Mercurial > mplayer.hg
changeset 17945:98f4e3704a76
Allow 6 ways (up/down/left/right/ok/cancel) navigation.
author | albeu |
---|---|
date | Sat, 25 Mar 2006 17:32:10 +0000 |
parents | db2c775fb2b9 |
children | 0afe12256464 |
files | libmenu/menu.c libmenu/menu.h libmenu/menu_cmdlist.c libmenu/menu_dvbin.c libmenu/menu_filesel.c libmenu/menu_list.c libmenu/menu_pt.c libmenu/vf_menu.c |
diffstat | 8 files changed, 40 insertions(+), 9 deletions(-) [+] |
line wrap: on
line diff
--- a/libmenu/menu.c Sat Mar 25 13:39:47 2006 +0000 +++ b/libmenu/menu.c Sat Mar 25 17:32:10 2006 +0000 @@ -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;
--- a/libmenu/menu.h Sat Mar 25 13:39:47 2006 +0000 +++ b/libmenu/menu.h Sat Mar 25 17:32:10 2006 +0000 @@ -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);
--- a/libmenu/menu_cmdlist.c Sat Mar 25 13:39:47 2006 +0000 +++ b/libmenu/menu_cmdlist.c Sat Mar 25 17:32:10 2006 +0000 @@ -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);
--- a/libmenu/menu_dvbin.c Sat Mar 25 13:39:47 2006 +0000 +++ b/libmenu/menu_dvbin.c Sat Mar 25 17:32:10 2006 +0000 @@ -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;
--- a/libmenu/menu_filesel.c Sat Mar 25 13:39:47 2006 +0000 +++ b/libmenu/menu_filesel.c Sat Mar 25 17:32:10 2006 +0000 @@ -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); }
--- a/libmenu/menu_list.c Sat Mar 25 13:39:47 2006 +0000 +++ b/libmenu/menu_list.c Sat Mar 25 17:32:10 2006 +0000 @@ -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; } +
--- a/libmenu/menu_pt.c Sat Mar 25 13:39:47 2006 +0000 +++ b/libmenu/menu_pt.c Sat Mar 25 17:32:10 2006 +0000 @@ -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];
--- a/libmenu/vf_menu.c Sat Mar 25 13:39:47 2006 +0000 +++ b/libmenu/vf_menu.c Sat Mar 25 17:32:10 2006 +0000 @@ -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)