]> git.lyx.org Git - lyx.git/blobdiff - src/insets/ExternalTemplate.C
Enable convertDefault.sh to run even if its executable bit is not set.
[lyx.git] / src / insets / ExternalTemplate.C
index 8ee1e68edf147be0647a640987aad3a2e39e8f59..2443e0756f66d3318666681b3d039db76b01e433 100644 (file)
@@ -5,14 +5,11 @@
  *
  * \author Asger Alstrup Nielsen
  *
- * Full author contact details are available in file CREDITS
+ * Full author contact details are available in file CREDITS.
  */
 
 #include <config.h>
 
-#ifdef __GNUG__
-#pragma implementation
-#endif
 
 #include <algorithm>
 
 #include "support/path.h"
 #include "support/LAssert.h"
 #include "support/filetools.h"
+#include "support/path_defines.h"
+
+using namespace lyx::support;
 
 using std::endl;
 using std::ostream;
 using std::for_each;
 
-extern string user_lyxdir;
-
-
 // We have to have dummy default commands for security reasons!
 
 ExternalTemplate::ExternalTemplate()
+       : inputFormat("*")
 {}
 
 
@@ -44,7 +42,7 @@ ExternalTemplate::FormatTemplate::FormatTemplate()
 ExternalTemplateManager::ExternalTemplateManager()
 {
        // gimp gnuchess gnuplot ical netscape tetris xpaint
-       readTemplates(user_lyxdir);
+       readTemplates(user_lyxdir());
        if (lyxerr.debugging())
                dumpTemplates();
 }
@@ -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:
@@ -250,7 +248,7 @@ void ExternalTemplate::readTemplate(LyXLex & lex)
                default:
                        lex.printError("ExternalTemplate::readTemplate: "
                                       "Wrong tag: $$Token");
-                       lyx::Assert(false);
+                       Assert(false);
                        break;
                }
        }
@@ -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: