Пример #1
0
static void handler_right (s_window_t *window, s_event_t *event, s_handler_t *handler)
{
    if (chars_select == SELECT_MAP) {
        chars_x++;
        if (chars_x > 2) {
            chars_x = 0;
        }
        draw_boxes(window);
    } else if (chars_select == SELECT_CHAR) {
        handler_set_right(window, event, handler);
    }
}
Пример #2
0
static void handler_left (s_window_t *window, s_event_t *event, s_handler_t *handler)
{
    if (chars_select == SELECT_MAP) {
        chars_x--;
        if (chars_x < 0) {
            chars_x = 2;
        }
        draw_boxes(window);
    } else if (chars_select == SELECT_CHAR) {
        handler_set_left(window, event, handler);
    }
}
Пример #3
0
/*
 * Show the selected color of the appropiate line or page 
 */
void
nxt_to_show(int toscroll)
{
	int obj;
	WORD clip[4];
	
	open_vwork();
	rc_2xy( &desk, clip );	
	vs_clip( vhandle, 1, ( int *)clip );
	
	/* if current color is not shown, page accordingly to show it */ 
	if (curcol < headcol) {							/* page backwards */
		if ((headcol -= toscroll) < 0)	/* update color to start with */
			headcol = 0;	
		draw_boxes();					/* redraw color boxes */
	} else if (curcol >= headcol + MAX_COL_SHOWN) {	/* page forward */
		if ((headcol += toscroll) > numcol - MAX_COL_SHOWN)
			headcol = numcol - MAX_COL_SHOWN;
		draw_boxes();					/* redraw color boxes */
	}
	
	/* deselect previous color and select current one */
	obj = curcol - headcol + headbox;
	if (obj != curbox) {
		outline(curbox, DEHILITE);
		outline(obj, HILITE);
		curbox = obj;			/* update current box selected */
	}
	
	/* update color # and RGB sliders */		
	curslid = CSLIDE;
	slidtext();				/* update color # */
	if (bpg)				/* if there is color */
		update_rgb(1);		/* update and draw RGB gun values */

	close_vwork();
}
static cairo_int_status_t
_cairo_win32_gdi_compositor_paint (const cairo_compositor_t	*compositor,
				   cairo_composite_rectangles_t *composite)
{
    cairo_int_status_t status = CAIRO_INT_STATUS_UNSUPPORTED;

    if (check_blit (composite)) {
	cairo_boxes_t boxes;

	TRACE ((stderr, "%s\n", __FUNCTION__));
	_cairo_clip_steal_boxes (composite->clip, &boxes);
	status = draw_boxes (composite, &boxes);
	_cairo_clip_unsteal_boxes (composite->clip, &boxes);
    }

    return status;
}
Пример #5
0
int main (int argc, char *argv[])
{
    int x;
    int y;
    int w;
    int h;
    s_window_t *window;

    s_window_init(&window);
    s_window_new(window, WINDOW_MAIN /*| WINDOW_NOFORM*/, NULL);
    s_window_set_title(window, "Demo - %s ", argv[0]);
    s_window_set_resizeable(window, 0);
    s_window_set_alwaysontop(window, 1);

    w = BOX_W * 3;
    h = BOX_H * 3;
    x = (window->surface->linear_buf_width - w) / 2;
    y = (window->surface->linear_buf_height - h) / 2;
    s_window_set_coor(window, WINDOW_NOFORM, x, y, w, h);

    window->surface->width = window->surface->buf->w;
    window->surface->height = window->surface->buf->h;
    s_free(window->surface->vbuf);
    window->surface->vbuf = s_malloc(window->surface->width * window->surface->height * window->surface->bytesperpixel);

    draw_boxes(window);

    handler_set(window, S_KEYCODE_RIGHTSHIFT, handler_shift_up);
    handler_set(window, S_KEYCODE_LEFTSHIFT, handler_shift_down);
    handler_set(window, S_KEYCODE_LEFT, handler_left);
    handler_set(window, S_KEYCODE_RIGHT, handler_right);
    handler_set(window, S_KEYCODE_UP, handler_up);
    handler_set(window, S_KEYCODE_DOWN, handler_down);
    handler_set(window, S_KEYCODE_SPACE, handler_set_map);
    handler_set(window, S_KEYCODE_i, handler_set_up);
    handler_set(window, S_KEYCODE_j, handler_set_left);
    handler_set(window, S_KEYCODE_k, handler_set_down);
    handler_set(window, S_KEYCODE_l, handler_set_right);

    s_window_show(window);
    s_window_main(window);

    return 0;
}
Пример #6
0
/*
 * Find and redraw all clipping rectangles
 */
void
do_redraw(GRECT *dirty_rect, int *oldclip)
{
	GRECT *r1;
	WORD clip[4];
  	if (bpg > 0) {		/* only need to draw when there is color */
  		open_vwork();
		r1 = (*xcpb->GetFirstRect)(dirty_rect);
		while (r1) {
			/* set clipping rectangle */
			rc_2xy(r1, clip);
			vs_clip(vhandle, 1, (int *)clip);
			draw_boxes();
			outline( curbox, HILITE );
			r1 = (*xcpb->GetNextRect)();
		}
		vs_clip(vhandle, 1, oldclip);	/* restore original clipping */
		close_vwork();
	}
}
Пример #7
0
/*
 * Find and redraw all clipping rectangles
 */
void
do_redraw(GRECT *dirty_rect, int *oldclip)
{
	GRECT *r1;
	WORD clip[4];
	GRECT r2;

		open_vwork();
		r1 = (*xcpb->GetFirstRect)(dirty_rect);
		while (r1) {
			r2 = *r1;
			/* set clipping rectangle */
			rc_2xy( &r2, clip);
			vs_clip(vhandle, 1, (int *)clip);
			draw_boxes();
			outline( curbox, HILITE );
			r1 = (*xcpb->GetNextRect)();
		}
		vs_clip(vhandle, 1, oldclip);	/* restore original clipping */
 		close_vwork();
}
Пример #8
0
/* 
 * Show color panel
 * Passed:  GRECT *rect		= pointer to rectangle CPX resides in 
 * Returns: BOOLEAN	FALSE	= to exit CPX
 */
BOOLEAN	
cdecl  colpnl(GRECT *rect)
{
    MRETS mk;
    int quit=0;
    int obj, ox, oy;
    WORD msg[8], clip[4];
	GRECT obrect;		/* object rectangle */
    
    
    Wind_get(0, WF_WORKXYWH, (WARGS *)&obrect);	/* set clipping to */
    rc_2xy(&obrect, clip);						/*   Desktop space */
    
    open_vwork();
    vs_clip(vhandle, 1, (int *)clip);
    
  	ObX(COLPNL) = rect->g_x;					/* position panel */
 	ObY(COLPNL) = rect->g_y;
    Objc_draw(tree, COLPNL, MAX_DEPTH, NULL);	/* draw panel */
   	draw_boxes();								/* draw the color boxes */
   	outline(curbox, HILITE);					/* show selected box */
    close_vwork();
    
    if (IsSelected(INVRSVDO))	/* if Invert button is selected */
    	Deselect(INVRSVDO);		/* deselect it */
    	
    do {
    if ((obj = (*xcpb->Xform_do)(tree, COLPNL, msg)) != -1) {
    	obj &= 0x7fff;				/* mask out double clicks */
 		switch(obj) {
			case RUP:
				curslid = RSLID;
	    		(*xcpb->Sl_arrow)(tree, RBASE, RSLID, RUP, 1, val_min, 
	    			val_max, &curscrn[R], VERTICAL, adjcol);
	    		break;
			case RDOWN:
				curslid = RSLID;
	    		(*xcpb->Sl_arrow)(tree, RBASE, RSLID, RDOWN, -1, 
	    			val_min, val_max, &curscrn[R], VERTICAL, adjcol);
	    		break;
			case RSLID:
				(*xcpb->MFsave)(MFSAVE, &orig_mf);
				if( AES_Version >= 0x0320 )
				    DRAG_MOUSE;
				curslid = RSLID;
	    		(*xcpb->Sl_dragy)(tree, RBASE, RSLID, val_min, val_max, 
	    			&curscrn[R], adjcol);
	    		(*xcpb->MFsave)(MFRESTORE, &orig_mf);
	    		break;
			case RBASE:
    	   		Graf_mkstate(&mk);
    	   		objc_offset(tree, RSLID, &ox, &oy);
    	   		if(mk.y < oy)
    	   			oy = VAL_PAGE;
    	   		else
    	       		oy = -VAL_PAGE;
				curslid = RSLID;
	    		(*xcpb->Sl_arrow)(tree, RBASE, RSLID, -1, oy, val_min, 
	    			val_max, &curscrn[R], VERTICAL, adjcol);
	    		break;
	        
			case GUP:
				curslid = GSLID;
	    		(*xcpb->Sl_arrow)(tree, GBASE, GSLID, GUP, 1, val_min, 
	    			val_max, &curscrn[G], VERTICAL, adjcol);
	    		break;
			case GDOWN:
				curslid = GSLID;
	    		(*xcpb->Sl_arrow)(tree, GBASE, GSLID, GDOWN, -1, 
	    			val_min, val_max, &curscrn[G], VERTICAL, adjcol);
	    		break;
			case GSLID:
				(*xcpb->MFsave)(MFSAVE, &orig_mf);
				if( AES_Version >= 0x0320 )
				    DRAG_MOUSE;
				curslid = GSLID;
	    		(*xcpb->Sl_dragy)(tree, GBASE, GSLID, val_min, val_max, 
	    			&curscrn[G], adjcol);
	    		(*xcpb->MFsave)(MFRESTORE, &orig_mf);
	    		break;
			case GBASE:
    	   		Graf_mkstate(&mk);
    	   		objc_offset(tree, GSLID, &ox, &oy);
    	   		if(mk.y < oy)
    	   			oy = VAL_PAGE;
    	   		else
    	   	    	oy = -VAL_PAGE;
				curslid = GSLID;
	    		(*xcpb->Sl_arrow)(tree, GBASE, GSLID, -1, oy, val_min, 
	    			val_max, &curscrn[G], VERTICAL, adjcol);
	    		break;
	        
			case BUP:
				curslid = BSLID;
	    		(*xcpb->Sl_arrow)(tree, BBASE, BSLID, BUP, 1, val_min, 
	    			val_max, &curscrn[B], VERTICAL, adjcol);
	    		break;
			case BDOWN:
				curslid = BSLID;
	    		(*xcpb->Sl_arrow)(tree, BBASE, BSLID, BDOWN, -1, 
	    			val_min, val_max, &curscrn[B], VERTICAL, adjcol);
	    		break;
			case BSLID:
				(*xcpb->MFsave)(MFSAVE, &orig_mf);
				if( AES_Version >= 0x0320 )
				    DRAG_MOUSE;
				curslid = BSLID;
	    		(*xcpb->Sl_dragy)(tree, BBASE, BSLID, val_min, val_max, 
	    			&curscrn[B], adjcol);
	    		(*xcpb->MFsave)(MFRESTORE, &orig_mf);
	    		break;
			case BBASE:
    			Graf_mkstate(&mk);
    			objc_offset(tree, BSLID, &ox, &oy);
    			if(mk.y < oy)
    	  				oy = VAL_PAGE;
    			else
					oy = -VAL_PAGE;
				curslid = BSLID;
	    		(*xcpb->Sl_arrow)(tree, BBASE, BSLID, -1, oy, val_min, 
	    			val_max, &curscrn[B], VERTICAL, adjcol);
	    		break;
	    		
	    	case COLUP:
	    		(*xcpb->Sl_arrow)(tree, COLBASE, COLSLID, COLUP, -1, 
	    			col_max, col_min, &curcol, VERTICAL, nxtrow);
	    		break;
			case COLDOWN:
	    		(*xcpb->Sl_arrow)(tree, COLBASE, COLSLID, COLDOWN, 1, 
	    			col_max, col_min, &curcol, VERTICAL, nxtrow);
	    		break;
			case COLSLID:
				(*xcpb->MFsave)(MFSAVE, &orig_mf);
				if( AES_Version >= 0x0320 )
				    DRAG_MOUSE;
	    		(*xcpb->Sl_dragy)(tree, COLBASE, COLSLID, col_max, 
	    			col_min, &curcol, nxtgrp);
	    		(*xcpb->MFsave)(MFRESTORE, &orig_mf);
	    		break;
			case COLBASE:
    			Graf_mkstate(&mk);
    			objc_offset(tree, COLSLID, &ox, &oy);
    			if(mk.y < oy)
    	   			oy = -col_page;
       			else
    	    		oy = col_page;
				curslid = COLSLID;
	    		(*xcpb->Sl_arrow)(tree, COLBASE, COLSLID, -1, oy, 
	    			col_max, col_min, &curcol, VERTICAL, nxtpage);
	    		break;
	    
			case BNKRIGHT:
	    		(*xcpb->Sl_arrow)(tree, BNKBASE, BNKSLID, BNKRIGHT, 1, 
	    			BNK_MIN, BNK_MAX, &curbnk, HORIZONTAL, nxtbnk);
	    		break;
			case BNKLEFT:
	    		(*xcpb->Sl_arrow)(tree, BNKBASE, BNKSLID, BNKLEFT, -1, 
	    			BNK_MIN, BNK_MAX, &curbnk, HORIZONTAL, nxtbnk);
	    		break;
			case BNKSLID:
				(*xcpb->MFsave)(MFSAVE, &orig_mf);
				if( AES_Version >= 0x0320 )
				    DRAG_MOUSE;
	    		(*xcpb->Sl_dragx)(tree, BNKBASE, BNKSLID, BNK_MIN, 
	    			BNK_MAX, &curbnk, nxtbnk);
	    		(*xcpb->MFsave)(MFRESTORE, &orig_mf);
	    		break;
			case BNKBASE:
    			Graf_mkstate(&mk);
    			objc_offset(tree, BNKSLID, &ox, &oy);
    			if(mk.x < ox)
    	   			oy = -BNK_PAGE;
    			else
    	    		oy = BNK_PAGE;
	    		(*xcpb->Sl_arrow)(tree, BNKBASE, BNKSLID, -1, oy, 
	    			BNK_MIN, BNK_MAX, &curbnk, HORIZONTAL, nxtbnk);
	    		break;
	
			case DUO0:			/* for ST High rez */
			case DUO1:
	
			case QUARTRO0:		/* for ST Medium rez */
			case QUARTRO1:
			case QUARTRO2:
			case QUARTRO3:
		
			case BOX0:    		/* for all other rez */
			case BOX1:
			case BOX2:
			case BOX3:
			case BOX4:
			case BOX5:
			case BOX6:
			case BOX7:
			case BOX8:
			case BOX9:
			case BOX10:
			case BOX11:
			case BOX12:
			case BOX13:
			case BOX14:
			case BOX15:
				if (obj != curbox) {	/* select requested color */
					curcol = obj - headbox + headcol;
					nxt_to_show(0);
					update_slid(VERTICAL, COLBASE, COLSLID, curcol, 
						col_max, col_min, 1);
				}
	   			break;
	    
	   		case INVRSVDO:
	   			Deselect(obj);				/* deselect button */
				flip(0, &curinv);			/* read invert state */
	   			if (curinv & NOT_FLIPPED) {	/* inverted? */
	   				curinv &= 0xfffe;		/* if not, invert it */
	   			} else {					/* else */
	   				curinv |= NOT_FLIPPED;	/* restore it */
	   				draw_button(obj);		/* redraw button */
	   			}
	   			flip(1, &curinv);			/* set new invert state */
	   			
	   			if (bpg) {						/* if color */
	   				swaprgb(curnew, curnew+1);	/* swap pen 0 and 1 */
	   				open_vwork();
	   				vs_color(vhandle, 0, (int *)curnew);
	   				vs_color(vhandle, 1, (int *)(curnew+1));
	   				close_vwork();
	   				*curdirt = *(curdirt+1) = *touch_bnk = DIRTY;
	   				update_rgb(1);			/* update RGB sliders */
	   			}
	   			break;
	    
	   		case SETGRAY:
	   		case SETCOL:
	   			Deselect(obj);			/* deselect selected button */
	   			HideObj(obj);			/* hide selected button */
	   			if (obj == SETGRAY) {
	   				obj = SETCOL;		/* change to Color button */
	   				curgray = TRUE;		/* turn on hypermono */
	   			} else {
	   				obj = SETGRAY;		/* change to Gray button */
	   				curgray = FALSE;	/* turn off hypermono */
	   			}
	   			ShowObj(obj);			/* show new button */
	   			draw_button(obj);		/* draw it */
	   			Vsync();
	   			EsetGray(curgray);		/* set to selected mode */
	   			reinitcol();			/* reinit color regs */
	   			break;
	   				
			case COLSAVE:				/* save current values */
				if ((*xcpb->XGen_Alert)(SAVE_DEFAULTS) == TRUE) {
					(*xcpb->MFsave)(MFSAVE, &orig_mf);
					if( AES_Version >= 0x0320 )
					    BEE_MOUSE;
					
					if (bpg) {					/* if color */
						usr_vals.bnk = curbnk;	/* save bank # */
						savergb();				/* save color info */
												/* update RGBs */
						cpyrgb((RGB *)&oldrgb, (RGB *)&newrgb, totcol);	
					}
			
					if (currez == STHI)			/* if in ST high rez */
						usr_vals.inv = curinv;	/* save invert state */
					
					/* if hypermono supported, save state */
					if (curmode == TTVDO && currez != TTHI)
						usr_vals.gray = curgray;
		
					/* save current data to file */
					saved = 1;
					(*xcpb->CPX_Save)((void *)&saved, sizeof(DEFAULTS)+2);
					
	    			(*xcpb->MFsave)(MFRESTORE, &orig_mf);
				}
				Deselect(obj);
				draw_button(obj);	
	   			break;
	   	
			case COLCNCEL:
				cnclchgs();			/* cancel all changes made */
	   	
			case COLOK:				/* accept all changes made */
				Deselect(obj);				/* deselect button */
	   			quit = TRUE;				/* ready to quit */
	   			break;
	   			
	   		case COLRLOAD:			/* reload saved user-preference */
	   			if (saved)
	   				init(&usr_vals);
	   			else
	   				init(&def_vals);
	   			Deselect(obj);
	   			draw_button(obj);
	   			break;
	   	}
	} else {
		switch(msg[0]) {
			case WM_REDRAW:				/* redraw cpx */
				do_redraw((GRECT *)&msg[4], (int *)clip);
				break;
			
			case KEY_CODE:
				switch(msg[3]) {	/* check which key is returned */
					case UNDO:				/* if Undo key */
						/* reset to original invert state */
						if (currez == STHI && oldinv != curinv) {
							flip(1, &oldinv);
							if (!(oldinv & NOT_FLIPPED))
								Select(INVRSVDO);
							draw_button(INVRSVDO);
							Deselect(INVRSVDO);
							curinv = oldinv;
						}
						
						if (bpg) {			/* if there is color */
							if ((int)curmode == TTVDO && currez != TTHI
								&& curgray != oldgray) {
								Vsync();
								EsetGray(oldgray);
								reinitcol();
								if (oldgray) {
									HideObj(SETGRAY);
									obj = SETCOL;
								} else {
									HideObj(SETCOL);
									obj = SETGRAY;
								}
								ShowObj(obj);
								draw_button(obj);
								curgray = oldgray;
							}
							cnclbnk();		/* cancel color changes */
							update_rgb(1);	/* update RGB on screen */
						}
						break;
						
					case HOME:					/* if Clr Home key */
						if (currez != TTHI)		/* if not in TT High rez */
							init(&def_vals);	/* init to system defs */
						break;
				}
				break;
						
			case AC_CLOSE:
				cnclchgs();			/* cancel changes made */
					
			case WM_CLOSED:
				quit = TRUE;				/* ready to quit */
				break;
		}
	}
    } while (!quit);

    return (FALSE);
}
Пример #9
0
void ps_mat(char *outf,int nmat,t_matrix mat[],t_matrix mat2[],
	    bool bFrame,bool bDiag,bool bFirstDiag,
	    bool bTitle,bool bTitleOnce,bool bYonce,int elegend,
	    real size,real boxx,real boxy,char *m2p,char *m2pout,
	    int mapoffset)
{
  char   *libm2p;
  char buf[256],*legend;
  t_psdata out;
  t_psrec  psrec,*psr;
  int    W,H;
  int    i,j,x,y,col,leg=0;
  real   x0,y0,xx;
  real   w,h,dw,dh;
  int       nmap1=0,nmap2=0,leg_nmap;
  t_mapping *map1=NULL,*map2=NULL,*leg_map;
  bool   bMap1,bNextMap1,bDiscrete;
  
  libm2p = m2p ? strdup(libfn(m2p)) : m2p;
  get_params(libm2p,m2pout,&psrec);

  psr=&psrec;

  if (psr->X.major <= 0 )
    tick_spacing((mat[0].flags & MAT_SPATIAL_X) ? mat[0].nx + 1 : mat[0].nx,
		 mat[0].axis_x, psr->X.offset, 'X', 
		 &(psr->X.major), &(psr->X.minor) );
  if (psr->X.minor <= 0 )
    psr->X.minor = psr->X.major / 2;
  if (psr->Y.major <= 0)
    tick_spacing((mat[0].flags & MAT_SPATIAL_Y) ? mat[0].ny + 1 : mat[0].ny,
		 mat[0].axis_y, psr->Y.offset, 'Y',
		 &(psr->Y.major), &(psr->Y.minor) );
  if (psr->Y.minor <= 0)
    psr->Y.minor = psr->Y.major / 2;

  if (boxx>0) {
    psr->xboxsize=boxx;
    psr->yboxsize=boxx;
  }
  if (boxy>0)
    psr->yboxsize=boxy;  

  if (psr->xboxsize==0) {
    psr->xboxsize = size/mat[0].nx;
    printf("Set the x-size of the box to %.3f\n",psr->xboxsize);
  }
  if (psr->yboxsize==0) {
    psr->yboxsize = size/mat[0].nx;
    printf("Set the y-size of the box to %.3f\n",psr->yboxsize);
  }

  nmap1=0;
  for (i=0; (i<nmat); i++)
    if (mat[i].nmap>nmap1) {
      nmap1=mat[i].nmap;
      map1=mat[i].map;
      leg=i+1;
    }
  if (leg!=1)
    printf("Selected legend of matrix # %d for display\n",leg);
  if (mat2) {
    nmap2=0;
    for (i=0; (i<nmat); i++)
      if (mat2[i].nmap>nmap2) {
	nmap2=mat2[i].nmap;
	map2=mat2[i].map;
	leg=i+1;
  }
    if (leg!=1)
      printf("Selected legend of matrix # %d for second display\n",leg);
  }
  if ( (mat[0].legend[0]==0) && psr->legend )
    strcpy(mat[0].legend, psr->leglabel);

  bTitle     = bTitle     && mat[nmat-1].title[0];
  bTitleOnce = bTitleOnce && mat[nmat-1].title[0];
  psr->bTitle     = bTitle;
  psr->bTitleOnce = bTitleOnce;
  psr->bYonce     = bYonce;

  /* Set up size of box for nice colors */
  box_dim(nmat,mat,mat2,psr,elegend,bFrame,&w,&h,&dw,&dh);
  
  /* Set up bounding box */
  W=w+dw;
  H=h+dh;
  
  /* Start box at */
  x0=dw;
  y0=dh;
  x = W+psr->xoffs;
  y = H+psr->yoffs;
  if (bFrame) {
    x += 5*DDD;
    y += 4*DDD;
  }
  out=ps_open(outf,0,0,x,y);
  ps_linewidth(out,psr->linewidth);
  ps_init_rgb_box(out,psr->xboxsize,psr->yboxsize);
  ps_init_rgb_nbox(out,psr->xboxsize,psr->yboxsize);
  ps_translate(out,psr->xoffs,psr->yoffs);

  if (bFrame) {
    ps_comment(out,"Here starts the BOX drawing");  
    draw_boxes(out,x0,y0,w,nmat,mat,psr);
  }

  for(i=0; (i<nmat); i++) {
    if (bTitle || (bTitleOnce && i==nmat-1) ) {
      /* Print title, if any */
      ps_rgb(out,BLACK);
      ps_strfont(out,psr->titfont,psr->titfontsize); 
      if (!mat2 || (strcmp(mat[i].title,mat2[i].title) == 0))
	strcpy(buf,mat[i].title);
      else
	sprintf(buf,"%s / %s",mat[i].title,mat2[i].title);
      ps_ctext(out,x0+w/2,y0+box_height(&(mat[i]),psr)+psr->titfontsize,
	       buf,eXCenter);
    }
    sprintf(buf,"Here starts the filling of box #%d",i);
    ps_comment(out,buf);
    for(x=0; (x<mat[i].nx); x++) {
      int nexty;
      int nextcol;
      
      xx=x0+x*psr->xboxsize;
      ps_moveto(out,xx,y0);
      y=0;
      bMap1 = (!mat2 || (x<y || (x==y && bFirstDiag)));
      if ((bDiag) || (x!=y))
	col = mat[i].matrix[x][y];
      else
	col = -1;
      for(nexty=1; (nexty<=mat[i].ny); nexty++) {
	bNextMap1 = (!mat2 || (x<nexty || (x==nexty && bFirstDiag)));
	  /* TRUE:  upper left  -> map1 */
	  /* FALSE: lower right -> map2 */
	if ((nexty==mat[i].ny) || (!bDiag && (x==nexty)))
	  nextcol = -1;
	else
	  nextcol=mat[i].matrix[x][nexty];
	if ( (nexty==mat[i].ny) || (col!=nextcol) || (bMap1!=bNextMap1) ) {
	  if (col >= 0)
	    if (bMap1)
	      ps_rgb_nbox(out,&(mat[i].map[col].rgb),nexty-y);
	    else
	      ps_rgb_nbox(out,&(mat2[i].map[col].rgb),nexty-y);
	  else
	    ps_moverel(out,0,psr->yboxsize);
	  y=nexty;
	  bMap1=bNextMap1;
	  col=nextcol;
	  }
	}
    }
    y0+=box_height(&(mat[i]),psr)+box_dh(psr)+box_dh_top(IS_ONCE,psr);
  }
  
  if (psr->X.lineatzero || psr->Y.lineatzero) {
    /* reset y0 for first box */
    y0=dh;
    ps_comment(out,"Here starts the zero lines drawing");  
    draw_zerolines(out,x0,y0,w,nmat,mat,psr);
  }
  
  if (elegend!=elNone) {
    ps_comment(out,"Now it's legend time!");
    ps_linewidth(out,psr->linewidth);
    if ( mat2==NULL || elegend!=elSecond ) {
      bDiscrete = mat[0].bDiscrete;
      legend    = mat[0].legend;
      leg_nmap  = nmap1;
      leg_map   = map1;
    } else {
      bDiscrete = mat2[0].bDiscrete;
      legend    = mat2[0].legend;
      leg_nmap  = nmap2;
      leg_map   = map2;
    }
    if (bDiscrete)
      leg_discrete(out,psr->legfontsize,DDD,legend,
		   psr->legfontsize,psr->legfont,leg_nmap,leg_map);
    else {
      if ( elegend!=elBoth )
	leg_continuous(out,x0+w/2,w/2,DDD,legend,
		       psr->legfontsize,psr->legfont,leg_nmap,leg_map,
		       mapoffset);
      else
	leg_bicontinuous(out,x0+w/2,w,DDD,mat[0].legend,mat2[0].legend,
			 psr->legfontsize,psr->legfont,nmap1,map1,nmap2,map2);
    }
    ps_comment(out,"Were there, dude");
  }
  
  ps_close(out);
}
Пример #10
0
/* cpx_call()
 * ======================================================================
 * Called ONLY when the CPX is being executed. Note that it is CPX_INIT()
 * that returned the ptr to cpx_call().
 * CPX_CALL() is the entry point to displaying and manipulating the
 * dialog box.
 *
 * IN: GRECT *rect:	Ptr to a GRECT that describes the current work
 *			area of the XControl window.
 *
 * OUT:
 *   FALSE:     The CPX has exited and no more messages are
 *		needed.  XControl will either return to its
 *		main menu or close its windows.
 *		This is used by XForm_do() type CPXs.
 *
 *   TRUE:	The CPX requests that XCONTROL continue to
 *		send AES messages.  This is used by Call-type CPXs.
 */
BOOLEAN
cpx_call( GRECT *rect )
{
     int     button;
     int     quit = 0;
     WORD    msg[8], clip[4];
     MRETS   mk;
     int     ox, oy;
     BOOLEAN dclick;
     int     CurPen;
     GRECT   orect;

     ActiveTree( ad_tree );

     WindGet(0, WF_WORKXYWH, &desk );	/* set clipping to */
     rc_2xy( &desk, clip );			/*   Desktop space */

     open_vwork();
     vs_clip( vhandle, 1, ( int *)clip );
     ObX( ROOT ) = rect->g_x;
     ObY( ROOT ) = rect->g_y;
     ObjcDraw( tree, ROOT, MAX_DEPTH, NULL );
     draw_boxes();			/* draw the color boxes */
     outline( curbox, HILITE );		/* show selected box */
     close_vwork();

     
     do
     {
        dclick = FALSE;
	button = (*xcpb->Xform_do)( tree, 0, msg );

	if(( button != -1 ) && ( button & 0x8000 ) )
        {
	   dclick = TRUE;
	   button &= 0x7fff;
        }

     	switch( button )
     	{
	   case CCANCEL:
		         cnclchgs();			/* cancel all changes made */
     	
     	   case C*K: quit = TRUE;
     	   	     Deselect( button );
     	   	     break;

 	   case CRELOAD:		/* reload saved user-preference */
	   		if( saved )
	   		  init(&usr_vals);
	   		else
	   		  init(&def_vals);
		        update_rgb(1);	/* update RGB on screen */

			/* Redraw the boxes deliberately */
		        open_vwork();
		        rc_2xy( &desk, clip );		/*   Desktop space */
			vs_clip( vhandle, 1, ( int *)clip );
			draw_boxes();			/* draw the color boxes */
			close_vwork();

			
	   		XDeselect( tree, button );
			break;


	   case CSAVE:	/* save current values */
			if ((*xcpb->XGen_Alert)(SAVE_DEFAULTS) == TRUE)
			{
			    (*xcpb->MFsave)(MFSAVE, &orig_mf);
			    if( AES_Version >= 0x0320 )
			        graf_mouse( BUSYBEE, 0L );
					
			    savergb();			/* save color info */
							/* update RGBs */
			    cpyrgb((RGB *)&oldrgb, (RGB *)&newrgb, numcol );	

			    /* save current data to file */
			    saved = 1;
			    (*xcpb->CPX_Save)((void *)&saved, sizeof(DEFAULTS)+2);
 	    		    (*xcpb->MFsave)(MFRESTORE, &orig_mf);
			}
			XDeselect( tree, button );
	   		break;


	   case CUP:
	   		(*xcpb->Sl_arrow)(tree, CBASE, CSLIDE, CUP, -1, 
	    			col_max, col_min, &curcol, VERTICAL, nxtrow);
	    		break;
	    		
	   case CDOWN:
	    		(*xcpb->Sl_arrow)(tree, CBASE, CSLIDE, CDOWN, 1, 
	    			col_max, col_min, &curcol, VERTICAL, nxtrow);
	    		break;


   	   case CSLIDE:
			if( dclick )	/* if double-click */
			{
			    ActiveTree( ad_tree );
			    orect = ObRect( CSLIDE );
			    objc_offset( ad_tree, CSLIDE, &orect.g_x, &orect.g_y );
			    
			    ActiveTree( ad_slide1 );
			    ObX( CTSLIDE ) = ObX( EXIT1 ) = ( orect.g_x - 2 );
			    ObY( CTSLIDE ) = ObY( EXIT1 ) = ( orect.g_y - 2 );
			    ObW( CTSLIDE ) = ( orect.g_w + 3 );
			    ObH( CTSLIDE ) = ( orect.g_h + 4 );

			    myitoa( curcol, &PenNum[0] );
			    TedText( CTSLIDE ) = PenNum;

			    ObjcDraw( ad_slide1, CTSLIDE, 0, NULL );
			    form_do( ad_slide1, CTSLIDE );

			    if( strlen( TedText( CTSLIDE ) ) )
			    {
			    			    
			      CurPen = atoi( TedText( CTSLIDE ) );
			      CurPen = min( CurPen, col_max );
			      CurPen = max( CurPen, col_min );
			      curcol = CurPen;
			      Deselect( CTSLIDE );
			      Deselect( EXIT1 );
			
			      ActiveTree( ad_tree );
			      ObjcDraw( ad_tree, CSLIDE, MAX_DEPTH, NULL );
			    
		   	      headcol = ( curcol / COL_PER_BNK )* COL_PER_BNK;
			      open_vwork();
			      rc_2xy( &desk, clip );	
			      vs_clip( vhandle, 1, ( int *)clip );
			      draw_boxes();
     			      close_vwork();
			      nxtgrp();
			      update_slid( CBASE, CSLIDE, curcol, col_max, col_min, 1 );
			    }
			    else
                            {
			      Deselect( CTSLIDE );
			      Deselect( EXIT1 );
			      ActiveTree( ad_tree );
			      ObjcDraw( ad_tree, CSLIDE, MAX_DEPTH, NULL );
                            }
			    EvntButton( 1, 1, 0, &mk );
			}
			else
 			{
			  (*xcpb->MFsave)(MFSAVE, &orig_mf);
			  if( AES_Version >= 0x0320 )
			      graf_mouse( FLAT_HAND, 0L );

          		  if(( AES_Version >= 0x0330 )
	      		      && ( numcol > LWHITE ) )
			     XSelect( tree, CSLIDE );

	    		  (*xcpb->Sl_dragy)(tree, CBASE, CSLIDE, col_max, 
	    			col_min, &curcol, nxtgrp);

          		  if(( AES_Version >= 0x0330 )
	      		      && ( numcol > LWHITE ) )
			      XDeselect( tree, CSLIDE );
	    		  (*xcpb->MFsave)(MFRESTORE, &orig_mf);
			}
			break;

	   case CBASE:  
			Graf_mkstate(&mk);
		        objc_offset(tree, CSLIDE, &ox, &oy);
			if(mk.y < oy)
			    oy = -col_page;
			else
			    oy = col_page;
			curslid = CSLIDE;
			(*xcpb->Sl_arrow)(tree, CBASE, CSLIDE, -1, oy, 
   		     			 col_max, col_min, &curcol, VERTICAL, nxtpage);

	    		break;


	   case RUP:    Do_Up( RBASE, RSLIDE, RUP, R );
	    		break;
	    		
	   case RDOWN:  Do_Down( RBASE, RSLIDE, RDOWN, R );
	    		break;
	    		
	   case RSLIDE: Do_Slider( RBASE, RSLIDE, R, dclick );
	    		break;
	    		
	   case RBASE:  Do_Base( RBASE, RSLIDE, R );
	    		break;
	        
  	   case GUP:    Do_Up( GBASE, GSLIDE, GUP, G );
	    		break;
	    		
	   case GDOWN:  Do_Down( GBASE, GSLIDE, GDOWN, G );
	    		break;
	    		
	   case GSLIDE: Do_Slider( GBASE, GSLIDE, G, dclick );
			break;
	    		
	   case GBASE:  Do_Base( GBASE, GSLIDE, G );
	    		break;
	   
	        
	   case BUP:    Do_Up( BBASE, BSLIDE, BUP, B );
	    		break;
	    		
	   case BDOWN:  Do_Down( BBASE, BSLIDE, BDOWN, B );
	    		break;
	    		
	   case BSLIDE: Do_Slider( BBASE, BSLIDE, B, dclick );
			break;
	    		
	   case BBASE:  Do_Base( BBASE, BSLIDE, B );
	    		break;


  	   case TWO01:		/* for ST High rez */
	   case TWO02:
	
	   case FOUR01:		/* for ST Medium rez */
	   case FOUR02:
	   case FOUR03:
	   case FOUR04:
		
	   case BOX0:    	/* for all other rez */
	   case BOX1:
	   case BOX2:
	   case BOX3:
	   case BOX4:
	   case BOX5:
	   case BOX6:
	   case BOX7:
	   case BOX8:
	   case BOX9:
	   case BOX10:
	   case BOX11:
	   case BOX12:
	   case BOX13:
	   case BOX14:
	   case BOX15:
	  		if( button != curbox)	/* select requested color */
	  		{
			    curcol = button - headbox + headcol;
			    nxt_to_show(0);
			    update_slid( CBASE, CSLIDE, curcol, col_max, col_min, 1 );
			}
	   		break;

     	   default:	if( button == -1 )
     			{
     			   switch( msg[0] )
     			   {
     			     case WM_REDRAW: /* redraw the cpx */
		  			     do_redraw((GRECT *)&msg[4], (int *)clip);
     			     		     break;
     			     		     
     			     case AC_CLOSE:  /* treated like a cancel */
	 				     cnclchgs();	/* cancel changes made */
     			     case WM_CLOSED: quit = TRUE; 	/* treated like an OK */
					     break;
					     
			     case CT_KEY:
			     	switch( msg[3] )	/* check which key is returned */
			     	{
					case UNDO:			/* if Undo key */
						   cnclbnk();		/* cancel color changes */
						   update_rgb(1);	/* update RGB on screen */

						   /* Redraw the boxes deliberately */
		        			   open_vwork();
		        			   rc_2xy( &desk, clip );		/*   Desktop space */
						   vs_clip( vhandle, 1, ( int *)clip );
						   draw_boxes();			/* draw the color boxes */
						   close_vwork();

						   break;
						
					case HOME:				/* if Clr Home key */
						   init(&def_vals);	/* init to system defs */
						   update_rgb(1);	/* update RGB on screen */

						   setup_bnk = CLEAN;/*cjg*/	
						   visit_bnk();	     /*cjg*/

						   /* Redraw the boxes deliberately */
		        			   open_vwork();
		        			   rc_2xy( &desk, clip );		/*   Desktop space */
						   vs_clip( vhandle, 1, ( int *)clip );
						   draw_boxes();			/* draw the color boxes */
						   close_vwork();

						   break;
				}

			     		     break;		     
     			     default:
     			     		break;
     			   }
     			}
     			break;
     	}
     }while( !quit);
     return( FALSE );
}
Пример #11
0
static void handler_set_map (s_window_t *window, s_event_t *event, s_handler_t *handler)
{
    chars_select++;
    chars_select %= 2;
    draw_boxes(window);
}
Пример #12
0
static void handler_shift_up (s_window_t *window, s_event_t *event, s_handler_t *handler)
{
    chars_type++;
    chars_type %= CHARS_MAX;
    draw_boxes(window);
}
Пример #13
0
/* cpx_call()
 * ======================================================================
 * Called ONLY when the CPX is being executed. Note that it is CPX_INIT()
 * that returned the ptr to cpx_call().
 * CPX_CALL() is the entry point to displaying and manipulating the
 * dialog box.
 *
 * IN: GRECT *rect:	Ptr to a GRECT that describes the current work
 *			area of the XControl window.
 *
 * OUT:
 *   FALSE:     The CPX has exited and no more messages are
 *		needed.  XControl will either return to its
 *		main menu or close its windows.
 *		This is used by XForm_do() type CPXs.
 *
 *   TRUE:	The CPX requests that XCONTROL continue to
 *		send AES messages.  This is used by Call-type CPXs.
 */
BOOLEAN
cdecl cpx_call( GRECT *rect )
{
     int   button;
     int   quit = 0;
     WORD  msg[8], clip[4];
     MRETS mk;
     int   ox, oy;
     
     ad_tree = (OBJECT *)rs_trindex[ COLOR ];
     ActiveTree( ad_tree );

     Wind_get(0, WF_WORKXYWH, (WARGS *)&desk );	/* set clipping to */
     rc_2xy( &desk, clip );			/*   Desktop space */

     open_vwork();
     vs_clip( vhandle, 1, ( int *)clip );
     
     ObX( ROOT ) = rect->g_x;
     ObY( ROOT ) = rect->g_y;
     Objc_draw( tree, ROOT, MAX_DEPTH, NULL );
     draw_boxes();								/* draw the color boxes */
     outline( curbox, HILITE );		/* show selected box */
     close_vwork();
     
     do
     {
	button = (*xcpb->Xform_do)( tree, 0, msg );
     	switch( button )
     	{
	   case CCANCEL:
		         cnclchgs();			/* cancel all changes made */
     	
     	   case C*K: quit = TRUE;
     	   	     Deselect( button );
     	   	     break;

 	   case CRELOAD:		/* reload saved user-preference */
 	   		if( bpg )
 	   		{
	   		  if( saved )
	   		     init(&usr_vals);
	   		  else
	   		     init(&def_vals);
		          update_rgb(1);	/* update RGB on screen */
		        }   
	   		Deselect( button );
	   		Objc_draw( tree, button, MAX_DEPTH, NULL );
			break;


	   case CSAVE:	/* save current values */
	   		if( bpg )
	   		{
			  if ((*xcpb->XGen_Alert)(SAVE_DEFAULTS) == TRUE)
			  {
			    (*xcpb->MFsave)(MFSAVE, &orig_mf);
			    graf_mouse( BUSYBEE, 0L );
					
			    if( bpg )			/* if color */
			    {
				savergb();		/* save color info */
							/* update RGBs */
				cpyrgb((RGB *)&oldrgb, (RGB *)&newrgb, numcol );	
			    }

			    /* save current data to file */
			    saved = 1;
			    (*xcpb->CPX_Save)((void *)&saved, sizeof(DEFAULTS)+2);
	    		    (*xcpb->MFsave)(MFRESTORE, &orig_mf);
			  }
			}  
			Deselect( button );
			Objc_draw( tree, button, MAX_DEPTH, NULL );
	   		break;


	   case CUP:
	   		(*xcpb->Sl_arrow)(tree, CBASE, CSLIDE, CUP, -1, 
	    			col_max, col_min, &curcol, VERTICAL, nxtrow);
	    		break;
	    		
	   case CDOWN:
	    		(*xcpb->Sl_arrow)(tree, CBASE, CSLIDE, CDOWN, 1, 
	    			col_max, col_min, &curcol, VERTICAL, nxtrow);
	    		break;

   	   case CSLIDE:
			(*xcpb->MFsave)(MFSAVE, &orig_mf);
			graf_mouse( FLAT_HAND, 0L );
	    		(*xcpb->Sl_dragy)(tree, CBASE, CSLIDE, col_max, 
	    			col_min, &curcol, nxtgrp);
	    		(*xcpb->MFsave)(MFRESTORE, &orig_mf);
			break;

	   case CBASE:
    			Graf_mkstate(&mk);
    			objc_offset(tree, CSLIDE, &ox, &oy);
    			if(mk.y < oy)
    	   		    oy = -col_page;
       			else
    	    		    oy = col_page;
			curslid = CSLIDE;
	    		(*xcpb->Sl_arrow)(tree, CBASE, CSLIDE, -1, oy, 
	    			col_max, col_min, &curcol, VERTICAL, nxtpage);
	    		break;


	   case RUP:
			curslid = RSLIDE;
	    		(*xcpb->Sl_arrow)(tree, RBASE, RSLIDE, RUP, 1, 0, 
	    			1000, &curscrn[R], VERTICAL, adjcol);
	    		break;
	    		
	   case RDOWN:
			curslid = RSLIDE;
	    		(*xcpb->Sl_arrow)(tree, RBASE, RSLIDE, RDOWN, -1, 
	    			0, 1000, &curscrn[R], VERTICAL, adjcol);
	    		break;
	    		
	   case RSLIDE:
			(*xcpb->MFsave)(MFSAVE, &orig_mf);
			graf_mouse( FLAT_HAND, 0L );
			curslid = RSLIDE;
	    		(*xcpb->Sl_dragy)(tree, RBASE, RSLIDE, 0, 1000, 
	    			&curscrn[R], adjcol);
	    		(*xcpb->MFsave)(MFRESTORE, &orig_mf);
	    		break;
	    		
	   case RBASE:
    	   		Graf_mkstate(&mk);
    	   		objc_offset(tree, RSLIDE, &ox, &oy);
    	   		if( mk.y < oy)
    	   		     oy = VAL_PAGE;
    	   		else
    	       		     oy = -VAL_PAGE;
			curslid = RSLIDE;
	    		(*xcpb->Sl_arrow)(tree, RBASE, RSLIDE, -1, oy, 0, 
	    			1000, &curscrn[R], VERTICAL, adjcol);
	    		break;
	        
  	   case GUP:
			curslid = GSLIDE;
	    		(*xcpb->Sl_arrow)(tree, GBASE, GSLIDE, GUP, 1, 0, 
	    			1000, &curscrn[G], VERTICAL, adjcol);
	    		break;
	    		
	   case GDOWN:
			curslid = GSLIDE;
	    		(*xcpb->Sl_arrow)(tree, GBASE, GSLIDE, GDOWN, -1, 
	    			0, 1000, &curscrn[G], VERTICAL, adjcol);
	    		break;
	    		
	   case GSLIDE:
			(*xcpb->MFsave)(MFSAVE, &orig_mf);
			graf_mouse( FLAT_HAND, 0L );
			curslid = GSLIDE;
	    		(*xcpb->Sl_dragy)(tree, GBASE, GSLIDE, 0, 1000, 
	    			&curscrn[G], adjcol);
	    		(*xcpb->MFsave)(MFRESTORE, &orig_mf);
	    		break;
	    		
	   case GBASE:
    	   		Graf_mkstate(&mk);
    	   		objc_offset(tree, GSLIDE, &ox, &oy);
    	   		if(mk.y < oy)
    	   		     oy = VAL_PAGE;
    	   		else
    	   	    	     oy = -VAL_PAGE;
			curslid = GSLIDE;
	    		(*xcpb->Sl_arrow)(tree, GBASE, GSLIDE, -1, oy, 0, 
	    			1000, &curscrn[G], VERTICAL, adjcol);
	    		break;
	   
	        
	   case BUP:
			curslid = BSLIDE;
	    		(*xcpb->Sl_arrow)(tree, BBASE, BSLIDE, BUP, 1, 0, 
	    			1000, &curscrn[B], VERTICAL, adjcol);
	    		break;
	    		
	   case BDOWN:
			curslid = BSLIDE;
	    		(*xcpb->Sl_arrow)(tree, BBASE, BSLIDE, BDOWN, -1, 
	    			0, 1000, &curscrn[B], VERTICAL, adjcol);
	    		break;
	    		
	   case BSLIDE:
			(*xcpb->MFsave)(MFSAVE, &orig_mf);
			graf_mouse( FLAT_HAND, 0L );
			curslid = BSLIDE;
	    		(*xcpb->Sl_dragy)(tree, BBASE, BSLIDE, 0, 1000, 
	    			&curscrn[B], adjcol);
	    		(*xcpb->MFsave)(MFRESTORE, &orig_mf);
	    		break;
	    		
	   case BBASE:
    			Graf_mkstate(&mk);
    			objc_offset(tree, BSLIDE, &ox, &oy);
    			if(mk.y < oy)
	  		   oy = VAL_PAGE;
    			else
			   oy = -VAL_PAGE;
			curslid = BSLIDE;
	    		(*xcpb->Sl_arrow)(tree, BBASE, BSLIDE, -1, oy, 0, 
	    			1000, &curscrn[B], VERTICAL, adjcol);
	    		break;


  	   case TWO01:		/* for ST High rez */
	   case TWO02:
	
	   case FOUR01:		/* for ST Medium rez */
	   case FOUR02:
	   case FOUR03:
	   case FOUR04:
		
	   case BOX0:    	/* for all other rez */
	   case BOX1:
	   case BOX2:
	   case BOX3:
	   case BOX4:
	   case BOX5:
	   case BOX6:
	   case BOX7:
	   case BOX8:
	   case BOX9:
	   case BOX10:
	   case BOX11:
	   case BOX12:
	   case BOX13:
	   case BOX14:
	   case BOX15:
	  		if( button != curbox)	/* select requested color */
	  		{
			    curcol = button - headbox + headcol;
			    nxt_to_show(0);
			    update_slid( CBASE, CSLIDE, curcol, col_max, col_min, 1);
			}
	   		break;

     	   default:	if( button == -1 )
     			{
     			   switch( msg[0] )
     			   {
     			     case WM_REDRAW: /* redraw the cpx */
		  			     do_redraw((GRECT *)&msg[4], (int *)clip);
     			     		     break;
     			     		     
     			     case AC_CLOSE:  /* treated like a cancel */
	 				     cnclchgs();	/* cancel changes made */
     			     case WM_CLOSED: quit = TRUE; 	/* treated like an OK */
					     break;
					     
			     case CT_KEY:
			     	switch( msg[3] )	/* check which key is returned */
			     	{
					case UNDO:				/* if Undo key */
						if( bpg )			/* if there is color */
						{
						   cnclbnk();		/* cancel color changes */
						   update_rgb(1);	/* update RGB on screen */
						}
						break;
						
					case HOME:				/* if Clr Home key */
						if( bpg )
						{
						   init(&def_vals);	/* init to system defs */
						   update_rgb(1);	/* update RGB on screen */
						}   
						break;
				}

			     		     break;		     
     			     default:
     			     		break;
     			   }
     			}
     			break;
     	}
     }while( !quit);
     return( FALSE );
}