From 13e49f5f91cbe2b8ddb1567afb24d385c68be899 Mon Sep 17 00:00:00 2001 From: Martin Scarratt Date: Wed, 19 Jul 2006 15:30:40 +0000 Subject: [PATCH] Completed implementation of display GUI code for recording and peakmeter git-svn-id: svn://svn.rockbox.org/rockbox/trunk@10249 a1c6a512-1295-4272-9138-f99709370657 --- apps/recorder/peakmeter.c | 16 +++-- apps/recorder/recording.c | 128 ++++++++++++++++++++++++-------------- 2 files changed, 90 insertions(+), 54 deletions(-) diff --git a/apps/recorder/peakmeter.c b/apps/recorder/peakmeter.c index 2b85513cf3..cb5464f9af 100644 --- a/apps/recorder/peakmeter.c +++ b/apps/recorder/peakmeter.c @@ -1119,6 +1119,7 @@ void peak_meter_draw_trig(int xpos, int ypos) { int barstart, barend; int icon, ixpos; + int i; switch (trig_status) { case TRIG_READY: @@ -1160,8 +1161,11 @@ void peak_meter_draw_trig(int xpos, int ypos) scrollbar(xpos + ICON_PLAY_STATE_WIDTH + 1, ypos + 1, TRIGBAR_WIDTH, TRIG_HEIGHT - 2, TRIGBAR_WIDTH, barstart, barend, HORIZONTAL); - lcd_mono_bitmap(bitmap_icons_7x8[icon], ixpos, ypos, - ICON_PLAY_STATE_WIDTH, STATUSBAR_HEIGHT); + FOR_NB_SCREENS(i) + { + screens[i].mono_bitmap(bitmap_icons_7x8[icon], ixpos, ypos, + ICON_PLAY_STATE_WIDTH, STATUSBAR_HEIGHT); + } } #endif @@ -1226,7 +1230,7 @@ bool peak_meter_histogram(void) unsigned int max = 0; int y = 0; int x = 0; - lcd_clear_display(); + screens[0].clear_display(); for (i = 0; i < PEEKS_PER_DRAW_SIZE; i++) { max = MAX(max, peeks_per_redraw[i]); @@ -1234,7 +1238,7 @@ bool peak_meter_histogram(void) for (i = 0; i < PEEKS_PER_DRAW_SIZE; i++) { x = peeks_per_redraw[i] * (LCD_WIDTH - 1)/ max; - lcd_hline(0, x, y + i); + screens[0].hline(0, x, y + i); } y = PEEKS_PER_DRAW_SIZE + 1; @@ -1246,9 +1250,9 @@ bool peak_meter_histogram(void) for (i = 0; i < TICKS_PER_DRAW_SIZE; i++) { x = ticks_per_redraw[i] * (LCD_WIDTH - 1)/ max; - lcd_hline(0, x, y + i); + screens[0].hline(0, x, y + i); } - lcd_update(); + screens[0].update(); btn = button_get(true); if (btn == BUTTON_PLAY) { diff --git a/apps/recorder/recording.c b/apps/recorder/recording.c index bfe4c2e099..458861c591 100644 --- a/apps/recorder/recording.c +++ b/apps/recorder/recording.c @@ -975,8 +975,10 @@ bool recording_screen(void) if (peak_meter_trigger_status() != TRIG_OFF) { peak_meter_draw_trig(LCD_WIDTH - TRIG_WIDTH, 4 * h); - lcd_update_rect(LCD_WIDTH - (TRIG_WIDTH + 2), 4 * h, - TRIG_WIDTH + 2, TRIG_HEIGHT); + FOR_NB_SCREENS(i){ + screens[i].update_rect(LCD_WIDTH - (TRIG_WIDTH + 2), 4 * h, + TRIG_WIDTH + 2, TRIG_HEIGHT); + } } } @@ -996,7 +998,10 @@ bool recording_screen(void) { gui_syncsplash(0, true, str(LANG_DISK_FULL)); gui_syncstatusbar_draw(&statusbars, true); - lcd_update(); + + FOR_NB_SCREENS(i) + screens[i].update(); + audio_error_clear(); while(1) @@ -1026,7 +1031,8 @@ bool recording_screen(void) sound_settings_apply(); - lcd_setfont(FONT_UI); + FOR_NB_SCREENS(i) + screens[i].setfont(FONT_UI); if (have_recorded) reload_directory(); @@ -1042,34 +1048,47 @@ bool f2_rec_screen(void) { bool exit = false; bool used = false; - int w, h; + int w, h, i; char buf[32]; int button; - lcd_setfont(FONT_SYSFIXED); - lcd_getstringsize("A",&w,&h); + FOR_NB_SCREENS(i) + { + screens[i].setfont(FONT_SYSFIXED); + screens[i].getstringsize("A",&w,&h); + } while (!exit) { const char* ptr=NULL; - lcd_clear_display(); + FOR_NB_SCREENS(i) + { + screens[i].clear_display(); - /* Recording quality */ - lcd_putsxy(0, LCD_HEIGHT/2 - h*2, str(LANG_RECORDING_QUALITY)); - snprintf(buf, 32, "%d", global_settings.rec_quality); - lcd_putsxy(0, LCD_HEIGHT/2-h, buf); - lcd_mono_bitmap(bitmap_icons_7x8[Icon_FastBackward], + /* Recording quality */ + screens[i].putsxy(0, LCD_HEIGHT/2 - h*2, str(LANG_RECORDING_QUALITY)); + } + + snprintf(buf, 32, "%d", global_settings.rec_quality); + FOR_NB_SCREENS(i) + { + screens[i].putsxy(0, LCD_HEIGHT/2-h, buf); + screens[i].mono_bitmap(bitmap_icons_7x8[Icon_FastBackward], LCD_WIDTH/2 - 16, LCD_HEIGHT/2 - 4, 7, 8); + } /* Frequency */ snprintf(buf, sizeof buf, "%s:", str(LANG_RECORDING_FREQUENCY)); - lcd_getstringsize(buf,&w,&h); - lcd_putsxy((LCD_WIDTH-w)/2, LCD_HEIGHT - h*2, buf); ptr = freq_str[global_settings.rec_frequency]; - lcd_getstringsize(ptr, &w, &h); - lcd_putsxy((LCD_WIDTH-w)/2, LCD_HEIGHT - h, ptr); - lcd_mono_bitmap(bitmap_icons_7x8[Icon_DownArrow], - LCD_WIDTH/2 - 3, LCD_HEIGHT - h*3, 7, 8); + FOR_NB_SCREENS(i) + { + screens[i].getstringsize(buf,&w,&h); + screens[i].putsxy((LCD_WIDTH-w)/2, LCD_HEIGHT - h*2, buf); + screens[i].getstringsize(ptr, &w, &h); + screens[i].putsxy((LCD_WIDTH-w)/2, LCD_HEIGHT - h, ptr); + screens[i].mono_bitmap(bitmap_icons_7x8[Icon_DownArrow], + LCD_WIDTH/2 - 3, LCD_HEIGHT - h*3, 7, 8); + } /* Channel mode */ switch ( global_settings.rec_channels ) { @@ -1082,17 +1101,20 @@ bool f2_rec_screen(void) break; } - lcd_getstringsize(str(LANG_RECORDING_CHANNELS), &w, &h); - lcd_putsxy(LCD_WIDTH - w, LCD_HEIGHT/2 - h*2, - str(LANG_RECORDING_CHANNELS)); - lcd_getstringsize(str(LANG_F2_MODE), &w, &h); - lcd_putsxy(LCD_WIDTH - w, LCD_HEIGHT/2 - h, str(LANG_F2_MODE)); - lcd_getstringsize(ptr, &w, &h); - lcd_putsxy(LCD_WIDTH - w, LCD_HEIGHT/2, ptr); - lcd_mono_bitmap(bitmap_icons_7x8[Icon_FastForward], + FOR_NB_SCREENS(i) + { + screens[i].getstringsize(str(LANG_RECORDING_CHANNELS), &w, &h); + screens[i].putsxy(LCD_WIDTH - w, LCD_HEIGHT/2 - h*2, + str(LANG_RECORDING_CHANNELS)); + screens[i].getstringsize(str(LANG_F2_MODE), &w, &h); + screens[i].putsxy(LCD_WIDTH - w, LCD_HEIGHT/2 - h, str(LANG_F2_MODE)); + screens[i].getstringsize(ptr, &w, &h); + screens[i].putsxy(LCD_WIDTH - w, LCD_HEIGHT/2, ptr); + screens[i].mono_bitmap(bitmap_icons_7x8[Icon_FastForward], LCD_WIDTH/2 + 8, LCD_HEIGHT/2 - 4, 7, 8); - lcd_update(); + screens[i].update(); + } button = button_get(true); switch (button) { @@ -1150,7 +1172,8 @@ bool f2_rec_screen(void) set_gain(); settings_save(); - lcd_setfont(FONT_UI); + FOR_NB_SCREENS(i) + screens[i].setfont(FONT_UI); return false; } @@ -1161,7 +1184,7 @@ bool f3_rec_screen(void) { bool exit = false; bool used = false; - int w, h; + int w, h, i; int button; char *src_str[] = { @@ -1169,31 +1192,39 @@ bool f3_rec_screen(void) str(LANG_RECORDING_SRC_LINE), str(LANG_RECORDING_SRC_DIGITAL) }; - - lcd_setfont(FONT_SYSFIXED); - lcd_getstringsize("A",&w,&h); - + FOR_NB_SCREENS(i) + { + screens[i].setfont(FONT_SYSFIXED); + screens[i].getstringsize("A",&w,&h); + } + while (!exit) { char* ptr=NULL; - - lcd_clear_display(); - - /* Recording source */ - lcd_putsxy(0, LCD_HEIGHT/2 - h*2, str(LANG_RECORDING_SOURCE)); ptr = src_str[global_settings.rec_source]; - lcd_getstringsize(ptr, &w, &h); - lcd_putsxy(0, LCD_HEIGHT/2-h, ptr); - lcd_mono_bitmap(bitmap_icons_7x8[Icon_FastBackward], - LCD_WIDTH/2 - 16, LCD_HEIGHT/2 - 4, 7, 8); + FOR_NB_SCREENS(i) + { + screens[i].clear_display(); + + /* Recording source */ + screens[i].putsxy(0, LCD_HEIGHT/2 - h*2, str(LANG_RECORDING_SOURCE)); + + screens[i].getstringsize(ptr, &w, &h); + screens[i].putsxy(0, LCD_HEIGHT/2-h, ptr); + screens[i].mono_bitmap(bitmap_icons_7x8[Icon_FastBackward], + LCD_WIDTH/2 - 16, LCD_HEIGHT/2 - 4, 7, 8); + } /* trigger setup */ ptr = str(LANG_RECORD_TRIGGER); - lcd_getstringsize(ptr,&w,&h); - lcd_putsxy((LCD_WIDTH-w)/2, LCD_HEIGHT - h*2, ptr); - lcd_mono_bitmap(bitmap_icons_7x8[Icon_DownArrow], + FOR_NB_SCREENS(i) + { + screens[i].getstringsize(ptr,&w,&h); + screens[i].putsxy((LCD_WIDTH-w)/2, LCD_HEIGHT - h*2, ptr); + screens[i].mono_bitmap(bitmap_icons_7x8[Icon_DownArrow], LCD_WIDTH/2 - 3, LCD_HEIGHT - h*3, 7, 8); - lcd_update(); + screens[i].update(); + } button = button_get(true); switch (button) { @@ -1245,7 +1276,8 @@ bool f3_rec_screen(void) set_gain(); settings_save(); - lcd_setfont(FONT_UI); + FOR_NB_SCREENS(i) + screens[i].setfont(FONT_UI); return false; }