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 #include "camtypes.h"
00100
00101
00102
00103
00104
00105
00106
00107
00108
00109 #include "sprdmsg.h"
00110 #include "optsmsgs.h"
00111 #include "layer.h"
00112
00113 #include "sglayer.h"
00114
00115
00116
00117 #include "layermsg.h"
00118 #include "aprps.h"
00119
00120
00121
00122
00123 #include "prevwdlg.h"
00124
00125
00126
00127
00128 #include "filedlgs.h"
00129
00130
00131 CC_IMPLEMENT_DYNCREATE (GIFAnimationPropertyTabsDlg, DialogTabOp)
00132 CC_IMPLEMENT_DYNCREATE (FramePropertiesTab, GIFAnimationPropertyTabs)
00133 CC_IMPLEMENT_DYNCREATE (AnimationPropertiesTab, GIFAnimationPropertyTabs)
00134 CC_IMPLEMENT_DYNCREATE (AnimationColoursTab, GIFAnimationPropertyTabs)
00135 CC_IMPLEMENT_DYNCREATE (PreviewInBrowserTab, GIFAnimationPropertyTabs)
00136 CC_IMPLEMENT_DYNCREATE (GIFAnimationPropertyTabs, PropertyTabs)
00137 CC_IMPLEMENT_DYNCREATE (AnimExOptns, GIFAnimationPropertyTabsDlg)
00138 CC_IMPLEMENT_DYNAMIC (BrowserPrvwChgdMsg, Msg)
00139
00140 #define new CAM_DEBUG_NEW
00141
00142 const CDlgResID GIFAnimationPropertyTabsDlg::IDD = _R(IDD_PROPERTIES);
00143 CDlgMode GIFAnimationPropertyTabsDlg::Mode = MODELESS;
00144
00145 const CDlgResID AnimExOptns::IDD = _R(IDD_OPTIONS_PROPERTIES);
00146 CDlgMode AnimExOptns::Mode = MODAL;
00147
00148
00149 GIFAnimationPropertyTabs *GIFAnimationPropertyTabsDlg::m_pGIFAnimationProperties = NULL;
00150 GIFAnimationPropertyTabsDlg *GIFAnimationPropertyTabsDlg::m_pGIFAnimationPropertyTabsDlg = NULL;
00151
00152
00153 List GIFAnimationPropertyTabs::GIFAnimationPropertyTabsList;
00154 DialogTabOp* GIFAnimationPropertyTabs::pPropertiesDlg = NULL;
00155 UINT32 GIFAnimationPropertyTabs::m_Count = 0;
00156 BOOL GIFAnimationPropertyTabs::m_IsManyDisplayed = FALSE;
00157 BOOL GIFAnimationPropertyTabs::m_IncludeFramePropertiesTab = TRUE;
00158 BOOL GIFAnimationPropertyTabs::m_BrowserPreviewTab = FALSE;
00159
00160
00161 UINT32 GIFAnimationPropertyTabs::FramePropertiesTabNumber = 0;
00162 UINT32 GIFAnimationPropertyTabs::AnimationColoursTabNumber = 1;
00163 UINT32 GIFAnimationPropertyTabs::AnimationPropertiesTabNumber = 2;
00164 UINT32 GIFAnimationPropertyTabs::PreviewInBrowserTabNumber = 3;
00165 INT32 GIFAnimationPropertyTabsDlg::m_PageToOpen = -1;
00166 BOOL GIFAnimationPropertyTabs::m_CurrentApplyNow = FALSE;
00167 BOOL GIFAnimationPropertyTabs::m_ApplyNow = FALSE;
00168 BOOL GIFAnimationPropertyTabs::m_InitMessage = FALSE;
00169 BOOL GIFAnimationPropertyTabs::m_FrameGalleryOpen = TRUE;
00170 BOOL GIFAnimationPropertyTabs::m_ChangeLayerState = FALSE;
00171 BOOL GIFAnimationPropertyTabs::m_FrameDelayValueChanged = FALSE;
00172
00173
00174 BOOL PreviewInBrowserTab::g_InfoInHtmlStub = TRUE;
00175 BOOL PreviewInBrowserTab::g_Imagemap = TRUE;
00176 BrowserBackground PreviewInBrowserTab::g_Background = BROWSER_BGR_NONE;
00177
00178
00179
00180
00181
00182
00183
00184
00185
00186
00187
00188
00189
00190
00191
00192 GIFAnimationPropertyTabsDlg::GIFAnimationPropertyTabsDlg(): DialogTabOp(GIFAnimationPropertyTabsDlg::IDD, GIFAnimationPropertyTabsDlg::Mode,
00193 CC_RUNTIME_CLASS(DialogOp), GIFAnimationPropertyTabsDlg::GetPageToOpen())
00194 {
00195 if (m_pGIFAnimationProperties)
00196 {
00197 m_pGIFAnimationProperties->SetApplyNowState(FALSE);
00198 m_pGIFAnimationProperties->SetInitMessageState(FALSE);
00199
00200
00201 m_pGIFAnimationProperties->pScopeDocument = NULL;
00202 m_pGIFAnimationProperties->SetCurrentDocAndSpread(NULL);
00203
00204
00205 UINT32 Val=1;
00206 m_pGIFAnimationProperties->IncCount(Val);
00207
00208
00209 m_pGIFAnimationPropertyTabsDlg = this;
00210 }
00211 }
00212
00213
00214
00215
00216
00217
00218
00219
00220
00221
00222
00223
00224
00225
00226
00227
00228
00229
00230 GIFAnimationPropertyTabsDlg::GIFAnimationPropertyTabsDlg(CDlgResID DialogResID, CDlgMode Mode): DialogTabOp(DialogResID, Mode,
00231 CC_RUNTIME_CLASS(DialogOp), GIFAnimationPropertyTabsDlg::GetPageToOpen())
00232 {
00233 if (m_pGIFAnimationProperties)
00234 {
00235 m_pGIFAnimationProperties->SetApplyNowState(FALSE);
00236 m_pGIFAnimationProperties->SetInitMessageState(FALSE);
00237
00238
00239 m_pGIFAnimationProperties->pScopeDocument = NULL;
00240 m_pGIFAnimationProperties->SetCurrentDocAndSpread(NULL);
00241
00242
00243 UINT32 Val=1;
00244 m_pGIFAnimationProperties->IncCount(Val);
00245
00246
00247 m_pGIFAnimationPropertyTabsDlg = this;
00248 }
00249 }
00250
00251
00252
00253
00254
00255
00256
00257
00258
00259
00260
00261
00262
00263
00264 GIFAnimationPropertyTabsDlg::~GIFAnimationPropertyTabsDlg()
00265 {
00266
00267 if (m_pGIFAnimationProperties)
00268 {
00269
00270 if(m_pGIFAnimationProperties->GetCount() < 1)
00271 {
00272
00273 m_pGIFAnimationProperties->SetTabbedDlg(NULL);
00274 }
00275
00276
00277 UINT32 Count =1;
00278 m_pGIFAnimationProperties->DecCount(Count);
00279
00280
00281 m_pGIFAnimationPropertyTabsDlg = NULL;
00282
00283
00284 m_pGIFAnimationProperties->SetCurrentApplyNow(FALSE);
00285 }
00286 }
00287
00288
00289
00290
00291
00292
00293
00294
00295
00296
00297
00298
00299
00300
00301
00302 BOOL GIFAnimationPropertyTabsDlg::CommitDialogValues()
00303 {
00304
00305 BOOL ok = TRUE;
00306 BOOL ValuesOk = TRUE;
00307
00308
00309 Document *pDocument = Document::GetSelected();
00310 m_pGIFAnimationProperties->SetCurrentDocAndSpread(pDocument);
00311
00312
00313 GIFAnimationPropertyTabs *pGIFAnimationPropertyTabs = GIFAnimationPropertyTabs::GetFirst();
00314
00315
00316 while (pGIFAnimationPropertyTabs != NULL)
00317 {
00318
00319 if ( pGIFAnimationPropertyTabs->IsPropertyRequired() )
00320 {
00321
00322 ok = pGIFAnimationPropertyTabs->CommitSection();
00323 if ( ok != TRUE)
00324 {
00325 if (ok == 2)
00326 InformError();
00327
00328
00329 ValuesOk = FALSE;
00330 }
00331
00332 pGIFAnimationPropertyTabs->SetApplyNowState(FALSE);
00333
00334
00335 pGIFAnimationPropertyTabs->GreyApplyNow();
00336 }
00337
00338 pGIFAnimationPropertyTabs = GIFAnimationPropertyTabs::GetNext(pGIFAnimationPropertyTabs);
00339 }
00340
00341
00342 return ValuesOk;
00343 }
00344
00345
00346
00347
00348
00349
00350
00351
00352
00353
00354
00355
00356
00357
00358
00359 MsgResult GIFAnimationPropertyTabsDlg::Message(Msg* Message)
00360 {
00361 ERROR3IF(Message == NULL,"GIFAnimationPropertyTabsDlg::Message NULL message received");
00362 ERROR3IF(m_pGIFAnimationProperties == NULL,"GIFAnimationPropertyTabsDlg::Message no m_pGIFAnimationProperties ptr");
00363
00364
00365 if (MESSAGE_IS_A(Message, DocChangingMsg))
00366 {
00367 DocChangingMsg *TheMsg = (DocChangingMsg *) Message;
00368
00369 switch ( TheMsg->State )
00370 {
00371 case DocChangingMsg::SELCHANGED:
00372 {
00373
00374 Document *pDocument = NULL;
00375 if (TheMsg->State == DocChangingMsg::TITLECHANGED)
00376 {
00377
00378 pDocument = TheMsg->pChangingDoc;
00379 }
00380 else
00381 {
00382
00383 pDocument = TheMsg->pNewDoc;
00384 }
00385
00386
00387 m_pGIFAnimationProperties->SetCurrentDocAndSpread(pDocument);
00388
00389
00390 m_pGIFAnimationProperties->SetUpDocUnits();
00391
00392
00393 if (pDocument == NULL)
00394 {
00395
00396 GIFAnimationPropertyTabs *pGIFAnimationPropertyTabs = GIFAnimationPropertyTabs::GetFirst();
00397
00398 while (pGIFAnimationPropertyTabs != NULL)
00399 {
00400
00401 if ( pGIFAnimationPropertyTabs->IsPropertyRequired() )
00402 {
00403
00404 pGIFAnimationPropertyTabs->GreySection();
00405 }
00406
00407
00408 pGIFAnimationPropertyTabs = GIFAnimationPropertyTabs::GetNext(pGIFAnimationPropertyTabs);
00409 }
00410 }
00411 else
00412 {
00413
00414 GIFAnimationPropertyTabs *pGIFAnimationPropertyTabs = GIFAnimationPropertyTabs::GetFirst();
00415
00416 while (pGIFAnimationPropertyTabs != NULL)
00417 {
00418
00419 if ( pGIFAnimationPropertyTabs->IsPropertyRequired() )
00420 {
00421
00422 pGIFAnimationPropertyTabs->UngreySection();
00423 }
00424
00425 pGIFAnimationPropertyTabs = GIFAnimationPropertyTabs::GetNext(pGIFAnimationPropertyTabs);
00426 }
00427 }
00428 }
00429 break;
00430
00431
00432 case DocChangingMsg::BORNANDSTABLE:
00433 {
00434
00435 Document *pDocument = NULL;
00436 pDocument = TheMsg->pChangingDoc;
00437 if (pDocument != NULL)
00438 {
00439
00440 m_pGIFAnimationProperties->SetCurrentDocAndSpread(pDocument);
00441
00442 GIFAnimationPropertyTabs *pGIFAnimationPropertyTabs = GIFAnimationPropertyTabs::GetFirst();
00443
00444 while (pGIFAnimationPropertyTabs != NULL)
00445 {
00446
00447 if ( pGIFAnimationPropertyTabs->IsPropertyRequired() )
00448 {
00449
00450 pGIFAnimationPropertyTabs->UpdateSection();
00451 }
00452
00453
00454 pGIFAnimationPropertyTabs = GIFAnimationPropertyTabs::GetNext(pGIFAnimationPropertyTabs);
00455 }
00456 }
00457 }
00458 break;
00459
00460 default:
00461 break;
00462 }
00463 }
00464
00465
00466 if (MESSAGE_IS_A(Message, DocViewMsg))
00467 {
00468 DocViewMsg *TheMsg = (DocViewMsg *) Message;
00469
00470 switch ( TheMsg->State )
00471 {
00472 case DocViewMsg::SELCHANGED:
00473 {
00474 if (TheMsg->pNewDocView != NULL)
00475 {
00476
00477 Document *pDocument = TheMsg->pNewDocView->GetDoc();
00478 m_pGIFAnimationProperties->SetCurrentDocAndSpread(pDocument);
00479
00480 GIFAnimationPropertyTabs *pGIFAnimationPropertyTabs = GIFAnimationPropertyTabs::GetFirst();
00481
00482 while (pGIFAnimationPropertyTabs != NULL)
00483 {
00484
00485 if ( pGIFAnimationPropertyTabs->IsPropertyRequired() )
00486 {
00487
00488 pGIFAnimationPropertyTabs->UpdateSection();
00489 }
00490
00491
00492 pGIFAnimationPropertyTabs = GIFAnimationPropertyTabs::GetNext(pGIFAnimationPropertyTabs);
00493 }
00494 }
00495 }
00496 break;
00497
00498 default:
00499 break;
00500 }
00501 }
00502
00503
00504 if (MESSAGE_IS_A(Message, SpreadMsg))
00505 {
00506 SpreadMsg *TheMsg = (SpreadMsg *) Message;
00507
00508 switch ( TheMsg->Reason )
00509 {
00510
00511 case SpreadMsg::SELCHANGED:
00512 {
00513 if (TheMsg->pNewSpread != NULL)
00514 {
00515
00516 Document *pDocument = (Document *)TheMsg->pNewSpread->FindOwnerDoc();
00517 m_pGIFAnimationProperties->SetCurrentDocAndSpread(pDocument);
00518
00519 GIFAnimationPropertyTabs *pGIFAnimationPropertyTabs = GIFAnimationPropertyTabs::GetFirst();
00520
00521 while (pGIFAnimationPropertyTabs != NULL)
00522 {
00523
00524 if ( pGIFAnimationPropertyTabs->IsPropertyRequired() )
00525 {
00526
00527 pGIFAnimationPropertyTabs->UpdateLayerSection();
00528 }
00529
00530
00531 pGIFAnimationPropertyTabs = GIFAnimationPropertyTabs::GetNext(pGIFAnimationPropertyTabs);
00532 }
00533 }
00534 }
00535 break;
00536
00537 case SpreadMsg::ANIMATIONPROPERTIESCHANGED:
00538 {
00539 GIFAnimationPropertyTabs *pGIFAnimationPropertyTabs = GIFAnimationPropertyTabs::GetFirst();
00540
00541 while (pGIFAnimationPropertyTabs != NULL)
00542 {
00543
00544 if ( pGIFAnimationPropertyTabs->IsPropertyRequired() )
00545 {
00546
00547 pGIFAnimationPropertyTabs->UpdateLayerSection();
00548 }
00549
00550 pGIFAnimationPropertyTabs = GIFAnimationPropertyTabs::GetNext(pGIFAnimationPropertyTabs);
00551 }
00552 }
00553 break;
00554
00555 default:
00556 break;
00557 }
00558 }
00559
00560
00561 if (MESSAGE_IS_A(Message, LayerMsg))
00562 {
00563 LayerMsg *TheMsg = (LayerMsg *) Message;
00564
00565 switch ( TheMsg->Reason )
00566 {
00567
00568 case LayerMsg::ACTIVE_LAYER_CHANGED:
00569 {
00570 if (TheMsg->pNewLayer != NULL)
00571 {
00572
00573 m_pGIFAnimationProperties->SetActiveLayer(TheMsg->pNewLayer);
00574
00575
00576
00577
00578 GIFAnimationPropertyTabs *pGIFAnimationPropertyTabs = GIFAnimationPropertyTabs::GetFirst();
00579
00580 while (pGIFAnimationPropertyTabs != NULL)
00581 {
00582
00583 CDlgResID PageId = pGIFAnimationPropertyTabs->GetPageID();
00584
00585
00586 if (PageId == _R(IDD_TAB_FRAME_PROPERTIES) || PageId == _R(IDD_TAB_ANIMATION_PROPERTIES))
00587 {
00588
00589 if ( pGIFAnimationPropertyTabs->IsPropertyRequired() )
00590 {
00591
00592 pGIFAnimationPropertyTabs->UpdateLayerSection();
00593
00594
00595
00596 }
00597 }
00598
00599 pGIFAnimationPropertyTabs = GIFAnimationPropertyTabs::GetNext(pGIFAnimationPropertyTabs);
00600 }
00601 }
00602 }
00603 break;
00604
00605
00606 case LayerMsg::UPDATE_ACTIVE_LAYER:
00607 {
00608
00609 BOOL FoundPage = FALSE;
00610
00611
00612 m_pGIFAnimationProperties->SetActiveLayer(TheMsg->pNewLayer);
00613
00614 GIFAnimationPropertyTabs *pGIFAnimationPropertyTabs = GIFAnimationPropertyTabs::GetFirst();
00615
00616 while (pGIFAnimationPropertyTabs != NULL && !FoundPage)
00617 {
00618
00619 CDlgResID PageId = pGIFAnimationPropertyTabs->GetPageID();
00620
00621
00622 if (PageId == _R(IDD_TAB_FRAME_PROPERTIES))
00623 {
00624
00625 if ( pGIFAnimationPropertyTabs->IsPropertyRequired() )
00626 {
00627
00628 pGIFAnimationPropertyTabs->UpdateLayerSection();
00629
00630
00631 FoundPage = TRUE;
00632 }
00633 }
00634
00635 pGIFAnimationPropertyTabs = GIFAnimationPropertyTabs::GetNext(pGIFAnimationPropertyTabs);
00636 }
00637 break;
00638 }
00639 default:
00640 break;
00641 }
00642 }
00643
00644
00645 if (MESSAGE_IS_A(Message, BrowserPrvwChgdMsg))
00646 {
00647 BrowserPrvwChgdMsg *TheMsg = (BrowserPrvwChgdMsg *) Message;
00648
00649 switch ( TheMsg->State )
00650 {
00651 case BrowserPrvwChgdMsg::PROPERTIES_CHANGED:
00652 {
00653
00654
00655
00656 BOOL FoundPage = FALSE;
00657
00658
00659 GIFAnimationPropertyTabs *pGIFAnimationPropertyTabs = GIFAnimationPropertyTabs::GetFirst();
00660
00661
00662 while (pGIFAnimationPropertyTabs != NULL && !FoundPage)
00663 {
00664
00665 CDlgResID PageId = pGIFAnimationPropertyTabs->GetPageID();
00666
00667
00668 if (PageId == _R(IDD_TAB_PREVIEW_IN_BROWSER))
00669 {
00670
00671 if ( pGIFAnimationPropertyTabs->IsPropertyRequired() )
00672 {
00673
00674 pGIFAnimationPropertyTabs->UpdateLayerSection();
00675
00676
00677 FoundPage = TRUE;
00678 }
00679 }
00680
00681 pGIFAnimationPropertyTabs = GIFAnimationPropertyTabs::GetNext(pGIFAnimationPropertyTabs);
00682 }
00683 break;
00684 }
00685 default:
00686 break;
00687 }
00688 }
00689
00690
00691 if (IS_OUR_DIALOG_MSG(Message))
00692 {
00693 DialogMsg* Msg = (DialogMsg*)Message;
00694
00695 MsgResult Result;
00696
00697
00698 BOOL EndDialog = FALSE;
00699 BOOL CommitValues = FALSE;
00700 m_pGIFAnimationProperties->GetApplyNowState();
00701
00702
00703 Document *pDocument = Document::GetSelected();
00704 m_pGIFAnimationProperties->SetCurrentDocAndSpread(pDocument);
00705
00706
00707 m_pGIFAnimationProperties->SetUpDocUnits();
00708
00709
00710
00711 if (Msg->DlgMsg == DIM_CREATE)
00712 m_pGIFAnimationProperties->SetInitMessageState(TRUE);
00713
00714
00715 BOOL FoundPage = FALSE;
00716
00717 if (Msg->PageID != 0)
00718 {
00719
00720 GIFAnimationPropertyTabs *pGIFAnimationPropertyTabs = GIFAnimationPropertyTabs::GetFirst();
00721
00722 while (pGIFAnimationPropertyTabs != NULL&& !FoundPage)
00723 {
00724 CDlgResID PageId = pGIFAnimationPropertyTabs->GetPageID();
00725 if (PageId == Msg->PageID)
00726 {
00727
00728 pGIFAnimationPropertyTabs->HandleMsg(Msg);
00729 FoundPage = TRUE;
00730 }
00731
00732 pGIFAnimationPropertyTabs = GIFAnimationPropertyTabs::GetNext(pGIFAnimationPropertyTabs);
00733 }
00734 }
00735 else
00736 {
00737
00738 switch (Msg->DlgMsg)
00739 {
00740 case DIM_CREATE:
00741 if (Msg->DlgMsg == DIM_CREATE)
00742 {
00743
00744
00745
00746 GIFAnimationPropertyTabs *pGIFAnimationPropertyTabs = GIFAnimationPropertyTabs::GetFirst();
00747
00748 while (pGIFAnimationPropertyTabs != NULL)
00749 {
00750
00751 pGIFAnimationPropertyTabs->HandleMsg(Msg);
00752
00753
00754 pGIFAnimationPropertyTabs = GIFAnimationPropertyTabs::GetNext(pGIFAnimationPropertyTabs);
00755 }
00756 }
00757 break;
00758
00759 case DIM_COMMIT:
00760 EndDialog = TRUE;
00761 CommitValues = TRUE;
00762 break;
00763
00764 case DIM_SOFT_COMMIT:
00765 {
00766 CommitValues = TRUE;
00767 m_pGIFAnimationProperties->SetApplyNowState(TRUE);
00768 }
00769 break;
00770
00771 case DIM_CANCEL:
00772 {
00773 EndDialog = TRUE;
00774 }
00775 break;
00776
00777 default:
00778 break;
00779 }
00780 }
00781
00782
00783 if (CommitValues)
00784 {
00785 BOOL ok = CommitDialogValues();
00786 if (!ok)
00787 {
00788 EndDialog = FALSE;
00789 }
00790 }
00791
00792
00793 Result = DialogTabOp::Message(Message);
00794
00795
00796 if (EndDialog)
00797 {
00798
00799
00800 if(m_pGIFAnimationProperties->GetCount() < 1)
00801 {
00802
00803 m_pGIFAnimationProperties->SetTabbedDlg(NULL);
00804 }
00805 return OK;
00806 }
00807
00808
00809 if (Msg->DlgMsg == DIM_CREATE)
00810 m_pGIFAnimationProperties->SetInitMessageState(FALSE);
00811
00812 return Result;
00813 }
00814 return DialogTabOp::Message(Message);
00815 }
00816
00817
00818
00819
00820
00821
00822
00823
00824
00825
00826
00827
00828
00829
00830 OpState GIFAnimationPropertyTabsDlg::GetState(String_256*, OpDescriptor*)
00831 {
00832 OpState OpSt;
00833
00834
00835 if (m_pGIFAnimationProperties && m_pGIFAnimationProperties->GetTabbedDlg() != NULL)
00836 OpSt.Greyed = TRUE;
00837
00838 return(OpSt);
00839 }
00840
00841
00842
00843
00844
00845
00846
00847
00848
00849
00850
00851
00852
00853 BOOL GIFAnimationPropertyTabsDlg::Init()
00854 {
00855 BOOL InitOK;
00856
00857
00858 InitOK = RegisterOpDescriptor(
00859 0,
00860 _R(IDS_ANIMATION_TAB_DLG),
00861 CC_RUNTIME_CLASS(GIFAnimationPropertyTabsDlg),
00862 OPTOKEN_GIFANIMPROPERTYTABS,
00863 GetState,
00864 0,
00865 0,
00866 0,
00867 0,
00868 SYSTEMBAR_ILLEGAL,
00869 TRUE,
00870 FALSE,
00871 TRUE,
00872 0,
00873 _R(IDS_ANIMATION_TAB_DLG_ONE),
00874 (DONT_GREY_WHEN_SELECT_INSIDE | GREY_WHEN_NO_CURRENT_DOC)
00875 );
00876
00877
00878 InitOK = InitOK && GIFAnimationPropertyTabs::InitGIFAnimationPropertyTabs();
00879 m_pGIFAnimationProperties = GIFAnimationPropertyTabs::GetFirst();
00880
00881 return (InitOK);
00882 }
00883
00884
00885
00886
00887
00888
00889
00890
00891
00892
00893
00894
00895
00896
00897 void GIFAnimationPropertyTabsDlg::Deinit()
00898 {
00899
00900 GIFAnimationPropertyTabs::DeinitGIFAnimationPropertyTabs();
00901 m_pGIFAnimationProperties = NULL;
00902 }
00903
00904
00905
00906
00907
00908
00909
00910
00911
00912
00913
00914
00915
00916
00917
00918 void GIFAnimationPropertyTabsDlg::Do(OpDescriptor*)
00919 {
00920 BOOL ok = FALSE;
00921
00922 if (m_pGIFAnimationProperties == NULL)
00923 {
00924
00925 ERROR3("GIFAnimationPropertyTabsDlg::Do no AnimationProperties present");
00926 End();
00927 }
00928
00929
00930 String_256 Temp(_R(IDS_ANIMATION_TAB_DLG));
00931 TitleString = Temp;
00932 SetName(&TitleString);
00933
00934
00935 GIFAnimationPropertyTabs::SetTabbedDlg(this);
00936
00937
00938
00939 ok = Create();
00940
00941
00942 Document *pDocument = Document::GetSelected();
00943 m_pGIFAnimationProperties->SetCurrentDocAndSpread(pDocument);
00944
00945 if ( ok )
00946 {
00947 Open();
00948
00949
00950 m_pGIFAnimationProperties->SetInitMessageState(FALSE);
00951 m_pGIFAnimationProperties->SetApplyNowState(FALSE);
00952 m_pGIFAnimationProperties->GreyApplyNow();
00953 }
00954 else
00955 {
00956
00957 InformError();
00958 End();
00959 }
00960 }
00961
00962
00963
00964
00965
00966
00967
00968
00969
00970
00971
00972
00973
00974
00975
00976 BOOL GIFAnimationPropertyTabsDlg::RegisterYourPagesInOrderPlease()
00977 {
00978 BOOL ok = TRUE;
00979
00980
00981 GIFAnimationPropertyTabs *pGIFAnimationPropertyTabs = GIFAnimationPropertyTabs::GetFirst();
00982
00983 while (pGIFAnimationPropertyTabs != NULL)
00984 {
00985 if ( pGIFAnimationPropertyTabs->IsPropertyRequired() )
00986 {
00987 CDlgResID PageId = pGIFAnimationPropertyTabs->GetPageID();
00988 ok = ok && AddAPage(PageId);
00989 }
00990
00991
00992 pGIFAnimationPropertyTabs = GIFAnimationPropertyTabs::GetNext(pGIFAnimationPropertyTabs);
00993 }
00994
00995 return (ok);
00996 }
00997
00998
00999
01000
01001
01002
01003
01004
01005
01006
01007
01008
01009
01010 GIFAnimationPropertyTabs * GIFAnimationPropertyTabsDlg::GetGIFAnimationPropertiesTabs()
01011 {
01012 return m_pGIFAnimationProperties;
01013 }
01014
01015
01016
01017
01018
01019
01020
01021
01022
01023
01024
01025 GIFAnimationPropertyTabs::GIFAnimationPropertyTabs()
01026 {
01027 pPropertiesDlg = NULL;
01028 m_NoFrameLayers = FALSE;
01029 m_IgnoreTextChangeMsg = FALSE;
01030 }
01031
01032
01033
01034
01035
01036
01037
01038
01039
01040
01041
01042 BOOL GIFAnimationPropertyTabs::Init()
01043 {
01044
01045 return TRUE;
01046 }
01047
01048
01049
01050
01051
01052 #define ADD_LAYERPROPERTY(Classname) \
01053 \
01054 pGIFAnimationProperty = new Classname; \
01055 if (pGIFAnimationProperty == NULL) return FALSE; \
01056 \
01057 if (!pGIFAnimationProperty->Init()) \
01058 { \
01059 \
01060 delete pGIFAnimationProperty; \
01061 InformError(); \
01062 return TRUE; \
01063 } \
01064 \
01065 GIFAnimationPropertyTabsList.AddTail(pGIFAnimationProperty);
01066
01067
01068
01069
01070
01071
01072
01073
01074
01075
01076
01077
01078
01079 BOOL GIFAnimationPropertyTabs::InitGIFAnimationPropertyTabs()
01080 {
01081
01082 GIFAnimationPropertyTabs *pGIFAnimationProperty = NULL;
01083
01084 ADD_LAYERPROPERTY(FramePropertiesTab)
01085 ADD_LAYERPROPERTY(AnimationColoursTab)
01086 ADD_LAYERPROPERTY(AnimationPropertiesTab)
01087 ADD_LAYERPROPERTY(PreviewInBrowserTab)
01088
01089
01090
01091
01092
01093
01094
01095
01096
01097
01098
01099
01100
01101
01102
01103
01104
01105
01106
01107
01108
01109
01110
01111
01112
01113
01114
01115
01116
01117
01118
01119
01120
01121
01122
01123
01124 return TRUE;
01125 }
01126
01127
01128
01129
01130
01131
01132
01133
01134
01135
01136
01137 void GIFAnimationPropertyTabs::DeinitGIFAnimationPropertyTabs()
01138 {
01139
01140
01141
01142 GIFAnimationPropertyTabsList.DeleteAll();
01143
01144 return;
01145 }
01146
01147
01148
01149
01150
01151
01152
01153
01154
01155
01156
01157
01158
01159 BOOL GIFAnimationPropertyTabs::DeclareGIFAnimationProperty(GIFAnimationPropertyTabs *pGIFAnimationProperty)
01160 {
01161 if (pGIFAnimationProperty == NULL) return FALSE;
01162
01163 if (!pGIFAnimationProperty->Init())
01164 {
01165 InformError();
01166 return TRUE;
01167 }
01168 GIFAnimationPropertyTabsList.AddTail(pGIFAnimationProperty);
01169
01170 return TRUE;
01171 }
01172
01173
01174
01175
01176
01177
01178
01179
01180
01181
01182
01183
01184 DialogTabOp * GIFAnimationPropertyTabs::GetTabbedDlg()
01185 {
01186
01187 return GIFAnimationPropertyTabs::pPropertiesDlg;
01188 }
01189
01190
01191
01192
01193
01194
01195
01196
01197
01198
01199
01200 BOOL GIFAnimationPropertyTabs::SetTabbedDlg(DialogTabOp * pDlg)
01201 {
01202
01203 pPropertiesDlg = pDlg;
01204
01205 return TRUE;
01206 }
01207
01208
01209
01210
01211
01212
01213
01214
01215
01216
01217
01218 GIFAnimationPropertyTabs *GIFAnimationPropertyTabs::GetFirst()
01219 {
01220 return (GIFAnimationPropertyTabs *) GIFAnimationPropertyTabsList.GetHead();
01221 }
01222
01223
01224
01225
01226
01227
01228
01229
01230
01231
01232
01233
01234
01235 GIFAnimationPropertyTabs *GIFAnimationPropertyTabs::GetNext(GIFAnimationPropertyTabs *pGIFAnimationPropertyTabs)
01236 {
01237 return (GIFAnimationPropertyTabs *) GIFAnimationPropertyTabsList.GetNext(pGIFAnimationPropertyTabs);
01238 }
01239
01240
01241
01242
01243
01244
01245
01246
01247
01248
01249
01250
01251
01252
01253 BOOL GIFAnimationPropertyTabs::GetApplyNowState()
01254 {
01255 return m_ApplyNow;
01256 }
01257
01258
01259
01260
01261
01262
01263
01264
01265
01266
01267
01268
01269
01270
01271 BOOL GIFAnimationPropertyTabs::SetApplyNowState(BOOL NewState)
01272 {
01273
01274
01275 if (!m_InitMessage)
01276 m_ApplyNow = NewState;
01277
01278
01279 return m_ApplyNow;
01280 }
01281
01282
01283
01284
01285
01286
01287
01288
01289
01290
01291
01292
01293
01294 BOOL GIFAnimationPropertyTabs::GetInitMessageState()
01295 {
01296 return m_InitMessage;
01297 }
01298
01299
01300
01301
01302
01303
01304
01305
01306
01307
01308
01309
01310
01311
01312 BOOL GIFAnimationPropertyTabs::SetInitMessageState(BOOL NewState)
01313 {
01314 BOOL OldState = m_InitMessage;
01315
01316 m_InitMessage = NewState;
01317
01318 return OldState;
01319 }
01320
01321
01322
01323
01324
01325
01326
01327
01328
01329
01330
01331
01332
01333 CDlgResID GIFAnimationPropertyTabs::GetPageID()
01334 {
01335 return 0;
01336 }
01337
01338
01339
01340
01341
01342
01343
01344
01345
01346
01347
01348
01349
01350 BOOL GIFAnimationPropertyTabs::CommitSection()
01351 {
01352 return TRUE;
01353 }
01354
01355
01356
01357
01358
01359
01360
01361
01362
01363
01364
01365
01366
01367
01368 BOOL GIFAnimationPropertyTabs::HandleMsg(DialogMsg* Msg)
01369 {
01370 return TRUE;
01371 }
01372
01373
01374
01375
01376
01377
01378
01379
01380
01381
01382
01383
01384
01385 BOOL GIFAnimationPropertyTabs::InitSection()
01386 {
01387 return TRUE;
01388 }
01389
01390
01391
01392
01393
01394
01395
01396
01397
01398
01399
01400
01401
01402
01403 BOOL GIFAnimationPropertyTabs::SameflDelayValues()
01404 {
01405 BOOL NumOfLayers = 0;
01406 INT32 i = 0;
01407 BOOL SameDelayValues = TRUE;
01408 Layer* pLayer = NULL;
01409 m_NoFrameLayers = FALSE;
01410
01411
01412 pLayer = pSpread->FindFirstFrameLayer();
01413
01414
01415 if(!pLayer)
01416 {
01417
01418
01419 pLayer = pSpread->FindFirstLayer();
01420
01421
01422 if(!pLayer)
01423 return FALSE;
01424 else
01425 m_NoFrameLayers = TRUE;
01426 }
01427
01428
01429 while (pLayer)
01430 {
01431
01432 if(m_NoFrameLayers)
01433 {
01434 pLayer = pLayer->FindNextLayer();
01435 NumOfLayers++;
01436 }
01437 else
01438 {
01439
01440 pLayer = pLayer->FindNextFrameLayer();
01441
01442 NumOfLayers++;
01443 }
01444 }
01445
01446
01447 if(NumOfLayers == 1)
01448 return TRUE;
01449
01450
01451 DWORD *pDelay = new DWORD[NumOfLayers];
01452
01453
01454 if(!pDelay)
01455 return FALSE;
01456
01457
01458 if(!m_NoFrameLayers)
01459 pLayer = pSpread->FindFirstFrameLayer();
01460 else
01461 pLayer = pSpread->FindFirstLayer();
01462
01463
01464 if(!pLayer)
01465 return FALSE;
01466
01467
01468 while (pLayer)
01469 {
01470
01471 pDelay[i++] = pLayer->GetFrameDelay();
01472
01473
01474 if(!m_NoFrameLayers)
01475 pLayer = pLayer->FindNextFrameLayer();
01476 else
01477 pLayer = pLayer->FindNextLayer();
01478 }
01479
01480
01481 for(i=0; i<NumOfLayers; i++)
01482 {
01483 for(INT32 n=0; n<NumOfLayers; n++)
01484 {
01485 if (pDelay[i] != pDelay[n])
01486 {
01487
01488 SameDelayValues = FALSE;
01489 }
01490 }
01491 }
01492
01493 delete [] pDelay;
01494
01495
01496 return SameDelayValues;
01497 }
01498
01499
01500
01501
01502
01503
01504
01505
01506
01507
01508
01509
01510
01511
01512
01513
01514
01515
01516
01517
01518
01519
01520
01521
01522
01523
01524
01525
01526
01527
01528 AnimationColoursTab::AnimationColoursTab()
01529 {
01530
01531 }
01532
01533
01534
01535
01536
01537
01538
01539
01540
01541
01542
01543
01544
01545
01546
01547 AnimationColoursTab::~AnimationColoursTab()
01548 {
01549
01550 }
01551
01552
01553
01554
01555
01556
01557
01558
01559
01560
01561
01562
01563
01564
01565 BOOL AnimationColoursTab::Init()
01566 {
01567 return TRUE;
01568 }
01569
01570
01571
01572
01573
01574
01575
01576
01577
01578
01579
01580
01581
01582 CDlgResID AnimationColoursTab::GetPageID()
01583 {
01584 return _R(IDD_TAB_ANIMATION_COLOURS);
01585 }
01586
01587
01588
01589
01590
01591
01592
01593
01594
01595
01596
01597 BOOL AnimationColoursTab::IsPropertyRequired()
01598 {
01599
01600
01601 if (GetBrowserPreviewTab())
01602 return FALSE;
01603 else
01604 return TRUE;
01605 }
01606
01607
01608
01609
01610
01611
01612
01613
01614
01615
01616
01617
01618
01619
01620
01621
01622 BOOL AnimationColoursTab::CommitSection()
01623 {
01624 ERROR2IF(pPropertiesDlg == NULL,FALSE,"animationColoursTab::CommitSection called with a NULL dialog pointer");
01625
01626 BOOL ok = pPropertiesDlg->TalkToPage(GetPageID());
01627 if (!ok)
01628 return TRUE;
01629
01630
01631 if (pSpread && HavePropertiesChanged())
01632 {
01633 PALETTE_COLOURS PalCols;
01634 WEB_PALETTE WebPal;
01635 DITHER Dither;
01636 DWORD CurNumColsInPal;
01637 BOOL Transparency;
01638
01639
01640 if (pPropertiesDlg->GetBoolGadgetSelected(_R(IDC_FRAME_GLOBALBROWSER)))
01641 {
01642 PalCols = PALCOL_BROWSER;
01643 WebPal = PAL_GLOBAL;
01644 }
01645 else if (pPropertiesDlg->GetBoolGadgetSelected(_R(IDC_FRAME_GLOBALOPTIMISED)))
01646 {
01647 WebPal = PAL_GLOBAL;
01648 PalCols = PALCOL_OPTIMIZED;
01649 }
01650 else if(pPropertiesDlg->GetBoolGadgetSelected(_R(IDC_FRAME_LOCALOPT)))
01651 {
01652 WebPal = PAL_LOCAL;
01653 PalCols = PALCOL_OPTIMIZED;
01654 }
01655
01656
01657 if (pPropertiesDlg->GetBoolGadgetSelected(_R(IDC_FRAME_DIFFUSION)))
01658 Dither = XARADITHER_ERROR_DIFFUSION;
01659
01660 else if (pPropertiesDlg->GetBoolGadgetSelected(_R(IDC_FRAME_ORDDITHER)))
01661 Dither = XARADITHER_ORDERED_GREY;
01662
01663 else if (pPropertiesDlg->GetBoolGadgetSelected(_R(IDC_FRAME_NODITHER)))
01664 Dither = XARADITHER_NONE;
01665
01666
01667 BOOL Valid = FALSE;
01668 CurNumColsInPal = pPropertiesDlg->GetLongGadgetValue(_R(IDC_FRAME_NUMCOLOURS), 2, 256, 0,&Valid);
01669
01670
01671 if (!Valid)
01672 {
01673 String_256 ErrMsg;
01674 ErrMsg.MakeMsg(_R(IDS_BMPPREFS_NUMCOLSWRONG),2,256);
01675 Error::SetError(0,ErrMsg,0);
01676 InformError();
01677
01678 return FALSE;
01679 }
01680
01681
01682 Transparency = pPropertiesDlg->GetBoolGadgetSelected(_R(IDC_FRAME_TRANSPARENCY));
01683
01684 PORTNOTE("other", "Remove FrameSGallery");
01685 #ifndef EXCLUDE_FROM_XARALX
01686
01687 FrameSGallery::EnsureFrameLayerIntegrity(pSpread);
01688 #endif
01689
01690 pSpread->SetAnimationColours( Dither, WebPal, PalCols, CurNumColsInPal, Transparency);
01691
01692
01693 Layer* pLayer = pSpread->FindFirstFrameLayer();
01694
01695 while (pLayer != NULL)
01696 {
01697
01698 pLayer->SetEdited(TRUE);
01699
01700
01701 pLayer = pLayer->FindNextFrameLayer();
01702 }
01703
01704
01705
01706 Document* pDoc = Document::GetCurrent();
01707
01708
01709 if(pDoc)
01710 pDoc->SetModified(TRUE);
01711
01712
01713 if (PreviewDialog::GetPreviewDialog())
01714 {
01715
01716
01717
01718
01719 OpDescriptor* pOpDesc = OpDescriptor::FindOpDescriptor(OPTOKEN_FRAME_GRABALLFRAMES);
01720 if (pOpDesc != NULL)
01721 pOpDesc->Invoke();
01722 else
01723 {
01724 ERROR3("Couldn't find OPTOKEN_FRAME_GRABALLFRAMES op descriptor");
01725 }
01726 }
01727 }
01728
01729
01730 return TRUE;
01731 }
01732
01733
01734
01735
01736
01737
01738
01739
01740
01741
01742
01743
01744
01745
01746 BOOL AnimationColoursTab::GreySection()
01747 {
01748 ERROR2IF(pPropertiesDlg == NULL,FALSE,"AnimationcoloursTab::GreySection called with no dialog pointer");
01749
01750
01751 BOOL ok = pPropertiesDlg->TalkToPage(GetPageID());
01752 if (!ok)
01753 return TRUE;
01754
01755
01756 if (m_GreyStatus == TRUE)
01757 return TRUE;
01758
01759
01760 pPropertiesDlg->EnableGadget(_R(IDC_FRAME_GLOBALBROWSER), FALSE);
01761 pPropertiesDlg->EnableGadget(_R(IDC_FRAME_GLOBALOPTIMISED), FALSE);
01762 pPropertiesDlg->EnableGadget(_R(IDC_FRAME_LOCALOPT), FALSE);
01763 pPropertiesDlg->EnableGadget(_R(IDC_FRAME_NUMCOLOURS), FALSE);
01764 pPropertiesDlg->EnableGadget(_R(IDC_FRAME_NODITHER), FALSE);
01765 pPropertiesDlg->EnableGadget(_R(IDC_FRAME_ORDDITHER), FALSE);
01766 pPropertiesDlg->EnableGadget(_R(IDC_FRAME_DIFFUSION), FALSE);
01767 pPropertiesDlg->EnableGadget(_R(IDC_FRAME_TRANSPARENCY), FALSE);
01768
01769
01770 ok = ChangeControlStatus(FALSE);
01771
01772
01773 m_GreyStatus = TRUE;
01774 SetApplyNowState(FALSE);
01775
01776
01777 return ok;
01778 }
01779
01780
01781
01782
01783
01784
01785
01786
01787
01788
01789
01790
01791
01792
01793 BOOL AnimationColoursTab::UngreySection()
01794 {
01795 ERROR2IF(pPropertiesDlg == NULL,FALSE,"AnimationColoursTab::UngreySection called with a NULL dialog pointer");
01796
01797
01798 BOOL ok = pPropertiesDlg->TalkToPage(GetPageID());
01799 if (!ok)
01800 return TRUE;
01801
01802
01803 if (m_GreyStatus == FALSE)
01804 return TRUE;
01805
01806
01807 pPropertiesDlg->EnableGadget(_R(IDC_FRAME_GLOBALBROWSER), TRUE);
01808 pPropertiesDlg->EnableGadget(_R(IDC_FRAME_GLOBALOPTIMISED), TRUE);
01809 pPropertiesDlg->EnableGadget(_R(IDC_FRAME_LOCALOPT), TRUE);
01810 pPropertiesDlg->EnableGadget(_R(IDC_FRAME_NUMCOLOURS), TRUE);
01811 pPropertiesDlg->EnableGadget(_R(IDC_FRAME_NODITHER), TRUE);
01812 pPropertiesDlg->EnableGadget(_R(IDC_FRAME_ORDDITHER), TRUE);
01813 pPropertiesDlg->EnableGadget(_R(IDC_FRAME_DIFFUSION), TRUE);
01814 pPropertiesDlg->EnableGadget(_R(IDC_FRAME_TRANSPARENCY), TRUE);
01815
01816
01817 ok = ChangeControlStatus(TRUE);
01818
01819 m_GreyStatus = FALSE;
01820
01821 return ok;
01822 }
01823
01824
01825
01826
01827
01828
01829
01830
01831
01832
01833
01834
01835
01836
01837
01838 BOOL AnimationColoursTab::ChangeControlStatus(const BOOL Status)
01839 {
01840
01841
01842 AnimationColoursTab::GreyApplyNow();
01843
01844 return TRUE;
01845 }
01846
01847
01848
01849
01850
01851
01852
01853
01854
01855
01856
01857
01858
01859
01860 BOOL AnimationColoursTab::UpdateSection()
01861 {
01862 ERROR2IF(pPropertiesDlg == NULL,FALSE,"AnimationColoursTab::UpdateSection called with a NULL dialog pointer");
01863
01864
01865 BOOL ok = pPropertiesDlg->TalkToPage(GetPageID());
01866 if (!ok)
01867 return TRUE;
01868
01869
01870 ShowDetails();
01871
01872 return TRUE;
01873 }
01874
01875
01876
01877
01878
01879
01880
01881
01882
01883
01884
01885
01886
01887
01888 BOOL AnimationColoursTab::ShowDetails()
01889 {
01890 ERROR2IF(pPropertiesDlg == NULL,FALSE,"AnimationColoursTab::ShowDetails called with a NULL dialog pointer");
01891
01892 BOOL ok = pPropertiesDlg->TalkToPage(GetPageID());
01893 if (!ok)
01894 return TRUE;
01895
01896 if (pSpread != NULL)
01897 {
01898
01899 SetIgnoreTextChangeMsg(TRUE);
01900
01901
01902 AnimPropertiesParam* pParam = &pSpread->GetSpreadAnimPropertiesParam();
01903
01904 if(pParam)
01905 {
01906
01907 DITHER Dither = pParam->GetDither();
01908
01909 switch(Dither)
01910 {
01911 case XARADITHER_NONE:
01912 {
01913
01914 pPropertiesDlg->SetBoolGadgetSelected(_R(IDC_FRAME_NODITHER),TRUE);
01915
01916
01917 pPropertiesDlg->SetBoolGadgetSelected(_R(IDC_FRAME_ORDDITHER),FALSE);
01918 pPropertiesDlg->SetBoolGadgetSelected(_R(IDC_FRAME_DIFFUSION),FALSE);
01919 }
01920 break;
01921
01922 case XARADITHER_ORDERED_GREY:
01923 {
01924
01925 pPropertiesDlg->SetBoolGadgetSelected(_R(IDC_FRAME_ORDDITHER),TRUE);
01926
01927
01928 pPropertiesDlg->SetBoolGadgetSelected(_R(IDC_FRAME_DIFFUSION),FALSE);
01929 pPropertiesDlg->SetBoolGadgetSelected(_R(IDC_FRAME_NODITHER),FALSE);
01930 }
01931 break;
01932
01933 case XARADITHER_ERROR_DIFFUSION:
01934 {
01935
01936 pPropertiesDlg->SetBoolGadgetSelected(_R(IDC_FRAME_DIFFUSION),TRUE);
01937
01938
01939 pPropertiesDlg->SetBoolGadgetSelected(_R(IDC_FRAME_NODITHER),FALSE);
01940 pPropertiesDlg->SetBoolGadgetSelected(_R(IDC_FRAME_ORDDITHER),FALSE);
01941 }
01942 break;
01943 default:
01944 {
01945
01946 pPropertiesDlg->SetBoolGadgetSelected(_R(IDC_FRAME_ORDDITHER),TRUE);
01947
01948
01949 pPropertiesDlg->SetBoolGadgetSelected(_R(IDC_FRAME_DIFFUSION),FALSE);
01950 pPropertiesDlg->SetBoolGadgetSelected(_R(IDC_FRAME_NODITHER),FALSE);
01951 }
01952 break;
01953 }
01954
01955
01956 pPropertiesDlg->SetBoolGadgetSelected(_R(IDC_FRAME_TRANSPARENCY), pParam->GetIsBackGroundTransp());
01957
01958
01959 PALETTE_COLOURS PalCols = pParam->GetPaletteCols();
01960 WEB_PALETTE WebPal = pParam->GetPalette();
01961 BOOL Optimized = FALSE;
01962 BOOL GlobalBrowserPalette = FALSE;
01963
01964
01965 if(WebPal == PAL_GLOBAL && PalCols == PALCOL_BROWSER)
01966 {
01967
01968 pPropertiesDlg->SetBoolGadgetSelected(_R(IDC_FRAME_GLOBALBROWSER),TRUE);
01969 GlobalBrowserPalette = TRUE;
01970
01971
01972 pPropertiesDlg->SetBoolGadgetSelected(_R(IDC_FRAME_GLOBALOPTIMISED),FALSE);
01973 pPropertiesDlg->SetBoolGadgetSelected(_R(IDC_FRAME_LOCALOPT),FALSE);
01974 }
01975
01976
01977 if(WebPal == PAL_GLOBAL && PalCols == PALCOL_OPTIMIZED)
01978 {
01979
01980 pPropertiesDlg->SetBoolGadgetSelected(_R(IDC_FRAME_GLOBALOPTIMISED),TRUE);
01981 Optimized = TRUE;
01982
01983
01984 pPropertiesDlg->SetBoolGadgetSelected(_R(IDC_FRAME_GLOBALBROWSER),FALSE);
01985 pPropertiesDlg->SetBoolGadgetSelected(_R(IDC_FRAME_LOCALOPT),FALSE);
01986 }
01987
01988
01989 if(WebPal == PAL_LOCAL && PalCols == PALCOL_OPTIMIZED)
01990 {
01991
01992 pPropertiesDlg->SetBoolGadgetSelected(_R(IDC_FRAME_LOCALOPT),TRUE);
01993 Optimized = TRUE;
01994
01995
01996 pPropertiesDlg->SetBoolGadgetSelected(_R(IDC_FRAME_GLOBALBROWSER),FALSE);
01997 pPropertiesDlg->SetBoolGadgetSelected(_R(IDC_FRAME_GLOBALOPTIMISED),FALSE);
01998 }
01999
02000
02001 if(Optimized)
02002 {
02003
02004 pPropertiesDlg->EnableGadget(_R(IDC_FRAME_ORDDITHER),FALSE);
02005
02006
02007 pPropertiesDlg->EnableGadget(_R(IDC_FRAME_NUMCOLOURS), TRUE);
02008
02009
02010 if(Dither == XARADITHER_ORDERED_GREY)
02011 pPropertiesDlg->SetBoolGadgetSelected(_R(IDC_FRAME_DIFFUSION),TRUE);
02012 }
02013
02014
02015
02016 if(GlobalBrowserPalette)
02017 {
02018 DWORD NumColsInPalette = pParam->GetNumColsInPalette();
02019 pPropertiesDlg->SetLongGadgetValue(_R(IDC_FRAME_NUMCOLOURS), NumColsInPalette);
02020 pPropertiesDlg->EnableGadget(_R(IDC_FRAME_NUMCOLOURS), FALSE);
02021 }
02022 else
02023 {
02024 DWORD NumColsInPalette = pParam->GetNumColsInPalette();
02025 pPropertiesDlg->SetLongGadgetValue(_R(IDC_FRAME_NUMCOLOURS), NumColsInPalette);
02026 }
02027 }
02028 }
02029
02030
02031 SetIgnoreTextChangeMsg(FALSE);
02032
02033
02034 ChangeControlStatus(!m_GreyStatus);
02035 return TRUE;
02036 }
02037
02038
02039
02040
02041
02042
02043
02044
02045
02046
02047
02048
02049
02050 BOOL AnimationColoursTab::UpdateLayerSection()
02051 {
02052 ERROR2IF(pPropertiesDlg == NULL,FALSE,"AnimationColoursTab::UpdateLayerSection() called with a NULL dialog pointer");
02053
02054 BOOL ok = pPropertiesDlg->TalkToPage(GetPageID());
02055 if (!ok)
02056 return TRUE;
02057
02058
02059 ShowDetails();
02060
02061
02062 return TRUE;
02063 }
02064
02065
02066
02067
02068
02069
02070
02071
02072
02073
02074
02075
02076
02077
02078 BOOL AnimationColoursTab::HandleMsg(DialogMsg* Msg)
02079 {
02080 ERROR2IF(Msg == NULL,FALSE,"AnimationColoursTab::Message null message received");
02081 ERROR2IF(pPropertiesDlg == NULL,FALSE,"AnimationColoursTab::HandleMsg called with a NULL dialog pointer");
02082
02083 BOOL ok = pPropertiesDlg->TalkToPage(GetPageID());
02084 if (!ok)
02085 return TRUE;
02086
02087 switch(Msg->DlgMsg)
02088 {
02089 case DIM_CREATE:
02090 m_GreyStatus = FALSE;
02091 ok = InitSection();
02092 if (!ok)
02093 InformError();
02094 break;
02095
02096 case DIM_LFT_BN_CLICKED:
02097 {
02098 HavePropertiesChanged();
02099
02100
02101 AnimationColoursTab::SetApplyNowState(TRUE);
02102
02103
02104 AnimationColoursTab::UngreyApplyNow();
02105 }
02106 break;
02107
02108 case DIM_SELECTION_CHANGED:
02109 {
02110 if(AnimationColoursTab::GetApplyNowState())
02111 {
02112
02113 AnimationColoursTab::UngreyApplyNow();
02114 }
02115 }
02116 break;
02117
02118 case DIM_TEXT_CHANGED:
02119 {
02120
02121 if(!GetIgnoreTextChangeMsg())
02122 {
02123
02124 if(HavePropertiesChanged())
02125 {
02126 AnimationColoursTab::SetApplyNowState(TRUE);
02127
02128
02129 AnimationColoursTab::UngreyApplyNow();
02130 }
02131 }
02132 }
02133 break;
02134
02135 case DIM_SET_ACTIVE:
02136 {
02137 if(AnimationColoursTab::GetApplyNowState())
02138 {
02139
02140 AnimationColoursTab::UngreyApplyNow();
02141 }
02142 }
02143 break;
02144
02145 default:
02146 break;
02147 }
02148 return TRUE;
02149 }
02150
02151
02152
02153
02154
02155
02156
02157
02158
02159
02160
02161
02162
02163
02164
02165
02166 BOOL AnimationColoursTab::UpdateApplyState()
02167 {
02168 ERROR2IF(pPropertiesDlg == NULL,FALSE,"animationColoursTab::CommitSection called with a NULL dialog pointer");
02169
02170
02171
02172
02173
02174
02175
02176
02177
02178
02179
02180
02181
02182
02183
02184
02185
02186
02187
02188
02189
02190 return TRUE;
02191 }
02192
02193
02194
02195
02196
02197
02198
02199
02200
02201
02202
02203
02204
02205 BOOL AnimationColoursTab::HavePropertiesChanged()
02206 {
02207 ERROR2IF(pPropertiesDlg == NULL,FALSE,"animationColoursTab::HavePropertiesChanged called with a NULL dialog pointer");
02208
02209 BOOL ok = pPropertiesDlg->TalkToPage(GetPageID());
02210 if (!ok)
02211 return TRUE;
02212
02213
02214
02215 PALETTE_COLOURS CurPalCols;
02216 WEB_PALETTE CurWebPal;
02217 DWORD CurNumColsInPal = 256;
02218 BOOL Global_Browser_Palette = FALSE;
02219 BOOL Optimized = FALSE;
02220 UINT32 CurPaletteType = 0;
02221 UINT32 PaletteType = 0;
02222
02223
02224
02225
02226 if (pPropertiesDlg->GetBoolGadgetSelected(_R(IDC_FRAME_GLOBALBROWSER)))
02227 {
02228 CurPalCols = PALCOL_BROWSER;
02229 CurWebPal = PAL_GLOBAL;
02230 CurPaletteType = 1;
02231 Global_Browser_Palette = TRUE;
02232 }
02233
02234 else if (pPropertiesDlg->GetBoolGadgetSelected(_R(IDC_FRAME_GLOBALOPTIMISED)))
02235 {
02236 CurWebPal = PAL_GLOBAL;
02237 CurPalCols = PALCOL_OPTIMIZED;
02238 Optimized = TRUE;
02239 CurPaletteType = 2;
02240 Global_Browser_Palette = FALSE;
02241 }
02242
02243 else if(pPropertiesDlg->GetBoolGadgetSelected(_R(IDC_FRAME_LOCALOPT)))
02244 {
02245 CurWebPal = PAL_LOCAL;
02246 CurPalCols = PALCOL_OPTIMIZED;
02247 Optimized = TRUE;
02248 CurPaletteType = 3;
02249 Global_Browser_Palette = FALSE;
02250 }
02251
02252
02253 if(Global_Browser_Palette)
02254 pPropertiesDlg->EnableGadget(_R(IDC_FRAME_NUMCOLOURS), FALSE);
02255 else
02256
02257 pPropertiesDlg->EnableGadget(_R(IDC_FRAME_NUMCOLOURS), TRUE);
02258
02259
02260 CurNumColsInPal = pPropertiesDlg->GetLongGadgetValue(_R(IDC_FRAME_NUMCOLOURS), 0, 256, _R(IDS_BMPPREFS_INVALIDDELAY) ,NULL);
02261
02262
02263 DITHER CurDither = XARADITHER_NONE;
02264 if (pPropertiesDlg->GetBoolGadgetSelected(_R(IDC_FRAME_DIFFUSION)))
02265 CurDither = XARADITHER_ERROR_DIFFUSION;
02266
02267 else if (pPropertiesDlg->GetBoolGadgetSelected(_R(IDC_FRAME_ORDDITHER)))
02268 CurDither = XARADITHER_ORDERED_GREY;
02269
02270 else if (pPropertiesDlg->GetBoolGadgetSelected(_R(IDC_FRAME_NODITHER)))
02271 CurDither = XARADITHER_NONE;
02272
02273
02274 if(Optimized)
02275 {
02276 pPropertiesDlg->EnableGadget(_R(IDC_FRAME_ORDDITHER),FALSE);
02277
02278
02279 if(CurDither == XARADITHER_ORDERED_GREY)
02280 pPropertiesDlg->SetBoolGadgetSelected(_R(IDC_FRAME_DIFFUSION),TRUE);
02281 pPropertiesDlg->SetLongGadgetValue(_R(IDC_FRAME_ORDDITHER), FALSE);
02282 }
02283 else
02284 pPropertiesDlg->EnableGadget(_R(IDC_FRAME_ORDDITHER),TRUE);
02285
02286
02287 BOOL CurTransparency = pPropertiesDlg->GetBoolGadgetSelected(_R(IDC_FRAME_TRANSPARENCY));
02288
02289
02290 AnimPropertiesParam* pParam = &pSpread->GetSpreadAnimPropertiesParam();
02291
02292 ERROR2IF(pParam == NULL,FALSE,"AnimationColoursTab::HavePropertiesChanged makes reference to a NULL ptr!");
02293
02294
02295 DITHER Dither = pParam->GetDither();
02296
02297
02298 BOOL Transparency = pParam->GetIsBackGroundTransp();
02299
02300
02301 PALETTE_COLOURS PalCols = pParam->GetPaletteCols();
02302 WEB_PALETTE WebPal = pParam->GetPalette();
02303
02304
02305 if(PalCols == PALCOL_BROWSER && WebPal == PAL_GLOBAL)
02306 PaletteType = 1;
02307
02308 else if(PalCols == PALCOL_OPTIMIZED && WebPal == PAL_GLOBAL)
02309 PaletteType = 2;
02310
02311 else if(PalCols == PALCOL_OPTIMIZED && WebPal == PAL_LOCAL)
02312 PaletteType = 3;
02313
02314
02315 DWORD NumColsInPal = pParam->GetNumColsInPalette();
02316
02317
02318 return
02319 ((CurDither != Dither) ||
02320 (CurTransparency != Transparency) ||
02321 (CurPaletteType != PaletteType) ||
02322 (CurNumColsInPal != NumColsInPal));
02323 }
02324
02325
02326
02327
02328
02329
02330
02331
02332
02333
02334
02335
02336
02337
02338 BOOL AnimationColoursTab::InitSection()
02339 {
02340 ERROR2IF(pPropertiesDlg == NULL,FALSE,"AnimationColoursTab::InitSection called with a NULL dialog pointer");
02341
02342
02343 Document* pDoc = Document::GetCurrent();
02344
02345
02346 if(!pDoc)
02347 {
02348 GreySection();
02349 return (TRUE);
02350 }
02351
02352 ShowDetails();
02353 return TRUE;
02354 }
02355
02356
02357
02358
02359
02360
02361
02362
02363
02364
02365
02366
02367
02368
02369
02370
02371
02372
02373
02374
02375
02376
02377
02378
02379
02380
02381
02382
02383 AnimationPropertiesTab::AnimationPropertiesTab()
02384 {
02385 }
02386
02387
02388
02389
02390
02391
02392
02393
02394
02395
02396
02397
02398
02399
02400
02401 AnimationPropertiesTab::~AnimationPropertiesTab()
02402 {
02403 }
02404
02405
02406
02407
02408
02409
02410
02411
02412
02413
02414
02415
02416
02417
02418
02419 BOOL AnimationPropertiesTab::Init()
02420 {
02421 return TRUE;
02422 }
02423
02424
02425
02426
02427
02428
02429
02430
02431
02432
02433
02434
02435
02436
02437 CDlgResID AnimationPropertiesTab::GetPageID()
02438 {
02439 return _R(IDD_TAB_ANIMATION_PROPERTIES);
02440 }
02441
02442
02443
02444
02445
02446
02447
02448
02449
02450
02451
02452
02453 BOOL AnimationPropertiesTab::IsPropertyRequired()
02454 {
02455
02456
02457 if (GetBrowserPreviewTab())
02458 return FALSE;
02459 else
02460 return TRUE;
02461 }
02462
02463
02464
02465
02466
02467
02468
02469
02470
02471
02472
02473
02474
02475
02476
02477
02478 BOOL AnimationPropertiesTab::CommitSection()
02479 {
02480 ERROR2IF(pPropertiesDlg == NULL,FALSE,"AnimationPropertiesTab::CommitSection called with a NULL dialog pointer");
02481
02482 BOOL ok = pPropertiesDlg->TalkToPage(GetPageID());
02483 if (!ok)
02484 return TRUE;
02485
02486
02487 if (pSpread && HavePropertiesChanged(TRUE))
02488 {
02489
02490 DWORD Delay = 0;
02491 BOOL DelayValid = FALSE;
02492 BOOL LoopValid = FALSE;
02493 BOOL PropertiesChanged = FALSE;
02494
02495 BOOL Loop_Continously = pPropertiesDlg->GetBoolGadgetSelected(_R(IDC_ANIMOPTS_LOOP));
02496 DWORD Loop = pPropertiesDlg->GetLongGadgetValue(_R(IDC_ANIMOPTS_ITERATIONS), 0, 65535, _R(IDS_BMPPREFS_INVALIDLOOP) ,&LoopValid);
02497
02498
02499 if(!LoopValid)
02500 return FALSE;
02501
02502
02503 if(!m_IsManyDisplayed)
02504 Delay = pPropertiesDlg->GetLongGadgetValue(_R(IDC_ANIMTAB_DELAY), 0, 65535, _R(IDS_BMPPREFS_INVALIDDELAY) ,&DelayValid);
02505
02506
02507
02508 if(Delay == 0 && !m_IsManyDisplayed)
02509 pPropertiesDlg->SetLongGadgetValue(_R(IDC_ANIMTAB_DELAY), 0);
02510
02511
02512 if(!DelayValid && !m_IsManyDisplayed)
02513 return FALSE;
02514
02515
02516 if(Loop_Continously)
02517 Loop = 0;
02518
02519 PORTNOTE("other", "Remove FrameSGallery");
02520 #ifndef EXCLUDE_FROM_XARALX
02521
02522 FrameSGallery::EnsureFrameLayerIntegrity(pSpread);
02523 #endif
02524
02525 pSpread->SetAnimationLoop(Loop);
02526
02527
02528 PropertiesChanged = TRUE;
02529
02530
02531 if(!m_IsManyDisplayed)
02532 {
02533
02534 pSpread->SetAnimationDelay(Delay);
02535
02536
02537 SetGlobalDelay(pSpread, Delay);
02538 }
02539
02540
02541 if (PreviewDialog::GetPreviewDialog())
02542 {
02543
02544
02545 PreviewDialog* pPreviewDlg = PreviewDialog::GetPreviewDialog();
02546
02547
02548 if(pPreviewDlg)
02549 {
02550
02551 if(!pPreviewDlg->GetDlgState())
02552 {
02553
02554 OpDescriptor* pOpDesc = OpDescriptor::FindOpDescriptor(OPTOKEN_FRAME_GRABALLFRAMES);
02555 if (pOpDesc != NULL)
02556 pOpDesc->Invoke();
02557 else
02558 {
02559 ERROR3("Couldn't find OPTOKEN_FRAME_GRABALLFRAMES op descriptor");
02560 }
02561 }
02562 }
02563 }
02564
02565
02566 Layer* pLayer = pSpread->FindFirstFrameLayer();
02567 while (pLayer != NULL)
02568 {
02569
02570 if (!pLayer->IsBackground() && !pLayer->IsGuide() &&
02571 !pLayer->IsPageBackground())
02572 {
02573
02574 BROADCAST_TO_ALL(LayerMsg(pLayer, LayerMsg::REDRAW_LAYER));
02575 }
02576
02577
02578 pLayer = pLayer->FindNextFrameLayer();
02579 }
02580
02581
02582 pLayer = pSpread->FindActiveLayer();
02583
02584
02585 BROADCAST_TO_ALL(LayerMsg(pLayer, LayerMsg::UPDATE_ACTIVE_LAYER));
02586
02587
02588 PropertiesChanged = TRUE;
02589
02590
02591 if(PropertiesChanged)
02592 {
02593
02594 Document* pDoc = Document::GetCurrent();
02595
02596
02597 if(pDoc)
02598 pDoc->SetModified(TRUE);
02599 }
02600 }
02601
02602
02603 if(GetFrameDelayValueChanged())
02604 {
02605
02606 if(SameflDelayValues())
02607 {
02608
02609
02610
02611 Layer* pLayer = pSpread->FindFirstLayer();
02612
02613
02614 if (pSpread && pLayer)
02615 {
02616
02617 DWORD GlobalDelay = pLayer->GetFrameDelay();
02618
02619
02620 pSpread->SetAnimationDelay(GlobalDelay);
02621
02622
02623 pPropertiesDlg->SetLongGadgetValue(_R(IDC_ANIMTAB_DELAY), pLayer->GetFrameDelay());
02624 }
02625 }
02626 else
02627 {
02628
02629 pPropertiesDlg->SetStringGadgetValue(_R(IDC_ANIMTAB_DELAY), _R(IDS_MANY));
02630 }
02631
02632
02633 SetFrameDelayValueChanged(FALSE);
02634 }
02635
02636
02637 return TRUE;
02638 }
02639
02640
02641
02642
02643
02644
02645
02646
02647
02648
02649
02650
02651
02652
02653
02654
02655 BOOL AnimationPropertiesTab::SetGlobalDelay(Spread *pSpread, DWORD Delay)
02656 {
02657 ERROR2IF(pSpread == NULL,FALSE,"AnimationPropertiesTab::SetGlobalDelay called with NULL Spread pointer");
02658
02659
02660 Layer* pLayer = pSpread->FindFirstFrameLayer();
02661
02662 if(!pLayer)
02663 return FALSE;
02664
02665
02666 while (pLayer)
02667 {
02668
02669
02670 KernelBitmap* pKernelBitmap = pLayer->GetGeneratedBitmap();
02671
02672 if (pKernelBitmap == NULL)
02673 pKernelBitmap = pLayer->GetReferencedBitmap();
02674
02675
02676 if(pKernelBitmap != NULL)
02677 {
02678
02679 OILBitmap* pOILBitmap = pKernelBitmap->GetActualBitmap();
02680 if (pOILBitmap == NULL)
02681 return FALSE;
02682
02683
02684 pOILBitmap->SetBitmapAnimDelay(Delay);
02685 }
02686
02687
02688 pLayer->SetFrameDelay(Delay);
02689
02690
02691 pLayer = pLayer->FindNextFrameLayer();
02692 }
02693
02694 return TRUE;
02695 }
02696
02697
02698
02699
02700
02701
02702
02703
02704
02705
02706
02707
02708
02709
02710
02711
02712 BOOL AnimationPropertiesTab::GreySection()
02713 {
02714 ERROR2IF(pPropertiesDlg == NULL,FALSE,"animationPropertiesTab::GreySection called with no dialog pointer");
02715
02716 BOOL ok = pPropertiesDlg->TalkToPage(GetPageID());
02717 if (!ok)
02718 return TRUE;
02719
02720
02721 if (m_GreyStatus == TRUE)
02722 return TRUE;
02723
02724
02725 pPropertiesDlg->EnableGadget(_R(IDC_ANIMOPTS_ITERATIONS), FALSE);
02726 pPropertiesDlg->EnableGadget(_R(IDC_ANIMOPTS_LOOP), FALSE);
02727 pPropertiesDlg->EnableGadget(_R(IDC_ANIMTAB_DELAY), FALSE);
02728
02729
02730 ok = ChangeControlStatus(FALSE);
02731
02732 m_GreyStatus = TRUE;
02733 SetApplyNowState(FALSE);
02734
02735 return ok;
02736 }
02737
02738
02739
02740
02741
02742
02743
02744
02745
02746
02747
02748
02749
02750
02751 BOOL AnimationPropertiesTab::UngreySection()
02752 {
02753 ERROR2IF(pPropertiesDlg == NULL,FALSE,"animationpropertiseTab::UngreySection called with no dialog pointer");
02754
02755
02756 BOOL ok = pPropertiesDlg->TalkToPage(GetPageID());
02757 if (!ok)
02758 return TRUE;
02759
02760
02761 if (m_GreyStatus == FALSE)
02762 return TRUE;
02763
02764
02765 pPropertiesDlg->EnableGadget(_R(IDC_ANIMOPTS_ITERATIONS), TRUE);
02766 pPropertiesDlg->EnableGadget(_R(IDC_ANIMOPTS_LOOP), TRUE);
02767 pPropertiesDlg->EnableGadget(_R(IDC_ANIMTAB_DELAY), TRUE);
02768
02769
02770 ok = ChangeControlStatus(TRUE);
02771
02772
02773 m_GreyStatus = FALSE;
02774
02775 return ok;
02776 }
02777
02778
02779
02780
02781
02782
02783
02784
02785
02786
02787
02788
02789
02790
02791 BOOL AnimationPropertiesTab::ChangeControlStatus(const BOOL Status)
02792 {
02793
02794 AnimationPropertiesTab::GreyApplyNow();
02795
02796 return TRUE;
02797 }
02798
02799
02800
02801
02802
02803
02804
02805
02806
02807
02808
02809
02810
02811 BOOL AnimationPropertiesTab::UpdateSection()
02812 {
02813 ERROR2IF(pPropertiesDlg == NULL,FALSE,"animationPropertiesTab::UpdateSection called with no dialog pointer");
02814
02815 BOOL ok = pPropertiesDlg->TalkToPage(GetPageID());
02816 if (!ok)
02817 return TRUE;
02818
02819
02820 ShowDetails();
02821
02822
02823 return TRUE;
02824 }
02825
02826
02827
02828
02829
02830
02831
02832
02833
02834
02835
02836
02837
02838
02839 BOOL AnimationPropertiesTab::ShowDetails()
02840 {
02841 ERROR2IF(pPropertiesDlg == NULL,FALSE,"animationpropertiseTab::ShowDetails called with no dialog pointer");
02842
02843
02844 BOOL ok = pPropertiesDlg->TalkToPage(GetPageID());
02845 if (!ok)
02846 return TRUE;
02847
02848
02849 if (pSpread)
02850 {
02851
02852 SetIgnoreTextChangeMsg(TRUE);
02853
02854
02855 AnimPropertiesParam* pParam = &pSpread->GetSpreadAnimPropertiesParam();
02856
02857 if(pParam)
02858 {
02859
02860 if(SameflDelayValues())
02861 {
02862
02863 if(m_NoFrameLayers)
02864 {
02865
02866 Layer* pLayer = pSpread->FindFirstLayer();
02867 if (pLayer)
02868 {
02869
02870 DWORD GlobalDelay = pLayer->GetFrameDelay();
02871
02872
02873 pSpread->SetAnimationDelay(GlobalDelay);
02874
02875
02876 pPropertiesDlg->SetLongGadgetValue(_R(IDC_ANIMTAB_DELAY), pLayer->GetFrameDelay());
02877 }
02878
02879 }
02880 else
02881 {
02882
02883
02884 Layer* pLayer = pSpread->FindFirstFrameLayer();
02885 if (pLayer)
02886 {
02887 PORTNOTE("other", "Remove FrameSGallery");
02888 #ifndef EXCLUDE_FROM_XARALX
02889
02890 FrameSGallery::EnsureFrameLayerIntegrity(pSpread);
02891 #endif
02892
02893 DWORD GlobalDelay = pLayer->GetFrameDelay();
02894
02895
02896 pSpread->SetAnimationDelay(GlobalDelay);
02897
02898
02899 pPropertiesDlg->SetLongGadgetValue(_R(IDC_ANIMTAB_DELAY), pLayer->GetFrameDelay());
02900 }
02901 }
02902 }
02903 else
02904 {
02905
02906 pPropertiesDlg->SetStringGadgetValue(_R(IDC_ANIMTAB_DELAY), _R(IDS_MANY));
02907 }
02908
02909
02910 DWORD Loop = pParam->GetAnimLoop();
02911
02912
02913 if(Loop == 0)
02914 {
02915
02916 pPropertiesDlg->SetLongGadgetValue(_R(IDC_ANIMOPTS_ITERATIONS), 1);
02917 pPropertiesDlg->EnableGadget(_R(IDC_ANIMOPTS_ITERATIONS), FALSE);
02918 pPropertiesDlg->SetBoolGadgetSelected(_R(IDC_ANIMOPTS_LOOP), TRUE);
02919 }
02920 else
02921 {
02922 pPropertiesDlg->SetBoolGadgetSelected(_R(IDC_ANIMOPTS_LOOP), FALSE);
02923 pPropertiesDlg->SetLongGadgetValue(_R(IDC_ANIMOPTS_ITERATIONS), Loop);
02924 }
02925 }
02926 }
02927
02928
02929 SetIgnoreTextChangeMsg(FALSE);
02930
02931
02932 ChangeControlStatus(!m_GreyStatus);
02933
02934
02935 return TRUE;
02936 }
02937
02938
02939
02940
02941
02942
02943
02944
02945
02946
02947
02948
02949
02950
02951 BOOL AnimationPropertiesTab::UpdateLayerSection()
02952 {
02953 ERROR2IF(pPropertiesDlg == NULL,FALSE,"AnimationPropertiesTab::UpdateLayerSection() called with a NULL dialog pointer");
02954
02955 BOOL ok = pPropertiesDlg->TalkToPage(GetPageID());
02956 if (!ok)
02957 return TRUE;
02958
02959
02960 ShowDetails();
02961
02962
02963 return TRUE;
02964 }
02965
02966
02967
02968
02969
02970
02971
02972
02973
02974
02975
02976
02977
02978
02979 BOOL AnimationPropertiesTab::HandleMsg(DialogMsg* Msg)
02980 {
02981 ERROR2IF(Msg == NULL,FALSE,"AnimationPropertiesTab::Message Null message received");
02982 ERROR2IF(pPropertiesDlg == NULL,FALSE,"AnimationPropertiesTab::HandleMsg called with no dialog pointer");
02983
02984 BOOL ok = pPropertiesDlg->TalkToPage(GetPageID());
02985 if (!ok)
02986 return TRUE;
02987
02988
02989
02990 switch(Msg->DlgMsg)
02991 {
02992 case DIM_CREATE:
02993 {
02994 m_GreyStatus = FALSE;
02995 ok = InitSection();
02996
02997 AnimationPropertiesTab::GreyApplyNow();
02998 if (!ok)
02999 InformError();
03000 }
03001 break;
03002
03003 case DIM_LFT_BN_CLICKED:
03004 {
03005 if(Msg->GadgetID == _R(IDC_ANIMOPTS_LOOP))
03006 {
03007
03008 BOOL Value = pPropertiesDlg->GetBoolGadgetSelected(_R(IDC_ANIMOPTS_LOOP));
03009 if (Value)
03010 pPropertiesDlg->EnableGadget(_R(IDC_ANIMOPTS_ITERATIONS), FALSE);
03011 else
03012 pPropertiesDlg->EnableGadget(_R(IDC_ANIMOPTS_ITERATIONS), TRUE);
03013 }
03014
03015 AnimationPropertiesTab::SetApplyNowState(TRUE);
03016
03017
03018 AnimationPropertiesTab::UngreyApplyNow();
03019 }
03020 break;
03021
03022 case DIM_SELECTION_CHANGED:
03023 {
03024 if(AnimationPropertiesTab::GetApplyNowState())
03025 {
03026
03027 AnimationPropertiesTab::UngreyApplyNow();
03028 }
03029 }
03030 break;
03031
03032 case DIM_TEXT_CHANGED:
03033 {
03034
03035 if(!GetIgnoreTextChangeMsg())
03036 {
03037
03038 if(HavePropertiesChanged())
03039 {
03040
03041 AnimationPropertiesTab::SetApplyNowState(TRUE);
03042
03043
03044 AnimationPropertiesTab::UngreyApplyNow();
03045
03046
03047 SetFrameDelayValueChanged(FALSE);
03048 }
03049 }
03050 }
03051 break;
03052
03053 case DIM_SET_ACTIVE:
03054 {
03055 if(AnimationPropertiesTab::GetApplyNowState())
03056 {
03057
03058 AnimationPropertiesTab::UngreyApplyNow();
03059 }
03060 }
03061 break;
03062
03063 default:
03064 break;
03065 }
03066 return TRUE;
03067 }
03068
03069
03070
03071
03072
03073
03074
03075
03076
03077
03078
03079
03080
03081
03082
03083
03084 BOOL AnimationPropertiesTab::UpdateApplyState()
03085 {
03086 ERROR2IF(pPropertiesDlg == NULL,FALSE,"animationColoursTab::CommitSection called with a NULL dialog pointer");
03087
03088
03089
03090
03091
03092
03093
03094
03095
03096
03097
03098
03099
03100
03101
03102
03103
03104
03105
03106
03107
03108
03109
03110
03111
03112
03113 return TRUE;
03114 }
03115
03116
03117
03118
03119
03120
03121
03122
03123
03124
03125
03126
03127
03128
03129
03130 BOOL AnimationPropertiesTab::HavePropertiesChanged(BOOL ValidateDelayValue)
03131 {
03132 ERROR2IF(pPropertiesDlg == NULL,FALSE,"AnimationPropertiessTab::CommitSection called with a NULL dialog pointer");
03133
03134 BOOL ok = pPropertiesDlg->TalkToPage(GetPageID());
03135 if (!ok)
03136 return TRUE;
03137
03138
03139 UINT32 CurrentDelay = 0;
03140
03141
03142 AnimPropertiesParam* pParam = &pSpread->GetSpreadAnimPropertiesParam();
03143
03144
03145 DWORD Loop = pParam->GetAnimLoop();
03146 DWORD Delay = pParam->GetGlobalAnimDelay();
03147
03148
03149 BOOL CurrentLoop_Continously = pPropertiesDlg->GetBoolGadgetSelected(_R(IDC_ANIMOPTS_LOOP));
03150 DWORD CurrentLoop = pPropertiesDlg->GetLongGadgetValue(_R(IDC_ANIMOPTS_ITERATIONS), 0, 65535, _R(IDS_BMPPREFS_INVALIDLOOP) ,NULL);
03151
03152
03153 String_256 StrDelay = pPropertiesDlg->GetStringGadgetValue(_R(IDC_ANIMTAB_DELAY), NULL);
03154 INT32 result = camStrnicmp(StrDelay, _T("Many"), 4);
03155
03156
03157 if(result == 0)
03158 {
03159
03160 m_IsManyDisplayed = TRUE;
03161
03162
03163
03164
03165
03166
03167 pSpread->SetAnimationDelay(65536);
03168
03169
03170 CurrentDelay = Delay;
03171 }
03172 else
03173 {
03174
03175 m_IsManyDisplayed = FALSE;
03176
03177
03178 if(ValidateDelayValue)
03179 {
03180
03181 BOOL DelayValid = FALSE;
03182 CurrentDelay = pPropertiesDlg->GetLongGadgetValue(_R(IDC_ANIMTAB_DELAY), 0, 65535, _R(IDS_BMPPREFS_INVALIDDELAY) ,&DelayValid);
03183
03184
03185 if(!DelayValid)
03186 return FALSE;
03187 }
03188 else
03189 {
03190
03191 CurrentDelay = pPropertiesDlg->GetLongGadgetValue(_R(IDC_ANIMTAB_DELAY), 0, 65535, _R(IDS_BMPPREFS_INVALIDDELAY) ,NULL);
03192 }
03193 }
03194
03195
03196 if(CurrentLoop_Continously)
03197 CurrentLoop = 0;
03198
03199
03200 return ((CurrentDelay != Delay) ||
03201 (CurrentLoop != Loop));
03202 }
03203
03204
03205
03206
03207
03208
03209
03210
03211
03212
03213
03214
03215
03216
03217 BOOL AnimationPropertiesTab::InitSection()
03218 {
03219 ERROR2IF(pPropertiesDlg == NULL,FALSE,"AnimationPropertiesTab::InitSection called with no dialog pointer");
03220
03221
03222 Document* pDoc = Document::GetCurrent();
03223
03224
03225 if(!pDoc)
03226 {
03227 GreySection();
03228 return (TRUE);
03229 }
03230
03231 ShowDetails();
03232
03233 return TRUE;
03234 }
03235
03236
03237
03238
03239
03240
03241
03242
03243
03244
03245
03246
03247
03248
03249
03250
03251
03252
03253
03254
03255
03256
03257
03258
03259
03260
03261
03262
03263 FramePropertiesTab::FramePropertiesTab()
03264 {
03265
03266 }
03267
03268
03269
03270
03271
03272
03273
03274
03275
03276
03277
03278
03279
03280
03281 FramePropertiesTab::~FramePropertiesTab()
03282 {
03283 }
03284
03285
03286
03287
03288
03289
03290
03291
03292
03293
03294
03295
03296
03297
03298 BOOL FramePropertiesTab::Init()
03299 {
03300 return TRUE;
03301 }
03302
03303
03304
03305
03306
03307
03308
03309
03310
03311
03312
03313
03314
03315
03316 CDlgResID FramePropertiesTab::GetPageID()
03317 {
03318 return _R(IDD_TAB_FRAME_PROPERTIES);
03319 }
03320
03321
03322
03323
03324
03325
03326
03327
03328
03329
03330
03331
03332 BOOL FramePropertiesTab::IsPropertyRequired()
03333 {
03334
03335
03336 if (!GetIncludeFramePropertiesTab() || GetBrowserPreviewTab())
03337 return FALSE;
03338 else
03339 return TRUE;
03340 }
03341
03342
03343
03344
03345
03346
03347
03348
03349
03350
03351
03352
03353
03354
03355
03356
03357 BOOL FramePropertiesTab::CommitSection()
03358 {
03359 ERROR2IF(pPropertiesDlg == NULL,FALSE,"FramePropertiesTab::CommitSection called with no dialog pointer");
03360
03361 BOOL ok = pPropertiesDlg->TalkToPage(GetPageID());
03362 if (!ok)
03363 return TRUE;
03364
03365
03366 Layer* pLayer = pSpread->FindActiveLayer();
03367
03368
03369 if (pLayer != NULL && HavePropertiesChanged(pLayer, TRUE))
03370 {
03371 DWORD Delay = 0;
03372 String_256 FrameLayerName;
03373 UINT32 AreDelayValuesSame = FALSE;
03374
03375
03376 FrameLayerName = pPropertiesDlg->GetStringGadgetValue(_R(IDC_FRAMETAB_NAME),NULL);
03377 BOOL DelayValid = FALSE;
03378 Delay = pPropertiesDlg->GetLongGadgetValue(_R(IDC_FRAMETAB_DELAY), 0, 65535, _R(IDS_BMPPREFS_INVALIDDELAY) ,&DelayValid);
03379
03380
03381 if(!DelayValid)
03382 return FALSE;
03383
03384
03385 BOOL Overlay = pPropertiesDlg->GetBoolGadgetSelected(_R(IDC_FRAMETAB_OVERLAY));
03386 BOOL Solid = pPropertiesDlg->GetBoolGadgetSelected(_R(IDC_FRAMETAB_SOLID));
03387
03388
03389
03390 if(Solid && Overlay)
03391 Overlay = FALSE;
03392
03393
03394 BOOL IsHidden = pPropertiesDlg->GetBoolGadgetSelected(_R(IDC_FRAMETAB_SHOWFRAME));
03395
03396
03397 if(IsHidden)
03398 pLayer->SetHiddenFrame(FALSE);
03399 else
03400 pLayer->SetHiddenFrame(TRUE);
03401
03402
03403
03404 if (pLayer->IsSolid() != Solid)
03405 {
03406
03407
03408 Layer * pFrame = pLayer->FindNextFrameLayer();
03409 while (pFrame != NULL && !pFrame->IsSolid())
03410 {
03411
03412 pFrame->SetEdited(TRUE);
03413 pFrame = pFrame->FindNextFrameLayer();
03414 }
03415 }
03416
03417
03418 pLayer->SetSolid(Solid);
03419 pLayer->SetOverlay(Overlay);
03420 pLayer->SetFrameDelay(Delay);
03421 pLayer->SetLayerID(FrameLayerName);
03422
03423
03424
03425 Document* pDoc = Document::GetCurrent();
03426
03427
03428 if(pDoc)
03429 pDoc->SetModified(TRUE);
03430
03431
03432 pLayer->SetEdited(TRUE);
03433
03434 #ifdef _DEBUG
03435
03436 BROADCAST_TO_ALL(LayerMsg(pLayer, LayerMsg::REDRAW_LAYER));
03437 #endif
03438
03439
03440
03441
03442 KernelBitmap* pKernelBitmap = pLayer->GetGeneratedBitmap();
03443
03444 if (pKernelBitmap == NULL)
03445 pKernelBitmap = pLayer->GetReferencedBitmap();
03446
03447
03448 if(pKernelBitmap == NULL)
03449 {
03450
03451 if(!SameflDelayValues())
03452 BROADCAST_TO_ALL(LayerMsg(pLayer, LayerMsg::UPDATE_ACTIVE_LAYER));
03453 else
03454 AreDelayValuesSame = TRUE;
03455
03456
03457
03458 if(AreDelayValuesSame && m_IsManyDisplayed)
03459 BROADCAST_TO_ALL(LayerMsg(pLayer, LayerMsg::UPDATE_ACTIVE_LAYER));
03460
03461
03462 BROADCAST_TO_ALL(LayerMsg(pLayer, LayerMsg::REDRAW_LAYER));
03463
03464 return TRUE;
03465 }
03466
03467
03468 OILBitmap* pOILBitmap = pKernelBitmap->GetActualBitmap();
03469 if (pOILBitmap == NULL)
03470 {
03471
03472
03473 if(!SameflDelayValues())
03474 BROADCAST_TO_ALL(LayerMsg(pLayer, LayerMsg::UPDATE_ACTIVE_LAYER));
03475 else
03476 AreDelayValuesSame = TRUE;
03477
03478
03479
03480 if(AreDelayValuesSame && m_IsManyDisplayed)
03481 BROADCAST_TO_ALL(LayerMsg(pLayer, LayerMsg::UPDATE_ACTIVE_LAYER));
03482
03483
03484 BROADCAST_TO_ALL(LayerMsg(pLayer, LayerMsg::REDRAW_LAYER));
03485
03486 return TRUE;
03487 }
03488
03489
03490 pOILBitmap->SetBitmapAnimDelay(Delay);
03491
03492
03493 pOILBitmap->SetName(FrameLayerName);
03494
03495 PORTNOTE("other", "Disabled OpGrabFrame")
03496 #ifndef EXCLUDE_FROM_XARALX
03497 if (PreviewDialog::GetPreviewDialog())
03498 {
03499 OpDescriptor* pOpDesc = OpDescriptor::FindOpDescriptor(OPTOKEN_FRAME_GRABFRAME);
03500 GIFAnimationExportParam Param;
03501 if (pOpDesc != NULL)
03502 pOpDesc->Invoke(&Param);
03503 else
03504 {
03505 ERROR3("Couldn't find OPTOKEN_FRAME_GRABALLFRAMES op descriptor");
03506 }
03507 }
03508 #endif
03509
03510
03511 if(!SameflDelayValues())
03512 BROADCAST_TO_ALL(LayerMsg(pLayer, LayerMsg::UPDATE_ACTIVE_LAYER));
03513 else
03514 AreDelayValuesSame = TRUE;
03515
03516
03517
03518 if(AreDelayValuesSame && m_IsManyDisplayed)
03519 BROADCAST_TO_ALL(LayerMsg(pLayer, LayerMsg::UPDATE_ACTIVE_LAYER));
03520 }
03521
03522
03523 BROADCAST_TO_ALL(LayerMsg(pLayer, LayerMsg::REDRAW_LAYER));
03524
03525
03526 return TRUE;
03527 }
03528
03529
03530
03531
03532
03533
03534
03535
03536
03537
03538
03539
03540
03541
03542 BOOL FramePropertiesTab::GreySection()
03543 {
03544 ERROR2IF(pPropertiesDlg == NULL,FALSE,"FramePropertiesTab::GreySection called with no dialog pointer");
03545
03546 BOOL ok = pPropertiesDlg->TalkToPage(GetPageID());
03547 if (!ok)
03548 return TRUE;
03549
03550
03551 if (m_GreyStatus == TRUE)
03552 return TRUE;
03553
03554
03555 pPropertiesDlg->EnableGadget(_R(IDC_FRAMETAB_DELAY),FALSE);
03556 pPropertiesDlg->EnableGadget(_R(IDC_FRAMETAB_SHOWFRAME),FALSE);
03557
03558
03559 ok = ChangeControlStatus(FALSE);
03560
03561
03562 m_GreyStatus = TRUE;
03563 SetApplyNowState(FALSE);
03564
03565 return ok;
03566 }
03567
03568
03569
03570
03571
03572
03573
03574
03575
03576
03577
03578
03579
03580
03581 BOOL FramePropertiesTab::UngreySection()
03582 {
03583 ERROR2IF(pPropertiesDlg == NULL,FALSE,"FramePropertiesTab::UngreySection called with no dialog pointer");
03584
03585 BOOL ok = pPropertiesDlg->TalkToPage(GetPageID());
03586 if (!ok)
03587 return TRUE;
03588
03589
03590 if (m_GreyStatus == FALSE)
03591 return TRUE;
03592
03593
03594 pPropertiesDlg->EnableGadget(_R(IDC_FRAMETAB_SHOWFRAME),TRUE);
03595 pPropertiesDlg->EnableGadget(_R(IDC_FRAMETAB_NAME),TRUE);
03596 pPropertiesDlg->EnableGadget(_R(IDC_FRAMETAB_SOLID),TRUE);
03597 pPropertiesDlg->EnableGadget(_R(IDC_FRAMETAB_DELAY),TRUE);
03598 pPropertiesDlg->EnableGadget(_R(IDC_FRAMETAB_SHOWFRAME),TRUE);
03599
03600
03601 m_GreyStatus = FALSE;
03602
03603 return ok;
03604 }
03605
03606
03607
03608
03609
03610
03611
03612
03613
03614
03615
03616
03617
03618
03619
03620 BOOL FramePropertiesTab::ChangeControlStatus(const BOOL Status, BOOL IgnoreOverlay)
03621 {
03622
03623 pPropertiesDlg->EnableGadget(_R(IDC_FRAMETAB_NAME),Status);
03624 pPropertiesDlg->EnableGadget(_R(IDC_FRAMETAB_SOLID),Status);
03625
03626
03627
03628 if(!IgnoreOverlay)
03629 pPropertiesDlg->EnableGadget(_R(IDC_FRAMETAB_OVERLAY),Status);
03630
03631
03632
03633 if(pSpread)
03634 {
03635
03636 Layer* pLayer = pSpread->FindActiveLayer();
03637
03638
03639 if(pLayer)
03640 {
03641
03642 if(HavePropertiesChanged(pLayer))
03643 {
03644
03645 FramePropertiesTab::UngreyApplyNow();
03646 }
03647
03648
03649
03650 }
03651 }
03652 else
03653 {
03654
03655 FramePropertiesTab::GreyApplyNow();
03656 }
03657
03658
03659 return TRUE;
03660 }
03661
03662
03663
03664
03665
03666
03667
03668
03669
03670
03671
03672
03673
03674 BOOL FramePropertiesTab::UpdateSection()
03675 {
03676 ERROR2IF(pPropertiesDlg == NULL,FALSE,"FramePropertiesTab::UpdateSection called with no dialog pointer");
03677
03678
03679 BOOL ok = pPropertiesDlg->TalkToPage(GetPageID());
03680 if (!ok)
03681 return TRUE;
03682
03683
03684 ShowDetails();
03685
03686
03687 return TRUE;
03688 }
03689
03690
03691
03692
03693
03694
03695
03696
03697
03698
03699
03700
03701
03702
03703 BOOL FramePropertiesTab::ShowDetails()
03704 {
03705 ERROR2IF(pPropertiesDlg == NULL,FALSE,"FramePropertiseTab::ShowDetails called with a NULL dialog pointer");
03706
03707 BOOL ok = pPropertiesDlg->TalkToPage(GetPageID());
03708 if (!ok)
03709 return TRUE;
03710
03711
03712 if(!pSpread)
03713 return FALSE;
03714
03715
03716 Layer* pLayer = pSpread->FindActiveLayer();
03717
03718
03719 if(!pLayer)
03720 return FALSE;
03721
03722
03723 SetIgnoreTextChangeMsg(TRUE);
03724
03725
03726
03727 pPropertiesDlg->SetStringGadgetValue(_R(IDC_FRAMETAB_NAME), pLayer->GetLayerID());
03728
03729
03730 pPropertiesDlg->SetBoolGadgetSelected(_R(IDC_FRAMETAB_SOLID), pLayer->IsSolid());
03731
03732
03733 BOOL BackGroundSelected = FALSE;
03734 if(pLayer->IsSolid())
03735 BackGroundSelected = TRUE;
03736
03737
03738 if(BackGroundSelected)
03739 {
03740
03741 pPropertiesDlg->EnableGadget(_R(IDC_FRAMETAB_OVERLAY), FALSE);
03742 }
03743 else
03744 {
03745
03746 pPropertiesDlg->SetBoolGadgetSelected(_R(IDC_FRAMETAB_OVERLAY), pLayer->IsOverlay());
03747 }
03748
03749
03750 pPropertiesDlg->SetLongGadgetValue(_R(IDC_FRAMETAB_DELAY), pLayer->GetFrameDelay());
03751
03752
03753 BOOL IsHidden = pLayer->IsHiddenFrame();
03754
03755
03756 if(!IsHidden)
03757 {
03758
03759 pPropertiesDlg->EnableGadget(_R(IDC_FRAMETAB_DELAY), TRUE);
03760
03761
03762 pPropertiesDlg->SetBoolGadgetSelected(_R(IDC_FRAMETAB_SHOWFRAME), TRUE);
03763 }
03764 else
03765 {
03766
03767
03768 pPropertiesDlg->SetBoolGadgetSelected(_R(IDC_FRAMETAB_SHOWFRAME), FALSE);
03769
03770
03771 pPropertiesDlg->EnableGadget(_R(IDC_FRAMETAB_DELAY), FALSE);
03772 }
03773
03774
03775
03776
03777 if(BackGroundSelected)
03778 ChangeControlStatus(!m_GreyStatus, TRUE);
03779 else
03780 ChangeControlStatus(!m_GreyStatus);
03781
03782
03783 SetIgnoreTextChangeMsg(FALSE);
03784
03785
03786 return TRUE;
03787 }
03788
03789
03790
03791
03792
03793
03794
03795
03796
03797
03798
03799
03800
03801
03802 BOOL FramePropertiesTab::UpdateLayerSection()
03803 {
03804 ERROR2IF(pPropertiesDlg == NULL,FALSE,"FramePropertiesTab::UpdateLayerSection() called with a NULL dialog pointer");
03805
03806 BOOL ok = pPropertiesDlg->TalkToPage(GetPageID());
03807 if (!ok)
03808 return TRUE;
03809
03810
03811
03812 if(m_FrameGalleryOpen && !m_ChangeLayerState)
03813 ShowDetails();
03814
03815
03816
03817
03818 if(m_ChangeLayerState)
03819 ChangeLayerState();
03820
03821
03822 return TRUE;
03823 }
03824
03825
03826
03827
03828
03829
03830
03831
03832
03833
03834
03835
03836
03837
03838 BOOL FramePropertiesTab::ChangeLayerState()
03839 {
03840 ERROR2IF(pPropertiesDlg == NULL,FALSE,"FramePropertiesTab::UpdateLayerSection() called with a NULL dialog pointer");
03841
03842 BOOL ok = pPropertiesDlg->TalkToPage(GetPageID());
03843 if (!ok)
03844 return TRUE;
03845
03846
03847 if(!pSpread)
03848 return FALSE;
03849
03850
03851 Layer* pLayer = pSpread->FindActiveLayer();
03852
03853
03854 if(!pLayer)
03855 return FALSE;
03856
03857
03858
03859
03860 if(pLayer->IsSolid())
03861 {
03862
03863
03864 pPropertiesDlg->SetBoolGadgetSelected(_R(IDC_FRAMETAB_SOLID), TRUE);
03865
03866
03867 pPropertiesDlg->EnableGadget(_R(IDC_FRAMETAB_OVERLAY), FALSE);
03868 }
03869 else
03870 {
03871
03872 pPropertiesDlg->SetBoolGadgetSelected(_R(IDC_FRAMETAB_SOLID), FALSE);
03873
03874
03875 pPropertiesDlg->EnableGadget(_R(IDC_FRAMETAB_OVERLAY), TRUE);
03876
03877 }
03878
03879
03880 if(pLayer->IsOverlay())
03881 {
03882
03883 pPropertiesDlg->EnableGadget(_R(IDC_FRAMETAB_SOLID), TRUE);
03884
03885
03886 pPropertiesDlg->SetBoolGadgetSelected(_R(IDC_FRAMETAB_OVERLAY), TRUE);
03887 }
03888 else
03889 {
03890
03891 pPropertiesDlg->SetBoolGadgetSelected(_R(IDC_FRAMETAB_OVERLAY), FALSE);
03892 }
03893
03894
03895 FramePropertiesTab::SetApplyNowState(TRUE);
03896
03897
03898 FramePropertiesTab::UngreyApplyNow();
03899
03900
03901 return TRUE;
03902 }
03903
03904
03905
03906
03907
03908
03909
03910
03911
03912
03913
03914
03915
03916
03917
03918 BOOL FramePropertiesTab::HandleMsg(DialogMsg* Msg)
03919 {
03920 ERROR2IF(Msg == NULL,FALSE,"FramePropertiesTab::Message null message received");
03921 ERROR2IF(pPropertiesDlg == NULL,FALSE,"FramePropertiesTab::HandleMsg called with no dialog pointer");
03922
03923
03924 BOOL ok = pPropertiesDlg->TalkToPage(GetPageID());
03925 if (!ok)
03926 return TRUE;
03927
03928 switch(Msg->DlgMsg)
03929 {
03930 case DIM_CREATE:
03931 m_GreyStatus = FALSE;
03932 ok = InitSection();
03933 if (!ok)
03934 InformError();
03935 break;
03936
03937 case DIM_LFT_BN_CLICKED:
03938 {
03939 if (FALSE) {}
03940 else if (Msg->GadgetID ==_R(IDC_FRAMETAB_SOLID))
03941 {
03942
03943 BOOL Value = pPropertiesDlg->GetBoolGadgetSelected(_R(IDC_FRAMETAB_SOLID));
03944 if (Value)
03945 {
03946
03947 pPropertiesDlg->EnableGadget(_R(IDC_FRAMETAB_OVERLAY), FALSE);
03948 }
03949 else
03950 {
03951
03952 pPropertiesDlg->EnableGadget(_R(IDC_FRAMETAB_OVERLAY), TRUE);
03953 }
03954 }
03955 else if (Msg->GadgetID == _R(IDC_FRAMETAB_SHOWFRAME))
03956 {
03957
03958 BOOL Value = pPropertiesDlg->GetBoolGadgetSelected(_R(IDC_FRAMETAB_SHOWFRAME));
03959
03960
03961 Layer* pLayer = pSpread->FindActiveLayer();
03962
03963
03964 if( pLayer)
03965 {
03966
03967 if(Value)
03968 {
03969
03970 pPropertiesDlg->EnableGadget(_R(IDC_FRAMETAB_DELAY), TRUE);
03971
03972
03973
03974
03975 }
03976 else
03977 {
03978
03979 pPropertiesDlg->EnableGadget(_R(IDC_FRAMETAB_DELAY), FALSE);
03980
03981
03982
03983
03984 }
03985
03986
03987
03988 BROADCAST_TO_ALL(LayerMsg(pLayer, LayerMsg::REDRAW_LAYER));
03989 }
03990 }
03991
03992
03993 FramePropertiesTab::SetApplyNowState(TRUE);
03994
03995
03996 FramePropertiesTab::UngreyApplyNow();
03997
03998 }
03999 break;
04000
04001 case DIM_SELECTION_CHANGED:
04002 {
04003 if(FramePropertiesTab::GetApplyNowState())
04004 {
04005
04006 FramePropertiesTab::UngreyApplyNow();
04007 }
04008 }
04009 break;
04010
04011 case DIM_TEXT_CHANGED:
04012 {
04013
04014 if(!GetIgnoreTextChangeMsg())
04015 {
04016
04017 Layer* pLayer = pSpread->FindActiveLayer();
04018
04019
04020 if (pLayer)
04021 {
04022
04023 if(HavePropertiesChanged(pLayer))
04024 {
04025
04026 FramePropertiesTab::SetApplyNowState(TRUE);
04027
04028
04029 FramePropertiesTab::UngreyApplyNow();
04030 }
04031 }
04032
04033
04034
04035
04036 SetFrameDelayValueChanged(TRUE);
04037 }
04038 }
04039 break;
04040
04041 case DIM_SET_ACTIVE:
04042 {
04043 if(FramePropertiesTab::GetApplyNowState())
04044 {
04045
04046 FramePropertiesTab::UngreyApplyNow();
04047 }
04048 }
04049 break;
04050
04051 default:
04052 break;
04053 }
04054 return TRUE;
04055 }
04056
04057
04058
04059
04060
04061
04062
04063
04064
04065
04066
04067
04068
04069
04070
04071
04072 BOOL FramePropertiesTab::UpdateApplyState()
04073 {
04074
04075
04076
04077
04078
04079
04080
04081
04082
04083
04084
04085
04086
04087
04088
04089
04090
04091
04092
04093
04094
04095
04096
04097
04098
04099
04100 return TRUE;
04101 }
04102
04103
04104
04105
04106
04107
04108
04109
04110
04111
04112
04113
04114
04115
04116
04117 BOOL FramePropertiesTab::HavePropertiesChanged(Layer* pLayer, BOOL ValidateDelayValue)
04118 {
04119 ERROR2IF(pPropertiesDlg == NULL,FALSE,"FramePropertiesTab::HavePropertiesChanged called with a NULL dialog pointer");
04120
04121 BOOL ok = pPropertiesDlg->TalkToPage(GetPageID());
04122 if (!ok)
04123 return TRUE;
04124
04125
04126 BOOL CurBackground = pPropertiesDlg->GetBoolGadgetSelected(_R(IDC_FRAMETAB_SOLID));
04127 BOOL CurOverlay = pPropertiesDlg->GetBoolGadgetSelected(_R(IDC_FRAMETAB_OVERLAY));
04128 String_256 CurName = pPropertiesDlg->GetStringGadgetValue(_R(IDC_FRAMETAB_NAME),NULL);
04129 BOOL CurIsHidden = pPropertiesDlg->GetBoolGadgetSelected(_R(IDC_FRAMETAB_SHOWFRAME));
04130 DWORD CurDelay = 0;
04131
04132
04133 if(ValidateDelayValue)
04134 {
04135 BOOL DelayValid = FALSE;
04136 CurDelay = pPropertiesDlg->GetLongGadgetValue(_R(IDC_FRAMETAB_DELAY), 0, 65535, _R(IDS_BMPPREFS_INVALIDDELAY) ,&DelayValid);
04137
04138
04139 if(!DelayValid)
04140 return FALSE;
04141 }
04142 else
04143 {
04144 CurDelay = pPropertiesDlg->GetLongGadgetValue(_R(IDC_FRAMETAB_DELAY), 0, 65535, _R(IDS_BMPPREFS_INVALIDDELAY) ,NULL);
04145 }
04146
04147
04148 if(CurIsHidden)
04149 CurIsHidden = FALSE;
04150 else
04151 CurIsHidden = TRUE;
04152
04153
04154
04155 if(CurBackground && CurOverlay)
04156 CurOverlay = FALSE;
04157
04158
04159 BOOL Background = pLayer->IsSolid();
04160 BOOL Overlay = pLayer->IsOverlay();
04161 String_256 Name = pLayer->GetLayerID();
04162 DWORD Delay = pLayer->GetFrameDelay();
04163 BOOL IsHidden = pLayer->IsHiddenFrame();
04164
04165
04166 return ((Background != CurBackground) ||
04167 (Overlay != CurOverlay) ||
04168 (Name != CurName) ||
04169 (Delay != CurDelay) ||
04170 (IsHidden != CurIsHidden ));
04171 }
04172
04173
04174
04175
04176
04177
04178
04179
04180
04181
04182
04183
04184
04185
04186 BOOL FramePropertiesTab::InitSection()
04187 {
04188 ERROR2IF(pPropertiesDlg == NULL,FALSE,"FramePropertiesTab::InitSection called with no dialog pointer");
04189
04190
04191 Document* pDoc = Document::GetCurrent();
04192
04193
04194 if(!pDoc)
04195 {
04196 GreySection();
04197 return (TRUE);
04198 }
04199
04200
04201 ShowDetails();
04202
04203 return TRUE;
04204 }
04205
04206
04207
04208
04209
04210
04211
04212
04213
04214
04215
04216
04217
04218
04219
04220
04221
04222
04223
04224
04225
04226
04227
04228
04229
04230
04231 BOOL AnimExOptns::Init()
04232 {
04233 BOOL InitOK;
04234
04235
04236 InitOK = RegisterOpDescriptor(
04237 0,
04238 _R(IDS_ANIMATION_TAB_DLG),
04239 CC_RUNTIME_CLASS(AnimExOptns),
04240 OPTOKEN_EXPORTGIFANIMTABSDLG,
04241 GetState,
04242 0,
04243 0,
04244 0,
04245 0,
04246 SYSTEMBAR_ILLEGAL,
04247 TRUE,
04248 FALSE,
04249 TRUE,
04250 0,
04251 _R(IDS_ANIMATION_TAB_DLG_ONE),
04252 (DONT_GREY_WHEN_SELECT_INSIDE | GREY_WHEN_NO_CURRENT_DOC)
04253 );
04254 return (InitOK);
04255 }
04256
04257
04258
04259
04260
04261
04262
04263
04264
04265
04266
04267
04268
04269
04270
04271
04272 AnimExOptns::AnimExOptns():GIFAnimationPropertyTabsDlg(AnimExOptns::IDD, AnimExOptns::Mode)
04273 {
04274
04275 }
04276
04277
04278
04279
04280
04281
04282
04283
04284
04285
04286
04287
04288
04289
04290
04291 AnimExOptns::~AnimExOptns()
04292 {
04293
04294
04295
04296
04297 if(m_pGIFAnimationProperties)
04298 {
04299
04300 m_pGIFAnimationProperties->SetIncludeFramePropertiesTab(TRUE);
04301 m_pGIFAnimationProperties->SetBrowserPreviewTab(FALSE);
04302 }
04303 }
04304
04305
04306
04307
04308
04309
04310
04311
04312
04313
04314
04315
04316
04317
04318 void AnimExOptns::Do( OpDescriptor * pOpDesc )
04319 {
04320
04321
04322 if (m_pGIFAnimationProperties == NULL)
04323 {
04324
04325 ERROR3("GIFAnimationPropertyTabsDlg::Do no AnimationProperties present");
04326 End();
04327 }
04328
04329
04330 String_256 Temp(_R(IDS_ANIMATION_EXPORT_OPTIONS));
04331 TitleString = Temp;
04332 SetName(&TitleString);
04333
04334
04335 GIFAnimationPropertyTabs::SetTabbedDlg(this);
04336
04337
04338 m_pGIFAnimationProperties->SetApplyNowState(FALSE);
04339
04340
04341 m_pGIFAnimationProperties->SetOkState(TRUE);
04342
04343
04344 Create();
04345 };
04346
04347
04348
04349
04350
04351
04352
04353
04354
04355
04356
04357
04358
04359
04360
04361 MsgResult AnimExOptns::Message(Msg* Message)
04362 {
04363 ERROR3IF(Message == NULL,"AnimExOptns::Message NULL message received");
04364
04365 if (IS_OUR_DIALOG_MSG(Message))
04366 {
04367 DialogMsg* Msg = (DialogMsg*)Message;
04368
04369 MsgResult Result;
04370
04371
04372 BOOL EndDialog = FALSE;
04373 BOOL CommitValues = FALSE;
04374 m_pGIFAnimationProperties->GetApplyNowState();
04375
04376
04377 Document *pDocument = Document::GetSelected();
04378 m_pGIFAnimationProperties->SetCurrentDocAndSpread(pDocument);
04379
04380
04381 m_pGIFAnimationProperties->SetUpDocUnits();
04382
04383
04384
04385 if (Msg->DlgMsg == DIM_CREATE)
04386 m_pGIFAnimationProperties->SetInitMessageState(TRUE);
04387
04388
04389 BOOL FoundPage = FALSE;
04390
04391 if (Msg->PageID != 0)
04392 {
04393
04394 GIFAnimationPropertyTabs *pGIFAnimationPropertyTabs = GIFAnimationPropertyTabs::GetFirst();
04395
04396 while (pGIFAnimationPropertyTabs != NULL&& !FoundPage)
04397 {
04398 CDlgResID PageId = pGIFAnimationPropertyTabs->GetPageID();
04399 if (PageId == Msg->PageID)
04400 {
04401
04402 pGIFAnimationPropertyTabs->HandleMsg(Msg);
04403 FoundPage = TRUE;
04404 }
04405
04406 pGIFAnimationPropertyTabs = GIFAnimationPropertyTabs::GetNext(pGIFAnimationPropertyTabs);
04407 }
04408 }
04409 else
04410 {
04411
04412 switch (Msg->DlgMsg)
04413 {
04414 case DIM_COMMIT:
04415 EndDialog = TRUE;
04416 CommitValues = TRUE;
04417 break;
04418
04419 case DIM_SOFT_COMMIT:
04420 {
04421 CommitValues = TRUE;
04422 m_pGIFAnimationProperties->SetApplyNowState(TRUE);
04423 }
04424 break;
04425
04426 case DIM_CANCEL:
04427 EndDialog = TRUE;
04428 break;
04429
04430 default:
04431 break;
04432 }
04433 }
04434
04435
04436 if (CommitValues)
04437 {
04438 BOOL ok = CommitDialogValues();
04439 if (!ok)
04440 {
04441 EndDialog = FALSE;
04442 }
04443 }
04444
04445
04446 Result = DialogTabOp::Message(Message);
04447
04448
04449 if (EndDialog)
04450 {
04451 Close();
04452 End();
04453
04454
04455 if(m_pGIFAnimationProperties->GetCount() < 1)
04456 {
04457
04458 m_pGIFAnimationProperties->SetTabbedDlg(NULL);
04459 }
04460 }
04461
04462
04463 if (Msg->DlgMsg == DIM_CREATE)
04464 m_pGIFAnimationProperties->SetInitMessageState(FALSE);
04465
04466
04467 return Result;
04468 }
04469 else
04470 {
04471
04472 return GIFAnimationPropertyTabsDlg::Message(Message);
04473 }
04474 }
04475
04476
04477
04478
04479
04480
04481
04482
04483
04484
04485
04486
04487
04488
04489
04490
04491
04492
04493
04494
04495
04496
04497
04498
04499
04500
04501
04502
04503
04504
04505
04506
04507
04508
04509
04510
04511
04512
04513
04514
04515
04516 PreviewInBrowserTab::PreviewInBrowserTab()
04517 {
04518
04519 }
04520
04521
04522
04523
04524
04525
04526
04527
04528
04529
04530
04531
04532
04533
04534
04535 PreviewInBrowserTab::~PreviewInBrowserTab()
04536 {
04537 }
04538
04539
04540
04541
04542
04543
04544
04545
04546
04547
04548
04549
04550
04551
04552 BOOL PreviewInBrowserTab::Init()
04553 {
04554 return TRUE;
04555 }
04556
04557
04558
04559
04560
04561
04562
04563
04564
04565
04566
04567
04568
04569 CDlgResID PreviewInBrowserTab::GetPageID()
04570 {
04571 return _R(IDD_TAB_PREVIEW_IN_BROWSER);
04572 }
04573
04574
04575
04576
04577
04578
04579
04580
04581
04582
04583
04584 BOOL PreviewInBrowserTab::IsPropertyRequired()
04585 {
04586 return TRUE;
04587 }
04588
04589
04590
04591
04592
04593
04594
04595
04596
04597
04598
04599
04600
04601
04602
04603
04604 BOOL PreviewInBrowserTab::CommitSection()
04605 {
04606 ERROR2IF(pPropertiesDlg == NULL,FALSE,"PreviewInBrowserTab::CommitSection called with a NULL dialog pointer");
04607
04608 BOOL ok = pPropertiesDlg->TalkToPage(GetPageID());
04609 if (!ok)
04610 return TRUE;
04611
04612
04613 if (HavePropertiesChanged())
04614 {
04615
04616 BrowserBackground Bgr = BROWSER_BGR_NONE;
04617
04618 if(pPropertiesDlg->GetBoolGadgetSelected(_R(IDC_PLAINBKGND)))
04619 Bgr = BROWSER_BGR_NONE;
04620
04621 else if (pPropertiesDlg->GetBoolGadgetSelected(_R(IDC_DOCBKGND)))
04622 Bgr = BROWSER_BGR_DOC;
04623
04624 else if (pPropertiesDlg->GetBoolGadgetSelected(_R(IDC_CHQBKGND)))
04625 Bgr = BROWSER_BGR_CHECKER;
04626
04627 BOOL Info = pPropertiesDlg->GetBoolGadgetSelected(_R(IDC_HTMLSTUB));
04628
04629
04630 g_Background = Bgr;
04631 g_InfoInHtmlStub =Info;
04632 }
04633
04634
04635 return TRUE;
04636 }
04637
04638
04639
04640
04641
04642
04643
04644
04645
04646
04647
04648
04649
04650
04651 BOOL PreviewInBrowserTab::HavePropertiesChanged()
04652 {
04653 ERROR2IF(pPropertiesDlg == NULL,FALSE,"PreviewInBrowserTab::HavePropertiesChanged called with a NULL dialog pointer");
04654
04655 BOOL ok = pPropertiesDlg->TalkToPage(GetPageID());
04656 if (!ok)
04657 return TRUE;
04658
04659
04660 BrowserBackground Bgr = BROWSER_BGR_NONE;
04661
04662 if(pPropertiesDlg->GetBoolGadgetSelected(_R(IDC_PLAINBKGND)))
04663 Bgr = BROWSER_BGR_NONE;
04664
04665 else if (pPropertiesDlg->GetBoolGadgetSelected(_R(IDC_DOCBKGND)))
04666 Bgr = BROWSER_BGR_DOC;
04667
04668 else if (pPropertiesDlg->GetBoolGadgetSelected(_R(IDC_CHQBKGND)))
04669 Bgr = BROWSER_BGR_CHECKER;
04670
04671 BOOL Info = pPropertiesDlg->GetBoolGadgetSelected(_R(IDC_HTMLSTUB));
04672
04673
04674 return
04675 (( Bgr != g_Background) ||
04676 ( Info != g_InfoInHtmlStub));
04677 }
04678
04679
04680
04681
04682
04683
04684
04685
04686
04687
04688
04689
04690
04691
04692 BOOL PreviewInBrowserTab::GreySection()
04693 {
04694 ERROR2IF(pPropertiesDlg == NULL,FALSE,"PreviewInBrowserTab::GreySection called with no dialog pointer");
04695
04696
04697 BOOL ok = pPropertiesDlg->TalkToPage(GetPageID());
04698 if (!ok)
04699 return TRUE;
04700
04701
04702 if (m_GreyStatus == TRUE)
04703 return TRUE;
04704
04705
04706 ok = ChangeControlStatus(FALSE);
04707
04708
04709 m_GreyStatus = TRUE;
04710 SetApplyNowState(FALSE);
04711
04712 return ok;
04713 }
04714
04715
04716
04717
04718
04719
04720
04721
04722
04723
04724
04725
04726
04727
04728 BOOL PreviewInBrowserTab::UngreySection()
04729 {
04730 ERROR2IF(pPropertiesDlg == NULL,FALSE,"PreviewInBrowserTab::UngreySection called with a NULL dialog pointer");
04731
04732
04733 BOOL ok = pPropertiesDlg->TalkToPage(GetPageID());
04734 if (!ok)
04735 return TRUE;
04736
04737
04738 if (m_GreyStatus == FALSE)
04739 return TRUE;
04740
04741
04742 ok = ChangeControlStatus(TRUE);
04743
04744 m_GreyStatus = FALSE;
04745
04746 return ok;
04747 }
04748
04749
04750
04751
04752
04753
04754
04755
04756
04757
04758
04759
04760
04761
04762
04763 BOOL PreviewInBrowserTab::ChangeControlStatus(const BOOL Status)
04764 {
04765 pPropertiesDlg->EnableGadget(_R(IDC_PLAINBKGND), Status);
04766 pPropertiesDlg->EnableGadget(_R(IDC_DOCBKGND), Status);
04767 pPropertiesDlg->EnableGadget(_R(IDC_CHQBKGND), Status);
04768 pPropertiesDlg->EnableGadget(_R(IDC_GIF_BITMAPPREVIEW), Status);
04769 pPropertiesDlg->EnableGadget(_R(IDC_HTMLSTUB), Status);
04770
04771
04772
04773 PreviewInBrowserTab::GreyApplyNow();
04774 return TRUE;
04775 }
04776
04777
04778
04779
04780
04781
04782
04783
04784
04785
04786
04787
04788
04789
04790 BOOL PreviewInBrowserTab::UpdateSection()
04791 {
04792 ERROR2IF(pPropertiesDlg == NULL,FALSE,"PreviewInBrowserTab::UpdateSection called with a NULL dialog pointer");
04793
04794
04795 BOOL ok = pPropertiesDlg->TalkToPage(GetPageID());
04796 if (!ok)
04797 return TRUE;
04798
04799
04800 ShowDetails();
04801
04802 return TRUE;
04803 }
04804
04805
04806
04807
04808
04809
04810
04811
04812
04813
04814
04815
04816
04817
04818 BOOL PreviewInBrowserTab::ShowDetails()
04819 {
04820 ERROR2IF(pPropertiesDlg == NULL,FALSE,"PreviewInBrowserTab::ShowDetails called with a NULL dialog pointer");
04821
04822
04823 BOOL ok = pPropertiesDlg->TalkToPage(GetPageID());
04824 if (!ok)
04825 return TRUE;
04826
04827 BrowserBackground Bgr = g_Background;
04828 BOOL Info = g_InfoInHtmlStub;
04829
04830
04831 if(Bgr == BROWSER_BGR_NONE)
04832 {
04833
04834 pPropertiesDlg->SetBoolGadgetSelected(_R(IDC_PLAINBKGND), TRUE);
04835
04836
04837 pPropertiesDlg->SetBoolGadgetSelected(_R(IDC_DOCBKGND), FALSE);
04838 pPropertiesDlg->SetBoolGadgetSelected(_R(IDC_CHQBKGND), FALSE);
04839 }
04840
04841 else if (Bgr == BROWSER_BGR_DOC)
04842 {
04843
04844 pPropertiesDlg->SetBoolGadgetSelected(_R(IDC_DOCBKGND), TRUE);
04845
04846
04847 pPropertiesDlg->SetBoolGadgetSelected(_R(IDC_PLAINBKGND), FALSE);
04848 pPropertiesDlg->SetBoolGadgetSelected(_R(IDC_CHQBKGND), FALSE);
04849 }
04850
04851 else if (Bgr == BROWSER_BGR_CHECKER)
04852 {
04853
04854 pPropertiesDlg->SetBoolGadgetSelected(_R(IDC_CHQBKGND), TRUE);
04855
04856
04857 pPropertiesDlg->SetBoolGadgetSelected(_R(IDC_PLAINBKGND), FALSE);
04858 pPropertiesDlg->SetBoolGadgetSelected(_R(IDC_DOCBKGND), FALSE);
04859 }
04860
04861 else if (Bgr == BROWSER_BGR_BITMAP)
04862 {
04863
04864
04865
04866 pPropertiesDlg->SetBoolGadgetSelected(_R(IDC_PLAINBKGND), TRUE);
04867
04868
04869 pPropertiesDlg->SetBoolGadgetSelected(_R(IDC_DOCBKGND), FALSE);
04870 pPropertiesDlg->SetBoolGadgetSelected(_R(IDC_CHQBKGND), FALSE);
04871
04872
04873 g_Background = BROWSER_BGR_BITMAP;
04874 }
04875
04876
04877 pPropertiesDlg->SetBoolGadgetSelected(_R(IDC_HTMLSTUB), Info == TRUE);
04878
04879
04880 return TRUE;
04881 }
04882
04883
04884
04885
04886
04887
04888
04889
04890
04891
04892
04893
04894
04895 BOOL PreviewInBrowserTab::UpdateLayerSection()
04896 {
04897 ERROR2IF(pPropertiesDlg == NULL,FALSE,"PreviewInBrowserTab::UpdateLayerSection() called with a NULL dialog pointer");
04898
04899 BOOL ok = pPropertiesDlg->TalkToPage(GetPageID());
04900 if (!ok)
04901 return TRUE;
04902
04903
04904 ShowDetails();
04905
04906
04907 return TRUE;
04908 }
04909
04910
04911
04912
04913
04914
04915
04916
04917
04918
04919
04920
04921
04922
04923 BOOL PreviewInBrowserTab::HandleMsg(DialogMsg* Msg)
04924 {
04925 ERROR2IF(Msg == NULL,FALSE,"PreviewInBrowserTab::Message null message received");
04926 ERROR2IF(pPropertiesDlg == NULL,FALSE,"PreviewInBrowserTab::HandleMsg called with a NULL dialog pointer");
04927
04928 BOOL ok = pPropertiesDlg->TalkToPage(GetPageID());
04929 if (!ok)
04930 return TRUE;
04931
04932
04933 switch(Msg->DlgMsg)
04934 {
04935 case DIM_CREATE:
04936 {
04937
04938 m_GreyStatus = FALSE;
04939
04940
04941 ok = InitSection();
04942 if (!ok)
04943 InformError();
04944
04945
04946 BrowserBackground Bgr = g_Background;
04947 BOOL Info = g_InfoInHtmlStub;
04948
04949
04950 if(Bgr == BROWSER_BGR_NONE)
04951 pPropertiesDlg->SetBoolGadgetSelected(_R(IDC_PLAINBKGND), TRUE);
04952
04953 else if (Bgr == BROWSER_BGR_DOC)
04954 pPropertiesDlg->SetBoolGadgetSelected(_R(IDC_DOCBKGND), TRUE);
04955
04956 else if (Bgr == BROWSER_BGR_CHECKER)
04957 pPropertiesDlg->SetBoolGadgetSelected(_R(IDC_CHQBKGND), TRUE);
04958
04959 else if (Bgr == BROWSER_BGR_BITMAP)
04960 {
04961
04962
04963
04964 pPropertiesDlg->SetBoolGadgetSelected(_R(IDC_PLAINBKGND), TRUE);
04965
04966
04967 g_Background = BROWSER_BGR_BITMAP;
04968 }
04969
04970
04971 pPropertiesDlg->SetBoolGadgetSelected(_R(IDC_HTMLSTUB), Info == TRUE);
04972
04973 break;
04974 }
04975
04976 case DIM_LFT_BN_CLICKED:
04977 {
04978 if (FALSE) {}
04979 else if (Msg->GadgetID == _R(IDC_GIF_BITMAPPREVIEW))
04980 {
04981
04982
04983 PORTNOTE("other", "Disabled BrowserPreviewOptions")
04984 #ifndef EXCLUDE_FROM_XARALX
04985
04986
04987 String_256 ShadeReason;
04988 OpState State = OpGrabAllFrames::GetState(&ShadeReason, NULL);
04989
04990 if (State.Greyed)
04991 {
04992
04993 InformError(_R(IDS_NOFRAMESTOPREVIEW));
04994 }
04995 else
04996 {
04997
04998
04999 BrowserPreviewOptions BrowserOptions;
05000
05001
05002 GetBrowserValues(&BrowserOptions);
05003
05004
05005 OpDescriptor* pOpDesc = OpDescriptor::FindOpDescriptor(OPTOKEN_FRAME_BROWSERPREVIEW);
05006
05007 if (pOpDesc != NULL)
05008 pOpDesc->Invoke();
05009 }
05010 #endif
05011 }
05012 else if (Msg->GadgetID == _R(IDC_PLAINBKGND))
05013 {
05014
05015 PreviewInBrowserTab::SetApplyNowState(TRUE);
05016
05017
05018 PreviewInBrowserTab::UngreyApplyNow();
05019 }
05020 else if (Msg->GadgetID == _R(IDC_DOCBKGND))
05021 {
05022
05023 PreviewInBrowserTab::SetApplyNowState(TRUE);
05024
05025
05026 PreviewInBrowserTab::UngreyApplyNow();
05027 }
05028 else if (Msg->GadgetID == _R(IDC_CHQBKGND))
05029 {
05030
05031 PreviewInBrowserTab::SetApplyNowState(TRUE);
05032
05033
05034 PreviewInBrowserTab::UngreyApplyNow();
05035 }
05036 else if (Msg->GadgetID == _R(IDC_GIF_BITMAPPREVIEW))
05037 {
05038
05039 PreviewInBrowserTab::SetApplyNowState(TRUE);
05040
05041
05042 PreviewInBrowserTab::UngreyApplyNow();
05043 }
05044 }
05045 break;
05046
05047 case DIM_SET_ACTIVE:
05048 {
05049
05050
05051 if(PreviewInBrowserTab::GetApplyNowState())
05052 {
05053
05054 PreviewInBrowserTab::UngreyApplyNow();
05055 }
05056 }
05057 break;
05058
05059 default:
05060 break;
05061 }
05062 return TRUE;
05063 }
05064
05065
05066
05067
05068
05069
05070
05071
05072
05073
05074
05075
05076
05077
05078
05079
05080 BOOL PreviewInBrowserTab::GetBrowserValues(BrowserPreviewOptions *pBrowserOptions)
05081 {
05082 ERROR2IF(pPropertiesDlg == NULL,FALSE,"PreviewInBrowserTab::HandleMsg called with a NULL dialog pointer");
05083
05084
05085
05086
05087
05088
05089
05090
05091 CommitSection();
05092
05093
05094 PORTNOTE("other", "Disabled BrowserPreviewOptions")
05095 #ifndef EXCLUDE_FROM_XARALX
05096 BOOL Imagemap = FALSE;
05097
05098
05099 pBrowserOptions->Set(g_Background, g_InfoInHtmlStub, Imagemap);
05100 #endif
05101
05102
05103 return TRUE;
05104 }
05105
05106
05107
05108
05109
05110
05111
05112
05113
05114
05115
05116
05117
05118
05119
05120
05121
05122 BOOL PreviewInBrowserTab::UpdateApplyState()
05123 {
05124 ERROR2IF(pPropertiesDlg == NULL,FALSE,"PreviewInBrowserTab::UpdateApplyState called with a NULL dialog pointer");
05125
05126
05127
05128
05129
05130
05131
05132
05133
05134
05135
05136
05137
05138
05139
05140
05141
05142
05143
05144
05145
05146
05147 return TRUE;
05148 }
05149
05150
05151
05152
05153
05154
05155
05156
05157
05158
05159
05160
05161
05162
05163 BOOL PreviewInBrowserTab::InitSection()
05164 {
05165 ERROR2IF(pPropertiesDlg == NULL,FALSE,"PreviewInBrowserTab::InitSection called with a NULL dialog pointer");
05166
05167
05168 Document* pDoc = Document::GetCurrent();
05169
05170
05171 if(!pDoc)
05172 {
05173 GreySection();
05174 return (TRUE);
05175 }
05176
05177
05178 ShowDetails();
05179
05180
05181 return TRUE;
05182 }
05183
05184
05185
05186
05187
05188
05189
05190
05191
05192
05193
05194
05195
05196 BOOL PreviewInBrowserTab::Declare()
05197 {
05198 if (Camelot.DeclareSection(_T("Browser Preview"), 5))
05199 {
05200 Camelot.DeclarePref( NULL, _T("BrowserBackground"), (INT32*)&g_Background, 0, 3 );
05201 Camelot.DeclarePref( NULL, _T("IncludeImageMap"), &g_Imagemap, 0, 1 );
05202 Camelot.DeclarePref( NULL, _T("IncludeInfoInHTMLStub"), &g_InfoInHtmlStub, 0, 1 );
05203 }
05204
05205
05206 return TRUE;
05207 }
05208
05209
05210
05211