]> git.lyx.org Git - lyx.git/blobdiff - src/lyx_cb.C
minimal effort implementation of:
[lyx.git] / src / lyx_cb.C
index 70e751bac3ba7877a28bd06015c18324830c4bd8..9086b5fd3ec1b1053fca2a800c9d4f13dc31ef75 100644 (file)
@@ -19,6 +19,7 @@
 #include "buffer.h"
 #include "bufferlist.h"
 #include "BufferView.h"
+#include "buffer_funcs.h"
 #include "cursor.h"
 #include "debug.h"
 #include "gettext.h"
@@ -129,7 +130,7 @@ bool writeAs(Buffer * buffer, string const & filename)
        if (filename.empty()) {
 
                FileDialog fileDlg(_("Choose a filename to save document as"),
-                       LFUN_WRITEAS,
+                       LFUN_BUFFER_WRITE_AS,
                        make_pair(string(_("Documents|#o#O")),
                                  string(lyxrc.document_path)),
                        make_pair(string(_("Templates|#T#t")),
@@ -216,7 +217,7 @@ void quitLyX(bool noask)
                Alert::warning(_("Unable to remove temporary directory"), msg);
        }
 
-       lyx_gui::exit();
+       lyx_gui::exit(0);
 }
 
 
@@ -284,7 +285,8 @@ int AutoSaveBuffer::generateChild()
                                // It is dangerous to do this in the child,
                                // but safe in the parent, so...
                                if (pid == -1)
-                                       bv_.owner()->message(_("Autosave failed!"));
+                                       // emit message signal.
+                                       bv_.buffer()->message(_("Autosave failed!"));
                        }
                }
                if (pid == 0) { // we are the child so...
@@ -310,7 +312,8 @@ void autoSave(BufferView * bv)
                return;
        }
 
-       bv->owner()->message(_("Autosaving current document..."));
+       // emit message signal.
+       bv->buffer()->message(_("Autosaving current document..."));
 
        // create autosave filename
        string fname = bv->buffer()->filePath();
@@ -338,20 +341,13 @@ void newFile(BufferView * bv, string const & filename)
        // Split argument by :
        string name;
        string tmpname = split(filename, name, ':');
-#ifdef __EMX__ // Fix me! lyx_cb.C may not be low level enough to allow this.
-       if (name.length() == 1
-           && isalpha(static_cast<unsigned char>(name[0]))
-           && (prefixIs(tmpname, "/") || prefixIs(tmpname, "\\"))) {
-               name += ':';
-               name += token(tmpname, ':', 0);
-               tmpname = split(tmpname, ':');
-       }
-#endif
        lyxerr[Debug::INFO] << "Arg is " << filename
                            << "\nName is " << name
                            << "\nTemplate is " << tmpname << endl;
 
-       bv->newFile(name, tmpname);
+       Buffer * const b = newFile(name, tmpname);
+       if (b)
+               bv->setBuffer(b);
 }
 
 
@@ -442,17 +438,17 @@ string getContentsOfAsciiFile(BufferView * bv, string const & f, bool asParagrap
 // reconfigure the automatic settings.
 void reconfigure(BufferView * bv)
 {
-       bv->owner()->message(_("Running configure..."));
+       // emit message signal.
+       bv->buffer()->message(_("Running configure..."));
 
        // Run configure in user lyx directory
        Path p(package().user_support());
-       string const configure_script =
-               addName(package().system_support(), "configure.py");
-       string const configure_command = "python " + quoteName(configure_script);
+       string const configure_command = package().configure_command();
        Systemcall one;
        one.startscript(Systemcall::Wait, configure_command);
        p.pop();
-       bv->owner()->message(_("Reloading configuration..."));
+       // emit message signal.
+       bv->buffer()->message(_("Reloading configuration..."));
        lyxrc.read(libFileSearch(string(), "lyxrc.defaults"));
        // Re-read packages.lst
        LaTeXFeatures::getAvailable();