| 87 | } |
| 88 | |
| 89 | void |
| 90 | LayoutPropertiesForm::commit () |
| 91 | { |
| 92 | if (m_index >= int (m_handles.size ()) || m_index < 0) { |
| 93 | return; |
| 94 | } |
| 95 | |
| 96 | db::Layout &layout = m_handles [m_index]->layout (); |
| 97 | |
| 98 | // get the database unit |
| 99 | double dbu = 0.001; |
| 100 | tl::from_string_ext (tl::to_string (dbu_le->text ()), dbu); |
| 101 | if (dbu < 1e-6 || dbu > 1e3) { |
| 102 | throw tl::Exception (tl::to_string (QObject::tr ("Invalid database unit"))); |
| 103 | } |
| 104 | |
| 105 | if (fabs (dbu - layout.dbu ()) > 1e-6) { |
| 106 | if (mp_view->manager ()) { |
| 107 | mp_view->manager ()->transaction (tl::to_string (QObject::tr ("Change layout's database unit"))); |
| 108 | } |
| 109 | layout.dbu (dbu); |
| 110 | if (mp_view->manager ()) { |
| 111 | mp_view->manager ()->commit (); |
| 112 | } |
| 113 | } |
| 114 | |
| 115 | // get the selected technology name |
| 116 | std::string technology; |
| 117 | int technology_index = tech_cbx->currentIndex (); |
| 118 | const db::Technology *tech = 0; |
| 119 | if (technology_index >= 0 && technology_index < (int) db::Technologies::instance ()->technologies ()) { |
| 120 | tech = &(db::Technologies::instance ()->begin () [technology_index]); |
| 121 | technology = tech->name (); |
| 122 | } |
| 123 | |
| 124 | if (tech) { |
| 125 | |
| 126 | bool tech_has_changed = (technology != m_handles [m_index]->tech_name ()); |
| 127 | m_handles [m_index]->set_tech_name (technology); |
| 128 | |
| 129 | std::string lyp_file = tech->eff_layer_properties_file (); |
| 130 | if (tech_has_changed && ! lyp_file.empty ()) { |
| 131 | |
| 132 | // if the new technology has a layer properties file attached, ask whether to load it |
| 133 | if (QMessageBox::question (this, QObject::tr ("Load Layer Properties File"), |
| 134 | tl::to_qstring (tl::to_string (QObject::tr ("The new technology specifies a layer properties file (")) + lyp_file + tl::to_string (QObject::tr (").\nLoad the new layer properties file?"))), |
| 135 | QMessageBox::Yes, QMessageBox::No) == QMessageBox::Yes) { |
| 136 | |
| 137 | // Interpolate the layer properties file name and load the file |
| 138 | tl::Eval expr; |
| 139 | expr.set_var ("layoutfile", m_handles [m_index]->filename ()); |
| 140 | lyp_file = expr.interpolate (lyp_file); |
| 141 | mp_view->load_layer_props (lyp_file); |
| 142 | |
| 143 | } |
| 144 | |
| 145 | } |
| 146 |
no test coverage detected