#include <sglbase.h>
Inheritance diagram for LibraryGallery:
Public Member Functions | |
LibraryGallery () | |
A base library gallery class with common library gallery stuff in. | |
~LibraryGallery () | |
virtual BOOL | IsLibraryGallery (void) |
To check if we're a library gallery. | |
virtual BOOL | IsLibraryGalleryWithNonLibraryGroups (void) |
To check if we're a dedicated library gallery, or a half+half (like the font gallery). | |
virtual BOOL | CanCreateIndexes (void) |
To determine if this gallery can generate indexes or not If you want to create indexes, override and return TRUE. | |
virtual BOOL | GetDefaults (String_256 *DefaultIndex, String_256 *IndexDesc, SGLibType *Type) |
To determine various library gallery default properties. | |
virtual BOOL | GetLibraryDirectoryName (String_256 *LibDirName) |
Get the default CD directory name for the gallery. | |
virtual BOOL | CheckForIndexMatch (StringBase *Txt) |
To see whether we should add this line of the index.txt file to this gallery. | |
virtual void | WorkOutSectionName (String_256 *Section) |
Works out which library gallery we are and returns a section name as appropriate. | |
virtual void | WorkOutDescriptionSectionName (String_256 *Section) |
Works out which library gallery we are and returns a description section name as appropriate. | |
virtual void | WorkOutLibraryTypeSectionName (String_256 *Section) |
Works out which library gallery we are and returns a library type section name as appropriate. | |
virtual SGDisplayGroup * | AddLibraryGroup (Library *LibraryToDisplay, INT32 NumItems) |
Create a library group, as opposed to a display group. | |
virtual BOOL | GetQuietStatus (void) |
Get the Quiet status of the gallery. | |
virtual void | SetQuietStatus (BOOL Status) |
Set the Quiet status of the gallery. | |
virtual BOOL | ScanForLocation (SGLibType Type, StringBase *Result) |
Searches all the drives for a CDROM drive. If it finds the Camelot CD mount here at Xara HQ, we point to that instead. Notes:. | |
virtual BOOL | CanSearchKeywords (void) |
Used to determine if this type of gallery supports keyword searching. At the moment, all except the fonts gallery do. | |
virtual MsgResult | Message (Msg *Message) |
Standard library gallery message handler. | |
virtual void | SelectionHasChanged (void) |
To inform the gallery that the selection has changed in some way. This function handles the default library gallery buttons. | |
BOOL | AddLibraryGroups (SGLibType LibType, String_256 *DefaultLibraryPath) |
Creates all teh library groups described in the GRM file, or passed in if non were in the GRM... | |
BOOL | AddGRMGroups (SGLibType LibType) |
Creates all the library groups described in the GRM file. | |
BOOL | ActuallyAddGRMGroups (List *TypeList, List *PathList, List *DescList, BOOL DescPresent, String_256 *SectionName, String_256 *DescriptionSectionName) |
Given two lists, create all the groups in the gallery from them. If the lists are null, then we go through the grmfile itself, slowly... | |
BOOL | GoAndAddGRMGroups (List *TypeList, List *PathList, List *DescList, BOOL DescPresent, String_256 *SectionName, String_256 *DescriptionSectionName) |
Given two lists, create all the groups in the gallery from them. Same as ActuallyAddGRMGroups but if the lists are null, then it doesn't go through the grmfile itself, slowly... as this is no longer relevent. | |
INT32 | GetDisplayMode (void) |
Get the current gallery display mode as passing in miscinfo structures... | |
void | RemoveSelectedLibraries (BOOL Warn) |
Removes all the selected groups in the library. | |
void | UpdateGRMFile (void) |
Updates the GRM file to reflect the status of the gallery (all the groups). | |
INT32 | LibraryGroupsInGallery (void) |
Count the number of library groups in the gallery. | |
void | GalleryAboutToClose (void) |
The gallery is about to close, so free any excess memory taken up by the indexes and things... | |
void | GalleryAboutToReOpen (void) |
The gallery is about to reopen, so recache any indexes or other information that we might need... | |
INT32 | RemoveSimilarLibraryGroups (PathName *FilesPath, String_256 *IndexFileName, BOOL RemoveFirstOne=TRUE, BOOL Redraw=TRUE, Library *DontKill=NULL) |
Removes all the groups with the same Index path... | |
virtual void | SuspendThumbnailDownloading () |
Prevents further thumbnail downloading and cancels the downloads already queued up. Used in response to a user cancel or a serious error. | |
virtual void | ResumeThumbnailDownloading () |
Restarts thumbnail downloading and clears all previous download erorrs. | |
BOOL | IsThumbDownloadingSuspended () |
virtual SGLibType | GetGalleryType () |
virtual String_256 * | GetDefaultLibraryPath () |
Library * | FindLibrary (const String_256 &rLibPath) |
virtual BOOL | OnGetButtonClicked () |
Attempts to download the main web resource index file from our web site, parse it and create corresponding gallery folders. | |
Static Public Member Functions | |
static BOOL | WipeGallerySettings (void) |
Function to remove all the current gallery settings. | |
Public Attributes | |
List | OpenLibFiles |
std::list< OpThumbDownload * > | m_lstPendingThumbs |
BOOL | m_bDiscardWebFolders |
BOOL | bThumbDownloading |
Static Public Attributes | |
static BOOL | AskAboutRemoving = FALSE |
static INT32 | OffsetOfFirstGroupRemoved = -1 |
static BOOL | FirstGroupRemovedSelectionState = FALSE |
static KernelBitmap * | TmpDraggingBitmap = NULL |
Protected Member Functions | |
virtual void | DoShadeGallery (BOOL ShadeIt) |
Handles the standard library gallery button shading in the gallery Notes:. | |
virtual BOOL | PreCreate (void) |
The LibraryGallery PreCreate handler. This overrides the base class PreCreate function. It is called at the very beginning of the SuperGallery::Create method, before the window has been created. | |
virtual BOOL | ApplyAction (SGActionType Action) |
Applies certain conventional gallery actions (usually associated with gallery buttons, for new, edit, delete, etc). | |
virtual BOOL | AddNewLibrary (PathName *LibPath, BOOL WipeOld, SGLibType LibType, BOOL Update=FALSE) |
This call will optionally kill all the old library groups and then recreate library groups for the given libpath Notes:. | |
virtual SGDisplayItem * | AddLibraryItem (SGDisplayGroup *LibraryGroup, Library *ParentLib, LibraryIndex ItemIndex, BOOL bNew=FALSE) |
Called by the Library class to create a display item for every item in a newly-scanned library file. It is essentially a callback to the gallery which requested that the library be scanned. | |
virtual void | HandleDragStart (DragMessage *DragMsg) |
Checks a DragMessage to see if it is a colour drag. If it is, then it creates a drag target for this gallerys listbox. | |
virtual SGDisplayItem * | CopyDisplayItem (SGDisplayItem *SourceItem, SGDisplayGroup *DestGroup, SGDisplayItem *TargetPosition) |
"Copies" the existing node in the tree in an appropriate fashion. | |
virtual void | AllItemsCopied (SGDisplayGroup *DestGroup) |
This upcall method is called after one or more items have been copied or moved by a gallery drag. It allows the gallery to do update things like broadcasting a message or getting a related window (eg colour line) to redraw at the end of a move/copy operation. This allows thousands of items to be moved/copied with only a single redraw/message-broadcast, etc at the very end. | |
virtual BOOL | BrowseClicked (void) |
Handle clicks on the browse button. | |
BOOL | BrowseClicked (String_256 *DefaultPath, SGLibType Type, INT32 Message) |
Shared Library Gallery Browse Clicked procedure. | |
virtual void | SortGallery (void) |
Sort the entire gallery alphabetically. | |
BOOL | SortOutGroupsAfterLibraryAdd (LibraryFile *LibFile, BOOL Update) |
This call will scroll to and redraw the newly added groups. Also, if we've just updated the group which is being added, we'll work out where it should be placed in the gallery... Notes: We assume the last group added to the gallery was placed at the end of the list... | |
virtual void | VirtualiseAllFoldedGroups () |
Go through the gallery tree and virtualise all folded groups which can be virtualised. | |
BOOL | RemoveWebFolders (SGLibType type) |
Reclaims space taken up by downloaded files of a certain type on the local machine. |
Definition at line 132 of file sglbase.h.
|
A base library gallery class with common library gallery stuff in.
Definition at line 183 of file sglbase.cpp. 00184 { 00185 if (!OpAddWebFolders::Init() || !OpAddWebLibrary::Init() || !OpThumbDownload::Init()) 00186 { 00187 ERROR3("Failed to init web operations"); 00188 } 00189 00190 // Initialising to true means Camelot will try and download thumbnails without you having to press the 'Get Fills' 00191 // (or equivalent) button. Because downloading is now suspended when an error occurs, offline users (with a 00192 // partial thumb stock) no longer get continual popups when scrolling down a page of unloaded thumbnails. 00193 // Fixes, with inetop.cpp change, #10471 00194 bThumbDownloading = TRUE; 00195 m_bDiscardWebFolders = FALSE; 00196 }
|
|
Definition at line 198 of file sglbase.cpp. 00199 { 00200 TRACEUSER( "Richard", _T("~LibraryGallery called\n")); 00201 }
|
|
Given two lists, create all the groups in the gallery from them. If the lists are null, then we go through the grmfile itself, slowly...
Definition at line 2039 of file sglbase.cpp. 02041 { 02042 ListItem *TypeItem = NULL; 02043 ListItem *PathItem = NULL; 02044 ListItem *DescItem = NULL; 02045 String_256 Entry; 02046 INT32 LineCount = 0; 02047 INT32 Line = 1; 02048 BOOL ValidLine = TRUE; 02049 BOOL GroupsAdded = FALSE; 02050 02051 // Work out the location of web folders so we can flag them as such 02052 String_256 strWebFoldersPath; 02053 GetAppCachePath(&strWebFoldersPath); 02054 02055 if(PathList != NULL) 02056 LineCount = PathList->GetCount() + 1; 02057 else 02058 while(ValidLine) 02059 { 02060 ValidLine = LibSettings::GetEntry(SectionName, Line++, &Entry); 02061 LineCount ++; 02062 }; 02063 02064 if(LineCount > 0) 02065 { 02066 String_64 SlowJob(_R(IDS_LIBRARY_SCANNING)); 02067 BeginSlowJob(LineCount, FALSE, &SlowJob); 02068 02069 // Need to reset the Quiet status before a stream of Library::Init calls 02070 SetQuietStatus(FALSE); 02071 02072 Line = 1; 02073 ValidLine = TRUE; 02074 02075 BOOL EscapePressed = FALSE; 02076 02077 while(ValidLine && !EscapePressed) 02078 { 02079 EscapePressed = !ContinueSlowJob(Line); 02080 02081 if(PathList != NULL) 02082 { 02083 if(PathItem == NULL) 02084 PathItem = PathList->GetHead(); 02085 else 02086 PathItem = PathList->GetNext(PathItem); 02087 ValidLine = (PathItem != NULL && ((LibSettingsListItem *)PathItem)->Line != NULL); 02088 if(ValidLine) 02089 Entry = *((LibSettingsListItem *)PathItem)->Line; 02090 Line ++; 02091 } 02092 else 02093 ValidLine = LibSettings::GetEntry(SectionName, Line++, &Entry); 02094 02095 if(ValidLine) 02096 { 02097 // See if we've got descriptions as well 02098 String_256 *pDescString = NULL; 02099 String_256 DescString; 02100 if(DescPresent) 02101 { 02102 if(DescList != NULL) 02103 { 02104 if(DescItem == NULL) 02105 DescItem = DescList->GetHead(); 02106 else 02107 DescItem = DescList->GetNext(DescItem); 02108 02109 if(DescItem != NULL && ((LibSettingsListItem *)DescItem)->Line != NULL) 02110 { 02111 DescString = *((LibSettingsListItem *)DescItem)->Line; 02112 pDescString = &DescString; 02113 } 02114 Line ++; 02115 } 02116 else 02117 { 02118 if(LibSettings::GetEntry(DescriptionSectionName, (Line-1), &DescString)) 02119 pDescString = &DescString; 02120 } 02121 } 02122 02123 // See if we've got library types as well 02124 SGLibType m_SGLibType; 02125 String_256 TypeString; 02126 INT32 TypeInt; 02127 if(DescPresent) 02128 { 02129 if(TypeList != NULL) 02130 { 02131 if(TypeItem == NULL) 02132 TypeItem = TypeList->GetHead(); 02133 else 02134 TypeItem = TypeList->GetNext(DescItem); 02135 02136 if(TypeItem != NULL && ((LibSettingsListItem *)TypeItem)->Line != NULL) 02137 { 02138 INT32 pos = 0; 02139 TypeString = *((LibSettingsListItem *)TypeItem)->Line; 02140 TypeInt = TypeString.ConvertToInteger(pos); 02141 m_SGLibType = (SGLibType)TypeInt; 02142 } 02143 } 02144 else 02145 { 02146 String_256 LibraryTypesSectionName; 02147 WorkOutLibraryTypeSectionName(&LibraryTypesSectionName); 02148 if(LibSettings::GetEntry(&LibraryTypesSectionName, (Line-1), &TypeString)) 02149 { 02150 INT32 pos = 0; 02151 TypeInt = TypeString.ConvertToInteger(pos); 02152 m_SGLibType = (SGLibType)TypeInt; 02153 } 02154 } 02155 } 02156 02157 02158 //>> webster (Adrian 3/01/96) 02159 // Check if the catalog file still exists and is accessible - the web clipart folder 02160 // might have been deleted in the meantime - in which case we'll skip it 02161 BOOL bIsWebFolder = (camStrstr((TCHAR*) Entry, (TCHAR*) strWebFoldersPath) != NULL); 02162 // BUT if it is a CD based folder and the CD ROM is not present then this test will fail. 02163 // This is very very very bad. We need to only check this if we are in the web case. 02164 // Otherwise, if the user opens the gallery without the CD ROM present, they loose all their 02165 // CD gallery entries. Older versions always show the glalery entries and it is only when 02166 // the user opens a section that it errors and tells them about the problem, giving them 02167 // a chance to fix it. 02168 // Neville 12/11/97 02169 BOOL bIsIndexPresent = (_access((TCHAR*) Entry, 0) != -1); 02170 if (!bIsWebFolder || (bIsWebFolder && bIsIndexPresent)) 02171 { 02172 // open the library file 02173 LibraryFile *LibFile = new LibraryFile; 02174 if (LibFile != NULL) 02175 { 02176 // 'Entry' now points to a specific index file. We have to add this to the 02177 // gallery... 02178 PathName path(Entry); 02179 if(!LibFile->AddSpecificIndex(this, &path, m_SGLibType, pDescString, 0, bIsWebFolder)) 02180 delete LibFile; 02181 else 02182 { 02183 OpenLibFiles.AddTail(LibFile); 02184 GroupsAdded = TRUE; 02185 } 02186 } 02187 } 02188 } 02189 } 02190 EndSlowJob(); 02191 } 02192 02193 return GroupsAdded; 02194 }
|
|
Creates all the library groups described in the GRM file.
Definition at line 1623 of file sglbase.cpp. 01624 { 01625 TRACEUSER( "Matt", _T("AddGRMGroups Called in base class\n")); 01626 String_256 SectionName; 01627 WorkOutSectionName(&SectionName); 01628 01629 // The two lists we are going to use to keep track of the two section that we require 01630 // Errr.. now there's three lists... Sorry. (Matt 25/09/2000) 01631 List *PathList = NULL; 01632 List *DescList = NULL; 01633 List *TypeList = NULL; 01634 01635 BOOL bRetVal = FALSE; 01636 01637 #ifdef SAVE_PREFS_TO_REGISTRY 01638 // Check to see if we have the gallery settings section in the registry 01639 // if we do then use that. 01640 // Otherwise, use check for the older ini file version and if present use that 01641 01642 // This is the main section name in the registry for gallery settings. 01643 String_256 KeySectionName(PRODUCT_REGISTRYKEY_GALLERY TEXT("\\")); 01644 // add in the required sub-section name that we are going to use 01645 KeySectionName += SectionName; 01646 01647 BOOL SectionPresent = CheckForRegistryEntry(KeySectionName); 01648 if (SectionPresent) 01649 { 01650 // We need to read the data from the registry as the section is present 01651 01652 // First do the pathnames list section 01653 LoadRegistryEntries Loader; 01654 BOOL StartedOk = Loader.StartLoading(&KeySectionName); 01655 ERROR3IF(!StartedOk,"LibraryGallery::UpdateGRMFile couldn't start saving the settings"); 01656 01657 PathList = new List; 01658 01659 // read all the lines from that section 01660 BOOL AddedItems = FALSE; 01661 INT32 NumberSectionItems = 0; 01662 if (PathList && StartedOk) 01663 { 01664 String_256 Entry; 01665 while (Loader.LoadNextEntry(&Entry)) 01666 { 01667 LibSettingsListItem *LibSettingsItem = new LibSettingsListItem(&Entry); 01668 PathList->AddTail((ListItem *)LibSettingsItem); 01669 AddedItems = TRUE; 01670 } 01671 // remember how many items we got 01672 NumberSectionItems = Loader.GetNumberOfItemsLoaded(); 01673 Loader.StopLoading(); 01674 } 01675 01676 // See if we've got descriptions section as well 01677 String_256 DescriptionSectionName; 01678 WorkOutDescriptionSectionName(&DescriptionSectionName); 01679 // This is the main section name in the registry for gallery settings. 01680 String_256 DescriptionKeySectionName(PRODUCT_REGISTRYKEY_GALLERY TEXT("\\")); 01681 // add in the required sub-section name that we are going to use 01682 DescriptionKeySectionName += DescriptionSectionName; 01683 BOOL DescriptionsPresent = FALSE; 01684 String_256 DescEntry; 01685 01686 // First do the pathnames list section 01687 LoadRegistryEntries DescLoader; 01688 DescriptionsPresent = DescLoader.StartLoading(&DescriptionKeySectionName); 01689 ERROR3IF(!DescriptionsPresent,"LibraryGallery::UpdateGRMFile couldn't start saving the settings"); 01690 01691 // build up a list of the items in this section 01692 DescList = new List; 01693 INT32 NumberDescriptionItems = 0; 01694 if (DescList && DescriptionsPresent) 01695 { 01696 while (DescLoader.LoadNextEntry(&DescEntry)) 01697 { 01698 LibSettingsListItem *LibSettingsItem = new LibSettingsListItem(&DescEntry); 01699 DescList->AddTail((ListItem *)LibSettingsItem); 01700 AddedItems = TRUE; 01701 } 01702 // remember how many items we got 01703 NumberDescriptionItems = DescLoader.GetNumberOfItemsLoaded(); 01704 DescLoader.StopLoading(); 01705 } 01706 01707 01708 // See if we've got library types section as well 01709 String_256 LibraryTypesSectionName; 01710 WorkOutLibraryTypeSectionName(&LibraryTypesSectionName); 01711 // This is the main section name in the registry for gallery settings. 01712 String_256 LibraryTypesKeySectionName(PRODUCT_REGISTRYKEY_GALLERY TEXT("\\")); 01713 // add in the required sub-section name that we are going to use 01714 LibraryTypesKeySectionName += LibraryTypesSectionName; 01715 BOOL LibraryTypesPresent = FALSE; 01716 String_256 TypesEntry; 01717 01718 // First do the pathnames list section 01719 LoadRegistryEntries TypesLoader; 01720 LibraryTypesPresent = TypesLoader.StartLoading(&LibraryTypesKeySectionName); 01721 ERROR3IF(!LibraryTypesPresent,"LibraryGallery::UpdateGRMFile couldn't start saving the LibraryTypes"); 01722 01723 // build up a list of the items in this section 01724 TypeList = new List; 01725 INT32 NumberLibraryTypesItems = 0; 01726 if (TypeList && LibraryTypesPresent) 01727 { 01728 while (TypesLoader.LoadNextEntry(&TypesEntry)) 01729 { 01730 LibSettingsListItem *LibSettingsItem = new LibSettingsListItem(&TypesEntry); 01731 TypeList->AddTail((ListItem *)LibSettingsItem); 01732 AddedItems = TRUE; 01733 } 01734 // remember how many items we got 01735 NumberLibraryTypesItems = TypesLoader.GetNumberOfItemsLoaded(); 01736 TypesLoader.StopLoading(); 01737 } 01738 01739 01740 // >>webster 01741 // This is the main section name in the registry for gallery settings. 01742 String_256 RootURLKeySectionName(PRODUCT_REGISTRYKEY_GALLERY TEXT("\\")); 01743 // add in the required sub-section name that we are going to use 01744 RootURLKeySectionName += String_256(_R(IDS_ROOTURL)); 01745 LoadRegistryEntries URLLoader; 01746 if (URLLoader.StartLoading(&RootURLKeySectionName)) 01747 URLLoader.LoadNextEntry(&Library::URLBase); 01748 URLLoader.StopLoading(); 01749 // <<webster 01750 01751 // If we have a matching set of pathname and description sections then add those items 01752 // Otherwise, just leave the gallery blank 01753 if (NumberDescriptionItems == NumberSectionItems && 01754 NumberSectionItems != 0 && NumberDescriptionItems != 0 && 01755 PathList != NULL && DescList != NULL) 01756 { 01757 // Add the sections to the gallery 01758 bRetVal = GoAndAddGRMGroups(/*LibType*/TypeList , PathList, DescList, DescriptionsPresent, &SectionName, &DescriptionSectionName); 01759 } 01760 } 01761 else 01762 #endif 01763 { 01764 // read the data from the ini file 01765 String_256 Entry; 01766 01767 // Right, only return false if the section wasn't found in the file 01768 // The contents of the section could be null, this would mean there are no libraries 01769 // shown, but if that's what they want then fair enough 01770 FilePos SectionNamePos = 0; 01771 if(!LibSettings::GetEntry(&SectionName, 0, &Entry, &SectionNamePos)) 01772 return FALSE; 01773 01774 // See if we've got descriptions as well 01775 String_256 DescriptionSectionName(SectionName); 01776 WorkOutDescriptionSectionName(&DescriptionSectionName); 01777 BOOL DescriptionsPresent = FALSE; 01778 String_256 DescEntry; 01779 FilePos DescriptionPos = 0; 01780 if(LibSettings::GetEntry(&DescriptionSectionName, 0, &DescEntry, &DescriptionPos)) 01781 DescriptionsPresent = TRUE; 01782 01783 // If the [SectionName] appears later than the [DescriptionSectionName] then the 01784 // [Description] one is invalid... 01785 // Perhaps in the future we should change the SectionNames so that old versions of Camelot 01786 // won't affect new things like this... 01787 if(DescriptionPos < SectionNamePos) 01788 DescriptionsPresent = FALSE; 01789 01790 // See if we've got library types as well 01791 String_256 LibraryTypesSectionName(SectionName); 01792 WorkOutLibraryTypeSectionName(&LibraryTypesSectionName); 01793 BOOL LibraryTypesPresent = FALSE; 01794 String_256 TypeEntry; 01795 FilePos LibraryTypesPos = 0; 01796 if(LibSettings::GetEntry(&LibraryTypesSectionName, 0, &TypeEntry, &LibraryTypesPos)) 01797 LibraryTypesPresent = TRUE; 01798 01799 01800 PathList = new List; 01801 if(PathList != NULL && !LibSettings::BuildList(&SectionName, PathList)) 01802 { 01803 PathList->DeleteAll(); 01804 delete PathList; 01805 PathList = NULL; 01806 } 01807 01808 DescList = NULL; 01809 if(DescriptionsPresent) 01810 { 01811 DescList = new List; 01812 if(DescList != NULL && !LibSettings::BuildList(&DescriptionSectionName, DescList)) 01813 { 01814 DescList->DeleteAll(); 01815 delete DescList; 01816 DescList = NULL; 01817 } 01818 } 01819 01820 TypeList = new List; 01821 if(LibraryTypesPresent) 01822 { 01823 TypeList = new List; 01824 if(TypeList != NULL && !LibSettings::BuildList(&LibraryTypesSectionName, TypeList)) 01825 { 01826 TypeList->DeleteAll(); 01827 delete TypeList; 01828 TypeList = NULL; 01829 } 01830 } 01831 01832 01833 01834 //>> webster (Adrian 3/01/97) 01835 String_256 strURLBaseSectionName(_R(IDS_ROOTURL)); 01836 String_256 strRootURL; 01837 if (LibSettings::GetEntry(&strURLBaseSectionName, 1, &strRootURL, NULL)) 01838 Library::URLBase = strRootURL; 01839 //<< webster 01840 01841 bRetVal = ActuallyAddGRMGroups(TypeList /*LibType*/, PathList, DescList, DescriptionsPresent, &SectionName, &DescriptionSectionName); 01842 01843 } 01844 01845 // Free up memory entailed in lists 01846 if(PathList != NULL) 01847 { 01848 PathList->DeleteAll(); 01849 delete PathList; 01850 } 01851 01852 if(DescList != NULL) 01853 { 01854 DescList->DeleteAll(); 01855 delete DescList; 01856 } 01857 01858 if(TypeList != NULL) 01859 { 01860 TypeList->DeleteAll(); 01861 delete TypeList; 01862 } 01863 01864 return bRetVal; 01865 }
|
|
Create a library group, as opposed to a display group.
Reimplemented from SuperGallery. Reimplemented in LibClipartSGallery, LibFillsSGallery, and FontsSGallery. Definition at line 301 of file sglbase.cpp. 00302 { 00303 return SuperGallery::AddLibraryGroup(LibraryToDisplay, NumItems); 00304 }
|
|
Creates all teh library groups described in the GRM file, or passed in if non were in the GRM...
Definition at line 1557 of file sglbase.cpp. 01558 { 01559 TRACEUSER( "Matt", _T("AddLibraryGroups called in Base Class\n")); 01560 // ERROR3_PF(("LibraryGallery::AddLibraryGroups -> %s", (TCHAR *)*DefaultLibraryPath)); 01561 01562 BOOL AddedGroups = FALSE; 01563 01564 if(AddGRMGroups(LibType)) 01565 { 01566 AddedGroups = TRUE; 01567 } 01568 else 01569 { 01570 01571 // Matt - 03/01/2001 01572 // This method is only ever called from derived classes and the check below is made in each one of them before calling... 01573 // Therefore, this change will not affect their operation - it DOES mean that we can now pre-create a gallery with CD stuff 01574 // from multiple sources... used in the clipart/web themes precreation... 01575 01576 // if (OpenLibFiles.IsEmpty()) // We have no libraries, so open the default library 01577 // { 01578 String_64 SlowJob(_R(IDS_LIBRARY_SCANNING)); 01579 BeginSlowJob(-1, FALSE, &SlowJob); 01580 01581 // open the library file 01582 LibraryFile *LibFile = new LibraryFile; 01583 if (LibFile != NULL) 01584 { 01585 // OK. Lets initialise the library. This will call us back via base-class 01586 // SuperGallery methods to add a group and items for each {sub}library 01587 // found in the given library file. 01588 PathName ThePath(*DefaultLibraryPath); 01589 if (!LibFile->Init(this, &ThePath, LibType)) 01590 { 01591 // InformError if it returned FALSE? **** !!!! 01592 delete LibFile; 01593 } 01594 else 01595 { 01596 OpenLibFiles.AddTail(LibFile); 01597 AddedGroups = TRUE; 01598 //SortGallery(); 01599 } 01600 } 01601 01602 EndSlowJob(); 01603 // } 01604 } 01605 01606 return AddedGroups; 01607 }
|
|
Called by the Library class to create a display item for every item in a newly-scanned library file. It is essentially a callback to the gallery which requested that the library be scanned.
Reimplemented from SuperGallery. Reimplemented in LibClipartSGallery, LibFillsSGallery, and FontsSGallery. Definition at line 589 of file sglbase.cpp. 00590 { 00591 return SuperGallery::AddLibraryItem(LibraryGroup, ParentLib, ItemIndex, bNew); 00592 }
|
|
This call will optionally kill all the old library groups and then recreate library groups for the given libpath Notes:.
Definition at line 423 of file sglbase.cpp. 00424 { 00425 /* String_256 P(LibPath->GetPath()); 00426 ERROR3_PF(("LibraryGallery::AddNewLibrary -> %s", (TCHAR *)P));*/ 00427 00428 ERROR3IF(DisplayTree==NULL, "No display tree!"); 00429 if(DisplayTree == NULL) return FALSE; 00430 00431 if(LibPath == NULL) 00432 { 00433 ERROR3("LibraryGallery::AddNewLibrary given null LibPath"); 00434 return FALSE; 00435 } 00436 00437 if(WipeOld) 00438 { 00439 // Kill all existing lib groups 00440 OpenLibFiles.DeleteAll(); 00441 LibraryGallery::SelectionHasChanged(); 00442 } 00443 00444 // Open the new index and add it to the gallery 00445 LibraryFile *LibFile = new LibraryFile; 00446 if (LibFile != NULL) 00447 { 00448 // OK. Lets initialise the library. This will call us back via base-class 00449 // SuperGallery methods to add a group and items for each {sub}library 00450 // found in the given library file. 00451 if(!LibPath->IsValid()) 00452 { 00453 ERROR3("LibraryGallery::AddNewLibrary given an invalid default library path"); 00454 delete LibFile; 00455 InvalidateCachedFormat(); 00456 ReformatAndRedrawIfNecessary(); 00457 return FALSE; 00458 } 00459 00460 String_64 SlowJob(_R(IDS_LIBRARY_SCANNING)); 00461 BeginSlowJob(-1, FALSE, &SlowJob); 00462 00463 InvalidateCachedFormat(); 00464 00465 // This will give the option of generating a new index file - Don't do the scroll redraw here... 00466 if (!LibFile->Init(this, LibPath, LibType, Update, FALSE)) 00467 { 00468 // InformError if it returned FALSE? **** !!!! 00469 TRACEUSER( "Richard", _T("Problems with this new library... -> LibFile::Init returned false\n")); 00470 delete LibFile; 00471 EndSlowJob(); 00472 // And force a redraw of the entire list 00473 ReformatAndRedrawIfNecessary(); 00474 return FALSE; 00475 } 00476 else 00477 { 00478 SortOutGroupsAfterLibraryAdd(LibFile, Update); 00479 } 00480 00481 EndSlowJob(); 00482 } 00483 00484 // And force a redraw of the entire list 00485 InvalidateCachedFormat(); 00486 ReformatAndRedrawIfNecessary(); 00487 return TRUE; 00488 }
|
|
This upcall method is called after one or more items have been copied or moved by a gallery drag. It allows the gallery to do update things like broadcasting a message or getting a related window (eg colour line) to redraw at the end of a move/copy operation. This allows thousands of items to be moved/copied with only a single redraw/message-broadcast, etc at the very end.
Notes: The caller automatically causes the appropriate things to be redrawn, so we just need to update other things. e.g. The colour gallery broadcasts a ColourChangingMsg to make sure that the colour line and other interested parties all update appropriately.
Reimplemented from SuperGallery. Reimplemented in FontsSGallery. Definition at line 203 of file sglbase.h.
|
|
Applies certain conventional gallery actions (usually associated with gallery buttons, for new, edit, delete, etc).
Reimplemented from SuperGallery. Reimplemented in LibClipartSGallery, LibFillsSGallery, and FontsSGallery. Definition at line 395 of file sglbase.cpp. 00396 { 00397 return SuperGallery::ApplyAction(Action); 00398 }
|
|
Shared Library Gallery Browse Clicked procedure.
Definition at line 696 of file sglbase.cpp. 00697 { 00698 BOOL Updated = FALSE; 00699 PathName ThePath(*DefaultPath); 00700 00701 // This returns FALSE if Cancel was hit, or an error occurred. 00702 if(SGLibOil::GetLibPath(this, &ThePath, CanCreateIndexes(), Type, &Updated)) 00703 { 00704 if(!ThePath.IsValid()) 00705 { 00706 String_256 Tmp(ThePath.GetPath()); 00707 ERROR3_PF(("LibraryGallery::BrowseClicked GetLibPath returned an invalid pathname - '%s'", (TCHAR *)Tmp)); 00708 } 00709 else 00710 { 00711 // Remove by default 00712 INT32 ButtonPressed = 2; 00713 00714 if(LibraryGroupsInGallery() > 0 && LibraryGallery::AskAboutRemoving) 00715 { 00716 // Find out whether we should kill all the other groups 00717 ButtonPressed = InformMessage(Message, _R(IDS_REMOVE), _R(IDS_KEEP), _R(IDS_CANCEL)/*, _R(IDS_HELP)*/); 00718 Error::ClearError(); 00719 00720 if(ButtonPressed == 3) 00721 return FALSE; 00722 } 00723 00724 // Remove clicked if button pressed == 1 00725 if(AddNewLibrary(&ThePath, ButtonPressed == 1, Type, Updated)) 00726 { 00727 // Remember the new path for the next time 00728 *DefaultPath = ThePath.GetPath(); 00729 } 00730 00731 // Sort the entire gallery alphabetically 00732 SortGallery(); 00733 00734 ReformatAndRedrawIfNecessary(); 00735 00736 return TRUE; 00737 } 00738 } 00739 return FALSE; 00740 }
|
|
Handle clicks on the browse button.
Reimplemented in LibClipartSGallery, LibFillsSGallery, and FontsSGallery. Definition at line 674 of file sglbase.cpp. 00675 { 00676 return FALSE; 00677 }
|
|
To determine if this gallery can generate indexes or not If you want to create indexes, override and return TRUE.
Reimplemented in LibClipartSGallery, LibFillsSGallery, and FontsSGallery. Definition at line 756 of file sglbase.cpp. 00757 { 00758 return FALSE; 00759 }
|
|
Used to determine if this type of gallery supports keyword searching. At the moment, all except the fonts gallery do.
Reimplemented from SuperGallery. Reimplemented in LibClipartSGallery, LibFillsSGallery, and FontsSGallery. Definition at line 281 of file sglbase.cpp. 00282 { 00283 return SuperGallery::CanSearchKeywords(); 00284 }
|
|
To see whether we should add this line of the index.txt file to this gallery.
Reimplemented in LibClipartSGallery, LibFillsSGallery, and FontsSGallery. Definition at line 870 of file sglbase.cpp. 00871 { 00872 /* if(Type == SGLib_ClipArt && ((Kind.Sub(String_8("A"))!=-1) || (Kind.Sub(String_8("a"))!=-1)) ) Match = TRUE; 00873 if(Type == SGLib_ClipArt && ((Kind.Sub(String_8("B"))!=-1) || (Kind.Sub(String_8("b"))!=-1)) ) Match = TRUE; 00874 //if(Type == SGLib_Bitmap && ((Kind.Sub(String_8("B"))!=-1) || (Kind.Sub(String_8("b"))!=-1)) ) Match = TRUE; 00875 if(Type == SGLib_Font && ((Kind.Sub(String_8("F"))!=-1) || (Kind.Sub(String_8("f"))!=-1)) ) Match = TRUE; 00876 if(Type == SGLib_Texture && ((Kind.Sub(String_8("T"))!=-1) || (Kind.Sub(String_8("t"))!=-1)) ) Match = TRUE; 00877 if(Type == SGLib_Fractal && ((Kind.Sub(String_8("R"))!=-1) || (Kind.Sub(String_8("r"))!=-1)) ) Match = TRUE; 00878 if(Type == SGLib_Colour && ((Kind.Sub(String_8("C"))!=-1) || (Kind.Sub(String_8("c"))!=-1)) ) Match = TRUE;*/ 00879 00880 return FALSE; 00881 }
|
|
"Copies" the existing node in the tree in an appropriate fashion.
TargetPosition - NULL (to add the copied item to the end of the sibling list), or points to an item BEFORE which the copied item will be inserted.
Notes: This method should be overridden by derived galleries to provide appropriate behaviour (some galleries (e.g colour) will copy the real-item that the given display-item references to the new group (document), while other galleries (layer) may just move the item after all). Note the handy InsertCopiedItem and MoveBefore/After methods which are available to take all of the hard work out of copying/moving items! See the body of this method in the source code for example pseudocode. For real code, see the Colour Gallery (sgcolour.cpp)
Reimplemented from SuperGallery. Reimplemented in LibClipartSGallery, LibFillsSGallery, and FontsSGallery. Definition at line 657 of file sglbase.cpp. 00659 { 00660 return SuperGallery::CopyDisplayItem(SourceItem, DestGroup, TargetPosition); 00661 }
|
|
Handles the standard library gallery button shading in the gallery Notes:.
Reimplemented from SuperGallery. Reimplemented in LibClipartSGallery, LibFillsSGallery, and FontsSGallery. Definition at line 343 of file sglbase.cpp. 00344 { 00345 // make sure the standard gallery buttons are updated properly 00346 LibraryGallery::SelectionHasChanged(); 00347 }
|
|
Definition at line 2645 of file sglbase.cpp. 02646 { 02647 String_256 strLibPath(rLibPath); 02648 LibraryFile* pLibFile = (LibraryFile*) OpenLibFiles.GetHead(); 02649 while (pLibFile) 02650 { 02651 Library* pLib = (Library*) pLibFile->Libraries.GetHead(); 02652 while (pLib) 02653 { 02654 if (strLibPath.CompareTo(pLib->ReturnIndexLocation()->GetPath(), FALSE)) 02655 pLib = (Library*) pLibFile->Libraries.GetNext(pLib); 02656 else 02657 return pLib; // we found it 02658 } 02659 pLibFile = (LibraryFile*) OpenLibFiles.GetNext(pLibFile); 02660 } 02661 return NULL; 02662 }
|
|
The gallery is about to close, so free any excess memory taken up by the indexes and things...
Definition at line 2227 of file sglbase.cpp. 02228 { 02229 TRACEUSER( "Richard", _T("Gallery about to close\n")); 02230 02231 // Update the GRM file 02232 UpdateGRMFile(); 02233 02234 String_64 ProgMsg(_R(IDS_GALLERY_FREEING_MEMORY_ON_CLOSE)); 02235 BeginSlowJob(-1, TRUE, &ProgMsg); 02236 02237 if(FALSE) 02238 { 02239 // This will delete ALL the memory used by galleries when they close... 02240 OpenLibFiles.DeleteAll(); 02241 } 02242 else 02243 { 02244 if(!OpenLibFiles.IsEmpty()) 02245 { 02246 INT32 LibFileCount = OpenLibFiles.GetCount(); 02247 02248 if(LibFileCount > 0) 02249 { 02250 // Loop through library files 02251 for(INT32 LibFileLoop = 0; LibFileLoop < LibFileCount; LibFileLoop ++) 02252 { 02253 LibraryFile *LibFile = (LibraryFile *)OpenLibFiles.FindItem(LibFileLoop); 02254 INT32 LibCount = LibFile->Libraries.GetCount(); 02255 if(LibCount > 0) 02256 { 02257 // Loop through library groups 02258 for(INT32 LibLoop = 0; LibLoop < LibCount; LibLoop ++) 02259 { 02260 Library *Lib = (Library *)LibFile->Libraries.FindItem(LibLoop); 02261 if(Lib != NULL) 02262 Lib->FreeCachedIndexes(); 02263 } 02264 } 02265 } 02266 } 02267 } 02268 } 02269 02270 EndSlowJob(); 02271 02272 VirtualiseAllFoldedGroups(); 02273 }
|
|
The gallery is about to reopen, so recache any indexes or other information that we might need...
Definition at line 2353 of file sglbase.cpp. 02354 { 02355 TRACEUSER( "Richard", _T("Gallery about to open\n")); 02356 02357 if(!OpenLibFiles.IsEmpty()) 02358 { 02359 INT32 LibFileCount = OpenLibFiles.GetCount(); 02360 02361 if(LibFileCount > 0) 02362 { 02363 // Dummy run to count the groups for the progress bar 02364 INT32 GroupCount = 0; 02365 INT32 LibFileLoop = 0; 02366 for(LibFileLoop = 0; LibFileLoop < LibFileCount; LibFileLoop ++) 02367 { 02368 LibraryFile *LibFile = (LibraryFile *)OpenLibFiles.FindItem(LibFileLoop); 02369 if(LibFile != NULL) 02370 GroupCount += LibFile->Libraries.GetCount(); 02371 } 02372 02373 if(GroupCount > 0) 02374 { 02375 String_64 SlowJob(_R(IDS_LIBRARY_CACHING_INDEXES)); 02376 BeginSlowJob(GroupCount, FALSE, &SlowJob); 02377 } 02378 02379 // Count so we can tell where we are in the LibFile list 02380 INT32 LibFilesDeleted = 0; 02381 INT32 OriginalLibFileCount = LibFileCount; 02382 INT32 ActualCount = 0; 02383 02384 // Used by the error box if the CD's not there... 02385 INT32 LastButtonPressed = 2; 02386 02387 // Loop through library files 02388 for(LibFileLoop = 0; LibFileLoop < OriginalLibFileCount; LibFileLoop ++) 02389 { 02390 LibraryFile *LibFile = (LibraryFile *)OpenLibFiles.FindItem(LibFileLoop - LibFilesDeleted); 02391 if(LibFile != NULL) 02392 { 02393 INT32 LibCount = LibFile->Libraries.GetCount(); 02394 if(LibCount > 0) 02395 { 02396 // Count so we can tell where we are in the lib list 02397 INT32 LibsDeleted = 0; 02398 INT32 OriginalLibCount = LibCount; 02399 02400 // Loop through library groups 02401 for(INT32 LibLoop = 0; LibLoop < OriginalLibCount; LibLoop ++) 02402 { 02403 // Found a library, possibly without its index file in memory... 02404 Library *Lib = (Library *)LibFile->Libraries.FindItem(LibLoop - LibsDeleted); 02405 if(Lib != NULL) 02406 { 02407 if(LastButtonPressed != 3) 02408 LastButtonPressed = 2; 02409 02410 BOOL RepeatTheLoop = FALSE; 02411 BOOL Remove = FALSE; 02412 BOOL Recache = TRUE; 02413 do { 02414 RepeatTheLoop = FALSE; 02415 02416 Recache = Lib->ReCacheIndexes(); 02417 if(!Recache) 02418 { 02419 if(LastButtonPressed != 3) 02420 { 02421 String_256 WarnMsg; 02422 String_256 Section; 02423 String_64 SmallSection; 02424 Lib->GetLibraryTitle(&Section); 02425 Section.Left(&SmallSection, 36); 02426 // Be very careful that this message does not exceed 255 bytes... 02427 WarnMsg.MakeMsg(_R(IDS_LIBRARY_CD_REMOVED), (TCHAR *)SmallSection); 02428 02429 Error::SetError(0, WarnMsg, 0); 02430 LastButtonPressed = InformWarning(0, _R(IDS_CONTINUE), _R(IDS_RETRY), _R(IDS_QUIET), NULL, 2, 1); 02431 02432 // RETRY 02433 if(LastButtonPressed == 2) 02434 RepeatTheLoop = TRUE; 02435 } 02436 // Continue or Quiet 02437 if(LastButtonPressed == 1 || LastButtonPressed == 3) 02438 Remove = TRUE; 02439 } 02440 } while(RepeatTheLoop); 02441 02442 if(Remove) 02443 { 02444 // If there were problems recaching the index, delete the group from the gallery 02445 Lib->ParentGroup->DestroySubtree(TRUE); 02446 02447 // Delete the relevant library 02448 delete(LibFile->Libraries.RemoveItem(Lib)); 02449 LibsDeleted ++; 02450 02451 // And delete the libfile structure 02452 LibCount = LibFile->Libraries.GetCount(); 02453 if(LibCount == 0) 02454 { 02455 delete(OpenLibFiles.RemoveItem(LibFile)); 02456 LibFilesDeleted ++; 02457 } 02458 } 02459 } 02460 // Update the progress bar for each group 02461 ContinueSlowJob(++ActualCount); 02462 } 02463 } 02464 } 02465 } 02466 EndSlowJob(); 02467 } 02468 } 02469 }
|
|
Reimplemented in LibClipartSGallery, LibFillsSGallery, and FontsSGallery. Definition at line 267 of file sglbase.h. 00267 {return NULL;}
|
|
To determine various library gallery default properties.
Reimplemented in LibClipartSGallery, LibFillsSGallery, and FontsSGallery. Definition at line 779 of file sglbase.cpp. 00780 { 00781 /* case SGLib_ClipArt: 00782 *DefaultIndex = _R(IDS_LIBRARIES_CLIPART_FILENAME); // "XaraClip.txt"; 00783 *IndexDesc = _R(IDS_LIBRARIES_CLIPART_DESC); // "Clipart"; 00784 break; 00785 00786 case SGLib_Bitmap: 00787 *DefaultIndex = _R(IDS_LIBRARIES_BITMAPS_FILENAME); // "XaraBitm.txt"; 00788 *IndexDesc = _R(IDS_LIBRARIES_BITMAPS_DESC); // "Bitmap clipart"; 00789 break; 00790 00791 case SGLib_Font: 00792 *DefaultIndex = _R(IDS_LIBRARIES_FONTS_FILENAME); // "XaraFont.txt"; 00793 *IndexDesc = _R(IDS_LIBRARIES_FONTS_DESC); // "Font"; 00794 break; 00795 00796 case SGLib_Texture: 00797 *DefaultIndex = _R(IDS_LIBRARIES_FILLS_FILENAME); // "XaraText.txt"; 00798 *IndexDesc = _R(IDS_LIBRARIES_FILLS_DESC); // "Fills"; 00799 break; 00800 00801 case SGLib_Fractal: 00802 *DefaultIndex = _R(IDS_LIBRARIES_FRACTALS_FILENAME);// "XaraFrac.txt"; 00803 *IndexDesc = _R(IDS_LIBRARIES_FRACTALS_DESC); // "Fractal"; 00804 break; 00805 00806 case SGLib_Colour: 00807 *DefaultIndex = _R(IDS_LIBRARIES_COLOURS_FILENAME); // "XaraColo.txt"; 00808 *IndexDesc = _R(IDS_LIBRARIES_COLOURS_DESC); // "Colour"; 00809 break;*/ 00810 00811 return FALSE; 00812 }
|
|
Get the current gallery display mode as passing in miscinfo structures...
Reimplemented from SuperGallery. Definition at line 983 of file sglbase.cpp. 00984 { 00985 // Current display mode identifier 00986 return DisplayMode; 00987 }
|
|
Reimplemented in LibClipartSGallery, LibFillsSGallery, and FontsSGallery. Definition at line 265 of file sglbase.h.
|
|
Get the default CD directory name for the gallery.
Reimplemented in LibClipartSGallery, LibFillsSGallery, and FontsSGallery. Definition at line 830 of file sglbase.cpp. 00831 { 00832 /*case SGLib_Font: 00833 CDPath += String_16(_R(IDS_LIBRARIES_FONTS_DIRNAME)); 00834 break; 00835 case SGLib_ClipArt: 00836 case SGLib_Blank: 00837 CDPath += String_16(_R(IDS_LIBRARIES_CLIPART_DIRNAME)); 00838 break; 00839 case SGLib_Bitmap: 00840 CDPath += String_16(_R(IDS_LIBRARIES_BITMAPS_DIRNAME)); 00841 break; 00842 case SGLib_Texture: 00843 CDPath += String_16(_R(IDS_LIBRARIES_FILLS_DIRNAME)); 00844 break; 00845 case SGLib_Fractal: 00846 CDPath += String_16(_R(IDS_LIBRARIES_FRACTALS_DIRNAME)); 00847 break; 00848 case SGLib_Colour: 00849 CDPath += String_16(_R(IDS_LIBRARIES_COLOURS_DIRNAME)); 00850 break;*/ 00851 00852 return FALSE; 00853 }
|
|
Get the Quiet status of the gallery.
Reimplemented from SuperGallery. Reimplemented in LibClipartSGallery, LibFillsSGallery, and FontsSGallery. Definition at line 895 of file sglbase.cpp. 00896 { 00897 return FALSE; 00898 }
|
|
Given two lists, create all the groups in the gallery from them. Same as ActuallyAddGRMGroups but if the lists are null, then it doesn't go through the grmfile itself, slowly... as this is no longer relevent.
Definition at line 1893 of file sglbase.cpp. 01895 { 01896 ERROR2IF(PathList == NULL || DescList == NULL,FALSE,"GoAndAddGRMGroups bad lists!"); 01897 ERROR2IF(SectionName == NULL || DescriptionSectionName == NULL,FALSE,"GoAndAddGRMGroups bad section names!"); 01898 01899 ListItem *TypeItem = NULL; 01900 ListItem *PathItem = NULL; 01901 ListItem *DescItem = NULL; 01902 String_256 Entry; 01903 INT32 LineCount = 0; 01904 INT32 Line = 1; 01905 BOOL ValidLine = TRUE; 01906 BOOL GroupsAdded = FALSE; 01907 01908 LineCount = PathList->GetCount() + 1; 01909 01910 // Work out the location of web folders so we can flag them as such 01911 String_256 strWebFoldersPath; 01912 GetAppCachePath(&strWebFoldersPath); 01913 01914 if (LineCount > 0) 01915 { 01916 String_64 SlowJob(_R(IDS_LIBRARY_SCANNING)); 01917 BeginSlowJob(LineCount, FALSE, &SlowJob); 01918 01919 // Need to reset the Quiet status before a stream of Library::Init calls 01920 SetQuietStatus(FALSE); 01921 01922 Line = 1; 01923 ValidLine = TRUE; 01924 01925 BOOL EscapePressed = FALSE; 01926 01927 while (ValidLine && !EscapePressed) 01928 { 01929 EscapePressed = !ContinueSlowJob(Line); 01930 01931 if(PathItem == NULL) 01932 PathItem = PathList->GetHead(); 01933 else 01934 PathItem = PathList->GetNext(PathItem); 01935 ValidLine = (PathItem != NULL && ((LibSettingsListItem *)PathItem)->Line != NULL); 01936 if (ValidLine) 01937 Entry = *((LibSettingsListItem *)PathItem)->Line; 01938 Line ++; 01939 01940 if (ValidLine) 01941 { 01942 // See if we've got descriptions as well 01943 String_256 *pDescString = NULL; 01944 String_256 DescString; 01945 if (DescPresent) 01946 { 01947 if(DescItem == NULL) 01948 DescItem = DescList->GetHead(); 01949 else 01950 DescItem = DescList->GetNext(DescItem); 01951 01952 if(DescItem != NULL && ((LibSettingsListItem *)DescItem)->Line != NULL) 01953 { 01954 DescString = *((LibSettingsListItem *)DescItem)->Line; 01955 pDescString = &DescString; 01956 } 01957 } 01958 01959 Line ++; 01960 01961 01962 // See if we've got library types as well 01963 SGLibType m_SGLibType; 01964 String_256 TypeString; 01965 INT32 TypeInt; 01966 if (DescPresent) 01967 { 01968 if(TypeItem == NULL) 01969 TypeItem = TypeList->GetHead(); 01970 else 01971 TypeItem = TypeList->GetNext(TypeItem); 01972 01973 if(TypeItem != NULL && ((LibSettingsListItem *)TypeItem)->Line != NULL) 01974 { 01975 INT32 pos = 0; 01976 TypeString = *((LibSettingsListItem *)TypeItem)->Line; 01977 TypeInt = TypeString.ConvertToInteger(pos); 01978 m_SGLibType = (SGLibType)TypeInt; 01979 } 01980 } 01981 //>> webster (Adrian 3/01/96) 01982 // Check if the catalog file still exists and is accessible - the web clipart folder 01983 // might have been deleted in the meantime - in which case we'll skip it 01984 BOOL bIsWebFolder = !_tcsncicmp(Entry, strWebFoldersPath, _tcsclen(strWebFoldersPath)); 01985 // BUT if it is a CD based folder and the CD ROM is not present then this test will fail. 01986 // This is very very very bad. We need to only check this if we are in the web case. 01987 // Otherwise, if the user opens the gallery without the CD ROM present, they loose all their 01988 // CD gallery entries. Older versions always show the glalery entries and it is only when 01989 // the user opens a section that it errors and tells them about the problem, giving them 01990 // a chance to fix it. 01991 // Neville 12/11/97 01992 BOOL bIsIndexPresent = (_access((TCHAR*) Entry, 0) != -1); 01993 if (!bIsWebFolder || (bIsWebFolder && bIsIndexPresent)) 01994 { 01995 // open the library file 01996 LibraryFile *LibFile = new LibraryFile; 01997 if (LibFile != NULL) 01998 { 01999 PathName path(Entry); 02000 if(!LibFile->AddSpecificIndex(this, &path, m_SGLibType, pDescString, 0, bIsWebFolder)) 02001 delete LibFile; 02002 else 02003 { 02004 OpenLibFiles.AddTail(LibFile); 02005 GroupsAdded = TRUE; 02006 } 02007 } 02008 } 02009 } 02010 } 02011 EndSlowJob(); 02012 } 02013 02014 return GroupsAdded; 02015 }
|
|
Checks a DragMessage to see if it is a colour drag. If it is, then it creates a drag target for this gallerys listbox.
Reimplemented from SuperGallery. Reimplemented in LibClipartSGallery, LibFillsSGallery, and FontsSGallery. Definition at line 613 of file sglbase.cpp. 00614 { 00615 SuperGallery::HandleDragStart(DragMsg); 00616 }
|
|
To check if we're a library gallery.
Reimplemented from SuperGallery. Definition at line 141 of file sglbase.h. 00141 {return TRUE;};
|
|
To check if we're a dedicated library gallery, or a half+half (like the font gallery).
Reimplemented from SuperGallery. Reimplemented in LibClipartSGallery, LibFillsSGallery, and FontsSGallery. Definition at line 147 of file sglbase.h. 00147 {return FALSE;};
|
|
Definition at line 263 of file sglbase.h. 00263 {return !bThumbDownloading;}
|
|
Count the number of library groups in the gallery.
Definition at line 2210 of file sglbase.cpp. 02211 { 02212 return (OpenLibFiles.GetCount()); 02213 }
|
|
Standard library gallery message handler.
NOTE WELL that the SuperGallery base class handler does some funky things for us - see SuperGallery::Message - such as deleting our display subtree for any document which dies (which, uncannily, would explain why they go away like that when you close documents ;-), and shading the gallery when there are no documents present. [To override this behaviour in these cases, you should respond to the message, and return OK rather than calling the base class message handler]
Reimplemented from SuperGallery. Reimplemented in LibClipartSGallery, LibFillsSGallery, and FontsSGallery. Definition at line 230 of file sglbase.cpp. 00231 { 00232 // If we have no displaytree, then we have not been shown, or something terrible has 00233 // happened, so we don't bother handling any of these messages. 00234 if (DisplayTree == NULL) 00235 return(SuperGallery::Message(Message)); 00236 00237 if (IS_OUR_DIALOG_MSG(Message)) 00238 { 00239 DialogMsg* Msg = (DialogMsg*)Message; 00240 00241 switch (Msg->DlgMsg) 00242 { 00243 case DIM_LFT_BN_CLICKED: 00244 switch (Msg->GadgetID) 00245 { 00246 case _R(IDC_LIBGAL_REMOVE): 00247 RemoveSelectedLibraries(TRUE); 00248 UpdateGRMFile(); 00249 break; 00250 // >>webster (adrian 15/12/96) 00251 case _R(IDC_LIBGAL_WEB_CLIPART): 00252 case _R(IDC_LIBGAL_WEB_FILLS): 00253 case _R(IDC_LIBGAL_WEB_FONTS): 00254 OnGetButtonClicked(); 00255 break; 00256 case _R(IDC_LIBGAL_STOP_LOADING): 00257 SuspendThumbnailDownloading(); 00258 break; 00259 // <<webster 00260 } 00261 } 00262 } 00263 00264 return SuperGallery::Message(Message); 00265 }
|
|
Attempts to download the main web resource index file from our web site, parse it and create corresponding gallery folders.
Reimplemented in LibClipartSGallery. Definition at line 2584 of file sglbase.cpp. 02586 { 02587 // Connect to the Net if not yet connected 02588 // This works only to some extent i.e. AttemptConnection() returns TRUE if the dial-up dialog has been created 02589 // successfully but it can't tell if a TCP/IP connection is eventually established. Anyway, all network operations 02590 // will eventually time out if nothing seems to be happening. 02591 if (!InternetManager::AttemptConnection()) 02592 { 02593 InformError(_R(IDS_NOTCONNECTED), _R(IDS_OK)); 02594 return FALSE; 02595 } 02596 // (re)enable thumbnail downloading in case it has been stopped 02597 ResumeThumbnailDownloading(); 02598 ForceRedrawOfList(); 02599 if (OpAddWebFolders::Success[GetGalleryType()] && !m_bDiscardWebFolders) // nothing else to do 02600 return TRUE; 02601 m_bDiscardWebFolders = FALSE; 02602 String_256 strIndexURL(GetStringField((UINT32) GetGalleryType(), _R(IDS_MAININDEXURL))); 02603 // We initiate the download of the web clipart index file to a temporary file in $WINDIR\Temporary Internet Files 02604 String_256 strTempFile; 02605 GetTempInetDir(&strTempFile); 02606 strTempFile += GetStringField((UINT32) GetGalleryType(), _R(IDS_TMPFILES)); 02607 OpDescriptor* pOpDesc = OpDescriptor::FindOpDescriptor(CC_RUNTIME_CLASS(OpAddWebFolders)); 02608 if (pOpDesc != NULL) 02609 { 02610 AddWebFoldersParam* Param = new AddWebFoldersParam; 02611 ERROR2IF(!Param, FALSE, "Memory allocation error"); 02612 // Set up the op's param 02613 Param->localFile.SetPathName((TCHAR *) strTempFile); // local path of index file 02614 Param->strURL = strIndexURL; // URL of index file on our web server 02615 Param->pLibGal = this; // pointer to the gallery to add folders to 02616 Param->type = GetGalleryType(); 02617 // Invoke the operation - this will initiate the download of the index file 02618 // No result is returned, but the Op will report itself any error that might occur 02619 pOpDesc->Invoke((OpParam*) Param); 02620 } 02621 else 02622 { 02623 ERROR3("OpAddWebFolders not found"); 02624 return FALSE; 02625 } 02626 return TRUE; 02627 }
|
|
The LibraryGallery PreCreate handler. This overrides the base class PreCreate function. It is called at the very beginning of the SuperGallery::Create method, before the window has been created.
Reimplemented from SuperGallery. Reimplemented in LibClipartSGallery, LibFillsSGallery, and FontsSGallery. Definition at line 371 of file sglbase.cpp. 00372 { 00373 return SuperGallery::PreCreate(); 00374 }
|
|
Removes all the selected groups in the library.
Definition at line 1001 of file sglbase.cpp. 01002 { 01003 BOOL FullRedrawNecessary = FALSE; 01004 01005 ERROR3IF(DisplayTree == NULL, "LibraryGallery::RemoveSelectedLibraries called with null display tree"); 01006 01007 INT32 GroupCount = GetSelectedGroupCount(); 01008 01009 //ERROR3_PF(("Selected Group Count %d", GroupCount)); 01010 01011 if(GroupCount > 0) 01012 { 01013 INT32 ButtonPressed = 1; 01014 01015 if(Warn) 01016 ButtonPressed = InformMessage(_R(IDS_LIBRARY_CHECK_REMOVE), _R(IDS_REMOVE), _R(IDS_CANCEL)); 01017 01018 if(ButtonPressed == 1) 01019 { 01020 SGDisplayGroup *Group = DisplayTree->FindNextSelectedGroup(NULL); 01021 SGDisplayGroup *NextGroup = NULL; 01022 BOOL DoingSlowJob = FALSE; 01023 01024 INT32 ActualCount = 0; 01025 if(GroupCount > 0) 01026 { 01027 String_64 SlowJob(_R(IDS_LIBRARY_REMOVING_FOLDERS)); 01028 BeginSlowJob(GroupCount, FALSE, &SlowJob); 01029 DoingSlowJob = TRUE; 01030 } 01031 01032 while(Group != NULL) 01033 { 01034 NextGroup = DisplayTree->FindNextSelectedGroup(Group); 01035 01036 INT32 LibFileCount = OpenLibFiles.GetCount(); 01037 BOOL DeletedGroup = FALSE; 01038 01039 if(LibFileCount > 0) 01040 { 01041 // Count so we can tell where we are in the libfile list 01042 INT32 LibFilesDeleted = 0; 01043 INT32 OriginalLibFileCount = LibFileCount; 01044 01045 // Loop through library files 01046 for(INT32 LibFileLoop = 0; LibFileLoop < OriginalLibFileCount; LibFileLoop ++) 01047 { 01048 LibraryFile *LibFile = (LibraryFile *)OpenLibFiles.FindItem(LibFileLoop - LibFilesDeleted); 01049 01050 INT32 LibCount = LibFile->Libraries.GetCount(); 01051 01052 if(LibCount > 0) 01053 { 01054 // Count so we can tell where we are in the libfile list 01055 INT32 LibsDeleted = 0; 01056 INT32 OriginalLibCount = LibCount; 01057 01058 // Loop through library groups 01059 for(INT32 LibLoop = 0; LibLoop < OriginalLibCount; LibLoop ++) 01060 { 01061 Library *Lib = (Library *)LibFile->Libraries.FindItem(LibLoop - LibsDeleted); 01062 01063 if(Lib->ParentGroup == Group) 01064 { 01065 if(Lib->ParentGroup->GetNext() == NULL) 01066 FullRedrawNecessary = TRUE; 01067 01068 Lib->ParentGroup->DestroySubtree(TRUE); 01069 // >>webster 01070 if (Lib->IsWebLibrary()) 01071 { 01072 OpAddWebFolders::Success[Lib->GetType()] = FALSE; 01073 // Remove the files from the hard disk 01074 DownloadCache::RemoveFile(Lib->ReturnIndexLocation()->GetPath()); 01075 } 01076 // <<webster 01077 // Found our group 01078 delete(LibFile->Libraries.RemoveItem(Lib)); 01079 LibsDeleted ++; 01080 01081 LibCount = LibFile->Libraries.GetCount(); 01082 if(LibCount == 0) 01083 { 01084 delete(OpenLibFiles.RemoveItem(OpenLibFiles.FindItem(LibFileLoop))); 01085 LibFilesDeleted ++; 01086 } 01087 01088 DeletedGroup = TRUE; 01089 } 01090 01091 if(DeletedGroup) 01092 break; 01093 } 01094 } 01095 if(DeletedGroup) 01096 break; 01097 } 01098 } 01099 01100 // Get the next selected group from the gallery 01101 Group = NextGroup; 01102 01103 // Update the progress bar for each group 01104 if(DoingSlowJob) 01105 ContinueSlowJob(++ActualCount); 01106 } 01107 01108 if(DoingSlowJob) 01109 EndSlowJob(); 01110 01111 // Update the button shading status - 'Remove' should now be greyed out 01112 SelectionHasChanged(); 01113 01114 // Update the gallery 01115 InvalidateCachedFormat(); 01116 if(FullRedrawNecessary) 01117 ForceRedrawOfList(); 01118 else 01119 ReformatAndRedrawIfNecessary(); 01120 } 01121 } 01122 }
|
|
Removes all the groups with the same Index path...
Definition at line 1143 of file sglbase.cpp. 01145 { 01146 ERROR3IF(FilesPath == NULL || IndexFileName == NULL, "LibraryGallery::RemoveSimilarLibraryGroups given null params"); 01147 ERROR3IF(DisplayTree == NULL, "LibraryGallery::RemoveSimilarLibraryGroups called with null display tree"); 01148 01149 INT32 RemovedGroups = 0; 01150 01151 BOOL FullRedrawNecessary = FALSE; 01152 INT32 GroupCount = LibraryGroupsInGallery(); 01153 01154 LibraryGallery::OffsetOfFirstGroupRemoved = -1; 01155 INT32 OffsetCount = 0; 01156 01157 if(GroupCount > 0) 01158 { 01159 // Sort out the path we're checking against 01160 String_256 UpperIndex(*IndexFileName); 01161 UpperIndex.toUpper(); 01162 String_256 UpperFiles(FilesPath->GetPath()); 01163 LibraryFile::TidyUpSubPath(&UpperFiles); 01164 UpperFiles.toUpper(); 01165 01166 SGDisplayGroup *Group = (SGDisplayGroup *)DisplayTree->GetChild(); 01167 SGDisplayGroup *NextGroup = NULL; 01168 01169 // Loop through groups... 01170 while(Group != NULL) 01171 { 01172 NextGroup = (SGDisplayGroup *)Group->GetNext(); 01173 01174 INT32 LibFileCount = OpenLibFiles.GetCount(); 01175 BOOL DeletedGroup = FALSE; 01176 01177 if(LibFileCount > 0) 01178 { 01179 // Count so we can tell where we are in the libfile list 01180 INT32 LibFilesDeleted = 0; 01181 INT32 OriginalLibFileCount = LibFileCount; 01182 01183 // Loop through library files 01184 for(INT32 LibFileLoop = 0; LibFileLoop < OriginalLibFileCount; LibFileLoop ++) 01185 { 01186 LibraryFile *LibFile = (LibraryFile *)OpenLibFiles.FindItem(LibFileLoop - LibFilesDeleted); 01187 INT32 LibCount = LibFile->Libraries.GetCount(); 01188 01189 if(LibCount > 0) 01190 { 01191 // Count so we can tell where we are in the libfile list 01192 INT32 LibsDeleted = 0; 01193 INT32 OriginalLibCount = LibCount; 01194 01195 // Loop through library groups 01196 for(INT32 LibLoop = 0; LibLoop < OriginalLibCount; LibLoop ++) 01197 { 01198 Library *Lib = (Library *)LibFile->Libraries.FindItem(LibLoop - LibsDeleted); 01199 01200 if(Lib->ParentGroup == Group && Lib->SubLibPath != NULL && Lib->IndexFile != NULL && Lib != DontKill) 01201 { 01202 String_256 LibraryPath(Lib->SubLibPath->GetPath()); 01203 String_256 LibraryIndex(Lib->IndexFile->GetFileName(TRUE)); 01204 LibraryPath.toUpper(); 01205 LibraryIndex.toUpper(); 01206 01207 // Found a duplicate group - vape city ! 01208 if(UpperFiles == LibraryPath && UpperIndex == LibraryIndex) 01209 { 01210 // Keep the offset count in a static so we can do a proper insert for updated groups 01211 if(LibraryGallery::OffsetOfFirstGroupRemoved == -1) 01212 { 01213 LibraryGallery::OffsetOfFirstGroupRemoved = OffsetCount; 01214 LibraryGallery::FirstGroupRemovedSelectionState = Group->IsSelected(); 01215 } 01216 01217 RemovedGroups++; 01218 01219 if(Lib->ParentGroup->GetNext() == NULL) 01220 FullRedrawNecessary = TRUE; 01221 01222 Lib->ParentGroup->DestroySubtree(TRUE); 01223 01224 delete(LibFile->Libraries.RemoveItem(Lib)); 01225 LibsDeleted ++; 01226 01227 LibCount = LibFile->Libraries.GetCount(); 01228 if(LibCount == 0) 01229 { 01230 delete(OpenLibFiles.RemoveItem(OpenLibFiles.FindItem(LibFileLoop))); 01231 LibFilesDeleted ++; 01232 } 01233 01234 DeletedGroup = TRUE; 01235 } 01236 } 01237 01238 if(DeletedGroup) 01239 break; 01240 } 01241 } 01242 if(DeletedGroup) 01243 break; 01244 } 01245 } 01246 01247 // Get the next group from the gallery 01248 Group = NextGroup; 01249 OffsetCount++; 01250 } 01251 01252 // Update the button shading status - 'Remove' should now be greyed out 01253 SelectionHasChanged(); 01254 01255 // Update the gallery 01256 if(Redraw) 01257 { 01258 InvalidateCachedFormat(); 01259 if(FullRedrawNecessary) 01260 ForceRedrawOfList(); 01261 else 01262 ReformatAndRedrawIfNecessary(); 01263 } 01264 } 01265 01266 return RemovedGroups; 01267 }
|
|
Reclaims space taken up by downloaded files of a certain type on the local machine.
Reimplemented in LibClipartSGallery. Definition at line 2487 of file sglbase.cpp. 02488 { 02489 if (AskQuestion(_R(IDS_WARNREMOVE), _R(IDS_EMPTY), _R(IDS_CANCEL)) == _R(IDS_CANCEL)) 02490 return FALSE; 02491 02492 // If the application is installed on the local hard disk, web folders will be in the cache 02493 String_256 strLocation; 02494 GetAppDataPath(&strLocation); 02495 strLocation += GetStringField(type, _R(IDS_CACHEDIR)); 02496 02497 if (_access((TCHAR*) strLocation, 0) != -1) // found it 02498 { 02499 DownloadCache::Traverse(strLocation, TRUE); 02500 DownloadCache::Refresh(); 02501 SelectionHasChanged(); 02502 return TRUE; 02503 } 02504 else 02505 return FALSE; 02506 }
|
|
Restarts thumbnail downloading and clears all previous download erorrs.
Definition at line 2561 of file sglbase.cpp. 02562 { 02563 OpThumbDownload::ClearErrors(); 02564 bThumbDownloading = TRUE; 02565 }
|
|
Searches all the drives for a CDROM drive. If it finds the Camelot CD mount here at Xara HQ, we point to that instead. Notes:.
Reimplemented in LibClipartSGallery, LibFillsSGallery, and FontsSGallery. Definition at line 934 of file sglbase.cpp. 00935 { 00936 return FALSE; 00937 }
|
|
To inform the gallery that the selection has changed in some way. This function handles the default library gallery buttons.
Reimplemented from SuperGallery. Reimplemented in LibClipartSGallery, LibFillsSGallery, and FontsSGallery. Definition at line 319 of file sglbase.cpp. 00320 { 00321 // Always ungrey the library menu and browse buttons 00322 EnableGadget(_R(IDC_GALLERY_MENU), TRUE); 00323 EnableGadget(_R(IDC_LIBGAL_BROWSE), TRUE); 00324 00325 // Check if we should grey the 'remove' button 00326 INT32 Count = DisplayTree->GetSelectedGroupCount(); 00327 EnableGadget(_R(IDC_LIBGAL_REMOVE), (Count > 0)); 00328 EnableGadget(_R(IDC_LIBGAL_STOP_LOADING), !m_lstPendingThumbs.empty()); 00329 }
|
|
Set the Quiet status of the gallery.
Reimplemented from SuperGallery. Reimplemented in LibClipartSGallery, LibFillsSGallery, and FontsSGallery. Definition at line 912 of file sglbase.cpp.
|
|
Sort the entire gallery alphabetically.
Reimplemented in LibClipartSGallery, LibFillsSGallery, and FontsSGallery. Definition at line 950 of file sglbase.cpp. 00951 { 00952 // auto sorting disabled 00953 return; 00954 00955 // Sort alphabetically (and keep old sort keys)... 00956 SGSortKey TmpSortKeys[MaxSGSortKeys]; 00957 for (INT32 i = 0; i < MaxSGSortKeys; i++) 00958 { 00959 TmpSortKeys[i] = SortKeys[i]; 00960 SortKeys[i].SortKey = 0; 00961 SortKeys[i].Reversed = FALSE; 00962 } 00963 SortKeys[0].SortKey = 1; 00964 00965 ApplySortNow(TRUE); 00966 00967 for (i = 0; i < MaxSGSortKeys; i++) 00968 SortKeys[i] = TmpSortKeys[i]; 00969 00970 }
|
|
This call will scroll to and redraw the newly added groups. Also, if we've just updated the group which is being added, we'll work out where it should be placed in the gallery... Notes: We assume the last group added to the gallery was placed at the end of the list...
Definition at line 511 of file sglbase.cpp. 00512 { 00513 // If updating a group then adding it back to the gallery, we want it added in the position 00514 // that the old group was in... 00515 BOOL AddedLibFileToOpenLibList = FALSE; 00516 00517 if(Update && LibraryGallery::OffsetOfFirstGroupRemoved > -1 && GetDisplayTree() != NULL) 00518 { 00519 // If we were updating a group, then adding it, we need to move the new group into the old group's 00520 // position 00521 // Get the last group, and move it to where it should be... 00522 SGLibGroup *LastGroup = (SGLibGroup *)GetDisplayTree()->GetChild(); 00523 if(LastGroup != NULL) 00524 { 00525 while(LastGroup->GetNext() != NULL) 00526 LastGroup = (SGLibGroup *)LastGroup->GetNext(); 00527 00528 LastGroup->SetSelected(LibraryGallery::FirstGroupRemovedSelectionState); 00529 00530 // Find the group at offset 'OffsetOfFirstGroupRemoved' 00531 INT32 GroupCount = 0; 00532 SGLibGroup *Group = (SGLibGroup *)GetDisplayTree()->GetChild(); 00533 while(Group != NULL && GroupCount < LibraryGallery::OffsetOfFirstGroupRemoved) 00534 { 00535 Group = (SGLibGroup *)Group->GetNext(); 00536 GroupCount ++; 00537 } 00538 00539 // If we were the last item anyhow, don't worry about moving the groups and stuff... 00540 if(Group != NULL && Group->GetNext() != NULL) 00541 { 00542 Group->MoveBefore(LastGroup); 00543 OpenLibFiles.InsertBefore((LISTPOS)LibraryGallery::OffsetOfFirstGroupRemoved, LibFile); 00544 AddedLibFileToOpenLibList = TRUE; 00545 } 00546 } 00547 } 00548 00549 // Just a simple, add to bottom of list, type addition... 00550 if(!AddedLibFileToOpenLibList) 00551 OpenLibFiles.AddTail(LibFile); 00552 00553 // Now we've fiddled about with the groups, it should be safe to redraw properly... 00554 LibFile->DoScrollRedraw(); 00555 00556 UpdateGRMFile(); 00557 00558 return TRUE; 00559 }
|
|
Prevents further thumbnail downloading and cancels the downloads already queued up. Used in response to a user cancel or a serious error.
Definition at line 2525 of file sglbase.cpp. 02527 { 02528 bThumbDownloading = FALSE; 02529 if (!m_lstPendingThumbs.empty()) // we have downloads pending, so we must end them 02530 { 02531 OpThumbDownload::Suspend(); // temporarily suspend executing downloads so that the pending download list is frozen 02532 // Iterate through the download list and end all download operation 02533 std::list<OpThumbDownload*>::iterator listIterator = m_lstPendingThumbs.begin(); 02534 INT32 nListSize = m_lstPendingThumbs.size(); 02535 for (INT32 i = 0; i < nListSize; i++) 02536 { 02537 OpThumbDownload* pDownloadOp = *listIterator++; 02538 ERROR3IF(!pDownloadOp || !pDownloadOp->IsKindOf(CC_RUNTIME_CLASS(OpThumbDownload)), "Ooops! Invalid pointer - we're about to crash"); 02539 pDownloadOp->End(); 02540 } 02541 OpThumbDownload::Resume(); // we're done - let the thumbs requested by other galleries continue downloading 02542 ERROR3IF(!m_lstPendingThumbs.empty(),"Failed to remove all pending downloads"); // just in case 02543 } 02544 }
|
|
Updates the GRM file to reflect the status of the gallery (all the groups).
Definition at line 1380 of file sglbase.cpp. 01381 { 01382 if(DisplayTree == NULL) 01383 ERROR3("LibraryGallery::UpdateGRMFile called with null display tree"); 01384 01385 String_64 SlowJob(_R(IDS_LIBRARY_UPDATING_GRMF)); 01386 BeginSlowJob(-1, TRUE, &SlowJob); 01387 01388 INT32 Pass = 0; 01389 String_256 SectionName; 01390 01391 // We now do 3 passes (webster), the first builds the pathnames section, the second does the descriptions 01392 // the third lists the index files corresponding to web folders. Note - doing the section first is important so we 01393 // can detect if the descriptions are out of date, 01394 // or rather that the SectionName bit was generated by an old version (which will always add it to 01395 // the end of the file...) 01396 01397 //OK, we now do 4 passes - the extra pass adds the Library type for each item - needed for clipart gallery to 01398 //support multiple download and cache locations... 01399 while(++Pass <= 3) 01400 { 01401 if(Pass == 1) 01402 WorkOutSectionName(&SectionName); 01403 else if (Pass == 2) 01404 WorkOutDescriptionSectionName(&SectionName); 01405 else if (Pass == 3) 01406 WorkOutLibraryTypeSectionName(&SectionName); 01407 01408 #ifdef SAVE_PREFS_TO_REGISTRY 01409 // This is the main section name in the registry for gallery settings. 01410 String_256 KeySectionName(PRODUCT_REGISTRYKEY_GALLERY TEXT("\\")); 01411 // add in the required sub-section name that we are going to use 01412 KeySectionName += SectionName; 01413 01414 SaveRegistryEntries Saver; 01415 BOOL StartedOk = Saver.StartSaving(&KeySectionName); 01416 ERROR3IF(!StartedOk,"LibraryGallery::UpdateGRMFile couldn't start saving the settings"); 01417 01418 if(!OpenLibFiles.IsEmpty() && StartedOk) 01419 { 01420 INT32 LibFileCount = OpenLibFiles.GetCount(); 01421 01422 if(LibFileCount > 0) 01423 { 01424 // Loop through library files 01425 for(INT32 LibFileLoop = 0; LibFileLoop < LibFileCount; LibFileLoop ++) 01426 { 01427 LibraryFile *LibFile = (LibraryFile *)OpenLibFiles.FindItem(LibFileLoop); 01428 INT32 LibCount = LibFile->Libraries.GetCount(); 01429 if(LibCount > 0) 01430 { 01431 // Loop through library groups 01432 for(INT32 LibLoop = 0; LibLoop < LibCount; LibLoop ++) 01433 { 01434 Library *Lib = (Library *)LibFile->Libraries.FindItem(LibLoop); 01435 01436 // Add the pathname of the index file to the grm file 01437 if(Lib != NULL && Lib->IndexFile != NULL) 01438 { 01439 String_256 Line; 01440 if(Pass == 1) 01441 Line = Lib->IndexFile->GetPath(); 01442 else if (Pass == 2) 01443 Lib->GetLibraryTitle(&Line); 01444 else if (Pass == 3) 01445 { 01446 INT32 libtype = Lib->Type; 01447 String_256 libstringtype; 01448 libstringtype._MakeMsg("#1%d",libtype); 01449 Line = libstringtype; 01450 } 01451 01452 if (Line.Length()) 01453 { 01454 if (!Saver.SaveNextEntry(&Line)) 01455 { 01456 // Possibly write access denied on grm file... or disk full... 01457 EndSlowJob(); 01458 return; 01459 } 01460 } 01461 } 01462 } 01463 } 01464 } 01465 } 01466 } 01467 01468 // Close down the saving 01469 Saver.StopSaving(); 01470 #else 01471 LibSettings::StartOutput(&SectionName); 01472 LibSettings::AddSection(&SectionName); 01473 01474 if(!OpenLibFiles.IsEmpty()) 01475 { 01476 INT32 LibFileCount = OpenLibFiles.GetCount(); 01477 01478 if(LibFileCount > 0) 01479 { 01480 // Loop through library files 01481 for(INT32 LibFileLoop = 0; LibFileLoop < LibFileCount; LibFileLoop ++) 01482 { 01483 LibraryFile *LibFile = (LibraryFile *)OpenLibFiles.FindItem(LibFileLoop); 01484 INT32 LibCount = LibFile->Libraries.GetCount(); 01485 if(LibCount > 0) 01486 { 01487 // Loop through library groups 01488 for(INT32 LibLoop = 0; LibLoop < LibCount; LibLoop ++) 01489 { 01490 Library *Lib = (Library *)LibFile->Libraries.FindItem(LibLoop); 01491 01492 // Add the pathname of the index file to the grm file 01493 if(Lib != NULL && Lib->IndexFile != NULL) 01494 { 01495 String_256 Line; 01496 if(Pass == 1) 01497 Line = Lib->IndexFile->GetPath(); 01498 else if (Pass == 2) 01499 Lib->GetLibraryTitle(&Line); 01500 else if (Pass == 3) 01501 { 01502 INT32 libtype = Lib->Type; 01503 String_256 libstringtype; 01504 libstringtype._MakeMsg("#1%d",libtype); 01505 Line = libstringtype; 01506 } 01507 01508 if(!LibSettings::AddLine(&Line)) 01509 { 01510 // Possibly write access denied on grm file... or disk full... 01511 EndSlowJob(); 01512 return; 01513 } 01514 } 01515 } 01516 } 01517 } 01518 } 01519 } 01520 #endif 01521 } 01522 #ifdef SAVE_PREFS_TO_REGISTRY 01523 String_256 RootURLKeySectionName(PRODUCT_REGISTRYKEY_GALLERY TEXT("\\")); 01524 RootURLKeySectionName += String_256(_R(IDS_ROOTURL)); 01525 SaveRegistryEntries Saver; 01526 BOOL StartedOk = Saver.StartSaving(&RootURLKeySectionName); 01527 ERROR3IF(!StartedOk,"LibraryGallery::UpdateGRMFile couldn't start saving the settings"); 01528 Saver.SaveNextEntry(&Library::URLBase); 01529 #else 01530 String_256 strRootURLSectionName(_R(IDS_ROOTURL)); 01531 LibSettings::StartOutput(&strRootURLSectionName); 01532 LibSettings::AddSection(&strRootURLSectionName); 01533 LibSettings::AddLine(&Library::URLBase); 01534 #endif 01535 01536 EndSlowJob(); 01537 }
|
|
Go through the gallery tree and virtualise all folded groups which can be virtualised.
Definition at line 2289 of file sglbase.cpp. 02290 { 02291 const INT32 TimeLimit = 1 * 1000; // 1 second time out... 02292 02293 SGDisplayGroup *Group = (SGDisplayGroup *)GetDisplayTree()->GetChild(); 02294 if(Group != NULL) 02295 { 02296 INT32 Groups = 0; 02297 while(Group != NULL) 02298 { 02299 Groups++; 02300 Group = (SGDisplayGroup *)Group->GetNext(); 02301 } 02302 02303 String_64 ProgMsg(_R(IDS_GALLERY_FREEING_MEMORY_ON_CLOSE)); 02304 BeginSlowJob(Groups, TRUE, &ProgMsg); 02305 02306 INT32 Count = 0; 02307 Group = (SGDisplayGroup *)GetDisplayTree()->GetChild(); 02308 02309 MonotonicTime TimeCheck; 02310 BOOL DoneAGroup = FALSE; 02311 02312 while(Group != NULL) 02313 { 02314 if(ContinueSlowJob(Count++)) 02315 { 02316 if(Group->Flags.Folded && !Group->IsVirtualised() && Group->CanVirtualise() && !Group->IsSelected() 02317 && !Group->Flags.Modified) 02318 { 02319 Group->Virtualise(); 02320 DoneAGroup = TRUE; 02321 } 02322 Group = (SGDisplayGroup *)Group->GetNext(); 02323 } 02324 else 02325 Group = NULL; // Escape pressed - stop virtualising right now ! 02326 02327 // Do it here so we ALWAYS release at least one group (if there are any) 02328 if(DoneAGroup && TimeCheck.Elapsed(TimeLimit)) 02329 Group = NULL; // Time limit exceeded - stop virtualising right now ! 02330 } 02331 02332 EndSlowJob(); 02333 } 02334 }
|
|
Function to remove all the current gallery settings.
Definition at line 1349 of file sglbase.cpp. 01350 { 01351 01352 #ifdef SAVE_PREFS_TO_REGISTRY 01353 // Wipe the gallery settings from the registry 01354 // need to use this delete function so that works on Windows 95 and NT 01355 DeleteRegKeyAndSubKeys(hAppStateRegKey, PRODUCT_REGISTRYKEY_GALLERY); 01356 01357 // We must wipe the ini file as well as otherwise when the code checks to 01358 // see if the registry settings and then falls back on the ini file if they 01359 // are not there, then we wont be using the default settings. 01360 #endif 01361 01362 // Wipe the GRM ini file 01363 LibSettings::NukeSettings(); 01364 01365 return TRUE; 01366 }
|
|
Works out which library gallery we are and returns a description section name as appropriate.
Definition at line 1306 of file sglbase.cpp. 01307 { 01308 ERROR3IF(Section == NULL, "LibraryGallery::WorkOutDescriptionSectionName given null section"); 01309 01310 WorkOutSectionName(Section); 01311 *Section += String_256(_R(IDS_GRMFILE_DESCRIPTIONS)); 01312 }
|
|
Works out which library gallery we are and returns a library type section name as appropriate.
Definition at line 1329 of file sglbase.cpp. 01330 { 01331 ERROR3IF(Section == NULL, "LibraryGallery::WorkOutLibraryTypeSectionName given null section"); 01332 01333 WorkOutSectionName(Section); 01334 *Section += String_256(_R(IDS_GRMFILE_LIBRARYTYPES)); 01335 }
|
|
Works out which library gallery we are and returns a section name as appropriate.
Reimplemented in LibClipartSGallery, LibFillsSGallery, and FontsSGallery. Definition at line 1285 of file sglbase.cpp. 01286 { 01287 ERROR3IF(Section == NULL, "LibraryGallery::WorkOutSectionName given null section"); 01288 01289 *Section = _R(IDS_SGLBASE_SECTION_NAME); // TEXT("LibraryGallery"); 01290 }
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|