00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040
00041
00042
00043
00044
00045
00046
00047
00048
00049
00050
00051
00052
00053
00054
00055
00056
00057
00058
00059
00060
00061
00062
00063
00064
00065
00066
00067
00068
00069
00070
00071
00072
00073
00074
00075
00076
00077
00078
00079
00080
00081
00082
00083
00084
00085
00086
00087
00088
00089
00090
00091
00092
00093
00094
00095
00096
00097
00098
00099
00100
00101
00102 #ifndef INC_OPLIVEFX
00103 #define INC_OPLIVEFX
00104
00105 #define OPTOKEN_APPLY_LIVEEFFECT _T("ApplyLiveEffect")
00106 #define OPTOKEN_EDIT_LIVEEFFECT _T("EditLiveEffect")
00107 #define OPTOKEN_DELETE_LIVEEFFECT _T("DeleteLiveEffect")
00108 #define OPTOKEN_DELETEALL_LIVEEFFECT _T("DeleteAllLiveEffect")
00109 #define OPTOKEN_APPLY_FEATHEREFFECT _T("ApplyFeatherEffect")
00110 #define OPTOKEN_CHANGE_EFFECT_RES _T("ChangeEffectRes")
00111 #define OPTOKEN_CHANGE_EFFECT_LOCK _T("ChangeEffectLock")
00112 #define OPTOKEN_CHANGE_EFFECT_LOCKALL _T("ChangeEffectLockAll")
00113 #define OPTOKEN_EDITEFFECTS _T("EditEffectsRootMenuItem")
00114 #define OPTOKEN_EDIT_LEGACYEFFECT _T("EditLegacyEffect")
00115
00116 PORTNOTE("other","Define dummy IXMLDOMDocumentPtr")
00117 #ifndef EXCLUDE_FROM_XARALX
00118 #else
00119 typedef void *IXMLDOMDocumentPtr;
00120 #endif
00121
00122
00123 #include "menuitem.h"
00124
00125
00126
00127 class Range;
00128 class ListRange;
00129 class NodeEffect;
00130 class EffectsStack;
00131 class NodeLiveEffect;
00132 class NodeFeatherEffect;
00133 class NodeBitmapEffect;
00134
00135
00136 #define FEATHER_EFFECT
00137
00138
00139
00140
00141
00142
00143
00144
00145
00146
00147
00148
00149
00150
00151 class OpLiveEffectParam : public OpMenuParam
00152 {
00153 CC_DECLARE_DYNAMIC(OpLiveEffectParam)
00154
00155 public:
00156 OpLiveEffectParam() : OpMenuParam()
00157 {
00158 bIsDestructive = FALSE;
00159 StackPosition = -1;
00160 pPPStack = NULL;
00161 bReUseEditor = FALSE;
00162 pEditsList = NULL;
00163 bSilent = FALSE;
00164 dResolution = 0;
00165 bForceLock = FALSE;
00166 }
00167
00168
00169 public:
00170 BOOL bIsDestructive;
00171 INT32 StackPosition;
00172 EffectsStack* pPPStack;
00173 BOOL bReUseEditor;
00174 IXMLDOMDocumentPtr pEditsList;
00175 BOOL bSilent;
00176 double dResolution;
00177 BOOL bForceLock;
00178 };
00179
00180
00181
00182
00183
00184
00185
00186
00187
00188
00189
00190
00191
00192
00193
00194
00195
00196 #ifdef FEATHER_EFFECT
00197 class OpFeatherEffectParam : public OpLiveEffectParam
00198 {
00199 CC_DECLARE_DYNAMIC(OpFeatherEffectParam)
00200
00201 public:
00202 OpFeatherEffectParam() : OpLiveEffectParam()
00203 {
00204 FeatherSize = 0;
00205
00206 }
00207
00208
00209 public:
00210 MILLIPOINT FeatherSize;
00211 CProfileBiasGain Profile;
00212 };
00213 #endif
00214
00215
00216
00217
00218
00219
00220
00221
00222
00223
00224
00225
00226
00227
00228
00229 class OpLiveEffect : public SelOperation
00230 {
00231
00232 CC_DECLARE_DYNCREATE(OpLiveEffect);
00233
00234 static BOOL Init();
00235 static BOOL UpdateCurrentEditor();
00236 static BOOL DoCopyPPStackToSelection(UndoableOperation* pOp, EffectsStack* pPPStack, Document* pSrcDoc, Document* pDestDoc);
00237 static BOOL DoLocaliseLiveEffects(UndoableOperation* pOp, Node* pNode);
00238 static BOOL DoLocaliseEffectAttrs(UndoableOperation* pOp, Node* pNode);
00239 static BOOL DoCopyEffectAttr(UndoableOperation* pOp, NodeAttribute* pAttr, Node* pNode);
00240 static Node* DoDeleteAllPostProcessors(UndoableOperation* pOp, NodeRenderableInk* pNode, BOOL bDeleteOldControllers = FALSE, BOOL bDeleteBelowLocked = FALSE);
00241 static BOOL DoDeletePostProcessor(UndoableOperation* pOp, Range* pRange);
00242 static BOOL DoDeletePostProcessor(UndoableOperation* pOp, NodeEffect* pLE, BOOL bMoveEffectAttrs = FALSE);
00243 #ifdef FEATHER_EFFECT
00244 static ListRange* DoApplyFeatherEffect(UndoableOperation* pOp,
00245 Range* pSel,
00246 String_256 strEffectID,
00247 String_64 strDisplayName,
00248 MILLIPOINT FeatherSize,
00249 CProfileBiasGain Profile);
00250 static NodeFeatherEffect* DoApplyFeatherEffectNode(UndoableOperation* pOp,
00251 Node* pSel,
00252 String_256 strEffectID,
00253 String_64 strDisplayName,
00254 MILLIPOINT FeatherSize,
00255 CProfileBiasGain Profile);
00256 #endif
00257 static BOOL DoCopyEffectsStack(UndoableOperation* pOp, Node* pDestNode, ListRange* pEffectsStack, Document* pSrcDoc, Document* pDestDoc);
00258 static NodeBitmapEffect* DoApplyLiveEffect(UndoableOperation* pOp,
00259 Node* pNode,
00260 String_256 strEffectID,
00261 String_64 strDisplayName,
00262 double dResolution,
00263 IXMLDOMDocumentPtr pEditsList = NULL,
00264 BOOL bMakeLocked = FALSE);
00265 static BOOL DoCopyAttributes(UndoableOperation* pOp, Node* pSrcNode, Node* pDestNode, BOOL bEffectsOnly, Document* pSrcDoc, Document* pDestDoc);
00266
00267 public:
00268 OpLiveEffect();
00269 ~OpLiveEffect();
00270
00271
00272 virtual void Do(OpDescriptor* pOpDesc);
00273 virtual void DoWithParam(OpDescriptor* pOpDesc, OpParam* pOpParam);
00274
00275 ListRange* GetLiveEffectList() {return m_pLERange;}
00276 virtual void DoEndEdit(BOOL bChangingSelection = FALSE,
00277 BOOL bBroadcast = TRUE,
00278 BOOL bCancelled = FALSE,
00279 BOOL bEmpty = FALSE);
00280 BOOL GetPreviewQuality() const {return m_bPreviewQuality;}
00281 void SetPreviewQuality(BOOL bNew) {m_bPreviewQuality = bNew;}
00282
00283 protected:
00284 ListRange* DoApplyLiveEffect(Range* pSel,
00285 String_256 strEffectID,
00286 String_64 strDisplayName,
00287 double dResolution,
00288 IXMLDOMDocumentPtr pEditsList = NULL,
00289 BOOL bMakeLocked = FALSE,
00290 BOOL bDetectDirectBitmaps = FALSE);
00291 virtual ListRange* DoApplyLockedEffect(Range* pSel,
00292 String_256 strEffectID,
00293 String_64 strDisplayName,
00294 double dResolution,
00295 IXMLDOMDocumentPtr pEditsList = NULL,
00296 BOOL bDetectDirectBitmaps = FALSE);
00297 BOOL EnsureLiveEffectOriginalBitmaps();
00298 BOOL GenerateBitmap(NodeBitmapEffect* pBitmapEffect,
00299 double dResolution,
00300 LPBITMAPINFO* ppInfo,
00301 LPBYTE* ppBits,
00302 DocRect* prectBounds);
00303 BOOL SetChanged(BOOL bNewState);
00304 BOOL HasChanged();
00305 BOOL IsTopOfStack(EffectsStack* pPPStack, INT32 iStackPos);
00306 virtual BOOL DoEffectOp(ListRange* pLevelRange, OpLiveEffectParam* pLEOpParam) { return TRUE; }
00307 virtual BOOL AllowEmptySelection() const { return FALSE; }
00308 virtual BOOL CheckEffectOpParam(OpLiveEffectParam* pLEOpParam);
00309 virtual BOOL DoEffectRangeOp(UINT32 idsProgress, Range* pLevel, OpLiveEffectParam* pParam);
00310 virtual BOOL DoEffectNodeOp(NodeEffect* pEffect, OpLiveEffectParam* pParam, NodeBitmapEffect** ppNewEffect) {*ppNewEffect = NULL; return FALSE;}
00311
00312
00313 ListRange* m_pLERange;
00314 BOOL m_bAppliedNewEffects;
00315 String_256 m_strEffectID;
00316 INT32 m_iStackPos;
00317 BOOL m_bPreviewQuality;
00318 };
00319
00320
00321
00322
00323
00324
00325
00326
00327
00328
00329
00330 class OpApplyLiveEffect : public OpLiveEffect
00331 {
00332
00333 CC_DECLARE_DYNCREATE(OpApplyLiveEffect);
00334
00335 public:
00336
00337 static OpState GetParamState(String_256* pstrDescription, OpDescriptor* pOpDesc, OpParam* pOpParam);
00338 virtual void GetOpName(String_256* pstrOpName);
00339
00340
00341
00342 virtual void DoWithParam(OpDescriptor* pOpDesc, OpParam* pOpParam);
00343
00344
00345 virtual BOOL MayChangeNodeBounds() const { return TRUE; }
00346
00347 };
00348
00349
00350
00351
00352
00353
00354
00355
00356
00357
00358
00359
00360
00361
00362 #ifdef FEATHER_EFFECT
00363 class OpApplyFeatherEffect : public OpLiveEffect
00364 {
00365
00366 CC_DECLARE_DYNCREATE(OpApplyFeatherEffect);
00367
00368 public:
00369
00370 static OpState GetParamState(String_256* pstrDescription, OpDescriptor* pOpDesc, OpParam* pOpParam);
00371 virtual void GetOpName(String_256* pstrOpName);
00372
00373
00374
00375 virtual void DoWithParam(OpDescriptor* pOpDesc, OpParam* pOpParam);
00376
00377
00378 virtual BOOL MayChangeNodeBounds() const { return TRUE; }
00379
00380 };
00381 #endif
00382
00383
00384
00385
00386
00387
00388
00389
00390
00391
00392
00393
00394
00395 class OpEditLiveEffect : public OpLiveEffect
00396 {
00397
00398 CC_DECLARE_DYNCREATE(OpEditLiveEffect);
00399
00400 public:
00401
00402 static OpState GetParamState(String_256* pstrDescription, OpDescriptor* pOpDesc, OpParam* pOpParam);
00403
00404 virtual void GetOpName(String_256* pstrOpName);
00405
00406
00407
00408
00409 virtual BOOL DoEffectOp(ListRange* pLevelRange, OpLiveEffectParam* pLEOpParam);
00410
00411
00412 virtual BOOL MayChangeNodeBounds() const { return TRUE; }
00413
00414 protected:
00415 virtual BOOL AllowEmptySelection() const { return TRUE; }
00416
00417 };
00418
00419
00420
00421
00422
00423
00424
00425
00426
00427
00428
00429
00430
00431
00432 class OpDeleteLiveEffect : public OpLiveEffect
00433 {
00434
00435 CC_DECLARE_DYNCREATE(OpDeleteLiveEffect);
00436
00437 public:
00438
00439 static OpState GetState(String_256* pstrDescription, OpDescriptor* pOpDesc);
00440 virtual void GetOpName(String_256* pstrOpName);
00441
00442
00443
00444
00445 virtual BOOL DoEffectOp(ListRange* pLevelRange, OpLiveEffectParam* pLEOpParam);
00446
00447
00448 virtual BOOL MayChangeNodeBounds() const { return TRUE; }
00449
00450 protected:
00451
00452
00453 };
00454
00455
00456
00457
00458
00459
00460
00461
00462
00463
00464
00465
00466
00467
00468 class OpDeleteAllLiveEffect : public OpLiveEffect
00469 {
00470
00471 CC_DECLARE_DYNCREATE(OpDeleteAllLiveEffect);
00472
00473 public:
00474
00475 static OpState GetState(String_256* pstrDescription, OpDescriptor* pOpDesc);
00476 virtual void GetOpName(String_256* pstrOpName);
00477
00478
00479
00480
00481 virtual BOOL DoEffectOp(ListRange* pLevelRange, OpLiveEffectParam* pLEOpParam);
00482
00483
00484 virtual BOOL MayChangeNodeBounds() const { return TRUE; }
00485
00486 protected:
00487 virtual BOOL CheckEffectOpParam(OpLiveEffectParam* pLEOpParam);
00488
00489 };
00490
00491
00492
00493
00494
00495
00496
00497
00498
00499
00500
00501
00502
00503
00504 class OpEffectRes : public OpLiveEffect
00505 {
00506
00507 CC_DECLARE_DYNCREATE(OpEffectRes);
00508
00509 public:
00510
00511 static OpState GetState(String_256* pstrDescription, OpDescriptor* pOpDesc);
00512 virtual void GetOpName(String_256* pstrOpName);
00513 virtual BOOL DoEffectOp(ListRange* pLevelRange, OpLiveEffectParam* pLEOpParam);
00514 virtual BOOL DoEffectNodeOp(NodeEffect* pEffect, OpLiveEffectParam* pParam, NodeBitmapEffect** ppNewEffect);
00515
00516
00517 virtual BOOL MayChangeNodeBounds() const { return FALSE; }
00518
00519 protected:
00520
00521
00522 };
00523
00524
00525
00526
00527
00528
00529
00530
00531
00532
00533
00534
00535
00536
00537 class OpEffectLock : public OpLiveEffect
00538 {
00539
00540 CC_DECLARE_DYNCREATE(OpEffectLock);
00541
00542 public:
00543
00544 static OpState GetState(String_256* pstrDescription, OpDescriptor* pOpDesc);
00545 virtual void GetOpName(String_256* pstrOpName);
00546 virtual BOOL DoEffectOp(ListRange* pLevelRange, OpLiveEffectParam* pLEOpParam);
00547 virtual BOOL DoEffectNodeOp(NodeEffect* pEffect, OpLiveEffectParam* pParam, NodeBitmapEffect** ppNewEffect);
00548
00549
00550 virtual BOOL MayChangeNodeBounds() const { return FALSE; }
00551
00552 protected:
00553 virtual BOOL CopyEffectAttrs(NodeBitmapEffect* pSrcNode, NodeBitmapEffect* pDestNode);
00554
00555 };
00556
00557
00558
00559
00560
00561
00562
00563
00564
00565
00566
00567
00568
00569
00570 class OpEffectLockAll : public OpEffectLock
00571 {
00572
00573 CC_DECLARE_DYNCREATE(OpEffectLockAll);
00574
00575 public:
00576
00577 static OpState GetState(String_256* pstrDescription, OpDescriptor* pOpDesc);
00578 virtual void GetOpName(String_256* pstrOpName);
00579
00580
00581
00582
00583 virtual BOOL DoEffectOp(ListRange* pLevelRange, OpLiveEffectParam* pLEOpParam);
00584
00585
00586 virtual BOOL MayChangeNodeBounds() const { return FALSE; }
00587
00588 protected:
00589 virtual BOOL CheckEffectOpParam(OpLiveEffectParam* pLEOpParam);
00590
00591 };
00592
00593
00594
00595
00596
00597
00598
00599
00600
00601
00602
00603
00604
00605
00606 class OpEditLegacyEffect : public Operation
00607 {
00608
00609 CC_DECLARE_DYNCREATE(OpEditLegacyEffect);
00610
00611 public:
00612
00613 static OpState GetParamState(String_256* pstrDescription, OpDescriptor* pOpDesc, OpParam* pOpParam);
00614 virtual void GetOpName(String_256* pstrOpName);
00615
00616
00617 virtual void Do(OpDescriptor* pOpDesc);
00618 virtual void DoWithParam(OpDescriptor* pOpDesc, OpParam* pOpParam);
00619
00620 };
00621
00622
00623
00624
00625
00626
00627
00628
00629
00630
00631
00632
00633
00634
00635
00636 class ChangeEffectResAction : public Action
00637 {
00638
00639 CC_DECLARE_DYNCREATE(ChangeEffectResAction)
00640
00641 public:
00642 ChangeEffectResAction();
00643 ~ChangeEffectResAction();
00644 virtual ActionCode Execute();
00645 static ActionCode Init( Operation* pOp,
00646 ActionList* pActionList,
00647 Action** NewAction);
00648 static BOOL CreateChangeEffectResAction(Operation* pOp,
00649 NodeBitmapEffect* pEffectNode,
00650 double dResolution
00651 );
00652
00653 NodeBitmapEffect* m_pEffectNode;
00654 double m_dResolution;
00655 };
00656
00657
00658
00659
00660
00661
00662
00663
00664
00665
00666
00667
00668
00669
00670
00671
00672
00673
00674
00675
00676
00677
00678
00679
00680
00681
00682
00683
00684
00685
00686
00687
00688
00689
00690
00691
00692
00693
00694
00695
00696
00697
00698
00699
00700
00701
00702
00703
00704
00705
00706 class MarkEditListAction : public Action
00707 {
00708
00709 CC_DECLARE_DYNCREATE(MarkEditListAction)
00710
00711 public:
00712 MarkEditListAction();
00713 ~MarkEditListAction();
00714 virtual ActionCode Execute();
00715 static ActionCode Init( Operation* pOp,
00716 ActionList* pActionList,
00717 Action** NewAction);
00718 static ActionCode DoMarkEditList(Operation* pOp,
00719 ActionList* pActionList,
00720 EffectsStack* pPPStack,
00721 INT32 iStackPos
00722 );
00723
00724 IXMLDOMDocumentPtr pEditList;
00725 INT32 iStackPos;
00726 };
00727
00728
00729
00730
00731 #endif // INC_OPLIVEFX