summaryrefslogtreecommitdiff
path: root/uisimulator/x11/uibasic.c
diff options
context:
space:
mode:
Diffstat (limited to 'uisimulator/x11/uibasic.c')
-rw-r--r--uisimulator/x11/uibasic.c43
1 files changed, 39 insertions, 4 deletions
diff --git a/uisimulator/x11/uibasic.c b/uisimulator/x11/uibasic.c
index 78ba500b6d..051f5a8b6f 100644
--- a/uisimulator/x11/uibasic.c
+++ b/uisimulator/x11/uibasic.c
@@ -34,6 +34,7 @@
34#include "version.h" 34#include "version.h"
35 35
36#include "lcd-x11.h" 36#include "lcd-x11.h"
37#include "lcd-playersim.h"
37 38
38#define MAX(x,y) ((x)>(y)?(x):(y)) 39#define MAX(x,y) ((x)>(y)?(x):(y))
39#define MIN(x,y) ((x)<(y)?(x):(y)) 40#define MIN(x,y) ((x)<(y)?(x):(y))
@@ -49,6 +50,7 @@ static int display_zoom=1;
49 50
50Display *dpy; 51Display *dpy;
51Window window; 52Window window;
53bool lcd_display_redraw=true;
52 54
53XrmOptionDescRec options [] = { 55XrmOptionDescRec options [] = {
54 /* { "-subtractive", ".additive", XrmoptionNoArg, "false" }, */ 56 /* { "-subtractive", ".additive", XrmoptionNoArg, "false" }, */
@@ -96,6 +98,21 @@ void screen_resized(int width, int height)
96 XSetForeground (dpy, draw_gc, get_pixel_resource ("background", "Background", 98 XSetForeground (dpy, draw_gc, get_pixel_resource ("background", "Background",
97 dpy, cmap)); 99 dpy, cmap));
98 XFillRectangle(dpy, window, draw_gc, 0, 0, width*display_zoom, height*display_zoom); 100 XFillRectangle(dpy, window, draw_gc, 0, 0, width*display_zoom, height*display_zoom);
101 lcd_display_redraw=true;
102 screen_redraw();
103}
104
105void drawrect(int color, int x1, int y1, int x2, int y2)
106{
107 if (color==0) {
108 XSetForeground(dpy, draw_gc,
109 get_pixel_resource("background", "Background", dpy, cmap));
110 }
111 else
112 XSetForeground(dpy, draw_gc,
113 get_pixel_resource("foreground", "Foreground", dpy, cmap));
114 XFillRectangle(dpy, window, draw_gc, x1*display_zoom, y1*display_zoom,
115 x2*display_zoom, y2*display_zoom);
99 116
100} 117}
101 118
@@ -137,7 +154,7 @@ void drawdot(int color, int x, int y)
137 display_zoom, display_zoom); 154 display_zoom, display_zoom);
138} 155}
139 156
140void drawdots(int color, XPoint *points, int count) 157void drawdots(int color, struct coordinate *points, int count)
141{ 158{
142 if (color==0) { 159 if (color==0) {
143 XSetForeground(dpy, draw_gc, 160 XSetForeground(dpy, draw_gc,
@@ -147,7 +164,7 @@ void drawdots(int color, XPoint *points, int count)
147 XSetForeground(dpy, draw_gc, 164 XSetForeground(dpy, draw_gc,
148 get_pixel_resource("foreground", "Foreground", dpy, cmap)); 165 get_pixel_resource("foreground", "Foreground", dpy, cmap));
149 166
150 while (count-->=0) { 167 while (count--) {
151 XFillRectangle(dpy, window, draw_gc, 168 XFillRectangle(dpy, window, draw_gc,
152 points[count].x*display_zoom, 169 points[count].x*display_zoom,
153 points[count].y*display_zoom, 170 points[count].y*display_zoom,
@@ -156,6 +173,26 @@ void drawdots(int color, XPoint *points, int count)
156 } 173 }
157} 174}
158 175
176void drawrectangles(int color, struct rectangle *points, int count)
177{
178 if (color==0) {
179 XSetForeground(dpy, draw_gc,
180 get_pixel_resource("background", "Background", dpy, cmap));
181 }
182 else
183 XSetForeground(dpy, draw_gc,
184 get_pixel_resource("foreground", "Foreground", dpy, cmap));
185
186 while (count--) {
187 XFillRectangle(dpy, window, draw_gc,
188 points[count].x*display_zoom,
189 points[count].y*display_zoom,
190 points[count].width*display_zoom,
191 points[count].height*display_zoom);
192
193 }
194}
195
159void drawtext(int color, int x, int y, char *text) 196void drawtext(int color, int x, int y, char *text)
160{ 197{
161 if (color==0) { 198 if (color==0) {
@@ -197,7 +234,6 @@ screenhack (Display *the_dpy, Window the_window)
197void screen_redraw() 234void screen_redraw()
198{ 235{
199 /* draw a border around the "Recorder" screen */ 236 /* draw a border around the "Recorder" screen */
200
201#define X1 0 237#define X1 0
202#define Y1 0 238#define Y1 0
203#define X2 (LCD_WIDTH + MARGIN_X*2) 239#define X2 (LCD_WIDTH + MARGIN_X*2)
@@ -207,6 +243,5 @@ void screen_redraw()
207 drawline(1, X2, Y1, X2, Y2); 243 drawline(1, X2, Y1, X2, Y2);
208 drawline(1, X1, Y2, X2, Y2); 244 drawline(1, X1, Y2, X2, Y2);
209 drawline(1, X1, Y1, X1, Y2); 245 drawline(1, X1, Y1, X1, Y2);
210
211 lcd_update(); 246 lcd_update();
212} 247}