static int CW_OK(GGadget *g, GEvent *e) { if ( e->type==et_controlevent && e->u.control.subtype == et_buttonactivate ) { int err = false; CreateWidthDlg *wd = GDrawGetUserData(GGadgetGetWindow(g)); if ( GGadgetIsChecked(GWidgetGetControl(wd->gw,CID_Set)) ) { wd->wd.type = st_set; wd->wd.setto = GetReal8(wd->gw,CID_SetVal,rb1[wd->wd.wtype],&err); if ( wd->wd.setto<0 && wd->wd.wtype==wt_width ) { char *yesno[3]; yesno[0] = _("_Yes"); yesno[1] = _("_No"); yesno[2] = NULL; if ( gwwv_ask(_("Negative Width"), (const char **) yesno, 0, 1, _("Negative glyph widths are not allowed in TrueType\nDo you really want a negative width?") )==1 ) return( true ); } } else if ( GGadgetIsChecked(GWidgetGetControl(wd->gw,CID_Incr)) ) { wd->wd.type = st_incr; wd->wd.increment = GetReal8(wd->gw,CID_IncrVal,rb2[wd->wd.wtype],&err); } else { wd->wd.type = st_scale; wd->wd.scale = GetReal8(wd->gw,CID_ScaleVal,rb2[wd->wd.wtype],&err); } if ( err ) return(true); (wd->wd.doit)((CreateWidthData *) wd); } return( true ); }
static void DoAutoRecoveryPostRecover_PromptUserGraphically(SplineFont *sf) { /* Ask user to save-as file */ char *buts[4]; buts[0] = _("_OK"); buts[1] = 0; gwwv_ask( _("Recovery Complete"),(const char **) buts,0,1,_("Your file %s has been recovered.\nYou must now Save your file to continue working on it."), sf->filename ); _FVMenuSaveAs( (FontView*)sf->fv ); }
/** * A timeout function which is called after a given idle period to * alert the user if we have not received a reply from the server yet. * * If we don't get a reply in time then the user experience will * suffer greatly (UI elements jumping around etc) so we ask the user * if they want to start again or disconnect. */ static void collabclient_roundTripTimer( void* ccvp ) { cloneclient_t *cc = (cloneclient_t*)ccvp; // printf("collabclient_roundTripTimer() cc: %p\n", cc ); // printf("collabclient_roundTripTimer() waitingseq: %d\n", cc->roundTripTimerWaitingSeq ); if( cc->roundTripTimerWaitingSeq ) { cc->roundTripTimerWaitingSeq = 0; char *buts[3]; buts[0] = _("_Reconnect"); buts[1] = _("_Disconnect"); buts[2] = NULL; if ( gwwv_ask(_("Network Issue"), (const char **) buts,0,1, _("FontForge expected some input from the server by now.\nWould you like to try to reconnect to the collaboration session?"))==1 ) { // break session FontView* fv = FontViewFind( FontViewFind_byCollabPtr, cc ); if( fv ) { printf("fv:%p\n", fv ); fv->b.collabState = cs_disconnected; fv->b.collabClient = 0; FVTitleUpdate( &fv->b ); } collabclient_free( (void**)&cc ); return; } collabclient_sessionReconnect( cc ); } }
int SVAttachFV(FontView *fv,int ask_if_difficult) { int i, doit, pos, any=0, gid; RefChar *r, *rnext, *rprev; if ( searcher==NULL ) return( false ); if ( searcher->sd.fv==(FontViewBase *) fv ) return( true ); if ( searcher->sd.fv!=NULL && searcher->sd.fv->sf==fv->b.sf ) { ((FontView *) searcher->sd.fv)->sv = NULL; fv->sv = searcher; searcher->sd.fv = (FontViewBase *) fv; SVSetTitle(searcher); searcher->sd.curchar = NULL; return( true ); } if ( searcher->dummy_sf.layers[ly_fore].order2 != fv->b.sf->layers[ly_fore].order2 ) { SCClearContents(&searcher->sd.sc_srch,ly_fore); SCClearContents(&searcher->sd.sc_rpl,ly_fore); for ( i=0; i<searcher->sd.sc_srch.layer_cnt; ++i ) UndoesFree(searcher->sd.sc_srch.layers[i].undoes); for ( i=0; i<searcher->sd.sc_rpl.layer_cnt; ++i ) UndoesFree(searcher->sd.sc_rpl.layers[i].undoes); } for ( doit=!ask_if_difficult; doit<=1; ++doit ) { for ( i=0; i<2; ++i ) { rprev = NULL; for ( r = searcher->chars[i]->layers[ly_fore].refs; r!=NULL; r=rnext ) { rnext = r->next; pos = SFFindSlot(fv->b.sf,fv->b.map,r->sc->unicodeenc,r->sc->name); gid = -1; if ( pos!=-1 ) gid = fv->b.map->map[pos]; if ( (gid==-1 || fv->b.sf->glyphs[gid]!=NULL) && !doit ) { char *buttons[3]; buttons[0] = _("Yes"); buttons[1] = _("Cancel"); buttons[2] = NULL; if ( ask_if_difficult==2 && !searcher->isvisible ) return( false ); if ( gwwv_ask(_("Bad Reference"),(const char **) buttons,1,1, _("The %1$s in the search dialog contains a reference to %2$.20hs which does not exist in the new font.\nShould I remove the reference?"), i==0?_("Search Pattern"):_("Replace Pattern"), r->sc->name)==1 ) return( false ); } else if ( !doit ) /* Do Nothing */; else if ( gid==-1 || fv->b.sf->glyphs[gid]!=NULL ) { if ( rprev==NULL ) searcher->chars[i]->layers[ly_fore].refs = rnext; else rprev->next = rnext; RefCharFree(r); any = true; } else { /*SplinePointListsFree(r->layers[0].splines); r->layers[0].splines = NULL;*/ r->sc = fv->b.sf->glyphs[gid]; r->orig_pos = gid; SCReinstanciateRefChar(searcher->chars[i],r,fv->b.active_layer); any = true; rprev = r; } } } } fv->sv = searcher; searcher->sd.fv = (FontViewBase *) fv; searcher->sd.curchar = NULL; if ( any ) { GDrawRequestExpose(searcher->cv_srch.v,NULL,false); GDrawRequestExpose(searcher->cv_rpl.v,NULL,false); } SVSetTitle(searcher); return( true ); }