Extended (transient) selection config

- Line style can be configured for selection + transient selection
- Transient selection has it's own styles
This commit is contained in:
Matthias Koefferlein 2024-11-21 23:10:59 +01:00
parent b4dabe29e5
commit abe578562f
7 changed files with 411 additions and 70 deletions

View File

@ -1192,8 +1192,11 @@ Service::transient_select (const db::DPoint &pos)
marker->set_vertex_shape (lay::ViewOp::Cross); marker->set_vertex_shape (lay::ViewOp::Cross);
marker->set_vertex_size (9 /*cross vertex size*/); marker->set_vertex_size (9 /*cross vertex size*/);
marker->set (inst, gt, tv); marker->set (inst, gt, tv);
marker->set_line_width (1); marker->set_line_width (view ()->default_transient_marker_line_width ());
marker->set_halo (0); marker->set_halo (view ()->default_transient_marker_halo ());
marker->set_color (view ()->default_transient_marker_color ());
marker->set_dither_pattern (view ()->default_transient_dither_pattern ());
marker->set_line_style (view ()->default_transient_line_style ());
marker->set_text_enabled (false); marker->set_text_enabled (false);
mp_transient_marker = marker; mp_transient_marker = marker;
@ -1205,9 +1208,12 @@ Service::transient_select (const db::DPoint &pos)
lay::Marker *marker = new lay::Marker (view (), r->cv_index ()); lay::Marker *marker = new lay::Marker (view (), r->cv_index ());
db::box_convert<db::CellInst> bc (cv->layout ()); db::box_convert<db::CellInst> bc (cv->layout ());
marker->set (bc (r->back ().inst_ptr.cell_inst ().object ()), gt * r->back ().inst_ptr.cell_inst ().complex_trans (*r->back ().array_inst), tv); marker->set (bc (r->back ().inst_ptr.cell_inst ().object ()), gt * r->back ().inst_ptr.cell_inst ().complex_trans (*r->back ().array_inst), tv);
marker->set_vertex_size (0); marker->set_vertex_size (view ()->default_transient_marker_vertex_size ());
marker->set_line_width (1); marker->set_line_width (view ()->default_transient_marker_line_width ());
marker->set_halo (0); marker->set_halo (view ()->default_transient_marker_halo ());
marker->set_color (view ()->default_transient_marker_color ());
marker->set_dither_pattern (view ()->default_transient_dither_pattern ());
marker->set_line_style (view ()->default_transient_line_style ());
mp_transient_marker = marker; mp_transient_marker = marker;
@ -1258,10 +1264,13 @@ Service::transient_select (const db::DPoint &pos)
marker->set_vertex_shape (lay::ViewOp::Cross); marker->set_vertex_shape (lay::ViewOp::Cross);
marker->set_vertex_size (9 /*cross vertex size*/); marker->set_vertex_size (9 /*cross vertex size*/);
} else { } else {
marker->set_vertex_size (0); marker->set_vertex_size (view ()->default_transient_marker_vertex_size ());
} }
marker->set_line_width (1); marker->set_line_width (view ()->default_transient_marker_line_width ());
marker->set_halo (0); marker->set_halo (view ()->default_transient_marker_halo ());
marker->set_color (view ()->default_transient_marker_color ());
marker->set_dither_pattern (view ()->default_transient_dither_pattern ());
marker->set_line_style (view ()->default_transient_line_style ());
mp_transient_marker = marker; mp_transient_marker = marker;

View File

@ -376,6 +376,11 @@ LayoutViewBase::init (db::Manager *mgr)
m_marker_dither_pattern = 1; m_marker_dither_pattern = 1;
m_marker_line_style = 0; m_marker_line_style = 0;
m_marker_halo = true; m_marker_halo = true;
m_transient_marker_line_width = 0;
m_transient_marker_vertex_size = 0;
m_transient_marker_dither_pattern = 1;
m_transient_marker_line_style = 0;
m_transient_marker_halo = true;
m_transient_selection_mode = true; m_transient_selection_mode = true;
m_sel_inside_pcells = false; m_sel_inside_pcells = false;
m_add_other_layers = false; m_add_other_layers = false;
@ -1301,6 +1306,84 @@ LayoutViewBase::configure (const std::string &name, const std::string &value)
// do not take - let others receive this configuration as well // do not take - let others receive this configuration as well
return false; return false;
} else if (name == cfg_transient_sel_color) {
tl::Color color;
lay::ColorConverter ().from_string (value, color);
// Change the color
if (lay::test_and_set (m_transient_marker_color, color)) {
mp_canvas->update_image ();
}
// do not take - let others receive this configuration as well
return false;
} else if (name == cfg_transient_sel_line_width) {
int lw = 0;
tl::from_string (value, lw);
// Change the line width
if (lay::test_and_set (m_transient_marker_line_width, lw)) {
mp_canvas->update_image ();
}
// do not take - let others receive this configuration as well
return false;
} else if (name == cfg_transient_sel_dither_pattern) {
int dp = 0;
tl::from_string (value, dp);
// Change the vertex_size
if (lay::test_and_set (m_transient_marker_dither_pattern, dp)) {
mp_canvas->update_image ();
}
// do not take - let others receive this configuration as well
return false;
} else if (name == cfg_transient_sel_line_style) {
int dp = 0;
tl::from_string (value, dp);
// Change the vertex_size
if (lay::test_and_set (m_transient_marker_line_style, dp)) {
mp_canvas->update_image ();
}
// do not take - let others receive this configuration as well
return false;
} else if (name == cfg_transient_sel_vertex_size) {
int vs = 0;
tl::from_string (value, vs);
// Change the vertex_size
if (lay::test_and_set (m_transient_marker_vertex_size, vs)) {
mp_canvas->update_image ();
}
// do not take - let others receive this configuration as well
return false;
} else if (name == cfg_transient_sel_halo) {
bool halo = 0;
tl::from_string (value, halo);
// Change the vertex_size
if (lay::test_and_set (m_transient_marker_halo, halo)) {
mp_canvas->update_image ();
}
// do not take - let others receive this configuration as well
return false;
} else { } else {
return false; return false;
} }

View File

@ -2347,6 +2347,55 @@ public:
return m_marker_halo; return m_marker_halo;
} }
/**
* @brief Get the default color for markers
*/
tl::Color default_transient_marker_color () const
{
return m_transient_marker_color;
}
/**
* @brief Get the default line width for markers
*/
int default_transient_marker_line_width () const
{
return m_transient_marker_line_width;
}
/**
* @brief Get the default marker dither pattern index
*/
int default_transient_dither_pattern () const
{
return m_transient_marker_dither_pattern;
}
/**
* @brief Get the default marker line style index
*/
int default_transient_line_style () const
{
return m_transient_marker_line_style;
}
/**
* @brief Get the default vertex size for markers
*/
int default_transient_marker_vertex_size () const
{
return m_transient_marker_vertex_size;
}
/**
* @brief Get the default halo flag for markers
*/
int default_transient_marker_halo () const
{
return m_transient_marker_halo;
}
/** /**
* @brief Gets the "search range" in pixels (for single click) * @brief Gets the "search range" in pixels (for single click)
* The search range applies whenever some object is looked up in the vicinity of the * The search range applies whenever some object is looked up in the vicinity of the
@ -2831,6 +2880,13 @@ private:
int m_marker_line_style; int m_marker_line_style;
bool m_marker_halo; bool m_marker_halo;
tl::Color m_transient_marker_color;
int m_transient_marker_line_width;
int m_transient_marker_vertex_size;
int m_transient_marker_dither_pattern;
int m_transient_marker_line_style;
bool m_transient_marker_halo;
unsigned int m_search_range; unsigned int m_search_range;
unsigned int m_search_range_box; unsigned int m_search_range_box;

View File

@ -75,6 +75,12 @@ public:
options.push_back (std::pair<std::string, std::string> (cfg_sel_dither_pattern, "1")); options.push_back (std::pair<std::string, std::string> (cfg_sel_dither_pattern, "1"));
options.push_back (std::pair<std::string, std::string> (cfg_sel_line_style, "0")); options.push_back (std::pair<std::string, std::string> (cfg_sel_line_style, "0"));
options.push_back (std::pair<std::string, std::string> (cfg_sel_halo, "true")); options.push_back (std::pair<std::string, std::string> (cfg_sel_halo, "true"));
options.push_back (std::pair<std::string, std::string> (cfg_transient_sel_color, cc.to_string (tl::Color ())));
options.push_back (std::pair<std::string, std::string> (cfg_transient_sel_line_width, "1"));
options.push_back (std::pair<std::string, std::string> (cfg_transient_sel_vertex_size, "0"));
options.push_back (std::pair<std::string, std::string> (cfg_transient_sel_dither_pattern, "-1")); // no specific one
options.push_back (std::pair<std::string, std::string> (cfg_transient_sel_line_style, "-1")); // no specific one
options.push_back (std::pair<std::string, std::string> (cfg_transient_sel_halo, "false"));
options.push_back (std::pair<std::string, std::string> (cfg_sel_transient_mode, "true")); options.push_back (std::pair<std::string, std::string> (cfg_sel_transient_mode, "true"));
options.push_back (std::pair<std::string, std::string> (cfg_sel_inside_pcells_mode, "false")); options.push_back (std::pair<std::string, std::string> (cfg_sel_inside_pcells_mode, "false"));
options.push_back (std::pair<std::string, std::string> (cfg_tracking_cursor_enabled, "true")); options.push_back (std::pair<std::string, std::string> (cfg_tracking_cursor_enabled, "true"));

View File

@ -72,6 +72,12 @@ static const std::string cfg_sel_vertex_size ("sel-vertex-size");
static const std::string cfg_sel_halo ("sel-halo"); static const std::string cfg_sel_halo ("sel-halo");
static const std::string cfg_sel_dither_pattern ("sel-dither-pattern"); static const std::string cfg_sel_dither_pattern ("sel-dither-pattern");
static const std::string cfg_sel_line_style ("sel-line-style"); static const std::string cfg_sel_line_style ("sel-line-style");
static const std::string cfg_transient_sel_color ("transient-sel-color");
static const std::string cfg_transient_sel_line_width ("transient-sel-line-width");
static const std::string cfg_transient_sel_vertex_size ("transient-sel-vertex-size");
static const std::string cfg_transient_sel_halo ("transient-sel-halo");
static const std::string cfg_transient_sel_dither_pattern ("transient-sel-dither-pattern");
static const std::string cfg_transient_sel_line_style ("transient-sel-line-style");
static const std::string cfg_sel_transient_mode ("sel-transient-mode"); static const std::string cfg_sel_transient_mode ("sel-transient-mode");
static const std::string cfg_sel_inside_pcells_mode ("sel-inside-pcells-mode"); static const std::string cfg_sel_inside_pcells_mode ("sel-inside-pcells-mode");

View File

@ -6,8 +6,8 @@
<rect> <rect>
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>608</width> <width>648</width>
<height>318</height> <height>497</height>
</rect> </rect>
</property> </property>
<property name="windowTitle"> <property name="windowTitle">
@ -50,13 +50,37 @@
<property name="spacing"> <property name="spacing">
<number>6</number> <number>6</number>
</property> </property>
<item row="1" column="1"> <item row="1" column="3">
<widget class="lay::DitherPatternSelectionButton" name="stipple_pb"> <widget class="QLabel" name="vs_lbl">
<property name="text">
<string>Vertex size</string>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QLabel" name="label">
<property name="text">
<string>Marker fill</string>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="lay::ColorButton" name="color_pb">
<property name="toolTip">
<string>The color in which the rulers are drawn</string>
</property>
<property name="text"> <property name="text">
<string/> <string/>
</property> </property>
</widget> </widget>
</item> </item>
<item row="0" column="3">
<widget class="QLabel" name="textLabel1_2">
<property name="text">
<string>Line width</string>
</property>
</widget>
</item>
<item row="1" column="5"> <item row="1" column="5">
<widget class="QLabel" name="label_5"> <widget class="QLabel" name="label_5">
<property name="text"> <property name="text">
@ -64,42 +88,9 @@
</property> </property>
</widget> </widget>
</item> </item>
<item row="0" column="6">
<spacer>
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>71</width>
<height>31</height>
</size>
</property>
</spacer>
</item>
<item row="0" column="5">
<widget class="QLabel" name="textLabel2">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>pixel</string>
</property>
</widget>
</item>
<item row="0" column="4"> <item row="0" column="4">
<widget class="QSpinBox" name="lw_spinbx"/> <widget class="QSpinBox" name="lw_spinbx"/>
</item> </item>
<item row="0" column="3">
<widget class="QLabel" name="textLabel1_2">
<property name="text">
<string>Line width</string>
</property>
</widget>
</item>
<item row="0" column="2"> <item row="0" column="2">
<spacer> <spacer>
<property name="orientation"> <property name="orientation">
@ -116,26 +107,29 @@
</property> </property>
</spacer> </spacer>
</item> </item>
<item row="1" column="3"> <item row="1" column="1">
<widget class="QLabel" name="vs_lbl"> <widget class="lay::DitherPatternSelectionButton" name="stipple_pb">
<property name="text"> <property name="text">
<string>Vertex size</string> <string/>
</property>
</widget>
</item>
<item row="0" column="5">
<widget class="QLabel" name="textLabel2">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>pixel</string>
</property> </property>
</widget> </widget>
</item> </item>
<item row="1" column="4"> <item row="1" column="4">
<widget class="QSpinBox" name="vs_spinbx"/> <widget class="QSpinBox" name="vs_spinbx"/>
</item> </item>
<item row="0" column="1">
<widget class="lay::ColorButton" name="color_pb">
<property name="toolTip">
<string>The color in which the rulers are drawn</string>
</property>
<property name="text">
<string/>
</property>
</widget>
</item>
<item row="0" column="0"> <item row="0" column="0">
<widget class="QLabel" name="textLabel3_2"> <widget class="QLabel" name="textLabel3_2">
<property name="text"> <property name="text">
@ -143,20 +137,40 @@
</property> </property>
</widget> </widget>
</item> </item>
<item row="1" column="0"> <item row="0" column="6">
<widget class="QLabel" name="label"> <spacer>
<property name="text"> <property name="orientation">
<string>Marker fill</string> <enum>Qt::Horizontal</enum>
</property> </property>
</widget> <property name="sizeHint" stdset="0">
<size>
<width>71</width>
<height>31</height>
</size>
</property>
</spacer>
</item> </item>
<item row="2" column="0" colspan="7"> <item row="2" column="3" colspan="4">
<widget class="QCheckBox" name="halo_cb"> <widget class="QCheckBox" name="halo_cb">
<property name="text"> <property name="text">
<string>With halo</string> <string>With halo</string>
</property> </property>
</widget> </widget>
</item> </item>
<item row="2" column="0">
<widget class="QLabel" name="label_9">
<property name="text">
<string>Marker line style</string>
</property>
</widget>
</item>
<item row="2" column="1">
<widget class="lay::LineStyleSelectionButton" name="line_style_pb">
<property name="text">
<string/>
</property>
</widget>
</item>
</layout> </layout>
</widget> </widget>
</item> </item>
@ -177,10 +191,139 @@
</spacer> </spacer>
</item> </item>
<item> <item>
<widget class="QCheckBox" name="transient_mode_cb"> <widget class="QGroupBox" name="transient_mode_gb">
<property name="text"> <property name="title">
<string>Transient mode (tracking of selectable objects under the mouse)</string> <string>Transient mode (tracking of selectable objects under the mouse)</string>
</property> </property>
<property name="checkable">
<bool>true</bool>
</property>
<property name="checked">
<bool>false</bool>
</property>
<layout class="QGridLayout" name="gridLayout_2">
<item row="0" column="0">
<widget class="QLabel" name="textLabel3_3">
<property name="text">
<string>Marker color</string>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="lay::ColorButton" name="transient_color_pb">
<property name="toolTip">
<string>The color in which the rulers are drawn</string>
</property>
<property name="text">
<string/>
</property>
</widget>
</item>
<item row="0" column="2">
<spacer name="spacer_2">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeType">
<enum>QSizePolicy::Fixed</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>41</width>
<height>31</height>
</size>
</property>
</spacer>
</item>
<item row="0" column="3">
<widget class="QLabel" name="textLabel1_3">
<property name="text">
<string>Line width</string>
</property>
</widget>
</item>
<item row="0" column="4">
<widget class="QSpinBox" name="transient_lw_spinbx"/>
</item>
<item row="0" column="5">
<widget class="QLabel" name="textLabel2_2">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>pixel</string>
</property>
</widget>
</item>
<item row="0" column="6">
<spacer name="spacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>241</width>
<height>31</height>
</size>
</property>
</spacer>
</item>
<item row="1" column="0">
<widget class="QLabel" name="label_8">
<property name="text">
<string>Marker fill</string>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="lay::DitherPatternSelectionButton" name="transient_stipple_pb">
<property name="text">
<string/>
</property>
</widget>
</item>
<item row="1" column="3">
<widget class="QLabel" name="vs_lbl_2">
<property name="text">
<string>Vertex size</string>
</property>
</widget>
</item>
<item row="1" column="4">
<widget class="QSpinBox" name="transient_vs_spinbx"/>
</item>
<item row="1" column="5">
<widget class="QLabel" name="label_7">
<property name="text">
<string>pixel</string>
</property>
</widget>
</item>
<item row="2" column="3" colspan="4">
<widget class="QCheckBox" name="transient_halo_cb">
<property name="text">
<string>With halo</string>
</property>
</widget>
</item>
<item row="2" column="1">
<widget class="lay::LineStyleSelectionButton" name="transient_line_style_pb">
<property name="text">
<string/>
</property>
</widget>
</item>
<item row="2" column="0">
<widget class="QLabel" name="label_10">
<property name="text">
<string>Marker line style</string>
</property>
</widget>
</item>
</layout>
</widget> </widget>
</item> </item>
<item> <item>
@ -319,13 +462,16 @@
<extends>QPushButton</extends> <extends>QPushButton</extends>
<header>layWidgets.h</header> <header>layWidgets.h</header>
</customwidget> </customwidget>
<customwidget>
<class>lay::LineStyleSelectionButton</class>
<extends>QPushButton</extends>
<header>layWidgets.h</header>
</customwidget>
</customwidgets> </customwidgets>
<tabstops> <tabstops>
<tabstop>color_pb</tabstop> <tabstop>color_pb</tabstop>
<tabstop>lw_spinbx</tabstop> <tabstop>lw_spinbx</tabstop>
<tabstop>halo_cb</tabstop>
<tabstop>vs_spinbx</tabstop> <tabstop>vs_spinbx</tabstop>
<tabstop>transient_mode_cb</tabstop>
</tabstops> </tabstops>
<resources/> <resources/>
<connections/> <connections/>

View File

@ -361,13 +361,41 @@ LayoutViewConfigPage2c::setup (lay::Dispatcher *root)
root->config_get (cfg_sel_dither_pattern, dp); root->config_get (cfg_sel_dither_pattern, dp);
mp_ui->stipple_pb->set_dither_pattern (dp); mp_ui->stipple_pb->set_dither_pattern (dp);
int ls = 0;
root->config_get (cfg_sel_line_style, ls);
mp_ui->line_style_pb->set_line_style (ls);
bool halo = 0; bool halo = 0;
root->config_get (cfg_sel_halo, halo); root->config_get (cfg_sel_halo, halo);
mp_ui->halo_cb->setChecked (halo); mp_ui->halo_cb->setChecked (halo);
bool tm = 0; bool tm = 0;
root->config_get (cfg_sel_transient_mode, tm); root->config_get (cfg_sel_transient_mode, tm);
mp_ui->transient_mode_cb->setChecked (tm); mp_ui->transient_mode_gb->setChecked (tm);
QColor transient_color;
root->config_get (cfg_transient_sel_color, transient_color, lay::ColorConverter ());
mp_ui->transient_color_pb->set_color (transient_color);
int transient_lw = 0;
root->config_get (cfg_transient_sel_line_width, transient_lw);
mp_ui->transient_lw_spinbx->setValue (transient_lw);
int transient_vs = 0;
root->config_get (cfg_transient_sel_vertex_size, transient_vs);
mp_ui->transient_vs_spinbx->setValue (transient_vs);
int transient_dp = 0;
root->config_get (cfg_transient_sel_dither_pattern, transient_dp);
mp_ui->transient_stipple_pb->set_dither_pattern (transient_dp);
int transient_ls = 0;
root->config_get (cfg_transient_sel_line_style, transient_ls);
mp_ui->transient_line_style_pb->set_line_style (transient_ls);
bool transient_halo = 0;
root->config_get (cfg_transient_sel_halo, transient_halo);
mp_ui->transient_halo_cb->setChecked (transient_halo);
bool ipm = 0; bool ipm = 0;
root->config_get (cfg_sel_inside_pcells_mode, ipm); root->config_get (cfg_sel_inside_pcells_mode, ipm);
@ -393,9 +421,16 @@ LayoutViewConfigPage2c::commit (lay::Dispatcher *root)
root->config_set (cfg_sel_color, mp_ui->color_pb->get_color (), cc); root->config_set (cfg_sel_color, mp_ui->color_pb->get_color (), cc);
root->config_set (cfg_sel_line_width, mp_ui->lw_spinbx->value ()); root->config_set (cfg_sel_line_width, mp_ui->lw_spinbx->value ());
root->config_set (cfg_sel_vertex_size, mp_ui->vs_spinbx->value ()); root->config_set (cfg_sel_vertex_size, mp_ui->vs_spinbx->value ());
root->config_set (cfg_sel_line_style, mp_ui->line_style_pb->line_style ());
root->config_set (cfg_sel_dither_pattern, mp_ui->stipple_pb->dither_pattern ()); root->config_set (cfg_sel_dither_pattern, mp_ui->stipple_pb->dither_pattern ());
root->config_set (cfg_sel_halo, mp_ui->halo_cb->isChecked ()); root->config_set (cfg_sel_halo, mp_ui->halo_cb->isChecked ());
root->config_set (cfg_sel_transient_mode, mp_ui->transient_mode_cb->isChecked ()); root->config_set (cfg_transient_sel_color, mp_ui->transient_color_pb->get_color (), cc);
root->config_set (cfg_transient_sel_line_width, mp_ui->transient_lw_spinbx->value ());
root->config_set (cfg_transient_sel_vertex_size, mp_ui->transient_vs_spinbx->value ());
root->config_set (cfg_transient_sel_dither_pattern, mp_ui->transient_stipple_pb->dither_pattern ());
root->config_set (cfg_transient_sel_line_style, mp_ui->transient_line_style_pb->line_style ());
root->config_set (cfg_transient_sel_halo, mp_ui->transient_halo_cb->isChecked ());
root->config_set (cfg_sel_transient_mode, mp_ui->transient_mode_gb->isChecked ());
root->config_set (cfg_sel_inside_pcells_mode, mp_ui->sel_inside_pcells_cb->isChecked ()); root->config_set (cfg_sel_inside_pcells_mode, mp_ui->sel_inside_pcells_cb->isChecked ());
root->config_set (cfg_text_point_mode, mp_ui->text_point_mode_cb->isChecked ()); root->config_set (cfg_text_point_mode, mp_ui->text_point_mode_cb->isChecked ());
root->config_set (cfg_search_range, (unsigned int) mp_ui->search_range_spinbx->value ()); root->config_set (cfg_search_range, (unsigned int) mp_ui->search_range_spinbx->value ());