mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-12-27 14:29:21 +00:00
Rename closeBufferAll to closeWorkAreaAll (because that's what we do). Add a new closeBufferAll function that closes all WorkArea's and then all hidden buffers. This is easy now, because we've done everything to prevent hidden buffers to be dirty.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@31125 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
parent
6e4ca1d18f
commit
64d7a33a89
@ -584,34 +584,6 @@ void GuiView::closeEvent(QCloseEvent * close_event)
|
||||
}
|
||||
|
||||
|
||||
bool GuiView::closeBufferAll(bool in_close_event)
|
||||
{
|
||||
GuiWorkArea * active_wa = currentMainWorkArea();
|
||||
setCurrentWorkArea(active_wa);
|
||||
|
||||
// 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
|
||||
// TabWorkArea::lastWorkAreaRemoved() signal. Therefore we count how
|
||||
// many TabWorkArea's have no documents anymore.
|
||||
int empty_twa = 0;
|
||||
|
||||
// We have to call count() each time, because it can happen that
|
||||
// more than one splitter will disappear in one iteration (bug 5998).
|
||||
for (; d.splitter_->count() > empty_twa; ) {
|
||||
TabWorkArea * twa = d.tabWorkArea(empty_twa);
|
||||
|
||||
if (twa->count() == 0)
|
||||
++empty_twa;
|
||||
else {
|
||||
setCurrentWorkArea(twa->currentWorkArea());
|
||||
if (!closeTabWorkArea(twa, true, active_wa))
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
void GuiView::dragEnterEvent(QDragEnterEvent * event)
|
||||
{
|
||||
if (event->mimeData()->hasUrls())
|
||||
@ -1903,6 +1875,48 @@ bool GuiView::closeBuffer()
|
||||
}
|
||||
|
||||
|
||||
bool GuiView::closeBufferAll(bool in_close_event)
|
||||
{
|
||||
// First close all workareas. This will make
|
||||
// sure that dirty buffers are saved.
|
||||
if (!closeWorkAreaAll(in_close_event))
|
||||
return false;
|
||||
|
||||
// Now close the hidden buffers. We prevent hidden
|
||||
// buffers from being dirty, so we can just close them.
|
||||
theBufferList().closeAll();
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
bool GuiView::closeWorkAreaAll(bool in_close_event)
|
||||
{
|
||||
GuiWorkArea * active_wa = currentMainWorkArea();
|
||||
setCurrentWorkArea(active_wa);
|
||||
|
||||
// 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
|
||||
// TabWorkArea::lastWorkAreaRemoved() signal. Therefore we count how
|
||||
// many TabWorkArea's have no documents anymore.
|
||||
int empty_twa = 0;
|
||||
|
||||
// We have to call count() each time, because it can happen that
|
||||
// more than one splitter will disappear in one iteration (bug 5998).
|
||||
for (; d.splitter_->count() > empty_twa; ) {
|
||||
TabWorkArea * twa = d.tabWorkArea(empty_twa);
|
||||
|
||||
if (twa->count() == 0)
|
||||
++empty_twa;
|
||||
else {
|
||||
setCurrentWorkArea(twa->currentWorkArea());
|
||||
if (!closeTabWorkArea(twa, true, active_wa))
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
bool GuiView::closeWorkArea(GuiWorkArea * wa, bool close_buffer,
|
||||
bool in_close_event, bool mark_active)
|
||||
{
|
||||
|
@ -309,6 +309,8 @@ private:
|
||||
bool saveBufferIfNeeded(Buffer & buf, bool hiding);
|
||||
///
|
||||
bool closeBufferAll(bool in_close_event = false);
|
||||
///
|
||||
bool closeWorkAreaAll(bool in_close_event = false);
|
||||
/// is the buffer in this workarea also shown in another tab ?
|
||||
/// This tab can either be in the same view or in another one.
|
||||
bool inMultiTabs(GuiWorkArea * wa);
|
||||
|
Loading…
Reference in New Issue
Block a user