envbvs@epb2.lbl.gov (Brian V. Smith) (07/04/90)
Submitted-by: envbvs@epb2.lbl.gov (Brian V. Smith) Posting-number: Volume 8, Issue 26 Archive-name: xfig2.8/part17 #! /bin/sh # This is a shell archive. Remove anything before this line, then unpack # it by saving it into a file and typing "sh file". To overwrite existing # files, type "sh file -c". You can also feed this as standard input via # unshar, or by typing "sh <file", e.g.. If this archive is complete, you # will see the following message at the end: # "End of archive 17 (of 21)." # Contents: panel.c # Wrapped by envbvs@epb2.lbl.gov on Thu Jun 28 08:53:17 1990 PATH=/bin:/usr/bin:/usr/ucb ; export PATH if test -f 'panel.c' -a "${1}" != "-c" ; then echo shar: Will not clobber existing file \"'panel.c'\" else echo shar: Extracting \"'panel.c'\" \(38010 characters\) sed "s/^X//" >'panel.c' <<'END_OF_FILE' X/* X * FIG : Facility for Interactive Generation of figures X * X * panel.c - Button panel X * X * Copyright (c) 1985 by Supoj Sutanthavibul (supoj@sally.UTEXAS.EDU) X * January 1985. X * 1st revision : Aug 1985. X * X * %W% %G% X*/ X#include "fig.h" X#include "resources.h" X#include "const.h" X#include "font.h" X#include "func.h" X#include "object.h" X#include "paintop.h" X Xextern null_proc(); Xextern read_file(); Xextern save_file(); Xextern edit_file(); Xextern change_directory(); Xextern print_wdir(); Xextern print_figure(); Xextern int line_thickness; Xextern int cur_radius; Xextern int cur_areafill; Xextern int fill_mode; Xextern int foreground_color; Xextern char current_file[]; Xextern int print_landscape; Xextern int size_button; Xextern int type_button; Xextern char *printer; Xextern int cur_printer; Xextern char *printer_list[]; Xextern TOOL fontmenu; /* popup menu for printer fonts */ Xextern appresStruct appres; Xextern int font_button; /* "current" font */ Xextern int *font_sel; /* pointer to store font selected from popup */ Xextern TOOL image_widget; /* which widget to store image of font in */ X X/************** local variables and routines **************/ X X#include "panel.h" X#include "panel2.h" X#include "switch.h" X Xstatic panel_selected(); Xstatic panel_sighandler(); Xstatic init_switch(); Xstatic F_switch *switch_selected(); Xstatic panel_selected(); Xstatic switch_handler(); Xstatic switch_action(); Xstatic mode_on(); Xstatic mode_off(); Xstatic set_command(); Xstatic set_geometry(); Xstatic set_grid(); Xstatic set_style(); Xstatic dec_thick(); Xstatic inc_thick(); X#ifndef TFX Xstatic dec_radius(); Xstatic inc_radius(); X#endif TFX Xstatic darken_fill(); Xstatic lighten_fill(); Xextern turn_off(); X X/* second panel (lower part of window */ Xstatic panel_button(); Xstatic text_just_button(); Xstatic popup_fonts(); Xstatic inc_size_button(); Xstatic dec_size_button(); Xstatic land_button(); X Xstatic Pixmap Lp_pm; /* pixmaps for print-Landscape/Portrait button */ Xstatic Pixmap lP_pm; Xstatic Pixmap print_sel_pm; /* pixmap for printer selection widget */ Xstatic Pixmap font_size_pm; /* pixmap for printer selection widget */ Xstatic Pixmap text_just_pm[3]; /* pixmaps for left/center/right just widget */ Xstatic Widget print_sel_widget; Xstatic Widget font_size_widget; Xstatic F_switch *text_just_sw; /* text justification button */ Xstatic F_switch *land_port_sw; /* landscape/portrait button */ X XTOOL ind_box; /* allow main() to access this widget */ X X#define on_action(z) (z->on_func)(z) X#define off_action(z) (z->off_func)(z) X Xstatic F_switch switches[] = { X { 0, 0, 0, 0, &cirrad_ic, F_CIRCLE_BY_RAD, set_command, null_proc, S_ON, }, X { 0, 0, 0, 0, &cirdia_ic, F_CIRCLE_BY_DIA, set_command, null_proc, S_ON, }, X { 0, 0, 0, 0, &ellrad_ic, F_ELLIPSE_BY_RAD, set_command, null_proc, S_ON, }, X { 0, 0, 0, 0, &elldia_ic, F_ELLIPSE_BY_DIA, set_command, null_proc, S_ON, }, X { 0, 0, 0, 0, &c_spl_ic, F_CLOSED_SPLINE, set_command, null_proc, S_ON, }, X { 0, 0, 0, 0, &spl_ic, F_SPLINE, set_command, null_proc, S_ON, }, X { 0, 0, 0, 0, &c_intspl_ic, F_CLOSED_INTSPLINE, set_command, null_proc, S_ON, }, X { 0, 0, 0, 0, &intspl_ic, F_INTSPLINE, set_command, null_proc, S_ON, }, X { 0, 0, 0, 0, &line_ic, F_POLYLINE, set_command, null_proc, S_ON, }, X { 0, 0, 0, 0, &polygon_ic, F_POLYGON, set_command, null_proc, S_ON, }, X { 0, 0, 0, 0, &box_ic, F_BOX, set_command, null_proc, S_ON, }, X#ifdef TFX X /* place holders to keep a multiple of 3 buttons */ X /* TFX does not allow arc_boxes */ X { 0, -1, 0, 0, &blank_ic, F_NOP, null_proc, null_proc, S_MOMENT, }, X#else X { 0, 0, 0, 0, &arc_box_ic, F_ARC_BOX, set_command, null_proc, S_ON, }, X#endif X { 0, 0, 0, 0, &text_ic, F_TEXT, set_command, null_proc, S_ON, }, X { 0, 0, 0, 0, &arc_ic, F_CIRCULAR_ARC, set_command, null_proc, S_ON, }, X { 0, 0, 0, 0, &turn_ic, F_TURN, set_command, null_proc, S_ON, }, X { 0, 0, 0, 0, &glue_ic, F_GLUE, set_command, null_proc, S_ON, }, X { 0, 0, 0, 0, &break_ic, F_BREAK, set_command, null_proc, S_ON, }, X { 0, 0, 0, 0, &scale_ic, F_SCALE, set_command, null_proc, S_ON, }, X { 0, 0, 0, 0, &autoarrow_ic, F_AUTOARROW, set_command, null_proc, S_ON, }, X { 0, 0, 0, 0, &addpt_ic, F_ADD_POINT, set_command, null_proc, S_ON, }, X { 0, 0, 0, 0, &deletept_ic, F_DELETE_POINT, set_command, null_proc, S_ON, }, X { 0, 0, 0, 0, &move_ic, F_MOVE, set_command, null_proc, S_ON, }, X { 0, 0, 0, 0, &movept_ic, F_MOVE_POINT, set_command, null_proc, S_ON, }, X { 0, 0, 0, 0, ©_ic, F_COPY, set_command, null_proc, S_ON, }, X { 0, 0, 0, 0, &remove_ic, F_REMOVE, set_command, null_proc, S_ON, }, X { 0, 0, 0, 0, &flip_x_ic, F_FLIP_XAXIS, set_command, null_proc, S_ON, }, X { 0, 0, 0, 0, &flip_y_ic, F_FLIP_YAXIS, set_command, null_proc, S_ON, }, X { 0, 0, 0, 0, &rot90_ic, F_ROTATE90, set_command, null_proc, S_ON, }, X { 0, 0, 0, 0, &rot270_ic, F_ROTATE270, set_command, null_proc, S_ON, }, X { 0, 0, 0, 0, &change_ic, F_CHANGE, set_command, null_proc, S_ON, }, X { 1, 2, 0, 0, &unconstraint_ic, F_UNCONSTRAINT, set_geometry, null_proc, S_ON, }, X { 0, 2, 0, 0, &latexline_ic, F_LATEX_LINE, set_geometry, null_proc, S_ON, }, X { 0, 2, 0, 0, &latexarrow_ic, F_LATEX_ARROW, set_geometry, null_proc, S_ON, }, X { 0, 2, 0, 0, &mounthattan_ic, F_MOUNTHATTAN, set_geometry, null_proc, S_ON, }, X { 0, 2, 0, 0, &manhattan_ic, F_MANHATTAN, set_geometry, null_proc, S_ON, }, X { 0, 2, 0, 0, &mountain_ic, F_MOUNTAIN, set_geometry, null_proc, S_ON, }, X { 1, 3, 0, 0, &solidline_ic, F_SET_SOLID_LINE, set_style, null_proc, S_ON, }, X { 0, 3, 0, 0, &dashline_ic, F_SET_DASH_LINE, set_style, null_proc, S_ON, }, X { 0, 3, 0, 0, &dottedline_ic, F_SET_DOTTED_LINE, set_style, null_proc, S_ON, }, X { 0, 1, 0, 0, &grid1_ic, F_GRID1, set_grid, set_grid, S_TOG, }, X { 0,-1, 0, 0, &backarrow_ic, F_AUTOB_ARROW, mode_on, mode_off, S_TOG, }, X { 0,-1, 0, 0, &forarrow_ic, F_AUTOF_ARROW, mode_on, mode_off, S_TOG, }, X { 0, 1, 0, 0, &grid2_ic, F_GRID2, set_grid, set_grid, S_TOG, }, X#ifdef TFX X { 0,-1, 0, 0, &fill_ic, F_FILL, mode_on, mode_off, S_TOG, }, X { 1,-1, 0, 0, &magnet_ic, F_MAGNET, mode_on, mode_off, S_TOG, }, X#else X { 1,-1, 0, 0, &magnet_ic, F_MAGNET, mode_on, mode_off, S_TOG, }, X { 0,-1, 0, 0, &fill_ic, F_FILL, mode_on, mode_off, S_TOG, }, X#endif X { 0,-1, 0, 0, &incdec_thick_ic, F_INCDECTHICK, dec_thick, null_proc, S_MOMENT,}, X#ifndef TFX X { 0,-1, 0, 0, &incdec_radius_ic, F_INCDECRADIUS, dec_radius, null_proc, S_MOMENT,}, X#endif X { 0,-1, 0, 0, &fill_color_ic, F_FILLCOLOR, lighten_fill, null_proc, S_MOMENT,}, X X }; X X#define N_SWITCHES (sizeof(switches) / sizeof(F_switch)) X#define NUM_GROUP 4 Xstatic F_switch *group[NUM_GROUP]; X X/* second panel of switches below the lower ruler */ Xstatic F_switch switches2[] = { X { 0, -1, 0, 0, &save_n_exit_ic,F_SAVE_N_EXIT,panel_button,null_proc,S_MOMENT,}, X { 0, -1, 0, 0, &quit_ic, F_QUIT, panel_button, null_proc, S_MOMENT, }, X { 0, -1, 0, 0, &save_ic, F_SAVE, panel_button, null_proc, S_MOMENT, }, X { 0, -1, 0, 0, &save_in_ic, F_SAVE_IN, panel_button, null_proc, S_MOMENT, }, X { 0, -1, 0, 0, &read_ic, F_READ, panel_button, null_proc, S_MOMENT, }, X { 0, -1, 0, 0, &edit_ic, F_EDIT, panel_button, null_proc, S_MOMENT, }, X { 0, -1, 0, 0, &cdir_ic, F_CHDIR, panel_button, null_proc, S_MOMENT, }, X { 0, -1, 0, 0, &pdir_ic, F_PWDIR, panel_button, null_proc, S_MOMENT, }, X { 0, -1, 0, 0, &print_ic, F_PRINT, panel_button, null_proc, S_MOMENT, }, X { 0, -1, 0, 0, &print_sel_ic, F_PRINTSEL, panel_button, null_proc, S_MOMENT,}, X { 0, -1, 0, 0, &font_ic, F_FONT, popup_fonts, null_proc, S_MOMENT, }, X { 0, -1, 0, 0, &size_ic, F_SIZE, dec_size_button, null_proc, S_MOMENT, }, X { 0, -1, 0, 0, &textL_ic, F_JUST, text_just_button, null_proc, S_MOMENT, }, X { 0, -1, 0, 0, &land_ic, F_LAND, land_button, null_proc, S_MOMENT, }, X { 0, -1, 0, 0, &undo_ic, F_UNDO, panel_button, null_proc, S_MOMENT, }, X { 0, -1, 0, 0, &redisp_ic, F_REDISPLAY, panel_button, null_proc, S_MOMENT, }, X }; X X#define N_SWITCHES2 (sizeof(switches2) / sizeof(F_switch)) X X/* X * Panel subwindow section X */ X Xstatic Arg panel_args[] = X{ X /* 0 */ { XtNwidth, (XtArgVal) 0 }, X /* 1 */ { XtNhSpace, (XtArgVal)SWITCH_ICON_SPACING }, X /* 2 */ { XtNvSpace, (XtArgVal)SWITCH_ICON_SPACING }, X /* Fix the size of the panel window by chaining both top & bottom X to the top of the form, and both left & right to the right. X If RHS_PANEL, then chain left/right to RIGHT of form */ X /* 3 */ { XtNtop, (XtArgVal)XtChainTop }, X /* 4 */ { XtNbottom, (XtArgVal)XtChainTop }, X /* 5 */ { XtNleft, (XtArgVal)XtChainLeft }, X /* 6 */ { XtNright, (XtArgVal)XtChainLeft }, X /* 7 */ { XtNresizable, (XtArgVal) False }, X /* 8 */ { XtNborderWidth, (XtArgVal) 2 }, X /* 9 */ { XtNvertDistance, (XtArgVal) 0 }, /* touching top of form */ X}; X Xstatic Arg panel2_args[] = X{ X /* 0 */ { XtNwidth, (XtArgVal)0 }, X /* 1 */ { XtNhSpace, (XtArgVal) 1 }, X /* 2 */ { XtNvSpace, (XtArgVal) 1 }, X /* 3 */ { XtNresizable, (XtArgVal) False }, X /* 4 */ { XtNfromVert, (XtArgVal) NULL }, /* will be from psfont */ X /* 5 */ { XtNvertDistance, (XtArgVal) -1 }, X /* 6 */ { XtNhorizDistance, (XtArgVal) 1 }, X /* Fix the size of the panel window by chaining both top & bottom X to the top of the form, and both left & right to the right */ X /* 7 */ { XtNtop, (XtArgVal)XtChainBottom }, X /* 8 */ { XtNbottom, (XtArgVal)XtChainBottom }, X /* 9 */ { XtNleft, (XtArgVal)XtChainLeft }, X /* 10 */ { XtNright, (XtArgVal)XtChainLeft }, X}; X Xstatic Arg ind_box_args[] = X{ X /* 0 */ { XtNwidth, (XtArgVal) 0 }, X /* 1 */ { XtNhSpace, (XtArgVal)SWITCH_ICON_SPACING }, X /* 2 */ { XtNfromVert, (XtArgVal) NULL }, /* will be from panel_sw */ X /* 3 */ { XtNvertDistance, (XtArgVal) 0 }, X /* 4 */ { XtNborderWidth, (XtArgVal) 2 }, X /* Fix the size of the panel window by chaining both top & bottom X to the top of the form, and both left & right to the right X If RHS_PANEL, then chain left/right to RIGHT of form */ X /* 5 */ { XtNtop, (XtArgVal)XtChainTop }, X /* 6 */ { XtNbottom, (XtArgVal)XtChainTop }, X /* 7 */ { XtNleft, (XtArgVal)XtChainLeft }, X /* 8 */ { XtNright, (XtArgVal)XtChainLeft }, X}; X X/* widget arguments to show the current fill color and line thickness*/ X Xstatic Arg indicator_panel_args[] = X{ X /* 0 */ { XtNlabel, (XtArgVal)" " }, X /* 1 */ { XtNwidth, (XtArgVal) SWITCH_ICON_WIDTH }, X /* 2 */ { XtNheight, (XtArgVal) SWITCH_ICON_HEIGHT }, X /* 3 */ { XtNresizable, (XtArgVal) False }, X /* 4 */ { XtNborderWidth, (XtArgVal) 1 }, X /* 5 */ { XtNbackgroundPixmap, (XtArgVal) NULL }, X}; X Xstatic void button_select(); X Xstatic Arg button_args[] = X{ X /* 0 */ { XtNlabel, (XtArgVal)" " }, X /* 1 */ { XtNwidth, (XtArgVal) 0 }, X /* 2 */ { XtNheight, (XtArgVal) 0 }, X /* 3 */ { XtNbackgroundPixmap, (XtArgVal)NULL }, X /* 4 */ { XtNresizable, (XtArgVal) False }, X /* 5 */ { XtNborderWidth, (XtArgVal) 1 }, X /* 6 */ { XtNresize, (XtArgVal) False }, /* this keeps the damned buttons from X being resized when there are not a X multiple of three of them */ X}; X Xextern int PANEL_LEFT, PANEL_TOP, PANEL_HEIGHT, PANEL_WID; Xextern int PANEL2_LEFT, PANEL2_TOP, PANEL2_HEIGHT, PANEL2_WID; Xextern int CANVAS_HEIGHT, ICON_COLUMN; X Xstatic right_but(); X X/* button selection event handler */ Xstatic sel_but(); X Xint Xinit_panel(tool) X TOOL tool; X{ X register int i; X register F_switch *sw; X X /* width */ X panel_args[0].value = PANEL_WID = X (SWITCH_ICON_WIDTH + 2 + SWITCH_ICON_SPACING) * ICON_COLUMN X + SWITCH_ICON_SPACING; X panel_sw = XtCreateWidget("side_panel", boxWidgetClass, tool, X panel_args, XtNumber(panel_args)); X X for (i = 0; i < N_SWITCHES; ++i) X { X sw = &switches[i]; X button_args[1].value = sw->icon->width; /* button width */ X button_args[2].value = sw->icon->height; /* button height */ X sw->but.widget = XtCreateManagedWidget( X "button", commandWidgetClass, X panel_sw, button_args, XtNumber(button_args)); X /* allow left & right buttons (callbacks pass same data for ANY button) */ X XtAddEventHandler(sw->but.widget,ButtonPressMask,(Boolean) 0, X sel_but, (caddr_t) sw); X } X X return (1); X} X Xint /* second panel */ Xinit_panel2(tool) X TOOL tool; X{ X register int i; X register F_switch *sw; X X X /* panel width */ X panel2_args[0].value = PANEL2_WID = 2 * N_SWITCHES2 * X (SWITCH_ICON_WIDTH + SWITCH_ICON_SPACING) X + SWITCH_ICON_SPACING; X panel2_args[4].value = (XtArgVal) psfont; /* vert offset from font window */ X X panel2_sw = XtCreateWidget("bottom_panel", boxWidgetClass, tool, panel2_args, X XtNumber(panel2_args)); X for (i = 0; i < N_SWITCHES2; ++i) X { X sw = &switches2[i]; X button_args[1].value = sw->icon->width; /* button width */ X button_args[2].value = sw->icon->height; /* button height */ X sw->but.widget = XtCreateManagedWidget( X "button", commandWidgetClass, X panel2_sw, button_args, XtNumber(button_args)); X /* allow left and right buttons (callbacks pass same data for ANY button) */ X XtAddEventHandler(sw->but.widget,ButtonPressMask,(Boolean) 0, X sel_but, (caddr_t) sw); X } X return (1); X} X X#define NUM_IND 3 /* number of indicator widgets */ X Xinit_indicator_panel(tool) XTOOL tool; X { X /* width */ X ind_box_args[0].value = X (SWITCH_ICON_WIDTH + 2 + SWITCH_ICON_SPACING)*NUM_IND X + SWITCH_ICON_SPACING; X X /* put below bottom of panel_sw */ X ind_box_args[2].value = (XtArgVal) panel_sw; X X ind_box = XtCreateWidget("indicator", boxWidgetClass, tool, ind_box_args, X XtNumber(ind_box_args)); X X indicator_panel_args[5].value = (XtArgVal) ind_fill_pm[0];/* white pixmap */ X X /* line thickness indicator */ X line_thick_panel = XtCreateManagedWidget( "linewidth_indicator", boxWidgetClass, X ind_box, indicator_panel_args, XtNumber(indicator_panel_args)); X X#ifndef TFX X /* rounded-corner box radius indicator */ X radius_panel = XtCreateManagedWidget( "radius_indicator", boxWidgetClass, X ind_box, indicator_panel_args, XtNumber(indicator_panel_args)); X#endif TFX X X /* fill_area color */ X fill_panel = XtCreateManagedWidget( "fill_indicator", boxWidgetClass, X ind_box, indicator_panel_args, XtNumber(indicator_panel_args)); X } X Xstatic GC button_gc; X X/* come here after panel widget is realized to put some bitmaps etc. things in it */ X Xsetup_panel() X{ X register int i; X register F_switch *sw; X register Display *d = tool_d; X register Screen *s = tool_s; X register Pixmap p; X Arg tmp_arg[3]; X unsigned long bg, fg; X X button_gc = XCreateGC(d, XtWindow(panel_sw), (unsigned long)0, NULL); X XtSetArg(tmp_arg[0], XtNbackground, &bg); X XtSetArg(tmp_arg[1], XtNforeground, &fg); X XtGetValues(switches[0].but.widget, tmp_arg, 2); X XSetForeground(d, button_gc, fg); X XSetBackground(d, button_gc, bg); X XSetFont(d, button_gc, button_font->fid); /* set button font */ X X for (i = 0; i < N_SWITCHES; ++i) X { X sw = &switches[i]; X p = XCreatePixmapFromBitmapData(d, XtWindow(sw->but.widget), X sw->icon->data, X sw->icon->width, sw->icon->height,fg,bg, X DefaultDepthOfScreen(s)); X X sw->but.normal = button_args[3].value = (XtArgVal)p; X XtSetValues(sw->but.widget, &button_args[3], 1); X } X/* X** Create reversed bitmaps for displaying activated state X*/ X for (i = 0; i < N_SWITCHES; ++i) X { X sw = &switches[i]; X p = XCreatePixmapFromBitmapData(d, XtWindow(sw->but.widget), X sw->icon->data, X sw->icon->width, sw->icon->height,bg,fg, X DefaultDepthOfScreen(s)); X X sw->but.reverse = (XtArgVal)p; X } X X /*******************************/ X /* now do the same for panel 2 */ X /*******************************/ X X for (i = 0; i < N_SWITCHES2; ++i) X { X sw = &switches2[i]; X p = XCreatePixmapFromBitmapData(d, XtWindow(sw->but.widget), X sw->icon->data, X sw->icon->width, sw->icon->height,fg,bg, X DefaultDepthOfScreen(s)); X if (sw->value == F_LAND) /* create portrait pixmap for land/portrait button */ X { X Lp_pm = p; /* save pointer to default */ X lP_pm = XCreatePixmapFromBitmapData(d, XtWindow(sw->but.widget), X port_ic.data, X port_ic.width, port_ic.height,fg,bg, X DefaultDepthOfScreen(s)); X if (!appres.landscape) /* use portrait for startup image */ X p = lP_pm; X land_port_sw = sw; /* save pointer to this switch */ X } X else if (sw->value == F_SIZE) /* save pointer to pixmap/widget for font size */ X { X font_size_pm = p; X font_size_widget = sw->but.widget; X } X else if (sw->value == F_JUST) /* save ptr to pixmap/widget for text justification */ X { X text_just_sw = sw; X /* create the other bitmaps for Center and Right */ X text_just_pm[T_LEFT_JUSTIFIED] = p; /* left just */ X text_just_pm[T_CENTER_JUSTIFIED] = /* center just */ X XCreatePixmapFromBitmapData(d, XtWindow(sw->but.widget), X textC_ic.data, X textC_ic.width, textC_ic.height,fg,bg, X DefaultDepthOfScreen(s)); X text_just_pm[T_RIGHT_JUSTIFIED] = /* right just */ X XCreatePixmapFromBitmapData(d, XtWindow(sw->but.widget), X textR_ic.data, X textR_ic.width, textR_ic.height,fg,bg, X DefaultDepthOfScreen(s)); X } X else if (sw->value == F_PRINTSEL) /* save pointer to pixmap for print sel */ X { X print_sel_pm = p; X print_sel_widget=sw->but.widget; X } X X sw->but.normal = button_args[3].value = (XtArgVal)p; X XtSetValues(sw->but.widget, &button_args[3], 1); X } X/* X** Create reversed bitmaps for displaying activated state X*/ X for (i = 0; i < N_SWITCHES2; ++i) X { X sw = &switches2[i]; X p = XCreatePixmapFromBitmapData(d, XtWindow(sw->but.widget), X sw->icon->data, X sw->icon->width, sw->icon->height,fg,bg, X DefaultDepthOfScreen(s)); X sw->but.reverse = (XtArgVal)p; X } X X init_switch(); X XDefineCursor(d, XtWindow(panel_sw), (Cursor)arrow_cursor.bitmap); X XDefineCursor(d, XtWindow(panel2_sw), (Cursor)arrow_cursor.bitmap); X X} X X/* come here when a button is pressed in either of the panels */ X Xstatic Xsel_but(widget, sw, event) XWidget widget; XF_switch *sw; XXButtonEvent *event; X { X if (event->button == Button1) /* left button */ X button_select(widget, sw); X else if (event->button == Button3) /* right button */ X right_but(widget, sw); X } X Xstatic Xright_but(widget, sw) XWidget widget; XF_switch *sw; X { X switch (sw->value) /* do the opposite of the function declared in the switch */ X { X case F_INCDECTHICK: X inc_thick(sw); X break; X case F_FILLCOLOR: X darken_fill(sw); X break; X#ifndef TFX X case F_INCDECRADIUS: X inc_radius(sw); X break; X#endif X case F_SIZE: X inc_size_button(sw); X break; X } X } X Xstatic void Xbutton_select(widget, s) X TOOL widget; X F_switch *s; X{ X switch_action(s); X} X Xstatic Xinit_switch() X{ X extern int manhattan_mode; X extern int mountain_mode; X extern int autoforwardarrow_mode; X extern int autobackwardarrow_mode; X extern int latexline_mode; X extern int latexarrow_mode; X extern int magnet_mode; X extern int line_style; X extern float cur_styleval; X extern float cur_dashlength; X extern float cur_dotgap; X int i; X F_switch *sw; X X for (sw = switches, i = 0; i < N_SWITCHES; sw++, i++) { X sw->x *= SWITCH_ICON_WIDTH; X sw->y *= SWITCH_ICON_HEIGHT; X } X /* don't forget the second panel */ X for (sw = switches2, i = 0; i < N_SWITCHES2; sw++, i++) { X sw->x *= SWITCH_ICON_WIDTH; X sw->y *= SWITCH_ICON_HEIGHT; X } X X for (i = 0; i < NUM_GROUP; ) X group[i++] = NULL; X X for (sw = switches, i = 0; i < N_SWITCHES; sw++, i++) { X if (sw->on) { X /* Only the following switch can be preset */ X switch (sw->value) { X case F_UNCONSTRAINT : X manhattan_mode = 0; X mountain_mode = 0; X latexline_mode = 0; X latexarrow_mode = 0; X group[sw->group] = sw; X break; X case F_MOUNTHATTAN : X manhattan_mode = 1; X mountain_mode = 1; X group[sw->group] = sw; X break; X case F_MANHATTAN : X manhattan_mode = 1; X group[sw->group] = sw; X break; X case F_MOUNTAIN : X mountain_mode = 1; X group[sw->group] = sw; X break; X case F_LATEX_LINE : X latexline_mode = 1; X group[sw->group] = sw; X break; X case F_LATEX_ARROW : X latexarrow_mode = 1; X group[sw->group] = sw; X break; X case F_AUTOF_ARROW : X autoforwardarrow_mode = 1; X break; X case F_AUTOB_ARROW : X autobackwardarrow_mode = 1; X break; X case F_SET_SOLID_LINE : X line_style = SOLID_LINE; X cur_styleval = 0.0; X break; X case F_SET_DASH_LINE : X line_style = DASH_LINE; X cur_styleval = cur_dashlength; X break; X case F_SET_DOTTED_LINE : X line_style = DOTTED_LINE; X cur_styleval = cur_dotgap; X break; X case F_MAGNET : X magnet_mode = 1; X break; X default : X continue; X } X turn_on(sw); X if (sw->group != -1) X group[sw->group] = sw; X } X } X } X Xstatic Xset_command(sw) XF_switch *sw; X{ X extern int cur_command; X extern int rotate_angle; X extern int flip_axis; X X switch (sw->value) { X case F_CIRCLE_BY_RAD : X circlebyradius_drawing_selected(); X erase_pointmarker(); X erase_compoundbox(); X put_msg("CIRCLE drawing: specify RADIUS"); X break; X case F_CIRCLE_BY_DIA : X circlebydiameter_drawing_selected(); X erase_pointmarker(); X erase_compoundbox(); X put_msg("CIRCLE drawing: specify DIAMETER"); X break; X case F_ELLIPSE_BY_RAD : X ellipsebyradius_drawing_selected(); X erase_pointmarker(); X erase_compoundbox(); X put_msg("ELLIPSE drawing: specify RADIUSES"); X break; X case F_ELLIPSE_BY_DIA : X ellipsebydiameter_drawing_selected(); X erase_pointmarker(); X erase_compoundbox(); X put_msg("ELLIPSE drawing: specify DIAMETERS"); X break; X case F_BOX : X box_drawing_selected(); X erase_pointmarker(); X erase_compoundbox(); X put_msg("Rectangular BOX drawing"); X break; X#ifndef TFX X case F_ARC_BOX : X arc_box_drawing_selected(); X erase_pointmarker(); X erase_compoundbox(); X put_msg("Rectangular BOX drawing with ROUNDED CORNERS"); X break; X#endif X case F_POLYGON : X line_drawing_selected(); X erase_pointmarker(); X erase_compoundbox(); X put_msg("POLYGON drawing"); X break; X case F_POLYLINE : X line_drawing_selected(); X erase_pointmarker(); X erase_compoundbox(); X put_msg("POLYLINE drawing"); X break; X case F_TEXT : X text_drawing_selected(); X erase_pointmarker(); X erase_compoundbox(); X put_msg("TEXT input (from keyboard)"); X break; X case F_CIRCULAR_ARC : X arc_drawing_selected(); X erase_pointmarker(); X erase_compoundbox(); X put_msg("ARC drawing: specify three points on the arc"); X break; X case F_SPLINE : X draw_spline_selected(); X erase_pointmarker(); X erase_compoundbox(); X put_msg("SPLINE drawing: specify control points"); X break; X case F_CLOSED_SPLINE : X draw_spline_selected(); X erase_pointmarker(); X erase_compoundbox(); X put_msg("CLOSED SPLINE drawing: specify control points"); X break; X case F_INTSPLINE : X draw_intspline_selected(); X erase_pointmarker(); X erase_compoundbox(); X put_msg("INTERPOLATED SPLINE drawing"); X break; X case F_CLOSED_INTSPLINE : X draw_intspline_selected(); X erase_pointmarker(); X erase_compoundbox(); X put_msg("CLOSED INTERPOLATED SPLINE drawing"); X break; X case F_GLUE : X compound_selected(); X erase_pointmarker(); X show_compoundbox(); X put_msg("GLUE objects into COMPOUND object with bounding box"); X break; X case F_BREAK : X break_selected(); X erase_pointmarker(); X show_compoundbox(); X put_msg("BREAK COMPOUND object"); X break; X case F_SCALE : X scale_compound_selected(); X erase_pointmarker(); X show_compoundbox(); X put_msg("SCALE COMPOUND object"); X break; X case F_ADD_POINT : X point_adding_selected(); X show_pointmarker(); X erase_compoundbox(); X put_msg("ADD POINTs (to POLYLINE, POLYGON, CLOSED-SPLINE and SPLINE)"); X break; X case F_DELETE_POINT : X delete_point_selected(); X show_pointmarker(); X erase_compoundbox(); X put_msg("DELETE POINTs (from POLYLINE, POLYGON, CLOSED-SPLINE and SPLINE)"); X break; X case F_MOVE : X move_selected(); X show_pointmarker(); X show_compoundbox(); X put_msg("MOVE objects"); X break; X case F_MOVE_POINT : X move_point_selected(); X show_pointmarker(); X erase_compoundbox(); X put_msg("MOVE POINTs (of POLYLINE, POLYGON, CLOSED-SPLINE, SPLINE and BOX)"); X break; X case F_REMOVE : X remove_selected(); X show_pointmarker(); X show_compoundbox(); X put_msg("REMOVE objects"); X break; X case F_COPY : X copy_selected(); X show_pointmarker(); X show_compoundbox(); X put_msg("COPY objects"); X break; X case F_ROTATE270 : X rotate_selected(); X show_pointmarker(); X show_compoundbox(); X rotate_angle = 270; X put_msg("ROTATE objects (middle button) or COPY & ROTATE (left button) -90 degree"); X break; X case F_ROTATE90 : X rotate_selected(); X show_pointmarker(); X show_compoundbox(); X rotate_angle = 90; X put_msg("ROTATE objects (middle button) or COPY & ROTATE (left button) 90 degree"); X break; X case F_FLIP_XAXIS : X flip_selected(); X show_pointmarker(); X show_compoundbox(); X flip_axis = 1; X put_msg("FLIP objects (middle button) or COPY & FLIP (left button) up or down"); X break; X case F_FLIP_YAXIS : X flip_selected(); X show_pointmarker(); X show_compoundbox(); X flip_axis = 2; X put_msg("FLIP objects (middle button) or COPY & FLIP (left button) left or right"); X break; X case F_TURN : X turn_selected(); X show_pointmarker(); X erase_compoundbox(); X put_msg("Turn POLYGON (POLYLINE) into CLOSED-SPLINE (SPLINE) or vice versa"); X break; X case F_AUTOARROW : X arrow_head_selected(); X show_pointmarker(); X erase_compoundbox(); X put_msg("ADD arrow head (left button); DELETE arrow head (middle button)"); X break; X case F_CHANGE: X change_item_selected(); X show_pointmarker(); X show_compoundbox(); X put_msg("CHANGE OBJECT"); X break; X X X } X cur_command = sw->value; X } X Xstatic Xset_geometry(sw) XF_switch *sw; X{ X extern int manhattan_mode; X extern int mountain_mode; X extern int latexline_mode; X extern int latexarrow_mode; X X switch (sw->value) { X case F_UNCONSTRAINT : X manhattan_mode = 0; X mountain_mode = 0; X latexline_mode = 0; X latexarrow_mode = 0; X put_msg("UNCONSTRAINT geometry (for POLYLINE and SPLINE)"); X break; X case F_MOUNTHATTAN : X mountain_mode = 1; X manhattan_mode = 1; X latexline_mode = 0; X latexarrow_mode = 0; X put_msg("MOUNT-HATTAN geometry (for POLYLINE and SPLINE)"); X break; X case F_MANHATTAN : X manhattan_mode = 1; X mountain_mode = 0; X latexline_mode = 0; X latexarrow_mode = 0; X put_msg("MANHATTAN geometry (for POLYLINE and SPLINE)"); X break; X case F_MOUNTAIN : X mountain_mode = 1; X manhattan_mode = 0; X latexline_mode = 0; X latexarrow_mode = 0; X put_msg("MOUNTAIN geometry (for POLYLINE and SPLINE)"); X break; X case F_LATEX_LINE : X latexline_mode = 1; X manhattan_mode = 0; X mountain_mode = 0; X latexarrow_mode = 0; X put_msg("LATEX LINE geometry: allow only LaTeX line slopes"); X break; X case F_LATEX_ARROW : X latexarrow_mode = 1; X manhattan_mode = 0; X mountain_mode = 0; X latexline_mode = 0; X put_msg("LATEX ARROW geometry: allow only LaTeX arrow slopes"); X break; X } X } X Xstatic Xset_grid(sw) XF_switch *sw; X{ X setup_grid(sw->value); X } X Xstatic Xmode_on(sw) XF_switch *sw; X{ X extern int autoforwardarrow_mode; X extern int autobackwardarrow_mode; X extern int magnet_mode; X X switch (sw->value) { X case F_AUTOF_ARROW : X autoforwardarrow_mode = 1; X put_msg("AUTO FORWARD ARROW (for ARC, POLYLINE and SPLINE)"); X break; X case F_AUTOB_ARROW : X autobackwardarrow_mode = 1; X put_msg("AUTO BACKWARD ARROW (for ARC, POLYLINE and SPLINE)"); X break; X case F_MAGNET : X magnet_mode = 1; X put_msg("MAGNET: round entered points to the nearest %s increment", X (appres.INCHES? "1/16\"": "2 mm")); X break; X case F_FILL : X fill_mode = 1; X put_fmsg("FILL MODE (gray level = %.2lf)", X (double)1.0-(cur_areafill-1.0)/(NUMFILLPATS-1.0)); X break; X } X } X Xstatic Xmode_off(sw) XF_switch *sw; X{ X extern int autoforwardarrow_mode; X extern int autobackwardarrow_mode; X extern int magnet_mode; X X switch (sw->value) { X case F_AUTOF_ARROW : X autoforwardarrow_mode = 0; X break; X case F_AUTOB_ARROW : X autobackwardarrow_mode = 0; X break; X case F_MAGNET : X magnet_mode = 0; X break; X case F_FILL : X fill_mode = 0; X put_msg("NO-FILL MODE"); X break; X } X } X Xstatic Xset_style(sw) XF_switch *sw; X{ X extern int line_style; X extern float cur_styleval; X extern float cur_dashlength; X extern float cur_dotgap; X X switch (sw->value) { X case F_SET_SOLID_LINE : X line_style = SOLID_LINE; X cur_styleval = 0.0; X put_msg("SOLID LINE STYLE (for BOX, POLYGON and POLYLINE)"); X break; X case F_SET_DASH_LINE : X line_style = DASH_LINE; X cur_styleval = cur_dashlength; X put_msg("DASH LINE STYLE (for BOX, POLYGON and POLYLINE)"); X break; X case F_SET_DOTTED_LINE : X line_style = DOTTED_LINE; X cur_styleval = cur_dotgap; X put_msg("DOTTED LINE STYLE (for BOX, POLYGON and POLYLINE)"); X break; X } X } X X Xstatic Xdec_thick(sw) XF_switch *sw; X { X if (line_thickness > 0) X --line_thickness; X show_line_thickness(); X } X X#define MAXLINETHICK 200 X Xstatic Xinc_thick(sw) XF_switch *sw; X { X if (line_thickness < MAXLINETHICK) X ++line_thickness; X show_line_thickness(); X } X Xstatic Pixmap line_pm=0; X Xshow_line_thickness() X { X if (line_pm == 0) X line_pm = XCreatePixmap(tool_d, XtWindow(line_thick_panel), X SWITCH_ICON_WIDTH, SWITCH_ICON_HEIGHT, X DefaultDepthOfScreen(tool_s)); X /* erase by drawing wide, inverted (white) line */ X pw_vector(line_pm, 0, SWITCH_ICON_HEIGHT/2, X SWITCH_ICON_WIDTH, SWITCH_ICON_HEIGHT/2, ERASE, X SWITCH_ICON_HEIGHT, SOLID_LINE, 0.0); X /* draw current line thickness into pixmap */ X if (line_thickness > 0) /* don't draw line for zero-thickness */ X pw_vector(line_pm, 0, SWITCH_ICON_HEIGHT/2, X SWITCH_ICON_WIDTH, SWITCH_ICON_HEIGHT/2, PAINT, X line_thickness, SOLID_LINE, 0.0); X X /* Fool the toolkit by changing the background pixmap to 0 X then giving it the modified one again. Otherwise, it sees X that the pixmap ID is not changed and doesn't actually draw X it into the widget window */ X indicator_panel_args[5].value = 0; X XtSetValues(line_thick_panel, &indicator_panel_args[5], 1); X X /* put the pixmap in the widget background */ X indicator_panel_args[5].value = line_pm; X XtSetValues(line_thick_panel, &indicator_panel_args[5], 1); X put_msg("LINE Thickness = %d",line_thickness); X } X X X#ifndef TFX X Xstatic Xdec_radius(sw) XF_switch *sw; X { X --cur_radius; X show_radius(); X } X X#define MAXRADIUS 30 X Xstatic Xinc_radius(sw) XF_switch *sw; X { X ++cur_radius; X show_radius(); X } X Xstatic Pixmap radius_pm=0; X Xshow_radius() X { X if (cur_radius > MAXRADIUS) X cur_radius = MAXRADIUS; X else if (cur_radius < 3) X cur_radius = 3; X if (radius_pm == 0) X radius_pm = XCreatePixmap(tool_d, XtWindow(radius_panel), X SWITCH_ICON_WIDTH, SWITCH_ICON_HEIGHT, X DefaultDepthOfScreen(tool_s)); X /* erase by drawing wide, inverted (white) line */ X pw_vector(radius_pm, 0, SWITCH_ICON_HEIGHT/2, X SWITCH_ICON_WIDTH, SWITCH_ICON_HEIGHT/2, ERASE, X SWITCH_ICON_HEIGHT, SOLID_LINE, 0.0); X /* draw current radius into pixmap */ X curve(radius_pm, 0, cur_radius, cur_radius, 0, 0, X cur_radius, cur_radius, X 1, SWITCH_ICON_HEIGHT-2, foreground_color, X 1, SOLID_LINE, 0.0, 0); X X /* Fool the toolkit by changing the background pixmap to 0 X then giving it the modified one again. Otherwise, it sees X that the pixmap ID is not changed and doesn't actually draw X it into the widget window */ X indicator_panel_args[5].value = 0; X XtSetValues(radius_panel, &indicator_panel_args[5], 1); X X /* put the pixmap in the widget background */ X indicator_panel_args[5].value = radius_pm; X XtSetValues(radius_panel, &indicator_panel_args[5], 1); X put_msg("ROUNDED-CORNER BOX Radius = %d",cur_radius); X } X#endif TFX X Xstatic Xdarken_fill(sw) XF_switch *sw; X { X if (cur_areafill < NUMFILLPATS) X ++cur_areafill; X show_fill_color(); X } X Xstatic Xlighten_fill(sw) XF_switch *sw; X { X if (cur_areafill > 1) X --cur_areafill; X show_fill_color(); X } X Xshow_fill_color() X { X /* put fill pixmap in widget background */ X indicator_panel_args[5].value = ind_fill_pm[cur_areafill-1]; X XtSetValues(fill_panel, &indicator_panel_args[5], 1); X put_fmsg("FILL GRAY = %.2lf", X (double)1.0-(cur_areafill-1.0)/(NUMFILLPATS-1.0)); X } X X/* Come here when most any lower panel button is pressed */ X Xstatic Xpanel_button(sw) XF_switch *sw; X { X char_handler(CR); /* finish any text in progress */ X switch (sw->value) { X case F_UNDO : X undo(); X break; X case F_READ : X init_msg_receiving(read_file, "Read file : "); X break; X case F_SAVE : X (void)save_current_file(); X break; X case F_SAVE_IN : X if (no_object()) { X put_msg("No figure to save; ignored"); X break; X } X init_msg_receiving(save_file, "Save in file : "); X break; X case F_REDISPLAY : X redisplay_canvas(); X break; X case F_EDIT : X edit(); X break; X case F_PRINT: X print_figure(); X break; X case F_PRINTSEL: X printer_select(); X break; X case F_CHDIR : X init_msg_receiving(change_directory, "Directory : "); X break; X case F_PWDIR: X print_directory(); X break; X case F_SAVE_N_EXIT : X save_n_exit(); X break; X case F_QUIT : X quit(); X break; X } X } X Xprinter_select() X { X if (*printer != '\0') /* increment printer number if not first time here */ X { X if (++cur_printer >= MAXPRINTERS) X cur_printer=0; X } X printer=printer_list[cur_printer]; X put_msg("SELECT PRINTER: %s",printer); X X /* first erase any existing string in pixmap */ X XDrawImageString(tool_d, print_sel_pm, button_gc, X 6, 24, " ", 8); X /* write the printer name in the background pixmap */ X XDrawImageString(tool_d, print_sel_pm, button_gc, X 6, 24, printer, strlen(printer)); X X /* Fool the toolkit by changing the background pixmap to 0 X then giving it the modified one again. Otherwise, it sees X that the pixmap ID is not changed and doesn't actually draw X it into the widget window */ X button_args[3].value = 0; X XtSetValues(print_sel_widget, &button_args[3], 1); X X /* put the pixmap in the widget background */ X button_args[3].value = print_sel_pm; X XtSetValues(print_sel_widget, &button_args[3], 1); X } X X/* popup menu of printer fonts */ X Xstatic Xpopup_fonts(sw) XF_switch *sw; X { X font_sel = &font_button; /* store selected font number in font_button */ X image_widget = psfont; /* and image in this widget */ X XtPopup(fontmenu,XtGrabNonexclusive); X setup_fontmenu_cursor(); /* now define the cursor for the font menu */ X } X X/* set text justification to left/center or right */ X Xstatic Xtext_just_button(sw) XF_switch *sw; X { X if (++type_button > T_RIGHT_JUSTIFIED) /* increment to next (L/C/R) */ X type_button = 0; X /* put the pixmap in the widget background */ X text_just_sw->but.normal = text_just_sw->but.reverse = X button_args[3].value = (XtArgVal) text_just_pm[type_button]; X XtSetValues(text_just_sw->but.widget, &button_args[3], 1); X if (type_button==T_LEFT_JUSTIFIED) X put_msg("Left justify text"); X else if (type_button==T_CENTER_JUSTIFIED) X put_msg("Center text"); X else X put_msg("Right justify text"); X } X X/* increase font size for print */ X Xstatic Xinc_size_button(sw) XF_switch *sw; X { X if (size_button >= 100) X { X size_button = (size_button/10) * 10; /* round first */ X size_button += 10; X } X else if (size_button >= 50) X { X size_button = (size_button/5) * 5; X size_button += 5; X } X else if (size_button >= 20) X { X size_button = (size_button/2) * 2; X size_button += 2; X } X else X size_button++; X show_fontsize(); X } X X X/* decrease font size for print */ X Xstatic Xdec_size_button(sw) XF_switch *sw; X { X if (size_button > 100) X { X size_button = (size_button/10) * 10; /* round first */ X size_button -= 10; X } X else if (size_button > 50) X { X size_button = (size_button/5) * 5; X size_button -= 5; X } X else if (size_button > 20) X { X size_button = (size_button/2) * 2; X size_button -= 2; X } X else if (size_button > 4) X size_button--; X show_fontsize(); X } X Xstatic char tmpsiz[5]; X Xshow_fontsize() X { X put_msg("Font size %d",size_button); X /* write the font size in the background pixmap */ X tmpsiz[0]=tmpsiz[1]=tmpsiz[2]=tmpsiz[3]=tmpsiz[4]='\0'; X sprintf(tmpsiz,"%3d",size_button); X XDrawImageString(tool_d, font_size_pm, button_gc, X 31, 12, tmpsiz, strlen(tmpsiz)); X X /* Fool the toolkit by changing the background pixmap to 0 X then giving it the modified one again. Otherwise, it sees X that the pixmap ID is not changed and doesn't actually draw X it into the widget window */ X button_args[3].value = 0; X XtSetValues(font_size_widget, &button_args[3], 1); X X /* put the pixmap in the widget background */ X button_args[3].value = font_size_pm; X XtSetValues(font_size_widget, &button_args[3], 1); X } X X/* change landscape/portrait flag for print */ X Xstatic Xland_button(sw) XF_switch *sw; X { X print_landscape = 1-print_landscape; X land_port(); /* display new state */ X } X X/* this is callable from the 'edit' file routine */ X Xland_port() X { X land_port_sw->but.normal = land_port_sw->but.reverse = X button_args[3].value = (XtArgVal) (print_landscape? Lp_pm: lP_pm); X XtSetValues(land_port_sw->but.widget, &button_args[3], 1); X put_msg("Print in %s mode",print_landscape? "LANDSCAPE": "PORTRAIT"); X } X X/* undo last operation */ X Xstatic Xundo_button(sw) XF_switch *sw; X { X undo(); X } X X/* redisplay */ X Xstatic Xredisp_button(sw) XF_switch *sw; X { X redisplay_canvas(); X } X Xturn_on(s) X F_switch *s; X{ X s->on = 1; X button_args[3].value = (XtArgVal)s->but.reverse; X XtSetValues(s->but.widget, &button_args[3], 1); X} X Xturn_off(s) X F_switch *s; X{ X s->on = 0; X button_args[3].value = (XtArgVal)s->but.normal; X XtSetValues(s->but.widget, &button_args[3], 1); X} X Xstatic Xswitch_action(sw) XF_switch *sw; X{ X F_switch *old; X X if (sw == NULL) return; X X if (sw->group == -1) { X if (sw->on) { X turn_off(sw); X off_action(sw); X } X else { X turn_on(sw); X on_action(sw); X } X if (sw->type == S_MOMENT) /* added B.V.Smith */ X { X turn_off(sw); X off_action(sw); X } X return; X } X X old = group[sw->group]; X if (old == sw) { X if (old->type != S_ON) { X turn_off(old); X off_action(old); X group[old->group] = NULL; X } X return; X } X else if (old) { X turn_off(old); X off_action(old); X } X X turn_on(sw); X on_action(sw); X group[sw->group] = sw; X if (sw->type == S_MOMENT) /* added B.V.Smith */ X { X turn_off(sw); X off_action(sw); X } X } END_OF_FILE if test 38010 -ne `wc -c <'panel.c'`; then echo shar: \"'panel.c'\" unpacked with wrong size! fi # end of 'panel.c' fi echo shar: End of archive 17 \(of 21\). cp /dev/null ark17isdone MISSING="" for I in 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 ; do if test ! -f ark${I}isdone ; then MISSING="${MISSING} ${I}" fi done if test "${MISSING}" = "" ; then echo You have unpacked all 21 archives. rm -f ark[1-9]isdone ark[1-9][0-9]isdone else echo You still need to unpack the following archives: echo " " ${MISSING} fi ## End of shell archive. exit 0 dan ---------------------------------------------------- O'Reilly && Associates argv@sun.com / argv@ora.com Opinions expressed reflect those of the author only.