ChangeTranspFillProfileAction Class Reference

Action for changing transp fill profiles. More...

#include <filltool.h>

Inheritance diagram for ChangeTranspFillProfileAction:

Action ListItem CCObject SimpleCCObject List of all members.

Public Member Functions

 ChangeTranspFillProfileAction ()
 Construct an object of this type.
 ~ChangeTranspFillProfileAction ()
 Destruct an object of this type.
virtual ActionCode Execute ()
 Executes the action. This will reset the transparency profile in m_pNodeTranspFill to its previous one, after creating another action to record the current transparency profile of m_pNodeTranspFill in.

Static Public Member Functions

static ActionCode Init (Operation *pOp, ActionList *pActionList, AttrFillGeometry *pThisNodeTranspFill, CProfileBiasGain &Profile, ChangeTranspFillProfileAction **NewAction, BOOL bReverse=TRUE, BOOL bCache=FALSE)
 This is the function which creates an instance of this action. If there is no room in the undo buffer (which is determined by the base class Init function called within) the function will either return AC_NO_RECORD which means the operation can continue, but no undo information needs to be stored, or AC_OK which means the operation should continue AND record undo information. If the function returns AC_FAIL, there was not enough memory to record the undo information, and the user has decided not to continue with the operation.
static void ChangeTranspFillProfileWithNoUndo (CProfileBiasGain &Profile)
 When applying transp fill profiles, we only want to generate one bit of undo information. This function allows us to meet this requirement (the one bit of undo information is generated via OpChangeTranspFillProfile::DoWithParam ()). This function is ONLY called from within TranspInfoBarOp::ChangeProfile () - after OpChangeTranspFillProfile::DoWithParam () has been called.

Protected Attributes

AttrFillGeometrym_pNodeTranspFill
CProfileBiasGain m_LastProfile

Detailed Description

Action for changing transp fill profiles.

Author:
Chris_Snook (Xara Group Ltd) <camelotdev@xara.com>
Date:
10/2/2000
See also:
-

Definition at line 944 of file filltool.h.


Constructor & Destructor Documentation

ChangeTranspFillProfileAction::ChangeTranspFillProfileAction  ) 
 

Construct an object of this type.

Author:
Chris_Snook (Xara Group Ltd) <camelotdev@xara.com>
Date:
10/2/2000
Parameters:
- [INPUTS]

Definition at line 10705 of file filltool.cpp.

10706 {
10707     m_pNodeTranspFill = NULL;
10708 }

ChangeTranspFillProfileAction::~ChangeTranspFillProfileAction  ) 
 

Destruct an object of this type.

Author:
Chris_Snook (Xara Group Ltd) <camelotdev@xara.com>
Date:
10/2/2000
Parameters:
- [INPUTS]

Definition at line 10723 of file filltool.cpp.

10724 {
10725 }


Member Function Documentation

void ChangeTranspFillProfileAction::ChangeTranspFillProfileWithNoUndo CProfileBiasGain Profile  )  [static]
 

When applying transp fill profiles, we only want to generate one bit of undo information. This function allows us to meet this requirement (the one bit of undo information is generated via OpChangeTranspFillProfile::DoWithParam ()). This function is ONLY called from within TranspInfoBarOp::ChangeProfile () - after OpChangeTranspFillProfile::DoWithParam () has been called.

Author:
Chris_Snook (Xara Group Ltd) <camelotdev@xara.com>
Date:
25/2/2000
Parameters:
Profile - the profile that is to be applied directly (i.e. applied with no undo) [INPUTS]
Returns:
Errors: -
See also:
GradInfoBarOp::ChangeProfile (), OpChangeTranspFillProfile::DoWithParam ().

Definition at line 10819 of file filltool.cpp.

10820 {
10821     Document * pDoc = Document::GetCurrent();
10822 
10823     List ShadowList;
10824 // Why does this change ALL profiles - even those deep down in the selection???
10825 //  FillTools::BuildListOfSelectedNodes(&ShadowList, CC_RUNTIME_CLASS(AttrTranspFillGeometry));
10826     FillTools::GetSelectedAttrList(&ShadowList, CC_RUNTIME_CLASS(AttrTranspFillGeometry), TRUE, TRUE);
10827 
10828     NodeListItem * pItem = (NodeListItem *)ShadowList.GetHead();
10829 
10830     CProfileBiasGain OldGain;
10831 
10832     while (pItem)
10833     {
10834         if (pItem->pNode)
10835         {
10836             AttrFillGeometry* pThisNodeFill = (AttrFillGeometry *)pItem->pNode;
10837                     
10838             FillGeometryAttribute* temp =  (FillGeometryAttribute*) pThisNodeFill->GetAttributeValue ();
10839             temp->SetProfile(Profile);
10840 
10841             NodeRenderableInk* pNode = (NodeRenderableInk*) pThisNodeFill->FindParent ();
10842             Node* pParent = pNode->FindParent ();
10843 
10844             // decide the best option for causing a redraw
10845             
10846             if (IS_A(pParent, Layer))           // a simple node is selected
10847             {
10848                 pDoc->ForceRedraw(pThisNodeFill->FindParentSpread(),
10849                                   pNode->GetBoundingRect(), FALSE, pNode);
10850             }
10851             else
10852             {
10853                 ObjChangeFlags cFlags;
10854                 cFlags.Attribute = TRUE;        // Needed to make Blends re-calc themselves
10855 
10856                 ObjChangeParam ObjChange(OBJCHANGE_STARTING,cFlags,NULL,NULL);
10857 
10858                 /*(AttrFillGeometry *)*/ (pItem->pNode)->AllowOp(&ObjChange);
10859 
10860                 ObjChange.Define(OBJCHANGE_FINISHED,cFlags,NULL,NULL);
10861                     
10862                 Operation TempOp;
10863 
10864                 TempOp.UpdateAllChangedNodes(&ObjChange);
10865             }
10866         }
10867 
10868         pItem = (NodeListItem *)ShadowList.GetNext(pItem);
10869     }
10870 
10871     ShadowList.DeleteAll();
10872 
10873     if (pDoc->GetOpHistory ().CanRedo ())
10874     {
10875         // then we need to clear out the redo information - since we are now 'before' it ....
10876         pDoc->GetOpHistory ().DeleteRedoableOps ();
10877 
10878         // and update the state of things ....
10879         DialogBarOp::SetSystemStateChanged();
10880         DialogBarOp::UpdateStateOfAllBars();
10881     }
10882 }

ActionCode ChangeTranspFillProfileAction::Execute  )  [virtual]
 

Executes the action. This will reset the transparency profile in m_pNodeTranspFill to its previous one, after creating another action to record the current transparency profile of m_pNodeTranspFill in.

Author:
Chris_Snook (Xara Group Ltd) <camelotdev@xara.com>
Date:
10/2/2000
Parameters:
- [INPUTS]
- [OUTPUTS]
Returns:
ActionCode, one of AC_OK, AC_NO_RECORD or AC_FAIL

Errors: -

See also:
Action::Init()

Reimplemented from Action.

Definition at line 10903 of file filltool.cpp.

10904 {
10905     ActionCode Act;
10906     ChangeFillProfileAction* pAction;
10907 
10908     Act = ChangeFillProfileAction::Init(    pOperation, 
10909                                             pOppositeActLst,
10910                                             m_pNodeTranspFill,
10911                                             m_LastProfile,
10912                                             &pAction,
10913                                             TRUE,
10914                                             FALSE);
10915     
10916     return (Act);
10917 }

ActionCode ChangeTranspFillProfileAction::Init Operation pOp,
ActionList pActionList,
AttrFillGeometry pThisNodeTranspFill,
CProfileBiasGain Profile,
ChangeTranspFillProfileAction **  NewAction,
BOOL  bReverse = TRUE,
BOOL  bCache = FALSE
[static]
 

This is the function which creates an instance of this action. If there is no room in the undo buffer (which is determined by the base class Init function called within) the function will either return AC_NO_RECORD which means the operation can continue, but no undo information needs to be stored, or AC_OK which means the operation should continue AND record undo information. If the function returns AC_FAIL, there was not enough memory to record the undo information, and the user has decided not to continue with the operation.

Author:
Chris_Snook (Xara Group Ltd) <camelotdev@xara.com>
Date:
10/2/2000
Parameters:
pOp = ptr to the operation to which this action belongs [INPUTS] pActionList = ptr to action list to which this action should be added pThisNodeTranspFill = ptr to NodeTranspFill to change Profile = New profile to apply to pThisNodeTranspFill
ppNewAction = ptr to a ptr to an action, allowing the function to return [OUTPUTS] a pointer to the created action
Returns:
ActionCode, one of AC_OK, AC_NO_RECORD or AC_FAIL

Errors: -

See also:
Action::Init()

Definition at line 10760 of file filltool.cpp.

10767 {
10768     UINT32 ActSize = sizeof(ChangeTranspFillProfileAction);
10769 
10770     ActionCode Ac = Action::Init(pOp,pActionList,ActSize, CC_RUNTIME_CLASS(ChangeTranspFillProfileAction), (Action**)NewAction);
10771 
10772     if (Ac != AC_FAIL)
10773     {
10774         Document * pDoc = Document::GetCurrent();
10775         
10776         // reverse the action
10777         if (bReverse)
10778         {
10779             pActionList->RemoveItem(*NewAction);
10780             pActionList->AddHead(*NewAction);
10781         }
10782         
10783         (*NewAction)->m_pNodeTranspFill = pThisNodeTranspFill;
10784         FillGeometryAttribute* temp =  (FillGeometryAttribute*) pThisNodeTranspFill->GetAttributeValue ();
10785         (*NewAction)->m_LastProfile = temp->GetProfile ();
10786 
10787         NodeRenderableInk* pNode = (NodeRenderableInk*) pThisNodeTranspFill->FindParent ();
10788 
10789         // set the values, invalidate and regenerate
10790 
10791         temp->SetProfile(Profile);
10792 
10793         pDoc->ForceRedraw(pThisNodeTranspFill->FindParentSpread(), 
10794                 pNode->GetBoundingRect(), FALSE, pNode);
10795     }
10796 
10797     return Ac;
10798 }


Member Data Documentation

CProfileBiasGain ChangeTranspFillProfileAction::m_LastProfile [protected]
 

Definition at line 965 of file filltool.h.

AttrFillGeometry* ChangeTranspFillProfileAction::m_pNodeTranspFill [protected]
 

Definition at line 964 of file filltool.h.


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