Skip to content

OpenToonz - An open-source full-featured 2D animation creation software

C

add all shortcuts for selection tool

pojienie05f1e6ea3e88
diff --git a/toonz/sources/toonz/mainwindow.cpp b/toonz/sources/toonz/mainwindow.cpp
index 465d654e1..0fb3e2095 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);
@@ -2470,6 +2490,36 @@ void MainWindow::toggleEditNextAll() {
->trigger();
}
+//---------------------------------------------------------------------------------------
+/*-- 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() {
diff --git a/toonz/sources/toonz/mainwindow.h b/toonz/sources/toonz/mainwindow.h
index b283cce0f..bbefae49f 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 331cffdeb..5aa85292b 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"