00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020 #ifndef __BM_ParmState_H__
00021 #define __BM_ParmState_H__
00022
00023 #include "BM_API.h"
00024 #include <UT/UT_String.h>
00025 #include "BM_SimpleState.h"
00026 #include <CH/CH_ExprLanguage.h>
00027
00028
00029 class PRM_Template;
00030 class PRM_ParmList;
00031 class PRM_Parm;
00032 class PRM_PresetInfo;
00033 class PSI2_DialogPRM;
00034 class PSI2_DialogPRMExported;
00035 class BM_ParmStateUndo;
00036
00037
00038 class BM_API BM_ParmState : public BM_SimpleState
00039 {
00040
00041
00042
00043 friend class BM_ParmStateUndo;
00044
00045 public:
00046
00047 BM_ParmState(BM_SceneManager &app, const char *cursor,
00048 const char *vname = 0,
00049 const char *english = 0,
00050 const char *const *vnames = 0,
00051 UI_EventMethod const *vmethods = 0);
00052 virtual ~BM_ParmState();
00053
00054
00055 const UT_String &name(void) const { return myName; }
00056 const UT_String &english(void) const { return myEnglishName; }
00057
00058
00059 virtual const char *className() const;
00060
00061
00062 virtual void prepareDialogForDisplay() const;
00063 virtual int hasDialog (void) const;
00064 virtual UI_Feel *dialogFeel(void) const;
00065 virtual int getToolboxCount() const;
00066 virtual UI_Feel *getToolbox(int index) const;
00067
00068
00069
00070
00071 UI_Feel *extraDialogFeel() const;
00072
00073
00074
00075
00076 virtual void initializeUI(PRM_Template *tmpl=0);
00077
00078 protected:
00079
00080 virtual void initApplication(UI_Manager *, int c, const char **v);
00081
00082
00083 PRM_ParmList *parameters (void) const { return myParmList; }
00084 UI_Value *parmValue (void) const { return myParmVal; }
00085
00086
00087 PRM_Parm *parameter(const char *name);
00088 PRM_Parm *parameter(int index);
00089
00090
00091 void setParm(const char *name, const UT_String &value,
00092 CH_StringMeaning meaning,
00093 float t=0, int refresh=1);
00094 void setParm(const char *name, int value, float t=0,
00095 int refresh=1);
00096 void setParm(const char *name, float value, float t=0,
00097 int refresh=1);
00098 void setXYParm (const char *name, float x,float y,
00099 float t=0, int refresh=1);
00100 void setXYZParm(const char *name, float x,float y,float z,
00101 float t=0, int refresh=1);
00102 void setParm(int index, const UT_String &v,
00103 CH_StringMeaning meaning,
00104 float t=0, int refresh=1);
00105 void setParm(int index, int value, float t=0,
00106 int refresh=1);
00107 void setParm(int index, float value, float t=0,
00108 int refresh=1);
00109 void setXYParm (int index, float x, float y,float t=0,
00110 int refresh=1);
00111 void setXYZParm(int index, float x, float y, float z,
00112 float t=0, int refresh=1);
00113
00114 bool parmExists( const char *name ) const;
00115 bool parmExists( int index ) const;
00116
00117 void getParm(const char *name, UT_String &value,
00118 float t=0) const;
00119 void getParm(const char *name, int &value,
00120 float t=0) const;
00121 void getParm(const char *name, float &value,
00122 float t=0) const;
00123 void getXYParm (const char *name, float &x, float &y,
00124 float t=0) const;
00125 void getXYParm (const char *name, int &x, int &y,
00126 float t=0) const;
00127 void getXYZParm(const char *n, float &x,float &y,float &z,
00128 float t=0) const;
00129 void getParm(int index, UT_String &value, float t=0) const;
00130 void getParm(int index, int &value, float t=0) const;
00131 void getParm(int index, float &value, float t=0) const;
00132 void getXYParm (int index, float &x, float &y,
00133 float t=0) const;
00134 void getXYParm (int index, int &x, int &y, float t=0) const;
00135 void getXYZParm(int index, float &x, float &y, float &z,
00136 float t=0) const;
00137
00138
00139 void overwriteParmDefault (const char *name, float t=0);
00140 void overwriteXYParmDefault (const char *name, float t=0);
00141 void overwriteXYZParmDefault(const char *name, float t=0);
00142 void overwriteParmDefault (int index, float t=0);
00143 void overwriteXYParmDefault (int index, float t=0);
00144 void overwriteXYZParmDefault(int index, float t=0);
00145 void overwriteParmDefaults();
00146
00147
00148 virtual int disableParms(void);
00149 int enableParm(const char *name, int onoff, int refresh=1);
00150 int enableParm(int index, int onoff, int refresh=1);
00151
00152
00153 void refreshParms(void);
00154 void refreshParm (int index);
00155
00156
00157
00158 virtual int handleParameterEvent(UI_Event *event);
00159
00160
00161
00162
00163
00164 bool saveParmForUndo( int index, bool force = false );
00165
00166
00167
00168
00169
00170
00171 virtual int handleSaveParmForUndo( int index );
00172
00173
00174
00175 virtual int handleParameterUndo( int parm_index );
00176
00177
00178
00179 int getSaveParmForUndoFlag()
00180 { return mySaveParmForUndoFlag; };
00181 void setSaveParmForUndoFlag( int onoff)
00182 { mySaveParmForUndoFlag = (onoff != 0); };
00183
00184 private:
00185
00186
00187
00188
00189
00190 static void saveParmForUndoCallback( void * state,
00191 int parm_index )
00192 {
00193 ((BM_ParmState *)state)->handleSaveParmForUndo(
00194 parm_index );
00195 }
00196
00197 void handleParameterEventVoidRet(UI_Event *event)
00198 { handleParameterEvent(event); }
00199 void handleToolboxParameterEvent(UI_Event *event);
00200 void parameterChanged(UI_Event *event);
00201
00202
00203
00204 UT_String myName;
00205 UT_String myEnglishName;
00206
00207 PSI2_DialogPRMExported *myParmToolbox;
00208 PRM_ParmList *myParmList;
00209 UI_Value *myParmVal;
00210 UI_Value *myToolboxParmVal;
00211 PSI2_DialogPRM *myParmDialog;
00212 PSI2_DialogPRM *myExtraParmDialog;
00213 PRM_PresetInfo *myPresetInfo;
00214
00215 unsigned myOwnParmsFlag:1,
00216 mySaveParmForUndoFlag:1;
00217 };
00218
00219 #endif