1 #ifndef _h_gbdfed
2 #define _h_gbdfed
3 
4 #include <gtk/gtk.h>
5 #include <gdk/gdkkeysyms.h>
6 #include "bdf.h"
7 
8 G_BEGIN_DECLS
9 
10 #define GBDFED_VERSION "1.6"
11 
12 /*************************************************************************
13  *
14  * Types.
15  *
16  *************************************************************************/
17 
18 typedef struct {
19     gboolean gbdfed_opts;
20 
21     gchar *accelerator;
22     gchar *accelerator_text;
23     gchar *unicode_name_file;
24     gchar *adobe_name_file;
25     gboolean no_blanks;
26     gboolean really_exit;
27     gboolean overwrite_mode;
28     gint initial_glyph;
29     unsigned int pixel_size;
30     unsigned int resolution;
31     gboolean show_cap_height;
32     gboolean show_x_height;
33 #if 0
34     gboolean vertical;
35 #endif
36     gboolean power2;
37 #if 0
38     gboolean colors_allocated;
39 #endif
40     unsigned short colors[20];
41 #if 0
42     guint32 pixels[20];
43 #endif
44     gboolean sbit;
45     gboolean backups;
46     guint code_base;
47     GtkOrientation orientation;
48     bdf_options_t font_opts;
49 } gbdfed_options_t;
50 
51 typedef struct {
52     /*
53      * Numeric ID for the editor.
54      */
55     guint id;
56 
57     /*
58      * Path and filenames of the font in question.
59      */
60     gchar *path;
61     gchar *file;
62 
63     GtkAccelGroup *ag;
64     GtkWidget *shell;
65 
66     /*
67      * The Open/Save file selection dialogs that will be used for related
68      * operations as well as the original.
69      */
70     GtkWidget *open_dialog;
71     GtkWidget *save_dialog;
72 
73     /*
74      * The menus that need to have item sensitivity checked on popup and
75      * popdown.
76      */
77     GtkWidget *file_menu;
78     GtkWidget *edit_menu;
79     GtkWidget *name_submenu;
80     GtkWidget *view_menu;
81     GtkWidget *ops_menu;
82     GtkWidget *win_menu;
83 
84     /*
85      * This editor's item on the Windows menu.  Used to toggle sensitivity.
86      */
87     GtkWidget *win_menu_item;
88 
89     /*
90      * The font name field.
91      */
92     GtkWidget *fontname;
93 
94     /*
95      * The encoding and metrics labels.
96      */
97     GtkWidget *charinfo;
98     GtkWidget *metrics;
99 
100     /*
101      * The paging buttons and page tracking variables.
102      */
103     GtkWidget *first;
104     GtkWidget *prev;
105     GtkWidget *next;
106     GtkWidget *last;
107     gint32 last_upageno;
108     gint32 last_pageno;
109 
110     /*
111      * The Page number and character code input fields.
112      */
113     GtkWidget *pageno;
114     GtkWidget *charno;
115 
116     /*
117      * The FontGrid widget.
118      */
119     GtkWidget *fgrid;
120 
121     /*
122      * Widgets that may change sensitivity depending on the state of the font
123      * being edited.
124      */
125     GtkWidget *file_save;
126     GtkWidget *file_export;
127 
128     GtkWidget *edit_cut;
129     GtkWidget *edit_copy;
130     GtkWidget *edit_paste;
131     GtkWidget *edit_overlay;
132     GtkWidget *edit_insert;
133     GtkWidget *edit_rename_glyphs;
134     GtkWidget *edit_rename_menu;
135     GtkWidget *edit_make_xlfd;
136     GtkWidget *edit_unicode_names;
137     GtkWidget *edit_adobe_names;
138     GtkWidget *edit_test_glyphs;
139 
140     /*
141      * These are the toggle widgets that change the code base displayed
142      * in the Fontgrid to octal, decimal, or hex.
143      */
144     GtkWidget *view_oct;
145     GtkWidget *view_dec;
146     GtkWidget *view_hex;
147 
148     /*
149      * The widget that toggles the view between the encoded and unencoded
150      * sections of the font.
151      */
152     GtkWidget *view_unencoded;
153 
154     /*
155      * The orientation label which changes depending on the current
156      * orientation of the Fontgrid.
157      */
158     GtkWidget *view_orientation;
159 
160     /*
161      * This is the font messages menu item that may or may not be
162      * enabled.
163      */
164     GtkWidget *view_messages;
165 
166     /*
167      * These are the widgets that make up the font messages dialog which is
168      * used to record the font I/O and modification messages.
169      */
170     GtkWidget *messages_label;
171     GtkWidget *messages_text;
172     GtkWidget *messages_dialog;
173 
174     /*
175      * These fields specify the font format being imported or exported.
176      */
177     guint import_format;
178     guint export_format;
179 
180     /*
181      * These are the preference widgets.
182      */
183     GtkWidget *pref_dialog;
184 
185     /*
186      * These are the widgets for editing information about the font.
187      */
188     GtkWidget *finfo_notebook;
189     GtkWidget *finfo_dialog;
190     GtkWidget *finfo_comments;
191     GtkWidget *finfo_erase_comments;
192     GtkWidget *finfo_apply_comments;
193     GtkWidget *finfo_font_props;
194     GtkWidget *finfo_all_props;
195     GtkWidget *finfo_prop_name;
196     GtkWidget *finfo_prop_value;
197     GtkWidget *finfo_prop_format[4];
198     GtkWidget *finfo_apply_prop;
199     GtkWidget *finfo_delete_prop;
200 
201     GtkWidget *finfo_enc_count;
202     GtkWidget *finfo_unenc_count;
203 
204     GtkWidget *finfo_default_char;
205 
206     GtkWidget *finfo_spacing[4];
207 
208     GtkWidget *finfo_hres;
209     GtkWidget *finfo_vres;
210     GtkWidget *finfo_bpp;
211 
212     GtkWidget *finfo_dwidth;
213     GtkWidget *finfo_ascent;
214     GtkWidget *finfo_descent;
215 
216     GtkWidget *finfo_apply_info;
217     gboolean finfo_xlfd_props_modified;
218 
219     /*
220      * A flag to indicate if the font was just imported from a non-BDF format
221      * file.  It is set to FALSE whenever a save of any kind is done.
222      */
223     gboolean imported;
224 
225 } gbdfed_editor_t;
226 
227 /*************************************************************************
228  *
229  * Globals.
230  *
231  *************************************************************************/
232 
233 #include "fontgrid.h"
234 #if 0
235 #include "colorswatch.h"
236 #endif
237 #include "glyphtest.h"
238 
239 /*
240  * List of editors and their number.
241  */
242 extern gbdfed_editor_t *editors;
243 extern guint num_editors;
244 
245 /*
246  * Buffers used for making messages and filenames.
247  */
248 extern gchar buffer1[];
249 extern gchar buffer2[];
250 
251 /*
252  * Options for loading/saving fonts and other application options.
253  */
254 extern gbdfed_options_t options;
255 
256 /*************************************************************************
257  *
258  * The glyph test widget used by all editors in one session.
259  *
260  *************************************************************************/
261 
262 extern GtkWidget *glyphtest;
263 
264 /*************************************************************************
265  *
266  * Other functions: gbdfed.c
267  *
268  *************************************************************************/
269 
270 extern guint gbdfed_make_editor(gchar *, gboolean);
271 
272 /*************************************************************************
273  *
274  * File menu functions: guifile.c
275  *
276  *************************************************************************/
277 
278 /*
279  * New editor creation callback.
280  */
281 extern void guifile_new_editor(GtkWidget *, gpointer);
282 
283 /*
284  * File import callbacks.
285  */
286 extern void guifile_import_bdf_font(GtkWidget *, gpointer);
287 extern void guifile_import_console_font(GtkWidget *, gpointer);
288 extern void guifile_import_pkgf_font(GtkWidget *, gpointer);
289 extern void guifile_import_windows_font(GtkWidget *, gpointer);
290 
291 #ifdef HAVE_HBF
292 extern void guifile_import_hbf_font(GtkWidget *, gpointer);
293 #endif
294 
295 #ifdef HAVE_FREETYPE
296 extern void guifile_import_otf_font(GtkWidget *, gpointer);
297 #endif /* HAVE_FREETYPE */
298 
299 #ifdef HAVE_XLIB
300 extern void guifile_import_xserver_font(GtkWidget *, gpointer);
301 #endif
302 
303 /*
304  * File save callbacks.
305  */
306 extern void guifile_save_as(GtkWidget *, gpointer);
307 extern void guifile_save_as_wait(GtkWidget *, gpointer);
308 extern void guifile_save(GtkWidget *, gpointer);
309 extern void guifile_export_psf_font(GtkWidget *, gpointer);
310 extern void guifile_export_hex_font(GtkWidget *, gpointer);
311 
312 /*
313  * Special direct BDF font load call for recent fonts menu.
314  */
315 extern void guifile_load_bdf_font(gbdfed_editor_t *ed, const gchar *filename);
316 
317 /*************************************************************************
318  *
319  * Edit functions: guiedit.c
320  *
321  *************************************************************************/
322 
323 extern void guiedit_set_unicode_glyph_names(GtkWidget *, gpointer);
324 extern void guiedit_set_adobe_glyph_names(GtkWidget *, gpointer);
325 extern void guiedit_set_uni_glyph_names(GtkWidget *, gpointer);
326 extern void guiedit_set_zerox_glyph_names(GtkWidget *, gpointer);
327 extern void guiedit_set_uplus_glyph_names(GtkWidget *, gpointer);
328 extern void guiedit_set_bslashu_glyph_names(GtkWidget *, gpointer);
329 extern void guiedit_show_font_info(GtkWidget *, gpointer);
330 extern void guiedit_show_font_comments(GtkWidget *, gpointer);
331 extern void guiedit_show_font_properties(GtkWidget *, gpointer);
332 extern void guiedit_update_font_info(gbdfed_editor_t *);
333 extern void guiedit_update_font_properties(gbdfed_editor_t *);
334 extern void guiedit_update_font_details(gbdfed_editor_t *);
335 extern void guiedit_update_code_base(gbdfed_editor_t *);
336 extern void guiedit_copy_selection(GtkWidget *, gpointer);
337 extern void guiedit_cut_selection(GtkWidget *, gpointer);
338 extern void guiedit_paste_selection(GtkWidget *, gpointer);
339 extern void guiedit_overlay_selection(GtkWidget *, gpointer);
340 extern void guiedit_insert_selection(GtkWidget *, gpointer);
341 extern void guiedit_show_glyphtest(GtkWidget *, gpointer);
342 
343 /*************************************************************************
344  *
345  * Glyph edit functions: guigedit.c
346  *
347  *************************************************************************/
348 
349 extern void guigedit_edit_glyph(gbdfed_editor_t *ed,
350                                 FontgridSelectionInfo *si);
351 
352 extern void guigedit_show_cap_height(gboolean show);
353 extern void guigedit_show_x_height(gboolean show);
354 extern void guigedit_set_pixel_size(guint pixel_size);
355 extern void guigedit_set_font_spacing(gint spacing, guint16 monowidth);
356 extern void guigedit_set_font_spacing(gint spacing, guint16 monowidth);
357 extern void guigedit_set_code_base(gint code_base);
358 
359 extern void guigedit_cleanup(void);
360 
361 
362 /*************************************************************************
363  *
364  * Preference functions: guipref.c
365  *
366  *************************************************************************/
367 
368 extern void guiedit_show_preferences(GtkWidget *, gpointer);
369 extern void guiedit_preference_cleanup(void);
370 
371 /*************************************************************************
372  *
373  * Help functions: guihelp.c
374  *
375  *************************************************************************/
376 
377 /*
378  * Macros that specify the help text to be used.
379  */
380 #define GUIHELP_ABOUT        0
381 #define GUIHELP_PROGRAM      1
382 #define GUIHELP_FONTGRID     2
383 #define GUIHELP_GLYPH_EDITOR 3
384 #define GUIHELP_CONFIG_FILE  4
385 #define GUIHELP_PREFERENCES  5
386 #define GUIHELP_FNT          6
387 #define GUIHELP_OTF          7
388 #define GUIHELP_PSF          8
389 #define GUIHELP_HEX          9
390 #define GUIHELP_COLOR        10
391 #define GUIHELP_TIPS         11
392 
393 extern void guihelp_show_help(GtkWidget *w, gpointer data);
394 
395 extern void guigedit_cleanup(void);
396 extern void guihelp_cleanup(void);
397 
398 /*************************************************************************
399  *
400  * Glyph operation functions: guiops.c
401  *
402  *************************************************************************/
403 
404 extern void guiops_show_translate(GtkWidget *, gpointer);
405 extern void guiops_show_rotate(GtkWidget *, gpointer);
406 extern void guiops_show_shear(GtkWidget *, gpointer);
407 extern void guiops_show_embolden(GtkWidget *, gpointer);
408 
409 /*************************************************************************
410  *
411  * Util functions: guiutil.c
412  *
413  *************************************************************************/
414 
415 extern void guiutil_show_dialog_centered(GtkWidget *dialog, GtkWidget *parent);
416 extern void guiutil_cursor_cleanup(void);
417 extern void guiutil_busy_cursor(GtkWidget *w, gboolean on);
418 extern void guiutil_error_message(GtkWidget *parent, gchar *text);
419 extern gboolean guiutil_yes_or_no(GtkWidget *parent, gchar *text,
420                                   gboolean default_answer);
421 extern void guiutil_util_set_tooltip(GtkWidget *, gchar *);
422 
423 G_END_DECLS
424 
425 #endif /* _h_gbdfed */
426