[comp.sources.sun] v01i048: Touchup 2.5 - a Sunview bitmap graphics editor, Part 06/07

mcgrew@dartagnan.rutgers.edu (Charles Mcgrew) (07/13/89)

Submitted-by: rayk@sbcs.sunysb.edu
Posting-number: Volume 1, Issue 48
Archive-name: touchup2.5/part06

#! /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 6 (of 7)."
# Contents:  fat.c ffill.c fonts.c info.c interface.c
# Wrapped by rayk@sboslab3 on Tue Aug 30 00:07:37 1988
PATH=/bin:/usr/bin:/usr/ucb ; export PATH
if test -f fat.c -a "${1}" != "-c" ; then 
  echo shar: Will not over-write existing file \"fat.c\"
else
echo shar: Extracting \"fat.c\" \(5675 characters\)
sed "s/^X//" >fat.c <<'END_OF_fat.c'
X
X/**************************************************************************
X   Touchup a bitmap graphics editor for the Sun Workstation running SunView
X   Copyright (c) 1988 by Raymond Kreisel
X   1/22/88 @ Suny Stony Brook
X
X   This program may be redistributed without fee as long as this copyright
X   notice is intact.
X
X==> PLEASE send comments and bug reports to one of the following addresses:
X
X	   Ray Kreisel
X	   CS Dept., SUNY at Stony Brook, Stony Brook NY 11794
X
X	   UUCP: {allegra, philabs, pyramid, research}!sbcs!rayk   
X	   ARPA-Internet: rayk@sbcs.sunysb.edu			
X	   CSnet: rayk@suny-sb
X	   (If nobody is home at any of the above addresses try:
X		S72QKRE@TOWSONVX.BITNET			        )
X
X "If I get home before daylight, I just might get some sleep tonight...."
X
X**************************************************************************/
X/**************************************************************************
X	file: fat.c
X	purpose: This file contains the functions that handle the
X		magnifing class command.
X
X	modifications:
X		date:	Tue Mar 22 22:04:58 EST 1988
X		author:	rayk
X		changes:add comments
X
X		date:	Sun Jun  5 23:47:42 EDT 1988
X		author:	rayk
X		changes:fixed bug in magnify, so that it does
X			a save_screen when you go into fat_mode
X**************************************************************************/
X
X#include "header.h"
X
Xint old_cur_color=0-1;
X
X/*
X * Let's go into magnify mode !!
X */
Xfat_mode()
X{
X    if (image_depth==1)
X	old_cur_color = cur_color;
X    if (select_pt_x == -1)
X       {
X	ERROR("Select point first then select Magnify");
X	set_select_mode();
X	return;
X       }
X    
X    if (fat_source_x != -1)
X       select_fat_region();
X    fat_source_x = select_pt_x- (int)window_get(fat_canvas, CANVAS_WIDTH)/magnify_fac/2;
X    fat_source_y = select_pt_y- (int)window_get(fat_canvas, CANVAS_HEIGHT)/magnify_fac/2;
X    clean_point();
X    save_screen();
X    (void)window_set(fat_frame, WIN_SHOW, TRUE, 0);
X    select_fat_region();
X    fat_update(0,0);
X}
X
X
X/*
X * kill off the magnify window
X */
Xfat_done()
X{
X    if ((image_depth==1) && (old_cur_color != -1))
X    {
X	cur_color = old_cur_color;
X        old_cur_color = 0-1;
X    }
X    if (fat_source_x != -1)
X       select_fat_region();
X    (void)window_set(fat_frame, WIN_SHOW, FALSE, 0);
X    fat_source_x = 0-1;
X    fat_source_y = 0-1;
X}
X
X
X
X/*
X * The event handler for the canvas of the magnifying class window
X * You can do 3 things.
X *  left: inverse the bit the mouse is on top of and continue
X *		to draw in that color
X *  middle: use this to draw the magnified view
X *  right: use to set the current color to the color of the pixel
X * 		under the cursor
X */
Xfat_handle_event(canvas_local, event)
XCanvas  canvas_local;
XEvent   *event;
X{
X    if (event_is_up(event))
X       return;
X    switch (event_id(event)) {
X	 case MS_LEFT:
X		if (image_depth ==1)
X                   {
X		      cur_color = 1^pw_get(pw,fat_source_x + (int)event_x(event)/magnify_fac,fat_source_y + (int)event_y(event)/magnify_fac);
X		   }
X		fat_draw(fat_pw,pw, event_x(event), event_y(event));
X		break;
X	 case MS_MIDDLE:
X		fat_x = event_x(event);
X		fat_y = event_y(event);
X		break;
X	 case MS_RIGHT:
X		 fat_match_color(event_x(event), event_y(event));
X       		 break;
X         case LOC_DRAG:
X            if (window_get(canvas_local, WIN_EVENT_STATE, MS_LEFT))
X		fat_draw(fat_pw,pw, event_x(event), event_y(event));
X	    else if (window_get(canvas_local, WIN_EVENT_STATE, MS_MIDDLE))
X		{
X		fat_update(fat_x-event_x(event),fat_y-event_y(event));
X		fat_x = event_x(event);
X		fat_y = event_y(event);
X		}
X	    break;
X
X	}
X}
X
X
X/*
X * Find out the color of the pixel under the cursor
X */
Xfat_match_color(x,y)
Xint x,y;
X{
X  x = fat_source_x + x/magnify_fac;
X  y = fat_source_y + y/magnify_fac;
X  if (image_depth > 1)
X    update_cur_color(0,0,pw_get(pw,x,y));
X}
X
X
X/*
X * This is the function that updates the display of the magnifyied view
X * This function is called when the middle but is used to draw this window
X */
Xfat_update(offset_x,offset_y)
Xint offset_x,offset_y;
X{
Xint w,h;
X
X  w = (int) window_get(fat_canvas, CANVAS_WIDTH);
X  h = (int) window_get(fat_canvas, CANVAS_HEIGHT);
X  select_fat_region();
X  fat_source_x += offset_x/magnify_fac;
X  fat_source_y += offset_y/magnify_fac;
X  if (w >= SCREEN_MAX_X)
X     w=SCREEN_MAX_X-1;
X  if (h >= SCREEN_MAX_Y)
X     h=SCREEN_MAX_Y-1;
X
X/*
X * check if you are within the pixrect
X */
X#ifdef NO_FASTAN
X  if (fat_source_x < 0)
X	fat_source_x = 0;
X  if (fat_source_y < 0)
X	fat_source_y = 0;
X  if (fat_source_x+w/magnify_fac > image_wid)
X	fat_source_x = image_wid - w/magnify_fac;
X  if (fat_source_y+h/magnify_fac > image_hgt)
X	fat_source_y = image_hgt - h/magnify_fac;
X#endif
X
X  pw_mag(fat_pw, 0, 0, w, h, magnify_fac, pw->pw_prretained,
X	 fat_source_x, fat_source_y);
X  select_fat_region();
X}
X
X
X/*
X * get the current magnification level
X */
Xfat_parms()
X{
X  select_fat_region();
X  magnify_fac = (int)panel_get_value(magnify_cycle) + 1;
X  select_fat_region();
X  fat_update(0,0);
X}
X
X
X/*
X * show which region of the drawing area bitmap is being magnified
X */
Xselect_fat_region()
X{
Xint w,h;
X  w = (int) window_get(fat_canvas, CANVAS_WIDTH);
X  h = (int) window_get(fat_canvas, CANVAS_HEIGHT);
X  select_region(pw,fat_source_x-1,fat_source_y-1,
X		  fat_source_x+w/magnify_fac+1,fat_source_y+h/magnify_fac+1);
X}
X
X
X
X/*
X * handle the drawing inside of the magnified view window
X */
Xfat_draw(fat_pw,pw,x,y)
Xstruct pixwin *fat_pw,*pw;
Xint x,y;
X{
X  x = x/magnify_fac*magnify_fac;
X  y = y/magnify_fac*magnify_fac;
X  pw_write(fat_pw,x,y,magnify_fac,magnify_fac,PIX_COLOR(cur_color) | PIX_SRC,NILPR,0,0);
X  x = fat_source_x + x/magnify_fac;
X  y = fat_source_y + y/magnify_fac;
X  pw_put(pw,x,y,cur_color);
X}
X
END_OF_fat.c
if test 5675 -ne `wc -c <fat.c`; then
    echo shar: \"fat.c\" unpacked with wrong size!
fi
# end of overwriting check
fi
if test -f ffill.c -a "${1}" != "-c" ; then 
  echo shar: Will not over-write existing file \"ffill.c\"
else
echo shar: Extracting \"ffill.c\" \(4993 characters\)
sed "s/^X//" >ffill.c <<'END_OF_ffill.c'
X
X/**************************************************************************
X   Touchup a bitmap graphics editor for the Sun Workstation running SunView
X   Copyright (c) 1988 by Raymond Kreisel
X   1/22/88 @ Suny Stony Brook
X
X   This program may be redistributed without fee as long as this copyright
X   notice is intact.
X
X==> PLEASE send comments and bug reports to one of the following addresses:
X
X	   Ray Kreisel
X	   CS Dept., SUNY at Stony Brook, Stony Brook NY 11794
X
X	   UUCP: {allegra, philabs, pyramid, research}!sbcs!rayk   
X	   ARPA-Internet: rayk@sbcs.sunysb.edu			
X	   CSnet: rayk@suny-sb
X	   (If nobody is home at any of the above addresses try:
X		S72QKRE@TOWSONVX.BITNET			        )
X
X "If I get home before daylight, I just might get some sleep tonight...."
X
X**************************************************************************/
X/**************************************************************************
X	file: ffill.c
X	purpose: this file has the functions that do flood fill
X
X	modifications:
X		date:	Tue Mar 22 22:04:58 EST 1988
X		author:	rayk
X		changes:add comments
X
X	modifications:
X		date:	Fri Jun 24 23:50:13 EDT 1988
X		author:	tnosoes!tom@uunet.UU.NET & rayk & Paul Heckbert
X		changes:changed Paul Heckbert's flood fill so that
X			it would flood fill with a pattern, pattern
X			flood code was taken from tnosoes!tom@uunet.UU.NET
X**************************************************************************/
X
X#include "header.h"
X
Xstatic struct pixrect	*org;
X
X/*
X * let's go into flood fill mode because we got a button click on flood fill
X */
Xfill_mode()
X{
Xint x,y;
X
X
X  if (select_pt_x != -1)
X      {
X         print_msg("Hold down the RIGHT mouse button to cancel flood fill.");
X  	 x = select_pt_x;
X         y = select_pt_y;
X  	 clean_point();
X	 save_screen();
X	org= my_mem_create(image_wid,image_hgt,image_depth);
X  	pr_rop(org,0,0,image_wid,image_hgt,PIX_SRC,pw->pw_prretained,0,0);
X
X	 if (fill(x,y,cur_color))
X		ERROR("Flood fill cancelled !!");
X	 else
X	    hide_msg();
X	 MY_pr_destroy(org);
X      }
X  else
X      {
X	ERROR("Select point first, then select flood fill");
X	set_select_mode();
X      }
X}
X
X
X#define FILL_CANCEL 1
X#define FILL_OK 0
X
X/*
X * fill.c : one page seed fill program, 1 channel frame buffer version
X *
X * doesn't read each pixel twice like the BASICFILL algorithm in
X *      Alvy Ray Smith, "Tint Fill", SIGGRAPH '79
X *
X * Paul Heckbert        13 Sept 1982, 28 Jan 1987
X */
X
Xtypedef int pixel;
Xextern int wx1, wx2, wy1, wy2;  /* screen window */
X
Xstruct seg {short y, xl, xr, dy;};      /* horizontal segment of scan line y */
X#define FILL_MAX 10000               /* max depth of stack */
X#define pixelread(x,y) 		pr_get(org,x,y)
X 
X#define PUSH(Y, XL, XR, DY) \
X    if (sp<stack+FILL_MAX && Y+(DY)>=wy1 && Y+(DY)<=wy2) \
X    {sp->y = Y; sp->xl = XL; sp->xr = XR; sp->dy = DY; sp++;}
X
X#define POP(Y, XL, XR, DY) \
X    {sp--; Y = sp->y+(DY = sp->dy); XL = sp->xl; XR = sp->xr;}
X
X/*
X * fill: set the pixel at (x,y) and all of its 4-connected neighbors
X * with the same pixel value to the new pixel value nv.
X * A 4-connected neighbor is a pixel above, below, left, or right of a pixel.
X */
Xfill(x, y, nv)
Xint x, y;       /* seed point */
Xpixel nv;       /* new pixel value */
X{
Xint wx1=0, wx2, wy1=0, wy2;  /* screen window */
X
X    int l, x1, x2, dy, sx;
X    pixel ov;   /* old pixel value */
X    struct seg stack[FILL_MAX], *sp = stack; /* stack of filled segments */
X
X     wx2 = image_wid;
X     wy2 = image_hgt;
X     
X    ov = pixelread(x, y);               /* read pv at seed point */
X    if (ov==nv || x<wx1 || x>wx2 || y<wy1 || y>wy2) return(FILL_OK);
X    PUSH(y, x, x, 1);                   /* needed in some cases */
X    PUSH(y+1, x, x, -1);                /* seed segment (popped 1st) */
X
X    while (sp>stack) {
X        /* pop segment off stack and fill a neighboring scan line */
X        POP(y, x1, x2, dy);
X        /*
X         * segment of scan line y-dy for x1<=x<=x2 was previously filled,
X         * now explore adjacent pixels in scan line y
X         */
X        for (x=x1; x>=wx1 && pixelread(x, y)==ov; x--);
X	pr_rop(org,x+1,y,x1-x,1,PIX_SET,0,0,0);
X	pw_replrop(pw,x+1,y,x1-x,1,(nv == 0 ? PIX_CLR : PIX_SRC | PIX_COLOR(nv)),pattern[(int)panel_get_value(pattern_choice)],x+1,y);
X        if (x>=x1) goto skip;
X        l = x+1;
X        if (l<x1) PUSH(y, l, x1-1, -dy);                /* leak on left? */
X        x = x1+1;
X        do {
X	    sx = x;
X            for (; x<=wx2 && pixelread(x, y)==ov; x++);
X	    if (sx != x)
X	    {
X	      pr_rop(org,sx,y,x-sx,1,PIX_SET,0,0,0);
X	      pw_replrop(pw,sx,y,x-sx,1,(nv == 0 ? PIX_CLR : PIX_SRC | PIX_COLOR(nv)),pattern[(int)panel_get_value(pattern_choice)],sx,y);
X	    }
X            PUSH(y, l, x-1, dy);
X            if (x>x2+1) PUSH(y, x2+1, x-1, -dy);        /* leak on right? */
Xskip:       for (x++; x<=x2 && pixelread(x, y)!=ov; x++);
X            l = x;
X	} while (x<=x2);
X        if (window_get(canvas, WIN_EVENT_STATE, MS_RIGHT))
X            return(FILL_CANCEL);
X
X    }
X  return(FILL_OK);
X}
X
X
END_OF_ffill.c
if test 4993 -ne `wc -c <ffill.c`; then
    echo shar: \"ffill.c\" unpacked with wrong size!
fi
# end of overwriting check
fi
if test -f fonts.c -a "${1}" != "-c" ; then 
  echo shar: Will not over-write existing file \"fonts.c\"
else
echo shar: Extracting \"fonts.c\" \(16311 characters\)
sed "s/^X//" >fonts.c <<'END_OF_fonts.c'
X
X/**************************************************************************
X   Touchup a bitmap graphics editor for the Sun Workstation running SunView
X   Copyright (c) 1988 by Raymond Kreisel
X   1/22/88 @ Suny Stony Brook
X
X   This program may be redistributed without fee as long as this copyright
X   notice is intact.
X
X==> PLEASE send comments and bug reports to one of the following addresses:
X
X	   Ray Kreisel
X	   CS Dept., SUNY at Stony Brook, Stony Brook NY 11794
X
X	   UUCP: {allegra, philabs, pyramid, research}!sbcs!rayk   
X	   ARPA-Internet: rayk@sbcs.sunysb.edu			
X	   CSnet: rayk@suny-sb
X	   (If nobody is home at any of the above addresses try:
X		S72QKRE@TOWSONVX.BITNET			        )
X
X "If I get home before daylight, I just might get some sleep tonight...."
X
X**************************************************************************/
X/**************************************************************************
X	file: fonts
X	purpose: The functions in this file build a list of the where
X		are the available fonts are by reading from a ".touchup"
X		that the user can supply.
X
X	modifications:
X		date:	Wed Jul 27 00:34:17 EDT 1988
X		author:	sgoell@sbcs.sunyb.edu
X		changes:total rewrite of fonts functions, so that the user
X			give a list of fonts and where they are located
X
X		date:	Wed Jul 27 00:34:17 EDT 1988
X		author:	rayk
X		changes:built the user menus for the fonts list and the
X			point size list
X**************************************************************************/
X
X#include "header.h"
X
Xtypedef struct {
X  char *name;
X  struct font *node;
X} fontnamelist;
X
Xtypedef struct font {
X	int dir;
X	char *filename;
X	char *fontname;
X	int pointsize[15];
X	struct font *next;
X} *fontlist;
X
Xfontnamelist fonts[60];
Xstruct  pixfont  *real_font;
X
XMenu font_menu, pt_menu;
X
Xint cur_pt_size=3;
X
X
X#define skipws(file) { \
X	c = getc(file);\
X	while ((c == ' ') || (c == '\t') || (c == '\n'))\
X	    c = getc(file);\
X}
X
X#define set_psize(font, index, psize) {\
X	font->pointsize[index] = psize;\
X	psize = 0;\
X}
X
Xchar fontdirs[6][MAX_FILE_NAME];
Xfontlist allfonts;
X
X#define USER_FONTFILE "/.touchup"
X#define SYS_FONTFILE "/touchup_fonts"
X#define SYSFONTDIR 	0
X#define SYSFONTPATH 	"/usr/lib/fonts/fixedwidthfonts"
X#define DEFAULT_FONT	"Screen"
X#define DEFAULT_FNAME	"screen.r."
X#define MAXFONTS	60
X
X
X
X/*
X * Give me the pointer to the node for this font and the point size
X * and this function will return the full path of where to find the font
X */
Xchar *mk_path(font, ptsize)
Xfontlist font;
Xint ptsize;
X{
Xstatic char path[MAX_FILE_NAME];
Xchar  psize[3];
X    
X    strcpy(path, fontdirs[font->dir]);
X    strcat(path, "/");
X    strcat(path, font->filename);
X    sprintf(psize, "%d", font->pointsize[ptsize]);
X    strcat(path, psize);
X    return(path);
X}
X
X
X/*
X * Add a new font to the existing list of fonts, remember which dir the font
X * is in, the name, and the filename
X */
Xfontlist mk_font(dir, name, file)
Xint	dir;
Xchar	*name;
Xchar	*file;
X{
X    char *malloc();
X    fontlist tmp;
X
X    tmp = (fontlist) malloc(sizeof(struct font));
X    tmp->dir = dir;
X    tmp->fontname = malloc(strlen(name)+1);
X    strcpy(tmp->fontname, name);
X    tmp->filename = malloc(strlen(file)+1);
X    strcpy(tmp->filename, file);
X    tmp->next = 0;
X    return(tmp);
X}
X
Xint change_pt_size();
X
X/*
X * First build the list of the all of the fonts we know then
X * set up everything for the fonts and point size menus.
X */
Xinit_font()
X{
Xint i;
Xfontlist currfont;
X
X    real_font = main_font;
X    for(i=0;i<60;i++)
X	fonts[i].name = 0;
X
X    init_fontlist();
X    font_menu = menu_create(MENU_NCOLS, 4,
X			    MENU_INITIAL_SELECTION_SELECTED, TRUE,
X			    MENU_INITIAL_SELECTION, MENU_SELECTED,
X			    MENU_DEFAULT_SELECTION, MENU_SELECTED,
X			    0);
X    pt_menu = menu_create(MENU_NCOLS, 3,
X			    MENU_INITIAL_SELECTION_SELECTED, TRUE,
X			    MENU_INITIAL_SELECTION, MENU_SELECTED,
X			    MENU_DEFAULT_SELECTION, MENU_SELECTED,
X			    MENU_STRINGS,"7","11","12","14",0,0);
X
X    currfont = allfonts;
X    i=0;
X    while (currfont) {
X	fonts[i].node = currfont;
X	fonts[i].name = currfont->fontname;
X	menu_set(font_menu,MENU_STRING_ITEM,currfont->fontname,++i,0);
X	currfont = currfont->next;
X    } 
X}
X
X
X/***********************************************************************\
X* 								        *
X*  init_fontlist reads the fontnames from the fontfile and initializes  *
X*  the font menu.						        *
X* 								        *
X\***********************************************************************/
Xinit_fontlist()
X
X{
X    int c;
X    FILE *fontfile, *fopen();
X    int currfdir = 0, fontcnt = 0;
X    char name[100], file[MAX_FILE_NAME];
X    fontlist newfont, currfont;
X    int ps0, ps1, ps2, ps3, ps4, ps5, ps6, ps7, ps8, ps9, ps10, ps11, ps12,
X    	ps13, ps14;
X
X    /*
X     * First check if the user has a font list in his HOME dir with
X     * the name ".touchup"
X     */
X    if (!getenv("HOME"))
X	printf("Cannot find the environment variable HOME\n");
X    else
X        strcpy(file_name,getenv("HOME"));
X    strcat(file_name,USER_FONTFILE);
X    if (!(fontfile = fopen(file_name, "r")))
X     {
X	/*
X	 * If the user does not have a font list in his HOME dir then
X	 * check the dir where touchup was installed
X	 */
X	strcpy(file_name,INSTALL_DIR);
X	strcat(file_name,SYS_FONTFILE);
X        if (!(fontfile = fopen(file_name, "r")))
X           {
X	      /*
X	       * We can not find anything so give them a couple founds
X	       */
X	      printf("Cannot find font list in:%s\n",file_name);
X	      printf("Using default fonts.\n");
X	      allfonts = mk_font(SYSFONTDIR, DEFAULT_FONT, DEFAULT_FNAME);
X	      strcpy(fontdirs[0],SYSFONTPATH);
X    	      allfonts->pointsize[0] = 7;
X    	      allfonts->pointsize[1] = 11;
X              allfonts->pointsize[2] = 12;
X              allfonts->pointsize[3] = 13;
X              allfonts->pointsize[4] = 14;
X	      return;
X	   }
X     }
X
X    allfonts = mk_font(SYSFONTDIR, DEFAULT_FONT, DEFAULT_FNAME);
X    strcpy(fontdirs[0],SYSFONTPATH);
X    allfonts->pointsize[0] = 7;
X    allfonts->pointsize[1] = 11;
X    allfonts->pointsize[2] = 12;
X    allfonts->pointsize[3] = 13;
X    allfonts->pointsize[3] = 14;
X    cur_pt_size = 3;
X    currfont = allfonts;
X    skipws(fontfile);
X    while (c == '#') {
X	while (getc(fontfile) != '\n');
X    	skipws(fontfile);
X    }
Xnew_dir:
X    ungetc(c, fontfile);
X    fscanf(fontfile, "%s", fontdirs[++currfdir]);
X    skipws(fontfile);
X    while (c == '#') {
X	while (getc(fontfile) != '\n');
X    	skipws(fontfile);
X    }
X
Xnew_font:
X    fscanf(fontfile, "%[^\"]\" %s %d %d %d %d %d %d %d %d %d %d %d %d %d %d %d", name, file, &ps0, &ps1, &ps2, &ps3, &ps4, &ps5, &ps6, &ps7, &ps8, &ps9, &ps10, &ps11, &ps12, &ps13, &ps14);
X    newfont = mk_font(currfdir, name, file);
X    currfont->next = newfont;
X    currfont = currfont->next;
X    set_psize(newfont, 0, ps0);
X    set_psize(newfont, 1, ps1);
X    set_psize(newfont, 2, ps2);
X    set_psize(newfont, 3, ps3);
X    set_psize(newfont, 4, ps4);
X    set_psize(newfont, 5, ps5);
X    set_psize(newfont, 6, ps6);
X    set_psize(newfont, 7, ps7);
X    set_psize(newfont, 8, ps8);
X    set_psize(newfont, 9, ps9);
X    set_psize(newfont, 10, ps10);
X    set_psize(newfont, 11, ps11);
X    set_psize(newfont, 12, ps12);
X    set_psize(newfont, 13, ps13);
X    set_psize(newfont, 14, ps14);
X    skipws(fontfile);
X    while (c == '#') {
X	while (getc(fontfile) != '\n');
X	skipws(fontfile);
X    }
X    switch (c) {
X	case EOF: 
X	   fclose(fontfile);
X	   return;
X
X	case '"':
X	    if (fontcnt++ == MAXFONTS)
X	      {
X	        fclose(fontfile);
X	        return;
X	      }
X	    goto new_font;
X
X	default:
X	    if (currfdir == 5)
X	      {
X	        fclose(fontfile);
X	        return;
X	      }
X	    goto new_dir;
X    }
X}
X
X
Xchar pt_size[15][3];
Xint cur_font_index=0;
X
X/*
X * Get a new font from the disk and use the first point size
X * Also build a menu of all of the point sizes for this font.
X */
Xget_new_font(event)
XEvent   *event;
X{
Xint i,j;
Xchar temp_str[4];
X
X  i = (int)menu_show(font_menu, text_panel, event, 0);
X  if (i==0) return;
X  cur_pt_size = 0;
X  if (cur_font_index)
X	pf_close(real_font);
X  cur_font_index = i-1;
X  real_font = pf_open(mk_path(fonts[cur_font_index].node,cur_pt_size));
X  if (!real_font)
X    {
X     ERRORstr("ERROR loading the font file:",mk_path(fonts[cur_font_index].node,cur_pt_size));
X     real_font = main_font;
X     menu_destroy(pt_menu);
X     pt_menu = menu_create(MENU_NCOLS, 3,
X			    MENU_INITIAL_SELECTION_SELECTED, TRUE,
X			    MENU_INITIAL_SELECTION, MENU_SELECTED,
X			    MENU_DEFAULT_SELECTION, MENU_SELECTED,
X			MENU_STRINGS,"7","11","12","14",0,0);
X     cur_pt_size = 3;
X     cur_font_index = 0;
X    }
X  else
X    {
X      menu_destroy(pt_menu);
X      pt_menu = menu_create(MENU_NCOLS, 3,
X			    MENU_INITIAL_SELECTION_SELECTED, TRUE,
X			    MENU_INITIAL_SELECTION, MENU_SELECTED,
X			    MENU_DEFAULT_SELECTION, MENU_SELECTED,
X			    0);
X      for(j=0;j<15;j++)
X       {
X	 if (fonts[cur_font_index].node->pointsize[j])
X	   {
X	    sprintf(pt_size[j],"%d",fonts[cur_font_index].node->pointsize[j]);
X	    menu_set(pt_menu,MENU_STRING_ITEM,pt_size[j],j+1,0);
X	   }
X       }
X    }
X}
X
X
X
X/*
X * Get a new copy of the current font but with a different point size
X */
Xchange_pt_size(event)
XEvent *event;
X{
X  cur_pt_size = (int)menu_show(pt_menu, text_panel, event, 0);
X  if (cur_pt_size)
X    {
X	cur_pt_size--;
X        if (cur_font_index)
X	     pf_close(real_font);
X        real_font = pf_open(mk_path(fonts[cur_font_index].node,cur_pt_size));
X       	if (!real_font)
X    	{
X     	   ERRORstr("ERROR loading the font file:",
X		mk_path(fonts[cur_font_index].node,cur_pt_size));
X     	   real_font = main_font;
X     	   menu_destroy(pt_menu);
X     	   pt_menu = menu_create(MENU_NCOLS, 3,
X			    MENU_INITIAL_SELECTION_SELECTED, TRUE,
X			    MENU_INITIAL_SELECTION, MENU_SELECTED,
X			    MENU_DEFAULT_SELECTION, MENU_SELECTED,
X			    MENU_STRINGS,"7","11","12","14",0,0);
X	   cur_font_index = 0;
X	   cur_pt_size = 3;
X	}
X    }
X}
X
X
X
Xchar cur_text_str[100];
Xint cur_text_x,cur_text_y,org_text_x;
X#define DELETE_KEY 127
X
X
X/*
X * Let's do interactive text right onto the bitmap, that is let the
X * user type the text and we XOR it on to screen so that they
X * can backspace. But there is only one current text string, every thing
X * else is already on the bitmap.
X */
Xnew_draw_text(event)
XEvent *event;
X{
Xint i,ROP;
Xstruct pr_size text_wid;
Xint text_hgt;
X 
X
X      text_hgt = real_font->pf_defaultsize.y;
X
X      if (!(ROP = get_current_ROP()))
X	 ROP = TRANSPARENT;
X
X      text_wid = pf_textwidth(strlen(cur_text_str),real_font,cur_text_str);
X
X      pw_batch_on(pw);
X      switch(event_id(event)) {
X	case '\n' :
X	case '\r' :
X		/*
X		 * We got a <return> so erase the old text and do the
X		 * final printing of the text string with the right ROP
X		 */
X		pw_replrop(pw,cur_text_x+ text_wid.x ,cur_text_y- text_hgt,
X			   1,text_hgt, PIX_XOR, pattern[0],0,0);
X		draw_text(cur_text_x,cur_text_y,cur_text_str,PIX_XOR);
X
X		draw_text(cur_text_x,cur_text_y,cur_text_str,ROP);
X		cur_text_y += text_hgt;
X	        cur_text_x = org_text_x;
X		cur_text_str[0] = '\0';
X		pw_replrop(pw,cur_text_x,cur_text_y- text_hgt,
X			   1,text_hgt, PIX_XOR, pattern[0],0,0);
X		break;
X	case '\b' :
X	case DELETE_KEY :
X		/*
X		 * We got a delete so erase the old string and then 
X		 * delete the last char of the string and reprint
X		 */
X		pw_replrop(pw,cur_text_x+ text_wid.x ,cur_text_y- text_hgt,
X			   1,text_hgt, PIX_XOR, pattern[0],0,0);
X		draw_text(cur_text_x,cur_text_y,cur_text_str,PIX_XOR);
X		i = strlen(cur_text_str);
X		if (i>0)
X		   cur_text_str[i-1] = '\0';
X
X      		text_wid = pf_textwidth(strlen(cur_text_str),
X		     real_font,cur_text_str);
X
X		switch(panel_get_value(text_choice)) {
X		  case 0: cur_text_x = org_text_x - text_wid.x/2;
X			  break;
X		  case 1: break;
X		  case 2: cur_text_x = org_text_x - text_wid.x;
X			  break;
X		}
X		draw_text(cur_text_x,cur_text_y,cur_text_str,PIX_XOR);
X		pw_replrop(pw,cur_text_x+ text_wid.x ,cur_text_y- text_hgt,
X			   1,text_hgt, PIX_XOR, pattern[0],0,0);
X		break;
X
X	default :
X		/*
X		 * We got a normal char so erase the old string, then
X		 * add the new char and reprint the string
X		 */
X		pw_replrop(pw,cur_text_x+ text_wid.x ,cur_text_y- text_hgt,
X			   1,text_hgt, PIX_XOR, pattern[0],0,0);
X		draw_text(cur_text_x,cur_text_y,cur_text_str,PIX_XOR);
X		i = strlen(cur_text_str);
X		cur_text_str[i] = event_id(event);
X		cur_text_str[i+1] = '\0';
X
X      		text_wid = pf_textwidth(strlen(cur_text_str),
X		     real_font,cur_text_str);
X
X		/*
X		 * Check if the text is centered, left, or right justified
X		 */
X		switch(panel_get_value(text_choice)) {
X		  case 0: cur_text_x = org_text_x - text_wid.x/2;
X			  break;
X		  case 1: break;
X		  case 2: cur_text_x = org_text_x - text_wid.x;
X			  break;
X		}
X
X		draw_text(cur_text_x,cur_text_y,cur_text_str,PIX_XOR);
X		pw_replrop(pw,cur_text_x+ text_wid.x ,cur_text_y- text_hgt,
X			   1,text_hgt, PIX_XOR, pattern[0],0,0);
X			   
X      }
X
X      /*
X       * =========> NOTE!!!! HACK <================
X       * There seems to be a problem will pw_batch and pw_text,
X       * because on large fonts pw_batch does not update all of the
X       * canvas when the text drawn has decending characters
X       * So this HACK just fakes pw_batch into thinking that a
X       * larger area of the screen was updated, so the when it gets
X       * to pw_batch_off() the correct part of the screen is refreshed.
X       */
X      pw_rop(pw,cur_text_x,cur_text_y,
X			   text_wid.x*2,text_hgt*2, PIX_XOR,0,0,0);
X      pw_batch_off(pw);
X}
X
Xint text_cursor=FALSE;
X
X
X/*
X * We are done with the text mode, so lets do the final printing of
X * the text and clear the cursor
X */
Xfinish_text()
X{
Xstruct pr_size text_wid;
Xint ROP;
X
X  if (cur_text_str[0]) 
X   {	 
X    pw_batch_on(pw);
X    text_wid = pf_textwidth(strlen(cur_text_str),
X	real_font,cur_text_str);
X    pw_replrop(pw,cur_text_x+ text_wid.x ,cur_text_y- TEXT_HGT,
X	1,TEXT_HGT, PIX_XOR, pattern[0],0,0);
X    draw_text(cur_text_x,cur_text_y,cur_text_str,PIX_XOR);
X    if (!(ROP = get_current_ROP()))
X	 ROP = TRANSPARENT;
X    draw_text(cur_text_x,cur_text_y,cur_text_str,ROP);
X    cur_text_str[0] = '\0';
X    text_cursor = FALSE;
X    cur_text_y += TEXT_HGT;
X    pw_batch_off(pw);
X   }
X  else if (text_cursor) 
X   {	 
X    /*
X     * there is no cuurent text so just erase the cursor
X     */
X    pw_replrop(pw,cur_text_x,cur_text_y- TEXT_HGT,
X	1,TEXT_HGT, PIX_XOR, pattern[0],0,0);
X    text_cursor = FALSE;
X   }
X}
X
Xextern int get_new_font();
Xextern int change_pt_size();
Xextern Panel_item font_button;
X
X
X/*
X * Change the font of th e current TEXT string and change the
X * the size of the text cursor, but first clear off the old stuff
X */
Xchange_font(item, event)
XPanel_item item;
XEvent *event;
X{
Xstruct pr_size text_wid;
X
X  if (cur_text_str[0])
X    {
X     text_wid = pf_textwidth(strlen(cur_text_str),
X	real_font,cur_text_str);
X     pw_replrop(pw,cur_text_x+ text_wid.x ,cur_text_y- 
X	real_font->pf_defaultsize.y,
X	1, real_font->pf_defaultsize.y,
X	 PIX_XOR, pattern[0],0,0);
X     pw_text(pw,cur_text_x,cur_text_y,PIX_COLOR(cur_color) | PIX_XOR,
X		real_font,cur_text_str);
X
X     if (item == font_button)
X     	get_new_font(event);
X     else
X	change_pt_size(event);
X
X     text_wid = pf_textwidth(strlen(cur_text_str),real_font,cur_text_str);
X
X    /*
X     * Check if the text is centered, left, or right justified
X     */
X     switch(panel_get_value(text_choice)) {
X	case 0: cur_text_x = org_text_x - text_wid.x/2;
X	  break;
X	case 1: break;
X	case 2: cur_text_x = org_text_x - text_wid.x;
X	  break;
X     }
X
X     draw_text(cur_text_x,cur_text_y,cur_text_str,PIX_XOR);
X     pw_replrop(pw,cur_text_x+ text_wid.x ,cur_text_y- TEXT_HGT,
X	1,TEXT_HGT, PIX_XOR, pattern[0],0,0);
X    }
X  else if (text_cursor) 
X   {	 
X     /*
X      * There is no current text string so just change the size
X      * of the cursor to reflex the size of the font
X      */
X     pw_replrop(pw,cur_text_x,cur_text_y- 
X	real_font->pf_defaultsize.y,
X	1, real_font->pf_defaultsize.y,
X	 PIX_XOR, pattern[0],0,0);
X     if (item == font_button)
X     	get_new_font(event);
X     else
X	change_pt_size(event);
X     pw_replrop(pw,cur_text_x,cur_text_y- TEXT_HGT,
X	1,TEXT_HGT, PIX_XOR, pattern[0],0,0);
X   }
X  else
X     /*
X      * make sure we always know the last font, so that we
X      * can erase the current string
X      */
X     if (item == font_button)
X     	get_new_font(event);
X     else
X	change_pt_size(event);
X}
X
X
END_OF_fonts.c
if test 16311 -ne `wc -c <fonts.c`; then
    echo shar: \"fonts.c\" unpacked with wrong size!
fi
# end of overwriting check
fi
if test -f info.c -a "${1}" != "-c" ; then 
  echo shar: Will not over-write existing file \"info.c\"
else
echo shar: Extracting \"info.c\" \(8131 characters\)
sed "s/^X//" >info.c <<'END_OF_info.c'
X
X/**************************************************************************
X   Touchup a bitmap graphics editor for the Sun Workstation running SunView
X   Copyright (c) 1988 by Raymond Kreisel
X   1/22/88 @ Suny Stony Brook
X
X   This program may be redistributed without fee as long as this copyright
X   notice is intact.
X
X==> PLEASE send comments and bug reports to one of the following addresses:
X
X	   Ray Kreisel
X	   CS Dept., SUNY at Stony Brook, Stony Brook NY 11794
X
X	   UUCP: {allegra, philabs, pyramid, research}!sbcs!rayk   
X	   ARPA-Internet: rayk@sbcs.sunysb.edu			
X	   CSnet: rayk@suny-sb
X	   (If nobody is home at any of the above addresses try:
X		S72QKRE@TOWSONVX.BITNET			        )
X
X "If I get home before daylight, I just might get some sleep tonight...."
X
X**************************************************************************/
X/**************************************************************************
X	file: info.c
X	purpose: this file has the functions that had the "view" pop up
X		window.  You can view the "man page", copyright notice
X		with the picture of the author (me), and the cut/paste
X   		buffer
X
X	modifications:
X		date:	Tue Mar 22 22:04:58 EST 1988
X		author:	rayk
X		changes:add comments
X
X		date:	Wed Jun 15 18:12:16 EDT 1988
X		author:	rayk
X		changes:changed error messages for "info" and "help"
X			suggested by ian@sq.com
X
X**************************************************************************/
X
X#include "header.h"
X
X#include <suntool/textsw.h>
X
XFrame view_frame;
XCanvas view_canvas;
XPixwin *view_pw;
XPanel view_panel;
Xint view_flag=FALSE;
X
X#define VIEW_INFO_FLAG 2
X#define VIEW_HELP_FLAG 3
X
X/*
X * this function will read in the copyright notice
X * with my picture on it and display it in a new window
X */
Xinfo_init()
X{
XFILE *fp,*fopen();
Xint color_map=NULL;
Xstruct pixrect *temp_pr;
X
X   if (view_flag == VIEW_INFO_FLAG)
X   {
X      (void)window_set(view_frame, WIN_SHOW, TRUE, 0);
X      return;
X   }
X
X   fp = fopen(INFO_IMAGE,"r");
X   if (!fp)
X   {
X      ERRORstr("I Could not find the information file : ",INFO_IMAGE);
X      view_flag = FALSE;
X      fclose(fp);
X      return;
X   }
X   temp_pr = (struct pixrect *)pr_load(fp,color_map);
X   if (!temp_pr)
X   {
X      ERRORstr("I could not load the information file : ",INFO_IMAGE);
X      view_flag = FALSE;
X      fclose(fp);
X      return;
X   }
X   view_init(temp_pr,"Information on Touchup");
X   view_flag = VIEW_INFO_FLAG;
X   MY_pr_destroy(temp_pr);
X   fclose(fp);
X}
X
X
X/*
X * this function will let you view the cut/paste buffer
X * in a seperate window
X */
Xview_cut_paste()
X{
X   if (cut_buffer_pr)
X   {
X     view_init(cut_buffer_pr,"The current Cut/Paste Buffer");
X   }
X   else
X   {
X     ERROR("The CUT/PASTE buffer is empty.");
X   }
X}
X
X
X/*
X * we got a button click on "view"
X * check out what we need to view
X */
X#define VIEW_INFO 0
X#define VIEW_HELP 1
X#define VIEW_CUT_PASTE 2
Xviewer()
X{
X   switch((int)panel_get_value(view_cycle)) {
X	case VIEW_INFO: info_init();
X	  	   break;
X	case VIEW_CUT_PASTE: view_cut_paste();
X	  		break;
X	case VIEW_HELP: view_help();
X   }
X}
X
X
X/*
X * close up the view window
X */
Xview_done()
X{
X   if (view_flag)
X   {
X     window_set(view_frame, FRAME_NO_CONFIRM, TRUE, 0);
X     window_destroy(view_frame);
X     view_flag = FALSE;  
X   }
X}
X
X
X/*
X * this function will take a pixrect and create a new window
X * which we can view it in
X */
Xview_init(view_pr,frame_label)
Xstruct pixrect *view_pr;
Xchar *frame_label;
X{
XRect *r;
XPixwin *temp_pw;
X
X   if (view_flag)
X   {
X      view_done();
X   }
X   view_flag = TRUE;
X
X    r = (Rect *) window_get(base_frame, WIN_RECT);
X    view_frame = window_create(base_frame,FRAME,
X		FRAME_LABEL,    frame_label,
X                FRAME_INHERIT_COLORS,   TRUE,
X	        FRAME_SHOW_LABEL, TRUE,
X		WIN_FONT,	main_font,
X	        WIN_X,		(r->r_width - view_pr->pr_size.x+20)/2,
X	        WIN_Y,		(r->r_height - view_pr->pr_size.y+50)/4,
X		0);
X
X    if (view_frame == NULL)
X      {
X	ERROR("Cannot open any more windows !");
X	view_done();
X        return;
X      }
X
X    view_panel = window_create(view_frame, PANEL,
X             PANEL_LABEL_BOLD,           TRUE,
X                WIN_FONT,       main_font,
X                0);
X   
X    if (view_panel == NULL)
X      {
X	ERROR("Cannot open any more windows !");
X	view_done();
X        return;
X      }
X
X   (void)panel_create_item(view_panel, PANEL_BUTTON, 
X     PANEL_ITEM_X, ATTR_COL(0),
X     PANEL_ITEM_Y, ATTR_ROW(0),
X     PANEL_LABEL_IMAGE, panel_button_image(view_panel, "done", 5, (Pixfont *)0),
X     PANEL_NOTIFY_PROC, view_done,
X     0);
X    window_fit(view_panel);
X
X    view_canvas = 
X        window_create(view_frame, CANVAS, 
X            WIN_CONSUME_PICK_EVENTS,    WIN_NO_EVENTS,WIN_MOUSE_BUTTONS,
X                                        LOC_DRAG, LOC_WINENTER,
X                                        LOC_MOVE, 
X                                        0,
X                WIN_X,          0,
X                WIN_BELOW,      view_panel,
X            WIN_WIDTH,          view_pr->pr_size.x,
X            WIN_HEIGHT,         view_pr->pr_size.y,
X            CANVAS_WIDTH,               view_pr->pr_size.x,
X            CANVAS_HEIGHT,              view_pr->pr_size.y,
X            CANVAS_AUTO_SHRINK,         FALSE,
X            CANVAS_FIXED_IMAGE,         TRUE,
X            CANVAS_AUTO_EXPAND,         FALSE,
X            CANVAS_RETAINED,            TRUE,
X            0),
X 
X
X    view_pw = canvas_pixwin(view_canvas);
X
X
X    if ((view_pw->pw_pixrect->pr_depth > 1) && (!BW_mode))
X    {
X	pw_setcmsname(view_pw, "ray kreisel");
X	pw_putcolormap(view_pw, 0,256,red,green,blue);
X
X  	temp_pw = (Pixwin *)window_get(view_frame, WIN_PIXWIN);
X  	pw_setcmsname(temp_pw, "ray kreisel");
X  	pw_putcolormap(temp_pw, 0,256,temp_red,temp_green,temp_blue);
X
X  	temp_pw = (Pixwin *)window_get(view_panel, WIN_PIXWIN);
X  	pw_setcmsname(temp_pw, "ray kreisel");
X  	pw_putcolormap(temp_pw, 0,256,temp_red,temp_green,temp_blue);
X    }
X
X
X  /* write the image files to the canvas */
X
X   pw_write(view_pw,0,0,view_pr->pr_size.x,
X		 view_pr->pr_size.y,PIX_SRC, view_pr,0,0);
X
X   window_fit(view_frame);
X   window_set(view_frame, WIN_SHOW, TRUE, 0);
X}   
X
X
X/*
X * this function is used to view the man page
X */
Xview_help()
X{
XRect *r;
X
X   if (!file_exist(HELP_FILE))
X   {
X      ERRORstr("I cannot find the man page for touchup : ",HELP_FILE);
X      return;
X   }
X
X   if (view_flag == VIEW_HELP_FLAG)
X   {
X      (void)window_set(view_frame, WIN_SHOW, TRUE, 0);
X      return;
X   }
X   else
X   {
X      if (view_flag)
X 	 view_done();
X   }
X   view_flag = VIEW_HELP_FLAG;
X
X    r = (Rect *) window_get(base_frame, WIN_RECT);
X    view_frame = window_create(base_frame,FRAME,
X		FRAME_LABEL,    "Help window",
X	        FRAME_SHOW_LABEL, TRUE,
X		WIN_FONT,	main_font,
X	        WIN_X,		(r->r_width - 600+20)/2,
X	        WIN_Y,		(r->r_height - 512+50)/4,
X		0);
X
X    if (view_frame == NULL)
X      {
X	ERROR("Cannot open any more windows !");
X	view_done();
X        return;
X      }
X
X    view_panel = window_create(view_frame, PANEL,
X	     PANEL_LABEL_BOLD,    	 TRUE,
X	     WIN_FONT,			 main_font,
X	     WIN_X,			 0,
X	     WIN_Y,			 3,
X	     WIN_HEIGHT,		 ATTR_ROW(1)+4,
X		0);
X   
X    if (view_panel == NULL)
X      {
X	ERROR("Cannot open any more windows !");
X	view_done();
X        return;
X      }
X
X   (void)panel_create_item(view_panel, PANEL_BUTTON, 
X     PANEL_ITEM_X, ATTR_COL(0),
X     PANEL_ITEM_Y, ATTR_ROW(0),
X     PANEL_LABEL_IMAGE, panel_button_image(view_panel, "done", 5, (Pixfont *)0),
X     PANEL_NOTIFY_PROC, view_done,
X     0);
X
X
X    (void)window_create(view_frame, TEXTSW,
X		WIN_ERROR_MSG, 		"I cannot find the man page for touchup",
X                WIN_X,                  0,
X		WIN_Y,			ATTR_ROW(2)+5,
X                WIN_HEIGHT,             512,
X                WIN_WIDTH,              620,
X		TEXTSW_FONT,		main_font,
X                TEXTSW_IGNORE_LIMIT,    TEXTSW_INFINITY,
X                TEXTSW_AUTO_INDENT,     TRUE,
X                TEXTSW_BROWSING,        TRUE,
X                TEXTSW_DISABLE_LOAD,    TRUE,
X                TEXTSW_DISABLE_CD,      TRUE,
X        	TEXTSW_FILE,    	HELP_FILE,
X                0);
X
X  window_fit(view_frame);
X  window_set(view_frame, WIN_SHOW, TRUE, 0);
X}   
X
X
END_OF_info.c
if test 8131 -ne `wc -c <info.c`; then
    echo shar: \"info.c\" unpacked with wrong size!
fi
# end of overwriting check
fi
if test -f interface.c -a "${1}" != "-c" ; then 
  echo shar: Will not over-write existing file \"interface.c\"
else
echo shar: Extracting \"interface.c\" \(27164 characters\)
sed "s/^X//" >interface.c <<'END_OF_interface.c'
X
X/**************************************************************************
X   Touchup a bitmap graphics editor for the Sun Workstation running SunView
X   Copyright (c) 1988 by Raymond Kreisel
X   1/22/88 @ Suny Stony Brook
X
X   This program may be redistributed without fee as long as this copyright
X   notice is intact.
X
X==> PLEASE send comments and bug reports to one of the following addresses:
X
X	   Ray Kreisel
X	   CS Dept., SUNY at Stony Brook, Stony Brook NY 11794
X
X	   UUCP: {allegra, philabs, pyramid, research}!sbcs!rayk   
X	   ARPA-Internet: rayk@sbcs.sunysb.edu			
X	   CSnet: rayk@suny-sb
X	   (If nobody is home at any of the above addresses try:
X		S72QKRE@TOWSONVX.BITNET			        )
X
X "If I get home before daylight, I just might get some sleep tonight...."
X
X**************************************************************************/
X/**************************************************************************
X	file: interface.c
X	purpose: this file contains all of the window defs for touchup
X
X	modifications:
X		date:	Tue Mar 22 22:04:58 EST 1988
X		author:	rayk
X		changes:add comments
X
X		date:	Fri Apr 15 01:18:05 EDT 1988
X		author:	rayk
X		changes:added scroll by line to drawing area
X**************************************************************************/
X
X#include"header.h"
Xextern int change_font();
Xextern int change_pt_size();
Xextern void yes_no();
XCursor fat_cursor;
X
Xextern Panel_item       red_slide, green_slide, blue_slide;
Xextern Panel_item       col_file;
Xextern Panel_item       cur_col_msg;
Xextern int col_change();
Xextern int col_load(), col_save(), make_new_col_name();
X
Xstatic short icon_data[] = {
X#include "touchup.icon"
X};
Xstatic mpr_static(touchup_pr, 64, 64, 1, icon_data);
X
X
X    Frame base_frame,fat_frame,color_frame;
X    Frame confirmer;
X    Canvas canvas,fat_canvas,color_canvas;
X    Pixwin *pw,*fat_pw,*color_pw;
X    Panel       panel,fat_panel,color_panel,pattern_panel,
X		brush_panel,region_panel,command_panel, text_panel;
X    Panel_item magnify_cycle,grid_cycle,view_cycle,ROP_cycle;
X    Panel_item  file_panel,brush_choice,mono_cycle,save_cycle,border_cycle,
X		msg_string,color_button,current_pattern,
X		load_cycle,pattern_choice,command_choice,region_choice,
X		compress_cycle,text_size_item,undo_button,width_text,
X		height_text,resize_button,yes_button,no_button,
X		lasso_remove, text_choice;
X   Panel	con_panel;
X   Panel_item con_msg_string, font_button;
X
X   struct pixrect *pattern[PATTERN_NO];
X   struct pixrect *brushes[BRUSH_NO];
X  
X
X
X
X/*
X * Build all of the window that we need for touchup
X */
Xinit_windows(argcp,argvp) int *argcp; char **argvp;
X{
X
X    base_frame = window_create(NULL,FRAME,
X		FRAME_LABEL,    "TouchUp version 2.5",
X		FRAME_ICON,	    icon_create(ICON_IMAGE, &touchup_pr, 0),
X		FRAME_ARGC_PTR_ARGV,	argcp,argvp,
X		FRAME_INHERIT_COLORS,  TRUE,
X		WIN_FONT,	main_font,
X		WIN_WIDTH,	1030,
X		WIN_HEIGHT,	670+ATTR_ROW(10),
X		WIN_X,		10,
X		WIN_Y,		10,
X		0);
X
X    panel = window_create(base_frame, PANEL,
X	     PANEL_LABEL_BOLD,    	 TRUE,
X	     WIN_FONT,		 	 main_font,
X	     WIN_X,			 0,
X	     WIN_Y,			 3,
X	     WIN_HEIGHT,		 ATTR_ROW(5),
X 	     PANEL_HEIGHT,		 ATTR_ROW(11),
X		0);
X
X  if (BW_mode)
X
X    canvas = 
X        window_create(base_frame, CANVAS, 
X	    WIN_VERTICAL_SCROLLBAR,	scrollbar_create(SCROLL_LINE_HEIGHT,20,0),
X	    WIN_HORIZONTAL_SCROLLBAR,	scrollbar_create(SCROLL_LINE_HEIGHT,20,0),
X	    WIN_CONSUME_PICK_EVENTS,	WIN_NO_EVENTS,WIN_MOUSE_BUTTONS,
X					LOC_DRAG,
X					LOC_MOVE,
X					0,
X	    WIN_CONSUME_KBD_EVENTS,	WIN_ASCII_EVENTS,
X					0,
X	    WIN_EVENT_PROC, 		handle_event,
X	    WIN_WIDTH,			780,
X/*	    WIN_HEIGHT,		 	650, */
X	    WIN_X,			PATTERN_SIZE*2+70,
X	    WIN_Y,			ATTR_ROW(8)+12,
X	    CANVAS_AUTO_SHRINK,		FALSE,
X	    CANVAS_AUTO_EXPAND,		FALSE,
X	    CANVAS_FIXED_IMAGE,		FALSE,
X	    CANVAS_RETAINED,		FALSE,
X	    CANVAS_WIDTH,		image_wid,
X	    CANVAS_HEIGHT,		image_hgt,
X	    CANVAS_DEPTH,		1,
X	    WIN_BELOW,			panel,
X	    0);
X
X  else
X
X    canvas = 
X        window_create(base_frame, CANVAS, 
X	    WIN_VERTICAL_SCROLLBAR,	scrollbar_create(SCROLL_LINE_HEIGHT,20,0),
X	    WIN_HORIZONTAL_SCROLLBAR,	scrollbar_create(SCROLL_LINE_HEIGHT,20,0),
X	    WIN_CONSUME_PICK_EVENTS,	WIN_NO_EVENTS,WIN_MOUSE_BUTTONS,
X					LOC_DRAG,
X					LOC_MOVE,
X					0,
X	    WIN_CONSUME_KBD_EVENTS,	WIN_ASCII_EVENTS,
X					0,
X	    WIN_EVENT_PROC, 		handle_event,
X	    WIN_WIDTH,			780,
X/*	    WIN_HEIGHT,		 	650, */
X	    WIN_X,			PATTERN_SIZE*2+70,
X	    WIN_Y,			ATTR_ROW(8)+12,
X	    CANVAS_AUTO_SHRINK,		FALSE,
X	    CANVAS_AUTO_EXPAND,		FALSE,
X	    CANVAS_FIXED_IMAGE,		FALSE,
X	    CANVAS_RETAINED,		FALSE,
X	    CANVAS_WIDTH,		image_wid,
X	    CANVAS_HEIGHT,		image_hgt,
X	    WIN_BELOW,			panel,
X	    0);
X
X
X    pw = canvas_pixwin(canvas);
X
X
X    command_panel = window_create(base_frame, PANEL,
X	     WIN_FONT,			main_font,
X/*	     WIN_X,			 1000-(COMMAND_SIZE*2+32), */
X	     WIN_Y,			 ATTR_ROW(7)+12,
X	     WIN_WIDTH,			 COMMAND_SIZE*2+5,
X
X	     WIN_HEIGHT,		 COMMAND_SIZE*COMMAND_NO/2+9,
X	     WIN_RIGHT_OF,		 canvas,
X	     WIN_BELOW,			 panel,
X		0);
X
X   command_choice = panel_create_item(command_panel, PANEL_CHOICE, 
X	     PANEL_LABEL_BOLD,    	 TRUE,
X	     PANEL_SHOW_MENU,		 FALSE,
X	     PANEL_LAYOUT,		PANEL_VERTICAL,
X	     PANEL_VALUE, 		6,
X	     PANEL_LABEL_X,		10,
X	     PANEL_LABEL_Y,		4,
X	     PANEL_DISPLAY_LEVEL,	PANEL_ALL,
X	     PANEL_FEEDBACK,		PANEL_INVERTED,
X	     PANEL_CHOICE_IMAGES,	&command12_pr,&command5_pr,
X					&command13_pr,&command14_pr,
X					&command1_pr,&command6_pr,
X					&command15_pr,&command3_pr,
X					&command4_pr,&command16_pr,
X					&command11_pr,&command10_pr,
X					&command2_pr,&command7_pr,
X					&command9_pr,&command8_pr,
X					0,
X	     PANEL_CHOICE_XS,		1,51,1,51,1,51,
X					1,51,1,51,1,51,
X					1,51,1,51,
X					0,
X	     
X	     PANEL_CHOICE_YS,		1,1,
X					50,50,
X					99,99,
X					148,148,
X					197,197,
X					246,246,
X					295,295,
X					344,344,
X					0,
X	     PANEL_NOTIFY_PROC, 	command_handle,
X	     0);
X
X
X    brush_panel = window_create(base_frame, PANEL,
X	     WIN_FONT,			main_font,
X	     WIN_SHOW,			TRUE,
X	     WIN_X,			 1000-(COMMAND_SIZE*2+32),
X	     WIN_Y,			 COMMAND_SIZE*COMMAND_NO/2+9+ATTR_ROW(7)+14,
X	     WIN_WIDTH,			 COMMAND_SIZE*2+5,
X/*	     WIN_HEIGHT,		 COMMAND_SIZE*4+15, */
X	     WIN_BELOW,			 command_panel,
X	     WIN_RIGHT_OF,		 canvas,
X		0);
X
X   brush_choice = panel_create_item(brush_panel, PANEL_CHOICE, 
X	     PANEL_LABEL_BOLD,    	 TRUE,
X	     PANEL_SHOW_MENU,		 FALSE,
X	     PANEL_LAYOUT,		PANEL_VERTICAL,
X	     PANEL_VALUE, 		3,
X	     PANEL_LABEL_X,		10,
X	     PANEL_LABEL_Y,		4,
X	     PANEL_DISPLAY_LEVEL,	PANEL_ALL,
X	     PANEL_FEEDBACK,		PANEL_MARKED,
X	     PANEL_NOTIFY_PROC, 	change_brush,
X	     PANEL_CHOICE_IMAGES,	&brush1_pr,&brush2_pr,
X					&brush3_pr,&brush4_pr,
X					&brush5_pr,&brush6_pr,
X					&brush7_pr,
X					0,
X	     PANEL_CHOICE_XS,		51,51,51,51,51,51,51,
X					0,
X	     
X	     PANEL_CHOICE_YS,		1,
X					35,69,
X					103,137,
X					171,205,
X					0,
X	     PANEL_MARK_XS,		3,
X					0,
X	     
X	     PANEL_MARK_YS,		1,
X					35,69,
X					103,137,
X					171,205,
X					0,
X	     0);
X
X  brushes[0] = &brush1_pr;
X  brushes[1] = &brush2_pr;
X  brushes[2] = &brush3_pr;
X  brushes[3] = &brush4_pr;
X  brushes[4] = &brush5_pr;
X  brushes[5] = &brush6_pr;
X  brushes[6] = &brush7_pr;
X
X
X    region_panel = window_create(base_frame, PANEL,
X	     WIN_FONT,			main_font,
X	     WIN_SHOW,			FALSE,
X	     WIN_X,			 1000-(COMMAND_SIZE*2+32),
X	     WIN_Y,			 COMMAND_SIZE*COMMAND_NO/2+9+ATTR_ROW(7)+14,
X	     WIN_WIDTH,			 COMMAND_SIZE*2+5,
X/*	     WIN_HEIGHT,		 COMMAND_SIZE*4+4, */
X	     WIN_BELOW,			 command_panel,
X	     WIN_RIGHT_OF,		 canvas,
X		0);
X
X   region_choice = panel_create_item(region_panel, PANEL_CHOICE, 
X	     PANEL_LABEL_BOLD,    	 TRUE,
X	     PANEL_SHOW_MENU,		 FALSE,
X	     PANEL_LAYOUT,		PANEL_VERTICAL,
X	     PANEL_VALUE, 		PASTE,
X	     PANEL_LABEL_X,		10,
X	     PANEL_LABEL_Y,		4,
X	     PANEL_DISPLAY_LEVEL,	PANEL_ALL,
X	     PANEL_FEEDBACK,		PANEL_INVERTED,
X	     PANEL_CHOICE_IMAGES,	&reg_command2_pr,&reg_command3_pr,
X					&reg_command4_pr,&reg_command7_pr,
X					&reg_command5_pr,&reg_command9_pr,
X					&reg_command8_pr,&reg_command1_pr,
X					&reg_command6_pr,
X					0,
X	     PANEL_CHOICE_XS,		1,51,1,51,1,51,1,51,51,
X					0,
X	     
X	     PANEL_CHOICE_YS,		1,1,
X					50,50,
X					99,99,
X					148,148,
X					197,
X					0,
X	     PANEL_NOTIFY_PROC, 	region_handle,
X	     0);
X
X
X    text_panel = window_create(base_frame, PANEL,
X	     WIN_FONT,			main_font,
X	     WIN_SHOW,			FALSE,
X	     WIN_X,			 1000-(COMMAND_SIZE*2+32),
X	     WIN_Y,			 COMMAND_SIZE*COMMAND_NO/2+9+ATTR_ROW(7)+14,
X	     WIN_WIDTH,			 COMMAND_SIZE*2+5,
X/*	     WIN_HEIGHT,		 COMMAND_SIZE*4+4, */
X	     WIN_BELOW,			 command_panel,
X	     WIN_RIGHT_OF,		 canvas,
X		0);
X
X   text_choice = panel_create_item(text_panel, PANEL_CHOICE, 
X	     PANEL_LABEL_BOLD,    	 TRUE,
X	     PANEL_SHOW_MENU,		 FALSE,
X	     PANEL_LAYOUT,		PANEL_VERTICAL,
X	     PANEL_VALUE, 		1,
X	     PANEL_LABEL_X,		10,
X	     PANEL_LABEL_Y,		4,
X	     PANEL_DISPLAY_LEVEL,	PANEL_ALL,
X	     PANEL_FEEDBACK,		PANEL_INVERTED,
X	     PANEL_CHOICE_IMAGES,	&text_center_pr,&text_left_pr,
X					&text_right_pr,0,
X	     PANEL_CHOICE_XS,		1,51,25,0,
X	     PANEL_CHOICE_YS,		1,1,50,0,
X	     0);
X
X
X     font_button = panel_create_item(text_panel, PANEL_BUTTON, 
X     PANEL_ITEM_X, ATTR_COL(1),
X     PANEL_ITEM_Y, ATTR_ROW(5),
X     PANEL_LABEL_IMAGE, panel_button_image(text_panel, "fonts", 8, (Pixfont *)0),
X     PANEL_NOTIFY_PROC, change_font,
X     0);
X
X     panel_create_item(text_panel, PANEL_BUTTON,
X     PANEL_ITEM_X, ATTR_COL(1),
X     PANEL_ITEM_Y, ATTR_ROW(7),
X     PANEL_LABEL_IMAGE, panel_button_image(text_panel, "pt size", 8,(Pixfont *)0),
X     PANEL_NOTIFY_PROC, change_font,
X     0);
X
X
X    pattern_panel = window_create(base_frame, PANEL,
X	     WIN_FONT,			main_font,
X	     WIN_X,			 0,
X	     WIN_Y,			ATTR_ROW(7)+12,
X 	     WIN_BELOW,			panel,
X	     WIN_WIDTH,			 PATTERN_SIZE*2+65,
X/*	     WIN_HEIGHT,		 PATTERN_SIZE*PATTERN_NO/2+22, */
X		0);
X
X   (void)panel_create_item(pattern_panel, PANEL_BUTTON, 
X     PANEL_ITEM_X, ATTR_COL(0),
X     PANEL_ITEM_Y, PATTERN_SIZE*PATTERN_NO/2+40,
X     PANEL_LABEL_IMAGE, panel_button_image(panel, "define pattern", 14, (Pixfont *)0),
X     PANEL_NOTIFY_PROC, pattern_define,
X     0);
X
X   pattern_choice = panel_create_item(pattern_panel, PANEL_CHOICE, 
X	     PANEL_LABEL_BOLD,    	 TRUE,
X	     PANEL_SHOW_MENU,		 FALSE,
X	     PANEL_LAYOUT,		PANEL_VERTICAL,
X	     PANEL_LABEL_X,		10,
X	     PANEL_LABEL_Y,		4,
X	     PANEL_VALUE, 		0,
X	     PANEL_DISPLAY_LEVEL,	PANEL_ALL,
X	     PANEL_FEEDBACK,		PANEL_MARKED,
X	     PANEL_NOTIFY_PROC, 	select_pattern,
X	     PANEL_CHOICE_IMAGES,	&pattern1_pr,&pattern2_pr,&pattern3_pr,
X					&pattern4_pr,&pattern5_pr,
X					&pattern6_pr,&pattern7_pr,
X					&pattern8_pr,&pattern9_pr,
X					&pattern10_pr,
X	     				&pattern11_pr,&pattern12_pr,&pattern13_pr,
X					&pattern14_pr,&pattern15_pr,
X					&pattern16_pr,&pattern17_pr,
X					&pattern18_pr,&pattern19_pr,
X					&pattern20_pr,
X	     				&pattern21_pr,&pattern22_pr,&pattern23_pr,
X					&pattern24_pr,&pattern25_pr,
X					&pattern26_pr,&pattern27_pr,
X					&pattern28_pr,&pattern29_pr,
X					&pattern30_pr,
X	     				&pattern31_pr,&pattern32_pr,&pattern33_pr,
X					&pattern34_pr,&pattern35_pr,
X					&pattern36_pr,&pattern37_pr,
X					&pattern38_pr,&pattern39_pr,
X					&pattern40_pr,0,
X	     PANEL_CHOICE_XS,		25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,88,88,88,88,88,88,88,88,88,88,88,88,88,88,88,88,88,88,88,88,0,
X	     
X	     PANEL_CHOICE_YS,		1+35,33+35,65+35,97+35,129+35,161+35,193+35,225+35,257+35,289+35,
X					321+35,353+35,385+35,417+35,449+35,481+35,513+35,545+35,577+35,609+35,
X	     				1+35,33+35,65+35,97+35,129+35,161+35,193+35,225+35,257+35,289+35,
X					321+35,353+35,385+35,417+35,449+35,481+35,513+35,545+35,577+35,609+35,0,
X	     PANEL_MARK_XS,		3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,60,60,60,60,60,60,60,60,60,60,60,60,60,60,60,60,60,60,60,60,0,
X	     PANEL_MARK_YS,		8+35,40+35,72+35,104+35,136+35,168+35,200+35,232+35,266+35,296+35,
X					328+35,360+35,392+35,426+35,456+35,488+35,520+35,552+35,584+35,616+35,
X	     				8+35,40+35,72+35,104+35,136+35,168+35,200+35,232+35,266+35,296+35,
X					328+35,360+35,392+35,426+35,456+35,488+35,520+35,552+35,584+35,616+35,0,
X
X     0);
X
X  pattern[0] = &pattern1_pr;
X  pattern[1] = &pattern2_pr;
X  pattern[2] = &pattern3_pr;
X  pattern[3] = &pattern4_pr;
X  pattern[4] = &pattern5_pr;
X  pattern[5] = &pattern6_pr;
X  pattern[6] = &pattern7_pr;
X  pattern[7] = &pattern8_pr;
X  pattern[8] = &pattern9_pr;
X  pattern[9] = &pattern10_pr;
X  pattern[10] = &pattern11_pr;
X  pattern[11] = &pattern12_pr;
X  pattern[12] = &pattern13_pr;
X  pattern[13] = &pattern14_pr;
X  pattern[14] = &pattern15_pr;
X  pattern[15] = &pattern16_pr;
X  pattern[16] = &pattern17_pr;
X  pattern[17] = &pattern18_pr;
X  pattern[18] = &pattern19_pr;
X  pattern[19] = &pattern20_pr;
X  pattern[20] = &pattern21_pr;
X  pattern[21] = &pattern22_pr;
X  pattern[22] = &pattern23_pr;
X  pattern[23] = &pattern24_pr;
X  pattern[24] = &pattern25_pr;
X  pattern[25] = &pattern26_pr;
X  pattern[26] = &pattern27_pr;
X  pattern[27] = &pattern28_pr;
X  pattern[28] = &pattern29_pr;
X  pattern[29] = &pattern30_pr;
X  pattern[30] = &pattern31_pr;
X  pattern[31] = &pattern32_pr;
X  pattern[32] = &pattern33_pr;
X  pattern[33] = &pattern34_pr;
X  pattern[34] = &pattern35_pr;
X  pattern[35] = &pattern36_pr;
X  pattern[36] = &pattern37_pr;
X  pattern[37] = &pattern38_pr;
X  pattern[38] = &pattern39_pr;
X  pattern[39] = &pattern40_pr;
X
X   current_pattern = panel_create_item(pattern_panel, PANEL_MESSAGE, 
X     PANEL_ITEM_X, ATTR_COL(6),
X     PANEL_ITEM_Y, 3,
X     PANEL_LABEL_IMAGE, &pattern1_pr,
X     0);
X
X  image_depth = pw->pw_pixrect->pr_depth;
X
X  if (BW_mode)
X	image_depth = 1;
X
X  if (image_depth > 1)
X    {
X         color_frame = window_create(base_frame,FRAME,
X                FRAME_LABEL,    "Color Palette",
X                FRAME_SHOW_LABEL, TRUE,
X                FRAME_INHERIT_COLORS,  TRUE,
X                WIN_FONT,       main_font,
X#if 0
X                WIN_WIDTH,      PALET_BLOCK*16+9,
X                WIN_HEIGHT,     PALET_BLOCK*(16+3)+20+ATTR_ROW(2),
X#endif
X                WIN_X,          650,
X                WIN_Y,          10,
X                0);
X
X    color_panel = window_create(color_frame, PANEL,
X             PANEL_LABEL_BOLD,           TRUE,
X                WIN_FONT,       main_font,
X                0);
X   (void)panel_create_item(color_panel, PANEL_BUTTON,
X     PANEL_ITEM_X, ATTR_COL(0),
X     PANEL_ITEM_Y, ATTR_ROW(0),
X     PANEL_LABEL_IMAGE, panel_button_image(color_panel, "done", 5, (Pixfont *)0),
X     PANEL_NOTIFY_PROC, color_done,
X     0);
X   panel_create_item(color_panel, PANEL_MESSAGE,
X     PANEL_ITEM_X, ATTR_COL(8),
X     PANEL_ITEM_Y, ATTR_ROW(0),
X     PANEL_LABEL_STRING, "Current Color:",
X     0);
X   cur_col_msg= panel_create_item(color_panel, PANEL_MESSAGE,
X     PANEL_LABEL_STRING, "1",
X     0);
X        red_slide= panel_create_item(color_panel, PANEL_SLIDER,
X                PANEL_ITEM_Y,           ATTR_ROW(1),
X                PANEL_ITEM_X,           ATTR_COL(0),
X                PANEL_LABEL_STRING,     "Red:  ",
X                PANEL_SHOW_RANGE,       FALSE,
X                PANEL_MAX_VALUE,        255,
X                PANEL_SLIDER_WIDTH,     100,
X                PANEL_VALUE,            red[0],
X                PANEL_NOTIFY_LEVEL,     PANEL_ALL,
X                PANEL_NOTIFY_PROC,      col_change,
X                PANEL_CLIENT_DATA,      0,
X                0);
X        green_slide= panel_create_item(color_panel, PANEL_SLIDER,
X                PANEL_ITEM_Y,           ATTR_ROW(2),
X                PANEL_ITEM_X,           ATTR_COL(0),
X                PANEL_LABEL_STRING,     "Green:",
X                PANEL_SHOW_RANGE,       FALSE,
X                PANEL_MAX_VALUE,        255,
X                PANEL_SLIDER_WIDTH,     100,
X                PANEL_VALUE,            green[0],
X                PANEL_NOTIFY_LEVEL,     PANEL_ALL,
X                PANEL_NOTIFY_PROC,      col_change,
X                PANEL_CLIENT_DATA,      1,
X                0);
X        blue_slide= panel_create_item(color_panel, PANEL_SLIDER,
X                PANEL_ITEM_Y,           ATTR_ROW(3),
X                PANEL_ITEM_X,           ATTR_COL(0),
X                PANEL_LABEL_STRING,     "Blue: ",
X                PANEL_SHOW_RANGE,       FALSE,
X                PANEL_MAX_VALUE,        255,
X                PANEL_SLIDER_WIDTH,     100,
X                PANEL_VALUE,            blue[0],
X                PANEL_NOTIFY_PROC,      col_change,
X                PANEL_NOTIFY_LEVEL,     PANEL_ALL,
X                PANEL_CLIENT_DATA,      2,
X                0);
X
X        panel_create_item(color_panel, PANEL_BUTTON,
X                PANEL_ITEM_Y,           ATTR_ROW(4),
X                PANEL_ITEM_X,           ATTR_COL(0),
X                PANEL_NOTIFY_PROC,      col_load,
X                PANEL_LABEL_IMAGE,      panel_button_image(
X                        color_panel, "Load", 0, (Pixfont *) NULL),
X                0);
X        panel_create_item(color_panel, PANEL_BUTTON,
X                PANEL_NOTIFY_PROC,      col_save,
X                PANEL_LABEL_IMAGE,      panel_button_image(
X                        color_panel, "Save", 0, (Pixfont *) NULL),
X                0);
X        col_file= panel_create_item(color_panel, PANEL_TEXT,
X                PANEL_ITEM_Y,           ATTR_ROW(5),
X                PANEL_ITEM_X,           ATTR_COL(0),
X                PANEL_LABEL_STRING,     "Filename:",
X                PANEL_VALUE_DISPLAY_LENGTH, 19,
X                PANEL_NOTIFY_PROC, make_new_col_name,
X                PANEL_NOTIFY_STRING, "\033",
X                PANEL_VALUE_STORED_LENGTH, MAX_FILE_NAME,
X                0);
X    window_fit(color_panel);
X
X
X          color_canvas =
X            window_create(color_frame, CANVAS,
X            WIN_CONSUME_PICK_EVENTS,    WIN_NO_EVENTS,WIN_MOUSE_BUTTONS,
X                                        0,
X            WIN_EVENT_PROC,             color_handle_event,
X                WIN_X,          0,
X                WIN_BELOW,      color_panel,
X            WIN_WIDTH,                  PALET_BLOCK*16,
X            WIN_HEIGHT,                 PALET_BLOCK*(16+3),
X            CANVAS_WIDTH,               PALET_BLOCK*16,
X            CANVAS_HEIGHT,              PALET_BLOCK*(16+3),
X            CANVAS_AUTO_SHRINK,         FALSE,
X            CANVAS_FIXED_IMAGE,         TRUE,
X            CANVAS_AUTO_EXPAND,         FALSE,
X            CANVAS_REPAINT_PROC,        draw_colormap,
X            CANVAS_RESIZE_PROC,         draw_colormap,
X            0),
X
X        color_pw = canvas_pixwin(color_canvas);
X
X        window_fit(color_frame);
X    }
X
X
X   
X    fat_frame = window_create(base_frame,FRAME,
X		FRAME_LABEL,    "Big bits",
X	        FRAME_SHOW_LABEL, TRUE,
X		FRAME_INHERIT_COLORS,  TRUE,
X		WIN_FONT,	main_font,
X		WIN_WIDTH,	ATTR_COL(31),
X		WIN_HEIGHT,	ATTR_ROW(24),
X	     WIN_X,			 0,
X	     WIN_Y,			ATTR_ROW(8)+12,
X		0);
X
X    fat_canvas = 
X        window_create(fat_frame, CANVAS, 
X	    WIN_CONSUME_PICK_EVENTS,	WIN_NO_EVENTS,WIN_MOUSE_BUTTONS,
X					LOC_DRAG,
X					LOC_MOVE, 
X					0,
X	    WIN_EVENT_PROC, 		fat_handle_event,
X		WIN_X,		0,
X		WIN_Y,		ATTR_ROW(2)+5,
X	    CANVAS_WIDTH,		ATTR_COL(30),
X	    CANVAS_HEIGHT,		ATTR_ROW(14),
X	    CANVAS_AUTO_SHRINK,		TRUE,
X	    CANVAS_FIXED_IMAGE,		FALSE,
X	    CANVAS_AUTO_EXPAND,		TRUE,
X	    CANVAS_RETAINED,		TRUE,
X	    0),
X
X    fat_pw = canvas_pixwin(fat_canvas);
X
X    fat_panel = window_create(fat_frame, PANEL,
X	     PANEL_LABEL_BOLD,    	 TRUE,
X		WIN_FONT,	main_font,
X	     WIN_X,			 0,
X	     WIN_Y,			 3,
X	     WIN_WIDTH,			 ATTR_COL(30),
X	     WIN_HEIGHT,		 ATTR_ROW(1)+4,
X		0);
X   
X    magnify_cycle = 
X	panel_create_item(fat_panel, PANEL_CYCLE,
X	    PANEL_ITEM_X, ATTR_COL(8),
X	    PANEL_ITEM_Y, ATTR_ROW(0),
X	    PANEL_LABEL_STRING, "Magnification:",
X	    PANEL_CHOICE_STRINGS, "1x", "2x","3x","4x",
X				  "5x","6x","7x","8x","9x",
X				  "10x","11x","12x","13x","14x",
X				  "15x","16x","17x","18x","19x",
X				  "20x", 0,
X	    PANEL_VALUE, 8,
X	    PANEL_NOTIFY_PROC, fat_parms,
X	    0);
X
X   (void)panel_create_item(fat_panel, PANEL_BUTTON, 
X     PANEL_ITEM_X, ATTR_COL(0),
X     PANEL_ITEM_Y, ATTR_ROW(0),
X     PANEL_LABEL_IMAGE, panel_button_image(fat_panel, "done", 5, (Pixfont *)0),
X     PANEL_NOTIFY_PROC, fat_done,
X     0);
X
X
X   (void)panel_create_item(panel, PANEL_BUTTON, 
X     PANEL_ITEM_X, ATTR_COL(8),
X     PANEL_ITEM_Y, ATTR_ROW(1),
X     PANEL_LABEL_IMAGE, panel_button_image(panel, "view", 5, (Pixfont *)0),
X     PANEL_NOTIFY_PROC, viewer,
X     0);
X
X    view_cycle =
X	panel_create_item(panel, PANEL_CYCLE,
X	    PANEL_ITEM_X, ATTR_COL(16),
X	    PANEL_ITEM_Y, ATTR_ROW(1),
X	    PANEL_LABEL_STRING, "View:",
X	    PANEL_CHOICE_STRINGS, "Touchup info", "man page (help)", "Cut/Paste buffer", 0,
X	    PANEL_VALUE, 1,
X	    0);
X
X   (void)panel_create_item(panel, PANEL_BUTTON, 
X     PANEL_ITEM_X, ATTR_COL(8),
X     PANEL_ITEM_Y, ATTR_ROW(0),
X     PANEL_LABEL_IMAGE, panel_button_image(panel, "load", 5, (Pixfont *)0),
X     PANEL_NOTIFY_PROC, load_file,
X     0);
X    load_cycle =
X	panel_create_item(panel, PANEL_CYCLE,
X	    PANEL_ITEM_X, ATTR_COL(16),
X	    PANEL_ITEM_Y, ATTR_ROW(0),
X	    PANEL_LABEL_STRING, "Load:",
X	    PANEL_CHOICE_STRINGS, "entire image", "Cut/Paste buffer", 0,
X	    PANEL_VALUE, LOAD_ALL,
X	    0);
X
X   (void)panel_create_item(panel, PANEL_BUTTON, 
X     PANEL_ITEM_X, ATTR_COL(45),
X     PANEL_ITEM_Y, ATTR_ROW(0),
X     PANEL_LABEL_IMAGE, panel_button_image(panel, "save", 5, (Pixfont *)0),
X     PANEL_NOTIFY_PROC, save_file,
X     0);
X
X    save_cycle =
X	panel_create_item(panel, PANEL_CYCLE,
X	    PANEL_ITEM_X, ATTR_COL(53),
X	    PANEL_ITEM_Y, ATTR_ROW(0),
X	    PANEL_LABEL_STRING, "Save:",
X	    PANEL_CHOICE_STRINGS, "entire image", "Cut/Paste buffer", 0,
X	    PANEL_VALUE, SAVE_ALL,
X	    0);
X
X    compress_cycle =
X	panel_create_item(panel, PANEL_CYCLE,
X	    PANEL_ITEM_X, ATTR_COL(53),
X	    PANEL_ITEM_Y, ATTR_ROW(1),
X	    PANEL_LABEL_STRING, "Save:",
X	    PANEL_CHOICE_STRINGS, "Standard format","Byte_Encoded",0,
X	    PANEL_VALUE, 0,
X	    0);
X
X   (void)panel_create_item(panel, PANEL_BUTTON, 
X     PANEL_ITEM_X, ATTR_COL(0),
X     PANEL_ITEM_Y, ATTR_ROW(0),
X     PANEL_LABEL_IMAGE, panel_button_image(panel, "quit", 5, (Pixfont *)0),
X     PANEL_NOTIFY_PROC, quit,
X     0);
X
X   undo_button = panel_create_item(panel, PANEL_BUTTON, 
X     PANEL_ITEM_X, ATTR_COL(0),
X     PANEL_ITEM_Y, ATTR_ROW(2),
X     PANEL_LABEL_IMAGE, panel_button_image(panel, "undo", 5, (Pixfont *)0),
X     PANEL_NOTIFY_PROC, undo_screen,
X     0);
X
X    grid_cycle =
X	panel_create_item(panel, PANEL_CYCLE,
X	    PANEL_ITEM_X, ATTR_COL(8),
X	    PANEL_ITEM_Y, ATTR_ROW(2),
X	    PANEL_LABEL_STRING, "Grid size:",
X	    PANEL_CHOICE_STRINGS, "none","5","10","15","20","25","30",0,
X	    PANEL_VALUE, grid_size,
X	    PANEL_NOTIFY_PROC, change_parms,
X	    0);
X
X    border_cycle =
X	panel_create_item(panel, PANEL_CYCLE,
X	    PANEL_ITEM_X, ATTR_COL(30),
X	    PANEL_ITEM_Y, ATTR_ROW(2),
X	    PANEL_LABEL_STRING, "Borders:",
X	    PANEL_CHOICE_STRINGS, "No","Yes",0,
X	    PANEL_VALUE, 1,
X	    0);
X
X   file_panel=panel_create_item(panel, PANEL_TEXT, 
X     PANEL_ITEM_X, ATTR_COL(80),
X     PANEL_ITEM_Y, ATTR_ROW(0),
X     PANEL_VALUE, file_name,
X     PANEL_VALUE_DISPLAY_LENGTH, 35,
X     PANEL_LABEL_STRING, "Filename:",
X     PANEL_NOTIFY_PROC, make_new_name,
X     PANEL_NOTIFY_STRING, "\033",
X     PANEL_VALUE_STORED_LENGTH, MAX_FILE_NAME,
X     PANEL_SHOW_MENU, FALSE,
X     0);
X
X    ROP_cycle =
X	panel_create_item(panel, PANEL_CYCLE,
X	    PANEL_ITEM_X, ATTR_COL(80),
X	    PANEL_ITEM_Y, ATTR_ROW(1),
X	    PANEL_LABEL_STRING, "Bitmap OP:",
X	    PANEL_CHOICE_STRINGS, "default","XOR","AND","OR","SRC",0,
X	    PANEL_VALUE, 0,
X	    PANEL_NOTIFY_PROC, change_parms,
X	    0);
X
X   resize_button = panel_create_item(panel, PANEL_BUTTON, 
X     PANEL_ITEM_X, ATTR_COL(80),
X     PANEL_ITEM_Y, ATTR_ROW(2),
X     PANEL_LABEL_IMAGE, panel_button_image(panel, "resize", 5, (Pixfont *)0),
X     PANEL_NOTIFY_PROC, resize_canvas,
X     0);
X
X   width_text=panel_create_item(panel, PANEL_TEXT, 
X     PANEL_ITEM_X, ATTR_COL(89),
X     PANEL_ITEM_Y, ATTR_ROW(2),
X     PANEL_VALUE, "1152",
X     PANEL_VALUE_DISPLAY_LENGTH, 6,
X     PANEL_LABEL_STRING, "Width:",
X     PANEL_VALUE_STORED_LENGTH, 6,
X     PANEL_SHOW_MENU, FALSE,
X     0);
X
X   height_text=panel_create_item(panel, PANEL_TEXT, 
X     PANEL_ITEM_X, ATTR_COL(103),
X     PANEL_ITEM_Y, ATTR_ROW(2),
X     PANEL_VALUE, "900",
X     PANEL_VALUE_DISPLAY_LENGTH, 6,
X     PANEL_LABEL_STRING, "Heigth:",
X     PANEL_VALUE_STORED_LENGTH, 6,
X     PANEL_SHOW_MENU, FALSE,
X     0);
X
X
X   lasso_remove=panel_create_item(panel, PANEL_TOGGLE, 
X     PANEL_ITEM_X, ATTR_COL(111),
X     PANEL_ITEM_Y, ATTR_ROW(1),
X     PANEL_SHOW_MENU, FALSE,
X     PANEL_LABEL_STRING, "lasso clear:",
X     PANEL_CHOICE_STRINGS, "",0,
X     PANEL_TOGGLE_VALUE, 0, TRUE,
X     0);
X
X    mono_cycle =
X	panel_create_item(panel, PANEL_CYCLE,
X	    PANEL_ITEM_X, ATTR_COL(48),
X	    PANEL_ITEM_Y, ATTR_ROW(2),
X	    PANEL_LABEL_STRING, "Draw color",
X	    PANEL_CHOICE_STRINGS, "WHITE", "BLACK",
X				   0,
X	    PANEL_VALUE, 1,
X	    PANEL_NOTIFY_PROC, change_parms,
X	    0);
X
X   color_button = panel_create_item(panel, PANEL_BUTTON, 
X     PANEL_ITEM_X, ATTR_COL(52),
X     PANEL_ITEM_Y, ATTR_ROW(2),
X     PANEL_SHOW_ITEM, FALSE,
X     PANEL_LABEL_IMAGE, panel_button_image(panel, "color", 5, (Pixfont *)0),
X     PANEL_NOTIFY_PROC, color_mode,
X     0);
X
X   msg_string = panel_create_item(panel, PANEL_MESSAGE, 
X     PANEL_ITEM_X, ATTR_COL(0),
X     PANEL_ITEM_Y, ATTR_ROW(4),
X     PANEL_LABEL_BOLD,    TRUE,
X     PANEL_LABEL_STRING, "",
X     0);
X
X
X/*
X * Confirmer window
X */
X   confirmer = window_create(base_frame, FRAME, 
X                WIN_WIDTH,      300,
X                WIN_HEIGHT,     150,
X		WIN_SHOW,	FALSE,
X		WIN_X,		1152/2 - 390/2,
X		WIN_Y,		900/2 - 140/2,
X                FRAME_SHOW_LABEL, FALSE,
X                                  0);
X
X   con_panel = window_create(confirmer, PANEL,
X                WIN_WIDTH,      390,
X                WIN_HEIGHT,     60,
X                                 0);
X
X   con_msg_string = panel_create_item(con_panel, PANEL_MESSAGE,
X		  PANEL_ITEM_X, 0,
X		  PANEL_ITEM_Y, 10,
X                  PANEL_LABEL_STRING, "",
X                                        0);
X
X   panel_create_item(con_panel, PANEL_BUTTON,
X                  PANEL_ITEM_X, 130,
X                  PANEL_ITEM_Y, 35,
X                  PANEL_LABEL_IMAGE, panel_button_image(con_panel,"NO",3,0),
X                  PANEL_CLIENT_DATA, FALSE,
X                  PANEL_NOTIFY_PROC, yes_no,
X                  0);
X
X   panel_create_item(con_panel, PANEL_BUTTON,
X                  PANEL_ITEM_X, 205,
X                  PANEL_ITEM_Y, 35,
X                  PANEL_LABEL_IMAGE, panel_button_image(con_panel, "YES", 3, 0),
X                  PANEL_CLIENT_DATA, TRUE,
X                  PANEL_NOTIFY_PROC, yes_no,
X                  0);
X
X   window_fit(confirmer);
X
X   
X  fat_cursor = window_get(canvas,WIN_CURSOR);
X  cursor_set(fat_cursor,CURSOR_OP,PIX_SRC^PIX_DST,0);
X  window_set(canvas,WIN_CURSOR,fat_cursor,0);
X
X#ifdef CHANGE_CURSOR
X  old_cur = cursor_copy(fat_cursor); /* Save this for later... */
X#endif
X
X  fat_cursor = window_get(fat_canvas,WIN_CURSOR);
X  cursor_set(fat_cursor,CURSOR_OP,PIX_SRC^PIX_DST,0);
X  window_set(fat_canvas,WIN_CURSOR,fat_cursor,0);
X
X}
X
X
X
X
X
END_OF_interface.c
if test 27164 -ne `wc -c <interface.c`; then
    echo shar: \"interface.c\" unpacked with wrong size!
fi
# end of overwriting check
fi
echo shar: End of archive 6 \(of 7\).
cp /dev/null ark6isdone
MISSING=""
for I in 1 2 3 4 5 6 7 ; do
    if test ! -f ark${I}isdone ; then
	MISSING="${MISSING} ${I}"
    fi
done
if test "${MISSING}" = "" ; then
    echo You have unpacked all 7 archives.
    rm -f ark[1-9]isdone
else
    echo You still need to unpack the following archives:
    echo "        " ${MISSING}
fi
##  End of shell archive.
exit 0