Mercurial > mplayer.hg
annotate m_config.h @ 34325:fc74085e2487
Fix bug in Win32 GUI introduced in r34403.
When selecting a file to open in the open dialog, the open dialog just
reappears.
handlemsg() passes unknown messages (such as evDropFile) to the gui's
playercontrol function (guiSetEvent()). We cannot replace the
handlemsg(hWnd, evDropFile) call by handlemsg(hWnd, evLoadPlay), because
evLoadPlay is known in handlemsg() and has a different meaning there. So
we directly call gui->playercontrol(evLoadPlay) instead where evDropFile
and evLoadPlay have the same meaning.
Reported by Stephen Sheldon, sfsheldo gmail com.
author | ib |
---|---|
date | Thu, 08 Dec 2011 19:41:28 +0000 |
parents | 1ca3d798b518 |
children |
rev | line source |
---|---|
30429
c1a3f1bbba26
Add license header to all top-level files missing them.
diego
parents:
29263
diff
changeset
|
1 /* |
c1a3f1bbba26
Add license header to all top-level files missing them.
diego
parents:
29263
diff
changeset
|
2 * This file is part of MPlayer. |
c1a3f1bbba26
Add license header to all top-level files missing them.
diego
parents:
29263
diff
changeset
|
3 * |
c1a3f1bbba26
Add license header to all top-level files missing them.
diego
parents:
29263
diff
changeset
|
4 * MPlayer is free software; you can redistribute it and/or modify |
c1a3f1bbba26
Add license header to all top-level files missing them.
diego
parents:
29263
diff
changeset
|
5 * it under the terms of the GNU General Public License as published by |
c1a3f1bbba26
Add license header to all top-level files missing them.
diego
parents:
29263
diff
changeset
|
6 * the Free Software Foundation; either version 2 of the License, or |
c1a3f1bbba26
Add license header to all top-level files missing them.
diego
parents:
29263
diff
changeset
|
7 * (at your option) any later version. |
c1a3f1bbba26
Add license header to all top-level files missing them.
diego
parents:
29263
diff
changeset
|
8 * |
c1a3f1bbba26
Add license header to all top-level files missing them.
diego
parents:
29263
diff
changeset
|
9 * MPlayer is distributed in the hope that it will be useful, |
c1a3f1bbba26
Add license header to all top-level files missing them.
diego
parents:
29263
diff
changeset
|
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
c1a3f1bbba26
Add license header to all top-level files missing them.
diego
parents:
29263
diff
changeset
|
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
c1a3f1bbba26
Add license header to all top-level files missing them.
diego
parents:
29263
diff
changeset
|
12 * GNU General Public License for more details. |
c1a3f1bbba26
Add license header to all top-level files missing them.
diego
parents:
29263
diff
changeset
|
13 * |
c1a3f1bbba26
Add license header to all top-level files missing them.
diego
parents:
29263
diff
changeset
|
14 * You should have received a copy of the GNU General Public License along |
c1a3f1bbba26
Add license header to all top-level files missing them.
diego
parents:
29263
diff
changeset
|
15 * with MPlayer; if not, write to the Free Software Foundation, Inc., |
c1a3f1bbba26
Add license header to all top-level files missing them.
diego
parents:
29263
diff
changeset
|
16 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. |
c1a3f1bbba26
Add license header to all top-level files missing them.
diego
parents:
29263
diff
changeset
|
17 */ |
c1a3f1bbba26
Add license header to all top-level files missing them.
diego
parents:
29263
diff
changeset
|
18 |
26029 | 19 #ifndef MPLAYER_M_CONFIG_H |
20 #define MPLAYER_M_CONFIG_H | |
8164 | 21 |
18258 | 22 /// \defgroup Config Config manager |
23 /// | |
18283 | 24 /// m_config provides an API to manipulate the config variables in MPlayer. |
18316
b3be7df634b0
spelling/grammar/wording fixes in doxygen and non-doxygen comments
diego
parents:
18283
diff
changeset
|
25 /// It makes use of the \ref Options API to provide a context stack that |
b3be7df634b0
spelling/grammar/wording fixes in doxygen and non-doxygen comments
diego
parents:
18283
diff
changeset
|
26 /// allows saving and later restoring the state of all variables. |
18258 | 27 ///@{ |
28 | |
29 /// \file | |
30 | |
8164 | 31 typedef struct m_config_option m_config_option_t; |
32 typedef struct m_config_save_slot m_config_save_slot_t; | |
18258 | 33 /// \ingroup ConfigProfiles |
17471 | 34 typedef struct m_profile m_profile_t; |
8164 | 35 struct m_option; |
36 struct m_option_type; | |
37 | |
18258 | 38 /// Config option save slot |
8164 | 39 struct m_config_save_slot { |
18258 | 40 /// Previous level slot. |
8164 | 41 m_config_save_slot_t* prev; |
18258 | 42 /// Level at which the save was made. |
8164 | 43 int lvl; |
18316
b3be7df634b0
spelling/grammar/wording fixes in doxygen and non-doxygen comments
diego
parents:
18283
diff
changeset
|
44 // We have to store other datatypes in this as well, |
b3be7df634b0
spelling/grammar/wording fixes in doxygen and non-doxygen comments
diego
parents:
18283
diff
changeset
|
45 // so make sure we get properly aligned addresses. |
13246 | 46 unsigned char data[0] __attribute__ ((aligned (8))); |
8164 | 47 }; |
48 | |
18258 | 49 /// Config option |
8164 | 50 struct m_config_option { |
51 m_config_option_t* next; | |
18258 | 52 /// Full name (ie option:subopt). |
53 char* name; | |
54 /// Option description. | |
25225
51c23a18a17b
First try to mark some things in m_config correctly as const
reimar
parents:
23689
diff
changeset
|
55 const struct m_option* opt; |
18258 | 56 /// Save slot stack. |
8164 | 57 m_config_save_slot_t* slots; |
18258 | 58 /// See \ref ConfigOptionFlags. |
59 unsigned int flags; | |
8164 | 60 }; |
61 | |
18258 | 62 /// \defgroup ConfigProfiles Config profiles |
63 /// \ingroup Config | |
64 /// | |
18283 | 65 /// Profiles allow to predefine some sets of options that can then |
18258 | 66 /// be applied later on with the internal -profile option. |
67 /// | |
68 ///@{ | |
69 | |
70 /// Config profile | |
17471 | 71 struct m_profile { |
72 m_profile_t* next; | |
73 char* name; | |
74 char* desc; | |
75 int num_opts; | |
18258 | 76 /// Option/value pair array. |
17471 | 77 char** opts; |
78 }; | |
79 | |
18258 | 80 ///@} |
81 | |
82 /// Config object | |
83 /** \ingroup Config */ | |
8164 | 84 typedef struct m_config { |
18258 | 85 /// Registered options. |
18283 | 86 /** This contains all options and suboptions. |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
26029
diff
changeset
|
87 */ |
8164 | 88 m_config_option_t* opts; |
18258 | 89 /// Current stack level. |
90 int lvl; | |
91 /// \ref OptionParserModes | |
8164 | 92 int mode; |
18283 | 93 /// List of defined profiles. |
17471 | 94 m_profile_t* profiles; |
18258 | 95 /// Depth when recursively including profiles. |
17471 | 96 int profile_depth; |
18258 | 97 /// Options defined by the config itself. |
17471 | 98 struct m_option* self_opts; |
8164 | 99 } m_config_t; |
100 | |
18258 | 101 /// \defgroup ConfigOptionFlags Config option flags |
102 /// \ingroup Config | |
103 ///@{ | |
104 | |
18316
b3be7df634b0
spelling/grammar/wording fixes in doxygen and non-doxygen comments
diego
parents:
18283
diff
changeset
|
105 /// Set if an option has been set at the current level. |
9912
39444d65c4cb
Don't save restore all options wich point to the same variable.
albeu
parents:
8168
diff
changeset
|
106 #define M_CFG_OPT_SET (1<<0) |
18258 | 107 |
18283 | 108 /// Set if another option already uses the same variable. |
9912
39444d65c4cb
Don't save restore all options wich point to the same variable.
albeu
parents:
8168
diff
changeset
|
109 #define M_CFG_OPT_ALIAS (1<<1) |
39444d65c4cb
Don't save restore all options wich point to the same variable.
albeu
parents:
8168
diff
changeset
|
110 |
18258 | 111 ///@} |
8164 | 112 |
18258 | 113 /// Create a new config object. |
114 /** \ingroup Config | |
115 */ | |
8164 | 116 m_config_t* |
117 m_config_new(void); | |
118 | |
18258 | 119 /// Free a config object. |
8164 | 120 void |
121 m_config_free(m_config_t* config); | |
122 | |
18258 | 123 /// Push a new context. |
124 /** \param config The config object. | |
125 */ | |
8164 | 126 void |
127 m_config_push(m_config_t* config); | |
128 | |
18258 | 129 /// Pop the current context restoring the previous context state. |
130 /** \param config The config object. | |
131 */ | |
8164 | 132 void |
133 m_config_pop(m_config_t* config); | |
134 | |
18258 | 135 /// Register some options to be used. |
136 /** \param config The config object. | |
137 * \param args An array of \ref m_option struct. | |
138 * \return 1 on success, 0 on failure. | |
139 */ | |
8164 | 140 int |
25225
51c23a18a17b
First try to mark some things in m_config correctly as const
reimar
parents:
23689
diff
changeset
|
141 m_config_register_options(m_config_t *config, const struct m_option *args); |
8164 | 142 |
18258 | 143 /// Set an option. |
144 /** \param config The config object. | |
145 * \param arg The option's name. | |
146 * \param param The value of the option, can be NULL. | |
147 * \return See \ref OptionParserReturn. | |
148 */ | |
8164 | 149 int |
150 m_config_set_option(m_config_t *config, char* arg, char* param); | |
151 | |
18258 | 152 /// Check if an option setting is valid. |
153 /** \param config The config object. | |
154 * \param arg The option's name. | |
155 * \param param The value of the option, can be NULL. | |
156 * \return See \ref OptionParserReturn. | |
157 */ | |
8164 | 158 int |
32300
1ca3d798b518
Mark some function parameters that are not modified as const.
diego
parents:
30429
diff
changeset
|
159 m_config_check_option(const m_config_t *config, char *arg, char *param); |
8164 | 160 |
18258 | 161 /// Get the option matching the given name. |
162 /** \param config The config object. | |
163 * \param arg The option's name. | |
164 */ | |
25225
51c23a18a17b
First try to mark some things in m_config correctly as const
reimar
parents:
23689
diff
changeset
|
165 const struct m_option* |
32300
1ca3d798b518
Mark some function parameters that are not modified as const.
diego
parents:
30429
diff
changeset
|
166 m_config_get_option(const m_config_t *config, char *arg); |
8164 | 167 |
18258 | 168 /// Print a list of all registered options. |
169 /** \param config The config object. | |
170 */ | |
8168 | 171 void |
32300
1ca3d798b518
Mark some function parameters that are not modified as const.
diego
parents:
30429
diff
changeset
|
172 m_config_print_option_list(const m_config_t *config); |
8168 | 173 |
18258 | 174 /// \addtogroup ConfigProfiles |
175 ///@{ | |
176 | |
177 /// Find the profile with the given name. | |
178 /** \param config The config object. | |
179 * \param arg The profile's name. | |
180 * \return The profile object or NULL. | |
181 */ | |
17471 | 182 m_profile_t* |
32300
1ca3d798b518
Mark some function parameters that are not modified as const.
diego
parents:
30429
diff
changeset
|
183 m_config_get_profile(const m_config_t *config, char *name); |
17471 | 184 |
18258 | 185 /// Get the profile with the given name, creating it if necessary. |
186 /** \param config The config object. | |
187 * \param arg The profile's name. | |
188 * \return The profile object. | |
189 */ | |
17471 | 190 m_profile_t* |
191 m_config_add_profile(m_config_t* config, char* name); | |
192 | |
18258 | 193 /// Set the description of a profile. |
18316
b3be7df634b0
spelling/grammar/wording fixes in doxygen and non-doxygen comments
diego
parents:
18283
diff
changeset
|
194 /** Used by the config file parser when defining a profile. |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
26029
diff
changeset
|
195 * |
18258 | 196 * \param p The profile object. |
197 * \param arg The profile's name. | |
198 */ | |
17471 | 199 void |
200 m_profile_set_desc(m_profile_t* p, char* desc); | |
201 | |
18258 | 202 /// Add an option to a profile. |
18316
b3be7df634b0
spelling/grammar/wording fixes in doxygen and non-doxygen comments
diego
parents:
18283
diff
changeset
|
203 /** Used by the config file parser when defining a profile. |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
26029
diff
changeset
|
204 * |
18258 | 205 * \param config The config object. |
206 * \param p The profile object. | |
207 * \param name The option's name. | |
208 * \param val The option's value. | |
209 */ | |
17471 | 210 int |
211 m_config_set_profile_option(m_config_t* config, m_profile_t* p, | |
212 char* name, char* val); | |
213 | |
25634 | 214 /// Enables profile usage |
215 /** Used by the config file parser when loading a profile. | |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
26029
diff
changeset
|
216 * |
25634 | 217 * \param config The config object. |
218 * \param p The profile object. | |
219 */ | |
220 void | |
221 m_config_set_profile(m_config_t* config, m_profile_t* p); | |
222 | |
18258 | 223 ///@} |
224 | |
225 ///@} | |
226 | |
26029 | 227 #endif /* MPLAYER_M_CONFIG_H */ |