sgallery.h

Go to the documentation of this file.
00001 // $Id: sgallery.h 1267 2006-06-08 00:50:11Z alex $
00002 /* @@tag:xara-cn@@ DO NOT MODIFY THIS LINE
00003 ================================XARAHEADERSTART===========================
00004  
00005                Xara LX, a vector drawing and manipulation program.
00006                     Copyright (C) 1993-2006 Xara Group Ltd.
00007        Copyright on certain contributions may be held in joint with their
00008               respective authors. See AUTHORS file for details.
00009 
00010 LICENSE TO USE AND MODIFY SOFTWARE
00011 ----------------------------------
00012 
00013 This file is part of Xara LX.
00014 
00015 Xara LX is free software; you can redistribute it and/or modify it
00016 under the terms of the GNU General Public License version 2 as published
00017 by the Free Software Foundation.
00018 
00019 Xara LX and its component source files are distributed in the hope
00020 that it will be useful, but WITHOUT ANY WARRANTY; without even the
00021 implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
00022 See the GNU General Public License for more details.
00023 
00024 You should have received a copy of the GNU General Public License along
00025 with Xara LX (see the file GPL in the root directory of the
00026 distribution); if not, write to the Free Software Foundation, Inc., 51
00027 Franklin St, Fifth Floor, Boston, MA  02110-1301 USA
00028 
00029 
00030 ADDITIONAL RIGHTS
00031 -----------------
00032 
00033 Conditional upon your continuing compliance with the GNU General Public
00034 License described above, Xara Group Ltd grants to you certain additional
00035 rights. 
00036 
00037 The additional rights are to use, modify, and distribute the software
00038 together with the wxWidgets library, the wxXtra library, and the "CDraw"
00039 library and any other such library that any version of Xara LX relased
00040 by Xara Group Ltd requires in order to compile and execute, including
00041 the static linking of that library to XaraLX. In the case of the
00042 "CDraw" library, you may satisfy obligation under the GNU General Public
00043 License to provide source code by providing a binary copy of the library
00044 concerned and a copy of the license accompanying it.
00045 
00046 Nothing in this section restricts any of the rights you have under
00047 the GNU General Public License.
00048 
00049 
00050 SCOPE OF LICENSE
00051 ----------------
00052 
00053 This license applies to this program (XaraLX) and its constituent source
00054 files only, and does not necessarily apply to other Xara products which may
00055 in part share the same code base, and are subject to their own licensing
00056 terms.
00057 
00058 This license does not apply to files in the wxXtra directory, which
00059 are built into a separate library, and are subject to the wxWindows
00060 license contained within that directory in the file "WXXTRA-LICENSE".
00061 
00062 This license does not apply to the binary libraries (if any) within
00063 the "libs" directory, which are subject to a separate license contained
00064 within that directory in the file "LIBS-LICENSE".
00065 
00066 
00067 ARRANGEMENTS FOR CONTRIBUTION OF MODIFICATIONS
00068 ----------------------------------------------
00069 
00070 Subject to the terms of the GNU Public License (see above), you are
00071 free to do whatever you like with your modifications. However, you may
00072 (at your option) wish contribute them to Xara's source tree. You can
00073 find details of how to do this at:
00074   http://www.xaraxtreme.org/developers/
00075 
00076 Prior to contributing your modifications, you will need to complete our
00077 contributor agreement. This can be found at:
00078   http://www.xaraxtreme.org/developers/contribute/
00079 
00080 Please note that Xara will not accept modifications which modify any of
00081 the text between the start and end of this header (marked
00082 XARAHEADERSTART and XARAHEADEREND).
00083 
00084 
00085 MARKS
00086 -----
00087 
00088 Xara, Xara LX, Xara X, Xara X/Xtreme, Xara Xtreme, the Xtreme and Xara
00089 designs are registered or unregistered trademarks, design-marks, and/or
00090 service marks of Xara Group Ltd. All rights in these marks are reserved.
00091 
00092 
00093       Xara Group Ltd, Gaddesden Place, Hemel Hempstead, HP2 6EX, UK.
00094                         http://www.xara.com/
00095 
00096 =================================XARAHEADEREND============================
00097  */
00098 // SGallery.h - the SuperGallery class
00099 
00100 #ifndef INC_SGALLERY
00101 #define INC_SGALLERY
00102 
00103 #include "sgtree.h"
00104 #include "sgscan.h"
00105 #include "dlgtypes.h"
00106 #include "dialogop.h"
00107 
00108 #define   GSAFECLASS(TheClass)     (TheClass?TheClass:CC_RUNTIME_CLASS(DialogOp))
00109 
00110 // Pre-declarations
00111 class DragMessage;
00112 
00113 class SGDisplayNode;
00114 class SGDisplayRoot;
00115 
00116 class OpState;
00117 class GalleryContextMenu;
00118 class Progress;
00119 
00120 struct ReDrawInfoType;
00121 
00122 class MenuItem;
00123 
00124 /***********************************************************************************************
00125 
00126 <   SGActionType
00127 
00128     Comment:    MonoOn
00129                 typedef enum
00130                 {
00131                     SGACTION_CREATE,
00132                     SGACTION_APPLY,
00133                     SGACTION_REDEFINE,
00134                     SGACTION_EDIT,
00135                     SGACTION_DELETE,
00136                     SGACTION_SETOPTIONS,
00137                     SGACTION_SETSORTMODE,
00138                     SGACTION_DISPLAYMODECHANGED
00139                 } SGActionType;
00140                 MonoOff
00141 
00142                 This is used by the SuperGallery -> Derived class ApplyAction() upcall.
00143                 This method recieves an action type, from the above list, and applies it
00144                 to the gallery selection. The actions generally correspond to clicks on
00145                 the standard SuperGallery action buttons.
00146 
00147                 MonoOn
00148                 Action:             What a conventional gallery would do:
00149 
00150                 CREATE              Create a new item, usually copied from the selection
00151                 APPLY               Apply the selected item(s) to the document (select-click)
00152                 APPLYADJUST         Apply the selected item(s) to the document (adjust click)
00153                 REDEFINE            Redefine an item from selection (define by example)
00154                 EDIT                Redefine an item with an editor (e.g. colour editor)
00155                 DELETE              Delete the selected items
00156                 SETOPTIONS          Set options-dialogue values by calling the dialogue
00157                 SETSORTMODE         Set sort-dialogue values by calling the dialogue
00158                 DISPLAYMODECHANGED  Take appropriate action when the display mode changes
00159                 SETLINEPROPERTIES   Set line-properties-dialogue values by calling the dialogue
00160                 MonoOff
00161 
00162     SeeAlso:    SuperGallery::ApplyAction
00163 
00164 ***********************************************************************************************/
00165 
00166 typedef enum
00167 {
00168     SGACTION_CREATE,
00169     SGACTION_APPLY,
00170     SGACTION_APPLYADJUST,
00171     SGACTION_REDEFINE,
00172     SGACTION_EDIT,
00173     SGACTION_DELETE,
00174     SGACTION_SETOPTIONS,
00175     SGACTION_SETSORTMODE,
00176     SGACTION_DISPLAYMODECHANGED,
00177     SGACTION_SETLINEPROPERTIES,
00178 
00179     SGACTION_ANIMATIONPROPERTIES,
00180     SGACTION_FRAMEPROPERTIES,
00181 
00182     SGACTION_UNDO       // DEFUNCT - DO NOT USE! This will be removed when possible
00183 
00184 } SGActionType;
00185 
00186 
00187 
00188 /***********************************************************************************************
00189 
00190 <   SGMenuID
00191 
00192     Comment:    MonoOn
00193                 typedef enum
00194                 {
00195                     SGMENU_OVERITEM,
00196                     SGMENU_OPTIONS
00197                 } SGMenuID;
00198                 MonoOff
00199 
00200                 An enum of this type is passed in when a request is made for a gallery to
00201                 build a command menu. The current menu types are:
00202 
00203                 MonoOn
00204                 SGMENU_OVERITEM     Build a pop-up menu for the current selection
00205                 SGMENU_OPTIONS      Build a drop-down menu when the options button is clicked
00206                 MonoOff
00207 
00208     SeeAlso:    SuperGallery::BuildCommandMenu
00209 
00210 ***********************************************************************************************/
00211 
00212 typedef enum
00213 {
00214     SGMENU_OVERITEM,
00215     SGMENU_OPTIONS
00216 } SGMenuID;
00217 
00218 /***********************************************************************************************
00219 
00220 >   class SuperGallery : public DialogOp
00221 
00222     Author:     Jason_Williams (Xara Group Ltd) <camelotdev@xara.com>
00223     Created:    19/10/94
00224     Purpose:    This is the base class for all Camelot "gallery" windows. It is called
00225                 SuperGallery as it replaces the older Gallery class with a new, improved
00226                 system, allowing multiple displaylists to be displayed as categories of
00227                 the gallery display.
00228 
00229     Notes:      SuperGalleries are specced in a number of docs including
00230                     specs\gallib.doc ("super" gallery extensions)
00231                     specs\propui.doc  (gallery basic ui)
00232 
00233     SeeAlso:    SGDisplayNode; SGDisplayRoot; SGDisplayGroup; SGDisplayItem
00234 
00235 ***********************************************************************************************/
00236 
00237 class SGalleryOptionsDlg;           // Defined below
00238 class SGallerySearchDlg;            // Defined below
00239 class SaveRegistryEntries;          // Defined below
00240 class SGallerySortDlg;              // Defined below
00241 class SGalleryLinePropertiesDlg;    // Defined in sglinepr.h
00242 
00243 class SuperGallery : public DialogOp
00244 {
00245 friend class SGalleryOptionsDlg;
00246 friend class SGallerySortDlg;
00247 friend class SGallerySearchDlg;
00248 friend class SGalleryLinePropertiesDlg;
00249 
00250     CC_DECLARE_DYNCREATE(SuperGallery)
00251 
00252 public:             // Constructors/Destructors
00253     SuperGallery(CCRuntimeClass *Class = NULL);
00254     SuperGallery(String_32 &NewName, CCRuntimeClass *Class = NULL);
00255     ~SuperGallery();
00256 
00257 private:            // Shared initialisation for constructors
00258     void InitData(void);
00259 
00260 
00261 public:             // Dialogue operations on Galleries
00262     virtual BOOL Create(void);
00263     virtual void SetVisibility(BOOL Open);
00264 
00265     void SetGallerySize(wxSize Size)
00266                     { GallerySize = Size; };
00267 
00268     wxSize GetGallerySize(void)
00269                     { return GallerySize; };
00270 
00271     // The old write it out to ini file form
00272     BOOL Write(CCLexFile& file);                // Override DialogBarOp write function
00273     // The new write it out to the registry form
00274     BOOL Write(SaveRegistryEntries& Saver);     // Override DialogBarOp write function
00275 
00276 protected:          // Private dialogue/Bar handlers for galleries
00277     wxSize GallerySize;
00278 
00279 
00280 public:             // Message handling
00281     virtual MsgResult Message(Msg *Message);
00282         // If you override Message, you must pass msgs on to SuperGallery::Message
00283 
00284 
00285 public:             // Derived class interface
00286     INT32 GetDisplayExtent(void);
00287         // Returns the minimum y coordinate of the displayed list
00288 
00289     void ForceGroupFolded(SGDisplayGroup *GroupToFold, BOOL FoldedState);
00290         // Ensures that the given group is {un}folded as desired.
00291         // Reformats and redraws the DisplayTree if neccessary
00292 
00293     void ScrollToShow(DocRect *Area, BOOL PreferToSeeBottom = FALSE);
00294         // Scrolls the window, if necessary, to show as much of the specified area
00295         // as possible. If the area is too large, scrolls to the top of it. Used to
00296         // scroll to a selected item or items.
00297         // PreferToSeeBottom indicates that the item at the bottom of the rectangle is
00298         // more important that the one at the top, so if it doesn't all fit, show the
00299         // bottom of the rect rather than the top.
00300 
00301     void ScrollArea(DocRect *Area, DocCoord *ScrollBy);
00302         // Scrolls a given area - uses WINDOW MILLIPOINT values, not virtual coords
00303 
00304     void PaintListNow(void);
00305         // Just makes the list box update immediately (cf DialogOp::PaintGadgetNow)
00306     
00307     void ReformatNow(BOOL ForceReformat);
00308         // Causes the display tree format to be recalculated immediately if necessary.
00309         // ForceReformat causes the format to be recalculated even if it is believed
00310         // to be correctly cached
00311 
00312     void ForceRedrawOfList(void);
00313         // Forces a reformat and redraw of the entire displayed list
00314 
00315     void ForceRedrawOfArea(DocRect *Area);
00316         // Forces a redraw of the given area in our virtual coordinate space
00317         // Only really of use to SGDisplayNode-derived classes!
00318 
00319     void RedrawEverythingBelow(INT32 TopYCoord);
00320         // Forces a redraw (if necessary) of the region of the display list which
00321         // occurs below the given virtual coordinate.
00322 
00323     void RedrawDocumentDisplay(Document *TheDocument);
00324         // Forces a redraw of the given document's display. If the format cache is
00325         // invalid, a reformat occurs, and all changed areas are redrawn.
00326 
00327     void ReformatAndRedrawIfNecessary(void);
00328         // If the format cache is invalid, does a reformat of the display. If this changed
00329         // the cached formatting information at all, the affected area(s) are redrawn
00330 
00331     inline void InvalidateCachedFormat(void);
00332         // Warns the supergallery that before redrawing/handling a click in this gallery,
00333         // we must send around an SGEVENT_FORMAT to recache the formatting information.
00334 
00335     void ShadeGallery(BOOL ShadeIt);
00336         // Shade/Unshade the gallery window - SeeAlso: DoShadeGallery upcall
00337 
00338     void SelectItems(BOOL SelectThem, BOOL Exclusive = FALSE,
00339                         Document *ParentDocument = NULL, Library *ParentLibrary = NULL);
00340         // Select/Deselect all items, all-items-in-document, all-items-in-library
00341         // Exclusive indicates if you should apply to the given range or apply to everything
00342         // outside the given range
00343 
00344     void SelectGroups(BOOL SelectThem, BOOL Exclusive = FALSE,
00345                         Document *ParentDocument = NULL, Library *ParentLibrary = NULL);
00346         // Select/Deselect all groups, all-groups-in-document, all-groups-in-library
00347         // Exclusive indicates if you should apply to the given range or apply to everything
00348         // outside the given range
00349 
00350     void SelectRange(SGDisplayNode *PrimeNode, SGDisplayNode *AnchorNode);
00351         // Selects the PrimeNode, and if possible, all sibling nodes between it and the
00352         // Anchor node. If Anchor == NULL or is not found, only PrimeNode is selected.
00353         // Does not deselect any nodes - you should call SelectItems first to clear the seln.
00354 
00355     INT32 GetSelectedItemCount(Document *TheDocument = NULL, Library *TheLibrary = NULL);
00356         // Determine how many items are selected in the entire tree (NULL, NULL), or
00357         // in the given document/library subtree
00358 
00359     INT32 GetSelectedGroupCount(void);
00360         // Determine how many groups are selected in the entire tree
00361 
00362     virtual void SelectionHasChanged(void);
00363         // Must be called whenever the selection changes, to make the gallery update itself
00364         // (For example shade/unshade available option buttons etc)
00365         // May be overridden by derived galleries to change the shading effects etc.
00366 
00367     inline BOOL AreYouRedrawingNow(void);
00368         // Returns TRUE if we are currently sitting inside the redraw code. Allows display
00369         // items to take special action (for scrolling etc) to avoid reentrant calls
00370         // to the redraw system and unnexcssary invalidations.
00371 
00372     CGadgetID GetListGadgetID(void);
00373         // Returns the Gadget ID of the list box gadget in the Supergallery dialogue window
00374 
00375     INT32 GetDisplayMode() const { return DisplayMode; }
00376         // Returns the current value of the gallery DisplayMode variable
00377 
00378     SGDisplayRoot *GetDisplayTree() const { return DisplayTree; }
00379         // Returns NULL, or a pointer to the display tree root node. Not intended for
00380         // general use - you should be able to access wha you need via other interfaces.
00381         // (Used by some drag targets when doing nasty things)
00382 
00383     virtual BOOL CanSearchKeywords(void);
00384         // Returns FALSE: Overridden by galleries which can supply keywords for searching.
00385 
00386     virtual BOOL GetStatusLineHelp(DocCoord* MousePos, String_256* Result);
00387 
00388 
00389 public:         // Command interface (for Ops and menu support)
00390     virtual BOOL PreContextMenu(void);
00391         // Give the gallery a chance to do something before popping up the context menu
00392         // At present, used by the bitmap gallery to ensure that the plug-ins have all
00393         // been parsed.
00394     
00395     virtual BOOL InitMenuCommands(void);
00396         // Called on startup to initialise any desired menu commands. Will make repeated calls
00397         // to InitMenuCommand(), below.
00398 
00399     BOOL InitMenuCommand(StringBase *CommandID, UINT32 MenuTextID);
00400         // While initialising, this is called to add a potential menu command. (These are
00401         // basically OpDescriptors for gallery menu Ops, so must be around permanently)
00402 
00403     virtual BOOL BuildCommandMenu(GalleryContextMenu *TheMenu, SGMenuID MenuID);
00404         // Builds the command menu for the given menu pop-up (over an item, or options button)
00405 
00406     BOOL AddCommand(GalleryContextMenu *TheMenu, StringBase *CommandID, BOOL Separator = FALSE,
00407                     MenuItem* pRootMenu = NULL);
00408         // Adds the given command to a menu. Called for each item by BuildMenuCommand.
00409 
00410     virtual OpState GetCommandState(StringBase *CommandID, String_256 *ShadeReason);
00411         // Returns an OpState indicating the state of this command, much like an Op GetState
00412 
00413     virtual void DoCommand(StringBase *CommandID);
00414         // Attempts to "do" the given command. Should call down to the base class to handle
00415         // any commands it can't deal with.
00416 
00417     SGDisplayGroup *FindCommandGroup(void);
00418         // Determines which group, if any was clicked "in" for the command (i.e. it finds the
00419         // first selected group or the parent group of the first selected item). May return NULL.
00420 
00421 
00422 protected:      // Protected derived-class interface
00423     void InsertCopiedItem(SGDisplayItem *CopiedItem,
00424                                 SGDisplayGroup *DestGroup,
00425                                 SGDisplayItem *TargetPosition);
00426         // Asks the gallery to insert the given item into the given group.
00427         // Optionally, an item in that group may be specified, in which case the
00428         // CopiedItem will be inserted before/after that item.
00429         // Otherwise, the copied will should be inserted with DestGroup->AddItem()
00430         // SEE CopyDisplayItem, below
00431 
00432 
00433 public:     // Interface generally intended for use by dragging systems
00434     virtual SGDisplayItem *CopyDisplayItem(SGDisplayItem *SourceItem, 
00435                                 SGDisplayGroup *DestGroup,
00436                                 SGDisplayItem *TargetPosition = NULL);
00437         // Asks the gallery to copy (or if appropriate, move) the given item to
00438         // the given group. This hould be done by copying the given item, and
00439         // then calling InsertCopiedItem() to insert it appropriately (see above)
00440 
00441     virtual void AllItemsCopied(SGDisplayGroup *DestGroup);
00442         // Informs the gallery when a sequence of MOVE or COPY actions have been applied
00443         // to the given gallery (see SGDisplayNode::MoveBefore; SGallery::CopyDisplayItem)
00444         // (this allows you to cause a message to be broadcast which sums up all of the
00445         // changes in one go, which is a good thing if a selection of thousands of objects
00446         // has just been moved up one position in the list!)
00447 
00448     SGDisplayNode *FindNodeUnderPointer(DocCoord *ThePoint);
00449         // Finds the (usually SGDisplayItem or SGDisplayGroup) node under the given
00450         // Kernel-rendered-dialogue window coordinate. Used by drag targets to determine
00451         // which item the mouse pointer lies over.
00452 
00453     void AutoScrollForDrag(DocCoord *MousePosition);
00454         // Requests that we scroll the list up/down if the given window mouse position
00455         // is near the top/bottom of the list-box control. Used during drags for autoscroll
00456 
00457     void FillInMiscInfo(SGMiscInfo *MiscInfo,
00458                         ReDrawInfoType *DlgRedrawInfo = NULL);
00459         // Routine to fill in a MiscInfo struct - intended for internal use, and
00460         // occasional use by drag targets.
00461 
00462 
00463 public:     // Interface intended only for use of LibraryFile and Library classes
00464     virtual SGDisplayGroup *AddLibraryGroup(Library *LibraryToDisplay, INT32 NumItems);
00465         // Creates a new group (or overwrites an existing group) for the given Library
00466 
00467     virtual void RemoveLibraryGroup(Library *DisplayedLibrary);
00468         // Ensures that we have no references to the given library in our DisplayTree
00469 
00470     virtual SGDisplayItem *AddLibraryItem(SGDisplayGroup *LibraryGroup, Library *ParentLib,
00471                                             LibraryIndex ItemIndex, BOOL bNew = FALSE);
00472         // Adds an item to the given library display group
00473         // Must be overridden by derived galleries if they wish to handle Libraries
00474 
00475 
00476 protected:
00477     void BroadcastEvent(SGEventType EventType, void *EventInfo, SGMiscInfo *MiscInfo = NULL);
00478         // Sends the given event around the DisplayTree
00479 
00480     void CalcVirtualSize(ReDrawInfoType *DlgRedrawInfo,
00481                                     DocRect *VirtualSize, INT32 *PixelSize);
00482         // Calculates the virtual coordinate space of the visible portion of the displaylist,
00483         // and determines the size of a pixel when mapped into this coord space.
00484 
00485     void RenderListBox(ReDrawInfoType *RedrawInfo);
00486         // Renders the "listbox" region of the dialogue
00487 
00488     void ConvertToVirtualCoords(ReDrawInfoType *DlgRedrawInfo, DocCoord *SourceAndResult);
00489         // Converts a standard DocCoord, as passed in for kernel-rendered dialogues, into
00490         // a standard Display-list virtual coordinate, as used by Display items.
00491 
00492 
00493 public:     // Public version of the above call, for drag targets
00494     void ConvertToVirtualCoords(SGMiscInfo *MiscInfo, DocCoord *SourceAndResult);
00495         // Converts a standard DocCoord, as passed in for kernel-rendered dialogues, into
00496         // a standard Display-list virtual coordinate, as used by Display items.
00497 
00498     BOOL ConvertFromVirtualCoords(SGMiscInfo *MiscInfo, DocRect *SourceAndResult);
00499         // Converts a DisplayList virtual coordinate rectangle into standard kernel-
00500         // rendered dialogue coordinates. Returns FALSE if the rect is not visible.
00501         // (Does NOT clip the returned rectangle to within the visible area)
00502  
00503 
00504 protected:      // Base->Derived class upcalls
00505     virtual BOOL PreCreate(void);
00506     virtual BOOL PostCreate(void);
00507         // Called before/after the window is created (respectively)
00508 
00509     virtual void DoShadeGallery(BOOL ShadeIt);
00510         // Called by SuperGallery::ShadeGallery to allow the derived gallery to add code
00511         // to shade/unshade any extra controls it may have in the window
00512 
00513     virtual void HandleDragStart(DragMessage *DragMsg);
00514         // Called when a drag start message is recieved. Override if you want to
00515         // ignore drags, or if you want to add handling for special drag types.
00516         // Default adds a target for the listbox only for SGListDrag drags
00517 
00518 
00519 public:         // Base->Derived class upcall - also called by display tree nodes sometimes
00520     virtual BOOL ApplyAction(SGActionType Action);
00521         // Applies a given action (new, delete, etc) in the gallery. Item is NULL, or
00522         // a suggested item to apply the action to.
00523 
00524 
00525 public:         // Interface for the options dialogue
00526     SGSortKey *GetCurrentSortKeys(void) { return(SortKeys); }
00527         // Gets a pointer to our array of MaxSGSortModes sort keys
00528 
00529     virtual void ApplySortNow(BOOL ApplyToEntireList);
00530         // Applies the last selected sort mode (again) to our display tree, or to
00531         // group(s) of the display tree wqhich contain selection(s)
00532 
00533 
00534 protected:      // Sorting support
00535     static INT32 __cdecl SortComparator(const void *Item1, const void *Item2);
00536         // a 'qsort' comparator function, used internally by ApplySortNow
00537 
00538     static SuperGallery *CurrentSortGallery;
00539 
00540 public:         // Virtualisation support
00541     BOOL DeVirtualiseAllGroups(StringBase *ProgressBarMsg);
00542         // de-virtualises all the gallery groups
00543 
00544 protected:      // RenderRegion replacement - override to provide anything other than OSRndRgn
00545     virtual RenderRegion *CreateRenderRegion(DocRect *VirtualSize, ReDrawInfoType *DlgRedrawInfo);
00546     virtual void DestroyRenderRegion(RenderRegion *pRender);
00547 
00548 
00549 public:     // Access methods for communications from the DisplayTree nodes
00550     void SetLastSelectedNode(SGDisplayNode *JustSelected);
00551         // Sets the 'memory' of which node was last made selected
00552 
00553     SGDisplayNode *GetLastSelectedNode(void);
00554         // Determines which node was last made selected
00555 
00556 public:     // Library Gallery overrides
00557     virtual BOOL GetQuietStatus(void);
00558         // Get the gallery Quiet button status
00559 
00560     virtual void SetQuietStatus(BOOL Status);
00561         // Set the gallery Quiet button status
00562 
00563     virtual BOOL IsLibraryGallery(void);
00564         // TRUE if the SuperGallery is also a LibraryGallery
00565 
00566     virtual BOOL IsLibraryGalleryWithNonLibraryGroups(void);
00567         // TRUE if the SuperGallery is also a LibraryGallery & has no non-library groups
00568 
00569 public:     // Base SGDisplayNode access for implentation of background redraws
00570     void IncrementPendingRedraws(void);
00571         // Adds another item to the number enqueued for BG redraw and adds an idle
00572         // processor to provide BG redraw if necessary.
00573 
00574     void DecrementPendingRedraws(void);
00575         // Removes an item from the number enqueued for BG redraw and removes any
00576         // idle processor if idles are no longer needed
00577 
00578     virtual BOOL OnIdleEvent(void);
00579         // Handles idle events (when enabled) to provide background redraws
00580 
00581     void FlushBackgroundRedraws(void);
00582         // Ensures that no nodes in the tree are waiting for background redraws,
00583         // and resets our bg rendering system (so if it gets confused, this call will
00584         // resurrect it by resetting the state)
00585 
00586     void SetLastBackgroundNode(SGDisplayNode *LastNodeRendered)     \
00587                                 { LastBGNode = LastNodeRendered; }
00588         // Tell the supergallery which node was last rendered by the BG rendering system
00589 
00590     SGDisplayNode *GetLastBackgroundNode(void)      \
00591                                 { return(LastBGNode); };
00592         // Retrieve a pointer to the last node which was background rendered
00593 
00594 
00595 protected:
00596     INT32           PendingRedraws; // Counter indicating when we need an idle event handler
00597                                     // in order to handle pending background redraw of items
00598 
00599     SGDisplayNode   *LastBGNode;    // Points to the last node we background rendered
00600 
00601 
00602 public:
00603     SGDisplayRoot   *DisplayTree;   // Pointer to the Display Tree
00604 protected:          // Display tree information
00605     INT32               DisplayMode;    // Current display mode identifier
00606     BOOL            FormatIsCached; // TRUE if the format info for the display tree is cached
00607 
00608     INT32           LastWindowDX;   // Last size of the display window. If this size changes
00609     INT32           LastWindowDY;   // then we must make sure the display is reformatted
00610 
00611     BOOL            AmShaded;       // TRUE if the gallery is currently in a shaded state
00612     BOOL            AmRedrawing;    // Lock: TRUE if the gallery is inside the redraw handler
00613 
00614     SGDisplayNode   *LastSelectedNode;  // Points to the last node which was made selected
00615 
00616     MonotonicTime   LastClickTime;      // Remembers time when a listbox click was last received
00617     DocCoord        LastClickPos;       // Pos of last click (dbl-click must be close to this)
00618     BOOL            DblClickPending;    // Indicates we expect 2nd click in double click
00619 
00620 
00621 protected:          // For access by our friend classes only
00622     SGalleryOptionsDlg *CurrentOptionsDlg;  // NULL, or the currently open opts dlg
00623                                             // (Set by friend class SGalleryOptionsDlg)
00624 
00625     SGallerySortDlg *CurrentSortDlg;        // NULL, or the currently open sort dlg
00626                                             // (Set by friend class SGallerySortDlg)
00627 
00628     SGallerySearchDlg *CurrentSearchDlg;    // NULL, or the currently open search dlg
00629                                             // (Set by friend class SGallerySearchDlg)
00630 
00631     SGSortKey       SortKeys[MaxSGSortKeys];// An array describing the last applied sort mode
00632 
00633     SGalleryLinePropertiesDlg *CurrentLinePropertiesDlg;    // NULL, or the currently open line properties dlg
00634                                             // (Set by friend class SGalleryLinePropertiesDlg)
00635 
00636     virtual void CloseOwnedDialogs(void);   // Closes any of the above dialogs if open
00637 
00638 public:     // Global gallery preferences
00639     static INT32        UseFixedColourSet;      // TRUE (default) to override Windows colours
00640 
00641 public:
00642     virtual BOOL IsABar() {return FALSE; }      // We are not a bar
00643     virtual BOOL IsAGallery() {return TRUE; }   // We are a gallery
00644     static SuperGallery* FindSuperGallery(String_32& SuperGalleryName, INT32 limit = -1);
00645     static SuperGallery* FindSuperGallery(ResourceID SuperGalleryID);
00646 
00647     String_32       Name;
00648     String_32&      GetGalName()                            { return Name; }
00649     void            SetGalName(const String_32& str)        { Name = str; }
00650 
00651 };
00652 
00653 
00654 
00655 
00656 
00657 /********************************************************************************************
00658 
00659 >   inline void SuperGallery::InvalidateCachedFormat(void)
00660 
00661     Author:     Jason_Williams (Xara Group Ltd) <camelotdev@xara.com>
00662     Created:    17/1/95
00663     Purpose:    Indicates to the super gallery that the cached display tree formatting is
00664                 out of date, and must be recalculated before next redraw of the display
00665 
00666 ********************************************************************************************/
00667 
00668 void SuperGallery::InvalidateCachedFormat(void)
00669 {
00670     FormatIsCached = FALSE;
00671 }
00672 
00673 
00674 
00675 /********************************************************************************************
00676 
00677 >   inline BOOL SuperGallery::AreYouRedrawingNow(void)
00678 
00679     Author:     Jason_Williams (Xara Group Ltd) <camelotdev@xara.com>
00680     Created:    3/2/95
00681 
00682     Returns:    TRUE if we are currently processing a redraw event
00683 
00684     Purpose:    To determine if the gallery is currently redrawing. This is necessary
00685                 for two reasons: (1) To ensure we don't go re-entrant in redraw code
00686                 (because we can't have more than one active render region or it'll go
00687                 bang), (2) To allow things like the SGDisplayRootScroll to take special
00688                 action when they try to chnage the scroll position if we are in a redraw
00689                 (obviously at this point, doing a ScrollWindow and force redraws would
00690                 be silly, if not downright dangerous)
00691 
00692 ********************************************************************************************/
00693 
00694 BOOL SuperGallery::AreYouRedrawingNow(void)
00695 {
00696     return(AmRedrawing);
00697 }
00698 
00699 
00700 
00701 
00702 
00703 
00704 
00705 
00706 typedef struct
00707 {
00708     SGSortKey   SortKey;
00709     UINT32      ListControlID;
00710     UINT32      CheckControlID;
00711 } SGOptsSortInfo;
00712 
00713 
00714 /***********************************************************************************************
00715 
00716 >   class SGalleryOptionsDlg : public DialogOp
00717 
00718     Author:     Jason_Williams (Xara Group Ltd) <camelotdev@xara.com>
00719     Created:    9/3/95
00720 
00721     Purpose:    A dialogue box allowing the user to set the gallery properties (display
00722                 options) for its parent gallery
00723 
00724     SeeAlso:    SuperGallery; SGalleryOptionsDlg::InvokeDialog
00725 
00726 ***********************************************************************************************/
00727 
00728 #define OPTOKEN_SGOPTIONSDLG _T("GalleryOptionsDlg")
00729 
00730 
00731 class SGalleryOptionsDlg : public DialogOp
00732 {
00733     CC_DECLARE_DYNCREATE(SGalleryOptionsDlg)
00734 
00735 public:
00736     SGalleryOptionsDlg();
00737     ~SGalleryOptionsDlg();
00738 
00739     MsgResult Message(Msg *Message);
00740 
00741     void Do(OpDescriptor*);
00742     void DoWithParam(OpDescriptor*, OpParam *Param);
00743 
00744     static BOOL Init();
00745     BOOL Create();
00746     static OpState GetState(String_256*, OpDescriptor*);
00747 
00748     static const UINT32 IDD;
00749     static const CDlgMode Mode;
00750 
00751     static void InvokeDialog(SuperGallery *Parent);
00752         // Call this method to create and display a gallery options dialogue
00753 
00754     void AddDisplayModeName(UINT32 NameResourceID);
00755     void AddDisplayModeName(StringBase *EntryName);
00756         // Called by derived gallery from ApplyAction(SGACTION_SETOPTIONS) function to set
00757         // each entry in turn of their display mode combobox list.
00758 
00759 
00760 protected:
00761     SuperGallery *ParentGallery;
00762 
00763     void InitValues(void);
00764     void SetControls(void);
00765 
00766     void Commit(void);
00767 };
00768 
00769 
00770 
00771 
00772 
00773 
00774 /***********************************************************************************************
00775 
00776 >   class SGallerySortDlg : public DialogOp
00777 
00778     Author:     Jason_Williams (Xara Group Ltd) <camelotdev@xara.com>
00779     Created:    19/9/95 (separated from opts dlg)
00780 
00781     Purpose:    A dialogue box allowing the user to apply a sort mode to its parent
00782                 SuperGallery DisplayTree
00783 
00784     SeeAlso:    SuperGallery; SGallerySortDlg::InvokeDialog
00785 
00786 ***********************************************************************************************/
00787 
00788 #define OPTOKEN_SGSORTDLG _T("GallerySortDlg")
00789 
00790 
00791 class SGallerySortDlg : public DialogOp
00792 {
00793     CC_DECLARE_DYNCREATE(SGallerySortDlg)
00794 
00795 public:
00796     SGallerySortDlg();
00797     ~SGallerySortDlg();
00798 
00799     MsgResult Message(Msg *Message);
00800 
00801     void Do(OpDescriptor*);
00802     void DoWithParam(OpDescriptor*, OpParam *Param);
00803 
00804     static BOOL Init();
00805     BOOL Create();
00806     static OpState GetState(String_256*, OpDescriptor*);
00807 
00808     static const UINT32 IDD;
00809     static const CDlgMode Mode;
00810 
00811     static void InvokeDialog(SuperGallery *Parent);
00812         // Call this method to create and display a gallery options dialogue
00813 
00814     void AddSortKeyName(UINT32 NameResourceID);
00815     void AddSortKeyName(StringBase *EntryName);
00816         // Called by derived gallery from ApplyAction(SGACTION_SETOPTIONS) function to set
00817         // each entry in turn of their sort key combobox lists.
00818 
00819 
00820 protected:
00821     void ShadeSortFields(void);
00822         // Shades/unshades the sort fields as appropriate to the do-sort button
00823 
00824 protected:
00825     SuperGallery *ParentGallery;
00826 
00827     void InitValues(void);
00828     void SetControls(void);
00829 
00830     void Commit(void);
00831 
00832 protected:
00833     static SGOptsSortInfo GallerySorts[MaxSGSortKeys];
00834 };
00835 
00836 
00837 
00838 
00839 
00840 
00841 /***********************************************************************************************
00842 
00843 >   class SGallerySearchDlg : public DialogOp
00844 
00845     Author:     Jason_Williams (Xara Group Ltd) <camelotdev@xara.com>
00846     Created:    12/3/95
00847 
00848     Purpose:    A dialogue box allowing the user to search a gallery DisplayTree for items
00849                 whose name or fullinfo text contains a given string.
00850 
00851     SeeAlso:    SuperGallery; SGallerySearchDlg::InvokeDialog
00852 
00853 ***********************************************************************************************/
00854 
00855 #define OPTOKEN_SGSEARCHDLG _T("GallerySearchDlg")
00856 
00857 
00858 class SGallerySearchDlg : public DialogOp
00859 {
00860     CC_DECLARE_DYNCREATE(SGallerySearchDlg)
00861 
00862 public:
00863     SGallerySearchDlg();
00864     ~SGallerySearchDlg();
00865 
00866     MsgResult Message(Msg *Message);
00867 
00868     void Do(OpDescriptor*);
00869     void DoWithParam(OpDescriptor*, OpParam *Param);
00870 
00871     static BOOL Init();
00872     BOOL Create();
00873     static OpState GetState(String_256*, OpDescriptor*);
00874 
00875     static const UINT32 IDD;
00876     static const CDlgMode Mode;
00877 
00878     static void InvokeDialog(SuperGallery *Parent);
00879         // Call this method to create and display a gallery options dialogue
00880 
00881 protected:
00882     SuperGallery *ParentGallery;
00883 
00884     void InitValues(void);
00885     void SetControls(void);
00886 
00887     void Search(BOOL FindFirst);            // Reads the current window settings and searches
00888 
00889     inline SGDisplayItem *SearchFindNextItem(SGDisplayItem *LastItem, Progress *Hourglass = NULL);  // Get next item
00890     inline SGDisplayItem *SearchFindStartItem(BOOL FindFirst);          // Get first item
00891 
00892     inline BOOL DoComparison(SGDisplayItem *Item, StringBase *SearchText, BOOL UseKeywords = FALSE,
00893                 BOOL ItsALibrary = FALSE, BOOL FullInfo = FALSE);
00894 
00895     static BOOL LastSearchFullInfo;         // TRUE if the last search was on full info
00896     static String_64 LastSearchText;        // The text used for the last search
00897 };
00898 
00899 #endif // INC_SGALLERY

Generated on Sat Nov 10 03:46:49 2007 for Camelot by  doxygen 1.4.4