Rockbox.org home
release
dev builds
extras
themes manual
wiki
device status forums
mailing lists
IRC bugs
patches
dev guide



Rockbox mail archive

Subject: [PATCH] Minor wps.c changes
From: Magnus Holmgren (lear_at_algonet.se)
Date: 2002-09-07


Hi,

The attached patch fixes a couple of small details in wps.c and adds
some information in the player ID3 info screen. The following things are
changed:

 * Make sure wps_refresh and status_draw are called frequently (i.e., a
couple of times per second) when changing volume and showing the ID3
info screen, so that things that should update (play time, charging
indicator) really do update.

 * When an USB cable is detected, turn off various icons on the display.

 * In the player ID3 info screen, the "header screen" ("-ID3 info-") is
removed, since it's not important and I find it annoying. :) Also, added
track number and playlist position/size. Also, corrected the frequency
text (it shows Hz, not kHz).

 * Turn off the (player) audio icon when going to the menu.

-- 
Magnus Holmgren

Index: apps/wps.c
===================================================================
RCS file: /cvsroot/rockbox/apps/wps.c,v
retrieving revision 1.140
diff -u -b -r1.140 wps.c
--- apps/wps.c 6 Sep 2002 05:33:57 -0000 1.140
+++ apps/wps.c 7 Sep 2002 08:41:39 -0000
@@ -76,7 +76,6 @@
                 if(global_settings.volume > mpeg_sound_max(SOUND_VOLUME))
                     global_settings.volume = mpeg_sound_max(SOUND_VOLUME);
                 mpeg_sound_set(SOUND_VOLUME, global_settings.volume);
- wps_refresh(id3,0,false);
                 settings_save();
                 break;
 
@@ -86,7 +85,6 @@
                 if(global_settings.volume < mpeg_sound_min(SOUND_VOLUME))
                     global_settings.volume = mpeg_sound_min(SOUND_VOLUME);
                 mpeg_sound_set(SOUND_VOLUME, global_settings.volume);
- wps_refresh(id3,0,false);
                 settings_save();
                 break;
 
@@ -102,13 +100,13 @@
         lcd_puts(0, 0, buffer);
 #else
         lcd_puts(2, 3, buffer);
- lcd_update();
 #endif
+ wps_refresh(id3, 0, false);
+ status_draw();
+
         if (!exit)
- button = button_get(true);
+ button = button_get_w_tmo(HZ/5);
     }
- status_draw();
- wps_refresh(id3,0,true);
 }
 #endif
 
@@ -171,10 +169,17 @@
     DEBUGF("wps got SYS_USB_CONNECTED\n");
     usb_acknowledge(SYS_USB_CONNECTED_ACK);
                     
+#ifdef HAVE_LCD_CHARCELLS
+ lcd_icon(ICON_PARAM, false);
+ lcd_icon(ICON_AUDIO, false);
+#endif
+ status_set_playmode(STATUS_STOP);
+
     /* Wait until the USB cable is extracted again */
     usb_wait_for_disconnect(&button_queue);
 
     backlight_time(global_settings.backlight);
+
 #endif
 }
 
@@ -183,15 +188,12 @@
 {
     int button;
     int menu_pos = 0;
- int menu_max = 6;
+ int menu_max = 8;
     bool exit = false;
- char scroll_text[MAX_PATH];
+ char scroll_text[32];
 
     lcd_stop_scroll();
     lcd_clear_display();
- lcd_puts(0, 0, "-ID3 Info- ");
- lcd_puts(0, 1, "--Screen-- ");
- sleep(HZ);
  
     while (!exit)
     {
@@ -217,6 +219,22 @@
                 break;
 
             case 3:
+ lcd_puts(0, 0, "[Tracknum]");
+
+ if (id3->tracknum)
+ {
+ snprintf(scroll_text,sizeof(scroll_text), "%d",
+ id3->tracknum);
+ lcd_puts_scroll(0, 1, scroll_text);
+ }
+ else
+ {
+ lcd_puts_scroll(0, 1, "<no tracknum>");
+ }
+
+ break;
+
+ case 4:
                 lcd_puts(0, 0, "[Length]");
                 snprintf(scroll_text,sizeof(scroll_text), "%d:%02d",
                          id3->length / 60000,
@@ -224,28 +242,36 @@
                 lcd_puts(0, 1, scroll_text);
                 break;
 
- case 4:
+ case 5:
+ lcd_puts(0, 0, "[Playlist]");
+ snprintf(scroll_text,sizeof(scroll_text), "%d/%d",
+ id3->index + 1, playlist.amount);
+ lcd_puts_scroll(0, 1, scroll_text);
+ break;
+
+ case 6:
                 lcd_puts(0, 0, "[Bitrate]");
                 snprintf(scroll_text,sizeof(scroll_text), "%d kbps",
                          id3->bitrate);
                 lcd_puts(0, 1, scroll_text);
                 break;
 
- case 5:
+ case 7:
                 lcd_puts(0, 0, "[Frequency]");
- snprintf(scroll_text,sizeof(scroll_text), "%d kHz",
+ snprintf(scroll_text,sizeof(scroll_text), "%d Hz",
                         id3->frequency);
                 lcd_puts(0, 1, scroll_text);
                 break;
 
- case 6:
+ case 8:
                 lcd_puts(0, 0, "[Path]");
                 lcd_puts_scroll(0, 1, id3->path);
                 break;
         }
         lcd_update();
 
- button = button_get(true);
+ button = button_get_w_tmo(HZ/5);
+ status_draw();
 
         switch(button)
         {
@@ -512,7 +538,13 @@
                 if ( !last_button ) {
                     lcd_stop_scroll();
                     button_set_release(old_release_mask);
+#ifdef HAVE_LCD_CHARCELLS
+ lcd_icon(ICON_AUDIO, false);
+#endif
                     main_menu();
+#ifdef HAVE_LCD_CHARCELLS
+ lcd_icon(ICON_AUDIO, true);
+#endif
 #ifdef HAVE_LCD_BITMAP
                     if(global_settings.statusbar)
                         lcd_setmargins(0, STATUSBAR_HEIGHT);



Page was last modified "Jan 10 2012" The Rockbox Crew
aaa