lyx_mirror/src/frontends/WorkAreaManager.cpp
Guillaume MM 5fda4e85c7 Unhide buffers that are marked dirty as a result of external modifications
Several comments in the code point to the fact that hidden buffers are assumed
to be clean.

The other solution was to adapt the closing & saving code to take into account
hidden dirty buffers. Experience shows that it is more useful to unhide the
buffers at the moment of the external modification, in the context of a git
workflow where one has to reload the modified children buffers one-by-one.

Fixes crash at #10603
2017-06-11 19:51:17 +02:00

68 lines
1.1 KiB
C++

// -*- C++ -*-
/**
* \file WorkAreaManager.cpp
* This file is part of LyX, the document processor.
* Licence details can be found in the file COPYING.
*
* \author Abdelrazak Younes
*
* Full author contact details are available in file CREDITS.
*/
#include <config.h>
#include "WorkAreaManager.h"
#include "Application.h"
#include "WorkArea.h"
namespace lyx {
namespace frontend {
void WorkAreaManager::add(WorkArea * wa)
{
work_areas_.push_back(wa);
}
void WorkAreaManager::remove(WorkArea * wa)
{
work_areas_.remove(wa);
}
void WorkAreaManager::redrawAll(bool update_metrics)
{
for (WorkArea * wa : work_areas_)
wa->redraw(update_metrics);
}
void WorkAreaManager::closeAll()
{
while (!work_areas_.empty())
// WorkArea is de-registering itself.
(*work_areas_.begin())->close();
}
bool WorkAreaManager::unhide(Buffer * buf)
{
if (!work_areas_.empty())
return true;
return theApp()->unhide(buf);
}
void WorkAreaManager::updateTitles()
{
for (WorkArea * wa : work_areas_)
wa->updateWindowTitle();
}
} // namespace frontend
} // namespace lyx