static int e_h (GWindow gw, GEvent *event) { if (event->type == et_close) { struct gfc_data *d = GDrawGetUserData (gw); d->done = true; } else if (event->type == et_map) /* Above palettes */ GDrawRaise (gw); else if (event->type == et_char) return (false); else if (event->type == et_mousemove || (event->type == et_mousedown && event->u.mouse.button == 3)) { struct gfc_data *d = GDrawGetUserData (gw); GFileChooserPopupCheck (d->gfc, event); } else if ((event->type == et_mouseup || event->type == et_mousedown) && (event->u.mouse.button >= 4 && event->u.mouse.button <= 7)) { struct gfc_data *d = GDrawGetUserData (gw); return (GGadgetDispatchEvent ((GGadget *) (d->gfc), event)); } return (true); }
static int e_h(GWindow gw, GEvent *event) { if ( event->type==et_close ) { struct gfc_data *d = GDrawGetUserData(gw); d->done = true; } else if ( event->type == et_map ) { /* Above palettes */ GDrawRaise(gw); } else if ( event->type == et_char ) { return( false ); } else if ( event->type == et_mousemove || (event->type==et_mousedown && event->u.mouse.button==3 )) { struct gfc_data *d = GDrawGetUserData(gw); if ( !WithinList(d,event) ) GFileChooserPopupCheck(d->gfc,event); } else if (( event->type==et_mouseup || event->type==et_mousedown ) && (event->u.mouse.button>=4 && event->u.mouse.button<=7) ) { struct gfc_data *d = GDrawGetUserData(gw); return( GGadgetDispatchEvent((GGadget *) (d->gfc),event)); } else if ( event->type == et_resize ) { GRect r, size; struct gfc_data *d = GDrawGetUserData(gw); if ( d->gfc!=NULL ) { GDrawGetSize(gw,&size); GGadgetGetSize(d->gfc,&r); GGadgetResize(d->gfc,size.width-2*r.x,r.height); } } return( event->type!=et_char ); }
static int DoFindOne(SearchView *sv,int startafter) { int i, gid; SplineChar *startcur = sv->sd.curchar; /* It is possible that some idiot deleted the current character since */ /* the last search... do some mild checks */ if ( sv->sd.curchar!=NULL && sv->sd.curchar->parent == sv->sd.fv->sf && sv->sd.curchar->orig_pos>=0 && sv->sd.curchar->orig_pos<sv->sd.fv->sf->glyphcnt && sv->sd.curchar==sv->sd.fv->sf->glyphs[sv->sd.curchar->orig_pos] ) /* Looks ok */; else sv->sd.curchar=startcur=NULL; if ( !sv->sd.subpatternsearch ) startafter = false; if ( sv->showsfindnext && sv->sd.curchar!=NULL ) i = sv->sd.fv->map->backmap[sv->sd.curchar->orig_pos]+1-startafter; else { startafter = false; if ( !sv->sd.onlyselected ) i = 0; else { for ( i=0; i<sv->sd.fv->map->enccount; ++i ) if ( sv->sd.fv->selected[i] && (gid=sv->sd.fv->map->map[i])!=-1 && sv->sd.fv->sf->glyphs[gid]!=NULL ) break; } } for ( ; i<sv->sd.fv->map->enccount; ++i ) { if (( !sv->sd.onlyselected || sv->sd.fv->selected[i]) && (gid=sv->sd.fv->map->map[i])!=-1 && sv->sd.fv->sf->glyphs[gid]!=NULL ) { SCSplinePointsUntick(sv->sd.fv->sf->glyphs[gid],sv->sd.fv->active_layer); if ( SearchChar(&sv->sd,gid,startafter) ) break; } startafter = false; } if ( i>=sv->sd.fv->map->enccount ) { ff_post_notice(_("Not Found"),sv->showsfindnext?_("The search pattern was not found again in the font %.100s"):_("The search pattern was not found in the font %.100s"),sv->sd.fv->sf->fontname); sv->sd.curchar = startcur; GGadgetSetTitle8(GWidgetGetControl(sv->gw,CID_Find),_("Find")); sv->showsfindnext = false; return( false ); } SVSelectSC(sv); if ( sv->lastcv!=NULL && sv->lastcv->b.sc==startcur && sv->lastcv->b.fv== sv->sd.fv ) { CVChangeSC(sv->lastcv,sv->sd.curchar); GDrawSetVisible(sv->lastcv->gw,true); GDrawRaise(sv->lastcv->gw); } else sv->lastcv = CharViewCreate(sv->sd.curchar,(FontView *) sv->sd.fv,-1); GGadgetSetTitle8(GWidgetGetControl(sv->gw,CID_Find),_("Find Next")); sv->showsfindnext = true; return( true ); }
void ShowErrorWindow(void) { if ( errdata.gw==NULL ) return; GDrawSetVisible(errdata.gw,true); GDrawRaise(errdata.gw); if ( errdata.showing ) GDrawRequestExpose(errdata.v,NULL,false); errdata.showing = true; }
static void RulerPlace(CharView *cv, GEvent *event) { unichar_t ubuf[80]; int width, x, y; GRect size; GPoint pt; int i,h,w; GWindowAttrs wattrs; GRect pos; FontRequest rq; int as, ds, ld; if ( cv->ruler_w==NULL ) { memset(&wattrs,0,sizeof(wattrs)); wattrs.mask = wam_events|wam_cursor|wam_positioned|wam_nodecor|wam_backcol|wam_bordwidth; wattrs.event_masks = (1<<et_expose)|(1<<et_resize)|(1<<et_mousedown); wattrs.cursor = ct_mypointer; wattrs.background_color = 0xe0e0c0; wattrs.nodecoration = 1; wattrs.border_width = 1; pos.x = pos.y = 0; pos.width=pos.height = 20; cv->ruler_w = GWidgetCreateTopWindow(NULL,&pos,ruler_e_h,cv,&wattrs); if ( rvfont==NULL ) { memset(&rq,0,sizeof(rq)); rq.utf8_family_name = FIXED_UI_FAMILIES; rq.point_size = -12; rq.weight = 400; rvfont = GDrawInstanciateFont(GDrawGetDisplayOfWindow(cv->ruler_w),&rq); rvfont = GResourceFindFont("CharView.Measure.Font",rvfont); } cv->rfont = rvfont; GDrawFontMetrics(cv->rfont,&as,&ds,&ld); cv->rfh = as+ds; cv->ras = as; } else GDrawRaise(cv->ruler_w); GDrawSetFont(cv->ruler_w,cv->rfont); width = h = 0; for ( i=0; RulerText(cv,ubuf,i); ++i ) { w = GDrawGetBiTextWidth(cv->ruler_w,ubuf,-1,-1,NULL); if ( w>width ) width = w; h += cv->rfh; } GDrawGetSize(GDrawGetRoot(NULL),&size); pt.x = event->u.mouse.x; pt.y = event->u.mouse.y; GDrawTranslateCoordinates(cv->v,GDrawGetRoot(NULL),&pt); x = pt.x + infowindowdistance; if ( x+width > size.width ) x = pt.x - width-infowindowdistance; y = pt.y -cv->ras-2; if ( y+h > size.height ) y = pt.y - h - cv->ras -10; GDrawMoveResize(cv->ruler_w,x,y,width+4,h+4); }
static int rh_e_h(GWindow gw, GEvent *event) { if ( event->type==et_close ) { DoCancel( GDrawGetUserData(gw)); } else if ( event->type == et_char ) { return( false ); } else if ( event->type == et_map ) { /* Above palettes */ GDrawRaise(gw); } return( true ); }
static int od_e_h(GWindow gw, GEvent *event) { if ( event->type==et_close ) { OutlineData *od = GDrawGetUserData(gw); od->done = true; } else if ( event->type == et_char ) { return( false ); } else if ( event->type == et_map ) { /* Above palettes */ GDrawRaise(gw); } return( true ); }
static int cwd_e_h(GWindow gw, GEvent *event) { if ( event->type==et_close ) { CreateWidthDlg *wd = GDrawGetUserData(gw); wd->wd.done = true; } else if ( event->type == et_char ) { return( false ); } else if ( event->type == et_map ) { /* Above palettes */ GDrawRaise(gw); } return( true ); }
static int chd_e_h(GWindow gw, GEvent *event) { if ( event->type==et_close ) { CreateHintData *hd = GDrawGetUserData(gw); hd->done = true; } else if ( event->type == et_char ) { return( false ); } else if ( event->type == et_map ) { /* Above palettes */ GDrawRaise(gw); } return( true ); }
static int sd_e_h(GWindow gw, GEvent *event) { struct sd_data *sd = GDrawGetUserData(gw); if ( sd==NULL ) return( true ); if ( event->type==et_close ) { SD_DoCancel( sd ); } else if ( event->type==et_char ) { if ( event->u.chr.keysym == GK_F1 || event->u.chr.keysym == GK_Help ) { help("scripting.html"); return( true ); } return( false ); } else if ( event->type == et_map ) { /* Above palettes */ GDrawRaise(gw); } else if ( event->type == et_resize ) { #if 0 GRect newsize, gpos; int space; GDrawGetSize(gw,&newsize); GGadgetGetSize(GWidgetGetControl(gw,CID_Script),&gpos); space = sd->oldh - gpos.height; GGadgetResize(GWidgetGetControl(gw,CID_Box),newsize.width-4,newsize.height-4); GGadgetResize(GWidgetGetControl(gw,CID_Script),newsize.width-2*gpos.x,newsize.height-space); #if !defined(_NO_FFSCRIPT) && !defined(_NO_PYTHON) GGadgetGetSize(GWidgetGetControl(gw,CID_Python),&gpos); space = sd->oldh - gpos.y; GGadgetMove(GWidgetGetControl(gw,CID_Python),gpos.x,newsize.height-space); GGadgetGetSize(GWidgetGetControl(gw,CID_FF),&gpos); GGadgetMove(GWidgetGetControl(gw,CID_FF),gpos.x,newsize.height-space); #endif GGadgetGetSize(GWidgetGetControl(gw,CID_Call),&gpos); space = sd->oldh - gpos.y; GGadgetMove(GWidgetGetControl(gw,CID_Call),gpos.x,newsize.height-space); GGadgetGetSize(GWidgetGetControl(gw,CID_OK),&gpos); space = sd->oldh - gpos.y; GGadgetMove(GWidgetGetControl(gw,CID_OK),gpos.x,newsize.height-space); GGadgetGetSize(GWidgetGetControl(gw,CID_Cancel),&gpos); space = sd->oldh - gpos.y; GGadgetMove(GWidgetGetControl(gw,CID_Cancel),gpos.x,newsize.height-space); sd->oldh = newsize.height; #endif GDrawRequestExpose(gw,NULL,false); } return( true ); }
static int trans_e_h(GWindow gw, GEvent *event) { if ( event->type==et_close ) { TransData *td = GDrawGetUserData(gw); td->done = true; } else if ( event->type == et_map ) { /* Above palettes */ GDrawRaise(gw); } else if ( event->type==et_char ) { if ( event->u.chr.keysym == GK_F1 || event->u.chr.keysym == GK_Help ) { help("transform.html"); return( true ); } return( false ); } return( true ); }
static int delta_e_h(GWindow gw, GEvent *event) { if ( event->type==et_close ) { QGData *qg = GDrawGetUserData(gw); qg->done = true; } else if ( event->type == et_char ) { return( false ); } else if ( event->type == et_map ) { /* Above palettes */ GDrawRaise(gw); } else if ( event->type == et_destroy ) { QGData *qg = GDrawGetUserData(gw); free(qg->qg); free(qg); } return( true ); }
static int sd_e_h(GWindow gw, GEvent *event) { struct sd_data *sd = GDrawGetUserData(gw); if ( sd==NULL ) return( true ); if ( event->type==et_close ) { SD_DoCancel( sd ); } else if ( event->type==et_char ) { if ( event->u.chr.keysym == GK_F1 || event->u.chr.keysym == GK_Help ) { help("scripting.html"); return( true ); } return( false ); } else if ( event->type == et_map ) /* Above palettes */ GDrawRaise(gw); else if ( event->type == et_resize ) GDrawRequestExpose(gw,NULL,false); return( true ); }
static void WindowSelect(GWindow base,struct gmenuitem *mi,GEvent *e) { GDrawRaise(mi->ti.userdata); }
SearchView *SVCreate(FontView *fv) { SearchView *sv; GRect pos; GWindow gw; GWindowAttrs wattrs; GGadgetCreateData gcd[14], boxes[6], *butarray[14], *allowarray[6], *fudgearray[4], *halfarray[3], *varray[14]; GTextInfo label[14]; FontRequest rq; int as, ds, ld; char fudgebuf[20]; int k, sel_pos, efdo_pos; static GFont *plainfont = NULL, *boldfont=NULL; if ( searcher!=NULL ) { if ( SVAttachFV(fv,true)) { GDrawSetVisible(fv->sv->gw,true); GDrawRaise(fv->sv->gw); return( searcher ); } else return( NULL ); } searcher = sv = SVFillup( gcalloc(1,sizeof(SearchView)), fv ); memset(&wattrs,0,sizeof(wattrs)); wattrs.mask = wam_events|wam_cursor|wam_isdlg/*|wam_icon*/; wattrs.is_dlg = true; wattrs.event_masks = -1; wattrs.event_masks = -1; wattrs.cursor = ct_pointer; /*wattrs.icon = icon;*/ pos.width = 600; pos.height = 400; pos.x = GGadgetScale(104)+6; DefaultY(&pos); sv->gw = gw = GDrawCreateTopWindow(NULL,&pos,sv_e_h,&sv->cv_srch,&wattrs); SVSetTitle(sv); if ( plainfont==NULL ) { memset(&rq,0,sizeof(rq)); rq.utf8_family_name = SANS_UI_FAMILIES; rq.point_size = 12; rq.weight = 400; plainfont = GDrawInstanciateFont(NULL,&rq); plainfont = GResourceFindFont("SearchView.Font",plainfont); GDrawDecomposeFont(plainfont, &rq); rq.weight = 700; boldfont = GDrawInstanciateFont(NULL,&rq); boldfont = GResourceFindFont("SearchView.BoldFont",boldfont); } sv->plain = plainfont; sv->bold = boldfont; GDrawFontMetrics(sv->plain,&as,&ds,&ld); sv->fh = as+ds; sv->as = as; SVCharViewInits(sv); memset(&label,0,sizeof(label)); memset(&gcd,0,sizeof(gcd)); memset(&boxes,0,sizeof(boxes)); k=0; label[k].text = (unichar_t *) _("Allow:"); label[k].text_is_1byte = true; gcd[k].gd.label = &label[k]; gcd[k].gd.pos.x = 5; gcd[k].gd.pos.y = GDrawPixelsToPoints(NULL,sv->cv_y+sv->cv_height+8); gcd[k].gd.flags = gg_enabled|gg_visible|gg_utf8_popup; gcd[k].gd.cid = CID_Allow; gcd[k].gd.popup_msg = (unichar_t *) _("Allow a match even if the search pattern has\nto be transformed by a combination of the\nfollowing transformations."); gcd[k].creator = GLabelCreate; allowarray[k] = &gcd[k]; ++k; label[k].text = (unichar_t *) _("Flipping"); label[k].text_is_1byte = true; gcd[k].gd.label = &label[k]; gcd[k].gd.pos.x = 35; gcd[k].gd.pos.y = gcd[0].gd.pos.y-3; gcd[k].gd.flags = gg_enabled|gg_visible|gg_cb_on|gg_utf8_popup; gcd[k].gd.cid = CID_Flipping; gcd[k].gd.popup_msg = (unichar_t *) _("Allow a match even if the search pattern has\nto be transformed by a combination of the\nfollowing transformations."); gcd[k].creator = GCheckBoxCreate; allowarray[k] = &gcd[k]; ++k; label[k].text = (unichar_t *) _("Scaling"); label[k].text_is_1byte = true; gcd[k].gd.label = &label[k]; gcd[k].gd.pos.x = 100; gcd[k].gd.pos.y = gcd[1].gd.pos.y; gcd[k].gd.flags = gg_enabled|gg_visible|gg_utf8_popup; gcd[k].gd.cid = CID_Scaling; gcd[k].gd.popup_msg = (unichar_t *) _("Allow a match even if the search pattern has\nto be transformed by a combination of the\nfollowing transformations."); gcd[k].creator = GCheckBoxCreate; allowarray[k] = &gcd[k]; ++k; label[k].text = (unichar_t *) _("Rotating"); label[k].text_is_1byte = true; gcd[k].gd.label = &label[k]; gcd[k].gd.pos.x = 170; gcd[k].gd.pos.y = gcd[1].gd.pos.y; gcd[k].gd.flags = gg_enabled|gg_visible|gg_utf8_popup; gcd[k].gd.cid = CID_Rotating; gcd[k].gd.popup_msg = (unichar_t *) _("Allow a match even if the search pattern has\nto be transformed by a combination of the\nfollowing transformations."); gcd[k].creator = GCheckBoxCreate; allowarray[k] = &gcd[k]; allowarray[++k] = GCD_Glue; allowarray[5] = NULL; label[k].text = (unichar_t *) _("_Match Fuzziness:"); label[k].text_is_1byte = true; label[k].text_in_resource = true; gcd[k].gd.label = &label[k]; gcd[k].gd.flags = gg_enabled|gg_visible; gcd[k].creator = GLabelCreate; fudgearray[0] = &gcd[k++]; sprintf(fudgebuf,"%g",old_fudge); label[k].text = (unichar_t *) fudgebuf; label[k].text_is_1byte = true; label[k].text_in_resource = true; gcd[k].gd.label = &label[k]; gcd[k].gd.flags = gg_enabled|gg_visible; gcd[k].gd.cid = CID_Fuzzy; gcd[k].creator = GTextFieldCreate; fudgearray[1] = &gcd[k++]; fudgearray[2] = GCD_Glue; fudgearray[3] = NULL; efdo_pos = k; label[k].text = (unichar_t *) _("Endpoints specify minimum length and direction only"); label[k].text_is_1byte = true; gcd[k].gd.label = &label[k]; gcd[k].gd.pos.x = 5; gcd[k].gd.pos.y = gcd[1].gd.pos.y+18; gcd[k].gd.flags = gg_enabled|gg_visible|gg_utf8_popup; gcd[k].gd.cid = CID_Endpoints; gcd[k].gd.popup_msg = (unichar_t *) _( "If the search pattern is a single open contour\n" "then do not match the end points. They merely\n" "specify the direction from which the curve should\n" "move toward the next point (which will be matched),\n" "and the minimum distance between the first matched\n" "point and the one before it. The endpoints of the\n" "replace contour will also only be used for positioning.\n" "\n" "This allows you to match a right angle corner\n" "without needed to specify exactly how long the edges\n" "are which form the right angle."); gcd[k++].creator = GCheckBoxCreate; sel_pos = k; label[k].text = (unichar_t *) _("Search Selected Chars Only"); label[k].text_is_1byte = true; gcd[k].gd.label = &label[k]; gcd[k].gd.pos.x = 5; gcd[k].gd.pos.y = gcd[1].gd.pos.y+18; gcd[k].gd.flags = gg_enabled|gg_visible|gg_utf8_popup; gcd[k].gd.cid = CID_Selected; gcd[k].gd.popup_msg = (unichar_t *) _("Only search characters selected in the fontview.\nNormally we search all characters in the font."); gcd[k++].creator = GCheckBoxCreate; label[k].text = (unichar_t *) _("Find Next"); /* Start with this to allow sufficient space */ label[k].text_is_1byte = true; gcd[k].gd.label = &label[k]; gcd[k].gd.pos.x = 5; gcd[k].gd.pos.y = gcd[sel_pos].gd.pos.y+24; gcd[k].gd.flags = gg_visible|gg_but_default; gcd[k].gd.cid = CID_Find; gcd[k].gd.handle_controlevent = SV_Find; gcd[k].creator = GButtonCreate; butarray[0] = GCD_Glue; butarray[1] = GCD_Glue; butarray[2] = &gcd[k++]; label[k].text = (unichar_t *) _("Find All"); label[k].text_is_1byte = true; gcd[k].gd.label = &label[k]; gcd[k].gd.pos.x = 0; gcd[k].gd.pos.y = gcd[k-1].gd.pos.y+3; gcd[k].gd.flags = gg_visible; gcd[k].gd.cid = CID_FindAll; gcd[k].gd.handle_controlevent = SV_FindAll; gcd[k].creator = GButtonCreate; butarray[3] = GCD_Glue; butarray[4] = &gcd[k++]; label[k].text = (unichar_t *) _("Replace"); label[k].text_is_1byte = true; gcd[k].gd.label = &label[k]; gcd[k].gd.pos.x = 0; gcd[k].gd.pos.y = gcd[k-1].gd.pos.y; gcd[k].gd.flags = gg_visible; gcd[k].gd.cid = CID_Replace; gcd[k].gd.handle_controlevent = SV_RplFind; gcd[k].creator = GButtonCreate; butarray[5] = GCD_Glue; butarray[6] = &gcd[k++]; label[k].text = (unichar_t *) _("Replace All"); label[k].text_is_1byte = true; gcd[k].gd.label = &label[k]; gcd[k].gd.pos.x = 0; gcd[k].gd.pos.y = gcd[k-2].gd.pos.y; gcd[k].gd.flags = gg_visible; gcd[k].gd.cid = CID_ReplaceAll; gcd[k].gd.handle_controlevent = SV_RplAll; gcd[k].creator = GButtonCreate; butarray[7] = GCD_Glue; butarray[8] = &gcd[k++]; label[k].text = (unichar_t *) _("_Cancel"); label[k].text_is_1byte = true; label[k].text_in_resource = true; gcd[k].gd.label = &label[k]; gcd[k].gd.pos.x = 0; gcd[k].gd.pos.y = gcd[k-3].gd.pos.y; gcd[k].gd.flags = gg_enabled|gg_visible|gg_but_cancel; gcd[k].gd.cid = CID_Cancel; gcd[k].gd.handle_controlevent = SV_Cancel; gcd[k].creator = GButtonCreate; butarray[9] = GCD_Glue; butarray[10] = &gcd[k++]; butarray[11] = GCD_Glue; butarray[12] = GCD_Glue; butarray[13] = NULL; boxes[2].gd.flags = gg_enabled|gg_visible; boxes[2].gd.u.boxelements = allowarray; boxes[2].creator = GHBoxCreate; boxes[3].gd.flags = gg_enabled|gg_visible; boxes[3].gd.u.boxelements = fudgearray; boxes[3].creator = GHBoxCreate; halfarray[0] = &boxes[2]; halfarray[1] = &boxes[3]; halfarray[2] = NULL; boxes[4].gd.flags = gg_enabled|gg_visible; boxes[4].gd.u.boxelements = halfarray; boxes[4].creator = GHBoxCreate; boxes[5].gd.flags = gg_enabled|gg_visible; boxes[5].gd.u.boxelements = butarray; boxes[5].creator = GHBoxCreate; varray[0] = GCD_Glue; varray[1] = NULL; varray[2] = &boxes[4]; varray[3] = NULL; varray[4] = &gcd[efdo_pos]; varray[5] = NULL; varray[6] = GCD_Glue; varray[7] = NULL; varray[8] = &gcd[sel_pos]; varray[9] = NULL; varray[10] = &boxes[5]; varray[11]= NULL; varray[12] = NULL; boxes[0].gd.pos.x = boxes[0].gd.pos.y = 2; boxes[0].gd.flags = gg_enabled|gg_visible; boxes[0].gd.u.boxelements = varray; boxes[0].gd.cid = CID_TopBox; boxes[0].creator = GHVGroupCreate; GGadgetsCreate(gw,boxes); GHVBoxSetExpandableRow(boxes[0].ret,0); GHVBoxSetPadding(boxes[2].ret,6,3); GHVBoxSetExpandableCol(boxes[2].ret,gb_expandglue); GHVBoxSetExpandableCol(boxes[3].ret,gb_expandglue); GHVBoxSetExpandableCol(boxes[5].ret,gb_expandglue); GGadgetResize(boxes[0].ret,pos.width,pos.height); GGadgetSetTitle8(GWidgetGetControl(gw,CID_Find),_("Find")); sv->showsfindnext = false; GDrawRequestTimer(gw,1000,1000,NULL); sv->button_height = GDrawPointsToPixels(gw,100); GDrawResize(gw,650,400); /* Force a resize event */ GDrawSetVisible(sv->gw,true); return( sv ); }
static void CpInfoPlace(CharView *cv, GEvent *event) { char buf[100]; int line, which; int width, x, y; GRect size; GPoint pt, pt2; int h,w; GWindowAttrs wattrs; GRect pos; FontRequest rq; int as, ds, ld; SplinePoint *sp; if ( cv->ruler_w==NULL ) { memset(&wattrs,0,sizeof(wattrs)); wattrs.mask = wam_events|wam_cursor|wam_positioned|wam_nodecor|wam_backcol|wam_bordwidth; wattrs.event_masks = (1<<et_expose)|(1<<et_resize)|(1<<et_mousedown); wattrs.cursor = ct_mypointer; wattrs.background_color = 0xe0e0c0; wattrs.nodecoration = 1; wattrs.border_width = 1; pos.x = pos.y = 0; pos.width=pos.height = 20; cv->ruler_w = GWidgetCreateTopWindow(NULL,&pos,cpinfo_e_h,cv,&wattrs); if ( rvfont==NULL ) { memset(&rq,0,sizeof(rq)); rq.utf8_family_name = FIXED_UI_FAMILIES; rq.point_size = -12; rq.weight = 400; rvfont = GDrawInstanciateFont(GDrawGetDisplayOfWindow(cv->ruler_w),&rq); rvfont = GResourceFindFont("CharView.Measure.Font",rvfont); } cv->rfont = rvfont; GDrawFontMetrics(cv->rfont,&as,&ds,&ld); cv->rfh = as+ds; cv->ras = as; } else GDrawRaise(cv->ruler_w); GDrawSetFont(cv->ruler_w,cv->rfont); h = 0; width = 0; for ( which = 0; which<2; ++which ) { for ( line=0; PtInfoText(cv,line,which,buf,sizeof(buf))!=NULL; ++line ) { w = GDrawGetBiText8Width(cv->ruler_w,buf,-1,-1,NULL); if ( w>width ) width = w; h += cv->rfh+1; } h += 4; } if ( PtInfoText(cv,0,-1,buf,sizeof(buf))!=NULL ) { w = GDrawGetBiText8Width(cv->ruler_w,buf,-1,-1,NULL); if ( w>width ) width = w; h += cv->rfh+1; } GDrawGetSize(GDrawGetRoot(NULL),&size); pt.x = event->u.mouse.x; pt.y = event->u.mouse.y; /* Address of cp */ GDrawTranslateCoordinates(cv->v,GDrawGetRoot(NULL),&pt); sp = cv->p.sp; if ( !cv->p.prevcp && !cv->p.nextcp ) sp = cv->active_sp; if ( sp!=NULL ) { x = cv->xoff + rint(sp->me.x*cv->scale); y = -cv->yoff + cv->height - rint(sp->me.y*cv->scale); if ( x>=0 && y>=0 && x<cv->width && y<cv->height ) { pt2.x = x; pt2.y = y; GDrawTranslateCoordinates(cv->v,GDrawGetRoot(NULL),&pt2); } else sp = NULL; } x = pt.x + infowindowdistance; y = pt.y - cv->ras-2; if ( sp!=NULL && x<=pt2.x-4 && x+width>=pt2.x+4 && y<=pt2.y-4 && y+h>=pt2.y+4 ) x = pt2.x + 4; if ( x+width > size.width ) { x = pt.x - width-30; if ( sp!=NULL && x<=pt2.x-4 && x+width>=pt2.x+4 && y<=pt2.y-4 && y+h>=pt2.y+4 ) x = pt2.x - width - 4; if ( x<0 ) { x = pt.x + 10; y = pt.y - h - infowindowdistance; if ( sp!=NULL && x<=pt2.x-4 && x+width>=pt2.x+4 && y<=pt2.y-4 && y+h>=pt2.y+4 ) y = pt2.y - h - 4; if ( y<0 ) y = pt.y+infowindowdistance; /* If this doesn't work we have nowhere else to */ /* try so don't check */ } } if ( y+h > size.height ) y = pt.y - h - cv->ras - 10; GDrawMoveResize(cv->ruler_w,x,y,width+4,h+4); }