Beispiel #1
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) ;
}
Beispiel #2
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;
}
Beispiel #3
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);
}
Beispiel #4
0
global
void p_gbar(int d, RECT *r)	/* for perimeter = 1 */
{
	G_i l[10],
	    x = r->x - d,
	    y = r->y - d,
	    w = r->w + d+d,
	    h = r->h + d+d;
	l[0] = x+1;	/* only the inside */
	l[1] = y+1;
	l[2] = x+w-2;
	l[3] = y+h-2;
	v_bar(C.vh, l);
	l[0] = x;
	l[1] = y;
	l[2] = x+w-1;
	l[3] = y;
	l[4] = x+w-1;
	l[5] = y+h-1;
	l[6] = x;
	l[7] = y+h-1;
	l[8] = x;
	l[9] = y+1;		/* beware Xor mode :-) */
	v_pline(C.vh,5,l);
}
Beispiel #5
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);
}
Beispiel #6
0
global
void gbar(int d, RECT *r)	/* for perimeter = 0 */
{
	G_i l[4];
	l[0] = r->x - d;
	l[1] = r->y - d;
	l[2] = r->x + r->w + d - 1;
	l[3] = r->y + r->h + d - 1;
	v_bar(C.vh, l);
}
Beispiel #7
0
global
void bar(int d,  G_i x, G_i y, G_i w, G_i h)
{
	G_i l[4];
	x -= d, y -= d, w += d+d, h += d+d;
	l[0] = x;
	l[1] = y;
	l[2] = x+w-1;
	l[3] = y+h-1;
	v_bar(C.vh, l);
}
Beispiel #8
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
     );
 }
Beispiel #9
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);
}
Beispiel #10
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;
}
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);
}
Beispiel #12
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);
}
Beispiel #13
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) ;
}
Beispiel #14
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);
}
Beispiel #15
0
main()
{
  gem_init();
  
  whandle = wind_create (4095, 20, 20, 280, 150);
            /* 4095 = tous les organes de commande */
  
  if (whandle < 0)
    form_alert (1, "[3][D‚sol‚!|Il ne reste plus de handle fenˆtre libre!][OK]"
);
  else
  {
    wind_open (whandle, 20, 20, 280, 150);
    
    /* Calcul de la zone de travail */
    
    wind_calc (1, 4095, 20, 20, 280, 150, &x, &y, &w, &h);
    
    /* Conversion de hauteur/largeur du deuxiŠme angle (x2/y2) */
    
    pxyarray[0] = x;          pxyarray[1] = y;
    pxyarray[2] = x+w-1;      pxyarray[3] = y+h-1;

    /* Effacer la zone de travail */
    
    vsf_interior (handle, 0);   /* Remplir avec couleur du fond */
    vsf_perimeter (handle, 0);  /* Pas de cadre */
    
    v_bar (handle, pxyarray);
    
    vsf_perimeter (handle, 1);  /* R‚activer le cadre */
    
    Crawcin();   /* Attendre appui touche */
    
    wind_close (whandle);
    wind_delete (whandle);
  }
  
  gem_exit();
}
Beispiel #16
0
global
void p_bar(int d, G_i x, G_i y, G_i w, G_i h)	/* for perimeter = 1 */
{
	G_i l[10];
	x -= d, y -= d, w += d+d, h += d+d;
	l[0] = x+1;	/* only the inside */
	l[1] = y+1;
	l[2] = x+w-2;
	l[3] = y+h-2;
	v_bar(C.vh, l);
	l[0] = x;
	l[1] = y;
	l[2] = x+w-1;
	l[3] = y;
	l[4] = x+w-1;
	l[5] = y+h-1;
	l[6] = x;
	l[7] = y+h-1;
	l[8] = x;
	l[9] = y+1;		/* beware Xor mode :-) */
	v_pline(C.vh,5,l);
}
Beispiel #17
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;

}
Beispiel #18
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);
}
Beispiel #19
0
static void __CDECL cert_info_draw( WINDOW * win, short buf[8], void * data)
{
	struct ssl_info_draw_param * dp = (struct ssl_info_draw_param *)data;
	GRECT work;
	short pxy[4];
	int maxchars;
	short d, cbh, cbw;
	int i = 0;
	short x,y,w,h;
	int px_ypos, px_xpos;
	char * line = malloc(512);
	if( line == NULL )
		return;

	LOG(("Cert info draw, win: %p, data: %p, scrollx: %d", win, data, dp->scrollx ));

	WindGet( win, WF_WORKXYWH, &x, &y, &w, &h );
	/*using static values here, as RsrcUserDraw has mem leaks & a very small stack */
	pxy[0] = work.g_x = x + 8;
	pxy[1] = work.g_y = y + 80;
	pxy[2] = x + 8 + 272;
	pxy[3] = y + 80 + 176;
	work.g_w = 272;
	work.g_h = 176;

	maxchars = (work.g_w / 8)+1;
	vs_clip( atari_plot_vdi_handle, 1,(short*) &pxy );
	vswr_mode( atari_plot_vdi_handle, MD_REPLACE );
	vsf_interior( atari_plot_vdi_handle, 1 );
	vsf_color( atari_plot_vdi_handle, LWHITE );
	v_bar( atari_plot_vdi_handle, (short*)&pxy );
	vst_height( atari_plot_vdi_handle, 16, &d, &d, &cbw, &cbh );
	vst_alignment(atari_plot_vdi_handle, 0, 5, &d, &d );
	vst_color( atari_plot_vdi_handle, BLACK );
	vst_effects( atari_plot_vdi_handle, 0 );
	px_ypos = px_xpos = 0;
	for(i=0; i<CERT_INF_LINES; i++ ) {
		switch( i ) {
			case 0:
				sprintf(line, "Cert Version:   %d", dp->cert_infos_n[dp->current].version  );
				break;

			case 1:
				sprintf(line, "Invalid before: %s", &dp->cert_infos_n[dp->current].not_before );
				break;

			case 2:
				sprintf(line, "Invalid after:  %s", &dp->cert_infos_n[dp->current].not_after );
				break;

			case 3:
				sprintf(line, "Signature type: %d", dp->cert_infos_n[dp->current].sig_type );
				break;

			case 4:
				sprintf(line, "Serial:         %d", dp->cert_infos_n[dp->current].serial );
				break;

			case 5:
				sprintf(line, "Issuer:         %s", &dp->cert_infos_n[dp->current].issuer );
				break;

			case 6:
				sprintf(line, "Subject:        %s", &dp->cert_infos_n[dp->current].subject );
				break;

			case 7:
				sprintf(line, "Cert type:      %d", dp->cert_infos_n[dp->current].cert_type );
				break;

			default:
				break;
		}
		if( (int)strlen(line) > dp->scrollx ) {
			if( dp->scrollx + maxchars < 511 && ( (signed int)strlen(line) - dp->scrollx) > maxchars )
				line[dp->scrollx + maxchars] = 0;
			v_gtext(atari_plot_vdi_handle, work.g_x + 1, work.g_y + px_ypos, &line[dp->scrollx]);
		}
		px_ypos += cbh;
	}
	vst_alignment(atari_plot_vdi_handle, 0, 0, &d, &d );
	vs_clip( atari_plot_vdi_handle, 0, (short*)&pxy );
	free( line );
}
Beispiel #20
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;
}
Beispiel #21
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;
}
Beispiel #22
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;
}
Beispiel #23
0
void browser_redraw( struct gui_window * gw )
{
	LGRECT bwrect;
	struct s_browser * b = gw->browser;
	short todo[4];
	struct rect clip;
	/* used for clipping of content redraw: */
	struct rect redraw_area;

	if( b->attached == false || b->bw->current_content == NULL ) {
		return;
	}

	browser_get_rect(gw, BR_CONTENT, &bwrect);

	plotter->resize(plotter, bwrect.g_w, bwrect.g_h);
	plotter->move(plotter, bwrect.g_x, bwrect.g_y );
	clip.x0 = 0;
	clip.y0 = 0;
	clip.x1 = bwrect.g_w;
	clip.y1 = bwrect.g_h;
	plotter->set_clip( plotter, &clip );
	if( plotter->lock(plotter) == 0 )
		return;

	if( b->scroll.required == true && b->bw->current_content != NULL) {
		browser_process_scroll( gw, bwrect );
		b->scroll.required = false;
	}

	if ((b->redraw.areas_used > 0) && b->bw->current_content != NULL ) {
		if( (plotter->flags & PLOT_FLAG_OFFSCREEN) == 0 ) {

			int i;
			GRECT area;
			GRECT fbwork;
			short wf_top[4];
			todo[0] = bwrect.g_x;
			todo[1] = bwrect.g_y;
			todo[2] = todo[0] + bwrect.g_w-1;
			todo[3] = todo[1] + bwrect.g_h-1;
			vs_clip(plotter->vdi_handle, 1, (short*)&todo[0]);

			wind_get( 0, WF_TOP, &wf_top[0], &wf_top[1],
						&wf_top[2], &wf_top[3] );

			if( wf_top[0] == gw->root->handle->handle
				&& wf_top[1] == _AESapid ){
				/* The window is on top, so there is no need to walk the 	*/
				/* AES rectangle list. 										*/
				for( i=0; i<b->redraw.areas_used; i++ ){
					fbwork.g_x = todo[0] - bwrect.g_x;
					fbwork.g_y = todo[1] - bwrect.g_y;
					if( fbwork.g_x < 0 ){
						fbwork.g_w = todo[2] + todo[0];
						fbwork.g_x = 0;
					} else {
						fbwork.g_w = todo[2];
					}
					if( fbwork.g_y < 0 ){
						fbwork.g_h = todo[3] + todo[1];
						fbwork.g_y = 0;
					} else {
						fbwork.g_h = todo[3];
					}
					area.g_x = b->redraw.areas[i].x0;
					area.g_y = b->redraw.areas[i].y0;
					area.g_w = b->redraw.areas[i].x1 - b->redraw.areas[i].x0;
					area.g_h = b->redraw.areas[i].y1 - b->redraw.areas[i].y0;
					if (rc_intersect((GRECT *)&fbwork,(GRECT *)&area)) {
						redraw_area.x0 = area.g_x;
						redraw_area.y0 = area.g_y;
						redraw_area.x1 = area.g_x + area.g_w;
						redraw_area.y1 = area.g_y + area.g_h;
						browser_redraw_content( gw, 0, 0, &redraw_area );
					} else {
						/* the area should be kept scheduled for later redraw,*/
						/* but because this is onscreen plotter, it doesn't   */
						/* make much sense anyway...						  */
					}
				}
			} else {
				/* walk the AES rectangle list: */
				if( wind_get(gw->root->handle->handle, WF_FIRSTXYWH,
								&todo[0], &todo[1], &todo[2], &todo[3] )!=0 ) {
					while (todo[2] && todo[3]) {
						/* convert screen to framebuffer coords: */
						fbwork.g_x = todo[0] - bwrect.g_x;
						fbwork.g_y = todo[1] - bwrect.g_y;
						if( fbwork.g_x < 0 ){
							fbwork.g_w = todo[2] + todo[0];
							fbwork.g_x = 0;
						} else {
							fbwork.g_w = todo[2];
						}
						if( fbwork.g_y < 0 ){
							fbwork.g_h = todo[3] + todo[1];
							fbwork.g_y = 0;
						} else {
							fbwork.g_h = todo[3];
						}
						/* walk the redraw requests: */
						for( i=0; i<b->redraw.areas_used; i++ ){
							area.g_x = b->redraw.areas[i].x0;
							area.g_y = b->redraw.areas[i].y0;
							area.g_w = b->redraw.areas[i].x1 - b->redraw.areas[i].x0;
							area.g_h = b->redraw.areas[i].y1 - b->redraw.areas[i].y0;
							if (rc_intersect((GRECT *)&fbwork,(GRECT *)&area)) {
								redraw_area.x0 = area.g_x;
								redraw_area.y0 = area.g_y;
								redraw_area.x1 = area.g_x + area.g_w;
								redraw_area.y1 = area.g_y + area.g_h;
								browser_redraw_content( gw, 0, 0, &redraw_area );
							} else {
								/* the area should be kept scheduled for later redraw,*/
								/* but because this is onscreen plotter, it doesn't   */
								/* make much sense anyway...						  */
							}

						}
						if (wind_get(gw->root->handle->handle, WF_NEXTXYWH,
								&todo[0], &todo[1], &todo[2], &todo[3])==0) {
							break;
						}
					}
				}
			}


			vs_clip(plotter->vdi_handle, 0, (short*)&todo);
		} else {

			/* its save to do a complete redraw without knowledge about GEM windows :) */
			/* walk the redraw requests: */
			int i;
			for( i=0; i<b->redraw.areas_used; i++ ){
				struct redraw_context ctx = {
					.interactive = true,
					.background_images = true,
					.plot = &atari_plotters
				};
				browser_window_redraw( b->bw, -b->scroll.current.x,
						-b->scroll.current.y, &b->redraw.areas[i], &ctx );
			}
			GRECT area;
			area.g_x = bwrect.g_x;
			area.g_y = bwrect.g_y;
			area.g_w = bwrect.g_w;
			area.g_h = bwrect.g_h;
			//plotter->blit( plotter, &area );
		}
		b->redraw.areas_used = 0;
	}
	if( b->caret.redraw == true && 	b->bw->current_content != NULL ) {
		LGRECT area;
		todo[0] = bwrect.g_x;
		todo[1] = bwrect.g_y;
		todo[2] = todo[0] + bwrect.g_w;
		todo[3] = todo[1] + bwrect.g_h;
		area.g_x = bwrect.g_x;
		area.g_y = bwrect.g_y;
		area.g_w = bwrect.g_w;
		area.g_h = bwrect.g_h;
		vs_clip(plotter->vdi_handle, 1, (short*)&todo[0]);
		browser_redraw_caret( gw, &area );
		vs_clip(plotter->vdi_handle, 0, (short*)&todo[0]);
		b->caret.redraw = false;
	}
	plotter->unlock(plotter);
	/* TODO: if we use offscreen bitmap, trigger content redraw here */
}

static void __CDECL browser_evnt_redraw( COMPONENT * c, long buff[8], void * data)
{
	struct gui_window * gw = (struct gui_window *) data;
	CMP_BROWSER b = gw->browser;
	LGRECT work, lclip;

	browser_get_rect( gw, BR_CONTENT, &work );
	lclip = work;
	if ( !rc_lintersect( (LGRECT*)&buff[4], &lclip ) ) return;

	if( b->bw->current_content == NULL ){
		short pxy[4];
		pxy[0] = lclip.g_x;
		pxy[1] = lclip.g_y;
		pxy[2] = lclip.g_x + lclip.g_w - 1;
		pxy[3] = lclip.g_y + lclip.g_h - 1;
		vsf_color( gw->root->handle->graf->handle, WHITE );
		vsf_perimeter( gw->root->handle->graf->handle, 0);
		vsf_interior( gw->root->handle->graf->handle, FIS_SOLID );
		vsf_style( gw->root->handle->graf->handle, 1);
		v_bar( gw->root->handle->graf->handle, (short*)&pxy );
		return;
	}

	/* convert redraw coords to framebuffer coords: */
	lclip.g_x -= work.g_x;
	lclip.g_y -= work.g_y;

	if( lclip.g_x < 0 ) {
		lclip.g_w = work.g_w + lclip.g_x;
		lclip.g_x = 0;
	}

	if( lclip.g_y < 0 ) {
		lclip.g_h = work.g_h + lclip.g_y;
		lclip.g_y = 0;
	}

	if( lclip.g_h > 0 && lclip.g_w > 0 ) {

		if( gw->browser->reformat_pending == true ){
			LGRECT newsize;
			gw->browser->reformat_pending = false;
			browser_get_rect(gw, BR_CONTENT, &newsize);
			/* this call will also schedule an redraw for the complete */
			/* area. */
			/* Resize must be handled here, because otherwise */
			/* a redraw is scheduled twice (1. by the frontend, 2. by AES) */
			browser_window_reformat(b->bw, false, newsize.g_w, newsize.g_h );
		} else {
			browser_schedule_redraw( gw, lclip.g_x, lclip.g_y,
				lclip.g_x + lclip.g_w, lclip.g_y + lclip.g_h
			);
		}
	}

	return;
}
Beispiel #24
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;
}
Beispiel #25
0
void chart_draw_bar (struct bar_chart * bc, int app_handle, int x, int y, int w, int h) {
	int pxy[4];
	int i, curr_x, curr_y;
	int scale_x_num, scale_x_den, scale_y_num, scale_y_den;
	int max_value, max_value_width, bar_chars, offset;
	char str[20]; /* numbers won't be larger than 20 */
	int bx, by, bw, bh; /* dimensions for bar chart */
	int char_w, char_h, cell_w, cell_h;

	clear_area (app_handle, x, y, w, h);
	if ((w < 50) || (h < 50)) return; /* too small to draw anything */

	max_value = find_max (bc->values, bc->num_bars);

	/* Find dimensions for display of bar chart */
	find_chart_dimensions (app_handle, 0, max_value, x, y, w, h, &max_value_width, &bx, &by, &bw, &bh);

	scale_x_num = bw/bc->num_bars;
	scale_x_den = bw%bc->num_bars;
	scale_y_num = bh/max_value;
	scale_y_den = bh%max_value;

	draw_axes_lines (app_handle, bx, by, bw, bh);
	draw_main_labels (app_handle, bc->title, bc->x_label, bc->y_label,
		bx, by, bw, bh, max_value_width);

	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);
	bar_chars = scale_x_num / cell_w; /* the number of chars that will fit in a bar */

	for (i = 0; i < bc->num_bars; i += 1) {
		pxy[0] = bx + i*scale_x_num+(i*scale_x_den)/bc->num_bars + scale_x_num/2;
		pxy[1] = by;
		pxy[2] = pxy[0];
		pxy[3] = by+5;

		v_pline (app_handle, 2, pxy);

		if (strlen (bc->labels[i]) < bar_chars) {
			/* label fits, so center and display */
			int offset = cell_w * (bar_chars - strlen (bc->labels[i]))/2;
			v_gtext (app_handle, pxy[0]-scale_x_num/2+cell_w/2+offset, pxy[3]+1.5*cell_h, bc->labels[i]);
		} else {
			/* label will not fit, so take only first part */
			int j;

			for (j=0; j<bar_chars; j+=1) {
				str[j] = bc->labels[i][j];
			}
			str[bar_chars]=0;
			v_gtext (app_handle, pxy[0]-scale_x_num/2+cell_w/2, pxy[3]+1.5*cell_h, str);
		}
	}
	draw_y_axis_labels (app_handle, 0, max_value, bx, by, bh);

	/* draw the bars */
	for (i = 0; i < bc->num_bars; i += 1) {
		vsf_color (app_handle, bc->colours[i]);
		vsf_interior (app_handle, bc->interior[i]);
		vsf_style (app_handle, bc->style[i]);

		pxy[0] = bx + i*scale_x_num + (i*scale_x_den)/bc->num_bars + 1;
		pxy[1] = by-1;
		pxy[2] = bx + (i+1)*scale_x_num+((i+1)*scale_x_den)/bc->num_bars;
		pxy[3] = by - bc->values[i]*scale_y_num-(bc->values[i]*scale_y_den)/max_value;

		v_bar (app_handle, pxy);
	}

}
Beispiel #26
0
/*
 * draw the polynomial into the editfield
 * Note: User VDI must be initialized!
 */
WORD cdecl draw_polynomial(PARMBLK *pb)
{
	int		i,j, field_w, field_h, *polyfactors;
	double	x, y;
	int		xo,yo;
	OBJECT	*tree;
	int		clipper[4], box[4], zero[4];
	
	if (userhandle<=0) return(NORMAL);		/* NO VDI!!! */
	
	tree = rs_trindex[POLY_ED];
	
	/* check: draw only if current state = old state */
	if (pb->pb_prevstate!=pb->pb_currstate)
		return (pb->pb_currstate & ~SELECTED);
	
	field_w = ObW(P_EDITFIELD);	field_h = ObH(P_EDITFIELD);
	polyfactors = *(int**)pb->pb_parm;
	
	box[0] = pb->pb_x-1;	
	box[1] = pb->pb_y-1;
	box[2] = pb->pb_x+pb->pb_w;
	box[3] = pb->pb_y+pb->pb_h;

	/* get pixel offsets */
	xo = box[0]; yo = box[1]+ObY(P_ZEROLINE)+ObH(P_ZEROLINE);
	
	/* Set Clip: */
	clipper[0] = MAX(box[0], pb->pb_xc);
	clipper[1] = MAX(box[1], pb->pb_yc);
	clipper[2] = MIN(box[2], pb->pb_xc+pb->pb_wc-1);
	clipper[3] = MIN(box[3], pb->pb_yc+pb->pb_hc-1);
	vs_clip(userhandle, 1, clipper);

	/* draw box */
	vsf_perimeter(userhandle, 1);		/* visible fill perimeter */
	vsf_color(userhandle, BLACK);
	vsf_interior(userhandle, FIS_HOLLOW);
	v_bar(userhandle, (int *)box);		/* fill rectangle */

	/* draw zeroline */
	zero[0]=xo; zero[1]=yo; zero[2]=xo+field_w; zero[3]=yo;
	vsl_type(userhandle, 3);
	vsl_color(userhandle, BLUE);
	v_pline(userhandle, 2, (int*)zero);
	
	/* calc polyarray */
	for (i=0; i<=POLYPOINTS; i++)
	{
		x = (XSCALE*(double)i)/(double)POLYPOINTS;
		for (j=0, y=0.0; j<4; j++) y=x*y+polyfactors[j];
		y=y*x/256.0;
		polyarray[i][0] = xo + ((double)field_w*i)/(double)POLYPOINTS;
		polyarray[i][1] = yo - ((double)field_h*y)/YSCALE;
		if (polyarray[i][1]<0) polyarray[i][1]=0;
	};
	
	/* draw curve */
	vsl_type(userhandle, 1);
	vsl_color(userhandle, RED);
	v_pline(userhandle, POLYPOINTS, (int *)&polyarray[0]);

	return (pb->pb_currstate & ~SELECTED);
}
Beispiel #27
0
void chart_draw_pie (struct pie_chart * pc, int app_handle, int x, int y, int w, int h) {
	int cx, cy, radius; /* centre and size of circle */
	int kx, ky; /* coordinates to start printing key */
	int i, total_values, bang;
	int char_h, char_w, cell_w, cell_h;

	clear_area (app_handle, x, y, w, h);
	if ((w < 50) || (h < 50)) return; /* too small to draw anything */

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

	/* calculate circle bounds */
	if (w < h) {
		int wo_key_height = h-(pc->num_slices + 2 + 3.5)*cell_h;

		/* dimensions if width less than height, allow for key below */
		radius = w/2 - cell_w;
		if (2*radius > wo_key_height) {
			radius = wo_key_height/2;
		}
		cx = x + w/2;
		cy = y + radius + cell_h + 1.5*cell_h;
		kx = x + 2*cell_w;
		ky = cy + radius + 1.5*cell_h;
	} else {
		int max_width=0;
		int wo_key_width;

		for (i=0; i<pc->num_slices; i+=1) {
			if (max_width < strlen(pc->labels[i])) {
				max_width = strlen(pc->labels[i]);
			}
		}
		/* dimensions if height less than width, allow for key to right */
		radius = h/2 - cell_h;
		wo_key_width = w-(2+max_width)*cell_w;
		if (2*radius + 2*cell_w > wo_key_width) {
			radius = wo_key_width/2 - cell_w;
		}
		cx = x + radius + cell_w;
		cy = y + radius + 1.5*cell_h; /* space for title */
		kx = cx + radius + 2*cell_w;
		ky = y+2.5*cell_h;
	}

	for (i=0, total_values=0; i<pc->num_slices; i += 1) {
		total_values += pc->values[i];
	}

	/* draw the title and key */
	vsf_color (app_handle, BLACK);
	v_gtext (app_handle, x+2*cell_w, y+cell_h+2, pc->title);

	vst_point (app_handle, AXES_TITLE_FONT, &char_w, &char_h, &cell_w, &cell_h);
	v_gtext (app_handle, kx, ky, "  KEY");
	ky += 1.5*cell_h;

	/* draw the slices */
	bang = 0;
	for (i=0; i < pc->num_slices; i += 1) {
		int eang = bang + 1 + (int)(3600*((float)pc->values[i]/total_values));
		int pxy[4];

		vsf_color (app_handle, pc->colours[i]);
		vsf_interior (app_handle, pc->interior[i]);
		vsf_style (app_handle, pc->style[i]);

		v_pieslice (app_handle, cx, cy, radius, bang, eang);

		bang = eang;

		/* draw the key */
		pxy[0] = kx;
		pxy[1] = ky;
		pxy[2] = kx + 1.5*cell_w-1;
		pxy[3] = ky - cell_h+4; /* leave a small gap between rows */
		v_bar (app_handle, pxy);

		vsf_color (app_handle, BLACK);
		v_gtext (app_handle, kx+2*cell_w, ky, pc->labels[i]);
		ky += cell_h;
	}
}
Beispiel #28
0
short main(int argc, char *argv[])
{
	MFDB dest;
	short my_AppId, x, y, w, h;
	short work_in[11] = {1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2};
	short work_out[57], msg[16], w_id1;
	short open_windows = 1, dummy;
	short wx, wy, ww, wh, clip[4], pnt[4];
	char win1_name[20];
	unsigned short logo_trnfrm[LOGO_DATASIZE];
	GRECT dirty, walk;
	short e = 0, evx, evy, a, kc_shstate, kc_key, click_count;

	my_AppId = appl_init();
	my_handle = graf_handle(&x, &y, &w, &h);		/* Open a virtual workstation */
	v_opnvwk(work_in, &my_handle, work_out);

	logo_bm.fd_w = LOGO_W;
	logo_bm.fd_h = LOGO_H;
	logo_bm.fd_wdwidth = 12;
	logo_bm.fd_nplanes = 4;
	logo_bm.fd_stand = 1;
	dest = logo_bm;
	dest.fd_stand = 0;

	logo_bm.fd_addr = (void *)x_logo;
	dest.fd_addr = (void *)logo_trnfrm;
	vr_trnfm(my_handle, &logo_bm, &dest);
	logo_bm.fd_addr = (void *)logo_trnfrm;

	w_id1 = wind_create(NAME|CLOSE|MOVER, 0, 0, LOGO_W + 40, LOGO_H + 40);

	if (argc > 1)
		sprintf(win1_name,"%s", argv[1]);
	else
		sprintf(win1_name,"Welcome to...", argv[1]);
		
	wind_set(w_id1, WF_NAME, ADDR(win1_name));

	x = (work_out[0] - (LOGO_W + 40)) / 2;
	y = (work_out[1] - (LOGO_H + 40)) / 2;
	wind_open(w_id1, x, y, LOGO_W + 40, LOGO_H + 40);

	while((open_windows) && (!(e & MU_TIMER))) {
		e = evnt_multi(MU_MESAG|MU_TIMER, 258, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
			msg, 15000, 0, &evx, &evy, &a, &kc_shstate, &kc_key, &click_count);

		if (e & MU_MESAG) {
			dummy = msg[0];
			switch(dummy) {
			case WM_CLOSED:	/* Did someone close one of our windows? */
				wind_close(msg[3]);
				open_windows--;
				break;
			case WM_MOVED:
				wind_set(msg[3], WF_CURRXYWH, msg[4], msg[5], msg[6], msg[7]);
				break;
			case WM_REDRAW:
				dirty.g_x = msg[4];
				dirty.g_y = msg[5];
				dirty.g_w = msg[6];
				dirty.g_h = msg[7];
				wind_update(BEG_UPDATE);
				wind_get(msg[3], WF_WORKXYWH, &wx, &wy, &ww, &wh);
				walk.g_x = wx;
				walk.g_y = wy;
				walk.g_w = ww;
				walk.g_h = wh;
				pnt[0] = wx;
				pnt[1] = wy;
				pnt[2] = wx + ww;
				pnt[3] = wy + wh;
				wind_get(msg[3], WF_FIRSTXYWH, &x, &y, &w, &h);
				rc_intersect(&walk, &dirty);
				graf_mouse(M_OFF, NULL);
				while(h) {
					walk.g_x = x;
					walk.g_y = y;
					walk.g_w = w;
					walk.g_h = h;
					if (rc_intersect(&dirty, &walk)) {
						clip[0] = walk.g_x;
						clip[1] = walk.g_y;
						clip[2] = walk.g_x + walk.g_w;
						clip[3] = walk.g_y + walk.g_h;
						vs_clip(my_handle, 1, clip);
						vsf_color(my_handle, LWHITE);
						v_bar(my_handle, pnt);
						display_bitmap(wx, wy);
					}
					wind_get(msg[3], WF_NEXTXYWH, &x, &y, &w, &h);
				}
				vs_clip(my_handle, 0, clip);
				graf_mouse(M_ON, NULL);
				wind_update(END_UPDATE);
				break;
			case WM_TOPPED:
				wind_set(msg[3], WF_TOP, 0, 0, 0, 0);
				break;
			case WM_BOTTOMED:
				wind_set(msg[3], WF_BOTTOM, 0, 0, 0, 0);
				break;
			}
		}
	}
	
	v_clsvwk(my_handle);
	
	appl_exit();
	
	return 0;
}