00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018 #ifndef __OP_GalleryManager__
00019 #define __OP_GalleryManager__
00020
00021 #include "OP_API.h"
00022 #include <UT/UT_Notifier.h>
00023 #include <UT/UT_Version.h>
00024 #include "OP_Gallery.h"
00025
00026 typedef enum {
00027 OP_GALLERY_ADDED,
00028 OP_GALLERY_REMOVED,
00029 OP_GALLERY_REFRESHED,
00030 OP_GALLERY_CONFIGCHANGE
00031 } OP_GalleryChangeType;
00032
00033 #define OP_GALLERY_DEFAULT_PATH "$HOME/houdini" \
00034 UT_SAVE_VERSION \
00035 "/gallery/Custom.gal"
00036
00037 typedef UT_NotifierImpl<OP_GalleryChangeType> OP_GalleryNotifier;
00038
00039 class OP_API OP_GalleryManager
00040 {
00041 public:
00042 int getNumGalleries() const;
00043 OP_Gallery *getGallery(int index) const;
00044 OP_Gallery *findGallery(const char *path) const;
00045 OP_Gallery *installGallery(const char *path,
00046 bool create, bool addtohistory);
00047 void removeGallery(const char *path);
00048 void removeGallery(int index);
00049 void getMatchingEntries(
00050 OP_GalleryEntryList &found,
00051 OP_Node *node) const;
00052 void getMatchingEntries(
00053 OP_GalleryEntryList &found,
00054 const char *namepattern,
00055 const char *labelpattern,
00056 const char *keywordpattern,
00057 const char *category,
00058 const char *optable,
00059 const char *optype) const;
00060
00061 void refreshAll(bool force);
00062 void purgeInvalidGalleries();
00063 void sendEvent(OP_GalleryChangeType changetype);
00064 OP_GalleryNotifier &getEventNotifier();
00065
00066 void getInstalledGalleryPaths(
00067 UT_StringArray &gallerypaths,
00068 bool includestandard,
00069 bool includehda) const;
00070
00071 void getCommonGalleryDirs(UT_StringList & paths);
00072
00073
00074
00075 void setCreateBackups(bool createbackups);
00076 bool getCreateBackups() const;
00077
00078
00079
00080 bool canSavePreferences() const;
00081
00082 static OP_GalleryManager &getManager();
00083
00084 protected:
00085 OP_GalleryManager();
00086 virtual ~OP_GalleryManager();
00087
00088 void clear();
00089 void scanGalleriesPath();
00090
00091 static void fullyQualifyGalleryPath(UT_String &path);
00092
00093 private:
00094 void loadPreferences();
00095 void savePreferences();
00096
00097 OP_GalleryList myGalleries;
00098 UT_SymbolTable myGalleriesTable;
00099 OP_GalleryNotifier myNotifier;
00100 bool myCreateBackups;
00101 };
00102
00103 OP_API extern OP_GalleryManager &OPgetGalleryManager();
00104
00105 #endif
00106