FrameSGallery Class Reference

The Layer SuperGallery class. More...

#include <sgframe.h>

Inheritance diagram for FrameSGallery:

LayerSGallery SuperGallery DialogOp Operation MessageHandler ListItem CCObject SimpleCCObject List of all members.

Public Member Functions

 FrameSGallery ()
 FrameSGallery default constructor.
 ~FrameSGallery ()
 FrameSGallery destructor.
virtual MsgResult Message (Msg *Message)
 A standard message handler, really.
virtual BOOL InitMenuCommands (void)
 Initialises any menu commands that this gallery needs.
virtual BOOL BuildCommandMenu (GalleryContextMenu *TheMenu, SGMenuID MenuID)
 To build a menu of commands to be popped up over the gallery.
virtual OpState GetCommandState (StringBase *CommandID, String_256 *ShadeReason)
 To determine the state of a given menu item. This method is an exact parallel to an Op's GetState method (in fact, it is called by an Op's GetState).
virtual void DoCommand (StringBase *CommandID)
 To apply a given command when it is chosen from the menu.
virtual void CreateNewSubtree (Document *ParentDoc, SGDisplayGroup *ExistingGroup=NULL)
 Internal call. This takes the Layer list of the given document and creates a DisplayTree subtree from it. This subtree is then added to the DisplayTree. Note that this does not force a redraw of the list - after making this call, you should also call ForceRedrawOfList.

Static Public Member Functions

static void MakeActiveLayer (Layer *pNewActiveLayer, UndoableOperation *pUndoOp=NULL)
 Makes the layer active. Firstly it will inactivate any other active layers, forcing it to redraw if necessary Then it will set this layer to be active, again forcing a redraw if necessary.
static void SetActive (Document *pDoc, Layer *pLayer, BOOL state)
 Calls pLayer->SetActive(state), redrawing and changing the layer's selection if necessary. DON'T CALL THIS FUNC!! USE MakeActiveLayer() INSTEAD!!!!
static String_256 CreateUniqueLayerID (Spread *pSpread, const String_256 *pBaseName=NULL)
 This function tries to hide the specified node. Copy of the undoable operation version as we are not undoable and don't have an op. Hide it as it may be mentioned in the undo history. Note: This would be safer than deleting the layer nodes but if we use this, which should be the same as the DoHideNode in undoable operation does, then it leaks the hidden nodes and layers that are being hidden. So there must be something sneaky going on.Used to generate a LayerID which is unique for the spread. The name generated is normally of the form "Layer n", where n is the number of layers in the spread + 1. If "Layer n" already exists on the spread then "Layer m" is generated where m is the smallest integer greater than n such that the id is unique.
static BOOL EnsureFrameLayerIntegrity (Spread *pSpread)
 This checks that there is one and only one active layer in the given spread. If there isn't an active layer, the first layer is made active. If there is more than on active layer, all but the first active layer are made inactive.This function should be called before any frame related actions are carried out It will ensure that all the visible layers are frame layers.
static BOOL DoHideNode (Node *pNodeToHide)
static void DoChangeSolid (Layer *pLayer, BOOL Solid)
 Called when the Solid button is clicked in a layer gallery item. Changes the Solidness of the displayed layer.
static void DoChangeOverlay (Layer *pLayer, BOOL Overlay)
 Called when the Overlay button is clicked in a layer gallery item. Changes the Overlayness of the displayed layer.
static void FixOtherLayers (Spread *pSpread)
 A layer flag such as overlay or solid has been changed and so we need to go and find the active layer and ensure that the other layers above and below this have the correct visibility and locked settings.
static void FixOtherLayersFromActive (Layer *pActiveLayer, UndoableOperation *pUndoOp=NULL)
 A layer flag such as overlay or solid has been changed and so we need take the passed in current active layer and then ensure that the other layers above and below this have the correct visibility and locked settings.

Protected Member Functions

virtual BOOL PostCreate (void)
 The FrameSGallery PostCreate handler. This overrides the base class PostCreate function. It is called at the very end of the SuperGallery::Create method, after the window has been created and opened.
virtual BOOL ApplyAction (SGActionType Action)
 Applies certain conventional gallery actions (usually associated with gallery buttons, for new, edit, delete, etc).
virtual void DoShadeGallery (BOOL ShadeIt)
 Called by the base class whenever the shaded status of the gallery is changed, to allow derived galleries to shade/unshade any extra controls that they provide in the window. ONLY called if the gallery is actually open/visible.
virtual void EnsureSelSpreadSelectionIntegrity ()
 This makes sure that all the invisible and/or locked layers in the spread have no selection. It calls NodeRenderableInk::DeselectAllOnLayer() on each layer that should NOT have a selection, just in case. Currently only called after an undo or redo op, because it could be quite slow.
virtual SGDisplayLayerGetSelectedLayerGalItem ()
 Gets the selected layer gallery item In debug builds, an ENSURE will go off if there is no selected gal item.
virtual void DoMoveLayer (MoveLayerType Reason)
 Called when the Locked button is clicked in the layers gallery. Changes the lockedness of the selected layer, if there is one.
virtual BOOL DoDeleteSelection (void)
 FORCIBLY deletes the active layer/frame.
virtual void DoCreateNewItem (void)
 This function is meant to be overridden in derived classes It creates a new item and adds it to the Gallery DisplayList The item may be created by cloning/deriving/basing-on the selected item, depending on the type of Gallery concerned.
virtual void DoCopyLayer ()
 Copies the active layer creating a new one with a default frame name.
virtual BOOL DoSaveAnimation ()
 Saves out the current animation to file.
virtual BOOL DoPreviewAnimation ()
 Previews the current animation.
virtual BOOL DoFrameProperties ()
 Opens the frame properties dlg.
virtual BOOL DoRegenerateFrames ()
 While previewing an animation, if the spread properties are changed we neeed to regenerate the frame layers. This function invokes the correct Op.
virtual BOOL DoRegenerateSingleFrame ()
 While previewing an animation, if the frame layer properties are changed we neeed to regenerate the active frame. This function invokes the correct Op.
BOOL UpdateFrameRelatedButtons ()
 Ensures that they buttons on the gallery up to date in their greying/ungreying status.
BOOL IsFrameMode (Document *pDoc)
BOOL CloseFrameGallery ()
BOOL OpenLayerGallery ()
void SetNewDocBorn (BOOL Val)
BOOL GetNewDocBorn ()

Protected Attributes

BOOL m_NewDocBorn

Detailed Description

The Layer SuperGallery class.

Author:
Neville_Humphrys (Xara Group Ltd) <camelotdev@xara.com> (Based on Jason's Layer gallery code)
Date:
16/4/97 (Based on Jason's Layer gallery code)
Notes: SuperGalleries are specced in a number of docs including specs.doc ("super" gallery extensions) specs.doc (gallery basic ui) There is also howtouse.doc which describes creating a supergallery

See also:
SuperGallery; SGDisplayFrame

Definition at line 224 of file sgframe.h.


Constructor & Destructor Documentation

FrameSGallery::FrameSGallery  ) 
 

FrameSGallery default constructor.

Author:
Neville_Humphrys (Xara Group Ltd) <camelotdev@xara.com> (Based on Jason's Layer gallery code)
Date:
16/4/97 (Based on Jason's Layer gallery code)

Definition at line 1006 of file sgframe.cpp.

01007 {
01008 #ifndef EXCLUDE_GALS
01009     pSpread = NULL;
01010     pDoc = NULL;
01011     DisplayForeground = NULL;   // Group of foreground layers
01012     DisplayBackground = NULL;   // Group of background layers
01013 
01014     OldGuideLayerState = -1;
01015     NewGuideLayerState = -1;
01016     m_NewDocBorn = FALSE;
01017 #endif
01018 } 

FrameSGallery::~FrameSGallery  ) 
 

FrameSGallery destructor.

Author:
Neville_Humphrys (Xara Group Ltd) <camelotdev@xara.com> (Based on Jason's Layer gallery code)
Date:
16/4/97 (Based on Jason's Layer gallery code)

Definition at line 1032 of file sgframe.cpp.

01033 {
01034 }


Member Function Documentation

BOOL FrameSGallery::ApplyAction SGActionType  Action  )  [protected, virtual]
 

Applies certain conventional gallery actions (usually associated with gallery buttons, for new, edit, delete, etc).

Author:
Neville_Humphrys (Xara Group Ltd) <camelotdev@xara.com> (Based on Jason's Layer gallery code)
Date:
16/4/97 (Based on Jason's Layer gallery code)
Parameters:
Action - Indicates what action to apply [INPUTS]
Returns:
TRUE to indicate successful handling of the action, or FALSE to indicate failure
See also:
SGActionType

Reimplemented from LayerSGallery.

Definition at line 1265 of file sgframe.cpp.

01266 {
01267     // No display tree? Better forget about it then!
01268     if (DisplayTree == NULL)
01269         return(FALSE);
01270 
01271     // Determine useful info - this is usually needed for most actions, so always get it
01272     Document        *SelectedDoc = Document::GetSelected();
01273     SGDisplayGroup  *DocumentGroup = DisplayTree->FindSubtree(this, SelectedDoc, NULL);
01274     SGDisplayFrame  *FirstSelected = NULL;
01275     
01276     if (DocumentGroup != NULL)
01277         FirstSelected = (SGDisplayFrame *) DocumentGroup->FindNextSelectedItem(NULL);
01278 
01279     // Now, process the action  TO DO! - see Colour gallery for examples
01280     switch(Action)
01281     {
01282         case SGACTION_CREATE:
01283             DoCreateNewItem();
01284             break;
01285 
01286         case SGACTION_EDIT:
01287             DoChangeName();
01288             break;
01289 
01290         case SGACTION_DELETE:
01291             //if (PrepareToDelete()) // No warning on Frame gallery
01292             DoDeleteSelection();
01293             break;
01294         
01295 //      case SGACTION_APPLY:
01296 //      case SGACTION_REDEFINE:
01297 //      case SGACTION_DISPLAYMODECHANGED:
01298 //          These operations are not provided by the layer gallery
01299 //          break;
01300 
01301         default:
01302             return(SuperGallery::ApplyAction(Action));
01303     }
01304 
01305     return(TRUE);
01306 }

BOOL FrameSGallery::BuildCommandMenu GalleryContextMenu TheMenu,
SGMenuID  MenuID
[virtual]
 

To build a menu of commands to be popped up over the gallery.

Author:
Neville_Humphrys (Xara Group Ltd) <camelotdev@xara.com> (Based on Jason's Layer gallery code)
Date:
16/4/97 (Based on Jason's Layer gallery code)
Parameters:
TheMenu - The menu to add commands to [INPUTS] MenuID - The type of menu (over-list or from-options-button) to create
Returns:
TRUE if it succeeded
Notes: The Layer gallery provides only a simple item-pop-up menu

Reimplemented from LayerSGallery.

Definition at line 2854 of file sgframe.cpp.

02855 {
02856     BOOL ok = TRUE;
02857 
02858     if (MenuID == SGMENU_OVERITEM)
02859     {
02860         // Over-list menu
02861         SGDisplayLayer* pLayerGalItem = GetSelectedLayerGalItem();
02862 
02863 #ifndef STANDALONE
02864 // no layer properties tab present on standalone version
02865         if (pLayerGalItem != NULL)
02866         {
02867             GIFAnimationPropertyTabs * pTabHandler = GIFAnimationPropertyTabsDlg::GetGIFAnimationPropertiesTabs();
02868             //LayerPropertyTabs * pTabHandler = LayerPropertyTabsDlg::GetLayerPropertiesTabs();
02869             if (pTabHandler)
02870             {
02871                 pTabHandler->SetCurrentLayer(pLayerGalItem->GetDisplayedLayer());
02872             }
02873         }
02874 #endif
02875         ok = ok && AddCommand(TheMenu, (StringBase *) &SGCmd_New);
02876         ok = ok && AddCommand(TheMenu, (StringBase *) &SGCmd_Copy);
02877         ok = ok && AddCommand(TheMenu, (StringBase *) &SGCmd_Delete,TRUE);
02878 #ifndef STANDALONE
02879 //      ok = ok && AddCommand(TheMenu, (StringBase *) &SGCmd_Animation);
02880 //      ok = ok && AddCommand(TheMenu, (StringBase *) &SGCmd_Save);
02881         ok = ok && AddCommand(TheMenu, (StringBase *) &SGCmd_Preview);
02882         ok = ok && AddCommand(TheMenu, (StringBase *) &SGCmd_Properties);
02883 //      ok = ok && AddCommand(TheMenu, (StringBase *) &SGCmd_FrameProps);
02884 //      ok = ok && AddCommand(TheMenu, (StringBase *) &SGCmd_Browser);
02885         ok = ok && AddCommand(TheMenu, (StringBase *) &SGCmd_Show);
02886 #endif
02887     }
02888 
02889     return(ok);
02890 }

BOOL FrameSGallery::CloseFrameGallery  )  [protected]
 

Author:
Ranbir_Rana (Xara Group Ltd) <camelotdev@xara.com>
Date:
21/10/97
Parameters:
- [INPUTS]
Returns:
TRUE if sucessful, else FALSE.

Definition at line 3273 of file sgframe.cpp.

03274 {
03275     String_32 Name(_R(IDS_FRAMEGAL_GALLNAME));
03276     DialogBarOp* pDialogBarOp = DialogBarOp::FindDialogBarOp(Name);
03277 
03278     // Ensure a valid ptr.
03279     if (pDialogBarOp == NULL)
03280         return FALSE;
03281     
03282     if (pDialogBarOp->GetRuntimeClass() == CC_RUNTIME_CLASS(FrameSGallery))
03283     {
03284         GIFAnimationPropertyTabs::SetFrameGalleryOpen(FALSE);
03285 
03286         // Toggle the visible state of the gallery window
03287         pDialogBarOp->SetVisibility( FALSE );
03288     }
03289     else
03290     {
03291         ERROR3("Got the frame gallery but it's not of the LayerSGallery class");
03292     }
03293 
03294     SGInit::UpdateGalleryButton(OPTOKEN_DISPLAYFRAMEGALLERY, FALSE);
03295 
03296     GIFAnimationPropertyTabs::SetFrameGalleryOpen(FALSE);
03297 
03298     // Everything ok.
03299     return TRUE;
03300 }

void FrameSGallery::CreateNewSubtree Document ParentDoc,
SGDisplayGroup ExistingGroup = NULL
[virtual]
 

Internal call. This takes the Layer list of the given document and creates a DisplayTree subtree from it. This subtree is then added to the DisplayTree. Note that this does not force a redraw of the list - after making this call, you should also call ForceRedrawOfList.

Author:
Neville_Humphrys (Xara Group Ltd) <camelotdev@xara.com> (Based on Jason's Layer gallery code)
Date:
16/4/97 (Based on Jason's Layer gallery code)
Parameters:
ParentDoc - The document to create a display subtree for [INPUTS] ExistingGroup - NULL (creates a new group for this document), or a pointer to the existing group-node for this document (in which case it clears all displayitems from the group and rebuilds it in place - this stops the display group moving around the tree at random!)
Notes: Passing in a NULL parent document pointer results in an ERROR3 - the function returns without doing anything in retail builds

See also:
SuperGallery::ForceRedrawOfList

Reimplemented from LayerSGallery.

Definition at line 1063 of file sgframe.cpp.

01064 {
01065     if (DisplayTree == NULL)
01066         return;
01067 
01068 TRACEUSER( "Neville", _T("FrameSGallery::CreateNewSubtree Just about to DestroySubtree\n"));
01069     // The layer gallery only ever shows one document, so destroy the entire tree
01070     // and start again from scratch (note that this doesn't destroy the root node)
01071     DisplayTree->DestroySubtree();
01072 
01073     // All groups will be destroyed by DestroySubtree(), so we'd better forget them
01074     DisplayForeground = NULL;
01075     
01076 TRACEUSER( "Neville", _T("FrameSGallery::CreateNewSubtree completed DestroySubtree\n"));
01077 
01078     if (ParentDoc == NULL)
01079         return;
01080 
01081     SGDisplayFrame  *DisplayLayer = NULL;
01082 
01083     EnsureActiveLayerIntegrity();
01084 
01085     // Create the foreground layer group
01086     DisplayForeground = new SGFrameGroup(this, ParentDoc,NULL,TRUE);    // Create new Group
01087     if (DisplayForeground == NULL)                                      // Total failure - abort
01088         return;
01089     DisplayTree->AddItem(DisplayForeground);                            // Add new group to tree
01090 
01091     Spread* pSelSpread = GetSelectedSpread();
01092     ERROR3IF(pSelSpread == NULL,"No selected spread in FrameSGallery");
01093     if (pSelSpread == NULL) return;
01094 
01095     Layer* pLayer                   = pSelSpread->FindLastLayer();
01096     Layer* pActiveLayer             = NULL;
01097     Layer* pGuideLayer              = NULL;
01098     BOOL SetActiveLayer             = FALSE;
01099 // Only Webster needs to show a dummy frame layer 
01100 #ifdef WEBSTER
01101     Layer* pSingleNonFrameLayer     = NULL;
01102     BOOL ShownSingleNonFrameLayer   = FALSE;
01103 #endif // WEBSTER
01104 
01105     while (pLayer != NULL)
01106     {
01107         // If we find a guide layer then note that for future use
01108         if (pLayer->IsGuide())
01109         {
01110             pGuideLayer = pLayer;
01111         }
01112         else if (
01113                  (pLayer->IsPseudoFrame() && pLayer->IsFrame())             // its a proper frame layer
01114 #ifdef WEBSTER
01115                  || (pLayer->IsPseudoFrame() && !ShownSingleNonFrameLayer)  // its a potential frame layer
01116 #endif // WEBSTER
01117                 )
01118         {
01119 #ifdef WEBSTER
01120             // If its not a frame layer then note that we have added our single
01121             // non-frame layer in.
01122             if (!pLayer->IsFrame())
01123             {
01124                 ShownSingleNonFrameLayer = TRUE;
01125                 pSingleNonFrameLayer = pLayer;
01126             }
01127 #endif // WEBSTER
01128 
01129             // Only add foreground layers and non-guide layers
01130             DisplayLayer = new SGDisplayFrame(pLayer);
01131 
01132             if (DisplayLayer != NULL)
01133             {
01134                 // Always add to the foreground layers
01135                 DisplayForeground->AddItem(DisplayLayer);
01136 
01137                 if (pLayer->IsActive())
01138                 {
01139                     ERROR3IF(pActiveLayer != NULL,"Found more than one active layer in the selected spread");
01140                     pActiveLayer = pLayer;
01141 
01142                     DisplayLayer->SetSelected(TRUE);    // Make the active layer selected
01143                     SetActiveLayer = TRUE;              // Note this fact
01144                 }
01145             }
01146         }
01147 
01148         pLayer = pLayer->FindPrevLayer();
01149     }
01150 
01151     // If we have not set a selected layer then this is very bad
01152     if (!SetActiveLayer)
01153     {
01154         TRACEUSER( "Neville", _T("Active layer is not a frame layer so force it!\n"));
01155         Layer * pNewActiveLayer = pSpread->FindLastFrameLayer();
01156 #ifdef WEBSTER
01157         if (pNewActiveLayer == NULL && pSingleNonFrameLayer != NULL)
01158             pNewActiveLayer = pSingleNonFrameLayer;
01159 #else
01160 //      ERROR3IF(pNewActiveLayer == NULL,"No current active frame layer");
01161 #endif // WEBSTER
01162 
01163         // If we have an active layer, ensure that it really is the one and only active layer
01164         if (pNewActiveLayer != NULL)
01165         {
01166             // Search for the new display item to match this new active layer 
01167             SGDisplayLayer *pWantedDispLayer = NULL;
01168             SGDisplayLayer *pDispLayer = ((SGDisplayLayer *) DisplayForeground->GetChild());
01169             while (pDispLayer != NULL)                      
01170             {
01171                 if (pDispLayer->GetDisplayedLayer() == pNewActiveLayer)
01172                     pWantedDispLayer = pDispLayer;
01173                 pDispLayer = ((SGDisplayLayer *)pDispLayer->GetNext());
01174             }
01175             
01176             // If we found the required display item then go and select it
01177             if (pWantedDispLayer)
01178             {
01179                 // Now update the selection states...
01180                 SelectItems(FALSE); // Deselect everything else
01181                 // Something has changed so we must go and select this new item
01182                 pWantedDispLayer->SetSelected(TRUE);
01183             }
01184 
01185             // As this can only happen when we have a frame layer which is not active
01186             // e.g. import a non-frame xar/web document into a non-frame document
01187             // we must use the layer form of MakeActiveLayer so that the visibility of
01188             // layers is not affected. 
01189             LayerSGallery::MakeActiveLayer(pNewActiveLayer);
01190             //FrameSGallery::MakeActiveLayer(pNewActiveLayer);
01191         }
01192     }
01193 
01194     // The new state of the Guide Layer is now the old state
01195     OldGuideLayerState = NewGuideLayerState;
01196 
01197     if (pGuideLayer == NULL)
01198         NewGuideLayerState = -1;                        // If there's no guide layer, set new state to be -1
01199     else
01200         NewGuideLayerState = pGuideLayer->IsVisible();  // New state is based on the guide layer's visibility
01201 
01202     if (IsVisible())
01203     {
01204         SetBoolGadgetSelected(_R(IDC_BTN_MULTILAYER),!(ParentDoc->IsMultilayer() == 0));
01205         SetBoolGadgetSelected(_R(IDC_BTN_ALLVISIBLE),!(ParentDoc->IsAllVisible() == 0));
01206     }
01207 
01208     TRACEUSER( "Neville", _T("FrameSGallery::CreateNewSubtree exit\n"));
01209 }

String_256 FrameSGallery::CreateUniqueLayerID Spread pSpread,
const String_256 pBaseName = NULL
[static]
 

This function tries to hide the specified node. Copy of the undoable operation version as we are not undoable and don't have an op. Hide it as it may be mentioned in the undo history. Note: This would be safer than deleting the layer nodes but if we use this, which should be the same as the DoHideNode in undoable operation does, then it leaks the hidden nodes and layers that are being hidden. So there must be something sneaky going on.Used to generate a LayerID which is unique for the spread. The name generated is normally of the form "Layer n", where n is the number of layers in the spread + 1. If "Layer n" already exists on the spread then "Layer m" is generated where m is the smallest integer greater than n such that the id is unique.

Author:
Neville_Humphrys (Xara Group Ltd) <camelotdev@xara.com> (Based on Mark N's function in the Layer gallery code)
Date:
16/4/97 (Based on Jason's Layer gallery code)
Parameters:
pSpread - the spread to use when checking [INPUTS] pBaseName - the name to use as the basis of the layer name, defaults to just 'Frame'
Returns:
A LayerID which is unique for the layer galleries spread.

Errors: -

See also:
-

Definition at line 2425 of file sgframe.cpp.

02426 {
02427     if (pSpread == NULL) return String_256("");
02428 
02429     String_256 UniqueLayerID; 
02430     INT32 NumLayers = 0; 
02431 
02432     Layer* pLayer = pSpread->FindFirstLayer();
02433 
02434     // Calculate how many layers are on the current spread
02435     while (pLayer != NULL)
02436     {
02437         NumLayers++;
02438         pLayer = pLayer->FindNextLayer();
02439     }
02440 
02441     INT32 NewLayerNum = NumLayers;
02442     if (NewLayerNum == 0)
02443         NewLayerNum = 1; // Always start at one
02444 
02445     BOOL Unique;  // Flag used to indicate if the id generated is unique or not 
02446     String_256 LayerName(_R(IDS_DEFAULTFRAMENAME));
02447     // If the caller suggested a base name then use this instead.
02448     if (pBaseName != NULL)
02449         LayerName = *pBaseName;
02450 
02451     do 
02452     {
02453         // Construct a first attempt at a unique layer id 'Layer n' 
02454         // where n = the number of layers on the current spread + 1
02455         UniqueLayerID.MakeMsg(_R(IDS_FRAMENAMEUNIQUEFORM), (TCHAR *)LayerName, NewLayerNum);
02456         //UniqueLayerID.MakeMsg(_R(IDS_SGLAYER_LAYER_NUM), /*TEXT("Layer #1%ld"),*/NewLayerNum);
02457     
02458         // Check that UniqueLayerID is indeed unique 
02459         Unique = TRUE; // Until we know better 
02460         pLayer = pSpread->FindFirstLayer();
02461         while (pLayer != NULL)
02462         {   
02463             if (UniqueLayerID == pLayer->GetLayerID())
02464             {
02465                 Unique = FALSE; 
02466 
02467                 // UniqueLayerID is not unique so increment NewLayerNum and try again 
02468                 NewLayerNum++;      
02469                 break; 
02470             }
02471             pLayer = pLayer->FindNextLayer();
02472         }
02473         
02474     } while (!Unique); 
02475 
02476     return(UniqueLayerID); 
02477 }

void FrameSGallery::DoChangeOverlay Layer pLayer,
BOOL  Overlay
[static]
 

Called when the Overlay button is clicked in a layer gallery item. Changes the Overlayness of the displayed layer.

Author:
Neville_Humphrys (Xara Group Ltd) <camelotdev@xara.com> (Based on Mark N's function in the Layer gallery code)
Date:
16/4/97 (Based on Jason's Layer gallery code)
Parameters:
pLayer = the layer to change [INPUTS] Overlay - TRUE means make the displayed layer Overlayed FALSE means make the displayed layer non-Overlayed
Returns:
-
Notes: Does not redraw the layer in the display list

Definition at line 2667 of file sgframe.cpp.

02668 {
02669     ERROR3IF(pLayer == NULL,"pLayer == NULL");
02670     if (pLayer == NULL) return;
02671 
02672     BOOL PrevOverlay = pLayer->IsOverlay();
02673     pLayer->SetOverlay(Overlay);
02674     BOOL PostOverlay = pLayer->IsOverlay();
02675 
02676     //if (PrevOverlay != PostOverlay)
02677     //  NodeRenderableInk::DeselectAllOnLayer(pLayer); 
02678 
02679     if (PrevOverlay != PostOverlay)
02680     {
02681         Spread* pSpread = pLayer->FindParentSpread();
02682         // Go and fix the status of other layers according to this new setting
02683         FixOtherLayers(pSpread);
02684 
02685         // Ensure that the buttons are in the correct state
02686         BROADCAST_TO_ALL(LayerMsg(pLayer, LayerMsg::LayerReason::ACTIVE_LAYER_CHANGED));
02687     }
02688 }

void FrameSGallery::DoChangeSolid Layer pLayer,
BOOL  Solid
[static]
 

Called when the Solid button is clicked in a layer gallery item. Changes the Solidness of the displayed layer.

Author:
Neville_Humphrys (Xara Group Ltd) <camelotdev@xara.com> (Based on Mark N's function in the Layer gallery code)
Date:
16/4/97 (Based on Jason's Layer gallery code)
Parameters:
pLayer = the layer to change [INPUTS] Solid - TRUE means make the displayed layer Solid FALSE means make Solid
Returns:
-
Notes: Does not redraw the layer in the display list

Definition at line 2607 of file sgframe.cpp.

02608 {
02609     ERROR3IF(pLayer == NULL,"pLayer == NULL");
02610     if (pLayer == NULL) return;
02611 
02612     BOOL PrevSolid = pLayer->IsSolid();
02613     pLayer->SetSolid(Solid);
02614     BOOL PostSolid = pLayer->IsSolid();
02615 
02616     /* if (PrevSolid != PostSolid)
02617     {
02618         // Force a redraw if the layer's visibility has changed
02619         FrameSGallery::ForceRedrawLayer(pLayer->FindDocument(), pLayer);
02620 
02621         // If layer has just become invisible, remove the selections on the layer 
02622         if (!PostSolid)
02623             NodeRenderableInk::DeselectAllOnLayer(pLayer); 
02624     } */
02625 
02626     if (PrevSolid != PostSolid)
02627     {
02628         // Mark all frames above this as edited until we reach the last frame
02629         // OR we hit a solid/background layer.
02630         // Previewing all the frames copes with dependent frames
02631         // Previwing single frames does not if you preview the solid frame.
02632         Layer * pFrame = pLayer->FindNextFrameLayer();
02633         while (pFrame != NULL && !pFrame->IsSolid())
02634         {
02635             // Mark that frame as edited
02636             pFrame->SetEdited(TRUE);
02637             pFrame = pFrame->FindNextFrameLayer();
02638         }
02639         
02640         Spread* pSpread = pLayer->FindParentSpread();
02641         // Go and fix the status of other layers according to this new setting
02642         FixOtherLayers(pSpread);
02643 
02644         // Ensure that the buttons are in the correct state
02645         BROADCAST_TO_ALL(LayerMsg(pLayer, LayerMsg::LayerReason::ACTIVE_LAYER_CHANGED));
02646     }
02647 }

void FrameSGallery::DoCommand StringBase CommandID  )  [virtual]
 

To apply a given command when it is chosen from the menu.

Author:
Neville_Humphrys (Xara Group Ltd) <camelotdev@xara.com> (Based on Jason's Layer gallery code)
Date:
16/4/97 (Based on Jason's Layer gallery code)
Parameters:
CommandID - The String ID of the command [INPUTS]
Notes: Override this method to provide handling for your special commands. Call the base class if you don't recognise the command, so that it can handle standard commands.

The base class handles all of these (maybe more - see the base class help) Properties, Sort, Find; New, Edit, Delete, Redefine; (it calls ApplyAction as appropriate) NextGroup, PrevGroup, FoldGroup, UnfoldGroup;

Reimplemented from LayerSGallery.

Definition at line 3021 of file sgframe.cpp.

03022 {
03023     if (*CommandID == SGCmd_Copy)
03024         DoCopyLayer();
03025     else if (*CommandID == SGCmd_New)
03026         DoCreateNewItem();
03027     else if (*CommandID == SGCmd_Delete)
03028     {
03029         //if (PrepareToDelete()) // No warning on Frame gallery
03030         DoDeleteSelection();
03031     }
03032 //  else if (*CommandID == SGCmd_Properties)
03033 //      DoFrameProperties();
03034     else if (*CommandID == SGCmd_Preview)
03035     {
03036         DoPreviewAnimation();
03037     }
03038     else if (*CommandID == SGCmd_FrameProps || *CommandID == SGCmd_Properties)
03039     {
03040         // Open the Animation properties dlg with the "Frame properties" page selected.
03041         DoFrameProperties();
03042     }
03043     else if (*CommandID == SGCmd_Show)
03044     {
03045         // Toggle the state of the show frame in animation flag
03046         SGDisplayLayer* pItem = GetSelectedLayerGalItem();
03047         Layer * pLayer = NULL;
03048         if (pItem)
03049             pLayer = pItem->GetDisplayedLayer();
03050         if (pLayer)
03051         {
03052             BOOL CurrentState = pLayer->IsHiddenFrame();
03053             pLayer->SetHiddenFrame(!CurrentState);
03054             if (pItem)
03055                 pItem->ForceRedrawOfMyself();
03056 
03057             // Ensure that the buttons are in the correct state
03058             BROADCAST_TO_ALL(LayerMsg(pLayer, LayerMsg::LayerReason::ACTIVE_LAYER_CHANGED));
03059         }
03060     }
03061 //  else if (*CommandID == SGCmd_Save)
03062 //      DoSaveAnimation();
03063     // Implement ****
03064     //  *CommandID == SGCmd_Animation
03065     //  *CommandID == SGCmd_Browser
03066 
03067     // Don't call the base class 'cos we don't want any other commands
03068 }

void FrameSGallery::DoCopyLayer  )  [protected, virtual]
 

Copies the active layer creating a new one with a default frame name.

Author:
Neville_Humphrys (Xara Group Ltd) <camelotdev@xara.com> (Based on Mark N's function in the Layer gallery code)
Date:
16/4/97 (Based on Jason's Layer gallery code)
Parameters:
- [INPUTS]
Returns:
-

Reimplemented from LayerSGallery.

Definition at line 2578 of file sgframe.cpp.

02579 {
02580     OpDescriptor* pOpDesc = OpDescriptor::FindOpDescriptor(OPTOKEN_FRAME_COPYFRAME); 
02581     if (pOpDesc != NULL)
02582         pOpDesc->Invoke();
02583     else
02584     {
02585         ERROR3("Couldn't find OPTOKEN_FRAME_COPYFRAME op descriptor");
02586     }
02587 }

void FrameSGallery::DoCreateNewItem void   )  [protected, virtual]
 

This function is meant to be overridden in derived classes It creates a new item and adds it to the Gallery DisplayList The item may be created by cloning/deriving/basing-on the selected item, depending on the type of Gallery concerned.

Author:
Neville_Humphrys (Xara Group Ltd) <camelotdev@xara.com> (Based on Mark N's function in the Layer gallery code)
Date:
16/4/97 (Based on Jason's Layer gallery code)

Reimplemented from LayerSGallery.

Definition at line 2555 of file sgframe.cpp.

02556 {
02557     OpDescriptor* pOpDesc = OpDescriptor::FindOpDescriptor(OPTOKEN_FRAME_NEWFRAME); 
02558     if (pOpDesc != NULL)
02559         pOpDesc->Invoke();
02560     else
02561     {
02562         ERROR3("Couldn't find OPTOKEN_FRAME_NEWFRAME op descriptor");
02563     }
02564 }

BOOL FrameSGallery::DoDeleteSelection void   )  [protected, virtual]
 

FORCIBLY deletes the active layer/frame.

Author:
Neville_Humphrys (Xara Group Ltd) <camelotdev@xara.com> (Based on Mark N's function in the Layer gallery code)
Date:
16/4/97 (Based on Jason's Layer gallery code)
Returns:
FALSE if it couldn't delete the selection. (This should, if at all possible leave the entire selection undeleted in this case)
See also:
FrameSGallery::PrepareToDelete; ColourManager::HideColours

Reimplemented from LayerSGallery.

Definition at line 2528 of file sgframe.cpp.

02529 {
02530     OpDescriptor* pOpDesc = OpDescriptor::FindOpDescriptor(OPTOKEN_FRAME_DELETEFRAME); 
02531     if (pOpDesc != NULL)
02532         pOpDesc->Invoke();
02533     else
02534     {
02535         ERROR3("Couldn't find OPTOKEN_FRAME_DELETEFRAME op descriptor");
02536     }
02537 
02538     return TRUE;
02539 }

BOOL FrameSGallery::DoFrameProperties  )  [protected, virtual]
 

Opens the frame properties dlg.

Author:
Neville_Humphrys (Xara Group Ltd) <camelotdev@xara.com>
Date:
22/5/97
Parameters:
- [INPUTS]
Returns:
True if worked ok, False otherwise

Definition at line 3205 of file sgframe.cpp.

03206 {
03207     OpDescriptor* pOpDesc = OpDescriptor::FindOpDescriptor(OPTOKEN_GIFANIMPROPERTYTABS);
03208 
03209     if (pOpDesc != NULL)
03210     {
03211         // Select the "Frame properties tab".
03212         GIFAnimationPropertyTabsDlg::SetPageToOpen(GIFAnimationPropertyTabs::FramePropertiesTabNumber);
03213 
03214         String_256 Str;
03215         OpState State = pOpDesc->GetOpsState(&Str);
03216         if (!State.Greyed)
03217             pOpDesc->Invoke();
03218         else
03219         {
03220             GIFAnimationPropertyTabs * pTabHandler = GIFAnimationPropertyTabsDlg::GetGIFAnimationPropertiesTabs();
03221             if (pTabHandler)
03222             {
03223                 DialogTabOp* pDlg =  pTabHandler->GetTabbedDlg();
03224                 if (pDlg != NULL)
03225                     pDlg->Open();
03226             }
03227         }
03228     }
03229     return TRUE;
03230 }

static BOOL FrameSGallery::DoHideNode Node pNodeToHide  )  [static]
 

void FrameSGallery::DoMoveLayer MoveLayerType  Reason  )  [protected, virtual]
 

Called when the Locked button is clicked in the layers gallery. Changes the lockedness of the selected layer, if there is one.

Author:
Neville_Humphrys (Xara Group Ltd) <camelotdev@xara.com> (Based on Mark N's function in the Layer gallery code)
Date:
16/4/97 (Based on Jason's Layer gallery code)
Parameters:
Reason = how the layer should be moved [INPUTS]
Returns:
-
Note: Same as LayerSGallery version but uses FRAME_MOVE

Reimplemented from LayerSGallery.

Definition at line 2706 of file sgframe.cpp.

02707 {
02708     SGDisplayLayer* pLayerGalItem = GetSelectedLayerGalItem();
02709 
02710     if (pLayerGalItem != NULL)
02711     {
02712         OpLayerGalParam Param(FRAME_MOVE, pSpread);
02713 
02714         Param.pLayer = pLayerGalItem->GetDisplayedLayer();
02715 
02716         switch (Reason)
02717         {
02718             case (MOVELAYER_UPONE) :
02719                 Param.pContextNode  = Param.pLayer->FindNextLayer();
02720                 Param.AttDir        = NEXT;
02721                 break;
02722 
02723             case (MOVELAYER_DOWNONE) :
02724                 Param.pContextNode  = Param.pLayer->FindPrevLayer();
02725                 Param.AttDir        = PREV;
02726                 break;
02727 
02728             default:
02729                 ERROR3("Unrecognised MoveLayer reason");
02730                 break;
02731         }
02732 
02733         if (Param.pContextNode != NULL)
02734         {
02735             // Redraw after the op if both this layer and the one it's moving in front/behind
02736             // is also visible
02737             Param.MoveRedraw = ((Layer*)Param.pContextNode)->IsVisible() &&
02738                                     Param.pLayer->IsVisible();
02739 
02740             // The above won't work in an undo or redo, so always redraw
02741             Param.MoveRedraw = TRUE;
02742 
02743             OpDescriptor* pOpDesc = OpDescriptor::FindOpDescriptor(OPTOKEN_LAYERGALCHANGE); 
02744             if (pOpDesc != NULL)
02745                 pOpDesc->Invoke((OpParam*)&Param);
02746             else
02747             {
02748                 ERROR3("Couldn't find OPTOKEN_LAYERGALCHANGE op descriptor");
02749             }
02750         }
02751     }
02752 }

BOOL FrameSGallery::DoPreviewAnimation  )  [protected, virtual]
 

Previews the current animation.

Author:
Neville_Humphrys (Xara Group Ltd) <camelotdev@xara.com>
Date:
30/4/97
Parameters:
- [INPUTS]
Returns:
True if worked ok, False otherwise

Definition at line 3108 of file sgframe.cpp.

03109 {
03110     // Check to see if the operation is available
03111     // No longer required as the button is hooked into the real op
03112     //String_256 ShadeReason;
03113     //OpState State;
03114     
03115     //State = OpGrabAllFrames::GetState(&ShadeReason, NULL);
03116     //if (State.Greyed)
03117     //  return FALSE;
03118 
03119     // Normally we want to invoke the grab frame, but we will sneak in that
03120     // if the shift key is pressed then we will grab all frames.
03121     OpDescriptor* pOpDesc = NULL;
03122     // Is the shift key pressed? 
03123     if (KeyPress::IsAdjustPressed())
03124         pOpDesc = OpDescriptor::FindOpDescriptor(OPTOKEN_FRAME_GRABALLFRAMES); 
03125     else
03126         pOpDesc = OpDescriptor::FindOpDescriptor(OPTOKEN_FRAME_GRABFRAME); 
03127 
03128     if (pOpDesc != NULL)
03129         pOpDesc->Invoke();
03130     else
03131     {
03132         ERROR3("Couldn't find OPTOKEN_FRAME_GRABFRAME/_GRABALLFRAMES op descriptor");
03133     }
03134 
03135     return TRUE;
03136 }

BOOL FrameSGallery::DoRegenerateFrames  )  [protected, virtual]
 

While previewing an animation, if the spread properties are changed we neeed to regenerate the frame layers. This function invokes the correct Op.

Author:
Ranbir_Rana (Xara Group Ltd) <camelotdev@xara.com>
Date:
14/05/97
Parameters:
- [INPUTS]
Returns:
True if worked ok, False otherwise

Definition at line 3179 of file sgframe.cpp.

03180 {
03181     OpDescriptor* pOpDesc = OpDescriptor::FindOpDescriptor(OPTOKEN_FRAME_GRABALLFRAMES); 
03182     if (pOpDesc != NULL)
03183         pOpDesc->Invoke();
03184     else
03185     {
03186         ERROR3("Couldn't find OPTOKEN_FRAME_GRABALLFRAMES op descriptor");
03187     }
03188 
03189     return TRUE;
03190 }

BOOL FrameSGallery::DoRegenerateSingleFrame  )  [protected, virtual]
 

While previewing an animation, if the frame layer properties are changed we neeed to regenerate the active frame. This function invokes the correct Op.

Author:
Ranbir_Rana (Xara Group Ltd) <camelotdev@xara.com>
Date:
14/05/97
Parameters:
- [INPUTS]
Returns:
True if worked ok, False otherwise

Definition at line 3151 of file sgframe.cpp.

03152 {
03153     OpDescriptor* pOpDesc = OpDescriptor::FindOpDescriptor(OPTOKEN_FRAME_GRABFRAME); 
03154     GIFAnimationExportParam Param;
03155     if (pOpDesc != NULL)
03156         pOpDesc->Invoke(&Param);
03157     else
03158     {
03159         ERROR3("Couldn't find OPTOKEN_FRAME_GRABALLFRAMES op descriptor");
03160     }
03161 
03162     return TRUE;
03163 }

BOOL FrameSGallery::DoSaveAnimation  )  [protected, virtual]
 

Saves out the current animation to file.

Author:
Neville_Humphrys (Xara Group Ltd) <camelotdev@xara.com>
Date:
30/4/97
Parameters:
- [INPUTS]
Returns:
True if worked ok, False otherwise

Definition at line 3082 of file sgframe.cpp.

03083 {
03084     // Not required at present
03085 /*  OpDescriptor* pOpDesc = OpDescriptor::FindOpDescriptor(OPTOKEN_SAVEANIMATEDGIF); 
03086     if (pOpDesc != NULL)
03087         pOpDesc->Invoke();
03088     else
03089     {
03090         ERROR3("Couldn't find OPTOKEN_FRAME_COPYFRAME op descriptor");
03091     }
03092 */
03093     return TRUE;
03094 }

void FrameSGallery::DoShadeGallery BOOL  ShadeIt  )  [protected, virtual]
 

Called by the base class whenever the shaded status of the gallery is changed, to allow derived galleries to shade/unshade any extra controls that they provide in the window. ONLY called if the gallery is actually open/visible.

Author:
Neville_Humphrys (Xara Group Ltd) <camelotdev@xara.com> (Based on Jason's Layer gallery code)
Date:
16/4/97 (Based on Jason's Layer gallery code)
Parameters:
ShadeIt - TRUE if the gallery is being shaded [INPUTS] FALSE if the gallery is being unshaded
Notes: Need not be overridden - the default action is to do nothing extra to the normal shade/unshade operation.
See also:
Gallery::ShadeGallery; Gallery::UnshadeGallery

Reimplemented from LayerSGallery.

Definition at line 2773 of file sgframe.cpp.

02774 {
02775     EnableGadget(_R(IDC_GALLERY_UPONE),     !ShadeIt);
02776     EnableGadget(_R(IDC_GALLERY_DOWNONE),   !ShadeIt);
02777     EnableGadget(_R(IDC_GALLERY_PROPERTIES),!ShadeIt);
02778     EnableGadget(_R(IDC_GALLERY_COPY),      !ShadeIt && !IsSelectedItemGuideLayer());
02779     EnableGadget(_R(IDC_FRAME_DELETE),      !ShadeIt);
02780 
02781     EnableGadget(_R(IDC_BTN_MULTILAYER),    !ShadeIt);
02782     EnableGadget(_R(IDC_BTN_ALLVISIBLE),    !ShadeIt);
02783 
02784     //EnableGadget(_R(IDC_GALLERY_NAME),        !ShadeIt);
02785 
02786     EnableGadget(_R(IDC_GALLERY_COPY),      !ShadeIt && !IsSelectedItemGuideLayer());
02787 
02788     UpdateFrameRelatedButtons();
02789 }

BOOL FrameSGallery::EnsureFrameLayerIntegrity Spread pSpread  )  [static]
 

This checks that there is one and only one active layer in the given spread. If there isn't an active layer, the first layer is made active. If there is more than on active layer, all but the first active layer are made inactive.This function should be called before any frame related actions are carried out It will ensure that all the visible layers are frame layers.

Author:
Neville_Humphrys (Xara Group Ltd) <camelotdev@xara.com>
Date:
21/5/97
Returns:
True if worked ok, False otherwise.

Errors: -

See also:
-

Definition at line 2199 of file sgframe.cpp.

02200 {
02201     ERROR2IF(pSpread == NULL,FALSE,"EnsureFrameLayerIntegrity null spread passed in");
02202 
02203     // For the present moment just ensure that the active layer is a frame layer
02204     //Layer * pActiveLayer = pSpread->FindActiveLayer();
02205     //if (pActiveLayer)
02206     //  pActiveLayer->SetFrame(TRUE);
02207 
02208 /* #if _DEBUG
02209     // Find out whether the operation thinks it is required or not
02210     String_256 ShadeReason;
02211     OpState State;
02212     State = OpCombineLayersToFrameLayer::GetState(&ShadeReason, NULL);
02213     if (!State.Greyed)
02214     {
02215         // Try and find the operation we want to use
02216         OpDescriptor* pOpDesc = OpDescriptor::FindOpDescriptor(OPTOKEN_COMBINELAYERSTOFRAMELAYER); 
02217         if (pOpDesc != NULL)
02218         {
02219             // We