]> git.lyx.org Git - lyx.git/blobdiff - src/lyx_cb.C
Alfredo's second patch
[lyx.git] / src / lyx_cb.C
index 4230954a60bc6ad0ba3bda3ba032f1f79fcf962c..2481bd6c895d55a492a724952fb6f637bef4a9ed 100644 (file)
 #include "support/systemcall.h"
 #include "support/lstrings.h"
 
-#include "BoostFormat.h"
+#include "support/BoostFormat.h"
 
 #include <fstream>
 #include <algorithm>
 #include <utility>
+#include <cerrno>
 
 using std::vector;
 using std::ifstream;
@@ -62,7 +63,7 @@ void ShowMessage(Buffer const * buf,
                 string const & msg2,
                 string const & msg3)
 {
-       if (lyxrc.use_gui
+       if (lyx_gui::use_gui
            && buf && buf->getUser() && buf->getUser()->owner()) {
                        string const str = msg1 + ' ' + msg2 + ' ' + msg3;
                        buf->getUser()->owner()->message(str);
@@ -95,7 +96,7 @@ bool MenuWrite(BufferView * bv, Buffer * buffer)
        text += file + _(" could not be saved.\n\nDo you want to rename the document and try again?");
 #endif
        int const ret = Alert::prompt(_("Rename and save?"),
-               text, 0, _("&Rename"), _("&Cancel"));
+               text, 0, 1, _("&Rename"), _("&Cancel"));
 
        if (ret == 0)
                return WriteAs(bv, buffer);
@@ -154,7 +155,7 @@ bool WriteAs(BufferView * bv, Buffer * buffer, string const & filename)
                text += file + _(" already exists.\n\nDo you want to over-write that document?");
 #endif
                int const ret = Alert::prompt(_("Over-write document?"),
-                       text, 1, _("&Over-write"), _("&Cancel"));
+                       text, 0, 1, _("&Over-write"), _("&Cancel"));
 
                if (ret == 1)
                        return false;
@@ -177,42 +178,11 @@ bool WriteAs(BufferView * bv, Buffer * buffer, string const & filename)
 }
 
 
-int MenuRunChktex(Buffer * buffer)
-{
-       int ret;
-
-       if (buffer->isSGML()) {
-               Alert::alert(_("Chktex does not work with SGML derived documents."));
-               return 0;
-       } else
-               ret = buffer->runChktex();
-
-       if (ret >= 0) {
-               string s;
-               string t;
-               if (ret == 0) {
-                       s = _("No warnings found.");
-               } else if (ret == 1) {
-                       s = _("One warning found.");
-                       t = _("Use `Navigate->Error' to find it.");
-               } else {
-                       s += tostr(ret);
-                       s += _(" warnings found.");
-                       t = _("Use `Navigate->Error' to find them.");
-               }
-               Alert::alert(_("Chktex run successfully"), s, t);
-       } else {
-               Alert::alert(_("Error!"), _("It seems chktex does not work."));
-       }
-       return ret;
-}
-
-
 void QuitLyX()
 {
        lyxerr[Debug::INFO] << "Running QuitLyX." << endl;
 
-       if (lyxrc.use_gui) {
+       if (lyx_gui::use_gui) {
                if (!bufferlist.quitWriteAll())
                        return;
 
@@ -492,7 +462,7 @@ string getContentsOfAsciiFile(BufferView * bv, string const & f, bool asParagrap
 
 string const getPossibleLabel(BufferView const & bv)
 {
-       Paragraph * par = bv.getLyXText()->cursor.par();
+       Paragraph * par = &*bv.getLyXText()->cursor.par();
        LyXLayout_ptr layout = par->layout();
        if (layout->latextype == LATEX_PARAGRAPH && par->previous()) {
                Paragraph * par2 = par->previous();