• R/O
  • SSH
  • HTTPS

tsukurimashou: コミット


コミットメタ情報

リビジョン651 (tree)
日時2016-09-18 16:00:35
作者mskala

ログメッセージ

remove more undo logic

変更サマリ

差分

--- trunk/fontanvil/fontanvil/sfd.c (revision 650)
+++ trunk/fontanvil/fontanvil/sfd.c (revision 651)
@@ -1,4 +1,4 @@
1-/* $Id: sfd.c 4532 2015-12-22 13:18:53Z mskala $ */
1+/* $Id: sfd.c 5125 2016-09-18 06:58:30Z mskala $ */
22 /* Copyright (C) 2000-2012 George Williams
33 * Copyright (C) 2015 Matthew Skala
44 *
@@ -1137,8 +1137,6 @@
11371137 afprintf(sfd, "VWidth: %d\n", sc->vwidth);
11381138 if (sc->glyph_class != 0)
11391139 afprintf(sfd, "GlyphClass: %d\n", sc->glyph_class);
1140- if (sc->unlink_rm_ovrlp_save_undo)
1141- afprintf(sfd, "UnlinkRmOvrlpSave: %d\n", sc->unlink_rm_ovrlp_save_undo);
11421140 if (sc->inspiro)
11431141 afprintf(sfd, "InSpiro: %d\n", sc->inspiro);
11441142 if (sc->lig_caret_cnt_fixed)
@@ -4084,7 +4082,7 @@
40844082 sc->glyph_class=temp;
40854083 } else if (strmatch(tok, "UnlinkRmOvrlpSave:")==0) {
40864084 getint(sfd, &temp);
4087- sc->unlink_rm_ovrlp_save_undo=temp;
4085+ /* ignore this value for compatibility */
40884086 } else if (strmatch(tok, "InSpiro:")==0) {
40894087 getint(sfd, &temp);
40904088 sc->inspiro=temp;
--- trunk/fontanvil/fontanvil/scvalid.c (revision 650)
+++ trunk/fontanvil/fontanvil/scvalid.c (revision 651)
@@ -1,4 +1,4 @@
1-/* $Id: scvalid.c 4532 2015-12-22 13:18:53Z mskala $ */
1+/* $Id: scvalid.c 5125 2016-09-18 06:58:30Z mskala $ */
22 /* Copyright (C) 2000-2012 George Williams
33 * Copyright (C) 2015 Matthew Skala
44 *
@@ -447,9 +447,6 @@
447447 sc->layers[layer].validation_state |= vs_missinganchor;
448448
449449 sc->layers[layer].validation_state |= vs_known;
450- if (sc->unlink_rm_ovrlp_save_undo)
451- return (sc->layers[layer].
452- validation_state&~(vs_known|vs_selfintersects));
453450
454451 return (sc->layers[layer].validation_state&~vs_known);
455452 }
@@ -474,10 +471,7 @@
474471 } else if (SCValidateAnchors(sc) != NULL)
475472 sc->layers[layer].validation_state |= vs_missinganchor;
476473
477- if (sc->unlink_rm_ovrlp_save_undo)
478- any |= sc->layers[layer].validation_state&~vs_selfintersects;
479- else
480- any |= sc->layers[layer].validation_state;
474+ any |= sc->layers[layer].validation_state;
481475 }
482476 ++k;
483477 } while (k<sf->subfontcnt);
--- trunk/fontanvil/fontanvil/savefont.c (revision 650)
+++ trunk/fontanvil/fontanvil/savefont.c (revision 651)
@@ -1,4 +1,4 @@
1-/* $Id: savefont.c 4532 2015-12-22 13:18:53Z mskala $ */
1+/* $Id: savefont.c 5125 2016-09-18 06:58:30Z mskala $ */
22 /* Copyright (C) 2000-2012 George Williams
33 * Copyright (C) 2015 Matthew Skala
44 *
@@ -954,49 +954,6 @@
954954 return (err);
955955 }
956956
957-void PrepareUnlinkRmOvrlp(SplineFont *sf, char *filename, int layer) {
958- int gid;
959- SplineChar *sc;
960- RefChar *ref, *refnext;
961- extern int maxundoes;
962- int old_maxundoes=maxundoes;
963-
964- if (maxundoes==0)
965- maxundoes=1; /* Force undoes */
966-
967- for (gid=0; gid<sf->glyphcnt; ++gid)
968- if ((sc=sf->glyphs[gid]) != NULL && sc->unlink_rm_ovrlp_save_undo) {
969- if (autohint_before_generate && sc != NULL &&
970- sc->changedsincelasthinted && !sc->manualhints) {
971- SplineCharAutoHint(sc, layer, NULL); /* Do this now, else we get an unwanted undo on the stack from hinting */
972- }
973- SCPreserveLayer(sc, layer, false);
974- for (ref=sc->layers[layer].refs; ref != NULL; ref=refnext) {
975- refnext=ref->next;
976- SCRefToSplines(sc, ref, layer);
977- }
978- SCRoundToCluster(sc, layer, false, .03, .12);
979- sc->layers[layer].splines =
980- SplineSetRemoveOverlap(sc, sc->layers[layer].splines,
981- over_remove);
982- if (!sc->manualhints)
983- sc->changedsincelasthinted=false;
984- }
985- maxundoes=old_maxundoes;
986-}
987-
988-void RestoreUnlinkRmOvrlp(SplineFont *sf, char *filename, int layer) {
989- int gid;
990- SplineChar *sc;
991-
992- for (gid=0; gid<sf->glyphcnt; ++gid)
993- if ((sc=sf->glyphs[gid]) != NULL && sc->unlink_rm_ovrlp_save_undo) {
994- SCDoUndo(sc, layer);
995- if (!sc->manualhints)
996- sc->changedsincelasthinted=false;
997- }
998-}
999-
1000957 static int32_t *AllBitmapSizes(SplineFont *sf) {
1001958 int32_t *sizes=NULL;
1002959 BDFFont *bdf;
@@ -1284,13 +1241,11 @@
12841241 former=NULL;
12851242 if (sfs != NULL) {
12861243 for (sfl=sfs; sfl != NULL; sfl=sfl->next) {
1287- PrepareUnlinkRmOvrlp(sfl->sf, filename, layer);
12881244 if (rename_to != NULL)
12891245 sfl->former_names =
12901246 SFTemporaryRenameGlyphsToNamelist(sfl->sf, rename_to);
12911247 }
12921248 } else {
1293- PrepareUnlinkRmOvrlp(sf, filename, layer);
12941249 if (rename_to != NULL)
12951250 former=SFTemporaryRenameGlyphsToNamelist(sf, rename_to);
12961251 }
@@ -1312,12 +1267,10 @@
13121267
13131268 if (sfs != NULL) {
13141269 for (sfl=sfs; sfl != NULL; sfl=sfl->next) {
1315- RestoreUnlinkRmOvrlp(sfl->sf, filename, layer);
13161270 if (rename_to != NULL)
13171271 SFTemporaryRestoreGlyphNames(sfl->sf, sfl->former_names);
13181272 }
13191273 } else {
1320- RestoreUnlinkRmOvrlp(sf, filename, layer);
13211274 if (rename_to != NULL)
13221275 SFTemporaryRestoreGlyphNames(sf, former);
13231276 }
--- trunk/fontanvil/fontanvil/cvundoes.c (revision 650)
+++ trunk/fontanvil/fontanvil/cvundoes.c (revision 651)
@@ -1,4 +1,4 @@
1-/* $Id: cvundoes.c 4532 2015-12-22 13:18:53Z mskala $ */
1+/* $Id: cvundoes.c 5125 2016-09-18 06:58:30Z mskala $ */
22 /* Copyright (C) 2000-2012 George Williams
33 * Copyright (C) 2015 Matthew Skala
44 *
@@ -107,189 +107,6 @@
107107 return (sofar);
108108 }
109109
110-static int RefCharsMatch(RefChar *urefs,RefChar *crefs) {
111- /* I assume they are in the same order */
112- while (urefs != NULL && crefs != NULL) {
113- if (urefs->sc != crefs->sc ||
114- urefs->transform[0] != crefs->transform[0] ||
115- urefs->transform[1] != crefs->transform[1] ||
116- urefs->transform[2] != crefs->transform[2] ||
117- urefs->transform[3] != crefs->transform[3] ||
118- urefs->transform[4] != crefs->transform[4] ||
119- urefs->transform[5] != crefs->transform[5])
120- return (false);
121- urefs=urefs->next;
122- crefs=crefs->next;
123- }
124- if (urefs==NULL && crefs==NULL)
125- return (true);
126-
127- return (false);
128-}
129-
130-static int ImagesMatch(ImageList *uimgs,ImageList *cimgs) {
131- /* I assume they are in the same order */
132- while (uimgs != NULL && cimgs != NULL) {
133- if (uimgs->image != cimgs->image ||
134- uimgs->xoff != cimgs->xoff ||
135- uimgs->yoff != cimgs->yoff ||
136- uimgs->xscale != cimgs->xscale || uimgs->yscale != cimgs->yscale)
137- return (false);
138- uimgs=uimgs->next;
139- cimgs=cimgs->next;
140- }
141- if (uimgs==NULL && cimgs==NULL)
142- return (true);
143-
144- return (false);
145-}
146-
147-static RefChar *RefCharInList(RefChar *search,RefChar *list) {
148- while (list != NULL) {
149- if (search->sc==list->sc &&
150- search->transform[0]==list->transform[0] &&
151- search->transform[1]==list->transform[1] &&
152- search->transform[2]==list->transform[2] &&
153- search->transform[3]==list->transform[3] &&
154- search->transform[4]==list->transform[4] &&
155- search->transform[5]==list->transform[5])
156- return (list);
157- list=list->next;
158- }
159- return (NULL);
160-}
161-
162-static ImageList *ImageInList(ImageList *search,ImageList *list) {
163- while (list != NULL) {
164- if (search->image != list->image ||
165- search->xoff != list->xoff ||
166- search->yoff != list->yoff ||
167- search->xscale != list->xscale || search->yscale != list->yscale)
168- return (list);
169- list=list->next;
170- }
171- return (NULL);
172-}
173-
174-static void FixupRefChars(SplineChar *sc,RefChar *urefs,int layer) {
175- RefChar *crefs, *cend, *cprev, *unext, *cnext;
176-
177- if (layer==ly_grid)
178- return;
179-
180- crefs=sc->layers[layer].refs;
181-
182- cprev=NULL;
183- while (crefs != NULL && urefs != NULL) {
184- if (urefs->sc==crefs->sc &&
185- urefs->transform[0]==crefs->transform[0] &&
186- urefs->transform[1]==crefs->transform[1] &&
187- urefs->transform[2]==crefs->transform[2] &&
188- urefs->transform[3]==crefs->transform[3] &&
189- urefs->transform[4]==crefs->transform[4] &&
190- urefs->transform[5]==crefs->transform[5]) {
191- unext=urefs->next;
192- crefs->selected=urefs->selected;
193- RefCharFree(urefs);
194- urefs=unext;
195- cprev=crefs;
196- crefs=crefs->next;
197- } else if ((cend=RefCharInList(urefs, crefs->next)) != NULL) {
198- /* if the undo refchar matches something further down the char's */
199- /* ref list, then than means we need to delete everything on the */
200- /* char's list between the two */
201- while (crefs != cend) {
202- cnext=crefs->next;
203- SCRemoveDependent(sc, crefs, layer);
204- crefs=cnext;
205- }
206- } else { /* urefs isn't on the list. Add it here */
207- unext=urefs->next;
208- urefs->next=crefs;
209- if (cprev==NULL)
210- sc->layers[layer].refs=urefs;
211- else
212- cprev->next=urefs;
213- cprev=urefs;
214- SCReinstantiateRefChar(sc, urefs, layer);
215- SCMakeDependent(sc, urefs->sc);
216- urefs=unext;
217- }
218- }
219- if (crefs != NULL) {
220- while (crefs != NULL) {
221- cnext=crefs->next;
222- SCRemoveDependent(sc, crefs, layer);
223- crefs=cnext;
224- }
225- } else if (urefs != NULL) {
226- if (cprev==NULL)
227- sc->layers[layer].refs=urefs;
228- else
229- cprev->next=urefs;
230- while (urefs != NULL) {
231- SCReinstantiateRefChar(sc, urefs, layer);
232- SCMakeDependent(sc, urefs->sc);
233- urefs=urefs->next;
234- }
235- }
236-}
237-
238-static void FixupImages(SplineChar *sc,ImageList *uimgs,int layer) {
239- ImageList *cimgs =
240- layer==-1?sc->parent->grid.images:sc->layers[layer].images, *cend,
241- *cprev, *unext, *cnext;
242-
243- cprev=NULL;
244- while (cimgs != NULL && uimgs != NULL) {
245- if (uimgs->image==cimgs->image &&
246- uimgs->xoff==cimgs->xoff &&
247- uimgs->yoff==cimgs->yoff &&
248- uimgs->xscale==cimgs->xscale && uimgs->yscale==cimgs->yscale) {
249- unext=uimgs->next;
250- cimgs->selected=uimgs->selected;
251- free(uimgs);
252- uimgs=unext;
253- cprev=cimgs;
254- cimgs=cimgs->next;
255- } else if ((cend=ImageInList(uimgs, cimgs->next)) != NULL) {
256- /* if the undo image matches something further down the char's */
257- /* img list, then than means we need to delete everything on the */
258- /* char's list between the two */
259- if (cprev==NULL)
260- sc->layers[layer].images=cend;
261- else
262- cprev->next=cend;
263- while (cimgs != cend) {
264- cnext=cimgs->next;
265- free(cimgs);
266- cimgs=cnext;
267- }
268- } else { /* uimgs isn't on the list. Add it here */
269- unext=uimgs->next;
270- uimgs->next=cimgs;
271- if (cprev==NULL)
272- sc->layers[layer].images=uimgs;
273- else
274- cprev->next=uimgs;
275- cprev=uimgs;
276- uimgs=unext;
277- }
278- }
279- if (cimgs != NULL) {
280- ImageListsFree(cimgs);
281- if (cprev==NULL)
282- sc->layers[layer].images=NULL;
283- else
284- cprev->next=NULL;
285- } else if (uimgs != NULL) {
286- if (cprev==NULL)
287- sc->layers[layer].images=uimgs;
288- else
289- cprev->next=uimgs;
290- }
291-}
292-
293110 static void UHintListFree(void *hints) {
294111 StemInfo *h, *t, *p;
295112
@@ -504,130 +321,6 @@
504321 return (NULL);
505322 }
506323
507-static void SCUndoAct(SplineChar *sc,int layer,Undoes *undo) {
508-
509- switch (undo->undotype) {
510- case ut_noop:
511- break;
512- case ut_width:{
513- int width=sc->width;
514-
515- if (sc->width != undo->u.width)
516- SCSynchronizeWidth(sc, undo->u.width, width, NULL);
517- undo->u.width=width;
518- }
519- break;
520- case ut_vwidth:{
521- int vwidth=sc->vwidth;
522-
523- sc->vwidth=undo->u.width;
524- undo->u.width=vwidth;
525- } break;
526- case ut_hints:{
527- void *hints=UHintCopy(sc, false);
528- uint8_t *instrs=sc->ttf_instrs;
529- int instrs_len=sc->ttf_instrs_len;
530-
531- ExtractHints(sc, undo->u.state.hints, false);
532- sc->ttf_instrs=undo->u.state.instrs;
533- sc->ttf_instrs_len=undo->u.state.instrs_len;
534- undo->u.state.hints=hints;
535- undo->u.state.instrs=instrs;
536- undo->u.state.instrs_len=instrs_len;
537- } break;
538- case ut_state:
539- case ut_tstate:
540- case ut_statehint:
541- case ut_statename:{
542- Layer *head =
543- layer==ly_grid?&sc->parent->grid:&sc->layers[layer];
544- SplinePointList *spl=head->splines;
545-
546- if (layer==ly_fore) {
547- int width=sc->width;
548- int vwidth=sc->vwidth;
549-
550- if (sc->width != undo->u.state.width)
551- SCSynchronizeWidth(sc, undo->u.state.width, width, NULL);
552- sc->vwidth=undo->u.state.vwidth;
553- undo->u.state.width=width;
554- undo->u.state.vwidth=vwidth;
555- }
556- head->splines=undo->u.state.splines;
557- if (layer==ly_fore) {
558- AnchorPoint *ap=sc->anchor;
559-
560- sc->anchor=undo->u.state.anchor;
561- undo->u.state.anchor=ap;
562- }
563- if (layer != ly_grid
564- && !RefCharsMatch(undo->u.state.refs, head->refs)) {
565- RefChar *refs=RefCharsCopyState(sc, layer);
566-
567- FixupRefChars(sc, undo->u.state.refs, layer);
568- undo->u.state.refs=refs;
569- }
570- if (layer==ly_fore &&
571- (undo->undotype==ut_statehint
572- || undo->undotype==ut_statename)) {
573- void *hints=UHintCopy(sc, false);
574- uint8_t *instrs=sc->ttf_instrs;
575- int instrs_len=sc->ttf_instrs_len;
576-
577- ExtractHints(sc, undo->u.state.hints, false);
578- sc->ttf_instrs=undo->u.state.instrs;
579- sc->ttf_instrs_len=undo->u.state.instrs_len;
580- undo->u.state.hints=hints;
581- undo->u.state.instrs=instrs;
582- undo->u.state.instrs_len=instrs_len;
583- }
584- if (!ImagesMatch(undo->u.state.images, head->images)) {
585- ImageList *images=ImageListCopy(head->images);
586-
587- FixupImages(sc, undo->u.state.images, layer);
588- undo->u.state.images=images;
589- }
590- undo->u.state.splines=spl;
591- if (undo->u.state.lbearingchange) {
592- undo->u.state.lbearingchange=-undo->u.state.lbearingchange;
593- SCSynchronizeLBearing(sc, undo->u.state.lbearingchange, layer);
594- }
595- if (layer==ly_fore && undo->undotype==ut_statename) {
596- char *temp=sc->name;
597- int uni=sc->unicodeenc;
598- PST *possub=sc->possub;
599- char *comment=sc->comment;
600-
601- sc->name=undo->u.state.charname;
602- undo->u.state.charname=temp;
603- sc->unicodeenc=undo->u.state.unicodeenc;
604- undo->u.state.unicodeenc=uni;
605- sc->possub=undo->u.state.possub;
606- undo->u.state.possub=possub;
607- sc->comment=undo->u.state.comment;
608- undo->u.state.comment=comment;
609- }
610- } break;
611- default:
612- ErrorMsg(2,"Unknown undo type in SCUndoAct: %d\n", undo->undotype);
613- break;
614- }
615-}
616-
617-void SCDoUndo(SplineChar * sc, int layer) {
618- Undoes *undo=sc->layers[layer].undoes;
619-
620- if (undo==NULL) /* Shouldn't happen */
621- return;
622- sc->layers[layer].undoes=undo->next;
623- undo->next=NULL;
624- SCUndoAct(sc, layer, undo);
625- undo->next=sc->layers[layer].redoes;
626- sc->layers[layer].redoes=undo;
627- SCCharChangedUpdate(sc, layer, undo->was_modified);
628- return;
629-}
630-
631324 /* **************************** Cut, Copy & Paste *************************** */
632325
633326 static Undoes copybuffer;
--- trunk/fontanvil/inc/splinefont.h (revision 650)
+++ trunk/fontanvil/inc/splinefont.h (revision 651)
@@ -1,4 +1,4 @@
1-/* $Id: splinefont.h 4658 2016-02-23 08:05:52Z mskala $ */
1+/* $Id: splinefont.h 5125 2016-09-18 06:58:30Z mskala $ */
22 /* Copyright (C) 2000-2012 George Williams
33 * Copyright (C) 2015 Matthew Skala
44 *
@@ -1506,7 +1506,6 @@
15061506 unsigned int instructions_out_of_date:1;
15071507 unsigned int complained_about_ptnums:1;
15081508 unsigned int vs_open:1;
1509- unsigned int unlink_rm_ovrlp_save_undo:1;
15101509 unsigned int inspiro:1;
15111510 unsigned int lig_caret_cnt_fixed:1;
15121511 unsigned int suspendMetricsViewEventPropagation:1; /* rect tool might do this while drawing */
@@ -3623,8 +3622,6 @@
36233622 extern void SFAddGlyphAndEncode(SplineFont *sf, SplineChar *sc,
36243623 EncMap *basemap, int baseenc);
36253624
3626-extern void SCDoUndo(SplineChar *sc, int layer);
3627-
36283625 extern void SCClearBackground(SplineChar *sc);
36293626
36303627 extern void BackgroundImageTransform(SplineChar *sc, ImageList *img,
旧リポジトリブラウザで表示