]> git.lyx.org Git - lyx.git/commitdiff
Some more cosmetics and removal of unused methods in GuiView.
authorAbdelrazak Younes <younes@lyx.org>
Tue, 13 Nov 2007 14:04:32 +0000 (14:04 +0000)
committerAbdelrazak Younes <younes@lyx.org>
Tue, 13 Nov 2007 14:04:32 +0000 (14:04 +0000)
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@21582 a592a061-630c-0410-9148-cb99ea01b6c8

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

index 04b68a03dd0e243eadcbbaa786072a00786f796e..0c6aa466f2f4eac4651c2decf2e890acc99a95ee 100644 (file)
@@ -951,7 +951,7 @@ void LyXFunc::dispatch(FuncRequest const & cmd)
 
                case LFUN_COMMAND_EXECUTE:
                        BOOST_ASSERT(lyx_view_);
-                       lyx_view_->showMiniBuffer(true);
+                       lyx_view_->dispatch(cmd);
                        break;
 
                case LFUN_CANCEL:
@@ -1085,7 +1085,7 @@ void LyXFunc::dispatch(FuncRequest const & cmd)
                case LFUN_BUFFER_EXPORT:
                        BOOST_ASSERT(lyx_view_ && lyx_view_->buffer());
                        if (argument == "custom")
-                               lyx_view_->getDialogs().show("sendto");
+                               lyx_view_->showDialog("sendto");
                        else
                                lyx_view_->buffer()->doExport(argument, false);
                        break;
@@ -1439,7 +1439,7 @@ void LyXFunc::dispatch(FuncRequest const & cmd)
                        if (name == "character") {
                                data = freefont2string();
                                if (!data.empty())
-                                       lyx_view_->getDialogs().show("character", data);
+                                       lyx_view_->showDialogWithData("character", data);
                        } else if (name == "latexlog") {
                                Buffer::LogType type; 
                                string const logfile = lyx_view_->buffer()->logName(&type);
@@ -1452,13 +1452,13 @@ void LyXFunc::dispatch(FuncRequest const & cmd)
                                        break;
                                }
                                data += Lexer::quoteString(logfile);
-                               lyx_view_->getDialogs().show("log", data);
+                               lyx_view_->showDialogWithData("log", data);
                        } else if (name == "vclog") {
                                string const data = "vc " +
                                        Lexer::quoteString(lyx_view_->buffer()->lyxvc().getLogFile());
-                               lyx_view_->getDialogs().show("log", data);
+                               lyx_view_->showDialogWithData("log", data);
                        } else
-                               lyx_view_->getDialogs().show(name, data);
+                               lyx_view_->showDialogWithData(name, data);
                        break;
                }
 
@@ -1570,7 +1570,7 @@ void LyXFunc::dispatch(FuncRequest const & cmd)
                        } else if (name == "paragraph") {
                                dispatch(FuncRequest(LFUN_PARAGRAPH_UPDATE));
                        } else if (name == "prefs") {
-                               lyx_view_->getDialogs().update(name, string());
+                               lyx_view_->updateDialog(name, string());
                        }
                        break;
                }
index ac045354078396b496e5d0290e0cf2f8d1758ed5..77aa49ed8c3f597a55d0ae18720ace468ef2370c 100644 (file)
@@ -100,7 +100,6 @@ public:
        ///
        virtual bool isToolbarVisible(std::string const & id) = 0;
        ///
-       virtual void showMiniBuffer(bool visible) = 0;
        virtual void openMenu(docstring const & name) = 0;
 
        /// get access to the dialogs
index d77db6a90f3c3f1f9f0bbe9fba6205938a815b72..2a1ca377b41824756f419e51be3b4262b1baf4b4 100644 (file)
 
 #include <config.h>
 
-#include "GuiView.h"
-
 #include "GuiCommandBuffer.h"
+
 #include "GuiCommandEdit.h"
+#include "GuiView.h"
 #include "qt_helpers.h"
 
 #include "BufferView.h"
@@ -87,7 +87,7 @@ protected:
 
 
 GuiCommandBuffer::GuiCommandBuffer(GuiView * view)
-       : view_(view), lv_(*view), history_pos_(history_.end())
+       : view_(view), history_pos_(history_.end())
 {
        transform(lyxaction.func_begin(), lyxaction.func_end(),
                back_inserter(commands_), firster());
@@ -266,13 +266,13 @@ string const GuiCommandBuffer::historyDown()
 
 docstring const GuiCommandBuffer::getCurrentState() const
 {
-       return lv_.view()->cursor().currentState();
+       return view_->view()->cursor().currentState();
 }
 
 
 void GuiCommandBuffer::hide() const
 {
-       lv_.showMiniBuffer(false);
+       view_->showMiniBuffer(false);
 }
 
 
@@ -324,7 +324,7 @@ void GuiCommandBuffer::dispatch(string const & str)
        history_pos_ = history_.end();
        FuncRequest func = lyxaction.lookupFunc(str);
        func.origin = FuncRequest::COMMANDBUFFER;
-       lv_.dispatch(func);
+       view_->dispatch(func);
 }
 
 } // namespace frontend
index b3a1004d4e9ebde08a0ec92bf92f040e61c7467f..9f8ec74216e9e2a952637905837459f8651f271c 100644 (file)
@@ -25,7 +25,6 @@ class QListWidgetItem;
 namespace lyx {
 namespace frontend {
 
-class LyXView;
 class GuiView;
 class GuiCommandEdit;
 
@@ -54,8 +53,6 @@ public Q_SLOTS:
 private:
        /// owning view
        GuiView * view_;
-       ///
-       LyXView & lv_;
        /// command widget
        GuiCommandEdit * edit_;
 
index 5dc221fe16ccdde065b826932241cae7523c6692..406c045f7c7b27adb33f65898d06e828394a89f0 100644 (file)
@@ -684,12 +684,6 @@ void GuiView::updateStatusBar()
 }
 
 
-void GuiView::activated(FuncRequest const & func)
-{
-       dispatch(func);
-}
-
-
 bool GuiView::hasFocus() const
 {
        return qApp->activeWindow() == this;
@@ -785,14 +779,6 @@ bool GuiView::focusNextPrevChild(bool /*next*/)
 }
 
 
-void GuiView::showView()
-{
-       setWindowTitle(qt_("LyX"));
-       show();
-       updateFloatingGeometry();
-}
-
-
 void GuiView::setBusy(bool yes)
 {
        if (d.current_work_area_) {
@@ -900,12 +886,6 @@ void GuiView::addTabWorkArea()
 }
 
 
-GuiWorkArea * GuiView::currentWorkArea()
-{
-       return d.current_work_area_;
-}
-
-
 GuiWorkArea const * GuiView::currentWorkArea() const
 {
        return d.current_work_area_;
@@ -1225,11 +1205,15 @@ void GuiView::resetAutosaveTimers()
 
 void GuiView::dispatch(FuncRequest const & cmd)
 {
-       string const argument = to_utf8(cmd.argument());
        switch(cmd.action) {
                case LFUN_BUFFER_SWITCH:
                        setBuffer(theBufferList().getBuffer(to_utf8(cmd.argument())));
                        break;
+
+               case LFUN_COMMAND_EXECUTE:
+                       showMiniBuffer(true);
+                       break;
+
                default:
                        theLyXFunc().setLyXView(this);
                        lyx::dispatch(cmd);
index 45cedc88acc99b179cbf91b91bc0a1aaabb87181..9b29d126071af93b0d08426c651b447d6fb5eb9d 100644 (file)
@@ -81,19 +81,9 @@ public:
        void updateToolbars();
        ToolbarInfo * getToolbarInfo(std::string const & name);
        void toggleToolbarState(std::string const & name, bool allowauto);
-
-       /// show - display the top-level window
-       void showView();
-
-       /// menu item has been selected
-       void activated(FuncRequest const &);
-
        ///
        QMenu * createPopupMenu();
 
-       ///
-       void addTabWorkArea();
-
        /// dispatch to current BufferView
        void dispatch(FuncRequest const & cmd);
 
@@ -103,34 +93,45 @@ public:
        /// set a buffer to the current workarea.
        void setBuffer(Buffer * b); ///< \c Buffer to set.
 
-Q_SIGNALS:
-       void closing(int);
-
-public Q_SLOTS:
-       /// idle timeout.
-       /// clear any temporary message and replace with current status.
-       void clearMessage();
+       /// GuiBufferDelegate.
+       ///@{
+       void resetAutosaveTimers();
+       void errors(std::string const &);
+       void structureChanged() { updateToc(); }
+       ///@}
 
+       ////
+       void showDialog(std::string const & name);
+       void showDialogWithData(std::string const & name,
+               std::string const & data);
+       void showInsetDialog(std::string const & name,
+               std::string const & data, Inset * inset);
+       void updateDialog(std::string const & name,
+               std::string const & data);
+       
+       /// called on timeout
+       void autoSave();
        ///
-       void updateWindowTitle(GuiWorkArea * wa);
+       void updateEmbeddedFiles();
 
-       ///
-       void on_currentWorkAreaChanged(GuiWorkArea *);
+       /// \return the current buffer view.
+       BufferView * view();
 
-       /// slots to change the icon size
-       void smallSizedIcons();
-       void normalSizedIcons();
-       void bigSizedIcons();
+       /// get access to the dialogs
+       Dialogs & getDialogs() { return *dialogs_; }
+       ///
+       Dialogs const & getDialogs() const { return *dialogs_; }
 
-private:
-       friend class GuiWorkArea;
+       /// load a buffer into the current workarea.
+       Buffer * loadLyXFile(support::FileName const &  name, ///< File to load.
+               bool tolastfiles = true);  ///< append to the "Open recent" menu?
 
-       /// make sure we quit cleanly
-       virtual void closeEvent(QCloseEvent * e);
-       ///
-       virtual void resizeEvent(QResizeEvent * e);
+       /** redraw \c inset in all the BufferViews in which it is currently
+        *  visible. If successful return a pointer to the owning Buffer.
+        */
+       Buffer const * updateInset(Inset const *);
        ///
-       virtual void moveEvent(QMoveEvent * e);
+       void restartCursor();
 
        /// \return the \c Workarea associated to \p  Buffer
        /// \retval 0 if no \c WorkArea is found.
@@ -146,17 +147,30 @@ private:
        void removeWorkArea(GuiWorkArea * work_area);
        /// return the current WorkArea (the one that has the focus).
        GuiWorkArea const * currentWorkArea() const;
-       /// FIXME: This non-const access is needed because of
-       /// a mis-designed \c ControlSpellchecker.
-       GuiWorkArea * currentWorkArea();
 
-       /// GuiBufferDelegate.
-       ///@{
-       void resetAutosaveTimers();
-       void errors(std::string const &);
-       void structureChanged() { updateToc(); }
-       ///@}
+Q_SIGNALS:
+       void closing(int);
 
+public Q_SLOTS:
+       /// idle timeout.
+       /// clear any temporary message and replace with current status.
+       void clearMessage();
+
+private Q_SLOTS:
+       ///
+       void updateWindowTitle(GuiWorkArea * wa);
+
+       ///
+       void on_currentWorkAreaChanged(GuiWorkArea *);
+
+       /// slots to change the icon size
+       void smallSizedIcons();
+       void normalSizedIcons();
+       void bigSizedIcons();
+
+private:
+       ///
+       void addTabWorkArea();
 
        /// connect to signals in the given BufferView
        void connectBufferView(BufferView & bv);
@@ -166,57 +180,27 @@ private:
        void connectBuffer(Buffer & buf);
        /// disconnect from signals in the given buffer
        void disconnectBuffer();
-
-       ////
-       void showDialog(std::string const & name);
-       void showDialogWithData(std::string const & name,
-               std::string const & data);
-       void showInsetDialog(std::string const & name,
-               std::string const & data, Inset * inset);
-       void updateDialog(std::string const & name,
-               std::string const & data);
-       
        ///
        void updateToc();
-
        ///
        void dragEnterEvent(QDragEnterEvent * ev);
        ///
        void dropEvent(QDropEvent * ev);
+       /// make sure we quit cleanly
+       virtual void closeEvent(QCloseEvent * e);
+       ///
+       virtual void resizeEvent(QResizeEvent * e);
+       ///
+       virtual void moveEvent(QMoveEvent * e);
 
        /// in order to catch Tab key press.
        bool event(QEvent * e);
        bool focusNextPrevChild(bool);
        ///
        QRect updateFloatingGeometry();
-       /// called on timeout
-       void autoSave();
-       ///
-       void updateEmbeddedFiles();
-
-       /// \return the current buffer view.
-       BufferView * view();
-
-       /// get access to the dialogs
-       Dialogs & getDialogs() { return *dialogs_; }
-       ///
-       Dialogs const & getDialogs() const { return *dialogs_; }
-
-       //@}
-
-       /// load a buffer into the current workarea.
-       Buffer * loadLyXFile(support::FileName const &  name, ///< File to load.
-               bool tolastfiles = true);  ///< append to the "Open recent" menu?
-
-       /** redraw \c inset in all the BufferViews in which it is currently
-        *  visible. If successful return a pointer to the owning Buffer.
-        */
-       Buffer const * updateInset(Inset const *);
        ///
-       void restartCursor();
-
+       void setIconSize(unsigned int size);
 
-private:
        ///
        struct GuiViewPrivate;
        GuiViewPrivate & d;
@@ -230,8 +214,6 @@ private:
        ///
        QRect floatingGeometry_;
 
-       void setIconSize(unsigned int size);
-
        struct ToolbarSize {
                int top_width;
                int bottom_width;