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 * Mark Elendt 00008 * Side Effects 00009 * 477 Richmond Street West 00010 * Toronto, Ontario 00011 * Canada M5V 3E7 00012 * 416-504-9876 00013 * 00014 * NAME: DS library (C++) 00015 * 00016 * COMMENTS: Dialog Scripted Command 00017 * Basically, this is an interface to building a command line 00018 * with arguments. Each of the arguments is represented internally 00019 * as a PRM parameter list. The dialog is built automatically using 00020 * PSI. 00021 */ 00022 00023 00024 #ifndef __DS_Command_h__ 00025 #define __DS_Command_h__ 00026 00027 #include "PRM_API.h" 00028 #include <UT/UT_PtrArray.h> 00029 #include <UT/UT_String.h> 00030 00031 class PRM_Template; 00032 class PRM_ParmList; 00033 class PRM_Default; 00034 class PRM_Name; 00035 class PRM_Parm; 00036 class PRM_PresetInfo; 00037 class PRM_SpareData; 00038 class DS_Stream; 00039 class DS_Page; 00040 class DS_Parm; 00041 00042 class PRM_API DS_Command { 00043 public: 00044 DS_Command(const char *commandlistfile); 00045 ~DS_Command(); 00046 00047 const UT_String &getCommandName() { return myCmdName; } 00048 const UT_String &getLabel() { return myLabel; } 00049 const UT_String &getIcon() { return myIcon; } 00050 00051 int parse(DS_Stream &is); 00052 00053 void getCommand(UT_String &str); 00054 00055 // To handle when there have been expressions overridden, we need to call 00056 // the parmChanged() method before getCommand() is called. This allows 00057 // parameters to know whether their expressions are being overwritten. 00058 // After the getCommand() returns whether there was an override or not, we 00059 // then have to either axe the expressions (i.e. use float values) or keep 00060 // them. If the axe/keep methods aren't called, then the parameter will 00061 // continue to think that it's being changed. 00062 // The parmChanged() method will return 1 if the parameter currently has 00063 // expressions which will be overridden by the parameter change. 00064 int parmChanged(int index); 00065 int parmChanged(const char *token); 00066 void axeExpressions(); 00067 void keepExpressions(); 00068 void enforceOptions(); 00069 00070 void setDefaultCommand(); 00071 void setCommand(const char *str); 00072 int isValid() { return myTemplateSize; } 00073 const char *getHelp(); 00074 PRM_ParmList *getParmList() const { return myParmList; } 00075 PRM_Template *getTemplateList() const { return myTemplateList; } 00076 int disableParms(); 00077 00078 void setRManSyntax(int onOff) { myRManSyntax = onOff;} 00079 int getRManSyntax() const { return myRManSyntax; } 00080 void setVexSyntax(int onoff) { myVexSyntax = onoff; } 00081 int getVexSyntax() const { return myVexSyntax; } 00082 00083 PRM_Template *addTemplate(DS_Parm *parm, bool addToggle = 1); 00084 00085 static void setObjectMenuBuilder(void (*callback)( 00086 void *, PRM_Name *theMenu, 00087 int theSize, 00088 const PRM_SpareData *, 00089 PRM_Parm *)); 00090 static void setRenderMenuBuilder(void (*callback)( 00091 void *, PRM_Name *theMenu, 00092 int theSize, 00093 const PRM_SpareData *, 00094 PRM_Parm *)); 00095 00096 private: 00097 UT_String myCommandListFile; 00098 UT_String myCmdName; 00099 UT_String myLabel; 00100 UT_String myIcon; 00101 UT_String myHelp; 00102 00103 DS_Page *myPage; 00104 UT_PtrArray<PRM_Name *> myNames; 00105 UT_PtrArray<PRM_Default *> myDefaults; 00106 00107 PRM_ParmList *myParmList; 00108 PRM_Template *myTemplateList; 00109 PRM_PresetInfo *myPresetInfo; 00110 int myTemplateSize; 00111 int myRManSyntax; 00112 int myVexSyntax; 00113 }; 00114 00115 #endif
1.5.9