/* Form definition file generated with fdesign. */

#include "forms.h"
#include <stdlib.h>
#include "pieinthesky.h"

void update_pie(int id, void *vptr);
int timeout_id = 0;
void *stupid = NULL;

FD_pieinthesky *create_form_pieinthesky(void)
{
  FL_OBJECT *obj;
  FD_pieinthesky *fdui = (FD_pieinthesky *) fl_calloc(1, sizeof(*fdui));

  fdui->pieinthesky = fl_bgn_form(FL_NO_BOX, 390, 600);
  obj = fl_add_box(FL_UP_BOX,0,0,390,600,"");
  fdui->piechart = obj = fl_add_chart(FL_PIE_CHART,80,40,230,200,"Distribution");
  fdui->item1 = obj = fl_add_valslider(FL_VERT_BROWSER_SLIDER,40,310,40,200,"item1");
    fl_set_object_callback(obj,item1,0);
    fl_set_slider_precision(obj, 0);
    fl_set_slider_bounds(obj, 100, 0);
    fl_set_slider_value(obj, 50);
  fdui->item2 = obj = fl_add_valslider(FL_VERT_BROWSER_SLIDER,110,310,40,200,"item2");
    fl_set_object_callback(obj,item2,0);
    fl_set_slider_precision(obj, 0);
    fl_set_slider_bounds(obj, 100, 0);
    fl_set_slider_value(obj, 50);
  fdui->item3 = obj = fl_add_valslider(FL_VERT_BROWSER_SLIDER,180,310,40,200,"item3");
    fl_set_object_callback(obj,item3,0);
    fl_set_slider_precision(obj, 0);
    fl_set_slider_bounds(obj, 100, 0);
    fl_set_slider_value(obj, 50);
  fdui->item4 = obj = fl_add_valslider(FL_VERT_BROWSER_SLIDER,250,310,40,200,"item4");
    fl_set_object_callback(obj,item4,0);
    fl_set_slider_precision(obj, 0);
    fl_set_slider_bounds(obj, 100, 0);
    fl_set_slider_value(obj, 50);
  fdui->item5 = obj = fl_add_valslider(FL_VERT_BROWSER_SLIDER,320,310,40,200,"item5");
    fl_set_object_callback(obj,item5,0);
    fl_set_slider_precision(obj, 0);
    fl_set_slider_bounds(obj, 100, 0);
    fl_set_slider_value(obj, 50);
    fl_set_slider_step(obj, 1);
    fl_set_slider_increment(obj, 1, 1);
  fdui->quit = obj = fl_add_button(FL_NORMAL_BUTTON,40,550,330,30,"Quit");
    fl_set_object_callback(obj,quit,10);
  fl_end_form();

  fdui->pieinthesky->fdui = fdui;

  return fdui;
}
/*---------------------------------------*/

int main (int argc, char *argv[])
{
  double itemvalue [5];
  FL_OBJECT *pushed;
  FD_pieinthesky *form;
  

  fl_initialize(&argc, argv, "FormDemo", 0, 0);
  form = create_form_pieinthesky();
  //  form->item1->u_vdata = form;
  //  form->item2->u_vdata = form;
  //  form->item3->u_vdata = form;
  //  form->item4->u_vdata = form;
  //  form->item5->u_vdata = form;  
  fl_show_form(form->pieinthesky,FL_PLACE_CENTERFREE,FL_FULLBORDER,"pieinthesky");  
  
  timeout_id = fl_add_timeout(100, update_pie, stupid);

  fl_do_forms ();


  
  /*  while ((pushed = fl_do_forms ()) != form->quit)
    {
      fl_freeze_form (form->pieinthesky);
      if (pushed == form->item1)
	{
	  itemvalue[0] = fl_get_slider_value (pushed);
	}
      else if (pushed == form->item2)
	{
	  itemvalue[1] = fl_get_slider_value (pushed);
	}
      else if (pushed == form -> item3)
	{
	  itemvalue[2] = fl_get_slider_value (pushed);
	}
      else if (pushed == form -> item4) 
	{
	  itemvalue[3] = fl_get_slider_value (pushed);
	}
      else if (pushed == form -> item5)
	{
          itemvalue[4] = fl_get_slider_value (pushed);
	}
      fl_clear_chart (form->piechart);
      fl_add_chart_value (form->piechart, itemvalue[0], "item 1",FL_RED);
      fl_add_chart_value (form->piechart, itemvalue[1], "item 1",FL_GREEN);
      fl_add_chart_value (form->piechart, itemvalue[2], "item 1",FL_YELLOW);
      fl_add_chart_value (form->piechart, itemvalue[3], "item 1",FL_BLUE);
      fl_add_chart_value (form->piechart, itemvalue[4], "item 1",FL_CYAN);
      fl_unfreeze_form (form->pieinthesky);
    }
    fl_hide_form(form->pieinthesky);*/
  return 0;
}


