#include <colormgr.h>
Inheritance diagram for OpColourChange:
Public Member Functions | |
OpColourChange () | |
OpColourChange constructor (Creates an undoable operation). | |
~OpColourChange () | |
OpColourChange destructor. | |
void | Do (OpDescriptor *) |
(Performs the colour change operation) OpColourChange has a special overloaded Do operator which takes parameters describing what is to be done - that version of Do must be used | |
void | DoWithParam (OpDescriptor *, OpParam *) |
Performs the colour change operation, which swaps (with undo) the data members two given colours. | |
virtual void | PerformMergeProcessing (void) |
This virtual function gets called to allow for the merging of ColourChange operations - this allows a multitude of sequential colour edits to be merged into a single undo stage. | |
virtual BOOL | Undo () |
Undoes whatever Do() or Redo() did. | |
virtual BOOL | Redo () |
Redoes whatever Undo() undid. | |
Static Public Member Functions | |
static BOOL | Init () |
OpColourChange initialiser method. | |
static OpState | GetState (String_256 *, OpDescriptor *) |
For finding the OpColourChange's state. | |
Protected Attributes | |
IndexedColour * | UndoRecord |
IndexedColour * | RedoRecord |
Definition at line 419 of file colormgr.h.
|
OpColourChange constructor (Creates an undoable operation).
Definition at line 3112 of file colormgr.cpp. 03112 : UndoableOperation() 03113 { 03114 UndoRecord = NULL; 03115 RedoRecord = NULL; 03116 }
|
|
OpColourChange destructor.
Definition at line 3135 of file colormgr.cpp. 03136 { 03137 // We 'own' the UNDO record, so we are responsible for deleting it 03138 if (UndoRecord != NULL) 03139 delete UndoRecord; 03140 03141 // We do not own the RedoRecord, so we leave it alone 03142 }
|
|
(Performs the colour change operation) OpColourChange has a special overloaded Do operator which takes parameters describing what is to be done - that version of Do must be used
Reimplemented from Operation. Definition at line 3216 of file colormgr.cpp. 03217 { 03218 ENSURE(FALSE, "OpColourChange does not provide a Do() function - Use DoWithParam"); 03219 End(); 03220 }
|
|
Performs the colour change operation, which swaps (with undo) the data members two given colours.
DO NOT call this directly - use ColourManager::ChangeColour Note that sequential colour changes for the same colour will be merged into a single undo step.
Reimplemented from Operation. Definition at line 3255 of file colormgr.cpp. 03256 { 03257 ColourChangeInfo *Info = (ColourChangeInfo *) Param; 03258 03259 // Remember the undo record so we don't get memory leakage 03260 UndoRecord = Info->NewDefn; // We 'own' the undo record and must delete it 03261 RedoRecord = Info->Target; // We do NOT own the target: For OpMerging info only 03262 03263 ERROR3IF(UndoRecord == NULL || RedoRecord == NULL || Info->ParentList == NULL, 03264 "Illegal NULL OpParams for OpColourChange"); 03265 03266 // Set our scope variables 03267 pOurDoc = (Document *)Info->ParentList->GetParentDocument(); 03268 pOurView = NULL; 03269 if (!pOurDoc->IsKindOf(CC_RUNTIME_CLASS(Document))) 03270 { 03271 pOurDoc = NULL; // Arrrgh! It must be a basedoc or something! 03272 End(); 03273 return; 03274 } 03275 03276 03277 // Create an action to Undo the hiding operation 03278 ActionColourChange *ACC; 03279 if (ActionColourChange::Init(this, &UndoActions, sizeof(ActionColourChange), 03280 RedoRecord, UndoRecord, Info->InvisibleChange, 03281 (Action**)(&ACC)) == AC_OK) 03282 { 03283 // Apply the initial 'Do' operation - swap the colours 03284 RedoRecord->SwapWith(UndoRecord); 03285 03286 // We have made the change, so broadcast that the list for this doc has changed 03287 if (Info->InvisibleChange) 03288 ColourManager::ColourHasChangedInvisible(GetWorkingDoc(), Info->ParentList, RedoRecord); 03289 else 03290 ColourManager::ColourHasChanged(GetWorkingDoc(), Info->ParentList, RedoRecord); 03291 } 03292 03293 End(); 03294 }
|
|
For finding the OpColourChange's state.
Definition at line 3190 of file colormgr.cpp. 03191 { 03192 OpState OpSt; 03193 return(OpSt); 03194 }
|
|
OpColourChange initialiser method.
Reimplemented from SimpleCCObject. Definition at line 3161 of file colormgr.cpp. 03162 { 03163 return (RegisterOpDescriptor( 03164 0, 03165 _R(IDS_COLOURCHANGEOP), 03166 CC_RUNTIME_CLASS(OpColourChange), 03167 OPTOKEN_COLOURCHANGE, 03168 OpColourChange::GetState, 03169 0, /* help ID */ 03170 0, /* Bubble help ID */ 03171 0 /* bitmap ID */ 03172 )); 03173 }
|
|
This virtual function gets called to allow for the merging of ColourChange operations - this allows a multitude of sequential colour edits to be merged into a single undo stage.
Reimplemented from UndoableOperation. Definition at line 3356 of file colormgr.cpp. 03357 { 03358 // Obtain a pointer to the operation history for the operation's document 03359 OperationHistory* pOpHist = &GetWorkingDoc()->GetOpHistory(); 03360 ERROR3IF(pOpHist == NULL, "There's no OpHistory!?"); 03361 03362 // Ensure that we are the last operation added to the operation history 03363 // Note cannot be an ERROR2 cos this function cannot fail. 03364 ERROR3IF(pOpHist->FindLastOp() != this, "Last Op should be this op"); 03365 03366 // OK lets see if the operation performed before this was an OpNudge operation 03367 Operation* pPrevOp = pOpHist->FindPrevToLastOp(); 03368 03369 if (pPrevOp != NULL) // Check if there was a previous op 03370 { 03371 if (IS_A(pPrevOp, OpColourChange)) 03372 { 03373 if (((OpColourChange *)pPrevOp)->RedoRecord == RedoRecord) 03374 { 03375 // This op is a colour change for the same colour as the last op. 03376 03377 // We may need to change the 'IsVisible' flag for the ActionColourChange 03378 // (if either change is 'visible', the overall change must be 'visible') 03379 03380 ActionColourChange* pNewAction = (ActionColourChange *) 03381 GetUndoActionList()->FindActionOfClass(CC_RUNTIME_CLASS(ActionColourChange)); 03382 03383 ERROR3IF(pNewAction == NULL, "This op should have an ActionColourChange"); 03384 03385 // If the new action is visible, force the old one to be visible 03386 if (pNewAction != NULL && !pNewAction->IsInvisible) 03387 { 03388 ActionColourChange* pOldAction = (ActionColourChange *) 03389 ((OpColourChange *)pPrevOp)->GetUndoActionList()-> 03390 FindActionOfClass(CC_RUNTIME_CLASS(ActionColourChange)); 03391 03392 ERROR3IF(pOldAction == NULL, "This op should have an ActionColourChange"); 03393 03394 if (pOldAction != NULL) 03395 pOldAction->IsInvisible = FALSE; 03396 } 03397 03398 // We have already overwritten the changed colour, so we just kill 03399 // ourselves to remove the unneeded undo step (so undo will revert 03400 // directly to the original state of the colour) 03401 pOpHist->DeleteLastOp(); 03402 } 03403 } 03404 } 03405 }
|
|
Redoes whatever Undo() undid.
Reimplemented from Operation. Definition at line 3331 of file colormgr.cpp. 03332 { 03333 return (Operation::Redo()); 03334 }
|
|
Undoes whatever Do() or Redo() did.
Reimplemented from Operation. Definition at line 3311 of file colormgr.cpp. 03312 { 03313 return (Operation::Undo()); 03314 }
|
|
Definition at line 439 of file colormgr.h. |
|
Definition at line 438 of file colormgr.h. |