home *** CD-ROM | disk | FTP | other *** search
- /* cat > headers/init.h << "EOF" */
- /* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
- /* init.h: header for init.c file */
- /* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
- /* SCCS information: %W% %G% - NCSA */
-
- #define init_h 1
-
- #include "all.h"
- #include "icons.h"
- #include "newext.h"
-
- static char *Version="Imagetool 1.1";
-
- static int bghandler();
- static Notify_value main_destroy_interposer();
-
- /* EOF */
- /* cat > src+obj/init/bghandler.c << "EOF" */
- /* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
- /* bghandler: (static) background event handler */
- /* for menu_panel */
- /* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
- /* SCCS information: %W% %G% - NCSA */
-
- /* #include "init.h" */
-
- static
- bghandler (panel, event)
- Panel panel;
- Event *event;
- {
- int ex = event_x (event);
- int ey = event_y (event);
- int x, ix, k, n, nm = 8;
-
- x = 60;
- ix = 100;
- k = 30;
- if (ex < x)
- n = 1;
- else if (ex > x + (nm - 1) * ix)
- n = nm;
- else
- {
- n = (ex - x) / ix + 1;
- if (ex > n * ix + x - k)
- n++;
- }
-
- /* Some of these calls below have BOGUS arguments!!! - MK-C */
-
- switch (n)
- { /* show different menus according to position */
- case 1:
- if (display_panel_menu (Image, event, menu_panel, image_menu))
- load_proc (event, menu_get (image_menu, MENU_NTH_ITEM, 1));
- break;
- case 2:
- if (display_panel_menu (Edit, event, menu_panel, edit_menu))
- edit_proc (event, menu_get (edit_menu, MENU_NTH_ITEM, 1));
- break;
- case 3:
- if (display_panel_menu (Palette, event, menu_panel, pal_menu))
- pal_proc (event, menu_get (pal_menu, MENU_NTH_ITEM, 1));
- break;
- case 4:
- if (display_panel_menu (Zoom, event, menu_panel, zoom_menu))
- zoom_proc (event, menu_get (zoom_menu, MENU_NTH_ITEM, 1));
- break;
- case 5:
- if (display_panel_menu (Graph, event, menu_panel, graph_menu))
- plot_action (event, menu_get (graph_menu, MENU_NTH_ITEM, 1));
- break;
- case 6:
- if (display_panel_menu (Ftp, event, menu_panel, ftp_menu))
- ftp_connect (event, menu_get (ftp_menu, MENU_NTH_ITEM, 1));
- break;
-
- case 7:
- if (display_panel_menu (Help, event, menu_panel, help_menu))
- help_proc (event, (Menu_item) menu_get (help_menu, MENU_NTH_ITEM, 1));
- break;
-
- case 8:
- if (display_panel_menu (Option, event, menu_panel, option_menu))
- set_defaults (); /* menu item 1 - call set_defaults () */
- /* set_defaults (event, menu_get (option_menu, MENU_NTH_ITEM, 1)); */
- break;
- default:
- break;
- }
- }
- /* EOF */
- /* cat > src+obj/init/create_base.c << "EOF" */
- /* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
- /* create_base: create base frame */
- /* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
- /* SCCS information: %W% %G% - NCSA */
-
- /* #include "init.h" */
-
- create_base (argc, argv)
- int argc;
- char *argv[];
-
- {
- base = window_create (NULL, FRAME,
- FRAME_ICON, &frame_icon,
- WIN_WIDTH, 900,
- WIN_HEIGHT, 895,
- WIN_X, 0,
- WIN_Y, 0,
- FRAME_ARGS, argc, argv,
- WIN_ERROR_MSG, "Can't open window.",
- 0);
- set_frame_label (base);
- (void) notify_interpose_destroy_func (base, main_destroy_interposer);
- }
- /* EOF */
- /* cat > src+obj/init/create_canvas.c << "EOF" */
- /* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
- /* create_canvas: create canvas */
- /* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
- /* SCCS information: %W% %G% - NCSA */
-
- /* #include "init.h" */
-
- create_canvas ()
- {
- canvas = window_create (base, CANVAS,
- CANVAS_AUTO_SHRINK, FALSE,
- CANVAS_FIXED_IMAGE, FALSE,
- CANVAS_RETAINED, TRUE,
- CANVAS_WIDTH, 1150,
- CANVAS_HEIGHT, 900,
- WIN_BELOW, menu_panel,
- WIN_X, 0,
- WIN_VERTICAL_SCROLLBAR, scrollbar_create (0),
- WIN_HORIZONTAL_SCROLLBAR, scrollbar_create (0),
- WIN_EVENT_PROC, can_controller,
- 0);
- window_set (canvas,
- WIN_CONSUME_PICK_EVENTS, LOC_DRAG, 0,
- 0);
- pw = canvas_pixwin (canvas);
- }
- /* EOF */
- /* cat > src+obj/init/create_menus.c << "EOF" */
- /* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
- /* create_menus: create menus */
- /* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
- /* SCCS information: %W% %G% - NCSA */
-
- /* #include "init.h" */
-
- create_menus ()
- {
- create_image_menu ();
- create_pal_menu ();
- create_edit_menu ();
- create_zoom_menu ();
- create_graph_menu ();
- create_ftp_menu ();
- create_help_menu ();
- create_opt_menu ();
- }
- /* EOF */
- /* cat > src+obj/init/create_msgsw.c << "EOF" */
- /* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
- /* create_msgsw: create message text subwindow */
- /* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
- /* SCCS information: %W% %G% - NCSA */
-
- /* #include "init.h" */
-
- void
- create_msgsw ()
- {
- msgsw = window_create (base, TEXTSW,
- WIN_BELOW, panel,
- /* WIN_FONT, font_panel, */
- /* doesn't work even though the documentation says it should! */
- TEXTSW_READ_ONLY, TRUE,
- TEXTSW_LINE_BREAK_ACTION, TEXTSW_WRAP_AT_CHAR,
- WIN_ROWS, 3,
- WIN_X, 0,
- 0);
- return;
- }
- /* EOF */
- /* cat > src+obj/init/create_panel.c << "EOF" */
- /* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
- /* create_panel: create non_menu panel */
- /* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
- /* SCCS information: %W% %G% - NCSA */
-
- /* #include "init.h" */
-
- create_panel ()
- {
- int x, y, ix, iy;
-
- /* first major panel */
-
- panel = window_create (base, PANEL,
- WIN_BELOW, ttysw,
- WIN_HEIGHT, 130,
- WIN_X, 0,
- WIN_FONT, font_panel,
- 0);
- x = 50;
- ix = 75;
- y = 15;
-
- /* major buttons - always visible */
-
- panel_create_item (panel, PANEL_BUTTON,
- PANEL_ITEM_X, x,
- PANEL_ITEM_Y, y,
- PANEL_LABEL_IMAGE, panel_button_image (panel, "Clear", 6, font_panel_button),
- PANEL_NOTIFY_PROC, clear,
- 0);
- panel_create_item (panel, PANEL_BUTTON,
- PANEL_ITEM_X, x + ix,
- PANEL_ITEM_Y, y,
- PANEL_LABEL_IMAGE, panel_button_image (panel, "Cancel", 6, font_panel_button),
- PANEL_NOTIFY_PROC, cancel,
- 0);
- panel_create_item (panel, PANEL_BUTTON,
- PANEL_ITEM_X, x + 2 * ix,
- PANEL_ITEM_Y, y,
- PANEL_LABEL_IMAGE, panel_button_image (panel, "Quit", 6, font_panel_button),
- PANEL_NOTIFY_PROC, quit,
- 0);
-
- /* buttons for animation - visible only for animation */
-
- (void) create_animation_panel ();
-
- /* panel and menu objects for stacking */
-
- (void) create_stack_panel ();
-
- /* text item to enter user's input data */
-
- x += 4 * ix;
- y = 5;
- iy = 20;
-
- dir_board = panel_create_item (panel, PANEL_TEXT,
- PANEL_ITEM_X, x,
- PANEL_ITEM_Y, y,
- PANEL_LABEL_STRING, "Directory:",
- PANEL_VALUE_STORED_LENGTH, MAXNAMELEN - 1,
- PANEL_VALUE_DISPLAY_LENGTH, 40,
- PANEL_VALUE, current_dir,
- PANEL_LABEL_BOLD, TRUE,
- PANEL_MENU_TITLE_STRING, "Directory item",
- PANEL_MENU_CHOICE_STRINGS,
- "^N - Get directory name",
- "^C - Change directory",
- 0,
- PANEL_MENU_CHOICE_FONTS,
- font_menu,
- font_menu,
- 0,
- PANEL_MENU_CHOICE_VALUES,
- CTRL_N,
- CTRL_C,
- 0,
- PANEL_SHOW_MENU, TRUE,
- PANEL_NOTIFY_LEVEL, PANEL_ALL,
- PANEL_NOTIFY_PROC, dir_board_proc,
- 0);
- image_board = panel_create_item (panel, PANEL_TEXT,
- PANEL_ITEM_X, x,
- PANEL_ITEM_Y, y + iy,
- PANEL_VALUE_STORED_LENGTH, MAXNAMELEN - 1,
- PANEL_VALUE_DISPLAY_LENGTH, 40,
- PANEL_LABEL_STRING, "Image:",
- PANEL_LABEL_BOLD, TRUE,
- PANEL_MENU_TITLE_STRING, "Filename item",
- PANEL_MENU_CHOICE_STRINGS,
- "^N - Get file name",
- "^L - Load image from file",
- "^A - Animate from files",
- "^C - Clear canvas",
- 0,
- PANEL_MENU_CHOICE_FONTS,
- font_menu,
- font_menu,
- font_menu,
- font_menu,
- 0,
- PANEL_MENU_CHOICE_VALUES,
- CTRL_N,
- CTRL_L,
- CTRL_A,
- CTRL_C,
- 0,
- PANEL_SHOW_MENU, TRUE,
- PANEL_NOTIFY_LEVEL, PANEL_ALL,
- PANEL_NOTIFY_PROC, image_board_proc,
- 0);
- load_toggle = panel_create_item (panel, PANEL_CYCLE,
- PANEL_ITEM_X, x + 100,
- PANEL_ITEM_Y, y + 2 * iy,
- PANEL_LABEL_STRING, "Loading?:",
- PANEL_LABEL_BOLD, TRUE,
- PANEL_CHOICE_STRINGS,
- "First (whatever) & palette (if any)",
- "First RIS8 image & palette (HDF)",
- "First SDS 2D-data (HDF)",
- "First (whatever) only",
- "First RIS8 image only (HDF)",
- 0,
- PANEL_MENU_CHOICE_FONTS,
- font_menu,
- font_menu,
- font_menu,
- font_menu,
- font_menu,
- font_menu,
- 0,
- PANEL_SHOW_MENU, TRUE,
- 0);
- xdim_item = panel_create_item (panel, PANEL_TEXT,
- PANEL_ITEM_X, x + 100,
- PANEL_ITEM_Y, y + 3 * iy,
- PANEL_VALUE_STORED_LENGTH, 5,
- PANEL_VALUE_DISPLAY_LENGTH, 5,
- PANEL_LABEL_STRING, "Xdim:",
- PANEL_LABEL_BOLD, TRUE,
- PANEL_MENU_CHOICE_STRINGS,
- "X dimension (integer)", 0,
- PANEL_MENU_CHOICE_FONTS,
- font_menu,
- 0,
- PANEL_SHOW_MENU, TRUE,
- 0);
- ydim_item = panel_create_item (panel, PANEL_TEXT,
- PANEL_ITEM_X, x + 250,
- PANEL_ITEM_Y, y + 3 * iy,
- PANEL_VALUE_STORED_LENGTH, 5,
- PANEL_VALUE_DISPLAY_LENGTH, 5,
- PANEL_LABEL_STRING, "Ydim:",
- PANEL_LABEL_BOLD, TRUE,
- PANEL_MENU_CHOICE_STRINGS,
- "Y dimension (integer)",
- 0,
- PANEL_MENU_CHOICE_FONTS,
- font_menu,
- 0,
- PANEL_SHOW_MENU, TRUE,
- 0);
- pal_board = panel_create_item (panel, PANEL_TEXT,
- PANEL_ITEM_X, x,
- PANEL_ITEM_Y, y + 4 * iy,
- PANEL_VALUE_STORED_LENGTH, MAXNAMELEN - 1,
- PANEL_VALUE_DISPLAY_LENGTH, 40,
- PANEL_LABEL_STRING, "Palette:",
- PANEL_LABEL_BOLD, TRUE,
- PANEL_MENU_TITLE_STRING, "Palette item",
- PANEL_MENU_CHOICE_STRINGS,
- "^N - Get file name",
- "^L - Load palette from file",
- "^R - Restore previous palette",
- "^S - Show palette",
- 0,
- PANEL_MENU_CHOICE_FONTS,
- font_menu,
- font_menu,
- font_menu,
- 0,
- PANEL_MENU_CHOICE_VALUES,
- CTRL_N,
- CTRL_L,
- CTRL_R,
- CTRL_S,
- 0,
- PANEL_SHOW_MENU, TRUE,
- PANEL_NOTIFY_LEVEL, PANEL_ALL,
- PANEL_NOTIFY_PROC, pal_board_proc,
- 0);
- SDS_toggle = panel_create_item (panel, PANEL_CYCLE,
- PANEL_ITEM_X, x,
- PANEL_ITEM_Y, y + 5 * iy,
- PANEL_LABEL_STRING, "SDS Scaling:",
- PANEL_LABEL_BOLD, TRUE,
- PANEL_CHOICE_STRINGS,
- "Use popup dialog window",
- "Linear, data max & min",
- "Log, data max & min",
- 0,
- PANEL_MENU_CHOICE_FONTS,
- font_menu,
- font_menu,
- font_menu,
- 0,
- PANEL_SHOW_MENU, TRUE,
- 0);
- }
- /* EOF */
- /* cat > src+obj/init/create_panel_menu.c << "EOF" */
- /* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
- /* create_panel_menu: create panel with menu items */
- /* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
- /* SCCS information: %W% %G% - NCSA */
-
- /* #include "init.h" */
-
- void
- create_panel_menu ()
- {
- int x, y, ix, iy;
-
- /* Menu items */
-
- menu_panel = window_create (base, PANEL,
- WIN_BELOW, msgsw,
- WIN_HEIGHT, 25,
- WIN_X, 0,
- PANEL_BACKGROUND_PROC, bghandler,
- /* allows one to pick a menu when the event
- (click rightmost) is on the background of the panel. */
- WIN_FONT, font_panel,
- 0);
-
- x = 60;
- ix = 100;
- y = 3;
-
- Image = panel_create_item (menu_panel, PANEL_BUTTON,
- PANEL_ITEM_X, x,
- PANEL_ITEM_Y, y,
- PANEL_LABEL_IMAGE, panel_button_image (panel, "Image", 6, font_panel_button),
- PANEL_EVENT_PROC, image_handler,
- 0);
-
- Edit = panel_create_item (menu_panel, PANEL_BUTTON,
- PANEL_ITEM_X, x + ix,
- PANEL_ITEM_Y, y,
- PANEL_LABEL_IMAGE, panel_button_image (panel, "Edit", 6, font_panel_button),
- PANEL_EVENT_PROC, edit_handler,
- 0);
-
- Palette = panel_create_item (menu_panel, PANEL_BUTTON,
- PANEL_ITEM_X, x + 2 * ix,
- PANEL_ITEM_Y, y,
- PANEL_LABEL_IMAGE, panel_button_image (panel, "Palette", 6, font_panel_button),
- PANEL_EVENT_PROC, pal_handler,
- 0);
-
- Zoom = panel_create_item (menu_panel, PANEL_BUTTON,
- PANEL_ITEM_X, x + 3 * ix,
- PANEL_ITEM_Y, y,
- PANEL_LABEL_IMAGE, panel_button_image (panel, "Zoom", 6, font_panel_button),
- PANEL_EVENT_PROC, zoom_handler,
- 0);
-
- Graph = panel_create_item (menu_panel, PANEL_BUTTON,
- PANEL_ITEM_X, x + 4 * ix,
- PANEL_ITEM_Y, y,
- PANEL_LABEL_IMAGE, panel_button_image (panel, "Graph", 6, font_panel_button),
- PANEL_EVENT_PROC, plot_handler,
- 0);
-
- Ftp = panel_create_item (menu_panel, PANEL_BUTTON,
- PANEL_ITEM_X, x + 5 * ix,
- PANEL_ITEM_Y, y,
- PANEL_LABEL_IMAGE, panel_button_image (panel, "FTP", 6, font_panel_button),
- PANEL_EVENT_PROC, ftp_handler,
- 0);
-
- Help = panel_create_item (menu_panel, PANEL_BUTTON,
- PANEL_ITEM_X, x + 6 * ix,
- PANEL_ITEM_Y, y,
- PANEL_LABEL_IMAGE, panel_button_image (panel, "Help", 6, font_panel_button),
- PANEL_EVENT_PROC, help_handler,
- 0);
-
- Option = panel_create_item (menu_panel, PANEL_BUTTON,
- PANEL_ITEM_X, x + 7 * ix,
- PANEL_ITEM_Y, y,
- PANEL_LABEL_IMAGE, panel_button_image (panel, "Option", 6, font_panel_button),
- PANEL_EVENT_PROC, opt_handler,
- 0);
-
- }
- /* EOF */
- /* cat > src+obj/init/create_ttysw.c << "EOF" */
- /* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
- /* create_ttysw: create tty subwindow */
- /* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
- /* SCCS information: %W% %G% - NCSA */
-
- /* #include "init.h" */
-
- create_ttysw ()
- {
- static char *my_argv[] = {"csh", 0};
-
- ttysw = window_create (base, TTY,
- WIN_ROWS, 6, /* 6 rows are needed for vi to work! */
- TTY_ARGV, my_argv, /* be sure that csh is run. */
- 0);
- }
- /* EOF */
- /* cat > src+obj/init/init_env.c << "EOF" */
- /* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
- /* init_env: try to get help file directory, default */
- /* default palette, and image directory. */
- /* The help file directory MUST be in the */
- /* users default database, i.e. */
- /* $HOME/.defaults maintained by */
- /* defaultsedit. It must exist. Otherwise, */
- /* ImageTool will not start. The default */
- /* default palette filename and image */
- /* directory may optionally exist in the */
- /* users default database. If the default */
- /* palette filename is not there or is in */
- /* error no default palette is assigned. */
- /* Otherwise, this palette is loaded. If from */
- /* an HDF file the first palette in the file */
- /* is used. If the image directory is not */
- /* there or is in error the current directory */
- /* is used. */
- /* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
- /* SCCS information: %W% %G% - NCSA */
-
- /* #include "init.h" */
-
- init_env ()
- {
- /* Implementation note(s):
-
- 1. Since calling system() invokes the shell any "wildcard" and
- multiple arguments will be handled by the call. Remember
- system() invokes the Bourne shell. So, call csh explicitly
- to get the more powerful "wildcard" features.
- */
- int err;
- char *p_defaultstr;
- char tmpname[MAXNAMELEN];
-
- /* get help directory - must be in defaults database */
- if ((p_defaultstr = get_defaults (DEFAULT_HELP_DIR)) == NULL)
- {
- msg2_stderr ("No help directory, ImageTool terminated.",
- "Check defaults database with defaultsedit.");
- exit (-1);
- }
- sprintf (wkstr, "csh -fc \"test -d '%s'\"", p_defaultstr);
- if (check_system (wkstr)) /* 0 exit status means true */
- {
- sprintf (wkstr, "Dir = %s", p_defaultstr);
- msg2_stderr ("Help directory bad or does not exist. ImageTool terminated.", wkstr);
- exit (-1);
- }
- strcpy (tmpname, p_defaultstr);
- if ((err = get_abspathname (tmpname, MAXNAMELEN, TYPE_DIR))) /* error should not occur */
- {
- sprintf (wkstr, "Internal error (%d): While resolving help directory. ImageTool terminated. Report bug!", err);
- sprintf (wkstr2, "Dir = %s", p_defaultstr);
- msg2_stderr (wkstr, wkstr2);
- exit (-1);
- }
- strcpy (help_dir, tmpname);
- (void) chdir (help_dir);
- (void) getwd (help_dir);
- (void) chdir (current_dir);
-
- /* get default palette - optionally in the defaults database
- use no palette if none given. */
-
- if ((p_defaultstr = get_defaults (DEFAULT_PALETTE_FILE)) == NULL)
- {
- msg_write ("Warning: No defaults palette file. None set.");
- strcpy (default_cdir, current_dir);
- }
- else
- {
- strcpy (default_pal.fn, p_defaultstr);
- if (load_pal (DEFAULT))
- { /* if error then null out */
- default_pal.fn[0] = '\0';
- default_pal.type = PAL_UNKNOWN;
- default_pal.num = 0;
- }
- }
-
- /* get image directory - optionally in the defaults database
- use the current directory if none
- given. */
- /* current_dir set in init_vars.c */
-
- if ((p_defaultstr = get_defaults (DEFAULT_IMAGE_DIR)) == NULL)
- {
- msg_write ("Warning: No defaults image directory. Current directory used.");
- strcpy (default_cdir, current_dir);
- }
- else
- {
- sprintf (wkstr, "csh -cf \"test -d '%s'\"", p_defaultstr);
- if (check_system (wkstr))
- { /* 0 exit status means true */
- msg_write ("Warning: Bad defaults image directory. Current directory used.");
- strcpy (default_cdir, current_dir);
- }
- else
- { /* fully resolve pathname */
- strcpy (tmpname, p_defaultstr);
- if ((err = get_abspathname (tmpname, MAXNAMELEN, TYPE_DIR)))
- { /* error should not occur */
- sprintf (wkstr, "Internal error (%d): While resolving default image directory. Report bug! Current directory used\n. Dir = %s", err, p_defaultstr);
- msg_write (wkstr);
- strcpy (default_cdir, current_dir);
- }
- else
- {
- strcpy (default_cdir, tmpname);
- strcpy (current_dir, default_cdir);
- }
- }
- }
- (void) chdir (current_dir);
- (void) getwd (current_dir);
- strcpy (default_cdir, current_dir);
- panel_set_value (dir_board, current_dir);
- set_frame_label (base);
- return (0);
- }
- /* EOF */
- /* cat > src+obj/init/init_vars.c << "EOF" */
- /* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
- /* init_vars: initialize all variables */
- /* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
- /* SCCS information: %W% %G% - NCSA */
-
- /* #include "init.h" */
-
- init_vars ()
- {
- char *font_panel_file, *font_panel_button_file, *font_menu_file;
-
- /* reset flags */
- rev_image = 0;
- dark_bg = 0;
-
- startx = starty = ORIGINXY;
- main_quit = 0;
- clear_request = 0;
- pos_picked = 0;
-
- graph_mode = PLOT_NONE;
- color_edit_mode = CEDIT_NONE;
-
- getloop_go = 0;
- animation_go = 0;
- pause_request = 0;
- repeat_index = 0;
- square_drawn = line_drawn = 0;
- first_point = 0;
- middle_button_down = 0;
- linear_scaling = 1;
-
- /* initialize relevant parts of curr_image */
- curr_image.img_name[0] = '\0';
- curr_image.pal_name[0] = '\0';
- curr_image.startx = 0;
- curr_image.starty = 0;
- curr_image.org_xdim = 0;
- curr_image.org_ydim = 0;
- curr_image.xdim = 0;
- curr_image.ydim = 0;
- curr_image.image = NULL;
- curr_image.expanded = 0;
- curr_image.zoomx = 0;
- curr_image.zoomy = 0;
- curr_image.in_use = 0;
- curr_image.cutout = 0;
-
- /* initialize palettes */
- color_index = LUTSIZE;
-
- last_pal.fn[0] = '\0';
- last_pal.type = PAL_UNKNOWN;
- last_pal.num = 0;
-
- curr_pal.fn[0] = '\0';
- curr_pal.type = PAL_UNKNOWN;
- curr_pal.num = 0;
-
- default_pal.fn[0] = '\0';
- default_pal.type = PAL_UNKNOWN;
- default_pal.num = 0;
-
- printer[0] = '\0';
-
- loop_zoomed = 0;
-
- flinear = 1;
-
- /* reset sub frame pointers */
- plot_window = NULL;
- scale_box = NULL;
- help_window = NULL;
- imagesave_box = NULL;
- palsave_box = NULL;
-
- /* get current working directory */
- getwd (current_dir);
-
- /* get fonts */
- if ((font_panel_file = get_defaults (DEFAULT_FONT_PANEL)) == NULL)
- {
- msg2_stderr ("No panel font file, ImageTool terminated.",
- "Check defaults database with defaultsedit.");
- exit (-1);
- }
- if ((font_panel = pf_open (font_panel_file)) == NULL)
- {
- sprintf (wkstr, "File = %s, check defaults database with defaultsedit.", font_panel_file);
- msg2_stderr ("Could not load panel font file, ImageTool terminated.", wkstr);
- exit (-1);
- }
-
- if ((font_panel_button_file = get_defaults (DEFAULT_FONT_PANEL_BUTTON)) == NULL)
- {
- msg2_stderr ("No panel button font file, ImageTool terminated.",
- "Check defaults database with defaultsedit.");
- exit (-1);
- };
- if ((font_panel_button = pf_open (font_panel_button_file)) == NULL)
- {
- sprintf (wkstr, "File = %s, check defaults database with defaultsedit.", font_panel_file);
- msg2_stderr ("Could not load panel button font file, ImageTool terminated", wkstr);
- exit (-1);
- }
-
- if ((font_menu_file = get_defaults (DEFAULT_FONT_MENU)) == NULL)
- {
- msg2_stderr ("No menu font file, ImageTool terminated.",
- "Check defaults database with defaultsedit.");
- exit (-1);
- };
- if ((font_menu = pf_open (font_menu_file)) == NULL)
- {
- sprintf (wkstr, "File = %s, check defaults database with defaultsedit.", font_panel_file);
- msg2_stderr ("Could not load menu font file, ImageTool terminated", wkstr);
- exit (-1);
- }
- }
- /* EOF */
- /* cat > src+obj/init/main_destroy_interposer.c << "EOF" */
- /* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
- /* main_destroy_interposer: (static) destroy the base */
- /* frame */
- /* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
- /* SCCS information: %W% %G% - NCSA */
-
- /* #include "init.h" */
-
- static Notify_value
- main_destroy_interposer (frame, status)
- Frame frame;
- Destroy_status status;
- {
- if (status != DESTROY_CHECKING)
- {
- main_quit = 1;
- main_cleanup ();
- }
- return (notify_next_destroy_func (frame, status));
- }
- /* EOF */
- /* cat > src+obj/init/set_frame_label.c << "EOF" */
- /* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
- /* set_frame_label: set the frame label */
- /* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
- /* SCCS information: %W% %G% - NCSA */
-
- /* #include "init.h" */
-
- set_frame_label (frame)
- Frame frame;
- {
- sprintf (wkstr, "%s --- Current directory: %s\n", Version, current_dir);
- window_set (frame, FRAME_LABEL, wkstr, 0);
- }
- /* EOF */
-