diff --git a/src/lay/lay/layMainWindow.cc b/src/lay/lay/layMainWindow.cc index 4d900946e..6e62dc9ae 100644 --- a/src/lay/lay/layMainWindow.cc +++ b/src/lay/lay/layMainWindow.cc @@ -1865,22 +1865,6 @@ MainWindow::select_mode (int m) } } -void -MainWindow::enable_all () -{ - for (tl::Registrar::iterator cls = tl::Registrar::begin (); cls != tl::Registrar::end (); ++cls) { - cls->set_editable_enabled (true); - } -} - -void -MainWindow::disable_all () -{ - for (tl::Registrar::iterator cls = tl::Registrar::begin (); cls != tl::Registrar::end (); ++cls) { - cls->set_editable_enabled (false); - } -} - void MainWindow::cm_reset_window_state () { @@ -3848,6 +3832,13 @@ MainWindow::menu_activated (const std::string &symbol) cm_help_about_qt (); } else { + // Try the plugin declarations + for (tl::Registrar::iterator cls = tl::Registrar::begin (); cls != tl::Registrar::end (); ++cls) { + if (cls->menu_activated (symbol)) { + return; + } + } + // TODO: this can be part of the Plugin scheme, but the plugin root has no idea which is the active // view. if (current_view ()) { diff --git a/src/lay/lay/layMainWindow.h b/src/lay/lay/layMainWindow.h index bc84fdb86..76b3e8276 100644 --- a/src/lay/lay/layMainWindow.h +++ b/src/lay/lay/layMainWindow.h @@ -636,8 +636,6 @@ public slots: void exit (); void close_current_view (); void tab_close_requested (int); - void enable_all (); - void disable_all (); void open_recent (size_t n); void view_selected (int index); void view_title_changed (); diff --git a/src/laybasic/laybasic/layLayoutView.cc b/src/laybasic/laybasic/layLayoutView.cc index 0cd7a6494..a4b8c6b90 100644 --- a/src/laybasic/laybasic/layLayoutView.cc +++ b/src/laybasic/laybasic/layLayoutView.cc @@ -6632,6 +6632,15 @@ LayoutView::menu_symbols () void LayoutView::menu_activated (const std::string &symbol) { + // Try the plugin declarations if the view is the top-level dispatcher + if (dispatcher () == this) { + for (tl::Registrar::iterator cls = tl::Registrar::begin (); cls != tl::Registrar::end (); ++cls) { + if (cls->menu_activated (symbol)) { + return; + } + } + } + if (symbol == "cm_show_properties") { show_properties (this); } else if (symbol == "cm_delete") { @@ -8042,8 +8051,8 @@ public: menu_entries.push_back (lay::menu_item ("cm_select_all", "select_all", at, tl::to_string (QObject::tr ("Select All")))); menu_entries.push_back (lay::menu_item ("cm_unselect_all", "unselect_all", at, tl::to_string (QObject::tr ("Unselect All")))); menu_entries.push_back (lay::separator ("edit_select_basic_group", at)); - menu_entries.push_back (lay::menu_item ("enable_all", "enable_all", at, tl::to_string (QObject::tr ("Enable All")))); - menu_entries.push_back (lay::menu_item ("disable_all", "disable_all", at, tl::to_string (QObject::tr ("Disable All")))); + menu_entries.push_back (lay::menu_item ("lv:enable_all", "enable_all", at, tl::to_string (QObject::tr ("Enable All")))); + menu_entries.push_back (lay::menu_item ("lv:disable_all", "disable_all", at, tl::to_string (QObject::tr ("Disable All")))); menu_entries.push_back (lay::separator ("edit_select_individual_group", at)); }; @@ -8109,6 +8118,27 @@ public: } + bool menu_activated (const std::string &symbol) const + { + if (symbol == "lv:enable_all") { + + for (tl::Registrar::iterator cls = tl::Registrar::begin (); cls != tl::Registrar::end (); ++cls) { + cls->set_editable_enabled (true); + } + return true; + + } else if (symbol == "lv:disable_all") { + + for (tl::Registrar::iterator cls = tl::Registrar::begin (); cls != tl::Registrar::end (); ++cls) { + cls->set_editable_enabled (false); + } + return true; + + } else { + return false; + } + } + void implements_primary_mouse_modes (std::vector > > &modes) { std::vector mode_titles;