1. ----------------------------------------------------------------------- 
  2. --               GtkAda - Ada95 binding for Gtk+/Gnome               -- 
  3. --                                                                   -- 
  4. --      Copyright (C) 2000 E. Briot, J. Brobecker and A. Charlet     -- 
  5. --                Copyright (C) 2000-2006 AdaCore                    -- 
  6. --                                                                   -- 
  7. -- This library is free software; you can redistribute it and/or     -- 
  8. -- modify it under the terms of the GNU General Public               -- 
  9. -- License as published by the Free Software Foundation; either      -- 
  10. -- version 2 of the License, or (at your option) any later version.  -- 
  11. --                                                                   -- 
  12. -- This library is distributed in the hope that it will be useful,   -- 
  13. -- but WITHOUT ANY WARRANTY; without even the implied warranty of    -- 
  14. -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU -- 
  15. -- General Public License for more details.                          -- 
  16. --                                                                   -- 
  17. -- You should have received a copy of the GNU General Public         -- 
  18. -- License along with this library; if not, write to the             -- 
  19. -- Free Software Foundation, Inc., 59 Temple Place - Suite 330,      -- 
  20. -- Boston, MA 02111-1307, USA.                                       -- 
  21. --                                                                   -- 
  22. -- As a special exception, if other files instantiate generics from  -- 
  23. -- this unit, or you link this unit with other files to produce an   -- 
  24. -- executable, this  unit  does not  by itself cause  the resulting  -- 
  25. -- executable to be covered by the GNU General Public License. This  -- 
  26. -- exception does not however invalidate any other reasons why the   -- 
  27. -- executable file  might be covered by the  GNU Public License.     -- 
  28. ----------------------------------------------------------------------- 
  29.  
  30. --  <description> 
  31. --  This package defines the root of the plot hierarchy. It defines several 
  32. --  display strategies that can be used to show scientific data on the 
  33. --  screen (see the children for 3D, polar, bars,...) 
  34. -- 
  35. --  All coordinates are in percent of the total size allocates for the data 
  36. --  set (ie the actual position is (x * width, y * height), where (x, y) is 
  37. --  the value stored in the data set and (width, height) its allocated screen 
  38. --  size. 
  39. --  </description> 
  40. --  <c_version>gtkextra 2.1.1</c_version> 
  41. --  <group>Plotting Data</group> 
  42. --  <testgtk>create_plot_realtime.adb</testgtk> 
  43.  
  44. with Gdk.Color; 
  45. with Gdk.GC; 
  46. with Glib; 
  47. with Gtk.Widget; 
  48. with Gtkada.Types; 
  49. with Unchecked_Conversion; 
  50.  
  51. package Gtk.Extra.Plot_Data is 
  52.  
  53.    type Plot_Label_Style is (Label_Float, Label_Exp, Label_Pow); 
  54.    --  The style of labels (floating point, or scientific notation) 
  55.    pragma Convention (C, Plot_Label_Style); 
  56.  
  57.    type Plot_Scale is (Scale_Linear, Scale_Log10); 
  58.    --  Type of scale used for each axis of a graph. 
  59.    pragma Convention (C, Plot_Scale); 
  60.  
  61.    type Gtk_Plot_Data_Record is new Gtk.Widget.Gtk_Widget_Record with private; 
  62.    type Gtk_Plot_Data is access all Gtk_Plot_Data_Record'Class; 
  63.    --  A set of values that can be represented on the screen. There are 
  64.    --  several strategies to set the values, either explicitely in your 
  65.    --  application, or by having them automatically generated by a function. 
  66.  
  67.    type Gtk_Plot_Marker is new Gdk.C_Proxy; 
  68.  
  69.    --  <doc_ignore> 
  70.    --  The convert functions are needed to e.g. instantiate Generic_List 
  71.    --  They should not be used directly 
  72.    function Convert is new Unchecked_Conversion 
  73.      (Gtk_Plot_Data, System.Address); 
  74.    function Convert is new Unchecked_Conversion 
  75.      (System.Address, Gtk_Plot_Data); 
  76.    --  </doc_ignore> 
  77.  
  78.    ----------- 
  79.    -- Types -- 
  80.    ----------- 
  81.  
  82.    type No_Range_Gdouble_Array is array (Natural) of Gdouble; 
  83.    --  An array of values. 
  84.    --  This is used to represent the data values displayed in the plot. 
  85.    --  This array does not have any range information (so that it can be 
  86.    --  easily returned from a C function, without requiring an extra 
  87.    --  copy of the table). You can not use 'Range on this array. 
  88.  
  89.    type No_Range_Gdouble_Array_Access is access all No_Range_Gdouble_Array; 
  90.    --  An access to a flat array. 
  91.  
  92.    type Gdouble_Array_Access is access all Glib.Gdouble_Array; 
  93.    --  The reason we use this type in the functions below is because 
  94.    --  gtk+-extra does not keep a copy of the arrays, but points to the one 
  95.    --  given in argument. Thus, the Ada arrays should not be allocated on the 
  96.    --  stack, or at least they should be at library level. Using this 'Access 
  97.    --  will force the compiler to do the check for us. 
  98.  
  99.    type Points_Array is record 
  100.       Points     : No_Range_Gdouble_Array_Access; 
  101.       Num_Points : Gint := 0; 
  102.    end record; 
  103.    --  The points are indexed from 0 to Num_Points-1. 
  104.    --  Note that you can't use 'Range, 'First or 'Last on Points. 
  105.  
  106.    type Plot_Connector is 
  107.      (Connect_None, 
  108.       --  No connection 
  109.  
  110.       Connect_Straight, 
  111.       --  straight line 
  112.  
  113.       Connect_Spline, 
  114.       --  spline or Bezier curve 
  115.  
  116.       Connect_Hv_Step, 
  117.       --  Horizontal then vertical 
  118.  
  119.       Connect_Vh_Step, 
  120.       --  Vertical then horizontal 
  121.  
  122.       Connect_Middle_Step 
  123.       --  Split in the middle 
  124.      ); 
  125.    --  The type of connection between two adjacent points in a graph. 
  126.    pragma Convention (C, Plot_Connector); 
  127.  
  128.    type Plot_Gradient is new Integer; 
  129.    --  Indicate which color components vary along the gradient 
  130.  
  131.    Gradient_H : constant Plot_Gradient; --  Hue 
  132.    Gradient_V : constant Plot_Gradient; --  Value 
  133.    Gradient_S : constant Plot_Gradient; --  Saturation 
  134.  
  135.    type Plot_Symbol_Type is 
  136.      (Symbol_None, 
  137.       Symbol_Square, 
  138.       Symbol_Circle, 
  139.       Symbol_Up_Triangle, 
  140.       Symbol_Down_Triangle, 
  141.       Symbol_Right_Triangle, 
  142.       Symbol_Left_Triangle, 
  143.       Symbol_Diamond, 
  144.       Symbol_Plus, 
  145.       Symbol_Cross, 
  146.       Symbol_Star, 
  147.       Symbol_Dot, 
  148.       Symbol_Impulse); 
  149.    --  Type of symbol used to represent the points in a graph. 
  150.    pragma Convention (C, Plot_Symbol_Type); 
  151.  
  152.    type Plot_Symbol_Style is 
  153.      (Symbol_Empty, 
  154.       Symbol_Filled, 
  155.       Symbol_Opaque); 
  156.    --  Style used to draw the points in a graph. 
  157.    pragma Convention (C, Plot_Symbol_Style); 
  158.  
  159.    type Plot_Line_Style is 
  160.      (Line_None, 
  161.       Line_Solid, 
  162.       Line_Dotted, 
  163.       Line_Dashed, 
  164.       Line_Dot_Dash, 
  165.       Line_Dot_Dot_Dash, 
  166.       Line_Dot_Dash_Dash); 
  167.    --  Lines used to connect two adjacent points in a graph. 
  168.    pragma Convention (C, Plot_Line_Style); 
  169.  
  170.    type Plot_Angle is (Angle_0, Angle_90, Angle_180, Angle_270); 
  171.    --  Valid values for the angles of texts and titles. 
  172.    pragma Convention (C, Plot_Angle); 
  173.  
  174.    -------------------- 
  175.    -- Plot functions -- 
  176.    -------------------- 
  177.    --  Plot functions should generate a unique Y value given a parameter. 
  178.    --  These can be used for instance to represent exactly mathematical 
  179.    --  functions. 
  180.    --  Note that due to the C interface, the subprograms in Gtk.Extra.Plot and 
  181.    --  in this package expect functions that take a System.Address as a 
  182.    --  parameter. However, since it is much more convenient in your application 
  183.    --  to get a Gtk_Plot_Record directly, GtkAda includes a generic function 
  184.    --  that automatically does the conversion for you (see 
  185.    --  Gtk.Plot.Generic_Plot_Function). 
  186.  
  187.    type Plot_Function is access function 
  188.      (Plot  : System.Address; 
  189.       Set   : Gtk_Plot_Data; 
  190.       X     : Gdouble; 
  191.       Error : access Gboolean) return Gdouble; 
  192.    --  Function used for plotting. 
  193.    --  It should return the value associated with X in its graph, and set 
  194.    --  Error to True if there was an error while calculating the value. 
  195.  
  196.    pragma Convention (C, Plot_Function); 
  197.  
  198.    ------------------------- 
  199.    -- Creating a Data set -- 
  200.    ------------------------- 
  201.  
  202.    procedure Gtk_New (Data : out Gtk_Plot_Data; Func : Plot_Function := null); 
  203.    --  Creates a new data set. Its values can either be generated automatically 
  204.    --  from Func, or will have to be set explicitely using the other 
  205.    --  subprograms in this package. 
  206.  
  207.    procedure Initialize 
  208.      (Data : access Gtk_Plot_Data_Record'Class; Func : Plot_Function := null); 
  209.    --  Internal initialization function. 
  210.    --  See the section "Creating your own widgets" in the documentation. 
  211.  
  212.    function Get_Type return Gtk.Gtk_Type; 
  213.    --  Return the internal value associated with a Gtk_Plot_Data. 
  214.  
  215.    procedure Set_Name (Data : access Gtk_Plot_Data_Record; Name : String); 
  216.    --  Set the name used internally for that dataset. 
  217.    --  This name does not appear anywhere on the screen, but it is easier to 
  218.    --  find the dataset afterward by using this name. 
  219.  
  220.    procedure Clone 
  221.      (Data : access Gtk_Plot_Data_Record; 
  222.       Copy : access Gtk_Plot_Data_Record'Class); 
  223.    --  Copy the contents of Data into Copy, which must have been allocated 
  224.    --  first 
  225.  
  226.    ------------------- 
  227.    -- Drawing a set -- 
  228.    ------------------- 
  229.    --  Although a set is basically a list of values, it is closely associated 
  230.    --  with its representation on the screen (see the children of Gtk_Plot_Data 
  231.    --  for various possible representations). 
  232.    --  The Gtk.Extra packages are designed so that the drawing can be done 
  233.    --  either to the screen (through a Gdk adapter), to a postscript file for 
  234.    --  easy printing, or to any other media. 
  235.  
  236.    procedure Paint (Data : access Gtk_Plot_Data_Record); 
  237.    --  Emits the "draw_data" signal to request a redrawing of the data set. 
  238.  
  239.    procedure Update (Data : access Gtk_Plot_Data_Record); 
  240.    --  Indicates that the data has changed, and the graphical view should 
  241.    --  reflect this. 
  242.  
  243.    procedure Draw_Points (Data : access Gtk_Plot_Data_Record; N : Gint); 
  244.    --  Draw the N last (most recent) values of the Data set on the screen. 
  245.    --  If N is greater than the actual number of values in Data, then they are 
  246.    --  all displayed. This subprogram should be used when you want to 
  247.    --  periodically update the contents of a dataset (you would then modify 
  248.    --  the number of points in the dataset with a call to Set_Numpoints, then 
  249.    --  register the new points with Set_X and Set_Y, and finally refresh the 
  250.    --  dataset with a call to Draw_Points and Gtk.Plot.Refresh). 
  251.  
  252.    procedure Draw_Symbol (Data : access Gtk_Plot_Data_Record; X, Y : Gdouble); 
  253.    --  Draw the current symbol (see Set_Symbol) at specific coordinates on 
  254.    --  the screen. 
  255.  
  256.    ---------------- 
  257.    -- Dimensions -- 
  258.    ---------------- 
  259.    --  The coordinates of the points to draw are specified in space. Therefore, 
  260.    --  they have multiple coordinates, each associate with a specific 
  261.    --  dimension. 
  262.    --  The name of dimensions below must be one of "x", "y", "z", "dx", "dy", 
  263.    --  "dz", "a", "da". 
  264.    --  "d..." are the size (precision of these points). A bigger symbol is 
  265.    --  displayed for the points whose (dx,dy) is bigger. 
  266.    --  "a" is used to specify the size of the symbols. When plotting boxes in 
  267.    --  two dimensions, "Z" is used to specify the size of the box. 
  268.  
  269.    procedure Dimension_Set_Points 
  270.      (Data   : access Gtk_Plot_Data_Record; 
  271.       Name   : String; 
  272.       Points : Gdouble_Array_Access); 
  273.    --  Set the coordinates of the points along one dimension 
  274.  
  275.    procedure Set_Numpoints (Data : access Gtk_Plot_Data_Record; Num : Gint); 
  276.    --  Set the number of points that should be expected in the graph. 
  277.    --  Note that this does not automatically resize all the internal structure, 
  278.    --  it just indicates what size the parameters to Set_X, Set_Y,... should 
  279.    --  have. 
  280.  
  281.    function Get_Numpoints (Data : access Gtk_Plot_Data_Record) return Gint; 
  282.    --  Return the number of points expected in the graph. 
  283.  
  284.    ------------------------- 
  285.    -- Manipulating values -- 
  286.    ------------------------- 
  287.    --  These are older functions, kept for compatibility. They provide a 
  288.    --  somewhat simpler interface to the dimensions, but the use of dimensions 
  289.    --  is recommended. 
  290.    --  See the comment for dimensions on the meaning of X, Y, Dx, Dy,... 
  291.  
  292.    procedure Set_Points 
  293.      (Data   : access Gtk_Plot_Data_Record; 
  294.       X, Y, Dx, Dy : Gdouble_Array_Access); 
  295.    --  Set some explicit points in the set. 
  296.    --  Note that the set must not be associated with a function, or the points 
  297.    --  will simply be ignored. 
  298.    --  All of the arrays must have the same length, the behavior is undefined 
  299.    --  otherwise. 
  300.  
  301.    procedure Get_Points 
  302.      (Data : access Gtk_Plot_Data_Record; 
  303.       X    : out Points_Array; 
  304.       Y    : out Points_Array; 
  305.       Dx   : out Points_Array; 
  306.       Dy   : out Points_Array); 
  307.    --  Return the value of the points in the set. 
  308.    --  Null-length arrays are returned if the set is associated with a 
  309.    --  function, since no explicit point has been set. 
  310.  
  311.    procedure Set_X 
  312.      (Data : access Gtk_Plot_Data_Record; X : Gdouble_Array_Access); 
  313.    procedure Set_Y 
  314.      (Data : access Gtk_Plot_Data_Record; Y : Gdouble_Array_Access); 
  315.    procedure Set_Z 
  316.      (Data : access Gtk_Plot_Data_Record; Z : Gdouble_Array_Access); 
  317.    procedure Set_A 
  318.      (Data : access Gtk_Plot_Data_Record; A : Gdouble_Array_Access); 
  319.    --  Set the values for one specific coordinate in the set. 
  320.    --  The array must have a length of Get_Numpoints (if GtkAda was 
  321.    --  compiled with assertions enabled, an exception will be raised if the 
  322.    --  length are different). 
  323.    --  No copy of the array is made for efficiency reasons, thus modifying 
  324.    --  the array content later on will also modify the plot. 
  325.  
  326.    procedure Set_A_Scale 
  327.      (Data : access Gtk_Plot_Data_Record; A_Scale : Gdouble); 
  328.    function Get_A_Scale 
  329.      (Data : access Gtk_Plot_Data_Record) return Gdouble; 
  330.    --  Changes the scale used for the "A" coordinate 
  331.  
  332.    procedure Set_Dx 
  333.      (Data : access Gtk_Plot_Data_Record; Dx : Gdouble_Array_Access); 
  334.    procedure Set_Dy 
  335.      (Data : access Gtk_Plot_Data_Record; Dy : Gdouble_Array_Access); 
  336.    procedure Set_Dz 
  337.      (Data : access Gtk_Plot_Data_Record; Dz : Gdouble_Array_Access); 
  338.    --  Set the precision of the points in the set. A bigger symbol is displayed 
  339.    --  for the points whose (Dx, Dy, Dz) is bigger. 
  340.    --  The array must have a length of Get_Numpoints (if GtkAda was 
  341.    --  compiled with assertions enabled, an exception will be raised if the 
  342.    --  length are different). 
  343.    --  No copy of the array is made for efficiency reasons, thus modifying 
  344.    --  the array content later on will also modify the plot. 
  345.  
  346.    procedure Set_Da 
  347.      (Data : access Gtk_Plot_Data_Record; Da : Gdouble_Array_Access); 
  348.    --  Specifies the colors to use for the points. 
  349.    --  The color of the symbols is detemined using the gradient. the gradient 
  350.    --  has (min, max) values, and corresponding colors. The symbol's color is 
  351.    --  interpolated between these values using hue/saturation/value depending 
  352.    --  on the gradient_mask. 
  353.  
  354.    function Get_X  (Data : access Gtk_Plot_Data_Record) return Points_Array; 
  355.    function Get_Y  (Data : access Gtk_Plot_Data_Record) return Points_Array; 
  356.    function Get_Z  (Data : access Gtk_Plot_Data_Record) return Points_Array; 
  357.    function Get_A  (Data : access Gtk_Plot_Data_Record) return Points_Array; 
  358.    function Get_Dx (Data : access Gtk_Plot_Data_Record) return Points_Array; 
  359.    function Get_Dy (Data : access Gtk_Plot_Data_Record) return Points_Array; 
  360.    function Get_Dz (Data : access Gtk_Plot_Data_Record) return Points_Array; 
  361.    function Get_Da (Data : access Gtk_Plot_Data_Record) return Points_Array; 
  362.    --  Return the coordinates for the points in the set. 
  363.    --  This is a direct access to the underlying C array, thus modifying this 
  364.    --  array's contents also modifies the graph. 
  365.    --  See the corresponding Set_* functions for a definition of the 
  366.    --  coordinates 
  367.  
  368.    ------------ 
  369.    -- Labels -- 
  370.    ------------ 
  371.    --  Each point in the data set can be associated with a label that describes 
  372.    --  it. This is only relevant for data sets where you explicitely give 
  373.    --  values, not when the values are generated by a function. 
  374.  
  375.    procedure Set_Labels 
  376.      (Data   : access Gtk_Plot_Data_Record; 
  377.       Labels : Gtkada.Types.Chars_Ptr_Array); 
  378.    --  Set the labels associated which each point in the canvas. 
  379.    --  There must be at least Get_Numpoints elements in Labels, or the 
  380.    --  behavior is undefined 
  381.  
  382.    function Get_Labels (Data : access Gtk_Plot_Data_Record) 
  383.       return Gtkada.Types.Chars_Ptr_Array; 
  384.    --  Return the labels associated with the points in the data set. 
  385.    --  Note that this returns a *copy* of the actual array, and thus might 
  386.    --  be expensive to call. 
  387.  
  388.    procedure Show_Labels (Data : access Gtk_Plot_Data_Record; Show : Boolean); 
  389.    --  Indicate whether the labels should be displayed next to each point in 
  390.    --  the data set. This has no effect if no labels were specified. 
  391.  
  392.    procedure Labels_Set_Attributes 
  393.      (Data       : access Gtk_Plot_Data_Record; 
  394.       Font       : String; 
  395.       Height     : Gint; 
  396.       Angle      : Plot_Angle; 
  397.       Foreground : Gdk.Color.Gdk_Color; 
  398.       Background : Gdk.Color.Gdk_Color); 
  399.    --  Set the properties of the labels 
  400.  
  401.    ---------------------------- 
  402.    -- Symbols and Connectors -- 
  403.    ---------------------------- 
  404.    --  Each point that is explicitely set in the data set through the 
  405.    --  Set_X, Set_Y,... subprograms is visually associated with a symbol. There 
  406.    --  are several representations for the symbols. 
  407.    -- 
  408.    --  All these symbols are then connected by a line, a curve or any other 
  409.    --  link. These are called connectors. 
  410.    -- 
  411.    --  Each symbol, in addition to being connected to the next one with a 
  412.    --  connector, can also be linked to the axis X=0, Y=0 or Z=0 so that it is 
  413.    --  easier to read its coordinates. These are called errbars, and they must 
  414.    --  be explicitely shown. 
  415.  
  416.    procedure Set_Symbol 
  417.      (Data         : access Gtk_Plot_Data_Record; 
  418.       The_Type     : Plot_Symbol_Type; 
  419.       Style        : Plot_Symbol_Style; 
  420.       Size         : Gint; 
  421.       Line_Width   : Gfloat; 
  422.       Color        : Gdk.Color.Gdk_Color; 
  423.       Border_Color : Gdk.Color.Gdk_Color); 
  424.    --  Set the visual aspect of the symbols. 
  425.  
  426.    procedure Get_Symbol 
  427.      (Data         : access Gtk_Plot_Data_Record; 
  428.       The_Type     : out Plot_Symbol_Type; 
  429.       Style        : out Plot_Symbol_Style; 
  430.       Size         : out Gint; 
  431.       Line_Width   : out Gint; 
  432.       Color        : out Gdk.Color.Gdk_Color; 
  433.       Border_Color : out Gdk.Color.Gdk_Color); 
  434.    --  Return the visual characteristics of the symbols. 
  435.  
  436.    procedure Set_Connector 
  437.      (Data : access Gtk_Plot_Data_Record; Connector : Plot_Connector); 
  438.    --  Set the style of the connectors. 
  439.  
  440.    function Get_Connector (Data : access Gtk_Plot_Data_Record) 
  441.       return Plot_Connector; 
  442.    --  Return the connector style used for the data set. 
  443.  
  444.    procedure Set_Line_Attributes 
  445.      (Data       : access Gtk_Plot_Data_Record; 
  446.       Style      : Plot_Line_Style; 
  447.       Cap_Style  : Gdk.GC.Gdk_Cap_Style; 
  448.       Join_Style : Gdk.GC.Gdk_Join_Style; 
  449.       Width      : Gfloat; 
  450.       Color      : Gdk.Color.Gdk_Color); 
  451.    --  Set the line style used for the connectors. 
  452.  
  453.    procedure Get_Line_Attributes 
  454.      (Data       : access Gtk_Plot_Data_Record; 
  455.       Style      : out Plot_Line_Style; 
  456.       Cap_Style  : out Gdk.GC.Gdk_Cap_Style; 
  457.       Join_Style : out Gdk.GC.Gdk_Join_Style; 
  458.       Width      : out Gfloat; 
  459.       Color      : out Gdk.Color.Gdk_Color); 
  460.    --  Return the line attributes used for the connectors. 
  461.  
  462.    procedure Set_X_Attributes 
  463.      (Data       : access Gtk_Plot_Data_Record; 
  464.       Style      : Plot_Line_Style; 
  465.       Cap_Style  : Gdk.GC.Gdk_Cap_Style; 
  466.       Join_Style : Gdk.GC.Gdk_Join_Style; 
  467.       Width      : Gfloat; 
  468.       Color      : Gdk.Color.Gdk_Color); 
  469.    --  Set the style of the lines used to connect the symbols to the X axis. 
  470.  
  471.    procedure Set_Y_Attributes 
  472.      (Data       : access Gtk_Plot_Data_Record; 
  473.       Style      : Plot_Line_Style; 
  474.       Cap_Style  : Gdk.GC.Gdk_Cap_Style; 
  475.       Join_Style : Gdk.GC.Gdk_Join_Style; 
  476.       Width      : Gfloat; 
  477.       Color      : Gdk.Color.Gdk_Color); 
  478.    --  Set the style of the lines used to connect the symbols to the Y axis. 
  479.  
  480.    procedure Set_Z_Attributes 
  481.      (Data       : access Gtk_Plot_Data_Record; 
  482.       Style      : Plot_Line_Style; 
  483.       Cap_Style  : Gdk.GC.Gdk_Cap_Style; 
  484.       Join_Style : Gdk.GC.Gdk_Join_Style; 
  485.       Width      : Gfloat; 
  486.       Color      : Gdk.Color.Gdk_Color); 
  487.    --  Set the style of the lines used to connect the symbols to the Z axis. 
  488.  
  489.    procedure Show_Xerrbars (Data : access Gtk_Plot_Data_Record); 
  490.    procedure Show_Yerrbars (Data : access Gtk_Plot_Data_Record); 
  491.    procedure Show_Zerrbars (Data : access Gtk_Plot_Data_Record); 
  492.    --  Indicate that each symbol should be connected to the various axis 
  493.  
  494.    procedure Hide_Xerrbars (Data : access Gtk_Plot_Data_Record); 
  495.    procedure Hide_Yerrbars (Data : access Gtk_Plot_Data_Record); 
  496.    procedure Hide_Zerrbars (Data : access Gtk_Plot_Data_Record); 
  497.    --  Indicate the the symbol should not be connected to the axis. 
  498.  
  499.    procedure Fill_Area (Data : access Gtk_Plot_Data_Record; Fill : Boolean); 
  500.    --  Indicate whether the area between two points should be filled or not. 
  501.  
  502.    function Area_Is_Filled (Data : access Gtk_Plot_Data_Record) 
  503.       return Boolean; 
  504.    --  Indicate whether the area between two points is filled. 
  505.  
  506.    ------------- 
  507.    -- Legends -- 
  508.    ------------- 
  509.    --  In addition to the drawing corresponding to the data set, it is possible 
  510.    --  to display a box that contains a legend. This is particulary useful when 
  511.    --  multiple data sets are displayed on the same plot. 
  512.  
  513.    procedure Set_Legend (Data : access Gtk_Plot_Data_Record; Legend : String); 
  514.    --  Set the string printed in the legend for that data set. 
  515.    --  Note that an entry can exist in the legend even if there is no name 
  516.    --  associated with the graph. 
  517.  
  518.    procedure Show_Legend (Data : access Gtk_Plot_Data_Record); 
  519.    --  An entry will be made in the plot's legend for that dataset. 
  520.  
  521.    procedure Hide_Legend (Data : access Gtk_Plot_Data_Record); 
  522.    --  No entry will appear in the plot's legend for that dataset. 
  523.  
  524.    procedure Set_Legend_Precision 
  525.      (Data : access Gtk_Plot_Data_Record; Precision : Gint); 
  526.    --  Number of digits to display when the legends is associated with values, 
  527.    --  as is the case for gradients. 
  528.  
  529.    function Get_Legend_Precision (Data : access Gtk_Plot_Data_Record) 
  530.       return Gint; 
  531.    --  Return the number of digits used for values in the legend 
  532.  
  533.    --------------- 
  534.    -- Gradients -- 
  535.    --------------- 
  536.    --  The symbols displayed in the plot can be assigned specific colors. But 
  537.    --  they can also compute their own color by picking it in a gradient, 
  538.    --  depending on the value. 
  539.  
  540.    --  See function Gtk.Plot.Gradient 
  541.  
  542.    procedure Move_Gradient 
  543.      (Data : access Gtk_Plot_Data_Record; X, Y : Gdouble); 
  544.  
  545.    procedure Set_Gradient_Size 
  546.      (Data : access Gtk_Plot_Data_Record; Size : Gint); 
  547.  
  548.    procedure Reset_Gradient (Data : access Gtk_Plot_Data_Record); 
  549.    --  Reset the gradient to its default value 
  550.  
  551.    procedure Reset_Gradient_Colors (Data : access Gtk_Plot_Data_Record); 
  552.    --  Reset the colors of the gradient to their default values 
  553.  
  554.    procedure Gradient_Use_Custom_Colors 
  555.      (Data : access Gtk_Plot_Data_Record; Custom : Boolean); 
  556.    function Gradient_Custom_Colors 
  557.      (Data : access Gtk_Plot_Data_Record) return Boolean; 
  558.    --  Whether the gradient uses custom colors 
  559.  
  560.    procedure Set_Gradient_Mask 
  561.      (Data : access Gtk_Plot_Data_Record; Mask : Plot_Gradient); 
  562.    function Get_Gradient_Mask 
  563.      (Data : access Gtk_Plot_Data_Record) return Plot_Gradient; 
  564.    --  Set or Get how the component of the colors vary along the gradient. 
  565.  
  566.    procedure Gradient_Set_Visible 
  567.      (Data : access Gtk_Plot_Data_Record; Visible : Boolean); 
  568.    function Gradient_Visible 
  569.      (Data : access Gtk_Plot_Data_Record) return Boolean; 
  570.    --  Set or get whether the gradient is currently visible (this looks like a 
  571.    --  legend for the plot) 
  572.  
  573.    procedure Gradient_Autoscale_A (Data : access Gtk_Plot_Data_Record); 
  574.    procedure Gradient_Autoscale_Da (Data : access Gtk_Plot_Data_Record); 
  575.    procedure Gradient_Autoscale_Z (Data : access Gtk_Plot_Data_Record); 
  576.    --  ??? 
  577.  
  578.    procedure Set_Gradient_Colors 
  579.      (Data     : access Gtk_Plot_Data_Record; 
  580.       Min, Max : Gdk.Color.Gdk_Color); 
  581.    procedure Get_Gradient_Colors 
  582.      (Data     : access Gtk_Plot_Data_Record; 
  583.       Min, Max : out Gdk.Color.Gdk_Color); 
  584.    --  Set or Get the colors that define the gradient. The colors will vary 
  585.    --  from Min to Max along the components specified in Set_Gradient_Mask. 
  586.  
  587.    procedure Set_Gradient_Nth_Color 
  588.      (Data  : access Gtk_Plot_Data_Record; 
  589.       Level : Guint; 
  590.       Color : Gdk.Color.Gdk_Color); 
  591.    function Get_Gradient_Nth_Color 
  592.      (Data  : access Gtk_Plot_Data_Record; Level : Guint) 
  593.       return Gdk.Color.Gdk_Color; 
  594.    --  Set or Get the nth color in the gradient 
  595.  
  596.    procedure Set_Gradient_Outer_Colors 
  597.      (Data     : access Gtk_Plot_Data_Record; 
  598.       Min, Max : Gdk.Color.Gdk_Color); 
  599.    procedure Get_Gradient_Outer_Colors 
  600.      (Data     : access Gtk_Plot_Data_Record; 
  601.       Min, Max : out Gdk.Color.Gdk_Color); 
  602.    --  Set the outer colors for the gradient 
  603.  
  604.    procedure Set_Gradient 
  605.      (Data       : access Gtk_Plot_Data_Record; 
  606.       Min, Max   : Gdouble; 
  607.       Nlevels    : Gint; 
  608.       Nsublevels : Gint); 
  609.    procedure Get_Gradient 
  610.      (Data       : access Gtk_Plot_Data_Record; 
  611.       Min, Max   : out Gdouble; 
  612.       Nlevels    : out Gint; 
  613.       Nsublevels : out Gint); 
  614.    --  Define the values associated with the minimal color and the maximal 
  615.    --  color. Any value in between will have a color computed in between. 
  616.    --  Nlevels is the number of ticks to display in the gradient. 
  617.  
  618.    procedure Get_Gradient_Level 
  619.      (Data  : access Gtk_Plot_Data_Record; 
  620.       Level : Gdouble; 
  621.       Color : out Gdk.Color.Gdk_Color); 
  622.    --  Return the color associated with a specific level. 
  623.    --  The color depends on the parameters to Set_Gradient and 
  624.    --  Set_Gradient_Colors. 
  625.  
  626.    procedure Gradient_Set_Style 
  627.      (Data      : access Gtk_Plot_Data_Record; 
  628.       Style     : Plot_Label_Style; 
  629.       Precision : Gint); 
  630.    --  ??? 
  631.  
  632.    procedure Gradient_Set_Scale 
  633.      (Data      : access Gtk_Plot_Data_Record; 
  634.       Scale     : Plot_Scale); 
  635.    --  Set the scale of the gradient 
  636.  
  637.    ------------- 
  638.    -- Markers -- 
  639.    ------------- 
  640.  
  641.    function Add_Marker 
  642.      (Data : access Gtk_Plot_Data_Record; Point : Guint) 
  643.       return Gtk_Plot_Marker; 
  644.    --  Add a new marker 
  645.  
  646.    procedure Remove_Marker 
  647.      (Data : access Gtk_Plot_Data_Record; Marker : Gtk_Plot_Marker); 
  648.    --  Remove a marker from the plot 
  649.  
  650.    procedure Remove_Markers (Data : access Gtk_Plot_Data_Record); 
  651.    --  Remove all markers 
  652.  
  653.    procedure Show_Markers (Data : access Gtk_Plot_Data_Record; Show : Boolean); 
  654.    --  Whether markers should be shown 
  655.  
  656.    function Markers_Visible 
  657.      (Data : access Gtk_Plot_Data_Record) return Boolean; 
  658.    --  Whether markers are currently visible 
  659.  
  660.    --------------- 
  661.    -- User Data -- 
  662.    --------------- 
  663.    --  It is possible to associated your own user data with a plot. This is 
  664.    --  the mechanism provided by the C version of gtkextra. However, the best 
  665.    --  way to do this in Ada is to inherit from Gtk_Plot_Data_Record (or one 
  666.    --  of its children), and add your own fields. 
  667.  
  668.    procedure Set_Link 
  669.      (Data : access Gtk_Plot_Data_Record; 
  670.       Link : System.Address); 
  671.    --  Associate some user data with Data. 
  672.    --  It is the responsability of the user to do some convert conversion to 
  673.    --  System.Address. 
  674.  
  675.    function Get_Link (Data : access Gtk_Plot_Data_Record) 
  676.       return System.Address; 
  677.    --  Return the user data associated with Data, or Null_Address if there is 
  678.    --  none. 
  679.  
  680.    procedure Remove_Link (Data : access Gtk_Plot_Data_Record); 
  681.    --  Remove the user data associated with Data. 
  682.  
  683.    --  <doc_ignore> 
  684.    function To_Double_Array is new Unchecked_Conversion 
  685.      (System.Address, No_Range_Gdouble_Array_Access); 
  686.    --  </doc_ignore> 
  687.  
  688. private 
  689.    type Gtk_Plot_Data_Record is new Gtk.Widget.Gtk_Widget_Record with 
  690.      null record; 
  691.  
  692.    Gradient_H : constant Plot_Gradient := 1; 
  693.    Gradient_V : constant Plot_Gradient := 2; 
  694.    Gradient_S : constant Plot_Gradient := 4; 
  695.  
  696.    for Plot_Angle use 
  697.      (Angle_0   => 0, 
  698.       Angle_90  => 90, 
  699.       Angle_180 => 180, 
  700.       Angle_270 => 270); 
  701.  
  702.    pragma Import (C, Get_Type, "gtk_plot_data_get_type"); 
  703. end Gtk.Extra.Plot_Data; 
  704.  
  705. --  Unbound: 
  706. --    gtk_plot_data_new_iterator 
  707. --    gtk_plot_data_clone 
  708. --    gtk_plot_data_get_gradient_outer_colors 
  709. --    gtk_plot_data_add_dimension 
  710. --    gtk_plot_data_remove_dimension 
  711. --    gtk_plot_data_find_dimension 
  712. --    gtk_plot_data_required_dimensions 
  713. --    gtk_plot_data_independent_dimensions 
  714. --    gtk_plot_data_dimension_set_array 
  715. --    gtk_plot_data_dimension_get_array 
  716. --    gtk_plot_data_get_point 
  717. --    gtk_plot_get_gradient_allocation 
  718. --  These subprograms appear in gtkplotdata.h, but not in gtkplotdata.c 
  719. --    gtk_plot_data_dimension_set_scale 
  720. --    gtk_plot_data_dimension_get_scale