Added option to configure capture range.

This commit is contained in:
Matthias Koefferlein 2019-07-25 00:06:50 +02:00
parent 985029dc97
commit 4f9208577b
12 changed files with 321 additions and 120 deletions

View File

@ -1094,7 +1094,7 @@ PartialService::timeout ()
mp_view->clear_transient_selection ();
// compute search box
double l = double (lay::search_range) / widget ()->mouse_event_trans ().mag ();
double l = double (view ()->search_range ()) / widget ()->mouse_event_trans ().mag ();
db::DBox search_box = db::DBox (m_hover_point, m_hover_point).enlarged (db::DVector (l, l));
PartialShapeFinder finder (true, m_top_level_sel, db::ShapeIterator::All);
@ -1748,7 +1748,7 @@ PartialService::mouse_click_event (const db::DPoint &p, unsigned int buttons, bo
try {
// compute search box
double l = double (lay::search_range) / widget ()->mouse_event_trans ().mag ();
double l = double (view ()->search_range ()) / widget ()->mouse_event_trans ().mag ();
db::DBox search_box = db::DBox (p, p).enlarged (db::DVector (l, l));
// check, if there is a selected shape under the mouse - in this case, we do not do a new selection
@ -2551,7 +2551,7 @@ PartialService::partial_select (const db::DBox &box, lay::Editable::SelectionMod
clear_partial_transient_selection ();
// compute search box
double l = double (lay::search_range) / widget ()->mouse_event_trans ().mag ();
double l = double (view ()->search_range ()) / widget ()->mouse_event_trans ().mag ();
db::DBox search_box = box.enlarged (db::DVector (l, l));
bool needs_update = false;

View File

@ -829,7 +829,7 @@ double
Service::click_proximity (const db::DPoint &pos, lay::Editable::SelectionMode mode)
{
// compute search box
double l = double (lay::search_range) / widget ()->mouse_event_trans ().mag ();
double l = double (view ()->search_range ()) / widget ()->mouse_event_trans ().mag ();
db::DBox search_box = db::DBox (pos, pos).enlarged (db::DVector (l, l));
// for single-point selections either exclude the current selection or the
@ -889,7 +889,7 @@ Service::transient_select (const db::DPoint &pos)
}
// compute search box
double l = double (lay::search_range) / widget ()->mouse_event_trans ().mag ();
double l = double (view ()->search_range ()) / widget ()->mouse_event_trans ().mag ();
db::DBox search_box = db::DBox (pos, pos).enlarged (db::DVector (l, l));
if (m_cell_inst_service) {
@ -1152,7 +1152,7 @@ bool
Service::select (const db::DBox &box, lay::Editable::SelectionMode mode)
{
// compute search box
double l = double (lay::search_range) / widget ()->mouse_event_trans ().mag ();
double l = double (view ()->search_range ()) / widget ()->mouse_event_trans ().mag ();
db::DBox search_box = box.enlarged (db::DVector (l, l));
bool needs_update = false;

View File

@ -101,3 +101,6 @@ plugins.depends += lib rdb db
unit_tests.depends += plugins $$MAIN_DEPENDS
RESOURCES += \
laybasic/laybasic/layResources.qrc

View File

@ -7,7 +7,7 @@
<x>0</x>
<y>0</y>
<width>608</width>
<height>235</height>
<height>318</height>
</rect>
</property>
<property name="windowTitle">
@ -17,7 +17,16 @@
<property name="spacing">
<number>6</number>
</property>
<property name="margin">
<property name="leftMargin">
<number>9</number>
</property>
<property name="topMargin">
<number>9</number>
</property>
<property name="rightMargin">
<number>9</number>
</property>
<property name="bottomMargin">
<number>9</number>
</property>
<item>
@ -26,7 +35,16 @@
<string>How the selection is shown</string>
</property>
<layout class="QGridLayout">
<property name="margin">
<property name="leftMargin">
<number>9</number>
</property>
<property name="topMargin">
<number>9</number>
</property>
<property name="rightMargin">
<number>9</number>
</property>
<property name="bottomMargin">
<number>9</number>
</property>
<property name="spacing">
@ -153,7 +171,7 @@
<property name="sizeHint" stdset="0">
<size>
<width>561</width>
<height>16</height>
<height>10</height>
</size>
</property>
</spacer>
@ -172,17 +190,104 @@
</property>
</widget>
</item>
<item>
<spacer name="verticalSpacer">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeType">
<enum>QSizePolicy::Fixed</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>10</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QFrame" name="frame">
<property name="frameShape">
<enum>QFrame::NoFrame</enum>
</property>
<property name="frameShadow">
<enum>QFrame::Raised</enum>
</property>
<layout class="QHBoxLayout" name="horizontalLayout">
<property name="leftMargin">
<number>0</number>
</property>
<property name="topMargin">
<number>0</number>
</property>
<property name="rightMargin">
<number>0</number>
</property>
<property name="bottomMargin">
<number>0</number>
</property>
<item>
<widget class="QLabel" name="label_2">
<property name="text">
<string>Capture range to mouse cursor</string>
</property>
</widget>
</item>
<item>
<widget class="QSpinBox" name="search_range_spinbx">
<property name="maximum">
<number>9999</number>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="label_3">
<property name="text">
<string>pixel</string>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>311</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
</layout>
</widget>
</item>
<item>
<spacer name="verticalSpacer_2">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>40</height>
</size>
</property>
</spacer>
</item>
</layout>
</widget>
<layoutdefault spacing="6" margin="11"/>
<customwidgets>
<customwidget>
<class>lay::DitherPatternSelectionButton</class>
<class>lay::ColorButton</class>
<extends>QPushButton</extends>
<header>layWidgets.h</header>
</customwidget>
<customwidget>
<class>lay::ColorButton</class>
<class>lay::DitherPatternSelectionButton</class>
<extends>QPushButton</extends>
<header>layWidgets.h</header>
</customwidget>

View File

@ -1,68 +1,87 @@
<ui version="4.0" >
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>LayoutViewConfigPage7</class>
<widget class="QFrame" name="LayoutViewConfigPage7" >
<property name="geometry" >
<widget class="QFrame" name="LayoutViewConfigPage7">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>791</width>
<height>323</height>
<height>385</height>
</rect>
</property>
<property name="windowTitle" >
<property name="windowTitle">
<string>Application Settings</string>
</property>
<layout class="QVBoxLayout" >
<property name="margin" >
<number>9</number>
</property>
<property name="spacing" >
<layout class="QVBoxLayout">
<property name="spacing">
<number>6</number>
</property>
<property name="leftMargin">
<number>9</number>
</property>
<property name="topMargin">
<number>9</number>
</property>
<property name="rightMargin">
<number>9</number>
</property>
<property name="bottomMargin">
<number>9</number>
</property>
<item>
<widget class="QGroupBox" name="groupBox" >
<property name="title" >
<widget class="QGroupBox" name="groupBox">
<property name="title">
<string>Oversampling</string>
</property>
<layout class="QGridLayout" >
<property name="margin" >
<layout class="QGridLayout">
<property name="leftMargin">
<number>9</number>
</property>
<property name="spacing" >
<property name="topMargin">
<number>9</number>
</property>
<property name="rightMargin">
<number>9</number>
</property>
<property name="bottomMargin">
<number>9</number>
</property>
<property name="spacing">
<number>6</number>
</property>
<item row="1" column="0" >
<widget class="QLabel" name="label_2" >
<property name="text" >
<item row="1" column="0">
<widget class="QLabel" name="label_2">
<property name="text">
<string>Use oversampling: </string>
</property>
</widget>
</item>
<item row="1" column="1" >
<widget class="QComboBox" name="oversampling" >
<item row="1" column="1">
<widget class="QComboBox" name="oversampling">
<item>
<property name="text" >
<property name="text">
<string>No oversampling</string>
</property>
</item>
<item>
<property name="text" >
<property name="text">
<string>2x oversampling</string>
</property>
</item>
<item>
<property name="text" >
<property name="text">
<string>3x oversampling</string>
</property>
</item>
</widget>
</item>
<item row="1" column="2" >
<item row="1" column="2">
<spacer>
<property name="orientation" >
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" >
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
@ -70,12 +89,12 @@
</property>
</spacer>
</item>
<item row="0" column="0" colspan="3" >
<widget class="QLabel" name="label" >
<property name="text" >
<item row="0" column="0" colspan="3">
<widget class="QLabel" name="label">
<property name="text">
<string>Oversampling increases the image quality by using an internal resolution larger than the image resolution. Drawing speed is somewhat reduced and lines may appear thinner.</string>
</property>
<property name="wordWrap" >
<property name="wordWrap">
<bool>true</bool>
</property>
</widget>
@ -84,38 +103,47 @@
</widget>
</item>
<item>
<widget class="QGroupBox" name="groupBox_4" >
<property name="title" >
<widget class="QGroupBox" name="groupBox_4">
<property name="title">
<string>Default Font Size</string>
</property>
<layout class="QHBoxLayout" >
<property name="margin" >
<number>9</number>
</property>
<property name="spacing" >
<layout class="QHBoxLayout">
<property name="spacing">
<number>6</number>
</property>
<property name="leftMargin">
<number>9</number>
</property>
<property name="topMargin">
<number>9</number>
</property>
<property name="rightMargin">
<number>9</number>
</property>
<property name="bottomMargin">
<number>9</number>
</property>
<item>
<widget class="QLabel" name="label_4" >
<property name="text" >
<string>Font size for "Default" font and rulers</string>
<widget class="QLabel" name="label_4">
<property name="text">
<string>Font size for &quot;Default&quot; font and rulers</string>
</property>
</widget>
</item>
<item>
<widget class="QComboBox" name="default_font_size" >
<widget class="QComboBox" name="default_font_size">
<item>
<property name="text" >
<property name="text">
<string>Small</string>
</property>
</item>
<item>
<property name="text" >
<property name="text">
<string>Medium</string>
</property>
</item>
<item>
<property name="text" >
<property name="text">
<string>Large</string>
</property>
</item>
@ -123,10 +151,10 @@
</item>
<item>
<spacer>
<property name="orientation" >
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" >
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
@ -138,98 +166,115 @@
</widget>
</item>
<item>
<widget class="QGroupBox" name="groupBox_2" >
<property name="title" >
<widget class="QGroupBox" name="groupBox_2">
<property name="title">
<string>Global Transformation</string>
</property>
<layout class="QHBoxLayout" >
<property name="margin" >
<number>9</number>
</property>
<property name="spacing" >
<layout class="QHBoxLayout">
<property name="spacing">
<number>6</number>
</property>
<property name="leftMargin">
<number>9</number>
</property>
<property name="topMargin">
<number>9</number>
</property>
<property name="rightMargin">
<number>9</number>
</property>
<property name="bottomMargin">
<number>9</number>
</property>
<item>
<widget class="QLabel" name="label_3" >
<property name="text" >
<widget class="QLabel" name="label_3">
<property name="text">
<string>Transform the view globally with</string>
</property>
</widget>
</item>
<item>
<widget class="QComboBox" name="global_trans" >
<widget class="QComboBox" name="global_trans">
<item>
<property name="text" >
<property name="text">
<string>(r0)</string>
</property>
<property name="icon" >
<iconset resource="layResources.qrc" >:/r0.png</iconset>
<property name="icon">
<iconset resource="../../lay/lay/layResources.qrc">
<normaloff>:/r0.png</normaloff>:/r0.png</iconset>
</property>
</item>
<item>
<property name="text" >
<property name="text">
<string>(r90)</string>
</property>
<property name="icon" >
<iconset resource="layResources.qrc" >:/r90.png</iconset>
<property name="icon">
<iconset resource="../../lay/lay/layResources.qrc">
<normaloff>:/r90.png</normaloff>:/r90.png</iconset>
</property>
</item>
<item>
<property name="text" >
<property name="text">
<string>(r180)</string>
</property>
<property name="icon" >
<iconset resource="layResources.qrc" >:/r180.png</iconset>
<property name="icon">
<iconset resource="../../lay/lay/layResources.qrc">
<normaloff>:/r180.png</normaloff>:/r180.png</iconset>
</property>
</item>
<item>
<property name="text" >
<property name="text">
<string>(r270)</string>
</property>
<property name="icon" >
<iconset resource="layResources.qrc" >:/r270.png</iconset>
<property name="icon">
<iconset resource="../../lay/lay/layResources.qrc">
<normaloff>:/r270.png</normaloff>:/r270.png</iconset>
</property>
</item>
<item>
<property name="text" >
<property name="text">
<string>(m0)</string>
</property>
<property name="icon" >
<iconset resource="layResources.qrc" >:/m0.png</iconset>
<property name="icon">
<iconset resource="../../lay/lay/layResources.qrc">
<normaloff>:/m0.png</normaloff>:/m0.png</iconset>
</property>
</item>
<item>
<property name="text" >
<property name="text">
<string>(m45)</string>
</property>
<property name="icon" >
<iconset resource="layResources.qrc" >:/m45.png</iconset>
<property name="icon">
<iconset resource="../../lay/lay/layResources.qrc">
<normaloff>:/m45.png</normaloff>:/m45.png</iconset>
</property>
</item>
<item>
<property name="text" >
<property name="text">
<string>(m90)</string>
</property>
<property name="icon" >
<iconset resource="layResources.qrc" >:/m90.png</iconset>
<property name="icon">
<iconset resource="../../lay/lay/layResources.qrc">
<normaloff>:/m90.png</normaloff>:/m90.png</iconset>
</property>
</item>
<item>
<property name="text" >
<property name="text">
<string>(m135)</string>
</property>
<property name="icon" >
<iconset resource="layResources.qrc" >:/m135.png</iconset>
<property name="icon">
<iconset resource="../../lay/lay/layResources.qrc">
<normaloff>:/m135.png</normaloff>:/m135.png</iconset>
</property>
</item>
</widget>
</item>
<item>
<spacer>
<property name="orientation" >
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" >
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
@ -241,37 +286,46 @@
</widget>
</item>
<item>
<widget class="QGroupBox" name="groupBox_3" >
<property name="title" >
<widget class="QGroupBox" name="groupBox_3">
<property name="title">
<string>Hierarchy Depth</string>
</property>
<layout class="QGridLayout" >
<property name="margin" >
<layout class="QGridLayout">
<property name="leftMargin">
<number>9</number>
</property>
<property name="spacing" >
<property name="topMargin">
<number>9</number>
</property>
<property name="rightMargin">
<number>9</number>
</property>
<property name="bottomMargin">
<number>9</number>
</property>
<property name="spacing">
<number>6</number>
</property>
<item row="0" column="0" >
<widget class="QLabel" name="label_13" >
<property name="text" >
<item row="0" column="0">
<widget class="QLabel" name="label_13">
<property name="text">
<string>Initial hierarchy depth when opening a new panel</string>
</property>
</widget>
</item>
<item row="0" column="1" >
<widget class="QSpinBox" name="def_depth" >
<property name="maximum" >
<item row="0" column="1">
<widget class="QSpinBox" name="def_depth">
<property name="maximum">
<number>1000</number>
</property>
</widget>
</item>
<item row="0" column="2" >
<item row="0" column="2">
<spacer>
<property name="orientation" >
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" >
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
@ -279,12 +333,12 @@
</property>
</spacer>
</item>
<item row="1" column="0" colspan="3" >
<widget class="QLabel" name="label_14" >
<property name="text" >
<string>(This setting is not active if "select all hierarchy levels on new cell" is checked on the "Navigation/New Cell" tab)</string>
<item row="1" column="0" colspan="3">
<widget class="QLabel" name="label_14">
<property name="text">
<string>(This setting is not active if &quot;select all hierarchy levels on new cell&quot; is checked on the &quot;Navigation/New Cell&quot; tab)</string>
</property>
<property name="wordWrap" >
<property name="wordWrap">
<bool>true</bool>
</property>
</widget>
@ -294,9 +348,9 @@
</item>
</layout>
</widget>
<layoutdefault spacing="6" margin="11" />
<layoutdefault spacing="6" margin="11"/>
<resources>
<include location="layResources.qrc" />
<include location="../../lay/lay/layResources.qrc"/>
</resources>
<connections/>
</ui>

View File

@ -44,9 +44,6 @@ namespace tl
namespace lay
{
// default search range for select in pixels
const unsigned int search_range = 5; // TODO make variable?
/**
* @brief A generic finder class
*

View File

@ -435,6 +435,7 @@ LayoutView::init (db::Manager *mgr, lay::PluginRoot *root, QWidget * /*parent*/)
m_copy_cvr = -1;
m_copy_layera = -1;
m_copy_layerr = -1;
m_search_range = 5;
m_layer_properties_lists.push_back (new LayerPropertiesList ());
m_layer_properties_lists.back ()->attach_view (this, (unsigned int) (m_layer_properties_lists.size () - 1));
@ -1075,6 +1076,13 @@ LayoutView::configure (const std::string &name, const std::string &value)
child_ctx_enabled (h);
return true;
} else if (name == cfg_search_range) {
unsigned int n;
tl::from_string (value, n);
set_search_range (n);
return true;
} else if (name == cfg_abstract_mode_enabled) {
bool e;
@ -6424,6 +6432,18 @@ LayoutView::is_editable () const
return m_editable;
}
unsigned int
LayoutView::search_range ()
{
return m_search_range;
}
void
LayoutView::set_search_range (unsigned int sr)
{
m_search_range = sr;
}
void
LayoutView::message (const std::string &s, int timeout)
{

View File

@ -2188,6 +2188,18 @@ public:
return m_marker_halo;
}
/**
* @brief Gets the "search range" in pixels
* The search range applies whenever some object is looked up in the vicinity of the
* mouse cursor. This value gives the search range in pixels.
*/
unsigned int search_range ();
/**
* @brief Sets the "search range" in pixels
*/
void set_search_range (unsigned int sr);
/**
* @brief Return true, if any cellview is editable
*/
@ -2734,6 +2746,8 @@ private:
int m_marker_line_style;
bool m_marker_halo;
unsigned int m_search_range;
bool m_transient_selection_mode;
bool m_sel_inside_pcells;

View File

@ -366,6 +366,10 @@ LayoutViewConfigPage2c::setup (lay::PluginRoot *root)
bool ipm = 0;
root->config_get (cfg_sel_inside_pcells_mode, ipm);
mp_ui->sel_inside_pcells_cb->setChecked (ipm);
unsigned int sr = 0;
root->config_get (cfg_search_range, sr);
mp_ui->search_range_spinbx->setValue (sr);
}
void
@ -379,6 +383,7 @@ LayoutViewConfigPage2c::commit (lay::PluginRoot *root)
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_sel_inside_pcells_mode, mp_ui->sel_inside_pcells_cb->isChecked ());
root->config_set (cfg_search_range, (unsigned int) mp_ui->search_range_spinbx->value ());
}
// ------------------------------------------------------------
@ -1511,6 +1516,7 @@ public:
options.push_back (std::pair<std::string, std::string> (cfg_child_ctx_dimming, "50"));
options.push_back (std::pair<std::string, std::string> (cfg_child_ctx_hollow, "false"));
options.push_back (std::pair<std::string, std::string> (cfg_child_ctx_enabled, "false"));
options.push_back (std::pair<std::string, std::string> (cfg_search_range, "5"));
options.push_back (std::pair<std::string, std::string> (cfg_abstract_mode_width, "10.0"));
options.push_back (std::pair<std::string, std::string> (cfg_abstract_mode_enabled, "false"));
options.push_back (std::pair<std::string, std::string> (cfg_fit_new_cell, "true"));

View File

@ -192,7 +192,7 @@ void
NetlistBrowserDialog::probe_net (const db::DPoint &p, bool trace_path)
{
// prepare for the net tracing
double l = double (lay::search_range) / widget ()->mouse_event_trans ().mag ();
double l = double (view ()->search_range ()) / widget ()->mouse_event_trans ().mag ();
db::DBox start_search_box = db::DBox (p, p).enlarged (db::DVector (l, l));

View File

@ -58,6 +58,8 @@ static const std::string cfg_child_ctx_dimming ("child-context-dimming");
static const std::string cfg_child_ctx_hollow ("child-context-hollow");
static const std::string cfg_child_ctx_enabled ("child-context-enabled");
static const std::string cfg_search_range ("search-range");
static const std::string cfg_abstract_mode_enabled ("abstract-mode-enabled");
static const std::string cfg_abstract_mode_width ("abstract-mode-width");

View File

@ -169,7 +169,7 @@ NetTracerDialog::mouse_click_event (const db::DPoint &p, unsigned int buttons, b
// prepare for the net tracing
clear_markers ();
double l = double (lay::search_range) / widget ()->mouse_event_trans ().mag ();
double l = double (view ()->search_range ()) / widget ()->mouse_event_trans ().mag ();
db::DBox start_search_box = db::DBox (p, p).enlarged (db::DVector (l, l));