From dde4494e664969224fde917beab8bedf4f8a0971 Mon Sep 17 00:00:00 2001 From: Angus Leeming Date: Mon, 21 Oct 2002 12:00:51 +0000 Subject: [PATCH] Fix the drawing of an inset with a relative file path subdir/fig.eps 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 | 6 ++++++ src/insets/insetgraphics.C | 12 ++++++++++++ 2 files changed, 18 insertions(+) diff --git a/src/insets/ChangeLog b/src/insets/ChangeLog index 010ee214d1..0a56f1ee84 100644 --- a/src/insets/ChangeLog +++ b/src/insets/ChangeLog @@ -1,3 +1,9 @@ +2002-10-21 Angus Leeming + + * 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 * insetspecialchar.C: remove \\protected_separator parsing diff --git a/src/insets/insetgraphics.C b/src/insets/insetgraphics.C index 814387c8b9..649fc0abbf 100644 --- a/src/insets/insetgraphics.C +++ b/src/insets/insetgraphics.C @@ -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; -- 2.39.2