Persisting settings of search features (see discussion 2868)

This commit is contained in:
Matthias Koefferlein 2026-04-30 21:35:48 +02:00
parent 9ad273d834
commit 5d60cfe27d
8 changed files with 269 additions and 3 deletions

View File

@ -48,6 +48,12 @@ public:
options.push_back (std::pair<std::string, std::string> (cfg_layers_always_show_ld, "true"));
options.push_back (std::pair<std::string, std::string> (cfg_layers_always_show_layout_index, "false"));
options.push_back (std::pair<std::string, std::string> (cfg_test_shapes_in_view, "false"));
options.push_back (std::pair<std::string, std::string> (cfg_layer_search_as_expressions, "true"));
options.push_back (std::pair<std::string, std::string> (cfg_layer_search_as_filter, "false"));
options.push_back (std::pair<std::string, std::string> (cfg_layer_search_case_sensitive, "true"));
options.push_back (std::pair<std::string, std::string> (cfg_cell_search_as_expressions, "true"));
options.push_back (std::pair<std::string, std::string> (cfg_cell_search_as_filter, "false"));
options.push_back (std::pair<std::string, std::string> (cfg_cell_search_case_sensitive, "true"));
options.push_back (std::pair<std::string, std::string> (cfg_flat_cell_list, "false"));
options.push_back (std::pair<std::string, std::string> (cfg_split_cell_list, "false"));
options.push_back (std::pair<std::string, std::string> (cfg_cell_list_sorting, "by-name"));

View File

@ -135,6 +135,13 @@ static const std::string cfg_layers_always_show_layout_index ("layers-always-sho
static const std::string cfg_reader_options_show_always ("reader-options-show-always");
static const std::string cfg_tip_window_hidden ("tip-window-hidden");
static const std::string cfg_layer_search_as_expressions ("layer-search-as-expressions");
static const std::string cfg_layer_search_as_filter ("layer-search-as-filter");
static const std::string cfg_layer_search_case_sensitive ("layer-search-case-sensitive");
static const std::string cfg_cell_search_as_expressions ("cell-search-as-expressions");
static const std::string cfg_cell_search_as_filter ("cell-search-as-filter");
static const std::string cfg_cell_search_case_sensitive ("cell-search-case-sensitive");
static const std::string cfg_bitmap_oversampling ("bitmap-oversampling");
static const std::string cfg_highres_mode ("highres-mode");
static const std::string cfg_subres_mode ("subres-mode");

View File

@ -264,7 +264,7 @@ HierarchyControlPanel::HierarchyControlPanel (lay::LayoutViewBase *view, QWidget
mp_search_edit_box->set_escape_signal_enabled (true);
mp_search_edit_box->set_tab_signal_enabled (true);
connect (mp_search_edit_box, SIGNAL (returnPressed ()), this, SLOT (search_editing_finished ()));
connect (mp_search_edit_box, SIGNAL (textEdited (const QString &)), this, SLOT (search_edited ()));
connect (mp_search_edit_box, SIGNAL (textEdited (const QString &)), this, SLOT (search_edited_no_signal ()));
connect (mp_search_edit_box, SIGNAL (esc_pressed ()), this, SLOT (search_editing_finished ()));
connect (mp_search_edit_box, SIGNAL (tab_pressed ()), this, SLOT (search_next ()));
connect (mp_search_edit_box, SIGNAL (backtab_pressed ()), this, SLOT (search_prev ()));
@ -452,8 +452,42 @@ HierarchyControlPanel::search_triggered (const QString &t)
}
}
void
HierarchyControlPanel::set_search_as_filter (bool f)
{
if (f != search_as_filter ()) {
mp_filter->setChecked (f);
search_edited_no_signal ();
}
}
void
HierarchyControlPanel::set_search_case_sensitive (bool f)
{
if (f != search_case_sensitive ()) {
mp_case_sensitive->setChecked (f);
search_edited_no_signal ();
}
}
void
HierarchyControlPanel::set_search_as_expression (bool f)
{
if (f != search_as_expression ()) {
mp_use_regular_expressions->setChecked (f);
search_edited_no_signal ();
}
}
void
HierarchyControlPanel::search_edited ()
{
search_edited_no_signal ();
emit search_options_changed ();
}
void
HierarchyControlPanel::search_edited_no_signal ()
{
bool filter_invalid = false;

View File

@ -152,6 +152,52 @@ public:
return m_active_index;
}
/**
* @brief Sets the "as_filter" flag for the search feature
*
* If this flag is set, search expressions are applied as filter
*/
void set_search_as_filter (bool f);
/**
* @brief Gets the "search_as_filter" flag
*/
bool search_as_filter ()
{
return mp_filter->isChecked ();
}
/**
* @brief Sets the "case_sensitive" flag for the search feature
*
* If this flag is set, search expressions are case sensitive
*/
void set_search_case_sensitive (bool f);
/**
* @brief Gets the "case_sensitive" flag for the search feature
*/
bool search_case_sensitive ()
{
return mp_case_sensitive->isChecked ();
}
/**
* @brief Sets the "as_expression" flag for the search feature
*
* If this flag is set, search expressions are handled as glob expressions
*/
void set_search_as_expression (bool f);
/**
* @brief Gets the "as_expression" flag for the search feature
*/
bool search_as_expression ()
{
return mp_use_regular_expressions->isChecked ();
}
/**
* @brief Returns the paths of the selected cells
*/
@ -273,6 +319,7 @@ public:
signals:
void cell_selected (cell_path_type path, int cellview_index);
void active_cellview_changed (int cellview_index);
void search_options_changed ();
public slots:
void clicked (const QModelIndex &index);
@ -283,6 +330,7 @@ public slots:
void context_menu (const QPoint &pt);
void search_triggered (const QString &t);
void search_edited ();
void search_edited_no_signal ();
void search_editing_finished ();
void search_next ();
void search_prev ();

View File

@ -257,7 +257,7 @@ LayerControlPanel::LayerControlPanel (lay::LayoutViewBase *view, db::Manager *ma
mp_search_edit_box->set_escape_signal_enabled (true);
mp_search_edit_box->set_tab_signal_enabled (true);
connect (mp_search_edit_box, SIGNAL (returnPressed ()), this, SLOT (search_editing_finished ()));
connect (mp_search_edit_box, SIGNAL (textEdited (const QString &)), this, SLOT (search_edited ()));
connect (mp_search_edit_box, SIGNAL (textEdited (const QString &)), this, SLOT (search_edited_no_signal ()));
connect (mp_search_edit_box, SIGNAL (esc_pressed ()), this, SLOT (search_editing_finished ()));
connect (mp_search_edit_box, SIGNAL (tab_pressed ()), this, SLOT (search_next ()));
connect (mp_search_edit_box, SIGNAL (backtab_pressed ()), this, SLOT (search_prev ()));
@ -1160,12 +1160,46 @@ LayerControlPanel::search_triggered (const QString &t)
mp_search_frame->show ();
mp_search_edit_box->setText (t);
mp_search_edit_box->setFocus ();
search_edited ();
search_edited_no_signal ();
}
}
void
LayerControlPanel::set_search_as_filter (bool f)
{
if (f != search_as_filter ()) {
mp_filter->setChecked (f);
search_edited_no_signal ();
}
}
void
LayerControlPanel::set_search_case_sensitive (bool f)
{
if (f != search_case_sensitive ()) {
mp_case_sensitive->setChecked (f);
search_edited_no_signal ();
}
}
void
LayerControlPanel::set_search_as_expression (bool f)
{
if (f != search_as_expression ()) {
mp_use_regular_expressions->setChecked (f);
search_edited_no_signal ();
}
}
void
LayerControlPanel::search_edited ()
{
search_edited_no_signal ();
emit search_options_changed ();
}
void
LayerControlPanel::search_edited_no_signal ()
{
if (! mp_model) {
return;

View File

@ -215,6 +215,51 @@ public:
return mp_model->get_test_shapes_in_view ();
}
/**
* @brief Sets the "as_filter" flag for the search feature
*
* If this flag is set, search expressions are applied as filter
*/
void set_search_as_filter (bool f);
/**
* @brief Gets the "search_as_filter" flag
*/
bool search_as_filter ()
{
return mp_filter->isChecked ();
}
/**
* @brief Sets the "case_sensitive" flag for the search feature
*
* If this flag is set, search expressions are case sensitive
*/
void set_search_case_sensitive (bool f);
/**
* @brief Gets the "case_sensitive" flag for the search feature
*/
bool search_case_sensitive ()
{
return mp_case_sensitive->isChecked ();
}
/**
* @brief Sets the "as_expression" flag for the search feature
*
* If this flag is set, search expressions are handled as glob expressions
*/
void set_search_as_expression (bool f);
/**
* @brief Gets the "as_expression" flag for the search feature
*/
bool search_as_expression ()
{
return mp_use_regular_expressions->isChecked ();
}
/**
* @brief Set the animation phase
*/
@ -297,6 +342,7 @@ signals:
void tab_changed ();
void current_layer_changed (const lay::LayerPropertiesConstIterator &iter);
void selected_layers_changed ();
void search_options_changed ();
public slots:
void cm_new_tab ();
@ -344,6 +390,7 @@ public slots:
void downdown_clicked ();
void search_triggered (const QString &t);
void search_edited ();
void search_edited_no_signal ();
void search_editing_finished ();
void search_next ();
void search_prev ();

View File

@ -404,6 +404,16 @@ void LayoutViewSignalConnector::layer_order_changed ()
mp_view->layer_order_changed ();
}
void LayoutViewSignalConnector::layer_search_options_edited ()
{
mp_view->layer_search_options_edited ();
}
void LayoutViewSignalConnector::cell_search_options_edited ()
{
mp_view->cell_search_options_edited ();
}
void LayoutViewSignalConnector::min_hier_changed (int i)
{
mp_view->min_hier_changed (i);
@ -573,6 +583,7 @@ LayoutView::init_ui (db::Manager *mgr)
mp_hierarchy_panel = new lay::HierarchyControlPanel (this, hierarchy_frame, "hcp");
left_frame_ly->addWidget (mp_hierarchy_panel, 1 /*stretch*/);
QObject::connect (mp_hierarchy_panel, SIGNAL (search_options_changed ()), mp_connector, SLOT (cell_search_options_edited ()));
QObject::connect (mp_hierarchy_panel, SIGNAL (cell_selected (cell_path_type, int)), mp_connector, SLOT (select_cell_dispatch (cell_path_type, int)));
QObject::connect (mp_hierarchy_panel, SIGNAL (active_cellview_changed (int)), mp_connector, SLOT (active_cellview_changed (int)));
QObject::connect (mp_hierarchy_frame, SIGNAL (destroyed ()), mp_connector, SLOT (side_panel_destroyed ()));
@ -655,6 +666,7 @@ LayoutView::init_ui (db::Manager *mgr)
mp_control_frame = mp_control_panel;
QObject::connect (mp_control_frame, SIGNAL (destroyed ()), mp_connector, SLOT (side_panel_destroyed ()));
QObject::connect (mp_control_frame, SIGNAL (search_options_changed ()), mp_connector, SLOT (layer_search_options_edited ()));
QObject::connect (mp_control_panel, SIGNAL (tab_changed ()), mp_connector, SLOT (layer_tab_changed ()));
QObject::connect (mp_control_panel, SIGNAL (order_changed ()), mp_connector, SLOT (layer_order_changed ()));
QObject::connect (mp_control_panel, SIGNAL (current_layer_changed (const lay::LayerPropertiesConstIterator &)), mp_connector, SLOT (current_layer_changed_slot (const lay::LayerPropertiesConstIterator &)));
@ -1041,6 +1053,60 @@ LayoutView::configure (const std::string &name, const std::string &value)
}
return true;
} else if (name == cfg_layer_search_as_expressions) {
bool f;
tl::from_string (value, f);
if (mp_control_panel) {
mp_control_panel->set_search_as_expression (f);
}
return true;
} else if (name == cfg_layer_search_as_filter) {
bool f;
tl::from_string (value, f);
if (mp_control_panel) {
mp_control_panel->set_search_as_filter (f);
}
return true;
} else if (name == cfg_layer_search_case_sensitive) {
bool f;
tl::from_string (value, f);
if (mp_control_panel) {
mp_control_panel->set_search_case_sensitive (f);
}
return true;
} else if (name == cfg_cell_search_as_expressions) {
bool f;
tl::from_string (value, f);
if (mp_hierarchy_panel) {
mp_hierarchy_panel->set_search_as_expression (f);
}
return true;
} else if (name == cfg_cell_search_as_filter) {
bool f;
tl::from_string (value, f);
if (mp_hierarchy_panel) {
mp_hierarchy_panel->set_search_as_filter (f);
}
return true;
} else if (name == cfg_cell_search_case_sensitive) {
bool f;
tl::from_string (value, f);
if (mp_hierarchy_panel) {
mp_hierarchy_panel->set_search_case_sensitive (f);
}
return true;
} else if (name == cfg_layers_always_show_source) {
bool a = false;
@ -1299,6 +1365,26 @@ LayoutView::max_hier_changed (int i)
set_hier_levels (std::make_pair (get_hier_levels ().first, i));
}
void
LayoutView::layer_search_options_edited ()
{
if (mp_control_panel) {
dispatcher ()->config_set (cfg_layer_search_as_expressions, mp_control_panel->search_as_expression ());
dispatcher ()->config_set (cfg_layer_search_case_sensitive, mp_control_panel->search_case_sensitive ());
dispatcher ()->config_set (cfg_layer_search_as_filter, mp_control_panel->search_as_filter ());
}
}
void
LayoutView::cell_search_options_edited ()
{
if (mp_hierarchy_panel) {
dispatcher ()->config_set (cfg_cell_search_as_expressions, mp_hierarchy_panel->search_as_expression ());
dispatcher ()->config_set (cfg_cell_search_case_sensitive, mp_hierarchy_panel->search_case_sensitive ());
dispatcher ()->config_set (cfg_cell_search_as_filter, mp_hierarchy_panel->search_as_filter ());
}
}
tl::Color
LayoutView::default_background_color ()
{

View File

@ -114,6 +114,8 @@ public slots:
void layer_tab_changed ();
void layer_order_changed ();
void select_cell_dispatch (const cell_path_type &path, int cellview_index);
void layer_search_options_edited ();
void cell_search_options_edited ();
void min_hier_changed (int i);
void max_hier_changed (int i);
void app_terminated ();
@ -654,6 +656,8 @@ private:
void layer_order_changed ();
void min_hier_changed (int i);
void max_hier_changed (int i);
void layer_search_options_edited ();
void cell_search_options_edited ();
bool event_filter (QObject *obj, QEvent *ev, bool &taken);
QSize size_hint () const;