mirror of https://github.com/KLayout/klayout.git
Implemented relative margin for shape and instance browser
This commit is contained in:
parent
4a51365ef2
commit
29e1bf9860
|
|
@ -26,32 +26,27 @@
|
|||
<string>Search Result Browser Configuration</string>
|
||||
</property>
|
||||
<layout class="QGridLayout">
|
||||
<property name="margin" stdset="0">
|
||||
<number>9</number>
|
||||
</property>
|
||||
<property name="spacing">
|
||||
<number>6</number>
|
||||
</property>
|
||||
<item row="0" column="4">
|
||||
<widget class="QLabel" name="textLabel2">
|
||||
<property name="text">
|
||||
<string>µm</string>
|
||||
<item row="0" column="2">
|
||||
<spacer>
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
</widget>
|
||||
<property name="sizeType">
|
||||
<enum>QSizePolicy::Minimum</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>10</width>
|
||||
<height>21</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item row="1" column="0" colspan="3">
|
||||
<widget class="QLabel" name="label">
|
||||
<property name="text">
|
||||
<string>Maximum number of items to show</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="textLabel1_2">
|
||||
<property name="text">
|
||||
<string>Window </string>
|
||||
</property>
|
||||
</widget>
|
||||
<item row="1" column="3">
|
||||
<widget class="QLineEdit" name="le_max_items"/>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<widget class="QComboBox" name="cbx_window">
|
||||
|
|
@ -82,28 +77,23 @@
|
|||
</item>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="2">
|
||||
<spacer>
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="textLabel1_2">
|
||||
<property name="text">
|
||||
<string>Window </string>
|
||||
</property>
|
||||
<property name="sizeType">
|
||||
<enum>QSizePolicy::Minimum</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>10</width>
|
||||
<height>21</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item row="1" column="3">
|
||||
<widget class="QLineEdit" name="le_max_items"/>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="3">
|
||||
<widget class="lay::MarginWidget" name="mrg_window" native="true"/>
|
||||
</item>
|
||||
<item row="1" column="0" colspan="3">
|
||||
<widget class="QLabel" name="label">
|
||||
<property name="text">
|
||||
<string>Maximum number of items to show</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
|
|
|
|||
|
|
@ -1,53 +1,52 @@
|
|||
<ui version="4.0" >
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>BrowseInstancesConfigPage</class>
|
||||
<widget class="QFrame" name="BrowseInstancesConfigPage" >
|
||||
<property name="geometry" >
|
||||
<widget class="QFrame" name="BrowseInstancesConfigPage">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>499</width>
|
||||
<height>148</height>
|
||||
<height>151</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="sizePolicy" >
|
||||
<sizepolicy>
|
||||
<hsizetype>5</hsizetype>
|
||||
<vsizetype>5</vsizetype>
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="windowTitle" >
|
||||
<property name="windowTitle">
|
||||
<string>Browse Cell Instances</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="margin" stdset="0">
|
||||
<number>9</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="QGroupBox" name="groupBox" >
|
||||
<property name="title" >
|
||||
<widget class="QGroupBox" name="groupBox">
|
||||
<property name="title">
|
||||
<string>Instance Browser Setup</string>
|
||||
</property>
|
||||
<layout class="QGridLayout" >
|
||||
<property name="margin" >
|
||||
<layout class="QGridLayout">
|
||||
<property name="margin" stdset="0">
|
||||
<number>9</number>
|
||||
</property>
|
||||
<property name="spacing" >
|
||||
<property name="spacing">
|
||||
<number>6</number>
|
||||
</property>
|
||||
<item row="0" column="2" >
|
||||
<item row="0" column="2">
|
||||
<spacer>
|
||||
<property name="orientation" >
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeType" >
|
||||
<property name="sizeType">
|
||||
<enum>QSizePolicy::Minimum</enum>
|
||||
</property>
|
||||
<property name="sizeHint" >
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>16</width>
|
||||
<height>27</height>
|
||||
|
|
@ -55,62 +54,62 @@
|
|||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item row="0" column="3" colspan="2" >
|
||||
<widget class="QLineEdit" name="le_cell_name" >
|
||||
<property name="enabled" >
|
||||
<item row="0" column="3" colspan="2">
|
||||
<widget class="QLineEdit" name="le_cell_name">
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="0" colspan="3" >
|
||||
<widget class="QLabel" name="label" >
|
||||
<property name="text" >
|
||||
<item row="2" column="0" colspan="3">
|
||||
<widget class="QLabel" name="label">
|
||||
<property name="text">
|
||||
<string>Maximum number of instances to show</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1" >
|
||||
<widget class="QComboBox" name="cbx_context" >
|
||||
<item row="0" column="1">
|
||||
<widget class="QComboBox" name="cbx_context">
|
||||
<item>
|
||||
<property name="text" >
|
||||
<property name="text">
|
||||
<string>Show in context of cell ..</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text" >
|
||||
<property name="text">
|
||||
<string>Show in context of any top cell</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text" >
|
||||
<property name="text">
|
||||
<string>Show in parent cell</string>
|
||||
</property>
|
||||
</item>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="0" >
|
||||
<widget class="QLabel" name="textLabel1" >
|
||||
<property name="text" >
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="textLabel1">
|
||||
<property name="text">
|
||||
<string>Context </string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0" >
|
||||
<widget class="QLabel" name="textLabel1_2" >
|
||||
<property name="text" >
|
||||
<item row="1" column="0">
|
||||
<widget class="QLabel" name="textLabel1_2">
|
||||
<property name="text">
|
||||
<string>Window</string>
|
||||
</property>
|
||||
</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="sizeType" >
|
||||
<property name="sizeType">
|
||||
<enum>QSizePolicy::Minimum</enum>
|
||||
</property>
|
||||
<property name="sizeHint" >
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>16</width>
|
||||
<height>25</height>
|
||||
|
|
@ -118,58 +117,55 @@
|
|||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item row="1" column="1" >
|
||||
<widget class="QComboBox" name="cbx_window" >
|
||||
<item row="1" column="1">
|
||||
<widget class="QComboBox" name="cbx_window">
|
||||
<item>
|
||||
<property name="text" >
|
||||
<property name="text">
|
||||
<string>Don't change</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text" >
|
||||
<property name="text">
|
||||
<string>Fit whole context cell</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text" >
|
||||
<property name="text">
|
||||
<string>Fit marker with margin ..</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text" >
|
||||
<property name="text">
|
||||
<string>Center marker</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text" >
|
||||
<property name="text">
|
||||
<string>Center marker with size ..</string>
|
||||
</property>
|
||||
</item>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="3" >
|
||||
<widget class="QLineEdit" name="le_window" >
|
||||
<property name="enabled" >
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
</widget>
|
||||
<item row="1" column="3" colspan="2">
|
||||
<widget class="lay::MarginWidget" name="mrg_window" native="true"/>
|
||||
</item>
|
||||
<item row="2" column="3" >
|
||||
<widget class="QLineEdit" name="le_max_count" />
|
||||
</item>
|
||||
<item row="1" column="4" >
|
||||
<widget class="QLabel" name="textLabel2" >
|
||||
<property name="text" >
|
||||
<string>µm</string>
|
||||
</property>
|
||||
</widget>
|
||||
<item row="2" column="3" colspan="2">
|
||||
<widget class="QLineEdit" name="le_max_count"/>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<layoutdefault spacing="6" margin="11" />
|
||||
<layoutdefault spacing="6" margin="11"/>
|
||||
<customwidgets>
|
||||
<customwidget>
|
||||
<class>lay::MarginWidget</class>
|
||||
<extends>QWidget</extends>
|
||||
<header>layWidgets.h</header>
|
||||
<container>1</container>
|
||||
</customwidget>
|
||||
</customwidgets>
|
||||
<resources/>
|
||||
<connections/>
|
||||
</ui>
|
||||
|
|
|
|||
|
|
@ -1,7 +1,8 @@
|
|||
<ui version="4.0" >
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>BrowseShapesConfigPage</class>
|
||||
<widget class="QFrame" name="BrowseShapesConfigPage" >
|
||||
<property name="geometry" >
|
||||
<widget class="QFrame" name="BrowseShapesConfigPage">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
|
|
@ -9,61 +10,44 @@
|
|||
<height>194</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle" >
|
||||
<property name="windowTitle">
|
||||
<string>Browse Shapes</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="margin" stdset="0">
|
||||
<number>9</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="QGroupBox" name="groupBox" >
|
||||
<property name="title" >
|
||||
<widget class="QGroupBox" name="groupBox">
|
||||
<property name="title">
|
||||
<string>Shape Browser Setup</string>
|
||||
</property>
|
||||
<layout class="QGridLayout" >
|
||||
<property name="margin" >
|
||||
<layout class="QGridLayout">
|
||||
<property name="margin" stdset="0">
|
||||
<number>9</number>
|
||||
</property>
|
||||
<property name="spacing" >
|
||||
<property name="spacing">
|
||||
<number>6</number>
|
||||
</property>
|
||||
<item row="1" column="4" >
|
||||
<widget class="QLabel" name="textLabel2" >
|
||||
<property name="text" >
|
||||
<string>µm</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="3" >
|
||||
<widget class="QLineEdit" name="le_window" >
|
||||
<property name="enabled" >
|
||||
<item row="0" column="3" colspan="2">
|
||||
<widget class="QLineEdit" name="le_cell_name">
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="3" colspan="2" >
|
||||
<widget class="QLineEdit" name="le_cell_name" >
|
||||
<property name="enabled" >
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="3" >
|
||||
<widget class="QLineEdit" name="le_max_shapes" />
|
||||
</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="sizeType" >
|
||||
<property name="sizeType">
|
||||
<enum>QSizePolicy::Minimum</enum>
|
||||
</property>
|
||||
<property name="sizeHint" >
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>10</width>
|
||||
<height>21</height>
|
||||
|
|
@ -71,15 +55,15 @@
|
|||
</property>
|
||||
</spacer>
|
||||
</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="sizeType" >
|
||||
<property name="sizeType">
|
||||
<enum>QSizePolicy::Minimum</enum>
|
||||
</property>
|
||||
<property name="sizeHint" >
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>10</width>
|
||||
<height>20</height>
|
||||
|
|
@ -87,91 +71,105 @@
|
|||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item row="0" column="1" >
|
||||
<widget class="QComboBox" name="cbx_context" >
|
||||
<item row="0" column="1">
|
||||
<widget class="QComboBox" name="cbx_context">
|
||||
<item>
|
||||
<property name="text" >
|
||||
<property name="text">
|
||||
<string>Show in context of cell ..</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text" >
|
||||
<property name="text">
|
||||
<string>Show in context of any top cell</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text" >
|
||||
<property name="text">
|
||||
<string>Show in context of local cell</string>
|
||||
</property>
|
||||
</item>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="3" >
|
||||
<widget class="QLineEdit" name="le_max_inst" />
|
||||
</item>
|
||||
<item row="2" column="0" colspan="2" >
|
||||
<widget class="QLabel" name="label" >
|
||||
<property name="text" >
|
||||
<item row="2" column="0" colspan="2">
|
||||
<widget class="QLabel" name="label">
|
||||
<property name="text">
|
||||
<string>Maximum number of shapes to show</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="0" >
|
||||
<widget class="QLabel" name="textLabel1" >
|
||||
<property name="text" >
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="textLabel1">
|
||||
<property name="text">
|
||||
<string>Context </string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1" >
|
||||
<widget class="QComboBox" name="cbx_window" >
|
||||
<item row="1" column="1">
|
||||
<widget class="QComboBox" name="cbx_window">
|
||||
<item>
|
||||
<property name="text" >
|
||||
<property name="text">
|
||||
<string>Don't change</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text" >
|
||||
<property name="text">
|
||||
<string>Fit context cell</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text" >
|
||||
<property name="text">
|
||||
<string>Fit marker with margin ..</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text" >
|
||||
<property name="text">
|
||||
<string>Center marker</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text" >
|
||||
<property name="text">
|
||||
<string>Center marker with size ..</string>
|
||||
</property>
|
||||
</item>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="0" colspan="2" >
|
||||
<widget class="QLabel" name="label_2" >
|
||||
<property name="text" >
|
||||
<item row="3" column="0" colspan="2">
|
||||
<widget class="QLabel" name="label_2">
|
||||
<property name="text">
|
||||
<string>Maximum number of instances to show</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0" >
|
||||
<widget class="QLabel" name="textLabel1_2" >
|
||||
<property name="text" >
|
||||
<item row="1" column="0">
|
||||
<widget class="QLabel" name="textLabel1_2">
|
||||
<property name="text">
|
||||
<string>Window </string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="3" colspan="2">
|
||||
<widget class="lay::MarginWidget" name="mrg_window" native="true"/>
|
||||
</item>
|
||||
<item row="2" column="3" colspan="2">
|
||||
<widget class="QLineEdit" name="le_max_shapes"/>
|
||||
</item>
|
||||
<item row="3" column="3" colspan="2">
|
||||
<widget class="QLineEdit" name="le_max_inst"/>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<layoutdefault spacing="6" margin="11" />
|
||||
<layoutdefault spacing="6" margin="11"/>
|
||||
<customwidgets>
|
||||
<customwidget>
|
||||
<class>lay::MarginWidget</class>
|
||||
<extends>QWidget</extends>
|
||||
<header>layWidgets.h</header>
|
||||
<container>1</container>
|
||||
</customwidget>
|
||||
</customwidgets>
|
||||
<resources/>
|
||||
<connections/>
|
||||
</ui>
|
||||
|
|
|
|||
|
|
@ -200,9 +200,9 @@ BrowseInstancesConfigPage::setup (lay::Dispatcher *root)
|
|||
cbx_window->setCurrentIndex (int (wmode));
|
||||
|
||||
// window dimension
|
||||
double wdim = 1.0;
|
||||
root->config_get (cfg_cib_window_dim, wdim);
|
||||
le_window->setText (tl::to_qstring (tl::to_string (wdim)));
|
||||
std::string wdim_str;
|
||||
root->config_get (cfg_cib_window_dim, wdim_str);
|
||||
mrg_window->set_margin (lay::Margin::from_string (wdim_str));
|
||||
|
||||
// max. instance count
|
||||
unsigned int max_inst_count = 1000;
|
||||
|
|
@ -223,22 +223,19 @@ BrowseInstancesConfigPage::context_changed (int m)
|
|||
void
|
||||
BrowseInstancesConfigPage::window_changed (int m)
|
||||
{
|
||||
le_window->setEnabled (m == int (BrowseInstancesForm::FitMarker) || m == int (BrowseInstancesForm::CenterSize));
|
||||
mrg_window->setEnabled (m == int (BrowseInstancesForm::FitMarker) || m == int (BrowseInstancesForm::CenterSize));
|
||||
}
|
||||
|
||||
void
|
||||
BrowseInstancesConfigPage::commit (lay::Dispatcher *root)
|
||||
{
|
||||
double dim = 1.0;
|
||||
tl::from_string_ext (tl::to_string (le_window->text ()), dim);
|
||||
|
||||
unsigned int max_inst_count = 1000;
|
||||
tl::from_string_ext (tl::to_string (le_max_count->text ()), max_inst_count);
|
||||
|
||||
root->config_set (cfg_cib_context_cell, tl::to_string (le_cell_name->text ()));
|
||||
root->config_set (cfg_cib_context_mode, BrowseInstancesForm::mode_type (cbx_context->currentIndex ()), BrowseInstancesContextModeConverter ());
|
||||
root->config_set (cfg_cib_window_mode, BrowseInstancesForm::window_type (cbx_window->currentIndex ()), BrowseInstancesWindowModeConverter ());
|
||||
root->config_set (cfg_cib_window_dim, dim);
|
||||
root->config_set (cfg_cib_window_dim, mrg_window->get_margin ().to_string ());
|
||||
root->config_set (cfg_cib_max_inst_count, max_inst_count);
|
||||
}
|
||||
|
||||
|
|
@ -306,7 +303,7 @@ BrowseInstancesForm::BrowseInstancesForm (lay::Dispatcher *root, LayoutViewBase
|
|||
m_ef_enabled (true),
|
||||
m_mode (AnyTop),
|
||||
m_window (FitMarker),
|
||||
m_window_dim (0.0),
|
||||
m_window_dim (),
|
||||
m_max_inst_count (0),
|
||||
m_current_count (0)
|
||||
{
|
||||
|
|
@ -390,9 +387,8 @@ BrowseInstancesForm::configure (const std::string &name, const std::string &valu
|
|||
|
||||
} else if (name == cfg_cib_window_dim) {
|
||||
|
||||
double wdim = m_window_dim;
|
||||
tl::from_string (value, wdim);
|
||||
if (fabs (wdim - m_window_dim) > 1e-6) {
|
||||
lay::Margin wdim = lay::Margin::from_string (value);
|
||||
if (wdim != m_window_dim) {
|
||||
m_window_dim = wdim;
|
||||
need_update = true;
|
||||
}
|
||||
|
|
@ -787,16 +783,18 @@ BrowseInstancesForm::highlight_current ()
|
|||
|
||||
if (index_set) {
|
||||
|
||||
double window_dim = m_window_dim.get (dbox);
|
||||
|
||||
view ()->select_cell (index, m_cv_index);
|
||||
if (m_window == FitCell) {
|
||||
view ()->zoom_fit ();
|
||||
} else if (m_window == FitMarker) {
|
||||
view ()->zoom_box (dbox.enlarged (db::DVector (m_window_dim, m_window_dim)));
|
||||
view ()->zoom_box (dbox.enlarged (db::DVector (window_dim, window_dim)));
|
||||
} else if (m_window == Center) {
|
||||
view ()->pan_center (dbox.p1 () + (dbox.p2 () - dbox.p1 ()) * 0.5);
|
||||
} else if (m_window == CenterSize) {
|
||||
double w = std::max (dbox.width (), m_window_dim);
|
||||
double h = std::max (dbox.height (), m_window_dim);
|
||||
double w = std::max (dbox.width (), window_dim);
|
||||
double h = std::max (dbox.height (), window_dim);
|
||||
db::DPoint center (dbox.p1 () + (dbox.p2 () - dbox.p1 ()) * 0.5);
|
||||
db::DVector d (w * 0.5, h * 0.5);
|
||||
view ()->zoom_box (db::DBox (center - d, center + d));
|
||||
|
|
|
|||
|
|
@ -29,6 +29,7 @@
|
|||
#include "ui_BrowseInstancesConfigPage.h"
|
||||
|
||||
#include "layLayoutViewBase.h"
|
||||
#include "layMargin.h"
|
||||
#include "layPluginConfigPage.h"
|
||||
#include "layBrowser.h"
|
||||
#include "layMarker.h"
|
||||
|
|
@ -98,7 +99,7 @@ private:
|
|||
mode_type m_mode;
|
||||
window_type m_window;
|
||||
|
||||
double m_window_dim;
|
||||
lay::Margin m_window_dim;
|
||||
std::string m_context_cell;
|
||||
|
||||
unsigned int m_max_inst_count;
|
||||
|
|
|
|||
|
|
@ -202,9 +202,9 @@ BrowseShapesConfigPage::setup (lay::Dispatcher *root)
|
|||
cbx_window->setCurrentIndex (int (wmode));
|
||||
|
||||
// window dimension
|
||||
double wdim = 1.0;
|
||||
root->config_get (cfg_shb_window_dim, wdim);
|
||||
le_window->setText (tl::to_qstring (tl::to_string (wdim)));
|
||||
std::string wdim_str;
|
||||
root->config_get (cfg_shb_window_dim, wdim_str);
|
||||
mrg_window->set_margin (lay::Margin::from_string (wdim_str));
|
||||
|
||||
// max. instance count
|
||||
unsigned int max_inst_count = 1000;
|
||||
|
|
@ -230,15 +230,12 @@ BrowseShapesConfigPage::context_changed (int m)
|
|||
void
|
||||
BrowseShapesConfigPage::window_changed (int m)
|
||||
{
|
||||
le_window->setEnabled (m == int (BrowseShapesForm::FitMarker) || m == int (BrowseShapesForm::CenterSize));
|
||||
mrg_window->setEnabled (m == int (BrowseShapesForm::FitMarker) || m == int (BrowseShapesForm::CenterSize));
|
||||
}
|
||||
|
||||
void
|
||||
BrowseShapesConfigPage::commit (lay::Dispatcher *root)
|
||||
{
|
||||
double dim = 1.0;
|
||||
tl::from_string_ext (tl::to_string (le_window->text ()), dim);
|
||||
|
||||
unsigned int max_inst_count = 1000;
|
||||
tl::from_string_ext (tl::to_string (le_max_inst->text ()), max_inst_count);
|
||||
|
||||
|
|
@ -248,7 +245,7 @@ BrowseShapesConfigPage::commit (lay::Dispatcher *root)
|
|||
root->config_set (cfg_shb_context_cell, tl::to_string (le_cell_name->text ()));
|
||||
root->config_set (cfg_shb_context_mode, BrowseShapesForm::mode_type (cbx_context->currentIndex ()), BrowseShapesContextModeConverter ());
|
||||
root->config_set (cfg_shb_window_mode, BrowseShapesForm::window_type (cbx_window->currentIndex ()), BrowseShapesWindowModeConverter ());
|
||||
root->config_set (cfg_shb_window_dim, dim);
|
||||
root->config_set (cfg_shb_window_dim, mrg_window->get_margin ().to_string ());
|
||||
root->config_set (cfg_shb_max_inst_count, max_inst_count);
|
||||
root->config_set (cfg_shb_max_shape_count, max_shape_count);
|
||||
}
|
||||
|
|
@ -409,7 +406,7 @@ BrowseShapesForm::BrowseShapesForm (lay::Dispatcher *root, LayoutViewBase *vw)
|
|||
m_ef_enabled (true),
|
||||
m_mode (AnyTop),
|
||||
m_window (FitMarker),
|
||||
m_window_dim (0.0),
|
||||
m_window_dim (),
|
||||
m_max_inst_count (0),
|
||||
m_max_shape_count (0)
|
||||
{
|
||||
|
|
@ -496,9 +493,8 @@ BrowseShapesForm::configure (const std::string &name, const std::string &value)
|
|||
|
||||
} else if (name == cfg_shb_window_dim) {
|
||||
|
||||
double wdim = m_window_dim;
|
||||
tl::from_string (value, wdim);
|
||||
if (fabs (wdim - m_window_dim) > 1e-6) {
|
||||
lay::Margin wdim = lay::Margin::from_string (value);
|
||||
if (wdim != m_window_dim) {
|
||||
m_window_dim = wdim;
|
||||
need_update = true;
|
||||
}
|
||||
|
|
@ -961,16 +957,18 @@ BrowseShapesForm::highlight_current ()
|
|||
|
||||
if (! dbox.empty ()) {
|
||||
|
||||
double window_dim = m_window_dim.get (dbox);
|
||||
|
||||
view ()->select_cell (cell_index, m_cv_index);
|
||||
if (m_window == FitCell) {
|
||||
view ()->zoom_fit ();
|
||||
} else if (m_window == FitMarker) {
|
||||
view ()->zoom_box (dbox.enlarged (db::DVector (m_window_dim, m_window_dim)));
|
||||
view ()->zoom_box (dbox.enlarged (db::DVector (window_dim, window_dim)));
|
||||
} else if (m_window == Center) {
|
||||
view ()->pan_center (dbox.p1 () + (dbox.p2 () - dbox.p1 ()) * 0.5);
|
||||
} else if (m_window == CenterSize) {
|
||||
double w = std::max (dbox.width (), m_window_dim);
|
||||
double h = std::max (dbox.height (), m_window_dim);
|
||||
double w = std::max (dbox.width (), window_dim);
|
||||
double h = std::max (dbox.height (), window_dim);
|
||||
db::DPoint center (dbox.p1 () + (dbox.p2 () - dbox.p1 ()) * 0.5);
|
||||
db::DVector d (w * 0.5, h * 0.5);
|
||||
view ()->zoom_box (db::DBox (center - d, center + d));
|
||||
|
|
|
|||
|
|
@ -29,6 +29,7 @@
|
|||
#include "ui_BrowseShapesConfigPage.h"
|
||||
|
||||
#include "layLayoutViewBase.h"
|
||||
#include "layMargin.h"
|
||||
#include "layPluginConfigPage.h"
|
||||
#include "layBrowser.h"
|
||||
#include "layMarker.h"
|
||||
|
|
@ -99,7 +100,7 @@ private:
|
|||
mode_type m_mode;
|
||||
window_type m_window;
|
||||
|
||||
double m_window_dim;
|
||||
lay::Margin m_window_dim;
|
||||
std::string m_context_cell;
|
||||
|
||||
unsigned int m_max_inst_count;
|
||||
|
|
|
|||
|
|
@ -1081,7 +1081,7 @@ ColorButton::browse_selected ()
|
|||
// MarginWidget implementation
|
||||
|
||||
MarginWidget::MarginWidget (QWidget *parent, const char *name)
|
||||
: QFrame (parent)
|
||||
: QFrame (parent), m_margin ()
|
||||
{
|
||||
if (name) {
|
||||
setObjectName (name);
|
||||
|
|
@ -1105,13 +1105,12 @@ MarginWidget::MarginWidget (QWidget *parent, const char *name)
|
|||
QComboBox *mode = new QComboBox (this);
|
||||
mode->addItem (tl::to_qstring ("µm"));
|
||||
mode->addItem (tl::to_qstring ("%"));
|
||||
mode->setCurrentIndex (0);
|
||||
mp_mode_cb = mode;
|
||||
layout->addWidget (mode);
|
||||
|
||||
connect (mode, SIGNAL (currentIndexChanged (int)), this, SLOT (mode_selection_changed ()));
|
||||
|
||||
mode_selection_changed ();
|
||||
set_margin (lay::Margin ());
|
||||
}
|
||||
|
||||
lay::Margin
|
||||
|
|
@ -1122,16 +1121,21 @@ MarginWidget::get_margin () const
|
|||
tl::from_string (tl::to_string (mp_rel_edit->text ()), rel);
|
||||
tl::from_string (tl::to_string (mp_abs_edit->text ()), abs);
|
||||
|
||||
lay::Margin m;
|
||||
lay::Margin m = m_margin;
|
||||
m.set_relative_mode (rel_mode);
|
||||
m.set_absolute_value (abs);
|
||||
m.set_relative_value (rel * 0.01);
|
||||
if (rel_mode) {
|
||||
m.set_relative_value (rel * 0.01);
|
||||
} else {
|
||||
m.set_absolute_value (abs);
|
||||
}
|
||||
return m;
|
||||
}
|
||||
|
||||
void
|
||||
MarginWidget::set_margin (const lay::Margin &margin)
|
||||
{
|
||||
m_margin = margin;
|
||||
|
||||
mp_abs_edit->setText (tl::to_qstring (tl::to_string (margin.absolute_value ())));
|
||||
mp_rel_edit->setText (tl::to_qstring (tl::to_string (margin.relative_value () * 100.0)));
|
||||
mp_mode_cb->setCurrentIndex (margin.relative_mode () ? 1 : 0);
|
||||
|
|
|
|||
|
|
@ -341,6 +341,7 @@ private:
|
|||
QLineEdit *mp_abs_edit;
|
||||
QLineEdit *mp_rel_edit;
|
||||
QComboBox *mp_mode_cb;
|
||||
lay::Margin m_margin;
|
||||
};
|
||||
|
||||
/**
|
||||
|
|
|
|||
Loading…
Reference in New Issue