]> git.lyx.org Git - lyx.git/blobdiff - src/buffer.C
citation patch from Angus
[lyx.git] / src / buffer.C
index 613f0d8b1f7c3dec64510dd9ac77d2a8adcd8cf0..82d8255cf675beb996882ae77a1decab3281231e 100644 (file)
@@ -87,6 +87,7 @@
 #include "lyx_gui_misc.h"      // WarnReadonly()
 #include "frontends/Dialogs.h"
 #include "encoding.h"
+#include "exporter.h"
 
 using std::ostream;
 using std::ofstream;
@@ -106,11 +107,13 @@ using std::istringstream;
 // all these externs should eventually be removed.
 extern BufferList bufferlist;
 
+#ifndef NEW_EXPORT
 extern void MenuExport(Buffer *, string const &);
+#endif
 extern LyXAction lyxaction;
 
 
-static const float LYX_FORMAT = 2.16;
+static const float LYX_FORMAT = 2.17;
 
 extern int tex_code_break_column;
 
@@ -1039,8 +1042,8 @@ void Buffer::readInset(LyXLex & lex, LyXParagraph *& par,
        } else if (tmptok == "GRAPHICS") {
                Inset * inset = new InsetGraphics;
                inset->Read(this, lex);
-               ++pos;
                par->InsertInset(pos, inset, font);
+               ++pos;
        } else if (tmptok == "LatexCommand") {
                InsetCommandParams inscmd;
                inscmd.Read(lex);
@@ -1068,7 +1071,7 @@ void Buffer::readInset(LyXLex & lex, LyXParagraph *& par,
                           || inscmd.getCmdName() == "prettyref") {
                        if (!inscmd.getOptions().empty()
                            || !inscmd.getContents().empty()) {
-                               inset = new InsetRef(inscmd, this);
+                               inset = new InsetRef(inscmd);
                        }
                } else if (inscmd.getCmdName() == "tableofcontents"
                           || inscmd.getCmdName() == "listofalgorithms"
@@ -1099,6 +1102,7 @@ bool Buffer::readFile(LyXLex & lex, LyXParagraph * par)
                        format = lex.GetFloat();
                        if (format > 1) {
                                if (LYX_FORMAT - format > 0.05) {
+                                       
                                        printf(_("Warning: need lyxformat %.2f but found %.2f\n"),
                                               LYX_FORMAT, format);
                                }
@@ -1203,19 +1207,7 @@ bool Buffer::save() const
        
        if (writeFile(fileName(), false)) {
                markLyxClean();
-
-               // now delete the autosavefile
-               string a = OnlyPath(fileName());
-               a += '#';
-               a += OnlyFilename(fileName());
-               a += '#';
-               FileInfo fileinfo(a);
-               if (fileinfo.exist()) {
-                       if (::remove(a.c_str()) != 0) {
-                               WriteFSAlert(_("Could not delete "
-                                              "auto-save file!"), a);
-                       }
-               }
+               removeAutosaveFile(fileName());
        } else {
                // Saving failed, so backup is not backup
                if (lyxrc.make_backup) {
@@ -3329,6 +3321,8 @@ void Buffer::SimpleDocBookOnePar(ostream & os, string & extra,
 
 int Buffer::runLaTeX()
 {
+#ifndef NEW_EXPORT
+
        if (!users->text) return 0;
 
        ProhibitInput(users);
@@ -3387,6 +3381,9 @@ int Buffer::runLaTeX()
         AllowInput(users);
  
         return latex.getNumErrors();
+#else
+       return 0;
+#endif
 }
 
 
@@ -3850,7 +3847,11 @@ bool Buffer::Dispatch(int action, string const & argument)
        bool dispatched = true;
        switch (action) {
                case LFUN_EXPORT: 
+#ifdef NEW_EXPORT
+                       Exporter::Export(this, argument, false);
+#else
                        MenuExport(this, argument);
+#endif
                        break;
 
                default: