]> git.lyx.org Git - features.git/commitdiff
Fix the drawing of an inset with a relative file path subdir/fig.eps
authorAngus Leeming <leeming@lyx.org>
Mon, 21 Oct 2002 12:00:51 +0000 (12:00 +0000)
committerAngus Leeming <leeming@lyx.org>
Mon, 21 Oct 2002 12:00:51 +0000 (12:00 +0000)
when pasting it into a buffer in a different directory.

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@5457 a592a061-630c-0410-9148-cb99ea01b6c8

src/insets/ChangeLog
src/insets/insetgraphics.C

index 010ee214d183bee631b0e4b76f57e4e8fde04a91..0a56f1ee842b0a8aa3ac9ac86d3269ae4ba3ae5f 100644 (file)
@@ -1,3 +1,9 @@
+2002-10-21  Angus Leeming  <leeming@lyx.org>
+
+       * insetgraphics.C (draw): Fix the drawing of an inset with a relative
+       file path subdir/fig.eps when pasting it into a buffer in a different
+       directory.
+
 2002-10-16  John Levon  <levon@movementarian.org>
 
        * insetspecialchar.C: remove \\protected_separator parsing
index 814387c8b908c440341c5121cc0767e2e758fb28..649fc0abbf57abd3e0f31af4140ac36db56ff978 100644 (file)
@@ -294,6 +294,18 @@ int InsetGraphics::width(BufferView *, LyXFont const & font) const
 void InsetGraphics::draw(BufferView * bv, LyXFont const & font,
                         int baseline, float & x, bool) const
 {
+       // MakeAbsPath returns params().filename unchanged if it absolute
+       // already.
+       string const file_with_path =
+               MakeAbsPath(params().filename, bv->buffer()->filePath());
+
+       // A 'paste' operation creates a new inset with the correct filepath,
+       // but then the 'old' inset stored in the 'copy' operation is actually
+       // added to the buffer.
+       // Thus, we should ensure that the filepath is correct.
+       if (file_with_path != cache_->loader.filename())
+               cache_->update(file_with_path);
+
        cache_->view = bv->owner()->view();
        int oasc = cache_->old_ascent;