Config option: disable generation of new layers

The name of the config option is "auto-create-new-layers".
It is a per-view option and can be edited on the
"Application/Layer Properties" page.

With this option set to true (default), new layers
are automatically added to the layer list on

1. Paste of cells and shapes
2. Placing of instances

Manually adding new layers to the layer list is always possible.
This commit is contained in:
Matthias Koefferlein 2026-04-04 15:28:05 +02:00
parent 65fec36902
commit 60a210c264
10 changed files with 129 additions and 56 deletions

View File

@ -934,7 +934,9 @@ InstPropertiesPage::do_apply (bool current_only, bool relative)
throw; throw;
} }
if (mp_service->view ()->auto_create_new_layers ()) {
mp_service->view ()->add_new_layers (layer_state); mp_service->view ()->add_new_layers (layer_state);
}
// remove superfluous proxies // remove superfluous proxies
for (unsigned int i = 0; i < mp_service->view ()->cellviews (); ++i) { for (unsigned int i = 0; i < mp_service->view ()->cellviews (); ++i) {

View File

@ -332,7 +332,9 @@ InstService::make_cell (const lay::CellView &cv)
} }
if (view ()->auto_create_new_layers ()) {
view ()->add_new_layers (layer_state); view ()->add_new_layers (layer_state);
}
m_has_valid_cell = true; m_has_valid_cell = true;
m_current_cell = inst_cell_index; m_current_cell = inst_cell_index;

View File

@ -2685,7 +2685,9 @@ MainService::paste ()
} }
// Add new layers to the view if required. // Add new layers to the view if required.
if (mp_view->auto_create_new_layers ()) {
view ()->add_new_layers (new_layers, cv_index); view ()->add_new_layers (new_layers, cv_index);
}
view ()->update_content (); view ()->update_content ();
} }

View File

@ -362,6 +362,7 @@ LayoutViewBase::init (db::Manager *mgr)
m_clear_ruler_new_cell = false; m_clear_ruler_new_cell = false;
m_dbu_coordinates = false; m_dbu_coordinates = false;
m_absolute_coordinates = false; m_absolute_coordinates = false;
m_auto_create_new_layers = true;
m_drop_small_cells = false; m_drop_small_cells = false;
m_drop_small_cells_value = 10; m_drop_small_cells_value = 10;
m_drop_small_cells_cond = DSC_Max; m_drop_small_cells_cond = DSC_Max;
@ -1099,6 +1100,13 @@ LayoutViewBase::configure (const std::string &name, const std::string &value)
absolute_coordinates (flag); absolute_coordinates (flag);
return true; return true;
} else if (name == cfg_auto_create_new_layers) {
bool flag;
tl::from_string (value, flag);
auto_create_new_layers (flag);
return true;
} else if (name == cfg_guiding_shape_visible) { } else if (name == cfg_guiding_shape_visible) {
bool v = false; bool v = false;
@ -4965,6 +4973,12 @@ LayoutViewBase::absolute_coordinates (bool f)
m_absolute_coordinates = f; m_absolute_coordinates = f;
} }
void
LayoutViewBase::auto_create_new_layers (bool f)
{
m_auto_create_new_layers = f;
}
void void
LayoutViewBase::select_cellviews_fit (const std::list <CellView> &cvs) LayoutViewBase::select_cellviews_fit (const std::list <CellView> &cvs)
{ {

View File

@ -1884,6 +1884,22 @@ public:
*/ */
void absolute_coordinates (bool f); void absolute_coordinates (bool f);
/**
* @brief Gets a value indicating whether new layer entries shall be created in the view
*
* Certain operations such as paste or creation of instances establish new layers.
* This flag controls whether such new layers are automatically added to the layer list.
*/
bool auto_create_new_layers () const
{
return m_auto_create_new_layers;
}
/**
* @brief Sets a value indicating whether new layer entries shall be created in the view
*/
void auto_create_new_layers (bool f);
/** /**
* @brief Gets the canvas object (where the layout is drawn and view objects are placed) * @brief Gets the canvas object (where the layout is drawn and view objects are placed)
*/ */
@ -3092,6 +3108,7 @@ private:
bool m_clear_ruler_new_cell; bool m_clear_ruler_new_cell;
bool m_dbu_coordinates; bool m_dbu_coordinates;
bool m_absolute_coordinates; bool m_absolute_coordinates;
bool m_auto_create_new_layers;
bool m_dirty; bool m_dirty;
bool m_prop_changed; bool m_prop_changed;

View File

@ -114,6 +114,7 @@ public:
options.push_back (std::pair<std::string, std::string> (cfg_guiding_shape_color, cc.to_string (tl::Color ()))); options.push_back (std::pair<std::string, std::string> (cfg_guiding_shape_color, cc.to_string (tl::Color ())));
options.push_back (std::pair<std::string, std::string> (cfg_guiding_shape_vertex_size, "5")); options.push_back (std::pair<std::string, std::string> (cfg_guiding_shape_vertex_size, "5"));
options.push_back (std::pair<std::string, std::string> (cfg_abs_units, "false")); options.push_back (std::pair<std::string, std::string> (cfg_abs_units, "false"));
options.push_back (std::pair<std::string, std::string> (cfg_auto_create_new_layers, "true"));
options.push_back (std::pair<std::string, std::string> (cfg_dbu_units, "false")); options.push_back (std::pair<std::string, std::string> (cfg_dbu_units, "false"));
options.push_back (std::pair<std::string, std::string> (cfg_drawing_workers, "1")); options.push_back (std::pair<std::string, std::string> (cfg_drawing_workers, "1"));
options.push_back (std::pair<std::string, std::string> (cfg_drop_small_cells, "false")); options.push_back (std::pair<std::string, std::string> (cfg_drop_small_cells, "false"));

View File

@ -119,6 +119,7 @@ static const std::string cfg_stipple_palette ("stipple-palette");
static const std::string cfg_line_style_palette ("line-style-palette"); static const std::string cfg_line_style_palette ("line-style-palette");
static const std::string cfg_dbu_units ("dbu-units"); static const std::string cfg_dbu_units ("dbu-units");
static const std::string cfg_abs_units ("absolute-units"); static const std::string cfg_abs_units ("absolute-units");
static const std::string cfg_auto_create_new_layers ("auto-create-new-layers");
static const std::string cfg_drawing_workers ("drawing-workers"); static const std::string cfg_drawing_workers ("drawing-workers");
static const std::string cfg_drop_small_cells ("drop-small-cells"); static const std::string cfg_drop_small_cells ("drop-small-cells");
static const std::string cfg_drop_small_cells_cond ("drop-small-cells-condition"); static const std::string cfg_drop_small_cells_cond ("drop-small-cells-condition");

View File

@ -1,3 +1,4 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0"> <ui version="4.0">
<class>LayoutViewConfigPage5</class> <class>LayoutViewConfigPage5</class>
<widget class="QFrame" name="LayoutViewConfigPage5"> <widget class="QFrame" name="LayoutViewConfigPage5">
@ -6,19 +7,19 @@
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>694</width> <width>694</width>
<height>301</height> <height>453</height>
</rect> </rect>
</property> </property>
<property name="windowTitle"> <property name="windowTitle">
<string>Application Settings</string> <string>Application Settings</string>
</property> </property>
<layout class="QVBoxLayout"> <layout class="QVBoxLayout">
<property name="margin" >
<number>9</number>
</property>
<property name="spacing"> <property name="spacing">
<number>6</number> <number>6</number>
</property> </property>
<property name="margin" stdset="0">
<number>9</number>
</property>
<item> <item>
<widget class="QGroupBox" name="lyp_file_gbx"> <widget class="QGroupBox" name="lyp_file_gbx">
<property name="title"> <property name="title">
@ -28,7 +29,7 @@
<bool>true</bool> <bool>true</bool>
</property> </property>
<layout class="QGridLayout"> <layout class="QGridLayout">
<property name="margin" > <property name="margin" stdset="0">
<number>9</number> <number>9</number>
</property> </property>
<property name="spacing"> <property name="spacing">
@ -54,7 +55,7 @@
<item row="2" column="0" colspan="2"> <item row="2" column="0" colspan="2">
<widget class="QLabel" name="label_2"> <widget class="QLabel" name="label_2">
<property name="text"> <property name="text">
<string>&lt;html>&lt;body>&lt;b>Hint&lt;/b>: a technology or reader specific layer properties file (i.e. for PCB import) will override this setting.&lt;/p>&lt;/body>&lt;/html></string> <string>&lt;html&gt;&lt;body&gt;&lt;b&gt;Hint&lt;/b&gt;: a technology or reader specific layer properties file (i.e. for PCB import) will override this setting.&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property> </property>
<property name="wordWrap"> <property name="wordWrap">
<bool>true</bool> <bool>true</bool>
@ -79,7 +80,7 @@
<property name="sizeType"> <property name="sizeType">
<enum>QSizePolicy::Fixed</enum> <enum>QSizePolicy::Fixed</enum>
</property> </property>
<property name="sizeHint" > <property name="sizeHint" stdset="0">
<size> <size>
<width>20</width> <width>20</width>
<height>5</height> <height>5</height>
@ -96,12 +97,12 @@
<string>Layer properties display</string> <string>Layer properties display</string>
</property> </property>
<layout class="QVBoxLayout"> <layout class="QVBoxLayout">
<property name="margin" >
<number>9</number>
</property>
<property name="spacing"> <property name="spacing">
<number>6</number> <number>6</number>
</property> </property>
<property name="margin" stdset="0">
<number>9</number>
</property>
<item> <item>
<widget class="QCheckBox" name="source_display_cb"> <widget class="QCheckBox" name="source_display_cb">
<property name="text"> <property name="text">
@ -126,6 +127,32 @@
</layout> </layout>
</widget> </widget>
</item> </item>
<item>
<widget class="QGroupBox" name="groupBox_2">
<property name="title">
<string>On new layers</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<widget class="QLabel" name="label_3">
<property name="text">
<string>New layers are created implicitly when new content is pasted or instances are placed.</string>
</property>
<property name="wordWrap">
<bool>true</bool>
</property>
</widget>
</item>
<item>
<widget class="QCheckBox" name="auto_create_new_layers_cb">
<property name="text">
<string>New layers are automatically added to the layer list</string>
</property>
</widget>
</item>
</layout>
</widget>
</item>
</layout> </layout>
</widget> </widget>
<layoutdefault spacing="6" margin="11"/> <layoutdefault spacing="6" margin="11"/>

View File

@ -1214,7 +1214,9 @@ HierarchyControlPanel::paste ()
// Add new layers to the view if required. // Add new layers to the view if required.
if (! new_layers.empty ()) { if (! new_layers.empty ()) {
if (mp_view->auto_create_new_layers ()) {
mp_view->add_new_layers (new_layers, m_active_index); mp_view->add_new_layers (new_layers, m_active_index);
}
mp_view->update_content (); mp_view->update_content ();
} }

View File

@ -1013,6 +1013,10 @@ LayoutViewConfigPage5::setup (lay::Dispatcher *root)
bool always_show_li = false; bool always_show_li = false;
root->config_get (cfg_layers_always_show_layout_index, always_show_li); root->config_get (cfg_layers_always_show_layout_index, always_show_li);
mp_ui->ly_index_cb->setChecked (always_show_li); mp_ui->ly_index_cb->setChecked (always_show_li);
bool auto_create_new_layers = true;
root->config_get (cfg_auto_create_new_layers, auto_create_new_layers);
mp_ui->auto_create_new_layers_cb->setChecked (auto_create_new_layers);
} }
void void
@ -1027,6 +1031,7 @@ LayoutViewConfigPage5::commit (lay::Dispatcher *root)
root->config_set (cfg_layers_always_show_source, mp_ui->source_display_cb->isChecked ()); root->config_set (cfg_layers_always_show_source, mp_ui->source_display_cb->isChecked ());
root->config_set (cfg_layers_always_show_ld, mp_ui->ld_display_cb->isChecked ()); root->config_set (cfg_layers_always_show_ld, mp_ui->ld_display_cb->isChecked ());
root->config_set (cfg_layers_always_show_layout_index, mp_ui->ly_index_cb->isChecked ()); root->config_set (cfg_layers_always_show_layout_index, mp_ui->ly_index_cb->isChecked ());
root->config_set (cfg_auto_create_new_layers, mp_ui->auto_create_new_layers_cb->isChecked ());
} }
void void