v...@lyx.org schreef:
Author: vfr
Date: Tue Aug 18 00:33:49 2009
New Revision: 31108
URL: http://www.lyx.org/trac/changeset/31108

Log:
Close the correct tab when clicking one while the active tab is in another 
tabworkarea. This is also in 1.6.3.

Modified:
   lyx-devel/trunk/src/frontends/qt4/GuiView.cpp
   lyx-devel/trunk/src/frontends/qt4/GuiView.h
   lyx-devel/trunk/src/frontends/qt4/GuiWorkArea.cpp

Modified: lyx-devel/trunk/src/frontends/qt4/GuiView.cpp
==============================================================================
--- lyx-devel/trunk/src/frontends/qt4/GuiView.cpp       Tue Aug 18 00:24:38 
2009        (r31107)
+++ lyx-devel/trunk/src/frontends/qt4/GuiView.cpp       Tue Aug 18 00:33:49 
2009        (r31108)
@@ -1901,6 +1901,12 @@
 }
+bool GuiView::closeWorkArea(GuiWorkArea * wa)
+{
+       return closeWorkArea(wa, true);
+}
+
+
 bool GuiView::closeBuffer()
 {
        GuiWorkArea * wa = currentMainWorkArea();

Modified: lyx-devel/trunk/src/frontends/qt4/GuiView.h
==============================================================================
--- lyx-devel/trunk/src/frontends/qt4/GuiView.h Tue Aug 18 00:24:38 2009        
(r31107)
+++ lyx-devel/trunk/src/frontends/qt4/GuiView.h Tue Aug 18 00:33:49 2009        
(r31108)
@@ -93,6 +93,8 @@
        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?

Modified: lyx-devel/trunk/src/frontends/qt4/GuiWorkArea.cpp
==============================================================================
--- lyx-devel/trunk/src/frontends/qt4/GuiWorkArea.cpp   Tue Aug 18 00:24:38 
2009        (r31107)
+++ lyx-devel/trunk/src/frontends/qt4/GuiWorkArea.cpp   Tue Aug 18 00:33:49 
2009        (r31108)
@@ -1519,14 +1519,14 @@
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);
 }
For branch ?

Vincent

Reply via email to