Re: [PATCH] Re: Graphics: "Get boundingbox from file" for non-eps ?

2002-04-11 Thread John Levon

On Thu, Apr 11, 2002 at 07:07:48PM +0100, Angus Leeming wrote:

> > Received unhandled X11 event
> > Type: 0xd Target: 0x35f
> 
> I know little or nothing about such X11 messages. John Levon is the guru!

*cough*

Anyway, it's just the remnants of the BadWindow xforms bug, it looks
like.

It can be ignored. We shouldn't quieten it though, it is there to remind
us that this is an error condition

regards
john

-- 
"I never understood what's so hard about picking a unique
 first and last name - and not going beyond the 6 character limit."
- Toon Moene



Re: [PATCH] Re: Graphics: "Get boundingbox from file" for non-eps ?

2002-04-11 Thread Angus Leeming

On Thursday 11 April 2002 8:08 pm, Herbert Voss wrote:
> Angus Leeming wrote:
> > I'm looking at it at this instant. I'll address my issues and commit it
> > in the next 20 mins or so.
>
> ok
>
> Angus, I forgot to ask for the sense of this message:
>
> Received unhandled X11 event
> Type: 0xd Target: 0x35f
>
> happens, when applying a graphic from the gui.
>
> Herbert

I know little or nothing about such X11 messages. John Levon is the guru!

Angus



Re: [PATCH] Re: Graphics: "Get boundingbox from file" for non-eps ?

2002-04-11 Thread Herbert Voss

Angus Leeming wrote:

> 
> I'm looking at it at this instant. I'll address my issues and commit it in 
> the next 20 mins or so.


ok

Angus, I forgot to ask for the sense of this message:

Received unhandled X11 event
Type: 0xd Target: 0x35f

happens, when applying a graphic from the gui.

Herbert



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




Re: [PATCH] Re: Graphics: "Get boundingbox from file" for non-eps ?

2002-04-11 Thread Angus Leeming

On Thursday 11 April 2002 7:54 pm, Herbert Voss wrote:
> Angus Leeming wrote:
> > I've done so. Needless to say I tweaked it a little. I decided that the
> > graphics dialog could access the graphics cache direct and not go through
> > the inset.
>
> ok, good idea.
>
>
> Angus, what is with the former graphics patch?
>
> Herbert

I'm looking at it at this instant. I'll address my issues and commit it in 
the next 20 mins or so.

A



Re: [PATCH] Re: Graphics: "Get boundingbox from file" for non-eps ?

2002-04-11 Thread Herbert Voss

Angus Leeming wrote:

> I've done so. Needless to say I tweaked it a little. I decided that the 
> graphics dialog could access the graphics cache direct and not go through the 
> inset.


ok, good idea.


Angus, what is with the former graphics patch?

Herbert

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




Re: [PATCH] Re: Graphics: "Get boundingbox from file" for non-eps ?

2002-04-11 Thread Angus Leeming

On Thursday 11 April 2002 4:19 pm, Herbert Voss wrote:
> Angus Leeming wrote:
> > Or call them raw_dimensions and return a pair. Your call.
>
> please apply.
>
> Herbert

I've done so. Needless to say I tweaked it a little. I decided that the 
graphics dialog could access the graphics cache direct and not go through the 
inset.

Regards,
Angus



[PATCH] Re: Graphics: "Get boundingbox from file" for non-eps ?

2002-04-11 Thread Herbert Voss

Angus Leeming wrote:


> 
> Or call them raw_dimensions and return a pair. Your call.


please apply.

Herbert


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


Index: src/frontends/controllers/ChangeLog
===
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/frontends/controllers/ChangeLog,v
retrieving revision 1.157
diff -u -r1.157 ChangeLog
--- src/frontends/controllers/ChangeLog 9 Apr 2002 10:02:10 -   1.157
+++ src/frontends/controllers/ChangeLog 11 Apr 2002 14:05:53 -
@@ -1,3 +1,7 @@
+2002-04-11  Herbert Voss  <[EMAIL PROTECTED]>
+
+   * ControlGraphics.C: read BoundingBox also from non (e)ps files.
+
 2002-04-08  Adrien Rebollo  <[EMAIL PROTECTED]>
 
* ControlAboutlyx.C (getVersion): two _() forgotten
Index: src/frontends/controllers/ControlGraphics.C
===
RCS file: 
/usr/local/lyx/cvsroot/lyx-devel/src/frontends/controllers/ControlGraphics.C,v
retrieving revision 1.31
diff -u -r1.31 ControlGraphics.C
--- src/frontends/controllers/ControlGraphics.C 8 Apr 2002 16:47:50 -   1.31
+++ src/frontends/controllers/ControlGraphics.C 11 Apr 2002 14:05:53 -
@@ -36,12 +38,14 @@
 #include "support/FileInfo.h"  // for FileInfo
 #include "helper_funcs.h"
 #include "support/lstrings.h"
-#include "support/filetools.h" // for AddName, zippedFile
+#include "support/filetools.h"
+#include "support/path.h"
 
 using std::pair;
 using std::make_pair;
 using std::ifstream;
-
+using std::endl;
+ 
 ControlGraphics::ControlGraphics(LyXView & lv, Dialogs & d)
: ControlInset(lv, d)
 {
@@ -104,7 +108,17 @@
 
 string const ControlGraphics::readBB(string const & file)
 {
-   return readBB_from_PSFile(MakeAbsPath(file, lv_.buffer()->filePath()));
+   string const from = getExtFromContents(file);   
+   // check if we have a postscriptfile, than it's easy
+   if (contains(from, "ps"))
+   return readBB_from_PSFile(file);
+   
+   // we don't, so let's ask the inset.
+   // first make the right path
+   Path p(lv_.buffer()->filePath());
+   return ("0 0 " + 
+   tostr(inset()->raw_image_width()) + ' ' + 
+   tostr(inset()->raw_image_height()));
 }
 
 
 }
Index: src/graphics/ChangeLog
===
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/graphics/ChangeLog,v
retrieving revision 1.48
diff -u -r1.48 ChangeLog
--- src/graphics/ChangeLog  8 Apr 2002 16:51:46 -   1.48
+++ src/graphics/ChangeLog  11 Apr 2002 14:05:55 -
@@ -1,3 +1,9 @@
+2002-04-10  Herbert Voss  <[EMAIL PROTECTED]>
+
+   * GraphicsCache.[Ch]:
+   * GraphicsCacheItem.[Ch]: add width/height functions from Angus
+   to read "BB" from non (e)ps files.
+
 2002-04-08  Angus Leeming  <[EMAIL PROTECTED]>
 
* GraphicsParams.C (c-tor): if clipping, then check the Bounding Box of
Index: src/graphics/GraphicsCache.C
===
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/graphics/GraphicsCache.C,v
retrieving revision 1.22
diff -u -r1.22 GraphicsCache.C
--- src/graphics/GraphicsCache.C22 Mar 2002 16:37:51 -  1.22
+++ src/graphics/GraphicsCache.C11 Apr 2002 14:05:55 -
@@ -165,4 +165,25 @@
return cache->end();
 }
 
+
+unsigned int GCache::raw_width(string const & filename) const
+{
+   CacheType::const_iterator it = cache->find(filename);
+   if (it == cache->end())
+   return 0;
+
+   return it->second->raw_width();
+}
+
+
+unsigned int GCache::raw_height(string const & filename) const
+{
+   CacheType::const_iterator it = cache->find(filename);
+   if (it == cache->end())
+   return 0;
+
+   return it->second->raw_height();
+}
+
 } // namespace grfx
+
Index: src/graphics/GraphicsCache.h
===
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/graphics/GraphicsCache.h,v
retrieving revision 1.16
diff -u -r1.16 GraphicsCache.h
--- src/graphics/GraphicsCache.h22 Mar 2002 16:37:51 -  1.16
+++ src/graphics/GraphicsCache.h11 Apr 2002 14:05:55 -
@@ -67,6 +67,10 @@
/// How far have we got in loading the image?
ImageStatus status(InsetGraphics const &) const;
 
+   // for getting the "bb" of non (e)ps files
+   unsigned int raw_width(string const & filename) const;
+   unsigned int raw_height(string const & filename) const;
+   
 private:
/** Make the c-tor private so we can control how many objects
 *  are instantiated.
Index: src/graphics/GraphicsCacheItem.C
===
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/graphics/GraphicsCacheItem.C,v
retrieving revision 1.30
diff -u -r1.30 GraphicsCacheItem.C
--- src/graphics/GraphicsCacheItem.C26 Mar 

Re: [PATCH] Re: Graphics: "Get boundingbox from file" for non-eps ?

2002-04-11 Thread Jean-Marc Lasgouttes

> "Herbert" == Herbert Voss <[EMAIL PROTECTED]> writes:

Herbert> R. Lahaye wrote:
>> Talking about conversions again: do you know why we have two Grace
>> formats listed in Preferences->Conversion->Formats? There is an
>> entry for "GRACE" and for "agr". What is the difference between the
>> two? Moreover, only "agr" is used in the "Converters".


Herbert> please apply

Will do it.

JMarc



[PATCH] Re: Graphics: "Get boundingbox from file" for non-eps ?

2002-04-10 Thread Herbert Voss

R. Lahaye wrote:

> Talking about conversions again: do you know why we have two Grace
> formats listed in Preferences->Conversion->Formats?
> There is an entry for "GRACE" and for "agr". What is the difference
> between the two? Moreover, only "agr" is used in the "Converters".


please apply

HErbert



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


Index: lib/ChangeLog
===
RCS file: /usr/local/lyx/cvsroot/lyx-devel/lib/ChangeLog,v
retrieving revision 1.204
diff -u -r1.204 ChangeLog
--- lib/ChangeLog   10 Apr 2002 14:07:10 -  1.204
+++ lib/ChangeLog   10 Apr 2002 15:13:51 -
@@ -1,5 +1,9 @@
 2002-04-10 Herbert Voss <[EMAIL PROTECTED]>
 
+   * configure.m4: correct entry for grace graphic format
+
+2002-04-10 Herbert Voss <[EMAIL PROTECTED]>
+
* CREDITS: correct email
   
 2002-04-05  Adrien Rebollo  <[EMAIL PROTECTED]>
Index: lib/configure.m4
===
RCS file: /usr/local/lyx/cvsroot/lyx-devel/lib/configure.m4,v
retrieving revision 1.36
diff -u -r1.36 configure.m4
--- lib/configure.m47 Apr 2002 15:34:34 -   1.36
+++ lib/configure.m410 Apr 2002 15:13:51 -
@@ -460,7 +460,7 @@
 \\Format fax ""Fax ""
 \\Format fits fits FITS""
 \\Format gif  gif  GIF ""
-\\Format graceagr  GRACE   ""
+\\Format agr  agr  GRACE   ""
 \\Format htmlhtml  HTMLH
 \\Format jpg  jpg  JPEG""
 \\Format latex   tex   LaTeX   L