00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040
00041
00042
00043
00044
00045
00046
00047
00048
00049
00050
00051
00052
00053
00054
00055
00056
00057
00058
00059
00060
00061
00062
00063
00064
00065
00066
00067
00068
00069
00070
00071
00072
00073
00074
00075
00076
00077
00078
00079
00080
00081
00082
00083
00084
00085
00086
00087
00088
00089
00090
00091
00092
00093
00094
00095
00096
00097
00098
00099
00100
00101
00102
00103 #include "camtypes.h"
00104
00105 #include "bfxdlg2.h"
00106 #include "bfxdlg.h"
00107
00108
00109 #include "oilprog.h"
00110
00111 #include "ccdc.h"
00112 #include "dlgcol.h"
00113
00114 #include "grnddib.h"
00115
00116
00117
00118 #include "nodebmp.h"
00119 #include "bitmpinf.h"
00120
00121 #include "bmpcomp.h"
00122
00123 #include "bitmapfx.h"
00124
00125 #include "progress.h"
00126 #include "csrstack.h"
00127
00128 #include "chapter.h"
00129 #include "page.h"
00130
00131
00132
00133
00134
00135
00136 #include "wrkrect.h"
00137
00138
00139
00140 #include "mrhbits.h"
00141
00142
00143
00144
00145 DECLARE_SOURCE("$Revision: 1282 $");
00146
00147
00148
00149 CC_IMPLEMENT_DYNCREATE(BfxPlugInDlg, DialogOp)
00150 CC_IMPLEMENT_DYNCREATE(BfxBrightnessContrastDlg, BfxPlugInDlg)
00151 CC_IMPLEMENT_DYNCREATE(BfxSpecialEffectsDlg, BfxPlugInDlg)
00152 CC_IMPLEMENT_DYNCREATE(BfxResizeDlg, BfxPlugInDlg)
00153 CC_IMPLEMENT_DYNCREATE(BfxFlipAndRotateDlg, BfxPlugInDlg)
00154 CC_IMPLEMENT_DYNCREATE(BfxColourDepthDlg, BfxPlugInDlg)
00155
00156
00157
00158 #define new CAM_DEBUG_NEW
00159
00160 const CDlgMode BfxPlugInDlg::Mode = MODAL;
00161 UINT32 BfxPlugInDlg::IDD = _R(IDD_BFXDLG);
00162
00163 BOOL BfxPlugInDlg::InteractiveBCC = TRUE;
00164
00165
00166
00167
00168
00169
00170
00171
00172
00173
00174
00175
00176 BfxBrightnessContrastDlg::BfxBrightnessContrastDlg() : BfxPlugInDlg( _R(IDD_BFXPLUGINDLG_PG3) )
00177 {
00178 OpenPage = _R(IDD_BFXPLUGINDLG_PG3);
00179 }
00180
00181 BfxSpecialEffectsDlg::BfxSpecialEffectsDlg() : BfxPlugInDlg( _R(IDD_BFXPLUGINDLG_PG5) )
00182 {
00183 OpenPage = _R(IDD_BFXPLUGINDLG_PG5);
00184 }
00185
00186 BfxResizeDlg::BfxResizeDlg() : BfxPlugInDlg( _R(IDD_BFXPLUGINDLG_PG2) )
00187 {
00188 OpenPage = _R(IDD_BFXPLUGINDLG_PG2);
00189 }
00190
00191 BfxFlipAndRotateDlg::BfxFlipAndRotateDlg() : BfxPlugInDlg( _R(IDD_BFXPLUGINDLG_PG1) )
00192 {
00193 OpenPage = _R(IDD_BFXPLUGINDLG_PG1);
00194 }
00195
00196 BfxColourDepthDlg::BfxColourDepthDlg() : BfxPlugInDlg( _R(IDD_BFXPLUGINDLG_PG4) )
00197 {
00198 OpenPage = _R(IDD_BFXPLUGINDLG_PG4);
00199 }
00200
00201 BfxPlugInDlg::BfxPlugInDlg(CDlgResID id) : DialogOp(id, BfxPlugInDlg::Mode)
00202 {
00203 pOriginal = NULL;
00204 pDestination = NULL;
00205 pPrevOriginal=NULL;
00206 pOrigInfo = NULL;
00207 m_UseInitial = TRUE;
00208 Clean = FALSE;
00209 pFX = NULL;
00210 SetParameters();
00211 for (INT32 i = 0; i<=8; i++) Matrix[i]=(i==4)?1.0:0.0;
00212
00213 m_pParam = NULL;
00214 m_pDocument = NULL;
00215 }
00216
00217
00218
00219
00220
00221
00222
00223
00224
00225
00226
00227 BfxPlugInDlg::~BfxPlugInDlg()
00228 {
00229
00230 if(!m_p24BitCopyNames.IsEmpty())
00231 {
00232
00233 Remove24BitTempCopy();
00234 }
00235
00236 if (pFX) delete pFX;
00237 if (pDestination) {TRACEUSER( "Neville", _T("Destructor deleting destination\n"));delete pDestination;}
00238 if (pOrigInfo) delete pOrigInfo;
00239 }
00240
00241 void BfxPlugInDlg::Remove24BitTempCopy()
00242 {
00243
00244 Document * pDoc = Document::GetSelected();
00245
00246
00247 BitmapList* Bitmaps = NULL;
00248 if (pDoc)
00249 {
00250 Bitmaps = pDoc->GetBitmapList();
00251 }
00252
00253
00254 KernelBitmap * pBmp = (KernelBitmap *)(Bitmaps->GetHead());
00255 KernelBitmap * pTemp = NULL;
00256
00257 POSITION Pos = NULL;
00258 BOOL DeleteThisBMP = FALSE;
00259
00260
00261 while (pBmp != NULL)
00262 {
00263
00264 Pos = m_p24BitCopyNames.GetHeadPosition();
00265
00266
00267 while(Pos != NULL && pBmp != NULL)
00268 {
00269
00270 if (pBmp->GetName().CompareTo(m_p24BitCopyNames.GetAt(Pos)) == 0)
00271 {
00272
00273 DeleteThisBMP = TRUE;
00274
00275
00276 break;
00277 }
00278
00279
00280 m_p24BitCopyNames.GetNext(Pos);
00281 }
00282
00283
00284 pTemp = (KernelBitmap *) Bitmaps->GetNext(pBmp);
00285
00286
00287 if(DeleteThisBMP)
00288 {
00289
00290 Bitmaps->RemoveItem(pBmp);
00291 pBmp->Detach();
00292 delete pBmp;
00293 pBmp = NULL;
00294
00295
00296 DeleteThisBMP = FALSE;
00297 }
00298
00299
00300 pBmp = pTemp;
00301 }
00302
00303
00304 while(!m_p24BitCopyNames.IsEmpty())
00305 {
00306 m_p24BitCopyNames.RemoveHead();
00307 }
00308 }
00309
00310
00311
00312
00313
00314
00315
00316
00317
00318
00319
00320
00321
00322
00323
00324
00325 BOOL BfxPlugInDlg::OriginalChanged()
00326 {
00327 if (pPrevOriginal==pOriginal) return TRUE;
00328 pPrevOriginal=pOriginal;
00329
00330 if (!pOrigInfo)
00331 {
00332 pOrigInfo = new BitmapInfo;
00333 if (!pOrigInfo) return FALSE;
00334 }
00335
00336 pOrigInfo->PixelWidth = 100;
00337 pOrigInfo->PixelHeight = 100;
00338 pOrigInfo->PixelDepth = 24;
00339 if (pOriginal && pOrigInfo)
00340 {
00341 pOriginal->ActualBitmap->GetInfo(pOrigInfo);
00342 }
00343
00344 if (SetDirty() && (OpenPage != 0))
00345 {
00346 InvalidateGadget(_R(IDC_BFXDLG_ORIGREDRAW));
00347 }
00348
00349 BROADCAST_TO_CLASS(DialogMsg(WindowID, DIM_OUT_OF_SPACE, _R(IDC_BFXDLG_ORIGREDRAW),
00350 0, OpenPage) ,DialogOp);
00351
00352 return FixOriginalComboBox();
00353 }
00354
00355
00356
00357
00358
00359
00360
00361
00362
00363
00364
00365
00366
00367
00368
00369
00370 BOOL BfxPlugInDlg::SetEffect(CCRuntimeClass * Effect)
00371 {
00372 if (pFX)
00373 {
00374 if (pFX->GetRuntimeClass() == Effect) return TRUE;
00375 delete pFX;
00376 pFX = NULL;
00377 }
00378 if (Effect)
00379 {
00380 pFX = (AccusoftBitmapEffect *) (Effect->CreateObject());
00381 if (!pFX) return FALSE;
00382 return pFX->SetParameters(Param1, Param2, Param3, Matrix);
00383 }
00384 else return TRUE;
00385 }
00386
00387
00388
00389
00390
00391
00392
00393
00394
00395
00396
00397
00398
00399
00400
00401
00402 BOOL BfxPlugInDlg::SetDirty(BOOL Redraw)
00403 {
00404 if (!ClearDestination(Redraw)) return FALSE;
00405 Clean = FALSE;
00406 if (pFX)
00407 {
00408 delete pFX;
00409 pFX = NULL;
00410 }
00411 return TRUE;
00412 }
00413
00414
00415
00416
00417
00418
00419
00420
00421
00422
00423
00424
00425
00426
00427
00428
00429 BOOL BfxPlugInDlg::DestinationChanged()
00430 {
00431 if (OpenPage)
00432 {
00433 InvalidateGadget(_R(IDC_BFXDLG_ORIGREDRAW2));
00434 }
00435 return TRUE;
00436 }
00437
00438
00439
00440
00441
00442
00443
00444
00445
00446
00447
00448
00449
00450
00451
00452
00453 BOOL BfxPlugInDlg::ClearDestination(BOOL Redraw)
00454 {
00455 if (pDestination)
00456 {
00457 delete pDestination;
00458 pDestination = NULL;
00459 return ((!Redraw) || (DestinationChanged()));
00460 }
00461 return TRUE;
00462 }
00463
00464
00465
00466
00467
00468
00469
00470
00471
00472
00473
00474
00475
00476
00477
00478
00479 BOOL BfxPlugInDlg::FindBitmap()
00480 {
00481
00482
00483
00484 if (m_pParam != 0)
00485 {
00486 pOriginal = (KernelBitmap*) m_pParam->Param1;
00487 return CheckOriginalBitmap();
00488 }
00489
00490 Range Sel(*(GetApplication()->FindSelection()));
00491 Node* FirstSelectedNode = Sel.FindFirst();
00492 if (FirstSelectedNode != NULL)
00493 {
00494 Node* CurrentNode = FirstSelectedNode;
00495 Node* NextCurrent;
00496
00497
00498 while (CurrentNode != NULL)
00499 {
00500 NextCurrent = Sel.FindNext(CurrentNode);
00501 if (CurrentNode->IsSelected() &&
00502 CurrentNode->GetRuntimeClass() == CC_RUNTIME_CLASS(NodeBitmap))
00503 {
00504 pOriginal = ((NodeBitmap *)(CurrentNode))->GetBitmap();
00505 return CheckOriginalBitmap();
00506 }
00507
00508 CurrentNode = NextCurrent;
00509 }
00510 }
00511
00512
00513 AttrFillGeometry* pAttrNode = AttrFillGeometry::FindFirstSelectedAttr();
00514
00515 while (pAttrNode != NULL)
00516 {
00517 if (pAttrNode->IsKindOf(CC_RUNTIME_CLASS(AttrBitmapColourFill)))
00518 {
00519 pOriginal = pAttrNode->GetBitmap();
00520 return CheckOriginalBitmap();
00521 }
00522
00523
00524 pAttrNode = AttrFillGeometry::FindNextSelectedAttr();
00525 }
00526
00527 return CheckOriginalBitmap();
00528 }
00529
00530
00531
00532
00533
00534
00535
00536
00537
00538
00539
00540
00541
00542
00543
00544
00545
00546 BOOL BfxPlugInDlg::CheckOriginalBitmap()
00547 {
00548 Document * pDoc = Document::GetSelected();
00549
00550
00551 BitmapList* Bitmaps = NULL;
00552 if (pDoc) Bitmaps = pDoc->GetBitmapList();
00553
00554 if (Bitmaps == NULL)
00555 {
00556 pOriginal = NULL;
00557 return OriginalChanged();
00558 }
00559
00560 KernelBitmap * pBmp = NULL;
00561
00562 if(pOriginal != NULL)
00563 {
00564
00565 if(pOriginal->ActualBitmap->GetBitmapInfoHeader()->biBitCount == 32)
00566 {
00567
00568 BOOL AlreadyHaveCopy = FALSE;
00569
00570
00571 pBmp = (KernelBitmap *)(Bitmaps->GetHead());
00572
00573
00574 while (pBmp != NULL)
00575 {
00576
00577 String_256 strTemp = pOriginal->GetName();
00578 strTemp += TEXT("(24-bit Copy)");
00579 if (pBmp->GetName().CompareTo(strTemp) == 0)
00580 {
00581
00582 AlreadyHaveCopy = TRUE;
00583 break;
00584 }
00585
00586 pBmp = (KernelBitmap *) Bitmaps->GetNext(pBmp);
00587 }
00588
00589
00590 if(AlreadyHaveCopy)
00591 {
00592 InformWarning(_R(IDS_BFX_USE_CONVERT_MSG),_R(IDS_OK),0,0,0,1,2);
00593 pOriginal = pBmp;
00594 }
00595 else
00596 {
00597
00598 InformWarning(_R(IDS_BFX_BMP_CONVERT_MSG),_R(IDS_OK),0,0,0,1,2);
00599
00600
00601 String_256 NewName = pOriginal->GetName();
00602 NewName += "(24-bit Copy)";
00603
00604
00605 m_p24BitCopyNames.AddTail(NewName);
00606
00607
00608 UINT32 Height = pOriginal->GetBitmapInfoHeader()->biHeight;
00609 UINT32 Width = pOriginal->GetBitmapInfoHeader()->biWidth;
00610 KernelBitmap* pNewBMP = new KernelBitmap( Width, Height, 24, 96);
00611
00612 if(pNewBMP != NULL)
00613 {
00614
00615 pNewBMP->ActualBitmap = CBMPBits::RenderKernelBMPToTransparentWhiteRect(pOriginal,TRUE,24);
00616
00617
00618 pNewBMP->SetName(NewName);
00619
00620
00621 pOriginal = pNewBMP;
00622
00623
00624 pNewBMP->Attach(Document::GetCurrent()->GetBitmapList());
00625 }
00626 else
00627 {
00628 ERROR2(FALSE,"Could not make 24Bit Bitmap Copy Of 32Bit Source!");
00629 }
00630 }
00631
00632 FixOriginalComboBox();
00633 return OriginalChanged();
00634 }
00635 }
00636
00637 pBmp = (KernelBitmap *)(Bitmaps->GetHead());
00638
00639 while (pBmp != NULL)
00640 {
00641 if (pBmp == pOriginal) return OriginalChanged();
00642 pBmp = (KernelBitmap *) Bitmaps->GetNext(pBmp);
00643 }
00644
00645 pOriginal = (KernelBitmap *)(Bitmaps->GetHead());
00646 return OriginalChanged();
00647 }
00648
00649
00650
00651
00652
00653
00654
00655
00656
00657
00658
00659
00660
00661
00662
00663
00664
00665
00666 BOOL BfxPlugInDlg::FixOriginalComboBox()
00667 {
00668
00669 Document * pDoc = Document::GetSelected();
00670
00671
00672 BitmapList* Bitmaps = NULL;
00673 if (pDoc) Bitmaps = pDoc->GetBitmapList();
00674
00675 if (Bitmaps == NULL)
00676 return TRUE;
00677
00678 String_256 Str;
00679
00680 if (OpenPage)
00681 {
00682 DeleteAllValues(_R(IDC_BFXDLG_ORIGCOMBO));
00683 }
00684
00685 BOOL DoneMain = FALSE;
00686 INT32 SelIndex = 0;
00687
00688
00689
00690 CustomComboBoxControlDataItem* theItem = NULL;
00691
00692 if (Bitmaps->GetCount() > 0)
00693 {
00694 INT32 Index = 0;
00695
00696 ListItem* pBmp = Bitmaps->GetHead();
00697
00698 while (pBmp != NULL)
00699 {
00700
00701
00702
00703
00704
00705
00706
00707
00708
00709
00710
00711
00712 if (OpenPage)
00713 {
00714 if (!((KernelBitmap*)pBmp)->HasBeenDeleted())
00715 {
00716 Str = ((KernelBitmap*)pBmp)->ActualBitmap->GetName();
00717
00718
00719
00720
00721
00722 theItem = new CustomComboBoxControlDataItem ();
00723 theItem->itemName = Str;
00724 theItem->itemID = Index;
00725
00726 KernelBitmap* bitmap = ((KernelBitmap*)pBmp);
00727
00728
00729 theItem->oilItemBitmap = (KernelBitmap*) bitmap;
00730
00731
00732
00733 if (((KernelBitmap*)(pBmp)) == pOriginal)
00734 {
00735 SetCustomComboGadgetValue ( _R(IDC_BFXDLG_ORIGCOMBO), theItem, TRUE, 0);
00736
00737 String_64 Str;
00738 Str = ((KernelBitmap*)(pBmp))->GetName ();
00739
00740
00741 SelectCustomComboGadgetValueOnString (_R(IDC_BFXDLG_ORIGCOMBO), &Str);
00742
00743
00744 DoneMain = TRUE;
00745 SelIndex=Index;
00746
00747 Index++;
00748 }
00749 else
00750 {
00751 SetCustomComboGadgetValue ( _R(IDC_BFXDLG_ORIGCOMBO), theItem, TRUE, 0);
00752 Index++;
00753 }
00754 }
00755 }
00756
00757 pBmp = Bitmaps->GetNext(pBmp);
00758 }
00759 }
00760 else
00761 {
00762
00763
00764 }
00765
00766 if (OpenPage)
00767 {
00768 Str.Load(_R(IDS_K_BFXDLG_DEFAULT));
00769
00770 if (!DoneMain)
00771 {
00772
00773 SelectCustomComboGadgetValueOnString (_R(IDC_BFXDLG_ORIGCOMBO), &Str);
00774
00775
00776
00777 }
00778
00779
00780
00781
00782 }
00783 return TRUE;
00784 }
00785
00786
00787
00788
00789
00790
00791
00792
00793
00794
00795
00796
00797
00798
00799
00800
00801
00802
00803
00804 BOOL BfxPlugInDlg::ReadOriginalComboBox()
00805 {
00806 if (!OpenPage) return FALSE;
00807
00808 Document * pDoc = Document::GetSelected();
00809
00810
00811 BitmapList* Bitmaps = NULL;
00812 if (pDoc) Bitmaps = pDoc->GetBitmapList();
00813
00814 if (Bitmaps == NULL)
00815 return TRUE;
00816
00817 ListItem* pBmp = Bitmaps->GetHead();
00818
00819 WORD Index;
00820 GetValueIndex(_R(IDC_BFXDLG_ORIGCOMBO),&Index);
00821
00822 for (INT32 i = 0; i < Index; i++)
00823 {
00824 if (pBmp == NULL)
00825 break;
00826
00827 pBmp = Bitmaps->GetNext(pBmp);
00828 }
00829
00830 pOriginal = (KernelBitmap*)pBmp;
00831 return CheckOriginalBitmap();
00832 }
00833
00834
00835
00836
00837
00838
00839
00840
00841
00842
00843
00844
00845
00846
00847
00848
00849
00850 BOOL BfxPlugInDlg::RenderBitmap(ReDrawInfoType* ExtraInfo, KernelBitmap * BitmapToUse)
00851 {
00852
00853 DocRect VirtualSize(0, 0, ExtraInfo->dx, ExtraInfo->dy);
00854 RenderRegion* pRender = CreateGRenderRegion(&VirtualSize, ExtraInfo);
00855 if (pRender!=NULL)
00856 {
00857 pRender->m_DoCompression = TRUE;
00858
00859 DialogColourInfo RedrawColours;
00860
00861
00862 DocColour Grey(255,200,0);
00863
00864
00865 pRender->SaveContext();
00866 pRender->SetLineColour(COLOUR_TRANS);
00867
00868
00869 pRender->SetFillColour(RedrawColours.DialogBack());
00870 pRender->DrawRect(&VirtualSize);
00871
00872 if (BitmapToUse)
00873 {
00874
00875 NodeBitmap NB;
00876 NodeBitmap * pNodeBitmap = &NB;
00877
00878 if (!((pNodeBitmap == NULL) || (!pNodeBitmap->SetUpPath(12,12))))
00879 {
00880
00881 pNodeBitmap->GetBitmapRef()->SetBitmap(BitmapToUse);
00882
00883 ENSURE(pNodeBitmap->GetBitmap()->ActualBitmap != NULL, "No bitmap object found!");
00884
00885 DocRect BitmapSize(VirtualSize);
00886 BitmapInfo BMInfo;
00887 BitmapToUse->ActualBitmap->GetInfo(&BMInfo);
00888 if (BMInfo.PixelWidth==0) BMInfo.PixelWidth=1;
00889 if (BMInfo.PixelHeight==0) BMInfo.PixelHeight=1;
00890
00891 double BMAspect = ((double)(BMInfo.PixelWidth))/((double)(BMInfo.PixelHeight));
00892 double RedrawAspect = ((double)(ExtraInfo->dx))/((double)(ExtraInfo->dy));
00893
00894 if (BMAspect>RedrawAspect)
00895 {
00896
00897 INT32 NewHeight = (INT32)( 0.5 + ((double)(VirtualSize.Width()))/BMAspect);
00898 if (NewHeight<1) NewHeight = 1;
00899 BitmapSize.loy = (VirtualSize.Height()-NewHeight)/2;
00900 BitmapSize.hiy = BitmapSize.loy + NewHeight;
00901 }
00902 else
00903 {
00904
00905 INT32 NewWidth = (INT32)( 0.5 + ((double)(VirtualSize.Height()))*BMAspect);
00906 if (NewWidth<1) NewWidth = 1;
00907 BitmapSize.lox = (VirtualSize.Width()-NewWidth)/2;
00908 BitmapSize.hix = BitmapSize.lox + NewWidth;
00909 }
00910
00911
00912 pNodeBitmap->CreateShape(BitmapSize);
00913
00914 pNodeBitmap->Render(pRender);
00915 }
00916 }
00917
00918 pRender->RestoreContext();
00919
00920
00921 DestroyGRenderRegion(pRender);
00922 }
00923 return TRUE;
00924 }
00925
00926
00927
00928
00929
00930
00931
00932
00933
00934
00935
00936
00937
00938
00939
00940
00941
00942
00943
00944
00945
00946
00947
00948
00949 MsgResult BfxPlugInDlg::Message( Msg* Message)
00950 {
00951 if (IS_OUR_DIALOG_MSG(Message))
00952 {
00953 DialogMsg* Msg = ((DialogMsg*) Message);
00954
00955 BOOL EndDialog = FALSE;
00956 BOOL CommitValues = FALSE;
00957
00958
00959 if (OpenPage) switch (OpenPage)
00960 {
00961 case _R(IDD_BFXPLUGINDLG_PG1):
00962 HandleFlipAndRotateMsg(Msg, &CommitValues, &EndDialog);
00963 break;
00964 case _R(IDD_BFXPLUGINDLG_PG2):
00965 HandleResizeMsg(Msg, &CommitValues, &EndDialog);
00966 break;
00967 case _R(IDD_BFXPLUGINDLG_PG3):
00968 HandleBrightnessAndContrastMsg(Msg, &CommitValues, &EndDialog);
00969 break;
00970 case _R(IDD_BFXPLUGINDLG_PG4):
00971 HandleDitherMsg(Msg, &CommitValues, &EndDialog);
00972 break;
00973 case _R(IDD_BFXPLUGINDLG_PG5):
00974 HandleSpecialEffectsMsg(Msg, &CommitValues, &EndDialog);
00975 break;
00976 case _R(IDD_BFXPLUGINDLG_PG6):
00977 HandleAlchemistMsg(Msg, &CommitValues, &EndDialog);
00978 break;
00979 default:
00980 ERROR3("Message from unknown tab dialog page");
00981 }
00982
00983 switch (Msg->DlgMsg)
00984 {
00985 case DIM_CREATE:
00986 pOriginal=NULL;
00987 FindBitmap();
00988 FixOriginalComboBox();
00989 SetDirty();
00990 break;
00991
00992 case DIM_COMMIT:
00993 EndDialog = TRUE;
00994 CommitValues = TRUE;
00995 break;
00996
00997 case DIM_SOFT_COMMIT:
00998 CommitValues = TRUE;
00999 break;
01000
01001 case DIM_CANCEL:
01002 if (!(IsCustomComboDropdownVisible (_R(IDC_BFXDLG_ORIGCOMBO))))
01003 {
01004 EndDialog = TRUE;
01005 }
01006 else
01007 {
01008 CloseDropdown (_R(IDC_BFXDLG_ORIGCOMBO), FALSE);
01009 }
01010 break;
01011
01012
01013 case DIM_SET_ACTIVE:
01014 CheckOriginalBitmap();
01015 FixOriginalComboBox();
01016 SetDirty();
01017 break;
01018
01019 case DIM_REDRAW :
01020
01021
01022
01023 switch (Msg->GadgetID)
01024 {
01025
01026 case _R(IDC_BFXDLG_ORIGREDRAW) :
01027 {
01028 RenderBitmap((ReDrawInfoType*) Msg->DlgMsgParam, pOriginal);
01029 break;
01030 }
01031 case _R(IDC_BFXDLG_ORIGREDRAW2) :
01032 {
01033 RenderBitmap((ReDrawInfoType*) Msg->DlgMsgParam, pDestination);
01034 break;
01035 }
01036 }
01037 break;
01038
01039 case DIM_SELECTION_CHANGED:
01040 switch (Msg->GadgetID)
01041 {
01042
01043 case _R(IDC_BFXDLG_ORIGCOMBO) :
01044 {
01045 ReadOriginalComboBox();
01046 break;
01047 }
01048 }
01049 break;
01050 }
01051
01052
01053 if (CommitValues)
01054 {
01055 if (pOriginal)
01056 {
01057 if (pFX)
01058 {
01059 if (!Clean)
01060 {
01061
01062
01063
01064
01065
01066
01067
01068
01069
01070
01071
01072
01073
01074
01075
01076
01077 ClearDestination();
01078
01079
01080
01081
01082
01083
01084
01085
01086 BeginSlowJob();
01087 BeginBusyCursor();
01088
01089 pFX->SetParameters(Param1, Param2, Param3, Matrix);
01090 pDestination = pFX->GetProcessedBitmap(pOriginal);
01091
01092
01093
01094
01095
01096
01097
01098 EndBusyCursor();
01099 EndSlowJob();
01100
01101 if (!pDestination)
01102 {
01103 InformError ();
01104 EndDialog = FALSE;
01105 }
01106 else
01107 {
01108 DestinationChanged();
01109 Clean=TRUE;
01110 }
01111 }
01112 }
01113 else
01114 {
01115 TRACEUSER( "Neville", _T("Wierd - he didn't actually ask for an effect..."));
01116
01117 if(Msg->DlgMsg == DIM_COMMIT && m_UseInitial)
01118 {
01119
01120
01121 StringBase Current;
01122 Current.Alloc(256);
01123 pOriginal->GetName().Left(&Current,pOriginal->GetName().Length() - 13);
01124 String_256 NewName = (TCHAR*)Current;
01125
01126
01127
01128 pOriginal->SetName(NewName);
01129 }
01130 }
01131 }
01132 }
01133
01134
01135 if (EndDialog)
01136 {
01137
01138
01139
01140 if (m_pParam != NULL)
01141 {
01142
01143 if (m_pParam->Output != NULL)
01144 *(m_pParam->Output) = CommitValues;
01145
01146 m_pParam->Param1 = NULL;
01147 }
01148
01149 if (pOriginal != NULL && CommitValues && pDestination != NULL)
01150 {
01151 OpenPage = 0;
01152
01153
01154
01155
01156
01157 OILBitmap * pDestWinBitmap = pDestination->ExtractOILBitmap();
01158
01159
01160
01161 KernelBitmap * pDestBitmap = NULL;
01162 BitmapList * pBmpList = NULL;
01163
01164
01165 BOOL IsNew = TRUE;
01166 if (m_pDocument)
01167 {
01168 m_pDocument->SetCurrent();
01169
01170 pDestBitmap = KernelBitmap::TryAndUseExistingBitmap(pDestWinBitmap, m_pDocument, &IsNew);
01171 pBmpList = m_pDocument->GetBitmapList();
01172 ERROR3IF(pBmpList == NULL,"No document bitmap ref found!");
01173 }
01174
01175
01176 if (pDestBitmap != NULL && pBmpList != NULL)
01177 {
01178
01179 pDestBitmap->Attach(pBmpList);
01180
01181
01182
01183
01184 pDestination = NULL;
01185
01186
01187 BROADCAST_TO_ALL(BitmapListChangedMsg(pBmpList, pDestBitmap));
01188
01189
01190 if (m_pParam)
01191 m_pParam->Param1 = (INT32)pDestBitmap;
01192 }
01193 else
01194 ERROR3("Couldn't add bitmap into system");
01195 }
01196
01197 ClearDestination();
01198
01199 Close();
01200
01201 End();
01202 }
01203
01204 } else if (MESSAGE_IS_A(Message, SelChangingMsg))
01205 {
01206
01207 SelChangingMsg *Msg = (SelChangingMsg *) Message;
01208 switch ( Msg->State )
01209 {
01210 case SelChangingMsg::SelectionState::SELECTIONCHANGED:
01211 case SelChangingMsg::SelectionState::NODECHANGED:
01212
01213 FindBitmap();
01214 break;
01215 }
01216 } else if (MESSAGE_IS_A(Message, BitmapListChangedMsg))
01217 {
01218
01219 CheckOriginalBitmap();
01220 FixOriginalComboBox();
01221 } else if (MESSAGE_IS_A(Message, BfxMsg))
01222 {
01223
01224 pOriginal=((BfxMsg*)(Message))->pBitmap;
01225 CheckOriginalBitmap();
01226 }
01227
01228 return DialogOp::Message(Message);
01229 }
01230
01231
01232
01233
01234
01235
01236
01237
01238
01239
01240
01241
01242
01243
01244
01245
01246
01247
01248
01249
01250
01251
01252
01253 void BfxPlugInDlg::HandleFlipAndRotateMsg(DialogMsg* Msg, BOOL *pCommitValues, BOOL *pEndDialog)
01254 {
01255
01256 switch(Msg->DlgMsg)
01257 {
01258 case DIM_CREATE:
01259 SetLongGadgetValue(_R(IDC_BFXDLG_FLIPX), TRUE);
01260 SetLongGadgetValue(_R(IDC_BFXDLG_FLIPY), FALSE);
01261 SetLongGadgetValue(_R(IDC_BFXDLG_ROTATE90), FALSE);
01262 SetLongGadgetValue(_R(IDC_BFXDLG_ROTATE180), FALSE);
01263 SetLongGadgetValue(_R(IDC_BFXDLG_ROTATE270), FALSE);
01264 break;
01265
01266 case DIM_LFT_BN_CLICKED:
01267 case DIM_SELECTION_CHANGED:
01268 {
01269 m_UseInitial = FALSE;
01270 switch (Msg->GadgetID)
01271 {
01272 case _R(IDC_BFXDLG_FLIPX):
01273 case _R(IDC_BFXDLG_FLIPY):
01274 case _R(IDC_BFXDLG_ROTATE90):
01275 case _R(IDC_BFXDLG_ROTATE180):
01276 case _R(IDC_BFXDLG_ROTATE270):
01277 SetDirty();
01278 break;
01279 default:
01280 break;
01281 }
01282 }
01283
01284 *pCommitValues = TRUE;
01285
01286 case DIM_SOFT_COMMIT:
01287 case DIM_COMMIT:
01288 {
01289 if (GetBoolGadgetSelected(_R(IDC_BFXDLG_FLIPX))) SetEffect(CC_RUNTIME_CLASS(ABFXFlipX));
01290 if (GetBoolGadgetSelected(_R(IDC_BFXDLG_FLIPY))) SetEffect(CC_RUNTIME_CLASS(ABFXFlipY));
01291 if (GetBoolGadgetSelected(_R(IDC_BFXDLG_ROTATE90) )) SetEffect(CC_RUNTIME_CLASS(ABFXRotate90 ));
01292 if (GetBoolGadgetSelected(_R(IDC_BFXDLG_ROTATE180))) SetEffect(CC_RUNTIME_CLASS(ABFXRotate180));
01293 if (GetBoolGadgetSelected(_R(IDC_BFXDLG_ROTATE270))) SetEffect(CC_RUNTIME_CLASS(ABFXRotate270));
01294 }
01295 break;
01296
01297 }
01298 }
01299
01300
01301
01302
01303
01304
01305
01306
01307
01308
01309
01310
01311
01312
01313
01314
01315
01316
01317 void BfxPlugInDlg::HandleResizeMsg(DialogMsg* Msg, BOOL *pCommitValues, BOOL *pEndDialog)
01318 {
01319 static BOOL ReEntered = FALSE;
01320 BOOL RescanSize = FALSE;
01321
01322 switch(Msg->DlgMsg)
01323 {
01324 case DIM_SET_ACTIVE:
01325 ReEntered = FALSE;
01326 break;
01327
01328 case DIM_CREATE:
01329 FindBitmap();
01330 SetLongGadgetValue(_R(IDC_BFXDLG_INTERP), TRUE);
01331 SetLongGadgetValue(_R(IDC_BFXDLG_ASPECT), TRUE);
01332 RescanSize=TRUE;
01333
01334
01335 EnableGadget(_R(ID_APPLY_NOW), FALSE);
01336 break;
01337
01338 case DIM_OUT_OF_SPACE:
01339 if (Msg->GadgetID == _R(IDC_BFXDLG_ORIGREDRAW))
01340 RescanSize=TRUE;
01341 break;
01342
01343 case DIM_SELECTION_CHANGED:
01344 case DIM_SLIDER_POS_SET:
01345
01346 case DIM_LFT_BN_CLICKED:
01347 case DIM_TEXT_CHANGED:
01348 {
01349 m_UseInitial = FALSE;
01350 SetDirty();
01351 INT32 NewX = GetLongGadgetValue(_R(IDC_BFXDLG_NEWXSIZE),0,10000000);
01352 INT32 NewY = GetLongGadgetValue(_R(IDC_BFXDLG_NEWYSIZE),0,10000000);
01353 EnableGadget(_R(ID_APPLY_NOW),
01354 NewX != (INT32) pOrigInfo->PixelWidth || NewY != (INT32) pOrigInfo->PixelHeight);
01355
01356 if ((GetLongGadgetValue(_R(IDC_BFXDLG_ASPECT),0,1)!=0) && !ReEntered)
01357 {
01358 switch (Msg->GadgetID)
01359 {
01360 case _R(IDC_BFXDLG_NEWXSIZE):
01361 if (pOrigInfo->PixelWidth)
01362 {
01363 ReEntered = TRUE;
01364 SetLongGadgetValue(_R(IDC_BFXDLG_NEWYSIZE), (INT32)(0.5+ (
01365 ((double)(pOrigInfo->PixelHeight))/((double)(pOrigInfo->PixelWidth))*((double)(NewX)) )));
01366 ReEntered = FALSE;
01367 }
01368 break;
01369
01370 case _R(IDC_BFXDLG_NEWYSIZE):
01371 if (pOrigInfo->PixelHeight)
01372 {
01373 ReEntered = TRUE;
01374 SetLongGadgetValue(_R(IDC_BFXDLG_NEWXSIZE), (INT32)(0.5+ (
01375 ((double)(pOrigInfo->PixelWidth))/((double)(pOrigInfo->PixelHeight))*((double)(NewY)) )));
01376 ReEntered = FALSE;
01377 }
01378 break;
01379
01380 default:
01381 break;
01382 }
01383 }
01384 break;
01385 }
01386 case DIM_SOFT_COMMIT:
01387 case DIM_COMMIT:
01388 {
01389 SetEffect(CC_RUNTIME_CLASS(ABFXResize));
01390 INT32 NewX = GetLongGadgetValue(_R(IDC_BFXDLG_NEWXSIZE),0,10000000);
01391 INT32 NewY = GetLongGadgetValue(_R(IDC_BFXDLG_NEWYSIZE),0,10000000);
01392 if (NewX<2) NewX = 2;
01393 if (NewY<2) NewY = 2;
01394 SetParameters(NewX, NewY, (INT32)(BOOL)(GetLongGadgetValue(_R(IDC_BFXDLG_INTERP),0,1)!=0));
01395 }
01396 break;
01397 }
01398
01399 if (RescanSize && pOrigInfo)
01400 {
01401 ReEntered = TRUE;
01402 SetLongGadgetValue(_R(IDC_BFXDLG_ORIGXSIZE), pOrigInfo->PixelWidth);
01403 SetLongGadgetValue(_R(IDC_BFXDLG_NEWXSIZE), pOrigInfo->PixelWidth);
01404 SetLongGadgetValue(_R(IDC_BFXDLG_ORIGYSIZE), pOrigInfo->PixelHeight);
01405 SetLongGadgetValue(_R(IDC_BFXDLG_NEWYSIZE), pOrigInfo->PixelHeight);
01406 ReEntered = FALSE;
01407 }
01408 }
01409
01410
01411
01412
01413
01414
01415
01416
01417
01418
01419
01420
01421
01422
01423
01424
01425
01426 void BfxPlugInDlg::HandleBrightnessAndContrastMsg(DialogMsg* Msg, BOOL *pCommitValues, BOOL *pEndDialog)
01427 {
01428
01429 switch(Msg->DlgMsg)
01430 {
01431 case DIM_CREATE:
01432 SetGadgetRange(_R(IDC_BFXDLG_BRIGHTNESS), -127, 127, 1);
01433 SetGadgetBitmaps(_R(IDC_BFXDLG_BRIGHTNESS), _R(IDB_SLIDERBASE), _R(IDB_SLIDERSLIDER));
01434 SetGadgetRange(_R(IDC_BFXDLG_CONTRAST), -127, 127, 1);
01435 SetGadgetBitmaps(_R(IDC_BFXDLG_CONTRAST), _R(IDB_SLIDERBASE), _R(IDB_SLIDERSLIDER));
01436 SetGadgetRange(_R(IDC_BFXDLG_COLOUR), -127, 127, 1);
01437 SetGadgetBitmaps(_R(IDC_BFXDLG_COLOUR), _R(IDB_SLIDERBASE), _R(IDB_SLIDERSLIDER));
01438 SetLongGadgetValue(_R(IDC_BFXDLG_BRIGHTNESS), 0);
01439 SetLongGadgetValue(_R(IDC_BFXDLG_CONTRAST), 0);
01440 SetLongGadgetValue(_R(IDC_BFXDLG_COLOUR), 0);
01441 break;
01442
01443
01444 case DIM_LFT_BN_CLICKED:
01445 case DIM_SELECTION_CHANGED:
01446 {
01447 switch (Msg->GadgetID)
01448 {
01449 case _R(IDC_BFXDLG_BRIGHTNESS):
01450 case _R(IDC_BFXDLG_CONTRAST):
01451 case _R(IDC_BFXDLG_COLOUR):
01452 SetDirty();
01453 break;
01454 default:
01455 break;
01456 }
01457 }
01458 break;
01459
01460 case DIM_SLIDER_POS_SET:
01461 case DIM_SLIDER_POS_IDLE:
01462 m_UseInitial = FALSE;
01463 case DIM_SOFT_COMMIT:
01464 case DIM_COMMIT:
01465 {
01466 INT32 Brightness = -GetLongGadgetValue(_R(IDC_BFXDLG_BRIGHTNESS),-127,127);
01467 INT32 Contrast = -GetLongGadgetValue(_R(IDC_BFXDLG_CONTRAST),-127,127);
01468 INT32 Colour = -GetLongGadgetValue(_R(IDC_BFXDLG_COLOUR),-127,127);
01469 if (Msg->DlgMsg == DIM_SLIDER_POS_SET || Msg->DlgMsg == DIM_SLIDER_POS_IDLE)
01470 {
01471 if (InteractiveBCC)
01472 {
01473 if ((!pFX) || (!pFX->IsKindOf(CC_RUNTIME_CLASS(ABFXBrightnessContrast))) ||
01474 (Brightness!=Param1) || (Contrast!=Param2) || (Colour!=Param3))
01475 {
01476 *pCommitValues = TRUE;
01477 *pEndDialog = FALSE;
01478 SetDirty(FALSE);
01479 }
01480 else break;
01481 }
01482 else
01483 {
01484 SetDirty();
01485 break;
01486 }
01487 }
01488 SetEffect(CC_RUNTIME_CLASS(ABFXBrightnessContrast));
01489 SetParameters(Brightness, Contrast, Colour);
01490 }
01491 break;
01492
01493 }
01494 }
01495
01496
01497
01498
01499
01500
01501
01502
01503
01504
01505
01506
01507
01508
01509
01510
01511
01512 void BfxPlugInDlg::HandleDitherMsg(DialogMsg* Msg, BOOL *pCommitValues, BOOL *pEndDialog)
01513 {
01514
01515 switch(Msg->DlgMsg)
01516 {
01517 case DIM_CREATE:
01518 SetLongGadgetValue(_R(IDC_BFXDLG_BAYERMONO), TRUE);
01519 SetLongGadgetValue(_R(IDC_BFXDLG_HALFTONEMONO), FALSE);
01520 SetLongGadgetValue(_R(IDC_BFXDLG_DIFFUSIONMONO), FALSE);
01521 SetLongGadgetValue(_R(IDC_BFXDLG_BAYERCOLOUR), FALSE);
01522 SetLongGadgetValue(_R(IDC_BFXDLG_DIFFUSIONCOLOUR), FALSE);
01523 SetLongGadgetValue(_R(IDC_BFXDLG_POPULARITY), FALSE);
01524 SetLongGadgetValue(_R(IDC_BFXDLG_MAKEGREYSCALE), FALSE);
01525 SetLongGadgetValue(_R(IDC_BFXDLG_OCTREECOLOUR), FALSE);
01526
01527
01528
01529
01530
01531
01532 break;
01533
01534 case DIM_LFT_BN_CLICKED:
01535 case DIM_SELECTION_CHANGED:
01536 {
01537 m_UseInitial = FALSE;
01538 switch (Msg->GadgetID)
01539 {
01540 case _R(IDC_BFXDLG_BAYERMONO):
01541 case _R(IDC_BFXDLG_HALFTONEMONO):
01542 case _R(IDC_BFXDLG_DIFFUSIONMONO):
01543 case _R(IDC_BFXDLG_BAYERCOLOUR):
01544 case _R(IDC_BFXDLG_DIFFUSIONCOLOUR):
01545 case _R(IDC_BFXDLG_POPULARITY):
01546 case _R(IDC_BFXDLG_MAKEGREYSCALE):
01547 case _R(IDC_BFXDLG_OCTREECOLOUR):
01548 SetDirty();
01549 break;
01550 default:
01551 break;
01552 }
01553 }
01554
01555 *pCommitValues = TRUE;
01556
01557 case DIM_SOFT_COMMIT:
01558 case DIM_COMMIT:
01559 {
01560 if (GetBoolGadgetSelected(_R(IDC_BFXDLG_BAYERMONO) )) SetEffect(CC_RUNTIME_CLASS(ABFXBayerMono));
01561 if (GetBoolGadgetSelected(_R(IDC_BFXDLG_HALFTONEMONO) )) SetEffect(CC_RUNTIME_CLASS(ABFXHalftoneMono));
01562 if (GetBoolGadgetSelected(_R(IDC_BFXDLG_DIFFUSIONMONO) )) SetEffect(CC_RUNTIME_CLASS(ABFXDiffusionMono));
01563 if (GetBoolGadgetSelected(_R(IDC_BFXDLG_BAYERCOLOUR) )) SetEffect(CC_RUNTIME_CLASS(ABFXBayerColour));
01564 if (GetBoolGadgetSelected(_R(IDC_BFXDLG_DIFFUSIONCOLOUR))) SetEffect(CC_RUNTIME_CLASS(ABFXDiffusionColour));
01565 if (GetBoolGadgetSelected(_R(IDC_BFXDLG_POPULARITY) )) SetEffect(CC_RUNTIME_CLASS(ABFXPopularityColour));
01566 if (GetBoolGadgetSelected(_R(IDC_BFXDLG_MAKEGREYSCALE) )) SetEffect(CC_RUNTIME_CLASS(ABFXMakeGreyscale));
01567 if (GetBoolGadgetSelected(_R(IDC_BFXDLG_OCTREECOLOUR) )) SetEffect(CC_RUNTIME_CLASS(ABFXOctree));
01568 }
01569 break;
01570
01571 }
01572 }
01573
01574
01575
01576
01577
01578
01579
01580
01581
01582
01583
01584
01585
01586
01587
01588
01589
01590
01591 void BfxPlugInDlg::HandleSpecialEffectsMsg(DialogMsg* Msg, BOOL *pCommitValues, BOOL *pEndDialog)
01592 {
01593
01594 switch(Msg->DlgMsg)
01595 {
01596 case DIM_CREATE:
01597 {
01598 SetLongGadgetValue(_R(IDC_BFXDLG_EFFECTCOMBO), 0);
01599 SetLongGadgetValue(_R(IDC_BFXDLG_CUSTOM1), (INT32)(Matrix[0]+0.5));
01600 SetLongGadgetValue(_R(IDC_BFXDLG_CUSTOM2), (INT32)(Matrix[1]+0.5));
01601 SetLongGadgetValue(_R(IDC_BFXDLG_CUSTOM3), (INT32)(Matrix[2]+0.5));
01602 SetLongGadgetValue(_R(IDC_BFXDLG_CUSTOM4), (INT32)(Matrix[3]+0.5));
01603 SetLongGadgetValue(_R(IDC_BFXDLG_CUSTOM5), (INT32)(Matrix[4]+0.5));
01604 SetLongGadgetValue(_R(IDC_BFXDLG_CUSTOM6), (INT32)(Matrix[5]+0.5));
01605 SetLongGadgetValue(_R(IDC_BFXDLG_CUSTOM7), (INT32)(Matrix[6]+0.5));
01606 SetLongGadgetValue(_R(IDC_BFXDLG_CUSTOM8), (INT32)(Matrix[7]+0.5));
01607 SetLongGadgetValue(_R(IDC_BFXDLG_CUSTOM9), (INT32)(Matrix[8]+0.5));
01608 SetGadgetRange(_R(IDC_BFXDLG_AMOUNT), 0, 127, 1);
01609 SetGadgetBitmaps(_R(IDC_BFXDLG_AMOUNT), _R(IDB_QUALITYBASE), _R(IDB_QUALITYSLIDER));
01610 SetLongGadgetValue(_R(IDC_BFXDLG_AMOUNT), 64);
01611
01612 DeleteAllValues(_R(IDC_BFXDLG_EFFECTCOMBO));
01613
01614 String_256 Str0(_R(IDS_BFXDLG_EFFECTMENU0));
01615 String_256 Str1(_R(IDS_BFXDLG_EFFECTMENU1));
01616 String_256 Str2(_R(IDS_BFXDLG_EFFECTMENU2));
01617 String_256 Str3(_R(IDS_BFXDLG_EFFECTMENU3));
01618 String_256 Str4(_R(IDS_BFXDLG_EFFECTMENU4));
01619 String_256 Str5(_R(IDS_BFXDLG_EFFECTMENU5));
01620 String_256 Str6(_R(IDS_BFXDLG_EFFECTMENU6));
01621 String_256 Str7(_R(IDS_BFXDLG_EFFECTMENU7));
01622 String_256 Str8(_R(IDS_BFXDLG_EFFECTMENU8));
01623 String_256 Str9(_R(IDS_BFXDLG_EFFECTMENU9));
01624 String_256 Str10(_R(IDS_BFXDLG_EFFECTMENU10));
01625 String_256 Str11(_R(IDS_BFXDLG_EFFECTMENU11));
01626 String_256 Str12(_R(IDS_BFXDLG_EFFECTMENU12));
01627 String_256 Str13(_R(IDS_BFXDLG_EFFECTMENU13));
01628 String_256 Str14(_R(IDS_BFXDLG_EFFECTMENU14));
01629 String_256 Str15(_R(IDS_BFXDLG_EFFECTMENU15));
01630 String_256 Str16(_R(IDS_BFXDLG_EFFECTMENU16));
01631 String_256 Str17(_R(IDS_BFXDLG_EFFECTMENU17));
01632 String_256 Str18(_R(IDS_BFXDLG_EFFECTMENU18));
01633 String_256 Str19(_R(IDS_BFXDLG_EFFECTMENU19));
01634
01635 SetStringGadgetValue(_R(IDC_BFXDLG_EFFECTCOMBO),&Str0,FALSE, 0);
01636 SetStringGadgetValue(_R(IDC_BFXDLG_EFFECTCOMBO),&Str1,FALSE, 1);
01637 SetStringGadgetValue(_R(IDC_BFXDLG_EFFECTCOMBO),&Str2,FALSE, 2);
01638 SetStringGadgetValue(_R(IDC_BFXDLG_EFFECTCOMBO),&Str3,FALSE, 3);
01639 SetStringGadgetValue(_R(IDC_BFXDLG_EFFECTCOMBO),&Str4,FALSE, 4);
01640 SetStringGadgetValue(_R(IDC_BFXDLG_EFFECTCOMBO),&Str5,FALSE, 5);
01641 SetStringGadgetValue(_R(IDC_BFXDLG_EFFECTCOMBO),&Str6,FALSE, 6);
01642 SetStringGadgetValue(_R(IDC_BFXDLG_EFFECTCOMBO),&Str7,FALSE, 7);
01643 SetStringGadgetValue(_R(IDC_BFXDLG_EFFECTCOMBO),&Str8,FALSE, 8);
01644 SetStringGadgetValue(_R(IDC_BFXDLG_EFFECTCOMBO),&Str9,FALSE, 9);
01645 SetStringGadgetValue(_R(IDC_BFXDLG_EFFECTCOMBO),&Str10,FALSE, 10);
01646 SetStringGadgetValue(_R(IDC_BFXDLG_EFFECTCOMBO),&Str11,FALSE, 11);
01647 SetStringGadgetValue(_R(IDC_BFXDLG_EFFECTCOMBO),&Str12,FALSE, 12);
01648 SetStringGadgetValue(_R(IDC_BFXDLG_EFFECTCOMBO),&Str13,FALSE, 13);
01649 SetStringGadgetValue(_R(IDC_BFXDLG_EFFECTCOMBO),&Str14,FALSE, 14);
01650 SetStringGadgetValue(_R(IDC_BFXDLG_EFFECTCOMBO),&Str15,FALSE, 15);
01651 if (IsUserName("Neville"))
01652 {
01653 SetStringGadgetValue(_R(IDC_BFXDLG_EFFECTCOMBO),&Str16,FALSE, 16);
01654 SetStringGadgetValue(_R(IDC_BFXDLG_EFFECTCOMBO),&Str17,FALSE, 17);
01655 SetStringGadgetValue(_R(IDC_BFXDLG_EFFECTCOMBO),&Str18,FALSE, 18);
01656 SetStringGadgetValue(_R(IDC_BFXDLG_EFFECTCOMBO),&Str19,FALSE, 19);
01657 }
01658
01659
01660 SetStringGadgetValue(_R(IDC_BFXDLG_EFFECTCOMBO),&Str11, FALSE, -1);
01661 SetComboListLength(_R(IDC_BFXDLG_EFFECTCOMBO));
01662 SetSelectedValueIndex(_R(IDC_BFXDLG_EFFECTCOMBO), 11);
01663 }
01664
01665
01666 case DIM_SLIDER_POS_SET:
01667 if(Msg->DlgMsg != DIM_CREATE)
01668 {
01669 m_UseInitial = FALSE;
01670 }
01671
01672 case DIM_LFT_BN_CLICKED:
01673 case DIM_SELECTION_CHANGED:
01674 case DIM_TEXT_CHANGED:
01675 {
01676 SetDirty();
01677 INT32 Choice = GetSelectedValueIndex(_R(IDC_BFXDLG_EFFECTCOMBO));
01678 BOOL GreyAmount = (Choice <= 9);
01679 BOOL GreyCustom = (Choice != 0);
01680 EnableGadget(_R(IDC_BFXDLG_CUSTOM1), !GreyCustom);
01681 EnableGadget(_R(IDC_BFXDLG_CUSTOM2), !GreyCustom);
01682 EnableGadget(_R(IDC_BFXDLG_CUSTOM3), !GreyCustom);
01683 EnableGadget(_R(IDC_BFXDLG_CUSTOM4), !GreyCustom);
01684 EnableGadget(_R(IDC_BFXDLG_CUSTOM5), !GreyCustom);
01685 EnableGadget(_R(IDC_BFXDLG_CUSTOM6), !GreyCustom);
01686 EnableGadget(_R(IDC_BFXDLG_CUSTOM7), !GreyCustom);
01687 EnableGadget(_R(IDC_BFXDLG_CUSTOM8), !GreyCustom);
01688 EnableGadget(_R(IDC_BFXDLG_CUSTOM9), !GreyCustom);
01689 EnableGadget(_R(IDC_BFXDLG_AMOUNT), !GreyAmount);
01690 EnableGadget(_R(IDC_BFXDLG_AMOUNTTXT), !GreyAmount);
01691 }
01692
01693 if (Msg->DlgMsg == DIM_CREATE) break; else *pCommitValues = TRUE;
01694
01695 case DIM_SOFT_COMMIT:
01696 m_UseInitial = FALSE;
01697 case DIM_COMMIT:
01698 {
01699 INT32 Choice = GetSelectedValueIndex(_R(IDC_BFXDLG_EFFECTCOMBO));
01700 Matrix[0]=GetDoubleGadgetValue(_R(IDC_BFXDLG_CUSTOM1),-255.0,255.0);
01701 Matrix[1]=GetDoubleGadgetValue(_R(IDC_BFXDLG_CUSTOM2),-255.0,255.0);
01702 Matrix[2]=GetDoubleGadgetValue(_R(IDC_BFXDLG_CUSTOM3),-255.0,255.0);
01703 Matrix[3]=GetDoubleGadgetValue(_R(IDC_BFXDLG_CUSTOM4),-255.0,255.0);
01704 Matrix[4]=GetDoubleGadgetValue(_R(IDC_BFXDLG_CUSTOM5),-255.0,255.0);
01705 Matrix[5]=GetDoubleGadgetValue(_R(IDC_BFXDLG_CUSTOM6),-255.0,255.0);
01706 Matrix[6]=GetDoubleGadgetValue(_R(IDC_BFXDLG_CUSTOM7),-255.0,255.0);
01707 Matrix[7]=GetDoubleGadgetValue(_R(IDC_BFXDLG_CUSTOM8),-255.0,255.0);
01708 Matrix[8]=GetDoubleGadgetValue(_R(IDC_BFXDLG_CUSTOM9),-255.0,255.0);
01709
01710 switch (Choice)
01711 {
01712 case 0:
01713 case 1:
01714 case 2:
01715 case 3:
01716 case 4:
01717 case 5:
01718 case 6:
01719 case 7:
01720 case 8:
01721 case 9:
01722 SetEffect(CC_RUNTIME_CLASS(ABFXSpecialEffect));
01723 SetParameters((INT32) Choice);
01724 break;
01725 case 10:
01726 SetEffect(CC_RUNTIME_CLASS(ABFXSharpenBlur));
01727 SetParameters(((INT32) 127-GetLongGadgetValue(_R(IDC_BFXDLG_AMOUNT),0,127)), 1);
01728 break;
01729 case 11:
01730 SetEffect(CC_RUNTIME_CLASS(ABFXSharpenBlur));
01731 SetParameters(((INT32) 127-GetLongGadgetValue(_R(IDC_BFXDLG_AMOUNT),0,127)), 2);
01732 break;
01733 case 12:
01734 SetEffect(CC_RUNTIME_CLASS(ABFXSharpenBlur));
01735 SetParameters(((INT32) 127-GetLongGadgetValue(_R(IDC_BFXDLG_AMOUNT),0,127)), 3);
01736 break;
01737 case 13:
01738 SetEffect(CC_RUNTIME_CLASS(ABFXSharpenBlur));
01739 SetParameters(((INT32) GetLongGadgetValue(_R(IDC_BFXDLG_AMOUNT),0,127))-127, 1);
01740 break;
01741 case 14:
01742 SetEffect(CC_RUNTIME_CLASS(ABFXSharpenBlur));
01743 SetParameters(((INT32) GetLongGadgetValue(_R(IDC_BFXDLG_AMOUNT),0,127))-127, 2);
01744 break;
01745 case 15:
01746 SetEffect(CC_RUNTIME_CLASS(ABFXSharpenBlur));
01747 SetParameters(((INT32) GetLongGadgetValue(_R(IDC_BFXDLG_AMOUNT),0,127))-127, 3);
01748 break;
01749 case 16:
01750 case 17:
01751 case 18:
01752 case 19:
01753 SetEffect(CC_RUNTIME_CLASS(ABFXRemoveDither));
01754 SetParameters((127-((INT32) GetLongGadgetValue(_R(IDC_BFXDLG_AMOUNT),0,127)))<<1, 30, Choice-16);
01755 break;
01756 }
01757 }
01758
01759 }
01760 }
01761
01762
01763
01764
01765
01766
01767
01768
01769
01770
01771
01772
01773
01774
01775
01776
01777
01778
01779 void BfxPlugInDlg::HandleAlchemistMsg(DialogMsg* Msg, BOOL *pCommitValues, BOOL *pEndDialog)
01780 {
01781
01782 switch(Msg->DlgMsg)
01783 {
01784 case DIM_CREATE:
01785 {
01786 SetLongGadgetValue(_R(IDC_BFXDLG_ALC_HUE_CHECK), TRUE);
01787 SetLongGadgetValue(_R(IDC_BFXDLG_ALC_SATURATION_CHECK), TRUE);
01788 SetLongGadgetValue(_R(IDC_BFXDLG_ALC_VALUE_CHECK), TRUE);
01789 SetLongGadgetValue(_R(IDC_BFXDLG_ALC_RAINBOW_CHECK), TRUE);
01790 SetLongGadgetValue(_R(IDC_BFXDLG_ALC_VARIATION_CHECK), TRUE);
01791 SetLongGadgetValue(_R(IDC_BFXDLG_ALC_SHAPES_CHECK), TRUE);
01792 SetLongGadgetValue(_R(IDC_BFXDLG_ALC_STYLE_CHECK), TRUE);
01793 SetLongGadgetValue(_R(IDC_BFXDLG_ALC_OPACITY_CHECK), TRUE);
01794 SetLongGadgetValue(_R(IDC_BFXDLG_ALC_GRAIN_CHECK), TRUE);
01795
01796 SetGadgetRange (_R(IDC_BFXDLG_ALC_HUE_SLIDER), 0, 127, 1);
01797 SetGadgetBitmaps (_R(IDC_BFXDLG_ALC_HUE_SLIDER), _R(IDB_QUALITYBASE), _R(IDB_QUALITYSLIDER));
01798 SetLongGadgetValue(_R(IDC_BFXDLG_ALC_HUE_SLIDER), 64);
01799 SetGadgetRange (_R(IDC_BFXDLG_ALC_SATURATION_SLIDER), 0, 127, 1);
01800 SetGadgetBitmaps (_R(IDC_BFXDLG_ALC_SATURATION_SLIDER), _R(IDB_QUALITYBASE), _R(IDB_QUALITYSLIDER));
01801 SetLongGadgetValue(_R(IDC_BFXDLG_ALC_SATURATION_SLIDER), 64);
01802 SetGadgetRange (_R(IDC_BFXDLG_ALC_VALUE_SLIDER), 0, 127, 1);
01803 SetGadgetBitmaps (_R(IDC_BFXDLG_ALC_VALUE_SLIDER), _R(IDB_QUALITYBASE), _R(IDB_QUALITYSLIDER));
01804 SetLongGadgetValue(_R(IDC_BFXDLG_ALC_VALUE_SLIDER), 64);
01805 SetGadgetRange (_R(IDC_BFXDLG_ALC_RAINBOW_SLIDER), 0, 127, 1);
01806 SetGadgetBitmaps (_R(IDC_BFXDLG_ALC_RAINBOW_SLIDER), _R(IDB_QUALITYBASE), _R(IDB_QUALITYSLIDER));
01807 SetLongGadgetValue(_R(IDC_BFXDLG_ALC_RAINBOW_SLIDER), 64);
01808 SetGadgetRange (_R(IDC_BFXDLG_ALC_VARIATION_SLIDER), 0, 127, 1);
01809 SetGadgetBitmaps (_R(IDC_BFXDLG_ALC_VARIATION_SLIDER), _R(IDB_QUALITYBASE), _R(IDB_QUALITYSLIDER));
01810 SetLongGadgetValue(_R(IDC_BFXDLG_ALC_VARIATION_SLIDER), 64);
01811 SetGadgetRange (_R(IDC_BFXDLG_ALC_SHAPES_SLIDER), 0, 127, 1);
01812 SetGadgetBitmaps (_R(IDC_BFXDLG_ALC_SHAPES_SLIDER), _R(IDB_QUALITYBASE), _R(IDB_QUALITYSLIDER));
01813 SetLongGadgetValue(_R(IDC_BFXDLG_ALC_SHAPES_SLIDER), 64);
01814 SetGadgetRange (_R(IDC_BFXDLG_ALC_STYLE_SLIDER), 0, 127, 1);
01815 SetGadgetBitmaps (_R(IDC_BFXDLG_ALC_STYLE_SLIDER), _R(IDB_QUALITYBASE), _R(IDB_QUALITYSLIDER));
01816 SetLongGadgetValue(_R(IDC_BFXDLG_ALC_STYLE_SLIDER), 64);
01817 SetGadgetRange (_R(IDC_BFXDLG_ALC_OPACITY_SLIDER), 0, 127, 1);
01818 SetGadgetBitmaps (_R(IDC_BFXDLG_ALC_OPACITY_SLIDER), _R(IDB_QUALITYBASE), _R(IDB_QUALITYSLIDER));
01819 SetLongGadgetValue(_R(IDC_BFXDLG_ALC_OPACITY_SLIDER), 64);
01820 SetGadgetRange (_R(IDC_BFXDLG_ALC_GRAIN_SLIDER), 0, 127, 1);
01821 SetGadgetBitmaps (_R(IDC_BFXDLG_ALC_GRAIN_SLIDER), _R(IDB_QUALITYBASE), _R(IDB_QUALITYSLIDER));
01822 SetLongGadgetValue(_R(IDC_BFXDLG_ALC_GRAIN_SLIDER), 64);
01823
01824 }
01825 break;
01826
01827 case DIM_SLIDER_POS_SET:
01828
01829 case DIM_LFT_BN_CLICKED:
01830 case DIM_SELECTION_CHANGED:
01831 case DIM_TEXT_CHANGED:
01832 {
01833 SetDirty();
01834 }
01835
01836 *pCommitValues = TRUE;
01837
01838 case DIM_SOFT_COMMIT:
01839 case DIM_COMMIT:
01840 {
01841 }
01842 break;
01843
01844 }
01845 }
01846
01847
01848
01849
01850
01851
01852
01853
01854
01855
01856
01857
01858
01859
01860
01861
01862
01863
01864
01865 OpState BfxPlugInDlg::GetState(String_256*, OpDescriptor*)
01866 {
01867 OpState OpSt;
01868 return(OpSt);
01869 }
01870
01871
01872
01873
01874
01875
01876
01877
01878
01879
01880
01881
01882
01883
01884
01885
01886
01887
01888 BOOL BfxPlugInDlg::Init()
01889 {
01890 GetApplication()->DeclareSection( "Bitmap Effects", 1);
01891 GetApplication()->DeclarePref( "Bitmap Effects", "Interactive Brightness & Contrast", &InteractiveBCC, FALSE, TRUE);
01892
01893 BOOL ok = TRUE;
01894 ok = ok && RegisterOpDescriptor(
01895 0,
01896 _R(IDS_BFXDLGM),
01897 CC_RUNTIME_CLASS(BfxBrightnessContrastDlg),
01898 OPTOKEN_BFXDLG_BRIGHTNESSCONTRAST,
01899 BfxPlugInDlg::GetState,
01900 0,
01901 NULL,
01902 NULL,
01903 NULL,
01904 SYSTEMBAR_ILLEGAL,
01905 TRUE,
01906 FALSE,
01907 TRUE,
01908 0,
01909 _R(IDS_BFXDLG_ONE),
01910 GREY_WHEN_NO_CURRENT_DOC | DONT_GREY_WHEN_SELECT_INSIDE
01911 );
01912 ok = ok && RegisterOpDescriptor(
01913 0,
01914 _R(IDS_BFXDLGM),
01915 CC_RUNTIME_CLASS(BfxSpecialEffectsDlg),
01916 OPTOKEN_BFXDLG_SPECIALEFFECTS,
01917 BfxPlugInDlg::GetState,
01918 0,
01919 NULL,
01920 NULL,
01921 NULL,
01922 SYSTEMBAR_ILLEGAL,
01923 TRUE,
01924 FALSE,
01925 TRUE,
01926 0,
01927 _R(IDS_BFXDLG_ONE),
01928 GREY_WHEN_NO_CURRENT_DOC | DONT_GREY_WHEN_SELECT_INSIDE
01929 );
01930 ok = ok && RegisterOpDescriptor(
01931 0,
01932 _R(IDS_BFXDLGM),
01933 CC_RUNTIME_CLASS(BfxResizeDlg),
01934 OPTOKEN_BFXDLG_RESIZE,
01935 BfxPlugInDlg::GetState,
01936 0,
01937 NULL,
01938 NULL,
01939 NULL,
01940 SYSTEMBAR_ILLEGAL,
01941 TRUE,
01942 FALSE,
01943 TRUE,
01944 0,
01945 _R(IDS_BFXDLG_ONE),
01946 GREY_WHEN_NO_CURRENT_DOC | DONT_GREY_WHEN_SELECT_INSIDE
01947 );
01948 ok = ok && RegisterOpDescriptor(
01949 0,
01950 _R(IDS_BFXDLGM),
01951 CC_RUNTIME_CLASS(BfxFlipAndRotateDlg),
01952 OPTOKEN_BFXDLG_FLIPROTATE,
01953 BfxPlugInDlg::GetState,
01954 0,
01955 NULL,
01956 NULL,
01957 NULL,
01958 SYSTEMBAR_ILLEGAL,
01959 TRUE,
01960 FALSE,
01961 TRUE,
01962 0,
01963 _R(IDS_BFXDLG_ONE),
01964 GREY_WHEN_NO_CURRENT_DOC | DONT_GREY_WHEN_SELECT_INSIDE
01965 );
01966 ok = ok && RegisterOpDescriptor(
01967 0,
01968 _R(IDS_BFXDLGM),
01969 CC_RUNTIME_CLASS(BfxColourDepthDlg),
01970 OPTOKEN_BFXDLG_COLOURDEPTH,
01971 BfxPlugInDlg::GetState,
01972 0,
01973 NULL,
01974 NULL,
01975 NULL,
01976 SYSTEMBAR_ILLEGAL,
01977 TRUE,
01978 FALSE,
01979 TRUE,
01980 0,
01981 _R(IDS_BFXDLG_ONE),
01982 GREY_WHEN_NO_CURRENT_DOC | DONT_GREY_WHEN_SELECT_INSIDE
01983 );
01984
01985 ok = ok && BfxOp::Init();
01986
01987 return ok;
01988 }
01989
01990
01991
01992
01993
01994
01995
01996
01997
01998
01999
02000
02001
02002
02003
02004
02005 void BfxPlugInDlg::Do(OpDescriptor*)
02006 {
02007
02008
02009 BOOL ok = Create();
02010 if (!ok)
02011 {
02012 ;
02013 OpenPage=0;
02014 End();
02015 }
02016
02017
02018
02019
02020 }
02021
02022
02023
02024
02025
02026
02027
02028
02029
02030
02031
02032
02033
02034
02035
02036
02037
02038
02039 void BfxPlugInDlg::DoWithParam(OpDescriptor* pOp, OpParam* pParam)
02040 {
02041
02042 m_pParam = pParam;
02043
02044 KernelBitmap * pBitmap = NULL;
02045 if (pParam)
02046 {
02047 pBitmap = (KernelBitmap *)(void *)(pParam->Param1);
02048 m_pDocument = (Document*)(pParam->Param2);
02049 }
02050
02051 if (pBitmap && pBitmap->IsKindOf(CC_RUNTIME_CLASS(KernelBitmap)))
02052 {
02053
02054 Do(pOp);
02055
02056 OriginalChanged();
02057 }
02058
02059 return;
02060 }
02061