diff --git a/src/laybasic/laybasic/layEditorOptionsPage.h b/src/laybasic/laybasic/layEditorOptionsPage.h index c5d605bff..9e7deedd3 100644 --- a/src/laybasic/laybasic/layEditorOptionsPage.h +++ b/src/laybasic/laybasic/layEditorOptionsPage.h @@ -252,7 +252,7 @@ public: /** * @brief Gets a value indicating whether the page is for that specific plugin (given by a declaration object) */ - bool for_plugin_declaration (const lay::PluginDeclaration *pd) + bool for_plugin_declaration (const lay::PluginDeclaration *pd) const { return m_plugin_declarations.find (pd) != m_plugin_declarations.end (); } diff --git a/src/laybasic/laybasic/layLayoutViewBase.h b/src/laybasic/laybasic/layLayoutViewBase.h index e754ebfbb..e3a1ff7b3 100644 --- a/src/laybasic/laybasic/layLayoutViewBase.h +++ b/src/laybasic/laybasic/layLayoutViewBase.h @@ -2225,6 +2225,14 @@ public: return pi; } + /** + * @brief Gets the active plugin + */ + lay::Plugin *active_plugin () const + { + return mp_active_plugin; + } + /** * @brief Create a plugin of the given type * @@ -3214,11 +3222,6 @@ protected: void init (db::Manager *mgr); - lay::Plugin *active_plugin () const - { - return mp_active_plugin; - } - virtual LayoutView *get_ui (); bool configure (const std::string &name, const std::string &value); diff --git a/src/laybasic/laybasic/laySelector.cc b/src/laybasic/laybasic/laySelector.cc index 9d60b1e63..241b9f496 100644 --- a/src/laybasic/laybasic/laySelector.cc +++ b/src/laybasic/laybasic/laySelector.cc @@ -332,6 +332,14 @@ public: { return new SelectionService (view); } + + virtual std::vector additional_editor_options_pages () const + { + std::vector names; + // TODO: provide in a central place instead of borrowing from the edt module + names.push_back ("GenericEditorOptions"); + return names; + } }; static tl::RegisteredClass selection_service_decl (new SelectionServiceDeclaration (), -980, "laybasic::SelectionServicePlugin"); diff --git a/src/layview/layview/layEditorOptionsPages.cc b/src/layview/layview/layEditorOptionsPages.cc index 0db1877de..6e3dd2d6a 100644 --- a/src/layview/layview/layEditorOptionsPages.cc +++ b/src/layview/layview/layEditorOptionsPages.cc @@ -120,8 +120,13 @@ EditorOptionsPages::editor_options_pages () bool EditorOptionsPages::has_content () const { + lay::Plugin *plugin = mp_view->active_plugin (); + if (! plugin) { + return false; + } + for (auto p = m_pages.begin (); p != m_pages.end (); ++p) { - if (p->active () && ! p->is_modal_page () && ! p->is_toolbox_widget ()) { + if (! p->is_modal_page () && ! p->is_toolbox_widget () && p->for_plugin_declaration (plugin->plugin_declaration ())) { return true; } } @@ -131,8 +136,13 @@ EditorOptionsPages::has_content () const bool EditorOptionsPages::has_modal_content () const { + lay::Plugin *plugin = mp_view->active_plugin (); + if (! plugin) { + return false; + } + for (auto p = m_pages.begin (); p != m_pages.end (); ++p) { - if (p->active () && p->is_modal_page () && ! p->is_toolbox_widget ()) { + if (p->is_modal_page () && ! p->is_toolbox_widget () && p->for_plugin_declaration (plugin->plugin_declaration ())) { return true; } } @@ -173,7 +183,7 @@ EditorOptionsPages::activate (const lay::Plugin *plugin) bool is_active = plugin && op->for_plugin_declaration (plugin->plugin_declaration ()); // The zero order page is picked as the initial one - if (is_active && ! op->active () && op->order () == 0 && page == 0) { + if (is_active && ! op->active () && (op->order () == 0 || page == 0)) { page = op.operator-> (); }