lyx_mirror/src/frontends/WorkAreaManager.cpp
Jean-Marc Lasgouttes a31d3dc67d Compute metrics when graphics is updated
Remove the old schedule_redraw_ mechanism that was only useful because
of our synchronous drawing code. Now that actual painting is
scheduled instead of forced, it becomes pointless.

Rename WorkArea::redraw(bool) to scheduleRedraw(bool), to show that
the drawing is not done right away.

In GuiView::updateInset, call scheduleRedraw(true), so that metrics
are correctly computed (this was the whole point of the exercise).
2017-09-14 15:50:30 +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->scheduleRedraw(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