]> git.lyx.org Git - lyx.git/blobdiff - src/tex2lyx/tex2lyx.cpp
InsetParamsDialog: fix Restore button enabling/disabling.
[lyx.git] / src / tex2lyx / tex2lyx.cpp
index d2aad9ed88ef6088ebf9d42de6a9ac9a19935725..a3fb9b49df91674c318f0fe16c5bd70792ec1827 100644 (file)
@@ -42,22 +42,34 @@ using namespace lyx::support::os;
 
 namespace lyx {
 
+namespace frontend {
+namespace Alert {
+       void warning(docstring const & title, docstring const & message,
+                                bool const &)
+       {
+               LYXERR0(title);
+               LYXERR0(message);
+       }
+}
+}
+
+
 // Dummy translation support
 Messages messages_;
-Messages & getMessages(std::string const &)
+Messages const & getMessages(std::string const &)
 {
        return messages_;
 }
 
 
-Messages & getGuiMessages()
+Messages const & getGuiMessages()
 {
        return messages_;
 }
 
 
 // Keep the linker happy on Windows
-void emergencyCleanup()
+void lyx_exit(int)
 {}
 
 
@@ -381,13 +393,14 @@ void easyParse(int & argc, char * argv[])
                                continue;
                }
 
-               string arg(to_utf8(from_local8bit((i + 1 < argc) ? argv[i + 1] : "")));
-               string arg2(to_utf8(from_local8bit((i + 2 < argc) ? argv[i + 2] : "")));
+               string arg = (i + 1 < argc) ? os::utf8_argv(i + 1) : string();
+               string arg2 = (i + 2 < argc) ? os::utf8_argv(i + 2) : string();
 
                int const remove = 1 + it->second(arg, arg2);
 
                // Now, remove used arguments by shifting
                // the following ones remove places down.
+               os::remove_internal_args(i, remove);
                argc -= remove;
                for (int j = i; j < argc; ++j)
                        argv[j] = argv[j + remove];
@@ -471,7 +484,7 @@ bool tex2lyx(FileName const & infilename, ostream & os, string const & encoding)
                return false;
        }
        string const oldParentFilePath = parentFilePath;
-       parentFilePath = onlyPath(infilename.absFilename());
+       parentFilePath = onlyPath(infilename.absFileName());
        tex2lyx(is, os, encoding);
        parentFilePath = oldParentFilePath;
        return true;
@@ -519,14 +532,15 @@ int main(int argc, char * argv[])
 
        lyxerr.setStream(cerr);
 
+       os::init(argc, argv);
+
        easyParse(argc, argv);
 
        if (argc <= 1) 
                error_message("Not enough arguments.");
-       os::init(argc, argv);
 
        try {
-               init_package(internal_path(to_utf8(from_local8bit(argv[0]))),
+               init_package(internal_path(os::utf8_argv(0)),
                             cl_system_support, cl_user_support,
                             top_build_dir_is_two_levels_up);
        } catch (ExceptionMessage const & message) {
@@ -538,14 +552,14 @@ int main(int argc, char * argv[])
 
        // Now every known option is parsed. Look for input and output
        // file name (the latter is optional).
-       string infilename = internal_path(to_utf8(from_local8bit(argv[1])));
-       infilename = makeAbsPath(infilename).absFilename();
+       string infilename = internal_path(os::utf8_argv(1));
+       infilename = makeAbsPath(infilename).absFileName();
 
        string outfilename;
        if (argc > 2) {
-               outfilename = internal_path(to_utf8(from_local8bit(argv[2])));
+               outfilename = internal_path(os::utf8_argv(2));
                if (outfilename != "-")
-                       outfilename = makeAbsPath(outfilename).absFilename();
+                       outfilename = makeAbsPath(outfilename).absFileName();
        } else
                outfilename = changeExtension(infilename, ".lyx");