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
This commit is contained in:
Jean-Marc Lasgouttes 2002-07-21 21:21:06 +00:00
parent 35c2e2d11a
commit 1dc25c472f
53 changed files with 244 additions and 177 deletions

View File

@ -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"

View File

@ -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();

View File

@ -4,6 +4,35 @@
2002-07-21 Jean-Marc Lasgouttes <lasgouttes@freesurf.fr>
* lyxrc.C: do not include lyx_main.h
* LaTeXFeatures.h: use a list<string> instead of a vector<string>
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

View File

@ -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;

View File

@ -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);
///

View File

@ -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<string>::const_iterator cit = usedLayouts.begin();
vector<string>::const_iterator end = usedLayouts.end();
list<string>::const_iterator cit = usedLayouts.begin();
list<string>::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<string>::const_iterator cit = usedLayouts.begin();
vector<string>::const_iterator end = usedLayouts.end();
list<string>::const_iterator cit = usedLayouts.begin();
list<string>::const_iterator end = usedLayouts.end();
for (; cit != end; ++cit) {
tcpreamble << tclass[*cit]->preamble();
}

View File

@ -21,7 +21,6 @@
#include "LString.h"
#include <vector>
#include <set>
#include <list>
#include <map>
@ -89,7 +88,7 @@ public:
private:
string externalPreambles;
std::vector<string> usedLayouts;
std::list<string> usedLayouts;
/// Static preamble bits from the external material insets

View File

@ -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))

View File

@ -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) {

View File

@ -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")

View File

@ -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 <boost/array.hpp>
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

View File

@ -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:") << ' '

View File

@ -15,6 +15,7 @@
#endif
#include "encoding.h"
#include "lyxlex.h"
#include "debug.h"
#ifndef CXX_GLOBAL_CSTD

View File

@ -1,3 +1,7 @@
2002-07-21 Jean-Marc Lasgouttes <lasgouttes@freesurf.fr>
* LyXView.C: use BufferParams::getLyXTextClass
2002-07-21 John Levon <moz@compsoc.man.ac.uk>
* LyXView.C: move autosave connect here

View File

@ -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 =

View File

@ -1,3 +1,7 @@
2002-07-21 Jean-Marc Lasgouttes <lasgouttes@freesurf.fr>
* Toolbar_pimpl.C: use BufferParams::getLyXTextClass
2002-07-21 John Levon <moz@compsoc.man.ac.uk>
* QToc.h:

View File

@ -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);

View File

@ -4,6 +4,13 @@
2002-07-21 Jean-Marc Lasgouttes <lasgouttes@freesurf.fr>
* 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:

View File

@ -18,8 +18,6 @@
#include "LString.h"
#include "frontends/Menubar.h"
#include "commandtags.h"
#include "MenuBackend.h"
#include <boost/shared_ptr.hpp>
@ -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.

View File

@ -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) {

View File

@ -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
*/

View File

@ -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
--------------------

View File

@ -1,3 +1,7 @@
2002-07-21 Jean-Marc Lasgouttes <lasgouttes@freesurf.fr>
* PreviewLoader.C: use BufferParams::getLyXTextClass
2002-07-21 Herbert Voss <voss@lyx.org>
* GraphicsImage.C: get the LyXAspectRatio run.

View File

@ -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"));

View File

@ -1,3 +1,29 @@
2002-07-21 Jean-Marc Lasgouttes <lasgouttes@freesurf.fr>
* 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 <voss@lyx.org>
* insetgraphicsParams.C: fet the keepLyXAspectRatio run. Move the

View File

@ -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

View File

@ -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";

View File

@ -23,6 +23,7 @@
#include "LaTeXFeatures.h"
#include "gettext.h"
#include "debug.h"
#include "lyxlex.h"
#include "frontends/Dialogs.h"

View File

@ -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();
}
}

View File

@ -17,6 +17,7 @@
#endif
#include "insetcollapsable.h"
#include "toc.h"
#include <boost/signals/signal0.hpp>
@ -62,6 +63,8 @@ public:
///
bool wide() const;
///
void addToToc(toc::TocList &, Buffer const *) const;
///
bool showInsetDialog(BufferView *) const;
///
boost::signal0<void> hideDialog;

View File

@ -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"

View File

@ -29,7 +29,7 @@
#include "support/lstrings.h"
#include "lyxrc.h"
#include "debug.h"
#include "lyxlex.h"
using std::ostream;

View File

@ -18,9 +18,9 @@
#endif
#include "LString.h"
#include "lyxlength.h"
#include "buffer.h"
#include "lyxlex.h"
class LyXLex;
namespace grfx {
class Params;

View File

@ -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;
}

View File

@ -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;

View File

@ -17,7 +17,8 @@
#include "inset.h"
#include "LString.h"
#include "lyxlex.h"
class LyXLex;
/** Insertion of accents

View File

@ -28,6 +28,7 @@
#include "lyxfont.h"
#include "lyxrc.h"
#include "paragraph.h"
#include "lyxlex.h"
using std::ostream;
using std::endl;

View File

@ -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"

View File

@ -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;
}

View File

@ -22,8 +22,7 @@
#include "inset.h"
#include "LString.h"
#include "LColor.h"
#include "paragraph.h"
#include "lyxcursor.h"
#include "support/types.h"
#include <boost/shared_ptr.hpp>
@ -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

View File

@ -22,7 +22,6 @@
#include "lyxtext.h"
#include "gettext.h"
#include "BufferView.h"
#include "lyxtextclasslist.h"
#include "insets/insetlabel.h"

View File

@ -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"

View File

@ -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 <boost/signals/trackable.hpp>
class LyXView;

View File

@ -17,19 +17,19 @@
#include <fstream>
#include <iomanip>
#include <iostream>
#include <boost/scoped_ptr.hpp>
#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<kb_keymap> toplevel_keymap;

View File

@ -46,10 +46,10 @@ pair<bool, textclass_type> 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;
}

View File

@ -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<bool, lyx::textclass_type> const
@ -53,9 +53,7 @@ public:
bool Read();
private:
///
mutable ClassList classlist;
///
void Add(LyXTextClass const &);
mutable ClassList classlist_;
};
///

View File

@ -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();
}

View File

@ -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();

View File

@ -35,7 +35,7 @@
#include "frontends/Alert.h"
#include "gettext.h"
#include "tabular_funcs.h"
#include "lyxtextclasslist.h"
#include "lyxlex.h"
#include <algorithm>
#include <cstdlib>
@ -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;

View File

@ -16,7 +16,6 @@
#pragma interface
#endif
#include "lyxlex.h"
#include "layout.h"
#include "LString.h"
#include "lyxlength.h"
@ -27,8 +26,10 @@
#include <vector>
class InsetTabular;
class BufferParams;
class LaTeXFeatures;
class Buffer;
class LyXLex;
/* The features the text class offers for tables */

View File

@ -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()

View File

@ -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,

View File

@ -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<InsetFloat*>(*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<InsetFloat*>(*it);
il->addToToc(toclist, buf);
}
} else {
lyxerr << "Caption not found" << endl;
}
}
par = par->next();
}