#include <colormgr.h>
Inheritance diagram for ActionHideColours:
Public Member Functions | |
ActionHideColours () | |
ActionHideColours constructor. | |
~ActionHideColours () | |
ActionHideColours destructor. | |
virtual void | Slaughter (void) |
ActionHideColours Slaughter method. Cleans up any deleted colours associated with this action - once slaughtered, deleted colours can not come back (touch wood!) so are actually deleted from the document rather than just hidden. | |
virtual ActionCode | Execute () |
Executes the ActionHideColours (to hide/unhide an IndexedColour), creating an equal and opposite action to undo it with later. | |
Static Public Member Functions | |
static ActionCode | Init (Operation *const pOp, ActionList *pActionList, UINT32 ActionSize, ColourList *ParentList, IndexedColour *Colour[], BOOL HideThem, 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. | |
Private Attributes | |
ColourList * | ParentList |
IndexedColour ** | ChangeColour |
BOOL | HideFlag |
Definition at line 356 of file colormgr.h.
|
ActionHideColours constructor.
Definition at line 2853 of file colormgr.cpp. 02854 { 02855 ChangeColour = NULL; 02856 ParentList = NULL; 02857 }
|
|
ActionHideColours destructor.
Definition at line 2871 of file colormgr.cpp. 02872 { 02873 if (ChangeColour != NULL) 02874 delete [] ChangeColour; 02875 }
|
|
Executes the ActionHideColours (to hide/unhide an IndexedColour), creating an equal and opposite action to undo it with later.
Reimplemented from Action. Definition at line 2949 of file colormgr.cpp. 02950 { 02951 ActionHideColours HideColAct; 02952 ActionCode ActCode; 02953 02954 // Create an action to restore the changes we are about to make 02955 if ((ActCode = ActionHideColours::Init(pOperation, 02956 pOppositeActLst, 02957 sizeof(ActionHideColours), 02958 ParentList, ChangeColour, 02959 ((HideFlag) ? FALSE : TRUE), 02960 (Action**)(&HideColAct))) != AC_FAIL) 02961 { 02962 INT32 Index = 0; 02963 02964 while (ChangeColour[Index] != NULL) // Write all the 'deleted' flags 02965 { 02966 // Check that the caller only gave us named colours 02967 ERROR3IF(!ChangeColour[Index]->IsNamed(), 02968 "You don't need to call (Un)HideColours for Local colours! Remove ASAP!"); 02969 02970 ChangeColour[Index]->SetDeleted(HideFlag); 02971 Index++; 02972 } 02973 } 02974 02975 return (ActCode); 02976 }
|
|
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.
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 ActionHideColours.
Definition at line 3027 of file colormgr.cpp. 03034 { 03035 ActionCode Ac = (Action::Init(pOp, 03036 pActionList, 03037 ActionSize, 03038 CC_RUNTIME_CLASS(ActionHideColours), 03039 NewAction)); 03040 if (*NewAction != NULL) 03041 { 03042 INT32 Count = 0; 03043 03044 while (Colour[Count] != NULL) // Count array size 03045 Count++; 03046 03047 ActionHideColours *AHC = (ActionHideColours*) (*NewAction); 03048 03049 ALLOC_WITH_FAIL(AHC->ChangeColour, new IndexedColourPtr[Count+1], pOp); 03050 03051 if (AHC->ChangeColour == NULL) // Failed in Action Alloc 03052 { 03053 delete AHC; // Delete the action 03054 *NewAction = NULL; // Ensure return NULL 03055 return(AC_FAIL); // And return 'failed' 03056 } 03057 03058 Count = 0; 03059 while (Colour[Count] != NULL) // Copy Colour array 03060 { 03061 AHC->ChangeColour[Count] = Colour[Count]; 03062 Count++; 03063 } 03064 AHC->ChangeColour[Count] = NULL; // And NULL terminate 03065 03066 AHC->ParentList = TheParentList; // Copy the parentlist pointer 03067 AHC->HideFlag = HideThem; // Copy HideFlag 03068 } 03069 03070 return (Ac); 03071 }
|
|
ActionHideColours Slaughter method. Cleans up any deleted colours associated with this action - once slaughtered, deleted colours can not come back (touch wood!) so are actually deleted from the document rather than just hidden.
Reimplemented from Action. Definition at line 2899 of file colormgr.cpp. 02900 { 02901 // If we have some colour(s) and our last action was to hide them (thus they are 02902 // deleted colours rather than undeleted ones), then we are responsible for 02903 // slaughtering the now-unneeded colours. 02904 // NOTE: Remember that if we are a 'Hide' action, then the colour should currently 02905 // be in an UN-hidden state; thus, we delete ONLY if we are an UN-hide action. 02906 02907 if (ChangeColour != NULL && !HideFlag) 02908 { 02909 INT32 Index = 0; 02910 02911 // Delete each colour in turn from the ParentList ColourList 02912 while (ChangeColour[Index] != NULL) 02913 { 02914 // Remove from the list 02915 ParentList->RemoveItem(ChangeColour[Index]); 02916 02917 // Ensure it has no children pointing at it 02918 ParentList->RemoveLinksToColour(ChangeColour[Index]); 02919 02920 // Delink this colour from its parent, if any 02921 if (ChangeColour[Index]->FindLastLinkedParent() != NULL) 02922 ChangeColour[Index]->SetLinkedParent(NULL, COLOURTYPE_NORMAL); 02923 02924 // And finally, delete it 02925 delete ChangeColour[Index]; 02926 02927 Index++; 02928 } 02929 } 02930 02931 Action::Slaughter(); // Call the base class Slaughter method to delete ourself 02932 }
|
|
Definition at line 378 of file colormgr.h. |
|
Definition at line 379 of file colormgr.h. |
|
Definition at line 377 of file colormgr.h. |