• R/O
  • SSH
  • HTTPS

tsukurimashou: コミット


コミットメタ情報

リビジョン652 (tree)
日時2016-09-18 19:24:53
作者mskala

ログメッセージ

fix some undo-handling stuff

変更サマリ

差分

--- trunk/fontanvil/inc/splinefont.h (revision 651)
+++ trunk/fontanvil/inc/splinefont.h (revision 652)
@@ -1,4 +1,4 @@
1-/* $Id: splinefont.h 5125 2016-09-18 06:58:30Z mskala $ */
1+/* $Id: splinefont.h 5126 2016-09-18 08:44:55Z mskala $ */
22 /* Copyright (C) 2000-2012 George Williams
33 * Copyright (C) 2015 Matthew Skala
44 *
@@ -863,11 +863,11 @@
863863 struct bdfcharlist *dependents;
864864 } BDFChar;
865865
866-enum undotype { ut_none=0, ut_state, ut_tstate, ut_statehint, ut_statename,
866+enum undotype { ut_none=0, ut_state, ut_statehint, ut_statename,
867867 ut_statelookup,
868868 ut_anchors,
869- ut_width, ut_vwidth, ut_lbearing, ut_rbearing, ut_possub,
870- ut_hints, ut_bitmap, ut_bitmapsel, ut_composit, ut_multiple, ut_layers,
869+ ut_width, ut_vwidth, ut_lbearing, ut_rbearing,
870+ ut_bitmap, ut_composit, ut_multiple, ut_layers,
871871 ut_noop
872872 };
873873
--- trunk/fontanvil/inc/baseviews.h (revision 651)
+++ trunk/fontanvil/inc/baseviews.h (revision 652)
@@ -1,4 +1,4 @@
1-/* $Id: baseviews.h 4501 2015-12-16 13:47:38Z mskala $ */
1+/* $Id: baseviews.h 5127 2016-09-18 10:21:52Z mskala $ */
22 /* Copyright (C) 2000-2012 George Williams
33 * Copyright (C) 2015 Matthew Skala
44 *
@@ -313,6 +313,8 @@
313313
314314 extern void FVCopy(FontViewBase * fv, enum fvcopy_type copytype);
315315
316+extern void FVCopyWidth(FontViewBase * fv, enum undotype copytype);
317+
316318 extern void PasteIntoFV(FontViewBase * fv, int pasteinto, double trans[6]);
317319
318320 extern void FVCopyFgtoBg(FontViewBase * fv);
--- trunk/fontanvil/fontanvil/splineutil.c (revision 651)
+++ trunk/fontanvil/fontanvil/splineutil.c (revision 652)
@@ -1,4 +1,4 @@
1-/* $Id: splineutil.c 4532 2015-12-22 13:18:53Z mskala $ */
1+/* $Id: splineutil.c 5126 2016-09-18 08:44:55Z mskala $ */
22 /* Copyright (C) 2000-2012 George Williams
33 * Copyright (C) 2015 Matthew Skala
44 *
@@ -5204,12 +5204,12 @@
52045204 return;
52055205 sc->anchor=AnchorPointsRemoveName(sc->anchor, an);
52065206 for (test=sc->layers[ly_fore].undoes; test != NULL; test=test->next)
5207- if (test->undotype==ut_state || test->undotype==ut_tstate ||
5207+ if (test->undotype==ut_state ||
52085208 test->undotype==ut_statehint || test->undotype==ut_statename)
52095209 test->u.state.anchor =
52105210 AnchorPointsRemoveName(test->u.state.anchor, an);
52115211 for (test=sc->layers[ly_fore].redoes; test != NULL; test=test->next)
5212- if (test->undotype==ut_state || test->undotype==ut_tstate ||
5212+ if (test->undotype==ut_state ||
52135213 test->undotype==ut_statehint || test->undotype==ut_statename)
52145214 test->u.state.anchor =
52155215 AnchorPointsRemoveName(test->u.state.anchor, an);
--- trunk/fontanvil/fontanvil/scripting.c (revision 651)
+++ trunk/fontanvil/fontanvil/scripting.c (revision 652)
@@ -1,4 +1,4 @@
1-/* $Id: scripting.c 4532 2015-12-22 13:18:53Z mskala $ */
1+/* $Id: scripting.c 5127 2016-09-18 10:21:52Z mskala $ */
22 /* Copyright (C) 2002-2012 George Williams
33 * Copyright (C) 2015 Matthew Skala
44 *
@@ -2978,11 +2978,11 @@
29782978 }
29792979
29802980 static void bCopyLBearing(Context *c) {
2981- FVCopy(c->curfv, ut_lbearing);
2981+ FVCopyWidth(c->curfv, ut_lbearing);
29822982 }
29832983
29842984 static void bCopyRBearing(Context *c) {
2985- FVCopy(c->curfv, ut_rbearing);
2985+ FVCopyWidth(c->curfv, ut_rbearing);
29862986 }
29872987
29882988 static void bCopyReference(Context *c) {
@@ -2996,11 +2996,11 @@
29962996 static void bCopyVWidth(Context *c) {
29972997 if (c->curfv != NULL && !c->curfv->sf->hasvmetrics)
29982998 ScriptError(c, "Vertical metrics not enabled in this font");
2999- FVCopy(c->curfv, ut_vwidth);
2999+ FVCopyWidth(c->curfv, ut_vwidth);
30003000 }
30013001
30023002 static void bCopyWidth(Context *c) {
3003- FVCopy(c->curfv, ut_width);
3003+ FVCopyWidth(c->curfv, ut_width);
30043004 }
30053005
30063006 static void bCorrectDirection(Context *c) {
--- trunk/fontanvil/fontanvil/glyphcomp.c (revision 651)
+++ trunk/fontanvil/fontanvil/glyphcomp.c (revision 652)
@@ -1,4 +1,4 @@
1-/* $Id: glyphcomp.c 4532 2015-12-22 13:18:53Z mskala $ */
1+/* $Id: glyphcomp.c 5126 2016-09-18 08:44:55Z mskala $ */
22 /* Copyright (C) 2006-2012 George Williams
33 * Copyright (C) 2015 Matthew Skala
44 *
@@ -945,7 +945,6 @@
945945 return (-1);
946946 }
947947 break;
948- case ut_bitmapsel:
949948 case ut_bitmap:
950949 if (pixel_off_frac >= 0) {
951950 ret |=
--- trunk/fontanvil/fontanvil/cvundoes.c (revision 651)
+++ trunk/fontanvil/fontanvil/cvundoes.c (revision 652)
@@ -1,4 +1,4 @@
1-/* $Id: cvundoes.c 5125 2016-09-18 06:58:30Z mskala $ */
1+/* $Id: cvundoes.c 5127 2016-09-18 10:21:52Z mskala $ */
22 /* Copyright (C) 2000-2012 George Williams
33 * Copyright (C) 2015 Matthew Skala
44 *
@@ -227,10 +227,8 @@
227227 /* Nothing else to free */ ;
228228 break;
229229 case ut_state:
230- case ut_tstate:
231230 case ut_statehint:
232231 case ut_statename:
233- case ut_hints:
234232 case ut_anchors:
235233 case ut_statelookup:
236234 SplinePointListsFree(undo->u.state.splines);
@@ -329,10 +327,6 @@
329327 BDFRefChar *brhead, *brnext;
330328
331329 switch (copybuffer.undotype) {
332- case ut_hints:
333- UHintListFree(copybuffer.u.state.hints);
334- free(copybuffer.u.state.instrs);
335- break;
336330 case ut_state:
337331 case ut_statehint:
338332 case ut_anchors:
@@ -348,9 +342,6 @@
348342 GradientFree(copybuffer.u.state.stroke_pen.brush.gradient);
349343 PatternFree(copybuffer.u.state.stroke_pen.brush.pattern);
350344 break;
351- case ut_bitmapsel:
352- BDFFloatFree(copybuffer.u.bmpstate.selection);
353- break;
354345 case ut_bitmap:
355346 for (brhead=copybuffer.u.bmpstate.refs; brhead != NULL;
356347 brhead=brnext) {
@@ -387,7 +378,7 @@
387378 if (cur->undotype==ut_composit)
388379 cur=cur->u.composit.state;
389380 if (cur==NULL
390- || (cur->undotype != ut_state && cur->undotype != ut_tstate
381+ || (cur->undotype != ut_state
391382 && cur->undotype != ut_statehint && cur->undotype != ut_statename))
392383 return (NULL);
393384 if (cur->u.state.splines != NULL || cur->u.state.refs==NULL ||
@@ -1520,16 +1511,6 @@
15201511 switch (paster->undotype) {
15211512 case ut_noop:
15221513 break;
1523- case ut_bitmapsel:
1524- BCFlattenFloat(bc);
1525- if (clearfirst)
1526- memset(bc->bitmap, '\0',
1527- bc->bytes_per_line * (bc->ymax-bc->ymin+1));
1528- bc->selection =
1529- BDFFloatConvert(paster->u.bmpstate.selection, depth,
1530- paster->u.bmpstate.depth);
1531- BCCharChangedUpdate(bc);
1532- break;
15331514 case ut_bitmap:
15341515 BCFlattenFloat(bc);
15351516 if (clearfirst) {
@@ -1689,6 +1670,50 @@
16891670 copybuffer.copied_from=fv->sf;
16901671 }
16911672
1673+void FVCopyWidth(FontViewBase *fv,enum undotype ut) {
1674+ Undoes *head=NULL, *last=NULL, *cur;
1675+ int i, any=false, gid;
1676+ SplineChar *sc;
1677+ DBounds bb;
1678+
1679+ CopyBufferFreeGrab();
1680+
1681+ for ( i=0; i<fv->map->enccount; ++i ) if ( fv->selected[i] ) {
1682+ any = true;
1683+ cur = chunkalloc(sizeof(Undoes));
1684+ cur->undotype = ut;
1685+ if ( (gid=fv->map->map[i])!=-1 && (sc=fv->sf->glyphs[gid])!=NULL ) {
1686+ switch ( ut ) {
1687+ case ut_width:
1688+ cur->u.width = sc->width;
1689+ break;
1690+ case ut_vwidth:
1691+ cur->u.width = sc->vwidth;
1692+ break;
1693+ case ut_lbearing:
1694+ SplineCharFindBounds(sc,&bb);
1695+ cur->u.lbearing = bb.minx;
1696+ break;
1697+ case ut_rbearing:
1698+ SplineCharFindBounds(sc,&bb);
1699+ cur->u.rbearing = sc->width-bb.maxx;
1700+ break;
1701+ default:
1702+ break;
1703+ }
1704+ } else
1705+ cur->undotype = ut_noop;
1706+ if ( head==NULL )
1707+ head = cur;
1708+ else
1709+ last->next = cur;
1710+ last = cur;
1711+ }
1712+ copybuffer.undotype = ut_multiple;
1713+ copybuffer.u.multiple.mult = head;
1714+ copybuffer.copied_from = fv->sf;
1715+}
1716+
16921717 static BDFFont *BitmapCreateCheck(FontViewBase *fv,int *yestoall,int first,
16931718 int pixelsize, int depth) {
16941719 int yes=0;
@@ -1831,7 +1856,6 @@
18311856 fv, pasteinto, trans, &mc, &refstate,
18321857 &already_complained);
18331858 break;
1834- case ut_bitmapsel:
18351859 case ut_bitmap:
18361860 if (onlycopydisplayed && fv->active_bitmap != NULL)
18371861 _PasteToBC(BDFMakeChar(fv->active_bitmap, fv->map, i),
旧リポジトリブラウザで表示