summaryrefslogtreecommitdiff
path: root/uisimulator/x11/uibasic.c
diff options
context:
space:
mode:
authorDan Everton <dan@iocaine.org>2006-08-12 10:28:30 +0000
committerDan Everton <dan@iocaine.org>2006-08-12 10:28:30 +0000
commit9d2929b79b22765701e9db240d967877d7f7bab8 (patch)
tree0829913b3e58ce5d1886358395d42c5cee80ce6c /uisimulator/x11/uibasic.c
parent509ee3d42cfe0660a107ae169a11cef9c0604b1f (diff)
downloadrockbox-9d2929b79b22765701e9db240d967877d7f7bab8.tar.gz
rockbox-9d2929b79b22765701e9db240d967877d7f7bab8.zip
Remove Win32 and X11 simulator sources. They've been deprecated for a while in favour of the SDL sim. Time to go.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@10543 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'uisimulator/x11/uibasic.c')
-rw-r--r--uisimulator/x11/uibasic.c277
1 files changed, 0 insertions, 277 deletions
diff --git a/uisimulator/x11/uibasic.c b/uisimulator/x11/uibasic.c
deleted file mode 100644
index 57870c39d3..0000000000
--- a/uisimulator/x11/uibasic.c
+++ /dev/null
@@ -1,277 +0,0 @@
1/***************************************************************************
2 * __________ __ ___.
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
7 * \/ \/ \/ \/ \/
8 * $Id$
9 *
10 * Copyright (C) 2002 by Daniel Stenberg <daniel@haxx.se>
11 *
12 * All files in this archive are subject to the GNU General Public License.
13 * See the file COPYING in the source tree root for full license agreement.
14 *
15 * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
16 * KIND, either express or implied.
17 *
18 ****************************************************************************/
19#include <stdio.h>
20#include <string.h>
21#include <stdarg.h>
22#include <stdlib.h>
23#include <ctype.h>
24#include <sys/types.h>
25#include <sys/stat.h>
26#include <fcntl.h>
27
28#include <errno.h>
29#include <ctype.h>
30#include <time.h>
31
32#include "config.h"
33#include "screenhack.h"
34
35#include "version.h"
36
37#include "lcd-x11.h"
38#include "lcd-playersim.h"
39
40#define MAX(x,y) ((x)>(y)?(x):(y))
41#define MIN(x,y) ((x)<(y)?(x):(y))
42
43#define PROGNAME "rockboxui"
44
45/* -- -- */
46
47GC draw_gc;
48static Colormap cmap;
49
50int display_zoom=1;
51bool lcd_display_redraw=true;
52
53XrmOptionDescRec options [] = {
54 /* { "-subtractive", ".additive", XrmoptionNoArg, "false" }, */
55 { "-server", ".server", XrmoptionSepArg, 0 },
56 { "-help", ".help", XrmoptionNoArg, "false" },
57 { 0, 0, 0, 0 }
58};
59char *progclass = "rockboxui";
60
61#ifdef IRIVER_H100_SERIES
62#define BGCOLOR "lightblue"
63#elif defined ARCHOS_GMINI120
64#define BGCOLOR "royalblue"
65#else
66#define BGCOLOR "lightgreen"
67#endif
68
69
70char *defaults [] = {
71 ".background: " BGCOLOR,
72 ".foreground: black",
73 "*help: false",
74 0
75};
76
77static XColor getcolor[4];
78
79/* set a range of bitmap indices to a gradient from startcolour to endcolour
80 inherited from the win32 sim code by Jens Arnold */
81static void lcdcolors(int index, int count, XColor *start, XColor *end)
82{
83 int i;
84 count--;
85 for (i = 0; i <= count; i++)
86 {
87 getcolor[i+index].red = start->red
88 + (end->red - start->red) * i / count;
89 getcolor[i+index].green = start->green
90 + (end->green - start->green) * i / count;
91 getcolor[i+index].blue = start->blue
92 + (end->blue - start->blue) * i / count;
93 XAllocColor (dpy, cmap, &getcolor[i+index]);
94 }
95}
96
97
98void init_window ()
99{
100 XGCValues gcv;
101 XWindowAttributes xgwa;
102
103 XGetWindowAttributes (dpy, window, &xgwa);
104 XColor bg;
105 XColor fg;
106
107 cmap = xgwa.colormap;
108
109 XParseColor (dpy, cmap, BGCOLOR, &bg);
110 XParseColor (dpy, cmap, "black", &fg);
111 getcolor[0] = bg;
112 getcolor[1] = bg;
113 getcolor[2] = bg;
114 getcolor[3] = bg;
115
116 lcdcolors(0, 4, &bg, &fg);
117
118#if 0
119 for(i=0; i<4; i++) {
120 printf("color %d: %d %d %d\n",
121 i,
122 getcolor[i].red,
123 getcolor[i].green,
124 getcolor[i].blue);
125 }
126#endif
127
128 gcv.function = GXxor;
129 gcv.foreground = getcolor[3].pixel;
130 draw_gc = XCreateGC (dpy, window, GCForeground, &gcv);
131
132 screen_resized(LCD_WIDTH, LCD_HEIGHT);
133}
134
135void screen_resized(int width, int height)
136{
137 int maxx, maxy;
138 maxx = width;
139 maxy = height;
140
141 XtAppLock(app);
142 XSetForeground(dpy, draw_gc, getcolor[0].pixel);
143
144 XFillRectangle(dpy, window, draw_gc, 0, 0, width*display_zoom,
145 height*display_zoom);
146 XtAppUnlock(app);
147 screen_redraw();
148}
149
150void drawrect(int color, int x1, int y1, int x2, int y2)
151{
152 XtAppLock(app);
153 XSetForeground(dpy, draw_gc, getcolor[color].pixel);
154 XFillRectangle(dpy, window, draw_gc, x1*display_zoom, y1*display_zoom,
155 x2*display_zoom, y2*display_zoom);
156 XtAppUnlock(app);
157}
158
159static void help(void)
160{
161 printf(PROGNAME " " ROCKBOXUI_VERSION " " __DATE__ "\n"
162 "usage: " PROGNAME "\n");
163}
164
165static void drawline(int color, int x1, int y1, int x2, int y2)
166{
167 XtAppLock(app);
168 XSetForeground(dpy, draw_gc, getcolor[color].pixel);
169
170 XDrawLine(dpy, window, draw_gc,
171 (int)(x1*display_zoom),
172 (int)(y1*display_zoom),
173 (int)(x2*display_zoom),
174 (int)(y2*display_zoom));
175 XtAppUnlock(app);
176}
177
178void dots(int *colors, struct coordinate *points, int count)
179{
180 int color;
181 XtAppLock(app);
182
183 while (count--) {
184 color = colors[count];
185 XSetForeground(dpy, draw_gc, getcolor[color].pixel);
186 XFillRectangle(dpy, window, draw_gc,
187 points[count].x*display_zoom,
188 points[count].y*display_zoom,
189 display_zoom,
190 display_zoom);
191 }
192 XtAppUnlock(app);
193}
194
195/* this is where the applicaton starts */
196extern void app_main(void);
197
198void screenhack()
199{
200 Bool helpme;
201
202 /* This doesn't work, but I don't know why (Daniel 1999-12-01) */
203 helpme = get_boolean_resource ("help", "Boolean");
204 if(helpme)
205 help();
206
207 printf(PROGNAME " " ROCKBOXUI_VERSION " (" __DATE__ ")\n");
208
209 init_window();
210
211 screen_redraw();
212
213 app_main();
214}
215
216/* used for the player sim */
217void drawdots(int color, struct coordinate *points, int count)
218{
219 XtAppLock(app);
220 XSetForeground(dpy, draw_gc, getcolor[color==0?0:3].pixel);
221
222 while (count--) {
223 XFillRectangle(dpy, window, draw_gc,
224 points[count].x*display_zoom,
225 points[count].y*display_zoom,
226 display_zoom,
227 display_zoom);
228 }
229 XtAppUnlock(app);
230}
231
232/* used for the player sim */
233void drawrectangles(int color, struct rectangle *points, int count)
234{
235 XtAppLock(app);
236
237 XSetForeground(dpy, draw_gc, getcolor[color==0?0:3].pixel);
238 while (count--) {
239 XFillRectangle(dpy, window, draw_gc,
240 points[count].x*display_zoom,
241 points[count].y*display_zoom,
242 points[count].width*display_zoom,
243 points[count].height*display_zoom);
244 }
245 XtAppUnlock(app);
246}
247
248
249void screen_redraw()
250{
251 /* draw a border around the screen */
252#define X1 0
253#define Y1 0
254#define X2 (LCD_WIDTH + 2*MARGIN_X - 1)
255#define Y2 (LCD_HEIGHT + 2*MARGIN_Y - 1)
256
257 drawline(1, X1, Y1, X2, Y1);
258 drawline(1, X2, Y1, X2, Y2);
259 drawline(1, X1, Y2, X2, Y2);
260 drawline(1, X1, Y1, X1, Y2);
261 lcd_display_redraw = true;
262 lcd_update();
263#ifdef LCD_REMOTE_HEIGHT
264 /* draw a border around the remote LCD screen */
265#define RX1 0
266#define RY1 (Y2 + 1)
267#define RX2 (LCD_REMOTE_WIDTH + 2*MARGIN_X - 1)
268#define RY2 (RY1 + LCD_REMOTE_HEIGHT + 2*MARGIN_Y - 1)
269
270 drawline(1, RX1, RY1, RX2, RY1);
271 drawline(1, RX2, RY1, RX2, RY2);
272 drawline(1, RX1, RY2, RX2, RY2);
273 drawline(1, RX1, RY1, RX1, RY2);
274 lcd_display_redraw = true;
275 lcd_remote_update();
276#endif
277}