]> git.lyx.org Git - features.git/commitdiff
Fix buffer-switching in split view.
authorAbdelrazak Younes <younes@lyx.org>
Thu, 21 Feb 2008 11:48:31 +0000 (11:48 +0000)
committerAbdelrazak Younes <younes@lyx.org>
Thu, 21 Feb 2008 11:48:31 +0000 (11:48 +0000)
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@23086 a592a061-630c-0410-9148-cb99ea01b6c8

src/frontends/qt4/GuiView.cpp

index a7e02019eddead6ffa4db5745c3fcba69209e339..653fd779bdb50b1566028a10b03e7464aafc8953 100644 (file)
@@ -225,11 +225,9 @@ struct GuiView::GuiViewPrivate
                        return tabWorkArea(0);
 
                for (int i = 0; i != splitter_->count(); ++i) {
-                       QWidget * w = splitter_->widget(i);
-                       if (!w->hasFocus())
-                               continue;
-                       if (TabWorkArea * tab_widget = dynamic_cast<TabWorkArea *>(w))
-                               return tab_widget;
+                       TabWorkArea * twa = tabWorkArea(i);
+                       if (current_work_area_ == twa->currentWorkArea())
+                               return twa;
                }
 
                // None has the focus so we just take the first one.
@@ -695,11 +693,8 @@ GuiToolbar * GuiView::makeToolbar(ToolbarInfo const & tbinfo, bool newline)
 
 GuiWorkArea * GuiView::workArea(Buffer & buffer)
 {
-       for (int i = 0; i != d.splitter_->count(); ++i) {
-               GuiWorkArea * wa = d.tabWorkArea(i)->workArea(buffer);
-               if (wa)
-                       return wa;
-       }
+       if (TabWorkArea * twa = d.currentTabWorkArea())
+               return twa->workArea(buffer);
        return 0;
 }
 
@@ -1821,7 +1816,6 @@ bool GuiView::dispatch(FuncRequest const & cmd)
                                TabWorkArea * twa = addTabWorkArea();
                                GuiWorkArea * wa = twa->addWorkArea(*buf, *this);
                                setCurrentWorkArea(wa);
-                               connectBufferView(wa->bufferView());
                        }
                        break;