1999-09-27 18:44:28 +00:00
|
|
|
|
// -*- C++ -*-
|
2003-08-23 00:17:00 +00:00
|
|
|
|
/**
|
2007-04-26 04:41:58 +00:00
|
|
|
|
* \file BufferParams.h
|
2003-08-23 00:17:00 +00:00
|
|
|
|
* This file is part of LyX, the document processor.
|
|
|
|
|
* Licence details can be found in the file COPYING.
|
2002-03-21 17:27:08 +00:00
|
|
|
|
*
|
2003-08-23 00:17:00 +00:00
|
|
|
|
* \author Lars Gullik Bj<EFBFBD>nnes
|
|
|
|
|
* \author Jean-Marc Lasgouttes
|
|
|
|
|
* \author John Levon
|
|
|
|
|
* \author Andr<EFBFBD> P<EFBFBD>nitz
|
2002-03-21 17:27:08 +00:00
|
|
|
|
*
|
2003-08-23 00:17:00 +00:00
|
|
|
|
* Full author contact details are available in file CREDITS.
|
|
|
|
|
*/
|
1999-09-27 18:44:28 +00:00
|
|
|
|
|
1999-11-04 01:40:20 +00:00
|
|
|
|
#ifndef BUFFERPARAMS_H
|
|
|
|
|
#define BUFFERPARAMS_H
|
1999-09-27 18:44:28 +00:00
|
|
|
|
|
2007-10-28 18:51:54 +00:00
|
|
|
|
#include "Font.h"
|
2007-08-20 17:04:36 +00:00
|
|
|
|
#include "BiblioInfo.h"
|
2003-07-26 23:04:39 +00:00
|
|
|
|
#include "paper.h"
|
2007-11-07 23:25:08 +00:00
|
|
|
|
#include "TextClassPtr.h"
|
2001-12-28 13:26:54 +00:00
|
|
|
|
|
2007-04-25 01:24:38 +00:00
|
|
|
|
#include "insets/InsetQuotes.h"
|
2001-12-28 13:26:54 +00:00
|
|
|
|
|
2003-09-15 20:23:57 +00:00
|
|
|
|
#include "support/copied_ptr.h"
|
2003-09-07 01:45:40 +00:00
|
|
|
|
#include "support/types.h"
|
|
|
|
|
|
2003-03-12 23:25:59 +00:00
|
|
|
|
#include <vector>
|
1999-09-27 18:44:28 +00:00
|
|
|
|
|
2006-10-21 00:16:43 +00:00
|
|
|
|
namespace lyx {
|
|
|
|
|
|
2007-11-28 15:25:07 +00:00
|
|
|
|
namespace support {
|
|
|
|
|
class FileName;
|
|
|
|
|
}
|
|
|
|
|
|
2003-09-09 17:00:19 +00:00
|
|
|
|
class AuthorList;
|
|
|
|
|
class BranchList;
|
|
|
|
|
class Bullet;
|
2006-12-10 16:08:52 +00:00
|
|
|
|
class Encoding;
|
2007-11-07 23:25:08 +00:00
|
|
|
|
class Language;
|
2007-04-26 11:30:54 +00:00
|
|
|
|
class Lexer;
|
2003-02-16 00:54:43 +00:00
|
|
|
|
class LatexFeatures;
|
2007-11-07 23:25:08 +00:00
|
|
|
|
class PDFOptions;
|
2003-09-09 17:00:19 +00:00
|
|
|
|
class Spacing;
|
2007-11-07 23:25:08 +00:00
|
|
|
|
class TextClass;
|
2003-02-16 00:54:43 +00:00
|
|
|
|
class TexRow;
|
2003-09-09 17:00:19 +00:00
|
|
|
|
class VSpace;
|
2000-03-17 10:14:46 +00:00
|
|
|
|
|
2000-08-07 20:58:24 +00:00
|
|
|
|
/** Buffer parameters.
|
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
2007-08-23 16:41:13 +00:00
|
|
|
|
* This class contains all the parameters for this buffer's use. Some
|
2003-09-15 20:23:57 +00:00
|
|
|
|
* work needs to be done on this class to make it nice. Now everything
|
|
|
|
|
* is in public.
|
|
|
|
|
*/
|
1999-09-27 18:44:28 +00:00
|
|
|
|
class BufferParams {
|
|
|
|
|
public:
|
1999-11-15 12:01:38 +00:00
|
|
|
|
///
|
|
|
|
|
enum PARSEP {
|
|
|
|
|
///
|
|
|
|
|
PARSEP_INDENT,
|
|
|
|
|
///
|
|
|
|
|
PARSEP_SKIP
|
|
|
|
|
};
|
|
|
|
|
///
|
1999-09-27 18:44:28 +00:00
|
|
|
|
BufferParams();
|
2003-09-09 17:00:19 +00:00
|
|
|
|
~BufferParams();
|
1999-09-27 18:44:28 +00:00
|
|
|
|
|
2007-05-01 08:26:40 +00:00
|
|
|
|
/// get l10n translated to the buffers language
|
|
|
|
|
docstring const B_(std::string const & l10n) const;
|
|
|
|
|
|
2003-03-12 02:39:12 +00:00
|
|
|
|
/// read a header token, if unrecognised, return it or an unknown class name
|
2007-11-28 15:25:07 +00:00
|
|
|
|
std::string const readToken(Lexer & lex,
|
|
|
|
|
std::string const & token, ///< token to read.
|
|
|
|
|
support::FileName const & filepath); ///< where to look for local layout file.
|
2003-03-12 02:39:12 +00:00
|
|
|
|
|
1999-09-27 18:44:28 +00:00
|
|
|
|
///
|
2000-04-04 00:19:15 +00:00
|
|
|
|
void writeFile(std::ostream &) const;
|
1999-09-27 18:44:28 +00:00
|
|
|
|
|
2007-12-14 14:51:47 +00:00
|
|
|
|
/// check what features are implied by the buffer parameters.
|
|
|
|
|
void validate(LaTeXFeatures &) const;
|
|
|
|
|
|
2003-05-22 22:44:30 +00:00
|
|
|
|
/** \returns true if the babel package is used (interogates
|
2003-09-15 20:23:57 +00:00
|
|
|
|
* the BufferParams and a LyXRC variable).
|
|
|
|
|
* This returned value can then be passed to the insets...
|
2003-05-22 22:44:30 +00:00
|
|
|
|
*/
|
2006-10-21 00:16:43 +00:00
|
|
|
|
bool writeLaTeX(odocstream &, LaTeXFeatures &, TexRow &) const;
|
2003-02-16 00:54:43 +00:00
|
|
|
|
|
1999-09-27 18:44:28 +00:00
|
|
|
|
///
|
|
|
|
|
void useClassDefaults();
|
|
|
|
|
|
2001-09-17 15:39:58 +00:00
|
|
|
|
///
|
|
|
|
|
bool hasClassDefaults() const;
|
|
|
|
|
|
1999-09-27 18:44:28 +00:00
|
|
|
|
///
|
2003-09-09 17:00:19 +00:00
|
|
|
|
VSpace const & getDefSkip() const;
|
2000-02-04 09:38:32 +00:00
|
|
|
|
|
|
|
|
|
///
|
2003-09-09 17:00:19 +00:00
|
|
|
|
void setDefSkip(VSpace const & vs);
|
1999-09-27 18:44:28 +00:00
|
|
|
|
|
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
2007-08-23 16:41:13 +00:00
|
|
|
|
/** Whether paragraphs are separated by using a indent like in
|
2003-09-15 20:23:57 +00:00
|
|
|
|
* articles or by using a little skip like in letters.
|
|
|
|
|
*/
|
2002-03-21 17:27:08 +00:00
|
|
|
|
PARSEP paragraph_separation;
|
1999-09-27 18:44:28 +00:00
|
|
|
|
///
|
2001-11-29 17:12:21 +00:00
|
|
|
|
InsetQuotes::quote_language quotes_language;
|
1999-09-27 18:44:28 +00:00
|
|
|
|
///
|
2001-11-29 17:12:21 +00:00
|
|
|
|
InsetQuotes::quote_times quotes_times;
|
1999-09-27 18:44:28 +00:00
|
|
|
|
///
|
2003-10-06 15:43:21 +00:00
|
|
|
|
std::string fontsize;
|
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
2007-08-23 16:41:13 +00:00
|
|
|
|
///Get the LyX TextClass (that is, the layout file) this document is using.
|
|
|
|
|
textclass_type getBaseClass() const;
|
2008-01-05 17:04:56 +00:00
|
|
|
|
/// Set the LyX TextClass (that is, the layout file) this document is using.
|
|
|
|
|
/// NOTE: This does not call makeTextClass() to update the local TextClass.
|
|
|
|
|
/// That needs to be done manually.
|
This patch continues 19964. It takes advantage of the work there to simplify a few things elsewhere. First, in ControlDocument::dispatchParams(), we're setting the TextClass and then dispatching the BufferParams, which sets it again now. So we can get rid of the first call. This, however, requires loading the TextClass somewhere other than LFUN_TEXTCLASS_APPLY, which I do in BufferParams::setBaseClass(), which is when you'd actually need to do it. So I've moved some of the loading logic there. (It seemed a good idea to make setBaseClass() return whether it was successful, then, though this isn't used at the moment.)
That makes another simplification both possible and desirable. For some reason, whenever you change the Document Class combobox in Document Settings, LyX tries to read whatever you choose _before_ you try to hit "Apply". Why? I see no good reason. You get the warning earlier that way, but maybe you weren't going to try to load it anyway and were going to change your mind. So I have removed that behavior, in which case you'll get the warning when you try to apply the parameters. This means we can also remove ControlDocument::loadTextclass().
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@19965 a592a061-630c-0410-9148-cb99ea01b6c8
2007-09-01 04:03:24 +00:00
|
|
|
|
bool setBaseClass(textclass_type);
|
2008-01-05 17:04:56 +00:00
|
|
|
|
/// Adds the module information to the baseClass information to
|
|
|
|
|
/// create our local TextClass.
|
|
|
|
|
void makeTextClass();
|
|
|
|
|
/// Returns the TextClass currently in use: the BaseClass as modified
|
|
|
|
|
/// by modules.
|
2007-04-29 19:53:54 +00:00
|
|
|
|
TextClass const & getTextClass() const;
|
2008-01-05 17:04:56 +00:00
|
|
|
|
/// Returns a pointer to the TextClass currently in use: the BaseClass
|
|
|
|
|
/// as modified by modules. (See \file TextClassPtr.h for the typedef.)
|
2007-09-18 17:46:14 +00:00
|
|
|
|
TextClassPtr getTextClassPtr() const;
|
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
2007-08-23 16:41:13 +00:00
|
|
|
|
/// 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().
|
2007-09-18 17:46:14 +00:00
|
|
|
|
void setTextClass(TextClassPtr);
|
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 patch adds the backend. The ModuleList class holds a list of the available modules, which are retrieved from lyxmodules.lst, itself generated by configure.py. There are two LFUNs available: modules-clear and module-add, which do the obvious thing; you can test by typing these into the minibuffer, along with the name of one of the available modules: URL (a CharStyle), Endnote (a Custom Inset), and---with the spaces---End To Foot (View>LaTeX and look at the user preamble), which are themselves in lib/layouts. There are some others, too, that allow theorems to be added to classes like article and book.
The GUI will come next.
Issues: (i) The configure.py script could be improved. It'd be nice, for example, if it tested for the presence of the LaTeX packages a particular module needs. But this would mean re-working the LaTeX script, and I don't know how to do that. Note that at present, the packages are ignored. This will change shortly. (ii) I've used std::string in LyXModule, following what seemed to be a precedent in TextClass. If some of these should be docstrings, please let me know, and I'll change them. (iii) There is at present no distinction between LaTeX and DocBook modules. Should there be? That is: Should there be modules that are available when the document class is a LaTeX class and others that are available only when it is DocBook? Or should there just be one set of modules? Each module can of course indicate for what it is suitable in its description.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@19893 a592a061-630c-0410-9148-cb99ea01b6c8
2007-08-29 17:59:49 +00:00
|
|
|
|
/// List of modules in use
|
|
|
|
|
std::vector<std::string> const & getModules() const;
|
|
|
|
|
/// Add a module to the list of modules in use.
|
|
|
|
|
/// Returns true if module was successfully added.
|
2008-01-05 17:04:56 +00:00
|
|
|
|
/// The makeClass variable signals whether to call makeTextClass. This
|
|
|
|
|
/// need not be done if we know this isn't the final time through, or if
|
|
|
|
|
/// the BufferParams do not represent the parameters for an actual buffer
|
|
|
|
|
/// (as in GuiDocument).
|
2008-01-06 18:17:25 +00:00
|
|
|
|
bool addLayoutModule(std::string const & modName);
|
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 patch adds the backend. The ModuleList class holds a list of the available modules, which are retrieved from lyxmodules.lst, itself generated by configure.py. There are two LFUNs available: modules-clear and module-add, which do the obvious thing; you can test by typing these into the minibuffer, along with the name of one of the available modules: URL (a CharStyle), Endnote (a Custom Inset), and---with the spaces---End To Foot (View>LaTeX and look at the user preamble), which are themselves in lib/layouts. There are some others, too, that allow theorems to be added to classes like article and book.
The GUI will come next.
Issues: (i) The configure.py script could be improved. It'd be nice, for example, if it tested for the presence of the LaTeX packages a particular module needs. But this would mean re-working the LaTeX script, and I don't know how to do that. Note that at present, the packages are ignored. This will change shortly. (ii) I've used std::string in LyXModule, following what seemed to be a precedent in TextClass. If some of these should be docstrings, please let me know, and I'll change them. (iii) There is at present no distinction between LaTeX and DocBook modules. Should there be? That is: Should there be modules that are available when the document class is a LaTeX class and others that are available only when it is DocBook? Or should there just be one set of modules? Each module can of course indicate for what it is suitable in its description.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@19893 a592a061-630c-0410-9148-cb99ea01b6c8
2007-08-29 17:59:49 +00:00
|
|
|
|
/// Clear the list
|
|
|
|
|
void clearLayoutModules();
|
1999-09-27 18:44:28 +00:00
|
|
|
|
|
2006-02-05 13:20:16 +00:00
|
|
|
|
/// returns the main font for the buffer (document)
|
2007-04-29 18:17:15 +00:00
|
|
|
|
Font const getFont() const;
|
2006-02-05 13:20:16 +00:00
|
|
|
|
|
1999-09-27 18:44:28 +00:00
|
|
|
|
/* this are for the PaperLayout */
|
2005-07-16 16:57:55 +00:00
|
|
|
|
/// the papersize
|
2003-06-10 14:39:45 +00:00
|
|
|
|
PAPER_SIZE papersize;
|
2001-11-29 17:12:21 +00:00
|
|
|
|
///
|
2003-06-10 14:39:45 +00:00
|
|
|
|
PAPER_ORIENTATION orientation;
|
2005-07-16 16:57:55 +00:00
|
|
|
|
/// use custom margins
|
2001-11-29 17:12:21 +00:00
|
|
|
|
bool use_geometry;
|
|
|
|
|
///
|
2003-10-06 15:43:21 +00:00
|
|
|
|
std::string paperwidth;
|
2001-11-29 17:12:21 +00:00
|
|
|
|
///
|
2003-10-06 15:43:21 +00:00
|
|
|
|
std::string paperheight;
|
2001-11-29 17:12:21 +00:00
|
|
|
|
///
|
2003-10-06 15:43:21 +00:00
|
|
|
|
std::string leftmargin;
|
2001-11-29 17:12:21 +00:00
|
|
|
|
///
|
2003-10-06 15:43:21 +00:00
|
|
|
|
std::string topmargin;
|
2001-11-29 17:12:21 +00:00
|
|
|
|
///
|
2003-10-06 15:43:21 +00:00
|
|
|
|
std::string rightmargin;
|
2001-11-29 17:12:21 +00:00
|
|
|
|
///
|
2003-10-06 15:43:21 +00:00
|
|
|
|
std::string bottommargin;
|
2001-11-29 17:12:21 +00:00
|
|
|
|
///
|
2003-10-06 15:43:21 +00:00
|
|
|
|
std::string headheight;
|
2001-11-29 17:12:21 +00:00
|
|
|
|
///
|
2003-10-06 15:43:21 +00:00
|
|
|
|
std::string headsep;
|
2001-11-29 17:12:21 +00:00
|
|
|
|
///
|
2003-10-06 15:43:21 +00:00
|
|
|
|
std::string footskip;
|
2001-11-29 17:12:21 +00:00
|
|
|
|
|
|
|
|
|
/* some LaTeX options */
|
1999-09-27 18:44:28 +00:00
|
|
|
|
/// The graphics driver
|
2003-10-06 15:43:21 +00:00
|
|
|
|
std::string graphicsDriver;
|
The Grand Font Selection Redesign:
* lib/lyx2lyx/LyX.py (format_relation): add file format 247 (from Georg BAUM).
* lib/lyx2lyx/lyx_1_5.py: add convert_font_settings, revert_font_settings (from Georg BAUM).
* lib/chkconfig.ltx: Test for newly supported font packages
* lib/doc/LaTeXConfig.lyx.in: document newly supported font packages
* lib/doc/UserGuide.lyx: document new UI.
* lib/doc/Extended.lyx: update PostScript font documentation
* development/FORMAT: document file format change 246->247.
* src/tex-strings.[Ch]: new strings tex_fonts_roman, tex_fonts_sans,
tex_fonts_monospaced (with GUI equivalents).
* src/buffer.C: Format up to 247.
* src/bufferparams.C:
new params fontsRoman, fontsSans, fontsTypewriter, fontsDefaultFamily,
fontsSC, fontsOSF, fontsSansScale and fontsTypewriterScale
(LyXFont const BufferParams::getFont): consider switch of default family.
(string const BufferParams::loadFonts): new method to get all the LaTeX
font stuff done.
* src/paragraph.C
(LyXFont const Paragraph::getFont):
(LyXFont const Paragraph::getLabelFont):
(LyXFont const Paragraph::getLayoutFont): user buffer's not textclass's
default font
* src/text.C
(int LyXText::leftMargin):
(int LyXText::rightMargin): user buffer's not textclass's default font
* src/text2.C
(LyXFont LyXText::getFont):
(LyXFont LyXText::getLayoutFont):
(LyXFont LyXText::getLabelFont): check if the family of the default document
font has been customized.
* src/frontends/gtk/GDocument.[Ch]: implement new font ui (from Georg BAUM).
* src/frontends/gtk/glade/document.glade: implement new font ui (from Georg BAUM).
* src/frontends/qt3/Makefile.dialogs: add new FontModuleBase
* src/frontends/qt3/ui/FontModuleBase.ui: new File
* src/frontends/qt3/ui/TextLayoutModuleBase.ui: remove font widgets
* src/frontends/qt3/QDocument.C
* src/frontends/qt3/QDocumentDialog.[Ch]: implement new font ui
* src/frontends/qt4/Makefile.dialogs: add new FontUi
* src/frontends/qt4/QDocumentDialog.[Ch]: implement new font ui
* src/frontends/qt4/ui/FontUi.ui: new File
* src/frontends/qt4/ui/TextLayoutUi.ui: remove font widgets
* src/frontends/qt4/ui/compile_uic.sh: add new FontUi
* src/frontends/xforms/FormDocument.[Ch]: implement new font ui
* src/frontends/xforms/forms/form_document.fd: add new font tab.
* src/frontends/controllers/ControlDocument.[Ch]
(char ControlDocument::fontfamilies):
(char ControlDocument::fontfamilies_gui):
(bool ControlDocument::isFontAvailable):
(bool ControlDocument::providesSC):
(bool ControlDocument::providesOSF):
(bool ControlDocument::providesScale): new methods, providing font info.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@14143 a592a061-630c-0410-9148-cb99ea01b6c8
2006-06-19 08:10:17 +00:00
|
|
|
|
/// the rm font
|
|
|
|
|
std::string fontsRoman;
|
|
|
|
|
/// the sf font
|
|
|
|
|
std::string fontsSans;
|
|
|
|
|
/// the tt font
|
|
|
|
|
std::string fontsTypewriter;
|
|
|
|
|
/// the default family (rm, sf, tt)
|
|
|
|
|
std::string fontsDefaultFamily;
|
|
|
|
|
/// use expert Small Caps
|
|
|
|
|
bool fontsSC;
|
|
|
|
|
/// use Old Style Figures
|
|
|
|
|
bool fontsOSF;
|
|
|
|
|
/// the scale factor of the sf font
|
|
|
|
|
int fontsSansScale;
|
|
|
|
|
/// the scale factor of the tt font
|
|
|
|
|
int fontsTypewriterScale;
|
1999-09-27 18:44:28 +00:00
|
|
|
|
///
|
2003-09-09 17:00:19 +00:00
|
|
|
|
Spacing & spacing();
|
|
|
|
|
Spacing const & spacing() const;
|
1999-09-27 18:44:28 +00:00
|
|
|
|
///
|
1999-11-04 01:40:20 +00:00
|
|
|
|
int secnumdepth;
|
1999-09-27 18:44:28 +00:00
|
|
|
|
///
|
1999-11-04 01:40:20 +00:00
|
|
|
|
int tocdepth;
|
1999-09-27 18:44:28 +00:00
|
|
|
|
///
|
2000-10-10 12:36:36 +00:00
|
|
|
|
Language const * language;
|
2003-08-17 11:28:23 +00:00
|
|
|
|
/// BranchList:
|
2003-09-09 17:00:19 +00:00
|
|
|
|
BranchList & branchlist();
|
|
|
|
|
BranchList const & branchlist() const;
|
2006-08-15 07:08:58 +00:00
|
|
|
|
/**
|
|
|
|
|
* The input encoding for LaTeX. This can be one of
|
2007-01-13 14:36:54 +00:00
|
|
|
|
* - \c auto: find out the input encoding from the used languages
|
|
|
|
|
* - \c default: ditto
|
2006-08-15 07:08:58 +00:00
|
|
|
|
* - any encoding supported by the inputenc package
|
|
|
|
|
* The encoding of the LyX file is always utf8 and has nothing to
|
|
|
|
|
* do with this setting.
|
2007-01-13 14:36:54 +00:00
|
|
|
|
* The difference between \c auto and \c default is that \c auto also
|
|
|
|
|
* causes loading of the inputenc package, while \c default does not.
|
|
|
|
|
* \c default will not work unless the user takes additional measures
|
|
|
|
|
* (such as using special environments like the CJK environment from
|
|
|
|
|
* CJK.sty).
|
|
|
|
|
* \c default can be seen as an unspecified 8bit encoding, since LyX
|
|
|
|
|
* does not interpret it in any way apart from display on screen.
|
2006-08-15 07:08:58 +00:00
|
|
|
|
*/
|
2003-10-06 15:43:21 +00:00
|
|
|
|
std::string inputenc;
|
2006-12-10 16:08:52 +00:00
|
|
|
|
/// The main encoding used by this buffer for LaTeX output.
|
|
|
|
|
/// Individual pieces of text can use different encodings.
|
|
|
|
|
Encoding const & encoding() const;
|
1999-09-27 18:44:28 +00:00
|
|
|
|
///
|
2003-10-06 15:43:21 +00:00
|
|
|
|
std::string preamble;
|
1999-09-27 18:44:28 +00:00
|
|
|
|
///
|
2003-10-06 15:43:21 +00:00
|
|
|
|
std::string options;
|
1999-09-27 18:44:28 +00:00
|
|
|
|
///
|
2003-10-06 15:43:21 +00:00
|
|
|
|
std::string float_placement;
|
1999-09-27 18:44:28 +00:00
|
|
|
|
///
|
1999-11-04 01:40:20 +00:00
|
|
|
|
unsigned int columns;
|
Add support for listings package. Two listings command \lstinline, \lstinputlisting and an environment \lstlisting are supported, along with preamble \lstset. \lstinputlisting is implemented through Include dialog, and the other two are implemented with a new inset listings, along with its dialog.
* src/LyXAction.cpp: listing-insert action
* src/insets/Inset.h,cpp: LISTINGS_CODE
* src/insets/InsetInclude.cpp: handle \lstinputlisting
* src/insets/InsetListings.h,cpp: new listings inset
* src/insets/InsetListingsParams.h,cpp: parameters from listings package
* src/insets/InsetCommandParams.h,cpp: handle lstinputlisting option
* src/Bidi.cpp: handle LISTINGS_CODE
* src/frontends/qt4/ui/TextLayoutUi.ui: update UI
* src/frontends/qt4/ui/ListingsUi.ui: new dialog
* src/frontends/qt4/ui/IncludeUi.ui: update UI
* src/frontends/qt4/QInclude.h,cpp: add lstinputlisting
* src/frontends/qt4/QDocument.h,cpp: add textedit for preamble listings_params
* src/frontends/qt4/QListings.h,cpp: new listings inset
* src/frontends/qt4/Dialogs.cpp: new listings dialog
* src/frontends/controllers/ControlInclude.h,cpp: add lstinputlisting
* src/frontends/controllers/ControlListings.h,cpp: new listings inset
* src/LyXFunc.cpp: handle LISTING_CODE
* src/Paragraph.cpp: handle LISTING_CODE
* src/factory.cpp: new listings inset
* src/CutAndPaste.cpp: handle LISTINGS_CODE
* src/LaTeXFeatures.cpp: require listings
* src/Text3.cpp: Handle LISTINGS_CODE
* src/lfuns.h: add LFUN_LISTING_INSERT
* src/Buffer.cpp: change lyx file format to 269
* src/BufferParams.h,cpp: add listings_params to preamble
* lib/lyx2lyx/LyX.py: lyx2lyx
* lib/lyx2lyx/lyx_1_5.py: lyx2lyx
* lib/ui/stdmenus.inc: new menu item (no shortcut!)
* src/insets/Makefile.am: update autotools
* src/frontends/controllers/Makefile.am
* src/frontends/qt4/Makefile.dialogs
* src/frontends/qt4/Makefile.am
* po/POTFILES.in: a few more translatable files.
* development/scons/scons_manifest.py: scons build system
* development/FORMAT: document format changes
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@18243 a592a061-630c-0410-9148-cb99ea01b6c8
2007-05-09 19:11:42 +00:00
|
|
|
|
/// parameters for the listings package
|
|
|
|
|
std::string listings_params;
|
1999-09-27 18:44:28 +00:00
|
|
|
|
///
|
2007-11-07 23:25:08 +00:00
|
|
|
|
PageSides sides;
|
1999-09-27 18:44:28 +00:00
|
|
|
|
///
|
2003-10-06 15:43:21 +00:00
|
|
|
|
std::string pagestyle;
|
2003-09-09 17:00:19 +00:00
|
|
|
|
/// \param index should lie in the range 0 <= \c index <= 3.
|
2006-10-21 00:16:43 +00:00
|
|
|
|
Bullet & temp_bullet(size_type index);
|
|
|
|
|
Bullet const & temp_bullet(size_type index) const;
|
2003-09-09 17:00:19 +00:00
|
|
|
|
/// \param index should lie in the range 0 <= \c index <= 3.
|
2006-10-21 00:16:43 +00:00
|
|
|
|
Bullet & user_defined_bullet(size_type index);
|
|
|
|
|
Bullet const & user_defined_bullet(size_type index) const;
|
2003-03-06 11:07:55 +00:00
|
|
|
|
|
2006-11-13 17:35:18 +00:00
|
|
|
|
/// Whether to load a package such as amsmath or esint.
|
|
|
|
|
/// The enum values must not be changed (file format!)
|
|
|
|
|
enum Package {
|
|
|
|
|
/// Don't load the package. For experts only.
|
|
|
|
|
package_off = 0,
|
|
|
|
|
/// Load the package if needed (recommended)
|
|
|
|
|
package_auto = 1,
|
|
|
|
|
/// Always load the package (e.g. if the document contains
|
|
|
|
|
/// some ERT that needs the package)
|
|
|
|
|
package_on = 2
|
2003-03-06 11:07:55 +00:00
|
|
|
|
};
|
2006-11-13 17:35:18 +00:00
|
|
|
|
/// Whether and how to load amsmath
|
|
|
|
|
Package use_amsmath;
|
|
|
|
|
/// Whether and how to load esint
|
|
|
|
|
Package use_esint;
|
2001-07-19 14:12:37 +00:00
|
|
|
|
///
|
2004-03-29 13:17:25 +00:00
|
|
|
|
bool use_bibtopic;
|
2003-02-08 19:18:01 +00:00
|
|
|
|
/// revision tracking for this buffer ?
|
2006-10-06 18:53:35 +00:00
|
|
|
|
bool trackChanges;
|
2007-05-08 17:46:03 +00:00
|
|
|
|
/** This param decides whether change tracking marks should be used
|
|
|
|
|
* in output (irrespective of how these marks are actually defined;
|
|
|
|
|
* for instance, they may differ for DVI and PDF generation)
|
2005-01-24 17:12:19 +00:00
|
|
|
|
*/
|
2006-10-06 18:53:35 +00:00
|
|
|
|
bool outputChanges;
|
2003-07-28 14:40:29 +00:00
|
|
|
|
///
|
|
|
|
|
bool compressed;
|
2007-08-30 20:46:42 +00:00
|
|
|
|
///
|
|
|
|
|
bool embedded;
|
2003-03-12 02:39:12 +00:00
|
|
|
|
|
2003-09-09 17:00:19 +00:00
|
|
|
|
/// the author list for the document
|
|
|
|
|
AuthorList & authors();
|
|
|
|
|
AuthorList const & authors() const;
|
|
|
|
|
|
2003-03-12 23:25:59 +00:00
|
|
|
|
/// map of the file's author IDs to buffer author IDs
|
2006-06-07 17:05:25 +00:00
|
|
|
|
std::vector<unsigned int> author_map;
|
2003-07-17 08:23:33 +00:00
|
|
|
|
///
|
2003-10-06 15:43:21 +00:00
|
|
|
|
std::string const dvips_options() const;
|
2003-07-17 08:23:33 +00:00
|
|
|
|
///
|
2003-10-06 15:43:21 +00:00
|
|
|
|
std::string const paperSizeName() const;
|
2007-05-07 22:32:44 +00:00
|
|
|
|
/// set up if and how babel is called
|
2004-03-07 14:33:17 +00:00
|
|
|
|
std::string const babelCall(std::string const & lang_opts) const;
|
2007-05-28 07:43:15 +00:00
|
|
|
|
/// handle inputenc etc.
|
2007-05-28 12:25:53 +00:00
|
|
|
|
void writeEncodingPreamble(odocstream & os, LaTeXFeatures & features,
|
2007-05-28 07:43:15 +00:00
|
|
|
|
TexRow & texrow) const;
|
The Grand Font Selection Redesign:
* lib/lyx2lyx/LyX.py (format_relation): add file format 247 (from Georg BAUM).
* lib/lyx2lyx/lyx_1_5.py: add convert_font_settings, revert_font_settings (from Georg BAUM).
* lib/chkconfig.ltx: Test for newly supported font packages
* lib/doc/LaTeXConfig.lyx.in: document newly supported font packages
* lib/doc/UserGuide.lyx: document new UI.
* lib/doc/Extended.lyx: update PostScript font documentation
* development/FORMAT: document file format change 246->247.
* src/tex-strings.[Ch]: new strings tex_fonts_roman, tex_fonts_sans,
tex_fonts_monospaced (with GUI equivalents).
* src/buffer.C: Format up to 247.
* src/bufferparams.C:
new params fontsRoman, fontsSans, fontsTypewriter, fontsDefaultFamily,
fontsSC, fontsOSF, fontsSansScale and fontsTypewriterScale
(LyXFont const BufferParams::getFont): consider switch of default family.
(string const BufferParams::loadFonts): new method to get all the LaTeX
font stuff done.
* src/paragraph.C
(LyXFont const Paragraph::getFont):
(LyXFont const Paragraph::getLabelFont):
(LyXFont const Paragraph::getLayoutFont): user buffer's not textclass's
default font
* src/text.C
(int LyXText::leftMargin):
(int LyXText::rightMargin): user buffer's not textclass's default font
* src/text2.C
(LyXFont LyXText::getFont):
(LyXFont LyXText::getLayoutFont):
(LyXFont LyXText::getLabelFont): check if the family of the default document
font has been customized.
* src/frontends/gtk/GDocument.[Ch]: implement new font ui (from Georg BAUM).
* src/frontends/gtk/glade/document.glade: implement new font ui (from Georg BAUM).
* src/frontends/qt3/Makefile.dialogs: add new FontModuleBase
* src/frontends/qt3/ui/FontModuleBase.ui: new File
* src/frontends/qt3/ui/TextLayoutModuleBase.ui: remove font widgets
* src/frontends/qt3/QDocument.C
* src/frontends/qt3/QDocumentDialog.[Ch]: implement new font ui
* src/frontends/qt4/Makefile.dialogs: add new FontUi
* src/frontends/qt4/QDocumentDialog.[Ch]: implement new font ui
* src/frontends/qt4/ui/FontUi.ui: new File
* src/frontends/qt4/ui/TextLayoutUi.ui: remove font widgets
* src/frontends/qt4/ui/compile_uic.sh: add new FontUi
* src/frontends/xforms/FormDocument.[Ch]: implement new font ui
* src/frontends/xforms/forms/form_document.fd: add new font tab.
* src/frontends/controllers/ControlDocument.[Ch]
(char ControlDocument::fontfamilies):
(char ControlDocument::fontfamilies_gui):
(bool ControlDocument::isFontAvailable):
(bool ControlDocument::providesSC):
(bool ControlDocument::providesOSF):
(bool ControlDocument::providesScale): new methods, providing font info.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@14143 a592a061-630c-0410-9148-cb99ea01b6c8
2006-06-19 08:10:17 +00:00
|
|
|
|
/// set up the document fonts
|
2007-02-08 15:18:36 +00:00
|
|
|
|
std::string const loadFonts(std::string const & rm,
|
The Grand Font Selection Redesign:
* lib/lyx2lyx/LyX.py (format_relation): add file format 247 (from Georg BAUM).
* lib/lyx2lyx/lyx_1_5.py: add convert_font_settings, revert_font_settings (from Georg BAUM).
* lib/chkconfig.ltx: Test for newly supported font packages
* lib/doc/LaTeXConfig.lyx.in: document newly supported font packages
* lib/doc/UserGuide.lyx: document new UI.
* lib/doc/Extended.lyx: update PostScript font documentation
* development/FORMAT: document file format change 246->247.
* src/tex-strings.[Ch]: new strings tex_fonts_roman, tex_fonts_sans,
tex_fonts_monospaced (with GUI equivalents).
* src/buffer.C: Format up to 247.
* src/bufferparams.C:
new params fontsRoman, fontsSans, fontsTypewriter, fontsDefaultFamily,
fontsSC, fontsOSF, fontsSansScale and fontsTypewriterScale
(LyXFont const BufferParams::getFont): consider switch of default family.
(string const BufferParams::loadFonts): new method to get all the LaTeX
font stuff done.
* src/paragraph.C
(LyXFont const Paragraph::getFont):
(LyXFont const Paragraph::getLabelFont):
(LyXFont const Paragraph::getLayoutFont): user buffer's not textclass's
default font
* src/text.C
(int LyXText::leftMargin):
(int LyXText::rightMargin): user buffer's not textclass's default font
* src/text2.C
(LyXFont LyXText::getFont):
(LyXFont LyXText::getLayoutFont):
(LyXFont LyXText::getLabelFont): check if the family of the default document
font has been customized.
* src/frontends/gtk/GDocument.[Ch]: implement new font ui (from Georg BAUM).
* src/frontends/gtk/glade/document.glade: implement new font ui (from Georg BAUM).
* src/frontends/qt3/Makefile.dialogs: add new FontModuleBase
* src/frontends/qt3/ui/FontModuleBase.ui: new File
* src/frontends/qt3/ui/TextLayoutModuleBase.ui: remove font widgets
* src/frontends/qt3/QDocument.C
* src/frontends/qt3/QDocumentDialog.[Ch]: implement new font ui
* src/frontends/qt4/Makefile.dialogs: add new FontUi
* src/frontends/qt4/QDocumentDialog.[Ch]: implement new font ui
* src/frontends/qt4/ui/FontUi.ui: new File
* src/frontends/qt4/ui/TextLayoutUi.ui: remove font widgets
* src/frontends/qt4/ui/compile_uic.sh: add new FontUi
* src/frontends/xforms/FormDocument.[Ch]: implement new font ui
* src/frontends/xforms/forms/form_document.fd: add new font tab.
* src/frontends/controllers/ControlDocument.[Ch]
(char ControlDocument::fontfamilies):
(char ControlDocument::fontfamilies_gui):
(bool ControlDocument::isFontAvailable):
(bool ControlDocument::providesSC):
(bool ControlDocument::providesOSF):
(bool ControlDocument::providesScale): new methods, providing font info.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@14143 a592a061-630c-0410-9148-cb99ea01b6c8
2006-06-19 08:10:17 +00:00
|
|
|
|
std::string const & sf, std::string const & tt,
|
|
|
|
|
bool const & sc, bool const & osf,
|
|
|
|
|
int const & sfscale, int const & ttscale) const;
|
2007-11-28 15:25:07 +00:00
|
|
|
|
|
2007-03-22 07:22:16 +00:00
|
|
|
|
/// get the appropriate cite engine (natbib handling)
|
2007-03-25 01:12:38 +00:00
|
|
|
|
biblio::CiteEngine getEngine() const;
|
|
|
|
|
|
|
|
|
|
///
|
|
|
|
|
void setCiteEngine(biblio::CiteEngine const);
|
2003-03-12 23:25:59 +00:00
|
|
|
|
|
2007-09-20 22:31:18 +00:00
|
|
|
|
/// options for pdf output
|
|
|
|
|
PDFOptions & pdfoptions();
|
|
|
|
|
PDFOptions const & pdfoptions() const;
|
|
|
|
|
|
2003-03-12 11:52:23 +00:00
|
|
|
|
private:
|
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
2007-08-23 16:41:13 +00:00
|
|
|
|
///
|
|
|
|
|
void readPreamble(Lexer &);
|
|
|
|
|
///
|
|
|
|
|
void readLanguage(Lexer &);
|
|
|
|
|
///
|
|
|
|
|
void readGraphicsDriver(Lexer &);
|
|
|
|
|
///
|
|
|
|
|
void readBullets(Lexer &);
|
|
|
|
|
///
|
|
|
|
|
void readBulletsLaTeX(Lexer &);
|
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 patch adds the backend. The ModuleList class holds a list of the available modules, which are retrieved from lyxmodules.lst, itself generated by configure.py. There are two LFUNs available: modules-clear and module-add, which do the obvious thing; you can test by typing these into the minibuffer, along with the name of one of the available modules: URL (a CharStyle), Endnote (a Custom Inset), and---with the spaces---End To Foot (View>LaTeX and look at the user preamble), which are themselves in lib/layouts. There are some others, too, that allow theorems to be added to classes like article and book.
The GUI will come next.
Issues: (i) The configure.py script could be improved. It'd be nice, for example, if it tested for the presence of the LaTeX packages a particular module needs. But this would mean re-working the LaTeX script, and I don't know how to do that. Note that at present, the packages are ignored. This will change shortly. (ii) I've used std::string in LyXModule, following what seemed to be a precedent in TextClass. If some of these should be docstrings, please let me know, and I'll change them. (iii) There is at present no distinction between LaTeX and DocBook modules. Should there be? That is: Should there be modules that are available when the document class is a LaTeX class and others that are available only when it is DocBook? Or should there just be one set of modules? Each module can of course indicate for what it is suitable in its description.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@19893 a592a061-630c-0410-9148-cb99ea01b6c8
2007-08-29 17:59:49 +00:00
|
|
|
|
///
|
|
|
|
|
void readModules(Lexer &);
|
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
2007-08-23 16:41:13 +00:00
|
|
|
|
|
|
|
|
|
/// 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
|
2007-09-18 17:46:14 +00:00
|
|
|
|
TextClassPtr textClass_;
|
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 patch adds the backend. The ModuleList class holds a list of the available modules, which are retrieved from lyxmodules.lst, itself generated by configure.py. There are two LFUNs available: modules-clear and module-add, which do the obvious thing; you can test by typing these into the minibuffer, along with the name of one of the available modules: URL (a CharStyle), Endnote (a Custom Inset), and---with the spaces---End To Foot (View>LaTeX and look at the user preamble), which are themselves in lib/layouts. There are some others, too, that allow theorems to be added to classes like article and book.
The GUI will come next.
Issues: (i) The configure.py script could be improved. It'd be nice, for example, if it tested for the presence of the LaTeX packages a particular module needs. But this would mean re-working the LaTeX script, and I don't know how to do that. Note that at present, the packages are ignored. This will change shortly. (ii) I've used std::string in LyXModule, following what seemed to be a precedent in TextClass. If some of these should be docstrings, please let me know, and I'll change them. (iii) There is at present no distinction between LaTeX and DocBook modules. Should there be? That is: Should there be modules that are available when the document class is a LaTeX class and others that are available only when it is DocBook? Or should there just be one set of modules? Each module can of course indicate for what it is suitable in its description.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@19893 a592a061-630c-0410-9148-cb99ea01b6c8
2007-08-29 17:59:49 +00:00
|
|
|
|
///
|
|
|
|
|
typedef std::vector<std::string> LayoutModuleList;
|
|
|
|
|
///
|
|
|
|
|
LayoutModuleList layoutModules_;
|
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
2007-08-23 16:41:13 +00:00
|
|
|
|
|
2003-09-09 17:00:19 +00:00
|
|
|
|
/** Use the Pimpl idiom to hide those member variables that would otherwise
|
2003-09-15 20:23:57 +00:00
|
|
|
|
* drag in other header files.
|
2003-09-09 17:00:19 +00:00
|
|
|
|
*/
|
|
|
|
|
class Impl;
|
2005-01-19 15:03:31 +00:00
|
|
|
|
class MemoryTraits {
|
|
|
|
|
public:
|
2003-09-15 20:23:57 +00:00
|
|
|
|
static Impl * clone(Impl const *);
|
|
|
|
|
static void destroy(Impl *);
|
|
|
|
|
};
|
2006-10-21 00:16:43 +00:00
|
|
|
|
support::copied_ptr<Impl, MemoryTraits> pimpl_;
|
2007-03-25 01:12:38 +00:00
|
|
|
|
|
1999-09-27 18:44:28 +00:00
|
|
|
|
};
|
|
|
|
|
|
2006-10-21 00:16:43 +00:00
|
|
|
|
} // namespace lyx
|
|
|
|
|
|
1999-09-27 18:44:28 +00:00
|
|
|
|
#endif
|