]> git.lyx.org Git - lyx.git/blobdiff - src/frontends/qt4/GuiWorkArea.cpp
If we are in a closeEvent, we don't want to close all buffers, because these may...
[lyx.git] / src / frontends / qt4 / GuiWorkArea.cpp
index 4c93a33a52509d6556b15f82faf496f24220376b..6a15b78b5848f4898ed4483e42178b1babd28877 100644 (file)
@@ -231,7 +231,7 @@ private:
 // cursor is at the top or bottom edge of the viewport. One scroll per 0.2 s
 SyntheticMouseEvent::SyntheticMouseEvent()
        : timeout(200), restart_timeout(true),
-         x_old(-1), y_old(-1), min_scrollbar_old(-1.0), max_scrollbar_old(-1.0)
+         x_old(-1), y_old(-1), min_scrollbar_old(-1), max_scrollbar_old(-1)
 {}
 
 
@@ -1519,14 +1519,14 @@ void TabWorkArea::on_currentTabChanged(int i)
 
 void TabWorkArea::closeCurrentBuffer()
 {
-       if (clicked_tab_ != -1)
-               setCurrentIndex(clicked_tab_);
-       else
-               // Before dispatching the LFUN we should be sure this
-               // is the current workarea.
-               currentWorkAreaChanged(currentWorkArea());
-
-       lyx::dispatch(FuncRequest(LFUN_BUFFER_CLOSE));
+       GuiWorkArea * wa;
+       if (clicked_tab_ == -1)
+               wa = currentWorkArea();
+       else {
+               wa = dynamic_cast<GuiWorkArea *>(widget(clicked_tab_));
+               LASSERT(wa, /**/);
+       }
+       wa->view().closeWorkArea(wa);
 }
 
 
@@ -1539,7 +1539,7 @@ void TabWorkArea::closeCurrentTab()
                wa = dynamic_cast<GuiWorkArea *>(widget(clicked_tab_));
                LASSERT(wa, /**/);
        }
-       wa->view().hideBuffer();
+       wa->view().hideWorkArea(wa);
 }
 
 ///