#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 }
|
|
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.
Definition at line 1457 of file sgallery.cpp. 01458 { 01459 ERROR3IF(SourceAndResult == NULL || MiscInfo == NULL, 01460 "SuperGallery::ConvertToVirtualCoords - NULL parameters are illegal"); 01461 01462 INT32 ScrollOffset = 0; 01463 if (DisplayTree != NULL) 01464 ScrollOffset = DisplayTree->GetScrollOffset(); 01465 01466 // x has a 1:1 mapping into our virtual space, so we don't touch it 01467 SourceAndResult->lo.y = (SourceAndResult->lo.y + MiscInfo->WindowHeight) + ScrollOffset; 01468 SourceAndResult->hi.y = (SourceAndResult->hi.y + MiscInfo->WindowHeight) + ScrollOffset; 01469 01470 // And determine if the y extent of the coords lie within the 0..WindowHeight range 01471 return(SourceAndResult->hi.y >= 0 && SourceAndResult->lo.y <= MiscInfo->WindowHeight); 01472 }
|
|
Converts a standard DocCoord, as passed in for kernel-rendered dialogues, into a standard Display-list virtual coordinate, as used by Display items.
Definition at line 1419 of file sgallery.cpp. 01421 { 01422 ERROR3IF(SourceAndResult == NULL || MiscInfo == NULL, 01423 "SuperGallery::ConvertToVirtualCoords - NULL parameters are illegal"); 01424 01425 INT32 ScrollOffset = 0; 01426 if (DisplayTree != NULL) 01427 ScrollOffset = DisplayTree->GetScrollOffset(); 01428 01429 // x has a 1:1 mapping into our virtual space, so we don't touch it 01430 SourceAndResult->y = (SourceAndResult->y - MiscInfo->WindowHeight) - ScrollOffset; 01431 }
|
|
Converts a standard DocCoord, as passed in for kernel-rendered dialogues, into a standard Display-list virtual coordinate, as used by Display items.
Definition at line 1385 of file sgallery.cpp. 01387 { 01388 ERROR3IF(SourceAndResult == NULL || DlgRedrawInfo == NULL, 01389 "SuperGallery::ConvertToVirtualCoords - NULL parameters are illegal"); 01390 01391 INT32 ScrollOffset = 0; 01392 if (DisplayTree != NULL) 01393 ScrollOffset = DisplayTree->GetScrollOffset(); 01394 01395 // x has a 1:1 mapping into our virtual space, so we don't touch it 01396 SourceAndResult->y = (SourceAndResult->y - DlgRedrawInfo->dy) - ScrollOffset; 01397 }
|
|
"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)
Find the real item (Thingy) to be moved/copied Thingy *ThingyToCopy = ((SGDisplayThingy *)SourceItem)->GetDisplayedThingy(); if (we really want to copy the items, rather than just move them) { Just copy the items... First, copy the real-item associated with the display item ThingyType *NewThingy = new ThingyType(ThingyToCopy); Add the copied item to your 'real item' list or whatever. DocThingyList = DestGroup->GetParentDocument()->FindThingyList(); if (TargetPosition == NULL) DocThingyList->AddTail(NewThingy); else { Thingy *TargetPos = ((SGDisplayThingy *)TargetPosition)->GetDisplayedThingy(); if (TargetPos == NULL) DocThingyList->AddTail(NewThingy); else DocThingyList->InsertBefore(TargetPos, NewThingy); } Now, create a new display item for the copied Thingy, and call the base class helper method to insert it as appropriate. SGDisplayThingy *NewThingyDisplayItem = new SGDisplayThingy(NewThingy); if (NewThingyDisplayItem != NULL) SuperGallery::InsertCopiedItem(NewThingyDisplayItem, DestGroup, TargetPosition); return(NewThingyDisplayItem); } else { Just move the items This code will be much the same as the above, but instead of copying the real-item, you will have to move it as appropriate. Instead of making a new DisplayItem to pass on to InsertCopiedItem, simply delink it from the DisplayTree, and then pass it to InsertCopiedItem as follows: SourceItem->RemoveFromTree(); // Delink from current displaytree position SuperGallery::InsertCopiedItem(SourceItem, DestGroup, TargetPosition); return(SourceItem); } Reimplemented in BitmapSGallery, ColourSGallery, LayerSGallery, LibraryGallery, LibClipartSGallery, LibFillsSGallery, and FontsSGallery. Definition at line 3084 of file sgallery.cpp. 03086 { 03087 ERROR3IF(SourceItem == NULL || DestGroup == NULL, "Illegal NULL param"); 03088 03089 ERROR3("Unimplemented code - SuperGallery::CopyDisplayItem must be overridden!"); 03090 03091 /**** Example psuedocode **** 03092 03093 // Find the real item (Thingy) to be moved/copied 03094 Thingy *ThingyToCopy = ((SGDisplayThingy *)SourceItem)->GetDisplayedThingy(); 03095 03096 if (we really want to copy the items, rather than just move them) 03097 { 03098 // Just copy the items... 03099 03100 // First, copy the real-item associated with the display item 03101 ThingyType *NewThingy = new ThingyType(ThingyToCopy); 03102 03103 // Add the copied item to your 'real item' list or whatever. 03104 DocThingyList = DestGroup->GetParentDocument()->FindThingyList(); 03105 03106 if (TargetPosition == NULL) 03107 DocThingyList->AddTail(NewThingy); 03108 else 03109 { 03110 Thingy *TargetPos = ((SGDisplayThingy *)TargetPosition)->GetDisplayedThingy(); 03111 if (TargetPos == NULL) 03112 DocThingyList->AddTail(NewThingy); 03113 else 03114 DocThingyList->InsertBefore(TargetPos, NewThingy); 03115 } 03116 03117 // Now, create a new display item for the copied Thingy, and call the 03118 // base class helper method to insert it as appropriate. 03119 SGDisplayThingy *NewThingyDisplayItem = new SGDisplayThingy(NewThingy); 03120 if (NewThingyDisplayItem != NULL) 03121 SuperGallery::InsertCopiedItem(NewThingyDisplayItem, DestGroup, TargetPosition); 03122 03123 return(NewThingyDisplayItem); 03124 } 03125 else 03126 { 03127 // Just move the items 03128 03129 // This code will be much the same as the above, but instead of copying the 03130 // real-item, you will have to move it as appropriate. Instead of making 03131 // a new DisplayItem to pass on to InsertCopiedItem, simply delink it from the 03132 // DisplayTree, and then pass it to InsertCopiedItem as follows: 03133 03134 SourceItem->RemoveFromTree(); // Delink from current displaytree position 03135 SuperGallery::InsertCopiedItem(SourceItem, DestGroup, TargetPosition); 03136 03137 return(SourceItem); 03138 } 03139 03140 ****/ 03141 03142 return(NULL); 03143 }
|
|
The SuperGallery Create method This method has been overridden to de-specialize the DialogOp.
This finally calls SelectionHasChanged() to ensure the buttons etc are updated appropriately to the selection state. Reimplemented from DialogOp. Definition at line 713 of file sgallery.cpp. 00714 { 00715 if (!DialogOp::Create()) 00716 return(FALSE); 00717 00718 // Call derived class PreCreate handler (to create display tree, usually) 00719 if (!PreCreate()) 00720 return(FALSE); 00721 00722 // Call the derived class Menu creation handler, to create any needed menu items 00723 if (!InitMenuCommands()) 00724 return(FALSE); 00725 00726 // Ensure any items pending background-redraws are 'flushed' 00727 FlushBackgroundRedraws(); 00728 00729 #ifndef EXCLUDE_FROM_XARALX 00730 PORTNOTE("galleries", "Removed docking stuff") 00731 // Bar initialisation and creation 00732 SetDockBarType(Dock); 00733 SetSlot(Slot); 00734 SetOffset(Offset); 00735 SetFloatingCPoint(FloatPos); 00736 #endif 00737 00738 // if (!DialogOp::Create()) 00739 // return(FALSE); 00740 00741 AmShaded = FALSE; 00742 00743 // Call derived class PostCreate handler 00744 if (!PostCreate()) 00745 return(FALSE); 00746 00747 SelectionHasChanged(); // Ensure we update appropriately for the selection state 00748 00749 return(TRUE); 00750 }
|
|
An overridable veneer to the DialogOp CreateOSRenderRegion method. This can be overriden to use a different type of renderregion for all of your rendering.
Reimplemented in BitmapSGallery, ColourSGallery, and LineGallery. Definition at line 1494 of file sgallery.cpp. 01495 { 01496 return(CreateOSRenderRegion(VirtualSize, DlgRedrawInfo)); 01497 }
|
|
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.
Definition at line 3362 of file sgallery.cpp. 03363 { 03364 PendingRedraws--; // Decrement count of pending redraws 03365 03366 if (PendingRedraws < 1) 03367 { 03368 PendingRedraws = 0; // Just to be on the safe side! 03369 03370 // Remove any idle event processor we had registered 03371 GetApplication()->RemoveIdleProcessor(MyIdlePriority, this); 03372 } 03373 }
|
|
An overridable veneer to the DialogOp DestroyOSRenderRegion method. This can be overriden to use a different type of renderregion for all of your rendering.
Reimplemented in BitmapSGallery, ColourSGallery, and LineGallery. Definition at line 1518 of file sgallery.cpp. 01519 { 01520 DestroyOSRenderRegion(pRender); 01521 }
|
|
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.
Definition at line 3498 of file sgallery.cpp. 03499 { 03500 SGDisplayNode *Ptr = DisplayTree->GetChild(); 03501 if (Ptr == NULL) // No groups 03502 return TRUE; 03503 03504 // Count groups in gallery (for progress bar) 03505 if(ProgressBarMsg != NULL) 03506 { 03507 INT32 NumGroups = 0; 03508 SGDisplayNode *Ptr2 = Ptr; 03509 while (Ptr2 != NULL) 03510 { 03511 NumGroups++; 03512 Ptr2 = Ptr2->GetNext(); 03513 } 03514 String_64 SmallStr; 03515 ProgressBarMsg->Left(&SmallStr, 64); 03516 BeginSlowJob(NumGroups, FALSE, &SmallStr); 03517 } 03518 03519 // Whizz through groups, devirtualising each one which needs it... 03520 03521 BOOL ProblemsDeVirtualising = FALSE; 03522 INT32 Count = 0; 03523 03524 // For library galleries we need to set the Quiet button status ready to un-supress errors 03525 SetQuietStatus(FALSE); 03526 03527 while (Ptr != NULL) 03528 { 03529 if(((SGDisplayGroup *)Ptr)->IsVirtualised()) 03530 { 03531 if (!((SGDisplayGroup *)Ptr)->DeVirtualise()) 03532 ProblemsDeVirtualising = TRUE; 03533 } 03534 03535 if(ProgressBarMsg != NULL) 03536 ContinueSlowJob(++Count); 03537 03538 Ptr = Ptr->GetNext(); 03539 } 03540 03541 if(ProgressBarMsg != NULL) 03542 EndSlowJob(); 03543 03544 return !ProblemsDeVirtualising; 03545 }
|
|
To apply a given command when it is chosen from the menu.
Default handling is provided for the following commands. These commands need only be added to your menu in BuildCommandMenu in order to become available. Override the default behaviour if it is unsuitable. MonoOn Properties* Shows properties (options) dialogue Sort* Shows Sort dialogue Find* Shows find dialogue New Calls ApplyAction(SGACTION_CREATE) Apply Calls ApplyAction(SGACTION_APPLY) Edit Calls ApplyAction(SGACTION_EDIT) Delete Calls ApplyAction(SGACTION_DELETE) Redefine Calls ApplyAction(SGACTION_REDEFINE) NextGroup Scrolls to show next group PrevGroup Scrolls to show previous group FoldGroup Forces the selected group folded UnfoldGroup Forces the seletced group unfolded MonoOff These items should always be provided if you provide an options menu. They should be shaded when unavailable. Reimplemented in NameGallery, BitmapSGallery, ColourSGallery, FrameSGallery, LayerSGallery, LibClipartSGallery, LibFillsSGallery, LineGallery, NameGallery, and FontsSGallery. Definition at line 2879 of file sgallery.cpp. 02880 { 02881 if (*CommandID == SGCmd_Properties) // --- Properties 02882 SGalleryOptionsDlg::InvokeDialog(this); 02883 else if (*CommandID == SGCmd_Sort) // -- Sort 02884 SGallerySortDlg::InvokeDialog(this); 02885 else if (*CommandID == SGCmd_Find) // --- Search 02886 SGallerySearchDlg::InvokeDialog(this); 02887 else if (*CommandID == SGCmd_New) // --- New (default) 02888 ApplyAction(SGACTION_CREATE); 02889 else 02890 { 02891 // All remaining commands require a selected group, so abort if no group 02892 SGDisplayGroup *ThisGroup = FindCommandGroup(); 02893 if (ThisGroup == NULL) // No group to apply command to - abort 02894 return; 02895 02896 if (*CommandID == SGCmd_Apply) // --- Apply (default) 02897 ApplyAction(SGACTION_APPLY); 02898 else if (*CommandID == SGCmd_Edit) // --- Edit (default) 02899 ApplyAction(SGACTION_EDIT); 02900 else if (*CommandID == SGCmd_Delete) // --- Delete (default) 02901 ApplyAction(SGACTION_DELETE); 02902 else if (*CommandID == SGCmd_Redefine) // --- Redefine (default) 02903 ApplyAction(SGACTION_REDEFINE); 02904 else if (*CommandID == SGCmd_NextGroup) // --- Next Group 02905 { 02906 ThisGroup = (SGDisplayGroup *) ThisGroup->GetNext(); 02907 if (ThisGroup == NULL) // No next group 02908 return; 02909 02910 // Select the group we are scrolling to 02911 SelectItems(FALSE); 02912 SelectGroups(FALSE); 02913 ThisGroup->SetSelected(); 02914 SelectionHasChanged(); 02915 02916 // And scroll (if necessary) to make that group visible on screen 02917 DocRect ScrollToRect; 02918 ThisGroup->GetFormatRect(&ScrollToRect); 02919 ScrollToShow(&ScrollToRect); 02920 } 02921 else if (*CommandID == SGCmd_PrevGroup) // --- Previous Group 02922 { 02923 ThisGroup = (SGDisplayGroup *) ThisGroup->GetPrevious(); 02924 if (ThisGroup == NULL) // No prev group 02925 return; 02926 02927 // Select the group we are scrolling to 02928 SelectItems(FALSE); 02929 SelectGroups(FALSE); 02930 ThisGroup->SetSelected(); 02931 SelectionHasChanged(); 02932 02933 // And scroll (if necessary) to make that group visible on screen 02934 DocRect ScrollToRect; 02935 ThisGroup->GetFormatRect(&ScrollToRect); 02936 ScrollToShow(&ScrollToRect); 02937 } 02938 else if (*CommandID == SGCmd_FoldGroup) // --- Fold Group 02939 { 02940 ForceGroupFolded(ThisGroup, TRUE); 02941 02942 // And make sure that we scroll back to the start of the group - we may have 02943 // just shot off the bottom of the list now that it is several miles shorter! 02944 // Also, we select the group, so we don't leave a selected item inside a folded group 02945 SelectItems(FALSE); 02946 SelectGroups(FALSE); 02947 ThisGroup->SetSelected(); 02948 SelectionHasChanged(); 02949 02950 DocRect ScrollToRect; 02951 ThisGroup->GetFormatRect(&ScrollToRect); 02952 ScrollToShow(&ScrollToRect); 02953 } 02954 else if (*CommandID == SGCmd_UnfoldGroup) // --- Unfold Group 02955 ForceGroupFolded(ThisGroup, FALSE); 02956 else 02957 { 02958 ERROR3("SuperGallery::DoCommand - base class called for unknown command"); 02959 } 02960 } 02961 }
|
|
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.
Reimplemented in BitmapSGallery, ColourSGallery, FrameSGallery, LayerSGallery, LibraryGallery, LibClipartSGallery, LibFillsSGallery, and FontsSGallery. Definition at line 954 of file sgallery.cpp.
|
|
Sets up a MiscInfo structure, ready for use.
Definition at line 304 of file sgallery.cpp. 00305 { 00306 // If the RedrawInfo was not passed in for us, go and get it for ourselves 00307 ReDrawInfoType TempDlgRedrawInfo; 00308 if (DlgRedrawInfo == NULL) 00309 { 00310 DlgRedrawInfo = &TempDlgRedrawInfo; 00311 GetKernelRenderedGadgetInfo(GetListGadgetID(), DlgRedrawInfo); 00312 } 00313 00314 // Fill in the MiscInfo 00315 MiscInfo->DisplayMode = DisplayMode; 00316 MiscInfo->PixelSize = 72000 / DlgRedrawInfo->Dpi; 00317 MiscInfo->MaxWidth = DlgRedrawInfo->dx; // Window/virtualsize width 00318 MiscInfo->WindowHeight = DlgRedrawInfo->dy; // Window height 00319 }
|
|
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.
Definition at line 2980 of file sgallery.cpp. 02981 { 02982 SGDisplayGroup *ThisGroup = DisplayTree->FindNextSelectedGroup(); 02983 02984 if (ThisGroup == NULL) 02985 { 02986 SGDisplayNode *Item = DisplayTree->FindNextSelectedItem(); 02987 if (Item == NULL) // No selected group or item - abort 02988 return(NULL); 02989 02990 ThisGroup = (SGDisplayGroup *) Item->GetParent(); 02991 } 02992 02993 return(ThisGroup); 02994 }
|
|
To allow outside entities to determine which display node lies under the (current mouse pointer) position.
Ensures that the formatting is cached with ReformatNow(FALSE) Definition at line 3207 of file sgallery.cpp. 03208 { 03209 ERROR3IF(ThePoint == NULL, "Illegal NULL param"); 03210 03211 ReformatNow(FALSE); // Ensure the formatting is cached 03212 03213 // Get our kernel-rendered-dlg info 03214 ReDrawInfoType DlgRedrawInfo; 03215 GetKernelRenderedGadgetInfo(GetListGadgetID(), &DlgRedrawInfo); 03216 03217 // Fill in appropriate information 03218 SGClaimPointInfo PointInfo; 03219 PointInfo.Claimant = NULL; 03220 PointInfo.ClosestSoFar = 1024*1024; // Don't bother detecting clicks 03221 // beyond approx 15inches away from items 03222 03223 // Convert the point into gallery display-list coordinates 03224 PointInfo.Position = *ThePoint; 03225 ConvertToVirtualCoords(&DlgRedrawInfo, &PointInfo.Position); 03226 03227 // Ask the tree to hit-test the point 03228 BroadcastEvent(SGEVENT_CLAIMPOINT, &PointInfo); 03229 03230 // And return the node (if any) which claimed to 'own' the point 03231 return(PointInfo.Claimant); 03232 }
|
|
Looks for a given SuperGallery by using its name.
Definition at line 3608 of file sgallery.cpp. 03609 { 03610 List* pList = MessageHandler::GetClassList(CC_RUNTIME_CLASS(DialogOp)); 03611 SuperGallery* pSuperGallery = (SuperGallery*)pList->GetHead(); 03612 03613 while (pSuperGallery != NULL) 03614 { 03615 if (pSuperGallery->IsKindOf(CC_RUNTIME_CLASS(SuperGallery))) 03616 { 03617 if (pSuperGallery->DlgResID == SuperGalleryID) 03618 return (pSuperGallery); 03619 } 03620 03621 pSuperGallery = (SuperGallery*)pList->GetNext(pSuperGallery); 03622 } 03623 03624 return NULL; 03625 }
|
|
Looks for a given SuperGallery by using its name.
Definition at line 3566 of file sgallery.cpp. 03567 { 03568 List* pList = MessageHandler::GetClassList(CC_RUNTIME_CLASS(DialogOp)); 03569 SuperGallery* pSuperGallery = (SuperGallery*)pList->GetHead(); 03570 03571 String_32 OpName; 03572 while (pSuperGallery != NULL) 03573 { 03574 if (pSuperGallery->IsKindOf(CC_RUNTIME_CLASS(SuperGallery))) 03575 { 03576 if (limit > 0) 03577 pSuperGallery->Name.Left(&OpName, limit); 03578 else 03579 OpName = pSuperGallery->Name; 03580 03581 if (OpName == SuperGalleryName) 03582 return (pSuperGallery); 03583 } 03584 03585 pSuperGallery = (SuperGallery*)pList->GetNext(pSuperGallery); 03586 } 03587 03588 return NULL; 03589 }
|
|
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.
Definition at line 3440 of file sgallery.cpp. 03441 { 03442 BroadcastEvent(SGEVENT_BGFLUSH, NULL); 03443 03444 ERROR3IF(PendingRedraws != 0, "Warning: PendingRedraws was non-zero after a flush"); 03445 03446 PendingRedraws = 0; 03447 LastBGNode = NULL; 03448 03449 GetApplication()->RemoveIdleProcessor(MyIdlePriority, this); 03450 }
|
|
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.
Definition at line 1702 of file sgallery.cpp. 01703 { 01704 ERROR3IF(GroupToFold == NULL, "SuperGallery::ForceGroupFolded- NULL parameter is illegal"); 01705 01706 // Ensure the group is in the requested state, and reformat/redraw if necessary 01707 GroupToFold->SetFoldedState(FoldedState); 01708 }
|
|
Redraws the given region of the list. The area specified is a MILLIPOINT offset within the SuperGallery Virtual Coordinate Space.
Definition at line 1933 of file sgallery.cpp. 01934 { 01935 if (DisplayTree == NULL) 01936 return; 01937 01938 if (IsVisible()) 01939 { 01940 // Get the dialogue info (dx, dy, and dpi values for the list box gadget) 01941 ReDrawInfoType DlgRedrawInfo; 01942 GetKernelRenderedGadgetInfo(GetListGadgetID(), &DlgRedrawInfo); 01943 01944 DocRect RealArea(*Area); 01945 INT32 ScrollOffset = DisplayTree->GetScrollOffset(); 01946 01947 // Convert the area into kernel-dialogue coords 01948 RealArea.lo.y = DlgRedrawInfo.dy + (RealArea.lo.y + ScrollOffset); 01949 RealArea.hi.y = DlgRedrawInfo.dy + (RealArea.hi.y + ScrollOffset); 01950 01951 // Clip values within the visible screen area. This is important because 01952 // the stupid winoil routines don't do this, and some cheap OSes (Win95/Win32s) 01953 // get upset at being passed huge numbers. 01954 if (RealArea.lo.y < 0) 01955 RealArea.lo.y = 0; 01956 01957 if (RealArea.hi.y > DlgRedrawInfo.dy) 01958 RealArea.hi.y = DlgRedrawInfo.dy; 01959 01960 // If this translates to a visible area of the window, force a redraw of it 01961 if (RealArea.hi.y > 0 && RealArea.lo.y < DlgRedrawInfo.dy) 01962 InvalidateGadget(GetListGadgetID(), &DlgRedrawInfo, &RealArea); 01963 } 01964 }
|
|
Reformats, and then redraws the entire displayed list.
Definition at line 1905 of file sgallery.cpp. 01906 { 01907 InvalidateCachedFormat(); // Force the formatting info to be re-cached 01908 01909 if (IsVisible()) 01910 InvalidateGadget(GetListGadgetID()); 01911 }
|
|
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).
Default handling is provided for the following commands. These commands need only be added to your menu in BuildCommandMenu in order to become available. Override the default behaviour if it is unsuitable: MonoOn Properties } Sort } - Always available Find } New Always available Apply Available if one item selected Edit Available if one item selected Delete Available if one or more items salected Redefine Available if one item selected NextGroup Available if there is a next group PrevGroup Available if there is a previous group FoldGroup Always available if there is a selected group UnfoldGroup Always available if there is a selected group MonoOff Reimplemented in NameGallery, BitmapSGallery, ColourSGallery, FrameSGallery, LayerSGallery, LibClipartSGallery, LibFillsSGallery, LineGallery, NameGallery, and FontsSGallery. Definition at line 2779 of file sgallery.cpp. 02780 { 02781 OpState State; 02782 02783 // Find/Sort/Properties are pretty much always available 02784 if (*CommandID == SGCmd_Sort || *CommandID == SGCmd_Find || 02785 *CommandID == SGCmd_Properties || *CommandID == SGCmd_New) 02786 return(State); 02787 02788 // Find the selected group for this command to act on 02789 SGDisplayGroup *ThisGroup = FindCommandGroup(); 02790 02791 if (ThisGroup == NULL) // --- No group to apply command to - abort 02792 { 02793 State.Greyed = TRUE; 02794 ShadeReason->MakeMsg(_R(IDS_SGSHADE_NOSEL)); 02795 } 02796 else if (*CommandID == SGCmd_Apply || // --- Apply, Edit, Redefine, Rename 02797 *CommandID == SGCmd_Edit || 02798 *CommandID == SGCmd_Redefine || // (These options are given default behaviour) 02799 *CommandID == SGCmd_Rename) 02800 { 02801 if (GetSelectedItemCount() != 1) 02802 { 02803 State.Greyed = TRUE; 02804 ShadeReason->MakeMsg(_R(IDS_SGSHADE_SINGLE)); 02805 } 02806 } 02807 else if (*CommandID == SGCmd_Delete) // --- Delete (applies only to selected *items*) 02808 { 02809 if (GetSelectedItemCount() < 1) 02810 { 02811 State.Greyed = TRUE; 02812 ShadeReason->MakeMsg(_R(IDS_SGSHADE_NOSEL)); 02813 } 02814 } 02815 else if (*CommandID == SGCmd_NextGroup) // --- Next Group 02816 { 02817 ThisGroup = (SGDisplayGroup *) ThisGroup->GetNext(); 02818 if (ThisGroup == NULL) // No next group 02819 { 02820 State.Greyed = TRUE; 02821 ShadeReason->MakeMsg(_R(IDS_SGSHADE_LASTGROUP)); 02822 } 02823 } 02824 else if (*CommandID == SGCmd_PrevGroup) // --- Previous Group 02825 { 02826 ThisGroup = (SGDisplayGroup *) ThisGroup->GetPrevious(); 02827 if (ThisGroup == NULL) // No next group 02828 { 02829 State.Greyed = TRUE; 02830 ShadeReason->MakeMsg(_R(IDS_SGSHADE_FIRSTGROUP)); 02831 } 02832 } 02833 02834 return(State); 02835 }
|
|
Definition at line 526 of file sgallery.h. 00526 { return(SortKeys); }
|
|
To determine the length of the displayed list, in MILLIPOINTS; actually, in terms of the mimimum displayed Y coordinate, which is really -(Length).
Definition at line 1665 of file sgallery.cpp. 01666 { 01667 if (DisplayTree == NULL || !IsVisible()) 01668 return(0); 01669 01670 SGMiscInfo MiscInfo; 01671 FillInMiscInfo(&MiscInfo); 01672 01673 SGFormatInfo FormatInfo; 01674 DisplayTree->InitFormatInfo(&FormatInfo, &MiscInfo); 01675 01676 return(DisplayTree->CalculateListExtent(&FormatInfo, &MiscInfo)); 01677 }
|
|
Reimplemented in LibraryGallery. Definition at line 375 of file sgallery.h. 00375 { return DisplayMode; }
|
|
Definition at line 378 of file sgallery.h. 00378 { return DisplayTree; }
|
|
Definition at line 268 of file sgallery.h. 00269 { return GallerySize; };
|
|
Definition at line 648 of file sgallery.h. 00648 { return Name; }
|
|
Definition at line 590 of file sgallery.h. 00591 { return(LastBGNode); };
|
|
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.
Definition at line 2405 of file sgallery.cpp. 02406 { 02407 return(LastSelectedNode); 02408 }
|
|
To allow outside entities to determine the list box gadget ID. Meant only for gallery drags to determine their target area.
Definition at line 2569 of file sgallery.cpp. 02570 { 02571 return(_R(IDC_GALLERY_LISTBOX)); 02572 }
|
|
Get the Quiet status of the gallery - used when a load of indexes are being added to the gallery and there are problems...
Reimplemented in LibraryGallery, LibClipartSGallery, LibFillsSGallery, and FontsSGallery. Definition at line 1261 of file sgallery.cpp. 01262 { 01263 return FALSE; 01264 }
|
|
Counts the number of selected groups in the display tree.
Definition at line 2301 of file sgallery.cpp. 02302 { 02303 if (DisplayTree == NULL) 02304 return(0); 02305 02306 return(DisplayTree->GetSelectedGroupCount()); 02307 }
|
|
Counts the number of selected items in the display tree or a subtree.
Otherwise, the document or library specified will be found (if possible) in the tree, and the return value will be the selection count within that subtree. If the desired {sub}tree does not exist, 0 is returned. Definition at line 2270 of file sgallery.cpp. 02271 { 02272 if (DisplayTree == NULL) 02273 return(0); 02274 02275 if (TheDocument != NULL || TheLibrary != NULL) 02276 { 02277 SGDisplayGroup *TheGroup = DisplayTree->FindSubtree(this, TheDocument, TheLibrary); 02278 02279 if (TheGroup == NULL) 02280 return(0); 02281 02282 return(TheGroup->GetSelectedItemCount()); 02283 } 02284 02285 return(DisplayTree->GetSelectedItemCount()); 02286 }
|
|
Gets status line help from the gallery.
Definition at line 3463 of file sgallery.cpp. 03464 { 03465 SGDisplayNode *TheNode = FindNodeUnderPointer(MousePos); 03466 if (TheNode != NULL) 03467 { 03468 // Convert MousePos into a display list coord and call the node 03469 DocCoord ListPos(*MousePos); 03470 ReDrawInfoType DlgRedrawInfo; 03471 GetKernelRenderedGadgetInfo(GetListGadgetID(), &DlgRedrawInfo); 03472 ConvertToVirtualCoords(&DlgRedrawInfo, &ListPos); 03473 03474 return(TheNode->GetStatusLineHelp(&ListPos, Result)); 03475 } 03476 03477 return(FALSE); 03478 }
|
|
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.
Reimplemented in BitmapSGallery, ColourSGallery, LibraryGallery, LibClipartSGallery, LibFillsSGallery, and FontsSGallery. Definition at line 983 of file sgallery.cpp. 00984 { 00985 // If this is a gallery list-reorganising drag which originated from this gallery, 00986 // then create a target for the gallery listbox. 00987 if (DragMsg->pInfo->IsKindOf(CC_RUNTIME_CLASS(SGListDragInfo)) && 00988 ((SGListDragInfo *)DragMsg->pInfo)->GetParentGallery() == this) 00989 { 00990 // Note this sort of auto-attaches it seems - AMB 00991 /*SGListDragTarget *NewTarget = */new SGListDragTarget(this, GetListGadgetID()); 00992 } 00993 }
|
|
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.
Definition at line 3329 of file sgallery.cpp. 03330 { 03331 if (PendingRedraws < 1) 03332 { 03333 PendingRedraws = 0; // Just to be on the safe side! 03334 03335 // Add an idle event processor to handle the bg redraws 03336 GetApplication()->RegisterIdleProcessor(MyIdlePriority, this); 03337 } 03338 03339 PendingRedraws++; // Increment count of pending redraws 03340 }
|
|
Internal method to initialise data mambers. Shared code for constructors.
Definition at line 183 of file sgallery.cpp. 00184 { 00185 GallerySize = wxSize(0,0); 00186 00187 DisplayTree = NULL; 00188 DisplayMode = 0; 00189 00190 FormatIsCached = FALSE; 00191 00192 LastWindowDX = LastWindowDY = 0; 00193 00194 AmShaded = FALSE; 00195 AmRedrawing = FALSE; 00196 00197 LastSelectedNode = NULL; 00198 00199 CurrentOptionsDlg = NULL; 00200 CurrentSortDlg = NULL; 00201 CurrentSearchDlg = NULL; 00202 CurrentLinePropertiesDlg = NULL; 00203 00204 DblClickPending = FALSE; // We aren't in the middle of a double click 00205 00206 PendingRedraws = 0; 00207 LastBGNode = NULL; 00208 00209 for (INT32 i = 0; i < MaxSGSortKeys; i++) 00210 { 00211 SortKeys[i].SortKey = 0; 00212 SortKeys[i].Reversed = FALSE; 00213 } 00214 }
|
|
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.
Definition at line 2652 of file sgallery.cpp. 02653 { 02654 String_256 OpToken = GetGalName(); 02655 // With the new GIF Animation frame gallery, this can mean that the OpToken can easily 02656 // overrun its String_32 allocation. Therefore, restrict the name to the first 16 characters. 02657 // Unfortunately, we then use the name to find the gallery to send the command to! 02658 // So we match that only using the GalleryBarNameLimitSize (16) characters 02659 String_256 OpTokenT = OpToken; 02660 OpToken.Left(&OpTokenT, GalleryBarNameLimitSize); 02661 02662 OpTokenT += TEXT(":"); 02663 OpTokenT += *CommandID; 02664 02665 return(OpGalleryCommand::InitPolymorphicCommand(&OpTokenT, MenuTextID)); 02666 }
|
|
Initialises any menu commands that this gallery needs.
Note: Should only create the menu commands once - further calls in the future should return TRUE immediately without trying to re-init the ops.
Reimplemented in NameGallery, BitmapSGallery, ColourSGallery, FrameSGallery, LayerSGallery, LibClipartSGallery, LibFillsSGallery, LineGallery, NameGallery, and FontsSGallery. Definition at line 2619 of file sgallery.cpp. 02620 { 02621 // The base class does nothing - no menu 02622 return(TRUE); 02623 }
|
|
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.
TargetPosition - NULL (to insert at the end of the sibling list), or points to the item BEFORE which the CopiedItem will be inserted. Notes: CopiedItem must NOT already be linked into the tree (ERROR3 if it is) This is used when dragging between groups, where typically items are copied rather than moved. The derived class CopyDisplayItem determines if a copy or move is necessary, and if the former, copies the item and creates a new DisplayItem, then calls this method to add the copied item to the display. Otherwise it will call MoveItem as appropriate
Definition at line 3030 of file sgallery.cpp. 03032 { 03033 ERROR3IF(CopiedItem == NULL || DestGroup == NULL, "Illegal NULL param"); 03034 if (CopiedItem == NULL || DestGroup == NULL) 03035 return; 03036 03037 if (TargetPosition != NULL) 03038 TargetPosition->InsertBefore(CopiedItem); 03039 else 03040 DestGroup->AddItem(CopiedItem); 03041 }
|
|
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.
Definition at line 668 of file sgallery.h. 00669 { 00670 FormatIsCached = FALSE; 00671 }
|
|
Reimplemented from DialogOp. Definition at line 642 of file sgallery.h. 00642 {return FALSE; } // We are not a bar
|
|
Reimplemented from DialogOp. Definition at line 643 of file sgallery.h. 00643 {return TRUE; } // We are a gallery
|
|
To check if we're a library gallery.
Reimplemented in LibraryGallery. Definition at line 1294 of file sgallery.cpp. 01295 { 01296 return FALSE; 01297 }
|
|
To check if we're a dedicated library gallery, or a half+half (like the font gallery).
Reimplemented in LibraryGallery, LibClipartSGallery, LibFillsSGallery, and FontsSGallery. Definition at line 1313 of file sgallery.cpp. 01314 { 01315 return FALSE; 01316 }
|
|
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.
Reimplemented from DialogOp. Reimplemented in NameGallery, TEMPLATESGallery, BitmapSGallery, ColourSGallery, FrameSGallery, LayerSGallery, LibraryGallery, LibClipartSGallery, LibFillsSGallery, LineGallery, NameGallery, and FontsSGallery. Definition at line 382 of file sgallery.cpp. 00383 { 00384 if (MESSAGE_IS_A(Message,DeathMsg)) // We must destroy the dialog if the application is dying 00385 { 00386 // Destroy the entire DisplayList (which should be empty by now), 00387 // just to be on the safe side, in case a derived gallery forgot to do it 00388 if (DisplayTree != NULL) 00389 { 00390 DisplayTree->DestroySubtree(); // Destroy the display tree, destructing all nodes 00391 delete DisplayTree; 00392 DisplayTree = NULL; 00393 } 00394 00395 // Ensure that all doc/view pointers for this Op are NULL to stop 00396 // 'FlushRedraw' access violations occurring. 00397 pOurDoc = NULL; 00398 pOurView = NULL; 00399 00400 End(); 00401 return(OK); 00402 } 00403 00404 00405 if ( Message->IsKindOf(CC_RUNTIME_CLASS(DialogMsg)) && 00406 ((DialogMsg*)Message)->DlgMsg == DIM_BAR_DEATH ) 00407 { 00408 DialogOp::Message(Message); 00409 return(OK); 00410 } 00411 00412 if (IS_OUR_DIALOG_MSG(Message)) 00413 { 00414 DialogMsg* Msg = (DialogMsg*)Message; 00415 00416 BOOL WasRightButton = FALSE; // What type of click was it (if any) 00417 // (allows code-sharing in the case statement) 00418 00419 switch (Msg->DlgMsg) 00420 { 00421 case DIM_CREATE: 00422 { 00423 String_32 name(CamResource::GetObjectName(DlgResID)); 00424 SetGalName(name); 00425 } 00426 break; 00427 00428 case DIM_CANCEL: // We're closing - close our owned dlgs 00429 CloseOwnedDialogs(); 00430 00431 // Ensure all items pending background redraws are flushed 00432 FlushBackgroundRedraws(); 00433 00434 // tell everyone the screen will be changing 00435 TRACEUSER( "Diccon", _T("Gallery closing\n")); 00436 BROADCAST_TO_ALL(ScreenChangeMsg()); 00437 break; 00438 00439 case DIM_MOUSEWHEEL_UP: 00440 { 00441 //MouseWheel Scrolled Upwards... 00442 TRACEUSER( "Matt", _T("SuperGallery::Message() Received MouseWheel UPWARDS Message!\n")); 00443 00444 ReDrawInfoType DlgRedrawInfo; 00445 GetKernelRenderedGadgetInfo(GetListGadgetID(), &DlgRedrawInfo); 00446 00447 // Make a SGMiscInfo with, well, MiscInfo in it... 00448 SGMiscInfo MiscInfo; 00449 FillInMiscInfo(&MiscInfo, &DlgRedrawInfo); 00450 00451 //Get the old scroll offset, adjust it accordingly and set it to be the current one... 00452 INT32 newScrollOffset = DisplayTree->GetScrollOffset() - (750 * 30); 00453 DisplayTree->SetScrollOffset(newScrollOffset, &MiscInfo); 00454 } 00455 break; 00456 00457 case DIM_MOUSEWHEEL_DOWN: 00458 { 00459 //MouseWheel Scrolled Downwards... 00460 TRACEUSER( "Matt", _T("SuperGallery::Message() Received MouseWheel DOWNWARDS Message!\n")); 00461 00462 ReDrawInfoType DlgRedrawInfo; 00463 GetKernelRenderedGadgetInfo(GetListGadgetID(), &DlgRedrawInfo); 00464 00465 // Make a SGMiscInfo with, well, MiscInfo in it... 00466 SGMiscInfo MiscInfo; 00467 FillInMiscInfo(&MiscInfo, &DlgRedrawInfo); 00468 00469 //Get the old scroll offset, adjust it accordingly and set it to be the current one... 00470 INT32 newScrollOffset = DisplayTree->GetScrollOffset() + (750 * 30); 00471 DisplayTree->SetScrollOffset(newScrollOffset, &MiscInfo); 00472 } 00473 break; 00474 00475 case DIM_RGT_BN_DOWN: 00476 WasRightButton = TRUE; 00477 // (Note: We treat a right click like a left click now. DIM_RGT_BN_UP is used 00478 // to pop up the menu when the button is released) 00479 00480 // Drop through to LFT_BN_DOWN handler... 00481 00482 case DIM_LFT_BN_DOWN: 00483 if ((Msg->GadgetID == GetListGadgetID()) && Msg->DlgMsgParam) 00484 { 00485 // Get our kernel-rendered-dlg info, and calculate our virtual coord space 00486 ReDrawInfoType *DlgRedrawInfo = (ReDrawInfoType*) Msg->DlgMsgParam; 00487 00488 // Determine where the mouse was clicked, within the virtual coord space 00489 SGMouseInfo ClickInfo; 00490 00491 // Was it a ctrl-click? (Adjust/right clicks now pop up the menu) 00492 ClickInfo.Adjust = KeyPress::IsGalleryCtrlPressed(); 00493 00494 // Was it a click to extend the selection? (shift-click) 00495 ClickInfo.Extend = KeyPress::IsGalleryShiftPressed(); 00496 00497 // Was it a pop-up-menu (right button) click? 00498 ClickInfo.MenuClick = WasRightButton; 00499 00500 // Is it the second installment in a double-click? 00501 ClickInfo.DoubleClick = FALSE; 00502 if (DblClickPending && !WasRightButton) 00503 { 00504 // Double-click Distance (millipoints). If the second click is more than this 00505 // distance away from the forst click point, it is not regarded as a dble click. 00506 const INT32 DblClickDist = 12000; // **** !!!! Read dbl-click-dist preference 00507 INT32 ClickDistX = ABS(LastClickPos.x - DlgRedrawInfo->pMousePos->x); 00508 INT32 ClickDistY = ABS(LastClickPos.y - DlgRedrawInfo->pMousePos->y); 00509 00510 if (ClickDistX <= DblClickDist && ClickDistY <= DblClickDist) 00511 { 00512 const INT32 DblClickTime = 400; // **** !!!! Read OS dbl-click time! 00513 00514 if (!LastClickTime.Elapsed(DblClickTime)) 00515 ClickInfo.DoubleClick= TRUE; 00516 } 00517 } 00518 LastClickPos = *(DlgRedrawInfo->pMousePos); // Remember last click position 00519 00520 if (ClickInfo.DoubleClick) 00521 DblClickPending = FALSE; // No longer pending double click 00522 else 00523 { 00524 DblClickPending = TRUE; // Double click is now pending 00525 LastClickTime.Sample(); // Start the "double-click timeout" timer 00526 } 00527 00528 ClickInfo.Position = *(DlgRedrawInfo->pMousePos); 00529 ConvertToVirtualCoords(DlgRedrawInfo, &ClickInfo.Position); 00530 00531 // And request that the tree decides what to do with the event 00532 BroadcastEvent(SGEVENT_MOUSECLICK, &ClickInfo); 00533 } 00534 break; 00535 00536 00537 case DIM_RGT_BN_UP: 00538 { 00539 // Give the gallery a chance to do something before popping up the context menu 00540 // At present, used by the bitmap gallery to ensure that the plug-ins have all 00541 // been parsed. 00542 PreContextMenu(); 00543 // Right button has been released - pop up a context-sensitive menu 00544 GalleryContextMenu *TheMenu = new GalleryContextMenu(SGMENU_OVERITEM, this); 00545 if (TheMenu != NULL) 00546 TheMenu->Show(); 00547 } 00548 break; 00549 00550 00551 case DIM_LFT_BN_CLICKED: 00552 { 00553 if (Msg->GadgetID == _R(IDC_GALLERY_NEW)) 00554 { 00555 ApplyAction(SGACTION_CREATE); 00556 } 00557 else if (Msg->GadgetID == _R(IDC_GALLERY_APPLY)) 00558 { 00559 // NB. changed to use Control key here, to be consistent with the 00560 // way Adjust works when clicking on items. 00561 if (KeyPress::IsGalleryCtrlPressed()) 00562 { 00563 // If the gallery doesn't respond to Adjust-click then try a plain 00564 // click instead. 00565 if (!ApplyAction(SGACTION_APPLYADJUST)) ApplyAction(SGACTION_APPLY); 00566 } 00567 else 00568 { 00569 ApplyAction(SGACTION_APPLY); 00570 } 00571 } 00572 else if (Msg->GadgetID == _R(IDC_GALLERY_REDEFINE)) 00573 { 00574 ApplyAction(SGACTION_REDEFINE); 00575 } 00576 else if (Msg->GadgetID == _R(IDC_GALLERY_EDIT)) 00577 { 00578 ApplyAction(SGACTION_EDIT); 00579 } 00580 else if (Msg->GadgetID == _R(IDC_GALLERY_DELETE)) 00581 { 00582 ApplyAction(SGACTION_DELETE); 00583 } 00584 else if (Msg->GadgetID == _R(IDC_GALLERY_MENU)) 00585 { 00586 // Pop up the options menu/dialogue 00587 // SGalleryOptionsDlg::InvokeDialog(this); 00588 GalleryContextMenu *TheMenu = new GalleryContextMenu(SGMENU_OPTIONS, this); 00589 if (TheMenu != NULL) 00590 TheMenu->Show(); 00591 } 00592 break; 00593 } 00594 case DIM_RGT_BN_CLICKED: 00595 if (Msg->GadgetID == _R(IDC_GALLERY_APPLY)) 00596 { 00597 if (!ApplyAction(SGACTION_APPLYADJUST)) 00598 ApplyAction(SGACTION_APPLY); 00599 } 00600 break; 00601 00602 00603 case DIM_REDRAW: 00604 if (Msg->GadgetID == _R(IDC_GALLERY_LISTBOX)) // Render the list box 00605 { 00606 RenderListBox((ReDrawInfoType*) Msg->DlgMsgParam); 00607 } 00608 break; 00609 00610 default: 00611 break; 00612 } 00613 } 00614 else if (MESSAGE_IS_A(Message, DocChangingMsg)) 00615 { 00616 DocChangingMsg *Msg = (DocChangingMsg *) Message; 00617 switch (Msg->State) 00618 { 00619 case DocChangingMsg::TITLECHANGED: 00620 if (DisplayTree != NULL && IsVisible()) 00621 { 00622 // If we have any 'categories' which represent this document, 00623 // ask them to redraw themselves to update their titles. 00624 SGDisplayNode *Category = 00625 DisplayTree->FindSubtree(this, Msg->pChangingDoc, NULL); 00626 00627 if (Category != NULL) 00628 Category->ForceRedrawOfMyself(); 00629 } 00630 break; 00631 00632 00633 case DocChangingMsg::ABOUTTODIE: // Document dying - remove from tree 00634 if (DisplayTree != NULL) 00635 { 00636 // If the gallery has a subtree for this document, we'll scrap it for 'em 00637 SGDisplayNode *Ptr = DisplayTree->FindSubtree(this, Msg->pChangingDoc, NULL); 00638 if (Ptr != NULL) 00639 { 00640 Ptr->DestroySubtree(); 00641 ForceRedrawOfList(); 00642 } 00643 } 00644 break; 00645 00646 00647 case DocChangingMsg::SELCHANGED: 00648 if (Msg->pNewDoc == NULL) 00649 { 00650 // There is no selected doc - this can only mean there are no docs 00651 // at all, so we had better shade the gallery 00652 ShadeGallery(TRUE); 00653 } 00654 break; 00655 00656 default: 00657 break; 00658 } 00659 } 00660 00661 else if (MESSAGE_IS_A(Message, DragMessage) && IsVisible() && DisplayTree != NULL) 00662 { 00663 // If a drag starting message comes around, pass it on to the tree 00664 DragMessage *Msg = (DragMessage *) Message; 00665 if (Msg->State == DragMessage::DRAGSTARTED) 00666 { 00667 BroadcastEvent(SGEVENT_DRAGSTARTED, (SGEventInfo *) Msg); 00668 00669 // And then call our virtual function to add a drag target (if appropriate) 00670 // for the entire gallery listbox. 00671 HandleDragStart(Msg); 00672 } 00673 } 00674 00675 else if (MESSAGE_IS_A(Message, ThumbMessage) && DisplayTree != NULL) 00676 { 00677 // If a library Thumb message comes around, pass it on to the tree 00678 // (do this even if the gallery is closed, as libraries may cache stuff even when closed) 00679 BroadcastEvent(SGEVENT_THUMBMSG, (SGEventInfo *) Message); 00680 } 00681 00682 // Pass the call down to the base class 00683 return(DialogOp::Message(Message)); 00684 00685 return OK; 00686 }
|
|
Processes idle events for the supergallery. This is used to provide backgrounded redraw of gallery items.
Reimplemented from Operation. Reimplemented in NameGallery, and NameGallery. Definition at line 3392 of file sgallery.cpp. 03393 { 03394 if (DisplayTree == NULL || !IsVisible() || PendingRedraws <= 0) 03395 { 03396 // Deregister for idles, because we should not be getting them now 03397 GetApplication()->RemoveIdleProcessor(MyIdlePriority, this); 03398 return(FALSE); // I no longer need idles 03399 } 03400 03401 // BroadcastEvent(SGEVENT_BGREDRAW, NULL); 03402 03403 // This is no longer done with an event broadcast. We now call a method which returns 03404 // once a node has been redrawn. It returns the redrawn node, so that we may continue 03405 // the next pass from that point, rather than having to re-scan the entire tree from the 03406 // beginning again (with a 14,000 item clipart gallery, we're looking at a small but 03407 // very noticable extra delay to scan the entire tree) 03408 SGMiscInfo MiscInfo; 03409 FillInMiscInfo(&MiscInfo); 03410 03411 if (LastBGNode == NULL) 03412 DisplayTree->DoBGRedrawPass(&MiscInfo); 03413 else 03414 LastBGNode->DoBGRedrawPass(&MiscInfo); 03415 03416 return(TRUE); 03417 }
|
|
Direct veneer function for DialogOp::PaintGadgetNow for the ListBox gadget. Allows SGDisplayNodes to force an immediate update.
May be called when the gallery is closed Definition at line 1841 of file sgallery.cpp. 01842 { 01843 if (IsVisible() && !AmRedrawing) 01844 PaintGadgetNow(GetListGadgetID()); 01845 }
|
|
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.
Reimplemented in FrameSGallery, LayerSGallery, and LineGallery. Definition at line 879 of file sgallery.cpp. 00880 { 00881 return(TRUE); 00882 }
|
|
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.
Reimplemented in BitmapSGallery. Definition at line 2591 of file sgallery.cpp. 02592 { 02593 // The base class does nothing 02594 return(TRUE); 02595 }
|
|
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.
Reimplemented in NameGallery, TEMPLATESGallery, BitmapSGallery, ColourSGallery, LayerSGallery, LibraryGallery, LibClipartSGallery, LibFillsSGallery, LineGallery, NameGallery, and FontsSGallery. Definition at line 856 of file sgallery.cpp. 00857 { 00858 return(TRUE); 00859 }
|
|
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.
Definition at line 2039 of file sgallery.cpp. 02040 { 02041 if (TheDocument == NULL || DisplayTree == NULL || !IsVisible()) 02042 return; 02043 02044 SGDisplayGroup *Group = DisplayTree->FindSubtree(this, TheDocument, NULL); 02045 02046 // Reformat, and update any areas that have changed 02047 ReformatAndRedrawIfNecessary(); 02048 02049 // If we found it, redraw the group and its contents (the window manager should 02050 // sort out redraw rectangle merging and stuff for us) 02051 if (Group != NULL) 02052 Group->ForceRedrawOfMyselfAndChildren(); 02053 }
|
|
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).
This method always forces a redraw of the scrollbar (if any) to ensure that the scrollbar is updated appropriately for the new extent. Definition at line 1988 of file sgallery.cpp. 01989 { 01990 #if FALSE 01991 /* 01992 if (DisplayTree == NULL || !IsVisible()) 01993 return; 01994 01995 ReDrawInfoType DlgRedrawInfo; 01996 GetKernelRenderedGadgetInfo(GetListGadgetID(), &DlgRedrawInfo); 01997 01998 // Get the visible list area in list virtual coordinates 01999 DocRect Area(0, 0, DlgRedrawInfo.dx, DlgRedrawInfo.dy); 02000 ConvertToVirtualCoords(&DlgRedrawInfo, &Area.lo); 02001 ConvertToVirtualCoords(&DlgRedrawInfo, &Area.hi); 02002 02003 // If the area to redraw is not offscreen (scrolled down out of view), redraw it 02004 if (TopYCoord > Area.lo.y) 02005 ForceRedrawOfArea(&Area); 02006 02007 SGMiscInfo MiscInfo; 02008 FillInMiscInfo(&MiscInfo); 02009 DisplayTree->RedrawScrollBar(&MiscInfo); // Ensure the Scrollbar is updated 02010 */ 02011 #else 02012 ReformatAndRedrawIfNecessary(); // This should do a better job than the above code! 02013 #endif 02014 }
|
|
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).
Definition at line 2073 of file sgallery.cpp. 02074 { 02075 if (DisplayTree == NULL || !IsVisible()) 02076 return; 02077 02078 ReDrawInfoType DlgRedrawInfo; 02079 GetKernelRenderedGadgetInfo(GetListGadgetID(), &DlgRedrawInfo); 02080 02081 SGMiscInfo MiscInfo; 02082 FillInMiscInfo(&MiscInfo, &DlgRedrawInfo); 02083 02084 if (!FormatIsCached || 02085 LastWindowDX != DlgRedrawInfo.dx || LastWindowDY != DlgRedrawInfo.dy) 02086 { 02087 SGFormatInfo FormatInfo; 02088 DisplayTree->InitFormatInfo(&FormatInfo, &MiscInfo); 02089 FormatInfo.AccumulateBounds = TRUE; 02090 02091 // Recalculate and cache formatting information 02092 BroadcastEvent(SGEVENT_FORMAT, &FormatInfo, &MiscInfo); 02093 02094 // And remember that the cache is now valid 02095 FormatIsCached = TRUE; 02096 02097 // And remember new window size 02098 LastWindowDX = DlgRedrawInfo.dx; 02099 LastWindowDY = DlgRedrawInfo.dy; 02100 02101 // If this caused anything to move, redraw the display 02102 if (FormatInfo.InvalidBounds.hi.y <= 0 && IsVisible()) 02103 ForceRedrawOfArea(&FormatInfo.InvalidBounds); 02104 } 02105 }
|
|
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.
Definition at line 1870 of file sgallery.cpp. 01871 { 01872 if (DisplayTree == NULL || !IsVisible()) 01873 return; 01874 01875 if (ForceReformat || !FormatIsCached) 01876 { 01877 SGFormatInfo FormatInfo; 01878 SGMiscInfo MiscInfo; 01879 01880 FillInMiscInfo(&MiscInfo); 01881 DisplayTree->InitFormatInfo(&FormatInfo, &MiscInfo); 01882 01883 // Recalculate and cache formatting information 01884 BroadcastEvent(SGEVENT_FORMAT, &FormatInfo, &MiscInfo); 01885 01886 // And remember that the cache is now valid 01887 FormatIsCached = TRUE; 01888 } 01889 }
|
|
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.
Definition at line 2491 of file sgallery.cpp. 02492 { 02493 ERROR3IF(DisplayedLibrary == NULL, "SuperGallery::RemoveLibraryGroup - NULL parameter is illegal"); 02494 02495 if (DisplayTree == NULL || DisplayedLibrary == NULL) 02496 return; 02497 02498 SGDisplayGroup *TheGroup = DisplayTree->FindSubtree(this, NULL, DisplayedLibrary); 02499 02500 if (TheGroup != NULL) 02501 TheGroup->DestroySubtree(); // Destroy subtree, including the Group node 02502 }
|
|
Renders the displayed list of items into the 'list box' control.
Definition at line 1535 of file sgallery.cpp. 01536 { 01537 if (AmRedrawing) 01538 { 01539 ERROR3("Re-entrant redraw detected in SuperGallery::RenderListBox! (I'll ignore it)"); 01540 return; 01541 } 01542 01543 AmRedrawing = TRUE; // LOCK to ensure we don't do this in a re-entrant manner 01544 01545 // Initialise the MiscInfo and formatting information structure 01546 SGMiscInfo MiscInfo; 01547 FillInMiscInfo(&MiscInfo, DlgRedrawInfo); 01548 01549 // If Format Info is not cached by the tree, or if the window size has changed, 01550 // then ask the tree to reformat its display items and cache the result 01551 if (DisplayTree != NULL) 01552 { 01553 if (!FormatIsCached || 01554 LastWindowDX != DlgRedrawInfo->dx || LastWindowDY != DlgRedrawInfo->dy) 01555 { 01556 SGFormatInfo FormatInfo; 01557 DisplayTree->InitFormatInfo(&FormatInfo, &MiscInfo); 01558 01559 // Recalculate and cache formatting information 01560 BroadcastEvent(SGEVENT_FORMAT, &FormatInfo, &MiscInfo); 01561 01562 // And remember that the cache is now valid 01563 FormatIsCached = TRUE; 01564 01565 // And remember new window size 01566 LastWindowDX = DlgRedrawInfo->dx; 01567 LastWindowDY = DlgRedrawInfo->dy; 01568 } 01569 } 01570 01571 // Now calculate the virtual size - note that this depends upon the scroll offset 01572 // which may be altered by a reformat, which is why we did the Reformat above. 01573 INT32 PixelSize; 01574 DocRect VirtualSize; 01575 CalcVirtualSize(DlgRedrawInfo, &VirtualSize, &PixelSize); 01576 01577 RenderRegion* pRender = CreateRenderRegion(&VirtualSize, DlgRedrawInfo); 01578 if (pRender!=NULL) 01579 { 01580 pRender->SaveContext(); 01581 01582 DialogColourInfo RedrawColours; 01583 01584 if (DisplayTree == NULL) 01585 { 01586 DocColour White(COLOUR_WHITE); 01587 01588 if (UseFixedColourSet) 01589 { 01590 pRender->SetFillColour(White); 01591 pRender->SetLineColour(White); 01592 } 01593 else 01594 { 01595 pRender->SetFillColour(RedrawColours.TextBack()); 01596 pRender->SetLineColour(RedrawColours.TextBack()); 01597 } 01598 pRender->DrawRect(&VirtualSize); // No display tree! Fill the area with white 01599 } 01600 else 01601 { 01602 // Set up the redraw information (Note: This must be left until after formatting, 01603 // as the scroll offset etc may be changed by a reformat) 01604 // Set the bounding rectangle of the region to be redrawn from the clip rectangle, 01605 // so that only items that need redrawing do redraw. We then have to convert these 01606 // into display list virtual coordinates 01607 SGRedrawInfo RedrawInfo; 01608 RedrawInfo.Bounds = *(DlgRedrawInfo->pClipRect); 01609 ConvertToVirtualCoords(DlgRedrawInfo, &RedrawInfo.Bounds.lo); 01610 ConvertToVirtualCoords(DlgRedrawInfo, &RedrawInfo.Bounds.hi); 01611 01612 RedrawInfo.Renderer = pRender; 01613 01614 if (UseFixedColourSet) 01615 { 01616 // Use fixed colour scheme 01617 RedrawInfo.Foreground = DocColour(COLOUR_BLACK); 01618 RedrawInfo.Background = DocColour(COLOUR_WHITE); 01619 RedrawInfo.SelForeground = DocColour(COLOUR_WHITE); 01620 RedrawInfo.SelBackground = DocColour(0L, 0L, 128L); 01621 } 01622 else 01623 { 01624 // Read the operating-system preferences for the colour scheme 01625 RedrawInfo.Foreground = RedrawColours.TextFore(); 01626 RedrawInfo.Background = RedrawColours.TextBack(); 01627 RedrawInfo.SelForeground = RedrawColours.HighlightedTextFore(); 01628 RedrawInfo.SelBackground = RedrawColours.HighlightedTextBack(); 01629 } 01630 01631 RedrawInfo.Transparent = DocColour(COLOUR_TRANS); 01632 01633 // And render the tree 01634 BroadcastEvent(SGEVENT_REDRAW, &RedrawInfo, &MiscInfo); 01635 } 01636 01637 pRender->RestoreContext(); 01638 DestroyRenderRegion(pRender); 01639 } 01640 01641 AmRedrawing = FALSE; // And unlock the redraw once more 01642 }
|
|
To scroll the list gadget in the super gallery. Basically just a veneer function for sgdisplayrootscroll which can't tidily access the DialogOp method...
May be called when the gallery is closed
Definition at line 1814 of file sgallery.cpp. 01815 { 01816 if (IsVisible()) 01817 ScrollKernelRenderedGadget(GetListGadgetID(), Area, ScrollBy); 01818 }
|
|
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.
Notes: Calls ReformatNow(FALSE) to reformat if the cached format is known to be invalid before it attempts to scroll. If the rectangle is bigger than the displayable area, we'll scroll to the top (or bottom) of it. If the rectangle is smaller than the display area, we'll scroll so that it is centered in the display. May be called when there is no displaylist or when the gallery is closed
Definition at line 1747 of file sgallery.cpp. 01748 { 01749 if (DisplayTree == NULL || !IsVisible()) 01750 return; 01751 01752 ReformatNow(FALSE); // Check that the formatting information is up to date 01753 01754 DocRect Window; 01755 INT32 PixelSize; 01756 01757 ReDrawInfoType DlgRedrawInfo; 01758 GetKernelRenderedGadgetInfo(GetListGadgetID(), &DlgRedrawInfo); 01759 01760 CalcVirtualSize(&DlgRedrawInfo, &Window, &PixelSize); 01761 01762 // If the rectangle is entirely visible, don't bother scrolling to it 01763 if (Window.lo.y <= Area->lo.y && Window.hi.y >= Area->hi.y) 01764 return; 01765 01766 // OK. Scroll the top into view... 01767 INT32 NewScrollOffset = ABS(Area->hi.y); 01768 01769 if (Area->Height() <= Window.Height()) 01770 NewScrollOffset -= (Window.Height() - Area->Height()) / 2; 01771 else if (PreferToSeeBottom) 01772 NewScrollOffset = (ABS(Area->lo.y)) - Window.Height(); 01773 01774 if (NewScrollOffset != DisplayTree->GetScrollOffset()) 01775 { 01776 SGMiscInfo MiscInfo; 01777 FillInMiscInfo(&MiscInfo, &DlgRedrawInfo); 01778 01779 DisplayTree->SetScrollOffset(NewScrollOffset, &MiscInfo); 01780 } 01781 }
|
|
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.
Document - NULL, or the document which defines the range of groups to affect Library - NULL, or the library which defines the range of groups to affect Notes: To select all groups in a range, and deselect all groups outside the range, you need to use 2 calls to this method. To select/deselect all groups in the display, pass FALSE, NULL, NULL to the last 3 parameters. (If Doc/Lib are both NULL, 'Exclusive' has no effect)
Definition at line 2194 of file sgallery.cpp. 02196 { 02197 if (DisplayTree != NULL) 02198 DisplayTree->SelectGroups(SelectThem, Exclusive, ParentDocument, ParentLibrary); 02199 }
|
|
To inform the gallery that the selection has changed in some way. The base gallery class will do the following things:.
Notes: If this default action is unsuitable, derived galleries may override it. If they add their own special buttons, they may need to override this method to ensure that their buttons also behave correctly on sel change. This method is called after creation of the window (immediately after the PostCreate upcall) to ensure the window state is correct Reimplemented in NameGallery, BitmapSGallery, ColourSGallery, LibraryGallery, LibClipartSGallery, LibFillsSGallery, LineGallery, NameGallery, and FontsSGallery. Definition at line 2339 of file sgallery.cpp. 02340 { 02341 if (DisplayTree == NULL || AmShaded || !IsVisible()) 02342 return; 02343 02344 INT32 Count = DisplayTree->GetSelectedItemCount(); 02345 02346 EnableGadget(_R(IDC_GALLERY_APPLY), (Count == 1)); // Apply/Redefine/edit/name need exactly 1 item 02347 EnableGadget(_R(IDC_GALLERY_REDEFINE), (Count == 1)); 02348 EnableGadget(_R(IDC_GALLERY_EDIT), (Count == 1)); 02349 EnableGadget(_R(IDC_GALLERY_NAME), (Count == 1)); 02350 02351 EnableGadget(_R(IDC_GALLERY_NEW), (Count <= 1)); // New needs 0 or 1 items 02352 02353 EnableGadget(_R(IDC_GALLERY_DELETE), (Count > 0)); // Delete needs 1 or more items 02354 02355 EnableGadget(_R(IDC_GALLERY_UNDO), TRUE); // Undo/menu always available 02356 EnableGadget(_R(IDC_GALLERY_MENU), TRUE); 02357 }
|
|
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.
Document - NULL, or the document which defines the range of items to affect Library - NULL, or the library which defines the range of items to affect Notes: To select all items in a range, and deselect all items outside the range, you need to use 2 calls to this method. To select/deselect all items in the display, pass FALSE, NULL, NULL to the last 3 parameters. (If Doc/Lib are both NULL, 'Exclusive' has no effect) e.g. SelectItems(TRUE, FALSE, MyDocument); will select all items which are related to the given document. SelectItems(TRUE, TRUE, MyDocument); will select all items which are NOT related to the given document. SelectItems(FALSE); will deselect ALL items in the gallery SelectItems(TRUE, FALSE, MyDocument); SelectItems(FALSE, TRUE, MyDocument); This combination will select all items in this document, ensuring that nothing is selected anywhere else in the gallery. Definition at line 2154 of file sgallery.cpp. 02156 { 02157 if (DisplayTree != NULL) 02158 DisplayTree->SelectItems(SelectThem, Exclusive, ParentDocument, ParentLibrary); 02159 }
|
|
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.
Definition at line 2221 of file sgallery.cpp. 02222 { 02223 #if 0 02224 BOOL Items = FALSE; 02225 BOOL Groups = FALSE; 02226 02227 if(PrimeNode->IS_KIND_OF(SGDisplayItem) && (AnchorNode == NULL || AnchorNode->IS_KIND_OF(SGDisplayItem))) 02228 Items = TRUE; 02229 else if(PrimeNode->IS_KIND_OF(SGDisplayGroup) && (AnchorNode == NULL || AnchorNode->IS_KIND_OF(SGDisplayGroup))) 02230 Groups = TRUE; 02231 02232 if(Items) 02233 DisplayTree->SelectRange(PrimeNode, AnchorNode); 02234 SelectRangeItems((SGDisplayItem *)PrimeNode, (SGDisplayItem *)AnchorNode); 02235 else if(Groups) 02236 SelectRangeGroups((SGDisplayGroup *)PrimeNode, (SGDisplayGroup *)AnchorNode); 02237 else 02238 ERROR3("SGDisplayNode::SelectRange given opposing node types"); 02239 #endif 02240 02241 if (DisplayTree != NULL) 02242 DisplayTree->SelectRange(PrimeNode, AnchorNode); 02243 }
|
|
Definition at line 265 of file sgallery.h. 00266 { GallerySize = Size; };
|
|
Definition at line 649 of file sgallery.h. 00649 { Name = str; }
|
|
Definition at line 586 of file sgallery.h. 00587 { LastBGNode = LastNodeRendered; }
|
|
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.
Definition at line 2379 of file sgallery.cpp. 02380 { 02381 LastSelectedNode = JustSelected; 02382 }
|
|
Set the Quiet status of the gallery - used when a load of indexes are being added to the gallery and there are problems...
Reimplemented in LibraryGallery, LibClipartSGallery, LibFillsSGallery, and FontsSGallery. Definition at line 1279 of file sgallery.cpp.
|
|
Used by the tool bar customize system to open and close a tool bar.
It always calls the base class in order to show/hide the gallery NOTE THAT THIS CAN DELETE THE OBJECT CONCERNED! Reimplemented from DialogOp. Reimplemented in NameGallery. Definition at line 776 of file sgallery.cpp. 00777 { 00778 if (!Open) 00779 { 00780 // If we're being hidden, make sure that any owned dialogues are closed 00781 CloseOwnedDialogs(); 00782 } 00783 00784 // Now call the base class to show/hide ourselves 00785 DialogOp::SetVisibility(Open); 00786 if (!Open) 00787 End(); // Return quick, this deletes the super gallery 00788 }
|
|
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.
Notes: If the gallery is already in the requested state, or if it is closed (not visible on screen) then nothing happens (other than that the shaded flag is updated to reflect the desired state)
Definition at line 910 of file sgallery.cpp. 00911 { 00912 if (AmShaded != ShadeIt && IsVisible()) 00913 { 00914 EnableGadget(_R(IDC_GALLERY_APPLY), !ShadeIt); 00915 EnableGadget(_R(IDC_GALLERY_NEW), !ShadeIt); 00916 EnableGadget(_R(IDC_GALLERY_DELETE), !ShadeIt); 00917 EnableGadget(_R(IDC_GALLERY_REDEFINE), !ShadeIt); 00918 EnableGadget(_R(IDC_GALLERY_EDIT), !ShadeIt); 00919 // EnableGadget(_R(IDC_GALLERY_UNDO), !ShadeIt); 00920 EnableGadget(_R(IDC_GALLERY_MENU), !ShadeIt); 00921 EnableGadget(_R(IDC_GALLERY_NAME), !ShadeIt); 00922 00923 DoShadeGallery(ShadeIt); 00924 } 00925 00926 AmShaded = ShadeIt; 00927 00928 if (!AmShaded) // If unshading, ensure the buttons are updated 00929 SelectionHasChanged(); // to reflect the new selection state 00930 }
|
|
'qsort' comparator function, used when quicksorting the display list
Definition at line 1047 of file sgallery.cpp. 01048 { 01049 SGDisplayNode *Node1 = *((SGDisplayNode **)Item1); 01050 SGDisplayNode *Node2 = *((SGDisplayNode **)Item2); 01051 01052 INT32 Result = Node1->CompareTo(Node2, CurrentSortGallery->SortKeys[0].SortKey); 01053 if (CurrentSortGallery->SortKeys[0].Reversed) 01054 Result = -Result; 01055 01056 if (Result == 0) 01057 { 01058 Result = Node1->CompareTo(Node2, CurrentSortGallery->SortKeys[1].SortKey); 01059 if (CurrentSortGallery->SortKeys[1].Reversed) 01060 Result = -Result; 01061 } 01062 01063 return(Result); 01064 }
|
|
Write the SuperGallery to the registry.
Definition at line 1921 of file bars.cpp. 01922 { 01923 #pragma message( __LOCMSG__ "SuperGallery::Write(SaveRegistryEntries& Saver) - do nothing" ) 01924 TRACE( _T("Warning - SuperGallery::Write(SaveRegistryEntries& Saver) called") ); 01925 /* BOOL ok = TRUE; 01926 01927 HKEY hRegKey = Saver.GetRegKey(); 01928 if (hRegKey == NULL) 01929 { 01930 ERROR3("SuperGallery::Write failed to get registry key"); 01931 return FALSE; 01932 } 01933 01934 // save out the name into the registry 01935 ok = ok && SetRegString(hRegKey, TEXT("Name"), GetName()); 01936 01937 String_256 str = GetRuntimeClass()->m_lpszClassName; 01938 ok = ok && SetRegString(hRegKey, TEXT("ClassName"), str); 01939 01940 ok = ok && SetRegString(hRegKey, TEXT("Type"), TokenTable[TOKEN_GALLERY].Token); 01941 01942 KernelBarPos* pKernelBarPos = NULL; 01943 GetMainFrame()->GetBarPosInfo(WindowID,&Dock,&pKernelBarPos); 01944 SetDockBarType(Dock); 01945 if (pKernelBarPos) 01946 { 01947 if (Dock == DOCKBAR_FLOAT) 01948 SetFloatingCPoint(wxPoint(pKernelBarPos->x,pKernelBarPos->y)); 01949 else 01950 { 01951 SetSlot(pKernelBarPos->Slot); 01952 SetOffset(pKernelBarPos->Position); 01953 } 01954 } 01955 01956 ok = ok && SetRegInt(hRegKey, TEXT("Dock"), Dock); 01957 01958 if (Dock == DOCKBAR_FLOAT) 01959 { 01960 ok = ok && SetRegDword(hRegKey, TEXT("x"), FloatPos.x); 01961 ok = ok && SetRegDword(hRegKey, TEXT("y"), FloatPos.y); 01962 } 01963 else 01964 { 01965 ok = ok && SetRegDword(hRegKey, TEXT("Slot"), Slot); 01966 ok = ok && SetRegDword(hRegKey, TEXT("Offset"), Offset); 01967 } 01968 01969 wxRect BarRect = GetMainFrame()->GetDockBar(Dock)->GetBarRect(WindowID); 01970 01971 if (BarRect.width > 0 && BarRect.height > 0) 01972 { 01973 ok = ok && SetRegDword(hRegKey, TEXT("Width"), BarRect.width); 01974 ok = ok && SetRegDword(hRegKey, TEXT("Height"), BarRect.height); 01975 } 01976 else if (GallerySize.x > 0 && GallerySize.y > 0) 01977 { 01978 ok = ok && SetRegDword(hRegKey, TEXT("Width"), GallerySize.x); 01979 ok = ok && SetRegDword(hRegKey, TEXT("Height"), GallerySize.y); 01980 } 01981 01982 // save the visibility of the bar 01983 ok = ok && SetRegBool(hRegKey, TEXT("Visibility"), IsVisible()); 01984 01985 // save out the items on the bar 01986 // get the first control on this bar 01987 BarItem* pBarItem = (BarItem*) BarItemList.GetHead(); 01988 String_256 data; 01989 while (pBarItem != NULL && ok) 01990 { 01991 data.Empty(); 01992 // get the bar control to put its details into a string for us 01993 if (ok) ok = pBarItem->Write(&data); 01994 // now write that out to the registry 01995 Saver.SaveNextEntry(&data); 01996 01997 // get the next control on this bar 01998 pBarItem = (BarItem*)BarItemList.GetNext(pBarItem); 01999 } 02000 02001 // The saver will automatically shut down our use of the key 02002 // so just return the result of the saving to the user 02003 return ok; */ 02004 02005 return false; 02006 }
|
|
Write the Gallery to the file in a tokenized form Write the SuperGallery to the file in a tokenized form.
Definition at line 1318 of file bars.cpp. 01319 { 01320 BOOL ok = TRUE; 01321 #ifndef EXCLUDE_FROM_XARALX 01322 PORTNOTE("galleries", "Disable Lexfile writing") 01323 String_256 str; 01324 if (ok) ok = file.PutToken(TokenTable[TOKEN_GALLERY].Token); 01325 01326 if (ok) ok = file.PutString((String_256)GetRuntimeClass()->GetClassName()); 01327 01328 if (ok) ok = file.PutString(GetName()); 01329 01330 if (ok) ok = file.PutToken(TokenTable[TOKEN_DOCKBAR_FLOAT].Token); 01331 01332 if (ok) ok = file.PutToken(FloatPos.x); 01333 if (ok) ok = file.PutToken(FloatPos.y); 01334 01335 file.IncIndent(); 01336 01337 BarItem* pBarItem = (BarItem*) BarItemList.GetHead(); 01338 while (pBarItem != NULL && ok) 01339 { 01340 if (ok) ok = file.PutNewLine(); 01341 01342 if (ok) ok = pBarItem->Write(file); 01343 01344 pBarItem = (BarItem*)BarItemList.GetNext(pBarItem); 01345 } 01346 01347 file.DecIndent(); 01348 01349 if (ok) ok = file.PutNewLine(); 01350 01351 if (ok) ok = file.PutToken(TokenTable[TOKEN_GALLERY_END].Token); 01352 01353 if (ok) ok = file.PutNewLine(); 01354 if (ok) ok = file.PutNewLine(); 01355 #endif 01356 return ok; 01357 }
|
|
Definition at line 248 of file sgallery.h. |
|
Definition at line 245 of file sgallery.h. |
|
Definition at line 247 of file sgallery.h. |
|
Definition at line 246 of file sgallery.h. |
|
Definition at line 612 of file sgallery.h. |
|
Definition at line 611 of file sgallery.h. |
|
Definition at line 633 of file sgallery.h. |
|
Definition at line 622 of file sgallery.h. |
|
Definition at line 628 of file sgallery.h. |
|
Definition at line 625 of file sgallery.h. |
|
Definition at line 538 of file sgallery.h. |
|
Definition at line 618 of file sgallery.h. |
|
Definition at line 605 of file sgallery.h. |
|
Definition at line 603 of file sgallery.h. |
|
Definition at line 606 of file sgallery.h. |
|
Definition at line 277 of file sgallery.h. |
|
Definition at line 599 of file sgallery.h. |
|
Definition at line 617 of file sgallery.h. |
|
Definition at line 616 of file sgallery.h. |
|
Definition at line 614 of file sgallery.h. |
|
Definition at line 608 of file sgallery.h. |
|
Definition at line 609 of file sgallery.h. |
|
Definition at line 647 of file sgallery.h. |
|
Definition at line 591 of file sgallery.h. |
|
Definition at line 631 of file sgallery.h. |
|
Definition at line 639 of file sgallery.h. |