Re: InsetGraphics and relative paths don't mix well

2002-02-15 Thread Jean-Marc Lasgouttes

> "Angus" == Angus Leeming <[EMAIL PROTECTED]> writes:

Angus> On Thursday 14 February 2002 4:23 pm, John Levon wrote:
>> perhaps even better would be to secretly store both the relative
>> and
Angus> absoluate
>> paths. That way the document then also has a chance of surviving a
>> "mv",
Angus> because
>> we look at the absolute path after a failing relative path

Angus> I've thought for some time that these dialogs should have a
Angus> "store as absolute path" check button. That would solve all our
Angus> woes, wouldn't it?

I think that the heuristic of storing the relative path when it is
below the document path works OK. Note that you can always write an
absolute path and it will be kept like that. The behaviour of
computing a relative path is only implemented in the browse button. It
seems to me that this is both simple and efficient.

JMarc



Re: InsetGraphics and relative paths don't mix well

2002-02-14 Thread Angus Leeming

On Thursday 14 February 2002 4:23 pm, John Levon wrote:
> perhaps even better would be to secretly store both the relative and 
absoluate
> paths. That way the document then also has a chance of surviving a "mv", 
because
> we look at the absolute path after a failing relative path

I've thought for some time that these dialogs should have a 
"store as absolute path" check button. That would solve all our woes, 
wouldn't it?

Angus



Re: InsetGraphics and relative paths don't mix well

2002-02-14 Thread Jean-Marc Lasgouttes

> "John" == John Levon <[EMAIL PROTECTED]> writes:

John> On Thu, Feb 14, 2002 at 12:05:33PM +0100, Jean-Marc Lasgouttes
John> wrote:
>> I think insetgraphics should treat all file names as relative to
>> buffer directory.

John> definitely because then it also allows :

John> /home/moz/mypictures/picture.png

John> so both cases would be covered fine

This is what the include inset does.

John> perhaps even better would be to secretly store both the relative
John> and absoluate paths. That way the document then also has a
John> chance of surviving a "mv", because we look at the absolute path
John> after a failing relative path

Secret things are guarenteed to break and annoy greatly the user.

However, we have a problem with this scheme (also in InsetInclude):
- doc1.lyx includes subdir/doc2.lyx
- subdir/doc2.lyx includes subdir/image.eps, which is therefore
  written as "image.eps".
- when running latex, image.eps is not found.

This means that when producing latex, the InsetInclude and
InsetGraphics should produce file names relative to the main document. 

I have not checked recently, but I think the problem is still here.

JMarc



Re: InsetGraphics and relative paths don't mix well

2002-02-14 Thread John Levon

On Thu, Feb 14, 2002 at 12:05:33PM +0100, Jean-Marc Lasgouttes wrote:

> I think insetgraphics should treat all file names as relative to buffer
> directory. 

definitely because then it also allows :

/home/moz/mypictures/picture.png

so both cases would be covered fine

perhaps even better would be to secretly store both the relative and absoluate
paths. That way the document then also has a chance of surviving a "mv", because
we look at the absolute path after a failing relative path

regards
john
-- 
"I'd rather be rudely informed than politely left in the dark."



Re: InsetGraphics and relative paths don't mix well

2002-02-14 Thread Jean-Marc Lasgouttes

> "Allan" == Allan Rae <[EMAIL PROTECTED]> writes:

Allan> I have a figure at:

Allan>  ../common/new-banner.png

Allan> that I'm using in a document. PDFLaTeX is able to find and
Allan> render it but InsetGraphics complains with an error message
Allan> (Alert dialog) that the file either doesn't exist or is
Allan> unreadable.

See the following comment at the beginning of insetgraphics.C:

* If the image is from the clipart, and the document is moved to another
   directory, the user is screwed. Need a way to handle it.
   This amounts to a problem of when to use relative or absolute file paths
   We should probably use what the user asks to use... but when he chooses
   by the file dialog we normally get an absolute path and this may not be 
   what the user meant.
   [Note that browseRelFile in helper_funcs.* provides a file name
which is relative if it is at reference path (here puffer path)
level or below, and an absolute path if the file name is not a
`natural' relative file name. In any case,
MakeAbsPath(filename, buf->filePath())
is guaranteed to provide the correct absolute path. This is what is
done know for include insets. Feel free to ask me -- JMarc
14/01/2002]


I think insetgraphics should treat all file names as relative to buffer
directory. 

JMarc