mirror of https://github.com/KLayout/klayout.git
parent
54cca8912b
commit
5dce0d8384
|
|
@ -7,7 +7,7 @@
|
|||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>432</width>
|
||||
<height>342</height>
|
||||
<height>349</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
|
|
@ -32,7 +32,7 @@
|
|||
<item>
|
||||
<widget class="QLabel" name="label">
|
||||
<property name="text">
|
||||
<string>Put origin relative to cell's bounding box at ...</string>
|
||||
<string>Place this cell reference point ...</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
|
|
@ -302,6 +302,79 @@
|
|||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QFrame" name="frame_4">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Fixed" vsizetype="Preferred">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="frameShape">
|
||||
<enum>QFrame::NoFrame</enum>
|
||||
</property>
|
||||
<property name="frameShadow">
|
||||
<enum>QFrame::Raised</enum>
|
||||
</property>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||
<property name="leftMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="topMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="rightMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="bottomMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="QLabel" name="label_3">
|
||||
<property name="text">
|
||||
<string>... at x:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLineEdit" name="x_le"/>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="label_4">
|
||||
<property name="text">
|
||||
<string>µm, y:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLineEdit" name="y_le"/>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="label_2">
|
||||
<property name="text">
|
||||
<string>µm</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="verticalSpacer">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
<property name="sizeType">
|
||||
<enum>QSizePolicy::Fixed</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>20</width>
|
||||
<height>5</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QCheckBox" name="vis_only_cbx">
|
||||
<property name="text">
|
||||
|
|
@ -322,7 +395,7 @@
|
|||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
<property name="sizeType">
|
||||
<enum>QSizePolicy::Fixed</enum>
|
||||
<enum>QSizePolicy::Expanding</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
|
|
@ -403,7 +476,10 @@
|
|||
<tabstop>lb</tabstop>
|
||||
<tabstop>cb</tabstop>
|
||||
<tabstop>rb</tabstop>
|
||||
<tabstop>x_le</tabstop>
|
||||
<tabstop>y_le</tabstop>
|
||||
<tabstop>vis_only_cbx</tabstop>
|
||||
<tabstop>adjust_calls_cbx</tabstop>
|
||||
</tabstops>
|
||||
<resources>
|
||||
<include location="../../lay/lay/layResources.qrc"/>
|
||||
|
|
|
|||
|
|
@ -900,33 +900,39 @@ AlignCellOptionsDialog::~AlignCellOptionsDialog ()
|
|||
}
|
||||
|
||||
bool
|
||||
AlignCellOptionsDialog::exec_dialog (int &mode_x, int &mode_y, bool &visible_only, bool &adjust_calls)
|
||||
AlignCellOptionsDialog::exec_dialog (AlignCellOptions &data)
|
||||
{
|
||||
mp_ui->vis_only_cbx->setChecked (visible_only);
|
||||
mp_ui->adjust_calls_cbx->setChecked (adjust_calls);
|
||||
mp_ui->vis_only_cbx->setChecked (data.visible_only);
|
||||
mp_ui->adjust_calls_cbx->setChecked (data.adjust_parents);
|
||||
|
||||
QToolButton *buttons[3][3] = { { mp_ui->lb, mp_ui->cb, mp_ui->rb }, { mp_ui->lc, mp_ui->cc, mp_ui->rc }, { mp_ui->lt, mp_ui->ct, mp_ui->rt } };
|
||||
|
||||
for (int i = 0; i < 3; ++i) {
|
||||
for (int j = 0; j < 3; ++j) {
|
||||
buttons[i][j]->setChecked (j - 1 == mode_x && i - 1 == mode_y);
|
||||
buttons[i][j]->setChecked (j - 1 == data.mode_x && i - 1 == data.mode_y);
|
||||
}
|
||||
}
|
||||
|
||||
mp_ui->x_le->setText (tl::to_qstring (tl::micron_to_string (data.xpos)));
|
||||
mp_ui->y_le->setText (tl::to_qstring (tl::micron_to_string (data.ypos)));
|
||||
|
||||
if (QDialog::exec ()) {
|
||||
|
||||
visible_only = mp_ui->vis_only_cbx->isChecked ();
|
||||
adjust_calls = mp_ui->adjust_calls_cbx->isChecked ();
|
||||
data.visible_only = mp_ui->vis_only_cbx->isChecked ();
|
||||
data.adjust_parents = mp_ui->adjust_calls_cbx->isChecked ();
|
||||
|
||||
for (int i = 0; i < 3; ++i) {
|
||||
for (int j = 0; j < 3; ++j) {
|
||||
if (buttons[i][j]->isChecked ()) {
|
||||
mode_x = j - 1;
|
||||
mode_y = i - 1;
|
||||
data.mode_x = j - 1;
|
||||
data.mode_y = i - 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
tl::from_string (tl::to_string (mp_ui->x_le->text ()), data.xpos);
|
||||
tl::from_string (tl::to_string (mp_ui->y_le->text ()), data.ypos);
|
||||
|
||||
return true;
|
||||
|
||||
} else {
|
||||
|
|
@ -934,7 +940,21 @@ AlignCellOptionsDialog::exec_dialog (int &mode_x, int &mode_y, bool &visible_onl
|
|||
}
|
||||
}
|
||||
|
||||
void
|
||||
void
|
||||
AlignCellOptionsDialog::accept ()
|
||||
{
|
||||
BEGIN_PROTECTED;
|
||||
|
||||
double x = 0.0;
|
||||
tl::from_string (tl::to_string (mp_ui->x_le->text ()), x);
|
||||
tl::from_string (tl::to_string (mp_ui->y_le->text ()), x);
|
||||
|
||||
QDialog::accept ();
|
||||
|
||||
END_PROTECTED;
|
||||
}
|
||||
|
||||
void
|
||||
AlignCellOptionsDialog::button_clicked ()
|
||||
{
|
||||
QToolButton *buttons[3][3] = { { mp_ui->lb, mp_ui->cb, mp_ui->rb }, { mp_ui->lc, mp_ui->cc, mp_ui->rc }, { mp_ui->lt, mp_ui->ct, mp_ui->rt } };
|
||||
|
|
|
|||
|
|
@ -363,6 +363,21 @@ private:
|
|||
lay::LayoutView *mp_view;
|
||||
};
|
||||
|
||||
/**
|
||||
* @brief A data structure holding the options for the "align cell" dialog
|
||||
*/
|
||||
struct LAYBASIC_PUBLIC AlignCellOptions
|
||||
{
|
||||
AlignCellOptions ()
|
||||
: mode_x (-1), mode_y (-1), xpos (0.0), ypos (0.0), visible_only (false), adjust_parents (true)
|
||||
{ }
|
||||
|
||||
int mode_x, mode_y;
|
||||
double xpos, ypos;
|
||||
bool visible_only;
|
||||
bool adjust_parents;
|
||||
};
|
||||
|
||||
/**
|
||||
* @brief The merge operation options
|
||||
*/
|
||||
|
|
@ -375,10 +390,11 @@ public:
|
|||
AlignCellOptionsDialog (QWidget *parent);
|
||||
virtual ~AlignCellOptionsDialog ();
|
||||
|
||||
bool exec_dialog (int &mode_x, int &mode_y, bool &visible_only, bool &adjust_calls);
|
||||
bool exec_dialog (AlignCellOptions &data);
|
||||
|
||||
private slots:
|
||||
void button_clicked ();
|
||||
void accept ();
|
||||
|
||||
private:
|
||||
Ui::AlignCellOptionsDialog *mp_ui;
|
||||
|
|
|
|||
|
|
@ -51,7 +51,6 @@
|
|||
#include "layConverters.h"
|
||||
#include "layGridNet.h"
|
||||
#include "layMove.h"
|
||||
#include "layDialogs.h"
|
||||
#include "layZoomBox.h"
|
||||
#include "layMouseTracker.h"
|
||||
#include "layTipDialog.h"
|
||||
|
|
@ -463,10 +462,6 @@ LayoutView::init (db::Manager *mgr, QWidget * /*parent*/)
|
|||
m_sel_inside_pcells = false;
|
||||
m_move_to_origin_mode_x = 0;
|
||||
m_move_to_origin_mode_y = 0;
|
||||
m_align_cell_origin_mode_x = -1;
|
||||
m_align_cell_origin_mode_y = -1;
|
||||
m_align_cell_origin_visible_layers = false;
|
||||
m_align_cell_adjust_parents = true;
|
||||
m_del_cell_mode = 0;
|
||||
m_layer_hier_mode = 0;
|
||||
m_add_other_layers = false;
|
||||
|
|
@ -5292,7 +5287,7 @@ LayoutView::cm_align_cell_origin ()
|
|||
}
|
||||
|
||||
lay::AlignCellOptionsDialog dialog (this);
|
||||
if (dialog.exec_dialog (m_align_cell_origin_mode_x, m_align_cell_origin_mode_y, m_align_cell_origin_visible_layers, m_align_cell_adjust_parents)) {
|
||||
if (dialog.exec_dialog (m_align_cell_options)) {
|
||||
|
||||
clear_selection ();
|
||||
|
||||
|
|
@ -5300,7 +5295,7 @@ LayoutView::cm_align_cell_origin ()
|
|||
|
||||
db::Box bbox;
|
||||
|
||||
if (m_align_cell_origin_visible_layers) {
|
||||
if (m_align_cell_options.visible_only) {
|
||||
for (lay::LayerPropertiesConstIterator l = begin_layers (); !l.at_end (); ++l) {
|
||||
if (! l->has_children () && l->layer_index () >= 0 && l->cellview_index () == cv_index && l->visible (true /*real*/)) {
|
||||
bbox += cell->bbox (l->layer_index ());
|
||||
|
|
@ -5311,7 +5306,7 @@ LayoutView::cm_align_cell_origin ()
|
|||
}
|
||||
|
||||
db::Coord refx, refy;
|
||||
switch (m_align_cell_origin_mode_x) {
|
||||
switch (m_align_cell_options.mode_x) {
|
||||
case -1:
|
||||
refx = bbox.left ();
|
||||
break;
|
||||
|
|
@ -5322,7 +5317,7 @@ LayoutView::cm_align_cell_origin ()
|
|||
refx = bbox.center ().x ();
|
||||
break;
|
||||
}
|
||||
switch (m_align_cell_origin_mode_y) {
|
||||
switch (m_align_cell_options.mode_y) {
|
||||
case -1:
|
||||
refy = bbox.bottom ();
|
||||
break;
|
||||
|
|
@ -5334,10 +5329,11 @@ LayoutView::cm_align_cell_origin ()
|
|||
break;
|
||||
}
|
||||
|
||||
db::Trans t (db::Vector (-refx, -refy));
|
||||
db::Layout &layout = cellview (cv_index)->layout ();
|
||||
db::Cell &nc_cell = layout.cell (cell->cell_index ());
|
||||
|
||||
db::Trans t (db::Vector (-refx + db::coord_traits<db::Coord>::rounded (m_align_cell_options.xpos / layout.dbu ()), -refy + db::coord_traits<db::Coord>::rounded (m_align_cell_options.ypos / layout.dbu ())));
|
||||
|
||||
for (unsigned int i = 0; i < layout.layers (); ++i) {
|
||||
if (layout.is_valid_layer (i)) {
|
||||
db::Shapes &shapes = nc_cell.shapes (i);
|
||||
|
|
@ -5351,7 +5347,7 @@ LayoutView::cm_align_cell_origin ()
|
|||
nc_cell.transform (*inst, t);
|
||||
}
|
||||
|
||||
if (m_align_cell_adjust_parents) {
|
||||
if (m_align_cell_options.adjust_parents) {
|
||||
|
||||
std::vector<std::pair<db::Cell *, db::Instance> > insts_to_modify;
|
||||
for (db::Cell::parent_inst_iterator pi = nc_cell.begin_parent_insts (); ! pi.at_end (); ++pi) {
|
||||
|
|
|
|||
|
|
@ -50,6 +50,7 @@
|
|||
#include "layPlugin.h"
|
||||
#include "layDisplayState.h"
|
||||
#include "layBookmarkList.h"
|
||||
#include "layDialogs.h"
|
||||
#include "gsi.h"
|
||||
#include "tlException.h"
|
||||
#include "tlEvents.h"
|
||||
|
|
@ -2871,9 +2872,7 @@ private:
|
|||
db::LayerProperties m_new_layer_props;
|
||||
db::DVector m_move_dist;
|
||||
int m_move_to_origin_mode_x, m_move_to_origin_mode_y;
|
||||
int m_align_cell_origin_mode_x, m_align_cell_origin_mode_y;
|
||||
bool m_align_cell_origin_visible_layers;
|
||||
bool m_align_cell_adjust_parents;
|
||||
lay::AlignCellOptions m_align_cell_options;
|
||||
int m_del_cell_mode;
|
||||
int m_layer_hier_mode;
|
||||
int m_duplicate_hier_mode;
|
||||
|
|
|
|||
|
|
@ -21,8 +21,8 @@
|
|||
*/
|
||||
|
||||
|
||||
#ifndef HDR_layDialogs
|
||||
#define HDR_layDialogs
|
||||
#ifndef HDR_layBooleanOperationsDialogs
|
||||
#define HDR_layBooleanOperationsDialogs
|
||||
|
||||
#include "ui_BooleanOptionsDialog.h"
|
||||
#include "ui_SizingOptionsDialog.h"
|
||||
|
|
|
|||
Loading…
Reference in New Issue