A.13. Gamma Curve

function create_gamma_curve ()
{
  local	count = 0, curve, table, vbox, toggle_button1, base_curve,
  max, i, vec;
  
  win_gamma_curve = new (GtkWindow);
  win_gamma_curve.signal ("destroy", #win_gamma_curve = nil);
  win_gamma_curve.title = "test";
  win_gamma_curve.border_width = 10;
  win_gamma_curve.set_default_size(179, 154);
  
  curve = new(GtkGammaCurve);
  win_gamma_curve.add(curve);
  curve.show();
  
  table = car(curve.children());
  vbox = car(table.children());
  toggle_button1 = car(vbox.children());
  base_curve = cadr(table.children());
  
  max = 127 + (count / 2) * 128;
  base_curve.set_range(0, max, 0, max);
  
/*  Note: The GtkCurve.set_vector() method is not yet mapped in Gamma.
    The following code assigns and make a test print of vec, a vector
    array.  The last line of code would assign the vector to base_curve.
    
    vec = array();
    for (i = 0; i < max; ++i)
    {
    vec[i] = (127 / sqrt (max)) * sqrt (i);
    princ(vec[i],"\n");
    }
    base_curve.set_vector(max, vec);
    
    */

  win_gamma_curve.show_all();
  win_gamma_curve;

}

function main ()
{
  local window, win_gamma_curve;
  TRUE=1;
  FALSE=0;
  window = create_gamma_curve ();
  window.signal ("destroy", #exit_program(0));
  init_ipc("gamma_curve", "gamma_curveq");
  gtk_main ();
}