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
This commit is contained in:
Angus Leeming 2002-10-21 12:00:51 +00:00
parent 855235a028
commit dde4494e66
2 changed files with 18 additions and 0 deletions

View 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

View 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;