home *** CD-ROM | disk | FTP | other *** search
/ Graphics Plus / Graphics Plus.iso / general / plotting / imagetoo / imagetl1.lha / Imagetool / src+obj / pathname.c < prev    next >
Encoding:
C/C++ Source or Header  |  1991-03-11  |  3.9 KB  |  141 lines

  1. /* cat > headers/pathname.h << "EOF" */
  2. /* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
  3. /* pathname.h: header for pathname.c file        */
  4. /* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
  5. /* SCCS information: %W%    %G% - NCSA */
  6.  
  7. #define    pathname_h        1
  8.  
  9. #include "all.h"
  10. #include "newext.h"
  11.  
  12. /* EOF */
  13. /* cat > src+obj/pathname/clear_pathnamesw.c << "EOF" */
  14. /* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
  15. /* clear_pathnamesw: no longer display pathname        */
  16. /*             subwindow                */
  17. /* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
  18. /* SCCS information: %W%    %G% - NCSA */
  19.  
  20. /* #include "pathname.h" */
  21.  
  22. void clear_pathnamesw ()
  23. {
  24.     window_set (path_frame, WIN_SHOW, FALSE, 0);
  25. }
  26. /* EOF */
  27.  
  28. /* cat > src+obj/pathname/create_pathnamesw.c << "EOF" */
  29. /* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
  30. /* create_pathnamesw: create pathname subwindow        */
  31. /* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
  32. /* SCCS information: %W%    %G% - NCSA */
  33.  
  34. /* #include "init.h" */
  35.  
  36. create_pathnamesw ()
  37. {
  38.     int x_origin, y_origin;
  39.     int x_offset, y_offset;
  40.  
  41.     if (window_corner (def_box, LEFT, BOTTOM, &x_origin, &y_origin))
  42.     {
  43.         printf ("Internal error: (create_pathnamesw) Can't get dimensions of def_box frame - ImageTool terminated!");
  44.         exit (1);
  45.     }
  46.     x_offset = 50;
  47.     y_offset = 25;
  48.  
  49.     path_frame = window_create (base, FRAME,
  50.                     FRAME_SHOW_LABEL, TRUE,
  51.                     WIN_ERROR_MSG, "Cannot open pathname window.",
  52.                     WIN_X, x_origin + x_offset,
  53.                     WIN_Y, y_origin + y_offset,
  54.                     WIN_COLUMNS, 80,
  55.                     0);
  56.     path_panel = window_create (path_frame, PANEL,
  57.                     WIN_FONT, font_panel,
  58.                     WIN_ROWS, 2,
  59.                     0);
  60.     path_return_but = panel_create_item (path_panel, PANEL_BUTTON,
  61.                          PANEL_LABEL_IMAGE, panel_button_image (path_panel, "return", 6, font_panel_button),
  62.                             PANEL_NOTIFY_PROC, path_return_proc,
  63.                              0);
  64.     path_cancel_but = panel_create_item (path_panel, PANEL_BUTTON,
  65.                          PANEL_LABEL_IMAGE, panel_button_image (path_panel, "cancel", 6, font_panel_button),
  66.                              PANEL_NOTIFY_PROC, path_cancel_proc,
  67.                              0);
  68.     window_fit_height (path_frame);
  69.  
  70.             /* set color map same with imagetool */
  71.     (void) color_path_win ();
  72.  
  73.     return;
  74. }
  75. /* EOF */
  76.  
  77. /* cat > src+obj/pathname/display_pathnamesw.c << "EOF" */
  78. /* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
  79. /* display_pathnamesw: initialize and display path    */
  80. /*               subwindow            */
  81. /* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
  82. /* SCCS information: %W%    %G% - NCSA */
  83.  
  84. /* #include "display.h" */
  85.  
  86. display_pathnamesw (label, return_func)
  87. char * label;
  88.         /* input: reminder string for frame label */
  89. PFUNC return_func;
  90.         /* input: pointer to a user function of the form
  91.               func (returned_dir, returned_filename) */
  92. {
  93.         /* set values in frame */
  94.  
  95.         /* save return function */
  96.     panel_set (path_return_but, PANEL_CLIENT_DATA, return_func, 0);
  97.  
  98.         /* display subwindow */
  99.     window_set (path_frame,
  100.             FRAME_LABEL, label,
  101.             WIN_SHOW, TRUE,
  102.             0);
  103. }
  104. /* EOF */
  105.  
  106. /* cat > src+obj/pathname/path_cancel_proc.c << "EOF" */
  107. /* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
  108. /* path_cancel_proc: make pathname frame invisible    */
  109. /* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
  110. /* SCCS information: %W%    %G% - NCSA */
  111.  
  112. /* #include "pathname.h" */
  113.  
  114. void
  115. path_cancel_proc ()
  116. {
  117.     clear_pathnamesw ();
  118. }
  119. /* EOF */
  120.  
  121. /* cat > src+obj/pathname/path_return_proc.c << "EOF" */
  122. /* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
  123. /* path_return_proc: update requested path information    */
  124. /* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
  125. /* SCCS information: %W%    %G% - NCSA */
  126.  
  127. /* #include "pathname.h" */
  128.  
  129. void
  130. path_return_proc ()
  131. {
  132.     PFUNC func;
  133.  
  134.         /* get function to update requested path information */
  135.     func = (PFUNC) panel_get (path_return_but, PANEL_CLIENT_DATA);
  136.     (void) (*func) ("Test_directory", "Test_file");
  137.     clear_pathnamesw ();
  138. }
  139. /* EOF */
  140.  
  141.