]> git.lyx.org Git - features.git/commitdiff
Explicitly pass to closeBuffer whether the tab should only be hidden or that the...
authorVincent van Ravesteijn <vfr@lyx.org>
Wed, 12 Aug 2009 20:03:34 +0000 (20:03 +0000)
committerVincent van Ravesteijn <vfr@lyx.org>
Wed, 12 Aug 2009 20:03:34 +0000 (20:03 +0000)
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@30993 a592a061-630c-0410-9148-cb99ea01b6c8

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

index 77e916b518af49488c41b41b6e9b0a105babe3d8..ef0c0dd31c1f7a3befeecd3648d259292758bc9c 100644 (file)
@@ -607,7 +607,7 @@ bool GuiView::closeBufferAll(bool tolastopened)
                        if (b->parent()) {
                                // This is a child document, just close the tab
                                // after saving but keep the file loaded.
-                               if (!closeBuffer(*b, tolastopened, is_active_wa))
+                               if (!closeBuffer(*b, false, tolastopened, is_active_wa))
                                        return false;
                                continue;
                        }
@@ -620,7 +620,8 @@ bool GuiView::closeBufferAll(bool tolastopened)
                                Buffer * c = *it;
                                // If a child is dirty, do not close
                                // without user intervention
-                               if (!closeBuffer(*c, false))
+                               //FIXME: should buffers be closed or not?
+                               if (!closeBuffer(*c, false, false))
                                        return false;
                        }
 
@@ -644,7 +645,7 @@ bool GuiView::closeBufferAll(bool tolastopened)
                        }
                        // closeBuffer() needs buffer workArea still alive and
                        // set as currrent one, and destroys it
-                       if (b && !closeBuffer(*b, tolastopened, is_active_wa))
+                       if (b && !closeBuffer(*b, true, tolastopened, is_active_wa))
                                return false;
                }
        }
@@ -1925,11 +1926,12 @@ bool GuiView::saveBuffer(Buffer & b)
 bool GuiView::closeBuffer()
 {
        Buffer * buf = buffer();
-       return buf && closeBuffer(*buf);
+       return buf && closeBuffer(*buf, !buf->parent());
 }
 
 
-bool GuiView::closeBuffer(Buffer & buf, bool tolastopened, bool mark_active)
+bool GuiView::closeBuffer(Buffer & buf, bool close_buffer,
+                                                 bool tolastopened, bool mark_active)
 {
        // goto bookmark to update bookmark pit.
        //FIXME: we should update only the bookmarks related to this buffer!
@@ -1943,8 +1945,7 @@ bool GuiView::closeBuffer(Buffer & buf, bool tolastopened, bool mark_active)
                // is opened as well
                if (tolastopened)
                        theSession().lastOpened().add(buf.fileName(), mark_active);
-               if (buf.parent())
-                       // Don't close child documents.
+               if (!close_buffer)
                        removeWorkArea(currentMainWorkArea());
                else
                        theBufferList().release(&buf);
index 260f9e8ce6eb1c6fb2af63c182e51bd349e8d01d..edaf8f949a382484251f68ce271efd1e05359079 100644 (file)
@@ -294,8 +294,8 @@ private:
        ///
        bool saveBuffer(Buffer & b);
        ///
-       bool closeBuffer(Buffer & buf, bool tolastopened = false,
-               bool mark_active = false);
+       bool closeBuffer(Buffer & buf, bool keep_buffer,
+               bool tolastopened = false, bool mark_active = false);
        ///
        bool saveBufferIfNeeded(Buffer & buf);
        ///