Example #1
0
/* display numeric range and tick marks of y-axis */
void draw_y_axis_labels (int app_handle, int min_y, int max_y, int x, int y, int h) {
	char str[20];
	int pxy[4];
	int i;
	int char_w, char_h, cell_w, cell_h;
	int range = max_y - min_y;

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

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

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

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

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

	if (h > 10 * cell_h) { /* print remaining labels depending on space available */
		draw_intermediate_y_labels (app_handle, 8, min_y, max_y, x, y, h, cell_w, cell_h);
	} else if (h > 6 * cell_h) {
		draw_intermediate_y_labels (app_handle, 4, min_y, max_y, x, y, h, cell_w, cell_h);
	} else if (h > 4 * cell_h) {
		draw_intermediate_y_labels (app_handle, 2, min_y, max_y, x, y, h, cell_w, cell_h);
	}
}
Example #2
0
void drawnicklist(int hand,GRECT box)
{
short mcto=0,junk=1,junk2;
short maxj;
short xy[4];
if(hand==-1)return;
xy[0]=box.g_x;xy[1]=box.g_y;xy[2]=box.g_x+box.g_w-1;xy[3]=box.g_y+box.g_h-1;
vs_clip(ws.handle,1,xy);
clearwin(box.g_x,box.g_y,box.g_w,box.g_h,col[CNLBACK]);
xy[0]=wn[hand].wwa.g_x+wn[hand].wwa.g_w-NLW;
xy[1]=wn[hand].wwa.g_y;
xy[2]=wn[hand].wwa.g_x+wn[hand].wwa.g_w-NLW;
xy[3]=wn[hand].wwa.g_y+wn[hand].wwa.g_h-ith*2-VT+4;
vsl_color(ws.handle,col[CNLDIVIDE]);
v_pline(ws.handle,2,xy);
xy[0]+=1;
xy[2]+=1;
v_pline(ws.handle,2,xy);
if(wn[hand].chan==-1)return;
vst_font(ws.handle,1);
vst_point(ws.handle,8,&junk2,&junk2,&junk2,&junk2);
maxj=(wn[hand].wwa.g_h-ith*2-VT)/8;
vst_color(ws.handle,col[CNICKLIST]);
vswr_mode(ws.handle,MD_TRANS);
while(mcto<128){
if(strlen(chan[wn[hand].chan].nl[mcto])){
v_gtext(ws.handle,wn[hand].wwa.g_x+wn[hand].wwa.g_w-NLW+4,wn[hand].wwa.g_y+junk*8,chan[wn[hand].chan].nl[mcto]);
junk++;
if(junk>maxj){
mcto=128;
v_gtext(ws.handle,wn[hand].wwa.g_x+wn[hand].wwa.g_w-NLW+4,wn[hand].wwa.g_y+junk*8,"    ");
}
}
mcto++;
}
vs_clip(ws.handle,0,NULL);
return;
}
Example #3
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;
}
Example #4
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;
}
Example #5
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;
}
Example #6
0
/****************************************************************
*																*
*					ouvre la fenˆtre du tampon					*
*																*
****************************************************************/
void ouvrir_tampon(void)
{
	windowptr thewin = Tampon;
	WIN *win;
	GRECT rect;
	t_win_coord *window;
	int dummy;

	/* demande la taille de la fenˆtre */
	window = get_info(1, Tampon, &rect);

	thewin -> fonction.secteur.couleur_curseur = window -> fonction.texte.curseur_c;
	thewin -> fonction.secteur.trame_curseur = window -> fonction.texte.curseur_t;
	thewin -> fonction.text.couleur_texte = window -> fonction.texte.texte_c;
	thewin -> fonction.text.taille_pt = window -> fonction.texte.texte_pt;
	thewin -> fonction.text.couleur_fond = window -> fonction.texte.background_c;
	thewin -> fonction.text.trame_fond = window -> fonction.texte.background_t;

	/* Create the information for the window.  Max size is the desktop. */
	win = open_window(thewin -> title, thewin -> title, NULL, NULL, window -> type, TRUE, 10, 10, &desk, &rect, NULL, secteurproc, NULL, 0);

	/* Check for error. */
	if (win == NULL)
	{
		error_msg(Z_NO_MORE_WINDOW);
		return;
	}

	if (!open_work(&win -> vdi_handle, work_out))
	{
		my_alert(1, FAIL, X_ICN_STOP, Messages(MAIN_9), NULL);
		close_window(win, FALSE);
		return;
	}

	thewin -> win = win;

	vst_point(win -> vdi_handle, thewin -> fonction.text.taille_pt, &dummy, &dummy, &thewin -> fonction.text.taille_w, &thewin -> fonction.text.taille_h);
	vst_color(win -> vdi_handle, thewin -> fonction.secteur.couleur_texte);
	vsf_interior(win -> vdi_handle, FIS_SOLID);
	vswr_mode(win -> vdi_handle, MD_REPLACE);
	vsf_perimeter(win -> vdi_handle, 0);

	/* Insert into windowlist. */
	{
		register windowptr winptr = (windowptr)&Firstwindow;

		while(winptr -> next)
		{
			winptr = winptr -> next;
			winptr -> place++;
		}
	
		winptr -> next = thewin;
	}

	convert_sect(thewin -> fonction.secteur.secteurBin, thewin -> fonction.text.Ligne, thewin -> fonction.secteur.ascii);

	/* initialise les ascenseurs */
	wind_set(win -> handle, WF_HSLSIZE, (int)(thewin -> win -> work.g_w *1000. / max_w), 0, 0, 0);

	wind_set(win -> handle, WF_VSLSIZE, 1000, 0, 0, 0);
	wind_set(win -> handle, WF_VSLIDE, 1000, 0, 0, 0);

	/* entr‚e dans le menu */
	get_menu_entry(thewin, thewin -> title +1);

	make_frontwin(thewin);

	menu_ienable(Menu, OUVRIR_TAMPON, 0);
	ajoute(Firstwindow, Messages(TAMPON_13));
} /* ouvrir_tampon */
Example #7
0
int wtib(char *point,char aflag)
{
short junk2,blunk,blunk2,rfoff=0,cellw;
short soff=0,lcount=0,wl;
char *dp;
char temps[2048];
if(cwin==-1)return 0;
wl=wn[cwin].cvof;
if((strlen(wn[cwin].inp)+strlen(point))>511){*(point+(511-strlen(wn[cwin].inp)))=0;}
vst_font(ws.handle,(WORD)inpfont);
vst_point(ws.handle,(WORD)inppoint,&junk2,&junk2,&junk2,&junk2);
if(amatend()){
blunk=findcurpos();
strcat(wn[cwin].inp,point);
}else{
aflag=1;
blunk=findcurpos();
strcpy(temps,"\0");
if(blunk!=0){
stccpy(temps,wn[cwin].inp,blunk+1);
}
strcat(temps,point);
strcat(temps,wn[cwin].inp+blunk);
strcpy(wn[cwin].inp,temps);
}
junk2=wn[cwin].cvof-1;
while(junk2>-1){
rfoff=rfoff+wn[cwin].ihc[junk2];
junk2--;
}
dp=wn[cwin].inp+rfoff;
aflag=FALSE;
blunk2=wn[cwin].iof[wl];
while(rfoff<strlen(wn[cwin].inp)){
vqt_width(ws.handle,*(dp+lcount),&cellw,&junk2,&junk2);
if(soff+cellw>wn[cwin].wwa.g_w){
wn[cwin].ihc[wl]=lcount;
wn[cwin].iof[wl]=soff;
dp=dp+lcount-1;
lcount=0;
soff=0;
wl++;
soff=soff+cellw;
cellw=0;
aflag=TRUE;
}
soff=soff+cellw;
lcount++;
if(rfoff==blunk+strlen(point)-1){wn[cwin].cvof=wl;wn[cwin].cx=lcount;}
rfoff++;
}
if(lcount){
wn[cwin].ihc[wl]=lcount;
wn[cwin].iof[wl]=soff;
}
if(!aflag){
startupdate();
clchar();
clcursor();
vst_color(ws.handle,col[CINPTEXT]);
vswr_mode(ws.handle,MD_TRANS);
v_gtext(ws.handle,wn[cwin].wwa.g_x+blunk2,wn[cwin].wwa.g_y+wn[cwin].wwa.g_h-1,point);
finishupdate();
}
if(aflag)ipbredraw(cwin);
return 0;
}
Example #8
0
int inputprocess(){
int junk,junk2,cellw,rfoff=0,lcount=0,wl;
char aflag=FALSE;
char *dp;
int sff=0;
char temps[2048];
	if(cwin==-1)return 0;
	wind_get(wn[cwin].hand,WF_TOP,&junk,&junk2,&junk2,&junk2);
	if(cwin!=-1 && wn[cwin].stat!=WMDONTWRITE && junk==wn[cwin].hand){
	strcpy(chinp,"\0");
	sprintf(chinp,"%c",kreturn);
	if(wn[cwin].scb){sbvslid(1000);wn[cwin].scb=0;}
	
	if(!strncmp("\b",chinp,1) && inpbcontents()){
	vst_font(ws.handle,(WORD)inpfont);
	vst_point(ws.handle,(WORD)inppoint,&junk2,&junk2,&junk2,&junk2);

	clcursor(cwin);
	junk2=findcurpos();
	stccpy(temps,wn[cwin].inp,junk2);
	strcat(temps,wn[cwin].inp+junk2);
	strcpy(wn[cwin].inp,temps);
	if(wn[cwin].cx>0){wn[cwin].cx--;}
	else{
	if(wn[cwin].cvof!=0){
	wn[cwin].cvof--;wn[cwin].cx=wn[cwin].ihc[wn[cwin].cvof]-1;}
	}
	
wl=wn[cwin].cvof;
junk2=wn[cwin].cvof-1;
while(junk2>-1){
rfoff=rfoff+wn[cwin].ihc[junk2];
junk2--;
}
dp=wn[cwin].inp+rfoff;
if(rfoff==strlen(wn[cwin].inp)){wn[cwin].ihc[wl]=0;
wn[cwin].iof[wl]=0;
}
else{
while(rfoff<strlen(wn[cwin].inp)){
vqt_width(ws.handle,*(dp+lcount),&cellw,&junk2,&junk2);
if(sff+cellw>wn[cwin].wwa.g_w){
wn[cwin].ihc[wl]=lcount;
wn[cwin].iof[wl]=sff;
dp=dp+lcount;
lcount=-1;
sff=0;
wl++;
cellw=0;
}
sff=sff+cellw;
lcount++;
rfoff++;
}

wn[cwin].ihc[wl]=lcount;
wn[cwin].iof[wl]=sff;
}
ipbredraw(cwin);
strcpy(chinp,"\0");
	aflag=TRUE;
	}

	if(!strncmp("\b",chinp,1) && !inpbcontents()){
	strcpy(chinp,"\0");
	aflag=TRUE;
	}
	
	if(strlen(wn[cwin].inp)>511){flag=TRUE;}
	
	if(!strncmp("\r",chinp,1)){
	aflag=TRUE;
	strcpy(chinp,"\0");
	gotcmd();
	clearipb(cwin);
	docursor(cwin);
	}
	
	if(!aflag){
	clcursor(cwin);
	wtib(chinp,aflag);
	docursor(cwin);
	strcpy(chinp,"\0");
	}
	
	}
	return 0;
}
Example #9
0
/* display numeric range and tick marks of x-axis */
void draw_x_axis_labels (int app_handle, int min_x, int max_x, int x, int y, int w) {
	char str[20];
	int pxy[4];
	int i;
	int char_w, char_h, cell_w, cell_h;
	int range = max_x - min_x;
	int largest_val;

	sprintf (str, "%d", min_x);
	largest_val = strlen (str);
	sprintf (str, "%d", max_x);
	if (strlen(str) > largest_val) largest_val = strlen(str);

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

	/* print values on x-axis, depending on space available */
	if (w > largest_val * 2 * cell_w) { /* print left and right values in most cases */
		pxy[0] = x;
		pxy[1] = y;
		pxy[2] = pxy[0];
		pxy[3] = y+5;

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

		pxy[0] = x+w;
		pxy[1] = y;
		pxy[2] = pxy[0];
		pxy[3] = y+5;

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

	if (w > largest_val * 10 * cell_w) { /* print remaining depending on space available */
		int i;

		for (i=1; i<=8; i += 1) {
			int val = min_x + range * i / 8; /* do eighths */

			pxy[0] = x + rescale (val, min_x, max_x, w);
			pxy[1] = y;
			pxy[2] = pxy[0];
			pxy[3] = y+5;

			sprintf (str, "%d", val);
			v_pline (app_handle, 2, pxy);
			v_gtext (app_handle, pxy[2]-strlen(str)*cell_w/2, pxy[3]+cell_h*1.5, str);
		}
	} else if (w > largest_val * 6 * cell_w) {
		int i;

		for (i=1; i<=3; i += 1) {
			int val = min_x + range * i / 4; /* do quarters */

			pxy[0] = x + rescale (val, min_x, max_x, w);
			pxy[1] = y;
			pxy[2] = pxy[0];
			pxy[3] = y+5;

			sprintf (str, "%d", val);
			v_pline (app_handle, 2, pxy);
			v_gtext (app_handle, pxy[2]-strlen(str)*cell_w/2, pxy[3]+cell_h*1.5, str);
		}
	} else if (w > largest_val * 4 * cell_w) {
		int val = min_x + range / 2; /* find nearest int to half-way */

		pxy[0] = x + rescale (val, min_x, max_x, w);
		pxy[1] = y;
		pxy[2] = pxy[0];
		pxy[3] = y+5;

		sprintf (str, "%d", val);
		v_pline (app_handle, 2, pxy);
		v_gtext (app_handle, pxy[2]-strlen(str)*cell_w/2, pxy[3]+cell_h*1.5, str);
	}
}
Example #10
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;
	}
}
Example #11
0
void chart_draw_line (struct line_chart * lc, int app_handle,
	int x, int y, int w, int h) {

	int lx, ly, lw, lh; /* dimensions of area in which to draw the line chart */
	int max_y_value, min_y_value, max_value_width;
	int min_x_value, max_x_value;
	int i;
	int dum, key_char_w, key_char_h;
	int kx, ky; /* position of key */

	clear_area (app_handle, x, y, w, h);
	if ((w < 50) || (h < 50)) return; /* too small to draw anything */
	if (lc->lines[0] == NULL) return; /* no line, so don't draw anything */

	max_y_value = find_max (lc->lines[0]->ys, lc->lines[0]->num_points);
	min_y_value = find_min (lc->lines[0]->ys, lc->lines[0]->num_points);
	for (i = 1; i < lc->num_lines; i += 1) {
		int t = find_max (lc->lines[i]->ys, lc->lines[i]->num_points);
		if (t > max_y_value) max_y_value = t;
		t = find_min (lc->lines[i]->ys, lc->lines[i]->num_points);
		if (t < min_y_value) min_y_value = t;
	}
	max_x_value = find_max (lc->lines[0]->xs, lc->lines[0]->num_points);
	min_x_value = find_min (lc->lines[0]->xs, lc->lines[0]->num_points);
	for (i = 1; i < lc->num_lines; i += 1) {
		int t = find_max (lc->lines[i]->xs, lc->lines[i]->num_points);
		if (t > max_x_value) max_x_value = t;
		t = find_min (lc->lines[i]->xs, lc->lines[i]->num_points);
		if (t < min_x_value) min_x_value = t;
	}

	/* Find dimensions for display of chart */
	find_chart_dimensions (app_handle, min_y_value, max_y_value, x, y, w, h,
				&max_value_width, &lx, &ly, &lw, &lh);

	vst_point (app_handle, AXES_TITLE_FONT, &dum, &dum, &key_char_w, &key_char_h);

	/* adjust dimensions to fit in a key */
	if (w > h) {
		/* wide area, so key on right */
		int max_width, i;

		max_width = strlen(lc->lines[0]->label);
		for (i=1; i<lc->num_lines; i+=1) {
			if (strlen(lc->lines[i]->label) > max_width) {
				max_width = strlen(lc->lines[i]->label);
			}
		}

		kx = x + w - key_char_w*(4 + max_width);
		ky = y + 2*key_char_h;
		lw = kx - lx - key_char_w;
	} else {
		/* tall area, so key below */
		int diff_y = key_char_h*(2+2+lc->num_lines);
		kx = x+5*key_char_w;
		ly -= diff_y;
		lh -= diff_y;
		ky = ly + 4*key_char_h; /* remember gap for labels */
	}

	draw_axes_lines (app_handle, lx, ly, lw, lh);
	draw_main_labels (app_handle, lc->title, lc->x_label, lc->y_label,
		lx, ly, lw, lh, max_value_width);
	draw_x_axis_labels (app_handle, min_x_value, max_x_value, lx, ly, lw);
	draw_y_axis_labels (app_handle, min_y_value, max_y_value, lx, ly, lh);

	/* draw points and lines */
	for (i = 0; i < lc->num_lines; i += 1) {
		int p;
		int * pts;
		pts = malloc(sizeof(int)*lc->lines[i]->num_points*2);

		for (p = 0; p < lc->lines[i]->num_points; p += 1) {
			pts[2*p] = lx + rescale (lc->lines[i]->xs[p], min_x_value, max_x_value, lw);
			pts[2*p+1] = ly - rescale (lc->lines[i]->ys[p], min_y_value, max_y_value, lh);
		}

		/* set colour/styles */
		vsl_width (app_handle, 1);
		vsl_color (app_handle, lc->lines[i]->colour);
		vsm_color (app_handle, lc->lines[i]->colour);
	#ifdef PMARKS /* use own pmarker code */
		vsf_color (app_handle, lc->lines[i]->colour);
		my_pmarker (app_handle, lc->lines[i]->point_style, lc->lines[i]->num_points, pts);
	#else /* use builtin pmarker code */
		vsm_type (app_handle, lc->lines[i]->point_style);
		/* call v_pmarker to draw points */
		v_pmarker (app_handle, lc->lines[i]->num_points, pts);
	#endif
		vsl_type (app_handle, lc->lines[i]->line_style);
		/* call v_pline to draw lines */
		v_pline (app_handle, lc->lines[i]->num_points, pts);

		free (pts);
	}

	/* draw key */
	vsf_color (app_handle, BLACK);
	vst_point (app_handle, AXES_TITLE_FONT, &dum, &dum, &dum, &dum);
	v_gtext (app_handle, kx, ky, "  KEY");
	ky += 2*key_char_h;

	for (i = 0; i < lc->num_lines; i += 1) {
		int pxy[4];

		pxy[0]=kx;
		pxy[1]=ky;
		pxy[2]=kx+2.5*key_char_w;
		pxy[3]=pxy[1];

		vsl_color (app_handle, lc->lines[i]->colour);
		vsl_width (app_handle, 1);
		vsm_color (app_handle, lc->lines[i]->colour);
	#ifdef PMARKS /* use own pmarker code */
		vsf_color (app_handle, lc->lines[i]->colour);
		my_pmarker (app_handle, lc->lines[i]->point_style, 2, pxy);
	#else /* use builtin pmarker code */
		vsm_type (app_handle, lc->lines[i]->point_style);
		v_pmarker (app_handle, 2, pxy);
	#endif
		vsl_type (app_handle, lc->lines[i]->line_style);
		v_pline (app_handle, 2, pxy);

		v_gtext (app_handle, kx+3.5*key_char_w, ky, lc->lines[i]->label);
		ky += key_char_h;
	}
}
Example #12
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);
	}

}
Example #13
0
void sendout(char *ps,int hand,short coll)
{
int junk;
char *dp;
int dolen=(int)strlen(ps);
int lcount=0,offset=0;
long effects=0;
int eff[3],dist[5],cellw;
int chof=0,howmany=0;
BOOLEAN bd=FALSE;
if(hand==-1)return;
vst_font(ws.handle,(WORD)winfont);
vst_point(ws.handle,(WORD)winpoint,&junk,&junk,&junk,&junk);

dp=ps;
dolen=(int)strlen(ps);
eff[0]=0;
vst_effects(ws.handle,0);
while(offset<dolen){
vqt_width(ws.handle,*(dp+lcount),&cellw,&junk,&junk);
cellw=cellw+eff[0];

if(*(dp+lcount)==2){
cellw=0;
if(bd){bd=FALSE;eff[0]=0;}
else{bd=TRUE;
effects=THICKENED;
vst_effects(ws.handle,effects);
vqt_fontinfo(ws.handle,&junk,&junk,&dist[0],&junk,&eff[0]);
}
}
if(*(dp+lcount)==3)cellw=0;
if(*(dp+lcount)==15){cellw=0;bd=FALSE;eff[0]=0;}
if(*(dp+lcount)==22)cellw=0;
if(*(dp+lcount)==31)cellw=0;

chof=chof+cellw;

if(chof>wn[hand].wwa.g_w-NLW-1 || lcount>148){
wn[hand].clc[wn[hand].clcnt]=coll;
stccpy(wn[hand].cl[wn[hand].clcnt++],dp,lcount+1);
tlog(wn[hand].cl[wn[hand].clcnt-1]);
if(wn[hand].clcnt==150)wn[hand].clcnt=0;
cellw=0;chof=0;offset--;
dp=dp+lcount;
lcount=-1;
howmany++;
}
offset++;
lcount++;
}

if(strlen(dp)){
wn[hand].clc[wn[hand].clcnt]=coll;
stccpy(wn[hand].cl[wn[hand].clcnt++],dp,lcount+1);
tlog(wn[hand].cl[wn[hand].clcnt-1]);
if(wn[hand].clcnt==150)wn[hand].clcnt=0;
howmany++;
}

scrollup(hand,howmany);
}
Example #14
0
static void dump_font()
{
const tGemFont *const pgf = name_table[iSelected].pFont;
const uint16 nr_entries = pgf->last_ade - pgf->first_ade + 1;
const uint32 size_wid = (nr_entries+1) * sizeof(uint16);
uint32 size_hor;
register tGemFont *phdr;
FILE *fp;
int16 dummy;
int16 clip_array[4] = { 0, 0, 100, 100 };
OBJECT *generating;
int cx, cy, cw, ch;
char *err_str;

   dprintf(( "\033Hgenerating fonts ... " )); dgetchar();
   rsrc_gaddr( R_TREE, GENFONTS, &generating );
   form_center( generating, &cx, &cy, &cw, &ch);
   form_dial(FMD_START, 0, 0, 0, 0, cx, cy, cw, ch);
   objc_draw( generating, ROOT, MAX_DEPTH, cx, cy, cw, ch);
   vst_font( handle, pgf->font_id );
   vst_point( handle, pgf->size, &dummy, &dummy, &dummy, &dummy );

   assert( (pgf->flags&MOT_FLAG) != 0 );
   size_hor = pgf->flags&HOR_FLAG ? nr_entries : 0;

   phdr = (tGemFont*)malloc( sizeof(tGemFont) + size_wid );
   if( phdr == NULL ) {
      err_str = "[3][Not enough memory|to convert font][OK]";
      goto error0;
   } /* if */
   
   *phdr = *pgf;        /* copy header data */
   phdr->h_table = (int8*)sizeof(tGemFont);
   phdr->off_table = (int16*)((uint32)phdr->h_table + size_hor);
   phdr->dat_table = (int8*)((uint32)phdr->off_table + size_wid);
   memcpy( phdr+1, pgf->off_table, size_wid );
   
   if( !fMot ) {
   register int16 *char_tbl = (int16*)(phdr+1);
   register uint16 i;
      for (i = nr_entries+1; i > 0; i--) {
	   Swapw(*char_tbl);
	   char_tbl++;
      } /* for */

      /* swap header words and longs */
      phdr->flags &= ~MOT_FLAG;
      Swapw(phdr->font_id);             Swapw(phdr->size);
      Swapw(phdr->first_ade);           Swapw(phdr->last_ade);
      Swapw(phdr->top);                 Swapw(phdr->ascent);
      Swapw(phdr->half);                Swapw(phdr->descent);
      Swapw(phdr->bottom);
      Swapw(phdr->max_char_width);      Swapw(phdr->max_cell_width);
      Swapw(phdr->left_offset);         Swapw(phdr->right_offset);
      Swapw(phdr->thicken);             Swapw(phdr->ul_size);
      Swapw(phdr->lighten);             Swapw(phdr->skew);
      Swapw(phdr->flags);               Swapl(phdr->h_table);
      Swapl(phdr->off_table);           Swapl(phdr->dat_table); 
      Swapw(phdr->form_width);          Swapw(phdr->form_height);
   } /* if */

   fp = fopen( gem_file_name, "wb" );
   if( fp == NULL ) {
      err_str = "[3][can't open gem font file][OK]";
      goto error1;
   } /* if */

   /** write the font header **/
   assert( phdr != NULL );   
   if( fwrite( phdr, sizeof( *phdr), 1, fp ) != 1 ) {
      goto error2;
   } /* if */
   
   if( size_hor != 0 ) {
      /** write horizontal offset table **/
      assert( pgf->h_table != NULL );   
      if( fwrite( pgf->h_table, nr_entries, 1, fp ) != 1 ) {
	 goto error2;
      } /* if */
   } /* if */

   /** write the character offset table **/
   if( fwrite( phdr+1, size_wid, 1, fp ) != 1 ) {
      goto error2;
   } /* if */

   if( !fWidOnly ) {
      /** write the character data table **/
      int q;
      unsigned char char_array[2] = { '\0', '\0' };
      dprintf(( "\033Hgenerating character data\n" )); dgetchar();
      vs_clip( handle, 1, clip_array );
      for( q=nr_entries, *char_array=pgf->first_ade; q>0; q--, (*char_array)++ ) {
         v_gtext( handle, 200, 200, char_array );
      } /* for */
      vs_clip( handle, 0, clip_array );
      assert( pgf->dat_table != NULL );   
      if( fwrite( pgf->dat_table, pgf->form_width, pgf->form_height, fp )
						      != pgf->form_height ) {
	 goto error2;
      } /* if */
   } /* if */
   fclose( fp );
   free( phdr );
   form_dial( FMD_FINISH, 0, 0, 0, 0, cx, cy, cw, ch );
   return;
   
error2:
   fclose( fp );
   err_str = "[3][can't write to|gem font file][OK]";
error1:
   free( phdr );
error0:
   form_dial( FMD_FINISH, 0, 0, 0, 0, cx, cy, cw, ch );
   form_alert(1, err_str );
} /* dump_font() */
Example #15
0
/*
** Description
** Initialize global variables, open vdi workstation etc
*/
void
init_global (WORD physical_vdi_id)
{
#if 0
  int        temp_vid;
  int        work_in[] = {1,1,1,1,1,1,1,1,1,1,2};
#endif
  int        work_out[57];
  int        dum;
  static int is_inited = FALSE;

  /* Only initialize globals if they haven't been initialized before */
  if(!is_inited)
  {
    is_inited = TRUE;
    
    DEBUG3 ("Entering init_global");
    
#if 0 /* FIXME def MINT_TARGET */
    /* Only mess with videomodes if running under MiNT */
    if(globals.video == 0x00030000L) {
      fprintf(stderr,"VsetMode\r\n");
      oldmode = globals.vmode = 3;
      oldmodecode = globals.vmodecode = VsetMode(-1);
      fprintf(stderr,"/VsetMode\r\n");
    }
    else {
      oldmode = globals.vmode = Getrez();
    };
#endif /* MINT_TARGET */
    
    global_common.mouse_owner = -1;
    global_common.realmove = 0;
    global_common.realsize = 0;
    global_common.realslide = 0;
    global_common.fnt_regul_id = -1;
    global_common.fnt_regul_sz = -1;
    global_common.icon_width = 48;
    global_common.icon_height = 56;
    global_common.wind_appl = 1;
    global_common.graf_mbox = 1;
    global_common.graf_growbox = 1;
    global_common.graf_shrinkbox = 1;
    global_common.fsel_sorted = 1;
    global_common.fsel_extern = 0;
    
    DEBUG3 ("init_global: 2");
    
#if 0 /* FIXME : Remove? def MINT_TARGET */
    fprintf(stderr,"appl_init()\r\n");
    own_appl_init();
    fprintf(stderr,"/appl_init()\r\n");
    
    if(open_physical_ws)
    {
      printf("No other AES found. Opening own Workstation.\r\n");
      work_in[0] = 5;
      v_opnwk(work_in,&global_common.vid,work_out);
      
      if(global_common.video == 0x00030000L)
      {
        VsetScreen(NULL, NULL, global_common.vmode, global_common.vmodecode);
      }
      else
      {
        VsetScreen((void*)-1, (void *)-1, global_common.vmode, global_common.vmodecode);
      }
    }
    else
    {
      printf("Other AES detected.\r\n");
      global_common.vid = own_graf_handle();
      v_clrwk(global_common.vid);
    }
#endif
    
    global_common.physical_vdi_id = physical_vdi_id;
    DEBUG2 ("lib_global.c: init_global: calling vq_extnd");
    vq_extnd (physical_vdi_id, 0, work_out);
    
    
    global_common.screen.x = 0;
    global_common.screen.y = 0;
    global_common.screen.width = work_out[0] + 1;
    global_common.screen.height = work_out[1] + 1;
    
    global_common.num_pens = work_out[13];
    
    vq_extnd (physical_vdi_id, 1, work_out);
    global_common.num_planes = work_out[4];
    
    /* setup systemfont information */
    
    if(global_common.screen.height >= 400)
    {
      global_common.fnt_regul_id = 1;
      global_common.fnt_regul_sz = 13;
    }
    else
    {
      global_common.fnt_regul_id = 1;
      global_common.fnt_regul_sz = 9;
    }
    
    global_common.fnt_small_id = global_common.fnt_regul_id;
    global_common.fnt_small_sz = global_common.fnt_regul_sz / 2;
    
    vst_font (physical_vdi_id, global_common.fnt_regul_id);
    vst_point (physical_vdi_id,
               global_common.fnt_regul_sz,
               &dum,
               &dum,
               &dum,
               &dum);
    
    global_common.arrowrepeat = 100;
    
    DEBUG2 ("lib_global.c: init_global: calling vqt_attributes");
    vqt_attributes (physical_vdi_id, work_out);
    
    global_common.blwidth = work_out[8] + 3;
    global_common.blheight = work_out[9] + 3;
    global_common.clwidth = work_out[8];
    global_common.clheight = work_out[9];
    
    global_common.bswidth = work_out[8] / 2 + 3;
    global_common.bsheight = work_out[9] / 2 + 3;
    global_common.cswidth = work_out[8] / 2;
    global_common.csheight = work_out[9] / 2;
    
    global_common.time = 0L;
    
#ifndef MINT_TARGET
    global_common.callback_handler = oaesis_callback;
#endif
    
    DEBUG2("lib_global.c: init_global: Calling Rsrc_do_rcfix");
    Rsrc_do_rcfix (physical_vdi_id,
                   (RSHDR *)resource,
                   FALSE
                   ,
                   TRUE
                   );
    DEBUG2("lib_global.c: init_global: Called Rsrc_do_rcfix");
    
    Rsrc_do_gaddr((RSHDR *)resource,
                  R_TREE,
                  AICONS,
                  &global_common.aiconstad,
                  TRUE); 
    DEBUG3("init_global: 10");
    Rsrc_do_gaddr((RSHDR *)resource,
                  R_TREE,
                  ALERT,
                  &global_common.alerttad,
                  TRUE);
    Rsrc_do_gaddr((RSHDR *)resource,
                  R_TREE,
                  FISEL,
                  &global_common.fiseltad,
                  TRUE);

    Rsrc_do_gaddr((RSHDR *)resource,
                  R_TREE,
                  PMENU,
                  &global_common.pmenutad,
                  TRUE);
    Rsrc_do_gaddr((RSHDR *)resource,
                  R_FRSTR,
                  0,
                  (OBJECT **)&global_common.fr_string,
                  TRUE);
    
    /* Initialize window elements and resource counters */
    Rsrc_do_gaddr((RSHDR *)resource,
                  R_TREE,
                  WINDOW,
                  &global_common.windowtad,
                  TRUE);
    global_common.elemnumber = -1;
 
    DEBUG3("init_global: 11");
    /* Init mouseforms */
    Rsrc_do_rcfix (physical_vdi_id,
                   (RSHDR *)cursors,
                   FALSE
                   ,
                   TRUE
                   );
    DEBUG3("init_global: 12");
    Rsrc_do_gaddr((RSHDR *)cursors,
                  R_TREE,
                  MOUSEFORMS,
                  &global_common.mouseformstad,
                  TRUE);
    DEBUG3("init_global: 13");
    Graf_init_mouseforms();
    
    DEBUG3("init_global: 14");
#ifdef MINT_TARGET
    /* Initialize semaphore used by Shel_do_write */
    Psemaphore(SEM_CREATE, SHEL_WRITE_LOCK, 0);
    Psemaphore(SEM_UNLOCK, SHEL_WRITE_LOCK, 0);
#endif
  }
}