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); }
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); }
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 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); }
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); }
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); }