HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
OPUI_GraphDisplayOptions.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: OPUI_GraphDisplayOptions.h (User Interface Library, C++)
7  *
8  * COMMENTS:
9  * A class to control the way items are displayed in the graph.
10  *
11  */
12 
13 #ifndef __OPUI_GraphDisplayOptions__
14 #define __OPUI_GraphDisplayOptions__
15 
16 #include "OPUI_API.h"
17 #include "OPUI_GraphBadge.h"
18 #include "OPUI_GraphTextBadge.h"
19 #include <OP/OP_Context.h>
20 #include <UT/UT_StringHolder.h>
21 #include <UT/UT_Color.h>
22 #include <UT/UT_Array.h>
23 #include <UT/UT_Map.h>
24 
25 class UT_OptionFile;
26 class AP_Interface;
27 class CV_Canvas;
29 
31 
32 extern "C" {
34  void OPUIaddBadges(OPUI_GraphBadgeArray *add_badges);
35 }
36 extern "C" {
38  void OPUIaddTextBadges(OPUI_GraphTextBadgeArray *add_textbadges);
39 }
40 
42 {
43 public:
45  virtual ~OPUI_GraphDisplayOptions();
46 
47  // Add our preference key/values to the canvas.
48  void registerPreferences(CV_Canvas &canvas);
49 
50  // Returns true if one of our options was changed by this call.
51  void setPref(const UT_StringHolder &pref,
52  const UT_StringHolder &value);
53 
54  const UT_StringHolder &perfStatName() const;
55  bool showPerfStats() const;
56  const UT_StringHolder &taskGraphPerfStatName() const;
57  bool showTaskGraphPerfStats() const;
58  const UT_StringHolder &taskGraphSortCriteria() const;
59  const UT_StringHolder &taskGraphCollapseMode() const;
60  bool showAllDependencies() const;
61  bool showSelectedDependencies() const;
62  bool showChildDependencies() const;
63  const UT_Array<UT_Color> &paletteColors() const;
64 
65  bool showNodeTypes() const;
66  bool showNodeShapes() const;
67  bool showCopPreviews() const;
68  bool showVopPreviews() const;
69  bool showTaskGraph() const;
70  bool showCookedWorkItems() const;
71  bool showCookingWorkItems() const;
72  bool showDirtyWorkItems() const;
73  bool showCancelledWorkItems() const;
74  bool showFailedWorkItems() const;
75  bool showRootWorkItems() const;
76  bool showPartitionWorkItems() const;
77  bool soloHighlightedWorkItems() const;
78  bool taskGraphLimitRows() const;
79  bool showPromptText() const;
80  bool showSimpleShape() const;
81  bool showVopInOutLabels() const;
82  bool showStackedLook() const;
83 
84  fpreal maxFlyoutScale() const;
85  fpreal maxNameWidth() const;
86  int minNameHeight() const;
87  int maxNameHeight() const;
88  fpreal wireFadeFactor() const;
89 
90  int maxTaskGraphRows() const;
91  int maxWorkItemsPerRow() const;
92 
93  int badgeCount() const
94  { return theRegisteredBadges.entries(); }
96  { return myBadgeNormalIndexes; }
98  { return myBadgeLargeIndexes; }
99  const OPUI_GraphBadge &badge(int badgeidx) const;
100  bool badgeVisible(int badgeidx,
102  const OPUI_GraphProxyDescriptor &desc,
103  UT_StringHolder &icon,
104  UT_Color &color) const;
105  int textBadgeCount() const
106  { return theRegisteredTextBadges.entries(); }
108  { return myTextBadgeIndexes; }
109  const OPUI_GraphTextBadge &textBadge(int textbadgeidx) const;
110  bool textBadgeVisible(int textbadgeidx,
111  const OPUI_GraphProxyDescriptor &desc,
112  UT_StringHolder &text,
113  bool &full_text,
114  fpreal &full_text_max_width,
115  UT_Color &color) const;
116  bool prepareSingleThreadedBadges(int num_nodes);
117  void calculateSingleThreadedBadges(
119 
120  static const UT_StringArray topInOutColorTags();
121  static const UT_StringArray topInOutColors();
122  static const UT_StringHolder topInOutColor(UT_StringHolder tag);
123 
124  static void installBadges();
125  static void installTextBadges();
126 
127  static void installTopInOutColors();
128 
129  static void saveGlobalPrefs(AP_Interface &app);
130  static void loadGlobalPrefs(AP_Interface &app);
131  static void importGlobalPrefs(AP_Interface &app);
132  static void exportGlobalPrefs(AP_Interface &app);
133  static void addGlobalPref(const UT_StringHolder &pref);
134  static bool isGlobalPref(const UT_StringHolder &pref);
135 
136  static void clearAllContexts();
137 
138 private:
139  static void setGlobalPref(const UT_StringHolder &pref,
140  const UT_StringHolder &value);
141  static void getGlobalPref(const UT_StringHolder &pref,
142  UT_StringHolder &value);
143 
144  static bool loadPaletteColors(
145  const char *json_buf,
146  UT_Array<UT_Color> &colors);
147  static void loadDefaultPaletteColors(
148  UT_Array<UT_Color> &colors);
149  static void savePaletteColors(
150  const UT_Array<UT_Color> &colors,
151  UT_WorkBuffer &json_buf);
152 
153  static int findBadgeWithPref(
154  const UT_StringHolder &pref);
155  static int findTextBadgeWithPref(
156  const UT_StringHolder &pref);
157 
158  UT_StringHolder myPerfStatName;
159  bool myShowPerfStats;
160  UT_StringHolder myTaskGraphPerfStatName;
161  bool myShowTaskGraphPerfStats;
162  UT_StringHolder myTaskGraphSortCriteria;
163  UT_StringHolder myTaskGraphCollapseMode;
164  bool myShowAllDependencies;
165  bool myShowSelectedDependencies;
166  bool myShowChildDependencies;
167  bool myPaletteColorsAreDefault;
168  UT_Array<UT_Color> myPaletteColors;
169 
170  UT_Array<UT_Array<bool> > mySingleThreadedBadgeData;
171  UT_Array<UT_StringArray> mySingleThreadedBadgeIcons;
172  UT_Array<UT_Array<UT_Color> > mySingleThreadedBadgeColors;
173  UT_IntArray mySingleThreadedBadgeIndexes;
174  UT_Array<UT_StringArray> mySingleThreadedTextBadgeData;
175  UT_Array<UT_Array<UT_Color> > mySingleThreadedTextBadgeColors;
176  UT_IntArray mySingleThreadedTextBadgeIndexes;
177  int mySingleThreadedDataId;
178  UT_IntArray myBadgeNormalIndexes;
179  UT_IntArray myBadgeLargeIndexes;
180  UT_IntArray myTextBadgeIndexes;
181  OP_Context myContext;
182 
183  static fpreal theMaxFlyoutScale;
184  static fpreal theMaxNameWidth;
185  static fpreal theMinNameHeight;
186  static fpreal theMaxNameHeight;
187  static fpreal theWireFadeFactor;
188  static fpreal theSnapRadius;
189  static fpreal theConnectorSnapRadius;
190  static fpreal theShakeSensitivity;
191  static bool theShowNodeTypes;
192  static bool theShowNodeShapes;
193  static bool theShowPreviews;
194  static bool theShowTaskGraph;
195  static bool theShowCookedWorkItems;
196  static bool theShowCookingWorkItems;
197  static bool theShowDirtyWorkItems;
198  static bool theShowCancelledWorkItems;
199  static bool theShowFailedWorkItems;
200  static bool theShowRootWorkItems;
201  static bool theShowPartitionWorkItems;
202  static bool theSoloHighlightedWorkItems;
203  static bool theTaskGraphLimitRows;
204  static int theMaxTaskGraphRows;
205  static int theMaxWorkItemsPerRow;
206  static UT_StringArray theTopInOutColorTags;
207  static UT_StringArray theTopInOutColors;
208  static bool theShowPromptText;
209  static bool theShowSimpleShape;
210  static bool theShowVopInOutLabels;
211  static bool theShowStackedLook;
212  static bool theShowAnimations;
213  static bool theAutoScroll;
214  static bool theTransientInfo;
215  static bool theFlagsAllowPreSelect;
216  static bool theAllowDiveIntoHDAs;
217  static bool theCopyPathsToClipboard;
218  static OPUI_OptionsCanvasMap theRegisteredCanvases;
219  static OPUI_GraphBadgeArray theRegisteredBadges;
220  static OPUI_GraphTextBadgeArray theRegisteredTextBadges;
221 };
222 
223 #endif
224 
Unsorted map container.
Definition: UT_Map.h:83
#define OPUI_API
Definition: OPUI_API.h:10
#define SYS_VISIBILITY_EXPORT
GLuint color
Definition: glcorearb.h:1260
UT_Map< OPUI_GraphDisplayOptions *, CV_Canvas * > OPUI_OptionsCanvasMap
SYS_VISIBILITY_EXPORT void OPUIaddTextBadges(OPUI_GraphTextBadgeArray *add_textbadges)
SYS_VISIBILITY_EXPORT void OPUIaddBadges(OPUI_GraphBadgeArray *add_badges)
const UT_IntArray & badgeNormalIndexes() const
const UT_IntArray & badgeLargeIndexes() const
const UT_IntArray & textBadgeIndexes() const
OPUI_GraphBadgeVisibility
GLsizei const GLfloat * value
Definition: glcorearb.h:823
double fpreal
Definition: SYS_Types.h:270