summaryrefslogtreecommitdiffstats
path: root/libmenu
diff options
context:
space:
mode:
authoruau <uau@b3059339-0415-0410-9bf9-f77b7e298cf2>2007-02-21 18:28:48 +0000
committeruau <uau@b3059339-0415-0410-9bf9-f77b7e298cf2>2007-02-21 18:28:48 +0000
commit00b3c781965e920f9672b7568d65acd44a47c84f (patch)
treebd97c00eae7dbcc107d6888828715c881f2c2778 /libmenu
parente1547563a929a1b923a708f7d9df062d68a2d11d (diff)
downloadmpv-00b3c781965e920f9672b7568d65acd44a47c84f.tar.bz2
mpv-00b3c781965e920f9672b7568d65acd44a47c84f.tar.xz
Fix menu to work with mpctx
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@22302 b3059339-0415-0410-9bf9-f77b7e298cf2
Diffstat (limited to 'libmenu')
-rw-r--r--libmenu/menu.c5
-rw-r--r--libmenu/menu.h3
-rw-r--r--libmenu/menu_param.c10
-rw-r--r--libmenu/menu_pt.c7
-rw-r--r--libmenu/vf_menu.c4
5 files changed, 17 insertions, 12 deletions
diff --git a/libmenu/menu.c b/libmenu/menu.c
index 5ff760ef37..fd2fe56b19 100644
--- a/libmenu/menu.c
+++ b/libmenu/menu.c
@@ -52,6 +52,7 @@ typedef struct menu_def_st {
char* args;
} menu_def_t;
+static struct MPContext *menu_ctx = NULL;
static menu_def_t* menu_list = NULL;
static int menu_count = 0;
@@ -122,7 +123,7 @@ static int menu_parse_config(char* buffer) {
#define BUF_STEP 1024
#define BUF_MIN 128
#define BUF_MAX BUF_STEP*1024
-int menu_init(char* cfg_file) {
+int menu_init(struct MPContext *mpctx, char* cfg_file) {
char* buffer = NULL;
int bl = BUF_STEP, br = 0;
int f, fd;
@@ -160,6 +161,7 @@ int menu_init(char* cfg_file) {
close(fd);
+ menu_ctx = mpctx;
f = menu_parse_config(buffer);
free(buffer);
return f;
@@ -216,6 +218,7 @@ menu_t* menu_open(char *name) {
m = calloc(1,sizeof(menu_t));
m->priv_st = &(menu_list[i].type->priv_st);
m->priv = m_struct_copy(m->priv_st,menu_list[i].cfg);
+ m->ctx = menu_ctx;
if(menu_list[i].type->open(m,menu_list[i].args))
return m;
if(m->priv)
diff --git a/libmenu/menu.h b/libmenu/menu.h
index 79913365e7..7c336e4535 100644
--- a/libmenu/menu.h
+++ b/libmenu/menu.h
@@ -3,6 +3,7 @@ struct menu_priv_s;
typedef struct menu_s menu_t;
struct menu_s {
+ struct MPContext *ctx;
void (*draw)(menu_t* menu,mp_image_t* mpi);
void (*read_cmd)(menu_t* menu,int cmd);
void (*read_key)(menu_t* menu,int cmd);
@@ -36,7 +37,7 @@ typedef struct menu_info_s {
#define MENU_CMD_ACTION 6
/// Global init/uninit
-int menu_init(char* cfg_file);
+int menu_init(struct MPContext *mpctx, char* cfg_file);
void menu_unint(void);
/// Open a menu defined in the config file
diff --git a/libmenu/menu_param.c b/libmenu/menu_param.c
index 84f4fbae5e..1be3c2e547 100644
--- a/libmenu/menu_param.c
+++ b/libmenu/menu_param.c
@@ -79,7 +79,7 @@ static m_option_t cfg_fields[] = {
m_option_t* mp_property_find(const char* name);
static void entry_set_text(menu_t* menu, list_entry_t* e) {
- char* val = m_property_print(e->opt);
+ char* val = m_property_print(e->opt, menu->ctx);
int l,edit = (mpriv->edit && e == mpriv->p.current);
if(!val) {
if(mpriv->hide_na) {
@@ -227,22 +227,22 @@ static void read_cmd(menu_t* menu,int cmd) {
case MENU_CMD_UP:
if(!mpriv->edit) break;
case MENU_CMD_RIGHT:
- if(m_property_do(e->opt,M_PROPERTY_STEP_UP,NULL) > 0)
+ if(m_property_do(e->opt,M_PROPERTY_STEP_UP,NULL,menu->ctx) > 0)
update_entries(menu);
return;
case MENU_CMD_DOWN:
if(!mpriv->edit) break;
case MENU_CMD_LEFT:
- if(m_property_do(e->opt,M_PROPERTY_STEP_DOWN,NULL) > 0)
+ if(m_property_do(e->opt,M_PROPERTY_STEP_DOWN,NULL,menu->ctx) > 0)
update_entries(menu);
return;
case MENU_CMD_OK:
// check that the property is writable
- if(m_property_do(e->opt,M_PROPERTY_SET,NULL) < 0) return;
+ if(m_property_do(e->opt,M_PROPERTY_SET,NULL,menu->ctx) < 0) return;
// shortcut for flags
if(e->opt->type == CONF_TYPE_FLAG) {
- if(m_property_do(e->opt,M_PROPERTY_STEP_UP,NULL) > 0)
+ if(m_property_do(e->opt,M_PROPERTY_STEP_UP,NULL,menu->ctx) > 0)
update_entries(menu);
return;
}
diff --git a/libmenu/menu_pt.c b/libmenu/menu_pt.c
index e49a865351..ba0c09d4fe 100644
--- a/libmenu/menu_pt.c
+++ b/libmenu/menu_pt.c
@@ -19,11 +19,10 @@
#include "playtree.h"
#include "input/input.h"
+#include "access_mpcontext.h"
#define mp_basename(s) (strrchr((s),'/')==NULL?(char*)(s):(strrchr((s),'/')+1))
-extern play_tree_iter_t* playtree_iter;
-
struct list_entry_s {
struct list_entry p;
play_tree_t* pt;
@@ -58,7 +57,7 @@ static void read_cmd(menu_t* menu,int cmd) {
char str[15];
play_tree_t* i;
mp_cmd_t* c;
-
+ play_tree_iter_t* playtree_iter = mpctx_get_playtree_iter(menu->ctx);
if(playtree_iter->tree == mpriv->p.current->pt)
break;
@@ -107,6 +106,8 @@ static void close_menu(menu_t* menu) {
static int op(menu_t* menu, char* args) {
play_tree_t* i;
list_entry_t* e;
+ play_tree_iter_t* playtree_iter = mpctx_get_playtree_iter(menu->ctx);
+
args = NULL; // Warning kill
menu->draw = menu_list_draw;
diff --git a/libmenu/vf_menu.c b/libmenu/vf_menu.c
index 81cd97f783..a49040611e 100644
--- a/libmenu/vf_menu.c
+++ b/libmenu/vf_menu.c
@@ -23,8 +23,7 @@
#include "input/input.h"
#include "m_struct.h"
#include "menu.h"
-
-extern vo_functions_t* video_out;
+#include "access_mpcontext.h"
static struct vf_priv_s* st_priv = NULL;
@@ -78,6 +77,7 @@ static mp_image_t* alloc_mpi(int w, int h, uint32_t fmt) {
}
void vf_menu_pause_update(struct vf_instance_s* vf) {
+ vo_functions_t *video_out = mpctx_get_video_out(vf->priv->current->ctx);
if(pause_mpi) {
put_image(vf,pause_mpi, MP_NOPTS_VALUE);
// Don't draw the osd atm