The branch, master, has been updated. - Log -----------------------------------------------------------------
commit 32b0e8cbdbb8f3b970243961d8a57ed4a9fde2e3 Author: Richard Heck <[email protected]> Date: Sat Feb 9 11:13:01 2013 -0500 Change LabelType Top_Environment to LabelType Above, and LabelType Centered_Top_Environment to LabelType Centered. diff --git a/src/Buffer.cpp b/src/Buffer.cpp index 9299d47..2379f49 100644 --- a/src/Buffer.cpp +++ b/src/Buffer.cpp @@ -4443,8 +4443,8 @@ void Buffer::Impl::setLabel(ParIterator & it, UpdateType utype) const par.params().labelString(docstring()); break; - case LABEL_TOP_ENVIRONMENT: - case LABEL_CENTERED_TOP_ENVIRONMENT: + case LABEL_ABOVE: + case LABEL_CENTERED: case LABEL_STATIC: { docstring const & lcounter = layout.counter; if (!lcounter.empty()) { diff --git a/src/Layout.cpp b/src/Layout.cpp index 52504ae..4848954 100644 --- a/src/Layout.cpp +++ b/src/Layout.cpp @@ -684,8 +684,8 @@ void Layout::readLabelType(Lexer & lex) enum { LA_NO_LABEL = 1, LA_MANUAL, - LA_TOP_ENVIRONMENT, - LA_CENTERED_TOP_ENVIRONMENT, + LA_ABOVE, + LA_CENTERED, LA_STATIC, LA_SENSITIVE, LA_ENUMERATE, @@ -695,15 +695,15 @@ void Layout::readLabelType(Lexer & lex) LexerKeyword labelTypeTags[] = { - { "bibliography", LA_BIBLIO }, - { "centered_top_environment", LA_CENTERED_TOP_ENVIRONMENT }, - { "enumerate", LA_ENUMERATE }, - { "itemize", LA_ITEMIZE }, - { "manual", LA_MANUAL }, - { "no_label", LA_NO_LABEL }, - { "sensitive", LA_SENSITIVE }, - { "static", LA_STATIC }, - { "top_environment", LA_TOP_ENVIRONMENT } + { "above", LA_ABOVE }, + { "bibliography", LA_BIBLIO }, + { "centered", LA_CENTERED }, + { "enumerate", LA_ENUMERATE }, + { "itemize", LA_ITEMIZE }, + { "manual", LA_MANUAL }, + { "no_label", LA_NO_LABEL }, + { "sensitive", LA_SENSITIVE }, + { "static", LA_STATIC } }; PushPopHelper pph(lex, labelTypeTags); @@ -721,11 +721,11 @@ void Layout::readLabelType(Lexer & lex) case LA_MANUAL: labeltype = LABEL_MANUAL; break; - case LA_TOP_ENVIRONMENT: - labeltype = LABEL_TOP_ENVIRONMENT; + case LA_ABOVE: + labeltype = LABEL_ABOVE; break; - case LA_CENTERED_TOP_ENVIRONMENT: - labeltype = LABEL_CENTERED_TOP_ENVIRONMENT; + case LA_CENTERED: + labeltype = LABEL_CENTERED; break; case LA_STATIC: labeltype = LABEL_STATIC; @@ -1035,8 +1035,8 @@ string const & Layout::htmlitemattr() const string const & Layout::htmllabeltag() const { if (htmllabeltag_.empty()) { - if (labeltype != LABEL_TOP_ENVIRONMENT && - labeltype != LABEL_CENTERED_TOP_ENVIRONMENT) + if (labeltype != LABEL_ABOVE && + labeltype != LABEL_CENTERED) htmllabeltag_ = "span"; else htmllabeltag_ = "div"; @@ -1161,7 +1161,7 @@ void Layout::makeDefaultCSS() const // label font if (labelfont != font) labelCSS = labelfont.asCSS() + from_ascii("\n"); - if (labeltype == LABEL_CENTERED_TOP_ENVIRONMENT) + if (labeltype == LABEL_CENTERED) labelCSS += from_ascii("text-align: center;\n"); if (!labelCSS.empty()) diff --git a/src/Layout.h b/src/Layout.h index b02c528..d84ca37 100644 --- a/src/Layout.h +++ b/src/Layout.h @@ -180,6 +180,24 @@ public: || latextype == LATEX_ITEM_ENVIRONMENT || latextype == LATEX_LIST_ENVIRONMENT; } + /// Is this the kind of layout in which adjacent paragraphs + /// are handled as one group? + bool isParagraphGroup() const { + return latextype == LATEX_ENVIRONMENT + || latextype == LATEX_BIB_ENVIRONMENT; + } + /// + bool labelIsInline() const { + return labeltype == LABEL_STATIC + || labeltype == LABEL_SENSITIVE + || labeltype == LABEL_ENUMERATE + || labeltype == LABEL_ITEMIZE; + } + bool labelIsAbove() const { + return labeltype == LABEL_ABOVE + || labeltype == LABEL_CENTERED + || labeltype == LABEL_BIBLIO; + } /// bool operator==(Layout const &) const; diff --git a/src/LayoutEnums.h b/src/LayoutEnums.h index efdd5f5..c90c968 100644 --- a/src/LayoutEnums.h +++ b/src/LayoutEnums.h @@ -113,11 +113,9 @@ enum LabelType { /// LABEL_BIBLIO, /// - LABEL_TOP_ENVIRONMENT, + LABEL_ABOVE, /// - LABEL_CENTERED_TOP_ENVIRONMENT, - - // the flushright labels following now must start with LABEL_STATIC + LABEL_CENTERED, /// LABEL_STATIC, /// diff --git a/src/TextMetrics.cpp b/src/TextMetrics.cpp index 9382230..44e81d0 100644 --- a/src/TextMetrics.cpp +++ b/src/TextMetrics.cpp @@ -1112,10 +1112,8 @@ Dimension TextMetrics::rowHeight(pit_type const pit, pos_type const first, } // special code for the top label - if ((layout.labeltype == LABEL_TOP_ENVIRONMENT - || layout.labeltype == LABEL_BIBLIO - || layout.labeltype == LABEL_CENTERED_TOP_ENVIRONMENT) - && text_->isFirstInSequence(pit) + if (layout.labelIsAbove() + && (!layout.isParagraphGroup() || text_->isFirstInSequence(pit)) && !par.labelString().empty()) { labeladdon = int( @@ -1981,10 +1979,7 @@ int TextMetrics::leftMargin(int max_width, && layout.latextype == LATEX_ENVIRONMENT && !text_->isFirstInSequence(pit))) { l_margin += labelfont_metrics.signedWidth(layout.leftmargin); - } else if (layout.labeltype != LABEL_TOP_ENVIRONMENT - && layout.labeltype != LABEL_BIBLIO - && layout.labeltype != - LABEL_CENTERED_TOP_ENVIRONMENT) { + } else if (!layout.labelIsAbove()) { l_margin += labelfont_metrics.signedWidth(layout.labelindent); l_margin += labelfont_metrics.width(layout.labelsep); l_margin += labelfont_metrics.width(par.labelString()); @@ -2026,8 +2021,8 @@ int TextMetrics::leftMargin(int max_width, // set the correct parindent if (pos == 0 && (layout.labeltype == LABEL_NO_LABEL - || layout.labeltype == LABEL_TOP_ENVIRONMENT - || layout.labeltype == LABEL_CENTERED_TOP_ENVIRONMENT + || layout.labeltype == LABEL_ABOVE + || layout.labeltype == LABEL_CENTERED || (layout.labeltype == LABEL_STATIC && layout.latextype == LATEX_ENVIRONMENT && !text_->isFirstInSequence(pit))) diff --git a/src/output_xhtml.cpp b/src/output_xhtml.cpp index 50ba0f4..c894f89 100644 --- a/src/output_xhtml.cpp +++ b/src/output_xhtml.cpp @@ -930,6 +930,7 @@ void makeCommand(Buffer const & buf, // Label around sectioning number: // FIXME Probably need to account for LABEL_MANUAL + // FIXME Probably also need now to account for labels ABOVE and CENTERED. if (style.labeltype != LABEL_NO_LABEL) { openLabelTag(xs, style); xs << pbegin->params().labelString(); diff --git a/src/rowpainter.cpp b/src/rowpainter.cpp index 5810fd6..eb3b6f7 100644 --- a/src/rowpainter.cpp +++ b/src/rowpainter.cpp @@ -586,20 +586,14 @@ void RowPainter::paintFirst() } } - bool const is_seq = text_.isFirstInSequence(pit_); + bool const is_first = + text_.isFirstInSequence(pit_) || !layout.isParagraphGroup(); //lyxerr << "paintFirst: " << par_.id() << " is_seq: " << is_seq << endl; - if (layout.labeltype >= LABEL_STATIC - && (layout.labeltype != LABEL_STATIC - || layout.latextype != LATEX_ENVIRONMENT - || is_seq)) { + if (layout.labelIsInline() + && (layout.labeltype != LABEL_STATIC || is_first)) { paintLabel(); - } else if (is_seq - && (layout.labeltype == LABEL_TOP_ENVIRONMENT - || layout.labeltype == LABEL_BIBLIO - || layout.labeltype == LABEL_CENTERED_TOP_ENVIRONMENT)) { - // the labels at the top of an environment. - // More or less for bibliography + } else if (is_first && layout.labelIsAbove()) { paintTopLevelLabel(); } } @@ -683,7 +677,7 @@ void RowPainter::paintTopLevelLabel() + (layout.labelbottomsep * defaultRowHeight())); double x = x_; - if (layout.labeltype == LABEL_CENTERED_TOP_ENVIRONMENT) { + if (layout.labeltype == LABEL_CENTERED) { if (is_rtl) x = leftMargin(); x += (width_ - text_metrics_.rightMargin(pm_) - leftMargin()) / 2; ----------------------------------------------------------------------- Summary of changes: src/Buffer.cpp | 4 ++-- src/Layout.cpp | 36 ++++++++++++++++++------------------ src/Layout.h | 18 ++++++++++++++++++ src/LayoutEnums.h | 6 ++---- src/TextMetrics.cpp | 15 +++++---------- src/output_xhtml.cpp | 1 + src/rowpainter.cpp | 18 ++++++------------ 7 files changed, 52 insertions(+), 46 deletions(-) hooks/post-receive -- The LyX Source Repository
