summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--apps/recorder/icons.c16
-rw-r--r--apps/recorder/icons.h46
-rw-r--r--apps/settings_menu.c4
-rw-r--r--apps/tree.c37
-rw-r--r--apps/wps.c166
-rw-r--r--apps/wps.h5
-rw-r--r--firmware/drivers/lcd.c10
7 files changed, 225 insertions, 59 deletions
diff --git a/apps/recorder/icons.c b/apps/recorder/icons.c
index 2019a1728a..440902a83a 100644
--- a/apps/recorder/icons.c
+++ b/apps/recorder/icons.c
@@ -36,7 +36,7 @@ unsigned char slider_bar[] =
0x7c, 0x28, 0x28, 0x28, 0x28, 0x38
};
-static unsigned char bitmap_icon_5x8[][5] =
+unsigned char bitmap_icons_5x8[][5] =
{
/* Lock */
{0x78,0x7f,0x49,0x7f,0x78}
@@ -70,7 +70,7 @@ unsigned char bitmap_icons_6x8[LastIcon][6] =
{ 0x63, 0x7f, 0x3a, 0x7f, 0x63, 0x00 },
};
-static unsigned char bitmap_icon_7x8[][7] =
+unsigned char bitmap_icons_7x8[][7] =
{
/* Power plug */
{0x08,0x1c,0x3e,0x3e,0x3e,0x14,0x14},
@@ -190,7 +190,7 @@ void statusbar_icon_battery(int percent, bool charging)
/* draw power plug if charging */
if (charging)
- lcd_bitmap(bitmap_icon_7x8[Icon_Plug], ICON_PLUG_X_POS,
+ lcd_bitmap(bitmap_icons_7x8[Icon_Plug], ICON_PLUG_X_POS,
STATUSBAR_Y_POS, ICON_PLUG_WIDTH, STATUSBAR_HEIGHT, false);
};
@@ -217,7 +217,7 @@ void statusbar_icon_volume(int percent)
volume = 100;
if (volume==0) {
- lcd_bitmap(bitmap_icon_7x8[Icon_Mute],
+ lcd_bitmap(bitmap_icons_7x8[Icon_Mute],
ICON_VOLUME_X_POS + ICON_VOLUME_WIDTH / 2 - 4,
STATUSBAR_Y_POS, 7, STATUSBAR_HEIGHT, false);
}
@@ -259,7 +259,7 @@ void statusbar_icon_volume(int percent)
*/
void statusbar_icon_play_state(int state)
{
- lcd_bitmap(bitmap_icon_7x8[state], ICON_PLAY_STATE_X_POS, STATUSBAR_Y_POS,
+ lcd_bitmap(bitmap_icons_7x8[state], ICON_PLAY_STATE_X_POS, STATUSBAR_Y_POS,
ICON_PLAY_STATE_WIDTH, STATUSBAR_HEIGHT, false);
}
@@ -268,7 +268,7 @@ void statusbar_icon_play_state(int state)
*/
void statusbar_icon_play_mode(int mode)
{
- lcd_bitmap(bitmap_icon_7x8[mode], ICON_PLAY_MODE_X_POS, STATUSBAR_Y_POS,
+ lcd_bitmap(bitmap_icons_7x8[mode], ICON_PLAY_MODE_X_POS, STATUSBAR_Y_POS,
ICON_PLAY_MODE_WIDTH, STATUSBAR_HEIGHT, false);
}
@@ -277,7 +277,7 @@ void statusbar_icon_play_mode(int mode)
*/
void statusbar_icon_shuffle(void)
{
- lcd_bitmap(bitmap_icon_7x8[Icon_Shuffle], ICON_SHUFFLE_X_POS,
+ lcd_bitmap(bitmap_icons_7x8[Icon_Shuffle], ICON_SHUFFLE_X_POS,
STATUSBAR_Y_POS, ICON_SHUFFLE_WIDTH, STATUSBAR_HEIGHT, false);
}
@@ -286,7 +286,7 @@ void statusbar_icon_shuffle(void)
*/
void statusbar_icon_lock(void)
{
- lcd_bitmap(bitmap_icon_5x8[Icon_Lock], LOCK_X_POS,
+ lcd_bitmap(bitmap_icons_5x8[Icon_Lock], LOCK_X_POS,
STATUSBAR_Y_POS, 5, 8, false);
}
diff --git a/apps/recorder/icons.h b/apps/recorder/icons.h
index 5017ed5b49..46b7c3d2d9 100644
--- a/apps/recorder/icons.h
+++ b/apps/recorder/icons.h
@@ -31,7 +31,31 @@ enum icons_6x8 {
LastIcon
};
+/* Symbolic names for icons */
+enum icons_5x8 {
+ Icon_Lock
+};
+
+enum icons_7x8 {
+ Icon_Plug,
+ Icon_Speaker,
+ Icon_Mute,
+ Icon_Play,
+ Icon_Stop,
+ Icon_Pause,
+ Icon_FastForward,
+ Icon_FastBackward,
+ Icon_Record,
+ Icon_RecPause,
+ Icon_Normal,
+ Icon_Repeat,
+ Icon_Shuffle,
+ Icon_Last
+};
+
+extern unsigned char bitmap_icons_5x8[1][5];
extern unsigned char bitmap_icons_6x8[LastIcon][6];
+extern unsigned char bitmap_icons_7x8[Icon_Last][7];
extern unsigned char rockbox112x37[];
@@ -57,28 +81,6 @@ extern unsigned char slider_bar[];
#define LOCK_WIDTH 5
#define TIME_X_END STATUSBAR_WIDTH-1
-/* Symbolic names for icons */
-enum
-{
- Icon_Lock = 0
-};
-enum
-{
- Icon_Plug = 0,
- Icon_Speaker,
- Icon_Mute,
- Icon_Play,
- Icon_Stop,
- Icon_Pause,
- Icon_FastForward,
- Icon_FastBackward,
- Icon_Record,
- Icon_RecPause,
- Icon_Normal,
- Icon_Repeat,
- Icon_Shuffle
-};
-
extern void statusbar_wipe(void);
extern void statusbar_icon_battery(int percent, bool charging);
extern void statusbar_icon_volume(int percent);
diff --git a/apps/settings_menu.c b/apps/settings_menu.c
index eeb6af8e71..da2098e921 100644
--- a/apps/settings_menu.c
+++ b/apps/settings_menu.c
@@ -50,11 +50,13 @@ static Menu contrast(void)
return MENU_OK;
}
+#ifndef HAVE_RECORDER_KEYPAD
static Menu shuffle(void)
{
set_bool( "[Shuffle]", &global_settings.playlist_shuffle );
return MENU_OK;
}
+#endif
static Menu mp3_filter(void)
{
@@ -169,7 +171,9 @@ Menu settings_menu(void)
Menu result;
struct menu_items items[] = {
+#ifndef HAVE_RECORDER_KEYPAD
{ "Shuffle", shuffle },
+#endif
{ "MP3/M3U filter", mp3_filter },
{ "Sort mode", sort_case },
{ "Backlight Timer", backlight_timer },
diff --git a/apps/tree.c b/apps/tree.c
index e5fb3c152d..36ce52cad3 100644
--- a/apps/tree.c
+++ b/apps/tree.c
@@ -117,7 +117,7 @@ extern unsigned char bitmap_icons_6x8[LastIcon][6];
#define TREE_EXIT BUTTON_LEFT
#define TREE_ENTER BUTTON_RIGHT
#define TREE_MENU BUTTON_F1
-#define RELEASE_MASK (BUTTON_OFF)
+#define RELEASE_MASK (BUTTON_OFF | BUTTON_F2 | BUTTON_F3)
#else
#define TREE_NEXT BUTTON_RIGHT
#define TREE_PREV BUTTON_LEFT
@@ -760,22 +760,31 @@ bool dirbrowse(char *root)
break;
#ifdef HAVE_RECORDER_KEYPAD
- case BUTTON_F3: {
-#ifdef HAVE_LCD_BITMAP
- unsigned char state;
- state = global_settings.statusbar << 1 | global_settings.scrollbar;
- state = (state + 1) % 4;
- global_settings.statusbar = state >> 1;
- global_settings.scrollbar = state & 0x1;
- settings_save();
+ case BUTTON_F2:
+ if (f2_screen()) {
+ /* reread root dir */
+ strcpy(currdir, "/");
+ lastdir[0] = 0;
+ dirlevel = 0;
+ dircursor = 0;
+ }
+ restore = true;
+ break;
+
+ case BUTTON_F3:
+ if (f3_screen()) {
+ /* reread root dir */
+ strcpy(currdir, "/");
+ lastdir[0] = 0;
+ dirlevel = 0;
+ dircursor = 0;
+ }
#ifdef LOADABLE_FONTS
- tree_max_on_screen = (LCD_HEIGHT - MARGIN_Y) / fh;
+ tree_max_on_screen = (LCD_HEIGHT - MARGIN_Y) / fh;
#else
- tree_max_on_screen = TREE_MAX_ON_SCREEN;
-#endif
- restore = true;
+ tree_max_on_screen = TREE_MAX_ON_SCREEN;
#endif
- }
+ restore = true;
break;
#endif
diff --git a/apps/wps.c b/apps/wps.c
index 440a3e85bf..029ed44f55 100644
--- a/apps/wps.c
+++ b/apps/wps.c
@@ -49,7 +49,7 @@
/* 3% of 30min file == 54s step size */
#ifdef HAVE_RECORDER_KEYPAD
-#define RELEASE_MASK (BUTTON_F1 | BUTTON_DOWN | BUTTON_LEFT | BUTTON_RIGHT | BUTTON_UP)
+#define RELEASE_MASK (BUTTON_F1 | BUTTON_F2 | BUTTON_F3 | BUTTON_DOWN | BUTTON_LEFT | BUTTON_RIGHT | BUTTON_UP)
#else
#define RELEASE_MASK (BUTTON_MENU | BUTTON_STOP | BUTTON_LEFT | BUTTON_RIGHT | BUTTON_PLAY)
#endif
@@ -629,6 +629,153 @@ static bool menu(void)
return false;
}
+#ifdef HAVE_LCD_BITMAP
+bool f2_screen(void)
+{
+ bool exit = false;
+
+ lcd_stop_scroll();
+
+ while (!exit) {
+ int w,h;
+ char* ptr;
+
+ ptr = "Repeat";
+#ifdef LCD_PROPFONTS
+ lcd_getstringsize(ptr,0,&w,&h);
+#else
+ lcd_getfontsize(0,&w,&h);
+ w *= strlen(ptr);
+#endif
+
+ lcd_clear_display();
+
+ lcd_putsxy(0, LCD_HEIGHT/2 - h*2, "Shuffle", 0);
+ lcd_putsxy(0, LCD_HEIGHT/2 - h, "mode:", 0);
+ lcd_putsxy(0, LCD_HEIGHT/2,
+ global_settings.playlist_shuffle ? "on" : "off", 0);
+ lcd_bitmap(bitmap_icons_7x8[Icon_FastBackward],
+ LCD_WIDTH/2 - 16, LCD_HEIGHT/2 - 4, 7, 8, true);
+
+ /* commented out until we really can disable repeat
+ lcd_putsxy(LCD_WIDTH - w, LCD_HEIGHT/2 - h*2, ptr, 0);
+ lcd_putsxy(LCD_WIDTH - w, LCD_HEIGHT/2 - h, "mode:", 0);
+ lcd_putsxy(LCD_WIDTH - w, LCD_HEIGHT/2, "on", 0 );
+ lcd_bitmap(bitmap_icons_7x8[Icon_FastForward],
+ LCD_WIDTH/2 + 8, LCD_HEIGHT/2 - 4, 7, 8, true);
+ */
+ lcd_update();
+
+ switch (button_get(true)) {
+ case BUTTON_LEFT:
+ case BUTTON_F2 | BUTTON_LEFT:
+ global_settings.playlist_shuffle =
+ !global_settings.playlist_shuffle;
+
+ if (global_settings.playlist_shuffle)
+ randomise_playlist(current_tick);
+ else
+ sort_playlist(true);
+ break;
+
+ case BUTTON_RIGHT:
+ case BUTTON_F2 | BUTTON_RIGHT:
+ /* toggle repeat */
+ break;
+
+#ifdef SIMULATOR
+ case BUTTON_F2:
+#else
+ case BUTTON_F2 | BUTTON_REL:
+#endif
+ exit = true;
+ break;
+
+#ifndef SIMULATOR
+ case SYS_USB_CONNECTED:
+ handle_usb();
+ return true;
+#endif
+ }
+ }
+
+ settings_save();
+
+ return false;
+}
+
+bool f3_screen(void)
+{
+ bool exit = false;
+
+ lcd_stop_scroll();
+
+ while (!exit) {
+ int w,h;
+ char* ptr;
+
+ ptr = "Status";
+#ifdef LCD_PROPFONTS
+ lcd_getstringsize(ptr,0,&w,&h);
+#else
+ lcd_getfontsize(0,&w,&h);
+ w *= strlen(ptr);
+#endif
+
+ lcd_clear_display();
+
+ lcd_putsxy(0, LCD_HEIGHT/2 - h*2, "Scroll", 0);
+ lcd_putsxy(0, LCD_HEIGHT/2 - h, "bar:", 0);
+ lcd_putsxy(0, LCD_HEIGHT/2,
+ global_settings.scrollbar ? "on" : "off", 0);
+ lcd_bitmap(bitmap_icons_7x8[Icon_FastBackward],
+ LCD_WIDTH/2 - 16, LCD_HEIGHT/2 - 4, 7, 8, true);
+
+ lcd_putsxy(LCD_WIDTH - w, LCD_HEIGHT/2 - h*2, ptr, 0);
+ lcd_putsxy(LCD_WIDTH - w, LCD_HEIGHT/2 - h, "bar:", 0);
+ lcd_putsxy(LCD_WIDTH - w, LCD_HEIGHT/2,
+ global_settings.statusbar ? "on" : "off", 0 );
+ lcd_bitmap(bitmap_icons_7x8[Icon_FastForward],
+ LCD_WIDTH/2 + 8, LCD_HEIGHT/2 - 4, 7, 8, true);
+ lcd_update();
+
+ switch (button_get(true)) {
+ case BUTTON_LEFT:
+ case BUTTON_F3 | BUTTON_LEFT:
+ global_settings.scrollbar = !global_settings.scrollbar;
+ break;
+
+ case BUTTON_RIGHT:
+ case BUTTON_F3 | BUTTON_RIGHT:
+ global_settings.statusbar = !global_settings.statusbar;
+ break;
+
+#ifdef SIMULATOR
+ case BUTTON_F3:
+#else
+ case BUTTON_F3 | BUTTON_REL:
+#endif
+ exit = true;
+ break;
+
+#ifndef SIMULATOR
+ case SYS_USB_CONNECTED:
+ handle_usb();
+ return true;
+#endif
+ }
+ }
+
+ settings_save();
+ if (global_settings.statusbar)
+ lcd_setmargins(0, STATUSBAR_HEIGHT);
+ else
+ lcd_setmargins(0, 0);
+
+ return false;
+}
+#endif
+
/* demonstrates showing different formats from playtune */
int wps_show(void)
{
@@ -777,15 +924,18 @@ int wps_show(void)
restore = true;
break;
- /* toggle status bar */
#ifdef HAVE_RECORDER_KEYPAD
+ /* play settings */
+ case BUTTON_F2:
+ if (f2_screen())
+ return SYS_USB_CONNECTED;
+ restore = true;
+ break;
+
+ /* screen settings */
case BUTTON_F3:
- global_settings.statusbar = !global_settings.statusbar;
- settings_save();
- if(global_settings.statusbar)
- lcd_setmargins(0, STATUSBAR_HEIGHT);
- else
- lcd_setmargins(0, 0);
+ if (f3_screen())
+ return SYS_USB_CONNECTED;
restore = true;
break;
#endif
diff --git a/apps/wps.h b/apps/wps.h
index 81435b532f..46ec7243d1 100644
--- a/apps/wps.h
+++ b/apps/wps.h
@@ -30,4 +30,9 @@ bool load_custom_wps(void);
bool display_custom_wps(int x_val, int y_val, bool do_scroll, char *wps_string);
bool refresh_wps(bool refresh_scroll);
+#ifdef HAVE_RECORDER_KEYPAD
+bool f2_screen(void);
+bool f3_screen(void);
+#endif
+
#endif
diff --git a/firmware/drivers/lcd.c b/firmware/drivers/lcd.c
index 03f667acfa..0fa077c7ba 100644
--- a/firmware/drivers/lcd.c
+++ b/firmware/drivers/lcd.c
@@ -797,7 +797,6 @@ extern unsigned char char_dw_8x8_prop[][9];
int lcd_getstringsize(unsigned char *str, unsigned int font, int *w, int *h)
{
int width=0;
- int height=0;
unsigned char ch, byte;
(void)font;
@@ -811,12 +810,9 @@ int lcd_getstringsize(unsigned char *str, unsigned int font, int *w, int *h)
byte = char_dw_8x8_prop[ch][8];
width += (byte>>4) + 1;
- if((byte & 0x0f) > height)
- height = byte & 0x0f;
-
}
*w = width;
- *h = height;
+ *h = 8;
return width;
}
@@ -851,7 +847,7 @@ void lcd_putspropxy(int x, int y, unsigned char *str, int thisfont)
break;
src = char_dw_8x8_prop[ch];
- lcd_clearrect (lcd_x+nx, lcd_y, 1, ny);
+ lcd_clearrect (lcd_x+nx, lcd_y, 1, ny );
lcd_bitmap (src, lcd_x, lcd_y, nx, ny, true);
lcd_x += nx+1;
@@ -928,7 +924,7 @@ void lcd_putsxy(int x, int y, unsigned char *str, int thisfont)
}
#endif
- while (((ch = *str++) != '\0') && (lcd_x + nx < LCD_WIDTH))
+ while (((ch = *str++) != '\0') && (lcd_x + nx <= LCD_WIDTH))
{
if (lcd_y + ny > LCD_HEIGHT)
return;