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



Rockbox mail archive

Subject: Experiment patch - UI-mode
From: Mats Lidell (matsl_at_contactor.se)
Date: 2002-06-23


Hi,

A small patch (should apply nicely to sources before the weekend) with
three things.

Experimental stuff. Useful!?
- m3u-mode. Only show m3u files in dir browser.
- Use a separator string in the scroll. ' | '

Bug!?
- scroll_speed. Use and keep the actual scroll speed when adjusting it
  in the menu.

--- ./firmware/drivers/lcd.c.~1~ Thu Jun 20 11:18:05 2002
+++ ./firmware/drivers/lcd.c Sun Jun 23 00:25:07 2002
@@ -113,9 +113,9 @@
 
 static void scroll_thread(void);
 static char scroll_stack[0x100];
-static char scroll_speed = 8; /* updates per second */
-static char scroll_spacing = 3; /* spaces between end and start of text */
-
+static char scroll_speed = 7; /* updates per second */
+static char scroll_separator[] = " | "; /* Character string between stop and start of scroll*/
+static char scroll_spacing = 3; /* Length of above */
 
 static struct scrollinfo scroll; /* only one scroll line at the moment */
 static int scroll_count = 0;
@@ -924,9 +924,15 @@
     scroll_speed = speed;
 }
 
+int lcd_get_scroll_speed()
+{
+ return scroll_speed;
+}
+
 static void scroll_thread(void)
 {
     struct scrollinfo* s = &scroll;
+ int scroll_sep_pos = 0;
 
     while ( 1 ) {
         if ( !scroll_count ) {
@@ -946,11 +952,13 @@
                 s->offset++;
             }
             else {
- s->line[s->space - 1] = ' ';
+ s->line[s->space - 1] = scroll_separator[scroll_sep_pos++];
                 if ( s->offset < s->textlen + scroll_spacing - 1 )
                     s->offset++;
- else
+ else {
                     s->offset = 0;
+ scroll_sep_pos = 0;
+ }
             }
 
             lcd_puts(s->startx,s->starty,s->line);
--- ./firmware/drivers/lcd.h.~1~ Mon Jun 10 14:36:54 2002
+++ ./firmware/drivers/lcd.h Sun Jun 23 00:24:22 2002
@@ -32,6 +32,7 @@
 extern void lcd_puts_scroll(int x, int y, char* string );
 extern void lcd_stop_scroll(void);
 extern void lcd_scroll_speed( int speed );
+extern int lcd_get_scroll_speed(void);
 
 #if defined(SIMULATOR) || defined(HAVE_LCD_BITMAP)
   extern void lcd_update(void);
--- ./apps/menu.c.~1~ Mon Jun 17 14:11:16 2002
+++ ./apps/menu.c Wed Jun 19 22:36:45 2002
@@ -5,7 +5,7 @@
  * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
  * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
  * \/ \/ \/ \/ \/
- * $Id: menu.c,v 1.19 2002/06/16 23:27:58 adiamas Exp $
+ * $Id: menu.c,v 1.20 2002/06/19 13:00:14 bagder Exp $
  *
  * Copyright (C) 2002 Robert E. Hak
  *
@@ -60,16 +60,20 @@
         lcd_bitmap ( bitmap_icons_6x8[Cursor],
                      x*6, y*8, 4, 8, true);
 #elif defined(SIMULATOR)
+ /* player simulator */
         unsigned char cursor[] = { 0x7f, 0x3e, 0x1c, 0x08 };
- lcd_bitmap ( cursor, x*6, y*8, 4, 8, true);
+ lcd_bitmap ( cursor, x*6, 8+y*8, 4, 8, true);
 #else
         lcd_puts(x, y, CURSOR_CHAR);
 #endif
     }
     else {
-#if defined(HAVE_LCD_BITMAP) || defined(SIMULATOR)
+#if defined(HAVE_LCD_BITMAP)
         /* I use xy here since it needs to disregard the margins */
         lcd_clearrect (x*6, y*8, 4, 8);
+#elif defined(SIMULATOR)
+ /* player simulator in action */
+ lcd_clearrect (x*6, 8+y*8, 4, 8);
 #else
         lcd_puts(x, y, " ");
 #endif
--- ./apps/tree.c.~1~ Wed Jun 19 22:36:46 2002
+++ ./apps/tree.c Sat Jun 22 23:46:05 2002
@@ -39,6 +39,8 @@
 #include "icons.h"
 #endif
 
+bool m3u_mode = false;
+
 #define MAX_FILES_IN_DIR 200
 #define TREE_MAX_FILENAMELEN 128
 #define MAX_DIR_LEVELS 10
@@ -107,10 +109,10 @@
                    TREE_MAX_FILENAMELEN);
 }
 
+char lastdir[256] = {0};
+
 static int showdir(char *path, int start)
 {
- static char lastdir[256] = {0};
-
 #ifdef HAVE_LCD_BITMAP
     int icon_type = 0;
 #endif
@@ -130,6 +132,10 @@
                 /* skip names starting with a dot */
                 i--;
                 continue;
+ } else if (m3u_mode && 0 != strcasecmp(&entry->d_name[strlen(entry->d_name)-4], ".m3u")) {
+ /* Skip all other entries except m3u */
+ i--;
+ continue;
             }
             dircache[i].file = !(entry->attribute & ATTR_DIRECTORY);
             strncpy(dircache[i].name,entry->d_name,TREE_MAX_FILENAMELEN);
--- ./apps/main_menu.c.~1~ Mon Jun 17 14:11:16 2002
+++ ./apps/main_menu.c Sun Jun 23 00:22:53 2002
@@ -124,7 +124,7 @@
 void scroll_speed(void)
 {
     bool done=false;
- int speed=10;
+ int speed=lcd_get_scroll_speed();
     char str[16];
 
     lcd_clear_display();
@@ -194,11 +194,39 @@
     }
 }
 
+void ui_mode(void)
+{
+ bool done = false;
+
+ lcd_clear_display();
+ lcd_puts(0,0,"[UI]");
+
+ while ( !done ) {
+ lcd_puts(0,1, m3u_mode ? "m3u" : "all");
+ lcd_update();
+
+ switch ( button_get(true) ) {
+#ifdef HAVE_RECORDER_KEYPAD
+ case BUTTON_LEFT:
+#else
+ case BUTTON_STOP:
+#endif
+ done = true;
+ break;
+
+ default:
+ m3u_mode = !m3u_mode;
+ lastdir[0] = 0; /* Refresh dir listing */
+ break;
+ }
+ }
+}
+
 void main_menu(void)
 {
     int m;
     enum {
- Tetris, Boxes, Bounce, Sokoban, Version, Sound, Scroll, Shuffle
+ Tetris, Boxes, Bounce, Sokoban, Version, Sound, Scroll, Shuffle, UI
     };
 
     /* main menu */
@@ -206,6 +234,7 @@
         { Shuffle, "Shuffle", shuffle },
         { Sound, "Sound", sound_menu },
         { Scroll, "Scroll speed", scroll_speed },
+ { UI, "UI mode", ui_mode },
 #ifdef HAVE_LCD_BITMAP
         { Tetris, "Tetris", tetris },
         { Boxes, "Boxes", boxes },
--- ./apps/tree.h.~1~ Thu May 16 14:53:41 2002
+++ ./apps/tree.h Sat Jun 22 23:50:26 2002
@@ -24,4 +24,7 @@
 void browse_root(void);
 bool dirbrowse(char *root);
 
+extern bool m3u_mode;
+extern char lastdir[256];
+
 #endif

Yours

-- 
%% Mats



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