mirror of https://github.com/KLayout/klayout.git
Merge branch 'issue-1259'
This commit is contained in:
commit
115b89c711
|
|
@ -2931,6 +2931,7 @@ MainWindow::close_view (int index)
|
||||||
|
|
||||||
// last view closed
|
// last view closed
|
||||||
|
|
||||||
|
lay::LayoutView::set_current (0);
|
||||||
current_view_changed ();
|
current_view_changed ();
|
||||||
|
|
||||||
clear_current_pos ();
|
clear_current_pos ();
|
||||||
|
|
|
||||||
|
|
@ -86,7 +86,7 @@ TechnologyController::initialized (lay::Dispatcher *dispatcher)
|
||||||
tl_assert (dispatcher == mp_dispatcher);
|
tl_assert (dispatcher == mp_dispatcher);
|
||||||
|
|
||||||
update_menu (mp_dispatcher);
|
update_menu (mp_dispatcher);
|
||||||
connect_events ();
|
view_changed ();
|
||||||
|
|
||||||
if (lay::SaltController::instance ()) {
|
if (lay::SaltController::instance ()) {
|
||||||
connect (lay::SaltController::instance (), SIGNAL (salt_changed ()), this, SLOT (sync_with_external_sources ()));
|
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
|
void
|
||||||
TechnologyController::connect_events ()
|
TechnologyController::view_changed ()
|
||||||
{
|
{
|
||||||
|
update_active_technology ();
|
||||||
|
|
||||||
// NOTE: the whole concept is a but strange here: the goal is to
|
// NOTE: the whole concept is a but strange here: the goal is to
|
||||||
// connect to the current view's active_cellview_changed event and
|
// connect to the current view's active_cellview_changed event and
|
||||||
// the active cellview's technology_changed event. We could register
|
// 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
|
// NOTE: the "real" call needs to come before the re-connect handler because
|
||||||
// the latter will remove the update call
|
// 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::view_changed);
|
||||||
mp_mw->current_view_changed_event.add (this, &TechnologyController::connect_events);
|
|
||||||
|
|
||||||
if (mp_mw->current_view ()) {
|
if (mp_mw->current_view ()) {
|
||||||
|
|
||||||
// NOTE: the "real" call needs to come before the re-connect handler because
|
// NOTE: the "real" call needs to come before the re-connect handler because
|
||||||
// the latter will remove the update call
|
// 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::view_changed);
|
||||||
mp_mw->current_view ()->active_cellview_changed_event.add (this, &TechnologyController::connect_events);
|
|
||||||
|
|
||||||
if (mp_mw->current_view ()->active_cellview_index () >= 0 && mp_mw->current_view ()->active_cellview_index () <= int (mp_mw->current_view ()->cellviews ())) {
|
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);
|
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 (mp_mw) {
|
||||||
if (active_tech) {
|
if (active_tech) {
|
||||||
mp_mw->tech_message (tech_string_from_name (active_tech->name ()));
|
mp_mw->tech_message (tech_string_from_name (active_tech->name ()));
|
||||||
} else {
|
} else {
|
||||||
mp_mw->tech_message (std::string ());
|
mp_mw->tech_message (std::string ());
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (mp_active_technology != active_tech) {
|
||||||
emit active_technology_changed ();
|
emit active_technology_changed ();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#if 0
|
#if 0
|
||||||
|
|
|
||||||
|
|
@ -138,7 +138,7 @@ private:
|
||||||
db::Technology *mp_active_technology;
|
db::Technology *mp_active_technology;
|
||||||
|
|
||||||
void update_active_technology ();
|
void update_active_technology ();
|
||||||
void connect_events ();
|
void view_changed ();
|
||||||
void technologies_changed ();
|
void technologies_changed ();
|
||||||
void technology_changed (db::Technology *);
|
void technology_changed (db::Technology *);
|
||||||
bool configure (const std::string &name, const std::string &value);
|
bool configure (const std::string &name, const std::string &value);
|
||||||
|
|
|
||||||
|
|
@ -3231,12 +3231,12 @@ LayoutViewBase::add_layout (lay::LayoutHandle *layout_handle, bool add_cellview,
|
||||||
std::vector <db::cell_index_type> p;
|
std::vector <db::cell_index_type> p;
|
||||||
p.push_back (*top);
|
p.push_back (*top);
|
||||||
select_cell (p, cv_index);
|
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) {
|
if (initialize_layers) {
|
||||||
|
|
||||||
bool add_other_layers = m_add_other_layers;
|
bool add_other_layers = m_add_other_layers;
|
||||||
|
|
@ -3315,7 +3315,7 @@ LayoutViewBase::create_layout (const std::string &technology, bool add_cellview,
|
||||||
{
|
{
|
||||||
const db::Technology *tech = db::Technologies::instance ()->technology_by_name (technology);
|
const db::Technology *tech = db::Technologies::instance ()->technology_by_name (technology);
|
||||||
|
|
||||||
db::Layout *layout = new db::Layout (manager ());
|
db::Layout *layout = new db::Layout (m_editable, manager ());
|
||||||
if (tech) {
|
if (tech) {
|
||||||
layout->dbu (tech->dbu ());
|
layout->dbu (tech->dbu ());
|
||||||
}
|
}
|
||||||
|
|
@ -3405,6 +3405,9 @@ LayoutViewBase::load_layout (const std::string &filename, const db::LoadLayoutOp
|
||||||
select_cell (p, cv_index);
|
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
|
// even if there is no cell, select the cellview item
|
||||||
// to support applications with an active cellview (that is however invalid)
|
// to support applications with an active cellview (that is however invalid)
|
||||||
set_active_cellview_index (cv_index);
|
set_active_cellview_index (cv_index);
|
||||||
|
|
|
||||||
|
|
@ -1309,6 +1309,7 @@ TEST (16)
|
||||||
|
|
||||||
int cv1 = view.create_layout ("", true, false);
|
int cv1 = view.create_layout ("", true, false);
|
||||||
db::Layout &ly1 = view.cellview (cv1)->layout ();
|
db::Layout &ly1 = view.cellview (cv1)->layout ();
|
||||||
|
EXPECT_EQ (ly1.is_editable (), is_editable ());
|
||||||
ly1.insert_layer (db::LayerProperties (1, 0));
|
ly1.insert_layer (db::LayerProperties (1, 0));
|
||||||
ly1.insert_layer (db::LayerProperties (2, 0));
|
ly1.insert_layer (db::LayerProperties (2, 0));
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -535,6 +535,21 @@ class LAYLayoutView_TestClass < TestBase
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
|
# issue-1259
|
||||||
|
def test_7
|
||||||
|
|
||||||
|
# standalone layout view
|
||||||
|
lv = RBA::LayoutView::new(true)
|
||||||
|
|
||||||
|
assert_equal(lv.is_editable, true)
|
||||||
|
|
||||||
|
lv.create_layout(true)
|
||||||
|
|
||||||
|
layout = lv.active_cellview.layout
|
||||||
|
assert_equal(layout.is_editable, true)
|
||||||
|
|
||||||
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
load("test_epilogue.rb")
|
load("test_epilogue.rb")
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue