X-Git-Url: https://git.lyx.org/gitweb/?a=blobdiff_plain;f=src%2Finsets%2FExternalTemplate.cpp;h=6bd02ac47a603b84803a2377c1a95b5744a9bc10;hb=3588f2f69675df8dbf829800b0ed6e4a455c68b4;hp=7861e8a59fa0fd869143385a689a5ded1289272b;hpb=7f461f4392a19cf488dec005d2f12cfea83655d9;p=lyx.git diff --git a/src/insets/ExternalTemplate.cpp b/src/insets/ExternalTemplate.cpp index 7861e8a59f..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(); @@ -299,6 +311,7 @@ void Template::readTemplate(Lexer & lex) TO_INPUTFORMAT, TO_FILTER, TO_AUTOMATIC, + TO_PREVIEW, TO_TRANSFORM, TO_FORMAT, TO_END @@ -311,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 } }; @@ -345,6 +359,16 @@ void Template::readTemplate(Lexer & lex) automaticProduction = lex.getBool(); break; + 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);