mirror of https://github.com/KLayout/klayout.git
Speeding up the netlist browser by shortcutting has_children
This commit is contained in:
parent
c5607777a8
commit
e14a96a421
|
|
@ -910,6 +910,7 @@ public:
|
|||
virtual QString search_text ();
|
||||
virtual std::string tooltip (NetlistBrowserModel *model);
|
||||
virtual db::NetlistCrossReference::Status status (NetlistBrowserModel *model);
|
||||
virtual bool has_children (NetlistBrowserModel *) { return true; }
|
||||
|
||||
CircuitItemData *circuit_item (NetlistBrowserModel *model, const IndexedNetlistModel::circuit_pair &cp);
|
||||
};
|
||||
|
|
@ -928,6 +929,7 @@ public:
|
|||
virtual QString search_text ();
|
||||
virtual std::string tooltip (NetlistBrowserModel *model);
|
||||
virtual db::NetlistCrossReference::Status status (NetlistBrowserModel *model);
|
||||
virtual bool has_children (NetlistBrowserModel *model);
|
||||
|
||||
virtual std::pair<const db::Circuit *, const db::Circuit *> circuits_of_this ()
|
||||
{
|
||||
|
|
@ -980,6 +982,7 @@ public:
|
|||
virtual QString search_text ();
|
||||
virtual std::string tooltip (NetlistBrowserModel *model);
|
||||
virtual db::NetlistCrossReference::Status status (NetlistBrowserModel *model);
|
||||
virtual bool has_children (NetlistBrowserModel *model);
|
||||
|
||||
CircuitNetItemData *circuit_net_item (NetlistBrowserModel *model, const IndexedNetlistModel::net_pair &np);
|
||||
CircuitDeviceItemData *circuit_device_item (NetlistBrowserModel *model, const IndexedNetlistModel::device_pair &dp);
|
||||
|
|
@ -1003,6 +1006,7 @@ public:
|
|||
virtual QString search_text ();
|
||||
virtual std::string tooltip (NetlistBrowserModel *model);
|
||||
virtual db::NetlistCrossReference::Status status (NetlistBrowserModel *model);
|
||||
virtual bool has_children (NetlistBrowserModel *) { return true; }
|
||||
|
||||
const IndexedNetlistModel::net_pair &np ()
|
||||
{
|
||||
|
|
@ -1038,6 +1042,7 @@ public:
|
|||
virtual QString search_text ();
|
||||
virtual std::string tooltip (NetlistBrowserModel *model);
|
||||
virtual db::NetlistCrossReference::Status status (NetlistBrowserModel *model);
|
||||
virtual bool has_children (NetlistBrowserModel *) { return true; }
|
||||
|
||||
const IndexedNetlistModel::net_pair &np ()
|
||||
{
|
||||
|
|
@ -1096,6 +1101,7 @@ public:
|
|||
virtual QString search_text ();
|
||||
virtual std::string tooltip (NetlistBrowserModel *model);
|
||||
virtual db::NetlistCrossReference::Status status (NetlistBrowserModel *model);
|
||||
virtual bool has_children (NetlistBrowserModel *) { return true; }
|
||||
|
||||
const IndexedNetlistModel::net_pair &np ()
|
||||
{
|
||||
|
|
@ -1149,6 +1155,7 @@ public:
|
|||
virtual QString search_text ();
|
||||
virtual std::string tooltip (NetlistBrowserModel *model);
|
||||
virtual db::NetlistCrossReference::Status status (NetlistBrowserModel *model);
|
||||
virtual bool has_children (NetlistBrowserModel *) { return false; }
|
||||
|
||||
virtual std::pair<const db::Pin *, const db::Pin *> pins_of_this ()
|
||||
{
|
||||
|
|
@ -1173,6 +1180,7 @@ public:
|
|||
virtual QString search_text ();
|
||||
virtual std::string tooltip (NetlistBrowserModel *model);
|
||||
virtual db::NetlistCrossReference::Status status (NetlistBrowserModel *model);
|
||||
virtual bool has_children (NetlistBrowserModel *) { return true; }
|
||||
|
||||
const IndexedNetlistModel::subcircuit_pair &sp ()
|
||||
{
|
||||
|
|
@ -1224,6 +1232,7 @@ public:
|
|||
virtual QString search_text ();
|
||||
virtual std::string tooltip (NetlistBrowserModel *model);
|
||||
virtual db::NetlistCrossReference::Status status (NetlistBrowserModel *model);
|
||||
virtual bool has_children (NetlistBrowserModel *model);
|
||||
|
||||
const IndexedNetlistModel::subcircuit_pair &sp ()
|
||||
{
|
||||
|
|
@ -1274,6 +1283,7 @@ public:
|
|||
virtual QString search_text ();
|
||||
virtual std::string tooltip (NetlistBrowserModel *model);
|
||||
virtual db::NetlistCrossReference::Status status (NetlistBrowserModel *model);
|
||||
virtual bool has_children (NetlistBrowserModel *) { return true; }
|
||||
|
||||
const IndexedNetlistModel::device_pair &dp ()
|
||||
{
|
||||
|
|
@ -1594,6 +1604,25 @@ CircuitItemData::do_ensure_children (NetlistBrowserModel *model)
|
|||
}
|
||||
}
|
||||
|
||||
bool
|
||||
CircuitItemData::has_children (NetlistBrowserModel *model)
|
||||
{
|
||||
if (model->indexer ()->pin_count (circuits ()) > 0) {
|
||||
return true;
|
||||
}
|
||||
if (model->indexer ()->net_count (circuits ()) > 0) {
|
||||
return true;
|
||||
}
|
||||
if (model->indexer ()->subcircuit_count (circuits ()) > 0) {
|
||||
return true;
|
||||
}
|
||||
if (model->indexer ()->device_count (circuits ()) > 0) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
QIcon
|
||||
CircuitItemData::icon (NetlistBrowserModel * /*model*/)
|
||||
{
|
||||
|
|
@ -1717,6 +1746,13 @@ CircuitItemNodeData::CircuitItemNodeData (NetlistModelItemData *parent, CircuitI
|
|||
: NetlistModelItemData (parent), m_type (t)
|
||||
{ }
|
||||
|
||||
bool
|
||||
CircuitItemNodeData::has_children (NetlistBrowserModel *)
|
||||
{
|
||||
// the node only exists if it has children
|
||||
return true;
|
||||
}
|
||||
|
||||
void
|
||||
CircuitItemNodeData::do_ensure_children (NetlistBrowserModel *model)
|
||||
{
|
||||
|
|
@ -2216,6 +2252,12 @@ CircuitSubCircuitPinsItemData::CircuitSubCircuitPinsItemData (NetlistModelItemDa
|
|||
: NetlistModelItemData (parent), m_sp (sp)
|
||||
{ }
|
||||
|
||||
bool
|
||||
CircuitSubCircuitPinsItemData::has_children (NetlistBrowserModel *model)
|
||||
{
|
||||
return model->indexer ()->subcircuit_pin_count (sp ()) > 0;
|
||||
}
|
||||
|
||||
void
|
||||
CircuitSubCircuitPinsItemData::do_ensure_children (NetlistBrowserModel *model)
|
||||
{
|
||||
|
|
@ -2887,8 +2929,7 @@ NetlistBrowserModel::hasChildren (const QModelIndex &parent) const
|
|||
d = mp_root.get ();
|
||||
}
|
||||
if (d) {
|
||||
d->ensure_children (const_cast<NetlistBrowserModel *> (this));
|
||||
return d->begin () != d->end ();
|
||||
return d->has_children (const_cast<NetlistBrowserModel *> (this));
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -133,6 +133,7 @@ public:
|
|||
virtual QString search_text () = 0;
|
||||
virtual std::string tooltip (NetlistBrowserModel *model) = 0;
|
||||
virtual db::NetlistCrossReference::Status status (NetlistBrowserModel *model) = 0;
|
||||
virtual bool has_children (NetlistBrowserModel *model) = 0;
|
||||
|
||||
void ensure_children (NetlistBrowserModel *model);
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue