Merge branch 'issue-1234'

This commit is contained in:
Matthias Koefferlein 2023-01-01 22:22:44 +01:00
commit 9e6965751d
4 changed files with 19 additions and 20 deletions

View File

@ -264,21 +264,11 @@ LayoutViewBase::LayoutViewBase (lay::LayoutView *ui, db::Manager *manager, bool
init (manager); init (manager);
} }
LayoutViewBase::LayoutViewBase (lay::LayoutView *ui, lay::LayoutViewBase *source, db::Manager *manager, bool editable, lay::Plugin *plugin_parent, unsigned int options) void
: lay::Dispatcher (plugin_parent, false /*not standalone*/), LayoutViewBase::copy_from (lay::LayoutViewBase *source)
mp_ui (ui),
dm_redraw (this, &LayoutViewBase::redraw),
m_editable (editable),
m_options (options),
m_annotation_shapes (manager)
{ {
// either it's us or the parent has a dispatcher
tl_assert (dispatcher () != 0);
m_annotation_shapes = source->m_annotation_shapes; m_annotation_shapes = source->m_annotation_shapes;
init (manager);
// set the handle reference and clear all cell related stuff // set the handle reference and clear all cell related stuff
m_cellviews = source->cellview_list (); m_cellviews = source->cellview_list ();
m_hidden_cells = source->m_hidden_cells; m_hidden_cells = source->m_hidden_cells;
@ -289,6 +279,8 @@ LayoutViewBase::LayoutViewBase (lay::LayoutView *ui, lay::LayoutViewBase *source
m_synchronous = source->synchronous (); m_synchronous = source->synchronous ();
m_drawing_workers = source->drawing_workers (); m_drawing_workers = source->drawing_workers ();
begin_layer_updates ();
// duplicate the layer properties // duplicate the layer properties
for (size_t i = 0; i < source->m_layer_properties_lists.size (); ++i) { for (size_t i = 0; i < source->m_layer_properties_lists.size (); ++i) {
if (i >= m_layer_properties_lists.size ()) { 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); m_layer_properties_lists [i]->attach_view (this, (unsigned int) i);
} }
end_layer_updates ();
if (! m_layer_properties_lists.empty ()) { if (! m_layer_properties_lists.empty ()) {
mp_canvas->set_dither_pattern (m_layer_properties_lists [0]->dither_pattern ()); mp_canvas->set_dither_pattern (m_layer_properties_lists [0]->dither_pattern ());
} }

View File

@ -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); 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 * @brief Destructor
*/ */
~LayoutViewBase (); ~LayoutViewBase ();
/**
* @brief Copies settings from the source view
*/
void copy_from (lay::LayoutViewBase *source);
/** /**
* @brief Gets the current mode * @brief Gets the current mode
*/ */

View File

@ -35,8 +35,9 @@ LayoutView::LayoutView (db::Manager *mgr, bool editable, lay::Plugin *plugin_par
} }
LayoutView::LayoutView (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, source, mgr, editable, plugin_parent, options) : LayoutViewBase (this, mgr, editable, plugin_parent, options)
{ {
copy_from (source);
config_setup (); config_setup ();
finish (); finish ();
} }

View File

@ -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) 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), mp_widget (0),
dm_setup_editor_option_pages (this, &LayoutView::do_setup_editor_options_pages) 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 (); init_ui ();
copy_from (source);
bookmarks (source->bookmarks ()); bookmarks (source->bookmarks ());
LayoutView::set_active_cellview_index (source->active_cellview_index ()); 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) 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), mp_widget (widget),
dm_setup_editor_option_pages (this, &LayoutView::do_setup_editor_options_pages) 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 (); init_ui ();
copy_from (source);
bookmarks (source->bookmarks ()); bookmarks (source->bookmarks ());
LayoutView::set_active_cellview_index (source->active_cellview_index ()); LayoutView::set_active_cellview_index (source->active_cellview_index ());
} }