mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-11-22 18:08:10 +00:00
Replace the PainterInfo::erased_ member by a proper Change object and remove the Color_deletedtext from InsetTabular.
see: http://thread.gmane.org/gmane.editors.lyx.devel/114326 git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@28424 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
parent
26c5e8a83b
commit
09a0e37b15
@ -48,7 +48,7 @@ MetricsInfo::MetricsInfo(BufferView * bv, FontInfo const & font, int textwidth,
|
||||
|
||||
|
||||
PainterInfo::PainterInfo(BufferView * bv, lyx::frontend::Painter & painter)
|
||||
: pain(painter), ltr_pos(false), erased_(false), selected(false),
|
||||
: pain(painter), ltr_pos(false), change_(), selected(false),
|
||||
full_repaint(true), background_color(Color_background)
|
||||
{
|
||||
base.bv = bv;
|
||||
|
@ -13,6 +13,7 @@
|
||||
#ifndef METRICSINFO_H
|
||||
#define METRICSINFO_H
|
||||
|
||||
#include "Changes.h"
|
||||
#include "ColorCode.h"
|
||||
#include "FontInfo.h"
|
||||
|
||||
@ -108,8 +109,8 @@ public:
|
||||
frontend::Painter & pain;
|
||||
/// Whether the text at this point is right-to-left (for InsetNewline)
|
||||
bool ltr_pos;
|
||||
/// Whether the parent is deleted (change tracking)
|
||||
bool erased_;
|
||||
/// The change the parent is part of (change tracking)
|
||||
Change change_;
|
||||
/// Whether the parent is selected as a whole
|
||||
bool selected;
|
||||
///
|
||||
|
@ -3081,11 +3081,11 @@ void InsetTabular::draw(PainterInfo & pi, int x, int y) const
|
||||
|| y - a > bv->workHeight()) {
|
||||
pi.pain.setDrawingEnabled(false);
|
||||
cell(idx)->draw(pi, cx, y);
|
||||
drawCellLines(pi.pain, nx, y, i, idx, pi.erased_);
|
||||
drawCellLines(pi.pain, nx, y, i, idx, pi.change_);
|
||||
pi.pain.setDrawingEnabled(original_drawing_state);
|
||||
} else {
|
||||
cell(idx)->draw(pi, cx, y);
|
||||
drawCellLines(pi.pain, nx, y, i, idx, pi.erased_);
|
||||
drawCellLines(pi.pain, nx, y, i, idx, pi.change_);
|
||||
}
|
||||
nx += tabular.columnWidth(idx);
|
||||
++idx;
|
||||
@ -3154,16 +3154,16 @@ void InsetTabular::drawSelection(PainterInfo & pi, int x, int y) const
|
||||
|
||||
|
||||
void InsetTabular::drawCellLines(Painter & pain, int x, int y,
|
||||
row_type row, idx_type cell, bool erased) const
|
||||
row_type row, idx_type cell, Change const & change) const
|
||||
{
|
||||
int x2 = x + tabular.columnWidth(cell);
|
||||
bool on_off = false;
|
||||
ColorCode col = Color_tabularline;
|
||||
ColorCode onoffcol = Color_tabularonoffline;
|
||||
Color col = Color_tabularline;
|
||||
Color onoffcol = Color_tabularonoffline;
|
||||
|
||||
if (erased) {
|
||||
col = Color_deletedtext;
|
||||
onoffcol = Color_deletedtext;
|
||||
if (change.changed()) {
|
||||
col = change.color();
|
||||
onoffcol = change.color();
|
||||
}
|
||||
|
||||
if (!tabular.topAlreadyDrawn(cell)) {
|
||||
|
@ -863,7 +863,7 @@ private:
|
||||
|
||||
///
|
||||
void drawCellLines(frontend::Painter &, int x, int y, row_type row,
|
||||
idx_type cell, bool erased) const;
|
||||
idx_type cell, Change const & change) const;
|
||||
///
|
||||
void setCursorFromCoordinates(Cursor & cur, int x, int y) const;
|
||||
|
||||
|
@ -60,7 +60,7 @@ RowPainter::RowPainter(PainterInfo & pi,
|
||||
pars_(text.paragraphs()),
|
||||
row_(row), pit_(pit), par_(text.paragraphs()[pit]),
|
||||
pm_(text_metrics_.parMetrics(pit)),
|
||||
bidi_(bidi), erased_(pi_.erased_),
|
||||
bidi_(bidi), change_(pi_.change_),
|
||||
xo_(x), yo_(y), width_(text_metrics_.width())
|
||||
{
|
||||
bidi_.computeTables(par_, pi_.base.bv->buffer(), row_);
|
||||
@ -106,7 +106,8 @@ void RowPainter::paintInset(Inset const * inset, pos_type const pos)
|
||||
pi_.base.bv->buffer().params().getFont().fontInfo() :
|
||||
font.fontInfo();
|
||||
pi_.ltr_pos = (bidi_.level(pos) % 2 == 0);
|
||||
pi_.erased_ = erased_ || par_.isDeleted(pos);
|
||||
pi_.change_ = change_.changed() ? change_ : par_.lookupChange(pos);
|
||||
|
||||
int const x1 = int(x_);
|
||||
pi_.base.bv->coordCache().insets().add(inset, x1, yo_);
|
||||
// insets are painted completely. Recursive
|
||||
|
@ -14,6 +14,8 @@
|
||||
#ifndef ROWPAINTER_H
|
||||
#define ROWPAINTER_H
|
||||
|
||||
#include "Changes.h"
|
||||
|
||||
#include "support/types.h"
|
||||
|
||||
namespace lyx {
|
||||
@ -92,8 +94,8 @@ private:
|
||||
/// one of them is active at a time.
|
||||
Bidi & bidi_;
|
||||
|
||||
/// is row erased? (change tracking)
|
||||
bool erased_;
|
||||
/// row changed? (change tracking)
|
||||
Change const change_;
|
||||
|
||||
// Looks ugly - is
|
||||
double const xo_;
|
||||
|
Loading…
Reference in New Issue
Block a user