#include <sgallery.h>
Inheritance diagram for SuperGallery:

Public Member Functions | |
| SuperGallery (CCRuntimeClass *Class=NULL) | |
| SuperGallery constructor (Identical to DialogOp). | |
| SuperGallery (String_32 &NewName, CCRuntimeClass *Class=NULL) | |
| SuperGallery constructor (Identical to DialogOp). | |
| ~SuperGallery () | |
| SuperGallery destructor. | |
| virtual BOOL | Create (void) |
| The SuperGallery Create method This method has been overridden to de-specialize the DialogOp. | |
| virtual void | SetVisibility (BOOL Open) |
| Used by the tool bar customize system to open and close a tool bar. | |
| void | SetGallerySize (wxSize Size) |
| wxSize | GetGallerySize (void) |
| BOOL | Write (CCLexFile &file) |
| Write the Gallery to the file in a tokenized form Write the SuperGallery to the file in a tokenized form. | |
| BOOL | Write (SaveRegistryEntries &Saver) |
| Write the SuperGallery to the registry. | |
| virtual MsgResult | Message (Msg *Message) |
| A standard message handler, really. If you override this in a derived class, you must pass any unhandled event on to this base class method after handling the messages you are interested in. | |
| INT32 | GetDisplayExtent (void) |
| To determine the length of the displayed list, in MILLIPOINTS; actually, in terms of the mimimum displayed Y coordinate, which is really -(Length). | |
| void | ForceGroupFolded (SGDisplayGroup *GroupToFold, BOOL FoldedState) |
| Ensures that the given group is in an {un}folded state. If it is not oin the desired state, the state is changed, and the tree is reformatted and invalidated for redraw. | |
| void | ScrollToShow (DocRect *Area, BOOL PreferToSeeBottom=FALSE) |
| Determines if the given rectangle is entirely visible in the display window. If it is not, the window is scrolled to show the rectangle. Used to scroll the display to ensure a single item or set of items is visible on screen. | |
| void | ScrollArea (DocRect *Area, DocCoord *ScrollBy) |
| To scroll the list gadget in the super gallery. Basically just a veneer function for sgdisplayrootscroll which can't tidily access the DialogOp method... | |
| void | PaintListNow (void) |
| Direct veneer function for DialogOp::PaintGadgetNow for the ListBox gadget. Allows SGDisplayNodes to force an immediate update. | |
| void | ReformatNow (BOOL ForceReformat) |
| Immediately reformats the display tree if necessary. NOTE: This is done automatically on any redraw if the cached format is known to be out of date. However, sometimes (e.g. when unfolding a group and then scrolling to it) you may want to chnage the display tree format and then cause the formatting to be recalculated before it is needed for the next step (scrolling) of your operation. | |
| void | ForceRedrawOfList (void) |
| Reformats, and then redraws the entire displayed list. | |
| void | ForceRedrawOfArea (DocRect *Area) |
| Redraws the given region of the list. The area specified is a MILLIPOINT offset within the SuperGallery Virtual Coordinate Space. | |
| void | RedrawEverythingBelow (INT32 TopYCoord) |
| To redraw the display list from a given positio downwards (e.g. if a document list changes, you'll need to redraw its display, plus any displays below it which may have moved around). | |
| void | RedrawDocumentDisplay (Document *TheDocument) |
| To redraw the entire display list for the given document. If the cached formatting information is known to be compromised, a reformat will occur, and the necessary regions will be redrawn. Otherwise, just the document's display will be redrawn. | |
| void | ReformatAndRedrawIfNecessary (void) |
| If the cached format information is thought to be out of date (eg after someone has called InvalidateCachedFormat) then this method will cause a reformatting operation to be carried out, and will then redraw any areas which are affected (have changed due to the reformatting). | |
| void | InvalidateCachedFormat (void) |
| Indicates to the super gallery that the cached display tree formatting is out of date, and must be recalculated before next redraw of the display. | |
| void | ShadeGallery (BOOL ShadeIt) |
| Shades (disables) the SuperGallery window. This calls the DoShadeGallery upcall to allow derived classes to take special action for any extra controls they may own, etc. | |
| void | SelectItems (BOOL SelectThem, BOOL Exclusive=FALSE, Document *ParentDocument=NULL, Library *ParentLibrary=NULL) |
| To select/deselect groups of display items (or all display items) in this Gallery display. All items whose state changes will force redraw themselves automatically. | |
| void | SelectGroups (BOOL SelectThem, BOOL Exclusive=FALSE, Document *ParentDocument=NULL, Library *ParentLibrary=NULL) |
| To select/deselect groups of display groups (or all display groups) in this Gallery display. All groups whose state changes will force redraw themselves automatically. | |
| void | SelectRange (SGDisplayNode *PrimeNode, SGDisplayNode *AnchorNode) |
| Selects the PrimeNode, and if possible, all sibling nodes between it and the Anchor node. If Anchor == NULL or is not found, only PrimeNode is selected. Does not deselect any nodes - you should call SelectItems first to clear the seln. | |
| INT32 | GetSelectedItemCount (Document *TheDocument=NULL, Library *TheLibrary=NULL) |
| Counts the number of selected items in the display tree or a subtree. | |
| INT32 | GetSelectedGroupCount (void) |
| Counts the number of selected groups in the display tree. | |
| virtual void | SelectionHasChanged (void) |
| To inform the gallery that the selection has changed in some way. The base gallery class will do the following things:. | |
| BOOL | AreYouRedrawingNow (void) |
| To determine if the gallery is currently redrawing. This is necessary for two reasons: (1) To ensure we don't go re-entrant in redraw code (because we can't have more than one active render region or it'll go bang), (2) To allow things like the SGDisplayRootScroll to take special action when they try to chnage the scroll position if we are in a redraw (obviously at this point, doing a ScrollWindow and force redraws would be silly, if not downright dangerous). | |
| CGadgetID | GetListGadgetID (void) |
| To allow outside entities to determine the list box gadget ID. Meant only for gallery drags to determine their target area. | |
| INT32 | GetDisplayMode () const |
| SGDisplayRoot * | GetDisplayTree () const |
| virtual BOOL | CanSearchKeywords (void) |
| Used to determine if this type of gallery supports keyword searching. By default galleries do not. Override and return TRUE if you do. | |
| virtual BOOL | GetStatusLineHelp (DocCoord *MousePos, String_256 *Result) |
| Gets status line help from the gallery. | |
| virtual BOOL | PreContextMenu (void) |
| Give the gallery a chance to do something before popping up the context menu. Called before the context menu is popped up on a right click. At present, used by the bitmap gallery to ensure that the plug-ins have all been parsed. Notes: The base class method does nothing. Override it in galleries which require this assistance. | |
| virtual BOOL | InitMenuCommands (void) |
| Initialises any menu commands that this gallery needs. | |
| BOOL | InitMenuCommand (StringBase *CommandID, UINT32 MenuTextID) |
| To initialise a menu command for future use. This should be called for any potential menu commands *on startup* - it essentially adds OpDescriptors to the system, and they must be initialised and ready to go right from startup of the application. | |
| virtual BOOL | BuildCommandMenu (GalleryContextMenu *TheMenu, SGMenuID MenuID) |
| To build a menu of commands to be popped up over the gallery. | |
| BOOL | AddCommand (GalleryContextMenu *TheMenu, StringBase *CommandID, BOOL Separator=FALSE, MenuItem *pRootMenu=NULL) |
| To add a gallery command (or separator) to the end of a menu currently being built. Call this from your overridden BuildCommandMenu method to add each appropriate command to the menu. NOTE that this command must have been registered on startup by calling InitMenuCommand. | |
| 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. | |
| SGDisplayGroup * | FindCommandGroup (void) |
| Determines which group will be affected by a menu command, if any. Esentially finds the first selected group in the gallery, or the parent group of the first selected item. | |
| virtual SGDisplayItem * | CopyDisplayItem (SGDisplayItem *SourceItem, SGDisplayGroup *DestGroup, SGDisplayItem *TargetPosition=NULL) |
| "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. | |
| SGDisplayNode * | FindNodeUnderPointer (DocCoord *ThePoint) |
| To allow outside entities to determine which display node lies under the (current mouse pointer) position. | |
| void | AutoScrollForDrag (DocCoord *MousePosition) |
| If the given point is near the top or bottom of the window, this will cause the supergallery to auto-scroll the window up/down. Intended to allow drags to autoscroll as necessary. | |
| void | FillInMiscInfo (SGMiscInfo *MiscInfo, ReDrawInfoType *DlgRedrawInfo=NULL) |
| Sets up a MiscInfo structure, ready for use. | |
| virtual SGDisplayGroup * | AddLibraryGroup (Library *LibraryToDisplay, INT32 NumItems) |
| Creates a blank group in the displaytree representing the given library. (If a suitable group already exists, its contents are wiped in preparation for being filled in again). | |
| virtual void | RemoveLibraryGroup (Library *DisplayedLibrary) |
| Ensures that there are no display groups representing this library in the DisplayTree- deletes any related group from the tree if necessary. Used when Library objects are destructed to ensure no references to them are held by their parent gallery. | |
| 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 | ConvertToVirtualCoords (SGMiscInfo *MiscInfo, DocCoord *SourceAndResult) |
| Converts a standard DocCoord, as passed in for kernel-rendered dialogues, into a standard Display-list virtual coordinate, as used by Display items. | |
| BOOL | ConvertFromVirtualCoords (SGMiscInfo *MiscInfo, DocRect *SourceAndResult) |
| Converts a standard Display-list virtual rectangle, as used by Display items, into a rect as used in kernel-rendered dialogues. The returned rectangle may be outside the visible display area of the gadget. | |
| virtual BOOL | ApplyAction (SGActionType Action) |
| Applies certain conventional gallery actions (usually associated with gallery buttons, for new, edit, delete, etc). | |
| SGSortKey * | GetCurrentSortKeys (void) |
| virtual void | ApplySortNow (BOOL ApplyToEntireList) |
| Applies the current gallery sort mode (member array SortKeys) to the display list. | |
| BOOL | DeVirtualiseAllGroups (StringBase *ProgressBarMsg) |
| Go through all the gallery groups and de-virtualise all virtual groups. A virtual group is a group with no associated items, de-virtualising will create all these items. | |
| void | SetLastSelectedNode (SGDisplayNode *JustSelected) |
| To set which node, if any, was last selected in this gallery. Used by the display tree to determine the anchor point for selection extension exercises. | |
| SGDisplayNode * | GetLastSelectedNode (void) |
| To determine which node, if any, was last selected in this gallery. Used by the display tree to determine the anchor point for selection extension exercises. | |
| virtual BOOL | GetQuietStatus (void) |
| Get the Quiet status of the gallery - used when a load of indexes are being added to the gallery and there are problems... | |
| virtual void | SetQuietStatus (BOOL Status) |
| Set the Quiet status of the gallery - used when a load of indexes are being added to the gallery and there are problems... | |
| 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). | |
| void | IncrementPendingRedraws (void) |
| Called by SGDisplayNode classes to handle background redraw. This increments our count of how many items are awaiting background redraw. While this counter is greater than zero, we use an idle processor to kick off background redraws every now and then. | |
| void | DecrementPendingRedraws (void) |
| Called by SGDisplayNode classes to handle background redraw. This increments our count of how many items are awaiting background redraw. While this counter is greater than zero, we use an idle processor to kick off background redraws every now and then. | |
| virtual BOOL | OnIdleEvent (void) |
| Processes idle events for the supergallery. This is used to provide backgrounded redraw of gallery items. | |
| void | FlushBackgroundRedraws (void) |
| Resets the BG rendering system - flushes all pending bg redraws, and then ensures the system is in the default (inactive) state. This has the useful side effect that if bg rendering has become confused it will reset the state and 'unconfuse' the renderer. | |
| void | SetLastBackgroundNode (SGDisplayNode *LastNodeRendered)\ |
| SGDisplayNode * | GetLastBackgroundNode (void)\ |
| virtual BOOL | IsABar () |
| virtual BOOL | IsAGallery () |
| String_32 & | GetGalName () |
| void | SetGalName (const String_32 &str) |
Static Public Member Functions | |
| static SuperGallery * | FindSuperGallery (String_32 &SuperGalleryName, INT32 limit=-1) |
| Looks for a given SuperGallery by using its name. | |
| static SuperGallery * | FindSuperGallery (ResourceID SuperGalleryID) |
| Looks for a given SuperGallery by using its name. | |
Public Attributes | |
| SGDisplayRoot * | DisplayTree |
| String_32 | Name |
Static Public Attributes | |
| static INT32 | UseFixedColourSet = FALSE |
Protected Member Functions | |
| void | InsertCopiedItem (SGDisplayItem *CopiedItem, SGDisplayGroup *DestGroup, SGDisplayItem *TargetPosition) |
| Inserts a given copied-node into the tree in an appropriate fashion. Used for re-organising the tree at the conclusion of a drag. Intended to be called only from overridden CopyDisplayItem() methods, to take all the work out of the process of copying display items around. | |
| void | BroadcastEvent (SGEventType EventType, void *EventInfo, SGMiscInfo *MiscInfo=NULL) |
| Passes the given event through the DisplayTree. | |
| void | CalcVirtualSize (ReDrawInfoType *DlgRedrawInfo, DocRect *VirtualSize, INT32 *PixelSize) |
| Shared internal code to determine the virtual coordinate space of the region of the display list which is visible n screen. | |
| void | RenderListBox (ReDrawInfoType *RedrawInfo) |
| Renders the displayed list of items into the 'list box' control. | |
| void | ConvertToVirtualCoords (ReDrawInfoType *DlgRedrawInfo, DocCoord *SourceAndResult) |
| Converts a standard DocCoord, as passed in for kernel-rendered dialogues, into a standard Display-list virtual coordinate, as used by Display items. | |
| virtual BOOL | PreCreate (void) |
| A call to be overridden by the derived class. This is called BEFORE the SuperGallery::Create function tries to create the gallery window. Derived galleries then initialise any unintialised data, and return TRUE if it is safe to continue creating the gallery window. | |
| virtual BOOL | PostCreate (void) |
| A call to be overridden by the derived class. This is called AFTER the SuperGallery::Create function has succeeded. Derived galleries can then initialise any unintialised data, and return TRUE if it is safe to open the gallery window. | |
| virtual void | DoShadeGallery (BOOL ShadeIt) |
| Shades (disables) the SuperGallery window. This calls the DoShadeGallery upcall to allow derived classes to take special action for any extra controls they may own, etc. | |
| virtual void | HandleDragStart (DragMessage *DragMsg) |
| Checks a DragMessage to see if it is a gallery list-drag. If so, it adds a new drag target to handle drops on the gallery list box. | |
| virtual RenderRegion * | CreateRenderRegion (DocRect *VirtualSize, ReDrawInfoType *DlgRedrawInfo) |
| An overridable veneer to the DialogOp CreateOSRenderRegion method. This can be overriden to use a different type of renderregion for all of your rendering. | |
| virtual void | DestroyRenderRegion (RenderRegion *pRender) |
| An overridable veneer to the DialogOp DestroyOSRenderRegion method. This can be overriden to use a different type of renderregion for all of your rendering. | |
| virtual void | CloseOwnedDialogs (void) |
| Checks and closes the various dialogs which can be owned by galleries. | |
Static Protected Member Functions | |
| static INT32 __cdecl | SortComparator (const void *Item1, const void *Item2) |
| 'qsort' comparator function, used when quicksorting the display list | |
Protected Attributes | |
| wxSize | GallerySize |
| INT32 | PendingRedraws |
| SGDisplayNode * | LastBGNode |
| INT32 | DisplayMode |
| BOOL | FormatIsCached |
| INT32 | LastWindowDX |
| INT32 | LastWindowDY |
| BOOL | AmShaded |
| BOOL | AmRedrawing |
| SGDisplayNode * | LastSelectedNode |
| MonotonicTime | LastClickTime |
| DocCoord | LastClickPos |
| BOOL | DblClickPending |
| SGalleryOptionsDlg * | CurrentOptionsDlg |
| SGallerySortDlg * | CurrentSortDlg |
| SGallerySearchDlg * | CurrentSearchDlg |
| SGSortKey | SortKeys [MaxSGSortKeys] |
| SGalleryLinePropertiesDlg * | CurrentLinePropertiesDlg |
Static Protected Attributes | |
| static SuperGallery * | CurrentSortGallery = NULL |
Private Member Functions | |
| void | InitData (void) |
| Internal method to initialise data mambers. Shared code for constructors. | |
Friends | |
| class | SGalleryOptionsDlg |
| class | SGallerySortDlg |
| class | SGallerySearchDlg |
| class | SGalleryLinePropertiesDlg |
Definition at line 243 of file sgallery.h.
|
|
SuperGallery constructor (Identical to DialogOp).
Definition at line 228 of file sgallery.cpp. 00228 : DialogOp(_R(IDD_BLANKBAR), MODELESS,0,GSAFECLASS(Class)) 00229 { 00230 String_32 str = String_32(_R(IDS_K_BARS_NONAME)); 00231 Name=str; 00232 InitData(); 00233 }
|
|
||||||||||||
|
SuperGallery constructor (Identical to DialogOp).
Definition at line 248 of file sgallery.cpp. 00249 : DialogOp(_R(IDD_BLANKBAR), MODELESS,0,GSAFECLASS(Class)) 00250 { 00251 String_32 str = String_32(_R(IDS_K_BARS_NONAME)); 00252 Name=str; 00253 InitData(); 00254 }
|
|
|
SuperGallery destructor.
Definition at line 268 of file sgallery.cpp. 00269 { 00270 if (DisplayTree != NULL) 00271 { 00272 DisplayTree->DestroySubtree(); // Destroy the tree, destructing all nodes except root 00273 delete DisplayTree; // And delete the root as well 00274 DisplayTree = NULL; 00275 } 00276 00277 CloseOwnedDialogs(); 00278 00279 // Remove any idle event processor we had registered for BG redraws 00280 GetApplication()->RemoveIdleProcessor(MyIdlePriority, this); 00281 }
|
|
||||||||||||||||||||
|
To add a gallery command (or separator) to the end of a menu currently being built. Call this from your overridden BuildCommandMenu method to add each appropriate command to the menu. NOTE that this command must have been registered on startup by calling InitMenuCommand.
Definition at line 2694 of file sgallery.cpp. 02696 { 02697 String_256 OpToken = GetGalName(); 02698 // With the new GIF Animation frame gallery, this can mean that the OpToken can easily 02699 // overrun its String_32 allocation. Therefore, restrict the name to the first 16 characters. 02700 // Unfortunately, we then use the name to find the gallery to send the command to! 02701 // So we match that only using the GalleryBarNameLimitSize (16) characters 02702 String_256 OpTokenT = OpToken; 02703 OpToken.Left(&OpTokenT, GalleryBarNameLimitSize); 02704 02705 OpTokenT += TEXT(":"); 02706 OpTokenT += *CommandID; 02707 02708 return(TheMenu->BuildCommand(OpTokenT, Separator, pRootMenu)); 02709 }
|
|
||||||||||||
|
Creates a blank group in the displaytree representing the given library. (If a suitable group already exists, its contents are wiped in preparation for being filled in again).
Reimplemented in LibraryGallery, LibClipartSGallery, LibFillsSGallery, and FontsSGallery. Definition at line 2438 of file sgallery.cpp. 02439 { 02440 ERROR3IF(LibraryToDisplay == NULL, "SuperGallery::AddLibraryGroup - NULL parameter is illegal"); 02441 02442 if (DisplayTree == NULL) 02443 { 02444 ERROR3("SuperGallery::AddLibraryGroup called before the DisplayTree was initialised!"); 02445 return(NULL); 02446 } 02447 02448 SGDisplayGroup *TheGroup = DisplayTree->FindSubtree(this, NULL, LibraryToDisplay); 02449 02450 if (TheGroup == NULL) 02451 { 02452 // No existing group for that library, so create a new one 02453 TheGroup = new SGDisplayGroup(this, NULL, LibraryToDisplay); 02454 if (TheGroup == NULL) // Failed! 02455 return(NULL); 02456 02457 // And add it to our display tree 02458 DisplayTree->AddItem(TheGroup); 02459 } 02460 else 02461 TheGroup->DestroySubtree(FALSE); // Delete all items in the group 02462 02463 return(TheGroup); 02464 02465 }
|
|
||||||||||||||||||||
|
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 in LibraryGallery, LibClipartSGallery, LibFillsSGallery, and FontsSGallery. Definition at line 2535 of file sgallery.cpp. 02537 { 02538 ERROR3IF(LibraryGroup == NULL || ParentLib == NULL, 02539 "SuperGallery::AddLibraryItem - NULL params are illegal"); 02540 02541 ERROR3IF(LibraryGroup->GetParentLibrary() != ParentLib, 02542 "SuperGallery::AddLibraryitem - The DisplayGroup is not for the same library!"); 02543 02544 // The base class cannot add library items - derived classes must override this method 02545 // in order to provide the necessary functionality (as they must create items of the 02546 // correct type in order to display things from the given library 02547 ERROR3("Illegal attempt to add a library item to a gallery which doesn't support it!"); 02548 02549 return(NULL); 02550 }
|
|
|
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 in ColourSGallery, LibraryGallery, and FontsSGallery. Definition at line 3174 of file sgallery.cpp.
|
|
|
Applies certain conventional gallery actions (usually associated with gallery buttons, for new, edit, delete, etc).
Notes: This base-class method should be overridden by derived classes. It does nothing by default, and returns FALSE.
Reimplemented in NameGallery, TEMPLATESGallery, BitmapSGallery, ColourSGallery, FrameSGallery, LayerSGallery, LibraryGallery, LibClipartSGallery, LibFillsSGallery, LineGallery, NameGallery, and FontsSGallery. Definition at line 1019 of file sgallery.cpp. 01020 { 01021 return(FALSE); 01022 }
|
|
|
Applies the current gallery sort mode (member array SortKeys) to the display list.
Reimplemented in FontsSGallery. Definition at line 1085 of file sgallery.cpp. 01086 { 01087 if (SortKeys[0].SortKey == 0 || DisplayTree == NULL) 01088 return; 01089 01090 CurrentSortGallery = this; 01091 01092 SGDisplayNode *CurrentGroup = DisplayTree->GetChild(); 01093 if (CurrentGroup == NULL) // Nothing to sort 01094 return; 01095 01096 SGDisplayNode *Ptr = CurrentGroup; 01097 01098 // Pre-run progress indicator 01099 String_64 ProgMsg(_R(IDS_GALLERY_PREPARE_FOR_SORT)); 01100 BeginSlowJob(-1, FALSE, &ProgMsg); 01101 01102 // For library galleries we need to set the Quiet button status ready to un-supress errors 01103 SetQuietStatus(FALSE); 01104 01105 // Count the number of available items to sort 01106 BOOL HasSelection = FALSE; 01107 INT32 NumItemsToSort = 0; 01108 while (Ptr != NULL) 01109 { 01110 if(ApplyToEntireList || ((SGDisplayGroup *)Ptr)->IsSelected()) 01111 if(((SGDisplayGroup *)Ptr)->IsVirtualised()) 01112 ((SGDisplayGroup *)Ptr)->DeVirtualise(); 01113 01114 if (ApplyToEntireList || ((SGDisplayGroup *)Ptr)->FindNextSelectedItem(NULL) != NULL) 01115 { 01116 SGDisplayNode *Item = Ptr->GetChild(); // Count number of items to sort in this group 01117 INT32 ItemsInThisGroup = 0; 01118 while (Item != NULL) 01119 { 01120 ItemsInThisGroup++; 01121 if (Item->Flags.Selected) 01122 HasSelection = TRUE; 01123 Item = Item->GetNext(); 01124 } 01125 01126 if (ItemsInThisGroup > 1 && (ApplyToEntireList || HasSelection)) 01127 NumItemsToSort += ItemsInThisGroup; 01128 } 01129 Ptr = Ptr->GetNext(); 01130 } 01131 01132 EndSlowJob(); 01133 01134 // If there is no point in trying to sort, abort now 01135 if (NumItemsToSort < 2) 01136 return; 01137 01138 // Start progress indicators, with a percentage based upon the number of items. 01139 // We will update twice for each group (after qsort and shuffle-items stages) 01140 String_64 Description(_R(IDS_SGOPTS_SORTING)); 01141 BeginSlowJob(NumItemsToSort * 2, FALSE, &Description); 01142 NumItemsToSort = 0; 01143 01144 INT32 NumItems; 01145 INT32 i; 01146 BOOL GroupHasChanged = FALSE; 01147 01148 while (CurrentGroup != NULL) 01149 { 01150 // Don't sort virtualised-out groups ! (they should have all been devirtualised before) 01151 if(!((SGDisplayGroup *)CurrentGroup)->IsVirtualised()) 01152 { 01153 HasSelection = FALSE; 01154 Ptr = CurrentGroup->GetChild(); 01155 ERROR3IF(Ptr != NULL && !Ptr->IsKindOf(CC_RUNTIME_CLASS(SGDisplayItem)), 01156 "Sort hasn't found items! Heinous failure imminent!" ); 01157 // Count the number of items we have to sort 01158 NumItems = 0; 01159 while (Ptr != NULL) 01160 { 01161 NumItems++; 01162 if (Ptr->Flags.Selected) 01163 HasSelection = TRUE; 01164 Ptr = Ptr->GetNext(); 01165 } 01166 01167 // If there are 2 or more items, and we are either applying to all groups, or this 01168 // group contains selected item(s), then we will sort it.. 01169 if (NumItems > 1 && (ApplyToEntireList || HasSelection)) 01170 { 01171 // Get memory for an array of pointers to these items 01172 SGDisplayNode **SortArray = (SGDisplayNode **)CCMalloc(NumItems * sizeof(SGDisplayNode *)); 01173 if (SortArray == NULL) 01174 { 01175 CurrentSortGallery = NULL; 01176 InvalidateCachedFormat(); 01177 EndSlowJob(); 01178 InformError(); 01179 return; 01180 } 01181 01182 // Fill in the array with pointers to display items to sort 01183 i = 0; 01184 Ptr = CurrentGroup->GetChild(); 01185 while (Ptr != NULL) 01186 { 01187 SortArray[i++] = Ptr; 01188 Ptr = Ptr->GetNext(); 01189 } 01190 01191 // Sort the array of pointers 01192 qsort(SortArray, NumItems, sizeof(SGDisplayNode *), SuperGallery::SortComparator); 01193 01194 NumItemsToSort += NumItems; 01195 if (!ContinueSlowJob(NumItemsToSort)) // Update percentage complete for the number of items processed 01196 { 01197 // User has cancelled by pressing escape 01198 CCFree(SortArray); 01199 break; 01200 } 01201 01202 01203 GroupHasChanged = FALSE; 01204 01205 // Now, take the sorted array, and rearrange the display items to be in that order 01206 // Special case the first item 01207 if (SortArray[0]->GetPrevious() != NULL) 01208 { 01209 SortArray[1]->MoveBefore(SortArray[0]); 01210 GroupHasChanged = TRUE; 01211 } 01212 01213 // Then whip through the rest of the items 01214 for (i = 1; i < NumItems; i++) 01215 { 01216 if (SortArray[i]->GetPrevious() != SortArray[i-1]) 01217 { 01218 SortArray[i-1]->MoveAfter(SortArray[i]); 01219 GroupHasChanged = TRUE; 01220 } 01221 } 01222 01223 // Free our temporary workspace 01224 CCFree(SortArray); 01225 01226 // Tell the derived gallery that the items in this group have been moved about 01227 if (GroupHasChanged) 01228 AllItemsCopied((SGDisplayGroup *)CurrentGroup); 01229 01230 NumItemsToSort += NumItems; 01231 if (!ContinueSlowJob(NumItemsToSort)) 01232 break; // Update percentage complete for the number of items processed, and quit if aborted 01233 } 01234 } 01235 01236 // And go on to the next group 01237 CurrentGroup = CurrentGroup->GetNext(); 01238 } 01239 01240 CurrentSortGallery = NULL; 01241 01242 EndSlowJob(); 01243 01244 InvalidateCachedFormat(); 01245 ReformatAndRedrawIfNecessary(); 01246 }
|
|
|
To determine if the gallery is currently redrawing. This is necessary for two reasons: (1) To ensure we don't go re-entrant in redraw code (because we can't have more than one active render region or it'll go bang), (2) To allow things like the SGDisplayRootScroll to take special action when they try to chnage the scroll position if we are in a redraw (obviously at this point, doing a ScrollWindow and force redraws would be silly, if not downright dangerous).
Definition at line 694 of file sgallery.h. 00695 { 00696 return(AmRedrawing); 00697 }
|
|
|
If the given point is near the top or bottom of the window, this will cause the supergallery to auto-scroll the window up/down. Intended to allow drags to autoscroll as necessary.
Definition at line 3257 of file sgallery.cpp. 03258 { 03259 if (DisplayTree == NULL || !IsVisible()) 03260 return; 03261 03262 const INT32 AutoScrollDist = 28000/2; // MILLIPOINT distance for autoscroll activation 03263 03264 // Get our kernel-rendered-dlg info 03265 ReDrawInfoType DlgRedrawInfo; 03266 GetKernelRenderedGadgetInfo(GetListGadgetID(), &DlgRedrawInfo); 03267 03268 // Find distance from top (or bottom) of the window, and determine a 03269 // scroll speed/direction factor to use below 03270 INT32 Dist = DlgRedrawInfo.dy - MousePosition->y; 03271 INT32 ScrollSpeed = -3; 03272 if (Dist < 0 || Dist > AutoScrollDist) 03273 { 03274 Dist = MousePosition->y - 0; 03275 ScrollSpeed = +3; 03276 } 03277 03278 if (Dist > 0 && Dist < AutoScrollDist) 03279 { 03280 // We're within AutoScrollDist of the top/bottom - let's scroll 03281 Dist = (AutoScrollDist - Dist) * ScrollSpeed; 03282 03283 SGMiscInfo MiscInfo; 03284 FillInMiscInfo(&MiscInfo, &DlgRedrawInfo); 03285 03286 DisplayTree->SetScrollOffset(DisplayTree->GetScrollOffset() + Dist, &MiscInfo); 03287 } 03288 }
|
|
||||||||||||||||
|
Passes the given event through the DisplayTree.
Definition at line 344 of file sgallery.cpp. 00346 { 00347 if (DisplayTree == NULL) 00348 return; 00349 00350 SGMiscInfo TheMiscInfo; 00351 00352 if (MiscInfo == NULL && IsVisible()) 00353 { 00354 FillInMiscInfo(&TheMiscInfo); 00355 MiscInfo = &TheMiscInfo; 00356 } 00357 00358 ERROR3IF(MiscInfo == NULL && (EventType != SGEVENT_THUMBMSG && EventType != SGEVENT_BGFLUSH), 00359 "Attempt to broadcast an event when the gallery is closed could be dangerous. Tell Jason"); 00360 00361 DisplayTree->HandleEvent(EventType, EventInfo, MiscInfo); 00362 }
|
|
||||||||||||
|
To build a menu of commands to be popped up over the gallery.
Reimplemented in NameGallery, BitmapSGallery, ColourSGallery, FrameSGallery, LayerSGallery, LibClipartSGallery, LibFillsSGallery, LineGallery, NameGallery, and FontsSGallery. Definition at line 2731 of file sgallery.cpp. 02732 { 02733 return(FALSE); 02734 }
|
|
||||||||||||||||
|
Shared internal code to determine the virtual coordinate space of the region of the display list which is visible n screen.
Definition at line 1344 of file sgallery.cpp. 01346 { 01347 ERROR3IF(DlgRedrawInfo == NULL || VirtualSize == NULL || PixelSize == NULL, 01348 "SuperGallery::CalcVirtualSize - NULL parameters are illegal"); 01349 01350 // Calculate the size of a screen display pixel in terms of virtual space coords 01351 *PixelSize = 72000 / DlgRedrawInfo->Dpi; 01352 01353 // Create our viewport. We specify 0,0 at the top left corner of the window, with 01354 // x increasing to the right, and y increasing upwards. This, all y coordinates 01355 // within the redrawn area are actually negative. 01356 // Coordinates are in millipoints, and no scaling is desired (i.e. if we say 20pt, 01357 // we mean 20pt on screen). 01358 *VirtualSize = DocRect(0, -DlgRedrawInfo->dy, DlgRedrawInfo->dx, 0); 01359 01360 // Now, shift the coordinate space down to the correct scroll offset position, so 01361 // we map the correct part of the window extent into the visible portion of the window 01362 if (DisplayTree != NULL) 01363 VirtualSize->Translate(0, -DisplayTree->GetScrollOffset()); 01364 }
|
|
|
Used to determine if this type of gallery supports keyword searching. By default galleries do not. Override and return TRUE if you do.
Reimplemented in LibraryGallery, LibClipartSGallery, LibFillsSGallery, and FontsSGallery. Definition at line 3306 of file sgallery.cpp. 03307 { 03308 return(FALSE); 03309 }
|
|
|
Checks and closes the various dialogs which can be owned by galleries.
Definition at line 805 of file sgallery.cpp. 00806 { 00807 if (CurrentOptionsDlg != NULL) 00808 { 00809 CurrentOptionsDlg->Close(); 00810 CurrentOptionsDlg->End(); 00811 } 00812 00813 if (CurrentSortDlg != NULL) 00814 { 00815 CurrentSortDlg->Close(); 00816 CurrentSortDlg->End(); 00817 } 00818 00819 if (CurrentSearchDlg != NULL) 00820 { 00821 CurrentSearchDlg->Close(); 00822 CurrentSearchDlg->End(); 00823 } 00824 00825 PORTNOTE("dialogs", "Removed CurrentLinePropertiesDlg from SuperGallery::CloseOwnedDialogs(void)") 00826 #ifndef EXCLUDE_FROM_XARALX 00827 if (CurrentLinePropertiesDlg != NULL) 00828 { 00829 CurrentLinePropertiesDlg->Close(); 00830 CurrentLinePropertiesDlg->End(); 00831 } 00832 #endif 00833 }
|
|