From: Richard Heck Date: Sun, 24 Feb 2008 15:44:11 +0000 (+0000) Subject: More cleanup from Andre. X-Git-Tag: 1.6.10~6119 X-Git-Url: https://git.lyx.org/gitweb/?a=commitdiff_plain;h=c7afa2d6581e350834f39c01ba3ba173a8c2022e;p=features.git More cleanup from Andre. git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@23194 a592a061-630c-0410-9148-cb99ea01b6c8 --- diff --git a/src/BufferParams.cpp b/src/BufferParams.cpp index 0c2d1b4bb6..d037fc67ff 100644 --- a/src/BufferParams.cpp +++ b/src/BufferParams.cpp @@ -1361,12 +1361,12 @@ bool BufferParams::hasClassDefaults() const { TextClass const & tclass = textclasslist[baseClass_]; - return (sides == tclass.sides() + return sides == tclass.sides() && columns == tclass.columns() && pagestyle == tclass.pagestyle() && options == tclass.options() && secnumdepth == tclass.secnumdepth() - && tocdepth == tclass.tocdepth()); + && tocdepth == tclass.tocdepth(); } @@ -1448,13 +1448,15 @@ void BufferParams::makeTextClass() } -vector const & BufferParams::getModules() const { +vector const & BufferParams::getModules() const +{ return layoutModules_; } -bool BufferParams::addLayoutModule(string const & modName) { +bool BufferParams::addLayoutModule(string const & modName) +{ LayoutModuleList::const_iterator it = layoutModules_.begin(); LayoutModuleList::const_iterator end = layoutModules_.end(); for (; it != end; it++) { @@ -1468,7 +1470,8 @@ bool BufferParams::addLayoutModule(string const & modName) { } -void BufferParams::clearLayoutModules() { +void BufferParams::clearLayoutModules() +{ layoutModules_.clear(); } @@ -1516,7 +1519,8 @@ void BufferParams::readLanguage(Lexer & lex) void BufferParams::readGraphicsDriver(Lexer & lex) { - if (!lex.next()) return; + if (!lex.next()) + return; string const tmptok = lex.getString(); // check if tmptok is part of tex_graphics in tex_defs.h @@ -1540,7 +1544,8 @@ void BufferParams::readGraphicsDriver(Lexer & lex) void BufferParams::readBullets(Lexer & lex) { - if (!lex.next()) return; + if (!lex.next()) + return; int const index = lex.getInteger(); lex.next(); @@ -1559,7 +1564,8 @@ void BufferParams::readBullets(Lexer & lex) void BufferParams::readBulletsLaTeX(Lexer & lex) { // The bullet class should be able to read this. - if (!lex.next()) return; + if (!lex.next()) + return; int const index = lex.getInteger(); lex.next(true); docstring const temp_str = lex.getDocString(); diff --git a/src/CutAndPaste.cpp b/src/CutAndPaste.cpp index 96986dd69f..fcf9633520 100644 --- a/src/CutAndPaste.cpp +++ b/src/CutAndPaste.cpp @@ -702,8 +702,7 @@ void pasteParagraphList(Cursor & cur, ParagraphList const & parlist, PitPosPair ppp; boost::tie(ppp, endpit) = - pasteSelectionHelper(cur, parlist, - textclass, errorList); + pasteSelectionHelper(cur, parlist, textclass, errorList); updateLabels(cur.buffer()); cur.clearSelection(); text->setCursor(cur, ppp.first, ppp.second); @@ -765,7 +764,7 @@ void pasteClipboardText(Cursor & cur, ErrorList & errorList, bool asParagraphs) } -void pasteClipboardGraphics(Cursor & cur, ErrorList & errorList, +void pasteClipboardGraphics(Cursor & cur, ErrorList & /* errorList */, Clipboard::GraphicsType preferedType) { BOOST_ASSERT(theClipboard().hasGraphicsContents(preferedType)); diff --git a/src/MenuBackend.cpp b/src/MenuBackend.cpp index 05aa0b461d..fce89d6c25 100644 --- a/src/MenuBackend.cpp +++ b/src/MenuBackend.cpp @@ -598,8 +598,7 @@ void expandFloatListInsert(Menu & tomenu, Buffer const * buf) return; } - FloatList const & floats = - buf->params().textClass().floats(); + FloatList const & floats = buf->params().textClass().floats(); FloatList::const_iterator cit = floats.begin(); FloatList::const_iterator end = floats.end(); for (; cit != end; ++cit) { @@ -620,8 +619,7 @@ void expandFloatInsert(Menu & tomenu, Buffer const * buf) return; } - FloatList const & floats = - buf->params().textClass().floats(); + FloatList const & floats = buf->params().textClass().floats(); FloatList::const_iterator cit = floats.begin(); FloatList::const_iterator end = floats.end(); for (; cit != end; ++cit) { diff --git a/src/Paragraph.cpp b/src/Paragraph.cpp index ee1a3ba849..5d773ee34c 100644 --- a/src/Paragraph.cpp +++ b/src/Paragraph.cpp @@ -1817,11 +1817,10 @@ bool Paragraph::latex(Buffer const & buf, // to be valid! bool asdefault = forceEmptyLayout(); - if (asdefault) { + if (asdefault) style = bparams.textClass().defaultLayout(); - } else { + else style = d->layout_; - } // Current base font for all inherited font changes, without any // change caused by an individual character, except for the language: diff --git a/src/ParagraphMetrics.cpp b/src/ParagraphMetrics.cpp index 77519e7673..b249f01d9b 100644 --- a/src/ParagraphMetrics.cpp +++ b/src/ParagraphMetrics.cpp @@ -62,9 +62,9 @@ using namespace lyx::support; namespace lyx { -ParagraphMetrics::ParagraphMetrics(Paragraph const & par): position_(-1), par_(&par) -{ -} +ParagraphMetrics::ParagraphMetrics(Paragraph const & par) : + position_(-1), par_(&par) +{} ParagraphMetrics & ParagraphMetrics::operator=( diff --git a/src/TocBackend.cpp b/src/TocBackend.cpp index 4c5bdb00f3..10a1a931c0 100644 --- a/src/TocBackend.cpp +++ b/src/TocBackend.cpp @@ -133,8 +133,7 @@ void TocBackend::updateItem(ParConstIterator const & par_it) } int const toclevel = toc_item->par_it_->layout()->toclevel; - if (toclevel != Layout::NOT_IN_TOC - && toclevel >= min_toclevel + if (toclevel != Layout::NOT_IN_TOC && toclevel >= min_toclevel && tocstring.empty()) tocstring = toc_item->par_it_->asString(*buffer_, true); diff --git a/src/frontends/qt4/Dialog.cpp b/src/frontends/qt4/Dialog.cpp index de358a63c0..2be31a4ffc 100644 --- a/src/frontends/qt4/Dialog.cpp +++ b/src/frontends/qt4/Dialog.cpp @@ -25,6 +25,8 @@ #include #include +#include + #include using namespace std; diff --git a/src/frontends/qt4/GuiDocument.cpp b/src/frontends/qt4/GuiDocument.cpp index 6adc1f52e9..163d591f3e 100644 --- a/src/frontends/qt4/GuiDocument.cpp +++ b/src/frontends/qt4/GuiDocument.cpp @@ -1230,8 +1230,8 @@ void GuiDocument::classChanged() namespace { - //This is an insanely complicated attempt to make this sort of thing - //work with RTL languages. + // This is an insanely complicated attempt to make this sort of thing + // work with RTL languages. docstring formatStrVec(vector const & v, docstring const & s) { //this mess formats the list as "v[0], v[1], ..., [s] v[n]" diff --git a/src/frontends/qt4/GuiToolbars.h b/src/frontends/qt4/GuiToolbars.h index d7015c8eb9..0b9d23cb3a 100644 --- a/src/frontends/qt4/GuiToolbars.h +++ b/src/frontends/qt4/GuiToolbars.h @@ -93,4 +93,4 @@ private: } // namespace frontend } // namespace lyx -#endif // NOT GUI_TOOLBARS_H +#endif // GUI_TOOLBARS_H diff --git a/src/insets/InsetCollapsable.cpp b/src/insets/InsetCollapsable.cpp index cb68250b29..60b864f32c 100644 --- a/src/insets/InsetCollapsable.cpp +++ b/src/insets/InsetCollapsable.cpp @@ -110,7 +110,7 @@ docstring InsetCollapsable::toolTip(BufferView const & bv, int x, int y) const Dimension dim = dimensionCollapsed(); if (geometry() == NoButton) return layout_->labelstring(); - else if (x > xo(bv) + dim.wid || y > yo(bv) + dim.des) + if (x > xo(bv) + dim.wid || y > yo(bv) + dim.des) return docstring(); switch (status_) { @@ -188,7 +188,7 @@ void InsetCollapsable::read(Buffer const & buf, Lexer & lex) lex.pushToken(token); } } - //this must be set before we enter InsetText::read() + // this must be set before we enter InsetText::read() setLayout(buf.params()); InsetText::read(buf, lex); @@ -254,8 +254,7 @@ void InsetCollapsable::metrics(MetricsInfo & mi, Dimension & dim) const case LeftButton: case ButtonOnly: dim = dimensionCollapsed(); - if (geometry() == TopButton - || geometry() == LeftButton) { + if (geometry() == TopButton || geometry() == LeftButton) { Dimension textdim; InsetText::metrics(mi, textdim); openinlined_ = (textdim.wid + dim.wid) < mi.base.textwidth; @@ -749,11 +748,11 @@ bool InsetCollapsable::getStatus(Cursor & cur, FuncRequest const & cmd, case LFUN_TABULAR_INSERT: case LFUN_TOC_INSERT: case LFUN_WRAP_INSERT: - if (layout_->isPassThru()) { - flag.enabled(false); - return true; - } else - return InsetText::getStatus(cur, cmd, flag); + if (layout_->isPassThru()) { + flag.enabled(false); + return true; + } else + return InsetText::getStatus(cur, cmd, flag); case LFUN_INSET_TOGGLE: if (cmd.argument() == "open" || cmd.argument() == "close" || diff --git a/src/output_docbook.cpp b/src/output_docbook.cpp index d024ab1316..fb52f221d8 100644 --- a/src/output_docbook.cpp +++ b/src/output_docbook.cpp @@ -102,16 +102,17 @@ ParagraphList::const_iterator makeParagraph(Buffer const & buf, ParagraphList::const_iterator const & pbegin, ParagraphList::const_iterator const & pend) { - LayoutPtr const & defaultstyle = - buf.params().textClass().defaultLayout(); + LayoutPtr const & defaultstyle = buf.params().textClass().defaultLayout(); for (ParagraphList::const_iterator par = pbegin; par != pend; ++par) { if (par != pbegin) os << '\n'; if (par->layout() == defaultstyle && par->emptyTag()) { - par->simpleDocBookOnePar(buf, os, runparams, outerFont(distance(paragraphs.begin(), par), paragraphs)); + par->simpleDocBookOnePar(buf, os, runparams, + outerFont(distance(paragraphs.begin(), par), paragraphs)); } else { sgml::openTag(buf, os, runparams, *par); - par->simpleDocBookOnePar(buf, os, runparams, outerFont(distance(paragraphs.begin(), par), paragraphs)); + par->simpleDocBookOnePar(buf, os, runparams, + outerFont(distance(paragraphs.begin(), par), paragraphs)); sgml::closeTag(os, *par); } } diff --git a/src/output_latex.cpp b/src/output_latex.cpp index ac906835ed..cdf8a5bb21 100644 --- a/src/output_latex.cpp +++ b/src/output_latex.cpp @@ -109,8 +109,7 @@ TeXEnvironment(Buffer const & buf, BufferParams const & bparams = buf.params(); LayoutPtr const & style = pit->forceEmptyLayout() ? - bparams.textClass().emptyLayout() : - pit->layout(); + bparams.textClass().emptyLayout() : pit->layout(); ParagraphList const & paragraphs = text.paragraphs(); @@ -310,8 +309,7 @@ TeXOnePar(Buffer const & buf, // In an inset with unlimited length (all in one row), // force layout to default LayoutPtr const style = pit->forceEmptyLayout() ? - bparams.textClass().emptyLayout() : - pit->layout(); + bparams.textClass().emptyLayout() : pit->layout(); OutputParams runparams = runparams_in; runparams.moving_arg |= style->needprotect; diff --git a/src/sgml.cpp b/src/sgml.cpp index fcaffdd56a..68d922e76e 100644 --- a/src/sgml.cpp +++ b/src/sgml.cpp @@ -123,7 +123,7 @@ docstring sgml::cleanID(Buffer const & buf, OutputParams const & runparams, // to disable this mangling. TextClass const & tclass = buf.params().textClass(); docstring const allowed = from_ascii( - runparams.flavor == OutputParams::XML? ".-_:":tclass.options()); + runparams.flavor == OutputParams::XML ? ".-_:" : tclass.options()); if (allowed.empty()) return orig; @@ -139,7 +139,7 @@ docstring sgml::cleanID(Buffer const & buf, OutputParams const & runparams, MangledMap::const_iterator const known = mangledNames.find(orig); if (known != mangledNames.end()) - return (*known).second; + return known->second; // make sure it starts with a letter if (!isAlphaASCII(*it) && allowed.find(*it) >= allowed.size())