diff --git a/src/edt/edt/edtEditorOptionsPages.cc b/src/edt/edt/edtEditorOptionsPages.cc index 3362dd49c..4b9c0cf86 100644 --- a/src/edt/edt/edtEditorOptionsPages.cc +++ b/src/edt/edt/edtEditorOptionsPages.cc @@ -92,8 +92,8 @@ struct EOPCompareOp } }; -EditorOptionsPages::EditorOptionsPages (QWidget *parent, const std::vector &pages, lay::Dispatcher *root) - : QFrame (parent), mp_root (root) +EditorOptionsPages::EditorOptionsPages (QWidget *parent, const std::vector &pages, lay::Dispatcher *dispatcher) + : QFrame (parent), mp_dispatcher (dispatcher) { QVBoxLayout *ly1 = new QVBoxLayout (this); ly1->setMargin (0); @@ -148,7 +148,7 @@ EditorOptionsPages::activate_page (edt::EditorOptionsPage *page) { try { if (page->active ()) { - page->setup (mp_root); + page->setup (mp_dispatcher); } } catch (...) { // catch any errors related to configuration file errors etc. @@ -192,7 +192,7 @@ EditorOptionsPages::setup () for (std::vector ::iterator p = m_pages.begin (); p != m_pages.end (); ++p) { if ((*p)->active ()) { - (*p)->setup (mp_root); + (*p)->setup (mp_dispatcher); } } @@ -210,7 +210,8 @@ EditorOptionsPages::do_apply () { for (std::vector ::iterator p = m_pages.begin (); p != m_pages.end (); ++p) { if ((*p)->active ()) { - (*p)->apply (mp_root); + // NOTE: we apply to the root dispatcher, so other dispatchers (views) get informed too. + (*p)->apply (mp_dispatcher->dispatcher ()); } } } diff --git a/src/edt/edt/edtEditorOptionsPages.h b/src/edt/edt/edtEditorOptionsPages.h index 68222ccc8..8b7f34ebc 100644 --- a/src/edt/edt/edtEditorOptionsPages.h +++ b/src/edt/edt/edtEditorOptionsPages.h @@ -111,7 +111,7 @@ public slots: private: std::vector m_pages; - lay::Dispatcher *mp_root; + lay::Dispatcher *mp_dispatcher; QTabWidget *mp_pages; void update (edt::EditorOptionsPage *page); diff --git a/src/edt/edt/edtMainService.cc b/src/edt/edt/edtMainService.cc index 548b1b855..9e2673d21 100644 --- a/src/edt/edt/edtMainService.cc +++ b/src/edt/edt/edtMainService.cc @@ -2362,6 +2362,12 @@ private: db::cell_index_type m_topcell; }; +void +MainService::config_finalize () +{ + setup_pages (view ()); +} + void MainService::paste () { diff --git a/src/edt/edt/edtMainService.h b/src/edt/edt/edtMainService.h index 5313da97f..34bdf512d 100644 --- a/src/edt/edt/edtMainService.h +++ b/src/edt/edt/edtMainService.h @@ -199,6 +199,12 @@ public: */ virtual void paste (); + /** + * @brief Implementation of "config_finalize" + * This implementation will update the editor option page's parameters. + */ + virtual void config_finalize (); + private: // The layout view that this service is attached to lay::LayoutView *mp_view; diff --git a/src/edt/edt/edtPlugin.cc b/src/edt/edt/edtPlugin.cc index d9f241d8f..4e0ca160a 100644 --- a/src/edt/edt/edtPlugin.cc +++ b/src/edt/edt/edtPlugin.cc @@ -377,12 +377,12 @@ show_editor_options_page (lay::LayoutView *view) } } - edt::EditorOptionsPages *pages = new edt::EditorOptionsPages (view->editor_options_frame (), prop_dialog_pages, view->dispatcher ()); + edt::EditorOptionsPages *pages = new edt::EditorOptionsPages (view->editor_options_frame (), prop_dialog_pages, view); view->editor_options_frame ()->layout ()->addWidget (pages); } -void -activate_service (lay::LayoutView *view, const lay::PluginDeclaration *pd, bool active) +static +edt::EditorOptionsPages *get_pages_widget (lay::LayoutView *view) { // TODO: is there a better way to find the editor options pages? edt::EditorOptionsPages *eo_pages = 0; @@ -391,6 +391,13 @@ activate_service (lay::LayoutView *view, const lay::PluginDeclaration *pd, bool eo_pages = dynamic_cast (*c); } + return eo_pages; +} + +void +activate_service (lay::LayoutView *view, const lay::PluginDeclaration *pd, bool active) +{ + edt::EditorOptionsPages *eo_pages = get_pages_widget (view); if (!eo_pages) { return; } @@ -400,6 +407,19 @@ activate_service (lay::LayoutView *view, const lay::PluginDeclaration *pd, bool } } +void +setup_pages (lay::LayoutView *view) +{ + edt::EditorOptionsPages *eo_pages = get_pages_widget (view); + if (!eo_pages) { + return; + } + + for (std::vector::const_iterator op = eo_pages->pages ().begin (); op != eo_pages->pages ().end (); ++op) { + (*op)->setup (view); + } +} + class PartialPluginDeclaration : public lay::PluginDeclaration { diff --git a/src/edt/edt/edtPlugin.h b/src/edt/edt/edtPlugin.h index 86898c714..fe0c8a2c0 100644 --- a/src/edt/edt/edtPlugin.h +++ b/src/edt/edt/edtPlugin.h @@ -60,6 +60,11 @@ namespace edt * This will show or hide the editor properties pages for the respective service. */ void activate_service (lay::LayoutView *view, const lay::PluginDeclaration *pd, bool active); + + /** + * @brief Setup the editor option pages for the given view + */ + void setup_pages (lay::LayoutView *view); } #endif