Add marks to indicate when a row is too large

A dotted line is shown on the left or on the right to indicate that a part of the row is not visible.

Add a color code for the scroll indicator
This commit is contained in:
Jean-Marc Lasgouttes 2014-07-27 18:55:10 +02:00
parent c6e1db7682
commit 52236503d3
5 changed files with 23 additions and 0 deletions

View File

@ -238,6 +238,7 @@ ColorSet::ColorSet()
{ Color_urllabel, N_("URL label"), "urllabel", "blue", "urllabel" },
{ Color_urltext, N_("URL text"), "urltext", "blue", "urltext" },
{ Color_depthbar, N_("depth bar"), "depthbar", "IndianRed", "depthbar" },
{ Color_scroll, N_("scroll indicator"), "scroll", "IndianRed", "scroll" },
{ Color_language, N_("language"), "language", "Blue", "language" },
{ Color_command, N_("command inset"), "command", "black", "command" },
{ Color_commandbg, N_("command inset background"), "commandbg", "azure", "commandbg" },

View File

@ -91,6 +91,8 @@ enum ColorCode {
/// Color for the depth bars in the margin
Color_depthbar,
/// Color that indicates when a row can be scrolled
Color_scroll,
/// Color for marking foreign language words
Color_language,

View File

@ -439,6 +439,23 @@ int RowPainter::paintAppendixStart(int y)
}
void RowPainter::paintTooLargeMarks(bool const left, bool const right)
{
if (left)
pi_.pain.line(dotted_line_thickness_, yo_ - row_.ascent(),
dotted_line_thickness_, yo_ + row_.descent(),
Color_scroll,
Painter::line_onoffdash, dotted_line_thickness_);
if (right) {
int const wwidth = pi_.base.bv->workWidth() - dotted_line_thickness_;
pi_.pain.line(wwidth, yo_ - row_.ascent(),
wwidth, yo_ + row_.descent(),
Color_scroll,
Painter::line_onoffdash, dotted_line_thickness_);
}
}
void RowPainter::paintFirst()
{
BufferParams const & bparams = pi_.base.bv->buffer().params();

View File

@ -66,6 +66,7 @@ public:
void paintAppendix();
void paintDepthBar();
void paintChangeBar();
void paintTooLargeMarks(bool const left, bool const right);
void paintFirst();
void paintLast();
void paintText();

View File

@ -1942,6 +1942,8 @@ void TextMetrics::drawParagraph(PainterInfo & pi, pit_type const pit, int const
rp.paintLast();
if (i == 0 && is_rtl)
rp.paintFirst();
rp.paintTooLargeMarks(row_x < 0,
row_x + row.width() > bv_->workWidth());
y += row.descent();
// Restore full_repaint status.