OpLayerGalChange Class Reference

#include <layergal.h>

Inheritance diagram for OpLayerGalChange:

UndoableOperation Operation MessageHandler ListItem CCObject SimpleCCObject OpCopyFrame OpCreateNewFrame OpDeleteFrame OpDeletePageBackground OpSelectEndFrame OpSelectNextFrame OpSelectPrevFrame OpSelectStartFrame List of all members.

Public Member Functions

 OpLayerGalChange ()
 OpLayerGalChange constructor (Creates an undoable operation).
void DoWithParam (OpDescriptor *, OpParam *pOpParam)
 Performs the layer change operation defined by ((OpLayerGalParam*)pOpParam)->Reason. It handles the creation, deletion, changing, and moving of the layer provided.
void GetOpName (String_256 *OpName)
 The GetOpName fn is overridden so that we return back a description appropriate to the type of attribute that the operation applies.
BOOL DoInvalidateLayerRegion (Layer *pLayer)
 This invalidates the areas of the screen covered by the given layer This copes with guidelines if the given layer is a guides layer.
virtual BOOL Undo ()
 The overloaded Undo operation refreshes the layer details in the layer manager.
virtual BOOL Redo ()
 The overloaded Redo operation refreshes the layer details in the layer manager.
virtual BOOL MayChangeNodeBounds () const

Static Public Member Functions

static BOOL Init ()
 OpLayerGalChange initialiser method.
static OpState GetState (String_256 *, OpDescriptor *)
 For finding the OpLayerGalChange's state.
static BOOL IsFrameMode ()

Private Member Functions

 CC_DECLARE_DYNCREATE (OpLayerGalChange)

Private Attributes

OpLayerGalReason Reason
SpreadpSpread
LayerpOpUndoLayer
LayerpOpRedoLayer
UINT32 UndoIDS
BOOL BroadcastLayerChanges

Detailed Description

Definition at line 277 of file layergal.h.


Constructor & Destructor Documentation

OpLayerGalChange::OpLayerGalChange  ) 
 

OpLayerGalChange constructor (Creates an undoable operation).

Author:
Mark_Neves (Xara Group Ltd) <camelotdev@xara.com>
Date:
4/8/94
Parameters:
- [INPUTS]
- [OUTPUTS]
Returns:
-

Errors: -

See also:
-

Definition at line 286 of file layergal.cpp.

00286                                   : UndoableOperation()                             
00287 {                              
00288     pSpread                 = NULL;
00289     UndoIDS                 = _R(IDS_NOTYPE);
00290     BroadcastLayerChanges   = TRUE;
00291     pOpUndoLayer            = NULL;
00292     pOpRedoLayer            = NULL;
00293 }


Member Function Documentation

OpLayerGalChange::CC_DECLARE_DYNCREATE OpLayerGalChange   )  [private]
 

BOOL OpLayerGalChange::DoInvalidateLayerRegion Layer pLayer  ) 
 

This invalidates the areas of the screen covered by the given layer This copes with guidelines if the given layer is a guides layer.

Author:
Mark_Neves (Xara Group Ltd) <camelotdev@xara.com>
Date:
21/9/95
Parameters:
pLayer = ptr to layer [INPUTS]
- [OUTPUTS]
Returns:
TRUE for success, FALSE otherwise
We have to do guidelines separately, because guidelines don't get included in the bounding rect of the layer, hence DoInvalidateNodeRegion(pLayer) won't work
Returns:
Errors: -
See also:
-

Definition at line 1066 of file layergal.cpp.

01067 {
01068     ERROR2IF(pLayer  == NULL,FALSE, "pLayer is NULL");
01069     ERROR2IF(pSpread == NULL,FALSE,"pSpread is NULL");
01070 
01071     BOOL ok = TRUE;
01072 
01073     if (pLayer->IsGuide())
01074     {
01075         Node* pNode = pLayer->FindFirstChild(CC_RUNTIME_CLASS(NodeGuideline));
01076         while (pNode != NULL && ok)
01077         {
01078             DocRect Rect = ((NodeGuideline*)pNode)->GetRenderRect();
01079             ok = DoInvalidateRegion(pSpread,Rect);
01080 
01081             pNode = pNode->FindNext(CC_RUNTIME_CLASS(NodeGuideline));
01082         }
01083     }
01084 
01085     if (ok) ok = DoInvalidateNodeRegion(pLayer, TRUE);
01086 
01087     return ok;
01088 }

void OpLayerGalChange::DoWithParam OpDescriptor ,
OpParam pOpParam
[virtual]
 

Performs the layer change operation defined by ((OpLayerGalParam*)pOpParam)->Reason. It handles the creation, deletion, changing, and moving of the layer provided.

Author:
Mark_Neves (Xara Group Ltd) <camelotdev@xara.com>
Date:
4/8/94
Parameters:
OpDescriptor (unused) [INPUTS] pOpParam - this is really a ptr to an OpLayerGalParam
- [OUTPUTS]
Returns:
-

Errors: -

See also:
-

Reimplemented from Operation.

Definition at line 517 of file layergal.cpp.

00518 {   
00519     OpLayerGalParam* pOpLayerGalParam = (OpLayerGalParam*)pOpParam;
00520 
00521     pSpread = pOpLayerGalParam->GetParentSpread();
00522     Reason  = pOpLayerGalParam->GetReason();
00523 
00524     Layer*              pLayer      = pOpLayerGalParam->pLayer;
00525     Node*               pContextNode= pOpLayerGalParam->pContextNode;
00526     AttachNodeDirection AttDir      = pOpLayerGalParam->AttDir;
00527     LayerStatus         NewStatus   = pOpLayerGalParam->Status;
00528 
00529     BOOL FrameLayer = FALSE;
00530 
00531     switch (Reason)
00532     {
00533         //--------------------------------------------------------------------------------------------
00534         // Select a Frame layer
00535         case (FRAME_SELECT):
00536             // Check for being given a null layer or an already active layer
00537             if (pLayer == NULL || pLayer->IsActive())
00538                 goto EndOperation;
00539 
00540 PORTNOTE("galleries", "disabled frame gallery")
00541 #ifndef EXCLUDE_FROM_XARALX
00542             // Make the layer we have been passed the active one
00543             FrameSGallery::MakeActiveLayer(pLayer);
00544 #endif
00545             UndoIDS = _R(IDS_FRAME_UNDO_SELECTNEW);
00546             break;
00547         //--------------------------------------------------------------------------------------------
00548         // Create a new layer
00549         case (FRAME_NEW):
00550             FrameLayer = TRUE;
00551         case (LAYER_NEW):
00552             {
00553                 // Attempt to create a new layer node 
00554                 ALLOC_WITH_FAIL(pLayer, (new Layer()), this);         
00555                 if (pLayer == NULL)
00556                     goto EndOperation; // We were unable to create a new layer so 
00557                                        // abort the operation 
00558 
00559                 // Set the new layer's status  
00560                 pLayer->SetLayerStatus(NewStatus); 
00561 
00562                 // Set the frame layer flag according to the operation type i.e FRAME_NEW = set flag
00563                 if (FrameLayer)
00564                 {
00565                     pLayer->SetFrame(TRUE);
00566                     pLayer->SetEdited(TRUE);
00567                 }
00568 
00569                 // Insert new layer in the tree
00570                 // Rule: if there is a guide layer at the top, then place the new layer
00571                 // beneath this layer, otherwise, put the new layer at the top.
00572                 Layer* pLastLayer = pSpread->FindLastLayer();
00573                 if(pLastLayer && pLastLayer->IsGuide())
00574                 {
00575                     // this layer is a guide layer - get the next one
00576                     pLastLayer = pLastLayer->FindPrevLayer();
00577                 }
00578                 Node* pNodeToInsert;
00579                 if(pLastLayer)
00580                 {
00581                     pNodeToInsert = pLastLayer;
00582                 }
00583                 else
00584                 {
00585                     // what?! can't find a Last Layer to use?
00586                     pNodeToInsert = pContextNode;
00587                 }
00588 
00589                 if (DoInsertNewNode(pLayer, pLastLayer, NEXT, FALSE))
00590                 {
00591 PORTNOTE("galleries", "Disabled frame gallery")
00592 #ifndef EXCLUDE_FROM_XARALX
00593                     if (FrameLayer)
00594                         FrameSGallery::MakeActiveLayer(pLayer);
00595                     else
00596 #endif
00597                         LayerSGallery::MakeActiveLayer(pLayer);
00598 
00599                     // Note the layer inserted so we can clear any selection on the layer when this op is undone
00600                     pOpUndoLayer = pLayer;
00601                     pLayer->EnsureUniqueLayerID();
00602                 }
00603             }
00604 
00605             if (FrameLayer)
00606                 UndoIDS = _R(IDS_FRAME_UNDO_NEW);
00607             else
00608                 UndoIDS = _R(IDS_LAYER_UNDO_NEW);
00609             break;
00610 
00611         //--------------------------------------------------------------------------------------------
00612         // Delete a layer
00613         case (FRAME_DELETE):
00614             FrameLayer = TRUE;
00615         case (LAYER_DELETE):
00616         case (PAGEBACKGROUND_DEFAULT):
00617             {
00618                 // This doesn't seem to be an important ensure as it works when the layer
00619                 // is not active
00620                 // Disabled 10/4/97
00621                 //ERROR3IF(pLayer->IsActive(),"Deleting layer, yet it is not active");
00622 
00623                 // We need to find 'prev' and 'next' before we delete the layer
00624                 Layer* pPrevLayer = pLayer->FindPrevLayer();
00625                 Layer* pNextLayer = pLayer->FindNextLayer();
00626 
00627                 if (pLayer->IsVisible())
00628                 {
00629                     if (!DoInvalidateLayerRegion(pLayer))
00630                         goto EndOperation;
00631                 }
00632 
00633                 NodeRenderableInk::DeselectAllOnLayer(pLayer); 
00634 
00635                 if (!DoHideNode(pLayer,TRUE)) // Hide the node 
00636                     goto EndOperation;
00637 
00638                 // Note the layer inserted so we can clear any selection on the layer when this op is redone
00639                 // i.e. deleted again after a redo
00640                 pOpRedoLayer = pLayer;
00641 
00642                 // If the last layer has been deleted, create a new one and make it the active layer
00643                 if (pSpread->FindFirstLayer() == NULL)
00644                 {
00645                     Layer* pFirstLayer;
00646 
00647                     ALLOC_WITH_FAIL(pFirstLayer, (new Layer()), this);        
00648                     if (pFirstLayer == NULL)
00649                         goto EndOperation; // We were unable to create a new layer so 
00650                                            // abort the operation 
00651 
00652                     // Set the new layer's status and ID  
00653                     pFirstLayer->SetActive(TRUE);
00654                     pFirstLayer->GetLayerStatus().StringLayerID = LayerSGallery::CreateUniqueLayerID(pSpread);
00655 
00656                     // Make it the last child of the spread
00657                     if (DoInsertNewNode(pFirstLayer,pSpread,LASTCHILD,FALSE,TRUE,TRUE,TRUE))
00658                     {
00659                         // Note the layer inserted so we can clear any selection on the layer when this op is undone
00660                         // i.e. deleted after an undo
00661                         pOpUndoLayer = pLayer;
00662                     }
00663                 }
00664                 else
00665                 {
00666                     // if we've deleted the active layer, make one of the others active
00667                     if (pLayer->IsActive())
00668                     {
00669                         Layer* pNewActiveLayer = pNextLayer;
00670 
00671                         if (pNewActiveLayer == NULL)
00672                             pNewActiveLayer = pPrevLayer;
00673 
00674                         if (pNewActiveLayer != NULL)
00675                         {
00676 PORTNOTE("galleries", "disabled frame gallery")
00677 #ifndef EXCLUDE_FROM_XARALX
00678                             if (FrameLayer)
00679                                 FrameSGallery::MakeActiveLayer(pNewActiveLayer);
00680                             else
00681 #endif
00682                                 LayerSGallery::MakeActiveLayer(pNewActiveLayer);
00683                         }
00684 
00685                         ERROR3IF(pNewActiveLayer == NULL,"Can't find another layer to make active");
00686 
00687                         // Make sure that when it comes back (through an undo) it is not flagged as active
00688                         pLayer->SetActive(FALSE);
00689                     }
00690                 }
00691             }
00692 
00693             if (FrameLayer)
00694                 UndoIDS = _R(IDS_FRAME_UNDO_DELETE);
00695             else
00696             {
00697                 if (Reason == LAYER_DELETE)
00698                     UndoIDS = _R(IDS_LAYER_UNDO_DELETE);
00699                 else
00700                     UndoIDS = _R(IDS_UNDO_DEFAULTBACKGROUND);
00701             }
00702             break;
00703 
00704         //--------------------------------------------------------------------------------------------
00705         // Change a layer's status (i.e. it's layer attributes)
00706         case (LAYER_CHANGE_NAME):
00707             UndoIDS = _R(IDS_LAYER_UNDO_CHANGENAME);
00708             // Fall through!!!!
00709 //      case (LAYER_CHANGE):
00710             {
00711                 // if UndoIDS has not been changed via the LAYER_CHANGE_NAME entry point,
00712                 // change it to something relevent
00713                 if (UndoIDS == _R(IDS_NOTYPE)) UndoIDS = _R(IDS_LAYER_UNDO_CHANGE);
00714 
00715                 // Try to create an action to restore the attribute changes we 
00716                 // are about to make 
00717                 ChangeLyrAttribAction* UndoAttribChngAction;                          
00718 
00719                 if ( ChangeLyrAttribAction::Init(this,                    
00720                                               &UndoActions,
00721                                               sizeof(InvalidateRegionAction),  
00722                                               pLayer->GetLayerStatus(),
00723                                               pLayer, 
00724                                               ( Action**)(&UndoAttribChngAction))
00725                                               != AC_FAIL) 
00726                 {
00727                     LayerStatus OldStatus = pLayer->GetLayerStatus();
00728 
00729                     // Get the state of the layer before the change
00730                     BOOL PrevVisible = pLayer->IsVisible();
00731                     BOOL PrevLocked  = pLayer->IsLocked();
00732                     BOOL PrevOutline = pLayer->IsOutline();
00733 
00734                     // This is the real state of the visible flag before the change
00735                     BOOL PrevVisibleReal = pLayer->GetVisibleFlagState();
00736 
00737                     // change the layer's status info
00738                     pLayer->SetLayerStatus(NewStatus);
00739 
00740                     // Get the state of the layer after the change
00741                     BOOL PostVisible = pLayer->IsVisible();
00742                     BOOL PostLocked  = pLayer->IsLocked();
00743                     BOOL PostOutline = pLayer->IsOutline();
00744 
00745                     // This is the real state of the visible flag after the change
00746                     BOOL PostVisibleReal = pLayer->GetVisibleFlagState();
00747 
00748                     // If the visibility flag has changed, or if visible and the outline state has changed,
00749                     // then do a redraw.
00750                     if ((PrevVisibleReal != PostVisibleReal) || (PostVisible && (PrevOutline != PostOutline)))
00751                     {
00752                         if (!DoInvalidateLayerRegion(pLayer))
00753                             goto EndOperation;
00754                     } 
00755 
00756                     // If become invisible or become locked, then remove the selections on the layer 
00757                     if ( ((PrevVisible != PostVisible) && !PostVisible) ||
00758                          ((PrevLocked  != PostLocked)  && PostLocked) )
00759                     {
00760                         NodeRenderableInk::DeselectAllOnLayer(pLayer); 
00761                     } 
00762                     pLayer->EnsureUniqueLayerID();
00763                 }
00764                 else 
00765                     goto EndOperation; // We have failed 
00766 
00767             }
00768             break;
00769 
00770         //--------------------------------------------------------------------------------------------
00771         // Move the layer somewhere else
00772         case (FRAME_MOVE):
00773             FrameLayer = TRUE;
00774         case (LAYER_MOVE):
00775             // Move the layer to the new pos
00776             if(!DoMoveNode(pLayer, pContextNode, AttDir))
00777                 goto EndOperation; 
00778 
00779             GetApplication()->UpdateSelection();
00780 
00781             // Horrible bodge that ensures that the layer that moves remains the active layer.
00782             // The DoMoveNode() call above causes a hidden node to be generated that references a layer.
00783             // This in turn generates a LAYERSCHANGED spread message that causes the layer gallery to do
00784             // a validity check to ensure that there's an active layer on the spread.
00785             // If there isn't an active layer (which there isn't in this case because it's just been
00786             // hidden) the check selects the first layer in the spread.
00787             // Not easy to fix properly, but easy to bodge it.
00788             if (FrameLayer)
00789             {
00790                 // Ensure that the frame layer flag is on
00791                 pLayer->SetFrame(TRUE);
00792                 pLayer->SetEdited(TRUE);
00793 PORTNOTE("galleries", "Disabled frame gallery")
00794 #ifndef EXCLUDE_FROM_XARALX
00795                 FrameSGallery::MakeActiveLayer(pLayer);
00796 #endif
00797             }
00798             else
00799                 LayerSGallery::MakeActiveLayer(pLayer);
00800 
00801             pOpUndoLayer = pLayer;
00802             pOpRedoLayer = pLayer;
00803 
00804             // Invalidate the region if the layer is visible
00805             if (pOpLayerGalParam->MoveRedraw)
00806             {
00807                 if (!DoInvalidateLayerRegion(pLayer))
00808                     goto EndOperation;
00809             }
00810 
00811             if (pOpLayerGalParam->ToggleBackground)
00812                 LayerStateAction::Init(this,&UndoActions,*pOpLayerGalParam);
00813 
00814             if (FrameLayer)
00815                 UndoIDS = _R(IDS_FRAME_UNDO_MOVE);
00816             else
00817                 UndoIDS = _R(IDS_LAYER_UNDO_MOVE);
00818             break;
00819 
00820         //--------------------------------------------------------------------------------------------
00821         // Copy the layer 
00822         case (FRAME_COPY):
00823             FrameLayer = TRUE;
00824         case (LAYER_COPY):
00825             {
00826                 BOOL ok = TRUE;
00827                 Layer* pCopyOfLayer = NULL;
00828 
00829                 if (pLayer == NULL)
00830                     goto EndOperation;
00831 
00832 
00833                 // The following lump of code makes sure that the layer being copied does not 
00834                 // contain the insertion node, otherwise it will be copied in the new layer,
00835                 // resulting in the doc having two insertion nodes. (Markn 17/10/96)
00836                 /*
00837                 {
00838                     BaseDocument* pBaseDoc = pLayer->FindOwnerDoc();
00839 
00840                     if (pBaseDoc != NULL && IS_A(pBaseDoc,Document))
00841                     {
00842                         Document* pDoc = (Document*)pBaseDoc;
00843                         InsertionNode* pInsertNode = pDoc->GetInsertionPosition();
00844                         if (pInsertNode != NULL)
00845                         {
00846                             Layer* pInsertLayer = (Layer*)pInsertNode->FindParent(CC_RUNTIME_CLASS(Layer));
00847                             if (pInsertLayer == pLayer)
00848                             {
00849                                 pInsertNode->UnlinkNodeFromTree();
00850                                 delete pInsertNode;
00851                                 pInsertNode = NULL;
00852                             }
00853                         }
00854                     }
00855                 }
00856                 */
00857 
00858                 // Copy the layer and all its children, without placing the copy in the tree
00859                 CALL_WITH_FAIL(pLayer->NodeCopy((Node**)&pCopyOfLayer), this, ok);
00860                 if (!ok) goto EndOperation; 
00861 
00862                 //Graham 1/8/97: Clear the text tool's internal record of the focus story
00863                 //This is a bug fix
00864                 TextStory::SetFocusStory(NULL);
00865 
00866                 // Set the new layer's status  
00867                 pCopyOfLayer->SetLayerStatus(NewStatus); 
00868 
00869                 // Set the frame layer flag according to the operation type i.e FRAME_NEW = set flag
00870                 if (FrameLayer)
00871                 {
00872                     pCopyOfLayer->SetFrame(TRUE);
00873                     pCopyOfLayer->SetEdited(TRUE);
00874                 }
00875 
00876                 // Insert layer and its children in the tree somewhere
00877                 // Rule: if there is a guide layer at the top, then place the new layer
00878                 // beneath this layer, otherwise, put the new layer at the top.
00879                 Layer* pLastLayer = pSpread->FindLastLayer();
00880                 if(pLastLayer && pLastLayer->IsGuide())
00881                 {
00882                     // this layer is a guide layer - get the next one
00883                     // (there will (ought to be) only one guide layer...)
00884                     pLastLayer = pLastLayer->FindPrevLayer();
00885                 }
00886                 Node* pNodeToInsert;
00887                 if(pLastLayer)
00888                 {
00889                     pNodeToInsert = pLastLayer;
00890                 }
00891                 else
00892                 {
00893                     // what?! can't find a Last Layer to use?
00894                     pNodeToInsert = pContextNode;
00895                 }
00896 
00897                 if (!DoInsertNewNode(pCopyOfLayer, pNodeToInsert, NEXT, FALSE))
00898                 {
00899                     // Tidy up if we fail
00900                     pCopyOfLayer->CascadeDelete(); 
00901                     delete pCopyOfLayer; 
00902                     goto EndOperation; 
00903                 } 
00904 
00905                 // Call PostDuplicate so things sort their lives out.
00906                 Node* pCurrent = pCopyOfLayer->FindFirstDepthFirst();
00907                 while (pCurrent!=NULL && ok)
00908                 {
00909                     ok = pCurrent->PostDuplicate(this);
00910                     pCurrent = pCurrent->FindNextDepthFirst(pCopyOfLayer);
00911                 }
00912                 if (!ok) goto EndOperation; 
00913             
00914                 if (!DoInvalidateLayerRegion(pCopyOfLayer))
00915                     goto EndOperation;
00916 
00917                 // Note the layer inserted so we can clear any selection on the layer when this op is undone
00918                 // i.e. when the copied layer is removed after an undo
00919                 pOpUndoLayer = pCopyOfLayer;
00920 
00921                 // Make it the active layer
00922 PORTNOTE("galleries", "Disabled frame gallery")
00923 #ifndef EXCLUDE_FROM_XARALX
00924                 if (FrameLayer)
00925                     FrameSGallery::MakeActiveLayer(pCopyOfLayer);
00926                 else
00927 #endif
00928                     LayerSGallery::MakeActiveLayer(pCopyOfLayer);
00929 
00930                 NodeRenderableInk::DeselectAllOnLayer(pLayer);
00931                 pCopyOfLayer->EnsureUniqueLayerID();
00932             }
00933 
00934             if (FrameLayer)
00935                 UndoIDS = _R(IDS_FRAME_UNDO_COPY);
00936             else
00937                 UndoIDS = _R(IDS_LAYER_UNDO_COPY);
00938             break;
00939 
00940         //--------------------------------------------------------------------------------------------
00941         // Toggle the layer's background flag
00942         case (LAYER_TOGGLEBACKGROUND):
00943             LayerStateAction::Init(this, &UndoActions, *pOpLayerGalParam);
00944             BroadcastLayerChanges = FALSE;
00945             UndoIDS = _R(IDS_LAYER_UNDO_MOVE);
00946             break;
00947 
00948         //--------------------------------------------------------------------------------------------
00949         // Change the layer's visibility
00950         case (LAYER_VISIBLE):
00951             LayerStateAction::Init(this, &UndoActions, *pOpLayerGalParam);
00952             BroadcastLayerChanges = FALSE;
00953             UndoIDS = _R(IDS_LAYER_UNDO_VISIBLE);
00954             break;
00955 
00956         //--------------------------------------------------------------------------------------------
00957         // Change the layer's locked state
00958         case (LAYER_LOCKED):
00959             LayerStateAction::Init(this, &UndoActions, *pOpLayerGalParam);
00960             BroadcastLayerChanges = FALSE;
00961             UndoIDS = _R(IDS_LAYER_UNDO_LOCKED);
00962             break;
00963 
00964         //--------------------------------------------------------------------------------------------
00965         // Change the layer's doc's 'all visible' state
00966         case (FRAME_ALLVISIBLE):
00967             FrameLayer = TRUE;
00968         case (LAYER_ALLVISIBLE):
00969             LayerStateAction::Init(this, &UndoActions, *pOpLayerGalParam);
00970             BroadcastLayerChanges = FALSE;
00971             if (FrameLayer)
00972                 UndoIDS = _R(IDS_FRAME_UNDO_ALLVISIBLE);
00973             else
00974                 UndoIDS = _R(IDS_LAYER_UNDO_ALLVISIBLE);
00975             break;
00976 
00977         //--------------------------------------------------------------------------------------------
00978         // Change the layer's doc's 'multilayer' state
00979         case (FRAME_MULTILAYER):
00980             FrameLayer = TRUE;
00981         case (LAYER_MULTILAYER):
00982             LayerStateAction::Init(this, &UndoActions, *pOpLayerGalParam);
00983             BroadcastLayerChanges = FALSE;
00984             if (FrameLayer)
00985                 UndoIDS = _R(IDS_FRAME_UNDO_MULTILAYER);
00986             else
00987                 UndoIDS = _R(IDS_LAYER_UNDO_MULTILAYER);
00988             break;
00989 
00990         //--------------------------------------------------------------------------------------------
00991         // Change the layer's name, visibility & editability, all on one go
00992         case (LAYER_CHANGE):
00993             LayerStateAction::Init(this, &UndoActions, *pOpLayerGalParam);
00994             //BroadcastLayerChanges = FALSE;
00995             UndoIDS = _R(IDS_OPCHANGELAYERPROPERTIES);
00996             break;
00997 
00998         //--------------------------------------------------------------------------------------------
00999         // Change the layer's solid state
01000         case (LAYER_SOLID):
01001 // Cannot do this as this causes the gallery items to be destructed whilst handling
01002 // clicks on one of the items.
01003 //          // Check that all visible layers are actually frame layers
01004 //          FrameSGallery::EnsureFrameLayerIntegrity(pSpread);
01005             // Set up the action
01006             LayerStateAction::Init(this, &UndoActions, *pOpLayerGalParam);
01007             BroadcastLayerChanges = FALSE;
01008             UndoIDS = _R(IDS_LAYER_UNDO_SOLID);
01009             break;
01010         //--------------------------------------------------------------------------------------------
01011         // Change the layer's solid state
01012         case (LAYER_OVERLAY):
01013 //          // Check that all visible layers are actually frame layers
01014 //          FrameSGallery::EnsureFrameLayerIntegrity(pSpread);
01015             // Set up the action
01016             LayerStateAction::Init(this, &UndoActions, *pOpLayerGalParam);
01017             BroadcastLayerChanges = FALSE;
01018             UndoIDS = _R(IDS_LAYER_UNDO_OVERLAY);
01019             break;
01020 
01021         //--------------------------------------------------------------------------------------------
01022         // Change the layer's active state
01023         case (LAYER_ACTIVE):
01024             // Set up the action
01025             LayerStateAction::Init(this, &UndoActions, *pOpLayerGalParam);
01026             BroadcastLayerChanges = FALSE;
01027             UndoIDS = _R(IDS_LAYER_UNDO_ACTIVE);
01028             break;
01029 
01030         // Trap any other reasons here
01031         default:
01032             ERROR3("Unknown OpLayerGalChange reason code");
01033             break;
01034     }
01035 
01036     if (BroadcastLayerChanges)
01037     {
01038         BROADCAST_TO_ALL(SpreadMsg(pSpread,SpreadMsg::LAYERCHANGES));
01039     }
01040 
01041     EndOperation:
01042 
01043     ERROR3IF(UndoIDS == 0,"The undo ID string is zero. No too useful!");
01044     End(); 
01045 }

void OpLayerGalChange::GetOpName String_256 OpName  )  [virtual]
 

The GetOpName fn is overridden so that we return back a description appropriate to the type of attribute that the operation applies.

Author:
Mark_Neves (Xara Group Ltd) <camelotdev@xara.com>
Date:
5/8/94
Parameters:
- [INPUTS]
The undo string for the operation [OUTPUTS]
Returns:

Errors: -

See also:
-

Reimplemented from Operation.

Definition at line 1107 of file layergal.cpp.

01108 { 
01109     *OpName = String_256(UndoIDS);
01110 }  

OpState OpLayerGalChange::GetState String_256 UIDescription,
OpDescriptor
[static]
 

For finding the OpLayerGalChange's state.

Author:
Mark_Neves (Xara Group Ltd) <camelotdev@xara.com>
Date:
4/8/94
Parameters:
- [INPUTS]
- [OUTPUTS]
Returns:
The state of the OpLayerGalChange operation

Errors: -

See also:
-

Reimplemented in OpSelectStartFrame, OpSelectEndFrame, OpSelectPrevFrame, OpSelectNextFrame, OpCreateNewFrame, OpCopyFrame, OpDeleteFrame, and OpDeletePageBackground.

Definition at line 486 of file layergal.cpp.

00487 {
00488     OpState OpSt;  
00489     return(OpSt);   
00490 }

BOOL OpLayerGalChange::Init void   )  [static]
 

OpLayerGalChange initialiser method.

Author:
Mark_Neves (Xara Group Ltd) <camelotdev@xara.com>
Date:
4/8/94
Parameters:
- [INPUTS]
- [OUTPUTS]
Returns:
TRUE if the operation could be successfully initialised FALSE if no more memory could be allocated

Errors: ERROR will be called if there was insufficient memory to allocate the operation.

See also:
-

Reimplemented from SimpleCCObject.

Definition at line 313 of file layergal.cpp.

00314 {
00315     return (
00316             RegisterOpDescriptor(
00317                                 0,
00318                                 _R(IDS_LAYERCHANGEOP),
00319                                 CC_RUNTIME_CLASS(OpLayerGalChange),
00320                                 OPTOKEN_LAYERGALCHANGE,
00321                                 OpLayerGalChange::GetState,
00322                                 0,  /* help ID */
00323                                 _R(IDBBL_LAYERCHANGEOP),
00324                                 0   /* bitmap ID */
00325                                 ) &&
00326             RegisterOpDescriptor(
00327                                 0,
00328                                 _R(IDS_DELETEPAGEBACKGROUND),
00329                                 CC_RUNTIME_CLASS(OpDeletePageBackground),
00330                                 OPTOKEN_DELETEPAGEBACKGROUND,
00331                                 OpDeletePageBackground::GetState,
00332                                 0,          // help ID
00333                                 0,          // bubble help id
00334                                 0           // bitmap ID
00335                                 )
00336             // special frame operations
00337                                 &&
00338 PORTNOTE("galleries", "Disabled frame stuff")
00339 #ifndef EXCLUDE_FROM_XARALX
00340             RegisterOpDescriptor(
00341                                 0,                              // Tool ID 
00342                                 _R(IDS_SELECTSTARTFRAME),           // String resource ID
00343                                 CC_RUNTIME_CLASS(OpSelectStartFrame),   // Runtime class
00344                                 OPTOKEN_FRAME_STARTFRAME,       // Token string
00345                                 OpSelectStartFrame::GetState,   // GetState function
00346                                 0,                              // help ID
00347                                 _R(IDBBL_SELECTSTARTFRAME),         // bubble help
00348                                 _R(IDD_ANIMATIONBAR),               // resource ID
00349                                 _R(IDC_PREVIEW_STARTFRAME),         // control ID
00350                                 SYSTEMBAR_ANIMATION,            // Bar ID
00351                                 TRUE,                           // Recieve system messages
00352                                 FALSE,                          // Smart duplicate operation
00353                                 TRUE,                           // Clean operation
00354                                 NULL,                           // String for one copy only error
00355                                 (DONT_GREY_WHEN_SELECT_INSIDE | GREY_WHEN_NO_CURRENT_DOC) // Auto state flags
00356                                 )
00357                                 &&
00358             RegisterOpDescriptor(
00359                                 0,                              // Tool ID 
00360                                 _R(IDS_SELECTENDFRAME),             // String resource ID
00361                                 CC_RUNTIME_CLASS(OpSelectEndFrame), // Runtime class
00362                                 OPTOKEN_FRAME_ENDFRAME,         // Token string
00363                                 OpSelectEndFrame::GetState, // GetState function
00364                                 0,                              // help ID
00365                                 _R(IDBBL_SELECTENDFRAME),           // bubble help
00366                                 _R(IDD_ANIMATIONBAR),               // resource ID
00367                                 _R(IDC_PREVIEW_ENDFRAME),           // control ID
00368                                 SYSTEMBAR_ANIMATION,            // Bar ID
00369                                 TRUE,                           // Recieve system messages
00370                                 FALSE,                          // Smart duplicate operation
00371                                 TRUE,                           // Clean operation
00372                                 NULL,                           // String for one copy only error
00373                                 (DONT_GREY_WHEN_SELECT_INSIDE | GREY_WHEN_NO_CURRENT_DOC) // Auto state flags
00374                                 )
00375                                 &&
00376             RegisterOpDescriptor(
00377                                 0,                              // Tool ID 
00378                                 _R(IDS_SELECTPREVFRAME),            // String resource ID
00379                                 CC_RUNTIME_CLASS(OpSelectPrevFrame),    // Runtime class
00380                                 OPTOKEN_FRAME_PREVFRAME,        // Token string
00381                                 OpSelectPrevFrame::GetState,    // GetState function
00382                                 0,                              // help ID
00383                                 _R(IDBBL_SELECTPREVFRAME),          // bubble help
00384                                 _R(IDD_ANIMATIONBAR),               // resource ID
00385                                 _R(IDC_PREVIEW_PREVFRAME),          // control ID
00386                                 SYSTEMBAR_ANIMATION,            // Bar ID
00387                                 TRUE,                           // Recieve system messages
00388                                 FALSE,                          // Smart duplicate operation
00389                                 TRUE,                           // Clean operation
00390                                 NULL,                           // String for one copy only error
00391                                 (DONT_GREY_WHEN_SELECT_INSIDE | GREY_WHEN_NO_CURRENT_DOC) // Auto state flags
00392                                 )
00393                                 &&
00394             RegisterOpDescriptor(
00395                                 0,                              // Tool ID 
00396                                 _R(IDS_SELECTNEXTFRAME),            // String resource ID
00397                                 CC_RUNTIME_CLASS(OpSelectNextFrame),    // Runtime class
00398                                 OPTOKEN_FRAME_NEXTFRAME,        // Token string
00399                                 OpSelectNextFrame::GetState,    // GetState function
00400                                 0,                              // help ID
00401                                 _R(IDBBL_SELECTNEXTFRAME),          // bubble help
00402                                 _R(IDD_ANIMATIONBAR),               // resource ID
00403                                 _R(IDC_PREVIEW_NEXTFRAME),          // control ID
00404                                 SYSTEMBAR_ANIMATION,            // Bar ID
00405                                 TRUE,                           // Recieve system messages
00406                                 FALSE,                          // Smart duplicate operation
00407                                 TRUE,                           // Clean operation
00408                                 NULL,                           // String for one copy only error
00409                                 (DONT_GREY_WHEN_SELECT_INSIDE | GREY_WHEN_NO_CURRENT_DOC) // Auto state flags
00410                                 )
00411                                 &&
00412             RegisterOpDescriptor(
00413                                 0,                              // Tool ID 
00414                                 _R(IDS_NEWFRAME),                   // String resource ID
00415                                 CC_RUNTIME_CLASS(OpCreateNewFrame), // Runtime class
00416                                 OPTOKEN_FRAME_NEWFRAME,         // Token string
00417                                 OpCreateNewFrame::GetState,     // GetState function
00418                                 0,                              // help ID
00419                                 _R(IDBBL_NEWFRAME),                 // bubble help
00420                                 _R(IDD_ANIMATIONBAR),               // resource ID
00421                                 _R(IDC_FRAME_NEWFRAME),             // control ID
00422                                 SYSTEMBAR_ANIMATION,            // Bar ID
00423                                 TRUE,                           // Recieve system messages
00424                                 FALSE,                          // Smart duplicate operation
00425                                 TRUE,                           // Clean operation
00426                                 NULL,                           // String for one copy only error
00427                                 (DONT_GREY_WHEN_SELECT_INSIDE | GREY_WHEN_NO_CURRENT_DOC) // Auto state flags
00428                                 )
00429                                 &&
00430             RegisterOpDescriptor(
00431                                 0,                              // Tool ID 
00432                                 _R(IDS_COPYFRAME),                  // String resource ID
00433                                 CC_RUNTIME_CLASS(OpCopyFrame),  // Runtime class
00434                                 OPTOKEN_FRAME_COPYFRAME,        // Token string
00435                                 OpCopyFrame::GetState,          // GetState function
00436                                 0,                              // help ID
00437                                 _R(IDBBL_COPYFRAME),                // bubble help
00438                                 _R(IDD_ANIMATIONBAR),               // resource ID
00439                                 _R(IDC_FRAME_COPYFRAME),            // control ID
00440                                 SYSTEMBAR_ANIMATION,            // Bar ID
00441                                 TRUE,                           // Recieve system messages
00442                                 FALSE,                          // Smart duplicate operation
00443                                 TRUE,                           // Clean operation
00444                                 NULL,                           // String for one copy only error
00445                                 (DONT_GREY_WHEN_SELECT_INSIDE | GREY_WHEN_NO_CURRENT_DOC) // Auto state flags
00446                                 )
00447                                 &&
00448             RegisterOpDescriptor(
00449                                 0,                              // Tool ID 
00450                                 _R(IDS_DELETEFRAME),                // String resource ID
00451                                 CC_RUNTIME_CLASS(OpDeleteFrame),// Runtime class
00452                                 OPTOKEN_FRAME_DELETEFRAME,      // Token string
00453                                 OpDeleteFrame::GetState,        // GetState function
00454                                 0,                              // help ID
00455                                 _R(IDBBL_DELETEFRAME),              // bubble help
00456                                 _R(IDD_ANIMATIONBAR),               // resource ID
00457                                 _R(IDC_FRAME_DELETEFRAME),          // control ID
00458                                 SYSTEMBAR_ANIMATION,            // Bar ID
00459                                 TRUE,                           // Recieve system messages
00460                                 FALSE,                          // Smart duplicate operation
00461                                 TRUE,                           // Clean operation
00462                                 NULL,                           // String for one copy only error
00463                                 (DONT_GREY_WHEN_SELECT_INSIDE | GREY_WHEN_NO_CURRENT_DOC) // Auto state flags
00464                                 )
00465                                 &&
00466 #endif // EXCLUDE_FROM_XARALX
00467                                 TRUE
00468             );
00469 }               

BOOL OpLayerGalChange::IsFrameMode  )  [static]
 

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

Definition at line 1302 of file layergal.cpp.

01303 {
01304     // Flag variables.
01305     BOOL FramedDoc = FALSE;     // Flag to determine the document type.
01306     
01307     // Get a ptr to the selected spread
01308     Spread* pSpread = Document::GetSelectedSpread();
01309 
01310     // Ensure a valid spread ptr.
01311     if(pSpread)
01312     {
01313         // Are there any frame layers?
01314         Layer* pFrameLayer = pSpread->FindFirstFrameLayer();    
01315 
01316         //If a frame layer exists, then this is an animation doc.
01317         if (pFrameLayer)
01318             FramedDoc = TRUE;
01319     }
01320 
01321     return FramedDoc;
01322 }

virtual BOOL OpLayerGalChange::MayChangeNodeBounds  )  const [inline, virtual]
 

Reimplemented from UndoableOperation.

Definition at line 296 of file layergal.h.

00296 { return TRUE; }

BOOL OpLayerGalChange::Redo  )  [virtual]
 

The overloaded Redo operation refreshes the layer details in the layer manager.

Author:
Simon_Maneggio (Xara Group Ltd) <camelotdev@xara.com>
Date:
4/8/94
Parameters:
- [INPUTS]
- [OUTPUTS]
Returns:
-

Errors: -

See also:
-

Reimplemented from Operation.

Definition at line 1220 of file layergal.cpp.

01221 {
01222     // Do some stuff before the redo takes place, relevent to the operation being redone
01223     switch (Reason)
01224     {
01225         case FRAME_DELETE:
01226         case LAYER_DELETE:
01227         case PAGEBACKGROUND_DEFAULT:
01228 
01229             ERROR3IF(pOpRedoLayer == NULL,"The op's redo layer ptr is NULL");
01230 
01231             // If redoing a layer delete, make sure there are no selected nodes on the layer before
01232             // it disappears
01233             if (pOpRedoLayer != NULL && pOpRedoLayer->FindParent() != NULL)
01234                 NodeRenderableInk::DeselectAllOnLayer(pOpRedoLayer);
01235 
01236             // **** Fall through...
01237 
01238         case FRAME_NEW:
01239         case FRAME_COPY:
01240         case FRAME_MOVE:
01241         case LAYER_NEW:
01242         case LAYER_COPY:
01243         case LAYER_MOVE:
01244 
01245             // All the above reasons generate hidden nodes, so the HideNode and ShowNode code
01246             // will broadcast layer changes on undo and redo (hopefully!)
01247             BroadcastLayerChanges = FALSE;
01248             break;
01249 
01250         default:
01251             break;
01252     }
01253 
01254     BOOL Result = Operation::Redo(); 
01255     if (Result)
01256     {
01257         // Do some stuff after the redo takes place, relevent to the operation being redone
01258         switch (Reason)
01259         {
01260             // When moving layers about, we need to make sure the layer moved remains the active layer
01261             case FRAME_MOVE:
01262             case LAYER_MOVE:
01263                 GetApplication()->UpdateSelection();
01264                 if (pOpRedoLayer != NULL)
01265                 {
01266 PORTNOTE("galleries", "Disabled frame gallery")
01267 #ifndef EXCLUDE_FROM_XARALX
01268                     if (Reason == FRAME_MOVE)
01269                         FrameSGallery::MakeActiveLayer(pOpRedoLayer);
01270                     else
01271 #endif
01272                         LayerSGallery::MakeActiveLayer(pOpRedoLayer);
01273                     BroadcastLayerChanges = TRUE;
01274                 }
01275                 break;
01276 
01277             default:
01278                 break;
01279         }       
01280 
01281         if (BroadcastLayerChanges)
01282         {
01283             BROADCAST_TO_ALL(SpreadMsg(pSpread,SpreadMsg::LAYERCHANGES));
01284         }
01285     }
01286     return (Result); 
01287 }

BOOL OpLayerGalChange::Undo  )  [virtual]
 

The overloaded Undo operation refreshes the layer details in the layer manager.

Author:
Simon_Maneggio (Xara Group Ltd) <camelotdev@xara.com>
Date:
4/8/94
Parameters:
- [INPUTS]
- [OUTPUTS]
Returns:
-

Errors: -

See also:
-

Reimplemented from Operation.

Definition at line 1129 of file layergal.cpp.

01130 {
01131     // Do some stuff before the undo takes place, relevent to the operation being undone
01132     switch (Reason)
01133     {
01134         // Only LAYER_NEW and LAYER_COPY need to worry if pOpUndoLayer is NULL
01135         // LAYER_DELETE op only creates a pOpUndoLayer ptr after the last layer is deleted and
01136         // automatically replaced by a new blank layer.
01137 
01138         case FRAME_NEW:
01139         case FRAME_COPY:
01140         case LAYER_NEW:
01141         case LAYER_COPY:
01142 
01143             ERROR3IF(pOpUndoLayer == NULL,"The op's undo layer ptr is NULL");
01144 
01145             // **** Fall through...
01146 
01147         case FRAME_DELETE:
01148         case LAYER_DELETE:
01149         case PAGEBACKGROUND_DEFAULT:
01150 
01151             // If undoing, make sure there are no selected nodes on the layer before
01152             // it disappears
01153             if (pOpUndoLayer != NULL && pOpUndoLayer->FindParent() != NULL)
01154                 NodeRenderableInk::DeselectAllOnLayer(pOpUndoLayer);
01155 
01156             // **** Fall through...
01157 
01158         case FRAME_MOVE:
01159         case LAYER_MOVE:
01160 
01161             // All the above reasons generate hidden nodes, so the HideNode and ShowNode code
01162             // will broadcast layer changes on undo and redo (hopefully!)
01163             BroadcastLayerChanges = FALSE;
01164             break;
01165 
01166         default:
01167             break;
01168     }
01169 
01170     BOOL Result = Operation::Undo(); 
01171     if (Result)
01172     {
01173         // Do some stuff after the undo takes place, relevent to the operation being undone
01174         switch (Reason)
01175         {
01176             // When moving layers about, we need to make sure the layer moved remains the active layer
01177             case FRAME_MOVE:
01178             case LAYER_MOVE:
01179                 GetApplication()->UpdateSelection();
01180                 if (pOpUndoLayer != NULL)
01181                 {
01182 PORTNOTE("galleries", "Disabled frame gallery")
01183 #ifndef EXCLUDE_FROM_XARALX
01184                     if (Reason == FRAME_MOVE)
01185                         FrameSGallery::MakeActiveLayer(pOpUndoLayer);
01186                     else
01187 #endif
01188                         LayerSGallery::MakeActiveLayer(pOpUndoLayer);
01189                     BroadcastLayerChanges = TRUE;
01190                 }
01191                 break;
01192             default:
01193                 break;
01194         }       
01195 
01196         if (BroadcastLayerChanges)
01197         {
01198             BROADCAST_TO_ALL(SpreadMsg(pSpread,SpreadMsg::LAYERCHANGES));
01199         }
01200     }
01201     return (Result); 
01202 }       


Member Data Documentation

BOOL OpLayerGalChange::BroadcastLayerChanges [private]
 

Definition at line 304 of file layergal.h.

Layer* OpLayerGalChange::pOpRedoLayer [private]
 

Definition at line 302 of file layergal.h.

Layer* OpLayerGalChange::pOpUndoLayer [private]
 

Definition at line 301 of file layergal.h.

Spread* OpLayerGalChange::pSpread [private]
 

Definition at line 300 of file layergal.h.

OpLayerGalReason OpLayerGalChange::Reason [private]
 

Definition at line 299 of file layergal.h.

UINT32 OpLayerGalChange::UndoIDS [private]
 

Definition at line 303 of file layergal.h.


The documentation for this class was generated from the following files:
Generated on Sat Nov 10 03:58:22 2007 for Camelot by  doxygen 1.4.4