1 #ifndef _CONFIG_PARAM_H 2 #define _CONFIG_PARAM_H 3 4 #include <stdlib.h> 5 6 /** 7 * File created on 2003-05-24 by Jeko. 8 * (c)2003, JC Hoelt for iOS-software. 9 * 10 * LGPL Licence. 11 */ 12 13 typedef enum { 14 PARAM_INTVAL, 15 PARAM_FLOATVAL, 16 PARAM_BOOLVAL, 17 PARAM_STRVAL, 18 PARAM_LISTVAL, 19 } ParamType; 20 21 struct IntVal { 22 int value; 23 int min; 24 int max; 25 int step; 26 }; 27 struct FloatVal { 28 float value; 29 float min; 30 float max; 31 float step; 32 }; 33 struct StrVal { 34 char *value; 35 }; 36 struct ListVal { 37 char *value; 38 int nbChoices; 39 char **choices; 40 }; 41 struct BoolVal { 42 int value; 43 }; 44 45 46 typedef struct _PARAM { 47 const char *name; 48 const char *desc; 49 char rw; 50 ParamType type; 51 union { 52 struct IntVal ival; 53 struct FloatVal fval; 54 struct StrVal sval; 55 struct ListVal slist; 56 struct BoolVal bval; 57 } param; 58 59 /* used by the core to inform the GUI of a change */ 60 void (*change_listener)(struct _PARAM *_this); 61 62 /* used by the GUI to inform the core of a change */ 63 void (*changed)(struct _PARAM *_this); 64 65 void *user_data; /* can be used by the GUI */ 66 } PluginParam; 67 68 #define IVAL(p) ((p).param.ival.value) 69 #define SVAL(p) ((p).param.sval.value) 70 #define FVAL(p) ((p).param.fval.value) 71 #define BVAL(p) ((p).param.bval.value) 72 #define LVAL(p) ((p).param.slist.value) 73 74 #define FMIN(p) ((p).param.fval.min) 75 #define FMAX(p) ((p).param.fval.max) 76 #define FSTEP(p) ((p).param.fval.step) 77 78 #define IMIN(p) ((p).param.ival.min) 79 #define IMAX(p) ((p).param.ival.max) 80 #define ISTEP(p) ((p).param.ival.step) 81 82 PluginParam goom_secure_param(void); 83 84 PluginParam goom_secure_f_param(const char *name); 85 PluginParam goom_secure_i_param(const char *name); 86 PluginParam goom_secure_b_param(const char *name, int value); 87 PluginParam goom_secure_s_param(const char *name); 88 89 PluginParam goom_secure_f_feedback(const char *name); 90 PluginParam goom_secure_i_feedback(const char *name); 91 92 void goom_set_str_param_value(PluginParam *p, const char *str); 93 void goom_set_list_param_value(PluginParam *p, const char *str); 94 95 typedef struct _PARAMETERS { 96 const char *name; 97 const char *desc; 98 int nbParams; 99 PluginParam **params; 100 } PluginParameters; 101 102 PluginParameters goom_plugin_parameters(const char *name, int nb); 103 104 #define secure_param goom_secure_param 105 #define secure_f_param goom_secure_f_param 106 #define secure_i_param goom_secure_i_param 107 #define secure_b_param goom_secure_b_param 108 #define secure_s_param goom_secure_s_param 109 #define secure_f_feedback goom_secure_f_feedback 110 #define secure_i_feedback goom_secure_i_feedback 111 #define set_list_param_value goom_set_list_param_value 112 #define set_str_param_value goom_set_str_param_value 113 #define plugin_parameters goom_plugin_parameters 114 115 #endif 116