1 /***************************************************************************
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
10 * Copyright (C) 2007 Dave Chapman
12 * This program is free software; you can redistribute it and/or
13 * modify it under the terms of the GNU General Public License
14 * as published by the Free Software Foundation; either version 2
15 * of the License, or (at your option) any later version.
17 * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
18 * KIND, either express or implied.
20 ****************************************************************************/
26 #ifdef HAVE_LCD_BITMAP
29 #define BGCOLOR_1 LCD_RGBPACK(255,255,0)
30 #define BGCOLOR_2 LCD_RGBPACK(0,255,0)
31 #define FGCOLOR_1 LCD_RGBPACK(0,0,255)
33 #define BGCOLOR_1 LCD_DARKGRAY
34 #define BGCOLOR_2 LCD_LIGHTGRAY
35 #define FGCOLOR_1 LCD_WHITE
38 static struct viewport vp0
=
45 .drawmode
= DRMODE_SOLID
,
47 .fg_pattern
= LCD_DEFAULT_FG
,
48 .bg_pattern
= BGCOLOR_1
,
51 .lss_pattern
= LCD_DEFAULT_BG
,
52 .lse_pattern
= LCD_DEFAULT_BG
,
53 .lst_pattern
= LCD_DEFAULT_BG
,
57 static struct viewport vp1
=
61 .width
= LCD_WIDTH
/ 3,
62 .height
= LCD_HEIGHT
/ 2,
63 .font
= FONT_SYSFIXED
,
64 .drawmode
= DRMODE_SOLID
,
66 .fg_pattern
= LCD_DEFAULT_FG
,
67 .bg_pattern
= LCD_DEFAULT_BG
,
69 .lss_pattern
= LCD_DEFAULT_BG
,
70 .lse_pattern
= LCD_DEFAULT_BG
,
71 .lst_pattern
= LCD_DEFAULT_BG
,
76 static struct viewport vp2
=
80 .width
= LCD_WIDTH
/ 3,
81 .height
= (LCD_HEIGHT
/ 2),
83 .drawmode
= DRMODE_SOLID
,
85 .fg_pattern
= FGCOLOR_1
,
86 .bg_pattern
= BGCOLOR_2
,
88 .lss_pattern
= LCD_DEFAULT_BG
,
89 .lse_pattern
= LCD_DEFAULT_BG
,
90 .lst_pattern
= LCD_DEFAULT_BG
,
96 static struct viewport vp3
=
99 .y
= (5 * LCD_HEIGHT
) / 8,
100 .width
= LCD_WIDTH
/ 2,
101 .height
= (LCD_HEIGHT
/ 4),
102 .font
= FONT_SYSFIXED
,
103 .drawmode
= DRMODE_SOLID
,
105 .fg_pattern
= LCD_BLACK
,
106 .bg_pattern
= LCD_WHITE
,
107 #ifdef HAVE_LCD_COLOR
108 .lss_pattern
= LCD_DEFAULT_BG
,
109 .lse_pattern
= LCD_DEFAULT_BG
,
110 .lst_pattern
= LCD_DEFAULT_BG
,
116 #ifdef HAVE_REMOTE_LCD
117 static struct viewport rvp0
=
121 .width
= LCD_REMOTE_WIDTH
/ 3,
122 .height
= LCD_REMOTE_HEIGHT
- 10,
123 .font
= FONT_SYSFIXED
,
124 .drawmode
= DRMODE_SOLID
,
125 #if LCD_REMOTE_DEPTH > 1
126 .fg_pattern
= LCD_REMOTE_BLACK
,
127 .bg_pattern
= LCD_REMOTE_LIGHTGRAY
,
131 static struct viewport rvp1
=
133 .x
= LCD_REMOTE_WIDTH
/ 2,
135 .width
= LCD_REMOTE_WIDTH
/ 3,
136 .height
= LCD_REMOTE_HEIGHT
- 10,
137 .font
= FONT_SYSFIXED
,
138 .drawmode
= DRMODE_SOLID
,
139 #if LCD_REMOTE_DEPTH > 1
140 .fg_pattern
= LCD_REMOTE_DEFAULT_FG
,
141 .bg_pattern
= LCD_REMOTE_DEFAULT_BG
148 enum plugin_status
plugin_start(const void* parameter
)
154 rb
->screens
[SCREEN_MAIN
]->set_viewport(&vp0
);
155 rb
->screens
[SCREEN_MAIN
]->clear_viewport();
156 rb
->screens
[SCREEN_MAIN
]->puts_scroll(0,0,"Viewport testing plugin - this is a scrolling title");
158 rb
->screens
[SCREEN_MAIN
]->set_viewport(&vp1
);
159 rb
->screens
[SCREEN_MAIN
]->clear_viewport();
161 for (i
= 0 ; i
< 3; i
++)
163 rb
->snprintf(buf
,sizeof(buf
),"Left text, scrolling_line %d",i
);
164 rb
->screens
[SCREEN_MAIN
]->puts_scroll(0,i
,buf
);
167 rb
->screens
[SCREEN_MAIN
]->set_viewport(&vp2
);
168 rb
->screens
[SCREEN_MAIN
]->clear_viewport();
169 for (i
= 1 ; i
< 3; i
++)
171 rb
->snprintf(buf
,sizeof(buf
),"Right text, scrolling line %d",i
);
172 rb
->screens
[SCREEN_MAIN
]->puts_scroll(1,i
,buf
);
176 for (i
= -10; i
< vp2
.width
+ 10; i
+= 5)
178 rb
->screens
[SCREEN_MAIN
]->drawline(i
, y
, i
, vp2
.height
- y
);
181 rb
->screens
[SCREEN_MAIN
]->set_viewport(&vp3
);
182 rb
->screens
[SCREEN_MAIN
]->clear_viewport();
183 for (i
= 1 ; i
< 2; i
++)
185 rb
->snprintf(buf
,sizeof(buf
),"Bottom text, a scrolling line %d",i
);
186 rb
->screens
[SCREEN_MAIN
]->puts_scroll(2,i
,buf
);
188 rb
->screens
[SCREEN_MAIN
]->puts_scroll(4,i
,"Short line");
189 rb
->screens
[SCREEN_MAIN
]->update();
192 #ifdef HAVE_REMOTE_LCD
193 rb
->screens
[SCREEN_REMOTE
]->set_viewport(&rvp0
);
194 rb
->screens
[SCREEN_REMOTE
]->clear_viewport();
196 for (i
= 0 ; i
< 5; i
++)
198 rb
->snprintf(buf
,sizeof(buf
),"Left text, scrolling_line %d",i
);
199 rb
->screens
[SCREEN_REMOTE
]->puts_scroll(0,i
,buf
);
201 rb
->screens
[SCREEN_REMOTE
]->puts(1,i
,"Static");
203 rb
->screens
[SCREEN_REMOTE
]->set_viewport(&rvp1
);
204 rb
->screens
[SCREEN_REMOTE
]->clear_viewport();
205 for (i
= 1 ; i
< 3; i
++)
207 rb
->snprintf(buf
,sizeof(buf
),"Right text, scrolling line %d",i
);
208 rb
->screens
[SCREEN_REMOTE
]->puts_scroll(1,i
,buf
);
212 for (i
= -10; i
< rvp1
.width
+ 10; i
+= 5)
214 rb
->screens
[SCREEN_REMOTE
]->drawline(i
, y
, i
, rvp1
.height
- y
);
217 rb
->screens
[SCREEN_REMOTE
]->update();
220 rb
->button_get(true);
222 /* Restore the default viewport */
223 rb
->screens
[SCREEN_MAIN
]->set_viewport(NULL
);
224 #ifdef HAVE_REMOTE_LCD
225 rb
->screens
[SCREEN_REMOTE
]->set_viewport(NULL
);
234 /* Charcell version of plugin */
236 static struct viewport vp0
=
244 static struct viewport vp1
=
252 static struct viewport vp2
=
261 enum plugin_status
plugin_start(const void* parameter
)
265 rb
->screens
[SCREEN_MAIN
]->set_viewport(&vp0
);
266 rb
->screens
[SCREEN_MAIN
]->clear_viewport();
267 rb
->screens
[SCREEN_MAIN
]->puts_scroll(0,0,"Rockbox");
269 rb
->screens
[SCREEN_MAIN
]->set_viewport(&vp1
);
270 rb
->screens
[SCREEN_MAIN
]->clear_viewport();
271 rb
->screens
[SCREEN_MAIN
]->puts_scroll(0,0,"Viewports");
273 rb
->screens
[SCREEN_MAIN
]->set_viewport(&vp2
);
274 rb
->screens
[SCREEN_MAIN
]->clear_viewport();
275 rb
->screens
[SCREEN_MAIN
]->puts_scroll(0,0,"Demonstration");
277 rb
->screens
[SCREEN_MAIN
]->update();
279 rb
->button_get(true);
281 /* Restore the default viewport */
282 rb
->screens
[SCREEN_MAIN
]->set_viewport(NULL
);
287 #endif /* !HAVE_LCD_BITMAP */