[PATCH] Re: LyX 1.2pre4 Image File Extension

2002-04-28 Thread Herbert Voss

John Levon wrote:

 On Sun, Apr 28, 2002 at 12:31:07AM +0200, Herbert Voss wrote:
 
 
LyX itself needs the real filename, means with extension.
Remeber that 1.2.0 allows a lot of different graphic formats,
which are converted to eps or pdf.

 
 Can you mention this in UPGRADING then please ?


this is a real bug in 1.2.0pre4!

here is a patch, to get the same behaviour as in 1.1.6:


without extension:
- no view in LyX (because we do not know which file should be
   viewed in LyX if different extensions are present,
   f.ex: file.gif file.eps.
- pass file to latex when file exists with an extension
   like .(e)ps



Herbert

-- 
http://www.lyx.org/help/


Index: src/insets/ChangeLog
===
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/insets/ChangeLog,v
retrieving revision 1.406
diff -u -r1.406 ChangeLog
--- src/insets/ChangeLog26 Apr 2002 15:38:15 -  1.406
+++ src/insets/ChangeLog28 Apr 2002 07:01:30 -
@@ -1,3 +1,8 @@
+2002-04-28  Herbert Voss  [EMAIL PROTECTED]
+
+   * insetgraphics.C (latex): fix bug with missing file-extension.
+   LaTeX still allows a missing eps or ps.
+
 2002-04-26  Angus Leeming  [EMAIL PROTECTED]
 
* insetfloat.C (c-tor, wide): translate the name of the float.
Index: src/insets/insetgraphics.C
===
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/insets/insetgraphics.C,v
retrieving revision 1.106
diff -u -r1.106 insetgraphics.C
--- src/insets/insetgraphics.C  24 Apr 2002 10:53:55 -  1.106
+++ src/insets/insetgraphics.C  28 Apr 2002 07:01:30 -
@@ -703,16 +703,26 @@
// If there is no file specified or not existing,
// just output a message about it in the latex output.
lyxerr[Debug::GRAPHICS]
-InsetGraphics::latex. Filename = 
+insetgraphics::latex: Filename = 
 params().filename  endl;
 
-   string const message =
-   (IsFileReadable(MakeAbsPath(params().filename, buf-filePath()))
-!params().filename.empty()) ?
-   string() :
-   string(bb = 0 0 200 100, draft, type=eps]);
+   // A missing (e)ps-extension is no problem for LaTeX, so
+   // we have to test three different cases
+   string const file_(MakeAbsPath(params().filename, buf-filePath()));
+   bool file_exist = 
+   !file_.empty()  
+   ( IsFileReadable(file_) ||  // original
+ IsFileReadable(file_ + .eps) || // original.eps
+ IsFileReadable(file_ + .ps) );  // original.ps
+   string const message = file_exist ? 
+   string() :
+   string(bb = 0 0 200 100, draft, type=eps]);
+   // if !message.empty() than there was no existing file
+   // filename(.(e)ps) found. In this case LaTeX
+   // draws only a rectangle with the above bb and the
+   // not found filename in it.
lyxerr[Debug::GRAPHICS]
-InsetGraphics::latex. Message =   message  endl;
+InsetGraphics::latex. Message = \  message  '\'  endl;
 
// These variables collect all the latex code that should be before and
// after the actual includegraphics command.



[PATCH] Re: LyX 1.2pre4 Image File Extension

2002-04-28 Thread Herbert Voss

John Levon wrote:

 On Sun, Apr 28, 2002 at 12:31:07AM +0200, Herbert Voss wrote:
 
 
LyX itself needs the real filename, means with extension.
Remeber that 1.2.0 allows a lot of different graphic formats,
which are converted to eps or pdf.

 
 Can you mention this in UPGRADING then please ?


this is a real bug in 1.2.0pre4!

here is a patch, to get the same behaviour as in 1.1.6:


without extension:
- no view in LyX (because we do not know which file should be
   viewed in LyX if different extensions are present,
   f.ex: file.gif file.eps.
- pass file to latex when file exists with an extension
   like .(e)ps



Herbert

-- 
http://www.lyx.org/help/


Index: src/insets/ChangeLog
===
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/insets/ChangeLog,v
retrieving revision 1.406
diff -u -r1.406 ChangeLog
--- src/insets/ChangeLog26 Apr 2002 15:38:15 -  1.406
+++ src/insets/ChangeLog28 Apr 2002 07:01:30 -
@@ -1,3 +1,8 @@
+2002-04-28  Herbert Voss  [EMAIL PROTECTED]
+
+   * insetgraphics.C (latex): fix bug with missing file-extension.
+   LaTeX still allows a missing eps or ps.
+
 2002-04-26  Angus Leeming  [EMAIL PROTECTED]
 
* insetfloat.C (c-tor, wide): translate the name of the float.
Index: src/insets/insetgraphics.C
===
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/insets/insetgraphics.C,v
retrieving revision 1.106
diff -u -r1.106 insetgraphics.C
--- src/insets/insetgraphics.C  24 Apr 2002 10:53:55 -  1.106
+++ src/insets/insetgraphics.C  28 Apr 2002 07:01:30 -
@@ -703,16 +703,26 @@
// If there is no file specified or not existing,
// just output a message about it in the latex output.
lyxerr[Debug::GRAPHICS]
-InsetGraphics::latex. Filename = 
+insetgraphics::latex: Filename = 
 params().filename  endl;
 
-   string const message =
-   (IsFileReadable(MakeAbsPath(params().filename, buf-filePath()))
-!params().filename.empty()) ?
-   string() :
-   string(bb = 0 0 200 100, draft, type=eps]);
+   // A missing (e)ps-extension is no problem for LaTeX, so
+   // we have to test three different cases
+   string const file_(MakeAbsPath(params().filename, buf-filePath()));
+   bool file_exist = 
+   !file_.empty()  
+   ( IsFileReadable(file_) ||  // original
+ IsFileReadable(file_ + .eps) || // original.eps
+ IsFileReadable(file_ + .ps) );  // original.ps
+   string const message = file_exist ? 
+   string() :
+   string(bb = 0 0 200 100, draft, type=eps]);
+   // if !message.empty() than there was no existing file
+   // filename(.(e)ps) found. In this case LaTeX
+   // draws only a rectangle with the above bb and the
+   // not found filename in it.
lyxerr[Debug::GRAPHICS]
-InsetGraphics::latex. Message =   message  endl;
+InsetGraphics::latex. Message = \  message  '\'  endl;
 
// These variables collect all the latex code that should be before and
// after the actual includegraphics command.



[PATCH] Re: LyX 1.2pre4 Image File Extension

2002-04-28 Thread Herbert Voss

John Levon wrote:

> On Sun, Apr 28, 2002 at 12:31:07AM +0200, Herbert Voss wrote:
> 
> 
>>LyX itself needs the "real" filename, means with extension.
>>Remeber that 1.2.0 allows a lot of different graphic formats,
>>which are converted to eps or pdf.
>>
> 
> Can you mention this in UPGRADING then please ?


this is a real "bug" in 1.2.0pre4!

here is a patch, to get the same behaviour as in 1.1.6:


without extension:
- no view in LyX (because we do not know which file should be
   viewed in LyX if different extensions are present,
   f.ex: file.gif file.eps.
- pass file to latex when file exists with an extension
   like .(e)ps



Herbert

-- 
http://www.lyx.org/help/


Index: src/insets/ChangeLog
===
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/insets/ChangeLog,v
retrieving revision 1.406
diff -u -r1.406 ChangeLog
--- src/insets/ChangeLog26 Apr 2002 15:38:15 -  1.406
+++ src/insets/ChangeLog28 Apr 2002 07:01:30 -
@@ -1,3 +1,8 @@
+2002-04-28  Herbert Voss  <[EMAIL PROTECTED]>
+
+   * insetgraphics.C (latex): fix bug with missing file-extension.
+   LaTeX still allows a missing "eps" or "ps".
+
 2002-04-26  Angus Leeming  <[EMAIL PROTECTED]>
 
* insetfloat.C (c-tor, wide): translate the name of the float.
Index: src/insets/insetgraphics.C
===
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/insets/insetgraphics.C,v
retrieving revision 1.106
diff -u -r1.106 insetgraphics.C
--- src/insets/insetgraphics.C  24 Apr 2002 10:53:55 -  1.106
+++ src/insets/insetgraphics.C  28 Apr 2002 07:01:30 -
@@ -703,16 +703,26 @@
// If there is no file specified or not existing,
// just output a message about it in the latex output.
lyxerr[Debug::GRAPHICS]
-   << "InsetGraphics::latex. Filename = "
+   << "insetgraphics::latex: Filename = "
<< params().filename << endl;
 
-   string const message =
-   (IsFileReadable(MakeAbsPath(params().filename, buf->filePath()))
-   && !params().filename.empty()) ?
-   string() :
-   string("bb = 0 0 200 100, draft, type=eps]");
+   // A missing (e)ps-extension is no problem for LaTeX, so
+   // we have to test three different cases
+   string const file_(MakeAbsPath(params().filename, buf->filePath()));
+   bool file_exist = 
+   !file_.empty() && 
+   ( IsFileReadable(file_) ||  // original
+ IsFileReadable(file_ + ".eps") || // original.eps
+ IsFileReadable(file_ + ".ps") );  // original.ps
+   string const message = file_exist ? 
+   string() :
+   string("bb = 0 0 200 100, draft, type=eps]");
+   // if !message.empty() than there was no existing file
+   // "filename(.(e)ps)" found. In this case LaTeX
+   // draws only a rectangle with the above bb and the
+   // not found filename in it.
lyxerr[Debug::GRAPHICS]
-   << "InsetGraphics::latex. Message = " << message << endl;
+   << "InsetGraphics::latex. Message = \"" << message << '\"' << endl;
 
// These variables collect all the latex code that should be before and
// after the actual includegraphics command.



LyX 1.2pre4 Image File Extension

2002-04-27 Thread David Green

I am a LyX novice but in 1.1.6 versions, it appeared that a practice
was to specify graphic files without mentioning suffix so that if
one preconverted their files to the various formats that the
underlying tools needed, every thing would use it's preferred
extension.

In 1.2pre4 just compiled, it appears that image specifications that
are without the suffix (say .eps) don't get discovered by LyX for
rendering.  In other words, specifying the image IMG expecting LyX
to pick up IMG.eps and latex2html to pickup IMG.jpg .  Is this
something that is no longer best (or even allowed) practice and
eliminated or ???  I am not fighting for the feature by the way, just
reporting a difference and asking intent.  I can see both sides of the
choice.

I do see hints in NEWS that perhaps less of this practice is necessary
due to additional image support in LyX. If this is by design you
might wish to mention it in the UPGRADING file.

Dave
-- 
David G. Green  [EMAIL PROTECTED]
UAB Electrical and Computer Engineering Birmingham, AL USA



Re: LyX 1.2pre4 Image File Extension

2002-04-27 Thread Herbert Voss

David Green wrote:

 I am a LyX novice but in 1.1.6 versions, it appeared that a practice
 was to specify graphic files without mentioning suffix so that if
 one preconverted their files to the various formats that the
 underlying tools needed, every thing would use it's preferred
 extension.
 
 In 1.2pre4 just compiled, it appears that image specifications that
 are without the suffix (say .eps) don't get discovered by LyX for
 rendering.  In other words, specifying the image IMG expecting LyX
 to pick up IMG.eps and latex2html to pickup IMG.jpg .  Is this
 something that is no longer best (or even allowed) practice and
 eliminated or ???  I am not fighting for the feature by the way, just
 reporting a difference and asking intent.  I can see both sides of the
 choice.


LyX itself needs the real filename, means with extension.
Remeber that 1.2.0 allows a lot of different graphic formats,
which are converted to eps or pdf.

But LyX exports this filename without extension, so that

pdflatex for example works well.

Herbert



-- 
http://www.lyx.org/help/




Re: LyX 1.2pre4 Image File Extension

2002-04-27 Thread John Levon

On Sun, Apr 28, 2002 at 12:31:07AM +0200, Herbert Voss wrote:

 LyX itself needs the real filename, means with extension.
 Remeber that 1.2.0 allows a lot of different graphic formats,
 which are converted to eps or pdf.

Can you mention this in UPGRADING then please ?

john

-- 
Taste is predicated on discrimination.



LyX 1.2pre4 Image File Extension

2002-04-27 Thread David Green

I am a LyX novice but in 1.1.6 versions, it appeared that a practice
was to specify graphic files without mentioning suffix so that if
one preconverted their files to the various formats that the
underlying tools needed, every thing would use it's preferred
extension.

In 1.2pre4 just compiled, it appears that image specifications that
are without the suffix (say .eps) don't get discovered by LyX for
rendering.  In other words, specifying the image IMG expecting LyX
to pick up IMG.eps and latex2html to pickup IMG.jpg .  Is this
something that is no longer best (or even allowed) practice and
eliminated or ???  I am not fighting for the feature by the way, just
reporting a difference and asking intent.  I can see both sides of the
choice.

I do see hints in NEWS that perhaps less of this practice is necessary
due to additional image support in LyX. If this is by design you
might wish to mention it in the UPGRADING file.

Dave
-- 
David G. Green  [EMAIL PROTECTED]
UAB Electrical and Computer Engineering Birmingham, AL USA



Re: LyX 1.2pre4 Image File Extension

2002-04-27 Thread Herbert Voss

David Green wrote:

 I am a LyX novice but in 1.1.6 versions, it appeared that a practice
 was to specify graphic files without mentioning suffix so that if
 one preconverted their files to the various formats that the
 underlying tools needed, every thing would use it's preferred
 extension.
 
 In 1.2pre4 just compiled, it appears that image specifications that
 are without the suffix (say .eps) don't get discovered by LyX for
 rendering.  In other words, specifying the image IMG expecting LyX
 to pick up IMG.eps and latex2html to pickup IMG.jpg .  Is this
 something that is no longer best (or even allowed) practice and
 eliminated or ???  I am not fighting for the feature by the way, just
 reporting a difference and asking intent.  I can see both sides of the
 choice.


LyX itself needs the real filename, means with extension.
Remeber that 1.2.0 allows a lot of different graphic formats,
which are converted to eps or pdf.

But LyX exports this filename without extension, so that

pdflatex for example works well.

Herbert



-- 
http://www.lyx.org/help/




Re: LyX 1.2pre4 Image File Extension

2002-04-27 Thread John Levon

On Sun, Apr 28, 2002 at 12:31:07AM +0200, Herbert Voss wrote:

 LyX itself needs the real filename, means with extension.
 Remeber that 1.2.0 allows a lot of different graphic formats,
 which are converted to eps or pdf.

Can you mention this in UPGRADING then please ?

john

-- 
Taste is predicated on discrimination.



LyX 1.2pre4 Image File Extension

2002-04-27 Thread David Green

I am a LyX novice but in 1.1.6 versions, it appeared that a practice
was to specify graphic files without mentioning suffix so that if
one preconverted their files to the various formats that the
underlying tools needed, every thing would use it's preferred
extension.

In 1.2pre4 just compiled, it appears that image specifications that
are without the suffix (say .eps) don't get discovered by LyX for
rendering.  In other words, specifying the image "IMG" expecting LyX
to pick up IMG.eps and latex2html to pickup IMG.jpg .  Is this
something that is no longer best (or even allowed) practice and
eliminated or ???  I am not fighting for the feature by the way, just
reporting a difference and asking intent.  I can see both sides of the
choice.

I do see hints in NEWS that perhaps less of this practice is necessary
due to additional image support in LyX. If this is "by design" you
might wish to mention it in the UPGRADING file.

Dave
-- 
David G. Green  [EMAIL PROTECTED]
UAB Electrical and Computer Engineering Birmingham, AL USA



Re: LyX 1.2pre4 Image File Extension

2002-04-27 Thread Herbert Voss

David Green wrote:

> I am a LyX novice but in 1.1.6 versions, it appeared that a practice
> was to specify graphic files without mentioning suffix so that if
> one preconverted their files to the various formats that the
> underlying tools needed, every thing would use it's preferred
> extension.
> 
> In 1.2pre4 just compiled, it appears that image specifications that
> are without the suffix (say .eps) don't get discovered by LyX for
> rendering.  In other words, specifying the image "IMG" expecting LyX
> to pick up IMG.eps and latex2html to pickup IMG.jpg .  Is this
> something that is no longer best (or even allowed) practice and
> eliminated or ???  I am not fighting for the feature by the way, just
> reporting a difference and asking intent.  I can see both sides of the
> choice.


LyX itself needs the "real" filename, means with extension.
Remeber that 1.2.0 allows a lot of different graphic formats,
which are converted to eps or pdf.

But LyX exports this filename without extension, so that

pdflatex for example works well.

Herbert



-- 
http://www.lyx.org/help/




Re: LyX 1.2pre4 Image File Extension

2002-04-27 Thread John Levon

On Sun, Apr 28, 2002 at 12:31:07AM +0200, Herbert Voss wrote:

> LyX itself needs the "real" filename, means with extension.
> Remeber that 1.2.0 allows a lot of different graphic formats,
> which are converted to eps or pdf.

Can you mention this in UPGRADING then please ?

john

-- 
"Taste is predicated on discrimination."