summaryrefslogtreecommitdiff
path: root/apps/gui
diff options
context:
space:
mode:
Diffstat (limited to 'apps/gui')
-rw-r--r--apps/gui/buttonbar.c131
-rw-r--r--apps/gui/buttonbar.h85
-rw-r--r--apps/gui/list.c4
-rw-r--r--apps/gui/option_select.h5
-rw-r--r--apps/gui/skin_engine/skin_tokens.c4
-rw-r--r--apps/gui/viewport.c7
-rw-r--r--apps/gui/wps.c4
7 files changed, 4 insertions, 236 deletions
diff --git a/apps/gui/buttonbar.c b/apps/gui/buttonbar.c
deleted file mode 100644
index 48ef6d0994..0000000000
--- a/apps/gui/buttonbar.c
+++ /dev/null
@@ -1,131 +0,0 @@
1/***************************************************************************
2 * __________ __ ___.
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
7 * \/ \/ \/ \/ \/
8 * $Id$
9 *
10 * Copyright (C) Linus Nielsen Feltzing (2002)
11 *
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.
16 *
17 * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
18 * KIND, either express or implied.
19 *
20 ****************************************************************************/
21/*
222005 Kevin Ferrare :
23 - Multi screen support
24 - Rewrote a lot of code to avoid global vars and make it accept eventually
25 more that 3 buttons on the bar (just the prototype of gui_buttonbar_set
26 and the constant BUTTONBAR_MAX_BUTTONS to modify)
272008 Jonathan Gordon
28 - redone to use viewports, items will NOT scroll in their vp.
29 Bar is always drawn at the bottom of the screen. This may be changed later.
30 Callers need to remember to adjust their viewports to not be overwitten
31*/
32#include "config.h"
33#include "buttonbar.h"
34#include "viewport.h"
35#include "lcd.h"
36#include "font.h"
37#include "string-extra.h"
38#include "settings.h"
39
40static struct viewport bb_vp[NB_SCREENS];
41void gui_buttonbar_init(struct gui_buttonbar * buttonbar)
42{
43 gui_buttonbar_unset(buttonbar);
44 FOR_NB_SCREENS(i)
45 {
46 viewport_set_defaults(&bb_vp[i], i);
47 bb_vp[i].font = FONT_SYSFIXED;
48 bb_vp[i].y = screens[i].lcdheight - BUTTONBAR_HEIGHT;
49 bb_vp[i].height = BUTTONBAR_HEIGHT;
50 bb_vp[i].drawmode = DRMODE_COMPLEMENT;
51 }
52}
53
54void gui_buttonbar_set_display(struct gui_buttonbar * buttonbar,
55 struct screen * display)
56{
57 buttonbar->display = display;
58}
59
60static void gui_buttonbar_draw_button(struct gui_buttonbar * buttonbar, int num)
61{
62 int button_width;
63 int fh, fw;
64 struct screen * display = buttonbar->display;
65 struct viewport vp = bb_vp[display->screen_type];
66
67 button_width = display->lcdwidth/BUTTONBAR_MAX_BUTTONS;
68 vp.width = button_width-1;
69 vp.x = button_width * num;
70 display->set_viewport(&vp);
71 display->fill_viewport();
72 if(buttonbar->caption[num][0] != 0)
73 {
74 display->getstringsize(buttonbar->caption[num], &fw, &fh);
75 display->putsxy((button_width - fw)/2,
76 (vp.height-fh)/2, buttonbar->caption[num]);
77 }
78 display->set_viewport(NULL);
79}
80
81void gui_buttonbar_set(struct gui_buttonbar * buttonbar,
82 const char *caption1,
83 const char *caption2,
84 const char *caption3)
85{
86 gui_buttonbar_unset(buttonbar);
87 if(caption1)
88 {
89 strlcpy(buttonbar->caption[0], caption1, BUTTONBAR_CAPTION_LENGTH);
90 }
91 if(caption2)
92 {
93 strlcpy(buttonbar->caption[1], caption2, BUTTONBAR_CAPTION_LENGTH);
94 }
95 if(caption3)
96 {
97 strlcpy(buttonbar->caption[2], caption3, BUTTONBAR_CAPTION_LENGTH);
98 }
99}
100
101void gui_buttonbar_unset(struct gui_buttonbar * buttonbar)
102{
103 int i;
104 for(i = 0;i < BUTTONBAR_MAX_BUTTONS;i++)
105 buttonbar->caption[i][0] = 0;
106}
107
108void gui_buttonbar_draw(struct gui_buttonbar * buttonbar)
109{
110 struct screen * display = buttonbar->display;
111 if(!global_settings.buttonbar || !gui_buttonbar_isset(buttonbar))
112 return;
113 int i;
114 display->set_viewport(&bb_vp[display->screen_type]);
115 display->clear_viewport();
116 for(i = 0;i < BUTTONBAR_MAX_BUTTONS;i++)
117 gui_buttonbar_draw_button(buttonbar, i);
118 display->set_viewport(&bb_vp[display->screen_type]);
119 display->update_viewport();
120 display->set_viewport(NULL);
121}
122
123bool gui_buttonbar_isset(struct gui_buttonbar * buttonbar)
124{
125 /* If all buttons are unset, the button bar is considered disabled */
126 int i;
127 for(i = 0;i < BUTTONBAR_MAX_BUTTONS;i++)
128 if(buttonbar->caption[i][0] != 0)
129 return true;
130 return false;
131}
diff --git a/apps/gui/buttonbar.h b/apps/gui/buttonbar.h
deleted file mode 100644
index 884e3132bf..0000000000
--- a/apps/gui/buttonbar.h
+++ /dev/null
@@ -1,85 +0,0 @@
1/***************************************************************************
2 * __________ __ ___.
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
7 * \/ \/ \/ \/ \/
8 * $Id$
9 *
10 * Copyright (C) 2005 by Kevin Ferrare
11 *
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.
16 *
17 * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
18 * KIND, either express or implied.
19 *
20 ****************************************************************************/
21
22#ifndef _GUI_BUTTONBAR_H_
23#define _GUI_BUTTONBAR_H_
24#include "config.h"
25#include "button.h"
26#include "screen_access.h"
27
28
29#ifdef HAVE_BUTTONBAR
30#define BUTTONBAR_HEIGHT 8
31#define BUTTONBAR_MAX_BUTTONS 3
32#define BUTTONBAR_CAPTION_LENGTH 8
33
34
35struct gui_buttonbar
36{
37 char caption[BUTTONBAR_MAX_BUTTONS][BUTTONBAR_CAPTION_LENGTH];
38 struct screen * display;
39};
40
41/*
42 * Initializes the buttonbar
43 * - buttonbar : the buttonbar
44 */
45extern void gui_buttonbar_init(struct gui_buttonbar * buttonbar);
46
47/*
48 * Attach the buttonbar to a screen
49 * - buttonbar : the buttonbar
50 * - display : the display to attach the buttonbar
51 */
52extern void gui_buttonbar_set_display(struct gui_buttonbar * buttonbar,
53 struct screen * display);
54
55/*
56 * Set the caption of the items of the buttonbar
57 * - buttonbar : the buttonbar
58 * - caption1,2,3 : the first, second and thirds items of the bar
59 */
60extern void gui_buttonbar_set(struct gui_buttonbar * buttonbar,
61 const char *caption1,
62 const char *caption2,
63 const char *caption3);
64
65/*
66 * Disable the buttonbar
67 * - buttonbar : the buttonbar
68 */
69extern void gui_buttonbar_unset(struct gui_buttonbar * buttonbar);
70
71/*
72 * Draw the buttonbar on it's attached screen
73 * - buttonbar : the buttonbar
74 */
75extern void gui_buttonbar_draw(struct gui_buttonbar * buttonbar);
76
77/*
78 * Returns true if the buttonbar has something to display, false otherwise
79 * - buttonbar : the buttonbar
80 */
81extern bool gui_buttonbar_isset(struct gui_buttonbar * buttonbar);
82#else
83#define BUTTONBAR_HEIGHT 0
84#endif
85#endif /* _GUI_BUTTONBAR_H_ */
diff --git a/apps/gui/list.c b/apps/gui/list.c
index 425cab9a0f..8533f93275 100644
--- a/apps/gui/list.c
+++ b/apps/gui/list.c
@@ -553,10 +553,6 @@ void gui_synclist_set_viewport_defaults(struct viewport *vp,
553 enum screen_type screen) 553 enum screen_type screen)
554{ 554{
555 viewport_set_defaults(vp, screen); 555 viewport_set_defaults(vp, screen);
556#ifdef HAVE_BUTTONBAR
557 if (screens[screen].has_buttonbar)
558 vp->height -= BUTTONBAR_HEIGHT;
559#endif
560} 556}
561 557
562#ifdef HAVE_LCD_COLOR 558#ifdef HAVE_LCD_COLOR
diff --git a/apps/gui/option_select.h b/apps/gui/option_select.h
index 4ccc15a14e..7ca9a4ebbb 100644
--- a/apps/gui/option_select.h
+++ b/apps/gui/option_select.h
@@ -25,9 +25,8 @@
25#include "screen_access.h" 25#include "screen_access.h"
26#include "settings.h" 26#include "settings.h"
27 27
28#if defined (HAVE_SCROLLWHEEL) || \ 28#if defined (HAVE_SCROLLWHEEL)
29 (CONFIG_KEYPAD == PLAYER_PAD) 29/* Define this if your target makes sense to have
30/* Define this if your target makes sense to have
31 smaller values at the top of the list increasing down the list */ 30 smaller values at the top of the list increasing down the list */
32#define ASCENDING_INT_SETTINGS 31#define ASCENDING_INT_SETTINGS
33#endif 32#endif
diff --git a/apps/gui/skin_engine/skin_tokens.c b/apps/gui/skin_engine/skin_tokens.c
index 1cff83eb9a..75c3203066 100644
--- a/apps/gui/skin_engine/skin_tokens.c
+++ b/apps/gui/skin_engine/skin_tokens.c
@@ -126,7 +126,7 @@ char* get_dir(char* buf, int buf_size, const char* path, int level)
126 return buf; 126 return buf;
127} 127}
128 128
129#if (CONFIG_CODEC != MAS3507D) && defined (HAVE_PITCHCONTROL) 129#if defined (HAVE_PITCHCONTROL)
130/* A helper to determine the enum value for pitch/speed. 130/* A helper to determine the enum value for pitch/speed.
131 131
132 When there are two choices (i.e. boolean), return 1 if the value is 132 When there are two choices (i.e. boolean), return 1 if the value is
@@ -1452,7 +1452,7 @@ const char *get_token_value(struct gui_wps *gwps,
1452 } 1452 }
1453#endif /* (CONFIG_CODEC == SWCODEC) */ 1453#endif /* (CONFIG_CODEC == SWCODEC) */
1454 1454
1455#if (CONFIG_CODEC != MAS3507D) && defined (HAVE_PITCHCONTROL) 1455#if defined (HAVE_PITCHCONTROL)
1456 case SKIN_TOKEN_SOUND_PITCH: 1456 case SKIN_TOKEN_SOUND_PITCH:
1457 { 1457 {
1458 int32_t pitch = sound_get_pitch(); 1458 int32_t pitch = sound_get_pitch();
diff --git a/apps/gui/viewport.c b/apps/gui/viewport.c
index 194954c1d2..fad3255cdb 100644
--- a/apps/gui/viewport.c
+++ b/apps/gui/viewport.c
@@ -262,13 +262,6 @@ void viewportmanager_init()
262#ifdef HAVE_LCD_BITMAP 262#ifdef HAVE_LCD_BITMAP
263void viewportmanager_theme_changed(const int which) 263void viewportmanager_theme_changed(const int which)
264{ 264{
265#ifdef HAVE_BUTTONBAR
266 if (which & THEME_BUTTONBAR)
267 { /* don't handle further, the custom ui viewport ignores the buttonbar,
268 * as does viewport_set_defaults(), since only lists use it*/
269 screens[SCREEN_MAIN].has_buttonbar = global_settings.buttonbar;
270 }
271#endif
272 if (which & THEME_LANGUAGE) 265 if (which & THEME_LANGUAGE)
273 { 266 {
274 } 267 }
diff --git a/apps/gui/wps.c b/apps/gui/wps.c
index c27c434d12..a930edaded 100644
--- a/apps/gui/wps.c
+++ b/apps/gui/wps.c
@@ -355,10 +355,6 @@ bool ffwd_rew(int button)
355 if (!skin_get_global_state()->paused) 355 if (!skin_get_global_state()->paused)
356 audio_pause(); 356 audio_pause();
357#endif 357#endif
358#if CONFIG_KEYPAD == PLAYER_PAD
359 FOR_NB_SCREENS(i)
360 skin_get_gwps(WPS, i)->display->scroll_stop();
361#endif
362 if (direction > 0) 358 if (direction > 0)
363 status_set_ffmode(STATUS_FASTFORWARD); 359 status_set_ffmode(STATUS_FASTFORWARD);
364 else 360 else