mirror of https://github.com/KLayout/klayout.git
Netlist browser enhancements
- better performance when changing layer properties (by deferred execution of the callback) - coloring of nets (net color has precedence) - sorting of circuits top-down
This commit is contained in:
parent
30fdb0089b
commit
99b47f732a
|
|
@ -164,7 +164,7 @@ QColor
|
||||||
NetColorizer::color_of_net (const db::Net *net) const
|
NetColorizer::color_of_net (const db::Net *net) const
|
||||||
{
|
{
|
||||||
if (! net) {
|
if (! net) {
|
||||||
return m_marker_color;
|
return QColor ();
|
||||||
}
|
}
|
||||||
|
|
||||||
std::map<const db::Net *, QColor>::const_iterator c = m_custom_color.find (net);
|
std::map<const db::Net *, QColor>::const_iterator c = m_custom_color.find (net);
|
||||||
|
|
@ -177,7 +177,7 @@ NetColorizer::color_of_net (const db::Net *net) const
|
||||||
size_t index = index_from_attr (net, circuit->begin_nets (), circuit->end_nets (), m_net_index_by_object);
|
size_t index = index_from_attr (net, circuit->begin_nets (), circuit->end_nets (), m_net_index_by_object);
|
||||||
return m_auto_colors.color_by_index ((unsigned int) index);
|
return m_auto_colors.color_by_index ((unsigned int) index);
|
||||||
} else {
|
} else {
|
||||||
return m_marker_color;
|
return QColor ();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -1650,9 +1650,9 @@ NetlistBrowserModel::circuit_from_id (void *id) const
|
||||||
if (c == m_circuit_by_index.end ()) {
|
if (c == m_circuit_by_index.end ()) {
|
||||||
|
|
||||||
c = m_circuit_by_index.insert (std::make_pair (index, (db::Circuit *) 0)).first;
|
c = m_circuit_by_index.insert (std::make_pair (index, (db::Circuit *) 0)).first;
|
||||||
for (db::Netlist::circuit_iterator i = netlist ()->begin_circuits (); i != netlist ()->end_circuits (); ++i) {
|
for (db::Netlist::top_down_circuit_iterator i = netlist ()->begin_top_down (); i != netlist ()->end_top_down (); ++i) {
|
||||||
if (index-- == 0) {
|
if (index-- == 0) {
|
||||||
c->second = i.operator-> ();
|
c->second = *i;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -56,6 +56,11 @@ public:
|
||||||
|
|
||||||
QColor color_of_net (const db::Net *net) const;
|
QColor color_of_net (const db::Net *net) const;
|
||||||
|
|
||||||
|
const QColor &marker_color () const
|
||||||
|
{
|
||||||
|
return m_marker_color;
|
||||||
|
}
|
||||||
|
|
||||||
void begin_changes ();
|
void begin_changes ();
|
||||||
void end_changes ();
|
void end_changes ();
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -88,7 +88,8 @@ NetlistBrowserPage::NetlistBrowserPage (QWidget * /*parent*/)
|
||||||
m_signals_enabled (true),
|
m_signals_enabled (true),
|
||||||
m_enable_updates (true),
|
m_enable_updates (true),
|
||||||
m_update_needed (true),
|
m_update_needed (true),
|
||||||
mp_info_dialog (0)
|
mp_info_dialog (0),
|
||||||
|
dm_update_highlights (this, &NetlistBrowserPage::update_highlights)
|
||||||
{
|
{
|
||||||
Ui::NetlistBrowserPage::setupUi (this);
|
Ui::NetlistBrowserPage::setupUi (this);
|
||||||
|
|
||||||
|
|
@ -241,7 +242,7 @@ NetlistBrowserPage::eventFilter (QObject *watched, QEvent *event)
|
||||||
void
|
void
|
||||||
NetlistBrowserPage::layer_list_changed (int)
|
NetlistBrowserPage::layer_list_changed (int)
|
||||||
{
|
{
|
||||||
update_highlights ();
|
dm_update_highlights ();
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
|
@ -775,7 +776,7 @@ NetlistBrowserPage::produce_highlights_for_device (const db::Device *device, siz
|
||||||
const db::Layout *layout = mp_database->internal_layout ();
|
const db::Layout *layout = mp_database->internal_layout ();
|
||||||
db::ICplxTrans device_trans = trans_for (device, layout->dbu (), db::DCplxTrans (device->position () - db::DPoint ()));
|
db::ICplxTrans device_trans = trans_for (device, layout->dbu (), db::DCplxTrans (device->position () - db::DPoint ()));
|
||||||
|
|
||||||
QColor color = make_valid_color (m_colorizer.color_of_net (0));
|
QColor color = make_valid_color (m_colorizer.marker_color ());
|
||||||
db::Box device_bbox = bbox_for_device (layout, device);
|
db::Box device_bbox = bbox_for_device (layout, device);
|
||||||
if (device_bbox.empty ()) {
|
if (device_bbox.empty ()) {
|
||||||
return false;
|
return false;
|
||||||
|
|
@ -801,7 +802,7 @@ NetlistBrowserPage::produce_highlights_for_subcircuit (const db::SubCircuit *sub
|
||||||
const db::Layout *layout = mp_database->internal_layout ();
|
const db::Layout *layout = mp_database->internal_layout ();
|
||||||
db::ICplxTrans subcircuit_trans = trans_for (subcircuit, layout->dbu (), subcircuit->trans ());
|
db::ICplxTrans subcircuit_trans = trans_for (subcircuit, layout->dbu (), subcircuit->trans ());
|
||||||
|
|
||||||
QColor color = make_valid_color (m_colorizer.color_of_net (0));
|
QColor color = make_valid_color (m_colorizer.marker_color ());
|
||||||
db::Box circuit_bbox = bbox_for_subcircuit (layout, subcircuit);
|
db::Box circuit_bbox = bbox_for_subcircuit (layout, subcircuit);
|
||||||
if (circuit_bbox.empty ()) {
|
if (circuit_bbox.empty ()) {
|
||||||
return false;
|
return false;
|
||||||
|
|
@ -830,7 +831,8 @@ NetlistBrowserPage::produce_highlights_for_net (const db::Net *net, size_t &n_ma
|
||||||
db::cell_index_type cell_index = net->circuit ()->cell_index ();
|
db::cell_index_type cell_index = net->circuit ()->cell_index ();
|
||||||
size_t cluster_id = net->cluster_id ();
|
size_t cluster_id = net->cluster_id ();
|
||||||
|
|
||||||
QColor net_color = make_valid_color (m_colorizer.color_of_net (net));
|
QColor net_color = m_colorizer.color_of_net (net);
|
||||||
|
QColor fallback_color = make_valid_color (m_colorizer.marker_color ());
|
||||||
|
|
||||||
const db::Connectivity &conn = mp_database->connectivity ();
|
const db::Connectivity &conn = mp_database->connectivity ();
|
||||||
for (db::Connectivity::layer_iterator layer = conn.begin_layers (); layer != conn.end_layers (); ++layer) {
|
for (db::Connectivity::layer_iterator layer = conn.begin_layers (); layer != conn.end_layers (); ++layer) {
|
||||||
|
|
@ -848,11 +850,16 @@ NetlistBrowserPage::produce_highlights_for_net (const db::Net *net, size_t &n_ma
|
||||||
mp_markers.push_back (new lay::Marker (mp_view, m_cv_index));
|
mp_markers.push_back (new lay::Marker (mp_view, m_cv_index));
|
||||||
mp_markers.back ()->set (*shapes, net_trans * shapes.trans (), tv);
|
mp_markers.back ()->set (*shapes, net_trans * shapes.trans (), tv);
|
||||||
|
|
||||||
if (! m_use_original_colors || display == display_by_lp.end ()) {
|
if (net_color.isValid ()) {
|
||||||
|
|
||||||
mp_markers.back ()->set_color (net_color);
|
mp_markers.back ()->set_color (net_color);
|
||||||
mp_markers.back ()->set_frame_color (net_color);
|
mp_markers.back ()->set_frame_color (net_color);
|
||||||
|
|
||||||
|
} else if (! m_use_original_colors || display == display_by_lp.end ()) {
|
||||||
|
|
||||||
|
mp_markers.back ()->set_color (fallback_color);
|
||||||
|
mp_markers.back ()->set_frame_color (fallback_color);
|
||||||
|
|
||||||
} else if (display != display_by_lp.end ()) {
|
} else if (display != display_by_lp.end ()) {
|
||||||
|
|
||||||
mp_markers.back ()->set_line_width (display->second->width (true));
|
mp_markers.back ()->set_line_width (display->second->width (true));
|
||||||
|
|
|
||||||
|
|
@ -184,6 +184,7 @@ private:
|
||||||
std::vector<const db::Device *> m_current_devices;
|
std::vector<const db::Device *> m_current_devices;
|
||||||
std::vector<const db::SubCircuit *> m_current_subcircuits;
|
std::vector<const db::SubCircuit *> m_current_subcircuits;
|
||||||
lay::NetInfoDialog *mp_info_dialog;
|
lay::NetInfoDialog *mp_info_dialog;
|
||||||
|
tl::DeferredMethod<NetlistBrowserPage> dm_update_highlights;
|
||||||
|
|
||||||
void add_to_history (void *id, bool fwd);
|
void add_to_history (void *id, bool fwd);
|
||||||
void navigate_to (void *id, bool forward = true);
|
void navigate_to (void *id, bool forward = true);
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue