lyx_mirror/src/BufferParams.h

413 lines
11 KiB
C
Raw Normal View History

// -*- C++ -*-
/**
* \file BufferParams.h
* This file is part of LyX, the document processor.
* Licence details can be found in the file COPYING.
*
* \author Lars Gullik Bjønnes
* \author Jean-Marc Lasgouttes
* \author John Levon
* \author André Pönitz
*
* Full author contact details are available in file CREDITS.
*/
#ifndef BUFFERPARAMS_H
#define BUFFERPARAMS_H
#include "Citation.h"
#include "Font.h"
#include "LayoutModuleList.h"
#include "paper.h"
#include "insets/InsetQuotes.h"
#include "support/copied_ptr.h"
#include <list>
#include <map>
#include <vector>
namespace lyx {
namespace support { class FileName; }
class AuthorList;
class BranchList;
class Bullet;
class DocumentClass;
class Encoding;
class HSpace;
class IndicesList;
class Language;
class LatexFeatures;
class LayoutFile;
class LayoutFileIndex;
class Lexer;
class PDFOptions;
class Spacing;
class TexRow;
class VSpace;
/** 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
* work needs to be done on this class to make it nice. Now everything
* is in public.
*/
class BufferParams {
public:
///
enum ParagraphSeparation {
///
ParagraphIndentSeparation,
///
ParagraphSkipSeparation
};
///
BufferParams();
/// get l10n translated to the buffers language
docstring B_(std::string const & l10n) const;
/// read a header token, if unrecognised, return it or an unknown class name
std::string readToken(Lexer & lex,
std::string const & token, ///< token to read.
support::FileName const & filepath);
///
void writeFile(std::ostream &) const;
/// check what features are implied by the buffer parameters.
void validate(LaTeXFeatures &) const;
/** \returns true if the babel package is used (interogates
* the BufferParams and a LyXRC variable).
* This returned value can then be passed to the insets...
*/
bool writeLaTeX(odocstream &, LaTeXFeatures &, TexRow &) const;
///
void useClassDefaults();
///
bool hasClassDefaults() const;
///
HSpace const & getIndentation() const;
///
void setIndentation(HSpace const & indent);
///
VSpace const & getDefSkip() const;
///
void setDefSkip(VSpace const & vs);
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
* articles or by using a little skip like in letters.
*/
ParagraphSeparation paragraph_separation;
///
InsetQuotes::QuoteLanguage quotes_language;
///
InsetQuotes::QuoteTimes quotes_times;
///
std::string fontsize;
///Get the LayoutFile this document is using.
LayoutFile const * baseClass() const;
///
LayoutFileIndex const & baseClassID() const;
/// Set the LyX layout file this document is using.
/// NOTE: This does not call makeDocumentClass() to update the local
/// DocumentClass. That needs to be done manually.
/// \param filename the name of the layout file
bool setBaseClass(std::string const & classname);
/// Adds the module information to the baseClass information to
/// create our local DocumentClass.
void makeDocumentClass();
/// Returns the DocumentClass currently in use: the BaseClass as modified
/// by modules.
DocumentClass const & documentClass() const;
/// \return A pointer to the DocumentClass currently in use: the BaseClass
/// as modified by modules.
DocumentClass const * documentClassPtr() 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().
void setDocumentClass(DocumentClass const * 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 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
LayoutModuleList const & getModules() const { return layoutModules_; }
/// List of default modules the user has removed
std::list<std::string> const & getRemovedModules() const
{ return removedModules_; }
///
/// Add a module to the list of modules in use. This checks only that the
/// module is not already in the list, so use moduleIsCompatible first if
/// you want to check for compatibility.
/// \return true if module was successfully added.
bool addLayoutModule(std::string const & modName);
/// checks to make sure module's requriements are satisfied, that it does
/// not conflict with already-present modules, isn't already loaded, etc.
bool moduleCanBeAdded(std::string const & modName) const;
///
void addRemovedModule(std::string const & modName)
{ removedModules_.push_back(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() { layoutModules_.clear(); }
/// Clear the removed module list
void clearRemovedModules() { removedModules_.clear(); }
/// returns the main font for the buffer (document)
Font const getFont() const;
/* these are for the PaperLayout */
/// the papersize
PAPER_SIZE papersize;
///
PAPER_ORIENTATION orientation;
/// use custom margins
bool use_geometry;
///
std::string paperwidth;
///
std::string paperheight;
///
std::string leftmargin;
///
std::string topmargin;
///
std::string rightmargin;
///
std::string bottommargin;
///
std::string headheight;
///
std::string headsep;
///
std::string footskip;
///
std::string columnsep;
/* some LaTeX options */
/// The graphics driver
std::string graphicsDriver;
/// The default output format
std::string defaultOutputFormat;
/// customized bibliography processor
std::string bibtex_command;
/// customized index processor
std::string index_command;
/// font encoding
std::string fontenc;
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 the XeTeX processor
bool useXetex;
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
/// 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;
/// the font used by the CJK command
std::string fontsCJK;
///
Spacing & spacing();
Spacing const & spacing() const;
///
int secnumdepth;
///
int tocdepth;
///
Language const * language;
/// BranchList:
BranchList & branchlist();
BranchList const & branchlist() const;
/// IndicesList:
IndicesList & indiceslist();
IndicesList const & indiceslist() const;
/**
* The input encoding for LaTeX. This can be one of
* - \c auto: find out the input encoding from the used languages
* - \c default: ditto
* - any encoding supported by the inputenc package
* The encoding of the LyX file is always utf8 and has nothing to
* do with this setting.
* 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.
*/
std::string inputenc;
/// The main encoding used by this buffer for LaTeX output.
/// Individual pieces of text can use different encodings.
Encoding const & encoding() const;
///
std::string preamble;
///
std::string local_layout;
///
std::string options;
/// use the class options defined in the layout?
bool use_default_options;
///
std::string master;
///
bool suppress_date;
///
std::string float_placement;
///
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;
///
PageSides sides;
///
std::string pagestyle;
///
RGBColor backgroundcolor;
/// \param index should lie in the range 0 <= \c index <= 3.
Bullet & temp_bullet(size_type index);
Bullet const & temp_bullet(size_type index) const;
/// \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;
Add support for the esint package * src/LaTeXFeatures.C (LaTeXFeatures::getPackages): handle esint and wasysym * src/mathed/MathMacroTable.[Ch] (requires_): New member: tell the feature this macro requires (MacroTable::insert): take new requires arg * src/mathed/MathMacroTemplate.C (MathMacroTemplate::asMacroData): adjust to change above * src/mathed/MathSupport.C (fontinfos): add esint10 font * src/mathed/InsetMathHull.C (InsetMathHull::doDispatch): AMS_ON -> package_on * src/mathed/MathMacroTable.h * src/mathed/MathFactory.C (initSymbols): read and store requires field for symbols * src/mathed/InsetMathSymbol.C (InsetMathSymbol::metrics): handle esint (InsetMathSymbol::takesLimits): ditto * src/buffer.C (LYX_FORMAT): update format (Buffer::validate): handle esint, AMS_ON -> package_on * src/bufferparams.C: (AMSTranslator): Rename to PackageTranslator (BufferParams::readToken): Read \use_esint (BufferParams::writeFile): Write \use_esint * src/frontends/qt4/QDocumentDialog.C: handle esint * src/frontends/qt4/ui/MathsUi.ui : add esint checkboxes * src/frontends/qt4/GuiFontLoader.C (symbol_fonts: Add esint10 font (symbolFamily): handle esint10 font (isChosenFont): Add comment * src/frontends/controllers/ControlMath.C (latex_varsz): Add new integral symbols * src/support/fontutils.C (win_fonts_truetype): Add esint10 font * src/bufferparams.h (enum AMS): rename to enum Package (use_esint): new parameter * src/lyxfont.[Ch]: Add esint font * lib/symbols: Add new integral symbols * lib/lyx2lyx/LyX.py (format_relation): Update format * lib/lyx2lyx/lyx_1_5.py: handle new format * lib/chkconfig.ltx: Test esint package * lib/images/math/oiintop.xpm * lib/images/math/sqintop.xpm * lib/images/math/sqint.xpm * lib/images/math/ointctrclockwiseop.xpm * lib/images/math/ointctrclockwise.xpm * lib/images/math/iiintop.xpm * lib/images/math/iintop.xpm * lib/images/math/sqiint.xpm * lib/images/math/iiint.xpm * lib/images/math/ointclockwiseop.xpm * lib/images/math/oiint.xpm * lib/images/math/dotsintop.xpm * lib/images/math/sqiintop.xpm * lib/images/math/ointclockwise.xpm * lib/images/math/iiiintop.xpm * lib/images/math/dotsint.xpm * lib/images/math/iiiint.xpm * lib/images/math/iint.xpm: new icons * lib/doc/LaTeXConfig.lyx.in: Add docs for esint package * lib/doc/UserGuide.lyx: Add short documentation of integral symbols * lib/Makefile.am: Add new files * development/scons/scons_manifest.py: ditto git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@15907 a592a061-630c-0410-9148-cb99ea01b6c8
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
};
Add support for the esint package * src/LaTeXFeatures.C (LaTeXFeatures::getPackages): handle esint and wasysym * src/mathed/MathMacroTable.[Ch] (requires_): New member: tell the feature this macro requires (MacroTable::insert): take new requires arg * src/mathed/MathMacroTemplate.C (MathMacroTemplate::asMacroData): adjust to change above * src/mathed/MathSupport.C (fontinfos): add esint10 font * src/mathed/InsetMathHull.C (InsetMathHull::doDispatch): AMS_ON -> package_on * src/mathed/MathMacroTable.h * src/mathed/MathFactory.C (initSymbols): read and store requires field for symbols * src/mathed/InsetMathSymbol.C (InsetMathSymbol::metrics): handle esint (InsetMathSymbol::takesLimits): ditto * src/buffer.C (LYX_FORMAT): update format (Buffer::validate): handle esint, AMS_ON -> package_on * src/bufferparams.C: (AMSTranslator): Rename to PackageTranslator (BufferParams::readToken): Read \use_esint (BufferParams::writeFile): Write \use_esint * src/frontends/qt4/QDocumentDialog.C: handle esint * src/frontends/qt4/ui/MathsUi.ui : add esint checkboxes * src/frontends/qt4/GuiFontLoader.C (symbol_fonts: Add esint10 font (symbolFamily): handle esint10 font (isChosenFont): Add comment * src/frontends/controllers/ControlMath.C (latex_varsz): Add new integral symbols * src/support/fontutils.C (win_fonts_truetype): Add esint10 font * src/bufferparams.h (enum AMS): rename to enum Package (use_esint): new parameter * src/lyxfont.[Ch]: Add esint font * lib/symbols: Add new integral symbols * lib/lyx2lyx/LyX.py (format_relation): Update format * lib/lyx2lyx/lyx_1_5.py: handle new format * lib/chkconfig.ltx: Test esint package * lib/images/math/oiintop.xpm * lib/images/math/sqintop.xpm * lib/images/math/sqint.xpm * lib/images/math/ointctrclockwiseop.xpm * lib/images/math/ointctrclockwise.xpm * lib/images/math/iiintop.xpm * lib/images/math/iintop.xpm * lib/images/math/sqiint.xpm * lib/images/math/iiint.xpm * lib/images/math/ointclockwiseop.xpm * lib/images/math/oiint.xpm * lib/images/math/dotsintop.xpm * lib/images/math/sqiintop.xpm * lib/images/math/ointclockwise.xpm * lib/images/math/iiiintop.xpm * lib/images/math/dotsint.xpm * lib/images/math/iiiint.xpm * lib/images/math/iint.xpm: new icons * lib/doc/LaTeXConfig.lyx.in: Add docs for esint package * lib/doc/UserGuide.lyx: Add short documentation of integral symbols * lib/Makefile.am: Add new files * development/scons/scons_manifest.py: ditto git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@15907 a592a061-630c-0410-9148-cb99ea01b6c8
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;
/// Whether and how to load mhchem
Package use_mhchem;
/// Split bibliography?
bool use_bibtopic;
/// Split the index?
bool use_indices;
/// revision tracking for this buffer ?
bool trackChanges;
/** 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)
*/
bool outputChanges;
///
bool compressed;
/// the author list for the document
AuthorList & authors();
AuthorList const & authors() const;
/// map of the file's author IDs to AuthorList indexes
std::map<unsigned int, int> author_map;
/// the buffer's font encoding
std::string const font_encoding() const;
///
std::string const dvips_options() const;
/** The return value of paperSizeName() depends on the
* purpose for which the paper size is needed, since they
* support different subsets of paper sizes.
*/
enum PapersizePurpose {
///
DVIPS,
///
DVIPDFM,
///
XDVI
};
///
std::string paperSizeName(PapersizePurpose purpose) const;
/// set up if and how babel is called
std::string babelCall(std::string const & lang_opts) const;
/// return supported drivers for specific packages
docstring getGraphicsDriver(std::string const & package) const;
/// handle inputenc etc.
void writeEncodingPreamble(odocstream & os, LaTeXFeatures & features,
TexRow & texrow) const;
///
std::string const parseFontName(std::string const & name) 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
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,
bool const & xetex) const;
/// get the appropriate cite engine (natbib handling)
CiteEngine citeEngine() const;
///
void setCiteEngine(CiteEngine const);
/// options for pdf output
PDFOptions & pdfoptions();
PDFOptions const & pdfoptions() const;
/// whether to use MathML for math output, or instead images
bool html_use_mathml;
/// whether to attempt to be XHTML 1.1 compliant or instead be
/// a little more mellow
bool html_be_strict;
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 readLocalLayout(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
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 &);
///
void readRemovedModules(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
CiteEngine cite_engine_;
///
DocumentClass * doc_class_;
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
///
LayoutModuleList layoutModules_;
/// this is for modules that are required by the document class but that
/// the user has chosen not to use
std::list<std::string> removedModules_;
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
/** Use the Pimpl idiom to hide those member variables that would otherwise
* drag in other header files.
*/
class Impl;
class MemoryTraits {
public:
static Impl * clone(Impl const *);
static void destroy(Impl *);
};
support::copied_ptr<Impl, MemoryTraits> pimpl_;
};
} // namespace lyx
#endif