···11-/***************************************************************************
22- * __________ __ ___.
33- * Open \______ \ ____ ____ | | _\_ |__ _______ ___
44- * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
55- * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
66- * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
77- * \/ \/ \/ \/ \/
88- * $Id$
99- *
1010- * Copyright (C) 2007 by Jonathan Gordon
1111- *
1212- * This program is free software; you can redistribute it and/or
1313- * modify it under the terms of the GNU General Public License
1414- * as published by the Free Software Foundation; either version 2
1515- * of the License, or (at your option) any later version.
1616- *
1717- * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
1818- * KIND, either express or implied.
1919- *
2020- ****************************************************************************/
2121-2222-/* This file contains the code to draw the list widget on BITMAP LCDs. */
2323-2424-#include "config.h"
2525-#include "lcd.h"
2626-#include "font.h"
2727-#include "button.h"
2828-#include "string.h"
2929-#include "settings.h"
3030-#include "kernel.h"
3131-#include "system.h"
3232-#include "file.h"
3333-3434-#include "list.h"
3535-#include "screen_access.h"
3636-#include "scrollbar.h"
3737-#include "lang.h"
3838-#include "sound.h"
3939-#include "misc.h"
4040-4141-void gui_synclist_scroll_stop(struct gui_synclist *lists)
4242-{
4343- (void)lists;
4444- FOR_NB_SCREENS(i)
4545- {
4646- screens[i].scroll_stop();
4747- }
4848-}
4949-5050-void list_draw(struct screen *display, struct gui_synclist *gui_list)
5151-{
5252- bool draw_icons = (gui_list->callback_get_item_icon != NULL);
5353- bool selected;
5454- int i;
5555- int start, end;
5656-5757- display->set_viewport(NULL);
5858-5959- display->clear_display();
6060- start = 0;
6161- end = display->getnblines();
6262-6363- struct line_desc desc = {
6464- .height = -1,
6565- .text_color = 1,
6666- .line_color = 1,
6767- .line_end_color = 1,
6868- .style = STYLE_DEFAULT
6969- };
7070-7171- for (i = start; i < end; i++)
7272- {
7373- unsigned const char *s;
7474- char entry_buffer[MAX_PATH];
7575- unsigned char *entry_name;
7676- int current_item = gui_list->start_item[display->screen_type] + i;
7777-7878- /* When there are less items to display than the
7979- * current available space on the screen, we stop*/
8080- if(current_item >= gui_list->nb_items)
8181- break;
8282- s = gui_list->callback_get_item_name(current_item,
8383- gui_list->data,
8484- entry_buffer,
8585- sizeof(entry_buffer));
8686- entry_name = P2STR(s);
8787-8888- if (gui_list->show_selection_marker &&
8989- current_item >= gui_list->selected_item &&
9090- current_item < gui_list->selected_item + gui_list->selected_size)
9191- selected = true; /* The selected item must be displayed scrolling */
9292- else
9393- selected = false;
9494-9595- desc.nlines = gui_list->selected_size,
9696- desc.line = gui_list->selected_size > 1 ? i : 0,
9797- desc.scroll = selected ? true : gui_list->scroll_all;
9898-9999- if (draw_icons)
100100- put_line(display, 0, i, &desc, "$i$i$t",
101101- selected ? Icon_Cursor : Icon_NOICON,
102102- gui_list->callback_get_item_icon(current_item, gui_list->data),
103103- entry_name);
104104- else
105105- put_line(display, 0, i, &desc, "$i$t",
106106- selected ? Icon_Cursor : Icon_NOICON,
107107- entry_name);
108108- }
109109-110110- display->update_viewport();
111111- display->update();
112112-}
+1-14
apps/gui/icon.h
···8989 */
9090extern void screen_put_iconxy(struct screen * screen,
9191 int x, int y, enum themable_icons icon);
9292-#ifdef HAVE_LCD_CHARCELLS
9393-# define screen_put_icon(s, x, y, i) screen_put_iconxy(s, x, y, i)
9494-# define screen_put_icon_with_offset(s, x, y, w, h, i) screen_put_icon(s, x, y, i)
9595-#else
9692/* For both of these, the icon will be placed in the center of the rectangle */
9793/* as above, but x,y are letter position, NOT PIXEL */
9894extern void screen_put_icon(struct screen * screen,
···10197extern void screen_put_icon_with_offset(struct screen * display,
10298 int x, int y, int off_x, int off_y,
10399 enum themable_icons icon);
104104-#endif
105105-106100void icons_init(void);
107101108102109109-#ifdef HAVE_LCD_CHARCELLS
110110-# define CURSOR_CHAR 0xe10c
111111-# define get_icon_width(a) 1
112112-# define get_icon_height(a) 1 /* needs to be verified */
113113-#else
114103int get_icon_width(enum screen_type screen_type);
115104int get_icon_height(enum screen_type screen_type);
116105int get_icon_format(enum screen_type screen_type);
117117-#endif
118106119119-#if (LCD_DEPTH > 1) || defined(HAVE_REMOTE_LCD) && (LCD_REMOTE_DEPTH > 1) \
120120- && !defined(HAVE_LCD_CHARCELLS)
107107+#if (LCD_DEPTH > 1) || defined(HAVE_REMOTE_LCD) && (LCD_REMOTE_DEPTH > 1)
121108int get_icon_format(enum screen_type screen_type);
122109#else
123110# define get_icon_format(a) FORMAT_MONO
-4
apps/gui/line.c
···4141#endif
424243434444-#ifdef HAVE_LCD_CHARCELLS
4545-#define style_line(d, x, y, l)
4646-#else
4744static void style_line(struct screen *display, int x, int y, struct line_desc *line);
4848-#endif
49455046static void put_text(struct screen *display, int x, int y, struct line_desc *line,
5147 const char *text, bool prevent_scroll, int text_skip_pixels);
-5
apps/gui/list.c
···279279 int bottom = MAX(0, gui_list->nb_items - nb_lines);
280280 int new_start_item = gui_list->start_item[screen];
281281 int difference = gui_list->selected_item - gui_list->start_item[screen];
282282-#ifdef HAVE_LCD_CHARCELLS
283283- const int scroll_limit_up = 0;
284284- const int scroll_limit_down = 1;
285285-#else
286282 const int scroll_limit_up = (nb_lines < gui_list->selected_size+2 ? 0:1);
287283 const int scroll_limit_down = (scroll_limit_up+gui_list->selected_size);
288288-#endif
289284290285 if (gui_list->show_selection_marker == false)
291286 {
-1
apps/gui/skin_engine/skin_display.c
···662662 */
663663int skin_wait_for_action(enum skinnable_screens skin, int context, int timeout)
664664{
665665- (void)skin; /* silence charcell warning */
666665 int button = ACTION_NONE;
667666#ifdef HAVE_LCD_BITMAP
668667 /* when the peak meter is enabled we want to have a
···595595 GRID_TOP + 4*(TK_HEIGHT+TK_SPACE) + 2, s );
596596}
597597598598-#else /* HAVE_LCD_CHARCELLS */
599599-600600-static const unsigned char tk_pat[4][7] = {
601601- { 0x0e, 0x11, 0x0e, 0x00, 0x0e, 0x11, 0x0e }, /* white - white */
602602- { 0x0e, 0x11, 0x0e, 0x00, 0x0e, 0x1f, 0x0e }, /* white - black */
603603- { 0x0e, 0x1f, 0x0e, 0x00, 0x0e, 0x11, 0x0e }, /* black - white */
604604- { 0x0e, 0x1f, 0x0e, 0x00, 0x0e, 0x1f, 0x0e } /* black - black */
605605-};
606606-607607-static unsigned char cur_pat[7];
608608-static unsigned long gfx_chars[5];
609609-610610-static void release_gfx(void)
611611-{
612612- int i;
613613-614614- for (i = 0; i < 5; i++)
615615- if (gfx_chars[i])
616616- rb->lcd_unlock_pattern(gfx_chars[i]);
617617-}
618618-619619-static bool init_gfx(void)
620620-{
621621- int i;
622622-623623- for (i = 0; i < 5; i++) {
624624- if ((gfx_chars[i] = rb->lcd_get_locked_pattern()) == 0) {
625625- release_gfx();
626626- return false;
627627- }
628628- }
629629- for (i = 0; i < 4; i++)
630630- rb->lcd_define_pattern(gfx_chars[i], tk_pat[i]);
631631- return true;
632632-}
633633-634634-/* draw a spot at the coordinates (x,y), range of p is 0-19 */
635635-static void draw_spot(int p)
636636-{
637637- if ((p/5) & 1)
638638- p -= 5;
639639-640640- rb->lcd_putc (p%5, p/10, gfx_chars[2*spots[p]+spots[p+5]]);
641641-}
642642-643643-/* draw the cursor at the current cursor position */
644644-static void draw_cursor(void)
645645-{
646646- if ((cursor_pos/5) & 1) {
647647- rb->memcpy( cur_pat, tk_pat[2*spots[cursor_pos-5]+spots[cursor_pos]], 7 );
648648- cur_pat[4] ^= 0x15;
649649- cur_pat[6] ^= 0x11;
650650- }
651651- else {
652652- rb->memcpy( cur_pat, tk_pat[2*spots[cursor_pos]+spots[cursor_pos+5]], 7 );
653653- cur_pat[0] ^= 0x15;
654654- cur_pat[2] ^= 0x11;
655655- }
656656- rb->lcd_define_pattern(gfx_chars[4], cur_pat);
657657- rb->lcd_putc( cursor_pos%5, cursor_pos/10, gfx_chars[4] );
658658-}
659659-660660-/* draw the info panel ... duh */
661661-static void draw_info_panel(void)
662662-{
663663- rb->lcd_puts( 6, 0, "Flips" );
664664- rb->lcd_putsf( 6, 1, "%d", moves );
665665-}
666666-667598#endif /* LCD */
668599669600/* clear the cursor where it is */
···978909#endif
979910980911 rb->lcd_update();
981981-#else /* HAVE_LCD_CHARCELLS */
982982- if (!init_gfx())
983983- return PLUGIN_ERROR;
984912#endif
985913 rb->button_get_w_tmo(HZ*3);
986914···995923 rb->srand(*rb->current_tick);
996924997925 rc = flipit_loop();
998998-#ifdef HAVE_LCD_CHARCELLS
999999- release_gfx();
10001000-#endif
1001926 return rc;
1002927}
-4
apps/plugins/invadrox.c
···6666/* Original graphics is only 1bpp so it should be portable
6767 * to most targets. But for now, only support the simple ones.
6868 */
6969-#ifndef HAVE_LCD_BITMAP
7070- #error INVADROX: Unsupported LCD
7171-#endif
7272-7369#if (LCD_DEPTH < 2)
7470 #error INVADROX: Unsupported LCD
7571#endif
···3232 * targets. On color, mylcd_ub_update_XXXX refer to the proper update
3333 * functions, otherwise they are no-ops.
3434 *
3535- * lib/playergfx.h or lib/grey.h should be included before including this
3535+ * lib/grey.h should be included before including this
3636 * header. For bitmap LCD's, defaults to rb->lcd_XXXX otherwise.
3737 */
3838-#if defined (HAVE_LCD_CHARCELLS) && defined(__PGFX_H__)
3939-#define MYLCD_CFG_PGFX /* using PGFX */
4040-#define mylcd_(fn) pgfx_##fn
4141-#define mylcd_ub_(fn) pgfx_##fn
4242-4343-#elif defined (HAVE_LCD_BITMAP) && (LCD_DEPTH < 4) && defined(__GREY_H__)
3838+#if defined (HAVE_LCD_BITMAP) && (LCD_DEPTH < 4) && defined(__GREY_H__)
4439#define MYLCD_CFG_GREYLIB /* using greylib */
4540#define mylcd_(fn) grey_##fn
4641#define myxlcd_(fn) grey_##fn
-4
apps/plugins/lib/osd.h
···2323#ifndef OSD_H
2424#define OSD_H
25252626-#ifndef HAVE_LCD_BITMAP
2727-#error OSD requires bitmapped LCD
2828-#endif
2929-3026/* At this time: assumes use of the default viewport for normal drawing */
31273228/* Callback implemented by user. Paramters are OSD vp-relative coordinates */
-526
apps/plugins/lib/playergfx.c
···11-/***************************************************************************
22-* __________ __ ___.
33-* Open \______ \ ____ ____ | | _\_ |__ _______ ___
44-* Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
55-* Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
66-* Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
77-* \/ \/ \/ \/ \/
88-* $Id$
99-*
1010-* Bitmap graphics on player LCD!
1111-*
1212-* Copyright (C) 2005 Jens Arnold
1313-*
1414-* This program is free software; you can redistribute it and/or
1515-* modify it under the terms of the GNU General Public License
1616-* as published by the Free Software Foundation; either version 2
1717-* of the License, or (at your option) any later version.
1818-*
1919-* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
2020-* KIND, either express or implied.
2121-*
2222-****************************************************************************/
2323-2424-#include "plugin.h"
2525-2626-#include "playergfx.h"
2727-2828-/*** globals ***/
2929-3030-static int char_width;
3131-static int char_height;
3232-static int pixel_height;
3333-static int pixel_width;
3434-static unsigned long gfx_chars[8];
3535-static unsigned char gfx_buffer[56];
3636-static int drawmode = DRMODE_SOLID;
3737-3838-/*** Special functions ***/
3939-4040-/* library init */
4141-bool pgfx_init(int cwidth, int cheight)
4242-{
4343- int i;
4444-4545- if (((unsigned) cwidth * (unsigned) cheight) > 8 || (unsigned) cheight > 2)
4646- return false;
4747-4848- char_width = cwidth;
4949- char_height = cheight;
5050- pixel_height = 7 * char_height;
5151- pixel_width = 5 * char_width;
5252-5353- for (i = 0; i < cwidth * cheight; i++)
5454- {
5555- if ((gfx_chars[i] = rb->lcd_get_locked_pattern()) == 0)
5656- {
5757- pgfx_release();
5858- return false;
5959- }
6060- }
6161-6262- return true;
6363-}
6464-6565-/* library deinit */
6666-void pgfx_release(void)
6767-{
6868- int i;
6969-7070- for (i = 0; i < 8; i++)
7171- if (gfx_chars[i])
7272- rb->lcd_unlock_pattern(gfx_chars[i]);
7373-}
7474-7575-/* place the display */
7676-void pgfx_display(int cx, int cy)
7777-{
7878- int i, j;
7979- int width = MIN(char_width, 11 - cx);
8080- int height = MIN(char_height, 2 - cy);
8181-8282- for (i = 0; i < width; i++)
8383- for (j = 0; j < height; j++)
8484- rb->lcd_putc(cx + i, cy + j, gfx_chars[char_height * i + j]);
8585-}
8686-8787-void pgfx_display_block(int cx, int cy, int x, int y)
8888-{
8989- rb->lcd_putc(cx, cy, gfx_chars[char_height * x + y]);
9090-}
9191-9292-9393-/*** Update functions ***/
9494-9595-void pgfx_update(void)
9696-{
9797- int i;
9898-9999- for (i = 0; i < char_width * char_height; i++)
100100- rb->lcd_define_pattern(gfx_chars[i], gfx_buffer + 7 * i);
101101-102102- rb->lcd_update();
103103-}
104104-105105-/*** Parameter handling ***/
106106-107107-void pgfx_set_drawmode(int mode)
108108-{
109109- drawmode = mode & (DRMODE_SOLID|DRMODE_INVERSEVID);
110110-}
111111-112112-int pgfx_get_drawmode(void)
113113-{
114114- return drawmode;
115115-}
116116-117117-/*** Low-level drawing functions ***/
118118-119119-static void setpixel(int x, int y)
120120-{
121121- gfx_buffer[pixel_height * (x/5) + y] |= 0x10 >> (x%5);
122122-}
123123-124124-static void clearpixel(int x, int y)
125125-{
126126- gfx_buffer[pixel_height * (x/5) + y] &= ~(0x10 >> (x%5));
127127-}
128128-129129-static void flippixel(int x, int y)
130130-{
131131- gfx_buffer[pixel_height * (x/5) + y] ^= 0x10 >> (x%5);
132132-}
133133-134134-static void nopixel(int x, int y)
135135-{
136136- (void)x;
137137- (void)y;
138138-}
139139-140140-lcd_pixelfunc_type* pgfx_pixelfuncs[8] = {
141141- flippixel, nopixel, setpixel, setpixel,
142142- nopixel, clearpixel, nopixel, clearpixel
143143-};
144144-145145-static void flipblock(unsigned char *address, unsigned mask, unsigned bits)
146146-{
147147- *address ^= (bits & mask);
148148-}
149149-150150-static void bgblock(unsigned char *address, unsigned mask, unsigned bits)
151151-{
152152- *address &= (bits | ~mask);
153153-}
154154-155155-static void fgblock(unsigned char *address, unsigned mask, unsigned bits)
156156-{
157157- *address |= (bits & mask);
158158-}
159159-160160-static void solidblock(unsigned char *address, unsigned mask, unsigned bits)
161161-{
162162- unsigned data = *(char *)address;
163163-164164- bits ^= data;
165165- *address = data ^ (bits & mask);
166166-}
167167-168168-static void flipinvblock(unsigned char *address, unsigned mask, unsigned bits)
169169-{
170170- *address ^= (~bits & mask);
171171-}
172172-173173-static void bginvblock(unsigned char *address, unsigned mask, unsigned bits)
174174-{
175175- *address &= ~(bits & mask);
176176-}
177177-178178-static void fginvblock(unsigned char *address, unsigned mask, unsigned bits)
179179-{
180180- *address |= (~bits & mask);
181181-}
182182-183183-static void solidinvblock(unsigned char *address, unsigned mask, unsigned bits)
184184-{
185185- unsigned data = *(char *)address;
186186-187187- bits = ~bits ^ data;
188188- *address = data ^ (bits & mask);
189189-}
190190-191191-lcd_blockfunc_type* pgfx_blockfuncs[8] = {
192192- flipblock, bgblock, fgblock, solidblock,
193193- flipinvblock, bginvblock, fginvblock, solidinvblock
194194-};
195195-196196-/*** Drawing functions ***/
197197-198198-/* Clear the whole display */
199199-void pgfx_clear_display(void)
200200-{
201201- unsigned bits = (drawmode & DRMODE_INVERSEVID) ? 0x1F : 0;
202202-203203- rb->memset(gfx_buffer, bits, char_width * pixel_height);
204204-}
205205-206206-/* Set a single pixel */
207207-void pgfx_drawpixel(int x, int y)
208208-{
209209- if (((unsigned)x < (unsigned)pixel_width)
210210- && ((unsigned)y < (unsigned)pixel_height))
211211- pgfx_pixelfuncs[drawmode](x, y);
212212-}
213213-214214-/* Draw a line */
215215-void pgfx_drawline(int x1, int y1, int x2, int y2)
216216-{
217217- int numpixels;
218218- int i;
219219- int deltax, deltay;
220220- int d, dinc1, dinc2;
221221- int x, xinc1, xinc2;
222222- int y, yinc1, yinc2;
223223- lcd_pixelfunc_type *pfunc = pgfx_pixelfuncs[drawmode];
224224-225225- deltax = abs(x2 - x1);
226226- deltay = abs(y2 - y1);
227227- xinc2 = 1;
228228- yinc2 = 1;
229229-230230- if (deltax >= deltay)
231231- {
232232- numpixels = deltax;
233233- d = 2 * deltay - deltax;
234234- dinc1 = deltay * 2;
235235- dinc2 = (deltay - deltax) * 2;
236236- xinc1 = 1;
237237- yinc1 = 0;
238238- }
239239- else
240240- {
241241- numpixels = deltay;
242242- d = 2 * deltax - deltay;
243243- dinc1 = deltax * 2;
244244- dinc2 = (deltax - deltay) * 2;
245245- xinc1 = 0;
246246- yinc1 = 1;
247247- }
248248- numpixels++; /* include endpoints */
249249-250250- if (x1 > x2)
251251- {
252252- xinc1 = -xinc1;
253253- xinc2 = -xinc2;
254254- }
255255-256256- if (y1 > y2)
257257- {
258258- yinc1 = -yinc1;
259259- yinc2 = -yinc2;
260260- }
261261-262262- x = x1;
263263- y = y1;
264264-265265- for (i = 0; i < numpixels; i++)
266266- {
267267- if (((unsigned)x < (unsigned)pixel_width)
268268- && ((unsigned)y < (unsigned)pixel_height))
269269- pfunc(x, y);
270270-271271- if (d < 0)
272272- {
273273- d += dinc1;
274274- x += xinc1;
275275- y += yinc1;
276276- }
277277- else
278278- {
279279- d += dinc2;
280280- x += xinc2;
281281- y += yinc2;
282282- }
283283- }
284284-}
285285-286286-/* Draw a horizontal line (optimised) */
287287-void pgfx_hline(int x1, int x2, int y)
288288-{
289289- int nx;
290290- unsigned char *dst;
291291- unsigned mask, mask_right;
292292- lcd_blockfunc_type *bfunc;
293293-294294- /* direction flip */
295295- if (x2 < x1)
296296- {
297297- nx = x1;
298298- x1 = x2;
299299- x2 = nx;
300300- }
301301-302302- /* nothing to draw? */
303303- if (((unsigned)y >= (unsigned)pixel_height) || (x1 >= pixel_width)
304304- || (x2 < 0))
305305- return;
306306-307307- /* clipping */
308308- if (x1 < 0)
309309- x1 = 0;
310310- if (x2 >= pixel_width)
311311- x2 = pixel_width - 1;
312312-313313- bfunc = pgfx_blockfuncs[drawmode];
314314- dst = &gfx_buffer[pixel_height * (x1/5) + y];
315315- nx = x2 - (x1 - (x1 % 5));
316316- mask = 0x1F >> (x1 % 5);
317317- mask_right = 0x1F0 >> (nx % 5);
318318-319319- for (; nx >= 5; nx -= 5)
320320- {
321321- bfunc(dst, mask, 0xFFu);
322322- dst += pixel_height;
323323- mask = 0x1F;
324324- }
325325- mask &= mask_right;
326326- bfunc(dst, mask, 0x1F);
327327-}
328328-329329-/* Draw a vertical line (optimised) */
330330-void pgfx_vline(int x, int y1, int y2)
331331-{
332332- int y;
333333- unsigned char *dst, *dst_end;
334334- unsigned mask;
335335- lcd_blockfunc_type *bfunc;
336336-337337- /* direction flip */
338338- if (y2 < y1)
339339- {
340340- y = y1;
341341- y1 = y2;
342342- y2 = y;
343343- }
344344-345345- /* nothing to draw? */
346346- if (((unsigned)x >= (unsigned)pixel_width) || (y1 >= pixel_height)
347347- || (y2 < 0))
348348- return;
349349-350350- /* clipping */
351351- if (y1 < 0)
352352- y1 = 0;
353353- if (y2 >= pixel_height)
354354- y2 = pixel_height - 1;
355355-356356- bfunc = pgfx_blockfuncs[drawmode];
357357- dst = &gfx_buffer[pixel_height * (x/5) + y1];
358358- mask = 0x10 >> (x % 5);
359359-360360- dst_end = dst + y2 - y1;
361361- do
362362- bfunc(dst++, mask, 0x1F);
363363- while (dst <= dst_end);
364364-}
365365-366366-/* Draw a rectangular box */
367367-void pgfx_drawrect(int x, int y, int width, int height)
368368-{
369369- if ((width <= 0) || (height <= 0))
370370- return;
371371-372372- int x2 = x + width - 1;
373373- int y2 = y + height - 1;
374374-375375- pgfx_vline(x, y, y2);
376376- pgfx_vline(x2, y, y2);
377377- pgfx_hline(x, x2, y);
378378- pgfx_hline(x, x2, y2);
379379-}
380380-381381-/* Fill a rectangular area */
382382-void pgfx_fillrect(int x, int y, int width, int height)
383383-{
384384- int nx;
385385- unsigned char *dst, *dst_end;
386386- unsigned mask, mask_right;
387387- lcd_blockfunc_type *bfunc;
388388-389389- /* nothing to draw? */
390390- if ((width <= 0) || (height <= 0) || (x >= pixel_width)
391391- || (y >= pixel_height) || (x + width <= 0) || (y + height <= 0))
392392- return;
393393-394394- /* clipping */
395395- if (x < 0)
396396- {
397397- width += x;
398398- x = 0;
399399- }
400400- if (y < 0)
401401- {
402402- height += y;
403403- y = 0;
404404- }
405405- if (x + width > pixel_width)
406406- width = pixel_width - x;
407407- if (y + height > pixel_height)
408408- height = pixel_height - y;
409409-410410- bfunc = pgfx_blockfuncs[drawmode];
411411- dst = &gfx_buffer[pixel_height * (x/5) + y];
412412- nx = width - 1 + (x % 5);
413413- mask = 0x1F >> (x % 5);
414414- mask_right = 0x1F0 >> (nx % 5);
415415-416416- for (; nx >= 5; nx -= 5)
417417- {
418418- unsigned char *dst_col = dst;
419419-420420- dst_end = dst_col + height;
421421- do
422422- bfunc(dst_col++, mask, 0x1F);
423423- while (dst_col < dst_end);
424424-425425- dst += pixel_height;
426426- mask = 0x1F;
427427- }
428428- mask &= mask_right;
429429-430430- dst_end = dst + height;
431431- do
432432- bfunc(dst++, mask, 0x1F);
433433- while (dst < dst_end);
434434-}
435435-436436-/* About PlayerGFX internal bitmap format:
437437- *
438438- * A bitmap contains one bit for every pixel that defines if that pixel is
439439- * black (1) or white (0). Bits within a byte are arranged horizontally,
440440- * MSB at the left.
441441- * The bytes are stored in row-major order, with byte 0 being top left,
442442- * byte 1 2nd from left etc. Each row of bytes defines one pixel row.
443443- *
444444- * This approximates the (even more strange) internal hardware format. */
445445-446446-/* Draw a partial bitmap. stride is given in pixels */
447447-void pgfx_bitmap_part(const unsigned char *src, int src_x, int src_y,
448448- int stride, int x, int y, int width, int height)
449449-{
450450- int nx, shift;
451451- unsigned char *dst, *dst_end;
452452- unsigned mask, mask_right;
453453- lcd_blockfunc_type *bfunc;
454454-455455- /* nothing to draw? */
456456- if ((width <= 0) || (height <= 0) || (x >= pixel_width)
457457- || (y >= pixel_height) || (x + width <= 0) || (y + height <= 0))
458458- return;
459459-460460- /* clipping */
461461- if (x < 0)
462462- {
463463- width += x;
464464- src_x -= x;
465465- x = 0;
466466- }
467467- if (y < 0)
468468- {
469469- height += y;
470470- src_y -= y;
471471- y = 0;
472472- }
473473- if (x + width > pixel_width)
474474- width = pixel_width - x;
475475- if (y + height > pixel_height)
476476- height = pixel_height - y;
477477-478478- stride = (stride + 7) >> 3; /* convert to no. of bytes */
479479-480480- src += stride * src_y + (src_x >> 3); /* move starting point */
481481- dst = &gfx_buffer[pixel_height * (x/5) + y];
482482- shift = 3 + (x % 5) - (src_x & 7);
483483- nx = width - 1 + (x % 5);
484484-485485- bfunc = pgfx_blockfuncs[drawmode];
486486- mask = 0x1F >> (x % 5);
487487- mask_right = 0x1F0 >> (nx % 5);
488488-489489- dst_end = dst + height;
490490- do
491491- {
492492- const unsigned char *src_row = src;
493493- unsigned char *dst_row = dst++;
494494- unsigned mask_row = mask;
495495- unsigned data = *src_row++;
496496- int extrabits = shift;
497497-498498- for (x = nx; x >= 5; x -= 5)
499499- {
500500- if (extrabits < 0)
501501- {
502502- data = (data << 8) | *src_row++;
503503- extrabits += 8;
504504- }
505505- bfunc(dst_row, mask_row, data >> extrabits);
506506- extrabits -= 5;
507507- dst_row += pixel_height;
508508- mask_row = 0x1F;
509509- }
510510- if (extrabits < 0)
511511- {
512512- data = (data << 8) | *src_row;
513513- extrabits += 8;
514514- }
515515- bfunc(dst_row, mask_row & mask_right, data >> extrabits);
516516-517517- src += stride;
518518- }
519519- while (dst < dst_end);
520520-}
521521-522522-/* Draw a full bitmap */
523523-void pgfx_bitmap(const unsigned char *src, int x, int y, int width, int height)
524524-{
525525- pgfx_bitmap_part(src, 0, 0, width, x, y, width, height);
526526-}
-55
apps/plugins/lib/playergfx.h
···11-/***************************************************************************
22-* __________ __ ___.
33-* Open \______ \ ____ ____ | | _\_ |__ _______ ___
44-* Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
55-* Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
66-* Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
77-* \/ \/ \/ \/ \/
88-* $Id$
99-*
1010-* Bitmap graphics on player LCD!
1111-*
1212-* Copyright (C) 2005 Jens Arnold
1313-*
1414-* This program is free software; you can redistribute it and/or
1515-* modify it under the terms of the GNU General Public License
1616-* as published by the Free Software Foundation; either version 2
1717-* of the License, or (at your option) any later version.
1818-*
1919-* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
2020-* KIND, either express or implied.
2121-*
2222-****************************************************************************/
2323-2424-#ifndef __PGFX_H__
2525-#define __PGFX_H__
2626-2727-#include "plugin.h"
2828-2929-#ifdef HAVE_LCD_CHARCELLS /* Player only :) */
3030-3131-bool pgfx_init(int cwidth, int cheight);
3232-void pgfx_release(void);
3333-void pgfx_display(int cx, int cy);
3434-void pgfx_display_block(int cx, int cy, int x, int y);
3535-void pgfx_update(void);
3636-3737-void pgfx_set_drawmode(int mode);
3838-int pgfx_get_drawmode(void);
3939-4040-void pgfx_clear_display(void);
4141-void pgfx_drawpixel(int x, int y);
4242-void pgfx_drawline(int x1, int y1, int x2, int y2);
4343-void pgfx_hline(int x1, int x2, int y);
4444-void pgfx_vline(int x, int y1, int y2);
4545-void pgfx_drawrect(int x, int y, int width, int height);
4646-void pgfx_fillrect(int x, int y, int width, int height);
4747-void pgfx_bitmap_part(const unsigned char *src, int src_x, int src_y,
4848- int stride, int x, int y, int width, int height);
4949-void pgfx_bitmap(const unsigned char *src, int x, int y, int width, int height);
5050-5151-#define pgfx_mono_bitmap_part pgfx_bitmap_part
5252-#define pgfx_mono_bitmap pgfx_bitmap
5353-5454-#endif /* HAVE_LCD_CHARCELLS */
5555-#endif /* __PGFX_H__ */
-5
apps/plugins/lib/simple_viewer.c
···6464 total = 0;
6565 while(*ptr)
6666 {
6767-#ifdef HAVE_LCD_CHARCELLS
6868- n = rb->utf8seek(ptr, 1);
6969- w = 1;
7070-#else
7167 unsigned short ch;
7268 n = ((intptr_t)rb->utf8decode(ptr, &ch) - (intptr_t)ptr);
7369 if (rb->is_diacritic(ch, NULL))
7470 w = 0;
7571 else
7672 w = rb->font_get_width(info->pf, ch);
7777-#endif
7873 if (isbrchr(ptr, n))
7974 space = ptr+(isspace(*ptr) || total + w <= info->vp.width? n: 0);
8075 if (*ptr == '\n')
-17
apps/plugins/logo.c
···1919 *
2020 **************************************************************************/
2121#include "plugin.h"
2222-#include "lib/playergfx.h"
2322#include "lib/pluginlib_actions.h"
24232524/* this set the context to use with PLA */
···8180 int y = (DISPLAY_HEIGHT / 2) - (LOGO_HEIGHT / 2);
8281 int dx;
8382 int dy;
8484-#ifdef HAVE_LCD_CHARCELLS
8585- int cpos = -1;
8686- int old_cpos = -1;
8787-#endif
88838984 (void)parameter;
90859191-#ifdef HAVE_LCD_CHARCELLS
9292- if (!pgfx_init(4, 2)) {
9393- rb->splash(HZ*2, "Old LCD :(");
9494- return PLUGIN_OK;
9595- }
9696-#endif
9786 rb->srand(*rb->current_tick);
9887 dx = rb->rand()%(2*RAND_SCALE+1) - RAND_SCALE;
9988 dy = rb->rand()%(2*RAND_SCALE+1) - RAND_SCALE;
···159148 switch (button) {
160149 case LP_QUIT:
161150 case LP_QUIT2:
162162-#ifdef HAVE_LCD_CHARCELLS
163163- pgfx_release();
164164-#endif
165151 return PLUGIN_OK;
166152 case LP_DEC_X:
167153 case LP_DEC_X_REPEAT:
···184170185171 default:
186172 if (rb->default_event_handler(button) == SYS_USB_CONNECTED) {
187187-#ifdef HAVE_LCD_CHARCELLS
188188- pgfx_release();
189189-#endif
190173 return PLUGIN_USB_CONNECTED;
191174 }
192175 break;
-53
apps/plugins/lrcplayer.c
···144144145145#include "lib/pluginlib_actions.h"
146146#define LST_SET_TIME (LST_SET_MSEC|LST_SET_SEC|LST_SET_MIN|LST_SET_HOUR)
147147-#ifdef HAVE_LCD_CHARCELLS
148148-#define LST_OFF_Y 0
149149-#else /* HAVE_LCD_BITMAP */
150147#define LST_OFF_Y 1
151151-#endif
152148static int lrc_set_time(const char *title, const char *unit, long *pval,
153149 int step, int min, int max, int flags)
154150{
···229225 rb->lcd_set_drawmode(DRMODE_SOLID|DRMODE_INVERSEVID);
230226 rb->lcd_putsxy(x, y*(1+LST_OFF_Y), &buffer[p_start]);
231227 rb->lcd_set_drawmode(DRMODE_SOLID);
232232-#else
233233- rb->lcd_put_cursor(x+rb->utf8length(&buffer[p_start])-1, y, 0x7F);
234228#endif
235229 }
236230 rb->lcd_update();
237231 int button = pluginlib_getaction(TIMEOUT_BLOCK, lst_contexts, ARRAYLEN(lst_contexts));
238232 int mult = 1;
239239-#ifdef HAVE_LCD_CHARCELLS
240240- if (pos_min != pos_max)
241241- rb->lcd_remove_cursor();
242242-#endif
243233 switch (button)
244234 {
245235 case PLA_UP_REPEAT:
···452442 int word_count, word_width;
453443 const unsigned char *str;
454444 }
455455-#ifndef HAVE_LCD_CHARCELLS
456445 sp,
457457-#endif
458446 cr;
459447460448 lrc_buffer_used = (lrc_buffer_used+3)&~3; /* 4 bytes aligned */
···514502 cr.nword = lrc_line->nword;
515503 lrc_word = lrc_line->words+cr.nword;
516504 cr.str = (lrc_word-1)->word;
517517-#ifndef HAVE_LCD_CHARCELLS
518505 sp.word_count = 0;
519506 sp.word_width = 0;
520507 sp.nword = 0;
521508 sp.count = 0;
522509 sp.width = 0;
523523-#endif
524510 do {
525511 cr.count = 0;
526512 cr.width = 0;
527527-#ifndef HAVE_LCD_CHARCELLS
528513 sp.str = NULL;
529529-#endif
530514531515 while (1)
532516 {
···541525 break;
542526543527 int c, w;
544544-#ifdef HAVE_LCD_CHARCELLS
545545- c = rb->utf8seek(cr.str, 1);
546546- w = 1;
547547-#else
548528 c = ((intptr_t)rb->utf8decode(cr.str, &ch) - (intptr_t)cr.str);
549529 if (rb->is_diacritic(ch, NULL))
550530 w = 0;
···576556 }
577557 break;
578558 }
579579-#endif
580559 cr.count += c;
581560 cr.width += w;
582561 lrc_word->count += c;
···19161895 }
19171896 if (!lrc_line && ypos < vp_lyrics[i].height)
19181897 display->putsxy(0, ypos, "[end]");
19191919-#else /* HAVE_LCD_CHARCELLS */
19201920- struct lrc_line *lrc_line = lrc_center;
19211921- struct lrc_brpos *lrc_brpos = calc_brpos(lrc_line, i);
19221922- long elapsed = 0;
19231923- const char *str = get_lrc_str(lrc_line);
19241924- int x = vp_lyrics[i].width/2, y = 0;
19251925-19261926- if (rin >= 0 && len > 0)
19271927- {
19281928- elapsed = rin * lrc_center->width / len;
19291929- while (elapsed > lrc_brpos->width)
19301930- {
19311931- elapsed -= lrc_brpos->width;
19321932- str = lrc_skip_space(str+lrc_brpos->count);
19331933- lrc_brpos++;
19341934- }
19351935- }
19361936- rb->strlcpy(temp_buf, str, lrc_brpos->count+1);
19371937-19381938- x -= elapsed;
19391939- if (x < 0)
19401940- display->puts(0, y, temp_buf + rb->utf8seek(temp_buf, -x));
19411941- else
19421942- display->puts(x, y, temp_buf);
19431943- x += rb->utf8length(temp_buf)+1;
19441944- lrc_line = lrc_line->next;
19451945- if (!lrc_line && x < vp_lyrics[i].width)
19461946- {
19471947- if (x < vp_lyrics[i].width/2)
19481948- x = vp_lyrics[i].width/2;
19491949- display->puts(x, y, "[end]");
19501950- }
19511898#endif /* HAVE_LCD_BITMAP */
19521899 display->update_viewport();
19531900 display->set_viewport(NULL);
···37373838#define FOR_NB_SCREENS(i) for(int i = 0; i < NB_SCREENS; i++)
39394040-#ifdef HAVE_LCD_CHARCELLS
4141-#define MAX_LINES_ON_SCREEN 2
4242-#endif
4343-4440typedef void screen_bitmap_part_func(const void *src, int src_x, int src_y,
4541 int stride, int x, int y, int width, int height);
4642typedef void screen_bitmap_func(const void *src, int x, int y, int width,
···110106 void (*hline)(int x1, int x2, int y);
111107#endif /* HAVE_LCD_BITMAP || HAVE_REMOTE_LCD */
112108113113-#ifdef HAVE_LCD_CHARCELLS /* no charcell remote LCDs so far */
114114- void (*double_height)(bool on);
115115- /* name it putchar, not putc because putc is a c library function */
116116- void (*putchar)(int x, int y, unsigned long ucs);
117117- void (*icon)(int icon, bool enable);
118118- unsigned long (*get_locked_pattern)(void);
119119- void (*define_pattern)(unsigned long ucs, const char *pattern);
120120- void (*unlock_pattern)(unsigned long ucs);
121121-#endif
122109 void (*putsxy)(int x, int y, const unsigned char *str);
123110 void (*puts)(int x, int y, const unsigned char *str);
124111 void (*putsf)(int x, int y, const unsigned char *str, ...);
···11-/***************************************************************************
22- * __________ __ ___.
33- * Open \______ \ ____ ____ | | _\_ |__ _______ ___
44- * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
55- * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
66- * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
77- * \/ \/ \/ \/ \/
88- * $Id$
99- *
1010- * Copyright (C) 2006 Dan Everton
1111- *
1212- * This program is free software; you can redistribute it and/or
1313- * modify it under the terms of the GNU General Public License
1414- * as published by the Free Software Foundation; either version 2
1515- * of the License, or (at your option) any later version.
1616- *
1717- * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
1818- * KIND, either express or implied.
1919- *
2020- ****************************************************************************/
2121-2222-#include <string.h>
2323-#include <unistd.h>
2424-#include <fcntl.h>
2525-#include "system.h"
2626-#include "debug.h"
2727-#include "lcd.h"
2828-#include "lcd-charcell.h"
2929-#include "screendump.h"
3030-#include "general.h"
3131-3232-#include "lcd-playersim.h"
3333-#include "sim-ui-defines.h"
3434-#include "lcd-sdl.h"
3535-3636-/* can't include file.h here */
3737-#ifndef MAX_PATH
3838-#define MAX_PATH 260
3939-#endif
4040-4141-/* extern functions, needed for screendump() */
4242-extern int sim_creat(const char *name, mode_t mode);
4343-4444-SDL_Surface* lcd_surface;
4545-4646-SDL_Color lcd_bl_color_dark = {RED_CMP(LCD_BL_DARKCOLOR),
4747- GREEN_CMP(LCD_BL_DARKCOLOR),
4848- BLUE_CMP(LCD_BL_DARKCOLOR), 0};
4949-SDL_Color lcd_bl_color_bright = {RED_CMP(LCD_BL_BRIGHTCOLOR),
5050- GREEN_CMP(LCD_BL_BRIGHTCOLOR),
5151- BLUE_CMP(LCD_BL_BRIGHTCOLOR), 0};
5252-SDL_Color lcd_color_dark = {RED_CMP(LCD_DARKCOLOR),
5353- GREEN_CMP(LCD_DARKCOLOR),
5454- BLUE_CMP(LCD_DARKCOLOR), 0};
5555-SDL_Color lcd_color_bright = {RED_CMP(LCD_BRIGHTCOLOR),
5656- GREEN_CMP(LCD_BRIGHTCOLOR),
5757- BLUE_CMP(LCD_BRIGHTCOLOR), 0};
5858-5959-6060-static unsigned long get_lcd_pixel(int x, int y)
6161-{
6262- return sim_lcd_framebuffer[y][x];
6363-}
6464-6565-void sim_lcd_update_rect(int x_start, int y_start, int width, int height)
6666-{
6767- sdl_update_rect(lcd_surface, x_start, y_start, width, height,
6868- SIM_LCD_WIDTH, SIM_LCD_HEIGHT, get_lcd_pixel);
6969- sdl_gui_update(lcd_surface, x_start, y_start, width, height,
7070- SIM_LCD_WIDTH, SIM_LCD_HEIGHT,
7171- background ? UI_LCD_POSX : 0, background ? UI_LCD_POSY : 0);
7272-}
7373-7474-void lcd_update(void)
7575-{
7676- int x, y;
7777-7878- for (y = 0; y < lcd_pattern_count; y++)
7979- if (lcd_patterns[y].count > 0)
8080- sim_lcd_define_pattern(y, lcd_patterns[y].pattern);
8181-8282- for (y = 0; y < LCD_HEIGHT; y++)
8383- for (x = 0; x < LCD_WIDTH; x++)
8484- lcd_print_char(x, y, lcd_charbuffer[y][x]);
8585-8686- if (lcd_cursor.visible)
8787- lcd_print_char(lcd_cursor.x, lcd_cursor.y, lcd_cursor.hw_char);
8888-8989- sim_lcd_update_rect(0, ICON_HEIGHT, SIM_LCD_WIDTH,
9090- LCD_HEIGHT*CHAR_HEIGHT*CHAR_PIXEL);
9191-}
9292-9393-#ifdef HAVE_BACKLIGHT
9494-void sim_backlight(int value)
9595-{
9696- if (value > 0) {
9797- sdl_set_gradient(lcd_surface, &lcd_bl_color_bright,
9898- &lcd_bl_color_dark, 0, (1<<LCD_DEPTH));
9999- } else {
100100- sdl_set_gradient(lcd_surface, &lcd_color_bright,
101101- &lcd_color_dark, 0, (1<<LCD_DEPTH));
102102- }
103103-104104- sim_lcd_update_rect(0, 0, SIM_LCD_WIDTH, SIM_LCD_HEIGHT);
105105-}
106106-#endif
107107-108108-/* initialise simulator lcd driver */
109109-void lcd_init_device(void)
110110-{
111111- lcd_surface = SDL_CreateRGBSurface(SDL_SWSURFACE,
112112- SIM_LCD_WIDTH * display_zoom,
113113- SIM_LCD_HEIGHT * display_zoom,
114114- 8, 0, 0, 0, 0);
115115-116116- sdl_set_gradient(lcd_surface, &lcd_bl_color_bright,
117117- &lcd_bl_color_dark, 0, (1<<LCD_DEPTH));
118118-}
119119-120120-#define BMP_COMPRESSION 0 /* BI_RGB */
121121-#define BMP_NUMCOLORS (1 << LCD_DEPTH)
122122-#define BMP_BPP 1
123123-#define BMP_LINESIZE (((SIM_LCD_WIDTH + 31) / 32) * 4)
124124-125125-#define BMP_HEADERSIZE (54 + 4 * BMP_NUMCOLORS)
126126-#define BMP_DATASIZE (BMP_LINESIZE * SIM_LCD_HEIGHT)
127127-#define BMP_TOTALSIZE (BMP_HEADERSIZE + BMP_DATASIZE)
128128-129129-#define LE16_CONST(x) (x)&0xff, ((x)>>8)&0xff
130130-#define LE32_CONST(x) (x)&0xff, ((x)>>8)&0xff, ((x)>>16)&0xff, ((x)>>24)&0xff
131131-132132-static const unsigned char bmpheader[] =
133133-{
134134- 0x42, 0x4d, /* 'BM' */
135135- LE32_CONST(BMP_TOTALSIZE), /* Total file size */
136136- 0x00, 0x00, 0x00, 0x00, /* Reserved */
137137- LE32_CONST(BMP_HEADERSIZE), /* Offset to start of pixel data */
138138-139139- 0x28, 0x00, 0x00, 0x00, /* Size of (2nd) header */
140140- LE32_CONST(SIM_LCD_WIDTH), /* Width in pixels */
141141- LE32_CONST(SIM_LCD_HEIGHT), /* Height in pixels */
142142- 0x01, 0x00, /* Number of planes (always 1) */
143143- LE16_CONST(BMP_BPP), /* Bits per pixel 1/4/8/16/24 */
144144- LE32_CONST(BMP_COMPRESSION),/* Compression mode */
145145- LE32_CONST(BMP_DATASIZE), /* Size of bitmap data */
146146- 0xc4, 0x0e, 0x00, 0x00, /* Horizontal resolution (pixels/meter) */
147147- 0xc4, 0x0e, 0x00, 0x00, /* Vertical resolution (pixels/meter) */
148148- LE32_CONST(BMP_NUMCOLORS), /* Number of used colours */
149149- LE32_CONST(BMP_NUMCOLORS), /* Number of important colours */
150150-151151- BMP_COLOR(LCD_BL_BRIGHTCOLOR),
152152- BMP_COLOR(LCD_BL_DARKCOLOR)
153153-};
154154-155155-void screen_dump(void)
156156-{
157157- int fd;
158158- char filename[MAX_PATH];
159159- int x, y;
160160- static unsigned char line[BMP_LINESIZE];
161161-162162- create_numbered_filename(filename, "", "dump_", ".bmp", 4
163163- IF_CNFN_NUM_(, NULL));
164164- DEBUGF("screen_dump\n");
165165-166166- fd = sim_creat(filename, 0666);
167167- if (fd < 0)
168168- return;
169169-170170- if(write(fd, bmpheader, sizeof(bmpheader)) != sizeof(bmpheader))
171171- {
172172- close(fd);
173173- return;
174174- }
175175- SDL_LockSurface(lcd_surface);
176176-177177- /* BMP image goes bottom up */
178178- for (y = SIM_LCD_HEIGHT - 1; y >= 0; y--)
179179- {
180180- Uint8 *src = (Uint8 *)lcd_surface->pixels
181181- + y * SIM_LCD_WIDTH * (int)display_zoom * (int)display_zoom;
182182- unsigned char *dst = line;
183183- unsigned dst_mask = 0x80;
184184-185185- memset(line, 0, sizeof(line));
186186- for (x = SIM_LCD_WIDTH; x > 0; x--)
187187- {
188188- if (*src)
189189- *dst |= dst_mask;
190190- src += (int)display_zoom;
191191- dst_mask >>= 1;
192192- if (dst_mask == 0)
193193- {
194194- dst++;
195195- dst_mask = 0x80;
196196- }
197197- }
198198- if(write(fd, line, sizeof(line)) != sizeof(line))
199199- {
200200- close(fd);
201201- return;
202202- }
203203- }
204204- SDL_UnlockSurface(lcd_surface);
205205- close(fd);
206206-}
-34
firmware/target/hosted/sdl/lcd-charcells.h
···11-/***************************************************************************
22- * __________ __ ___.
33- * Open \______ \ ____ ____ | | _\_ |__ _______ ___
44- * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
55- * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
66- * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
77- * \/ \/ \/ \/ \/
88- * $Id$
99- *
1010- * Copyright (C) 2006 Dan Everton
1111- *
1212- * This program is free software; you can redistribute it and/or
1313- * modify it under the terms of the GNU General Public License
1414- * as published by the Free Software Foundation; either version 2
1515- * of the License, or (at your option) any later version.
1616- *
1717- * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
1818- * KIND, either express or implied.
1919- *
2020- ****************************************************************************/
2121-2222-#ifndef __LCDCHARCELL_H__
2323-#define __LCDCHARCELL_H__
2424-2525-#include "lcd.h"
2626-#include "SDL.h"
2727-2828-#ifdef HAVE_LCD_CHARCELLS
2929-void sim_lcd_init(void);
3030-void screen_dump(void);
3131-#endif
3232-3333-#endif /* #ifndef __LCDCHARCELL_H__ */
3434-
···168168 the \fname{/.rockbox/backdrops} directory.
169169}%
170170171171-\nopt{lcd_charcell}{
172172- \subsection{UI Viewport}
173173- By default, the UI is drawn on the whole screen. This can be changed so that
174174- the UI is confined to a specific area of the screen, by use of a UI
175175- viewport. This is done by adding the following line to the
176176- \fname{.cfg} file for a theme:\\*
171171+\subsection{UI Viewport}
172172+By default, the UI is drawn on the whole screen. This can be changed so that
173173+the UI is confined to a specific area of the screen, by use of a UI
174174+viewport. This is done by adding the following line to the
175175+\fname{.cfg} file for a theme:\\*
177176178178- \nopt{lcd_non-mono}{\config{ui viewport: X,Y,[width],[height],[font]}}
179179- \nopt{lcd_color}{\opt{lcd_non-mono}{
180180- \config{ui viewport: X,Y,[width],[height],[font],[fgshade],[bgshade]}}}
181181- \opt{lcd_color}{
182182- \config{ui viewport: X,Y,[width],[height],[font],[fgcolour],[bgcolour]}}
183183- \\*
177177+\nopt{lcd_non-mono}{\config{ui viewport: X,Y,[width],[height],[font]}}
178178+\nopt{lcd_color}{\opt{lcd_non-mono}{
179179+ \config{ui viewport: X,Y,[width],[height],[font],[fgshade],[bgshade]}}}
180180+\opt{lcd_color}{
181181+ \config{ui viewport: X,Y,[width],[height],[font],[fgcolour],[bgcolour]}}
182182+\\*
184183185185- \opt{HAVE_REMOTE_LCD}{
186186- The dimensions of the menu that is displayed on the remote control of your
187187- \dap\ can be set in the same way. The line to be added to the theme
188188- \fname{.cfg} is the following:\\*
184184+\opt{HAVE_REMOTE_LCD}{
185185+ The dimensions of the menu that is displayed on the remote control of your
186186+ \dap\ can be set in the same way. The line to be added to the theme
187187+ \fname{.cfg} is the following:\\*
189188190190- \nopt{lcd_non-mono}{\config{remote ui viewport: X,Y,[width],[height],[font]}}
191191- \nopt{lcd_color}{\opt{lcd_non-mono}{
192192- \config{remote ui viewport: X,Y,[width],[height],[font],[fgshade],[bgshade]}}}
193193- \opt{lcd_color}{
194194- \config{remote ui viewport: X,Y,[width],[height],[font],[fgcolour],[bgcolour]}}
195195- \\*
196196- }
189189+ \nopt{lcd_non-mono}{\config{remote ui viewport: X,Y,[width],[height],[font]}}
190190+ \nopt{lcd_color}{\opt{lcd_non-mono}{
191191+ \config{remote ui viewport: X,Y,[width],[height],[font],[fgshade],[bgshade]}}}
192192+ \opt{lcd_color}{
193193+ \config{remote ui viewport: X,Y,[width],[height],[font],[fgcolour],[bgcolour]}}
194194+\\*
197195198196 Only the first two parameters \emph{have} to be specified, the others can
199197 be omitted using `$-$' as a placeholder. The syntax is very similar to WPS
···202200 \nopt{lcd_non-mono}{\input{advanced_topics/viewports/mono-uivp-syntax.tex}}
203201 \nopt{lcd_color}{\opt{lcd_non-mono}{\input{advanced_topics/viewports/grayscale-uivp-syntax.tex}}}
204202 \opt{lcd_color}{\input{advanced_topics/viewports/colour-uivp-syntax.tex}}
205205-}
206203207204\section{\label{ref:ConfiguringtheWPS}Configuring the Theme}
208205···265262 }
266263}
267264268268-\nopt{lcd_charcell}{
269265\subsubsection{\label{ref:Viewports}Viewports}
270266271267By default, a viewport filling the whole screen contains all the elements
···279275\opt{lcd_non-mono}{ with its own foreground/background
280276\opt{lcd_color}{colours}\nopt{lcd_color}{shades}}.
281277This window also has variable dimensions. To
282282-define a viewport a line starting \config{{\%V(\dots}} has to be
278278+define a viewport a line starting \config{{\%V(\dots)}} has to be
283279present in the theme file. The full syntax will be explained later in
284280this section. All elements placed before the
285281line defining a viewport are displayed in the default viewport. Elements
···292288cannot be layered \emph{transparently} over one another. Subsequent viewports
293289will be drawn over any other viewports already drawn onto that
294290area of the screen.
291291+295292296293\nopt{lcd_non-mono}{\input{advanced_topics/viewports/mono-vp-syntax.tex}}
297294\nopt{lcd_color}{\opt{lcd_non-mono}{\input{advanced_topics/viewports/grayscale-vp-syntax.tex}}}
···318315 the end colour\\}
319316\end{rbtabular}
320317}
321321-322318\subsubsection{Conditional Viewports}
323319324320Any viewport can be displayed either permanently or conditionally.
325325-Defining a viewport as \config{{\%V(\dots}}
321321+Defining a viewport as \config{{\%V(\dots)}}
326322will display it permanently.
327323328324\begin{itemize}
+41-44
manual/appendix/wps_tags.tex
···5353These tags, when written with a capital ``I'' (e.g. \config{\%Ia} or \config{\%Ic}),
5454show the information for the next song to be played.
55555656-\nopt{lcd_charcell}{
5757- \section{Viewports}
5858- \begin{tagmap}
5959- \nopt{lcd_non-mono}{%
6060- \config{\%V(x,y,[width],\tabnlindent[height],[font])}
6161- & See section \ref{ref:Viewports}\\}
5656+\section{Viewports}
5757+ \begin{tagmap}
5858+ \nopt{lcd_non-mono}{%
5959+ \config{\%V(x,y,[width],\tabnlindent[height],[font])}
6060+ & See section \ref{ref:Viewports}\\}
62616363- \nopt{lcd_color}{\opt{lcd_non-mono}{%
6464- \config{\%V(x,y,[width],\tabnlindent[height],[font])}\newline
6565- \config{\%Vf([fgshade])}\newline
6666- \config{\%Vb([bgshade])}
6767- & See section \ref{ref:Viewports}\\}}
6262+ \nopt{lcd_color}{\opt{lcd_non-mono}{%
6363+ \config{\%V(x,y,[width],\tabnlindent[height],[font])}\newline
6464+ \config{\%Vf([fgshade])}\newline
6565+ \config{\%Vb([bgshade])}
6666+ & See section \ref{ref:Viewports}\\}}
68676969- \opt{lcd_color}{%
7070- \config{\%V(x,y,[width],\tabnlindent[height],[font])}\newline
7171- \config{\%Vf([fgcolour])}\newline
7272- \config{\%Vb([bgcolour])}\newline
7373- \config{\%Vg(start,end \tabnlindent[,text])}
7474- & See section \ref{ref:Viewports}\\}
6868+ \opt{lcd_color}{%
6969+ \config{\%V(x,y,[width],\tabnlindent[height],[font])}\newline
7070+ \config{\%Vf([fgcolour])}\newline
7171+ \config{\%Vb([bgcolour])}\newline
7272+ \config{\%Vg(start,end \tabnlindent[,text])}
7373+ & See section \ref{ref:Viewports}\\}
75747676- \opt{lcd_non-mono}{%
7777- \config{\%Vs(mode[,param])}
7878- & See section \ref{ref:Viewports}\\}
7979-8080- \config{\%Vl('identifier',\newline\dots)} & Preloads a viewport for later
7575+ \opt{lcd_non-mono}{%
7676+ \config{\%Vs(mode[,param])}
7777+ & See section \ref{ref:Viewports}\\}
7878+ \config{\%Vl('identifier',\newline\dots)} & Preloads a viewport for later
8179 display. `identifier' is a single lowercase letter (a-z) and the `\dots'
8280 parameters use the same logic as the \%V tag explained above.\\
83818484- \config{\%Vd('identifier')} & Display the `identifier' viewport. E.g.
8585- \config{\%?C<\%Vd(a)|\%Vd(b)>}
8686- will show viewport `a' if album art is found, and `b' if it isn't.\\
8282+ \config{\%Vd('identifier')} & Display the `identifier' viewport. E.g.
8383+ \config{\%?C<\%Vd(a)|\%Vd(b)>}
8484+ will show viewport `a' if album art is found, and `b' if it isn't.\\
87858888- \config{\%Vi('label',\dots)} &
8989- Declare a Custom UI Viewport. The `\dots' parameters use the same logic as
9090- the \config{\%V} tag explained above. See section \ref{ref:Viewports}.\\
8686+ \config{\%Vi('label',\dots)} &
8787+ Declare a Custom UI Viewport. The `\dots' parameters use the same logic as
8888+ the \config{\%V} tag explained above. See section \ref{ref:Viewports}.\\
91899292- \config{\%VI('label')} & Set the Info Viewport to use the viewport called
9393- label, as declared with the previous tag.\\
9090+ \config{\%VI('label')} & Set the Info Viewport to use the viewport called
9191+ label, as declared with the previous tag.\\
94929595- \config{\%VB} & Draw this viewport on the backdrop layer.\\
9696- \end{tagmap}
9393+ \config{\%VB} & Draw this viewport on the backdrop layer.\\
9494+ \end{tagmap}
97959898- \section{Additional Fonts}
9999- \begin{tagmap}
100100- \config{\%Fl('id',filename)} & See section \ref{ref:multifont}.\\
101101- \end{tagmap}
9696+\section{Additional Fonts}
9797+ \begin{tagmap}
9898+ \config{\%Fl('id',filename)} & See section \ref{ref:multifont}.\\
9999+ \end{tagmap}
102100103103- \section{Misc Coloring Tags}
104104- \begin{tagmap}
105105- \config{\%dr(x,y,width,height,[color1,color2])} & Color a rectangle. \\
106106- \end{tagmap}
107107- width and height can be ``$-$'' to fill the viewport. If no color is
108108- specified the viewports foreground color will be used. If two
109109- colors are specified it will do a gradient fill.
110110-}
101101+\section{Misc Coloring Tags}
102102+ \begin{tagmap}
103103+ \config{\%dr(x,y,width,height,[color1,color2])} & Color a rectangle. \\
104104+ \end{tagmap}
105105+ width and height can be ``$-$'' to fill the viewport. If no color is
106106+ specified the viewports foreground color will be used. If two
107107+ colors are specified it will do a gradient fill.
111108112109\section{Power Related Information}
113110 \begin{tagmap}
-2
manual/plugins/text_viewer.tex
···196196\item[Viewer Options] Change settings for the current file.
197197 \begin{description}
198198 \item[Encoding] Set the codepage in the text viewer.
199199-% ToDo: wrap some of the following settings into a \opt{lcd_bitmap} to exlude
200200-% ones that don't work on charcell - as soon as the plugin itself does
201199 Available settings:
202200 \setting{ISO-8859-1} (Latin 1).
203201 \setting{ISO-8859-7} (Greek),
···11-/***************************************************************************
22- * __________ __ ___.
33- * Open \______ \ ____ ____ | | _\_ |__ _______ ___
44- * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
55- * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
66- * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
77- * \/ \/ \/ \/ \/
88- * $Id$
99- *
1010- * This program is free software; you can redistribute it and/or
1111- * modify it under the terms of the GNU General Public License
1212- * as published by the Free Software Foundation; either version 2
1313- * of the License, or (at your option) any later version.
1414- *
1515- * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
1616- * KIND, either express or implied.
1717- *
1818- ****************************************************************************/
1919-2020-#ifndef __FONT_PLAYER_H__
2121-#define __FONT_PLAYER_H__
2222-2323-extern unsigned char (*font_player)[256][7];
2424-2525-void font_init(void);
2626-2727-#endif /* __FONT_PLAYER_H__ */
+1-1
uisimulator/common/lcd-common.c
···2727#include "system.h"
2828#include "lcd.h"
2929#if defined(HAVE_TRANSFLECTIVE_LCD) && defined(HAVE_LCD_SLEEP)
3030-/* in uisimulator/sdl/lcd-bitmap.c and lcd-charcell.c */
3030+/* in uisimulator/sdl/lcd-bitmap.c */
3131extern void sim_backlight(int value);
3232#endif
3333
-119
uisimulator/common/lcd-playersim.c
···11-/***************************************************************************
22- * __________ __ ___.
33- * Open \______ \ ____ ____ | | _\_ |__ _______ ___
44- * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
55- * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
66- * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
77- * \/ \/ \/ \/ \/
88- * $Id$
99- *
1010- * Copyright (C) 2002 by Alan Korr
1111- *
1212- * This program is free software; you can redistribute it and/or
1313- * modify it under the terms of the GNU General Public License
1414- * as published by the Free Software Foundation; either version 2
1515- * of the License, or (at your option) any later version.
1616- *
1717- * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
1818- * KIND, either express or implied.
1919- *
2020- ****************************************************************************/
2121-#include "config.h"
2222-#include "hwcompat.h"
2323-2424-#include "lcd.h"
2525-#include "lcd-charcell.h"
2626-#include "kernel.h"
2727-#include "thread.h"
2828-#include <string.h>
2929-#include <stdlib.h>
3030-#include "debug.h"
3131-#include "system.h"
3232-3333-#include "font-player.h"
3434-#include "lcd-playersim.h"
3535-3636-/*** definitions ***/
3737-3838-bool sim_lcd_framebuffer[SIM_LCD_HEIGHT][SIM_LCD_WIDTH];
3939-4040-static int double_height = 1;
4141-4242-void lcd_print_icon(int x, int icon_line, bool enable, char **icon)
4343-{
4444- int row = 0, col = 0; /* shut up gcc */
4545- int y = (ICON_HEIGHT+(CHAR_HEIGHT*2+2)*CHAR_PIXEL) * icon_line;
4646-4747- y += BORDER_MARGIN;
4848- x += BORDER_MARGIN;
4949-5050- for (; icon[row]; row++)
5151- {
5252- for (col = 0; icon[row][col]; col++)
5353- {
5454- switch (icon[row][col])
5555- {
5656- case '*':
5757- sim_lcd_framebuffer[y+row][x+col] = enable;
5858- break;
5959-6060- case ' ':
6161- sim_lcd_framebuffer[y+row][x+col] = false;
6262- break;
6363- }
6464- }
6565- }
6666- sim_lcd_update_rect(x, y, col, row);
6767- /* icon drawing updates immediately */
6868-}
6969-7070-void lcd_print_char(int x, int y, unsigned char ch)
7171-{
7272- int xpos = x * CHAR_WIDTH*CHAR_PIXEL;
7373- int ypos = y * CHAR_HEIGHT*CHAR_PIXEL + ICON_HEIGHT;
7474- int row, col, r, c;
7575-7676- if (double_height > 1 && y == 1)
7777- return; /* only one row available if text is double height */
7878-7979- for (row = 0; row < 7; row ++)
8080- {
8181- unsigned fontbitmap = (*font_player)[ch][row];
8282- int height = (row == 3) ? 1 : double_height;
8383-8484- y = ypos + row * CHAR_PIXEL * double_height;
8585- for (col = 0; col < 5; col++)
8686- {
8787- bool fontbit = fontbitmap & (0x10 >> col);
8888-8989- x = xpos + col * CHAR_PIXEL;
9090- for (r = 0; r < height * CHAR_PIXEL; r++)
9191- for (c = 0; c < CHAR_PIXEL; c++)
9292- sim_lcd_framebuffer[y+r][x+c] = fontbit;
9393- }
9494- }
9595- if (double_height > 1)
9696- {
9797- y = ypos + 15*CHAR_PIXEL;
9898- for (r = 0; r < CHAR_PIXEL; r++)
9999- for (c = 0; c < 5*CHAR_PIXEL; c++)
100100- sim_lcd_framebuffer[y+r][xpos+c] = false;
101101- }
102102-}
103103-104104-void lcd_double_height(bool on)
105105-{
106106- int newval = (is_new_player() && on) ? 2 : 1;
107107-108108- if (newval != double_height)
109109- {
110110- double_height = newval;
111111- lcd_update();
112112- }
113113-}
114114-115115-void sim_lcd_define_pattern(int pat, const char *pattern)
116116-{
117117- if (pat < lcd_pattern_count)
118118- memcpy((*font_player)[pat], pattern, 7);
119119-}
-38
uisimulator/common/lcd-playersim.h
···11-/***************************************************************************
22- * __________ __ ___.
33- * Open \______ \ ____ ____ | | _\_ |__ _______ ___
44- * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
55- * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
66- * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
77- * \/ \/ \/ \/ \/
88- * $Id$
99- *
1010- * Copyright (C) 2002 by Kjell Ericson
1111- *
1212- * This program is free software; you can redistribute it and/or
1313- * modify it under the terms of the GNU General Public License
1414- * as published by the Free Software Foundation; either version 2
1515- * of the License, or (at your option) any later version.
1616- *
1717- * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
1818- * KIND, either express or implied.
1919- *
2020- ****************************************************************************/
2121-2222-#define ICON_HEIGHT 12
2323-#define CHAR_HEIGHT 8
2424-2525-#ifdef CHAR_WIDTH
2626- #undef CHAR_WIDTH
2727-#endif
2828-2929-#define CHAR_WIDTH 6
3030-#define CHAR_PIXEL 2
3131-#define BORDER_MARGIN 1
3232-3333-extern bool sim_lcd_framebuffer[SIM_LCD_HEIGHT][SIM_LCD_WIDTH];
3434-3535-void lcd_print_icon(int x, int icon_line, bool enable, char **icon);
3636-void lcd_print_char(int x, int y, unsigned char ch);
3737-void sim_lcd_update_rect(int x, int y, int width, int height);
3838-void sim_lcd_define_pattern(int pat, const char *pattern);