connect progress signal directly to the logger.
[Rockbox.git] / uisimulator / common / lcd-playersim.c
blob1c877d44096e614e73411cbc7da81f25b74136ff
1 /***************************************************************************
2 * __________ __ ___.
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
7 * \/ \/ \/ \/ \/
8 * $Id$
10 * Copyright (C) 2002 by Alan Korr
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.
15 * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
16 * KIND, either express or implied.
18 ****************************************************************************/
19 #include "config.h"
20 #include "hwcompat.h"
22 #include "lcd.h"
23 #include "lcd-charcell.h"
24 #include "kernel.h"
25 #include "thread.h"
26 #include <string.h>
27 #include <stdlib.h>
28 #include "debug.h"
29 #include "system.h"
31 #include "font-player.h"
32 #include "lcd-playersim.h"
34 /*** definitions ***/
36 bool sim_lcd_framebuffer[SIM_LCD_HEIGHT][SIM_LCD_WIDTH];
38 static int double_height = 1;
40 void lcd_print_icon(int x, int icon_line, bool enable, char **icon)
42 int row, col;
43 int y = (ICON_HEIGHT+(CHAR_HEIGHT*2+2)*CHAR_PIXEL) * icon_line;
45 y += BORDER_MARGIN;
46 x += BORDER_MARGIN;
48 for (row = 0; icon[row]; row++)
50 for (col = 0; icon[row][col]; col++)
52 switch (icon[row][col])
54 case '*':
55 sim_lcd_framebuffer[y+row][x+col] = enable;
56 break;
58 case ' ':
59 sim_lcd_framebuffer[y+row][x+col] = false;
60 break;
64 sim_lcd_update_rect(x, y, col, row);
65 /* icon drawing updates immediately */
68 void lcd_print_char(int x, int y, unsigned char ch)
70 int xpos = x * CHAR_WIDTH*CHAR_PIXEL;
71 int ypos = y * CHAR_HEIGHT*CHAR_PIXEL + ICON_HEIGHT;
72 int row, col, r, c;
74 if (double_height > 1 && y == 1)
75 return; /* only one row available if text is double height */
77 for (row = 0; row < 7; row ++)
79 unsigned fontbitmap = (*font_player)[ch][row];
80 int height = (row == 3) ? 1 : double_height;
82 y = ypos + row * CHAR_PIXEL * double_height;
83 for (col = 0; col < 5; col++)
85 bool fontbit = fontbitmap & (0x10 >> col);
87 x = xpos + col * CHAR_PIXEL;
88 for (r = 0; r < height * CHAR_PIXEL; r++)
89 for (c = 0; c < CHAR_PIXEL; c++)
90 sim_lcd_framebuffer[y+r][x+c] = fontbit;
93 if (double_height > 1)
95 y = ypos + 15*CHAR_PIXEL;
96 for (r = 0; r < CHAR_PIXEL; r++)
97 for (c = 0; c < 5*CHAR_PIXEL; c++)
98 sim_lcd_framebuffer[y+r][xpos+c] = false;
102 void lcd_double_height(bool on)
104 int newval = (is_new_player() && on) ? 2 : 1;
106 if (newval != double_height)
108 double_height = newval;
109 lcd_update();
113 void sim_lcd_define_pattern(int pat, const char *pattern)
115 if (pat < lcd_pattern_count)
116 memcpy((*font_player)[pat], pattern, 7);