mirror of https://github.com/odrling/Aegisub
Rename edit/line/swap to grid/swap and grid/swap/* to grid/move/*
Continue moving all the reordering commands to grid (why were they in three different categories?), and change swap to move to better reflect what they do. Originally committed to SVN as r6287.
This commit is contained in:
parent
e2984b93b0
commit
7e557c1dad
|
@ -321,33 +321,6 @@ struct edit_line_split_by_karaoke : public validate_sel_nonempty {
|
|||
}
|
||||
};
|
||||
|
||||
|
||||
/// Swaps the two selected lines.
|
||||
struct edit_line_swap : public Command {
|
||||
CMD_NAME("edit/line/swap")
|
||||
STR_MENU("Swap Lines")
|
||||
STR_DISP("Swap Lines")
|
||||
STR_HELP("Swaps the two selected lines.")
|
||||
CMD_TYPE(COMMAND_VALIDATE)
|
||||
|
||||
bool Validate(const agi::Context *c) {
|
||||
return c->selectionController->GetSelectedSet().size() == 2;
|
||||
}
|
||||
|
||||
void operator()(agi::Context *c) {
|
||||
SelectionController<AssDialogue>::Selection sel = c->selectionController->GetSelectedSet();
|
||||
if (sel.size() == 2) {
|
||||
entryIter a = find(c->ass->Line.begin(), c->ass->Line.end(), *sel.begin());
|
||||
entryIter b = find(c->ass->Line.begin(), c->ass->Line.end(), *sel.rbegin());
|
||||
|
||||
using std::swap;
|
||||
swap(*a, *b);
|
||||
c->ass->Commit(_("swap lines"), AssFile::COMMIT_ORDER);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
/// Redoes last action.
|
||||
struct edit_redo : public Command {
|
||||
CMD_NAME("edit/redo")
|
||||
|
@ -420,7 +393,6 @@ namespace cmd {
|
|||
reg(new edit_line_paste_over);
|
||||
reg(new edit_line_recombine);
|
||||
reg(new edit_line_split_by_karaoke);
|
||||
reg(new edit_line_swap);
|
||||
reg(new edit_redo);
|
||||
reg(new edit_undo);
|
||||
}
|
||||
|
|
|
@ -213,9 +213,9 @@ static bool move_one(T begin, T end, U value) {
|
|||
return false;
|
||||
}
|
||||
|
||||
/// Swap the active line with the dialogue line above it
|
||||
struct grid_swap_up : public Command {
|
||||
CMD_NAME("grid/swap/up")
|
||||
/// Move the active line up one row
|
||||
struct grid_move_up : public Command {
|
||||
CMD_NAME("grid/move/up")
|
||||
STR_MENU("Move line up")
|
||||
STR_DISP("Move line up")
|
||||
STR_HELP("Move the selected line up one row")
|
||||
|
@ -228,14 +228,14 @@ struct grid_swap_up : public Command {
|
|||
void operator()(agi::Context *c) {
|
||||
if (AssDialogue *line = c->selectionController->GetActiveLine()) {
|
||||
if (move_one(c->ass->Line.rbegin(), c->ass->Line.rend(), line))
|
||||
c->ass->Commit(_("swap lines"), AssFile::COMMIT_ORDER);
|
||||
c->ass->Commit(_("move lines"), AssFile::COMMIT_ORDER);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
/// Swap the active line with the dialogue line below it
|
||||
struct grid_swap_down : public Command {
|
||||
CMD_NAME("grid/swap/down")
|
||||
/// Move the active line down one row
|
||||
struct grid_move_down : public Command {
|
||||
CMD_NAME("grid/move/down")
|
||||
STR_MENU("Move line down")
|
||||
STR_DISP("Move line down")
|
||||
STR_HELP("Move the selected line down one row")
|
||||
|
@ -248,10 +248,36 @@ struct grid_swap_down : public Command {
|
|||
void operator()(agi::Context *c) {
|
||||
if (AssDialogue *line = c->selectionController->GetActiveLine()) {
|
||||
if (move_one(c->ass->Line.begin(), c->ass->Line.end(), line))
|
||||
c->ass->Commit(_("move lines"), AssFile::COMMIT_ORDER);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
/// Swaps the two selected lines.
|
||||
struct grid_swap : public Command {
|
||||
CMD_NAME("grid/swap")
|
||||
STR_MENU("Swap Lines")
|
||||
STR_DISP("Swap Lines")
|
||||
STR_HELP("Swaps the two selected lines.")
|
||||
CMD_TYPE(COMMAND_VALIDATE)
|
||||
|
||||
bool Validate(const agi::Context *c) {
|
||||
return c->selectionController->GetSelectedSet().size() == 2;
|
||||
}
|
||||
|
||||
void operator()(agi::Context *c) {
|
||||
SelectionController<AssDialogue>::Selection sel = c->selectionController->GetSelectedSet();
|
||||
if (sel.size() == 2) {
|
||||
entryIter a = find(c->ass->Line.begin(), c->ass->Line.end(), *sel.begin());
|
||||
entryIter b = find(c->ass->Line.begin(), c->ass->Line.end(), *sel.rbegin());
|
||||
|
||||
using std::swap;
|
||||
swap(*a, *b);
|
||||
c->ass->Commit(_("swap lines"), AssFile::COMMIT_ORDER);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
}
|
||||
/// @}
|
||||
|
||||
|
@ -262,8 +288,9 @@ namespace cmd {
|
|||
reg(new grid_sort_end);
|
||||
reg(new grid_sort_start);
|
||||
reg(new grid_sort_style);
|
||||
reg(new grid_swap_down);
|
||||
reg(new grid_swap_up);
|
||||
reg(new grid_move_down);
|
||||
reg(new grid_move_up);
|
||||
reg(new grid_swap);
|
||||
reg(new grid_tag_cycle_hiding);
|
||||
reg(new grid_tags_hide);
|
||||
reg(new grid_tags_show);
|
||||
|
|
|
@ -148,13 +148,13 @@
|
|||
"key" : "KP_8"
|
||||
}
|
||||
],
|
||||
"grid/swap/down" : [
|
||||
"grid/move/down" : [
|
||||
{
|
||||
"modifiers" : [ "Alt" ],
|
||||
"key" : "Down"
|
||||
}
|
||||
],
|
||||
"grid/swap/up" : [
|
||||
"grid/move/up" : [
|
||||
{
|
||||
"modifiers" : [ "Alt" ],
|
||||
"key" : "Up"
|
||||
|
|
|
@ -8,7 +8,7 @@
|
|||
{ "command" : "edit/line/duplicate" },
|
||||
{ "command" : "edit/line/duplicate/shift" },
|
||||
{},
|
||||
{ "command" : "edit/line/swap" },
|
||||
{ "command" : "grid/swap" },
|
||||
{ "command" : "edit/line/join/concatenate", "text" : "&Join (concatenate)" },
|
||||
{ "command" : "edit/line/join/keep_first", "text" : "Join (keep first)" },
|
||||
{ "command" : "edit/line/join/as_karaoke", "text" : "Join (as Karaoke)" },
|
||||
|
@ -84,7 +84,7 @@
|
|||
{ "command" : "edit/line/split/by_karaoke" },
|
||||
{},
|
||||
{ "submenu" : "main/subtitle/sort lines", "text" : "Sort Lines" },
|
||||
{ "command" : "edit/line/swap" },
|
||||
{ "command" : "grid/swap" },
|
||||
{ "command" : "tool/line/select" },
|
||||
{ "command" : "subtitle/select/all" }
|
||||
],
|
||||
|
|
Loading…
Reference in New Issue