sglbase.h

Go to the documentation of this file.
00001 // $Id: sglbase.h 1282 2006-06-09 09:46:49Z alex $
00002 /* @@tag:xara-cn@@ DO NOT MODIFY THIS LINE
00003 ================================XARAHEADERSTART===========================
00004  
00005                Xara LX, a vector drawing and manipulation program.
00006                     Copyright (C) 1993-2006 Xara Group Ltd.
00007        Copyright on certain contributions may be held in joint with their
00008               respective authors. See AUTHORS file for details.
00009 
00010 LICENSE TO USE AND MODIFY SOFTWARE
00011 ----------------------------------
00012 
00013 This file is part of Xara LX.
00014 
00015 Xara LX is free software; you can redistribute it and/or modify it
00016 under the terms of the GNU General Public License version 2 as published
00017 by the Free Software Foundation.
00018 
00019 Xara LX and its component source files are distributed in the hope
00020 that it will be useful, but WITHOUT ANY WARRANTY; without even the
00021 implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
00022 See the GNU General Public License for more details.
00023 
00024 You should have received a copy of the GNU General Public License along
00025 with Xara LX (see the file GPL in the root directory of the
00026 distribution); if not, write to the Free Software Foundation, Inc., 51
00027 Franklin St, Fifth Floor, Boston, MA  02110-1301 USA
00028 
00029 
00030 ADDITIONAL RIGHTS
00031 -----------------
00032 
00033 Conditional upon your continuing compliance with the GNU General Public
00034 License described above, Xara Group Ltd grants to you certain additional
00035 rights. 
00036 
00037 The additional rights are to use, modify, and distribute the software
00038 together with the wxWidgets library, the wxXtra library, and the "CDraw"
00039 library and any other such library that any version of Xara LX relased
00040 by Xara Group Ltd requires in order to compile and execute, including
00041 the static linking of that library to XaraLX. In the case of the
00042 "CDraw" library, you may satisfy obligation under the GNU General Public
00043 License to provide source code by providing a binary copy of the library
00044 concerned and a copy of the license accompanying it.
00045 
00046 Nothing in this section restricts any of the rights you have under
00047 the GNU General Public License.
00048 
00049 
00050 SCOPE OF LICENSE
00051 ----------------
00052 
00053 This license applies to this program (XaraLX) and its constituent source
00054 files only, and does not necessarily apply to other Xara products which may
00055 in part share the same code base, and are subject to their own licensing
00056 terms.
00057 
00058 This license does not apply to files in the wxXtra directory, which
00059 are built into a separate library, and are subject to the wxWindows
00060 license contained within that directory in the file "WXXTRA-LICENSE".
00061 
00062 This license does not apply to the binary libraries (if any) within
00063 the "libs" directory, which are subject to a separate license contained
00064 within that directory in the file "LIBS-LICENSE".
00065 
00066 
00067 ARRANGEMENTS FOR CONTRIBUTION OF MODIFICATIONS
00068 ----------------------------------------------
00069 
00070 Subject to the terms of the GNU Public License (see above), you are
00071 free to do whatever you like with your modifications. However, you may
00072 (at your option) wish contribute them to Xara's source tree. You can
00073 find details of how to do this at:
00074   http://www.xaraxtreme.org/developers/
00075 
00076 Prior to contributing your modifications, you will need to complete our
00077 contributor agreement. This can be found at:
00078   http://www.xaraxtreme.org/developers/contribute/
00079 
00080 Please note that Xara will not accept modifications which modify any of
00081 the text between the start and end of this header (marked
00082 XARAHEADERSTART and XARAHEADEREND).
00083 
00084 
00085 MARKS
00086 -----
00087 
00088 Xara, Xara LX, Xara X, Xara X/Xtreme, Xara Xtreme, the Xtreme and Xara
00089 designs are registered or unregistered trademarks, design-marks, and/or
00090 service marks of Xara Group Ltd. All rights in these marks are reserved.
00091 
00092 
00093       Xara Group Ltd, Gaddesden Place, Hemel Hempstead, HP2 6EX, UK.
00094                         http://www.xara.com/
00095 
00096 =================================XARAHEADEREND============================
00097  */
00098 // SGLBase.h - SuperGallery Library Base class
00099 
00100 #ifndef INC_SGLBASE
00101 #define INC_SGLBASE
00102 
00103 //#include "sgallery.h" - in camtypes.h [AUTOMATICALLY REMOVED]
00104 //#include "sgtree.h" - in camtypes.h [AUTOMATICALLY REMOVED]
00105 //#include "msg.h" - in camtypes.h [AUTOMATICALLY REMOVED]
00106 //#include "thumb.h" - in camtypes.h [AUTOMATICALLY REMOVED]
00107 //#include "sgscan.h" - in camtypes.h [AUTOMATICALLY REMOVED]
00108 //#include "inetop.h"
00109 //#include "stl.h"
00110 #include <list>
00111 
00112 class PathName;
00113 class List;
00114 class LibraryFile;
00115 /***********************************************************************************************
00116 
00117 >   class LibraryGallery : public SuperGallery
00118 
00119     Author:     Richard_Millican (Xara Group Ltd) <camelotdev@xara.com>
00120     Created:    18/5/95 (Finally)
00121     Purpose:    A base library gallery class with common library gallery stuff in
00122 
00123     Notes:      SuperGalleries are specced in a number of docs including
00124                     specs\sgallery.doc ("super" gallery extensions)
00125                     specs\propui.doc  (gallery basic ui)
00126                 There is also howtouse\sgallery.doc which describes creating a supergallery
00127 
00128     SeeAlso:    SuperGallery; SGDisplayLibClipart
00129 
00130 ***********************************************************************************************/
00131 
00132 class LibraryGallery : public SuperGallery
00133 {
00134     CC_DECLARE_DYNCREATE(LibraryGallery)
00135 
00136 public:
00137     LibraryGallery();
00138     ~LibraryGallery();
00139 
00140     // TRUE if the SuperGallery is also a LibraryGallery, which it is !
00141     virtual BOOL IsLibraryGallery(void) {return TRUE;};
00142 
00143 public:
00144     // Library Galleries must override these
00145 
00146     // TRUE if the SuperGallery is also a LibraryGallery & has no non-library groups
00147     virtual BOOL IsLibraryGalleryWithNonLibraryGroups(void) {return FALSE;};
00148 
00149     // Can we create indexes ?
00150     virtual BOOL CanCreateIndexes(void);
00151 
00152     // Get various default bits 'n' pieces
00153     virtual BOOL GetDefaults(String_256 *DefaultIndex, String_256 *IndexDesc, SGLibType *Type);
00154 
00155     // Get the default CD directory name for the gallery
00156     virtual BOOL GetLibraryDirectoryName(String_256 *LibDirName);
00157 
00158     // Check the entry in the index.txt file with our gallery, and return TRUE if it's a match
00159     virtual BOOL CheckForIndexMatch(StringBase *Txt);
00160 
00161     // Return a Section name for this gallery...
00162     virtual void WorkOutSectionName(String_256 *Section);
00163 
00164     // Return a Description Section name for the gallery
00165     virtual void WorkOutDescriptionSectionName(String_256 *Section);
00166 
00167     // Return a Library Type Section name for the gallery
00168     virtual void WorkOutLibraryTypeSectionName(String_256 *Section);
00169 
00170     // Override for creating clipart library groups rather than display groups
00171     virtual SGDisplayGroup *AddLibraryGroup(Library *LibraryToDisplay, INT32 NumItems);
00172 
00173     // Get the quiet status of the gallery
00174     virtual BOOL GetQuietStatus(void);
00175 
00176     // Set the quiet status of the gallery
00177     virtual void SetQuietStatus(BOOL Status);
00178 
00179     // Scan for location of default CD library
00180     virtual BOOL ScanForLocation(SGLibType Type, StringBase *Result);
00181 
00182 public:
00183     // Library Galleries should override these
00184 
00185     // Can we support keywords ?
00186     virtual BOOL CanSearchKeywords(void);
00187 
00188     // Message handler
00189     virtual MsgResult Message(Msg* Message);
00190 
00191     // Override for button greying
00192     virtual void SelectionHasChanged(void);
00193 
00194 protected:
00195     virtual void DoShadeGallery(BOOL ShadeIt);  
00196     virtual BOOL PreCreate(void);
00197     virtual BOOL ApplyAction(SGActionType Action);
00198     virtual BOOL AddNewLibrary(PathName *LibPath, BOOL WipeOld, SGLibType LibType, BOOL Update = FALSE);
00199     virtual SGDisplayItem *AddLibraryItem(SGDisplayGroup *LibraryGroup, Library *ParentLib, LibraryIndex ItemIndex, BOOL bNew = FALSE);
00200     virtual void HandleDragStart(DragMessage *DragMsg);
00201     virtual SGDisplayItem *CopyDisplayItem(SGDisplayItem *SourceItem, 
00202                                 SGDisplayGroup *DestGroup, SGDisplayItem *TargetPosition);
00203     virtual void AllItemsCopied(SGDisplayGroup *DestGroup) {};
00204 
00205     // These could probably go in the library gallery base class if we ever create one
00206 
00207     // Handle clicks on the browse button
00208     virtual BOOL BrowseClicked(void);
00209     BOOL BrowseClicked(String_256 *DefaultPath, SGLibType Type, INT32 Message);
00210 
00211     // Sort the entire gallery alphabetically
00212     virtual void SortGallery(void);
00213 
00214     // Called by AddLibraryGroup to Scroll, redraw and shuffle about the groups after an add..
00215     BOOL SortOutGroupsAfterLibraryAdd(LibraryFile *LibFile, BOOL Update);
00216 
00217 public:
00218     // Add the library groups as described by the GRM file. If there were non there,
00219     // use the given path
00220     BOOL AddLibraryGroups(SGLibType LibType, String_256 *DefaultLibraryPath);
00221 
00222     // Use the indexes listed in the GRM file to add to the gallery
00223     BOOL AddGRMGroups(SGLibType LibType);
00224 
00225     // Helper function for AddGRMGroups which actually does the addition
00226     BOOL ActuallyAddGRMGroups(/*SGLibType LibType*/ List *TypeList, List *PathList, List *DescList, BOOL DescPresent,
00227         String_256 *SectionName, String_256 *DescriptionSectionName);
00228     // This is the same function but does not try and read from the GRM ini file if the lists are
00229     // empty as this is deprecated functionality.
00230     BOOL GoAndAddGRMGroups(/*SGLibType LibType*/ List *TypeList, List *PathList, List *DescList, BOOL DescPresent,
00231         String_256 *SectionName, String_256 *DescriptionSectionName);
00232 
00233     // Function to remove all the current gallery settings
00234     static BOOL WipeGallerySettings(void);
00235 
00236     // Return the current display mode identifier - needed for sorting
00237     INT32 GetDisplayMode(void);
00238 
00239     // Remove any selected gallery groups
00240     void RemoveSelectedLibraries(BOOL Warn);
00241 
00242     // Update the GRM file to reflect the new state of the gallery
00243     void UpdateGRMFile(void);
00244 
00245     // Count library groups in gallery
00246     INT32 LibraryGroupsInGallery(void);
00247 
00248     // The gallery is closing
00249     void GalleryAboutToClose(void);
00250 
00251     // The gallery is (re)opening
00252     void GalleryAboutToReOpen(void);
00253 
00254     // Remove all duplicate groups with the same file path and index name as the specified...
00255     INT32 RemoveSimilarLibraryGroups(PathName *FilesPath, String_256 *IndexFileName, BOOL RemoveFirstOne = TRUE, BOOL Redraw = TRUE, Library *DontKill = NULL);
00256 
00257     // >>webster (adrian 15/12/96)
00258 
00259     virtual void SuspendThumbnailDownloading();
00260 
00261     virtual void ResumeThumbnailDownloading();
00262 
00263     inline BOOL IsThumbDownloadingSuspended() {return !bThumbDownloading;}
00264 
00265     virtual SGLibType GetGalleryType() { return SGLib_Blank;}
00266 
00267     virtual String_256* GetDefaultLibraryPath() {return NULL;}
00268 
00269 
00270     Library* FindLibrary(const String_256& rLibPath);
00271 
00272     // Called in response to the user clicking the "Get X..." (X = "clipart","fonts", etc.) button in one of the online galleries 
00273     virtual BOOL OnGetButtonClicked();
00274 
00275 // <<webster
00276 
00277 
00278 protected:
00279     // Whizz through the gallery tree and virtualise all the folded groups which can be
00280     virtual void VirtualiseAllFoldedGroups();
00281 
00282     // Recursively remove web folders for the specified gallery - used by the Internet galleries
00283     BOOL RemoveWebFolders(SGLibType type);
00284 
00285 public:
00286 
00287     // All LibraryFiles we currently have open
00288     List OpenLibFiles;
00289 
00290     // List of pending thumb downloads 
00291     std::list<OpThumbDownload*> m_lstPendingThumbs;
00292 
00293     // Flag indicating whether this gallery's web folders have been discarded since last update (or beginning of session)
00294     // A value of TRUE indicates that we should attempt to download the indexes before any web folder operation
00295     BOOL m_bDiscardWebFolders;
00296 
00297 
00298 public: // statics
00299 
00300     // Ask the user if they want to 'remove all existing groups before adding this one or not'
00301     static BOOL AskAboutRemoving;
00302 
00303     // Offset into folders of the first one removed by RemoveSimilarLibraryGroups
00304     static INT32 OffsetOfFirstGroupRemoved;
00305 
00306     // Was the first removed group selected or not ?
00307     static BOOL FirstGroupRemovedSelectionState;
00308 
00309     // Copy of bitmap used for dragging
00310     static KernelBitmap* TmpDraggingBitmap;
00311 
00312     // Flag indicating whether we should attempt to download thumnails not found locally - makes sense only for Internet galleries
00313     BOOL bThumbDownloading;
00314 
00315 };
00316 
00317 #endif
00318 

Generated on Sat Nov 10 03:46:54 2007 for Camelot by  doxygen 1.4.4