mirror of
https://github.com/KLayout/klayout.git
synced 2026-08-31 18:16:08 +02:00
Less expression evaluation for more robustness
This commit is contained in:
@@ -224,10 +224,10 @@ void
|
||||
BrowseInstancesConfigPage::commit (lay::Dispatcher *root)
|
||||
{
|
||||
double dim = 1.0;
|
||||
tl::from_string (tl::to_string (le_window->text ()), dim);
|
||||
tl::from_string_ext (tl::to_string (le_window->text ()), dim);
|
||||
|
||||
unsigned int max_inst_count = 1000;
|
||||
tl::from_string (tl::to_string (le_max_count->text ()), max_inst_count);
|
||||
tl::from_string_ext (tl::to_string (le_max_count->text ()), max_inst_count);
|
||||
|
||||
root->config_set (cfg_cib_context_cell, tl::to_string (le_cell_name->text ()));
|
||||
root->config_set (cfg_cib_context_mode, BrowseInstancesForm::mode_type (cbx_context->currentIndex ()), BrowseInstancesContextModeConverter ());
|
||||
|
||||
@@ -231,13 +231,13 @@ void
|
||||
BrowseShapesConfigPage::commit (lay::Dispatcher *root)
|
||||
{
|
||||
double dim = 1.0;
|
||||
tl::from_string (tl::to_string (le_window->text ()), dim);
|
||||
tl::from_string_ext (tl::to_string (le_window->text ()), dim);
|
||||
|
||||
unsigned int max_inst_count = 1000;
|
||||
tl::from_string (tl::to_string (le_max_inst->text ()), max_inst_count);
|
||||
tl::from_string_ext (tl::to_string (le_max_inst->text ()), max_inst_count);
|
||||
|
||||
unsigned int max_shape_count = 1000;
|
||||
tl::from_string (tl::to_string (le_max_shapes->text ()), max_shape_count);
|
||||
tl::from_string_ext (tl::to_string (le_max_shapes->text ()), max_shape_count);
|
||||
|
||||
root->config_set (cfg_shb_context_cell, tl::to_string (le_cell_name->text ()));
|
||||
root->config_set (cfg_shb_context_mode, BrowseShapesForm::mode_type (cbx_context->currentIndex ()), BrowseShapesContextModeConverter ());
|
||||
|
||||
@@ -170,9 +170,9 @@ NewLayoutPropertiesDialog::exec_dialog (std::string &technology, std::string &ce
|
||||
technology = std::string ();
|
||||
}
|
||||
|
||||
tl::from_string (tl::to_string (mp_ui->window_le->text ()), size);
|
||||
tl::from_string_ext (tl::to_string (mp_ui->window_le->text ()), size);
|
||||
if (! mp_ui->dbu_le->text ().isEmpty ()) {
|
||||
tl::from_string (tl::to_string (mp_ui->dbu_le->text ()), dbu);
|
||||
tl::from_string_ext (tl::to_string (mp_ui->dbu_le->text ()), dbu);
|
||||
} else {
|
||||
dbu = 0.0;
|
||||
}
|
||||
@@ -207,9 +207,9 @@ NewLayoutPropertiesDialog::accept ()
|
||||
BEGIN_PROTECTED;
|
||||
|
||||
double x = 0.0;
|
||||
tl::from_string (tl::to_string (mp_ui->window_le->text ()), x);
|
||||
tl::from_string_ext (tl::to_string (mp_ui->window_le->text ()), x);
|
||||
if (!mp_ui->dbu_le->text ().isEmpty ()) {
|
||||
tl::from_string (tl::to_string (mp_ui->dbu_le->text ()), x);
|
||||
tl::from_string_ext (tl::to_string (mp_ui->dbu_le->text ()), x);
|
||||
}
|
||||
|
||||
if (mp_ui->topcell_le->text ().isEmpty ()) {
|
||||
@@ -250,7 +250,7 @@ NewCellPropertiesDialog::exec_dialog (const db::Layout *layout, std::string &cel
|
||||
|
||||
if (QDialog::exec ()) {
|
||||
|
||||
tl::from_string (tl::to_string (mp_ui->window_le->text ()), size);
|
||||
tl::from_string_ext (tl::to_string (mp_ui->window_le->text ()), size);
|
||||
cell_name = tl::to_string (mp_ui->name_le->text ());
|
||||
return true;
|
||||
|
||||
@@ -265,7 +265,7 @@ NewCellPropertiesDialog::accept ()
|
||||
BEGIN_PROTECTED;
|
||||
|
||||
double x = 0.0;
|
||||
tl::from_string (tl::to_string (mp_ui->window_le->text ()), x);
|
||||
tl::from_string_ext (tl::to_string (mp_ui->window_le->text ()), x);
|
||||
|
||||
if (mp_layout->cell_by_name (tl::to_string (mp_ui->name_le->text ()).c_str ()).first) {
|
||||
throw tl::Exception (tl::to_string (QObject::tr ("A cell with that name already exists: %s")), tl::to_string (mp_ui->name_le->text ()));
|
||||
@@ -335,14 +335,14 @@ NewLayerPropertiesDialog::get (db::LayerProperties &src)
|
||||
{
|
||||
if (! mp_ui->layer_le->text ().isEmpty ()) {
|
||||
int l = -1;
|
||||
tl::from_string (tl::to_string (mp_ui->layer_le->text ()), l);
|
||||
tl::from_string_ext (tl::to_string (mp_ui->layer_le->text ()), l);
|
||||
src.layer = l;
|
||||
} else {
|
||||
src.layer = -1;
|
||||
}
|
||||
if (! mp_ui->datatype_le->text ().isEmpty ()) {
|
||||
int d = -1;
|
||||
tl::from_string (tl::to_string (mp_ui->datatype_le->text ()), d);
|
||||
tl::from_string_ext (tl::to_string (mp_ui->datatype_le->text ()), d);
|
||||
src.datatype = d;
|
||||
} else {
|
||||
src.datatype = -1;
|
||||
@@ -395,8 +395,8 @@ MoveOptionsDialog::exec_dialog (db::DVector &disp)
|
||||
if (QDialog::exec ()) {
|
||||
|
||||
double x = 0.0, y = 0.0;
|
||||
tl::from_string (tl::to_string (mp_ui->disp_x_le->text ()), x);
|
||||
tl::from_string (tl::to_string (mp_ui->disp_y_le->text ()), y);
|
||||
tl::from_string_ext (tl::to_string (mp_ui->disp_x_le->text ()), x);
|
||||
tl::from_string_ext (tl::to_string (mp_ui->disp_y_le->text ()), y);
|
||||
|
||||
disp = db::DVector (x, y);
|
||||
|
||||
@@ -412,8 +412,8 @@ MoveOptionsDialog::accept ()
|
||||
{
|
||||
BEGIN_PROTECTED;
|
||||
double x = 0.0;
|
||||
tl::from_string (tl::to_string (mp_ui->disp_x_le->text ()), x);
|
||||
tl::from_string (tl::to_string (mp_ui->disp_y_le->text ()), x);
|
||||
tl::from_string_ext (tl::to_string (mp_ui->disp_x_le->text ()), x);
|
||||
tl::from_string_ext (tl::to_string (mp_ui->disp_y_le->text ()), x);
|
||||
QDialog::accept ();
|
||||
END_PROTECTED;
|
||||
}
|
||||
@@ -470,8 +470,8 @@ MoveToOptionsDialog::exec_dialog (int &mode_x, int &mode_y, db::DPoint &target)
|
||||
}
|
||||
|
||||
double x = 0.0, y = 0.0;
|
||||
tl::from_string (tl::to_string (mp_ui->x_le->text ()), x);
|
||||
tl::from_string (tl::to_string (mp_ui->y_le->text ()), y);
|
||||
tl::from_string_ext (tl::to_string (mp_ui->x_le->text ()), x);
|
||||
tl::from_string_ext (tl::to_string (mp_ui->y_le->text ()), y);
|
||||
|
||||
target = db::DPoint (x, y);
|
||||
|
||||
@@ -487,8 +487,8 @@ MoveToOptionsDialog::accept ()
|
||||
{
|
||||
BEGIN_PROTECTED;
|
||||
double x = 0.0;
|
||||
tl::from_string (tl::to_string (mp_ui->x_le->text ()), x);
|
||||
tl::from_string (tl::to_string (mp_ui->y_le->text ()), x);
|
||||
tl::from_string_ext (tl::to_string (mp_ui->x_le->text ()), x);
|
||||
tl::from_string_ext (tl::to_string (mp_ui->y_le->text ()), x);
|
||||
QDialog::accept ();
|
||||
END_PROTECTED;
|
||||
}
|
||||
@@ -955,8 +955,8 @@ AlignCellOptionsDialog::exec_dialog (AlignCellOptions &data)
|
||||
}
|
||||
}
|
||||
|
||||
tl::from_string (tl::to_string (mp_ui->x_le->text ()), data.xpos);
|
||||
tl::from_string (tl::to_string (mp_ui->y_le->text ()), data.ypos);
|
||||
tl::from_string_ext (tl::to_string (mp_ui->x_le->text ()), data.xpos);
|
||||
tl::from_string_ext (tl::to_string (mp_ui->y_le->text ()), data.ypos);
|
||||
|
||||
return true;
|
||||
|
||||
@@ -971,8 +971,8 @@ AlignCellOptionsDialog::accept ()
|
||||
BEGIN_PROTECTED;
|
||||
|
||||
double x = 0.0;
|
||||
tl::from_string (tl::to_string (mp_ui->x_le->text ()), x);
|
||||
tl::from_string (tl::to_string (mp_ui->y_le->text ()), x);
|
||||
tl::from_string_ext (tl::to_string (mp_ui->x_le->text ()), x);
|
||||
tl::from_string_ext (tl::to_string (mp_ui->y_le->text ()), x);
|
||||
|
||||
QDialog::accept ();
|
||||
|
||||
|
||||
@@ -204,7 +204,7 @@ static void configure_from_line_edit (lay::Dispatcher *dispatcher, QLineEdit *le
|
||||
{
|
||||
try {
|
||||
Value value = Value (0);
|
||||
tl::from_string (tl::to_string (le->text ()), value);
|
||||
tl::from_string_ext (tl::to_string (le->text ()), value);
|
||||
dispatcher->config_set (cfg_name, tl::to_string (value));
|
||||
lay::indicate_error (le, (tl::Exception *) 0);
|
||||
} catch (tl::Exception &ex) {
|
||||
|
||||
@@ -96,7 +96,7 @@ LayoutPropertiesForm::commit ()
|
||||
|
||||
// get the database unit
|
||||
double dbu = 0.001;
|
||||
tl::from_string (tl::to_string (dbu_le->text ()), dbu);
|
||||
tl::from_string_ext (tl::to_string (dbu_le->text ()), dbu);
|
||||
if (dbu < 1e-6 || dbu > 1e3) {
|
||||
throw tl::Exception (tl::to_string (QObject::tr ("Invalid database unit")));
|
||||
}
|
||||
|
||||
@@ -170,7 +170,7 @@ LayoutViewConfigPage1::commit (lay::Dispatcher *root)
|
||||
root->config_set (cfg_abstract_mode_enabled, mp_ui->abstract_mode_grp->isChecked ());
|
||||
|
||||
double w = 10.0;
|
||||
tl::from_string (tl::to_string (mp_ui->abstract_mode_width_le->text ()), w);
|
||||
tl::from_string_ext (tl::to_string (mp_ui->abstract_mode_width_le->text ()), w);
|
||||
root->config_set (cfg_abstract_mode_width, w);
|
||||
if (w <= 0.0) {
|
||||
throw tl::Exception (tl::to_string (QObject::tr ("Invalid abstract mode border with - must be larger than 0")));
|
||||
@@ -254,7 +254,7 @@ LayoutViewConfigPage2a::commit (lay::Dispatcher *root)
|
||||
|
||||
try {
|
||||
int n;
|
||||
tl::from_string (tl::to_string (mp_ui->cell_min_size_for_label_edit->text ()), n);
|
||||
tl::from_string_ext (tl::to_string (mp_ui->cell_min_size_for_label_edit->text ()), n);
|
||||
root->config_set (cfg_min_inst_label_size, n);
|
||||
} catch (...) { }
|
||||
}
|
||||
@@ -319,7 +319,7 @@ LayoutViewConfigPage2b::commit (lay::Dispatcher *root)
|
||||
|
||||
try {
|
||||
double s;
|
||||
tl::from_string (tl::to_string (mp_ui->text_def_size_edit->text ()), s);
|
||||
tl::from_string_ext (tl::to_string (mp_ui->text_def_size_edit->text ()), s);
|
||||
root->config_set (cfg_default_text_size, s);
|
||||
} catch (...) { }
|
||||
}
|
||||
@@ -511,7 +511,7 @@ LayoutViewConfigPage3b::commit (lay::Dispatcher *root)
|
||||
|
||||
double pd = 0.0;
|
||||
try {
|
||||
tl::from_string (tl::to_string (mp_ui->pan_distance_le->text ()), pd);
|
||||
tl::from_string_ext (tl::to_string (mp_ui->pan_distance_le->text ()), pd);
|
||||
} catch (...) { }
|
||||
if (pd <= 0.0) {
|
||||
throw tl::Exception (tl::to_string (QObject::tr ("Invalid pan distance: must be larger than 0.0")));
|
||||
@@ -619,7 +619,7 @@ LayoutViewConfigPage3f::commit (lay::Dispatcher *root)
|
||||
|
||||
try {
|
||||
unsigned int s;
|
||||
tl::from_string (tl::to_string (mp_ui->drop_small_cells_value_le->text ()), s);
|
||||
tl::from_string_ext (tl::to_string (mp_ui->drop_small_cells_value_le->text ()), s);
|
||||
root->config_set (cfg_drop_small_cells_value, s);
|
||||
} catch (...) { }
|
||||
|
||||
|
||||
@@ -1423,7 +1423,7 @@ LayoutViewFunctions::cm_lay_free_rot ()
|
||||
if (ok) {
|
||||
|
||||
double angle = 0.0;
|
||||
tl::from_string (tl::to_string (s), angle);
|
||||
tl::from_string_ext (tl::to_string (s), angle);
|
||||
|
||||
transform_layout (db::DCplxTrans (1.0, angle, false, db::DVector ()));
|
||||
|
||||
@@ -1443,7 +1443,7 @@ LayoutViewFunctions::cm_lay_scale ()
|
||||
if (ok) {
|
||||
|
||||
double scale = 0.0;
|
||||
tl::from_string (tl::to_string (s), scale);
|
||||
tl::from_string_ext (tl::to_string (s), scale);
|
||||
|
||||
transform_layout (db::DCplxTrans (scale));
|
||||
|
||||
@@ -1516,7 +1516,7 @@ LayoutViewFunctions::cm_sel_free_rot ()
|
||||
if (ok) {
|
||||
|
||||
double angle = 0.0;
|
||||
tl::from_string (tl::to_string (s), angle);
|
||||
tl::from_string_ext (tl::to_string (s), angle);
|
||||
|
||||
db::DCplxTrans tr = db::DCplxTrans (1.0, angle, false, db::DVector ());
|
||||
db::DBox sel_bbox (view ()->lay::Editables::selection_bbox ());
|
||||
@@ -1541,7 +1541,7 @@ LayoutViewFunctions::cm_sel_scale ()
|
||||
if (ok) {
|
||||
|
||||
double scale = 0.0;
|
||||
tl::from_string (tl::to_string (s), scale);
|
||||
tl::from_string_ext (tl::to_string (s), scale);
|
||||
|
||||
db::DCplxTrans tr = db::DCplxTrans (scale);
|
||||
db::DBox sel_bbox (view ()->lay::Editables::selection_bbox ());
|
||||
|
||||
@@ -151,7 +151,7 @@ int
|
||||
NetExportDialog::start_layer_number ()
|
||||
{
|
||||
int ln = 0;
|
||||
tl::from_string (tl::to_string (ui->layernum->text ()), ln);
|
||||
tl::from_string_ext (tl::to_string (ui->layernum->text ()), ln);
|
||||
return ln;
|
||||
}
|
||||
|
||||
|
||||
@@ -136,10 +136,10 @@ void
|
||||
NetlistBrowserConfigPage::commit (lay::Dispatcher *root)
|
||||
{
|
||||
double dim = 1.0;
|
||||
tl::from_string (tl::to_string (le_window->text ()), dim);
|
||||
tl::from_string_ext (tl::to_string (le_window->text ()), dim);
|
||||
|
||||
unsigned int max_shapes_highlighted = 10000;
|
||||
tl::from_string (tl::to_string (le_max_markers->text ()), max_shapes_highlighted);
|
||||
tl::from_string_ext (tl::to_string (le_max_markers->text ()), max_shapes_highlighted);
|
||||
|
||||
root->config_set (cfg_l2ndb_window_mode, lay::NetlistBrowserConfig::net_window_type (cbx_window->currentIndex ()), NetlistBrowserWindowModeConverter ());
|
||||
root->config_set (cfg_l2ndb_window_dim, dim);
|
||||
@@ -300,7 +300,7 @@ NetlistBrowserConfigPage2::commit (lay::Dispatcher *root)
|
||||
} else {
|
||||
try {
|
||||
int s;
|
||||
tl::from_string (tl::to_string (lw_le->text ()), s);
|
||||
tl::from_string_ext (tl::to_string (lw_le->text ()), s);
|
||||
root->config_set (cfg_l2ndb_marker_line_width, s);
|
||||
} catch (...) { }
|
||||
}
|
||||
@@ -310,7 +310,7 @@ NetlistBrowserConfigPage2::commit (lay::Dispatcher *root)
|
||||
} else {
|
||||
try {
|
||||
int s;
|
||||
tl::from_string (tl::to_string (vs_le->text ()), s);
|
||||
tl::from_string_ext (tl::to_string (vs_le->text ()), s);
|
||||
root->config_set (cfg_l2ndb_marker_vertex_size, s);
|
||||
} catch (...) { }
|
||||
}
|
||||
|
||||
@@ -396,8 +396,8 @@ SaveLayoutAsOptionsDialog::ok_button_pressed ()
|
||||
}
|
||||
|
||||
double x = 0.0;
|
||||
tl::from_string (tl::to_string (dbu_le->text ()), x);
|
||||
tl::from_string (tl::to_string (sf_le->text ()), x);
|
||||
tl::from_string_ext (tl::to_string (dbu_le->text ()), x);
|
||||
tl::from_string_ext (tl::to_string (sf_le->text ()), x);
|
||||
|
||||
accept ();
|
||||
|
||||
@@ -475,10 +475,10 @@ SaveLayoutAsOptionsDialog::get_options (lay::LayoutView *view, unsigned int cv_i
|
||||
}
|
||||
|
||||
double dbu = 0.0;
|
||||
tl::from_string (tl::to_string (dbu_le->text ()), dbu);
|
||||
tl::from_string_ext (tl::to_string (dbu_le->text ()), dbu);
|
||||
|
||||
double sf = 1.0;
|
||||
tl::from_string (tl::to_string (sf_le->text ()), sf);
|
||||
tl::from_string_ext (tl::to_string (sf_le->text ()), sf);
|
||||
|
||||
options.set_dbu (dbu);
|
||||
options.set_scale_factor (sf);
|
||||
|
||||
@@ -170,10 +170,10 @@ void
|
||||
MarkerBrowserConfigPage::commit (lay::Dispatcher *root)
|
||||
{
|
||||
double dim = 1.0;
|
||||
tl::from_string (tl::to_string (le_window->text ()), dim);
|
||||
tl::from_string_ext (tl::to_string (le_window->text ()), dim);
|
||||
|
||||
unsigned int max_markers_count = 1000;
|
||||
tl::from_string (tl::to_string (le_max_markers->text ()), max_markers_count);
|
||||
tl::from_string_ext (tl::to_string (le_max_markers->text ()), max_markers_count);
|
||||
|
||||
root->config_set (cfg_rdb_context_mode, rdb::context_mode_type (cbx_context->currentIndex ()), MarkerBrowserContextModeConverter ());
|
||||
root->config_set (cfg_rdb_window_mode, rdb::window_type (cbx_window->currentIndex ()), MarkerBrowserWindowModeConverter ());
|
||||
@@ -238,7 +238,7 @@ MarkerBrowserConfigPage2::commit (lay::Dispatcher *root)
|
||||
} else {
|
||||
try {
|
||||
int s;
|
||||
tl::from_string (tl::to_string (lw_le->text ()), s);
|
||||
tl::from_string_ext (tl::to_string (lw_le->text ()), s);
|
||||
root->config_set (cfg_rdb_marker_line_width, s);
|
||||
} catch (...) { }
|
||||
}
|
||||
@@ -248,7 +248,7 @@ MarkerBrowserConfigPage2::commit (lay::Dispatcher *root)
|
||||
} else {
|
||||
try {
|
||||
int s;
|
||||
tl::from_string (tl::to_string (vs_le->text ()), s);
|
||||
tl::from_string_ext (tl::to_string (vs_le->text ()), s);
|
||||
root->config_set (cfg_rdb_marker_vertex_size, s);
|
||||
} catch (...) { }
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user