diff options
Diffstat (limited to 'uisimulator/win32')
-rw-r--r-- | uisimulator/win32/UI-h100.bmp | bin | 265464 -> 194120 bytes | |||
-rw-r--r-- | uisimulator/win32/lcd-win32.c | 101 | ||||
-rw-r--r-- | uisimulator/win32/lcd-win32.h | 5 | ||||
-rw-r--r-- | uisimulator/win32/uisw32.c | 13 | ||||
-rw-r--r-- | uisimulator/win32/uisw32.h | 16 |
5 files changed, 120 insertions, 15 deletions
diff --git a/uisimulator/win32/UI-h100.bmp b/uisimulator/win32/UI-h100.bmp index 5c0898ab22..caeb81bc4b 100644 --- a/uisimulator/win32/UI-h100.bmp +++ b/uisimulator/win32/UI-h100.bmp | |||
Binary files differ | |||
diff --git a/uisimulator/win32/lcd-win32.c b/uisimulator/win32/lcd-win32.c index 11296884b7..216aa65a0e 100644 --- a/uisimulator/win32/lcd-win32.c +++ b/uisimulator/win32/lcd-win32.c | |||
@@ -39,13 +39,29 @@ BITMAPINFO256 bmi = | |||
39 | 39 | ||
40 | #ifdef HAVE_LCD_BITMAP | 40 | #ifdef HAVE_LCD_BITMAP |
41 | 41 | ||
42 | #ifdef HAVE_REMOTE_LCD | ||
43 | char remote_bitmap[LCD_REMOTE_HEIGHT][LCD_REMOTE_WIDTH]; | ||
44 | |||
45 | RGBQUAD remote_color_zero = {UI_REMOTE_BGCOLORLIGHT, 0}; | ||
46 | RGBQUAD remote_color_max = {0, 0, 0, 0}; | ||
47 | |||
48 | BITMAPINFO256 remote_bmi = | ||
49 | { | ||
50 | {sizeof (BITMAPINFOHEADER), | ||
51 | LCD_REMOTE_WIDTH, -LCD_REMOTE_HEIGHT, 1, 8, | ||
52 | BI_RGB, 0, 0, 0, 2, 2, | ||
53 | }, | ||
54 | {} /* colour lookup table gets filled later */ | ||
55 | }; | ||
56 | #endif | ||
57 | |||
42 | #if LCD_DEPTH == 1 | 58 | #if LCD_DEPTH == 1 |
43 | extern unsigned char lcd_framebuffer[LCD_HEIGHT/8][LCD_WIDTH]; /* the display */ | 59 | extern unsigned char lcd_framebuffer[LCD_HEIGHT/8][LCD_WIDTH]; /* the display */ |
44 | #elif LCD_DEPTH == 2 | 60 | #elif LCD_DEPTH == 2 |
45 | extern unsigned char lcd_framebuffer[LCD_HEIGHT/4][LCD_WIDTH]; /* the display */ | 61 | extern unsigned char lcd_framebuffer[LCD_HEIGHT/4][LCD_WIDTH]; /* the display */ |
46 | #endif | 62 | #endif |
47 | 63 | ||
48 | void lcd_update() | 64 | void lcd_update(void) |
49 | { | 65 | { |
50 | int x, y; | 66 | int x, y; |
51 | RECT r; | 67 | RECT r; |
@@ -109,19 +125,67 @@ void lcd_update_rect(int x_start, int y_start, | |||
109 | InvalidateRect (hGUIWnd, &r, FALSE); | 125 | InvalidateRect (hGUIWnd, &r, FALSE); |
110 | } | 126 | } |
111 | 127 | ||
128 | #ifdef HAVE_REMOTE_LCD | ||
129 | |||
130 | extern unsigned char lcd_remote_framebuffer[LCD_REMOTE_HEIGHT/8][LCD_REMOTE_WIDTH]; | ||
131 | |||
112 | void lcd_remote_update(void) | 132 | void lcd_remote_update(void) |
113 | { | 133 | { |
114 | 134 | int x, y; | |
135 | RECT r; | ||
136 | |||
137 | if (hGUIWnd == NULL) | ||
138 | _endthread (); | ||
139 | |||
140 | for (x = 0; x < LCD_REMOTE_WIDTH; x++) | ||
141 | for (y = 0; y < LCD_REMOTE_HEIGHT; y++) | ||
142 | remote_bitmap[y][x] = ((lcd_remote_framebuffer[y/8][x] >> (y & 7)) & 1); | ||
143 | |||
144 | /* Invalidate only the window part that actually did change */ | ||
145 | GetClientRect (hGUIWnd, &r); | ||
146 | r.left = UI_REMOTE_POSX * r.right / UI_WIDTH; | ||
147 | r.top = UI_REMOTE_POSY * r.bottom / UI_HEIGHT; | ||
148 | r.right = (UI_REMOTE_POSX + UI_REMOTE_WIDTH) * r.right / UI_WIDTH; | ||
149 | r.bottom = (UI_REMOTE_POSY + UI_REMOTE_HEIGHT) * r.bottom / UI_HEIGHT; | ||
150 | InvalidateRect (hGUIWnd, &r, FALSE); | ||
115 | } | 151 | } |
116 | 152 | ||
117 | void lcd_remote_update_rect(int x_start, int y_start, | 153 | void lcd_remote_update_rect(int x_start, int y_start, |
118 | int width, int height) | 154 | int width, int height) |
119 | { | 155 | { |
120 | (void)x_start; | 156 | int x, y; |
121 | (void)y_start; | 157 | int xmax, ymax; |
122 | (void)width; | 158 | RECT r; |
123 | (void)height; | 159 | |
160 | ymax = y_start + height; | ||
161 | xmax = x_start + width; | ||
162 | |||
163 | if (hGUIWnd == NULL) | ||
164 | _endthread (); | ||
165 | |||
166 | if(xmax > LCD_REMOTE_WIDTH) | ||
167 | xmax = LCD_REMOTE_WIDTH; | ||
168 | if(ymax >= LCD_REMOTE_HEIGHT) | ||
169 | ymax = LCD_REMOTE_HEIGHT; | ||
170 | |||
171 | for (x = x_start; x < xmax; x++) | ||
172 | for (y = y_start; y < ymax; y++) | ||
173 | remote_bitmap[y][x] = ((lcd_remote_framebuffer[y/8][x] >> (y & 7)) & 1); | ||
174 | |||
175 | /* Invalidate only the window part that actually did change */ | ||
176 | GetClientRect (hGUIWnd, &r); | ||
177 | r.left = (UI_REMOTE_POSX + (UI_REMOTE_WIDTH * x_start / LCD_REMOTE_WIDTH)) | ||
178 | * r.right / UI_WIDTH; | ||
179 | r.top = (UI_REMOTE_POSY + (UI_REMOTE_HEIGHT * y_start / LCD_REMOTE_HEIGHT)) | ||
180 | * r.bottom / UI_HEIGHT; | ||
181 | r.right = (UI_REMOTE_POSX + (UI_REMOTE_WIDTH * xmax / LCD_REMOTE_WIDTH)) | ||
182 | * r.right / UI_WIDTH; | ||
183 | r.bottom = (UI_REMOTE_POSY + (UI_REMOTE_HEIGHT * ymax / LCD_REMOTE_HEIGHT)) | ||
184 | * r.bottom / UI_HEIGHT; | ||
185 | InvalidateRect (hGUIWnd, &r, FALSE); | ||
124 | } | 186 | } |
187 | |||
188 | #endif /* HAVE_REMOTE_LCD */ | ||
125 | #endif /* HAVE_LCD_BITMAP */ | 189 | #endif /* HAVE_LCD_BITMAP */ |
126 | 190 | ||
127 | #ifdef HAVE_LCD_CHARCELLS | 191 | #ifdef HAVE_LCD_CHARCELLS |
@@ -131,7 +195,7 @@ extern bool lcd_display_redraw; | |||
131 | extern unsigned char hardware_buffer_lcd[11][2]; | 195 | extern unsigned char hardware_buffer_lcd[11][2]; |
132 | static unsigned char lcd_buffer_copy[11][2]; | 196 | static unsigned char lcd_buffer_copy[11][2]; |
133 | 197 | ||
134 | void lcd_update() | 198 | void lcd_update(void) |
135 | { | 199 | { |
136 | int x, y; | 200 | int x, y; |
137 | bool changed = false; | 201 | bool changed = false; |
@@ -224,11 +288,32 @@ void lcdcolors(int index, int count, RGBQUAD *start, RGBQUAD *end) | |||
224 | } | 288 | } |
225 | } | 289 | } |
226 | 290 | ||
291 | #ifdef HAVE_REMOTE_LCD | ||
292 | /* set a range of bitmap indices to a gradient from startcolour to endcolour */ | ||
293 | void lcdremotecolors(int index, int count, RGBQUAD *start, RGBQUAD *end) | ||
294 | { | ||
295 | int i; | ||
296 | count--; | ||
297 | for (i = 0; i <= count; i++) | ||
298 | { | ||
299 | remote_bmi.bmiColors[i+index].rgbRed = start->rgbRed | ||
300 | + (end->rgbRed - start->rgbRed) * i / count; | ||
301 | remote_bmi.bmiColors[i+index].rgbGreen = start->rgbGreen | ||
302 | + (end->rgbGreen - start->rgbGreen) * i / count; | ||
303 | remote_bmi.bmiColors[i+index].rgbBlue = start->rgbBlue | ||
304 | + (end->rgbBlue - start->rgbBlue) * i / count; | ||
305 | } | ||
306 | } | ||
307 | #endif | ||
308 | |||
227 | /* initialise simulator lcd driver */ | 309 | /* initialise simulator lcd driver */ |
228 | void simlcdinit(void) | 310 | void simlcdinit(void) |
229 | { | 311 | { |
230 | bmi.bmiHeader.biClrUsed = (1<<LCD_DEPTH); | 312 | bmi.bmiHeader.biClrUsed = (1<<LCD_DEPTH); |
231 | bmi.bmiHeader.biClrImportant = (1<<LCD_DEPTH); | 313 | bmi.bmiHeader.biClrImportant = (1<<LCD_DEPTH); |
232 | lcdcolors(0, (1<<LCD_DEPTH), &color_zero, &color_max); | 314 | lcdcolors(0, (1<<LCD_DEPTH), &color_zero, &color_max); |
315 | #ifdef HAVE_REMOTE_LCD | ||
316 | lcdremotecolors(0, (1<<LCD_REMOTE_DEPTH), &remote_color_zero, &remote_color_max); | ||
317 | #endif | ||
233 | } | 318 | } |
234 | 319 | ||
diff --git a/uisimulator/win32/lcd-win32.h b/uisimulator/win32/lcd-win32.h index 26a47208e5..ca9c9da3ee 100644 --- a/uisimulator/win32/lcd-win32.h +++ b/uisimulator/win32/lcd-win32.h | |||
@@ -33,6 +33,11 @@ typedef struct | |||
33 | extern char bitmap[LCD_HEIGHT][LCD_WIDTH]; // the ui display | 33 | extern char bitmap[LCD_HEIGHT][LCD_WIDTH]; // the ui display |
34 | extern BITMAPINFO256 bmi; // bitmap information | 34 | extern BITMAPINFO256 bmi; // bitmap information |
35 | 35 | ||
36 | #ifdef HAVE_REMOTE_LCD | ||
37 | extern char remote_bitmap[LCD_REMOTE_HEIGHT][LCD_REMOTE_WIDTH]; | ||
38 | extern BITMAPINFO256 remote_bmi; // bitmap information | ||
39 | #endif | ||
40 | |||
36 | void simlcdinit(void); | 41 | void simlcdinit(void); |
37 | 42 | ||
38 | #endif // #ifndef __LCDWIN32_H__ | 43 | #endif // #ifndef __LCDWIN32_H__ |
diff --git a/uisimulator/win32/uisw32.c b/uisimulator/win32/uisw32.c index fb581c0cf1..02697be443 100644 --- a/uisimulator/win32/uisw32.c +++ b/uisimulator/win32/uisw32.c | |||
@@ -182,7 +182,16 @@ LRESULT CALLBACK GUIWndProc ( | |||
182 | 0, 0, LCD_WIDTH, LCD_HEIGHT, | 182 | 0, 0, LCD_WIDTH, LCD_HEIGHT, |
183 | bitmap, (BITMAPINFO *) &bmi, DIB_RGB_COLORS, | 183 | bitmap, (BITMAPINFO *) &bmi, DIB_RGB_COLORS, |
184 | SRCCOPY); | 184 | SRCCOPY); |
185 | 185 | #ifdef HAVE_REMOTE_LCD | |
186 | StretchDIBits (hDc, | ||
187 | UI_REMOTE_POSX * r.right / UI_WIDTH, | ||
188 | UI_REMOTE_POSY * r.bottom / UI_HEIGHT, | ||
189 | UI_REMOTE_WIDTH * r.right / UI_WIDTH, | ||
190 | UI_REMOTE_HEIGHT * r.bottom / UI_HEIGHT, | ||
191 | 0, 0, LCD_REMOTE_WIDTH, LCD_REMOTE_HEIGHT, | ||
192 | remote_bitmap, (BITMAPINFO *) &remote_bmi, | ||
193 | DIB_RGB_COLORS, SRCCOPY); | ||
194 | #endif | ||
186 | EndPaint (hWnd, &ps); | 195 | EndPaint (hWnd, &ps); |
187 | return TRUE; | 196 | return TRUE; |
188 | } | 197 | } |
@@ -240,7 +249,7 @@ BOOL GUIStartup () | |||
240 | if (hGUIWnd == NULL) | 249 | if (hGUIWnd == NULL) |
241 | return FALSE; | 250 | return FALSE; |
242 | 251 | ||
243 | simlcdinit(); | 252 | simlcdinit(); |
244 | 253 | ||
245 | return TRUE; | 254 | return TRUE; |
246 | } | 255 | } |
diff --git a/uisimulator/win32/uisw32.h b/uisimulator/win32/uisw32.h index dbbfd06c1e..cf44a8a76d 100644 --- a/uisimulator/win32/uisw32.h +++ b/uisimulator/win32/uisw32.h | |||
@@ -76,16 +76,22 @@ typedef unsigned short wchar_t; | |||
76 | #define UI_LCD_HEIGHT 64 // (80 for real aspect) | 76 | #define UI_LCD_HEIGHT 64 // (80 for real aspect) |
77 | 77 | ||
78 | #elif defined(IRIVER_H100) | 78 | #elif defined(IRIVER_H100) |
79 | #define UI_TITLE "iRiver H100" | 79 | #define UI_TITLE "iriver H100" |
80 | #define UI_WIDTH 352 // width of GUI window | 80 | #define UI_WIDTH 379 // width of GUI window |
81 | #define UI_HEIGHT 377 // height of GUI window | 81 | #define UI_HEIGHT 508 // height of GUI window |
82 | #define UI_LCD_BGCOLOR 90, 145, 90 // bkgnd color of LCD (no backlight) | 82 | #define UI_LCD_BGCOLOR 90, 145, 90 // bkgnd color of LCD (no backlight) |
83 | #define UI_LCD_BGCOLORLIGHT 230, 216, 173 // bkgnd color of LCD (backlight) | 83 | #define UI_LCD_BGCOLORLIGHT 230, 216, 173 // bkgnd color of LCD (backlight) |
84 | #define UI_LCD_BLACK 0, 0, 0 // black | 84 | #define UI_LCD_BLACK 0, 0, 0 // black |
85 | #define UI_LCD_POSX 96 // x position of lcd | 85 | #define UI_LCD_POSX 109 // x position of lcd |
86 | #define UI_LCD_POSY 28 // y position of lcd | 86 | #define UI_LCD_POSY 23 // y position of lcd |
87 | #define UI_LCD_WIDTH 160 | 87 | #define UI_LCD_WIDTH 160 |
88 | #define UI_LCD_HEIGHT 128 | 88 | #define UI_LCD_HEIGHT 128 |
89 | #define UI_REMOTE_BGCOLOR 90, 145, 90 // bkgnd of remote lcd (no bklight) | ||
90 | #define UI_REMOTE_BGCOLORLIGHT 250, 180, 130 // bkgnd of remote lcd (bklight) | ||
91 | #define UI_REMOTE_POSX 50 // x position of remote lcd | ||
92 | #define UI_REMOTE_POSY 403 // y position of remote lcd | ||
93 | #define UI_REMOTE_WIDTH 128 | ||
94 | #define UI_REMOTE_HEIGHT 64 | ||
89 | 95 | ||
90 | #elif defined(ARCHOS_GMINI120) | 96 | #elif defined(ARCHOS_GMINI120) |
91 | #define UI_TITLE "Gmini 120" | 97 | #define UI_TITLE "Gmini 120" |