More steps to fully (hopefully) fix issue #1259 - basically it is important to issue enough active_view_changed and active_technology_change events

This commit is contained in:
Matthias Koefferlein 2023-01-26 20:31:43 +01:00
parent cfd21d98bf
commit 12693ed212
3 changed files with 22 additions and 20 deletions

View File

@ -86,7 +86,7 @@ TechnologyController::initialized (lay::Dispatcher *dispatcher)
tl_assert (dispatcher == mp_dispatcher);
update_menu (mp_dispatcher);
connect_events ();
view_changed ();
if (lay::SaltController::instance ()) {
connect (lay::SaltController::instance (), SIGNAL (salt_changed ()), this, SLOT (sync_with_external_sources ()));
@ -121,8 +121,10 @@ TechnologyController::get_menu_entries (std::vector<lay::MenuEntry> &menu_entrie
}
void
TechnologyController::connect_events ()
TechnologyController::view_changed ()
{
update_active_technology ();
// NOTE: the whole concept is a but strange here: the goal is to
// connect to the current view's active_cellview_changed event and
// the active cellview's technology_changed event. We could register
@ -140,15 +142,13 @@ TechnologyController::connect_events ()
// NOTE: the "real" call needs to come before the re-connect handler because
// the latter will remove the update call
mp_mw->current_view_changed_event.add (this, &TechnologyController::update_active_technology);
mp_mw->current_view_changed_event.add (this, &TechnologyController::connect_events);
mp_mw->current_view_changed_event.add (this, &TechnologyController::view_changed);
if (mp_mw->current_view ()) {
// NOTE: the "real" call needs to come before the re-connect handler because
// the latter will remove the update call
mp_mw->current_view ()->active_cellview_changed_event.add (this, &TechnologyController::update_active_technology);
mp_mw->current_view ()->active_cellview_changed_event.add (this, &TechnologyController::connect_events);
mp_mw->current_view ()->active_cellview_changed_event.add (this, &TechnologyController::view_changed);
if (mp_mw->current_view ()->active_cellview_index () >= 0 && mp_mw->current_view ()->active_cellview_index () <= int (mp_mw->current_view ()->cellviews ())) {
mp_mw->current_view ()->active_cellview ()->technology_changed_event.add (this, &TechnologyController::update_active_technology);
@ -178,20 +178,19 @@ TechnologyController::update_active_technology ()
}
if (mp_active_technology != active_tech) {
mp_active_technology = active_tech;
mp_active_technology = active_tech;
if (mp_mw) {
if (active_tech) {
mp_mw->tech_message (tech_string_from_name (active_tech->name ()));
} else {
mp_mw->tech_message (std::string ());
}
if (mp_mw) {
if (active_tech) {
mp_mw->tech_message (tech_string_from_name (active_tech->name ()));
} else {
mp_mw->tech_message (std::string ());
}
}
if (mp_active_technology != active_tech) {
emit active_technology_changed ();
}
#if 0

View File

@ -138,7 +138,7 @@ private:
db::Technology *mp_active_technology;
void update_active_technology ();
void connect_events ();
void view_changed ();
void technologies_changed ();
void technology_changed (db::Technology *);
bool configure (const std::string &name, const std::string &value);

View File

@ -3231,12 +3231,12 @@ LayoutViewBase::add_layout (lay::LayoutHandle *layout_handle, bool add_cellview,
std::vector <db::cell_index_type> p;
p.push_back (*top);
select_cell (p, cv_index);
} else {
// even if there is no cell, select the cellview item
// to support applications with an active cellview (that is however invalid)
set_active_cellview_index (cv_index);
}
// even if there is no cell, select the cellview item
// to support applications with an active cellview (that is however invalid)
set_active_cellview_index (cv_index);
if (initialize_layers) {
bool add_other_layers = m_add_other_layers;
@ -3405,6 +3405,9 @@ LayoutViewBase::load_layout (const std::string &filename, const db::LoadLayoutOp
select_cell (p, cv_index);
}
// force "active_cellview_changed" event
m_active_cellview_index = -1;
// even if there is no cell, select the cellview item
// to support applications with an active cellview (that is however invalid)
set_active_cellview_index (cv_index);