Skip to content

Commit

Permalink
Fixed issue #1360 (LayoutViewBase not promoted to LayoutView). Proble…
Browse files Browse the repository at this point in the history
…m was that GSI binding of LayoutView happened before LayoutView was fully constructed.
  • Loading branch information
Matthias Koefferlein committed May 9, 2023
1 parent 34d147f commit df7311d
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 15 deletions.
2 changes: 0 additions & 2 deletions src/laybasic/laybasic/layLayoutViewBase.cc
Expand Up @@ -260,8 +260,6 @@ LayoutViewBase::LayoutViewBase (lay::LayoutView *ui, db::Manager *manager, bool
{
// either it's us or the parent has a dispatcher
tl_assert (dispatcher () != 0);

init (manager);
}

void
Expand Down
14 changes: 7 additions & 7 deletions src/laybasic/laybasic/layLayoutViewBase.h
Expand Up @@ -192,11 +192,6 @@ class LAYBASIC_PUBLIC LayoutViewBase :
*/
LayoutViewBase (db::Manager *mgr, bool editable, lay::Plugin *plugin_parent, unsigned int options = (unsigned int) LV_Normal);

/**
* @brief Constructor
*/
LayoutViewBase (lay::LayoutView *ui, db::Manager *mgr, bool editable, lay::Plugin *plugin_parent, unsigned int options = (unsigned int) LV_Normal);

/**
* @brief Destructor
*/
Expand Down Expand Up @@ -2861,8 +2856,6 @@ class LAYBASIC_PUBLIC LayoutViewBase :

tl::Clock m_clock, m_last_checked;

void init (db::Manager *mgr);

void do_prop_changed ();
void do_redraw (int layer);
void do_redraw ();
Expand Down Expand Up @@ -2891,6 +2884,13 @@ class LAYBASIC_PUBLIC LayoutViewBase :
void merge_dither_pattern (lay::LayerPropertiesList &props);

protected:
/**
* @brief Constructor for calling from a LayoutView
*/
LayoutViewBase (lay::LayoutView *ui, db::Manager *mgr, bool editable, lay::Plugin *plugin_parent, unsigned int options = (unsigned int) LV_Normal);

void init (db::Manager *mgr);

lay::Plugin *active_plugin () const
{
return mp_active_plugin;
Expand Down
4 changes: 4 additions & 0 deletions src/layview/layview/layLayoutView_noqt.cc
Expand Up @@ -30,13 +30,17 @@ namespace lay
LayoutView::LayoutView (db::Manager *mgr, bool editable, lay::Plugin *plugin_parent, unsigned int options)
: LayoutViewBase (this, mgr, editable, plugin_parent, options)
{
// NOTE: it's important to call LayoutViewBase::init from a fully constructed LayoutView (issue #1360)
LayoutViewBase::init (mgr);
config_setup ();
finish ();
}

LayoutView::LayoutView (lay::LayoutView *source, db::Manager *mgr, bool editable, lay::Plugin *plugin_parent, unsigned int options)
: LayoutViewBase (this, mgr, editable, plugin_parent, options)
{
// NOTE: it's important to call LayoutViewBase::init from a fully constructed LayoutView (issue #1360)
LayoutViewBase::init (mgr);
copy_from (source);
config_setup ();
finish ();
Expand Down
14 changes: 9 additions & 5 deletions src/layview/layview/layLayoutView_qt.cc
Expand Up @@ -279,7 +279,7 @@ LayoutView::LayoutView (db::Manager *manager, bool editable, lay::Plugin *plugin
// ensures the deferred method scheduler is present
tl::DeferredMethodScheduler::instance ();

init_ui ();
init_ui (manager);
}

LayoutView::LayoutView (lay::LayoutView *source, db::Manager *manager, bool editable, lay::Plugin *plugin_parent, unsigned int options)
Expand All @@ -290,7 +290,7 @@ LayoutView::LayoutView (lay::LayoutView *source, db::Manager *manager, bool edit
// ensures the deferred method scheduler is present
tl::DeferredMethodScheduler::instance ();

init_ui ();
init_ui (manager);

copy_from (source);

Expand All @@ -306,7 +306,7 @@ LayoutView::LayoutView (db::Manager *manager, bool editable, lay::Plugin *plugin
// ensures the deferred method scheduler is present
tl::DeferredMethodScheduler::instance ();

init_ui ();
init_ui (manager);
}

LayoutView::LayoutView (lay::LayoutView *source, db::Manager *manager, bool editable, lay::Plugin *plugin_parent, LayoutViewWidget *widget, unsigned int options)
Expand All @@ -317,7 +317,7 @@ LayoutView::LayoutView (lay::LayoutView *source, db::Manager *manager, bool edit
// ensures the deferred method scheduler is present
tl::DeferredMethodScheduler::instance ();

init_ui ();
init_ui (manager);

copy_from (source);

Expand Down Expand Up @@ -349,7 +349,7 @@ LayoutView::event_filter (QObject *obj, QEvent *event, bool &taken)
}

void
LayoutView::init_ui ()
LayoutView::init_ui (db::Manager *mgr)
{
m_activated = true;
m_always_show_source = false;
Expand All @@ -373,6 +373,10 @@ LayoutView::init_ui ()
mp_min_hier_spbx = 0;
mp_max_hier_spbx = 0;

// NOTE: it's important to call LayoutViewBase::init from LayoutView because creating the plugins will need a
// fully constructed LayoutView (issue #1360)
LayoutViewBase::init (mgr);

if (mp_widget) {

canvas ()->init_ui (mp_widget);
Expand Down
2 changes: 1 addition & 1 deletion src/layview/layview/layLayoutView_qt.h
Expand Up @@ -627,7 +627,7 @@ class LAYVIEW_PUBLIC LayoutView
bool event_filter (QObject *obj, QEvent *ev, bool &taken);
QSize size_hint () const;

void init_ui ();
void init_ui (db::Manager *manager);
void do_setup_editor_options_pages ();

QWidget *layer_control_frame () { return mp_control_frame; }
Expand Down

0 comments on commit df7311d

Please sign in to comment.