]> git.lyx.org Git - lyx.git/blobdiff - src/insets/InsetGraphics.cpp
* src/paragraph_funcs.cpp (breakParagraph): change parameter 'flag' to
[lyx.git] / src / insets / InsetGraphics.cpp
index e979e24e2f8303ff9409e231324dc966c1c6e2dd..cff5a843ea8d01f74c538c81db49a62397b06286 100644 (file)
@@ -243,13 +243,11 @@ void InsetGraphics::updateEmbeddedFile(Buffer const & buf,
        EmbeddedFile const & file)
 {
        BOOST_ASSERT(buf.embeddedFiles().enabled());
-       LYXERR(Debug::FILES) << "Update InsetGraphics file from " 
-               << params_.filename.toFilesystemEncoding() << std::endl;
-       params_.filename.set(file.availableFile(&buf), buf.filePath());
-       LYXERR(Debug::FILES) << " to " 
-               << params_.filename.toFilesystemEncoding() << std::endl;
-       // FIXME: graphics dialog is not updated even if the underlying
-       // filename is updated. What should I do?
+       params_.filename = file;
+       LYXERR(Debug::FILES) << "Update InsetGraphic with File " 
+               << params_.filename.toFilesystemEncoding() 
+               << ", embedding status: "
+               << params_.filename.embedded() << std::endl;
 }
 
 
@@ -259,18 +257,14 @@ void InsetGraphics::edit(Cursor & cur, bool)
 }
 
 
-bool InsetGraphics::metrics(MetricsInfo & mi, Dimension & dim) const
+void InsetGraphics::metrics(MetricsInfo & mi, Dimension & dim) const
 {
        graphic_->metrics(mi, dim);
-       bool const changed = dim_ != dim;
-       dim_ = dim;
-       return changed;
 }
 
 
 void InsetGraphics::draw(PainterInfo & pi, int x, int y) const
 {
-       setPosCache(pi, x, y);
        graphic_->draw(pi, x, y);
 }
 
@@ -305,7 +299,7 @@ void InsetGraphics::read(Buffer const & buf, Lexer & lex)
                if (it != buf.embeddedFiles().end())
                        // using available file, embedded or external, depending on file availability and
                        // embedding status.
-                       params_.filename = DocFileName(it->availableFile(&buf));
+                       params_.filename = *it;
        }
        graphic_->update(params().as_grfxParams());
 }
@@ -633,13 +627,12 @@ string const InsetGraphics::prepareFile(Buffer const & buf,
        if (status == FAILURE)
                return orig_file;
 
-       // a relative filename should be relative to the master
-       // buffer.
+       // a relative filename should be relative to the master buffer.
        // "nice" means that the buffer is exported to LaTeX format but not
-       //        run through the LaTeX compiler.
-       string output_file = support::os::external_path(runparams.nice ?
+       // run through the LaTeX compiler.
+       string output_file = runparams.nice ?
                params().filename.outputFilename(m_buffer->filePath()) :
-               onlyFilename(temp_file.absFilename()));
+               onlyFilename(temp_file.absFilename());
 
        if (runparams.nice && !isValidLaTeXFilename(output_file)) {
                frontend::Alert::warning(_("Invalid filename"),