ActionColourChange Class Reference

When executed, this copies the IndexedColour 'Defn' over the top of the IndexedColour 'Target', so that Target is redefined. This is used to undo/redo colour edits. A flag 'ChangeIsinvisible' is used to tell whether to broadcast a ColourChangingMsg COLOURUPDATED or COLOURUPDATEDINVISIBLE when the change is applied. More...

#include <colormgr.h>

Inheritance diagram for ActionColourChange:

Action ListItem CCObject SimpleCCObject List of all members.

Public Member Functions

 ActionColourChange ()
 ActionColourChange constructor.
 ~ActionColourChange ()
 ActionColourChange destructor.
virtual ActionCode Execute ()
 Executes the ActionColourChange to swap the two IndexedColours over and generates another ActionColourChange to undo this change.

Static Public Member Functions

static ActionCode Init (Operation *const pOp, ActionList *pActionList, UINT32 ActionSize, IndexedColour *TheTarget, IndexedColour *TheNewDefn, BOOL ChangeIsInvisible, Action **NewAction)
 To check that there is sufficient room for the action in the operation history, and if there is, then to add the action to the operations action list.

Protected Attributes

BOOL IsInvisible

Private Attributes

IndexedColourTarget
IndexedColourNewDefn

Friends

class OpColourChange

Detailed Description

When executed, this copies the IndexedColour 'Defn' over the top of the IndexedColour 'Target', so that Target is redefined. This is used to undo/redo colour edits. A flag 'ChangeIsinvisible' is used to tell whether to broadcast a ColourChangingMsg COLOURUPDATED or COLOURUPDATEDINVISIBLE when the change is applied.

Author:
Jason_Williams (Xara Group Ltd) <camelotdev@xara.com>
Date:
3/6/94 Friends: OpColourChange
Scope: Private - for use only by the ColourManager

See also:
OpColourChange

Definition at line 465 of file colormgr.h.


Constructor & Destructor Documentation

ActionColourChange::ActionColourChange  ) 
 

ActionColourChange constructor.

Author:
Jason_Williams (Xara Group Ltd) <camelotdev@xara.com>
Date:
6/6/94

Definition at line 3444 of file colormgr.cpp.

03445 {
03446 }

ActionColourChange::~ActionColourChange  ) 
 

ActionColourChange destructor.

Author:
Jason_Williams (Xara Group Ltd) <camelotdev@xara.com>
Date:
6/6/94

Definition at line 3460 of file colormgr.cpp.

03461 {
03462 }


Member Function Documentation

ActionCode ActionColourChange::Execute  )  [virtual]
 

Executes the ActionColourChange to swap the two IndexedColours over and generates another ActionColourChange to undo this change.

Author:
Jason_Williams (Xara Group Ltd) <camelotdev@xara.com>
Date:
6/6/94
Parameters:
- [INPUTS]
ActionCode indicating if the action was successfully executed or not [OUTPUTS]
Returns:
-

Reimplemented from Action.

Definition at line 3480 of file colormgr.cpp.

03481 {
03482    ActionColourChange ColChangeAct;
03483    ActionCode ActCode;
03484 
03485      // Create an action to restore the changes we are about to make
03486     if ((ActCode = ActionColourChange::Init(pOperation,
03487                                             pOppositeActLst,
03488                                             sizeof(ActionColourChange),
03489                                             Target, NewDefn, IsInvisible,
03490                                             (Action**)(&ColChangeAct))) != AC_FAIL)
03491     {
03492         // Swap the colour and its undo partner over
03493         Target->SwapWith(NewDefn);
03494 
03495         // Broadcast the change
03496         Document *ScopeDoc  = GetWorkingDoc();
03497         ColourList *ColList = ScopeDoc->GetIndexedColours();
03498         if (IsInvisible)
03499             ColourManager::ColourHasChangedInvisible(ScopeDoc, ColList, Target);
03500         else
03501             ColourManager::ColourHasChanged(ScopeDoc, ColList, Target);
03502     }
03503 
03504     return (ActCode);
03505 }

ActionCode ActionColourChange::Init Operation *const   pOp,
ActionList pActionList,
UINT32  ActionSize,
IndexedColour TheTarget,
IndexedColour TheNewDefn,
BOOL  ChangeIsInvisible,
Action **  NewAction
[static]
 

To check that there is sufficient room for the action in the operation history, and if there is, then to add the action to the operations action list.

Parameters:
pOp,: The operation to which the action should be added [INPUTS] pActionList: The action list in the operation object ActionSize: The size of the action in bytes. This should be the total size of the action (including any objects pointed to by the action). TheTarget: The target colour which will be changed when we are executed TheNewDefn: The definition which will be used to change TheTarget (These 2 colours will be swapped in actual operation)
ChangeIsInvisible: TRUE if this change to the colour is not 'visible' (i.e. objects drawn in this colour will not visibly chnage - the chnage was only to a flag or the name, etc.). See ColourManager:: ColourHasChanged and ColourHasChangedInvisible

Parameters:
NewAction,: A pointer to the action if it could be allocated. [OUTPUTS]
Returns:
AC_FAIL: There was not enough room in the operation history for the action and the user did not wish to continue. Usually End() should be called in this situation.
AC_NORECORD: There was not enough room in the operation history for the action, but the user requested that he wished to continue without undo.

AC_OK : The action was successfully initialised and added to the operation.

The function calls the Action::Init function passing the runtime class of an ActionColourChange.

Returns:
Errors: -
See also:
Action::Init; ColourManager::ColourHasChanged; ColourManager::ColourHasChangedInvisible; OpColourChange::DoWithParam

Definition at line 3562 of file colormgr.cpp.

03569 {
03570     
03571 
03572     ActionCode Ac = (Action::Init(pOp,
03573                                     pActionList,
03574                                     ActionSize,
03575                                     CC_RUNTIME_CLASS(ActionColourChange), 
03576                                     NewAction));
03577     if (*NewAction != NULL)
03578     {
03579         ActionColourChange *ACC = (ActionColourChange*) (*NewAction);
03580         ACC->Target  = TheTarget;
03581         ACC->NewDefn = TheNewDefn;
03582         ACC->IsInvisible = ChangeIsInvisible;
03583     }
03584 
03585     return (Ac);
03586 }


Friends And Related Function Documentation

friend class OpColourChange [friend]
 

Definition at line 469 of file colormgr.h.


Member Data Documentation

BOOL ActionColourChange::IsInvisible [protected]
 

Definition at line 484 of file colormgr.h.

IndexedColour* ActionColourChange::NewDefn [private]
 

Definition at line 488 of file colormgr.h.

IndexedColour* ActionColourChange::Target [private]
 

Definition at line 487 of file colormgr.h.


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