#include <blndtool.h>
Inheritance diagram for OpChangeBlendSteps:
Public Member Functions | |
OpChangeBlendSteps () | |
~OpChangeBlendSteps () | |
virtual void | DoWithParam (OpDescriptor *, OpParam *pOpParam) |
This changes all the selected blend objects to have pOpParam->Param1 number of steps. | |
virtual void | GetOpName (String_256 *OpName) |
The GetOpName fn is overridden so that we return back a description appropriate to the type of attribute that the operation applies. | |
virtual BOOL | MayChangeNodeBounds () const |
BOOL | DeterminBlendObjectsProcessorHit (OpParam *pOpParam, List *nodeList) |
Static Public Member Functions | |
static BOOL | Declare () |
Adds the operation to the list of all known operations. | |
static OpState | GetState (String_256 *Description, OpDescriptor *) |
Find out the state of the operation at the specific time. | |
Private Member Functions | |
CC_DECLARE_DYNCREATE (OpChangeBlendSteps) |
Definition at line 656 of file blndtool.h.
|
Definition at line 662 of file blndtool.h.
|
|
Definition at line 663 of file blndtool.h.
|
|
|
|
Adds the operation to the list of all known operations.
Definition at line 5960 of file blndtool.cpp. 05961 { 05962 return (RegisterOpDescriptor( 05963 0, 05964 0, 05965 CC_RUNTIME_CLASS(OpChangeBlendSteps), 05966 OPTOKEN_CHANGEBLENDSTEPS, 05967 OpChangeBlendSteps::GetState, 05968 0, /* help ID */ 05969 0, /* bubble ID */ 05970 0 /* bitmap ID */ 05971 )); 05972 }
|
|
Definition at line 5844 of file blndtool.cpp. 05845 { 05846 NodeListItem *pItem = NULL; 05847 INT32 total = 0; 05848 05849 // The new number of steps is in pOpParam->Param1 of the 05850 INT32 NewNumSteps = UINT32(pOpParam->Param1); 05851 pItem = (NodeListItem *)NodeList->GetHead(); 05852 05853 OpParam pParam( NewNumSteps, INT32(0) ); 05854 05855 Node* pSelNode = NULL; 05856 05857 if (pItem) 05858 { 05859 pSelNode = pItem->pNode; 05860 } 05861 05862 while (pSelNode != NULL) 05863 { 05864 Node* pNode = pSelNode; 05865 05866 pItem = (NodeListItem *)NodeList->GetNext(pItem); 05867 05868 if (pItem) 05869 { 05870 pSelNode = pItem->pNode; 05871 } 05872 else 05873 { 05874 pSelNode = NULL; 05875 } 05876 05877 if (pNode->IS_KIND_OF(NodeBlend)) 05878 { 05879 // We now have a selected blend node so: 05880 // add in its paths 05881 05882 NodeBlend* pBlend = (NodeBlend*) pNode; 05883 Node* start = NULL, *end = NULL; 05884 05885 pBlend->GetStartAndEndNodes (&start, &end); 05886 05887 if ((start != NULL) && (end != NULL)) 05888 { 05889 total += pNode->EstimateNodeComplexity ( &pParam ); 05890 } 05891 else 05892 { 05893 return (FALSE); 05894 } 05895 } 05896 } 05897 05898 static BOOL foundCPU = FALSE; 05899 static INT32 pathsBeforeAsk = 0; 05900 05901 if (!foundCPU) 05902 { 05903 /* SYSTEM_INFO systemInfo; 05904 GetSystemInfo (&systemInfo); 05905 05906 if (systemInfo.dwProcessorType == PROCESSOR_INTEL_386) 05907 { 05908 pathsBeforeAsk = 6000; 05909 } 05910 else if (systemInfo.dwProcessorType == PROCESSOR_INTEL_486) 05911 { 05912 pathsBeforeAsk = 12000; 05913 } 05914 else if (systemInfo.dwProcessorType == PROCESSOR_INTEL_PENTIUM) 05915 { 05916 pathsBeforeAsk = 20000; 05917 } 05918 else */ 05919 { 05920 // assume its faster than a pentium .... (always true now in 2005!) 05921 pathsBeforeAsk = 24000; 05922 } 05923 foundCPU = TRUE; 05924 } 05925 05926 if (total > pathsBeforeAsk) 05927 { 05928 // Load and build the question text. 05929 String_256 QueryString(_R(IDS_ASKLONGJOB)); 05930 05931 // The only way of bringing up a box with a string in it 05932 Error::SetError(0, QueryString, 0); 05933 INT32 DlgResult = InformMessage(0, _R(IDS_YES), _R(IDS_NO)); 05934 Error::ClearError(); 05935 05936 switch (DlgResult) 05937 { 05938 case 1: // YES 05939 return (TRUE); 05940 break; 05941 case 2: // NO 05942 return (FALSE); // break out of this stuff! 05943 } 05944 } 05945 05946 return (TRUE); 05947 }
|
|
This changes all the selected blend objects to have pOpParam->Param1 number of steps.
Reimplemented from Operation. Definition at line 5728 of file blndtool.cpp. 05729 { 05730 ERROR3IF(pOpParam == NULL,"NULL OpParam ptr"); 05731 if (pOpParam == NULL) return; 05732 05733 List NodeList; 05734 BevelTools::BuildListOfSelectedNodes(&NodeList, CC_RUNTIME_CLASS(NodeRenderableInk)); 05735 05736 NodeListItem *pItem = NULL; 05737 05738 BOOL ok = !NodeList.IsEmpty(); 05739 05740 ok = DeterminBlendObjectsProcessorHit (pOpParam, &NodeList); 05741 05742 if (ok) ok = DoStartSelOp(FALSE,FALSE); 05743 05744 if (ok) 05745 { 05746 // The new number of steps is in pOpParam->Param1 of the 05747 UINT32 NewNumSteps = UINT32(pOpParam->Param1); 05748 pItem = (NodeListItem *)NodeList.GetHead(); 05749 05750 Node* pSelNode = NULL; 05751 05752 if (pItem) 05753 { 05754 pSelNode = pItem->pNode; 05755 } 05756 05757 while (pSelNode != NULL && ok) 05758 { 05759 Node* pNode = pSelNode; 05760 05761 pItem = (NodeListItem *)NodeList.GetNext(pItem); 05762 05763 if (pItem) 05764 { 05765 pSelNode = pItem->pNode; 05766 } 05767 else 05768 { 05769 pSelNode = NULL; 05770 } 05771 05772 if (pNode->IS_KIND_OF(NodeBlend)) 05773 { 05774 // We now have a selected blend node so: 05775 // Invalidate the node's region 05776 // Store the current number of blend steps in an undo actiom 05777 // Change the number of steps to NewNumSteps 05778 05779 // Altered by DMC to account for contoured nodes 05780 BOOL bBlend = FALSE; 05781 05782 if (pNode->IS_KIND_OF(NodeBlend)) 05783 { 05784 bBlend = TRUE; 05785 } 05786 05787 05788 05789 NodeRenderableInk * pInk = (NodeRenderableInk *)pNode; 05790 05791 UINT32 NumSteps = 0; 05792 double DistanceEntered = 0.0; 05793 if (bBlend) 05794 { 05795 NumSteps = ((NodeBlend *)pNode)->GetNumBlendSteps(); 05796 DistanceEntered = ((NodeBlend *)pNode)->GetDistanceEntered(); 05797 } 05798 05799 ChangeBlendStepsAction* pAction; 05800 05801 // Ask the node if it's ok to do the op 05802 ObjChangeFlags cFlags; 05803 ObjChangeParam ObjChange(OBJCHANGE_STARTING,cFlags,NULL,this); 05804 ok = pInk->AllowOp(&ObjChange); 05805 05806 if (ok) ok = DoInvalidateNodeRegion(pInk,TRUE,FALSE); 05807 if (ok) ok = (InvalidateBoundsAction::Init(this,&UndoActions,pInk,TRUE) != AC_FAIL); 05808 if (ok) ok = ChangeBlendStepsAction::Init(this,&UndoActions,pInk,NumSteps, DistanceEntered, &pAction) != AC_FAIL; 05809 05810 05811 if (ok) 05812 { 05813 if (bBlend) 05814 { 05815 ((NodeBlend *)pNode)->SetNumBlendSteps(NewNumSteps); 05816 05817 // DY update the distance between steps variable 05818 ((NodeBlend *)pNode)->UpdateStepDistance(); 05819 } 05820 05821 } 05822 05823 if (ok) ok = DoInvalidateNodeRegion(pInk,TRUE,FALSE); 05824 if (ok) ok = (InvalidateBoundsAction::Init(this,&UndoActions,pInk,TRUE) != AC_FAIL); 05825 } 05826 } 05827 } 05828 05829 NodeList.DeleteAll(); 05830 05831 if (ok) 05832 { 05833 // Inform the effected parents of the change 05834 ObjChangeFlags cFlags; 05835 ObjChangeParam ObjChange(OBJCHANGE_FINISHED,cFlags,NULL,this); 05836 UpdateChangedNodes(&ObjChange); 05837 } 05838 else 05839 FailAndExecute(); 05840 05841 End(); 05842 }
|
|
The GetOpName fn is overridden so that we return back a description appropriate to the type of attribute that the operation applies.
Reimplemented from Operation. Definition at line 6042 of file blndtool.cpp. 06043 { 06044 *OpName = String_256(_R(IDS_BLENDSTEPS_UNDO)); 06045 }
|
|
Find out the state of the operation at the specific time.
Definition at line 5989 of file blndtool.cpp. 05990 { 05991 OpState State(FALSE,TRUE); // It's not ticked, but it is greyed by default 05992 05993 // DMc - to test for bevels & contours 05994 // are there any contour nodes in the selection 05995 List NodeList; 05996 BevelTools::BuildListOfSelectedNodes(&NodeList, CC_RUNTIME_CLASS(NodeBlend)); 05997 05998 if (!NodeList.IsEmpty()) 05999 { 06000 State.Greyed = FALSE; 06001 } 06002 06003 NodeList.DeleteAll(); 06004 06005 // DY awful hack to allow us to call this op from the bezier tool 06006 // when we wish to edit the path of a blend on a path. 06007 Range * pSel = GetApplication()->FindSelection(); 06008 06009 if (pSel) 06010 { 06011 Node* pNode = pSel->FindFirst(); 06012 if (pNode->IS_KIND_OF(NodeBlendPath)) 06013 { 06014 State.Greyed = FALSE; 06015 } 06016 } 06017 06018 if (State.Greyed) 06019 *Description = String_256(_R(IDS_REMOVEBLEND_GREYED)); 06020 else 06021 *Description = String_256(_R(IDS_BLENDSTEPS)); 06022 06023 return State; 06024 }
|
|
Reimplemented from SelOperation. Definition at line 674 of file blndtool.h. 00674 { return FALSE; }
|