Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
path: root/src/include/ui.h
blob: 8bdf7830d8f9c49e7e8bfee5f32721c5f4bb5c32 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
/* 
 *     XaoS, a fast portable realtime fractal zoomer 
 *                  Copyright (C) 1996,1997 by
 *
 *      Jan Hubicka          (hubicka@paru.cas.cz)
 *      Thomas Marsh         (tmarsh@austin.ibm.com)
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
 */
#ifndef UI_H
#define UI_H
/*
#include "xio.h"
#include "zoom.h"
*/
#include "config.h"
#include "param.h"
#include "xmenu.h"
#ifdef __cplusplus
extern "C" {
#endif


#undef BUTTON1
#undef BUTTON2
#undef BUTTON3
#define BUTTON1 256
#define BUTTON2 512
#define BUTTON3 1024
#define UI_C256 1
#define UI_GRAYSCALE 2
#define UI_TRUECOLOR16 4
#define UI_TRUECOLOR24 8
#define UI_TRUECOLOR 16
#define UI_PROTECTIMAGES 32
#define UI_LBITMAP 256
#define UI_MBITMAP 512
#define UI_LIBITMAP 1024
#define UI_MIBITMAP 2048
#define UI_FIXEDCOLOR 4096


#define NORMALMOUSE 0
#define WAITMOUSE 1
#define REPLAYMOUSE 2
#define VJMOUSE 3

#define UIKEY_UP 257
#define UIKEY_DOWN 258
#define UIKEY_LEFT 259
#define UIKEY_RIGHT 260
#define UIKEY_ESC 261
#define UIKEY_BACKSPACE 8
#define UIKEY_TAB '\t'
#define UIKEY_HOME 262
#define UIKEY_END 263
#define UIKEY_PGUP 264
#define UIKEY_PGDOWN 265

    typedef unsigned char ui_rgb[4];
    typedef ui_rgb *ui_palette;
    struct uih_context;
    struct gui_driver {
	void (*setrootmenu) (struct uih_context * c, CONST char *name);
	void (*enabledisable) (struct uih_context * c, CONST char *name);
	void (*menu) (struct uih_context * c, CONST char *name);
	void (*dialog) (struct uih_context * c, CONST char *name);
	void (*help) (struct uih_context * c, CONST char *name);
    };
    struct ui_driver {
	CONST char *name;
	int (*init) (void);	/*initializing function. recturns 0 if fail */
	void (*getsize) (int *, int *);	/*get current size..in fullscreen versions
					   i.e svga and dos asks user for it */
	void (*processevents) (int, int *, int *, int *, int *);
	/*processevents..calls ui_resize,ui_key
	   laso returns possitions of mouse..
	   waits for event if first parameter is
	   1 */
	void (*getmouse) (int *, int *, int *);
	/*returns current mouse possitions */
	void (*uninit) (void);
	/*called before exit */
	int (*set_color) (int, int, int, int);
	void (*set_range) (ui_palette palette, int, int);
	/*sets palette color and returns number */
	void (*print) (int, int, CONST char *);	/*prints text */
	void (*display) (void);	/*displays bitmap */
	int (*alloc_buffers) (char **buffer1, char **buffer2);	/*makes buffers */
	void (*free_buffers) (char *buffer1, char *buffer2);	/*frees buffers */
	void (*flip_buffers) (void);	/*prints text */
	void (*mousetype) (int type);
	void (*flush) (void);
	int textwidth;
	int textheight;		/*width of text */
	/*int helpsize; */
	CONST struct params *params;
	int flags;
	float width, height;
	int maxwidth, maxheight;
	int imagetype;
	int palettestart, paletteend, maxentries;
	int rmask, gmask, bmask;
	CONST struct gui_driver *gui_driver;
    };

    extern struct uih_context *globaluih;

#ifdef USE_LOCALEPATH
    extern char *localepath;
#endif

    number_t ui_getfloat(CONST char *text);
    void ui_resize(void);
    void ui_call_resize(void);
    void ui_quit(void) NORETURN;
    void ui_menu(CONST char *text);
    void ui_menuactivate(CONST menuitem * item, dialogparam * d);
    int ui_key(int);
    void ui_loadstr(CONST char *data);
    xio_path ui_getfile(CONST char *basename, CONST char *extension);
    void ui_help(CONST char *name);
    char *ui_getpos(void);
    int MAIN_FUNCTION(int argc, char **argv);



#ifndef RANDOM_PALETTE_SIZE
#define RANDOM_PALETTE_SIZE 1	/*FIXME currently ignored */
#define FULLSCREEN 2
#define UPDATE_AFTER_PALETTE 4
#define UPDATE_AFTER_RESIZE 8
#define PALETTE_ROTATION 16
#define ASYNC_PALETTE 32
#define ROTATE_INSIDE_CALCULATION 64
#define PALETTE_REDISPLAYS 128
#define SCREENSIZE 256
#define PIXELSIZE 512
#define RESOLUTION 1024
#endif
#define NOFLUSHDISPLAY 2048
#define AALIB	(4096*2)
#define RESIZE_COMMAND (4096*4)

#ifdef __cplusplus
}
#endif
#endif				/* UI_H */