static int GFD_Ok(GGadget *g, GEvent *e) { if ( e->type==et_controlevent && e->u.control.subtype == et_buttonactivate ) { struct gfc_data *d = GDrawGetUserData(GGadgetGetWindow(g)); GGadget *tf; GFileChooserGetChildren(d->gfc,NULL,NULL,&tf); if ( *_GGadgetGetTitle(tf)!='\0' ) { extern int allow_utf8_glyphnames; GTextInfo *ti = GGadgetGetListItemSelected(d->rename); char *nlname = u2utf8_copy(ti->text); force_names_when_opening = NameListByName(nlname); free(nlname); if ( force_names_when_opening!=NULL && force_names_when_opening->uses_unicode && !allow_utf8_glyphnames) { ff_post_error(_("Namelist contains non-ASCII names"),_("Glyph names should be limited to characters in the ASCII character set, but there are names in this namelist which use characters outside that range.")); return(true); } d->done = true; d->ret = GGadgetGetTitle(d->gfc); // Trim trailing '/' if its there and put that string back as // the d->gfc string. int tmplen = u_strlen( d->ret ); if( tmplen > 0 ) { if( d->ret[ tmplen-1 ] == '/' ) { unichar_t* tmp = u_copy( d->ret ); tmp[ tmplen-1 ] = '\0'; GGadgetSetTitle(d->gfc, tmp); free(tmp); d->ret = GGadgetGetTitle(d->gfc); } } } } return( true ); }
static int KP_ChangeSize(GGadget *g, GEvent *e) { if ( e->type==et_controlevent && e->u.control.subtype == et_listselected ) { KPData *kpd = GDrawGetUserData(GGadgetGetWindow(g)); int newsize = (intpt) (GGadgetGetListItemSelected(g)->userdata); BDFFont *temp; if ( newsize==kpd->bdf->pixelsize ) return( true ); temp = SplineFontPieceMeal(kpd->sf,kpd->layer,newsize,72,true,NULL); BDFFontFree(kpd->bdf); kpd->bdf = temp; KP_Resize(kpd); KPV_Resize(kpd); } return( true ); }
static int GFD_FilterSelected(GGadget *g, GEvent *e) { if ( e->type==et_controlevent && e->u.control.subtype == et_listselected ) { struct gfc_data *d = GDrawGetUserData(GGadgetGetWindow(g)); GTextInfo *ti = GGadgetGetListItemSelected(g); if ( ti->userdata==NULL ) /* They selected a line. Dull */; else if ( ti->userdata == (void *) -1 ) { FilterDlg(); GGadgetSetList(g,StandardFilters(),true); } else { unichar_t *temp = utf82u_copy(ti->userdata); GFileChooserSetFilterText(d->gfc,temp); free(temp); temp = GFileChooserGetDir(d->gfc); GFileChooserSetDir(d->gfc,temp); free(temp); default_font_filter_index = GGadgetGetFirstListSelectedItem(g); SavePrefs(true); } } return( true ); }
static int AnchorD_GlyphChanged(GGadget *g, GEvent *e) { AnchorDlg *a = GDrawGetUserData(GGadgetGetWindow(g)); if ( e->type==et_controlevent && e->u.control.subtype == et_listselected ) { GTextInfo *sel = GGadgetGetListItemSelected(g); if ( sel!=NULL ) { AnchorPoint *ap = sel->userdata; if ( ap==Add_Mark ) AddAnchor(a,a->sc->parent,a->ap->anchor,true); else if ( ap==Add_Base ) AddAnchor(a,a->sc->parent,a->ap->anchor,false); else { char *name = u2utf8_copy(sel->text); SplineChar *sc = SFGetChar(a->sc->parent,-1,name); free(name); AnchorD_ChangeGlyph(a,sc,ap); } } } return( true ); }