mirror of https://github.com/KLayout/klayout.git
Editor options: recent layers are created if not there.
This commit is contained in:
parent
55f5132514
commit
e42136ee27
|
|
@ -327,7 +327,7 @@ RecentConfigurationPage::item_clicked (QTreeWidgetItem *item)
|
||||||
ex.read (cv_index);
|
ex.read (cv_index);
|
||||||
}
|
}
|
||||||
|
|
||||||
mp_view->set_current_layer (cv_index, lp);
|
mp_view->set_or_request_current_layer (cv_index, lp);
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
dispatcher ()->config_set (c->cfg_name, v);
|
dispatcher ()->config_set (c->cfg_name, v);
|
||||||
|
|
|
||||||
|
|
@ -505,16 +505,14 @@ LayerControlPanel::cm_insert ()
|
||||||
|
|
||||||
BEGIN_PROTECTED_CLEANUP
|
BEGIN_PROTECTED_CLEANUP
|
||||||
|
|
||||||
transaction (tl::to_string (QObject::tr ("Insert views")));
|
transaction (tl::to_string (QObject::tr ("Insert layer view")));
|
||||||
|
|
||||||
props.set_source (tl::to_string (n));
|
props.set_source (tl::to_string (n));
|
||||||
mp_view->init_layer_properties (props);
|
mp_view->init_layer_properties (props);
|
||||||
|
|
||||||
const LayerPropertiesNode &lp = mp_view->insert_layer (sel, props);
|
const LayerPropertiesNode &lp = mp_view->insert_layer (sel, props);
|
||||||
|
|
||||||
if (transacting ()) {
|
set_current_layer (sel);
|
||||||
manager ()->queue (this, new LayerSelectionClearOp ());
|
|
||||||
}
|
|
||||||
mp_layer_list->set_current (sel);
|
|
||||||
|
|
||||||
commit ();
|
commit ();
|
||||||
|
|
||||||
|
|
@ -565,18 +563,12 @@ LayerControlPanel::cm_group ()
|
||||||
|
|
||||||
mp_view->insert_layer (ins_pos, node);
|
mp_view->insert_layer (ins_pos, node);
|
||||||
|
|
||||||
if (transacting ()) {
|
set_current_layer (*sel.rbegin ());
|
||||||
manager ()->queue (this, new LayerSelectionClearOp ());
|
|
||||||
}
|
|
||||||
|
|
||||||
commit ();
|
commit ();
|
||||||
|
|
||||||
end_updates ();
|
|
||||||
|
|
||||||
emit order_changed ();
|
emit order_changed ();
|
||||||
|
|
||||||
mp_layer_list->set_current (*sel.rbegin ());
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
END_PROTECTED_CLEANUP { recover (); }
|
END_PROTECTED_CLEANUP { recover (); }
|
||||||
|
|
@ -1907,8 +1899,14 @@ LayerControlPanel::do_update_content ()
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
LayerControlPanel::set_current_layer (const lay::LayerPropertiesConstIterator &l) const
|
LayerControlPanel::set_current_layer (const lay::LayerPropertiesConstIterator &l)
|
||||||
{
|
{
|
||||||
|
if (transacting ()) {
|
||||||
|
manager ()->queue (this, new LayerSelectionClearOp ());
|
||||||
|
}
|
||||||
|
|
||||||
|
end_updates ();
|
||||||
|
|
||||||
mp_layer_list->set_current (l);
|
mp_layer_list->set_current (l);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -250,7 +250,7 @@ public:
|
||||||
*
|
*
|
||||||
* This will also select this layer.
|
* This will also select this layer.
|
||||||
*/
|
*/
|
||||||
void set_current_layer (const lay::LayerPropertiesConstIterator &l) const;
|
void set_current_layer (const lay::LayerPropertiesConstIterator &l);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Return the current layer index
|
* @brief Return the current layer index
|
||||||
|
|
|
||||||
|
|
@ -1709,7 +1709,41 @@ LayoutView::enable_edits (bool enable)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
bool
|
||||||
|
LayoutView::set_or_request_current_layer (unsigned int cv_index, const db::LayerProperties &lp)
|
||||||
|
{
|
||||||
|
bool ok = set_current_layer (cv_index, lp);
|
||||||
|
if (ok) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (! mp_control_panel) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
const lay::CellView &cv = cellview (cv_index);
|
||||||
|
if (! cv.is_valid ()) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (QMessageBox::question (this, tr ("Create Layer"), tr ("Layer %1 does not exist yet. Create it now?").arg (tl::to_qstring (lp.to_string ()))) == QMessageBox::Yes) {
|
||||||
|
|
||||||
|
lay::LayerPropertiesNode lpn;
|
||||||
|
lpn.set_source (lay::ParsedLayerSource (lp, cv_index));
|
||||||
|
init_layer_properties (lpn);
|
||||||
|
|
||||||
|
transaction (tl::to_string (QObject::tr ("Create new layer")));
|
||||||
|
set_current_layer (lay::LayerPropertiesConstIterator (& insert_layer (end_layers (), lpn)));
|
||||||
|
commit ();
|
||||||
|
|
||||||
|
return true;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool
|
||||||
LayoutView::set_current_layer (unsigned int cv_index, const db::LayerProperties &lp)
|
LayoutView::set_current_layer (unsigned int cv_index, const db::LayerProperties &lp)
|
||||||
{
|
{
|
||||||
// rename the ones that got shifted.
|
// rename the ones that got shifted.
|
||||||
|
|
@ -1717,10 +1751,11 @@ LayoutView::set_current_layer (unsigned int cv_index, const db::LayerProperties
|
||||||
while (! l.at_end ()) {
|
while (! l.at_end ()) {
|
||||||
if (l->source (true).cv_index () == int (cv_index) && l->source (true).layer_props ().log_equal (lp)) {
|
if (l->source (true).cv_index () == int (cv_index) && l->source (true).layer_props ().log_equal (lp)) {
|
||||||
set_current_layer (l);
|
set_current_layer (l);
|
||||||
break;
|
return true;
|
||||||
}
|
}
|
||||||
++l;
|
++l;
|
||||||
}
|
}
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
|
|
||||||
|
|
@ -780,8 +780,18 @@ public:
|
||||||
*
|
*
|
||||||
* This method will look up that layer in the layer view tree and select that layer.
|
* This method will look up that layer in the layer view tree and select that layer.
|
||||||
* This method will also select this layer.
|
* This method will also select this layer.
|
||||||
|
*
|
||||||
|
* Returns false if the layer is not a valid one.
|
||||||
*/
|
*/
|
||||||
void set_current_layer (unsigned int cv_index, const db::LayerProperties &properties);
|
bool set_current_layer (unsigned int cv_index, const db::LayerProperties &properties);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Sets the currently active layer by layer properties and cell view index
|
||||||
|
*
|
||||||
|
* If the layer does not exist, the user will be asked whether to create the layer.
|
||||||
|
* Returns false if the layer is not a valid one and the user defined to create the layer.
|
||||||
|
*/
|
||||||
|
bool set_or_request_current_layer (unsigned int cv_index, const db::LayerProperties &properties);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Sets the currently active layer
|
* @brief Sets the currently active layer
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue