mirror of https://github.com/KLayout/klayout.git
Enhancements to cell name search feature. Needs more debugging.
This commit is contained in:
parent
9d349239b5
commit
71a7326fe9
|
|
@ -134,7 +134,7 @@ PropertiesPage::get_points (db::DPoint &p1, db::DPoint &p2)
|
|||
|
||||
try {
|
||||
tl::from_string (tl::to_string (x1->text ()), dx1);
|
||||
lay::indicate_error (x1, 0);
|
||||
lay::indicate_error (x1, (tl::Exception *) 0);
|
||||
} catch (tl::Exception &ex) {
|
||||
lay::indicate_error (x1, &ex);
|
||||
has_error = true;
|
||||
|
|
@ -142,7 +142,7 @@ PropertiesPage::get_points (db::DPoint &p1, db::DPoint &p2)
|
|||
|
||||
try {
|
||||
tl::from_string (tl::to_string (x2->text ()), dx2);
|
||||
lay::indicate_error (x2, 0);
|
||||
lay::indicate_error (x2, (tl::Exception *) 0);
|
||||
} catch (tl::Exception &ex) {
|
||||
lay::indicate_error (x2, &ex);
|
||||
has_error = true;
|
||||
|
|
@ -150,7 +150,7 @@ PropertiesPage::get_points (db::DPoint &p1, db::DPoint &p2)
|
|||
|
||||
try {
|
||||
tl::from_string (tl::to_string (y1->text ()), dy1);
|
||||
lay::indicate_error (y1, 0);
|
||||
lay::indicate_error (y1, (tl::Exception *) 0);
|
||||
} catch (tl::Exception &ex) {
|
||||
lay::indicate_error (y1, &ex);
|
||||
has_error = true;
|
||||
|
|
@ -158,7 +158,7 @@ PropertiesPage::get_points (db::DPoint &p1, db::DPoint &p2)
|
|||
|
||||
try {
|
||||
tl::from_string (tl::to_string (y2->text ()), dy2);
|
||||
lay::indicate_error (y2, 0);
|
||||
lay::indicate_error (y2, (tl::Exception *) 0);
|
||||
} catch (tl::Exception &ex) {
|
||||
lay::indicate_error (y2, &ex);
|
||||
has_error = true;
|
||||
|
|
|
|||
|
|
@ -60,7 +60,7 @@ static void configure_from_line_edit (lay::Dispatcher *dispatcher, QLineEdit *le
|
|||
Value value = Value (0);
|
||||
tl::from_string (tl::to_string (le->text ()), value);
|
||||
dispatcher->config_set (cfg_name, tl::to_string (value));
|
||||
lay::indicate_error (le, 0);
|
||||
lay::indicate_error (le, (tl::Exception *) 0);
|
||||
} catch (tl::Exception &ex) {
|
||||
lay::indicate_error (le, &ex);
|
||||
}
|
||||
|
|
@ -114,7 +114,7 @@ EditorOptionsGeneric::apply (lay::Dispatcher *root)
|
|||
try {
|
||||
db::DVector eg;
|
||||
egc.from_string_picky (tl::to_string (mp_ui->edit_grid_le->text ()), eg);
|
||||
lay::indicate_error (mp_ui->edit_grid_le, 0);
|
||||
lay::indicate_error (mp_ui->edit_grid_le, (tl::Exception *) 0);
|
||||
root->config_set (cfg_edit_grid, egc.to_string (eg));
|
||||
} catch (tl::Exception &ex) {
|
||||
lay::indicate_error (mp_ui->edit_grid_le, &ex);
|
||||
|
|
@ -166,7 +166,7 @@ EditorOptionsGeneric::setup (lay::Dispatcher *root)
|
|||
mp_ui->edit_grid_le->setText (tl::to_qstring (egc.to_string (eg)));
|
||||
}
|
||||
grid_changed (mp_ui->grid_cb->currentIndex ());
|
||||
lay::indicate_error (mp_ui->edit_grid_le, 0);
|
||||
lay::indicate_error (mp_ui->edit_grid_le, (tl::Exception *) 0);
|
||||
|
||||
// edit & move angle
|
||||
|
||||
|
|
@ -196,7 +196,7 @@ EditorOptionsGeneric::setup (lay::Dispatcher *root)
|
|||
unsigned int max_shapes = 1000;
|
||||
root->config_get (cfg_edit_max_shapes_of_instances, max_shapes);
|
||||
mp_ui->max_shapes_le->setText (tl::to_qstring (tl::to_string (max_shapes)));
|
||||
lay::indicate_error (mp_ui->max_shapes_le, 0);
|
||||
lay::indicate_error (mp_ui->max_shapes_le, (tl::Exception *) 0);
|
||||
|
||||
bool show_shapes = true;
|
||||
root->config_get (cfg_edit_show_shapes_of_instances, show_shapes);
|
||||
|
|
@ -356,7 +356,7 @@ EditorOptionsPath::setup (lay::Dispatcher *root)
|
|||
double w = 0.0;
|
||||
root->config_get (cfg_edit_path_width, w);
|
||||
mp_ui->width_le->setText (tl::to_qstring (tl::to_string (w)));
|
||||
lay::indicate_error (mp_ui->width_le, 0);
|
||||
lay::indicate_error (mp_ui->width_le, (tl::Exception *) 0);
|
||||
|
||||
// path type and extensions
|
||||
|
||||
|
|
@ -377,9 +377,9 @@ EditorOptionsPath::setup (lay::Dispatcher *root)
|
|||
root->config_get (cfg_edit_path_ext_var_begin, bgnext);
|
||||
root->config_get (cfg_edit_path_ext_var_end, endext);
|
||||
mp_ui->start_ext_le->setText (tl::to_qstring (tl::to_string (bgnext)));
|
||||
lay::indicate_error (mp_ui->start_ext_le, 0);
|
||||
lay::indicate_error (mp_ui->start_ext_le, (tl::Exception *) 0);
|
||||
mp_ui->end_ext_le->setText (tl::to_qstring (tl::to_string (endext)));
|
||||
lay::indicate_error (mp_ui->end_ext_le, 0);
|
||||
lay::indicate_error (mp_ui->end_ext_le, (tl::Exception *) 0);
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------------
|
||||
|
|
@ -631,7 +631,7 @@ EditorOptionsInst::setup (lay::Dispatcher *root)
|
|||
double angle = 0.0;
|
||||
root->config_get (cfg_edit_inst_angle, angle);
|
||||
mp_ui->angle_le->setText (tl::to_qstring (tl::to_string (angle)));
|
||||
lay::indicate_error (mp_ui->angle_le, 0);
|
||||
lay::indicate_error (mp_ui->angle_le, (tl::Exception *) 0);
|
||||
|
||||
bool mirror = false;
|
||||
root->config_get (cfg_edit_inst_mirror, mirror);
|
||||
|
|
@ -640,7 +640,7 @@ EditorOptionsInst::setup (lay::Dispatcher *root)
|
|||
double scale = 1.0;
|
||||
root->config_get (cfg_edit_inst_scale, scale);
|
||||
mp_ui->scale_le->setText (tl::to_qstring (tl::to_string (scale)));
|
||||
lay::indicate_error (mp_ui->scale_le, 0);
|
||||
lay::indicate_error (mp_ui->scale_le, (tl::Exception *) 0);
|
||||
|
||||
// array
|
||||
bool array = false;
|
||||
|
|
@ -657,17 +657,17 @@ EditorOptionsInst::setup (lay::Dispatcher *root)
|
|||
root->config_get (cfg_edit_inst_column_y, column_y);
|
||||
|
||||
mp_ui->rows_le->setText (tl::to_qstring (tl::to_string (rows)));
|
||||
lay::indicate_error (mp_ui->rows_le, 0);
|
||||
lay::indicate_error (mp_ui->rows_le, (tl::Exception *) 0);
|
||||
mp_ui->row_x_le->setText (tl::to_qstring (tl::to_string (row_x)));
|
||||
lay::indicate_error (mp_ui->row_x_le, 0);
|
||||
lay::indicate_error (mp_ui->row_x_le, (tl::Exception *) 0);
|
||||
mp_ui->row_y_le->setText (tl::to_qstring (tl::to_string (row_y)));
|
||||
lay::indicate_error (mp_ui->row_y_le, 0);
|
||||
lay::indicate_error (mp_ui->row_y_le, (tl::Exception *) 0);
|
||||
mp_ui->columns_le->setText (tl::to_qstring (tl::to_string (columns)));
|
||||
lay::indicate_error (mp_ui->columns_le, 0);
|
||||
lay::indicate_error (mp_ui->columns_le, (tl::Exception *) 0);
|
||||
mp_ui->column_x_le->setText (tl::to_qstring (tl::to_string (column_x)));
|
||||
lay::indicate_error (mp_ui->column_x_le, 0);
|
||||
lay::indicate_error (mp_ui->column_x_le, (tl::Exception *) 0);
|
||||
mp_ui->column_y_le->setText (tl::to_qstring (tl::to_string (column_y)));
|
||||
lay::indicate_error (mp_ui->column_y_le, 0);
|
||||
lay::indicate_error (mp_ui->column_y_le, (tl::Exception *) 0);
|
||||
|
||||
// place origin of cell flag
|
||||
bool place_origin = false;
|
||||
|
|
|
|||
|
|
@ -405,7 +405,7 @@ InstPropertiesPage::create_applicator (db::Cell & /*cell*/, const db::Instance &
|
|||
throw tl::Exception (tl::to_string (QObject::tr ("Not a valid cell or PCell name: %s")).c_str (), tl::to_string (cell_name_le->text ()).c_str ());
|
||||
}
|
||||
|
||||
lay::indicate_error (cell_name_le, 0);
|
||||
lay::indicate_error (cell_name_le, (tl::Exception *) 0);
|
||||
|
||||
} catch (tl::Exception &ex) {
|
||||
lay::indicate_error (cell_name_le, &ex);
|
||||
|
|
@ -447,7 +447,7 @@ InstPropertiesPage::create_applicator (db::Cell & /*cell*/, const db::Instance &
|
|||
|
||||
try {
|
||||
tl::from_string (tl::to_string (pos_x_le->text ()), x);
|
||||
lay::indicate_error (pos_x_le, 0);
|
||||
lay::indicate_error (pos_x_le, (tl::Exception *) 0);
|
||||
} catch (tl::Exception &ex) {
|
||||
lay::indicate_error (pos_x_le, &ex);
|
||||
has_error = true;
|
||||
|
|
@ -455,7 +455,7 @@ InstPropertiesPage::create_applicator (db::Cell & /*cell*/, const db::Instance &
|
|||
|
||||
try {
|
||||
tl::from_string (tl::to_string (pos_y_le->text ()), y);
|
||||
lay::indicate_error (pos_y_le, 0);
|
||||
lay::indicate_error (pos_y_le, (tl::Exception *) 0);
|
||||
} catch (tl::Exception &ex) {
|
||||
lay::indicate_error (pos_y_le, &ex);
|
||||
has_error = true;
|
||||
|
|
@ -472,7 +472,7 @@ InstPropertiesPage::create_applicator (db::Cell & /*cell*/, const db::Instance &
|
|||
double angle = 0.0;
|
||||
try {
|
||||
tl::from_string (tl::to_string (angle_le->text ()), angle);
|
||||
lay::indicate_error (angle_le, 0);
|
||||
lay::indicate_error (angle_le, (tl::Exception *) 0);
|
||||
} catch (tl::Exception &ex) {
|
||||
lay::indicate_error (angle_le, &ex);
|
||||
has_error = true;
|
||||
|
|
@ -481,7 +481,7 @@ InstPropertiesPage::create_applicator (db::Cell & /*cell*/, const db::Instance &
|
|||
double mag = 0.0;
|
||||
try {
|
||||
tl::from_string (tl::to_string (mag_le->text ()), mag);
|
||||
lay::indicate_error (mag_le, 0);
|
||||
lay::indicate_error (mag_le, (tl::Exception *) 0);
|
||||
} catch (tl::Exception &ex) {
|
||||
lay::indicate_error (mag_le, &ex);
|
||||
has_error = true;
|
||||
|
|
@ -510,7 +510,7 @@ InstPropertiesPage::create_applicator (db::Cell & /*cell*/, const db::Instance &
|
|||
|
||||
try {
|
||||
tl::from_string (tl::to_string (column_x_le->text ()), cx);
|
||||
lay::indicate_error (column_x_le, 0);
|
||||
lay::indicate_error (column_x_le, (tl::Exception *) 0);
|
||||
} catch (tl::Exception &ex) {
|
||||
lay::indicate_error (column_x_le, &ex);
|
||||
has_error = true;
|
||||
|
|
@ -518,7 +518,7 @@ InstPropertiesPage::create_applicator (db::Cell & /*cell*/, const db::Instance &
|
|||
|
||||
try {
|
||||
tl::from_string (tl::to_string (column_y_le->text ()), cy);
|
||||
lay::indicate_error (column_y_le, 0);
|
||||
lay::indicate_error (column_y_le, (tl::Exception *) 0);
|
||||
} catch (tl::Exception &ex) {
|
||||
lay::indicate_error (column_y_le, &ex);
|
||||
has_error = true;
|
||||
|
|
@ -526,7 +526,7 @@ InstPropertiesPage::create_applicator (db::Cell & /*cell*/, const db::Instance &
|
|||
|
||||
try {
|
||||
tl::from_string (tl::to_string (row_x_le->text ()), rx);
|
||||
lay::indicate_error (row_x_le, 0);
|
||||
lay::indicate_error (row_x_le, (tl::Exception *) 0);
|
||||
} catch (tl::Exception &ex) {
|
||||
lay::indicate_error (row_x_le, &ex);
|
||||
has_error = true;
|
||||
|
|
@ -534,7 +534,7 @@ InstPropertiesPage::create_applicator (db::Cell & /*cell*/, const db::Instance &
|
|||
|
||||
try {
|
||||
tl::from_string (tl::to_string (row_y_le->text ()), ry);
|
||||
lay::indicate_error (row_y_le, 0);
|
||||
lay::indicate_error (row_y_le, (tl::Exception *) 0);
|
||||
} catch (tl::Exception &ex) {
|
||||
lay::indicate_error (row_y_le, &ex);
|
||||
has_error = true;
|
||||
|
|
@ -542,7 +542,7 @@ InstPropertiesPage::create_applicator (db::Cell & /*cell*/, const db::Instance &
|
|||
|
||||
try {
|
||||
tl::from_string (tl::to_string (rows_le->text ()), rows);
|
||||
lay::indicate_error (rows_le, 0);
|
||||
lay::indicate_error (rows_le, (tl::Exception *) 0);
|
||||
} catch (tl::Exception &ex) {
|
||||
lay::indicate_error (rows_le, &ex);
|
||||
has_error = true;
|
||||
|
|
@ -550,7 +550,7 @@ InstPropertiesPage::create_applicator (db::Cell & /*cell*/, const db::Instance &
|
|||
|
||||
try {
|
||||
tl::from_string (tl::to_string (columns_le->text ()), cols);
|
||||
lay::indicate_error (columns_le, 0);
|
||||
lay::indicate_error (columns_le, (tl::Exception *) 0);
|
||||
} catch (tl::Exception &ex) {
|
||||
lay::indicate_error (columns_le, &ex);
|
||||
has_error = true;
|
||||
|
|
@ -766,7 +766,7 @@ InstPropertiesPage::update_pcell_parameters ()
|
|||
tl::Exception ex (tl::to_string (QObject::tr ("Not a valid cell or PCell name: %s")).c_str (), tl::to_string (cell_name_le->text ()).c_str ());
|
||||
lay::indicate_error (cell_name_le, &ex);
|
||||
} else {
|
||||
lay::indicate_error (cell_name_le, 0);
|
||||
lay::indicate_error (cell_name_le, (tl::Exception *) 0);
|
||||
}
|
||||
|
||||
if (pc.first && layout->pcell_declaration (pc.second)) {
|
||||
|
|
|
|||
|
|
@ -496,7 +496,7 @@ PCellParametersPage::get_parameters (bool *ok)
|
|||
tl::from_string (tl::to_string (le->text ()), v);
|
||||
|
||||
parameters.back () = tl::Variant (v);
|
||||
lay::indicate_error (le, 0);
|
||||
lay::indicate_error (le, (tl::Exception *) 0);
|
||||
|
||||
} catch (tl::Exception &ex) {
|
||||
|
||||
|
|
@ -520,7 +520,7 @@ PCellParametersPage::get_parameters (bool *ok)
|
|||
tl::from_string (tl::to_string (le->text ()), v);
|
||||
|
||||
parameters.back () = tl::Variant (v);
|
||||
lay::indicate_error (le, 0);
|
||||
lay::indicate_error (le, (tl::Exception *) 0);
|
||||
|
||||
} catch (tl::Exception &ex) {
|
||||
|
||||
|
|
|
|||
|
|
@ -509,7 +509,7 @@ PolygonPropertiesPage::create_applicator (db::Shapes & /*shapes*/, const db::Sha
|
|||
|
||||
}
|
||||
|
||||
lay::indicate_error (pointListEdit, 0);
|
||||
lay::indicate_error (pointListEdit, (tl::Exception *) 0);
|
||||
|
||||
} catch (tl::Exception &ex) {
|
||||
lay::indicate_error (pointListEdit, &ex);
|
||||
|
|
@ -609,7 +609,7 @@ BoxPropertiesPage::get_box (int mode) const
|
|||
|
||||
try {
|
||||
tl::from_string (tl::to_string (x1_le_1->text ()), x1);
|
||||
lay::indicate_error (x1_le_1, 0);
|
||||
lay::indicate_error (x1_le_1, (tl::Exception *) 0);
|
||||
} catch (tl::Exception &ex) {
|
||||
lay::indicate_error (x1_le_1, &ex);
|
||||
has_error = true;
|
||||
|
|
@ -617,7 +617,7 @@ BoxPropertiesPage::get_box (int mode) const
|
|||
|
||||
try {
|
||||
tl::from_string (tl::to_string (y1_le_1->text ()), y1);
|
||||
lay::indicate_error (y1_le_1, 0);
|
||||
lay::indicate_error (y1_le_1, (tl::Exception *) 0);
|
||||
} catch (tl::Exception &ex) {
|
||||
lay::indicate_error (y1_le_1, &ex);
|
||||
has_error = true;
|
||||
|
|
@ -625,7 +625,7 @@ BoxPropertiesPage::get_box (int mode) const
|
|||
|
||||
try {
|
||||
tl::from_string (tl::to_string (x2_le_1->text ()), x2);
|
||||
lay::indicate_error (x2_le_1, 0);
|
||||
lay::indicate_error (x2_le_1, (tl::Exception *) 0);
|
||||
} catch (tl::Exception &ex) {
|
||||
lay::indicate_error (x2_le_1, &ex);
|
||||
has_error = true;
|
||||
|
|
@ -633,7 +633,7 @@ BoxPropertiesPage::get_box (int mode) const
|
|||
|
||||
try {
|
||||
tl::from_string (tl::to_string (y2_le_1->text ()), y2);
|
||||
lay::indicate_error (y2_le_1, 0);
|
||||
lay::indicate_error (y2_le_1, (tl::Exception *) 0);
|
||||
} catch (tl::Exception &ex) {
|
||||
lay::indicate_error (y2_le_1, &ex);
|
||||
has_error = true;
|
||||
|
|
@ -669,7 +669,7 @@ BoxPropertiesPage::get_box (int mode) const
|
|||
|
||||
try {
|
||||
tl::from_string (tl::to_string (cx_le_2->text ()), cx);
|
||||
lay::indicate_error (cx_le_2, 0);
|
||||
lay::indicate_error (cx_le_2, (tl::Exception *) 0);
|
||||
} catch (tl::Exception &ex) {
|
||||
lay::indicate_error (cx_le_2, &ex);
|
||||
has_error = true;
|
||||
|
|
@ -677,7 +677,7 @@ BoxPropertiesPage::get_box (int mode) const
|
|||
|
||||
try {
|
||||
tl::from_string (tl::to_string (cy_le_2->text ()), cy);
|
||||
lay::indicate_error (cy_le_2, 0);
|
||||
lay::indicate_error (cy_le_2, (tl::Exception *) 0);
|
||||
} catch (tl::Exception &ex) {
|
||||
lay::indicate_error (cy_le_2, &ex);
|
||||
has_error = true;
|
||||
|
|
@ -685,7 +685,7 @@ BoxPropertiesPage::get_box (int mode) const
|
|||
|
||||
try {
|
||||
tl::from_string (tl::to_string (w_le_2->text ()), w);
|
||||
lay::indicate_error (w_le_2, 0);
|
||||
lay::indicate_error (w_le_2, (tl::Exception *) 0);
|
||||
} catch (tl::Exception &ex) {
|
||||
lay::indicate_error (w_le_2, &ex);
|
||||
has_error = true;
|
||||
|
|
@ -693,7 +693,7 @@ BoxPropertiesPage::get_box (int mode) const
|
|||
|
||||
try {
|
||||
tl::from_string (tl::to_string (h_le_2->text ()), h);
|
||||
lay::indicate_error (h_le_2, 0);
|
||||
lay::indicate_error (h_le_2, (tl::Exception *) 0);
|
||||
} catch (tl::Exception &ex) {
|
||||
lay::indicate_error (h_le_2, &ex);
|
||||
has_error = true;
|
||||
|
|
@ -834,7 +834,7 @@ TextPropertiesPage::create_applicator (db::Shapes & /*shapes*/, const db::Shape
|
|||
|
||||
try {
|
||||
tl::from_string (tl::to_string (x_le->text ()), x);
|
||||
lay::indicate_error (x_le, 0);
|
||||
lay::indicate_error (x_le, (tl::Exception *) 0);
|
||||
} catch (tl::Exception &ex) {
|
||||
lay::indicate_error (x_le, &ex);
|
||||
has_error = true;
|
||||
|
|
@ -842,7 +842,7 @@ TextPropertiesPage::create_applicator (db::Shapes & /*shapes*/, const db::Shape
|
|||
|
||||
try {
|
||||
tl::from_string (tl::to_string (y_le->text ()), y);
|
||||
lay::indicate_error (y_le, 0);
|
||||
lay::indicate_error (y_le, (tl::Exception *) 0);
|
||||
} catch (tl::Exception &ex) {
|
||||
lay::indicate_error (y_le, &ex);
|
||||
has_error = true;
|
||||
|
|
@ -875,7 +875,7 @@ TextPropertiesPage::create_applicator (db::Shapes & /*shapes*/, const db::Shape
|
|||
if (! size_le->text ().isEmpty ()) {
|
||||
try {
|
||||
size = coord_from_string (tl::to_string (size_le->text ()).c_str (), dbu, du, t);
|
||||
lay::indicate_error (size_le, 0);
|
||||
lay::indicate_error (size_le, (tl::Exception *) 0);
|
||||
} catch (tl::Exception &ex) {
|
||||
lay::indicate_error (size_le, &ex);
|
||||
has_error = true;
|
||||
|
|
@ -1084,7 +1084,7 @@ EditablePathPropertiesPage::create_applicator (db::Shapes & /*shapes*/, const db
|
|||
throw tl::Exception (tl::to_string (QObject::tr ("The path must have at least one point")));
|
||||
}
|
||||
|
||||
lay::indicate_error (ptlist_le, 0);
|
||||
lay::indicate_error (ptlist_le, (tl::Exception *) 0);
|
||||
|
||||
} catch (tl::Exception &ex) {
|
||||
lay::indicate_error (ptlist_le, &ex);
|
||||
|
|
@ -1094,7 +1094,7 @@ EditablePathPropertiesPage::create_applicator (db::Shapes & /*shapes*/, const db
|
|||
db::Coord w = 0;
|
||||
try {
|
||||
w = coord_from_string (tl::to_string (width_le->text ()).c_str (), dbu, du, t);
|
||||
lay::indicate_error (width_le, 0);
|
||||
lay::indicate_error (width_le, (tl::Exception *) 0);
|
||||
} catch (tl::Exception &ex) {
|
||||
lay::indicate_error (width_le, &ex);
|
||||
has_error = true;
|
||||
|
|
@ -1111,14 +1111,14 @@ EditablePathPropertiesPage::create_applicator (db::Shapes & /*shapes*/, const db
|
|||
case 2: // variable
|
||||
try {
|
||||
se = coord_from_string (tl::to_string (start_ext_le->text ()).c_str (), dbu, du, t);
|
||||
lay::indicate_error (start_ext_le, 0);
|
||||
lay::indicate_error (start_ext_le, (tl::Exception *) 0);
|
||||
} catch (tl::Exception &ex) {
|
||||
lay::indicate_error (start_ext_le, &ex);
|
||||
has_error = true;
|
||||
}
|
||||
try {
|
||||
ee = coord_from_string (tl::to_string (end_ext_le->text ()).c_str (), dbu, du, t);
|
||||
lay::indicate_error (end_ext_le, 0);
|
||||
lay::indicate_error (end_ext_le, (tl::Exception *) 0);
|
||||
} catch (tl::Exception &ex) {
|
||||
lay::indicate_error (end_ext_le, &ex);
|
||||
has_error = true;
|
||||
|
|
|
|||
|
|
@ -219,7 +219,7 @@ PropertiesPage::get_xmin_xmax (double &xmin, double &xmax, bool &has_error_out)
|
|||
|
||||
try {
|
||||
tl::from_string (tl::to_string (from_le->text ()), xmin);
|
||||
lay::indicate_error (from_le, 0);
|
||||
lay::indicate_error (from_le, (tl::Exception *) 0);
|
||||
} catch (tl::Exception &ex) {
|
||||
lay::indicate_error (from_le, &ex);
|
||||
has_error = true;
|
||||
|
|
@ -227,7 +227,7 @@ PropertiesPage::get_xmin_xmax (double &xmin, double &xmax, bool &has_error_out)
|
|||
|
||||
try {
|
||||
tl::from_string (tl::to_string (to_le->text ()), xmax);
|
||||
lay::indicate_error (to_le, 0);
|
||||
lay::indicate_error (to_le, (tl::Exception *) 0);
|
||||
} catch (tl::Exception &ex) {
|
||||
lay::indicate_error (to_le, &ex);
|
||||
has_error = true;
|
||||
|
|
@ -336,7 +336,7 @@ PropertiesPage::value_changed ()
|
|||
double x = 0.0;
|
||||
try {
|
||||
tl::from_string (tl::to_string (value_le->text ()), x);
|
||||
lay::indicate_error (value_le, 0);
|
||||
lay::indicate_error (value_le, (tl::Exception *) 0);
|
||||
} catch (tl::Exception &ex) {
|
||||
lay::indicate_error (value_le, &ex);
|
||||
has_error = true;
|
||||
|
|
@ -805,7 +805,7 @@ PropertiesPage::apply ()
|
|||
if (w <= 0.0 || h <= 0.0) {
|
||||
throw tl::Exception (tl::to_string (QObject::tr ("Pixel width or height must be positive, non-null values")));
|
||||
}
|
||||
lay::indicate_error (width_le, 0);
|
||||
lay::indicate_error (width_le, (tl::Exception *) 0);
|
||||
} catch (tl::Exception &ex) {
|
||||
lay::indicate_error (width_le, &ex);
|
||||
has_error = true;
|
||||
|
|
@ -813,7 +813,7 @@ PropertiesPage::apply ()
|
|||
|
||||
try {
|
||||
tl::from_string (tl::to_string (height_le->text ()), h);
|
||||
lay::indicate_error (height_le, 0);
|
||||
lay::indicate_error (height_le, (tl::Exception *) 0);
|
||||
} catch (tl::Exception &ex) {
|
||||
lay::indicate_error (height_le, &ex);
|
||||
has_error = true;
|
||||
|
|
@ -821,7 +821,7 @@ PropertiesPage::apply ()
|
|||
|
||||
try {
|
||||
tl::from_string (tl::to_string (x_offset_le->text ()), x);
|
||||
lay::indicate_error (x_offset_le, 0);
|
||||
lay::indicate_error (x_offset_le, (tl::Exception *) 0);
|
||||
} catch (tl::Exception &ex) {
|
||||
lay::indicate_error (x_offset_le, &ex);
|
||||
has_error = true;
|
||||
|
|
@ -829,7 +829,7 @@ PropertiesPage::apply ()
|
|||
|
||||
try {
|
||||
tl::from_string (tl::to_string (y_offset_le->text ()), y);
|
||||
lay::indicate_error (y_offset_le, 0);
|
||||
lay::indicate_error (y_offset_le, (tl::Exception *) 0);
|
||||
} catch (tl::Exception &ex) {
|
||||
lay::indicate_error (y_offset_le, &ex);
|
||||
has_error = true;
|
||||
|
|
@ -837,7 +837,7 @@ PropertiesPage::apply ()
|
|||
|
||||
try {
|
||||
tl::from_string (tl::to_string (angle_le->text ()), a);
|
||||
lay::indicate_error (angle_le, 0);
|
||||
lay::indicate_error (angle_le, (tl::Exception *) 0);
|
||||
} catch (tl::Exception &ex) {
|
||||
lay::indicate_error (angle_le, &ex);
|
||||
has_error = true;
|
||||
|
|
@ -848,7 +848,7 @@ PropertiesPage::apply ()
|
|||
if (sa <= -45 || sa >= 45) {
|
||||
throw tl::Exception (tl::to_string (QObject::tr ("The shear angle must be larger than -45 and less than 45 degree")));
|
||||
}
|
||||
lay::indicate_error (shear_le, 0);
|
||||
lay::indicate_error (shear_le, (tl::Exception *) 0);
|
||||
} catch (tl::Exception &ex) {
|
||||
lay::indicate_error (shear_le, &ex);
|
||||
has_error = true;
|
||||
|
|
@ -859,7 +859,7 @@ PropertiesPage::apply ()
|
|||
if (tx <= -90 || tx >= 90) {
|
||||
throw tl::Exception (tl::to_string (QObject::tr ("The perspective tilt angles must be larger than -90 and less than 90 degree")));
|
||||
}
|
||||
lay::indicate_error (persp_tx_le, 0);
|
||||
lay::indicate_error (persp_tx_le, (tl::Exception *) 0);
|
||||
} catch (tl::Exception &ex) {
|
||||
lay::indicate_error (persp_tx_le, &ex);
|
||||
has_error = true;
|
||||
|
|
@ -870,7 +870,7 @@ PropertiesPage::apply ()
|
|||
if (ty <= -90 || ty >= 90) {
|
||||
throw tl::Exception (tl::to_string (QObject::tr ("The perspective tilt angles must be larger than -90 and less than 90 degree")));
|
||||
}
|
||||
lay::indicate_error (persp_ty_le, 0);
|
||||
lay::indicate_error (persp_ty_le, (tl::Exception *) 0);
|
||||
} catch (tl::Exception &ex) {
|
||||
lay::indicate_error (persp_ty_le, &ex);
|
||||
has_error = true;
|
||||
|
|
|
|||
|
|
@ -87,7 +87,9 @@ struct cmp_cell_tree_item_vs_name_f
|
|||
// CellTreeItem implementation
|
||||
|
||||
CellTreeItem::CellTreeItem (const db::Layout *layout, bool is_pcell, size_t cell_or_pcell_index, bool flat, CellTreeModel::Sorting s)
|
||||
: mp_layout (layout), mp_parent (0), m_sorting (s), m_is_pcell (is_pcell), m_index (0), m_children (), m_cell_or_pcell_index (cell_or_pcell_index)
|
||||
: mp_layout (layout), mp_parent (0), m_sorting (s), m_is_pcell (is_pcell),
|
||||
m_index (0), m_tree_index (0),
|
||||
m_children (), m_cell_or_pcell_index (cell_or_pcell_index)
|
||||
{
|
||||
if (! flat && ! is_pcell) {
|
||||
m_child_count = int (mp_layout->cell (cell_or_pcell_index).child_cells ());
|
||||
|
|
@ -104,6 +106,16 @@ CellTreeItem::~CellTreeItem ()
|
|||
m_children.clear ();
|
||||
}
|
||||
|
||||
size_t
|
||||
CellTreeItem::assign_serial (size_t index, std::map<CellTreeItem *, size_t> &serial)
|
||||
{
|
||||
serial.insert (std::make_pair (this, index++));
|
||||
for (std::vector<CellTreeItem *>::iterator c = m_children.begin (); c != m_children.end (); ++c) {
|
||||
index = (*c)->assign_serial (index, serial);
|
||||
}
|
||||
return index;
|
||||
}
|
||||
|
||||
bool
|
||||
CellTreeItem::is_valid () const
|
||||
{
|
||||
|
|
@ -128,10 +140,22 @@ CellTreeItem::children () const
|
|||
return m_child_count;
|
||||
}
|
||||
|
||||
CellTreeItem *
|
||||
CellTreeItem::child (int index)
|
||||
int
|
||||
CellTreeItem::children_in (const std::set<const CellTreeItem *> &sel) const
|
||||
{
|
||||
if (! m_is_pcell && int (m_children.size ()) <= index) {
|
||||
size_t count = 0;
|
||||
for (std::vector<CellTreeItem *>::const_iterator c = m_children.begin (); c != m_children.end (); ++c) {
|
||||
if (sel.find (*c) != sel.end ()) {
|
||||
++count;
|
||||
}
|
||||
}
|
||||
return count;
|
||||
}
|
||||
|
||||
void
|
||||
CellTreeItem::ensure_children ()
|
||||
{
|
||||
if (! m_is_pcell && m_children.empty ()) {
|
||||
|
||||
// create a list of child sub-item
|
||||
|
||||
|
|
@ -146,10 +170,29 @@ CellTreeItem::child (int index)
|
|||
finish_children ();
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
CellTreeItem *
|
||||
CellTreeItem::child (int index)
|
||||
{
|
||||
ensure_children ();
|
||||
return m_children [index];
|
||||
}
|
||||
|
||||
CellTreeItem *
|
||||
CellTreeItem::child_in (const std::set<const CellTreeItem *> &sel, int index)
|
||||
{
|
||||
ensure_children ();
|
||||
|
||||
for (std::vector<CellTreeItem *>::const_iterator c = m_children.begin (); c != m_children.end (); ++c) {
|
||||
if (sel.find (*c) != sel.end () && index-- <= 0) {
|
||||
return *c;
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
void
|
||||
CellTreeItem::add_child (CellTreeItem *item)
|
||||
{
|
||||
|
|
@ -274,6 +317,7 @@ CellTreeModel::CellTreeModel (QWidget *parent, lay::LayoutView *view, int cv_ind
|
|||
|
||||
m_flat = ((flags & Flat) != 0) && ((flags & TopCells) == 0);
|
||||
m_pad = ((flags & NoPadding) == 0);
|
||||
m_filter_mode = false;
|
||||
|
||||
mp_layout = & view->cellview (cv_index)->layout ();
|
||||
mp_library = 0;
|
||||
|
|
@ -295,6 +339,7 @@ CellTreeModel::CellTreeModel (QWidget *parent, db::Layout *layout, unsigned int
|
|||
{
|
||||
m_flat = ((flags & Flat) != 0) && ((flags & TopCells) == 0);
|
||||
m_pad = ((flags & NoPadding) == 0);
|
||||
m_filter_mode = false;
|
||||
|
||||
mp_layout = layout;
|
||||
mp_library = 0;
|
||||
|
|
@ -316,6 +361,7 @@ CellTreeModel::CellTreeModel (QWidget *parent, db::Library *library, unsigned in
|
|||
{
|
||||
m_flat = ((flags & Flat) != 0) && ((flags & TopCells) == 0);
|
||||
m_pad = ((flags & NoPadding) == 0);
|
||||
m_filter_mode = false;
|
||||
|
||||
mp_layout = &library->layout ();
|
||||
mp_library = library;
|
||||
|
|
@ -475,6 +521,15 @@ CellTreeModel::do_configure (db::Layout *layout, db::Library *library, lay::Layo
|
|||
}
|
||||
}
|
||||
|
||||
void
|
||||
CellTreeModel::set_filter_mode (bool f)
|
||||
{
|
||||
if (f != m_filter_mode) {
|
||||
m_filter_mode = f;
|
||||
signal_data_changed ();
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
CellTreeModel::set_sorting (Sorting s)
|
||||
{
|
||||
|
|
@ -754,7 +809,7 @@ CellTreeModel::data (const QModelIndex &index, int role) const
|
|||
|
||||
} else if (role == Qt::BackgroundRole) {
|
||||
|
||||
if (m_selected_indexes_set.find (index) != m_selected_indexes_set.end ()) {
|
||||
if (m_selected_indexes_set.find (index.internalPointer ()) != m_selected_indexes_set.end ()) {
|
||||
// for selected items pick a color between Highlight and Base
|
||||
QPalette pl (mp_parent->palette ());
|
||||
QColor c1 = pl.color (QPalette::Highlight);
|
||||
|
|
@ -819,6 +874,8 @@ CellTreeModel::rowCount (const QModelIndex &parent) const
|
|||
} else if (! item->is_valid ()) {
|
||||
// for safety we return 0 children for invalid cells
|
||||
return 0;
|
||||
} else if (m_filter_mode && ! m_visible_cell_set.empty ()) {
|
||||
return int (item->children_in (m_visible_cell_set));
|
||||
} else {
|
||||
return int (item->children ());
|
||||
}
|
||||
|
|
@ -839,6 +896,8 @@ CellTreeModel::index (int row, int column, const QModelIndex &parent) const
|
|||
} else if (! item->is_valid ()) {
|
||||
// for safety we don't return valid child indexes for invalid cells
|
||||
return QModelIndex ();
|
||||
} else if (m_filter_mode && ! m_visible_cell_set.empty ()) {
|
||||
return createIndex (row, column, item->child_in (m_visible_cell_set, row));
|
||||
} else {
|
||||
return createIndex (row, column, item->child (row));
|
||||
}
|
||||
|
|
@ -862,9 +921,19 @@ CellTreeModel::parent (const QModelIndex &index) const
|
|||
if (! item) {
|
||||
return QModelIndex ();
|
||||
}
|
||||
|
||||
CellTreeItem *pitem = item->parent ();
|
||||
if (pitem) {
|
||||
return createIndex (int (pitem->index ()), index.column (), pitem);
|
||||
if (m_filter_mode && ! m_visible_cell_set.empty ()) {
|
||||
if (pitem->tree_index () == std::numeric_limits<size_t>::max ()) {
|
||||
// WARNING: invisible item!
|
||||
return QModelIndex ();
|
||||
} else {
|
||||
return createIndex (int (pitem->tree_index ()), index.column (), pitem);
|
||||
}
|
||||
} else {
|
||||
return createIndex (int (pitem->index ()), index.column (), pitem);
|
||||
}
|
||||
} else {
|
||||
return QModelIndex ();
|
||||
}
|
||||
|
|
@ -895,6 +964,13 @@ CellTreeModel::model_index (CellTreeItem *item) const
|
|||
{
|
||||
if (mp_layout->under_construction () || (mp_layout->manager () && mp_layout->manager ()->transacting ())) {
|
||||
return QModelIndex ();
|
||||
} else if (m_filter_mode && ! m_visible_cell_set.empty ()) {
|
||||
if (item->tree_index () == std::numeric_limits<size_t>::max ()) {
|
||||
// WARNING: invisible item!
|
||||
return QModelIndex ();
|
||||
} else {
|
||||
return createIndex (int (item->tree_index ()), 0, item);
|
||||
}
|
||||
} else {
|
||||
return createIndex (int (item->index ()), 0, item);
|
||||
}
|
||||
|
|
@ -963,12 +1039,58 @@ void
|
|||
CellTreeModel::clear_locate ()
|
||||
{
|
||||
m_selected_indexes.clear ();
|
||||
m_visible_cell_set.clear ();
|
||||
m_current_index = m_selected_indexes.begin ();
|
||||
m_selected_indexes_set.clear ();
|
||||
|
||||
signal_data_changed ();
|
||||
}
|
||||
|
||||
QModelIndex
|
||||
CellTreeModel::locate_next (const QModelIndex &index)
|
||||
{
|
||||
if (m_current_index == m_selected_indexes.end ()) {
|
||||
return QModelIndex ();
|
||||
} else if (! index.isValid ()) {
|
||||
return locate_next ();
|
||||
}
|
||||
|
||||
// easy case: the requested index is a selected one
|
||||
|
||||
for (std::vector <QModelIndex>::const_iterator i = m_selected_indexes.begin (); i != m_selected_indexes.end (); ++i) {
|
||||
if (i->internalPointer () == index.internalPointer ()) {
|
||||
m_current_index = i;
|
||||
if (++m_current_index == m_selected_indexes.end ()) {
|
||||
m_current_index = m_selected_indexes.begin ();
|
||||
}
|
||||
return *m_current_index;
|
||||
}
|
||||
}
|
||||
|
||||
// otherwise: search by sequential order
|
||||
|
||||
m_current_index = m_selected_indexes.begin ();
|
||||
|
||||
std::map<CellTreeItem *, size_t> serial_index;
|
||||
size_t seq = 0;
|
||||
for (size_t i = 0; i < m_toplevel.size (); ++i) {
|
||||
seq = m_toplevel [i]->assign_serial (seq, serial_index);
|
||||
}
|
||||
|
||||
size_t serial = serial_index [(CellTreeItem *) index.internalPointer ()];
|
||||
size_t next = 0;
|
||||
|
||||
for (std::vector <QModelIndex>::const_iterator i = m_selected_indexes.begin (); i != m_selected_indexes.end (); ++i) {
|
||||
size_t s = serial_index [(CellTreeItem *) i->internalPointer ()];
|
||||
if (s > serial && (next == 0 || s < next)) {
|
||||
next = s;
|
||||
m_current_index = i;
|
||||
}
|
||||
}
|
||||
|
||||
return *m_current_index;
|
||||
}
|
||||
|
||||
QModelIndex
|
||||
CellTreeModel::locate_next ()
|
||||
{
|
||||
|
|
@ -1005,19 +1127,41 @@ CellTreeModel::locate_prev ()
|
|||
}
|
||||
}
|
||||
|
||||
void
|
||||
bool
|
||||
CellTreeModel::search_children (const tl::GlobPattern &pattern, CellTreeItem *item)
|
||||
{
|
||||
bool any = false;
|
||||
size_t ti = 0;
|
||||
|
||||
int children = item->children ();
|
||||
for (int i = 0; i < children; ++i) {
|
||||
|
||||
CellTreeItem *c = item->child (i);
|
||||
if (c) {
|
||||
|
||||
bool visible = false;
|
||||
|
||||
if (c->name_matches (pattern)) {
|
||||
m_selected_indexes.push_back (model_index (c));
|
||||
visible = true;
|
||||
}
|
||||
search_children (pattern, c);
|
||||
if (search_children (pattern, c)) {
|
||||
visible = true;
|
||||
}
|
||||
|
||||
if (visible) {
|
||||
c->set_tree_index (ti++);
|
||||
m_visible_cell_set.insert (c);
|
||||
any = true;
|
||||
} else {
|
||||
c->set_tree_index (std::numeric_limits<size_t>::max ());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return any;
|
||||
}
|
||||
|
||||
QModelIndex
|
||||
|
|
@ -1027,27 +1171,67 @@ CellTreeModel::locate (const char *name, bool glob_pattern, bool case_sensitive,
|
|||
return QModelIndex ();
|
||||
}
|
||||
|
||||
QModelIndexList indexes = persistentIndexList ();
|
||||
|
||||
m_selected_indexes.clear ();
|
||||
m_visible_cell_set.clear ();
|
||||
|
||||
tl::GlobPattern p = tl::GlobPattern (std::string (name));
|
||||
p.set_case_sensitive (case_sensitive);
|
||||
p.set_exact (!glob_pattern);
|
||||
p.set_header_match (true);
|
||||
|
||||
size_t ti = 0;
|
||||
|
||||
for (std::vector <CellTreeItem *>::const_iterator lc = m_toplevel.begin (); lc != m_toplevel.end (); ++lc) {
|
||||
|
||||
bool visible = false;
|
||||
|
||||
if ((*lc)->name_matches (p)) {
|
||||
m_selected_indexes.push_back (model_index (*lc));
|
||||
visible = true;
|
||||
}
|
||||
if (! top_only) {
|
||||
search_children (p, *lc);
|
||||
if (! top_only && search_children (p, *lc)) {
|
||||
visible = true;
|
||||
}
|
||||
|
||||
if (visible) {
|
||||
(*lc)->set_tree_index (ti++);
|
||||
m_visible_cell_set.insert (*lc);
|
||||
} else {
|
||||
(*lc)->set_tree_index (std::numeric_limits<size_t>::max ());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
m_selected_indexes_set.clear ();
|
||||
m_selected_indexes_set.insert (m_selected_indexes.begin (), m_selected_indexes.end ());
|
||||
|
||||
for (std::vector <QModelIndex>::const_iterator i = m_selected_indexes.begin (); i != m_selected_indexes.end (); ++i) {
|
||||
m_selected_indexes_set.insert (i->internalPointer ());
|
||||
}
|
||||
|
||||
// re-layout the items
|
||||
|
||||
if (m_filter_mode) {
|
||||
|
||||
QModelIndexList new_indexes;
|
||||
|
||||
for (QModelIndexList::iterator i = indexes.begin (); i != indexes.end (); ++i) {
|
||||
CellTreeItem *item = (CellTreeItem *) i->internalPointer ();
|
||||
if (m_visible_cell_set.find (item) != m_visible_cell_set.end ()) {
|
||||
new_indexes.push_back (model_index (item));
|
||||
} else {
|
||||
new_indexes.push_back (QModelIndex ());
|
||||
}
|
||||
}
|
||||
|
||||
changePersistentIndexList (indexes, new_indexes);
|
||||
|
||||
}
|
||||
|
||||
signal_data_changed ();
|
||||
|
||||
// make the first selected one current
|
||||
|
||||
m_current_index = m_selected_indexes.begin ();
|
||||
if (m_current_index == m_selected_indexes.end ()) {
|
||||
return QModelIndex ();
|
||||
|
|
|
|||
|
|
@ -202,6 +202,11 @@ public:
|
|||
*/
|
||||
QModelIndex locate_prev ();
|
||||
|
||||
/**
|
||||
* @brief Resets the search pointer to the one next to the given index
|
||||
*/
|
||||
QModelIndex locate_next (const QModelIndex &index);
|
||||
|
||||
/**
|
||||
* @brief Clears the locate flags
|
||||
*/
|
||||
|
|
@ -220,6 +225,19 @@ public:
|
|||
return m_sorting;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Sets a flag indicating whether selected indexes are filtered or highlighted
|
||||
*/
|
||||
void set_filter_mode (bool f);
|
||||
|
||||
/**
|
||||
* @brief Gets a flag indicating whether selected indexes are filtered or highlighted
|
||||
*/
|
||||
bool get_filter_mode () const
|
||||
{
|
||||
return m_filter_mode;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Signal to the owner of the model that the data has changed
|
||||
*
|
||||
|
|
@ -238,7 +256,7 @@ public:
|
|||
}
|
||||
|
||||
private:
|
||||
bool m_flat, m_pad;
|
||||
bool m_flat, m_pad, m_filter_mode;
|
||||
unsigned int m_flags;
|
||||
Sorting m_sorting;
|
||||
QWidget *mp_parent;
|
||||
|
|
@ -248,13 +266,14 @@ private:
|
|||
int m_cv_index;
|
||||
const db::Cell *mp_base;
|
||||
std::vector <CellTreeItem *> m_toplevel;
|
||||
std::set <QModelIndex> m_selected_indexes_set;
|
||||
std::set <void *> m_selected_indexes_set;
|
||||
std::set<const CellTreeItem *> m_visible_cell_set;
|
||||
std::vector <QModelIndex> m_selected_indexes;
|
||||
std::vector <QModelIndex>::const_iterator m_current_index;
|
||||
|
||||
void build_top_level ();
|
||||
void clear_top_level ();
|
||||
void search_children (const tl::GlobPattern &pattern, CellTreeItem *item);
|
||||
bool search_children (const tl::GlobPattern &pattern, CellTreeItem *item);
|
||||
void do_configure (db::Layout *layout, db::Library *library, lay::LayoutView *view, int cv_index, unsigned int flags, const db::Cell *base, Sorting sorting);
|
||||
};
|
||||
|
||||
|
|
@ -271,7 +290,9 @@ public:
|
|||
~CellTreeItem ();
|
||||
|
||||
int children () const;
|
||||
int children_in (const std::set<const CellTreeItem *> &sel) const;
|
||||
CellTreeItem *child (int index);
|
||||
CellTreeItem *child_in (const std::set<const CellTreeItem *> &sel, int index);
|
||||
db::cell_index_type cell_or_pcell_index () const;
|
||||
CellTreeItem *parent () const;
|
||||
bool by_name_less_than (const CellTreeItem *b) const;
|
||||
|
|
@ -300,17 +321,30 @@ public:
|
|||
m_index = index;
|
||||
}
|
||||
|
||||
size_t tree_index () const
|
||||
{
|
||||
return m_tree_index;
|
||||
}
|
||||
|
||||
void set_tree_index (size_t index)
|
||||
{
|
||||
m_tree_index = index;
|
||||
}
|
||||
|
||||
size_t assign_serial (size_t index, std::map<CellTreeItem *, size_t> &serial);
|
||||
|
||||
private:
|
||||
const db::Layout *mp_layout;
|
||||
CellTreeItem *mp_parent;
|
||||
CellTreeModel::Sorting m_sorting;
|
||||
bool m_is_pcell;
|
||||
size_t m_index;
|
||||
size_t m_index, m_tree_index;
|
||||
std::vector<CellTreeItem *> m_children;
|
||||
int m_child_count;
|
||||
size_t m_cell_or_pcell_index;
|
||||
|
||||
const char *name () const;
|
||||
void ensure_children ();
|
||||
};
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -205,7 +205,7 @@ static void configure_from_line_edit (lay::Dispatcher *dispatcher, QLineEdit *le
|
|||
Value value = Value (0);
|
||||
tl::from_string (tl::to_string (le->text ()), value);
|
||||
dispatcher->config_set (cfg_name, tl::to_string (value));
|
||||
lay::indicate_error (le, 0);
|
||||
lay::indicate_error (le, (tl::Exception *) 0);
|
||||
} catch (tl::Exception &ex) {
|
||||
lay::indicate_error (le, &ex);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -46,6 +46,7 @@
|
|||
#include "layCellTreeModel.h"
|
||||
#include "layLayoutView.h"
|
||||
#include "layAbstractMenu.h"
|
||||
#include "layQtTools.h"
|
||||
#include "layDialogs.h"
|
||||
#include "tlExceptions.h"
|
||||
#include "laybasicConfig.h"
|
||||
|
|
@ -264,11 +265,18 @@ HierarchyControlPanel::HierarchyControlPanel (lay::LayoutView *view, QWidget *pa
|
|||
mp_case_sensitive->setChecked (true);
|
||||
mp_case_sensitive->setText (tr ("Case sensitive search"));
|
||||
|
||||
mp_filter = new QAction (this);
|
||||
mp_filter->setCheckable (true);
|
||||
mp_filter->setChecked (false);
|
||||
mp_filter->setText (tr ("Apply as filter"));
|
||||
|
||||
QMenu *m = new QMenu (mp_search_edit_box);
|
||||
m->addAction (mp_use_regular_expressions);
|
||||
m->addAction (mp_case_sensitive);
|
||||
m->addAction (mp_filter);
|
||||
connect (mp_use_regular_expressions, SIGNAL (triggered ()), this, SLOT (search_edited ()));
|
||||
connect (mp_case_sensitive, SIGNAL (triggered ()), this, SLOT (search_edited ()));
|
||||
connect (mp_filter, SIGNAL (triggered ()), this, SLOT (search_edited ()));
|
||||
|
||||
mp_search_edit_box->set_clear_button_enabled (true);
|
||||
mp_search_edit_box->set_options_button_enabled (true);
|
||||
|
|
@ -426,6 +434,10 @@ HierarchyControlPanel::search_triggered (const QString &t)
|
|||
void
|
||||
HierarchyControlPanel::search_edited ()
|
||||
{
|
||||
bool filter_invalid = false;
|
||||
|
||||
mp_search_model->set_filter_mode (mp_filter->isChecked ());
|
||||
|
||||
QString t = mp_search_edit_box->text ();
|
||||
|
||||
for (std::vector <QTreeView *>::const_iterator v = mp_cell_lists.begin (); v != mp_cell_lists.end (); ++v) {
|
||||
|
|
@ -438,11 +450,15 @@ HierarchyControlPanel::search_edited ()
|
|||
(*v)->setCurrentIndex (found);
|
||||
if (found.isValid ()) {
|
||||
(*v)->scrollTo (found);
|
||||
} else {
|
||||
filter_invalid = true;
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
lay::indicate_error (mp_search_edit_box, filter_invalid);
|
||||
}
|
||||
|
||||
void
|
||||
|
|
@ -450,7 +466,7 @@ HierarchyControlPanel::search_next ()
|
|||
{
|
||||
for (std::vector <QTreeView *>::const_iterator v = mp_cell_lists.begin (); v != mp_cell_lists.end (); ++v) {
|
||||
if ((*v)->model () == mp_search_model) {
|
||||
QModelIndex found = mp_search_model->locate_next ();
|
||||
QModelIndex found = mp_search_model->locate_next ((*v)->currentIndex ());
|
||||
if (found.isValid ()) {
|
||||
(*v)->setCurrentIndex (found);
|
||||
(*v)->scrollTo (found);
|
||||
|
|
@ -786,6 +802,9 @@ void
|
|||
HierarchyControlPanel::do_update_content (int cv_index)
|
||||
{
|
||||
// close the search box since we will modify the model
|
||||
if (mp_search_model) {
|
||||
mp_search_model->clear_locate ();
|
||||
}
|
||||
mp_search_frame->hide ();
|
||||
mp_search_model = 0;
|
||||
|
||||
|
|
@ -1199,7 +1218,7 @@ public:
|
|||
menu_entries.push_back (lay::menu_item ("cm_cell_show", "show_cell", at, tl::to_string (QObject::tr ("Show"))));
|
||||
menu_entries.push_back (lay::menu_item ("cm_cell_show_all", "show_all", at, tl::to_string (QObject::tr ("Show All"))));
|
||||
menu_entries.push_back (lay::separator ("utils_group", at));
|
||||
menu_entries.push_back (lay::menu_item ("cm_open_current_cell", "open_current", at, tl::to_string (QObject::tr ("Where Am I?"))));
|
||||
menu_entries.push_back (lay::menu_item ("cm_open_current_cell", "open_current", at, tl::to_string (QObject::tr ("Where am I?"))));
|
||||
menu_entries.push_back (lay::separator ("file_group", at));
|
||||
menu_entries.push_back (lay::menu_item ("cm_save_current_cell_as", "save_cell_as:hide_vo", at, tl::to_string (QObject::tr ("Save Selected Cells As"))));
|
||||
}
|
||||
|
|
|
|||
|
|
@ -298,6 +298,7 @@ private:
|
|||
lay::DecoratedLineEdit *mp_search_edit_box;
|
||||
QAction *mp_case_sensitive;
|
||||
QAction *mp_use_regular_expressions;
|
||||
QAction *mp_filter;
|
||||
CellTreeModel *mp_search_model;
|
||||
QFrame *mp_search_frame;
|
||||
QCheckBox *mp_search_close_cb;
|
||||
|
|
|
|||
|
|
@ -162,19 +162,29 @@ restore_dialog_state (QWidget *dialog, const std::string &s, bool with_section_s
|
|||
|
||||
void
|
||||
indicate_error (QWidget *le, const tl::Exception *ex)
|
||||
{
|
||||
if (ex) {
|
||||
indicate_error (le, true);
|
||||
le->setToolTip (tl::to_qstring (ex->msg ()));
|
||||
} else {
|
||||
indicate_error (le, false);
|
||||
le->setToolTip (QString ());
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
indicate_error (QWidget *le, bool f)
|
||||
{
|
||||
// by the way, update the foreground color of the cell edit box as well (red, if not valid)
|
||||
QPalette pl = le->palette ();
|
||||
if (ex) {
|
||||
if (f) {
|
||||
pl.setColor (QPalette::Active, QPalette::Text, Qt::red);
|
||||
pl.setColor (QPalette::Active, QPalette::Base, QColor (Qt::red).lighter (180));
|
||||
le->setToolTip (tl::to_qstring (ex->msg ()));
|
||||
} 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->setToolTip (QString ());
|
||||
}
|
||||
le->setPalette (pl);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -76,6 +76,11 @@ LAYBASIC_PUBLIC void register_help_handler (QObject *object, const char *slot, c
|
|||
*/
|
||||
LAYBASIC_PUBLIC void indicate_error (QWidget *le, const tl::Exception *ex);
|
||||
|
||||
/**
|
||||
* @brief Configures a QLineEdit or other widget to indicate an error
|
||||
*/
|
||||
LAYBASIC_PUBLIC void indicate_error (QWidget *le, bool error);
|
||||
|
||||
} // namespace lay
|
||||
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -400,7 +400,7 @@ LEFDEFReaderOptionsEditor::commit (db::FormatSpecificReaderOptions *options, con
|
|||
ex.read (v);
|
||||
ex.expect_end ();
|
||||
data->set_net_property_name (v);
|
||||
indicate_error (net_prop_name, 0);
|
||||
indicate_error (net_prop_name, (tl::Exception *) 0);
|
||||
} catch (tl::Exception &ex) {
|
||||
indicate_error (net_prop_name, &ex);
|
||||
has_error = true;
|
||||
|
|
@ -414,7 +414,7 @@ LEFDEFReaderOptionsEditor::commit (db::FormatSpecificReaderOptions *options, con
|
|||
ex.read (v);
|
||||
ex.expect_end ();
|
||||
data->set_inst_property_name (v);
|
||||
indicate_error (inst_prop_name, 0);
|
||||
indicate_error (inst_prop_name, (tl::Exception *) 0);
|
||||
} catch (tl::Exception &ex) {
|
||||
indicate_error (inst_prop_name, &ex);
|
||||
has_error = true;
|
||||
|
|
@ -428,7 +428,7 @@ LEFDEFReaderOptionsEditor::commit (db::FormatSpecificReaderOptions *options, con
|
|||
ex.read (v);
|
||||
ex.expect_end ();
|
||||
data->set_pin_property_name (v);
|
||||
indicate_error (pin_prop_name, 0);
|
||||
indicate_error (pin_prop_name, (tl::Exception *) 0);
|
||||
} catch (tl::Exception &ex) {
|
||||
indicate_error (pin_prop_name, &ex);
|
||||
has_error = true;
|
||||
|
|
@ -441,7 +441,7 @@ LEFDEFReaderOptionsEditor::commit (db::FormatSpecificReaderOptions *options, con
|
|||
tl::Extractor ex (s.c_str ());
|
||||
lp.read (ex);
|
||||
ex.expect_end ();
|
||||
indicate_error (outline_layer, 0);
|
||||
indicate_error (outline_layer, (tl::Exception *) 0);
|
||||
} catch (tl::Exception &ex) {
|
||||
indicate_error (outline_layer, &ex);
|
||||
has_error = true;
|
||||
|
|
@ -454,7 +454,7 @@ LEFDEFReaderOptionsEditor::commit (db::FormatSpecificReaderOptions *options, con
|
|||
tl::Extractor ex (s.c_str ());
|
||||
lp.read (ex);
|
||||
ex.expect_end ();
|
||||
indicate_error (region_layer, 0);
|
||||
indicate_error (region_layer, (tl::Exception *) 0);
|
||||
} catch (tl::Exception &ex) {
|
||||
indicate_error (region_layer, &ex);
|
||||
has_error = true;
|
||||
|
|
@ -467,7 +467,7 @@ LEFDEFReaderOptionsEditor::commit (db::FormatSpecificReaderOptions *options, con
|
|||
tl::Extractor ex (s.c_str ());
|
||||
lp.read (ex);
|
||||
ex.expect_end ();
|
||||
indicate_error (placement_blockage_layer, 0);
|
||||
indicate_error (placement_blockage_layer, (tl::Exception *) 0);
|
||||
} catch (tl::Exception &ex) {
|
||||
indicate_error (placement_blockage_layer, &ex);
|
||||
has_error = true;
|
||||
|
|
|
|||
Loading…
Reference in New Issue