Esempio n. 1
0
 void draw(int16_t vhandle, int16_t rect[]) {
     vsf_color(vhandle, 1);
     v_bar(vhandle, rect);
     vsf_color(vhandle, 0);
     v_ellipse(vhandle, 
         (visible[0] + visible[2] / 2),
         (visible[1] + visible[3] / 2),
         visible[2] / 2,
         visible[3] / 2
     );
 }
Esempio n. 2
0
static inline void vsf_rgbcolor( short vdih, uint32_t cin )
{
	if( vdi_sysinfo.scr_bpp > 8 ) {
		unsigned short c[4];
		rgb_to_vdi1000( (unsigned char*)&cin, (unsigned short*)&c );
		vs_color( vdih, OFFSET_CUSTOM_COLOR, &c[0] );
		vsf_color( vdih, OFFSET_CUSTOM_COLOR );
	} else {
		if( vdi_sysinfo.scr_bpp >= 4 ){
			vsf_color( vdih, RGB_TO_VDI(cin) );
		}
		else
			vsf_color( vdih, WHITE );
	}
}
Esempio n. 3
0
void display_status(int status)
{
  int x_align, y_align ;
  int xy[8] ;
  char txt[50] ;

  switch (status )
  {
    case STATUS_LOADING : strcpy( txt, "Loading..." ) ;
                          break ;

    case STATUS_SCALING : strcpy( txt, "Scaling..." ) ;
                          break ;

    case STATUS_WAITING : strcpy( txt, "Waiting..." ) ;
                          break ;

    default             : strcpy( txt, "          " ) ;
  }
  vsf_color( handle, back_color ) ;
  vsf_interior( handle, FIS_SOLID ) ;
  vqt_extent( handle, txt, xy ) ;
  xy[2] = xy[4] ; xy[3] = xy[5] ;
  yprog = xy[3] + ttype.hcar ;
  v_hide_c(handle) ;
  vr_recfl( handle, xy ) ;
  v_show_c(handle, 1) ;
  vst_alignment( handle, 0, 1, &x_align, &y_align ) ;
  aff_text( txt, 0, ttype.hcar, txt_color ) ;
  vst_alignment( handle, x_align, y_align, &x_align, &y_align ) ;
}
Esempio n. 4
0
VOID gsx_invert(GRECT *pt)
{
	vsf_color(gl_handle, BLACK);
	vs_clip(gl_handle, FALSE, &ptsin[0]); 
	bb_fill(MD_XOR, FIS_SOLID, IP_SOLID,
		pt->g_x, pt->g_y, pt->g_w, pt->g_h);
}
Esempio n. 5
0
global
void f_color(int m)
{
	static int mode = -1;
	if (m ne mode)
		vsf_color(C.vh, mode = m);
}
Esempio n. 6
0
int cdecl draw_currentcolor(PARMBLK *parmblock)
{ 
  WEXTENSION_PAL *wext = (WEXTENSION_PAL *) parmblock->pb_parm ;
  int            xyc[4], xy[4] ;
  	
  if (parmblock->pb_prevstate != parmblock->pb_currstate) return(0) ;
  
  xyc[0] = parmblock->pb_xc ;
  xyc[1] = parmblock->pb_yc ;
  xyc[2] = xyc[0]+parmblock->pb_wc ;
  xyc[3] = xyc[1]+parmblock->pb_hc ;
  vs_clip(handle, 1, xyc);
	
  vswr_mode(handle, MD_REPLACE) ;
  vsf_interior(handle, FIS_SOLID) ;	
  vsf_style(handle, 7) ;
  vsf_perimeter(handle, 1) ;
  vsf_color(handle, wext->index) ;
  xy[0] = parmblock->pb_x ;
  xy[1] = parmblock->pb_y ;
  xy[2] = parmblock->pb_x+parmblock->pb_w-1 ;
  xy[3] = parmblock->pb_y+parmblock->pb_h-1 ;
  v_hide_c(handle) ;
  v_bar(handle, xy) ;
  v_show_c(handle, 1) ;
  vs_clip(handle, 0, xyc) ;

  return(0) ;
}
Esempio n. 7
0
/*
 * Draw the color boxes
 */
void
draw_boxes(void)
{
	GRECT obrect;
	int obj, objcol;
	int lastbox;		
	
	wind_update(TRUE);
	HIDE_MOUSE;
	
	if (numcol < MAX_COL_SHOWN)				/* init last box to be drawn */
		lastbox = headbox + numcol - 1;
	else
		lastbox = headbox + MAX_COL_SHOWN - 1;
	
	vsf_interior(vhandle, SOLID);		/* fill with SOLID pattern */
	for (obj = headbox, objcol = headcol; 
		obj <= lastbox;
		obj++, objcol++) {
		
		vsf_color(vhandle, objcol);	/* fill with color of obj */
		obrect = ObRect(obj);
		objc_offset(tree, obj, &obrect.g_x, &obrect.g_y);
		pxyarray[0] = obrect.g_x;
		pxyarray[1] = obrect.g_y;
		pxyarray[2] = obrect.g_x + obrect.g_w - 1;
		pxyarray[3] = obrect.g_y + obrect.g_h - 1;
		v_bar(vhandle, pxyarray);
		
	}
	SHOW_MOUSE;
	wind_update(FALSE);
}
Esempio n. 8
0
/*
 * Adjust color of selected color pen with
 * RGB gun values requested.
 *
 * Force the redraw of the currently selected pen box.
 */
void
adjcol( void )
{
	GRECT obrect;
	WORD  clip[4];

	(curnew+curcol)->rint = curscrn[R];
	(curnew+curcol)->gint = curscrn[G];
	(curnew+curcol)->bint = curscrn[B];
        
	slidtext();
	open_vwork();
	rc_2xy( &desk, clip );	
	vs_clip( vhandle, 1, ( int *)clip );

	vs_color(vhandle, curcol, (int *)(curnew+curcol) );

	/* cjg - force a redraw fo the curbox */
	vsf_color( vhandle, curcol );	/* fill with color of obj */
	obrect = ObRect( curbox );
	objc_offset(tree, curbox, &obrect.g_x, &obrect.g_y);
	pxyarray[0] = obrect.g_x;
	pxyarray[1] = obrect.g_y;
	pxyarray[2] = obrect.g_x + obrect.g_w - 1;
	pxyarray[3] = obrect.g_y + obrect.g_h - 1;
	v_bar(vhandle, pxyarray);

	close_vwork();
	*( curdirt+curcol ) = touch_bnk = DIRTY;
}
Esempio n. 9
0
void draw_main_labels (int app_handle, char * title, char * x_label, char * y_label,
	int x, int y, int w, int h, int y_value_width) {

	int offset;
	int char_w, char_h, cell_w, cell_h;

	vsf_color (app_handle, BLACK);
	vst_point (app_handle, TITLE_FONT, &char_w, &char_h, &cell_w, &cell_h);

	offset = cell_w * (w/cell_w - strlen(title))/2;
	if (offset < 0) offset = 0;
	v_gtext (app_handle, x + offset, y-h-cell_h, title);

	vst_point (app_handle, AXES_TITLE_FONT, &char_w, &char_h, &cell_w, &cell_h);

	offset = cell_w * (w/cell_w - strlen(x_label))/2;
	if (offset < 0) offset = 0;
	v_gtext (app_handle, x + offset, y+2*cell_h, x_label);

	offset = cell_h * (h/cell_h - strlen(y_label))/2;
	if (offset < 0) offset = 0;
	vst_rotation (app_handle, 900);
	v_gtext (app_handle, x-(y_value_width+1)*cell_w, y-offset, y_label);
	vst_rotation (app_handle, 0);
}
Esempio n. 10
0
void
iw_xdraw(ICONWIND iw)
{
	WORD	xy[4], bxy[10];

	wind_update(BEG_UPDATE);
	graf_mouse(M_OFF, NULL);

	rc_getpts(&iw->w.rwind, xy);
	vs_clip(iw->w.wsid, 1, xy);
	vswr_mode(iw->w.wsid, MD_XOR);

	vsl_color(iw->w.wsid, BLACK);
	vsl_ends(iw->w.wsid, 0, 0);
	vsl_type(iw->w.wsid, 1);
	vsl_width(iw->w.wsid, 1);
	rc_boxpts(&iw->w.rwind, bxy);
	bxy[9]--;
	v_pline(iw->w.wsid, 5, bxy);

	vsf_color(iw->w.wsid, BLACK);
	vsf_interior(iw->w.wsid, FIS_SOLID);
	vsf_perimeter(iw->w.wsid, 0);
	xy[0]++, xy[2]--;
	xy[3] = xy[1]++ + 7;
	v_bar(iw->w.wsid, xy);

	graf_mouse(M_ON, NULL);
	wind_update(END_UPDATE);
}
Esempio n. 11
0
void display_stone( void )
{
	static int oldx, oldy;
	static long oldstone;
	int x, y;
	long thestone;
	int parray[4];
	
	
	if (displayed)
	{
		vsf_color( handle, 0 );
		for (y=0; y<4; y++)
			for (x=0; x<4; x++)
			{
				oldstone<<=1;
				if ( 0x10000L & oldstone )
				{
					parray[0]=17+(16*(oldx+x));
					parray[1]=17+(16*(oldy+y));
					parray[2]=parray[0]+14;
					parray[3]=parray[1]+14;
					vr_recfl( handle, parray );
				}
			}
		vsf_color( handle, 1 );
	}
	thestone= stones[stone][mutation];
	oldstone= thestone;
	oldx=stonex;
	oldy=stoney;
	displayed=1;
	for (y=0; y<4; y++)
		for (x=0; x<4; x++)
		{
			thestone<<=1;
			if ( 0x10000L & thestone )
			{
				parray[0]=17+(16*(stonex+x));
				parray[1]=17+(16*(stoney+y));
				parray[2]=parray[0]+14;
				parray[3]=parray[1]+14;
				vr_recfl( handle, parray );
			}
		}
}
Esempio n. 12
0
int cdecl draw_pencil(PARMBLK *parmblk)
{
  WEXTENSION_PENCIL *wext = (WEXTENSION_PENCIL *) parmblk->pb_parm ;
  int xy[8] ;
  int xc, yc ;

  xy[0] = parmblk->pb_x ;
  xy[1] = parmblk->pb_y ;
  xy[2] = parmblk->pb_x+parmblk->pb_w-1 ;
  xy[3] = parmblk->pb_y+parmblk->pb_h-1 ;
  vs_clip(handle, 1, xy) ;
  xc = (xy[0]+xy[2])/2 ;
  yc = (xy[1]+xy[3])/2 ;
  vswr_mode(handle, MD_REPLACE) ;
  vsf_interior(handle, FIS_SOLID) ;
  vsf_color(handle, 0) ;
  vr_recfl(handle, xy) ;

  vsf_color(handle, wext->pencil.color) ;
  switch( wext->pencil.type )
  {
    case 0 : xy[0] = xc-wext->pencil.height/2 ;
             xy[1] = yc-wext->pencil.height/2 ;
             xy[2] = xc+wext->pencil.height/2 ;
             xy[3] = yc+wext->pencil.height/2 ;
             vr_recfl(handle, xy) ;
             break ;
    case 1 : v_circle(handle, xc, yc, wext->pencil.height/2) ;
             break ;
    case 2 : xy[0] = xc ;
             xy[1] = yc-wext->pencil.height/2 ;
             xy[2] = xc+wext->pencil.height/2 ;
             xy[3] = yc ;
             xy[4] = xc ;
             xy[5] = yc+wext->pencil.height/2 ;
             xy[6] = xc-wext->pencil.height/2 ;
             xy[7] = yc ;
             v_fillarea(handle, 4, xy) ;
             break ;
  }
  vs_clip(handle, 0, xy) ;

  return(0) ;
}
Esempio n. 13
0
void clear(RECT *r)		/* HR 021202: use v_bar for a white rectangle (for true colour) */
{
	int pxy[4];

	vsf_color(vdi_handle, WHITE);
	vsf_interior(vdi_handle, FIS_SOLID);
	vsf_perimeter(vdi_handle, 0);
	vswr_mode(vdi_handle, MD_REPLACE);
	xd_rect2pxy(r, pxy);
	v_bar(vdi_handle, pxy);
}
Esempio n. 14
0
/* Clear given area of screen */
void clear_area (int app_handle, int x, int y, int w, int h) {
	int pxy[4];

	vsf_interior (app_handle, SOLID);
	vsf_color (app_handle, WHITE);
	pxy[0] = x;
	pxy[1] = y;
	pxy[2] = x + w - 1;
	pxy[3] = y + h - 1;
	vr_recfl (app_handle, pxy);
}
Esempio n. 15
0
/*******************************************************************************
	G_LINE in popup menu
*******************************************************************************/
int cdecl _drawNiceLine(PARMBLK *parm)
{
   vqf_attributes(glb.vdi.ha,fattr);
	vql_attributes(glb.vdi.ha,lattr);
	my1.g_x=parm->pb_x;
	my1.g_y=parm->pb_y;
	my1.g_w=parm->pb_w;
	my1.g_h=parm->pb_h;
	my2.g_x=parm->pb_xc;
	my2.g_y=parm->pb_yc;
	my2.g_w=parm->pb_wc;
	my2.g_h=parm->pb_hc;
	_rcIntersect(&my1,&my2);
	tab_clip[0]=my2.g_x;
	tab_clip[1]=my2.g_y;
	tab_clip[2]=tab_clip[0]+my2.g_w-1;
	tab_clip[3]=tab_clip[1]+my2.g_h-1;
	vs_clip(glb.vdi.ha,TRUE,tab_clip);
	bar[0]=my1.g_x;
	bar[1]=my1.g_y;
	bar[2]=bar[0]+my1.g_w-1;
	bar[3]=bar[1]+my1.g_h-1;

	vswr_mode(glb.vdi.ha,MD_REPLACE);
	vsf_perimeter(glb.vdi.ha,FALSE);
	vsf_interior(glb.vdi.ha,FIS_SOLID);
	vsf_style(glb.vdi.ha,0);
	vsf_color(glb.vdi.ha,WHITE);
	v_bar(glb.vdi.ha,bar);

	vsl_type(glb.vdi.ha,USERLINE);
	vsl_width(glb.vdi.ha,1);
	vsl_udsty(glb.vdi.ha,(int)0x5555);
	x=parm->pb_x;
	y=parm->pb_y+parm->pb_h/2;
	bar[0]=x;
	bar[1]=y;
	bar[2]=x+parm->pb_w;
	bar[3]=y;
	v_pline(glb.vdi.ha,2,bar);
	bar[1]+=1;
	bar[3]+=1;
	vsl_udsty(glb.vdi.ha,(int)0xAAAA);
	v_pline(glb.vdi.ha,2,bar);

	vs_clip(glb.vdi.ha,FALSE,tab_clip);
	vsl_type(glb.vdi.ha,lattr[0]);
	vsl_color(glb.vdi.ha,lattr[1]);
	vsf_interior(glb.vdi.ha,fattr[2]);
	vsf_style(glb.vdi.ha,fattr[0]);
	vsf_perimeter(glb.vdi.ha,fattr[4]);
	return parm->pb_currstate&~DISABLED;
}
Esempio n. 16
0
void
redraw( const WINFO *w, GRECT *clip )
{
	OBJECT	*tree;
	int		savex, savey;
	GRECT	rect;
	int		pxy[4];

	rect = w->work;
	wind_adjust( w, &rect );
	rc_2xy( clip, (WORD *)pxy );
	vs_clip( vhandle, 1, pxy );

	graf_mouse( M_OFF, NULL );
#if SILLY_PATTERN
	vsf_interior( vhandle, FIS_PATTERN );
	vsf_style( vhandle, 19 ); /* balls */
	vsf_color( vhandle, BLACK );
#else
	vsf_interior( vhandle, FIS_SOLID );
	vsf_color( vhandle, WHITE );
#endif
	vsf_perimeter( vhandle, FALSE );
	vswr_mode( vhandle, MD_REPLACE );
	v_bar( vhandle, pxy );
	graf_mouse( M_ON, NULL );

	tree = (OBJECT *)(w->x);
	savex = ObX(ROOT);
	savey = ObY(ROOT);

	ObX(ROOT) = rect.g_x - w->vir.g_x * gl_wchar;
	ObY(ROOT) = rect.g_y - w->vir.g_y * gl_hchar;
	Objc_draw( tree, ROOT, MAX_DEPTH, clip );
	ObX(ROOT) = savex;
	ObY(ROOT) = savey;

}
Esempio n. 17
0
static void GEM_ClearRect(_THIS, short *rect)
{
	short oldrgb[3], rgb[3]={0,0,0};

	vq_color(VDI_handle, vdi_index[0], 0, oldrgb);
	vs_color(VDI_handle, vdi_index[0], rgb);

	vsf_color(VDI_handle,0);
	vsf_interior(VDI_handle,1);
	vsf_perimeter(VDI_handle,0);
	v_bar(VDI_handle, rect);

	vs_color(VDI_handle, vdi_index[0], oldrgb);
}
Esempio n. 18
0
VOID gr_rect(WORD icolor, WORD ipattern, GRECT *pt)
{
	WORD		fis;

	fis = FIS_PATTERN;
	if (ipattern == IP_HOLLOW)
		fis = FIS_HOLLOW;
	else if (ipattern == IP_SOLID)
		fis = FIS_SOLID;

	vsf_color(gl_handle, icolor);
	bb_fill(MD_REPLACE, fis, ipattern, 
		pt->g_x, pt->g_y, pt->g_w, pt->g_h);
} 
Esempio n. 19
0
static int cdecl draw_aquaback(PARMBLK *p)
{
	int16 pxy[8];
	int16	x0;
	int16 y0;

	set_clipping(vdi_handle, p->pb_xc, p->pb_yc, p->pb_wc, p->pb_hc, TRUE);
	vswr_mode(vdi_handle, MD_REPLACE);

	pxy[0] = x0 = p->pb_x;				pxy[1] = y0 = p->pb_y;
	pxy[2] = p->pb_x + p->pb_w -1 ;	pxy[3] = p->pb_y + p->pb_h - 1;

	vsf_interior(vdi_handle, FIS_PATTERN); /* FIS_PATTERN */
	vsf_color(vdi_handle, LWHITE );
	vsf_style(vdi_handle, 4);
	v_bar(vdi_handle, pxy);

	pxy[3] = pxy[1];

/*	while( (pxy[1]-y0) < (p->pb_h) )
	{
		vsl_color(vdi_handle, WHITE);
		v_pline(vdi_handle, 2, pxy);
		pxy[1]+=2;	pxy[3]+=2;
	}
*/	
	while( (pxy[1]-y0+2) < (p->pb_h) )
	{
		vsl_color(vdi_handle, LWHITE); 
		v_pline(vdi_handle, 2, pxy);
		pxy[1]+=2;	pxy[3]+=2;
		vsl_color(vdi_handle, WHITE);
		v_pline(vdi_handle, 2, pxy);
		pxy[1]+=2;	pxy[3]+=2;
	}
	
	if( (pxy[1]-y0) < (p->pb_h) )
	{
		vsl_color(vdi_handle, LWHITE);
		v_pline(vdi_handle, 2, pxy);
	}
	
	return (p->pb_currstate);
}
Esempio n. 20
0
int cdecl draw_colors(PARMBLK *parmblock)
{ 
  WEXTENSION_PAL *wext = (WEXTENSION_PAL *) parmblock->pb_parm ;
  int            xyc[4], xy[4] ;
  int            nb_col_y, col_y, col_x, ind_col ;
  	
  nb_col_y = wext->nb_col_x = (int)sqrt((double)nb_colors) ;
  wext->ww = (int)(parmblock->pb_w/wext->nb_col_x) ;
  wext->hh = (int)(parmblock->pb_h/nb_col_y) ;

  if (parmblock->pb_prevstate != parmblock->pb_currstate) return(0) ;

  xyc[0] = parmblock->pb_xc ;
  xyc[1] = parmblock->pb_yc ;
  xyc[2] = xyc[0]+parmblock->pb_wc ;
  xyc[3] = xyc[1]+parmblock->pb_hc ;
  vs_clip(handle, 1, xyc) ;

  vswr_mode(handle, MD_REPLACE) ;
  vsf_interior(handle, FIS_SOLID) ;
  vsf_style(handle, 7) ;
  vsf_perimeter(handle, 1) ;

  xy[1] = parmblock->pb_y ;
  xy[3] = xy[1]+wext->hh ;
  for (col_y = 0, ind_col = 0; col_y < nb_col_y; col_y++)
  {
    xy[0] = parmblock->pb_x ;
    xy[2] = xy[0]+wext->ww ;
    for (col_x = 0; col_x < wext->nb_col_x; col_x++, ind_col++)
    {
      vsf_color(handle, ind_col) ;
	  v_bar(handle, xy) ;
      xy[0] += wext->ww ;
      xy[2] += wext->ww ;
    }
    xy[1] += wext->hh ;
	xy[3] += wext->hh ;
  }
  vs_clip(handle, 0, xyc);

  return(0) ;
}
Esempio n. 21
0
void sldcls_screen( VSS_INFO *vss_info, INFO_IMAGE *inf )
{
  int xyarray[4] ;

  compute_colors( vss_info, inf ) ;

  if ( !vss_info->do_not_cls_scr )
  {
    xyarray[0] = 0 ; xyarray[1] = 0 ;
    xyarray[2] = Xmax ; xyarray[3] = Ymax ;
    vsf_color( handle, back_color ) ;
    vsf_interior( handle, FIS_SOLID ) ;
    if ( !vss_info->do_not_show_mouse )
      v_hide_c(handle) ;
    vr_recfl(handle, xyarray) ;
    if ( !vss_info->do_not_show_mouse )
      v_show_c(handle, 1) ;
  }
}
Esempio n. 22
0
/* Similar to clear() above but clears with pattern and colour */
void pclear(RECT *r)
{
	int pxy[4];

	vsf_color(vdi_handle, options.V2_2.win_color);

	if ( options.V2_2.win_pattern != 0 )
	{
		vsf_interior(vdi_handle, FIS_PATTERN);
		vsf_style(vdi_handle, options.V2_2.win_pattern);
	}
	else
		vsf_interior(vdi_handle, FIS_SOLID); /* maybe a little faster so? */

	vsf_perimeter(vdi_handle, 0);
	vswr_mode(vdi_handle, MD_REPLACE);
	xd_rect2pxy(r, pxy);
	v_bar(vdi_handle, pxy);
}
Esempio n. 23
0
void OnDrawRTZoom(void *wnd, int xycoords[4])
{
  int xy[8] ;
  int index ;
  int must_fill = ( rtoffx > 0 ) || ( rtoffy > 0 ) ;

  if ( must_fill )
  {
    if ( !Truecolor ) index = 0 ;
    else
    {
      int rgb[3] = { 1000, 1000, 1000 } ;

      index = 19 ;
      vs_color( handle, index, rgb ) ;
    }
    vswr_mode( handle, MD_REPLACE ) ;
    vsf_color( handle, index ) ;
    vsf_interior( handle, FIS_SOLID ) ;
    vsf_perimeter( handle, 0 ) ;
  }

  if ( intersect( rtx + rtoffx, rty + rtoffy, rtw - rtoffx, rth - rtoffy,
                  xycoords[0], xycoords[1], xycoords[2], xycoords[3],
                  &xy[4] )
     )
  {
    xy[0] = smart_offx + xy[4] - rtx - rtoffx ;
    xy[1] = xy[5] - rty - rtoffy ;
    xy[2] = smart_offx + xy[6] - rtx - rtoffx ;
    xy[3] = xy[7] - rty - rtoffy ;
    vro_cpyfm( handle, S_ONLY, xy, &RTZoomDst, &screen ) ;

    if ( must_fill )
    {
      if ( intersect( rtx, rty, rtoffx, rth, xycoords[0], xycoords[1], xycoords[2], xycoords[3], xy ) )
        vr_recfl( handle, xy ) ;
      if ( intersect( rtx, rty, rtw, rtoffy, xycoords[0], xycoords[1], xycoords[2], xycoords[3], xy ) )
        vr_recfl( handle, xy ) ;
    }
  }
}
Esempio n. 24
0
/* display numeric range and tick marks of y-axis */
void draw_y_axis_labels (int app_handle, int min_y, int max_y, int x, int y, int h) {
	char str[20];
	int pxy[4];
	int i;
	int char_w, char_h, cell_w, cell_h;
	int range = max_y - min_y;

	vsf_color (app_handle, BLACK);
	vst_point (app_handle, AXES_LABEL_FONT, &char_w, &char_h, &cell_w, &cell_h);
	vsl_width (app_handle, 1);

	/* print 2,3,5 or 9 values on y-axis, depending on space available */
	if (h > 3 * cell_h) { /* print lower and top values in most cases */
		pxy[0] = x;
		pxy[1] = y;
		pxy[2] = x-5;
		pxy[3] = y;

		v_pline (app_handle, 2, pxy);
		sprintf (str, "%d", min_y);
		v_gtext (app_handle, pxy[2]-strlen(str)*cell_w, pxy[3]+cell_h/2, str);

		pxy[0] = x;
		pxy[1] = y-h;
		pxy[2] = x-5;
		pxy[3] = pxy[1];

		sprintf (str, "%d", max_y);
		v_pline (app_handle, 2, pxy);
		v_gtext (app_handle, pxy[2]-strlen(str)*cell_w, pxy[3]+cell_h/2, str);
	}

	if (h > 10 * cell_h) { /* print remaining labels depending on space available */
		draw_intermediate_y_labels (app_handle, 8, min_y, max_y, x, y, h, cell_w, cell_h);
	} else if (h > 6 * cell_h) {
		draw_intermediate_y_labels (app_handle, 4, min_y, max_y, x, y, h, cell_w, cell_h);
	} else if (h > 4 * cell_h) {
		draw_intermediate_y_labels (app_handle, 2, min_y, max_y, x, y, h, cell_w, cell_h);
	}
}
Esempio n. 25
0
static void GEM_ClearScreen(_THIS)
{
    short rgb[3]= {0,0,0};
    short oldrgb[3];
    short pxy[4];

    v_hide_c(VDI_handle);

    vq_color(VDI_handle, vdi_index[0], 0, oldrgb);
    vs_color(VDI_handle, vdi_index[0], rgb);

    pxy[0] = pxy[1] = 0;
    pxy[2] = VDI_w - 1;
    pxy[3] = VDI_h - 1;
    vsf_color(VDI_handle,0);
    vsf_interior(VDI_handle,1);
    vsf_perimeter(VDI_handle,0);
    v_bar(VDI_handle,pxy);

    vs_color(VDI_handle, vdi_index[0], oldrgb);

    v_show_c(VDI_handle, 1);
}
Esempio n. 26
0
/*******************************************************************************
	PopUp G_BUTTON
*******************************************************************************/
int cdecl _drawPopUp(PARMBLK *parm)
{
	pb.pb_tree			=	glb.rsc.head.trindex[FUSER];
	pb.pb_obj			=	FUSDPOP+glb.vdi.low;
	pb.pb_prevstate	=	pb.pb_tree[pb.pb_obj].ob_state;
	pb.pb_currstate	=	parm->pb_tree[parm->pb_obj].ob_state;
	pb.pb_w				=	pb.pb_tree[pb.pb_obj].ob_width;
	pb.pb_h				=	pb.pb_tree[pb.pb_obj].ob_height;
	pb.pb_x				=	parm->pb_x+parm->pb_w-pb.pb_w;
	pb.pb_y				=	parm->pb_y+(parm->pb_h-pb.pb_h)/2;
	pb.pb_xc				=	parm->pb_xc;
	pb.pb_yc				=	parm->pb_yc;
	pb.pb_wc				=	parm->pb_wc;
	pb.pb_hc				=	parm->pb_hc;
	pb.pb_parm			=	pb.pb_tree[pb.pb_obj].ob_spec.userblk->ub_parm;

   vqt_attributes(glb.vdi.ha,tattr);
   vqf_attributes(glb.vdi.ha,fattr);
	flags=parm->pb_tree[parm->pb_obj].ob_flags;
	state=parm->pb_tree[parm->pb_obj].ob_state;

	vsl_color(glb.vdi.ha,BLACK);
	vst_effects(glb.vdi.ha,TXT_NORMAL);
	vst_alignment(glb.vdi.ha,ALI_LEFT,ALI_BASE,&dummy,&dummy);
	user=(UBLK *)(parm->pb_parm);

	vst_point(glb.vdi.ha,10-glb.vdi.low,&dummy,&htext,&dummy,&dummy);

	my1.g_x=parm->pb_x-3;
	my1.g_y=parm->pb_y-3;
	my1.g_w=parm->pb_w+6;
	my1.g_h=parm->pb_h+6;
	my2.g_x=parm->pb_xc;
	my2.g_y=parm->pb_yc;
	my2.g_w=parm->pb_wc;
	my2.g_h=parm->pb_hc;
	_rcIntersect(&my1,&my2);
	tab_clip[0]=my2.g_x;
	tab_clip[1]=my2.g_y;
	tab_clip[2]=tab_clip[0]+my2.g_w-1;
	tab_clip[3]=tab_clip[1]+my2.g_h-1;
	vs_clip(glb.vdi.ha,TRUE,tab_clip);
	pxy[0]=parm->pb_x-1;
	pxy[1]=parm->pb_y-1;
	pxy[2]=parm->pb_x+parm->pb_w;
	pxy[3]=pxy[1];
	pxy[4]=pxy[2];
	pxy[5]=parm->pb_y+parm->pb_h;
	pxy[6]=pxy[0];
	pxy[7]=pxy[5];
	pxy[8]=pxy[0];
	pxy[9]=pxy[1];
	v_pline(glb.vdi.ha,5,pxy);
	pxy[0]=parm->pb_x+parm->pb_w+1;
	pxy[1]=parm->pb_y;
	pxy[2]=pxy[0];
	pxy[3]=parm->pb_y+parm->pb_h+1;
	pxy[4]=parm->pb_x;
	pxy[5]=pxy[3];
	v_pline(glb.vdi.ha,3,pxy);
	pxy[0]=parm->pb_x+parm->pb_w+2;
	pxy[1]=parm->pb_y;
	pxy[2]=pxy[0];
	pxy[3]=parm->pb_y+parm->pb_h+2;
	pxy[4]=parm->pb_x;
	pxy[5]=pxy[3];
	v_pline(glb.vdi.ha,3,pxy);

	bar[0]=my1.g_x;
	bar[1]=my1.g_y;
	bar[2]=bar[0]+my1.g_w-1;
	bar[3]=bar[1]+my1.g_h-1;

	vswr_mode(glb.vdi.ha,MD_REPLACE);
	vsf_perimeter(glb.vdi.ha,FALSE);
	vsf_interior(glb.vdi.ha,FIS_SOLID);
	vsf_style(glb.vdi.ha,0);

	if (flags&FL3DACT)
		backcol=LWHITE;
	else
		backcol=WHITE;
	textcol=BLACK;
	if (backcol==LWHITE && glb.vdi.extnd[4]<4)
		backcol=WHITE;
	bar[0]=parm->pb_x;
	bar[1]=parm->pb_y;
	bar[2]=bar[0]+parm->pb_w-1;
	bar[3]=bar[1]+parm->pb_h-1;
	vsf_color(glb.vdi.ha,backcol);
	/****************************************************************************
		Fond Blanc/Gris suivant r‚solution et 3D
	****************************************************************************/
	v_bar(glb.vdi.ha,bar);
	vst_color(glb.vdi.ha,textcol);
	vs_clip(glb.vdi.ha,FALSE,tab_clip);

	my1.g_x=parm->pb_x;
	my1.g_y=parm->pb_y;
	my1.g_w=parm->pb_w;
	my1.g_h=parm->pb_h;
	my2.g_x=parm->pb_xc;
	my2.g_y=parm->pb_yc;
	my2.g_w=parm->pb_wc;
	my2.g_h=parm->pb_hc;
	_rcIntersect(&my1,&my2);
	tab_clip[0]=my2.g_x;
	tab_clip[1]=my2.g_y;
	tab_clip[2]=tab_clip[0]+my2.g_w-1;
	tab_clip[3]=tab_clip[1]+my2.g_h-1;
	vs_clip(glb.vdi.ha,TRUE,tab_clip);
	vswr_mode(glb.vdi.ha,MD_TRANS);

	p=(char *)user->spec;
	while (*p==32)
		p++;
	vqt_extent(glb.vdi.ha,p,extent);

	x=parm->pb_x+pb.pb_w/2;
	y=parm->pb_y;
	y+=parm->pb_h/2;
	y-=(extent[7]-extent[1])/2;
	y+=htext;
	/****************************************************************************
		Si bouton 3D alors on d‚cale le texte
	****************************************************************************/
	if (flags&FL3DIND && flags&FL3DACT && state&SELECTED)
	{
		x+=1;
		y+=1;
	}
	v_gtext(glb.vdi.ha,x,y,p);

	vs_clip(glb.vdi.ha,FALSE,tab_clip);
	vst_effects(glb.vdi.ha,TXT_NORMAL);
	vst_alignment (glb.vdi.ha,tattr[3],tattr[4],&dummy,&dummy);
	vsf_interior(glb.vdi.ha,fattr[2]);
	vsf_style(glb.vdi.ha,fattr[0]);
	vsf_perimeter(glb.vdi.ha,fattr[4]);
	_drawCicon(&pb);
	/****************************************************************************
		Si le bouton est en relief alors il faut demander … l'AES de dessiner
		l'attribut SELECTED pour qu'il inverse le cadre fin gris/noir.
		Par contre si le bouton n'est pas en relief, il ne faut surtout pas
		demander … l'AES de dessiner cet attribut sinon; lorsque l'objet est
		s‚lectionn‚ (donc noir), l'AES le recouvre en blanc !!
	****************************************************************************/
	if (flags&FL3DIND && flags&FL3DACT || flags&FL3DIND)
		return parm->pb_currstate;
	else
		return parm->pb_currstate&~SELECTED;
}
Esempio n. 27
0
/*******************************************************************************
	G_BUTTON
*******************************************************************************/
int cdecl _drawButton(PARMBLK *parm)
{
   vqt_attributes(glb.vdi.ha,tattr);
   vqf_attributes(glb.vdi.ha,fattr);
	flags=parm->pb_tree[parm->pb_obj].ob_flags;
	state=parm->pb_tree[parm->pb_obj].ob_state;

	vst_effects(glb.vdi.ha,TXT_NORMAL);
	vst_alignment(glb.vdi.ha,ALI_LEFT,ALI_BASE,&dummy,&dummy);
	user=(UBLK *)(parm->pb_parm);

	vst_point(glb.vdi.ha,10-glb.vdi.low,&dummy,&htext,&dummy,&dummy);

	tour=1;
	if (flags & EXIT)
		tour+=1;
	if (flags & DEFAULT)
		tour+=1;

	my1.g_x=parm->pb_x-tour;
	my1.g_y=parm->pb_y-tour;
	my1.g_w=parm->pb_w+2*tour;
	my1.g_h=parm->pb_h+2*tour;
	my2.g_x=parm->pb_xc;
	my2.g_y=parm->pb_yc;
	my2.g_w=parm->pb_wc;
	my2.g_h=parm->pb_hc;
	_rcIntersect(&my1,&my2);
	tab_clip[0]=my2.g_x;
	tab_clip[1]=my2.g_y;
	tab_clip[2]=tab_clip[0]+my2.g_w-1;
	tab_clip[3]=tab_clip[1]+my2.g_h-1;
	vs_clip(glb.vdi.ha,TRUE,tab_clip);

	bar[0]=my1.g_x;
	bar[1]=my1.g_y;
	bar[2]=bar[0]+my1.g_w-1;
	bar[3]=bar[1]+my1.g_h-1;

	vswr_mode(glb.vdi.ha,MD_REPLACE);
	vsf_perimeter(glb.vdi.ha,FALSE);
	vsf_interior(glb.vdi.ha,FIS_SOLID);
	vsf_style(glb.vdi.ha,0);
	vsf_color(glb.vdi.ha,BLACK);

	/****************************************************************************
		Cadre Noir (attributs EXIT/DEFAUT/SELECTABLE)
	****************************************************************************/
	v_bar(glb.vdi.ha,bar);

	if (flags&FL3DIND && flags&FL3DACT)
	{
		backcol=LWHITE;
		textcol=BLACK;
	}
	else if (flags&FL3DIND)
	{
		if (state&SELECTED)
		{
			backcol=LBLACK;
			textcol=WHITE;
		}
		else
		{
			backcol=LWHITE;
			textcol=BLACK;
		}
	}
	else
	{
		if (state&SELECTED)
		{
			backcol=BLACK;
			textcol=WHITE;
		}
		else
		{
			backcol=WHITE;
			textcol=BLACK;
		}
	}
	if (backcol==LWHITE && glb.vdi.extnd[4]<4)
		backcol=WHITE;
	if (backcol!=BLACK)
	{
		bar[0]=parm->pb_x;
		bar[1]=parm->pb_y;
		bar[2]=bar[0]+parm->pb_w-1;
		bar[3]=bar[1]+parm->pb_h-1;
		vsf_color(glb.vdi.ha,backcol);
		/*************************************************************************
			Cadre Int‚rieur Blanc/Noir/Gris suivant s‚lection
		*************************************************************************/
		v_bar(glb.vdi.ha,bar);
	}
	vst_color(glb.vdi.ha,textcol);
	vs_clip(glb.vdi.ha,FALSE,tab_clip);

	my1.g_x=parm->pb_x;
	my1.g_y=parm->pb_y;
	my1.g_w=parm->pb_w;
	my1.g_h=parm->pb_h;
	my2.g_x=parm->pb_xc;
	my2.g_y=parm->pb_yc;
	my2.g_w=parm->pb_wc;
	my2.g_h=parm->pb_hc;
	_rcIntersect(&my1,&my2);
	tab_clip[0]=my2.g_x;
	tab_clip[1]=my2.g_y;
	tab_clip[2]=tab_clip[0]+my2.g_w-1;
	tab_clip[3]=tab_clip[1]+my2.g_h-1;
	vs_clip(glb.vdi.ha,TRUE,tab_clip);
	vswr_mode(glb.vdi.ha,MD_TRANS);

	tLarg=0;
	trait=(uchar *)strchr((char *)user->spec,'[');
	if (trait!=NULL)
	{
		if (trait!=(uchar *)user->spec)
		{
			*trait=0;
			vst_effects(glb.vdi.ha,TXT_UNDERLINED);
			vqt_extent(glb.vdi.ha,(char *)user->spec,extent);
			vst_effects(glb.vdi.ha,TXT_NORMAL);
			*trait='[';
			tLarg=extent[2]-extent[6];
		}
		trait++;
	}
	else
		trait=(uchar *)user->spec;
	vqt_extent(glb.vdi.ha,(char *)trait,extent);
	tLarg+=extent[2]-extent[6];

	x=parm->pb_x;
	x+=(parm->pb_w-tLarg)/2;
	y=parm->pb_y;
	y+=parm->pb_h/2;
	y-=(extent[7]-extent[1])/2;
	y+=htext;
	/****************************************************************************
		Si bouton 3D alors on d‚cale le texte
	****************************************************************************/
	if (flags&FL3DIND && flags&FL3DACT && state&SELECTED)
	{
		x+=1;
		y+=1;
	}

	trait=(uchar *)strchr((char *)user->spec,'[');
	if (trait!=NULL)
	{
		if (trait!=(uchar *)user->spec)
		{
			*trait=0;
			vqt_extent(glb.vdi.ha,(char *)user->spec,extent);
			v_gtext(glb.vdi.ha,x,y,(char *)user->spec);
			*trait='[';
			x+=extent[2]-extent[0];
		}
		trait++;
		if (*trait!=0)
		{
			car[0]=*trait;
			car[1]=0;
			vst_effects(glb.vdi.ha,TXT_UNDERLINED);
			v_gtext(glb.vdi.ha,x,y,(char *)car);
			vqt_extent(glb.vdi.ha,(char *)car,extent);
			vst_effects(glb.vdi.ha,TXT_NORMAL);
			trait++;
			x+=extent[2]-extent[0];
		}
		if (*trait!=0)
			v_gtext(glb.vdi.ha,x,y,(char *)trait);
	}
	else
		v_gtext(glb.vdi.ha,x,y,(char *)user->spec);

	vs_clip(glb.vdi.ha,FALSE,tab_clip);
	vst_effects(glb.vdi.ha,TXT_NORMAL);
	vst_alignment (glb.vdi.ha,tattr[3],tattr[4],&dummy,&dummy);
	vsf_interior(glb.vdi.ha,fattr[2]);
	vsf_style(glb.vdi.ha,fattr[0]);
	vsf_perimeter(glb.vdi.ha,fattr[4]);
	/****************************************************************************
		Si le bouton est en relief alors il faut demander … l'AES de dessiner
		l'attribut SELECTED pour qu'il inverse le cadre fin gris/noir.
		Par contre si le bouton n'est pas en relief, il ne faut surtout pas
		demander … l'AES de dessiner cet attribut sinon; lorsque l'objet est
		s‚lectionn‚ (donc noir), l'AES le recouvre en blanc !!
	****************************************************************************/
	if (flags&FL3DIND && flags&FL3DACT || flags&FL3DIND)
		return parm->pb_currstate;
	else
		return parm->pb_currstate&~SELECTED;
}
Esempio n. 28
0
/*******************************************************************************
	Cross & Radio G_BUTTON
*******************************************************************************/
int cdecl _drawCroixCarre(PARMBLK *parm)
{
	pb.pb_tree			=	glb.rsc.head.trindex[FUSER];
	if (((parm->pb_tree[parm->pb_obj].ob_type)&0xFF00)==USD_CROSS)
		pb.pb_obj		=	FUSDCAR+glb.vdi.low;
	else if (((parm->pb_tree[parm->pb_obj].ob_type)&0xFF00)==USD_ROUND)
		pb.pb_obj		=	FUSDCIR+glb.vdi.low;
	else
		pb.pb_obj		=	FUSDLAR+glb.vdi.low;
	pb.pb_prevstate	=	pb.pb_tree[pb.pb_obj].ob_state;
	if (((parm->pb_tree[parm->pb_obj].ob_type)&0xFF00)==USD_NUM)
		pb.pb_currstate=	pb.pb_tree[pb.pb_obj].ob_state;
	else
		pb.pb_currstate=	parm->pb_tree[parm->pb_obj].ob_state;
	pb.pb_w				=	pb.pb_tree[pb.pb_obj].ob_width;
	pb.pb_h				=	pb.pb_tree[pb.pb_obj].ob_height;
	pb.pb_x				=	parm->pb_x;
	pb.pb_y				=	parm->pb_y+(parm->pb_h-pb.pb_h)/2;
	pb.pb_xc				=	parm->pb_xc;
	pb.pb_yc				=	parm->pb_yc;
	pb.pb_wc				=	parm->pb_wc;
	pb.pb_hc				=	parm->pb_hc;
	pb.pb_parm			=	pb.pb_tree[pb.pb_obj].ob_spec.userblk->ub_parm;

   vqt_attributes(glb.vdi.ha,tattr);
   vqf_attributes(glb.vdi.ha,fattr);
	flags=parm->pb_tree[parm->pb_obj].ob_flags;
	state=parm->pb_tree[parm->pb_obj].ob_state;

	vst_effects(glb.vdi.ha,TXT_NORMAL);
	vst_alignment(glb.vdi.ha,ALI_LEFT,ALI_BASE,&dummy,&dummy);
	user=(UBLK *)(parm->pb_parm);

	vst_point(glb.vdi.ha,10-glb.vdi.low,&dummy,&htext,&dummy,&dummy);

	my1.g_x=parm->pb_x;
	my1.g_y=parm->pb_y;
	my1.g_w=parm->pb_w;
	my1.g_h=parm->pb_h;
	my2.g_x=parm->pb_xc;
	my2.g_y=parm->pb_yc;
	my2.g_w=parm->pb_wc;
	my2.g_h=parm->pb_hc;
	_rcIntersect(&my1,&my2);
	tab_clip[0]=my2.g_x;
	tab_clip[1]=my2.g_y;
	tab_clip[2]=tab_clip[0]+my2.g_w-1;
	tab_clip[3]=tab_clip[1]+my2.g_h-1;
	vs_clip(glb.vdi.ha,TRUE,tab_clip);

	bar[0]=my1.g_x;
	bar[1]=my1.g_y;
	bar[2]=bar[0]+my1.g_w-1;
	bar[3]=bar[1]+my1.g_h-1;

	vswr_mode(glb.vdi.ha,MD_REPLACE);
	vsf_perimeter(glb.vdi.ha,FALSE);
	vsf_interior(glb.vdi.ha,FIS_SOLID);
	vsf_style(glb.vdi.ha,0);

	if (flags&FL3DACT)
		backcol=LWHITE;
	else
		backcol=WHITE;
	textcol=BLACK;
	if (backcol==LWHITE && glb.vdi.extnd[4]<4)
		backcol=WHITE;
	bar[0]=parm->pb_x;
	bar[1]=parm->pb_y;
	bar[2]=bar[0]+parm->pb_w-1;
	bar[3]=bar[1]+parm->pb_h-1;
	vsf_color(glb.vdi.ha,backcol);
	/****************************************************************************
		Fond Blanc/Gris suivant r‚solution et 3D
	****************************************************************************/
	v_bar(glb.vdi.ha,bar);
	vst_color(glb.vdi.ha,textcol);
	vs_clip(glb.vdi.ha,FALSE,tab_clip);

	my1.g_x=parm->pb_x;
	my1.g_y=parm->pb_y;
	my1.g_w=parm->pb_w;
	my1.g_h=parm->pb_h;
	my2.g_x=parm->pb_xc;
	my2.g_y=parm->pb_yc;
	my2.g_w=parm->pb_wc;
	my2.g_h=parm->pb_hc;
	_rcIntersect(&my1,&my2);
	tab_clip[0]=my2.g_x;
	tab_clip[1]=my2.g_y;
	tab_clip[2]=tab_clip[0]+my2.g_w-1;
	tab_clip[3]=tab_clip[1]+my2.g_h-1;
	vs_clip(glb.vdi.ha,TRUE,tab_clip);
	vswr_mode(glb.vdi.ha,MD_TRANS);

	tLarg=0;
	trait=(uchar *)strchr((char *)user->spec,'[');
	if (trait!=NULL)
	{
		if (trait!=(uchar *)user->spec)
		{
			*trait=0;
			vst_effects(glb.vdi.ha,TXT_UNDERLINED);
			vqt_extent(glb.vdi.ha,(char *)user->spec,extent);
			vst_effects(glb.vdi.ha,TXT_NORMAL);
			*trait='[';
			tLarg=extent[2]-extent[6];
		}
		trait++;
	}
	else
		trait=(uchar *)user->spec;
	vqt_extent(glb.vdi.ha,(char *)trait,extent);
	tLarg+=extent[2]-extent[6];

	if (((parm->pb_tree[parm->pb_obj].ob_type)&0xFF00)==USD_NUM)
	{
		vst_alignment(glb.vdi.ha,ALI_CENTER,ALI_BASE,&dummy,&dummy);
		x=parm->pb_x+parm->pb_w/2;
	}
	else
	{
		vst_alignment(glb.vdi.ha,ALI_LEFT,ALI_BASE,&dummy,&dummy);
		x=parm->pb_x+1.5*pb.pb_w;
	}
	y=parm->pb_y;
	y+=parm->pb_h/2;
	y-=(extent[7]-extent[1])/2;
	y+=htext;

	trait=(uchar *)strchr((char *)user->spec,'[');
	if (trait!=NULL)
	{
		if (trait!=(uchar *)user->spec)
		{
			*trait=0;
			vqt_extent(glb.vdi.ha,(char *)user->spec,extent);
			v_gtext(glb.vdi.ha,x,y,(char *)user->spec);
			*trait='[';
			x+=extent[2]-extent[0];
		}
		trait++;
		if (*trait!=0)
		{
			car[0]=*trait;
			car[1]=0;
			vst_effects(glb.vdi.ha,TXT_UNDERLINED);
			v_gtext(glb.vdi.ha,x,y,(char *)car);
			vqt_extent(glb.vdi.ha,(char *)car,extent);
			vst_effects(glb.vdi.ha,TXT_NORMAL);
			trait++;
			x+=extent[2]-extent[0];
		}
		if (*trait!=0)
			v_gtext(glb.vdi.ha,x,y,(char *)trait);
	}
	else
		v_gtext(glb.vdi.ha,x,y,(char *)user->spec);

	vs_clip(glb.vdi.ha,FALSE,tab_clip);
	vst_effects(glb.vdi.ha,TXT_NORMAL);
	vst_alignment (glb.vdi.ha,tattr[3],tattr[4],&dummy,&dummy);
	vsf_interior(glb.vdi.ha,fattr[2]);
	vsf_style(glb.vdi.ha,fattr[0]);
	vsf_perimeter(glb.vdi.ha,fattr[4]);

	_drawCicon(&pb);
	if (((parm->pb_tree[parm->pb_obj].ob_type)&0xFF00)==USD_NUM)
	{
		pb.pb_tree		=	glb.rsc.head.trindex[FUSER];
		pb.pb_obj		=	FUSDRAR+glb.vdi.low;
		pb.pb_prevstate=	pb.pb_tree[pb.pb_obj].ob_state;
		pb.pb_currstate=	pb.pb_tree[pb.pb_obj].ob_state;
		pb.pb_w			=	pb.pb_tree[pb.pb_obj].ob_width;
		pb.pb_h			=	pb.pb_tree[pb.pb_obj].ob_height;
		pb.pb_x			=	parm->pb_x+parm->pb_w-pb.pb_w;
		pb.pb_y			=	parm->pb_y+(parm->pb_h-pb.pb_h)/2;
		pb.pb_xc			=	parm->pb_xc;
		pb.pb_yc			=	parm->pb_yc;
		pb.pb_wc			=	parm->pb_wc;
		pb.pb_hc			=	parm->pb_hc;
		pb.pb_parm		=	pb.pb_tree[pb.pb_obj].ob_spec.userblk->ub_parm;
		_drawCicon(&pb);
	}

	/****************************************************************************
		Si le bouton est en relief alors il faut demander … l'AES de dessiner
		l'attribut SELECTED pour qu'il inverse le cadre fin gris/noir.
		Par contre si le bouton n'est pas en relief, il ne faut surtout pas
		demander … l'AES de dessiner cet attribut sinon; lorsque l'objet est
		s‚lectionn‚ (donc noir), l'AES le recouvre en blanc !!
	****************************************************************************/
	return parm->pb_currstate&~SELECTED;
}
Esempio n. 29
0
int OnObjectNotifyPal(void *w, int obj)
{
  GEM_WINDOW     *wnd = (GEM_WINDOW *) w ;
  WEXTENSION_PAL *wext = wnd->DlgData->UserData ;
  OBJECT         *adr_mkpal = wnd->DlgData->BaseObject ;
  int            off_x, off_y ;
  int            xm, ym, dummy ;
  int            pb_x, pb_y ;
  int            x1, y1, x2, y2 ;
  int            code = -1 ;
  char           buf[15] ;

  graf_mkstate( &xm, &ym, &dummy, &dummy ) ;

  switch( obj )
  {
    case MKPAL_MRED      :
    case MKPAL_PRED      : if ( obj == MKPAL_PRED ) wext->curr_rgb[0]++ ;
                           else                     wext->curr_rgb[0]-- ;
                           if (wext->curr_rgb[0] < 1)    wext->curr_rgb[0] = 1 ;
                           if (wext->curr_rgb[0] > 1000) wext->curr_rgb[0] = 1000 ;
                           off_y = (int) ((1000-wext->curr_rgb[0])*(float)wext->hf/1000.0) ;
                           adr_mkpal[MKPAL_RED].ob_y = off_y ;
                           xobjc_draw( wnd->window_handle,adr_mkpal, MKPAL_REDBOX ) ;
                           sprintf(buf, "%.4d", wext->curr_rgb[0]) ;
                           write_text(adr_mkpal, MKPAL_TRED, buf) ;
                           xobjc_draw( wnd->window_handle,adr_mkpal, MKPAL_TRED ) ;
                           vs_color(handle, wext->index, wext->curr_rgb) ;
                           break ;
    case MKPAL_MGREEN    :
    case MKPAL_PGREEN    : if ( obj == MKPAL_PGREEN ) wext->curr_rgb[1]++ ;
                           else                       wext->curr_rgb[1]-- ;
                           if (wext->curr_rgb[1] < 1)    wext->curr_rgb[1] = 1 ;
                           if (wext->curr_rgb[1] > 1000) wext->curr_rgb[1] = 1000 ;
                           off_y = (int) ((1000-wext->curr_rgb[1])*(float)wext->hf/1000.0) ;
                           adr_mkpal[MKPAL_GREEN].ob_y = off_y ;
                           xobjc_draw( wnd->window_handle,adr_mkpal, MKPAL_GREENBOX ) ;
                           sprintf(buf, "%.4d", wext->curr_rgb[1]) ;
                           write_text(adr_mkpal, MKPAL_TGREEN, buf) ;
                           xobjc_draw( wnd->window_handle,adr_mkpal, MKPAL_TGREEN ) ;
                           vs_color(handle, wext->index, wext->curr_rgb) ;
                           break ;
    case MKPAL_MBLUE     :
    case MKPAL_PBLUE     : if ( obj == MKPAL_PBLUE ) wext->curr_rgb[2]++ ;
                           else                      wext->curr_rgb[2]-- ;
                           if (wext->curr_rgb[2] < 1)    wext->curr_rgb[2] = 1 ;
                           if (wext->curr_rgb[2] > 1000) wext->curr_rgb[2] = 1000 ;
                           off_y = (int) ((1000-wext->curr_rgb[2])*(float)wext->hf/1000.0) ;
                           adr_mkpal[MKPAL_BLUE].ob_y = off_y ;
                           xobjc_draw( wnd->window_handle,adr_mkpal, MKPAL_BLUEBOX ) ;
                           sprintf(buf, "%.4d", wext->curr_rgb[2]) ;
                           write_text(adr_mkpal, MKPAL_TBLUE, buf) ;
                           xobjc_draw( wnd->window_handle,adr_mkpal, MKPAL_TBLUE ) ;
                           vs_color(handle, wext->index, wext->curr_rgb) ;
                           break ;
    case MKPAL_REDBOX    : 
                           objc_offset(adr_mkpal, MKPAL_RED, &off_x, &off_y) ;
                           if (ym > off_y) wext->curr_rgb[0] = wext->curr_rgb[0]-20 ;
                           else            wext->curr_rgb[0] = wext->curr_rgb[0]+20 ;
                           if (wext->curr_rgb[0] < 1)    wext->curr_rgb[0] = 1 ;
                           if (wext->curr_rgb[0] > 1000) wext->curr_rgb[0] = 1000 ;
                           off_y = (int) ((1000-wext->curr_rgb[0])*(float)wext->hf/1000.0) ;
                           adr_mkpal[MKPAL_RED].ob_y = off_y ;
                           xobjc_draw( wnd->window_handle,adr_mkpal, MKPAL_REDBOX ) ;
                           sprintf(buf, "%.4d", wext->curr_rgb[0]) ;
                           write_text(adr_mkpal, MKPAL_TRED, buf) ;
                           xobjc_draw( wnd->window_handle,adr_mkpal, MKPAL_TRED ) ;
                           vs_color(handle, wext->index, wext->curr_rgb) ;
                           break ;
    case MKPAL_GREENBOX  : 
                           objc_offset(adr_mkpal, MKPAL_GREEN, &off_x, &off_y) ;
                           if (ym > off_y) wext->curr_rgb[1] = wext->curr_rgb[1]-20 ;
                           else            wext->curr_rgb[1] = wext->curr_rgb[1]+20 ;
                           if (wext->curr_rgb[1] < 1)  wext->curr_rgb[1] = 1 ;
                           if (wext->curr_rgb[1] > 1000) wext->curr_rgb[1] = 1000 ;
                           off_y = (int) ((1000-wext->curr_rgb[1])*(float)wext->hf/1000.0) ;
                           adr_mkpal[MKPAL_GREEN].ob_y = off_y ;
                           xobjc_draw( wnd->window_handle,adr_mkpal, MKPAL_GREENBOX ) ;
                           sprintf(buf, "%.4d", wext->curr_rgb[1]) ;
                           write_text(adr_mkpal, MKPAL_TGREEN, buf) ;
                           xobjc_draw( wnd->window_handle,adr_mkpal, MKPAL_TGREEN ) ;
                           vs_color(handle, wext->index, wext->curr_rgb) ;
                           break ;
    case MKPAL_BLUEBOX   : 
                           objc_offset(adr_mkpal, MKPAL_BLUE, &off_x, &off_y) ;
                           if (ym > off_y) wext->curr_rgb[2] = wext->curr_rgb[2]-20 ;
                           else            wext->curr_rgb[2] = wext->curr_rgb[2]+20 ;
                           if (wext->curr_rgb[2] < 1)    wext->curr_rgb[2] = 1 ;
                           if (wext->curr_rgb[2] > 1000) wext->curr_rgb[2] = 1000 ;
                           off_y = (int) ((1000-wext->curr_rgb[2])*(float)wext->hf/1000.0) ;
                           adr_mkpal[MKPAL_BLUE].ob_y = off_y ;
                           xobjc_draw( wnd->window_handle,adr_mkpal, MKPAL_BLUEBOX ) ;
                           sprintf(buf, "%.4d", wext->curr_rgb[2]) ;
                           write_text(adr_mkpal, MKPAL_TBLUE, buf) ;
                           xobjc_draw( wnd->window_handle,adr_mkpal, MKPAL_TBLUE ) ;
                           vs_color(handle, wext->index, wext->curr_rgb) ;
                           break ;
    case MKPAL_RED       : wext->curr_rgb[0] = (float) graf_slidebox(adr_mkpal, MKPAL_REDBOX, MKPAL_RED, 1) ;
                           off_y = (int) (wext->curr_rgb[0]*(float)wext->hf/1000.0) ;
                           adr_mkpal[MKPAL_RED].ob_y = off_y ;
                           xobjc_draw( wnd->window_handle,adr_mkpal, MKPAL_REDBOX ) ;
                           wext->curr_rgb[0] = 1000-wext->curr_rgb[0] ;
                           sprintf(buf, "%.4d", wext->curr_rgb[0]) ;
                           write_text(adr_mkpal, MKPAL_TRED, buf) ;
                           xobjc_draw( wnd->window_handle,adr_mkpal, MKPAL_TRED ) ;
                           vs_color(handle, wext->index, wext->curr_rgb) ;
                           break ;
     case MKPAL_GREEN    : wext->curr_rgb[1] = (float) graf_slidebox(adr_mkpal, MKPAL_GREENBOX, MKPAL_GREEN, 1) ;
                           off_y = (int) (wext->curr_rgb[1]*(float)wext->hf/1000.0) ;
                           adr_mkpal[MKPAL_GREEN].ob_y = off_y ;
                           xobjc_draw( wnd->window_handle,adr_mkpal, MKPAL_GREENBOX ) ;
                           wext->curr_rgb[1] = 1000-wext->curr_rgb[1] ;
                           sprintf(buf, "%.4d", wext->curr_rgb[1]) ;
                           write_text(adr_mkpal, MKPAL_TGREEN, buf) ;
                           xobjc_draw( wnd->window_handle,adr_mkpal, MKPAL_TGREEN ) ;
                           vs_color(handle, wext->index, wext->curr_rgb) ;
                           break ;
    case MKPAL_BLUE      : wext->curr_rgb[2] = (float) graf_slidebox(adr_mkpal, MKPAL_BLUEBOX, MKPAL_BLUE, 1) ;
                           off_y = (int) (wext->curr_rgb[2]*(float)wext->hf/1000.0) ;
                           adr_mkpal[MKPAL_BLUE].ob_y = off_y ;
                           xobjc_draw( wnd->window_handle,adr_mkpal, MKPAL_BLUEBOX ) ;
                           wext->curr_rgb[2] = 1000-wext->curr_rgb[2] ;
                           sprintf(buf, "%.4d", wext->curr_rgb[2]) ;
                           write_text(adr_mkpal, MKPAL_TBLUE, buf) ;
                           xobjc_draw( wnd->window_handle,adr_mkpal, MKPAL_TBLUE ) ;
                           vs_color(handle, wext->index, wext->curr_rgb) ;
                           break ;
    case MKPAL_LOAD     : charge_palette() ;
                          deselect(adr_mkpal, obj) ;
                          xobjc_draw( wnd->window_handle,adr_mkpal, obj ) ;
                          wext->flag_aff = 0 ;
                          break ;
    case MKPAL_SAVE     : sauve_palette() ;
                          deselect(adr_mkpal, obj) ;
                          xobjc_draw( wnd->window_handle,adr_mkpal, obj ) ;
                          wext->flag_aff = 0 ;
                          break ;
    case MKPAL_START    :
    case MKPAL_END      : if ( obj == MKPAL_START ) wext->stdeg  = wext->index ;
                          else                      wext->enddeg = wext->index ;
                          if (selected(adr_mkpal, MKPAL_START) && selected(adr_mkpal, MKPAL_END))
                          {
                            deselect(adr_mkpal, MKPAL_START) ;
                            deselect(adr_mkpal, MKPAL_END) ;
                            xobjc_draw( wnd->window_handle,adr_mkpal, MKPAL_START ) ;
                            xobjc_draw( wnd->window_handle,adr_mkpal, MKPAL_END ) ;
                            cree_degrade(wext->stdeg, wext->enddeg) ;
                            wext->stdeg = wext->enddeg = 500 ;
                          }
                          break ;
    case MKPAL_APPLIQUE : read_text(adr_mkpal, MKPAL_TRED, buf) ;
                          wext->rgb[0] = atoi(buf) ;
                          off_y = (int) ((1000-wext->rgb[0])*(float)wext->hf/1000.0) ;
                          adr_mkpal[MKPAL_RED].ob_y = off_y ;
                          xobjc_draw( wnd->window_handle,adr_mkpal, MKPAL_REDBOX ) ;
                          read_text(adr_mkpal, MKPAL_TGREEN, buf) ;
                          wext->rgb[1] = atoi(buf) ;
                          off_y = (int) ((1000-wext->rgb[1])*(float)wext->hf/1000.0) ;
                          adr_mkpal[MKPAL_GREEN].ob_y = off_y ;
                          xobjc_draw( wnd->window_handle,adr_mkpal, MKPAL_GREENBOX ) ;
                          read_text(adr_mkpal, MKPAL_TBLUE, buf) ;
                          wext->rgb[2] = atoi(buf) ;
                          off_y = (int) ((1000-wext->rgb[2])*(float)wext->hf/1000.0) ;
                          adr_mkpal[MKPAL_BLUE].ob_y = off_y ;
                          xobjc_draw( wnd->window_handle,adr_mkpal, MKPAL_BLUEBOX ) ;
                          vs_color(handle, wext->index, wext->rgb) ;
                          deselect(adr_mkpal, obj) ;
                          xobjc_draw( wnd->window_handle,adr_mkpal, obj ) ;
                          break ;
    case MKPAL_BOX      : objc_offset(adr_mkpal, obj, &pb_x, &pb_y) ;
                          if (wext->flag_aff)
                          {
                            x1 = pb_x+(wext->index % wext->nb_col_x)*wext->ww ;
                            y1 = pb_y+(wext->index / wext->nb_col_x)*wext->hh ;
                            x2 = x1+wext->ww-1 ;
                            y2 = y1+wext->hh-1 ;
                            vsf_color(handle, 1) ;
                            vswr_mode(handle, MD_XOR) ;
                            vsl_width(handle, 3) ;
                            v_hide_c(handle) ;
                            rectangle(x1, y1, x2, y2) ;
                            v_show_c(handle, 1) ;
                          }
                          else wext->flag_aff = 1 ;
                          graf_mkstate(&xm, &ym, &dummy, &dummy) ;
                          wext->index = (xm-pb_x)/wext->ww+ wext->nb_col_x*((ym-pb_y)/wext->hh) ;
                          vq_color(handle, wext->index, 0, wext->rgb) ;
                          sprintf(buf, "%.4d", wext->rgb[0]) ;
                          write_text(adr_mkpal, MKPAL_TRED, buf) ;
                          sprintf(buf, "%.4d", wext->rgb[1]) ;
                          write_text(adr_mkpal, MKPAL_TGREEN, buf) ;
                          sprintf(buf, "%.4d", wext->rgb[2]) ;
                          write_text(adr_mkpal, MKPAL_TBLUE, buf) ;
                          xobjc_draw( wnd->window_handle,adr_mkpal, MKPAL_RGB ) ;
                          x1 = pb_x+wext->ww*((xm-pb_x)/wext->ww) ;
                          y1 = pb_y+wext->hh*((ym-pb_y)/wext->hh) ;
                          x2 = x1+wext->ww-1 ;
                          y2 = y1+wext->hh-1 ;
                          vsf_color(handle, 1) ;
                          v_hide_c(handle) ;
                          vswr_mode(handle, MD_XOR) ;
                          vsl_width(handle, 3) ;
                          rectangle(x1, y1, x2, y2) ;
                          v_show_c(handle, 1) ;
                          xobjc_draw( wnd->window_handle,adr_mkpal, MKPAL_CURRCOL ) ;
                          off_y = (int) ((1000-wext->rgb[0])*(float)wext->hf/1000.0) ;
                          adr_mkpal[MKPAL_RED].ob_y = off_y ;
                          xobjc_draw( wnd->window_handle,adr_mkpal, MKPAL_REDBOX ) ;
                          off_y = (int) ((1000-wext->rgb[1])*(float)wext->hf/1000.0) ;
                          adr_mkpal[MKPAL_GREEN].ob_y = off_y ;
                          xobjc_draw( wnd->window_handle,adr_mkpal, MKPAL_GREENBOX ) ;
                          off_y = (int) ((1000-wext->rgb[2])*(float)wext->hf/1000.0) ;
                          adr_mkpal[MKPAL_BLUE].ob_y = off_y ;
                          xobjc_draw( wnd->window_handle,adr_mkpal, MKPAL_BLUEBOX ) ;
                          break ;
     case MKPAL_OK      : code = IDOK ;
                          break ;
     case MKPAL_CANCEL  : code = IDCANCEL ;
                          break ;
  }

  if ( code == IDOK )
  {

  }

  return( code ) ;
}
Esempio n. 30
0
static
void __CDECL evnt_sb_redraw( COMPONENT *c, long buff[8] )
{
	size_t i;
	struct gui_window * gw = (struct gui_window *)mt_CompDataSearch(&app, c, CDT_OWNER);
	assert(gw != NULL);
	CMP_STATUSBAR sb = gw->root->statusbar;
	assert( sb != NULL );
	if( sb == NULL )
		return;

	if( sb->attached == false )
		return;

	LGRECT work, lclip;
	short pxy[8], d, pxyclip[4];

	mt_CompGetLGrect(&app, sb->comp, WF_WORKXYWH, &work);
	lclip = work;
	if ( !rc_lintersect( (LGRECT*)&buff[4], &lclip ) ) {
		return;
	}
	vsf_interior(atari_plot_vdi_handle, FIS_SOLID );
	vsl_color(atari_plot_vdi_handle, BLACK );
	vsl_type(atari_plot_vdi_handle, 1);
	vsl_width(atari_plot_vdi_handle, 1 );
	vst_color(atari_plot_vdi_handle, BLACK);

	vst_height(atari_plot_vdi_handle, atari_sysinfo.medium_sfont_pxh, &pxy[0], &pxy[1], &pxy[2], &pxy[3] );
	vst_alignment(atari_plot_vdi_handle, 0, 5, &d, &d );
	vst_effects(atari_plot_vdi_handle, 0 );
	pxyclip[0] = lclip.g_x;
	pxyclip[1] = lclip.g_y;
	pxyclip[2] = lclip.g_x + lclip.g_w-1;
	pxyclip[3] = lclip.g_y + lclip.g_h-1;

	vs_clip(atari_plot_vdi_handle, 1, (short*)&pxyclip );
	vswr_mode(atari_plot_vdi_handle, MD_REPLACE );

	if( lclip.g_y <= work.g_y ) {
		pxy[0] = work.g_x;
		pxy[1] = work.g_y;
		pxy[2] = MIN( work.g_x + work.g_w, lclip.g_x + lclip.g_w );
		pxy[3] = work.g_y;
		v_pline(atari_plot_vdi_handle, 2, (short*)&pxy );
	}

	if(app.nplanes > 2) {
		vsf_color(atari_plot_vdi_handle, LWHITE);
	} else {
		vsf_color(atari_plot_vdi_handle, WHITE );
	}

	pxy[0] = work.g_x;
	pxy[1] = work.g_y+1;
	pxy[2] = work.g_x + work.g_w-1;
	pxy[3] = work.g_y + work.g_h-1;
	v_bar(atari_plot_vdi_handle, pxy );


	if( sb->textlen > 0 ) {
		short curx;
		short vqw[4];
		char t[2];
		short cw = 8;
		t[1]=0;
		if( atari_sysinfo.sfont_monospaced ) {
			t[0]='A';
			int r = vqt_width(atari_plot_vdi_handle, t[0], &vqw[0], &vqw[1], &vqw[2] );
			cw = vqw[0];
		}
		vswr_mode(atari_plot_vdi_handle, MD_TRANS );
		for( curx = work.g_x + 2, i=0 ; (curx+cw < work.g_x+work.g_w ) && i < sb->textlen; i++ ){
			t[0] = sb->text[i];
			if( !atari_sysinfo.sfont_monospaced ) {
				vqt_width(atari_plot_vdi_handle, t[0], &vqw[0], &vqw[1], &vqw[2] );
				cw = vqw[0];
			}
			if( curx >= lclip.g_x - cw ) {
				v_gtext(atari_plot_vdi_handle, curx, work.g_y + 5, (char*)&t );
			}
			curx += cw;
			if( curx >= lclip.g_x + lclip.g_w )
				break;
		}
	}
	vswr_mode(atari_plot_vdi_handle, MD_REPLACE );
	pxy[0] = work.g_x + work.g_w;
	pxy[1] = work.g_y + work.g_h;
	pxy[2] = work.g_x + work.g_w;
	pxy[3] = work.g_y + work.g_h-work.g_h;
	v_pline(atari_plot_vdi_handle, 2, (short*)&pxy );

	vs_clip(atari_plot_vdi_handle, 0, (short*)&pxyclip );
	return;
}