parameter.h
00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022 #ifndef __BG_PARAMETER_H_
00023 #define __BG_PARAMETER_H_
00024
00025 #include <libxml/tree.h>
00026 #include <libxml/parser.h>
00027
00028 #include <gavl/gavl.h>
00029
00044
00045
00053 typedef enum
00054 {
00055 BG_PARAMETER_SECTION,
00056 BG_PARAMETER_CHECKBUTTON,
00057 BG_PARAMETER_INT,
00058 BG_PARAMETER_FLOAT,
00059 BG_PARAMETER_SLIDER_INT,
00060 BG_PARAMETER_SLIDER_FLOAT,
00061 BG_PARAMETER_STRING,
00062 BG_PARAMETER_STRING_HIDDEN,
00063 BG_PARAMETER_STRINGLIST,
00064 BG_PARAMETER_COLOR_RGB,
00065 BG_PARAMETER_COLOR_RGBA,
00066 BG_PARAMETER_FONT,
00067 BG_PARAMETER_DEVICE,
00068 BG_PARAMETER_FILE,
00069 BG_PARAMETER_DIRECTORY,
00070 BG_PARAMETER_MULTI_MENU,
00071 BG_PARAMETER_MULTI_LIST,
00072 BG_PARAMETER_MULTI_CHAIN,
00073 BG_PARAMETER_TIME,
00074 BG_PARAMETER_POSITION,
00075 BG_PARAMETER_BUTTON,
00076 } bg_parameter_type_t;
00077
00082 typedef union
00083 {
00084 double val_f;
00085 int val_i;
00086 char * val_str;
00087 float val_color[4];
00088 gavl_time_t val_time;
00089 double val_pos[2];
00090 } bg_parameter_value_t;
00091
00092
00093
00097 #define BG_PARAMETER_SYNC (1<<0) //!< Apply the value whenever the widgets value changes
00098
00102 #define BG_PARAMETER_HIDE_DIALOG (1<<1) //!< Don't make a configuration widget (for objects, which change values themselves)
00103
00107 #define BG_PARAMETER_NO_SORT (1<<2) //!< Don't make a list sortable
00108
00112 #define BG_PARAMETER_PLUGIN (1<<3) //!< Parameter refers to a plugin
00113
00117 #define BG_PARAMETER_OWN_SECTION (1<<4) //!< For parameters of the type BG_PARAMETER_SECTION: Following parameters should be stored in an own section
00118
00123 typedef struct bg_parameter_info_s bg_parameter_info_t;
00124
00131 struct bg_parameter_info_s
00132 {
00133 char * name;
00134 char * long_name;
00135 char * opt;
00136
00137 char * gettext_domain;
00138 char * gettext_directory;
00139
00140 bg_parameter_type_t type;
00141
00142 int flags;
00143
00144 bg_parameter_value_t val_default;
00145 bg_parameter_value_t val_min;
00146 bg_parameter_value_t val_max;
00147
00148
00149
00150 char const * const * multi_names;
00151
00152
00153
00154
00155 char const * const * multi_labels;
00156 char const * const * multi_descriptions;
00157
00158
00159
00160
00161
00162
00163
00164 struct bg_parameter_info_s const * const * multi_parameters;
00165
00166 int num_digits;
00167
00168 char * help_string;
00169
00170 char ** multi_names_nc;
00171
00172 char ** multi_labels_nc;
00173
00174 char ** multi_descriptions_nc;
00175
00176 struct bg_parameter_info_s ** multi_parameters_nc;
00177
00178 };
00179
00180
00181
00182
00183
00184
00185
00186
00200 typedef void (*bg_set_parameter_func_t)(void * data, const char * name,
00201 const bg_parameter_value_t * v);
00202
00216 typedef int (*bg_get_parameter_func_t)(void * data, const char * name,
00217 bg_parameter_value_t * v);
00218
00224 void bg_parameter_info_copy(bg_parameter_info_t * dst,
00225 const bg_parameter_info_t * src);
00226
00236 bg_parameter_info_t *
00237 bg_parameter_info_copy_array(const bg_parameter_info_t * src);
00238
00247 void
00248 bg_parameter_info_set_const_ptrs(bg_parameter_info_t * info);
00249
00255 void bg_parameter_info_destroy_array(bg_parameter_info_t * info);
00256
00267 void bg_parameter_value_copy(bg_parameter_value_t * dst,
00268 const bg_parameter_value_t * src,
00269 const bg_parameter_info_t * info);
00270
00277 void bg_parameter_value_free(bg_parameter_value_t * val,
00278 bg_parameter_type_t type);
00279
00280
00288 bg_parameter_info_t *
00289 bg_parameter_info_concat_arrays(bg_parameter_info_t const ** srcs);
00290
00301 int bg_parameter_get_selected(const bg_parameter_info_t * info,
00302 const char * val);
00303
00304
00316 const bg_parameter_info_t *
00317 bg_parameter_find(const bg_parameter_info_t * info,
00318 const char * name);
00319
00320
00331 bg_parameter_info_t * bg_xml_2_parameters(xmlDocPtr xml_doc,
00332 xmlNodePtr xml_parameters);
00333
00343 void
00344 bg_parameters_2_xml(const bg_parameter_info_t * info, xmlNodePtr xml_parameters);
00345
00354 void
00355 bg_parameters_dump(const bg_parameter_info_t * info, const char * filename);
00356
00357
00358 #endif
00359