00001 /* 00002 * PROPRIETARY INFORMATION. This software is proprietary to 00003 * Side Effects Software Inc., and is not to be reproduced, 00004 * transmitted, or disclosed in any way without written permission. 00005 * 00006 * Produced by: 00007 * ramin 00008 * Side Effects Software Inc. 00009 * 20 Maud St. 00010 * Toronto, Ontario, M5V 2M5 00011 * Canada 00012 * 416-366-4607 00013 * 00014 * NAME: PRM_Default.h (Parameter Library) 00015 * 00016 * COMMENTS: 00017 */ 00018 00019 #ifndef __PRM_Default__ 00020 #define __PRM_Default__ 00021 00022 #include "PRM_API.h" 00023 #include <CH/CH_ExprLanguage.h> 00024 00025 // These options can be OR'd and are processed in order from top to bottom. 00026 enum PRM_DefaultType { 00027 PRM_DEFAULT_LOCK = 0x00000001, 00028 PRM_DEFAULT_USER = 0x00000002, 00029 PRM_DEFAULT_EXPR = 0x00000004, 00030 PRM_DEFAULT_FCTY = 0x00000008, 00031 PRM_DEFAULT_MASK = 0x0000000F 00032 }; 00033 00034 #define PRM_FACTORY_DEF PRM_DefaultType( \ 00035 PRM_DEFAULT_LOCK | PRM_DEFAULT_FCTY) 00036 #define PRM_USER_DEF PRM_DefaultType( \ 00037 PRM_FACTORY_DEF | PRM_DEFAULT_USER) 00038 #define PRM_TRUE_FACTORY_DEF PRM_DefaultType( \ 00039 PRM_FACTORY_DEF | PRM_DEFAULT_EXPR) 00040 #define PRM_FACTORY_UI_DEF PRM_DefaultType( \ 00041 PRM_TRUE_FACTORY_DEF & ~PRM_DEFAULT_LOCK) 00042 00043 // 00044 // For now, ordinal and animated parameters are both stored in a floating 00045 // point number. 00046 // 00047 00048 class PRM_API PRM_Default 00049 { 00050 public: 00051 /// PRM_Default has two parts: a float and a string. For floating point 00052 /// parameters, if the default string is defined, then the parameter will 00053 /// start off being animated and have the channel expression defined by the 00054 /// string. Otherwise, the floating point default is used for float and 00055 /// integer types, while the string is used to initialize string types. 00056 PRM_Default(float thefloat=0.0F, const char *thestring = 0, 00057 CH_StringMeaning string_meaning = 00058 CH_AUTO_DETECT_OLD_EXPRESSION); 00059 00060 float getFloat() const { return myFloat; } 00061 int getOrdinal() const { return (int)myFloat; } 00062 bool gotString() const { return (myString) ? true : false; } 00063 const char *getString() const { return (myString) ? myString : ""; } 00064 CH_StringMeaning getStringMeaning() const 00065 { return myStringMeaning; } 00066 00067 PRM_Default &operator=(const PRM_Default &dft); 00068 00069 void set(float thefloat, const char *thestring, 00070 CH_StringMeaning string_meaning); 00071 00072 void setFloat(float v) { myFloat = v; } 00073 void setOrdinal(int v) { myFloat = (float)v; } 00074 void setString(const char *v, bool free_existing = false); 00075 void setStringMeaning(CH_StringMeaning string_meaning); 00076 00077 private: 00078 float myFloat; 00079 char *myString; 00080 CH_StringMeaning myStringMeaning; 00081 }; 00082 #endif
1.5.9