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
|
|
|
// -*- C++ -*-
|
|
|
|
/**
|
|
|
|
* \file ModuleList.h
|
|
|
|
* This file is part of LyX, the document processor.
|
|
|
|
* Licence details can be found in the file COPYING.
|
|
|
|
*
|
2020-12-05 22:17:02 +00:00
|
|
|
* \author Richard Kimberly Heck
|
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
|
|
|
*
|
|
|
|
* Full author contact details are available in file CREDITS.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef MODULELIST_H
|
|
|
|
#define MODULELIST_H
|
|
|
|
|
2007-11-30 20:57:53 +00:00
|
|
|
#include <string>
|
2007-11-07 21:52:11 +00:00
|
|
|
#include <vector>
|
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
|
|
|
|
|
|
|
namespace lyx {
|
2012-03-08 16:43:02 +00:00
|
|
|
|
2007-11-07 21:52:11 +00:00
|
|
|
/**
|
2019-05-14 14:39:35 +00:00
|
|
|
* This class represents a particular LyX "module", which is like a layout
|
2012-03-08 16:43:02 +00:00
|
|
|
* file, except that it does not stand alone. In that sense, it is more like
|
|
|
|
* a LaTeX package, where a layout file corresponds to a LaTeX class. Or, in
|
2008-10-20 21:11:49 +00:00
|
|
|
* LyX's own terms, a module is more like an included file that can be used
|
|
|
|
* with various document classes. The difference is that using a module only
|
2012-03-08 16:43:02 +00:00
|
|
|
* means selecting it in the Document>Settings dialog, whereas including a
|
2008-10-20 21:11:49 +00:00
|
|
|
* layout file means layout file editing.
|
|
|
|
*
|
|
|
|
* In general, a given module can be used with any document class. That said,
|
|
|
|
* one module may `require' another, or it may `exclude' some other module.
|
|
|
|
* The requires and excludes are given in comments within the module file,
|
|
|
|
* which must begin roughly so:
|
|
|
|
* #\DeclareLyXModule{Theorems (By Section)}
|
2019-04-04 16:43:29 +00:00
|
|
|
* #\DeclateCategory{Theorems}
|
2008-10-20 21:11:49 +00:00
|
|
|
* #DescriptionBegin
|
|
|
|
* #Numbers theorems and the like by section.
|
|
|
|
* #DescriptionEnd
|
|
|
|
* #Requires: theorems-std | theorems-ams
|
|
|
|
* #Excludes: theorems-chap
|
|
|
|
* The description is used in the gui to give information to the user. The
|
2012-03-10 21:45:01 +00:00
|
|
|
* Requires, Excludes, and Category lines are read by the configuration script
|
2009-08-14 15:20:11 +00:00
|
|
|
* and written to a file lyxmodules.lst in the user configuration directory.
|
|
|
|
* That file is then read on startup to populate the ModuleList, below.
|
2008-10-23 00:27:03 +00:00
|
|
|
*
|
|
|
|
* Modules can also be "provided" or "excluded" by document classes, using
|
|
|
|
* the ProvidesModule and ExcludesModule tags.
|
2007-11-07 21:52:11 +00:00
|
|
|
*/
|
2008-01-06 16:44:51 +00:00
|
|
|
|
2008-01-05 16:49:49 +00:00
|
|
|
class LyXModule {
|
|
|
|
public:
|
|
|
|
///
|
2012-03-08 16:43:02 +00:00
|
|
|
LyXModule(std::string const & name, std::string const & id,
|
|
|
|
std::string const & description,
|
2009-08-14 15:28:06 +00:00
|
|
|
std::vector<std::string> const & packagelist,
|
2020-05-04 17:45:39 +00:00
|
|
|
std::vector<std::string> const & required,
|
2009-08-14 15:28:06 +00:00
|
|
|
std::vector<std::string> const & excludes,
|
2019-04-20 07:28:46 +00:00
|
|
|
std::string const & catgy, bool const local);
|
2008-01-05 16:49:49 +00:00
|
|
|
/// whether the required packages are available
|
2009-08-14 15:46:10 +00:00
|
|
|
bool isAvailable() const;
|
2011-01-13 21:19:14 +00:00
|
|
|
/// the missing prerequisites, if any
|
|
|
|
std::vector<std::string> prerequisites() const;
|
2008-01-09 18:51:02 +00:00
|
|
|
///
|
2009-08-14 15:28:06 +00:00
|
|
|
std::string const & getName() const { return name_; }
|
2008-01-09 18:51:02 +00:00
|
|
|
///
|
2009-08-14 15:28:06 +00:00
|
|
|
std::string const & getID() const { return id_; }
|
This commit changes the way individual LyXModule's are represented, both internally and in the .lyx files. The earlier version represented them by their `descriptive name', e.g., "Endnote" or "Theorems (AMS)", these being the same names used in the UI. This was a mistake, as becomes readily apparent when one starts to think about translating these strings. The modules ought to be represented by their filename, without the extension, just as TextClass's are.
The changes that accomplish this part are in ModuleList.{h,cpp}, configure.py, and the *.module files themselves. This is a format change, and the lyx2lyx is in those files.
By itself, that change would not be major, except for the fact that we do not want the module to be represented in the UI by its filename---e.g., theorems-std---but rather by a descriptive name, such as "Theorems". But that change turns out to be wholly non-trivial. The mechanism for choosing modules was the same as---indeed, was borrowed from---that in GuiCitation: You get a list of modules, and choosing them involves moving strings from one QListView to another. The models underlying these views are just QStringListModels, which means that, when you want to know what modules have been selected, you see what strings are in the "selected" QListView. But these are just the descriptive names, and we can't look up a module by its descriptive name if it's been translated. That, indeed, was the whole point of the change to the new representation.
So, we need a more complicated model underlying the QListView, one that will pair an identifying string---the filename minus the extension, in this case---with each item. This turns out not to be terribly difficult, though it took rather a while for me to understand why it's not difficult. There are two parts:
(i) GuiSelectionManger gets re-written to use any QAbstractListModel, not just a QStringListModel. This actually seems to improve the code, independently.
(ii) We then subclass QAbstractListModel to get the associated ID string, using the Qt::UserRole slot associated with each item to store its ID. This would be almost completely trivial if QAbstractListItem::itemData() included the QVariant associated with this role, but it doesn't, so there are some additional hoops through which to jump.
The new model, a GuiIdListModel, is defined in the files by that name. The changes in GuiSelectionManger.{h,cpp} make it more abstract; the changes in GuiDocument.{h,cpp} adapt it to the new framework.
I've also updated the module documenation to accord with this change.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@22501 a592a061-630c-0410-9148-cb99ea01b6c8
2008-01-12 04:28:12 +00:00
|
|
|
///
|
2009-08-14 15:28:06 +00:00
|
|
|
std::string const & getFilename() const { return filename_; }
|
2008-01-09 18:51:02 +00:00
|
|
|
///
|
2009-08-14 15:28:06 +00:00
|
|
|
std::string const & getDescription() const { return description_; }
|
2008-01-09 18:51:02 +00:00
|
|
|
///
|
|
|
|
std::vector<std::string> const & getPackageList() const
|
2009-08-14 15:28:06 +00:00
|
|
|
{ return package_list_; }
|
2008-01-09 18:51:02 +00:00
|
|
|
///
|
2012-03-08 16:43:02 +00:00
|
|
|
std::vector<std::string> const & getRequiredModules() const
|
2009-08-14 15:28:06 +00:00
|
|
|
{ return required_modules_; }
|
2008-01-09 18:51:02 +00:00
|
|
|
/// Modules this one excludes: the list should be treated disjunctively
|
2012-03-08 16:43:02 +00:00
|
|
|
std::vector<std::string> const & getExcludedModules() const
|
2009-08-14 15:28:06 +00:00
|
|
|
{ return excluded_modules_; }
|
2009-08-14 15:20:11 +00:00
|
|
|
///
|
|
|
|
std::string category() const { return category_; }
|
2019-04-20 07:28:46 +00:00
|
|
|
/// Is this a local module (from the user directory)?
|
|
|
|
bool isLocal() const { return local_; }
|
2008-10-16 17:21:13 +00:00
|
|
|
/// \return true if the module is compatible with this one, i.e.,
|
|
|
|
/// it does not exclude us and we do not exclude it.
|
2009-08-14 15:28:06 +00:00
|
|
|
/// this will also return true if modname is unknown and we do not
|
2008-10-16 17:21:13 +00:00
|
|
|
/// exclude it, since in that case we cannot check its exclusions.
|
2009-08-14 15:28:06 +00:00
|
|
|
bool isCompatible(std::string const & modname) const;
|
2008-10-16 17:21:13 +00:00
|
|
|
///
|
|
|
|
static bool areCompatible(std::string const & mod1, std::string const & mod2);
|
2008-01-09 18:51:02 +00:00
|
|
|
private:
|
2007-11-07 21:52:11 +00:00
|
|
|
/// what appears in the ui
|
2009-08-14 15:28:06 +00:00
|
|
|
std::string name_;
|
This commit changes the way individual LyXModule's are represented, both internally and in the .lyx files. The earlier version represented them by their `descriptive name', e.g., "Endnote" or "Theorems (AMS)", these being the same names used in the UI. This was a mistake, as becomes readily apparent when one starts to think about translating these strings. The modules ought to be represented by their filename, without the extension, just as TextClass's are.
The changes that accomplish this part are in ModuleList.{h,cpp}, configure.py, and the *.module files themselves. This is a format change, and the lyx2lyx is in those files.
By itself, that change would not be major, except for the fact that we do not want the module to be represented in the UI by its filename---e.g., theorems-std---but rather by a descriptive name, such as "Theorems". But that change turns out to be wholly non-trivial. The mechanism for choosing modules was the same as---indeed, was borrowed from---that in GuiCitation: You get a list of modules, and choosing them involves moving strings from one QListView to another. The models underlying these views are just QStringListModels, which means that, when you want to know what modules have been selected, you see what strings are in the "selected" QListView. But these are just the descriptive names, and we can't look up a module by its descriptive name if it's been translated. That, indeed, was the whole point of the change to the new representation.
So, we need a more complicated model underlying the QListView, one that will pair an identifying string---the filename minus the extension, in this case---with each item. This turns out not to be terribly difficult, though it took rather a while for me to understand why it's not difficult. There are two parts:
(i) GuiSelectionManger gets re-written to use any QAbstractListModel, not just a QStringListModel. This actually seems to improve the code, independently.
(ii) We then subclass QAbstractListModel to get the associated ID string, using the Qt::UserRole slot associated with each item to store its ID. This would be almost completely trivial if QAbstractListItem::itemData() included the QVariant associated with this role, but it doesn't, so there are some additional hoops through which to jump.
The new model, a GuiIdListModel, is defined in the files by that name. The changes in GuiSelectionManger.{h,cpp} make it more abstract; the changes in GuiDocument.{h,cpp} adapt it to the new framework.
I've also updated the module documenation to accord with this change.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@22501 a592a061-630c-0410-9148-cb99ea01b6c8
2008-01-12 04:28:12 +00:00
|
|
|
/// the module's unique identifier
|
|
|
|
/// at present, this is the filename, without the extension
|
2009-08-14 15:28:06 +00:00
|
|
|
std::string id_;
|
This commit changes the way individual LyXModule's are represented, both internally and in the .lyx files. The earlier version represented them by their `descriptive name', e.g., "Endnote" or "Theorems (AMS)", these being the same names used in the UI. This was a mistake, as becomes readily apparent when one starts to think about translating these strings. The modules ought to be represented by their filename, without the extension, just as TextClass's are.
The changes that accomplish this part are in ModuleList.{h,cpp}, configure.py, and the *.module files themselves. This is a format change, and the lyx2lyx is in those files.
By itself, that change would not be major, except for the fact that we do not want the module to be represented in the UI by its filename---e.g., theorems-std---but rather by a descriptive name, such as "Theorems". But that change turns out to be wholly non-trivial. The mechanism for choosing modules was the same as---indeed, was borrowed from---that in GuiCitation: You get a list of modules, and choosing them involves moving strings from one QListView to another. The models underlying these views are just QStringListModels, which means that, when you want to know what modules have been selected, you see what strings are in the "selected" QListView. But these are just the descriptive names, and we can't look up a module by its descriptive name if it's been translated. That, indeed, was the whole point of the change to the new representation.
So, we need a more complicated model underlying the QListView, one that will pair an identifying string---the filename minus the extension, in this case---with each item. This turns out not to be terribly difficult, though it took rather a while for me to understand why it's not difficult. There are two parts:
(i) GuiSelectionManger gets re-written to use any QAbstractListModel, not just a QStringListModel. This actually seems to improve the code, independently.
(ii) We then subclass QAbstractListModel to get the associated ID string, using the Qt::UserRole slot associated with each item to store its ID. This would be almost completely trivial if QAbstractListItem::itemData() included the QVariant associated with this role, but it doesn't, so there are some additional hoops through which to jump.
The new model, a GuiIdListModel, is defined in the files by that name. The changes in GuiSelectionManger.{h,cpp} make it more abstract; the changes in GuiDocument.{h,cpp} adapt it to the new framework.
I've also updated the module documenation to accord with this change.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@22501 a592a061-630c-0410-9148-cb99ea01b6c8
2008-01-12 04:28:12 +00:00
|
|
|
/// the filename
|
2009-08-14 15:28:06 +00:00
|
|
|
std::string filename_;
|
2007-11-07 21:52:11 +00:00
|
|
|
/// a short description for use in the ui
|
2009-08-14 15:28:06 +00:00
|
|
|
std::string description_;
|
2008-01-11 04:44:56 +00:00
|
|
|
/// the LaTeX packages on which this depends, if any
|
2009-08-14 15:28:06 +00:00
|
|
|
std::vector<std::string> package_list_;
|
2008-01-09 18:51:02 +00:00
|
|
|
/// Modules this one requires: at least one
|
2009-08-14 15:28:06 +00:00
|
|
|
std::vector<std::string> required_modules_;
|
2008-01-09 18:51:02 +00:00
|
|
|
/// Modules this one excludes: none of these
|
2009-08-14 15:28:06 +00:00
|
|
|
std::vector<std::string> excluded_modules_;
|
|
|
|
/// Category, also used in the UI
|
2009-08-14 15:20:11 +00:00
|
|
|
std::string category_;
|
2009-08-14 15:46:10 +00:00
|
|
|
// these are mutable because they are used to cache the results
|
|
|
|
// or an otherwise const operation.
|
2009-08-14 15:20:11 +00:00
|
|
|
///
|
2009-08-14 15:46:10 +00:00
|
|
|
mutable bool checked_;
|
2008-01-05 16:49:49 +00:00
|
|
|
///
|
2009-08-14 15:46:10 +00:00
|
|
|
mutable bool available_;
|
2011-01-13 21:19:14 +00:00
|
|
|
///
|
2019-04-20 07:28:46 +00:00
|
|
|
mutable bool local_;
|
|
|
|
///
|
2011-01-13 21:19:14 +00:00
|
|
|
mutable std::vector<std::string> prerequisites_;
|
2007-11-07 21:52:11 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
typedef std::vector<LyXModule> LyXModuleList;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* The ModuleList represents the various LyXModule's that are available at
|
|
|
|
* present.
|
|
|
|
*/
|
|
|
|
class ModuleList {
|
|
|
|
public:
|
|
|
|
///
|
|
|
|
ModuleList() {}
|
|
|
|
/// reads the modules from a file generated by configure.py
|
2009-02-19 17:24:37 +00:00
|
|
|
bool read();
|
2007-11-07 21:52:11 +00:00
|
|
|
///
|
|
|
|
LyXModuleList::const_iterator begin() const;
|
|
|
|
///
|
|
|
|
LyXModuleList::iterator begin();
|
|
|
|
///
|
|
|
|
LyXModuleList::const_iterator end() const;
|
|
|
|
///
|
|
|
|
LyXModuleList::iterator end();
|
|
|
|
///
|
|
|
|
bool empty() const { return modlist_.empty(); }
|
This commit changes the way individual LyXModule's are represented, both internally and in the .lyx files. The earlier version represented them by their `descriptive name', e.g., "Endnote" or "Theorems (AMS)", these being the same names used in the UI. This was a mistake, as becomes readily apparent when one starts to think about translating these strings. The modules ought to be represented by their filename, without the extension, just as TextClass's are.
The changes that accomplish this part are in ModuleList.{h,cpp}, configure.py, and the *.module files themselves. This is a format change, and the lyx2lyx is in those files.
By itself, that change would not be major, except for the fact that we do not want the module to be represented in the UI by its filename---e.g., theorems-std---but rather by a descriptive name, such as "Theorems". But that change turns out to be wholly non-trivial. The mechanism for choosing modules was the same as---indeed, was borrowed from---that in GuiCitation: You get a list of modules, and choosing them involves moving strings from one QListView to another. The models underlying these views are just QStringListModels, which means that, when you want to know what modules have been selected, you see what strings are in the "selected" QListView. But these are just the descriptive names, and we can't look up a module by its descriptive name if it's been translated. That, indeed, was the whole point of the change to the new representation.
So, we need a more complicated model underlying the QListView, one that will pair an identifying string---the filename minus the extension, in this case---with each item. This turns out not to be terribly difficult, though it took rather a while for me to understand why it's not difficult. There are two parts:
(i) GuiSelectionManger gets re-written to use any QAbstractListModel, not just a QStringListModel. This actually seems to improve the code, independently.
(ii) We then subclass QAbstractListModel to get the associated ID string, using the Qt::UserRole slot associated with each item to store its ID. This would be almost completely trivial if QAbstractListItem::itemData() included the QVariant associated with this role, but it doesn't, so there are some additional hoops through which to jump.
The new model, a GuiIdListModel, is defined in the files by that name. The changes in GuiSelectionManger.{h,cpp} make it more abstract; the changes in GuiDocument.{h,cpp} adapt it to the new framework.
I've also updated the module documenation to accord with this change.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@22501 a592a061-630c-0410-9148-cb99ea01b6c8
2008-01-12 04:28:12 +00:00
|
|
|
/// Returns a pointer to the LyXModule with filename str.
|
|
|
|
/// Returns a null pointer if no such module is found.
|
2009-08-14 15:46:10 +00:00
|
|
|
LyXModule const * operator[](std::string const & str) const;
|
2012-03-08 16:43:02 +00:00
|
|
|
///
|
2007-11-07 21:52:11 +00:00
|
|
|
LyXModule * operator[](std::string const & str);
|
2009-08-14 15:46:10 +00:00
|
|
|
private:
|
2007-11-07 21:52:11 +00:00
|
|
|
/// noncopyable
|
|
|
|
ModuleList(ModuleList const &);
|
2008-01-09 18:51:02 +00:00
|
|
|
///
|
2007-11-07 21:52:11 +00:00
|
|
|
void operator=(ModuleList const &);
|
2008-01-09 18:51:02 +00:00
|
|
|
/// add a module to the list
|
2012-03-08 16:43:02 +00:00
|
|
|
void addLayoutModule(std::string const &, std::string const &,
|
2008-01-09 18:51:02 +00:00
|
|
|
std::string const &, std::vector<std::string> const &,
|
2009-08-14 15:20:11 +00:00
|
|
|
std::vector<std::string> const &, std::vector<std::string> const &,
|
2019-04-20 07:28:46 +00:00
|
|
|
std::string const &, bool const);
|
2007-11-07 21:52:11 +00:00
|
|
|
///
|
|
|
|
std::vector<LyXModule> modlist_;
|
|
|
|
};
|
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
|
|
|
|
2009-08-14 15:37:34 +00:00
|
|
|
extern ModuleList theModuleList;
|
2017-07-23 11:11:54 +00:00
|
|
|
} // namespace lyx
|
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
|
|
|
#endif
|