ChangeFillProfileAction Class Reference

Action for changing fill profiles. More...

#include <filltool.h>

Inheritance diagram for ChangeFillProfileAction:

Action ListItem CCObject SimpleCCObject List of all members.

Public Member Functions

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

Static Public Member Functions

static ActionCode Init (Operation *pOp, ActionList *pActionList, AttrFillGeometry *pThisNodeFill, CProfileBiasGain &Profile, ChangeFillProfileAction **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 ChangeFillProfileWithNoUndo (CProfileBiasGain &Profile)
 When applying 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 OpChangeFillProfile::DoWithParam ()). This function is ONLY called from within GradInfoBarOp::ChangeProfile () - after OpChangeFillProfile::DoWithParam () has been called.

Protected Attributes

AttrFillGeometrym_pNodeFill
CProfileBiasGain m_LastProfile

Detailed Description

Action for changing fill profiles.

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

Definition at line 859 of file filltool.h.


Constructor & Destructor Documentation

ChangeFillProfileAction::ChangeFillProfileAction  ) 
 

Construct an object of this type.

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

Definition at line 10314 of file filltool.cpp.

10315 {
10316     m_pNodeFill = NULL;
10317 }

ChangeFillProfileAction::~ChangeFillProfileAction  ) 
 

Destruct an object of this type.

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

Definition at line 10332 of file filltool.cpp.

10333 {
10334 }


Member Function Documentation

void ChangeFillProfileAction::ChangeFillProfileWithNoUndo CProfileBiasGain Profile  )  [static]
 

When applying 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 OpChangeFillProfile::DoWithParam ()). This function is ONLY called from within GradInfoBarOp::ChangeProfile () - after OpChangeFillProfile::DoWithParam () has been called.

Author:
Chris_Snook (Xara Group Ltd) <camelotdev@xara.com>
Date:
24/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 (), OpChangeFillProfile::DoWithParam ().

Definition at line 10429 of file filltool.cpp.

10430 {
10431     Document * pDoc = Document::GetCurrent();
10432 
10433     List ShadowList;
10434 // Why does this change ALL profiles - even those deep down in the selection???
10435 //  FillTools::BuildListOfSelectedNodes(&ShadowList, CC_RUNTIME_CLASS(AttrFillGeometry));
10436     FillTools::GetSelectedAttrList(&ShadowList, CC_RUNTIME_CLASS(AttrFillGeometry), TRUE, FALSE);
10437 
10438     NodeListItem * pItem = (NodeListItem *)ShadowList.GetHead();
10439 
10440     CProfileBiasGain OldGain;
10441 
10442     while (pItem)
10443     {
10444         if (pItem->pNode)
10445         {
10446             AttrFillGeometry* pThisNodeFill = (AttrFillGeometry *)pItem->pNode;
10447                     
10448             FillGeometryAttribute* temp =  (FillGeometryAttribute*) pThisNodeFill->GetAttributeValue ();
10449             temp->SetProfile(Profile);
10450 
10451             NodeRenderableInk* pNode = (NodeRenderableInk*) pThisNodeFill->FindParent ();
10452             Node* pParent = pNode->FindParent ();
10453 
10454             // decide the best option for causing a redraw
10455             
10456             if (IS_A(pParent, Layer))           // a simple node is selected
10457             {
10458                 pDoc->ForceRedraw(pThisNodeFill->FindParentSpread(), 
10459                                   pNode->GetBoundingRect(), FALSE, pNode);
10460             }
10461             else
10462             {
10463                 ObjChangeFlags cFlags;
10464                 cFlags.Attribute = TRUE;        // Needed to make Blends re-calc themselves
10465 
10466                 ObjChangeParam ObjChange(OBJCHANGE_STARTING,cFlags,NULL,NULL);
10467 
10468                 /*(AttrFillGeometry *)*/ (pItem->pNode)->AllowOp(&ObjChange);
10469 
10470                 ObjChange.Define(OBJCHANGE_FINISHED,cFlags,NULL,NULL);
10471                     
10472                 Operation TempOp;
10473 
10474                 TempOp.UpdateAllChangedNodes(&ObjChange);
10475             }
10476         }
10477 
10478         pItem = (NodeListItem *)ShadowList.GetNext(pItem);
10479     }
10480 
10481     ShadowList.DeleteAll();
10482 
10483     if (pDoc->GetOpHistory ().CanRedo ())
10484     {
10485         // then we need to clear out the redo information - since we are now 'before' it ....
10486         pDoc->GetOpHistory ().DeleteRedoableOps ();
10487 
10488         // and update the state of things ....
10489         DialogBarOp::SetSystemStateChanged();
10490         DialogBarOp::UpdateStateOfAllBars();
10491     }
10492 }

ActionCode ChangeFillProfileAction::Execute  )  [virtual]
 

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

Author:
Chris_Snook (Xara Group Ltd) <camelotdev@xara.com>
Date:
7/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 10513 of file filltool.cpp.

10514 {
10515     ActionCode Act;
10516     ChangeFillProfileAction* pAction;
10517 
10518     Act = ChangeFillProfileAction::Init(    pOperation, 
10519                                             pOppositeActLst,
10520                                             m_pNodeFill,
10521                                             m_LastProfile,
10522                                             &pAction,
10523                                             TRUE,
10524                                             FALSE);
10525     
10526     return (Act);
10527 }

ActionCode ChangeFillProfileAction::Init Operation pOp,
ActionList pActionList,
AttrFillGeometry pThisNodeFill,
CProfileBiasGain Profile,
ChangeFillProfileAction **  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:
7/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 pThisNodeFill = ptr to NodeFill to change Profile = New profile to apply to pThisNodeFill
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 10370 of file filltool.cpp.

10377 {
10378     UINT32 ActSize = sizeof(ChangeFillProfileAction);
10379 
10380     ActionCode Ac = Action::Init(pOp,pActionList,ActSize, CC_RUNTIME_CLASS(ChangeFillProfileAction), (Action**)NewAction);
10381 
10382     if (Ac != AC_FAIL)
10383     {
10384         Document * pDoc = Document::GetCurrent();
10385         
10386         // reverse the action
10387         if (bReverse)
10388         {
10389             pActionList->RemoveItem(*NewAction);
10390             pActionList->AddHead(*NewAction);
10391         }
10392         
10393         (*NewAction)->m_pNodeFill = pThisNodeFill;
10394         FillGeometryAttribute* temp =  (FillGeometryAttribute*) pThisNodeFill->GetAttributeValue ();
10395         (*NewAction)->m_LastProfile = temp->GetProfile ();
10396 
10397         NodeRenderableInk* pNode = (NodeRenderableInk*) pThisNodeFill->FindParent ();
10398 
10399         // set the values, invalidate and regenerate
10400 
10401         temp->SetProfile(Profile);
10402 
10403         pDoc->ForceRedraw(pThisNodeFill->FindParentSpread(), 
10404                           pNode->GetBoundingRect(), FALSE, pNode);
10405     }
10406 
10407     return Ac;
10408 }


Member Data Documentation

CProfileBiasGain ChangeFillProfileAction::m_LastProfile [protected]
 

Definition at line 880 of file filltool.h.

AttrFillGeometry* ChangeFillProfileAction::m_pNodeFill [protected]
 

Definition at line 879 of file filltool.h.


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