From: Vincent van Ravesteijn Date: Fri, 21 Aug 2009 20:29:40 +0000 (+0000) Subject: Some necessary cleanup, noticed by Pavel. X-Git-Tag: 2.0.0~5618 X-Git-Url: https://git.lyx.org/gitweb/?a=commitdiff_plain;h=bb09bdfc2bc4b54534ff6fefa3a567ce8e327a69;p=lyx.git Some necessary cleanup, noticed by Pavel. git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@31182 a592a061-630c-0410-9148-cb99ea01b6c8 --- diff --git a/src/frontends/qt4/GuiView.cpp b/src/frontends/qt4/GuiView.cpp index 854c702586..52bb6c9f92 100644 --- a/src/frontends/qt4/GuiView.cpp +++ b/src/frontends/qt4/GuiView.cpp @@ -1900,9 +1900,7 @@ bool GuiView::closeBufferAll() bool GuiView::closeWorkAreaAll() { - // To write in the session file which workarea was active. - GuiWorkArea * active_wa = currentMainWorkArea(); - setCurrentWorkArea(active_wa); + setCurrentWorkArea(currentMainWorkArea()); // We might be in a situation that there is still a tabWorkArea, but // there are no tabs anymore. This can happen when we get here after a @@ -1919,7 +1917,7 @@ bool GuiView::closeWorkAreaAll() ++empty_twa; else { setCurrentWorkArea(twa->currentWorkArea()); - if (!closeTabWorkArea(twa, active_wa)) + if (!closeTabWorkArea(twa)) return false; } } @@ -1927,8 +1925,7 @@ bool GuiView::closeWorkAreaAll() } -bool GuiView::closeWorkArea(GuiWorkArea * wa, bool close_buffer, - bool) +bool GuiView::closeWorkArea(GuiWorkArea * wa, bool close_buffer) { Buffer & buf = wa->bufferView().buffer(); @@ -1976,13 +1973,12 @@ bool GuiView::closeWorkArea(GuiWorkArea * wa, bool close_buffer, } -bool GuiView::closeTabWorkArea(TabWorkArea * twa, GuiWorkArea * main_work_area) +bool GuiView::closeTabWorkArea(TabWorkArea * twa) { while (twa == d.currentTabWorkArea()) { twa->setCurrentIndex(twa->count()-1); GuiWorkArea * wa = twa->currentWorkArea(); - bool const is_active_wa = main_work_area == wa; Buffer & b = wa->bufferView().buffer(); // We only want to close the buffer if the same buffer is not visible @@ -1991,7 +1987,7 @@ bool GuiView::closeTabWorkArea(TabWorkArea * twa, GuiWorkArea * main_work_area) bool const close_buffer = !inMultiViews(wa) && !b.parent() && closing_; - if (!closeWorkArea(wa, close_buffer, is_active_wa)) + if (!closeWorkArea(wa, close_buffer)) return false; } return true; @@ -2323,7 +2319,7 @@ bool GuiView::dispatch(FuncRequest const & cmd) case LFUN_CLOSE_TAB_GROUP: if (TabWorkArea * twa = d.currentTabWorkArea()) { - closeTabWorkArea(twa, false); + closeTabWorkArea(twa); d.current_work_area_ = 0; twa = d.currentTabWorkArea(); // Switch to the next GuiWorkArea in the found TabWorkArea. diff --git a/src/frontends/qt4/GuiView.h b/src/frontends/qt4/GuiView.h index 21ebdf81b8..ce64c34d79 100644 --- a/src/frontends/qt4/GuiView.h +++ b/src/frontends/qt4/GuiView.h @@ -299,13 +299,11 @@ private: bool saveBuffer(Buffer & b); /// closes a workarea, if close_buffer is true the buffer will /// also be released, otherwise the buffer will be hidden. - bool closeWorkArea(GuiWorkArea * wa, bool close_buffer, - bool is_active = false); + bool closeWorkArea(GuiWorkArea * wa, bool close_buffer); /// closes the tabworkarea and all tabs. If we are in a close event, /// all buffers will be closed, otherwise they will be hidden. /// main_work_area is the workarea marked in the session file as active. - bool closeTabWorkArea(TabWorkArea * twa, - GuiWorkArea * main_work_area = 0); + bool closeTabWorkArea(TabWorkArea * twa); /// gives the user the possibility to save his work /// or to discard the changes. If hiding is true, the /// document will be reloaded.