home *** CD-ROM | disk | FTP | other *** search
/ Graphics Plus / Graphics Plus.iso / general / fractal / kaos.lha / intlib / create_int_windows.c next >
Encoding:
C/C++ Source or Header  |  1990-01-21  |  6.5 KB  |  209 lines

  1. /*
  2. ### create integration windows ###
  3. */
  4.  
  5. #include <suntool/sunview.h>
  6. #include <suntool/canvas.h>
  7. #include <suntool/panel.h>
  8.  
  9. void create_int_windows()
  10. {
  11.     void int_quit_proc(),int_driver_proc(),int_option_proc(),int_algorithm_proc();
  12.     int i,ipanel_row=0;
  13.     extern Frame frame,int_frame;
  14.     extern Panel int_panel;
  15.     extern Pixfont *boldfont;
  16.     extern Panel_item int_quit_item,int_driver_item,int_algorithm_item,int_option_item,int_start_item,int_end_item,int_period_item;
  17.     extern Panel_item int_eps_item,int_guessed_step_item,int_min_step_item,int_max_nstep_item,int_nstep_item, *int_yscal_item;
  18.  
  19.     extern short int_panel_show;
  20.     extern int panel_colormap_on;
  21.     extern int model,draw_all;
  22.     extern int var_dim,param_dim,func_dim;
  23.     extern int int_driver,int_algorithm,int_option,int_nstep,int_max_nstep;
  24.     extern double int_start,int_end,int_period,int_eps,int_guessed_step,int_min_step,*int_yscal;
  25.     extern char string[],lstring[],int_frame_label[],**var_label,**func_label;
  26.     
  27.     /* Turn on the flag */    
  28.     if(int_panel_show){
  29.         window_set(int_frame,WIN_SHOW,TRUE,0);    
  30.         return;
  31.     }
  32.     else
  33.         int_panel_show = 1;
  34.  
  35.     /* Create aux frame */
  36.     int_frame = window_create(frame,FRAME,
  37.         FRAME_NO_CONFIRM,       TRUE,
  38.         FRAME_LABEL,    int_frame_label,
  39.         FRAME_SHOW_LABEL,       TRUE,
  40.         WIN_SHOW,       TRUE,
  41.         WIN_X,  400,
  42.         WIN_Y,  0,
  43.         WIN_FONT, boldfont,
  44.         0);
  45.     if(int_frame == NULL) {
  46.         system_mess_proc(1,"No more windows. Clean up some windows to make room.");
  47.         int_panel_show = 0;
  48.         return;
  49.     }
  50.     /* Create Panel */
  51.     int_panel = window_create(int_frame, PANEL,
  52.         WIN_X, 0,
  53.         WIN_Y, 0,
  54.         WIN_FONT, boldfont,
  55.         0);
  56.     if(int_panel == NULL) {
  57.         system_mess_proc(1,"No more windows. Clean up some windows to make room.");
  58.         (void) destroy_int_windows();
  59.         return;
  60.     }
  61.     /* Create panel items */
  62.     int_quit_item= panel_create_item(int_panel, PANEL_BUTTON,
  63.         PANEL_LABEL_Y, ATTR_ROW(ipanel_row++),
  64.         PANEL_LABEL_X, ATTR_COL(0),
  65.         PANEL_LABEL_IMAGE, panel_button_image(int_panel, "Quit", 4, boldfont),
  66.         PANEL_NOTIFY_PROC, int_quit_proc,
  67.         0);
  68.     int_driver_item= panel_create_item(int_panel, PANEL_CYCLE,
  69.         PANEL_LABEL_Y, ATTR_ROW(ipanel_row++),
  70.         PANEL_LABEL_X, ATTR_COL(0),
  71.         PANEL_DISPLAY_LEVEL, PANEL_CURRENT,
  72.         PANEL_LABEL_STRING, "Driver: ",
  73.         PANEL_CHOICE_STRINGS, "Standard","Time","Quality-Controlled",0,
  74.         PANEL_VALUE, int_driver,
  75.         PANEL_NOTIFY_PROC, int_driver_proc,
  76.         0);
  77.     if(int_driver == 0 || int_driver == 1){
  78.         int_algorithm_item= panel_create_item(int_panel, PANEL_CYCLE,
  79.             PANEL_LABEL_Y, ATTR_ROW(ipanel_row++),
  80.             PANEL_LABEL_X, ATTR_COL(0),
  81.             PANEL_DISPLAY_LEVEL, PANEL_CURRENT,
  82.             PANEL_LABEL_STRING, "Algorithm:",
  83.             PANEL_CHOICE_STRINGS,    "Euler",
  84.                         "Runge-Kutta (4)",
  85.                         "Symplectic-Ruth (1)",
  86.                         "Symplectic-Reversible Ruth (2)",
  87.                         "Symplectic-Centered Euler (2)",
  88.                         "Symplectic-Forest-Berz (4)",
  89.                         "User",
  90.                         0,            
  91.             PANEL_VALUE, int_algorithm,
  92.             PANEL_NOTIFY_PROC, int_algorithm_proc,
  93.             0);
  94.     }
  95.     else if(int_driver == 2){
  96.         int_algorithm_item= panel_create_item(int_panel, PANEL_CYCLE,
  97.             PANEL_LABEL_Y, ATTR_ROW(ipanel_row++),
  98.             PANEL_LABEL_X, ATTR_COL(0),
  99.             PANEL_DISPLAY_LEVEL, PANEL_CURRENT,
  100.             PANEL_LABEL_STRING, "Algorithm:",
  101.             PANEL_CHOICE_STRINGS, "Runge-Kutta QC (5)","Bulirsch-Stoer QC",0,
  102.             PANEL_VALUE, int_algorithm,
  103.             PANEL_NOTIFY_PROC, int_algorithm_proc,
  104.             0);
  105.     }
  106.     if(int_driver == 2 && int_algorithm == 1){
  107.         int_option_item= panel_create_item(int_panel, PANEL_CYCLE,
  108.             PANEL_LABEL_Y, ATTR_ROW(ipanel_row++),
  109.             PANEL_LABEL_X, ATTR_COL(0),
  110.             PANEL_DISPLAY_LEVEL, PANEL_CURRENT,
  111.             PANEL_LABEL_STRING, "Option: ",
  112.             PANEL_CHOICE_STRINGS, "Show True Orbits Only","Show Intermediate Orbits",0,
  113.             PANEL_VALUE, int_option,
  114.             PANEL_NOTIFY_PROC, int_option_proc,
  115.             0);
  116.     }
  117.  
  118.     if(int_driver == 1 || int_driver == 2 ){
  119.         sprintf(string, "%lg", int_start);
  120.         int_start_item = panel_create_item(int_panel, PANEL_TEXT,
  121.             PANEL_LABEL_Y, ATTR_ROW(ipanel_row++),
  122.             PANEL_LABEL_X, ATTR_COL(0),
  123.             PANEL_VALUE, string,
  124.             PANEL_VALUE_DISPLAY_LENGTH, 20,
  125.             PANEL_LABEL_STRING,"t Start:",
  126.             0);
  127.         sprintf(string, "%lg", int_end);
  128.         int_end_item = panel_create_item(int_panel, PANEL_TEXT,
  129.             PANEL_LABEL_Y, ATTR_ROW(ipanel_row++),
  130.             PANEL_LABEL_X, ATTR_COL(0),
  131.             PANEL_VALUE, string,
  132.             PANEL_VALUE_DISPLAY_LENGTH, 20,
  133.             PANEL_LABEL_STRING,"t End:",
  134.             0);
  135.         if(!draw_all){
  136.             sprintf(string, "%lg", int_period);
  137.             int_period_item = panel_create_item(int_panel, PANEL_TEXT,
  138.                 PANEL_LABEL_Y, ATTR_ROW(ipanel_row++),
  139.                 PANEL_LABEL_X, ATTR_COL(0),
  140.                 PANEL_VALUE, string,
  141.                 PANEL_VALUE_DISPLAY_LENGTH, 20,
  142.                 PANEL_LABEL_STRING,"t Period:",
  143.                 0);
  144.         }
  145.         if(int_driver ==1) {
  146.             sprintf(string, "%d", int_nstep);
  147.             int_nstep_item = panel_create_item(int_panel, PANEL_TEXT,
  148.                 PANEL_LABEL_Y, ATTR_ROW(ipanel_row++),
  149.                 PANEL_LABEL_X, ATTR_COL(0),
  150.                 PANEL_VALUE, string,
  151.                 PANEL_VALUE_DISPLAY_LENGTH, 20,
  152.                 PANEL_LABEL_STRING,"# Step:",
  153.                 0);
  154.         }
  155.         else {
  156.             sprintf(string, "%lg", int_eps);
  157.             int_eps_item = panel_create_item(int_panel, PANEL_TEXT,
  158.                 PANEL_LABEL_Y, ATTR_ROW(ipanel_row++),
  159.                 PANEL_LABEL_X, ATTR_COL(0),
  160.                 PANEL_VALUE, string,
  161.                 PANEL_VALUE_DISPLAY_LENGTH, 20,
  162.                 PANEL_LABEL_STRING,"Tolerated Error:",
  163.                 0);
  164.             sprintf(string, "%lg", int_guessed_step);
  165.             int_guessed_step_item = panel_create_item(int_panel, PANEL_TEXT,
  166.                 PANEL_LABEL_Y, ATTR_ROW(ipanel_row++),
  167.                 PANEL_LABEL_X, ATTR_COL(0),
  168.                 PANEL_VALUE, string,
  169.                 PANEL_VALUE_DISPLAY_LENGTH, 20,
  170.                 PANEL_LABEL_STRING,"Guessed dt:",
  171.                 0);
  172.             sprintf(string, "%lg", int_min_step);
  173.             int_min_step_item = panel_create_item(int_panel, PANEL_TEXT,
  174.                 PANEL_LABEL_Y, ATTR_ROW(ipanel_row++),
  175.                 PANEL_LABEL_X, ATTR_COL(0),
  176.                 PANEL_VALUE, string,
  177.                 PANEL_VALUE_DISPLAY_LENGTH, 20,
  178.                 PANEL_LABEL_STRING,"Min Allowed dt:",
  179.                 0);
  180.             sprintf(string, "%d", int_max_nstep);
  181.             int_max_nstep_item = panel_create_item(int_panel, PANEL_TEXT,
  182.                 PANEL_LABEL_Y, ATTR_ROW(ipanel_row++),
  183.                 PANEL_LABEL_X, ATTR_COL(0),
  184.                 PANEL_VALUE, string,
  185.                 PANEL_VALUE_DISPLAY_LENGTH, 20,
  186.                 PANEL_LABEL_STRING,"# Max Step:",
  187.                 0);
  188.             for(i=0;i<var_dim;i++){
  189.                 sprintf(string, "%lg", int_yscal[i]);
  190.                 sprintf(lstring,"Scale Factor-%s:",var_label[i]);
  191.                 int_yscal_item[i] = panel_create_item(int_panel, PANEL_TEXT,
  192.                     PANEL_LABEL_Y, ATTR_ROW(ipanel_row++),
  193.                     PANEL_LABEL_X, ATTR_COL(0),
  194.                     PANEL_VALUE, string,
  195.                     PANEL_VALUE_DISPLAY_LENGTH, 20,
  196.                     PANEL_LABEL_STRING,lstring,
  197.                     0);
  198.             }
  199.         }
  200.     }
  201.  
  202.     window_fit(int_panel);
  203.     window_fit(int_frame);
  204.  
  205.     if(panel_colormap_on)
  206.         init_panel_colormap((Pixwin *) window_get(int_panel,WIN_PIXWIN),"int_panel_cms");
  207. }
  208.  
  209.