#include <opliveeffects.h>
Inheritance diagram for OpEffectLock:
Public Member Functions | |
virtual void | GetOpName (String_256 *pstrOpName) |
virtual BOOL | DoEffectOp (ListRange *pLevelRange, OpLiveEffectParam *pLEOpParam) |
virtual BOOL | DoEffectNodeOp (NodeEffect *pEffect, OpLiveEffectParam *pParam, NodeBitmapEffect **ppNewEffect) |
virtual BOOL | MayChangeNodeBounds () const |
Static Public Member Functions | |
static OpState | GetState (String_256 *pstrDescription, OpDescriptor *pOpDesc) |
Protected Member Functions | |
virtual BOOL | CopyEffectAttrs (NodeBitmapEffect *pSrcNode, NodeBitmapEffect *pDestNode) |
Copy the Effect attributes from the specified node to another specified node. | |
Private Member Functions | |
CC_DECLARE_DYNCREATE (OpEffectLock) |
Definition at line 537 of file opliveeffects.h.
|
|
|
Copy the Effect attributes from the specified node to another specified node.
Definition at line 3904 of file opliveeffects.cpp. 03905 { 03906 NodeAttribute* pAttr = NodeAttribute::FindFirstAppliedAttr(pSrcNode); 03907 while (pAttr && pAttr->IsEffectAttribute() && pAttr->FindParent()==pSrcNode) 03908 { 03909 if (!pAttr->HasEquivalentDefaultValue(TRUE)) // Only copy attr if it doesn't look like the default 03910 { 03911 if (pDestNode->IsValidEffectAttr(pAttr)) 03912 { 03913 NodeAttribute* pExistingAttr = pDestNode->FindAppliedAttribute(pAttr->GetRuntimeClass()); 03914 if (pExistingAttr==NULL || pExistingAttr->FindParent()!=pDestNode) 03915 { 03916 // We can copy our effect attr to pInkNode as an effect attr 03917 // Make a copy of this LiveEffect 03918 NodeAttribute* pCopyAttr = NULL; 03919 BOOL bOK = FALSE; 03920 CALL_WITH_FAIL(pCopyAttr = (NodeAttribute*)pAttr->SimpleCopy(), this, bOK); 03921 if (!bOK) return FALSE; // No room to take a copy of the node 03922 03923 pCopyAttr->AttachNode(pDestNode, LASTCHILD); 03924 } 03925 } 03926 } 03927 03928 pAttr = NodeAttribute::FindPrevAppliedAttr(pAttr); 03929 } 03930 03931 return TRUE; 03932 }
|
|
Reimplemented from OpLiveEffect. Definition at line 3756 of file opliveeffects.cpp. 03757 { 03758 // We should have decent inputs... 03759 ERROR2IF(pLE==NULL, FALSE, "OpEffectLock::DoEffectNodeOp given NULL node"); 03760 ERROR2IF(pParam==NULL, FALSE, "OpEffectRes::DoEffectNodeOp given NULL param"); 03761 03762 double dViewPPI = 96.0; 03763 View* pView = View::GetCurrent(); 03764 if (pView) dViewPPI = 72000.0 / pView->GetPixelWidth().MakeDouble(); 03765 BOOL bForceLock = pParam->bForceLock; 03766 NodeBitmapEffect* pNewEffect = NULL; 03767 03768 if (pLE->IsBitmapEffect() && !pLE->IsFeatherEffect()) 03769 { 03770 NodeBitmapEffect* pBitmapEffect = (NodeBitmapEffect*)pLE; 03771 if (pBitmapEffect->IsLockedEffect()) 03772 { 03773 if (((NodeLockedEffect*)pBitmapEffect)->CanBeUnlocked() && bForceLock==FALSE) 03774 { 03775 // ----------------------------------------------------------------- 03776 // Unlock 03777 BOOL bWasSelected = pBitmapEffect->IsSelected(); 03778 03779 // Get resolution for live effect from locked effect but set to 03780 // automatic if its the same as the current screen resolution 03781 double dNewRes = pBitmapEffect->GetPixelsPerInch(); 03782 if (dNewRes==dViewPPI) 03783 dNewRes = 0; // "Automatic" 03784 03785 pNewEffect = DoApplyLiveEffect(this, 03786 pBitmapEffect, 03787 pBitmapEffect->GetPostProcessorID(), 03788 pBitmapEffect->GetDisplayName(), 03789 dNewRes, // NodeBitmapEffect::DefaultLivePixelsPerInch, //pBitmapEffect->GetPixelsPerInch(), 03790 pBitmapEffect->GetEditList() 03791 ); 03792 CopyEffectAttrs(pBitmapEffect, pNewEffect); 03793 DoFactorOutCommonChildAttributes(pNewEffect); 03794 DoDeletePostProcessor(this, pBitmapEffect, TRUE); 03795 03796 if (bWasSelected) 03797 { 03798 pNewEffect->Select(FALSE); // Should skip down to underlying node automatically 03799 } 03800 03801 *ppNewEffect = pNewEffect; 03802 return TRUE; 03803 } 03804 } 03805 else 03806 { 03807 if (bForceLock==TRUE) // Prevent unwanted extra work 03808 { 03809 // ----------------------------------------------------------------- 03810 // Lock 03811 ERROR3IF(pBitmapEffect->IsLockedEffect(), "Unexpected type of BitmapEffect in OpEffectLock"); 03812 NodeLiveEffect* pLiveEffect = (NodeLiveEffect*)pBitmapEffect; 03813 BOOL bWasSelected = pLiveEffect->IsParentOfSelected(); 03814 // double dReqdResolution = NodeBitmapEffect::DefaultLockedPixelsPerInch; 03815 double dReqdResolution = pLiveEffect->GetPixelsPerInch(); 03816 LPBITMAPINFO lpInfo = NULL; 03817 LPBYTE lpBits = NULL; 03818 DocRect rectBounds; 03819 double dRes = 0; 03820 Matrix matTransform; // Defaults to identity 03821 03822 if (bWasSelected) 03823 { 03824 // Deselect before modifying the tree so that flags get sorted out correctly 03825 pLiveEffect->DeSelect(FALSE, TRUE); 03826 } 03827 03828 if (pLiveEffect->GetPixelsPerInch()==dReqdResolution) 03829 { 03830 // We should already have a bitmap of the required resolution 03831 // (unless its been chucked out of the cache) 03832 // If cached bitmap was result of a DirectBitmap process 03833 // Then get bounding rect, transformation and resolution from child 03834 BOOL bDirect = pLiveEffect->GetChildDirectBitmap(NULL, NULL, NULL, NULL, &matTransform, &dRes); 03835 if (dRes==0) 03836 dRes = pLiveEffect->GetPixelsPerInch(); 03837 03838 // We only want to get the bitmap bounds in direct space if the matrix indicates 03839 // a valid transform from direct space into document space. 03840 // If not then we want bounds from document space. 03841 // See also HasCachedDirectBitmap 03842 bDirect = bDirect && !matTransform.IsIdentity(); 03843 pLiveEffect->GetProcessedBitmap(bDirect, &lpInfo, &lpBits, &rectBounds); 03844 03845 pLiveEffect->RemoveBitmapFromCache(); // So that bitmap is no longer subject to auto-deletion 03846 } 03847 03848 // NOTE: We don't need to regenerate here because the node will grab a bitmap automatically 03849 // during rendering 03850 03851 pNewEffect = DoApplyLiveEffect(this, 03852 pLiveEffect, 03853 pLiveEffect->GetPostProcessorID(), 03854 pLiveEffect->GetDisplayName(), 03855 dReqdResolution, //pLiveEffect->GetPixelsPerInch(), 03856 pLiveEffect->GetEditList(), 03857 TRUE // bMakeLocked 03858 ); 03859 CopyEffectAttrs(pLiveEffect, pNewEffect); 03860 DoFactorOutCommonChildAttributes(pNewEffect); 03861 03862 // If we have an initialisation bitmap set it now 03863 if (pNewEffect && lpInfo && lpBits && rectBounds.IsValid()) 03864 { 03865 pNewEffect->SetProcessedBitmap(lpInfo, lpBits, rectBounds, 0, 0, 0, 0, 72000.0/dRes, &matTransform); 03866 } 03867 03868 DoDeletePostProcessor(this, pLiveEffect, TRUE); 03869 03870 if (bWasSelected) 03871 { 03872 pNewEffect->Select(FALSE); 03873 } 03874 03875 *ppNewEffect = pNewEffect; 03876 return TRUE; 03877 } 03878 } 03879 } 03880 else 03881 ERROR3("Unknown effect type in OpEffectLock::DoEffectNodeOp"); 03882 03883 return FALSE; 03884 }
|
|
Reimplemented from OpLiveEffect. Reimplemented in OpEffectLockAll. Definition at line 3728 of file opliveeffects.cpp. 03729 { 03730 BOOL bOK = FALSE; 03731 03732 UINT32 idsProgress = _R(IDS_LE_UNLOCK_PROGRESS); 03733 if (pParam->bForceLock) idsProgress = _R(IDS_LE_LOCK_PROGRESS); 03734 bOK = DoEffectRangeOp(idsProgress, pLevelRange, pParam); 03735 03736 return bOK; 03737 }
|
|
Reimplemented from Operation. Reimplemented in OpEffectLockAll. Definition at line 3706 of file opliveeffects.cpp. 03707 { 03708 *pstrOpName = String_256(_R(IDS_LE_OPEFFECTLOCK)); 03709 }
|
|
Reimplemented in OpEffectLockAll. Definition at line 3680 of file opliveeffects.cpp. 03681 { 03682 // default is an unticked, *GREYED*, on-menu state. 03683 OpState OpSt; 03684 OpSt.Greyed = FALSE; 03685 *pstrDescription = String_256(_R(IDS_DESCRIBE_LIVEEFFECT)); 03686 03687 return OpSt; 03688 }
|
|
Reimplemented from SelOperation. Reimplemented in OpEffectLockAll. Definition at line 550 of file opliveeffects.h. 00550 { return FALSE; }
|