diff --git a/src/lay/lay/layTechnologyController.cc b/src/lay/lay/layTechnologyController.cc index 376ae24bf..103e7a1cc 100644 --- a/src/lay/lay/layTechnologyController.cc +++ b/src/lay/lay/layTechnologyController.cc @@ -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 &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 diff --git a/src/lay/lay/layTechnologyController.h b/src/lay/lay/layTechnologyController.h index 8717fc9e8..f783dc4de 100644 --- a/src/lay/lay/layTechnologyController.h +++ b/src/lay/lay/layTechnologyController.h @@ -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); diff --git a/src/laybasic/laybasic/layLayoutViewBase.cc b/src/laybasic/laybasic/layLayoutViewBase.cc index 30f242720..bf711a53d 100644 --- a/src/laybasic/laybasic/layLayoutViewBase.cc +++ b/src/laybasic/laybasic/layLayoutViewBase.cc @@ -3231,12 +3231,12 @@ LayoutViewBase::add_layout (lay::LayoutHandle *layout_handle, bool add_cellview, std::vector 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);