summaryrefslogtreecommitdiffstats
path: root/apps
diff options
context:
space:
mode:
authorMarkus Braun <markus.braun@krawel.de>2002-08-20 19:39:55 +0000
committerMarkus Braun <markus.braun@krawel.de>2002-08-20 19:39:55 +0000
commitc41dcb9ae9a37b4177ec789ac9c27462da5ccbe3 (patch)
treeff617df7b59ea2eb2515c00bcc3194d76163ae00 /apps
parent5e4c1d2ad8278ea3787766c506dc5997d96b9386 (diff)
downloadrockbox-c41dcb9ae9a37b4177ec789ac9c27462da5ccbe3.tar.gz
rockbox-c41dcb9ae9a37b4177ec789ac9c27462da5ccbe3.zip
Now using lcd margins instead of a line offset for displaying status bar.
Needed to support fonts smaller than 8 pixels. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@1823 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'apps')
-rw-r--r--apps/playlist.c25
-rw-r--r--apps/tree.c59
-rw-r--r--apps/wps.c41
3 files changed, 65 insertions, 60 deletions
diff --git a/apps/playlist.c b/apps/playlist.c
index 9bd42941bc..27665981f7 100644
--- a/apps/playlist.c
+++ b/apps/playlist.c
@@ -30,12 +30,10 @@
#include "settings.h"
#include "status.h"
#include "applimits.h"
-
#ifdef HAVE_LCD_BITMAP
-#define LINE_Y (global_settings.statusbar&&statusbar_enabled?1:0) /* Y position the entry-list starts at */
-#else /* HAVE_LCD_BITMAP */
-#define LINE_Y 0 /* Y position the entry-list starts at */
-#endif /* HAVE_LCD_BITMAP */
+#include "icons.h"
+#include "widgets.h"
+#endif
playlist_info_t playlist;
@@ -183,10 +181,17 @@ void play_list(char *dir, /* "current directory" */
playlist.index = start_index;
+#ifdef HAVE_LCD_BITMAP
+ if(global_settings.statusbar)
+ lcd_setmargins(0, STATUSBAR_HEIGHT);
+ else
+ lcd_setmargins(0, 0);
+#endif
+
/* If file is NULL, the list is in RAM */
if(file) {
lcd_clear_display();
- lcd_puts(0,LINE_Y,"Loading...");
+ lcd_puts(0,0,"Loading...");
status_draw();
lcd_update();
playlist.in_ram = false;
@@ -216,7 +221,7 @@ void play_list(char *dir, /* "current directory" */
if(global_settings.playlist_shuffle) {
if(!playlist.in_ram) {
- lcd_puts(0,LINE_Y,"Shuffling...");
+ lcd_puts(0,0,"Shuffling...");
status_draw();
lcd_update();
randomise_playlist( random_seed );
@@ -247,7 +252,7 @@ void play_list(char *dir, /* "current directory" */
}
if(!playlist.in_ram) {
- lcd_puts(0,LINE_Y,"Playing... ");
+ lcd_puts(0,0,"Playing... ");
status_draw();
lcd_update();
}
@@ -342,7 +347,7 @@ void add_indices_to_playlist(void)
next_tick = current_tick + HZ;
snprintf(line, sizeof line, "%d files",
playlist.amount);
- lcd_puts(0,LINE_Y+1,line);
+ lcd_puts(0,1,line);
status_draw();
lcd_update();
}
@@ -357,7 +362,7 @@ void add_indices_to_playlist(void)
}
if(!playlist.in_ram) {
snprintf(line, sizeof line, "%d files", playlist.amount);
- lcd_puts(0,LINE_Y+1,line);
+ lcd_puts(0,1,line);
status_draw();
lcd_update();
close(fd);
diff --git a/apps/tree.c b/apps/tree.c
index 1f1c924ef6..a07a520955 100644
--- a/apps/tree.c
+++ b/apps/tree.c
@@ -69,10 +69,10 @@ void browse_root(void)
#ifdef HAVE_LCD_BITMAP
-#define TREE_MAX_ON_SCREEN ((LCD_HEIGHT-MARGIN_Y)/LINE_HEIGTH-LINE_Y)
+#define TREE_MAX_ON_SCREEN ((LCD_HEIGHT-MARGIN_Y)/LINE_HEIGTH)
#define TREE_MAX_LEN_DISPLAY 16 /* max length that fits on screen */
-#define MARGIN_Y 0 /* Y pixel margin */
+#define MARGIN_Y (global_settings.statusbar ? STATUSBAR_HEIGHT : 0) /* Y pixel margin */
#define MARGIN_X 10 /* X pixel margin */
#define LINE_Y (global_settings.statusbar ? 1 : 0) /* Y position the entry-list starts at */
#define LINE_X 0 /* X position the entry-list starts at */
@@ -167,7 +167,7 @@ static int showdir(char *path, int start)
int fh;
unsigned char *font = lcd_getcurrentldfont();
fh = ajf_get_fontheight(font);
- tree_max_on_screen = ((LCD_HEIGHT-MARGIN_Y)/fh)-LINE_Y;
+ tree_max_on_screen = (LCD_HEIGHT - MARGIN_Y) / fh;
line_height = fh;
#else
tree_max_on_screen = TREE_MAX_ON_SCREEN;
@@ -273,7 +273,7 @@ static int showdir(char *path, int start)
icon_type = File;
}
lcd_bitmap(bitmap_icons_6x8[icon_type],
- 4, MARGIN_Y+(LINE_Y+i-start)*line_height, 6, 8, true);
+ 4, MARGIN_Y+(i-start)*line_height, 6, 8, true);
#endif
@@ -283,11 +283,11 @@ static int showdir(char *path, int start)
{
char temp = dircache[i].name[len-4];
dircache[i].name[len-4] = 0;
- lcd_puts(LINE_X, LINE_Y+i-start, dircache[i].name);
+ lcd_puts(LINE_X, i-start, dircache[i].name);
dircache[i].name[len-4] = temp;
}
else
- lcd_puts(LINE_X, LINE_Y+i-start, dircache[i].name);
+ lcd_puts(LINE_X, i-start, dircache[i].name);
}
status_draw();
@@ -411,7 +411,7 @@ bool dirbrowse(char *root)
int fh;
unsigned char *font = lcd_getcurrentldfont();
fh = ajf_get_fontheight(font);
- tree_max_on_screen = ((LCD_HEIGHT-MARGIN_Y)/fh)-LINE_Y;
+ tree_max_on_screen = (LCD_HEIGHT - MARGIN_Y) / fh;
#else
tree_max_on_screen = TREE_MAX_ON_SCREEN;
#endif
@@ -424,7 +424,7 @@ bool dirbrowse(char *root)
if (numentries == -1)
return -1; /* root is not a directory */
- put_cursorxy(0, CURSOR_Y + LINE_Y+dircursor, true);
+ put_cursorxy(0, CURSOR_Y + dircursor, true);
while(1) {
bool restore = false;
@@ -545,29 +545,29 @@ bool dirbrowse(char *root)
case BUTTON_VOL_UP:
if(filesindir) {
if(dircursor) {
- put_cursorxy(0, CURSOR_Y + LINE_Y+dircursor, false);
+ put_cursorxy(0, CURSOR_Y + dircursor, false);
dircursor--;
- put_cursorxy(0, CURSOR_Y + LINE_Y+dircursor, true);
+ put_cursorxy(0, CURSOR_Y + dircursor, true);
}
else {
if (start) {
start--;
numentries = showdir(currdir, start);
- put_cursorxy(0, CURSOR_Y + LINE_Y+dircursor, true);
+ put_cursorxy(0, CURSOR_Y + dircursor, true);
}
else {
if (numentries < tree_max_on_screen) {
- put_cursorxy(0, CURSOR_Y + LINE_Y+dircursor,
+ put_cursorxy(0, CURSOR_Y + dircursor,
false);
dircursor = numentries - 1;
- put_cursorxy(0, CURSOR_Y + LINE_Y+dircursor,
+ put_cursorxy(0, CURSOR_Y + dircursor,
true);
}
else {
start = numentries - tree_max_on_screen;
dircursor = tree_max_on_screen - 1;
numentries = showdir(currdir, start);
- put_cursorxy(0, CURSOR_Y + LINE_Y +
+ put_cursorxy(0, CURSOR_Y +
tree_max_on_screen - 1, true);
}
}
@@ -583,28 +583,28 @@ bool dirbrowse(char *root)
{
if (dircursor + start + 1 < numentries ) {
if(dircursor+1 < tree_max_on_screen) {
- put_cursorxy(0, CURSOR_Y + LINE_Y+dircursor,
+ put_cursorxy(0, CURSOR_Y + dircursor,
false);
dircursor++;
- put_cursorxy(0, CURSOR_Y + LINE_Y+dircursor, true);
+ put_cursorxy(0, CURSOR_Y + dircursor, true);
}
else {
start++;
numentries = showdir(currdir, start);
- put_cursorxy(0, CURSOR_Y + LINE_Y+dircursor, true);
+ put_cursorxy(0, CURSOR_Y + dircursor, true);
}
}
else {
if(numentries < tree_max_on_screen) {
- put_cursorxy(0, CURSOR_Y + LINE_Y+dircursor,
+ put_cursorxy(0, CURSOR_Y + dircursor,
false);
start = dircursor = 0;
- put_cursorxy(0, CURSOR_Y + LINE_Y+dircursor, true);
+ put_cursorxy(0, CURSOR_Y + dircursor, true);
}
else {
start = dircursor = 0;
numentries = showdir(currdir, start);
- put_cursorxy(0, CURSOR_Y + LINE_Y+dircursor, true);
+ put_cursorxy(0, CURSOR_Y + dircursor, true);
}
}
lcd_update();
@@ -614,14 +614,8 @@ bool dirbrowse(char *root)
case TREE_MENU: {
bool lastfilter = global_settings.mp3filter;
bool lastsortcase = global_settings.sort_case;
-#ifdef HAVE_LCD_BITMAP
- bool laststate=statusbar(false);
-#endif
lcd_stop_scroll();
main_menu();
-#ifdef HAVE_LCD_BITMAP
- statusbar(laststate);
-#endif
/* do we need to rescan dir? */
if ( lastfilter != global_settings.mp3filter ||
lastsortcase != global_settings.sort_case)
@@ -650,13 +644,18 @@ bool dirbrowse(char *root)
#ifdef HAVE_RECORDER_KEYPAD
case BUTTON_F3:
-#endif
#ifdef HAVE_LCD_BITMAP
global_settings.statusbar = !global_settings.statusbar;
settings_save();
+#ifdef LOADABLE_FONTS
+ tree_max_on_screen = (LCD_HEIGHT - MARGIN_Y) / fh;
+#else
+ tree_max_on_screen = TREE_MAX_ON_SCREEN;
+#endif
restore = true;
#endif
break;
+#endif
#ifndef SIMULATOR
case SYS_USB_CONNECTED: {
@@ -694,7 +693,7 @@ bool dirbrowse(char *root)
dircursor--;
}
numentries = showdir(currdir, start);
- put_cursorxy(0, CURSOR_Y + LINE_Y+dircursor, true);
+ put_cursorxy(0, CURSOR_Y + dircursor, true);
}
if ( numentries ) {
@@ -711,12 +710,12 @@ bool dirbrowse(char *root)
int len = strlen(dircache[i].name);
char temp = dircache[i].name[len-4];
dircache[i].name[len-4] = 0;
- lcd_puts_scroll(LINE_X, LINE_Y+dircursor,
+ lcd_puts_scroll(LINE_X, dircursor,
dircache[i].name);
dircache[i].name[len-4] = temp;
}
else
- lcd_puts_scroll(LINE_X, LINE_Y+dircursor,
+ lcd_puts_scroll(LINE_X, dircursor,
dircache[i].name);
}
}
diff --git a/apps/wps.c b/apps/wps.c
index 3af73d15ed..e134535bff 100644
--- a/apps/wps.c
+++ b/apps/wps.c
@@ -45,12 +45,6 @@
#endif
#ifdef HAVE_LCD_BITMAP
-#define LINE_Y (global_settings.statusbar ? 1 : 0) /* Y position the entry-list starts at */
-#else /* HAVE_LCD_BITMAP */
-#define LINE_Y 0 /* Y position the entry-list starts at */
-#endif /* HAVE_LCD_BITMAP */
-
-#ifdef HAVE_LCD_BITMAP
#define PLAY_DISPLAY_2LINEID3 0
#define PLAY_DISPLAY_FILENAME_SCROLL 1
#define PLAY_DISPLAY_TRACK_TITLE 2
@@ -82,7 +76,6 @@ static void draw_screen(struct mp3entry* id3)
font_height = 8;
#endif
-
lcd_clear_display();
if(!id3)
{
@@ -117,14 +110,14 @@ static void draw_screen(struct mp3entry* id3)
strncpy(szArtist,szTok,sizeof(szArtist));
szArtist[sizeof(szArtist)-1] = 0;
szDelimit = strrchr(id3->path, ch);
- lcd_puts(0,LINE_Y, szArtist?szArtist:"<nothing>");
+ lcd_puts(0, 0, szArtist?szArtist:"<nothing>");
// removes the .mp3 from the end of the display buffer
szPeriod = strrchr(szDelimit, '.');
if (szPeriod != NULL)
*szPeriod = 0;
- lcd_puts_scroll(0,LINE_Y+1,(++szDelimit));
+ lcd_puts_scroll(0, 1, (++szDelimit));
break;
}
case PLAY_DISPLAY_FILENAME_SCROLL:
@@ -147,12 +140,12 @@ static void draw_screen(struct mp3entry* id3)
playlist.amount,
id3->path);
}
- lcd_puts_scroll(0,LINE_Y, buffer);
+ lcd_puts_scroll(0, 0, buffer);
break;
}
case PLAY_DISPLAY_2LINEID3:
{
- int l = LINE_Y;
+ int l = 0;
#ifdef HAVE_LCD_BITMAP
char buffer[64];
@@ -161,7 +154,7 @@ static void draw_screen(struct mp3entry* id3)
lcd_puts(0, l++, id3->album?id3->album:"");
lcd_puts(0, l++, id3->artist?id3->artist:"");
- if(LINE_Y==0&&font_height<=8) {
+ if(!global_settings.statusbar && font_height <= 8) {
if(id3->vbr)
snprintf(buffer, sizeof(buffer), "%d kbit (avg)",
id3->bitrate);
@@ -345,6 +338,11 @@ static void display_file_time(unsigned int elapsed, unsigned int length)
char buffer[32];
#ifdef HAVE_LCD_BITMAP
+ int line;
+ if(global_settings.statusbar)
+ line = 5;
+ else
+ line = 6;
snprintf(buffer,sizeof(buffer),
"Time:%3d:%02d/%d:%02d",
elapsed / 60000,
@@ -352,7 +350,7 @@ static void display_file_time(unsigned int elapsed, unsigned int length)
length / 60000,
length % 60000 / 1000 );
- lcd_puts(0, 6, buffer);
+ lcd_puts(0, line, buffer);
slidebar(0, LCD_HEIGHT-6, LCD_WIDTH, 6, elapsed*100/length, Grow_Right);
lcd_update();
#else
@@ -410,6 +408,7 @@ void display_keylock_text(bool locked)
{
lcd_puts(2, 3, "Key lock is OFF");
}
+ status_draw();
lcd_update();
#endif
@@ -435,6 +434,7 @@ void display_mute_text(bool muted)
{
lcd_puts(2, 3, "Mute is OFF");
}
+ status_draw();
lcd_update();
#endif
@@ -464,7 +464,10 @@ int wps_show(void)
lcd_icon(ICON_AUDIO, true);
lcd_icon(ICON_PARAM, false);
#else
- lcd_setmargins(0,0);
+ if(global_settings.statusbar)
+ lcd_setmargins(0, STATUSBAR_HEIGHT);
+ else
+ lcd_setmargins(0, 0);
#endif
ff_rewind = false;
@@ -876,15 +879,9 @@ int wps_show(void)
#endif
if(!keys_locked && !dont_go_to_menu && menu_button_is_down)
{
-#ifdef HAVE_LCD_BITMAP
- bool laststate=statusbar(false);
-#endif
lcd_stop_scroll();
button_set_release(old_release_mask);
main_menu();
-#ifdef HAVE_LCD_BITMAP
- statusbar(laststate);
-#endif
old_release_mask = button_set_release(RELEASE_MASK);
ignore_keyup = true;
id3 = mpeg_current_track();
@@ -905,6 +902,10 @@ int wps_show(void)
#ifdef HAVE_LCD_BITMAP
global_settings.statusbar = !global_settings.statusbar;
settings_save();
+ if(global_settings.statusbar)
+ lcd_setmargins(0, STATUSBAR_HEIGHT);
+ else
+ lcd_setmargins(0, 0);
draw_screen(id3);
#endif
break;