diff --git "a/stuff/config/loc/\346\227\245\346\234\254\350\252\236/toonz.qm" "b/stuff/config/loc/\346\227\245\346\234\254\350\252\236/toonz.qm" index 4205309..67d8eeb 100644 Binary files "a/stuff/config/loc/\346\227\245\346\234\254\350\252\236/toonz.qm" and "b/stuff/config/loc/\346\227\245\346\234\254\350\252\236/toonz.qm" differ diff --git a/toonz/sources/include/toonzqt/selection.h b/toonz/sources/include/toonzqt/selection.h index 57e7243..90e76c2 100644 --- a/toonz/sources/include/toonzqt/selection.h +++ b/toonz/sources/include/toonzqt/selection.h @@ -19,6 +19,8 @@ class QMenu; class QWidget; +#include + //============================================================================= // TSelection //----------------------------------------------------------------------------- @@ -74,8 +76,17 @@ public: void notifyView(); + // specify alternative command name when the selection is current. + // the commands must be "Edit" category. + const QMap &alternativeCommandNames() { + return m_alternativeCommandNames; + } + private: View *m_view; + +protected: + QMap m_alternativeCommandNames; }; #endif // TSELECTION_H diff --git a/toonz/sources/toonz/cellselection.cpp b/toonz/sources/toonz/cellselection.cpp index 3b55ed1..2f34c58 100644 --- a/toonz/sources/toonz/cellselection.cpp +++ b/toonz/sources/toonz/cellselection.cpp @@ -1444,7 +1444,9 @@ int TCellSelection::Range::getColCount() const { return m_c1 - m_c0 + 1; } // TCellSelection //----------------------------------------------------------------------------- -TCellSelection::TCellSelection() : m_timeStretchPopup(0), m_reframePopup(0) {} +TCellSelection::TCellSelection() : m_timeStretchPopup(0), m_reframePopup(0) { + setAlternativeCommandNames(); +} //----------------------------------------------------------------------------- @@ -1512,6 +1514,19 @@ void TCellSelection::enableCommands() { enableCommand(this, MI_Duplicate, &TCellSelection::duplicateFrames); enableCommand(this, MI_PasteDuplicate, &TCellSelection::pasteDuplicateCells); } + +//----------------------------------------------------------------------------- + +void TCellSelection::setAlternativeCommandNames() { + m_alternativeCommandNames = { + {MI_Copy, QObject::tr("Copy Cells", "TCellSelection")}, + {MI_Paste, QObject::tr("Paste Cells", "TCellSelection")}, + {MI_PasteInto, QObject::tr("Overwrite Paste Cells", "TCellSelection")}, + {MI_Cut, QObject::tr("Cut Cells", "TCellSelection")}, + {MI_Clear, QObject::tr("Delete Cells", "TCellSelection")}, + {MI_Insert, QObject::tr("Insert Cells", "TCellSelection")}}; +} + //----------------------------------------------------------------------------- // Used in RenameCellField::eventFilter() diff --git a/toonz/sources/toonz/cellselection.h b/toonz/sources/toonz/cellselection.h index 13d8bc3..e1a04bd 100644 --- a/toonz/sources/toonz/cellselection.h +++ b/toonz/sources/toonz/cellselection.h @@ -40,6 +40,7 @@ public: ~TCellSelection(); void enableCommands() override; + void setAlternativeCommandNames(); bool isEmpty() const override; diff --git a/toonz/sources/toonz/columnselection.cpp b/toonz/sources/toonz/columnselection.cpp index 03780d6..d1d208f 100644 --- a/toonz/sources/toonz/columnselection.cpp +++ b/toonz/sources/toonz/columnselection.cpp @@ -67,7 +67,9 @@ void getLevelSetFromColumnIndices(const std::set& indices, // TColumnSelection //----------------------------------------------------------------------------- -TColumnSelection::TColumnSelection() : m_reframePopup(0) {} +TColumnSelection::TColumnSelection() : m_reframePopup(0) { + setAlternativeCommandNames(); +} //----------------------------------------------------------------------------- @@ -95,6 +97,16 @@ void TColumnSelection::enableCommands() { enableCommand(this, MI_ReframeWithEmptyInbetweens, &TColumnSelection::reframeWithEmptyInbetweens); } +//----------------------------------------------------------------------------- + +void TColumnSelection::setAlternativeCommandNames() { + m_alternativeCommandNames = { + {MI_Copy, QObject::tr("Copy Columns", "TColumnSelection")}, + {MI_Paste, QObject::tr("Paste Columns", "TColumnSelection")}, + {MI_Cut, QObject::tr("Cut Columns", "TColumnSelection")}, + {MI_Clear, QObject::tr("Delete Columns", "TColumnSelection")}, + {MI_Insert, QObject::tr("Insert Columns", "TColumnSelection")}}; +} //----------------------------------------------------------------------------- diff --git a/toonz/sources/toonz/columnselection.h b/toonz/sources/toonz/columnselection.h index fad2253..323751b 100644 --- a/toonz/sources/toonz/columnselection.h +++ b/toonz/sources/toonz/columnselection.h @@ -30,6 +30,7 @@ public: const std::set &getIndices() const { return m_indices; } void enableCommands() override; + void setAlternativeCommandNames(); void copyColumns(); void pasteColumns(); diff --git a/toonz/sources/toonz/mainwindow.cpp b/toonz/sources/toonz/mainwindow.cpp index 938b692..ba0f88e 100644 --- a/toonz/sources/toonz/mainwindow.cpp +++ b/toonz/sources/toonz/mainwindow.cpp @@ -1393,6 +1393,14 @@ QAction *MainWindow::createAction(const char *id, const char *name, CommandType type, const char *iconSVGName) { QAction *action = new DVAction(tr(name), this); + // For "edit" category menu commands may behave various function + // according to the current selection. + // Now the command name can be adjusted on switching the selection. + // Here we explicitly register the default text in order to recover the + // command name if the selection does not specify the alternative command + // name. + if (type == MenuEditCommandType) action->setIconText(tr(name)); + #if !defined(_WIN32) bool visible = Preferences::instance()->getBoolValue(showIconsInMenu); action->setIconVisibleInMenu(visible); diff --git a/toonz/sources/toonzqt/tselectionhandle.cpp b/toonz/sources/toonzqt/tselectionhandle.cpp index 232a3b8..69b9b1e 100644 --- a/toonz/sources/toonzqt/tselectionhandle.cpp +++ b/toonz/sources/toonzqt/tselectionhandle.cpp @@ -23,18 +23,35 @@ TSelection *TSelectionHandle::getSelection() const { void TSelectionHandle::setSelection(TSelection *selection) { if (getSelection() == selection) return; - TSelection *oldSelection = getSelection(); + TSelection *oldSelection = getSelection(); + CommandManager *commandManager = CommandManager::instance(); if (oldSelection) { oldSelection->selectNone(); // disable selection related commands - CommandManager *commandManager = CommandManager::instance(); int i; for (i = 0; i < (int)m_enabledCommandIds.size(); i++) commandManager->setHandler(m_enabledCommandIds[i].c_str(), 0); m_enabledCommandIds.clear(); + + // revert alternative command names to original ones kept in the icon texts + for (auto commandId : oldSelection->alternativeCommandNames().keys()) { + QAction *action = commandManager->getAction(commandId); + action->setText(action->iconText()); + } } m_selectionStack.back() = selection; - if (selection) selection->enableCommands(); + if (selection) { + selection->enableCommands(); + + // set alternative command names + QMap::const_iterator i = + selection->alternativeCommandNames().constBegin(); + while (i != selection->alternativeCommandNames().constEnd()) { + QAction *action = commandManager->getAction(i.key()); + action->setText(i.value()); + ++i; + } + } emit selectionSwitched(oldSelection, selection); } diff --git a/toonz/sources/translations/japanese/toonz.ts b/toonz/sources/translations/japanese/toonz.ts index b0af635..31415a8 100644 --- a/toonz/sources/translations/japanese/toonz.ts +++ b/toonz/sources/translations/japanese/toonz.ts @@ -11680,7 +11680,7 @@ Are you sure to Paste Column : - 列を貼り付け : + 列の貼り付け : Delete Column : @@ -11800,7 +11800,7 @@ Are you sure to Cut Cells - コマのカット + コマの切り取り Insert Cells @@ -12947,6 +12947,61 @@ Do you wish to continue loading the last good save or stop and try to salvage th + Copy Columns + TColumnSelection + 列のコピー + + + Paste Columns + TColumnSelection + 列の貼り付け + + + Cut Columns + TColumnSelection + 列の切り取り + + + Delete Columns + TColumnSelection + 列の削除 + + + Insert Columns + TColumnSelection + 列を挿入 + + + Copy Cells + TCellSelection + コマのコピー + + + Paste Cells + TCellSelection + コマの貼り付け + + + Overwrite Paste Cells + TCellSelection + コマを上書きして貼り付け + + + Cut Cells + TCellSelection + コマの切り取り + + + Delete Cells + TCellSelection + コマの削除 + + + Insert Cells + TCellSelection + 空白コマの挿入 + + Pasting external image from clipboard. What do you want to do?