]> git.lyx.org Git - lyx.git/blobdiff - src/lyx_cb.C
remove noload/don't typeset
[lyx.git] / src / lyx_cb.C
index 2e2983271755cd526622eecf15ef8fff85a8df90..30f2d89da14f0d98808660482f405574260099a5 100644 (file)
 #include "bufferview_funcs.h"
 #include "debug.h"
 #include "lastfiles.h"
-#include "frontends/LyXView.h"
 #include "lyxrc.h"
 #include "lyxtext.h"
 #include "gettext.h"
 #include "BufferView.h"
-#include "lyxtextclasslist.h"
 
 #include "insets/insetlabel.h"
 
+#include "frontends/lyx_gui.h"
+#include "frontends/LyXView.h"
 #include "frontends/Alert.h"
 #include "frontends/FileDialog.h"
 
@@ -53,7 +53,6 @@ using std::make_pair;
 extern BufferList bufferlist;
 // this should be static, but I need it in buffer.C
 bool quitting; // flag, that we are quitting the program
-extern bool finished; // all cleanup done just let it run through now.
 
 
 void ShowMessage(Buffer const * buf,
@@ -240,7 +239,7 @@ void QuitLyX()
 
        DestroyLyXTmpDir(system_tempdir);
 
-       finished = true;
+       lyx_gui::exit();
 }
 
 
@@ -279,7 +278,7 @@ void AutoSave(BufferView * bv)
 
                string const tmp_ret = lyx::tempName(string(), "lyxauto");
                if (!tmp_ret.empty()) {
-                       bv->buffer()->writeFile(tmp_ret, 1);
+                       bv->buffer()->writeFile(tmp_ret);
                        // assume successful write of tmp_ret
                        if (!lyx::rename(tmp_ret, fname)) {
                                failed = true;
@@ -294,7 +293,7 @@ void AutoSave(BufferView * bv)
 
                if (failed) {
                        // failed to write/rename tmp_ret so try writing direct
-                       if (!bv->buffer()->writeFile(fname, 1)) {
+                       if (!bv->buffer()->writeFile(fname)) {
                                // It is dangerous to do this in the child,
                                // but safe in the parent, so...
                                if (pid == -1)
@@ -318,7 +317,7 @@ void AutoSave(BufferView * bv)
 // create new file with template
 // SERVERCMD !
 //
-Buffer * NewLyxFile(string const & filename)
+Buffer * NewFile(string const & filename)
 {
        // Split argument by :
        string name;
@@ -429,17 +428,16 @@ string getContentsOfAsciiFile(BufferView * bv, string const & f, bool asParagrap
 
 void MenuInsertLabel(BufferView * bv, string const & arg)
 {
-       string label(arg);
+       string label = arg;
        bv->owner()->prohibitInput();
        if (label.empty()) {
                Paragraph * par = bv->getLyXText()->cursor.par();
-               LyXTextClass const & tclass =
-                       textclasslist[bv->buffer()->params.textclass];
-               LyXLayout const * layout = &tclass[par->layout()];
-
+               LyXLayout_ptr layout = par->layout();
                if (layout->latextype == LATEX_PARAGRAPH && par->previous()) {
                        Paragraph * par2 = par->previous();
-                       LyXLayout const * layout2 = &tclass[par2->layout()];
+
+                       LyXLayout_ptr const & layout2 = par2->layout();
+
                        if (layout2->latextype != LATEX_PARAGRAPH) {
                                par = par2;
                                layout = layout2;
@@ -468,7 +466,7 @@ void MenuInsertLabel(BufferView * bv, string const & arg)
                pair<bool, string> result =
                        Alert::askForText(_("Enter new label to insert:"), text);
                if (result.first) {
-                       label = frontStrip(strip(result.second));
+                       label = trim(result.second);
                }
        }
        if (!label.empty()) {