]> git.lyx.org Git - lyx.git/blobdiff - src/buffer.C
Introduce and use latex_path().
[lyx.git] / src / buffer.C
index 8acdc91f38600d3e281f498ccefccbbbdd385997..8f698f51968a1f0af0b3528673a125b46aac5fee 100644 (file)
@@ -13,6 +13,7 @@
 #include "buffer.h"
 
 #include "author.h"
+#include "BranchList.h"
 #include "buffer_funcs.h"
 #include "bufferlist.h"
 #include "bufferparams.h"
@@ -97,6 +98,7 @@ using lyx::support::destroyDir;
 using lyx::support::getFormatFromContents;
 using lyx::support::IsDirWriteable;
 using lyx::support::LibFileSearch;
+using lyx::support::latex_path;
 using lyx::support::ltrim;
 using lyx::support::MakeAbsPath;
 using lyx::support::MakeDisplayPath;
@@ -395,6 +397,20 @@ int Buffer::readHeader(LyXLex & lex)
        int line = -1;
        int begin_header_line = -1;
 
+       // Initialize parameters that may be/go lacking in header:
+       params().branchlist().clear();
+       params().options.erase();
+       params().float_placement.erase();
+       params().paperwidth.erase();
+       params().paperheight.erase();
+       params().leftmargin.erase();
+       params().rightmargin.erase();
+       params().topmargin.erase();
+       params().bottommargin.erase();
+       params().headheight.erase();
+       params().headsep.erase();
+       params().footskip.erase();
+
        while (lex.isOK()) {
                lex.next();
                string const token = lex.getString();
@@ -482,7 +498,7 @@ void Buffer::insertStringAsLines(ParagraphList & pars,
        // insert the string, don't insert doublespace
        bool space_inserted = true;
        for (string::const_iterator cit = str.begin();
-           cit != str.end(); ++cit) { 
+           cit != str.end(); ++cit) {
                Paragraph & par = pars[pit];
                if (*cit == '\n') {
                        if (autobreakrows && (!par.empty() || par.allowEmpty())) {
@@ -855,8 +871,7 @@ void Buffer::makeLaTeXFile(ostream & os,
                        texrow().newline();
                }
                if (!original_path.empty()) {
-                       string inputpath = os::external_path(original_path);
-                       subst(inputpath, "~", "\\string~");
+                       string const inputpath = latex_path(original_path);
                        os << "\\makeatletter\n"
                            << "\\def\\input@path{{"
                            << inputpath << "/}}\n"