[MPlayer-cvslog] CVS: main/libmenu menu.c, 1.12, 1.13 menu.h, 1.1, 1.2 menu_cmdlist.c, 1.3, 1.4 menu_dvbin.c, 1.5, 1.6 menu_filesel.c, 1.12, 1.13 menu_list.c, 1.5, 1.6 menu_pt.c, 1.4, 1.5 vf_menu.c, 1.13, 1.14

Alban Bedel CVS syncmail at mplayerhq.hu
Sat Mar 25 18:32:13 CET 2006


CVS change done by Alban Bedel CVS

Update of /cvsroot/mplayer/main/libmenu
In directory mail:/var2/tmp/cvs-serv32312/libmenu

Modified Files:
	menu.c menu.h menu_cmdlist.c menu_dvbin.c menu_filesel.c 
	menu_list.c menu_pt.c vf_menu.c 
Log Message:
Allow 6 ways (up/down/left/right/ok/cancel) navigation.


Index: menu.c
===================================================================
RCS file: /cvsroot/mplayer/main/libmenu/menu.c,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -r1.12 -r1.13
--- menu.c	26 Oct 2005 00:07:43 -0000	1.12
+++ menu.c	25 Mar 2006 17:32:10 -0000	1.13
@@ -185,10 +185,14 @@
     menu->read_cmd(menu,MENU_CMD_DOWN);
     break;
   case KEY_LEFT:
+    menu->read_cmd(menu,MENU_CMD_LEFT);
+    break;
   case KEY_ESC:
     menu->read_cmd(menu,MENU_CMD_CANCEL);
     break;
   case KEY_RIGHT:
+    menu->read_cmd(menu,MENU_CMD_RIGHT);
+    break;
   case KEY_ENTER:
     menu->read_cmd(menu,MENU_CMD_OK);
     break;

Index: menu.h
===================================================================
RCS file: /cvsroot/mplayer/main/libmenu/menu.h,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- menu.h	14 Nov 2002 23:47:11 -0000	1.1
+++ menu.h	25 Mar 2006 17:32:10 -0000	1.2
@@ -31,6 +31,8 @@
 #define MENU_CMD_DOWN 1
 #define MENU_CMD_OK 2
 #define MENU_CMD_CANCEL 3
+#define MENU_CMD_LEFT 4
+#define MENU_CMD_RIGHT 5 
 
 /// Global init/uninit
 int menu_init(char* cfg_file);

Index: menu_cmdlist.c
===================================================================
RCS file: /cvsroot/mplayer/main/libmenu/menu_cmdlist.c,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- menu_cmdlist.c	26 Oct 2005 00:07:43 -0000	1.3
+++ menu_cmdlist.c	25 Mar 2006 17:32:10 -0000	1.4
@@ -27,6 +27,8 @@
 
   char* ok;
   char* cancel;
+  char* left;
+  char* right;
 };
 
 struct menu_priv_s {
@@ -47,6 +49,12 @@
 
 static void read_cmd(menu_t* menu,int cmd) {
   switch(cmd) {
+  case MENU_CMD_RIGHT:
+    if(mpriv->p.current->right) {
+      mp_cmd_t* c = mp_input_parse_cmd(mpriv->p.current->right);
+      if(c) mp_input_queue_cmd(c);
+      break;
+    } // fallback on ok if right is not defined
   case MENU_CMD_OK: {
     if(mpriv->p.current->ok) {
       mp_cmd_t* c = mp_input_parse_cmd(mpriv->p.current->ok);
@@ -54,6 +62,12 @@
 	mp_input_queue_cmd(c);
     }
    } break;
+  case MENU_CMD_LEFT:
+    if(mpriv->p.current->left) {
+      mp_cmd_t* c = mp_input_parse_cmd(mpriv->p.current->left);
+      if(c) mp_input_queue_cmd(c);
+      break;
+    } // fallback on cancel if left is not defined
   case MENU_CMD_CANCEL:
     if(mpriv->p.current->cancel) {
       mp_cmd_t* c = mp_input_parse_cmd(mpriv->p.current->cancel);
@@ -84,7 +98,7 @@
 }
 
 static int parse_args(menu_t* menu,char* args) {
-  char *element,*body, **attribs, *name, *ok, *cancel;
+  char *element,*body, **attribs, *name;
   list_entry_t* m = NULL;
   int r;
   ASX_Parser_t* parser = asx_parser_new();
@@ -110,12 +124,12 @@
       asx_free_attribs(attribs);
       continue;
     }
-    ok = asx_get_attrib("ok",attribs);
-    cancel = asx_get_attrib("cancel",attribs);
     m = calloc(1,sizeof(struct list_entry_s));
     m->p.txt = name;
-    m->ok = ok;
-    m->cancel = cancel;
+    m->ok = asx_get_attrib("ok",attribs);
+    m->cancel = asx_get_attrib("cancel",attribs);
+    m->left = asx_get_attrib("left",attribs);
+    m->right = asx_get_attrib("right",attribs);
     menu_list_add_entry(menu,m);
 
     free(element);

Index: menu_dvbin.c
===================================================================
RCS file: /cvsroot/mplayer/main/libmenu/menu_dvbin.c,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- menu_dvbin.c	24 Feb 2006 23:01:40 -0000	1.5
+++ menu_dvbin.c	25 Mar 2006 17:32:10 -0000	1.6
@@ -191,6 +191,7 @@
   char *cmd_name;
   switch(cmd)
   {
+	case MENU_CMD_RIGHT:
 	case MENU_CMD_OK:
 	{
 		elem = mpriv->p.current;
@@ -222,6 +223,7 @@
   	}
   	break;
 
+	case MENU_CMD_LEFT:
 	case MENU_CMD_CANCEL:
 	{
 		elem = mpriv->p.current;

Index: menu_filesel.c
===================================================================
RCS file: /cvsroot/mplayer/main/libmenu/menu_filesel.c,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -r1.12 -r1.13
--- menu_filesel.c	26 Oct 2005 00:07:43 -0000	1.12
+++ menu_filesel.c	25 Mar 2006 17:32:10 -0000	1.13
@@ -206,6 +206,9 @@
 static void read_cmd(menu_t* menu,int cmd) {
   mp_cmd_t* c = NULL;
   switch(cmd) {
+  case MENU_CMD_LEFT:
+    mpriv->p.current = mpriv->p.menu; // Hack : we consider that the first entry is ../
+  case MENU_CMD_RIGHT:
   case MENU_CMD_OK: {
     // Directory
     if(mpriv->p.current->d) {
@@ -261,10 +264,9 @@
 }
 
 static void read_key(menu_t* menu,int c){
-  if(c == KEY_BS) {
-    mpriv->p.current = mpriv->p.menu; // Hack : we consider that the first entry is ../
-    read_cmd(menu,MENU_CMD_OK);
-  } else
+  if(c == KEY_BS)
+    read_cmd(menu,MENU_CMD_LEFT);
+  else
     menu_list_read_key(menu,c,1);
 }
 

Index: menu_list.c
===================================================================
RCS file: /cvsroot/mplayer/main/libmenu/menu_list.c,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- menu_list.c	26 Oct 2005 00:07:43 -0000	1.5
+++ menu_list.c	25 Mar 2006 17:32:10 -0000	1.6
@@ -129,6 +129,7 @@
    } else {
      mpriv->current = mpriv->menu;
    } break;
+  case MENU_CMD_LEFT:
   case MENU_CMD_CANCEL:
     menu->show = 0;
     menu->cl = 1;
@@ -224,3 +225,4 @@
   mpriv->menu = mpriv->current = NULL;
 
 }
+

Index: menu_pt.c
===================================================================
RCS file: /cvsroot/mplayer/main/libmenu/menu_pt.c,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- menu_pt.c	26 Oct 2005 00:07:43 -0000	1.4
+++ menu_pt.c	25 Mar 2006 17:32:10 -0000	1.5
@@ -50,6 +50,7 @@
 
 static void read_cmd(menu_t* menu,int cmd) {
   switch(cmd) {
+  case MENU_CMD_RIGHT:
   case MENU_CMD_OK: {
     int d = 1;
     char str[15];

Index: vf_menu.c
===================================================================
RCS file: /cvsroot/mplayer/main/libmenu/vf_menu.c,v
retrieving revision 1.13
retrieving revision 1.14
diff -u -r1.13 -r1.14
--- vf_menu.c	21 Mar 2006 22:31:49 -0000	1.13
+++ vf_menu.c	25 Mar 2006 17:32:10 -0000	1.14
@@ -105,6 +105,10 @@
       menu_read_cmd(priv->current,MENU_CMD_UP);
     else if(strcmp(arg,"down") == 0)
       menu_read_cmd(priv->current,MENU_CMD_DOWN);
+    else if(strcmp(arg,"left") == 0)
+      menu_read_cmd(priv->current,MENU_CMD_LEFT);
+    else if(strcmp(arg,"right") == 0)
+      menu_read_cmd(priv->current,MENU_CMD_RIGHT);
     else if(strcmp(arg,"ok") == 0)
       menu_read_cmd(priv->current,MENU_CMD_OK);
     else if(strcmp(arg,"cancel") == 0)




More information about the MPlayer-cvslog mailing list