This is one of a series of patches that will merge the layout modules development in personal/branches/rgheck back into the tree.

Design goal: Allow the use of layout "modules", which are to LaTeX packages as layout files are to LaTeX document classes. Thus, one could have a module that defined certain character styles, environments, commands, or what have you, and include it in various documents, each of which uses a different document class, without having to modify the layout files themselves. For example, a theorems.module could be used with article.layout to provide support for theorem-type environments, without having to modify article.layout itself, and the same module could be used with book.layout, etc.

This first patch does some reworking of the infrastructrue. We need to distinguish between the TextClass that a particular document is using and the layout of that document, since modules, in particular, can modify the layout. The solution adopted here is to add a TextClass pointer to BufferParams, which will hold the layout. The layout itself is then constructed from the TextClass the document is using. At present, this is completely trivial, but that will change when modules are added.

The pointer in question is a boost::shared_ptr. This is needed because CutAndPaste saves a copy of the layout with each cut or copied selection. We cannot assume the selection vanishes when the document is closed, so there are two options: (i) keep a list of all the layouts that have ever been used by any document; (ii) used some kind of smart pointer. The latter seems preferable, as the former would waste memory. More importantly, the use of a smart pointer allows modules to be modified on disk and then reloaded while LyX is running, and it will eventually allow the same for layout files.


git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@19756 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Richard Heck 2007-08-23 16:41:13 +00:00
parent 24a36d01a0
commit 6e93e77f22
19 changed files with 190 additions and 88 deletions

View File

@ -107,6 +107,7 @@ src_header_files = Split('''
TexRow.h
Text.h
TextClass.h
TextClass_ptr.h
TextClassList.h
TextMetrics.h
Thesaurus.h

View File

@ -49,6 +49,7 @@
#include "ParIterator.h"
#include "sgml.h"
#include "TexRow.h"
#include "TextClassList.h"
#include "TexStream.h"
#include "TocBackend.h"
#include "Undo.h"
@ -439,6 +440,7 @@ int Buffer::readHeader(Lexer & lex)
params().headsep.erase();
params().footskip.erase();
params().listings_params.clear();
for (int i = 0; i < 4; ++i) {
params().user_defined_bullet(i) = ITEMIZE_DEFAULTS[i];
params().temp_bullet(i) = ITEMIZE_DEFAULTS[i];
@ -515,7 +517,7 @@ bool Buffer::readDocument(Lexer & lex)
Alert::error(_("Can't load document class"), bformat(
_("Using the default document class, because the "
"class %1$s could not be loaded."), from_utf8(theclass)));
params().textclass = 0;
params().setBaseClass(defaultTextclass());
}
if (params().outputChanges) {

View File

@ -19,6 +19,7 @@
#include "Author.h"
#include "BranchList.h"
#include "buffer_funcs.h"
#include "Bullet.h"
#include "debug.h"
#include "Encoding.h"
@ -268,15 +269,6 @@ SpaceTranslator const & spacetranslator()
}
textclass_type defaultTextclass()
{
// Initialize textclass to point to article. if `first' is
// true in the returned pair, then `second' is the textclass
// number; if it is false, second is 0. In both cases, second
// is what we want.
return textclasslist.numberOfClass("article").second;
}
} // anon namespace
@ -322,8 +314,9 @@ void BufferParams::MemoryTraits::destroy(BufferParams::Impl * ptr)
BufferParams::BufferParams()
: textclass(defaultTextclass()), pimpl_(new Impl)
: pimpl_(new Impl)
{
setBaseClass(defaultTextclass());
paragraph_separation = PARSEP_INDENT;
quotes_language = InsetQuotes::EnglishQ;
fontsize = "default";
@ -458,20 +451,17 @@ string const BufferParams::readToken(Lexer & lex, string const & token)
pair<bool, lyx::textclass_type> pp =
textclasslist.numberOfClass(classname);
if (pp.first) {
textclass = pp.second;
setBaseClass(pp.second);
} else {
// if text class does not exist, try to load it from filepath
pp = textclasslist.addTextClass(classname, filepath);
if (pp.first) {
textclass = pp.second;
setBaseClass(pp.second);
} else {
textclass = defaultTextclass();
setBaseClass(defaultTextclass());
return classname;
}
}
// FIXME: isTeXClassAvailable will try to load the layout file, but will
// fail because of the lack of path info. Warnings will be given although
// the layout file will be correctly loaded later.
if (!getTextClass().isTeXClassAvailable()) {
docstring const msg =
bformat(_("The layout file requested by this document,\n"
@ -648,7 +638,7 @@ void BufferParams::writeFile(ostream & os) const
// Prints out the buffer info into the .lyx file given by file
// the textclass
os << "\\textclass " << textclasslist[textclass].name() << '\n';
os << "\\textclass " << textclasslist[baseClass_].name() << '\n';
// then the preamble
if (!preamble.empty()) {
@ -1172,7 +1162,7 @@ bool BufferParams::writeLaTeX(odocstream & os, LaTeXFeatures & features,
void BufferParams::useClassDefaults()
{
TextClass const & tclass = textclasslist[textclass];
TextClass const & tclass = textclasslist[baseClass_];
sides = tclass.sides();
columns = tclass.columns();
@ -1188,7 +1178,7 @@ void BufferParams::useClassDefaults()
bool BufferParams::hasClassDefaults() const
{
TextClass const & tclass = textclasslist[textclass];
TextClass const & tclass = textclasslist[baseClass_];
return (sides == tclass.sides()
&& columns == tclass.columns()
@ -1201,7 +1191,42 @@ bool BufferParams::hasClassDefaults() const
TextClass const & BufferParams::getTextClass() const
{
return textclasslist[textclass];
return *textClass_;
}
TextClass_ptr BufferParams::getTextClass_ptr() const {
return textClass_;
}
void BufferParams::setTextClass(TextClass_ptr tc) {
textClass_ = tc;
}
void BufferParams::setBaseClass(textclass_type tc)
{
baseClass_ = tc;
makeTextClass();
}
void BufferParams::setJustBaseClass(textclass_type tc)
{
baseClass_ = tc;
}
textclass_type BufferParams::getBaseClass() const
{
return baseClass_;
}
void BufferParams::makeTextClass()
{
textClass_.reset(new TextClass(textclasslist[getBaseClass()]));
}

View File

@ -17,18 +17,19 @@
#include "BiblioInfo.h"
#include "TextClass.h"
#include "TextClass_ptr.h"
#include "paper.h"
#include "insets/InsetQuotes.h"
#include "support/copied_ptr.h"
#include "support/FileName.h"
#include "support/types.h"
#include "frontends/controllers/frontend_helpers.h"
#include <vector>
namespace lyx {
class AuthorList;
@ -42,9 +43,8 @@ class TexRow;
class VSpace;
class Language;
/** Buffer parameters.
* This class contains all the parameters for this a buffer uses. Some
* This class contains all the parameters for this buffer's use. Some
* work needs to be done on this class to make it nice. Now everything
* is in public.
*/
@ -88,7 +88,7 @@ public:
///
void setDefSkip(VSpace const & vs);
/** Wether paragraphs are separated by using a indent like in
/** Whether paragraphs are separated by using a indent like in
* articles or by using a little skip like in letters.
*/
PARSEP paragraph_separation;
@ -98,10 +98,30 @@ public:
InsetQuotes::quote_times quotes_times;
///
std::string fontsize;
///
textclass_type textclass;
///
///Get the LyX TextClass (that is, the layout file) this document is using.
textclass_type getBaseClass() const;
///Set the LyX TextClass (that is, the layout file) this document is using.
///NOTE This also calls makeTextClass(), to update the local
///TextClass.
void setBaseClass(textclass_type);
///Returns the TextClass currently in use: the BaseClass as modified
///by modules.
TextClass const & getTextClass() const;
///Returns a pointer to the TextClass currently in use: the BaseClass
///as modified by modules. (See \file TextClass_ptr.h for the typedef.)
TextClass_ptr getTextClass_ptr() const;
///Set the LyX TextClass---layout file---this document is using.
///This does NOT call makeTextClass() and so should be used with
///care. This is most likely not what you want if you are operating on
///BufferParams that are actually associatd with a Buffer. If, on the
///other hand, you are using a temporary set of BufferParams---say, in
///a controller, it may well be, since in that case the local TextClass
///has nothing to do.
void setJustBaseClass(textclass_type);
/// This bypasses the baseClass and sets the textClass directly.
/// Should be called with care and would be better not being here,
/// but it seems to be needed by CutAndPaste::putClipboard().
void setTextClass(TextClass_ptr);
/// returns the main font for the buffer (document)
Font const getFont() const;
@ -202,16 +222,6 @@ public:
/// \param index should lie in the range 0 <= \c index <= 3.
Bullet & user_defined_bullet(size_type index);
Bullet const & user_defined_bullet(size_type index) const;
///
void readPreamble(Lexer &);
///
void readLanguage(Lexer &);
///
void readGraphicsDriver(Lexer &);
///
void readBullets(Lexer &);
///
void readBulletsLaTeX(Lexer &);
/// Whether to load a package such as amsmath or esint.
/// The enum values must not be changed (file format!)
@ -271,6 +281,27 @@ public:
void setCiteEngine(biblio::CiteEngine const);
private:
///
void readPreamble(Lexer &);
///
void readLanguage(Lexer &);
///
void readGraphicsDriver(Lexer &);
///
void readBullets(Lexer &);
///
void readBulletsLaTeX(Lexer &);
/// create our local TextClass.
void makeTextClass();
/// for use with natbib
biblio::CiteEngine cite_engine_;
/// the base TextClass associated with the document
textclass_type baseClass_;
/// the possibly modular TextClass actually in use
TextClass_ptr textClass_;
/** Use the Pimpl idiom to hide those member variables that would otherwise
* drag in other header files.
*/
@ -282,8 +313,6 @@ private:
};
support::copied_ptr<Impl, MemoryTraits> pimpl_;
///
biblio::CiteEngine cite_engine_;
};
} // namespace lyx

View File

@ -1516,7 +1516,7 @@ void BufferView::menuInsertLyXFile(string const & filenm)
el = buf.errorList("Parse");
recordUndo(cursor_);
cap::pasteParagraphList(cursor_, buf.paragraphs(),
buf.params().textclass, el);
buf.params().getTextClass_ptr(), el);
res = _("Document %1$s inserted.");
} else
res = _("Could not insert document %1$s");

View File

@ -30,6 +30,7 @@
#include "LyXFunc.h"
#include "LyXRC.h"
#include "Text.h"
#include "TextClass_ptr.h"
#include "TextClassList.h"
#include "Paragraph.h"
#include "paragraph_funcs.h"
@ -71,7 +72,7 @@ namespace {
typedef std::pair<pit_type, int> PitPosPair;
typedef limited_stack<pair<ParagraphList, textclass_type> > CutStack;
typedef limited_stack<pair<ParagraphList, TextClass_ptr> > CutStack;
CutStack theCuts(10);
// persistent selection, cleared until the next selection
@ -107,7 +108,7 @@ bool checkPastePossible(int index)
pair<PitPosPair, pit_type>
pasteSelectionHelper(Cursor & cur, ParagraphList const & parlist,
textclass_type textclass, ErrorList & errorlist)
TextClass_ptr textclass, ErrorList & errorlist)
{
Buffer const & buffer = cur.buffer();
pit_type pit = cur.pit();
@ -121,7 +122,7 @@ pasteSelectionHelper(Cursor & cur, ParagraphList const & parlist,
// Make a copy of the CaP paragraphs.
ParagraphList insertion = parlist;
textclass_type const tc = buffer.params().textclass;
TextClass_ptr const tc = buffer.params().getTextClass_ptr();
// Now remove all out of the pars which is NOT allowed in the
// new environment and set also another font if that is required.
@ -335,7 +336,7 @@ PitPosPair eraseSelectionHelper(BufferParams const & params,
}
void putClipboard(ParagraphList const & paragraphs, textclass_type textclass,
void putClipboard(ParagraphList const & paragraphs, TextClass_ptr textclass,
docstring const & plaintext)
{
// For some strange reason gcc 3.2 and 3.3 do not accept
@ -343,7 +344,7 @@ void putClipboard(ParagraphList const & paragraphs, textclass_type textclass,
Buffer buffer("", false);
buffer.setUnnamed(true);
buffer.paragraphs() = paragraphs;
buffer.params().textclass = textclass;
buffer.params().setTextClass(textclass);
std::ostringstream lyx;
if (buffer.write(lyx))
theClipboard().put(lyx.str(), plaintext);
@ -354,7 +355,7 @@ void putClipboard(ParagraphList const & paragraphs, textclass_type textclass,
void copySelectionHelper(Buffer const & buf, ParagraphList & pars,
pit_type startpit, pit_type endpit,
int start, int end, textclass_type tc, CutStack & cutstack)
int start, int end, TextClass_ptr tc, CutStack & cutstack)
{
BOOST_ASSERT(0 <= start && start <= pars[startpit].size());
BOOST_ASSERT(0 <= end && end <= pars[endpit].size());
@ -411,17 +412,17 @@ docstring grabAndEraseSelection(Cursor & cur)
}
void switchBetweenClasses(textclass_type c1, textclass_type c2,
InsetText & in, ErrorList & errorlist)
void switchBetweenClasses(TextClass_ptr const & c1,
TextClass_ptr const & c2, InsetText & in, ErrorList & errorlist)
{
errorlist.clear();
BOOST_ASSERT(!in.paragraphs().empty());
if (c1 == c2)
return;
TextClass const & tclass1 = textclasslist[c1];
TextClass const & tclass2 = textclasslist[c2];
TextClass const & tclass1 = *c1;
TextClass const & tclass2 = *c2;
// layouts
ParIterator end = par_iterator_end(in);
@ -542,7 +543,7 @@ void cutSelection(Cursor & cur, bool doclear, bool realcut)
text->paragraphs(),
begpit, endpit,
cur.selBegin().pos(), endpos,
bp.textclass, theCuts);
bp.getTextClass_ptr(), theCuts);
// Stuff what we got on the clipboard.
// Even if there is no selection.
putClipboard(theCuts[0].first, theCuts[0].second,
@ -626,7 +627,8 @@ void copySelectionToStack(Cursor & cur, CutStack & cutstack)
++pos;
copySelectionHelper(cur.buffer(), pars, par, cur.selEnd().pit(),
pos, cur.selEnd().pos(), cur.buffer().params().textclass, cutstack);
pos, cur.selEnd().pos(),
cur.buffer().params().getTextClass_ptr(), cutstack);
dirtyTabularStack(false);
}
@ -638,7 +640,7 @@ void copySelectionToStack(Cursor & cur, CutStack & cutstack)
par.layout(bp.getTextClass().defaultLayout());
par.insert(0, grabSelection(cur), Font(), Change(Change::UNCHANGED));
pars.push_back(par);
cutstack.push(make_pair(pars, bp.textclass));
cutstack.push(make_pair(pars, bp.getTextClass_ptr()));
}
}
@ -665,7 +667,7 @@ void copySelection(Cursor & cur, docstring const & plaintext)
par.layout(bp.getTextClass().defaultLayout());
par.insert(0, plaintext, Font(), Change(Change::UNCHANGED));
pars.push_back(par);
theCuts.push(make_pair(pars, bp.textclass));
theCuts.push(make_pair(pars, bp.getTextClass_ptr()));
} else
copySelectionToStack(cur, theCuts);
@ -711,7 +713,7 @@ docstring getSelection(Buffer const & buf, size_t sel_index)
void pasteParagraphList(Cursor & cur, ParagraphList const & parlist,
textclass_type textclass, ErrorList & errorList)
TextClass_ptr textclass, ErrorList & errorList)
{
if (cur.inTexted()) {
Text * text = cur.text();
@ -765,7 +767,7 @@ void pasteClipboard(Cursor & cur, ErrorList & errorList, bool asParagraphs)
if (buffer.readString(lyx)) {
recordUndo(cur);
pasteParagraphList(cur, buffer.paragraphs(),
buffer.params().textclass, errorList);
buffer.params().getTextClass_ptr(), errorList);
cur.setSelection();
return;
}

View File

@ -15,6 +15,7 @@
#define CUTANDPASTE_H
#include "support/docstring.h"
#include "TextClass_ptr.h"
#include <vector>
@ -89,15 +90,15 @@ void pasteFromStack(Cursor & cur, ErrorList & errorList, size_t sel_index);
/// Paste the paragraph list \p parlist at the position given by \p cur.
/// Does not handle undo. Does only work in text, not mathed.
void pasteParagraphList(Cursor & cur, ParagraphList const & parlist,
textclass_type textclass, ErrorList & errorList);
TextClass_ptr textclass, ErrorList & errorList);
/** Needed to switch between different classes. This works
* for a list of paragraphs beginning with the specified par.
* It changes layouts and character styles.
*/
void switchBetweenClasses(textclass_type c1, textclass_type c2,
InsetText & in, ErrorList &);
void switchBetweenClasses(TextClass_ptr const & c1,
TextClass_ptr const & c2, InsetText & in, ErrorList &);
/// Get the current selection as a string. Does not change the selection.
/// Does only work if the whole selection is in mathed.

View File

@ -816,10 +816,10 @@ void loadTextclass(string const & name)
textclass_type const tc = tc_pair.second;
if (!textclasslist[tc].load()) {
docstring s = bformat(_("The document could not be converted\n"
"into the document class %1$s."),
docstring s = bformat(_("The document class %1$s."
"could not be loaded."),
from_utf8(textclasslist[tc].name()));
Alert::error(_("Could not change class"), s);
Alert::error(_("Could not load class"), s);
}
}
@ -1777,9 +1777,6 @@ void LyXFunc::dispatch(FuncRequest const & cmd)
BOOST_ASSERT(lyx_view_);
Buffer * buffer = lyx_view_->buffer();
textclass_type const old_class =
buffer->params().textclass;
loadTextclass(argument);
std::pair<bool, textclass_type> const tc_pair =
@ -1788,18 +1785,23 @@ void LyXFunc::dispatch(FuncRequest const & cmd)
if (!tc_pair.first)
break;
textclass_type const old_class = buffer->params().getBaseClass();
textclass_type const new_class = tc_pair.second;
if (old_class == new_class)
// nothing to do
break;
lyx_view_->message(_("Converting document to new document class..."));
recordUndoFullDocument(view());
buffer->params().textclass = new_class;
//Save the old, possibly modular, layout for use in conversion.
TextClass_ptr oldClass = buffer->params().getTextClass_ptr();
buffer->params().setBaseClass(new_class);
StableDocIterator backcur(view()->cursor());
ErrorList & el = buffer->errorList("Class Switch");
cap::switchBetweenClasses(
old_class, new_class,
oldClass, buffer->params().getTextClass_ptr(),
static_cast<InsetText &>(buffer->inset()), el);
view()->setCursor(backcur.asDocIterator(&(buffer->inset())));

View File

@ -250,6 +250,7 @@ liblyxcore_la_SOURCES = \
Text3.cpp \
TextClass.cpp \
TextClass.h \
TextClass_ptr.h \
TextClassList.cpp \
TextClassList.h \
TextMetrics.cpp \

View File

@ -1342,7 +1342,7 @@ bool Text::dissolveInset(Cursor & cur) {
b.getLanguage());
}
pasteParagraphList(cur, plist, b.params().textclass,
pasteParagraphList(cur, plist, b.params().getTextClass_ptr(),
b.errorList("Paste"));
// restore position
cur.pit() = std::min(cur.lastpit(), spit);

28
src/TextClass_ptr.h Normal file
View File

@ -0,0 +1,28 @@
// -*- C++ -*-
/**
* \file TextClass_ptr.h
* This file is part of LyX, the document processor.
* Licence details can be found in the file COPYING.
*
* \author Richard Heck
*
* Full author contact details are available in file CREDITS.
*/
#ifndef TEXTCLASS_PTR_H
#define TEXTCLASS_PTR_H
#include <boost/shared_ptr.hpp>
namespace lyx {
class TextClass;
/** Shared pointer for possibly modular layout. Needed so that paste,
* for example, will still be able to retain the pointer, even when
* the buffer itself is closed.
*/
typedef boost::shared_ptr<TextClass> TextClass_ptr;
}
#endif

View File

@ -28,6 +28,7 @@
#include "LaTeX.h"
#include "LyX.h"
#include "TextClass.h"
#include "TextClassList.h"
#include "Paragraph.h"
#include "paragraph_funcs.h"
#include "ParagraphList.h"
@ -632,6 +633,15 @@ void checkBufferStructure(Buffer & buffer, ParIterator const & par_it)
}
}
textclass_type defaultTextclass()
{
// We want to return the article class. if `first' is
// true in the returned pair, then `second' is the textclass
// number; if it is false, second is 0. In both cases, second
// is what we want.
return textclasslist.numberOfClass("article").second;
}
void loadChildDocuments(Buffer const & buf)
{
@ -652,5 +662,4 @@ void loadChildDocuments(Buffer const & buf)
if (use_gui && buf.getMasterBuffer() == &buf)
updateLabels(buf);
}
} // namespace lyx

View File

@ -71,6 +71,9 @@ void updateLabels(Buffer const &, ParIterator &);
///
void checkBufferStructure(Buffer &, ParIterator const &);
///
textclass_type defaultTextclass();
///
void loadChildDocuments(Buffer const & buffer);

View File

@ -355,7 +355,7 @@ void LyXView::updateLayoutChoice()
}
// Update the layout display
if (toolbars_->updateLayoutList(buffer()->params().textclass)) {
if (toolbars_->updateLayoutList(buffer()->params().getTextClass_ptr())) {
current_layout = buffer()->params().getTextClass().defaultLayoutName();
}

View File

@ -35,7 +35,7 @@ namespace frontend {
Toolbars::Toolbars(LyXView & owner)
: owner_(owner),
layout_(0),
last_textclass_(-1)
last_textclass_(TextClass_ptr())
{}
#define TurnOnFlag(x) flags |= ToolbarInfo::x
@ -286,7 +286,7 @@ void Toolbars::setLayout(docstring const & layout)
}
bool Toolbars::updateLayoutList(int textclass)
bool Toolbars::updateLayoutList(TextClass_ptr textclass)
{
// update the layout display
if (last_textclass_ != textclass) {
@ -308,7 +308,7 @@ void Toolbars::openLayoutList()
void Toolbars::clearLayoutList()
{
last_textclass_ = -1;
last_textclass_ = TextClass_ptr();
if (layout_)
layout_->clear();
}

View File

@ -23,6 +23,7 @@
#ifndef TOOLBARS_H
#define TOOLBARS_H
#include "TextClass_ptr.h"
#include "ToolbarBackend.h"
#include "Session.h"
@ -115,7 +116,7 @@ public:
/** Populate the layout combox - returns whether we did a full
* update or not
*/
bool updateLayoutList(int textclass);
bool updateLayoutList(TextClass_ptr textclass);
/// Drop down the layout list.
void openLayoutList();
@ -150,7 +151,7 @@ private:
ToolbarsMap toolbars_;
/// The last textclass layout list in the layout choice selector
int last_textclass_;
TextClass_ptr last_textclass_;
// load flags with saved values
void initFlags(ToolbarInfo & tbinfo);

View File

@ -87,7 +87,7 @@ BufferId ControlDocument::id() const
TextClass const & ControlDocument::textClass() const
{
return textclasslist[bp_->textclass];
return textclasslist[bp_->getBaseClass()];
}
@ -113,8 +113,8 @@ void ControlDocument::dispatchParams()
// Set the document class.
textclass_type const old_class =
kernel().buffer().params().textclass;
textclass_type const new_class = bp_->textclass;
kernel().buffer().params().getBaseClass();
textclass_type const new_class = bp_->getBaseClass();
if (new_class != old_class) {
string const name = textclasslist[new_class].name();
kernel().dispatch(FuncRequest(LFUN_TEXTCLASS_APPLY, name));

View File

@ -834,12 +834,12 @@ void QDocumentDialog::classChanged()
textclass_type const tc = latexModule->classCO->currentIndex();
if (form_->controller().loadTextclass(tc)) {
params.textclass = tc;
params.setJustBaseClass(tc);
if (lyxrc.auto_reset_options)
params.useClassDefaults();
form_->update_contents();
} else {
latexModule->classCO->setCurrentIndex(params.textclass);
latexModule->classCO->setCurrentIndex(params.getBaseClass());
}
}
@ -969,8 +969,7 @@ void QDocumentDialog::apply(BufferParams & params)
}
// text layout
params.textclass =
latexModule->classCO->currentIndex();
params.setJustBaseClass(latexModule->classCO->currentIndex());
if (pageLayoutModule->pagestyleCO->currentIndex() == 0)
params.pagestyle = "default";
@ -1255,7 +1254,7 @@ void QDocumentDialog::updateParams(BufferParams const & params)
}
// text layout
latexModule->classCO->setCurrentIndex(params.textclass);
latexModule->classCO->setCurrentIndex(params.getBaseClass());
updatePagestyle(form_->controller().textClass().opt_pagestyle(),
params.pagestyle);
@ -1454,8 +1453,7 @@ void QDocument::useClassDefaults()
{
BufferParams & params = controller().params();
///\todo verify the use of below with lyx-devel:
params.textclass = dialog_->latexModule->classCO->currentIndex();
params.setJustBaseClass(dialog_->latexModule->classCO->currentIndex());
params.useClassDefaults();
update_contents();

View File

@ -482,7 +482,7 @@ int InsetInclude::latex(Buffer const & buffer, odocstream & os,
Buffer * tmp = theBufferList().getBuffer(included_file.absFilename());
if (tmp->params().textclass != m_buffer->params().textclass) {
if (tmp->params().getBaseClass() != m_buffer->params().getBaseClass()) {
// FIXME UNICODE
docstring text = bformat(_("Included file `%1$s'\n"
"has textclass `%2$s'\n"