comp.lang.ada
 help / color / mirror / Atom feed
* GtkAda.Image
@ 2021-09-01  8:42 AdaMagica
  2021-09-01  9:02 ` GtkAda.Image Dmitry A. Kazakov
  0 siblings, 1 reply; 8+ messages in thread
From: AdaMagica @ 2021-09-01  8:42 UTC (permalink / raw)


Calling Gtk.Image.Gtk_New (Lady, "Ada_9X.bmp"); with a nonexisting file does not report any problem. It just creates a tiny placeholder.
Is there a way to get a warning in this case? The GtkAda_RM is silent on this.

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: GtkAda.Image
  2021-09-01  8:42 GtkAda.Image AdaMagica
@ 2021-09-01  9:02 ` Dmitry A. Kazakov
  2021-09-02 18:16   ` GtkAda.Image AdaMagica
  0 siblings, 1 reply; 8+ messages in thread
From: Dmitry A. Kazakov @ 2021-09-01  9:02 UTC (permalink / raw)


On 2021-09-01 10:42, AdaMagica wrote:
> Calling Gtk.Image.Gtk_New (Lady, "Ada_9X.bmp"); with a nonexisting file does not report any problem. It just creates a tiny placeholder.
> Is there a way to get a warning in this case? The GtkAda_RM is silent on this.

"...If the file isn't found or can't be loaded, the resulting 
Gtk.Image.Gtk_Image will display a "broken image" icon. This function 
never returns null, it always returns a valid Gtk.Image.Gtk_Image widget..."

Embed Ada_9X.bmp into your GtkAda program. It will always be there, no 
need to care about shipping the image file with your program.

-- 
Regards,
Dmitry A. Kazakov
http://www.dmitry-kazakov.de

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: GtkAda.Image
  2021-09-01  9:02 ` GtkAda.Image Dmitry A. Kazakov
@ 2021-09-02 18:16   ` AdaMagica
  2021-09-02 20:10     ` GtkAda.Image Dmitry A. Kazakov
  0 siblings, 1 reply; 8+ messages in thread
From: AdaMagica @ 2021-09-02 18:16 UTC (permalink / raw)


> Embed Ada_9X.bmp into your GtkAda program. It will always be there, no 
> need to care about shipping the image file with your program.

Tnanks, Dmitry, I thought about this but do not know how to do this.
Christoph

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: GtkAda.Image
  2021-09-02 18:16   ` GtkAda.Image AdaMagica
@ 2021-09-02 20:10     ` Dmitry A. Kazakov
  2021-09-03  7:32       ` GtkAda.Image AdaMagica
  0 siblings, 1 reply; 8+ messages in thread
From: Dmitry A. Kazakov @ 2021-09-02 20:10 UTC (permalink / raw)


On 2021-09-02 20:16, AdaMagica wrote:
>> Embed Ada_9X.bmp into your GtkAda program. It will always be there, no
>> need to care about shipping the image file with your program.
> 
> Tnanks, Dmitry, I thought about this but do not know how to do this.

I have a small Ada utility program converting an XPM image to Ada 
packages. E.g. open BMP in GIMP and export it as XPM.

    http://www.dmitry-kazakov.de/ada/gtkada_contributions.htm#3

-- 
Regards,
Dmitry A. Kazakov
http://www.dmitry-kazakov.de

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: GtkAda.Image
  2021-09-02 20:10     ` GtkAda.Image Dmitry A. Kazakov
@ 2021-09-03  7:32       ` AdaMagica
  2021-09-09 15:31         ` GtkAda.Image AdaMagica
  0 siblings, 1 reply; 8+ messages in thread
From: AdaMagica @ 2021-09-03  7:32 UTC (permalink / raw)


Dmitry A. Kazakov schrieb am Donnerstag, 2. September 2021 um 22:10:13 UTC+2:
> I have a small Ada utility program converting an XPM image to Ada
> packages. E.g. open BMP in GIMP and export it as XPM.

Thanks, I'll try it
Christoph

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: GtkAda.Image
  2021-09-03  7:32       ` GtkAda.Image AdaMagica
@ 2021-09-09 15:31         ` AdaMagica
  2021-09-09 16:03           ` GtkAda.Image Dmitry A. Kazakov
  0 siblings, 1 reply; 8+ messages in thread
From: AdaMagica @ 2021-09-09 15:31 UTC (permalink / raw)


AdaMagica schrieb am Freitag, 3. September 2021 um 09:32:24 UTC+2:
> Dmitry A. Kazakov schrieb am Donnerstag, 2. September 2021 um 22:10:13 UTC+2: 
> > I have a small Ada utility program converting an XPM image to Ada 
> > packages. E.g. open BMP in GIMP and export it as XPM.
> Thanks, I'll try it 
> Christoph
Dmitry,
I've produced the files Ada_9X_xpm-image.ads/adb .
Problem is: Ada_9X_xpm.adb starts thus:

with Gdk.Pixbuf.Conversions;  <-- GNAT complains: file not found
package body Ada_9X_xpm is

Have I overlooked something in your documentation?
Christoph

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: GtkAda.Image
  2021-09-09 15:31         ` GtkAda.Image AdaMagica
@ 2021-09-09 16:03           ` Dmitry A. Kazakov
  2021-09-11 13:35             ` GtkAda.Image AdaMagica
  0 siblings, 1 reply; 8+ messages in thread
From: Dmitry A. Kazakov @ 2021-09-09 16:03 UTC (permalink / raw)


On 2021-09-09 17:31, AdaMagica wrote:
> AdaMagica schrieb am Freitag, 3. September 2021 um 09:32:24 UTC+2:
>> Dmitry A. Kazakov schrieb am Donnerstag, 2. September 2021 um 22:10:13 UTC+2:
>>> I have a small Ada utility program converting an XPM image to Ada
>>> packages. E.g. open BMP in GIMP and export it as XPM.
>> Thanks, I'll try it
>> Christoph
> Dmitry,
> I've produced the files Ada_9X_xpm-image.ads/adb .
> Problem is: Ada_9X_xpm.adb starts thus:
> 
> with Gdk.Pixbuf.Conversions;  <-- GNAT complains: file not found
> package body Ada_9X_xpm is
> 
> Have I overlooked something in your documentation?

It is a helper package from the GtkAda contributions:

----------------------------------
-- GtkAda  2.14.2  introduced  a  backward  incompatibility  by   making
-- Gdk_Pixbuf a tagged type rather than plain pointer.  This package  is
-- provided for backward compatibility of the GtkAda Contributions.
--
-- !!WARNING!! Use only with GtkAda >= 2.14.2
--
with Gdk.Pixbuf;   use Gdk.Pixbuf;
with GLib.Object;  use GLib.Object;
with System;       use System;

with Glib.Properties;
with Gtk.Cell_Renderer_Pixbuf;

package Gdk.Pixbuf.Conversions is
--
-- From_Address -- Ada object creation
--
--    Object - Obtained from a GDK call
--
-- Returns :
--
--    The Ada object
--
    function From_Address (Object : Address) return Gdk_Pixbuf
       renames Convert;
--
-- To_Address -- Getting C object address
--
--    Object - An Ada object
--
-- Returns :
--
--    The C object's address
--
    function To_Address
             (  Object : access GObject_Record'Class
             )  return Address renames GLib.Object.Get_Object;
--
-- Set_Pixbuf_Property -- Set pixbuf property
--
    procedure Set_Pixbuf_Property
              (  Object : access GObject_Record'Class;
                 Name   : Glib.Properties.Property_Object :=
                             Gtk.Cell_Renderer_Pixbuf.Pixbuf_Property;
                 Value  : access GObject_Record'Class
              )  renames Glib.Properties.Set_Property;

    subtype To_Value is Gdk_Pixbuf;

end Gdk.Pixbuf.Conversions;
----------------------------------

-- 
Regards,
Dmitry A. Kazakov
http://www.dmitry-kazakov.de

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: GtkAda.Image
  2021-09-09 16:03           ` GtkAda.Image Dmitry A. Kazakov
@ 2021-09-11 13:35             ` AdaMagica
  0 siblings, 0 replies; 8+ messages in thread
From: AdaMagica @ 2021-09-11 13:35 UTC (permalink / raw)


Dmitry A. Kazakov schrieb am Donnerstag, 9. September 2021 um 18:03:11 UTC+2:
> It is a helper package from the GtkAda contributions: 

I replaced the call of your Gdk.Pixbuf.Conversions.From_Address in the generated file by
the original Gdk.Pixbuf.Convert.

The embedding works fine. Thanks again.
Christoph

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2021-09-11 13:35 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-09-01  8:42 GtkAda.Image AdaMagica
2021-09-01  9:02 ` GtkAda.Image Dmitry A. Kazakov
2021-09-02 18:16   ` GtkAda.Image AdaMagica
2021-09-02 20:10     ` GtkAda.Image Dmitry A. Kazakov
2021-09-03  7:32       ` GtkAda.Image AdaMagica
2021-09-09 15:31         ` GtkAda.Image AdaMagica
2021-09-09 16:03           ` GtkAda.Image Dmitry A. Kazakov
2021-09-11 13:35             ` GtkAda.Image AdaMagica

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox