]> git.lyx.org Git - lyx.git/blobdiff - src/Buffer.cpp
Remove unused UI file.
[lyx.git] / src / Buffer.cpp
index efc83fa4910a70fd0275945efb102bd739bc3ada..b116f0f0945a4f8b426ee3e6553636393cb0a3f7 100644 (file)
@@ -127,7 +127,7 @@ namespace {
 
 // Do not remove the comment below, so we get merge conflict in
 // independent branches. Instead add your own.
-int const LYX_FORMAT = 374; // rgheck: HTML output options
+int const LYX_FORMAT = 375; // jspitzm: includeonly support
 
 typedef map<string, bool> DepClean;
 typedef map<docstring, pair<InsetLabel const *, Buffer::References> > RefCache;
@@ -317,8 +317,8 @@ Buffer::Buffer(string const & file, bool readonly, Buffer const * cloned_buffer)
        if (cloned_buffer) {
                d->inset = new InsetText(*cloned_buffer->d->inset);
                d->inset->setBuffer(*this);
-               // FIXME 1: optimize this loop somewhat, maybe by creatinga new
-               // greneral recursive Inset::setId().
+               // FIXME: optimize this loop somewhat, maybe by creating a new
+               // general recursive Inset::setId().
                DocIterator it = doc_iterator_begin(this);
                DocIterator cloned_it = doc_iterator_begin(cloned_buffer);
                for (; !it.atEnd(); it.forwardPar(), cloned_it.forwardPar())
@@ -380,6 +380,8 @@ Buffer::~Buffer()
 
 Buffer * Buffer::clone() const
 {
+       // FIXME for asynchronous export and preview: We must also clone all
+       // the child buffers!
        return new Buffer(fileName().absFilename(), false, this);
 }
 
@@ -390,10 +392,10 @@ bool Buffer::isClone() const
 }
 
 
-void Buffer::changed() const
+void Buffer::changed(bool update_metrics) const
 {
        if (d->wa_)
-               d->wa_->redrawAll();
+               d->wa_->redrawAll(update_metrics);
 }
 
 
@@ -605,6 +607,7 @@ int Buffer::readHeader(Lexer & lex)
        params().listings_params.clear();
        params().clearLayoutModules();
        params().clearRemovedModules();
+       params().clearIncludedChildren();
        params().pdfoptions().clear();
        params().indiceslist().clear();
        params().backgroundcolor = lyx::rgbFromHexName("#ffffff");
@@ -1257,7 +1260,9 @@ void Buffer::writeLaTeXSource(odocstream & os,
                listParentMacros(parentMacros, features);
 
                // Write the preamble
-               runparams.use_babel = params().writeLaTeX(os, features, d->texrow);
+               runparams.use_babel = params().writeLaTeX(os, features,
+                                                         d->texrow,
+                                                         d->filename.onlyPath());
 
                runparams.use_japanese = features.isRequired("japanese");
 
@@ -3198,6 +3203,14 @@ bool Buffer::doExport(string const & format, bool put_in_tempdir,
        if (!success)
                return false;
 
+       if (d->cloned_buffer_) {
+               // Enable reverse dvi or pdf to work by copying back the texrow
+               // object to the cloned buffer.
+               // FIXME: There is a possibility of concurrent access to texrow
+               // here from the main GUI thread that should be securized.
+               d->cloned_buffer_->d->texrow = d->texrow;
+       }
+
        if (put_in_tempdir) {
                result_file = tmp_result_file.absFilename();
                return true;
@@ -3761,4 +3774,26 @@ int Buffer::spellCheck(DocIterator & from, DocIterator & to,
        return progress;
 }
 
+
+bool Buffer::reload()
+{
+       setBusy(true);
+       // e.g., read-only status could have changed due to version control
+       d->filename.refresh();
+       docstring const disp_fn = makeDisplayPath(d->filename.absFilename());
+
+       bool const success = loadLyXFile(d->filename);
+       if (success) {
+               updateLabels();
+               changed(true);
+               errors("Parse");
+               message(bformat(_("Document %1$s reloaded."), disp_fn));
+       } else {
+               message(bformat(_("Could not reload document %1$s."), disp_fn));
+       }       
+       setBusy(false);
+       return success;
+}
+
+
 } // namespace lyx