HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
OP_GalleryManager.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: OP_GalleryManager.h ( OP Library, C++)
7  *
8  * COMMENTS: Class to manage OP_Gallerys.
9  */
10 
11 #ifndef __OP_GalleryManager__
12 #define __OP_GalleryManager__
13 
14 #include "OP_API.h"
15 #include <UT/UT_Notifier.h>
16 #include <UT/UT_SymbolTable.h>
17 #include "OP_Gallery.h"
18 
19 class UT_StringArray;
20 class OP_GalleryCategoryOrder;
21 
22 typedef enum {
28 
29 
31 
33 {
34 public:
35  int getNumGalleries() const;
36  OP_Gallery *getGallery(int index) const;
37  OP_Gallery *findGallery(const char *path) const;
38  OP_Gallery *installGallery(const char *path,
39  bool create, bool addtohistory);
40  bool removeGallery(const char *path);
41  void removeGallery(int index);
42  void getMatchingEntries(
43  OP_GalleryEntryList &found,
44  OP_Node *node,
45  bool include_hidden = true) const;
46  void getMatchingEntries(
47  OP_GalleryEntryList &found,
48  const char *namepattern,
49  const char *labelpattern,
50  const char *keywordpattern,
51  const char *category,
52  const char *optable,
53  const char *optype,
54  bool include_hidden = true) const;
55 
56  /// Returns the array of all keywords used by entries in all galleries
57  /// that match the requirement of the optable.
58  void getKeywords(UT_StringArray & keywords,
59  const char *optable = NULL);
60 
61  /// Adds an extra category even if no entry subscribes to it.
62  ///
63  /// @param optable The context in which extra category should appear.
64  /// @param category The category name to add.
65  void addExtraCategory( const char *optable,
66  const char *category );
67 
68  /// Gets a list of extra categories added for the given optable.
69  const UT_StringArray * getExtraCategories( const char *optable )const;
70 
71  void refreshAll(bool force);
72  void purgeInvalidGalleries();
73  void sendEvent(OP_GalleryChangeType changetype);
74  OP_GalleryNotifier &getEventNotifier();
75 
76  void getInstalledGalleryPaths(
77  UT_StringArray &gallerypaths,
78  bool includestandard,
79  bool includehda) const;
80 
81  void getCommonGalleryDirs(UT_StringArray & paths);
82 
83  // Controls whether galleries should create backup files when they
84  // are saved.
85  void setCreateBackups(bool createbackups);
86  bool getCreateBackups() const;
87 
88  // Returns whether or not we are allowed to save the preferences file.
89  // This will be false if there is a nosave file in the HOUDINI_PATH.
90  bool canSavePreferences() const;
91 
92  // Obtains the default gallery path.
93  const UT_String &getDefaultGallery();
94 
95  /// Gets the sort order of categories (when parent name is not a string).
96  /// Optionally the parent category may be provided in the form of a string
97  /// encoding subcategories separated with a slash. When the parent category
98  /// name is given, returns the order of sub-categories, if parent is found,
99  /// otherwise ther returned array will be empty.
100  const UT_StringArray *getCategorySortOrder(
101  const char *parent_category = NULL);
102 
103  // Returns the global gallery manager.
104  static OP_GalleryManager &getManager();
105 
106 protected:
108  virtual ~OP_GalleryManager();
109 
110  void clear();
111  void scanGalleriesPath();
112 
113  static void fullyQualifyGalleryPath(UT_String &path);
114 
115 private:
116  void loadPreferences();
117  void savePreferences();
118  void loadUiPreferences();
119  void saveUiPreferences();
120 
121  OP_GalleryList myGalleries;
122  UT_SymbolMap<int> myGalleriesTable;
123  OP_GalleryNotifier myNotifier;
124  UT_String myDefaultGallery;
125  UT_SymbolMap<UT_StringArray *> myExtraCategories;
126  bool myCreateBackups;
127  OP_GalleryCategoryOrder *myCategoryOrder;
128 };
129 
131 
132 #endif
133 
GLsizei const GLchar *const * path
Definition: glcorearb.h:3341
SIM_API const UT_StringHolder force
#define OP_API
Definition: OP_API.h:10
GLuint index
Definition: glcorearb.h:786