WIP: turned ext module into plugins.

This commit is contained in:
Matthias Koefferlein
2018-06-17 09:43:25 +02:00
parent 7e56ce23e5
commit 4097a5b361
71 changed files with 297 additions and 405 deletions
+5
View File
@@ -0,0 +1,5 @@
TEMPLATE = subdirs
SUBDIRS = lay_plugin
@@ -0,0 +1,279 @@
<ui version="4.0" >
<class>BooleanOptionsDialog</class>
<widget class="QDialog" name="BooleanOptionsDialog" >
<property name="geometry" >
<rect>
<x>0</x>
<y>0</y>
<width>535</width>
<height>349</height>
</rect>
</property>
<property name="windowTitle" >
<string>Boolean Operation</string>
</property>
<layout class="QVBoxLayout" >
<property name="margin" >
<number>9</number>
</property>
<property name="spacing" >
<number>6</number>
</property>
<item>
<widget class="QGroupBox" name="groupBox" >
<property name="title" >
<string>Boolean Operation Setup</string>
</property>
<layout class="QGridLayout" >
<property name="margin" >
<number>9</number>
</property>
<property name="spacing" >
<number>6</number>
</property>
<item row="2" column="3" >
<spacer>
<property name="orientation" >
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" >
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item row="3" column="0" colspan="4" >
<widget class="Line" name="line" >
<property name="orientation" >
<enum>Qt::Horizontal</enum>
</property>
</widget>
</item>
<item row="4" column="1" >
<widget class="QComboBox" name="mode_cbx" >
<item>
<property name="text" >
<string>Union (OR)</string>
</property>
</item>
<item>
<property name="text" >
<string>Intersection (AND)</string>
</property>
</item>
<item>
<property name="text" >
<string>Difference (A NOT B)</string>
</property>
</item>
<item>
<property name="text" >
<string>Difference (B NOT A)</string>
</property>
</item>
<item>
<property name="text" >
<string>Symmetric Difference (XOR)</string>
</property>
</item>
</widget>
</item>
<item row="2" column="0" >
<widget class="QLabel" name="label_2" >
<property name="text" >
<string>Source B</string>
</property>
</widget>
</item>
<item row="1" column="0" >
<widget class="QLabel" name="label" >
<property name="text" >
<string>Source A</string>
</property>
</widget>
</item>
<item row="4" column="0" >
<widget class="QLabel" name="label_4" >
<property name="text" >
<string>Mode</string>
</property>
</widget>
</item>
<item row="6" column="0" >
<widget class="QLabel" name="label_3" >
<property name="text" >
<string>Result</string>
</property>
</widget>
</item>
<item row="8" column="0" >
<widget class="QLabel" name="label_7" >
<property name="text" >
<string>Hierarchy</string>
</property>
</widget>
</item>
<item row="7" column="0" colspan="4" >
<widget class="Line" name="line_2" >
<property name="orientation" >
<enum>Qt::Horizontal</enum>
</property>
</widget>
</item>
<item row="0" column="1" >
<widget class="QLabel" name="label_5" >
<property name="text" >
<string>Layout and cell</string>
</property>
</widget>
</item>
<item row="0" column="2" >
<widget class="QLabel" name="label_6" >
<property name="text" >
<string>Layer</string>
</property>
</widget>
</item>
<item row="5" column="2" >
<widget class="QLabel" name="label_8" >
<property name="text" >
<string>Layer</string>
</property>
</widget>
</item>
<item row="5" column="1" >
<widget class="QLabel" name="label_9" >
<property name="text" >
<string>Layout and cell</string>
</property>
</widget>
</item>
<item row="1" column="1" >
<widget class="lay::CellViewSelectionComboBox" name="cva_cbx" />
</item>
<item row="2" column="1" >
<widget class="lay::CellViewSelectionComboBox" name="cvb_cbx" />
</item>
<item row="6" column="1" >
<widget class="lay::CellViewSelectionComboBox" name="cvr_cbx" />
</item>
<item row="1" column="2" >
<widget class="lay::LayerSelectionComboBox" name="layera_cbx" />
</item>
<item row="2" column="2" >
<widget class="lay::LayerSelectionComboBox" name="layerb_cbx" />
</item>
<item row="6" column="2" >
<widget class="lay::LayerSelectionComboBox" name="layerr_cbx" />
</item>
<item row="6" column="3" >
<widget class="QLabel" name="label_10" >
<property name="text" >
<string>(Layer is overwritten)</string>
</property>
</widget>
</item>
<item row="9" column="1" colspan="3" >
<widget class="QCheckBox" name="min_coherence_cb" >
<property name="text" >
<string>Minimum coherence (for touching corners)</string>
</property>
</widget>
</item>
<item row="8" column="1" colspan="3" >
<widget class="QComboBox" name="hier_mode_cbx" >
<item>
<property name="text" >
<string>Flat</string>
</property>
</item>
<item>
<property name="text" >
<string>Top cell only</string>
</property>
</item>
<item>
<property name="text" >
<string>Individually for current and subcells (semi hierarchical)</string>
</property>
</item>
</widget>
</item>
</layout>
</widget>
</item>
<item>
<spacer>
<property name="orientation" >
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" >
<size>
<width>506</width>
<height>51</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QDialogButtonBox" name="buttonBox" >
<property name="orientation" >
<enum>Qt::Horizontal</enum>
</property>
<property name="standardButtons" >
<set>QDialogButtonBox::Cancel|QDialogButtonBox::NoButton|QDialogButtonBox::Ok</set>
</property>
</widget>
</item>
</layout>
</widget>
<customwidgets>
<customwidget>
<class>lay::CellViewSelectionComboBox</class>
<extends>QComboBox</extends>
<header>layWidgets.h</header>
</customwidget>
<customwidget>
<class>lay::LayerSelectionComboBox</class>
<extends>QComboBox</extends>
<header>layWidgets.h</header>
</customwidget>
</customwidgets>
<resources/>
<connections>
<connection>
<sender>buttonBox</sender>
<signal>accepted()</signal>
<receiver>BooleanOptionsDialog</receiver>
<slot>accept()</slot>
<hints>
<hint type="sourcelabel" >
<x>248</x>
<y>254</y>
</hint>
<hint type="destinationlabel" >
<x>157</x>
<y>274</y>
</hint>
</hints>
</connection>
<connection>
<sender>buttonBox</sender>
<signal>rejected()</signal>
<receiver>BooleanOptionsDialog</receiver>
<slot>reject()</slot>
<hints>
<hint type="sourcelabel" >
<x>316</x>
<y>260</y>
</hint>
<hint type="destinationlabel" >
<x>286</x>
<y>274</y>
</hint>
</hints>
</connection>
</connections>
</ui>
@@ -0,0 +1,247 @@
<ui version="4.0" >
<class>MergeOptionsDialog</class>
<widget class="QDialog" name="MergeOptionsDialog" >
<property name="geometry" >
<rect>
<x>0</x>
<y>0</y>
<width>641</width>
<height>331</height>
</rect>
</property>
<property name="windowTitle" >
<string>Merge Operation</string>
</property>
<layout class="QVBoxLayout" >
<property name="spacing" >
<number>6</number>
</property>
<property name="margin" >
<number>9</number>
</property>
<item>
<widget class="QGroupBox" name="groupBox" >
<property name="title" >
<string>Merge Operation Setup</string>
</property>
<layout class="QGridLayout" >
<property name="margin" >
<number>9</number>
</property>
<property name="spacing" >
<number>6</number>
</property>
<item row="7" column="1" colspan="3" >
<widget class="QComboBox" name="hier_mode_cbx" >
<item>
<property name="text" >
<string>Flat</string>
</property>
</item>
<item>
<property name="text" >
<string>Top cell only</string>
</property>
</item>
<item>
<property name="text" >
<string>Individually for current and subcells (semi hierarchical)</string>
</property>
</item>
</widget>
</item>
<item row="5" column="3" >
<widget class="QLabel" name="label_10" >
<property name="text" >
<string>(Layer is overwritten)</string>
</property>
</widget>
</item>
<item row="4" column="2" >
<widget class="QLabel" name="label_8" >
<property name="text" >
<string>Layer</string>
</property>
</widget>
</item>
<item row="5" column="1" >
<widget class="lay::CellViewSelectionComboBox" name="cvr_cbx" />
</item>
<item row="3" column="1" >
<widget class="QLineEdit" name="threshold_le" />
</item>
<item row="6" column="0" colspan="4" >
<widget class="Line" name="line_2" >
<property name="orientation" >
<enum>Qt::Horizontal</enum>
</property>
</widget>
</item>
<item row="7" column="0" >
<widget class="QLabel" name="label_7" >
<property name="text" >
<string>Hierarchy</string>
</property>
</widget>
</item>
<item row="1" column="1" >
<widget class="lay::CellViewSelectionComboBox" name="cv_cbx" />
</item>
<item row="5" column="0" >
<widget class="QLabel" name="label_3" >
<property name="text" >
<string>Result</string>
</property>
</widget>
</item>
<item row="1" column="0" >
<widget class="QLabel" name="label" >
<property name="text" >
<string>Source</string>
</property>
</widget>
</item>
<item row="0" column="2" >
<widget class="QLabel" name="label_6" >
<property name="text" >
<string>Layer</string>
</property>
</widget>
</item>
<item row="2" column="0" colspan="4" >
<widget class="Line" name="line" >
<property name="orientation" >
<enum>Qt::Horizontal</enum>
</property>
</widget>
</item>
<item row="8" column="1" colspan="3" >
<widget class="QCheckBox" name="min_coherence_cb" >
<property name="text" >
<string>Minimum coherence (for touching corners)</string>
</property>
</widget>
</item>
<item row="1" column="3" >
<spacer>
<property name="orientation" >
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0" >
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item row="1" column="2" >
<widget class="lay::LayerSelectionComboBox" name="layer_cbx" />
</item>
<item row="5" column="2" >
<widget class="lay::LayerSelectionComboBox" name="layerr_cbx" />
</item>
<item row="3" column="2" colspan="2" >
<widget class="QLabel" name="label_2" >
<property name="text" >
<string>(0: all polygons, 1: at least two overlapping ...)</string>
</property>
</widget>
</item>
<item row="0" column="1" >
<widget class="QLabel" name="label_5" >
<property name="text" >
<string>Layout and cell</string>
</property>
</widget>
</item>
<item row="4" column="1" >
<widget class="QLabel" name="label_9" >
<property name="text" >
<string>Layout and cell</string>
</property>
</widget>
</item>
<item row="3" column="0" >
<widget class="QLabel" name="label_4" >
<property name="text" >
<string>Overlap threshold</string>
</property>
</widget>
</item>
</layout>
</widget>
</item>
<item>
<spacer>
<property name="orientation" >
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0" >
<size>
<width>506</width>
<height>51</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QDialogButtonBox" name="buttonBox" >
<property name="orientation" >
<enum>Qt::Horizontal</enum>
</property>
<property name="standardButtons" >
<set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
</property>
</widget>
</item>
</layout>
</widget>
<customwidgets>
<customwidget>
<class>lay::CellViewSelectionComboBox</class>
<extends>QComboBox</extends>
<header>layWidgets.h</header>
</customwidget>
<customwidget>
<class>lay::LayerSelectionComboBox</class>
<extends>QComboBox</extends>
<header>layWidgets.h</header>
</customwidget>
</customwidgets>
<resources/>
<connections>
<connection>
<sender>buttonBox</sender>
<signal>accepted()</signal>
<receiver>MergeOptionsDialog</receiver>
<slot>accept()</slot>
<hints>
<hint type="sourcelabel" >
<x>248</x>
<y>254</y>
</hint>
<hint type="destinationlabel" >
<x>157</x>
<y>274</y>
</hint>
</hints>
</connection>
<connection>
<sender>buttonBox</sender>
<signal>rejected()</signal>
<receiver>MergeOptionsDialog</receiver>
<slot>reject()</slot>
<hints>
<hint type="sourcelabel" >
<x>316</x>
<y>260</y>
</hint>
<hint type="destinationlabel" >
<x>286</x>
<y>274</y>
</hint>
</hints>
</connection>
</connections>
</ui>
@@ -0,0 +1,288 @@
<ui version="4.0" >
<class>SizingOptionsDialog</class>
<widget class="QDialog" name="SizingOptionsDialog" >
<property name="geometry" >
<rect>
<x>0</x>
<y>0</y>
<width>567</width>
<height>331</height>
</rect>
</property>
<property name="windowTitle" >
<string>Sizing Operation</string>
</property>
<layout class="QVBoxLayout" >
<property name="margin" >
<number>9</number>
</property>
<property name="spacing" >
<number>6</number>
</property>
<item>
<widget class="QGroupBox" name="groupBox" >
<property name="title" >
<string>Sizing Operation Setup</string>
</property>
<layout class="QGridLayout" >
<property name="margin" >
<number>9</number>
</property>
<property name="spacing" >
<number>6</number>
</property>
<item row="8" column="1" colspan="3" >
<widget class="QComboBox" name="hier_mode_cbx" >
<item>
<property name="text" >
<string>Flat</string>
</property>
</item>
<item>
<property name="text" >
<string>Top cell only</string>
</property>
</item>
<item>
<property name="text" >
<string>Individually for current and subcells (semi hierarchical)</string>
</property>
</item>
</widget>
</item>
<item row="6" column="3" >
<widget class="QLabel" name="label_10" >
<property name="text" >
<string>(Layer is overwritten)</string>
</property>
</widget>
</item>
<item row="5" column="2" >
<widget class="QLabel" name="label_8" >
<property name="text" >
<string>Layer</string>
</property>
</widget>
</item>
<item row="6" column="1" >
<widget class="lay::CellViewSelectionComboBox" name="cvr_cbx" />
</item>
<item row="3" column="1" >
<widget class="QLineEdit" name="value_le" />
</item>
<item row="7" column="0" colspan="4" >
<widget class="Line" name="line_2" >
<property name="orientation" >
<enum>Qt::Horizontal</enum>
</property>
</widget>
</item>
<item row="8" column="0" >
<widget class="QLabel" name="label_7" >
<property name="text" >
<string>Hierarchy</string>
</property>
</widget>
</item>
<item row="1" column="1" >
<widget class="lay::CellViewSelectionComboBox" name="cv_cbx" />
</item>
<item row="6" column="0" >
<widget class="QLabel" name="label_3" >
<property name="text" >
<string>Result</string>
</property>
</widget>
</item>
<item row="1" column="0" >
<widget class="QLabel" name="label" >
<property name="text" >
<string>Source</string>
</property>
</widget>
</item>
<item row="0" column="2" >
<widget class="QLabel" name="label_6" >
<property name="text" >
<string>Layer</string>
</property>
</widget>
</item>
<item row="2" column="0" colspan="4" >
<widget class="Line" name="line" >
<property name="orientation" >
<enum>Qt::Horizontal</enum>
</property>
</widget>
</item>
<item row="9" column="1" colspan="3" >
<widget class="QCheckBox" name="min_coherence_cb" >
<property name="text" >
<string>Minimum coherence (for touching corners)</string>
</property>
</widget>
</item>
<item row="1" column="3" >
<spacer>
<property name="orientation" >
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" >
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item row="1" column="2" >
<widget class="lay::LayerSelectionComboBox" name="layer_cbx" />
</item>
<item row="6" column="2" >
<widget class="lay::LayerSelectionComboBox" name="layerr_cbx" />
</item>
<item row="3" column="2" colspan="2" >
<widget class="QLabel" name="label_2" >
<property name="text" >
<string>Single value or pair (one per direction: sx,sy)</string>
</property>
</widget>
</item>
<item row="0" column="1" >
<widget class="QLabel" name="label_5" >
<property name="text" >
<string>Layout and cell</string>
</property>
</widget>
</item>
<item row="5" column="1" >
<widget class="QLabel" name="label_9" >
<property name="text" >
<string>Layout and cell</string>
</property>
</widget>
</item>
<item row="3" column="0" >
<widget class="QLabel" name="label_4" >
<property name="text" >
<string>Sizing value</string>
</property>
</widget>
</item>
<item row="4" column="0" >
<widget class="QLabel" name="label_11" >
<property name="text" >
<string>Cutoff mode</string>
</property>
</widget>
</item>
<item row="4" column="1" >
<widget class="QComboBox" name="cutoff_cbx" >
<item>
<property name="text" >
<string>Strict (diagonal)</string>
</property>
</item>
<item>
<property name="text" >
<string>Strong (octagon)</string>
</property>
</item>
<item>
<property name="text" >
<string>Moderate (sharp bends only)</string>
</property>
</item>
<item>
<property name="text" >
<string>Weak (sharps bends >135 deg.)</string>
</property>
</item>
<item>
<property name="text" >
<string>Long limit (x10)</string>
</property>
</item>
<item>
<property name="text" >
<string>Extreme limit (x100)</string>
</property>
</item>
</widget>
</item>
</layout>
</widget>
</item>
<item>
<spacer>
<property name="orientation" >
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" >
<size>
<width>506</width>
<height>51</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QDialogButtonBox" name="buttonBox" >
<property name="orientation" >
<enum>Qt::Horizontal</enum>
</property>
<property name="standardButtons" >
<set>QDialogButtonBox::Cancel|QDialogButtonBox::NoButton|QDialogButtonBox::Ok</set>
</property>
</widget>
</item>
</layout>
</widget>
<customwidgets>
<customwidget>
<class>lay::CellViewSelectionComboBox</class>
<extends>QComboBox</extends>
<header>layWidgets.h</header>
</customwidget>
<customwidget>
<class>lay::LayerSelectionComboBox</class>
<extends>QComboBox</extends>
<header>layWidgets.h</header>
</customwidget>
</customwidgets>
<resources/>
<connections>
<connection>
<sender>buttonBox</sender>
<signal>accepted()</signal>
<receiver>SizingOptionsDialog</receiver>
<slot>accept()</slot>
<hints>
<hint type="sourcelabel" >
<x>248</x>
<y>254</y>
</hint>
<hint type="destinationlabel" >
<x>157</x>
<y>274</y>
</hint>
</hints>
</connection>
<connection>
<sender>buttonBox</sender>
<signal>rejected()</signal>
<receiver>SizingOptionsDialog</receiver>
<slot>reject()</slot>
<hints>
<hint type="sourcelabel" >
<x>316</x>
<y>260</y>
</hint>
<hint type="destinationlabel" >
<x>286</x>
<y>274</y>
</hint>
</hints>
</connection>
</connections>
</ui>
@@ -0,0 +1,394 @@
/*
KLayout Layout Viewer
Copyright (C) 2006-2018 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 "layBooleanOperationsDialogs.h"
#include "layLayoutView.h"
#include "tlExceptions.h"
namespace lay
{
// --------------------------------------------------------------------------------
// BooleanOptionsDialog implementation
BooleanOptionsDialog::BooleanOptionsDialog (QWidget *parent)
: QDialog (parent),
mp_view (0)
{
setObjectName (QString::fromUtf8 ("boolean_options_dialog"));
Ui::BooleanOptionsDialog::setupUi (this);
connect (cva_cbx, SIGNAL (activated (int)), this, SLOT (cv_changed (int)));
connect (cvb_cbx, SIGNAL (activated (int)), this, SLOT (cv_changed (int)));
connect (cvr_cbx, SIGNAL (activated (int)), this, SLOT (cv_changed (int)));
}
BooleanOptionsDialog::~BooleanOptionsDialog ()
{
// .. nothing yet ..
}
void
BooleanOptionsDialog::cv_changed (int)
{
if (! mp_view) {
return;
}
layera_cbx->set_view (mp_view, cva_cbx->currentIndex ());
layerb_cbx->set_view (mp_view, cvb_cbx->currentIndex ());
layerr_cbx->set_view (mp_view, cvr_cbx->currentIndex ());
}
bool
BooleanOptionsDialog::exec_dialog (lay::LayoutView *view, int &cv_a, int &layer_a, int &cv_b, int &layer_b, int &cv_r, int &layer_r, int &mode, int &hier_mode, bool &min_coherence)
{
mp_view = view;
bool res = false;
cva_cbx->set_layout_view (view);
cva_cbx->set_current_cv_index (cv_a);
cvb_cbx->set_layout_view (view);
cvb_cbx->set_current_cv_index (cv_b);
cvb_cbx->setEnabled (true);
cvr_cbx->set_layout_view (view);
cvr_cbx->set_current_cv_index (cv_r);
cv_changed (0 /*dummy*/);
layera_cbx->set_current_layer (layer_a);
layerb_cbx->set_current_layer (layer_b);
layerb_cbx->setEnabled (true);
layerr_cbx->set_current_layer (layer_r);
hier_mode_cbx->setCurrentIndex (hier_mode);
mode_cbx->setCurrentIndex (mode);
min_coherence_cb->setChecked (min_coherence);
if (QDialog::exec ()) {
cv_a = cva_cbx->current_cv_index ();
cv_b = cvb_cbx->current_cv_index ();
cv_r = cvr_cbx->current_cv_index ();
layer_a = layera_cbx->current_layer ();
layer_b = layerb_cbx->current_layer ();
layer_r = layerr_cbx->current_layer ();
hier_mode = hier_mode_cbx->currentIndex ();
mode = mode_cbx->currentIndex ();
min_coherence = min_coherence_cb->isChecked ();
res = true;
}
mp_view = 0;
return res;
}
void
BooleanOptionsDialog::accept ()
{
BEGIN_PROTECTED;
int cv_a = cva_cbx->current_cv_index ();
if (cv_a < 0) {
throw tl::Exception (tl::to_string (QObject::tr ("No layout specified for source 'A'")));
}
int cv_b = cvb_cbx->current_cv_index ();
if (cv_b < 0) {
throw tl::Exception (tl::to_string (QObject::tr ("No layout specified for source 'B'")));
}
int cv_r = cvr_cbx->current_cv_index ();
if (cv_r < 0) {
throw tl::Exception (tl::to_string (QObject::tr ("No layout specified for result")));
}
if (fabs (mp_view->cellview (cv_a)->layout ().dbu () - mp_view->cellview (cv_r)->layout ().dbu ()) > db::epsilon ||
fabs (mp_view->cellview (cv_b)->layout ().dbu () - mp_view->cellview (cv_r)->layout ().dbu ()) > db::epsilon) {
throw tl::Exception (tl::to_string (QObject::tr ("All source and result layouts must have the same database unit")));
}
if (layera_cbx->current_layer () < 0) {
throw tl::Exception (tl::to_string (QObject::tr ("No layer specified for source 'A'")));
}
if (layerb_cbx->current_layer () < 0) {
throw tl::Exception (tl::to_string (QObject::tr ("No layer specified for source 'B'")));
}
if (layerr_cbx->current_layer () < 0) {
throw tl::Exception (tl::to_string (QObject::tr ("No layer specified for result layer")));
}
if (hier_mode_cbx->currentIndex () == 2 &&
cva_cbx->current_cv_index () != cvb_cbx->current_cv_index () &&
cva_cbx->current_cv_index () != cvr_cbx->current_cv_index ()) {
throw tl::Exception (tl::to_string (QObject::tr ("All source layouts and result layout must be same in 'cell by cell' mode")));
}
QDialog::accept ();
END_PROTECTED;
}
// --------------------------------------------------------------------------------
// SizingOptionsDialog implementation
SizingOptionsDialog::SizingOptionsDialog (QWidget *parent)
: QDialog (parent),
mp_view (0)
{
setObjectName (QString::fromUtf8 ("sizing_options_dialog"));
Ui::SizingOptionsDialog::setupUi (this);
connect (cv_cbx, SIGNAL (activated (int)), this, SLOT (cv_changed (int)));
connect (cvr_cbx, SIGNAL (activated (int)), this, SLOT (cv_changed (int)));
}
SizingOptionsDialog::~SizingOptionsDialog ()
{
// .. nothing yet ..
}
void
SizingOptionsDialog::cv_changed (int)
{
if (! mp_view) {
return;
}
layer_cbx->set_view (mp_view, cv_cbx->currentIndex ());
layerr_cbx->set_view (mp_view, cvr_cbx->currentIndex ());
}
bool
SizingOptionsDialog::exec_dialog (lay::LayoutView *view, int &cv, int &layer, int &cv_r, int &layer_r, double &dx, double &dy, unsigned int &size_mode, int &hier_mode, bool &min_coherence)
{
mp_view = view;
bool res = false;
cv_cbx->set_layout_view (view);
cv_cbx->set_current_cv_index (cv);
cvr_cbx->set_layout_view (view);
cvr_cbx->set_current_cv_index (cv_r);
cv_changed (0 /*dummy*/);
layer_cbx->set_current_layer (layer);
layerr_cbx->set_current_layer (layer_r);
hier_mode_cbx->setCurrentIndex (hier_mode);
cutoff_cbx->setCurrentIndex (size_mode);
if (dx == dy) {
value_le->setText (tl::to_qstring (tl::sprintf ("%.12g", dx)));
} else {
value_le->setText (tl::to_qstring (tl::sprintf ("%.12g,%.12g", dx, dy)));
}
min_coherence_cb->setChecked (min_coherence);
if (QDialog::exec ()) {
cv = cv_cbx->current_cv_index ();
cv_r = cvr_cbx->current_cv_index ();
layer = layer_cbx->current_layer ();
layer_r = layerr_cbx->current_layer ();
hier_mode = hier_mode_cbx->currentIndex ();
min_coherence = min_coherence_cb->isChecked ();
size_mode = cutoff_cbx->currentIndex ();
tl::string t (tl::to_string (value_le->text ()));
tl::Extractor ex (t.c_str ());
ex.read (dx);
if (ex.test (",")) {
ex.read (dy);
} else {
dy = dx;
}
res = true;
}
mp_view = 0;
return res;
}
void
SizingOptionsDialog::accept ()
{
BEGIN_PROTECTED;
int cv = cv_cbx->current_cv_index ();
if (cv < 0) {
throw tl::Exception (tl::to_string (QObject::tr ("No layout specified for source")));
}
int cv_r = cvr_cbx->current_cv_index ();
if (cv_r < 0) {
throw tl::Exception (tl::to_string (QObject::tr ("No layout specified for result")));
}
if (fabs (mp_view->cellview (cv)->layout ().dbu () - mp_view->cellview (cv_r)->layout ().dbu ()) > db::epsilon) {
throw tl::Exception (tl::to_string (QObject::tr ("Source and result layouts must have the same database unit")));
}
if (layer_cbx->current_layer () < 0) {
throw tl::Exception (tl::to_string (QObject::tr ("No layer specified for source")));
}
if (layerr_cbx->current_layer () < 0) {
throw tl::Exception (tl::to_string (QObject::tr ("No layer specified for result layer")));
}
if (hier_mode_cbx->currentIndex () == 2 &&
cv_cbx->current_cv_index () != cvr_cbx->current_cv_index ()) {
throw tl::Exception (tl::to_string (QObject::tr ("Source layout and result layout must be same in 'cell by cell' mode")));
}
double x, y;
tl::string t (tl::to_string (value_le->text ()));
tl::Extractor ex (t.c_str ());
ex.read (x);
if (ex.test (",")) {
ex.read (y);
}
QDialog::accept ();
END_PROTECTED;
}
// --------------------------------------------------------------------------------
// MergeOptionsDialog implementation
MergeOptionsDialog::MergeOptionsDialog (QWidget *parent)
: QDialog (parent),
mp_view (0)
{
setObjectName (QString::fromUtf8 ("merge_options_dialog"));
Ui::MergeOptionsDialog::setupUi (this);
connect (cv_cbx, SIGNAL (activated (int)), this, SLOT (cv_changed (int)));
connect (cvr_cbx, SIGNAL (activated (int)), this, SLOT (cv_changed (int)));
}
MergeOptionsDialog::~MergeOptionsDialog ()
{
// .. nothing yet ..
}
void
MergeOptionsDialog::cv_changed (int)
{
if (! mp_view) {
return;
}
layer_cbx->set_view (mp_view, cv_cbx->currentIndex ());
layerr_cbx->set_view (mp_view, cvr_cbx->currentIndex ());
}
bool
MergeOptionsDialog::exec_dialog (lay::LayoutView *view, int &cv, int &layer, int &cv_r, int &layer_r, unsigned int &min_wc, int &hier_mode, bool &min_coherence)
{
mp_view = view;
bool res = false;
cv_cbx->set_layout_view (view);
cv_cbx->set_current_cv_index (cv);
cvr_cbx->set_layout_view (view);
cvr_cbx->set_current_cv_index (cv_r);
cv_changed (0 /*dummy*/);
layer_cbx->set_current_layer (layer);
layerr_cbx->set_current_layer (layer_r);
hier_mode_cbx->setCurrentIndex (hier_mode);
threshold_le->setText (tl::to_qstring (tl::sprintf ("%u", min_wc)));
min_coherence_cb->setChecked (min_coherence);
if (QDialog::exec ()) {
cv = cv_cbx->current_cv_index ();
cv_r = cvr_cbx->current_cv_index ();
layer = layer_cbx->current_layer ();
layer_r = layerr_cbx->current_layer ();
hier_mode = hier_mode_cbx->currentIndex ();
min_coherence = min_coherence_cb->isChecked ();
std::string t (tl::to_string (threshold_le->text ()));
tl::Extractor ex (t.c_str ());
ex.read (min_wc);
res = true;
}
mp_view = 0;
return res;
}
void
MergeOptionsDialog::accept ()
{
BEGIN_PROTECTED;
int cv = cv_cbx->current_cv_index ();
if (cv < 0) {
throw tl::Exception (tl::to_string (QObject::tr ("No layout specified for source")));
}
int cv_r = cvr_cbx->current_cv_index ();
if (cv_r < 0) {
throw tl::Exception (tl::to_string (QObject::tr ("No layout specified for result")));
}
if (fabs (mp_view->cellview (cv)->layout ().dbu () - mp_view->cellview (cv_r)->layout ().dbu ()) > db::epsilon) {
throw tl::Exception (tl::to_string (QObject::tr ("Source and result layouts must have the same database unit")));
}
if (layer_cbx->current_layer () < 0) {
throw tl::Exception (tl::to_string (QObject::tr ("No layer specified for source")));
}
if (layerr_cbx->current_layer () < 0) {
throw tl::Exception (tl::to_string (QObject::tr ("No layer specified for result")));
}
if (hier_mode_cbx->currentIndex () == 2 &&
cv_cbx->current_cv_index () != cvr_cbx->current_cv_index ()) {
throw tl::Exception (tl::to_string (QObject::tr ("Source layout and result layout must be same in 'cell by cell' mode")));
}
unsigned int min_wc = 0;
std::string t (tl::to_string (threshold_le->text ()));
tl::Extractor ex (t.c_str ());
ex.read (min_wc);
QDialog::accept ();
END_PROTECTED;
}
}
@@ -0,0 +1,119 @@
/*
KLayout Layout Viewer
Copyright (C) 2006-2018 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_layDialogs
#define HDR_layDialogs
#include "ui_BooleanOptionsDialog.h"
#include "ui_SizingOptionsDialog.h"
#include "ui_MergeOptionsDialog.h"
namespace db
{
class Layout;
}
namespace lay
{
class CellView;
class LayoutView;
/**
* @brief The boolean operation options
*/
class BooleanOptionsDialog
: public QDialog,
public Ui::BooleanOptionsDialog
{
Q_OBJECT
public:
BooleanOptionsDialog (QWidget *parent);
virtual ~BooleanOptionsDialog ();
bool exec_dialog (lay::LayoutView *view, int &cv_a, int &layer_a, int &cv_b, int &layer_b, int &cv_res, int &layer_res, int &mode, int &hier_mode, bool &min_coherence);
public slots:
void cv_changed (int);
private:
virtual void accept ();
lay::LayoutView *mp_view;
};
/**
* @brief The sizing operation options
*/
class SizingOptionsDialog
: public QDialog,
public Ui::SizingOptionsDialog
{
Q_OBJECT
public:
SizingOptionsDialog (QWidget *parent);
virtual ~SizingOptionsDialog ();
bool exec_dialog (lay::LayoutView *view, int &cv, int &layer, int &cv_res, int &layer_res, double &dx, double &dy, unsigned int &size_mode, int &hier_mode, bool &min_coherence);
public slots:
void cv_changed (int);
private:
virtual void accept ();
lay::LayoutView *mp_view;
};
/**
* @brief The merge operation options
*/
class MergeOptionsDialog
: public QDialog,
public Ui::MergeOptionsDialog
{
Q_OBJECT
public:
MergeOptionsDialog (QWidget *parent);
virtual ~MergeOptionsDialog ();
bool exec_dialog (lay::LayoutView *view, int &cv, int &layer, int &cv_res, int &layer_res, unsigned int &min_wc, int &hier_mode, bool &min_coherence);
public slots:
void cv_changed (int);
private:
virtual void accept ();
lay::LayoutView *mp_view;
};
}
#endif
@@ -0,0 +1,506 @@
/*
KLayout Layout Viewer
Copyright (C) 2006-2018 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 "layBooleanOperationsDialogs.h"
#include "layPlugin.h"
#include "layTipDialog.h"
#include "layLayoutView.h"
#include "dbShapeProcessor.h"
#include <QApplication>
namespace lay
{
class BooleanOperationsPlugin
: public lay::Plugin
{
public:
BooleanOperationsPlugin (Plugin *parent, lay::LayoutView *view)
: lay::Plugin (parent), mp_view (view)
{
m_boolean_cva = -1;
m_boolean_cvb = -1;
m_boolean_cvr = -1;
m_boolean_layera = -1;
m_boolean_layerb = -1;
m_boolean_layerr = -1;
m_boolean_hier_mode = 0;
m_boolean_mode = 0;
m_boolean_mincoh = true;
m_boolean_minwc = 0;
m_boolean_sizex = m_boolean_sizey = 0.0;
m_boolean_size_mode = 2;
}
~BooleanOperationsPlugin ()
{
// ...
}
void menu_activated (const std::string &symbol)
{
if (symbol == "lay::boolean") {
boolean ();
} else if (symbol == "lay::merge") {
merge ();
} else if (symbol == "lay::size") {
size ();
}
}
void boolean ()
{
struct { int *cv; int *layer; } specs [] = {
{ &m_boolean_cva, &m_boolean_layera },
{ &m_boolean_cvb, &m_boolean_layerb },
{ &m_boolean_cvr, &m_boolean_layerr }
};
for (unsigned int i = 0; i < sizeof (specs) / sizeof (specs[0]); ++i) {
int &cv = *(specs[i].cv);
int &layer = *(specs[i].layer);
if (cv >= int (mp_view->cellviews ())) {
cv = -1;
}
int index = mp_view->active_cellview_index ();
if (cv < 0) {
cv = index;
}
if (cv < 0 || ! mp_view->cellview (cv)->layout ().is_valid_layer ((unsigned int) layer)) {
layer = -1;
}
}
lay::BooleanOptionsDialog dialog (mp_view);
if (dialog.exec_dialog (mp_view, m_boolean_cva, m_boolean_layera, m_boolean_cvb, m_boolean_layerb, m_boolean_cvr, m_boolean_layerr, m_boolean_mode, m_boolean_hier_mode, m_boolean_mincoh)) {
mp_view->cancel ();
bool supports_undo = true;
if (db::transactions_enabled ()) {
lay::TipDialog td (QApplication::activeWindow (),
tl::to_string (QObject::tr ("Undo buffering for the following operation can be memory and time consuming.\nChoose \"Yes\" to use undo buffering or \"No\" for no undo buffering. Warning: in the latter case, the undo history will be lost.\n\nChoose undo buffering?")),
"boolean-undo-buffering",
lay::TipDialog::yesnocancel_buttons);
lay::TipDialog::button_type button = lay::TipDialog::null_button;
td.exec_dialog (button);
if (button == lay::TipDialog::cancel_button) {
return;
}
supports_undo = (button == lay::TipDialog::yes_button);
} else {
supports_undo = false;
}
if (mp_view->manager ()) {
if (! supports_undo) {
mp_view->manager ()->clear ();
} else {
mp_view->manager ()->transaction (tl::to_string (QObject::tr ("Boolean operation")));
}
}
try {
db::BooleanOp::BoolOp op_mode;
switch (m_boolean_mode) {
default:
op_mode = db::BooleanOp::Or;
break;
case 1:
op_mode = db::BooleanOp::And;
break;
case 2:
op_mode = db::BooleanOp::ANotB;
break;
case 3:
op_mode = db::BooleanOp::BNotA;
break;
case 4:
op_mode = db::BooleanOp::Xor;
break;
}
if (m_boolean_hier_mode == 0) {
// flat mode
db::ShapeProcessor p (true);
p.boolean (mp_view->cellview (m_boolean_cva)->layout (), *mp_view->cellview (m_boolean_cva).cell (), m_boolean_layera,
mp_view->cellview (m_boolean_cvb)->layout (), *mp_view->cellview (m_boolean_cvb).cell (), m_boolean_layerb,
mp_view->cellview (m_boolean_cvr).cell ()->shapes (m_boolean_layerr), op_mode, true, true, m_boolean_mincoh);
// clear the result layer for all called cells in flat mode
std::set<db::cell_index_type> called_cells;
mp_view->cellview (m_boolean_cvr).cell ()->collect_called_cells (called_cells);
for (std::set<db::cell_index_type>::const_iterator c = called_cells.begin (); c != called_cells.end (); ++c) {
mp_view->cellview (m_boolean_cvr)->layout ().cell (*c).shapes (m_boolean_layerr).clear ();
}
} else if (m_boolean_hier_mode == 1) {
// top cell only mode
db::ShapeProcessor p (true);
p.boolean (mp_view->cellview (m_boolean_cva)->layout (), *mp_view->cellview (m_boolean_cva).cell (), m_boolean_layera,
mp_view->cellview (m_boolean_cvb)->layout (), *mp_view->cellview (m_boolean_cvb).cell (), m_boolean_layerb,
mp_view->cellview (m_boolean_cvr).cell ()->shapes (m_boolean_layerr), op_mode, false, true, m_boolean_mincoh);
} else if (m_boolean_hier_mode == 2) {
// subcells cell by cell
std::set<db::cell_index_type> called_cells;
mp_view->cellview (m_boolean_cva).cell ()->collect_called_cells (called_cells);
called_cells.insert (mp_view->cellview (m_boolean_cva).cell_index ());
db::ShapeProcessor p (true);
db::Layout &layout = mp_view->cellview (m_boolean_cva)->layout ();
for (std::set<db::cell_index_type>::const_iterator c = called_cells.begin (); c != called_cells.end (); ++c) {
db::Cell &cell = layout.cell (*c);
p.boolean (layout, cell, m_boolean_layera,
layout, cell, m_boolean_layerb,
cell.shapes (m_boolean_layerr), op_mode, false, true, m_boolean_mincoh);
}
}
if (supports_undo && mp_view->manager ()) {
mp_view->manager ()->commit ();
}
} catch (...) {
if (supports_undo && mp_view->manager ()) {
mp_view->manager ()->commit ();
}
throw;
}
}
}
void merge ()
{
struct { int *cv; int *layer; } specs [] = {
{ &m_boolean_cva, &m_boolean_layera },
{ &m_boolean_cvr, &m_boolean_layerr }
};
for (unsigned int i = 0; i < sizeof (specs) / sizeof (specs[0]); ++i) {
int &cv = *(specs[i].cv);
int &layer = *(specs[i].layer);
if (cv >= int (mp_view->cellviews ())) {
cv = -1;
}
int index = mp_view->active_cellview_index ();
if (cv < 0) {
cv = index;
}
if (cv < 0 || ! mp_view->cellview (cv)->layout ().is_valid_layer ((unsigned int) layer)) {
layer = -1;
}
}
lay::MergeOptionsDialog dialog (mp_view);
if (dialog.exec_dialog (mp_view, m_boolean_cva, m_boolean_layera, m_boolean_cvr, m_boolean_layerr, m_boolean_minwc, m_boolean_hier_mode, m_boolean_mincoh)) {
mp_view->cancel ();
bool supports_undo = true;
if (db::transactions_enabled ()) {
lay::TipDialog td (QApplication::activeWindow (),
tl::to_string (QObject::tr ("Undo buffering for the following operation can be memory and time consuming.\nChoose \"Yes\" to use undo buffering or \"No\" for no undo buffering. Warning: in the latter case, the undo history will be lost.\n\nChoose undo buffering?")),
"merge-undo-buffering",
lay::TipDialog::yesnocancel_buttons);
lay::TipDialog::button_type button = lay::TipDialog::null_button;
td.exec_dialog (button);
if (button == lay::TipDialog::cancel_button) {
return;
}
supports_undo = (button == lay::TipDialog::yes_button);
} else {
supports_undo = false;
}
if (mp_view->manager ()) {
if (! supports_undo) {
mp_view->manager ()->clear ();
} else {
mp_view->manager ()->transaction (tl::to_string (QObject::tr ("Merge operation")));
}
}
try {
if (m_boolean_hier_mode == 0) {
// flat mode
db::ShapeProcessor p (true);
p.merge (mp_view->cellview (m_boolean_cva)->layout (), *mp_view->cellview (m_boolean_cva).cell (), m_boolean_layera,
mp_view->cellview (m_boolean_cvr).cell ()->shapes (m_boolean_layerr), true, m_boolean_minwc, true, m_boolean_mincoh);
// clear the result layer for all called cells in flat mode
std::set<db::cell_index_type> called_cells;
mp_view->cellview (m_boolean_cvr).cell ()->collect_called_cells (called_cells);
for (std::set<db::cell_index_type>::const_iterator c = called_cells.begin (); c != called_cells.end (); ++c) {
mp_view->cellview (m_boolean_cvr)->layout ().cell (*c).shapes (m_boolean_layerr).clear ();
}
} else if (m_boolean_hier_mode == 1) {
// top cell only mode
db::ShapeProcessor p (true);
p.merge (mp_view->cellview (m_boolean_cva)->layout (), *mp_view->cellview (m_boolean_cva).cell (), m_boolean_layera,
mp_view->cellview (m_boolean_cvr).cell ()->shapes (m_boolean_layerr), false, m_boolean_minwc, true, m_boolean_mincoh);
} else if (m_boolean_hier_mode == 2) {
// subcells cell by cell
std::set<db::cell_index_type> called_cells;
mp_view->cellview (m_boolean_cva).cell ()->collect_called_cells (called_cells);
called_cells.insert (mp_view->cellview (m_boolean_cva).cell_index ());
db::ShapeProcessor p (true);
db::Layout &layout = mp_view->cellview (m_boolean_cva)->layout ();
for (std::set<db::cell_index_type>::const_iterator c = called_cells.begin (); c != called_cells.end (); ++c) {
db::Cell &cell = layout.cell (*c);
p.merge (layout, cell, m_boolean_layera,
cell.shapes (m_boolean_layerr), false, m_boolean_minwc, true, m_boolean_mincoh);
}
}
if (supports_undo && mp_view->manager ()) {
mp_view->manager ()->commit ();
}
} catch (...) {
if (supports_undo && mp_view->manager ()) {
mp_view->manager ()->commit ();
}
throw;
}
}
}
void size ()
{
struct { int *cv; int *layer; } specs [] = {
{ &m_boolean_cva, &m_boolean_layera },
{ &m_boolean_cvr, &m_boolean_layerr }
};
for (unsigned int i = 0; i < sizeof (specs) / sizeof (specs[0]); ++i) {
int &cv = *(specs[i].cv);
int &layer = *(specs[i].layer);
if (cv >= int (mp_view->cellviews ())) {
cv = -1;
}
int index = mp_view->active_cellview_index ();
if (cv < 0) {
cv = index;
}
if (cv < 0 || ! mp_view->cellview (cv)->layout ().is_valid_layer ((unsigned int) layer)) {
layer = -1;
}
}
lay::SizingOptionsDialog dialog (mp_view);
if (dialog.exec_dialog (mp_view, m_boolean_cva, m_boolean_layera, m_boolean_cvr, m_boolean_layerr, m_boolean_sizex, m_boolean_sizey, m_boolean_size_mode, m_boolean_hier_mode, m_boolean_mincoh)) {
mp_view->cancel ();
bool supports_undo = true;
if (db::transactions_enabled ()) {
lay::TipDialog td (QApplication::activeWindow (),
tl::to_string (QObject::tr ("Undo buffering for the following operation can be memory and time consuming.\nChoose \"Yes\" to use undo buffering or \"No\" for no undo buffering. Warning: in the latter case, the undo history will be lost.\n\nChoose undo buffering?")),
"size-undo-buffering",
lay::TipDialog::yesnocancel_buttons);
lay::TipDialog::button_type button = lay::TipDialog::null_button;
td.exec_dialog (button);
if (button == lay::TipDialog::cancel_button) {
return;
}
supports_undo = (button == lay::TipDialog::yes_button);
} else {
supports_undo = false;
}
db::Coord dx_int, dy_int;
dx_int = db::coord_traits<db::Coord>::rounded (m_boolean_sizex / mp_view->cellview (m_boolean_cva)->layout ().dbu ());
dy_int = db::coord_traits<db::Coord>::rounded (m_boolean_sizey / mp_view->cellview (m_boolean_cva)->layout ().dbu ());
if (mp_view->manager ()) {
if (! supports_undo) {
mp_view->manager ()->clear ();
} else {
mp_view->manager ()->transaction (tl::to_string (QObject::tr ("Sizing operation")));
}
}
try {
if (m_boolean_hier_mode == 0) {
// flat mode
db::ShapeProcessor p (true);
p.size (mp_view->cellview (m_boolean_cva)->layout (), *mp_view->cellview (m_boolean_cva).cell (), m_boolean_layera,
mp_view->cellview (m_boolean_cvr).cell ()->shapes (m_boolean_layerr), dx_int, dy_int, m_boolean_size_mode, true, true, m_boolean_mincoh);
// clear the result layer for all called cells in flat mode
std::set<db::cell_index_type> called_cells;
mp_view->cellview (m_boolean_cvr).cell ()->collect_called_cells (called_cells);
for (std::set<db::cell_index_type>::const_iterator c = called_cells.begin (); c != called_cells.end (); ++c) {
mp_view->cellview (m_boolean_cvr)->layout ().cell (*c).shapes (m_boolean_layerr).clear ();
}
} else if (m_boolean_hier_mode == 1) {
// top cell only mode
db::ShapeProcessor p (true);
p.size (mp_view->cellview (m_boolean_cva)->layout (), *mp_view->cellview (m_boolean_cva).cell (), m_boolean_layera,
mp_view->cellview (m_boolean_cvr).cell ()->shapes (m_boolean_layerr), dx_int, dy_int, m_boolean_size_mode, false, true, m_boolean_mincoh);
} else if (m_boolean_hier_mode == 2) {
// subcells cell by cell
std::set<db::cell_index_type> called_cells;
mp_view->cellview (m_boolean_cva).cell ()->collect_called_cells (called_cells);
called_cells.insert (mp_view->cellview (m_boolean_cva).cell_index ());
db::ShapeProcessor p (true);
db::Layout &layout = mp_view->cellview (m_boolean_cva)->layout ();
for (std::set<db::cell_index_type>::const_iterator c = called_cells.begin (); c != called_cells.end (); ++c) {
db::Cell &cell = layout.cell (*c);
p.size (layout, cell, m_boolean_layera,
cell.shapes (m_boolean_layerr), dx_int, dy_int, m_boolean_size_mode, false, true, m_boolean_mincoh);
}
}
if (supports_undo && mp_view->manager ()) {
mp_view->manager ()->commit ();
}
} catch (...) {
if (supports_undo && mp_view->manager ()) {
mp_view->manager ()->commit ();
}
throw;
}
}
}
private:
lay::LayoutView *mp_view;
int m_boolean_cva, m_boolean_cvb, m_boolean_cvr;
int m_boolean_layera, m_boolean_layerb, m_boolean_layerr;
int m_boolean_hier_mode, m_boolean_mode;
bool m_boolean_mincoh;
unsigned int m_boolean_minwc;
double m_boolean_sizex, m_boolean_sizey;
unsigned int m_boolean_size_mode;
};
class BooleanOperationsPluginDeclaration
: public lay::PluginDeclaration
{
public:
BooleanOperationsPluginDeclaration ()
{
// .. nothing yet ..
}
virtual void get_options (std::vector < std::pair<std::string, std::string> > & /*options*/) const
{
// .. nothing yet ..
}
virtual lay::ConfigPage *config_page (QWidget * /*parent*/, std::string & /*title*/) const
{
// .. nothing yet ..
return 0;
}
virtual void get_menu_entries (std::vector<lay::MenuEntry> &menu_entries) const
{
lay::PluginDeclaration::get_menu_entries (menu_entries);
menu_entries.push_back (lay::MenuEntry ("ops_group", "edit_menu.layer_menu.end"));
menu_entries.push_back (lay::MenuEntry ("lay::boolean", "boolean:edit:edit_mode", "edit_menu.layer_menu.end", tl::to_string (QObject::tr ("Boolean Operations"))));
menu_entries.push_back (lay::MenuEntry ("lay::merge", "merge:edit:edit_mode", "edit_menu.layer_menu.end", tl::to_string (QObject::tr ("Merge"))));
menu_entries.push_back (lay::MenuEntry ("lay::size", "size:edit:edit_mode", "edit_menu.layer_menu.end", tl::to_string (QObject::tr ("Size"))));
}
virtual bool configure (const std::string & /*name*/, const std::string & /*value*/)
{
return false;
}
virtual void config_finalize ()
{
// .. nothing yet ..
}
lay::Plugin *create_plugin (db::Manager *, lay::PluginRoot *root, lay::LayoutView *view) const
{
return new BooleanOperationsPlugin (root, view);
}
};
static tl::RegisteredClass<lay::PluginDeclaration> config_decl (new lay::BooleanOperationsPluginDeclaration (), 3010, "lay::BooleanOperationsPlugin");
}
@@ -0,0 +1,17 @@
TARGET = bool
DESTDIR = $$OUT_PWD/../../../../lay_plugins
include($$PWD/../../../lay_plugin.pri)
HEADERS = \
layBooleanOperationsDialogs.h
SOURCES = \
layBooleanOperationsDialogs.cc \
layBooleanOperationsPlugin.cc
FORMS = \
BooleanOptionsDialog.ui \
SizingOptionsDialog.ui \
MergeOptionsDialog.ui \