More consistent behavior of Marker Browser / Scan Shapes

* Scan Shapes Hierarchical will scan from current cell, not all cells
* Marker browser shows markers propertly also in descended mode
* Marker database description of shown in selection box
This commit is contained in:
Matthias Koefferlein 2023-12-03 17:22:48 +01:00
parent ebb35b1f2b
commit 7b4a5c3878
2 changed files with 33 additions and 11 deletions

View File

@ -582,7 +582,13 @@ MarkerBrowserDialog::rdbs_changed ()
for (unsigned int i = 0; i < view ()->num_rdbs (); ++i) {
const rdb::Database *rdb = view ()->get_rdb (i);
mp_ui->rdb_cb->addItem (tl::to_qstring (rdb->name ()));
std::string text = rdb->name ();
if (! rdb->description ().empty ()) {
text += " (";
text += rdb->description ();
text += ")";
}
mp_ui->rdb_cb->addItem (tl::to_qstring (text));
if (rdb->name () == m_rdb_name) {
rdb_index = i;
}
@ -761,23 +767,35 @@ MarkerBrowserDialog::scan_layer ()
std::string desc;
for (std::vector<lay::LayerPropertiesConstIterator>::const_iterator l = layers.begin (); l != layers.end (); ++l) {
if (!(*l)->has_children () && (*l)->cellview_index () >= 0 && layout.is_valid_layer ((*l)->layer_index ())) {
if (!(*l)->has_children () && (*l)->cellview_index () == cv_index && layout.is_valid_layer ((*l)->layer_index ())) {
if (! desc.empty ()) {
desc += ", ";
}
desc += layout.get_properties ((*l)->layer_index ()).to_string ();
}
}
rdb->set_description ("Shapes of layer(s) " + desc);
desc = tl::to_string (tr ("Hierarchical shapes of layer(s) ")) + desc;
desc += " ";
desc += tl::to_string (tr ("from cell "));
desc += cv->layout ().cell_name (cv.cell_index ());
rdb->set_description (desc);
std::set<db::cell_index_type> called_cells;
called_cells.insert (cv.cell_index ());
cv->layout ().cell (cv.cell_index ()).collect_called_cells (called_cells);
for (std::vector<lay::LayerPropertiesConstIterator>::const_iterator l = layers.begin (); l != layers.end (); ++l) {
if (!(*l)->has_children () && (*l)->cellview_index () >= 0 && layout.is_valid_layer ((*l)->layer_index ())) {
if (!(*l)->has_children () && (*l)->cellview_index () == cv_index && layout.is_valid_layer ((*l)->layer_index ())) {
rdb::Category *cat = rdb->create_category (layout.get_properties ((*l)->layer_index ()).to_string ());
rdb::Category *cat = rdb->create_category (layout.get_properties ((*l)->layer_index ()).to_string ());
for (db::Layout::const_iterator cid = layout.begin (); cid != layout.end (); ++cid) {
if (called_cells.find (cid->cell_index ()) == called_cells.end ()) {
continue;
}
const db::Cell &cell = *cid;
if (cell.shapes ((*l)->layer_index ()).size () > 0) {
@ -855,18 +873,22 @@ MarkerBrowserDialog::scan_layer_flat ()
std::string desc;
for (std::vector<lay::LayerPropertiesConstIterator>::const_iterator l = layers.begin (); l != layers.end (); ++l) {
if (!(*l)->has_children () && (*l)->cellview_index () >= 0 && layout.is_valid_layer ((*l)->layer_index ())) {
if (!(*l)->has_children () && (*l)->cellview_index () == cv_index && layout.is_valid_layer ((*l)->layer_index ())) {
if (! desc.empty ()) {
desc += ", ";
}
desc += layout.get_properties ((*l)->layer_index ()).to_string ();
}
}
rdb->set_description ("Shapes of layer(s) " + desc);
desc = tl::to_string (tr ("Flat shapes of layer(s) ")) + desc;
desc += " ";
desc += tl::to_string (tr ("from cell "));
desc += cv->layout ().cell_name (cv.cell_index ());
rdb->set_description (desc);
for (std::vector<lay::LayerPropertiesConstIterator>::const_iterator l = layers.begin (); l != layers.end (); ++l) {
if (!(*l)->has_children () && (*l)->cellview_index () >= 0 && layout.is_valid_layer ((*l)->layer_index ())) {
if (!(*l)->has_children () && (*l)->cellview_index () == cv_index && layout.is_valid_layer ((*l)->layer_index ())) {
rdb::Category *cat = rdb->create_category (layout.get_properties ((*l)->layer_index ()).to_string ());

View File

@ -2148,7 +2148,7 @@ MarkerBrowserPage::do_update_markers ()
lay::CellView cv = mp_view->cellview (m_cv_index);
if (! current_cell && cv.is_valid ()) {
current_cell = mp_database->cell_by_qname (cv->layout ().cell_name (cv.cell_index ()));
current_cell = mp_database->cell_by_qname (cv->layout ().cell_name (cv.ctx_cell_index ()));
}
std::vector<db::DCplxTrans> tv = mp_view->cv_transform_variants (m_cv_index);
@ -2182,7 +2182,7 @@ MarkerBrowserPage::do_update_markers ()
// If we could not find a transformation in the RDB, try to find one in the layout DB:
std::pair<bool, db::cell_index_type> cc = cv->layout ().cell_by_name (c->name ().c_str ());
if (cc.first) {
std::pair <bool, db::ICplxTrans> ic = db::find_layout_context (cv->layout (), cc.second, cv.cell_index ());
std::pair <bool, db::ICplxTrans> ic = db::find_layout_context (cv->layout (), cc.second, cv.ctx_cell_index ());
if (ic.first) {
context.first = true;
context.second = db::DCplxTrans (cv->layout ().dbu ()) * db::DCplxTrans (ic.second) * db::DCplxTrans (1.0 / cv->layout ().dbu ());
@ -2197,7 +2197,7 @@ MarkerBrowserPage::do_update_markers ()
context = std::pair <bool, db::DCplxTrans> (true, db::DCplxTrans ());
} else if (! current_cell) {
m_error_text = tl::sprintf (tl::to_string (QObject::tr ("Current layout cell '%s' not found in marker database and no path found from marker's cell '%s' to current cell in the layout database.")),
cv->layout ().cell_name (cv.cell_index ()), c->name ());
cv->layout ().cell_name (cv.ctx_cell_index ()), c->name ());
} else {
m_error_text = tl::sprintf (tl::to_string (QObject::tr ("No example instantiation given in marker database for marker's cell '%s' to current cell '%s' and no such path in the layout database either.")),
c->name (), current_cell->name ());