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) const;
45  void getMatchingEntries(
46  OP_GalleryEntryList &found,
47  const char *namepattern,
48  const char *labelpattern,
49  const char *keywordpattern,
50  const char *category,
51  const char *optable,
52  const char *optype) const;
53 
54  /// Returns the array of all keywords used by entries in all galleries
55  /// that match the requirement of the optable.
56  void getKeywords(UT_StringArray & keywords,
57  const char *optable = NULL);
58 
59  /// Adds an extra category even if no entry subscribes to it.
60  ///
61  /// @param optable The context in which extra category should appear.
62  /// @param category The category name to add.
63  void addExtraCategory( const char *optable,
64  const char *category );
65 
66  /// Gets a list of extra categories added for the given optable.
67  const UT_StringArray * getExtraCategories( const char *optable )const;
68 
69  void refreshAll(bool force);
70  void purgeInvalidGalleries();
71  void sendEvent(OP_GalleryChangeType changetype);
72  OP_GalleryNotifier &getEventNotifier();
73 
74  void getInstalledGalleryPaths(
75  UT_StringArray &gallerypaths,
76  bool includestandard,
77  bool includehda) const;
78 
79  void getCommonGalleryDirs(UT_StringArray & paths);
80 
81  // Controls whether galleries should create backup files when they
82  // are saved.
83  void setCreateBackups(bool createbackups);
84  bool getCreateBackups() const;
85 
86  // Returns whether or not we are allowed to save the preferences file.
87  // This will be false if there is a nosave file in the HOUDINI_PATH.
88  bool canSavePreferences() const;
89 
90  // Obtains the default gallery path.
91  const UT_String &getDefaultGallery();
92 
93  /// Gets the sort order of categories (when parent name is not a string).
94  /// Optionally the parent category may be provided in the form of a string
95  /// encoding subcategories separated with a slash. When the parent category
96  /// name is given, returns the order of sub-categories, if parent is found,
97  /// otherwise ther returned array will be empty.
98  const UT_StringArray *getCategorySortOrder(
99  const char *parent_category = NULL);
100 
101  // Returns the global gallery manager.
102  static OP_GalleryManager &getManager();
103 
104 protected:
106  virtual ~OP_GalleryManager();
107 
108  void clear();
109  void scanGalleriesPath();
110 
111  static void fullyQualifyGalleryPath(UT_String &path);
112 
113 private:
114  void loadPreferences();
115  void savePreferences();
116  void loadUiPreferences();
117  void saveUiPreferences();
118 
119  OP_GalleryList myGalleries;
120  UT_SymbolMap<int> myGalleriesTable;
121  OP_GalleryNotifier myNotifier;
122  UT_String myDefaultGallery;
123  UT_SymbolMap<UT_StringArray *> myExtraCategories;
124  bool myCreateBackups;
125  OP_GalleryCategoryOrder *myCategoryOrder;
126 };
127 
129 
130 #endif
131 
GLsizei const GLchar *const * path
Definition: glcorearb.h:3340
#define OP_API
Definition: OP_API.h:10
GLuint index
Definition: glcorearb.h:785