From 1dc25c472f3001b5e558f6dc4d471d8c4401fb1d Mon Sep 17 00:00:00 2001 From: Jean-Marc Lasgouttes Date: Sun, 21 Jul 2002 21:21:06 +0000 Subject: [PATCH] time to recompile everything: I removed #include directives from headers here and there... Not sure what the net effect is, but it cannot be worse git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@4736 a592a061-630c-0410-9148-cb99ea01b6c8 --- src/BufferView2.C | 1 + src/BufferView_pimpl.C | 7 ++-- src/ChangeLog | 29 +++++++++++++ src/CutAndPaste.C | 6 +-- src/CutAndPaste.h | 5 ++- src/LaTeXFeatures.C | 16 ++++---- src/LaTeXFeatures.h | 3 +- src/buffer.C | 40 +++++++++--------- src/bufferlist.C | 6 +-- src/bufferparams.C | 7 ++++ src/bufferparams.h | 5 ++- src/bufferview_funcs.C | 3 +- src/encoding.C | 1 + src/frontends/ChangeLog | 4 ++ src/frontends/LyXView.C | 3 +- src/frontends/qt2/ChangeLog | 4 ++ src/frontends/qt2/Toolbar_pimpl.C | 7 ++-- src/frontends/xforms/ChangeLog | 7 ++++ src/frontends/xforms/Menubar_pimpl.h | 4 +- src/frontends/xforms/Toolbar_pimpl.C | 9 +++-- src/frontends/xforms/Toolbar_pimpl.h | 5 +-- src/frontends/xforms/forms/form_document.fd | 2 +- src/graphics/ChangeLog | 4 ++ src/graphics/PreviewLoader.C | 3 +- src/insets/ChangeLog | 26 ++++++++++++ src/insets/insetbib.C | 4 +- src/insets/insetert.C | 4 +- src/insets/insetexternal.C | 1 + src/insets/insetfloat.C | 27 +++++++++++++ src/insets/insetfloat.h | 3 ++ src/insets/insetgraphics.C | 1 + src/insets/insetgraphicsParams.C | 2 +- src/insets/insetgraphicsParams.h | 4 +- src/insets/insetinclude.C | 5 +-- src/insets/insetlatexaccent.C | 1 + src/insets/insetlatexaccent.h | 3 +- src/insets/insetquotes.C | 1 + src/insets/insettabular.C | 1 + src/insets/insettext.C | 11 +++-- src/insets/insettext.h | 4 +- src/lyx_cb.C | 1 - src/lyx_main.C | 2 +- src/lyxfunc.h | 4 -- src/lyxrc.C | 6 ++- src/lyxtextclasslist.C | 26 +++++------- src/lyxtextclasslist.h | 8 ++-- src/paragraph.C | 9 ++--- src/paragraph_pimpl.C | 3 +- src/tabular.C | 4 +- src/tabular.h | 3 +- src/text.C | 10 ++--- src/text2.C | 21 ++++------ src/toc.C | 45 +++++---------------- 53 files changed, 244 insertions(+), 177 deletions(-) diff --git a/src/BufferView2.C b/src/BufferView2.C index d299b9f0f6..031f535d9b 100644 --- a/src/BufferView2.C +++ b/src/BufferView2.C @@ -24,6 +24,7 @@ #include "undo_funcs.h" #include "debug.h" #include "iterators.h" +#include "lyxlex.h" #include "frontends/Alert.h" #include "frontends/Dialogs.h" diff --git a/src/BufferView_pimpl.C b/src/BufferView_pimpl.C index 0d745a323d..2483a3aa9c 100644 --- a/src/BufferView_pimpl.C +++ b/src/BufferView_pimpl.C @@ -39,7 +39,6 @@ #include "gettext.h" #include "ParagraphParameters.h" #include "undo_funcs.h" -#include "lyxtextclasslist.h" #include "insets/insetbib.h" #include "insets/insettext.h" @@ -796,7 +795,7 @@ void BufferView::Pimpl::workAreaButtonRelease(int x, int y, // Maybe we want to edit a bibitem ale970302 if (bv_->text->cursor.par()->bibkey) { bool const is_rtl = bv_->text->cursor.par()->isRightToLeftPar(buffer_->params); - int const width = bibitemMaxWidth(bv_, textclasslist[buffer_->params.textclass].defaultfont()); + int const width = bibitemMaxWidth(bv_, buffer_->params.getLyXTextClass().defaultfont()); if ((is_rtl && x > bv_->text->workWidth(bv_)-20-width) || (!is_rtl && x < 20+width)) { bv_->text->cursor.par()->bibkey->edit(bv_, 0, 0, mouse_button::none); @@ -1473,7 +1472,7 @@ bool BufferView::Pimpl::dispatch(kb_action action, string const & argument) lyxerr[Debug::ACTION] << "BufferView::Pimpl::Dispatch: action[" << action <<"] arg[" << argument << "]" << endl; - LyXTextClass const & tclass = textclasslist[buffer_->params.textclass]; + LyXTextClass const & tclass = buffer_->params.getLyXTextClass(); switch (action) { // --- Misc ------------------------------------------- @@ -3319,7 +3318,7 @@ bool BufferView::Pimpl::insertInset(Inset * inset, string const & lout) string lres = lout; LyXTextClass const & tclass = - textclasslist[buffer_->params.textclass]; + buffer_->params.getLyXTextClass(); bool hasLayout = tclass.hasLayout(lres); string lay = tclass.defaultLayoutName(); diff --git a/src/ChangeLog b/src/ChangeLog index 18b28cd34f..228b37eea2 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -4,6 +4,35 @@ 2002-07-21 Jean-Marc Lasgouttes + * lyxrc.C: do not include lyx_main.h + + * LaTeXFeatures.h: use a list instead of a vector + for layouts + + * lyxrc.C: + * encoding.C: + * bufferlist.C: + * BufferView2.C: include "lyxlex.h" + + * tabular.h: + * bufferparams.h: do not #include "lyxlex.h" + + * lyxtextclasslist.C (Add): remove method + (classlist): renamed to classlist_ + + * paragraph_pimpl.C: + * paragraph.C: + * text2.C: + * CutAndPaste.C: + * bufferview_funcs.C: + * bufferlist.C: + * text.C: + * LaTeXFeatures.C: + * buffer.C: + * toc.C (getTocList): use BufferParams::getLyXTextClass + + * toc.C (getTocList): use InsetFloat::addToToc + * toc.[Ch]: new files, containing helper functions to handle table of contents diff --git a/src/CutAndPaste.C b/src/CutAndPaste.C index 9d72add1a8..5b04304927 100644 --- a/src/CutAndPaste.C +++ b/src/CutAndPaste.C @@ -137,7 +137,7 @@ bool CutAndPaste::cutSelection(Paragraph * startpar, Paragraph ** endpar, if (realcut) { buf->params().clear(); buf->bibkey = 0; - buf->layout(textclasslist[current_view->buffer()->params.textclass].defaultLayout()); + buf->layout(current_view->buffer()->params.getLyXTextClass().defaultLayout()); } // paste the paragraphs again, if possible @@ -425,8 +425,8 @@ int CutAndPaste::SwitchLayoutsBetweenClasses(textclass_type c1, + name + _(" to ") + par->layout()->name() + _("\nbecause of class conversion from\n") - + textclasslist[c1].name() + _(" to ") - + textclasslist[c2].name(); + + tclass1.name() + _(" to ") + + tclass2.name(); InsetError * new_inset = new InsetError(s); LyXText * txt = current_view->getLyXText(); LyXCursor cur = txt->cursor; diff --git a/src/CutAndPaste.h b/src/CutAndPaste.h index 4874d1b17d..88a275fd37 100644 --- a/src/CutAndPaste.h +++ b/src/CutAndPaste.h @@ -19,6 +19,7 @@ class Paragraph; class BufferParams; +class LyXTextClass; /// class CutAndPaste { @@ -44,8 +45,8 @@ public: return value is the number of wrong conversions */ static - int SwitchLayoutsBetweenClasses(lyx::textclass_type class1, - lyx::textclass_type class2, + int SwitchLayoutsBetweenClasses(lyx::textclass_type c1, + lyx::textclass_type c2, Paragraph * par, BufferParams const & bparams); /// diff --git a/src/LaTeXFeatures.C b/src/LaTeXFeatures.C index df738be2c2..363fd12334 100644 --- a/src/LaTeXFeatures.C +++ b/src/LaTeXFeatures.C @@ -19,7 +19,6 @@ #include "lyx_sty.h" #include "lyxrc.h" #include "bufferparams.h" -#include "lyxtextclasslist.h" #include "FloatList.h" #include "language.h" #include "encoding.h" @@ -32,7 +31,6 @@ using lyx::textclass_type; using std::endl; using std::set; -using std::vector; using std::find; using std::ostream; @@ -63,11 +61,11 @@ void LaTeXFeatures::useLayout(string const & layoutname) return; } - LyXTextClass tclass = textclasslist[params.textclass]; + LyXTextClass tclass = params.getLyXTextClass(); if (tclass.hasLayout(layoutname)) { // Is this layout already in usedLayouts? - vector::const_iterator cit = usedLayouts.begin(); - vector::const_iterator end = usedLayouts.end(); + list::const_iterator cit = usedLayouts.begin(); + list::const_iterator end = usedLayouts.end(); for (; cit != end; ++cit) { if (layoutname == *cit) return; @@ -185,7 +183,7 @@ const int nb_simplefeatures = sizeof(simplefeatures) / sizeof(char const *); string const LaTeXFeatures::getPackages() const { ostringstream packages; - LyXTextClass const & tclass = textclasslist[params.textclass]; + LyXTextClass const & tclass = params.getLyXTextClass(); // @@ -365,13 +363,13 @@ string const LaTeXFeatures::getBabelOptions() const string const LaTeXFeatures::getTClassPreamble() const { // the text class specific preamble - LyXTextClass const & tclass = textclasslist[params.textclass]; + LyXTextClass const & tclass = params.getLyXTextClass(); ostringstream tcpreamble; tcpreamble << tclass.preamble(); - vector::const_iterator cit = usedLayouts.begin(); - vector::const_iterator end = usedLayouts.end(); + list::const_iterator cit = usedLayouts.begin(); + list::const_iterator end = usedLayouts.end(); for (; cit != end; ++cit) { tcpreamble << tclass[*cit]->preamble(); } diff --git a/src/LaTeXFeatures.h b/src/LaTeXFeatures.h index ad9483e377..cfd0b18c01 100644 --- a/src/LaTeXFeatures.h +++ b/src/LaTeXFeatures.h @@ -21,7 +21,6 @@ #include "LString.h" -#include #include #include #include @@ -89,7 +88,7 @@ public: private: string externalPreambles; - std::vector usedLayouts; + std::list usedLayouts; /// Static preamble bits from the external material insets diff --git a/src/buffer.C b/src/buffer.C index 50d669717e..f43f74a704 100644 --- a/src/buffer.C +++ b/src/buffer.C @@ -346,7 +346,7 @@ bool Buffer::readLyXformat2(LyXLex & lex, Paragraph * par) if (!par) { par = new Paragraph; - par->layout(textclasslist[params.textclass].defaultLayout()); + par->layout(params.getLyXTextClass().defaultLayout()); } else { // We are inserting into an existing document users->text->breakParagraph(users); @@ -447,7 +447,7 @@ void Buffer::insertErtContents(Paragraph * par, int & pos, bool set_inactive) last = last->next(); // create the new paragraph after the last one Paragraph * par = new Paragraph(last); - par->layout(textclasslist[params.textclass].defaultLayoutName()); + par->layout(params.getLyXTextClass().defaultLayoutName()); par->setInsetOwner(last->inInset()); // set the contents LyXFont font(LyXFont::ALL_INHERIT, params.language); @@ -542,7 +542,7 @@ Buffer::parseSingleLyXformat2Token(LyXLex & lex, Paragraph *& par, lex.eatLine(); string layoutname = lex.getString(); - LyXTextClass const & tclass = textclasslist[params.textclass]; + LyXTextClass const & tclass = params.getLyXTextClass(); if (layoutname.empty()) { layoutname = tclass.defaultLayoutName(); @@ -626,14 +626,14 @@ Buffer::parseSingleLyXformat2Token(LyXLex & lex, Paragraph *& par, first_par = par; else { par = new Paragraph(par); - par->layout(textclasslist[params.textclass].defaultLayout()); + par->layout(params.getLyXTextClass().defaultLayout()); } pos = 0; - par->layout(textclasslist[params.textclass][layoutname]); + par->layout(params.getLyXTextClass()[layoutname]); // Test whether the layout is obsolete. LyXLayout_ptr const & layout = par->layout(); if (!layout->obsoleted_by().empty()) - par->layout(textclasslist[params.textclass][layout->obsoleted_by()]); + par->layout(params.getLyXTextClass()[layout->obsoleted_by()]); par->params().depth(depth); #ifndef NO_COMPABILITY } else { @@ -642,7 +642,7 @@ Buffer::parseSingleLyXformat2Token(LyXLex & lex, Paragraph *& par, par->layout(layoutname); // Test whether the layout is obsolete. LyXLayout_ptr const & layout = - textclasslist[params.textclass][par->layout()]; + params.getLyXTextClass()[par->layout()]; if (!layout->obsoleted_by().empty()) par->layout(layout->obsoleted_by()); par->params().depth(depth); @@ -902,7 +902,7 @@ Buffer::parseSingleLyXformat2Token(LyXLex & lex, Paragraph *& par, string(_("LyX will not be able to produce output correctly."))); params.textclass = 0; } - if (!textclasslist[params.textclass].load()) { + if (!params.getLyXTextClass().load()) { // if the textclass wasn't loaded properly // we need to either substitute another // or stop loading the file. @@ -910,7 +910,7 @@ Buffer::parseSingleLyXformat2Token(LyXLex & lex, Paragraph *& par, // stop loading... ideas?? ARRae980418 Alert::alert(_("Textclass Loading Error!"), string(_("Can't load textclass ")) + - textclasslist[params.textclass].name(), + params.getLyXTextClass().name(), _("-- substituting default")); params.textclass = 0; } @@ -1367,7 +1367,7 @@ Buffer::parseSingleLyXformat2Token(LyXLex & lex, Paragraph *& par, if (par->params().pextraStartMinipage() && !par->params().pextraHfill()) { Paragraph * p = new Paragraph; - p->layout(textclasslist[params.textclass].defaultLayoutName()); + p->layout(params.getLyXTextClass().defaultLayoutName()); p->previous(parBeforeMinipage); parBeforeMinipage->next(p); @@ -1442,7 +1442,7 @@ Buffer::parseSingleLyXformat2Token(LyXLex & lex, Paragraph *& par, // a sequence of minipages // in its own paragraph. Paragraph * p = new Paragraph; - p->layout(textclasslist[params.textclass].defaultLayoutName()); + p->layout(params.getLyXTextClass().defaultLayoutName()); p->previous(par->previous()); p->next(0); p->params().depth(depth); @@ -2247,7 +2247,7 @@ void Buffer::makeLaTeXFile(ostream & os, os << "\\documentclass"; - LyXTextClass const & tclass = textclasslist[params.textclass]; + LyXTextClass const & tclass = params.getLyXTextClass(); ostringstream options; // the document class options. @@ -2730,31 +2730,31 @@ void Buffer::latexParagraphs(ostream & ofs, Paragraph * par, bool Buffer::isLatex() const { - return textclasslist[params.textclass].outputType() == LATEX; + return params.getLyXTextClass().outputType() == LATEX; } bool Buffer::isLinuxDoc() const { - return textclasslist[params.textclass].outputType() == LINUXDOC; + return params.getLyXTextClass().outputType() == LINUXDOC; } bool Buffer::isLiterate() const { - return textclasslist[params.textclass].outputType() == LITERATE; + return params.getLyXTextClass().outputType() == LITERATE; } bool Buffer::isDocBook() const { - return textclasslist[params.textclass].outputType() == DOCBOOK; + return params.getLyXTextClass().outputType() == DOCBOOK; } bool Buffer::isSGML() const { - LyXTextClass const & tclass = textclasslist[params.textclass]; + LyXTextClass const & tclass = params.getLyXTextClass(); return tclass.outputType() == LINUXDOC || tclass.outputType() == DOCBOOK; @@ -2810,7 +2810,7 @@ void Buffer::makeLinuxDocFile(string const & fname, bool nice, bool body_only) texrow.reset(); - LyXTextClass const & tclass = textclasslist[params.textclass]; + LyXTextClass const & tclass = params.getLyXTextClass(); string top_element = tclass.latexname(); @@ -3267,7 +3267,7 @@ void Buffer::makeDocBookFile(string const & fname, bool nice, bool only_body) texrow.reset(); - LyXTextClass const & tclass = textclasslist[params.textclass]; + LyXTextClass const & tclass = params.getLyXTextClass(); string top_element = tclass.latexname(); if (!only_body) { @@ -3671,7 +3671,7 @@ int Buffer::runChktex() void Buffer::validate(LaTeXFeatures & features) const { Paragraph * par = paragraph; - LyXTextClass const & tclass = textclasslist[params.textclass]; + LyXTextClass const & tclass = params.getLyXTextClass(); // AMS Style is at document level if (params.use_amsmath || tclass.provides(LyXTextClass::amsmath)) diff --git a/src/bufferlist.C b/src/bufferlist.C index d3e14cb2a2..3766b37cc6 100644 --- a/src/bufferlist.C +++ b/src/bufferlist.C @@ -31,7 +31,7 @@ #include "frontends/LyXView.h" #include "vc-backend.h" #include "TextCache.h" -#include "lyxtextclasslist.h" +#include "lyxlex.h" #include "frontends/Alert.h" @@ -477,11 +477,11 @@ Buffer * BufferList::newFile(string const & name, string tname, bool isNamed) MakeDisplayPath(tname)); // no template, start with empty buffer b->paragraph = new Paragraph; - b->paragraph->layout(textclasslist[b->params.textclass].defaultLayout()); + b->paragraph->layout(b->params.getLyXTextClass().defaultLayout()); } } else { // start with empty buffer b->paragraph = new Paragraph; - b->paragraph->layout(textclasslist[b->params.textclass].defaultLayout()); + b->paragraph->layout(b->params.getLyXTextClass().defaultLayout()); } if (!isNamed) { diff --git a/src/bufferparams.C b/src/bufferparams.C index b24ee8e69d..0d73595781 100644 --- a/src/bufferparams.C +++ b/src/bufferparams.C @@ -22,6 +22,7 @@ #include "lyxrc.h" #include "language.h" #include "lyxtextclasslist.h" +#include "lyxlex.h" #include "support/lyxlib.h" #include "support/lstrings.h" @@ -233,6 +234,12 @@ bool BufferParams::hasClassDefaults() const } +LyXTextClass const & BufferParams::getLyXTextClass() const +{ + return textclasslist[textclass]; +} + + void BufferParams::readPreamble(LyXLex & lex) { if (lex.getString() != "\\begin_preamble") diff --git a/src/bufferparams.h b/src/bufferparams.h index 811eeede6e..a77fb04c3e 100644 --- a/src/bufferparams.h +++ b/src/bufferparams.h @@ -17,7 +17,6 @@ #endif #include "LString.h" -#include "lyxlex.h" #include "vspace.h" #include "Spacing.h" #include "Bullet.h" @@ -27,7 +26,7 @@ #include - +class LyXLex; struct Language; /** Buffer parameters. @@ -139,6 +138,8 @@ public: string fontsize; /// lyx::textclass_type textclass; + /// + LyXTextClass const & getLyXTextClass() const; /* this are for the PaperLayout */ /// the general papersize (papersize2 or paperpackage diff --git a/src/bufferview_funcs.C b/src/bufferview_funcs.C index d6f804083a..ee43bd9e11 100644 --- a/src/bufferview_funcs.C +++ b/src/bufferview_funcs.C @@ -25,7 +25,6 @@ #include "language.h" #include "gettext.h" #include "ParagraphParameters.h" -#include "lyxtextclasslist.h" #include "frontends/Alert.h" @@ -159,7 +158,7 @@ string const currentState(BufferView * bv) Buffer * buffer = bv->buffer(); LyXFont font = text->real_current_font; LyXFont const & defaultfont = - textclasslist[buffer->params.textclass].defaultfont(); + buffer->params.getLyXTextClass().defaultfont(); font.reduce(defaultfont); state << _("Font:") << ' ' diff --git a/src/encoding.C b/src/encoding.C index 697adab956..71749a8381 100644 --- a/src/encoding.C +++ b/src/encoding.C @@ -15,6 +15,7 @@ #endif #include "encoding.h" +#include "lyxlex.h" #include "debug.h" #ifndef CXX_GLOBAL_CSTD diff --git a/src/frontends/ChangeLog b/src/frontends/ChangeLog index 4c0791d627..7fa1599c48 100644 --- a/src/frontends/ChangeLog +++ b/src/frontends/ChangeLog @@ -1,3 +1,7 @@ +2002-07-21 Jean-Marc Lasgouttes + + * LyXView.C: use BufferParams::getLyXTextClass + 2002-07-21 John Levon * LyXView.C: move autosave connect here diff --git a/src/frontends/LyXView.C b/src/frontends/LyXView.C index ae3ebe0896..65e42cf318 100644 --- a/src/frontends/LyXView.C +++ b/src/frontends/LyXView.C @@ -25,7 +25,6 @@ #include "lyx_cb.h" #include "BufferView.h" #include "bufferview_funcs.h" -#include "lyxtextclasslist.h" #include "Dialogs.h" #include "Toolbar.h" @@ -162,7 +161,7 @@ void LyXView::updateLayoutChoice() // update the layout display if (toolbar_->updateLayoutList(buffer()->params.textclass)) { - current_layout = textclasslist[buffer()->params.textclass].defaultLayoutName(); + current_layout = buffer()->params.getLyXTextClass().defaultLayoutName(); } string const & layout = diff --git a/src/frontends/qt2/ChangeLog b/src/frontends/qt2/ChangeLog index 715831b38e..90fb92768b 100644 --- a/src/frontends/qt2/ChangeLog +++ b/src/frontends/qt2/ChangeLog @@ -1,3 +1,7 @@ +2002-07-21 Jean-Marc Lasgouttes + + * Toolbar_pimpl.C: use BufferParams::getLyXTextClass + 2002-07-21 John Levon * QToc.h: diff --git a/src/frontends/qt2/Toolbar_pimpl.C b/src/frontends/qt2/Toolbar_pimpl.C index a1dc470efb..a22351fecf 100644 --- a/src/frontends/qt2/Toolbar_pimpl.C +++ b/src/frontends/qt2/Toolbar_pimpl.C @@ -18,7 +18,6 @@ #include "FuncStatus.h" #include "BufferView.h" #include "buffer.h" -#include "lyxtextclasslist.h" #include "LyXAction.h" #include "gettext.h" @@ -136,7 +135,7 @@ void Toolbar::Pimpl::button_selected(QToolButton * button) void Toolbar::Pimpl::changed_layout(string const & sel) { LyXTextClass const & tc = - textclasslist[owner_->buffer()->params.textclass]; + owner_->buffer()->params.getLyXTextClass(); LyXTextClass::const_iterator end = tc.end(); for (LyXTextClass::const_iterator cit = tc.begin(); @@ -154,7 +153,7 @@ void Toolbar::Pimpl::changed_layout(string const & sel) void Toolbar::Pimpl::setLayout(string const & layout) { LyXTextClass const & tc = - textclasslist[owner_->buffer()->params.textclass]; + owner_->buffer()->params.getLyXTextClass(); string const & name = _(tc[layout]->name()); @@ -182,7 +181,7 @@ void Toolbar::Pimpl::updateLayoutList(bool force) return; LyXTextClass const & tc = - textclasslist[owner_->buffer()->params.textclass]; + owner_->buffer()->params.getLyXTextClass(); combo_->setUpdatesEnabled(false); diff --git a/src/frontends/xforms/ChangeLog b/src/frontends/xforms/ChangeLog index c0a1d36d49..97f0e28ee8 100644 --- a/src/frontends/xforms/ChangeLog +++ b/src/frontends/xforms/ChangeLog @@ -4,6 +4,13 @@ 2002-07-21 Jean-Marc Lasgouttes + * Menubar_pimpl.h: do not include "MenuBackend.h" and "commandtags.h" + + * Toolbar_pimpl.h: do not include "combox.h", "ToolbarDefaults.h" + and "commandtags.h" + + * Toolbar_pimpl.C: use BufferParams::getLyXTextClass + * FormSendto.C: * FormParagraph.C: * FormMinipage.C: diff --git a/src/frontends/xforms/Menubar_pimpl.h b/src/frontends/xforms/Menubar_pimpl.h index bd5aebcf01..988a37aed8 100644 --- a/src/frontends/xforms/Menubar_pimpl.h +++ b/src/frontends/xforms/Menubar_pimpl.h @@ -18,8 +18,6 @@ #include "LString.h" #include "frontends/Menubar.h" -#include "commandtags.h" -#include "MenuBackend.h" #include @@ -31,6 +29,8 @@ class LyXView; class XFormsView; +class Menu; +class MenuItem; /** The LyX GUI independent menubar class The GUI interface is implemented in the corresponding Menubar_pimpl class. diff --git a/src/frontends/xforms/Toolbar_pimpl.C b/src/frontends/xforms/Toolbar_pimpl.C index a3a9183018..b20d8aaac0 100644 --- a/src/frontends/xforms/Toolbar_pimpl.C +++ b/src/frontends/xforms/Toolbar_pimpl.C @@ -23,12 +23,13 @@ #include "FuncStatus.h" #include "BufferView.h" #include "buffer.h" -#include "lyxtextclasslist.h" #include "LyXAction.h" #include "MathsSymbols.h" #include "gettext.h" #include "Tooltips.h" #include FORMS_H_LOCATION +#include "combox.h" +#include "ToolbarDefaults.h" #include "support/LAssert.h" #include "support/filetools.h" @@ -153,7 +154,7 @@ void Toolbar::Pimpl::layoutSelected() { string const & layoutguiname = combox->getline(); LyXTextClass const & tc = - textclasslist[owner->buffer()->params.textclass]; + owner->buffer()->params.getLyXTextClass(); LyXTextClass::const_iterator end = tc.end(); for (LyXTextClass::const_iterator cit = tc.begin(); @@ -172,7 +173,7 @@ void Toolbar::Pimpl::setLayout(string const & layout) { if (combox) { LyXTextClass const & tc = - textclasslist[owner->buffer()->params.textclass]; + owner->buffer()->params.getLyXTextClass(); combox->select(_(tc[layout]->name())); } } @@ -187,7 +188,7 @@ void Toolbar::Pimpl::updateLayoutList(bool force) if (combox->empty() || force) { combox->clear(); LyXTextClass const & tc = - textclasslist[owner->buffer()->params.textclass]; + owner->buffer()->params.getLyXTextClass(); LyXTextClass::const_iterator end = tc.end(); for (LyXTextClass::const_iterator cit = tc.begin(); cit != end; ++cit) { diff --git a/src/frontends/xforms/Toolbar_pimpl.h b/src/frontends/xforms/Toolbar_pimpl.h index bc67403f85..e6acdca1d3 100644 --- a/src/frontends/xforms/Toolbar_pimpl.h +++ b/src/frontends/xforms/Toolbar_pimpl.h @@ -16,10 +16,6 @@ #include "frontends/Toolbar.h" -#include "commandtags.h" -#include "combox.h" -#include "ToolbarDefaults.h" - #ifdef __GNUG__ #pragma interface #endif @@ -27,6 +23,7 @@ class XFormsView; class Tooltips; class Dialogs; +class Combox; /** The LyX xforms toolbar class */ diff --git a/src/frontends/xforms/forms/form_document.fd b/src/frontends/xforms/forms/form_document.fd index 0be98eeeb4..e2b6541177 100644 --- a/src/frontends/xforms/forms/form_document.fd +++ b/src/frontends/xforms/forms/form_document.fd @@ -1537,7 +1537,7 @@ gravity: FL_NoGravity FL_NoGravity name: bmtable_bullet_panel callback: argument: - file: /nfs/sinco/source/lyx/lyx-devel/lib/images/psnfss2.xpm + file: psnfss2.xpm fullpath: 1 -------------------- diff --git a/src/graphics/ChangeLog b/src/graphics/ChangeLog index a1b2bceb48..d8be60dbb6 100644 --- a/src/graphics/ChangeLog +++ b/src/graphics/ChangeLog @@ -1,3 +1,7 @@ +2002-07-21 Jean-Marc Lasgouttes + + * PreviewLoader.C: use BufferParams::getLyXTextClass + 2002-07-21 Herbert Voss * GraphicsImage.C: get the LyXAspectRatio run. diff --git a/src/graphics/PreviewLoader.C b/src/graphics/PreviewLoader.C index eb28055954..14eb559e3d 100644 --- a/src/graphics/PreviewLoader.C +++ b/src/graphics/PreviewLoader.C @@ -20,7 +20,6 @@ #include "converter.h" #include "debug.h" #include "lyxrc.h" -#include "lyxtextclasslist.h" #include "LColor.h" #include "insets/inset.h" @@ -662,7 +661,7 @@ double setFontScalingFactor(Buffer & buffer) return 10.0 * scale_factor / strToDbl(fontsize); // No. We must extract it from the LaTeX class file. - LyXTextClass const & tclass = textclasslist[buffer.params.textclass]; + LyXTextClass const & tclass = buffer.params.getLyXTextClass(); string const textclass(tclass.latexname() + ".cls"); string const classfile(findtexfile(textclass, "cls")); diff --git a/src/insets/ChangeLog b/src/insets/ChangeLog index e831ee35f8..28f49362ae 100644 --- a/src/insets/ChangeLog +++ b/src/insets/ChangeLog @@ -1,3 +1,29 @@ +2002-07-21 Jean-Marc Lasgouttes + + * insettext.h: do not include "paragraph.h" and "lyxcursor.h" + + * insetlatexaccent.h: do not include "lyxlex.h" + + * insetgraphicsParams.h: do not include "lyxlex.h" and "buffer.h" + + * insetquotes.C: + * insetlatexaccent.C: + * insetgraphics.C: + * insetexternal.C: + * insetert.C: + * insetbib.C: #include "lyxlex.h" + + * insetinclude.C: + * insetfloat.C: + * insetert.C: + * insetbib.C: + * insettext.C: use BufferParams::getLyXTextClass + + + * insetfloat.C (addToToc): new method. Add to toclist the entries + corresponding to Caption layouts + (InsetFloat): when creating a new float, set the layout to "Caption" + 2002-07-21 Herbert Voss * insetgraphicsParams.C: fet the keepLyXAspectRatio run. Move the diff --git a/src/insets/insetbib.C b/src/insets/insetbib.C index 2799dad562..1525c4d274 100644 --- a/src/insets/insetbib.C +++ b/src/insets/insetbib.C @@ -11,9 +11,9 @@ #include "gettext.h" #include "lyxtext.h" #include "lyxrc.h" +#include "lyxlex.h" #include "frontends/font_metrics.h" #include "frontends/LyXView.h" -#include "lyxtextclasslist.h" #include "frontends/Dialogs.h" @@ -174,7 +174,7 @@ int InsetBibtex::latex(Buffer const * buffer, ostream & os, // part of its name, because it's than book. // For the "official" lyx-layouts it's no problem to support // all well - if (!contains(textclasslist[buffer->params.textclass].name(), + if (!contains(buffer->params.getLyXTextClass().name(), "art")) { if (buffer->params.sides == LyXTextClass::OneSide) { // oneside diff --git a/src/insets/insetert.C b/src/insets/insetert.C index 7b71bfec59..e7a3a8f980 100644 --- a/src/insets/insetert.C +++ b/src/insets/insetert.C @@ -22,8 +22,8 @@ #include "frontends/LyXView.h" #include "lyxtext.h" #include "debug.h" -#include "lyxtextclasslist.h" #include "lyxrow.h" +#include "lyxlex.h" #include "insets/insettext.h" @@ -201,7 +201,7 @@ void InsetERT::write(Buffer const * buf, ostream & os) const << "status "<< st << "\n"; //inset.writeParagraphData(buf, os); - string const layout(textclasslist[buf->params.textclass].defaultLayoutName()); + string const layout(buf->params.getLyXTextClass().defaultLayoutName()); Paragraph * par = inset.paragraph(); while (par) { os << "\n\\layout " << layout << "\n"; diff --git a/src/insets/insetexternal.C b/src/insets/insetexternal.C index cc66ca3b20..8e557f91cd 100644 --- a/src/insets/insetexternal.C +++ b/src/insets/insetexternal.C @@ -23,6 +23,7 @@ #include "LaTeXFeatures.h" #include "gettext.h" #include "debug.h" +#include "lyxlex.h" #include "frontends/Dialogs.h" diff --git a/src/insets/insetfloat.C b/src/insets/insetfloat.C index 7882fe3348..f803886e27 100644 --- a/src/insets/insetfloat.C +++ b/src/insets/insetfloat.C @@ -28,6 +28,7 @@ #include "buffer.h" #include "frontends/LyXView.h" #include "frontends/Dialogs.h" +#include "lyxlex.h" using std::ostream; using std::endl; @@ -101,6 +102,10 @@ using std::endl; namespace { +// this should not be hardcoded, but be part of the definition +// of the float (JMarc) +string const caplayout("Caption"); + string floatname(string const & type) { FloatList::const_iterator it = floatList[type]; @@ -126,6 +131,9 @@ InsetFloat::InsetFloat(BufferParams const & bp, string const & type) setLabelFont(font); floatType_ = type; setInsetName(type); + LyXTextClass const & tclass = bp.getLyXTextClass(); + if (tclass.hasLayout(caplayout)) + inset.paragraph()->layout(tclass[caplayout]); } @@ -328,3 +336,22 @@ bool InsetFloat::wide() const { return wide_; } + + +void InsetFloat::addToToc(toc::TocList & toclist, Buffer const * buf) const +{ + // Now find the caption in the float... + // We now tranverse the paragraphs of + // the inset... + Paragraph * tmp = inset.paragraph(); + while (tmp) { + if (tmp->layout()->name() == caplayout) { + string const str = + tostr(toclist[type()].size() + 1) + + ". " + tmp->asString(buf, false); + toc::TocItem const item(tmp, 0 , str); + toclist[type()].push_back(item); + } + tmp = tmp->next(); + } +} diff --git a/src/insets/insetfloat.h b/src/insets/insetfloat.h index 81ab93538c..bfea7de0f7 100644 --- a/src/insets/insetfloat.h +++ b/src/insets/insetfloat.h @@ -17,6 +17,7 @@ #endif #include "insetcollapsable.h" +#include "toc.h" #include @@ -62,6 +63,8 @@ public: /// bool wide() const; /// + void addToToc(toc::TocList &, Buffer const *) const; + /// bool showInsetDialog(BufferView *) const; /// boost::signal0 hideDialog; diff --git a/src/insets/insetgraphics.C b/src/insets/insetgraphics.C index 424fef4eb2..a8d4a9f4c8 100644 --- a/src/insets/insetgraphics.C +++ b/src/insets/insetgraphics.C @@ -75,6 +75,7 @@ TODO #include "debug.h" #include "gettext.h" #include "LaTeXFeatures.h" +#include "lyxlex.h" #include "frontends/Dialogs.h" #include "frontends/Alert.h" diff --git a/src/insets/insetgraphicsParams.C b/src/insets/insetgraphicsParams.C index 4bdb4be32a..3f699fd393 100644 --- a/src/insets/insetgraphicsParams.C +++ b/src/insets/insetgraphicsParams.C @@ -29,7 +29,7 @@ #include "support/lstrings.h" #include "lyxrc.h" #include "debug.h" - +#include "lyxlex.h" using std::ostream; diff --git a/src/insets/insetgraphicsParams.h b/src/insets/insetgraphicsParams.h index 3fae9694e2..aadc417d9f 100644 --- a/src/insets/insetgraphicsParams.h +++ b/src/insets/insetgraphicsParams.h @@ -18,9 +18,9 @@ #endif #include "LString.h" +#include "lyxlength.h" -#include "buffer.h" -#include "lyxlex.h" +class LyXLex; namespace grfx { class Params; diff --git a/src/insets/insetinclude.C b/src/insets/insetinclude.C index 27fae37715..f4e88b5eed 100644 --- a/src/insets/insetinclude.C +++ b/src/insets/insetinclude.C @@ -13,7 +13,6 @@ #include "frontends/LyXView.h" #include "LaTeXFeatures.h" #include "gettext.h" -#include "lyxtextclasslist.h" #include "frontends/Dialogs.h" @@ -242,9 +241,9 @@ int InsetInclude::latex(Buffer const * buffer, ostream & os, lyxerr << "WARNING: Included file `" << MakeDisplayPath(getFileName()) << "' has textclass `" - << textclasslist[tmp->params.textclass].name() + << tmp->params.getLyXTextClass().name() << "' while parent file has textclass `" - << textclasslist[buffer->params.textclass].name() + << buffer->params.getLyXTextClass().name() << "'." << endl; //return 0; } diff --git a/src/insets/insetlatexaccent.C b/src/insets/insetlatexaccent.C index 572538bdac..fdbafa4cb7 100644 --- a/src/insets/insetlatexaccent.C +++ b/src/insets/insetlatexaccent.C @@ -22,6 +22,7 @@ #include "frontends/Painter.h" #include "frontends/font_metrics.h" #include "language.h" +#include "lyxlex.h" using std::ostream; using std::endl; diff --git a/src/insets/insetlatexaccent.h b/src/insets/insetlatexaccent.h index 8e80c56e59..b35b2eb9d5 100644 --- a/src/insets/insetlatexaccent.h +++ b/src/insets/insetlatexaccent.h @@ -17,7 +17,8 @@ #include "inset.h" #include "LString.h" -#include "lyxlex.h" + +class LyXLex; /** Insertion of accents diff --git a/src/insets/insetquotes.C b/src/insets/insetquotes.C index ce24a655d7..4567f4ab03 100644 --- a/src/insets/insetquotes.C +++ b/src/insets/insetquotes.C @@ -28,6 +28,7 @@ #include "lyxfont.h" #include "lyxrc.h" #include "paragraph.h" +#include "lyxlex.h" using std::ostream; using std::endl; diff --git a/src/insets/insettabular.C b/src/insets/insettabular.C index 4b4a7bc157..e2b8bcfb50 100644 --- a/src/insets/insettabular.C +++ b/src/insets/insettabular.C @@ -34,6 +34,7 @@ #include "undo_funcs.h" #include "lyxlength.h" #include "ParagraphParameters.h" +#include "lyxlex.h" #include "frontends/Dialogs.h" #include "frontends/Alert.h" diff --git a/src/insets/insettext.C b/src/insets/insettext.C index 5153172714..5496568320 100644 --- a/src/insets/insettext.C +++ b/src/insets/insettext.C @@ -23,7 +23,6 @@ #include "buffer.h" #include "frontends/LyXView.h" #include "BufferView.h" -#include "lyxtextclasslist.h" #include "LaTeXFeatures.h" #include "frontends/Painter.h" #include "lyxtext.h" @@ -140,7 +139,7 @@ InsetText::InsetText(BufferParams const & bp) do_reinit(false) { par = new Paragraph; - par->layout(textclasslist[bp.textclass].defaultLayout()); + par->layout(bp.getLyXTextClass().defaultLayout()); init(); } @@ -1448,15 +1447,15 @@ InsetText::localDispatch(BufferView * bv, // Derive layout number from given argument (string) // and current buffer's textclass (number). */ - textclass_type tclass = bv->buffer()->params.textclass; + LyXTextClass const & tclass = + bv->buffer()->params.getLyXTextClass(); string layout = arg; - bool hasLayout = textclasslist[tclass].hasLayout(layout); + bool hasLayout = tclass.hasLayout(layout); // If the entry is obsolete, use the new one instead. if (hasLayout) { string const & obs = - textclasslist[tclass][layout]-> - obsoleted_by(); + tclass[layout]->obsoleted_by(); if (!obs.empty()) layout = obs; } diff --git a/src/insets/insettext.h b/src/insets/insettext.h index 971634b65e..9f0fe2dc94 100644 --- a/src/insets/insettext.h +++ b/src/insets/insettext.h @@ -22,8 +22,7 @@ #include "inset.h" #include "LString.h" #include "LColor.h" -#include "paragraph.h" -#include "lyxcursor.h" +#include "support/types.h" #include @@ -34,6 +33,7 @@ class BufferParams; class LyXCursor; class LyXText; class Row; +class Paragraph; /** A text inset is like a TeX box to write full text diff --git a/src/lyx_cb.C b/src/lyx_cb.C index 6548ea1edb..1eb77860eb 100644 --- a/src/lyx_cb.C +++ b/src/lyx_cb.C @@ -22,7 +22,6 @@ #include "lyxtext.h" #include "gettext.h" #include "BufferView.h" -#include "lyxtextclasslist.h" #include "insets/insetlabel.h" diff --git a/src/lyx_main.C b/src/lyx_main.C index 3a0454692b..ddb6e7bddd 100644 --- a/src/lyx_main.C +++ b/src/lyx_main.C @@ -25,7 +25,6 @@ #include "lyxlex.h" #include "bufferlist.h" -#include "lyxtextclasslist.h" #include "lyxserver.h" #include "kbmap.h" #include "lyxfunc.h" @@ -35,6 +34,7 @@ #include "lastfiles.h" #include "encoding.h" #include "converter.h" +#include "lyxtextclasslist.h" #include "frontends/Alert.h" #include "frontends/lyx_gui.h" diff --git a/src/lyxfunc.h b/src/lyxfunc.h index d2353d4436..fd6e853896 100644 --- a/src/lyxfunc.h +++ b/src/lyxfunc.h @@ -12,10 +12,6 @@ #include "kbsequence.h" #include "LString.h" -#include "frontends/mouse_state.h" -#include "frontends/key_state.h" -#include "frontends/LyXKeySym.h" - #include class LyXView; diff --git a/src/lyxrc.C b/src/lyxrc.C index aa4c6cc358..d2b8e1caf0 100644 --- a/src/lyxrc.C +++ b/src/lyxrc.C @@ -17,19 +17,19 @@ #include #include #include +#include #include "debug.h" #include "lyxrc.h" #include "kbmap.h" #include "LyXAction.h" -#include "lyx_main.h" #include "intl.h" #include "support/path.h" #include "support/filetools.h" -#include "lyxtext.h" #include "converter.h" #include "gettext.h" +#include "lyxlex.h" using std::ostream; using std::ofstream; @@ -38,6 +38,8 @@ using std::ios; using std::endl; using std::vector; +class kb_keymap; + extern LyXAction lyxaction; extern boost::scoped_ptr toplevel_keymap; diff --git a/src/lyxtextclasslist.C b/src/lyxtextclasslist.C index 66b9e16284..59b0a4d595 100644 --- a/src/lyxtextclasslist.C +++ b/src/lyxtextclasslist.C @@ -46,10 +46,10 @@ pair const LyXTextClassList::NumberOfClass(string const & textclass) const { ClassList::const_iterator cit = - find_if(classlist.begin(), classlist.end(), + find_if(classlist_.begin(), classlist_.end(), lyx::compare_memfun(&LyXTextClass::name, textclass)); - return cit != classlist.end() ? - make_pair(true, textclass_type(cit - classlist.begin())) : + return cit != classlist_.end() ? + make_pair(true, textclass_type(cit - classlist_.begin())) : make_pair(false, textclass_type(0)); } @@ -58,17 +58,11 @@ LyXTextClassList::NumberOfClass(string const & textclass) const LyXTextClass const & LyXTextClassList::operator[](textclass_type textclass) const { - classlist[textclass].load(); - if (textclass < classlist.size()) - return classlist[textclass]; + classlist_[textclass].load(); + if (textclass < classlist_.size()) + return classlist_[textclass]; else - return classlist[0]; -} - - -void LyXTextClassList::Add(LyXTextClass const & t) -{ - classlist.push_back(t); + return classlist_[0]; } @@ -143,14 +137,14 @@ bool LyXTextClassList::Read () if (lyxerr.debugging(Debug::TCLASS)) { tmpl.load(); } - Add(tmpl); + classlist_.push_back(tmpl); } } } } lyxerr[Debug::TCLASS] << "End of parsing of textclass.lst" << endl; - if (classlist.empty()) { + if (classlist_.empty()) { lyxerr << "LyXTextClassList::Read: no textclasses found!" << endl; Alert::alert(_("LyX wasn't able to find any layout description!"), @@ -159,7 +153,7 @@ bool LyXTextClassList::Read () return false; } // Ok everything loaded ok, now sort the list. - sort(classlist.begin(), classlist.end(), less_textclass_desc()); + sort(classlist_.begin(), classlist_.end(), less_textclass_desc()); return true; } diff --git a/src/lyxtextclasslist.h b/src/lyxtextclasslist.h index a5aa7cedb9..94d71bbc06 100644 --- a/src/lyxtextclasslist.h +++ b/src/lyxtextclasslist.h @@ -38,9 +38,9 @@ public: /// typedef ClassList::const_iterator const_iterator; /// - const_iterator begin() const { return classlist.begin(); } + const_iterator begin() const { return classlist_.begin(); } /// - const_iterator end() const { return classlist.end(); } + const_iterator end() const { return classlist_.end(); } /// Gets textclass number from name, -1 if textclass name does not exist std::pair const @@ -53,9 +53,7 @@ public: bool Read(); private: /// - mutable ClassList classlist; - /// - void Add(LyXTextClass const &); + mutable ClassList classlist_; }; /// diff --git a/src/paragraph.C b/src/paragraph.C index 9c397dee98..9b537fba1b 100644 --- a/src/paragraph.C +++ b/src/paragraph.C @@ -28,7 +28,6 @@ #include "encoding.h" #include "ParameterStruct.h" #include "gettext.h" -#include "lyxtextclasslist.h" #include "insets/insetinclude.h" #include "insets/insetbib.h" @@ -798,7 +797,7 @@ void Paragraph::breakParagraph(BufferParams const & bparams, { // create a new paragraph Paragraph * tmp = new Paragraph(this); - tmp->layout(textclasslist[bparams.textclass].defaultLayout()); + tmp->layout(bparams.getLyXTextClass().defaultLayout()); // remember to set the inset_owner tmp->setInsetOwner(inInset()); @@ -853,7 +852,7 @@ void Paragraph::breakParagraph(BufferParams const & bparams, bibkey = 0; params().clear(); - layout(textclasslist[bparams.textclass].defaultLayout()); + layout(bparams.getLyXTextClass().defaultLayout()); // layout stays the same with latex-environments if (flag) { @@ -1220,7 +1219,7 @@ Paragraph * Paragraph::TeXOnePar(Buffer const * buf, texrow.newline(); } } else { - style = textclasslist[bparams.textclass].defaultLayout(); + style = bparams.getLyXTextClass().defaultLayout(); } Language const * language = getParLanguage(bparams); @@ -1522,7 +1521,7 @@ bool Paragraph::simpleTeXOnePar(Buffer const * buf, (inInset() && inInset()->forceDefaultParagraphs(inInset())); if (asdefault) { - style = textclasslist[bparams.textclass].defaultLayout(); + style = bparams.getLyXTextClass().defaultLayout(); } else { style = layout(); } diff --git a/src/paragraph_pimpl.C b/src/paragraph_pimpl.C index 45c81b9736..6db01a5e7d 100644 --- a/src/paragraph_pimpl.C +++ b/src/paragraph_pimpl.C @@ -22,7 +22,6 @@ #include "encoding.h" #include "lyxrc.h" #include "debug.h" -#include "lyxtextclasslist.h" #include "support/LAssert.h" @@ -675,7 +674,7 @@ LyXFont const Paragraph::Pimpl::realizeFont(LyXFont const & font, // check for environment font information char par_depth = owner_->getDepth(); Paragraph const * par = owner_; - LyXTextClass const & tclass = textclasslist[bparams.textclass]; + LyXTextClass const & tclass = bparams.getLyXTextClass(); while (par && par->getDepth() && !tmpfont.resolved()) { par = par->outerHook(); diff --git a/src/tabular.C b/src/tabular.C index eae5366071..c6652f3029 100644 --- a/src/tabular.C +++ b/src/tabular.C @@ -35,7 +35,7 @@ #include "frontends/Alert.h" #include "gettext.h" #include "tabular_funcs.h" -#include "lyxtextclasslist.h" +#include "lyxlex.h" #include #include @@ -1449,7 +1449,7 @@ void LyXTabular::OldFormatRead(BufferParams const & bp, Paragraph * par = new Paragraph; Paragraph * return_par = 0; - par->layout(textclasslist[bp.textclass].defaultLayout()); + par->layout(bp.getLyXTextClass().defaultLayout()); string tmptok; int pos = 0; diff --git a/src/tabular.h b/src/tabular.h index 75f9feacf0..09e0faa1f7 100644 --- a/src/tabular.h +++ b/src/tabular.h @@ -16,7 +16,6 @@ #pragma interface #endif -#include "lyxlex.h" #include "layout.h" #include "LString.h" #include "lyxlength.h" @@ -27,8 +26,10 @@ #include class InsetTabular; +class BufferParams; class LaTeXFeatures; class Buffer; +class LyXLex; /* The features the text class offers for tables */ diff --git a/src/text.C b/src/text.C index 9392cb5913..7f35a5fadb 100644 --- a/src/text.C +++ b/src/text.C @@ -12,7 +12,6 @@ #include "lyxtext.h" #include "lyxrow.h" -#include "lyxtextclasslist.h" #include "paragraph.h" #include "gettext.h" #include "bufferparams.h" @@ -707,7 +706,7 @@ int LyXText::leftMargin(BufferView * bview, Row const * row) const return LYX_PAPER_MARGIN; LyXTextClass const & tclass = - textclasslist[bview->buffer()->params.textclass]; + bview->buffer()->params.getLyXTextClass(); LyXLayout_ptr const & layout = row->par()->layout(); string parindent = layout->parindent; @@ -899,7 +898,7 @@ int LyXText::rightMargin(Buffer const * buf, Row const * row) const (ins->needFullRow() || ins->display())) return LYX_PAPER_MARGIN; - LyXTextClass const & tclass = textclasslist[buf->params.textclass]; + LyXTextClass const & tclass = buf->params.getLyXTextClass(); LyXLayout_ptr const & layout = row->par()->layout(); int x = LYX_PAPER_MARGIN @@ -1726,7 +1725,7 @@ void LyXText::breakAgainOneRow(BufferView * bview, Row * row) void LyXText::breakParagraph(BufferView * bview, char keep_layout) { LyXTextClass const & tclass = - textclasslist[bview->buffer()->params.textclass]; + bview->buffer()->params.getLyXTextClass(); LyXLayout_ptr const & layout = cursor.par()->layout(); // this is only allowed, if the current paragraph is not empty or caption @@ -2782,7 +2781,8 @@ void LyXText::backspace(BufferView * bview) // different wether it is open or closed. // Correction: Pasting is always allowed with standard-layout - LyXTextClass const & tclass = textclasslist[bview->buffer()->params.textclass]; + LyXTextClass const & tclass = + bview->buffer()->params.getLyXTextClass(); if (cursor.par() != tmppar && (cursor.par()->layout() == tmppar->layout() diff --git a/src/text2.C b/src/text2.C index 896e2a97dd..506d957912 100644 --- a/src/text2.C +++ b/src/text2.C @@ -17,7 +17,6 @@ #include "lyxtext.h" #include "LString.h" #include "paragraph.h" -#include "lyxtextclasslist.h" #include "frontends/LyXView.h" #include "undo_funcs.h" #include "buffer.h" @@ -120,6 +119,7 @@ LyXFont const realizeFont(LyXFont const & font, Buffer const * buf, Paragraph * par) { + LyXTextClass const & tclass = buf->params.getLyXTextClass(); LyXFont tmpfont(font); Paragraph::depth_type par_depth = par->getDepth(); @@ -130,9 +130,7 @@ LyXFont const realizeFont(LyXFont const & font, #ifndef INHERIT_LANGUAGE tmpfont.realize(par->layout()->font); #else - tmpfont.realize(textclasslist. - Style(buf->params.textclass, - par->layout())->font, + tmpfont.realize(tclass[par->layout()]->font, buf->params.language); #endif par_depth = par->getDepth(); @@ -140,10 +138,9 @@ LyXFont const realizeFont(LyXFont const & font, } #ifndef INHERIT_LANGUAGE - tmpfont.realize(textclasslist[buf->params.textclass].defaultfont()); + tmpfont.realize(tclass.defaultfont()); #else - tmpfont.realize(textclasslist[buf->params.textclass].defaultfont(), - buf->params.language); + tmpfont.realize(tclass.defaultfont(), buf->params.language); #endif return tmpfont; @@ -272,7 +269,7 @@ void LyXText::setCharFont(Buffer const * buf, Paragraph * par, { LyXFont font(fnt); - LyXTextClass const & tclass = textclasslist[buf->params.textclass]; + LyXTextClass const & tclass = buf->params.getLyXTextClass(); LyXLayout_ptr const & layout = par->layout(); // Get concrete layout font to reduce against @@ -292,9 +289,7 @@ void LyXText::setCharFont(Buffer const * buf, Paragraph * par, #ifndef INHERIT_LANGUAGE layoutfont.realize(tp->layout()->font); #else - layoutfont.realize(textclasslist. - Style(buf->params.textclass, - tp->layout()).font, + layoutfont.realize(tclass[tp->layout()].font, buf->params.language); #endif } @@ -499,7 +494,7 @@ Paragraph * LyXText::setLayout(BufferView * bview, Paragraph * epar = send_cur.par()->next(); LyXLayout_ptr const & lyxlayout = - textclasslist[bview->buffer()->params.textclass][layout]; + bview->buffer()->params.getLyXTextClass()[layout]; do { par->applyLayout(lyxlayout); @@ -1279,7 +1274,7 @@ string const romanCounter(int n) // set the counter of a paragraph. This includes the labels void LyXText::setCounter(Buffer const * buf, Paragraph * par) const { - LyXTextClass const & textclass = textclasslist[buf->params.textclass]; + LyXTextClass const & textclass = buf->params.getLyXTextClass(); LyXLayout_ptr const & layout = par->layout(); // copy the prev-counters to this one, diff --git a/src/toc.C b/src/toc.C index 79c528c154..06b4062b7f 100644 --- a/src/toc.C +++ b/src/toc.C @@ -26,7 +26,6 @@ #include "lyxfunc.h" #include "LyXAction.h" #include "paragraph.h" -#include "lyxtextclasslist.h" #include "insets/insetfloat.h" #include "debug.h" @@ -75,9 +74,7 @@ TocList const getTocList(Buffer const * buf) TocList toclist; Paragraph * par = buf->paragraph; - LyXTextClass const & textclass = textclasslist[buf->params.textclass]; - bool found = textclass.hasLayout("Caption"); - string const layout("Caption"); + LyXTextClass const & textclass = buf->params.getLyXTextClass(); while (par) { #ifdef WITH_WARNINGS @@ -93,40 +90,18 @@ TocList const getTocList(Buffer const * buf) par->asString(buf, true)); toclist["TOC"].push_back(item); } + // For each paragraph, traverse its insets and look for // FLOAT_CODE - - if (found) { - Paragraph::inset_iterator it = - par->inset_iterator_begin(); - Paragraph::inset_iterator end = - par->inset_iterator_end(); - - for (; it != end; ++it) { - if ((*it)->lyxCode() == Inset::FLOAT_CODE) { - InsetFloat * il = - static_cast(*it); - - string const type = il->type(); - - // Now find the caption in the float... - // We now tranverse the paragraphs of - // the inset... - Paragraph * tmp = il->inset.paragraph(); - while (tmp) { - if (tmp->layout()->name() == layout) { - string const str = - tostr(toclist[type].size()+1) + ". " + tmp->asString(buf, false); - TocItem const item(tmp, 0 , str); - toclist[type].push_back(item); - } - tmp = tmp->next(); - } - } + Paragraph::inset_iterator it = par->inset_iterator_begin(); + Paragraph::inset_iterator end = par->inset_iterator_end(); + for (; it != end; ++it) { + if ((*it)->lyxCode() == Inset::FLOAT_CODE) { + InsetFloat * il = + static_cast(*it); + il->addToToc(toclist, buf); } - } else { - lyxerr << "Caption not found" << endl; - } + } par = par->next(); }