diff options
author | Jens Arnold <amiconn@rockbox.org> | 2005-03-18 00:03:22 +0000 |
---|---|---|
committer | Jens Arnold <amiconn@rockbox.org> | 2005-03-18 00:03:22 +0000 |
commit | 31b28f523a9e95031dcfbef342bcffcf66120eab (patch) | |
tree | a8d5e5b2c83e2a4631124ea93505f2722ee196be | |
parent | f89087df4b8e33ba3737e791d46f77019c500fb1 (diff) | |
download | rockbox-31b28f523a9e95031dcfbef342bcffcf66120eab.tar.gz rockbox-31b28f523a9e95031dcfbef342bcffcf66120eab.zip |
Extensive code policing (indentation levels, tab characters).
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@6199 a1c6a512-1295-4272-9138-f99709370657
-rw-r--r-- | uisimulator/x11/button-x11.c | 125 | ||||
-rw-r--r-- | uisimulator/x11/lcd-x11.c | 28 | ||||
-rw-r--r-- | uisimulator/x11/screenhack.c | 236 | ||||
-rw-r--r-- | uisimulator/x11/uibasic.c | 237 |
4 files changed, 309 insertions, 317 deletions
diff --git a/uisimulator/x11/button-x11.c b/uisimulator/x11/button-x11.c index 594d489a56..28ede95df6 100644 --- a/uisimulator/x11/button-x11.c +++ b/uisimulator/x11/button-x11.c | |||
@@ -60,109 +60,109 @@ static int get_raw_button (void) | |||
60 | int ev=screenhack_handle_events(&release, &repeat); | 60 | int ev=screenhack_handle_events(&release, &repeat); |
61 | switch(ev) | 61 | switch(ev) |
62 | { | 62 | { |
63 | case XK_KP_Left: | 63 | case XK_KP_Left: |
64 | case XK_Left: | 64 | case XK_Left: |
65 | case XK_KP_4: | 65 | case XK_KP_4: |
66 | k = BUTTON_LEFT; | 66 | k = BUTTON_LEFT; |
67 | break; | 67 | break; |
68 | 68 | ||
69 | case XK_KP_Right: | 69 | case XK_KP_Right: |
70 | case XK_Right: | 70 | case XK_Right: |
71 | case XK_KP_6: | 71 | case XK_KP_6: |
72 | k = BUTTON_RIGHT; | 72 | k = BUTTON_RIGHT; |
73 | break; | 73 | break; |
74 | 74 | ||
75 | case XK_KP_Up: | 75 | case XK_KP_Up: |
76 | case XK_Up: | 76 | case XK_Up: |
77 | case XK_KP_8: | 77 | case XK_KP_8: |
78 | #ifdef BUTTON_UP | 78 | #ifdef BUTTON_UP |
79 | k = BUTTON_UP; | 79 | k = BUTTON_UP; |
80 | #elif defined BUTTON_PLAY | 80 | #elif defined BUTTON_PLAY |
81 | k = BUTTON_PLAY; | 81 | k = BUTTON_PLAY; |
82 | #endif | 82 | #endif |
83 | break; | 83 | break; |
84 | 84 | ||
85 | case XK_KP_Down: | 85 | case XK_KP_Down: |
86 | case XK_Down: | 86 | case XK_Down: |
87 | case XK_KP_2: | 87 | case XK_KP_2: |
88 | #ifdef BUTTON_DOWN | 88 | #ifdef BUTTON_DOWN |
89 | k = BUTTON_DOWN; | 89 | k = BUTTON_DOWN; |
90 | #elif defined BUTTON_STOP | 90 | #elif defined BUTTON_STOP |
91 | k = BUTTON_STOP; | 91 | k = BUTTON_STOP; |
92 | #endif | 92 | #endif |
93 | break; | 93 | break; |
94 | 94 | ||
95 | #ifdef BUTTON_ON | 95 | #ifdef BUTTON_ON |
96 | case XK_KP_Add: | 96 | case XK_KP_Add: |
97 | case XK_Q: | 97 | case XK_Q: |
98 | case XK_q: | 98 | case XK_q: |
99 | k = BUTTON_ON; | 99 | k = BUTTON_ON; |
100 | break; | 100 | break; |
101 | #endif | 101 | #endif |
102 | 102 | ||
103 | #ifdef BUTTON_OFF | 103 | #ifdef BUTTON_OFF |
104 | case XK_KP_Enter: | 104 | case XK_KP_Enter: |
105 | case XK_A: | 105 | case XK_A: |
106 | case XK_a: | 106 | case XK_a: |
107 | k = BUTTON_OFF; | 107 | k = BUTTON_OFF; |
108 | break; | 108 | break; |
109 | #endif | 109 | #endif |
110 | 110 | ||
111 | #ifdef BUTTON_F1 | 111 | #ifdef BUTTON_F1 |
112 | case XK_KP_Divide: | 112 | case XK_KP_Divide: |
113 | case XK_1: | 113 | case XK_1: |
114 | k = BUTTON_F1; | 114 | k = BUTTON_F1; |
115 | break; | 115 | break; |
116 | 116 | ||
117 | case XK_KP_Multiply: | 117 | case XK_KP_Multiply: |
118 | case XK_2: | 118 | case XK_2: |
119 | k = BUTTON_F2; | 119 | k = BUTTON_F2; |
120 | break; | 120 | break; |
121 | 121 | ||
122 | case XK_KP_Subtract: | 122 | case XK_KP_Subtract: |
123 | case XK_3: | 123 | case XK_3: |
124 | k = BUTTON_F3; | 124 | k = BUTTON_F3; |
125 | break; | 125 | break; |
126 | #elif defined(BUTTON_REC) | 126 | #elif defined(BUTTON_REC) |
127 | case XK_KP_Divide: | 127 | case XK_KP_Divide: |
128 | case XK_1: | 128 | case XK_1: |
129 | k = BUTTON_REC; | 129 | k = BUTTON_REC; |
130 | break; | 130 | break; |
131 | #endif | 131 | #endif |
132 | 132 | ||
133 | case XK_KP_Space: | 133 | case XK_KP_Space: |
134 | case XK_KP_5: | 134 | case XK_KP_5: |
135 | case XK_KP_Begin: | 135 | case XK_KP_Begin: |
136 | case XK_space: | 136 | case XK_space: |
137 | #ifdef BUTTON_PLAY | 137 | #ifdef BUTTON_PLAY |
138 | k = BUTTON_PLAY; | 138 | k = BUTTON_PLAY; |
139 | #elif defined(BUTTON_SELECT) | 139 | #elif defined(BUTTON_SELECT) |
140 | k = BUTTON_SELECT; | 140 | k = BUTTON_SELECT; |
141 | #endif | 141 | #endif |
142 | break; | 142 | break; |
143 | 143 | ||
144 | #ifdef HAVE_LCD_BITMAP | 144 | #ifdef HAVE_LCD_BITMAP |
145 | case XK_5: | 145 | case XK_5: |
146 | if(!release) | 146 | if(!release) |
147 | { | 147 | { |
148 | screen_dump(); | 148 | screen_dump(); |
149 | return 0; | 149 | return 0; |
150 | } | 150 | } |
151 | break; | 151 | break; |
152 | #endif | 152 | #endif |
153 | 153 | ||
154 | case XK_KP_Separator: | 154 | case XK_KP_Separator: |
155 | case XK_KP_Insert: | 155 | case XK_KP_Insert: |
156 | case XK_Insert: | 156 | case XK_Insert: |
157 | #ifdef BUTTON_MENU | 157 | #ifdef BUTTON_MENU |
158 | k = BUTTON_MENU; | 158 | k = BUTTON_MENU; |
159 | #elif defined(BUTTON_MODE) | 159 | #elif defined(BUTTON_MODE) |
160 | k = BUTTON_MODE; | 160 | k = BUTTON_MODE; |
161 | #endif | 161 | #endif |
162 | break; | 162 | break; |
163 | 163 | ||
164 | default: | 164 | default: |
165 | k = 0; | 165 | k = 0; |
166 | if(ev) | 166 | if(ev) |
167 | DEBUGF("received ev %d\n", ev); | 167 | DEBUGF("received ev %d\n", ev); |
168 | break; | 168 | break; |
@@ -172,7 +172,8 @@ static int get_raw_button (void) | |||
172 | /* return a release event */ | 172 | /* return a release event */ |
173 | button_state &= ~k; | 173 | button_state &= ~k; |
174 | k |= BUTTON_REL; | 174 | k |= BUTTON_REL; |
175 | } else { | 175 | } |
176 | else { | ||
176 | if(k) { | 177 | if(k) { |
177 | button_state |= k; | 178 | button_state |= k; |
178 | k = button_state; | 179 | k = button_state; |
@@ -222,8 +223,8 @@ long button_get(bool block) | |||
222 | } while(1); | 223 | } while(1); |
223 | 224 | ||
224 | if(!block) | 225 | if(!block) |
225 | /* delay a bit */ | 226 | /* delay a bit */ |
226 | sim_sleep(1); | 227 | sim_sleep(1); |
227 | 228 | ||
228 | return bits; | 229 | return bits; |
229 | } | 230 | } |
diff --git a/uisimulator/x11/lcd-x11.c b/uisimulator/x11/lcd-x11.c index bc03d7f822..be687d1181 100644 --- a/uisimulator/x11/lcd-x11.c +++ b/uisimulator/x11/lcd-x11.c | |||
@@ -173,21 +173,21 @@ static unsigned char lcd_buffer_copy[11][2]; | |||
173 | 173 | ||
174 | void lcd_update (void) | 174 | void lcd_update (void) |
175 | { | 175 | { |
176 | bool changed=false; | 176 | bool changed=false; |
177 | int x, y; | 177 | int x, y; |
178 | for (y=0; y<2; y++) { | 178 | for (y=0; y<2; y++) { |
179 | for (x=0; x<11; x++) { | 179 | for (x=0; x<11; x++) { |
180 | if (lcd_display_redraw || | 180 | if (lcd_display_redraw || |
181 | lcd_buffer_copy[x][y] != hardware_buffer_lcd[x][y]) { | 181 | lcd_buffer_copy[x][y] != hardware_buffer_lcd[x][y]) { |
182 | lcd_buffer_copy[x][y] = hardware_buffer_lcd[x][y]; | 182 | lcd_buffer_copy[x][y] = hardware_buffer_lcd[x][y]; |
183 | lcd_print_char(x, y); | 183 | lcd_print_char(x, y); |
184 | changed=true; | 184 | changed=true; |
185 | } | 185 | } |
186 | } | ||
186 | } | 187 | } |
187 | } | 188 | if (changed) |
188 | if (changed) | 189 | XSync(dpy,False); |
189 | XSync(dpy,False); | 190 | lcd_display_redraw=false; |
190 | lcd_display_redraw=false; | ||
191 | } | 191 | } |
192 | 192 | ||
193 | #endif | 193 | #endif |
diff --git a/uisimulator/x11/screenhack.c b/uisimulator/x11/screenhack.c index 75a7ed4d93..d7f21a60ce 100644 --- a/uisimulator/x11/screenhack.c +++ b/uisimulator/x11/screenhack.c | |||
@@ -41,7 +41,7 @@ | |||
41 | #include <X11/keysym.h> | 41 | #include <X11/keysym.h> |
42 | 42 | ||
43 | #ifdef __sgi | 43 | #ifdef __sgi |
44 | # include <X11/SGIScheme.h> /* for SgiUseSchemes() */ | 44 | # include <X11/SGIScheme.h> /* for SgiUseSchemes() */ |
45 | #endif /* __sgi */ | 45 | #endif /* __sgi */ |
46 | 46 | ||
47 | #ifdef HAVE_XMU | 47 | #ifdef HAVE_XMU |
@@ -128,31 +128,31 @@ XtAppContext app; | |||
128 | Bool mono_p; | 128 | Bool mono_p; |
129 | 129 | ||
130 | static XrmOptionDescRec default_options [] = { | 130 | static XrmOptionDescRec default_options [] = { |
131 | { "-root", ".root", XrmoptionNoArg, "True" }, | 131 | { "-root", ".root", XrmoptionNoArg, "True" }, |
132 | { "-window", ".root", XrmoptionNoArg, "False" }, | 132 | { "-window", ".root", XrmoptionNoArg, "False" }, |
133 | { "-mono", ".mono", XrmoptionNoArg, "True" }, | 133 | { "-mono", ".mono", XrmoptionNoArg, "True" }, |
134 | { "-install", ".installColormap", XrmoptionNoArg, "True" }, | 134 | { "-install", ".installColormap", XrmoptionNoArg, "True" }, |
135 | { "-noinstall",".installColormap", XrmoptionNoArg, "False" }, | 135 | { "-noinstall", ".installColormap", XrmoptionNoArg, "False" }, |
136 | { "-visual", ".visualID", XrmoptionSepArg, 0 }, | 136 | { "-visual", ".visualID", XrmoptionSepArg, 0 }, |
137 | { "-window-id", ".windowID", XrmoptionSepArg, 0 }, | 137 | { "-window-id", ".windowID", XrmoptionSepArg, 0 }, |
138 | { 0, 0, 0, 0 } | 138 | { 0, 0, 0, 0 } |
139 | }; | 139 | }; |
140 | 140 | ||
141 | static char *default_defaults[] = { | 141 | static char *default_defaults[] = { |
142 | ".root: false", | 142 | ".root: false", |
143 | #define GEOMETRY_POSITION 1 | 143 | #define GEOMETRY_POSITION 1 |
144 | "*geometry: " | 144 | "*geometry: " |
145 | #ifdef HAVE_LCD_BITMAP | 145 | #ifdef HAVE_LCD_BITMAP |
146 | "120x68" | 146 | "120x68" |
147 | #else | 147 | #else |
148 | "280x132" /* A bit larger that necessary */ | 148 | "280x132" /* A bit larger that necessary */ |
149 | #endif | 149 | #endif |
150 | , /* this should be .geometry, but nooooo... */ | 150 | , /* this should be .geometry, but nooooo... */ |
151 | "*mono: false", | 151 | "*mono: false", |
152 | "*installColormap: false", | 152 | "*installColormap: false", |
153 | "*visualID: default", | 153 | "*visualID: default", |
154 | "*windowID: ", | 154 | "*windowID: ", |
155 | 0 | 155 | 0 |
156 | }; | 156 | }; |
157 | 157 | ||
158 | extern Display* dpy; | 158 | extern Display* dpy; |
@@ -261,71 +261,70 @@ int screenhack_handle_event(Display *dpy, XEvent *event, | |||
261 | *repeat = false; | 261 | *repeat = false; |
262 | 262 | ||
263 | switch (event->xany.type) { | 263 | switch (event->xany.type) { |
264 | case KeyPress: | 264 | case KeyPress: |
265 | { | 265 | { |
266 | KeySym keysym; | 266 | KeySym keysym; |
267 | unsigned char c = 0; | 267 | unsigned char c = 0; |
268 | XLookupString (&event->xkey, &c, 1, &keysym, 0); | 268 | XLookupString (&event->xkey, &c, 1, &keysym, 0); |
269 | key = keysym; | 269 | key = keysym; |
270 | #if 0 | 270 | #if 0 |
271 | DEBUGF("Got keypress: %02x %x, time %lx\n", c, | 271 | DEBUGF("Got keypress: %02x %x, time %lx\n", c, |
272 | event->xkey.keycode, | 272 | event->xkey.keycode, |
273 | event->xkey.time); | 273 | event->xkey.time); |
274 | #endif | 274 | #endif |
275 | if(lastkeycode == event->xkey.keycode) | 275 | if(lastkeycode == event->xkey.keycode) |
276 | *repeat = checkrepeat(lasttime, event->xkey.time); | 276 | *repeat = checkrepeat(lasttime, event->xkey.time); |
277 | lasttime = event->xkey.time; | 277 | lasttime = event->xkey.time; |
278 | lastkeycode = event->xkey.keycode; | 278 | lastkeycode = event->xkey.keycode; |
279 | } | 279 | } |
280 | break; | 280 | break; |
281 | case KeyRelease: | 281 | case KeyRelease: |
282 | { | 282 | { |
283 | KeySym keysym; | 283 | KeySym keysym; |
284 | unsigned char c = 0; | 284 | unsigned char c = 0; |
285 | XLookupString (&event->xkey, &c, 1, &keysym, 0); | 285 | XLookupString (&event->xkey, &c, 1, &keysym, 0); |
286 | key = keysym; | 286 | key = keysym; |
287 | #if 0 | 287 | #if 0 |
288 | DEBUGF("Got keyrelease: %c (%02x) %x\n", c, c, | 288 | DEBUGF("Got keyrelease: %c (%02x) %x\n", c, c, |
289 | event->xkey.keycode); | 289 | event->xkey.keycode); |
290 | #endif | 290 | #endif |
291 | if(lastkeycode == event->xkey.keycode) | 291 | if(lastkeycode == event->xkey.keycode) |
292 | *repeat = checkrepeat(lasttime, event->xkey.time); | 292 | *repeat = checkrepeat(lasttime, event->xkey.time); |
293 | lasttime = event->xkey.time; | 293 | lasttime = event->xkey.time; |
294 | lastkeycode = event->xkey.keycode; | 294 | lastkeycode = event->xkey.keycode; |
295 | if(*repeat) | 295 | if(*repeat) |
296 | return 0; /* on repeats, return nothing on release */ | 296 | return 0; /* on repeats, return nothing on release */ |
297 | 297 | ||
298 | *release = TRUE; | 298 | *release = TRUE; |
299 | } | 299 | } |
300 | break; | 300 | break; |
301 | case Expose: | 301 | case Expose: |
302 | { | 302 | screen_redraw(); |
303 | screen_redraw(); | 303 | break; |
304 | } | 304 | case ClientMessage: |
305 | break; | 305 | if (event->xclient.message_type != XA_WM_PROTOCOLS) { |
306 | default: | 306 | char *s = XGetAtomName(dpy, event->xclient.message_type); |
307 | break; | 307 | if (!s) |
308 | case ClientMessage: | 308 | s = "(null)"; |
309 | { | 309 | fprintf (stderr, "%s: unknown ClientMessage %s received!\n", |
310 | if (event->xclient.message_type != XA_WM_PROTOCOLS) { | 310 | progname, s); |
311 | char *s = XGetAtomName(dpy, event->xclient.message_type); | 311 | } |
312 | if (!s) s = "(null)"; | 312 | else if (event->xclient.data.l[0] != (int)XA_WM_DELETE_WINDOW) { |
313 | fprintf (stderr, "%s: unknown ClientMessage %s received!\n", | 313 | char *s1 = XGetAtomName(dpy, event->xclient.message_type); |
314 | progname, s); | 314 | char *s2 = XGetAtomName(dpy, event->xclient.data.l[0]); |
315 | } | 315 | if (!s1) |
316 | else if (event->xclient.data.l[0] != (int)XA_WM_DELETE_WINDOW) { | 316 | s1 = "(null)"; |
317 | char *s1 = XGetAtomName(dpy, event->xclient.message_type); | 317 | if (!s2) |
318 | char *s2 = XGetAtomName(dpy, event->xclient.data.l[0]); | 318 | s2 = "(null)"; |
319 | if (!s1) s1 = "(null)"; | 319 | fprintf (stderr, "%s: unknown ClientMessage %s[%s] received!\n", |
320 | if (!s2) s2 = "(null)"; | 320 | progname, s1, s2); |
321 | fprintf (stderr, "%s: unknown ClientMessage %s[%s] received!\n", | 321 | } |
322 | progname, s1, s2); | 322 | else { |
323 | } | 323 | exit (0); |
324 | else { | 324 | } |
325 | exit (0); | 325 | break; |
326 | } | 326 | default: |
327 | } | 327 | break; |
328 | break; | ||
329 | } | 328 | } |
330 | return key; | 329 | return key; |
331 | } | 330 | } |
@@ -344,8 +343,7 @@ int screenhack_handle_events(bool *release, bool *repeat) | |||
344 | } | 343 | } |
345 | 344 | ||
346 | 345 | ||
347 | static Visual * | 346 | static Visual *pick_visual (Screen *screen) |
348 | pick_visual (Screen *screen) | ||
349 | { | 347 | { |
350 | #ifdef USE_GL | 348 | #ifdef USE_GL |
351 | /* If we're linking against GL (that is, this is the version of | 349 | /* If we're linking against GL (that is, this is the version of |
@@ -367,7 +365,7 @@ pick_visual (Screen *screen) | |||
367 | !strcmp (string, "best") || | 365 | !strcmp (string, "best") || |
368 | !strcmp (string, "color") || | 366 | !strcmp (string, "color") || |
369 | !strcmp (string, "default")) | 367 | !strcmp (string, "default")) |
370 | v = get_gl_visual (screen); /* from ../utils/visual-gl.c */ | 368 | v = get_gl_visual (screen); /* from ../utils/visual-gl.c */ |
371 | 369 | ||
372 | if (string) | 370 | if (string) |
373 | free (string); | 371 | free (string); |
@@ -393,64 +391,64 @@ int main (int argc, char **argv) | |||
393 | #ifdef HAVE_LCD_BITMAP | 391 | #ifdef HAVE_LCD_BITMAP |
394 | display_zoom=2; | 392 | display_zoom=2; |
395 | { | 393 | { |
396 | char *env=getenv("RECORDER_ZOOM"); | 394 | char *env=getenv("RECORDER_ZOOM"); |
397 | if (env) { | 395 | if (env) { |
398 | display_zoom=atoi(env); | 396 | display_zoom=atoi(env); |
399 | } | 397 | } |
400 | } | 398 | } |
401 | #else | 399 | #else |
402 | display_zoom=1; | 400 | display_zoom=1; |
403 | { | 401 | { |
404 | char *env=getenv("PLAYER_ZOOM"); | 402 | char *env=getenv("PLAYER_ZOOM"); |
405 | if (env) { | 403 | if (env) { |
406 | display_zoom=atoi(env); | 404 | display_zoom=atoi(env); |
407 | } | 405 | } |
408 | } | 406 | } |
409 | #endif | 407 | #endif |
410 | 408 | ||
411 | if (argc > 1) | 409 | if (argc > 1) |
412 | { | 410 | { |
413 | int x; | 411 | int x; |
414 | for (x=1; x<argc; x++) { | 412 | for (x=1; x<argc; x++) { |
415 | if (!strcmp("--old_lcd", argv[x])) { | 413 | if (!strcmp("--old_lcd", argv[x])) { |
416 | having_new_lcd=FALSE; | 414 | having_new_lcd=FALSE; |
417 | printf("Using old LCD layout.\n"); | 415 | printf("Using old LCD layout.\n"); |
418 | } else if (!strcmp("--recorder_zoom", argv[x])) { | 416 | } else if (!strcmp("--recorder_zoom", argv[x])) { |
419 | x++; | 417 | x++; |
420 | #ifdef HAVE_LCD_BITMAP | 418 | #ifdef HAVE_LCD_BITMAP |
421 | display_zoom=atoi(argv[x]); | 419 | display_zoom=atoi(argv[x]); |
422 | printf("Window zoom is %d\n", display_zoom); | 420 | printf("Window zoom is %d\n", display_zoom); |
423 | #endif | 421 | #endif |
424 | } else if (!strcmp("--player_zoom", argv[x])) { | 422 | } else if (!strcmp("--player_zoom", argv[x])) { |
425 | x++; | 423 | x++; |
426 | #ifndef HAVE_LCD_BITMAP | 424 | #ifndef HAVE_LCD_BITMAP |
427 | display_zoom=atoi(argv[x]); | 425 | display_zoom=atoi(argv[x]); |
428 | printf("Window zoom is %d\n", display_zoom); | 426 | printf("Window zoom is %d\n", display_zoom); |
429 | #endif | 427 | #endif |
430 | } else { | 428 | } else { |
431 | printf("rockboxui\n"); | 429 | printf("rockboxui\n"); |
432 | printf("Arguments:\n"); | 430 | printf("Arguments:\n"); |
433 | printf(" --old_lcd \t [Player] simulate old playermodel (ROM version<4.51)\n"); | 431 | printf(" --old_lcd \t [Player] simulate old playermodel (ROM version<4.51)\n"); |
434 | printf(" --player_zoom \t [Player] window zoom\n"); | 432 | printf(" --player_zoom \t [Player] window zoom\n"); |
435 | printf(" --recorder_zoom \t [Recorder] window zoom\n"); | 433 | printf(" --recorder_zoom \t [Recorder] window zoom\n"); |
436 | printf(KEYBOARD_GENERIC KEYBOARD_SPECIFIC); | 434 | printf(KEYBOARD_GENERIC KEYBOARD_SPECIFIC); |
437 | exit(0); | 435 | exit(0); |
438 | } | 436 | } |
439 | } | 437 | } |
440 | } | 438 | } |
441 | { | 439 | { |
442 | static char geometry[40]; | 440 | static char geometry[40]; |
443 | #ifdef HAVE_LCD_BITMAP | 441 | #ifdef HAVE_LCD_BITMAP |
444 | snprintf(geometry, 40, "*geometry: %dx%d", | 442 | snprintf(geometry, 40, "*geometry: %dx%d", |
445 | LCD_WIDTH*display_zoom+14, LCD_HEIGHT*display_zoom+8); | 443 | LCD_WIDTH*display_zoom+14, LCD_HEIGHT*display_zoom+8); |
446 | #else | 444 | #else |
447 | snprintf(geometry, 40, "*geometry: %dx%d", 280*display_zoom, 132*display_zoom); | 445 | snprintf(geometry, 40, "*geometry: %dx%d", 280*display_zoom, |
446 | 132*display_zoom); | ||
448 | #endif | 447 | #endif |
449 | default_defaults[GEOMETRY_POSITION]=geometry; | 448 | default_defaults[GEOMETRY_POSITION]=geometry; |
450 | } | 449 | } |
451 | printf(KEYBOARD_GENERIC KEYBOARD_SPECIFIC); | 450 | printf(KEYBOARD_GENERIC KEYBOARD_SPECIFIC); |
452 | 451 | ||
453 | |||
454 | merge_options (); | 452 | merge_options (); |
455 | 453 | ||
456 | #ifdef __sgi | 454 | #ifdef __sgi |
diff --git a/uisimulator/x11/uibasic.c b/uisimulator/x11/uibasic.c index 1b44f10d99..ca3c2c5568 100644 --- a/uisimulator/x11/uibasic.c +++ b/uisimulator/x11/uibasic.c | |||
@@ -54,158 +54,151 @@ Window window; | |||
54 | bool lcd_display_redraw=true; | 54 | bool lcd_display_redraw=true; |
55 | 55 | ||
56 | XrmOptionDescRec options [] = { | 56 | XrmOptionDescRec options [] = { |
57 | /* { "-subtractive", ".additive", XrmoptionNoArg, "false" }, */ | 57 | /* { "-subtractive", ".additive", XrmoptionNoArg, "false" }, */ |
58 | { "-server", ".server", XrmoptionSepArg, 0 }, | 58 | { "-server", ".server", XrmoptionSepArg, 0 }, |
59 | { "-help", ".help", XrmoptionNoArg, "false" }, | 59 | { "-help", ".help", XrmoptionNoArg, "false" }, |
60 | { 0, 0, 0, 0 } | 60 | { 0, 0, 0, 0 } |
61 | }; | 61 | }; |
62 | char *progclass = "rockboxui"; | 62 | char *progclass = "rockboxui"; |
63 | 63 | ||
64 | char *defaults [] = { | 64 | char *defaults [] = { |
65 | #ifdef IRIVER_H100 | 65 | #ifdef IRIVER_H100 |
66 | ".background: lightblue", | 66 | ".background: lightblue", |
67 | #elif defined ARCHOS_GMINI120 | 67 | #elif defined ARCHOS_GMINI120 |
68 | ".background: royalblue", | 68 | ".background: royalblue", |
69 | #else | 69 | #else |
70 | ".background: lightgreen", | 70 | ".background: lightgreen", |
71 | #endif | 71 | #endif |
72 | ".foreground: black", | 72 | ".foreground: black", |
73 | "*help: false", | 73 | "*help: false", |
74 | 0 | 74 | 0 |
75 | }; | 75 | }; |
76 | 76 | ||
77 | void init_window () | 77 | void init_window () |
78 | { | 78 | { |
79 | XGCValues gcv; | 79 | XGCValues gcv; |
80 | XWindowAttributes xgwa; | 80 | XWindowAttributes xgwa; |
81 | 81 | ||
82 | XGetWindowAttributes (dpy, window, &xgwa); | 82 | XGetWindowAttributes (dpy, window, &xgwa); |
83 | 83 | ||
84 | cmap = xgwa.colormap; | 84 | cmap = xgwa.colormap; |
85 | 85 | ||
86 | gcv.function = GXxor; | 86 | gcv.function = GXxor; |
87 | gcv.foreground = | 87 | gcv.foreground = get_pixel_resource("foreground", "Foreground", dpy, cmap); |
88 | get_pixel_resource ("foreground", "Foreground", dpy, cmap); | 88 | draw_gc = XCreateGC (dpy, window, GCForeground, &gcv); |
89 | draw_gc = XCreateGC (dpy, window, GCForeground, &gcv); | ||
90 | 89 | ||
91 | screen_resized(LCD_WIDTH, LCD_HEIGHT); | 90 | screen_resized(LCD_WIDTH, LCD_HEIGHT); |
92 | } | 91 | } |
93 | 92 | ||
94 | void screen_resized(int width, int height) | 93 | void screen_resized(int width, int height) |
95 | { | 94 | { |
96 | int maxx, maxy; | 95 | int maxx, maxy; |
97 | maxx = width; | 96 | maxx = width; |
98 | maxy = height; | 97 | maxy = height; |
99 | |||
100 | XSetForeground (dpy, draw_gc, get_pixel_resource ("background", "Background", | ||
101 | dpy, cmap)); | ||
102 | XFillRectangle(dpy, window, draw_gc, 0, 0, width*display_zoom, height*display_zoom); | ||
103 | lcd_display_redraw=true; | ||
104 | screen_redraw(); | ||
105 | } | ||
106 | 98 | ||
107 | void drawrect(int color, int x1, int y1, int x2, int y2) | ||
108 | { | ||
109 | if (color==0) { | ||
110 | XSetForeground(dpy, draw_gc, | 99 | XSetForeground(dpy, draw_gc, |
111 | get_pixel_resource("background", "Background", dpy, cmap)); | 100 | get_pixel_resource("background", "Background", dpy, cmap)); |
112 | } | 101 | XFillRectangle(dpy, window, draw_gc, 0, 0, width*display_zoom, |
113 | else | 102 | height*display_zoom); |
114 | XSetForeground(dpy, draw_gc, | 103 | lcd_display_redraw=true; |
115 | get_pixel_resource("foreground", "Foreground", dpy, cmap)); | 104 | screen_redraw(); |
116 | XFillRectangle(dpy, window, draw_gc, x1*display_zoom, y1*display_zoom, | 105 | } |
117 | x2*display_zoom, y2*display_zoom); | ||
118 | 106 | ||
107 | void drawrect(int color, int x1, int y1, int x2, int y2) | ||
108 | { | ||
109 | if (color==0) | ||
110 | XSetForeground(dpy, draw_gc, | ||
111 | get_pixel_resource("background", "Background", dpy, cmap)); | ||
112 | else | ||
113 | XSetForeground(dpy, draw_gc, | ||
114 | get_pixel_resource("foreground", "Foreground", dpy, cmap)); | ||
115 | |||
116 | XFillRectangle(dpy, window, draw_gc, x1*display_zoom, y1*display_zoom, | ||
117 | x2*display_zoom, y2*display_zoom); | ||
119 | } | 118 | } |
120 | 119 | ||
121 | static void help(void) | 120 | static void help(void) |
122 | { | 121 | { |
123 | printf(PROGNAME " " ROCKBOXUI_VERSION " " __DATE__ "\n" | 122 | printf(PROGNAME " " ROCKBOXUI_VERSION " " __DATE__ "\n" |
124 | "usage: " PROGNAME "\n" | 123 | "usage: " PROGNAME "\n"); |
125 | ); | ||
126 | } | 124 | } |
127 | 125 | ||
128 | void drawline(int color, int x1, int y1, int x2, int y2) | 126 | void drawline(int color, int x1, int y1, int x2, int y2) |
129 | { | 127 | { |
130 | if (color==0) { | 128 | if (color==0) |
131 | XSetForeground(dpy, draw_gc, | 129 | XSetForeground(dpy, draw_gc, |
132 | get_pixel_resource("background", "Background", dpy, cmap)); | 130 | get_pixel_resource("background", "Background", dpy, cmap)); |
133 | } | 131 | else |
134 | else | 132 | XSetForeground(dpy, draw_gc, |
135 | XSetForeground(dpy, draw_gc, | 133 | get_pixel_resource("foreground", "Foreground", dpy, cmap)); |
136 | get_pixel_resource("foreground", "Foreground", dpy, cmap)); | 134 | |
137 | 135 | XDrawLine(dpy, window, draw_gc, | |
138 | XDrawLine(dpy, window, draw_gc, | 136 | (int)(x1*display_zoom), |
139 | (int)(x1*display_zoom), | 137 | (int)(y1*display_zoom), |
140 | (int)(y1*display_zoom), | 138 | (int)(x2*display_zoom), |
141 | (int)(x2*display_zoom), | 139 | (int)(y2*display_zoom)); |
142 | (int)(y2*display_zoom)); | ||
143 | } | 140 | } |
144 | 141 | ||
145 | void drawdot(int color, int x, int y) | 142 | void drawdot(int color, int x, int y) |
146 | { | 143 | { |
147 | if (color==0) { | 144 | if (color==0) |
148 | XSetForeground(dpy, draw_gc, | 145 | XSetForeground(dpy, draw_gc, |
149 | get_pixel_resource("background", "Background", dpy, cmap)); | 146 | get_pixel_resource("background", "Background", dpy, cmap)); |
150 | } | 147 | else |
151 | else | 148 | XSetForeground(dpy, draw_gc, |
152 | XSetForeground(dpy, draw_gc, | 149 | get_pixel_resource("foreground", "Foreground", dpy, cmap)); |
153 | get_pixel_resource("foreground", "Foreground", dpy, cmap)); | 150 | |
154 | 151 | XFillRectangle(dpy, window, draw_gc, x*display_zoom, y*display_zoom, | |
155 | XFillRectangle(dpy, window, draw_gc, x*display_zoom, y*display_zoom, | 152 | display_zoom, display_zoom); |
156 | display_zoom, display_zoom); | ||
157 | } | 153 | } |
158 | 154 | ||
159 | void drawdots(int color, struct coordinate *points, int count) | 155 | void drawdots(int color, struct coordinate *points, int count) |
160 | { | 156 | { |
161 | if (color==0) { | 157 | if (color==0) |
162 | XSetForeground(dpy, draw_gc, | 158 | XSetForeground(dpy, draw_gc, |
163 | get_pixel_resource("background", "Background", dpy, cmap)); | 159 | get_pixel_resource("background", "Background", dpy, cmap)); |
164 | } | 160 | else |
165 | else | 161 | XSetForeground(dpy, draw_gc, |
166 | XSetForeground(dpy, draw_gc, | 162 | get_pixel_resource("foreground", "Foreground", dpy, cmap)); |
167 | get_pixel_resource("foreground", "Foreground", dpy, cmap)); | 163 | |
168 | 164 | while (count--) { | |
169 | while (count--) { | 165 | XFillRectangle(dpy, window, draw_gc, |
170 | XFillRectangle(dpy, window, draw_gc, | 166 | points[count].x*display_zoom, |
171 | points[count].x*display_zoom, | 167 | points[count].y*display_zoom, |
172 | points[count].y*display_zoom, | 168 | display_zoom, |
173 | display_zoom, | 169 | display_zoom); |
174 | display_zoom); | 170 | } |
175 | } | ||
176 | } | 171 | } |
177 | 172 | ||
178 | void drawrectangles(int color, struct rectangle *points, int count) | 173 | void drawrectangles(int color, struct rectangle *points, int count) |
179 | { | 174 | { |
180 | if (color==0) { | 175 | if (color==0) |
181 | XSetForeground(dpy, draw_gc, | 176 | XSetForeground(dpy, draw_gc, |
182 | get_pixel_resource("background", "Background", dpy, cmap)); | 177 | get_pixel_resource("background", "Background", dpy, cmap)); |
183 | } | 178 | else |
184 | else | 179 | XSetForeground(dpy, draw_gc, |
185 | XSetForeground(dpy, draw_gc, | 180 | get_pixel_resource("foreground", "Foreground", dpy, cmap)); |
186 | get_pixel_resource("foreground", "Foreground", dpy, cmap)); | 181 | |
187 | 182 | while (count--) { | |
188 | while (count--) { | 183 | XFillRectangle(dpy, window, draw_gc, |
189 | XFillRectangle(dpy, window, draw_gc, | 184 | points[count].x*display_zoom, |
190 | points[count].x*display_zoom, | 185 | points[count].y*display_zoom, |
191 | points[count].y*display_zoom, | 186 | points[count].width*display_zoom, |
192 | points[count].width*display_zoom, | 187 | points[count].height*display_zoom); |
193 | points[count].height*display_zoom); | 188 | } |
194 | |||
195 | } | ||
196 | } | 189 | } |
197 | 190 | ||
198 | void drawtext(int color, int x, int y, char *text) | 191 | void drawtext(int color, int x, int y, char *text) |
199 | { | 192 | { |
200 | if (color==0) { | 193 | if (color==0) |
201 | XSetForeground(dpy, draw_gc, | 194 | XSetForeground(dpy, draw_gc, |
202 | get_pixel_resource("background", "Background", dpy, cmap)); | 195 | get_pixel_resource("background", "Background", dpy, cmap)); |
203 | } | 196 | else |
204 | else | 197 | XSetForeground(dpy, draw_gc, |
205 | XSetForeground(dpy, draw_gc, | 198 | get_pixel_resource("foreground", "Foreground", dpy, cmap)); |
206 | get_pixel_resource("foreground", "Foreground", dpy, cmap)); | 199 | |
207 | 200 | XDrawString(dpy, window, draw_gc, x*display_zoom, y*display_zoom, text, | |
208 | XDrawString(dpy, window, draw_gc, x*display_zoom, y*display_zoom, text, strlen(text)); | 201 | strlen(text)); |
209 | } | 202 | } |
210 | 203 | ||
211 | /* this is where the applicaton starts */ | 204 | /* this is where the applicaton starts */ |
@@ -214,36 +207,36 @@ extern void app_main(void); | |||
214 | void | 207 | void |
215 | screenhack (Display *the_dpy, Window the_window) | 208 | screenhack (Display *the_dpy, Window the_window) |
216 | { | 209 | { |
217 | Bool helpme; | 210 | Bool helpme; |
211 | |||
212 | /* This doesn't work, but I don't know why (Daniel 1999-12-01) */ | ||
213 | helpme = get_boolean_resource ("help", "Boolean"); | ||
214 | if(helpme) | ||
215 | help(); | ||
218 | 216 | ||
219 | /* This doesn't work, but I don't know why (Daniel 1999-12-01) */ | 217 | printf(PROGNAME " " ROCKBOXUI_VERSION " (" __DATE__ ")\n"); |
220 | helpme = get_boolean_resource ("help", "Boolean"); | ||
221 | if(helpme) { | ||
222 | help(); | ||
223 | } | ||
224 | printf(PROGNAME " " ROCKBOXUI_VERSION " (" __DATE__ ")\n"); | ||
225 | 218 | ||
226 | dpy=the_dpy; | 219 | dpy=the_dpy; |
227 | window=the_window; | 220 | window=the_window; |
228 | 221 | ||
229 | init_window(); | 222 | init_window(); |
230 | 223 | ||
231 | screen_redraw(); | 224 | screen_redraw(); |
232 | 225 | ||
233 | app_main(); | 226 | app_main(); |
234 | } | 227 | } |
235 | 228 | ||
236 | void screen_redraw() | 229 | void screen_redraw() |
237 | { | 230 | { |
238 | /* draw a border around the "Recorder" screen */ | 231 | /* draw a border around the "Recorder" screen */ |
239 | #define X1 0 | 232 | #define X1 0 |
240 | #define Y1 0 | 233 | #define Y1 0 |
241 | #define X2 (LCD_WIDTH + MARGIN_X*2) | 234 | #define X2 (LCD_WIDTH + MARGIN_X*2) |
242 | #define Y2 (LCD_HEIGHT + MARGIN_Y) | 235 | #define Y2 (LCD_HEIGHT + MARGIN_Y) |
243 | 236 | ||
244 | drawline(1, X1, Y1, X2, Y1); | 237 | drawline(1, X1, Y1, X2, Y1); |
245 | drawline(1, X2, Y1, X2, Y2); | 238 | drawline(1, X2, Y1, X2, Y2); |
246 | drawline(1, X1, Y2, X2, Y2); | 239 | drawline(1, X1, Y2, X2, Y2); |
247 | drawline(1, X1, Y1, X1, Y2); | 240 | drawline(1, X1, Y1, X1, Y2); |
248 | lcd_update(); | 241 | lcd_update(); |
249 | } | 242 | } |