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_NonCopyable.h>
22 #include <UT/UT_ValArray.h>
23 #include <UT/UT_String.h>
24 
25 class PRM_Template;
26 class PRM_ParmList;
27 class PRM_Default;
28 class PRM_Name;
29 class PRM_Parm;
30 class PRM_PresetInfo;
31 class PRM_SpareData;
32 class DS_Stream;
33 class DS_Page;
34 class DS_Parm;
35 
37 {
38 public:
39  DS_Command(const char *commandlistfile);
40  ~DS_Command();
41 
43 
44  const UT_String &getCommandName() { return myCmdName; }
45  const UT_String &getLabel() { return myLabel; }
46  const UT_String &getIcon() { return myIcon; }
47 
48  int parse(DS_Stream &is);
49 
50  void getCommand(UT_String &str);
51 
52  // To handle when there have been expressions overridden, we need to call
53  // the parmChanged() method before getCommand() is called. This allows
54  // parameters to know whether their expressions are being overwritten.
55  // After the getCommand() returns whether there was an override or not, we
56  // then have to either axe the expressions (i.e. use float values) or keep
57  // them. If the axe/keep methods aren't called, then the parameter will
58  // continue to think that it's being changed.
59  // The parmChanged() method will return 1 if the parameter currently has
60  // expressions which will be overridden by the parameter change.
61  int parmChanged(int index);
62  int parmChanged(const char *token);
63  void axeExpressions();
64  void keepExpressions();
65  void enforceOptions();
66 
67  void setDefaultCommand();
68  void setCommand(const char *str);
69  int isValid() { return myTemplateSize; }
70  const char *getHelp();
71  PRM_ParmList *getParmList() const { return myParmList; }
72  PRM_Template *getTemplateList() const { return myTemplateList; }
73  int disableParms();
74 
75  void setRManSyntax(int onOff) { myRManSyntax = onOff;}
76  int getRManSyntax() const { return myRManSyntax; }
77  void setVexSyntax(int onoff) { myVexSyntax = onoff; }
78  int getVexSyntax() const { return myVexSyntax; }
79 
80  PRM_Template *addTemplate(DS_Parm *parm, bool addToggle = 1);
81 
82  static void setObjectMenuBuilder(PRM_ChoiceGenFunc callback);
83  static void setRenderMenuBuilder(PRM_ChoiceGenFunc callback);
84 
85 private:
86  UT_String myCommandListFile;
87  UT_String myCmdName;
88  UT_String myLabel;
89  UT_String myIcon;
90  UT_String myHelp;
91 
92  DS_Page *myPage;
94  UT_ValArray<PRM_Default *> myDefaults;
95 
96  PRM_ParmList *myParmList;
97  PRM_Template *myTemplateList;
98  PRM_PresetInfo *myPresetInfo;
99  int myTemplateSize;
100  int myRManSyntax;
101  int myVexSyntax;
102 
103  int mySwitcherCount;
104 };
105 
106 #endif
void setRManSyntax(int onOff)
Definition: DS_Command.h:75
const UT_String & getIcon()
Definition: DS_Command.h:46
PRM_ParmList * getParmList() const
Definition: DS_Command.h:71
int getRManSyntax() const
Definition: DS_Command.h:76
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:72
int isValid()
Definition: DS_Command.h:69
#define UT_NON_COPYABLE(CLASS)
Define deleted copy constructor and assignment operator inside a class.
const UT_String & getLabel()
Definition: DS_Command.h:45
void setVexSyntax(int onoff)
Definition: DS_Command.h:77
int getVexSyntax() const
Definition: DS_Command.h:78
GLuint index
Definition: glcorearb.h:786
#define PRM_API
Definition: PRM_API.h:10