Exemple #1
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;
}
Exemple #2
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) ;
}
Exemple #3
0
global
void f_style(int m)
{
	static int mode = -1;
	if (m ne mode)
		vsf_style(C.vh, mode = m);
}
Exemple #4
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);
}
Exemple #5
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) ;
}
Exemple #6
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);
}
Exemple #7
0
LOCAL VOID bb_fill(WORD mode, WORD fis, WORD patt, WORD hx, WORD hy, WORD hw, WORD hh)
{
	gsx_fix(&gl_dst, 0x0L, 0, 0);
	ptsin[0] = hx;
	ptsin[1] = hy;
	ptsin[2] = hx + hw - 1;
	ptsin[3] = hy + hh - 1;

	gsx_attr(TRUE, mode, gl_tcolor);
	if (fis != gl_fis)
	{
		vsf_interior(gl_handle, fis);
		gl_fis = fis;
	}
	if (patt != gl_patt)
	{
		vsf_style( gl_handle, patt );
		gl_patt = patt;
	}
	vr_recfl(gl_handle, &ptsin[0]);
}
Exemple #8
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;

}
Exemple #9
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;
}
Exemple #10
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;
}
Exemple #11
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;
}
Exemple #12
0
void specific_note_draw(ALWINDOW *alw, CURRENT_STATUS *cs,int specific_note)
	{
	register int loop1,loop2;
	int cf;
	short coord[4];
	register int curx,cury;
	int half_fret_height=frets_height/2,half_fret_length=frets_length/2;
	register int circle_radius;
	int combination_note,note_val;
	int frets_length_times_loop2,half_fret_height_and_frets_y_offset;
	short tatts[10]; /* text attributes */
	NOTE *np;
	char albuff[10];
	
#define draw(X1,Y1,X2,Y2);	coord[0]=X1;coord[1]=Y1;coord[2]=X2;coord[3]=Y2;v_pline(handle,2,coord);



	scale_offsets(alw,&frets_x_offset,&frets_y_offset);
	frets_y_offset=frets_y_offset+big_y_offset;
	half_fret_height_and_frets_y_offset=half_fret_height+frets_y_offset;



	if(frets_length>frets_height)
		circle_radius=(frets_height/2)-1-2;
	else
		circle_radius=(frets_length/2)-1-2;

	vqt_attributes(handle,tatts);

	wclip(alw);
	graf_mouse(M_OFF,NULL);
	for(loop2=0;loop2<global_frets && loop2+start_fret<global_frets;loop2++)
		{
		frets_length_times_loop2=frets_length*loop2;

		for(loop1=0;loop1<6;loop1++)
			{
				cf=loop2+start_fret;

				curx=(loop2*frets_length);
				cury=(loop1*frets_height);




	if(cs->current_fretboard[loop1][cf]->number==specific_note)
		{

/*							vsf_color(handle,WHITE);
							vsf_interior(handle,FIS_SOLID);
							vsf_style(handle,1);

							alcircle(handle,
							curx+half_fret_length+frets_x_offset,
							cury+half_fret_height+frets_y_offset,
							circle_radius+2); 

							vsf_color(handle,BLACK);
							vsf_interior(handle,8);
							vsf_style(handle,2);

*/

		/* Wipe out the old note */
				coord[0]=curx+frets_x_offset+1;
				coord[1]=cury+frets_y_offset;
				coord[2]=curx+frets_x_offset+frets_length-1;
				coord[3]=cury+frets_height+frets_y_offset;
				vsf_color(handle,WHITE);
				vsf_interior(handle,FIS_SOLID);
				vsf_style(handle,1);
				vr_recfl(handle,coord);

				vsf_color(handle,BLACK);
				vsf_interior(handle,8);
				vsf_style(handle,2);


				/* if the current fret is 0 then it is the open notes
					only draw the string if it is not the open note */

						if(cf!=0)
							{
							draw(curx+frets_x_offset,
								cury+half_fret_height+frets_y_offset,
							 	curx+frets_length+frets_x_offset,
								cury+half_fret_height+frets_y_offset);
							}

	/* draw the note */
		if(text_notes==1)
		{

			combination_note=0;
			if(cs->display_fretboard[loop1][cf]>RELATIVE_NOTE)
				{
					combination_note=1;
					note_val=cs->display_fretboard[loop1][cf]-RELATIVE_NOTE;
				}
			else
				{
					note_val=cs->display_fretboard[loop1][cf];
				}

			switch(note_val)
			{
						case NO_NOTE: break;
						case NORMAL_NOTE:
							if(combination_note)
								vst_effects(handle,0|UNDERLINED);
							else
								vst_effects(handle,0);
							break;
						case FILLED_NOTE:
							if(combination_note)
								vst_effects(handle,OUTLINE|UNDERLINED);
							else
								vst_effects(handle,OUTLINE);
							break;
						case RELATIVE_NOTE:
							vst_effects(handle,UNDERLINED); 
							break;
			}

			/* draw as text */
			if(cs->display_fretboard[loop1][cf]!=NO_NOTE)
			{
				np=cs->current_fretboard[loop1][cf];
				sprintf(albuff,"%s",np->note_name);
				if(strlen(albuff)==1)
					v_gtext(handle,frets_x_offset+frets_length_times_loop2+half_fret_length-(tatts[6]/2),
										cury+half_fret_height_and_frets_y_offset+(tatts[7]/2)/*cury+frets_y_offset+frets_height*/,albuff);
				else
					v_gtext(handle,/*curx+frets_x_offset*/frets_x_offset+(frets_length_times_loop2)+half_fret_length-tatts[6],
										cury+half_fret_height_and_frets_y_offset+(tatts[7]/2)/*cury+frets_y_offset+frets_height*/,albuff);
			}
		
			vst_effects(handle,0);

		}
		else
		{

			combination_note=0;
			if(cs->display_fretboard[loop1][cf]>RELATIVE_NOTE)
				{
					combination_note=1;
					note_val=cs->display_fretboard[loop1][cf]-RELATIVE_NOTE;
				}
			else
				{
					note_val=cs->display_fretboard[loop1][cf];
				}

			if(combination_note)
				{
					vsf_color(handle,BLACK);
					vsf_interior(handle,FIS_HOLLOW);
					vsf_style(handle,0);

					alcircle(handle, 
								curx+half_fret_length+frets_x_offset,
								cury+half_fret_height+frets_y_offset, 
								circle_radius+2);
 		
					vsf_color(handle,BLACK);					
					vsf_interior(handle,8);
					vsf_style(handle,2);
				}

				switch(note_val)		
					{
						case NO_NOTE: 
/*							vsf_color(handle,WHITE);
							vsf_interior(handle,FIS_SOLID);
							vsf_style(handle,1);

							alcircle(handle,
							curx+half_fret_length+frets_x_offset,
							cury+half_fret_height+frets_y_offset,
							circle_radius); 

							vsf_color(handle,BLACK);
							vsf_interior(handle,8);
							vsf_style(handle,2);
						if(cf!=0)
							{
							draw(curx+frets_x_offset,
								cury+half_fret_height+frets_y_offset,
							 	curx+frets_length+frets_x_offset,
								cury+half_fret_height+frets_y_offset);
							}*/
							break;
						case NORMAL_NOTE:
/*						if(cf!=0)
							{
							draw(curx+frets_x_offset,
								cury+half_fret_height+frets_y_offset,
							 	curx+frets_length+frets_x_offset,
								cury+half_fret_height+frets_y_offset);
							}
*/							vsf_color(handle,BLACK); 
							vsf_interior(handle,2);
							vsf_style(handle,2);

							alcircle(handle,
							curx+half_fret_length+frets_x_offset,
							cury+half_fret_height+frets_y_offset,
							circle_radius); 

							vsf_color(handle,BLACK);
							vsf_interior(handle,8);
							vsf_style(handle,2);
							break;
						case FILLED_NOTE:
/*						if(cf!=0)
							{
							draw(curx+frets_x_offset,
								cury+half_fret_height+frets_y_offset,
							 	curx+frets_length+frets_x_offset,
								cury+half_fret_height+frets_y_offset);
							}
*/							vsf_color(handle,BLACK);
							vsf_interior(handle,FIS_SOLID);
							vsf_style(handle,2);

							alcircle(handle, 
							curx+half_fret_length+frets_x_offset,
							cury+half_fret_height+frets_y_offset, 
							circle_radius);
 		
							vsf_color(handle,BLACK);					
							break;
						case RELATIVE_NOTE: 
/*						if(cf!=0)
							{
							draw(curx+frets_x_offset,
								cury+half_fret_height+frets_y_offset,
							 	curx+frets_length+frets_x_offset,
								cury+half_fret_height+frets_y_offset);
							}
*/							vsf_color(handle,BLACK);
							vsf_interior(handle,FIS_HOLLOW);
							vsf_style(handle,0);

							alcircle(handle, 
							curx+half_fret_length+frets_x_offset,
							cury+half_fret_height+frets_y_offset, 
							circle_radius);
 		
							vsf_color(handle,BLACK);					
							vsf_interior(handle,8);
							vsf_style(handle,2);
							break;
/*						case COMMON_NOTE: 
							vsf_color(handle,BLACK);
							vsf_interior(handle,4);
							vsf_style(handle,2);
							alcircle(handle, 
							curx+half_fret_length+frets_x_offset,
							cury+half_fret_height+frets_y_offset, 
							circle_radius);
 		
							vsf_color(handle,BLACK);					
							vsf_interior(handle,8);
							vsf_style(handle,2);
							break;
*/					}

			}

			}			
			}

	
		}
	

graf_mouse(M_ON,NULL);


	}
Exemple #13
0
void small_scale_draw(ALWINDOW *alw, CURRENT_STATUS *cs)
	{
	register int loop1,loop2;
	int cf;
	short coord[4];
	register int curx,cury;

	int inc_res;
	int half_fret_height=frets_height/2,half_fret_length=frets_length/2;

	register int circle_radius;
	int h,saveh;
	int tadd;
	short ch,cw,clh,clw,maxcw;
	char albuff[10];
	char info_buffer[120];
	int combination_note,note_val;
	int frets_x_offset_and_frets_length;
	int half_fret_height_and_frets_y_offset;
	int frets_height_and_frets_y_offset;
	int frets_length_times_loop2;
	int frets_height_times_7;
	short tatts[10]; /* text attributes */
	NOTE *np;
	
#ifdef PRINTER_TEST
/* gdos test stuff*/
	short work_in[11],work_out[57],thandle,lop;

#endif

#define draw(X1,Y1,X2,Y2);	coord[0]=X1;coord[1]=Y1;coord[2]=X2;coord[3]=Y2;v_pline(handle,2,coord);

#ifdef PRINTER_TEST
if(vq_gdos()==0)
	fatal_error("GDOS NOT LOADED!");

#endif


#ifndef PRINTER_TEST
if(scale_name_flag && !key_name_flag)
	{
	sprintf(info_buffer," %s",cs->current_scale->name);
	wind_info(scale_window.handle,info_buffer);
	}
else
	{
	if(!scale_name_flag && key_name_flag)
		{
		sprintf(info_buffer," %s",cs->key->note_name);
		wind_info(scale_window.handle,info_buffer);
		}
	else
		{
		if(scale_name_flag && key_name_flag)
			{
			sprintf(info_buffer," %s in %s",cs->current_scale->name,cs->key->note_name);
			wind_info(scale_window.handle,info_buffer);
			}
		else
			{
			sprintf(info_buffer,"                                                                                       ");
			wind_info(scale_window.handle,info_buffer);
			}
		}
	}
#endif


	scale_offsets(alw,&frets_x_offset,&frets_y_offset);
	frets_y_offset=frets_y_offset+big_y_offset;
	frets_height_and_frets_y_offset=frets_height+frets_y_offset;
	frets_x_offset_and_frets_length=frets_length+frets_x_offset;
	half_fret_height_and_frets_y_offset=half_fret_height+frets_y_offset;


#ifndef PRINTER_TEST
h=0;cw=0;ch=0;maxcw=0;
while(cw<((frets_length/2)-2) && h<99)
	{
		
		if(cw>maxcw)
			saveh=h;
		h++;
		vst_height(handle,h,&cw,&ch,&clw,&clh);
	}

set_hor();


if(h>=99)
	vst_height(handle,saveh,&cw,&ch,&clw,&clh);
#endif

#ifdef PRINTER_TEST
clh=0;
#endif

	vqt_attributes(handle,tatts);

	frets_height_times_7=7*frets_height;

	total_y_dist=clh+(frets_height_times_7);


	set_ver(total_y_dist);


	if(frets_length>frets_height)
		circle_radius=(frets_height/2)-1-2;
	else
		circle_radius=(frets_length/2)-1-2;

	curx=0;

#ifdef PRINTER_TEST
work_in[0]=21; /*printer ?*/
for(lop=1;lop<10;lop++)
	work_in[lop]=1;
	work_in[10]=2;

for(lop=21;lop<31;lop++)
{
	work_in[0]=lop;
	v_opnwk(work_in,&handle,work_out);
	if(handle)
{
		error("GOT A PRINTER HANDLE");
		lop=32;
	}
	else
		error("NOT GOT A PRINTER HANDLE");
}


#endif

	wclip(alw);
	graf_mouse(M_OFF,NULL);
	for(loop2=0;loop2<global_frets && loop2+start_fret<global_frets;loop2++)
		{
		frets_length_times_loop2=frets_length*loop2;

		for(loop1=0;loop1<6;loop1++)
			{
			if(curx<desk_x+frets_height)
			{
				cf=loop2+start_fret;

				curx=/*alw->wx+*/(frets_length_times_loop2);
				cury=/*alw->wy+*/(loop1*frets_height);
				if(cf!=0)
					{

						draw(curx+frets_x_offset,cury+half_fret_height_and_frets_y_offset,
							 curx+frets_x_offset_and_frets_length,cury+half_fret_height_and_frets_y_offset);

					}


				switch(loop1)
				{
				case 0:				
					draw(curx+frets_x_offset_and_frets_length,cury+frets_y_offset+half_fret_height,
					 curx+frets_x_offset_and_frets_length,cury+frets_height_and_frets_y_offset);						
					break;

			 	case 5:					
					draw(curx+frets_x_offset_and_frets_length,cury+frets_y_offset,
					 curx+frets_x_offset_and_frets_length,cury+half_fret_height_and_frets_y_offset);						
					break;

				default:			
					draw(curx+frets_x_offset_and_frets_length,cury+frets_y_offset,
					 curx+frets_x_offset_and_frets_length,cury+frets_height_and_frets_y_offset);						
				}

#ifndef PRINTER_TEST
	if(numbers_flag==1)
	{

	if(cf==first_fret || (((inc_res=cf%fret_inc)==0) && cf>first_fret))
		{
		if((tadd=clh-frets_height)>0)
			{
			sprintf(albuff,"%d",cf);
			if(strlen(albuff)==1)
			v_gtext(handle,frets_x_offset+(frets_length_times_loop2)+half_fret_length-(tatts[6]/2),frets_y_offset+(frets_height_times_7)+tadd,albuff);
			else
			v_gtext(handle,frets_x_offset+(frets_length_times_loop2)+half_fret_length-tatts[6],frets_y_offset+(frets_height_times_7)+tadd,albuff);
			}
		else
			{
			sprintf(albuff,"%d",cf);
			if(strlen(albuff)==1)
			v_gtext(handle,frets_x_offset+(frets_length_times_loop2)+half_fret_length-(tatts[6]/2),frets_y_offset+(frets_height_times_7),albuff);
			else
			v_gtext(handle,frets_x_offset+(frets_length_times_loop2)+half_fret_length-tatts[6],
								frets_y_offset+(frets_height_times_7),albuff);
			}
		}
	}
#endif

		if(text_notes==1)
		{

			combination_note=0;
			if(cs->display_fretboard[loop1][cf]>RELATIVE_NOTE)
				{
					combination_note=1;
					note_val=cs->display_fretboard[loop1][cf]-RELATIVE_NOTE;
				}
			else
				{
					note_val=cs->display_fretboard[loop1][cf];
				}

			switch(note_val)
			{
						case NO_NOTE: break;
						case NORMAL_NOTE:
							if(combination_note)
								vst_effects(handle,0|UNDERLINED);
							else
								vst_effects(handle,0);
							break;
						case FILLED_NOTE:
							if(combination_note)
								vst_effects(handle,OUTLINE|UNDERLINED);
							else
								vst_effects(handle,OUTLINE);
							break;
						case RELATIVE_NOTE:
							vst_effects(handle,SHADED|UNDERLINED); 
							break;
			}

			/* draw as text */
			if(cs->display_fretboard[loop1][cf]!=NO_NOTE)
			{
				np=cs->current_fretboard[loop1][cf];
				sprintf(albuff,"%s",np->note_name);
				if(strlen(albuff)==1)
					v_gtext(handle,frets_x_offset+frets_length_times_loop2+half_fret_length-(tatts[6]/2),
										cury+half_fret_height_and_frets_y_offset+(tatts[7]/2)/*cury+frets_y_offset+frets_height*/,albuff);
				else
					v_gtext(handle,/*curx+frets_x_offset*/frets_x_offset+(frets_length_times_loop2)+half_fret_length-tatts[6],
										cury+half_fret_height_and_frets_y_offset+(tatts[7]/2)/*cury+frets_y_offset+frets_height*/,albuff);
			}
		
			vst_effects(handle,0);

		}
		else
		{
			combination_note=0;
			if(cs->display_fretboard[loop1][cf]>RELATIVE_NOTE)
				{
					combination_note=1;
					note_val=cs->display_fretboard[loop1][cf]-RELATIVE_NOTE;
				}
			else
				{
					note_val=cs->display_fretboard[loop1][cf];
				}

			if(combination_note)
				{
					vsf_color(handle,BLACK);
					vsf_interior(handle,FIS_HOLLOW);
					vsf_style(handle,0);

					alcircle(handle, 
								curx+half_fret_length+frets_x_offset,
								cury+half_fret_height+frets_y_offset, 
								circle_radius+2);
 		
					vsf_color(handle,BLACK);					
					vsf_interior(handle,8);
					vsf_style(handle,2);
				}

				switch(note_val)		
					{
						case NO_NOTE: break;
						case NORMAL_NOTE:
							vsf_color(handle,BLACK); 
							vsf_interior(handle,2);
							vsf_style(handle,2);

							alcircle(handle,
							curx+half_fret_length+frets_x_offset,
							cury+half_fret_height_and_frets_y_offset,
							circle_radius); 

							vsf_color(handle,BLACK);
							vsf_interior(handle,8);
							vsf_style(handle,2);
							break;
						case FILLED_NOTE:
							vsf_color(handle,BLACK);
							vsf_interior(handle,FIS_SOLID);
							vsf_style(handle,2);

							alcircle(handle, 
							curx+half_fret_length+frets_x_offset,
							cury+half_fret_height_and_frets_y_offset, 
							circle_radius);
 		
							vsf_color(handle,BLACK);					
							break;
						case RELATIVE_NOTE: 
							vsf_color(handle,BLACK);
							vsf_interior(handle,FIS_HOLLOW);
							vsf_style(handle,2);
							alcircle(handle, 
							curx+half_fret_length+frets_x_offset,
							cury+half_fret_height_and_frets_y_offset, 
							circle_radius);
 		
							vsf_color(handle,BLACK);					
							vsf_interior(handle,8);
							vsf_style(handle,2);
							break;
/*						case COMMON_NOTE: 
							vsf_color(handle,BLACK);
							vsf_interior(handle,4);
							vsf_style(handle,2);
							alcircle(handle, 
							curx+half_fret_length+frets_x_offset,
							cury+half_fret_height_and_frets_y_offset, 
							circle_radius);
 		
							vsf_color(handle,BLACK);					
							vsf_interior(handle,8);
							vsf_style(handle,2);
							break;*/
					}
			}

			}
			}

	
		}
	

graf_mouse(M_ON,NULL);
#ifdef PRINTER_TEST
v_clswk(handle);
#endif
	}
Exemple #14
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;
	}
}
Exemple #15
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);
	}

}
Exemple #16
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;
}