w32tex
About: TeX Live provides a comprehensive TeX system including all the major TeX-related programs, macro packages, and fonts that are free software. Windows sources.
  Fossies Dox: w32tex-src.tar.xz  ("unofficial" and yet experimental doxygen-generated source code documentation)  

uiinterface.h
Go to the documentation of this file.
1 /* Copyright (C) 2007-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 #ifndef _UIINTERFACE_H
28 #define _UIINTERFACE_H
29 # include <basics.h>
30 #include <fontforge-config.h>
31 
32 /* This encapsulates a set of callbacks and stubs. The callbacks get activated*/
33 /* when an event happens (a glyph in a font changes for example, then all */
34 /* charviews looking at it must be updated), and the stubs provide some simple*/
35 /* UI routines: Post an error, etc. */
36 
37 /* ************************************************************************** */
38 /* Basic, low-level UI routines for events we discover deep inside script code*/
39 /* ************************************************************************** */
40 
41 struct ui_interface {
42  /* The following is used to post a fontforge internal error */
43  /* currently it puts up a dlg displaying the error text */
44  void (*ierror)(const char *fmt,...);
45 
46  /* The following is a simple dialog to alert the user that s/he has */
47  /* made an error. Currently it posts a modal dlg and waits for the */
48  /* user to dismiss it */
49  /* The title argument is the window's title. The error argument is the */
50  /* text of the message. It may contain printf formatting. It may contain */
51  /* newlines to force line breaks -- even if it doesn't contain new lines */
52  /* the routine will wrap the text if a line is too long */
53  void (*post_error)(const char *title,const char *error,...);
54 
55  /* The following is used to post a warning message in such a way that it */
56  /* will not impede the user. Currently it creates a little window at the */
57  /* bottom right of the screen and writes successive messages there */
58  void (*logwarning)(const char *fmt,...);
59 
60  /* The following is another way to post a warning message in such a way */
61  /* that it will not impede the user. Currently it pops up a little */
62  /* non-modal dlg which vanishes after a minute or two (or if the user */
63  /* dismisses it, of course */
64  void (*post_warning)(const char *title,const char *statement,...);
65 
66  /* Occasionally we we be deep in a non-ui routine and we find we must ask */
67  /* the user a question. In this routine the choices are displayed as */
68  /* buttons, one button is the default, another is a cancel choice */
69  int (*ask)(const char *title, const char **answers,
70  int def, int cancel,const char *question,...);
71 
72  /* Similar to the above, except here the choices are presented as a */
73  /* scrolled list. Return -1 if the user cancels */
74  int (*choose)(const char *title, const char **answers,
75  int def, int cancel,const char *question,...);
76 
77  /* Multiple things can be selected, sel is an in/out parameter, one byte */
78  /* per entry in the choice array. 0=> not selected, 1=>selected */
79  int (*choose_multiple)(char *title, const char **choices,char *sel,
80  int cnt, char *buts[2], const char *question,...);
81 
82  /* Here we want a string. We are passed a default answer (or NULL) */
83  /* The return is NULL on cancel, otherwise a string which must be freed */
84  char *(*ask_string)(const char *title,
85  const char *def,const char *question,...);
86  /* Same as above, except for entering a password */
87  char *(*ask_password)(const char *title,
88  const char *def,const char *question,...);
89 
90  /* The next two routines are only used in the python interface to provide */
91  /* a python script running in ff a way to open a file */
92  /* Arguments are a window title for the dlg, a default file (or NULL), and */
93  /* an initial filter (unix wildcards) or NULL */
94  char *(*open_file)(const char *title, const char *defaultfile,
95  const char *initial_filter);
96  char *(*saveas_file)(const char *title, const char *defaultfile,
97  const char *initial_filter);
98 
99  /* These routines are for a progress indicator */
100  void (*progress_start)(int delay, const char *title, const char *line1,
101  const char *line2, int tot, int stages);
108  void (*progress_change_line1)(const char *);
109  void (*progress_change_line2)(const char *);
115 
117 
118  /* pops up a dlg asking user whether to do remove overlap (and other stuff)*/
119  /* when loading an eps file with strokes, etc. */
121 };
122 extern struct ui_interface *ui_interface;
123 
124 #define IError (ui_interface->ierror)
125 #define LogError (ui_interface->logwarning)
126 #define ff_post_notice (ui_interface->post_warning)
127 #define ff_post_error (ui_interface->post_error)
128 #define ff_ask (ui_interface->ask)
129 #define ff_choose (ui_interface->choose)
130 #define ff_choose_multiple (ui_interface->choose_multiple)
131 #define ff_ask_string (ui_interface->ask_string)
132 #define ff_ask_password (ui_interface->ask_password)
133 
134 #define ff_open_filename (ui_interface->open_file)
135 #define ff_save_filename (ui_interface->saveas_file)
136 
137 #define ff_progress_start_indicator (ui_interface->progress_start)
138 #define ff_progress_end_indicator (ui_interface->progress_end)
139 #define ff_progress_show (ui_interface->progress_show)
140 #define ff_progress_enable_stop (ui_interface->progress_enable_stop)
141 #define ff_progress_next (ui_interface->progress_next)
142 #define ff_progress_next_stage (ui_interface->progress_next_stage)
143 #define ff_progress_increment (ui_interface->progress_increment)
144 #define ff_progress_change_line1 (ui_interface->progress_change_line1)
145 #define ff_progress_change_line2 (ui_interface->progress_change_line2)
146 #define ff_progress_pause_timer (ui_interface->progress_pause)
147 #define ff_progress_resume_timer (ui_interface->progress_resume)
148 #define ff_progress_change_stages (ui_interface->progress_change_stages)
149 #define ff_progress_change_total (ui_interface->progress_change_total)
150 #define ff_progress_reset (ui_interface->progress_reset)
151 
152 #define ff_progress_allow_events (ui_interface->allow_events)
153 
154 #define TTFNameIds (ui_interface->strid)
155 #define MSLangString (ui_interface->mslang)
156 
157 #define PsStrokeFlagsDlg (ui_interface->stroke_flags)
158 
159 #endif
char * def
Definition: definitions.c:41
#define error(a)
Definition: dviinfo.c:48
static void
Definition: fpif.c:118
void cancel(short *num, short *denom, short lowest)
Definition: globals.c:49
static int cnt
Definition: pkout.c:166
struct ui_interface * ui_interface
Definition: nouiutil.c:161
static void statement(LexState *ls)
Definition: lparser.c:1538
int(* choose_multiple)(char *title, const char **choices, char *sel, int cnt, char *buts[2], const char *question,...)
Definition: uiinterface.h:79
int(* ask)(const char *title, const char **answers, int def, int cancel, const char *question,...)
Definition: uiinterface.h:69
void(* progress_enable_stop)(int)
Definition: uiinterface.h:104
int(* progress_increment)(int)
Definition: uiinterface.h:107
void(* allow_events)(void)
Definition: uiinterface.h:116
void(* progress_pause)(void)
Definition: uiinterface.h:110
void(* progress_change_line1)(const char *)
Definition: uiinterface.h:108
int(* progress_next)(void)
Definition: uiinterface.h:105
int(* stroke_flags)(void)
Definition: uiinterface.h:120
void(* progress_change_total)(int)
Definition: uiinterface.h:113
void(* progress_show)(void)
Definition: uiinterface.h:103
void(* ierror)(const char *fmt,...)
Definition: uiinterface.h:44
void(* post_error)(const char *title, const char *error,...)
Definition: uiinterface.h:53
void(* post_warning)(const char *title, const char *statement,...)
Definition: uiinterface.h:64
int(* choose)(const char *title, const char **answers, int def, int cancel, const char *question,...)
Definition: uiinterface.h:74
void(* progress_end)(void)
Definition: uiinterface.h:102
void(* progress_resume)(void)
Definition: uiinterface.h:111
void(* logwarning)(const char *fmt,...)
Definition: uiinterface.h:58
void(* progress_change_stages)(int)
Definition: uiinterface.h:112
void(* progress_start)(int delay, const char *title, const char *line1, const char *line2, int tot, int stages)
Definition: uiinterface.h:100
int(* progress_reset)(void)
Definition: uiinterface.h:114
int(* progress_next_stage)(void)
Definition: uiinterface.h:106
void(* progress_change_line2)(const char *)
Definition: uiinterface.h:109
char fmt[256]
Definition: tex4ht.c:3925
return() int(((double) *(font_tbl[cur_fnt].wtbl+(int)(*(font_tbl[cur_fnt].char_wi+(int)(ch - font_tbl[cur_fnt].char_f)% 256)))/(double)(1L<< 20)) *(double) font_tbl[cur_fnt].scale)
char line2[BUFSIZ]
Definition: texfix.c:35
@ title
Definition: preamble.c:50