mirror of https://github.com/KLayout/klayout.git
WIP: no-apply for instance properties
This commit is contained in:
parent
0ff1a472f5
commit
b8c33f1b59
|
|
@ -174,6 +174,9 @@
|
||||||
<verstretch>0</verstretch>
|
<verstretch>0</verstretch>
|
||||||
</sizepolicy>
|
</sizepolicy>
|
||||||
</property>
|
</property>
|
||||||
|
<property name="clearButtonEnabled">
|
||||||
|
<bool>false</bool>
|
||||||
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
|
|
|
||||||
|
|
@ -51,8 +51,8 @@ namespace edt
|
||||||
// ------------------------------------------------------------------
|
// ------------------------------------------------------------------
|
||||||
// EditorOptionsPage implementation
|
// EditorOptionsPage implementation
|
||||||
|
|
||||||
EditorOptionsPage::EditorOptionsPage ()
|
EditorOptionsPage::EditorOptionsPage (lay::Dispatcher *dispatcher)
|
||||||
: mp_owner (0), m_active (true), mp_plugin_declaration (0)
|
: mp_owner (0), m_active (true), mp_plugin_declaration (0), mp_dispatcher (dispatcher)
|
||||||
{
|
{
|
||||||
// nothing yet ..
|
// nothing yet ..
|
||||||
}
|
}
|
||||||
|
|
@ -230,11 +230,43 @@ BEGIN_PROTECTED
|
||||||
END_PROTECTED_W (this)
|
END_PROTECTED_W (this)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// ------------------------------------------------------------------
|
||||||
|
// Indicates an error on a line edit
|
||||||
|
|
||||||
|
static void indicate_error (QLineEdit *le, bool error)
|
||||||
|
{
|
||||||
|
// by the way, update the foreground color of the cell edit box as well (red, if not valid)
|
||||||
|
QPalette pl = le->palette ();
|
||||||
|
if (error) {
|
||||||
|
pl.setColor (QPalette::Active, QPalette::Text, Qt::red);
|
||||||
|
pl.setColor (QPalette::Active, QPalette::Base, QColor (Qt::red).lighter (180));
|
||||||
|
} else {
|
||||||
|
QWidget *pw = dynamic_cast<QWidget *> (le->parent ());
|
||||||
|
tl_assert (pw != 0);
|
||||||
|
pl.setColor (QPalette::Active, QPalette::Text, pw->palette ().color (QPalette::Text));
|
||||||
|
pl.setColor (QPalette::Active, QPalette::Base, pw->palette ().color (QPalette::Base));
|
||||||
|
}
|
||||||
|
le->setPalette (pl);
|
||||||
|
}
|
||||||
|
|
||||||
|
template <class Value>
|
||||||
|
static void configure_from_line_edit (lay::Dispatcher *dispatcher, QLineEdit *le, const std::string &cfg_name)
|
||||||
|
{
|
||||||
|
try {
|
||||||
|
Value value = Value (0);
|
||||||
|
tl::from_string (tl::to_string (le->text ()), value);
|
||||||
|
dispatcher->config_set (cfg_name, tl::to_string (value));
|
||||||
|
indicate_error (le, false);
|
||||||
|
} catch (...) {
|
||||||
|
indicate_error (le, true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// ------------------------------------------------------------------
|
// ------------------------------------------------------------------
|
||||||
// EditorOptionsGeneric implementation
|
// EditorOptionsGeneric implementation
|
||||||
|
|
||||||
EditorOptionsGeneric::EditorOptionsGeneric ()
|
EditorOptionsGeneric::EditorOptionsGeneric (lay::Dispatcher *dispatcher)
|
||||||
: QWidget (), EditorOptionsPage ()
|
: QWidget (), EditorOptionsPage (dispatcher)
|
||||||
{
|
{
|
||||||
mp_ui = new Ui::EditorOptionsGeneric ();
|
mp_ui = new Ui::EditorOptionsGeneric ();
|
||||||
mp_ui->setupUi (this);
|
mp_ui->setupUi (this);
|
||||||
|
|
@ -255,7 +287,7 @@ EditorOptionsGeneric::title () const
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
EditorOptionsGeneric::apply (lay::Plugin *root)
|
EditorOptionsGeneric::apply (lay::Dispatcher *root)
|
||||||
{
|
{
|
||||||
// Edit grid
|
// Edit grid
|
||||||
|
|
||||||
|
|
@ -300,7 +332,7 @@ EditorOptionsGeneric::show_shapes_changed ()
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
EditorOptionsGeneric::setup (lay::Plugin *root)
|
EditorOptionsGeneric::setup (lay::Dispatcher *root)
|
||||||
{
|
{
|
||||||
// Edit grid
|
// Edit grid
|
||||||
|
|
||||||
|
|
@ -355,8 +387,8 @@ EditorOptionsGeneric::setup (lay::Plugin *root)
|
||||||
// ------------------------------------------------------------------
|
// ------------------------------------------------------------------
|
||||||
// EditorOptionsText implementation
|
// EditorOptionsText implementation
|
||||||
|
|
||||||
EditorOptionsText::EditorOptionsText ()
|
EditorOptionsText::EditorOptionsText (lay::Dispatcher *dispatcher)
|
||||||
: QWidget (), EditorOptionsPage ()
|
: QWidget (), EditorOptionsPage (dispatcher)
|
||||||
{
|
{
|
||||||
mp_ui = new Ui::EditorOptionsText ();
|
mp_ui = new Ui::EditorOptionsText ();
|
||||||
mp_ui->setupUi (this);
|
mp_ui->setupUi (this);
|
||||||
|
|
@ -375,7 +407,7 @@ EditorOptionsText::title () const
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
EditorOptionsText::apply (lay::Plugin *root)
|
EditorOptionsText::apply (lay::Dispatcher *root)
|
||||||
{
|
{
|
||||||
// Text string
|
// Text string
|
||||||
root->config_set (cfg_edit_text_string, tl::unescape_string (tl::to_string (mp_ui->text_le->text ())));
|
root->config_set (cfg_edit_text_string, tl::unescape_string (tl::to_string (mp_ui->text_le->text ())));
|
||||||
|
|
@ -399,7 +431,7 @@ EditorOptionsText::apply (lay::Plugin *root)
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
EditorOptionsText::setup (lay::Plugin *root)
|
EditorOptionsText::setup (lay::Dispatcher *root)
|
||||||
{
|
{
|
||||||
// Text string
|
// Text string
|
||||||
std::string s;
|
std::string s;
|
||||||
|
|
@ -428,8 +460,8 @@ EditorOptionsText::setup (lay::Plugin *root)
|
||||||
// ------------------------------------------------------------------
|
// ------------------------------------------------------------------
|
||||||
// EditorOptionsPath implementation
|
// EditorOptionsPath implementation
|
||||||
|
|
||||||
EditorOptionsPath::EditorOptionsPath ()
|
EditorOptionsPath::EditorOptionsPath (lay::Dispatcher *dispatcher)
|
||||||
: QWidget (), EditorOptionsPage ()
|
: QWidget (), EditorOptionsPage (dispatcher)
|
||||||
{
|
{
|
||||||
mp_ui = new Ui::EditorOptionsPath ();
|
mp_ui = new Ui::EditorOptionsPath ();
|
||||||
mp_ui->setupUi (this);
|
mp_ui->setupUi (this);
|
||||||
|
|
@ -457,7 +489,7 @@ EditorOptionsPath::type_changed (int type)
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
EditorOptionsPath::apply (lay::Plugin *root)
|
EditorOptionsPath::apply (lay::Dispatcher *root)
|
||||||
{
|
{
|
||||||
// width
|
// width
|
||||||
|
|
||||||
|
|
@ -494,7 +526,7 @@ EditorOptionsPath::apply (lay::Plugin *root)
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
EditorOptionsPath::setup (lay::Plugin *root)
|
EditorOptionsPath::setup (lay::Dispatcher *root)
|
||||||
{
|
{
|
||||||
// width
|
// width
|
||||||
|
|
||||||
|
|
@ -527,16 +559,27 @@ EditorOptionsPath::setup (lay::Plugin *root)
|
||||||
// ------------------------------------------------------------------
|
// ------------------------------------------------------------------
|
||||||
// EditorOptionsInst implementation
|
// EditorOptionsInst implementation
|
||||||
|
|
||||||
EditorOptionsInst::EditorOptionsInst (lay::Dispatcher *root)
|
EditorOptionsInst::EditorOptionsInst (lay::Dispatcher *dispatcher)
|
||||||
: QWidget (), EditorOptionsPage (), mp_root (root)
|
: QWidget (), EditorOptionsPage (dispatcher)
|
||||||
{
|
{
|
||||||
mp_ui = new Ui::EditorOptionsInst ();
|
mp_ui = new Ui::EditorOptionsInst ();
|
||||||
mp_ui->setupUi (this);
|
mp_ui->setupUi (this);
|
||||||
|
|
||||||
connect (mp_ui->array_grp, SIGNAL (clicked ()), this, SLOT (array_changed ()));
|
connect (mp_ui->array_grp, SIGNAL (clicked ()), this, SLOT (array_changed ()));
|
||||||
connect (mp_ui->browse_pb, SIGNAL (clicked ()), this, SLOT (browse_cell ()));
|
connect (mp_ui->browse_pb, SIGNAL (clicked ()), this, SLOT (browse_cell ()));
|
||||||
connect (mp_ui->lib_cbx, SIGNAL (currentIndexChanged (int)), this, SLOT (library_changed (int)));
|
connect (mp_ui->lib_cbx, SIGNAL (currentIndexChanged (int)), this, SLOT (library_changed ()));
|
||||||
connect (mp_ui->cell_le, SIGNAL (textChanged (const QString &)), this, SLOT (cell_name_changed (const QString &)));
|
connect (mp_ui->cell_le, SIGNAL (editingFinished ()), this, SLOT (edited ()));
|
||||||
|
connect (mp_ui->angle_le, SIGNAL (editingFinished ()), this, SLOT (edited ()));
|
||||||
|
connect (mp_ui->scale_le, SIGNAL (editingFinished ()), this, SLOT (edited ()));
|
||||||
|
connect (mp_ui->rows_le, SIGNAL (editingFinished ()), this, SLOT (edited ()));
|
||||||
|
connect (mp_ui->row_x_le, SIGNAL (editingFinished ()), this, SLOT (edited ()));
|
||||||
|
connect (mp_ui->row_y_le, SIGNAL (editingFinished ()), this, SLOT (edited ()));
|
||||||
|
connect (mp_ui->columns_le, SIGNAL (editingFinished ()), this, SLOT (edited ()));
|
||||||
|
connect (mp_ui->column_x_le, SIGNAL (editingFinished ()), this, SLOT (edited ()));
|
||||||
|
connect (mp_ui->column_y_le, SIGNAL (editingFinished ()), this, SLOT (edited ()));
|
||||||
|
connect (mp_ui->mirror_cbx, SIGNAL (clicked ()), this, SLOT (edited ()));
|
||||||
|
connect (mp_ui->array_grp, SIGNAL (clicked ()), this, SLOT (edited ()));
|
||||||
|
connect (mp_ui->place_origin_cb, SIGNAL (clicked ()), this, SLOT (edited ()));
|
||||||
|
|
||||||
m_cv_index = -1;
|
m_cv_index = -1;
|
||||||
}
|
}
|
||||||
|
|
@ -554,25 +597,17 @@ EditorOptionsInst::title () const
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
EditorOptionsInst::library_changed (int)
|
EditorOptionsInst::library_changed ()
|
||||||
{
|
{
|
||||||
update_cell_edits ();
|
update_cell_edits ();
|
||||||
/* @@@
|
edited ();
|
||||||
BEGIN_PROTECTED
|
|
||||||
update_pcell_parameters ();
|
|
||||||
END_PROTECTED
|
|
||||||
@@@*/
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
EditorOptionsInst::cell_name_changed (const QString &)
|
EditorOptionsInst::cell_name_changed ()
|
||||||
{
|
{
|
||||||
update_cell_edits ();
|
update_cell_edits ();
|
||||||
/* @@@
|
edited ();
|
||||||
BEGIN_PROTECTED
|
|
||||||
update_pcell_parameters ();
|
|
||||||
END_PROTECTED
|
|
||||||
@@@*/
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
|
@ -597,15 +632,7 @@ EditorOptionsInst::update_cell_edits ()
|
||||||
std::pair<bool, db::cell_index_type> cc = layout->cell_by_name (tl::to_string (mp_ui->cell_le->text ()).c_str ());
|
std::pair<bool, db::cell_index_type> 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)
|
// 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 ();
|
indicate_error (mp_ui->cell_le, ! pc.first && ! cc.first);
|
||||||
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
|
void
|
||||||
|
|
@ -649,7 +676,7 @@ BEGIN_PROTECTED
|
||||||
} else if (layout->is_valid_cell_index (form.selected_cell_index ())) {
|
} 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 ())));
|
mp_ui->cell_le->setText (tl::to_qstring (layout->cell_name (form.selected_cell_index ())));
|
||||||
}
|
}
|
||||||
// @@@@update_pcell_parameters ();
|
edited ();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
@ -657,6 +684,12 @@ BEGIN_PROTECTED
|
||||||
END_PROTECTED
|
END_PROTECTED
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
EditorOptionsInst::edited ()
|
||||||
|
{
|
||||||
|
apply (dispatcher ());
|
||||||
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
EditorOptionsInst::array_changed ()
|
EditorOptionsInst::array_changed ()
|
||||||
{
|
{
|
||||||
|
|
@ -667,15 +700,16 @@ EditorOptionsInst::array_changed ()
|
||||||
mp_ui->columns_le->setEnabled (array);
|
mp_ui->columns_le->setEnabled (array);
|
||||||
mp_ui->column_x_le->setEnabled (array);
|
mp_ui->column_x_le->setEnabled (array);
|
||||||
mp_ui->column_y_le->setEnabled (array);
|
mp_ui->column_y_le->setEnabled (array);
|
||||||
|
edited ();
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
EditorOptionsInst::apply (lay::Plugin *root)
|
EditorOptionsInst::apply (lay::Dispatcher *root)
|
||||||
{
|
{
|
||||||
// cell name
|
// cell name
|
||||||
root->config_set (cfg_edit_inst_cell_name, tl::to_string (mp_ui->cell_le->text ()));
|
root->config_set (cfg_edit_inst_cell_name, tl::to_string (mp_ui->cell_le->text ()));
|
||||||
|
|
||||||
// cell name
|
// lib name
|
||||||
if (mp_ui->lib_cbx->current_library ()) {
|
if (mp_ui->lib_cbx->current_library ()) {
|
||||||
root->config_set (cfg_edit_inst_lib_name, mp_ui->lib_cbx->current_library ()->get_name ());
|
root->config_set (cfg_edit_inst_lib_name, mp_ui->lib_cbx->current_library ()->get_name ());
|
||||||
} else {
|
} else {
|
||||||
|
|
@ -683,36 +717,23 @@ EditorOptionsInst::apply (lay::Plugin *root)
|
||||||
}
|
}
|
||||||
|
|
||||||
// rotation, scaling
|
// rotation, scaling
|
||||||
double angle = 0.0;
|
configure_from_line_edit<double> (root, mp_ui->angle_le, cfg_edit_inst_angle);
|
||||||
tl::from_string (tl::to_string (mp_ui->angle_le->text ()), angle);
|
|
||||||
root->config_set (cfg_edit_inst_angle, tl::to_string (angle));
|
|
||||||
|
|
||||||
bool mirror = mp_ui->mirror_cbx->isChecked ();
|
bool mirror = mp_ui->mirror_cbx->isChecked ();
|
||||||
root->config_set (cfg_edit_inst_mirror, tl::to_string (mirror));
|
root->config_set (cfg_edit_inst_mirror, tl::to_string (mirror));
|
||||||
|
|
||||||
double scale = 1.0;
|
configure_from_line_edit<double> (root, mp_ui->scale_le, cfg_edit_inst_scale);
|
||||||
tl::from_string (tl::to_string (mp_ui->scale_le->text ()), scale);
|
|
||||||
root->config_set (cfg_edit_inst_scale, tl::to_string (scale));
|
|
||||||
|
|
||||||
// array
|
// array
|
||||||
bool array = mp_ui->array_grp->isChecked ();
|
bool array = mp_ui->array_grp->isChecked ();
|
||||||
root->config_set (cfg_edit_inst_array, tl::to_string (array));
|
root->config_set (cfg_edit_inst_array, tl::to_string (array));
|
||||||
|
|
||||||
int rows = 1, columns = 1;
|
configure_from_line_edit<int> (root, mp_ui->rows_le, cfg_edit_inst_rows);
|
||||||
double row_x = 0.0, row_y = 0.0, column_x = 0.0, column_y = 0.0;
|
configure_from_line_edit<double> (root, mp_ui->row_x_le, cfg_edit_inst_row_x);
|
||||||
tl::from_string (tl::to_string (mp_ui->rows_le->text ()), rows);
|
configure_from_line_edit<double> (root, mp_ui->row_y_le, cfg_edit_inst_row_y);
|
||||||
tl::from_string (tl::to_string (mp_ui->row_x_le->text ()), row_x);
|
configure_from_line_edit<int> (root, mp_ui->columns_le, cfg_edit_inst_columns);
|
||||||
tl::from_string (tl::to_string (mp_ui->row_y_le->text ()), row_y);
|
configure_from_line_edit<double> (root, mp_ui->column_x_le, cfg_edit_inst_column_x);
|
||||||
tl::from_string (tl::to_string (mp_ui->columns_le->text ()), columns);
|
configure_from_line_edit<double> (root, mp_ui->column_y_le, cfg_edit_inst_column_y);
|
||||||
tl::from_string (tl::to_string (mp_ui->column_x_le->text ()), column_x);
|
|
||||||
tl::from_string (tl::to_string (mp_ui->column_y_le->text ()), column_y);
|
|
||||||
|
|
||||||
root->config_set (cfg_edit_inst_rows, tl::to_string (rows));
|
|
||||||
root->config_set (cfg_edit_inst_row_x, tl::to_string (row_x));
|
|
||||||
root->config_set (cfg_edit_inst_row_y, tl::to_string (row_y));
|
|
||||||
root->config_set (cfg_edit_inst_columns, tl::to_string (columns));
|
|
||||||
root->config_set (cfg_edit_inst_column_x, tl::to_string (column_x));
|
|
||||||
root->config_set (cfg_edit_inst_column_y, tl::to_string (column_y));
|
|
||||||
|
|
||||||
// place origin of cell flag
|
// place origin of cell flag
|
||||||
bool place_origin = mp_ui->place_origin_cb->isChecked ();
|
bool place_origin = mp_ui->place_origin_cb->isChecked ();
|
||||||
|
|
@ -720,29 +741,42 @@ EditorOptionsInst::apply (lay::Plugin *root)
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
EditorOptionsInst::setup (lay::Plugin *root)
|
EditorOptionsInst::setup (lay::Dispatcher *root)
|
||||||
{
|
{
|
||||||
m_cv_index = -1;
|
m_cv_index = -1;
|
||||||
if (lay::LayoutView::current ()) {
|
if (lay::LayoutView::current ()) {
|
||||||
m_cv_index = lay::LayoutView::current ()->active_cellview_index ();
|
m_cv_index = lay::LayoutView::current ()->active_cellview_index ();
|
||||||
}
|
}
|
||||||
mp_ui->lib_cbx->update_list ();
|
|
||||||
if (m_cv_index >= 0 && lay::LayoutView::current () && lay::LayoutView::current ()->cellview (m_cv_index).is_valid ()) {
|
try {
|
||||||
mp_ui->lib_cbx->set_technology_filter (lay::LayoutView::current ()->cellview (m_cv_index)->tech_name (), true);
|
|
||||||
} else {
|
mp_ui->lib_cbx->blockSignals (true);
|
||||||
mp_ui->lib_cbx->set_technology_filter (std::string (), false);
|
|
||||||
|
mp_ui->lib_cbx->update_list ();
|
||||||
|
if (m_cv_index >= 0 && lay::LayoutView::current () && lay::LayoutView::current ()->cellview (m_cv_index).is_valid ()) {
|
||||||
|
mp_ui->lib_cbx->set_technology_filter (lay::LayoutView::current ()->cellview (m_cv_index)->tech_name (), true);
|
||||||
|
} else {
|
||||||
|
mp_ui->lib_cbx->set_technology_filter (std::string (), false);
|
||||||
|
}
|
||||||
|
|
||||||
|
// cell name
|
||||||
|
std::string s;
|
||||||
|
root->config_get (cfg_edit_inst_cell_name, s);
|
||||||
|
mp_ui->cell_le->setText (tl::to_qstring (s));
|
||||||
|
|
||||||
|
// library
|
||||||
|
std::string l;
|
||||||
|
root->config_get (cfg_edit_inst_lib_name, l);
|
||||||
|
mp_ui->lib_cbx->set_current_library (db::LibraryManager::instance ().lib_ptr_by_name (l));
|
||||||
|
|
||||||
|
mp_ui->lib_cbx->blockSignals (false);
|
||||||
|
update_cell_edits ();
|
||||||
|
|
||||||
|
} catch (...) {
|
||||||
|
mp_ui->lib_cbx->blockSignals (false);
|
||||||
|
throw;
|
||||||
}
|
}
|
||||||
|
|
||||||
// cell name
|
|
||||||
std::string s;
|
|
||||||
root->config_get (cfg_edit_inst_cell_name, s);
|
|
||||||
mp_ui->cell_le->setText (tl::to_qstring (s));
|
|
||||||
|
|
||||||
// library
|
|
||||||
std::string l;
|
|
||||||
root->config_get (cfg_edit_inst_lib_name, l);
|
|
||||||
mp_ui->lib_cbx->set_current_library (db::LibraryManager::instance ().lib_ptr_by_name (l));
|
|
||||||
|
|
||||||
// rotation, scaling
|
// rotation, scaling
|
||||||
double angle = 0.0;
|
double angle = 0.0;
|
||||||
root->config_get (cfg_edit_inst_angle, angle);
|
root->config_get (cfg_edit_inst_angle, angle);
|
||||||
|
|
@ -786,8 +820,8 @@ EditorOptionsInst::setup (lay::Plugin *root)
|
||||||
// ------------------------------------------------------------------
|
// ------------------------------------------------------------------
|
||||||
// EditorOptionsInstPCellParam implementation
|
// EditorOptionsInstPCellParam implementation
|
||||||
|
|
||||||
EditorOptionsInstPCellParam::EditorOptionsInstPCellParam (lay::Dispatcher *root)
|
EditorOptionsInstPCellParam::EditorOptionsInstPCellParam (lay::Dispatcher *dispatcher)
|
||||||
: QWidget (), EditorOptionsPage (), mp_root (root), mp_pcell_parameters (0), mp_placeholder_label (0)
|
: QWidget (), EditorOptionsPage (dispatcher), mp_pcell_parameters (0), mp_placeholder_label (0)
|
||||||
{
|
{
|
||||||
mp_ui = new Ui::EditorOptionsInstPCellParam ();
|
mp_ui = new Ui::EditorOptionsInstPCellParam ();
|
||||||
mp_ui->setupUi (this);
|
mp_ui->setupUi (this);
|
||||||
|
|
@ -806,7 +840,7 @@ EditorOptionsInstPCellParam::title () const
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
EditorOptionsInstPCellParam::apply (lay::Plugin *root)
|
EditorOptionsInstPCellParam::apply (lay::Dispatcher *root)
|
||||||
{
|
{
|
||||||
// pcell parameters
|
// pcell parameters
|
||||||
std::string param;
|
std::string param;
|
||||||
|
|
@ -833,7 +867,7 @@ EditorOptionsInstPCellParam::apply (lay::Plugin *root)
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
EditorOptionsInstPCellParam::setup (lay::Plugin *root)
|
EditorOptionsInstPCellParam::setup (lay::Dispatcher *root)
|
||||||
{
|
{
|
||||||
m_cv_index = -1;
|
m_cv_index = -1;
|
||||||
if (lay::LayoutView::current ()) {
|
if (lay::LayoutView::current ()) {
|
||||||
|
|
|
||||||
|
|
@ -65,14 +65,14 @@ class EditorOptionsPages;
|
||||||
class EditorOptionsPage
|
class EditorOptionsPage
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
EditorOptionsPage ();
|
EditorOptionsPage (lay::Dispatcher *dispatcher);
|
||||||
virtual ~EditorOptionsPage ();
|
virtual ~EditorOptionsPage ();
|
||||||
|
|
||||||
virtual QWidget *q_frame () = 0;
|
virtual QWidget *q_frame () = 0;
|
||||||
virtual std::string title () const = 0;
|
virtual std::string title () const = 0;
|
||||||
virtual int order () const = 0;
|
virtual int order () const = 0;
|
||||||
virtual void apply (lay::Plugin *root) = 0;
|
virtual void apply (lay::Dispatcher *root) = 0;
|
||||||
virtual void setup (lay::Plugin *root) = 0;
|
virtual void setup (lay::Dispatcher *root) = 0;
|
||||||
|
|
||||||
bool active () const { return m_active; }
|
bool active () const { return m_active; }
|
||||||
void activate (bool active);
|
void activate (bool active);
|
||||||
|
|
@ -81,10 +81,17 @@ public:
|
||||||
const lay::PluginDeclaration *plugin_declaration () const { return mp_plugin_declaration; }
|
const lay::PluginDeclaration *plugin_declaration () const { return mp_plugin_declaration; }
|
||||||
void set_plugin_declaration (const lay::PluginDeclaration *pd) { mp_plugin_declaration = pd; }
|
void set_plugin_declaration (const lay::PluginDeclaration *pd) { mp_plugin_declaration = pd; }
|
||||||
|
|
||||||
|
protected:
|
||||||
|
lay::Dispatcher *dispatcher () const
|
||||||
|
{
|
||||||
|
return mp_dispatcher;
|
||||||
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
EditorOptionsPages *mp_owner;
|
EditorOptionsPages *mp_owner;
|
||||||
bool m_active;
|
bool m_active;
|
||||||
const lay::PluginDeclaration *mp_plugin_declaration;
|
const lay::PluginDeclaration *mp_plugin_declaration;
|
||||||
|
lay::Dispatcher *mp_dispatcher;
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -129,15 +136,15 @@ class EditorOptionsGeneric
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
EditorOptionsGeneric ();
|
EditorOptionsGeneric (lay::Dispatcher *dispatcher);
|
||||||
~EditorOptionsGeneric ();
|
~EditorOptionsGeneric ();
|
||||||
|
|
||||||
virtual QWidget *q_frame () { return this; }
|
virtual QWidget *q_frame () { return this; }
|
||||||
|
|
||||||
virtual std::string title () const;
|
virtual std::string title () const;
|
||||||
virtual int order () const { return 0; }
|
virtual int order () const { return 0; }
|
||||||
void apply (lay::Plugin *root);
|
void apply (lay::Dispatcher *root);
|
||||||
void setup (lay::Plugin *root);
|
void setup (lay::Dispatcher *root);
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
void grid_changed (int);
|
void grid_changed (int);
|
||||||
|
|
@ -154,15 +161,15 @@ class EditorOptionsText
|
||||||
: public QWidget, public EditorOptionsPage
|
: public QWidget, public EditorOptionsPage
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
EditorOptionsText ();
|
EditorOptionsText (lay::Dispatcher *dispatcher);
|
||||||
~EditorOptionsText ();
|
~EditorOptionsText ();
|
||||||
|
|
||||||
virtual QWidget *q_frame () { return this; }
|
virtual QWidget *q_frame () { return this; }
|
||||||
|
|
||||||
virtual std::string title () const;
|
virtual std::string title () const;
|
||||||
virtual int order () const { return 10; }
|
virtual int order () const { return 10; }
|
||||||
void apply (lay::Plugin *root);
|
void apply (lay::Dispatcher *root);
|
||||||
void setup (lay::Plugin *root);
|
void setup (lay::Dispatcher *root);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Ui::EditorOptionsText *mp_ui;
|
Ui::EditorOptionsText *mp_ui;
|
||||||
|
|
@ -177,15 +184,15 @@ class EditorOptionsPath
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
EditorOptionsPath ();
|
EditorOptionsPath (lay::Dispatcher *dispatcher);
|
||||||
~EditorOptionsPath ();
|
~EditorOptionsPath ();
|
||||||
|
|
||||||
virtual QWidget *q_frame () { return this; }
|
virtual QWidget *q_frame () { return this; }
|
||||||
|
|
||||||
virtual std::string title () const;
|
virtual std::string title () const;
|
||||||
virtual int order () const { return 30; }
|
virtual int order () const { return 30; }
|
||||||
void apply (lay::Plugin *root);
|
void apply (lay::Dispatcher *root);
|
||||||
void setup (lay::Plugin *root);
|
void setup (lay::Dispatcher *root);
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
void type_changed (int);
|
void type_changed (int);
|
||||||
|
|
@ -210,20 +217,20 @@ public:
|
||||||
|
|
||||||
virtual std::string title () const;
|
virtual std::string title () const;
|
||||||
virtual int order () const { return 20; }
|
virtual int order () const { return 20; }
|
||||||
void apply (lay::Plugin *root);
|
void apply (lay::Dispatcher *root);
|
||||||
void setup (lay::Plugin *root);
|
void setup (lay::Dispatcher *root);
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
void array_changed ();
|
void array_changed ();
|
||||||
void browse_cell ();
|
void browse_cell ();
|
||||||
void update_pcell_parameters ();
|
void update_pcell_parameters ();
|
||||||
void library_changed (int index);
|
void library_changed ();
|
||||||
void cell_name_changed (const QString &s);
|
void cell_name_changed ();
|
||||||
void update_cell_edits ();
|
void update_cell_edits ();
|
||||||
|
void edited ();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Ui::EditorOptionsInst *mp_ui;
|
Ui::EditorOptionsInst *mp_ui;
|
||||||
lay::Dispatcher *mp_root;
|
|
||||||
edt::PCellParametersPage *mp_pcell_parameters;
|
edt::PCellParametersPage *mp_pcell_parameters;
|
||||||
int m_cv_index;
|
int m_cv_index;
|
||||||
|
|
||||||
|
|
@ -246,15 +253,14 @@ public:
|
||||||
|
|
||||||
virtual std::string title () const;
|
virtual std::string title () const;
|
||||||
virtual int order () const { return 21; }
|
virtual int order () const { return 21; }
|
||||||
void apply (lay::Plugin *root);
|
void apply (lay::Dispatcher *root);
|
||||||
void setup (lay::Plugin *root);
|
void setup (lay::Dispatcher *root);
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
void update_pcell_parameters ();
|
void update_pcell_parameters ();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Ui::EditorOptionsInstPCellParam *mp_ui;
|
Ui::EditorOptionsInstPCellParam *mp_ui;
|
||||||
lay::Dispatcher *mp_root;
|
|
||||||
edt::PCellParametersPage *mp_pcell_parameters;
|
edt::PCellParametersPage *mp_pcell_parameters;
|
||||||
QLabel *mp_placeholder_label;
|
QLabel *mp_placeholder_label;
|
||||||
int m_cv_index;
|
int m_cv_index;
|
||||||
|
|
|
||||||
|
|
@ -46,9 +46,9 @@ void get_text_options (std::vector < std::pair<std::string, std::string> > &opti
|
||||||
}
|
}
|
||||||
|
|
||||||
static
|
static
|
||||||
void get_text_editor_options_pages (std::vector<edt::EditorOptionsPage *> &ret, lay::Dispatcher *)
|
void get_text_editor_options_pages (std::vector<edt::EditorOptionsPage *> &ret, lay::Dispatcher *dispatcher)
|
||||||
{
|
{
|
||||||
ret.push_back (new edt::EditorOptionsText ());
|
ret.push_back (new edt::EditorOptionsText (dispatcher));
|
||||||
}
|
}
|
||||||
|
|
||||||
static
|
static
|
||||||
|
|
@ -61,9 +61,9 @@ void get_path_options (std::vector < std::pair<std::string, std::string> > &opti
|
||||||
}
|
}
|
||||||
|
|
||||||
static
|
static
|
||||||
void get_path_editor_options_pages (std::vector<edt::EditorOptionsPage *> &ret, lay::Dispatcher *)
|
void get_path_editor_options_pages (std::vector<edt::EditorOptionsPage *> &ret, lay::Dispatcher *dispatcher)
|
||||||
{
|
{
|
||||||
ret.push_back (new EditorOptionsPath ());
|
ret.push_back (new EditorOptionsPath (dispatcher));
|
||||||
}
|
}
|
||||||
|
|
||||||
static
|
static
|
||||||
|
|
@ -86,10 +86,10 @@ void get_inst_options (std::vector < std::pair<std::string, std::string> > &opti
|
||||||
}
|
}
|
||||||
|
|
||||||
static
|
static
|
||||||
void get_inst_editor_options_pages (std::vector<edt::EditorOptionsPage *> &ret, lay::Dispatcher *root)
|
void get_inst_editor_options_pages (std::vector<edt::EditorOptionsPage *> &ret, lay::Dispatcher *dispatcher)
|
||||||
{
|
{
|
||||||
ret.push_back (new EditorOptionsInstPCellParam (root));
|
ret.push_back (new EditorOptionsInstPCellParam (dispatcher));
|
||||||
ret.push_back (new EditorOptionsInst (root));
|
ret.push_back (new EditorOptionsInst (dispatcher));
|
||||||
}
|
}
|
||||||
|
|
||||||
template <class Svc>
|
template <class Svc>
|
||||||
|
|
@ -356,8 +356,7 @@ show_editor_options_page (lay::LayoutView *view)
|
||||||
}
|
}
|
||||||
|
|
||||||
std::vector<edt::EditorOptionsPage *> prop_dialog_pages;
|
std::vector<edt::EditorOptionsPage *> prop_dialog_pages;
|
||||||
EditorOptionsGeneric *generic_opt = new EditorOptionsGeneric ();
|
EditorOptionsGeneric *generic_opt = new EditorOptionsGeneric (view->dispatcher ());
|
||||||
generic_opt->setup (view->dispatcher ());
|
|
||||||
prop_dialog_pages.push_back (generic_opt);
|
prop_dialog_pages.push_back (generic_opt);
|
||||||
|
|
||||||
for (tl::Registrar<lay::PluginDeclaration>::iterator cls = tl::Registrar<lay::PluginDeclaration>::begin (); cls != tl::Registrar<lay::PluginDeclaration>::end (); ++cls) {
|
for (tl::Registrar<lay::PluginDeclaration>::iterator cls = tl::Registrar<lay::PluginDeclaration>::begin (); cls != tl::Registrar<lay::PluginDeclaration>::end (); ++cls) {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue