HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
DS_Command.h
Go to the documentation of this file.
1 /*
2  * PROPRIETARY INFORMATION. This software is proprietary to
3  * Side Effects Software Inc., and is not to be reproduced,
4  * transmitted, or disclosed in any way without written permission.
5  *
6  * NAME: DS library (C++)
7  *
8  * COMMENTS: Dialog Scripted Command
9  * Basically, this is an interface to building a command line
10  * with arguments. Each of the arguments is represented internally
11  * as a PRM parameter list. The dialog is built automatically using
12  * PSI.
13  */
14 
15 
16 #ifndef __DS_Command_h__
17 #define __DS_Command_h__
18 
19 #include "PRM_API.h"
20 #include "PRM_ChoiceList.h"
21 #include <UT/UT_ValArray.h>
22 #include <UT/UT_String.h>
23 
24 class PRM_Template;
25 class PRM_ParmList;
26 class PRM_Default;
27 class PRM_Name;
28 class PRM_Parm;
29 class PRM_PresetInfo;
30 class PRM_SpareData;
31 class DS_Stream;
32 class DS_Page;
33 class DS_Parm;
34 
36 public:
37  DS_Command(const char *commandlistfile);
38  ~DS_Command();
39 
40  const UT_String &getCommandName() { return myCmdName; }
41  const UT_String &getLabel() { return myLabel; }
42  const UT_String &getIcon() { return myIcon; }
43 
44  int parse(DS_Stream &is);
45 
46  void getCommand(UT_String &str);
47 
48  // To handle when there have been expressions overridden, we need to call
49  // the parmChanged() method before getCommand() is called. This allows
50  // parameters to know whether their expressions are being overwritten.
51  // After the getCommand() returns whether there was an override or not, we
52  // then have to either axe the expressions (i.e. use float values) or keep
53  // them. If the axe/keep methods aren't called, then the parameter will
54  // continue to think that it's being changed.
55  // The parmChanged() method will return 1 if the parameter currently has
56  // expressions which will be overridden by the parameter change.
57  int parmChanged(int index);
58  int parmChanged(const char *token);
59  void axeExpressions();
60  void keepExpressions();
61  void enforceOptions();
62 
63  void setDefaultCommand();
64  void setCommand(const char *str);
65  int isValid() { return myTemplateSize; }
66  const char *getHelp();
67  PRM_ParmList *getParmList() const { return myParmList; }
68  PRM_Template *getTemplateList() const { return myTemplateList; }
69  int disableParms();
70 
71  void setRManSyntax(int onOff) { myRManSyntax = onOff;}
72  int getRManSyntax() const { return myRManSyntax; }
73  void setVexSyntax(int onoff) { myVexSyntax = onoff; }
74  int getVexSyntax() const { return myVexSyntax; }
75 
76  PRM_Template *addTemplate(DS_Parm *parm, bool addToggle = 1);
77 
78  static void setObjectMenuBuilder(PRM_ChoiceGenFunc callback);
79  static void setRenderMenuBuilder(PRM_ChoiceGenFunc callback);
80 
81 private:
82  UT_String myCommandListFile;
83  UT_String myCmdName;
84  UT_String myLabel;
85  UT_String myIcon;
86  UT_String myHelp;
87 
88  DS_Page *myPage;
90  UT_ValArray<PRM_Default *> myDefaults;
91 
92  PRM_ParmList *myParmList;
93  PRM_Template *myTemplateList;
94  PRM_PresetInfo *myPresetInfo;
95  int myTemplateSize;
96  int myRManSyntax;
97  int myVexSyntax;
98 
99  int mySwitcherCount;
100 };
101 
102 #endif
void setRManSyntax(int onOff)
Definition: DS_Command.h:71
const UT_String & getIcon()
Definition: DS_Command.h:42
PRM_ParmList * getParmList() const
Definition: DS_Command.h:67
int getRManSyntax() const
Definition: DS_Command.h:72
void(* PRM_ChoiceGenFunc)(void *thedata, PRM_Name *thechoicenames, int thelistsize, const PRM_SpareData *thespareptr, const PRM_Parm *theparm)
PRM_Template * getTemplateList() const
Definition: DS_Command.h:68
int isValid()
Definition: DS_Command.h:65
const UT_String & getLabel()
Definition: DS_Command.h:41
void setVexSyntax(int onoff)
Definition: DS_Command.h:73
int getVexSyntax() const
Definition: DS_Command.h:74
const UT_String & getCommandName()
Definition: DS_Command.h:40
GLuint index
Definition: glcorearb.h:786
#define PRM_API
Definition: PRM_API.h:10