1 /* Copyright (C) 2000-2012 by George Williams */
2 /*
3  * Redistribution and use in source and binary forms, with or without
4  * modification, are permitted provided that the following conditions are met:
5 
6  * Redistributions of source code must retain the above copyright notice, this
7  * list of conditions and the following disclaimer.
8 
9  * Redistributions in binary form must reproduce the above copyright notice,
10  * this list of conditions and the following disclaimer in the documentation
11  * and/or other materials provided with the distribution.
12 
13  * The name of the author may not be used to endorse or promote products
14  * derived from this software without specific prior written permission.
15 
16  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
17  * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
18  * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
19  * EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
20  * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
21  * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
22  * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
23  * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
24  * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
25  * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26  */
27 
28 #ifndef FONTFORGE_VIEWS_H
29 #define FONTFORGE_VIEWS_H
30 
31 #include <fontforge-config.h>
32 
33 #include "ttfinstrs.h"
34 
35 #include "baseviews.h"
36 #include "ffglib.h"
37 
38 #include "dlist.h"
39 #include "ggadget.h"
40 #include "search.h"
41 
42 
43 struct gfi_data;
44 struct contextchaindlg;
45 struct statemachinedlg;
46 
47 
48 extern struct cvshows {
49     int showfore, showback, showgrids, showhhints, showvhints, showdhints;
50     int showpoints, showfilled;
51     int showrulers;
52     int showrounds;		/* 0=>no, 1=>auto, 2=>always */
53     int showmdx, showmdy;	/* minimum distances x,y */
54     int showhmetrics, showvmetrics;	/* show advance width, baseline, etc. */
55     int markextrema;
56     int markpoi;		/* Points of inflection */
57     int showblues, showfamilyblues;
58     int showanchor;
59     int showcpinfo;
60     int showtabs;		/* with the names of former glyphs */
61     int showsidebearings;
62     int showrefnames;
63     int snapoutlines;
64     int showalmosthvlines;
65     int showalmosthvcurves;
66     int hvoffset;
67     int checkselfintersects;	/* Not really something shown, but convenient to keep it here */
68     int showdebugchanges;	/* Changes the way changing rasters are displayed in tt debug mode */
69     int alwaysshowcontrolpoints; //< Always show the BCP even when their splinepoint is not selected
70 } CVShows;
71 
72 extern struct bvshows {
73     int showfore, showoutline, showgrid;
74     int lastpixelsize;
75 } BVShows;
76 
77 enum debug_wins { dw_registers=0x1, dw_stack=0x2, dw_storage=0x4, dw_points=0x8,
78 	dw_cvt=0x10, dw_raster=0x20, dw_gloss=0x40 };
79 
80 struct instrinfo {
81     int isel_pos;
82     int16 lheight,lpos;
83     char *scroll, *offset;
84     GWindow v;
85     GGadget *vsb;
86     int16 sbw;
87     int16 vheight, vwidth;
88     int16 lstopped;
89     int16 as, fh;
90     struct instrdata *instrdata;
91     GFont *gfont;
92     unsigned int showaddr: 1;
93     unsigned int showhex: 1;
94     unsigned int mousedown: 1;
95     void *userdata;
96     void (*selection_callback)(struct instrinfo *,int ip);
97     int  (*bpcheck)(struct instrinfo *,int ip);
98     int  (*handle_char)(struct instrinfo *,GEvent *e);
99 };
100 
101 struct reflist {
102     RefChar *ref;
103     struct reflist *parent;
104 };
105 
106 typedef struct debugview {
107     struct debugger_context *dc;	/* Local to freetype.c */
108     GWindow dv, v;
109     /* Windows for twilight points, cvt, registers, stack, storage, stack gloss */
110     GWindow regs, stack, storage, points, cvt, raster, gloss;	/* order matters */
111     GWindow points_v;
112     GGadget *cvtsb;
113     GGadget *pts_vsb;
114     GGadget *glosssb;
115     GGadget *storagesb;
116     GGadget *regsb;
117     GGadget *stacksb;
118     struct instrdata id;
119     struct instrinfo ii;
120     int dwidth, toph;
121     struct charview *cv;
122     double scalex, scaley;
123     int pts_head, cvt_offtop, gloss_offtop, storage_offtop, stack_offtop, reg_offtop;
124     int points_offtop;
125 
126     int codeSize;
127     uint8 initialbytes[4];
128     struct reflist *active_refs;
129     int last_npoints;
130     int layer;
131 } DebugView;
132 
133 
134 #define CV_TABMAX	100
135 
136 enum dv_coderange { cr_none=0, cr_fpgm, cr_prep, cr_glyph };	/* cleverly chosen to match ttobjs.h */
137 
138 struct freehand {
139     struct tracedata *head, *last;	/* for the freehand tool */
140     SplinePointList *current_trace;
141     int ignore_wobble;		/* Ignore wiggles smaller than this */
142     int skip_cnt;
143 };
144 
145 enum expandedge { ee_none, ee_nw, ee_up, ee_ne, ee_right, ee_se, ee_down,
146 		  ee_sw, ee_left, ee_max };
147 
148 enum { charviewtab_charselectedsz = 1024 };
149 typedef struct charviewtab
150 {
151     char charselected[ charviewtab_charselectedsz + 1 ];
152     char tablabeltxt[ charviewtab_charselectedsz + 1 ];
153     float xoff, yoff;
154     real scale;
155 } CharViewTab;
156 
157 enum { charview_cvtabssz = 100 };
158 
159 
160  /* approximately BACK_LAYER_MAX / 32 */
161 #define BACK_LAYERS_VIEW_MAX 8
162 
163 typedef struct charview {
164     CharViewBase b;
165     uint32 showback[BACK_LAYERS_VIEW_MAX];
166     unsigned int showfore:1;
167     unsigned int showgrids:1;
168     unsigned int showhhints:1;
169     unsigned int showvhints:1;
170     unsigned int showdhints:1;
171     unsigned int showpoints:1;
172     unsigned int alwaysshowcontrolpoints:1;
173     unsigned int showfilled:1;
174     unsigned int showrulers:1;
175     unsigned int showrounds:2;		/* 0=>no, 1=>auto, 2=>always */
176     unsigned int showmdx:1;
177     unsigned int showmdy:1;
178     unsigned int showhmetrics:1;
179     unsigned int showvmetrics:1;
180     unsigned int showblues:1;	/* 16 */
181     unsigned int showfamilyblues:1;
182     unsigned int showanchor:1;
183     unsigned int showpointnumbers:2;
184     unsigned int markextrema:1;
185     unsigned int markpoi:1;
186     unsigned int needsrasterize:1;		/* Rasterization (of fill or fontview) needed on mouse up */
187     unsigned int recentchange:1;		/* a change happened in the grids or background. don't need to rasterize */
188     unsigned int info_within: 1;		/* cursor is within main window */
189     unsigned int back_img_out_of_date: 1;	/* Force redraw of back image pixmap */
190     unsigned int cntrldown:1;
191     unsigned int joinvalid:1;
192     unsigned int widthsel:1;
193     unsigned int vwidthsel:1;
194     unsigned int lbearingsel:1;
195     unsigned int icsel:1;
196     unsigned int tah_sel:1;
197     unsigned int inactive:1;			/* When in a search view (32) */
198     unsigned int show_ft_results: 1;
199     unsigned int show_ft_results_live_update : 1;
200     unsigned int coderange: 2;			/* For the debugger */
201     unsigned int autonomous_ruler_w: 1;
202     unsigned int showcpinfo: 1;
203     unsigned int showtabs: 1;
204     unsigned int showsidebearings: 1;
205     unsigned int showing_spiro_pt_menu: 1;
206     unsigned int ruler_pressed: 1;
207     unsigned int ruler_pressedv: 1;
208     unsigned int showrefnames: 1;
209     unsigned int snapoutlines: 1;
210     unsigned int showalmosthvlines: 1;
211     unsigned int showalmosthvcurves: 1;
212     unsigned int checkselfintersects: 1;
213     unsigned int showdebugchanges: 1;
214     unsigned int inPreviewMode: 1;
215     unsigned int inDraggingComparisonOutline: 1;
216     unsigned int activeModifierControl: 1; //< Is control being held right now?
217     unsigned int activeModifierAlt: 1;     //< Is alt being held right now?
218     unsigned int changedActiveGlyph: 1;    //< Set in CVSwitchActiveSC() cleared in cvmouseup()
219 
220     int hvoffset;		/* for showalmosthvlines */
221     int layers_off_top;
222     GWindow gw, v;
223     GWindow hruler, vruler; /* Ruler pixmaps */
224     GGadget *vsb, *hsb, *mb, *tabs;
225     GFont *small, *normal;
226     GWindow icon;
227     GWindow ruler_w;
228     GWindow ruler_linger_w;
229     unichar_t ruler_linger_lines[40][80];
230     int ruler_linger_num_lines;
231     int num_ruler_intersections;
232     int allocated_ruler_intersections;
233     BasePoint *ruler_intersections;
234     int start_intersection_snapped;
235     int end_intersection_snapped;
236     GFont *rfont;
237     GTimer *pressed;
238     GWindow backimgs;
239     GIC *gic;
240     GIC *gwgic;
241     int width, height;
242     int mbh;    //< menu bar height
243     int charselectorh;  //< char selection input box height
244     int infoh;  //< info bar height
245     int rulerh; //< ruler height
246     int16 sas, sfh, sdh, nas, nfh;
247     BasePoint info;
248     SplinePoint *info_sp;
249     Spline *info_spline;
250     real info_t;
251     GPoint e;					/* mouse location */
252     GPoint olde;
253     BasePoint last_c;
254     BDFChar *filled;
255     GImage gi;					/* used for fill bitmap only */
256     int enc;
257     EncMap *map_of_enc;				/* Only use for comparison against fontview's map to see if our enc be valid */
258 						/*  Will not be updated when fontview is reencoded */
259     PressedOn p;
260     SplinePoint *lastselpt;
261     spiro_cp *lastselcp;
262     /*GWindow tools, layers;*/
263     int8 b1_tool, cb1_tool, b2_tool, cb2_tool;	/* Button 3 does a popup */
264     int8 b1_tool_old;				/* Used by mingw port */
265     int8 s1_tool, s2_tool, er_tool;		/* Bindings for wacom stylus and eraser */
266     int8 showing_tool, pressed_tool, pressed_display, had_control, active_tool;
267     int8 spacebar_hold;				/* spacebar is held down */
268     SplinePointList *active_spl;
269     SplinePoint *active_sp;
270     spiro_cp *active_cp;
271     IPoint handscroll_base;
272     uint16 rfh, ras;
273     BasePoint lastknife;
274     struct freehand freehand;
275     enum expandedge expandedge;
276     BasePoint expandorigin;
277     real expandwidth, expandheight;
278     SplinePointList *active_shape;
279     SplinePoint joinpos;
280     spiro_cp joincp;
281     SplineChar *template1, *template2;
282 #if HANYANG
283     struct jamodisplay *jamodisplay;
284 #endif
285     real oldwidth, oldvwidth;
286     real oldlbearing;
287     int16 oldic, oldtah;
288 #if _ModKeysAutoRepeat
289     GTimer *autorpt;
290     int keysym, oldstate;
291     int oldkeyx, oldkeyy;
292     GWindow oldkeyw;
293 #endif
294     PST *lcarets;
295     int16 nearcaret;
296 	/* freetype results display */
297     int16 ft_dpi, ft_ppemy, ft_ppemx, ft_depth;
298     real ft_pointsizey, ft_pointsizex;
299     struct freetype_raster *raster, *oldraster;
300     DebugView *dv;
301     uint32 mmvisible;
302     char *former_names[CV_TABMAX];
303     int former_cnt;
304     AnchorPoint *apmine, *apmatch;
305     SplineChar *apsc;
306     int guide_pos;
307     struct qg_data *qg;
308     int16 note_x, note_y;
309     struct dlistnode* pointInfoDialogs;
310     GGadget* charselector;     //< let the user type in more than one char to view at once.
311     GGadget* charselectorNext; //< move to next word in charselector
312     GGadget* charselectorPrev; //< move to prev word in charselector
313     int charselectoridx;
314     SplineChar* additionalCharsToShow [51]; //<  additionalCharsToShowLimit + 1 in size
315     int additionalCharsToShowActiveIndex;
316 
317     CharViewTab cvtabs[ charview_cvtabssz+1 ];
318     int oldtabnum, ctpos;
319 
320 } CharView;
321 
322 typedef struct bitmapview {
323     BDFChar *bc;
324     BDFFont *bdf;
325     struct fontview *fv;
326     EncMap *map_of_enc;
327     int enc;
328     GWindow gw, v;
329     GGadget *vsb, *hsb, *mb;
330     GGadget *recalc;
331     GFont *small;
332     int xoff, yoff;
333     int width, height;
334     int infoh, mbh;
335     int scale;
336     real scscale;
337     struct bitmapview *next;
338     unsigned int showfore:1;
339     unsigned int showoutline:1;
340     unsigned int showgrid:1;
341     unsigned int cntrldown:1;
342     unsigned int recentchange:1;
343     unsigned int clearing:1;
344     unsigned int shades_hidden:1;
345     unsigned int shades_down:1;
346     /*GWindow tools, layers;*/
347     int8 b1_tool, cb1_tool, b2_tool, cb2_tool;		/* Button 3 does a popup */
348     int8 s1_tool, s2_tool, er_tool;			/* Bindings for wacom stylus and eraser */
349     int8 showing_tool, pressed_tool, pressed_display, had_control, active_tool;
350     int pressed_x, pressed_y;
351     int info_x, info_y;
352     int event_x, event_y;
353     int16 sas, sfh;
354 #if _ModKeysAutoRepeat
355     GTimer *autorpt;
356     int keysym, oldstate;
357 #endif
358     int color;			/* for greyscale fonts (between 0,255) */
359     int color_under_cursor;
360 } BitmapView;
361 
362 struct aplist { AnchorPoint *ap; int connected_to, selected; struct aplist *next; };
363 
364 enum mv_grids { mv_hidegrid, mv_showgrid, mv_partialgrid, mv_hidemovinggrid };
365 enum mv_type { mv_kernonly, mv_widthonly, mv_kernwidth };
366 
367 struct metricchar {
368     int16 dx, dwidth;	/* position and width of the displayed char */
369     int16 dy, dheight;	/*  displayed info for vertical metrics */
370     int xoff, yoff;
371     int16 mx, mwidth;	/* position and width of the text underneath */
372     int16 kernafter;
373     unsigned int selected: 1;
374     GGadget *width, *lbearing, *rbearing, *kern, *name;
375     GGadget* updownkparray[10]; /* Cherry picked elements from width...kern allowing up/down key navigation */
376 };
377 
378 typedef struct metricsview {
379     struct fontview *fv;
380     SplineFont *sf;
381     int pixelsize;		/* If the user has manually requested a pixelsize */
382 				/*  then rasterize at that size no matter how large */
383 			        /*  the font is zoomed. For non-user requesed sizes */
384 			        /*  this is the pixelsize * zoom-factor */
385     BDFFont *bdf;		/* We can also see metric info on a bitmap font */
386     BDFFont *show;		/*  Or the rasterized version of the outline font */
387     GWindow gw, v;
388     GFont *font;
389     GGadget *hsb, *vsb, *mb, *text, *textPrev, *textNext, *script, *features, *subtable_list;
390     GGadget *namelab, *widthlab, *lbearinglab, *rbearinglab, *kernlab;
391     int16 xstart;
392     int16 width, height, dwidth;
393     int16 vwidth, vheight;
394     int16 mbh,sbh;
395     int16 topend;		/* y value of the end of the region containing the text field */
396     int16 displayend;		/* y value of the end of the region showing filled characters */
397     int16 fh, as;
398     int16 cmax, clen;
399     SplineChar **chars;		/* Character input stream */
400     struct opentype_str *glyphs;/* after going through the various gsub/gpos transformations */
401     struct metricchar *perchar;	/* One for each glyph above */
402     SplineChar **sstr;		/* Character input stream */
403     int16 mwidth, mbase;
404     int16 glyphcnt, max;
405     int16 pressed_x, pressed_y;
406     int16 activeoff;
407     int xoff, coff, yoff;
408     struct metricsview *next;
409     unsigned int right_to_left: 1;
410     unsigned int pressed: 1;
411     unsigned int pressedwidth: 1;
412     unsigned int pressedkern: 1;
413     unsigned int showgrid: 2;
414     unsigned int antialias: 1;
415     unsigned int vertical: 1;
416     unsigned int type: 2;		/* enum mv_type */
417     unsigned int usehinting: 1;         /* should the hints be used during the render */
418     unsigned int pixelsize_set_by_window;
419     int xp, yp, ap_owner;
420     BasePoint ap_start;
421     int cursor;
422     int scale_index;
423     struct lookup_subtable *cur_subtable;
424     GTextInfo *scriptlangs;
425     int word_index;
426     int layer;
427     int fake_unicode_base;
428     GIC *gwgic;
429     int ptsize, dpi;
430     int ybaseline;
431     int oldscript, oldlang;
432 } MetricsView;
433 
434 enum fv_metrics { fvm_baseline=1, fvm_origin=2, fvm_advanceat=4, fvm_advanceto=8 };
435 typedef struct fontview {
436     FontViewBase b;
437     BDFFont *show, *filled;
438     GWindow gw, v;
439     GFont **fontset;
440     GGadget *vsb, *mb;
441     GTimer *pressed;
442     GTimer *resize;
443     GEvent resize_event;
444     GIC *gic;
445     GIC *gwgic;
446     int width, height;		/* of v */
447     int16 infoh,mbh;
448     int16 lab_height, lab_as;
449     int16 colcnt, rowcnt;		/* of display window */
450     int32 rowoff, rowltot;		/* Can be really big in full unicode */
451     int16 cbw,cbh;			/* width/height of a character box */
452     int pressed_pos, end_pos;
453     unsigned int antialias:1;
454     unsigned int bbsized:1;		/* displayed bitmap should be scaled by bounding box rather than emsize */
455     unsigned int wasonlybitmaps:1;
456     /*unsigned int refstate: 3;*/	/* 0x1 => paste orig of all non exist refs, 0x2=>don't, 0x3 => don't warn about non-exist refs with no source font */
457     unsigned int touched: 1;
458     unsigned int showhmetrics: 4;
459     unsigned int showvmetrics: 4;
460     unsigned int drag_and_drop: 1;
461     unsigned int has_dd_no_cursor: 1;
462     unsigned int any_dd_events_sent: 1;
463     unsigned int resize_expected: 1;
464 	/* Some window managers do not honour my resize requests (if window is*/
465 	/*  maximized for example), but we depend on the resize request to    */
466 	/*  fix up the window. We do get a configure notify, but the window   */
467 	/*  stays the same size, so kludge things */
468     unsigned int glyphlabel: 2;
469     unsigned int notactive:1;			/* When embedded in a dlg */
470     int16 magnify;
471     int16 user_requested_magnify;
472     struct searchview *sv;
473     SplineChar *sc_near_top;
474     int sel_index;
475     struct lookup_subtable *cur_subtable;
476     struct qg_data *qg;
477     GPid pid_webfontserver;
478     bool script_unsaved; // Whether or not there's an unsaved script in script dialog
479 } FontView;
480 
481 typedef struct findsel {
482     GEvent *e;
483     real fudge;		/* One pixel fudge factor */
484     real xl,xh, yl, yh;	/* One pixel fudge factor */
485     real c_xl,c_xh, c_yl, c_yh;		/* fudge rectangle for control points, larger than above if alt is depressed */
486     unsigned int select_controls: 1;	/* notice control points */
487     unsigned int seek_controls: 1;	/* notice control points before base points */
488     unsigned int all_controls: 1;	/* notice control points even if the base points aren't selected (in truetype point numbering mode where all cps are visible) */
489     unsigned int alwaysshowcontrolpoints:1; /* if the BCP are forced on, then we want the selection code paths
490 					     * to also know that so the user can drag the BCP of a non selected splinepoint */
491     real scale;
492     PressedOn *p;
493 } FindSel;
494 
495 typedef struct searchview {
496     struct cvcontainer base;
497     FontView dummy_fv;
498     SplineFont dummy_sf;
499     LayerInfo layerinfo[2];
500     SplineChar *chars[2];
501     EncMap dummy_map;
502     int32 map[2], backmap[2];
503     uint8 sel[2];
504     CharView cv_srch, cv_rpl;
505     CharView *lastcv;
506 /* ****** */
507     GWindow gw;
508     GGadget *mb;
509     GFont *plain, *bold;
510     int mbh;
511     int fh, as;
512     int rpl_x, cv_y;
513     int cv_width, cv_height;
514     short button_height, button_width;
515 /* ****** */
516     SearchData sd;
517     unsigned int showsfindnext: 1;
518     unsigned int findenabled: 1;
519     unsigned int rplallenabled: 1;
520     unsigned int rplenabled: 1;
521     unsigned int isvisible: 1;
522 } SearchView;
523 
524 typedef struct mathkernview {
525     struct cvcontainer base;
526     FontView dummy_fv;
527     SplineFont dummy_sf;
528     LayerInfo layerinfo[2];
529     SplineChar sc_topright, sc_topleft, sc_bottomright, sc_bottomleft;
530     SplineChar *chars[4];
531     EncMap dummy_map;
532     int32 map[4], backmap[4];
533     uint8 sel[4];
534     CharView cv_topright, cv_topleft, cv_bottomright, cv_bottomleft;
535     CharView *lastcv;
536 /* ****** */
537     GWindow gw;
538     GWindow cvparent_w;
539     GGadget *mb;
540     GFont *plain, *bold;
541     int mbh;
542     int fh, as;
543     int mid_space, cv_y;
544     int cv_width, cv_height;
545     short button_height, button_width;
546 /* ****** */
547     SplineChar *cursc;
548     int def_layer;
549     struct mathkern *orig_mathkern;
550     uint8 saved_mathkern;		/* Can't just check if orig is non-NULL, because NULL is a perfectly valid initial state */
551     uint8 last_aspect;
552     uint8 done;
553 } MathKernDlg;
554 
555 # ifdef FONTFORGE_CONFIG_TILEPATH
556 
557 typedef struct tilepathdlg {
558     struct cvcontainer base;
559     FontView dummy_fv;
560     SplineFont dummy_sf;
561     LayerInfo layerinfo[2];
562     SplineChar sc_first, sc_medial, sc_final, sc_isolated;
563     SplineChar *chars[4];
564     EncMap dummy_map;
565     int32 map[4], backmap[4];
566     uint8 sel[4];
567     CharView cv_first, cv_medial, cv_final, cv_isolated;
568     CharView *lastcv;
569 /* ****** */
570     GWindow gw;
571     GGadget *mb;
572     GFont *plain, *bold;
573     int mbh;
574     int fh, as;
575     int mid_space, cv_y;
576     int cv_width, cv_height;
577 /* ****** */
578     struct tiledata *td;
579     SplineFont *base_sf;
580     uint8 done, oked;
581 } TilePathDlg;
582 extern void TPDCharViewInits(TilePathDlg *tpd, int cid);
583 extern void PTDCharViewInits(TilePathDlg *tpd, int cid);
584 #endif		/* Tile Path */
585 
586 typedef struct gradientdlg {
587     struct cvcontainer base;
588     FontView dummy_fv;
589     SplineFont dummy_sf;
590     LayerInfo layerinfo[2];
591     SplineChar sc_grad;
592     SplineChar *chars[1];
593     EncMap dummy_map;
594     int32 map[1], backmap[1];
595     uint8 sel[1];
596     CharView cv_grad;
597 /* ****** */
598     GWindow gw;
599     GGadget *mb;
600     GFont *plain, *bold;
601     int mbh;
602     int fh, as;
603     int mid_space, cv_y;
604     int cv_width, cv_height;
605 /* ****** */
606     uint8 done, oked;
607     struct gradient *active;
608 } GradientDlg;
609 extern void GDDCharViewInits(GradientDlg *gdd,int cid);
610 
611 typedef struct strokedlg {
612     struct cvcontainer base;
613     FontView dummy_fv;
614     SplineFont dummy_sf;
615     LayerInfo layerinfo[2];
616     SplineChar sc_stroke;
617     SplineChar *chars[1];
618     EncMap dummy_map;
619     int32 map[1], backmap[1];
620     uint8 sel[1];
621     CharView cv_stroke;
622     int cv_width, cv_height;
623     GGadget *mb;
624     int mbh;
625     SplineSet *old_convex;
626 /* ****** */
627     int done;
628     GWindow gw;
629     CharView *cv;
630     FontView *fv;
631     SplineFont *sf;
632     void (*strokeit)(void *,StrokeInfo *,int);
633     StrokeInfo *si;
634     GRect r1, r2;
635     int up[2];
636     int dontexpand;
637 } StrokeDlg;
638 extern void StrokeCharViewInits(StrokeDlg *sd,int cid);
639 
640 struct lksubinfo {
641     struct lookup_subtable *subtable;
642     unsigned int deleted: 1;
643     unsigned int new: 1;
644     unsigned int selected: 1;
645     unsigned int moved: 1;
646 };
647 
648 struct lkinfo {
649     OTLookup *lookup;
650     unsigned int open: 1;
651     unsigned int deleted: 1;
652     unsigned int new: 1;
653     unsigned int selected: 1;
654     unsigned int moved: 1;
655     int16 subtable_cnt, subtable_max;
656     struct lksubinfo *subtables;
657 };
658 
659 struct lkdata {
660     int cnt, max;
661     int off_top, off_left;
662     struct lkinfo *all;
663 };
664 
665 struct anchor_shows {
666     CharView *cv;
667     SplineChar *sc;
668     int restart;
669 };
670 
671 struct gfi_data {		/* FontInfo */
672     SplineFont *sf;
673     int def_layer;
674     GWindow gw;
675     int tn_active;
676     int private_aspect, ttfv_aspect, tn_aspect, tx_aspect, unicode_aspect;
677     int old_sel, old_aspect, old_lang, old_strid;
678     int ttf_set, names_set, tex_set;
679     int langlocalecode;	/* MS code for the current locale */
680     unsigned int family_untitled: 1;
681     unsigned int human_untitled: 1;
682     unsigned int done: 1;
683     unsigned int mpdone: 1;
684     unsigned int lk_drag_and_drop: 1;
685     unsigned int lk_dropablecursor: 1;
686     struct anchor_shows anchor_shows[2];
687     struct texdata texdata;
688     GFont *font;
689     int as, fh;
690     struct lkdata tables[2];
691     int lkwidth, lkheight;
692     int first_sel_lookup, first_sel_subtable;
693     int last_panose_family;
694 };
695 
696 struct kf_dlg /* : fvcontainer */ {
697     struct fvcontainer base;
698     struct lookup_subtable *sub;
699     GWindow gw, dw;
700     GFont *plain, *bold;
701     int fh, as;
702     GGadget *mb, *guts, *topbox;
703     int mbh, label2_y, infoh;
704 
705     SplineFont *sf;
706     int def_layer;
707     struct kf_results *results;
708     int done;
709 
710     FontView *active;
711     FontView *first_fv;
712     FontView *second_fv;
713 };
714 
715 enum genfam { gf_none, gf_macfamily, gf_ttc };
716 
717 extern void FVMarkHintsOutOfDate(SplineChar *sc);
718 extern void FVRefreshChar(FontView *fv,int gid);
719 extern void _FVMenuOpen(FontView *fv);
720 extern int _FVMenuSave(FontView *fv);
721 extern int _FVMenuSaveAs(FontView *fv);
722 extern int _FVMenuGenerate(FontView *fv,int family);
723 extern void _FVCloseWindows(FontView *fv);
724 extern char *GetPostScriptFontName(char *dir, bool mult, bool modal);
725 extern void MergeKernInfo(SplineFont *sf,EncMap *map);
726 extern int SFGenerateFont(SplineFont *sf,int layer, int family,EncMap *map);
727 
728 extern void NonLinearDlg(FontView *fv,struct charview *cv);
729 extern void FVChangeChar(FontView *fv,int encoding);
730 extern void FVMergeFonts(FontView *fv);
731 extern void FVInterpolateFonts(FontView *fv);
732 
733 extern void FVDeselectAll(FontView *fv);
734 
735 extern void FVAutoWidth2(FontView *fv);
736 /*extern void FVAutoKern(FontView *fv);*/
737 /*extern void FVAutoWidth(FontView *fv);*/
738 
739 extern void SC_MarkInstrDlgAsChanged(SplineChar *sc);
740 
741 extern void PythonUI_Init(void);
742 
743 extern void SCStroke(SplineChar *sc);
744 
745 extern void PfaEditSetFallback(void);
746 extern void RecentFilesRemember(char *filename);
747 extern void LastFonts_Save(void);
748 
749 struct debugger_context;
750 extern void DebuggerTerminate(struct debugger_context *dc);
751 extern void DebuggerReset(struct debugger_context *dc,real pointsizey, real pointsizex,int dpi,int dbg_fpgm, int is_bitmap);
752 extern struct debugger_context *DebuggerCreate(SplineChar *sc,int layer,real pointsizey,real pointsizex,int dpi,int dbg_fpgm, int is_bitmap);
753 enum debug_gotype { dgt_continue, dgt_step, dgt_next, dgt_stepout };
754 extern void DebuggerGo(struct debugger_context *dc,enum debug_gotype,DebugView *dv);
755 extern struct  TT_ExecContextRec_ *DebuggerGetEContext(struct debugger_context *dc);
756 extern void DebuggerToggleBp(struct debugger_context *dc,int range,int ip);
757 extern int DebuggerBpCheck(struct debugger_context *dc,int range,int ip);
758 extern void DebuggerSetWatches(struct debugger_context *dc,int n, uint8 *w);
759 extern uint8 *DebuggerGetWatches(struct debugger_context *dc, int *n);
760 extern void DebuggerSetWatchStores(struct debugger_context *dc,int n, uint8 *w);
761 extern uint8 *DebuggerGetWatchStores(struct debugger_context *dc, int *n);
762 extern int DebuggerIsStorageSet(struct debugger_context *dc, int index);
763 extern void DebuggerSetWatchCvts(struct debugger_context *dc,int n, uint8 *w);
764 extern uint8 *DebuggerGetWatchCvts(struct debugger_context *dc, int *n);
765 extern int DebuggingFpgm(struct debugger_context *dc);
766 
767 
768 extern void PrintFFDlg(FontView *fv,SplineChar *sc,MetricsView *mv);
769 extern void PrintWindowClose(void);
770 extern void InsertTextDlg(CharView *cv);
771 
772 extern char *Kern2Text(SplineChar *other,KernPair *kp,int isv);
773 extern char *PST2Text(PST *pst,SplineFont *sf);
774 
775 
776 
777 void EmboldenDlg(FontView *fv, CharView *cv);
778 void CondenseExtendDlg(FontView *fv, CharView *cv);
779 void ObliqueDlg(FontView *fv, CharView *cv);
780 void GlyphChangeDlg(FontView *fv, CharView *cv, enum glyphchange_type gc);
781 void ItalicDlg(FontView *fv, CharView *cv);
782 void ChangeXHeightDlg(FontView *fv,CharView *cv);
783 
784 extern int FVParseSelectByPST(FontView *fv,struct lookup_subtable *sub,
785 	int search_type);
786 extern void DropChars2Text(GWindow gw, GGadget *glyphs,GEvent *event);
787 
788 
789 extern void FVReplaceOutlineWithReference( FontView *fv, double fudge );
790 extern void SVDestroy(struct searchview *sv);
791 
792 
793 
794 extern int  SLICount(SplineFont *sf);
795 extern unichar_t *ClassName(const char *name,uint32 feature_tag,
796 	uint16 flags, int script_lang_index, int merge_with, int act_type,
797 	int macfeature,SplineFont *sf);
798 extern unichar_t *DecomposeClassName(const unichar_t *clsnm, unichar_t **name,
799 	uint32 *feature_tag, int *macfeature,
800 	uint16 *flags, uint16 *script_lang_index,int *merge_with,int *act_type,
801 	SplineFont *sf);
802 extern PST *AddSubs(PST *last,uint32 tag,char *name,uint16 flags,
803 	uint16 sli,SplineChar *sc);
804 
805 
806 extern void FVSetUIToMatch(FontView *destfv,FontView *srcfv);
807 extern void FVScrollToChar(FontView *fv,int i);
808 extern void FVRegenChar(FontView *fv,SplineChar *sc);
809 extern FontView *FontNew(void);
810 extern void _MenuWarnings(GWindow gw,struct gmenuitem *mi,GEvent *e);
811 extern void MenuPrefs(GWindow base,struct gmenuitem *mi,GEvent *e);
812 extern void MenuXRes(GWindow base,struct gmenuitem *mi,GEvent *e);
813 extern void MenuSaveAll(GWindow base,struct gmenuitem *mi,GEvent *e);
814 extern void MenuExit(GWindow base,struct gmenuitem *mi,GEvent *e);
815 extern void MenuHelp(GWindow base,struct gmenuitem *mi,GEvent *e);
816 extern void MenuIndex(GWindow base,struct gmenuitem *mi,GEvent *e);
817 extern void MenuAbout(GWindow base,struct gmenuitem *mi,GEvent *e);
818 extern void MenuLicense(GWindow base,struct gmenuitem *mi,GEvent *e);
819 extern void MenuNew(GWindow gw,struct gmenuitem *mi,GEvent *e);
820 extern void WindowMenuBuild(GWindow base,struct gmenuitem *mi,GEvent *);
821 extern void MenuRecentBuild(GWindow base,struct gmenuitem *mi,GEvent *);
822 extern void MenuScriptsBuild(GWindow base,struct gmenuitem *mi,GEvent *);
823 extern void mb2FreeGetText(GMenuItem2 *mb);
824 extern void mb2DoGetText(GMenuItem2 *mb);
825 extern void mbFreeGetText(GMenuItem *mb);
826 extern void mbDoGetText(GMenuItem *mb);
827 extern int RecentFilesAny(void);
828 extern void _aplistbuild(struct gmenuitem *mi,SplineFont *sf,
829 	void (*func)(GWindow,struct gmenuitem *,GEvent *));
830 extern int32 *ParseBitmapSizes(GGadget *g,char *msg,int *err);
831 extern GTextInfo *AddMacFeatures(GTextInfo *opentype,enum possub_type type,SplineFont *sf);
832 extern unichar_t *AskNameTag(char *title,unichar_t *def,uint32 def_tag,uint16 flags,
833 	int script_lang_index, enum possub_type type, SplineFont *sf, SplineChar *default_script,
834 	int merge_with,int act_type);
835 extern unichar_t *ShowScripts(unichar_t *usedef);
836 extern GTextInfo *SFLangList(SplineFont *sf,int addfinal,SplineChar *default_script);
837 extern GTextInfo **SFLangArray(SplineFont *sf,int addfinal);
838 extern int  ScriptLangList(SplineFont *sf,GGadget *list,int sli);
839 extern void GListDelSelected(GGadget *list);
840 extern void GListMoveSelected(GGadget *list,int offset);
841 extern GTextInfo *GListChangeLine(GGadget *list,int pos, const unichar_t *line);
842 extern GTextInfo *GListAppendLine(GGadget *list,const unichar_t *line,int select);
843 extern GTextInfo *GListChangeLine8(GGadget *list,int pos, const char *line);
844 extern GTextInfo *GListAppendLine8(GGadget *list,const char *line,int select);
845 extern void CharInfoInit(void);
846 extern void SCLigCaretCheck(SplineChar *sc,int clean);
847 extern char *DevTab_Dlg(GGadget *g, int r, int c);
848 extern int DeviceTableOK(char *dvstr, int *_low, int *_high);
849 extern void VRDevTabParse(struct vr *vr,struct matrix_data *md);
850 extern DeviceTable *DeviceTableParse(DeviceTable *dv,char *dvstr);
851 extern void DevTabToString(char **str,DeviceTable *adjust);
852 extern void ValDevTabToStrings(struct matrix_data *mds,int first_offset,ValDevTab *adjust);
853 extern void KpMDParse(SplineChar *sc,struct lookup_subtable *sub,
854 	struct matrix_data *possub,int rows,int cols,int i);
855 extern void GFI_LookupEnableButtons(struct gfi_data *gfi, int isgpos);
856 extern void GFI_LookupScrollbars(struct gfi_data *gfi, int isgpos, int refresh);
857 extern void FontInfo(SplineFont *sf,int layer,int aspect,int sync);
858 extern void FontInfoDestroy(SplineFont *sf);
859 extern void FontMenuFontInfo(void *fv);
860 extern struct enc *MakeEncoding(SplineFont *sf, EncMap *map);
861 extern void LoadEncodingFile(void);
862 extern void RemoveEncoding(void);
863 extern void SFPrivateInfo(SplineFont *sf);
864 extern void FVDelay(FontView *fv,void (*func)(FontView *));
865 extern void GFI_FinishContextNew(struct gfi_data *d,FPST *fpst, int success);
866 extern void SCPreparePopup(GWindow gw,SplineChar *sc, struct remap *remap, int enc, int actualuni);
867 enum outlinesfm_flags {
868     sfm_stroke=0x1,
869     sfm_fill=0x2,
870     sfm_nothing=0x4,
871     sfm_stroke_trans = 0x8,
872     sfm_clip = 0x16
873 };
874 extern void CVDrawSplineSetSpecialized( CharView *cv, GWindow pixmap, SplinePointList *set,
875 					Color fg, int dopoints, DRect *clip,
876 					enum outlinesfm_flags strokeFillMode,
877 					Color AlphaChannelOverride );
878 extern void CVDrawSplineSet(CharView *cv, GWindow pixmap, SplinePointList *set,
879 	Color fg, int dopoints, DRect *clip );
880 extern void CVDrawSplineSetOutlineOnly(CharView *cv, GWindow pixmap, SplinePointList *set,
881 	Color fg, int dopoints, DRect *clip, enum outlinesfm_flags strokeFillMode );
882 extern GWindow CVMakeTools(CharView *cv);
883 extern GWindow CVMakeLayers(CharView *cv);
884 extern GWindow BVMakeTools(BitmapView *bv);
885 extern GWindow BVMakeLayers(BitmapView *bv);
886 extern void CVSetLayer(CharView *cv,int layer);
887 extern int CVPaletteMnemonicCheck(GEvent *event);
888 extern int TrueCharState(GEvent *event);
889 extern void CVToolsPopup(CharView *cv, GEvent *event);
890 extern void BVToolsPopup(BitmapView *bv, GEvent *event);
891 extern real CVRoundRectRadius(void);
892 extern int CVRectElipseCenter(void);
893 extern void CVRectEllipsePosDlg(CharView *cv);
894 extern real CVStarRatio(void);
895 extern int CVPolyStarPoints(void);
896 extern StrokeInfo *CVFreeHandInfo(void);
897 extern void BVToolsSetCursor(BitmapView *bv, int state,char *device);
898 extern void CVToolsSetCursor(CharView *cv, int state,char *device);
899 extern int CVPaletteIsVisible(CharView *cv,int which);
900 extern void CVPaletteSetVisible(CharView *cv,int which,int visible);
901 extern void CVPalettesRaise(CharView *cv);
902 extern void CVLayersSet(CharView *cv);
903 extern void _CVPaletteActivate(CharView *cv,int force,int docking_changed);
904 extern void CVPaletteActivate(CharView *cv);
905 extern void CV_LayerPaletteCheck(SplineFont *sf);
906 extern void CVPalettesHideIfMine(CharView *cv);
907 extern int BVPaletteIsVisible(BitmapView *bv,int which);
908 extern void BVPaletteSetVisible(BitmapView *bv,int which,int visible);
909 extern void BVPaletteActivate(BitmapView *bv);
910 extern void BVPalettesHideIfMine(BitmapView *bv);
911 extern void BVPaletteColorChange(BitmapView *bv);
912 extern void BVPaletteColorUnderChange(BitmapView *bv,int color);
913 extern void BVPaletteChangedChar(BitmapView *bv);
914 extern void CVPaletteDeactivate(void);
915 extern void PalettesChangeDocking(void);
916 extern int CVPalettesWidth(void);
917 extern int BVPalettesWidth(void);
918 extern int CVInSpiro( CharView *cv );
919 
920 extern void CVDoTransform(CharView *cv, enum cvtools cvt );
921 
922 // apply transform to specified layer
923 extern void CVTransFuncLayer(CharView *cv,Layer *ly,real transform[6], enum fvtrans_flags flags);
924 // apply transform to the current layer only
925 extern void CVTransFunc(CharView *cv,real transform[6],enum fvtrans_flags);
926 // apply transform to all layers
927 extern void CVTransFuncAllLayers(CharView *cv,real transform[6], enum fvtrans_flags flags);
928 enum transdlg_flags { tdf_enableback=0x1, tdf_enablekerns=0x2,
929 	tdf_defaultkerns=0x4, tdf_addapply=0x8 };
930 extern void TransformDlgCreate(void *data,void (*transfunc)(void *,real *,int,BVTFunc *,enum fvtrans_flags),
931 	int (*getorigin)(void *,BasePoint *,int), enum transdlg_flags flags,
932 	enum cvtools cvt);
933 extern void BitmapDlg(FontView *fv,SplineChar *sc, int isavail);
934 extern int SimplifyDlg(SplineFont *sf,struct simplifyinfo *smpl);
935 extern void CVReviewHints(CharView *cv);
936 extern void CVCreateHint(CharView *cv,int ishstem,int preserveundoes);
937 extern void SCRemoveSelectedMinimumDistances(SplineChar *sc,int inx);
938 extern int CVExport(CharView *cv);
939 extern int BVExport(BitmapView *bv);
940 
941 extern void DrawAnchorPoint(GWindow pixmap,int x, int y,int selected);
942 extern void DefaultY(GRect *pos);
943 extern void CVDrawRubberRect(GWindow pixmap, CharView *cv);
944 extern void CVInfoDraw(CharView *cv, GWindow pixmap );
945 extern void CVChar(CharView *cv, GEvent *event );
946 extern void PI_ShowHints(SplineChar *sc, GGadget *list, int set);
947 extern GTextInfo *SCHintList(SplineChar *sc,HintMask *);
948 extern void CVResize(CharView *cv );
949 extern CharView *CharViewCreate(SplineChar *sc,FontView *fv,int enc);
950 extern void CharViewFinishNonStatic();
951 
952 /**
953  * Extended version of CharViewCreate() which allows a window to be created but
954  * not displayed.
955  */
956 extern CharView *CharViewCreateExtended(SplineChar *sc, FontView *fv,int enc, int show );
957 extern CharViewTab *CVGetActiveTab(CharView *cv);
958 extern void CharViewFree(CharView *cv);
959 extern int CVValid(SplineFont *sf, SplineChar *sc, CharView *cv);
960 extern void CVSetCharChanged(CharView *cv,int changed);
961 extern int CVAnySel(CharView *cv, int *anyp, int *anyr, int *anyi, int *anya);
962 extern int CVAnySelPoints(CharView *cv);
963 
964 /**
965  * Get all the selected points in the current cv.
966  * Caller must g_list_free() the returned value.
967  */
968 extern GList_Glib* CVGetSelectedPoints(CharView *cv);
969 extern void CVSelectPointAt(CharView *cv);
970 extern int CVClearSel(CharView *cv);
971 extern int CVSetSel(CharView *cv,int mask);
972 extern void CVInvertSel(CharView *cv);
973 extern int CVAllSelected(CharView *cv);
974 extern SplinePointList *CVAnySelPointList(CharView *cv);
975 extern int CVAnySelPoint(CharView *cv, SplinePoint **selsp, spiro_cp **selcp);
976 extern int CVOneThingSel(CharView *cv, SplinePoint **sp, SplinePointList **spl,
977 	RefChar **ref, ImageList **img, AnchorPoint **ap, spiro_cp **cp);
978 extern int CVOneContourSel(CharView *cv, SplinePointList **_spl,
979 	RefChar **ref, ImageList **img);
980 extern void CVInfoDrawText(CharView *cv, GWindow pixmap );
981 extern void CVImport(CharView *cv);
982 extern void BVImport(BitmapView *bv);
983 extern void FVImport(FontView *bv);
984 extern void CVFindCenter(CharView *cv, BasePoint *bp, int nosel);
985 extern void CVStroke(CharView *cv);
986 extern void FVStroke(FontView *fv);
987 extern void FreeHandStrokeDlg(StrokeInfo *si);
988 extern void OutlineDlg(FontView *fv, CharView *cv,MetricsView *mv,int isinline);
989 extern void ShadowDlg(FontView *fv, CharView *cv,MetricsView *mv,int wireframe);
990 extern void CVTile(CharView *cv);
991 extern void FVTile(FontView *fv);
992 extern void CVPatternTile(CharView *cv);
993 extern void FVPatternTile(FontView *fv);
994 extern void SCCharInfo(SplineChar *sc,int deflayer,EncMap *map,int enc);
995 extern void CharInfoDestroy(struct charinfo *ci);
996 extern SplineChar *SuffixCheck(SplineChar *sc,char *suffix);
997 extern void SCSubtableDefaultSubsCheck(SplineChar *sc, struct lookup_subtable *sub, struct matrix_data *possub, int col_cnt, int r,int layer);
998 extern GImage *PST_GetImage(GGadget *pstk,SplineFont *sf,int def_layer,
999 	struct lookup_subtable *sub,int popup_r, SplineChar *sc );
1000 extern GImage *NameList_GetImage(SplineFont *sf,SplineChar *sc,int def_layer,
1001 	char *namelist, int isliga );
1002 extern GImage *GV_GetConstructedImage(SplineChar *sc,int def_layer, struct glyphvariants *gv,
1003 	int is_horiz);
1004 extern GImage *SC_GetLinedImage(SplineChar *sc, int def_layer, int pos, int is_italic_cor);
1005 extern struct glyphvariants *GV_ParseConstruction(struct glyphvariants *gv,
1006 	struct matrix_data *stuff, int rows, int cols);
1007 extern void GV_ToMD(GGadget *g, struct glyphvariants *gv);
1008 extern void CVGetInfo(CharView *cv);
1009 extern void CVPGetInfo(CharView *cv);
1010 extern int  SCUsedBySubs(SplineChar *sc);
1011 extern void SCSubBy(SplineChar *sc);
1012 extern void SCRefBy(SplineChar *sc);
1013 extern void ApGetInfo(CharView *cv, AnchorPoint *ap);
1014 extern void CVMakeClipPath(CharView *cv);
1015 extern void CVAddAnchor(CharView *cv);
1016 extern AnchorClass *AnchorClassUnused(SplineChar *sc,int *waslig);
1017 extern void FVSetWidth(FontView *fv,enum widthtype wtype);
1018 extern void CVSetWidth(CharView *cv,enum widthtype wtype);
1019 extern void GenericVSetWidth(FontView *fv,SplineChar* sc,enum widthtype wtype);
1020 extern void CVChangeSC(CharView *cv, SplineChar *sc );
1021 extern Undoes *CVPreserveTState(CharView *cv);
1022 /**
1023  * If isTState > 0 then CVPreserveTState(cv)
1024  * otherwise CVPreserveState(cv)
1025  */
1026 extern Undoes *CVPreserveMaybeState(CharView *cv, int isTState );
1027 extern void CVRestoreTOriginalState(CharView *cv);
1028 extern void CVUndoCleanup(CharView *cv);
1029 
1030 extern void AdjustControls(SplinePoint *sp);
1031 extern void CVAdjustPoint(CharView *cv, SplinePoint *sp);
1032 extern void CVMergeSplineSets(CharView *cv, SplinePoint *active, SplineSet *activess,
1033 	SplinePoint *merge, SplineSet *mergess);
1034 extern void CVAdjustControl(CharView *cv,BasePoint *cp, BasePoint *to);
1035 extern int  CVMoveSelection(CharView *cv, real dx, real dy, uint32 input_state);
1036 extern int  CVTestSelectFromEvent(CharView *cv,GEvent *event);
1037 extern void CVMouseMovePen(CharView *cv, PressedOn *p, GEvent *event);
1038 extern void CVMouseUpPoint(CharView *cv,GEvent *event);
1039 extern int  CVMouseMovePointer(CharView *cv, GEvent *event);
1040 extern void CVMouseDownPointer(CharView *cv, FindSel *fs, GEvent *event);
1041 extern void CVMouseDownRuler(CharView *cv, GEvent *event);
1042 extern void CVMouseMoveRuler(CharView *cv, GEvent *event);
1043 extern int CVMouseAtSpline(CharView *cv,GEvent *event);
1044 extern void CVMouseUpRuler(CharView *cv, GEvent *event);
1045 extern void CVMouseMoveHand(CharView *cv, GEvent *event);
1046 extern void CVMouseDownFreeHand(CharView *cv, GEvent *event);
1047 extern void CVMouseMoveFreeHand(CharView *cv, GEvent *event);
1048 extern void CVMouseUpFreeHand(CharView *cv, GEvent *event);
1049 extern void CVMouseDownShape(CharView *cv,GEvent *event);
1050 extern void CPStartInfo(CharView *cv, GEvent *event);
1051 extern void CPUpdateInfo(CharView *cv, GEvent *event);
1052 extern void CPEndInfo(CharView *cv);
1053 extern void BVChar(BitmapView *cv, GEvent *event );
1054 extern void CVMouseDownPoint(CharView *cv,GEvent *event);
1055 extern void CVMouseMovePoint(CharView *cv,PressedOn *);
1056 extern void CVMouseUpPointer(CharView *cv );
1057 extern void CVCheckResizeCursors(CharView *cv);
1058 extern void CVMouseDownHand(CharView *cv);
1059 extern void CVMouseUpHand(CharView *cv);
1060 extern void CVMouseDownTransform(CharView *cv);
1061 extern void CVMouseMoveTransform(CharView *cv);
1062 extern void CVMouseUpTransform(CharView *cv);
1063 extern void CVMouseDownKnife(CharView *cv);
1064 extern void CVMouseMoveKnife(CharView *cv,PressedOn *);
1065 extern void CVMouseUpKnife(CharView *cv,GEvent *event);
1066 extern void CVMouseMoveShape(CharView *cv);
1067 extern void CVMouseUpShape(CharView *cv);
1068 extern void LogoExpose(GWindow pixmap,GEvent *event, GRect *r,enum drawmode dm);
1069 extern void CVDebugPointPopup(CharView *cv);
1070 
1071 extern int GotoChar(SplineFont *sf,EncMap *map, int *merge_with_selection);
1072 
1073 extern void CVShowPoint(CharView *cv, BasePoint *me);
1074 
1075 extern void BitmapViewFinishNonStatic();
1076 extern BitmapView *BitmapViewCreate(BDFChar *bc, BDFFont *bdf, FontView *fv,int enc);
1077 extern BitmapView *BitmapViewCreatePick(int enc, FontView *fv);
1078 extern void BitmapViewFree(BitmapView *bv);
1079 extern void BVMenuRotateInvoked(GWindow gw,struct gmenuitem *mi, GEvent *e);
1080 extern void BVRotateBitmap(BitmapView *bv,enum bvtools type );
1081 extern int  BVColor(BitmapView *bv);
1082 extern void BCGeneralFunction(BitmapView *bv,
1083 	void (*SetPoint)(BitmapView *,int x, int y, void *data),void *data);
1084 extern char *BVFlipNames[];
1085 extern void BVChangeBC(BitmapView *bv, BDFChar *bc, int fitit );
1086 
1087 extern void MVSetSCs(MetricsView *mv, SplineChar **scs);
1088 extern void MVRefreshChar(MetricsView *mv, SplineChar *sc);
1089 extern void MVRegenChar(MetricsView *mv, SplineChar *sc);
1090 extern void MVReKern(MetricsView *mv);
1091 extern void MetricsViewFinishNonStatic();
1092 extern MetricsView *MetricsViewCreate(FontView *fv,SplineChar *sc,BDFFont *bdf);
1093 extern void MetricsViewFree(MetricsView *mv);
1094 extern void MVRefreshAll(MetricsView *mv);
1095 extern void MV_FriendlyFeatures(GGadget *g, int pos);
1096 extern GTextInfo *SLOfFont(SplineFont *sf);
1097 
1098 extern void DoPrefs(void);
1099 extern void DoXRes(void);
1100 extern void PointerDlg(CharView *cv);
1101 extern void GListAddStr(GGadget *list,unichar_t *str, void *ud);
1102 extern void GListReplaceStr(GGadget *list,int index, unichar_t *str, void *ud);
1103 extern struct macname *NameGadgetsGetNames( GWindow gw );
1104 extern void NameGadgetsSetEnabled( GWindow gw, int enable );
1105 extern int GCDBuildNames(GGadgetCreateData *gcd,GTextInfo *label,int pos,struct macname *names);
1106 extern void GCDFillMacFeat(GGadgetCreateData *mfgcd,GTextInfo *mflabels, int width,
1107 	MacFeat *all, int fromprefs, GGadgetCreateData *boxes,
1108 	GGadgetCreateData **array);
1109 extern void Prefs_ReplaceMacFeatures(GGadget *list);
1110 
1111 extern void ShowAboutScreen(void);
1112 extern void DelayEvent(void (*func)(void *), void *data);
1113 
1114 extern void FindProblems(FontView *fv,CharView *cv,SplineChar *sc);
1115 typedef enum
1116 {
1117     constrainSelection_AveragePoints = 0,
1118     constrainSelection_SpacePoints = 1,
1119     constrainSelection_SpaceSelectedRegions = 2
1120 } constrainSelection_t;
1121 extern void CVConstrainSelection(CharView *cv, constrainSelection_t type);
1122 extern void CVMakeParallel(CharView *cv);
1123 
1124 extern void ScriptDlg(FontView *fv,CharView *cv);
1125 
1126 # if HANYANG
1127 extern void MenuNewComposition(GWindow gw, struct gmenuitem *, GEvent *);
1128 extern void CVDisplayCompositions(GWindow gw, struct gmenuitem *, GEvent *);
1129 extern void Disp_DoFinish(struct jamodisplay *d, int cancel);
1130 extern void Disp_RefreshChar(SplineFont *sf,SplineChar *sc);
1131 extern void Disp_DefaultTemplate(CharView *cv);
1132 # endif
1133 
1134 extern SearchView *SVCreate(FontView *fv);
1135 extern void SVCharViewInits(SearchView *sv);
1136 extern void SV_DoClose(struct cvcontainer *cvc);
1137 extern void SVMakeActive(SearchView *sv,CharView *cv);
1138 extern int SVAttachFV(FontView *fv,int ask_if_difficult);
1139 extern void SVDetachFV(FontView *fv);
1140 
1141 extern void MKDMakeActive(MathKernDlg *mkd,CharView *cv);
1142 extern void MKD_DoClose(struct cvcontainer *cvc);
1143 extern void MKDCharViewInits(MathKernDlg *mkd);
1144 extern void MathKernDialog(SplineChar *sc,int def_layer);
1145 
1146 extern void ShowAtt(SplineFont *sf,int def_layer);
1147 extern void FontCompareDlg(FontView *fv);
1148 extern void SFShowKernPairs(SplineFont *sf,SplineChar *sc,AnchorClass *ac,int layer);
1149 extern void SFShowLigatures(SplineFont *sf,SplineChar *sc);
1150 
1151 extern void SCEditInstructions(SplineChar *sc);
1152 extern void SFEditTable(SplineFont *sf, uint32 tag);
1153 extern void IIScrollTo(struct instrinfo *ii,int ip,int mark_stop);
1154 extern void IIReinit(struct instrinfo *ii,int ip);
1155 extern int ii_v_e_h(GWindow gw, GEvent *event);
1156 extern void instr_scroll(struct instrinfo *ii,struct sbevent *sb);
1157 
1158 extern void CVGridFitChar(CharView *cv);
1159 /**
1160  * If a live preview of grid fit is somehow in effect, call CVGridFitChar() for us.
1161  * A caller can call here after a change and any CVGridFitChar() will be updated if need be.
1162  */
1163 extern void CVGridHandlePossibleFitChar(CharView *cv);
1164 extern void CVFtPpemDlg(CharView *cv,int debug);
1165 extern void SCDeGridFit(SplineChar *sc);
1166 extern void SCReGridFit(SplineChar *sc,int layer);
1167 
1168 extern void CVDebugReInit(CharView *cv,int restart_debug,int dbg_fpgm);
1169 extern void CVDebugFree(DebugView *dv);
1170 extern int DVChar(DebugView *dv, GEvent *e);
1171 
1172 extern void KernClassD(KernClass *kc, SplineFont *sf, int layer, int isv);
1173 extern void ShowKernClasses(SplineFont *sf,MetricsView *mv,int layer,int isv);
1174 extern void KCLD_End(struct kernclasslistdlg *kcld);
1175 extern void KCLD_MvDetach(struct kernclasslistdlg *kcld,MetricsView *mv);
1176 extern void KernPairD(SplineFont *sf,SplineChar *sc1,SplineChar *sc2,int layer, int isv);
1177 extern void KCD_DrawGlyph(GWindow pixmap,int x,int baseline,BDFChar *bdfc,int mag);
1178 extern GTextInfo *BuildFontList(FontView *except);
1179 extern void TFFree(GTextInfo *tf);
1180 
1181 extern void AnchorControl(SplineChar *sc,AnchorPoint *ap,int layer);
1182 extern void AnchorControlClass(SplineFont *_sf,AnchorClass *ac,int layer);
1183 
1184 extern void FVSelectByPST(FontView *fv);
1185 
1186 enum hist_type { hist_hstem, hist_vstem, hist_blues };
1187 struct psdict;
1188 extern void SFHistogram(SplineFont *sf,int layer, struct psdict *private,uint8 *selected,
1189 	EncMap *map, enum hist_type which);
1190 
1191 extern void ContextChainEdit(SplineFont *sf,FPST *fpst,
1192 	struct gfi_data *gfi,unichar_t *newname,int layer);
1193 extern char *cu_copybetween(const unichar_t *start, const unichar_t *end);
1194 
1195 extern void StateMachineEdit(SplineFont *sf,ASM *sm,struct gfi_data *d);
1196 extern void GFI_FinishSMNew(struct gfi_data *d,ASM *sm, int success,int isnew);
1197 
1198 extern void MMChangeBlend(MMSet *mm,FontView *fv,int tonew);
1199 extern void MMWizard(MMSet *mm);
1200 
1201 extern int LayerDialog(Layer *layer,SplineFont *sf);
1202 extern void CVLayerChange(CharView *cv);
1203 
1204 extern int PointOfViewDlg(struct pov_data *pov,SplineFont *sf,int flags);
1205 
1206 extern SplineChar *FVMakeChar(FontView *fv,int i);
1207 
1208 extern void CVPointOfView(CharView *cv,struct pov_data *);
1209 
1210 extern void DVCreateGloss(DebugView *dv);
1211 extern void DVMarkPts(DebugView *dv,SplineSet *ss);
1212 extern int CVXPos(DebugView *dv,int offset,int width);
1213 
1214 extern GMenuItem *GetEncodingMenu(void (*func)(GWindow,GMenuItem *,GEvent *),
1215 	Encoding *current);
1216 
1217 extern GTextInfo *TIFromName(const char *name);
1218 
1219 enum subtable_data_flags {
1220     /* I have flags for each alternative because I want "unspecified" to be */
1221     /*  an option */
1222     sdf_kernclass      = 0x01,
1223     sdf_kernpair       = 0x02,
1224     sdf_verticalkern   = 0x04,
1225     sdf_horizontalkern = 0x08,
1226     sdf_dontedit       = 0x10
1227 };
1228 struct subtable_data {
1229     int flags;
1230     SplineChar *sc;
1231 };
1232 
1233 extern GTextInfo **SFLookupListFromType(SplineFont *sf, int lookup_type );
1234 extern GTextInfo *SFLookupArrayFromType(SplineFont *sf, int lookup_type );
1235 extern GTextInfo *SFLookupArrayFromMask(SplineFont *sf, int lookup_mask );
1236 extern GTextInfo **SFSubtablesOfType(SplineFont *sf, int lookup_type, int kernclass, int add_none);
1237 extern GTextInfo *SFSubtableListOfType(SplineFont *sf, int lookup_type, int kernclass, int add_none);
1238 extern struct lookup_subtable *SFNewLookupSubtableOfType(SplineFont *sf, int lookup_type, struct subtable_data *sd, int def_layer );
1239 extern int EditLookup(OTLookup *otl,int isgpos,SplineFont *sf);
1240 extern int EditSubtable(struct lookup_subtable *sub,int isgpos,SplineFont *sf,
1241 	struct subtable_data *sd,int def_layer);
1242 extern void _LookupSubtableContents(SplineFont *sf, struct lookup_subtable *sub,
1243 	struct subtable_data *sd,int def_layer);
1244 extern char *SCNameUniStr(SplineChar *sc);
1245 extern unichar_t *uSCNameUniStr(SplineChar *sc);
1246 extern char *SFNameList2NameUni(SplineFont *sf, char *str);
1247 extern unichar_t **SFGlyphNameCompletion(SplineFont *sf,GGadget *t,int from_tab,
1248 	int new_name_after_space);
1249 extern char *GlyphNameListDeUnicode( char *str );
1250 extern void AddRmLang(SplineFont *sf, struct lkdata *lk,int add_lang);
1251 extern void FVMassGlyphRename(FontView *fv);
1252 
1253 extern void SFBdfProperties(SplineFont *sf, EncMap *map, BDFFont *thisone);
1254 
1255 
1256 
1257 extern GMenuItem2 helplist[];
1258 extern BasePoint last_ruler_offset[];
1259 
1260 extern void CVCopyLayerToLayer(CharView *cv);
1261 extern void FVCopyLayerToLayer(FontView *fv);
1262 extern void CVCompareLayerToLayer(CharView *cv);
1263 extern void FVCompareLayerToLayer(FontView *fv);
1264 
1265 extern void MathInit(void);
1266 extern void SFMathDlg(SplineFont *sf,int def_layer);
1267 
1268 extern GMenuItem2 *cvpy_menu, *fvpy_menu;
1269 extern void cvpy_tllistcheck(GWindow gw,struct gmenuitem *mi,GEvent *e);
1270 extern void fvpy_tllistcheck(GWindow gw,struct gmenuitem *mi,GEvent *e);
1271 
1272 extern GMenuItem2 *cv_menu, *fv_menu;
1273 extern void cv_tl2listcheck(GWindow gw,struct gmenuitem *mi,GEvent *e);
1274 extern void fv_tl2listcheck(GWindow gw,struct gmenuitem *mi,GEvent *e);
1275 
1276 extern void SFValidationWindow(SplineFont *sf,int layer, enum fontformat format);
1277 extern void ValidationDestroy(SplineFont *sf);
1278 
1279 
1280 
1281 extern const char *UI_TTFNameIds(int id);
1282 extern const char *UI_MSLangString(int language);
1283 extern void FontInfoInit(void);
1284 extern void LookupUIInit(void);
1285 extern void _ImportParamsDlg(ImportParams *ip);
1286 extern void _ExportParamsDlg(ExportParams *ep);
1287 extern struct cidmap *AskUserForCIDMap(void);
1288 
1289 extern void DefineGroups(struct fontview *fv);
1290 extern void DisplayGroups(struct fontview *fv);
1291 
1292 extern struct Base *SFBaselines(SplineFont *sf,struct Base *old,int is_vertical);
1293 extern void JustifyDlg(SplineFont *sf);
1294 extern char *GlyphListDlg(SplineFont *sf, char *glyphstr);
1295 
1296 extern void DeltaSuggestionDlg(FontView *fv,CharView *cv);
1297 extern void QGRmFontView(struct qg_data *qg,FontView *fv);
1298 extern void QGRmCharView(struct qg_data *qg,CharView *cv);
1299 
1300 
1301 extern struct hslrgb *SFFontCols(SplineFont *sf,struct hslrgb fontcols[6]);
1302 
1303 extern Color view_bgcol;	/* Background color for views */
1304 extern void MVColInit(void);
1305 extern void CVColInit( void );
1306 extern void BVColInit( void );
1307 
1308 extern void FontViewRemove(FontView *fv);
1309 extern void FontViewFinishNonStatic();
1310 extern void FVChar(FontView *fv,GEvent *event);
1311 extern void FVDrawInfo(FontView *fv,GWindow pixmap,GEvent *event);
1312 extern void FVRedrawAllCharViews(FontView *fv);
1313 extern void KFFontViewInits(struct kf_dlg *kf,GGadget *drawable);
1314 extern char *GlyphSetFromSelection(SplineFont *sf,int def_layer,char *current);
1315 extern void ME_ListCheck(GGadget *g,int r, int c, SplineFont *sf);
1316 extern void ME_SetCheckUnique(GGadget *g,int r, int c, SplineFont *sf);
1317 extern void ME_ClassCheckUnique(GGadget *g,int r, int c, SplineFont *sf);
1318 extern void PI_Destroy(struct dlistnode *node);
1319 struct gidata;
1320 extern void PIChangePoint(struct gidata *ci);
1321 
1322 extern void CVRegenFill(CharView *cv);
1323 extern void RulerDlg(CharView *cv);
1324 extern int  CVCountSelectedPoints(CharView *cv);
1325 extern void _CVMenuInsertPt(CharView *cv);
1326 extern void _CVMenuNamePoint(CharView *cv, SplinePoint *sp);
1327 extern void _CVMenuNameContour(CharView *cv);
1328 
1329 extern void Prefs_LoadDefaultPreferences( void );
1330 
1331 
1332 extern void SPSelectNextPoint( SplinePoint *sp, int state );
1333 extern void SPSelectPrevPoint( SplinePoint *sp, int state );
1334 
1335 
1336 /**
1337  * Is the next BCP for the sp selected, and is it the primary BCP for the selection
1338  * @see SPIsNextCPSelected
1339  */
1340 extern bool SPIsNextCPSelectedSingle( SplinePoint *sp, CharView *cv );
1341 /**
1342  * Is the prev BCP for the sp selected, and is it the primary BCP for the selection
1343  * @see SPIsNextCPSelected
1344  */
1345 extern bool SPIsPrevCPSelectedSingle( SplinePoint *sp, CharView *cv );
1346 /**
1347  * Is the next BCP for the sp selected, it can be the primary or any
1348  * of the secondary selected BCP
1349  *
1350  * The last selected BCP is the 'primary' selected BCP. Code which
1351  * only handles a single selected BCP will only honor the primary
1352  * selected BCP
1353  *
1354  * There can also be one or more seconday selected BCP. These might be
1355  * drawn with slightly less highlight graphically and are only handled
1356  * by code which has been updated to allow mutliple selected BCP to be
1357  * operated on at once.
1358  */
1359 extern bool SPIsNextCPSelected( SplinePoint *sp, CharView *cv );
1360 /**
1361  * Is the prev BCP for the sp selected, it can be the primary or any of the secondary selected BCP
1362  *
1363  * @see SPIsNextCPSelected
1364  */
1365 extern bool SPIsPrevCPSelected( SplinePoint *sp, CharView *cv );
1366 
1367 typedef struct FE_adjustBCPByDeltaDataS
1368 {
1369     CharView *cv; //< used to update view
1370     real dx;      //< Add this to the BCP x
1371     real dy;      //< Add this to the BCP y
1372     int keyboarddx;
1373 
1374 } FE_adjustBCPByDeltaData;
1375 
1376 
1377 /**
1378  * Visitor function type for visitSelectedControlPoints()
1379  */
1380 typedef void (*visitSelectedControlPointsVisitor) ( void* key,
1381 						    void* value,
1382 						    SplinePoint* sp,
1383 						    BasePoint *which,
1384 						    bool isnext,
1385 						    void* udata );
1386 
1387 /**
1388  * Visitor function to move each BCP by data->dx/data->dy
1389  *
1390  *
1391  * Visitor: visitSelectedControlPointsVisitor
1392  * UsedBy:  CVFindAndVisitSelectedControlPoints
1393  */
1394 extern void FE_adjustBCPByDelta( void* key,
1395 				 void* value,
1396 				 SplinePoint* sp,
1397 				 BasePoint *which,
1398 				 bool isnext,
1399 				 void* udata );
1400 
1401 extern void FE_adjustBCPByDeltaWhilePreservingBCPAngle( void* key,
1402 							void* value,
1403 							SplinePoint* sp,
1404 							BasePoint *which,
1405 							bool isnext,
1406 							void* udata );
1407 
1408 /**
1409  * Visitor function to unselect every BCP passed
1410  *
1411  * Visitor: visitSelectedControlPointsVisitor
1412  * UsedBy:  CVFindAndVisitSelectedControlPoints
1413  *          CVUnselectAllBCP
1414  *
1415  * @see SPIsNextCPSelected
1416  */
1417 extern void FE_unselectBCP( void* key,
1418 			    void* value,
1419 			    SplinePoint* sp,
1420 			    BasePoint *which,
1421 			    bool isnext,
1422 			    void* udata );
1423 
1424 extern void FE_touchControlPoint( void* key,
1425 				  void* value,
1426 				  SplinePoint* sp,
1427 				  BasePoint *which,
1428 				  bool isnext,
1429 				  void* udata );
1430 
1431 /**
1432  * Find all the selected BCP and apply the visitor function f to them
1433  * passing the user data pointer udata to the 'f' visitor.
1434  *
1435  * This function doesn't use udata at all, it simply passes it on to
1436  * your visitor function so it may do something with it like record
1437  * results or take optional parameters.
1438  *
1439  * If preserveState is true and there are selected BCP then
1440  * CVPreserveState() is called before the visitor function.
1441  */
1442 extern void CVFindAndVisitSelectedControlPoints( CharView *cv, bool preserveState,
1443 						 visitSelectedControlPointsVisitor f, void* udata );
1444 /**
1445  * NOTE: doesn't do all, just all on selected spline.
1446  */
1447 extern void CVVisitAllControlPoints( CharView *cv, bool preserveState,
1448 				     visitSelectedControlPointsVisitor f, void* udata );
1449 
1450 /**
1451  * Unselect all the BCP which are currently selected.
1452  */
1453 extern void CVUnselectAllBCP( CharView *cv );
1454 
1455 
1456 /**
1457  * This will call your visitor function 'f' on any selected BCP. This
1458  * is regardless of if the BCP is the next or prev BCP for it's
1459  * splinepoint.
1460  *
1461  * This function doesn't use udata at all, it simply passes it on to
1462  * your visitor function so it may do something with it like record
1463  * results or take optional parameters.
1464  */
1465 extern void visitSelectedControlPoints( GHashTable *col, visitSelectedControlPointsVisitor f, gpointer udata );
1466 /**
1467  * NOTE: doesn't do all, just all on selected spline.
1468  */
1469 extern void visitAllControlPoints( GHashTable *col, visitSelectedControlPointsVisitor f, gpointer udata );
1470 
1471 extern void CVVisitAdjacentToSelectedControlPoints( CharView *cv, bool preserveState,
1472 						    visitSelectedControlPointsVisitor f, void* udata );
1473 
1474 extern bool CVShouldInterpolateCPsOnMotion( CharView* cv );
1475 
1476 extern int CVNearRBearingLine( CharView* cv, real x, real fudge );
1477 extern int CVNearLBearingLine( CharView* cv, real x, real fudge );
1478 
1479 extern void CVMenuConstrain(GWindow gw, struct gmenuitem *mi, GEvent *UNUSED(e));
1480 
1481 
1482 
1483 #endif /* FONTFORGE_VIEWS_H */
1484