]> git.lyx.org Git - features.git/commitdiff
move view_ids from Application to GuiApplication
authorAndré Pönitz <poenitz@gmx.net>
Sat, 17 Nov 2007 22:25:42 +0000 (22:25 +0000)
committerAndré Pönitz <poenitz@gmx.net>
Sat, 17 Nov 2007 22:25:42 +0000 (22:25 +0000)
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@21658 a592a061-630c-0410-9148-cb99ea01b6c8

src/LyXFunc.cpp
src/frontends/Application.h
src/frontends/qt4/GuiApplication.h
src/frontends/qt4/GuiView.cpp

index 0ec1e9c4e97e0b231b546e809066984d9f59fde2..cfeae9188830ca616c27f0e0d73ae1952bc35f01 100644 (file)
@@ -701,7 +701,7 @@ FuncStatus LyXFunc::getStatus(FuncRequest const & cmd) const
                break;
        }
        case LFUN_WINDOW_CLOSE: {
-               enable = (theApp()->viewIds().size() > 1);
+               enable = theApp()->viewCount() > 0;
                break;
        }
 
@@ -718,7 +718,7 @@ FuncStatus LyXFunc::getStatus(FuncRequest const & cmd) const
 
        case LFUN_CALL: {
                FuncRequest func;
-               std::string name(to_utf8(cmd.argument()));
+               std::string name = to_utf8(cmd.argument());
                if (LyX::ref().topLevelCmdDef().lock(name, func)) {
                        func.origin = cmd.origin;
                        flag = getStatus(func);
index 858bf3e77d5e1c9a5654ef01df363adc091ca34e..985137304f63dcba4480bd7f02ec406a80548d5e 100644 (file)
@@ -17,8 +17,6 @@
 
 #include <boost/function.hpp>
 
-#include <vector>
-
 
 namespace lyx {
 
@@ -163,7 +161,7 @@ public:
        ///
        virtual LyXView & view(int id) const = 0;
        ///
-       std::vector<int> const & viewIds() { return view_ids_; }
+       virtual size_t viewCount() const = 0;
 
        ///
        virtual void hideDialogs(std::string const & name, Inset * inset) const = 0;
@@ -243,8 +241,6 @@ protected:
        /// This LyXView is the one receiving Clipboard and Selection
        /// events
        LyXView * current_view_;
-       ///
-       std::vector<int> view_ids_;
 };
 
 } // namespace frontend
index c7e8f4f5a9fb41693ae8be1fb12ccaea393b87b2..4496a01be8779f1a776a79c14bbbc3e880f2fdc1 100644 (file)
@@ -25,6 +25,7 @@
 #include <QTranslator>
 
 #include <map>
+#include <vector>
 
 class QSessionManager;
 
@@ -79,6 +80,9 @@ public:
        void commitData(QSessionManager & sm);
        //@}
 
+       virtual size_t viewCount() const { return view_ids_.size(); }
+       std::vector<int> const & viewIds() { return view_ids_; }
+
        ///
        ColorCache & colorCache() { return color_cache_; }
        ///
@@ -130,6 +134,8 @@ public:
        * \sa Qt::WA_DeleteOnClose attribute.
        */
        std::map<int, GuiView *> views_;
+       ///
+       std::vector<int> view_ids_;
 }; // GuiApplication
 
 extern GuiApplication * guiApp;
index 11f90e20397000a67b7e3bd09b703969258018b8..a11c0acac0679191803d303334b90e40e63aa18e 100644 (file)
@@ -403,7 +403,7 @@ void GuiView::closeEvent(QCloseEvent * close_event)
 {
        // we may have been called through the close window button
        // which bypasses the LFUN machinery.
-       if (!quitting_by_menu_ && theApp()->viewIds().size() == 1) {
+       if (!quitting_by_menu_ && theApp()->viewCount() == 1) {
                if (!theBufferList().quitWriteAll()) {
                        close_event->ignore();
                        return;
@@ -429,7 +429,7 @@ void GuiView::closeEvent(QCloseEvent * close_event)
        }
 
        theApp()->unregisterView(id());
-       if (!theApp()->viewIds().empty()) {
+       if (theApp()->viewCount() > 0) {
                // Just close the window and do nothing else if this is not the
                // last window.
                close_event->accept();