mirror of https://github.com/KLayout/klayout.git
Merge pull request #2342 from KLayout/feature/issue-2335
Fixing issue #2335
This commit is contained in:
commit
8488c59c15
|
|
@ -252,7 +252,7 @@ public:
|
||||||
/**
|
/**
|
||||||
* @brief Gets a value indicating whether the page is for that specific plugin (given by a declaration object)
|
* @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 ();
|
return m_plugin_declarations.find (pd) != m_plugin_declarations.end ();
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -2225,6 +2225,14 @@ public:
|
||||||
return pi;
|
return pi;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Gets the active plugin
|
||||||
|
*/
|
||||||
|
lay::Plugin *active_plugin () const
|
||||||
|
{
|
||||||
|
return mp_active_plugin;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Create a plugin of the given type
|
* @brief Create a plugin of the given type
|
||||||
*
|
*
|
||||||
|
|
@ -3214,11 +3222,6 @@ protected:
|
||||||
|
|
||||||
void init (db::Manager *mgr);
|
void init (db::Manager *mgr);
|
||||||
|
|
||||||
lay::Plugin *active_plugin () const
|
|
||||||
{
|
|
||||||
return mp_active_plugin;
|
|
||||||
}
|
|
||||||
|
|
||||||
virtual LayoutView *get_ui ();
|
virtual LayoutView *get_ui ();
|
||||||
|
|
||||||
bool configure (const std::string &name, const std::string &value);
|
bool configure (const std::string &name, const std::string &value);
|
||||||
|
|
|
||||||
|
|
@ -332,6 +332,14 @@ public:
|
||||||
{
|
{
|
||||||
return new SelectionService (view);
|
return new SelectionService (view);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
virtual std::vector<std::string> additional_editor_options_pages () const
|
||||||
|
{
|
||||||
|
std::vector<std::string> names;
|
||||||
|
// TODO: provide in a central place instead of borrowing from the edt module
|
||||||
|
names.push_back ("GenericEditorOptions");
|
||||||
|
return names;
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
static tl::RegisteredClass<lay::PluginDeclaration> selection_service_decl (new SelectionServiceDeclaration (), -980, "laybasic::SelectionServicePlugin");
|
static tl::RegisteredClass<lay::PluginDeclaration> selection_service_decl (new SelectionServiceDeclaration (), -980, "laybasic::SelectionServicePlugin");
|
||||||
|
|
|
||||||
|
|
@ -120,8 +120,13 @@ EditorOptionsPages::editor_options_pages ()
|
||||||
bool
|
bool
|
||||||
EditorOptionsPages::has_content () const
|
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) {
|
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;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -131,8 +136,13 @@ EditorOptionsPages::has_content () const
|
||||||
bool
|
bool
|
||||||
EditorOptionsPages::has_modal_content () const
|
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) {
|
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;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -173,7 +183,7 @@ EditorOptionsPages::activate (const lay::Plugin *plugin)
|
||||||
bool is_active = plugin && op->for_plugin_declaration (plugin->plugin_declaration ());
|
bool is_active = plugin && op->for_plugin_declaration (plugin->plugin_declaration ());
|
||||||
|
|
||||||
// The zero order page is picked as the initial one
|
// 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-> ();
|
page = op.operator-> ();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue