From 0fb8f3fba12ab9fb395ef40e21b5ba50a5e0b9df Mon Sep 17 00:00:00 2001 From: =?utf8?q?Andr=C3=A9=20P=C3=B6nitz?= Date: Sat, 23 Feb 2008 16:45:38 +0000 Subject: [PATCH] mostly s/Paragraph::layout(...)/Paragraph::setLayout(...)/ git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@23159 a592a061-630c-0410-9148-cb99ea01b6c8 --- src/CutAndPaste.cpp | 20 ++++++++-------- src/Layout.cpp | 9 ++----- src/MenuBackend.cpp | 8 +++---- src/Paragraph.cpp | 15 +++++++++--- src/Paragraph.h | 7 ++++-- src/Text.cpp | 11 ++++----- src/Text3.cpp | 40 +++++++++++++------------------ src/TextClass.cpp | 16 +++++-------- src/TextClass.h | 16 ++++++------- src/TextMetrics.cpp | 8 +++---- src/TocBackend.cpp | 8 +++---- src/frontends/qt4/GuiDocument.cpp | 14 +++++------ src/frontends/qt4/GuiToolbar.cpp | 21 +++++++--------- src/insets/Inset.cpp | 2 +- src/insets/InsetBox.cpp | 2 +- src/insets/InsetCaption.cpp | 2 +- src/insets/InsetCollapsable.cpp | 4 ++-- src/insets/InsetTabular.cpp | 2 +- src/insets/InsetText.cpp | 7 ++---- src/paragraph_funcs.cpp | 14 +++++------ src/rowpainter.cpp | 6 ++--- 21 files changed, 108 insertions(+), 124 deletions(-) diff --git a/src/CutAndPaste.cpp b/src/CutAndPaste.cpp index d2c1e63607..019783f5e6 100644 --- a/src/CutAndPaste.cpp +++ b/src/CutAndPaste.cpp @@ -127,11 +127,11 @@ pasteSelectionHelper(Cursor & cur, ParagraphList const & parlist, // Convert newline to paragraph break in ERT inset. // This should not be here! - if (pars[pit].inInset() && - (pars[pit].inInset()->lyxCode() == ERT_CODE || - pars[pit].inInset()->lyxCode() == LISTINGS_CODE)) { - for (ParagraphList::size_type i = 0; i < insertion.size(); ++i) { - for (pos_type j = 0; j < insertion[i].size(); ++j) { + Inset * inset = pars[pit].inInset(); + if (inset && (inset->lyxCode() == ERT_CODE || + inset->lyxCode() == LISTINGS_CODE)) { + for (size_t i = 0; i != insertion.size(); ++i) { + for (pos_type j = 0; j != insertion[i].size(); ++j) { if (insertion[i].isNewline(j)) { // do not track deletion of newline insertion[i].eraseChar(j, false); @@ -152,7 +152,7 @@ pasteSelectionHelper(Cursor & cur, ParagraphList const & parlist, ParagraphList::iterator const end = insertion.end(); for (ParagraphList::iterator par = insertion.begin(); par != end; ++par) - par->layout(layout); + par->setLayout(layout); } // Make sure there is no class difference. @@ -421,9 +421,9 @@ void switchBetweenClasses(TextClassIndex const & oldtcindex, bool hasLayout = newtc.hasLayout(name); if (hasLayout) - it->layout(newtc[name]); + it->setLayout(newtc[name]); else - it->layout(newtc.defaultLayout()); + it->setLayout(newtc.defaultLayout()); if (!hasLayout && name != oldtc.defaultLayoutName()) { docstring const s = bformat( @@ -621,7 +621,7 @@ void copySelectionToStack(Cursor & cur, CutStack & cutstack) ParagraphList pars; Paragraph par; BufferParams const & bp = cur.buffer().params(); - par.layout(bp.textClass().defaultLayout()); + par.setLayout(bp.textClass().defaultLayout()); par.insert(0, grabSelection(cur), Font(), Change(Change::UNCHANGED)); pars.push_back(par); cutstack.push(make_pair(pars, bp.textClassIndex())); @@ -648,7 +648,7 @@ void copySelection(Cursor & cur, docstring const & plaintext) ParagraphList pars; Paragraph par; BufferParams const & bp = cur.buffer().params(); - par.layout(bp.textClass().defaultLayout()); + par.setLayout(bp.textClass().defaultLayout()); par.insert(0, plaintext, Font(), Change(Change::UNCHANGED)); pars.push_back(par); theCuts.push(make_pair(pars, bp.textClassIndex())); diff --git a/src/Layout.cpp b/src/Layout.cpp index c29f0bd1f8..7fedb3209c 100644 --- a/src/Layout.cpp +++ b/src/Layout.cpp @@ -223,14 +223,9 @@ bool Layout::read(Lexer & lexrc, TextClass const & tclass) << to_utf8(style) << "'\n" << "All layouts so far:" << endl; - TextClass::const_iterator it = - tclass.begin(); - TextClass::const_iterator end = - tclass.end(); - for (; it != end; ++it) { - lyxerr << to_utf8((*it)->name()) + for (size_t i = 0; i != tclass.layoutCount(); ++i) + lyxerr << to_utf8(tclass.layout(i)->name()) << endl; - } //lexrc.printError("Cannot copy known " // "style `$$Token'"); diff --git a/src/MenuBackend.cpp b/src/MenuBackend.cpp index 8d11cc4577..fce89d6c25 100644 --- a/src/MenuBackend.cpp +++ b/src/MenuBackend.cpp @@ -640,10 +640,10 @@ void expandFlexInsert(Menu & tomenu, Buffer const * buf, string s) FuncRequest(LFUN_NOACTION))); return; } - InsetLayouts const & insetlayouts = - buf->params().textClass().insetlayouts(); - InsetLayouts::const_iterator cit = insetlayouts.begin(); - InsetLayouts::const_iterator end = insetlayouts.end(); + InsetLayouts const & insetLayouts = + buf->params().textClass().insetLayouts(); + InsetLayouts::const_iterator cit = insetLayouts.begin(); + InsetLayouts::const_iterator end = insetLayouts.end(); for (; cit != end; ++cit) { docstring const label = cit->first; if (cit->second.lyxtype() == s) diff --git a/src/Paragraph.cpp b/src/Paragraph.cpp index 2ab9a61a81..293a62e8c8 100644 --- a/src/Paragraph.cpp +++ b/src/Paragraph.cpp @@ -1473,7 +1473,7 @@ char Paragraph::getAlign() const } -docstring const & Paragraph::getLabelstring() const +docstring const & Paragraph::labelString() const { return d->params_.labelString(); } @@ -2334,9 +2334,18 @@ LayoutPtr const & Paragraph::layout() const } -void Paragraph::layout(LayoutPtr const & new_layout) +void Paragraph::setLayout(LayoutPtr const & layout) { - d->layout_ = new_layout; + d->layout_ = layout; +} + + +void Paragraph::setEmptyOrDefaultLayout(TextClass const & tclass) +{ + if (useEmptyLayout()) + setLayout(tclass.emptyLayout()); + else + setLayout(tclass.defaultLayout()); } diff --git a/src/Paragraph.h b/src/Paragraph.h index e00f644f15..3c9e533562 100644 --- a/src/Paragraph.h +++ b/src/Paragraph.h @@ -43,6 +43,7 @@ class MetricsInfo; class OutputParams; class PainterInfo; class ParagraphParameters; +class TextClass; class TexRow; @@ -158,7 +159,9 @@ public: /// LayoutPtr const & layout() const; /// - void layout(LayoutPtr const & new_layout); + void setLayout(LayoutPtr const & layout); + /// + void setEmptyOrDefaultLayout(TextClass const & tc); /// This is the item depth, only used by enumerate and itemize signed char itemdepth; @@ -201,7 +204,7 @@ public: void setBeginOfBody(); /// - docstring const & getLabelstring() const; + docstring const & labelString() const; /// the next two functions are for the manual labels docstring const getLabelWidthString() const; diff --git a/src/Text.cpp b/src/Text.cpp index 8422e43425..456584b8c7 100644 --- a/src/Text.cpp +++ b/src/Text.cpp @@ -125,12 +125,12 @@ void readParToken(Buffer const & buf, Paragraph & par, Lexer & lex, tclass.defaultLayoutName(); } - par.layout(bp.textClass()[layoutname]); + par.setLayout(bp.textClass()[layoutname]); // Test whether the layout is obsolete. LayoutPtr const & layout = par.layout(); if (!layout->obsoleted_by().empty()) - par.layout(bp.textClass()[layout->obsoleted_by()]); + par.setLayout(bp.textClass()[layout->obsoleted_by()]); par.params().read(lex); @@ -340,8 +340,7 @@ bool Text::empty() const } -double Text::spacing(Buffer const & buffer, - Paragraph const & par) const +double Text::spacing(Buffer const & buffer, Paragraph const & par) const { if (par.params().spacing().isDefault()) return buffer.params().spacing().getValue(); @@ -929,9 +928,9 @@ bool Text::handleBibitems(Cursor & cur) // otherwise reset to default if (par.useEmptyLayout()) - cur.paragraph().layout(bufparams.textClass().emptyLayout()); + cur.paragraph().setLayout(bufparams.textClass().emptyLayout()); else - cur.paragraph().layout(bufparams.textClass().defaultLayout()); + cur.paragraph().setLayout(bufparams.textClass().defaultLayout()); return true; } diff --git a/src/Text3.cpp b/src/Text3.cpp index 62e9129cbd..4be361630a 100644 --- a/src/Text3.cpp +++ b/src/Text3.cpp @@ -219,10 +219,8 @@ static bool doInsertInset(Cursor & cur, Text * text, InsetText * insetText = dynamic_cast(inset); if (insetText && !insetText->allowMultiPar() || cur.lastpit() == 0) { // reset first par to default - LayoutPtr const layout = insetText->useEmptyLayout() - ? bparams.textClass().emptyLayout() - : bparams.textClass().defaultLayout(); - cur.text()->paragraphs().begin()->layout(layout); + cur.text()->paragraphs().begin() + ->setEmptyOrDefaultLayout(bparams.textClass()); cur.pos() = 0; cur.pit() = 0; // Merge multiple paragraphs -- hack @@ -268,8 +266,7 @@ static void outline(OutlineOp mode, Cursor & cur) ParagraphList::iterator finish = start; ParagraphList::iterator end = pars.end(); - TextClass::const_iterator lit = buf.params().textClass().begin(); - TextClass::const_iterator const lend = buf.params().textClass().end(); + TextClass const & tc = buf.params().textClass(); int const thistoclevel = start->layout()->toclevel; int toclevel; @@ -344,20 +341,22 @@ static void outline(OutlineOp mode, Cursor & cur) } case OutlineIn: buf.undo().recordUndo(cur); - for (; lit != lend; ++lit) { - if ((*lit)->toclevel == thistoclevel + 1 && - start->layout()->labeltype == (*lit)->labeltype) { - start->layout((*lit)); + for (size_t i = 0; i != tc.layoutCount(); ++i) { + LayoutPtr const & lt = tc.layout(i); + if (lt->toclevel == thistoclevel + 1 && + start->layout()->labeltype == lt->labeltype) { + start->setLayout(lt); break; } } break; case OutlineOut: buf.undo().recordUndo(cur); - for (; lit != lend; ++lit) { - if ((*lit)->toclevel == thistoclevel - 1 && - start->layout()->labeltype == (*lit)->labeltype) { - start->layout((*lit)); + for (size_t i = 0; i != tc.layoutCount(); ++i) { + LayoutPtr const & lt = tc.layout(i); + if (lt->toclevel == thistoclevel - 1 && + start->layout()->labeltype == lt->labeltype) { + start->setLayout(lt); break; } } @@ -1390,11 +1389,7 @@ void Text::dispatch(Cursor & cur, FuncRequest & cmd) // add a separate paragraph for the caption inset pars.push_back(Paragraph()); pars.back().setInsetOwner(pars[0].inInset()); - if (pars.back().useEmptyLayout()) - pars.back().layout(tclass.emptyLayout()); - else - pars.back().layout(tclass.defaultLayout()); - + pars.back().setEmptyOrDefaultLayout(tclass); int cap_pit = pars.size() - 1; // if an empty inset was created, we create an additional empty @@ -1403,10 +1398,7 @@ void Text::dispatch(Cursor & cur, FuncRequest & cmd) if (!content) { pars.push_back(Paragraph()); pars.back().setInsetOwner(pars[0].inInset()); - if (pars.back().useEmptyLayout()) - pars.back().layout(tclass.emptyLayout()); - else - pars.back().layout(tclass.defaultLayout()); + pars.back().setEmptyOrDefaultLayout(tclass); } // reposition the cursor to the caption @@ -1954,7 +1946,7 @@ bool Text::getStatus(Cursor & cur, FuncRequest const & cmd, case LFUN_FLEX_INSERT: { code = FLEX_CODE; string s = cmd.getArg(0); - InsetLayout il = cur.buffer().params().textClass().insetlayout(from_utf8(s)); + InsetLayout il = cur.buffer().params().textClass().insetLayout(from_utf8(s)); if (il.lyxtype() != "charstyle" && il.lyxtype() != "custom" && il.lyxtype() != "element" && diff --git a/src/TextClass.cpp b/src/TextClass.cpp index c5dcd2ec13..4df69a680c 100644 --- a/src/TextClass.cpp +++ b/src/TextClass.cpp @@ -539,18 +539,14 @@ bool TextClass::read(FileName const & filename, ReadType rt) min_toclevel_ = Layout::NOT_IN_TOC; max_toclevel_ = Layout::NOT_IN_TOC; - const_iterator cit = begin(); - const_iterator the_end = end(); - for ( ; cit != the_end ; ++cit) { - int const toclevel = (*cit)->toclevel; + for (size_t i = 0; i != layoutCount(); ++i) { + int const toclevel = layout(i)->toclevel; if (toclevel != Layout::NOT_IN_TOC) { if (min_toclevel_ == Layout::NOT_IN_TOC) min_toclevel_ = toclevel; else - min_toclevel_ = min(min_toclevel_, - toclevel); - max_toclevel_ = max(max_toclevel_, - toclevel); + min_toclevel_ = min(min_toclevel_, toclevel); + max_toclevel_ = max(max_toclevel_, toclevel); } } LYXERR(Debug::TCLASS, "Minimum TocLevel is " << min_toclevel_ @@ -978,13 +974,13 @@ Counters & TextClass::counters() const // will invoke the layout object defined by name = 'CharStyle'. // If that doesn't work either, an empty object returns (shouldn't // happen). -- Idea JMarc, comment MV -InsetLayout const & TextClass::insetlayout(docstring const & name) const +InsetLayout const & TextClass::insetLayout(docstring const & name) const { docstring n = name; while (!n.empty()) { if (insetlayoutlist_.count(n) > 0) return insetlayoutlist_[n]; - docstring::size_type i = n.find(':'); + size_t i = n.find(':'); if (i == string::npos) break; n = n.substr(0,i); diff --git a/src/TextClass.h b/src/TextClass.h index c29011ae1e..db5906493d 100644 --- a/src/TextClass.h +++ b/src/TextClass.h @@ -58,8 +58,6 @@ class TextClass { public: /// The individual styles comprising the document class typedef std::vector LayoutList; - /// Enumerate the paragraph styles. - typedef LayoutList::const_iterator const_iterator; /// Construct a layout with default values. Actual values loaded later. explicit TextClass(std::string const & = std::string(), @@ -70,12 +68,12 @@ public: /// check whether the TeX class is available bool isTeXClassAvailable() const; - /// paragraph styles begin iterator. - const_iterator begin() const { return layoutlist_.begin(); } - /// paragraph styles end iterator - const_iterator end() const { return layoutlist_.end(); } + /// Enumerate the paragraph styles. + size_t layoutCount() const { return layoutlist_.size(); } + /// Access the paragraph styles. + LayoutPtr const & layout(size_t index) const { return layoutlist_[index]; } - ///Enum used with TextClass::read + /// Enum used with TextClass::read enum ReadType { BASECLASS, //>This is a base class, i.e., top-level layout file MERGE, //>This is a file included in a layout file @@ -116,9 +114,9 @@ public: /// The Counters present in this document class. Counters & counters() const; /// Inset layouts of this doc class - InsetLayouts & insetlayouts() const { return insetlayoutlist_; }; + InsetLayouts & insetLayouts() const { return insetlayoutlist_; }; /// - InsetLayout const & insetlayout(docstring const & name) const; + InsetLayout const & insetLayout(docstring const & name) const; /// docstring const & defaultLayoutName() const; /// diff --git a/src/TextMetrics.cpp b/src/TextMetrics.cpp index 588971a0c9..126e4a8422 100644 --- a/src/TextMetrics.cpp +++ b/src/TextMetrics.cpp @@ -998,7 +998,7 @@ Dimension TextMetrics::rowHeight(pit_type const pit, pos_type const first, || layout->labeltype == LABEL_BIBLIO || layout->labeltype == LABEL_CENTERED_TOP_ENVIRONMENT) && isFirstInSequence(pit, pars) - && !par.getLabelstring().empty()) + && !par.labelString().empty()) { labeladdon = int( labelfont_metrics.maxHeight() @@ -1810,9 +1810,9 @@ int TextMetrics::leftMargin(int max_width, l_margin += theFontMetrics(buffer.params().getFont()).signedWidth( layout->leftmargin); } - if (!par.getLabelstring().empty()) { + if (!par.labelString().empty()) { l_margin += labelfont_metrics.signedWidth(layout->labelindent); - l_margin += labelfont_metrics.width(par.getLabelstring()); + l_margin += labelfont_metrics.width(par.labelString()); l_margin += labelfont_metrics.width(layout->labelsep); } break; @@ -1856,7 +1856,7 @@ int TextMetrics::leftMargin(int max_width, LABEL_CENTERED_TOP_ENVIRONMENT) { l_margin += labelfont_metrics.signedWidth(layout->labelindent); l_margin += labelfont_metrics.width(layout->labelsep); - l_margin += labelfont_metrics.width(par.getLabelstring()); + l_margin += labelfont_metrics.width(par.labelString()); } break; diff --git a/src/TocBackend.cpp b/src/TocBackend.cpp index cf40c4f818..00a55a9870 100644 --- a/src/TocBackend.cpp +++ b/src/TocBackend.cpp @@ -125,8 +125,8 @@ void TocBackend::updateItem(ParConstIterator const & par_it) break; Paragraph const & par = *static_cast(inset).paragraphs().begin(); - if (!toc_item->par_it_->getLabelstring().empty()) - tocstring = toc_item->par_it_->getLabelstring() + ' '; + if (!toc_item->par_it_->labelString().empty()) + tocstring = toc_item->par_it_->labelString() + ' '; tocstring += par.asString(*buffer_, false); break; } @@ -169,8 +169,8 @@ void TocBackend::update() break; Paragraph const & par = *static_cast(inset).paragraphs().begin(); - if (!pit->getLabelstring().empty()) - tocstring = pit->getLabelstring() + ' '; + if (!pit->labelString().empty()) + tocstring = pit->labelString() + ' '; tocstring += par.asString(*buffer_, false); break; } diff --git a/src/frontends/qt4/GuiDocument.cpp b/src/frontends/qt4/GuiDocument.cpp index dcfaf3985f..7ad3bd4f83 100644 --- a/src/frontends/qt4/GuiDocument.cpp +++ b/src/frontends/qt4/GuiDocument.cpp @@ -518,7 +518,7 @@ GuiDocument::GuiDocument(GuiView & lv) this, SLOT(change_adaptor())); connect(textLayoutModule->lspacingCO, SIGNAL(activated(int)), this, SLOT(setLSpacing(int))); - connect(textLayoutModule->lspacingLE, SIGNAL(textChanged(const QString&)), + connect(textLayoutModule->lspacingLE, SIGNAL(textChanged(const QString &)), this, SLOT(change_adaptor())); connect(textLayoutModule->skipRB, SIGNAL(clicked()), this, SLOT(change_adaptor())); @@ -1363,15 +1363,13 @@ void GuiDocument::updateNumbering() int const toc = numberingModule->tocSL->value(); QString const no = qt_("No"); QString const yes = qt_("Yes"); - TextClass::const_iterator end = tclass.end(); - TextClass::const_iterator cit = tclass.begin(); QTreeWidgetItem * item = 0; - for ( ; cit != end ; ++cit) { - int const toclevel = (*cit)->toclevel; - if (toclevel != Layout::NOT_IN_TOC - && (*cit)->labeltype == LABEL_COUNTER) { + for (size_t i = 0; i != tclass.layoutCount(); ++i) { + Layout const & lt = *tclass.layout(i); + int const toclevel = lt.toclevel; + if (toclevel != Layout::NOT_IN_TOC && lt.labeltype == LABEL_COUNTER) { item = new QTreeWidgetItem(numberingModule->tocTW); - item->setText(0, toqstr(translateIfPossible((*cit)->name()))); + item->setText(0, toqstr(translateIfPossible(lt.name()))); item->setText(1, (toclevel <= depth) ? yes : no); item->setText(2, (toclevel <= toc) ? yes : no); } diff --git a/src/frontends/qt4/GuiToolbar.cpp b/src/frontends/qt4/GuiToolbar.cpp index 8cf7b87a85..ab61ce352a 100644 --- a/src/frontends/qt4/GuiToolbar.cpp +++ b/src/frontends/qt4/GuiToolbar.cpp @@ -323,11 +323,10 @@ void GuiLayoutBox::updateContents(bool reset) text_class_ = text_class; clear(); - TextClass::const_iterator it = text_class_->begin(); - TextClass::const_iterator const end = text_class_->end(); - for (; it != end; ++it) { - docstring const & name = (*it)->name(); + for (size_t i = 0; i != text_class_->layoutCount(); ++i) { + Layout const & lt = *text_class_->layout(i); + docstring const & name = lt.name(); // if this inset requires the empty layout, we skip the default // layout if (name == text_class_->defaultLayoutName() && inset && @@ -359,14 +358,12 @@ void GuiLayoutBox::selected(const QString & str) return; docstring const name = qstring_to_ucs4(str); - TextClass::const_iterator it = text_class_->begin(); - TextClass::const_iterator const end = text_class_->end(); - for (; it != end; ++it) { - docstring const & itname = (*it)->name(); - //FIXME Comparing translated strings is not ideal. - //This should be done the way module names are handled - //in GuiDocument: viz, the untranslated name should be - //associated with the item via QComboBox::setItemData(). + for (size_t i = 0; i != text_class_->layoutCount(); ++i) { + docstring const & itname = text_class_->layout(i)->name(); + // FIXME: Comparing translated strings is not ideal. + // This should be done the way module names are handled + // in GuiDocument: viz, the untranslated name should be + // associated with the item via QComboBox::setItemData(). if (translateIfPossible(itname) == name) { FuncRequest const func(LFUN_LAYOUT, itname, FuncRequest::TOOLBAR); diff --git a/src/insets/Inset.cpp b/src/insets/Inset.cpp index 778000d806..ed94df8ae3 100644 --- a/src/insets/Inset.cpp +++ b/src/insets/Inset.cpp @@ -361,7 +361,7 @@ bool Inset::covers(BufferView const & bv, int x, int y) const InsetLayout const & Inset::getLayout(BufferParams const & bp) const { - return bp.textClass().insetlayout(name()); + return bp.textClass().insetLayout(name()); } diff --git a/src/insets/InsetBox.cpp b/src/insets/InsetBox.cpp index 45ee674d9a..71620c3213 100644 --- a/src/insets/InsetBox.cpp +++ b/src/insets/InsetBox.cpp @@ -89,7 +89,7 @@ InsetBox::InsetBox(BufferParams const & bp, string const & label) : InsetCollapsable(bp), params_(label) { if (forceEmptyLayout()) - paragraphs().back().layout(bp.textClass().emptyLayout()); + paragraphs().back().setLayout(bp.textClass().emptyLayout()); } diff --git a/src/insets/InsetCaption.cpp b/src/insets/InsetCaption.cpp index ae240d7019..ae9e9eb5ec 100644 --- a/src/insets/InsetCaption.cpp +++ b/src/insets/InsetCaption.cpp @@ -64,7 +64,7 @@ InsetCaption::InsetCaption(BufferParams const & bp) setFrameColor(Color_captionframe); //FIXME Do we need to set all paragraphs here? or will there //always only be one? - paragraphs().back().layout(bp.textClass().emptyLayout()); + paragraphs().back().setLayout(bp.textClass().emptyLayout()); } diff --git a/src/insets/InsetCollapsable.cpp b/src/insets/InsetCollapsable.cpp index 96f6765195..e35f18906b 100644 --- a/src/insets/InsetCollapsable.cpp +++ b/src/insets/InsetCollapsable.cpp @@ -87,7 +87,7 @@ InsetCollapsable::InsetCollapsable(BufferParams const & bp, setAutoBreakRows(true); setDrawFrame(true); setFrameColor(Color_collapsableframe); - paragraphs().back().layout(bp.textClass().emptyLayout()); + paragraphs().back().setLayout(bp.textClass().emptyLayout()); } @@ -134,7 +134,7 @@ void InsetCollapsable::setLayout(TextClassIndex tcindex) { textClass_ = tcindex; if (tcindex != TextClassIndex(-1)) { - layout_ = &textclasslist[tcindex].insetlayout(name()); + layout_ = &textclasslist[tcindex].insetLayout(name()); labelstring_ = layout_->labelstring(); } else { layout_ = &TextClass::emptyInsetLayout(); diff --git a/src/insets/InsetTabular.cpp b/src/insets/InsetTabular.cpp index 658fa3e4fd..35ca668d19 100644 --- a/src/insets/InsetTabular.cpp +++ b/src/insets/InsetTabular.cpp @@ -486,7 +486,7 @@ Tabular::cellstruct::cellstruct(BufferParams const & bp) rotate(false), inset(new InsetText(bp)) { - inset->paragraphs().back().layout(bp.textClass().emptyLayout()); + inset->paragraphs().back().setLayout(bp.textClass().emptyLayout()); } diff --git a/src/insets/InsetText.cpp b/src/insets/InsetText.cpp index 4ef8c94128..4bb85a9064 100644 --- a/src/insets/InsetText.cpp +++ b/src/insets/InsetText.cpp @@ -100,10 +100,7 @@ InsetText::InsetText(BufferParams const & bp) { paragraphs().push_back(Paragraph()); Paragraph & ourpar = paragraphs().back(); - if (useEmptyLayout()) - ourpar.layout(bp.textClass().emptyLayout()); - else - ourpar.layout(bp.textClass().defaultLayout()); + ourpar.setEmptyOrDefaultLayout(bp.textClass()); ourpar.setInsetOwner(this); } @@ -140,7 +137,7 @@ void InsetText::clear() pars.clear(); pars.push_back(Paragraph()); pars.begin()->setInsetOwner(this); - pars.begin()->layout(old_layout); + pars.begin()->setLayout(old_layout); } diff --git a/src/paragraph_funcs.cpp b/src/paragraph_funcs.cpp index c4d70e415a..2b2f5ab183 100644 --- a/src/paragraph_funcs.cpp +++ b/src/paragraph_funcs.cpp @@ -77,18 +77,18 @@ void breakParagraph(BufferParams const & bparams, // without doing that we get a crash when typing at the // end of a paragraph if (par.useEmptyLayout()) - tmp->layout(bparams.textClass().emptyLayout()); + tmp->setLayout(bparams.textClass().emptyLayout()); else - tmp->layout(bparams.textClass().defaultLayout()); + tmp->setLayout(bparams.textClass().defaultLayout()); // layout stays the same with latex-environments if (keep_layout) { - tmp->layout(par.layout()); + tmp->setLayout(par.layout()); tmp->setLabelWidthString(par.params().labelWidthString()); tmp->params().depth(par.params().depth()); } else if (par.params().depth() > 0) { Paragraph const & hook = pars[outerHook(par_offset, pars)]; - tmp->layout(hook.layout()); + tmp->setLayout(hook.layout()); // not sure the line below is useful tmp->setLabelWidthString(par.params().labelWidthString()); tmp->params().depth(hook.params().depth()); @@ -97,7 +97,7 @@ void breakParagraph(BufferParams const & bparams, bool const isempty = (par.allowEmpty() && par.empty()); if (!isempty && (par.size() > pos || par.empty())) { - tmp->layout(par.layout()); + tmp->setLayout(par.layout()); tmp->params().align(par.params().align()); tmp->setLabelWidthString(par.params().labelWidthString()); @@ -144,12 +144,12 @@ void breakParagraph(BufferParams const & bparams, par.params().clear(); // do not lose start of appendix marker (bug 4212) par.params().startOfAppendix(soa); - par.layout(bparams.textClass().defaultLayout()); + par.setLayout(bparams.textClass().defaultLayout()); } // layout stays the same with latex-environments if (keep_layout) { - par.layout(tmp->layout()); + par.setLayout(tmp->layout()); par.setLabelWidthString(tmp->params().labelWidthString()); par.params().depth(tmp->params().depth()); } diff --git a/src/rowpainter.cpp b/src/rowpainter.cpp index eba16563ac..e4e48d6c52 100644 --- a/src/rowpainter.cpp +++ b/src/rowpainter.cpp @@ -505,7 +505,7 @@ void RowPainter::paintFirst() FontInfo const font = getLabelFont(); FontMetrics const & fm = theFontMetrics(font); - docstring const str = par_.getLabelstring(); + docstring const str = par_.labelString(); if (!str.empty()) { double x = x_; @@ -551,8 +551,8 @@ void RowPainter::paintFirst() layout->labeltype == LABEL_BIBLIO || layout->labeltype == LABEL_CENTERED_TOP_ENVIRONMENT)) { FontInfo const font = getLabelFont(); - if (!par_.getLabelstring().empty()) { - docstring const str = par_.getLabelstring(); + docstring const str = par_.labelString(); + if (!str.empty()) { double spacing_val = 1.0; if (!parparams.spacing().isDefault()) spacing_val = parparams.spacing().getValue(); -- 2.39.5