short draw_multiline(PARMBLK *parmblock) { GRECT clip_area; short sizing = 4; //Set up clipping OUTPUT_WINDOW *window = (OUTPUT_WINDOW*)parmblock->pb_parm; short handle = window->workstation; char buffer[255]; short last_index = 0; short draw_region[4] = { parmblock->pb_x, parmblock->pb_y, parmblock->pb_x + parmblock->pb_w, parmblock->pb_y + parmblock->pb_h }; short clip_region[4] = { parmblock->pb_xc, parmblock->pb_yc, parmblock->pb_xc + parmblock->pb_wc, parmblock->pb_yc + parmblock->pb_hc }; vs_clip(handle, 1, clip_region); vsf_interior(handle, 1); //vsf_color(handle, 6); //vr_recfl(handle, draw_region); // clear entire message area vsl_color(handle, 1); vst_height(handle, sizing, &sizing, &sizing, &sizing, &sizing); short position = 6; while (tokenize_multiline(buffer, window->text, parmblock->pb_w, sizing, &last_index)) { v_gtext(handle, parmblock->pb_x, parmblock->pb_y + position, buffer); position += sizing; } vs_clip(handle, 0, clip_region); return 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) ; }
int cdecl draw_albumimg(PARMBLK *paramblk) { WEXTENSION_ALBUM *wext = (WEXTENSION_ALBUM *) paramblk->pb_parm ; int cxy[4] ; int xy[8] ; if (wext->albumimg.fd_addr != NULL) { xy[0] = 0 ; xy[1] = 0 ; xy[2] = wext->albumimg.fd_w-1 ; xy[3] = wext->albumimg.fd_h-1 ; xy[4] = paramblk->pb_x ; xy[5] = paramblk->pb_y ; xy[6] = xy[4]+wext->albumimg.fd_w-1 ; xy[7] = xy[5]+wext->albumimg.fd_h-1 ; cxy[0] = paramblk->pb_xc ; cxy[1] = paramblk->pb_yc ; cxy[2] = paramblk->pb_xc+paramblk->pb_wc-1 ; cxy[3] = paramblk->pb_yc+paramblk->pb_hc-1 ; vs_clip(handle, 1, cxy) ; v_hide_c(handle) ; vro_cpyfm(handle, S_ONLY, xy, &wext->albumimg, &screen) ; v_show_c(handle, 1) ; vs_clip(handle, 0, cxy) ; } return(0) ; }
int redoinpb(short hand,GRECT box) { int xy[4]; char *point; short junk2; char temps[2048]; if(hand==-1)return 0; 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[CINPBACK]); writeinpinfo(hand); point=wn[hand].inp+strlen(wn[hand].inp); vst_font(ws.handle,(WORD)inpfont); vst_point(ws.handle,(WORD)inppoint,&junk2,&junk2,&junk2,&junk2); vst_color(ws.handle,col[CINPTEXT]); point=point-wn[hand].ihc[wn[hand].cvof]; stccpy(temps,point,wn[hand].ihc[wn[hand].cvof]+1); vswr_mode(ws.handle,MD_TRANS); v_gtext(ws.handle,wn[hand].wwa.g_x,wn[hand].wwa.g_y+wn[hand].wwa.g_h-1,temps); if(wn[hand].cvof>0){ point=point-wn[hand].ihc[wn[hand].cvof-1]; stccpy(temps,point,wn[hand].ihc[wn[hand].cvof-1]+1); v_gtext(ws.handle,wn[hand].wwa.g_x,wn[hand].wwa.g_y+wn[hand].wwa.g_h-ith-1,temps); } docursor(hand); vs_clip(ws.handle,0,NULL); return 0; }
void update_raster(GEM_WINDOW *gwnd, int xmin, int ymin, int xmax, int ymax) { VXIMAGE *vimage ; MFDB zoom ; int xy[8] ; int cxy[4] ; int xi, yi, wx, wy ; int posx, posy ; int zoom_level ; if ( gwnd == NULL ) return ; vimage = (VXIMAGE *) gwnd->Extension ; gwnd->GetWorkXYWH( gwnd, &xi, &yi, &wx, &wy ) ; posx = vimage->x1 ; posy = vimage->y1 ; if (xmax > Xmax) xmax = Xmax ; if (ymax > Ymax) ymax = Ymax ; zoom_level = vimage->zoom_level ; xy[0] = xmin ; xy[1] = ymin ; xy[2] = xmax ; xy[3] = ymax ; xy[4] = posx+(xmin-xi) ; xy[5] = posy+(ymin-yi) ; xy[6] = xy[4]+(1+xmax-xmin)/zoom_level-1 ; xy[7] = xy[5]+(1+ymax-ymin)/zoom_level-1 ; cxy[0] = xdesk ; cxy[1] = ydesk ; cxy[2] = xdesk+wdesk-1 ; cxy[3] = ydesk+hdesk-1 ; vs_clip( handle, 1, cxy ) ; v_hide_c( handle ) ; if ( zoom_level == 1 ) vro_cpyfm( handle, S_ONLY, xy, &screen, &vimage->raster ) ; else { int xyarray[8] ; memcpy(xyarray, xy, 8) ; xyarray[4] = xmin-xi ; xyarray[5] = ymin-yi ; xyarray[6] = xmax-xi ; xyarray[7] = ymax-yi ; vro_cpyfm(handle, S_ONLY, xyarray, &screen, &vimage->zoom) ; if (raster_zoom(&screen, &zoom, xy, -zoom_level, -zoom_level) == 0) { xy[0] = 0 ; xy[1] = 0 ; xy[2] = (1+xmax-xmin)/zoom_level-1 ; xy[3] = (1+ymax-ymin)/zoom_level-1 ; vro_cpyfm(handle, S_ONLY, xy, &zoom, &vimage->raster) ; free(zoom.fd_addr) ; } } v_show_c(handle, 0) ; vs_clip(handle, 0, cxy) ; }
/******************************************************************************* 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; }
VOID gsx_sclip(GRECT *pt) { rc_get(pt, &gl_xclip, &gl_yclip, &gl_wclip, &gl_hclip); if ( gl_wclip && gl_hclip ) { ptsin[0] = gl_xclip; ptsin[1] = gl_yclip; ptsin[2] = gl_xclip + gl_wclip - 1; ptsin[3] = gl_yclip + gl_hclip - 1; vs_clip(gl_handle, TRUE, &ptsin[0]); } else vs_clip(gl_handle, FALSE, &ptsin[0]); } /* gsx_setclip */
void clipdesk_on(void) { int clip_rect[4]; xd_rect2pxy(&screen_info.dsk, clip_rect); vs_clip(vdi_handle, 1, clip_rect); }
VOID gsx_outline(GRECT *pt) { vs_clip(gl_handle, FALSE, &ptsin[0]); gsx_attr(FALSE, MD_XOR, BLACK); gsx_bxpts(pt); v_pline(gl_handle, 5, &ptsin[0]); }
void iw_xdraw(ICONWIND iw) { WORD xy[4], bxy[10]; wind_update(BEG_UPDATE); graf_mouse(M_OFF, NULL); rc_getpts(&iw->w.rwind, xy); vs_clip(iw->w.wsid, 1, xy); vswr_mode(iw->w.wsid, MD_XOR); vsl_color(iw->w.wsid, BLACK); vsl_ends(iw->w.wsid, 0, 0); vsl_type(iw->w.wsid, 1); vsl_width(iw->w.wsid, 1); rc_boxpts(&iw->w.rwind, bxy); bxy[9]--; v_pline(iw->w.wsid, 5, bxy); vsf_color(iw->w.wsid, BLACK); vsf_interior(iw->w.wsid, FIS_SOLID); vsf_perimeter(iw->w.wsid, 0); xy[0]++, xy[2]--; xy[3] = xy[1]++ + 7; v_bar(iw->w.wsid, xy); graf_mouse(M_ON, NULL); wind_update(END_UPDATE); }
VOID gsx_invert(GRECT *pt) { vsf_color(gl_handle, BLACK); vs_clip(gl_handle, FALSE, &ptsin[0]); bb_fill(MD_XOR, FIS_SOLID, IP_SOLID, pt->g_x, pt->g_y, pt->g_w, pt->g_h); }
/* * Adjust color of selected color pen with * RGB gun values requested. * * Force the redraw of the currently selected pen box. */ void adjcol( void ) { GRECT obrect; WORD clip[4]; (curnew+curcol)->rint = curscrn[R]; (curnew+curcol)->gint = curscrn[G]; (curnew+curcol)->bint = curscrn[B]; slidtext(); open_vwork(); rc_2xy( &desk, clip ); vs_clip( vhandle, 1, ( int *)clip ); vs_color(vhandle, curcol, (int *)(curnew+curcol) ); /* cjg - force a redraw fo the curbox */ vsf_color( vhandle, curcol ); /* fill with color of obj */ obrect = ObRect( curbox ); objc_offset(tree, curbox, &obrect.g_x, &obrect.g_y); pxyarray[0] = obrect.g_x; pxyarray[1] = obrect.g_y; pxyarray[2] = obrect.g_x + obrect.g_w - 1; pxyarray[3] = obrect.g_y + obrect.g_h - 1; v_bar(vhandle, pxyarray); close_vwork(); *( curdirt+curcol ) = touch_bnk = DIRTY; }
/* * Show the selected color of the appropiate line or page */ void nxt_to_show(int toscroll) { int obj; WORD clip[4]; open_vwork(); rc_2xy( &desk, clip ); vs_clip( vhandle, 1, ( int *)clip ); /* if current color is not shown, page accordingly to show it */ if (curcol < headcol) { /* page backwards */ if ((headcol -= toscroll) < 0) /* update color to start with */ headcol = 0; draw_boxes(); /* redraw color boxes */ } else if (curcol >= headcol + MAX_COL_SHOWN) { /* page forward */ if ((headcol += toscroll) > numcol - MAX_COL_SHOWN) headcol = numcol - MAX_COL_SHOWN; draw_boxes(); /* redraw color boxes */ } /* deselect previous color and select current one */ obj = curcol - headcol + headbox; if (obj != curbox) { outline(curbox, DEHILITE); outline(obj, HILITE); curbox = obj; /* update current box selected */ } /* update color # and RGB sliders */ curslid = CSLIDE; slidtext(); /* update color # ONLY */ update_rgb(1); /* update and draw RGB gun values */ close_vwork(); }
int cdecl draw_pencil(PARMBLK *parmblk) { WEXTENSION_PENCIL *wext = (WEXTENSION_PENCIL *) parmblk->pb_parm ; int xy[8] ; int xc, yc ; xy[0] = parmblk->pb_x ; xy[1] = parmblk->pb_y ; xy[2] = parmblk->pb_x+parmblk->pb_w-1 ; xy[3] = parmblk->pb_y+parmblk->pb_h-1 ; vs_clip(handle, 1, xy) ; xc = (xy[0]+xy[2])/2 ; yc = (xy[1]+xy[3])/2 ; vswr_mode(handle, MD_REPLACE) ; vsf_interior(handle, FIS_SOLID) ; vsf_color(handle, 0) ; vr_recfl(handle, xy) ; vsf_color(handle, wext->pencil.color) ; switch( wext->pencil.type ) { case 0 : xy[0] = xc-wext->pencil.height/2 ; xy[1] = yc-wext->pencil.height/2 ; xy[2] = xc+wext->pencil.height/2 ; xy[3] = yc+wext->pencil.height/2 ; vr_recfl(handle, xy) ; break ; case 1 : v_circle(handle, xc, yc, wext->pencil.height/2) ; break ; case 2 : xy[0] = xc ; xy[1] = yc-wext->pencil.height/2 ; xy[2] = xc+wext->pencil.height/2 ; xy[3] = yc ; xy[4] = xc ; xy[5] = yc+wext->pencil.height/2 ; xy[6] = xc-wext->pencil.height/2 ; xy[7] = yc ; v_fillarea(handle, 4, xy) ; break ; } vs_clip(handle, 0, xy) ; return(0) ; }
/******************************************************************************* Clip ou d‚clip une zone avec la VDI *******************************************************************************/ void _setClip(int flag,GRECT *area) { int pxy[4]; pxy[0]=area->g_x; pxy[1]=area->g_y; pxy[2]=area->g_w+area->g_x-1; pxy[3]=area->g_h+area->g_y-1; vs_clip (glb.vdi.ha,flag,pxy); }
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) ; }
/* * Find and redraw all clipping rectangles */ void do_redraw(GRECT *dirty_rect, int *oldclip) { GRECT *r1; WORD clip[4]; if (bpg > 0) { /* only need to draw when there is color */ open_vwork(); r1 = (*xcpb->GetFirstRect)(dirty_rect); while (r1) { /* set clipping rectangle */ rc_2xy(r1, clip); vs_clip(vhandle, 1, (int *)clip); draw_boxes(); outline( curbox, HILITE ); r1 = (*xcpb->GetNextRect)(); } vs_clip(vhandle, 1, oldclip); /* restore original clipping */ close_vwork(); } }
set_for_jim() { WORD dummy; WORD i; Setpallete(sys_cmap); /* and now set flicker colors */ ghide_mouse(); jim_rez(); vs_clip(handle, 1, screen_bounds); show_mouse(); install_critical(); }
/* * Find and redraw all clipping rectangles */ void do_redraw(GRECT *dirty_rect, int *oldclip) { GRECT *r1; WORD clip[4]; GRECT r2; open_vwork(); r1 = (*xcpb->GetFirstRect)(dirty_rect); while (r1) { r2 = *r1; /* set clipping rectangle */ rc_2xy( &r2, clip); vs_clip(vhandle, 1, (int *)clip); draw_boxes(); outline( curbox, HILITE ); r1 = (*xcpb->GetNextRect)(); } vs_clip(vhandle, 1, oldclip); /* restore original clipping */ close_vwork(); }
static inline void plotter_vdi_clip( GEM_PLOTTER self, bool set) { return; if( set == true ) { struct rect c; short vdiflags[58]; short newclip[4]; self->get_clip( self, &c ); vq_extnd( self->vdi_handle, 1, (short*)&vdiflags); prev_vdi_clip[0] = vdiflags[45]; prev_vdi_clip[1] = vdiflags[46]; prev_vdi_clip[2] = vdiflags[47]; prev_vdi_clip[3] = vdiflags[48]; newclip[0] = VIEW(self).x + MAX(c.x0, 0); newclip[1] = VIEW(self).y + MAX(c.y0, 0); newclip[2] = MIN(VIEW(self).x+VIEW(self).w, newclip[0] + (c.x1 - c.x0) )-1; newclip[3] = MIN(VIEW(self).y+VIEW(self).h, newclip[1] + (c.y1 - c.y0) )-1; vs_clip( self->vdi_handle, 1, (short*)&newclip ); } else { vs_clip( self->vdi_handle, 1, (short *)&prev_vdi_clip ); } }
void dodirty(int hand,GRECT box) { int xy[4]; int tpa,tpb,junk2,mcto=0; int x,y,w,h; x=box.g_x;y=box.g_y;w=box.g_w;h=box.g_h; xy[0]=x;xy[1]=y;xy[2]=x+w-1;xy[3]=y+h-1; vs_clip(ws.handle,1,xy); clearwin(x,y,w,h,col[CBACK]); tpa=(wn[hand].wwa.g_y+wn[hand].wwa.g_h-ith*2-VT-3)-(y+h-1); tpb=tpa/th; tpa=(h+th/2)/th; junk2=wn[hand].clcnt-tpb-wn[hand].scb; if(junk2<0)junk2=150+junk2; vswr_mode(ws.handle,MD_TRANS); while(tpa>-1){ writeoutput(hand,wn[hand].cl[junk2],tpb+mcto-1,wn[hand].clc[junk2]); mcto++;tpa--;junk2--; if(junk2<0)junk2=149; } vs_clip(ws.handle,0,NULL); }
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; }
/* driver_redraw() * ================================================================ */ void driver_redraw( int *msg ) { GRECT area; GRECT rect; int clip[4]; area.g_x = msg[4]; area.g_y = msg[5]; area.g_w = msg[6]; area.g_h = msg[7]; graf_mouse( M_OFF, 0L ); wind_get( msg[3], WF_FIRSTXYWH, &rect.g_x, &rect.g_y, &rect.g_w, &rect.g_h ); while( rect.g_w && rect.g_h ) { if( rc_intersect( &area, &rect ) ) { rc_2xy( &rect, clip ); vs_clip( vhandle, 1, clip ); /* Redraw Meta Driver */ #if 0 if( gl_meta ) do_cross_draw( ad_driver, PMETA2 ); /* Redraw Memory Driver */ if( gl_mem ) do_cross_draw( ad_driver, PMEM2 ); #endif } wind_get( msg[3], WF_NEXTXYWH,&rect.g_x, &rect.g_y, &rect.g_w, &rect.g_h ); } vs_clip( vhandle, 0, clip ); graf_mouse( M_ON, 0L ); }
/* set_for_gem and set_for_jim - functions that let me run at low rez while doing file requestor and file io at whatever rez GEM thinks it is - necessary for file requestor to appear ok, and for system io error dialogs to be centered etc. Thanks to Dave Staugas (of Neochrome) for the necessary magic aline peeks and pokes! */ set_for_gem() { WORD i; wait_penup(); for (i=0; i<22000; i++) ; /* just stall - hey I'm experimenting */ remove_critical(); Setpallete(color_env); /* restore start-up colors */ hide_mouse(); /* go reset mouse and */ vs_clip(handle, 0, screen_bounds); gem_rez(); /* screen rez */ gshow_mouse(); /* to what GEM wants */ Setscreen(pscreen, pscreen, -1); }
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; }
static void SmartRePaint(GEM_WINDOW *gwnd, long old_ystart) { HEX_DUMP *hex_dump = (HEX_DUMP *) gwnd->Extension ; long i, dy, line_size ; int xy[8], xyr[8], xyc[4] ; int rx, ry, rw, rh, x, y, w, h ; int htline ; int smart_possible = 0 ; unsigned char *fmt_txt = (unsigned char*)hex_dump->formatted_txt + hex_dump->nb_max_lines_on_window * sizeof(char*) ; wind_get( gwnd->window_handle, WF_FIRSTXYWH, &rx, &ry, &rw, &rh ) ; GWGetWorkXYWH( gwnd, &x, &y, &w, &h ) ; if ( ( rx == x ) && ( ry == y ) && ( rw == w ) && ( rh == h ) ) smart_possible = 1 ; hex_dump->ystart_fmt = hex_dump->ystart ; if ( smart_possible ) { line_size = 1L + hex_dump->total_nb_char_on_line ; htline = hex_dump->h_char + hex_dump->interline ; dy = hex_dump->ystart - old_ystart ; if ( labs( dy ) < hex_dump->nb_lines_on_window ) { xy[0] = xy[4] = xyr[0] = x ; xy[2] = xy[6] = xyr[2] = x + w - 1 ; if ( dy > 0 ) { xy[1] = y + (int)dy * htline ; xy[3] = y + (int)hex_dump->nb_lines_on_window * htline - 1 ; xy[5] = y ; xy[7] = y + (int)( hex_dump->nb_lines_on_window - dy ) * htline - 1 ; xyr[1] = 1 + xy[7] ; xyr[3] = (int)dy * htline - 1 ; memmove( fmt_txt, fmt_txt + dy * line_size, ( hex_dump->nb_lines_on_window - dy ) * line_size ) ; for ( i = dy; i > 0; i-- ) FormatLine( hex_dump, old_ystart + hex_dump->nb_lines_on_window + i - 1 ) ; } else { xy[1] = y ; xy[3] = y + (int)( hex_dump->nb_lines_on_window + dy ) * htline - 1 ; xy[5] = y - (int)dy * htline ; xy[7] = y + (int)hex_dump->nb_lines_on_window * htline - 1 ; xyr[1] = xy[1] ; xyr[3] = (int)( hex_dump->nb_lines_on_window + dy ) * htline - 1 ; memmove( fmt_txt - dy * line_size, fmt_txt, ( hex_dump->nb_lines_on_window + dy ) * line_size ) ; for ( i = dy; i < 0; i++ ) FormatLine( hex_dump, old_ystart + i ) ; } v_hide_c( handle ) ; vro_cpyfm( handle, S_ONLY, xy, &screen, &screen ) ; xyc[0] = x ; xyc[1] = y ; xyc[2] = x + w - 1 ; xyc[3] = y + h - 1 ; vs_clip( handle, 1, xyc ) ; OnDraw( gwnd, xyr ) ; vs_clip( handle, 0, xyc ) ; v_show_c( handle, 1 ) ; } else smart_possible = 0 ; } if ( !smart_possible ) { for ( i = hex_dump->ystart_fmt; i < hex_dump->ystart_fmt + hex_dump->nb_lines_on_window; i++ ) FormatLine( hex_dump, i ) ; GWRePaint( gwnd ) ; } UpdateVSlider( gwnd ) ; }
/* * Show color panel * Passed: GRECT *rect = pointer to rectangle CPX resides in * Returns: BOOLEAN FALSE = to exit CPX */ BOOLEAN cdecl colpnl(GRECT *rect) { MRETS mk; int quit=0; int obj, ox, oy; WORD msg[8], clip[4]; GRECT obrect; /* object rectangle */ Wind_get(0, WF_WORKXYWH, (WARGS *)&obrect); /* set clipping to */ rc_2xy(&obrect, clip); /* Desktop space */ open_vwork(); vs_clip(vhandle, 1, (int *)clip); ObX(COLPNL) = rect->g_x; /* position panel */ ObY(COLPNL) = rect->g_y; Objc_draw(tree, COLPNL, MAX_DEPTH, NULL); /* draw panel */ draw_boxes(); /* draw the color boxes */ outline(curbox, HILITE); /* show selected box */ close_vwork(); if (IsSelected(INVRSVDO)) /* if Invert button is selected */ Deselect(INVRSVDO); /* deselect it */ do { if ((obj = (*xcpb->Xform_do)(tree, COLPNL, msg)) != -1) { obj &= 0x7fff; /* mask out double clicks */ switch(obj) { case RUP: curslid = RSLID; (*xcpb->Sl_arrow)(tree, RBASE, RSLID, RUP, 1, val_min, val_max, &curscrn[R], VERTICAL, adjcol); break; case RDOWN: curslid = RSLID; (*xcpb->Sl_arrow)(tree, RBASE, RSLID, RDOWN, -1, val_min, val_max, &curscrn[R], VERTICAL, adjcol); break; case RSLID: (*xcpb->MFsave)(MFSAVE, &orig_mf); if( AES_Version >= 0x0320 ) DRAG_MOUSE; curslid = RSLID; (*xcpb->Sl_dragy)(tree, RBASE, RSLID, val_min, val_max, &curscrn[R], adjcol); (*xcpb->MFsave)(MFRESTORE, &orig_mf); break; case RBASE: Graf_mkstate(&mk); objc_offset(tree, RSLID, &ox, &oy); if(mk.y < oy) oy = VAL_PAGE; else oy = -VAL_PAGE; curslid = RSLID; (*xcpb->Sl_arrow)(tree, RBASE, RSLID, -1, oy, val_min, val_max, &curscrn[R], VERTICAL, adjcol); break; case GUP: curslid = GSLID; (*xcpb->Sl_arrow)(tree, GBASE, GSLID, GUP, 1, val_min, val_max, &curscrn[G], VERTICAL, adjcol); break; case GDOWN: curslid = GSLID; (*xcpb->Sl_arrow)(tree, GBASE, GSLID, GDOWN, -1, val_min, val_max, &curscrn[G], VERTICAL, adjcol); break; case GSLID: (*xcpb->MFsave)(MFSAVE, &orig_mf); if( AES_Version >= 0x0320 ) DRAG_MOUSE; curslid = GSLID; (*xcpb->Sl_dragy)(tree, GBASE, GSLID, val_min, val_max, &curscrn[G], adjcol); (*xcpb->MFsave)(MFRESTORE, &orig_mf); break; case GBASE: Graf_mkstate(&mk); objc_offset(tree, GSLID, &ox, &oy); if(mk.y < oy) oy = VAL_PAGE; else oy = -VAL_PAGE; curslid = GSLID; (*xcpb->Sl_arrow)(tree, GBASE, GSLID, -1, oy, val_min, val_max, &curscrn[G], VERTICAL, adjcol); break; case BUP: curslid = BSLID; (*xcpb->Sl_arrow)(tree, BBASE, BSLID, BUP, 1, val_min, val_max, &curscrn[B], VERTICAL, adjcol); break; case BDOWN: curslid = BSLID; (*xcpb->Sl_arrow)(tree, BBASE, BSLID, BDOWN, -1, val_min, val_max, &curscrn[B], VERTICAL, adjcol); break; case BSLID: (*xcpb->MFsave)(MFSAVE, &orig_mf); if( AES_Version >= 0x0320 ) DRAG_MOUSE; curslid = BSLID; (*xcpb->Sl_dragy)(tree, BBASE, BSLID, val_min, val_max, &curscrn[B], adjcol); (*xcpb->MFsave)(MFRESTORE, &orig_mf); break; case BBASE: Graf_mkstate(&mk); objc_offset(tree, BSLID, &ox, &oy); if(mk.y < oy) oy = VAL_PAGE; else oy = -VAL_PAGE; curslid = BSLID; (*xcpb->Sl_arrow)(tree, BBASE, BSLID, -1, oy, val_min, val_max, &curscrn[B], VERTICAL, adjcol); break; case COLUP: (*xcpb->Sl_arrow)(tree, COLBASE, COLSLID, COLUP, -1, col_max, col_min, &curcol, VERTICAL, nxtrow); break; case COLDOWN: (*xcpb->Sl_arrow)(tree, COLBASE, COLSLID, COLDOWN, 1, col_max, col_min, &curcol, VERTICAL, nxtrow); break; case COLSLID: (*xcpb->MFsave)(MFSAVE, &orig_mf); if( AES_Version >= 0x0320 ) DRAG_MOUSE; (*xcpb->Sl_dragy)(tree, COLBASE, COLSLID, col_max, col_min, &curcol, nxtgrp); (*xcpb->MFsave)(MFRESTORE, &orig_mf); break; case COLBASE: Graf_mkstate(&mk); objc_offset(tree, COLSLID, &ox, &oy); if(mk.y < oy) oy = -col_page; else oy = col_page; curslid = COLSLID; (*xcpb->Sl_arrow)(tree, COLBASE, COLSLID, -1, oy, col_max, col_min, &curcol, VERTICAL, nxtpage); break; case BNKRIGHT: (*xcpb->Sl_arrow)(tree, BNKBASE, BNKSLID, BNKRIGHT, 1, BNK_MIN, BNK_MAX, &curbnk, HORIZONTAL, nxtbnk); break; case BNKLEFT: (*xcpb->Sl_arrow)(tree, BNKBASE, BNKSLID, BNKLEFT, -1, BNK_MIN, BNK_MAX, &curbnk, HORIZONTAL, nxtbnk); break; case BNKSLID: (*xcpb->MFsave)(MFSAVE, &orig_mf); if( AES_Version >= 0x0320 ) DRAG_MOUSE; (*xcpb->Sl_dragx)(tree, BNKBASE, BNKSLID, BNK_MIN, BNK_MAX, &curbnk, nxtbnk); (*xcpb->MFsave)(MFRESTORE, &orig_mf); break; case BNKBASE: Graf_mkstate(&mk); objc_offset(tree, BNKSLID, &ox, &oy); if(mk.x < ox) oy = -BNK_PAGE; else oy = BNK_PAGE; (*xcpb->Sl_arrow)(tree, BNKBASE, BNKSLID, -1, oy, BNK_MIN, BNK_MAX, &curbnk, HORIZONTAL, nxtbnk); break; case DUO0: /* for ST High rez */ case DUO1: case QUARTRO0: /* for ST Medium rez */ case QUARTRO1: case QUARTRO2: case QUARTRO3: case BOX0: /* for all other rez */ case BOX1: case BOX2: case BOX3: case BOX4: case BOX5: case BOX6: case BOX7: case BOX8: case BOX9: case BOX10: case BOX11: case BOX12: case BOX13: case BOX14: case BOX15: if (obj != curbox) { /* select requested color */ curcol = obj - headbox + headcol; nxt_to_show(0); update_slid(VERTICAL, COLBASE, COLSLID, curcol, col_max, col_min, 1); } break; case INVRSVDO: Deselect(obj); /* deselect button */ flip(0, &curinv); /* read invert state */ if (curinv & NOT_FLIPPED) { /* inverted? */ curinv &= 0xfffe; /* if not, invert it */ } else { /* else */ curinv |= NOT_FLIPPED; /* restore it */ draw_button(obj); /* redraw button */ } flip(1, &curinv); /* set new invert state */ if (bpg) { /* if color */ swaprgb(curnew, curnew+1); /* swap pen 0 and 1 */ open_vwork(); vs_color(vhandle, 0, (int *)curnew); vs_color(vhandle, 1, (int *)(curnew+1)); close_vwork(); *curdirt = *(curdirt+1) = *touch_bnk = DIRTY; update_rgb(1); /* update RGB sliders */ } break; case SETGRAY: case SETCOL: Deselect(obj); /* deselect selected button */ HideObj(obj); /* hide selected button */ if (obj == SETGRAY) { obj = SETCOL; /* change to Color button */ curgray = TRUE; /* turn on hypermono */ } else { obj = SETGRAY; /* change to Gray button */ curgray = FALSE; /* turn off hypermono */ } ShowObj(obj); /* show new button */ draw_button(obj); /* draw it */ Vsync(); EsetGray(curgray); /* set to selected mode */ reinitcol(); /* reinit color regs */ break; case COLSAVE: /* save current values */ if ((*xcpb->XGen_Alert)(SAVE_DEFAULTS) == TRUE) { (*xcpb->MFsave)(MFSAVE, &orig_mf); if( AES_Version >= 0x0320 ) BEE_MOUSE; if (bpg) { /* if color */ usr_vals.bnk = curbnk; /* save bank # */ savergb(); /* save color info */ /* update RGBs */ cpyrgb((RGB *)&oldrgb, (RGB *)&newrgb, totcol); } if (currez == STHI) /* if in ST high rez */ usr_vals.inv = curinv; /* save invert state */ /* if hypermono supported, save state */ if (curmode == TTVDO && currez != TTHI) usr_vals.gray = curgray; /* save current data to file */ saved = 1; (*xcpb->CPX_Save)((void *)&saved, sizeof(DEFAULTS)+2); (*xcpb->MFsave)(MFRESTORE, &orig_mf); } Deselect(obj); draw_button(obj); break; case COLCNCEL: cnclchgs(); /* cancel all changes made */ case COLOK: /* accept all changes made */ Deselect(obj); /* deselect button */ quit = TRUE; /* ready to quit */ break; case COLRLOAD: /* reload saved user-preference */ if (saved) init(&usr_vals); else init(&def_vals); Deselect(obj); draw_button(obj); break; } } else { switch(msg[0]) { case WM_REDRAW: /* redraw cpx */ do_redraw((GRECT *)&msg[4], (int *)clip); break; case KEY_CODE: switch(msg[3]) { /* check which key is returned */ case UNDO: /* if Undo key */ /* reset to original invert state */ if (currez == STHI && oldinv != curinv) { flip(1, &oldinv); if (!(oldinv & NOT_FLIPPED)) Select(INVRSVDO); draw_button(INVRSVDO); Deselect(INVRSVDO); curinv = oldinv; } if (bpg) { /* if there is color */ if ((int)curmode == TTVDO && currez != TTHI && curgray != oldgray) { Vsync(); EsetGray(oldgray); reinitcol(); if (oldgray) { HideObj(SETGRAY); obj = SETCOL; } else { HideObj(SETCOL); obj = SETGRAY; } ShowObj(obj); draw_button(obj); curgray = oldgray; } cnclbnk(); /* cancel color changes */ update_rgb(1); /* update RGB on screen */ } break; case HOME: /* if Clr Home key */ if (currez != TTHI) /* if not in TT High rez */ init(&def_vals); /* init to system defs */ break; } break; case AC_CLOSE: cnclchgs(); /* cancel changes made */ case WM_CLOSED: quit = TRUE; /* ready to quit */ break; } } } while (!quit); return (FALSE); }
/******************************************************************************* 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; }
/******************************************************************************* 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; }
/******************************************************************************* 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; }