From 60a210c264095b014a898e34f81a7e5f7faf33ec Mon Sep 17 00:00:00 2001 From: Matthias Koefferlein Date: Sat, 4 Apr 2026 15:28:05 +0200 Subject: [PATCH] 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. --- src/edt/edt/edtInstPropertiesPage.cc | 4 +- src/edt/edt/edtInstService.cc | 4 +- src/edt/edt/edtMainService.cc | 4 +- src/laybasic/laybasic/layLayoutViewBase.cc | 16 ++- src/laybasic/laybasic/layLayoutViewBase.h | 17 +++ src/laybasic/laybasic/layLayoutViewConfig.cc | 1 + src/laybasic/laybasic/laybasicConfig.h | 1 + src/layui/layui/LayoutViewConfigPage5.ui | 129 +++++++++++-------- src/layui/layui/layHierarchyControlPanel.cc | 4 +- src/layui/layui/layLayoutViewConfigPages.cc | 5 + 10 files changed, 129 insertions(+), 56 deletions(-) diff --git a/src/edt/edt/edtInstPropertiesPage.cc b/src/edt/edt/edtInstPropertiesPage.cc index 8c28e4f1f..e1eeb1d71 100644 --- a/src/edt/edt/edtInstPropertiesPage.cc +++ b/src/edt/edt/edtInstPropertiesPage.cc @@ -934,7 +934,9 @@ InstPropertiesPage::do_apply (bool current_only, bool relative) throw; } - mp_service->view ()->add_new_layers (layer_state); + if (mp_service->view ()->auto_create_new_layers ()) { + mp_service->view ()->add_new_layers (layer_state); + } // remove superfluous proxies for (unsigned int i = 0; i < mp_service->view ()->cellviews (); ++i) { diff --git a/src/edt/edt/edtInstService.cc b/src/edt/edt/edtInstService.cc index 6c8794276..e78721a6a 100644 --- a/src/edt/edt/edtInstService.cc +++ b/src/edt/edt/edtInstService.cc @@ -332,7 +332,9 @@ InstService::make_cell (const lay::CellView &cv) } - view ()->add_new_layers (layer_state); + if (view ()->auto_create_new_layers ()) { + view ()->add_new_layers (layer_state); + } m_has_valid_cell = true; m_current_cell = inst_cell_index; diff --git a/src/edt/edt/edtMainService.cc b/src/edt/edt/edtMainService.cc index 2187b574d..92f5f777c 100644 --- a/src/edt/edt/edtMainService.cc +++ b/src/edt/edt/edtMainService.cc @@ -2685,7 +2685,9 @@ MainService::paste () } // Add new layers to the view if required. - view ()->add_new_layers (new_layers, cv_index); + if (mp_view->auto_create_new_layers ()) { + view ()->add_new_layers (new_layers, cv_index); + } view ()->update_content (); } diff --git a/src/laybasic/laybasic/layLayoutViewBase.cc b/src/laybasic/laybasic/layLayoutViewBase.cc index b0c537a40..b1c80ce58 100644 --- a/src/laybasic/laybasic/layLayoutViewBase.cc +++ b/src/laybasic/laybasic/layLayoutViewBase.cc @@ -362,6 +362,7 @@ LayoutViewBase::init (db::Manager *mgr) m_clear_ruler_new_cell = false; m_dbu_coordinates = false; m_absolute_coordinates = false; + m_auto_create_new_layers = true; m_drop_small_cells = false; m_drop_small_cells_value = 10; m_drop_small_cells_cond = DSC_Max; @@ -1099,6 +1100,13 @@ LayoutViewBase::configure (const std::string &name, const std::string &value) absolute_coordinates (flag); 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) { bool v = false; @@ -4965,7 +4973,13 @@ LayoutViewBase::absolute_coordinates (bool f) m_absolute_coordinates = f; } -void +void +LayoutViewBase::auto_create_new_layers (bool f) +{ + m_auto_create_new_layers = f; +} + +void LayoutViewBase::select_cellviews_fit (const std::list &cvs) { if (m_cellviews != cvs) { diff --git a/src/laybasic/laybasic/layLayoutViewBase.h b/src/laybasic/laybasic/layLayoutViewBase.h index eaa83b818..c8cf43a4c 100644 --- a/src/laybasic/laybasic/layLayoutViewBase.h +++ b/src/laybasic/laybasic/layLayoutViewBase.h @@ -1884,6 +1884,22 @@ public: */ 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) */ @@ -3092,6 +3108,7 @@ private: bool m_clear_ruler_new_cell; bool m_dbu_coordinates; bool m_absolute_coordinates; + bool m_auto_create_new_layers; bool m_dirty; bool m_prop_changed; diff --git a/src/laybasic/laybasic/layLayoutViewConfig.cc b/src/laybasic/laybasic/layLayoutViewConfig.cc index dd65bad15..590429231 100644 --- a/src/laybasic/laybasic/layLayoutViewConfig.cc +++ b/src/laybasic/laybasic/layLayoutViewConfig.cc @@ -114,6 +114,7 @@ public: options.push_back (std::pair (cfg_guiding_shape_color, cc.to_string (tl::Color ()))); options.push_back (std::pair (cfg_guiding_shape_vertex_size, "5")); options.push_back (std::pair (cfg_abs_units, "false")); + options.push_back (std::pair (cfg_auto_create_new_layers, "true")); options.push_back (std::pair (cfg_dbu_units, "false")); options.push_back (std::pair (cfg_drawing_workers, "1")); options.push_back (std::pair (cfg_drop_small_cells, "false")); diff --git a/src/laybasic/laybasic/laybasicConfig.h b/src/laybasic/laybasic/laybasicConfig.h index f3b6b2c03..8506f6776 100644 --- a/src/laybasic/laybasic/laybasicConfig.h +++ b/src/laybasic/laybasic/laybasicConfig.h @@ -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_dbu_units ("dbu-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_drop_small_cells ("drop-small-cells"); static const std::string cfg_drop_small_cells_cond ("drop-small-cells-condition"); diff --git a/src/layui/layui/LayoutViewConfigPage5.ui b/src/layui/layui/LayoutViewConfigPage5.ui index f8a02467c..0fbfba3f4 100644 --- a/src/layui/layui/LayoutViewConfigPage5.ui +++ b/src/layui/layui/LayoutViewConfigPage5.ui @@ -1,85 +1,86 @@ - + + LayoutViewConfigPage5 - - + + 0 0 694 - 301 + 453 - + Application Settings - - - 9 - - + + 6 + + 9 + - - + + Use default layer properties file - + true - - + + 9 - + 6 - - - + + + ... - - - + + + Automatically add other layers - - + + - - - - <html><body><b>Hint</b>: a technology or reader specific layer properties file (i.e. for PCB import) will override this setting.</p></body></html> + + + + <html><body><b>Hint</b>: a technology or reader specific layer properties file (i.e. for PCB import) will override this setting.</p></body></html> - + true - - - + + + The following layer properties file is loaded into the layer view list every time a layout is opened or created: - + true - + - + Qt::Vertical - + QSizePolicy::Fixed - + 20 5 @@ -91,34 +92,34 @@ - - + + Layer properties display - - - 9 - - + + 6 + + 9 + - - + + Always show layer source in layer list - - + + Always show layer and datatype together with database name in layer source - - + + Always show layout index in layer source @@ -126,9 +127,35 @@ + + + + On new layers + + + + + + New layers are created implicitly when new content is pasted or instances are placed. + + + true + + + + + + + New layers are automatically added to the layer list + + + + + + - + lyp_file_gbx lyp_file_le diff --git a/src/layui/layui/layHierarchyControlPanel.cc b/src/layui/layui/layHierarchyControlPanel.cc index 131323839..2b948058c 100644 --- a/src/layui/layui/layHierarchyControlPanel.cc +++ b/src/layui/layui/layHierarchyControlPanel.cc @@ -1214,7 +1214,9 @@ HierarchyControlPanel::paste () // Add new layers to the view if required. if (! new_layers.empty ()) { - mp_view->add_new_layers (new_layers, m_active_index); + if (mp_view->auto_create_new_layers ()) { + mp_view->add_new_layers (new_layers, m_active_index); + } mp_view->update_content (); } diff --git a/src/layui/layui/layLayoutViewConfigPages.cc b/src/layui/layui/layLayoutViewConfigPages.cc index ac6ecfe7f..3b70dc170 100644 --- a/src/layui/layui/layLayoutViewConfigPages.cc +++ b/src/layui/layui/layLayoutViewConfigPages.cc @@ -1013,6 +1013,10 @@ LayoutViewConfigPage5::setup (lay::Dispatcher *root) bool always_show_li = false; root->config_get (cfg_layers_always_show_layout_index, 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 @@ -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_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_auto_create_new_layers, mp_ui->auto_create_new_layers_cb->isChecked ()); } void