2003-02-26 17:04:10 +00:00
|
|
|
/**
|
2014-07-25 19:55:08 +00:00
|
|
|
* \file RowPainter.cpp
|
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
|
|
|
|
*
|
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
|
|
|
*/
|
|
|
|
|
|
|
|
#include <config.h>
|
2020-01-14 10:42:01 +00:00
|
|
|
|
2014-07-25 19:55:08 +00:00
|
|
|
#include "RowPainter.h"
|
2003-02-26 17:04:10 +00:00
|
|
|
|
2007-04-26 04:41:58 +00:00
|
|
|
#include "Buffer.h"
|
|
|
|
#include "CoordCache.h"
|
2007-04-26 14:56:30 +00:00
|
|
|
#include "Cursor.h"
|
2007-04-26 04:41:58 +00:00
|
|
|
#include "BufferParams.h"
|
2003-09-06 23:36:02 +00:00
|
|
|
#include "BufferView.h"
|
2007-10-18 15:29:51 +00:00
|
|
|
#include "Changes.h"
|
2007-04-26 04:41:58 +00:00
|
|
|
#include "Language.h"
|
2007-09-29 20:02:32 +00:00
|
|
|
#include "Layout.h"
|
2007-04-26 04:41:58 +00:00
|
|
|
#include "LyXRC.h"
|
|
|
|
#include "Row.h"
|
|
|
|
#include "MetricsInfo.h"
|
|
|
|
#include "Paragraph.h"
|
2020-01-14 10:42:01 +00:00
|
|
|
#include "ParagraphList.h"
|
2003-09-06 23:36:02 +00:00
|
|
|
#include "ParagraphParameters.h"
|
2020-01-14 10:42:01 +00:00
|
|
|
#include "Text.h"
|
2006-12-29 23:54:48 +00:00
|
|
|
#include "TextMetrics.h"
|
2003-02-26 17:04:10 +00:00
|
|
|
|
2006-10-07 16:15:06 +00:00
|
|
|
#include "frontends/FontMetrics.h"
|
2003-09-06 23:36:02 +00:00
|
|
|
#include "frontends/Painter.h"
|
|
|
|
|
2008-02-18 07:14:42 +00:00
|
|
|
#include "support/debug.h"
|
2009-07-19 01:41:47 +00:00
|
|
|
#include "support/gettext.h"
|
2008-04-30 08:26:40 +00:00
|
|
|
#include "support/lassert.h"
|
2005-12-30 19:02:52 +00:00
|
|
|
|
2020-10-24 21:47:13 +00:00
|
|
|
#include <algorithm>
|
2016-07-04 18:36:16 +00:00
|
|
|
|
2007-12-12 10:16:00 +00:00
|
|
|
using namespace std;
|
2004-01-30 11:41:12 +00:00
|
|
|
|
2007-08-28 08:57:13 +00:00
|
|
|
namespace lyx {
|
2003-07-14 17:50:00 +00:00
|
|
|
|
2007-08-28 08:57:13 +00:00
|
|
|
using frontend::Painter;
|
|
|
|
using frontend::FontMetrics;
|
2003-07-28 12:20:42 +00:00
|
|
|
|
2012-10-27 13:45:27 +00:00
|
|
|
|
2004-11-30 01:59:49 +00:00
|
|
|
RowPainter::RowPainter(PainterInfo & pi,
|
2016-05-18 07:39:47 +00:00
|
|
|
Text const & text, Row const & row, int x, int y)
|
2007-08-30 14:26:52 +00:00
|
|
|
: pi_(pi), text_(text),
|
2016-12-07 11:16:41 +00:00
|
|
|
tm_(pi_.base.bv->textMetrics(&text)),
|
2016-05-18 07:39:47 +00:00
|
|
|
row_(row), par_(text.paragraphs()[row.pit()]),
|
2016-12-07 11:16:41 +00:00
|
|
|
xo_(x), yo_(y)
|
2003-11-24 16:26:55 +00:00
|
|
|
{
|
2014-12-22 09:36:53 +00:00
|
|
|
x_ = row_.left_margin + xo_;
|
2004-08-14 15:55:22 +00:00
|
|
|
|
2004-11-30 01:59:49 +00:00
|
|
|
//lyxerr << "RowPainter: x: " << x_ << " xo: " << xo_ << " yo: " << yo_ << endl;
|
|
|
|
//row_.dump();
|
|
|
|
|
2020-04-26 07:08:35 +00:00
|
|
|
LBUFERR(row.pit() >= 0);
|
|
|
|
LBUFERR(row.pit() < int(text.paragraphs().size()));
|
2003-11-24 16:26:55 +00:00
|
|
|
}
|
2003-02-26 17:04:10 +00:00
|
|
|
|
|
|
|
|
2018-01-16 13:04:05 +00:00
|
|
|
FontInfo RowPainter::labelFont(bool end) const
|
2003-02-26 17:04:10 +00:00
|
|
|
{
|
2010-09-06 14:35:02 +00:00
|
|
|
FontInfo f = text_.labelFont(par_);
|
|
|
|
// selected text?
|
2018-01-16 13:04:05 +00:00
|
|
|
if ((end ? row_.end_margin_sel : row_.begin_margin_sel)
|
|
|
|
|| pi_.selected)
|
2010-09-06 14:35:02 +00:00
|
|
|
f.setPaintColor(Color_selectiontext);
|
|
|
|
return f;
|
2003-02-26 17:04:10 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2006-11-03 15:39:58 +00:00
|
|
|
// If you want to debug inset metrics uncomment the following line:
|
2007-08-30 09:01:30 +00:00
|
|
|
//#define DEBUG_METRICS
|
2006-11-03 15:39:58 +00:00
|
|
|
// This draws green lines around each inset.
|
|
|
|
|
|
|
|
|
2016-05-17 13:00:09 +00:00
|
|
|
void RowPainter::paintInset(Row::Element const & e) const
|
2003-02-26 17:04:10 +00:00
|
|
|
{
|
2021-07-01 16:35:16 +00:00
|
|
|
// Handle selection (first left/right, then middle).
|
|
|
|
pi_.selected_left = pi_.selected
|
|
|
|
|| (row_.isRTL() ? row_.end_margin_sel : row_.begin_margin_sel);
|
|
|
|
pi_.selected_right = pi_.selected
|
|
|
|
|| (row_.isRTL() ? row_.begin_margin_sel : row_.end_margin_sel);
|
2015-07-16 21:10:44 +00:00
|
|
|
bool const pi_selected = pi_.selected;
|
|
|
|
Cursor const & cur = pi_.base.bv->cursor();
|
|
|
|
if (cur.selection() && cur.text() == &text_
|
|
|
|
&& cur.normalAnchor().text() == &text_)
|
2016-02-28 15:42:35 +00:00
|
|
|
pi_.selected = row_.sel_beg <= e.pos && row_.sel_end > e.pos;
|
2015-07-16 21:10:44 +00:00
|
|
|
|
2016-02-28 15:42:35 +00:00
|
|
|
LASSERT(e.inset, return);
|
2008-01-14 16:24:01 +00:00
|
|
|
// Backup full_repaint status because some insets (InsetTabular)
|
|
|
|
// requires a full repaint
|
2015-05-06 16:39:24 +00:00
|
|
|
bool const pi_full_repaint = pi_.full_repaint;
|
|
|
|
bool const pi_do_spellcheck = pi_.do_spellcheck;
|
2020-01-14 10:50:44 +00:00
|
|
|
Change const pi_change = pi_.change;
|
2008-01-14 16:24:01 +00:00
|
|
|
|
2016-02-28 15:42:35 +00:00
|
|
|
pi_.base.font = e.inset->inheritFont() ? e.font.fontInfo() :
|
2011-02-22 19:41:04 +00:00
|
|
|
pi_.base.bv->buffer().params().getFont().fontInfo();
|
2016-02-28 15:42:35 +00:00
|
|
|
pi_.ltr_pos = !e.font.isVisibleRightToLeft();
|
2020-01-14 10:50:44 +00:00
|
|
|
pi_.change = pi_.change.changed() ? pi_.change : e.change;
|
2016-02-28 15:42:35 +00:00
|
|
|
pi_.do_spellcheck &= e.inset->allowSpellCheck();
|
2009-02-09 21:14:23 +00:00
|
|
|
|
2008-12-22 18:16:05 +00:00
|
|
|
int const x1 = int(x_);
|
2016-02-28 15:42:35 +00:00
|
|
|
pi_.base.bv->coordCache().insets().add(e.inset, x1, yo_);
|
2007-08-27 14:38:29 +00:00
|
|
|
// insets are painted completely. Recursive
|
2010-11-25 13:08:26 +00:00
|
|
|
// FIXME: it is wrong to completely paint the background
|
|
|
|
// if we want to do single row painting.
|
2016-02-28 15:42:35 +00:00
|
|
|
e.inset->drawBackground(pi_, x1, yo_);
|
|
|
|
e.inset->drawSelection(pi_, x1, yo_);
|
|
|
|
e.inset->draw(pi_, x1, yo_);
|
2019-05-23 09:30:35 +00:00
|
|
|
paintTextDecoration(e);
|
2007-08-30 09:01:30 +00:00
|
|
|
|
2008-01-14 16:24:01 +00:00
|
|
|
// Restore full_repaint status.
|
|
|
|
pi_.full_repaint = pi_full_repaint;
|
2020-01-14 10:50:44 +00:00
|
|
|
pi_.change = pi_change;
|
2015-05-06 16:39:24 +00:00
|
|
|
pi_.do_spellcheck = pi_do_spellcheck;
|
2015-07-16 21:10:44 +00:00
|
|
|
pi_.selected = pi_selected;
|
2008-01-14 16:24:01 +00:00
|
|
|
|
2006-11-03 15:39:58 +00:00
|
|
|
#ifdef DEBUG_METRICS
|
2016-05-17 13:00:09 +00:00
|
|
|
Dimension const & dim = pi_.base.bv->coordCache().insets().dim(e.inset);
|
2006-11-03 15:39:58 +00:00
|
|
|
int const x2 = x1 + dim.wid;
|
|
|
|
int const y1 = yo_ + dim.des;
|
|
|
|
int const y2 = yo_ - dim.asc;
|
2007-10-25 12:41:02 +00:00
|
|
|
pi_.pain.line(x1, y1, x1, y2, Color_green);
|
|
|
|
pi_.pain.line(x1, y1, x2, y1, Color_green);
|
|
|
|
pi_.pain.line(x2, y1, x2, y2, Color_green);
|
|
|
|
pi_.pain.line(x1, y2, x2, y2, Color_green);
|
2006-11-03 15:39:58 +00:00
|
|
|
#endif
|
2003-02-26 17:04:10 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2018-05-06 17:48:21 +00:00
|
|
|
void RowPainter::paintLanguageMarkings(Row::Element const & e) const
|
|
|
|
{
|
|
|
|
paintForeignMark(e);
|
|
|
|
paintNoSpellingMark(e);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2016-05-17 13:00:09 +00:00
|
|
|
void RowPainter::paintForeignMark(Row::Element const & e) const
|
2015-07-14 21:45:41 +00:00
|
|
|
{
|
2016-05-17 13:00:09 +00:00
|
|
|
Language const * lang = e.font.language();
|
2015-07-14 21:45:41 +00:00
|
|
|
if (!lyxrc.mark_foreign_language)
|
|
|
|
return;
|
|
|
|
if (lang == latex_language)
|
|
|
|
return;
|
|
|
|
if (lang == pi_.base.bv->buffer().params().language)
|
|
|
|
return;
|
|
|
|
|
2016-05-17 13:00:09 +00:00
|
|
|
int const desc = e.inset ? e.dim.descent() : 0;
|
2018-07-20 13:23:55 +00:00
|
|
|
int const y = yo_ + min(3 * pi_.base.solidLineOffset() / 2 + desc,
|
|
|
|
row_.descent() - 1);
|
2018-07-23 15:07:48 +00:00
|
|
|
pi_.pain.line(int(x_), y, int(x_ + e.full_width() - 1), y, Color_language,
|
2016-05-22 21:48:28 +00:00
|
|
|
Painter::line_solid, pi_.base.solidLineThickness());
|
2015-07-14 21:45:41 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2018-05-06 17:48:21 +00:00
|
|
|
void RowPainter::paintNoSpellingMark(Row::Element const & e) const
|
|
|
|
{
|
|
|
|
//if (!lyxrc.mark_no_spelling)
|
|
|
|
// return;
|
|
|
|
if (e.font.language() == latex_language)
|
|
|
|
return;
|
2018-05-07 06:41:28 +00:00
|
|
|
if (e.font.fontInfo().nospellcheck() != FONT_ON)
|
2018-05-06 17:48:21 +00:00
|
|
|
return;
|
|
|
|
|
2018-05-07 06:41:28 +00:00
|
|
|
// We at the same voffset than the misspelled mark, since
|
|
|
|
// these two are mutually exclusive
|
2018-05-06 17:48:21 +00:00
|
|
|
int const desc = e.inset ? e.dim.descent() : 0;
|
2020-02-22 16:59:37 +00:00
|
|
|
int y = yo_ + pi_.base.solidLineOffset() + desc
|
2018-05-07 06:41:28 +00:00
|
|
|
+ pi_.base.solidLineThickness()
|
|
|
|
+ (e.change.changed() ? pi_.base.solidLineThickness() + 1 : 0)
|
|
|
|
+ 1;
|
2020-02-22 16:59:37 +00:00
|
|
|
// Make sure that the mark does not go below the row rectangle
|
|
|
|
y = min(y, yo_ + row_.descent() - 1);
|
|
|
|
|
2018-05-06 17:48:21 +00:00
|
|
|
pi_.pain.line(int(x_), y, int(x_ + e.full_width()), y, Color_language,
|
|
|
|
Painter::line_onoffdash, pi_.base.solidLineThickness());
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2016-05-17 13:00:09 +00:00
|
|
|
void RowPainter::paintMisspelledMark(Row::Element const & e) const
|
2015-07-14 21:45:41 +00:00
|
|
|
{
|
2018-05-07 06:41:28 +00:00
|
|
|
if (e.font.fontInfo().nospellcheck() == FONT_ON)
|
|
|
|
return;
|
2015-07-14 21:45:41 +00:00
|
|
|
// if changed the misspelled marker gets placed slightly lower than normal
|
|
|
|
// to avoid drawing at the same vertical offset
|
2015-11-25 21:09:45 +00:00
|
|
|
FontMetrics const & fm = theFontMetrics(e.font);
|
|
|
|
int const thickness = max(fm.lineWidth(), 2);
|
2020-02-22 16:59:37 +00:00
|
|
|
int y = yo_ + pi_.base.solidLineOffset() + pi_.base.solidLineThickness()
|
2016-05-22 21:48:28 +00:00
|
|
|
+ (e.change.changed() ? pi_.base.solidLineThickness() + 1 : 0)
|
2015-11-25 21:09:45 +00:00
|
|
|
+ 1 + thickness / 2;
|
2020-02-22 16:59:37 +00:00
|
|
|
// Make sure that the mark does not go below the row rectangle
|
|
|
|
y = min(y, yo_ + row_.descent() - 1);
|
2015-07-14 21:45:41 +00:00
|
|
|
|
|
|
|
//FIXME: this could be computed only once, it is probably not costly.
|
|
|
|
// check for cursor position
|
|
|
|
// don't draw misspelled marker for words at cursor position
|
|
|
|
// we don't want to disturb the process of text editing
|
|
|
|
DocIterator const nw = pi_.base.bv->cursor().newWord();
|
|
|
|
pos_type cpos = -1;
|
|
|
|
if (!nw.empty() && par_.id() == nw.paragraph().id()) {
|
|
|
|
cpos = nw.pos();
|
|
|
|
if (cpos > 0 && cpos == par_.size() && !par_.isWordSeparator(cpos-1))
|
|
|
|
--cpos;
|
|
|
|
else if (cpos > 0 && par_.isWordSeparator(cpos))
|
|
|
|
--cpos;
|
|
|
|
}
|
|
|
|
|
2015-07-18 23:22:10 +00:00
|
|
|
pos_type pos = e.pos;
|
|
|
|
while (pos < e.pos + pos_type(e.str.length())) {
|
2015-07-14 21:45:41 +00:00
|
|
|
if (!par_.isMisspelled(pos)) {
|
|
|
|
++pos;
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
|
|
|
|
FontSpan const & range = par_.getSpellRange(pos);
|
|
|
|
|
|
|
|
// Skip element which are being edited
|
|
|
|
if (range.contains(cpos)) {
|
|
|
|
// the range includes the last element
|
|
|
|
pos = range.last + 1;
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
|
2015-07-18 23:22:10 +00:00
|
|
|
int x1 = fm.pos2x(e.str, range.first - e.pos,
|
2015-09-18 14:42:24 +00:00
|
|
|
e.isRTL(), e.extra);
|
2015-07-18 23:22:10 +00:00
|
|
|
int x2 = fm.pos2x(e.str, min(range.last - e.pos + 1,
|
|
|
|
pos_type(e.str.length())),
|
2015-09-18 14:42:24 +00:00
|
|
|
e.isRTL(), e.extra);
|
2015-07-14 21:45:41 +00:00
|
|
|
if (x1 > x2)
|
|
|
|
swap(x1, x2);
|
|
|
|
|
2017-07-03 17:53:14 +00:00
|
|
|
pi_.pain.line(int(x_ + x1), y, int(x_ + x2), y,
|
2016-07-02 18:12:34 +00:00
|
|
|
Color_error,
|
2015-11-25 21:09:45 +00:00
|
|
|
Painter::line_onoffdash, thickness);
|
2015-07-14 21:45:41 +00:00
|
|
|
pos = range.last + 1;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2016-05-17 13:00:09 +00:00
|
|
|
void RowPainter::paintStringAndSel(Row::Element const & e) const
|
2015-07-14 21:45:41 +00:00
|
|
|
{
|
|
|
|
// at least part of text selected?
|
2015-07-18 23:22:10 +00:00
|
|
|
bool const some_sel = (e.endpos >= row_.sel_beg && e.pos < row_.sel_end)
|
2015-07-14 21:45:41 +00:00
|
|
|
|| pi_.selected;
|
|
|
|
// all the text selected?
|
2015-07-18 23:22:10 +00:00
|
|
|
bool const all_sel = (e.pos >= row_.sel_beg && e.endpos < row_.sel_end)
|
2015-07-14 21:45:41 +00:00
|
|
|
|| pi_.selected;
|
|
|
|
|
2015-10-28 09:29:48 +00:00
|
|
|
if (all_sel || e.change.changed()) {
|
2015-07-18 23:22:10 +00:00
|
|
|
Font copy = e.font;
|
2015-10-28 09:29:48 +00:00
|
|
|
Color const col = e.change.changed() ? e.change.color()
|
|
|
|
: Color_selectiontext;
|
|
|
|
copy.fontInfo().setPaintColor(col);
|
2016-03-20 19:02:05 +00:00
|
|
|
pi_.pain.text(int(x_), yo_, e.str, copy, e.extra, e.full_width());
|
2015-07-14 21:45:41 +00:00
|
|
|
} else if (!some_sel) {
|
2016-03-20 19:02:05 +00:00
|
|
|
pi_.pain.text(int(x_), yo_, e.str, e.font, e.extra, e.full_width());
|
2015-07-14 21:45:41 +00:00
|
|
|
} else {
|
2015-07-18 23:22:10 +00:00
|
|
|
pi_.pain.text(int(x_), yo_, e.str, e.font, Color_selectiontext,
|
2016-03-20 19:02:05 +00:00
|
|
|
max(row_.sel_beg, e.pos) - e.pos,
|
|
|
|
min(row_.sel_end, e.endpos) - e.pos,
|
|
|
|
e.extra, e.full_width());
|
2015-07-14 21:45:41 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2018-09-20 09:31:23 +00:00
|
|
|
void RowPainter::paintTextDecoration(Row::Element const & e) const
|
|
|
|
{
|
|
|
|
// element selected?
|
|
|
|
bool const sel = (e.pos >= row_.sel_beg && e.endpos <= row_.sel_end)
|
|
|
|
|| pi_.selected;
|
|
|
|
FontInfo copy = e.font.fontInfo();
|
|
|
|
if (sel || e.change.changed()) {
|
|
|
|
Color const col = e.change.changed() ? e.change.color()
|
|
|
|
: Color_selectiontext;
|
|
|
|
copy.setPaintColor(col);
|
|
|
|
}
|
|
|
|
pi_.pain.textDecoration(copy, int(x_), yo_, int(e.full_width()));
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2016-05-17 13:00:09 +00:00
|
|
|
void RowPainter::paintChange(Row::Element const & e) const
|
2015-07-16 21:18:55 +00:00
|
|
|
{
|
2016-05-22 21:48:28 +00:00
|
|
|
e.change.paintCue(pi_, x_, yo_, x_ + e.full_width(), e.font.fontInfo());
|
2015-07-16 21:18:55 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2015-06-29 14:12:11 +00:00
|
|
|
void RowPainter::paintChangeBar() const
|
2003-02-26 17:04:10 +00:00
|
|
|
{
|
2021-04-05 17:07:15 +00:00
|
|
|
int const x = pi_.base.bv->leftMargin() - pi_.base.bv->zoomedPixels(7);
|
|
|
|
Dimension const & cdim = row_.contents_dim();
|
|
|
|
pi_.pain.fillRectangle(x, yo_ - cdim.ascent(),
|
|
|
|
3, cdim.height(), Color_changebar);
|
2003-02-26 17:04:10 +00:00
|
|
|
}
|
|
|
|
|
2003-03-04 09:27:27 +00:00
|
|
|
|
2015-06-29 14:12:11 +00:00
|
|
|
void RowPainter::paintAppendix() const
|
2003-02-26 17:04:10 +00:00
|
|
|
{
|
2007-07-17 13:35:32 +00:00
|
|
|
// only draw the appendix frame once (for the main text)
|
2009-08-09 15:29:34 +00:00
|
|
|
if (!par_.params().appendix() || !text_.isMainText())
|
2003-03-13 19:55:39 +00:00
|
|
|
return;
|
|
|
|
|
2004-11-30 01:59:49 +00:00
|
|
|
int y = yo_ - row_.ascent();
|
2003-03-13 19:55:39 +00:00
|
|
|
|
2004-08-15 00:01:45 +00:00
|
|
|
if (par_.params().startOfAppendix())
|
2003-03-13 19:55:39 +00:00
|
|
|
y += 2 * defaultRowHeight();
|
|
|
|
|
2007-10-25 12:41:02 +00:00
|
|
|
pi_.pain.line(1, y, 1, yo_ + row_.height(), Color_appendix);
|
2016-12-07 11:16:41 +00:00
|
|
|
pi_.pain.line(tm_.width() - 2, y, tm_.width() - 2, yo_ + row_.height(), Color_appendix);
|
2003-02-26 17:04:10 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2015-06-29 14:12:11 +00:00
|
|
|
void RowPainter::paintDepthBar() const
|
2003-02-26 17:04:10 +00:00
|
|
|
{
|
2018-02-08 16:00:41 +00:00
|
|
|
depth_type const depth = par_.getDepth();
|
2020-01-14 10:42:01 +00:00
|
|
|
ParagraphList const & pars = text_.paragraphs();
|
2003-02-26 17:04:10 +00:00
|
|
|
|
|
|
|
if (depth <= 0)
|
|
|
|
return;
|
|
|
|
|
2006-10-21 00:16:43 +00:00
|
|
|
depth_type prev_depth = 0;
|
2016-12-07 11:16:41 +00:00
|
|
|
if (!tm_.isFirstRow(row_)) {
|
2016-05-18 07:39:47 +00:00
|
|
|
pit_type pit2 = row_.pit();
|
2003-10-23 08:15:57 +00:00
|
|
|
if (row_.pos() == 0)
|
2003-08-14 12:06:11 +00:00
|
|
|
--pit2;
|
2020-01-14 10:42:01 +00:00
|
|
|
prev_depth = pars[pit2].getDepth();
|
2003-08-14 12:06:11 +00:00
|
|
|
}
|
2003-06-18 17:43:49 +00:00
|
|
|
|
2006-10-21 00:16:43 +00:00
|
|
|
depth_type next_depth = 0;
|
2016-12-07 11:16:41 +00:00
|
|
|
if (!tm_.isLastRow(row_)) {
|
2016-05-18 07:39:47 +00:00
|
|
|
pit_type pit2 = row_.pit();
|
2020-01-14 10:42:01 +00:00
|
|
|
if (row_.endpos() >= pars[pit2].size())
|
2003-08-14 12:06:11 +00:00
|
|
|
++pit2;
|
2020-01-14 10:42:01 +00:00
|
|
|
next_depth = pars[pit2].getDepth();
|
2003-08-14 12:06:11 +00:00
|
|
|
}
|
2003-02-26 17:04:10 +00:00
|
|
|
|
2006-10-21 00:16:43 +00:00
|
|
|
for (depth_type i = 1; i <= depth; ++i) {
|
2004-08-14 15:55:22 +00:00
|
|
|
int const w = nestMargin() / 5;
|
2004-08-14 21:56:40 +00:00
|
|
|
int x = int(xo_) + w * i;
|
2018-09-11 14:45:48 +00:00
|
|
|
// consider the bufferview left margin if we're drawing outermost text
|
2009-08-09 15:29:34 +00:00
|
|
|
if (text_.isMainText())
|
2018-09-11 14:45:48 +00:00
|
|
|
x += pi_.base.bv->leftMargin();
|
2004-08-14 15:55:22 +00:00
|
|
|
|
2004-11-30 01:59:49 +00:00
|
|
|
int const starty = yo_ - row_.ascent();
|
|
|
|
int const h = row_.height() - 1 - (i - next_depth - 1) * 3;
|
2003-02-26 17:04:10 +00:00
|
|
|
|
2007-10-25 12:41:02 +00:00
|
|
|
pi_.pain.line(x, starty, x, starty + h, Color_depthbar);
|
2003-02-26 17:04:10 +00:00
|
|
|
|
2003-07-28 12:20:42 +00:00
|
|
|
if (i > prev_depth)
|
2007-10-25 12:41:02 +00:00
|
|
|
pi_.pain.fillRectangle(x, starty, w, 2, Color_depthbar);
|
2003-07-28 12:20:42 +00:00
|
|
|
if (i > next_depth)
|
2007-10-25 12:41:02 +00:00
|
|
|
pi_.pain.fillRectangle(x, starty + h, w, 2, Color_depthbar);
|
2003-02-26 17:04:10 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2015-10-12 09:55:38 +00:00
|
|
|
void RowPainter::paintAppendixStart(int y) const
|
2003-03-13 19:55:39 +00:00
|
|
|
{
|
2007-10-29 08:47:19 +00:00
|
|
|
FontInfo pb_font = sane_font;
|
2007-10-25 12:41:02 +00:00
|
|
|
pb_font.setColor(Color_appendix);
|
2003-09-16 09:01:15 +00:00
|
|
|
pb_font.decSize();
|
2003-03-13 19:55:39 +00:00
|
|
|
|
|
|
|
int w = 0;
|
|
|
|
int a = 0;
|
|
|
|
int d = 0;
|
2006-10-17 14:46:45 +00:00
|
|
|
|
|
|
|
docstring const label = _("Appendix");
|
|
|
|
theFontMetrics(pb_font).rectText(label, w, a, d);
|
2003-03-13 19:55:39 +00:00
|
|
|
|
2016-12-07 11:16:41 +00:00
|
|
|
int const text_start = int(xo_ + (tm_.width() - w) / 2);
|
2003-03-13 19:55:39 +00:00
|
|
|
int const text_end = text_start + w;
|
|
|
|
|
2007-10-25 12:41:02 +00:00
|
|
|
pi_.pain.rectText(text_start, y + d, label, pb_font, Color_none, Color_none);
|
2003-03-13 19:55:39 +00:00
|
|
|
|
2007-10-25 12:41:02 +00:00
|
|
|
pi_.pain.line(int(xo_ + 1), y, text_start, y, Color_appendix);
|
2016-12-07 11:16:41 +00:00
|
|
|
pi_.pain.line(text_end, y, int(xo_ + tm_.width() - 2), y, Color_appendix);
|
2003-03-13 19:55:39 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2015-06-29 14:12:11 +00:00
|
|
|
void RowPainter::paintTooLargeMarks(bool const left, bool const right) const
|
2014-07-27 16:55:10 +00:00
|
|
|
{
|
2021-04-05 17:07:15 +00:00
|
|
|
int const lwid = pi_.base.dottedLineThickness();
|
|
|
|
Dimension const & cdim = row_.contents_dim();
|
|
|
|
if (left) {
|
|
|
|
int const x = pi_.base.bv->leftMargin() - lwid;
|
|
|
|
pi_.pain.line(x, yo_ - cdim.ascent(), x, yo_ + cdim.descent(),
|
|
|
|
Color_scroll, Painter::line_onoffdash, lwid);
|
|
|
|
}
|
2014-07-27 16:55:10 +00:00
|
|
|
if (right) {
|
2021-04-05 17:07:15 +00:00
|
|
|
int const x = pi_.base.bv->workWidth() - pi_.base.bv->rightMargin();
|
|
|
|
pi_.pain.line(x, yo_ - cdim.ascent(), x, yo_ + cdim.descent(),
|
|
|
|
Color_scroll, Painter::line_onoffdash, lwid);
|
2014-07-27 16:55:10 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2015-06-29 14:12:11 +00:00
|
|
|
void RowPainter::paintFirst() const
|
2003-02-26 17:04:10 +00:00
|
|
|
{
|
2010-09-06 10:56:27 +00:00
|
|
|
Layout const & layout = par_.layout();
|
2003-02-26 17:04:10 +00:00
|
|
|
|
|
|
|
// start of appendix?
|
2011-10-30 09:16:30 +00:00
|
|
|
if (par_.params().startOfAppendix())
|
2015-10-12 09:55:38 +00:00
|
|
|
paintAppendixStart(yo_ - row_.ascent() + 2 * defaultRowHeight());
|
2003-02-26 17:04:10 +00:00
|
|
|
|
2013-02-09 16:13:01 +00:00
|
|
|
bool const is_first =
|
2016-05-18 07:39:47 +00:00
|
|
|
text_.isFirstInSequence(row_.pit()) || !layout.isParagraphGroup();
|
2007-12-12 19:28:07 +00:00
|
|
|
//lyxerr << "paintFirst: " << par_.id() << " is_seq: " << is_seq << endl;
|
2003-02-26 17:04:10 +00:00
|
|
|
|
2013-02-09 16:13:01 +00:00
|
|
|
if (layout.labelIsInline()
|
2015-10-12 09:55:38 +00:00
|
|
|
&& (layout.labeltype != LABEL_STATIC || is_first))
|
2011-10-30 09:16:30 +00:00
|
|
|
paintLabel();
|
2015-10-12 09:55:38 +00:00
|
|
|
else if (is_first && layout.labelIsAbove())
|
2011-10-30 09:16:30 +00:00
|
|
|
paintTopLevelLabel();
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2015-06-29 14:12:11 +00:00
|
|
|
void RowPainter::paintLabel() const
|
2011-10-30 09:16:30 +00:00
|
|
|
{
|
2016-06-29 16:51:55 +00:00
|
|
|
docstring const & str = par_.labelString();
|
2011-10-30 09:16:30 +00:00
|
|
|
if (str.empty())
|
|
|
|
return;
|
|
|
|
|
|
|
|
Layout const & layout = par_.layout();
|
2018-01-16 13:04:05 +00:00
|
|
|
FontInfo const font = labelFont(false);
|
2011-10-30 09:16:30 +00:00
|
|
|
FontMetrics const & fm = theFontMetrics(font);
|
2019-02-04 11:13:01 +00:00
|
|
|
int const x = row_.isRTL() ? row_.width() + fm.width(layout.labelsep)
|
|
|
|
: row_.left_margin - fm.width(layout.labelsep) - fm.width(str);
|
2013-02-09 16:13:40 +00:00
|
|
|
|
2019-03-17 13:28:22 +00:00
|
|
|
pi_.pain.text(int(xo_) + x, yo_, str, font);
|
2003-02-26 17:04:10 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2015-06-29 14:12:11 +00:00
|
|
|
void RowPainter::paintTopLevelLabel() const
|
2011-10-30 09:16:30 +00:00
|
|
|
{
|
|
|
|
BufferParams const & bparams = pi_.base.bv->buffer().params();
|
|
|
|
ParagraphParameters const & pparams = par_.params();
|
|
|
|
Layout const & layout = par_.layout();
|
2018-01-16 13:04:05 +00:00
|
|
|
FontInfo const font = labelFont(false);
|
2011-10-30 09:16:30 +00:00
|
|
|
docstring const str = par_.labelString();
|
|
|
|
if (str.empty())
|
|
|
|
return;
|
|
|
|
|
|
|
|
double spacing_val = 1.0;
|
|
|
|
if (!pparams.spacing().isDefault())
|
|
|
|
spacing_val = pparams.spacing().getValue();
|
|
|
|
else
|
|
|
|
spacing_val = bparams.spacing().getValue();
|
|
|
|
|
|
|
|
FontMetrics const & fm = theFontMetrics(font);
|
|
|
|
|
|
|
|
int const labeladdon = int(fm.maxHeight()
|
|
|
|
* layout.spacing.getValue() * spacing_val);
|
|
|
|
|
|
|
|
int maxdesc =
|
|
|
|
int(fm.maxDescent() * layout.spacing.getValue() * spacing_val
|
|
|
|
+ (layout.labelbottomsep * defaultRowHeight()));
|
|
|
|
|
|
|
|
double x = x_;
|
2013-02-09 16:13:01 +00:00
|
|
|
if (layout.labeltype == LABEL_CENTERED) {
|
2021-02-16 19:22:46 +00:00
|
|
|
// The 'size + 1' is weird, but it makes sure that we get the
|
|
|
|
// left margin of non-first row.
|
|
|
|
int leftm = tm_.leftMargin(row_.pit(), par_.size() + 1);
|
|
|
|
int rightm = tm_.rightMargin(row_.pit());
|
|
|
|
if (row_.isRTL())
|
|
|
|
swap(leftm, rightm);
|
2020-08-25 08:25:14 +00:00
|
|
|
/* Currently, x points at row_.left_margin (which contains the
|
|
|
|
* indent). First remove that, and then center the title with
|
|
|
|
* respect to the left and right margins.
|
|
|
|
*/
|
|
|
|
x += leftm - row_.left_margin + (tm_.width() - leftm -rightm) / 2
|
|
|
|
- fm.width(str) / 2;
|
2016-12-07 11:16:41 +00:00
|
|
|
} else if (row_.isRTL()) {
|
2019-01-04 15:24:18 +00:00
|
|
|
x = xo_ + tm_.width() - row_.right_margin - fm.width(str);
|
2011-10-30 09:16:30 +00:00
|
|
|
}
|
|
|
|
pi_.pain.text(int(x), yo_ - maxdesc - labeladdon, str, font);
|
|
|
|
}
|
|
|
|
|
2012-10-27 13:45:27 +00:00
|
|
|
|
2016-05-17 13:00:09 +00:00
|
|
|
void RowPainter::paintLast() const
|
2003-02-26 17:04:10 +00:00
|
|
|
{
|
2019-04-03 09:06:43 +00:00
|
|
|
int const endlabel = text_.getEndLabel(row_.pit());
|
2003-02-26 17:04:10 +00:00
|
|
|
switch (endlabel) {
|
|
|
|
case END_LABEL_BOX:
|
2003-10-28 11:18:40 +00:00
|
|
|
case END_LABEL_FILLED_BOX: {
|
2018-01-16 13:04:05 +00:00
|
|
|
FontInfo font = labelFont(true);
|
|
|
|
if (font.realColor() != Color_selectiontext)
|
|
|
|
font.setPaintColor(Color_eolmarker);
|
2006-10-11 17:24:46 +00:00
|
|
|
FontMetrics const & fm = theFontMetrics(font);
|
2006-10-07 16:15:06 +00:00
|
|
|
int const size = int(0.75 * fm.maxAscent());
|
2004-11-30 01:59:49 +00:00
|
|
|
int const y = yo_ - size;
|
2003-02-26 17:04:10 +00:00
|
|
|
|
2008-01-29 07:31:24 +00:00
|
|
|
// If needed, move the box a bit to avoid overlapping with text.
|
2016-08-23 15:43:38 +00:00
|
|
|
int x = 0;
|
2016-12-07 11:16:41 +00:00
|
|
|
if (row_.isRTL()) {
|
2016-08-23 15:43:38 +00:00
|
|
|
int const normal_x = nestMargin() + changebarMargin();
|
2020-01-13 21:09:06 +00:00
|
|
|
x = min(normal_x, row_.left_margin - size - Inset::textOffset(pi_.base.bv));
|
2016-08-23 15:43:38 +00:00
|
|
|
} else {
|
2016-12-07 11:16:41 +00:00
|
|
|
int const normal_x = tm_.width() - row_.right_margin
|
2020-01-13 21:09:06 +00:00
|
|
|
- size - Inset::textOffset(pi_.base.bv);
|
2016-08-23 15:43:38 +00:00
|
|
|
x = max(normal_x, row_.width());
|
|
|
|
}
|
2003-02-26 17:04:10 +00:00
|
|
|
|
2003-07-28 12:20:42 +00:00
|
|
|
if (endlabel == END_LABEL_BOX)
|
2019-02-11 09:43:59 +00:00
|
|
|
pi_.pain.rectangle(int(xo_) + x, y, size, size, font.realColor());
|
2003-07-28 12:20:42 +00:00
|
|
|
else
|
2019-02-11 09:43:59 +00:00
|
|
|
pi_.pain.fillRectangle(int(xo_) + x, y, size, size, font.realColor());
|
2003-02-26 17:04:10 +00:00
|
|
|
break;
|
|
|
|
}
|
2003-10-28 11:18:40 +00:00
|
|
|
|
|
|
|
case END_LABEL_STATIC: {
|
2018-01-16 13:04:05 +00:00
|
|
|
FontInfo const font = labelFont(true);
|
2006-10-11 17:24:46 +00:00
|
|
|
FontMetrics const & fm = theFontMetrics(font);
|
2008-03-06 21:31:27 +00:00
|
|
|
docstring const & str = par_.layout().endlabelstring();
|
2021-02-14 19:07:19 +00:00
|
|
|
double const x = row_.isRTL() ? row_.left_margin - fm.width(str) : row_.width();
|
|
|
|
pi_.pain.text(xo_ + x, yo_, str, font);
|
2003-02-26 17:04:10 +00:00
|
|
|
break;
|
|
|
|
}
|
2003-10-28 11:18:40 +00:00
|
|
|
|
2003-02-26 17:04:10 +00:00
|
|
|
case END_LABEL_NO_LABEL:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2007-08-30 13:19:24 +00:00
|
|
|
void RowPainter::paintOnlyInsets()
|
|
|
|
{
|
2019-01-07 12:50:55 +00:00
|
|
|
for (Row::Element const & e : row_) {
|
2016-07-20 21:25:17 +00:00
|
|
|
if (e.type == Row::INSET) {
|
|
|
|
paintInset(e);
|
2018-05-06 17:48:21 +00:00
|
|
|
// The markings of foreign languages
|
|
|
|
// and of text ignored for spellchecking
|
|
|
|
paintLanguageMarkings(e);
|
2016-07-20 21:25:17 +00:00
|
|
|
// change tracking (not for insets that handle it themselves)
|
|
|
|
if (!e.inset->canPaintChange(*pi_.base.bv))
|
|
|
|
paintChange(e);
|
|
|
|
}
|
|
|
|
|
2016-05-17 13:00:09 +00:00
|
|
|
x_ += e.full_width();
|
2007-08-30 13:19:24 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2015-07-18 18:37:53 +00:00
|
|
|
|
2003-03-22 17:26:03 +00:00
|
|
|
void RowPainter::paintText()
|
2015-07-16 21:18:55 +00:00
|
|
|
{
|
2019-01-07 12:50:55 +00:00
|
|
|
for (Row::Element const & e : row_) {
|
2015-07-16 21:18:55 +00:00
|
|
|
switch (e.type) {
|
|
|
|
case Row::STRING:
|
|
|
|
case Row::VIRTUAL:
|
2015-07-18 23:22:10 +00:00
|
|
|
paintStringAndSel(e);
|
2015-07-16 21:18:55 +00:00
|
|
|
|
2015-08-26 11:54:35 +00:00
|
|
|
// Paint the spelling marks if enabled.
|
2017-07-15 23:25:03 +00:00
|
|
|
if (lyxrc.spellcheck_continuously && pi_.do_spellcheck && !pi_.pain.isNull())
|
2016-05-17 13:00:09 +00:00
|
|
|
paintMisspelledMark(e);
|
2015-07-16 21:18:55 +00:00
|
|
|
break;
|
2016-05-17 13:00:09 +00:00
|
|
|
|
|
|
|
case Row::INSET:
|
2016-02-28 15:42:35 +00:00
|
|
|
paintInset(e);
|
2015-07-16 21:18:55 +00:00
|
|
|
break;
|
2016-05-17 13:00:09 +00:00
|
|
|
|
2015-07-16 21:18:55 +00:00
|
|
|
case Row::SPACE:
|
2018-09-20 09:31:23 +00:00
|
|
|
paintTextDecoration(e);
|
2015-07-16 21:18:55 +00:00
|
|
|
}
|
|
|
|
|
2018-05-06 17:48:21 +00:00
|
|
|
// The markings of foreign languages
|
|
|
|
// and of text ignored for spellchecking
|
|
|
|
paintLanguageMarkings(e);
|
2015-07-16 21:18:55 +00:00
|
|
|
|
2016-05-22 21:48:28 +00:00
|
|
|
// change tracking (not for insets that handle it themselves)
|
|
|
|
if (e.type != Row::INSET || ! e.inset->canPaintChange(*pi_.base.bv))
|
2016-05-17 13:00:09 +00:00
|
|
|
paintChange(e);
|
|
|
|
|
|
|
|
x_ += e.full_width();
|
2015-07-16 21:18:55 +00:00
|
|
|
}
|
2003-02-26 17:04:10 +00:00
|
|
|
}
|
|
|
|
|
2008-02-22 14:05:27 +00:00
|
|
|
|
2015-06-29 14:12:11 +00:00
|
|
|
void RowPainter::paintSelection() const
|
2010-11-25 13:16:30 +00:00
|
|
|
{
|
|
|
|
if (!row_.selection())
|
|
|
|
return;
|
2016-10-25 07:28:14 +00:00
|
|
|
|
2021-12-07 17:15:01 +00:00
|
|
|
int const y1 = yo_ - row_.contents_dim().asc;
|
|
|
|
int const y2 = yo_ + row_.contents_dim().des;
|
2010-11-25 13:16:30 +00:00
|
|
|
|
2021-12-07 17:15:01 +00:00
|
|
|
// The top selection
|
|
|
|
if (row_.begin_margin_sel)
|
|
|
|
pi_.pain.fillRectangle(int(xo_), yo_ - row_.ascent(),
|
|
|
|
tm_.width(), row_.ascent() - row_.contents_dim().asc,
|
|
|
|
Color_selection);
|
|
|
|
|
|
|
|
// The left margin selection
|
2016-12-07 11:16:41 +00:00
|
|
|
if (row_.isRTL() ? row_.end_margin_sel : row_.begin_margin_sel)
|
2016-10-25 07:28:14 +00:00
|
|
|
pi_.pain.fillRectangle(int(xo_), y1, row_.left_margin, y2 - y1,
|
|
|
|
Color_selection);
|
2016-10-26 12:23:59 +00:00
|
|
|
|
2010-11-25 13:16:30 +00:00
|
|
|
// go through row and draw from RTL boundary to RTL boundary
|
2016-10-26 08:52:55 +00:00
|
|
|
double x = xo_ + row_.left_margin;
|
2016-10-25 07:28:14 +00:00
|
|
|
for (auto const & e : row_) {
|
2016-10-26 12:23:59 +00:00
|
|
|
// These are the same tests as in paintStringAndSel, except
|
|
|
|
// that all_sel has an additional clause that triggers for end
|
|
|
|
// of paragraph markers. The clause was not used in
|
|
|
|
// paintStringAndSel to avoid changing the drawing color.
|
2016-10-25 07:28:14 +00:00
|
|
|
// at least part of text selected?
|
2016-10-26 12:23:59 +00:00
|
|
|
bool const some_sel = (e.endpos >= row_.sel_beg && e.pos < row_.sel_end)
|
2016-10-25 07:28:14 +00:00
|
|
|
|| pi_.selected;
|
|
|
|
// all the text selected?
|
2016-10-26 12:23:59 +00:00
|
|
|
bool const all_sel = (e.pos >= row_.sel_beg && e.endpos < row_.sel_end)
|
|
|
|
|| (e.isVirtual() && e.pos == row_.endpos() && row_.end_margin_sel)
|
|
|
|
|| pi_.selected;
|
2016-10-25 07:28:14 +00:00
|
|
|
|
|
|
|
if (all_sel) {
|
2016-10-26 12:23:59 +00:00
|
|
|
// the 3rd argument is written like that to avoid rounding issues
|
|
|
|
pi_.pain.fillRectangle(int(x), y1,
|
|
|
|
int(x + e.full_width()) - int(x), y2 - y1,
|
2016-10-25 07:28:14 +00:00
|
|
|
Color_selection);
|
|
|
|
} else if (some_sel) {
|
|
|
|
pos_type const from = min(max(row_.sel_beg, e.pos), e.endpos);
|
|
|
|
pos_type const to = max(min(row_.sel_end, e.endpos), e.pos);
|
2016-10-26 08:52:55 +00:00
|
|
|
double x1 = e.pos2x(from);
|
|
|
|
double x2 = e.pos2x(to);
|
2016-10-25 07:28:14 +00:00
|
|
|
if (x1 > x2)
|
|
|
|
swap(x1, x2);
|
2017-06-12 12:39:03 +00:00
|
|
|
// the 3rd argument is written like that to avoid rounding issues
|
|
|
|
pi_.pain.fillRectangle(int(x + x1), y1, int(x2 + x) - int(x1 + x),
|
|
|
|
y2 - y1, Color_selection);
|
2010-11-25 13:16:30 +00:00
|
|
|
}
|
2016-10-25 07:28:14 +00:00
|
|
|
x += e.full_width();
|
2010-11-25 13:16:30 +00:00
|
|
|
}
|
2016-10-25 14:14:35 +00:00
|
|
|
|
2021-12-07 17:15:01 +00:00
|
|
|
// the right margin selection
|
2016-12-07 11:16:41 +00:00
|
|
|
if (row_.isRTL() ? row_.begin_margin_sel : row_.end_margin_sel)
|
2016-11-04 14:57:59 +00:00
|
|
|
pi_.pain.fillRectangle(int(x), y1,
|
2016-12-07 11:16:41 +00:00
|
|
|
int(xo_ + tm_.width()) - int(x), y2 - y1,
|
2016-10-25 14:14:35 +00:00
|
|
|
Color_selection);
|
2021-12-07 17:15:01 +00:00
|
|
|
// The bottom selection
|
|
|
|
if (row_.end_margin_sel)
|
|
|
|
pi_.pain.fillRectangle(int(xo_), yo_ + row_.contents_dim().des,
|
|
|
|
tm_.width(), row_.descent() - row_.contents_dim().des,
|
|
|
|
Color_selection);
|
2021-02-26 18:05:35 +00:00
|
|
|
}
|
|
|
|
|
2016-10-25 14:14:35 +00:00
|
|
|
|
2021-02-26 18:05:35 +00:00
|
|
|
void RowPainter::paintBookmark(int num) const
|
|
|
|
{
|
2021-04-06 13:19:12 +00:00
|
|
|
BufferView const * bv = pi_.base.bv;
|
|
|
|
FontInfo fi = bv->buffer().params().getFont().fontInfo();
|
|
|
|
FontMetrics const & fm = theFontMetrics(fi);
|
2021-02-26 18:05:35 +00:00
|
|
|
fi.setColor(Color_bookmark);
|
|
|
|
// ❶ U+2776 DINGBAT NEGATIVE CIRCLED DIGIT ONE
|
|
|
|
char_type const ch = 0x2775 + num;
|
2021-04-06 13:19:12 +00:00
|
|
|
int const x = row_.isRTL()
|
|
|
|
? bv->workWidth() - bv->rightMargin() + (bv->defaultMargin() - fm.width(ch)) / 2
|
|
|
|
: bv->leftMargin() - (bv->defaultMargin() + fm.width(ch)) / 2;
|
2021-02-26 18:05:35 +00:00
|
|
|
pi_.pain.text(x, yo_, ch, fi);
|
2010-11-25 13:16:30 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2006-10-21 00:16:43 +00:00
|
|
|
} // namespace lyx
|