commit 52236503d3f680a2df00a6e6539b530703066d32
Author: Jean-Marc Lasgouttes <[email protected]>
Date:   Sun Jul 27 18:55:10 2014 +0200

    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

diff --git a/src/Color.cpp b/src/Color.cpp
index 31d5f62..161ebba 100644
--- a/src/Color.cpp
+++ b/src/Color.cpp
@@ -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" },
diff --git a/src/ColorCode.h b/src/ColorCode.h
index 2338995..4d391c0 100644
--- a/src/ColorCode.h
+++ b/src/ColorCode.h
@@ -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,
 
diff --git a/src/RowPainter.cpp b/src/RowPainter.cpp
index 4f7e667..5e3444a 100644
--- a/src/RowPainter.cpp
+++ b/src/RowPainter.cpp
@@ -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();
diff --git a/src/RowPainter.h b/src/RowPainter.h
index aebd73e..0628f32 100644
--- a/src/RowPainter.h
+++ b/src/RowPainter.h
@@ -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();
diff --git a/src/TextMetrics.cpp b/src/TextMetrics.cpp
index ab857a5..9a6b67d 100644
--- a/src/TextMetrics.cpp
+++ b/src/TextMetrics.cpp
@@ -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.

Reply via email to