mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-11-09 18:31:04 +00:00
Enable multiple preamble snippets to be accessed by each format.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@7814 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
parent
d5f7b7dec2
commit
858e197b7c
@ -1,3 +1,8 @@
|
||||
2003-09-23 Angus Leeming <leeming@lyx.org>
|
||||
|
||||
* FormExternal.C (updateComboChange): use formatted to ensure that the
|
||||
help text fits in the browser.
|
||||
|
||||
2003-09-21 Lars Gullik Bjønnes <larsbj@gullik.net>
|
||||
|
||||
* XFormsToolbar.C: adjust
|
||||
|
@ -183,7 +183,9 @@ void FormExternal::updateComboChange()
|
||||
ExternalTemplate templ = controller().getTemplate(choice);
|
||||
|
||||
// Update the help text
|
||||
string const txt = formatted(templ.helpText,
|
||||
dialog_->browser_helptext->w - 20);
|
||||
fl_clear_browser(dialog_->browser_helptext);
|
||||
fl_addto_browser(dialog_->browser_helptext, templ.helpText.c_str());
|
||||
fl_addto_browser(dialog_->browser_helptext, txt.c_str());
|
||||
fl_set_browser_topline(dialog_->browser_helptext, 0);
|
||||
}
|
||||
|
@ -1,3 +1,11 @@
|
||||
2003-09-23 Angus Leeming <leeming@lyx.org>
|
||||
|
||||
* ExternalTemplate.[Ch]: can have multiple preamble snippets if we store them
|
||||
in a vector, preambleNames.
|
||||
|
||||
* insetexternal.C (validate): loop over all preambleNames and call
|
||||
LaTeXFeatures::addExternalPreamble with each.
|
||||
|
||||
2003-09-22 Martin Vermeer <martin.vermeer@hut.fi>
|
||||
|
||||
* insetbranch.C: bug fix in branches
|
||||
|
@ -30,6 +30,7 @@ using std::endl;
|
||||
using std::for_each;
|
||||
|
||||
using std::ostream;
|
||||
using std::vector;
|
||||
|
||||
|
||||
// We have to have dummy default commands for security reasons!
|
||||
@ -111,9 +112,17 @@ public:
|
||||
<< "\t\tProduct " << ft.product << '\n'
|
||||
<< "\t\tUpdateFormat " << ft.updateFormat << '\n'
|
||||
<< "\t\tUpdateResult " << ft.updateResult << '\n'
|
||||
<< "\t\tRequirement " << ft.requirement << '\n'
|
||||
<< "\t\tPreamble " << ft.preambleName << '\n'
|
||||
<< "\tFormatEnd\n";
|
||||
<< "\t\tRequirement " << ft.requirement << '\n';
|
||||
|
||||
if (!ft.preambleNames.empty()) {
|
||||
vector<string>::const_iterator it = ft.preambleNames.begin();
|
||||
vector<string>::const_iterator end = ft.preambleNames.end();
|
||||
for (; it != end; ++it) {
|
||||
ost << "\t\tPreamble " << *it << '\n';
|
||||
}
|
||||
}
|
||||
|
||||
ost << "\tFormatEnd\n";
|
||||
}
|
||||
private:
|
||||
ostream & ost;
|
||||
@ -361,7 +370,7 @@ void ExternalTemplate::FormatTemplate::readFormat(LyXLex & lex)
|
||||
|
||||
case FO_PREAMBLE:
|
||||
lex.next(true);
|
||||
preambleName = lex.getString();
|
||||
preambleNames.push_back(lex.getString());
|
||||
break;
|
||||
|
||||
case FO_END:
|
||||
|
@ -17,6 +17,7 @@
|
||||
#include <map>
|
||||
#include "support/std_string.h"
|
||||
#include <boost/utility.hpp>
|
||||
#include <vector>
|
||||
|
||||
class LyXLex;
|
||||
|
||||
@ -48,8 +49,8 @@ struct ExternalTemplate {
|
||||
string updateFormat;
|
||||
/// What features does this external inset require?
|
||||
string requirement;
|
||||
/// Identify the preamble snippet using \c preambleName.
|
||||
string preambleName;
|
||||
/// A collection of preamble snippets identified by name.
|
||||
std::vector<string> preambleNames;
|
||||
///
|
||||
void readFormat(LyXLex &);
|
||||
/// This constructor has to default a command for safety reasons!
|
||||
|
@ -43,10 +43,12 @@
|
||||
namespace support = lyx::support;
|
||||
|
||||
using std::endl;
|
||||
|
||||
using std::auto_ptr;
|
||||
using std::istringstream;
|
||||
using std::ostream;
|
||||
using std::ostringstream;
|
||||
using std::vector;
|
||||
|
||||
|
||||
namespace lyx {
|
||||
@ -459,9 +461,14 @@ void InsetExternal::validate(LaTeXFeatures & features) const
|
||||
features.require(cit->second.requirement);
|
||||
|
||||
ExternalTemplateManager & etm = ExternalTemplateManager::get();
|
||||
string const preamble = etm.getPreambleDefByName(cit->second.preambleName);
|
||||
if (!preamble.empty())
|
||||
features.addExternalPreamble(preamble);
|
||||
|
||||
vector<string>::const_iterator it = cit->second.preambleNames.begin();
|
||||
vector<string>::const_iterator end = cit->second.preambleNames.end();
|
||||
for (; it != end; ++it) {
|
||||
string const preamble = etm.getPreambleDefByName(*it);
|
||||
if (!preamble.empty())
|
||||
features.addExternalPreamble(preamble);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user