]> git.lyx.org Git - features.git/commitdiff
Put LyXView on a diet, step 2: get rid of menubar direct access from the core. Menuba...
authorAbdelrazak Younes <younes@lyx.org>
Thu, 23 Aug 2007 12:44:21 +0000 (12:44 +0000)
committerAbdelrazak Younes <younes@lyx.org>
Thu, 23 Aug 2007 12:44:21 +0000 (12:44 +0000)
* LyXView:
- getMenubars(): deleted.
- menubar_: transfered to GuiView::private.
- updateMenubar(): deleted, QLMenubar::update() is a void method anyway (to be deleted soon).

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@19750 a592a061-630c-0410-9148-cb99ea01b6c8

src/LyXFunc.cpp
src/frontends/LyXView.cpp
src/frontends/LyXView.h
src/frontends/WorkArea.cpp
src/frontends/qt4/GuiView.cpp
src/frontends/qt4/GuiView.h

index c1ec1ae5908a1748c40ed1a9fcc6b9137139b70c..b9384260d105ea63270e907870deeb4d34be78f9 100644 (file)
@@ -1298,7 +1298,7 @@ void LyXFunc::dispatch(FuncRequest const & cmd)
 
                case LFUN_MENU_OPEN:
                        BOOST_ASSERT(lyx_view_);
-                       lyx_view_->getMenubar().openByName(from_utf8(argument));
+                       lyx_view_->openMenu(from_utf8(argument));
                        break;
 
                // --- lyxserver commands ----------------------------
@@ -1927,7 +1927,6 @@ void LyXFunc::dispatch(FuncRequest const & cmd)
                }
        }
        if (!quitting && lyx_view_) {
-               lyx_view_->updateMenubar();
                lyx_view_->updateToolbars();
                // Some messages may already be translated, so we cannot use _()
                sendDispatchMessage(translateIfPossible(getMessage()), cmd);
index 895704aa8e09fcedb4e25317f761ffec360c89be..5247c3f77dea80e9f86a4b77fdb6cf720885bfb6 100644 (file)
@@ -308,9 +308,7 @@ void LyXView::updateToolbars()
        } else
                toolbars_->update(false, false, false);
 
-       // update redaonly status of open dialogs. This could also be in
-       // updateMenubar(), but since updateToolbars() and updateMenubar()
-       // are always called together it is only here.
+       // update redaonly status of open dialogs.
        getDialogs().checkStatus();
 }
 
@@ -335,12 +333,6 @@ void LyXView::toggleToolbarState(string const & name, bool allowauto)
 }
 
 
-void LyXView::updateMenubar()
-{
-       menubar_->update();
-}
-
-
 void LyXView::autoSave()
 {
        LYXERR(Debug::INFO) << "Running autoSave()" << endl;
index 912e3880be142f023fb87e93190dc3ddc1c76870..19ff3d47512d901b43f9ad1c01e71b9458aa648c 100644 (file)
@@ -41,7 +41,6 @@ namespace frontend {
 
 class ControlCommandBuffer;
 class Dialogs;
-class Menubar;
 class WorkArea;
 
 /**
@@ -130,11 +129,7 @@ public:
        bool isToolbarVisible(std::string const & id);
        ///
        virtual void showMiniBuffer(bool visible) = 0;
-
-       /// return the menubar for this view
-       Menubar & getMenubar() { return *menubar_.get(); }
-       ///
-       Menubar const & getMenubar() const { return *menubar_.get(); }
+       virtual void openMenu(docstring const & name) = 0;
 
        /// get access to the dialogs
        Dialogs & getDialogs() { return *dialogs_.get(); }
@@ -159,8 +154,6 @@ public:
        ToolbarInfo * getToolbarInfo(std::string const & name);
        /// toggle toolbar state
        void toggleToolbarState(std::string const & name, bool allowauto);
-       /// update the menubar
-       void updateMenubar();
        /// update the status bar
        virtual void updateStatusBar() = 0;
 
@@ -200,8 +193,6 @@ protected:
        /// disconnect from signals in the given buffer
        void disconnectBuffer();
 
-       /// view's menubar
-       boost::scoped_ptr<Menubar> menubar_;
        /// view's toolbar
        boost::scoped_ptr<Toolbars> toolbars_;
 
index d27816a6763ce02dd6f614ead0664104cda6f411..3da4e4cfe61be8e46be773e6a107a03d9011920b 100644 (file)
@@ -219,7 +219,6 @@ void WorkArea::dispatch(FuncRequest const & cmd0, key_modifier::state k)
        // Skip these when selecting
        if (cmd.action != LFUN_MOUSE_MOTION) {
                lyx_view_->updateLayoutChoice();
-               lyx_view_->updateMenubar();
                lyx_view_->updateToolbars();
        }
 
index ab3307068dabcfe4ba88c70f0c651e6765ad129f..36af40fa7ce0de4841ca4b0c2b6895b4e3834caf 100644 (file)
@@ -140,6 +140,8 @@ struct GuiView::GuiViewPrivate
        TabWidget * tab_widget_;
        QStackedWidget * stack_widget_;
        BackgroundWidget * bg_widget_;
+       /// view's menubar
+       QLMenubar * menubar_;
 
        GuiViewPrivate() : posx_offset(0), posy_offset(0)
        {}
@@ -278,7 +280,7 @@ GuiView::GuiView(int id)
 
 GuiView::~GuiView()
 {
-       menubar_.reset();
+       delete d.menubar_;
        delete &d;
 }
 
@@ -306,7 +308,7 @@ QMenu* GuiView::createPopupMenu()
 
 void GuiView::init()
 {
-       menubar_.reset(new QLMenubar(this, menubackend));
+       d.menubar_ = new QLMenubar(this, menubackend);
        QObject::connect(menuBar(), SIGNAL(triggered(QAction *)),
                this, SLOT(updateMenu(QAction *)));
 
@@ -561,7 +563,7 @@ void GuiView::setGeometry(unsigned int width,
 
 void GuiView::updateMenu(QAction * /*action*/)
 {
-       menubar_->update();
+       d.menubar_->update();
 }
 
 
@@ -658,7 +660,6 @@ void GuiView::currentTabChanged(int i)
        // hidden. This should go here because some dialogs (eg ToC)
        // require bv_->text.
        getDialogs().updateBufferDependent(true);
-       updateMenubar();
        updateToolbars();
        updateLayoutChoice();
        updateWindowTitle();
@@ -947,6 +948,12 @@ void GuiView::showMiniBuffer(bool visible)
        commandbuffer_->focus_command();
 }
 
+
+void GuiView::openMenu(docstring const & name)
+{
+       d.menubar_->openByName(name);
+}
+
 } // namespace frontend
 } // namespace lyx
 
index 0c67e340737aed01856d3d020d715a18ab124504..5eb2e32f68ec591ecff2ef97e9609838f579dc47 100644 (file)
@@ -72,6 +72,7 @@ public:
        virtual void clearMessage();
        virtual bool hasFocus() const;
        void showMiniBuffer(bool);
+       void openMenu(docstring const &);
 
        /// show - display the top-level window
        void show();