summaryrefslogtreecommitdiffstats
path: root/libmenu/menu_cmdlist.c
diff options
context:
space:
mode:
authorUoti Urpala <uau@mplayer2.org>2011-10-25 07:05:47 +0300
committerUoti Urpala <uau@mplayer2.org>2011-10-25 07:05:47 +0300
commit8b5efd6455370c02211f9fec2a3dbb74f5d0fcbc (patch)
tree4a8222fbf5ed2c8e7b7766435820183ff641c97d /libmenu/menu_cmdlist.c
parentb200583403219136363b755afab2b05c0937a928 (diff)
downloadmpv-8b5efd6455370c02211f9fec2a3dbb74f5d0fcbc.tar.bz2
mpv-8b5efd6455370c02211f9fec2a3dbb74f5d0fcbc.tar.xz
libmenu: remove OSD menu functionality (--menu)
Something like the OSD menu functionality could be useful. However the current implementation has several problems and would require a relatively large amount of work to get into good shape. As far as I know there are few users of the existing functionality. Nobody is working on the existing code and keeping it compiling at all while changing other code would require extra work. So delete the menu code and some related code elsewhere that's used by nothing else.
Diffstat (limited to 'libmenu/menu_cmdlist.c')
-rw-r--r--libmenu/menu_cmdlist.c177
1 files changed, 0 insertions, 177 deletions
diff --git a/libmenu/menu_cmdlist.c b/libmenu/menu_cmdlist.c
deleted file mode 100644
index 14026d04c4..0000000000
--- a/libmenu/menu_cmdlist.c
+++ /dev/null
@@ -1,177 +0,0 @@
-/*
- * This file is part of MPlayer.
- *
- * MPlayer is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * MPlayer is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License along
- * with MPlayer; if not, write to the Free Software Foundation, Inc.,
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
- */
-
-#include "config.h"
-#include "mp_msg.h"
-
-#include <stdlib.h>
-#include <stdio.h>
-#include <ctype.h>
-#include <string.h>
-
-#include "libmpcodecs/img_format.h"
-#include "libmpcodecs/mp_image.h"
-
-#include "m_option.h"
-#include "m_struct.h"
-#include "asxparser.h"
-#include "menu.h"
-#include "menu_list.h"
-
-#include "sub/font_load.h"
-
-#include "input/input.h"
-
-
-
-struct list_entry_s {
- struct list_entry p;
-
- char* ok;
- char* cancel;
- char* left;
- char* right;
-};
-
-struct menu_priv_s {
- menu_list_priv_t p;
-};
-
-#define ST_OFF(m) M_ST_OFF(struct menu_priv_s, m)
-
-static struct menu_priv_s cfg_dflt = {
- MENU_LIST_PRIV_DFLT,
-};
-
-static const m_option_t cfg_fields[] = {
- MENU_LIST_PRIV_FIELDS,
- { "title",M_ST_OFF(struct menu_priv_s,p.title), CONF_TYPE_STRING, 0, 0, 0, NULL },
- { NULL, NULL, NULL, 0,0,0,NULL }
-};
-
-#define mpriv (menu->priv)
-
-static void read_cmd(menu_t* menu,int cmd) {
- switch(cmd) {
- case MENU_CMD_RIGHT:
- if(mpriv->p.current->right) {
- mp_input_parse_and_queue_cmds(menu->input_ctx, mpriv->p.current->right);
- break;
- } // fallback on ok if right is not defined
- case MENU_CMD_OK:
- if (mpriv->p.current->ok)
- mp_input_parse_and_queue_cmds(menu->input_ctx, mpriv->p.current->ok);
- break;
- case MENU_CMD_LEFT:
- if(mpriv->p.current->left) {
- mp_input_parse_and_queue_cmds(menu->input_ctx, mpriv->p.current->left);
- break;
- } // fallback on cancel if left is not defined
- case MENU_CMD_CANCEL:
- if(mpriv->p.current->cancel) {
- mp_input_parse_and_queue_cmds(menu->input_ctx, mpriv->p.current->cancel);
- break;
- }
- default:
- menu_list_read_cmd(menu,cmd);
- }
-}
-
-static void free_entry(list_entry_t* entry) {
- free(entry->ok);
- free(entry->cancel);
- free(entry->left);
- free(entry->right);
- free(entry->p.txt);
- free(entry);
-}
-
-static void close_menu(menu_t* menu) {
- menu_list_uninit(menu,free_entry);
-}
-
-static int parse_args(menu_t* menu,char* args) {
- char *element,*body, **attribs, *name;
- list_entry_t* m = NULL;
- int r;
- ASX_Parser_t* parser = asx_parser_new(menu->mconfig);
-
- while(1) {
- r = asx_get_element(parser,&args,&element,&body,&attribs);
- if(r < 0) {
- mp_tmsg(MSGT_GLOBAL,MSGL_WARN,"[MENU] syntax error at line: %d\n",parser->line);
- asx_parser_free(parser);
- return -1;
- } else if(r == 0) {
- asx_parser_free(parser);
- if(!m)
- mp_tmsg(MSGT_GLOBAL,MSGL_WARN,"[MENU] No entry found in the menu definition.\n");
- return m ? 1 : 0;
- }
- // Has it a name ?
- name = asx_get_attrib("name",attribs);
- if(!name) {
- mp_tmsg(MSGT_GLOBAL,MSGL_WARN,"[MENU] List menu entry definitions need a name (line %d).\n",parser->line);
- free(element);
- free(body);
- asx_free_attribs(attribs);
- continue;
- }
- m = calloc(1,sizeof(struct list_entry_s));
- m->p.txt = name;
- 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);
- free(body);
- asx_free_attribs(attribs);
- }
-}
-
-static int open_cmdlist(menu_t* menu, char* args) {
- menu->draw = menu_list_draw;
- menu->read_cmd = read_cmd;
- menu->close = close_menu;
-
- if(!args) {
- mp_tmsg(MSGT_GLOBAL,MSGL_WARN,"[MENU] List menu needs an argument.\n");
- return 0;
- }
-
- menu_list_init(menu);
- if(!parse_args(menu,args))
- return 0;
- return 1;
-}
-
-const menu_info_t menu_info_cmdlist = {
- "Command list menu",
- "cmdlist",
- "Albeu",
- "",
- {
- "cmdlist_cfg",
- sizeof(struct menu_priv_s),
- &cfg_dflt,
- cfg_fields
- },
- open_cmdlist
-};