mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-11-16 16:18:22 +00:00
8d8988de47
The goal of this commit is to ensure that a processUpdateFlags call that requires no redraw will not override a previous one that did require a redraw. To this end, the semantics of the flag argument is now different: its value is now OR'ed with a private update_flags_ variable. This variable is only reset after the buffer view has actually been redrawn. A new Update::ForceRedraw flag has been added. It requires a full redraw but no metrics computation. It is not used in the main code (yet), but avoids to compute metrics repeatedly in consecutive processUpdateFlags calls. The process is now as follows: - if flags is just None, return immediately, there is nothing to do. - the Force flag is honored (full metrics computation) and replaced with ForceDraw. - the FitCursor flag is honored and removed from the flags. - the SinglePar update is added if ForceDraw is not in flags and only the current par has been modified. The remaining flags are only then added to the BufferView update flags, and the update strategy is computed for the next paint event. Finally the dubious call to updateMacros in updateMetrics has been removed for performance reasons.
55 lines
1.2 KiB
C++
55 lines
1.2 KiB
C++
// -*- C++ -*-
|
|
/**
|
|
* \file update_flags.h
|
|
* This file is part of LyX, the document processor.
|
|
* Licence details can be found in the file COPYING.
|
|
*
|
|
* \author The Denmark Cowboys
|
|
*
|
|
* Full author contact details are available in file CREDITS.
|
|
*/
|
|
|
|
#ifndef UPDATE_FLAGS_H
|
|
#define UPDATE_FLAGS_H
|
|
|
|
namespace lyx {
|
|
|
|
namespace Update {
|
|
enum flags {
|
|
/// No screen update is needed.
|
|
None = 0,
|
|
/// Recenter the screen around the cursor if is found outside the
|
|
/// visible area.
|
|
FitCursor = 1,
|
|
/// Force a full screen metrics update and a full draw.
|
|
Force = 2,
|
|
/// Force a full redraw (but no metrics computations)
|
|
ForceDraw = 4,
|
|
/// Try to rebreak only the current paragraph metrics.
|
|
/// (currently ignored!)
|
|
SinglePar = 8,
|
|
/// Only the inset decorations need to be redrawn, no text metrics
|
|
/// update is needed.
|
|
Decoration = 16
|
|
};
|
|
|
|
inline flags operator|(flags const f, flags const g)
|
|
{
|
|
return static_cast<flags>(int(f) | int(g));
|
|
}
|
|
|
|
inline flags operator&(flags const f, flags const g)
|
|
{
|
|
return static_cast<flags>(int(f) & int(g));
|
|
}
|
|
|
|
inline flags operator~(flags const f)
|
|
{
|
|
return static_cast<flags>(~int(f));
|
|
}
|
|
|
|
} // namespace Update
|
|
|
|
} // namespace lyx
|
|
#endif
|