X-Git-Url: https://git.lyx.org/gitweb/?a=blobdiff_plain;f=src%2Finsets%2FExternalTemplate.cpp;h=6bd02ac47a603b84803a2377c1a95b5744a9bc10;hb=3588f2f69675df8dbf829800b0ed6e4a455c68b4;hp=c172ccf13609b3dc6b3d428b5add636ed5133333;hpb=e1453ef6873b8c6d371a62471c5d309154133866;p=lyx.git diff --git a/src/insets/ExternalTemplate.cpp b/src/insets/ExternalTemplate.cpp index c172ccf136..6bd02ac47a 100644 --- a/src/insets/ExternalTemplate.cpp +++ b/src/insets/ExternalTemplate.cpp @@ -20,6 +20,7 @@ #include "support/lstrings.h" #include "support/Package.h" #include "support/Path.h" +#include "support/Translator.h" #include @@ -50,7 +51,7 @@ static TransformIDTranslator const & transformIDTranslator() // We have to have dummy default commands for security reasons! Template::Template() - : inputFormat("*") + : inputFormat("*"), automaticProduction(false), preview_mode(PREVIEW_OFF) {} @@ -102,8 +103,19 @@ public: << "\tHelpTextEnd\n" << "\tInputFormat " << et.inputFormat << '\n' << "\tFileFilter " << et.fileRegExp << '\n' - << "\tAutomaticProduction " << et.automaticProduction << '\n'; - + << "\tAutomaticProduction " << et.automaticProduction << '\n' + << "\tPreview "; + switch (et.preview_mode) { + case PREVIEW_OFF: + os_ << "Off\n"; + break; + case PREVIEW_GRAPHICS: + os_ << "Graphics\n"; + break; + case PREVIEW_INSTANT: + os_ << "InstantPreview\n"; + break; + } typedef vector IDs; IDs::const_iterator it = et.transformIds.begin(); IDs::const_iterator end = et.transformIds.end(); @@ -202,8 +214,7 @@ TemplateManager & TemplateManager::get() } -TemplateManager::Templates const & -TemplateManager::getTemplates() const +TemplateManager::Templates const & TemplateManager::getTemplates() const { return templates; } @@ -300,6 +311,7 @@ void Template::readTemplate(Lexer & lex) TO_INPUTFORMAT, TO_FILTER, TO_AUTOMATIC, + TO_PREVIEW, TO_TRANSFORM, TO_FORMAT, TO_END @@ -312,6 +324,7 @@ void Template::readTemplate(Lexer & lex) { "guiname", TO_GUINAME }, { "helptext", TO_HELPTEXT }, { "inputformat", TO_INPUTFORMAT }, + { "preview", TO_PREVIEW }, { "templateend", TO_END }, { "transform", TO_TRANSFORM } }; @@ -346,14 +359,25 @@ void Template::readTemplate(Lexer & lex) automaticProduction = lex.getBool(); break; - case TO_TRANSFORM: + case TO_PREVIEW: + lex >> token; + if (token == "InstantPreview") + preview_mode = PREVIEW_INSTANT; + else if (token == "Graphics") + preview_mode = PREVIEW_GRAPHICS; + else + preview_mode = PREVIEW_OFF; + break; + + case TO_TRANSFORM: { lex >> token; TransformID id = transformIDTranslator().find(token); if (int(id) == -1) LYXERR0("Transform " << token << " is not recognized"); else - ids.push_back(id); + transformIds.push_back(id); break; + } case TO_FORMAT: lex.next(true); @@ -366,7 +390,7 @@ void Template::readTemplate(Lexer & lex) default: lex.printError("external::Template::readTemplate: " "Wrong tag: $$Token"); - BOOST_ASSERT(false); + LASSERT(false, /**/); break; } }