diff --git a/src/db/db/dbTechnology.cc b/src/db/db/dbTechnology.cc index a4acd4ce0..122d1e319 100644 --- a/src/db/db/dbTechnology.cc +++ b/src/db/db/dbTechnology.cc @@ -253,13 +253,13 @@ Technologies::technology_by_name (const std::string &name) // Technology implementation Technology::Technology () - : m_name (), m_description (), m_dbu (0.001), m_persisted (true), m_readonly (false) + : m_name (), m_description (), m_group (), m_dbu (0.001), m_persisted (true), m_readonly (false) { init (); } -Technology::Technology (const std::string &name, const std::string &description) - : m_name (name), m_description (description), m_dbu (0.001), m_persisted (true), m_readonly (false) +Technology::Technology (const std::string &name, const std::string &description, const std::string &group) + : m_name (name), m_description (description), m_group (group), m_dbu (0.001), m_persisted (true), m_readonly (false) { init (); } @@ -284,7 +284,7 @@ Technology::~Technology () Technology::Technology (const Technology &d) : tl::Object (), - m_name (d.m_name), m_description (d.m_description), m_grain_name (d.m_grain_name), m_dbu (d.m_dbu), + m_name (d.m_name), m_description (d.m_description), m_group (d.m_group), m_grain_name (d.m_grain_name), m_dbu (d.m_dbu), m_explicit_base_path (d.m_explicit_base_path), m_default_base_path (d.m_default_base_path), m_load_layout_options (d.m_load_layout_options), m_save_layout_options (d.m_save_layout_options), @@ -302,6 +302,7 @@ Technology &Technology::operator= (const Technology &d) m_name = d.m_name; m_description = d.m_description; + m_group = d.m_group; m_grain_name = d.m_grain_name; m_dbu = d.m_dbu; m_default_base_path = d.m_default_base_path; @@ -330,12 +331,29 @@ Technology &Technology::operator= (const Technology &d) return *this; } +std::string +Technology::get_display_string () const +{ + std::string d = name (); + if (! d.empty () && ! description ().empty ()) { + d += " - "; + } + d += description (); + if (! group ().empty ()) { + d += " ["; + d += group (); + d += "]"; + } + return d; +} + tl::XMLElementList Technology::xml_elements () { tl::XMLElementList elements = tl::make_member (&Technology::name, &Technology::set_name, "name") + tl::make_member (&Technology::description, &Technology::set_description, "description") + + tl::make_member (&Technology::group, &Technology::set_group, "group") + tl::make_member (&Technology::dbu, &Technology::set_dbu, "dbu") + tl::make_member (&Technology::explicit_base_path, &Technology::set_explicit_base_path, "base-path") + tl::make_member (&Technology::default_base_path, &Technology::set_default_base_path, "original-base-path") + diff --git a/src/db/db/dbTechnology.h b/src/db/db/dbTechnology.h index f2acec09e..3c24f0a8c 100644 --- a/src/db/db/dbTechnology.h +++ b/src/db/db/dbTechnology.h @@ -265,7 +265,7 @@ public: /** * @brief The constructor */ - Technology (const std::string &name, const std::string &description); + Technology (const std::string &name, const std::string &description, const std::string &group = std::string ()); /** * @brief The copy constructor @@ -414,6 +414,33 @@ public: } } + /** + * @brief Gets the technology group + */ + const std::string &group () const + { + return m_group; + } + + /** + * @brief Sets the technology group + */ + void set_group (const std::string &d) + { + if (m_group != d) { + m_group = d; + technology_changed (); + } + } + + /** + * @brief Gets the display string + * + * The display string is used to indicate the technology through a + * descriptive string + */ + std::string get_display_string () const; + /** * @brief Gets the default database unit */ @@ -613,7 +640,7 @@ public: tl::event technology_changed_with_sender_event; private: - std::string m_name, m_description; + std::string m_name, m_description, m_group; std::string m_grain_name; double m_dbu; std::string m_explicit_base_path, m_default_base_path; diff --git a/src/db/db/gsiDeclDbTechnologies.cc b/src/db/db/gsiDeclDbTechnologies.cc index 061e1e433..d4c54a7ef 100644 --- a/src/db/db/gsiDeclDbTechnologies.cc +++ b/src/db/db/gsiDeclDbTechnologies.cc @@ -191,6 +191,20 @@ gsi::Class technology_decl ("db", "Technology", gsi::method ("description=", &db::Technology::set_description, gsi::arg ("description"), "@brief Sets the description\n" ) + + gsi::method ("group", &db::Technology::group, + "@brief Gets the technology group\n" + "\n" + "The technology group is used to group certain technologies together in the technology selection menu. " + "Technologies with the same group are put under a submenu with that group title.\n" + "\n" + "The 'group' attribute has been introduced in version 0.26.2.\n" + ) + + gsi::method ("group=", &db::Technology::set_group, gsi::arg ("group"), + "@brief Sets the technology group\n" + "See \\group for details about this attribute.\n" + "\n" + "The 'group' attribute has been introduced in version 0.26.2.\n" + ) + gsi::method ("dbu", &db::Technology::dbu, "@brief Gets the default database unit\n" "\n" diff --git a/src/lay/lay/TechBaseEditorPage.ui b/src/lay/lay/TechBaseEditorPage.ui index 059659437..b2ab51375 100644 --- a/src/lay/lay/TechBaseEditorPage.ui +++ b/src/lay/lay/TechBaseEditorPage.ui @@ -14,37 +14,24 @@ Form - - - - ... + + + + Qt::Horizontal - - - - - - - Name + + + + Qt::Horizontal - - - - false - - - - - + + - The base path is used to locate auxiliary files if those are specified with a relative path. If none is specified, the default path is used. The default path is the one from which a technology was imported. - - - true + Base path @@ -55,23 +42,38 @@ - - - - Qt::Vertical + + + + Name - - QSizePolicy::Fixed + + + + + + Database +unit + + + Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop + + + + + + + Qt::Horizontal - 20 - 5 + 40 + 20 - + Load layer properties file @@ -125,14 +127,10 @@ - - - - Base path - - + + - + Layer @@ -143,28 +141,10 @@ properties - - - - Database -unit - - - Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop - - - - - - - Qt::Horizontal - - - - - - - Qt::Horizontal + + + + false @@ -175,14 +155,28 @@ unit - - + + - The default database unit is used as database unit for freshly created layouts + ... - + + + + Qt::Horizontal + + + + + + + QAbstractItemView::NoSelection + + + + QFrame::NoFrame @@ -223,39 +217,30 @@ unit - - + + + + The default database unit is used as database unit for freshly created layouts + + + + + - Qt::Horizontal + Qt::Vertical + + + QSizePolicy::Fixed - 40 - 20 + 20 + 5 - - - - - - - Technology -specific -libraries - - - - - - - Qt::Horizontal - - - - + Qt::Vertical @@ -268,10 +253,42 @@ libraries - - - - QAbstractItemView::NoSelection + + + + The base path is used to locate auxiliary files if those are specified with a relative path. If none is specified, the default path is used. The default path is the one from which a technology was imported. + + + true + + + + + + + + + + Technology +specific +libraries + + + + + + + + + + Group + + + + + + + (Used for creating tech groups) diff --git a/src/lay/lay/layTechSetupDialog.cc b/src/lay/lay/layTechSetupDialog.cc index 0e881fd0b..6a721b792 100644 --- a/src/lay/lay/layTechSetupDialog.cc +++ b/src/lay/lay/layTechSetupDialog.cc @@ -80,6 +80,11 @@ title_for_technology (const db::Technology *t) d += t->description (); } } + if (! t->group ().empty ()) { + d += " ["; + d += t->group (); + d += "]"; + } return d; } @@ -106,6 +111,7 @@ TechBaseEditorPage::setup () { mp_ui->name_le->setText (tl::to_qstring (tech ()->name ())); mp_ui->desc_le->setText (tl::to_qstring (tech ()->description ())); + mp_ui->group_le->setText (tl::to_qstring (tech ()->group ())); mp_ui->dbu_le->setText (tl::to_qstring (tl::to_string (tech ()->dbu ()))); mp_ui->desc_le->setEnabled (! tech ()->name ().empty ()); mp_ui->base_path_le->setText (tl::to_qstring (tech ()->explicit_base_path ())); @@ -155,6 +161,7 @@ void TechBaseEditorPage::commit () { tech ()->set_description (tl::to_string (mp_ui->desc_le->text ())); + tech ()->set_group (tl::to_string (mp_ui->group_le->text ())); tech ()->set_explicit_base_path (tl::to_string (mp_ui->base_path_le->text ())); double d = 0.001; @@ -741,11 +748,7 @@ BEGIN_PROTECTED tl_assert (t != 0); } - std::string d = t->name (); - if (! d.empty () && ! t->description ().empty ()) { - d += " - "; - } - d += t->description (); + std::string d = t->get_display_string (); bool ok = false; QString tn = QInputDialog::getText (this, QObject::tr ("Add Technology"), diff --git a/src/lay/lay/layTechnologyController.cc b/src/lay/lay/layTechnologyController.cc index f6ca65ee5..927e4d183 100644 --- a/src/lay/lay/layTechnologyController.cc +++ b/src/lay/lay/layTechnologyController.cc @@ -359,22 +359,37 @@ TechnologyController::update_menu () m_tech_actions.clear (); - std::map tech_by_name; + std::map > tech_by_name_and_group; for (db::Technologies::const_iterator t = db::Technologies::instance ()->begin (); t != db::Technologies::instance ()->end (); ++t) { - tech_by_name.insert (std::make_pair (t->name (), t.operator-> ())); + tech_by_name_and_group [tl::trim (t->group ())].insert (std::make_pair (t->name (), t.operator-> ())); } - int it = 0; - for (std::map::const_iterator t = tech_by_name.begin (); t != tech_by_name.end (); ++t, ++it) { + for (std::vector::const_iterator tg = tech_group.begin (); tg != tech_group.end (); ++tg) { - std::string title = tech_string_from_name (t->first); + int ig = 0; + for (std::map >::const_iterator g = tech_by_name_and_group.begin (); g != tech_by_name_and_group.end (); ++g) { + + std::string tp = *tg; + if (! g->first.empty ()) { + std::string gn = "techgroup_" + tl::to_string (++ig); + pr->menu ()->insert_menu (*tg + ".end", gn, g->first); + tp = *tg + "." + gn; + } + tp += ".end"; + + int it = 0; + for (std::map::const_iterator t = g->second.begin (); t != g->second.end (); ++t, ++it) { + + std::string title = tech_string_from_name (t->first); + + m_tech_actions.push_back (pr->create_config_action ("", cfg_initial_technology, t->first)); + m_tech_actions.back ().set_title (title); // setting the title here avoids interpretation of '(...)' etc. + m_tech_actions.back ().set_checkable (true); + m_tech_actions.back ().set_checked (t->first == m_current_technology); + pr->menu ()->insert_item (tp, "technology_" + tl::to_string (it), m_tech_actions.back ()); + + } - m_tech_actions.push_back (pr->create_config_action ("", cfg_initial_technology, t->first)); - m_tech_actions.back ().set_title (title); // setting the title here avoids interpretation of '(...)' etc. - m_tech_actions.back ().set_checkable (true); - m_tech_actions.back ().set_checked (t->first == m_current_technology); - for (std::vector::const_iterator tg = tech_group.begin (); tg != tech_group.end (); ++tg) { - pr->menu ()->insert_item (*tg + ".end", "technology_" + tl::to_string (it), m_tech_actions.back ()); } } diff --git a/src/laybasic/laybasic/layDialogs.cc b/src/laybasic/laybasic/layDialogs.cc index 1ed76c56f..d298b95a0 100644 --- a/src/laybasic/laybasic/layDialogs.cc +++ b/src/laybasic/laybasic/layDialogs.cc @@ -135,13 +135,7 @@ NewLayoutPropertiesDialog::exec_dialog (std::string &technology, std::string &ce unsigned int technology_index = 0; for (db::Technologies::const_iterator t = db::Technologies::instance ()->begin (); t != db::Technologies::instance ()->end (); ++t, ++technology_index) { - std::string d = t->name (); - if (! d.empty () && ! t->description ().empty ()) { - d += " - "; - } - d += t->description (); - - mp_ui->tech_cbx->addItem (tl::to_qstring (d)); + mp_ui->tech_cbx->addItem (tl::to_qstring (t->get_display_string ())); if (t->name () == technology) { mp_ui->tech_cbx->setCurrentIndex (technology_index); } diff --git a/src/laybasic/laybasic/layLayoutPropertiesForm.cc b/src/laybasic/laybasic/layLayoutPropertiesForm.cc index 159644ee3..a59a03cbd 100644 --- a/src/laybasic/laybasic/layLayoutPropertiesForm.cc +++ b/src/laybasic/laybasic/layLayoutPropertiesForm.cc @@ -192,13 +192,7 @@ BEGIN_PROTECTED unsigned int technology_index = 0; for (db::Technologies::const_iterator t = db::Technologies::instance ()->begin (); t != db::Technologies::instance ()->end (); ++t, ++technology_index) { - std::string d = t->name (); - if (! d.empty () && ! t->description ().empty ()) { - d += " - "; - } - d += t->description (); - - tech_cbx->addItem (tl::to_qstring (d)); + tech_cbx->addItem (tl::to_qstring (t->get_display_string ())); if (t->name () == m_handles [index]->tech_name ()) { tech_cbx->setCurrentIndex (technology_index); }