1 /* Goom Project 2 * Copyright (C) <2003> iOS-Software 3 * 4 * This library is free software; you can redistribute it and/or 5 * modify it under the terms of the GNU Library General Public 6 * License as published by the Free Software Foundation; either 7 * version 2 of the License, or (at your option) any later version. 8 * 9 * This library is distributed in the hope that it will be useful, 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 12 * Library General Public License for more details. 13 * 14 * You should have received a copy of the GNU Library General Public 15 * License along with this library; if not, write to the 16 * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, 17 * Boston, MA 02110-1301, USA. 18 */ 19 #ifndef _CONFIG_PARAM_H 20 #define _CONFIG_PARAM_H 21 22 #include <stdlib.h> 23 24 /* 25 * File created on 2003-05-24 by Jeko. 26 * (c)2003, JC Hoelt for iOS-software. 27 * 28 * LGPL Licence. 29 */ 30 31 typedef enum { 32 PARAM_INTVAL, 33 PARAM_FLOATVAL, 34 PARAM_BOOLVAL, 35 PARAM_STRVAL, 36 PARAM_LISTVAL, 37 } ParamType; 38 39 struct IntVal { 40 int value; 41 int min; 42 int max; 43 int step; 44 }; 45 struct FloatVal { 46 float value; 47 float min; 48 float max; 49 float step; 50 }; 51 struct StrVal { 52 char *value; 53 }; 54 struct ListVal { 55 char *value; 56 int nbChoices; 57 char **choices; 58 }; 59 struct BoolVal { 60 int value; 61 }; 62 63 64 typedef struct _PARAM { 65 const char *name; 66 const char *desc; 67 char rw; 68 ParamType type; 69 union { 70 struct IntVal ival; 71 struct FloatVal fval; 72 struct StrVal sval; 73 struct ListVal slist; 74 struct BoolVal bval; 75 } param; 76 77 /* used by the core to inform the GUI of a change */ 78 void (*change_listener)(struct _PARAM *_this); 79 80 /* used by the GUI to inform the core of a change */ 81 void (*changed)(struct _PARAM *_this); 82 83 void *user_data; /* can be used by the GUI */ 84 } PluginParam; 85 86 #define IVAL(p) ((p).param.ival.value) 87 #define SVAL(p) ((p).param.sval.value) 88 #define FVAL(p) ((p).param.fval.value) 89 #define BVAL(p) ((p).param.bval.value) 90 #define LVAL(p) ((p).param.slist.value) 91 92 #define FMIN(p) ((p).param.fval.min) 93 #define FMAX(p) ((p).param.fval.max) 94 #define FSTEP(p) ((p).param.fval.step) 95 96 #define IMIN(p) ((p).param.ival.min) 97 #define IMAX(p) ((p).param.ival.max) 98 #define ISTEP(p) ((p).param.ival.step) 99 100 void goom_secure_param(PluginParam *p); 101 102 void goom_secure_f_param(PluginParam *p, const char *name); 103 void goom_secure_i_param(PluginParam *p, const char *name); 104 void goom_secure_b_param(PluginParam *p, const char *name, int value); 105 void goom_secure_s_param(PluginParam *p, const char *name); 106 107 void goom_secure_f_feedback(PluginParam *p, const char *name); 108 void goom_secure_i_feedback(PluginParam *p, const char *name); 109 110 void goom_set_str_param_value(PluginParam *p, const char *str); 111 void goom_set_list_param_value(PluginParam *p, const char *str); 112 113 typedef struct _PARAMETERS { 114 const char *name; 115 const char *desc; 116 int nbParams; 117 PluginParam **params; 118 } PluginParameters; 119 120 void goom_plugin_parameters(PluginParameters *p, const char *name, int nb); 121 void goom_plugin_parameters_free(PluginParameters *p); 122 123 #define secure_param goom_secure_param 124 #define secure_f_param goom_secure_f_param 125 #define secure_i_param goom_secure_i_param 126 #define secure_b_param goom_secure_b_param 127 #define secure_s_param goom_secure_s_param 128 #define secure_f_feedback goom_secure_f_feedback 129 #define secure_i_feedback goom_secure_i_feedback 130 #define set_list_param_value goom_set_list_param_value 131 #define set_str_param_value goom_set_str_param_value 132 #define plugin_parameters goom_plugin_parameters 133 134 #endif 135