diff --git a/src/edt/edt/EditorOptionsGeneric.ui b/src/edt/edt/EditorOptionsGeneric.ui
index 36c1aadd0..66b4ca306 100644
--- a/src/edt/edt/EditorOptionsGeneric.ui
+++ b/src/edt/edt/EditorOptionsGeneric.ui
@@ -6,10 +6,16 @@
0
0
- 500
- 417
+ 400
+ 446
+
+
+ 0
+ 0
+
+
Form
@@ -18,390 +24,440 @@
6
- 9
+ 0
- 9
+ 0
- 9
+ 0
- 9
+ 0
-
-
-
- Snapping
+
+
+ QFrame::NoFrame
-
-
- 9
+
+ QFrame::Plain
+
+
+ true
+
+
+
+
+ 0
+ 0
+ 400
+ 446
+
-
- 9
-
-
- 9
-
-
- 9
-
-
- 6
-
-
-
-
-
- Qt::Horizontal
-
-
-
- 148
- 16
-
-
-
-
- -
-
-
- Qt::Horizontal
-
-
- QSizePolicy::Fixed
-
-
-
- 16
- 20
-
-
-
-
- -
-
-
-
- 0
- 0
-
-
-
- Enter the grid in micron. Can be anisotropic ("gx,gy")
-
-
-
- -
-
-
- Grid
-
-
-
- -
-
-
- Objects
-
-
-
- -
-
-
-
-
- No grid
+
+
+ 2
+
+
+ 4
+
+
+ 4
+
+
+ 4
+
+
+ 4
+
+
-
+
+
+ Snapping
-
- -
-
- Global grid
+
+
+ 4
+
+
+ 4
+
+
+ 4
+
+
+ 4
+
+
+ 6
+
+
+ 2
+
+
-
+
+
+ Grid
+
+
+
+ -
+
+
+
+ 1
+ 0
+
+
+
+ QComboBox::AdjustToContents
+
+
-
+
+ No grid
+
+
+ -
+
+ Global grid
+
+
+ -
+
+ Other grid ...
+
+
+
+
+ -
+
+
+ Snap to other objects
+
+
+
+ -
+
+
+ Objects
+
+
+
+ -
+
+
+ Qt::Horizontal
+
+
+
+ 148
+ 16
+
+
+
+
+ -
+
+
+
+ 0
+ 0
+
+
+
+ Enter the grid in micron. Can be anisotropic ("gx,gy")
+
+
+
+
+
+
+ -
+
+
+ Angle Constraints
-
- -
-
- Other grid ...
+
+
+ 4
+
+
+ 4
+
+
+ 4
+
+
+ 4
+
+
+ 6
+
+
+ 2
+
+
-
+
+
+ Movements
+
+
+
+ -
+
+
+ Connections
+
+
+
+ -
+
+
+
+ 1
+ 0
+
+
+
+ QComboBox::AdjustToContents
+
+
-
+
+ Any Angle
+
+
+ -
+
+ Diagonal
+
+
+ -
+
+ Manhattan
+
+
+
+
+ -
+
+
+
+ 1
+ 0
+
+
+
+ QComboBox::AdjustToContents
+
+
-
+
+ Any Direction
+
+
+ -
+
+ Diagonal
+
+
+ -
+
+ Manhattan
+
+
+
+
+ -
+
+
+ Qt::Horizontal
+
+
+
+ 257
+ 10
+
+
+
+
+
+
+
+ -
+
+
+ Hierarchical Features
-
-
-
- -
-
-
- Snap to other objects
-
-
-
-
+
+
+ 4
+
+
+ 4
+
+
+ 4
+
+
+ 4
+
+
+ 6
+
+
+ 2
+
+ -
+
+
+ Copy mode
+
+
+
+ -
+
+
+ Shallow select
+
+
+
+ -
+
+
+
+ 1
+ 0
+
+
+
+ QComboBox::AdjustToContents
+
+
-
+
+ Shallow mode (instance only)
+
+
+ -
+
+ Deep mode (instance and cell)
+
+
+ -
+
+ Ask
+
+
+
+
+ -
+
+
+ Qt::Horizontal
+
+
+
+ 40
+ 20
+
+
+
+
+ -
+
+
+
+ 0
+ 0
+
+
+
+ Select top level objects only
+
+
+
+
+
+
+ -
+
+
+ Instance Display
+
+
+
+ 2
+
+
+ 4
+
+
+ 4
+
+
+ 4
+
+
+ 4
+
+
-
+
+
+ Show shapes while moving (max.
+
+
+
+ -
+
+
+
+ 0
+ 0
+
+
+
+
+ -
+
+
+ shapes)
+
+
+
+ -
+
+
+ Qt::Horizontal
+
+
+
+ 20
+ 20
+
+
+
+
+
+
+
+ -
+
+
+ Qt::Vertical
+
+
+
+ 121
+ 70
+
+
+
+
+
+
- -
-
-
- Angle Constraints
-
-
-
- 9
-
-
- 9
-
-
- 9
-
-
- 9
-
-
- 6
-
-
-
-
-
- Movements
-
-
-
- -
-
-
- Connections
-
-
-
- -
-
-
-
-
- Any Angle
-
-
- -
-
- Diagonal
-
-
- -
-
- Manhattan
-
-
-
-
- -
-
-
-
-
- Any Direction
-
-
- -
-
- Diagonal
-
-
- -
-
- Manhattan
-
-
-
-
- -
-
-
- Qt::Horizontal
-
-
-
- 257
- 41
-
-
-
-
-
-
-
- -
-
-
- Hierarchical Features
-
-
-
- 9
-
-
- 9
-
-
- 9
-
-
- 9
-
-
- 6
-
-
-
-
-
- Copy mode
-
-
-
- -
-
-
- Shallow select
-
-
-
- -
-
-
-
- 0
- 0
-
-
-
- QComboBox::AdjustToContentsOnFirstShow
-
-
-
-
- Shallow mode (instance only)
-
-
- -
-
- Deep mode (instance and cell)
-
-
- -
-
- Ask
-
-
-
-
- -
-
-
- Qt::Horizontal
-
-
-
- 40
- 20
-
-
-
-
- -
-
-
-
- 0
- 0
-
-
-
- Select top level objects only
-
-
-
-
-
-
- -
-
-
- Instance Display
-
-
-
- 6
-
-
- 9
-
-
- 9
-
-
- 9
-
-
- 9
-
-
-
-
-
- Show shapes when moving (max.
-
-
-
- -
-
-
-
- 0
- 0
-
-
-
-
- -
-
-
- shapes)
-
-
-
- -
-
-
- Qt::Horizontal
-
-
-
- 20
- 20
-
-
-
-
-
-
-
- -
-
-
- Qt::Vertical
-
-
-
- 121
- 51
-
-
-
-
-
- grid_cb
- edit_grid_le
- snap_objects_cbx
- conn_angle_cb
- move_angle_cb
- hier_sel_cbx
- show_shapes_cbx
- max_shapes_le
-
diff --git a/src/edt/edt/EditorOptionsInst.ui b/src/edt/edt/EditorOptionsInst.ui
index 3cd38120a..d7529a797 100644
--- a/src/edt/edt/EditorOptionsInst.ui
+++ b/src/edt/edt/EditorOptionsInst.ui
@@ -6,10 +6,16 @@
0
0
- 680
- 574
+ 358
+ 496
+
+
+ 0
+ 0
+
+
Form
@@ -18,163 +24,215 @@
6
- 9
+ 0
- 9
+ 0
- 9
+ 0
- 9
+ 0
-
-
+
QFrame::NoFrame
- QFrame::Raised
+ QFrame::Plain
-
-
- 6
+
+ true
+
+
+
+
+ 0
+ 0
+ 358
+ 496
+
-
- 0
-
-
- 0
-
-
- 0
-
-
- 0
-
-
-
-
-
-
- 0
- 0
-
-
-
- Cell
-
-
-
- -
-
-
-
- 0
- 0
-
-
-
-
- -
-
-
- ...
-
-
-
- -
-
-
- Library
-
-
-
- -
-
-
-
- 0
- 0
-
-
-
-
-
-
-
- -
-
-
- Qt::Vertical
-
-
- QSizePolicy::Fixed
-
-
-
- 522
- 8
-
-
-
-
- -
-
-
-
- 0
- 1
-
-
-
- 0
-
-
-
- Geometry
-
-
-
- 6
-
+
- 9
+ 4
- 9
+ 4
- 9
+ 4
- 9
+ 4
-
-
+
+ 2
+
+
-
+
+
+ QFrame::NoFrame
+
+
+ QFrame::Raised
+
+
+
+ 0
+
+
+ 0
+
+
+ 0
+
+
+ 0
+
+
+ 6
+
+
+ 2
+
+
-
+
+
+ Library
+
+
+
+ -
+
+
+
+ 0
+ 0
+
+
+
+
+ -
+
+
+
+ 0
+ 0
+
+
+
+ Cell
+
+
+
+ -
+
+
+ QFrame::NoFrame
+
+
+ QFrame::Raised
+
+
+
+ 2
+
+
+ 0
+
+
+ 0
+
+
+ 0
+
+
+ 0
+
+
-
+
+
+ ...
+
+
+
+ :/find.png:/find.png
+
+
+ true
+
+
+
+ -
+
+
+
+ 0
+ 0
+
+
+
+
+
+
+
+
+
+
+ -
+
+
+ Qt::Vertical
+
+
+ QSizePolicy::Fixed
+
+
+
+ 20
+ 4
+
+
+
+
+ -
+
+
+ Place origin of cell
+
+
+
+ -
Rotation / Scaling
-
+
- 9
+ 4
- 9
+ 4
- 9
+ 4
- 9
+ 4
-
+
6
+
+ 2
+
-
-
+
0
0
@@ -194,14 +252,14 @@
-
- Scaling factor (magnification)
+ Scaling factor
-
-
+
0
0
@@ -229,10 +287,17 @@
+ -
+
+
+ (magnification)
+
+
+
- -
+
-
@@ -246,33 +311,36 @@
true
-
+
- 9
+ 4
- 9
+ 4
- 9
+ 4
- 9
+ 4
-
+
6
+
+ 2
+
-
- Column vector (x,y)
+ Column step
-
-
+
1
0
@@ -292,7 +360,7 @@
-
-
+
1
0
@@ -312,7 +380,7 @@
-
-
+
1
0
@@ -332,7 +400,7 @@
-
-
+
1
0
@@ -352,14 +420,14 @@
-
- Row vector (x,y)
+ Row step
-
- Rows/Columns
+ Dimension
@@ -368,12 +436,15 @@
columns =
+
+ Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter
+
-
-
+
1
0
@@ -385,74 +456,89 @@
rows =
+
+ Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter
+
-
-
+
1
0
+
+
+ 0
+ 0
+
+
- -
+
-
- Warning: although row and column vectors can be arbitrary combination,
-some design systems only accept orthogonal (rectangular) arrays.
+ Warning: although row and column vectors can be arbitrary combination, some design systems only accept orthogonal (rectangular) arrays.
true
+ -
+
+
+ Qt::Vertical
+
+
+ QSizePolicy::Fixed
+
+
+
+ 20
+ 4
+
+
+
+
- -
-
+
-
+
Qt::Vertical
20
- 40
+ 120
+
+
+
+
+ -
+
+
+ Qt::Vertical
+
+
+ QSizePolicy::Fixed
+
+
+
+ 20
+ 4
-
-
- PCell
-
-
- -
-
-
- Place origin of cell
-
-
-
- -
-
-
- Qt::Vertical
-
-
-
- 50
- 8
-
-
-
-
@@ -462,22 +548,8 @@ some design systems only accept orthogonal (rectangular) arrays.
-
- cell_le
- browse_pb
- lib_cbx
- param_tab_widget
- scale_le
- angle_le
- mirror_cbx
- rows_le
- columns_le
- row_x_le
- row_y_le
- column_x_le
- column_y_le
- place_origin_cb
-
-
+
+
+
diff --git a/src/edt/edt/EditorOptionsInstPCellParam.ui b/src/edt/edt/EditorOptionsInstPCellParam.ui
new file mode 100644
index 000000000..2e1e0178e
--- /dev/null
+++ b/src/edt/edt/EditorOptionsInstPCellParam.ui
@@ -0,0 +1,39 @@
+
+
+ EditorOptionsInstPCellParam
+
+
+
+ 0
+ 0
+ 358
+ 481
+
+
+
+
+ 0
+ 0
+
+
+
+ Form
+
+
+
+ 0
+
+
+ 0
+
+
+ 0
+
+
+ 0
+
+
+
+
+
+
diff --git a/src/edt/edt/edt.pro b/src/edt/edt/edt.pro
index 9a1d11c75..d78982deb 100644
--- a/src/edt/edt/edt.pro
+++ b/src/edt/edt/edt.pro
@@ -43,7 +43,8 @@ FORMS = \
RoundCornerOptionsDialog.ui \
TextPropertiesPage.ui \
PCellParametersDialog.ui \
- DistributeOptionsDialog.ui
+ DistributeOptionsDialog.ui \
+ EditorOptionsInstPCellParam.ui
SOURCES = \
edtConfig.cc \
diff --git a/src/edt/edt/edtEditorOptionsPages.cc b/src/edt/edt/edtEditorOptionsPages.cc
index 4b9c0cf86..f050b9ca4 100644
--- a/src/edt/edt/edtEditorOptionsPages.cc
+++ b/src/edt/edt/edtEditorOptionsPages.cc
@@ -38,6 +38,7 @@
#include "ui_EditorOptionsPath.h"
#include "ui_EditorOptionsText.h"
#include "ui_EditorOptionsInst.h"
+#include "ui_EditorOptionsInstPCellParam.h"
#include
#include
@@ -160,18 +161,23 @@ EditorOptionsPages::activate_page (edt::EditorOptionsPage *page)
void
EditorOptionsPages::update (edt::EditorOptionsPage *page)
{
- std::sort (m_pages.begin (), m_pages.end (), EOPCompareOp ());
+ std::vector sorted_pages = m_pages;
+ std::sort (sorted_pages.begin (), sorted_pages.end (), EOPCompareOp ());
+
+ if (! page && m_pages.size () > 0) {
+ page = m_pages.back ();
+ }
while (mp_pages->count () > 0) {
mp_pages->removeTab (0);
}
int index = -1;
- for (std::vector ::iterator p = m_pages.begin (); p != m_pages.end (); ++p) {
+ for (std::vector ::iterator p = sorted_pages.begin (); p != sorted_pages.end (); ++p) {
if ((*p)->active ()) {
- mp_pages->addTab ((*p)->q_frame (), tl::to_qstring ((*p)->title ()));
if ((*p) == page) {
- index = int (std::distance (m_pages.begin (), p));
+ index = mp_pages->count ();
}
+ mp_pages->addTab ((*p)->q_frame (), tl::to_qstring ((*p)->title ()));
} else {
(*p)->q_frame ()->setParent (0);
}
@@ -522,7 +528,7 @@ EditorOptionsPath::setup (lay::Plugin *root)
// EditorOptionsInst implementation
EditorOptionsInst::EditorOptionsInst (lay::Dispatcher *root)
- : QWidget (), EditorOptionsPage (), mp_root (root), mp_pcell_parameters (0)
+ : QWidget (), EditorOptionsPage (), mp_root (root)
{
mp_ui = new Ui::EditorOptionsInst ();
mp_ui->setupUi (this);
@@ -532,10 +538,6 @@ EditorOptionsInst::EditorOptionsInst (lay::Dispatcher *root)
connect (mp_ui->lib_cbx, SIGNAL (currentIndexChanged (int)), this, SLOT (library_changed (int)));
connect (mp_ui->cell_le, SIGNAL (textChanged (const QString &)), this, SLOT (cell_name_changed (const QString &)));
- QHBoxLayout *layout = new QHBoxLayout (mp_ui->pcell_tab);
- layout->setMargin (0);
- mp_ui->pcell_tab->setLayout (layout);
-
m_cv_index = -1;
}
@@ -554,17 +556,51 @@ EditorOptionsInst::title () const
void
EditorOptionsInst::library_changed (int)
{
+ update_cell_edits ();
+/* @@@
BEGIN_PROTECTED
update_pcell_parameters ();
END_PROTECTED
+@@@*/
}
void
EditorOptionsInst::cell_name_changed (const QString &)
{
+ update_cell_edits ();
+/* @@@
BEGIN_PROTECTED
update_pcell_parameters ();
END_PROTECTED
+@@@*/
+}
+
+void
+EditorOptionsInst::update_cell_edits ()
+{
+ db::Layout *layout = 0;
+
+ // find the layout the cell has to be looked up: that is either the layout of the current instance or
+ // the library selected
+ if (mp_ui->lib_cbx->current_library ()) {
+ layout = &mp_ui->lib_cbx->current_library ()->layout ();
+ } else {
+ layout = &lay::LayoutView::current ()->cellview (m_cv_index)->layout ();
+ }
+
+ std::pair pc = layout->pcell_by_name (tl::to_string (mp_ui->cell_le->text ()).c_str ());
+ std::pair cc = layout->cell_by_name (tl::to_string (mp_ui->cell_le->text ()).c_str ());
+
+ // by the way, update the foreground color of the cell edit box as well (red, if not valid)
+ QPalette pl = mp_ui->cell_le->palette ();
+ if (! pc.first && ! cc.first) {
+ pl.setColor (QPalette::Text, Qt::red);
+ pl.setColor (QPalette::Base, QColor (Qt::red).lighter (180));
+ } else {
+ pl.setColor (QPalette::Text, palette ().color (QPalette::Text));
+ pl.setColor (QPalette::Base, palette ().color (QPalette::Base));
+ }
+ mp_ui->cell_le->setPalette (pl);
}
void
@@ -608,7 +644,7 @@ BEGIN_PROTECTED
} else if (layout->is_valid_cell_index (form.selected_cell_index ())) {
mp_ui->cell_le->setText (tl::to_qstring (layout->cell_name (form.selected_cell_index ())));
}
- update_pcell_parameters ();
+ // @@@@update_pcell_parameters ();
}
}
@@ -641,28 +677,6 @@ EditorOptionsInst::apply (lay::Plugin *root)
root->config_set (cfg_edit_inst_lib_name, std::string ());
}
- // pcell parameters
- std::string param;
- db::Layout *layout = 0;
-
- if (mp_ui->lib_cbx->current_library ()) {
- layout = &mp_ui->lib_cbx->current_library ()->layout ();
- } else if (m_cv_index >= 0 && lay::LayoutView::current () && lay::LayoutView::current ()->cellview (m_cv_index).is_valid ()) {
- layout = &lay::LayoutView::current ()->cellview (m_cv_index)->layout ();
- }
-
- if (layout && mp_pcell_parameters) {
- std::pair pc = layout->pcell_by_name (tl::to_string (mp_ui->cell_le->text ()).c_str ());
- if (pc.first) {
- const db::PCellDeclaration *pc_decl = layout->pcell_declaration (pc.second);
- if (pc_decl) {
- param = pcell_parameters_to_string (pc_decl->named_parameters (mp_pcell_parameters->get_parameters ()));
- }
- }
- }
-
- root->config_set (cfg_edit_inst_pcell_parameters, param);
-
// rotation, scaling
double angle = 0.0;
tl::from_string (tl::to_string (mp_ui->angle_le->text ()), angle);
@@ -724,61 +738,6 @@ EditorOptionsInst::setup (lay::Plugin *root)
root->config_get (cfg_edit_inst_lib_name, l);
mp_ui->lib_cbx->set_current_library (db::LibraryManager::instance ().lib_ptr_by_name (l));
- // pcell parameters
- std::string param;
- root->config_get (cfg_edit_inst_pcell_parameters, param);
-
- db::Layout *layout = 0;
- if (mp_ui->lib_cbx->current_library ()) {
- layout = &mp_ui->lib_cbx->current_library ()->layout ();
- } else if (m_cv_index >= 0 && lay::LayoutView::current () && lay::LayoutView::current ()->cellview (m_cv_index).is_valid ()) {
- layout = &lay::LayoutView::current ()->cellview (m_cv_index)->layout ();
- }
-
- std::vector pv;
-
- if (layout && mp_pcell_parameters) {
-
- std::pair pc = layout->pcell_by_name (tl::to_string (mp_ui->cell_le->text ()).c_str ());
-
- if (pc.first) {
-
- const db::PCellDeclaration *pc_decl = layout->pcell_declaration (pc.second);
- if (pc_decl) {
-
- std::map parameters;
- try {
- tl::Extractor ex (param.c_str ());
- ex.test ("!"); // used to flag PCells
- while (! ex.at_end ()) {
- std::string n;
- ex.read_word_or_quoted (n);
- ex.test (":");
- ex.read (parameters.insert (std::make_pair (n, tl::Variant ())).first->second);
- ex.test (";");
- }
- } catch (...) { }
-
- const std::vector &pcp = pc_decl->parameter_declarations ();
- for (std::vector::const_iterator pd = pcp.begin (); pd != pcp.end (); ++pd) {
- std::map::const_iterator p = parameters.find (pd->get_name ());
- if (p != parameters.end ()) {
- pv.push_back (p->second);
- } else {
- pv.push_back (pd->get_default ());
- }
- }
-
- }
-
- }
-
- }
-
- try {
- update_pcell_parameters (pv);
- } catch (...) { }
-
// rotation, scaling
double angle = 0.0;
root->config_get (cfg_edit_inst_angle, angle);
@@ -819,43 +778,172 @@ EditorOptionsInst::setup (lay::Plugin *root)
mp_ui->place_origin_cb->setChecked (place_origin);
}
-void
-EditorOptionsInst::update_pcell_parameters ()
+// ------------------------------------------------------------------
+// EditorOptionsInstPCellParam implementation
+
+EditorOptionsInstPCellParam::EditorOptionsInstPCellParam (lay::Dispatcher *root)
+ : QWidget (), EditorOptionsPage (), mp_root (root), mp_pcell_parameters (0)
+{
+ mp_ui = new Ui::EditorOptionsInstPCellParam ();
+ mp_ui->setupUi (this);
+}
+
+EditorOptionsInstPCellParam::~EditorOptionsInstPCellParam ()
+{
+ delete mp_ui;
+ mp_ui = 0;
+}
+
+std::string
+EditorOptionsInstPCellParam::title () const
+{
+ return tl::to_string (QObject::tr ("PCell"));
+}
+
+/* @@@
+void
+EditorOptionsInstPCellParam::library_changed (int)
+{
+BEGIN_PROTECTED
+ update_pcell_parameters ();
+END_PROTECTED
+}
+
+void
+EditorOptionsInstPCellParam::cell_name_changed (const QString &)
+{
+BEGIN_PROTECTED
+ update_pcell_parameters ();
+END_PROTECTED
+}
+*/
+
+void
+EditorOptionsInstPCellParam::apply (lay::Plugin *root)
+{
+ // pcell parameters
+ std::string param;
+ db::Layout *layout = 0;
+
+ db::Library *lib = db::LibraryManager::instance ().lib_ptr_by_name (m_lib_name);
+ if (lib) {
+ layout = &lib->layout ();
+ } else if (m_cv_index >= 0 && lay::LayoutView::current () && lay::LayoutView::current ()->cellview (m_cv_index).is_valid ()) {
+ layout = &lay::LayoutView::current ()->cellview (m_cv_index)->layout ();
+ }
+
+ if (layout && mp_pcell_parameters) {
+ std::pair pc = layout->pcell_by_name (tl::to_string (m_cell_name).c_str ());
+ if (pc.first) {
+ const db::PCellDeclaration *pc_decl = layout->pcell_declaration (pc.second);
+ if (pc_decl) {
+ param = pcell_parameters_to_string (pc_decl->named_parameters (mp_pcell_parameters->get_parameters ()));
+ }
+ }
+ }
+
+ root->config_set (cfg_edit_inst_pcell_parameters, param);
+}
+
+void
+EditorOptionsInstPCellParam::setup (lay::Plugin *root)
+{
+ m_cv_index = -1;
+ if (lay::LayoutView::current ()) {
+ m_cv_index = lay::LayoutView::current ()->active_cellview_index ();
+ }
+
+ // cell name
+ root->config_get (cfg_edit_inst_cell_name, m_cell_name);
+
+ // library
+ root->config_get (cfg_edit_inst_lib_name, m_lib_name);
+ db::Library *lib = db::LibraryManager::instance ().lib_ptr_by_name (m_lib_name);
+
+ // pcell parameters
+ std::string param;
+ root->config_get (cfg_edit_inst_pcell_parameters, param);
+
+ db::Layout *layout = 0;
+ if (lib) {
+ layout = &lib->layout ();
+ } else if (m_cv_index >= 0 && lay::LayoutView::current () && lay::LayoutView::current ()->cellview (m_cv_index).is_valid ()) {
+ layout = &lay::LayoutView::current ()->cellview (m_cv_index)->layout ();
+ }
+
+ std::vector pv;
+
+ if (layout && mp_pcell_parameters) {
+
+ std::pair pc = layout->pcell_by_name (tl::to_string (m_cell_name).c_str ());
+
+ if (pc.first) {
+
+ const db::PCellDeclaration *pc_decl = layout->pcell_declaration (pc.second);
+ if (pc_decl) {
+
+ std::map parameters;
+ try {
+ tl::Extractor ex (param.c_str ());
+ ex.test ("!"); // used to flag PCells
+ while (! ex.at_end ()) {
+ std::string n;
+ ex.read_word_or_quoted (n);
+ ex.test (":");
+ ex.read (parameters.insert (std::make_pair (n, tl::Variant ())).first->second);
+ ex.test (";");
+ }
+ } catch (...) { }
+
+ const std::vector &pcp = pc_decl->parameter_declarations ();
+ for (std::vector::const_iterator pd = pcp.begin (); pd != pcp.end (); ++pd) {
+ std::map::const_iterator p = parameters.find (pd->get_name ());
+ if (p != parameters.end ()) {
+ pv.push_back (p->second);
+ } else {
+ pv.push_back (pd->get_default ());
+ }
+ }
+
+ }
+
+ }
+
+ }
+
+ try {
+ update_pcell_parameters (pv);
+ } catch (...) { }
+}
+
+void
+EditorOptionsInstPCellParam::update_pcell_parameters ()
{
update_pcell_parameters (std::vector ());
}
-void
-EditorOptionsInst::update_pcell_parameters (const std::vector ¶meters)
+void
+EditorOptionsInstPCellParam::update_pcell_parameters (const std::vector ¶meters)
{
db::Layout *layout = 0;
+/* @@@
if (m_cv_index < 0 || !lay::LayoutView::current () || !lay::LayoutView::current ()->cellview (m_cv_index).is_valid ()) {
mp_ui->param_tab_widget->setTabEnabled (1, false);
return;
}
+@@@*/
- // find the layout the cell has to be looked up: that is either the layout of the current instance or
+ // find the layout the cell has to be looked up: that is either the layout of the current instance or
// the library selected
- if (mp_ui->lib_cbx->current_library ()) {
- layout = &mp_ui->lib_cbx->current_library ()->layout ();
+ db::Library *lib = db::LibraryManager::instance ().lib_ptr_by_name (m_lib_name);
+ if (lib) {
+ layout = &lib->layout ();
} else {
layout = &lay::LayoutView::current ()->cellview (m_cv_index)->layout ();
}
- std::pair pc = layout->pcell_by_name (tl::to_string (mp_ui->cell_le->text ()).c_str ());
- std::pair cc = layout->cell_by_name (tl::to_string (mp_ui->cell_le->text ()).c_str ());
-
- // by the way, update the foreground color of the cell edit box as well (red, if not valid)
- QPalette pl = mp_ui->cell_le->palette ();
- if (! pc.first && ! cc.first) {
- pl.setColor (QPalette::Text, Qt::red);
- pl.setColor (QPalette::Base, QColor (Qt::red).lighter (180));
- } else {
- pl.setColor (QPalette::Text, palette ().color (QPalette::Text));
- pl.setColor (QPalette::Base, palette ().color (QPalette::Base));
- }
- mp_ui->cell_le->setPalette (pl);
+ std::pair pc = layout->pcell_by_name (tl::to_string (m_cell_name).c_str ());
PCellParametersPage::State pcp_state;
@@ -870,15 +958,15 @@ EditorOptionsInst::update_pcell_parameters (const std::vector &par
if (pc.first && layout->pcell_declaration (pc.second)) {
- mp_ui->param_tab_widget->setTabEnabled (1, true);
+ // @@@mp_ui->param_tab_widget->setTabEnabled (1, true);
lay::LayoutView *view = lay::LayoutView::current ();
- mp_pcell_parameters = new PCellParametersPage (mp_ui->pcell_tab, &view->cellview (m_cv_index)->layout (), view, m_cv_index, layout->pcell_declaration (pc.second), parameters);
- mp_ui->pcell_tab->layout ()->addWidget (mp_pcell_parameters);
+ mp_pcell_parameters = new PCellParametersPage (this, &view->cellview (m_cv_index)->layout (), view, m_cv_index, layout->pcell_declaration (pc.second), parameters);
+ this->layout ()->addWidget (mp_pcell_parameters);
mp_pcell_parameters->set_state (pcp_state);
} else {
- mp_ui->param_tab_widget->setTabEnabled (1, false);
+ // @@@mp_ui->param_tab_widget->setTabEnabled (1, false);
}
}
diff --git a/src/edt/edt/edtEditorOptionsPages.h b/src/edt/edt/edtEditorOptionsPages.h
index 8b7f34ebc..723a42603 100644
--- a/src/edt/edt/edtEditorOptionsPages.h
+++ b/src/edt/edt/edtEditorOptionsPages.h
@@ -41,6 +41,7 @@ namespace Ui
class EditorOptionsPath;
class EditorOptionsText;
class EditorOptionsInst;
+ class EditorOptionsInstPCellParam;
}
namespace lay
@@ -181,7 +182,7 @@ public:
virtual QWidget *q_frame () { return this; }
virtual std::string title () const;
- virtual int order () const { return 20; }
+ virtual int order () const { return 30; }
void apply (lay::Plugin *root);
void setup (lay::Plugin *root);
@@ -217,6 +218,7 @@ public slots:
void update_pcell_parameters ();
void library_changed (int index);
void cell_name_changed (const QString &s);
+ void update_cell_edits ();
private:
Ui::EditorOptionsInst *mp_ui;
@@ -227,6 +229,38 @@ private:
void update_pcell_parameters (const std::vector ¶meters);
};
+/**
+ * @brief The instance properties page (PCell parameters)
+ */
+class EditorOptionsInstPCellParam
+ : public QWidget, public EditorOptionsPage
+{
+Q_OBJECT
+
+public:
+ EditorOptionsInstPCellParam (lay::Dispatcher *root);
+ ~EditorOptionsInstPCellParam ();
+
+ virtual QWidget *q_frame () { return this; }
+
+ virtual std::string title () const;
+ virtual int order () const { return 21; }
+ void apply (lay::Plugin *root);
+ void setup (lay::Plugin *root);
+
+public slots:
+ void update_pcell_parameters ();
+
+private:
+ Ui::EditorOptionsInstPCellParam *mp_ui;
+ lay::Dispatcher *mp_root;
+ edt::PCellParametersPage *mp_pcell_parameters;
+ int m_cv_index;
+ std::string m_lib_name, m_cell_name;
+
+ void update_pcell_parameters (const std::vector ¶meters);
+};
+
}
#endif
diff --git a/src/edt/edt/edtPlugin.cc b/src/edt/edt/edtPlugin.cc
index 4e0ca160a..8e579a759 100644
--- a/src/edt/edt/edtPlugin.cc
+++ b/src/edt/edt/edtPlugin.cc
@@ -88,6 +88,7 @@ void get_inst_options (std::vector < std::pair > &opti
static
void get_inst_editor_options_pages (std::vector &ret, lay::Dispatcher *root)
{
+ ret.push_back (new EditorOptionsInstPCellParam (root));
ret.push_back (new EditorOptionsInst (root));
}
@@ -402,9 +403,11 @@ activate_service (lay::LayoutView *view, const lay::PluginDeclaration *pd, bool
return;
}
+ // @@@ TODO: this is very inefficient as each "activate" will regenerate the tabs
for (std::vector::const_iterator op = eo_pages->pages ().begin (); op != eo_pages->pages ().end (); ++op) {
(*op)->activate (((*op)->plugin_declaration () == pd || ! (*op)->plugin_declaration ()) && active);
}
+
}
void