mirror of https://github.com/KLayout/klayout.git
WIP: switching prop id change notification to events
This commit is contained in:
parent
6db836e405
commit
f095374455
|
|
@ -445,7 +445,7 @@ Layout::Layout (db::Manager *manager)
|
|||
m_top_cells (0),
|
||||
m_dbu (0.001),
|
||||
m_prop_id (0),
|
||||
m_properties_repository (this),
|
||||
m_properties_repository (),
|
||||
m_do_cleanup (false),
|
||||
m_editable (db::default_editable_mode ())
|
||||
{
|
||||
|
|
@ -461,7 +461,7 @@ Layout::Layout (bool editable, db::Manager *manager)
|
|||
m_top_cells (0),
|
||||
m_dbu (0.001),
|
||||
m_prop_id (0),
|
||||
m_properties_repository (this),
|
||||
m_properties_repository (),
|
||||
m_do_cleanup (false),
|
||||
m_editable (editable)
|
||||
{
|
||||
|
|
@ -481,7 +481,7 @@ Layout::Layout (const db::Layout &layout)
|
|||
m_top_cells (0),
|
||||
m_dbu (0.001),
|
||||
m_prop_id (0),
|
||||
m_properties_repository (this),
|
||||
m_properties_repository (),
|
||||
m_do_cleanup (false),
|
||||
m_editable (layout.m_editable)
|
||||
{
|
||||
|
|
@ -534,7 +534,7 @@ Layout::clear ()
|
|||
m_cell_map.clear ();
|
||||
|
||||
m_shape_repository = db::GenericRepository ();
|
||||
db::PropertiesRepository empty_pr (this);
|
||||
db::PropertiesRepository empty_pr;
|
||||
m_properties_repository = empty_pr;
|
||||
m_array_repository = db::ArrayRepository ();
|
||||
|
||||
|
|
|
|||
|
|
@ -172,14 +172,6 @@ protected:
|
|||
*/
|
||||
virtual void do_update () { }
|
||||
|
||||
/**
|
||||
* @brief Issue a "prop id's changed event"
|
||||
*/
|
||||
void prop_ids_changed ()
|
||||
{
|
||||
prop_ids_changed_event ();
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Issue a "prop id's changed event"
|
||||
*/
|
||||
|
|
@ -202,7 +194,6 @@ public:
|
|||
tl::Event bboxes_changed_any_event;
|
||||
tl::Event dbu_changed_event;
|
||||
tl::Event cell_name_changed_event;
|
||||
tl::Event prop_ids_changed_event;
|
||||
tl::Event layer_properties_changed_event;
|
||||
|
||||
private:
|
||||
|
|
|
|||
|
|
@ -33,8 +33,7 @@ namespace db
|
|||
// ----------------------------------------------------------------------------------
|
||||
// PropertiesRepository implementation
|
||||
|
||||
PropertiesRepository::PropertiesRepository (db::LayoutStateModel *state_model)
|
||||
: mp_state_model (state_model)
|
||||
PropertiesRepository::PropertiesRepository ()
|
||||
{
|
||||
// install empty property set
|
||||
properties_set empty_set;
|
||||
|
|
@ -43,7 +42,6 @@ PropertiesRepository::PropertiesRepository (db::LayoutStateModel *state_model)
|
|||
}
|
||||
|
||||
PropertiesRepository::PropertiesRepository (const PropertiesRepository &d)
|
||||
: mp_state_model (0)
|
||||
{
|
||||
operator= (d);
|
||||
}
|
||||
|
|
@ -142,9 +140,7 @@ PropertiesRepository::change_properties (property_names_id_type id, const proper
|
|||
if (changed) {
|
||||
// signal the change of the properties ID's. This way for example, the layer views
|
||||
// can recompute the property selectors
|
||||
if (mp_state_model) {
|
||||
mp_state_model->prop_ids_changed ();
|
||||
}
|
||||
prop_ids_changed_event ();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -200,9 +196,7 @@ PropertiesRepository::properties_id (const properties_set &props)
|
|||
if (changed) {
|
||||
// signal the change of the properties ID's. This way for example, the layer views
|
||||
// can recompute the property selectors
|
||||
if (mp_state_model) {
|
||||
mp_state_model->prop_ids_changed ();
|
||||
}
|
||||
prop_ids_changed_event ();
|
||||
}
|
||||
|
||||
return result;
|
||||
|
|
@ -250,6 +244,7 @@ PropertiesRepository::properties_ids_by_name_value (const name_value_pair &nv) c
|
|||
}
|
||||
}
|
||||
|
||||
// @@@ should not be needed at all
|
||||
properties_id_type
|
||||
PropertiesRepository::translate (const PropertiesRepository &rep, properties_id_type id)
|
||||
{
|
||||
|
|
@ -352,7 +347,7 @@ PropertiesTranslator::make_filter (db::PropertiesRepository &repo, const std::se
|
|||
names_selected.insert (repo.prop_name_id (*k));
|
||||
}
|
||||
|
||||
db::PropertiesRepository org_repo = repo;
|
||||
db::PropertiesRepository org_repo = repo; // @@@ should not be available
|
||||
|
||||
for (auto p = org_repo.begin (); p != org_repo.end (); ++p) {
|
||||
db::PropertiesRepository::properties_set new_set;
|
||||
|
|
@ -379,7 +374,7 @@ PropertiesTranslator::make_key_mapper (db::PropertiesRepository &repo, const std
|
|||
name_map.insert (std::make_pair (repo.prop_name_id (k->first), repo.prop_name_id (k->second)));
|
||||
}
|
||||
|
||||
db::PropertiesRepository org_repo = repo;
|
||||
db::PropertiesRepository org_repo = repo; // @@@ should not be available
|
||||
|
||||
for (auto p = org_repo.begin (); p != org_repo.end (); ++p) {
|
||||
db::PropertiesRepository::properties_set new_set;
|
||||
|
|
|
|||
|
|
@ -30,6 +30,7 @@
|
|||
|
||||
#include "tlVariant.h"
|
||||
#include "tlThreads.h"
|
||||
#include "tlEvents.h"
|
||||
|
||||
#include <vector>
|
||||
#include <string>
|
||||
|
|
@ -62,7 +63,7 @@ public:
|
|||
/**
|
||||
* @brief Default constructor
|
||||
*/
|
||||
PropertiesRepository (db::LayoutStateModel *state_model = 0);
|
||||
PropertiesRepository ();
|
||||
|
||||
/**
|
||||
* @brief Copy constructor
|
||||
|
|
@ -229,6 +230,11 @@ public:
|
|||
db::mem_stat (stat, purpose, cat, m_properties_component_table, true, parent);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief An event indicating a change in the properties IDs
|
||||
*/
|
||||
tl::Event prop_ids_changed_event;
|
||||
|
||||
private:
|
||||
std::map <property_names_id_type, tl::Variant> m_propnames_by_id;
|
||||
std::map <tl::Variant, property_names_id_type> m_propname_ids_by_name;
|
||||
|
|
@ -237,7 +243,6 @@ private:
|
|||
std::map <properties_set, properties_id_type> m_properties_ids_by_set;
|
||||
std::map <name_value_pair, properties_id_vector> m_properties_component_table;
|
||||
|
||||
db::LayoutStateModel *mp_state_model;
|
||||
mutable tl::Mutex m_lock;
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -437,7 +437,7 @@ TEST(4)
|
|||
|
||||
g.dbu_changed_event.add (&el, &EventListener::dbu_changed);
|
||||
g.cell_name_changed_event.add (&el, &EventListener::cell_name_changed);
|
||||
g.prop_ids_changed_event.add (&el, &EventListener::property_ids_changed);
|
||||
g.properties_repository ().prop_ids_changed_event.add (&el, &EventListener::property_ids_changed);
|
||||
g.layer_properties_changed_event.add (&el, &EventListener::layer_properties_changed);
|
||||
|
||||
EXPECT_EQ (el.dbu_dirty, false);
|
||||
|
|
|
|||
|
|
@ -88,7 +88,7 @@ LayoutHandle::LayoutHandle (db::Layout *layout, const std::string &filename)
|
|||
mp_layout->hier_changed_event.add (this, &LayoutHandle::layout_changed);
|
||||
mp_layout->bboxes_changed_any_event.add (this, &LayoutHandle::layout_changed);
|
||||
mp_layout->cell_name_changed_event.add (this, &LayoutHandle::layout_changed);
|
||||
mp_layout->prop_ids_changed_event.add (this, &LayoutHandle::layout_changed);
|
||||
mp_layout->properties_repository ().prop_ids_changed_event.add (this, &LayoutHandle::layout_changed);
|
||||
mp_layout->layer_properties_changed_event.add (this, &LayoutHandle::layout_changed);
|
||||
|
||||
if (tl::verbosity () >= 30) {
|
||||
|
|
|
|||
|
|
@ -537,7 +537,7 @@ void LayoutViewBase::update_event_handlers ()
|
|||
cellview (i)->layout ().hier_changed_event.add (this, &LayoutViewBase::signal_hier_changed);
|
||||
cellview (i)->layout ().bboxes_changed_event.add (this, &LayoutViewBase::signal_bboxes_from_layer_changed, i);
|
||||
cellview (i)->layout ().dbu_changed_event.add (this, &LayoutViewBase::signal_bboxes_changed);
|
||||
cellview (i)->layout ().prop_ids_changed_event.add (this, &LayoutViewBase::signal_prop_ids_changed);
|
||||
cellview (i)->layout ().properties_repository ().prop_ids_changed_event.add (this, &LayoutViewBase::signal_prop_ids_changed);
|
||||
cellview (i)->layout ().layer_properties_changed_event.add (this, &LayoutViewBase::signal_layer_properties_changed);
|
||||
cellview (i)->layout ().cell_name_changed_event.add (this, &LayoutViewBase::signal_cell_name_changed);
|
||||
cellview (i)->apply_technology_with_sender_event.add (this, &LayoutViewBase::signal_apply_technology);
|
||||
|
|
|
|||
Loading…
Reference in New Issue