From c801df7f7b5fbf483fe3d23e8f7668ca629a5ef4 Mon Sep 17 00:00:00 2001 From: Matthias Koefferlein Date: Tue, 11 Feb 2020 00:39:19 +0100 Subject: [PATCH] WIP: fixed assertion in klayout_main test. --- TODO | 8 +++++++- src/ant/ant/antPlugin.cc | 4 ++-- src/edt/edt/edtPlugin.cc | 6 +++--- src/lay/lay/layTechnologyController.cc | 4 ++-- src/laybasic/laybasic/layBookmarksView.cc | 4 ---- src/laybasic/laybasic/layDispatcher.h | 5 +++++ src/laybasic/laybasic/layHierarchyControlPanel.cc | 4 ---- src/laybasic/laybasic/layLayerControlPanel.cc | 8 -------- src/laybasic/laybasic/layLibrariesView.cc | 4 ---- 9 files changed, 19 insertions(+), 28 deletions(-) diff --git a/TODO b/TODO index dd968e470..03c30fbb8 100644 --- a/TODO +++ b/TODO @@ -32,9 +32,14 @@ DONE 8. We can move menu initialization of LV-specifics to the LayoutView and 12. Default ctor for MainWindow so a pymod script can instantiate one (?) +13. Re-think concept of Action as "smart pointers": ConfigureAction + violates this. ConfigureAction should be ActionHandle variant? + Action as pointer and smart pointers for managing? + + Tests: - DONE: compare menu layout - - test every menu function + - DONE: test every menu function - adding of new tech - DONE: adding of rulers/removing - ruby plugin (debugging, re-running) @@ -42,4 +47,5 @@ Tests: - DONE: funktionieren die check marks vor den menus? (Mode, selection modes, ruler template) - DONE: check whether there is a replacement for the "cm_..." methods and tests them (at least one) - DONE: check if changing the default grid works + - Run unit tests -> klayout_main_tests:main is failing diff --git a/src/ant/ant/antPlugin.cc b/src/ant/ant/antPlugin.cc index b81637bc9..6aa3af2a1 100644 --- a/src/ant/ant/antPlugin.cc +++ b/src/ant/ant/antPlugin.cc @@ -210,7 +210,7 @@ void PluginDeclaration::update_current_template () { lay::Dispatcher *mp = lay::Dispatcher::instance (); - if (! mp || ! mp->menu ()) { + if (! mp || ! mp->has_ui ()) { return; } @@ -240,7 +240,7 @@ void PluginDeclaration::update_menu () { lay::Dispatcher *mp = lay::Dispatcher::instance (); - if (! mp || ! mp->menu ()) { + if (! mp || ! mp->has_ui ()) { return; } diff --git a/src/edt/edt/edtPlugin.cc b/src/edt/edt/edtPlugin.cc index 9508c09f3..8b5db7967 100644 --- a/src/edt/edt/edtPlugin.cc +++ b/src/edt/edt/edtPlugin.cc @@ -272,7 +272,7 @@ public: virtual void initialize (lay::Dispatcher *root) { lay::Dispatcher *mp = lay::Dispatcher::instance (); - if (! mp || ! mp->menu ()) { + if (! mp || ! mp->has_ui ()) { return; } @@ -311,7 +311,7 @@ public: void update_menu (combine_mode_type cm) { lay::Dispatcher *mp = lay::Dispatcher::instance (); - if (! mp || ! mp->menu ()) { + if (! mp || ! mp->has_ui ()) { return; } @@ -374,7 +374,7 @@ public: void initialized (lay::Dispatcher *root) { lay::Dispatcher *mp = lay::Dispatcher::instance (); - if (! mp || ! mp->menu ()) { + if (! mp || ! mp->has_ui ()) { return; } diff --git a/src/lay/lay/layTechnologyController.cc b/src/lay/lay/layTechnologyController.cc index 3b2909cb1..fd01d4919 100644 --- a/src/lay/lay/layTechnologyController.cc +++ b/src/lay/lay/layTechnologyController.cc @@ -299,7 +299,7 @@ void TechnologyController::update_current_technology () { lay::Dispatcher *pr = lay::Dispatcher::instance (); - if (! pr || ! pr->menu ()) { + if (! pr || ! pr->has_ui ()) { return; } @@ -326,7 +326,7 @@ void TechnologyController::update_menu () { lay::Dispatcher *pr = lay::Dispatcher::instance (); - if (! pr || ! pr->menu ()) { + if (! pr || ! pr->has_ui ()) { return; } diff --git a/src/laybasic/laybasic/layBookmarksView.cc b/src/laybasic/laybasic/layBookmarksView.cc index e5ce83d2a..42d043d4c 100644 --- a/src/laybasic/laybasic/layBookmarksView.cc +++ b/src/laybasic/laybasic/layBookmarksView.cc @@ -161,10 +161,6 @@ BookmarksView::refresh () void BookmarksView::context_menu (const QPoint &p) { - if (! mp_view->menu ()) { - return; - } - QListView *bm_list = dynamic_cast (sender ()); if (bm_list) { QMenu *ctx_menu = mp_view->menu ()->detached_menu ("bookmarks_context_menu"); diff --git a/src/laybasic/laybasic/layDispatcher.h b/src/laybasic/laybasic/layDispatcher.h index 7b4e7df61..0a076e655 100644 --- a/src/laybasic/laybasic/layDispatcher.h +++ b/src/laybasic/laybasic/layDispatcher.h @@ -114,6 +114,11 @@ public: */ virtual QWidget *menu_parent_widget () { return 0; } + /** + * @brief Returns true, if the dispatcher supplies a user interface + */ + virtual bool has_ui () { return menu_parent_widget () != 0; } + /** * @brief Gets the AbstractMenu object * diff --git a/src/laybasic/laybasic/layHierarchyControlPanel.cc b/src/laybasic/laybasic/layHierarchyControlPanel.cc index 6f989622d..d983e5b64 100644 --- a/src/laybasic/laybasic/layHierarchyControlPanel.cc +++ b/src/laybasic/laybasic/layHierarchyControlPanel.cc @@ -323,10 +323,6 @@ HierarchyControlPanel::event (QEvent *e) void HierarchyControlPanel::context_menu (const QPoint &p) { - if (! mp_view->menu ()) { - return; - } - QTreeView *cell_list = dynamic_cast (sender ()); if (cell_list) { set_active_celltree_from_sender (); diff --git a/src/laybasic/laybasic/layLayerControlPanel.cc b/src/laybasic/laybasic/layLayerControlPanel.cc index 972ec2b19..be8eda762 100644 --- a/src/laybasic/laybasic/layLayerControlPanel.cc +++ b/src/laybasic/laybasic/layLayerControlPanel.cc @@ -1605,10 +1605,6 @@ LayerControlPanel::cm_expand_all () void LayerControlPanel::tab_context_menu (const QPoint &p) { - if (! mp_view->menu ()) { - return; - } - QMenu *ctx_menu = mp_view->menu ()->detached_menu ("lcp_tabs_context_menu"); if (ctx_menu) { ctx_menu->exec (mp_tab_bar->mapToGlobal (p)); @@ -1618,10 +1614,6 @@ LayerControlPanel::tab_context_menu (const QPoint &p) void LayerControlPanel::context_menu (const QPoint &p) { - if (! mp_view->menu ()) { - return; - } - QMenu *ctx_menu = mp_view->menu ()->detached_menu ("lcp_context_menu"); if (ctx_menu) { ctx_menu->exec (mp_layer_list->mapToGlobal (p)); diff --git a/src/laybasic/laybasic/layLibrariesView.cc b/src/laybasic/laybasic/layLibrariesView.cc index d29d735ad..3ef2bb4b6 100644 --- a/src/laybasic/laybasic/layLibrariesView.cc +++ b/src/laybasic/laybasic/layLibrariesView.cc @@ -318,10 +318,6 @@ LibrariesView::event (QEvent *e) void LibrariesView::context_menu (const QPoint &p) { - if (! mp_view->menu ()) { - return; - } - QTreeView *cell_list = dynamic_cast (sender ()); if (cell_list) { QMenu *ctx_menu = mp_view->menu ()->detached_menu ("lib_context_menu");