]> git.lyx.org Git - features.git/commitdiff
Put LyXView on a diet, step 1: get rid of toolbars direct access from the core. Toolb...
authorAbdelrazak Younes <younes@lyx.org>
Thu, 23 Aug 2007 12:21:47 +0000 (12:21 +0000)
committerAbdelrazak Younes <younes@lyx.org>
Thu, 23 Aug 2007 12:21:47 +0000 (12:21 +0000)
* LyXView:
- getToolbars(): deleted.
- toolbars_: now protected. The goal is to transfer that to GuiView.
- openLayoutList(): new method. The core should not know how this list is displayed.
- showMiniBuffer(): new pure virtual method to show the mini-buffer.
- focus_command_buffer: deleted.

* GuiView:
- focus_command_widget(): deleted.
- showMiniBuffer(): implemented.

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

src/LyXFunc.cpp
src/frontends/LyXView.cpp
src/frontends/LyXView.h
src/frontends/controllers/ControlCommandBuffer.cpp
src/frontends/qt4/GuiView.cpp
src/frontends/qt4/GuiView.h

index 92e83f05cfb511a7ed8de21ebf6518c75cd31eae..c1ec1ae5908a1748c40ed1a9fcc6b9137139b70c 100644 (file)
@@ -666,7 +666,7 @@ FuncStatus LyXFunc::getStatus(FuncRequest const & cmd) const
                break;
 
        case LFUN_TOOLBAR_TOGGLE: {
-               bool const current = lyx_view_->getToolbars().visible(cmd.getArg(0));
+               bool const current = lyx_view_->isToolbarVisible(cmd.getArg(0));
                flag.setOnOff(current);
                break;
        }
@@ -888,8 +888,7 @@ void LyXFunc::dispatch(FuncRequest const & cmd)
 
                case LFUN_COMMAND_EXECUTE:
                        BOOST_ASSERT(lyx_view_);
-                       lyx_view_->getToolbars().display("minibuffer", true);
-                       lyx_view_->focus_command_buffer();
+                       lyx_view_->showMiniBuffer(true);
                        break;
 
                case LFUN_CANCEL:
@@ -1294,7 +1293,7 @@ void LyXFunc::dispatch(FuncRequest const & cmd)
 
                case LFUN_DROP_LAYOUTS_CHOICE:
                        BOOST_ASSERT(lyx_view_);
-                       lyx_view_->getToolbars().openLayoutList();
+                       lyx_view_->openLayoutList();
                        break;
 
                case LFUN_MENU_OPEN:
index af322ba09207fac4b80ff518c08b4102bba089ee..895704aa8e09fcedb4e25317f761ffec360c89be 100644 (file)
@@ -431,5 +431,17 @@ Buffer const * const LyXView::updateInset(Inset const * inset)
        return &work_area->bufferView().buffer();
 }
 
+
+void LyXView::openLayoutList()
+{
+       toolbars_->openLayoutList();
+}
+
+
+bool LyXView::isToolbarVisible(std::string const & id)
+{
+       return toolbars_->visible(id);
+}
+
 } // namespace frontend
 } // namespace lyx
index 7bf5ae92457015809f22e7f110187060ebc281a9..912e3880be142f023fb87e93190dc3ddc1c76870 100644 (file)
@@ -124,10 +124,12 @@ public:
        Buffer * buffer();
        Buffer const * buffer() const;
 
-       /// return the toolbar for this view
-       Toolbars & getToolbars() { return *toolbars_.get(); }
        ///
-       Toolbars const & getToolbars() const { return *toolbars_.get(); }
+       void openLayoutList();
+       ///
+       bool isToolbarVisible(std::string const & id);
+       ///
+       virtual void showMiniBuffer(bool visible) = 0;
 
        /// return the menubar for this view
        Menubar & getMenubar() { return *menubar_.get(); }
@@ -162,9 +164,6 @@ public:
        /// update the status bar
        virtual void updateStatusBar() = 0;
 
-       /// focus the command buffer (minibuffer)
-       boost::signal<void()> focus_command_buffer;
-
        /// display a message in the view
        virtual void message(docstring const &) = 0;
 
@@ -203,6 +202,8 @@ protected:
 
        /// view's menubar
        boost::scoped_ptr<Menubar> menubar_;
+       /// view's toolbar
+       boost::scoped_ptr<Toolbars> toolbars_;
 
 private:
        /**
@@ -215,8 +216,6 @@ private:
        /// called on timeout
        void autoSave();
 
-       /// view's toolbar
-       boost::scoped_ptr<Toolbars> toolbars_;
        /// auto-saving of buffers
        boost::scoped_ptr<Timeout> const autosave_timeout_;
        /// our function handler
index 959bfb73266b5118530612c01d4dc022862f46a8..6ed5a51a78c5a0395ff604bfe04591d1759df99d 100644 (file)
@@ -87,7 +87,7 @@ docstring const ControlCommandBuffer::getCurrentState() const
 
 void ControlCommandBuffer::hide() const
 {
-       lv_.getToolbars().display("minibuffer", false);
+       lv_.showMiniBuffer(false);
 }
 
 
index cb9114f1c7fbbc63691e5dbf404d1498a3eb28b2..ab3307068dabcfe4ba88c70f0c651e6765ad129f 100644 (file)
@@ -310,7 +310,7 @@ void GuiView::init()
        QObject::connect(menuBar(), SIGNAL(triggered(QAction *)),
                this, SLOT(updateMenu(QAction *)));
 
-       getToolbars().init();
+       toolbars_->init();
 
        statusBar()->setSizeGripEnabled(true);
 
@@ -445,7 +445,7 @@ void GuiView::saveGeometry()
                session.sessionInfo().save("WindowPosX", convert<string>(normal_geometry.x() + d.posx_offset));
                session.sessionInfo().save("WindowPosY", convert<string>(normal_geometry.y() + d.posy_offset));
        }
-       getToolbars().saveToolbarInfo();
+       toolbars_->saveToolbarInfo();
 }
 
 
@@ -579,7 +579,6 @@ void GuiView::setWindowTitle(docstring const & t, docstring const & it)
 void GuiView::addCommandBuffer(QToolBar * toolbar)
 {
        commandbuffer_ = new QCommandBuffer(this, *controlcommand_);
-       focus_command_buffer.connect(boost::bind(&GuiView::focus_command_widget, this));
        toolbar->addWidget(commandbuffer_);
 }
 
@@ -623,13 +622,6 @@ void GuiView::bigSizedIcons()
 }
 
 
-void GuiView::focus_command_widget()
-{
-       if (commandbuffer_)
-               commandbuffer_->focus_command();
-}
-
-
 void GuiView::update_view_state_qt()
 {
        if (!hasFocus())
@@ -946,6 +938,15 @@ void GuiView::removeWorkArea(WorkArea * work_area)
 }
 
 
+void GuiView::showMiniBuffer(bool visible)
+{
+       if (!commandbuffer_)
+               return;
+
+       toolbars_->display("minibuffer", visible);
+       commandbuffer_->focus_command();
+}
+
 } // namespace frontend
 } // namespace lyx
 
index dd5a425de03f8f3750623d0f53f36e0d7f8ca88b..0c67e340737aed01856d3d020d715a18ab124504 100644 (file)
@@ -71,6 +71,7 @@ public:
        virtual void message(docstring const & str);
        virtual void clearMessage();
        virtual bool hasFocus() const;
+       void showMiniBuffer(bool);
 
        /// show - display the top-level window
        void show();
@@ -130,9 +131,6 @@ private:
        ///
        void dropEvent(QDropEvent * ev);
 
-       /// focus the command buffer widget
-       void focus_command_widget();
-
        /**
         * setWindowTitle - set title of window
         * @param t main window title