Mercurial > mplayer.hg
annotate libmenu/menu_pt.c @ 23011:365eef1fc4f0
Disable caching of rotated glyphs.
The following commits will add perspective distortion to the glyphs rotated
with \frx and \fry. Somewhere along the way correct caching of such glyphs
will become impossible, but in the end everything will be fine.
author | eugeni |
---|---|
date | Fri, 20 Apr 2007 22:49:48 +0000 |
parents | 83366c8e1928 |
children | 96d0992c7920 |
rev | line source |
---|---|
8197 | 1 |
2 #include <stdlib.h> | |
3 #include <stdio.h> | |
8623
440301fef3fe
Added/reordered #includes to silence warnings about "implicit declaration".
rathann
parents:
8197
diff
changeset
|
4 #include <string.h> |
9102 | 5 //#include <libgen.h> |
8197 | 6 |
16862 | 7 #include "config.h" |
17994
6927fabaef92
Part1 of several printf2mp_msg changes in patch from Otvos Attila oattila AT chello DOT hu
reynaldo
parents:
17945
diff
changeset
|
8 #include "mp_msg.h" |
6927fabaef92
Part1 of several printf2mp_msg changes in patch from Otvos Attila oattila AT chello DOT hu
reynaldo
parents:
17945
diff
changeset
|
9 #include "help_mp.h" |
8197 | 10 |
19431
ac69ba536915
Explicitly include libmpcodecs/img_format.h and libvo/fastmemcpy.h.
diego
parents:
18817
diff
changeset
|
11 #include "libmpcodecs/img_format.h" |
ac69ba536915
Explicitly include libmpcodecs/img_format.h and libvo/fastmemcpy.h.
diego
parents:
18817
diff
changeset
|
12 #include "libmpcodecs/mp_image.h" |
8197 | 13 |
16862 | 14 #include "m_struct.h" |
15 #include "m_option.h" | |
8197 | 16 #include "menu.h" |
17 #include "menu_list.h" | |
18 | |
19 | |
16862 | 20 #include "playtree.h" |
21 #include "input/input.h" | |
22284 | 22 #include "access_mpcontext.h" |
8197 | 23 |
9102 | 24 #define mp_basename(s) (strrchr((s),'/')==NULL?(char*)(s):(strrchr((s),'/')+1)) |
8197 | 25 |
26 struct list_entry_s { | |
27 struct list_entry p; | |
28 play_tree_t* pt; | |
29 }; | |
30 | |
31 | |
32 struct menu_priv_s { | |
33 menu_list_priv_t p; | |
34 char* title; | |
35 }; | |
36 | |
37 static struct menu_priv_s cfg_dflt = { | |
38 MENU_LIST_PRIV_DFLT, | |
39 "Jump to" | |
40 }; | |
41 | |
42 #define ST_OFF(m) M_ST_OFF(struct menu_priv_s,m) | |
43 | |
44 static m_option_t cfg_fields[] = { | |
45 MENU_LIST_PRIV_FIELDS, | |
46 { "title", ST_OFF(title), CONF_TYPE_STRING, 0, 0, 0, NULL }, | |
47 { NULL, NULL, NULL, 0,0,0,NULL } | |
48 }; | |
49 | |
50 #define mpriv (menu->priv) | |
51 | |
52 static void read_cmd(menu_t* menu,int cmd) { | |
53 switch(cmd) { | |
17945
98f4e3704a76
Allow 6 ways (up/down/left/right/ok/cancel) navigation.
albeu
parents:
16862
diff
changeset
|
54 case MENU_CMD_RIGHT: |
8197 | 55 case MENU_CMD_OK: { |
56 int d = 1; | |
57 char str[15]; | |
58 play_tree_t* i; | |
59 mp_cmd_t* c; | |
22284 | 60 play_tree_iter_t* playtree_iter = mpctx_get_playtree_iter(menu->ctx); |
8197 | 61 |
62 if(playtree_iter->tree == mpriv->p.current->pt) | |
63 break; | |
64 | |
65 if(playtree_iter->tree->parent && mpriv->p.current->pt == playtree_iter->tree->parent) | |
66 snprintf(str,15,"pt_up_step 1"); | |
67 else { | |
68 for(i = playtree_iter->tree->next; i != NULL ; i = i->next) { | |
69 if(i == mpriv->p.current->pt) | |
70 break; | |
71 d++; | |
72 } | |
73 if(i == NULL) { | |
74 d = -1; | |
75 for(i = playtree_iter->tree->prev; i != NULL ; i = i->prev) { | |
76 if(i == mpriv->p.current->pt) | |
77 break; | |
78 d--; | |
79 } | |
80 if(i == NULL) { | |
17994
6927fabaef92
Part1 of several printf2mp_msg changes in patch from Otvos Attila oattila AT chello DOT hu
reynaldo
parents:
17945
diff
changeset
|
81 mp_msg(MSGT_GLOBAL,MSGL_WARN,MSGTR_LIBMENU_CantfindTheTargetItem); |
8197 | 82 break; |
83 } | |
84 } | |
85 snprintf(str,15,"pt_step %d",d); | |
86 } | |
87 c = mp_input_parse_cmd(str); | |
88 if(c) | |
89 mp_input_queue_cmd(c); | |
90 else | |
17994
6927fabaef92
Part1 of several printf2mp_msg changes in patch from Otvos Attila oattila AT chello DOT hu
reynaldo
parents:
17945
diff
changeset
|
91 mp_msg(MSGT_GLOBAL,MSGL_WARN,MSGTR_LIBMENU_FailedToBuildCommand,str); |
8197 | 92 } break; |
93 default: | |
94 menu_list_read_cmd(menu,cmd); | |
95 } | |
96 } | |
97 | |
98 static void read_key(menu_t* menu,int c){ | |
99 menu_list_read_key(menu,c,1); | |
100 } | |
101 | |
18817
a2b064a48775
declaring static functions with the same name than libc ones was not the best idea ever
ben
parents:
17994
diff
changeset
|
102 static void close_menu(menu_t* menu) { |
8197 | 103 menu_list_uninit(menu,NULL); |
104 } | |
105 | |
106 static int op(menu_t* menu, char* args) { | |
107 play_tree_t* i; | |
108 list_entry_t* e; | |
22284 | 109 play_tree_iter_t* playtree_iter = mpctx_get_playtree_iter(menu->ctx); |
110 | |
8197 | 111 args = NULL; // Warning kill |
112 | |
113 menu->draw = menu_list_draw; | |
114 menu->read_cmd = read_cmd; | |
115 menu->read_key = read_key; | |
18817
a2b064a48775
declaring static functions with the same name than libc ones was not the best idea ever
ben
parents:
17994
diff
changeset
|
116 menu->close = close_menu; |
8197 | 117 |
118 menu_list_init(menu); | |
119 | |
120 mpriv->p.title = mpriv->title; | |
121 | |
122 if(playtree_iter->tree->parent != playtree_iter->root) { | |
123 e = calloc(1,sizeof(list_entry_t)); | |
124 e->p.txt = ".."; | |
125 e->pt = playtree_iter->tree->parent; | |
126 menu_list_add_entry(menu,e); | |
127 } | |
128 | |
129 for(i = playtree_iter->tree ; i->prev != NULL ; i = i->prev) | |
130 /* NOP */; | |
131 for( ; i != NULL ; i = i->next ) { | |
132 e = calloc(1,sizeof(list_entry_t)); | |
133 if(i->files) | |
9102 | 134 e->p.txt = mp_basename(i->files[0]); |
8197 | 135 else |
136 e->p.txt = "Group ..."; | |
137 e->pt = i; | |
138 menu_list_add_entry(menu,e); | |
139 } | |
140 | |
141 return 1; | |
142 } | |
143 | |
144 const menu_info_t menu_info_pt = { | |
145 "Playtree menu", | |
146 "pt", | |
147 "Albeu", | |
148 "", | |
149 { | |
150 "pt_cfg", | |
151 sizeof(struct menu_priv_s), | |
152 &cfg_dflt, | |
153 cfg_fields | |
154 }, | |
155 op | |
156 }; |