diff --git a/src/edt/edt/edtPlugin.cc b/src/edt/edt/edtPlugin.cc index 926325850..46b3f664b 100644 --- a/src/edt/edt/edtPlugin.cc +++ b/src/edt/edt/edtPlugin.cc @@ -47,7 +47,7 @@ void get_text_options (std::vector < std::pair > &opti } static -void get_text_editor_options_pages (std::vector &ret, lay::Dispatcher *dispatcher) +void get_text_editor_options_pages (std::vector &ret, lay::LayoutView *, lay::Dispatcher *dispatcher) { ret.push_back (new edt::EditorOptionsText (dispatcher)); } @@ -61,9 +61,20 @@ void get_path_options (std::vector < std::pair > &opti options.push_back (std::pair (cfg_edit_path_ext_var_end, "0.0")); } -static -void get_path_editor_options_pages (std::vector &ret, lay::Dispatcher *dispatcher) +edt::RecentConfigurationPage::ConfigurationDescriptor path_cfg_descriptors[] = { + edt::RecentConfigurationPage::ConfigurationDescriptor ("", tl::to_string (tr ("Layer")), edt::RecentConfigurationPage::Layer), + edt::RecentConfigurationPage::ConfigurationDescriptor (cfg_edit_path_width, tl::to_string (tr ("Width")), edt::RecentConfigurationPage::Double), + edt::RecentConfigurationPage::ConfigurationDescriptor (cfg_edit_path_ext_type, tl::to_string (tr ("Ends")), edt::RecentConfigurationPage::Int), + edt::RecentConfigurationPage::ConfigurationDescriptor (cfg_edit_path_ext_var_begin, tl::to_string (tr ("Begin ext.")), edt::RecentConfigurationPage::Double), + edt::RecentConfigurationPage::ConfigurationDescriptor (cfg_edit_path_ext_var_end, tl::to_string (tr ("End ext.")), edt::RecentConfigurationPage::Double) +}; + +static +void get_path_editor_options_pages (std::vector &ret, lay::LayoutView *view, lay::Dispatcher *dispatcher) +{ + ret.push_back (new RecentConfigurationPage (view, dispatcher, "edit-recent-path-param", + &path_cfg_descriptors[0], &path_cfg_descriptors[sizeof (path_cfg_descriptors) / sizeof (path_cfg_descriptors[0])])); ret.push_back (new EditorOptionsPath (dispatcher)); } @@ -103,10 +114,10 @@ edt::RecentConfigurationPage::ConfigurationDescriptor inst_cfg_descriptors[] = edt::RecentConfigurationPage::ConfigurationDescriptor (cfg_edit_inst_pcell_parameters, tl::to_string (tr ("PCell parameters")), edt::RecentConfigurationPage::PCellParameters) }; -static -void get_inst_editor_options_pages (std::vector &ret, lay::Dispatcher *dispatcher) +static +void get_inst_editor_options_pages (std::vector &ret, lay::LayoutView *view, lay::Dispatcher *dispatcher) { - ret.push_back (new RecentConfigurationPage (dispatcher, "edit-recent-inst-param", + ret.push_back (new RecentConfigurationPage (view, dispatcher, "edit-recent-inst-param", &inst_cfg_descriptors[0], &inst_cfg_descriptors[sizeof (inst_cfg_descriptors) / sizeof (inst_cfg_descriptors[0])])); ret.push_back (new EditorOptionsInstPCellParam (dispatcher)); ret.push_back (new EditorOptionsInst (dispatcher)); @@ -119,7 +130,7 @@ class PluginDeclaration public: PluginDeclaration (const std::string &title, const std::string &mouse_mode, void (*option_get_f) (std::vector < std::pair > &) = 0, - void (*pages_f) (std::vector &, lay::Dispatcher *) = 0) + void (*pages_f) (std::vector &, lay::LayoutView *, lay::Dispatcher *) = 0) : m_title (title), m_mouse_mode (mouse_mode), mp_option_get_f (option_get_f), mp_pages_f (pages_f) { // .. nothing yet .. @@ -142,11 +153,11 @@ public: // .. nothing yet .. } - virtual void get_editor_options_pages (std::vector &pages, lay::Dispatcher *root) const + virtual void get_editor_options_pages (std::vector &pages, lay::LayoutView *view, lay::Dispatcher *root) const { if (mp_pages_f != 0) { size_t nstart = pages.size (); - (*mp_pages_f) (pages, root); + (*mp_pages_f) (pages, view, root); while (nstart < pages.size ()) { pages [nstart++]->set_plugin_declaration (this); } @@ -177,7 +188,7 @@ private: std::string m_mouse_mode; void (*mp_option_get_f) (std::vector < std::pair > &options); - void (*mp_pages_f) (std::vector &, lay::Dispatcher *); + void (*mp_pages_f) (std::vector &, lay::LayoutView *, lay::Dispatcher *); }; static tl::RegisteredClass config_decl1 ( @@ -382,7 +393,7 @@ show_editor_options_page (lay::LayoutView *view) for (tl::Registrar::iterator cls = tl::Registrar::begin (); cls != tl::Registrar::end (); ++cls) { const PluginDeclarationBase *pd_base = dynamic_cast (&*cls); if (pd_base) { - pd_base->get_editor_options_pages (prop_dialog_pages, view->dispatcher ()); + pd_base->get_editor_options_pages (prop_dialog_pages, view, view->dispatcher ()); } } diff --git a/src/edt/edt/edtPlugin.h b/src/edt/edt/edtPlugin.h index 412f51d97..c0ede8408 100644 --- a/src/edt/edt/edtPlugin.h +++ b/src/edt/edt/edtPlugin.h @@ -44,7 +44,7 @@ namespace edt : public lay::PluginDeclaration { public: - virtual void get_editor_options_pages (std::vector &, lay::Dispatcher *) const = 0; + virtual void get_editor_options_pages (std::vector &, lay::LayoutView *, lay::Dispatcher *) const = 0; }; /** diff --git a/src/edt/edt/edtRecentConfigurationPage.cc b/src/edt/edt/edtRecentConfigurationPage.cc index 1d9bcec56..3d329c5c0 100644 --- a/src/edt/edt/edtRecentConfigurationPage.cc +++ b/src/edt/edt/edtRecentConfigurationPage.cc @@ -23,6 +23,7 @@ #include "edtRecentConfigurationPage.h" #include "edtUtils.h" #include "layDispatcher.h" +#include "layLayoutView.h" #include "dbLibraryManager.h" #include "dbLibrary.h" @@ -263,9 +264,28 @@ RecentConfigurationPage::item_clicked (QTreeWidgetItem *item) { int column = 0; for (std::list::const_iterator c = m_cfg.begin (); c != m_cfg.end (); ++c, ++column) { + std::string v = tl::to_string (item->data (column, Qt::UserRole).toString ()); - dispatcher ()->config_set (c->cfg_name, v); + + if (c->rendering == Layer) { + + // "getting" a layer means making it current + db::LayerProperties lp; + tl::Extractor ex (v.c_str ()); + lp.read (ex); + int cv_index = 0; + if (ex.test ("@")) { + ex.read (cv_index); + } + + mp_view->set_current_layer (cv_index, lp); + + } else { + dispatcher ()->config_set (c->cfg_name, v); + } + } + dispatcher ()->config_end (); } @@ -275,7 +295,30 @@ RecentConfigurationPage::commit_recent (lay::Dispatcher *root) std::vector values; values.reserve (m_cfg.size ()); for (std::list::const_iterator c = m_cfg.begin (); c != m_cfg.end (); ++c) { - values.push_back (root->config_get (c->cfg_name)); + if (c->rendering == Layer) { + + std::string s; + + if (mp_view->current_layer ()->is_visual ()) { + + int cv_index = mp_view->current_layer ()->cellview_index (); + const lay::CellView &cv = mp_view->cellview (cv_index); + int li = mp_view->current_layer ()->layer_index (); + if (cv.is_valid () && cv->layout ().is_valid_layer (li)) { + s = cv->layout ().get_properties (li).to_string (); + if (cv_index > 0) { + s += "@" + tl::to_string (cv_index); + } + } + + } + + values.push_back (s); + + } else { + values.push_back (root->config_get (c->cfg_name)); + } + } std::list > stored_values = get_stored_values (); diff --git a/src/edt/edt/edtRecentConfigurationPage.h b/src/edt/edt/edtRecentConfigurationPage.h index 766a7f77f..81b6b493f 100644 --- a/src/edt/edt/edtRecentConfigurationPage.h +++ b/src/edt/edt/edtRecentConfigurationPage.h @@ -29,6 +29,11 @@ #include #include +namespace lay +{ + class LayoutView; +} + namespace edt { @@ -71,8 +76,8 @@ public: }; template - RecentConfigurationPage (lay::Dispatcher *dispatcher, const std::string &recent_cfg_name, Iter begin_cfg, Iter end_cfg) - : EditorOptionsPage (dispatcher), m_recent_cfg_name (recent_cfg_name), m_cfg (begin_cfg, end_cfg) + RecentConfigurationPage (lay::LayoutView *view, lay::Dispatcher *dispatcher, const std::string &recent_cfg_name, Iter begin_cfg, Iter end_cfg) + : EditorOptionsPage (dispatcher), mp_view (view), m_recent_cfg_name (recent_cfg_name), m_cfg (begin_cfg, end_cfg) { init (); } @@ -89,6 +94,7 @@ private slots: void item_clicked (QTreeWidgetItem *item); private: + lay::LayoutView *mp_view; std::string m_recent_cfg_name; std::list m_cfg; QTreeWidget *mp_tree_widget; diff --git a/src/edt/edt/edtServiceImpl.cc b/src/edt/edt/edtServiceImpl.cc index b4a339f0c..2cd448fdc 100644 --- a/src/edt/edt/edtServiceImpl.cc +++ b/src/edt/edt/edtServiceImpl.cc @@ -965,6 +965,8 @@ PathService::do_finish_edit () m_points.pop_back (); deliver_shape (get_path ()); + + commit_recent (view ()); } void