home *** CD-ROM | disk | FTP | other *** search
/ Graphics Plus / Graphics Plus.iso / general / fractal / kaos.lha / querylib / create_query_windows.c next >
Encoding:
C/C++ Source or Header  |  1989-12-07  |  3.2 KB  |  118 lines

  1. /*
  2. ### create a help window ###
  3. */
  4.  
  5. #define QUERY_LIST \
  6. "Equation",
  7. "System Parameters",
  8. "Special Orbits",
  9. "Special Orbits,Eigenvalues,Eigenvectors",
  10. "Manifolds",
  11. "Time Series",
  12. "Fourier Amplitudes",
  13. "Lyapunov Exponents",
  14. "Dimension Fit",
  15. "Scan-List"
  16.  
  17. #include <suntool/sunview.h>
  18. #include <suntool/textsw.h>
  19. #include <suntool/panel.h>
  20.  
  21. void create_query_windows()
  22. {
  23.     void query_quit_proc(),query_option_proc();
  24.     int i,ipanel_row=0,px,py;
  25.     extern Frame frame,query_frame;
  26.     extern Panel query_panel;
  27.     extern Textsw query_textsw;
  28.     extern Textsw_status query_status; 
  29.     extern Pixfont *boldfont;
  30.     extern Panel_item query_quit_item,query_option_item;
  31.     extern short query_panel_show;
  32.     extern int panel_colormap_on;
  33.     extern int query_option;
  34.     extern char string[],query_dir[];
  35.     
  36.     /* Turn on the flag */    
  37.     if(query_panel_show){
  38.         window_set(query_frame,WIN_SHOW,TRUE,0);    
  39.         return;
  40.     }
  41.     else
  42.         query_panel_show = 1;
  43.  
  44.     px = (int) window_get(frame,WIN_X) + (int) window_get(frame,WIN_WIDTH)/2;
  45.     py = (int) window_get(frame,WIN_Y) + (int) window_get(frame,WIN_HEIGHT) /2;
  46.     /* Create help frame */
  47.     query_frame = window_create(frame,FRAME,
  48.         FRAME_NO_CONFIRM,       TRUE,
  49.         FRAME_LABEL,    "help",
  50.         FRAME_SHOW_LABEL,       TRUE,
  51.         WIN_SHOW,       TRUE,
  52.         WIN_X,  px,
  53.         WIN_Y,  py,
  54.         WIN_HEIGHT, 400,
  55.         WIN_WIDTH, 650,
  56.         WIN_FONT, boldfont,
  57.         0);
  58.     if(query_frame == NULL) {
  59.         system_mess_proc(1,"No more windows. Clean up some windows to make room.");
  60.         query_panel_show = 0;
  61.         return;
  62.     }
  63.     /* Create Panel */
  64.     query_panel = window_create(query_frame, PANEL,
  65.         WIN_X, 0,
  66.         WIN_Y, 0,
  67.         WIN_FONT, boldfont,
  68.         0);
  69.     if(query_panel == NULL) {
  70.         system_mess_proc(1,"No more windows. Clean up some windows to make room.");
  71.         (void) destroy_query_windows();
  72.         return;
  73.     }
  74.     /* Create panel items */
  75.     query_quit_item= panel_create_item(query_panel, PANEL_BUTTON,
  76.         PANEL_LABEL_Y, ATTR_ROW(ipanel_row++),
  77.         PANEL_LABEL_X, ATTR_COL(0),
  78.         PANEL_LABEL_IMAGE, panel_button_image(query_panel, "Quit", 4, boldfont),
  79.         PANEL_NOTIFY_PROC, query_quit_proc,
  80.         0);
  81.     query_option_item= panel_create_item(query_panel, PANEL_CYCLE,
  82.         PANEL_LABEL_Y, ATTR_ROW(ipanel_row++),
  83.         PANEL_LABEL_X, ATTR_COL(0),
  84.         PANEL_DISPLAY_LEVEL, PANEL_CURRENT,
  85.         PANEL_LABEL_STRING, "Topic: ",
  86.         PANEL_CHOICE_STRINGS,
  87.             QUERY_LIST,
  88.             0,
  89.         PANEL_VALUE, query_option,
  90.         PANEL_NOTIFY_PROC, query_option_proc,
  91.         0);
  92.  
  93.     window_fit_height(query_panel);
  94.  
  95.     if(panel_colormap_on)
  96.         init_panel_colormap((Pixwin *) window_get(query_panel,WIN_PIXWIN),"query_panel_cms");
  97.  
  98.         sprintf(string,"%s/online_help.0",query_dir);
  99.         query_textsw = window_create(query_frame, TEXTSW,
  100.         0);
  101.     if(query_textsw == NULL) {
  102.         system_mess_proc(1,"No more windows. Clean up some windows to make room.");
  103.         (void) destroy_query_windows();
  104.         return;
  105.     }
  106.     window_set(query_textsw,
  107.                 TEXTSW_STATUS, &query_status,
  108.                 TEXTSW_FILE,string,
  109.                 TEXTSW_FIRST,0,
  110.                 0);
  111.         if(query_status == TEXTSW_STATUS_CANNOT_OPEN_INPUT){
  112.                 sprintf(string,"Help file (%s/%d) does not exist!\n",query_dir,query_option);
  113.                 system_mess_proc(1,string);
  114.         }       
  115.     if(panel_colormap_on)
  116.         init_panel_colormap((Pixwin *) window_get(query_textsw,WIN_PIXWIN),"query_textsw_cms");
  117. }
  118.