mirror of https://github.com/KLayout/klayout.git
WIP: netlist browser - device links
This commit is contained in:
parent
7e9e0dd5e6
commit
ceb3d39ddb
|
|
@ -604,6 +604,17 @@ NetlistBrowserModel::make_link_to (const db::Net *net) const
|
|||
}
|
||||
}
|
||||
|
||||
QString
|
||||
NetlistBrowserModel::make_link_to (const db::Device *device) const
|
||||
{
|
||||
if (! device) {
|
||||
return QString ();
|
||||
} else {
|
||||
void *id = make_id_circuit_device (circuit_index (device->circuit ()), device_index (device));
|
||||
return tl::to_qstring (tl::sprintf ("<a href='int:device?id=%s'>%s</a>", tl::to_string (reinterpret_cast<size_t> (id)), device->expanded_name ()));
|
||||
}
|
||||
}
|
||||
|
||||
QString
|
||||
NetlistBrowserModel::make_link_to (const db::Pin *pin, const db::Circuit *circuit) const
|
||||
{
|
||||
|
|
@ -834,7 +845,7 @@ NetlistBrowserModel::text (const QModelIndex &index) const
|
|||
if (index.column () == 0) {
|
||||
return tl::to_qstring (ref->terminal_def ()->name () + " - " + device_string (ref->device ()));
|
||||
} else {
|
||||
return tl::to_qstring (ref->device ()->expanded_name ());
|
||||
return make_link_to (ref->device ());
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -1269,7 +1280,7 @@ NetlistBrowserModel::headerData (int section, Qt::Orientation /*orientation*/, i
|
|||
if (section == 0) {
|
||||
return tr ("Object");
|
||||
} else if (section == 1) {
|
||||
return tr ("Attribute");
|
||||
return tr ("Name (Items)");
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -1728,6 +1739,13 @@ NetlistBrowserModel::subcircuit_index (const db::SubCircuit *sub_circuit) const
|
|||
return index_from_attr (sub_circuit, circuit->begin_subcircuits (), circuit->end_subcircuits (), m_subcircuit_index_by_object);
|
||||
}
|
||||
|
||||
size_t
|
||||
NetlistBrowserModel::device_index (const db::Device *device) const
|
||||
{
|
||||
const db::Circuit *circuit = device->circuit ();
|
||||
return index_from_attr (device, circuit->begin_devices (), circuit->end_devices (), m_device_index_by_object);
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------------
|
||||
// NetlistBrowserPage implementation
|
||||
|
||||
|
|
@ -2201,6 +2219,7 @@ NetlistBrowserPage::set_l2ndb (db::LayoutToNetlist *database)
|
|||
connect (directory_tree->selectionModel (), SIGNAL (currentChanged (const QModelIndex &, const QModelIndex &)), this, SLOT (current_index_changed (const QModelIndex &)));
|
||||
connect (directory_tree->selectionModel (), SIGNAL (selectionChanged (const QItemSelection &, const QItemSelection &)), this, SLOT (net_selection_changed ()));
|
||||
|
||||
directory_tree->header ()->show ();
|
||||
directory_tree->header ()->setSortIndicatorShown (true);
|
||||
|
||||
find_text->setText (QString ());
|
||||
|
|
|
|||
|
|
@ -181,9 +181,11 @@ private:
|
|||
QIcon icon (const QModelIndex &index) const;
|
||||
size_t circuit_index (const db::Circuit *circuit) const;
|
||||
size_t net_index (const db::Net *net) const;
|
||||
size_t device_index (const db::Device *device) const;
|
||||
size_t pin_index (const db::Pin *pin, const db::Circuit *circuit) const;
|
||||
size_t subcircuit_index (const db::SubCircuit *subcircuit) const;
|
||||
QString make_link_to (const db::Net *net) const;
|
||||
QString make_link_to (const db::Device *device) const;
|
||||
QString make_link_to (const db::Pin *pin, const db::Circuit *circuit) const;
|
||||
QString make_link_to (const db::Circuit *circuit) const;
|
||||
QString make_link_to (const db::SubCircuit *sub_circuit) const;
|
||||
|
|
@ -210,6 +212,7 @@ private:
|
|||
mutable std::map<const db::Net *, size_t> m_net_index_by_object;
|
||||
mutable std::map<const db::Pin *, size_t> m_pin_index_by_object;
|
||||
mutable std::map<const db::SubCircuit *, size_t> m_subcircuit_index_by_object;
|
||||
mutable std::map<const db::Device *, size_t> m_device_index_by_object;
|
||||
mutable std::map<lay::color_t, QIcon> m_net_icon_per_color;
|
||||
mutable std::map<lay::color_t, QIcon> m_connection_icon_per_color;
|
||||
};
|
||||
|
|
|
|||
Loading…
Reference in New Issue