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 #include "camtypes.h"
00101 #include "camelot.h"
00102 #include "liveeffectstool.h"
00103 #include "liveeffectsinfo.h"
00104
00105
00106
00107
00108
00109
00110
00111 #include "colmsg.h"
00112 #include "brushmsg.h"
00113
00114 #include "xpehost.h"
00115 #include "opliveeffects.h"
00116 #include "nodeliveeffect.h"
00117 #include "liveeffectsmenu.h"
00118 #include "shadtool.h"
00119 #include "opfeathr.h"
00120 #include "appprefs.h"
00121
00122 DECLARE_SOURCE( "$Revision: 1282 $" );
00123
00124
00125 CC_IMPLEMENT_DYNCREATE( LiveEffectsInfoBarOp, InformationBarOp )
00126 #define new CAM_DEBUG_NEW
00127
00128
00129
00130
00131
00132
00133
00134
00135
00136
00137
00138
00139
00140
00141 LiveEffectsInfoBarOp::LiveEffectsInfoBarOp()
00142 {
00143
00144 m_pTool = NULL;
00145
00146
00147 m_bControlsExist = FALSE;
00148 m_bLockSwitchState = FALSE;
00149 m_bLockAllSwitchState = FALSE;
00150 }
00151
00152
00153
00154
00155
00156
00157
00158
00159
00160
00161
00162
00163
00164
00165 LiveEffectsInfoBarOp::~LiveEffectsInfoBarOp()
00166 {
00167 }
00168
00169
00170
00171
00172
00173
00174
00175
00176
00177
00178
00179
00180
00181
00182 MsgResult LiveEffectsInfoBarOp::Message(Msg* Message)
00183 {
00184 if (IS_OUR_DIALOG_MSG(Message))
00185 {
00186 DialogMsg* DMsg = (DialogMsg*)Message;
00187
00188
00189 if (DMsg->DlgMsg == DIM_CANCEL)
00190 {
00191
00192 m_bControlsExist = FALSE;
00193
00194
00195 Close();
00196 }
00197
00198 else if (DMsg->DlgMsg == DIM_CREATE)
00199 {
00200 HandleCreate();
00201 }
00202
00203 else
00204 {
00205
00206 switch (DMsg->GadgetID)
00207 {
00208 case _R(IDC_LE_LABEL):
00209 {
00210 GadgetMessage_Label(DMsg);
00211 break;
00212 }
00213 case _R(IDC_COMBOBOX_LE_ORDER):
00214 {
00215 GadgetMessage_Order(DMsg);
00216 break;
00217 }
00218 case _R(IDC_CCBUTTON_LE_EDIT):
00219 case _R(IDC_BUTTON_LE_EDIT):
00220 {
00221 GadgetMessage_Edit(DMsg);
00222 break;
00223 }
00224 case _R(IDC_CCBUTTON_LE_ADD):
00225 case _R(IDC_BUTTON_LE_ADD):
00226 {
00227 GadgetMessage_Add(DMsg);
00228 break;
00229 }
00230 case _R(IDC_CCBUTTON_LE_INSERT):
00231 {
00232 GadgetMessage_Insert(DMsg);
00233 break;
00234 }
00235 case _R(IDC_COMBOBOX_LE_RES):
00236 {
00237 GadgetMessage_Resolution(DMsg);
00238 break;
00239 }
00240 case _R(IDC_CCBUTTON_LE_TOGGLELOCK):
00241 {
00242 GadgetMessage_ToggleLock(DMsg);
00243 break;
00244 }
00245 case _R(IDC_CCBUTTON_LE_REMOVE):
00246 {
00247 GadgetMessage_Remove(DMsg);
00248 break;
00249 }
00250 case _R(IDC_CCBUTTON_LE_REMOVEALL):
00251 {
00252 GadgetMessage_RemoveAll(DMsg);
00253 break;
00254 }
00255 case _R(IDC_CCBUTTON_LE_TOGGLELOCKALL):
00256 {
00257 GadgetMessage_ToggleLockAll(DMsg);
00258 break;
00259 }
00260 case _R(IDC_BUTTON_LE_SETUP):
00261 {
00262 GadgetMessage_Setup(DMsg);
00263 break;
00264 }
00265 }
00266 }
00267 }
00268 else
00269 {
00270
00271
00272
00273
00274
00275
00276
00277
00278
00279
00280
00281
00282
00283
00284
00285
00286
00287 if (Message->IsKindOf(CC_RUNTIME_CLASS(DocViewMsg)))
00288 {
00289 DocViewMsg* pDVM = (DocViewMsg*)Message;
00290 if (pDVM->State == pDVM->DocViewState::SELCHANGED)
00291 m_pTool->ScreenChanged(TRUE);
00292 }
00293 }
00294
00295
00296 if (MESSAGE_IS_A(Message, SelChangingMsg))
00297 {
00298 Document* pDoc = Document::GetCurrent();
00299 if (pDoc != NULL)
00300 {
00301 if (m_bControlsExist && IsVisible())
00302 {
00303 }
00304 }
00305
00306
00307 if (m_pTool != NULL && HasWindow())
00308 m_pTool->ScreenChanged(TRUE);
00309 }
00310
00311 if (MESSAGE_IS_A(Message, ColourChangingMsg))
00312 {
00313 ColourChangingMsg *TheMsg = (ColourChangingMsg *) Message;
00314
00315
00316
00317 if(TheMsg->State == ColourChangingMsg::ColourState::SELVIEWCONTEXTCHANGE)
00318 {
00319
00320
00321
00322
00323 if (m_pTool != NULL && HasWindow())
00324 m_pTool->ScreenChanged(TRUE);
00325 }
00326 }
00327
00328 if (MESSAGE_IS_A(Message, DocChangingMsg))
00329 {
00330 DocChangingMsg* pMsg = (DocChangingMsg*) Message;
00331 if (pMsg->State == DocChangingMsg::DocState::ABOUTTODIE && XPEHost::GetEditSessionDocument()==pMsg->pChangingDoc)
00332 {
00333 XPEHost::EndEditLiveEffect();
00334 }
00335 }
00336
00337 else if (MESSAGE_IS_A(Message,OpMsg))
00338 {
00339
00340
00341 BlobManager* BlobMgr = GetApplication()->GetBlobManager();
00342 ENSURE(BlobMgr, "Can't get BlobManager");
00343
00344 if ( (((OpMsg*)Message)->MsgType == OpMsg::BEFORE_UNDO) ||
00345 (((OpMsg*)Message)->MsgType == OpMsg::BEFORE_REDO))
00346 {
00347 OpLiveEffect* pCurrentOp = XPEHost::GetCurrentLEOp();
00348
00349
00350 if (pCurrentOp!=NULL)
00351 {
00352
00353
00354
00355
00356
00357
00358
00359
00360
00361
00362
00363 pCurrentOp->DoEndEdit(TRUE, TRUE, TRUE, TRUE);
00364 XPEHost::SetCurrentLEOp(NULL);
00365 XPEHost::EndEditLiveEffect();
00366 }
00367 }
00368 else if ( (((OpMsg*)Message)->MsgType == OpMsg::AFTER_UNDO) ||
00369 (((OpMsg*)Message)->MsgType == OpMsg::AFTER_REDO))
00370 {
00371
00372
00373
00374
00375
00376
00377
00378
00379
00380
00381
00382
00383
00384
00385
00386
00387
00388
00389
00390
00391
00392
00393
00394
00395
00396
00397
00398
00399
00400
00401
00402
00403
00404
00405
00406
00407
00408
00409
00410
00411
00412
00413
00414
00415
00416
00417
00418
00419
00420
00421
00422
00423
00424
00425
00426
00427
00428
00429
00430 }
00431 }
00432
00433
00434 return (InformationBarOp::Message(Message));
00435 }
00436
00437
00438
00439
00440
00441
00442
00443
00444
00445
00446
00447
00448
00449
00450
00451
00452
00453
00454 void LiveEffectsInfoBarOp::GadgetMessage_Order(DialogMsg* Message)
00455 {
00456 switch (Message->DlgMsg)
00457 {
00458 case DIM_SELECTION_CHANGED:
00459 {
00460 WORD Index;
00461 GetValueIndex(Message->GadgetID, &Index);
00462 EffectsStack* pStack = m_pTool->GetEffectsStack();
00463 PPStackLevel* pStackLevel = (PPStackLevel*)pStack->FindItem(Index);
00464
00465 if (pStackLevel)
00466 {
00467 String_256 strEffectID = pStackLevel->strPostProID;
00468 m_pTool->SetCurrentEffectID(strEffectID);
00469 m_pTool->SetCurrentStackPos(Index);
00470 }
00471 else
00472 {
00473 m_pTool->SetCurrentEffectID(String(""));
00474 m_pTool->SetCurrentStackPos(Index);
00475 }
00476
00477 UpdateState();
00478
00479 #ifdef FEATHER_EFFECT
00480 String_256 strCurrentEffectID = m_pTool->GetCurrentEffectID();
00481 if (strCurrentEffectID==String_256(POSTPRO_ID_FEATHER))
00482 {
00483 INT32 iStackPos = m_pTool->GetCurrentStackPos();
00484 ListRange* pFeatherRange = m_pTool->GetEffectsStack()->GetLevelRange(&iStackPos);
00485 OpChangeFeatherSize::SetEditContext(iStackPos, pFeatherRange);
00486 return;
00487 }
00488 #endif
00489
00490 }
00491 }
00492 }
00493
00494
00495
00496
00497
00498
00499
00500
00501
00502
00503
00504
00505
00506
00507
00508
00509 void LiveEffectsInfoBarOp::GadgetMessage_Edit(DialogMsg* Message)
00510 {
00511 switch (Message->DlgMsg)
00512 {
00513 case DIM_LFT_BN_CLICKED:
00514 {
00515 String_256 strCurrentEffectID = m_pTool->GetCurrentEffectID();
00516
00517
00518 if (strCurrentEffectID==String_256(POSTPRO_ID_SHADOW))
00519 {
00520
00521 Tool* pShadowTool = Tool::FindTool(TOOLID_SOFTSHADOW);
00522 if (pShadowTool && !pShadowTool->IsCurrent())
00523 {
00524 INT32 iStackPos = m_pTool->GetCurrentStackPos();
00525 ListRange* pShadowRange = m_pTool->GetEffectsStack()->GetLevelRange(&iStackPos);
00526 if (pShadowRange)
00527 {
00528 ((SoftShadowTool*)pShadowTool)->SelectShadowRange(pShadowRange);
00529 }
00530
00531 pShadowTool->SetCurrent();
00533
00534
00535
00536 return;
00537 }
00538 }
00539
00540 #ifdef FEATHER_EFFECT
00541 if (strCurrentEffectID==String_256(POSTPRO_ID_FEATHER))
00542 {
00543 INT32 iStackPos = m_pTool->GetCurrentStackPos();
00544 ListRange* pFeatherRange = m_pTool->GetEffectsStack()->GetLevelRange(&iStackPos);
00545 OpChangeFeatherSize::SetEditContext(iStackPos, pFeatherRange);
00546 return;
00547 }
00548 #endif
00549
00550 if (strCurrentEffectID!=String(""))
00551 {
00552 OpDescriptor* pOp = NULL;
00553 pOp = OpDescriptor::FindOpDescriptor(OPTOKEN_EDIT_LIVEEFFECT);
00554
00555 if (pOp)
00556 {
00557
00558
00559 if (XPEHost::IsEditSessionRunning())
00560 {
00561 XPEHost::EndEditLiveEffect();
00562 m_pTool->UpdatePPStack();
00563 }
00564
00565 OpLiveEffectParam Param;
00566 Param.strOpUnique = strCurrentEffectID;
00567 Param.StackPosition = m_pTool->GetCurrentStackPos();
00568 Param.pPPStack = m_pTool->GetEffectsStack();
00569 BOOL bValid = XPEHost::GetEffectDetails(strCurrentEffectID, &Param.strMenuText, &Param.bIsDestructive);
00570
00571 if (bValid)
00572 {
00573 pOp->Invoke(&Param);
00574 return;
00575 }
00576 }
00577 }
00578 }
00579 }
00580 }
00581
00582
00583
00584
00585
00586
00587
00588
00589
00590
00591
00592
00593
00594
00595
00596
00597 void LiveEffectsInfoBarOp::GadgetMessage_Add(DialogMsg* Message)
00598 {
00599 switch (Message->DlgMsg)
00600 {
00601 case DIM_LFT_BN_CLICKED:
00602 {
00603
00604
00605 if (XPEHost::IsEditSessionRunning())
00606 {
00607 XPEHost::EndEditLiveEffect();
00608 m_pTool->UpdatePPStack();
00609 }
00610
00611 LiveEffectsMenu* pLEMenu = new LiveEffectsMenu();
00612 if (pLEMenu)
00613 {
00614 pLEMenu->SetStackPos(STACKPOS_INSERT_TOP);
00615 pLEMenu->SetEffectsStack(m_pTool->GetEffectsStack());
00616 pLEMenu->Show();
00617 }
00618 }
00619 }
00620 }
00621
00622
00623
00624
00625
00626
00627
00628
00629
00630
00631
00632
00633
00634
00635
00636
00637 void LiveEffectsInfoBarOp::GadgetMessage_Label(DialogMsg* Message)
00638 {
00639 switch (Message->DlgMsg)
00640 {
00641 case DIM_RGT_BN_CLICKED:
00642 {
00643
00644
00645 if (XPEHost::IsEditSessionRunning())
00646 {
00647 XPEHost::EndEditLiveEffect();
00648 m_pTool->UpdatePPStack();
00649 }
00650
00651 LiveEffectsMenu* pLEMenu = new LiveEffectsMenu();
00652 if (pLEMenu)
00653 {
00654 pLEMenu->SetStackPos(STACKPOS_INSERT_TOP);
00655 pLEMenu->SetEffectsStack(m_pTool->GetEffectsStack());
00656 pLEMenu->Show();
00657 }
00658 }
00659 }
00660 }
00661
00662
00663
00664
00665
00666
00667
00668
00669
00670
00671
00672
00673
00674
00675
00676
00677 void LiveEffectsInfoBarOp::GadgetMessage_Resolution(DialogMsg* Message)
00678 {
00679 switch (Message->DlgMsg)
00680 {
00681 case DIM_SELECTION_CHANGED:
00682 {
00683
00684
00685 if (XPEHost::IsEditSessionRunning())
00686 {
00687 XPEHost::EndEditLiveEffect();
00688 m_pTool->UpdatePPStack();
00689 }
00690
00691 BOOL Valid = FALSE;
00692 INT32 lValue = 0;
00693
00694 lValue = GetResDropListValue(_R(IDC_COMBOBOX_LE_RES), TRUE, &Valid);
00695
00696 if (Valid)
00697 {
00698
00699 OpDescriptor* pOp = NULL;
00700 pOp = OpDescriptor::FindOpDescriptor(OPTOKEN_CHANGE_EFFECT_RES);
00701
00702 if (pOp)
00703 {
00704 OpLiveEffectParam Param;
00705
00706 Param.StackPosition = m_pTool->GetCurrentStackPos();
00707 Param.pPPStack = m_pTool->GetEffectsStack();
00708 Param.dResolution = (double) lValue;
00709
00710
00711 pOp->Invoke(&Param);
00712 return;
00713 }
00714 }
00715
00716
00717
00718 EffectsStack* pStack = m_pTool->GetEffectsStack();
00719 INT32 iStackPos = m_pTool->GetCurrentStackPos();
00720 ListRange* pLevelRange = NULL;
00721 if (pStack)
00722 pLevelRange = pStack->GetLevelRange(&iStackPos);
00723
00724 PopulateResolutionDropdown(pStack, pLevelRange, FALSE);
00725 }
00726 }
00727 }
00728
00729
00730
00731
00732
00733
00734
00735
00736
00737
00738
00739
00740
00741
00742
00743
00744 void LiveEffectsInfoBarOp::GadgetMessage_ToggleLock(DialogMsg* Message)
00745 {
00746 switch (Message->DlgMsg)
00747 {
00748 case DIM_LFT_BN_CLICKED:
00749 {
00750
00751
00752 if (XPEHost::IsEditSessionRunning())
00753 {
00754 XPEHost::EndEditLiveEffect();
00755 m_pTool->UpdatePPStack();
00756 }
00757
00758
00759 m_bLockSwitchState = !m_bLockSwitchState;
00760 BOOL bIsSelected = GetBoolGadgetSelected(Message->GadgetID, m_bLockSwitchState);
00761
00762 OpDescriptor* pOp = NULL;
00763 pOp = OpDescriptor::FindOpDescriptor(OPTOKEN_CHANGE_EFFECT_LOCK);
00764
00765 if (pOp)
00766 {
00767 OpLiveEffectParam Param;
00768
00769 Param.StackPosition = m_pTool->GetCurrentStackPos();
00770 Param.pPPStack = m_pTool->GetEffectsStack();
00771
00772 Param.bForceLock = m_bLockSwitchState;
00773
00774 pOp->Invoke(&Param);
00775 return;
00776 }
00777 }
00778 }
00779 }
00780
00781
00782
00783
00784
00785
00786
00787
00788
00789
00790
00791
00792
00793
00794
00795
00796 void LiveEffectsInfoBarOp::GadgetMessage_ToggleLockAll(DialogMsg* Message)
00797 {
00798 switch (Message->DlgMsg)
00799 {
00800 case DIM_LFT_BN_CLICKED:
00801 {
00802
00803
00804 if (XPEHost::IsEditSessionRunning())
00805 {
00806 XPEHost::EndEditLiveEffect();
00807 m_pTool->UpdatePPStack();
00808 }
00809
00810
00811 m_bLockAllSwitchState = !m_bLockAllSwitchState;
00812 BOOL bIsSelected = GetBoolGadgetSelected(Message->GadgetID, m_bLockAllSwitchState);
00813
00814 OpDescriptor* pOp = NULL;
00815 pOp = OpDescriptor::FindOpDescriptor(OPTOKEN_CHANGE_EFFECT_LOCKALL);
00816
00817 if (pOp)
00818 {
00819 OpLiveEffectParam Param;
00820 Param.bForceLock = m_bLockAllSwitchState;
00821
00822 pOp->Invoke(&Param);
00823 return;
00824 }
00825 }
00826 }
00827 }
00828
00829
00830
00831
00832
00833
00834
00835
00836
00837
00838
00839
00840
00841
00842
00843
00844 void LiveEffectsInfoBarOp::GadgetMessage_Insert(DialogMsg* Message)
00845 {
00846 switch (Message->DlgMsg)
00847 {
00848 case DIM_LFT_BN_CLICKED:
00849 {
00850
00851
00852 if (XPEHost::IsEditSessionRunning())
00853 {
00854 XPEHost::EndEditLiveEffect();
00855 m_pTool->UpdatePPStack();
00856 }
00857
00858 LiveEffectsMenu* pLEMenu = new LiveEffectsMenu();
00859 if (pLEMenu)
00860 {
00861 pLEMenu->SetStackPos(m_pTool->GetCurrentStackPos());
00862 pLEMenu->SetEffectsStack(m_pTool->GetEffectsStack());
00863 pLEMenu->Show();
00864 }
00865 }
00866 }
00867 }
00868
00869
00870
00871
00872
00873
00874
00875
00876
00877
00878
00879
00880
00881
00882
00883
00884 void LiveEffectsInfoBarOp::GadgetMessage_Remove(DialogMsg* Message)
00885 {
00886 switch (Message->DlgMsg)
00887 {
00888 case DIM_LFT_BN_CLICKED:
00889 {
00890 String_256 strCurrentEffectID = m_pTool->GetCurrentEffectID();
00891 if (strCurrentEffectID!=String(""))
00892 {
00893
00894
00895 if (XPEHost::IsEditSessionRunning())
00896 {
00897 XPEHost::EndEditLiveEffect();
00898 m_pTool->UpdatePPStack();
00899 }
00900
00901 OpDescriptor* pOp = NULL;
00902 pOp = OpDescriptor::FindOpDescriptor(OPTOKEN_DELETE_LIVEEFFECT);
00903
00904 if (pOp)
00905 {
00906 OpLiveEffectParam Param;
00907 Param.strOpUnique = strCurrentEffectID;
00908 Param.StackPosition = m_pTool->GetCurrentStackPos();
00909 Param.pPPStack = m_pTool->GetEffectsStack();
00910 BOOL bValid = XPEHost::GetEffectDetails(strCurrentEffectID, &Param.strMenuText, &Param.bIsDestructive);
00911
00912
00913 pOp->Invoke(&Param);
00914 return;
00915 }
00916 }
00917 }
00918 }
00919 }
00920
00921
00922
00923
00924
00925
00926
00927
00928
00929
00930
00931
00932
00933
00934
00935
00936 void LiveEffectsInfoBarOp::GadgetMessage_RemoveAll(DialogMsg* Message)
00937 {
00938 switch (Message->DlgMsg)
00939 {
00940 case DIM_LFT_BN_CLICKED:
00941 {
00942
00943
00944 if (XPEHost::IsEditSessionRunning())
00945 {
00946 XPEHost::EndEditLiveEffect();
00947 m_pTool->UpdatePPStack();
00948 }
00949
00950 OpDescriptor* pOp = NULL;
00951 pOp = OpDescriptor::FindOpDescriptor(OPTOKEN_DELETEALL_LIVEEFFECT);
00952
00953 if (pOp)
00954 {
00955 OpLiveEffectParam Param;
00956 pOp->Invoke(&Param);
00957 return;
00958 }
00959 }
00960 }
00961 }
00962
00963
00964
00965
00966
00967
00968
00969
00970
00971
00972
00973
00974
00975
00976
00977
00978 void LiveEffectsInfoBarOp::GadgetMessage_Setup(DialogMsg* Message)
00979 {
00980 switch (Message->DlgMsg)
00981 {
00982 case DIM_LFT_BN_CLICKED:
00983 {
00984
00985
00986 if (XPEHost::IsEditSessionRunning())
00987 {
00988 XPEHost::EndEditLiveEffect();
00989 m_pTool->UpdatePPStack();
00990 }
00991
00992 if (ClickModifiers::GetClickModifiers().Adjust)
00993 XPEEditOp::EditPluginSettings();
00994 else
00995 {
00996 OpDescriptor* pOp = NULL;
00997 pOp = OpDescriptor::FindOpDescriptor(OPTOKEN_PLUGSDLG);
00998
00999 String_256 strDesc;
01000 if (pOp && !pOp->GetOpsState(&strDesc).Greyed)
01001 {
01002 pOp->Invoke();
01003 return;
01004 }
01005 }
01006 }
01007 }
01008 }
01009
01010
01011
01012
01013
01014
01015
01016
01017
01018
01019
01020
01021
01022
01023
01024
01025 void LiveEffectsInfoBarOp::HandleCreate()
01026 {
01027
01028
01029
01030 if (WindowID!=NULL)
01031 {
01032
01033 m_bControlsExist = TRUE;
01034
01035
01036
01037 UpdateState();
01038 }
01039 }
01040
01041
01042
01043
01044
01045
01046
01047
01048
01049
01050
01051
01052 void LiveEffectsInfoBarOp::SetToolActiveState(BOOL IsToolActive)
01053 {
01054
01055 m_bControlsExist = IsToolActive;
01056 }
01057
01058
01059
01060
01061
01062
01063
01064
01065
01066
01067
01068
01069
01070
01071 void LiveEffectsInfoBarOp::UpdateState()
01072 {
01073
01074 if (!m_bControlsExist)
01075 return;
01076
01077 if (CCamApp::DisableSys)
01078 return;
01079
01080 EffectsStack* pStack = m_pTool->GetEffectsStack();
01081 INT32 iStackPos = m_pTool->GetCurrentStackPos();
01082
01083 IXMLDOMDocumentPtr pDoc = XPEHost::GetEditorsList();
01084 PopulateOrderDropdown(pStack, iStackPos);
01085
01086 ListRange* pLevelRange = NULL;
01087 if (pStack)
01088 pLevelRange = pStack->GetLevelRange(&iStackPos);
01089
01090 UpdateAddButton(pStack, pLevelRange);
01091 UpdateEditButton(pStack, pLevelRange);
01092 PopulateResolutionDropdown(pStack, pLevelRange);
01093 UpdateLockButton(pLevelRange);
01094 UpdateRemoveButton(pLevelRange);
01095 UpdateLockAllButton();
01096 UpdateRemoveAllButton();
01097 UpdateSetupButton();
01098 }
01099
01100
01101
01102
01103
01104
01105
01106
01107
01108
01109
01110
01111
01112
01113
01114
01115 void LiveEffectsInfoBarOp::PopulateOrderDropdown(EffectsStack* pPPStack, INT32 iSelectedStackPos)
01116 {
01117
01118 if (!m_bControlsExist)
01119 return;
01120
01121 if (pPPStack==NULL)
01122 return;
01123
01124 DeleteAllValues(_R(IDC_COMBOBOX_LE_ORDER));
01125 SetComboListLength(_R(IDC_COMBOBOX_LE_ORDER));
01126 SetGadgetWritable(_R(IDC_COMBOBOX_LE_ORDER), FALSE);
01127
01128 if (!pPPStack->bConsistent)
01129 {
01130
01131 SetStringGadgetValue(_R(IDC_COMBOBOX_LE_ORDER), _R(IDS_LE_MANY));
01132 SetSelectedValueIndex(_R(IDC_COMBOBOX_LE_ORDER), 0);
01133 }
01134 else
01135 {
01136 if (pPPStack->IsEmpty())
01137 {
01138
01139 SetStringGadgetValue(_R(IDC_COMBOBOX_LE_ORDER), _R(IDS_LE_NONE));
01140 SetSelectedValueIndex(_R(IDC_COMBOBOX_LE_ORDER), 0);
01141 }
01142 else
01143 {
01144
01145 INT32 pos = 0;
01146 PPStackLevel* pLevel = (PPStackLevel*)pPPStack->GetHead();
01147 while (pLevel!=NULL)
01148 {
01149 String_64 strDisplayName;
01150 if (pLevel->pPPNode!=NULL && pLevel->pPPNode->IsBitmapEffect())
01151 strDisplayName = ((NodeBitmapEffect*)(pLevel->pPPNode))->GetDisplayName();
01152 BOOL bDestructive = FALSE;
01153 BOOL bFound = XPEHost::GetEffectDetails(pLevel->strPostProID, &strDisplayName, &bDestructive);
01154
01155 TCHAR Str[64];
01156 String_64 pjm(_R(IDS_LE_ORDER_FORMAT));
01157 if (!bFound)
01158 pjm = String_64(_R(IDS_LE_ORDER_FORMAT_NOTFOUND));
01159 else if (bDestructive)
01160 pjm = String_64(_R(IDS_LE_ORDER_FORMAT_DESTRUCTIVE));
01161 camSprintf(Str, pjm, pos+1, (LPTSTR)strDisplayName);
01162 String_64 strOrderedName(Str);
01163
01164 SetStringGadgetValue(_R(IDC_COMBOBOX_LE_ORDER), &strOrderedName, FALSE, pos);
01165
01166 if (pos==iSelectedStackPos)
01167 SetSelectedValueIndex(_R(IDC_COMBOBOX_LE_ORDER), pos);
01168
01169 pos++;
01170 pLevel = (PPStackLevel*)pPPStack->GetNext(pLevel);
01171 }
01172 }
01173 }
01174 SetComboListLength(_R(IDC_COMBOBOX_LE_ORDER));
01175 }
01176
01177
01178
01179
01180
01181
01182
01183
01184
01185
01186
01187
01188
01189
01190
01191
01192
01193 void LiveEffectsInfoBarOp::PopulateResolutionDropdown(EffectsStack* pStack, ListRange* pLevelRange, BOOL bUpdateList)
01194 {
01195
01196 if (!m_bControlsExist)
01197 return;
01198
01199 if (bUpdateList)
01200 {
01201 BuildResDropList(_R(IDC_COMBOBOX_LE_RES), TRUE, FALSE, -1);
01202 SetGadgetWritable(_R(IDC_COMBOBOX_LE_RES), TRUE);
01203 }
01204
01205 if (pLevelRange==NULL)
01206 return;
01207
01208 double dRes = -1;
01209 Node* pNode = pLevelRange->FindFirst();
01210 BOOL bCanChangeRes = FALSE;
01211 while (pNode)
01212 {
01213 if (pNode->IsBitmapEffect())
01214 {
01215 NodeBitmapEffect* pEffect = (NodeBitmapEffect*)pNode;
01216 bCanChangeRes = bCanChangeRes || pEffect->CanBeUnlocked();
01217 if (dRes==-1)
01218 dRes = pEffect->GetPixelsPerInchValue();
01219 else
01220 {
01221 if (dRes != pEffect->GetPixelsPerInchValue())
01222 {
01223 dRes = -2;
01224 break;
01225 }
01226 }
01227 }
01228
01229 pNode = pLevelRange->FindNext(pNode);
01230 }
01231
01232 switch ((INT32)dRes)
01233 {
01234 case -2:
01235
01236 SetSelectedValueIndex(_R(IDC_COMBOBOX_LE_RES), -1);
01237 SetStringGadgetValue(_R(IDC_COMBOBOX_LE_RES), _R(IDS_LE_MANY), FALSE, -1);
01238 EnableGadget(_R(IDC_COMBOBOX_LE_RES), FALSE);
01239 break;
01240
01241 case -1:
01242
01243 SetSelectedValueIndex(_R(IDC_COMBOBOX_LE_RES), -1);
01244 SetStringGadgetValue(_R(IDC_COMBOBOX_LE_RES), _R(IDS_LE_NONE), FALSE, -1);
01245 EnableGadget(_R(IDC_COMBOBOX_LE_RES), FALSE);
01246 break;
01247
01248 case 0:
01249
01250 SetStringGadgetValue(_R(IDC_COMBOBOX_LE_RES), _R(IDS_LE_AUTO), FALSE, -1);
01251 SetSelectedValueIndex(_R(IDC_COMBOBOX_LE_RES), 0);
01252 EnableGadget(_R(IDC_COMBOBOX_LE_RES), bCanChangeRes);
01253 break;
01254
01255 default:
01256 SetResDropListValue(_R(IDC_COMBOBOX_LE_RES), TRUE, (INT32)dRes);
01257 EnableGadget(_R(IDC_COMBOBOX_LE_RES), bCanChangeRes);
01258 break;
01259 }
01260 }
01261
01262
01263
01264
01265
01266
01267
01268
01269
01270
01271
01272
01273
01274
01275
01276
01277 void LiveEffectsInfoBarOp::UpdateLockButton(ListRange* pLevelRange)
01278 {
01279
01280
01281
01282 return;
01283
01284
01285 if (!m_bControlsExist)
01286 return;
01287
01288 if (pLevelRange==NULL)
01289 return;
01290
01291
01292 BOOL bSomeOrAllAreLocked = FALSE;
01293 BOOL bEnableButton = FALSE;
01294 Node* pNode = pLevelRange->FindFirst();
01295 while (pNode)
01296 {
01297 if (pNode->IsBitmapEffect())
01298 {
01299 NodeBitmapEffect* pEffect = (NodeBitmapEffect*)pNode;
01300 if (!pEffect->IsFeatherEffect())
01301 {
01302 if (pEffect->IsLockedEffect())
01303 {
01304 bEnableButton = (bEnableButton || pEffect->CanBeUnlocked());
01305 bSomeOrAllAreLocked = (bSomeOrAllAreLocked || pEffect->CanBeUnlocked());
01306 if (bSomeOrAllAreLocked && bEnableButton)
01307 break;
01308 }
01309 else
01310 bEnableButton = TRUE;
01311 }
01312 }
01313
01314 pNode = pLevelRange->FindNext(pNode);
01315 }
01316
01317 m_bLockSwitchState = bSomeOrAllAreLocked;
01318 SetBoolGadgetSelected(_R(IDC_CCBUTTON_LE_TOGGLELOCK), m_bLockSwitchState);
01319 EnableGadget(_R(IDC_CCBUTTON_LE_TOGGLELOCK), bEnableButton);
01320 }
01321
01322
01323
01324
01325
01326
01327
01328
01329
01330
01331
01332
01333
01334
01335
01336
01337 void LiveEffectsInfoBarOp::UpdateRemoveButton(ListRange* pLevelRange)
01338 {
01339
01340 if (!m_bControlsExist)
01341 return;
01342
01343 if (pLevelRange==NULL)
01344 return;
01345
01346 BOOL bEnableButton = FALSE;
01347 Node* pNode = pLevelRange->FindFirst();
01348 while (pNode)
01349 {
01350 if (pNode->IsEffect())
01351 {
01352 bEnableButton = TRUE;
01353 break;
01354 }
01355
01356 pNode = pLevelRange->FindNext(pNode);
01357 }
01358
01359 EnableGadget(_R(IDC_CCBUTTON_LE_REMOVE), bEnableButton);
01360 }
01361
01362
01363
01364
01365
01366
01367
01368
01369
01370
01371
01372
01373
01374
01375
01376
01377 void LiveEffectsInfoBarOp::UpdateAddButton(EffectsStack* pStack, ListRange* pLevelRange)
01378 {
01379
01380 if (!m_bControlsExist)
01381 return;
01382
01383 if (pLevelRange==NULL)
01384 return;
01385
01386
01387 BOOL bEnableButton = (pLevelRange->FindFirst()!=NULL);
01388
01389 EnableGadget(_R(IDC_CCBUTTON_LE_ADD), bEnableButton);
01390 EnableGadget(_R(IDC_BUTTON_LE_ADD), bEnableButton);
01391 }
01392
01393
01394
01395
01396
01397
01398
01399
01400
01401
01402
01403
01404
01405
01406
01407
01408 void LiveEffectsInfoBarOp::UpdateAddButton(EffectsStack* pStack, ListRange* pLevelRange)
01409 {
01410
01411 if (!m_bControlsExist)
01412 return;
01413
01414 if (pLevelRange==NULL)
01415 return;
01416
01417
01418 BOOL bEnableButton = (pLevelRange->FindFirst()!=NULL);
01419
01420 EnableGadget(_R(IDC_CCBUTTON_LE_ADD), bEnableButton);
01421 EnableGadget(_R(IDC_BUTTON_LE_ADD), bEnableButton);
01422 }
01423
01424
01425
01426
01427
01428
01429
01430
01431
01432
01433
01434
01435
01436
01437
01438
01439 void LiveEffectsInfoBarOp::UpdateEditButton(EffectsStack* pStack, ListRange* pLevelRange)
01440 {
01441
01442 if (!m_bControlsExist)
01443 return;
01444
01445 if (pLevelRange==NULL)
01446 return;
01447
01448 BOOL bEnableButton = FALSE;
01449 if (pStack->bConsistent )
01450 {
01451 Node* pNode = pLevelRange->FindFirst();
01452 while (pNode)
01453 {
01454 if (pNode->IsEffect())
01455 {
01456 bEnableButton = TRUE;
01457 break;
01458 }
01459
01460 pNode = pLevelRange->FindNext(pNode);
01461 }
01462 }
01463
01464 EnableGadget(_R(IDC_CCBUTTON_LE_EDIT), bEnableButton);
01465 EnableGadget(_R(IDC_BUTTON_LE_EDIT), bEnableButton);
01466 }
01467
01468
01469
01470
01471
01472
01473
01474
01475
01476
01477
01478
01479
01480
01481
01482
01483 void LiveEffectsInfoBarOp::UpdateLockAllButton()
01484 {
01485
01486 if (!m_bControlsExist)
01487 return;
01488
01489 SelRange Sel(*(GetApplication()->FindSelection()));
01490 Sel.SetPromoteToParent(TRUE);
01491 Node* pNode = Sel.FindFirst();
01492 Node* pNextNode = NULL;
01493 BOOL bSomeOrAllAreLocked = FALSE;
01494 BOOL bEnableButton = FALSE;
01495 while (pNode && !bSomeOrAllAreLocked && !bEnableButton)
01496 {
01497 pNextNode = Sel.FindNext(pNode);
01498
01499
01500 Node* pScanNode = pNode->FindFirstPreorder();
01501 while (pScanNode)
01502 {
01503 if (pScanNode->IsBitmapEffect() && !((NodeBitmapEffect*)pScanNode)->IsFeatherEffect())
01504 {
01505 NodeBitmapEffect* pEffect = (NodeBitmapEffect*)pScanNode;
01506 if (pEffect->IsLockedEffect())
01507 {
01508 bEnableButton = (bEnableButton || pEffect->CanBeUnlocked());
01509 bSomeOrAllAreLocked = (bSomeOrAllAreLocked || pEffect->CanBeUnlocked());
01510 if (bEnableButton && bSomeOrAllAreLocked)
01511 break;
01512 }
01513 else
01514 bEnableButton = TRUE;
01515
01516
01517
01518 pScanNode = pScanNode->FindNextPreorder(pNode, TRUE);
01519 }
01520 else
01521 pScanNode = pScanNode->FindNextPreorder(pNode);
01522 }
01523
01524 pNode = pNextNode;
01525 }
01526
01527 m_bLockAllSwitchState = bSomeOrAllAreLocked;
01528 SetBoolGadgetSelected(_R(IDC_CCBUTTON_LE_TOGGLELOCKALL), m_bLockAllSwitchState);
01529 EnableGadget(_R(IDC_CCBUTTON_LE_TOGGLELOCKALL), bEnableButton);
01530 }
01531
01532
01533
01534
01535
01536
01537
01538
01539
01540
01541
01542
01543
01544
01545
01546
01547 void LiveEffectsInfoBarOp::UpdateRemoveAllButton()
01548 {
01549
01550 if (!m_bControlsExist)
01551 return;
01552
01553 SelRange Sel(*(GetApplication()->FindSelection()));
01554 Node* pNode = Sel.FindFirst();
01555 BOOL bEnableButton = FALSE;
01556 ListRange* pStack = NULL;
01557 while (pNode)
01558 {
01559 pStack = EffectsStack::GetEffectsStackFromNode(pNode, TRUE, TRUE);
01560 if (pStack)
01561 {
01562 bEnableButton = TRUE;
01563 break;
01564 }
01565
01566 pNode = Sel.FindNext(pNode);
01567 }
01568
01569 if (pStack)
01570 {
01571 delete pStack;
01572 pStack = NULL;
01573 }
01574
01575 EnableGadget(_R(IDC_CCBUTTON_LE_REMOVEALL), bEnableButton);
01576 }
01577
01578
01579
01580
01581
01582
01583
01584
01585
01586
01587
01588
01589
01590
01591
01592
01593 void LiveEffectsInfoBarOp::UpdateSetupButton()
01594 {
01595
01596 if (!m_bControlsExist)
01597 return;
01598
01599 OpDescriptor* pOp = NULL;
01600 pOp = OpDescriptor::FindOpDescriptor(OPTOKEN_PLUGSDLG);
01601
01602 String_256 strDesc;
01603 EnableGadget(_R(IDC_BUTTON_LE_SETUP), pOp && !pOp->GetOpsState(&strDesc).Greyed);
01604 }
01605
01606
01607
01608
01609
01610
01611
01612
01613
01614
01615
01616
01617
01618
01619
01620
01621
01622
01623 void LiveEffectsInfoBarOp::SetGadgetWritable(INT32 id, BOOL enable)
01624 {
01625
01626 HWND gadget = ::GetDlgItem(WindowID, id);
01627
01628
01629 HWND hEdit = ::ChildWindowFromPoint(gadget, CPoint(1,1));
01630
01631 if (hEdit)
01632 gadget = hEdit;
01633
01634 if (enable)
01635 {
01636 ::SendMessage(gadget, EM_SETREADONLY, FALSE, 0);
01637 }
01638 else
01639 {
01640 ::SendMessage(gadget, EM_SETREADONLY, TRUE, 0);
01641 }
01642 }
01643
01644
01645
01646