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