#include <sglcart.h>
Inheritance diagram for LibClipartSGallery:

Public Member Functions | |
| LibClipartSGallery () | |
| LibClipartSGallery default constructor. | |
| ~LibClipartSGallery () | |
| LibClipartSGallery destructor. | |
| INT32 | GetClipTheme () const |
| INT32 | SetClipTheme (INT32 nNewIndex) |
| virtual BOOL | IsLibraryGalleryWithNonLibraryGroups (void) |
| To check if we're a dedicated library gallery, or a half+half (like the font gallery). | |
| virtual MsgResult | Message (Msg *Message) |
| A standard message handler, really. | |
| void | ProfileRedraw (ReDrawInfoType *Param) |
| virtual BOOL | CanSearchKeywords (void) |
| Used to determine if this type of gallery supports keyword searching. This one does. | |
| virtual SGDisplayGroup * | AddLibraryGroup (Library *LibraryToDisplay, INT32 NumItems) |
| Create a library group, as opposed to a display group Notes:. | |
| virtual BOOL | CanCreateIndexes (void) |
| To determine if this gallery can generate indexes or not. | |
| 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) |
| Returns the section name to use in the grm file. | |
| 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 | InitMenuCommands (void) |
| Initialises any menu commands that this gallery needs. | |
| virtual BOOL | BuildCommandMenu (GalleryContextMenu *TheMenu, SGMenuID MenuID) |
| To build a menu of commands to be popped up over the gallery. | |
| virtual OpState | GetCommandState (StringBase *CommandID, String_256 *ShadeReason) |
| To determine the state of a given menu item. This method is an exact parallel to an Op's GetState method (in fact, it is called by an Op's GetState). | |
| virtual void | DoCommand (StringBase *CommandID) |
| To apply a given command when it is chosen from the menu. | |
| virtual SGLibType | GetGalleryType () |
| virtual String_256 * | GetDefaultLibraryPath () |
| void | SelectionHasChanged (void) |
| To inform the gallery that the selection has changed in some way. We need to grey different buttons on different occasions Notes:. | |
| void | ModeHasChanged (void) |
| To toggle the visible/selectable items of this gallery between clipart and web themes Notes:. | |
| virtual BOOL | PreCreate (void) |
| The LibClipartSGallery 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 | OnGetButtonClicked (void) |
| Attempts to download the main web resource index file from our web site, parse it and create corresponding gallery folders. | |
| virtual BOOL | RemoveWebFolders (SGLibType type) |
| Reclaims space taken up by downloaded files of a certain type on the local machine. | |
Static Public Member Functions | |
| static LibClipartSGallery * | Instance () |
| static BOOL | Init (void) |
| static BOOL | ImportClipart (BOOL NewDocument, LibraryGallery *pSourceGallery) |
| To load/import all the selected clipart items one by one into camelot. Notes:. | |
Public Attributes | |
| bool | m_bRedraw |
| bool | m_bRestore |
Static Public Attributes | |
| static String_256 | DefaultLibraryPath = ClipartPath |
| static String_256 | ClipartPath = TEXT("D:\\clipart") |
| static String_256 | WebThemePath = TEXT("D:\\themes") |
| static INT32 | DefaultDisplayMode = 0 |
| static UINT32 | DefaultSortKeys = 1 |
| static String_256 | BatchSaveLocation = "" |
| static BOOL | DoSounds = TRUE |
| static LibClipartSGallery * | ThisGallery = NULL |
| static BOOL | QuietStatus = FALSE |
Protected Member Functions | |
| void | DoShadeGallery (BOOL ShadeIt) |
| To un-grey the options... button when there are no docs Notes:. | |
| virtual BOOL | ApplyAction (SGActionType Action) |
| Applies certain conventional gallery actions (usually associated with gallery buttons, for new, edit, delete, etc). | |
| 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. | |
| BOOL | LoadAndSave (void) |
| To load all the selected clipart items one by one into camelot and then to save them out again - useful for updating documents. | |
| 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. | |
| SGDisplayItem * | CopyDisplayItem (SGDisplayItem *SourceItem, SGDisplayGroup *DestGroup, SGDisplayItem *TargetPosition) |
| "Copies" the existing node in the tree in an appropriate fashion. | |
| BOOL | BrowseClicked (void) |
| Pops up the browse box and lets a new location be set for the clipart directory. | |
| void | SortGallery (void) |
| Sorts the contents of the gallery in an alphabetical fashion, whilst keeping the old sort key status... Notes:. | |
Private Attributes | |
| INT32 | m_nClipTheme |
Static Private Attributes | |
| static LibClipartSGallery * | m_pInstance = 0 |
Definition at line 130 of file sglcart.h.
|
|
LibClipartSGallery default constructor.
Definition at line 249 of file sglcart.cpp. 00250 { 00251 LibClipartSGallery::ThisGallery = this; 00252 m_bDiscardWebFolders = FALSE; 00253 // Default gallery size 00254 CSize Size(((333 * 2) - 32) - 32, 256); 00255 SetGallerySize(Size); 00256 m_pInstance = this; 00257 m_nClipTheme = 0; 00258 m_bRedraw = false; 00259 }
|
|
|
LibClipartSGallery destructor.
Definition at line 273 of file sglcart.cpp. 00274 { 00275 TRACEUSER( "Matt", _T("~LibClipartSGallery\n")); 00276 00277 OpenLibFiles.DeleteAll(); // Ensure all open libraries are closed 00278 LibClipartSGallery::ThisGallery = NULL; 00279 m_pInstance = 0; 00280 }
|
|
||||||||||||
|
Create a library group, as opposed to a display group Notes:.
Reimplemented from LibraryGallery. Definition at line 2044 of file sglcart.cpp. 02045 { 02046 TRACEUSER( "Matt", _T("Add library group called in clipart gallery\n")); 02047 ERROR3IF(LibraryToDisplay == NULL, "LibClipartSGallery::AddLibraryGroup - NULL parameter is illegal"); 02048 02049 if (DisplayTree == NULL) 02050 { 02051 ERROR3("LibClipartSGallery::AddLibraryGroup called before the DisplayTree was initialised!"); 02052 return(NULL); 02053 } 02054 02055 //Flag the gallery to redraw and check the group against the state of the web themes / clipart box 02056 m_bRedraw = true; 02057 SGLibGroup *TheGroup = (SGLibGroup *)DisplayTree->FindSubtree(this, NULL, LibraryToDisplay); 02058 02059 if (TheGroup == NULL) 02060 { 02061 // No existing group for that library, so create a new one 02062 TheGroup = new SGLibGroup(this, NULL, LibraryToDisplay); 02063 02064 if (TheGroup == NULL) // Failed! 02065 return(NULL); 02066 02067 // And add it to our display tree 02068 if (((GetClipTheme() == 0) && (LibraryToDisplay->Type == SGLib_ClipArt_WebThemes)) || ((GetClipTheme() == 1) && (LibraryToDisplay->Type == SGLib_ClipArt))) 02069 { 02070 TheGroup->Flags.Invisible = true; 02071 TheGroup->Flags.CanSelect = false; 02072 } 02073 DisplayTree->AddItem(TheGroup); 02074 TRACEUSER( "Matt", _T("...Add library group has just added the item to the display tree\n")); 02075 } 02076 else 02077 { 02078 if (((GetClipTheme() == 0) && (LibraryToDisplay->Type == SGLib_ClipArt_WebThemes)) || ((GetClipTheme() == 1) && (LibraryToDisplay->Type == SGLib_ClipArt))) 02079 { 02080 TheGroup->Flags.Invisible = true; 02081 TheGroup->Flags.CanSelect = false; 02082 } 02083 02084 TheGroup->DestroySubtree(FALSE); // Delete all items in the group 02085 } 02086 02087 return(TheGroup); 02088 }
|
|
||||||||||||||||||||
|
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 LibraryGallery. Definition at line 1802 of file sglcart.cpp. 01803 { 01804 TRACEUSER( "Matt", _T("Add library item called in clipart gallery\n")); 01805 ERROR3IF(LibraryGroup == NULL || ParentLib == NULL, 01806 "SuperGallery::AddLibraryItem - NULL params are illegal"); 01807 01808 ERROR3IF(LibraryGroup->GetParentLibrary() != ParentLib, 01809 "SuperGallery::AddLibraryitem - The DisplayGroup is not for the same library!"); 01810 01811 // Create a clipart library item 01812 01813 SGClipartItem *NewItem = new SGClipartItem(ItemIndex, bNew); 01814 01815 // Check for, and don't include if found in the Studio group, the line: 01816 // Rolex.art,Rather expensive watch,36,Rolex,Object|Time|Watch|Machine,113852 01817 if((ParentLib->Title != NULL) && (ParentLib->Title->Sub((String_8)"Studio") == 0)) 01818 { 01819 String_256 TmpPath; 01820 BOOL ok = ParentLib->GetFilename(ItemIndex, &TmpPath, FALSE); 01821 01822 if(ok) 01823 { 01824 INT32 Size = NewItem->GetFileSize(ParentLib); 01825 if(Size == 113852) 01826 { 01827 String_256 TmpPath; 01828 BOOL ok = ParentLib->GetFilename(ItemIndex, &TmpPath, FALSE); 01829 01830 if(TmpPath == (String_16)"Rolex.art") 01831 { 01832 delete NewItem; 01833 NewItem = FALSE; 01834 } 01835 } 01836 } 01837 } 01838 01839 /* SGSortKey SortKeys[MaxSGSortKeys]; 01840 for (INT32 i = 0; i < MaxSGSortKeys; i++) 01841 { 01842 SortKeys[i].SortKey = 0; 01843 SortKeys[i].Reversed = FALSE; 01844 } 01845 01846 SortKeys[0].SortKey = 1;*/ 01847 01848 if (NewItem != NULL) 01849 LibraryGroup->AddItem(NewItem/*, (SGSortKey *)SortKeys*/); 01850 01851 return(NewItem); 01852 }
|
|
|
Applies certain conventional gallery actions (usually associated with gallery buttons, for new, edit, delete, etc).
Reimplemented from LibraryGallery. Definition at line 489 of file sglcart.cpp. 00490 { 00491 // No display tree? Better forget about it then! 00492 if (DisplayTree == NULL) 00493 return(FALSE); 00494 00495 switch(Action) 00496 { 00497 case SGACTION_REDEFINE: 00498 break; 00499 00500 case SGACTION_APPLY: 00501 ImportClipart(TRUE, this); 00502 break; 00503 00504 /* case SGACTION_APPLYADJUST: 00505 ImportClipart(FALSE); 00506 break;*/ 00507 00508 case SGACTION_EDIT: 00509 // Ignored - libraries are currently read-only 00510 break; 00511 00512 case SGACTION_DELETE: 00513 // Ignored - libraries are currently read-only 00514 break; 00515 00516 case SGACTION_SETOPTIONS: // Set values in the options dialogue as it is opened 00517 { 00518 if (CurrentOptionsDlg == NULL) 00519 return(FALSE); 00520 00521 CurrentOptionsDlg->AddDisplayModeName(_R(IDS_GALLERYDM_LARGE)); // 0 00522 CurrentOptionsDlg->AddDisplayModeName(_R(IDS_GALLERYDM_FULLINFO)); // 1 00523 CurrentOptionsDlg->AddDisplayModeName(_R(IDS_GALLERYDM_SMALL)); // 2 00524 } 00525 break; 00526 00527 case SGACTION_SETSORTMODE: 00528 { 00529 if (CurrentSortDlg == NULL) 00530 return(FALSE); 00531 00532 CurrentSortDlg->AddSortKeyName(_R(IDS_SORTBY_NAME)); 00533 CurrentSortDlg->AddSortKeyName(_R(IDS_SORTBY_MEMORY)); 00534 CurrentSortDlg->AddSortKeyName(_R(IDS_SORTBY_NAMELENGTH)); 00535 CurrentSortDlg->AddSortKeyName(_R(IDS_SORTBY_FILETYPE)); 00536 } 00537 00538 break; 00539 00540 00541 case SGACTION_DISPLAYMODECHANGED: 00542 if(DisplayMode >= 3) DisplayMode = 0; 00543 LibClipartSGallery::DefaultDisplayMode = DisplayMode; 00544 InvalidateCachedFormat(); 00545 ReformatAndRedrawIfNecessary(); 00546 //ForceRedrawOfList(); 00547 break; 00548 00549 default: 00550 return(SuperGallery::ApplyAction(Action)); 00551 break; 00552 } 00553 00554 return(TRUE); 00555 }
|
|
|
Pops up the browse box and lets a new location be set for the clipart directory.
Reimplemented from LibraryGallery. Definition at line 761 of file sglcart.cpp. 00762 { 00763 if (GetClipTheme() == 0) 00764 { 00765 return (LibraryGallery::BrowseClicked(&DefaultLibraryPath, SGLib_ClipArt, _R(IDS_REMOVE_OLD_GOUPS_CLIPART))); 00766 } 00767 else 00768 { 00769 return (LibraryGallery::BrowseClicked(&DefaultLibraryPath, SGLib_ClipArt_WebThemes, _R(IDS_REMOVE_OLD_GOUPS_CLIPART))); 00770 } 00771 }
|
|
||||||||||||
|
To build a menu of commands to be popped up over the gallery.
Reimplemented from SuperGallery. Definition at line 2234 of file sglcart.cpp. 02235 { 02236 BOOL ok = TRUE; 02237 02238 if (MenuID == SGMENU_OPTIONS) 02239 { 02240 // Options menu 02241 ok = ok && AddCommand(TheMenu, (StringBase *) &SGCmd_Add); 02242 ok = ok && AddCommand(TheMenu, (StringBase *) &SGCmd_EmptyClipartCache, TRUE); 02243 02244 ok = ok && AddCommand(TheMenu, (StringBase *) &SGCmd_Find); 02245 ok = ok && AddCommand(TheMenu, (StringBase *) &SGCmd_Sort); 02246 ok = ok && AddCommand(TheMenu, (StringBase *) &SGCmd_Properties); 02247 } 02248 else 02249 { 02250 // Over-list menu 02251 ok = ok && AddCommand(TheMenu, (StringBase *) &SGCmd_Open); 02252 ok = ok && AddCommand(TheMenu, (StringBase *) &SGCmd_Import); 02253 ok = ok && AddCommand(TheMenu, (StringBase *) &SGCmd_Remove, TRUE); // With separator 02254 02255 SGDisplayGroup *TheGroup = FindCommandGroup(); // Fold or unfold as appropriate 02256 if (TheGroup == NULL || !TheGroup->Flags.Folded) 02257 ok = ok && AddCommand(TheMenu, (StringBase *) &SGCmd_FoldGroup); 02258 else 02259 ok = ok && AddCommand(TheMenu, (StringBase *) &SGCmd_UnfoldGroup); 02260 02261 ok = ok && AddCommand(TheMenu, (StringBase *) &SGCmd_PrevGroup); 02262 ok = ok && AddCommand(TheMenu, (StringBase *) &SGCmd_NextGroup); 02263 } 02264 02265 return(ok); 02266 }
|
|
|
To determine if this gallery can generate indexes or not.
Reimplemented from LibraryGallery. Definition at line 787 of file sglcart.cpp. 00788 { 00789 return TRUE; 00790 }
|
|
|
Used to determine if this type of gallery supports keyword searching. This one does.
Reimplemented from LibraryGallery. Definition at line 2001 of file sglcart.cpp. 02002 { 02003 return(TRUE); 02004 }
|
|
|
To see whether we should add this line of the index.txt file to this gallery.
Reimplemented from LibraryGallery. Definition at line 889 of file sglcart.cpp. 00890 { 00891 BOOL Match = FALSE; 00892 00893 // Artwork, and Bitmaps... 00894 if(((Txt->Sub(String_8("A"))!=-1) || (Txt->Sub(String_8("a"))!=-1)) ) Match = TRUE; 00895 if(((Txt->Sub(String_8("B"))!=-1) || (Txt->Sub(String_8("b"))!=-1)) ) Match = TRUE; 00896 00897 return Match; 00898 }
|
|
||||||||||||||||
|
"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 LibraryGallery. Definition at line 2132 of file sglcart.cpp. 02134 { 02135 TRACEUSER( "Matt", _T("Copy display item called in clipart gallery\n")); 02136 if(SourceItem == NULL || DestGroup == NULL) 02137 { 02138 ERROR3("LibClipartSGallery::CopyDisplayItem -> Illegal NULL param"); 02139 return NULL; 02140 } 02141 02142 // Check if we've dragged from one group to another and warn if that's the case 02143 if(DestGroup->IsKindOf(CC_RUNTIME_CLASS(SGLibGroup))) 02144 { 02145 SGDisplayNode *SourceGroup = SourceItem->GetParent(); 02146 if((SGDisplayGroup *)SourceGroup != DestGroup) 02147 { 02148 // "Can't move clipart between groups." 02149 InformError(_R(IDS_CLIPART_BETWEEN_GROUPS), _R(IDS_OK)); 02150 Error::ClearError(); 02151 } 02152 } 02153 02154 return(NULL); 02155 }
|
|
|
To apply a given command when it is chosen from the menu.
The base class handles all of these (maybe more - see the base class help) Properties, Sort, Find; New, Edit, Delete, Redefine; (it calls ApplyAction as appropriate) NextGroup, PrevGroup, FoldGroup, UnfoldGroup; Reimplemented from SuperGallery. Definition at line 2364 of file sglcart.cpp. 02365 { 02366 if (*CommandID == SGCmd_Open) // --- Open 02367 ImportClipart(TRUE, this); 02368 else if (*CommandID == SGCmd_Import) // --- Import 02369 ImportClipart(FALSE, this); 02370 else if (*CommandID == SGCmd_Add) // --- Add clipart 02371 BrowseClicked(); 02372 else if (*CommandID == SGCmd_EmptyClipartCache) // --- Remove web folders 02373 { 02374 RemoveWebFolders(SGLib_ClipArt); //This will actually remove both clipart and web themes! 02375 } 02376 else if (*CommandID == SGCmd_Remove) // --- Remove 02377 { 02378 RemoveSelectedLibraries(TRUE); 02379 UpdateGRMFile(); 02380 } 02381 else 02382 SuperGallery::DoCommand(CommandID); // Unknown command- pass to the base class 02383 }
|
|
|
To un-grey the options... button when there are no docs Notes:.
Reimplemented from LibraryGallery. Definition at line 1968 of file sglcart.cpp. 01969 { 01970 if (DisplayTree == NULL) 01971 return; 01972 01973 // Keep this here always 01974 EnableGadget(_R(IDC_GALLERY_MENU), TRUE); 01975 01976 if(ShadeIt) 01977 { 01978 EnableGadget(_R(IDC_LIBGAL_IMPORT), FALSE); 01979 } 01980 01981 EnableGadget(_R(IDC_LIBGAL_ADD_CLIPART), TRUE); 01982 01983 // Standard library buttons 01984 LibraryGallery::DoShadeGallery(ShadeIt); 01985 }
|
|
|
Definition at line 2395 of file sglcart.cpp. 02396 { 02397 return m_nClipTheme; 02398 }
|
|
||||||||||||
|
To determine the state of a given menu item. This method is an exact parallel to an Op's GetState method (in fact, it is called by an Op's GetState).
The base class handles all of these (maybe more - see the base class help) Properties, Sort, Find; New, Edit, Delete, Redefine; NextGroup, PrevGroup, FoldGroup, UnfoldGroup; Reimplemented from SuperGallery. Definition at line 2296 of file sglcart.cpp. 02297 { 02298 OpState State; 02299 02300 if (*CommandID == SGCmd_Add) // --- Add (always available) 02301 return(State); 02302 02303 if (*CommandID == SGCmd_EmptyClipartCache) 02304 { 02305 if (m_bDiscardWebFolders) 02306 State.Greyed = TRUE; 02307 return (State); 02308 } 02309 02310 if (*CommandID == SGCmd_Open || *CommandID == SGCmd_Import) // --- Open/Import 02311 { 02312 if (GetSelectedItemCount() < 1) 02313 { 02314 State.Greyed = TRUE; 02315 ShadeReason->MakeMsg(_R(IDS_SGSHADE_NOSEL)); 02316 } 02317 } 02318 else if (*CommandID == SGCmd_Remove) // --- Remove 02319 { 02320 if (GetSelectedGroupCount() < 1) 02321 { 02322 State.Greyed = TRUE; 02323 ShadeReason->MakeMsg(_R(IDS_SGSHADE_NOSELGROUP)); 02324 } 02325 } 02326 else if (*CommandID == SGCmd_Properties) // --- Properties - disabled if the gallery is currently downloading thumnails 02327 { 02328 if (!m_lstPendingThumbs.empty()) 02329 { 02330 State.Greyed = TRUE; 02331 ShadeReason->MakeMsg(_R(IDS_SGSHADE_DOWNLOADING)); 02332 } 02333 } 02334 else 02335 return(SuperGallery::GetCommandState(CommandID, ShadeReason)); // Unknown command- pass to baseclass 02336 02337 return(State); 02338 }
|
|
|
Reimplemented from LibraryGallery. Definition at line 219 of file sglcart.h. 00219 {return &DefaultLibraryPath;}
|
|
||||||||||||||||
|
To determine various library gallery default properties.
Reimplemented from LibraryGallery. Definition at line 810 of file sglcart.cpp. 00811 { 00812 TRACEUSER( "Matt", _T("Getting defaults for clipart gallery\n")); 00813 if(DefaultIndex != NULL) 00814 { 00815 //Set the correct info filename for the current gallery style 00816 if (GetClipTheme() == 0) 00817 { 00818 *DefaultIndex = _R(IDS_LIBRARIES_CLIPART_FILENAME); // "XaraClip.txt"; 00819 } 00820 else 00821 { 00822 *DefaultIndex = _R(IDS_LIBRARIES_WEBTHEMES_FILENAME); // "XaraThem.txt"; 00823 } 00824 } 00825 00826 if(IndexDesc != NULL) 00827 *IndexDesc = _R(IDS_LIBRARIES_CLIPART_DESC); // "Clipart"; 00828 00829 if(Type != NULL) 00830 { 00831 //Set the type of the gallery to be 'Clipart' or 'Web Themes' 00832 //so that the base classes attempt to load file info from the 00833 //correct URL - real handy... 00834 if (GetClipTheme() == 0) 00835 { 00836 *Type = SGLib_ClipArt; 00837 } 00838 else 00839 { 00840 *Type = SGLib_ClipArt_WebThemes; 00841 } 00842 } 00843 00844 return TRUE; 00845 }
|
|
|
Reimplemented from LibraryGallery. Definition at line 207 of file sglcart.h. 00208 { 00209 if (GetClipTheme() == 0) 00210 { 00211 return SGLib_ClipArt; 00212 } 00213 else 00214 { 00215 return SGLib_ClipArt_WebThemes; 00216 } 00217 }
|
|
|
Get the default CD directory name for the gallery.
Reimplemented from LibraryGallery. Definition at line 861 of file sglcart.cpp. 00862 { 00863 TRACEUSER( "Matt", _T("Getting library directory name for clipart gallery\n")); 00864 if (GetClipTheme() == 0) 00865 { 00866 LibDirName->MakeMsg(_R(IDS_LIBRARIES_CLIPART_DIRNAME)); 00867 } 00868 else 00869 { 00870 LibDirName->MakeMsg(_R(IDS_LIBRARIES_WEBTHEMES_DIRNAME)); 00871 } 00872 return TRUE; 00873 }
|
|
|
Get the Quiet status of the gallery.
Reimplemented from LibraryGallery. Definition at line 912 of file sglcart.cpp. 00913 { 00914 return LibClipartSGallery::QuietStatus; 00915 }
|
|
|
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 LibraryGallery. Definition at line 1030 of file sglcart.cpp. 01031 { 01032 // If it's a bitmap drag, add a target for our window. If not, let the base class 01033 // have a look at it (to see if it is a gallery item being dragged) 01034 if (DragMsg->pInfo->IsKindOf(CC_RUNTIME_CLASS(GalleryClipartDragInfo))) 01035 SGClipartDragTarget *NewTarget = new SGClipartDragTarget(this, GetListGadgetID()); 01036 else 01037 SuperGallery::HandleDragStart(DragMsg); 01038 }
|
|
||||||||||||
|
To load/import all the selected clipart items one by one into camelot. Notes:.
Definition at line 1068 of file sglcart.cpp. 01069 { 01070 TRACEUSER( "Matt", _T("Importing clipart in clipart gallery\n")); 01071 if (pSourceGallery->DisplayTree == NULL) 01072 { 01073 ERROR3("LibClipartSGallery::ImportClipart No display tree - bad !"); 01074 return FALSE; 01075 } 01076 01077 if(Document::GetSelected() == NULL && !NewDocument) 01078 { 01079 return FALSE; 01080 } 01081 01082 BOOL ok = TRUE; 01083 01084 01085 // Find the first selected item (if any) and get the next item to start searching from 01086 // If there is no selection, then get the first item 01087 SGDisplayNode *Item = pSourceGallery->DisplayTree->FindNextSelectedItem(NULL); 01088 String_256 ItemText; 01089 01090 while (Item != NULL) 01091 { 01092 if(Item->IsKindOf(CC_RUNTIME_CLASS(SGClipartItem)) || Item->IsKindOf(CC_RUNTIME_CLASS(SGFillsItem))) 01093 { 01094 Item->GetNameText(&ItemText); 01095 01096 if(Item->Flags.Selected) 01097 { 01098 PathName FileName; 01099 SGLibDisplayItem *ClipItem = (SGLibDisplayItem *) Item; 01100 01101 //if (Lib != NULL) 01102 ok = ClipItem->GetFileName(&FileName); 01103 01104 if(ok) 01105 { 01106 // Bodge for clipart CD - 'Cow' in LScape should point to "Moo.tif", not just "Moo" 01107 if(FileName.GetFileName(FALSE) == (String_256)"Moo") 01108 { 01109 INT32 Size = ClipItem->GetFileSize(NULL); 01110 if(Size == 1080904) 01111 FileName.SetType("TIF"); 01112 } 01113 01114 if(!FileName.IsValid(FileName.GetPath())) 01115 { 01116 ERROR3("LibClipartSGallery::ImportClipart - Filename is invalid"); 01117 return FALSE; 01118 } 01119 01120 // Check if file has a long filename, and use that if it does... 01121 String_256 FilePath((const TCHAR *)FileName.GetPath()); 01122 String_256 LongFileName; 01123 BOOL LongPath = FileUtil::GetLongFileName((LPTSTR)FilePath, (LPTSTR)LongFileName, 255); 01124 if(LongPath) 01125 { 01126 FilePath = FileName.GetLocation(TRUE); 01127 FilePath += LongFileName; 01128 } 01129 01130 // Check if the file really exists on the local drive 01131 Library* pLibrary = ClipItem->GetParentLibrary(); 01132 if (!pLibrary) 01133 { 01134 ERROR3("Illegal NULL pointer"); 01135 return FALSE; 01136 } 01137 BOOL bIsLocalFile; 01138 if (!pLibrary->IsWebLibrary()) 01139 bIsLocalFile = TRUE; 01140 else 01141 bIsLocalFile = (_access((TCHAR*) FilePath, 0) != -1); 01142 01143 if(NewDocument) 01144 { 01145 if (bIsLocalFile) 01146 { 01147 CWinApp* pApp = AfxGetApp(); 01148 BaseFileDialog::SelectedFilter = 0; 01149 01150 // Open a document 01151 CCamDoc* pDoc = (CCamDoc*) pApp->OpenDocumentFile((TCHAR *)FilePath); 01152 01153 // And redraw the imported document 01154 if(pDoc) pDoc->GetKernelDoc()->ForceRedraw(); 01155 } 01156 else // do an asynch import 01157 { 01158 goto ASYNCH_IMPORT; 01159 } 01160 } 01161 else 01162 { 01163 // Invoke the clipart import operation so that we get Undo. 01164 if (bIsLocalFile) // if the file is local we do a normal import Op 01165 { 01166 01167 OpDescriptor* pOpDesc = OpDescriptor::FindOpDescriptor(CC_RUNTIME_CLASS(OpClipartImport)); 01168 01169 if (pOpDesc != NULL) 01170 { 01171 ClipartImportParam Param; 01172 01173 PathName FullPathName(FilePath); 01174 01175 // Set up the parameters which we require to do the import operation 01176 Param.File = &FullPathName; 01177 Param.Import = !NewDocument; 01178 Param.Result = TRUE; 01179 01180 // Import the specified file 01181 pOpDesc->Invoke((OpParam *) &Param); 01182 01183 ok = Param.Result; 01184 if(!ok) 01185 { 01186 ERROR3("LibClipartSGallery::ImportClipart - Problem importing file"); 01187 return FALSE; 01188 } 01189 } 01190 } 01191 else // try an asynch import 01192 { 01193 ASYNCH_IMPORT: 01194 String_256 strFileURL = FilePath; 01195 pLibrary->LocalPath2URL(&strFileURL); 01196 OpDescriptor* pOpDesc = OpDescriptor::FindOpDescriptor(CC_RUNTIME_CLASS(OpAsynchClipartImport)); 01197 01198 if (pOpDesc != NULL) 01199 { 01200 AsynchClipartImportParam* Param = new AsynchClipartImportParam; 01201 ERROR2IF(!Param, FALSE, "Memory allocation error"); 01202 // Set up the parameters which we require to import the clipart 01203 Param->File.SetPathName((TCHAR *)FilePath); 01204 String_256 strDescription; 01205 ClipItem->GetNameText(&strDescription); 01206 Param->strDescription = _T("'"); 01207 Param->strDescription += strDescription; 01208 Param->strDescription += _T("'"); 01209 |