HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros 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  bool showAllDependencies() const;
57  bool showSelectedDependencies() const;
58  bool showChildDependencies() const;
59  const UT_Array<UT_Color> &paletteColors() const;
60 
61  bool showNodeTypes() const;
62  bool showNodeShapes() const;
63  bool showCopPreviews() const;
64  bool showVopPreviews() const;
65  bool showPromptText() const;
66  bool showSimpleShape() const;
67  bool showVopInOutLabels() const;
68  bool showStackedLook() const;
69 
70  fpreal maxFlyoutScale() const;
71  fpreal maxNameWidth() const;
72  int minNameHeight() const;
73  int maxNameHeight() const;
74  fpreal wireFadeFactor() const;
75 
76  int badgeCount() const
77  { return theRegisteredBadges.entries(); }
79  { return myBadgeNormalIndexes; }
81  { return myBadgeLargeIndexes; }
82  const OPUI_GraphBadge &badge(int badgeidx) const;
83  bool badgeVisible(int badgeidx,
85  const OPUI_GraphProxyDescriptor &desc,
86  UT_StringHolder &icon,
87  UT_Color &color) const;
88  int textBadgeCount() const
89  { return theRegisteredTextBadges.entries(); }
91  { return myTextBadgeIndexes; }
92  const OPUI_GraphTextBadge &textBadge(int textbadgeidx) const;
93  bool textBadgeVisible(int textbadgeidx,
94  const OPUI_GraphProxyDescriptor &desc,
95  UT_StringHolder &text,
96  bool &full_text,
97  fpreal &full_text_max_width,
98  UT_Color &color) const;
99  bool prepareSingleThreadedBadges(int num_nodes);
100  void calculateSingleThreadedBadges(
102  static void installBadges();
103  static void installTextBadges();
104 
105  static void saveGlobalPrefs(AP_Interface &app);
106  static void loadGlobalPrefs(AP_Interface &app);
107  static void importGlobalPrefs(AP_Interface &app);
108  static void exportGlobalPrefs(AP_Interface &app);
109  static void addGlobalPref(const UT_StringHolder &pref);
110  static bool isGlobalPref(const UT_StringHolder &pref);
111 
112  static void clearAllContexts();
113 
114 private:
115  static void setGlobalPref(const UT_StringHolder &pref,
116  const UT_StringHolder &value);
117  static void getGlobalPref(const UT_StringHolder &pref,
118  UT_StringHolder &value);
119 
120  static bool loadPaletteColors(
121  const char *json_buf,
122  UT_Array<UT_Color> &colors);
123  static void loadDefaultPaletteColors(
124  UT_Array<UT_Color> &colors);
125  static void savePaletteColors(
126  const UT_Array<UT_Color> &colors,
127  UT_WorkBuffer &json_buf);
128 
129  static int findBadgeWithPref(
130  const UT_StringHolder &pref);
131  static int findTextBadgeWithPref(
132  const UT_StringHolder &pref);
133 
134  UT_StringHolder myPerfStatName;
135  bool myShowPerfStats;
136  bool myShowAllDependencies;
137  bool myShowSelectedDependencies;
138  bool myShowChildDependencies;
139  bool myPaletteColorsAreDefault;
140  UT_Array<UT_Color> myPaletteColors;
141 
142  UT_Array<UT_Array<bool> > mySingleThreadedBadgeData;
143  UT_Array<UT_StringArray> mySingleThreadedBadgeIcons;
144  UT_Array<UT_Array<UT_Color> > mySingleThreadedBadgeColors;
145  UT_IntArray mySingleThreadedBadgeIndexes;
146  UT_Array<UT_StringArray> mySingleThreadedTextBadgeData;
147  UT_Array<UT_Array<UT_Color> > mySingleThreadedTextBadgeColors;
148  UT_IntArray mySingleThreadedTextBadgeIndexes;
149  int mySingleThreadedDataId;
150  UT_IntArray myBadgeNormalIndexes;
151  UT_IntArray myBadgeLargeIndexes;
152  UT_IntArray myTextBadgeIndexes;
153  OP_Context myContext;
154 
155  static fpreal theMaxFlyoutScale;
156  static fpreal theMaxNameWidth;
157  static fpreal theMinNameHeight;
158  static fpreal theMaxNameHeight;
159  static fpreal theWireFadeFactor;
160  static fpreal theSnapRadius;
161  static fpreal theConnectorSnapRadius;
162  static fpreal theShakeSensitivity;
163  static bool theShowNodeTypes;
164  static bool theShowNodeShapes;
165  static bool theShowPreviews;
166  static bool theShowPromptText;
167  static bool theShowSimpleShape;
168  static bool theShowVopInOutLabels;
169  static bool theShowStackedLook;
170  static bool theShowAnimations;
171  static bool theTransientInfo;
172  static bool theFlagsAllowPreSelect;
173  static bool theAllowDiveIntoHDAs;
174  static bool theAutoScroll;
175  static OPUI_OptionsCanvasMap theRegisteredCanvases;
176  static OPUI_GraphBadgeArray theRegisteredBadges;
177  static OPUI_GraphTextBadgeArray theRegisteredTextBadges;
178 };
179 
180 #endif
181 
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:263