[email protected] schreef:
Author: vfr
Date: Sat Aug 15 23:46:39 2009
New Revision: 31065
URL: http://www.lyx.org/trac/changeset/31065

Log:
If we are hiding a buffer _and_ the buffer is visible in another view/tabgroup, 
then we don't need to ensure that the buffer is clean.

Modified:
   lyx-devel/trunk/src/frontends/qt4/GuiView.cpp
   lyx-devel/trunk/src/frontends/qt4/GuiView.h

Modified: lyx-devel/trunk/src/frontends/qt4/GuiView.cpp
==============================================================================
--- lyx-devel/trunk/src/frontends/qt4/GuiView.cpp       Sat Aug 15 23:33:37 
2009        (r31064)
+++ lyx-devel/trunk/src/frontends/qt4/GuiView.cpp       Sat Aug 15 23:46:39 
2009        (r31065)
@@ -1939,8 +1939,12 @@
        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::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();

Modified: lyx-devel/trunk/src/frontends/qt4/GuiView.h
==============================================================================
--- lyx-devel/trunk/src/frontends/qt4/GuiView.h Sat Aug 15 23:33:37 2009        
(r31064)
+++ lyx-devel/trunk/src/frontends/qt4/GuiView.h Sat Aug 15 23:46:39 2009        
(r31065)
@@ -304,6 +304,9 @@
        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);
        ///
Pavel ?

Ok for you now ?

PS. If you want to test a litttle, that can't hurt.

Vincent

Reply via email to