From 4429d4c8f7d382c751d83ab86ddd1fd214498077 Mon Sep 17 00:00:00 2001 From: Matthias Koefferlein Date: Tue, 27 Dec 2022 20:01:36 +0100 Subject: [PATCH 1/2] Fixed #1234 (layer list empty after clone panel) --- src/laybasic/laybasic/layLayoutViewBase.cc | 18 ++++++------------ src/laybasic/laybasic/layLayoutViewBase.h | 10 +++++----- src/layview/layview/layLayoutView_noqt.cc | 5 +++-- src/layview/layview/layLayoutView_qt.cc | 8 ++++++-- 4 files changed, 20 insertions(+), 21 deletions(-) diff --git a/src/laybasic/laybasic/layLayoutViewBase.cc b/src/laybasic/laybasic/layLayoutViewBase.cc index a879417d7..7f298ee9d 100644 --- a/src/laybasic/laybasic/layLayoutViewBase.cc +++ b/src/laybasic/laybasic/layLayoutViewBase.cc @@ -264,21 +264,11 @@ LayoutViewBase::LayoutViewBase (lay::LayoutView *ui, db::Manager *manager, bool init (manager); } -LayoutViewBase::LayoutViewBase (lay::LayoutView *ui, lay::LayoutViewBase *source, db::Manager *manager, bool editable, lay::Plugin *plugin_parent, unsigned int options) - : lay::Dispatcher (plugin_parent, false /*not standalone*/), - mp_ui (ui), - dm_redraw (this, &LayoutViewBase::redraw), - m_editable (editable), - m_options (options), - m_annotation_shapes (manager) +void +LayoutViewBase::copy_from (lay::LayoutViewBase *source) { - // either it's us or the parent has a dispatcher - tl_assert (dispatcher () != 0); - m_annotation_shapes = source->m_annotation_shapes; - init (manager); - // set the handle reference and clear all cell related stuff m_cellviews = source->cellview_list (); m_hidden_cells = source->m_hidden_cells; @@ -289,6 +279,8 @@ LayoutViewBase::LayoutViewBase (lay::LayoutView *ui, lay::LayoutViewBase *source m_synchronous = source->synchronous (); m_drawing_workers = source->drawing_workers (); + begin_layer_updates (); + // duplicate the layer properties for (size_t i = 0; i < source->m_layer_properties_lists.size (); ++i) { if (i >= m_layer_properties_lists.size ()) { @@ -299,6 +291,8 @@ LayoutViewBase::LayoutViewBase (lay::LayoutView *ui, lay::LayoutViewBase *source m_layer_properties_lists [i]->attach_view (this, (unsigned int) i); } + end_layer_updates (); + if (! m_layer_properties_lists.empty ()) { mp_canvas->set_dither_pattern (m_layer_properties_lists [0]->dither_pattern ()); } diff --git a/src/laybasic/laybasic/layLayoutViewBase.h b/src/laybasic/laybasic/layLayoutViewBase.h index 3419f76c9..936de4b80 100644 --- a/src/laybasic/laybasic/layLayoutViewBase.h +++ b/src/laybasic/laybasic/layLayoutViewBase.h @@ -192,16 +192,16 @@ public: */ LayoutViewBase (lay::LayoutView *ui, db::Manager *mgr, bool editable, lay::Plugin *plugin_parent, unsigned int options = (unsigned int) LV_Normal); - /** - * @brief Constructor (clone from another view) - */ - LayoutViewBase (lay::LayoutView *ui, lay::LayoutViewBase *source, db::Manager *mgr, bool editable, lay::Plugin *plugin_parent, unsigned int options = (unsigned int) LV_Normal); - /** * @brief Destructor */ ~LayoutViewBase (); + /** + * @brief Copies settings from the source view + */ + void copy_from (lay::LayoutViewBase *source); + /** * @brief Gets the current mode */ diff --git a/src/layview/layview/layLayoutView_noqt.cc b/src/layview/layview/layLayoutView_noqt.cc index 524fcae39..351c94d4a 100644 --- a/src/layview/layview/layLayoutView_noqt.cc +++ b/src/layview/layview/layLayoutView_noqt.cc @@ -34,9 +34,10 @@ LayoutView::LayoutView (db::Manager *mgr, bool editable, lay::Plugin *plugin_par finish (); } -LayoutView::LayoutView (lay::LayoutView *source, db::Manager *mgr, bool editable, lay::Plugin *plugin_parent, unsigned int options) - : LayoutViewBase (this, source, mgr, editable, plugin_parent, options) +LayoutView::LayoutView (db::Manager *mgr, lay::LayoutView *source, db::Manager *mgr, bool editable, lay::Plugin *plugin_parent, unsigned int options) + : LayoutViewBase (this, mgr, editable, plugin_parent, options) { + copy_from (source); config_setup (); finish (); } diff --git a/src/layview/layview/layLayoutView_qt.cc b/src/layview/layview/layLayoutView_qt.cc index 1d084063a..02ff4b806 100644 --- a/src/layview/layview/layLayoutView_qt.cc +++ b/src/layview/layview/layLayoutView_qt.cc @@ -275,7 +275,7 @@ LayoutView::LayoutView (db::Manager *manager, bool editable, lay::Plugin *plugin } LayoutView::LayoutView (lay::LayoutView *source, db::Manager *manager, bool editable, lay::Plugin *plugin_parent, unsigned int options) - : LayoutViewBase (this, source, manager, editable, plugin_parent, options), + : LayoutViewBase (this, manager, editable, plugin_parent, options), mp_widget (0), dm_setup_editor_option_pages (this, &LayoutView::do_setup_editor_options_pages) { @@ -284,6 +284,8 @@ LayoutView::LayoutView (lay::LayoutView *source, db::Manager *manager, bool edit init_ui (); + copy_from (source); + bookmarks (source->bookmarks ()); LayoutView::set_active_cellview_index (source->active_cellview_index ()); } @@ -300,7 +302,7 @@ LayoutView::LayoutView (db::Manager *manager, bool editable, lay::Plugin *plugin } LayoutView::LayoutView (lay::LayoutView *source, db::Manager *manager, bool editable, lay::Plugin *plugin_parent, LayoutViewWidget *widget, unsigned int options) - : LayoutViewBase (this, source, manager, editable, plugin_parent, options), + : LayoutViewBase (this, manager, editable, plugin_parent, options), mp_widget (widget), dm_setup_editor_option_pages (this, &LayoutView::do_setup_editor_options_pages) { @@ -309,6 +311,8 @@ LayoutView::LayoutView (lay::LayoutView *source, db::Manager *manager, bool edit init_ui (); + copy_from (source); + bookmarks (source->bookmarks ()); LayoutView::set_active_cellview_index (source->active_cellview_index ()); } From 8d025ddf9f2b30db04524f2d907a2cb39a23439d Mon Sep 17 00:00:00 2001 From: Matthias Koefferlein Date: Tue, 27 Dec 2022 20:14:22 +0100 Subject: [PATCH 2/2] Fixed non-Qt builds --- src/layview/layview/layLayoutView_noqt.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/layview/layview/layLayoutView_noqt.cc b/src/layview/layview/layLayoutView_noqt.cc index 351c94d4a..f63ecc299 100644 --- a/src/layview/layview/layLayoutView_noqt.cc +++ b/src/layview/layview/layLayoutView_noqt.cc @@ -34,7 +34,7 @@ LayoutView::LayoutView (db::Manager *mgr, bool editable, lay::Plugin *plugin_par finish (); } -LayoutView::LayoutView (db::Manager *mgr, lay::LayoutView *source, db::Manager *mgr, bool editable, lay::Plugin *plugin_parent, unsigned int options) +LayoutView::LayoutView (lay::LayoutView *source, db::Manager *mgr, bool editable, lay::Plugin *plugin_parent, unsigned int options) : LayoutViewBase (this, mgr, editable, plugin_parent, options) { copy_from (source);