ChangeBlendAction Class Reference

An action which changes the one-to-one flag of a blend. More...

#include <blndtool.h>

Inheritance diagram for ChangeBlendAction:

Action ListItem CCObject SimpleCCObject List of all members.

Public Member Functions

 ChangeBlendAction ()
 Constructor for the action.
 ~ChangeBlendAction ()
virtual ActionCode Execute ()
 Executes the action. This will reset the num blend steps in pThisNodeBlend to OldNumSteps, after creating another action to record the current num steps of pThisNodeBlend.

Static Public Member Functions

static ActionCode Init (Operation *pOp, ActionList *pActionList, NodeRenderableInk *pThisNodeBlend, ChangeBlendOpParam *pChangeParam, ChangeBlendAction **NewAction)
 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 ChangeObjectProfileWithNoUndo (CProfileBiasGain &Profile, BOOL regenerateParents=FALSE)
 When applying blend (object) 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 OpChangeBlend::DoWithParam ()). This function is ONLY called from within BlendInfoBarOp::ChangeProfile () - after OpChangeBlend::DoWithParam () has been called.
static void ChangeAttributeProfileWithNoUndo (CProfileBiasGain &Profile)
 When applying blend (attribute) 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 OpChangeBlend::DoWithParam ()). This function is ONLY called from within BlendInfoBarOp::ChangeProfile () - after OpChangeBlend::DoWithParam () has been called.

Protected Attributes

NodeRenderableInkpNodeBlend
ChangeBlendOpParam ChangeParam

Detailed Description

An action which changes the one-to-one flag of a blend.

Author:
Mark_Neves (Xara Group Ltd) <camelotdev@xara.com>
Date:
21/11/94
See also:
-

Definition at line 1047 of file blndtool.h.


Constructor & Destructor Documentation

ChangeBlendAction::ChangeBlendAction  ) 
 

Constructor for the action.

Author:
Mark_Neves (Xara Group Ltd) <camelotdev@xara.com>
Date:
6/12/94
Parameters:
- [INPUTS]
- [OUTPUTS]
Returns:
-

Errors: -

See also:
-

Definition at line 7788 of file blndtool.cpp.

07789 {
07790     pNodeBlend  = NULL;
07791 }

ChangeBlendAction::~ChangeBlendAction  ) 
 

Definition at line 8221 of file blndtool.cpp.

08222 {
08223 }


Member Function Documentation

void ChangeBlendAction::ChangeAttributeProfileWithNoUndo CProfileBiasGain Profile  )  [static]
 

When applying blend (attribute) 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 OpChangeBlend::DoWithParam ()). This function is ONLY called from within BlendInfoBarOp::ChangeProfile () - after OpChangeBlend::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:
BlendInfoBarOp::ChangeProfile (), OpChangeBlend::DoWithParam ().

Definition at line 8114 of file blndtool.cpp.

08115 {
08116     List NodeList;
08117     BevelTools::BuildListOfSelectedNodes(&NodeList, CC_RUNTIME_CLASS(NodeRenderableInk));
08118 
08119     BOOL ok = !NodeList.IsEmpty();
08120 
08121     NodeListItem * pItem = NULL;
08122 
08123     if (ok)
08124     {
08125         pItem = (NodeListItem *)NodeList.GetHead();
08126 
08127         Node* pSelNode = NULL;
08128 
08129         if (pItem)
08130         {
08131             pSelNode = pItem->pNode;
08132         }
08133 
08134         Document * pDoc = Document::GetCurrent();
08135 
08136         while (pSelNode != NULL && ok)
08137         {
08138             Node* pNode = pSelNode;
08139 
08140             pItem = (NodeListItem *)NodeList.GetNext(pItem);
08141 
08142             if (pItem)
08143             {
08144                 pSelNode = pItem->pNode;
08145             }
08146             else
08147             {
08148                 pSelNode = NULL;
08149             }
08150 
08151             if (pNode->IS_KIND_OF(NodeBlend))
08152             {
08153                 // We now have a selected blend node so:
08154                 // Change the profile in a non-undoable fashion
08155                 // Invalidate the node's region (thereby causing a redraw)
08156 
08157                 NodeBlend* pNodeBlend = (NodeBlend*)pNode;
08158 
08159                 AFp BiasValue = Profile.GetBias ();
08160                 AFp GainValue = Profile.GetGain ();
08161                 CProfileBiasGain *pProfile = ((NodeBlend *)pNodeBlend)->GetAttrProfile();
08162                 
08163                 if (pProfile != NULL)
08164                 {
08165                     // this may seem a little wierd - BUT we still need to do position
08166                     // processing for the attribute ....
08167                     
08168                     pNodeBlend->RequestObjectProfileProcessing (TRUE);
08169                     pProfile->SetBiasGain(BiasValue, GainValue);
08170                 }
08171 
08172                 pDoc->ForceRedraw(pNodeBlend->FindParentSpread(), 
08173                 pNodeBlend->GetBoundingRect(), FALSE, pNodeBlend);
08174             }
08175         }
08176 
08177         if (pDoc->GetOpHistory ().CanRedo ())
08178         {
08179             // then we need to clear out the redo information - since we are now 'before' it ....
08180             pDoc->GetOpHistory ().DeleteRedoableOps ();
08181 
08182             // and update the state of things ....
08183             DialogBarOp::SetSystemStateChanged();
08184             DialogBarOp::UpdateStateOfAllBars();
08185         }
08186     }
08187 
08188     // de-allocate the contents of NodeList.
08189     NodeList.DeleteAll();
08190 }

void ChangeBlendAction::ChangeObjectProfileWithNoUndo CProfileBiasGain Profile,
BOOL  regenerateParents = FALSE
[static]
 

When applying blend (object) 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 OpChangeBlend::DoWithParam ()). This function is ONLY called from within BlendInfoBarOp::ChangeProfile () - after OpChangeBlend::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] regenerateParents - do we need to regenerate the parents of the affected nodes?
Returns:
Errors: -
See also:
BlendInfoBarOp::ChangeProfile (), OpChangeBlend::DoWithParam ().

Definition at line 7986 of file blndtool.cpp.

07987 {
07988     List NodeList;
07989     BevelTools::BuildListOfSelectedNodes(&NodeList, CC_RUNTIME_CLASS(NodeRenderableInk));
07990 
07991     BOOL ok = !NodeList.IsEmpty();
07992 
07993     NodeListItem * pItem = NULL;
07994 
07995     if (ok)
07996     {
07997         pItem = (NodeListItem *)NodeList.GetHead();
07998 
07999         Node* pSelNode = NULL;
08000 
08001         if (pItem)
08002         {
08003             pSelNode = pItem->pNode;
08004         }
08005 
08006         Document * pDoc = Document::GetCurrent();
08007 
08008         while (pSelNode != NULL && ok)
08009         {
08010             Node* pNode = pSelNode;
08011 
08012             pItem = (NodeListItem *)NodeList.GetNext(pItem);
08013 
08014             if (pItem)
08015             {
08016                 pSelNode = pItem->pNode;
08017             }
08018             else
08019             {
08020                 pSelNode = NULL;
08021             }
08022 
08023             if (pNode->IS_KIND_OF(NodeBlend))
08024             {
08025                 if (!regenerateParents)
08026                 {
08027                     // We now have a selected blend node so:
08028                     // Change the profile in a non-undoable fashion
08029                     // Invalidate the node's region (thereby causing a redraw)
08030 
08031                     NodeBlend* pNodeBlend = (NodeBlend*)pNode;
08032 
08033                     AFp BiasValue = Profile.GetBias ();
08034                     AFp GainValue = Profile.GetGain ();
08035                     CProfileBiasGain *pProfile = ((NodeBlend *)pNodeBlend)->GetObjectProfile();
08036                     
08037                     if (pProfile != NULL)
08038                     {
08039                         pNodeBlend->RequestObjectProfileProcessing (TRUE);
08040                         pProfile->SetBiasGain(BiasValue, GainValue);
08041                     }
08042 
08043                     pDoc->ForceRedraw(pNodeBlend->FindParentSpread(), 
08044                     pNodeBlend->GetBoundingRect(), FALSE, pNodeBlend);
08045                 }
08046                 else
08047                 {
08048                     // now the fun begins!  I need to persuade parents nodes to regenerate - BUT
08049                     // I don't have an op to do it with!  Well lets not let a little thing like that
08050                     // deter us ....
08051 
08052                     NodeBlend* pNodeBlend = (NodeBlend*)pNode;
08053                     
08054                     // Ask the node if it's ok to do the op
08055                     ObjChangeFlags cFlags;
08056                     // Ilan 7/5/00
08057                     // Ensure AllowOp passes messages on to children in compound (so geom linked attrs informed)
08058                     cFlags.TransformNode = TRUE;
08059                     ObjChangeParam ObjChange(OBJCHANGE_STARTING,cFlags,NULL,NULL);//this);
08060                     ok = pNodeBlend->AllowOp(&ObjChange);
08061                 }
08062             }
08063         }
08064 
08065         if (pDoc->GetOpHistory ().CanRedo ())
08066         {
08067             // then we need to clear out the redo information - since we are now 'before' it ....
08068             pDoc->GetOpHistory ().DeleteRedoableOps ();
08069 
08070             // and update the state of things ....
08071             DialogBarOp::SetSystemStateChanged();
08072             DialogBarOp::UpdateStateOfAllBars();
08073         }
08074     }
08075 
08076     // de-allocate the contents of NodeList.
08077     NodeList.DeleteAll();
08078 
08079     if (ok && regenerateParents)
08080     {
08081         // Inform the effected parents of the change
08082         ObjChangeFlags cFlags;
08083         cFlags.RegenerateNode = TRUE;
08084         ObjChangeParam ObjChange(OBJCHANGE_FINISHED,cFlags,NULL,NULL);
08085         
08086         UndoableOperation undoOp;
08087         
08088         undoOp.UpdateChangedNodes(&ObjChange);      // get compound nodes to regenerate themselves
08089         undoOp.FailAndDiscard ();                   // Although we will have succeeded, we don't
08090                                                     // want any of the overheads that would result
08091                                                     // from succeeding - so simply fail
08092     }
08093 }

ActionCode ChangeBlendAction::Execute  )  [virtual]
 

Executes the action. This will reset the num blend steps in pThisNodeBlend to OldNumSteps, after creating another action to record the current num steps of pThisNodeBlend.

Author:
Mark_Neves (Xara Group Ltd) <camelotdev@xara.com>
Date:
6/12/94
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 8210 of file blndtool.cpp.

08211 {
08212     ChangeParam.SwapOldAndNew();
08213 
08214     ActionCode Act;
08215     ChangeBlendAction* pAction;
08216     Act = ChangeBlendAction::Init(pOperation,pOppositeActLst,pNodeBlend,&ChangeParam,&pAction);
08217 
08218     return Act;
08219 }

ActionCode ChangeBlendAction::Init Operation pOp,
ActionList pActionList,
NodeRenderableInk pNodeBlend,
ChangeBlendOpParam pChangeParam,
ChangeBlendAction **  ppNewAction
[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:
Mark_Neves (Xara Group Ltd) <camelotdev@xara.com>
Date:
6/12/94
Parameters:
pOp = ptr to the operation to which this action belongs [INPUTS] pActionList = ptr to action list to which this action should be added pNodeBlend = ptr to NodeBlend to change pChangeParam = ptr to class that details how the blend should be changed.
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
This function actually changes the blend node in a way specified in pChangeParam
Returns:
Errors: -
See also:
Action::Init()

Definition at line 7827 of file blndtool.cpp.

07832 {
07833     ERROR2IF(pNodeBlend   == NULL,AC_FAIL,"pNodeBlend is NULL");
07834     ERROR2IF(pChangeParam == NULL,AC_FAIL,"pChangeParam is NULL");
07835 
07836     UINT32 ActSize = sizeof(ChangeBlendAction);
07837 
07838     ChangeBlendAction* pNewAction;
07839     ActionCode Ac = Action::Init(pOp,pActionList,ActSize,CC_RUNTIME_CLASS(ChangeBlendAction),(Action**)&pNewAction);
07840 
07841     *ppNewAction = pNewAction;
07842 
07843     BOOL bNodeIsContour = FALSE;
07844 
07845     if (Ac != AC_FAIL && pNewAction != NULL)
07846     {
07847         if (!bNodeIsContour)
07848         {
07849             ChangeBlendType ChangeType = pChangeParam->ChangeType;
07850             
07851             pNewAction->pNodeBlend             = pNodeBlend;
07852             pNewAction->ChangeParam.ChangeType = ChangeType;
07853             pNewAction->ChangeParam.SetOldValues(pNodeBlend);
07854             
07855             switch (ChangeType)
07856             {
07857             case CHANGEBLEND_ONETOONE:          ((NodeBlend *)pNodeBlend)->SetOneToOne(pChangeParam->NewOneToOne);          break;
07858             case CHANGEBLEND_ANTIALIAS:         ((NodeBlend *)pNodeBlend)->SetNotAntialiased(!pChangeParam->NewAntiAlias);  break;
07859             case CHANGEBLEND_COLOURBLENDTYPE:   ((NodeBlend *)pNodeBlend)->SetColourBlendType(pChangeParam->NewColBlendType);   break;
07860             case CHANGEBLEND_EDITEND:           ((NodeBlend *)pNodeBlend)->SetLastEdited(pChangeParam->NewEndObject);       break;
07861             case CHANGEBLEND_TANGENTIAL:
07862             {
07863                 // Only change the tangential flag of blends on a curve
07864                 if (((NodeBlend *)pNodeBlend)->GetNodeBlendPath(0) != NULL)
07865                     ((NodeBlend *)pNodeBlend)->SetTangential(pChangeParam->NewTangential);      
07866             }
07867             break;
07868 
07869             // Diccon Yamanaka 9/99 added profile code
07870             case CHANGEBLEND_OBJECTPROFILE:  
07871             {
07872                 AFp BiasValue = (pChangeParam)->NewObjectProfile.GetBias();
07873                 AFp GainValue = (pChangeParam)->NewObjectProfile.GetGain();
07874                 CProfileBiasGain *pProfile = ((NodeBlend *)pNodeBlend)->GetObjectProfile();
07875                 
07876                 if (pProfile != NULL)
07877                 {
07878                     ((NodeBlend*) pNodeBlend)->RequestObjectProfileProcessing (TRUE);
07879                     pProfile->SetBiasGain(BiasValue, GainValue);
07880                 }
07881                 
07882             }
07883             break;
07884             case CHANGEBLEND_ATTRPROFILE:
07885             {
07886                 AFp BiasValue = (pChangeParam)->NewAttrProfile.GetBias();
07887                 AFp GainValue = (pChangeParam)->NewAttrProfile.GetGain();
07888                 CProfileBiasGain *pProfile = ((NodeBlend *)pNodeBlend)->GetAttrProfile();
07889                 
07890                 if (pProfile != NULL)
07891                 {
07892                     // this may seem a little wierd - BUT we still need to do position
07893                     // processing for the attribute ....
07894                     ((NodeBlend*) pNodeBlend)->RequestObjectProfileProcessing (TRUE);
07895                     pProfile->SetBiasGain(BiasValue, GainValue);
07896                 }
07897 
07898             }
07899             break;
07900             
07901             case CHANGEBLEND_BLENDONPATH:
07902             {
07903                 ((NodeBlend*)pNodeBlend)->SetBlendedOnCurve(pChangeParam->NewBlendedOnCurve);
07904     
07905                 // increment/decrement the nodeblendpath counter
07906                 if (pChangeParam->NewBlendedOnCurve)
07907                     ((NodeBlend*)pNodeBlend)->SetNumNodeBlendPaths(TRUE);
07908                 else
07909                     ((NodeBlend*)pNodeBlend)->SetNumNodeBlendPaths(FALSE);
07910 
07911                 NodeBlender* pNodeBlender = ((NodeBlend*)pNodeBlend)->FindFirstBlender();
07912                 ERROR2IF((pNodeBlender == NULL), AC_FAIL, "Couldn't get blender");
07913                 while (pNodeBlender != NULL)
07914                 {
07915                     if (pChangeParam->NewBlendedOnCurve)
07916                         pNodeBlender->SetNodeBlendPathIndex(0);
07917                     else
07918                         pNodeBlender->SetNodeBlendPathIndex(-1);
07919 
07920                     pNodeBlender = ((NodeBlend*)pNodeBlend)->FindNextBlender(pNodeBlender);
07921                 }
07922 
07923                 /*
07924                 Spread* pSpread = pNodeBlend->FindParentSpread();
07925                 if (pSpread != NULL)
07926                 {
07927                     RenderRegion* pOnTopRegion = DocView::RenderOnTop(NULL, pSpread, ClippedEOR);
07928                     while (pOnTopRegion)
07929                     {
07930                         ((NodeBlend*)pNodeBlend)->RenderObjectBlobs(pOnTopRegion);
07931 
07932                         // Go find the next region
07933                         pOnTopRegion = DocView::GetNextOnTop(NULL);
07934                     }
07935                 }
07936                 */
07937             }
07938             break;
07939 
07940             default : ERROR2(AC_FAIL,"Unknown change blend type"); break;
07941             
07942             } // end
07943         } // end if (!bNode..
07944         else
07945         {
07946             ChangeBlendType ChangeType = pChangeParam->ChangeType;
07947             
07948             pNewAction->pNodeBlend             = pNodeBlend;
07949             pNewAction->ChangeParam.ChangeType = ChangeType;
07950             pNewAction->ChangeParam.SetOldValues(pNodeBlend);
07951             
07952             switch (ChangeType)
07953             {
07954             case CHANGEBLEND_COLOURBLENDTYPE:   ((NodeContourController *)pNodeBlend)->SetColourBlendType(pChangeParam->NewColBlendType);   break;
07955             default : ERROR2(AC_FAIL,"Unknown change blend type"); break;
07956             }
07957         } // end else
07958 
07959 
07960         pNewAction->ChangeParam.SetNewValues(pNodeBlend);
07961     } // end if (AC != ..
07962 
07963     return Ac;
07964 }


Member Data Documentation

ChangeBlendOpParam ChangeBlendAction::ChangeParam [protected]
 

Definition at line 1066 of file blndtool.h.

NodeRenderableInk* ChangeBlendAction::pNodeBlend [protected]
 

Definition at line 1065 of file blndtool.h.


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