OpApplyFeatherEffect Class Reference

Operation to apply Bitmap Effect to the selection. See also:. More...

#include <opliveeffects.h>

Inheritance diagram for OpApplyFeatherEffect:

OpLiveEffect SelOperation UndoableOperation Operation MessageHandler ListItem CCObject SimpleCCObject List of all members.

Public Member Functions

virtual void GetOpName (String_256 *pstrOpName)
virtual void DoWithParam (OpDescriptor *pOpDesc, OpParam *pOpParam)
 Insert a new FeatherEffect attribute in the stack above the selected object(s).
virtual BOOL MayChangeNodeBounds () const

Static Public Member Functions

static OpState GetParamState (String_256 *pstrDescription, OpDescriptor *pOpDesc, OpParam *pOpParam)
 Return state of the specified LiveEffect (name in pstrDescription) being applied to the selection (taking into account the current position in the LiveEffect Stack.

Private Member Functions

 CC_DECLARE_DYNCREATE (OpApplyFeatherEffect)

Detailed Description

Operation to apply Bitmap Effect to the selection. See also:.

Author:
Phil_Martin (Xara Group Ltd) <camelotdev@xara.com>
Date:
07/09/2004

Definition at line 363 of file opliveeffects.h.


Member Function Documentation

OpApplyFeatherEffect::CC_DECLARE_DYNCREATE OpApplyFeatherEffect   )  [private]
 

void OpApplyFeatherEffect::DoWithParam OpDescriptor pOpDesc,
OpParam pOpParam
[virtual]
 

Insert a new FeatherEffect attribute in the stack above the selected object(s).

Author:
Phil_Martin (Xara Group Ltd) <camelotdev@xara.com>
Date:
10/09/2004
Parameters:
[INPUTS] 
[OUTPUTS] 
Returns:

Errors: See also:

Reimplemented from OpLiveEffect.

Definition at line 4136 of file opliveeffects.cpp.

04137 {
04138     BOOL ok = FALSE;
04139 
04140     OpFeatherEffectParam* pFeatherOpParam = NULL;
04141     if (pOpParam->IsKindOf(CC_RUNTIME_CLASS(OpFeatherEffectParam)))
04142         pFeatherOpParam = (OpFeatherEffectParam*) pOpParam;
04143 
04144     INT32 InsertPos = pFeatherOpParam->StackPosition - 1;   // We want to find the surface below the current pos
04145                                                     // because we are going to insert above that surface
04146 
04147     // Remember some details for later on when the Op ends successfully
04148     m_strEffectID = pFeatherOpParam->strOpUnique;
04149     m_iStackPos = InsertPos;
04150 
04151     // obtain the current selection.
04152     SelRange* pSelRange = GetApplication()->FindSelection();
04153 
04154     if (pSelRange->FindFirst()==NULL)
04155     {
04156         End();
04157         return;
04158     }
04159 
04160     Range* pInitialRange = NULL;
04161 
04162     // render blobs off for tools which don't automatically redraw their blobs.
04163     Tool* pTool = Tool::GetCurrent();
04164     Spread* pSpread = Document::GetSelectedSpread();
04165     if (pSpread != NULL && pTool != NULL && !pTool->AreToolBlobsRenderedOnSelection())
04166         pTool->RenderToolBlobs(pSpread, NULL);
04167 
04168     // record the current selection state and if required, render off any selection blobs.
04169     if (!DoStartSelOp(FALSE, FALSE))
04170     {
04171         End();
04172         return;
04173     }
04174 
04175 // Ask the range whether it's OK to do the transform...
04176 // Get an ObjChangeParam ready, so we can ask op permission from nodes.
04177 ObjChangeFlags cFlags(NULL, TRUE, NULL, NULL, NULL, NULL, NULL, TRUE);  // ReplaceNode & RegenerateNode
04178 ObjChangeParam ObjChange(OBJCHANGE_STARTING, cFlags, NULL, this);
04179 BOOL bOK = pSelRange->AllowOp(&ObjChange);
04180 if (!bOK)
04181 {
04182     End();
04183     return;
04184 }
04185     // invalidate the region bounding the selection.
04186     if (!DoInvalidateNodesRegions(*pSelRange, TRUE, FALSE, FALSE, FALSE))
04187     {
04188         End();
04189         return;
04190     }
04191 
04192     // Force text subselection up to the whole parent text object
04193     pSelRange->MakePartialSelectionWhole(FALSE, FALSE, TRUE);
04194 
04195     // Get a list of the LiveEffects we will be working on
04196     ENSURE(m_pLERange==NULL, "!");
04197     if (InsertPos==-1)
04198     {
04199         // We are to apply the LiveEFfects to the selection
04200         pInitialRange = GetApplication()->FindSelection();
04201         m_iStackPos = 0;
04202     }
04203     else
04204     {
04205         ENSURE(pFeatherOpParam->pPPStack, "Can't find EffectsStack");
04206         pInitialRange = pFeatherOpParam->pPPStack->GetLevelRange(&InsertPos);
04207         m_iStackPos = InsertPos+1;          // Remember some details for later on when the Op ends successfully
04208                                             // (New stack pos refers to item to be shown in UI after successful insertion)
04209     }
04210 
04211     // Check whether we can edit an existing effect or whether we have to apply a new one
04212     if (pInitialRange==NULL)
04213     {
04214         ERROR3("If this happens, the UI logic disagrees with the Op about what the Op can do");
04215         FailAndExecute();
04216         End();
04217         return;
04218     }
04219 
04220     m_pLERange = DoApplyFeatherEffect(this, pInitialRange, pFeatherOpParam->strOpUnique, pFeatherOpParam->strMenuText, pFeatherOpParam->FeatherSize, pFeatherOpParam->Profile);
04221     m_bAppliedNewEffects = TRUE;
04222 
04223     // We should now have a decent list of LiveEffect nodes...
04224     if (m_pLERange==NULL)
04225     {
04226         FailAndExecute();
04227         End();
04228         return;
04229     }
04230 
04231     // Inform the modeless Feather UI of the change
04232     // and give it its own copy of the range of feather effect nodes
04233     OpChangeFeatherSize::SetEditContext(m_iStackPos, m_pLERange);
04234 
04235     // Update the LiveEffect Tool's permanent status
04236     if (pTool->GetID()==TOOLID_LIVEEFFECT)
04237     {
04238         ((LiveEffectsTool*)pTool)->SetCurrentEffectID(m_strEffectID);
04239         ((LiveEffectsTool*)pTool)->SetCurrentStackPos(m_iStackPos);
04240     }
04241 
04242     // invalidate the (new) region bounding the selection.
04243     DoInvalidateNodesRegions(*pSelRange, TRUE, FALSE, FALSE);
04244 
04245     // render blobs back on if the current tool doesn't automatically redraw its blobs.
04246     if (pSpread != NULL && pTool != NULL && !pTool->AreToolBlobsRenderedOnSelection())
04247         pTool->RenderToolBlobs(pSpread, NULL);
04248 
04249 ObjChange.Define(OBJCHANGE_FINISHED, cFlags, NULL, this);
04250 ok = UpdateChangedNodes(&ObjChange);
04251 
04252     BROADCAST_TO_ALL(SelChangingMsg(SelChangingMsg::EFFECTSTACKCHANGED)); 
04253 
04254     // Tell the selrange that things have changed!
04255     GetApplication()->FindSelection()->Update();
04256 
04257     End();
04258 }

void OpApplyFeatherEffect::GetOpName String_256 pstrOpName  )  [virtual]
 

Author:
Phil_Martin (Xara Group Ltd) <camelotdev@xara.com>
Date:
07/09/2004
Parameters:
[INPUTS] 
[OUTPUTS] 
Returns:

Errors: See also:

Reimplemented from Operation.

Definition at line 4115 of file opliveeffects.cpp.

04116 {
04117     *pstrOpName = String_256(_R(IDS_LE_OPAPPLYFEATHER));
04118 }

OpState OpApplyFeatherEffect::GetParamState String_256 pstrDescription,
OpDescriptor pOpDesc,
OpParam pOpParam
[static]
 

Return state of the specified LiveEffect (name in pstrDescription) being applied to the selection (taking into account the current position in the LiveEffect Stack.

Author:
Phil_Martin (Xara Group Ltd) <camelotdev@xara.com>
Date:
07/09/2004
Parameters:
[INPUTS] 
[OUTPUTS] 
Returns:

Errors: See also:

Definition at line 4090 of file opliveeffects.cpp.

04091 {
04092     // default is an unticked, *GREYED*, on-menu state.
04093     OpState OpSt;
04094     OpSt.Greyed = (GetApplication()->FindSelection()->FindFirst()==NULL);
04095 
04096     return OpSt;
04097 }

virtual BOOL OpApplyFeatherEffect::MayChangeNodeBounds  )  const [inline, virtual]
 

Reimplemented from SelOperation.

Definition at line 378 of file opliveeffects.h.

00378 { return TRUE; }


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