From fa1b98c9335b167f3985889696abb49232a083cb Mon Sep 17 00:00:00 2001 From: Matthias Koefferlein Date: Fri, 7 Feb 2020 01:11:23 +0100 Subject: [PATCH] WIP: refactoring ongoing. --- src/ant/ant/antConfigPage.cc | 17 +++--- src/ant/ant/antConfigPage.h | 16 +++--- src/ant/ant/antPlugin.cc | 24 ++++---- src/ant/ant/antPlugin.h | 6 +- src/edt/edt/edtEditorOptionsPages.cc | 4 +- src/edt/edt/edtEditorOptionsPages.h | 10 ++-- src/edt/edt/edtMainService.cc | 2 +- src/edt/edt/edtMainService.h | 6 +- src/edt/edt/edtPartialService.cc | 2 +- src/edt/edt/edtPartialService.h | 6 +- src/edt/edt/edtPlugin.cc | 83 ++++++++++++++-------------- src/edt/edt/edtPlugin.h | 4 +- src/edt/edt/edtService.cc | 4 +- src/edt/edt/edtServiceImpl.cc | 10 ++-- src/img/img/imgPlugin.cc | 2 +- src/img/img/imgPlugin.h | 2 +- src/lay/lay/layApplication.cc | 62 ++++++++++----------- src/lay/lay/layApplication.h | 12 ++-- src/lay/lay/layClipDialog.cc | 4 +- src/lay/lay/layClipDialog.h | 2 +- src/lay/lay/layFillDialog.cc | 4 +- src/lay/lay/layMacroEditorDialog.h | 4 +- 22 files changed, 143 insertions(+), 143 deletions(-) diff --git a/src/ant/ant/antConfigPage.cc b/src/ant/ant/antConfigPage.cc index ca06d1b93..64c07fcae 100644 --- a/src/ant/ant/antConfigPage.cc +++ b/src/ant/ant/antConfigPage.cc @@ -28,6 +28,7 @@ #include "ui_RulerConfigPage4.h" #include "antConfig.h" #include "layConverters.h" +#include "layDispatcher.h" #include "layQtTools.h" #include "tlExceptions.h" @@ -53,7 +54,7 @@ ConfigPage::~ConfigPage () } void -ConfigPage::setup (lay::PluginRoot *root) +ConfigPage::setup (lay::Dispatcher *root) { // Snap range int snap_range = 0; @@ -69,7 +70,7 @@ ConfigPage::setup (lay::PluginRoot *root) } void -ConfigPage::commit (lay::PluginRoot *root) +ConfigPage::commit (lay::Dispatcher *root) { root->config_set (cfg_ruler_obj_snap, mp_ui->ruler_obj_snap_cbx->isChecked ()); root->config_set (cfg_ruler_grid_snap, mp_ui->ruler_grid_snap_cbx->isChecked ()); @@ -99,7 +100,7 @@ ConfigPage2::~ConfigPage2 () } void -ConfigPage2::setup (lay::PluginRoot *root) +ConfigPage2::setup (lay::Dispatcher *root) { // Max. number of rulers int max_number_of_rulers = -1; @@ -122,7 +123,7 @@ ConfigPage2::setup (lay::PluginRoot *root) } void -ConfigPage2::commit (lay::PluginRoot *root) +ConfigPage2::commit (lay::Dispatcher *root) { int mr; try { @@ -153,7 +154,7 @@ ConfigPage3::~ConfigPage3 () } void -ConfigPage3::setup (lay::PluginRoot *root) +ConfigPage3::setup (lay::Dispatcher *root) { // snap mode lay::angle_constraint_type rm = lay::AC_Any; @@ -166,7 +167,7 @@ ConfigPage3::setup (lay::PluginRoot *root) } void -ConfigPage3::commit (lay::PluginRoot *root) +ConfigPage3::commit (lay::Dispatcher *root) { lay::angle_constraint_type rm = lay::AC_Any; if (mp_ui->ruler_any_angle_rb->isChecked ()) { @@ -215,7 +216,7 @@ ConfigPage4::~ConfigPage4 () } void -ConfigPage4::setup (lay::PluginRoot *root) +ConfigPage4::setup (lay::Dispatcher *root) { // templates root->config_get (cfg_ruler_templates, m_ruler_templates, TemplatesConverter ()); @@ -236,7 +237,7 @@ ConfigPage4::setup (lay::PluginRoot *root) } void -ConfigPage4::commit (lay::PluginRoot *root) +ConfigPage4::commit (lay::Dispatcher *root) { commit (); diff --git a/src/ant/ant/antConfigPage.h b/src/ant/ant/antConfigPage.h index 9142b4d7e..fe5853948 100644 --- a/src/ant/ant/antConfigPage.h +++ b/src/ant/ant/antConfigPage.h @@ -50,8 +50,8 @@ public: ConfigPage (QWidget *parent); ~ConfigPage (); - virtual void setup (lay::PluginRoot *root); - virtual void commit (lay::PluginRoot *root); + virtual void setup (lay::Dispatcher *root); + virtual void commit (lay::Dispatcher *root); private: Ui::RulerConfigPage *mp_ui; @@ -69,8 +69,8 @@ public: ConfigPage2 (QWidget *parent); ~ConfigPage2 (); - virtual void setup (lay::PluginRoot *root); - virtual void commit (lay::PluginRoot *root); + virtual void setup (lay::Dispatcher *root); + virtual void commit (lay::Dispatcher *root); private: Ui::RulerConfigPage2 *mp_ui; @@ -88,8 +88,8 @@ public: ConfigPage3 (QWidget *parent); ~ConfigPage3 (); - virtual void setup (lay::PluginRoot *root); - virtual void commit (lay::PluginRoot *root); + virtual void setup (lay::Dispatcher *root); + virtual void commit (lay::Dispatcher *root); private: Ui::RulerConfigPage3 *mp_ui; @@ -107,8 +107,8 @@ public: ConfigPage4 (QWidget *parent); ~ConfigPage4 (); - virtual void setup (lay::PluginRoot *root); - virtual void commit (lay::PluginRoot *root); + virtual void setup (lay::Dispatcher *root); + virtual void commit (lay::Dispatcher *root); public slots: void add_clicked (); diff --git a/src/ant/ant/antPlugin.cc b/src/ant/ant/antPlugin.cc index 5a9391fff..67de17128 100644 --- a/src/ant/ant/antPlugin.cc +++ b/src/ant/ant/antPlugin.cc @@ -23,9 +23,9 @@ #include "layPlugin.h" #include "layAbstractMenu.h" -#include "layAbstractMenuProvider.h" #include "layConverters.h" #include "layConfigurationDialog.h" +#include "layDispatcher.h" #include "antConfigPage.h" #include "antConfig.h" #include "antPlugin.h" @@ -85,13 +85,13 @@ void PluginDeclaration::get_menu_entries (std::vector &menu_entries) const { lay::PluginDeclaration::get_menu_entries (menu_entries); - menu_entries.push_back (lay::MenuEntry ("rulers_group", "edit_menu.end")); - menu_entries.push_back (lay::MenuEntry ("ant::clear_all_rulers", "clear_all_rulers:edit", "edit_menu.end", tl::to_string (QObject::tr ("Clear All Rulers And Annotations(Ctrl+K)")))); - menu_entries.push_back (lay::MenuEntry ("ant::configure", "configure_rulers", "edit_menu.end", tl::to_string (QObject::tr ("Ruler And Annotation Setup")))); + menu_entries.push_back (lay::separator ("rulers_group", "edit_menu.end")); + menu_entries.push_back (lay::menu_item ("ant::clear_all_rulers", "clear_all_rulers:edit", "edit_menu.end", tl::to_string (QObject::tr ("Clear All Rulers And Annotations(Ctrl+K)")))); + menu_entries.push_back (lay::menu_item ("ant::configure", "configure_rulers", "edit_menu.end", tl::to_string (QObject::tr ("Ruler And Annotation Setup")))); } lay::Plugin * -PluginDeclaration::create_plugin (db::Manager *manager, lay::PluginRoot *, lay::LayoutView *view) const +PluginDeclaration::create_plugin (db::Manager *manager, lay::Dispatcher *, lay::LayoutView *view) const { return new ant::Service (manager, view); } @@ -101,7 +101,7 @@ PluginDeclaration::menu_activated (const std::string &symbol) const { if (symbol == "ant::configure") { - lay::ConfigurationDialog config_dialog (QApplication::activeWindow (), lay::PluginRoot::instance (), "ant::Plugin"); + lay::ConfigurationDialog config_dialog (QApplication::activeWindow (), lay::Dispatcher::instance (), "ant::Plugin"); config_dialog.exec (); return true; @@ -165,7 +165,7 @@ PluginDeclaration::config_finalize () } void -PluginDeclaration::initialized (lay::PluginRoot *root) +PluginDeclaration::initialized (lay::Dispatcher *root) { // Check if we already have templates (initial setup) bool any_templates = false; @@ -201,7 +201,7 @@ PluginDeclaration::initialized (lay::PluginRoot *root) } void -PluginDeclaration::uninitialize (lay::PluginRoot *) +PluginDeclaration::uninitialize (lay::Dispatcher *) { for (std::vector::iterator a = m_actions.begin (); a != m_actions.end (); ++a) { delete *a; @@ -212,7 +212,7 @@ PluginDeclaration::uninitialize (lay::PluginRoot *) void PluginDeclaration::update_current_template () { - lay::AbstractMenuProvider *mp = lay::AbstractMenuProvider::instance (); + lay::Dispatcher *mp = lay::Dispatcher::instance (); if (! mp || ! mp->menu ()) { return; } @@ -238,7 +238,7 @@ PluginDeclaration::update_current_template () void PluginDeclaration::update_menu () { - lay::AbstractMenuProvider *mp = lay::AbstractMenuProvider::instance (); + lay::Dispatcher *mp = lay::Dispatcher::instance (); if (! mp || ! mp->menu ()) { return; } @@ -296,8 +296,8 @@ PluginDeclaration::register_annotation_template (const ant::Template &t) } m_templates.push_back (t); - lay::PluginRoot::instance ()->config_set (cfg_ruler_templates, ant::TemplatesConverter ().to_string (m_templates)); - lay::PluginRoot::instance ()->config_end (); + lay::Dispatcher::instance ()->config_set (cfg_ruler_templates, ant::TemplatesConverter ().to_string (m_templates)); + lay::Dispatcher::instance ()->config_end (); } static tl::RegisteredClass config_decl (new ant::PluginDeclaration (), 3000, "ant::Plugin"); diff --git a/src/ant/ant/antPlugin.h b/src/ant/ant/antPlugin.h index 01f96b0c1..4201d9e82 100644 --- a/src/ant/ant/antPlugin.h +++ b/src/ant/ant/antPlugin.h @@ -40,14 +40,14 @@ public: virtual void get_options (std::vector < std::pair > &options) const; virtual void get_menu_entries (std::vector &menu_entries) const; - virtual lay::Plugin *create_plugin (db::Manager *manager, lay::PluginRoot *, lay::LayoutView *view) const; + virtual lay::Plugin *create_plugin (db::Manager *manager, lay::Dispatcher *, lay::LayoutView *view) const; virtual bool implements_editable (std::string &title) const; virtual bool implements_mouse_mode (std::string &title) const; virtual bool configure (const std::string &name, const std::string &value); virtual std::vector > config_pages (QWidget *parent) const; virtual void config_finalize (); - virtual void initialized (lay::PluginRoot *); - virtual void uninitialize (lay::PluginRoot *); + virtual void initialized (lay::Dispatcher *); + virtual void uninitialize (lay::Dispatcher *); virtual bool menu_activated (const std::string &symbol) const; void register_annotation_template (const ant::Template &t); diff --git a/src/edt/edt/edtEditorOptionsPages.cc b/src/edt/edt/edtEditorOptionsPages.cc index 47fd33bef..bd1940467 100644 --- a/src/edt/edt/edtEditorOptionsPages.cc +++ b/src/edt/edt/edtEditorOptionsPages.cc @@ -87,7 +87,7 @@ struct EOPCompareOp } }; -EditorOptionsPages::EditorOptionsPages (const std::vector &pages, lay::PluginRoot *root) +EditorOptionsPages::EditorOptionsPages (const std::vector &pages, lay::Dispatcher *root) : mp_root (root) { mp_ui = new Ui::EditorOptionsDialog (); @@ -515,7 +515,7 @@ EditorOptionsPath::setup (lay::Plugin *root) // ------------------------------------------------------------------ // EditorOptionsInst implementation -EditorOptionsInst::EditorOptionsInst (lay::PluginRoot *root) +EditorOptionsInst::EditorOptionsInst (lay::Dispatcher *root) : QWidget (), EditorOptionsPage (), mp_root (root), mp_pcell_parameters (0) { mp_ui = new Ui::EditorOptionsInst (); diff --git a/src/edt/edt/edtEditorOptionsPages.h b/src/edt/edt/edtEditorOptionsPages.h index 17ca75690..65145212f 100644 --- a/src/edt/edt/edtEditorOptionsPages.h +++ b/src/edt/edt/edtEditorOptionsPages.h @@ -44,7 +44,7 @@ namespace Ui namespace lay { class PluginDeclaration; - class PluginRoot; + class Dispatcher; class Plugin; } @@ -92,7 +92,7 @@ class EditorOptionsPages Q_OBJECT public: - EditorOptionsPages (const std::vector &pages, lay::PluginRoot *root); + EditorOptionsPages (const std::vector &pages, lay::Dispatcher *root); ~EditorOptionsPages (); void unregister_page (edt::EditorOptionsPage *page); @@ -106,7 +106,7 @@ public slots: private: std::vector m_pages; Ui::EditorOptionsDialog *mp_ui; - lay::PluginRoot *mp_root; + lay::Dispatcher *mp_root; void update (edt::EditorOptionsPage *page); void do_apply (); @@ -195,7 +195,7 @@ class EditorOptionsInst Q_OBJECT public: - EditorOptionsInst (lay::PluginRoot *root); + EditorOptionsInst (lay::Dispatcher *root); ~EditorOptionsInst (); virtual QWidget *q_frame () { return this; } @@ -214,7 +214,7 @@ public slots: private: Ui::EditorOptionsInst *mp_ui; - lay::PluginRoot *mp_root; + lay::Dispatcher *mp_root; edt::PCellParametersPage *mp_pcell_parameters; int m_cv_index; diff --git a/src/edt/edt/edtMainService.cc b/src/edt/edt/edtMainService.cc index 3c225096b..a5068438c 100644 --- a/src/edt/edt/edtMainService.cc +++ b/src/edt/edt/edtMainService.cc @@ -48,7 +48,7 @@ namespace edt // ----------------------------------------------------------------------------- // Main Service implementation -MainService::MainService (db::Manager *manager, lay::LayoutView *view, lay::PluginRoot *root) +MainService::MainService (db::Manager *manager, lay::LayoutView *view, lay::Dispatcher *root) : lay::Plugin (view), lay::Editable (view), db::Object (manager), diff --git a/src/edt/edt/edtMainService.h b/src/edt/edt/edtMainService.h index c81fa7177..743d8a9f4 100644 --- a/src/edt/edt/edtMainService.h +++ b/src/edt/edt/edtMainService.h @@ -38,7 +38,7 @@ #include namespace lay { - class PluginRoot; + class Dispatcher; class FlattenInstOptionsDialog; } @@ -63,7 +63,7 @@ public: /** * @brief The constructor */ - MainService (db::Manager *manager, lay::LayoutView *view, lay::PluginRoot *root); + MainService (db::Manager *manager, lay::LayoutView *view, lay::Dispatcher *root); /** * @brief The destructor @@ -196,7 +196,7 @@ public: private: // The layout view that this service is attached to lay::LayoutView *mp_view; - lay::PluginRoot *mp_root; + lay::Dispatcher *mp_root; bool m_needs_update; // options diff --git a/src/edt/edt/edtPartialService.cc b/src/edt/edt/edtPartialService.cc index d4feedf38..f66da5b94 100644 --- a/src/edt/edt/edtPartialService.cc +++ b/src/edt/edt/edtPartialService.cc @@ -1007,7 +1007,7 @@ PartialShapeFinder::visit_cell (const db::Cell &cell, const db::Box &search_box, // ----------------------------------------------------------------------------- // Main Service implementation -PartialService::PartialService (db::Manager *manager, lay::LayoutView *view, lay::PluginRoot *root) +PartialService::PartialService (db::Manager *manager, lay::LayoutView *view, lay::Dispatcher *root) : QObject (), lay::ViewService (view->view_object_widget ()), lay::Editable (view), diff --git a/src/edt/edt/edtPartialService.h b/src/edt/edt/edtPartialService.h index 0df2bb880..2c22ac21c 100644 --- a/src/edt/edt/edtPartialService.h +++ b/src/edt/edt/edtPartialService.h @@ -44,7 +44,7 @@ namespace db { } namespace lay { - class PluginRoot; + class Dispatcher; class Marker; class InstanceMarker; } @@ -153,7 +153,7 @@ public: /** * @brief The constructor */ - PartialService (db::Manager *manager, lay::LayoutView *view, lay::PluginRoot *root); + PartialService (db::Manager *manager, lay::LayoutView *view, lay::Dispatcher *root); /** * @brief The destructor @@ -288,7 +288,7 @@ protected: private: // The layout view that this service is attached to lay::LayoutView *mp_view; - lay::PluginRoot *mp_root; + lay::Dispatcher *mp_root; bool m_dragging; bool m_keep_selection; db::DPoint m_start, m_current; diff --git a/src/edt/edt/edtPlugin.cc b/src/edt/edt/edtPlugin.cc index 38c2c9fd4..9508c09f3 100644 --- a/src/edt/edt/edtPlugin.cc +++ b/src/edt/edt/edtPlugin.cc @@ -22,7 +22,6 @@ #include "layTipDialog.h" -#include "layAbstractMenuProvider.h" #include "edtPlugin.h" #include "edtConfig.h" #include "edtService.h" @@ -46,7 +45,7 @@ void get_text_options (std::vector < std::pair > &opti } static -void get_text_editor_options_pages (std::vector &ret, lay::PluginRoot *) +void get_text_editor_options_pages (std::vector &ret, lay::Dispatcher *) { ret.push_back (new edt::EditorOptionsText ()); } @@ -61,7 +60,7 @@ void get_path_options (std::vector < std::pair > &opti } static -void get_path_editor_options_pages (std::vector &ret, lay::PluginRoot *) +void get_path_editor_options_pages (std::vector &ret, lay::Dispatcher *) { ret.push_back (new EditorOptionsPath ()); } @@ -86,7 +85,7 @@ void get_inst_options (std::vector < std::pair > &opti } static -void get_inst_editor_options_pages (std::vector &ret, lay::PluginRoot *root) +void get_inst_editor_options_pages (std::vector &ret, lay::Dispatcher *root) { ret.push_back (new EditorOptionsInst (root)); } @@ -98,7 +97,7 @@ class PluginDeclaration public: PluginDeclaration (const std::string &title, const std::string &mouse_mode, void (*option_get_f) (std::vector < std::pair > &) = 0, - void (*pages_f) (std::vector &, lay::PluginRoot *) = 0) + void (*pages_f) (std::vector &, lay::Dispatcher *) = 0) : m_title (title), m_mouse_mode (mouse_mode), mp_option_get_f (option_get_f), mp_pages_f (pages_f) { // .. nothing yet .. @@ -121,7 +120,7 @@ public: // .. nothing yet .. } - virtual void get_editor_options_pages (std::vector &pages, lay::PluginRoot *root) const + virtual void get_editor_options_pages (std::vector &pages, lay::Dispatcher *root) const { if (mp_pages_f != 0) { size_t nstart = pages.size (); @@ -132,7 +131,7 @@ public: } } - virtual lay::Plugin *create_plugin (db::Manager *manager, lay::PluginRoot *, lay::LayoutView *view) const + virtual lay::Plugin *create_plugin (db::Manager *manager, lay::Dispatcher *, lay::LayoutView *view) const { Svc *service = new Svc (manager, view); service->set_plugin_declaration (this); @@ -156,7 +155,7 @@ private: std::string m_mouse_mode; void (*mp_option_get_f) (std::vector < std::pair > &options); - void (*mp_pages_f) (std::vector &, lay::PluginRoot *); + void (*mp_pages_f) (std::vector &, lay::Dispatcher *); }; static tl::RegisteredClass config_decl1 ( @@ -215,33 +214,33 @@ public: { lay::PluginDeclaration::get_menu_entries (menu_entries); - menu_entries.push_back (lay::MenuEntry ("edt::hier_group", "zoom_menu.end")); - menu_entries.push_back (lay::MenuEntry ("edt::descend", "descend", "zoom_menu.end", tl::to_string (QObject::tr ("Descend")) + "(Ctrl+D)")); - menu_entries.push_back (lay::MenuEntry ("edt::ascend", "ascend", "zoom_menu.end", tl::to_string (QObject::tr ("Ascend")) + "(Ctrl+A)")); + menu_entries.push_back (lay::separator ("edt::hier_group", "zoom_menu.end")); + menu_entries.push_back (lay::menu_item ("edt::descend", "descend", "zoom_menu.end", tl::to_string (QObject::tr ("Descend")) + "(Ctrl+D)")); + menu_entries.push_back (lay::menu_item ("edt::ascend", "ascend", "zoom_menu.end", tl::to_string (QObject::tr ("Ascend")) + "(Ctrl+A)")); - menu_entries.push_back (lay::MenuEntry ("edit_options_group:edit_mode", "edit_menu.end")); - menu_entries.push_back (lay::MenuEntry ("edt::edit_options", "edit_options:edit_mode", "edit_menu.end", tl::to_string (QObject::tr ("Editor Options")) + "(F3)")); - menu_entries.push_back (lay::MenuEntry ("edt::sel_make_array", "make_array:edit_mode", "edit_menu.selection_menu.end", tl::to_string (QObject::tr ("Make Array")))); - menu_entries.push_back (lay::MenuEntry ("selection_group:edit_mode", "edit_menu.selection_menu.end")); - menu_entries.push_back (lay::MenuEntry ("edt::sel_change_layer", "change_layer:edit_mode", "edit_menu.selection_menu.end", tl::to_string (QObject::tr ("Change Layer")))); - menu_entries.push_back (lay::MenuEntry ("edt::sel_tap", "tap:edit_mode", "edit_menu.selection_menu.end", tl::to_string (QObject::tr ("Tap")) + "(T)")); - menu_entries.push_back (lay::MenuEntry ("edt::sel_align", "align:edit_mode", "edit_menu.selection_menu.end", tl::to_string (QObject::tr ("Align")))); - menu_entries.push_back (lay::MenuEntry ("edt::sel_round_corners", "round_corners:edit_mode", "edit_menu.selection_menu.end", tl::to_string (QObject::tr ("Round Corners")))); - menu_entries.push_back (lay::MenuEntry ("edt::sel_size", "size:edit_mode", "edit_menu.selection_menu.end", tl::to_string (QObject::tr ("Size Shapes")))); - menu_entries.push_back (lay::MenuEntry ("edt::sel_union", "union:edit_mode", "edit_menu.selection_menu.end", tl::to_string (QObject::tr ("Merge Shapes")))); - menu_entries.push_back (lay::MenuEntry ("edt::sel_intersection", "intersection:edit_mode", "edit_menu.selection_menu.end", tl::to_string (QObject::tr ("Intersection - Others With First")))); - menu_entries.push_back (lay::MenuEntry ("edt::sel_difference", "difference:edit_mode", "edit_menu.selection_menu.end", tl::to_string (QObject::tr ("Subtraction - Others From First")))); - menu_entries.push_back (lay::MenuEntry ("edt::sel_separate", "separate:edit_mode", "edit_menu.selection_menu.end", tl::to_string (QObject::tr ("Separate - First into Inside/Outside Others")))); - menu_entries.push_back (lay::MenuEntry ("hier_group:edit_mode", "edit_menu.selection_menu.end")); - menu_entries.push_back (lay::MenuEntry ("edt::sel_flatten_insts", "flatten_insts:edit_mode", "edit_menu.selection_menu.end", tl::to_string (QObject::tr ("Flatten Instances")))); - menu_entries.push_back (lay::MenuEntry ("edt::sel_resolve_arefs", "resolve_arefs:edit_mode", "edit_menu.selection_menu.end", tl::to_string (QObject::tr ("Resolve Arrays")))); - menu_entries.push_back (lay::MenuEntry ("edt::sel_move_hier_up", "move_hier_up:edit_mode", "edit_menu.selection_menu.end", tl::to_string (QObject::tr ("Move Up In Hierarchy")))); - menu_entries.push_back (lay::MenuEntry ("edt::sel_make_cell", "make_cell:edit_mode", "edit_menu.selection_menu.end", tl::to_string (QObject::tr ("Make Cell")))); - menu_entries.push_back (lay::MenuEntry ("edt::sel_make_cell_variants", "make_cell_variants:edit_mode", "edit_menu.selection_menu.end", tl::to_string (QObject::tr ("Make Cell Variants")))); - menu_entries.push_back (lay::MenuEntry ("edt::sel_convert_to_pcell", "convert_to_pcell:edit_mode", "edit_menu.selection_menu.end", tl::to_string (QObject::tr ("Convert To PCell")))); - menu_entries.push_back (lay::MenuEntry ("edt::sel_convert_to_cell", "convert_to_cell:edit_mode", "edit_menu.selection_menu.end", tl::to_string (QObject::tr ("Convert To Static Cell")))); + menu_entries.push_back (lay::separator ("edit_options_group:edit_mode", "edit_menu.end")); + menu_entries.push_back (lay::menu_item ("edt::edit_options", "edit_options:edit_mode", "edit_menu.end", tl::to_string (QObject::tr ("Editor Options")) + "(F3)")); + menu_entries.push_back (lay::menu_item ("edt::sel_make_array", "make_array:edit_mode", "edit_menu.selection_menu.end", tl::to_string (QObject::tr ("Make Array")))); + menu_entries.push_back (lay::separator ("selection_group:edit_mode", "edit_menu.selection_menu.end")); + menu_entries.push_back (lay::menu_item ("edt::sel_change_layer", "change_layer:edit_mode", "edit_menu.selection_menu.end", tl::to_string (QObject::tr ("Change Layer")))); + menu_entries.push_back (lay::menu_item ("edt::sel_tap", "tap:edit_mode", "edit_menu.selection_menu.end", tl::to_string (QObject::tr ("Tap")) + "(T)")); + menu_entries.push_back (lay::menu_item ("edt::sel_align", "align:edit_mode", "edit_menu.selection_menu.end", tl::to_string (QObject::tr ("Align")))); + menu_entries.push_back (lay::menu_item ("edt::sel_round_corners", "round_corners:edit_mode", "edit_menu.selection_menu.end", tl::to_string (QObject::tr ("Round Corners")))); + menu_entries.push_back (lay::menu_item ("edt::sel_size", "size:edit_mode", "edit_menu.selection_menu.end", tl::to_string (QObject::tr ("Size Shapes")))); + menu_entries.push_back (lay::menu_item ("edt::sel_union", "union:edit_mode", "edit_menu.selection_menu.end", tl::to_string (QObject::tr ("Merge Shapes")))); + menu_entries.push_back (lay::menu_item ("edt::sel_intersection", "intersection:edit_mode", "edit_menu.selection_menu.end", tl::to_string (QObject::tr ("Intersection - Others With First")))); + menu_entries.push_back (lay::menu_item ("edt::sel_difference", "difference:edit_mode", "edit_menu.selection_menu.end", tl::to_string (QObject::tr ("Subtraction - Others From First")))); + menu_entries.push_back (lay::menu_item ("edt::sel_separate", "separate:edit_mode", "edit_menu.selection_menu.end", tl::to_string (QObject::tr ("Separate - First into Inside/Outside Others")))); + menu_entries.push_back (lay::separator ("hier_group:edit_mode", "edit_menu.selection_menu.end")); + menu_entries.push_back (lay::menu_item ("edt::sel_flatten_insts", "flatten_insts:edit_mode", "edit_menu.selection_menu.end", tl::to_string (QObject::tr ("Flatten Instances")))); + menu_entries.push_back (lay::menu_item ("edt::sel_resolve_arefs", "resolve_arefs:edit_mode", "edit_menu.selection_menu.end", tl::to_string (QObject::tr ("Resolve Arrays")))); + menu_entries.push_back (lay::menu_item ("edt::sel_move_hier_up", "move_hier_up:edit_mode", "edit_menu.selection_menu.end", tl::to_string (QObject::tr ("Move Up In Hierarchy")))); + menu_entries.push_back (lay::menu_item ("edt::sel_make_cell", "make_cell:edit_mode", "edit_menu.selection_menu.end", tl::to_string (QObject::tr ("Make Cell")))); + menu_entries.push_back (lay::menu_item ("edt::sel_make_cell_variants", "make_cell_variants:edit_mode", "edit_menu.selection_menu.end", tl::to_string (QObject::tr ("Make Cell Variants")))); + menu_entries.push_back (lay::menu_item ("edt::sel_convert_to_pcell", "convert_to_pcell:edit_mode", "edit_menu.selection_menu.end", tl::to_string (QObject::tr ("Convert To PCell")))); + menu_entries.push_back (lay::menu_item ("edt::sel_convert_to_cell", "convert_to_cell:edit_mode", "edit_menu.selection_menu.end", tl::to_string (QObject::tr ("Convert To Static Cell")))); - menu_entries.push_back (lay::MenuEntry ("edt::combine_mode", "combine_mode:edit_mode", "@toolbar.end_modes", tl::to_string (QObject::tr ("Combine{Select background combination mode}")))); + menu_entries.push_back (lay::menu_item ("edt::combine_mode", "combine_mode:edit_mode", "@toolbar.end_modes", tl::to_string (QObject::tr ("Combine{Select background combination mode}")))); } bool configure (const std::string &name, const std::string &value) @@ -255,7 +254,7 @@ public: return false; } - virtual lay::Plugin *create_plugin (db::Manager *manager, lay::PluginRoot *root, lay::LayoutView *view) const + virtual lay::Plugin *create_plugin (db::Manager *manager, lay::Dispatcher *root, lay::LayoutView *view) const { return new edt::MainService (manager, view, root); } @@ -270,9 +269,9 @@ public: return false; } - virtual void initialize (lay::PluginRoot *root) + virtual void initialize (lay::Dispatcher *root) { - lay::AbstractMenuProvider *mp = lay::AbstractMenuProvider::instance (); + lay::Dispatcher *mp = lay::Dispatcher::instance (); if (! mp || ! mp->menu ()) { return; } @@ -311,7 +310,7 @@ public: void update_menu (combine_mode_type cm) { - lay::AbstractMenuProvider *mp = lay::AbstractMenuProvider::instance (); + lay::Dispatcher *mp = lay::Dispatcher::instance (); if (! mp || ! mp->menu ()) { return; } @@ -336,7 +335,7 @@ public: } } - virtual void uninitialize (lay::PluginRoot *) + virtual void uninitialize (lay::Dispatcher *) { if (mp_obj_prop_dialog) { delete mp_obj_prop_dialog; @@ -372,9 +371,9 @@ public: } } - void initialized (lay::PluginRoot *root) + void initialized (lay::Dispatcher *root) { - lay::AbstractMenuProvider *mp = lay::AbstractMenuProvider::instance (); + lay::Dispatcher *mp = lay::Dispatcher::instance (); if (! mp || ! mp->menu ()) { return; } @@ -398,7 +397,7 @@ public: } private: - lay::PluginRoot *mp_root; + lay::Dispatcher *mp_root; std::string m_title; edt::EditorOptionsPages *mp_obj_prop_dialog; std::vector m_prop_dialog_pages; @@ -447,7 +446,7 @@ public: // .. nothing yet .. } - virtual lay::Plugin *create_plugin (db::Manager *manager, lay::PluginRoot *root, lay::LayoutView *view) const + virtual lay::Plugin *create_plugin (db::Manager *manager, lay::Dispatcher *root, lay::LayoutView *view) const { return new edt::PartialService (manager, view, root); } diff --git a/src/edt/edt/edtPlugin.h b/src/edt/edt/edtPlugin.h index 50c46658b..f75dec8dd 100644 --- a/src/edt/edt/edtPlugin.h +++ b/src/edt/edt/edtPlugin.h @@ -30,7 +30,7 @@ namespace lay { - class PluginRoot; + class Dispatcher; } namespace edt @@ -44,7 +44,7 @@ namespace edt : public lay::PluginDeclaration { public: - virtual void get_editor_options_pages (std::vector &, lay::PluginRoot *) const = 0; + virtual void get_editor_options_pages (std::vector &, lay::Dispatcher *) const = 0; }; /** diff --git a/src/edt/edt/edtService.cc b/src/edt/edt/edtService.cc index 813f778d1..0e5986b5c 100644 --- a/src/edt/edt/edtService.cc +++ b/src/edt/edt/edtService.cc @@ -334,8 +334,8 @@ Service::copy_selected () // store the given value "forever" if (dont_ask_again) { - plugin_root ()->config_set (cfg_edit_hier_copy_mode, tl::to_string (inst_mode)); - plugin_root ()->config_end (); + dispatcher ()->config_set (cfg_edit_hier_copy_mode, tl::to_string (inst_mode)); + dispatcher ()->config_end (); } // create one ClipboardData object per cv_index because, this one assumes that there is diff --git a/src/edt/edt/edtServiceImpl.cc b/src/edt/edt/edtServiceImpl.cc index 6bdd2f8ac..691bff357 100644 --- a/src/edt/edt/edtServiceImpl.cc +++ b/src/edt/edt/edtServiceImpl.cc @@ -1282,14 +1282,14 @@ InstService::sync_to_config () { // push the current setup to configuration so the instance dialog will take these as default // and "apply" of these instance properties doesn't fail because of insistency. - plugin_root ()->config_set (cfg_edit_inst_lib_name, m_lib_name); - plugin_root ()->config_set (cfg_edit_inst_cell_name, m_cell_or_pcell_name); + dispatcher ()->config_set (cfg_edit_inst_lib_name, m_lib_name); + dispatcher ()->config_set (cfg_edit_inst_cell_name, m_cell_or_pcell_name); if (m_is_pcell) { - plugin_root ()->config_set (cfg_edit_inst_pcell_parameters, pcell_parameters_to_string (m_pcell_parameters)); + dispatcher ()->config_set (cfg_edit_inst_pcell_parameters, pcell_parameters_to_string (m_pcell_parameters)); } else { - plugin_root ()->config_set (cfg_edit_inst_pcell_parameters, std::string ()); + dispatcher ()->config_set (cfg_edit_inst_pcell_parameters, std::string ()); } - plugin_root ()->config_end (); + dispatcher ()->config_end (); } void diff --git a/src/img/img/imgPlugin.cc b/src/img/img/imgPlugin.cc index 89de45ea9..48dfe7a5c 100644 --- a/src/img/img/imgPlugin.cc +++ b/src/img/img/imgPlugin.cc @@ -42,7 +42,7 @@ PluginDeclaration::get_menu_entries (std::vector &menu_entries) } lay::Plugin * -PluginDeclaration::create_plugin (db::Manager *manager, lay::PluginRoot *, lay::LayoutView *view) const +PluginDeclaration::create_plugin (db::Manager *manager, lay::Dispatcher *, lay::LayoutView *view) const { return new img::Service (manager, view); } diff --git a/src/img/img/imgPlugin.h b/src/img/img/imgPlugin.h index 95e770615..5c1dcb632 100644 --- a/src/img/img/imgPlugin.h +++ b/src/img/img/imgPlugin.h @@ -39,7 +39,7 @@ public: } virtual void get_menu_entries (std::vector &menu_entries) const; - virtual lay::Plugin *create_plugin (db::Manager *manager, lay::PluginRoot *, lay::LayoutView *view) const; + virtual lay::Plugin *create_plugin (db::Manager *manager, lay::Dispatcher *, lay::LayoutView *view) const; virtual bool implements_editable (std::string &title) const; }; diff --git a/src/lay/lay/layApplication.cc b/src/lay/lay/layApplication.cc index 33f7dc0c4..f7fd82d16 100644 --- a/src/lay/lay/layApplication.cc +++ b/src/lay/lay/layApplication.cc @@ -605,7 +605,7 @@ ApplicationBase::init_app () bool editable_from_config = false; { - lay::PluginRoot cfg; + lay::Dispatcher cfg; for (std::vector ::const_iterator c = m_config_files.begin (); c != m_config_files.end (); ++c) { try { @@ -770,11 +770,11 @@ ApplicationBase::init_app () if (tl::verbosity () >= 20) { tl::info << " " << cls.current_name () << " [" << cls.current_position () << "]"; } - pd->initialize (plugin_root ()); + pd->initialize (dispatcher ()); } // establish the configuration - plugin_root ()->config_setup (); + dispatcher ()->config_setup (); // Some info output if (tl::verbosity () >= 20) { @@ -862,7 +862,7 @@ ApplicationBase::exit (int result) // uninitialize the plugins for (tl::Registrar::iterator cls = tl::Registrar::begin (); cls != tl::Registrar::end (); ++cls) { lay::PluginDeclaration *pd = const_cast (&*cls); - pd->uninitialize (plugin_root ()); + pd->uninitialize (dispatcher ()); } shutdown (); @@ -873,13 +873,13 @@ ApplicationBase::exit (int result) void ApplicationBase::finish () { - if (plugin_root () && m_write_config_file) { + if (dispatcher () && m_write_config_file) { if (! m_config_file_to_write.empty ()) { if (tl::verbosity () >= 20) { tl::info << tl::to_string (QObject::tr ("Updating configuration file ")) << m_config_file_to_write; } - plugin_root ()->write_config (m_config_file_to_write); + dispatcher ()->write_config (m_config_file_to_write); } if (! m_config_file_to_delete.empty () && m_config_file_to_delete != m_config_file_to_write) { if (tl::verbosity () >= 20) { @@ -1008,7 +1008,7 @@ ApplicationBase::run () for (std::vector ::const_iterator c = m_config_files.begin (); c != m_config_files.end (); ++c) { BEGIN_PROTECTED_CLEANUP - plugin_root ()->read_config (*c); + dispatcher ()->read_config (*c); // if the last config was read successfully no reset will happen: config_failed = false; END_PROTECTED_CLEANUP { @@ -1130,7 +1130,7 @@ ApplicationBase::run () // Give the plugins a change to do some last-minute initialisation and checks for (tl::Registrar::iterator cls = tl::Registrar::begin (); cls != tl::Registrar::end (); ++cls) { lay::PluginDeclaration *pd = const_cast (&*cls); - pd->initialized (plugin_root ()); + pd->initialized (dispatcher ()); } if (! m_no_gui && m_gtf_replay.empty () && m_gtf_record.empty ()) { @@ -1138,12 +1138,12 @@ ApplicationBase::run () mw->about_to_exec (); } - } else if (plugin_root ()) { + } else if (dispatcher ()) { // Give the plugins a change to do some last-minute initialisation and checks for (tl::Registrar::iterator cls = tl::Registrar::begin (); cls != tl::Registrar::end (); ++cls) { lay::PluginDeclaration *pd = const_cast (&*cls); - pd->initialized (plugin_root ()); + pd->initialized (dispatcher ()); } } @@ -1218,7 +1218,7 @@ ApplicationBase::process_events_impl (QEventLoop::ProcessEventsFlags /*flags*/, bool ApplicationBase::write_config (const std::string &config_file) { - return plugin_root () ? plugin_root ()->write_config (config_file) : 0; + return dispatcher () ? dispatcher ()->write_config (config_file) : 0; } void @@ -1235,38 +1235,38 @@ ApplicationBase::reset_config () void ApplicationBase::clear_config () { - if (plugin_root ()) { - plugin_root ()->clear_config (); + if (dispatcher ()) { + dispatcher ()->clear_config (); } } bool ApplicationBase::read_config (const std::string &config_file) { - return plugin_root () ? plugin_root ()->read_config (config_file) : true; + return dispatcher () ? dispatcher ()->read_config (config_file) : true; } void ApplicationBase::set_config (const std::string &name, const std::string &value) { - if (plugin_root ()) { - plugin_root ()->config_set (name, value); + if (dispatcher ()) { + dispatcher ()->config_set (name, value); } } void ApplicationBase::config_end () { - if (plugin_root ()) { - plugin_root ()->config_end (); + if (dispatcher ()) { + dispatcher ()->config_end (); } } std::string ApplicationBase::get_config (const std::string &name) const { - if (plugin_root ()) { - return plugin_root ()->config_get (name); + if (dispatcher ()) { + return dispatcher ()->config_get (name); } else { return std::string (); } @@ -1276,8 +1276,8 @@ std::vector ApplicationBase::get_config_names () const { std::vector names; - if (plugin_root ()) { - plugin_root ()->get_config_names (names); + if (dispatcher ()) { + dispatcher ()->get_config_names (names); } return names; } @@ -1313,7 +1313,7 @@ GuiApplication::~GuiApplication () // uninitialize the plugins for (tl::Registrar::iterator cls = tl::Registrar::begin (); cls != tl::Registrar::end (); ++cls) { lay::PluginDeclaration *pd = const_cast (&*cls); - pd->uninitialize (plugin_root ()); + pd->uninitialize (dispatcher ()); } shutdown (); @@ -1472,8 +1472,8 @@ GuiApplication::start_recording () } } -lay::PluginRoot * -GuiApplication::plugin_root () const +lay::Dispatcher * +GuiApplication::dispatcher () const { return mp_plugin_root; } @@ -1529,7 +1529,7 @@ NonGuiApplication::NonGuiApplication (int &argc, char **argv) : QCoreApplication (argc, argv), ApplicationBase (true), mp_pr (0), mp_pb (0), - mp_plugin_root (0) + mp_dispatcher (0) { // .. nothing yet .. } @@ -1539,7 +1539,7 @@ NonGuiApplication::~NonGuiApplication () // uninitialize the plugins for (tl::Registrar::iterator cls = tl::Registrar::begin (); cls != tl::Registrar::end (); ++cls) { lay::PluginDeclaration *pd = const_cast (&*cls); - pd->uninitialize (plugin_root ()); + pd->uninitialize (dispatcher ()); } shutdown (); @@ -1555,9 +1555,9 @@ NonGuiApplication::exec () void NonGuiApplication::shutdown () { - if (mp_plugin_root) { - delete mp_plugin_root; - mp_plugin_root = 0; + if (mp_dispatcher) { + delete mp_dispatcher; + mp_dispatcher = 0; } if (mp_pr) { @@ -1579,7 +1579,7 @@ NonGuiApplication::setup () mp_pr = new lay::ProgressReporter (); mp_pb = new TextProgress (10 /*verbosity level*/); mp_pr->set_progress_bar (mp_pb); - mp_plugin_root = new lay::PluginRoot (); + mp_dispatcher = new lay::Dispatcher (0); } } diff --git a/src/lay/lay/layApplication.h b/src/lay/lay/layApplication.h index b121138b2..31ef67256 100644 --- a/src/lay/lay/layApplication.h +++ b/src/lay/lay/layApplication.h @@ -58,7 +58,7 @@ namespace lay class MainWindow; class DispatcherToMainWindow; -class PluginRoot; +class Dispatcher; class ProgressReporter; class ProgressBar; @@ -321,7 +321,7 @@ protected: virtual void shutdown (); virtual void prepare_recording (const std::string >f_record, bool gtf_record_incremental); virtual void start_recording (); - virtual lay::PluginRoot *plugin_root () const = 0; + virtual lay::Dispatcher *dispatcher () const = 0; virtual void finish (); virtual void process_events_impl (QEventLoop::ProcessEventsFlags flags, bool silent = false); @@ -441,7 +441,7 @@ protected: virtual void start_recording (); virtual void process_events_impl (QEventLoop::ProcessEventsFlags flags, bool silent); - virtual lay::PluginRoot *plugin_root () const; + virtual lay::Dispatcher *dispatcher () const; private: MainWindow *mp_mw; @@ -493,15 +493,15 @@ protected: virtual void setup (); virtual void shutdown (); - virtual lay::PluginRoot *plugin_root () const + virtual lay::Dispatcher *dispatcher () const { - return mp_plugin_root; + return mp_dispatcher; } private: lay::ProgressReporter *mp_pr; lay::ProgressBar *mp_pb; - lay::PluginRoot *mp_plugin_root; + lay::Dispatcher *mp_dispatcher; }; } // namespace lay diff --git a/src/lay/lay/layClipDialog.cc b/src/lay/lay/layClipDialog.cc index 85e7e58a1..5a0c1da46 100644 --- a/src/lay/lay/layClipDialog.cc +++ b/src/lay/lay/layClipDialog.cc @@ -55,7 +55,7 @@ public: menu_entries.push_back (lay::MenuEntry ("clip_tool::show", "clip_tool:edit_mode", "edit_menu.utils_menu.end", tl::to_string (QObject::tr ("Clip Tool")))); } - virtual lay::Plugin *create_plugin (db::Manager *, lay::PluginRoot *root, lay::LayoutView *view) const + virtual lay::Plugin *create_plugin (db::Manager *, lay::Dispatcher *root, lay::LayoutView *view) const { return new ClipDialog (root, view); } @@ -66,7 +66,7 @@ static tl::RegisteredClass config_decl (new ClipDialogPl // ------------------------------------------------------------ -ClipDialog::ClipDialog (lay::PluginRoot *root, lay::LayoutView *vw) +ClipDialog::ClipDialog (lay::Dispatcher *root, lay::LayoutView *vw) : lay::Browser (root, vw), Ui::ClipDialog () { diff --git a/src/lay/lay/layClipDialog.h b/src/lay/lay/layClipDialog.h index 510ba8cd9..fdb50b835 100644 --- a/src/lay/lay/layClipDialog.h +++ b/src/lay/lay/layClipDialog.h @@ -40,7 +40,7 @@ class ClipDialog Q_OBJECT public: - ClipDialog (lay::PluginRoot *root, lay::LayoutView *view); + ClipDialog (lay::Dispatcher *root, lay::LayoutView *view); ~ClipDialog (); public slots: diff --git a/src/lay/lay/layFillDialog.cc b/src/lay/lay/layFillDialog.cc index 8dc072b0a..3abd11490 100644 --- a/src/lay/lay/layFillDialog.cc +++ b/src/lay/lay/layFillDialog.cc @@ -62,7 +62,7 @@ public: menu_entries.push_back (lay::MenuEntry ("fill_tool::show", "fill_tool:edit_mode", "edit_menu.utils_menu.end", tl::to_string (QObject::tr ("Fill Tool")))); } - virtual lay::Plugin *create_plugin (db::Manager *, lay::PluginRoot *root, lay::LayoutView *view) const + virtual lay::Plugin *create_plugin (db::Manager *, lay::Dispatcher *root, lay::LayoutView *view) const { return new FillDialog (root, view); } @@ -73,7 +73,7 @@ static tl::RegisteredClass config_decl (new FillDialogPl // ------------------------------------------------------------ -FillDialog::FillDialog (lay::PluginRoot *main, lay::LayoutView *view) +FillDialog::FillDialog (lay::Dispatcher *main, lay::LayoutView *view) : QDialog (view), lay::Plugin (main), Ui::FillDialog (), diff --git a/src/lay/lay/layMacroEditorDialog.h b/src/lay/lay/layMacroEditorDialog.h index 01c588ee6..f2d67320d 100644 --- a/src/lay/lay/layMacroEditorDialog.h +++ b/src/lay/lay/layMacroEditorDialog.h @@ -98,7 +98,7 @@ public: /** * @brief Constructor */ - MacroEditorDialog (lay::PluginRoot *pr, lym::MacroCollection *root); + MacroEditorDialog (lay::Dispatcher *pr, lym::MacroCollection *root); /** * @brief Destructor @@ -289,7 +289,7 @@ private: bool configure (const std::string &name, const std::string &value); void config_finalize (); - lay::PluginRoot *mp_plugin_root; + lay::Dispatcher *mp_plugin_root; lym::MacroCollection *mp_root; bool m_first_show; bool m_in_processing;