]> git.lyx.org Git - lyx.git/commitdiff
If we are hiding a buffer _and_ the buffer is visible in another view/tabgroup, then...
authorVincent van Ravesteijn <vfr@lyx.org>
Sat, 15 Aug 2009 21:46:39 +0000 (21:46 +0000)
committerVincent van Ravesteijn <vfr@lyx.org>
Sat, 15 Aug 2009 21:46:39 +0000 (21:46 +0000)
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@31065 a592a061-630c-0410-9148-cb99ea01b6c8

src/frontends/qt4/GuiView.cpp
src/frontends/qt4/GuiView.h

index e9e167af33d64cc0777428b219e2c74149f70d14..564d6e52b9634f187212639f7f38f38714b92c3c 100644 (file)
@@ -1939,8 +1939,12 @@ bool GuiView::closeWorkArea(GuiWorkArea * wa, bool close_buffer,
        for (size_t i = 0; i < theSession().bookmarks().size(); ++i)
                theLyXFunc().gotoBookmark(i+1, false, false);
 
+       // if we are only hiding the buffer and there are multiple views
+       // of the buffer, then we do not need to ensure a clean buffer.
+       bool const allow_dirty = inMultiTabs(wa) && !close_buffer;
+
        Buffer & buf = wa->bufferView().buffer();
-       if (saveBufferIfNeeded(buf, !close_buffer)) {
+       if (allow_dirty || saveBufferIfNeeded(buf, !close_buffer)) {
                // save in sessions if requested
                // do not save childs if their master
                // is opened as well
@@ -2014,6 +2018,19 @@ bool GuiView::saveBufferIfNeeded(Buffer & buf, bool hiding)
 }
 
 
+bool GuiView::inMultiTabs(GuiWorkArea * wa)
+{
+       Buffer & buf = wa->bufferView().buffer();
+
+       for (int i = 0; i != d.splitter_->count(); ++i) {
+               GuiWorkArea * wa_ = d.tabWorkArea(i)->workArea(buf);
+               if (wa_ && wa_ != wa)
+                       return true;
+       }
+       return inMultiViews(wa);
+}
+
+
 bool GuiView::inMultiViews(GuiWorkArea * wa)
 {
        QList<int> const ids = guiApp->viewIds();
index 979cbef069fa8e47c362ba8493c2c952101f9c67..4cf5d027e92e6371d9235c78252d0ef5f095f5af 100644 (file)
@@ -304,6 +304,9 @@ private:
        bool saveBufferIfNeeded(Buffer & buf, bool hiding);
        ///
        bool closeBufferAll(bool tolastopened = false);
+       /// is the buffer in this workarea also shown in another tab ?
+       /// This tab can either be in the same view or in another one.
+       bool inMultiTabs(GuiWorkArea * wa);
        /// is the buffer in this workarea also shown in another view ?
        bool inMultiViews(GuiWorkArea * wa);
        ///