]> git.lyx.org Git - features.git/commitdiff
shuffle some code around
authorAndré Pönitz <poenitz@gmx.net>
Thu, 15 Nov 2007 22:30:16 +0000 (22:30 +0000)
committerAndré Pönitz <poenitz@gmx.net>
Thu, 15 Nov 2007 22:30:16 +0000 (22:30 +0000)
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@21636 a592a061-630c-0410-9148-cb99ea01b6c8

src/LyX.cpp
src/LyXFunc.cpp
src/frontends/Application.h
src/frontends/Gui.h
src/frontends/qt4/GuiApplication.h
src/frontends/qt4/GuiImplementation.cpp
src/frontends/qt4/GuiImplementation.h

index 1089fe9532ebcc51021ca52cd47308f03d571375..efb1237950c7b70d910b87e798ae17a426675992 100644 (file)
@@ -48,7 +48,6 @@
 
 #include "frontends/alert.h"
 #include "frontends/Application.h"
-#include "frontends/Dialogs.h"
 #include "frontends/Gui.h"
 #include "frontends/LyXView.h"
 
@@ -380,18 +379,7 @@ Buffer const * LyX::updateInset(Inset const * inset) const
 {
        if (quitting || !inset)
                return 0;
-
-       Buffer const * buffer_ptr = 0;
-       vector<int> const & view_ids = pimpl_->application_->gui().viewIds();
-       vector<int>::const_iterator it = view_ids.begin();
-       vector<int>::const_iterator const end = view_ids.end();
-       for (; it != end; ++it) {
-               Buffer const * ptr =
-                       pimpl_->application_->gui().view(*it).updateInset(inset);
-               if (ptr)
-                       buffer_ptr = ptr;
-       }
-       return buffer_ptr;
+       return application().gui().updateInset(inset);
 }
 
 
@@ -399,13 +387,7 @@ void LyX::hideDialogs(std::string const & name, Inset * inset) const
 {
        if (quitting || !use_gui)
                return;
-
-       vector<int> const & view_ids = pimpl_->application_->gui().viewIds();
-       vector<int>::const_iterator it = view_ids.begin();
-       vector<int>::const_iterator const end = view_ids.end();
-       for (; it != end; ++it)
-               pimpl_->application_->gui().view(*it).getDialogs().
-                       hide(name, inset);
+       application().gui().hideDialogs(name, inset);
 }
 
 
index 6b65f012419535c689b970dd2b939854f9164d88..557e7148e6e3b52c565287bc5228f2035e64dfd0 100644 (file)
@@ -137,6 +137,7 @@ using support::prefixIs;
 namespace Alert = frontend::Alert;
 
 extern bool quitting;
+extern bool use_gui;
 
 namespace {
 
@@ -1560,9 +1561,10 @@ void LyXFunc::dispatch(FuncRequest const & cmd)
                        break;
                }
 
-               case LFUN_DIALOG_HIDE:
+               case LFUN_DIALOG_HIDE: {
                        LyX::cref().hideDialogs(argument, 0);
                        break;
+               }
 
                case LFUN_DIALOG_TOGGLE: {
                        BOOST_ASSERT(lyx_view_);
index 8ca6ace8a31518530cee656964a9542c253113ac..8fbdc47989d9566d8b67f048f2930c7b23558ff5 100644 (file)
@@ -150,6 +150,7 @@ public:
 
        ///
        virtual Gui & gui() = 0;
+       virtual Gui const & gui() const = 0;
 
        /// Start the main event loop.
        /// The batch command is programmed to be execute once
index 6dd9c8316a101dc78a14b313f2a6e1bed286f00d..f0372f6d14f02de883a4f14acc1ef93267decca0 100644 (file)
 #ifndef BASE_GUI_H
 #define BASE_GUI_H
 
+#include "support/strfwd.h"
+
 #include <vector>
 
+
 namespace lyx {
+
+class Buffer;
+class Inset;
+
 namespace frontend {
 
 class LyXView;
@@ -42,6 +49,11 @@ public:
        ///
        std::vector<int> const & viewIds() { return view_ids_; }
 
+       ///
+       virtual void hideDialogs(std::string const & name, Inset * inset) const = 0;
+       ///
+       virtual Buffer const * updateInset(Inset const * inset) const = 0;
+
 protected:
        ///
        std::vector<int> view_ids_;
index 2d5a547f6c0ee29f11e23ef1a7f6bca43053d386..22b55beaf7facf368e0744c15b7ca743eb655019 100644 (file)
@@ -59,6 +59,7 @@ public:
        virtual FontLoader & fontLoader() { return font_loader_; }
        virtual int exec();
        virtual Gui & gui() { return gui_; }
+       virtual Gui const & gui() const { return gui_; }
        virtual void exit(int status);
        virtual bool event(QEvent * e);
        void syncEvents();
index 52f4da4fe606f7d305c5979987045ac3c38b1e6a..d370ffb9e07eee7b55bc2abdc69dd2eb28561667 100644 (file)
@@ -14,6 +14,7 @@
 
 #include "GuiImplementation.h"
 #include "GuiView.h"
+#include "Dialogs.h"
 
 #include <boost/assert.hpp>
 
@@ -21,6 +22,7 @@
 
 using std::map;
 using std::vector;
+using std::string;
 
 
 namespace lyx {
@@ -104,6 +106,29 @@ LyXView & GuiImplementation::view(int id) const
 }
 
 
+void GuiImplementation::hideDialogs(string const & name, Inset * inset) const
+{
+       vector<int>::const_iterator it = view_ids_.begin();
+       vector<int>::const_iterator const end = view_ids_.end();
+       for (; it != end; ++it)
+               view(*it).getDialogs().hide(name, inset);
+}
+
+
+Buffer const * GuiImplementation::updateInset(Inset const * inset) const
+{
+       Buffer const * buffer_ptr = 0;
+       vector<int>::const_iterator it = view_ids_.begin();
+       vector<int>::const_iterator const end = view_ids_.end();
+       for (; it != end; ++it) {
+               Buffer const * ptr = view(*it).updateInset(inset);
+               if (ptr)
+                       buffer_ptr = ptr;
+       }
+       return buffer_ptr;
+}
+
+
 } // namespace frontend
 } // namespace lyx
 
index 38a51e5aa693c4f6877c946cfb076ec7634e27de..44749491724c6c9aaff4f1fccdd3416a218441e4 100644 (file)
@@ -41,9 +41,12 @@ public:
        virtual bool unregisterView(int id);
 
        virtual LyXView& view(int id) const;
+       ///
+       virtual void hideDialogs(std::string const & name, Inset * inset) const;
+       ///
+       virtual Buffer const * updateInset(Inset const * inset) const;
 
 private:
-
        /// Multiple views container.
        /**
        * Warning: This must not be a smart pointer as the destruction of the