1 /* Copyright (C) 2000-2008 by George Williams */
3 * Redistribution and use in source and binary forms, with or without
4 * modification, are permitted provided that the following conditions are met:
6 * Redistributions of source code must retain the above copyright notice, this
7 * list of conditions and the following disclaimer.
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.
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.
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.
27 #include "uiinterface.h"
28 #include "splinefont.h"
34 static void NOUI_IError(const char *format
,...) {
37 fprintf(stderr
, "Internal Error: " );
38 vfprintf(stderr
,format
,ap
);
42 static void NOUI__LogError(const char *format
,va_list ap
) {
43 char buffer
[400], *str
;
44 vsnprintf(buffer
,sizeof(buffer
),format
,ap
);
46 fprintf(stderr
,"%s",str
);
47 if ( str
[strlen(str
)-1]!='\n' )
52 static void NOUI_LogError(const char *format
,...) {
56 NOUI__LogError(format
,ap
);
60 static void NOUI_post_notice(const char *title
,const char *statement
,...) {
63 va_start(ap
,statement
);
64 NOUI__LogError(statement
,ap
);
68 static void NOUI_post_error(const char *title
,const char *statement
,...) {
71 va_start(ap
,statement
);
72 NOUI__LogError(statement
,ap
);
76 static int NOUI_ask(const char *title
, const char **answers
,
77 int def
, int cancel
,const char *question
,...) {
86 static int NOUI_choose(const char *title
, const char **choices
,int cnt
, int def
,
87 const char *question
,...) {
96 static int NOUI_choose_multiple(char *title
, const char **choices
,char *sel
,
97 int cnt
, char *buts
[2], const char *question
,...) {
107 static char *NOUI_ask_string(const char *title
, const char *def
,
108 const char *question
,...) {
112 return( (char *) def
);
115 static char *NOUI_open_file(const char *title
, const char *defaultfile
,
116 const char *initial_filter
) {
119 (void)initial_filter
;
123 static char *NOUI_saveas_file(const char *title
, const char *defaultfile
,
124 const char *initial_filter
) {
126 (void)initial_filter
;
127 return( copy(defaultfile
) );
130 static void NOUI_progress_start(int delay
, const char *title
, const char *line1
,
131 const char *line2
, int tot
, int stages
) {
140 static void NOUI_void_void_noop(void) {
143 static void NOUI_void_int_noop(int useless
) {
147 static int NOUI_int_int_noop(int useless
) {
152 static void NOUI_void_str_noop(const char * useless
) {
156 static int NOUI_alwaystrue(void) {
160 static int NOUI_DefaultStrokeFlags(void) {
161 return( sf_correctdir
);
164 static struct ui_interface noui_interface
= {
171 NOUI_choose_multiple
,
173 NOUI_ask_string
, /* password */
197 NOUI_DefaultStrokeFlags
199 struct ui_interface
*ui_interface
= &noui_interface
;
201 void FF_SetUiInterface(struct ui_interface
*uii
) {