On 08/18/2009 04:12 PM, [email protected] wrote:
Author: vfr
Date: Tue Aug 18 22:12:34 2009
New Revision: 31125
URL: http://www.lyx.org/trac/changeset/31125

Log:
Rename closeBufferAll to closeWorkAreaAll (because that's what we do). Add a 
new closeBufferAll function that closes all WorkArea's and then all hidden 
buffers. This is easy now, because we've done everything to prevent hidden 
buffers to be dirty.

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       Tue Aug 18 21:27:19 
2009        (r31124)
+++ lyx-devel/trunk/src/frontends/qt4/GuiView.cpp       Tue Aug 18 22:12:34 
2009        (r31125)
@@ -584,34 +584,6 @@
  }


-bool GuiView::closeBufferAll(bool in_close_event)
-{
-       GuiWorkArea * active_wa = currentMainWorkArea();
-       setCurrentWorkArea(active_wa);
-
-       // We might be in a situation that there is still a tabWorkArea, but
-       // there are no tabs anymore. This can happen when we get here after a
-       // TabWorkArea::lastWorkAreaRemoved() signal. Therefore we count how
-       // many TabWorkArea's have no documents anymore.
-       int empty_twa = 0;
-
-       // We have to call count() each time, because it can happen that
-       // more than one splitter will disappear in one iteration (bug 5998).
-       for (; d.splitter_->count()>  empty_twa; ) {
-               TabWorkArea * twa = d.tabWorkArea(empty_twa);
-                               
-               if (twa->count() == 0)
-                       ++empty_twa;
-               else {
-                       setCurrentWorkArea(twa->currentWorkArea());
-                       if (!closeTabWorkArea(twa, true, active_wa))
-                               return false;
-               }
-       }
-       return true;
-}
-
-
  void GuiView::dragEnterEvent(QDragEnterEvent * event)
  {
        if (event->mimeData()->hasUrls())
@@ -1903,6 +1875,48 @@
  }


+bool GuiView::closeBufferAll(bool in_close_event)
+{
+       // First close all workareas. This will make
+       // sure that dirty buffers are saved.
+       if (!closeWorkAreaAll(in_close_event))
+               return false;
+
+       // Now close the hidden buffers. We prevent hidden
+       // buffers from being dirty, so we can just close them.
+       theBufferList().closeAll();
+       return true;
+}

I'm a little unclear on how separate views are supposed to work. So, maybe a silly question, but: When we call this, do we really want to close ALL open buffers? Can there be more than one GuiView at a time? You see the worry.

+
+bool GuiView::closeWorkAreaAll(bool in_close_event)

This parameter is not used now, which means you don't seem to need the other one, either.

rh

Reply via email to