This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug ada/11541] New: Ada: gnat bug detected when compiling GtkAda-1.2.12


PLEASE REPLY TO gcc-bugzilla@gcc.gnu.org ONLY, *NOT* gcc-bugs@gcc.gnu.org.

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=11541

           Summary: Ada: gnat bug detected when compiling GtkAda-1.2.12
           Product: gcc
           Version: 3.3
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: ada
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: andreas at almroth dot com
                CC: gcc-bugs at gcc dot gnu dot org
 GCC build triplet: sparc-sun-solaris2.8
  GCC host triplet: sparc-sun-solaris2.8
GCC target triplet: sparc-sun-solaris2.8

Command line: gcc -c -I../ -O2 -gnatn -gnatwuwl -fPIC -I- ../gtk-extra-plot_data.adb

+===========================GNAT BUG DETECTED==============================+
| 3.3 (sparc-sun-solaris2.8) GCC error:                                    |
| in assign_stack_temp_for_type, at function.c:649                         |
| Error detected at
/opt/csw/gcc3/lib/gcc-lib/sparc-sun-solaris2.8/3.3/adainclude/s-secsta.ads:65:14|
| Please submit a bug report; see http://gcc.gnu.org/bugs.html.            |
| Include the entire contents of this bug box in the report.               |
| Include the exact gcc or gnatmake command that you entered.              |
| Also include sources listed below in gnatchop format                     |
| concatenated together with no headers between files.                     |
+==========================================================================+

Sources:
gtexplda.adb
gtexplda.ads

-----------------------------------------------------------------------
--          GtkAda - Ada95 binding for the Gimp Toolkit              --
--                                                                   --
--                     Copyright (C) 2000                            --
--        Emmanuel Briot, Joel Brobecker and Arnaud Charlet          --
--                                                                   --
-- This library is free software; you can redistribute it and/or     --
-- modify it under the terms of the GNU General Public               --
-- License as published by the Free Software Foundation; either      --
-- version 2 of the License, or (at your option) any later version.  --
--                                                                   --
-- This library is distributed in the hope that it will be useful,   --
-- but WITHOUT ANY WARRANTY; without even the implied warranty of    --
-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU --
-- General Public License for more details.                          --
--                                                                   --
-- You should have received a copy of the GNU General Public         --
-- License along with this library; if not, write to the             --
-- Free Software Foundation, Inc., 59 Temple Place - Suite 330,      --
-- Boston, MA 02111-1307, USA.                                       --
--                                                                   --
-- As a special exception, if other files instantiate generics from  --
-- this unit, or you link this unit with other files to produce an   --
-- executable, this  unit  does not  by itself cause  the resulting  --
-- executable to be covered by the GNU General Public License. This  --
-- exception does not however invalidate any other reasons why the   --
-- executable file  might be covered by the  GNU Public License.     --
-----------------------------------------------------------------------

with Glib;         use Glib;
with Gtk.Widget;   use Gtk.Widget;
with Gtkada.Types; use Gtkada.Types;
with Gdk.Color;    use Gdk.Color;
with Interfaces.C; use Interfaces.C;

package body Gtk.Extra.Plot_Data is

   -------------
   -- Gtk_New --
   -------------

   procedure Gtk_New
     (Data : out Gtk_Plot_Data; Func : Plot_Function := null) is
   begin
      Data := new Gtk_Plot_Data_Record;
      Initialize (Data, Func);
   end Gtk_New;

   ----------------
   -- Initialize --
   ----------------

   procedure Initialize
     (Data : access Gtk_Plot_Data_Record'Class; Func : Plot_Function := null)
   is
      function Internal return System.Address;
      pragma Import (C, Internal, "gtk_plot_data_new");

      function Internal2 (Func : Plot_Function) return System.Address;
      pragma Import (C, Internal2, "gtk_plot_data_new_function");
   begin
      if Func = null then
         Set_Object (Data, Internal);
      else
         Set_Object (Data, Internal2 (Func));
      end if;
      Initialize_User_Data (Data);
   end Initialize;

   --------------
   -- Set_Name --
   --------------

   procedure Set_Name (Data : access Gtk_Plot_Data_Record; Name : String) is
      procedure Internal (Data : System.Address; Name : in String);
      pragma Import (C, Internal, "gtk_plot_data_set_name");
   begin
      Internal (Get_Object (Data), Name & ASCII.NUL);
   end Set_Name;

   -----------
   -- Paint --
   -----------

   procedure Paint (Data : access Gtk_Plot_Data_Record) is
      procedure Internal (Data : System.Address);
      pragma Import (C, Internal, "gtk_plot_data_paint");
   begin
      Internal (Get_Object (Data));
   end Paint;

   -----------------
   -- Draw_Points --
   -----------------

   procedure Draw_Points (Data : access Gtk_Plot_Data_Record; N : Gint) is
      procedure Internal (Data : System.Address; N : Gint);
      pragma Import (C, Internal, "gtk_plot_data_draw_points");
   begin
      Internal (Get_Object (Data), N);
   end Draw_Points;

   -----------------
   -- Draw_Symbol --
   -----------------

   procedure Draw_Symbol
     (Data : access Gtk_Plot_Data_Record; X, Y : Gdouble)
   is
      procedure Internal (Data : System.Address; X, Y : Gdouble);
      pragma Import (C, Internal, "gtk_plot_data_draw_symbol");
   begin
      Internal (Get_Object (Data), X, Y);
   end Draw_Symbol;

   ----------------
   -- Set_Points --
   ----------------

   procedure Set_Points
     (Data : access Gtk_Plot_Data_Record;
      X    : Gdouble_Array_Access;
      Y    : Gdouble_Array_Access;
      Dx   : Gdouble_Array_Access;
      Dy   : Gdouble_Array_Access)
   is
      procedure Internal (Data       : in System.Address;
                          X          : in System.Address;
                          Y          : in System.Address;
                          Dx         : in System.Address;
                          Dy         : in System.Address;
                          Num_Points : in Gint);
      pragma Import (C, Internal, "gtk_plot_data_set_points");
      Xa, Ya, Dxa, Dya : System.Address := System.Null_Address;
   begin
      if X /= null then
         Xa := X (X'First)'Address;
      end if;

      if Y /= null then
         Ya := Y (Y'First)'Address;
      end if;

      if Dx /= null then
         Dxa := Dx (Dx'First)'Address;
      end if;

      if Dy /= null then
         Dya := Dy (Dy'First)'Address;
      end if;

      Internal (Get_Object (Data), Xa, Ya, Dxa, Dya, X'Length);
   end Set_Points;

   ----------------
   -- Get_Points --
   ----------------

   procedure Get_Points
     (Data : access Gtk_Plot_Data_Record;
      X    : out Points_Array;
      Y    : out Points_Array;
      Dx   : out Points_Array;
      Dy   : out Points_Array)
   is
      procedure Internal (Data       : in System.Address;
                          X          : out System.Address;
                          Y          : out System.Address;
                          Dx         : out System.Address;
                          Dy         : out System.Address;
                          Num_Points : out Gint);
      pragma Import (C, Internal, "gtk_plot_data_get_points");
      Num_Points : Gint;
      X1, Y1, Dx1, Dy1 : System.Address;
   begin
      Internal (Get_Object (Data), X1, Y1, Dx1, Dy1, Num_Points);
      X  := (Points => To_Double_Array (X1),  Num_Points => Num_Points);
      Y  := (Points => To_Double_Array (Y1),  Num_Points => Num_Points);
      Dx := (Points => To_Double_Array (Dx1), Num_Points => Num_Points);
      Dy := (Points => To_Double_Array (Dy1), Num_Points => Num_Points);
   end Get_Points;

   -----------
   -- Set_X --
   -----------

   procedure Set_X
     (Data : access Gtk_Plot_Data_Record; X : Gdouble_Array_Access)
   is
      procedure Internal (Data : System.Address; X : System.Address);
      pragma Import (C, Internal, "gtk_plot_data_set_x");
   begin
      pragma Assert (Get_Numpoints (Data) = X'Length);
      Internal (Get_Object (Data), X (X'First)'Address);
   end Set_X;

   -----------
   -- Set_Y --
   -----------

   procedure Set_Y
     (Data : access Gtk_Plot_Data_Record; Y : Gdouble_Array_Access)
   is
      procedure Internal (Data : System.Address; Y : System.Address);
      pragma Import (C, Internal, "gtk_plot_data_set_y");
   begin
      pragma Assert (Get_Numpoints (Data) = Y'Length);
      Internal (Get_Object (Data), Y (Y'First)'Address);
   end Set_Y;

   -----------
   -- Set_Z --
   -----------

   procedure Set_Z
     (Data : access Gtk_Plot_Data_Record; Z : Gdouble_Array_Access)
   is
      procedure Internal (Data : System.Address; Z : System.Address);
      pragma Import (C, Internal, "gtk_plot_data_set_z");
   begin
      pragma Assert (Get_Numpoints (Data) = Z'Length);
      Internal (Get_Object (Data), Z (Z'First)'Address);
   end Set_Z;

   -----------
   -- Set_A --
   -----------

   procedure Set_A
     (Data : access Gtk_Plot_Data_Record; A : Gdouble_Array_Access)
   is
      procedure Internal (Data : System.Address; A : System.Address);
      pragma Import (C, Internal, "gtk_plot_data_set_a");
   begin
      pragma Assert (Get_Numpoints (Data) = A'Length);
      Internal (Get_Object (Data), A (A'First)'Address);
   end Set_A;

   ------------
   -- Set_Dx --
   ------------

   procedure Set_Dx
     (Data : access Gtk_Plot_Data_Record; Dx : Gdouble_Array_Access)
   is
      procedure Internal (Data : System.Address; Dx : System.Address);
      pragma Import (C, Internal, "gtk_plot_data_set_dx");
   begin
      pragma Assert (Get_Numpoints (Data) = Dx'Length);
      Internal (Get_Object (Data), Dx (Dx'First)'Address);
   end Set_Dx;

   ------------
   -- Set_Dy --
   ------------

   procedure Set_Dy
     (Data : access Gtk_Plot_Data_Record; Dy : Gdouble_Array_Access)
   is
      procedure Internal (Data : System.Address; Dy : System.Address);
      pragma Import (C, Internal, "gtk_plot_data_set_dy");
   begin
      pragma Assert (Get_Numpoints (Data) = Dy'Length);
      Internal (Get_Object (Data), Dy (Dy'First)'Address);
   end Set_Dy;

   ------------
   -- Set_Dz --
   ------------

   procedure Set_Dz
     (Data : access Gtk_Plot_Data_Record; Dz : Gdouble_Array_Access)
   is
      procedure Internal (Data : System.Address; Dz : System.Address);
      pragma Import (C, Internal, "gtk_plot_data_set_dz");
   begin
      pragma Assert (Get_Numpoints (Data) = Dz'Length);
      Internal (Get_Object (Data), Dz (Dz'First)'Address);
   end Set_Dz;

   ------------
   -- Set_Da --
   ------------

   procedure Set_Da
     (Data : access Gtk_Plot_Data_Record; Da : Gdouble_Array_Access)
   is
      procedure Internal (Data : System.Address; Da : System.Address);
      pragma Import (C, Internal, "gtk_plot_data_set_da");
   begin
      pragma Assert (Get_Numpoints (Data) = Da'Length);
      Internal (Get_Object (Data), Da (Da'First)'Address);
   end Set_Da;

   -----------
   -- Get_X --
   -----------

   function Get_X (Data : access Gtk_Plot_Data_Record) return Points_Array is
      function Internal (Data : System.Address; Num_Points : System.Address)
         return System.Address;
      pragma Import (C, Internal, "gtk_plot_data_get_x");

      Num_Points : aliased Gint;
      S : System.Address := Internal (Get_Object (Data), Num_Points'Address);
   begin
      return (Points => To_Double_Array (S), Num_Points => Num_Points);
   end Get_X;

   -----------
   -- Get_Y --
   -----------

   function Get_Y (Data : access Gtk_Plot_Data_Record) return Points_Array is
      function Internal (Data : System.Address; Num_Points : System.Address)
         return System.Address;
      pragma Import (C, Internal, "gtk_plot_data_get_y");

      Num_Points : aliased Gint;
      S : System.Address := Internal (Get_Object (Data), Num_Points'Address);
   begin
      return (Points => To_Double_Array (S), Num_Points => Num_Points);
   end Get_Y;

   -----------
   -- Get_Z --
   -----------

   function Get_Z (Data : access Gtk_Plot_Data_Record) return Points_Array is
      function Internal (Data : System.Address; Num_Points : System.Address)
         return System.Address;
      pragma Import (C, Internal, "gtk_plot_data_get_z");

      Num_Points : aliased Gint;
      S : System.Address := Internal (Get_Object (Data), Num_Points'Address);
   begin
      return (Points => To_Double_Array (S), Num_Points => Num_Points);
   end Get_Z;

   -----------
   -- Get_A --
   -----------

   function Get_A (Data : access Gtk_Plot_Data_Record) return Points_Array is
      function Internal (Data : System.Address; Num_Points : System.Address)
         return System.Address;
      pragma Import (C, Internal, "gtk_plot_data_get_a");

      Num_Points : aliased Gint;
      S : System.Address := Internal (Get_Object (Data), Num_Points'Address);
   begin
      return (Points => To_Double_Array (S), Num_Points => Num_Points);
   end Get_A;

   ------------
   -- Get_Dx --
   ------------

   function Get_Dx (Data : access Gtk_Plot_Data_Record) return Points_Array is
      function Internal (Data : System.Address; Num_Points : System.Address)
         return System.Address;
      pragma Import (C, Internal, "gtk_plot_data_get_dx");

      Num_Points : aliased Gint;
      S : System.Address := Internal (Get_Object (Data), Num_Points'Address);
   begin
      return (Points => To_Double_Array (S), Num_Points => Num_Points);
   end Get_Dx;

   ------------
   -- Get_Dy --
   ------------

   function Get_Dy (Data : access Gtk_Plot_Data_Record) return Points_Array is
      function Internal (Data : System.Address; Num_Points : System.Address)
         return System.Address;
      pragma Import (C, Internal, "gtk_plot_data_get_dy");

      Num_Points : aliased Gint;
      S : System.Address := Internal (Get_Object (Data), Num_Points'Address);
   begin
      return (Points => To_Double_Array (S), Num_Points => Num_Points);
   end Get_Dy;

   ------------
   -- Get_Dz --
   ------------

   function Get_Dz (Data : access Gtk_Plot_Data_Record) return Points_Array is
      function Internal (Data : System.Address; Num_Points : System.Address)
         return System.Address;
      pragma Import (C, Internal, "gtk_plot_data_get_dz");

      Num_Points : aliased Gint;
      S : System.Address := Internal (Get_Object (Data), Num_Points'Address);
   begin
      return (Points => To_Double_Array (S), Num_Points => Num_Points);
   end Get_Dz;

   ------------
   -- Get_Da --
   ------------

   function Get_Da  (Data : access Gtk_Plot_Data_Record) return Points_Array is
      function Internal (Data : System.Address; Num_Points : System.Address)
         return System.Address;
      pragma Import (C, Internal, "gtk_plot_data_get_da");

      Num_Points : aliased Gint;
      S : System.Address := Internal (Get_Object (Data), Num_Points'Address);
   begin
      return (Points => To_Double_Array (S), Num_Points => Num_Points);
   end Get_Da;

   -------------------
   -- Set_Numpoints --
   -------------------

   procedure Set_Numpoints (Data : access Gtk_Plot_Data_Record; Num : Gint) is
      procedure Internal (Data : System.Address; Num : Gint);
      pragma Import (C, Internal, "gtk_plot_data_set_numpoints");
   begin
      Internal (Get_Object (Data), Num);
   end Set_Numpoints;

   -------------------
   -- Get_Numpoints --
   -------------------

   function Get_Numpoints (Data : access Gtk_Plot_Data_Record) return Gint is
      function Internal (Data : System.Address) return Gint;
      pragma Import (C, Internal, "gtk_plot_data_get_numpoints");
   begin
      return Internal (Get_Object (Data));
   end Get_Numpoints;

   ----------------
   -- Set_Labels --
   ----------------

   procedure Set_Labels
     (Data : access Gtk_Plot_Data_Record;
      Labels : Gtkada.Types.Chars_Ptr_Array)
   is
      procedure Internal (Data : System.Address; Labels : Chars_Ptr_Array);
      pragma Import (C, Internal, "gtk_plot_data_set_labels");
   begin
      Internal (Get_Object (Data), Labels);
   end Set_Labels;

   ----------------
   -- Get_Labels --
   ----------------

   function Get_Labels (Data : access Gtk_Plot_Data_Record)
      return Gtkada.Types.Chars_Ptr_Array
   is
      type Str_Array is array (Natural) of Chars_Ptr;
      function Internal (Data : System.Address) return Str_Array;
      pragma Import (C, Internal, "gtk_plot_data_get_labels");

      N : constant size_t := size_t (Get_Numpoints (Data));
   begin
      return Chars_Ptr_Array
        (Internal (Get_Object (Data))(0 .. Integer (N) - 1));
   end Get_Labels;

   -----------------
   -- Show_Labels --
   -----------------

   procedure Show_Labels
     (Data : access Gtk_Plot_Data_Record; Show : Boolean)
   is
      procedure Internal (Data : System.Address; Show : Gint);
      pragma Import (C, Internal, "gtk_plot_data_show_labels");
   begin
      Internal (Get_Object (Data), Boolean'Pos (Show));
   end Show_Labels;

   ---------------------------
   -- Labels_Set_Attributes --
   ---------------------------

   procedure Labels_Set_Attributes
     (Data : access Gtk_Plot_Data_Record;
      Font : String;
      Height : Gint;
      Angle  : Gint;
      Foreground : Gdk.Color.Gdk_Color;
      Background : Gdk.Color.Gdk_Color)
   is
      procedure Internal
        (Data : System.Address;
         Font : String;
         Height, Angle : Gint;
         Foreground, Background : System.Address);
      pragma Import (C, Internal, "gtk_plot_data_labels_set_attributes");

      F : aliased Gdk_Color := Foreground;
      B : aliased Gdk_Color := Background;
   begin
      Internal (Get_Object (Data), Font & ASCII.NUL, Height, Angle,
                F'Address, B'Address);
   end Labels_Set_Attributes;

   ----------------
   -- Set_Symbol --
   ----------------

   procedure Set_Symbol
     (Data         : access Gtk_Plot_Data_Record;
      The_Type     : Plot_Symbol_Type;
      Style        : Plot_Symbol_Style;
      Size         : Gint;
      Line_Width   : Gfloat;
      Color        : Gdk.Color.Gdk_Color;
      Border_Color : Gdk.Color.Gdk_Color)
   is
      procedure Internal
        (Data                  : System.Address;
         The_Type, Style, Size : Gint;
         Line_Width            : Gfloat;
         Color, Border_Color   : System.Address);
      pragma Import (C, Internal, "gtk_plot_data_set_symbol");
      C : aliased Gdk_Color := Color;
      B : aliased Gdk_Color := Border_Color;
   begin
      Internal (Get_Object (Data), Plot_Symbol_Type'Pos (The_Type),
                Plot_Symbol_Style'Pos (Style), Size, Line_Width,
                C'Address, B'Address);
   end Set_Symbol;

   ----------------
   -- Get_Symbol --
   ----------------

   procedure Get_Symbol
     (Data         : access Gtk_Plot_Data_Record;
      The_Type     : out Plot_Symbol_Type;
      Style        : out Plot_Symbol_Style;
      Size         : out Gint;
      Line_Width   : out Gint;
      Color        : out Gdk.Color.Gdk_Color;
      Border_Color : out Gdk.Color.Gdk_Color)
   is
      procedure Internal
        (Data         : System.Address;
         The_Type     : out Plot_Symbol_Type;
         Style        : out Plot_Symbol_Style;
         Size         : out Gint;
         Line_Width   : out Gint;
         Color        : System.Address;
         Border_Color : System.Address);
      pragma Import (C, Internal, "gtk_plot_data_get_symbol");
      C, B : aliased Gdk_Color;
   begin
      Internal (Get_Object (Data), The_Type, Style, Size, Line_Width,
                C'Address, B'Address);
      Color := C;
      Border_Color := B;
   end Get_Symbol;

   -------------------
   -- Set_Connector --
   -------------------

   procedure Set_Connector
     (Data : access Gtk_Plot_Data_Record; Connector : Plot_Connector)
   is
      procedure Internal (Data : System.Address; Connector : Gint);
      pragma Import (C, Internal, "gtk_plot_data_set_connector");
   begin
      Internal (Get_Object (Data), Plot_Connector'Pos (Connector));
   end Set_Connector;

   -------------------
   -- Get_Connector --
   -------------------

   function Get_Connector (Data : access Gtk_Plot_Data_Record)
      return Plot_Connector
   is
      function Internal (Data : System.Address) return Gint;
      pragma Import (C, Internal, "gtk_plot_data_get_connector");
   begin
      return Plot_Connector'Val (Internal (Get_Object (Data)));
   end Get_Connector;

   -------------------------
   -- Set_Line_Attributes --
   -------------------------

   procedure Set_Line_Attributes
     (Data  : access Gtk_Plot_Data_Record;
      Style : Plot_Line_Style;
      Width : Gfloat;
      Color : Gdk.Color.Gdk_Color)
   is
      procedure Internal
        (Data  : System.Address;
         Style : Gint;
         Width : Gfloat;
         Color : System.Address);
      pragma Import (C, Internal, "gtk_plot_data_set_line_attributes");
      C : aliased Gdk_Color := Color;
   begin
      Internal (Get_Object (Data), Plot_Line_Style'Pos (Style), Width,
                C'Address);
   end Set_Line_Attributes;

   -------------------------
   -- Get_Line_Attributes --
   -------------------------

   procedure Get_Line_Attributes
     (Data  : access Gtk_Plot_Data_Record;
      Style : out Plot_Line_Style;
      Width : out Gfloat;
      Color : out Gdk.Color.Gdk_Color)
   is
      procedure Internal
        (Data  : System.Address;
         Style : out Plot_Line_Style;
         Width : out Gfloat;
         Color : System.Address);
      pragma Import (C, Internal, "gtk_plot_data_get_line_attributes");
      C : aliased Gdk_Color;
   begin
      Internal (Get_Object (Data), Style, Width, C'Address);
      Color := C;
   end Get_Line_Attributes;

   ----------------------
   -- Set_X_Attributes --
   ----------------------

   procedure Set_X_Attributes
     (Data  : access Gtk_Plot_Data_Record;
      Style : Plot_Line_Style;
      Width : Gfloat;
      Color : Gdk.Color.Gdk_Color)
   is
      procedure Internal
        (Data  : System.Address;
         Style : Gint;
         Width : Gfloat;
         Color : System.Address);
      pragma Import (C, Internal, "gtk_plot_data_set_x_attributes");
      C : aliased Gdk_Color := Color;
   begin
      Internal (Get_Object (Data), Plot_Line_Style'Pos (Style), Width,
                C'Address);
   end Set_X_Attributes;

   ----------------------
   -- Set_Y_Attributes --
   ----------------------

   procedure Set_Y_Attributes
     (Data  : access Gtk_Plot_Data_Record;
      Style : Plot_Line_Style;
      Width : Gfloat;
      Color : Gdk.Color.Gdk_Color)
   is
      procedure Internal
        (Data  : System.Address;
         Style : Gint;
         Width : Gfloat;
         Color : System.Address);
      pragma Import (C, Internal, "gtk_plot_data_set_y_attributes");
      C : aliased Gdk_Color := Color;
   begin
      Internal (Get_Object (Data), Plot_Line_Style'Pos (Style), Width,
                C'Address);
   end Set_Y_Attributes;

   ----------------------
   -- Set_Z_Attributes --
   ----------------------

   procedure Set_Z_Attributes
     (Data  : access Gtk_Plot_Data_Record;
      Style : Plot_Line_Style;
      Width : Gfloat;
      Color : Gdk.Color.Gdk_Color)
   is
      procedure Internal
        (Data  : System.Address;
         Style : Gint;
         Width : Gfloat;
         Color : System.Address);
      pragma Import (C, Internal, "gtk_plot_data_set_z_attributes");
      C : aliased Gdk_Color := Color;
   begin
      Internal (Get_Object (Data), Plot_Line_Style'Pos (Style), Width,
                C'Address);
   end Set_Z_Attributes;

   -------------------
   -- Show_Xerrbars --
   -------------------

   procedure Show_Xerrbars (Data : access Gtk_Plot_Data_Record) is
      procedure Internal (Data : System.Address);
      pragma Import (C, Internal, "gtk_plot_data_show_xerrbars");
   begin
      Internal (Get_Object (Data));
   end Show_Xerrbars;

   -------------------
   -- Show_Yerrbars --
   -------------------

   procedure Show_Yerrbars (Data : access Gtk_Plot_Data_Record) is
      procedure Internal (Data : System.Address);
      pragma Import (C, Internal, "gtk_plot_data_show_yerrbars");
   begin
      Internal (Get_Object (Data));
   end Show_Yerrbars;

   -------------------
   -- Show_Zerrbars --
   -------------------

   procedure Show_Zerrbars (Data : access Gtk_Plot_Data_Record) is
      procedure Internal (Data : System.Address);
      pragma Import (C, Internal, "gtk_plot_data_show_zerrbars");
   begin
      Internal (Get_Object (Data));
   end Show_Zerrbars;

   -------------------
   -- Hide_Xerrbars --
   -------------------

   procedure Hide_Xerrbars (Data : access Gtk_Plot_Data_Record) is
      procedure Internal (Data : System.Address);
      pragma Import (C, Internal, "gtk_plot_data_hide_xerrbars");
   begin
      Internal (Get_Object (Data));
   end Hide_Xerrbars;

   -------------------
   -- Hide_Yerrbars --
   -------------------

   procedure Hide_Yerrbars (Data : access Gtk_Plot_Data_Record) is
      procedure Internal (Data : System.Address);
      pragma Import (C, Internal, "gtk_plot_data_hide_yerrbars");
   begin
      Internal (Get_Object (Data));
   end Hide_Yerrbars;

   -------------------
   -- Hide_Zerrbars --
   -------------------

   procedure Hide_Zerrbars (Data : access Gtk_Plot_Data_Record) is
      procedure Internal (Data : System.Address);
      pragma Import (C, Internal, "gtk_plot_data_hide_zerrbars");
   begin
      Internal (Get_Object (Data));
   end Hide_Zerrbars;

   ---------------
   -- Fill_Area --
   ---------------

   procedure Fill_Area (Data : access Gtk_Plot_Data_Record; Fill : Boolean) is
      procedure Internal (Data : System.Address; Fill : Gint);
      pragma Import (C, Internal, "gtk_plot_data_fill_area");
   begin
      Internal (Get_Object (Data), Boolean'Pos (Fill));
   end Fill_Area;

   --------------------
   -- Area_Is_Filled --
   --------------------

   function Area_Is_Filled (Data : access Gtk_Plot_Data_Record)
      return Boolean
   is
      function Internal (Data : System.Address) return Gint;
      pragma Import (C, Internal, "gtk_plot_data_area_is_filled");
   begin
      return Boolean'Val (Internal (Get_Object (Data)));
   end Area_Is_Filled;

   ----------------
   -- Set_Legend --
   ----------------

   procedure Set_Legend (Data : access Gtk_Plot_Data_Record; Legend : String)
   is
      procedure Internal (Data : System.Address; Legend : String);
      pragma Import (C, Internal, "gtk_plot_data_set_legend");
   begin
      Internal (Get_Object (Data), Legend & ASCII.NUL);
   end Set_Legend;

   -----------------
   -- Show_Legend --
   -----------------

   procedure Show_Legend (Data : access Gtk_Plot_Data_Record) is
      procedure Internal (Data : System.Address);
      pragma Import (C, Internal, "gtk_plot_data_show_legend");
   begin
      Internal (Get_Object (Data));
   end Show_Legend;

   -----------------
   -- Hide_Legend --
   -----------------

   procedure Hide_Legend (Data : access Gtk_Plot_Data_Record) is
      procedure Internal (Data : System.Address);
      pragma Import (C, Internal, "gtk_plot_data_hide_legend");
   begin
      Internal (Get_Object (Data));
   end Hide_Legend;

   --------------------------
   -- Set_Legend_Precision --
   --------------------------

   procedure Set_Legend_Precision
     (Data : access Gtk_Plot_Data_Record; Precision : Gint)
   is
      procedure Internal (Data : System.Address; Precision : Gint);
      pragma Import (C, Internal, "gtk_plot_data_set_legend_precision");
   begin
      Internal (Get_Object (Data), Precision);
   end Set_Legend_Precision;

   --------------------------
   -- Get_Legend_Precision --
   --------------------------

   function Get_Legend_Precision (Data : access Gtk_Plot_Data_Record)
      return Gint
   is
      function Internal (Data : System.Address) return Gint;
      pragma Import (C, Internal, "gtk_plot_data_get_legend_precision");
   begin
      return Internal (Get_Object (Data));
   end Get_Legend_Precision;

   -----------------------
   -- Set_Gradient_Mask --
   -----------------------

   procedure Set_Gradient_Mask
     (Data : access Gtk_Plot_Data_Record; Mask : Plot_Gradient)
   is
      procedure Internal (Data : System.Address; Mask : Gint);
      pragma Import (C, Internal, "gtk_plot_data_set_gradient_mask");
   begin
      Internal (Get_Object (Data), Plot_Gradient'Pos (Mask));
   end Set_Gradient_Mask;

   -----------------------
   -- Get_Gradient_Mask --
   -----------------------

   function Get_Gradient_Mask (Data : access Gtk_Plot_Data_Record)
      return Plot_Gradient
   is
      function Internal (Data : System.Address) return Gint;
      pragma Import (C, Internal, "gtk_plot_data_get_gradient_mask");
   begin
      return Plot_Gradient'Val (Internal (Get_Object (Data)));
   end Get_Gradient_Mask;

   --------------------------
   -- Gradient_Set_Visible --
   --------------------------

   procedure Gradient_Set_Visible
     (Data : access Gtk_Plot_Data_Record; Visible : Boolean)
   is
      procedure Internal (Data : System.Address; Visible : Gint);
      pragma Import (C, Internal, "gtk_plot_data_gradient_set_visible");
   begin
      Internal (Get_Object (Data), Boolean'Pos (Visible));
   end Gradient_Set_Visible;

   ----------------------
   -- Gradient_Visible --
   ----------------------

   function Gradient_Visible (Data : access Gtk_Plot_Data_Record)
      return Boolean
   is
      function Internal (Data : System.Address) return Gint;
      pragma Import (C, Internal, "gtk_plot_data_gradient_visible");
   begin
      return Boolean'Val (Internal (Get_Object (Data)));
   end Gradient_Visible;

   -------------------------
   -- Set_Gradient_Colors --
   -------------------------

   procedure Set_Gradient_Colors
     (Data : access Gtk_Plot_Data_Record;
      Min, Max : Gdk.Color.Gdk_Color)
   is
      procedure Internal (Data, Min, Max : System.Address);
      pragma Import (C, Internal, "gtk_plot_data_set_gradient_colors");
      Mi : aliased Gdk_Color := Min;
      Ma : aliased Gdk_Color := Max;
   begin
      Internal (Get_Object (Data), Mi'Address, Ma'Address);
   end Set_Gradient_Colors;

   -------------------------
   -- Get_Gradient_Colors --
   -------------------------

   procedure Get_Gradient_Colors
     (Data : access Gtk_Plot_Data_Record;
      Min, Max : out Gdk.Color.Gdk_Color)
   is
      procedure Internal (Data, Min, Max : System.Address);
      pragma Import (C, Internal, "gtk_plot_data_get_gradient_colors");
      Mi, Ma : aliased Gdk_Color;
   begin
      Internal (Get_Object (Data), Mi'Address, Ma'Address);
      Min := Mi;
      Max := Ma;
   end Get_Gradient_Colors;

   ------------------
   -- Set_Gradient --
   ------------------

   procedure Set_Gradient
     (Data     : access Gtk_Plot_Data_Record;
      Min, Max : Gdouble;
      Nlevels  : Gint)
   is
      procedure Internal (Data : System.Address; Min, Max : Gdouble; N : Gint);
      pragma Import (C, Internal, "gtk_plot_data_set_gradient");
   begin
      Internal (Get_Object (Data), Min, Max, Nlevels);
   end Set_Gradient;

   ------------------
   -- Get_Gradient --
   ------------------

   procedure Get_Gradient
     (Data     : access Gtk_Plot_Data_Record;
      Min, Max : out Gdouble;
      Nlevels  : out Gint)
   is
      procedure Internal (Data : System.Address;
                          Min, Max : out Gdouble;
                          N : out Gint);
      pragma Import (C, Internal, "gtk_plot_data_get_gradient");
   begin
      Internal (Get_Object (Data), Min, Max, Nlevels);
   end Get_Gradient;

   ------------------------
   -- Get_Gradient_Level --
   ------------------------

   procedure Get_Gradient_Level
     (Data  : access Gtk_Plot_Data_Record;
      Level : Gdouble;
      Color : out Gdk.Color.Gdk_Color)
   is
      procedure Internal (Data : System.Address;
                          Level : Gdouble;
                          Color : System.Address);
      pragma Import (C, Internal, "gtk_plot_data_get_gradient_level");
      C : aliased Gdk_Color;
   begin
      Internal (Get_Object (Data), Level, C'Address);
      Color := C;
   end Get_Gradient_Level;

   --------------
   -- Set_Link --
   --------------

   procedure Set_Link
     (Data : access Gtk_Plot_Data_Record;
      Link : System.Address)
   is
      procedure Internal (Data, Link : System.Address);
      pragma Import (C, Internal, "gtk_plot_data_set_link");
   begin
      Internal (Get_Object (Data), Link);
   end Set_Link;

   --------------
   -- Get_Link --
   --------------

   function Get_Link (Data : access Gtk_Plot_Data_Record)
      return System.Address
   is
      function Internal (Data : System.Address) return System.Address;
      pragma Import (C, Internal, "gtk_plot_data_get_link");
   begin
      return Internal (Get_Object (Data));
   end Get_Link;

   -----------------
   -- Remove_Link --
   -----------------

   procedure Remove_Link (Data : access Gtk_Plot_Data_Record) is
      procedure Internal (Data : System.Address);
      pragma Import (C, Internal, "gtk_plot_data_remove_link");
   begin
      Internal (Get_Object (Data));
   end Remove_Link;
end Gtk.Extra.Plot_Data;
-----------------------------------------------------------------------
--          GtkAda - Ada95 binding for the Gimp Toolkit              --
--                                                                   --
--                     Copyright (C) 2000                            --
--        Emmanuel Briot, Joel Brobecker and Arnaud Charlet          --
--                                                                   --
-- This library is free software; you can redistribute it and/or     --
-- modify it under the terms of the GNU General Public               --
-- License as published by the Free Software Foundation; either      --
-- version 2 of the License, or (at your option) any later version.  --
--                                                                   --
-- This library is distributed in the hope that it will be useful,   --
-- but WITHOUT ANY WARRANTY; without even the implied warranty of    --
-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU --
-- General Public License for more details.                          --
--                                                                   --
-- You should have received a copy of the GNU General Public         --
-- License along with this library; if not, write to the             --
-- Free Software Foundation, Inc., 59 Temple Place - Suite 330,      --
-- Boston, MA 02111-1307, USA.                                       --
--                                                                   --
-- As a special exception, if other files instantiate generics from  --
-- this unit, or you link this unit with other files to produce an   --
-- executable, this  unit  does not  by itself cause  the resulting  --
-- executable to be covered by the GNU General Public License. This  --
-- exception does not however invalidate any other reasons why the   --
-- executable file  might be covered by the  GNU Public License.     --
-----------------------------------------------------------------------

--  <description>
--  This package defines the root of the plot hierarchy. It defines several
--  display strategies that can be used to show scientific data on the
--  screen (see the children for 3D, polar, bars,...)
--
--  All coordinates are in percent of the total size allocates for the data
--  set (ie the actual position is (x * width, y * height), where (x, y) is
--  the value stored in the data set and (width, height) its allocated screen
--  size.
--  </description>
--  <c_version>gtk+extra 0.99.14<c_version>

with Glib; use Glib;
with Gtk.Widget;
with Gtkada.Types;
with Gdk.Color;
with Unchecked_Conversion;

package Gtk.Extra.Plot_Data is

   type Gtk_Plot_Data_Record is new Gtk.Widget.Gtk_Widget_Record with private;
   type Gtk_Plot_Data is access all Gtk_Plot_Data_Record'Class;
   --  A set of values that can be represented on the screen. There are
   --  several strategies to set the values, either explicitely in your
   --  application, or by having them automatically generated by a function.

   -----------
   -- Types --
   -----------

   type No_Range_Gdouble_Array is array (Natural) of Gdouble;
   --  An array of values.
   --  This is used to represent the data values displayed in the plot.
   --  This array does not have any range information (so that it can be
   --  easily returned from a C function, without requiring an extra
   --  copy of the table). You can not use 'Range on this array.

   type No_Range_Gdouble_Array_Access is access all No_Range_Gdouble_Array;
   --  An access to a flat array.

   type Gdouble_Array_Access is access all Glib.Gdouble_Array;
   --  The reason we use this type in the functions below is because
   --  gtk+-extra does not keep a copy of the arrays, but points to the one
   --  given in argument. Thus, the Ada arrays should not be allocated on the
   --  stack, or at least they should be at library level. Using this 'Access
   --  will force the compiler to do the check for us.

   type Points_Array is record
      Points     : No_Range_Gdouble_Array_Access;
      Num_Points : Gint := 0;
   end record;
   --  The points are indexed from 0 to Num_Points-1.
   --  Note that you can't use 'Range, 'First or 'Last on Points.


   type Plot_Connector is (Connect_None,
                           --  No connection

                           Connect_Straight,
                           --  straight line

                           Connect_Spline,
                           --  spline or Bezier curve

                           Connect_Hv_Step,
                           --  Horizontal then vertical

                           Connect_Vh_Step,
                           --  Vertical then horizontal

                           Connect_Middle_Step
                           --  Split in the middle
                           );
   --  The type of connection between two adjacent points in a graph.

   type Plot_Gradient is new Integer;
   --  Indicate which color components vary along the gradient

   Gradient_H : constant Plot_Gradient; --  Hue
   Gradient_V : constant Plot_Gradient; --  Value
   Gradient_S : constant Plot_Gradient; --  Saturation

   type Plot_Symbol_Type is (Symbol_None,
                             Symbol_Square,
                             Symbol_Circle,
                             Symbol_Up_Triangle,
                             Symbol_Down_Triangle,
                             Symbol_Right_Triangle,
                             Symbol_Left_Triangle,
                             Symbol_Diamond,
                             Symbol_Plus,
                             Symbol_Cross,
                             Symbol_Star,
                             Symbol_Dot,
                             Symbol_Impulse);
   --  Type of symbol used to represent the points in a graph.

   type Plot_Symbol_Style is (Symbol_Empty,
                              Symbol_Filled,
                              Symbol_Opaque);
   --  Style used to draw the points in a graph.

   type Plot_Line_Style is (Line_None,
                            Line_Solid,
                            Line_Dotted,
                            Line_Dashed,
                            Line_Dot_Dash,
                            Line_Dot_Dot_Dash,
                            Line_Dot_Dash_Dash);
   --  Lines used to connect two adjacent points in a graph.

   --------------------
   -- Plot functions --
   --------------------
   --  Plot functions should generate a unique Y value given a parameter.
   --  These can be used for instance to represent exactly mathematical
   --  functions.
   --  Note that due to the C interface, the subprograms in Gtk.Extra.Plot and
   --  in this package expect functions that take a System.Address as a
   --  parameter. However, since it is much more convenient in your application
   --  to get a Gtk_Plot_Record directly, GtkAda includes a generic function
   --  that automatically does the conversion for you (see
   --  Gtk.Plot.Generic_Plot_Function).

   type Plot_Function is access function
     (Plot  : System.Address;
      Set   : Gtk_Plot_Data;
      X     : Gdouble;
      Error : access Gboolean)
     return Gdouble;
   --  Function used for plotting.
   --  It should return the value associated with X in its graph, and set
   --  Error to True if there was an error while calculating the value.

   pragma Convention (C, Plot_Function);

   -------------------------
   -- Creating a Data set --
   -------------------------

   procedure Gtk_New (Data : out Gtk_Plot_Data; Func : Plot_Function := null);
   --  Creates a new data set. Its values can either be generated automatically
   --  from Func, or will have to be set explicitely using the other
   --  subprograms in this package.

   procedure Initialize
     (Data : access Gtk_Plot_Data_Record'Class; Func : Plot_Function := null);
   --  Internal initialization function.
   --  See the section "Creating your own widgets" in the documentation.

   function Get_Type return Gtk.Gtk_Type;
   --  Return the internal value associated with a Gtk_Plot_Data.

   procedure Set_Name (Data : access Gtk_Plot_Data_Record; Name : String);
   --  Set the name used internally for that dataset.
   --  This name does not appear anywhere on the screen, but it is easier to
   --  find the dataset afterward by using this name.

   -------------------
   -- Drawing a set --
   -------------------
   --  Although a set is basically a list of values, it is closely associated
   --  with its representation on the screen (see the children of Gtk_Plot_Data
   --  for various possible representations).
   --  The Gtk.Extra packages are designed so that the drawing can be done
   --  either to the screen (through a Gdk adapter), to a postscript file for
   --  easy printing, or to any other media.

   procedure Paint (Data : access Gtk_Plot_Data_Record);
   --  Emits the "draw_data" signal to request a redrawing of the data set.

   procedure Draw_Points (Data : access Gtk_Plot_Data_Record; N : Gint);
   --  Draw at most N values of the Data set on the screen. If N is greater
   --  than the actual number of values in Data, then they are all displayed.

   procedure Draw_Symbol (Data : access Gtk_Plot_Data_Record; X, Y : Gdouble);
   --  Draw the current symbol (see Set_Symbol) at specific coordinates on
   --  the screen.

   -------------------------
   -- Manipulating values --
   -------------------------

   procedure Set_Points
     (Data : access Gtk_Plot_Data_Record;
      X    : Gdouble_Array_Access;
      Y    : Gdouble_Array_Access;
      Dx   : Gdouble_Array_Access;
      Dy   : Gdouble_Array_Access);
   --  Set some explicit points in the set.
   --  Note that the set must not be associated with a function, or the points
   --  will simply be ignored.
   --  All of the arrays must have the same length, the behavior is undefined
   --  otherwise.
   --  X and Y are the list of coordinates of the points.
   --  Dx and Dy are the list of size (precision) of these points. A bigger
   --  symbol will be displayed for the point whose (Dx, Dy) value is bigger.

   procedure Get_Points
     (Data : access Gtk_Plot_Data_Record;
      X    : out Points_Array;
      Y    : out Points_Array;
      Dx   : out Points_Array;
      Dy   : out Points_Array);
   --  Return the value of the points in the set.
   --  Null-length arrays are returned if the set is associated with a
   --  function, since no explicit point has been set.
   --  See Set_Points for a definition of X, Y, Dx and Dy.

   procedure Set_X
     (Data : access Gtk_Plot_Data_Record; X : Gdouble_Array_Access);
   procedure Set_Y
     (Data : access Gtk_Plot_Data_Record; Y : Gdouble_Array_Access);
   procedure Set_Z
     (Data : access Gtk_Plot_Data_Record; Z : Gdouble_Array_Access);
   procedure Set_A
     (Data : access Gtk_Plot_Data_Record; A : Gdouble_Array_Access);
   --  Set the values for one specific coordinate in the set.
   --  The array must have a length of Get_Numpoints (if GtkAda was
   --  compiled with assertions enabled, an exception will be raised if the
   --  length are different).
   --  No copy of the array is made for efficiency reasons, thus modifying
   --  the array content later on will also modify the plot.
   --
   --  "A" is used to specify the size of the symbols. When plotting boxes in
   --  two dimensions, "Z" is used to specify the size of the box.

   procedure Set_Dx
     (Data : access Gtk_Plot_Data_Record; Dx : Gdouble_Array_Access);
   procedure Set_Dy
     (Data : access Gtk_Plot_Data_Record; Dy : Gdouble_Array_Access);
   procedure Set_Dz
     (Data : access Gtk_Plot_Data_Record; Dz : Gdouble_Array_Access);
   --  Set the precision of the points in the set. A bigger symbol is displayed
   --  for the points whose (Dx, Dy, Dz) is bigger.
   --  The array must have a length of Get_Numpoints (if GtkAda was
   --  compiled with assertions enabled, an exception will be raised if the
   --  length are different).
   --  No copy of the array is made for efficiency reasons, thus modifying
   --  the array content later on will also modify the plot.

   procedure Set_Da
     (Data : access Gtk_Plot_Data_Record; Da : Gdouble_Array_Access);
   --  Specifies the colors to use for the points.
   --  The color of the symbols is detemined using the gradient. the gradient
   --  has (min, max) values, and corresponding colors. The symbol's color is
   --  interpolated between these values using hue/saturation/value depending
   --  on the gradient_mask.

   function Get_X  (Data : access Gtk_Plot_Data_Record) return Points_Array;
   function Get_Y  (Data : access Gtk_Plot_Data_Record) return Points_Array;
   function Get_Z  (Data : access Gtk_Plot_Data_Record) return Points_Array;
   function Get_A  (Data : access Gtk_Plot_Data_Record) return Points_Array;
   function Get_Dx (Data : access Gtk_Plot_Data_Record) return Points_Array;
   function Get_Dy (Data : access Gtk_Plot_Data_Record) return Points_Array;
   function Get_Dz (Data : access Gtk_Plot_Data_Record) return Points_Array;
   function Get_Da (Data : access Gtk_Plot_Data_Record) return Points_Array;
   --  Return the coordinates for the points in the set.
   --  This is a direct access to the underlying C array, thus modifying this
   --  array's contents also modifies the graph.
   --  See the corresponding Set_* functions for a definition of the
   --  coordinates

   procedure Set_Numpoints (Data : access Gtk_Plot_Data_Record; Num : Gint);
   --  Set the number of points that should be expected in the graph.
   --  Note that this does not automatically resize all the internal structure,
   --  it just indicates what size the parameters to Set_X, Set_Y,... should
   --  have.

   function Get_Numpoints (Data : access Gtk_Plot_Data_Record) return Gint;
   --  Return the number of points expected in the graph.

   ------------
   -- Labels --
   ------------
   --  Each point in the data set can be associated with a label that describes
   --  it. This is only relevant for data sets where you explicitely give
   --  values, not when the values are generated by a function.

   procedure Set_Labels
     (Data : access Gtk_Plot_Data_Record;
      Labels : Gtkada.Types.Chars_Ptr_Array);
   --  Set the labels associated which each point in the canvas.
   --  There must be at least Get_Numpoints elements in Labels, or the
   --  behavior is undefined

   function Get_Labels (Data : access Gtk_Plot_Data_Record)
      return Gtkada.Types.Chars_Ptr_Array;
   --  Return the labels associated with the points in the data set.
   --  Note that this returns a *copy* of the actual array, and thus might
   --  be expensive to call.

   procedure Show_Labels (Data : access Gtk_Plot_Data_Record; Show : Boolean);
   --  Indicate whether the labels should be displayed next to each point in
   --  the data set. This has no effect if no labels were specified.

   procedure Labels_Set_Attributes
     (Data : access Gtk_Plot_Data_Record;
      Font : String;
      Height : Gint;
      Angle  : Gint;
      Foreground : Gdk.Color.Gdk_Color;
      Background : Gdk.Color.Gdk_Color);
   --  Set the properties of the labels

   ----------------------------
   -- Symbols and Connectors --
   ----------------------------
   --  Each point that is explicitely set in the data set through the
   --  Set_X, Set_Y,... subprograms is visually associated with a symbol. There
   --  are several representations for the symbols.
   --
   --  All these symbols are then connected by a line, a curve or any other
   --  link. These are called connectors.
   --
   --  Each symbol, in addition to being connected to the next one with a
   --  connector, can also be linked to the axis X=0, Y=0 or Z=0 so that it is
   --  easier to read its coordinates. These are called errbars, and they must
   --  be explicitely shown.

   procedure Set_Symbol
     (Data         : access Gtk_Plot_Data_Record;
      The_Type     : Plot_Symbol_Type;
      Style        : Plot_Symbol_Style;
      Size         : Gint;
      Line_Width   : Gfloat;
      Color        : Gdk.Color.Gdk_Color;
      Border_Color : Gdk.Color.Gdk_Color);
   --  Set the visual aspect of the symbols.

   procedure Get_Symbol
     (Data         : access Gtk_Plot_Data_Record;
      The_Type     : out Plot_Symbol_Type;
      Style        : out Plot_Symbol_Style;
      Size         : out Gint;
      Line_Width   : out Gint;
      Color        : out Gdk.Color.Gdk_Color;
      Border_Color : out Gdk.Color.Gdk_Color);
   --  Return the visual characteristics of the symbols.

   procedure Set_Connector
     (Data : access Gtk_Plot_Data_Record; Connector : Plot_Connector);
   --  Set the style of the connectors.

   function Get_Connector (Data : access Gtk_Plot_Data_Record)
      return Plot_Connector;
   --  Return the connector style used for the data set.

   procedure Set_Line_Attributes
     (Data  : access Gtk_Plot_Data_Record;
      Style : Plot_Line_Style;
      Width : Gfloat;
      Color : Gdk.Color.Gdk_Color);
   --  Set the line style used for the connectors.

   procedure Get_Line_Attributes
     (Data  : access Gtk_Plot_Data_Record;
      Style : out Plot_Line_Style;
      Width : out Gfloat;
      Color : out Gdk.Color.Gdk_Color);
   --  Return the line attributes used for the connectors.

   procedure Set_X_Attributes
     (Data  : access Gtk_Plot_Data_Record;
      Style : Plot_Line_Style;
      Width : Gfloat;
      Color : Gdk.Color.Gdk_Color);
   --  Set the style of the lines used to connect the symbols to the X axis.

   procedure Set_Y_Attributes
     (Data  : access Gtk_Plot_Data_Record;
      Style : Plot_Line_Style;
      Width : Gfloat;
      Color : Gdk.Color.Gdk_Color);
   --  Set the style of the lines used to connect the symbols to the Y axis.

   procedure Set_Z_Attributes
     (Data  : access Gtk_Plot_Data_Record;
      Style : Plot_Line_Style;
      Width : Gfloat;
      Color : Gdk.Color.Gdk_Color);
   --  Set the style of the lines used to connect the symbols to the Z axis.

   procedure Show_Xerrbars (Data : access Gtk_Plot_Data_Record);
   procedure Show_Yerrbars (Data : access Gtk_Plot_Data_Record);
   procedure Show_Zerrbars (Data : access Gtk_Plot_Data_Record);
   --  Indicate that each symbol should be connected to the various axis

   procedure Hide_Xerrbars (Data : access Gtk_Plot_Data_Record);
   procedure Hide_Yerrbars (Data : access Gtk_Plot_Data_Record);
   procedure Hide_Zerrbars (Data : access Gtk_Plot_Data_Record);
   --  Indicate the the symbol should not be connected to the axis.

   procedure Fill_Area (Data : access Gtk_Plot_Data_Record; Fill : Boolean);
   --  Indicate whether the area between two points should be filled or not.

   function Area_Is_Filled (Data : access Gtk_Plot_Data_Record)
      return Boolean;
   --  Indicate whether the area between two points is filled.

   -------------
   -- Legends --
   -------------
   --  In addition to the drawing corresponding to the data set, it is possible
   --  to display a box that contains a legend. This is particulary useful when
   --  multiple data sets are displayed on the same plot.

   procedure Set_Legend (Data : access Gtk_Plot_Data_Record; Legend : String);
   --  Set the string printed in the legend for that data set.
   --  Note that an entry can exist in the legend even if there is no name
   --  associated with the graph.

   procedure Show_Legend (Data : access Gtk_Plot_Data_Record);
   --  An entry will be made in the plot's legend for that dataset.

   procedure Hide_Legend (Data : access Gtk_Plot_Data_Record);
   --  No entry will appear in the plot's legend for that dataset.

   procedure Set_Legend_Precision
     (Data : access Gtk_Plot_Data_Record; Precision : Gint);
   --  Number of digits to display when the legends is associated with values,
   --  as is the case for gradients.

   function Get_Legend_Precision (Data : access Gtk_Plot_Data_Record)
      return Gint;
   --  Return the number of digits used for values in the legend

   ---------------
   -- Gradients --
   ---------------
   --  The symbols displayed in the plot can be assigned specific colors. But
   --  they can also compute their own color by picking it in a gradient,
   --  depending on the value.

   procedure Set_Gradient_Mask
     (Data : access Gtk_Plot_Data_Record; Mask : Plot_Gradient);
   --  Indicates which component of the colors vary along the gradient.

   function Get_Gradient_Mask (Data : access Gtk_Plot_Data_Record)
      return Plot_Gradient;
   --  Return the mask used for the gradient.

   procedure Gradient_Set_Visible
     (Data : access Gtk_Plot_Data_Record; Visible : Boolean);
   --  Indicates whether the gradient should be visible

   function Gradient_Visible (Data : access Gtk_Plot_Data_Record)
      return Boolean;
   --  Return True if the gradient is currently visible

   procedure Set_Gradient_Colors
     (Data : access Gtk_Plot_Data_Record;
      Min, Max : Gdk.Color.Gdk_Color);
   --  Set the colors that define the gradient. The colors will vary from
   --  Min to Max along the components specified in Set_Gradient_Mask.

   procedure Get_Gradient_Colors
     (Data : access Gtk_Plot_Data_Record;
      Min, Max : out Gdk.Color.Gdk_Color);
   --  Return the colors that define the range

   procedure Set_Gradient
     (Data     : access Gtk_Plot_Data_Record;
      Min, Max : Gdouble;
      Nlevels  : Gint);
   --  Define the values associated with the minimal color and the maximal
   --  color. Any value in between will have a color computed in between.
   --  Nlevels is the number of ticks to display in the gradient.

   procedure Get_Gradient
     (Data     : access Gtk_Plot_Data_Record;
      Min, Max : out Gdouble;
      Nlevels  : out Gint);
   --  Return the values associated with the minimal and maximal colors.

   procedure Get_Gradient_Level
     (Data  : access Gtk_Plot_Data_Record;
      Level : Gdouble;
      Color : out Gdk.Color.Gdk_Color);
   --  Return the color associated with a specific level.
   --  The color depends on the parameters to Set_Gradient and
   --  Set_Gradient_Colors.

   ---------------
   -- User Data --
   ---------------
   --  It is possible to associated your own user data with a plot. This is
   --  the mechanism provided by the C version of gtkextra. However, the best
   --  way to do this in Ada is to inherit from Gtk_Plot_Data_Record (or one
   --  of its children), and add your own fields.

   procedure Set_Link
     (Data : access Gtk_Plot_Data_Record;
      Link : System.Address);
   --  Associate some user data with Data.
   --  It is the responsability of the user to do some convert conversion to
   --  System.Address.

   function Get_Link (Data : access Gtk_Plot_Data_Record)
      return System.Address;
   --  Return the user data associated with Data, or Null_Address if there is
   --  none.

   procedure Remove_Link (Data : access Gtk_Plot_Data_Record);
   --  Remove the user data associated with Data.


   --  <doc_ignore>
   function To_Double_Array is new Unchecked_Conversion
     (System.Address, No_Range_Gdouble_Array_Access);
   --  </doc_ignore>

private
   type Gtk_Plot_Data_Record is new Gtk.Widget.Gtk_Widget_Record with
     null record;

   Gradient_H : constant Plot_Gradient := 1;
   Gradient_V : constant Plot_Gradient := 2;
   Gradient_S : constant Plot_Gradient := 4;

   pragma Import (C, Get_Type, "gtk_plot_data_get_type");
end Gtk.Extra.Plot_Data;


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]