]> git.lyx.org Git - features.git/commitdiff
the appendix patch
authorJohn Levon <levon@movementarian.org>
Thu, 13 Mar 2003 19:55:39 +0000 (19:55 +0000)
committerJohn Levon <levon@movementarian.org>
Thu, 13 Mar 2003 19:55:39 +0000 (19:55 +0000)
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@6491 a592a061-630c-0410-9148-cb99ea01b6c8

src/ChangeLog
src/LColor.C
src/LColor.h
src/rowpainter.C
src/rowpainter.h
src/text.C

index 558a7201d86be12f3465a296f93f0f77b1b8509a..7ee43ffae844c270a856b77a43aa080ac6ca5f5e 100644 (file)
@@ -1,3 +1,13 @@
+2003-03-13  John Levon  <levon@movementarian.org>
+
+       * text.C (setHeightOfRow):
+       * rowpainter.h:
+       * rowpainter.C: make appendix mark have the text
+         "Appendix" so the user knows what it is
+
+       * LColor.h:
+       * LColor.C: s/appendixline/appendix/ from above
+
 2003-03-13  John Levon  <levon@movementarian.org>
 
        * paragraph_pimpl.C: fix Andre's backing out of the strong assertion
index ea7c17ec10e42a4e45654fb5ee0f792cb4460e64..a6027492a068bcdc88a086a0ff9bf0f6c2955398 100644 (file)
@@ -79,7 +79,7 @@ LColor::LColor()
        { insetframe, N_("inset frame"), "insetframe", "IndianRed", "insetframe" },
        { error, N_("LaTeX error"), "error", "Red", "error" },
        { eolmarker, N_("end-of-line marker"), "eolmarker", "Brown", "eolmarker" },
-       { appendixline, N_("appendix line"), "appendixline", "Brown", "appendixline" },
+       { appendix, N_("appendix marker"), "appendix", "Brown", "appendix" },
        { changebar, N_("change bar"), "changebar", "Blue", "changebar" },
        { strikeout, N_("Deleted text"), "strikeout", "Red", "strikeout" },
        { newtext, N_("Added text"), "newtext", "Blue", "newtext" },
index 83a5a3d8e15868ea684fd18003fb30ff84410ba7..ef0a2382a93f092d16e7cb9172e7f2350082ca7f 100644 (file)
@@ -131,8 +131,8 @@ public:
                eolmarker,
                /// Added space colour
                added_space,
-               /// Appendix line color
-               appendixline,
+               /// Appendix marker color
+               appendix,
                /// changebar color
                changebar,
                /// strike-out color
index 99e4b04b249c8351c4223f11a36f34fb4146c69a..5e5302e9b53ce02b8437e6aa2ef9a39d2c185372 100644 (file)
@@ -488,13 +488,19 @@ void RowPainter::paintChangeBar()
 
 void RowPainter::paintAppendix()
 {
+       if (!par_.params().appendix())
+               return;
+
        // FIXME: can be just width_ ?
        int const ww = bv_.workWidth();
 
-       if (par_.params().appendix()) {
-               pain_.line(1, yo_, 1, yo_ + row_.height(), LColor::appendixline);
-               pain_.line(ww - 2, yo_, ww - 2, yo_ + row_.height(), LColor::appendixline);
-       }
+       int y = yo_;
+
+       if (par_.params().startOfAppendix())
+               y += 2 * defaultRowHeight();
+
+       pain_.line(1, y, 1, yo_ + row_.height(), LColor::appendix);
+       pain_.line(ww - 2, y, ww - 2, yo_ + row_.height(), LColor::appendix);
 }
 
 
@@ -641,17 +647,40 @@ int RowPainter::paintPageBreak(string const & label, int y)
 }
 
 
+int RowPainter::paintAppendixStart(int y)
+{
+       LyXFont pb_font;
+       pb_font.setColor(LColor::appendix).decSize();
+
+       string const label = _("Appendix");
+       int w = 0;
+       int a = 0;
+       int d = 0;
+       font_metrics::rectText(label, pb_font, w, a, d);
+
+       int const text_start = xo_ + ((width_ - w) / 2);
+       int const text_end = text_start + w;
+
+       pain_.rectText(text_start, y + d, label, pb_font);
+
+       pain_.line(xo_ + 1, y, text_start, y, LColor::appendix);
+       pain_.line(text_end, y, xo_ + width_ - 2, y, LColor::appendix);
+
+       return 3 * defaultRowHeight();
+}
+
+
 void RowPainter::paintFirst()
 {
        ParagraphParameters const & parparams = par_.params();
 
+       int y_top = 0;
+
        // start of appendix?
        if (parparams.startOfAppendix()) {
-               pain_.line(1, yo_, width_ - 2, yo_, LColor::appendixline);
+               y_top += paintAppendixStart(yo_ + y_top + 2 * defaultRowHeight());
        }
 
-       int y_top = 0;
-
        // the top margin
        if (!row_.previous() && text_.isTopLevel())
                y_top += PAPER_MARGIN;
index 2324bf656ce9961a76cd32e6f2fa58f5894bd330..9c0c534733b9913c32b4ed6f5aaccfd43bdcdfdb 100644 (file)
@@ -50,6 +50,7 @@ private:
        void paintArabicComposeChar(lyx::pos_type & vpos);
        void paintChars(lyx::pos_type & vpos, bool hebrew, bool arabic);
        int paintPageBreak(string const & label, int y);
+       int paintAppendixStart(int y);
        int paintLengthMarker(string const & prefix, VSpace const & vsp, int start);
        /// returns true when CHANGED_IN_DRAW
        bool paintText();
index df6f0f90854f669ee6b468ad813d2f7e2faee30e..2f3ea97c199c566c4bf7d14c50933d14ae5e6ad0 100644 (file)
@@ -1070,6 +1070,9 @@ void LyXText::setHeightOfRow(BufferView * bview, Row * row) const
                if (firstpar->params().pagebreakTop())
                        maxasc += 3 * defaultRowHeight();
 
+               if (firstpar->params().startOfAppendix())
+                       maxasc += 3 * defaultRowHeight();
+
                // This is special code for the chapter, since the label of this
                // layout is printed in an extra row
                if (layout->labeltype == LABEL_COUNTER_CHAPTER