#include <sglfills.h>
Inheritance diagram for LibFillsSGallery:
Public Member Functions | |
LibFillsSGallery () | |
LibFillsSGallery default constructor. | |
~LibFillsSGallery () | |
LibFillsSGallery destructor. | |
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. | |
virtual BOOL | CanSearchKeywords (void) |
Used to determine if this type of gallery supports keyword searching. This one does. | |
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 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:. | |
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. | |
Static Public Member Functions | |
static BOOL | Init (void) |
Static Public Attributes | |
static String_256 | DefaultLibraryPath = TEXT("D:\\fills") |
static INT32 | DefaultDisplayMode = 0 |
static UINT32 | DefaultSortKeys = 1 |
static LibFillsSGallery * | 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 | PreCreate (void) |
The LibFillsSGallery 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 SGDisplayGroup * | AddLibraryGroup (Library *LibraryToDisplay, INT32 NumItems) |
Create a library group, as opposed to a display group 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. | |
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. | |
bool | FillUsingFillGallerySelection (FillTypeEnum FillType) |
To import a fill into camelot, then apply it in the mannor selected. | |
BOOL | BrowseClicked (void) |
Pops up the browse box and lets a new location be set for the data. | |
void | SortGallery (void) |
Sorts the contents of the gallery in an alphabetical fashion, whilst keeping the old sort key status... Notes:. | |
SGDisplayItem * | CopyDisplayItem (SGDisplayItem *SourceItem, SGDisplayGroup *DestGroup, SGDisplayItem *TargetPosition) |
"Copies" the existing node in the tree in an appropriate fashion. | |
KernelBitmap * | GetSelectedBitmap (void) |
Definition at line 134 of file sglfills.h.
|
LibFillsSGallery default constructor.
Definition at line 203 of file sglfills.cpp. 00204 { 00205 LibFillsSGallery::ThisGallery = this; 00206 00207 // Default gallery size 00208 CSize Size(((333 * 2) - 32) - 32, 256); 00209 SetGallerySize(Size); 00210 }
|
|
LibFillsSGallery destructor.
Definition at line 224 of file sglfills.cpp. 00225 { 00226 OpenLibFiles.DeleteAll(); // Ensure all open libraries are closed 00227 LibFillsSGallery::ThisGallery = NULL; 00228 }
|
|
Create a library group, as opposed to a display group Notes:.
Reimplemented from LibraryGallery. Definition at line 1465 of file sglfills.cpp. 01466 { 01467 ERROR3IF(LibraryToDisplay == NULL, "LibFillsSGallery::AddLibraryGroup - NULL parameter is illegal"); 01468 01469 if (DisplayTree == NULL) 01470 { 01471 ERROR3("LibFillsSGallery::AddLibraryGroup called before the DisplayTree was initialised!"); 01472 return(NULL); 01473 } 01474 01475 SGLibGroup *TheGroup = (SGLibGroup *)DisplayTree->FindSubtree(this, NULL, LibraryToDisplay); 01476 01477 if (TheGroup == NULL) 01478 { 01479 // No existing group for that library, so create a new one 01480 TheGroup = new SGLibGroup(this, NULL, LibraryToDisplay); 01481 01482 if (TheGroup == NULL) // Failed! 01483 return(NULL); 01484 01485 // And add it to our display tree 01486 DisplayTree->AddItem(TheGroup); 01487 } 01488 else 01489 TheGroup->DestroySubtree(FALSE); // Delete all items in the group 01490 01491 return(TheGroup); 01492 }
|
|
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 1102 of file sglfills.cpp. 01105 { 01106 ERROR3IF(LibraryGroup == NULL || ParentLib == NULL, 01107 "LibFillsSGallery::AddLibraryItem - NULL params are illegal"); 01108 01109 ERROR3IF(LibraryGroup->GetParentLibrary() != ParentLib, 01110 "LibFillsSGallery::AddLibraryitem - The DisplayGroup is not for the same library!"); 01111 01112 // Create a Fills library item 01113 SGFillsItem *NewItem = new SGFillsItem(ItemIndex, bNew); 01114 01115 // Alphabetic add... 01116 /* SGSortKey SortKeys[MaxSGSortKeys]; 01117 for (INT32 i = 0; i < MaxSGSortKeys; i++) 01118 { 01119 SortKeys[i].SortKey = 0; 01120 SortKeys[i].Reversed = FALSE; 01121 } 01122 01123 SortKeys[0].SortKey = 1;*/ 01124 01125 if (NewItem != NULL) 01126 LibraryGroup->AddItem(NewItem/*, (SGSortKey *)SortKeys*/); 01127 01128 return(NewItem); 01129 }
|
|
Applies certain conventional gallery actions (usually associated with gallery buttons, for new, edit, delete, etc).
Reimplemented from LibraryGallery. Definition at line 570 of file sglfills.cpp. 00571 { 00572 // No display tree? Better forget about it then! 00573 if (DisplayTree == NULL) 00574 return(FALSE); 00575 00576 // Now, process the action TO DO! - see Colour gallery for examples 00577 switch(Action) 00578 { 00579 case SGACTION_APPLYADJUST: 00580 // Drop through to SGACTION_APPLY handler 00581 00582 case SGACTION_APPLY: 00583 // Import the current selection and apply it as a fill 00584 if(Document::GetSelected() == NULL) 00585 return FALSE; 00586 00587 if(!FillUsingFillGallerySelection(ApplyToObject)) 00588 return FALSE; 00589 00590 break; 00591 00592 case SGACTION_SETOPTIONS: // Set values in the options dialogue as it is opened 00593 { 00594 if (CurrentOptionsDlg == NULL) 00595 return(FALSE); 00596 00597 CurrentOptionsDlg->AddDisplayModeName(_R(IDS_GALLERYDM_LARGE)); // 0 00598 CurrentOptionsDlg->AddDisplayModeName(_R(IDS_GALLERYDM_FULLINFO)); // 1 00599 CurrentOptionsDlg->AddDisplayModeName(_R(IDS_GALLERYDM_SMALL)); // 2 00600 } 00601 break; 00602 00603 case SGACTION_SETSORTMODE: 00604 { 00605 if (CurrentSortDlg == NULL) 00606 return(FALSE); 00607 00608 CurrentSortDlg->AddSortKeyName(_R(IDS_SORTBY_NAME)); 00609 CurrentSortDlg->AddSortKeyName(_R(IDS_SORTBY_MEMORY)); 00610 CurrentSortDlg->AddSortKeyName(_R(IDS_SORTBY_NAMELENGTH)); 00611 CurrentSortDlg->AddSortKeyName(_R(IDS_SORTBY_FILETYPE)); 00612 } 00613 break; 00614 00615 00616 case SGACTION_DISPLAYMODECHANGED: 00617 if(DisplayMode >= 3) DisplayMode = 0; 00618 DefaultDisplayMode = DisplayMode; 00619 InvalidateCachedFormat(); 00620 ReformatAndRedrawIfNecessary(); 00621 break; 00622 00623 default: 00624 return(SuperGallery::ApplyAction(Action)); 00625 break; 00626 } 00627 00628 return(TRUE); 00629 }
|
|
Pops up the browse box and lets a new location be set for the data.
Reimplemented from LibraryGallery. Definition at line 353 of file sglfills.cpp. 00354 { 00355 return (LibraryGallery::BrowseClicked(&DefaultLibraryPath, SGLib_Texture, _R(IDS_REMOVE_OLD_GOUPS_FILLS))); 00356 }
|
|
To build a menu of commands to be popped up over the gallery.
Reimplemented from SuperGallery. Definition at line 1277 of file sglfills.cpp. 01278 { 01279 BOOL ok = TRUE; 01280 01281 if (MenuID == SGMENU_OPTIONS) 01282 { 01283 // Options menu 01284 ok = ok && AddCommand(TheMenu, (StringBase *) &SGCmd_Add); // With separator 01285 ok = ok && AddCommand(TheMenu, (StringBase *) &SGCmd_EmptyFillsCache, TRUE); // With separator 01286 01287 01288 ok = ok && AddCommand(TheMenu, (StringBase *) &SGCmd_Find); 01289 ok = ok && AddCommand(TheMenu, (StringBase *) &SGCmd_Sort); 01290 ok = ok && AddCommand(TheMenu, (StringBase *) &SGCmd_Properties); 01291 } 01292 else 01293 { 01294 // Over-list menu 01295 ok = ok && AddCommand(TheMenu, (StringBase *) &SGCmd_Import); 01296 ok = ok && AddCommand(TheMenu, (StringBase *) &SGCmd_Fill); 01297 ok = ok && AddCommand(TheMenu, (StringBase *) &SGCmd_Transp,TRUE); 01298 01299 ok = ok && AddCommand(TheMenu, (StringBase *) &SGCmd_Remove, TRUE); // With separator 01300 01301 ok = ok && AddCommand(TheMenu, (StringBase *) &SGCmd_SetBackground,TRUE); 01302 01303 SGDisplayGroup *TheGroup = FindCommandGroup(); // Fold or unfold as appropriate 01304 if (TheGroup == NULL || !TheGroup->Flags.Folded) 01305 ok = ok && AddCommand(TheMenu, (StringBase *) &SGCmd_FoldGroup); 01306 else 01307 ok = ok && AddCommand(TheMenu, (StringBase *) &SGCmd_UnfoldGroup); 01308 01309 ok = ok && AddCommand(TheMenu, (StringBase *) &SGCmd_PrevGroup); 01310 ok = ok && AddCommand(TheMenu, (StringBase *) &SGCmd_NextGroup); 01311 } 01312 01313 return(ok); 01314 }
|
|
To determine if this gallery can generate indexes or not.
Reimplemented from LibraryGallery. Definition at line 371 of file sglfills.cpp. 00372 { 00373 return TRUE; 00374 }
|
|
Used to determine if this type of gallery supports keyword searching. This one does.
Reimplemented from LibraryGallery. Definition at line 1146 of file sglfills.cpp. 01147 { 01148 return(TRUE); 01149 }
|
|
To see whether we should add this line of the index.txt file to this gallery.
Reimplemented from LibraryGallery. Definition at line 540 of file sglfills.cpp. 00541 { 00542 BOOL Match = FALSE; 00543 00544 // Textures (fills) 00545 if(((Txt->Sub(String_8("T"))!=-1) || (Txt->Sub(String_8("t"))!=-1)) ) Match = TRUE; 00546 00547 return Match; 00548 }
|
|
"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 1533 of file sglfills.cpp. 01535 { 01536 if(SourceItem == NULL || DestGroup == NULL) 01537 { 01538 ERROR3("LibFillsSGallery::CopyDisplayItem -> Illegal NULL param"); 01539 return NULL; 01540 } 01541 01542 // Check if we've dragged from one group to another and warn if that's the case 01543 if(DestGroup->IsKindOf(CC_RUNTIME_CLASS(SGLibGroup))) 01544 { 01545 SGDisplayNode *SourceGroup = SourceItem->GetParent(); 01546 if((SGDisplayGroup *)SourceGroup != DestGroup) 01547 { 01548 // "Can't move library fills between groups." 01549 InformError(_R(IDS_FILLS_BETWEEN_GROUPS), _R(IDS_OK)); 01550 Error::ClearError(); 01551 } 01552 } 01553 01554 return(NULL); 01555 }
|
|
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 1408 of file sglfills.cpp. 01409 { 01410 if (*CommandID == SGCmd_Import) // --- Import 01411 { 01412 if (Document::GetSelected() != NULL) 01413 FillUsingFillGallerySelection(AddToPage); 01414 } 01415 else if (*CommandID == SGCmd_Fill) // --- Fill 01416 { 01417 if (Document::GetSelected() != NULL) 01418 FillUsingFillGallerySelection(ApplyToObject); 01419 } 01420 else if (*CommandID == SGCmd_EmptyFillsCache) 01421 { 01422 RemoveWebFolders(SGLib_Fractal); 01423 } 01424 else if (*CommandID == SGCmd_Transp) // --- Transp 01425 { 01426 if (Document::GetSelected() != NULL) 01427 FillUsingFillGallerySelection(ApplyToObjectAsTransp); 01428 } 01429 else if (*CommandID == SGCmd_Add) // --- Add fills 01430 BrowseClicked(); 01431 else if (*CommandID == SGCmd_Remove) // --- Remove 01432 { 01433 RemoveSelectedLibraries(TRUE); 01434 UpdateGRMFile(); 01435 } 01436 else if (*CommandID == SGCmd_SetBackground) // --- Set background 01437 { 01438 if (Document::GetSelected() != NULL) 01439 FillUsingFillGallerySelection(SetBackground); 01440 } 01441 else 01442 SuperGallery::DoCommand(CommandID); // Unknown command- pass to the base class 01443 }
|
|
To un-grey the options... button when there are no docs Notes:.
Reimplemented from LibraryGallery. Definition at line 890 of file sglfills.cpp. 00891 { 00892 if (DisplayTree == NULL) 00893 return; 00894 00895 // Keep this here always 00896 EnableGadget(_R(IDC_GALLERY_MENU), TRUE); 00897 00898 EnableGadget(_R(IDC_LIBGAL_IMPORT), !ShadeIt); 00899 EnableGadget(_R(IDC_BMPGAL_FILL), !ShadeIt); 00900 EnableGadget(_R(IDC_BMPGAL_TEXTURE), !ShadeIt); 00901 00902 EnableGadget(_R(IDC_BMPGAL_BACKGROUND), !ShadeIt); 00903 00904 EnableGadget(_R(IDC_LIBGAL_ADD_FILLS), TRUE); 00905 00906 LibraryGallery::DoShadeGallery(ShadeIt); 00907 }
|
|
To import a fill into camelot, then apply it in the mannor selected.
Definition at line 922 of file sglfills.cpp. 00923 { 00924 PathName FileName; 00925 00926 UINT32 TagObjectToFill = 0; // used for ApplyToObject and ApplyToObjectAsTransp 00927 // when downloading a fill 00928 00929 if (GetSelectedItemCount() != 1 && FillType != AddToPage) 00930 { 00931 TRACEUSER( "Jonathan", _T("Fills: FillUsingGallerySelection failing due to multiple selection\n")); 00932 return false; 00933 } 00934 00935 SGLibDisplayItem *FillItem = static_cast<SGLibDisplayItem *>(DisplayTree->FindNextSelectedItem()); 00936 00937 if (!FillItem->GetFileName(&FileName)) 00938 return false; 00939 00940 if (!FileName.IsValid(FileName.GetPath())) 00941 { 00942 ERROR3("Filename is invalid"); 00943 return false; 00944 } 00945 00946 bool NeedToDownload; 00947 if (_taccess(FileName.GetPath(), 0) == -1) 00948 NeedToDownload = true; 00949 else 00950 NeedToDownload = false; 00951 00952 if (FillType == ApplyToObject || FillType == ApplyToObjectAsTransp) 00953 { 00954 SelRange* Sel = GetApplication()->FindSelection(); 00955 if (Sel==0) 00956 { 00957 ERROR3("Can't find SelRange!"); 00958 return false; 00959 } 00960 if (NeedToDownload) 00961 { 00962 Node *NodeToFill = Sel->FindFirst(); 00963 if (Sel->FindNext(NodeToFill) != 0) 00964 { 00965 // If mulitple objects are selected, saving the tag of just one object is not 00966 // going to do much good so for now we just give up in this case 00967 InformError(_R(IDE_SGLFILLS_NOMULTI_DL_FILL)); 00968 return false; 00969 } 00970 if (NodeToFill) 00971 TagObjectToFill = NodeToFill->GetTag(); 00972 else 00973 { 00974 // No node selected. This means the user has pressed fill from the gallery 00975 // with no selection, intending to set the default fill of the document. To 00976 // do this we set TagObjectToFill to zero which results in TagObjectValid not 00977 // being set. We do not have to use this logic in the case where the fill is 00978 // already downloaded as the ApplyFill(...) stuff just uses the current selection 00979 // (or the lack of current selection). 00980 TagObjectToFill = 0; 00981 } 00982 } 00983 } 00984 // Calculate where to put an imported object 00985 DocCoord DropPos; 00986 DocRect PageRect; 00987 Spread *s; 00988 if ((s = Document::GetSelectedSpread()) != 0) 00989 { 00990 if (s->GetPagesRect(&PageRect)) 00991 DropPos = PageRect.Centre(); 00992 else 00993 return false; 00994 } 00995 else 00996 return false; 00997 00998 if (!NeedToDownload) 00999 // Don't need to download the fill 01000 { 01001 TRACEUSER( "Jonathan", _T("Fills: File in cache\n")); 01002 OpDescriptor* pOpDesc = OpDescriptor::FindOpDescriptor(CC_RUNTIME_CLASS(OpBitmapImport)); 01003 01004 if (pOpDesc != 0) 01005 { 01006 BitmapImportParam Param; 01007 01008 Param.File = &FileName; 01009 Param.Result = TRUE; 01010 Param.pTargetDoc = Document::GetSelected(); 01011 Param.FillType = FillType; 01012 Param.pSpread = Document::GetSelectedSpread(); 01013 Param.DropPos = DropPos; 01014 Param.TagObjectValid = false; 01015 Param.pObjectValid = false; 01016 01017 // Do it... 01018 pOpDesc->Invoke((OpParam *) &Param); 01019 01020 if (!Param.Result) 01021 { 01022 ERROR3("Problem importing file from cache"); 01023 return false; 01024 } 01025 } 01026 } 01027 else 01028 // Need to download the fill 01029 { 01030 TRACEUSER( "Jonathan", _T("Fills: File not in cache : downloading\n")); 01031 OpDescriptor* pOpDesc = OpDescriptor::FindOpDescriptor(CC_RUNTIME_CLASS(OpAsynchBitmapImport)); 01032 01033 if (pOpDesc != 0) 01034 { 01035 AsynchBitmapImportParam* Param = new AsynchBitmapImportParam; 01036 01037 if (!Param) 01038 return false; 01039 Library* pLibrary = FillItem->GetParentLibrary(); 01040 String_256 strFileURL = FileName.GetPath(); 01041 pLibrary->LocalPath2URL(&strFileURL); 01042 Param->file = FileName; 01043 Param->pTargetDoc = Document::GetSelected(); 01044 Param->strURL = strFileURL; 01045 String_256 strDescription; 01046 FillItem->GetNameText(&strDescription); 01047 Param->strDescription = _T("'"); 01048 Param->strDescription += strDescription; 01049 Param->strDescription += _T("'"); 01050 Param->type = TYPE_FILL; 01051 Param->FillType = FillType; 01052 Param->priority = AsynchDownload::PRIORITY_HIGH; 01053 Param->pSpread = Document::GetSelectedSpread(); 01054 Param->DropPos = DropPos; 01055 Param->TagObjectToFill = TagObjectToFill; 01056 Param->pObjectValid = false; 01057 // If TagObjectToFill == 0, don't set pObjectValid or TagObjectValid so 01058 // ApplyFill(...) just applies the fill to nothing (except if the user has 01059 // changed the selection during the download, in which case that object will 01060 // get filled - bit bad, but that is a very rare case). 01061 if (TagObjectToFill) 01062 Param->TagObjectValid = true; 01063 else 01064 Param->TagObjectValid = false; 01065 01066 // Do it... 01067 pOpDesc->Invoke((OpParam *) Param); 01068 } 01069 } 01070 return true; 01071 }
|
|
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 1344 of file sglfills.cpp. 01345 { 01346 TRACEUSER( "Jonathan", _T("Fills::GetCommandState called for ")); 01347 TRACEUSER("Jonathan", *CommandID); 01348 TRACEUSER( "Jonathan", _T("\n")); 01349 OpState State; 01350 01351 if (*CommandID == SGCmd_Add) // --- Add (always available) 01352 { 01353 return(State); 01354 } 01355 else if (*CommandID == SGCmd_EmptyFillsCache) 01356 { 01357 if (m_bDiscardWebFolders) 01358 State.Greyed = TRUE; 01359 return (State); 01360 } 01361 else if (*CommandID == SGCmd_Fill || *CommandID == SGCmd_Transp || // --- Fill/Transp/Set Background/Import 01362 *CommandID == SGCmd_SetBackground || *CommandID == SGCmd_Import) 01363 { 01364 if (GetSelectedItemCount() != 1) 01365 { 01366 State.Greyed = TRUE; 01367 ShadeReason->MakeMsg(_R(IDS_SGSHADE_SINGLE)); 01368 } 01369 } 01370 else if (*CommandID == SGCmd_Remove) // --- Remove 01371 { 01372 if (GetSelectedGroupCount() < 1) 01373 { 01374 State.Greyed = TRUE; 01375 ShadeReason->MakeMsg(_R(IDS_SGSHADE_NOSELGROUP)); 01376 } 01377 } 01378 else 01379 return(SuperGallery::GetCommandState(CommandID, ShadeReason)); // Unknown command- pass to baseclass 01380 01381 return(State); 01382 }
|
|
Reimplemented from LibraryGallery. Definition at line 186 of file sglfills.h. 00186 {return &DefaultLibraryPath;}
|
|
To determine various library gallery default properties.
Reimplemented from LibraryGallery. Definition at line 393 of file sglfills.cpp. 00394 { 00395 if(DefaultIndex != NULL) 00396 *DefaultIndex = _R(IDS_LIBRARIES_FILLS_FILENAME); // "XaraText.txt"; 00397 00398 if(IndexDesc != NULL) 00399 *IndexDesc = _R(IDS_LIBRARIES_FILLS_DESC); // "Fills"; 00400 00401 if(Type != NULL) 00402 *Type = SGLib_Texture; 00403 00404 return TRUE; 00405 }
|
|
Reimplemented from LibraryGallery. Definition at line 184 of file sglfills.h.
|
|
Get the default CD directory name for the gallery.
Reimplemented from LibraryGallery. Definition at line 422 of file sglfills.cpp.
|
|
Get the Quiet status of the gallery.
Reimplemented from LibraryGallery. Definition at line 439 of file sglfills.cpp. 00440 { 00441 return LibFillsSGallery::QuietStatus; 00442 }
|
|
|
|
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 1170 of file sglfills.cpp. 01171 { 01172 // If it's a bitmap drag, add a target for our window. If not, let the base class 01173 // have a look at it (to see if it is a gallery item being dragged) 01174 if (DragMsg->pInfo->IsKindOf(CC_RUNTIME_CLASS(GalleryFillsDragInfo))) 01175 SGFillsDragTarget *NewTarget = new SGFillsDragTarget(this, GetListGadgetID()); 01176 else 01177 SuperGallery::HandleDragStart(DragMsg); 01178 }
|
|
Reimplemented from SimpleCCObject. Definition at line 244 of file sglfills.cpp. 00245 { 00246 return(TRUE); 00247 }
|
|
Initialises any menu commands that this gallery needs.
Reimplemented from SuperGallery. Definition at line 1217 of file sglfills.cpp. 01218 { 01219 static BOOL MenusInitialised = FALSE; 01220 01221 BOOL ok = TRUE; 01222 01223 if (!MenusInitialised) 01224 { 01225 // Initialise menu command Ops 01226 01227 // "Standard" entries for options menu 01228 ok = ok && InitMenuCommand((StringBase *) &SGCmd_Find, _R(IDS_SGMENU_FIND)); 01229 ok = ok && InitMenuCommand((StringBase *) &SGCmd_Sort, _R(IDS_SGMENU_SORT)); 01230 ok = ok && InitMenuCommand((StringBase *) &SGCmd_Properties, _R(IDS_SGMENU_PROPERTIES)); 01231 01232 // "Special" entries for options menu 01233 ok = ok && InitMenuCommand((StringBase *) &SGCmd_Add, _R(IDS_SGMENU_ADDFILL)); 01234 ok = ok && InitMenuCommand((StringBase *) &SGCmd_EmptyFillsCache, _R(IDS_SGMENU_EMPTYFILLCACHE)); 01235 01236 01237 // "Special" entries for over-list menu 01238 ok = ok && InitMenuCommand((StringBase *) &SGCmd_Import, _R(IDS_SGMENU_IMPORT)); 01239 ok = ok && InitMenuCommand((StringBase *) &SGCmd_Fill, _R(IDS_SGMENU_FILL)); 01240 ok = ok && InitMenuCommand((StringBase *) &SGCmd_Transp, _R(IDS_SGMENU_TRANSP)); 01241 ok = ok && InitMenuCommand((StringBase *) &SGCmd_SetBackground, _R(IDS_SGMENU_SETBACKGROUND)); 01242 ok = ok && InitMenuCommand((StringBase *) &SGCmd_Download, _R(IDS_SGMENU_DOWNLOAD)); 01243 ok = ok && InitMenuCommand((StringBase *) &SGCmd_Remove, _R(IDS_SGMENU_REMOVE)); 01244 01245 // "Standard" commands for over-list menu 01246 ok = ok && InitMenuCommand((StringBase *) &SGCmd_FoldGroup, _R(IDS_SGMENU_FOLD)); 01247 ok = ok && InitMenuCommand((StringBase *) &SGCmd_UnfoldGroup, _R(IDS_SGMENU_UNFOLD)); 01248 01249 ok = ok && InitMenuCommand((StringBase *) &SGCmd_NextGroup, _R(IDS_SGMENU_NEXTGROUP)); 01250 ok = ok && InitMenuCommand((StringBase *) &SGCmd_PrevGroup, _R(IDS_SGMENU_PREVGROUP)); 01251 01252 MenusInitialised = TRUE; 01253 } 01254 01255 return(ok); 01256 }
|
|
To check if we're a dedicated library gallery, or a half+half (like the font gallery).
Reimplemented from LibraryGallery. Definition at line 143 of file sglfills.h. 00143 {return TRUE;};
|
|
A standard message handler, really.
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 LibraryGallery. Definition at line 658 of file sglfills.cpp. 00659 { 00660 // Added by Craig Hamilton 18/1/01. 00661 static HANDLE handle = NULL; 00662 CString mutexName = "autorunMutex"; 00663 // End added. 00664 00665 // If we have no displaytree, then we have not been shown, or something terrible has 00666 // happened, so we don't bother handling any of these messages. 00667 if (DisplayTree == NULL) 00668 return(LibraryGallery::Message(Message)); 00669 00670 KernelBitmap *SelectedBitmap = NULL; 00671 00672 if (IS_OUR_DIALOG_MSG(Message)) 00673 { 00674 DialogMsg* Msg = (DialogMsg*)Message; 00675 00676 switch (Msg->DlgMsg) 00677 { 00678 case DIM_CREATE: 00679 // Added by Craig Hamilton 18/1/01. 00680 // This and the section of code of the same date in the DIM_CANCEL handler below 00681 // deal with the creation and destruction of a kernel object that is recognised by 00682 // the autorun. If this object exists then the autorun does not run. This is so 00683 // that the user can enter their resources cd while the gallery is open and not be 00684 // annoyed by the autorun appearing. 00685 handle = CreateMutex(NULL,TRUE,mutexName); 00686 // End added. 00687 00688 SGInit::UpdateGalleryButton(OPTOKEN_DISPLAYFILLSGALLERY, TRUE); 00689 LibFillsSGallery::ThisGallery->GalleryAboutToReOpen(); 00690 break; 00691 00692 case DIM_CANCEL: 00693 // Added by Craig Hamilton 18/1/01. 00694 if(handle != NULL) 00695 { 00696 CloseHandle(handle); 00697 } 00698 // End added. 00699 00700 SGInit::UpdateGalleryButton(OPTOKEN_DISPLAYFILLSGALLERY, FALSE); 00701 00702 // Flush the thumbnail cache 00703 BROADCAST_TO_CLASS(ThumbMessage(ThumbMessage::ThumbState::KILLCACHE, SGLib_Texture), DialogOp); 00704 BROADCAST_TO_CLASS(ThumbMessage(ThumbMessage::ThumbState::KILLCACHE, SGLib_Fractal), DialogOp); 00705 GalleryAboutToClose(); 00706 break; 00707 00708 case DIM_LFT_BN_CLICKED: 00709 switch (Msg->GadgetID) 00710 { 00711 case _R(IDC_LIBGAL_OPEN): 00712 if(Document::GetSelected() != NULL) 00713 FillUsingFillGallerySelection(AddToPage); 00714 break; 00715 00716 case _R(IDC_LIBGAL_IMPORT): 00717 FillUsingFillGallerySelection(AddToPage); 00718 break; 00719 00720 case _R(IDC_LIBGAL_BROWSE): 00721 case _R(IDC_LIBGAL_ADD_FILLS): 00722 BrowseClicked(); 00723 break; 00724 00725 case _R(IDC_BMPGAL_FILL): 00726 if(!FillUsingFillGallerySelection(ApplyToObject)) 00727 { 00728 return(SuperGallery::Message(Message)); 00729 } 00730 break; 00731 00732 case _R(IDC_BMPGAL_TEXTURE): 00733 if(Document::GetSelected() != NULL) 00734 if(!FillUsingFillGallerySelection(ApplyToObjectAsTransp)) 00735 { 00736 return(SuperGallery::Message(Message)); 00737 } 00738 break; 00739 00740 case _R(IDC_BMPGAL_BACKGROUND): 00741 if(Document::GetSelected() != NULL) 00742 if(!FillUsingFillGallerySelection(SetBackground)) 00743 { 00744 return(SuperGallery::Message(Message)); 00745 } 00746 break; 00747 00748 case _R(IDC_BMPGAL_SAVE): 00749 #ifdef _DEBUG 00750 { 00751 SGDisplayNode *Item = DisplayTree->FindNextSelectedItem(NULL); 00752 if(Item != NULL && Item->IsKindOf(CC_RUNTIME_CLASS(SGLibDisplayItem))) 00753 { 00754 SGLibDisplayItem *LibItem = (SGLibDisplayItem *)Item; 00755 00756 Library *Parent = LibItem->GetParentLibrary(); 00757 if(Parent != NULL) 00758 { 00759 PathName *Source = Parent->ReturnIndexLocation(); 00760 PathName Dest(*Source); 00761 Dest.SetType((String_256)"BAK"); 00762 SGLibOil::FileCopy(Source, &Dest); 00763 00764 Parent->SaveIndexInDisplayedOrder(Source, TRUE); 00765 } 00766 } 00767 } 00768 #endif 00769 break; 00770 00771 case _R(IDC_GALLERY_HELP): // Show help page 00772 HelpUserTopic(_R(IDS_HELPPATH_Gallery_Fill)); 00773 break; 00774 00775 00776 00777 default: 00778 break; 00779 } 00780 } 00781 } 00782 else if (MESSAGE_IS_A(Message, DocChangingMsg)) 00783 { 00784 DocChangingMsg *Msg = (DocChangingMsg *) Message; 00785 switch (Msg->State) 00786 { 00787 case DocChangingMsg::DocState::SELCHANGED: 00788 if (Msg->pNewDoc == NULL) 00789 { 00790 // There is no selected doc - this can only mean there are no docs 00791 // at all, so we had better shade the gallery 00792 DoShadeGallery(TRUE); 00793 SuperGallery::ShadeGallery(TRUE); 00794 } 00795 else 00796 { 00797 // Possibly a new document 00798 DoShadeGallery(FALSE); 00799 SuperGallery::ShadeGallery(FALSE); 00800 SelectionHasChanged(); 00801 } 00802 break; 00803 } 00804 } 00805 else if (MESSAGE_IS_A(Message, ThumbMessage) && DisplayTree != NULL) 00806 { 00807 ThumbMessage *Msg = (ThumbMessage *) Message; 00808 00809 // If a library Thumb message comes around, flush the redraw stuff, etc 00810 if(Msg->State == ThumbMessage::ThumbState::CACHESIZECHANGED) 00811 { 00812 FlushBackgroundRedraws(); 00813 ForceRedrawOfList(); 00814 } 00815 } 00816 00817 return(LibraryGallery::Message(Message)); 00818 }
|
|
The LibFillsSGallery 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 LibraryGallery. Definition at line 272 of file sglfills.cpp. 00273 { 00274 // If there isn't already one, create a DisplayTree 00275 if (DisplayTree == NULL) 00276 { 00277 DisplayTree = new SGDisplayRootScroll(this); // New root node, with a scrollbar 00278 if (DisplayTree == NULL) 00279 return(FALSE); 00280 } 00281 00282 // Add the library groups to the gallery if they're not there already 00283 if(OpenLibFiles.IsEmpty()) 00284 { 00285 String_256 sLoc = DefaultLibraryPath; 00286 // Set DefaultLibraryPath to <ExeLocation>\Fills - the user might have installed 00287 // the fills to his hard disk: 00288 if(CResDll::GetExecutablePath((TCHAR*)DefaultLibraryPath)) 00289 { 00290 // Look for the resources in the main Xara X folder first 00291 String_256 LibDirName; 00292 GetLibraryDirectoryName(&LibDirName); 00293 DefaultLibraryPath += "\\"; 00294 DefaultLibraryPath += LibDirName; 00295 PathName ThisPath(DefaultLibraryPath); 00296 if(!SGLibOil::FileExists(&ThisPath)) // will also work for paths (not just paths with a filename on the end) 00297 { 00298 // Fills not on hard disk. Try the CD location 00299 if(!ScanForLocation(SGLib_Texture, NULL)) 00300 { 00301 // hard drive and CD location not found 00302 // put the original path back 00303 DefaultLibraryPath = sLoc; 00304 } 00305 } 00306 } 00307 00308 LibraryGallery::AddLibraryGroups(SGLib_Texture, &DefaultLibraryPath); 00309 } 00310 00311 // Use last time's display mode 00312 DisplayMode = LibFillsSGallery::DefaultDisplayMode; 00313 00314 return TRUE; 00315 }
|
|
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 from LibraryGallery. Definition at line 479 of file sglfills.cpp. 00480 { 00481 #ifndef STANDALONE 00482 // Search for a CD ROM drive 00483 String_256 DriveName; 00484 BOOL AreWeXara = FALSE; 00485 String_256 XaraDrive; 00486 00487 BOOL Adjust = KeyPress::IsAdjustPressed(); 00488 #ifndef _DEBUG 00489 Adjust = FALSE; 00490 #endif 00491 00492 if(SGLibOil::LocateCDROMDrive(this, Type, &DriveName, &AreWeXara, &XaraDrive, Adjust)) 00493 { 00494 if(AreWeXara) 00495 DriveName = XaraDrive; 00496 00497 switch(Type) 00498 { 00499 case SGLib_Texture: 00500 case SGLib_Fractal: 00501 LibFillsSGallery::DefaultLibraryPath = DriveName; 00502 #ifdef _DEBUG 00503 if(Adjust) 00504 { 00505 LibFillsSGallery::DefaultLibraryPath += TEXT("Graphics\\Fills"); 00506 } 00507 else 00508 #endif 00509 { 00510 String_256 LibDirName; 00511 GetLibraryDirectoryName(&LibDirName); 00512 LibFillsSGallery::DefaultLibraryPath += LibDirName; 00513 } 00514 00515 if(Result) 00516 *Result = LibFillsSGallery::DefaultLibraryPath; 00517 00518 return TRUE; 00519 } 00520 } 00521 #endif 00522 return FALSE; 00523 }
|
|
To inform the gallery that the selection has changed in some way. We need to grey different buttons on different occasions Notes:.
Reimplemented from LibraryGallery. Definition at line 834 of file sglfills.cpp. 00835 { 00836 if (DisplayTree == NULL) 00837 return; 00838 00839 // As we now allow the gallery to be closed and all the groups to remain, we must now 00840 // also check to see if the gallery is visible i.e. open or not. If not then get out now. 00841 // Required as SetStringGadgetValue will ERROR and memory leak if called when dialog closed. 00842 if (!IsVisible()) 00843 return; 00844 00845 INT32 Count = DisplayTree->GetSelectedItemCount(); 00846 BOOL Documents = (Document::GetSelected() != NULL); 00847 00848 // Set up button states 00849 00850 // Enable the import button if there is a selection and valid documents 00851 EnableGadget(_R(IDC_LIBGAL_IMPORT), (Count > 0) && Documents); 00852 00853 String_256 strCommand, strDummy; 00854 00855 BOOL bEnable = Count == 1 && Documents; 00856 00857 // Import button 00858 strCommand = SGCmd_Import; 00859 EnableGadget(_R(IDC_LIBGAL_IMPORT), bEnable && !((GetCommandState(&strCommand, &strDummy)).Greyed)); 00860 00861 // Fill button 00862 strCommand = SGCmd_Fill; 00863 EnableGadget(_R(IDC_BMPGAL_FILL), bEnable && !((GetCommandState(&strCommand, &strDummy)).Greyed)); 00864 00865 // Transp button 00866 strCommand = SGCmd_Transp; 00867 EnableGadget(_R(IDC_BMPGAL_TEXTURE), bEnable && !((GetCommandState(&strCommand, &strDummy)).Greyed)); 00868 00869 // Background button 00870 strCommand = SGCmd_SetBackground; 00871 EnableGadget(_R(IDC_BMPGAL_BACKGROUND), bEnable && !((GetCommandState(&strCommand, &strDummy)).Greyed)); 00872 00873 EnableGadget(_R(IDC_LIBGAL_ADD_FILLS), TRUE); 00874 00875 LibraryGallery::SelectionHasChanged(); 00876 }
|
|
Set the Quiet status of the gallery.
Reimplemented from LibraryGallery. Definition at line 456 of file sglfills.cpp. 00457 { 00458 LibFillsSGallery::QuietStatus = Status; 00459 }
|
|
Sorts the contents of the gallery in an alphabetical fashion, whilst keeping the old sort key status... Notes:.
Reimplemented from LibraryGallery. Definition at line 334 of file sglfills.cpp. 00335 { 00336 LibraryGallery::SortGallery(); 00337 }
|
|
Returns the section name to use in the grm file.
Reimplemented from LibraryGallery. Definition at line 1193 of file sglfills.cpp. 01194 { 01195 if(Section) 01196 *Section = _R(IDS_SGLFILLS_SECTION_NAME); // "FillsGallery"; 01197 }
|
|
Definition at line 245 of file sglfills.h. |
|
Definition at line 242 of file sglfills.h. |
|
Definition at line 248 of file sglfills.h. |
|
Definition at line 255 of file sglfills.h. |
|
Definition at line 252 of file sglfills.h. |