static void CreateErrorWindow(void) { GWindowAttrs wattrs; FontRequest rq; GRect pos,size; int as, ds, ld; GWindow gw; GGadgetData gd; extern int _GScrollBar_Width; GDrawGetSize(GDrawGetRoot(NULL),&size); memset(&wattrs,0,sizeof(wattrs)); wattrs.mask = wam_events|wam_cursor|wam_utf8_wtitle|wam_isdlg|wam_positioned; wattrs.event_masks = ~(1<<et_charup); wattrs.is_dlg = true; wattrs.cursor = ct_pointer; wattrs.positioned = true; wattrs.utf8_window_title = _("Warnings"); pos.width = GDrawPointsToPixels(NULL,GGadgetScale(400)); pos.height = GDrawPointsToPixels(NULL,GGadgetScale(100)); pos.x = size.width - pos.width - 10; pos.y = size.height - pos.height - 30; errdata.gw = gw = GDrawCreateTopWindow(NULL,&pos,warnings_e_h,&errdata,&wattrs); memset(&rq,0,sizeof(rq)); rq.utf8_family_name = SANS_UI_FAMILIES; rq.point_size = 10; rq.weight = 400; errdata.font = GDrawInstanciateFont(NULL,&rq); errdata.font = GResourceFindFont("Warnings.Font",errdata.font); GDrawWindowFontMetrics(errdata.gw,errdata.font,&as,&ds,&ld); errdata.as = as; errdata.fh = as+ds; memset(&gd,0,sizeof(gd)); gd.pos.y = 0; gd.pos.height = pos.height; gd.pos.width = GDrawPointsToPixels(gw,_GScrollBar_Width); gd.pos.x = pos.width-gd.pos.width; gd.flags = gg_visible|gg_enabled|gg_pos_in_pixels|gg_sb_vert; errdata.vsb = GScrollBarCreate(gw,&gd,&errdata); pos.width -= gd.pos.width; pos.x = pos.y = 0; wattrs.mask = wam_events|wam_cursor; errdata.v = GWidgetCreateSubWindow(gw,&pos,warningsv_e_h,&errdata,&wattrs); GDrawSetVisible(errdata.v,true); errdata.linecnt = pos.height/errdata.fh; errdata.start_l = errdata.end_l = -1; }
void JustifyDlg(SplineFont *sf) { Jstf_Dlg jd; GRect pos; GWindow gw; GWindowAttrs wattrs; GGadgetCreateData gcd[4], boxes[3]; GGadgetCreateData *varray[6], *harray3[8]; GTextInfo label[4]; struct matrixinit mi; int i,j,k; LookupUIInit(); JustUIInit(); memset(&jd,0,sizeof(jd)); jd.sf = sf; memset(&wattrs,0,sizeof(wattrs)); wattrs.mask = wam_events|wam_cursor|wam_utf8_wtitle|wam_undercursor|wam_isdlg|wam_restrict; wattrs.event_masks = ~(1<<et_charup); wattrs.is_dlg = true; wattrs.restrict_input_to_me = 1; wattrs.undercursor = 1; wattrs.cursor = ct_pointer; wattrs.utf8_window_title = _("Justified Scripts"); pos.x = pos.y = 0; pos.width =GDrawPointsToPixels(NULL,GGadgetScale(268)); pos.height = GDrawPointsToPixels(NULL,375); jd.gw = gw = GDrawCreateTopWindow(NULL,&pos,jscripts_e_h,&jd,&wattrs); JScriptMatrixInit(&mi,sf->justify); memset(&gcd,0,sizeof(gcd)); memset(&boxes,0,sizeof(boxes)); memset(&label,0,sizeof(label)); k=j=0; gcd[k].gd.pos.x = 10; gcd[k].gd.pos.y = gcd[1].gd.pos.y+14; gcd[k].gd.flags = gg_enabled | gg_visible | gg_utf8_popup; gcd[k].gd.cid = CID_Scripts; gcd[k].gd.u.matrix = &mi; gcd[k].gd.popup_msg = (unichar_t *) _( "A list of scripts with special justification needs"); gcd[k].creator = GMatrixEditCreate; varray[j++] = &gcd[k++]; varray[j++] = NULL; gcd[k].gd.pos.x = 30-3; gcd[k].gd.pos.width = -1; gcd[k].gd.pos.height = 0; gcd[k].gd.flags = gg_visible | gg_enabled | gg_but_default; label[k].text = (unichar_t *) _("_OK"); label[k].text_is_1byte = true; label[k].text_in_resource = true; gcd[k].gd.label = &label[k]; gcd[k].gd.handle_controlevent = JSTF_Script_OK; gcd[k].gd.cid = CID_OK; gcd[k++].creator = GButtonCreate; gcd[k].gd.pos.x = -30; gcd[k].gd.pos.width = -1; gcd[k].gd.pos.height = 0; gcd[k].gd.flags = gg_visible | gg_enabled | gg_but_cancel; 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.handle_controlevent = Justify_Cancel; gcd[k].gd.cid = CID_Cancel; gcd[k++].creator = GButtonCreate; harray3[0] = harray3[2] = harray3[3] = harray3[4] = harray3[6] = GCD_Glue; harray3[7] = NULL; harray3[1] = &gcd[k-2]; harray3[5] = &gcd[k-1]; boxes[0].gd.flags = gg_enabled|gg_visible; boxes[0].gd.u.boxelements = harray3; boxes[0].creator = GHBoxCreate; varray[j++] = &boxes[0]; varray[j++] = NULL; varray[j] = NULL; boxes[1].gd.pos.x = boxes[1].gd.pos.y = 2; boxes[1].gd.flags = gg_enabled|gg_visible; boxes[1].gd.u.boxelements = varray; boxes[1].creator = GHVGroupCreate; GGadgetsCreate(gw,boxes+1); for ( i=0; i<mi.initial_row_cnt; ++i ) { free( mi.matrix_data[2*i+0].u.md_str ); } free( mi.matrix_data ); GMatrixEditSetNewText(gcd[0].ret,S_("Script|New")); GMatrixEditSetUpDownVisible(gcd[0].ret,true); GMatrixEditShowColumn(gcd[0].ret,3,false); GHVBoxSetExpandableCol(boxes[0].ret,gb_expandgluesame); GHVBoxFitWindow(boxes[1].ret); GDrawSetVisible(gw,true); while ( !jd.done ) GDrawProcessOneEvent(NULL); GDrawDestroyWindow(gw); }
static char *JSTF_Langs(GGadget *g, int r, int c) { int rows, i, k, j; struct matrix_data *strings = GMatrixEditGet(g, &rows); int cols = GMatrixEditGetColCnt(g); Jstf_Dlg *jd = GDrawGetUserData(GGadgetGetWindow(g)); GRect pos; GWindow gw; GWindowAttrs wattrs; GGadgetCreateData gcd[4], boxes[3]; GGadgetCreateData *varray[6], *harray3[8]; GTextInfo label[4]; struct matrixinit mi; jd->ldone = false; jd->here = (struct jstf_lang **) &strings[cols*r+3].u.md_addr; memset(&wattrs,0,sizeof(wattrs)); wattrs.mask = wam_events|wam_cursor|wam_utf8_wtitle|wam_undercursor|wam_isdlg|wam_restrict; wattrs.event_masks = ~(1<<et_charup); wattrs.is_dlg = true; wattrs.restrict_input_to_me = 1; wattrs.undercursor = 1; wattrs.cursor = ct_pointer; wattrs.utf8_window_title = _("Justified Languages"); pos.x = pos.y = 0; pos.width =GDrawPointsToPixels(NULL,GGadgetScale(268)); pos.height = GDrawPointsToPixels(NULL,375); jd->lgw = gw = GDrawCreateTopWindow(NULL,&pos,langs_e_h,jd,&wattrs); memset(&gcd,0,sizeof(gcd)); memset(&boxes,0,sizeof(boxes)); memset(&label,0,sizeof(label)); k=j=0; JLanguageMatrixInit(&mi,*jd->here); gcd[k].gd.pos.x = 10; gcd[k].gd.pos.y = gcd[1].gd.pos.y+14; gcd[k].gd.pos.width = 900; gcd[k].gd.flags = gg_enabled | gg_visible | gg_utf8_popup; gcd[k].gd.cid = CID_Languages; gcd[k].gd.u.matrix = &mi; gcd[k].gd.popup_msg = (unichar_t *) _( "A list of languages and the lookups turned on and off\n" "for each to accomplish justification. A language may\n" "appear more than once, in which case second (or third,\n" "etc.) will be tried if the first fails."); gcd[k].creator = GMatrixEditCreate; varray[j++] = &gcd[k++]; varray[j++] = NULL; gcd[k].gd.pos.x = 30-3; gcd[k].gd.pos.width = -1; gcd[k].gd.pos.height = 0; gcd[k].gd.flags = gg_visible | gg_enabled | gg_but_default; label[k].text = (unichar_t *) _("_OK"); label[k].text_is_1byte = true; label[k].text_in_resource = true; gcd[k].gd.label = &label[k]; gcd[k].gd.handle_controlevent = JSTF_Language_OK; gcd[k].gd.cid = CID_OK; gcd[k++].creator = GButtonCreate; gcd[k].gd.pos.x = -30; gcd[k].gd.pos.width = -1; gcd[k].gd.pos.height = 0; gcd[k].gd.flags = gg_visible | gg_enabled | gg_but_cancel; 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.handle_controlevent = JSTF_Language_Cancel; gcd[k].gd.cid = CID_Cancel; gcd[k++].creator = GButtonCreate; harray3[0] = harray3[2] = harray3[3] = harray3[4] = harray3[6] = GCD_Glue; harray3[7] = NULL; harray3[1] = &gcd[k-2]; harray3[5] = &gcd[k-1]; boxes[0].gd.flags = gg_enabled|gg_visible; boxes[0].gd.u.boxelements = harray3; boxes[0].creator = GHBoxCreate; varray[j++] = &boxes[0]; varray[j++] = NULL; varray[j] = NULL; boxes[1].gd.pos.x = boxes[1].gd.pos.y = 2; boxes[1].gd.flags = gg_enabled|gg_visible; boxes[1].gd.u.boxelements = varray; boxes[1].creator = GHVGroupCreate; GGadgetsCreate(gw,boxes+1); for ( i=0; i<mi.initial_row_cnt; ++i ) { free( mi.matrix_data[2*i+0].u.md_str ); } free( mi.matrix_data ); GMatrixEditSetNewText(gcd[0].ret,S_("Language|New")); GMatrixEditSetUpDownVisible(gcd[0].ret,true); GHVBoxSetExpandableCol(boxes[0].ret,gb_expandgluesame); GHVBoxFitWindow(boxes[1].ret); GDrawSetVisible(gw,true); while ( !jd->ldone ) GDrawProcessOneEvent(NULL); GDrawDestroyWindow(gw); return( NULL ); }
void FVAutoWidth2(FontView *fv) { struct widthinfo wi; GWindow gw; GWindowAttrs wattrs; GRect pos; GGadgetCreateData *harray1[4], *harray2[6], *harray3[6], *barray[9], *varray[14]; GGadgetCreateData gcd[29], boxes[6]; GTextInfo label[29]; int i,v; char sepbuf[20], minbuf[20], maxbuf[20], hbuf[20], lbuf[20]; SplineFont *sf = fv->b.sf; double emsize = (sf->ascent + sf->descent); memset(&wi,0,sizeof(wi)); wi.fv = fv; wi.sf = sf; memset(&wattrs,0,sizeof(wattrs)); wattrs.mask = wam_events|wam_cursor|wam_utf8_wtitle|wam_undercursor|wam_restrict|wam_isdlg; wattrs.event_masks = ~(1<<et_charup); wattrs.restrict_input_to_me = 1; wattrs.is_dlg = 1; wattrs.undercursor = 1; wattrs.cursor = ct_pointer; wattrs.utf8_window_title = _("Auto Width"); pos.x = pos.y = 0; pos.width = GGadgetScale(GDrawPointsToPixels(NULL,200)); pos.height = GDrawPointsToPixels(NULL,180); wi.gw = gw = GDrawCreateTopWindow(NULL,&pos,AW2_e_h,&wi,&wattrs); memset(&label,0,sizeof(label)); memset(&boxes,0,sizeof(boxes)); memset(&gcd,0,sizeof(gcd)); i = v = 0; label[i].text = (unichar_t *) _( "FontForge will attempt to adjust the left and right\n" "sidebearings of the selected glyphs so that the average\n" "separation between glyphs in a script will be the\n" "specified amount. You may also specify a minimum and\n" "maximum value for each glyph's sidebearings." ); label[i].text_is_1byte = true; gcd[i].gd.label = &label[i]; gcd[i].gd.pos.x = 5; gcd[i].gd.pos.y = 6; gcd[i].gd.flags = gg_visible | gg_enabled; gcd[i++].creator = GLabelCreate; varray[v++] = &gcd[i-1]; varray[v++] = NULL; label[i].text = (unichar_t *) _( "_Separation:" ); label[i].text_is_1byte = true; label[i].text_in_resource = true; gcd[i].gd.label = &label[i]; gcd[i].gd.pos.x = 5; gcd[i].gd.pos.y = 6; gcd[i].gd.flags = gg_visible | gg_enabled; gcd[i++].creator = GLabelCreate; harray1[0] = &gcd[i-1]; if ( sf->width_separation>0 ) sprintf( sepbuf, "%d", sf->width_separation ); else sprintf( sepbuf, "%d", (int) rint( width_separation * emsize / width_last_em_size )); label[i].text = (unichar_t *) sepbuf; label[i].text_is_1byte = true; gcd[i].gd.label = &label[i]; gcd[i].gd.pos.x = 5; gcd[i].gd.pos.y = 6; gcd[i].gd.flags = gg_visible | gg_enabled; gcd[i].gd.cid = CID_Separation; gcd[i++].creator = GTextFieldCreate; harray1[1] = &gcd[i-1]; harray1[2] = GCD_Glue; harray1[3] = NULL; boxes[2].gd.flags = gg_enabled|gg_visible; boxes[2].gd.u.boxelements = harray1; boxes[2].creator = GHBoxCreate; varray[v++] = &boxes[2]; varray[v++] = NULL; label[i].text = (unichar_t *) _( "_Min:" ); label[i].text_is_1byte = true; label[i].text_in_resource = true; gcd[i].gd.label = &label[i]; gcd[i].gd.pos.x = 5; gcd[i].gd.pos.y = 6; gcd[i].gd.flags = gg_visible | gg_enabled; gcd[i++].creator = GLabelCreate; harray2[0] = &gcd[i-1]; #define PI 3.1415926535897932 if ( sf->italicangle<0 ) sprintf( minbuf, "%d", (int) rint( sf->descent*tan(sf->italicangle*PI/180 )) ); else if ( sf->italicangle>0 ) sprintf( minbuf, "%d", (int) -rint( sf->ascent*tan(sf->italicangle*PI/180 )) ); else sprintf( minbuf, "%d", (int) rint( width_min_side_bearing * emsize / width_last_em_size )); label[i].text = (unichar_t *) minbuf; label[i].text_is_1byte = true; gcd[i].gd.label = &label[i]; gcd[i].gd.pos.x = 5; gcd[i].gd.pos.y = 6; gcd[i].gd.flags = gg_visible | gg_enabled; gcd[i].gd.cid = CID_MinSep; gcd[i++].creator = GTextFieldCreate; harray2[1] = &gcd[i-1]; label[i].text = (unichar_t *) _( "Ma_x:" ); label[i].text_is_1byte = true; label[i].text_in_resource = true; gcd[i].gd.label = &label[i]; gcd[i].gd.pos.x = 5; gcd[i].gd.pos.y = 6; gcd[i].gd.flags = gg_visible | gg_enabled; gcd[i++].creator = GLabelCreate; harray2[2] = &gcd[i-1]; sprintf( maxbuf, "%d", (int) rint( width_max_side_bearing * emsize / width_last_em_size )); label[i].text = (unichar_t *) maxbuf; label[i].text_is_1byte = true; gcd[i].gd.label = &label[i]; gcd[i].gd.pos.x = 5; gcd[i].gd.pos.y = 6; gcd[i].gd.flags = gg_visible | gg_enabled; gcd[i].gd.cid = CID_MaxSep; gcd[i++].creator = GTextFieldCreate; harray2[3] = &gcd[i-1]; harray2[4] = GCD_Glue; harray2[5] = NULL; boxes[3].gd.flags = gg_enabled|gg_visible; boxes[3].gd.u.boxelements = harray2; boxes[3].creator = GHBoxCreate; varray[v++] = &boxes[3]; varray[v++] = NULL; label[i].text = (unichar_t *) _( "_Height:" ); label[i].text_is_1byte = true; label[i].text_in_resource = true; gcd[i].gd.label = &label[i]; gcd[i].gd.pos.x = 5; gcd[i].gd.pos.y = 6; gcd[i].gd.flags = /* gg_visible |*/ gg_enabled; gcd[i++].creator = GLabelCreate; harray3[0] = &gcd[i-1]; sprintf( hbuf, "%d", (int) rint( width_chunk_height * emsize / width_last_em_size )); label[i].text = (unichar_t *) hbuf; label[i].text_is_1byte = true; gcd[i].gd.label = &label[i]; gcd[i].gd.pos.x = 5; gcd[i].gd.pos.y = 6; gcd[i].gd.flags = /* gg_visible |*/ gg_enabled; gcd[i].gd.cid = CID_Height; gcd[i++].creator = GTextFieldCreate; harray3[1] = &gcd[i-1]; label[i].text = (unichar_t *) _( "_Loops:" ); label[i].text_is_1byte = true; label[i].text_in_resource = true; gcd[i].gd.label = &label[i]; gcd[i].gd.pos.x = 5; gcd[i].gd.pos.y = 6; gcd[i].gd.flags = /* gg_visible |*/ gg_enabled; gcd[i++].creator = GLabelCreate; harray3[2] = &gcd[i-1]; sprintf( lbuf, "%d", (int) rint( width_loop_cnt * emsize / width_last_em_size )); label[i].text = (unichar_t *) lbuf; label[i].text_is_1byte = true; gcd[i].gd.label = &label[i]; gcd[i].gd.pos.x = 5; gcd[i].gd.pos.y = 6; gcd[i].gd.flags = /* gg_visible |*/ gg_enabled; gcd[i].gd.cid = CID_Loop; gcd[i++].creator = GTextFieldCreate; harray3[3] = &gcd[i-1]; harray3[4] = GCD_Glue; harray3[5] = NULL; boxes[4].gd.flags = gg_enabled/*|gg_visible*/; boxes[4].gd.u.boxelements = harray3; boxes[4].creator = GHBoxCreate; varray[v++] = &boxes[4]; varray[v++] = NULL; gcd[i].gd.flags = gg_visible | gg_enabled | gg_but_default; label[i].text = (unichar_t *) _("_OK"); label[i].text_is_1byte = true; label[i].text_in_resource = true; gcd[i].gd.label = &label[i]; gcd[i].gd.handle_controlevent = AW2_OK; gcd[i++].creator = GButtonCreate; barray[0] = GCD_Glue; barray[1] = &gcd[i-1]; barray[2] = GCD_Glue; gcd[i].gd.flags = gg_visible | gg_enabled | gg_but_cancel; label[i].text = (unichar_t *) _("_Cancel"); label[i].text_is_1byte = true; label[i].text_in_resource = true; gcd[i].gd.label = &label[i]; gcd[i].gd.handle_controlevent = AW2_Cancel; gcd[i++].creator = GButtonCreate; barray[3] = barray[4] = GCD_Glue; barray[5] = &gcd[i-1]; barray[6] = GCD_Glue; barray[7] = NULL; boxes[5].gd.flags = gg_enabled|gg_visible; boxes[5].gd.u.boxelements = barray; boxes[5].creator = GHBoxCreate; varray[v++] = GCD_Glue; varray[v++] = NULL; varray[v++] = &boxes[5]; varray[v++] = NULL; varray[v++] = NULL; boxes[0].gd.pos.x = gcd[i].gd.pos.y = 2; boxes[0].gd.flags = gg_enabled|gg_visible; boxes[0].gd.u.boxelements = varray; boxes[0].creator = GHVGroupCreate; GGadgetsCreate(gw,boxes); GHVBoxSetExpandableRow(boxes[0].ret,gb_expandglue); GHVBoxSetExpandableCol(boxes[2].ret,gb_expandglue); GHVBoxSetExpandableCol(boxes[3].ret,gb_expandglue); GHVBoxSetExpandableCol(boxes[4].ret,gb_expandglue); GHVBoxSetExpandableCol(boxes[5].ret,gb_expandgluesame); GHVBoxFitWindow(boxes[0].ret); GWidgetIndicateFocusGadget(gcd[2].ret); GTextFieldSelect(gcd[2].ret,0,-1); GWidgetHidePalettes(); GDrawSetVisible(gw,true); while ( !wi.done ) GDrawProcessOneEvent(NULL); GDrawDestroyWindow(gw); }
void SFBdfProperties(SplineFont *sf, EncMap *map, BDFFont *thisone) { struct bdf_dlg bd; int i; BDFFont *bdf; GTextInfo *ti; char buffer[40]; char title[130]; GRect pos, subpos; GWindow gw; GWindowAttrs wattrs; GGadgetCreateData gcd[10]; GTextInfo label[9]; FontRequest rq; static GFont *font = NULL; extern int _GScrollBar_Width; int sbwidth; static unichar_t sans[] = { 'h','e','l','v','e','t','i','c','a',',','c','l','e','a','r','l','y','u',',','u','n','i','f','o','n','t', '\0' }; static GBox small = { 0 }; GGadgetData gd; /* I don't use a MatrixEdit here because I want to be able to display */ /* non-standard properties. And a MatrixEdit can only disply things in */ /* its pull-down list */ memset(&bd,0,sizeof(bd)); bd.map = map; bd.sf = sf; for ( bdf = sf->bitmaps, i=0; bdf!=NULL; bdf=bdf->next, ++i ); if ( i==0 ) return; bd.fcnt = i; bd.fonts = gcalloc(i,sizeof(struct bdf_dlg_font)); bd.cur = &bd.fonts[0]; for ( bdf = sf->bitmaps, i=0; bdf!=NULL; bdf=bdf->next, ++i ) { bd.fonts[i].bdf = bdf; bd.fonts[i].old_prop_cnt = bdf->prop_cnt; bd.fonts[i].old_props = BdfPropsCopy(bdf->props,bdf->prop_cnt); bd.fonts[i].sel_prop = -1; bdf->prop_max = bdf->prop_cnt; if ( bdf==thisone ) bd.cur = &bd.fonts[i]; } ti = gcalloc((i+1),sizeof(GTextInfo)); for ( bdf = sf->bitmaps, i=0; bdf!=NULL; bdf=bdf->next, ++i ) { if ( bdf->clut==NULL ) sprintf( buffer, "%d", bdf->pixelsize ); else sprintf( buffer, "%d@%d", bdf->pixelsize, BDFDepth(bdf)); ti[i].text = (unichar_t *) copy(buffer); ti[i].text_is_1byte = true; } ti[bd.cur-bd.fonts].selected = true; memset(&wattrs,0,sizeof(wattrs)); wattrs.mask = wam_events|wam_cursor|wam_utf8_wtitle|wam_undercursor|wam_isdlg|wam_restrict; wattrs.event_masks = ~(1<<et_charup); wattrs.is_dlg = true; wattrs.restrict_input_to_me = 1; wattrs.undercursor = 1; wattrs.cursor = ct_pointer; snprintf(title,sizeof(title),_("Strike Information for %.90s"), sf->fontname); wattrs.utf8_window_title = title; pos.x = pos.y = 0; pos.width = GDrawPointsToPixels(NULL,GGadgetScale(268)); pos.height = GDrawPointsToPixels(NULL,375); bd.gw = gw = GDrawCreateTopWindow(NULL,&pos,bdfp_e_h,&bd,&wattrs); sbwidth = GDrawPointsToPixels(bd.gw,_GScrollBar_Width); subpos.x = 0; subpos.y = GDrawPointsToPixels(NULL,28); subpos.width = pos.width-sbwidth; subpos.height = pos.height - subpos.y - GDrawPointsToPixels(NULL,70); wattrs.mask = wam_events; bd.v = GWidgetCreateSubWindow(gw,&subpos,bdfpv_e_h,&bd,&wattrs); bd.vwidth = subpos.width; bd.vheight = subpos.height; bd.width = pos.width; bd.height = pos.height; bd.value_x = GDrawPointsToPixels(bd.gw,135); if ( font==NULL ) { memset(&rq,0,sizeof(rq)); rq.family_name = sans; rq.point_size = 10; rq.weight = 400; font = GDrawInstanciateFont(GDrawGetDisplayOfWindow(gw),&rq); font = GResourceFindFont("BDFProperties.Font",font); } bd.font = font; { int as, ds, ld; GDrawFontMetrics(bd.font,&as,&ds,&ld); bd.as = as; bd.fh = as+ds; } memset(gcd,0,sizeof(gcd)); memset(label,0,sizeof(label)); i=0; gcd[i].gd.pos.x = 10; gcd[i].gd.pos.y = 3; gcd[i].gd.flags = gg_visible | gg_enabled; gcd[i].gd.u.list = ti; gcd[i].gd.handle_controlevent = BdfP_ChangeBDF; gcd[i++].creator = GListButtonCreate; gcd[i].gd.pos.x = bd.vwidth; gcd[i].gd.pos.y = subpos.y-1; gcd[i].gd.pos.width = sbwidth; gcd[i].gd.pos.height = subpos.height+2; gcd[i].gd.flags = gg_visible | gg_enabled | gg_sb_vert | gg_pos_in_pixels; gcd[i].gd.handle_controlevent = _BdfP_VScroll; gcd[i++].creator = GScrollBarCreate; label[i].text = (unichar_t *) _("Delete"); label[i].text_is_1byte = true; gcd[i].gd.label = &label[i]; gcd[i].gd.pos.x = 4; gcd[i].gd.pos.y = GDrawPixelsToPoints(gw,subpos.y+subpos.height)+6; gcd[i].gd.flags = gg_visible | gg_enabled ; gcd[i].gd.handle_controlevent = BdfP_DeleteCurrent; gcd[i].gd.cid = CID_Delete; gcd[i++].creator = GButtonCreate; label[i].text = (unichar_t *) _("Default All"); label[i].text_is_1byte = true; gcd[i].gd.label = &label[i]; gcd[i].gd.pos.x = 80; gcd[i].gd.pos.y = gcd[i-1].gd.pos.y; gcd[i].gd.flags = gg_visible | gg_enabled ; gcd[i].gd.handle_controlevent = BdfP_DefaultAll; gcd[i].gd.cid = CID_DefAll; gcd[i++].creator = GButtonCreate; label[i].text = (unichar_t *) _("Default This"); label[i].text_is_1byte = true; gcd[i].gd.label = &label[i]; gcd[i].gd.pos.y = gcd[i-1].gd.pos.y; gcd[i].gd.flags = gg_visible | gg_enabled ; gcd[i].gd.handle_controlevent = BdfP_DefaultCurrent; gcd[i].gd.cid = CID_DefCur; gcd[i++].creator = GButtonCreate; /* I want the 2 pronged arrow, but gdraw can't find a nice one */ /* label[i].text = (unichar_t *) "⇑"; *//* Up Arrow */ label[i].text = (unichar_t *) "↑"; /* Up Arrow */ label[i].text_is_1byte = true; gcd[i].gd.label = &label[i]; gcd[i].gd.pos.y = gcd[i-1].gd.pos.y; gcd[i].gd.flags = gg_visible | gg_enabled ; gcd[i].gd.handle_controlevent = BdfP_Up; gcd[i].gd.cid = CID_Up; gcd[i++].creator = GButtonCreate; /* I want the 2 pronged arrow, but gdraw can't find a nice one */ /* label[i].text = (unichar_t *) "⇓"; *//* Down Arrow */ label[i].text = (unichar_t *) "↓"; /* Down Arrow */ label[i].text_is_1byte = true; gcd[i].gd.label = &label[i]; gcd[i].gd.pos.y = gcd[i-1].gd.pos.y; gcd[i].gd.flags = gg_visible | gg_enabled ; gcd[i].gd.handle_controlevent = BdfP_Down; gcd[i].gd.cid = CID_Down; gcd[i++].creator = GButtonCreate; gcd[i].gd.pos.x = 30-3; gcd[i].gd.pos.y = GDrawPixelsToPoints(NULL,pos.height)-32-3; gcd[i].gd.pos.width = -1; gcd[i].gd.pos.height = 0; gcd[i].gd.flags = gg_visible | gg_enabled | gg_but_default; label[i].text = (unichar_t *) _("_OK"); label[i].text_is_1byte = true; label[i].text_in_resource = true; gcd[i].gd.label = &label[i]; gcd[i].gd.handle_controlevent = BdfP_OK; gcd[i].gd.cid = CID_OK; gcd[i++].creator = GButtonCreate; gcd[i].gd.pos.x = -30; gcd[i].gd.pos.y = gcd[i-1].gd.pos.y+3; gcd[i].gd.pos.width = -1; gcd[i].gd.pos.height = 0; gcd[i].gd.flags = gg_visible | gg_enabled | gg_but_cancel; label[i].text = (unichar_t *) _("_Cancel"); label[i].text_is_1byte = true; label[i].text_in_resource = true; gcd[i].gd.label = &label[i]; gcd[i].gd.handle_controlevent = BdfP_Cancel; gcd[i].gd.cid = CID_Cancel; gcd[i++].creator = GButtonCreate; GGadgetsCreate(gw,gcd); GTextInfoListFree(gcd[0].gd.u.list); bd.vsb = gcd[1].ret; small.main_background = small.main_foreground = COLOR_DEFAULT; small.main_foreground = 0x0000ff; memset(&gd,'\0',sizeof(gd)); memset(&label[0],'\0',sizeof(label[0])); label[0].text = (unichar_t *) "\0\0\0\0"; label[0].font = bd.font; gd.pos.height = bd.fh; gd.pos.width = bd.vwidth-bd.value_x; gd.label = &label[0]; gd.box = &small; gd.flags = gg_enabled | gg_pos_in_pixels | gg_dontcopybox | gg_text_xim; bd.tf = GTextFieldCreate(bd.v,&gd,&bd); bd.press_pos = -1; BdfP_EnableButtons(&bd); BdfP_RefigureScrollbar(&bd); GDrawSetVisible(bd.v,true); GDrawSetVisible(gw,true); while ( !bd.done ) GDrawProcessOneEvent(NULL); GDrawDestroyWindow(gw); }
static void FilterDlg(void) { static struct col_init cols[] = { { me_string, NULL, NULL, NULL, N_("Name") }, { me_string, NULL, NULL, NULL, N_("Filter") } }; static int inited = false; static struct matrixinit mi = { 2, cols, 0, NULL, NULL, filter_candelete, NULL, NULL, NULL, NULL }; struct matrix_data *md; int k, cnt, i, ptwidth; GGadgetCreateData gcd[3], boxes[3], *varray[7], *harray[7]; GTextInfo label[3]; GRect pos; GWindow gw; GWindowAttrs wattrs; struct filter_d d; if ( !inited ) { inited = true; cols[0].title = _(cols[0].title); cols[1].title = _(cols[1].title); } for ( k=0; k<2; ++k ) { cnt = 0; for ( i=0; def_font_filters[i].name!=NULL; ++i ) { if ( *(char *) def_font_filters[i].name != '-' ) { if ( k ) { md[2*cnt].u.md_str = copy(_(def_font_filters[i].name)); md[2*cnt].frozen = true; md[2*cnt+1].u.md_str = copy(def_font_filters[i].filter); md[2*cnt+1].frozen = true; } ++cnt; } } if ( user_font_filters!=NULL ) { for ( i=0; user_font_filters[i].name!=NULL; ++i ) { if ( *(char *) user_font_filters[i].name != '-' ) { if ( k ) { md[2*cnt].u.md_str = copy(user_font_filters[i].name); md[2*cnt].frozen = false; md[2*cnt+1].u.md_str = copy(user_font_filters[i].filter); md[2*cnt+1].frozen = false; } ++cnt; } } } if ( !k ) md = calloc(2*cnt,sizeof(struct matrix_data)); } mi.initial_row_cnt = cnt; mi.matrix_data = md; memset(&d,'\0',sizeof(d)); memset(&wattrs,0,sizeof(wattrs)); wattrs.mask = wam_events|wam_cursor|wam_utf8_wtitle|wam_undercursor|wam_restrict|wam_isdlg; wattrs.event_masks = ~(1<<et_charup); wattrs.restrict_input_to_me = 1; wattrs.is_dlg = true; wattrs.undercursor = 1; wattrs.cursor = ct_pointer; wattrs.utf8_window_title = _("Edit Font Filters"); pos.x = pos.y = 0; ptwidth = 2*GIntGetResource(_NUM_Buttonsize)+GGadgetScale(60); pos.width =GDrawPointsToPixels(NULL,ptwidth); pos.height = GDrawPointsToPixels(NULL,90); gw = GDrawCreateTopWindow(NULL,&pos,filter_e_h,&d,&wattrs); memset(&label,0,sizeof(label)); memset(&gcd,0,sizeof(gcd)); memset(&boxes,0,sizeof(boxes)); gcd[0].gd.pos.x = 10; gcd[0].gd.pos.y = 6; gcd[0].gd.pos.width = 300; gcd[0].gd.pos.height = 200; gcd[0].gd.flags = gg_visible | gg_enabled; gcd[0].creator = GMatrixEditCreate; gcd[0].gd.u.matrix = &mi; varray[0] = &gcd[0]; varray[1] = NULL; gcd[1].gd.pos.x = 20-3; gcd[1].gd.pos.y = 90-35-3; gcd[1].gd.pos.width = -1; gcd[1].gd.pos.height = 0; gcd[1].gd.flags = gg_visible | gg_enabled | gg_but_default; label[1].text = (unichar_t *) _("_OK"); label[1].text_is_1byte = true; label[1].text_in_resource = true; gcd[1].gd.label = &label[1]; gcd[1].gd.handle_controlevent = Filter_OK; gcd[1].creator = GButtonCreate; harray[0] = GCD_Glue; harray[1] = &gcd[1]; harray[2] = GCD_Glue; gcd[2].gd.pos.x = -20; gcd[2].gd.pos.y = 90-35; gcd[2].gd.pos.width = -1; gcd[2].gd.pos.height = 0; gcd[2].gd.flags = gg_visible | gg_enabled | gg_but_cancel; label[2].text = (unichar_t *) _("_Cancel"); label[2].text_is_1byte = true; label[2].text_in_resource = true; gcd[2].gd.label = &label[2]; gcd[2].gd.handle_controlevent = Filter_Cancel; gcd[2].creator = GButtonCreate; harray[3] = GCD_Glue; harray[4] = &gcd[2]; harray[5] = GCD_Glue; harray[6] = NULL; varray[2] = &boxes[2]; varray[3] = NULL; varray[4] = 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].creator = GHVGroupCreate; boxes[2].gd.flags = gg_enabled|gg_visible; boxes[2].gd.u.boxelements = harray; boxes[2].creator = GHBoxCreate; GGadgetsCreate(gw,boxes); GHVBoxSetExpandableRow(boxes[0].ret,0); GHVBoxSetExpandableCol(boxes[2].ret,gb_expandgluesame); GHVBoxFitWindow(boxes[0].ret); GMatrixEditSetNewText(gcd[0].ret,S_("Filter|New")); d.gme = gcd[0].ret; GDrawSetVisible(gw,true); while ( !d.done ) GDrawProcessOneEvent(NULL); GDrawDestroyWindow(gw); for ( i=0; i<cnt; ++i ) { free(md[2*i].u.md_str); free(md[2*i+1].u.md_str); } free(md); }
static uint32_t * GWidgetOpenFileWPath (const uint32_t *title, const uint32_t *defaultfile, const uint32_t *initial_filter, char **mimetypes, GFileChooserFilterType filter, char **path) { GRect pos; GWindow gw; GWindowAttrs wattrs; GGadgetCreateData gcd[7], boxes[3], *varray[5], *harray[8]; GTextInfo label[4]; struct gfc_data d; int bs = GIntGetResource (_NUM_Buttonsize), bsbigger, totwid; GProgressPauseTimer (); memset (&wattrs, 0, sizeof (wattrs)); wattrs.mask = wam_events | wam_cursor | wam_wtitle | wam_undercursor | wam_restrict | wam_isdlg; wattrs.event_masks = ~(1 << et_charup); wattrs.restrict_input_to_me = 1; wattrs.undercursor = 1; wattrs.is_dlg = 1; wattrs.cursor = ct_pointer; wattrs.window_title = (uint32_t *) title; pos.x = pos.y = 0; totwid = GGadgetScale (223); bsbigger = 3 * bs + 4 * 14 > totwid; totwid = bsbigger ? 3 * bs + 4 * 12 : totwid; pos.width = GDrawPointsToPixels (NULL, totwid); pos.height = GDrawPointsToPixels (NULL, 223); gw = GDrawCreateTopWindow (NULL, &pos, e_h, &d, &wattrs); memset (&label, 0, sizeof (label)); memset (&gcd, 0, sizeof (gcd)); memset (&boxes, 0, sizeof (boxes)); gcd[0].gd.pos.x = 12; gcd[0].gd.pos.y = 6; gcd[0].gd.pos.width = 223 - 24; gcd[0].gd.pos.height = 180; gcd[0].gd.flags = gg_visible | gg_enabled; gcd[0].creator = GFileChooserCreate; varray[0] = &gcd[0]; varray[1] = NULL; gcd[1].gd.pos.x = 12; gcd[1].gd.pos.y = 192 - 3; gcd[1].gd.pos.width = -1; gcd[1].gd.flags = gg_visible | gg_enabled | gg_but_default; label[1].text = (uint32_t *) _("_OK"); label[1].text_is_1byte = true; label[1].text_has_mnemonic = true; gcd[1].gd.label = &label[1]; gcd[1].gd.handle_controlevent = GFD_Ok; gcd[1].creator = GButtonCreate; harray[0] = GCD_Glue; harray[1] = &gcd[1]; gcd[2].gd.pos.x = (totwid - bs) * 100 / GIntGetResource (_NUM_ScaleFactor) / 2; gcd[2].gd.pos.y = gcd[1].gd.pos.y + 3; gcd[2].gd.pos.width = -1; gcd[2].gd.flags = gg_visible | gg_enabled; label[2].text = (uint32_t *) _("_Filter"); label[2].text_is_1byte = true; label[2].text_has_mnemonic = true; gcd[2].gd.label = &label[2]; gcd[2].gd.handle_controlevent = GFileChooserFilterEh; gcd[2].creator = GButtonCreate; harray[2] = GCD_Glue; harray[3] = &gcd[2]; gcd[3].gd.pos.x = -gcd[1].gd.pos.x; gcd[3].gd.pos.y = gcd[2].gd.pos.y; gcd[3].gd.pos.width = -1; gcd[3].gd.flags = gg_visible | gg_enabled | gg_but_cancel; label[3].text = (uint32_t *) _("_Cancel"); label[3].text_is_1byte = true; label[3].text_has_mnemonic = true; gcd[3].gd.label = &label[3]; gcd[3].gd.handle_controlevent = GFD_Cancel; gcd[3].creator = GButtonCreate; harray[4] = GCD_Glue; harray[5] = &gcd[3]; harray[6] = GCD_Glue; harray[7] = NULL; boxes[2].gd.flags = gg_visible | gg_enabled; boxes[2].gd.u.boxelements = harray; boxes[2].creator = GHBoxCreate; varray[2] = &boxes[2]; varray[3] = NULL; varray[4] = NULL; boxes[0].gd.pos.x = boxes[0].gd.pos.y = 2; boxes[0].gd.flags = gg_visible | gg_enabled; boxes[0].gd.u.boxelements = varray; boxes[0].creator = GHVGroupCreate; gcd[4].gd.pos.x = 2; gcd[4].gd.pos.y = 2; gcd[4].gd.pos.width = pos.width - 4; gcd[4].gd.pos.height = pos.height - 4; gcd[4].gd.flags = gg_enabled | gg_visible | gg_pos_in_pixels; gcd[4].creator = GGroupCreate; GGadgetsCreate (gw, boxes); GGadgetSetUserData (gcd[2].ret, gcd[0].ret); GHVBoxSetExpandableRow (boxes[0].ret, 0); GHVBoxSetExpandableCol (boxes[2].ret, gb_expandgluesame); GHVBoxFitWindow (boxes[0].ret); GFileChooserConnectButtons (gcd[0].ret, gcd[1].ret, gcd[2].ret); GFileChooserSetFilterText (gcd[0].ret, initial_filter); GFileChooserSetFilterFunc (gcd[0].ret, filter); GFileChooserSetMimetypes (gcd[0].ret, mimetypes); GFileChooserSetPaths (gcd[0].ret, path); GGadgetSetTitle (gcd[0].ret, defaultfile); memset (&d, '\0', sizeof (d)); d.gfc = gcd[0].ret; GDrawSetVisible (gw, true); while (!d.done) GDrawProcessOneEvent (NULL); GDrawDestroyWindow (gw); GDrawProcessPendingEvents (NULL); /* Give the window a chance to vanish... */ GDrawSync (NULL); GDrawProcessPendingEvents (NULL); /* Give the window a chance to vanish... */ GProgressResumeTimer (); return (d.ret); }
void CVFtPpemDlg(CharView *cv,int debug) { GRect pos; GWindow gw; GWindowAttrs wattrs; GGadgetCreateData gcd[16], boxes[8]; GTextInfo label[16]; FtSizeData fsd; char buffer[20], buffer2[20], buffer3[20]; GGadgetCreateData *varray[7][4], *barray[9], *harray1[3], *harray2[3], *harray3[3]; int k,r; memset(&fsd,0,sizeof(fsd)); fsd.cv = cv; fsd.debug = debug; memset(&wattrs,0,sizeof(wattrs)); wattrs.mask = wam_events|wam_cursor|wam_utf8_wtitle|wam_undercursor|wam_isdlg|wam_restrict; wattrs.event_masks = ~(1<<et_charup); wattrs.restrict_input_to_me = 1; wattrs.undercursor = 1; wattrs.cursor = ct_pointer; wattrs.utf8_window_title = _("Grid Fit Parameters"); wattrs.is_dlg = true; pos.x = pos.y = 0; pos.width = GGadgetScale(GDrawPointsToPixels(NULL,190)); pos.height = GDrawPointsToPixels(NULL,106); fsd.gw = gw = GDrawCreateTopWindow(NULL,&pos,fsd_e_h,&fsd,&wattrs); memset(&label,0,sizeof(label)); memset(&gcd,0,sizeof(gcd)); memset(&boxes,0,sizeof(boxes)); k=r=0; label[k].text = (unichar_t *) _("Debug _fpgm/prep"); label[k].text_is_1byte = true; label[k].text_in_resource = true; gcd[k].gd.label = &label[k]; gcd[k].gd.pos.x = 80; gcd[k].gd.pos.y = 4; gcd[k].gd.flags = debug ? (gg_enabled|gg_visible) : 0; if ( last_fpgm ) gcd[k].gd.flags |= gg_cb_on; gcd[k].gd.cid = CID_Debugfpgm; gcd[k++].creator = GCheckBoxCreate; varray[r][0] = &gcd[k-1]; varray[r][1] = GCD_ColSpan; varray[r][2] = GCD_ColSpan; varray[r++][3] = NULL; label[k].text = (unichar_t *) _("Scale X/Y the same"); label[k].text_is_1byte = true; label[k].text_in_resource = true; gcd[k].gd.label = &label[k]; gcd[k].gd.pos.x = 110; gcd[k].gd.pos.y = 17+5+6; gcd[k].gd.flags = gg_enabled|gg_visible; if ( gridfit_x_sameas_y ) gcd[k].gd.flags |= gg_cb_on; gcd[k].gd.cid = CID_SameAs; gcd[k].gd.handle_controlevent = FtPpem_SameAsChanged; gcd[k++].creator = GCheckBoxCreate; varray[r][0] = &gcd[k-1]; varray[r][1] = GCD_HPad10; label[k].text = (unichar_t *) _("_DPI:"); label[k].text_is_1byte = true; label[k].text_in_resource = true; gcd[k].gd.label = &label[k]; gcd[k].gd.pos.x = 110; gcd[k].gd.pos.y = 17+5+6; gcd[k].gd.flags = gg_enabled|gg_visible; gcd[k++].creator = GLabelCreate; harray1[0] = &gcd[k-1]; sprintf( buffer2, "%d", gridfit_dpi ); label[k].text = (unichar_t *) buffer2; label[k].text_is_1byte = true; gcd[k].gd.label = &label[k]; gcd[k].gd.pos.x = 140; gcd[k].gd.pos.y = 17+5; gcd[k].gd.pos.width = 40; gcd[k].gd.flags = gg_enabled|gg_visible; gcd[k].gd.cid = CID_DPI; gcd[k++].creator = GTextFieldCreate; harray1[1] = &gcd[k-1]; harray1[2] = NULL; boxes[2].gd.flags = gg_enabled|gg_visible; boxes[2].gd.u.boxelements = harray1; boxes[2].creator = GHBoxCreate; varray[r][2] = &boxes[2]; varray[r++][3] = NULL; label[k].text = (unichar_t *) _("_Pointsize Y:"); label[k].text_is_1byte = true; label[k].text_in_resource = true; gcd[k].gd.label = &label[k]; gcd[k].gd.pos.x = 5; gcd[k].gd.pos.y = 17+5+6; gcd[k].gd.flags = gg_enabled|gg_visible; gcd[k++].creator = GLabelCreate; harray2[0] = &gcd[k-1]; sprintf( buffer, "%g", gridfit_pointsizey ); label[k].text = (unichar_t *) buffer; label[k].text_is_1byte = true; gcd[k].gd.label = &label[k]; gcd[k].gd.pos.x = 57; gcd[k].gd.pos.y = 17+5; gcd[k].gd.pos.width = 40; gcd[k].gd.flags = gg_enabled|gg_visible; gcd[k].gd.handle_controlevent = FtPpem_PtYChanged; gcd[k].gd.cid = CID_PointSize; gcd[k++].creator = GTextFieldCreate; harray2[1] = &gcd[k-1]; harray2[2] = NULL; boxes[3].gd.flags = gg_enabled|gg_visible; boxes[3].gd.u.boxelements = harray2; boxes[3].creator = GHBoxCreate; varray[r][0] = &boxes[3]; varray[r][1] = GCD_HPad10; label[k].text = (unichar_t *) _("_X:"); label[k].text_is_1byte = true; label[k].text_in_resource = true; gcd[k].gd.label = &label[k]; gcd[k].gd.pos.x = 5; gcd[k].gd.pos.y = 17+5+6; gcd[k].gd.flags = gg_enabled|gg_visible; gcd[k++].creator = GLabelCreate; harray3[0] = &gcd[k-1]; sprintf( buffer3, "%g", gridfit_x_sameas_y ? gridfit_pointsizey : gridfit_pointsizex); label[k].text = (unichar_t *) buffer3; label[k].text_is_1byte = true; gcd[k].gd.label = &label[k]; gcd[k].gd.pos.x = 57; gcd[k].gd.pos.y = 17+5; gcd[k].gd.pos.width = 40; gcd[k].gd.flags = gg_enabled|gg_visible; if ( gridfit_x_sameas_y ) gcd[k].gd.flags = gg_visible; gcd[k].gd.cid = CID_PointSizeX; gcd[k++].creator = GTextFieldCreate; harray3[1] = &gcd[k-1]; harray3[2] = NULL; boxes[4].gd.flags = gg_enabled|gg_visible; boxes[4].gd.u.boxelements = harray3; boxes[4].creator = GHBoxCreate; varray[r][2] = &boxes[4]; varray[r++][3] = NULL; label[k].text = (unichar_t *) _("_Mono"); label[k].text_is_1byte = true; label[k].text_in_resource = true; gcd[k].gd.label = &label[k]; gcd[k].gd.pos.x = 20; gcd[k].gd.pos.y = 14+31; gcd[k].gd.flags = gridfit_depth==1 ? (gg_enabled|gg_visible|gg_cb_on) : (gg_enabled|gg_visible); gcd[k].gd.cid = CID_BW; gcd[k++].creator = GRadioCreate; varray[r][0] = &gcd[k-1]; varray[r][1] = GCD_HPad10; label[k].text = (unichar_t *) _("_Anti-Aliased"); label[k].text_is_1byte = true; label[k].text_in_resource = true; gcd[k].gd.label = &label[k]; gcd[k].gd.pos.x = 80; gcd[k].gd.pos.y = gcd[9].gd.pos.y; gcd[k].gd.flags = gridfit_depth!=1 ? (gg_enabled|gg_visible|gg_cb_on) : (gg_enabled|gg_visible); gcd[k++].creator = GRadioCreate; varray[r][2] = &gcd[k-1]; varray[r++][3] = NULL; gcd[k].gd.pos.x = 5; gcd[k].gd.pos.y = 17+31+16; gcd[k].gd.pos.width = 190-10; gcd[k].gd.flags = gg_enabled|gg_visible; gcd[k++].creator = GLineCreate; varray[r][0] = &gcd[k-1]; varray[r][1] = GCD_ColSpan; varray[r][2] = GCD_ColSpan; varray[r++][3] = NULL; gcd[k].gd.pos.x = 20-3; gcd[k].gd.pos.y = 17+37+16; gcd[k].gd.pos.width = -1; gcd[k].gd.pos.height = 0; gcd[k].gd.flags = gg_visible | gg_enabled | gg_but_default; label[k].text = (unichar_t *) _("_OK"); label[k].text_is_1byte = true; label[k].text_in_resource = true; gcd[k].gd.mnemonic = 'O'; gcd[k].gd.label = &label[k]; gcd[k].gd.handle_controlevent = FtPpem_OK; gcd[k++].creator = GButtonCreate; barray[0] = GCD_Glue; barray[1] = &gcd[k-1]; barray[2] = GCD_Glue; gcd[k].gd.pos.x = -20; gcd[k].gd.pos.y = gcd[4].gd.pos.y+3; gcd[k].gd.pos.width = -1; gcd[k].gd.pos.height = 0; gcd[k].gd.flags = gg_visible | gg_enabled | gg_but_cancel; 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.mnemonic = 'C'; gcd[k].gd.handle_controlevent = FtPpem_Cancel; gcd[k++].creator = GButtonCreate; barray[3] = GCD_Glue; barray[4] = &gcd[k-1]; barray[5] = GCD_Glue; barray[6] = NULL; boxes[5].gd.flags = gg_enabled|gg_visible; boxes[5].gd.u.boxelements = barray; boxes[5].creator = GHBoxCreate; varray[r][0] = &boxes[5]; varray[r][1] = GCD_ColSpan; varray[r][2] = GCD_ColSpan; varray[r++][3] = NULL; varray[r][0] = 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[0]; boxes[0].creator = GHVGroupCreate; GGadgetsCreate(gw,boxes); GHVBoxFitWindow(boxes[0].ret); GWidgetIndicateFocusGadget(GWidgetGetControl(gw,CID_PointSize)); GTextFieldSelect(GWidgetGetControl(gw,CID_PointSize),0,-1); GWidgetHidePalettes(); GDrawSetVisible(gw,true); while ( !fsd.done ) GDrawProcessOneEvent(NULL); GDrawDestroyWindow(gw); }
void DeltaSuggestionDlg(FontView *fv,CharView *cv) { GRect pos; GWindow gw; GWindowAttrs wattrs; GGadgetCreateData gcd[13], boxes[4]; GTextInfo label[13]; GGadgetCreateData *varray[7][5], *barray[9]; char dpi_buffer[40], within_buffer[40]; QGData *data; int failed = false; int k, r; FontView *savefv; if ( !hasFreeType() ) { ff_post_error(_("No FreeType"),_("You must install the freetype library before using this command.")); return; } if ( !hasFreeTypeByteCode() ) { ff_post_error(_("No FreeType"),_("Your version of the freetype library does not contain the bytecode interpreter.")); return; } if ( delta_sizes==NULL ) delta_sizes = copy("7-40,72,80,88,96"); data = calloc(1,sizeof(QGData)); data->fv = (FontViewBase *) fv; data->cv = cv; if ( cv!=NULL ) { data->sc = cv->b.sc; savefv = (FontView *) cv->b.fv; data->layer = CVLayer((CharViewBase *) cv); if ( !data->sc->parent->layers[data->layer].order2 ) failed = true; if ( !failed && data->sc->ttf_instrs_len==0 ) ff_post_notice(_("No Instructions"),_("This glyph has no instructions. Adding instructions (a DELTA) may change its rasterization significantly.")); cv->qg = data; cv->note_x = cv->note_y = 32766; } else { savefv = fv; data->layer = fv->b.active_layer; if ( !fv->b.sf->layers[data->layer].order2 ) failed = true; } if ( failed ) { ff_post_error(_("Not quadratic"),_("This must be a truetype layer.")); free(data); if ( cv!=NULL ) cv->qg = NULL; return; } savefv->qg = data; memset(&wattrs,0,sizeof(wattrs)); wattrs.mask = wam_events|wam_cursor|wam_utf8_wtitle|wam_undercursor|wam_isdlg|wam_restrict; wattrs.event_masks = ~(1<<et_charup); wattrs.restrict_input_to_me = 1; wattrs.undercursor = 1; wattrs.cursor = ct_pointer; wattrs.utf8_window_title = _("DELTA suggestions"); wattrs.is_dlg = true; pos.x = pos.y = 0; pos.width = GGadgetScale(GDrawPointsToPixels(NULL,190)); pos.height = GDrawPointsToPixels(NULL,106); data->gw = gw = GDrawCreateTopWindow(NULL,&pos,delta_e_h,data,&wattrs); memset(&label,0,sizeof(label)); memset(&gcd,0,sizeof(gcd)); memset(&boxes,0,sizeof(boxes)); k=r=0; label[k].text = (unichar_t *) _( "When a curve passes very close to the center of a\n" "pixel you might want to check that the curve is on\n" "the intended side of that pixel.\n" "If it's on the wrong side, consider using a DELTA\n" "instruction to adjust the closest point at the\n" "current pixelsize." ); 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; varray[r][0] = &gcd[k-1]; varray[r][1] = GCD_ColSpan; varray[r][2] = GCD_ColSpan; varray[r][3] = GCD_ColSpan; varray[r++][4] = NULL; label[k].text = (unichar_t *) _("Rasterize at sizes:"); 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; label[k].text = (unichar_t *) delta_sizes; 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_Sizes; gcd[k++].creator = GTextFieldCreate; varray[r][0] = &gcd[k-2]; varray[r][1] = &gcd[k-1]; varray[r][2] = GCD_ColSpan; varray[r][3] = GCD_ColSpan; varray[r++][4] = NULL; label[k].text = (unichar_t *) _("DPI:"); 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; sprintf( dpi_buffer, "%d", delta_dpi ); label[k].text = (unichar_t *) dpi_buffer; label[k].text_is_1byte = true; label[k].text_in_resource = true; gcd[k].gd.label = &label[k]; gcd[k].gd.pos.width = 40; gcd[k].gd.cid = CID_DPI; gcd[k].gd.flags = gg_enabled|gg_visible; gcd[k++].creator = GTextFieldCreate; label[k].text = (unichar_t *) _("_Mono"); label[k].text_is_1byte = true; label[k].text_in_resource = true; gcd[k].gd.label = &label[k]; gcd[k].gd.flags = delta_depth==1 ? (gg_enabled|gg_visible|gg_cb_on) : (gg_enabled|gg_visible); gcd[k].gd.cid = CID_BW; gcd[k++].creator = GRadioCreate; varray[r][0] = &gcd[k-1]; varray[r][1] = GCD_HPad10; label[k].text = (unichar_t *) _("_Anti-Aliased"); label[k].text_is_1byte = true; label[k].text_in_resource = true; gcd[k].gd.label = &label[k]; gcd[k].gd.flags = delta_depth!=1 ? (gg_enabled|gg_visible|gg_cb_on) : (gg_enabled|gg_visible); gcd[k++].creator = GRadioCreate; varray[r][0] = &gcd[k-4]; varray[r][1] = &gcd[k-3]; varray[r][2] = &gcd[k-2]; varray[r][3] = &gcd[k-1]; varray[r++][4] = NULL; label[k].text = (unichar_t *) _("Proximity:"); 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; sprintf( within_buffer, "%g", delta_within ); label[k].text = (unichar_t *) within_buffer; 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.pos.width = 40; gcd[k].gd.cid = CID_Within; gcd[k++].creator = GTextFieldCreate; label[k].text = (unichar_t *) _("pixels"); 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; varray[r][0] = &gcd[k-3]; varray[r][1] = &gcd[k-2]; varray[r][2] = &gcd[k-1]; varray[r][3] = GCD_ColSpan; varray[r++][4] = NULL; label[k].text = (unichar_t *) _( "This may take a while. Please be patient..." ); label[k].text_is_1byte = true; label[k].text_in_resource = true; gcd[k].gd.label = &label[k]; gcd[k].gd.flags = gg_enabled; gcd[k].gd.cid = CID_Msg; gcd[k++].creator = GLabelCreate; varray[r][0] = &gcd[k-1]; varray[r][1] = GCD_ColSpan; varray[r][2] = GCD_ColSpan; varray[r][3] = GCD_ColSpan; varray[r++][4] = NULL; gcd[k].gd.flags = gg_visible | gg_enabled | gg_but_default; label[k].text = (unichar_t *) _("_OK"); label[k].text_is_1byte = true; label[k].text_in_resource = true; gcd[k].gd.label = &label[k]; gcd[k].gd.handle_controlevent = Delta_OK; gcd[k].gd.cid = CID_Ok; gcd[k++].creator = GButtonCreate; barray[0] = GCD_Glue; barray[1] = &gcd[k-1]; barray[2] = GCD_Glue; gcd[k].gd.flags = gg_visible | gg_enabled | gg_but_cancel; 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.handle_controlevent = Delta_Cancel; gcd[k].gd.cid = CID_Cancel; gcd[k++].creator = GButtonCreate; barray[3] = GCD_Glue; barray[4] = &gcd[k-1]; barray[5] = GCD_Glue; barray[6] = NULL; boxes[2].gd.flags = gg_enabled|gg_visible; boxes[2].gd.u.boxelements = barray; boxes[2].creator = GHBoxCreate; varray[r][0] = &boxes[2]; varray[r][1] = GCD_ColSpan; varray[r][2] = GCD_ColSpan; varray[r][3] = GCD_ColSpan; varray[r++][4] = NULL; varray[r][0] = 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[0]; boxes[0].gd.cid = CID_Top; boxes[0].creator = GHVGroupCreate; GGadgetsCreate(gw,boxes); GHVBoxFitWindow(boxes[0].ret); GDrawSetVisible(gw,true); while ( !data->done ) GDrawProcessOneEvent(NULL); GDrawDestroyWindow(gw); if ( data->cv!=NULL ) data->cv->qg = NULL; if ( savefv->qg == data ) savefv->qg = NULL; }
int GotoChar(SplineFont *sf,EncMap *map,int *merge_with_selection) { GRect pos; GWindow gw; GWindowAttrs wattrs; GGadgetCreateData gcd[9], boxes[3], *hvarray[6][2], *barray[10]; GTextInfo label[9]; static GotoData gd; GTextInfo *ranges = NULL; int k,j; if ( !map->enc->only_1byte ) ranges = AvailableRanges(sf,map); memset(&gd,0,sizeof(gd)); gd.sf = sf; gd.map = map; gd.ret = -1; gd.ranges = ranges; memset(&wattrs,0,sizeof(wattrs)); wattrs.mask = wam_events|wam_cursor|wam_utf8_wtitle|wam_undercursor|wam_isdlg|wam_restrict; wattrs.event_masks = ~(1<<et_charup); wattrs.restrict_input_to_me = 1; wattrs.undercursor = 1; wattrs.cursor = ct_pointer; wattrs.utf8_window_title = _("Goto"); wattrs.is_dlg = true; pos.x = pos.y = 0; pos.width = GGadgetScale(GDrawPointsToPixels(NULL,170)); pos.height = GDrawPointsToPixels(NULL,90); gd.gw = gw = GDrawCreateTopWindow(NULL,&pos,goto_e_h,&gd,&wattrs); memset(&label,0,sizeof(label)); memset(&gcd,0,sizeof(gcd)); memset(&boxes,0,sizeof(boxes)); k=j=0; label[k].text = (unichar_t *) _("Enter the name of a glyph in the font"); label[k].text_is_1byte = true; gcd[k].gd.label = &label[k]; gcd[k].gd.flags = gg_enabled|gg_visible; gcd[k].creator = GLabelCreate; hvarray[j][0] = &gcd[k++]; hvarray[j++][1] = NULL; gcd[k].gd.flags = gg_enabled|gg_visible|gg_text_xim; gcd[k].gd.cid = CID_Name; if ( ranges==NULL ) gcd[k].creator = GTextCompletionCreate; else { gcd[k].gd.u.list = ranges; gcd[k].creator = GListFieldCreate; } hvarray[j][0] = &gcd[k++]; hvarray[j++][1] = NULL; if ( merge_with_selection!=NULL ) { label[k].text = (unichar_t *) _("Merge into selection"); label[k].text_is_1byte = true; gcd[k].gd.label = &label[k]; gcd[k].gd.cid = CID_MergeWithSelection; gcd[k].gd.flags = *merge_with_selection ? gg_enabled|gg_visible|gg_cb_on : gg_enabled|gg_visible; gcd[k].creator = GCheckBoxCreate; hvarray[j][0] = &gcd[k++]; hvarray[j++][1] = NULL; } hvarray[j][0] = GCD_Glue; hvarray[j++][1] = NULL; gcd[k].gd.flags = gg_visible | gg_enabled | gg_but_default; label[k].text = (unichar_t *) _("_OK"); label[k].text_is_1byte = true; label[k].text_in_resource = true; gcd[k].gd.label = &label[k]; gcd[k].gd.handle_controlevent = Goto_OK; gcd[k].creator = GButtonCreate; barray[0] = GCD_Glue; barray[1] = &gcd[k++]; barray[2] = GCD_Glue; barray[3] = GCD_Glue; gcd[k].gd.flags = gg_visible | gg_enabled | gg_but_cancel; 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.handle_controlevent = Goto_Cancel; gcd[k].creator = GButtonCreate; barray[4] = GCD_Glue; barray[5] = &gcd[k++]; barray[6] = GCD_Glue; barray[7] = NULL; boxes[2].gd.flags = gg_visible | gg_enabled; boxes[2].gd.u.boxelements = barray; boxes[2].creator = GHBoxCreate; hvarray[j][0] = &boxes[2]; hvarray[j++][1] = NULL; hvarray[j][0] = NULL; boxes[0].gd.pos.x = boxes[0].gd.pos.y = 2; boxes[0].gd.flags = gg_visible | gg_enabled; boxes[0].gd.u.boxelements = hvarray[0]; boxes[0].creator = GHVGroupCreate; GGadgetsCreate(gw,boxes); GCompletionFieldSetCompletion(gcd[1].ret,GotoCompletion); GCompletionFieldSetCompletionMode(gcd[1].ret,true); GHVBoxSetExpandableRow(boxes[0].ret,gb_expandglue); GHVBoxSetExpandableCol(boxes[2].ret,gb_expandgluesame); GHVBoxFitWindow(boxes[0].ret); GDrawSetVisible(gw,true); while ( !gd.done ) GDrawProcessOneEvent(NULL); if ( merge_with_selection!=NULL ) *merge_with_selection = GGadgetIsChecked(GWidgetGetControl(gw,CID_MergeWithSelection)); GDrawDestroyWindow(gw); return( gd.ret ); }
void OutlineDlg(FontView *fv, CharView *cv,MetricsView *mv,int isinline) { GRect pos; GWindow gw; GWindowAttrs wattrs; GGadgetCreateData gcd[9], *harray[6], *butarray[7], *varray[7], boxes[4]; GTextInfo label[9]; OutlineData od; char buffer[20], buffer2[20]; int i,k; od.done = false; od.fv = fv; od.cv = cv; od.mv = mv; od.isinline = isinline; memset(&wattrs,0,sizeof(wattrs)); wattrs.mask = wam_events|wam_cursor|wam_utf8_wtitle|wam_undercursor|wam_isdlg|wam_restrict; wattrs.event_masks = ~(1<<et_charup); wattrs.restrict_input_to_me = 1; wattrs.undercursor = 1; wattrs.cursor = ct_pointer; wattrs.utf8_window_title = isinline?_("Inline"):_("Outline"); wattrs.is_dlg = true; pos.x = pos.y = 0; pos.width = GGadgetScale(GDrawPointsToPixels(NULL,170)); pos.height = GDrawPointsToPixels(NULL,75); od.gw = gw = GDrawCreateTopWindow(NULL,&pos,od_e_h,&od,&wattrs); memset(&label,0,sizeof(label)); memset(&gcd,0,sizeof(gcd)); memset(&boxes,0,sizeof(boxes)); i = k = 0; label[i].text = (uint32_t *) _("Outline Width:"); label[i].text_is_1byte = true; label[i].text_has_mnemonic = true; gcd[i].gd.label = &label[i]; gcd[i].gd.pos.x = 7; gcd[i].gd.pos.y = 7+3; gcd[i].gd.flags = gg_enabled|gg_visible; gcd[i++].creator = GLabelCreate; harray[k++] = &gcd[i-1]; sprintf( buffer, "%g", def_outline_width ); label[i].text = (uint32_t *) buffer; label[i].text_is_1byte = true; gcd[i].gd.label = &label[i]; gcd[i].gd.pos.x = 40; gcd[i].gd.pos.y = 7; gcd[i].gd.pos.width = 40; gcd[i].gd.flags = gg_enabled|gg_visible; gcd[i].gd.cid = CID_Width; gcd[i++].creator = GTextFieldCreate; harray[k++] = &gcd[i-1]; harray[k++] = GCD_Glue; if ( isinline ) { label[i].text = (uint32_t *) _("_Gap:"); label[i].text_is_1byte = true; label[i].text_has_mnemonic = true; gcd[i].gd.label = &label[i]; gcd[i].gd.pos.x = 90; gcd[i].gd.pos.y = 7+3; gcd[i].gd.flags = gg_enabled|gg_visible; gcd[i++].creator = GLabelCreate; harray[k++] = &gcd[i-1]; sprintf( buffer2, "%g", def_gap_width ); label[i].text = (uint32_t *) buffer2; label[i].text_is_1byte = true; gcd[i].gd.label = &label[i]; gcd[i].gd.pos.x = 120; gcd[i].gd.pos.y = 7; gcd[i].gd.pos.width = 40; gcd[i].gd.flags = gg_enabled|gg_visible; gcd[i].gd.cid = CID_Gap; gcd[i++].creator = GTextFieldCreate; harray[k++] = &gcd[i-1]; } harray[k] = NULL; k = 0; gcd[i].gd.pos.x = 20-3; gcd[i].gd.pos.y = 7+32; gcd[i].gd.pos.width = -1; gcd[i].gd.pos.height = 0; gcd[i].gd.flags = gg_visible | gg_enabled | gg_but_default; label[i].text = (uint32_t *) _("_OK"); label[i].text_is_1byte = true; label[i].text_has_mnemonic = true; gcd[i].gd.label = &label[i]; gcd[i].gd.handle_controlevent = OD_OK; gcd[i++].creator = GButtonCreate; butarray[k++] = GCD_Glue; butarray[k++] = &gcd[i-1]; butarray[k++] = GCD_Glue; gcd[i].gd.pos.x = -20; gcd[i].gd.pos.y = 7+32+3; gcd[i].gd.pos.width = -1; gcd[i].gd.pos.height = 0; gcd[i].gd.flags = gg_visible | gg_enabled | gg_but_cancel; label[i].text = (uint32_t *) _("_Cancel"); label[i].text_is_1byte = true; label[i].text_has_mnemonic = true; gcd[i].gd.label = &label[i]; gcd[i].gd.handle_controlevent = OD_Cancel; gcd[i++].creator = GButtonCreate; butarray[k++] = GCD_Glue; butarray[k++] = &gcd[i-1]; butarray[k++] = GCD_Glue; butarray[k] = 0; boxes[2].gd.flags = gg_enabled|gg_visible; boxes[2].gd.u.boxelements = harray; boxes[2].creator = GHBoxCreate; boxes[3].gd.flags = gg_enabled|gg_visible; boxes[3].gd.u.boxelements = butarray; boxes[3].creator = GHBoxCreate; varray[0] = &boxes[2]; varray[1] = NULL; varray[2] = GCD_Glue; varray[3] = NULL; varray[4] = &boxes[3]; varray[5] = NULL; varray[6] = 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].creator = GHVGroupCreate; gcd[i].gd.pos.x = 2; gcd[i].gd.pos.y = 2; gcd[i].gd.pos.width = pos.width-4; gcd[i].gd.pos.height = pos.height-4; gcd[i].gd.flags = gg_enabled|gg_visible|gg_pos_in_pixels; gcd[i].creator = GGroupCreate; GGadgetsCreate(gw,boxes); GHVBoxSetExpandableRow(boxes[0].ret,gb_expandglue); GHVBoxSetExpandableCol(boxes[2].ret,gb_expandglue); GHVBoxSetExpandableCol(boxes[3].ret,gb_expandgluesame); GHVBoxFitWindow(boxes[0].ret); GWidgetIndicateFocusGadget(GWidgetGetControl(gw,CID_Width)); GTextFieldSelect(GWidgetGetControl(gw,CID_Width),0,-1); GDrawSetVisible(gw,true); while ( !od.done ) GDrawProcessOneEvent(NULL); GDrawSetVisible(gw,false); }
void RemoveEncoding(void) { GRect pos; GWindow gw; GWindowAttrs wattrs; GGadgetCreateData gcd[5]; GTextInfo label[5]; Encoding *item; int done = 0; for ( item=enclist; item!=NULL && item->builtin; item=item->next ); if ( item==NULL ) return; memset(&gcd,0,sizeof(gcd)); memset(&label,0,sizeof(label)); memset(&wattrs,0,sizeof(wattrs)); wattrs.mask = wam_events|wam_cursor|wam_utf8_wtitle|wam_undercursor|wam_restrict|wam_isdlg; wattrs.event_masks = ~(1<<et_charup); wattrs.restrict_input_to_me = 1; wattrs.is_dlg = 1; wattrs.undercursor = 1; wattrs.cursor = ct_pointer; wattrs.utf8_window_title = _("Remove Encoding"); pos.x = pos.y = 0; pos.width = GGadgetScale(GDrawPointsToPixels(NULL,150)); pos.height = GDrawPointsToPixels(NULL,110); gw = GDrawCreateTopWindow(NULL,&pos,de_e_h,&done,&wattrs); gcd[0].gd.pos.x = 10; gcd[0].gd.pos.y = 6; gcd[0].gd.pos.width = 130; gcd[0].gd.pos.height = 5*12+10; gcd[0].gd.flags = gg_visible | gg_enabled; gcd[0].gd.cid = CID_Encodings; gcd[0].gd.u.list = EncodingList(); gcd[0].gd.handle_controlevent = DE_Delete; gcd[0].creator = GListCreate; gcd[2].gd.pos.x = -10; gcd[2].gd.pos.y = gcd[0].gd.pos.y+gcd[0].gd.pos.height+5; gcd[2].gd.pos.width = -1; gcd[2].gd.pos.height = 0; gcd[2].gd.flags = gg_visible | gg_enabled | gg_but_cancel ; label[2].text = (unichar_t *) _("_Cancel"); label[2].text_is_1byte = true; label[2].text_in_resource = true; gcd[2].gd.label = &label[2]; gcd[2].gd.mnemonic = 'C'; gcd[2].gd.handle_controlevent = DE_Cancel; gcd[2].creator = GButtonCreate; gcd[1].gd.pos.x = 10-3; gcd[1].gd.pos.y = gcd[2].gd.pos.y-3; gcd[1].gd.pos.width = -1; gcd[1].gd.pos.height = 0; gcd[1].gd.flags = gg_visible | gg_enabled | gg_but_default ; label[1].text = (unichar_t *) _("_Delete"); label[1].text_is_1byte = true; label[1].text_in_resource = true; gcd[1].gd.mnemonic = 'D'; gcd[1].gd.label = &label[1]; gcd[1].gd.handle_controlevent = DE_Delete; gcd[1].creator = GButtonCreate; gcd[3].gd.pos.x = 2; gcd[3].gd.pos.y = 2; gcd[3].gd.pos.width = pos.width-4; gcd[3].gd.pos.height = pos.height-2; gcd[3].gd.flags = gg_enabled | gg_visible | gg_pos_in_pixels; gcd[3].creator = GGroupCreate; GGadgetsCreate(gw,gcd); GTextInfoListFree(gcd[0].gd.u.list); GWidgetHidePalettes(); GDrawSetVisible(gw,true); while ( !done ) GDrawProcessOneEvent(NULL); GDrawDestroyWindow(gw); }
static void FVCreateWidth( void *_fv,SplineChar* _sc,void (*doit)(CreateWidthData *), enum widthtype wtype, char *def) { GRect pos; GWindowAttrs wattrs; GGadgetCreateData gcd[11], boxes[2], topbox[2], *hvs[17], *varray[8], *buttons[6]; GTextInfo label[11]; static CreateWidthDlg cwd; static GWindow winds[5]; static char *title[] = { N_("Set Width..."), N_("Set LBearing..."), N_("Set RBearing..."), N_("Set Both Side Bearings..."), N_("Set Vertical Advance...") }; cwd.wd.done = false; cwd.wd._fv = _fv; cwd.wd._sc = _sc; cwd.wd.wtype = wtype; cwd.wd.doit = doit; cwd.gw = winds[wtype]; if ( cwd.gw==NULL ) { memset(&wattrs,0,sizeof(wattrs)); wattrs.mask = wam_events|wam_cursor|wam_utf8_wtitle|wam_undercursor|wam_isdlg|wam_restrict; wattrs.event_masks = ~(1<<et_charup); wattrs.restrict_input_to_me = 1; wattrs.undercursor = 1; wattrs.cursor = ct_pointer; wattrs.utf8_window_title = _(title[wtype]); wattrs.is_dlg = true; pos.x = pos.y = 0; pos.width = GGadgetScale(GDrawPointsToPixels(NULL,180)); pos.height = GDrawPointsToPixels(NULL,100); cwd.gw = winds[wtype] = GDrawCreateTopWindow(NULL,&pos,cwd_e_h,&cwd,&wattrs); memset(&label,0,sizeof(label)); memset(&gcd,0,sizeof(gcd)); label[0].text = (unichar_t *) _(rb1[wtype]); label[0].text_is_1byte = true; gcd[0].gd.label = &label[0]; gcd[0].gd.flags = gg_enabled|gg_visible|gg_cb_on; gcd[0].gd.cid = CID_Set; gcd[0].gd.handle_controlevent = CW_RadioChange; gcd[0].data = (void *) CID_SetVal; gcd[0].creator = GRadioCreate; label[1].text = (unichar_t *) _(rb2[wtype]); label[1].text_is_1byte = true; gcd[1].gd.label = &label[1]; gcd[1].gd.flags = gg_enabled|gg_visible|gg_rad_continueold ; gcd[1].gd.cid = CID_Incr; gcd[1].gd.handle_controlevent = CW_RadioChange; gcd[1].data = (void *) CID_IncrVal; gcd[1].creator = GRadioCreate; label[2].text = (unichar_t *) _(rb3[wtype]); label[2].text_is_1byte = true; gcd[2].gd.label = &label[2]; gcd[2].gd.flags = gg_enabled|gg_visible|gg_rad_continueold ; gcd[2].gd.cid = CID_Scale; gcd[2].gd.handle_controlevent = CW_RadioChange; gcd[2].data = (void *) CID_ScaleVal; gcd[2].creator = GRadioCreate; label[3].text = (unichar_t *) def; label[3].text_is_1byte = true; gcd[3].gd.label = &label[3]; gcd[3].gd.pos.width = 60; gcd[3].gd.flags = gg_enabled|gg_visible; gcd[3].gd.cid = CID_SetVal; gcd[3].gd.handle_controlevent = CW_FocusChange; gcd[3].data = (void *) CID_Set; gcd[3].creator = GTextFieldCreate; label[4].text = (unichar_t *) "0"; label[4].text_is_1byte = true; gcd[4].gd.label = &label[4]; gcd[4].gd.pos.width = 60; gcd[4].gd.flags = gg_enabled|gg_visible; gcd[4].gd.cid = CID_IncrVal; gcd[4].gd.handle_controlevent = CW_FocusChange; gcd[4].data = (void *) CID_Incr; gcd[4].creator = GTextFieldCreate; label[5].text = (unichar_t *) "100"; label[5].text_is_1byte = true; gcd[5].gd.label = &label[5]; gcd[5].gd.pos.width = 60; gcd[5].gd.flags = gg_enabled|gg_visible; gcd[5].gd.cid = CID_ScaleVal; gcd[5].gd.handle_controlevent = CW_FocusChange; gcd[5].data = (void *) CID_Scale; gcd[5].creator = GTextFieldCreate; gcd[6].gd.flags = gg_visible | gg_enabled | gg_but_default; label[6].text = (unichar_t *) _("_OK"); label[6].text_is_1byte = true; label[6].text_in_resource = true; gcd[6].gd.mnemonic = 'O'; gcd[6].gd.label = &label[6]; gcd[6].gd.handle_controlevent = CW_OK; gcd[6].creator = GButtonCreate; gcd[7].gd.flags = gg_visible | gg_enabled | gg_but_cancel; label[7].text = (unichar_t *) _("_Cancel"); label[7].text_is_1byte = true; label[7].text_in_resource = true; gcd[7].gd.label = &label[7]; gcd[7].gd.mnemonic = 'C'; gcd[7].gd.handle_controlevent = CW_Cancel; gcd[7].creator = GButtonCreate; label[8].text = (unichar_t *) S_(info[wtype]); label[8].text_is_1byte = true; gcd[8].gd.label = &label[8]; gcd[8].gd.pos.x = 5; gcd[8].gd.pos.y = 59; gcd[8].gd.flags = gg_enabled|gg_visible ; gcd[8].creator = GLabelCreate; label[9].text = (unichar_t *) "%"; label[9].text_is_1byte = true; gcd[9].gd.label = &label[9]; gcd[9].gd.flags = gg_enabled|gg_visible; gcd[9].creator = GLabelCreate; hvs[0] = &gcd[0]; hvs[1] = &gcd[3]; hvs[2] = GCD_Glue; hvs[3] = NULL; hvs[4] = &gcd[1]; hvs[5] = &gcd[4]; hvs[6] = GCD_Glue; hvs[7] = NULL; hvs[8] = &gcd[2]; hvs[9] = &gcd[5]; hvs[10] = &gcd[9]; hvs[11] = NULL; hvs[12] = &gcd[8]; hvs[13] = GCD_ColSpan; hvs[14] = GCD_Glue; hvs[15] = NULL; hvs[16] = NULL; buttons[0] = buttons[2] = buttons[4] = GCD_Glue; buttons[5] = NULL; buttons[1] = &gcd[6]; buttons[3] = &gcd[7]; varray[0] = &boxes[1]; varray[1] = NULL; varray[2] = GCD_Glue; varray[3] = NULL; varray[4] = &boxes[0]; varray[5] = NULL; varray[6] = NULL; memset(boxes,0,sizeof(boxes)); boxes[0].gd.flags = gg_enabled|gg_visible; boxes[0].gd.u.boxelements = buttons; boxes[0].creator = GHBoxCreate; boxes[1].gd.flags = gg_enabled|gg_visible; boxes[1].gd.u.boxelements = hvs; boxes[1].creator = GHVBoxCreate; memset(topbox,0,sizeof(topbox)); topbox[0].gd.pos.x = topbox[0].gd.pos.y = 2; topbox[0].gd.pos.width = pos.width-4; topbox[0].gd.pos.height = pos.height-4; topbox[0].gd.flags = gg_enabled|gg_visible; topbox[0].gd.u.boxelements = varray; topbox[0].creator = GHVGroupCreate; GGadgetsCreate(cwd.gw,topbox); GHVBoxSetExpandableRow(topbox[0].ret,1); GHVBoxSetExpandableCol(boxes[0].ret,gb_expandgluesame); GHVBoxSetExpandableCol(boxes[1].ret,1); GWidgetIndicateFocusGadget(GWidgetGetControl(cwd.gw,CID_SetVal)); GTextFieldSelect(GWidgetGetControl(cwd.gw,CID_SetVal),0,-1); GHVBoxFitWindow(topbox[0].ret); } else { unichar_t *temp = uc_copy(def); GGadgetSetTitle(GWidgetGetControl(cwd.gw,CID_SetVal),temp); } GWidgetHidePalettes(); GDrawSetVisible(cwd.gw,true); while ( !cwd.wd.done ) GDrawProcessOneEvent(NULL); GDrawSetVisible(cwd.gw,false); }
void CVCreateHint(CharView *cv,int ishstem,int preservehints) { GRect pos; GWindow gw; GWindowAttrs wattrs; GGadgetCreateData gcd[9], *harray1[4], *harray2[9], *barray[7], *varray[5][2], boxes[5]; GTextInfo label[9]; static CreateHintData chd; char buffer[20]; unichar_t ubuf[20]; chd.done = false; chd.ishstem = ishstem; chd.preservehints = preservehints; chd.cv = cv; if ( chd.gw==NULL ) { memset(&wattrs,0,sizeof(wattrs)); wattrs.mask = wam_events|wam_cursor|wam_utf8_wtitle|wam_undercursor|wam_isdlg|wam_restrict; wattrs.event_masks = ~(1<<et_charup); wattrs.restrict_input_to_me = 1; wattrs.undercursor = 1; wattrs.cursor = ct_pointer; wattrs.utf8_window_title = _("Create Hint"); wattrs.is_dlg = true; pos.x = pos.y = 0; pos.width = GGadgetScale(GDrawPointsToPixels(NULL,170)); pos.height = GDrawPointsToPixels(NULL,90); chd.gw = gw = GDrawCreateTopWindow(NULL,&pos,chd_e_h,&chd,&wattrs); memset(&label,0,sizeof(label)); memset(&gcd,0,sizeof(gcd)); memset(&boxes,0,sizeof(boxes)); label[0].text = (unichar_t *) _("_Base:"); label[0].text_is_1byte = true; label[0].text_in_resource = true; gcd[0].gd.label = &label[0]; gcd[0].gd.pos.x = 5; gcd[0].gd.pos.y = 17+5+6; gcd[0].gd.flags = gg_enabled|gg_visible; gcd[0].creator = GLabelCreate; harray2[0] = GCD_Glue; harray2[1] = &gcd[0]; sprintf( buffer, "%g", (double) (ishstem ? cv->p.cy : cv->p.cx) ); label[1].text = (unichar_t *) buffer; label[1].text_is_1byte = true; gcd[1].gd.label = &label[1]; gcd[1].gd.pos.x = 37; gcd[1].gd.pos.y = 17+5; gcd[1].gd.pos.width = 40; gcd[1].gd.flags = gg_enabled|gg_visible; gcd[1].gd.cid = CID_Base; gcd[1].creator = GTextFieldCreate; harray2[2] = &gcd[1]; label[2].text = (unichar_t *) _("_Size:"); label[2].text_is_1byte = true; label[2].text_in_resource = true; gcd[2].gd.label = &label[2]; gcd[2].gd.pos.x = 90; gcd[2].gd.pos.y = 17+5+6; gcd[2].gd.flags = gg_enabled|gg_visible; gcd[2].creator = GLabelCreate; harray2[3] = GCD_Glue; harray2[4] = &gcd[2]; label[3].text = (unichar_t *) "60"; label[3].text_is_1byte = true; gcd[3].gd.label = &label[3]; gcd[3].gd.pos.x = 120; gcd[3].gd.pos.y = 17+5; gcd[3].gd.pos.width = 40; gcd[3].gd.flags = gg_enabled|gg_visible; gcd[3].gd.cid = CID_Width; gcd[3].creator = GTextFieldCreate; harray2[5] = &gcd[3]; harray2[6] = GCD_Glue; harray2[7] = NULL; gcd[4].gd.pos.x = 20-3; gcd[4].gd.pos.y = 17+37; gcd[4].gd.pos.width = -1; gcd[4].gd.pos.height = 0; gcd[4].gd.flags = gg_visible | gg_enabled | gg_but_default; label[4].text = (unichar_t *) _("_OK"); label[4].text_is_1byte = true; label[4].text_in_resource = true; gcd[4].gd.mnemonic = 'O'; gcd[4].gd.label = &label[4]; gcd[4].gd.handle_controlevent = CH_OK; gcd[4].creator = GButtonCreate; barray[0] = GCD_Glue; barray[1] = &gcd[4]; barray[2] = GCD_Glue; gcd[5].gd.pos.x = -20; gcd[5].gd.pos.y = 17+37+3; gcd[5].gd.pos.width = -1; gcd[5].gd.pos.height = 0; gcd[5].gd.flags = gg_visible | gg_enabled | gg_but_cancel; label[5].text = (unichar_t *) _("_Cancel"); label[5].text_is_1byte = true; label[5].text_in_resource = true; gcd[5].gd.label = &label[5]; gcd[5].gd.mnemonic = 'C'; gcd[5].gd.handle_controlevent = CH_Cancel; gcd[5].creator = GButtonCreate; barray[3] = GCD_Glue; barray[4] = &gcd[5]; barray[5] = GCD_Glue; barray[6] = NULL; label[6].text = (unichar_t *) _("Create Horizontal Stem Hint"); /* Initialize to bigger size */ label[6].text_is_1byte = true; gcd[6].gd.label = &label[6]; gcd[6].gd.pos.x = 17; gcd[6].gd.pos.y = 5; gcd[6].gd.flags = gg_enabled|gg_visible; gcd[6].gd.cid = CID_Label; gcd[6].creator = GLabelCreate; harray1[0] = GCD_Glue; harray1[1] = &gcd[6]; harray1[2] = GCD_Glue; harray1[3] = NULL; gcd[7].gd.pos.x = 5; gcd[7].gd.pos.y = 17+31; gcd[7].gd.pos.width = 170-10; gcd[7].gd.flags = gg_enabled|gg_visible; gcd[7].creator = GLineCreate; boxes[2].gd.flags = gg_enabled|gg_visible; boxes[2].gd.u.boxelements = harray1; boxes[2].creator = GHBoxCreate; boxes[3].gd.flags = gg_enabled|gg_visible; boxes[3].gd.u.boxelements = harray2; boxes[3].creator = GHBoxCreate; boxes[4].gd.flags = gg_enabled|gg_visible; boxes[4].gd.u.boxelements = barray; boxes[4].creator = GHBoxCreate; varray[0][0] = &boxes[2]; varray[0][1] = NULL; varray[1][0] = &boxes[3]; varray[1][1] = NULL; varray[2][0] = &gcd[7]; varray[2][1] = NULL; varray[3][0] = &boxes[4]; varray[3][1] = NULL; varray[4][0] = 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[0]; boxes[0].creator = GHVGroupCreate; GGadgetsCreate(gw,boxes); GHVBoxSetExpandableCol(boxes[2].ret,gb_expandglue); GHVBoxSetExpandableCol(boxes[3].ret,gb_expandglue); GHVBoxSetExpandableCol(boxes[4].ret,gb_expandgluesame); GHVBoxFitWindow(boxes[0].ret); } else { gw = chd.gw; sprintf( buffer, "%g", (double) (ishstem ? cv->p.cy : cv->p.cx) ); uc_strcpy(ubuf,buffer); GGadgetSetTitle(GWidgetGetControl(gw,CID_Base),ubuf); GDrawSetTransientFor(gw,(GWindow) -1); } GGadgetSetTitle8(GWidgetGetControl(gw,CID_Label), ishstem ? _("Create Horizontal Stem Hint") : _("Create Vertical Stem Hint")); GWidgetIndicateFocusGadget(GWidgetGetControl(gw,CID_Base)); GTextFieldSelect(GWidgetGetControl(gw,CID_Base),0,-1); GWidgetHidePalettes(); GDrawSetVisible(gw,true); while ( !chd.done ) GDrawProcessOneEvent(NULL); GDrawSetVisible(gw,false); }
void CVReviewHints(CharView *cv) { GRect pos; GWindow gw; GWindowAttrs wattrs; GGadgetCreateData gcd[18], *harray1[6], *harray2[6], *harray3[6], *harray4[6], *varray[7][2], boxes[8], *barray[6][6]; GTextInfo label[18]; static ReviewHintData hd; int k; hd.done = false; hd.cv = cv; if ( hd.gw==NULL ) { memset(&wattrs,0,sizeof(wattrs)); wattrs.mask = wam_events|wam_cursor|wam_utf8_wtitle|wam_undercursor|wam_isdlg|wam_restrict; wattrs.event_masks = ~(1<<et_charup); wattrs.restrict_input_to_me = 1; wattrs.undercursor = 1; wattrs.cursor = ct_pointer; wattrs.utf8_window_title = _("Review Hints"); wattrs.is_dlg = true; pos.x = pos.y = 0; pos.width = GGadgetScale(GDrawPointsToPixels(NULL,170)); pos.height = GDrawPointsToPixels(NULL,178); hd.gw = gw = GDrawCreateTopWindow(NULL,&pos,rh_e_h,&hd,&wattrs); memset(&label,0,sizeof(label)); memset(&gcd,0,sizeof(gcd)); memset(&boxes,0,sizeof(boxes)); k=0; label[k].text = (unichar_t *) _("_HStem"); 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|gg_cb_on; gcd[k].gd.cid = CID_HStem; gcd[k].gd.handle_controlevent = RH_HVStem; gcd[k].creator = GRadioCreate; harray2[0] = &gcd[k++]; label[k].text = (unichar_t *) _("_VStem"); 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_VStem; gcd[k].gd.handle_controlevent = RH_HVStem; gcd[k].creator = GRadioCreate; harray2[1] = &gcd[k++]; label[k].text = (unichar_t *) "999/999 hstem3"; label[k].text_is_1byte = true; gcd[k].gd.label = &label[k]; gcd[k].gd.flags = gg_enabled|gg_visible; gcd[k].gd.cid = CID_Count; gcd[k].creator = GLabelCreate; harray2[2] = GCD_HPad10; harray2[3] = &gcd[k++]; harray2[4] = GCD_Glue; harray2[5] = NULL; label[k].text = (unichar_t *) _("_Move Points"); 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|gg_utf8_popup; gcd[k].gd.cid = CID_MovePoints; gcd[k].gd.popup_msg = (unichar_t *) _("When the hint's position is changed\nadjust the postion of any points\nwhich lie on that hint"); gcd[k].creator = GCheckBoxCreate; harray3[0] = &gcd[k++]; harray3[1] = GCD_Glue; harray3[2] = NULL; label[k].text = (unichar_t *) _("_Base:"); label[k].text_is_1byte = true; label[k].text_in_resource = true; gcd[k].gd.label = &label[k]; gcd[k].gd.pos.x = 5; gcd[k].gd.pos.y = 14+17+5+3; gcd[k].gd.flags = gg_enabled|gg_visible; gcd[k].creator = GLabelCreate; harray1[0] = &gcd[k++]; gcd[k].gd.pos.width = 40; gcd[k].gd.flags = gg_enabled|gg_visible; gcd[k].gd.cid = CID_Base; gcd[k].gd.handle_controlevent = RH_TextChanged; gcd[k].creator = GTextFieldCreate; harray1[1] = &gcd[k++]; label[k].text = (unichar_t *) _("_Size:"); 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; harray1[2] = &gcd[k++]; gcd[k].gd.pos.width = 40; gcd[k].gd.flags = gg_enabled|gg_visible; gcd[k].gd.cid = CID_Width; gcd[k].gd.handle_controlevent = RH_TextChanged; gcd[k].creator = GTextFieldCreate; harray1[3] = &gcd[k++]; harray1[4] = GCD_Glue; harray1[5] = NULL; gcd[k].gd.flags = gg_visible | gg_enabled; label[k].text = (unichar_t *) "Overlaps another hint"; label[k].text_is_1byte = true; label[k].fg = 0xff0000; label[k].bg = COLOR_DEFAULT; /* Doesn't work, needs to be in box */ gcd[k].gd.label = &label[k]; gcd[k].gd.cid = CID_Overlap; gcd[k].creator = GLabelCreate; harray4[0] = GCD_Glue; harray4[1] = &gcd[k++]; harray4[2] = GCD_Glue; harray4[3] = NULL; gcd[k].gd.flags = gg_visible | gg_enabled; label[k].text = (unichar_t *) _("Cr_eate"); label[k].text_is_1byte = true; label[k].text_in_resource = true; gcd[k].gd.label = &label[k]; gcd[k].gd.cid = CID_Add; gcd[k].gd.handle_controlevent = RH_Add; gcd[k].creator = GButtonCreate; barray[0][0] = GCD_Glue; barray[0][1] = &gcd[k++]; barray[0][2] = GCD_Glue; gcd[k].gd.flags = gg_visible | gg_enabled; label[k].text = (unichar_t *) _("Re_move"); label[k].text_is_1byte = true; label[k].text_in_resource = true; gcd[k].gd.label = &label[k]; gcd[k].gd.cid = CID_Remove; gcd[k].gd.handle_controlevent = RH_Remove; gcd[k].creator = GButtonCreate; barray[0][3] = &gcd[k++]; barray[0][4] = GCD_Glue; barray[0][5] = NULL; gcd[k].gd.pos.width = 170-10; gcd[k].gd.flags = gg_enabled|gg_visible; gcd[k].creator = GLineCreate; barray[1][0] = GCD_Glue; barray[1][1] = &gcd[k++]; barray[1][2] = barray[1][3] = GCD_ColSpan; barray[1][4] = GCD_Glue; barray[1][5] = NULL; gcd[k].gd.flags = gg_visible | gg_enabled | gg_utf8_popup; label[k].text = (unichar_t *) _("< _Prev"); label[k].text_is_1byte = true; label[k].text_in_resource = true; gcd[k].gd.label = &label[k]; gcd[k].gd.cid = CID_Prev; gcd[k].gd.popup_msg = (unichar_t *) _("Previous Hint."); gcd[k].gd.handle_controlevent = RH_NextPrev; gcd[k].creator = GButtonCreate; barray[2][0] = GCD_Glue; barray[2][1] = &gcd[k++]; barray[2][2] = GCD_Glue; gcd[k].gd.flags = gg_visible | gg_enabled | gg_utf8_popup; label[k].text = (unichar_t *) _("_Next >"); label[k].text_is_1byte = true; label[k].text_in_resource = true; gcd[k].gd.label = &label[k]; gcd[k].gd.cid = CID_Next; gcd[k].gd.popup_msg = (unichar_t *) _("Next Hint."); gcd[k].gd.handle_controlevent = RH_NextPrev; gcd[k].creator = GButtonCreate; barray[2][3] = &gcd[k++]; barray[2][4] = GCD_Glue; barray[2][5] = NULL; label[k].text = (unichar_t *) _("Regenerate Hint Substitution Points"); 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|gg_cb_on|gg_utf8_popup; gcd[k].gd.cid = CID_RegenHM; gcd[k].gd.popup_msg = (unichar_t *) _("If you have made any changes to the hints,\nthen in addition to changing the glyph's hints\nrefigure it's hint masks and substitution points."); gcd[k].creator = GCheckBoxCreate; barray[3][0] = &gcd[k++]; barray[3][1] = barray[3][2] = barray[3][3] = barray[3][4] = GCD_ColSpan; barray[3][5] = NULL; gcd[k].gd.flags = gg_visible | gg_enabled; label[k].text = (unichar_t *) _("_OK"); label[k].text_is_1byte = true; label[k].text_in_resource = true; gcd[k].gd.label = &label[k]; gcd[k].gd.handle_controlevent = RH_OK; gcd[k].creator = GButtonCreate; barray[4][0] = GCD_Glue; barray[4][1] = &gcd[k++]; barray[4][2] = GCD_Glue; gcd[k].gd.flags = gg_visible | gg_enabled | gg_but_cancel; 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.handle_controlevent = RH_Cancel; gcd[k].creator = GButtonCreate; barray[4][3] = &gcd[k++]; barray[4][4] = GCD_Glue; barray[4][5] = NULL; barray[5][0] = NULL; boxes[2].gd.flags = gg_enabled|gg_visible; boxes[2].gd.u.boxelements = harray2; boxes[2].creator = GHBoxCreate; boxes[3].gd.flags = gg_enabled|gg_visible; boxes[3].gd.u.boxelements = harray3; boxes[3].creator = GHBoxCreate; boxes[4].gd.flags = gg_enabled|gg_visible; boxes[4].gd.u.boxelements = harray1; boxes[4].creator = GHBoxCreate; boxes[5].gd.flags = gg_enabled|gg_visible; boxes[5].gd.u.boxelements = harray4; boxes[5].creator = GHBoxCreate; boxes[6].gd.flags = gg_enabled|gg_visible; boxes[6].gd.u.boxelements = barray[0]; boxes[6].creator = GHVBoxCreate; varray[0][0] = &boxes[2]; varray[0][1] = NULL; varray[1][0] = &boxes[3]; varray[1][1] = NULL; varray[2][0] = &boxes[4]; varray[2][1] = NULL; varray[3][0] = &boxes[5]; varray[3][1] = NULL; varray[4][0] = &boxes[6]; varray[4][1] = NULL; varray[5][0] = 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[0]; boxes[0].gd.cid = CID_TopBox; boxes[0].creator = GHVGroupCreate; GGadgetsCreate(gw,boxes); GHVBoxSetExpandableRow(boxes[0].ret,3); GHVBoxSetExpandableCol(boxes[2].ret,gb_expandglue); GHVBoxSetExpandableCol(boxes[3].ret,gb_expandglue); GHVBoxSetExpandableCol(boxes[4].ret,gb_expandglue); GHVBoxSetExpandableCol(boxes[5].ret,gb_expandglue); GHVBoxSetExpandableCol(boxes[6].ret,gb_expandglue); GHVBoxFitWindow(boxes[0].ret); } else { gw = hd.gw; GDrawSetTransientFor(gw,(GWindow) -1); } if ( cv->b.sc->hstem==NULL && cv->b.sc->vstem==NULL ) hd.active = NULL; else if ( cv->b.sc->hstem!=NULL && cv->b.sc->vstem!=NULL ) { if ( GGadgetIsChecked(GWidgetGetControl(gw,CID_HStem))) hd.active = cv->b.sc->hstem; else hd.active = cv->b.sc->vstem; } else if ( cv->b.sc->hstem!=NULL ) { GGadgetSetChecked(GWidgetGetControl(gw,CID_HStem),true); hd.active = cv->b.sc->hstem; } else { GGadgetSetChecked(GWidgetGetControl(gw,CID_VStem),true); hd.active = cv->b.sc->vstem; } hd.ishstem = (hd.active==cv->b.sc->hstem); hd.oldh = StemInfoCopy(cv->b.sc->hstem); hd.oldv = StemInfoCopy(cv->b.sc->vstem); hd.oldmanual = cv->b.sc->manualhints; hd.changed = false; RH_SetupHint(&hd); if ( hd.active!=NULL ) { GWidgetIndicateFocusGadget(GWidgetGetControl(gw,CID_Base)); GTextFieldSelect(GWidgetGetControl(gw,CID_Base),0,-1); } GWidgetHidePalettes(); GDrawSetVisible(gw,true); while ( !hd.done ) GDrawProcessOneEvent(NULL); GDrawSetVisible(gw,false); }
int PointOfViewDlg(struct pov_data *pov, SplineFont *sf, int flags) { static struct pov_data def = { or_center, or_value, 0, 0, .1, 0, 3.1415926535897932/16, .2, 0 }; double emsize = (sf->ascent + sf->descent); struct nldlg d; GRect pos; GWindowAttrs wattrs; GGadgetCreateData gcd[24], boxes[7], *varray[10][3], *harray1[3], *harray2[3], *barray[9], *harray3[3], *harray4[3]; GTextInfo label[24]; int i,k,l; char xval[40], yval[40], zval[40], dval[40], tval[40], dirval[40]; double x,y,z,dv,tilt,dir; int err; static int done = false; if ( !done ) { done = true; for ( i=0; originx[i].text!=NULL; ++i ) originx[i].text = (unichar_t *) _((char *) originx[i].text); for ( i=0; originy[i].text!=NULL; ++i ) originy[i].text = (unichar_t *) _((char *) originy[i].text); } *pov = def; pov->x *= emsize; pov->y *= emsize; pov->z *= emsize; pov->d *= emsize; if ( !(flags&1) ) { if ( pov->xorigin == or_lastpress ) pov->xorigin = or_center; if ( pov->yorigin == or_lastpress ) pov->yorigin = or_center; } memset(&d,'\0',sizeof(d)); memset(&wattrs,0,sizeof(wattrs)); wattrs.mask = wam_events|wam_cursor|wam_utf8_wtitle|wam_undercursor|wam_restrict|wam_isdlg; wattrs.event_masks = ~(1<<et_charup); wattrs.restrict_input_to_me = 1; wattrs.is_dlg = 1; wattrs.undercursor = 1; wattrs.cursor = ct_pointer; wattrs.utf8_window_title = _("Point of View Projection"); pos.x = pos.y = 0; pos.width = GGadgetScale(GDrawPointsToPixels(NULL,240)); pos.height = GDrawPointsToPixels(NULL,216); d.gw = GDrawCreateTopWindow(NULL,&pos,nld_e_h,&d,&wattrs); memset(gcd,0,sizeof(gcd)); memset(boxes,0,sizeof(boxes)); memset(label,0,sizeof(label)); k=l=0; label[k].text = (unichar_t *) _("View Point"); label[k].text_is_1byte = true; gcd[k].gd.label = &label[k]; gcd[k].gd.pos.x = 10; gcd[k].gd.pos.y = 8; gcd[k].gd.flags = gg_visible | gg_enabled; gcd[k++].creator = GLabelCreate; varray[l][0] = &gcd[k-1]; varray[l][1] = GCD_ColSpan; varray[l++][2] = NULL; label[k].text = (unichar_t *) _("_X"); label[k].text_is_1byte = true; label[k].text_in_resource = true; gcd[k].gd.label = &label[k]; gcd[k].gd.pos.x = 10; gcd[k].gd.pos.y = gcd[k-1].gd.pos.y + 16; gcd[k].gd.flags = gg_visible | gg_enabled; gcd[k++].creator = GLabelCreate; harray1[0] = &gcd[k-1]; for ( i=or_zero; i<or_undefined; ++i ) originx[i].selected = false; originx[pov->xorigin].selected = true; originx[or_lastpress].disabled = !(flags&1); gcd[k].gd.pos.x = 23; gcd[k].gd.pos.y = gcd[k-1].gd.pos.y-4; gcd[k].gd.flags = gg_visible | gg_enabled; gcd[k].gd.label = &originx[pov->xorigin]; gcd[k].gd.u.list = originx; gcd[k].gd.cid = CID_XType; gcd[k++].creator = GListButtonCreate; harray1[1] = &gcd[k-1]; harray1[2] = NULL; boxes[2].gd.flags = gg_enabled|gg_visible; boxes[2].gd.u.boxelements = harray1; boxes[2].creator = GHBoxCreate; varray[l][0] = &boxes[2]; sprintf( xval, "%g", rint(pov->x)); label[k].text = (unichar_t *) xval; label[k].text_is_1byte = true; gcd[k].gd.label = &label[k]; gcd[k].gd.pos.x = 160; gcd[k].gd.pos.y = gcd[k-1].gd.pos.y; gcd[k].gd.pos.width = 60; gcd[k].gd.flags = gg_enabled|gg_visible; gcd[k].gd.handle_controlevent = PoV_Vanish; gcd[k].gd.cid = CID_XValue; gcd[k++].creator = GTextFieldCreate; varray[l][1] = &gcd[k-1]; varray[l++][2] = NULL; label[k].text = (unichar_t *) _("_Y"); label[k].text_is_1byte = true; label[k].text_in_resource = true; gcd[k].gd.label = &label[k]; gcd[k].gd.pos.x = gcd[k-3].gd.pos.x; gcd[k].gd.pos.y = gcd[k-1].gd.pos.y + 28; gcd[k].gd.flags = gg_visible | gg_enabled; gcd[k++].creator = GLabelCreate; harray2[0] = &gcd[k-1]; for ( i=or_zero; i<or_undefined; ++i ) originy[i].selected = false; originy[pov->yorigin].selected = true; originy[or_lastpress].disabled = !(flags&1); gcd[k].gd.pos.x = gcd[k-3].gd.pos.x; gcd[k].gd.pos.y = gcd[k-1].gd.pos.y-4; gcd[k].gd.flags = gg_visible | gg_enabled; gcd[k].gd.label = &originy[pov->yorigin]; gcd[k].gd.u.list = originy; gcd[k].gd.cid = CID_YType; gcd[k++].creator = GListButtonCreate; harray2[1] = &gcd[k-1]; harray2[2] = NULL; boxes[3].gd.flags = gg_enabled|gg_visible; boxes[3].gd.u.boxelements = harray2; boxes[3].creator = GHBoxCreate; varray[l][0] = &boxes[3]; sprintf( yval, "%g", rint(pov->y)); label[k].text = (unichar_t *) yval; label[k].text_is_1byte = true; gcd[k].gd.label = &label[k]; gcd[k].gd.pos.x = gcd[k-3].gd.pos.x; gcd[k].gd.pos.y = gcd[k-1].gd.pos.y; gcd[k].gd.pos.width = gcd[k-3].gd.pos.width; gcd[k].gd.flags = gg_enabled|gg_visible; gcd[k].gd.cid = CID_YValue; gcd[k].gd.handle_controlevent = PoV_Vanish; gcd[k++].creator = GTextFieldCreate; varray[l][1] = &gcd[k-1]; varray[l++][2] = NULL; label[k].text = (unichar_t *) _("Distance to drawing plane:"); label[k].text_is_1byte = true; gcd[k].gd.label = &label[k]; gcd[k].gd.pos.x = 10; gcd[k].gd.pos.y = gcd[k-1].gd.pos.y + 28; gcd[k].gd.flags = gg_visible | gg_enabled; gcd[k++].creator = GLabelCreate; varray[l][0] = &gcd[k-1]; sprintf( zval, "%g", rint(pov->z)); label[k].text = (unichar_t *) zval; label[k].text_is_1byte = true; gcd[k].gd.label = &label[k]; gcd[k].gd.pos.x = 160; gcd[k].gd.pos.y = gcd[k-1].gd.pos.y-4; gcd[k].gd.pos.width = 60; gcd[k].gd.flags = gg_enabled|gg_visible; gcd[k].gd.handle_controlevent = PoV_Vanish; gcd[k].gd.cid = CID_ZValue; gcd[k++].creator = GTextFieldCreate; varray[l][1] = &gcd[k-1]; varray[l++][2] = NULL; label[k].text = (unichar_t *) _("Distance to projection plane:"); label[k].text_is_1byte = true; gcd[k].gd.label = &label[k]; gcd[k].gd.pos.x = gcd[k-2].gd.pos.x; gcd[k].gd.pos.y = gcd[k-2].gd.pos.y + 24; gcd[k].gd.flags = gg_visible | gg_enabled; gcd[k++].creator = GLabelCreate; varray[l][0] = &gcd[k-1]; sprintf( dval, "%g", rint(pov->d)); label[k].text = (unichar_t *) dval; label[k].text_is_1byte = true; gcd[k].gd.label = &label[k]; gcd[k].gd.pos.x = 160; gcd[k].gd.pos.y = gcd[k-1].gd.pos.y-4; gcd[k].gd.pos.width = 60; gcd[k].gd.flags = gg_enabled|gg_visible; gcd[k].gd.handle_controlevent = PoV_Vanish; gcd[k].gd.cid = CID_DValue; gcd[k++].creator = GTextFieldCreate; varray[l][1] = &gcd[k-1]; varray[l++][2] = NULL; label[k].text = (unichar_t *) _("Drawing plane tilt:"); label[k].text_is_1byte = true; gcd[k].gd.label = &label[k]; gcd[k].gd.pos.x = gcd[k-2].gd.pos.x; gcd[k].gd.pos.y = gcd[k-2].gd.pos.y + 24; gcd[k].gd.flags = gg_visible | gg_enabled; gcd[k++].creator = GLabelCreate; varray[l][0] = &gcd[k-1]; sprintf( tval, "%g", rint(pov->tilt*180/3.1415926535897932)); label[k].text = (unichar_t *) tval; label[k].text_is_1byte = true; gcd[k].gd.label = &label[k]; gcd[k].gd.pos.x = 160; gcd[k].gd.pos.y = gcd[k-1].gd.pos.y-4; gcd[k].gd.pos.width = 40; gcd[k].gd.flags = gg_enabled|gg_visible; gcd[k].gd.handle_controlevent = PoV_Vanish; gcd[k].gd.cid = CID_Tilt; gcd[k++].creator = GTextFieldCreate; harray3[0] = &gcd[k-1]; label[k].text = (unichar_t *) U_("°"); label[k].text_is_1byte = true; gcd[k].gd.label = &label[k]; gcd[k].gd.pos.x = gcd[k-1].gd.pos.x+gcd[k-1].gd.pos.width+3; gcd[k].gd.pos.y = gcd[k-2].gd.pos.y; gcd[k].gd.flags = gg_visible | gg_enabled; gcd[k++].creator = GLabelCreate; harray3[1] = &gcd[k-1]; harray3[2] = NULL; boxes[4].gd.flags = gg_enabled|gg_visible; boxes[4].gd.u.boxelements = harray3; boxes[4].creator = GHBoxCreate; varray[l][1] = &boxes[4]; varray[l++][2] = NULL; label[k].text = (unichar_t *) _("Direction of gaze:"); label[k].text_is_1byte = true; gcd[k].gd.label = &label[k]; gcd[k].gd.pos.x = gcd[k-3].gd.pos.x; gcd[k].gd.pos.y = gcd[k-3].gd.pos.y + 24; gcd[k].gd.flags = gg_visible | gg_enabled; gcd[k++].creator = GLabelCreate; varray[l][0] = &gcd[k-1]; sprintf( dirval, "%g", rint(pov->direction*180/3.1415926535897932)); label[k].text = (unichar_t *) dirval; label[k].text_is_1byte = true; gcd[k].gd.label = &label[k]; gcd[k].gd.pos.x = 160; gcd[k].gd.pos.y = gcd[k-1].gd.pos.y-4; gcd[k].gd.pos.width = 40; gcd[k].gd.flags = gg_enabled|gg_visible; gcd[k].gd.handle_controlevent = PoV_Vanish; gcd[k].gd.cid = CID_GazeDirection; gcd[k++].creator = GTextFieldCreate; harray4[0] = &gcd[k-1]; label[k].text = (unichar_t *) U_("°"); label[k].text_is_1byte = true; gcd[k].gd.label = &label[k]; gcd[k].gd.pos.x = gcd[k-1].gd.pos.x+gcd[k-1].gd.pos.width+3; gcd[k].gd.pos.y = gcd[k-2].gd.pos.y; gcd[k].gd.flags = gg_visible | gg_enabled; gcd[k++].creator = GLabelCreate; harray4[1] = &gcd[k-1]; harray4[2] = NULL; boxes[5].gd.flags = gg_enabled|gg_visible; boxes[5].gd.u.boxelements = harray4; boxes[5].creator = GHBoxCreate; varray[l][1] = &boxes[5]; varray[l++][2] = NULL; label[k].text = (unichar_t *) _("Vanishing Point:"); label[k].text_is_1byte = true; gcd[k].gd.label = &label[k]; gcd[k].gd.pos.x = 10; gcd[k].gd.pos.y = gcd[k-1].gd.pos.y+18; gcd[k].gd.flags = gg_visible | gg_enabled | gg_utf8_popup; gcd[k].gd.popup_msg = (unichar_t *) _("This is the approximate location of the vanishing point.\nIt does not include the offset induced by \"Center of selection\"\nnor \"Last Press\"."); gcd[k++].creator = GLabelCreate; varray[l][0] = &gcd[k-1]; label[k].text = (unichar_t *) "123456.,123456."; label[k].text_is_1byte = true; gcd[k].gd.label = &label[k]; gcd[k].gd.pos.x = 160; gcd[k].gd.pos.y = gcd[k-1].gd.pos.y; gcd[k].gd.flags = gg_visible | gg_enabled | gg_utf8_popup; gcd[k].gd.popup_msg = (unichar_t *) _("This is the approximate location of the vanishing point.\nIt does not include the offset induced by \"Center of selection\"\nnor \"Last Press\"."); gcd[k].gd.cid = CID_Vanish; gcd[k++].creator = GLabelCreate; varray[l][1] = &gcd[k-1]; varray[l++][2] = NULL; gcd[k].gd.pos.x = 30-3; gcd[k].gd.pos.y = gcd[k-1].gd.pos.y+18; gcd[k].gd.pos.width = -1; gcd[k].gd.pos.height = 0; gcd[k].gd.flags = gg_visible | gg_enabled | gg_but_default; label[k].text = (unichar_t *) _("_OK"); label[k].text_is_1byte = true; label[k].text_in_resource = true; gcd[k].gd.label = &label[k]; gcd[k].gd.cid = true; gcd[k++].creator = GButtonCreate; barray[0] = GCD_Glue; barray[1] = &gcd[k-1]; barray[2] = GCD_Glue; gcd[k].gd.pos.x = -30; gcd[k].gd.pos.y = gcd[k-1].gd.pos.y+3; gcd[k].gd.pos.width = -1; gcd[k].gd.pos.height = 0; gcd[k].gd.flags = gg_visible | gg_enabled | gg_but_cancel; 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.cid = false; gcd[k++].creator = GButtonCreate; barray[3] = GCD_Glue; barray[4] = &gcd[k-1]; barray[5] = GCD_Glue; barray[6] = NULL; boxes[6].gd.flags = gg_enabled|gg_visible; boxes[6].gd.u.boxelements = barray; boxes[6].creator = GHBoxCreate; varray[l][0] = &boxes[6]; varray[l][1] = GCD_ColSpan; varray[l++][2] = NULL; varray[l][0] = 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[0]; boxes[0].creator = GHVGroupCreate; GGadgetsCreate(d.gw,boxes); GHVBoxFitWindow(boxes[0].ret); PoV_DoVanish(&d); GDrawSetVisible(d.gw,true); while ( !d.done ) { GDrawProcessOneEvent(NULL); if ( d.done ) { if ( !d.ok ) { GDrawDestroyWindow(d.gw); return( -1 ); } err = false; x = GetReal8(d.gw,CID_XValue,_("_X"),&err); y = GetReal8(d.gw,CID_YValue,_("_Y"),&err); z = GetReal8(d.gw,CID_ZValue,_("Distance to drawing plane:"),&err); dv = GetReal8(d.gw,CID_DValue,_("Distance to projection plane:"),&err); tilt = GetReal8(d.gw,CID_Tilt,_("Drawing plane tilt:"),&err); dir = GetReal8(d.gw,CID_GazeDirection,_("Direction of gaze:"),&err); if ( err ) { d.done = d.ok = false; continue; } pov->x = x; pov->y = y; pov->z = z; pov->d = dv; pov->tilt = tilt*3.1415926535897932/180; pov->direction = dir*3.1415926535897932/180; pov->xorigin = GGadgetGetFirstListSelectedItem( GWidgetGetControl(d.gw,CID_XType)); pov->yorigin = GGadgetGetFirstListSelectedItem( GWidgetGetControl(d.gw,CID_YType)); } } GDrawDestroyWindow(d.gw); def = *pov; def.x /= emsize; def.y /= emsize; def.z /= emsize; def.d /= emsize; return( 0 ); /* -1 => Canceled */ }
void NonLinearDlg(FontView *fv,CharView *cv) { static unichar_t *lastx, *lasty; struct nldlg d; GRect pos; GWindowAttrs wattrs; GGadgetCreateData gcd[8], boxes[4], *hvarray[3][3], *barray[9], *varray[3][2]; GTextInfo label[8]; struct context c; char *expstr; memset(&d,'\0',sizeof(d)); memset(&c,'\0',sizeof(c)); memset(&wattrs,0,sizeof(wattrs)); wattrs.mask = wam_events|wam_cursor|wam_utf8_wtitle|wam_undercursor|wam_restrict|wam_isdlg; wattrs.event_masks = ~(1<<et_charup); wattrs.restrict_input_to_me = 1; wattrs.is_dlg = 1; wattrs.undercursor = 1; wattrs.cursor = ct_pointer; wattrs.utf8_window_title = _("Non Linear Transform"); pos.x = pos.y = 0; pos.width = GGadgetScale(GDrawPointsToPixels(NULL,200)); pos.height = GDrawPointsToPixels(NULL,97); d.gw = GDrawCreateTopWindow(NULL,&pos,nld_e_h,&d,&wattrs); memset(gcd,0,sizeof(gcd)); memset(boxes,0,sizeof(boxes)); memset(label,0,sizeof(label)); /* GT: an expression describing the transformation applied to the X coordinate */ label[0].text = (unichar_t *) _("X Expr:"); label[0].text_is_1byte = true; gcd[0].gd.label = &label[0]; gcd[0].gd.pos.x = 10; gcd[0].gd.pos.y = 8; gcd[0].gd.flags = gg_visible | gg_enabled | gg_utf8_popup; gcd[0].gd.popup_msg = (unichar_t *) _("These expressions may contain the operators +,-,*,/,%,^ (which means raise to the power of here), and ?: It may also contain a few standard functions. Basic terms are real numbers, x and y.\nExamples:\n x^3+2.5*x^2+5\n (x-300)*(y-200)/100\n y+sin(100*x)"); gcd[0].creator = GLabelCreate; hvarray[0][0] = &gcd[0]; if ( lastx!=NULL ) label[1].text = lastx; else { label[1].text = (unichar_t *) "x"; label[1].text_is_1byte = true; } gcd[1].gd.label = &label[1]; gcd[1].gd.pos.x = 55; gcd[1].gd.pos.y = 5; gcd[1].gd.pos.width = 135; gcd[1].gd.flags = gg_visible | gg_enabled | gg_utf8_popup; gcd[1].gd.popup_msg = (unichar_t *) _("These expressions may contain the operators +,-,*,/,%,^ (which means raise to the power of here), and ?: It may also contain a few standard functions. Basic terms are real numbers, x and y.\nExamples:\n x^3+2.5*x^2+5\n (x-300)*(y-200)/100\n y+sin(100*x)"); gcd[1].creator = GTextFieldCreate; hvarray[0][1] = &gcd[1]; hvarray[0][2] = NULL; /* GT: an expression describing the transformation applied to the Y coordinate */ label[2].text = (unichar_t *) _("Y Expr:"); label[2].text_is_1byte = true; gcd[2].gd.label = &label[2]; gcd[2].gd.pos.x = 10; gcd[2].gd.pos.y = gcd[0].gd.pos.y+26; gcd[2].gd.flags = gg_visible | gg_enabled | gg_utf8_popup; gcd[2].gd.popup_msg = (unichar_t *) _("These expressions may contain the operators +,-,*,/,%,^ (which means raise to the power of here), and ?: It may also contain a few standard functions. Basic terms are real numbers, x and y.\nExamples:\n x^3+2.5*x^2+5\n (x-300)*(y-200)/100\n y+sin(100*x)"); gcd[2].creator = GLabelCreate; hvarray[1][0] = &gcd[2]; if ( lasty!=NULL ) label[3].text = lasty; else { label[3].text = (unichar_t *) "y"; label[3].text_is_1byte = true; } gcd[3].gd.label = &label[3]; gcd[3].gd.pos.x = gcd[1].gd.pos.x; gcd[3].gd.pos.y = gcd[1].gd.pos.y+26; gcd[3].gd.pos.width = gcd[1].gd.pos.width; gcd[3].gd.flags = gg_visible | gg_enabled | gg_utf8_popup; gcd[3].gd.popup_msg = (unichar_t *) _("These expressions may contain the operators +,-,*,/,%,^ (which means raise to the power of here), and ?: It may also contain a few standard functions. Basic terms are real numbers, x and y.\nExamples:\n x^3+2.5*x^2+5\n (x-300)*(y-200)/100\n y+sin(100*x)"); gcd[3].creator = GTextFieldCreate; hvarray[1][1] = &gcd[3]; hvarray[1][2] = NULL; hvarray[2][0] = NULL; boxes[2].gd.flags = gg_enabled|gg_visible; boxes[2].gd.u.boxelements = hvarray[0]; boxes[2].creator = GHVBoxCreate; varray[0][0] = &boxes[2]; varray[0][1] = NULL; gcd[4].gd.pos.x = 30-3; gcd[4].gd.pos.y = gcd[3].gd.pos.y+30; gcd[4].gd.pos.width = -1; gcd[4].gd.pos.height = 0; gcd[4].gd.flags = gg_visible | gg_enabled | gg_but_default; label[4].text = (unichar_t *) _("_OK"); label[4].text_is_1byte = true; label[4].text_in_resource = true; gcd[4].gd.label = &label[4]; gcd[4].gd.cid = true; gcd[4].creator = GButtonCreate; barray[0] = GCD_Glue; barray[1] = &gcd[4]; barray[2] = GCD_Glue; gcd[5].gd.pos.x = -30; gcd[5].gd.pos.y = gcd[4].gd.pos.y+3; gcd[5].gd.pos.width = -1; gcd[5].gd.pos.height = 0; gcd[5].gd.flags = gg_visible | gg_enabled | gg_but_cancel; label[5].text = (unichar_t *) _("_Cancel"); label[5].text_is_1byte = true; label[5].text_in_resource = true; gcd[5].gd.label = &label[5]; gcd[5].gd.cid = false; gcd[5].creator = GButtonCreate; barray[3] = GCD_Glue; barray[4] = &gcd[5]; barray[5] = GCD_Glue; barray[6] = NULL; boxes[3].gd.flags = gg_enabled|gg_visible; boxes[3].gd.u.boxelements = barray; boxes[3].creator = GHBoxCreate; varray[1][0] = &boxes[3]; varray[1][1] = NULL; varray[2][0] = 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[0]; boxes[0].creator = GHVGroupCreate; GGadgetsCreate(d.gw,boxes); GHVBoxSetExpandableCol(boxes[2].ret,1); GHVBoxSetExpandableCol(boxes[3].ret,gb_expandgluesame); GHVBoxFitWindow(boxes[0].ret); GDrawSetVisible(d.gw,true); while ( !d.done ) { GDrawProcessOneEvent(NULL); if ( d.done && d.ok ) { expstr = cu_copy(_GGadgetGetTitle(gcd[1].ret)); c.had_error = false; if ( (c.x_expr = nlt_parseexpr(&c,expstr))==NULL ) d.done = d.ok = false; else { free(expstr); c.had_error = false; expstr = cu_copy(_GGadgetGetTitle(gcd[3].ret)); if ( (c.y_expr = nlt_parseexpr(&c,expstr))==NULL ) { d.done = d.ok = false; nlt_exprfree(c.x_expr); } else { free(expstr); free(lasty); free(lastx); lastx = GGadgetGetTitle(gcd[1].ret); lasty = GGadgetGetTitle(gcd[3].ret); } } } } if ( d.ok ) { if ( fv!=NULL ) _SFNLTrans((FontViewBase *) fv,&c); else CVNLTrans((CharViewBase *) cv,&c); nlt_exprfree(c.x_expr); nlt_exprfree(c.y_expr); } GDrawDestroyWindow(d.gw); }
void SFShowKernPairs(SplineFont *sf,SplineChar *sc,AnchorClass *ac,int layer) { KPData kpd; GRect pos; GWindow gw; GWindowAttrs wattrs; GGadgetCreateData gcd[9], boxes[6], *hvarray[3][3], *harray[3], *barray[10], *varray[5]; GTextInfo label[9]; FontRequest rq; int as, ds, ld,i; static int done=false; static GFont *font=NULL; memset(&kpd,0,sizeof(kpd)); kpd.sf = sf; kpd.sc = sc; kpd.ac = ac; kpd.layer = layer; kpd.first = true; kpd.last_index = kpd.selected = -1; if ( ac==NULL ) KPBuildKernList(&kpd); else KPBuildAnchorList(&kpd); if ( kpd.kcnt==0 ) return; memset(&wattrs,0,sizeof(wattrs)); wattrs.mask = wam_events|wam_cursor|wam_utf8_wtitle|wam_undercursor|wam_isdlg|wam_restrict; wattrs.event_masks = ~(1<<et_charup); wattrs.restrict_input_to_me = 1; wattrs.undercursor = 1; wattrs.cursor = ct_pointer; wattrs.utf8_window_title = ac==NULL?_("Kern Pairs"):_("Anchored Pairs"); wattrs.is_dlg = true; pos.x = pos.y = 0; pos.width = GGadgetScale(200); pos.height = GDrawPointsToPixels(NULL,500); kpd.gw = gw = GDrawCreateTopWindow(NULL,&pos,kpd_e_h,&kpd,&wattrs); memset(&label,0,sizeof(label)); memset(&gcd,0,sizeof(gcd)); memset(&boxes,0,sizeof(boxes)); label[0].text = (unichar_t *) _("_Size:"); label[0].text_is_1byte = true; label[0].text_in_resource = true; gcd[0].gd.label = &label[0]; gcd[0].gd.pos.x = 5; gcd[0].gd.pos.y = 5+6; gcd[0].gd.flags = gg_enabled|gg_visible; gcd[0].creator = GLabelCreate; hvarray[0][0] = &gcd[0]; gcd[1].gd.label = &sizes[1]; gcd[1].gd.label->selected = true; gcd[1].gd.pos.x = 50; gcd[1].gd.pos.y = 5; gcd[1].gd.flags = gg_enabled|gg_visible; gcd[1].gd.cid = CID_Size; gcd[1].gd.u.list = sizes; gcd[1].gd.handle_controlevent = KP_ChangeSize; gcd[1].creator = GListButtonCreate; hvarray[0][1] = &gcd[1]; hvarray[0][2] = NULL; label[2].text = (unichar_t *) _("Sort By:"); label[2].text_is_1byte = true; gcd[2].gd.label = &label[2]; gcd[2].gd.pos.x = gcd[0].gd.pos.x; gcd[2].gd.pos.y = gcd[0].gd.pos.y+25; gcd[2].gd.flags = gg_enabled|gg_visible; gcd[2].creator = GLabelCreate; hvarray[1][0] = &gcd[2]; if ( !done ) { done = true; for ( i=0; sortby[i].text!=NULL; ++i ) sortby[i].text = (unichar_t *) _((char *) sortby[i].text); } gcd[3].gd.label = &sortby[0]; gcd[3].gd.label->selected = true; gcd[3].gd.pos.x = 50; gcd[3].gd.pos.y = gcd[1].gd.pos.y+25; gcd[3].gd.flags = gg_enabled|gg_visible; gcd[3].gd.cid = CID_SortBy; gcd[3].gd.u.list = sortby; gcd[3].gd.handle_controlevent = KP_ChangeSort; gcd[3].creator = GListButtonCreate; hvarray[1][1] = &gcd[3]; hvarray[1][2] = NULL; hvarray[2][0] = NULL; boxes[2].gd.flags = gg_enabled|gg_visible; boxes[2].gd.u.boxelements = hvarray[0]; boxes[2].creator = GHVBoxCreate; varray[0] = &boxes[2]; gcd[4].gd.pos.width = 40; gcd[4].gd.pos.height = 250; gcd[4].gd.flags = gg_visible | gg_enabled; gcd[4].gd.u.drawable_e_h = kpdv_e_h; gcd[4].creator = GDrawableCreate; gcd[5].gd.flags = gg_enabled|gg_visible|gg_sb_vert; gcd[5].gd.cid = CID_ScrollBar; gcd[5].gd.handle_controlevent = KP_Scrolled; gcd[5].creator = GScrollBarCreate; harray[0] = &gcd[4]; harray[1] = &gcd[5]; harray[2] = NULL; boxes[3].gd.flags = gg_enabled|gg_visible; boxes[3].gd.u.boxelements = harray; boxes[3].creator = GHBoxCreate; varray[1] = &boxes[3]; gcd[6].gd.pos.x = 20-3; gcd[6].gd.pos.y = 17+37; gcd[6].gd.pos.width = -1; gcd[6].gd.pos.height = 0; gcd[6].gd.flags = gg_visible | gg_enabled | gg_but_default; label[6].text = (unichar_t *) _("_OK"); label[6].text_is_1byte = true; label[6].text_in_resource = true; gcd[6].gd.label = &label[6]; gcd[6].gd.cid = CID_OK; gcd[6].gd.handle_controlevent = KP_OK; gcd[6].creator = GButtonCreate; gcd[7].gd.pos.x = -20; gcd[7].gd.pos.y = gcd[6].gd.pos.y+3; gcd[7].gd.pos.width = -1; gcd[7].gd.pos.height = 0; gcd[7].gd.flags = gg_visible | gg_enabled | gg_but_cancel; label[7].text = (unichar_t *) _("_Cancel"); label[7].text_is_1byte = true; label[7].text_in_resource = true; gcd[7].gd.label = &label[7]; gcd[7].gd.cid = CID_Cancel; gcd[7].gd.handle_controlevent = KP_Cancel; gcd[7].creator = GButtonCreate; barray[0] = GCD_Glue; barray[1] = &gcd[6]; barray[2] = GCD_Glue; barray[3] = GCD_Glue; barray[4] = &gcd[7]; barray[5] = GCD_Glue; barray[6] = NULL; boxes[4].gd.flags = gg_enabled|gg_visible; boxes[4].gd.u.boxelements = barray; boxes[4].creator = GHBoxCreate; varray[2] = &boxes[4]; varray[3] = NULL; boxes[0].gd.flags = gg_enabled|gg_visible; boxes[0].gd.u.boxelements = varray; boxes[0].creator = GVBoxCreate; GGadgetsCreate(gw,boxes); GHVBoxSetExpandableRow(boxes[0].ret,1); GHVBoxSetExpandableCol(boxes[3].ret,0); GHVBoxSetExpandableCol(boxes[4].ret,gb_expandgluesame); GHVBoxSetPadding(boxes[0].ret,0,2); GHVBoxSetPadding(boxes[3].ret,0,0); kpd.v = GDrawableGetWindow(gcd[4].ret);; GGadgetGetSize(gcd[4].ret,&pos); kpd.sb_width = pos.width; GGadgetGetSize(gcd[3].ret,&pos); kpd.header_height = pos.y+pos.height+4; kpd.bdf = SplineFontPieceMeal(kpd.sf,kpd.layer,(intpt) (gcd[1].gd.label->userdata),72,true,NULL); if ( font==NULL ) { memset(&rq,'\0',sizeof(rq)); rq.utf8_family_name = SANS_UI_FAMILIES; rq.point_size = -12; rq.weight = 400; font = GDrawInstanciateFont(GDrawGetDisplayOfWindow(gw),&rq); font = GResourceFindFont("Combinations.Font",font); } kpd.font = font; GDrawFontMetrics(kpd.font,&as,&ds,&ld); kpd.fh = as+ds; kpd.as = as; kpd.uh = (4*kpd.bdf->pixelsize/3)+kpd.fh+6; kpd.vpad = kpd.bdf->pixelsize/5 + 3; GHVBoxFitWindow(boxes[0].ret); GDrawSetVisible(kpd.v,true); GDrawSetVisible(kpd.gw,true); while ( !kpd.done ) GDrawProcessOneEvent(NULL); free( kpd.kerns ); GDrawDestroyWindow(gw); }
void TransformDlgCreate(void *data,void (*transfunc)(void *,real *,int,BVTFunc *,enum fvtrans_flags), int (*getorigin)(void *,BasePoint *,int), enum transdlg_flags flags, enum cvtools cvt) { GRect pos; GWindow gw; GWindowAttrs wattrs; GGadgetCreateData gcd[12+TCnt*25], boxes[4], *subarray[TCnt*27], *array[2*(TCnt+8)+4], *buttons[13], *origarray[4]; GTextInfo label[9+TCnt*24]; static TransData td; int i, y, gci, subai, ai; int32 len; GGadget *orig; BasePoint junk; GTextInfo **ti; static int done = false; if ( !done ) { int i; for ( i=0; transformtypes[i].text!=NULL; ++i ) transformtypes[i].text = (unichar_t *) _((char *) transformtypes[i].text); for ( i=0; origin[i].text!=NULL; ++i ) origin[i].text = (unichar_t *) _((char *) origin[i].text); done = true; } td.userdata = data; td.transfunc = transfunc; td.getorigin = getorigin; td.done = false; if ( td.gw==NULL ) { memset(&wattrs,0,sizeof(wattrs)); wattrs.mask = wam_events|wam_cursor|wam_utf8_wtitle|wam_undercursor|wam_isdlg|wam_restrict; wattrs.event_masks = ~(1<<et_charup); wattrs.restrict_input_to_me = 1; wattrs.undercursor = 1; wattrs.cursor = ct_pointer; wattrs.utf8_window_title = _("Transform"); wattrs.is_dlg = true; pos.x = pos.y = 0; pos.width = GGadgetScale(GDrawPointsToPixels(NULL,TBlock_Width)); pos.height = GDrawPointsToPixels(NULL,TBlock_Top+TCnt*TBlock_Height+110); td.gw = gw = GDrawCreateTopWindow(NULL,&pos,trans_e_h,&td,&wattrs); memset(&label,0,sizeof(label)); memset(&gcd,0,sizeof(gcd)); memset(&boxes,0,sizeof(boxes)); label[0].text = (unichar_t *) _("Origin:"); label[0].text_is_1byte = true; label[0].text_in_resource = true; gcd[0].gd.label = &label[0]; gcd[0].gd.pos.x = 5; gcd[0].gd.pos.y = 4; gcd[0].gd.flags = (getorigin==NULL) ? gg_visible : (gg_visible | gg_enabled); gcd[0].creator = GLabelCreate; gcd[1].gd.pos.x = 5; gcd[1].gd.pos.y = 4; gcd[1].gd.flags = (getorigin==NULL) ? gg_visible : (gg_visible | gg_enabled); gcd[1].gd.label = &origin[1]; gcd[1].gd.u.list = origin; gcd[1].gd.cid = CID_Origin; gcd[1].creator = GListButtonCreate; origin[1].selected = true; origarray[0] = &gcd[0]; origarray[1] = &gcd[1]; origarray[2] = GCD_Glue; origarray[3] = NULL; boxes[3].gd.flags = gg_enabled|gg_visible; boxes[3].gd.u.boxelements = origarray; boxes[3].creator = GHBoxCreate; array[0] = &boxes[3]; array[1] = NULL; gci = 2; subai = 0; ai = 2; for ( i=0; i<TCnt; ++i ) { array[ai++] = MakeTransBlock(&td,i,gcd+gci,label+gci,subarray+subai); array[ai++] = NULL; gci += 23; subai += 27; } y = TBlock_Top+TCnt*TBlock_Height+4; gcd[gci].gd.pos.x = 10; gcd[gci].gd.pos.y = y; gcd[gci].gd.flags = (flags&tdf_enableback) ? (gg_visible | gg_enabled) : gg_visible; label[gci].text = (unichar_t *) _("Transform _All Layers"); label[gci].text_is_1byte = true; label[gci].text_in_resource = true; gcd[gci].gd.label = &label[gci]; gcd[gci].gd.cid = CID_AllLayers; gcd[gci++].creator = GCheckBoxCreate; array[ai++] = &gcd[gci-1]; array[ai++] = NULL; y += 16; gcd[gci].gd.pos.x = 10; gcd[gci].gd.pos.y = y; gcd[gci].gd.flags = (flags&tdf_enableback) ? (gg_visible | gg_enabled) : gg_visible; label[gci].text = (unichar_t *) _("Transform _Guide Layer Too"); label[gci].text_is_1byte = true; label[gci].text_in_resource = true; gcd[gci].gd.label = &label[gci]; gcd[gci].gd.cid = CID_DoGrid; gcd[gci++].creator = GCheckBoxCreate; array[ai++] = &gcd[gci-1]; array[ai++] = NULL; y += 16; gcd[gci].gd.pos.x = 10; gcd[gci].gd.pos.y = y; gcd[gci].gd.flags = (flags&tdf_enableback) ? (gg_visible | gg_enabled | gg_cb_on) : gg_visible; label[gci].text = (unichar_t *) _("Transform _Width Too"); label[gci].text_is_1byte = true; label[gci].text_in_resource = true; gcd[gci].gd.label = &label[gci]; gcd[gci].gd.cid = CID_DoWidth; gcd[gci++].creator = GCheckBoxCreate; array[ai++] = &gcd[gci-1]; array[ai++] = NULL; y += 16; gcd[gci].gd.pos.x = 10; gcd[gci].gd.pos.y = y; gcd[gci].gd.flags = gg_visible | (flags&tdf_enablekerns ? gg_enabled : 0) | (flags&tdf_defaultkerns ? gg_cb_on : 0); label[gci].text = (unichar_t *) _("Transform kerning _classes too"); label[gci].text_is_1byte = true; label[gci].text_in_resource = true; gcd[gci].gd.label = &label[gci]; gcd[gci].gd.cid = CID_DoKerns; gcd[gci++].creator = GCheckBoxCreate; array[ai++] = &gcd[gci-1]; array[ai++] = NULL; y += 16; gcd[gci].gd.pos.x = 10; gcd[gci].gd.pos.y = y; gcd[gci].gd.flags = gg_visible | (flags&tdf_enableback ? gg_enabled : 0) | (flags&tdf_enablekerns ? gg_cb_on : 0); label[gci].text = (unichar_t *) _("Transform simple positioning features & _kern pairs"); label[gci].text_is_1byte = true; label[gci].text_in_resource = true; gcd[gci].gd.label = &label[gci]; gcd[gci].gd.cid = CID_DoSimplePos; gcd[gci++].creator = GCheckBoxCreate; array[ai++] = &gcd[gci-1]; array[ai++] = NULL; y += 16; gcd[gci].gd.pos.x = 10; gcd[gci].gd.pos.y = y; gcd[gci].gd.flags = gg_visible | gg_enabled; label[gci].text = (unichar_t *) _("Round To _Int"); label[gci].text_is_1byte = true; label[gci].text_in_resource = true; gcd[gci].gd.label = &label[gci]; gcd[gci].gd.cid = CID_Round2Int; gcd[gci++].creator = GCheckBoxCreate; array[ai++] = &gcd[gci-1]; array[ai++] = NULL; y += 24; array[ai++] = GCD_Glue; array[ai++] = NULL; gcd[gci].gd.pos.x = 30-3; gcd[gci].gd.pos.y = y; gcd[gci].gd.flags = gg_visible | gg_enabled | gg_but_default; label[gci].text = (unichar_t *) _("_OK"); label[gci].text_is_1byte = true; label[gci].text_in_resource = true; gcd[gci].gd.mnemonic = 'O'; gcd[gci].gd.label = &label[gci]; gcd[gci].gd.handle_controlevent = Trans_OK; gcd[gci++].creator = GButtonCreate; buttons[0] = GCD_Glue; buttons[1] = &gcd[gci-1]; buttons[2] = GCD_Glue; buttons[3] = GCD_Glue; gcd[gci].gd.flags = gg_visible | gg_enabled; label[gci].text = (unichar_t *) _("_Apply"); label[gci].text_is_1byte = true; label[gci].text_in_resource = true; gcd[gci].gd.label = &label[gci]; gcd[gci].gd.handle_controlevent = Trans_OK; gcd[gci].gd.cid = CID_Apply; gcd[gci++].creator = GButtonCreate; buttons[4] = GCD_Glue; buttons[5] = &gcd[gci-1]; buttons[6] = GCD_Glue; buttons[7] = GCD_Glue; gcd[gci].gd.pos.x = -30; gcd[gci].gd.pos.y = gcd[gci-1].gd.pos.y+3; gcd[gci].gd.flags = gg_visible | gg_enabled | gg_but_cancel; label[gci].text = (unichar_t *) _("_Cancel"); label[gci].text_is_1byte = true; label[gci].text_in_resource = true; gcd[gci].gd.label = &label[gci]; gcd[gci].gd.mnemonic = 'C'; gcd[gci].gd.handle_controlevent = Trans_Cancel; gcd[gci++].creator = GButtonCreate; buttons[8] = GCD_Glue; buttons[9] = &gcd[gci-1]; buttons[10] = GCD_Glue; buttons[11] = NULL; boxes[2].gd.flags = gg_enabled|gg_visible; boxes[2].gd.u.boxelements = buttons; boxes[2].creator = GHBoxCreate; array[ai++] = &boxes[2]; array[ai++] = NULL; array[ai++] = 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 = array; boxes[0].creator = GHVGroupCreate; GGadgetsCreate(gw,boxes); GHVBoxSetExpandableRow(boxes[0].ret,gb_expandglue); GHVBoxSetExpandableCol(boxes[2].ret,gb_expandgluesame); GHVBoxSetExpandableCol(boxes[3].ret,gb_expandglue); for ( i=0; i<TCnt; ++i ) { GHVBoxSetPadding( GWidgetGetControl(gw,CID_ClockBox+i*TBlock_CIDOffset),0,0); GHVBoxSetPadding( GWidgetGetControl(gw,CID_HVBox+i*TBlock_CIDOffset),0,0); GHVBoxSetExpandableCol( GWidgetGetControl(gw,CID_HBox+i*TBlock_CIDOffset),gb_expandglue); } GGadgetSelectOneListItem( GWidgetGetControl(gw,CID_Type), 1); GWidgetToDesiredSize(gw); } else GDrawSetTransientFor(td.gw,(GWindow) -1); gw = td.gw; GGadgetSetEnabled( GWidgetGetControl(gw,CID_AllLayers), flags&tdf_enableback); GGadgetSetEnabled( GWidgetGetControl(gw,CID_DoGrid), flags&tdf_enableback); GGadgetSetEnabled( GWidgetGetControl(gw,CID_DoSimplePos), flags&tdf_enableback); GGadgetSetEnabled( GWidgetGetControl(gw,CID_DoKerns), flags&tdf_enablekerns); GGadgetSetVisible( GWidgetGetControl(gw,CID_Apply), flags&tdf_addapply); if ( !(flags&tdf_enableback) ) { GGadgetSetChecked( GWidgetGetControl(gw,CID_AllLayers), false ); GGadgetSetChecked( GWidgetGetControl(gw,CID_DoGrid), false ); } GGadgetSetChecked( GWidgetGetControl(gw,CID_DoKerns), !(flags&tdf_enablekerns)?false:(flags&tdf_defaultkerns)?true:false ); /* Yes, this is set differently from the previous, that's intended */ GGadgetSetChecked( GWidgetGetControl(gw,CID_DoSimplePos), !(flags&tdf_enableback)?false:(flags&tdf_enablekerns)?true:false ); orig = GWidgetGetControl(gw,CID_Origin); GGadgetSetEnabled( orig, getorigin!=NULL ); ti = GGadgetGetList(orig,&len); for ( i=0; i<len; ++i ) { ti[i]->disabled = !getorigin(data,&junk,i); if ( ti[i]->disabled && ti[i]->selected ) { ti[i]->selected = false; ti[0]->selected = true; GGadgetSetTitle(orig,ti[0]->text); } } if ( cvt!=cvt_none ) { int index = cvt == cvt_scale ? 4 : cvt == cvt_flip ? 5 : cvt == cvt_rotate ? 2 : cvt == cvt_skew ? 6 : /* 3d rot*/ 7 ; GGadget *firstoption = GWidgetGetControl(td.gw,CID_Type); GEvent dummy; GGadgetSelectOneListItem( firstoption, index ); memset(&dummy,0,sizeof(dummy)); dummy.type = et_controlevent; dummy.u.control.subtype = et_listselected; Trans_TypeChange( firstoption, &dummy ); } for ( i=0; i<TCnt; ++i ) { int index = GGadgetGetFirstListSelectedItem(GWidgetGetControl(td.gw,CID_Type+i*TBlock_CIDOffset)); if ( selcid[index]!=0 ) { GGadget *tf = GWidgetGetControl(td.gw,selcid[index]+i*TBlock_CIDOffset); GWidgetIndicateFocusGadget(tf); GTextFieldSelect(tf,0,-1); break; } } GWidgetHidePalettes(); GDrawSetVisible(gw,true); while ( !td.done ) GDrawProcessOneEvent(NULL); GDrawSetVisible(gw,false); }
static void Layer2Layer(CharView *cv,FontView *fv,enum l2l_type l2l,int def_layer) { L2LDlg d; GRect pos; GWindow gw; GWindowAttrs wattrs; GGadgetCreateData gcd[17], *hvarray[34], *harray[5], *harray2[8], *hvarray2[7], boxes[7]; GTextInfo label[17]; int k,j; memset(&d,0,sizeof(d)); d.cv = cv; d.fv = fv; d.l2l = l2l; if ( cv!=NULL ) d.sf = cv->b.sc->parent; else d.sf = fv->b.sf; memset(&wattrs,0,sizeof(wattrs)); wattrs.mask = wam_events|wam_cursor|wam_utf8_wtitle|wam_undercursor|wam_isdlg|wam_restrict; wattrs.event_masks = ~(1<<et_charup); wattrs.restrict_input_to_me = 1; wattrs.undercursor = 1; wattrs.cursor = ct_pointer; wattrs.utf8_window_title = l2l==l2l_copy ? _("Copy Layers") : _("Compare Layers"); wattrs.is_dlg = true; pos.x = pos.y = 0; pos.width = GGadgetScale(GDrawPointsToPixels(NULL,170)); pos.height = GDrawPointsToPixels(NULL,178); d.gw = gw = GDrawCreateTopWindow(NULL,&pos,l2l_e_h,&d,&wattrs); memset(&label,0,sizeof(label)); memset(&gcd,0,sizeof(gcd)); memset(&boxes,0,sizeof(boxes)); k=j=0; label[k].text = (unichar_t *) (l2l==l2l_copy ? _("Copy one layer to another") : _("Compare two layers")); label[k].text_is_1byte = true; gcd[k].gd.label = &label[k]; gcd[k].gd.flags = gg_enabled|gg_visible; gcd[k++].creator = GLabelCreate; hvarray[j++] = &gcd[k-1]; hvarray[j++] = NULL; label[k].text = (unichar_t *) (l2l==l2l_copy ? _("From:") : _("Base:")); label[k].text_is_1byte = true; gcd[k].gd.label = &label[k]; gcd[k].gd.flags = gg_enabled|gg_visible; gcd[k++].creator = GLabelCreate; hvarray2[0] = &gcd[k-1]; gcd[k].gd.flags = gg_enabled|gg_visible; gcd[k].gd.cid = CID_FromLayer; gcd[k].gd.u.list = SFLayerList(d.sf,def_layer); gcd[k++].creator = GListButtonCreate; hvarray2[1] = &gcd[k-1]; hvarray2[2] = NULL; label[k].text = (unichar_t *) (l2l==l2l_copy ? _("To:") : _("Other:")); label[k].text_is_1byte = true; gcd[k].gd.label = &label[k]; gcd[k].gd.flags = gg_enabled|gg_visible; gcd[k++].creator = GLabelCreate; hvarray2[3] = &gcd[k-1]; gcd[k].gd.flags = gg_enabled|gg_visible; gcd[k].gd.cid = CID_ToLayer; gcd[k].gd.u.list = SFLayerList(d.sf,def_layer==ly_fore ? ly_back : ly_fore ); gcd[k++].creator = GListButtonCreate; hvarray2[4] = &gcd[k-1]; hvarray2[5] = NULL; hvarray2[6] = NULL; boxes[3].gd.flags = gg_enabled|gg_visible; boxes[3].gd.u.boxelements = hvarray2; boxes[3].creator = GHVBoxCreate; hvarray[j++] = &boxes[3]; hvarray[j++] = NULL; if ( l2l==l2l_copy ) { label[k].text = (unichar_t *) _("Clear destination layer before copy"); label[k].text_is_1byte = true; gcd[k].gd.label = &label[k]; gcd[k].gd.cid = CID_ClearOld; gcd[k].gd.flags = gg_enabled|gg_visible|gg_cb_on; gcd[k++].creator = GCheckBoxCreate; hvarray[j++] = &gcd[k-1]; hvarray[j++] = NULL; } else { label[k].text = (unichar_t *) _("Allow errors of:"); label[k].text_is_1byte = true; gcd[k].gd.label = &label[k]; gcd[k].gd.flags = gg_enabled|gg_visible; gcd[k++].creator = GLabelCreate; harray[0] = &gcd[k-1]; label[k].text = (unichar_t *) "1"; label[k].text_is_1byte = true; gcd[k].gd.pos.width = 50; gcd[k].gd.label = &label[k]; gcd[k].gd.flags = gg_enabled|gg_visible; gcd[k].gd.cid = CID_ErrorBound; gcd[k++].creator = GTextFieldCreate; harray[1] = &gcd[k-1]; label[k].text = (unichar_t *) _("em units"); label[k].text_is_1byte = true; gcd[k].gd.label = &label[k]; gcd[k].gd.flags = gg_enabled|gg_visible; gcd[k++].creator = GLabelCreate; harray[2] = &gcd[k-1]; harray[3] = GCD_Glue; harray[4] = NULL; boxes[4].gd.flags = gg_enabled|gg_visible; boxes[4].gd.u.boxelements = harray; boxes[4].creator = GHBoxCreate; hvarray[j++] = &boxes[4]; hvarray[j++] = NULL; } gcd[k].gd.flags = gg_visible | gg_enabled | gg_but_default; label[k].text = (unichar_t *) _("_OK"); label[k].text_is_1byte = true; label[k].text_in_resource = true; gcd[k].gd.label = &label[k]; gcd[k].gd.handle_controlevent = L2L_OK; gcd[k++].creator = GButtonCreate; harray2[0] = GCD_Glue; harray2[1] = &gcd[k-1]; harray2[2] = GCD_Glue; harray2[3] = GCD_Glue; gcd[k].gd.flags = gg_visible | gg_enabled | gg_but_cancel; 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.handle_controlevent = L2L_Cancel; gcd[k++].creator = GButtonCreate; harray2[4] = GCD_Glue; harray2[5] = &gcd[k-1]; harray2[6] = GCD_Glue; harray2[7] = NULL; boxes[2].gd.flags = gg_enabled|gg_visible; boxes[2].gd.u.boxelements = harray2; boxes[2].creator = GHBoxCreate; hvarray[j++] = &boxes[2]; hvarray[j++] = NULL; hvarray[j++] = GCD_Glue; hvarray[j++] = NULL; hvarray[j++] = 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 = hvarray; boxes[0].creator = GHVGroupCreate; GGadgetsCreate(gw,boxes); GHVBoxSetExpandableRow(boxes[0].ret,gb_expandglue); GHVBoxSetExpandableCol(boxes[2].ret,gb_expandgluesame); if ( l2l==l2l_compare ) GHVBoxSetExpandableRow(boxes[4].ret,gb_expandglue); GHVBoxFitWindow(boxes[0].ret); GDrawSetVisible(gw,true); while ( !d.done ) GDrawProcessOneEvent(NULL); GDrawDestroyWindow(gw); }
void ShadowDlg(FontView *fv, CharView *cv,MetricsView *mv,int wireframe) { GRect pos; GWindow gw; GWindowAttrs wattrs; GGadgetCreateData gcd[10], *butarray[7], *hvarray[16], boxes[3]; GTextInfo label[10]; OutlineData od; char buffer[20], buffer2[20], buffer3[20]; int i, k; od.done = false; od.fv = fv; od.cv = cv; od.mv = mv; od.wireframe = wireframe; memset(&wattrs,0,sizeof(wattrs)); wattrs.mask = wam_events|wam_cursor|wam_utf8_wtitle|wam_undercursor|wam_isdlg|wam_restrict; wattrs.event_masks = ~(1<<et_charup); wattrs.restrict_input_to_me = 1; wattrs.undercursor = 1; wattrs.cursor = ct_pointer; wattrs.utf8_window_title = _("Shadow"); wattrs.is_dlg = true; pos.x = pos.y = 0; pos.width = GGadgetScale(GDrawPointsToPixels(NULL,160)); pos.height = GDrawPointsToPixels(NULL,125); od.gw = gw = GDrawCreateTopWindow(NULL,&pos,od_e_h,&od,&wattrs); memset(&label,0,sizeof(label)); memset(&gcd,0,sizeof(gcd)); memset(&boxes,0,sizeof(boxes)); i = k = 0; label[i].text = (unichar_t *) _("Outline Width:"); label[i].text_is_1byte = true; gcd[i].gd.label = &label[i]; gcd[i].gd.pos.x = 7; gcd[i].gd.pos.y = 7+3; gcd[i].gd.flags = gg_enabled|gg_visible; gcd[i++].creator = GLabelCreate; hvarray[k++] = &gcd[i-1]; sprintf( buffer, "%g", def_outline_width ); label[i].text = (unichar_t *) buffer; label[i].text_is_1byte = true; gcd[i].gd.label = &label[i]; gcd[i].gd.pos.x = 90; gcd[i].gd.pos.y = 7; gcd[i].gd.pos.width = 50; gcd[i].gd.flags = gg_enabled|gg_visible; gcd[i].gd.cid = CID_Width; gcd[i++].creator = GTextFieldCreate; hvarray[k++] = &gcd[i-1]; hvarray[k++] = NULL; label[i].text = (unichar_t *) _("Shadow Length:"); label[i].text_is_1byte = true; gcd[i].gd.label = &label[i]; gcd[i].gd.pos.x = gcd[i-2].gd.pos.x; gcd[i].gd.pos.y = gcd[i-2].gd.pos.y+26; gcd[i].gd.flags = gg_enabled|gg_visible; gcd[i++].creator = GLabelCreate; hvarray[k++] = &gcd[i-1]; sprintf( buffer2, "%g", def_shadow_len ); label[i].text = (unichar_t *) buffer2; label[i].text_is_1byte = true; gcd[i].gd.label = &label[i]; gcd[i].gd.pos.x = gcd[i-2].gd.pos.x; gcd[i].gd.pos.y = gcd[i-1].gd.pos.y-3; gcd[i].gd.pos.width = gcd[i-2].gd.pos.width; gcd[i].gd.flags = gg_enabled|gg_visible; gcd[i].gd.cid = CID_ShadowLen; gcd[i++].creator = GTextFieldCreate; hvarray[k++] = &gcd[i-1]; hvarray[k++] = NULL; label[i].text = (unichar_t *) _("Light Angle:"); label[i].text_is_1byte = true; gcd[i].gd.label = &label[i]; gcd[i].gd.pos.x = gcd[i-2].gd.pos.x; gcd[i].gd.pos.y = gcd[i-2].gd.pos.y+26; gcd[i].gd.flags = gg_enabled|gg_visible; gcd[i++].creator = GLabelCreate; hvarray[k++] = &gcd[i-1]; sprintf( buffer3, "%g", def_sun_angle ); label[i].text = (unichar_t *) buffer3; label[i].text_is_1byte = true; gcd[i].gd.label = &label[i]; gcd[i].gd.pos.x = gcd[i-2].gd.pos.x; gcd[i].gd.pos.y = gcd[i-1].gd.pos.y-3; gcd[i].gd.pos.width = gcd[i-2].gd.pos.width; gcd[i].gd.flags = gg_enabled|gg_visible; gcd[i].gd.cid = CID_LightAngle; gcd[i++].creator = GTextFieldCreate; hvarray[k++] = &gcd[i-1]; hvarray[k++] = NULL; hvarray[k++] = &boxes[2]; hvarray[k++] = GCD_ColSpan; hvarray[k++] = NULL; hvarray[k++] = GCD_Glue; hvarray[k++] = GCD_Glue; hvarray[k++] = NULL; hvarray[k] = NULL; k = 0; gcd[i].gd.pos.x = 20-3; gcd[i].gd.pos.y = gcd[i-2].gd.pos.y+30; gcd[i].gd.pos.width = -1; gcd[i].gd.pos.height = 0; gcd[i].gd.flags = gg_visible | gg_enabled | gg_but_default; label[i].text = (unichar_t *) _("_OK"); label[i].text_is_1byte = true; label[i].text_in_resource = true; gcd[i].gd.label = &label[i]; gcd[i].gd.handle_controlevent = SD_OK; gcd[i++].creator = GButtonCreate; butarray[k++] = GCD_Glue; butarray[k++] = &gcd[i-1]; butarray[k++] = GCD_Glue; gcd[i].gd.pos.x = -20; gcd[i].gd.pos.y = gcd[i-1].gd.pos.y+3; gcd[i].gd.pos.width = -1; gcd[i].gd.pos.height = 0; gcd[i].gd.flags = gg_visible | gg_enabled | gg_but_cancel; label[i].text = (unichar_t *) _("_Cancel"); label[i].text_is_1byte = true; label[i].text_in_resource = true; gcd[i].gd.label = &label[i]; gcd[i].gd.handle_controlevent = OD_Cancel; gcd[i++].creator = GButtonCreate; butarray[k++] = GCD_Glue; butarray[k++] = &gcd[i-1]; butarray[k++] = GCD_Glue; butarray[k] = NULL; boxes[2].gd.flags = gg_enabled|gg_visible; boxes[2].gd.u.boxelements = butarray; boxes[2].creator = GHBoxCreate; boxes[0].gd.pos.x = boxes[0].gd.pos.y = 2; boxes[0].gd.flags = gg_enabled|gg_visible; boxes[0].gd.u.boxelements = hvarray; boxes[0].creator = GHVGroupCreate; gcd[i].gd.pos.x = 2; gcd[i].gd.pos.y = 2; gcd[i].gd.pos.width = pos.width-4; gcd[i].gd.pos.height = pos.height-4; gcd[i].gd.flags = gg_enabled|gg_visible|gg_pos_in_pixels; gcd[i].creator = GGroupCreate; GGadgetsCreate(gw,boxes); GHVBoxSetExpandableRow(boxes[0].ret,gb_expandglue); GHVBoxSetExpandableCol(boxes[2].ret,gb_expandgluesame); GHVBoxFitWindow(boxes[0].ret); GWidgetIndicateFocusGadget(GWidgetGetControl(gw,CID_ShadowLen)); GTextFieldSelect(GWidgetGetControl(gw,CID_ShadowLen),0,-1); GWidgetHidePalettes(); GDrawSetVisible(gw,true); while ( !od.done ) GDrawProcessOneEvent(NULL); GDrawSetVisible(gw,false); }
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 ); }
unichar_t *FVOpenFont(char *title, const char *defaultfile, int mult) { GRect pos; int i, filter, renamei; GWindow gw; GWindowAttrs wattrs; GGadgetCreateData gcd[11], boxes[5], *varray[9], *harray1[7], *harray2[4], *harray3[9]; GTextInfo label[10]; struct gfc_data d; int bs = GIntGetResource(_NUM_Buttonsize), bsbigger, totwid, spacing; GGadget *tf; unichar_t *temp; char **nlnames; GTextInfo *namelistnames, **filts; int cnt; memset(&d,'\0',sizeof(d)); memset(&wattrs,0,sizeof(wattrs)); wattrs.mask = wam_events|wam_cursor|wam_utf8_wtitle|wam_undercursor|wam_isdlg|wam_restrict; wattrs.event_masks = ~(1<<et_charup); wattrs.restrict_input_to_me = 1; wattrs.is_dlg = true; wattrs.undercursor = 1; wattrs.cursor = ct_pointer; wattrs.utf8_window_title = title; pos.x = pos.y = 0; totwid = GGadgetScale(295); bsbigger = 4*bs+4*14>totwid; totwid = bsbigger?4*bs+4*12:totwid; spacing = (totwid-4*bs-2*12)/3; pos.width = GDrawPointsToPixels(NULL,totwid); pos.height = GDrawPointsToPixels(NULL,247); gw = GDrawCreateTopWindow(NULL,&pos,e_h,&d,&wattrs); memset(&label,0,sizeof(label)); memset(&gcd,0,sizeof(gcd)); memset(&boxes,0,sizeof(boxes)); i=0; gcd[i].gd.pos.x = 12; gcd[i].gd.pos.y = 6; gcd[i].gd.pos.width = totwid*100/GIntGetResource(_NUM_ScaleFactor)-24; gcd[i].gd.pos.height = 180; gcd[i].gd.flags = gg_visible | gg_enabled; if ( RecentFiles[0]!=NULL ) gcd[i].gd.flags = gg_visible | gg_enabled | gg_file_pulldown; if ( mult ) gcd[i].gd.flags |= gg_file_multiple; varray[0] = &gcd[i]; varray[1] = NULL; gcd[i++].creator = GFileChooserCreate; label[i].text = (unichar_t *) _("Filter:"); label[i].text_is_1byte = true; gcd[i].gd.label = &label[i]; gcd[i].gd.pos.x = 8; gcd[i].gd.pos.y = 188+6; gcd[i].gd.flags = gg_visible | gg_enabled | gg_utf8_popup; gcd[i].gd.popup_msg = (unichar_t *) _("Display files of this type" ); harray1[0] = GCD_Glue; harray1[1] = &gcd[i]; gcd[i++].creator = GLabelCreate; gcd[i].gd.pos.x = 0; gcd[i].gd.pos.y = gcd[i-1].gd.pos.y-6; gcd[i].gd.flags = gg_visible | gg_enabled | gg_utf8_popup; gcd[i].gd.popup_msg = (unichar_t *) _("Display files of this type"); gcd[i].gd.handle_controlevent = GFD_FilterSelected; harray1[2] = &gcd[i]; harray1[3] = GCD_Glue; harray1[4] = GCD_Glue; harray1[5] = GCD_Glue; harray1[6] = NULL; gcd[i++].creator = GListButtonCreate; boxes[2].gd.flags = gg_visible | gg_enabled; boxes[2].gd.u.boxelements = harray1; boxes[2].creator = GHBoxCreate; varray[2] = &boxes[2]; varray[3] = NULL; label[i].text = (unichar_t *) _("Force glyph names to:"); label[i].text_is_1byte = true; gcd[i].gd.label = &label[i]; gcd[i].gd.pos.x = 8; gcd[i].gd.pos.y = 188+6; gcd[i].gd.flags = gg_visible | gg_enabled | gg_utf8_popup; gcd[i].gd.popup_msg = (unichar_t *) _("In the saved font, force all glyph names to match those in the specified namelist"); harray2[0] = &gcd[i]; gcd[i++].creator = GLabelCreate; renamei = i; gcd[i].gd.pos.x = 0; gcd[i].gd.pos.y = gcd[i-1].gd.pos.y-6; gcd[i].gd.flags = gg_visible | gg_enabled | gg_utf8_popup; gcd[i].gd.popup_msg = (unichar_t *) _("In the saved font, force all glyph names to match those in the specified namelist"); gcd[i].creator = GListButtonCreate; nlnames = AllNamelistNames(); for ( cnt=0; nlnames[cnt]!=NULL; ++cnt); namelistnames = calloc(cnt+3,sizeof(GTextInfo)); namelistnames[0].text = (unichar_t *) _("No Rename"); namelistnames[0].text_is_1byte = true; if ( force_names_when_opening==NULL ) { namelistnames[0].selected = true; gcd[i].gd.label = &namelistnames[0]; } namelistnames[1].line = true; for ( cnt=0; nlnames[cnt]!=NULL; ++cnt) { namelistnames[cnt+2].text = (unichar_t *) nlnames[cnt]; namelistnames[cnt+2].text_is_1byte = true; if ( force_names_when_opening!=NULL && strcmp(_(force_names_when_opening->title),nlnames[cnt])==0 ) { namelistnames[cnt+2].selected = true; gcd[i].gd.label = &namelistnames[cnt+2]; } } harray2[1] = &gcd[i]; harray2[2] = GCD_Glue; harray2[3] = NULL; gcd[i++].gd.u.list = namelistnames; boxes[3].gd.flags = gg_visible | gg_enabled; boxes[3].gd.u.boxelements = harray2; boxes[3].creator = GHBoxCreate; varray[4] = &boxes[3]; varray[5] = NULL; gcd[i].gd.pos.x = 12; gcd[i].gd.pos.y = 216-3; gcd[i].gd.pos.width = -1; gcd[i].gd.flags = gg_visible | gg_enabled | gg_but_default; label[i].text = (unichar_t *) _("_OK"); label[i].text_is_1byte = true; label[i].text_in_resource = true; gcd[i].gd.mnemonic = 'O'; gcd[i].gd.label = &label[i]; gcd[i].gd.handle_controlevent = GFD_Ok; harray3[0] = GCD_Glue; harray3[1] = &gcd[i]; gcd[i++].creator = GButtonCreate; gcd[i].gd.pos.x = -(spacing+bs)*100/GIntGetResource(_NUM_ScaleFactor)-12; gcd[i].gd.pos.y = gcd[i-1].gd.pos.y+3; gcd[i].gd.pos.width = -1; gcd[i].gd.flags = gg_visible | gg_enabled; label[i].text = (unichar_t *) S_("Font|_New"); label[i].text_is_1byte = true; label[i].text_in_resource = true; gcd[i].gd.mnemonic = 'N'; gcd[i].gd.label = &label[i]; gcd[i].gd.handle_controlevent = GFD_New; harray3[2] = GCD_Glue; harray3[3] = &gcd[i]; gcd[i++].creator = GButtonCreate; filter = i; gcd[i].gd.pos.x = (spacing+bs)*100/GIntGetResource(_NUM_ScaleFactor)+12; gcd[i].gd.pos.y = gcd[i-1].gd.pos.y; gcd[i].gd.pos.width = -1; gcd[i].gd.flags = /* gg_visible |*/ gg_enabled; label[i].text = (unichar_t *) _("_Filter"); label[i].text_is_1byte = true; label[i].text_in_resource = true; gcd[i].gd.mnemonic = 'F'; gcd[i].gd.label = &label[i]; gcd[i].gd.handle_controlevent = GFileChooserFilterEh; harray3[4] = &gcd[i]; gcd[i++].creator = GButtonCreate; gcd[i].gd.pos.x = -12; gcd[i].gd.pos.y = gcd[i-1].gd.pos.y; gcd[i].gd.pos.width = -1; gcd[i].gd.flags = gg_visible | gg_enabled | gg_but_cancel; label[i].text = (unichar_t *) _("_Cancel"); label[i].text_is_1byte = true; label[i].text_in_resource = true; gcd[i].gd.label = &label[i]; gcd[i].gd.mnemonic = 'C'; gcd[i].gd.handle_controlevent = GFD_Cancel; harray3[5] = GCD_Glue; harray3[6] = &gcd[i]; harray3[7] = GCD_Glue; harray3[8] = NULL; gcd[i++].creator = GButtonCreate; boxes[4].gd.flags = gg_visible | gg_enabled; boxes[4].gd.u.boxelements = harray3; boxes[4].creator = GHBoxCreate; varray[6] = &boxes[4]; varray[7] = NULL; varray[8] = NULL; boxes[0].gd.pos.x = boxes[0].gd.pos.y = 2; boxes[0].gd.flags = gg_visible | gg_enabled; boxes[0].gd.u.boxelements = varray; boxes[0].creator = GHVGroupCreate; gcd[i].gd.pos.x = 2; gcd[i].gd.pos.y = 2; gcd[i].gd.pos.width = pos.width-4; gcd[i].gd.pos.height = pos.height-4; gcd[i].gd.flags = gg_enabled | gg_visible | gg_pos_in_pixels; gcd[i++].creator = GGroupCreate; GGadgetsCreate(gw,boxes); d.gfc = gcd[0].ret; d.rename = gcd[renamei].ret; filts = StandardFilters(); GGadgetSetList(harray1[2]->ret,filts,true); GHVBoxSetExpandableRow(boxes[0].ret,0); GHVBoxSetExpandableCol(boxes[2].ret,gb_expandglue); GHVBoxSetExpandableCol(boxes[3].ret,gb_expandglue); GHVBoxSetExpandableCol(boxes[4].ret,gb_expandgluesame); GHVBoxFitWindow(boxes[0].ret); free(namelistnames); GGadgetSetUserData(gcd[filter].ret,gcd[0].ret); GFileChooserConnectButtons(gcd[0].ret,harray3[1]->ret,gcd[filter].ret); temp = utf82u_copy(filts[default_font_filter_index]->userdata); GFileChooserSetFilterText(gcd[0].ret,temp); free(temp); GFileChooserGetChildren(gcd[0].ret,NULL, NULL, &tf); if ( RecentFiles[0]!=NULL ) { GGadgetSetList(tf,GTextInfoFromChars(RecentFiles,RECENT_MAX),false); } GGadgetSetTitle8(gcd[0].ret,defaultfile); GWidgetHidePalettes(); GDrawSetVisible(gw,true); while ( !d.done ) GDrawProcessOneEvent(NULL); GDrawDestroyWindow(gw); GDrawProcessPendingEvents(NULL); /* Give the window a chance to vanish... */ GDrawSync(NULL); GDrawProcessPendingEvents(NULL); /* Give the window a chance to vanish... */ free( d.lastpopupfontname ); GTextInfoArrayFree(filts); for ( cnt=0; nlnames[cnt]!=NULL; ++cnt) { free(nlnames[cnt]); } free(nlnames); return(d.ret); }
char *GlyphListDlg(SplineFont *sf, char *glyphstr) { int i, k, j; GRect pos; GWindow gw; GWindowAttrs wattrs; GGadgetCreateData gcd[4], boxes[3]; GGadgetCreateData *varray[6], *harray3[8]; GTextInfo label[4]; struct matrixinit mi; struct glyph_list_dlg gld; memset(&gld,0,sizeof(gld)); gld.sf = sf; memset(&wattrs,0,sizeof(wattrs)); wattrs.mask = wam_events|wam_cursor|wam_utf8_wtitle|wam_undercursor|wam_isdlg|wam_restrict; wattrs.event_masks = ~(1<<et_charup); wattrs.is_dlg = true; wattrs.restrict_input_to_me = 1; wattrs.undercursor = 1; wattrs.cursor = ct_pointer; wattrs.utf8_window_title = _("Extender Glyphs (kashidas, etc.)"); pos.x = pos.y = 0; pos.width =GDrawPointsToPixels(NULL,GGadgetScale(268)); pos.height = GDrawPointsToPixels(NULL,375); gld.gw = gw = GDrawCreateTopWindow(NULL,&pos,glyph_e_h,&gld,&wattrs); GlyphMatrixInit(&mi,glyphstr,sf); memset(&gcd,0,sizeof(gcd)); memset(&boxes,0,sizeof(boxes)); memset(&label,0,sizeof(label)); k=j=0; gcd[k].gd.pos.x = 10; gcd[k].gd.pos.y = gcd[1].gd.pos.y+14; gcd[k].gd.flags = gg_enabled | gg_visible | gg_utf8_popup; gcd[k].gd.cid = CID_Glyphs; gcd[k].gd.u.matrix = &mi; gcd[k].gd.popup_msg = (unichar_t *) _( "A list of glyph names"); gcd[k].creator = GMatrixEditCreate; varray[j++] = &gcd[k++]; varray[j++] = NULL; gcd[k].gd.pos.x = 30-3; gcd[k].gd.pos.width = -1; gcd[k].gd.pos.height = 0; gcd[k].gd.flags = gg_visible | gg_enabled | gg_but_default; label[k].text = (unichar_t *) _("_OK"); label[k].text_is_1byte = true; label[k].text_in_resource = true; gcd[k].gd.label = &label[k]; gcd[k].gd.handle_controlevent = JSTF_Glyph_OK; gcd[k].gd.cid = CID_OK; gcd[k++].creator = GButtonCreate; gcd[k].gd.pos.x = -30; gcd[k].gd.pos.width = -1; gcd[k].gd.pos.height = 0; gcd[k].gd.flags = gg_visible | gg_enabled | gg_but_cancel; 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.handle_controlevent = JSTF_Glyph_Cancel; gcd[k].gd.cid = CID_Cancel; gcd[k++].creator = GButtonCreate; harray3[0] = harray3[2] = harray3[3] = harray3[4] = harray3[6] = GCD_Glue; harray3[7] = NULL; harray3[1] = &gcd[k-2]; harray3[5] = &gcd[k-1]; boxes[0].gd.flags = gg_enabled|gg_visible; boxes[0].gd.u.boxelements = harray3; boxes[0].creator = GHBoxCreate; varray[j++] = &boxes[0]; varray[j++] = NULL; varray[j] = NULL; boxes[1].gd.pos.x = boxes[1].gd.pos.y = 2; boxes[1].gd.flags = gg_enabled|gg_visible; boxes[1].gd.u.boxelements = varray; boxes[1].creator = GHVGroupCreate; GGadgetsCreate(gw,boxes+1); for ( i=0; i<mi.initial_row_cnt; ++i ) { free( mi.matrix_data[2*i+0].u.md_str ); } free( mi.matrix_data ); GMatrixEditSetNewText(gcd[0].ret,S_("GlyphName|New")); GMatrixEditSetColumnCompletion(gcd[0].ret, 0, JSTF_Glyph_Completion ); GHVBoxSetExpandableCol(boxes[0].ret,gb_expandgluesame); GHVBoxFitWindow(boxes[1].ret); GDrawSetVisible(gw,true); while ( !gld.done ) GDrawProcessOneEvent(NULL); GDrawDestroyWindow(gw); return( gld.ret ); }
void ScriptDlg(FontView *fv,CharView *cv) { GRect pos; static GWindow gw; GWindowAttrs wattrs; GGadgetCreateData gcd[12], boxes[5], *barray[4][8], *hvarray[4][2]; #if !defined(_NO_FFSCRIPT) && !defined(_NO_PYTHON) GGadgetCreateData *rarray[4]; #endif GTextInfo label[12]; struct sd_data sd; FontView *list; int i,l; memset(&sd,0,sizeof(sd)); sd.fv = fv; sd.sc = cv==NULL ? NULL : cv->b.sc; sd.layer = cv==NULL ? ly_fore : CVLayer((CharViewBase *) cv); sd.oldh = pos.height = GDrawPointsToPixels(NULL,SD_Height); if ( gw==NULL ) { memset(&wattrs,0,sizeof(wattrs)); wattrs.mask = wam_events|wam_cursor|wam_utf8_wtitle|wam_undercursor|wam_restrict|wam_isdlg; wattrs.event_masks = ~(1<<et_charup); wattrs.restrict_input_to_me = 1; wattrs.undercursor = 1; wattrs.cursor = ct_pointer; wattrs.utf8_window_title = _("Execute Script"); wattrs.is_dlg = true; pos.x = pos.y = 0; pos.width = GDrawPointsToPixels(NULL,GGadgetScale(SD_Width)); gw = GDrawCreateTopWindow(NULL,&pos,sd_e_h,&sd,&wattrs); memset(&boxes,0,sizeof(boxes)); memset(&gcd,0,sizeof(gcd)); memset(&label,0,sizeof(label)); i = l = 0; gcd[i].gd.pos.x = 10; gcd[i].gd.pos.y = 10; gcd[i].gd.pos.width = SD_Width-20; gcd[i].gd.pos.height = SD_Height-54; gcd[i].gd.flags = gg_visible | gg_enabled | gg_textarea_wrap; gcd[i].gd.cid = CID_Script; gcd[i++].creator = GTextAreaCreate; hvarray[l][0] = &gcd[i-1]; hvarray[l++][1] = NULL; #if !defined(_NO_FFSCRIPT) && !defined(_NO_PYTHON) gcd[i-1].gd.pos.height -= 24; gcd[i].gd.pos.x = 10; gcd[i].gd.pos.y = gcd[i-1].gd.pos.y+gcd[i-1].gd.pos.height+1; gcd[i].gd.flags = gg_visible | gg_enabled | gg_cb_on; gcd[i].gd.cid = CID_Python; label[i].text = (unichar_t *) _("_Python"); label[i].text_is_1byte = true; label[i].text_in_resource = true; gcd[i].gd.label = &label[i]; gcd[i].gd.handle_controlevent = SD_LangChanged; gcd[i++].creator = GRadioCreate; rarray[0] = &gcd[i-1]; gcd[i].gd.pos.x = 70; gcd[i].gd.pos.y = gcd[i-1].gd.pos.y; gcd[i].gd.flags = gg_visible | gg_enabled; /* disabled if cv!=NULL later */ gcd[i].gd.cid = CID_FF; label[i].text = (unichar_t *) _("_FF"); label[i].text_is_1byte = true; label[i].text_in_resource = true; gcd[i].gd.label = &label[i]; gcd[i].gd.handle_controlevent = SD_LangChanged; gcd[i++].creator = GRadioCreate; rarray[1] = &gcd[i-1]; rarray[2] = GCD_Glue; rarray[3] = NULL; boxes[2].gd.flags = gg_enabled | gg_visible; boxes[2].gd.u.boxelements = rarray; boxes[2].creator = GHBoxCreate; hvarray[l][0] = &boxes[2]; hvarray[l++][1] = NULL; #endif barray[0][0] = barray[1][0] = barray[0][6] = barray[1][6] = GCD_Glue; barray[0][2] = barray[1][2] = barray[0][4] = barray[1][4] = GCD_Glue; barray[0][1] = barray[0][5] = GCD_RowSpan; barray[0][7] = barray[1][7] = barray[2][0] = NULL; gcd[i].gd.pos.x = 25-3; gcd[i].gd.pos.y = SD_Height-32-3; gcd[i].gd.flags = gg_visible | gg_enabled | gg_but_default; label[i].text = (unichar_t *) _("_OK"); label[i].text_is_1byte = true; label[i].text_in_resource = true; gcd[i].gd.mnemonic = 'O'; gcd[i].gd.label = &label[i]; gcd[i].gd.handle_controlevent = SD_OK; gcd[i].gd.cid = CID_OK; gcd[i++].creator = GButtonCreate; barray[1][1] = &gcd[i-1]; gcd[i].gd.pos.x = -25; gcd[i].gd.pos.y = SD_Height-32; gcd[i].gd.flags = gg_visible | gg_enabled | gg_but_cancel; label[i].text = (unichar_t *) _("_Cancel"); label[i].text_is_1byte = true; label[i].text_in_resource = true; gcd[i].gd.label = &label[i]; gcd[i].gd.mnemonic = 'C'; gcd[i].gd.handle_controlevent = SD_Cancel; gcd[i].gd.cid = CID_Cancel; gcd[i++].creator = GButtonCreate; barray[1][5] = &gcd[i-1]; gcd[i].gd.pos.x = (SD_Width-GIntGetResource(_NUM_Buttonsize)*100/GIntGetResource(_NUM_ScaleFactor))/2; gcd[i].gd.pos.y = SD_Height-40; gcd[i].gd.flags = gg_visible | gg_enabled; label[i].text = (unichar_t *) _("C_all..."); label[i].text_is_1byte = true; label[i].text_in_resource = true; gcd[i].gd.label = &label[i]; gcd[i].gd.mnemonic = 'a'; gcd[i].gd.handle_controlevent = SD_Call; gcd[i].gd.cid = CID_Call; gcd[i++].creator = GButtonCreate; barray[0][3] = &gcd[i-1]; #if !defined(_NO_FFSCRIPT) gcd[i].gd.pos.width = gcd[i].gd.pos.height = 5; gcd[i].gd.flags = gg_visible | gg_enabled; gcd[i++].creator = GSpacerCreate; barray[1][3] = &gcd[i-1]; #else barray[1][3] = GCD_RowSpan; #endif barray[3][0] = NULL; boxes[3].gd.flags = gg_enabled | gg_visible; boxes[3].gd.u.boxelements = barray[0]; boxes[3].creator = GHVBoxCreate; hvarray[l][0] = &boxes[3]; hvarray[l++][1] = NULL; hvarray[l][0] = 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 = hvarray[0]; boxes[0].creator = GHVGroupCreate; GGadgetsCreate(gw,boxes); if ( boxes[2].ret!=NULL ) GHVBoxSetExpandableCol(boxes[2].ret,gb_expandglue); GHVBoxSetExpandableCol(boxes[3].ret,gb_expandgluesame); GHVBoxSetExpandableRow(boxes[0].ret,0); GHVBoxFitWindow(boxes[0].ret); } #if !defined(_NO_FFSCRIPT) && !defined(_NO_PYTHON) GGadgetSetEnabled(GWidgetGetControl(gw,CID_FF),cv==NULL); #endif sd.gw = gw; GDrawSetUserData(gw,&sd); GWidgetIndicateFocusGadget(GWidgetGetControl(gw,CID_Script)); #if !defined(_NO_FFSCRIPT) && !defined(_NO_PYTHON) _SD_LangChanged(&sd); #endif GDrawSetVisible(gw,true); while ( !sd.done ) GDrawProcessOneEvent(NULL); GDrawSetVisible(gw,false); /* Selection may be out of date, force a refresh */ for ( list = fv_list; list!=NULL; list=(FontView *) list->b.next ) GDrawRequestExpose(list->v,NULL,false); GDrawSync(NULL); GDrawProcessPendingEvents(NULL); GDrawSetUserData(gw,NULL); }
static char *JSTF_LookupListDlg(GGadget *g, int r, int c) { int rows, k, j; struct matrix_data *strings = GMatrixEditGet(g, &rows); int cols = GMatrixEditGetColCnt(g); char *lookupstr = strings[cols*r+c].u.md_str; Jstf_Dlg *jd = GDrawGetUserData(GGadgetGetWindow(g)); GRect pos; GWindow gw; GWindowAttrs wattrs; GGadgetCreateData gcd[4], boxes[3]; GGadgetCreateData *varray[6], *harray3[8]; GTextInfo label[4]; struct matrixinit mi; struct glyph_list_dlg gld; memset(&gld,0,sizeof(gld)); gld.sf = jd->sf; memset(&wattrs,0,sizeof(wattrs)); wattrs.mask = wam_events|wam_cursor|wam_utf8_wtitle|wam_undercursor|wam_isdlg|wam_restrict; wattrs.event_masks = ~(1<<et_charup); wattrs.is_dlg = true; wattrs.restrict_input_to_me = 1; wattrs.undercursor = 1; wattrs.cursor = ct_pointer; wattrs.utf8_window_title = c==1 ? _("Lookups turned ON to extend a line") : c==2 ? _("Lookups turned OFF to extend a line") : c==3 ? _("Lookups which specify the maximum size by which a glyph may grow") : c==4 ? _("Lookups turned ON to shrink a line") : c==5 ? _("Lookups turned OFF to shrink a line") : _("Lookups which specify the maximum size by which a glyph may shrink"); pos.x = pos.y = 0; pos.width =GDrawPointsToPixels(NULL,GGadgetScale(268)); pos.height = GDrawPointsToPixels(NULL,375); gld.gw = gw = GDrawCreateTopWindow(NULL,&pos,lookup_e_h,&gld,&wattrs); LookupMatrixInit(&mi,lookupstr,gld.sf,c); memset(&gcd,0,sizeof(gcd)); memset(&boxes,0,sizeof(boxes)); memset(&label,0,sizeof(label)); k=j=0; gcd[k].gd.pos.x = 10; gcd[k].gd.pos.y = gcd[1].gd.pos.y+14; gcd[k].gd.flags = gg_enabled | gg_visible | gg_utf8_popup; gcd[k].gd.cid = CID_Lookups; gcd[k].gd.u.matrix = &mi; gcd[k].gd.popup_msg = (unichar_t *) _( "A list of lookup names"); gcd[k].creator = GMatrixEditCreate; varray[j++] = &gcd[k++]; varray[j++] = NULL; gcd[k].gd.pos.x = 30-3; gcd[k].gd.pos.width = -1; gcd[k].gd.pos.height = 0; gcd[k].gd.flags = gg_visible | gg_enabled | gg_but_default; label[k].text = (unichar_t *) _("_OK"); label[k].text_is_1byte = true; label[k].text_in_resource = true; gcd[k].gd.label = &label[k]; gcd[k].gd.handle_controlevent = JSTF_Lookup_OK; gcd[k].gd.cid = CID_OK; gcd[k++].creator = GButtonCreate; gcd[k].gd.pos.x = -30; gcd[k].gd.pos.width = -1; gcd[k].gd.pos.height = 0; gcd[k].gd.flags = gg_visible | gg_enabled | gg_but_cancel; 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.handle_controlevent = JSTF_Glyph_Cancel; gcd[k].gd.cid = CID_Cancel; gcd[k++].creator = GButtonCreate; harray3[0] = harray3[2] = harray3[3] = harray3[4] = harray3[6] = GCD_Glue; harray3[7] = NULL; harray3[1] = &gcd[k-2]; harray3[5] = &gcd[k-1]; boxes[0].gd.flags = gg_enabled|gg_visible; boxes[0].gd.u.boxelements = harray3; boxes[0].creator = GHBoxCreate; varray[j++] = &boxes[0]; varray[j++] = NULL; varray[j] = NULL; boxes[1].gd.pos.x = boxes[1].gd.pos.y = 2; boxes[1].gd.flags = gg_enabled|gg_visible; boxes[1].gd.u.boxelements = varray; boxes[1].creator = GHVGroupCreate; GGadgetsCreate(gw,boxes+1); free( mi.matrix_data ); GMatrixEditSetNewText(gcd[0].ret,S_("LookupName|New")); GHVBoxSetExpandableCol(boxes[0].ret,gb_expandgluesame); GHVBoxFitWindow(boxes[1].ret); GDrawSetVisible(gw,true); while ( !gld.done ) GDrawProcessOneEvent(NULL); GDrawDestroyWindow(gw); GTextInfoListFree(lookup_ci[0].enum_vals); lookup_ci[0].enum_vals = NULL; return( gld.ret ); }