]> 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 dda253b0155c2bf2a6526218ad0426151f6e284b..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,26 +1519,27 @@ 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);
 }
 
 
 void TabWorkArea::closeCurrentTab()
 {
+       GuiWorkArea * wa;
        if (clicked_tab_ == -1)
-               removeWorkArea(currentWorkArea());
+               wa = currentWorkArea();
        else {
-               GuiWorkArea * wa = dynamic_cast<GuiWorkArea *>(widget(clicked_tab_));
+               wa = dynamic_cast<GuiWorkArea *>(widget(clicked_tab_));
                LASSERT(wa, /**/);
-               removeWorkArea(wa);
        }
+       wa->view().hideWorkArea(wa);
 }
 
 ///
@@ -1550,7 +1551,9 @@ public:
        DisplayPath(int tab, FileName const & filename)
                : tab_(tab)
        {
-               filename_ = toqstr(filename.onlyFileNameWithoutExt());
+               filename_ = (filename.extension() == "lyx") ?
+                       toqstr(filename.onlyFileNameWithoutExt())
+                       : toqstr(filename.onlyFileName());
                postfix_ = toqstr(filename.absoluteFilePath()).
                        split("/", QString::SkipEmptyParts);
                postfix_.pop_back();