mirror of https://github.com/KLayout/klayout.git
WIP: some refactoring, introducing cut layer in via definition
This commit is contained in:
parent
33ffa6367f
commit
39c8e0ca15
|
|
@ -128,6 +128,11 @@ public:
|
|||
*/
|
||||
bool bottom_wired;
|
||||
|
||||
/**
|
||||
* @brief The cut layer
|
||||
*/
|
||||
db::LayerProperties cut;
|
||||
|
||||
/**
|
||||
* @brief The top layer
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -119,6 +119,9 @@ Class<db::ViaType> decl_dbViaType ("db", "ViaType",
|
|||
make_getter_setter<db::ViaType, db::LayerProperties, &db::ViaType::bottom> ("bottom",
|
||||
"@brief The bottom layer of the via.\n"
|
||||
) +
|
||||
make_getter_setter<db::ViaType, db::LayerProperties, &db::ViaType::cut> ("cut",
|
||||
"@brief The cut layer of the via.\n"
|
||||
) +
|
||||
make_getter_setter<db::ViaType, db::LayerProperties, &db::ViaType::top> ("top",
|
||||
"@brief The top layer of the via.\n"
|
||||
) +
|
||||
|
|
|
|||
|
|
@ -1574,6 +1574,10 @@ PathService::via ()
|
|||
db::Instance via_instance = cell ().insert (db::CellInstArray (db::CellInst (via_cell), db::Trans (trans () * via_pos - db::Point ())));
|
||||
push_segment (path_shape, via_instance, via_def.via_type);
|
||||
|
||||
if (! via_def.via_type.cut.is_null ()) {
|
||||
edt::set_or_request_current_layer (view (), via_def.via_type.cut, cv_index (), false /*don't make current*/);
|
||||
}
|
||||
|
||||
change_edit_layer (lp_new);
|
||||
|
||||
m_points.clear ();
|
||||
|
|
|
|||
|
|
@ -114,12 +114,18 @@ config_recent_for_layer (lay::LayoutViewBase *view, const db::LayerProperties &l
|
|||
}
|
||||
|
||||
bool
|
||||
set_or_request_current_layer (lay::LayoutViewBase *view, const db::LayerProperties &lp, unsigned int cv_index)
|
||||
set_or_request_current_layer (lay::LayoutViewBase *view, const db::LayerProperties &lp, unsigned int cv_index, bool make_current)
|
||||
{
|
||||
#if defined(HAVE_QT)
|
||||
bool ok = view->set_current_layer (cv_index, lp);
|
||||
if (ok) {
|
||||
return true;
|
||||
// try to find an existing layer
|
||||
if (make_current) {
|
||||
if (view->set_current_layer (cv_index, lp)) {
|
||||
return true;
|
||||
}
|
||||
} else {
|
||||
if (! view->find_layer (cv_index, lp).is_null ()) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
if (! view->control_panel ()) {
|
||||
|
|
@ -137,11 +143,15 @@ set_or_request_current_layer (lay::LayoutViewBase *view, const db::LayerProperti
|
|||
lpn.set_source (lay::ParsedLayerSource (lp, cv_index));
|
||||
view->init_layer_properties (lpn);
|
||||
|
||||
view->transaction (tl::to_string (QObject::tr ("Create new layer")));
|
||||
lay::LayerPropertiesConstIterator lpi = lay::LayerPropertiesConstIterator (& view->insert_layer (view->end_layers (), lpn));
|
||||
view->set_current_layer (lpi);
|
||||
lpi->realize_source ();
|
||||
view->commit ();
|
||||
{
|
||||
db::Transaction transaction (! view->manager ()->transacting () ? view->manager () : 0, tl::to_string (QObject::tr ("Create new layer")));
|
||||
|
||||
lay::LayerPropertiesConstIterator lpi = lay::LayerPropertiesConstIterator (& view->insert_layer (view->end_layers (), lpn));
|
||||
if (make_current) {
|
||||
view->set_current_layer (lpi);
|
||||
}
|
||||
lpi->realize_source ();
|
||||
}
|
||||
|
||||
return true;
|
||||
|
||||
|
|
|
|||
|
|
@ -83,7 +83,7 @@ config_recent_for_layer (lay::LayoutViewBase *view, const db::LayerProperties &l
|
|||
* @brief Request to make the given layer the current one (asks whether to create the layer if needed)
|
||||
*/
|
||||
bool
|
||||
set_or_request_current_layer (lay::LayoutViewBase *view, const db::LayerProperties &lp, unsigned int cv_index);
|
||||
set_or_request_current_layer (lay::LayoutViewBase *view, const db::LayerProperties &lp, unsigned int cv_index, bool make_current = true);
|
||||
|
||||
/**
|
||||
* @brief A helper class that identifies clipboard data for edt::
|
||||
|
|
|
|||
|
|
@ -1604,19 +1604,30 @@ LayoutViewBase::rename_properties (unsigned int index, const std::string &new_na
|
|||
layer_list_changed_event (4);
|
||||
}
|
||||
|
||||
bool
|
||||
LayoutViewBase::set_current_layer (unsigned int cv_index, const db::LayerProperties &lp)
|
||||
lay::LayerPropertiesConstIterator
|
||||
LayoutViewBase::find_layer (unsigned int cv_index, const db::LayerProperties &lp) const
|
||||
{
|
||||
// rename the ones that got shifted.
|
||||
lay::LayerPropertiesConstIterator l = begin_layers ();
|
||||
while (! l.at_end ()) {
|
||||
if (l->source (true).cv_index () == int (cv_index) && l->source (true).layer_props ().log_equal (lp)) {
|
||||
set_current_layer (l);
|
||||
return true;
|
||||
return l;
|
||||
}
|
||||
++l;
|
||||
}
|
||||
return false;
|
||||
|
||||
return lay::LayerPropertiesConstIterator ();
|
||||
}
|
||||
|
||||
bool
|
||||
LayoutViewBase::set_current_layer (unsigned int cv_index, const db::LayerProperties &lp)
|
||||
{
|
||||
lay::LayerPropertiesConstIterator l = find_layer (cv_index, lp);
|
||||
if (! l.is_null ()) {
|
||||
set_current_layer (l);
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
|
|
|
|||
|
|
@ -602,6 +602,13 @@ public:
|
|||
*/
|
||||
virtual lay::LayerPropertiesConstIterator current_layer () const;
|
||||
|
||||
/**
|
||||
* @brief Finds the first layer by layer properties and cell view index
|
||||
*
|
||||
* Returns a null iterator if the layer is not found in the list.
|
||||
*/
|
||||
virtual lay::LayerPropertiesConstIterator find_layer (unsigned int cv_index, const db::LayerProperties &properties) const;
|
||||
|
||||
/**
|
||||
* @brief Return the layers that are selected in the layer browser
|
||||
*
|
||||
|
|
|
|||
Loading…
Reference in New Issue