diff --git a/toonz/sources/toonz/mainwindow.cpp b/toonz/sources/toonz/mainwindow.cpp index 465d654..0fb3e20 100644 --- a/toonz/sources/toonz/mainwindow.cpp +++ b/toonz/sources/toonz/mainwindow.cpp @@ -452,6 +452,16 @@ centralWidget->setLayout(centralWidgetLayout);*/ setCommandHandler(MI_EditCenter, this, &MainWindow::toggleEditNextCenter); setCommandHandler(MI_EditAll, this, &MainWindow::toggleEditNextAll); + /*-- Selection tool + mode switching shortcuts --*/ + setCommandHandler(MI_SelectionNextMode, this, + &MainWindow::toggleSelectionNextMode); + setCommandHandler(MI_SelectionRectangular, this, + &MainWindow::toggleSelectionRectangular); + setCommandHandler(MI_SelectionFreehand, this, + &MainWindow::toggleSelectionFreehand); + setCommandHandler(MI_SelectionPolyline, this, + &MainWindow::toggleSelectionPolyline); + /*-- FillAreas,FillLinesに直接切り替えるコマンド --*/ setCommandHandler(MI_FillAreas, this, &MainWindow::toggleFillAreas); setCommandHandler(MI_FillLines, this, &MainWindow::toggleFillLines); @@ -2372,6 +2382,16 @@ void MainWindow::defineActions() { createAction(MI_EditCenter, tr("Animate Tool - Center"), "", ToolCommandType); createAction(MI_EditAll, tr("Animate Tool - All"), "", ToolCommandType); + /*-- Selection tool + mode switching shortcuts --*/ + createAction(MI_SelectionNextMode, tr("Selection Tool - Next Mode"), "", + ToolCommandType); + createAction(MI_SelectionRectangular, tr("Selection Tool - Rectangular"), "", + ToolCommandType); + createAction(MI_SelectionFreehand, tr("Selection Tool - Freehand"), "", + ToolCommandType); + createAction(MI_SelectionPolyline, tr("Selection Tool - Polyline"), "", + ToolCommandType); + /*-- FillAreas, FillLinesにキー1つで切り替えるためのコマンド --*/ createAction(MI_FillAreas, tr("Fill Tool - Areas"), "", ToolCommandType); createAction(MI_FillLines, tr("Fill Tool - Lines"), "", ToolCommandType); @@ -2471,6 +2491,36 @@ void MainWindow::toggleEditNextAll() { } //--------------------------------------------------------------------------------------- +/*-- Selection tool + mode switching shortcuts --*/ +void MainWindow::toggleSelectionNextMode() { + if (TApp::instance()->getCurrentTool()->getTool()->getName() == T_Selection) + CommandManager::instance()->getAction("A_ToolOption_Type")->trigger(); + else + CommandManager::instance()->getAction(T_Selection)->trigger(); +} + +void MainWindow::toggleSelectionRectangular() { + CommandManager::instance()->getAction(T_Selection)->trigger(); + CommandManager::instance() + ->getAction("A_ToolOption_Type:Rectangular") + ->trigger(); +} + +void MainWindow::toggleSelectionFreehand() { + CommandManager::instance()->getAction(T_Selection)->trigger(); + CommandManager::instance() + ->getAction("A_ToolOption_Type:Freehand") + ->trigger(); +} + +void MainWindow::toggleSelectionPolyline() { + CommandManager::instance()->getAction(T_Selection)->trigger(); + CommandManager::instance() + ->getAction("A_ToolOption_Type:Polyline") + ->trigger(); +} + +//--------------------------------------------------------------------------------------- /*-- FillAreas, FillLinesにキー1つで切り替えるためのコマンド --*/ void MainWindow::toggleFillAreas() { CommandManager::instance()->getAction(T_Fill)->trigger(); diff --git a/toonz/sources/toonz/mainwindow.h b/toonz/sources/toonz/mainwindow.h index b283cce..bbefae4 100644 --- a/toonz/sources/toonz/mainwindow.h +++ b/toonz/sources/toonz/mainwindow.h @@ -116,6 +116,12 @@ public: void toggleEditNextCenter(); void toggleEditNextAll(); + /*-- Selection tool + mode switching shortcuts --*/ + void toggleSelectionNextMode(); + void toggleSelectionRectangular(); + void toggleSelectionFreehand(); + void toggleSelectionPolyline(); + /*-- FillAreas,FillLinesに直接切り替えるコマンド --*/ void toggleFillAreas(); void toggleFillLines(); diff --git a/toonz/sources/toonz/menubarcommandids.h b/toonz/sources/toonz/menubarcommandids.h index 331cffd..5aa8529 100644 --- a/toonz/sources/toonz/menubarcommandids.h +++ b/toonz/sources/toonz/menubarcommandids.h @@ -343,6 +343,11 @@ #define MI_EditCenter "MI_EditCenter" #define MI_EditAll "MI_EditAll" +#define MI_SelectionNextMode "MI_SelectionNextMode" +#define MI_SelectionRectangular "MI_SelectionRectangular" +#define MI_SelectionFreehand "MI_SelectionFreehand" +#define MI_SelectionPolyline "MI_SelectionPolyline" + #define MI_FillAreas "MI_FillAreas" #define MI_FillLines "MI_FillLines" #define MI_PickStyleAreas "MI_PickStyleAreas"