static void GroupWExpose(struct groupdlg *grp,GWindow pixmap,GRect *rect) { int depth, y, len; Group *group; GRect r; Color fg; GDrawFillRect(pixmap,rect,GDrawGetDefaultBackground(NULL)); GDrawSetLineWidth(pixmap,0); r.height = r.width = grp->as; y = (rect->y/grp->fh) * grp->fh + grp->as; depth=0; group = GroupFindLPos(grp->root,rect->y/grp->fh+grp->off_top,&depth); GDrawSetFont(pixmap,grp->font); while ( group!=NULL ) { r.y = y-grp->as+1; r.x = 5+8*depth - grp->off_left; fg = group->selected ? 0xff0000 : 0x000000; if ( group->glyphs==NULL ) { GDrawDrawRect(pixmap,&r,fg); GDrawDrawLine(pixmap,r.x+2,r.y+grp->as/2,r.x+grp->as-2,r.y+grp->as/2, fg); if ( !group->open ) GDrawDrawLine(pixmap,r.x+grp->as/2,r.y+2,r.x+grp->as/2,r.y+grp->as-2, fg); } len = GDrawDrawText8(pixmap,r.x+r.width+5,y,group->name,-1,fg); if ( group->glyphs ) GDrawDrawText8(pixmap,r.x+r.width+5+len+5,y,group->glyphs,-1,fg); group = GroupNext(group,&depth); y += grp->fh; if ( y-grp->fh>rect->y+rect->height ) break; } }
static void GProgressDraw(GProgress *p,GWindow pixmap,GRect *rect) { GRect r, old; int width, amount; GDrawPushClip(pixmap,rect,&old); GDrawSetFont(pixmap,p->font); if ( p->line1!=NULL ) GDrawDrawText(pixmap, (p->width-p->l1width)/2, p->l1y, p->line1, -1, progress_foreground ); if ( p->line2!=NULL ) GDrawDrawText(pixmap, (p->width-p->l2width)/2, p->l2y, p->line2, -1, progress_foreground ); r.x = GDrawPointsToPixels(pixmap,10); r.y = p->boxy; r.height = r.x; width = p->width-2*r.x; if ( p->tot==0 ) amount = 0; else amount = width * (p->stage*p->tot + p->sofar)/(p->stages*p->tot); if ( amount>0 ) { r.width = amount; GDrawFillRect(pixmap,&r,progress_fillcol); } else if ( p->tot==0 ) { r.width = width; GDrawSetStippled(pixmap,1,0,0); GDrawFillRect(pixmap,&r,progress_fillcol); GDrawSetStippled(pixmap,0,0,0); } r.width = width; GDrawDrawRect(pixmap,&r,progress_foreground); GDrawPopClip(pixmap,&old); }
static void QGDrawWindow(GWindow pixmap, QGData *qg, GEvent *e) { int l, y, depth; char buffer[200]; GRect old, r; struct navigate where; struct qgnode *parent; GDrawPushClip(pixmap,&e->u.expose.rect,&old); r.width = r.height = qg->as; y = qg->as; memset(&where,0,sizeof(where)); QG_FindLine(&qg->list,qg->loff_top,&where); for ( l=0; l<qg->vlcnt && where.parent!=NULL; ++l ) { for ( parent=where.parent, depth= -2; parent!=NULL; parent=parent->parent, ++depth ); if ( where.offset==-1 ) { r.x = 2+depth*qg->fh; r.y = y-qg->as+1; GDrawDrawRect(pixmap,&r,0x000000); GDrawDrawLine(pixmap,r.x+2,r.y+qg->as/2,r.x+qg->as-2,r.y+qg->as/2, 0x000000); if ( !where.parent->open ) GDrawDrawLine(pixmap,r.x+qg->as/2,r.y+2,r.x+qg->as/2,r.y+qg->as-2, 0x000000); GDrawDrawText8(pixmap,r.x+qg->fh,y,where.parent->name,-1, 0x000000); } else { QuestionableGrid *q = &where.parent->first[where.offset]; sprintf( buffer, _("\"%.40s\" size=%d point=%d (%d,%d) distance=%g"), q->sc->name, q->size, q->nearestpt, q->x, q->y, q->distance ); GDrawDrawText8(pixmap,2+(depth+1)*qg->fh,y,buffer,-1, 0x000000); } y += qg->fh; QG_NextLine(&where); } GDrawPopClip(pixmap,&old); }
static void KP_RefreshSel(KPData *kpd,int index) { Color col = index==kpd->selected ? 0x000000 : GDrawGetDefaultBackground(NULL); GRect sel; if ( index==-1 ) return; sel.x = 0; sel.width = kpd->vwidth-1; sel.y = (index-kpd->off_top)*kpd->uh; sel.height = kpd->uh-2; GDrawSetLineWidth(kpd->v,0); GDrawDrawRect(kpd->v,&sel,col); }
static void SVDraw(SearchView *sv, GWindow pixmap, GEvent *event) { GRect r; GDrawSetLineWidth(pixmap,0); if ( sv->cv_srch.inactive ) GDrawSetFont(pixmap,sv->plain); else GDrawSetFont(pixmap,sv->bold); GDrawDrawBiText8(pixmap,10,sv->mbh+5+sv->as, _("Search Pattern:"),-1,NULL,0); if ( sv->cv_rpl.inactive ) GDrawSetFont(pixmap,sv->plain); else GDrawSetFont(pixmap,sv->bold); GDrawDrawBiText8(pixmap,sv->rpl_x,sv->mbh+5+sv->as, _("Replace Pattern:"),-1,NULL,0); r.x = 10-1; r.y=sv->cv_y-1; r.width = sv->cv_width+1; r.height = sv->cv_height+1; GDrawDrawRect(pixmap,&r,0); r.x = sv->rpl_x-1; GDrawDrawRect(pixmap,&r,0); }
static void KP_ExposeKerns(KPData *kpd,GWindow pixmap,GRect *rect) { GRect old, subclip, subold, sel; struct _GImage base; GImage gi; int index1, index2; BDFChar *bdfc1, *bdfc2; int i, as, x, em = kpd->sf->ascent+kpd->sf->descent, yoff; int first, last; struct kerns *kern; char buffer[140]; first = rect->y/kpd->uh; last = (rect->y+rect->height+kpd->uh-1)/kpd->uh; for ( i=first; i<=last && i+kpd->off_top<kpd->kcnt; ++i ) { kern = &kpd->kerns[i+kpd->off_top]; index1 = kern->first->orig_pos; if ( kpd->bdf->glyphs[index1]==NULL ) BDFPieceMeal(kpd->bdf,index1); index2 = kern->second->orig_pos; if ( kpd->bdf->glyphs[index2]==NULL ) BDFPieceMeal(kpd->bdf,index2); } as = kpd->vpad + kpd->sf->ascent * kpd->bdf->pixelsize / em; memset(&gi,'\0',sizeof(gi)); memset(&base,'\0',sizeof(base)); gi.u.image = &base; base.image_type = it_index; base.clut = kpd->bdf->clut; GDrawSetDither(NULL, false); GDrawPushClip(pixmap,rect,&old); GDrawSetFont(pixmap,kpd->font); GDrawSetLineWidth(pixmap,0); GDrawFillRect(pixmap,rect,GDrawGetDefaultBackground(NULL)); subclip = *rect; for ( i=first; i<=last && i+kpd->off_top<kpd->kcnt; ++i ) { subclip.y = i*kpd->uh; subclip.height = kpd->uh; GDrawPushClip(pixmap,&subclip,&subold); kern = &kpd->kerns[i+kpd->off_top]; index1 = kern->first->orig_pos; index2 = kern->second->orig_pos; bdfc1 = kpd->bdf->glyphs[index1]; bdfc2 = kpd->bdf->glyphs[index2]; BaseFillFromBDFC(&base,bdfc1); base.trans = base.clut->trans_index = -1; /* the peculiar behavior concerning xmin/xmax is because the bitmaps */ /* don't contain the side-bearings, we have to add that spacing manually */ if ( !kern->r2l ) { GDrawDrawImage(pixmap,&gi,NULL, 10,subclip.y+as-bdfc1->ymax); x = 10 + (bdfc1->width-bdfc1->xmin) + bdfc2->xmin + (kern->newoff*kpd->bdf->pixelsize/em); } else { x = kpd->vwidth-10-(bdfc1->xmax-bdfc1->xmin); GDrawDrawImage(pixmap,&gi,NULL, x,subclip.y+as-bdfc1->ymax); x -= bdfc1->xmin + (bdfc2->width-bdfc2->xmin) + (kern->newoff*kpd->bdf->pixelsize/em); } BaseFillFromBDFC(&base,bdfc2); #ifndef _BrokenBitmapImages base.trans = base.clut->trans_index = 0; #endif yoff = (kern->newyoff*kpd->bdf->pixelsize/em); GDrawDrawImage(pixmap,&gi,NULL, x,subclip.y+as-bdfc2->ymax-yoff); GDrawDrawLine(pixmap,0,subclip.y+kpd->uh-1, subclip.x+subclip.width,subclip.y+kpd->uh-1,0x000000); if ( kern->kp!=NULL ) sprintf( buffer, "%d ", kern->newoff); else sprintf( buffer, "%d,%d ", kern->newoff, kern->newyoff ); if ( kern->ac!=NULL ) strncat(buffer,kern->ac->name,sizeof(buffer)-strlen(buffer)-1); GDrawDrawBiText8(pixmap,15,subclip.y+kpd->uh-kpd->fh+kpd->as,buffer,-1,NULL, kern->kp!=NULL && kern->newoff!=kern->kp->off ? 0xff0000 : 0x000000 ); if ( i+kpd->off_top==kpd->selected ) { sel.x = 0; sel.width = kpd->vwidth-1; sel.y = subclip.y; sel.height = kpd->uh-2; GDrawDrawRect(pixmap,&sel,0x000000); } GDrawPopClip(pixmap,&subold); } #ifndef _BrokenBitmapImages base.clut->trans_index = -1; #endif GDrawPopClip(pixmap,&old); GDrawSetDither(NULL, true); }