]> git.lyx.org Git - lyx.git/blobdiff - src/insets/ExternalTemplate.C
Enable the external inset to handle unknown templates gracefully.
[lyx.git] / src / insets / ExternalTemplate.C
index 8ee1e68edf147be0647a640987aad3a2e39e8f59..bfa1e851b86d53ad6e372446f733ee52e04d0f25 100644 (file)
@@ -10,9 +10,6 @@
 
 #include <config.h>
 
-#ifdef __GNUG__
-#pragma implementation
-#endif
 
 #include <algorithm>
 
@@ -34,6 +31,7 @@ extern string user_lyxdir;
 // We have to have dummy default commands for security reasons!
 
 ExternalTemplate::ExternalTemplate()
+       : inputFormat("*")
 {}
 
 
@@ -62,8 +60,8 @@ public:
                    << "\tHelpText\n"
                    << et.helpText
                    << "\tHelpTextEnd\n"
+                   << "\tInputFormat " << et.inputFormat << "\n"
                    << "\tFileFilter " << et.fileRegExp << "\n"
-                   << "\tViewCommand " << et.viewCommand << "\n"
                    << "\tEditCommand " << et.editCommand << "\n"
                    << "\tAutomaticProduction " << et.automaticProduction << "\n";
                et.dumpFormats(ost);
@@ -83,7 +81,7 @@ public:
                ExternalTemplate::FormatTemplate const & ft = vt.second;
                ost << "\tFormat " << vt.first << "\n"
                    << "\t\tProduct " << ft.product << "\n"
-                   << "\t\tUpdateCommand " << ft.updateCommand << "\n"
+                   << "\t\tUpdateFormat " << ft.updateFormat << "\n"
                    << "\t\tUpdateResult " << ft.updateResult << "\n"
                    << "\t\tRequirement " << ft.requirement << "\n"
                    << "\t\tPreamble\n"
@@ -187,8 +185,8 @@ void ExternalTemplate::readTemplate(LyXLex & lex)
        enum TemplateOptionTags {
                TO_GUINAME = 1,
                TO_HELPTEXT,
+               TO_INPUTFORMAT,
                TO_FILTER,
-               TO_VIEWCMD,
                TO_EDITCMD,
                TO_AUTOMATIC,
                TO_FORMAT,
@@ -202,8 +200,8 @@ void ExternalTemplate::readTemplate(LyXLex & lex)
                { "format", TO_FORMAT },
                { "guiname", TO_GUINAME },
                { "helptext", TO_HELPTEXT },
-               { "templateend", TO_END },
-               { "viewcommand", TO_VIEWCMD }
+               { "inputformat", TO_INPUTFORMAT },
+               { "templateend", TO_END }
        };
 
        pushpophelper pph(lex, templateoptiontags, TO_END);
@@ -219,14 +217,14 @@ void ExternalTemplate::readTemplate(LyXLex & lex)
                        helpText = lex.getLongString("HelpTextEnd");
                        break;
 
-               case TO_FILTER:
+               case TO_INPUTFORMAT:
                        lex.next(true);
-                       fileRegExp = lex.getString();
+                       inputFormat = lex.getString();
                        break;
 
-               case TO_VIEWCMD:
+               case TO_FILTER:
                        lex.next(true);
-                       viewCommand = lex.getString();
+                       fileRegExp = lex.getString();
                        break;
 
                case TO_EDITCMD:
@@ -261,7 +259,7 @@ void ExternalTemplate::FormatTemplate::readFormat(LyXLex & lex)
 {
        enum FormatTags {
                FO_PRODUCT = 1,
-               FO_UPDATECMD,
+               FO_UPDATEFORMAT,
                FO_UPDATERESULT,
                FO_REQUIREMENT,
                FO_PREAMBLE,
@@ -273,7 +271,7 @@ void ExternalTemplate::FormatTemplate::readFormat(LyXLex & lex)
                { "preamble", FO_PREAMBLE },
                { "product", FO_PRODUCT },
                { "requirement", FO_REQUIREMENT },
-               { "updatecommand", FO_UPDATECMD },
+               { "updateformat", FO_UPDATEFORMAT },
                { "updateresult", FO_UPDATERESULT }
        };
 
@@ -286,9 +284,9 @@ void ExternalTemplate::FormatTemplate::readFormat(LyXLex & lex)
                        product = lex.getString();
                        break;
 
-               case FO_UPDATECMD:
+               case FO_UPDATEFORMAT:
                        lex.next(true);
-                       updateCommand = lex.getString();
+                       updateFormat = lex.getString();
                        break;
 
                case FO_UPDATERESULT: