mirror of https://github.com/KLayout/klayout.git
commit
25ff5b79eb
|
|
@ -1,7 +1,8 @@
|
||||||
<ui version="4.0" >
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<ui version="4.0">
|
||||||
<class>SearchReplaceConfigPage</class>
|
<class>SearchReplaceConfigPage</class>
|
||||||
<widget class="QFrame" name="SearchReplaceConfigPage" >
|
<widget class="QFrame" name="SearchReplaceConfigPage">
|
||||||
<property name="geometry" >
|
<property name="geometry">
|
||||||
<rect>
|
<rect>
|
||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>0</y>
|
<y>0</y>
|
||||||
|
|
@ -9,94 +10,34 @@
|
||||||
<height>158</height>
|
<height>158</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
<property name="windowTitle" >
|
<property name="windowTitle">
|
||||||
<string>Search Result Browser Configuration</string>
|
<string>Search Result Browser Configuration</string>
|
||||||
</property>
|
</property>
|
||||||
<layout class="QVBoxLayout" >
|
<layout class="QVBoxLayout">
|
||||||
<property name="margin" >
|
<property name="spacing">
|
||||||
<number>9</number>
|
|
||||||
</property>
|
|
||||||
<property name="spacing" >
|
|
||||||
<number>6</number>
|
<number>6</number>
|
||||||
</property>
|
</property>
|
||||||
|
<property name="margin" stdset="0">
|
||||||
|
<number>9</number>
|
||||||
|
</property>
|
||||||
<item>
|
<item>
|
||||||
<widget class="QGroupBox" name="groupBox" >
|
<widget class="QGroupBox" name="groupBox">
|
||||||
<property name="title" >
|
<property name="title">
|
||||||
<string>Search Result Browser Configuration</string>
|
<string>Search Result Browser Configuration</string>
|
||||||
</property>
|
</property>
|
||||||
<layout class="QGridLayout" >
|
<layout class="QGridLayout">
|
||||||
<property name="margin" >
|
<property name="spacing">
|
||||||
<number>9</number>
|
|
||||||
</property>
|
|
||||||
<property name="spacing" >
|
|
||||||
<number>6</number>
|
<number>6</number>
|
||||||
</property>
|
</property>
|
||||||
<item row="0" column="4" >
|
<item row="0" column="2">
|
||||||
<widget class="QLabel" name="textLabel2" >
|
|
||||||
<property name="text" >
|
|
||||||
<string>µm</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="0" column="3" >
|
|
||||||
<widget class="QLineEdit" name="le_window" >
|
|
||||||
<property name="enabled" >
|
|
||||||
<bool>false</bool>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</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>
|
|
||||||
<item row="0" column="1" >
|
|
||||||
<widget class="QComboBox" name="cbx_window" >
|
|
||||||
<item>
|
|
||||||
<property name="text" >
|
|
||||||
<string>Don't change</string>
|
|
||||||
</property>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<property name="text" >
|
|
||||||
<string>Fit context cell</string>
|
|
||||||
</property>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<property name="text" >
|
|
||||||
<string>Fit marker with margin ..</string>
|
|
||||||
</property>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<property name="text" >
|
|
||||||
<string>Center marker</string>
|
|
||||||
</property>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<property name="text" >
|
|
||||||
<string>Center marker with size ..</string>
|
|
||||||
</property>
|
|
||||||
</item>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="0" column="2" >
|
|
||||||
<spacer>
|
<spacer>
|
||||||
<property name="orientation" >
|
<property name="orientation">
|
||||||
<enum>Qt::Horizontal</enum>
|
<enum>Qt::Horizontal</enum>
|
||||||
</property>
|
</property>
|
||||||
<property name="sizeType" >
|
<property name="sizeType">
|
||||||
<enum>QSizePolicy::Minimum</enum>
|
<enum>QSizePolicy::Minimum</enum>
|
||||||
</property>
|
</property>
|
||||||
<property name="sizeHint" >
|
<property name="sizeHint" stdset="0">
|
||||||
<size>
|
<size>
|
||||||
<width>10</width>
|
<width>10</width>
|
||||||
<height>21</height>
|
<height>21</height>
|
||||||
|
|
@ -104,18 +45,71 @@
|
||||||
</property>
|
</property>
|
||||||
</spacer>
|
</spacer>
|
||||||
</item>
|
</item>
|
||||||
<item row="1" column="3" >
|
<item row="1" column="3">
|
||||||
<widget class="QLineEdit" name="le_max_items" />
|
<widget class="QLineEdit" name="le_max_items"/>
|
||||||
|
</item>
|
||||||
|
<item row="0" column="1">
|
||||||
|
<widget class="QComboBox" name="cbx_window">
|
||||||
|
<item>
|
||||||
|
<property name="text">
|
||||||
|
<string>Don't change</string>
|
||||||
|
</property>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<property name="text">
|
||||||
|
<string>Fit context cell</string>
|
||||||
|
</property>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<property name="text">
|
||||||
|
<string>Fit marker with margin ..</string>
|
||||||
|
</property>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<property name="text">
|
||||||
|
<string>Center marker</string>
|
||||||
|
</property>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<property name="text">
|
||||||
|
<string>Center marker with size ..</string>
|
||||||
|
</property>
|
||||||
|
</item>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="0" column="0">
|
||||||
|
<widget class="QLabel" name="textLabel1_2">
|
||||||
|
<property name="text">
|
||||||
|
<string>Window </string>
|
||||||
|
</property>
|
||||||
|
</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>
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</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>
|
||||||
<tabstops>
|
<tabstops>
|
||||||
<tabstop>cbx_window</tabstop>
|
<tabstop>cbx_window</tabstop>
|
||||||
<tabstop>le_window</tabstop>
|
|
||||||
<tabstop>le_max_items</tabstop>
|
<tabstop>le_max_items</tabstop>
|
||||||
</tabstops>
|
</tabstops>
|
||||||
<resources/>
|
<resources/>
|
||||||
|
|
|
||||||
|
|
@ -87,9 +87,9 @@ SearchReplaceConfigPage::setup (lay::Dispatcher *root)
|
||||||
cbx_window->setCurrentIndex (int (wmode));
|
cbx_window->setCurrentIndex (int (wmode));
|
||||||
|
|
||||||
// window dimension
|
// window dimension
|
||||||
double wdim = 1.0;
|
std::string wdim_str;
|
||||||
root->config_get (cfg_sr_window_dim, wdim);
|
root->config_get (cfg_sr_window_dim, wdim_str);
|
||||||
le_window->setText (tl::to_qstring (tl::to_string (wdim)));
|
mrg_window->set_margin (lay::Margin::from_string (wdim_str));
|
||||||
|
|
||||||
// max. instance count
|
// max. instance count
|
||||||
unsigned int max_item_count = 1000;
|
unsigned int max_item_count = 1000;
|
||||||
|
|
@ -103,20 +103,19 @@ SearchReplaceConfigPage::setup (lay::Dispatcher *root)
|
||||||
void
|
void
|
||||||
SearchReplaceConfigPage::window_changed (int m)
|
SearchReplaceConfigPage::window_changed (int m)
|
||||||
{
|
{
|
||||||
le_window->setEnabled (m == int (SearchReplaceDialog::FitMarker) || m == int (SearchReplaceDialog::CenterSize));
|
mrg_window->setEnabled (m == int (SearchReplaceDialog::FitMarker) || m == int (SearchReplaceDialog::CenterSize));
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
SearchReplaceConfigPage::commit (lay::Dispatcher *root)
|
SearchReplaceConfigPage::commit (lay::Dispatcher *root)
|
||||||
{
|
{
|
||||||
double dim = 1.0;
|
lay::Margin dim = mrg_window->get_margin ();
|
||||||
tl::from_string_ext (tl::to_string (le_window->text ()), dim);
|
|
||||||
|
|
||||||
unsigned int max_item_count = 1000;
|
unsigned int max_item_count = 1000;
|
||||||
tl::from_string_ext (tl::to_string (le_max_items->text ()), max_item_count);
|
tl::from_string_ext (tl::to_string (le_max_items->text ()), max_item_count);
|
||||||
|
|
||||||
root->config_set (cfg_sr_window_mode, SearchReplaceDialog::window_type (cbx_window->currentIndex ()), SearchReplaceWindowModeConverter ());
|
root->config_set (cfg_sr_window_mode, SearchReplaceDialog::window_type (cbx_window->currentIndex ()), SearchReplaceWindowModeConverter ());
|
||||||
root->config_set (cfg_sr_window_dim, dim);
|
root->config_set (cfg_sr_window_dim, dim.to_string ());
|
||||||
root->config_set (cfg_sr_max_item_count, max_item_count);
|
root->config_set (cfg_sr_max_item_count, max_item_count);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1125,9 +1125,8 @@ SearchReplaceDialog::configure (const std::string &name, const std::string &valu
|
||||||
|
|
||||||
} else if (name == cfg_sr_window_dim) {
|
} else if (name == cfg_sr_window_dim) {
|
||||||
|
|
||||||
double wdim = m_window_dim;
|
lay::Margin wdim = lay::Margin::from_string (value);
|
||||||
tl::from_string (value, wdim);
|
if (wdim != m_window_dim) {
|
||||||
if (fabs (wdim - m_window_dim) > 1e-6) {
|
|
||||||
m_window_dim = wdim;
|
m_window_dim = wdim;
|
||||||
need_update = true;
|
need_update = true;
|
||||||
}
|
}
|
||||||
|
|
@ -1754,15 +1753,17 @@ SearchReplaceDialog::result_selection_changed ()
|
||||||
|
|
||||||
if (! dbox.empty ()) {
|
if (! dbox.empty ()) {
|
||||||
|
|
||||||
|
double window_dim = m_window_dim.get (dbox);
|
||||||
|
|
||||||
if (m_window == FitCell) {
|
if (m_window == FitCell) {
|
||||||
view ()->zoom_fit ();
|
view ()->zoom_fit ();
|
||||||
} else if (m_window == FitMarker) {
|
} 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) {
|
} else if (m_window == Center) {
|
||||||
view ()->pan_center (dbox.p1 () + (dbox.p2 () - dbox.p1 ()) * 0.5);
|
view ()->pan_center (dbox.p1 () + (dbox.p2 () - dbox.p1 ()) * 0.5);
|
||||||
} else if (m_window == CenterSize) {
|
} else if (m_window == CenterSize) {
|
||||||
double w = std::max (dbox.width (), m_window_dim);
|
double w = std::max (dbox.width (), window_dim);
|
||||||
double h = std::max (dbox.height (), m_window_dim);
|
double h = std::max (dbox.height (), window_dim);
|
||||||
db::DPoint center (dbox.p1 () + (dbox.p2 () - dbox.p1 ()) * 0.5);
|
db::DPoint center (dbox.p1 () + (dbox.p2 () - dbox.p1 ()) * 0.5);
|
||||||
db::DVector d (w * 0.5, h * 0.5);
|
db::DVector d (w * 0.5, h * 0.5);
|
||||||
view ()->zoom_box (db::DBox (center - d, center + d));
|
view ()->zoom_box (db::DBox (center - d, center + d));
|
||||||
|
|
|
||||||
|
|
@ -27,6 +27,7 @@
|
||||||
#include "ui_SearchReplaceDialog.h"
|
#include "ui_SearchReplaceDialog.h"
|
||||||
|
|
||||||
#include "layBrowser.h"
|
#include "layBrowser.h"
|
||||||
|
#include "layMargin.h"
|
||||||
#include "rdb.h"
|
#include "rdb.h"
|
||||||
#include "dbLayout.h"
|
#include "dbLayout.h"
|
||||||
#include "dbShape.h"
|
#include "dbShape.h"
|
||||||
|
|
@ -180,7 +181,7 @@ private:
|
||||||
int m_current_mode;
|
int m_current_mode;
|
||||||
|
|
||||||
window_type m_window;
|
window_type m_window;
|
||||||
double m_window_dim;
|
lay::Margin m_window_dim;
|
||||||
unsigned int m_max_item_count;
|
unsigned int m_max_item_count;
|
||||||
std::vector<lay::MarkerBase *> mp_markers;
|
std::vector<lay::MarkerBase *> mp_markers;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,114 @@
|
||||||
|
|
||||||
|
/*
|
||||||
|
|
||||||
|
KLayout Layout Viewer
|
||||||
|
Copyright (C) 2006-2023 Matthias Koefferlein
|
||||||
|
|
||||||
|
This program is free software; you can redistribute it and/or modify
|
||||||
|
it under the terms of the GNU General Public License as published by
|
||||||
|
the Free Software Foundation; either version 2 of the License, or
|
||||||
|
(at your option) any later version.
|
||||||
|
|
||||||
|
This program is distributed in the hope that it will be useful,
|
||||||
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
GNU General Public License for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU General Public License
|
||||||
|
along with this program; if not, write to the Free Software
|
||||||
|
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||||
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
#include "layMargin.h"
|
||||||
|
|
||||||
|
#include <algorithm>
|
||||||
|
|
||||||
|
namespace lay
|
||||||
|
{
|
||||||
|
|
||||||
|
static const double delta = 1e-10;
|
||||||
|
|
||||||
|
Margin::Margin (double value, bool relative)
|
||||||
|
: m_relative_value (0.0), m_absolute_value (0.0), m_relative_mode (relative)
|
||||||
|
{
|
||||||
|
if (relative) {
|
||||||
|
m_relative_value = value;
|
||||||
|
} else {
|
||||||
|
m_absolute_value = value;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
bool
|
||||||
|
Margin::operator== (const lay::Margin &other) const
|
||||||
|
{
|
||||||
|
return m_relative_mode == other.m_relative_mode &&
|
||||||
|
fabs (m_absolute_value - other.m_absolute_value) < delta &&
|
||||||
|
fabs (m_relative_value - other.m_relative_value) < delta;
|
||||||
|
}
|
||||||
|
|
||||||
|
std::string
|
||||||
|
Margin::to_string () const
|
||||||
|
{
|
||||||
|
std::string res;
|
||||||
|
if (m_relative_mode) {
|
||||||
|
res = std::string ("*") + tl::to_string (m_relative_value);
|
||||||
|
if (fabs (m_absolute_value) > delta) {
|
||||||
|
res += " ";
|
||||||
|
res += tl::to_string (m_absolute_value);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
res = tl::to_string (m_absolute_value);
|
||||||
|
if (fabs (m_relative_value) > delta) {
|
||||||
|
res += " *";
|
||||||
|
res += tl::to_string (m_relative_value);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return res;
|
||||||
|
}
|
||||||
|
|
||||||
|
Margin
|
||||||
|
Margin::from_string (const std::string &s)
|
||||||
|
{
|
||||||
|
Margin res;
|
||||||
|
|
||||||
|
tl::Extractor ex (s.c_str ());
|
||||||
|
if (ex.test ("*")) {
|
||||||
|
double v = 0.0;
|
||||||
|
ex.read (v);
|
||||||
|
res.set_relative_mode (true);
|
||||||
|
res.set_relative_value (v);
|
||||||
|
if (! ex.at_end ()) {
|
||||||
|
ex.read (v);
|
||||||
|
res.set_absolute_value (v);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
double v = 0.0;
|
||||||
|
ex.read (v);
|
||||||
|
res.set_relative_mode (false);
|
||||||
|
res.set_absolute_value (v);
|
||||||
|
if (ex.test ("*")) {
|
||||||
|
ex.read (v);
|
||||||
|
res.set_relative_value (v);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return res;
|
||||||
|
}
|
||||||
|
|
||||||
|
double
|
||||||
|
Margin::get (double dim) const
|
||||||
|
{
|
||||||
|
return m_relative_mode ? dim * m_relative_value : m_absolute_value;
|
||||||
|
}
|
||||||
|
|
||||||
|
double
|
||||||
|
Margin::get (const db::DBox &box) const
|
||||||
|
{
|
||||||
|
return get (std::max (box.width (), box.height ()));
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
@ -0,0 +1,140 @@
|
||||||
|
|
||||||
|
/*
|
||||||
|
|
||||||
|
KLayout Layout Viewer
|
||||||
|
Copyright (C) 2006-2023 Matthias Koefferlein
|
||||||
|
|
||||||
|
This program is free software; you can redistribute it and/or modify
|
||||||
|
it under the terms of the GNU General Public License as published by
|
||||||
|
the Free Software Foundation; either version 2 of the License, or
|
||||||
|
(at your option) any later version.
|
||||||
|
|
||||||
|
This program is distributed in the hope that it will be useful,
|
||||||
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
GNU General Public License for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU General Public License
|
||||||
|
along with this program; if not, write to the Free Software
|
||||||
|
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||||
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
#ifndef HDR_layMargin
|
||||||
|
#define HDR_layMargin
|
||||||
|
|
||||||
|
#include "laybasicCommon.h"
|
||||||
|
|
||||||
|
#include "dbBox.h"
|
||||||
|
|
||||||
|
namespace lay
|
||||||
|
{
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief A class represeting a margin on size
|
||||||
|
*
|
||||||
|
* Margin or size can be specified absolutely (in micron units) or relative
|
||||||
|
* to some object (given by a size or a box).
|
||||||
|
*
|
||||||
|
* The object keeps relative and absolute values so it can be easily
|
||||||
|
* switched.
|
||||||
|
*/
|
||||||
|
|
||||||
|
class LAYBASIC_PUBLIC Margin
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
/**
|
||||||
|
* @brief The constructor
|
||||||
|
*/
|
||||||
|
Margin (double value = 0.0, bool relative = false);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Equality
|
||||||
|
*/
|
||||||
|
bool operator== (const lay::Margin &other) const;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Inequality
|
||||||
|
*/
|
||||||
|
bool operator!= (const lay::Margin &other) const
|
||||||
|
{
|
||||||
|
return ! operator== (other);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Gets the relative value
|
||||||
|
*/
|
||||||
|
double relative_value () const
|
||||||
|
{
|
||||||
|
return m_relative_value;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Sets the relative value
|
||||||
|
*/
|
||||||
|
void set_relative_value (double v)
|
||||||
|
{
|
||||||
|
m_relative_value = v;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Gets the absolute value
|
||||||
|
*/
|
||||||
|
double absolute_value () const
|
||||||
|
{
|
||||||
|
return m_absolute_value;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Sets the absolute value
|
||||||
|
*/
|
||||||
|
void set_absolute_value (double v)
|
||||||
|
{
|
||||||
|
m_absolute_value = v;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Gets a value indicating whether the relative value shall be used
|
||||||
|
*/
|
||||||
|
bool relative_mode () const
|
||||||
|
{
|
||||||
|
return m_relative_mode;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Sets a value indicating whether the relative value shall be used
|
||||||
|
*/
|
||||||
|
void set_relative_mode (bool mode)
|
||||||
|
{
|
||||||
|
m_relative_mode = mode;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Converts the object to a string
|
||||||
|
*/
|
||||||
|
std::string to_string () const;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Creates the object from a string
|
||||||
|
*/
|
||||||
|
static Margin from_string (const std::string &s);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Gets the resulting value for a given object dimension
|
||||||
|
*/
|
||||||
|
double get (double dim) const;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Gets the resulting value for a given box
|
||||||
|
*/
|
||||||
|
double get (const db::DBox &box) const;
|
||||||
|
|
||||||
|
private:
|
||||||
|
double m_relative_value, m_absolute_value;
|
||||||
|
bool m_relative_mode;
|
||||||
|
};
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
@ -36,6 +36,7 @@ SOURCES += \
|
||||||
gsiDeclLayRdbAdded.cc \
|
gsiDeclLayRdbAdded.cc \
|
||||||
layAbstractMenu.cc \
|
layAbstractMenu.cc \
|
||||||
layLayoutViewConfig.cc \
|
layLayoutViewConfig.cc \
|
||||||
|
layMargin.cc \
|
||||||
laybasicForceLink.cc \
|
laybasicForceLink.cc \
|
||||||
layAnnotationShapes.cc \
|
layAnnotationShapes.cc \
|
||||||
layBitmap.cc \
|
layBitmap.cc \
|
||||||
|
|
@ -86,6 +87,7 @@ SOURCES += \
|
||||||
layUtils.cc \
|
layUtils.cc \
|
||||||
|
|
||||||
HEADERS += \
|
HEADERS += \
|
||||||
|
layMargin.h \
|
||||||
laybasicConfig.h \
|
laybasicConfig.h \
|
||||||
laybasicForceLink.h \
|
laybasicForceLink.h \
|
||||||
layAbstractMenu.h \
|
layAbstractMenu.h \
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,82 @@
|
||||||
|
|
||||||
|
/*
|
||||||
|
|
||||||
|
KLayout Layout Viewer
|
||||||
|
Copyright (C) 2006-2023 Matthias Koefferlein
|
||||||
|
|
||||||
|
This program is free software; you can redistribute it and/or modify
|
||||||
|
it under the terms of the GNU General Public License as published by
|
||||||
|
the Free Software Foundation; either version 2 of the License, or
|
||||||
|
(at your option) any later version.
|
||||||
|
|
||||||
|
This program is distributed in the hope that it will be useful,
|
||||||
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
GNU General Public License for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU General Public License
|
||||||
|
along with this program; if not, write to the Free Software
|
||||||
|
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||||
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "layMargin.h"
|
||||||
|
|
||||||
|
#include "tlUnitTest.h"
|
||||||
|
|
||||||
|
TEST(1)
|
||||||
|
{
|
||||||
|
lay::Margin m;
|
||||||
|
|
||||||
|
EXPECT_EQ (m.relative_mode (), false);
|
||||||
|
EXPECT_EQ (m.to_string (), "0");
|
||||||
|
EXPECT_EQ (m.get (1.0), 0.0);
|
||||||
|
EXPECT_EQ (lay::Margin::from_string (m.to_string ()).to_string (), m.to_string ());
|
||||||
|
|
||||||
|
m.set_relative_mode (true);
|
||||||
|
EXPECT_EQ (m.get (1.0), 0.0);
|
||||||
|
EXPECT_EQ (m.relative_mode (), true);
|
||||||
|
EXPECT_EQ (m.to_string (), "*0");
|
||||||
|
EXPECT_EQ (lay::Margin::from_string (m.to_string ()).to_string (), m.to_string ());
|
||||||
|
|
||||||
|
m = lay::Margin (1.0);
|
||||||
|
EXPECT_EQ (m.get (2.0), 1.0);
|
||||||
|
EXPECT_EQ (m.relative_mode (), false);
|
||||||
|
EXPECT_EQ (m.absolute_value (), 1.0);
|
||||||
|
EXPECT_EQ (m.to_string (), "1");
|
||||||
|
EXPECT_EQ (lay::Margin::from_string (m.to_string ()).to_string (), m.to_string ());
|
||||||
|
|
||||||
|
m.set_absolute_value (2.0);
|
||||||
|
EXPECT_EQ (m.get (1.0), 2.0);
|
||||||
|
EXPECT_EQ (m.absolute_value (), 2.0);
|
||||||
|
EXPECT_EQ (m.to_string (), "2");
|
||||||
|
EXPECT_EQ (lay::Margin::from_string (m.to_string ()).to_string (), m.to_string ());
|
||||||
|
|
||||||
|
m = lay::Margin (1.5, true);
|
||||||
|
EXPECT_EQ (m.get (1.0), 1.5);
|
||||||
|
EXPECT_EQ (m.get (db::DBox (0.0, 0.0, 1.0, 0.5)), 1.5);
|
||||||
|
EXPECT_EQ (m.get (db::DBox (0.0, 0.0, 1.0, 2.0)), 3.0);
|
||||||
|
EXPECT_EQ (m.relative_mode (), true);
|
||||||
|
EXPECT_EQ (m.relative_value (), 1.5);
|
||||||
|
EXPECT_EQ (m.to_string (), "*1.5");
|
||||||
|
EXPECT_EQ (lay::Margin::from_string (m.to_string ()).to_string (), m.to_string ());
|
||||||
|
|
||||||
|
m.set_absolute_value (2.5);
|
||||||
|
EXPECT_EQ (m.get (1.0), 1.5);
|
||||||
|
EXPECT_EQ (m.to_string (), "*1.5 2.5");
|
||||||
|
EXPECT_EQ (lay::Margin::from_string (m.to_string ()).to_string (), m.to_string ());
|
||||||
|
EXPECT_EQ (m.absolute_value (), 2.5);
|
||||||
|
|
||||||
|
m.set_relative_value (2.0);
|
||||||
|
EXPECT_EQ (m.get (1.0), 2.0);
|
||||||
|
EXPECT_EQ (m.to_string (), "*2 2.5");
|
||||||
|
EXPECT_EQ (lay::Margin::from_string (m.to_string ()).to_string (), m.to_string ());
|
||||||
|
EXPECT_EQ (m.relative_value (), 2.0);
|
||||||
|
|
||||||
|
m.set_relative_mode (false);
|
||||||
|
EXPECT_EQ (m.get (1.0), 2.5);
|
||||||
|
EXPECT_EQ (m.absolute_value (), 2.5);
|
||||||
|
EXPECT_EQ (m.to_string (), "2.5 *2");
|
||||||
|
EXPECT_EQ (lay::Margin::from_string (m.to_string ()).to_string (), m.to_string ());
|
||||||
|
EXPECT_EQ (m.relative_value (), 2.0);
|
||||||
|
}
|
||||||
|
|
@ -11,6 +11,7 @@ SOURCES = \
|
||||||
layBitmap.cc \
|
layBitmap.cc \
|
||||||
layBitmapsToImage.cc \
|
layBitmapsToImage.cc \
|
||||||
layLayerProperties.cc \
|
layLayerProperties.cc \
|
||||||
|
layMarginTests.cc \
|
||||||
layParsedLayerSource.cc \
|
layParsedLayerSource.cc \
|
||||||
layRenderer.cc \
|
layRenderer.cc \
|
||||||
layAbstractMenuTests.cc \
|
layAbstractMenuTests.cc \
|
||||||
|
|
|
||||||
|
|
@ -1,53 +1,52 @@
|
||||||
<ui version="4.0" >
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<ui version="4.0">
|
||||||
<class>BrowseInstancesConfigPage</class>
|
<class>BrowseInstancesConfigPage</class>
|
||||||
<widget class="QFrame" name="BrowseInstancesConfigPage" >
|
<widget class="QFrame" name="BrowseInstancesConfigPage">
|
||||||
<property name="geometry" >
|
<property name="geometry">
|
||||||
<rect>
|
<rect>
|
||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>0</y>
|
<y>0</y>
|
||||||
<width>499</width>
|
<width>499</width>
|
||||||
<height>148</height>
|
<height>151</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
<property name="sizePolicy" >
|
<property name="sizePolicy">
|
||||||
<sizepolicy>
|
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
|
||||||
<hsizetype>5</hsizetype>
|
|
||||||
<vsizetype>5</vsizetype>
|
|
||||||
<horstretch>0</horstretch>
|
<horstretch>0</horstretch>
|
||||||
<verstretch>0</verstretch>
|
<verstretch>0</verstretch>
|
||||||
</sizepolicy>
|
</sizepolicy>
|
||||||
</property>
|
</property>
|
||||||
<property name="windowTitle" >
|
<property name="windowTitle">
|
||||||
<string>Browse Cell Instances</string>
|
<string>Browse Cell Instances</string>
|
||||||
</property>
|
</property>
|
||||||
<layout class="QVBoxLayout" >
|
<layout class="QVBoxLayout">
|
||||||
<property name="margin" >
|
<property name="spacing">
|
||||||
<number>9</number>
|
|
||||||
</property>
|
|
||||||
<property name="spacing" >
|
|
||||||
<number>6</number>
|
<number>6</number>
|
||||||
</property>
|
</property>
|
||||||
|
<property name="margin" stdset="0">
|
||||||
|
<number>9</number>
|
||||||
|
</property>
|
||||||
<item>
|
<item>
|
||||||
<widget class="QGroupBox" name="groupBox" >
|
<widget class="QGroupBox" name="groupBox">
|
||||||
<property name="title" >
|
<property name="title">
|
||||||
<string>Instance Browser Setup</string>
|
<string>Instance Browser Setup</string>
|
||||||
</property>
|
</property>
|
||||||
<layout class="QGridLayout" >
|
<layout class="QGridLayout">
|
||||||
<property name="margin" >
|
<property name="margin" stdset="0">
|
||||||
<number>9</number>
|
<number>9</number>
|
||||||
</property>
|
</property>
|
||||||
<property name="spacing" >
|
<property name="spacing">
|
||||||
<number>6</number>
|
<number>6</number>
|
||||||
</property>
|
</property>
|
||||||
<item row="0" column="2" >
|
<item row="0" column="2">
|
||||||
<spacer>
|
<spacer>
|
||||||
<property name="orientation" >
|
<property name="orientation">
|
||||||
<enum>Qt::Horizontal</enum>
|
<enum>Qt::Horizontal</enum>
|
||||||
</property>
|
</property>
|
||||||
<property name="sizeType" >
|
<property name="sizeType">
|
||||||
<enum>QSizePolicy::Minimum</enum>
|
<enum>QSizePolicy::Minimum</enum>
|
||||||
</property>
|
</property>
|
||||||
<property name="sizeHint" >
|
<property name="sizeHint" stdset="0">
|
||||||
<size>
|
<size>
|
||||||
<width>16</width>
|
<width>16</width>
|
||||||
<height>27</height>
|
<height>27</height>
|
||||||
|
|
@ -55,62 +54,62 @@
|
||||||
</property>
|
</property>
|
||||||
</spacer>
|
</spacer>
|
||||||
</item>
|
</item>
|
||||||
<item row="0" column="3" colspan="2" >
|
<item row="0" column="3" colspan="2">
|
||||||
<widget class="QLineEdit" name="le_cell_name" >
|
<widget class="QLineEdit" name="le_cell_name">
|
||||||
<property name="enabled" >
|
<property name="enabled">
|
||||||
<bool>false</bool>
|
<bool>false</bool>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="2" column="0" colspan="3" >
|
<item row="2" column="0" colspan="3">
|
||||||
<widget class="QLabel" name="label" >
|
<widget class="QLabel" name="label">
|
||||||
<property name="text" >
|
<property name="text">
|
||||||
<string>Maximum number of instances to show</string>
|
<string>Maximum number of instances to show</string>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="0" column="1" >
|
<item row="0" column="1">
|
||||||
<widget class="QComboBox" name="cbx_context" >
|
<widget class="QComboBox" name="cbx_context">
|
||||||
<item>
|
<item>
|
||||||
<property name="text" >
|
<property name="text">
|
||||||
<string>Show in context of cell ..</string>
|
<string>Show in context of cell ..</string>
|
||||||
</property>
|
</property>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<property name="text" >
|
<property name="text">
|
||||||
<string>Show in context of any top cell</string>
|
<string>Show in context of any top cell</string>
|
||||||
</property>
|
</property>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<property name="text" >
|
<property name="text">
|
||||||
<string>Show in parent cell</string>
|
<string>Show in parent cell</string>
|
||||||
</property>
|
</property>
|
||||||
</item>
|
</item>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="0" column="0" >
|
<item row="0" column="0">
|
||||||
<widget class="QLabel" name="textLabel1" >
|
<widget class="QLabel" name="textLabel1">
|
||||||
<property name="text" >
|
<property name="text">
|
||||||
<string>Context </string>
|
<string>Context </string>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="1" column="0" >
|
<item row="1" column="0">
|
||||||
<widget class="QLabel" name="textLabel1_2" >
|
<widget class="QLabel" name="textLabel1_2">
|
||||||
<property name="text" >
|
<property name="text">
|
||||||
<string>Window</string>
|
<string>Window</string>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="1" column="2" >
|
<item row="1" column="2">
|
||||||
<spacer>
|
<spacer>
|
||||||
<property name="orientation" >
|
<property name="orientation">
|
||||||
<enum>Qt::Horizontal</enum>
|
<enum>Qt::Horizontal</enum>
|
||||||
</property>
|
</property>
|
||||||
<property name="sizeType" >
|
<property name="sizeType">
|
||||||
<enum>QSizePolicy::Minimum</enum>
|
<enum>QSizePolicy::Minimum</enum>
|
||||||
</property>
|
</property>
|
||||||
<property name="sizeHint" >
|
<property name="sizeHint" stdset="0">
|
||||||
<size>
|
<size>
|
||||||
<width>16</width>
|
<width>16</width>
|
||||||
<height>25</height>
|
<height>25</height>
|
||||||
|
|
@ -118,58 +117,55 @@
|
||||||
</property>
|
</property>
|
||||||
</spacer>
|
</spacer>
|
||||||
</item>
|
</item>
|
||||||
<item row="1" column="1" >
|
<item row="1" column="1">
|
||||||
<widget class="QComboBox" name="cbx_window" >
|
<widget class="QComboBox" name="cbx_window">
|
||||||
<item>
|
<item>
|
||||||
<property name="text" >
|
<property name="text">
|
||||||
<string>Don't change</string>
|
<string>Don't change</string>
|
||||||
</property>
|
</property>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<property name="text" >
|
<property name="text">
|
||||||
<string>Fit whole context cell</string>
|
<string>Fit whole context cell</string>
|
||||||
</property>
|
</property>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<property name="text" >
|
<property name="text">
|
||||||
<string>Fit marker with margin ..</string>
|
<string>Fit marker with margin ..</string>
|
||||||
</property>
|
</property>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<property name="text" >
|
<property name="text">
|
||||||
<string>Center marker</string>
|
<string>Center marker</string>
|
||||||
</property>
|
</property>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<property name="text" >
|
<property name="text">
|
||||||
<string>Center marker with size ..</string>
|
<string>Center marker with size ..</string>
|
||||||
</property>
|
</property>
|
||||||
</item>
|
</item>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="1" column="3" >
|
<item row="1" column="3" colspan="2">
|
||||||
<widget class="QLineEdit" name="le_window" >
|
<widget class="lay::MarginWidget" name="mrg_window" native="true"/>
|
||||||
<property name="enabled" >
|
|
||||||
<bool>false</bool>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
</item>
|
||||||
<item row="2" column="3" >
|
<item row="2" column="3" colspan="2">
|
||||||
<widget class="QLineEdit" name="le_max_count" />
|
<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>
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</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/>
|
<resources/>
|
||||||
<connections/>
|
<connections/>
|
||||||
</ui>
|
</ui>
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,8 @@
|
||||||
<ui version="4.0" >
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<ui version="4.0">
|
||||||
<class>BrowseShapesConfigPage</class>
|
<class>BrowseShapesConfigPage</class>
|
||||||
<widget class="QFrame" name="BrowseShapesConfigPage" >
|
<widget class="QFrame" name="BrowseShapesConfigPage">
|
||||||
<property name="geometry" >
|
<property name="geometry">
|
||||||
<rect>
|
<rect>
|
||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>0</y>
|
<y>0</y>
|
||||||
|
|
@ -9,61 +10,44 @@
|
||||||
<height>194</height>
|
<height>194</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
<property name="windowTitle" >
|
<property name="windowTitle">
|
||||||
<string>Browse Shapes</string>
|
<string>Browse Shapes</string>
|
||||||
</property>
|
</property>
|
||||||
<layout class="QVBoxLayout" >
|
<layout class="QVBoxLayout">
|
||||||
<property name="margin" >
|
<property name="spacing">
|
||||||
<number>9</number>
|
|
||||||
</property>
|
|
||||||
<property name="spacing" >
|
|
||||||
<number>6</number>
|
<number>6</number>
|
||||||
</property>
|
</property>
|
||||||
|
<property name="margin" stdset="0">
|
||||||
|
<number>9</number>
|
||||||
|
</property>
|
||||||
<item>
|
<item>
|
||||||
<widget class="QGroupBox" name="groupBox" >
|
<widget class="QGroupBox" name="groupBox">
|
||||||
<property name="title" >
|
<property name="title">
|
||||||
<string>Shape Browser Setup</string>
|
<string>Shape Browser Setup</string>
|
||||||
</property>
|
</property>
|
||||||
<layout class="QGridLayout" >
|
<layout class="QGridLayout">
|
||||||
<property name="margin" >
|
<property name="margin" stdset="0">
|
||||||
<number>9</number>
|
<number>9</number>
|
||||||
</property>
|
</property>
|
||||||
<property name="spacing" >
|
<property name="spacing">
|
||||||
<number>6</number>
|
<number>6</number>
|
||||||
</property>
|
</property>
|
||||||
<item row="1" column="4" >
|
<item row="0" column="3" colspan="2">
|
||||||
<widget class="QLabel" name="textLabel2" >
|
<widget class="QLineEdit" name="le_cell_name">
|
||||||
<property name="text" >
|
<property name="enabled">
|
||||||
<string>µm</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="1" column="3" >
|
|
||||||
<widget class="QLineEdit" name="le_window" >
|
|
||||||
<property name="enabled" >
|
|
||||||
<bool>false</bool>
|
<bool>false</bool>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="0" column="3" colspan="2" >
|
<item row="0" column="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" >
|
|
||||||
<spacer>
|
<spacer>
|
||||||
<property name="orientation" >
|
<property name="orientation">
|
||||||
<enum>Qt::Horizontal</enum>
|
<enum>Qt::Horizontal</enum>
|
||||||
</property>
|
</property>
|
||||||
<property name="sizeType" >
|
<property name="sizeType">
|
||||||
<enum>QSizePolicy::Minimum</enum>
|
<enum>QSizePolicy::Minimum</enum>
|
||||||
</property>
|
</property>
|
||||||
<property name="sizeHint" >
|
<property name="sizeHint" stdset="0">
|
||||||
<size>
|
<size>
|
||||||
<width>10</width>
|
<width>10</width>
|
||||||
<height>21</height>
|
<height>21</height>
|
||||||
|
|
@ -71,15 +55,15 @@
|
||||||
</property>
|
</property>
|
||||||
</spacer>
|
</spacer>
|
||||||
</item>
|
</item>
|
||||||
<item row="1" column="2" >
|
<item row="1" column="2">
|
||||||
<spacer>
|
<spacer>
|
||||||
<property name="orientation" >
|
<property name="orientation">
|
||||||
<enum>Qt::Horizontal</enum>
|
<enum>Qt::Horizontal</enum>
|
||||||
</property>
|
</property>
|
||||||
<property name="sizeType" >
|
<property name="sizeType">
|
||||||
<enum>QSizePolicy::Minimum</enum>
|
<enum>QSizePolicy::Minimum</enum>
|
||||||
</property>
|
</property>
|
||||||
<property name="sizeHint" >
|
<property name="sizeHint" stdset="0">
|
||||||
<size>
|
<size>
|
||||||
<width>10</width>
|
<width>10</width>
|
||||||
<height>20</height>
|
<height>20</height>
|
||||||
|
|
@ -87,91 +71,105 @@
|
||||||
</property>
|
</property>
|
||||||
</spacer>
|
</spacer>
|
||||||
</item>
|
</item>
|
||||||
<item row="0" column="1" >
|
<item row="0" column="1">
|
||||||
<widget class="QComboBox" name="cbx_context" >
|
<widget class="QComboBox" name="cbx_context">
|
||||||
<item>
|
<item>
|
||||||
<property name="text" >
|
<property name="text">
|
||||||
<string>Show in context of cell ..</string>
|
<string>Show in context of cell ..</string>
|
||||||
</property>
|
</property>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<property name="text" >
|
<property name="text">
|
||||||
<string>Show in context of any top cell</string>
|
<string>Show in context of any top cell</string>
|
||||||
</property>
|
</property>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<property name="text" >
|
<property name="text">
|
||||||
<string>Show in context of local cell</string>
|
<string>Show in context of local cell</string>
|
||||||
</property>
|
</property>
|
||||||
</item>
|
</item>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="3" column="3" >
|
<item row="2" column="0" colspan="2">
|
||||||
<widget class="QLineEdit" name="le_max_inst" />
|
<widget class="QLabel" name="label">
|
||||||
</item>
|
<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>
|
<string>Maximum number of shapes to show</string>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="0" column="0" >
|
<item row="0" column="0">
|
||||||
<widget class="QLabel" name="textLabel1" >
|
<widget class="QLabel" name="textLabel1">
|
||||||
<property name="text" >
|
<property name="text">
|
||||||
<string>Context </string>
|
<string>Context </string>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="1" column="1" >
|
<item row="1" column="1">
|
||||||
<widget class="QComboBox" name="cbx_window" >
|
<widget class="QComboBox" name="cbx_window">
|
||||||
<item>
|
<item>
|
||||||
<property name="text" >
|
<property name="text">
|
||||||
<string>Don't change</string>
|
<string>Don't change</string>
|
||||||
</property>
|
</property>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<property name="text" >
|
<property name="text">
|
||||||
<string>Fit context cell</string>
|
<string>Fit context cell</string>
|
||||||
</property>
|
</property>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<property name="text" >
|
<property name="text">
|
||||||
<string>Fit marker with margin ..</string>
|
<string>Fit marker with margin ..</string>
|
||||||
</property>
|
</property>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<property name="text" >
|
<property name="text">
|
||||||
<string>Center marker</string>
|
<string>Center marker</string>
|
||||||
</property>
|
</property>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<property name="text" >
|
<property name="text">
|
||||||
<string>Center marker with size ..</string>
|
<string>Center marker with size ..</string>
|
||||||
</property>
|
</property>
|
||||||
</item>
|
</item>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="3" column="0" colspan="2" >
|
<item row="3" column="0" colspan="2">
|
||||||
<widget class="QLabel" name="label_2" >
|
<widget class="QLabel" name="label_2">
|
||||||
<property name="text" >
|
<property name="text">
|
||||||
<string>Maximum number of instances to show</string>
|
<string>Maximum number of instances to show</string>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="1" column="0" >
|
<item row="1" column="0">
|
||||||
<widget class="QLabel" name="textLabel1_2" >
|
<widget class="QLabel" name="textLabel1_2">
|
||||||
<property name="text" >
|
<property name="text">
|
||||||
<string>Window </string>
|
<string>Window </string>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</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>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</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/>
|
<resources/>
|
||||||
<connections/>
|
<connections/>
|
||||||
</ui>
|
</ui>
|
||||||
|
|
|
||||||
|
|
@ -17,7 +17,7 @@
|
||||||
<property name="spacing">
|
<property name="spacing">
|
||||||
<number>6</number>
|
<number>6</number>
|
||||||
</property>
|
</property>
|
||||||
<property name="margin">
|
<property name="margin" stdset="0">
|
||||||
<number>9</number>
|
<number>9</number>
|
||||||
</property>
|
</property>
|
||||||
<item>
|
<item>
|
||||||
|
|
@ -26,14 +26,15 @@
|
||||||
<string>Marker Browser</string>
|
<string>Marker Browser</string>
|
||||||
</property>
|
</property>
|
||||||
<layout class="QGridLayout">
|
<layout class="QGridLayout">
|
||||||
<property name="margin">
|
|
||||||
<number>9</number>
|
|
||||||
</property>
|
|
||||||
<property name="spacing">
|
<property name="spacing">
|
||||||
<number>6</number>
|
<number>6</number>
|
||||||
</property>
|
</property>
|
||||||
<item row="2" column="3">
|
<item row="2" column="0" colspan="2">
|
||||||
<widget class="QLineEdit" name="le_max_markers"/>
|
<widget class="QLabel" name="label_2">
|
||||||
|
<property name="text">
|
||||||
|
<string>Maximum number of markers to show</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="1" column="2">
|
<item row="1" column="2">
|
||||||
<spacer>
|
<spacer>
|
||||||
|
|
@ -87,7 +88,7 @@
|
||||||
</item>
|
</item>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="0" column="1" colspan="4">
|
<item row="0" column="1" colspan="5">
|
||||||
<widget class="QComboBox" name="cbx_context">
|
<widget class="QComboBox" name="cbx_context">
|
||||||
<item>
|
<item>
|
||||||
<property name="text">
|
<property name="text">
|
||||||
|
|
@ -116,20 +117,6 @@
|
||||||
</item>
|
</item>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="1" column="3">
|
|
||||||
<widget class="QLineEdit" name="le_window">
|
|
||||||
<property name="enabled">
|
|
||||||
<bool>false</bool>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="2" column="0" colspan="2">
|
|
||||||
<widget class="QLabel" name="label_2">
|
|
||||||
<property name="text">
|
|
||||||
<string>Maximum number of markers to show</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="0" column="0">
|
<item row="0" column="0">
|
||||||
<widget class="QLabel" name="textLabel1_3">
|
<widget class="QLabel" name="textLabel1_3">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
|
|
@ -137,12 +124,11 @@
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="1" column="4">
|
<item row="2" column="3" colspan="3">
|
||||||
<widget class="QLabel" name="textLabel2">
|
<widget class="QLineEdit" name="le_max_markers"/>
|
||||||
<property name="text">
|
</item>
|
||||||
<string>µm</string>
|
<item row="1" column="3" colspan="3">
|
||||||
</property>
|
<widget class="lay::MarginWidget" name="mgn_window" native="true"/>
|
||||||
</widget>
|
|
||||||
</item>
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
|
|
@ -150,6 +136,14 @@
|
||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</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/>
|
<resources/>
|
||||||
<connections/>
|
<connections/>
|
||||||
</ui>
|
</ui>
|
||||||
|
|
|
||||||
|
|
@ -200,9 +200,9 @@ BrowseInstancesConfigPage::setup (lay::Dispatcher *root)
|
||||||
cbx_window->setCurrentIndex (int (wmode));
|
cbx_window->setCurrentIndex (int (wmode));
|
||||||
|
|
||||||
// window dimension
|
// window dimension
|
||||||
double wdim = 1.0;
|
std::string wdim_str;
|
||||||
root->config_get (cfg_cib_window_dim, wdim);
|
root->config_get (cfg_cib_window_dim, wdim_str);
|
||||||
le_window->setText (tl::to_qstring (tl::to_string (wdim)));
|
mrg_window->set_margin (lay::Margin::from_string (wdim_str));
|
||||||
|
|
||||||
// max. instance count
|
// max. instance count
|
||||||
unsigned int max_inst_count = 1000;
|
unsigned int max_inst_count = 1000;
|
||||||
|
|
@ -223,22 +223,19 @@ BrowseInstancesConfigPage::context_changed (int m)
|
||||||
void
|
void
|
||||||
BrowseInstancesConfigPage::window_changed (int m)
|
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
|
void
|
||||||
BrowseInstancesConfigPage::commit (lay::Dispatcher *root)
|
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;
|
unsigned int max_inst_count = 1000;
|
||||||
tl::from_string_ext (tl::to_string (le_max_count->text ()), max_inst_count);
|
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_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_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_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);
|
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_ef_enabled (true),
|
||||||
m_mode (AnyTop),
|
m_mode (AnyTop),
|
||||||
m_window (FitMarker),
|
m_window (FitMarker),
|
||||||
m_window_dim (0.0),
|
m_window_dim (),
|
||||||
m_max_inst_count (0),
|
m_max_inst_count (0),
|
||||||
m_current_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) {
|
} else if (name == cfg_cib_window_dim) {
|
||||||
|
|
||||||
double wdim = m_window_dim;
|
lay::Margin wdim = lay::Margin::from_string (value);
|
||||||
tl::from_string (value, wdim);
|
if (wdim != m_window_dim) {
|
||||||
if (fabs (wdim - m_window_dim) > 1e-6) {
|
|
||||||
m_window_dim = wdim;
|
m_window_dim = wdim;
|
||||||
need_update = true;
|
need_update = true;
|
||||||
}
|
}
|
||||||
|
|
@ -787,16 +783,18 @@ BrowseInstancesForm::highlight_current ()
|
||||||
|
|
||||||
if (index_set) {
|
if (index_set) {
|
||||||
|
|
||||||
|
double window_dim = m_window_dim.get (dbox);
|
||||||
|
|
||||||
view ()->select_cell (index, m_cv_index);
|
view ()->select_cell (index, m_cv_index);
|
||||||
if (m_window == FitCell) {
|
if (m_window == FitCell) {
|
||||||
view ()->zoom_fit ();
|
view ()->zoom_fit ();
|
||||||
} else if (m_window == FitMarker) {
|
} 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) {
|
} else if (m_window == Center) {
|
||||||
view ()->pan_center (dbox.p1 () + (dbox.p2 () - dbox.p1 ()) * 0.5);
|
view ()->pan_center (dbox.p1 () + (dbox.p2 () - dbox.p1 ()) * 0.5);
|
||||||
} else if (m_window == CenterSize) {
|
} else if (m_window == CenterSize) {
|
||||||
double w = std::max (dbox.width (), m_window_dim);
|
double w = std::max (dbox.width (), window_dim);
|
||||||
double h = std::max (dbox.height (), m_window_dim);
|
double h = std::max (dbox.height (), window_dim);
|
||||||
db::DPoint center (dbox.p1 () + (dbox.p2 () - dbox.p1 ()) * 0.5);
|
db::DPoint center (dbox.p1 () + (dbox.p2 () - dbox.p1 ()) * 0.5);
|
||||||
db::DVector d (w * 0.5, h * 0.5);
|
db::DVector d (w * 0.5, h * 0.5);
|
||||||
view ()->zoom_box (db::DBox (center - d, center + d));
|
view ()->zoom_box (db::DBox (center - d, center + d));
|
||||||
|
|
|
||||||
|
|
@ -29,6 +29,7 @@
|
||||||
#include "ui_BrowseInstancesConfigPage.h"
|
#include "ui_BrowseInstancesConfigPage.h"
|
||||||
|
|
||||||
#include "layLayoutViewBase.h"
|
#include "layLayoutViewBase.h"
|
||||||
|
#include "layMargin.h"
|
||||||
#include "layPluginConfigPage.h"
|
#include "layPluginConfigPage.h"
|
||||||
#include "layBrowser.h"
|
#include "layBrowser.h"
|
||||||
#include "layMarker.h"
|
#include "layMarker.h"
|
||||||
|
|
@ -98,7 +99,7 @@ private:
|
||||||
mode_type m_mode;
|
mode_type m_mode;
|
||||||
window_type m_window;
|
window_type m_window;
|
||||||
|
|
||||||
double m_window_dim;
|
lay::Margin m_window_dim;
|
||||||
std::string m_context_cell;
|
std::string m_context_cell;
|
||||||
|
|
||||||
unsigned int m_max_inst_count;
|
unsigned int m_max_inst_count;
|
||||||
|
|
|
||||||
|
|
@ -202,9 +202,9 @@ BrowseShapesConfigPage::setup (lay::Dispatcher *root)
|
||||||
cbx_window->setCurrentIndex (int (wmode));
|
cbx_window->setCurrentIndex (int (wmode));
|
||||||
|
|
||||||
// window dimension
|
// window dimension
|
||||||
double wdim = 1.0;
|
std::string wdim_str;
|
||||||
root->config_get (cfg_shb_window_dim, wdim);
|
root->config_get (cfg_shb_window_dim, wdim_str);
|
||||||
le_window->setText (tl::to_qstring (tl::to_string (wdim)));
|
mrg_window->set_margin (lay::Margin::from_string (wdim_str));
|
||||||
|
|
||||||
// max. instance count
|
// max. instance count
|
||||||
unsigned int max_inst_count = 1000;
|
unsigned int max_inst_count = 1000;
|
||||||
|
|
@ -230,15 +230,12 @@ BrowseShapesConfigPage::context_changed (int m)
|
||||||
void
|
void
|
||||||
BrowseShapesConfigPage::window_changed (int m)
|
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
|
void
|
||||||
BrowseShapesConfigPage::commit (lay::Dispatcher *root)
|
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;
|
unsigned int max_inst_count = 1000;
|
||||||
tl::from_string_ext (tl::to_string (le_max_inst->text ()), max_inst_count);
|
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_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_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_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_inst_count, max_inst_count);
|
||||||
root->config_set (cfg_shb_max_shape_count, max_shape_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_ef_enabled (true),
|
||||||
m_mode (AnyTop),
|
m_mode (AnyTop),
|
||||||
m_window (FitMarker),
|
m_window (FitMarker),
|
||||||
m_window_dim (0.0),
|
m_window_dim (),
|
||||||
m_max_inst_count (0),
|
m_max_inst_count (0),
|
||||||
m_max_shape_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) {
|
} else if (name == cfg_shb_window_dim) {
|
||||||
|
|
||||||
double wdim = m_window_dim;
|
lay::Margin wdim = lay::Margin::from_string (value);
|
||||||
tl::from_string (value, wdim);
|
if (wdim != m_window_dim) {
|
||||||
if (fabs (wdim - m_window_dim) > 1e-6) {
|
|
||||||
m_window_dim = wdim;
|
m_window_dim = wdim;
|
||||||
need_update = true;
|
need_update = true;
|
||||||
}
|
}
|
||||||
|
|
@ -961,16 +957,18 @@ BrowseShapesForm::highlight_current ()
|
||||||
|
|
||||||
if (! dbox.empty ()) {
|
if (! dbox.empty ()) {
|
||||||
|
|
||||||
|
double window_dim = m_window_dim.get (dbox);
|
||||||
|
|
||||||
view ()->select_cell (cell_index, m_cv_index);
|
view ()->select_cell (cell_index, m_cv_index);
|
||||||
if (m_window == FitCell) {
|
if (m_window == FitCell) {
|
||||||
view ()->zoom_fit ();
|
view ()->zoom_fit ();
|
||||||
} else if (m_window == FitMarker) {
|
} 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) {
|
} else if (m_window == Center) {
|
||||||
view ()->pan_center (dbox.p1 () + (dbox.p2 () - dbox.p1 ()) * 0.5);
|
view ()->pan_center (dbox.p1 () + (dbox.p2 () - dbox.p1 ()) * 0.5);
|
||||||
} else if (m_window == CenterSize) {
|
} else if (m_window == CenterSize) {
|
||||||
double w = std::max (dbox.width (), m_window_dim);
|
double w = std::max (dbox.width (), window_dim);
|
||||||
double h = std::max (dbox.height (), m_window_dim);
|
double h = std::max (dbox.height (), window_dim);
|
||||||
db::DPoint center (dbox.p1 () + (dbox.p2 () - dbox.p1 ()) * 0.5);
|
db::DPoint center (dbox.p1 () + (dbox.p2 () - dbox.p1 ()) * 0.5);
|
||||||
db::DVector d (w * 0.5, h * 0.5);
|
db::DVector d (w * 0.5, h * 0.5);
|
||||||
view ()->zoom_box (db::DBox (center - d, center + d));
|
view ()->zoom_box (db::DBox (center - d, center + d));
|
||||||
|
|
|
||||||
|
|
@ -29,6 +29,7 @@
|
||||||
#include "ui_BrowseShapesConfigPage.h"
|
#include "ui_BrowseShapesConfigPage.h"
|
||||||
|
|
||||||
#include "layLayoutViewBase.h"
|
#include "layLayoutViewBase.h"
|
||||||
|
#include "layMargin.h"
|
||||||
#include "layPluginConfigPage.h"
|
#include "layPluginConfigPage.h"
|
||||||
#include "layBrowser.h"
|
#include "layBrowser.h"
|
||||||
#include "layMarker.h"
|
#include "layMarker.h"
|
||||||
|
|
@ -99,7 +100,7 @@ private:
|
||||||
mode_type m_mode;
|
mode_type m_mode;
|
||||||
window_type m_window;
|
window_type m_window;
|
||||||
|
|
||||||
double m_window_dim;
|
lay::Margin m_window_dim;
|
||||||
std::string m_context_cell;
|
std::string m_context_cell;
|
||||||
|
|
||||||
unsigned int m_max_inst_count;
|
unsigned int m_max_inst_count;
|
||||||
|
|
|
||||||
|
|
@ -1077,6 +1077,85 @@ ColorButton::browse_selected ()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// -------------------------------------------------------------
|
||||||
|
// MarginWidget implementation
|
||||||
|
|
||||||
|
MarginWidget::MarginWidget (QWidget *parent, const char *name)
|
||||||
|
: QFrame (parent), m_margin ()
|
||||||
|
{
|
||||||
|
if (name) {
|
||||||
|
setObjectName (name);
|
||||||
|
}
|
||||||
|
|
||||||
|
setFrameStyle (QFrame::NoFrame);
|
||||||
|
|
||||||
|
QHBoxLayout *layout = new QHBoxLayout (this);
|
||||||
|
layout->setMargin (0);
|
||||||
|
|
||||||
|
QLineEdit *le = new QLineEdit (this);
|
||||||
|
mp_abs_edit = le;
|
||||||
|
le->setSizePolicy (QSizePolicy (QSizePolicy::Fixed, QSizePolicy::Preferred));
|
||||||
|
layout->addWidget (le);
|
||||||
|
|
||||||
|
le = new QLineEdit (this);
|
||||||
|
mp_rel_edit = le;
|
||||||
|
le->setSizePolicy (QSizePolicy (QSizePolicy::Fixed, QSizePolicy::Preferred));
|
||||||
|
layout->addWidget (le);
|
||||||
|
|
||||||
|
QComboBox *mode = new QComboBox (this);
|
||||||
|
mode->addItem (tl::to_qstring ("µm"));
|
||||||
|
mode->addItem (tl::to_qstring ("%"));
|
||||||
|
mp_mode_cb = mode;
|
||||||
|
layout->addWidget (mode);
|
||||||
|
|
||||||
|
connect (mode, SIGNAL (currentIndexChanged (int)), this, SLOT (mode_selection_changed ()));
|
||||||
|
|
||||||
|
set_margin (lay::Margin ());
|
||||||
|
}
|
||||||
|
|
||||||
|
lay::Margin
|
||||||
|
MarginWidget::get_margin () const
|
||||||
|
{
|
||||||
|
bool rel_mode = mp_mode_cb->currentIndex () == 1;
|
||||||
|
double rel = 0.0, abs = 0.0;
|
||||||
|
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 = m_margin;
|
||||||
|
m.set_relative_mode (rel_mode);
|
||||||
|
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);
|
||||||
|
mode_selection_changed ();
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
MarginWidget::mode_selection_changed ()
|
||||||
|
{
|
||||||
|
bool rel_mode = mp_mode_cb->currentIndex () == 1;
|
||||||
|
// NOTE: first hiding and then showing avoids layout flicker ..
|
||||||
|
mp_rel_edit->hide ();
|
||||||
|
mp_abs_edit->hide ();
|
||||||
|
if (rel_mode) {
|
||||||
|
mp_rel_edit->show ();
|
||||||
|
} else {
|
||||||
|
mp_abs_edit->show ();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// -------------------------------------------------------------
|
// -------------------------------------------------------------
|
||||||
// DecoratedLineEdit implementation
|
// DecoratedLineEdit implementation
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -26,6 +26,7 @@
|
||||||
#define HDR_layWidgets
|
#define HDR_layWidgets
|
||||||
|
|
||||||
#include "layuiCommon.h"
|
#include "layuiCommon.h"
|
||||||
|
#include "layMargin.h"
|
||||||
|
|
||||||
#include "tlObject.h"
|
#include "tlObject.h"
|
||||||
#include "tlDeferredExecution.h"
|
#include "tlDeferredExecution.h"
|
||||||
|
|
@ -316,6 +317,33 @@ private slots:
|
||||||
virtual void selected ();
|
virtual void selected ();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Margin edit box
|
||||||
|
*
|
||||||
|
* This class implements a special widget to edit a lay::Margin object.
|
||||||
|
* This object allows specification of a relative or absolute margin.
|
||||||
|
*/
|
||||||
|
class LAYUI_PUBLIC MarginWidget
|
||||||
|
: public QFrame
|
||||||
|
{
|
||||||
|
Q_OBJECT
|
||||||
|
|
||||||
|
public:
|
||||||
|
MarginWidget (QWidget *parent, const char *name = 0);
|
||||||
|
|
||||||
|
lay::Margin get_margin () const;
|
||||||
|
void set_margin (const lay::Margin &margin);
|
||||||
|
|
||||||
|
protected slots:
|
||||||
|
void mode_selection_changed ();
|
||||||
|
|
||||||
|
private:
|
||||||
|
QLineEdit *mp_abs_edit;
|
||||||
|
QLineEdit *mp_rel_edit;
|
||||||
|
QComboBox *mp_mode_cb;
|
||||||
|
lay::Margin m_margin;
|
||||||
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Color chooser button
|
* @brief Color chooser button
|
||||||
*
|
*
|
||||||
|
|
|
||||||
|
|
@ -28,6 +28,7 @@
|
||||||
#include "layConverters.h"
|
#include "layConverters.h"
|
||||||
#include "layDispatcher.h"
|
#include "layDispatcher.h"
|
||||||
#include "layUtils.h"
|
#include "layUtils.h"
|
||||||
|
#include "layMargin.h"
|
||||||
|
|
||||||
#include "ui_MarkerBrowserConfigPage.h"
|
#include "ui_MarkerBrowserConfigPage.h"
|
||||||
#include "ui_MarkerBrowserConfigPage2.h"
|
#include "ui_MarkerBrowserConfigPage2.h"
|
||||||
|
|
@ -159,9 +160,11 @@ MarkerBrowserConfigPage::setup (lay::Dispatcher *root)
|
||||||
mp_ui->cbx_window->setCurrentIndex (int (wmode));
|
mp_ui->cbx_window->setCurrentIndex (int (wmode));
|
||||||
|
|
||||||
// window dimension
|
// window dimension
|
||||||
double wdim = 1.0;
|
lay::Margin wdim (1.0);
|
||||||
root->config_get (cfg_rdb_window_dim, wdim);
|
std::string wdim_str = wdim.to_string ();
|
||||||
mp_ui->le_window->setText (tl::to_qstring (tl::to_string (wdim)));
|
root->config_get (cfg_rdb_window_dim, wdim_str);
|
||||||
|
wdim = lay::Margin::from_string (wdim_str);
|
||||||
|
mp_ui->mgn_window->set_margin (wdim);
|
||||||
|
|
||||||
// max. marker count
|
// max. marker count
|
||||||
unsigned int max_marker_count = 1000;
|
unsigned int max_marker_count = 1000;
|
||||||
|
|
@ -175,21 +178,18 @@ MarkerBrowserConfigPage::setup (lay::Dispatcher *root)
|
||||||
void
|
void
|
||||||
MarkerBrowserConfigPage::window_changed (int m)
|
MarkerBrowserConfigPage::window_changed (int m)
|
||||||
{
|
{
|
||||||
mp_ui->le_window->setEnabled (m == int (rdb::FitMarker) || m == int (rdb::CenterSize));
|
mp_ui->mgn_window->setEnabled (m == int (rdb::FitMarker) || m == int (rdb::CenterSize));
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
MarkerBrowserConfigPage::commit (lay::Dispatcher *root)
|
MarkerBrowserConfigPage::commit (lay::Dispatcher *root)
|
||||||
{
|
{
|
||||||
double dim = 1.0;
|
|
||||||
tl::from_string_ext (tl::to_string (mp_ui->le_window->text ()), dim);
|
|
||||||
|
|
||||||
unsigned int max_markers_count = 1000;
|
unsigned int max_markers_count = 1000;
|
||||||
tl::from_string_ext (tl::to_string (mp_ui->le_max_markers->text ()), max_markers_count);
|
tl::from_string_ext (tl::to_string (mp_ui->le_max_markers->text ()), max_markers_count);
|
||||||
|
|
||||||
root->config_set (cfg_rdb_context_mode, rdb::context_mode_type (mp_ui->cbx_context->currentIndex ()), MarkerBrowserContextModeConverter ());
|
root->config_set (cfg_rdb_context_mode, rdb::context_mode_type (mp_ui->cbx_context->currentIndex ()), MarkerBrowserContextModeConverter ());
|
||||||
root->config_set (cfg_rdb_window_mode, rdb::window_type (mp_ui->cbx_window->currentIndex ()), MarkerBrowserWindowModeConverter ());
|
root->config_set (cfg_rdb_window_mode, rdb::window_type (mp_ui->cbx_window->currentIndex ()), MarkerBrowserWindowModeConverter ());
|
||||||
root->config_set (cfg_rdb_window_dim, dim);
|
root->config_set (cfg_rdb_window_dim, mp_ui->mgn_window->get_margin ().to_string ());
|
||||||
root->config_set (cfg_rdb_max_marker_count, max_markers_count);
|
root->config_set (cfg_rdb_max_marker_count, max_markers_count);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -470,9 +470,8 @@ MarkerBrowserDialog::configure (const std::string &name, const std::string &valu
|
||||||
|
|
||||||
} else if (name == cfg_rdb_window_dim) {
|
} else if (name == cfg_rdb_window_dim) {
|
||||||
|
|
||||||
double wdim = m_window_dim;
|
lay::Margin wdim = lay::Margin::from_string (value);
|
||||||
tl::from_string (value, wdim);
|
if (wdim != m_window_dim) {
|
||||||
if (fabs (wdim - m_window_dim) > 1e-6) {
|
|
||||||
m_window_dim = wdim;
|
m_window_dim = wdim;
|
||||||
need_update = true;
|
need_update = true;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -27,6 +27,7 @@
|
||||||
|
|
||||||
#include "layuiCommon.h"
|
#include "layuiCommon.h"
|
||||||
#include "layBrowser.h"
|
#include "layBrowser.h"
|
||||||
|
#include "layMargin.h"
|
||||||
#include "tlColor.h"
|
#include "tlColor.h"
|
||||||
#include "rdbMarkerBrowser.h"
|
#include "rdbMarkerBrowser.h"
|
||||||
|
|
||||||
|
|
@ -78,7 +79,7 @@ private:
|
||||||
Ui::MarkerBrowserDialog *mp_ui;
|
Ui::MarkerBrowserDialog *mp_ui;
|
||||||
context_mode_type m_context;
|
context_mode_type m_context;
|
||||||
window_type m_window;
|
window_type m_window;
|
||||||
double m_window_dim;
|
lay::Margin m_window_dim;
|
||||||
unsigned int m_max_marker_count;
|
unsigned int m_max_marker_count;
|
||||||
tl::Color m_marker_color;
|
tl::Color m_marker_color;
|
||||||
int m_marker_line_width;
|
int m_marker_line_width;
|
||||||
|
|
|
||||||
|
|
@ -1838,7 +1838,7 @@ MarkerBrowserPage::marker_double_clicked (const QModelIndex &)
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
MarkerBrowserPage::set_window (rdb::window_type window, double window_dim, rdb::context_mode_type context)
|
MarkerBrowserPage::set_window (rdb::window_type window, const lay::Margin &window_dim, rdb::context_mode_type context)
|
||||||
{
|
{
|
||||||
if (window != m_window || window_dim != m_window_dim || context != m_context) {
|
if (window != m_window || window_dim != m_window_dim || context != m_context) {
|
||||||
m_window = window;
|
m_window = window;
|
||||||
|
|
@ -2280,15 +2280,17 @@ MarkerBrowserPage::do_update_markers ()
|
||||||
|
|
||||||
if (mp_view && ! m_markers_bbox.empty ()) {
|
if (mp_view && ! m_markers_bbox.empty ()) {
|
||||||
|
|
||||||
|
double wdim = m_window_dim.get (m_markers_bbox);
|
||||||
|
|
||||||
if (m_window == FitCell) {
|
if (m_window == FitCell) {
|
||||||
mp_view->zoom_fit ();
|
mp_view->zoom_fit ();
|
||||||
} else if (m_window == FitMarker) {
|
} else if (m_window == FitMarker) {
|
||||||
mp_view->zoom_box (m_markers_bbox.enlarged (db::DVector (m_window_dim, m_window_dim)));
|
mp_view->zoom_box (m_markers_bbox.enlarged (db::DVector (wdim, wdim)));
|
||||||
} else if (m_window == Center) {
|
} else if (m_window == Center) {
|
||||||
mp_view->pan_center (m_markers_bbox.p1 () + (m_markers_bbox.p2 () - m_markers_bbox.p1 ()) * 0.5);
|
mp_view->pan_center (m_markers_bbox.p1 () + (m_markers_bbox.p2 () - m_markers_bbox.p1 ()) * 0.5);
|
||||||
} else if (m_window == CenterSize) {
|
} else if (m_window == CenterSize) {
|
||||||
double w = std::max (m_markers_bbox.width (), m_window_dim);
|
double w = std::max (m_markers_bbox.width (), wdim);
|
||||||
double h = std::max (m_markers_bbox.height (), m_window_dim);
|
double h = std::max (m_markers_bbox.height (), wdim);
|
||||||
db::DPoint center (m_markers_bbox.p1 () + (m_markers_bbox.p2 () - m_markers_bbox.p1 ()) * 0.5);
|
db::DPoint center (m_markers_bbox.p1 () + (m_markers_bbox.p2 () - m_markers_bbox.p1 ()) * 0.5);
|
||||||
db::DVector d (w * 0.5, h * 0.5);
|
db::DVector d (w * 0.5, h * 0.5);
|
||||||
mp_view->zoom_box (db::DBox (center - d, center + d));
|
mp_view->zoom_box (db::DBox (center - d, center + d));
|
||||||
|
|
|
||||||
|
|
@ -27,6 +27,7 @@
|
||||||
|
|
||||||
#include "ui_MarkerBrowserPage.h"
|
#include "ui_MarkerBrowserPage.h"
|
||||||
#include "rdbMarkerBrowser.h"
|
#include "rdbMarkerBrowser.h"
|
||||||
|
#include "layMargin.h"
|
||||||
#include "tlDeferredExecution.h"
|
#include "tlDeferredExecution.h"
|
||||||
#include "tlColor.h"
|
#include "tlColor.h"
|
||||||
#include "dbBox.h"
|
#include "dbBox.h"
|
||||||
|
|
@ -137,7 +138,7 @@ public:
|
||||||
/**
|
/**
|
||||||
* @brief Set the window type and window dimensions
|
* @brief Set the window type and window dimensions
|
||||||
*/
|
*/
|
||||||
void set_window (rdb::window_type window_type, double window_dim, rdb::context_mode_type context);
|
void set_window (rdb::window_type window_type, const lay::Margin &window_dim, rdb::context_mode_type context);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Set the maximum number of markers shown in the marker selection list
|
* @brief Set the maximum number of markers shown in the marker selection list
|
||||||
|
|
@ -212,7 +213,7 @@ private:
|
||||||
bool m_in_directory_selection_change;
|
bool m_in_directory_selection_change;
|
||||||
rdb::context_mode_type m_context;
|
rdb::context_mode_type m_context;
|
||||||
rdb::window_type m_window;
|
rdb::window_type m_window;
|
||||||
double m_window_dim;
|
lay::Margin m_window_dim;
|
||||||
size_t m_max_marker_count;
|
size_t m_max_marker_count;
|
||||||
tl::Color m_marker_color;
|
tl::Color m_marker_color;
|
||||||
int m_marker_line_width;
|
int m_marker_line_width;
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue