Rockbox.org home
Downloads
Release release
Dev builds dev builds
Extras extras
themes themes
Documentation
Manual manual
Wiki wiki
Device Status device status
Support
Forums forums
Mailing lists mailing lists
IRC IRC
Development
Bugs bugs
Patches patches
Dev Guide dev guide
Search



Donate

Rockbox Technical Forums


Login with username, password and session length
Home Help Search Staff List Login Register
News:

Rockbox Ports are now being developed for various digital audio players!

+  Rockbox Technical Forums
|-+  Rockbox Development
| |-+  Starting Development and Compiling
| | |-+  cpchan's Menu Patch Expliantion?
« previous next »
  • Print
Pages: [1]

Author Topic: cpchan's Menu Patch Expliantion?  (Read 1412 times)

Offline Dajax

  • Member
  • *
  • Posts: 2
cpchan's Menu Patch Expliantion?
« on: February 09, 2008, 08:53:21 PM »
I was wondering if there is a kind soul to help explian this

It's cpchan's Patch for Custom Main Menu
and well i'm not to savy with coding but i was wondering how it works can someone please explain,


Code: [Select]
diff -Naur rockbox-modified/apps/lang/english.lang rockbox-experimental/apps/lang/english.lang
--- rockbox-modified/apps/lang/english.lang 2007-11-07 09:18:04.000000000 -0500
+++ rockbox-experimental/apps/lang/english.lang 2007-11-07 10:18:57.000000000 -0500
@@ -383,13 +383,13 @@
   desc: main menu title
   user:
   
-    *: "Files"
+    *: "Manage Files"
   
   
-    *: "Files"
+    *: "Manage Files"
   

   
-    *: "Files"
+    *: "Manage Files"
   

 
 
@@ -483,20 +483,6 @@
   
 

 
-  id: LANG_PLAYLISTS
-  desc: in the main menu and  file vew setting
-  user:
-  
-    *: "Playlists"
-  
-  
-    *: "Playlists"
-  

-  
-    *: "Playlists"
-  

-

-
   id: LANG_PLUGINS
   desc: in the main menu
   user:
@@ -7146,13 +7132,13 @@
   desc: in onplay menu
   user:
   
-    *: "Playlist Catalog"
+    *: "Playlists Actions"
   
   
-    *: "Playlist Catalog"
+    *: "Playlists Actions"
   

   
-    *: "Playlist Catalog"
+    *: "Playlist Catalog Actions"
   

 

 
@@ -7427,13 +7413,13 @@
   desc: Used when you need to say playlist, also voiced
   user:
   
-    *: "Playlist Actions"
+    *: "Playlist"
   
   
-    *: "Playlist Actions"
+    *: "Playlist"
   

   
-    *: "Playlist Actions"
+    *: "Playlists Options"
   

 

 
@@ -10769,15 +10755,15 @@
   user:
   
     *: none
-    lcd_bitmap: "Playlists"
+    lcd_bitmap: "Playlists Options"
   
   
     *: none
-    lcd_bitmap: "Playlists"
+    lcd_bitmap: "Playlists Options"
   

   
     *: none
-    lcd_bitmap: "Playlists"
+    lcd_bitmap: "Playlists Options"
   

 

 
@@ -12055,3 +12041,87 @@
     *: "title and time"
   
 

+
+  id: LANG_MUSIC
+  desc: in root menu
+  user:
+  
+    *: "Music"
+  
+  
+    *: "Music"
+  

+  
+    *: "Music"
+  

+

+
+  id: LANG_PLAYLISTS
+  desc: in root menu
+  user:
+  
+    *: "Playlist Catalog"
+  
+  
+    *: "Playlist Catalog"
+  

+  
+    *: "Playlist Catalog"
+  

+

+
+  id: LANG_PLAYLIST_ACTIONS
+  desc: in root menu
+  user:
+  
+    *: "Playlist Actions"
+  
+  
+    *: "Playlist Action"
+  

+  
+    *: "Playlist Actions"
+  

+

+
+  id: LANG_PLAYLISTS_SETTINGS
+  desc: in root menu
+  user:
+  
+    *: "Playlists"
+  
+  
+    *: "Playlists"
+  

+  
+    *: "Playlists"
+  

+

+
+  id: LANG_OTHER_AUDIO
+  desc: in root menu
+  user:
+  
+    *: "Other Audios"
+  
+  
+    *: "Other Audios"
+  

+  
+    *: "Other Audios"
+  

+

+
+  id: LANG_TAGS_BROWSER
+  desc: in root menu
+  user:
+  
+    *: "Browse Tags"
+  
+  
+    *: "Browse Tags"
+  

+  
+    *: "Browse Tags"
+  

+

diff -Naur rockbox-modified/apps/menus/playlist_menu.c rockbox-experimental/apps/menus/playlist_menu.c
--- rockbox-modified/apps/menus/playlist_menu.c 2007-11-07 09:18:04.000000000 -0500
+++ rockbox-experimental/apps/menus/playlist_menu.c 2007-11-07 10:23:55.000000000 -0500
@@ -74,16 +74,15 @@
 MENUITEM_FUNCTION(save_playlist, MENU_FUNC_USEPARAM, ID2P(LANG_SAVE_DYNAMIC_PLAYLIST),
                          (int(*)(void*))save_playlist_screen,
                         NULL, NULL, Icon_NOICON);
-MENUITEM_FUNCTION(catalog, 0, ID2P(LANG_CATALOG_VIEW),
+MENUITEM_FUNCTION(catalog, 0, ID2P(LANG_PLAYLISTS),
                   (int(*)(void))catalog_view_playlists,
                    NULL, NULL, Icon_NOICON);
 MENUITEM_SETTING(recursive_dir_insert, &global_settings.recursive_dir_insert, NULL);
 MENUITEM_SETTING(warn_on_erase, &global_settings.warnon_erase_dynplaylist, NULL);
-
-MAKE_MENU(playlist_settings, ID2P(LANG_PLAYLISTS), NULL,
+MAKE_MENU(playlist_settings, ID2P(LANG_PLAYLISTS_SETTINGS), NULL,
           Icon_Playlist,
           &recursive_dir_insert, &warn_on_erase);
-MAKE_MENU(playlist_options, ID2P(LANG_PLAYLISTS), NULL,
+MAKE_MENU(playlist_options, ID2P(LANG_CATALOG), NULL,
           Icon_Playlist,
           &create_playlist_item, &view_playlist, &save_playlist, &catalog);
 
diff -Naur rockbox-modified/apps/onplay.c rockbox-experimental/apps/onplay.c
--- rockbox-modified/apps/onplay.c 2007-11-07 09:30:36.000000000 -0500
+++ rockbox-experimental/apps/onplay.c 2007-11-07 10:18:57.000000000 -0500
@@ -70,6 +70,8 @@
 #endif
 #include "root_menu.h"
 
+#include "root_menu.h"
+
 static int context;
 static char* selected_file = NULL;
 static int selected_file_attr = 0;
@@ -95,6 +97,10 @@
 
 static int bookmark_menu_callback(int action,
                                   const struct menu_item_ex *this_item);
+
+MENUITEM_RETURNVALUE(playlists_browser, ID2P(LANG_PLAYLISTS), GO_TO_PLAYLISTS,
+                        NULL, Icon_Audio);
+
 MENUITEM_FUNCTION(bookmark_create_menu_item, 0,
                   ID2P(LANG_BOOKMARK_MENU_CREATE),
                   bookmark_create_menu, NULL, NULL, Icon_Bookmark);
@@ -239,17 +245,20 @@
         false);
 }
 
+static bool view_playlists_catalog(void)
+{
+    return rockbox_browse("/Playlist/",SHOW_SUPPORTED);
+}
+
 static bool cat_add_to_a_new_playlist(void)
 {
     return catalog_add_to_a_playlist(selected_file, selected_file_attr, true);
 }
 
-
 static int cat_playlist_callback(int action,
                                  const struct menu_item_ex *this_item);
 MENUITEM_FUNCTION(cat_view_lists, 0, ID2P(LANG_CATALOG_VIEW),
-                  catalog_view_playlists, 0, cat_playlist_callback,
-                  Icon_Playlist);
+                  view_playlists_catalog, 0, NULL, Icon_Playlist);
 MENUITEM_FUNCTION(cat_add_to_list, 0, ID2P(LANG_CATALOG_ADD_TO),
                   cat_add_to_a_playlist, 0, NULL, Icon_Playlist);
 MENUITEM_FUNCTION(cat_add_to_new, 0, ID2P(LANG_CATALOG_ADD_TO_NEW),
diff -Naur rockbox-modified/apps/playlist.h rockbox-experimental/apps/playlist.h
--- rockbox-modified/apps/playlist.h 2007-11-07 09:18:04.000000000 -0500
+++ rockbox-experimental/apps/playlist.h 2007-11-07 10:18:57.000000000 -0500
@@ -30,7 +30,7 @@
 #define PLAYLIST_ATTR_SKIPPED   0x04
 #define PLAYLIST_MAX_CACHE      16
 
-#define DEFAULT_PLAYLIST_DIR "/Playlists"
+#define DEFAULT_PLAYLIST_DIR "/Playlist"
 #define DEFAULT_DYNAMIC_PLAYLIST_NAME "/dynamic.m3u8"
 
 enum playlist_command {
diff -Naur rockbox-modified/apps/playlist_catalog.c rockbox-experimental/apps/playlist_catalog.c
--- rockbox-modified/apps/playlist_catalog.c 2007-11-07 09:18:04.000000000 -0500
+++ rockbox-experimental/apps/playlist_catalog.c 2007-11-07 10:18:57.000000000 -0500
@@ -41,6 +41,7 @@
 #include "debug.h"
 
 #define PLAYLIST_CATALOG_CFG ROCKBOX_DIR "/playlist_catalog.config"
+#define PLAYLIST_CATALOG_DEFAULT_DIR "/Playlist"
 #define MAX_PLAYLISTS 400
 #define PLAYLIST_DISPLAY_COUNT 10
 
@@ -422,6 +423,9 @@
 
 bool catalog_view_playlists(void)
 {
+    int filter = SHOW_SUPPORTED;
+    char folder[MAX_PATH] = "/";
+
     if (initialize_catalog() == -1)
         return false;
 
@@ -429,6 +433,7 @@
         return false;
 
     return true;
+
 }
 
 bool catalog_add_to_a_playlist(char* sel, int sel_attr, bool new_playlist)
diff -Naur rockbox-modified/apps/root_menu.c rockbox-experimental/apps/root_menu.c
--- rockbox-modified/apps/root_menu.c 2007-11-07 09:18:04.000000000 -0500
+++ rockbox-experimental/apps/root_menu.c 2007-11-07 10:18:57.000000000 -0500
@@ -217,6 +217,18 @@
             filter = SHOW_SUPPORTED;
             snprintf(folder, MAX_PATH, "%s/", SHORTCUTS_DIR);
         break;        
+        case GO_TO_MUSIC:
+            filter = SHOW_SUPPORTED;
+            snprintf(folder, MAX_PATH, "%s/", MUSIC_DIR);
+        break;
+        case GO_TO_OTHER_AUDIO:
+            filter = SHOW_SUPPORTED;
+            snprintf(folder, MAX_PATH, "%s/", OTHER_AUDIO_DIR);
+        break;
+        case GO_TO_PLAYLISTS:
+            filter = SHOW_SUPPORTED;
+            snprintf(folder, MAX_PATH, "%s/", PLAYLISTS_DIR);
+        break;                
     }
     ret_val = rockbox_browse(folder, filter);
     switch ((intptr_t)param)
@@ -363,12 +375,24 @@
     [GO_TO_PHOTOS] = { browser, (void*)GO_TO_PHOTOS, NULL },    
     [GO_TO_EBOOKS] = { browser, (void*)GO_TO_EBOOKS, NULL },
     [GO_TO_SHORTCUTS] = { browser, (void*)GO_TO_SHORTCUTS, NULL },
+    [GO_TO_MUSIC] = { browser, (void*)GO_TO_MUSIC, NULL },    
+    [GO_TO_OTHER_AUDIO] = { browser, (void*)GO_TO_OTHER_AUDIO, NULL },    
+    [GO_TO_PLAYLISTS] = { browser, (void*)GO_TO_PLAYLISTS, NULL },    
     
 };
 static const int nb_items = sizeof(items)/sizeof(*items);
 
 int item_callback(int action, const struct menu_item_ex *this_item) ;
 
+MENUITEM_RETURNVALUE(playlists_browser, ID2P(LANG_PLAYLISTS), GO_TO_PLAYLISTS,
+                        NULL, Icon_Playlist);
+
+MENUITEM_RETURNVALUE(music_browser, ID2P(LANG_MUSIC), GO_TO_MUSIC,
+                        NULL, Icon_Audio);
+
+MENUITEM_RETURNVALUE(other_audio_browser, ID2P(LANG_OTHER_AUDIO), GO_TO_OTHER_AUDIO,
+                        NULL, Icon_Folder);
+
 MENUITEM_RETURNVALUE(file_browser, ID2P(LANG_DIR_BROWSER), GO_TO_FILEBROWSER,
                         NULL, Icon_file_view_menu);
 #ifdef HAVE_TAGCACHE
@@ -408,18 +432,17 @@
                         Icon_Bookmark);
 MAKE_MENU(root_menu_, ID2P(LANG_ROCKBOX_TITLE),
             item_callback, Icon_Rockbox,
-            &bookmarks, &file_browser,
+            &playlists_browser, &bookmarks, &playlist_options, &music_browser,
 #ifdef HAVE_TAGCACHE
             &db_browser,
 #endif
-            &wps_item, &menu_,
-#ifdef HAVE_RECORDING
-            &rec,
-#endif
 #if CONFIG_TUNER
             &fm,
 #endif
-            &playlist_options, &vids_browser, &photos_browser, &ebooks_browser, &rocks_browser, &info_menu        );
+#ifdef HAVE_RECORDING
+            &rec,
+#endif
+            &other_audio_browser, &vids_browser, &photos_browser, &ebooks_browser, &rocks_browser, &file_browser, &info_menu, &menu_        );
 
 int item_callback(int action, const struct menu_item_ex *this_item)
 {
diff -Naur rockbox-modified/apps/root_menu.h rockbox-experimental/apps/root_menu.h
--- rockbox-modified/apps/root_menu.h 2007-11-07 09:18:04.000000000 -0500
+++ rockbox-experimental/apps/root_menu.h 2007-11-07 10:18:57.000000000 -0500
@@ -46,6 +46,9 @@
     /* Do Not add any items above here unless you want it to be able to
        be the "start screen" after a boot up. The setting in settings_list.c
        will need editing if this is the case. */
+    GO_TO_PLAYLISTS,
+    GO_TO_MUSIC,
+    GO_TO_OTHER_AUDIO,    
     GO_TO_BROWSEPLUGINS,
     GO_TO_CUSTOM_MENU,
     GO_TO_VIDEOS,
diff -Naur rockbox-modified/apps/settings.h rockbox-experimental/apps/settings.h
--- rockbox-modified/apps/settings.h 2007-11-07 09:18:04.000000000 -0500
+++ rockbox-experimental/apps/settings.h 2007-11-07 10:18:57.000000000 -0500
@@ -69,7 +69,7 @@
 #define VIEWERS_DIR         PLUGIN_DIR "/viewers"
 
 #define BACKDROP_DIR ROCKBOX_DIR "/backdrops"
-#define REC_BASE_DIR "/"
+#define REC_BASE_DIR "/other_audio/recordings"
 #define EQS_DIR     ROCKBOX_DIR "/eqs"
 #define CODECS_DIR  ROCKBOX_DIR "/codecs"
 #define RECPRESETS_DIR  ROCKBOX_DIR "/recpresets"
@@ -78,6 +78,9 @@
 #define PHOTOS_DIR "/photo"
 #define EBOOKS_DIR "/ebooks"
 #define SHORTCUTS_DIR "/_Shortcuts"
+#define MUSIC_DIR "/musica"
+#define OTHER_AUDIO_DIR "/other_audio"
+#define PLAYLISTS_DIR "/playlist"
 
 #define VIEWERS_CONFIG      ROCKBOX_DIR "/viewers.config"
 #define CONFIGFILE          ROCKBOX_DIR "/config.cfg"
diff -Naur rockbox-modified/tools/svnversion.sh rockbox-experimental/tools/svnversion.sh
--- rockbox-modified/tools/svnversion.sh 2007-11-07 09:18:05.000000000 -0500
+++ rockbox-experimental/tools/svnversion.sh 2007-11-07 10:18:57.000000000 -0500
@@ -36,6 +36,6 @@
         SVNVER=`svnversion_safe $TOP/tools`;
     fi
 fi
-VERSION=$SVNVER-cpchan-branch-`date -u +%y%m%d`
+VERSION=$SVNVER-cpchan-menu-branch-`date -u +%y%m%d`
 echo $VERSION
 


Thanks
Dajax
Logged

Offline Dajax

  • Member
  • *
  • Posts: 2
Re: cpchan's Menu Patch Expliantion?
« Reply #1 on: February 09, 2008, 09:25:24 PM »
sorry for double post..

but what im truely asking for is just an explination of how to move items around on the root menu

Like:

Music
Video
Photo
Ebook
Setting
Files
System

etc...
Logged

Offline nls

  • Developer
  • Member
  • *
  • Posts: 460
Re: cpchan's Menu Patch Expliantion?
« Reply #2 on: February 10, 2008, 04:08:40 AM »
see apps/root_menu.c:395
MAKE_MENU(root_menu_, ID2P(LANG_ROCKBOX_TITLE), ...
change the order of the items to change the order in the menu, simple!  ;)
Logged

  • Print
Pages: [1]
« previous next »
+  Rockbox Technical Forums
|-+  Rockbox Development
| |-+  Starting Development and Compiling
| | |-+  cpchan's Menu Patch Expliantion?
 

  • SMF 2.0.17 | SMF © 2019, Simple Machines
  • Rockbox Privacy Policy
  • XHTML
  • RSS
  • WAP2

Page created in 0.064 seconds with 15 queries.