2003-04-09 21:34:31 +00:00
|
|
|
// -*- C++ -*-
|
2003-02-26 17:04:10 +00:00
|
|
|
/**
|
2014-07-25 19:55:08 +00:00
|
|
|
* \file RowPainter.h
|
2003-02-26 17:04:10 +00:00
|
|
|
* This file is part of LyX, the document processor.
|
|
|
|
* Licence details can be found in the file COPYING.
|
|
|
|
*
|
|
|
|
* \author various
|
|
|
|
* \author John Levon
|
2008-11-14 15:58:50 +00:00
|
|
|
* \author André Pönitz
|
2003-02-26 17:04:10 +00:00
|
|
|
*
|
2003-08-23 00:17:00 +00:00
|
|
|
* Full author contact details are available in file CREDITS.
|
2003-02-26 17:04:10 +00:00
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef ROWPAINTER_H
|
|
|
|
#define ROWPAINTER_H
|
|
|
|
|
2013-10-11 14:12:20 +00:00
|
|
|
#include "Bidi.h"
|
2009-02-09 21:14:23 +00:00
|
|
|
#include "Changes.h"
|
|
|
|
|
2004-04-07 20:20:15 +00:00
|
|
|
#include "support/types.h"
|
|
|
|
|
2006-10-21 00:16:43 +00:00
|
|
|
namespace lyx {
|
|
|
|
|
2003-02-26 17:04:10 +00:00
|
|
|
class BufferView;
|
2007-08-28 08:57:13 +00:00
|
|
|
class Font;
|
2007-10-28 18:51:54 +00:00
|
|
|
class FontInfo;
|
2007-08-30 13:19:24 +00:00
|
|
|
class Inset;
|
2007-10-29 08:52:13 +00:00
|
|
|
class Language;
|
2003-12-15 11:36:19 +00:00
|
|
|
class PainterInfo;
|
2007-08-28 08:57:13 +00:00
|
|
|
class Paragraph;
|
|
|
|
class ParagraphList;
|
|
|
|
class ParagraphMetrics;
|
|
|
|
class Row;
|
|
|
|
class Text;
|
|
|
|
class TextMetrics;
|
2003-02-26 17:04:10 +00:00
|
|
|
|
2006-10-21 00:16:43 +00:00
|
|
|
namespace frontend { class Painter; }
|
2003-08-19 16:46:47 +00:00
|
|
|
|
2014-06-30 13:55:30 +00:00
|
|
|
/**
|
|
|
|
* FIXME: Re-implement row painting using row elements.
|
|
|
|
*
|
|
|
|
* This is not difficult in principle, but the code is intricate and
|
|
|
|
* needs some careful analysis. The first thing that needs to be done
|
|
|
|
* is to break row elements with the same criteria. Currently breakRow
|
|
|
|
* does not consider on-the-fly spell-checking, but it is not clear to
|
|
|
|
* me that it is required. Moreover, this thing would only work if we
|
|
|
|
* are sure that the Row object is up-to-date when drawing happens.
|
|
|
|
* This depends on the update machinery.
|
|
|
|
*
|
|
|
|
* This would allow to get rid of the Bidi class.
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
2007-08-28 08:57:13 +00:00
|
|
|
/**
|
|
|
|
* A class used for painting an individual row of text.
|
|
|
|
* FIXME: get rid of that class.
|
|
|
|
*/
|
|
|
|
class RowPainter {
|
|
|
|
public:
|
|
|
|
/// initialise and run painter
|
|
|
|
RowPainter(PainterInfo & pi, Text const & text,
|
2013-10-11 14:12:20 +00:00
|
|
|
pit_type pit, Row const & row, int x, int y);
|
2007-08-28 08:57:13 +00:00
|
|
|
|
|
|
|
/// paint various parts
|
|
|
|
/// FIXME: transfer to TextMetrics
|
2015-06-29 14:12:11 +00:00
|
|
|
void paintAppendix() const;
|
|
|
|
void paintDepthBar() const;
|
|
|
|
void paintChangeBar() const;
|
|
|
|
void paintTooLargeMarks(bool const left, bool const right) const;
|
|
|
|
void paintFirst() const;
|
2007-08-28 08:57:13 +00:00
|
|
|
void paintLast();
|
|
|
|
void paintText();
|
2007-08-30 13:19:24 +00:00
|
|
|
void paintOnlyInsets();
|
2015-06-29 14:12:11 +00:00
|
|
|
void paintSelection() const;
|
2007-08-28 08:57:13 +00:00
|
|
|
|
|
|
|
private:
|
2012-05-02 16:02:52 +00:00
|
|
|
void paintSeparator(double orig_x, double width, FontInfo const & font);
|
2015-06-29 14:12:11 +00:00
|
|
|
void paintForeignMark(double orig_x, Language const * lang, int desc = 0) const;
|
|
|
|
void paintMisspelledMark(double orig_x, bool changed) const;
|
2014-04-10 14:37:21 +00:00
|
|
|
void paintChars(pos_type & vpos, Font const & font);
|
2015-06-29 14:12:11 +00:00
|
|
|
int paintAppendixStart(int y) const;
|
2010-10-04 18:18:37 +00:00
|
|
|
void paintFromPos(pos_type & vpos, bool changed);
|
2007-08-30 13:19:24 +00:00
|
|
|
void paintInset(Inset const * inset, pos_type const pos);
|
2008-02-22 15:26:52 +00:00
|
|
|
void paintInlineCompletion(Font const & font);
|
2010-12-13 16:18:37 +00:00
|
|
|
|
2007-08-28 08:57:13 +00:00
|
|
|
/// return left margin
|
|
|
|
int leftMargin() const;
|
|
|
|
|
|
|
|
/// return the label font for this row
|
2008-02-27 23:03:26 +00:00
|
|
|
FontInfo labelFont() const;
|
2007-08-28 08:57:13 +00:00
|
|
|
|
2011-10-30 09:16:30 +00:00
|
|
|
///
|
2015-06-29 14:12:11 +00:00
|
|
|
void paintLabel() const;
|
2011-10-30 09:16:30 +00:00
|
|
|
///
|
2015-06-29 14:12:11 +00:00
|
|
|
void paintTopLevelLabel() const;
|
2011-10-30 09:16:30 +00:00
|
|
|
|
|
|
|
|
2007-08-30 13:53:02 +00:00
|
|
|
/// contains painting related information.
|
|
|
|
PainterInfo & pi_;
|
2007-08-28 08:57:13 +00:00
|
|
|
|
|
|
|
/// Text for the row
|
|
|
|
Text const & text_;
|
2015-06-29 14:12:11 +00:00
|
|
|
TextMetrics const & text_metrics_;
|
2007-08-28 08:57:13 +00:00
|
|
|
ParagraphList const & pars_;
|
|
|
|
|
|
|
|
/// The row to paint
|
|
|
|
Row const & row_;
|
|
|
|
|
|
|
|
/// Row's paragraph
|
|
|
|
pit_type const pit_;
|
|
|
|
Paragraph const & par_;
|
|
|
|
ParagraphMetrics const & pm_;
|
|
|
|
|
2013-10-11 14:12:20 +00:00
|
|
|
/// bidi cache
|
|
|
|
Bidi bidi_;
|
2007-08-28 08:57:13 +00:00
|
|
|
|
2009-02-09 21:14:23 +00:00
|
|
|
/// row changed? (change tracking)
|
|
|
|
Change const change_;
|
2007-08-28 08:57:13 +00:00
|
|
|
|
|
|
|
// Looks ugly - is
|
|
|
|
double const xo_;
|
|
|
|
int const yo_; // current baseline
|
|
|
|
double x_;
|
|
|
|
int width_;
|
2011-02-20 07:50:28 +00:00
|
|
|
float solid_line_thickness_;
|
|
|
|
int solid_line_offset_;
|
|
|
|
float dotted_line_thickness_;
|
|
|
|
int dotted_line_offset_;
|
2007-08-28 08:57:13 +00:00
|
|
|
};
|
2003-08-19 16:46:47 +00:00
|
|
|
|
2006-10-21 00:16:43 +00:00
|
|
|
} // namespace lyx
|
2004-08-14 15:55:22 +00:00
|
|
|
|
2003-02-26 17:04:10 +00:00
|
|
|
#endif // ROWPAINTER_H
|