mirror of
https://git.lyx.org/repos/lyx.git
synced 2025-01-11 03:03:06 +00:00
Simplify the code, and rename tolastopened to in_close_event. Rationale: when we are in a close event we want to store the last opened files, and we don't want to close any child buffers. Closing the child buffers now will crimple the last opened files in the session file (the order of tabs that is). Child buffers are closed anyway when we are in a close event.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@31106 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
parent
f6491727bf
commit
0e3f25489e
@ -584,7 +584,7 @@ void GuiView::closeEvent(QCloseEvent * close_event)
|
||||
}
|
||||
|
||||
|
||||
bool GuiView::closeBufferAll(bool tolastopened)
|
||||
bool GuiView::closeBufferAll(bool in_close_event)
|
||||
{
|
||||
GuiWorkArea * active_wa = currentMainWorkArea();
|
||||
setCurrentWorkArea(active_wa);
|
||||
@ -611,21 +611,13 @@ bool GuiView::closeBufferAll(bool tolastopened)
|
||||
bool const is_active_wa = active_wa == wa;
|
||||
Buffer & b = wa->bufferView().buffer();
|
||||
|
||||
if (b.parent()) {
|
||||
// This is a child document, just close the tab
|
||||
// after saving but keep the file loaded.
|
||||
if (!closeWorkArea(wa, false, tolastopened, is_active_wa))
|
||||
return false;
|
||||
continue;
|
||||
}
|
||||
|
||||
// We only want to close the buffer if the same buffer is not in
|
||||
// another view.
|
||||
bool const close_buffer = !inMultiViews(wa);
|
||||
bool const close_buffer = !(inMultiViews(wa) || b.parent());
|
||||
|
||||
// closeBuffer() needs buffer workArea still alive and
|
||||
// set as currrent one, and destroys it
|
||||
if (!closeWorkArea(wa, close_buffer, tolastopened, is_active_wa))
|
||||
if (!closeWorkArea(wa, close_buffer, in_close_event, is_active_wa))
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@ -1918,11 +1910,11 @@ bool GuiView::closeBuffer()
|
||||
|
||||
|
||||
bool GuiView::closeWorkArea(GuiWorkArea * wa, bool close_buffer,
|
||||
bool tolastopened, bool mark_active)
|
||||
bool in_close_event, bool mark_active)
|
||||
{
|
||||
Buffer & buf = wa->bufferView().buffer();
|
||||
|
||||
if (close_buffer && !tolastopened) {
|
||||
if (close_buffer && !in_close_event) {
|
||||
vector<Buffer *> clist = buf.getChildren();
|
||||
for (vector<Buffer *>::const_iterator it = clist.begin();
|
||||
it != clist.end(); ++it) {
|
||||
@ -1949,7 +1941,7 @@ bool GuiView::closeWorkArea(GuiWorkArea * wa, bool close_buffer,
|
||||
// save in sessions if requested
|
||||
// do not save childs if their master
|
||||
// is opened as well
|
||||
if (tolastopened)
|
||||
if (in_close_event)
|
||||
theSession().lastOpened().add(buf.fileName(), mark_active);
|
||||
if (!close_buffer)
|
||||
removeWorkArea(wa);
|
||||
|
Loading…
Reference in New Issue
Block a user