mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-11-23 02:14:50 +00:00
Try to make the distinction between base classes and text classes clearer in the code.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@23198 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
parent
69de04feac
commit
4c6180d209
@ -30,6 +30,7 @@ TOP_extra_files = Split('''
|
|||||||
src_header_files = Split('''
|
src_header_files = Split('''
|
||||||
ASpell_local.h
|
ASpell_local.h
|
||||||
Author.h
|
Author.h
|
||||||
|
BaseClassList.h
|
||||||
BiblioInfo.h
|
BiblioInfo.h
|
||||||
Bidi.h
|
Bidi.h
|
||||||
Box.h
|
Box.h
|
||||||
@ -112,7 +113,6 @@ src_header_files = Split('''
|
|||||||
TexRow.h
|
TexRow.h
|
||||||
Text.h
|
Text.h
|
||||||
TextClass.h
|
TextClass.h
|
||||||
TextClassList.h
|
|
||||||
TextClassPtr.h
|
TextClassPtr.h
|
||||||
TextMetrics.h
|
TextMetrics.h
|
||||||
Thesaurus.h
|
Thesaurus.h
|
||||||
@ -143,6 +143,7 @@ src_header_files = Split('''
|
|||||||
|
|
||||||
src_pre_files = Split('''
|
src_pre_files = Split('''
|
||||||
Author.cpp
|
Author.cpp
|
||||||
|
BaseClassList.cpp
|
||||||
BiblioInfo.cpp
|
BiblioInfo.cpp
|
||||||
Bidi.cpp
|
Bidi.cpp
|
||||||
BranchList.cpp
|
BranchList.cpp
|
||||||
@ -213,7 +214,6 @@ src_pre_files = Split('''
|
|||||||
Text2.cpp
|
Text2.cpp
|
||||||
Text3.cpp
|
Text3.cpp
|
||||||
TextClass.cpp
|
TextClass.cpp
|
||||||
TextClassList.cpp
|
|
||||||
TextMetrics.cpp
|
TextMetrics.cpp
|
||||||
TocBackend.cpp
|
TocBackend.cpp
|
||||||
ToolbarBackend.cpp
|
ToolbarBackend.cpp
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/**
|
/**
|
||||||
* \file TextClassList.cpp
|
* \file BaseClassList.cpp
|
||||||
* This file is part of LyX, the document processor.
|
* This file is part of LyX, the document processor.
|
||||||
* Licence details can be found in the file COPYING.
|
* Licence details can be found in the file COPYING.
|
||||||
*
|
*
|
||||||
@ -11,7 +11,7 @@
|
|||||||
|
|
||||||
#include <config.h>
|
#include <config.h>
|
||||||
|
|
||||||
#include "TextClassList.h"
|
#include "BaseClassList.h"
|
||||||
#include "TextClass.h"
|
#include "TextClass.h"
|
||||||
#include "Lexer.h"
|
#include "Lexer.h"
|
||||||
|
|
||||||
@ -35,7 +35,7 @@ using boost::smatch;
|
|||||||
|
|
||||||
// Gets textclass number from name
|
// Gets textclass number from name
|
||||||
pair<bool, BaseClassIndex> const
|
pair<bool, BaseClassIndex> const
|
||||||
TextClassList::numberOfClass(string const & textclass) const
|
BaseClassList::numberOfClass(string const & textclass) const
|
||||||
{
|
{
|
||||||
ClassList::const_iterator cit =
|
ClassList::const_iterator cit =
|
||||||
find_if(classlist_.begin(), classlist_.end(),
|
find_if(classlist_.begin(), classlist_.end(),
|
||||||
@ -51,7 +51,7 @@ TextClassList::numberOfClass(string const & textclass) const
|
|||||||
|
|
||||||
// Gets a textclass structure from number
|
// Gets a textclass structure from number
|
||||||
TextClass const &
|
TextClass const &
|
||||||
TextClassList::operator[](BaseClassIndex textclass) const
|
BaseClassList::operator[](BaseClassIndex textclass) const
|
||||||
{
|
{
|
||||||
if (textclass >= classlist_.size())
|
if (textclass >= classlist_.size())
|
||||||
return classlist_[0];
|
return classlist_[0];
|
||||||
@ -82,14 +82,14 @@ public:
|
|||||||
|
|
||||||
|
|
||||||
// Reads LyX textclass definitions according to textclass config file
|
// Reads LyX textclass definitions according to textclass config file
|
||||||
bool TextClassList::read()
|
bool BaseClassList::read()
|
||||||
{
|
{
|
||||||
Lexer lex(0, 0);
|
Lexer lex(0, 0);
|
||||||
FileName const real_file = libFileSearch("", "textclass.lst");
|
FileName const real_file = libFileSearch("", "textclass.lst");
|
||||||
LYXERR(Debug::TCLASS, "Reading textclasses from `" << real_file << '\'');
|
LYXERR(Debug::TCLASS, "Reading textclasses from `" << real_file << '\'');
|
||||||
|
|
||||||
if (real_file.empty()) {
|
if (real_file.empty()) {
|
||||||
lyxerr << "TextClassList::Read: unable to find "
|
lyxerr << "BaseClassList::Read: unable to find "
|
||||||
"textclass file `"
|
"textclass file `"
|
||||||
<< to_utf8(makeDisplayPath(real_file.absFilename(), 1000))
|
<< to_utf8(makeDisplayPath(real_file.absFilename(), 1000))
|
||||||
<< "'. Exiting." << endl;
|
<< "'. Exiting." << endl;
|
||||||
@ -102,13 +102,13 @@ bool TextClassList::read()
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!lex.setFile(real_file)) {
|
if (!lex.setFile(real_file)) {
|
||||||
lyxerr << "TextClassList::Read: "
|
lyxerr << "BaseClassList::Read: "
|
||||||
"lyxlex was not able to set file: "
|
"lyxlex was not able to set file: "
|
||||||
<< real_file << endl;
|
<< real_file << endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!lex.isOK()) {
|
if (!lex.isOK()) {
|
||||||
lyxerr << "TextClassList::Read: unable to open "
|
lyxerr << "BaseClassList::Read: unable to open "
|
||||||
"textclass file `"
|
"textclass file `"
|
||||||
<< to_utf8(makeDisplayPath(real_file.absFilename(), 1000))
|
<< to_utf8(makeDisplayPath(real_file.absFilename(), 1000))
|
||||||
<< "'\nCheck your installation. LyX can't continue."
|
<< "'\nCheck your installation. LyX can't continue."
|
||||||
@ -157,7 +157,7 @@ bool TextClassList::read()
|
|||||||
// in this case. This gives users a second chance to configure lyx if
|
// in this case. This gives users a second chance to configure lyx if
|
||||||
// initial configuration fails. (c.f. bug 2829)
|
// initial configuration fails. (c.f. bug 2829)
|
||||||
if (classlist_.empty())
|
if (classlist_.empty())
|
||||||
lyxerr << "TextClassList::Read: no textclasses found!"
|
lyxerr << "BaseClassList::Read: no textclasses found!"
|
||||||
<< endl;
|
<< endl;
|
||||||
else
|
else
|
||||||
// Ok everything loaded ok, now sort the list.
|
// Ok everything loaded ok, now sort the list.
|
||||||
@ -166,7 +166,7 @@ bool TextClassList::read()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void TextClassList::reset(BaseClassIndex const textclass) {
|
void BaseClassList::reset(BaseClassIndex const textclass) {
|
||||||
if (textclass >= classlist_.size())
|
if (textclass >= classlist_.size())
|
||||||
return;
|
return;
|
||||||
TextClass const & tc = classlist_[textclass];
|
TextClass const & tc = classlist_[textclass];
|
||||||
@ -177,7 +177,7 @@ void TextClassList::reset(BaseClassIndex const textclass) {
|
|||||||
|
|
||||||
|
|
||||||
pair<bool, BaseClassIndex> const
|
pair<bool, BaseClassIndex> const
|
||||||
TextClassList::addTextClass(string const & textclass, string const & path)
|
BaseClassList::addTextClass(string const & textclass, string const & path)
|
||||||
{
|
{
|
||||||
// only check for textclass.layout file, .cls can be anywhere in $TEXINPUTS
|
// only check for textclass.layout file, .cls can be anywhere in $TEXINPUTS
|
||||||
// NOTE: latex class name is defined in textclass.layout, which can be different from textclass
|
// NOTE: latex class name is defined in textclass.layout, which can be different from textclass
|
||||||
@ -207,7 +207,7 @@ TextClassList::addTextClass(string const & textclass, string const & path)
|
|||||||
// Do not add this local TextClass to classlist_ if it has
|
// Do not add this local TextClass to classlist_ if it has
|
||||||
// already been loaded by, for example, a master buffer.
|
// already been loaded by, for example, a master buffer.
|
||||||
pair<bool, lyx::BaseClassIndex> pp =
|
pair<bool, lyx::BaseClassIndex> pp =
|
||||||
textclasslist.numberOfClass(textclass);
|
baseclasslist.numberOfClass(textclass);
|
||||||
// only layouts from the same directory are considered to be identical.
|
// only layouts from the same directory are considered to be identical.
|
||||||
if (pp.first && classlist_[pp.second].description() == tmpl.description())
|
if (pp.first && classlist_[pp.second].description() == tmpl.description())
|
||||||
return pp;
|
return pp;
|
||||||
@ -226,16 +226,16 @@ TextClassList::addTextClass(string const & textclass, string const & path)
|
|||||||
|
|
||||||
|
|
||||||
// Global variable: textclass table.
|
// Global variable: textclass table.
|
||||||
TextClassList textclasslist;
|
BaseClassList baseclasslist;
|
||||||
|
|
||||||
|
|
||||||
BaseClassIndex defaultTextclass()
|
BaseClassIndex defaultBaseclass()
|
||||||
{
|
{
|
||||||
// We want to return the article class. if `first' is
|
// We want to return the article class. if `first' is
|
||||||
// true in the returned pair, then `second' is the textclass
|
// true in the returned pair, then `second' is the textclass
|
||||||
// number; if it is false, second is 0. In both cases, second
|
// number; if it is false, second is 0. In both cases, second
|
||||||
// is what we want.
|
// is what we want.
|
||||||
return textclasslist.numberOfClass("article").second;
|
return baseclasslist.numberOfClass("article").second;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -245,7 +245,7 @@ bool LyXSetStyle()
|
|||||||
{
|
{
|
||||||
LYXERR(Debug::TCLASS, "LyXSetStyle: parsing configuration...");
|
LYXERR(Debug::TCLASS, "LyXSetStyle: parsing configuration...");
|
||||||
|
|
||||||
if (!textclasslist.read()) {
|
if (!baseclasslist.read()) {
|
||||||
LYXERR(Debug::TCLASS, "LyXSetStyle: an error occured "
|
LYXERR(Debug::TCLASS, "LyXSetStyle: an error occured "
|
||||||
"during parsing.\n Exiting.");
|
"during parsing.\n Exiting.");
|
||||||
return false;
|
return false;
|
@ -1,6 +1,6 @@
|
|||||||
// -*- C++ -*-
|
// -*- C++ -*-
|
||||||
/**
|
/**
|
||||||
* \file TextClassList.h
|
* \file BaseClassList.h
|
||||||
* This file is part of LyX, the document processor.
|
* This file is part of LyX, the document processor.
|
||||||
* Licence details can be found in the file COPYING.
|
* Licence details can be found in the file COPYING.
|
||||||
*
|
*
|
||||||
@ -9,8 +9,8 @@
|
|||||||
* Full author contact details are available in file CREDITS.
|
* Full author contact details are available in file CREDITS.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef TEXTCLASSLIST_H
|
#ifndef BASECLASSLIST_H
|
||||||
#define TEXTCLASSLIST_H
|
#define BASECLASSLIST_H
|
||||||
|
|
||||||
#include "TextClass.h"
|
#include "TextClass.h"
|
||||||
|
|
||||||
@ -26,11 +26,25 @@ class Layout;
|
|||||||
/// Reads the style files
|
/// Reads the style files
|
||||||
extern bool LyXSetStyle();
|
extern bool LyXSetStyle();
|
||||||
|
|
||||||
///
|
/// Index into BaseClassList. Basically a 'strong typedef'.
|
||||||
class TextClassList {
|
class BaseClassIndex {
|
||||||
public:
|
public:
|
||||||
///
|
///
|
||||||
TextClassList() {}
|
typedef size_t base_type;
|
||||||
|
///
|
||||||
|
BaseClassIndex(base_type t) { data_ = t; }
|
||||||
|
///
|
||||||
|
operator base_type() const { return data_; }
|
||||||
|
///
|
||||||
|
private:
|
||||||
|
base_type data_;
|
||||||
|
};
|
||||||
|
|
||||||
|
/// A list of base document classes (*.layout files).
|
||||||
|
class BaseClassList {
|
||||||
|
public:
|
||||||
|
///
|
||||||
|
BaseClassList() {}
|
||||||
///
|
///
|
||||||
typedef std::vector<TextClass> ClassList;
|
typedef std::vector<TextClass> ClassList;
|
||||||
///
|
///
|
||||||
@ -62,18 +76,18 @@ public:
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
/// noncopyable
|
/// noncopyable
|
||||||
TextClassList(TextClassList const &);
|
BaseClassList(BaseClassList const &);
|
||||||
/// nonassignable
|
/// nonassignable
|
||||||
void operator=(TextClassList const &);
|
void operator=(BaseClassList const &);
|
||||||
|
|
||||||
///
|
///
|
||||||
mutable ClassList classlist_;
|
mutable ClassList classlist_;
|
||||||
};
|
};
|
||||||
|
|
||||||
///
|
///
|
||||||
extern TextClassList textclasslist;
|
extern BaseClassList baseclasslist;
|
||||||
///
|
///
|
||||||
BaseClassIndex defaultTextclass();
|
BaseClassIndex defaultBaseclass();
|
||||||
|
|
||||||
|
|
||||||
} // namespace lyx
|
} // namespace lyx
|
@ -14,6 +14,7 @@
|
|||||||
#include "Buffer.h"
|
#include "Buffer.h"
|
||||||
|
|
||||||
#include "Author.h"
|
#include "Author.h"
|
||||||
|
#include "BaseClassList.h"
|
||||||
#include "BiblioInfo.h"
|
#include "BiblioInfo.h"
|
||||||
#include "BranchList.h"
|
#include "BranchList.h"
|
||||||
#include "buffer_funcs.h"
|
#include "buffer_funcs.h"
|
||||||
@ -54,7 +55,6 @@
|
|||||||
#include "sgml.h"
|
#include "sgml.h"
|
||||||
#include "TexRow.h"
|
#include "TexRow.h"
|
||||||
#include "TexStream.h"
|
#include "TexStream.h"
|
||||||
#include "TextClassList.h"
|
|
||||||
#include "Text.h"
|
#include "Text.h"
|
||||||
#include "TocBackend.h"
|
#include "TocBackend.h"
|
||||||
#include "Undo.h"
|
#include "Undo.h"
|
||||||
|
@ -18,6 +18,7 @@
|
|||||||
#include "BufferParams.h"
|
#include "BufferParams.h"
|
||||||
|
|
||||||
#include "Author.h"
|
#include "Author.h"
|
||||||
|
#include "BaseClassList.h"
|
||||||
#include "BranchList.h"
|
#include "BranchList.h"
|
||||||
#include "buffer_funcs.h"
|
#include "buffer_funcs.h"
|
||||||
#include "Bullet.h"
|
#include "Bullet.h"
|
||||||
@ -29,7 +30,6 @@
|
|||||||
#include "Font.h"
|
#include "Font.h"
|
||||||
#include "Lexer.h"
|
#include "Lexer.h"
|
||||||
#include "LyXRC.h"
|
#include "LyXRC.h"
|
||||||
#include "TextClassList.h"
|
|
||||||
#include "OutputParams.h"
|
#include "OutputParams.h"
|
||||||
#include "Spacing.h"
|
#include "Spacing.h"
|
||||||
#include "TexRow.h"
|
#include "TexRow.h"
|
||||||
@ -314,7 +314,7 @@ void BufferParams::MemoryTraits::destroy(BufferParams::Impl * ptr)
|
|||||||
BufferParams::BufferParams()
|
BufferParams::BufferParams()
|
||||||
: pimpl_(new Impl)
|
: pimpl_(new Impl)
|
||||||
{
|
{
|
||||||
setBaseClass(defaultTextclass());
|
setBaseClass(defaultBaseclass());
|
||||||
makeTextClass();
|
makeTextClass();
|
||||||
paragraph_separation = PARSEP_INDENT;
|
paragraph_separation = PARSEP_INDENT;
|
||||||
quotes_language = InsetQuotes::EnglishQ;
|
quotes_language = InsetQuotes::EnglishQ;
|
||||||
@ -466,17 +466,17 @@ string const BufferParams::readToken(Lexer & lex, string const & token,
|
|||||||
pair<bool, lyx::BaseClassIndex> pp =
|
pair<bool, lyx::BaseClassIndex> pp =
|
||||||
make_pair(false, BaseClassIndex(0));
|
make_pair(false, BaseClassIndex(0));
|
||||||
if (!filepath.empty())
|
if (!filepath.empty())
|
||||||
pp = textclasslist.addTextClass(
|
pp = baseclasslist.addTextClass(
|
||||||
classname, filepath.absFilename());
|
classname, filepath.absFilename());
|
||||||
if (pp.first)
|
if (pp.first)
|
||||||
setBaseClass(pp.second);
|
setBaseClass(pp.second);
|
||||||
else {
|
else {
|
||||||
pp = textclasslist.numberOfClass(classname);
|
pp = baseclasslist.numberOfClass(classname);
|
||||||
if (pp.first)
|
if (pp.first)
|
||||||
setBaseClass(pp.second);
|
setBaseClass(pp.second);
|
||||||
else {
|
else {
|
||||||
// a warning will be given for unknown class
|
// a warning will be given for unknown class
|
||||||
setBaseClass(defaultTextclass());
|
setBaseClass(defaultBaseclass());
|
||||||
return classname;
|
return classname;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -678,7 +678,7 @@ void BufferParams::writeFile(ostream & os) const
|
|||||||
// Prints out the buffer info into the .lyx file given by file
|
// Prints out the buffer info into the .lyx file given by file
|
||||||
|
|
||||||
// the textclass
|
// the textclass
|
||||||
os << "\\textclass " << textclasslist[pimpl_->baseClass_].name() << '\n';
|
os << "\\textclass " << baseclasslist[pimpl_->baseClass_].name() << '\n';
|
||||||
|
|
||||||
// then the preamble
|
// then the preamble
|
||||||
if (!preamble.empty()) {
|
if (!preamble.empty()) {
|
||||||
@ -1344,7 +1344,7 @@ bool BufferParams::writeLaTeX(odocstream & os, LaTeXFeatures & features,
|
|||||||
|
|
||||||
void BufferParams::useClassDefaults()
|
void BufferParams::useClassDefaults()
|
||||||
{
|
{
|
||||||
TextClass const & tclass = textclasslist[pimpl_->baseClass_];
|
TextClass const & tclass = baseclasslist[pimpl_->baseClass_];
|
||||||
|
|
||||||
sides = tclass.sides();
|
sides = tclass.sides();
|
||||||
columns = tclass.columns();
|
columns = tclass.columns();
|
||||||
@ -1360,7 +1360,7 @@ void BufferParams::useClassDefaults()
|
|||||||
|
|
||||||
bool BufferParams::hasClassDefaults() const
|
bool BufferParams::hasClassDefaults() const
|
||||||
{
|
{
|
||||||
TextClass const & tclass = textclasslist[pimpl_->baseClass_];
|
TextClass const & tclass = baseclasslist[pimpl_->baseClass_];
|
||||||
|
|
||||||
return sides == tclass.sides()
|
return sides == tclass.sides()
|
||||||
&& columns == tclass.columns()
|
&& columns == tclass.columns()
|
||||||
@ -1389,14 +1389,14 @@ void BufferParams::setTextClass(TextClassPtr tc) {
|
|||||||
|
|
||||||
bool BufferParams::setBaseClass(BaseClassIndex tc)
|
bool BufferParams::setBaseClass(BaseClassIndex tc)
|
||||||
{
|
{
|
||||||
if (textclasslist[tc].load()) {
|
if (baseclasslist[tc].load()) {
|
||||||
pimpl_->baseClass_ = tc;
|
pimpl_->baseClass_ = tc;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
docstring s =
|
docstring s =
|
||||||
bformat(_("The document class %1$s could not be loaded."),
|
bformat(_("The document class %1$s could not be loaded."),
|
||||||
from_utf8(textclasslist[tc].name()));
|
from_utf8(baseclasslist[tc].name()));
|
||||||
frontend::Alert::error(_("Could not load class"), s);
|
frontend::Alert::error(_("Could not load class"), s);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -1410,7 +1410,7 @@ BaseClassIndex BufferParams::baseClass() const
|
|||||||
|
|
||||||
void BufferParams::makeTextClass()
|
void BufferParams::makeTextClass()
|
||||||
{
|
{
|
||||||
textClass_.reset(new TextClass(textclasslist[baseClass()]));
|
textClass_.reset(new TextClass(baseclasslist[baseClass()]));
|
||||||
|
|
||||||
//FIXME It might be worth loading the children's modules here,
|
//FIXME It might be worth loading the children's modules here,
|
||||||
//just as we load their bibliographies and such, instead of just
|
//just as we load their bibliographies and such, instead of just
|
||||||
|
@ -33,6 +33,7 @@ class FileName;
|
|||||||
}
|
}
|
||||||
|
|
||||||
class AuthorList;
|
class AuthorList;
|
||||||
|
class BaseClassIndex;
|
||||||
class BranchList;
|
class BranchList;
|
||||||
class Bullet;
|
class Bullet;
|
||||||
class Encoding;
|
class Encoding;
|
||||||
@ -42,7 +43,6 @@ class LatexFeatures;
|
|||||||
class PDFOptions;
|
class PDFOptions;
|
||||||
class Spacing;
|
class Spacing;
|
||||||
class TextClass;
|
class TextClass;
|
||||||
class BaseClassIndex;
|
|
||||||
class TexRow;
|
class TexRow;
|
||||||
class VSpace;
|
class VSpace;
|
||||||
|
|
||||||
|
@ -15,6 +15,7 @@
|
|||||||
|
|
||||||
#include "CutAndPaste.h"
|
#include "CutAndPaste.h"
|
||||||
|
|
||||||
|
#include "BaseClassList.h"
|
||||||
#include "Buffer.h"
|
#include "Buffer.h"
|
||||||
#include "buffer_funcs.h"
|
#include "buffer_funcs.h"
|
||||||
#include "BufferParams.h"
|
#include "BufferParams.h"
|
||||||
@ -30,7 +31,6 @@
|
|||||||
#include "LyXFunc.h"
|
#include "LyXFunc.h"
|
||||||
#include "LyXRC.h"
|
#include "LyXRC.h"
|
||||||
#include "Text.h"
|
#include "Text.h"
|
||||||
#include "TextClassList.h"
|
|
||||||
#include "Paragraph.h"
|
#include "Paragraph.h"
|
||||||
#include "paragraph_funcs.h"
|
#include "paragraph_funcs.h"
|
||||||
#include "ParagraphParameters.h"
|
#include "ParagraphParameters.h"
|
||||||
|
@ -17,6 +17,7 @@
|
|||||||
|
|
||||||
#include "LyX.h"
|
#include "LyX.h"
|
||||||
|
|
||||||
|
#include "BaseClassList.h"
|
||||||
#include "Buffer.h"
|
#include "Buffer.h"
|
||||||
#include "BufferList.h"
|
#include "BufferList.h"
|
||||||
#include "CmdDef.h"
|
#include "CmdDef.h"
|
||||||
@ -39,7 +40,6 @@
|
|||||||
#include "Server.h"
|
#include "Server.h"
|
||||||
#include "ServerSocket.h"
|
#include "ServerSocket.h"
|
||||||
#include "Session.h"
|
#include "Session.h"
|
||||||
#include "TextClassList.h"
|
|
||||||
#include "ToolbarBackend.h"
|
#include "ToolbarBackend.h"
|
||||||
|
|
||||||
#include "frontends/alert.h"
|
#include "frontends/alert.h"
|
||||||
@ -582,7 +582,7 @@ void LyX::execBatchCommands()
|
|||||||
// aknowledged.
|
// aknowledged.
|
||||||
|
|
||||||
// if reconfiguration is needed.
|
// if reconfiguration is needed.
|
||||||
while (textclasslist.empty()) {
|
while (baseclasslist.empty()) {
|
||||||
switch (Alert::prompt(
|
switch (Alert::prompt(
|
||||||
_("No textclass is found"),
|
_("No textclass is found"),
|
||||||
_("LyX cannot continue because no textclass is found. "
|
_("LyX cannot continue because no textclass is found. "
|
||||||
|
@ -21,6 +21,7 @@
|
|||||||
|
|
||||||
#include "LyXFunc.h"
|
#include "LyXFunc.h"
|
||||||
|
|
||||||
|
#include "BaseClassList.h"
|
||||||
#include "BranchList.h"
|
#include "BranchList.h"
|
||||||
#include "buffer_funcs.h"
|
#include "buffer_funcs.h"
|
||||||
#include "Buffer.h"
|
#include "Buffer.h"
|
||||||
@ -54,7 +55,6 @@
|
|||||||
#include "Row.h"
|
#include "Row.h"
|
||||||
#include "Server.h"
|
#include "Server.h"
|
||||||
#include "Session.h"
|
#include "Session.h"
|
||||||
#include "TextClassList.h"
|
|
||||||
|
|
||||||
#include "insets/InsetBox.h"
|
#include "insets/InsetBox.h"
|
||||||
#include "insets/InsetBranch.h"
|
#include "insets/InsetBranch.h"
|
||||||
@ -715,7 +715,7 @@ void showPrintError(string const & name)
|
|||||||
void loadTextClass(string const & name, string const & buf_path)
|
void loadTextClass(string const & name, string const & buf_path)
|
||||||
{
|
{
|
||||||
pair<bool, BaseClassIndex> const tc_pair =
|
pair<bool, BaseClassIndex> const tc_pair =
|
||||||
textclasslist.numberOfClass(name);
|
baseclasslist.numberOfClass(name);
|
||||||
|
|
||||||
if (!tc_pair.first) {
|
if (!tc_pair.first) {
|
||||||
lyxerr << "Document class \"" << name
|
lyxerr << "Document class \"" << name
|
||||||
@ -726,10 +726,10 @@ void loadTextClass(string const & name, string const & buf_path)
|
|||||||
|
|
||||||
BaseClassIndex const tc = tc_pair.second;
|
BaseClassIndex const tc = tc_pair.second;
|
||||||
|
|
||||||
if (!textclasslist[tc].load(buf_path)) {
|
if (!baseclasslist[tc].load(buf_path)) {
|
||||||
docstring s = bformat(_("The document class %1$s."
|
docstring s = bformat(_("The document class %1$s."
|
||||||
"could not be loaded."),
|
"could not be loaded."),
|
||||||
from_utf8(textclasslist[tc].name()));
|
from_utf8(baseclasslist[tc].name()));
|
||||||
Alert::error(_("Could not load class"), s);
|
Alert::error(_("Could not load class"), s);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1608,7 +1608,7 @@ void LyXFunc::dispatch(FuncRequest const & cmd)
|
|||||||
loadTextClass(argument, buffer->filePath());
|
loadTextClass(argument, buffer->filePath());
|
||||||
|
|
||||||
pair<bool, BaseClassIndex> const tc_pair =
|
pair<bool, BaseClassIndex> const tc_pair =
|
||||||
textclasslist.numberOfClass(argument);
|
baseclasslist.numberOfClass(argument);
|
||||||
|
|
||||||
if (!tc_pair.first)
|
if (!tc_pair.first)
|
||||||
break;
|
break;
|
||||||
@ -1635,7 +1635,7 @@ void LyXFunc::dispatch(FuncRequest const & cmd)
|
|||||||
Buffer * buffer = lyx_view_->buffer();
|
Buffer * buffer = lyx_view_->buffer();
|
||||||
TextClassPtr oldClass = buffer->params().textClassPtr();
|
TextClassPtr oldClass = buffer->params().textClassPtr();
|
||||||
BaseClassIndex const tc = buffer->params().baseClass();
|
BaseClassIndex const tc = buffer->params().baseClass();
|
||||||
textclasslist.reset(tc);
|
baseclasslist.reset(tc);
|
||||||
buffer->params().setBaseClass(tc);
|
buffer->params().setBaseClass(tc);
|
||||||
buffer->params().makeTextClass();
|
buffer->params().makeTextClass();
|
||||||
updateLayout(oldClass, buffer);
|
updateLayout(oldClass, buffer);
|
||||||
|
@ -76,6 +76,7 @@ endif
|
|||||||
|
|
||||||
SOURCEFILESCORE = \
|
SOURCEFILESCORE = \
|
||||||
Author.cpp \
|
Author.cpp \
|
||||||
|
BaseClassList.cpp \
|
||||||
BiblioInfo.cpp \
|
BiblioInfo.cpp \
|
||||||
Bidi.cpp \
|
Bidi.cpp \
|
||||||
boost.cpp \
|
boost.cpp \
|
||||||
@ -156,7 +157,6 @@ SOURCEFILESCORE = \
|
|||||||
Text2.cpp \
|
Text2.cpp \
|
||||||
Text3.cpp \
|
Text3.cpp \
|
||||||
TexStream.cpp \
|
TexStream.cpp \
|
||||||
TextClassList.cpp \
|
|
||||||
TextMetrics.cpp \
|
TextMetrics.cpp \
|
||||||
TocBackend.cpp \
|
TocBackend.cpp \
|
||||||
ToolbarBackend.cpp \
|
ToolbarBackend.cpp \
|
||||||
@ -170,6 +170,7 @@ SOURCEFILESCORE = \
|
|||||||
|
|
||||||
HEADERFILESCORE = \
|
HEADERFILESCORE = \
|
||||||
Author.h \
|
Author.h \
|
||||||
|
BaseClassList.h \
|
||||||
BiblioInfo.h \
|
BiblioInfo.h \
|
||||||
Bidi.h \
|
Bidi.h \
|
||||||
BranchList.h \
|
BranchList.h \
|
||||||
@ -260,7 +261,6 @@ HEADERFILESCORE = \
|
|||||||
TexStream.h \
|
TexStream.h \
|
||||||
Text.h \
|
Text.h \
|
||||||
TextClass.h \
|
TextClass.h \
|
||||||
TextClassList.h \
|
|
||||||
TextClassPtr.h \
|
TextClassPtr.h \
|
||||||
TextMetrics.h \
|
TextMetrics.h \
|
||||||
TocBackend.h \
|
TocBackend.h \
|
||||||
|
@ -76,7 +76,7 @@ public:
|
|||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
//Much of this is borrowed from TextClassList::read()
|
//Much of this is borrowed from BaseClassList::read()
|
||||||
bool ModuleList::load()
|
bool ModuleList::load()
|
||||||
{
|
{
|
||||||
FileName const real_file = libFileSearch("", "lyxmodules.lst");
|
FileName const real_file = libFileSearch("", "lyxmodules.lst");
|
||||||
|
@ -38,21 +38,6 @@ class FloatList;
|
|||||||
/// List of inset layouts
|
/// List of inset layouts
|
||||||
typedef std::map<docstring, InsetLayout> InsetLayouts;
|
typedef std::map<docstring, InsetLayout> InsetLayouts;
|
||||||
|
|
||||||
/// Index into global list of base classes (i.e., *.layout).
|
|
||||||
/// Basically a 'strong typedef'.
|
|
||||||
class BaseClassIndex {
|
|
||||||
public:
|
|
||||||
///
|
|
||||||
typedef size_t base_type;
|
|
||||||
///
|
|
||||||
BaseClassIndex(base_type t) { data_ = t; }
|
|
||||||
///
|
|
||||||
operator base_type() const { return data_; }
|
|
||||||
///
|
|
||||||
private:
|
|
||||||
base_type data_;
|
|
||||||
};
|
|
||||||
|
|
||||||
/// Stores the layout specification of a LyX document class.
|
/// Stores the layout specification of a LyX document class.
|
||||||
class TextClass {
|
class TextClass {
|
||||||
public:
|
public:
|
||||||
|
@ -12,6 +12,7 @@
|
|||||||
|
|
||||||
#include <config.h>
|
#include <config.h>
|
||||||
|
|
||||||
|
#include "BaseClassList.h"
|
||||||
#include "buffer_funcs.h"
|
#include "buffer_funcs.h"
|
||||||
#include "Buffer.h"
|
#include "Buffer.h"
|
||||||
#include "BufferList.h"
|
#include "BufferList.h"
|
||||||
@ -29,7 +30,6 @@
|
|||||||
#include "LayoutPtr.h"
|
#include "LayoutPtr.h"
|
||||||
#include "LyX.h"
|
#include "LyX.h"
|
||||||
#include "TextClass.h"
|
#include "TextClass.h"
|
||||||
#include "TextClassList.h"
|
|
||||||
#include "Paragraph.h"
|
#include "Paragraph.h"
|
||||||
#include "paragraph_funcs.h"
|
#include "paragraph_funcs.h"
|
||||||
#include "ParagraphList.h"
|
#include "ParagraphList.h"
|
||||||
|
@ -13,6 +13,7 @@
|
|||||||
|
|
||||||
#include "GuiDocument.h"
|
#include "GuiDocument.h"
|
||||||
|
|
||||||
|
#include "BaseClassList.h"
|
||||||
#include "BranchList.h"
|
#include "BranchList.h"
|
||||||
#include "buffer_funcs.h"
|
#include "buffer_funcs.h"
|
||||||
#include "Buffer.h"
|
#include "Buffer.h"
|
||||||
@ -37,7 +38,6 @@
|
|||||||
#include "PDFOptions.h"
|
#include "PDFOptions.h"
|
||||||
#include "qt_helpers.h"
|
#include "qt_helpers.h"
|
||||||
#include "Spacing.h"
|
#include "Spacing.h"
|
||||||
#include "TextClassList.h"
|
|
||||||
#include "Validator.h"
|
#include "Validator.h"
|
||||||
|
|
||||||
#include "insets/InsetListingsParams.h"
|
#include "insets/InsetListingsParams.h"
|
||||||
@ -879,8 +879,8 @@ GuiDocument::GuiDocument(GuiView & lv)
|
|||||||
//FIXME This seems too involved with the kernel. Some of this
|
//FIXME This seems too involved with the kernel. Some of this
|
||||||
//should be moved to the kernel---which should perhaps just
|
//should be moved to the kernel---which should perhaps just
|
||||||
//give us a list of entries or something of the sort.
|
//give us a list of entries or something of the sort.
|
||||||
for (TextClassList::const_iterator cit = textclasslist.begin();
|
for (BaseClassList::const_iterator cit = baseclasslist.begin();
|
||||||
cit != textclasslist.end(); ++cit) {
|
cit != baseclasslist.end(); ++cit) {
|
||||||
if (cit->isTeXClassAvailable()) {
|
if (cit->isTeXClassAvailable()) {
|
||||||
latexModule->classCO->addItem(toqstr(cit->description()));
|
latexModule->classCO->addItem(toqstr(cit->description()));
|
||||||
} else {
|
} else {
|
||||||
@ -2113,7 +2113,7 @@ vector<GuiDocument::modInfoStruct> const GuiDocument::getSelectedModules()
|
|||||||
|
|
||||||
TextClass const & GuiDocument::textClass() const
|
TextClass const & GuiDocument::textClass() const
|
||||||
{
|
{
|
||||||
return textclasslist[bp_.baseClass()];
|
return baseclasslist[bp_.baseClass()];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -14,6 +14,7 @@
|
|||||||
|
|
||||||
#include "InsetInclude.h"
|
#include "InsetInclude.h"
|
||||||
|
|
||||||
|
#include "BaseClassList.h"
|
||||||
#include "Buffer.h"
|
#include "Buffer.h"
|
||||||
#include "buffer_funcs.h"
|
#include "buffer_funcs.h"
|
||||||
#include "BufferList.h"
|
#include "BufferList.h"
|
||||||
|
@ -27,7 +27,7 @@
|
|||||||
#include "MenuBackend.h"
|
#include "MenuBackend.h"
|
||||||
#include "MetricsInfo.h"
|
#include "MetricsInfo.h"
|
||||||
#include "ParagraphParameters.h"
|
#include "ParagraphParameters.h"
|
||||||
#include "TextClassList.h"
|
#include "BaseClassList.h"
|
||||||
|
|
||||||
#include "frontends/Application.h"
|
#include "frontends/Application.h"
|
||||||
|
|
||||||
@ -202,7 +202,7 @@ void InsetInfo::updateInfo(Buffer const & buf)
|
|||||||
break;
|
break;
|
||||||
case TEXTCLASS_INFO: {
|
case TEXTCLASS_INFO: {
|
||||||
// name_ is the class name
|
// name_ is the class name
|
||||||
pair<bool, lyx::BaseClassIndex> pp = textclasslist.numberOfClass(name_);
|
pair<bool, lyx::BaseClassIndex> pp = baseclasslist.numberOfClass(name_);
|
||||||
setText(pp.first ? _("yes") : _("no"),
|
setText(pp.first ? _("yes") : _("no"),
|
||||||
bp.getFont(), false);
|
bp.getFont(), false);
|
||||||
break;
|
break;
|
||||||
|
Loading…
Reference in New Issue
Block a user