]> git.lyx.org Git - features.git/commitdiff
Close the correct tab when clicking one while the active tab is in another tabworkare...
authorVincent van Ravesteijn <vfr@lyx.org>
Mon, 17 Aug 2009 22:33:49 +0000 (22:33 +0000)
committerVincent van Ravesteijn <vfr@lyx.org>
Mon, 17 Aug 2009 22:33:49 +0000 (22:33 +0000)
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@31108 a592a061-630c-0410-9148-cb99ea01b6c8

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

index 713b85cf3dda4c5a81dfc33333a1688a8c8d500d..f403cef31b525e98fd16f8d70daffba6884ec0e5 100644 (file)
@@ -1901,6 +1901,12 @@ bool GuiView::hideWorkArea(GuiWorkArea * wa)
 }
 
 
+bool GuiView::closeWorkArea(GuiWorkArea * wa)
+{
+       return closeWorkArea(wa, true);
+}
+
+
 bool GuiView::closeBuffer()
 {
        GuiWorkArea * wa = currentMainWorkArea();
index f84f2e91f98183bce1f2c62ae00c0ef71720418d..234e50a08df5ba8e91aa5fbf3d4ca0f37924d1a3 100644 (file)
@@ -93,6 +93,8 @@ public:
        bool closeBuffer();
        /// hides the workarea and makes sure it is clean
        bool hideWorkArea(GuiWorkArea * wa);
+       /// closes the workarea
+       bool closeWorkArea(GuiWorkArea * wa);
        /// load a document into the current workarea.
        Buffer * loadDocument(support::FileName const &  name, ///< File to load.
                bool tolastfiles = true);  ///< append to the "Open recent" menu?
index add50405c79261305f22acd08866c1b7d065274a..6a15b78b5848f4898ed4483e42178b1babd28877 100644 (file)
@@ -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);
 }