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
00104 #include "camtypes.h"
00105
00106 #include "colourix.h"
00107 #include "csrstack.h"
00108 #include "osrndrgn.h"
00109
00110 #include "blobs.h"
00111
00112
00113
00114 #include "oilfiles.h"
00115
00116 #include "filltool.h"
00117 #include "opgrad.h"
00118 #include "toollist.h"
00119
00120
00121 #include "bitmpinf.h"
00122
00123 #include "ophist.h"
00124 #include "keypress.h"
00125 #include "opnudge.h"
00126 #include "fillndge.h"
00127
00128
00129
00130 #include "bmpcomp.h"
00131 #include "bubbleid.h"
00132
00133
00134
00135 #include "nodeshad.h"
00136
00137 #include "objchge.h"
00138 #include "layer.h"
00139
00140 #include "opliveeffects.h"
00141 #include "effects_stack.h"
00142 #include "nodeliveeffect.h"
00143
00144
00145 DECLARE_SOURCE( "$Revision: 1730 $" );
00146
00147
00148 TCHAR* GradFillTool::FamilyName = _T("Fill Tools");
00149 TCHAR* GradFillTool::ToolName = _T("Graduated Fill Tool");
00150 TCHAR* GradFillTool::Purpose = _T("Graduated Filling of Objects");
00151 TCHAR* GradFillTool::Author = _T("Will");
00152
00153 TCHAR* TranspTool::FamilyName = _T("Fill Tools");
00154 TCHAR* TranspTool::ToolName = _T("Transparency Tool");
00155 TCHAR* TranspTool::Purpose = _T("Alter the transparency of objects");
00156 TCHAR* TranspTool::Author = _T("Will");
00157
00158 INT32 GradInfoBarOp::CurrentGeometryIndex;
00159 INT32 GradInfoBarOp::CurrentMappingIndex;
00160 INT32 GradInfoBarOp::CurrentEffectIndex;
00161
00162 INT32 TranspInfoBarOp::CurrentGeometryIndex;
00163 INT32 TranspInfoBarOp::CurrentTransTypeIndex;
00164 INT32 TranspInfoBarOp::CurrentMappingIndex;
00165 INT32 TranspInfoBarOp::CurrentTypeIndex;
00166 INT32 TranspInfoBarOp::CurrentBitmapIndex;
00167
00168 GradInfoBarOp* GradFillTool::pGradInfoBarOp;
00169 TranspInfoBarOp* GradFillTool::pTranspInfoBarOp;
00170
00171 UINT32 GradFillTool::LastStatusID;
00172 BOOL GradFillTool::CurrentTool;
00173
00174 TranspInfoBarOp* TranspTool::pTranspInfoBarOp;
00175
00176 UINT32 TranspTool::LastStatusID;
00177 BOOL TranspTool::CurrentTool;
00178
00179 BOOL GradFillTool::AllowFillNudges = TRUE;
00180
00181 BOOL GradFillTool::NudgeFills = FALSE;
00182 BOOL TranspTool::NudgeFills = FALSE;
00183
00184 static INT32 TempGeometryIndex = -1;
00185
00186 CC_IMPLEMENT_MEMDUMP( GradFillTool, Tool_v1 )
00187 CC_IMPLEMENT_MEMDUMP( TranspTool, Tool_v1 )
00188 CC_IMPLEMENT_DYNCREATE( GradInfoBarOp, InformationBarOp )
00189 CC_IMPLEMENT_DYNCREATE( TranspInfoBarOp, InformationBarOp )
00190
00191 CC_IMPLEMENT_DYNCREATE( AttrRemoveTransp, AttrTranspChange )
00192 CC_IMPLEMENT_DYNCREATE( AttrRemoveStrokeTransp, AttrValueChange )
00193 CC_IMPLEMENT_DYNCREATE( AttrMakeFlatTransp, AttrTranspChange )
00194
00195 CC_IMPLEMENT_DYNCREATE( FillProfileOpParam, OpParam)
00196 CC_IMPLEMENT_DYNCREATE( OpChangeFillProfile, SelOperation)
00197 CC_IMPLEMENT_DYNCREATE( ChangeFillProfileAction, Action)
00198 CC_IMPLEMENT_DYNCREATE( TranspFillProfileOpParam, OpParam)
00199 CC_IMPLEMENT_DYNCREATE( OpChangeTranspFillProfile, SelOperation)
00200 CC_IMPLEMENT_DYNCREATE( ChangeTranspFillProfileAction, Action)
00201
00202
00203 #define new CAM_DEBUG_NEW
00204
00205
00206
00207
00208
00209
00210
00211
00212
00213
00214
00215
00218
00219
00220
00223
00224
00225
00226
00227
00228
00229
00230
00231
00232
00233
00234
00235
00236
00237
00238
00239
00240
00241
00242
00243
00244
00245
00246
00247
00248
00249
00250
00251
00252
00253
00254
00255
00256
00257
00258
00259
00260
00261
00262
00263
00264
00265
00266
00267
00268
00269
00270
00271
00272
00273
00274
00275
00276
00277
00278
00279
00280
00281
00282
00283
00284
00285
00286
00287
00288
00289
00290
00291
00292
00293
00294
00295
00296
00297
00298
00299
00300
00301
00302
00303
00304
00305
00306
00307
00308
00309
00310
00311
00312
00313
00314
00315
00316
00317
00318
00319
00320
00321
00322
00323
00324
00325
00326
00327
00328
00329
00330
00331
00332
00333
00334
00335
00336
00337
00338
00339
00340
00341
00342
00343
00344
00345
00346
00347
00348
00349
00350
00351
00352
00353
00354
00355
00356
00357
00358
00359
00360
00361
00362
00363
00364
00365
00366
00367
00368
00369
00370
00371
00372
00373
00374
00375
00376
00377
00378
00379
00380
00381
00382
00383
00384
00385
00386
00387
00388
00389
00390
00391
00392
00393
00394
00395
00396
00397
00398
00399
00400
00401
00402
00403
00404
00405
00406
00407
00408
00409
00410
00411
00412
00413
00414
00415
00416
00417
00418
00419
00420
00421
00422
00423
00424
00425
00426
00427
00428
00429
00430
00431
00432
00433
00434
00435
00436
00437
00438
00439
00440
00441
00442
00443
00444
00445
00446
00447
00448
00449
00450
00451
00452
00453
00454
00455
00456
00457
00458
00459
00460
00461
00462
00463
00464
00465
00466 BOOL FillTools::IsNodeInList(List * pList, const Node * pNode)
00467 {
00468 NodeListItem * pItem = (NodeListItem * )pList->GetHead();
00469
00470 while (pItem)
00471 {
00472 if (pItem->pNode == pNode)
00473 return TRUE;
00474
00475 pItem = (NodeListItem * )pList->GetNext(pItem);
00476 }
00477
00478 return FALSE;
00479 }
00480
00481
00482
00483
00484
00485
00486
00487
00488
00489
00490
00491
00492
00493
00494
00495
00496
00497
00498
00499
00500
00501
00502
00503
00504
00505
00506
00507
00508
00509
00510
00511
00512
00513
00514
00515
00516
00517
00518
00519
00520
00521 BOOL FillTools::GetSelectedAttrList(List* pList,
00522 const CCRuntimeClass* pClass,
00523 BOOL bGradFill,
00524 BOOL bTranspFill,
00525 EffectsStack* pUseThisStack)
00526 {
00527 ERROR2IF(pList==NULL, FALSE, "GetSelectedAttrList passed NULL list pointer");
00528 ERROR2IF(pClass==NULL, FALSE, "GetSelectedAttrList passed NULL class pointer");
00529
00530 EffectsStack* pStack = NULL;
00531
00532 if (pUseThisStack != NULL)
00533 pStack = pUseThisStack;
00534 else
00535 pStack = GetApplication()->FindSelection()->GetEffectsStack();
00536
00537 ENSURE(pStack, "Can't find PostProStack");
00538
00539 INT32 iStackPos = STACKPOS_TOP;
00540 Range* pLevelRange = pStack->GetLevelRange(&iStackPos, FALSE);
00541 if (pLevelRange == NULL)
00542 return FALSE;
00543
00544 Node* pNode = pLevelRange->FindFirst();
00545 while (pNode)
00546 {
00547 if (pNode->IsAnObject())
00548 {
00549 NodeAttribute* pAttr = ((NodeRenderableInk*)pNode)->FindAppliedAttribute((CCRuntimeClass*)pClass);
00550 if (pAttr && !pAttr->IsADefaultAttr() && pAttr->IsAGradFill()==bGradFill && pAttr->IsATranspFill()==bTranspFill)
00551 {
00552 NodeListItem * pItem = new NodeListItem;
00553 if (pItem)
00554 {
00555 pItem->pNode = pAttr;
00556 pList->AddTail(pItem);
00557 }
00558 else
00559 {
00560 pList->DeleteAll();
00561 return FALSE;
00562 }
00563 }
00564 }
00565
00566 pNode = pLevelRange->FindNext(pNode);
00567 }
00568
00569 return TRUE;
00570 }
00571
00572
00575
00576
00577
00580
00581
00582
00583
00584
00585
00586
00587
00588
00589
00590
00591
00592
00593 GradFillTool::GradFillTool()
00594 {
00595 ClickStart = DocCoord(0,0);
00596 IsSelection = FALSE;
00597 StartSpread = NULL;
00598 pGradFillCursor = NULL;
00599 CurrentCursorID = 0;
00600
00601 NudgeFills = FALSE;
00602 }
00603
00604
00605
00606
00607
00608
00609
00610
00611
00612
00613
00614 GradFillTool::~GradFillTool()
00615 {
00616
00617 }
00618
00619
00620
00621
00622
00623
00624
00625
00626
00627
00628
00629
00630
00631 BOOL GradFillTool::Init()
00632 {
00633 BOOL ok = TRUE;
00634
00635 ok = OpChangeFillProfile::Declare();
00636
00637 #if 0
00638 if (ok)
00639 {
00640
00641 CCResTextFile file;
00642 GradInfoBarOpCreate BarCreate;
00643
00644 ok = file.open(_R(IDM_GRAD_BAR), _R(IDT_INFO_BAR_RES));
00645 if (ok) ok = DialogBarOp::ReadBarsFromFile(file,BarCreate);
00646 if (ok) file.close();
00647
00648 ENSURE(ok,"Unable to load gradbar.ini from resource\n");
00649 String_32 str = String_32(_R(IDS_FILLTOOL_FILLINFOBARNAME));
00650 DialogBarOp* pDialogBarOp = DialogBarOp::FindDialogBarOp(str);
00651 }
00652 #endif
00653
00654 if (ok)
00655 {
00656
00657 pGradInfoBarOp = new GradInfoBarOp(_R(IDD_GRADFILLDLG));
00658
00659 if (pGradInfoBarOp)
00660 {
00661
00662 pGradInfoBarOp->CurrentGeometryIndex = FGMENU_LINEAR;
00663 pGradInfoBarOp->CurrentMappingIndex = FMMENU_SIMPLE;
00664 pGradInfoBarOp->CurrentEffectIndex = FEMENU_FADE;
00665 } else
00666 ok=FALSE;
00667
00668 ENSURE(ok,"Couldn't find grad tool info bar");
00669 }
00670
00671 return (ok);
00672 }
00673
00674
00675
00676
00677
00678
00679
00680
00681
00682
00683
00684
00685
00686
00687
00688
00689 void GradFillTool::Describe(void *InfoPtr)
00690 {
00691
00692 ToolInfo_v1 *Info = (ToolInfo_v1 *) InfoPtr;
00693
00694 Info -> InfoVersion = 1;
00695
00696 Info -> InterfaceVersion = GetToolInterfaceVersion();
00697
00698
00699 Info -> Version = 1;
00700 Info -> ID = GetID();
00701 Info -> TextID = _R(IDS_GRADFILL_TOOL);
00702 Info -> BubbleID = _R(IDBBL_FILL_TOOL);
00703
00704 Info -> Family = FamilyName;
00705 Info -> Name = ToolName;
00706 Info -> Purpose = Purpose;
00707 Info -> Author = Author;
00708
00709 Info -> InfoBarDialog = 0;
00710 }
00711
00712
00713
00714
00715
00716
00717
00718
00719
00720
00721
00722
00723
00724
00725
00726
00727
00728
00729 void GradFillTool::SelectChange(BOOL isSelected)
00730 {
00731 if (isSelected)
00732 {
00733
00734
00735 pGradFillCursor = new Cursor(this, _R(IDC_GRADTOOLCURSOR));
00736 pGradPointCursor = new Cursor(this, _R(IDC_GRADPOINTCURSOR));
00737
00738
00739 if (!pGradFillCursor || !pGradFillCursor->IsValid())
00740 {
00741 return;
00742 }
00743
00744
00745 if (!pGradPointCursor || !pGradPointCursor->IsValid())
00746 {
00747 return;
00748 }
00749
00750 pCurrentCursor = pGradFillCursor;
00751 CurrentCursorID = CursorStack::GPush(pGradFillCursor, FALSE);
00752
00753
00754 CurrentTool = TRUE;
00755 AttrFillGeometry::SetTranspMeshesVisible(FALSE);
00756
00757
00758 BlobManager* BlobMgr = GetApplication()->GetBlobManager();
00759 if (BlobMgr != NULL)
00760 {
00761
00762 BlobStyle MyBlobs;
00763 MyBlobs.Tiny = TRUE;
00764 MyBlobs.Fill = TRUE;
00765
00766
00767 BlobMgr->ToolInterest(MyBlobs);
00768 }
00769
00770
00771 AttrFillGeometry::SetSelectionCount(AttrFillGeometry::CountSelectionControlPoints());
00772
00773 pGradInfoBarOp->Create();
00774 pGradInfoBarOp->EnableControls ();
00775
00776 if (AttrFillGeometry::SelectionCount > 0)
00777 EnableFillNudge();
00778
00779 TempGeometryIndex = -1;
00780
00781
00782 SelRange *Selected = GetApplication()->FindSelection();
00783
00784
00785 IsSelection = (Document::GetCurrent() != NULL && Selected->Count() > 0);
00786
00787 if (IsSelection)
00788 {
00789 SelectionBox = Selected->GetBoundingRect();
00790
00791 Node* Current = Selected->FindFirst();
00792 if (Current != NULL)
00793 {
00794 Spread *pSpread = Current->FindParentSpread();
00795 RenderToolBlobs(pSpread, NULL);
00796 }
00797 }
00798 }
00799 else
00800 {
00801
00802
00803 DisableFillNudge();
00804
00805
00806 if (pGradFillCursor)
00807 {
00808 CursorStack::GPop(CurrentCursorID);
00809 delete pGradFillCursor;
00810 delete pGradPointCursor;
00811
00812 pCurrentCursor = NULL;
00813 CurrentCursorID = 0;
00814 }
00815
00816 pGradInfoBarOp->CloseProfileDialog (pGradInfoBarOp->m_BiasGainGadget);
00817
00818 pGradInfoBarOp->Delete();
00819
00820 CurrentTool = FALSE;
00821
00822
00823 if (IsSelection && Document::GetCurrent()!=NULL)
00824 {
00825 SelRange *Selected = GetApplication()->FindSelection();
00826 Node *Current = Selected->FindFirst();
00827
00828 if (Current!=NULL)
00829 {
00830 Spread *pSpread = Current->FindParentSpread();
00831 RenderToolBlobs(pSpread, NULL);
00832 }
00833 }
00834
00835
00836 BlobManager* BlobMgr = GetApplication()->GetBlobManager();
00837 if (BlobMgr != NULL)
00838 {
00839 BlobStyle bsRemoves;
00840 bsRemoves.ToolObject = TRUE;
00841 BlobMgr->RemoveInterest(bsRemoves);
00842 }
00843 }
00844 }
00845
00846
00847
00848
00849
00850
00851
00852
00853
00854
00855
00856
00857
00858
00859
00860
00861
00862
00863
00864
00865
00866 void GradFillTool::OnClick( DocCoord PointerPos, ClickType Click, ClickModifiers ClickMods,
00867 Spread* pSpread )
00868 {
00869 if (ClickMods.Menu) return;
00870
00871
00872 if (Operation::GetCurrentDragOp()!=NULL)
00873 return;
00874
00875 if ( AttrFillGeometry::CheckAttrClick(PointerPos, Click, ClickMods, pSpread) )
00876 {
00877
00878
00879
00880
00881
00882
00883 if ( Click == CLICKTYPE_DOUBLE )
00884 {
00885 SelRange *Selected = GetApplication()->FindSelection();
00886 Node *Current = Selected->FindFirst();
00887
00888 if (Current!=NULL)
00889 {
00890 Spread *pSpread2 = Current->FindParentSpread();
00891 RenderToolBlobs(pSpread2, NULL);
00892
00893
00894
00895 AttrFillGeometry::CheckAttrClick(PointerPos, CLICKTYPE_SINGLE, ClickMods, pSpread2);
00896
00897
00898
00899 OnMouseMove (PointerPos, pSpread, ClickMods);
00900 }
00901 }
00902
00903 return;
00904 }
00905
00906
00907 if ( Click == CLICKTYPE_SINGLE )
00908 {
00909 StartPos = PointerPos;
00910 StartSpread = pSpread;
00911 DoubleClicked = FALSE;
00912 }
00913
00914 if ( Click == CLICKTYPE_UP )
00915 {
00916 StartPos = DocCoord(0,0);
00917 StartSpread = NULL;
00918 DoubleClicked = FALSE;
00919 }
00920
00921 if ( Click == CLICKTYPE_DOUBLE )
00922 {
00923 DoubleClicked = TRUE;
00924 }
00925
00926 if ( Click == CLICKTYPE_DRAG )
00927 {
00928 if (StartSpread == NULL)
00929 return;
00930
00931
00932
00933
00934 OpEditFill* pOp = new OpEditFill;
00935 if (pOp == NULL)
00936 {
00937
00938 InformError();
00939 }
00940 else
00941 {
00942 AttrFillGeometry* Fill = NULL;
00943
00944
00945 if (ClickMods.Adjust)
00946 {
00947 Fill = new AttrRadialColourFill;
00948 if (Fill != NULL)
00949 ((AttrRadialFill*)Fill)->MakeCircular();
00950 }
00951 #ifndef WEBSTER
00952 else if (DoubleClicked)
00953 {
00954 Fill = new AttrConicalColourFill;
00955 }
00956 #endif //WEBSTER
00957 else
00958 {
00959 switch (pGradInfoBarOp->CurrentGeometryIndex)
00960 {
00961 case (FGMENU_FLAT):
00962
00963 Fill = new AttrLinearColourFill;
00964 break;
00965
00966 case (FGMENU_LINEAR):
00967 Fill = new AttrLinearColourFill;
00968 break;
00969
00970 case (FGMENU_CIRCULAR):
00971 Fill = new AttrRadialColourFill;
00972 if (Fill != NULL)
00973 ((AttrRadialFill*)Fill)->MakeCircular();
00974 break;
00975
00976 case (FGMENU_RADIAL):
00977 Fill = new AttrRadialColourFill;
00978 break;
00979
00980 case (FGMENU_CONICAL):
00981 Fill = new AttrConicalColourFill;
00982 break;
00983
00984 case (FGMENU_SQUARE):
00985 Fill = new AttrSquareColourFill;
00986 break;
00987
00988 case (FGMENU_THREECOL):
00989 Fill = new AttrThreeColColourFill;
00990 break;
00991
00992 case (FGMENU_FOURCOL):
00993 Fill = new AttrFourColColourFill;
00994 break;
00995
00996 case (FGMENU_BITMAP):
00997 Fill = new AttrBitmapColourFill;
00998
00999 Fill->AttachBitmap(NULL);
01000 Fill->SetTesselation(pGradInfoBarOp->CurrentMappingIndex+1);
01001 break;
01002
01003 case (FGMENU_FRACTAL):
01004 Fill = new AttrFractalColourFill;
01005 Fill->SetTesselation(pGradInfoBarOp->CurrentMappingIndex+1);
01006 break;
01007
01008 case (FGMENU_NOISE):
01009 Fill = new AttrNoiseColourFill;
01010 Fill->SetTesselation(pGradInfoBarOp->CurrentMappingIndex+1);
01011 break;
01012
01013 default:
01014
01015 Fill = new AttrLinearColourFill;
01016 break;
01017 }
01018 }
01019
01020 if (Fill == NULL)
01021 {
01022 InformError();
01023 return;
01024 }
01025
01026 pOp->DoCreate(StartPos, StartSpread, Fill);
01027 }
01028
01029 StartPos = DocCoord(0,0);
01030 StartSpread = NULL;
01031 DoubleClicked = FALSE;
01032 return;
01033 }
01034
01035
01036
01037 DragTool::OnClick (PointerPos, Click, ClickMods, pSpread);
01038 }
01039
01040
01041
01042
01043
01044
01045
01046
01047
01048
01049
01050
01051
01052
01053 void GradFillTool::OnMouseMove(DocCoord Pos, Spread* pSpread, ClickModifiers ClickMods)
01054 {
01055
01056 Cursor* pCursor = pGradFillCursor;
01057 String_256 Status;
01058
01059 if (ClickMods.Adjust)
01060 TempGeometryIndex = FGMENU_CIRCULAR;
01061 else
01062 TempGeometryIndex = -1;
01063
01064 GetCursorAndStatus(Pos, pSpread, &pCursor, &Status);
01065
01066 if (pCursor != pCurrentCursor)
01067 {
01068
01069 pCurrentCursor = pCursor;
01070 CursorStack::GSetTop(pCurrentCursor, CurrentCursorID);
01071 }
01072
01073
01074 GetApplication()->UpdateStatusBarText(&Status);
01075 }
01076
01077
01078
01079
01080
01081
01082
01083
01084
01085
01086
01087
01088
01089
01090
01091
01092 BOOL GradFillTool::OnKeyPress(KeyPress* pKeyPress)
01093 {
01094 if (pKeyPress->GetVirtKey() == CAMKEY(TAB) &&
01095 !pKeyPress->IsRelease() &&
01096 !pKeyPress->IsRepeat())
01097 {
01098
01099 ToggleControlPoints(pKeyPress->IsAdjust());
01100
01101 return TRUE;
01102 }
01103
01104 if ( IsFillNudgeEnabled() &&
01105 (pKeyPress->GetVirtKey() == CAMKEY(UP) ||
01106 pKeyPress->GetVirtKey() == CAMKEY(DOWN) ||
01107 pKeyPress->GetVirtKey() == CAMKEY(LEFT) ||
01108 pKeyPress->GetVirtKey() == CAMKEY(RIGHT)) )
01109 {
01110
01111
01112 if (pKeyPress->IsRelease())
01113 AttributeManager::SendMessages = TRUE;
01114 else
01115 AttributeManager::SendMessages = FALSE;
01116
01117
01118 return FALSE;
01119 }
01120 return FALSE;
01121 }
01122
01123
01124
01125
01126
01127
01128
01129
01130
01131
01132
01133
01134 void GradFillTool::ToggleControlPoints(BOOL Reverse)
01135 {
01136
01137 AttrFillGeometry::LastRenderedStartBlob = DocCoord(0,0);
01138 AttrFillGeometry::LastRenderedEndBlob = DocCoord(0,0);
01139 AttrFillGeometry::LastRenderedEnd2Blob = DocCoord(0,0);
01140 AttrFillGeometry::LastRenderedEnd3Blob = DocCoord(0,0);
01141
01142 AttrFillGeometry* pAttrNode = AttrFillGeometry::FindFirstSelectedAttr();
01143
01144
01145 if (pAttrNode == NULL)
01146 return;
01147
01148
01149 BOOL DoToggle = AttrFillGeometry::FillSelectionCount() > 0;
01150
01151 while (pAttrNode != NULL)
01152 {
01153 if (pAttrNode->IsAColourFill())
01154 {
01155 if (DoToggle)
01156 {
01157
01158 if (pAttrNode->GetSelectionCount() > 0)
01159 {
01160 pAttrNode->CycleSelection(Reverse);
01161 }
01162 }
01163 else
01164 {
01165
01166
01167 pAttrNode->SelectBlob(FILLCONTROL_STARTPOINT);
01168 }
01169 }
01170
01171
01172 pAttrNode = AttrFillGeometry::FindNextSelectedAttr();
01173 }
01174
01175 BROADCAST_TO_ALL(SelChangingMsg(SelChangingMsg::COLOURATTCHANGED));
01176 }
01177
01178
01179
01180
01181
01182
01183
01184
01185
01186
01187
01188
01189 void GradFillTool::EnableFillNudge()
01190 {
01191 if (!GradFillTool::AllowFillNudges || NudgeFills)
01192 return;
01193
01194
01195 OpFillNudge::NudgeColours(TRUE);
01196
01197 OpDescriptor* pOpDesc;
01198
01199 pOpDesc = OpDescriptor::FindOpDescriptor(OPTOKEN_NUDGEUP1) ;
01200 if (pOpDesc) pOpDesc->AliasOperation(CC_RUNTIME_CLASS(OpFillNudgeUp1),NULL,0);
01201 pOpDesc = OpDescriptor::FindOpDescriptor(OPTOKEN_NUDGEUP5);
01202 if (pOpDesc) pOpDesc->AliasOperation(CC_RUNTIME_CLASS(OpFillNudgeUp5),NULL,0);
01203 pOpDesc = OpDescriptor::FindOpDescriptor(OPTOKEN_NUDGEUP10);
01204 if (pOpDesc) pOpDesc->AliasOperation(CC_RUNTIME_CLASS(OpFillNudgeUp10),NULL,0);
01205 pOpDesc = OpDescriptor::FindOpDescriptor(OPTOKEN_NUDGEUPFIFTH);
01206 if (pOpDesc) pOpDesc->AliasOperation(CC_RUNTIME_CLASS(OpFillNudgeUpFifth),NULL,0);
01207 pOpDesc = OpDescriptor::FindOpDescriptor(OPTOKEN_NUDGEUPPIXEL1);
01208 if (pOpDesc) pOpDesc->AliasOperation(CC_RUNTIME_CLASS(OpFillNudgeUpPixel1),NULL,0);
01209 pOpDesc = OpDescriptor::FindOpDescriptor(OPTOKEN_NUDGEUPPIXEL10);
01210 if (pOpDesc) pOpDesc->AliasOperation(CC_RUNTIME_CLASS(OpFillNudgeUpPixel10),NULL,0);
01211
01212 pOpDesc = OpDescriptor::FindOpDescriptor(OPTOKEN_NUDGEDOWN1);
01213 if (pOpDesc) pOpDesc->AliasOperation(CC_RUNTIME_CLASS(OpFillNudgeDown1),NULL,0);
01214 pOpDesc = OpDescriptor::FindOpDescriptor(OPTOKEN_NUDGEDOWN5);
01215 if (pOpDesc) pOpDesc->AliasOperation(CC_RUNTIME_CLASS(OpFillNudgeDown5),NULL,0);
01216 pOpDesc = OpDescriptor::FindOpDescriptor(OPTOKEN_NUDGEDOWN10);
01217 if (pOpDesc) pOpDesc->AliasOperation(CC_RUNTIME_CLASS(OpFillNudgeDown10),NULL,0);
01218 pOpDesc = OpDescriptor::FindOpDescriptor(OPTOKEN_NUDGEDOWNFIFTH);
01219 if (pOpDesc) pOpDesc->AliasOperation(CC_RUNTIME_CLASS(OpFillNudgeDownFifth),NULL,0);
01220 pOpDesc = OpDescriptor::FindOpDescriptor(OPTOKEN_NUDGEDOWNPIXEL1);
01221 if (pOpDesc) pOpDesc->AliasOperation(CC_RUNTIME_CLASS(OpFillNudgeDownPixel1),NULL,0);
01222 pOpDesc = OpDescriptor::FindOpDescriptor(OPTOKEN_NUDGEDOWNPIXEL10);
01223 if (pOpDesc) pOpDesc->AliasOperation(CC_RUNTIME_CLASS(OpFillNudgeDownPixel10),NULL,0);
01224
01225 pOpDesc = OpDescriptor::FindOpDescriptor(OPTOKEN_NUDGELEFT1);
01226 if (pOpDesc) pOpDesc->AliasOperation(CC_RUNTIME_CLASS(OpFillNudgeLeft1),NULL,0);
01227 pOpDesc = OpDescriptor::FindOpDescriptor(OPTOKEN_NUDGELEFT5);
01228 if (pOpDesc) pOpDesc->AliasOperation(CC_RUNTIME_CLASS(OpFillNudgeLeft5),NULL,0);
01229 pOpDesc = OpDescriptor::FindOpDescriptor(OPTOKEN_NUDGELEFT10);
01230 if (pOpDesc) pOpDesc->AliasOperation(CC_RUNTIME_CLASS(OpFillNudgeLeft10),NULL,0);
01231 pOpDesc = OpDescriptor::FindOpDescriptor(OPTOKEN_NUDGELEFTFIFTH);
01232 if (pOpDesc) pOpDesc->AliasOperation(CC_RUNTIME_CLASS(OpFillNudgeLeftFifth),NULL,0);
01233 pOpDesc = OpDescriptor::FindOpDescriptor(OPTOKEN_NUDGELEFTPIXEL1);
01234 if (pOpDesc) pOpDesc->AliasOperation(CC_RUNTIME_CLASS(OpFillNudgeLeftPixel1),NULL,0);
01235 pOpDesc = OpDescriptor::FindOpDescriptor(OPTOKEN_NUDGELEFTPIXEL10);
01236 if (pOpDesc) pOpDesc->AliasOperation(CC_RUNTIME_CLASS(OpFillNudgeLeftPixel10),NULL,0);
01237
01238 pOpDesc = OpDescriptor::FindOpDescriptor(OPTOKEN_NUDGERIGHT1);
01239 if (pOpDesc) pOpDesc->AliasOperation(CC_RUNTIME_CLASS(OpFillNudgeRight1),NULL,0);
01240 pOpDesc = OpDescriptor::FindOpDescriptor(OPTOKEN_NUDGERIGHT5);
01241 if (pOpDesc) pOpDesc->AliasOperation(CC_RUNTIME_CLASS(OpFillNudgeRight5),NULL,0);
01242 pOpDesc = OpDescriptor::FindOpDescriptor(OPTOKEN_NUDGERIGHT10);
01243 if (pOpDesc) pOpDesc->AliasOperation(CC_RUNTIME_CLASS(OpFillNudgeRight10),NULL,0);
01244 pOpDesc = OpDescriptor::FindOpDescriptor(OPTOKEN_NUDGERIGHTFIFTH);
01245 if (pOpDesc) pOpDesc->AliasOperation(CC_RUNTIME_CLASS(OpFillNudgeRightFifth),NULL,0);
01246 pOpDesc = OpDescriptor::FindOpDescriptor(OPTOKEN_NUDGERIGHTPIXEL1);
01247 if (pOpDesc) pOpDesc->AliasOperation(CC_RUNTIME_CLASS(OpFillNudgeRightPixel1),NULL,0);
01248 pOpDesc = OpDescriptor::FindOpDescriptor(OPTOKEN_NUDGERIGHTPIXEL10);
01249 if (pOpDesc) pOpDesc->AliasOperation(CC_RUNTIME_CLASS(OpFillNudgeRightPixel10),NULL,0);
01250
01251 NudgeFills = TRUE;
01252 }
01253
01254
01255
01256
01257
01258
01259
01260
01261
01262
01263
01264
01265 void GradFillTool::DisableFillNudge()
01266 {
01267 if (!GradFillTool::AllowFillNudges || !NudgeFills)
01268 return;
01269
01270 NudgeFills = FALSE;
01271
01272
01273
01274 OpDescriptor* pOpDesc = OpDescriptor::FindOpDescriptor(OPTOKEN_NUDGEUP1);
01275 pOpDesc->RemoveAlias();
01276 pOpDesc = OpDescriptor::FindOpDescriptor(OPTOKEN_NUDGEUP5);
01277 pOpDesc->RemoveAlias();
01278 pOpDesc = OpDescriptor::FindOpDescriptor(OPTOKEN_NUDGEUP10);
01279 pOpDesc->RemoveAlias();
01280 pOpDesc = OpDescriptor::FindOpDescriptor(OPTOKEN_NUDGEUPFIFTH);
01281 pOpDesc->RemoveAlias();
01282 pOpDesc = OpDescriptor::FindOpDescriptor(OPTOKEN_NUDGEUPPIXEL1);
01283 pOpDesc->RemoveAlias();
01284 pOpDesc = OpDescriptor::FindOpDescriptor(OPTOKEN_NUDGEUPPIXEL10);
01285 pOpDesc->RemoveAlias();
01286
01287 pOpDesc = OpDescriptor::FindOpDescriptor(OPTOKEN_NUDGEDOWN1);
01288 pOpDesc->RemoveAlias();
01289 pOpDesc = OpDescriptor::FindOpDescriptor(OPTOKEN_NUDGEDOWN5);
01290 pOpDesc->RemoveAlias();
01291 pOpDesc = OpDescriptor::FindOpDescriptor(OPTOKEN_NUDGEDOWN10);
01292 pOpDesc->RemoveAlias();
01293 pOpDesc = OpDescriptor::FindOpDescriptor(OPTOKEN_NUDGEDOWNFIFTH);
01294 pOpDesc->RemoveAlias();
01295 pOpDesc = OpDescriptor::FindOpDescriptor(OPTOKEN_NUDGEDOWNPIXEL1);
01296 pOpDesc->RemoveAlias();
01297 pOpDesc = OpDescriptor::FindOpDescriptor(OPTOKEN_NUDGEDOWNPIXEL10);
01298 pOpDesc->RemoveAlias();
01299
01300 pOpDesc = OpDescriptor::FindOpDescriptor(OPTOKEN_NUDGELEFT1);
01301 pOpDesc->RemoveAlias();
01302 pOpDesc = OpDescriptor::FindOpDescriptor(OPTOKEN_NUDGELEFT5);
01303 pOpDesc->RemoveAlias();
01304 pOpDesc = OpDescriptor::FindOpDescriptor(OPTOKEN_NUDGELEFT10);
01305 pOpDesc->RemoveAlias();
01306 pOpDesc = OpDescriptor::FindOpDescriptor(OPTOKEN_NUDGELEFTFIFTH);
01307 pOpDesc->RemoveAlias();
01308 pOpDesc = OpDescriptor::FindOpDescriptor(OPTOKEN_NUDGELEFTPIXEL1);
01309 pOpDesc->RemoveAlias();
01310 pOpDesc = OpDescriptor::FindOpDescriptor(OPTOKEN_NUDGELEFTPIXEL10);
01311 pOpDesc->RemoveAlias();
01312
01313
01314 pOpDesc = OpDescriptor::FindOpDescriptor(OPTOKEN_NUDGERIGHT1);
01315 pOpDesc->RemoveAlias();
01316 pOpDesc = OpDescriptor::FindOpDescriptor(OPTOKEN_NUDGERIGHT5);
01317 pOpDesc->RemoveAlias();
01318 pOpDesc = OpDescriptor::FindOpDescriptor(OPTOKEN_NUDGERIGHT10);
01319 pOpDesc->RemoveAlias();
01320 pOpDesc = OpDescriptor::FindOpDescriptor(OPTOKEN_NUDGERIGHTFIFTH);
01321 pOpDesc->RemoveAlias();
01322 pOpDesc = OpDescriptor::FindOpDescriptor(OPTOKEN_NUDGERIGHTPIXEL1);
01323 pOpDesc->RemoveAlias();
01324 pOpDesc = OpDescriptor::FindOpDescriptor(OPTOKEN_NUDGERIGHTPIXEL10);
01325 pOpDesc->RemoveAlias();
01326 }
01327
01328
01329
01330
01331
01332
01333
01334
01335
01336
01337
01338
01339
01340
01341 BOOL GradFillTool::IsFillNudgeEnabled()
01342 {
01343 return NudgeFills;
01344 }
01345
01346
01347
01348
01349
01350
01351
01352
01353
01354
01355
01356
01357
01358
01359
01360
01361
01362 BOOL GradFillTool::GetStatusLineText(String_256* ptext, Spread* pSpread,
01363 DocCoord DocPos, ClickModifiers ClickMods)
01364 {
01365 ERROR3IF(ptext==NULL,"GradFillTool::GetStatusLineText() - ptext passed as null");
01366
01367 if (ClickMods.Adjust)
01368 TempGeometryIndex = FGMENU_CIRCULAR;
01369 else
01370 TempGeometryIndex = -1;
01371
01372 GetCursorAndStatus(DocPos, pSpread, NULL, ptext);
01373
01374 return TRUE;
01375 }
01376
01377
01378
01379
01380
01381
01382
01383
01384
01385
01386
01387
01388 void GradFillTool::GetCursorAndStatus(DocCoord Pos, Spread* pSpread,
01389 Cursor** pCursor, String_256* pStatus)
01390 {
01391
01392 UINT32 Status;
01393 Cursor* pNewCursor = pGradFillCursor;
01394
01395 AttrFillGeometry::DoCheckOnFillRampMesh = FALSE;
01396
01397
01398 if ( AttrFillGeometry::CheckForFillControlHit(Pos, &Status) )
01399 {
01400
01401
01402
01403 pNewCursor = pGradPointCursor;
01404 }
01405 else
01406 {
01407 INT32 Index = pGradInfoBarOp->CurrentGeometryIndex;
01408
01409 if (TempGeometryIndex != -1)
01410 Index = TempGeometryIndex;
01411
01412
01413 switch (Index)
01414 {
01415
01416
01417
01418
01419
01420 case (FGMENU_FLAT):
01421 if ( AttrFillGeometry::FillSelectionCount() > 0 )
01422 Status = _R(IDS_FS_CREATELINEAR_S);
01423 else
01424 Status = _R(IDS_FS_CREATELINEAR);
01425 break;
01426
01427 case (FGMENU_LINEAR):
01428 if ( AttrFillGeometry::FillSelectionCount() > 0 )
01429 Status = _R(IDS_FS_CREATELINEAR_S);
01430 else
01431 Status = _R(IDS_FS_CREATELINEAR);
01432 break;
01433
01434 case (FGMENU_CIRCULAR):
01435 if ( AttrFillGeometry::FillSelectionCount() > 0 )
01436 Status = _R(IDS_FS_CREATECIRCLE_S);
01437 else
01438 Status = _R(IDS_FS_CREATECIRCLE);
01439 break;
01440
01441 case (FGMENU_RADIAL):
01442 if ( AttrFillGeometry::FillSelectionCount() > 0 )
01443 Status = _R(IDS_FS_CREATEELLIP_S);
01444 else
01445 Status = _R(IDS_FS_CREATEELLIP);
01446 break;
01447
01448 case (FGMENU_CONICAL):
01449 if ( AttrFillGeometry::FillSelectionCount() > 0 )
01450 Status = _R(IDS_FS_CREATECONICAL_S);
01451 else
01452 Status = _R(IDS_FS_CREATECONICAL);
01453 break;
01454
01455 case (FGMENU_SQUARE):
01456 if ( AttrFillGeometry::FillSelectionCount() > 0 )
01457 Status = _R(IDS_FS_CREATESQUARE_S);
01458 else
01459 Status = _R(IDS_FS_CREATESQUARE);
01460 break;
01461
01462 case (FGMENU_THREECOL):
01463 if ( AttrFillGeometry::FillSelectionCount() > 0 )
01464 Status = _R(IDS_FS_CREATETHREECOL_S);
01465 else
01466 Status = _R(IDS_FS_CREATETHREECOL);
01467 break;
01468
01469 case (FGMENU_FOURCOL):
01470 if ( AttrFillGeometry::FillSelectionCount() > 0 )
01471 Status = _R(IDS_FS_CREATEFOURCOL_S);
01472 else
01473 Status = _R(IDS_FS_CREATEFOURCOL);
01474 break;
01475
01476 case (FGMENU_BITMAP):
01477 if ( AttrFillGeometry::FillSelectionCount() > 0 )
01478 Status = _R(IDS_FS_CREATEBITMAP_S);
01479 else
01480 Status = _R(IDS_FS_CREATEBITMAP);
01481 break;
01482
01483 case (FGMENU_FRACTAL):
01484 if ( AttrFillGeometry::FillSelectionCount() > 0 )
01485 Status = _R(IDS_FS_CREATEFRACTAL_S);
01486 else
01487 Status = _R(IDS_FS_CREATEFRACTAL);
01488 break;
01489
01490 case (FGMENU_NOISE):
01491 if ( AttrFillGeometry::FillSelectionCount() > 0 )
01492 Status = _R(IDS_FS_CREATENOISE_S);
01493 else
01494 Status = _R(IDS_FS_CREATENOISE);
01495 break;
01496
01497 default:
01498
01499 Status = _R(IDS_FS_CREATELINEAR);
01500 break;
01501 }
01502 }
01503
01504 if (pStatus != NULL)
01505 {
01506 pStatus->Load(Status);
01507 LastStatusID = Status;
01508 }
01509
01510 if (pCursor != NULL)
01511 *pCursor = pNewCursor;
01512
01513 AttrFillGeometry::DoCheckOnFillRampMesh = TRUE;
01514 }
01515
01516
01517
01518
01519
01520
01521
01522
01523
01524
01525
01526
01527
01528
01529
01530 void GradFillTool::DisplayStatusBarHelp(UINT32 StatusID)
01531 {
01532 String_256 StatusMsg("");
01533 StatusMsg.Load(StatusID);
01534 GetApplication()->UpdateStatusBarText(&StatusMsg);
01535 LastStatusID = StatusID;
01536 }
01537
01538
01539
01542
01543
01544
01547
01548
01549
01550
01551
01552
01553
01554
01555
01556
01557
01558
01559
01560 TranspTool::TranspTool()
01561 {
01562 ClickStart = DocCoord(0,0);
01563 IsSelection = FALSE;
01564 StartSpread = NULL;
01565 pTranspCursor = NULL;
01566 CurrentCursorID = 0;
01567
01568 CurrentTool = FALSE;
01569 NudgeFills = FALSE;
01570 }
01571
01572
01573
01574
01575
01576
01577
01578
01579
01580
01581
01582 TranspTool::~TranspTool()
01583 {
01584
01585 }
01586
01587
01588
01589
01590
01591
01592
01593
01594
01595
01596
01597
01598
01599 BOOL TranspTool::Init()
01600 {
01601 BOOL ok = TRUE;
01602
01603 ok = OpChangeTranspFillProfile::Declare();
01604
01605 #if 0
01606 if (ok)
01607 {
01608 CCResTextFile file;
01609 TranspInfoBarOpCreate BarCreate;
01610
01611 ok = file.open(_R(IDM_TRANSP_BAR), _R(IDT_INFO_BAR_RES));
01612 if (ok) ok = DialogBarOp::ReadBarsFromFile(file,BarCreate);
01613 if (ok) file.close();
01614
01615 ENSURE(ok,"Unable to load transbar.ini from resource\n");
01616
01617
01618 String_32 str = String_32(_R(IDS_FILLTOOL_TRANINFOBARNAME));
01619 DialogBarOp* pDialogBarOp = DialogBarOp::FindDialogBarOp(str);
01620
01621 }
01622 #endif
01623 if (ok)
01624 {
01625 pTranspInfoBarOp = new TranspInfoBarOp(_R(IDD_TRANFILLDLG));
01626
01627 if (pTranspInfoBarOp)
01628 {
01629
01630 pTranspInfoBarOp->CurrentGeometryIndex = FGMENU_LINEARTRANSP;
01631 pTranspInfoBarOp->CurrentMappingIndex = FMMENU_SIMPLE;
01632 pTranspInfoBarOp->CurrentTypeIndex = FTMENU_REFLECT;
01633 } else
01634 ok=FALSE;
01635
01636 ENSURE(ok,"Unable to load transbar.ini from resource\n");
01637
01638 }
01639
01640 return (ok);
01641 }
01642
01643
01644
01645
01646
01647
01648
01649
01650
01651
01652
01653
01654
01655
01656
01657
01658 void TranspTool::Describe(void *InfoPtr)
01659 {
01660
01661 ToolInfo_v1 *Info = (ToolInfo_v1 *) InfoPtr;
01662
01663 Info -> InfoVersion = 1;
01664
01665 Info -> InterfaceVersion = GetToolInterfaceVersion();
01666
01667
01668 Info -> Version = 1;
01669 Info -> ID = GetID();
01670 Info -> TextID = _R(IDS_TRANSP_TOOL);
01671 Info -> BubbleID = _R(IDBBL_TRANSP_TOOL);
01672
01673 Info -> Family = FamilyName;
01674 Info -> Name = ToolName;
01675 Info -> Purpose = Purpose;
01676 Info -> Author = Author;
01677
01678 Info -> InfoBarDialog = 0;
01679 }
01680
01681
01682
01683
01684
01685
01686
01687
01688
01689
01690
01691
01692
01693
01694
01695
01696
01697
01698 void TranspTool::SelectChange(BOOL isSelected)
01699 {
01700 if (isSelected)
01701 {
01702
01703
01704 pTranspCursor = new Cursor(this, _R(IDC_TRANSPTOOLCURSOR));
01705 pTranspPointCursor = new Cursor(this, _R(IDC_TRANSPPOINTCURSOR));
01706
01707
01708 if (!pTranspCursor || !pTranspCursor->IsValid())
01709 {
01710 return;
01711 }
01712
01713
01714 if (!pTranspPointCursor || !pTranspPointCursor->IsValid())
01715 {
01716 return;
01717 }
01718
01719 pCurrentCursor = pTranspCursor;
01720 CurrentCursorID = CursorStack::GPush(pTranspCursor, FALSE);
01721
01722
01723 CurrentTool = FALSE;
01724 AttrFillGeometry::SetTranspMeshesVisible(FALSE);
01725
01726 BlobManager* BlobMgr = GetApplication()->GetBlobManager();
01727
01728 BlobStyle MyBlobs = BlobMgr->GetCurrentInterest();
01729 if (MyBlobs.Fill)
01730 {
01731 MyBlobs.Fill = FALSE;
01732 MyBlobs.Effect = FALSE;
01733 BlobMgr->ToolInterest(MyBlobs);
01734 }
01735
01736 CurrentTool = TRUE;
01737 AttrFillGeometry::SetTranspMeshesVisible(TRUE);
01738
01739 SelRange *Selected = GetApplication()->FindSelection();
01740
01741 BlobStyle ToolBlobs;
01742 ToolBlobs.Fill = TRUE;
01743 ToolBlobs.Tiny = TRUE;
01744 ToolBlobs.Effect = TRUE;
01745 BlobMgr->ToolInterest(ToolBlobs);
01746
01747
01748 AttrFillGeometry::SetSelectionCount(AttrFillGeometry::CountSelectionControlPoints());
01749
01750 pTranspInfoBarOp->Create();
01751
01752 if (AttrFillGeometry::SelectionCount > 0)
01753 EnableFillNudge();
01754
01755 TempGeometryIndex = -1;
01756
01757
01758 IsSelection = (Document::GetCurrent() != NULL && Selected->Count() > 0);
01759
01760 if (IsSelection)
01761 {
01762 SelectionBox = Selected->GetBoundingRect();
01763
01764 Node* Current = Selected->FindFirst();
01765 if (Current != NULL)
01766 {
01767 Spread *pSpread = Current->FindParentSpread();
01768 RenderToolBlobs(pSpread, NULL);
01769 }
01770 }
01771 }
01772 else
01773 {
01774 DisableFillNudge();
01775
01776
01777 if (pTranspCursor)
01778 {
01779 CursorStack::GPop(CurrentCursorID);
01780 delete pTranspCursor;
01781 delete pTranspPointCursor;
01782
01783 pCurrentCursor = NULL;
01784 CurrentCursorID = 0;
01785 }
01786
01787 pTranspInfoBarOp->CloseProfileDialog(pTranspInfoBarOp->m_BiasGainGadget);
01788
01789 pTranspInfoBarOp->Delete();
01790
01791 CurrentTool = TRUE;
01792 AttrFillGeometry::SetTranspMeshesVisible(TRUE);
01793
01794 BlobManager* BlobMgr = GetApplication()->GetBlobManager();
01795
01796 BlobStyle MyBlobs = BlobMgr->GetCurrentInterest();
01797 MyBlobs.Fill = FALSE;
01798 MyBlobs.Effect = FALSE;
01799 BlobMgr->ToolInterest(MyBlobs);
01800
01801 CurrentTool = FALSE;
01802 AttrFillGeometry::SetTranspMeshesVisible(FALSE);
01803
01804
01805 if (IsSelection && Document::GetCurrent()!=NULL)
01806 {
01807 SelRange *Selected = GetApplication()->FindSelection();
01808 Node *Current = Selected->FindFirst();
01809
01810 if (Current!=NULL)
01811 {
01812 Spread *pSpread = Current->FindParentSpread();
01813 RenderToolBlobs(pSpread, NULL);
01814 }
01815 }
01816
01817
01818 BlobStyle bsRemoves;
01819 bsRemoves.ToolObject = TRUE;
01820 BlobMgr->RemoveInterest(bsRemoves);
01821 }
01822 }
01823
01824
01825
01826
01827
01828
01829
01830
01831
01832
01833
01834
01835
01836
01837
01838
01839
01840
01841
01842
01843
01844
01845
01846 void TranspTool::OnClick( DocCoord PointerPos, ClickType Click, ClickModifiers ClickMods,
01847 Spread* pSpread )
01848 {
01849 if (ClickMods.Menu) return;
01850
01851
01852 if (Operation::GetCurrentDragOp()!=NULL)
01853 return;
01854
01855 if ( AttrFillGeometry::CheckAttrClick(PointerPos, Click, ClickMods, pSpread) )
01856 {
01857 return;
01858 }
01859
01860
01861 if ( Click == CLICKTYPE_SINGLE )
01862 {
01863 StartPos = PointerPos;
01864 StartSpread = pSpread;
01865 DoubleClicked = FALSE;
01866 }
01867
01868
01869 if ( Click == CLICKTYPE_UP )
01870 {
01871 StartPos = DocCoord(0,0);
01872 StartSpread = NULL;
01873 DoubleClicked = FALSE;
01874 }
01875
01876 if ( Click == CLICKTYPE_DOUBLE )
01877 {
01878 DoubleClicked = TRUE;
01879 }
01880
01881 if ( Click == CLICKTYPE_DRAG )
01882 {
01883
01884
01885 BOOL allowed = TRUE;
01886
01887 Range Sel(*(GetApplication()->FindSelection()));
01888
01889 INT32 Count = Sel.Count();
01890 INT32 ShadCount = 0;
01891
01892 Node * pNode = Sel.FindFirst(FALSE);
01893
01894 while (pNode)
01895 {
01896 if (pNode->IsKindOf(CC_RUNTIME_CLASS(NodeShadow)))
01897 {
01898 allowed = FALSE;
01899 ((NodeShadow*)pNode)->DeSelect(TRUE);
01900 ShadCount ++;
01901 }
01902
01903 pNode = Sel.FindNext(pNode, FALSE);
01904 }
01905
01906 if (!allowed && Count == ShadCount)
01907 {
01908 return;
01909 }
01910
01911 if (!allowed)
01912 {
01913 GetApplication()->UpdateSelection();
01914 }
01915
01916 if (StartSpread == NULL)
01917 return;
01918
01919
01920
01921
01922 OpEditFill* pOp = new OpEditFill;
01923 if (pOp == NULL)
01924 {
01925
01926 InformError();
01927 }
01928 else
01929 {
01930 AttrFillGeometry* Fill = NULL;
01931
01932
01933 if (ClickMods.Adjust)
01934 {
01935 Fill = new AttrRadialTranspFill;
01936 if (Fill != NULL)
01937 ((AttrRadialFill*)Fill)->MakeCircular();
01938 }
01939 #ifndef WEBSTER
01940 else if (DoubleClicked)
01941 {
01942
01943 Fill = new AttrConicalTranspFill;
01944 }
01945 #endif //WEBSTER
01946 else
01947 {
01948 switch (pTranspInfoBarOp->CurrentGeometryIndex)
01949 {
01950 case (FGMENU_NOTRANSP):
01951 Fill = new AttrLinearTranspFill;
01952 break;
01953
01954 case (FGMENU_FLATTRANSP):
01955 Fill = new AttrLinearTranspFill;
01956 break;
01957
01958 case (FGMENU_LINEARTRANSP):
01959 Fill = new AttrLinearTranspFill;
01960 break;
01961
01962 case (FGMENU_CIRCULARTRANSP):
01963 Fill = new AttrRadialTranspFill;
01964 if (Fill != NULL)
01965 ((AttrRadialFill*)Fill)->MakeCircular();
01966 break;
01967
01968 case (FGMENU_RADIALTRANSP):
01969 Fill = new AttrRadialTranspFill;
01970 break;
01971
01972 case (FGMENU_CONICALTRANSP):
01973 Fill = new AttrConicalTranspFill;
01974 break;
01975
01976 case (FGMENU_SQUARETRANSP):
01977 Fill = new AttrSquareTranspFill;
01978 break;
01979
01980 case (FGMENU_THREECOLTRANSP):
01981 Fill = new AttrThreeColTranspFill;
01982 break;
01983
01984 case (FGMENU_FOURCOLTRANSP):
01985 Fill = new AttrFourColTranspFill;
01986 break;
01987
01988 case (FGMENU_BITMAPTRANSP):
01989 {
01990 Fill = new AttrBitmapTranspFill;
01991
01992 KernelBitmap* Default = NULL;
01993 Default = KernelBitmap::MakeKernelBitmap();
01994 if (Default == NULL)
01995 {
01996 InformError();
01997 delete Fill;
01998 return;
01999 }
02000
02001 Fill->AttachBitmap(Default);
02002 Fill->SetTesselation(pTranspInfoBarOp->CurrentMappingIndex+1);
02003 break;
02004 }
02005
02006 case (FGMENU_FRACTALTRANSP):
02007 Fill = new AttrFractalTranspFill;
02008 Fill->SetTesselation(pTranspInfoBarOp->CurrentMappingIndex+1);
02009 break;
02010
02011 case (FGMENU_NOISETRANSP):
02012 Fill = new AttrNoiseTranspFill;
02013 Fill->SetTesselation(pTranspInfoBarOp->CurrentMappingIndex+1);
02014 break;
02015
02016 default:
02017
02018 Fill = new AttrLinearTranspFill;
02019 break;
02020 }
02021 }
02022
02023 if (Fill == NULL)
02024 {
02025 InformError();
02026 delete pOp;
02027 return;
02028 }
02029
02030 Fill->SetTranspType(pTranspInfoBarOp->GetTranspType());
02031
02032
02033 pOp->DoCreate(StartPos, StartSpread, Fill);
02034 }
02035
02036 StartPos = DocCoord(0,0);
02037 StartSpread = NULL;
02038 DoubleClicked = FALSE;
02039 return;
02040 }
02041
02042
02043
02044 DragTool::OnClick (PointerPos, Click, ClickMods, pSpread);
02045 }
02046
02047
02048
02049
02050
02051
02052
02053
02054
02055
02056
02057
02058
02059
02060 void TranspTool::OnMouseMove(DocCoord Pos, Spread* pSpread, ClickModifiers ClickMods)
02061 {
02062
02063 Cursor* pCursor = pTranspCursor;
02064 String_256 Status;
02065
02066 if (ClickMods.Adjust)
02067 TempGeometryIndex = FGMENU_CIRCULARTRANSP;
02068 else
02069 TempGeometryIndex = -1;
02070
02071 GetCursorAndStatus(Pos, pSpread, &pCursor, &Status);
02072
02073 if (pCursor != pCurrentCursor)
02074 {
02075
02076 pCurrentCursor = pCursor;
02077 CursorStack::GSetTop(pCurrentCursor, CurrentCursorID);
02078 }
02079
02080
02081 GetApplication()->UpdateStatusBarText(&Status);
02082 }
02083
02084
02085
02086
02087
02088
02089
02090
02091
02092
02093
02094
02095
02096
02097
02098
02099 BOOL TranspTool::OnKeyPress(KeyPress* pKeyPress)
02100 {
02101 if (pKeyPress->GetVirtKey() == CAMKEY(TAB) &&
02102 !pKeyPress->IsRelease() &&
02103 !pKeyPress->IsRepeat())
02104 {
02105
02106 ToggleControlPoints(pKeyPress->IsAdjust());
02107
02108 return TRUE;
02109 }
02110
02111 if ( IsFillNudgeEnabled() &&
02112 (pKeyPress->GetVirtKey() == CAMKEY(UP) ||
02113 pKeyPress->GetVirtKey() == CAMKEY(DOWN) ||
02114 pKeyPress->GetVirtKey() == CAMKEY(LEFT) ||
02115 pKeyPress->GetVirtKey() == CAMKEY(RIGHT)) )
02116 {
02117
02118
02119 if (pKeyPress->IsRelease())
02120 AttributeManager::SendMessages = TRUE;
02121 else
02122 AttributeManager::SendMessages = FALSE;
02123
02124
02125 return FALSE;
02126 }
02127 return FALSE;
02128 }
02129
02130
02131
02132
02133
02134
02135
02136
02137
02138
02139
02140
02141
02142 void TranspTool::ToggleControlPoints(BOOL Reverse)
02143 {
02144
02145 AttrFillGeometry::LastRenderedStartBlob = DocCoord(0,0);
02146 AttrFillGeometry::LastRenderedEndBlob = DocCoord(0,0);
02147 AttrFillGeometry::LastRenderedEnd2Blob = DocCoord(0,0);
02148 AttrFillGeometry::LastRenderedEnd3Blob = DocCoord(0,0);
02149
02150 AttrFillGeometry* pAttrNode = AttrFillGeometry::FindFirstSelectedAttr(CC_RUNTIME_CLASS(AttrTranspFillGeometry));
02151
02152
02153 if (pAttrNode == NULL)
02154 return;
02155
02156
02157 BOOL DoToggle = AttrFillGeometry::FillSelectionCount() > 0;
02158
02159 while (pAttrNode != NULL)
02160 {
02161 if (pAttrNode->IsATranspFill())
02162 {
02163 if (DoToggle)
02164 {
02165
02166 if (pAttrNode->GetSelectionCount() > 0)
02167 {
02168 pAttrNode->CycleSelection(Reverse);
02169 }
02170 }
02171 else
02172 {
02173
02174
02175 pAttrNode->SelectBlob(FILLCONTROL_STARTPOINT);
02176 }
02177 }
02178
02179
02180 pAttrNode = AttrFillGeometry::FindNextSelectedAttr(CC_RUNTIME_CLASS(AttrTranspFillGeometry));
02181 }
02182
02183 BROADCAST_TO_ALL(SelChangingMsg(SelChangingMsg::COLOURATTCHANGED));
02184 }
02185
02186
02187
02188
02189
02190
02191
02192
02193
02194
02195
02196 void TranspTool::EnableFillNudge()
02197 {
02198 if (!GradFillTool::AllowFillNudges || NudgeFills)
02199 return;
02200
02201
02202 OpFillNudge::NudgeColours(FALSE);
02203
02204 OpDescriptor* pOpDesc = OpDescriptor::FindOpDescriptor(OPTOKEN_NUDGEUP1);
02205 pOpDesc->AliasOperation(CC_RUNTIME_CLASS(OpFillNudgeUp1),NULL,0);
02206 pOpDesc = OpDescriptor::FindOpDescriptor(OPTOKEN_NUDGEUP5);
02207 pOpDesc->AliasOperation(CC_RUNTIME_CLASS(OpFillNudgeUp5),NULL,0);
02208 pOpDesc = OpDescriptor::FindOpDescriptor(OPTOKEN_NUDGEUP10);
02209 pOpDesc->AliasOperation(CC_RUNTIME_CLASS(OpFillNudgeUp10),NULL,0);
02210 pOpDesc = OpDescriptor::FindOpDescriptor(OPTOKEN_NUDGEUPFIFTH);
02211 pOpDesc->AliasOperation(CC_RUNTIME_CLASS(OpFillNudgeUpFifth),NULL,0);
02212 pOpDesc = OpDescriptor::FindOpDescriptor(OPTOKEN_NUDGEUPPIXEL1);
02213 pOpDesc->AliasOperation(CC_RUNTIME_CLASS(OpFillNudgeUpPixel1),NULL,0);
02214 pOpDesc = OpDescriptor::FindOpDescriptor(OPTOKEN_NUDGEUPPIXEL10);
02215 pOpDesc->AliasOperation(CC_RUNTIME_CLASS(OpFillNudgeUpPixel10),NULL,0);
02216
02217 pOpDesc = OpDescriptor::FindOpDescriptor(OPTOKEN_NUDGEDOWN1);
02218 pOpDesc->AliasOperation(CC_RUNTIME_CLASS(OpFillNudgeDown1),NULL,0);
02219 pOpDesc = OpDescriptor::FindOpDescriptor(OPTOKEN_NUDGEDOWN5);
02220 pOpDesc->AliasOperation(CC_RUNTIME_CLASS(OpFillNudgeDown5),NULL,0);
02221 pOpDesc = OpDescriptor::FindOpDescriptor(OPTOKEN_NUDGEDOWN10);
02222 pOpDesc->AliasOperation(CC_RUNTIME_CLASS(OpFillNudgeDown10),NULL,0);
02223 pOpDesc = OpDescriptor::FindOpDescriptor(OPTOKEN_NUDGEDOWNFIFTH);
02224 pOpDesc->AliasOperation(CC_RUNTIME_CLASS(OpFillNudgeDownFifth),NULL,0);
02225 pOpDesc = OpDescriptor::FindOpDescriptor(OPTOKEN_NUDGEDOWNPIXEL1);
02226 pOpDesc->AliasOperation(CC_RUNTIME_CLASS(OpFillNudgeDownPixel1),NULL,0);
02227 pOpDesc = OpDescriptor::FindOpDescriptor(OPTOKEN_NUDGEDOWNPIXEL10);
02228 pOpDesc->AliasOperation(CC_RUNTIME_CLASS(OpFillNudgeDownPixel10),NULL,0);
02229
02230 pOpDesc = OpDescriptor::FindOpDescriptor(OPTOKEN_NUDGELEFT1);
02231 pOpDesc->AliasOperation(CC_RUNTIME_CLASS(OpFillNudgeLeft1),NULL,0);
02232 pOpDesc = OpDescriptor::FindOpDescriptor(OPTOKEN_NUDGELEFT5);
02233 pOpDesc->AliasOperation(CC_RUNTIME_CLASS(OpFillNudgeLeft5),NULL,0);
02234 pOpDesc = OpDescriptor::FindOpDescriptor(OPTOKEN_NUDGELEFT10);
02235 pOpDesc->AliasOperation(CC_RUNTIME_CLASS(OpFillNudgeLeft10),NULL,0);
02236 pOpDesc = OpDescriptor::FindOpDescriptor(OPTOKEN_NUDGELEFTFIFTH);
02237 pOpDesc->AliasOperation(CC_RUNTIME_CLASS(OpFillNudgeLeftFifth),NULL,0);
02238 pOpDesc = OpDescriptor::FindOpDescriptor(OPTOKEN_NUDGELEFTPIXEL1);
02239 pOpDesc->AliasOperation(CC_RUNTIME_CLASS(OpFillNudgeLeftPixel1),NULL,0);
02240 pOpDesc = OpDescriptor::FindOpDescriptor(OPTOKEN_NUDGELEFTPIXEL10);
02241 pOpDesc->AliasOperation(CC_RUNTIME_CLASS(OpFillNudgeLeftPixel10),NULL,0);
02242
02243 pOpDesc = OpDescriptor::FindOpDescriptor(OPTOKEN_NUDGERIGHT1);
02244 pOpDesc->AliasOperation(CC_RUNTIME_CLASS(OpFillNudgeRight1),NULL,0);
02245 pOpDesc = OpDescriptor::FindOpDescriptor(OPTOKEN_NUDGERIGHT5);
02246 pOpDesc->AliasOperation(CC_RUNTIME_CLASS(OpFillNudgeRight5),NULL,0);
02247 pOpDesc = OpDescriptor::FindOpDescriptor(OPTOKEN_NUDGERIGHT10);
02248 pOpDesc->AliasOperation(CC_RUNTIME_CLASS(OpFillNudgeRight10),NULL,0);
02249 pOpDesc = OpDescriptor::FindOpDescriptor(OPTOKEN_NUDGERIGHTFIFTH);
02250 pOpDesc->AliasOperation(CC_RUNTIME_CLASS(OpFillNudgeRightFifth),NULL,0);
02251 pOpDesc = OpDescriptor::FindOpDescriptor(OPTOKEN_NUDGERIGHTPIXEL1);
02252 pOpDesc->AliasOperation(CC_RUNTIME_CLASS(OpFillNudgeRightPixel1),NULL,0);
02253 pOpDesc = OpDescriptor::FindOpDescriptor(OPTOKEN_NUDGERIGHTPIXEL10);
02254 pOpDesc->AliasOperation(CC_RUNTIME_CLASS(OpFillNudgeRightPixel10),NULL,0);
02255
02256
02257 NudgeFills = TRUE;
02258 }
02259
02260
02261
02262
02263
02264
02265
02266
02267
02268
02269
02270
02271 void TranspTool::DisableFillNudge()
02272 {
02273 if (!GradFillTool::AllowFillNudges || !NudgeFills)
02274 return;
02275
02276 NudgeFills = FALSE;
02277
02278
02279 OpDescriptor* pOpDesc = OpDescriptor::FindOpDescriptor(OPTOKEN_NUDGEUP1);
02280 pOpDesc->RemoveAlias();
02281 pOpDesc = OpDescriptor::FindOpDescriptor(OPTOKEN_NUDGEUP5);
02282 pOpDesc->RemoveAlias();
02283 pOpDesc = OpDescriptor::FindOpDescriptor(OPTOKEN_NUDGEUP10);
02284 pOpDesc->RemoveAlias();
02285 pOpDesc = OpDescriptor::FindOpDescriptor(OPTOKEN_NUDGEUPFIFTH);
02286 pOpDesc->RemoveAlias();
02287 pOpDesc = OpDescriptor::FindOpDescriptor(OPTOKEN_NUDGEUPPIXEL1);
02288 pOpDesc->RemoveAlias();
02289 pOpDesc = OpDescriptor::FindOpDescriptor(OPTOKEN_NUDGEUPPIXEL10);
02290 pOpDesc->RemoveAlias();
02291
02292 pOpDesc = OpDescriptor::FindOpDescriptor(OPTOKEN_NUDGEDOWN1);
02293 pOpDesc->RemoveAlias();
02294 pOpDesc = OpDescriptor::FindOpDescriptor(OPTOKEN_NUDGEDOWN5);
02295 pOpDesc->RemoveAlias();
02296 pOpDesc = OpDescriptor::FindOpDescriptor(OPTOKEN_NUDGEDOWN10);
02297 pOpDesc->RemoveAlias();
02298 pOpDesc = OpDescriptor::FindOpDescriptor(OPTOKEN_NUDGEDOWNFIFTH);
02299 pOpDesc->RemoveAlias();
02300 pOpDesc = OpDescriptor::FindOpDescriptor(OPTOKEN_NUDGEDOWNPIXEL1);
02301 pOpDesc->RemoveAlias();
02302 pOpDesc = OpDescriptor::FindOpDescriptor(OPTOKEN_NUDGEDOWNPIXEL10);
02303 pOpDesc->RemoveAlias();
02304
02305 pOpDesc = OpDescriptor::FindOpDescriptor(OPTOKEN_NUDGELEFT1);
02306 pOpDesc->RemoveAlias();
02307 pOpDesc = OpDescriptor::FindOpDescriptor(OPTOKEN_NUDGELEFT5);
02308 pOpDesc->RemoveAlias();
02309 pOpDesc = OpDescriptor::FindOpDescriptor(OPTOKEN_NUDGELEFT10);
02310 pOpDesc->RemoveAlias();
02311 pOpDesc = OpDescriptor::FindOpDescriptor(OPTOKEN_NUDGELEFTFIFTH);
02312 pOpDesc->RemoveAlias();
02313 pOpDesc = OpDescriptor::FindOpDescriptor(OPTOKEN_NUDGELEFTPIXEL1);
02314 pOpDesc->RemoveAlias();
02315 pOpDesc = OpDescriptor::FindOpDescriptor(OPTOKEN_NUDGELEFTPIXEL10);
02316 pOpDesc->RemoveAlias();
02317
02318 pOpDesc = OpDescriptor::FindOpDescriptor(OPTOKEN_NUDGERIGHT1);
02319 pOpDesc->RemoveAlias();
02320 pOpDesc = OpDescriptor::FindOpDescriptor(OPTOKEN_NUDGERIGHT5);
02321 pOpDesc->RemoveAlias();
02322 pOpDesc = OpDescriptor::FindOpDescriptor(OPTOKEN_NUDGERIGHT10);
02323 pOpDesc->RemoveAlias();
02324 pOpDesc = OpDescriptor::FindOpDescriptor(OPTOKEN_NUDGERIGHTFIFTH);
02325 pOpDesc->RemoveAlias();
02326 pOpDesc = OpDescriptor::FindOpDescriptor(OPTOKEN_NUDGERIGHTPIXEL1);
02327 pOpDesc->RemoveAlias();
02328 pOpDesc = OpDescriptor::FindOpDescriptor(OPTOKEN_NUDGERIGHTPIXEL10);
02329 pOpDesc->RemoveAlias();
02330 }
02331
02332
02333
02334
02335
02336
02337
02338
02339
02340
02341
02342
02343
02344
02345 BOOL TranspTool::IsFillNudgeEnabled()
02346 {
02347 return NudgeFills;
02348 }
02349
02350
02351
02352
02353
02354
02355
02356
02357
02358
02359
02360
02361
02362
02363
02364
02365
02366 BOOL TranspTool::GetStatusLineText(String_256* ptext, Spread* pSpread,
02367 DocCoord DocPos, ClickModifiers ClickMods)
02368 {
02369 ERROR3IF(ptext==NULL,"TranspTool::GetStatusLineText() - ptext passed as null");
02370
02371 if (ClickMods.Adjust)
02372 TempGeometryIndex = FGMENU_CIRCULARTRANSP;
02373 else
02374 TempGeometryIndex = -1;
02375
02376 GetCursorAndStatus(DocPos, pSpread, NULL, ptext);
02377
02378 return TRUE;
02379 }
02380
02381
02382
02383
02384
02385
02386
02387
02388
02389
02390
02391
02392 void TranspTool::GetCursorAndStatus(DocCoord Pos, Spread* pSpread,
02393 Cursor** pCursor, String_256* pStatus)
02394 {
02395
02396 UINT32 Status;
02397 Cursor* pNewCursor = pTranspCursor;
02398
02399
02400 if ( AttrFillGeometry::CheckForFillControlHit(Pos, &Status) )
02401 {
02402
02403
02404
02405 pNewCursor = pTranspPointCursor;
02406 }
02407 else
02408 {
02409 INT32 Index = pTranspInfoBarOp->CurrentGeometryIndex;
02410
02411 if (TempGeometryIndex != -1)
02412 Index = TempGeometryIndex;
02413
02414
02415 switch (Index)
02416 {
02417
02418
02419
02420
02421
02422 case (FGMENU_NOTRANSP):
02423 if ( AttrFillGeometry::FillSelectionCount() > 0 )
02424 Status = _R(IDS_TS_CREATELINEAR_S);
02425 else
02426 Status = _R(IDS_TS_CREATELINEAR);
02427 break;
02428
02429 case (FGMENU_FLATTRANSP):
02430 if ( AttrFillGeometry::FillSelectionCount() > 0 )
02431 Status = _R(IDS_TS_CREATELINEAR_S);
02432 else
02433 Status = _R(IDS_TS_CREATELINEAR);
02434 break;
02435
02436 case (FGMENU_LINEARTRANSP):
02437 if ( AttrFillGeometry::FillSelectionCount() > 0 )
02438 Status = _R(IDS_TS_CREATELINEAR_S);
02439 else
02440 Status = _R(IDS_TS_CREATELINEAR);
02441 break;
02442
02443 case (FGMENU_CIRCULARTRANSP):
02444 if ( AttrFillGeometry::FillSelectionCount() > 0 )
02445 Status = _R(IDS_TS_CREATECIRCLE_S);
02446 else
02447 Status = _R(IDS_TS_CREATECIRCLE);
02448 break;
02449
02450 case (FGMENU_RADIALTRANSP):
02451 if ( AttrFillGeometry::FillSelectionCount() > 0 )
02452 Status = _R(IDS_TS_CREATEELLIP_S);
02453 else
02454 Status = _R(IDS_TS_CREATEELLIP);
02455 break;
02456
02457 case (FGMENU_CONICALTRANSP):
02458 if ( AttrFillGeometry::FillSelectionCount() > 0 )
02459 Status = _R(IDS_TS_CREATECONICAL_S);
02460 else
02461 Status = _R(IDS_TS_CREATECONICAL);
02462 break;
02463
02464 case (FGMENU_SQUARETRANSP):
02465 if ( AttrFillGeometry::FillSelectionCount() > 0 )
02466 Status = _R(IDS_TS_CREATESQUARE_S);
02467 else
02468 Status = _R(IDS_TS_CREATESQUARE);
02469 break;
02470
02471 case (FGMENU_THREECOLTRANSP):
02472 if ( AttrFillGeometry::FillSelectionCount() > 0 )
02473 Status = _R(IDS_TS_CREATETHREECOL_S);
02474 else
02475 Status = _R(IDS_TS_CREATETHREECOL);
02476 break;
02477
02478 case (FGMENU_FOURCOLTRANSP):
02479 if ( AttrFillGeometry::FillSelectionCount() > 0 )
02480 Status = _R(IDS_TS_CREATEFOURCOL_S);
02481 else
02482 Status = _R(IDS_TS_CREATEFOURCOL);
02483 break;
02484
02485 case (FGMENU_BITMAPTRANSP):
02486 if ( AttrFillGeometry::FillSelectionCount() > 0 )
02487 Status = _R(IDS_TS_CREATEBITMAP_S);
02488 else
02489 Status = _R(IDS_TS_CREATEBITMAP);
02490 break;
02491
02492 case (FGMENU_FRACTALTRANSP):
02493 if ( AttrFillGeometry::FillSelectionCount() > 0 )
02494 Status = _R(IDS_TS_CREATEFRACTAL_S);
02495 else
02496 Status = _R(IDS_TS_CREATEFRACTAL);
02497 break;
02498
02499 case (FGMENU_NOISETRANSP):
02500 if ( AttrFillGeometry::FillSelectionCount() > 0 )
02501 Status = _R(IDS_TS_CREATENOISE_S);
02502 else
02503 Status = _R(IDS_TS_CREATENOISE);
02504 break;
02505
02506 default:
02507
02508 Status = _R(IDS_TS_CREATELINEAR);
02509 break;
02510 }
02511 }
02512
02513 if (pStatus != NULL)
02514 {
02515 pStatus->Load(Status);
02516 LastStatusID = Status;
02517 }
02518
02519 if (pCursor != NULL)
02520 *pCursor = pNewCursor;
02521 }
02522
02523
02524
02525
02526
02527
02528
02529
02530
02531
02532
02533
02534
02535
02536
02537 void TranspTool::DisplayStatusBarHelp(UINT32 StatusID)
02538 {
02539 String_256 StatusMsg("");
02540 StatusMsg.Load(StatusID);
02541 GetApplication()->UpdateStatusBarText(&StatusMsg);
02542 LastStatusID = StatusID;
02543 }
02544
02545
02546
02549
02550
02551
02554
02555
02556
02557
02558
02559
02560
02561
02562
02563
02564
02565
02566
02567
02568
02569 struct FGMItem
02570 {
02571 FillGeometry Geometry;
02572 unsigned StringID;
02573 };
02574
02575
02576
02577
02578
02579
02580
02581
02582
02583
02584
02585
02586
02587
02588
02589 const FGMItem FillGeometryMenu[] =
02590 {
02591 { FGMENU_FLAT, _R(IDS_FILLTOOL_FLATFILL) },
02592 { FGMENU_LINEAR, _R(IDS_FILLTOOL_LINEAR) },
02593 { FGMENU_CIRCULAR, _R(IDS_FILLTOOL_CIRCULAR) },
02594 { FGMENU_RADIAL, _R(IDS_FILLTOOL_ELLIPTICAL) },
02595 #ifndef WEBSTER
02596 { FGMENU_CONICAL, _R(IDS_FILLTOOL_CONICAL) },
02597 { FGMENU_SQUARE, _R(IDS_FILLTOOL_SQUARE) },
02598 { FGMENU_THREECOL, _R(IDS_FILLTOOL_THREECOL) },
02599 { FGMENU_FOURCOL, _R(IDS_FILLTOOL_FOURCOL) },
02600 #endif //WEBSTER
02601 { FGMENU_BITMAP, _R(IDS_FILLTOOL_BITMAP) },
02602 { FGMENU_FRACTAL, _R(IDS_FILLTOOL_FRACTAL) },
02603 #ifndef WEBSTER
02604 { FGMENU_NOISE, _R(IDS_FILLTOOL_NOISE) }
02605 #endif //WEBSTER
02606 };
02607
02608
02609
02610
02611
02612
02613
02614
02615
02616
02617
02618
02619 const INT32 FillGeometryMenuCount = sizeof(FillGeometryMenu) / sizeof(FillGeometryMenu[0]);
02620
02621
02622
02623
02624
02625
02626
02627
02628
02629
02630
02631
02632
02633
02634
02635
02636 MsgResult GradInfoBarOp::Message(Msg* Message)
02637 {
02638 if (!GradFillTool::IsCurrentTool() || !IsVisible())
02639 {
02640 return (InformationBarOp::Message(Message));
02641 }
02642
02643 if (IS_OUR_DIALOG_MSG(Message))
02644 {
02645 DialogMsg* Msg = (DialogMsg*)Message;
02646
02647
02648 if (Msg->DlgMsg == DIM_CANCEL)
02649 {
02650 Close();
02651 }
02652 else if (Msg->DlgMsg == DIM_CREATE)
02653 {
02654
02655 InitControls();
02656 }
02657 else
02658 {
02659 if (Msg->GadgetID == _R(IDC_GEOMETRY))
02660 {
02661 switch (Msg->DlgMsg)
02662 {
02663 case DIM_SELECTION_CHANGED :
02664 {
02665 ShowCommonType (FALSE);
02666
02667
02668
02669 INT32 Index;
02670 GetValueIndex(_R(IDC_GEOMETRY),&Index);
02671
02672 BOOL AllowFractal = FALSE;
02673
02674
02675
02676
02677 if (Index == FGMENU_FRACTAL)
02678 {
02679 if (CurrentGeometryIndex == Index)
02680 {
02681 AllowFractal = TRUE;
02682 }
02683 }
02684
02685 if (Index == FGMENU_NOISE)
02686 {
02687 if (CurrentGeometryIndex == Index)
02688 {
02689 AllowFractal = TRUE;
02690 }
02691 }
02692
02693 if ((CurrentGeometryIndex != Index) || (AllowFractal))
02694 {
02695
02696 CurrentGeometryIndex = FillGeometryMenu[Index].Geometry;
02697
02698
02699
02700
02701
02702 Range* pSelRange = GetApplication()->FindSelection();
02703 if (pSelRange != NULL)
02704 {
02705 for ( Node* pSelNode = pSelRange->FindFirst();
02706 pSelNode != NULL;
02707 pSelNode = pSelRange->FindNext(pSelNode) )
02708 {
02709 if (pSelNode->IsAnAttribute() &&
02710 pSelNode->IS_KIND_OF(AttrFillGeometry))
02711 {
02712 FillRamp* pRamp = ((AttrFillGeometry*)pSelNode)->GetFillRamp();
02713 if (pRamp != NULL)
02714 pRamp->DeselectAll();
02715 }
02716 }
02717 }
02718
02719 ChangeFillType();
02720 EnableControls();
02721 }
02722 }
02723 break;
02724
02725 default:
02726 break;
02727 }
02728 }
02729
02730 else if (Msg->GadgetID == _R(IDC_MAPPING))
02731 {
02732 switch (Msg->DlgMsg)
02733 {
02734 case DIM_SELECTION_CHANGED:
02735 {
02736 ShowCommonMapping (FALSE);
02737
02738
02739
02740 INT32 Index;
02741 GetValueIndex(_R(IDC_MAPPING),&Index);
02742
02743 if (CurrentMappingIndex != Index)
02744 {
02745
02746 CurrentMappingIndex = Index;
02747 ChangeFillMapping();
02748 }
02749 }
02750 break;
02751
02752 default:
02753 break;
02754 }
02755 }
02756
02757 else if (Msg->GadgetID == _R(IDC_EFFECT))
02758 {
02759 switch (Msg->DlgMsg)
02760 {
02761 case DIM_SELECTION_CHANGED:
02762 {
02763 ShowCommonEffect (FALSE);
02764
02765
02766
02767 INT32 Index;
02768 GetValueIndex(_R(IDC_EFFECT),&Index);
02769
02770 if (CurrentEffectIndex != Index)
02771 {
02772
02773 CurrentEffectIndex = Index;
02774 ChangeFillEffect();
02775 }
02776 }
02777 break;
02778
02779 default:
02780 break;
02781 }
02782 }
02783
02784 else if (Msg->GadgetID == _R(IDC_BITMAPEFFECT))
02785 {
02786 switch (Msg->DlgMsg)
02787 {
02788 case DIM_SELECTION_CHANGED:
02789 {
02790
02791 INT32 iIndex = m_oBitmapDropDown.GetSelected();
02792
02793
02794
02795
02796
02797
02798
02799
02800
02801 CurrentEffectIndex = iIndex;
02802 ChangeBitmapName ();
02803
02804 }
02805 break;
02806
02807 default:
02808 break;
02809 }
02810 }
02811
02812 else if (Msg->GadgetID == _R(IDC_BIASGAIN))
02813 {
02814 switch (Msg->DlgMsg)
02815 {
02816 case DIM_LFT_BN_CLICKED:
02817 HandleProfileButtonClick (m_BiasGainGadget, _R(IDC_BIASGAIN));
02818 break;
02819
02820 default:
02821 ProfileSelectionChange( Msg, Msg->GadgetID );
02822 break;
02823 }
02824 }
02825
02826 else if (Msg->GadgetID == _R(IDC_SELPOINT))
02827 {
02828 switch (Msg->DlgMsg)
02829 {
02830 case DIM_SELECTION_CHANGED:
02831 {
02832 if (AttrFillGeometry::SelectionCount == 0)
02833 {
02834 if (Mode == BITMAPFILL ||
02835 Mode == FRACTALFILL ||
02836 Mode == NOISEFILL )
02837 {
02838 ChangeDPI();
02839 }
02840 }
02841 }
02842 break;
02843 default:
02844 break;
02845 }
02846 }
02847
02848 else if (Msg->GadgetID == _R(IDC_SELCOLOUR))
02849 {
02850 switch (Msg->DlgMsg)
02851 {
02852 case DIM_SELECTION_CHANGED:
02853 {
02854 if (AttrFillGeometry::SelectionCount == 0)
02855 {
02856 if (Mode == FRACTALFILL)
02857 ChangeFractalGrain();
02858 if (Mode == NOISEFILL)
02859 ChangeNoiseScale();
02860 }
02861 }
02862 break;
02863
02864 default:
02865 break;
02866 }
02867 }
02868 }
02869 }
02870
02871 if (MESSAGE_IS_A(Message, SelChangingMsg) ||
02872 MESSAGE_IS_A(Message, CurrentAttrChangedMsg))
02873 {
02874
02875
02876 AttrFillGeometry::SetSelectionCount(AttrFillGeometry::CountSelectionControlPoints());
02877
02878 if (AttrFillGeometry::SelectionCount > 0)
02879 {
02880 GradFillTool::EnableFillNudge();
02881 }
02882 else
02883 {
02884 GradFillTool::DisableFillNudge();
02885 }
02886
02887 HandleProfileSelChangingMsg (m_BiasGainGadget, _R(IDC_BIASGAIN));
02888
02889 ShowInfo();
02890
02891
02892
02893
02894
02895
02896
02897
02898
02899
02900
02901
02902
02903
02904
02905
02906
02907 }
02908
02909
02910 if (MESSAGE_IS_A(Message, SelChangingMsg))
02911 {
02912
02913 HandleProfileSelChangingMsg (m_BiasGainGadget, _R(IDC_BIASGAIN));
02914 ShowInfo();
02915 }
02916
02917 if (MESSAGE_IS_A(Message, BitmapListChangedMsg) &&
02918 Document::GetSelected() != NULL)
02919 {
02920 InitBitmapName();
02921 ShowInfo();
02922 }
02923
02924
02925 return (InformationBarOp::Message(Message));
02926 }
02927
02928
02929
02930
02931
02932
02933
02934
02935
02936
02937
02938
02939
02940
02941 void GradInfoBarOp::ChangeProfile(CProfileBiasGain* Profile, CGadgetID GadgetID)
02942 {
02943 OpDescriptor* pOpDesc = OpDescriptor::FindOpDescriptor(OPTOKEN_FILLPROFILE);
02944 if (pOpDesc != NULL)
02945 {
02946 BOOL FireOp = TRUE;
02947
02948
02949
02950
02951
02952 Operation* pLastOp = NULL;
02953
02954 if (Profile->GetGeneratesInfiniteUndo ())
02955 {
02956 pLastOp = Document::GetSelected()->GetOpHistory().FindLastOp();
02957 }
02958
02959 if (pLastOp)
02960 {
02961 if (pLastOp->GetRuntimeClass() == CC_RUNTIME_CLASS(OpChangeFillProfile))
02962 {
02963 FireOp = FALSE;
02964 }
02965 }
02966
02967 if (FireOp == TRUE)
02968 {
02969 FillProfileOpParam Param;
02970 Param.Profile = *Profile;
02971
02972 pOpDesc->Invoke(&Param);
02973 }
02974 else
02975 {
02976
02977
02978
02979 ChangeFillProfileAction Action;
02980 Action.ChangeFillProfileWithNoUndo ( *Profile);
02981 }
02982 }
02983 }
02984
02985
02986
02987
02988
02989
02990
02991
02992
02993
02994
02995
02996
02997
02998
02999
03000
03001
03002
03003 CProfileBiasGain* GradInfoBarOp::GetProfileFromSelection(CGadgetID GadgetID, BOOL* bMany, BOOL* bAllSameType)
03004 {
03005 BOOL ok = (GadgetID == _R(IDC_BIASGAIN));
03006
03007 ERROR2IF(ok==FALSE, FALSE, "Invalid gadgetID passed");
03008
03009 UINT32 TotalNumberSelected = (GetApplication()->FindSelection()->Count ());
03010
03011
03012 List ShadowList;
03013
03014 FillTools::GetSelectedAttrList(&ShadowList, CC_RUNTIME_CLASS(AttrFillGeometry), TRUE, FALSE);
03015
03016 AttrFillGeometry* pFirstNodeShadow = NULL;
03017 FillGeometryAttribute* pFirstFillGeoAttr = NULL;
03018
03019
03020 CProfileBiasGain* pFirstProfile = NULL;
03021
03022
03023
03024
03025
03026
03027
03028
03029
03030 NodeListItem * pItem = (NodeListItem *)ShadowList.GetHead();
03031
03032 while (pItem)
03033 {
03034 if (pFirstNodeShadow == NULL)
03035 {
03036 pFirstNodeShadow = (AttrFillGeometry*) pItem->pNode;
03037 pFirstFillGeoAttr = (FillGeometryAttribute*) pFirstNodeShadow->GetAttributeValue ();
03038
03039 pFirstProfile = pFirstFillGeoAttr->GetProfilePtr ();
03040
03041 if (pFirstNodeShadow->GetFillRamp () != NULL)
03042 {
03043 *bAllSameType = FALSE;
03044 }
03045 }
03046 else
03047 {
03048 if (((AttrFillGeometry*)pItem->pNode)->GetFillRamp () != NULL)
03049 {
03050 *bAllSameType = FALSE;
03051 }
03052
03053 CProfileBiasGain* pOtherProfile = NULL;
03054
03055 pOtherProfile = ((FillGeometryAttribute*) ((AttrFillGeometry*)pItem->pNode)->GetAttributeValue ())->GetProfilePtr ();
03056
03057 if (pOtherProfile)
03058 {
03059 if (*pFirstProfile == *pOtherProfile)
03060 {
03061
03062 }
03063 else
03064 {
03065 *bMany = TRUE;
03066 }
03067 }
03068 }
03069
03070 pItem = (NodeListItem *)ShadowList.GetNext(pItem);
03071 }
03072
03073 if (TotalNumberSelected != (UINT32) ShadowList.GetCount ())
03074 {
03075
03076
03077 if ((pFirstProfile) && (*bMany == FALSE))
03078 {
03079
03080
03081 SelRange* range = GetApplication()->FindSelection();
03082
03083 NodeRenderableInk* pNode = (NodeRenderableInk*) range->FindFirst ();
03084 NodeAttribute* pAttr;
03085
03086 while (pNode)
03087 {
03088 if (pNode->FindAppliedAttribute (CC_RUNTIME_CLASS (AttrFillGeometry), &pAttr))
03089 {
03090 pNode = (NodeRenderableInk*) (range->FindNext (pNode));
03091 }
03092 else
03093 {
03094
03095
03096 *bAllSameType = FALSE;
03097 ShadowList.DeleteAll();
03098 return (NULL);
03099 }
03100 }
03101 }
03102 else
03103 {
03104 *bAllSameType = FALSE;
03105 ShadowList.DeleteAll();
03106 return (NULL);
03107 }
03108 }
03109 if (m_BiasGainGadget.GetUseFillProfile () == FALSE)
03110 {
03111 ShadowList.DeleteAll();
03112 if (*bMany == TRUE)
03113 {
03114 return (NULL);
03115 }
03116 else
03117 {
03118 return (pFirstProfile);
03119 }
03120 }
03121 else
03122 {
03123
03124 if (*bMany == TRUE)
03125 {
03126 ShadowList.DeleteAll();
03127 return (NULL);
03128 }
03129 else
03130 {
03131
03132
03133
03134
03135 if (pFirstNodeShadow)
03136 {
03137 m_BiasGainGadget.SetStartColour (pFirstNodeShadow->GetStartColour ());
03138 m_BiasGainGadget.SetEndColour (pFirstNodeShadow->GetEndColour ());
03139
03140
03141
03142 String_64 Str;
03143
03144 CommonAttrEffect = SelRange::ATTR_NONE;
03145 Str.Load(_R(IDS_FILLTOOL_NONE));
03146
03147 if (Selection != NULL)
03148 {
03149
03150
03151
03152 CommonAttrEffect = Selection->FindCommonAttribute(CC_RUNTIME_CLASS(AttrFillEffect),
03153 (NodeAttribute**)&CommonEffect);
03154 CCRuntimeClass* EffectType;
03155
03156
03157
03158 SelRange::CommonAttribResult CommonType =
03159 Selection->FindCommonAttributeType(CC_RUNTIME_CLASS(AttrFillEffect),
03160 &EffectType);
03161
03162 if (CommonAttrEffect == SelRange::ATTR_NONE &&
03163 CommonEffect != NULL)
03164 {
03165 CommonAttrEffect = SelRange::ATTR_COMMON;
03166 }
03167
03168 if (CommonType == SelRange::ATTR_NONE &&
03169 EffectType != NULL)
03170 {
03171 CommonType = SelRange::ATTR_COMMON;
03172 }
03173
03174 FillEffectAttribute* TheEffect = NULL;
03175
03176
03177
03178 if (CommonType == SelRange::ATTR_COMMON)
03179 {
03180 if (EffectType == CC_RUNTIME_CLASS(AttrFillEffectFade))
03181 {
03182 TheEffect = new FillEffectFadeAttribute ();
03183 }
03184 else if (EffectType == CC_RUNTIME_CLASS(AttrFillEffectRainbow))
03185 {
03186 TheEffect = new FillEffectRainbowAttribute ();
03187 }
03188 else if (EffectType == CC_RUNTIME_CLASS(AttrFillEffectAltRainbow))
03189 {
03190 TheEffect = new FillEffectAltRainbowAttribute ();
03191 }
03192 }
03193
03194 if (CommonEffect != NULL)
03195 m_BiasGainGadget.SetFillEffect (TheEffect);
03196
03197
03198 }
03199
03200
03201 ShadowList.DeleteAll();
03202 }
03203
03204 return (pFirstProfile);
03205 }
03206 }
03207 }
03208
03209
03210
03211
03212
03213
03214
03215
03216
03217
03218
03219
03220
03221
03222
03223
03224 void GradInfoBarOp::InitControls()
03225 {
03226
03227 if (!GradFillTool::IsCurrentTool() || !IsVisible()) return;
03228
03229 DeleteAllValues(_R(IDC_GEOMETRY));
03230 DeleteAllValues(_R(IDC_EFFECT));
03231
03232 DeleteAllValues(_R(IDC_MAPPING));
03233
03234 m_oBitmapDropDown.Init(WindowID, _R(IDC_BITMAPEFFECT));
03235 m_oBitmapDropDown.SetColumns(3);
03236 m_oBitmapDropDown.SetItemSize(wxSize(50, 50));
03237
03238 String_64 Str;
03239
03240
03241 for ( INT32 i=0; i<FillGeometryMenuCount; i++ )
03242 {
03243 Str.Load( FillGeometryMenu[i].StringID );
03244 SetStringGadgetValue( _R(IDC_GEOMETRY), Str, TRUE, FillGeometryMenu[i].Geometry );
03245 }
03246
03247
03248 SetComboListLength(_R(IDC_GEOMETRY));
03249
03250 SetGadgetWritable(_R(IDC_GEOMETRY), FALSE);
03251 SetGadgetWritable(_R(IDC_MAPPING), FALSE);
03252 SetGadgetWritable(_R(IDC_EFFECT), FALSE);
03253 SetGadgetWritable(_R(IDC_SELPOINT), FALSE);
03254 SetGadgetWritable(_R(IDC_SELCOLOUR), FALSE);
03255
03256 SetGadgetHelp(_R(IDC_GEOMETRY), _R(IDBBL_FILLTOOL_FILLTYPE), _R(IDS_FILLTOOL_FILLTYPE));
03257 SetGadgetHelp(_R(IDC_EFFECT), _R(IDBBL_FILLTOOL_FILLEFFECT), _R(IDS_FILLTOOL_FILLEFFECT));
03258 SetGadgetHelp(_R(IDC_BITMAPEFFECT), _R(IDBBL_FILLTOOL_BITMAPNAME), _R(IDS_FILLTOOL_BITMAPNAME));
03259 SetGadgetHelp(_R(IDC_MAPPING), _R(IDBBL_FILLTOOL_FILLTILING), _R(IDS_FILLTOOL_FILLTILING));
03260 SetGadgetHelp(_R(IDC_SELPOINT), _R(IDBBL_FILLTOOL_FILLHANDLE), _R(IDS_FILLTOOL_FILLHANDLE));
03261
03262
03263 SelGeometryIndex = 0;
03264 SelMappingIndex = 0;
03265 SelEffectIndex = 0;
03266 SelPointIndex = 0;
03267
03268 CommonGeometry = NULL;
03269 CommonMapping = NULL;
03270 CommonEffect = NULL;
03271
03272 MappingDisabled = FALSE;
03273 EffectDisabled = FALSE;
03274 AllowForceToSimpleMapping = TRUE;
03275
03276 Mode = NOFILL;
03277
03278 m_BiasGainGadget.Init(this, _R(IDC_BIASGAIN), _R(IDBBL_BIASGAIN), _R(IDS_BIASGAINDLG));
03279 m_BiasGainGadget.ToggleFillProfile ();
03280
03281 ShowInfo();
03282 }
03283
03284
03285
03286
03287
03288
03289
03290
03291
03292
03293
03294
03295 void GradInfoBarOp::ShowInfo()
03296 {
03297
03298 if (!GradFillTool::IsCurrentTool() || !IsVisible()) return;
03299
03300
03301 Selection = GetApplication()->FindSelection();
03302
03303 OldMode = Mode;
03304
03305 ShowCommonType();
03306
03307
03308
03309
03310 switch (Mode)
03311 {
03312 case FLATFILL:
03313 ShowFlatInfo();
03314 break;
03315
03316 case GRADFILL:
03317 case GRADREPEATFILL:
03318 ShowGraduatedInfo();
03319 break;
03320
03321 case BITMAPFILL:
03322 ShowBitmapInfo();
03323 break;
03324
03325 case FRACTALFILL:
03326 ShowFractalInfo();
03327 break;
03328
03329 case NOISEFILL:
03330 ShowNoiseInfo();
03331 break;
03332
03333 default:
03334 ShowGraduatedInfo();
03335 break;
03336 }
03337
03338 EnableControls();
03339 }
03340
03341
03342
03343
03344
03345
03346
03347
03348
03349
03350
03351
03352 void GradInfoBarOp::InitEffect()
03353 {
03354 DeleteAllValues(_R(IDC_EFFECT));
03355 EnableGadget(_R(IDC_EFFECT), TRUE);
03356 EffectDisabled = FALSE;
03357
03358 String_64 Str;
03359
03360 Str.Load(_R(IDS_FILLTOOL_FADE));
03361 SetStringGadgetValue(_R(IDC_EFFECT),Str,FALSE, FEMENU_FADE);
03362 Str.Load(_R(IDS_FILLTOOL_RAINBOW));
03363 SetStringGadgetValue(_R(IDC_EFFECT),Str,FALSE, FEMENU_RAINBOW);
03364 Str.Load(_R(IDS_FILLTOOL_ALTRAINBOW));
03365 SetStringGadgetValue(_R(IDC_EFFECT),Str,TRUE, FEMENU_ALTRAINBOW);
03366
03367 SetComboListLength(_R(IDC_EFFECT));
03368 }
03369
03370
03371
03372
03373
03374
03375
03376
03377
03378
03379
03380
03381 void GradInfoBarOp::InitMapping()
03382 {
03383 DeleteAllValues(_R(IDC_MAPPING));
03384 EnableGadget(_R(IDC_MAPPING), TRUE);
03385 MappingDisabled = FALSE;
03386
03387 String_64 Str;
03388
03389 Str.Load(_R(IDS_FILLTOOL_MAPSIMPLE));
03390 SetStringGadgetValue(_R(IDC_MAPPING),Str,FALSE, FMMENU_SIMPLE);
03391 Str.Load(_R(IDS_FILLTOOL_MAPREPEAT));
03392 SetStringGadgetValue(_R(IDC_MAPPING),Str,TRUE, FMMENU_REPEATING);
03393
03394
03395 SetComboListLength(_R(IDC_MAPPING));
03396 }
03397
03398
03399
03400
03401
03402
03403
03404
03405
03406
03407
03408
03409 void GradInfoBarOp::InitBitmapName()
03410 {
03411
03412 m_oBitmapDropDown.Clear();
03413 EnableGadget (_R(IDC_BITMAPEFFECT), TRUE);
03414
03415 EffectDisabled = FALSE;
03416
03417 Document* pDoc = Document::GetSelected();
03418
03419
03420 BitmapList* Bitmaps = NULL;
03421 if (pDoc) Bitmaps = pDoc->GetBitmapList();
03422
03423 if (Bitmaps == NULL)
03424 return;
03425
03426 String_256 Str;
03427
03428 if (Bitmaps->GetCount() > 0)
03429 {
03430 INT32 Index = 0;
03431
03432 ListItem* pBmp = Bitmaps->GetHead();
03433
03434
03435 while (pBmp != NULL)
03436 {
03437 if (!((KernelBitmap*)pBmp)->HasBeenDeleted())
03438 {
03439 Str = ((KernelBitmap*)pBmp)->ActualBitmap->GetName();
03440
03441 KernelBitmap* bitmap = ((KernelBitmap*)pBmp);
03442 m_oBitmapDropDown.AddItem(bitmap, FALSE, Str);
03443
03444 Index++;
03445 }
03446
03447 pBmp = Bitmaps->GetNext(pBmp);
03448 }
03449
03450 }
03451 }
03452
03453
03454
03455
03456
03457
03458
03459
03460
03461
03462
03463
03464
03465 void GradInfoBarOp::InitTesselate()
03466 {
03467 DeleteAllValues(_R(IDC_MAPPING));
03468 EnableGadget(_R(IDC_MAPPING), TRUE);
03469 MappingDisabled = FALSE;
03470
03471 String_64 Str;
03472
03473 Str.Load(_R(IDS_FILLTOOL_TESS_SIMPLE));
03474 SetStringGadgetValue(_R(IDC_MAPPING),Str,FALSE, FTMENU_SIMPLE);
03475 Str.Load(_R(IDS_FILLTOOL_TESS_REPEAT));
03476 SetStringGadgetValue(_R(IDC_MAPPING),Str,FALSE, FTMENU_REPEAT);
03477 Str.Load(_R(IDS_FILLTOOL_TESS_REPEATINV));
03478 SetStringGadgetValue(_R(IDC_MAPPING),Str,TRUE, FTMENU_REPEATINV);
03479
03480 SetComboListLength(_R(IDC_MAPPING));
03481 }
03482
03483
03484
03485
03486
03487
03488
03489
03490
03491
03492
03493
03494
03495 BOOL GradInfoBarOp::SetGadgetString(CGadgetID Gadget, StringBase* StrValue)
03496 {
03497 if (Gadget == _R(IDC_EFFECT) && EffectDisabled)
03498 return TRUE;
03499
03500 if (Gadget == _R(IDC_MAPPING) && MappingDisabled)
03501 return TRUE;
03502
03503 if (GetStringGadgetValue(Gadget, NULL, -1) != *StrValue)
03504 {
03505 return SetStringGadgetValue(Gadget, *StrValue, FALSE, -1);
03506 }
03507
03508 return TRUE;
03509 }
03510
03511
03512
03513
03514
03515
03516
03517
03518
03519
03520
03521 void GradInfoBarOp::ShowFlatInfo()
03522 {
03523 if (OldMode != FLATFILL)
03524 {
03525 InitMapping();
03526 InitEffect();
03527
03528 SetGadgetHelp(_R(IDC_EFFECT), _R(IDBBL_FILLTOOL_FILLEFFECT), _R(IDS_FILLTOOL_FILLEFFECT));
03529 SetGadgetHelp(_R(IDC_MAPPING), _R(IDBBL_FILLTOOL_FILLTILING), _R(IDS_FILLTOOL_FILLTILING));
03530 SetGadgetHelp(_R(IDC_SELPOINT), _R(IDBBL_FILLTOOL_FILLHANDLE), _R(IDS_FILLTOOL_FILLHANDLE));
03531
03532 }
03533
03534 ShowCommonEffect();
03535 ShowCommonMapping();
03536 ShowControlPointInfo();
03537 }
03538
03539
03540
03541
03542
03543
03544
03545
03546
03547
03548
03549 void GradInfoBarOp::ShowGraduatedInfo()
03550 {
03551 if (OldMode != GRADFILL && OldMode != GRADREPEATFILL)
03552 {
03553 InitMapping();
03554 InitEffect();
03555
03556 SetGadgetHelp(_R(IDC_EFFECT), _R(IDBBL_FILLTOOL_FILLEFFECT), _R(IDS_FILLTOOL_FILLEFFECT));
03557 SetGadgetHelp(_R(IDC_MAPPING), _R(IDBBL_FILLTOOL_FILLTILING), _R(IDS_FILLTOOL_FILLTILING));
03558 SetGadgetHelp(_R(IDC_SELPOINT), _R(IDBBL_FILLTOOL_FILLHANDLE), _R(IDS_FILLTOOL_FILLHANDLE));
03559
03560 }
03561
03562 ShowCommonEffect();
03563 ShowCommonMapping();
03564 ShowControlPointInfo();
03565 }
03566
03567
03568
03569
03570
03571
03572
03573
03574
03575
03576
03577 void GradInfoBarOp::ShowBitmapInfo()
03578 {
03579 if (OldMode != BITMAPFILL)
03580 {
03581 InitTesselate ();
03582 InitEffect ();
03583 InitBitmapName ();
03584
03585 SetGadgetHelp(_R(IDC_BITMAPEFFECT), _R(IDBBL_FILLTOOL_BITMAPNAME), _R(IDS_FILLTOOL_BITMAPNAME));
03586 SetGadgetHelp(_R(IDC_MAPPING), _R(IDBBL_FILLTOOL_FILLTILING), _R(IDS_FILLTOOL_FILLTILING));
03587
03588 }
03589
03590 if (AttrFillGeometry::SelectionCount == 0)
03591 {
03592 SetGadgetHelp(_R(IDC_SELPOINT), _R(IDBBL_FILLTOOL_BITMAPRES), _R(IDS_FILLTOOL_BITMAPRES));
03593 SetGadgetWritable(_R(IDC_SELPOINT), TRUE);
03594 }
03595 else
03596 {
03597 SetGadgetHelp(_R(IDC_SELPOINT), _R(IDBBL_FILLTOOL_FILLHANDLE), _R(IDS_FILLTOOL_FILLHANDLE));
03598 SetGadgetWritable(_R(IDC_SELPOINT), FALSE);
03599 }
03600
03601 ShowCommonTesselate();
03602 ShowCommonEffect ();
03603 ShowCommonBitmapName();
03604 ShowControlPointInfo();
03605
03606 if (AttrFillGeometry::SelectionCount == 0)
03607 ShowCommonBitmapDpi();
03608 }
03609
03610
03611
03612
03613
03614
03615
03616
03617
03618
03619
03620
03621
03622 void GradInfoBarOp::ShowFractalInfo()
03623 {
03624 if (OldMode != FRACTALFILL)
03625 {
03626
03627 InitTesselate();
03628 InitEffect();
03629
03630 SetGadgetHelp(_R(IDC_EFFECT), _R(IDBBL_FILLTOOL_FILLEFFECT), _R(IDS_FILLTOOL_FILLEFFECT));
03631 SetGadgetHelp(_R(IDC_MAPPING), _R(IDBBL_FILLTOOL_FILLTILING), _R(IDS_FILLTOOL_FILLTILING));
03632 }
03633
03634 if (AttrFillGeometry::SelectionCount == 0)
03635 {
03636 SetGadgetHelp(_R(IDC_SELPOINT), _R(IDBBL_FILLTOOL_FRACTALRES), _R(IDS_FILLTOOL_FRACTALRES));
03637 SetGadgetHelp(_R(IDC_SELCOLOUR), _R(IDBBL_FILLTOOL_GRAININESS), _R(IDS_FILLTOOL_GRAININESS));
03638 SetGadgetWritable(_R(IDC_SELPOINT), TRUE);
03639 SetGadgetWritable(_R(IDC_SELCOLOUR), TRUE);
03640 }
03641 else
03642 {
03643 SetGadgetHelp(_R(IDC_SELPOINT), _R(IDBBL_FILLTOOL_FILLHANDLE), _R(IDS_FILLTOOL_FILLHANDLE));
03644 SetGadgetHelp(_R(IDC_SELCOLOUR), _R(IDBBL_FILLTOOL_FILLCOLOUR), _R(IDS_FILLTOOL_FILLCOLOUR));
03645 SetGadgetWritable(_R(IDC_SELPOINT), FALSE);
03646 SetGadgetWritable(_R(IDC_SELCOLOUR), FALSE);
03647 }
03648
03649
03650 ShowCommonTesselate();
03651 ShowCommonEffect();
03652
03653 if (AttrFillGeometry::SelectionCount == 0)
03654 {
03655 ShowCommonBitmapDpi();
03656 ShowCommonFractalGrain();
03657 }
03658 else
03659 {
03660 ShowControlPointInfo();
03661 }
03662 }
03663
03664
03665
03666
03667
03668
03669
03670
03671
03672
03673
03674 void GradInfoBarOp::ShowNoiseInfo()
03675 {
03676 if (OldMode != NOISEFILL)
03677 {
03678 InitTesselate();
03679 InitEffect();
03680
03681 SetGadgetHelp(_R(IDC_EFFECT), _R(IDBBL_FILLTOOL_FILLEFFECT), _R(IDS_FILLTOOL_FILLEFFECT));
03682 SetGadgetHelp(_R(IDC_MAPPING), _R(IDBBL_FILLTOOL_FILLTILING), _R(IDS_FILLTOOL_FILLTILING));
03683 }
03684
03685 if (AttrFillGeometry::SelectionCount == 0)
03686 {
03687 SetGadgetHelp(_R(IDC_SELPOINT), _R(IDBBL_FILLTOOL_NOISERES), _R(IDS_FILLTOOL_NOISERES));
03688 SetGadgetHelp(_R(IDC_SELCOLOUR), _R(IDBBL_FILLTOOL_NOISESCALE), _R(IDS_FILLTOOL_NOISESCALE));
03689 SetGadgetWritable(_R(IDC_SELPOINT), TRUE);
03690 SetGadgetWritable(_R(IDC_SELCOLOUR), TRUE);
03691 }
03692 else
03693 {
03694 SetGadgetHelp(_R(IDC_SELPOINT), _R(IDBBL_FILLTOOL_FILLHANDLE), _R(IDS_FILLTOOL_FILLHANDLE));
03695 SetGadgetHelp(_R(IDC_SELCOLOUR), _R(IDBBL_FILLTOOL_FILLCOLOUR), _R(IDS_FILLTOOL_FILLCOLOUR));
03696 SetGadgetWritable(_R(IDC_SELPOINT), FALSE);
03697 SetGadgetWritable(_R(IDC_SELCOLOUR), FALSE);
03698 }
03699
03700 ShowCommonTesselate();
03701 ShowCommonEffect();
03702
03703 if (AttrFillGeometry::SelectionCount == 0)
03704 {
03705 ShowCommonBitmapDpi();
03706 ShowCommonNoiseScale();
03707 }
03708 else
03709 {
03710 ShowControlPointInfo();
03711 }
03712 }
03713
03714
03715
03716
03717
03718
03719
03720
03721
03722
03723
03724
03725
03726 void GradInfoBarOp::ShowCommonType(BOOL ShowDataAndNotSet)
03727 {
03728 String_64 Str;
03729
03730 CommonAttr = SelRange::ATTR_NONE;
03731 Str.Load(_R(IDS_FILLTOOL_NONE));
03732
03733 if (Selection != NULL)
03734 {
03735 Document* pCurrentDoc = Document::GetCurrent();
03736 if (Document::GetSelected())
03737 Document::GetSelected()->SetCurrent();
03738
03739
03740
03741
03742 CommonAttr = Selection->FindCommonAttribute(CC_RUNTIME_CLASS(AttrFillGeometry),
03743 (NodeAttribute**)&CommonGeometry);
03744 CCRuntimeClass* GeometryType;
03745
03746
03747
03748 SelRange::CommonAttribResult CommonType =
03749 Selection->FindCommonAttributeType(CC_RUNTIME_CLASS(AttrFillGeometry),
03750 &GeometryType);
03751
03752 if (CommonAttr == SelRange::ATTR_NONE &&
03753 CommonGeometry != NULL)
03754 {
03755 CommonAttr = SelRange::ATTR_COMMON;
03756 }
03757
03758 if (CommonType == SelRange::ATTR_NONE &&
03759 GeometryType != NULL)
03760 {
03761 CommonType = SelRange::ATTR_COMMON;
03762 }
03763
03764
03765
03766 if (CommonType == SelRange::ATTR_COMMON)
03767 {
03768 if (GeometryType == CC_RUNTIME_CLASS(AttrFlatColourFill))
03769 {
03770 Str.Load(_R(IDS_FILLTOOL_FLATFILL));
03771 Mode = FLATFILL;
03772 CurrentGeometryIndex = FGMENU_FLAT;
03773 }
03774 else if (GeometryType == CC_RUNTIME_CLASS(AttrLinearColourFill))
03775 {
03776 Str.Load(_R(IDS_FILLTOOL_LINEAR));
03777 Mode = GRADFILL;
03778 CurrentGeometryIndex = FGMENU_LINEAR;
03779 }
03780 else if (GeometryType == CC_RUNTIME_CLASS(AttrCircularColourFill))
03781 {
03782 Str.Load(_R(IDS_FILLTOOL_CIRCULAR));
03783 Mode = GRADFILL;
03784 CurrentGeometryIndex = FGMENU_CIRCULAR;
03785 }
03786 else if (GeometryType == CC_RUNTIME_CLASS(AttrRadialColourFill))
03787 {
03788 Str.Load(_R(IDS_FILLTOOL_ELLIPTICAL));
03789 Mode = GRADFILL;
03790 CurrentGeometryIndex = FGMENU_RADIAL;
03791 }
03792 else if (GeometryType == CC_RUNTIME_CLASS(AttrConicalColourFill))
03793 {
03794 Str.Load(_R(IDS_FILLTOOL_CONICAL));
03795 Mode = GRADFILL;
03796 CurrentGeometryIndex = FGMENU_CONICAL;
03797 }
03798 else if (GeometryType == CC_RUNTIME_CLASS(AttrSquareColourFill))
03799 {
03800 Str.Load(_R(IDS_FILLTOOL_SQUARE));
03801 Mode = GRADFILL;
03802 CurrentGeometryIndex = FGMENU_SQUARE;
03803 }
03804 else if (GeometryType == CC_RUNTIME_CLASS(AttrThreeColColourFill))
03805 {
03806 Str.Load(_R(IDS_FILLTOOL_THREECOL));
03807 Mode = GRADREPEATFILL;
03808 CurrentGeometryIndex = FGMENU_THREECOL;
03809 }
03810 else if (GeometryType == CC_RUNTIME_CLASS(AttrFourColColourFill))
03811 {
03812 Str.Load(_R(IDS_FILLTOOL_FOURCOL));
03813 Mode = GRADREPEATFILL;
03814 CurrentGeometryIndex = FGMENU_FOURCOL;
03815 }
03816 else if (GeometryType == CC_RUNTIME_CLASS(AttrBitmapColourFill))
03817 {
03818 Str.Load(_R(IDS_FILLTOOL_BITMAP));
03819 Mode = BITMAPFILL;
03820 CurrentGeometryIndex = FGMENU_BITMAP;
03821 }
03822 else if (GeometryType == CC_RUNTIME_CLASS(AttrFractalColourFill))
03823 {
03824 Str.Load(_R(IDS_FILLTOOL_FRACTAL));
03825 Mode = FRACTALFILL;
03826 CurrentGeometryIndex = FGMENU_FRACTAL;
03827 }
03828 else if (GeometryType == CC_RUNTIME_CLASS(AttrNoiseColourFill))
03829 {
03830 Str.Load(_R(IDS_FILLTOOL_NOISE));
03831 Mode = NOISEFILL;
03832 CurrentGeometryIndex = FGMENU_NOISE;
03833 }
03834 }
03835 else
03836 {
03837 if (CommonAttr == SelRange::ATTR_MANY)
03838 {
03839
03840 Str.Load(_R(IDS_FILLTOOL_MANY));
03841 Mode = MANYFILLS;
03842 CurrentGeometryIndex = FGMENU_MANY;
03843 }
03844 }
03845
03846 if (pCurrentDoc)
03847 pCurrentDoc->SetCurrent();
03848 }
03849
03850
03851 if (ShowDataAndNotSet)
03852 {
03853 SetGadgetString(_R(IDC_GEOMETRY),&Str);
03854 }
03855 }
03856
03857
03858
03859
03860
03861
03862
03863
03864
03865
03866
03867
03868
03869
03870
03871 void GradInfoBarOp::ShowCommonMapping(BOOL ShowDataAndNotSet)
03872 {
03873 String_64 Str;
03874
03875 INT32 CommTess = FindCommonTesselate();
03876
03877 switch (CommTess)
03878 {
03879 case -1:
03880 Str.Load(_R(IDS_FILLTOOL_MANY));
03881 CurrentMappingIndex = -2;
03882 break;
03883
03884 case 0:
03885 Str.Load(_R(IDS_FILLTOOL_NONE));
03886 CurrentMappingIndex = -1;
03887 break;
03888
03889 case 1:
03890 Str.Load(_R(IDS_FILLTOOL_MAPSIMPLE));
03891 CurrentMappingIndex = FMMENU_SIMPLE;
03892 break;
03893
03894 case 2:
03895
03896
03897 #ifdef NEW_FEATURES
03898 if(Mode == GRADFILL)
03899 {
03900 Str.Load(_R(IDS_FILLTOOL_MAPSIMPLE));
03901 CurrentMappingIndex = FMMENU_SIMPLE;
03902 break;
03903 }
03904 else
03905 {
03906 Str.Load(_R(IDS_FILLTOOL_MAPREPEAT));
03907 CurrentMappingIndex = FMMENU_REPEATING;
03908 break;
03909 }
03910 case 4:
03911 #endif
03912 case 3:
03913 Str.Load(_R(IDS_FILLTOOL_MAPREPEAT));
03914 CurrentMappingIndex = 2;
03915 break;
03916 }
03917
03918 if (ShowDataAndNotSet)
03919 {
03920 SetGadgetString(_R(IDC_MAPPING),&Str);
03921 }
03922 }
03923
03924
03925
03926
03927
03928
03929
03930
03931
03932
03933
03934
03935
03936 void GradInfoBarOp::ShowCommonEffect(BOOL ShowDataAndNotSet)
03937 {
03938 String_64 Str;
03939
03940 CommonAttrEffect = SelRange::ATTR_NONE;
03941 Str.Load(_R(IDS_FILLTOOL_NONE));
03942
03943 if (Selection != NULL)
03944 {
03945
03946
03947
03948 CommonAttrEffect = Selection->FindCommonAttribute(CC_RUNTIME_CLASS(AttrFillEffect),
03949 (NodeAttribute**)&CommonEffect);
03950 CCRuntimeClass* EffectType;
03951
03952
03953
03954 SelRange::CommonAttribResult CommonType =
03955 Selection->FindCommonAttributeType(CC_RUNTIME_CLASS(AttrFillEffect),
03956 &EffectType);
03957
03958 if (CommonAttrEffect == SelRange::ATTR_NONE &&
03959 CommonEffect != NULL)
03960 {
03961 CommonAttrEffect = SelRange::ATTR_COMMON;
03962 }
03963
03964 if (CommonType == SelRange::ATTR_NONE &&
03965 EffectType != NULL)
03966 {
03967 CommonType = SelRange::ATTR_COMMON;
03968 }
03969
03970
03971
03972 if (CommonType == SelRange::ATTR_COMMON)
03973 {
03974 if (EffectType == CC_RUNTIME_CLASS(AttrFillEffectFade))
03975 {
03976 Str.Load(_R(IDS_FILLTOOL_FADE));
03977 CurrentEffectIndex = FEMENU_FADE;
03978 }
03979 else if (EffectType == CC_RUNTIME_CLASS(AttrFillEffectRainbow))
03980 {
03981 Str.Load(_R(IDS_FILLTOOL_RAINBOW));
03982 CurrentEffectIndex = FEMENU_RAINBOW;
03983 }
03984 else if (EffectType == CC_RUNTIME_CLASS(AttrFillEffectAltRainbow))
03985 {
03986 Str.Load(_R(IDS_FILLTOOL_ALTRAINBOW));
03987 CurrentEffectIndex = FEMENU_ALTRAINBOW;
03988 }
03989 }
03990 else
03991 {
03992 if (CommonType == SelRange::ATTR_MANY)
03993 {
03994
03995 Str.Load(_R(IDS_FILLTOOL_MANY));
03996 CurrentEffectIndex = -1;
03997 }
03998 }
03999 }
04000
04001
04002 if (ShowDataAndNotSet)
04003 {
04004 SetGadgetString(_R(IDC_EFFECT),&Str);
04005 }
04006 }
04007
04008
04009
04010
04011
04012
04013
04014
04015
04016
04017
04018
04019 void GradInfoBarOp::ShowCommonTesselate()
04020 {
04021 String_64 Str;
04022
04023 INT32 CommTess = FindCommonTesselate();
04024
04025 switch (CommTess)
04026 {
04027 case -1:
04028 Str.Load(_R(IDS_FILLTOOL_MANY));
04029 CurrentMappingIndex = FTMENU_REPEAT;
04030 break;
04031
04032 case 0:
04033 Str.Load(_R(IDS_FILLTOOL_NONE));
04034 CurrentMappingIndex = FTMENU_REPEAT;
04035 break;
04036
04037 case 1:
04038 Str.Load(_R(IDS_FILLTOOL_TESS_SIMPLE));
04039 CurrentMappingIndex = FTMENU_SIMPLE;
04040 break;
04041
04042 case 2:
04043 Str.Load(_R(IDS_FILLTOOL_TESS_REPEAT));
04044 CurrentMappingIndex = FTMENU_REPEAT;
04045 break;
04046
04047 case 3:
04048 Str.Load(_R(IDS_FILLTOOL_TESS_REPEATINV));
04049 CurrentMappingIndex = FTMENU_REPEATINV;
04050 break;
04051 }
04052
04053 SetGadgetString(_R(IDC_MAPPING),&Str);
04054 EnableGadget(_R(IDC_MAPPING), TRUE);
04055 }
04056
04057
04058
04059
04060
04061
04062
04063
04064
04065
04066
04067 INT32 GradInfoBarOp::FindCommonTesselate()
04068 {
04069 INT32 CommonTess = 0;
04070 Node* pNode;
04071 NodeAttribute* pChild;
04072
04073 if (Selection->Count() == 0)
04074 {
04075 AttrFillMapping* pCurrentMapping = GetCurrentMapping();
04076
04077 if (pCurrentMapping != NULL)
04078 {
04079 return pCurrentMapping->GetRepeat();
04080 }
04081
04082 return 0;
04083 }
04084
04085
04086 if (Selection != NULL)
04087 {
04088
04089 pNode = Selection->FindFirst();
04090 while (pNode != NULL)
04091 {
04092 BOOL FoundAttr = ((NodeRenderableInk*)pNode)->FindAppliedAttribute(CC_RUNTIME_CLASS(AttrFillMapping), &pChild);
04093
04094 if (FoundAttr)
04095 {
04096 INT32 Tess = ((AttrFillMapping*)pChild)->GetRepeat();
04097
04098 if (CommonTess == 0)
04099 CommonTess = Tess;
04100
04101 if (Tess != CommonTess)
04102 {
04103 return -1;
04104 }
04105 }
04106
04107 pNode = Selection->FindNext(pNode);
04108 }
04109 }
04110
04111
04112
04113
04114 return CommonTess;
04115 }
04116
04117
04118
04119
04120
04121
04122
04123
04124
04125
04126
04127 void GradInfoBarOp::ShowCommonBitmapName()
04128 {
04129 String_64 strName = FindCommonBitmapName();
04130 m_oBitmapDropDown.SelectByLabel(strName);
04131 }
04132
04133
04134
04135
04136
04137
04138
04139
04140
04141
04142
04143 String_256 GradInfoBarOp::FindCommonBitmapName()
04144 {
04145 String_256 CommonName;
04146 CommonName.Load(_R(IDS_FILLTOOL_NONE));
04147
04148 String_256 Name;
04149 Name.Load(_R(IDS_FILLTOOL_NONE));
04150
04151 String_256 None;
04152 None.Load(_R(IDS_FILLTOOL_NONE));
04153
04154 String_256 Many;
04155 Many.Load(_R(IDS_FILLTOOL_MANY));
04156
04157 if (Selection->Count() == 0)
04158 {
04159 AttrFillGeometry* pCurrentFill = GetCurrentGeometry();
04160
04161 if (pCurrentFill && pCurrentFill->IsABitmapFill())
04162 {
04163 KernelBitmap* pBitmap = pCurrentFill->GetBitmap();
04164 if (pBitmap)
04165 {
04166 OILBitmap* pOilBitmap = pBitmap->ActualBitmap;
04167 if (pOilBitmap)
04168 {
04169 return pOilBitmap->GetName();
04170 }
04171 }
04172 }
04173
04174 return None;
04175 }
04176
04177
04178 AttrFillGeometry* pAttrNode = AttrFillGeometry::FindFirstSelectedAttr();
04179
04180
04181 if (pAttrNode == NULL)
04182 return None;
04183
04184 while (pAttrNode != NULL)
04185 {
04186 if (pAttrNode->IsKindOf(CC_RUNTIME_CLASS(AttrBitmapColourFill)))
04187 {
04188 Name = None;
04189 KernelBitmap* pBitmap = pAttrNode->GetBitmap();
04190 if (pBitmap)
04191 {
04192 OILBitmap* pOilBitmap = pBitmap->ActualBitmap;
04193 if (pOilBitmap)
04194 {
04195 Name = pOilBitmap->GetName();
04196 }
04197 }
04198
04199 if (CommonName == None)
04200 CommonName = Name;
04201
04202 if (Name != CommonName)
04203 {
04204 return Many;
04205 }
04206 }
04207
04208
04209 pAttrNode = AttrFillGeometry::FindNextSelectedAttr();
04210 }
04211
04212 return CommonName;
04213 }
04214
04215
04216
04217
04218
04219
04220
04221
04222
04223
04224
04225 void GradInfoBarOp::ShowCommonBitmapDpi()
04226 {
04227 INT32 dpi = FindCommonBitmapDpi();
04228
04229 String_64 DpiStr;
04230
04231 if (dpi == 0)
04232 {
04233 DpiStr.Load(_R(IDS_FILLTOOL_NODPI));
04234 }
04235
04236 if (dpi == -1)
04237 {
04238 DpiStr.Load(_R(IDS_FILLTOOL_MANYDPI));
04239 }
04240
04241 if (dpi > 0)
04242 {
04243
04244 Convert::LongToString(dpi, &DpiStr);
04245 DpiStr += String_64(_R(IDS_FILLTOOL_DPI));
04246 }
04247
04248 SetGadgetString(_R(IDC_SELPOINT),&DpiStr);
04249 SetGadgetWritable(_R(IDC_SELPOINT), TRUE);
04250 }
04251
04252
04253
04254
04255
04256
04257
04258
04259
04260
04261
04262
04263
04264
04265 void GradInfoBarOp::SetGadgetWritable(INT32 id, BOOL enable)
04266 {
04267 PORTNOTETRACE("other","GradInfoBarOp::SetGadgetWritable - disabled");
04268 #ifndef EXCLUDE_FROM_XARALX
04269
04270 HWND gadget = ::GetDlgItem(WindowID, id);
04271
04272
04273 HWND hEdit = ::ChildWindowFromPoint(gadget, CPoint(1,1));
04274
04275 if (hEdit)
04276 gadget = hEdit;
04277
04278 if (enable)
04279 {
04280 ::SendMessage(gadget, EM_SETREADONLY, FALSE, 0);
04281 }
04282 else
04283 {
04284 ::SendMessage(gadget, EM_SETREADONLY, TRUE, 0);
04285 }
04286 #endif
04287 }
04288
04289
04290
04291
04292
04293
04294
04295
04296
04297
04298
04299
04300
04301
04302
04303 BOOL GradInfoBarOp::GetGadgetWritable (INT32 id)
04304 {
04305 PORTNOTETRACE("other","GradInfoBarOp::SetGadgetWritable - disabled");
04306 #ifndef EXCLUDE_FROM_XARALX
04307
04308 HWND gadget = ::GetDlgItem (WindowID, id);
04309
04310
04311 HWND hEdit = ::ChildWindowFromPoint (gadget, CPoint(1,1));
04312
04313 if (hEdit)
04314 gadget = hEdit;
04315
04316 if (GetWindowLong (gadget, GWL_STYLE) & ES_READONLY)
04317 {
04318 return (TRUE);
04319 }
04320 else
04321 {
04322 return (FALSE);
04323 }
04324 #else
04325 return TRUE;
04326 #endif
04327 }
04328
04329
04330
04331
04332
04333
04334
04335
04336
04337
04338
04339 INT32 GradInfoBarOp::FindCommonBitmapDpi()
04340 {
04341 if (Selection->Count() == 0)
04342 {
04343 AttrFillGeometry* pCurrentFill = GetCurrentGeometry();
04344
04345 if (pCurrentFill && pCurrentFill->IsABitmapFill())
04346 {
04347 return pCurrentFill->GetDPI();
04348 }
04349
04350 return 0;
04351 }
04352
04353
04354 AttrFillGeometry* pAttrNode = AttrFillGeometry::FindFirstSelectedAttr();
04355
04356
04357 if (pAttrNode == NULL)
04358 return 0;
04359
04360 INT32 CommonDpi = 0;
04361 INT32 Dpi = 0;
04362
04363 while (pAttrNode != NULL)
04364 {
04365 if (pAttrNode->IsKindOf(CC_RUNTIME_CLASS(AttrBitmapFill)))
04366 {
04367 if (pAttrNode->IsKindOf(CC_RUNTIME_CLASS(AttrTextureColourFill)) ||
04368 pAttrNode->IsKindOf(CC_RUNTIME_CLASS(AttrBitmapColourFill)) )
04369 {
04370 Dpi = pAttrNode->GetDPI();
04371
04372 if (CommonDpi == 0)
04373 CommonDpi = Dpi;
04374
04375 if (Dpi != CommonDpi)
04376 {
04377 return -1;
04378 }
04379 }
04380 }
04381
04382
04383 pAttrNode = AttrFillGeometry::FindNextSelectedAttr();
04384 }
04385
04386 return CommonDpi;
04387 }
04388
04389
04390
04391
04392
04393
04394
04395
04396
04397
04398
04399
04400 void GradInfoBarOp::ShowCommonFractalGrain()
04401 {
04402 double Grain = FindCommonFractalGrain();
04403
04404 String_64 GrainStr;
04405
04406 if (Grain == 0)
04407 GrainStr.Load(_R(IDS_FILLTOOL_NOGRAIN));
04408 if (Grain == -1)
04409 GrainStr.Load(_R(IDS_FILLTOOL_MANYGRAIN));
04410 if (Grain > 0)
04411 Convert::DoubleToString(Grain, &GrainStr, 1);
04412
04413 SetGadgetString(_R(IDC_SELCOLOUR),&GrainStr);
04414 SetGadgetWritable(_R(IDC_SELCOLOUR), TRUE);
04415 }
04416
04417
04418
04419
04420
04421
04422
04423
04424
04425
04426
04427 double GradInfoBarOp::FindCommonFractalGrain()
04428 {
04429 if (Selection->Count() == 0)
04430 {
04431 AttrFillGeometry* pCurrentFill = GetCurrentGeometry();
04432
04433 if (pCurrentFill && pCurrentFill->IsAFractalFill())
04434 {
04435 return ((FractalFillAttribute*)pCurrentFill->GetAttributeValue())->Graininess.MakeDouble();
04436 }
04437
04438 return 0;
04439 }
04440
04441
04442 AttrFillGeometry* pAttrNode = AttrFillGeometry::FindFirstSelectedAttr();
04443
04444
04445 if (pAttrNode == NULL)
04446 return 0;
04447
04448 double CommonGrain = 0;
04449
04450 while (pAttrNode != NULL)
04451 {
04452 if (pAttrNode->IsKindOf(CC_RUNTIME_CLASS(AttrFractalColourFill)))
04453 {
04454 double Grain = ((FractalFillAttribute*)pAttrNode->GetAttributeValue())->Graininess.MakeDouble();
04455
04456 if (CommonGrain == 0)
04457 CommonGrain = Grain;
04458
04459 if (Grain != CommonGrain)
04460 {
04461 return -1;
04462 }
04463 }
04464
04465
04466 pAttrNode = AttrFillGeometry::FindNextSelectedAttr();
04467 }
04468
04469 return CommonGrain;
04470 }
04471
04472
04473
04474
04475
04476
04477
04478
04479
04480
04481
04482 void GradInfoBarOp::ShowCommonNoiseScale()
04483 {
04484 double Scale = FindCommonNoiseScale();
04485
04486 String_64 ScaleStr;
04487
04488 if (Scale == 0)
04489 ScaleStr.Load(_R(IDS_FILLTOOL_NOGRAIN));
04490 if (Scale == -1)
04491 ScaleStr.Load(_R(IDS_FILLTOOL_MANYGRAIN));
04492 if (Scale > 0)
04493 Convert::DoubleToString(Scale, &ScaleStr, 1);
04494
04495 SetGadgetString(_R(IDC_SELCOLOUR),&ScaleStr);
04496 SetGadgetWritable(_R(IDC_SELCOLOUR), TRUE);
04497 }
04498
04499
04500
04501
04502
04503
04504
04505
04506
04507
04508
04509 double GradInfoBarOp::FindCommonNoiseScale()
04510 {
04511 if (Selection->Count() == 0)
04512 {
04513 AttrFillGeometry* pCurrentFill = GetCurrentGeometry();
04514
04515 if (pCurrentFill && IS_A(pCurrentFill, AttrNoiseColourFill))
04516 {
04517 return ((NoiseFillAttribute*)pCurrentFill->GetAttributeValue())->GetGraininess().MakeDouble();
04518 }
04519
04520 return 0;
04521 }
04522
04523
04524 AttrFillGeometry* pAttrNode = AttrFillGeometry::FindFirstSelectedAttr();
04525
04526
04527 if (pAttrNode == NULL)
04528 return 0;
04529
04530 double CommonScale = 0;
04531
04532 while (pAttrNode != NULL)
04533 {
04534 if (pAttrNode->IsKindOf(CC_RUNTIME_CLASS(AttrNoiseColourFill)))
04535 {
04536 double Scale = ((NoiseFillAttribute*)pAttrNode->GetAttributeValue())->GetGraininess().MakeDouble();
04537
04538 if (CommonScale == 0)
04539 CommonScale = Scale;
04540
04541 if (Scale != CommonScale)
04542 {
04543 return -1;
04544 }
04545 }
04546
04547
04548 pAttrNode = AttrFillGeometry::FindNextSelectedAttr();
04549 }
04550
04551 return CommonScale;
04552 }
04553
04554
04555
04556
04557
04558
04559
04560
04561
04562
04563
04564 void GradInfoBarOp::ShowControlPointInfo()
04565 {
04566 String_64 PointStr;
04567 String_64 ColourStr;
04568
04569
04570 ScanSelectionForControlPoints(&PointStr, &ColourStr);
04571
04572
04573
04574
04575 SetStringGadgetValue(_R(IDC_SELPOINT), PointStr);
04576 SetStringGadgetValue(_R(IDC_SELCOLOUR), ColourStr);
04577
04578 if ((Mode != BITMAPFILL &&
04579 Mode != FRACTALFILL &&
04580 Mode != NOISEFILL ) || AttrFillGeometry::SelectionCount > 0)
04581 {
04582 SetGadgetString(_R(IDC_SELPOINT),&PointStr);
04583 }
04584
04585 SetGadgetString(_R(IDC_SELCOLOUR),&ColourStr);
04586 }
04587
04588
04589
04590
04591
04592
04593
04594
04595
04596
04597
04598 void GradInfoBarOp::ScanSelectionForControlPoints(String_64* PointString,
04599 String_64* ColourString)
04600 {
04601 *PointString = _T("");
04602 *ColourString = _T("");
04603
04604 AttrFillGeometry* pAttrNode;
04605 UINT32 count = Selection->Count();
04606
04607
04608 if (count == 0)
04609 {
04610 pAttrNode = GetCurrentGeometry();
04611 }
04612 else
04613 {
04614 pAttrNode = AttrFillGeometry::FindFirstSelectedAttr();
04615 }
04616
04617 AllowForceToSimpleMapping = TRUE;
04618
04619
04620 if (pAttrNode == NULL)
04621 {
04622 (*PointString).Load(_R(IDS_FILLTOOL_NONE));
04623 (*ColourString).Load(_R(IDS_FILLTOOL_NONE));
04624 return;
04625 }
04626
04627 INT32 SelCount = 0;
04628 BOOL CommonColour = TRUE;
04629 BOOL CommonPoint = TRUE;
04630
04631 BOOL AllFlat = TRUE;
04632 BOOL AnyNeedSimple = FALSE;
04633
04634 while (pAttrNode != NULL)
04635 {
04636 if (AttrFillGeometry::FillSelectionCount() > 0)
04637 {
04638 if (!(pAttrNode->GetRuntimeClass() == CC_RUNTIME_CLASS(AttrFlatColourFill)))
04639 {
04640
04641 String_64 PointStr = GetSelectedPoint(pAttrNode);
04642 String_64 ColourStr = GetSelectedColour(pAttrNode);
04643
04644 String_64 Str;
04645 Str.Load(_R(IDS_FILLTOOL_NONE));
04646
04647
04648 if (PointStr != Str)
04649 {
04650
04651 *PointString = PointStr;
04652 SelCount++;
04653
04654 if (*PointString == String_64(_T("")))
04655 *PointString = PointStr;
04656
04657 if (*PointString != PointStr)
04658 CommonPoint = FALSE;
04659
04660 if (*ColourString == String_64(_T("")))
04661 *ColourString = ColourStr;
04662
04663 if (*ColourString != ColourStr)
04664 CommonColour = FALSE;
04665
04666 AllFlat = FALSE;
04667 }
04668 }
04669 }
04670 else
04671 {
04672 if (pAttrNode->GetRuntimeClass() == CC_RUNTIME_CLASS(AttrFlatColourFill))
04673 {
04674 if ( pAttrNode->GetStartColour() != NULL )
04675 {
04676 (*PointString).Load(_R(IDS_FILLTOOL_FLATFILL));
04677
04678 if (*ColourString == String_64(_T("")))
04679 *ColourString = GetColourName(*pAttrNode->GetStartColour());
04680
04681 if (*ColourString != GetColourName(*pAttrNode->GetStartColour()))
04682 CommonColour = FALSE;
04683
04684 SelCount++;
04685 }
04686 }
04687 else
04688 {
04689 if (SelCount > 0)
04690 AllFlat = FALSE;
04691 }
04692 }
04693
04694
04695 if (pAttrNode->IsAColourFill() && pAttrNode->NeedsForceToSimpleMapping())
04696 AnyNeedSimple = TRUE;
04697
04698
04699 if (count > 0)
04700 pAttrNode = AttrFillGeometry::FindNextSelectedAttr();
04701 else
04702 pAttrNode = NULL;
04703 }
04704
04705 if (AnyNeedSimple)
04706 AllowForceToSimpleMapping = FALSE;
04707
04708 if (AttrFillGeometry::FillSelectionCount() == 0 && !AllFlat)
04709 {
04710 (*PointString).Load(_R(IDS_FILLTOOL_MANY));
04711 }
04712
04713 if (SelCount == 0)
04714 {
04715 (*PointString).Load(_R(IDS_FILLTOOL_NONE));
04716 (*ColourString).Load(_R(IDS_FILLTOOL_NONE));
04717 }
04718
04719
04720 if (!CommonPoint)
04721 {
04722
04723 (*PointString).Load(_R(IDS_FILLTOOL_MANY));
04724 }
04725
04726 if (!CommonColour)
04727 {
04728 (*ColourString).Load(_R(IDS_FILLTOOL_MANY));
04729 }
04730
04731
04732
04733
04734
04735
04736
04737
04738
04739
04740
04741
04742
04743
04744
04745
04746
04747
04748
04749
04750
04751
04752
04753
04754
04755
04756
04757
04758
04759
04760
04761
04762
04763
04764
04765
04766
04767
04768
04769
04770
04771
04772
04773
04774
04775
04776
04777
04778
04779
04780
04781
04782
04783
04784
04785
04786
04787
04788
04789
04790
04791
04792
04793
04794 }
04795
04796
04797
04798
04799
04800
04801
04802
04803
04804
04805
04806
04807
04808
04809 String_64 GradInfoBarOp::GetSelectedPoint(AttrFillGeometry* pGeometry)
04810 {
04811 String_64 Str;
04812
04813
04814 UINT32 SelCount = pGeometry->GetSelectionCount();
04815
04816
04817 if (SelCount<1)
04818 {
04819 Str.Load(_R(IDS_FILLTOOL_NONE));
04820 return Str;
04821 }
04822
04823
04824 if (SelCount>1)
04825 {
04826 Str.Load(_R(IDS_FILLTOOL_MANY));
04827 return Str;
04828 }
04829
04830
04831 INT32 i = pGeometry->GetFirstSelectedIndex();
04832 if (ISA_RAMPINDEX(i))
04833 {
04834 Str.Load(_R(IDS_FILLTOOL_RAMPCOL));
04835 return Str;
04836 }
04837
04838
04839 switch (i)
04840 {
04841 case FILLCONTROL_STARTPOINT:
04842 Str.Load(_R(IDS_FILLTOOL_STARTCOL));
04843 break;
04844
04845 case FILLCONTROL_ENDPOINT:
04846 case FILLCONTROL_SECONDARYPOINT:
04847 Str.Load(_R(IDS_FILLTOOL_ENDCOL));
04848 break;
04849
04850 case FILLCONTROL_ENDPOINT2:
04851 Str.Load(_R(IDS_FILLTOOL_ENDCOL2));
04852 break;
04853
04854 case FILLCONTROL_ENDPOINT3:
04855 Str.Load(_R(IDS_FILLTOOL_ENDCOL3));
04856 break;
04857
04858 default:
04859 Str.Load(_R(IDS_FILLTOOL_NONE));
04860 break;
04861 }
04862
04863 return Str;
04864 }
04865
04866
04867
04868
04869
04870
04871
04872
04873
04874
04875
04876
04877
04878
04879
04880
04881
04882
04883
04884
04885
04886
04887
04888
04889
04890
04891
04892
04893
04894
04895
04896
04897
04898
04899
04900
04901
04902
04903
04904
04905
04906
04907
04908
04909
04910
04911
04912
04913
04914
04915
04916
04917
04918
04919
04920
04921
04922
04923
04924
04925
04926
04927
04928
04929
04930
04931
04932
04933 String_64 GradInfoBarOp::GetSelectedColour(AttrFillGeometry* pGeometry)
04934 {
04935 String_64 Str;
04936
04937
04938 Str.Load(_R(IDS_FILLTOOL_NONE));
04939
04940 UINT32 SelCount = pGeometry->GetSelectionCount();
04941
04942
04943 if (SelCount<1)
04944 return Str;
04945
04946
04947 if (SelCount==1)
04948 {
04949
04950 DocColour *pColour = pGeometry->GetFirstSelectedColour();
04951 if (pColour)
04952 Str=GetColourName(*pColour);
04953 return Str;
04954 }
04955
04956
04957 Str.Load(_R(IDS_FILLTOOL_MANY));
04958 return Str;
04959 }
04960
04961
04962
04963
04964
04965
04966
04967
04968
04969
04970
04971
04972
04973
04974
04975
04976
04977
04978
04979
04980
04981
04982
04983
04984
04985
04986
04987
04988
04989
04990
04991
04992
04993
04994
04995
04996
04997
04998
04999
05000
05001
05002
05003
05004
05005
05006
05007
05008
05009
05010
05011
05012
05013
05014
05015
05016
05017
05018
05019
05020
05021
05022
05023
05024
05025
05026
05027
05028
05029
05030
05031
05032
05033
05034
05035
05036 String_64 GradInfoBarOp::GetColourName(DocColour &Col)
05037 {
05038 String_64 Str;
05039 Str.Load(_R(IDS_FILLTOOL_NONE));
05040
05041 IndexedColour* IndexCol = Col.FindParentIndexedColour();
05042
05043
05044 if (IndexCol != NULL)
05045 {
05046
05047 Str = *(IndexCol->GetName());
05048 }
05049 else
05050 {
05051
05052 if (Col == COLOUR_NONE)
05053 {
05054 Str.Load(_R(IDS_FILLTOOL_NOCOLOUR));
05055 }
05056 else if (Col == COLOUR_WHITE)
05057 {
05058 Str.Load(_R(IDS_FILLTOOL_WHITE));
05059 }
05060 else if (Col == COLOUR_BLACK)
05061 {
05062 Str.Load(_R(IDS_FILLTOOL_BLACK));
05063 }
05064 else
05065 {
05066
05067 Str.Load(_R(IDS_FILLTOOL_LOCALCOLOUR));
05068 }
05069 }
05070
05071 return Str;
05072 }
05073
05074
05075
05076
05077
05078
05079
05080
05081
05082
05083
05084
05085
05086
05087
05088
05089
05090 void GradInfoBarOp::EnableControls()
05091 {
05092 if (Document::GetSelected() == NULL)
05093 {
05094 EnableGadget(_R(IDC_GEOMETRY), FALSE);
05095 EnableGadget(_R(IDC_MAPPING), FALSE);
05096 EnableGadget(_R(IDC_EFFECT), FALSE);
05097 EnableGadget(_R(IDC_SELPOINT), FALSE);
05098 EnableGadget(_R(IDC_BITMAPEFFECT), FALSE);
05099 EnableGadget(_R(IDC_BIASGAIN), FALSE);
05100 EnableGadget(_R(IDC_SELCOLOUR), FALSE);
05101
05102
05103
05104
05105 }
05106 else
05107 {
05108 EnableGadget (_R(IDC_GEOMETRY), TRUE);
05109
05110 if (Mode != BITMAPFILL) { EnableGadget(_R(IDC_BITMAPEFFECT), FALSE); }
05111
05112 if ((Mode != FRACTALFILL) && (Mode != NOISEFILL)) { EnableGadget(_R(IDC_SELCOLOUR), FALSE); }
05113
05114
05115
05116 BOOL EnableBiasGain = TRUE;
05117 BOOL EnableBiasGain2 = FALSE;
05118 BOOL EnableAffect = FALSE;
05119
05120 List FillList;
05121
05122
05123 FillTools::GetSelectedAttrList(&FillList, CC_RUNTIME_CLASS(AttrFillGeometry), TRUE, FALSE);
05124
05125 AttrFillGeometry* pNodeFill = NULL;
05126
05127 if (!(FillList.IsEmpty()))
05128 {
05129 NodeListItem * pItem = (NodeListItem *)FillList.GetHead();
05130
05131 while (pItem)
05132 {
05133 pNodeFill = (AttrFillGeometry*) pItem->pNode;
05134
05135
05136
05137 if (pNodeFill->GetFillRamp () != NULL)
05138 {
05139
05140
05141 EnableBiasGain = FALSE;
05142
05143 }
05144
05145
05146
05147 if ((pNodeFill->IsABitmapFill ()) && (pNodeFill->GetStartColour () != NULL) && (pNodeFill->GetEndColour () != NULL))
05148 {
05149 EnableBiasGain2 = TRUE;
05150 EnableAffect = TRUE;
05151 }
05152
05153 pItem = (NodeListItem *)FillList.GetNext(pItem);
05154
05155
05156
05157
05158
05159 }
05160
05161 FillList.DeleteAll();
05162 }
05163
05164 switch (Mode)
05165 {
05166
05167
05168 case NOFILL:
05169 EnableGadget(_R(IDC_MAPPING), FALSE);
05170 EnableGadget(_R(IDC_EFFECT), FALSE);
05171 EnableGadget(_R(IDC_BIASGAIN), FALSE);
05172 EnableGadget(_R(IDC_SELPOINT), FALSE);
05173 break;
05174
05175 case MANYFILLS:
05176 case FLATFILL:
05177
05178
05179 EnableGadget (_R(IDC_MAPPING), FALSE);
05180 EnableGadget (_R(IDC_EFFECT), FALSE);
05181 EnableGadget (_R(IDC_BIASGAIN), FALSE);
05182 EnableGadget (_R(IDC_SELPOINT), FALSE);
05183 EnableGadget (_R(IDC_SELCOLOUR), FALSE);
05184
05185
05186
05187
05188
05189 if (Mode == MANYFILLS)
05190 CloseProfileDialog (m_BiasGainGadget);
05191 break;
05192
05193 case GRADFILL:
05194 case GRADREPEATFILL:
05195 switch (CurrentGeometryIndex)
05196 {
05197 case FGMENU_LINEAR:
05198 case FGMENU_CIRCULAR:
05199 case FGMENU_RADIAL:
05200
05201 case FGMENU_SQUARE:
05202 EnableGadget (_R(IDC_MAPPING), TRUE);
05203
05204 EnableGadget (_R(IDC_BIASGAIN), EnableBiasGain);
05205 EnableGadget (_R(IDC_SELPOINT), FALSE);
05206 EnableGadget (_R(IDC_SELCOLOUR), FALSE);
05207 break;
05208
05209 case FGMENU_CONICAL:
05210 EnableGadget (_R(IDC_MAPPING), FALSE);
05211
05212 EnableGadget (_R(IDC_BIASGAIN), EnableBiasGain);
05213 EnableGadget (_R(IDC_SELPOINT), FALSE);
05214 EnableGadget (_R(IDC_SELCOLOUR), FALSE);
05215 break;
05216
05217 case FGMENU_THREECOL:
05218 case FGMENU_FOURCOL:
05219 EnableGadget (_R(IDC_MAPPING), TRUE);
05220 EnableGadget (_R(IDC_EFFECT), FALSE);
05221 EnableGadget (_R(IDC_BIASGAIN), FALSE);
05222 EnableGadget (_R(IDC_SELPOINT), FALSE);
05223 EnableGadget (_R(IDC_SELCOLOUR), FALSE);
05224 break;
05225
05226 }
05227 break;
05228
05229 case BITMAPFILL:
05230 EnableGadget (_R(IDC_MAPPING), TRUE);
05231 EnableGadget (_R(IDC_EFFECT), EnableAffect);
05232 EnableGadget (_R(IDC_BITMAPEFFECT), TRUE);
05233
05234 EnableGadget (_R(IDC_BIASGAIN), EnableBiasGain2);
05235
05236 if (GetGadgetWritable (_R(IDC_SELPOINT))) { EnableGadget (_R(IDC_SELPOINT), FALSE); }
05237 else { EnableGadget (_R(IDC_SELPOINT), TRUE); }
05238
05239 EnableGadget (_R(IDC_SELCOLOUR), FALSE);
05240 break;
05241
05242 case FRACTALFILL:
05243 case NOISEFILL:
05244 EnableGadget (_R(IDC_MAPPING), TRUE);
05245
05246 EnableGadget (_R(IDC_BIASGAIN), TRUE);
05247
05248 if (GetGadgetWritable (_R(IDC_SELPOINT))) { EnableGadget (_R(IDC_SELPOINT), FALSE); }
05249 else { EnableGadget (_R(IDC_SELPOINT), TRUE); }
05250
05251 if (GetGadgetWritable (_R(IDC_SELCOLOUR))) { EnableGadget (_R(IDC_SELCOLOUR), FALSE); }
05252 else
05253 {
05254 EnableGadget (_R(IDC_SELCOLOUR), TRUE);
05255
05256 EnableGadget (_R(IDC_SELCOLOUR), TRUE);
05257 }
05258 break;
05259
05260 default:
05261 break;
05262 }
05263
05264 if ((Mode != BITMAPFILL) && (Mode != NOFILL) && (Mode != MANYFILLS) && (Mode != FLATFILL)
05265 && (CurrentGeometryIndex != FGMENU_THREECOL) && (CurrentGeometryIndex != FGMENU_FOURCOL))
05266 {
05267 EnableGadget (_R(IDC_EFFECT), TRUE);
05268 }
05269 }
05270 }
05271
05272
05273
05274
05275
05276
05277
05278
05279
05280
05281
05282
05283 void GradInfoBarOp::ChangeFillType()
05284 {
05285
05286
05287 AttrFillGeometry* Mutator = MakeFillMutator();
05288
05289 if (Mutator == NULL)
05290 {
05291 InformError();
05292 return;
05293 }
05294
05295
05296
05297
05298
05299
05300
05301
05302 AttributeManager::AttributeSelected(NULL, Mutator);
05303 Mutator = NULL;
05304
05305
05306
05307
05308
05309
05310
05311 }
05312
05313
05314
05315
05316
05317
05318
05319
05320
05321
05322
05323 void GradInfoBarOp::ChangeFillMapping()
05324 {
05325 if (Mode != BITMAPFILL &&
05326 Mode != FRACTALFILL &&
05327 Mode != GRADREPEATFILL &&
05328
05329 #ifdef NEW_FEATURES
05330 Mode != GRADFILL &&
05331 #endif
05332 Mode != NOISEFILL)
05333 {
05334 return;
05335 }
05336
05337 INT32 Tesselation;
05338
05339 switch (CurrentMappingIndex)
05340 {
05341 case (FTMENU_SIMPLE):
05342 Tesselation = 1;
05343 break;
05344
05345 case (FTMENU_REPEAT):
05346
05347 #ifdef NEW_FEATURES
05348 if(Mode==GRADFILL)
05349 {
05350 Tesselation = 4;
05351 }
05352 else
05353 #endif
05354 {
05355 Tesselation = 2;
05356 }
05357 break;
05358
05359 case (FTMENU_REPEATINV):
05360 Tesselation = 3;
05361 break;
05362
05363 default:
05364 Tesselation = 1;
05365 break;
05366 }
05367
05368
05369
05370
05371
05372
05373
05374
05375
05376
05377
05378
05379
05380
05381 AttrFillMappingLinear* NewMapping = new AttrFillMappingLinear;
05382 if (NewMapping == NULL)
05383 {
05384 InformError();
05385 return;
05386 }
05387
05388 NewMapping->SetRepeat(Tesselation);
05389 AttributeManager::AttributeSelected(NewMapping);
05390 }
05391
05392
05393
05394
05395
05396
05397
05398
05399
05400
05401
05402 void GradInfoBarOp::ChangeFillEffect()
05403 {
05404 AttrFillEffect* FillEffect = NULL;
05405
05406 switch (CurrentEffectIndex)
05407 {
05408 case (FEMENU_FADE):
05409 FillEffect = new AttrFillEffectFade;
05410 break;
05411
05412 case (FEMENU_RAINBOW):
05413 FillEffect = new AttrFillEffectRainbow;
05414 break;
05415
05416 case (FEMENU_ALTRAINBOW):
05417 FillEffect = new AttrFillEffectAltRainbow;
05418 break;
05419
05420 default:
05421 FillEffect = new AttrFillEffectFade;
05422 break;
05423 }
05424
05425 if (FillEffect == NULL)
05426 {
05427 InformError();
05428 return;
05429 }
05430
05431 AttributeManager::AttributeSelected(FillEffect);
05432 }
05433
05434
05435
05436
05437
05438
05439
05440
05441
05442
05443
05444 void GradInfoBarOp::ChangeBitmapName()
05445 {
05446 AttrValueChange* NewBitmap = new AttrBitmapChange;
05447 if (NewBitmap == NULL)
05448 {
05449 InformError();
05450 return;
05451 }
05452
05453 Document* pDoc = Document::GetSelected();
05454
05455
05456 BitmapList* Bitmaps = NULL;
05457 if (pDoc) Bitmaps = pDoc->GetBitmapList();
05458
05459 if (Bitmaps == NULL)
05460 return;
05461
05462 INT32 BmpIndex = -1;
05463 ListItem* pBmp = Bitmaps->GetHead();
05464
05465 while (pBmp != NULL)
05466 {
05467 if (!((KernelBitmap*)pBmp)->HasBeenDeleted())
05468 BmpIndex++;
05469
05470 if (BmpIndex == CurrentEffectIndex)
05471 break;
05472
05473 pBmp = Bitmaps->GetNext(pBmp);
05474 }
05475
05476 ((AttrBitmapChange*)NewBitmap)->AttachBitmap((KernelBitmap*)pBmp);
05477 AttributeManager::AttributeSelected(NULL, NewBitmap);
05478 }
05479
05480
05481
05482
05483
05484
05485
05486
05487
05488
05489
05490
05491 void GradInfoBarOp::ChangeDPI()
05492 {
05493 BOOL Valid;
05494 String_256 Str = GetStringGadgetValue(_R(IDC_SELPOINT), &Valid);
05495
05496 if (Valid)
05497 {
05498 TRACEUSER( "Will", _T("String = %s\n"),(TCHAR*)Str);
05499
05500 INT32 Length = Str.Length();
05501 TCHAR* StrText = (TCHAR*)Str;
05502
05503 INT32 FirstNum = -1;
05504 INT32 Count = 0;
05505
05506 for (INT32 i = 0; i < Length; ++i)
05507 {
05508 TCHAR chr = StrText[i];
05509 if (FirstNum == -1 && StringBase::IsNumeric(chr))
05510 FirstNum = i;
05511
05512 if (FirstNum != -1)
05513 {
05514 if (StringBase::IsNumeric(chr))
05515 Count++;
05516 else
05517 break;
05518 }
05519 }
05520
05521 String_256 DpiStr;
05522 INT32 Dpi;
05523
05524 if (FirstNum != -1 && Count > 0)
05525 {
05526 Str.Mid(&DpiStr, FirstNum, Count);
05527 Convert::StringToLong(DpiStr, &Dpi);
05528 TRACEUSER( "Will", _T("Dpi = %d\n"),Dpi);
05529
05530 if (Dpi == 0)
05531 Dpi = 1;
05532
05533 AttrValueChange* NewDpi = new AttrBitmapDpiChange;
05534 if (NewDpi == NULL)
05535 {
05536 InformError();
05537 return;
05538 }
05539
05540 ((AttrBitmapDpiChange*)NewDpi)->SetDPI(Dpi);
05541
05542 AttributeManager::AttributeSelected(NULL, NewDpi);
05543 }
05544 else
05545 {
05546 TRACEUSER( "Will", _T("That was rubbish\n"));
05547 ShowCommonBitmapDpi();
05548 }
05549 }
05550 else
05551 TRACEUSER( "Will", _T("String was invalid\n"));
05552 }
05553
05554
05555
05556
05557
05558
05559
05560
05561
05562
05563
05564 void GradInfoBarOp::ChangeFractalGrain()
05565 {
05566 BOOL Valid;
05567 String_256 Str = GetStringGadgetValue(_R(IDC_SELCOLOUR), &Valid);
05568
05569 if (Valid)
05570 {
05571 TRACEUSER( "Will", _T("String = %s\n"),(TCHAR*)Str);
05572
05573 double Grain = 1.0;
05574 UnitType Units;
05575
05576 if (Convert::StringToComponents(Str, &Grain, &Units))
05577 {
05578 TRACEUSER( "Will", _T("Graininess = %f\n"),Grain);
05579
05580 if (Grain < 0.1)
05581 Grain = 0.1;
05582
05583 if (Grain > 16384)
05584 Grain = 16384;
05585
05586 AttrValueChange* NewGrain = new AttrFractalGrainChange;
05587 if (NewGrain == NULL)
05588 {
05589 InformError();
05590 return;
05591 }
05592
05593 ((FractalFillAttribute*)NewGrain->GetAttributeValue())->Graininess = FIXED16(Grain);
05594
05595 AttributeManager::AttributeSelected(NULL, NewGrain);
05596 }
05597 else
05598 {
05599 TRACEUSER( "Will", _T("That was rubbish\n"));
05600 ShowCommonFractalGrain();
05601 }
05602 }
05603 }
05604
05605
05606
05607
05608
05609
05610
05611
05612
05613
05614
05615 void GradInfoBarOp::ChangeNoiseScale()
05616 {
05617 BOOL Valid;
05618 String_256 Str = GetStringGadgetValue(_R(IDC_SELCOLOUR), &Valid);
05619
05620 if (Valid)
05621 {
05622 TRACEUSER( "Will", _T("String = %s\n"),(TCHAR*)Str);
05623
05624 double Scale = 1.0;
05625 UnitType Units;
05626
05627 if (Convert::StringToComponents(Str, &Scale, &Units))
05628 {
05629 TRACEUSER( "Mike", _T("Noise scale = %f\n"),Scale);
05630
05631 if (Scale < 1)
05632 Scale = 1;
05633
05634 if (Scale > 100)
05635 Scale = 100;
05636
05637 AttrValueChange* NewScale = new AttrNoiseScaleChange;
05638 if (NewScale == NULL)
05639 {
05640 InformError();
05641 return;
05642 }
05643
05644 FIXED16 Grain = FIXED16(Scale);
05645 ((NoiseFillAttribute*)NewScale->GetAttributeValue())->SetGraininess(Grain);
05646
05647 AttributeManager::AttributeSelected(NULL, NewScale);
05648 }
05649 else
05650 {
05651 TRACEUSER( "Will", _T("That was rubbish\n"));
05652 ShowCommonNoiseScale();
05653 }
05654 }
05655 }
05656
05657
05658
05659
05660
05661
05662
05663
05664
05665
05666
05667
05668
05669 AttrFillGeometry* GradInfoBarOp::MakeFillMutator()
05670 {
05671 AttrFillGeometry* Fill = NULL;
05672 KernelBitmap* Default;
05673
05674 switch (CurrentGeometryIndex)
05675 {
05676 case (FGMENU_FLAT):
05677 Fill = new AttrFlatColourFill;
05678 break;
05679
05680 case (FGMENU_LINEAR):
05681 Fill = new AttrLinearColourFill;
05682 break;
05683
05684 case (FGMENU_CIRCULAR):
05685 Fill = new AttrRadialColourFill;
05686 if (Fill != NULL)
05687 ((AttrRadialFill*)Fill)->MakeCircular();
05688 break;
05689
05690 case (FGMENU_RADIAL):
05691 Fill = new AttrRadialColourFill;
05692 if (Fill != NULL)
05693 ((AttrRadialFill*)Fill)->MakeElliptical();
05694 break;
05695
05696 case (FGMENU_CONICAL):
05697 Fill = new AttrConicalColourFill;
05698 break;
05699
05700 case (FGMENU_SQUARE):
05701 Fill = new AttrSquareColourFill;
05702 break;
05703
05704 case (FGMENU_THREECOL):
05705 Fill = new AttrThreeColColourFill;
05706 CloseProfileDialog (m_BiasGainGadget);
05707 break;
05708
05709 case (FGMENU_FOURCOL):
05710 Fill = new AttrFourColColourFill;
05711 CloseProfileDialog (m_BiasGainGadget);
05712 break;
05713
05714 case (FGMENU_BITMAP):
05715 Fill = new AttrBitmapColourFill;
05716 CloseProfileDialog (m_BiasGainGadget);
05717
05718 Default = KernelBitmap::MakeKernelBitmap();
05719 if (Default == NULL)
05720 {
05721 delete Fill;
05722 return NULL;
05723 }
05724
05725 Fill->AttachBitmap(Default);
05726 break;
05727
05728 case (FGMENU_FRACTAL):
05729 Fill = new AttrFractalColourFill;
05730 break;
05731
05732 case (FGMENU_NOISE):
05733 Fill = new AttrNoiseColourFill;
05734 break;
05735
05736 default:
05737
05738 Fill = new AttrFlatColourFill;
05739 break;
05740 }
05741
05742 return Fill;
05743 }
05744
05745
05746
05747
05748
05749
05750
05751
05752
05753
05754
05755 AttrFillGeometry* GradInfoBarOp::GetCurrentGeometry()
05756 {
05757 CCRuntimeClass* CurrentAttribGroup =
05758 Tool::GetCurrent()->Parent->m_ToolInfo.CurrentAttributeGroup;
05759
05760 Document* CurrentDoc = Document::GetSelected();
05761
05762 if (CurrentDoc == NULL)
05763 return NULL;
05764
05765 return (AttrFillGeometry*)CurrentDoc->GetAttributeMgr()
05766 .GetCurrentAttribute(CurrentAttribGroup,
05767 CC_RUNTIME_CLASS(AttrFillGeometry));
05768 }
05769
05770
05771
05772
05773
05774
05775
05776
05777
05778
05779
05780
05781 AttrFillMapping* GradInfoBarOp::GetCurrentMapping()
05782 {
05783 CCRuntimeClass* CurrentAttribGroup =
05784 Tool::GetCurrent()->Parent->m_ToolInfo.CurrentAttributeGroup;
05785
05786 Document* CurrentDoc = Document::GetSelected();
05787
05788 if (CurrentDoc == NULL)
05789 return NULL;
05790
05791 return (AttrFillMapping*)CurrentDoc->GetAttributeMgr()
05792 .GetCurrentAttribute(CurrentAttribGroup,
05793 CC_RUNTIME_CLASS(AttrFillMapping));
05794 }
05795
05796
05797
05798
05799
05800
05801
05802
05803
05804
05805
05806
05807
05808
05809
05810
05811
05812
05815
05816
05817
05820
05821
05822
05823
05824
05825
05826
05827
05828
05829
05830
05831
05832
05833
05834
05835 struct TGMItem
05836 {
05837 TransparencyGeometry Geometry;
05838 unsigned StringID;
05839 };
05840
05841
05842
05843
05844
05845
05846
05847
05848
05849
05850
05851
05852
05853
05854
05855 const TGMItem TransparencyGeometryMenu[] =
05856 {
05857 { FGMENU_NOTRANSP, _R(IDS_FILLTOOL_NOTRANSP) },
05858 { FGMENU_FLATTRANSP, _R(IDS_FILLTOOL_FLATTRANSP) },
05859 { FGMENU_LINEARTRANSP, _R(IDS_FILLTOOL_LINEAR) },
05860 { FGMENU_CIRCULARTRANSP, _R(IDS_FILLTOOL_CIRCULAR) },
05861 { FGMENU_RADIALTRANSP, _R(IDS_FILLTOOL_ELLIPTICAL) },
05862 #ifndef WEBSTER
05863 { FGMENU_CONICALTRANSP, _R(IDS_FILLTOOL_CONICAL) },
05864 { FGMENU_SQUARETRANSP, _R(IDS_FILLTOOL_SQUARE) },
05865 { FGMENU_THREECOLTRANSP, _R(IDS_FILLTOOL_THREECOLTRANS) },
05866 { FGMENU_FOURCOLTRANSP, _R(IDS_FILLTOOL_FOURCOLTRANS) },
05867 #endif //WEBSTER
05868 { FGMENU_BITMAPTRANSP, _R(IDS_FILLTOOL_TEXTURE) },
05869 { FGMENU_FRACTALTRANSP, _R(IDS_FILLTOOL_FRACTAL) },
05870 #ifndef WEBSTER
05871 { FGMENU_NOISETRANSP, _R(IDS_FILLTOOL_NOISE) }
05872 #endif //WEBSTER
05873 };
05874
05875
05876
05877
05878
05879
05880
05881
05882
05883
05884
05885
05886 const INT32 TransparencyGeometryMenuCount = sizeof(TransparencyGeometryMenu) / sizeof(TransparencyGeometryMenu[0]);
05887
05888
05889
05890
05891
05892
05893
05894
05895
05896
05897
05898
05899
05900
05901
05902
05903 MsgResult TranspInfoBarOp::Message(Msg* Message)
05904 {
05905 if (!TranspTool::IsCurrentTool() || !IsVisible())
05906 return (InformationBarOp::Message(Message));
05907
05908 if (IS_OUR_DIALOG_MSG(Message))
05909 {
05910 DialogMsg* Msg = (DialogMsg*)Message;
05911
05912
05913 if (Msg->DlgMsg == DIM_CANCEL)
05914 {
05915 Close();
05916 }
05917 else if (Msg->DlgMsg == DIM_CREATE)
05918 {
05919
05920 SliderDragged = FALSE;
05921 InitControls();
05922 }
05923 else
05924 {
05925 if (Msg->GadgetID == _R(IDC_GEOMETRY))
05926 {
05927 switch (Msg->DlgMsg)
05928 {
05929 case DIM_SELECTION_CHANGED :
05930 {
05931 ShowCommonType (FALSE);
05932
05933
05934
05935 INT32 Index;
05936 GetValueIndex(_R(IDC_GEOMETRY),&Index);
05937
05938
05939
05940
05941 if (CurrentGeometryIndex != Index)
05942 {
05943
05944 CurrentGeometryIndex = TransparencyGeometryMenu[Index].Geometry;
05945 ChangeFillType();
05946 EnableControls();
05947 }
05948 }
05949 break;
05950
05951 default:
05952 break;
05953 }
05954 }
05955
05956 else if (Msg->GadgetID == _R(IDC_TRANSPTYPE))
05957 {
05958 switch (Msg->DlgMsg)
05959 {
05960 case DIM_SELECTION_CHANGED:
05961 {
05962 ShowCommonTranspType (FALSE);
05963
05964
05965
05966 INT32 Index;
05967 GetValueIndex (_R(IDC_TRANSPTYPE), &Index);
05968
05969 if (CurrentTransTypeIndex != Index)
05970 {
05971 if (Index >= 0 && Index < FTMENU_MAX)
05972 {
05973
05974 CurrentTransTypeIndex = Index;
05975 EnableControls ();
05976 ChangeTranspType ();
05977 }
05978 else
05979 {
05980 ShowInfo();
05981 }
05982 }
05983 }
05984 break;
05985
05986 default:
05987 break;
05988 }
05989 }
05990
05991 else if (Msg->GadgetID == _R(IDC_MAPPING))
05992 {
05993 switch (Msg->DlgMsg)
05994 {
05995 case DIM_SELECTION_CHANGED:
05996 {
05997 ShowCommonMapping (FALSE);
05998
05999
06000
06001 INT32 Index;
06002 GetValueIndex(_R(IDC_MAPPING),&Index);
06003
06004 if (CurrentMappingIndex != Index)
06005 {
06006
06007 CurrentMappingIndex = Index;
06008 ChangeFillMapping();
06009 }
06010 }
06011 break;
06012
06013 default:
06014 break;
06015 }
06016 }
06017
06018 else if (Msg->GadgetID == _R(IDC_BITMAPEFFECT))
06019 {
06020 switch (Msg->DlgMsg)
06021 {
06022 case DIM_SELECTION_CHANGED:
06023 {
06024
06025 INT32 Index = m_oBitmapDropDown.GetSelected();
06026
06027
06028
06029
06030 INT32 OldBitmapIndex = CurrentBitmapIndex;
06031
06032 CurrentBitmapIndex = Index;
06033
06034 if (!ChangeBitmapName ())
06035 {
06036 CurrentBitmapIndex = OldBitmapIndex;
06037 ShowInfo();
06038 }
06039
06040 }
06041 break;
06042
06043 default:
06044 break;
06045 }
06046 }
06047
06048 else if (Msg->GadgetID == _R(IDC_BIASGAIN))
06049 {
06050 switch (Msg->DlgMsg)
06051 {
06052 case DIM_LFT_BN_CLICKED:
06053 HandleProfileButtonClick (m_BiasGainGadget, _R(IDC_BIASGAIN));
06054 break;
06055
06056 default:
06057 ProfileSelectionChange( Msg, Msg->GadgetID );
06058 break;
06059 }
06060 }
06061
06062 else if (Msg->GadgetID == _R(IDC_SELPOINT))
06063 {
06064 switch (Msg->DlgMsg)
06065 {
06066 case DIM_SELECTION_CHANGED:
06067 {
06068 if (AttrFillGeometry::SelectionCount == 0)
06069 {
06070 if (Mode == BITMAPFILL ||
06071 Mode == FRACTALFILL ||
06072 Mode == NOISEFILL
06073 )
06074 {
06075 ChangeDPI();
06076 }
06077 }
06078 }
06079 break;
06080
06081 default:
06082 break;
06083 }
06084 }
06085
06086 else if (Msg->GadgetID == _R(IDC_SELCOLOUR))
06087 {
06088 switch (Msg->DlgMsg)
06089 {
06090 case DIM_SELECTION_CHANGED:
06091 {
06092
06093
06094
06095
06096
06097
06098
06099
06100
06101
06102 if (Mode==FRACTALFILL && AttrFillGeometry::SelectionCount==0)
06103 {
06104 ChangeFractalGrain (TRUE);
06105 }
06106 else if (Mode==NOISEFILL && AttrFillGeometry::SelectionCount==0)
06107 {
06108 ChangeNoiseScale (TRUE);
06109 }
06110 else
06111 {
06112 ChangeTransparencyValue ();
06113 }
06114 }
06115 break;
06116
06117 default:
06118 break;
06119 }
06120 }
06121
06122 else if (Msg->GadgetID == _R(IDC_TRANSPSLIDE))
06123 {
06124 switch (Msg->DlgMsg)
06125 {
06126 case DIM_SLIDER_POS_CHANGING:
06127 {
06128 GetApplication ()->LockOutControlHelp ();
06129
06130 TCHAR Str[32];
06131 BOOL Valid;
06132 INT32 Result = GetLongGadgetValue(_R(IDC_TRANSPSLIDE), 0, SliderMax, 0, &Valid);
06133
06134 if (LastSliderPos == Result)
06135 break;
06136
06137 double Grain = 1.0;
06138 BOOL flag = TRUE;
06139
06140 if (AttrFillGeometry::SelectionCount == 0)
06141 {
06142 if (Mode == FRACTALFILL)
06143 {
06144 Grain = GetDoubleGrain(Result);
06145 flag = FALSE;
06146 }
06147 if (Mode == NOISEFILL)
06148 {
06149 Grain = GetDoubleScale(Result);
06150 flag = FALSE;
06151 }
06152
06153 if (!flag)
06154 {
06155 if (Mode == FRACTALFILL)
06156 {
06157 camSnprintf(Str, 31, _T("%.1f"), Grain);
06158 }
06159 }
06160 }
06161
06162 if (flag)
06163 {
06164 double Transp = (double) Result;
06165
06166
06167
06168
06169
06170
06171 DisplayTransparencyPercentString ((double) Transp);
06172
06173 if (GetApplication()->FindSelection()->Count() <= 64)
06174 {
06175
06176
06177
06178
06179 AttributeManager::SendMessages = FALSE;
06180 SetTranspValue(static_cast<UINT32>(Transp), TRUE, !SliderDragged);
06181 }
06182 }
06183 else
06184 {
06185 if (Mode == FRACTALFILL)
06186 {
06187 String_32 PercentStr(Str);
06188 SetStringGadgetValue(_R(IDC_SELCOLOUR), PercentStr);
06189 }
06190 else
06191 {
06192 String_64 Str;
06193
06194 Convert::DoubleToString( Grain, &Str, 1 );
06195
06196 Str.MakePercent ((TCHAR*) Str);
06197
06198 String_64 PercentStr(Str);
06199 SetGadgetString(_R(IDC_SELCOLOUR), &PercentStr);
06200 }
06201 }
06202
06203 LastSliderPos = Result;
06204
06205 SliderDragged = TRUE;
06206 }
06207 break;
06208
06209 case DIM_SLIDER_POS_IDLE:
06210 {
06211
06212
06213
06214 {
06215 GetApplication ()->LockOutControlHelp ();
06216
06217 TCHAR Str[32];
06218 BOOL Valid;
06219 INT32 Result = GetLongGadgetValue(_R(IDC_TRANSPSLIDE), 0, SliderMax, 0, &Valid);
06220
06221
06222
06223 LastSliderPos = Result;
06224
06225 double val = 1.0;
06226 BOOL flag = TRUE;
06227
06228 if (AttrFillGeometry::SelectionCount == 0)
06229 {
06230 if (Mode == FRACTALFILL)
06231 {
06232 val = GetDoubleGrain(Result);
06233 flag = FALSE;
06234 }
06235 if (Mode == NOISEFILL)
06236 {
06237 val = GetDoubleScale(Result);
06238 flag = FALSE;
06239 }
06240
06241 if (!flag)
06242 {
06243 if (Mode == FRACTALFILL)
06244 {
06245 camSnprintf(Str, 31, _T("%.1f"), val);
06246 }
06247 }
06248 }
06249
06250 if (flag)
06251 {
06252 double Transp = (double) Result;
06253
06254
06255
06256
06257
06258
06259 DisplayTransparencyPercentString ((double) Transp);
06260
06261 if (GetApplication()->FindSelection()->Count() <= 64)
06262 {
06263
06264
06265
06266
06267 AttributeManager::SendMessages = FALSE;
06268
06269
06270 SetTranspValue(static_cast<UINT32>(Transp));
06271 SliderDragged = FALSE;
06272 }
06273 }
06274 else
06275 {
06276 if (Mode == FRACTALFILL)
06277 {
06278 String_32 PercentStr(Str);
06279 SetStringGadgetValue(_R(IDC_SELCOLOUR), PercentStr);
06280 }
06281 else
06282 {
06283 String_64 Str;
06284
06285 Convert::DoubleToString( val, &Str, 1 );
06286
06287 Str.MakePercent ((TCHAR*) Str);
06288
06289 String_64 PercentStr(Str);
06290 SetGadgetString(_R(IDC_SELCOLOUR), &PercentStr);
06291 }
06292 }
06293 }
06294 }
06295 break;
06296
06297 case DIM_SLIDER_POS_SET:
06298 {
06299
06300 BOOL Valid;
06301 INT32 Result = GetLongGadgetValue(_R(IDC_TRANSPSLIDE), 0, SliderMax, 0, &Valid);
06302 LastSliderPos = Result;
06303
06304 Operation::SetQuickRender(FALSE);
06305
06306
06307 if (Valid)
06308 {
06309 AttributeManager::SendMessages = TRUE;
06310
06311 if (Mode==FRACTALFILL && AttrFillGeometry::SelectionCount==0)
06312 ChangeFractalGrain();
06313 else if (Mode==NOISEFILL && AttrFillGeometry::SelectionCount==0)
06314 ChangeNoiseScale();
06315 else
06316 SetTranspValue(Result);
06317
06318 GetApplication ()->UnlockControlHelp ();
06319 }
06320
06321 SliderDragged = FALSE;
06322 break;
06323 }
06324
06325 default:
06326 break;
06327 }
06328 }
06329
06330 }
06331 }
06332
06333 if (MESSAGE_IS_A(Message, SelChangingMsg) ||
06334 MESSAGE_IS_A(Message, CurrentAttrChangedMsg))
06335 {
06336
06337
06338
06339 AttrFillGeometry::SetSelectionCount(AttrFillGeometry::CountSelectionControlPoints());
06340
06341 if (AttrFillGeometry::SelectionCount > 0)
06342 {
06343 TranspTool::EnableFillNudge();
06344 }
06345 else
06346 {
06347 TranspTool::DisableFillNudge();
06348 }
06349
06350 HandleProfileSelChangingMsg (m_BiasGainGadget, _R(IDC_BIASGAIN));
06351
06352 ShowInfo();
06353
06354
06355
06356
06357
06358
06359
06360
06361
06362
06363
06364
06365
06366
06367
06368 }
06369
06370
06371 return (InformationBarOp::Message(Message));
06372 }
06373
06374
06375
06376
06377
06378
06379
06380
06381
06382
06383
06384
06385
06386 void TranspInfoBarOp::ChangeProfile(CProfileBiasGain* Profile, CGadgetID GadgetID)
06387 {
06388 OpDescriptor* pOpDesc = OpDescriptor::FindOpDescriptor(OPTOKEN_TRANSPFILLPROFILE);
06389 if (pOpDesc != NULL)
06390 {
06391 BOOL FireOp = TRUE;
06392
06393
06394
06395
06396
06397 Operation* pLastOp = NULL;
06398
06399 if (Profile->GetGeneratesInfiniteUndo ())
06400 {
06401 pLastOp = Document::GetSelected()->GetOpHistory().FindLastOp();
06402 }
06403
06404 if (pLastOp)
06405 {
06406 if (pLastOp->GetRuntimeClass() == CC_RUNTIME_CLASS(OpChangeTranspFillProfile))
06407 {
06408 FireOp = FALSE;
06409 }
06410 }
06411
06412 if (FireOp == TRUE)
06413 {
06414 TranspFillProfileOpParam Param;
06415 Param.Profile = *Profile;
06416
06417 pOpDesc->Invoke(&Param);
06418 }
06419 else
06420 {
06421
06422
06423
06424 ChangeTranspFillProfileAction Action;
06425 Action.ChangeTranspFillProfileWithNoUndo ( *Profile);
06426 }
06427
06428
06429
06430
06431
06432
06433
06434
06435
06436 }
06437 }
06438
06439
06440
06441
06442
06443
06444
06445
06446
06447
06448
06449
06450
06451
06452
06453
06454
06455
06456
06457 CProfileBiasGain* TranspInfoBarOp::GetProfileFromSelection(CGadgetID GadgetID, BOOL* bMany, BOOL* bAllSameType)
06458 {
06459 BOOL ok = (GadgetID == _R(IDC_BIASGAIN));
06460
06461 ERROR2IF(ok==FALSE, FALSE, "Invalid gadgetID passed");
06462
06463 UINT32 TotalNumberSelected = (GetApplication()->FindSelection()->Count ());
06464
06465
06466
06467
06468 List AttrList;
06469 ok = FillTools::GetSelectedAttrList(&AttrList, CC_RUNTIME_CLASS(AttrTranspFillGeometry), TRUE, TRUE);
06470 if (!ok)
06471 return NULL;
06472
06473 AttrFillGeometry* pFirstNodeShadow = NULL;
06474 FillGeometryAttribute* pFirstFillGeoAttr = NULL;
06475
06476 CProfileBiasGain* pFirstProfile = NULL;
06477
06478
06479 NodeListItem * pItem = (NodeListItem *)AttrList.GetHead();
06480
06481 while (pItem)
06482 {
06483 if (pFirstNodeShadow == NULL)
06484 {
06485 pFirstNodeShadow = (AttrFillGeometry*) pItem->pNode;
06486 pFirstFillGeoAttr = (FillGeometryAttribute*) pFirstNodeShadow->GetAttributeValue ();
06487
06488 pFirstProfile = pFirstFillGeoAttr->GetProfilePtr ();
06489 }
06490 else
06491 {
06492 CProfileBiasGain* pOtherProfile = NULL;
06493
06494 pOtherProfile = ((FillGeometryAttribute*) ((AttrFillGeometry*)pItem->pNode)->GetAttributeValue ())->GetProfilePtr ();
06495
06496 if (pOtherProfile)
06497 {
06498 if (*pFirstProfile == *pOtherProfile)
06499 {
06500
06501 }
06502 else
06503 {
06504 *bMany = TRUE;
06505 }
06506 }
06507 }
06508
06509
06510 pItem = (NodeListItem *)AttrList.GetNext(pItem);
06511 }
06512
06513
06514 if (TotalNumberSelected != (UINT32) AttrList.GetCount ())
06515 {
06516
06517
06518 if ((pFirstProfile) && (*bMany == FALSE))
06519 {
06520
06521
06522 SelRange* range = GetApplication()->FindSelection();
06523
06524 NodeRenderableInk* pNode = (NodeRenderableInk*) range->FindFirst();
06525 NodeAttribute* pAttr;
06526
06527 while (pNode)
06528 {
06529
06530 pAttr = pNode->FindAppliedAttribute(CC_RUNTIME_CLASS(AttrTranspFillGeometry));
06531 if (pAttr)
06532 {
06533 pNode = (NodeRenderableInk*) (range->FindNext(pNode));
06534 }
06535 else
06536 {
06537
06538
06539 *bAllSameType = FALSE;
06540
06541 AttrList.DeleteAll();
06542 return (NULL);
06543 }
06544 }
06545 }
06546 else
06547 {
06548 *bAllSameType = FALSE;
06549
06550 AttrList.DeleteAll();
06551 return (NULL);
06552 }
06553 }
06554
06555
06556
06557
06558 if (*bMany == TRUE)
06559 {
06560
06561 AttrList.DeleteAll();
06562 return (NULL);
06563 }
06564 else
06565 {
06566
06567
06568
06569 if (pFirstNodeShadow)
06570 {
06571 m_BiasGainGadget.SetStartTransp (pFirstNodeShadow->GetStartTransp ());
06572 m_BiasGainGadget.SetEndTransp (pFirstNodeShadow->GetEndTransp ());
06573 }
06574
06575
06576 AttrList.DeleteAll();
06577
06578 return (pFirstProfile);
06579 }
06580 }
06581
06582
06583
06584
06585
06586
06587
06588
06589
06590
06591
06592
06593
06594
06595
06596 void TranspInfoBarOp::InitControls()
06597 {
06598
06599 if (!TranspTool::IsCurrentTool() || !IsVisible()) return;
06600
06601
06602
06603
06604 SetGadgetRange(_R(IDC_TRANSPSLIDE), 0, SliderMax);
06605
06606 DeleteAllValues(_R(IDC_GEOMETRY));
06607 DeleteAllValues(_R(IDC_TRANSPTYPE));
06608 DeleteAllValues(_R(IDC_MAPPING));
06609
06610 m_oBitmapDropDown.Init(WindowID, _R(IDC_BITMAPEFFECT));
06611 m_oBitmapDropDown.SetColumns(3);
06612 m_oBitmapDropDown.SetItemSize(wxSize(50, 50));
06613
06614
06615 SetGadgetHelp(_R(IDC_GEOMETRY), _R(IDBBL_TRANSPTOOL_TRANSPSHAPE), _R(IDS_TRANSPTOOL_TRANSPSHAPE));
06616 SetGadgetHelp(_R(IDC_TRANSPTYPE), _R(IDBBL_TRANSPTOOL_TRANSPTYPE), _R(IDS_TRANSPTOOL_TRANSPTYPE));
06617 SetGadgetHelp(_R(IDC_MAPPING), _R(IDBBL_TRANSPTOOL_TRANSPTILING), _R(IDS_TRANSPTOOL_TRANSPTILING));
06618 SetGadgetHelp(_R(IDC_BITMAPEFFECT), _R(IDBBL_FILLTOOL_BITMAPNAME), _R(IDS_FILLTOOL_BITMAPNAME));
06619 SetGadgetHelp(_R(IDC_SELPOINT), _R(IDBBL_TRANSPTOOL_TRANSPHANDLE), _R(IDS_TRANSPTOOL_TRANSPHANDLE));
06620 SetGadgetHelp(_R(IDC_TRANSPSLIDE), _R(IDBBL_TRANSPTOOL_TRANSP), _R(IDS_TRANSPTOOL_TRANSP));
06621 SetGadgetHelp(_R(IDC_SELCOLOUR), _R(IDBBL_TRANSPTOOL_TRANSP), _R(IDS_TRANSPTOOL_TRANSP));
06622
06623 String_64 Str;
06624
06625
06626 for ( INT32 i=0; i<TransparencyGeometryMenuCount; i++ )
06627 {
06628 Str.Load( TransparencyGeometryMenu[i].StringID );
06629 SetStringGadgetValue( _R(IDC_GEOMETRY), Str, TRUE, TransparencyGeometryMenu[i].Geometry );
06630 }
06631
06632 Str.Load(_R(IDS_FILLTOOL_PAINT));
06633 SetStringGadgetValue(_R(IDC_TRANSPTYPE),Str,FALSE, FTMENU_REFLECT);
06634 Str.Load(_R(IDS_FILLTOOL_STAIN));
06635 SetStringGadgetValue(_R(IDC_TRANSPTYPE),Str,FALSE, FTMENU_SUB);
06636 Str.Load(_R(IDS_FILLTOOL_BLEACH));
06637 SetStringGadgetValue(_R(IDC_TRANSPTYPE),Str,TRUE, FTMENU_ADD);
06638 Str.Load(_R(IDS_FILLTOOL_CONTRAST));
06639 SetStringGadgetValue(_R(IDC_TRANSPTYPE),Str,TRUE, FTMENU_CON);
06640 Str.Load(_R(IDS_FILLTOOL_SATURATE));
06641 SetStringGadgetValue(_R(IDC_TRANSPTYPE),Str,TRUE, FTMENU_SAT);
06642 Str.Load(_R(IDS_FILLTOOL_DARKEN));
06643 SetStringGadgetValue(_R(IDC_TRANSPTYPE),Str,TRUE, FTMENU_DARK);
06644 Str.Load(_R(IDS_FILLTOOL_LIGHTEN));
06645 SetStringGadgetValue(_R(IDC_TRANSPTYPE),Str,TRUE, FTMENU_LIGHT);
06646 Str.Load(_R(IDS_FILLTOOL_BRIGHTNESS));
06647 SetStringGadgetValue(_R(IDC_TRANSPTYPE),Str,TRUE, FTMENU_BRI);
06648 Str.Load(_R(IDS_FILLTOOL_LUMINOSITY));
06649 SetStringGadgetValue(_R(IDC_TRANSPTYPE),Str,TRUE, FTMENU_LUM);
06650 Str.Load(_R(IDS_FILLTOOL_HUE));
06651 SetStringGadgetValue(_R(IDC_TRANSPTYPE),Str,TRUE, FTMENU_HUE);
06652
06653 Str.Load(_R(IDS_FILLTOOL_TESS_SIMPLE));
06654 SetStringGadgetValue(_R(IDC_MAPPING),Str,FALSE, FTMENU_SIMPLE);
06655 Str.Load(_R(IDS_FILLTOOL_TESS_REPEAT));
06656 SetStringGadgetValue(_R(IDC_MAPPING),Str,TRUE, FTMENU_REPEAT);
06657 Str.Load(_R(IDS_FILLTOOL_TESS_REPEATINV));
06658 SetStringGadgetValue(_R(IDC_MAPPING),Str,TRUE, FTMENU_REPEATINV);
06659
06660
06661 SetComboListLength(_R(IDC_GEOMETRY));
06662 SetComboListLength(_R(IDC_TRANSPTYPE));
06663 SetComboListLength(_R(IDC_MAPPING));
06664
06665 SetGadgetWritable(_R(IDC_GEOMETRY), FALSE);
06666 SetGadgetWritable(_R(IDC_TRANSPTYPE), FALSE);
06667 SetGadgetWritable(_R(IDC_MAPPING), FALSE);
06668
06669 SetGadgetWritable(_R(IDC_SELPOINT), FALSE);
06670 SetGadgetWritable(_R(IDC_SELCOLOUR), TRUE);
06671
06672 SliderMax = 255;
06673 SetGadgetRange(_R(IDC_TRANSPSLIDE), 0, SliderMax, 1);
06674 SetGadgetBitmaps(_R(IDC_TRANSPSLIDE), _R(IDB_SLIDERBASE), _R(IDB_SLIDERSLIDER));
06675
06676
06677 SelGeometryIndex = FGMENU_LINEARTRANSP;
06678 SelMappingIndex = 0;
06679
06680 CommonGeometry = NULL;
06681 CommonMapping = NULL;
06682
06683 MappingDisabled = FALSE;
06684 AllowForceToSimpleMapping = TRUE;
06685
06686 TypeDisabled = TRUE;
06687
06688 LastSliderPos = -1;
06689
06690 Mode = NOFILL;
06691
06692 m_BiasGainGadget.Init(this, _R(IDC_BIASGAIN), _R(IDBBL_BIASGAIN), _R(IDS_BIASGAINDLG));
06693 m_BiasGainGadget.ToggleTranspFillProfile ();
06694
06695 ShowInfo();
06696 }
06697
06698
06699
06700
06701
06702
06703
06704
06705
06706
06707
06708
06709 void TranspInfoBarOp::ShowInfo()
06710 {
06711
06712 if (!TranspTool::IsCurrentTool() || !IsVisible()) return;
06713
06714
06715 Selection = GetApplication()->FindSelection();
06716
06717
06718 AttrFillGeometry::SetSelectionCount(AttrFillGeometry::CountSelectionControlPoints());
06719
06720 OldMode = Mode;
06721
06722 ShowCommonType();
06723
06724
06725
06726
06727 switch (Mode)
06728 {
06729 case NOFILL:
06730 ShowFlatInfo();
06731 break;
06732
06733 case FLATFILL:
06734 ShowFlatInfo();
06735 break;
06736
06737 case GRADFILL:
06738 case GRADREPEATFILL:
06739 ShowGraduatedInfo();
06740 break;
06741
06742 case BITMAPFILL:
06743 ShowBitmapInfo();
06744 break;
06745
06746 case FRACTALFILL:
06747 ShowFractalInfo();
06748 break;
06749
06750 case NOISEFILL:
06751 ShowNoiseInfo();
06752 break;
06753
06754 default:
06755 ShowGraduatedInfo();
06756 break;
06757 }
06758
06759 EnableControls();
06760 }
06761
06762
06763
06764
06765
06766
06767
06768
06769
06770
06771
06772
06773 void TranspInfoBarOp::InitMapping()
06774 {
06775 DeleteAllValues(_R(IDC_MAPPING));
06776 EnableGadget(_R(IDC_MAPPING), TRUE);
06777 MappingDisabled = FALSE;
06778
06779 String_64 Str;
06780
06781 Str.Load(_R(IDS_FILLTOOL_MAPSIMPLE));
06782 SetStringGadgetValue(_R(IDC_MAPPING), Str,FALSE, FMMENU_SIMPLE);
06783 Str.Load(_R(IDS_FILLTOOL_MAPREPEAT));
06784 SetStringGadgetValue(_R(IDC_MAPPING), Str,TRUE, FMMENU_REPEATING);
06785
06786 SetComboListLength(_R(IDC_MAPPING));
06787 }
06788
06789
06790
06791
06792
06793
06794
06795
06796
06797
06798
06799
06800 void TranspInfoBarOp::InitBitmapName()
06801 {
06802
06803 m_oBitmapDropDown.Clear();
06804 EnableGadget (_R(IDC_BITMAPEFFECT), TRUE);
06805
06806 Document* pDoc = Document::GetSelected();
06807
06808
06809 BitmapList* Bitmaps = NULL;
06810 if (pDoc) Bitmaps = pDoc->GetBitmapList();
06811
06812 if (Bitmaps == NULL)
06813 return;
06814
06815 String_256 Str;
06816
06817 if (Bitmaps->GetCount() > 0)
06818 {
06819 INT32 Index = 0;
06820
06821 ListItem* pBmp = Bitmaps->GetHead();
06822
06823
06824
06825 while (pBmp != NULL)
06826 {
06827 if (!((KernelBitmap*)pBmp)->HasBeenDeleted())
06828 {
06829 Str = ((KernelBitmap*)pBmp)->ActualBitmap->GetName();
06830
06831 KernelBitmap* bitmap = ((KernelBitmap*)pBmp);
06832 m_oBitmapDropDown.AddItem(bitmap, FALSE, Str);
06833
06834 Index++;
06835 }
06836
06837 pBmp = Bitmaps->GetNext(pBmp);
06838 }
06839
06840
06841 }
06842
06843
06844
06845
06846
06847
06848
06849 }
06850
06851
06852
06853
06854
06855
06856
06857
06858
06859
06860
06861
06862 void TranspInfoBarOp::InitTransType ()
06863 {
06864 DeleteAllValues (_R(IDC_TRANSPTYPE));
06865 EnableGadget (_R(IDC_TRANSPTYPE), TRUE);
06866
06867 String_64 Str;
06868
06869 Str.Load(_R(IDS_FILLTOOL_PAINT));
06870 SetStringGadgetValue(_R(IDC_TRANSPTYPE), Str,FALSE, FTMENU_REFLECT);
06871 Str.Load(_R(IDS_FILLTOOL_STAIN));
06872 SetStringGadgetValue(_R(IDC_TRANSPTYPE),Str,FALSE, FTMENU_SUB);
06873 Str.Load(_R(IDS_FILLTOOL_BLEACH));
06874 SetStringGadgetValue(_R(IDC_TRANSPTYPE),Str,TRUE, FTMENU_ADD);
06875 Str.Load(_R(IDS_FILLTOOL_CONTRAST));
06876 SetStringGadgetValue(_R(IDC_TRANSPTYPE),Str,TRUE, FTMENU_CON);
06877 Str.Load(_R(IDS_FILLTOOL_SATURATE));
06878 SetStringGadgetValue(_R(IDC_TRANSPTYPE),Str,TRUE, FTMENU_SAT);
06879 Str.Load(_R(IDS_FILLTOOL_DARKEN));
06880 SetStringGadgetValue(_R(IDC_TRANSPTYPE),Str,TRUE, FTMENU_DARK);
06881 Str.Load(_R(IDS_FILLTOOL_LIGHTEN));
06882 SetStringGadgetValue(_R(IDC_TRANSPTYPE),Str,TRUE, FTMENU_LIGHT);
06883 Str.Load(_R(IDS_FILLTOOL_BRIGHTNESS));
06884 SetStringGadgetValue(_R(IDC_TRANSPTYPE),Str,TRUE, FTMENU_BRI);
06885 Str.Load(_R(IDS_FILLTOOL_LUMINOSITY));
06886 SetStringGadgetValue(_R(IDC_TRANSPTYPE),Str,TRUE, FTMENU_LUM);
06887 Str.Load(_R(IDS_FILLTOOL_HUE));
06888 SetStringGadgetValue(_R(IDC_TRANSPTYPE),Str,TRUE, FTMENU_HUE);
06889
06890 SetComboListLength(_R(IDC_TRANSPTYPE));
06891 }
06892
06893
06894
06895
06896
06897
06898
06899
06900
06901
06902
06903
06904
06905 void TranspInfoBarOp::InitTesselate()
06906 {
06907 DeleteAllValues(_R(IDC_MAPPING));
06908 EnableGadget(_R(IDC_MAPPING), TRUE);
06909 MappingDisabled = FALSE;
06910
06911 String_64 Str;
06912
06913 Str.Load(_R(IDS_FILLTOOL_TESS_SIMPLE));
06914 SetStringGadgetValue(_R(IDC_MAPPING),Str,FALSE, FTMENU_SIMPLE);
06915 Str.Load(_R(IDS_FILLTOOL_TESS_REPEAT));
06916 SetStringGadgetValue(_R(IDC_MAPPING),Str,TRUE, FTMENU_REPEAT);
06917 Str.Load(_R(IDS_FILLTOOL_TESS_REPEATINV));
06918 SetStringGadgetValue(_R(IDC_MAPPING),Str,TRUE, FTMENU_REPEATINV);
06919
06920 SetComboListLength(_R(IDC_MAPPING));
06921 }
06922
06923
06924
06925
06926
06927
06928
06929
06930
06931
06932
06933
06934
06935
06936
06937
06938
06939 void TranspInfoBarOp::DisplayTransparencyPercentString (double value)
06940 {
06941 if (value == (double) 1) { value = 0; }
06942
06943 double TranspVal = ((double) value * 100) / (double) SliderMax;
06944
06945 UINT32 Rounded = (UINT32) TranspVal;
06946 double Diff = TranspVal - Rounded;
06947
06948 if (Diff < 0.5)
06949 {
06950 if (Diff < 0.25) { TranspVal = (double) Rounded; }
06951 else { TranspVal = (double) Rounded + 0.5; }
06952 }
06953 else
06954 {
06955 if (Diff < 0.75) { TranspVal = (double) Rounded + 0.5; }
06956 else { TranspVal = (double) ++Rounded; }
06957 }
06958
06959 String_64 Str;
06960
06961 Convert::DoubleToString( TranspVal, &Str, 1 );
06962
06963 if (Str.FindNextChar ((TCHAR) '.') == -1)
06964 {
06965
06966
06967 Str += _T(".0");
06968 }
06969
06970 Str.MakePercent ((TCHAR*) Str);
06971
06972 String_64 PercentStr(Str);
06973 SetGadgetString(_R(IDC_SELCOLOUR), &PercentStr);
06974 }
06975
06976
06977
06978
06979
06980
06981
06982
06983
06984
06985
06986
06987
06988 BOOL TranspInfoBarOp::SetGadgetString(CGadgetID Gadget, StringBase* StrValue)
06989 {
06990 if (Gadget == _R(IDC_EFFECT) && TypeDisabled)
06991 return TRUE;
06992
06993 if (Gadget == _R(IDC_MAPPING) && MappingDisabled)
06994 return TRUE;
06995
06996 if (GetStringGadgetValue(Gadget, NULL, -1) != *StrValue)
06997 {
06998 return SetStringGadgetValue(Gadget, *StrValue, FALSE, -1);
06999 }
07000
07001 return TRUE;
07002 }
07003
07004
07005
07006
07007
07008
07009
07010
07011
07012
07013
07014 void TranspInfoBarOp::ShowFlatInfo()
07015 {
07016 if (OldMode != FLATFILL && OldMode != NOFILL)
07017 {
07018 InitTransType ();
07019 InitTesselate();
07020
07021
07022 SetGadgetHelp(_R(IDC_TRANSPTYPE), _R(IDBBL_TRANSPTOOL_TRANSPTYPE), _R(IDS_TRANSPTOOL_TRANSPTYPE));
07023 SetGadgetHelp(_R(IDC_MAPPING), _R(IDBBL_TRANSPTOOL_TRANSPTILING), _R(IDS_TRANSPTOOL_TRANSPTILING));
07024 SetGadgetHelp(_R(IDC_SELPOINT), _R(IDBBL_TRANSPTOOL_TRANSPHANDLE), _R(IDS_TRANSPTOOL_TRANSPHANDLE));
07025 SetGadgetHelp(_R(IDC_TRANSPSLIDE), _R(IDBBL_TRANSPTOOL_TRANSP), _R(IDS_TRANSPTOOL_TRANSP));
07026 SetGadgetHelp(_R(IDC_SELCOLOUR), _R(IDBBL_TRANSPTOOL_TRANSP), _R(IDS_TRANSPTOOL_TRANSP));
07027
07028
07029
07030
07031 SliderMax = 255;
07032 SetGadgetRange(_R(IDC_TRANSPSLIDE), 0, SliderMax, 1);
07033 }
07034
07035 ShowCommonTesselate();
07036 ShowCommonTranspType();
07037 ShowControlPointInfo();
07038 }
07039
07040
07041
07042
07043
07044
07045
07046
07047
07048
07049
07050 void TranspInfoBarOp::ShowGraduatedInfo()
07051 {
07052 if (OldMode != GRADFILL && OldMode != GRADREPEATFILL)
07053 {
07054 InitTransType ();
07055 InitMapping();
07056
07057
07058 SetGadgetHelp(_R(IDC_TRANSPTYPE), _R(IDBBL_TRANSPTOOL_TRANSPTYPE), _R(IDS_TRANSPTOOL_TRANSPTYPE));
07059 SetGadgetHelp(_R(IDC_MAPPING), _R(IDBBL_TRANSPTOOL_TRANSPTILING), _R(IDS_TRANSPTOOL_TRANSPTILING));
07060 SetGadgetHelp(_R(IDC_SELPOINT), _R(IDBBL_TRANSPTOOL_TRANSPHANDLE), _R(IDS_TRANSPTOOL_TRANSPHANDLE));
07061 SetGadgetHelp(_R(IDC_TRANSPSLIDE), _R(IDBBL_TRANSPTOOL_TRANSP), _R(IDS_TRANSPTOOL_TRANSP));
07062 SetGadgetHelp(_R(IDC_SELCOLOUR), _R(IDBBL_TRANSPTOOL_TRANSP), _R(IDS_TRANSPTOOL_TRANSP));
07063
07064
07065
07066
07067 SliderMax = 255;
07068 SetGadgetRange(_R(IDC_TRANSPSLIDE), 0, SliderMax, 1);
07069 }
07070
07071 ShowCommonMapping();
07072 ShowCommonTranspType();
07073 ShowControlPointInfo();
07074 }
07075
07076
07077
07078
07079
07080
07081
07082
07083
07084
07085
07086
07087 void TranspInfoBarOp::ShowBitmapInfo()
07088 {
07089 if (OldMode != BITMAPFILL)
07090 {
07091 InitTesselate();
07092 InitTransType ();
07093
07094 InitBitmapName();
07095
07096 SetGadgetHelp(_R(IDC_TRANSPTYPE), _R(IDBBL_TRANSPTOOL_TRANSPTYPE), _R(IDS_TRANSPTOOL_TRANSPTYPE));
07097 SetGadgetHelp(_R(IDC_MAPPING), _R(IDBBL_TRANSPTOOL_TRANSPTILING), _R(IDS_TRANSPTOOL_TRANSPTILING));
07098 SetGadgetHelp(_R(IDC_BITMAPEFFECT), _R(IDBBL_FILLTOOL_BITMAPNAME), _R(IDS_FILLTOOL_BITMAPNAME));
07099 }
07100
07101 if (AttrFillGeometry::SelectionCount == 0)
07102 {
07103 SetGadgetWritable(_R(IDC_SELPOINT), TRUE);
07104
07105 SetGadgetHelp(_R(IDC_SELPOINT), _R(IDBBL_FILLTOOL_FRACTALRES), _R(IDS_FILLTOOL_FRACTALRES));
07106
07107
07108 SetGadgetHelp(_R(IDC_TRANSPSLIDE), _R(IDBBL_TRANSPTOOL_TRANSP), _R(IDS_TRANSPTOOL_TRANSP));
07109 SetGadgetHelp(_R(IDC_SELCOLOUR), _R(IDBBL_TRANSPTOOL_TRANSP), _R(IDS_TRANSPTOOL_TRANSP));
07110
07111
07112
07113 }
07114 else
07115 {
07116 SetGadgetWritable(_R(IDC_SELPOINT), FALSE);
07117 SetGadgetHelp(_R(IDC_SELPOINT), _R(IDBBL_TRANSPTOOL_TRANSPHANDLE), _R(IDS_TRANSPTOOL_TRANSPHANDLE));
07118
07119 SetGadgetHelp(_R(IDC_TRANSPSLIDE), _R(IDBBL_TRANSPTOOL_TRANSP), _R(IDS_TRANSPTOOL_TRANSP));
07120 SetGadgetHelp(_R(IDC_SELCOLOUR), _R(IDBBL_TRANSPTOOL_TRANSP), _R(IDS_TRANSPTOOL_TRANSP));
07121
07122 SliderMax = 255;
07123 }
07124
07125 SetGadgetRange(_R(IDC_TRANSPSLIDE), 0, SliderMax, 1);
07126
07127 ShowCommonTesselate();
07128 ShowCommonTranspType();
07129 ShowCommonBitmapName();
07130
07131 if (AttrFillGeometry::SelectionCount == 0)
07132 ShowCommonBitmapDpi();
07133
07134 ShowControlPointInfo();
07135 }
07136
07137
07138
07139
07140
07141
07142
07143
07144
07145
07146
07147
07148 void TranspInfoBarOp::ShowNoiseInfo()
07149 {
07150 if (OldMode != NOISEFILL)
07151 {
07152 InitTransType ();
07153 InitTesselate();
07154
07155
07156 SetGadgetHelp(_R(IDC_TRANSPTYPE), _R(IDBBL_TRANSPTOOL_TRANSPTYPE), _R(IDS_TRANSPTOOL_TRANSPTYPE));
07157 SetGadgetHelp(_R(IDC_MAPPING), _R(IDBBL_TRANSPTOOL_TRANSPTILING), _R(IDS_TRANSPTOOL_TRANSPTILING));
07158 }
07159
07160 if (AttrFillGeometry::SelectionCount == 0)
07161 {
07162 SetGadgetWritable(_R(IDC_SELPOINT), TRUE);
07163
07164 SetGadgetHelp(_R(IDC_SELPOINT), _R(IDBBL_FILLTOOL_FRACTALRES), _R(IDS_FILLTOOL_FRACTALRES));
07165 SetGadgetHelp(_R(IDC_TRANSPSLIDE), _R(IDBBL_TRANSPTOOL_NOISESCALE), _R(IDS_TRANSPTOOL_NOISESCALE));
07166 SetGadgetHelp(_R(IDC_SELCOLOUR), _R(IDBBL_TRANSPTOOL_NOISESCALE), _R(IDS_TRANSPTOOL_NOISESCALE));
07167
07168 SliderMax = GetScalePosMax();
07169 }
07170 else
07171 {
07172 SetGadgetWritable(_R(IDC_SELPOINT), FALSE);
07173
07174 SetGadgetHelp(_R(IDC_SELPOINT), _R(IDBBL_TRANSPTOOL_TRANSPHANDLE), _R(IDS_TRANSPTOOL_TRANSPHANDLE));
07175 SetGadgetHelp(_R(IDC_TRANSPSLIDE), _R(IDBBL_TRANSPTOOL_TRANSP), _R(IDS_TRANSPTOOL_TRANSP));
07176 SetGadgetHelp(_R(IDC_SELCOLOUR), _R(IDBBL_TRANSPTOOL_TRANSP), _R(IDS_TRANSPTOOL_TRANSP));
07177
07178 SliderMax = 255;
07179 }
07180
07181 SetGadgetRange(_R(IDC_TRANSPSLIDE), 0, SliderMax, 1);
07182
07183 ShowCommonTesselate();
07184 ShowCommonTranspType();
07185
07186 if (AttrFillGeometry::SelectionCount == 0)
07187 {
07188 ShowCommonBitmapDpi();
07189 ShowCommonNoiseScale();
07190 }
07191 else
07192 ShowControlPointInfo();
07193 }
07194
07195
07196
07197
07198
07199
07200
07201
07202
07203
07204
07205 void TranspInfoBarOp::ShowFractalInfo()
07206 {
07207 if (OldMode != FRACTALFILL)
07208 {
07209 InitTransType ();
07210 InitTesselate();
07211
07212
07213
07214 SetGadgetHelp(_R(IDC_MAPPING), _R(IDBBL_TRANSPTOOL_TRANSPTILING), _R(IDS_TRANSPTOOL_TRANSPTILING));
07215 }
07216
07217 if (AttrFillGeometry::SelectionCount == 0)
07218 {
07219 SetGadgetWritable(_R(IDC_SELPOINT), TRUE);
07220
07221 SetGadgetHelp(_R(IDC_SELPOINT), _R(IDBBL_FILLTOOL_FRACTALRES), _R(IDS_FILLTOOL_FRACTALRES));
07222 SetGadgetHelp(_R(IDC_TRANSPSLIDE), _R(IDBBL_TRANSPTOOL_GRAININESS), _R(IDS_TRANSPTOOL_GRAININESS));
07223 SetGadgetHelp(_R(IDC_SELCOLOUR), _R(IDBBL_TRANSPTOOL_GRAININESS), _R(IDS_TRANSPTOOL_GRAININESS));
07224
07225 SliderMax = GetGrainPosMax();
07226 }
07227 else
07228 {
07229 SetGadgetWritable(_R(IDC_SELPOINT), FALSE);
07230
07231 SetGadgetHelp(_R(IDC_SELPOINT), _R(IDBBL_TRANSPTOOL_TRANSPHANDLE), _R(IDS_TRANSPTOOL_TRANSPHANDLE));
07232 SetGadgetHelp(_R(IDC_TRANSPSLIDE), _R(IDBBL_TRANSPTOOL_TRANSP), _R(IDS_TRANSPTOOL_TRANSP));
07233 SetGadgetHelp(_R(IDC_SELCOLOUR), _R(IDBBL_TRANSPTOOL_TRANSP), _R(IDS_TRANSPTOOL_TRANSP));
07234
07235 SliderMax = 255;
07236 }
07237
07238 SetGadgetRange(_R(IDC_TRANSPSLIDE), 0, SliderMax, 1);
07239
07240 ShowCommonTesselate();
07241 ShowCommonTranspType();
07242
07243 if (AttrFillGeometry::SelectionCount == 0)
07244 {
07245 ShowCommonBitmapDpi();
07246 ShowCommonFractalGrain();
07247 }
07248 else
07249 ShowControlPointInfo();
07250 }
07251
07252
07253
07254
07255
07256
07257
07258
07259
07260
07261
07262
07263
07264 void TranspInfoBarOp::ShowCommonType(BOOL ShowDataAndNotSet)
07265 {
07266 CommonAttr = SelRange::ATTR_NONE;
07267 String_64 Str;
07268 Str.Load(_R(IDS_FILLTOOL_NONE));
07269 String_64 TStr;
07270 TStr.Load(_R(IDS_FILLTOOL_NONE));
07271
07272 if (Selection != NULL)
07273 {
07274 Document* pCurrentDoc = Document::GetCurrent();
07275 if (Document::GetSelected())
07276 Document::GetSelected()->SetCurrent();
07277
07278 EffectsStack* pStack = Selection->GetEffectsStack();
07279 INT32 iStackPos = STACKPOS_TOP;
07280 Range* pLevel = pStack->GetLevelRange(&iStackPos, FALSE);
07281
07282
07283
07284
07285
07286
07287 CommonAttr = pLevel->FindCommonAttribute(CC_RUNTIME_CLASS(AttrTranspFillGeometry),
07288 (NodeAttribute**)&CommonGeometry,
07289 TRUE);
07290 CCRuntimeClass* GeometryType;
07291
07292
07293
07294
07295
07296
07297 SelRange::CommonAttribResult CommonType =
07298 pLevel->FindCommonAttributeType(CC_RUNTIME_CLASS(AttrTranspFillGeometry),
07299 &GeometryType,
07300 FALSE,
07301 TRUE);
07302
07303 if (CommonAttr == SelRange::ATTR_NONE &&
07304 CommonGeometry != NULL)
07305 {
07306 CommonAttr = SelRange::ATTR_COMMON;
07307 }
07308
07309 if (CommonType == SelRange::ATTR_NONE &&
07310 GeometryType != NULL)
07311 {
07312 CommonType = SelRange::ATTR_COMMON;
07313 }
07314
07315
07316
07317 if (CommonType == SelRange::ATTR_COMMON)
07318 {
07319 if (GeometryType == CC_RUNTIME_CLASS(AttrFlatTranspFill))
07320 {
07321 Str.Load(_R(IDS_FILLTOOL_FLATTRANSP));
07322 Mode = FLATFILL;
07323 CurrentGeometryIndex = FGMENU_FLATTRANSP;
07324
07325 if (CommonAttr == SelRange::ATTR_COMMON)
07326 {
07327 if ( (CommonGeometry->GetTranspType() == TT_Mix) && ((*CommonGeometry->GetStartTransp()) == 0) )
07328 {
07329 Str.Load(_R(IDS_FILLTOOL_NONE));
07330 Mode = NOFILL;
07331 CurrentGeometryIndex = 0;
07332 }
07333 }
07334 }
07335 else if (GeometryType == CC_RUNTIME_CLASS(AttrLinearTranspFill))
07336 {
07337 Str.Load(_R(IDS_FILLTOOL_LINEAR));
07338 Mode = GRADFILL;
07339 CurrentGeometryIndex = FGMENU_LINEARTRANSP;
07340 }
07341 else if (GeometryType == CC_RUNTIME_CLASS(AttrCircularTranspFill))
07342 {
07343 Str.Load(_R(IDS_FILLTOOL_CIRCULAR));
07344 Mode = GRADFILL;
07345 CurrentGeometryIndex = FGMENU_CIRCULARTRANSP;
07346 }
07347 else if (GeometryType == CC_RUNTIME_CLASS(AttrRadialTranspFill))
07348 {
07349 Str.Load(_R(IDS_FILLTOOL_ELLIPTICAL));
07350 Mode = GRADFILL;
07351 CurrentGeometryIndex = FGMENU_RADIALTRANSP;
07352 }
07353 else if (GeometryType == CC_RUNTIME_CLASS(AttrConicalTranspFill))
07354 {
07355 Str.Load(_R(IDS_FILLTOOL_CONICAL));
07356 Mode = GRADFILL;
07357 CurrentGeometryIndex = FGMENU_CONICALTRANSP;
07358 }
07359 else if (GeometryType == CC_RUNTIME_CLASS(AttrSquareTranspFill))
07360 {
07361 Str.Load(_R(IDS_FILLTOOL_SQUARE));
07362 Mode = GRADFILL;
07363 CurrentGeometryIndex = FGMENU_SQUARETRANSP;
07364 }
07365 else if (GeometryType == CC_RUNTIME_CLASS(AttrThreeColTranspFill))
07366 {
07367 Str.Load(_R(IDS_FILLTOOL_THREECOLTRANS));
07368 Mode = GRADREPEATFILL;
07369 CurrentGeometryIndex = FGMENU_THREECOLTRANSP;
07370 }
07371 else if (GeometryType == CC_RUNTIME_CLASS(AttrFourColTranspFill))
07372 {
07373 Str.Load(_R(IDS_FILLTOOL_FOURCOLTRANS));
07374 Mode = GRADREPEATFILL;
07375 CurrentGeometryIndex = FGMENU_FOURCOLTRANSP;
07376 }
07377 else if (GeometryType == CC_RUNTIME_CLASS(AttrBitmapTranspFill))
07378 {
07379 Str.Load(_R(IDS_FILLTOOL_TEXTURE));
07380 Mode = BITMAPFILL;
07381 CurrentGeometryIndex = FGMENU_BITMAPTRANSP;
07382 }
07383 else if (GeometryType == CC_RUNTIME_CLASS(AttrFractalTranspFill))
07384 {
07385 Str.Load(_R(IDS_FILLTOOL_FRACTAL));
07386 Mode = FRACTALFILL;
07387 CurrentGeometryIndex = FGMENU_FRACTALTRANSP;
07388 }
07389 else if (GeometryType == CC_RUNTIME_CLASS(AttrNoiseTranspFill))
07390 {
07391 Str.Load(_R(IDS_FILLTOOL_NOISE));
07392 Mode = NOISEFILL;
07393 CurrentGeometryIndex = FGMENU_NOISETRANSP;
07394 }
07395 }
07396 else
07397 {
07398 if (CommonAttr == SelRange::ATTR_MANY)
07399 {
07400
07401 Str.Load(_R(IDS_FILLTOOL_MANY));
07402 Mode = MANYFILLS;
07403 CurrentGeometryIndex = FGMENU_MANYTRANSP;
07404 }
07405 }
07406
07407 if (pCurrentDoc)
07408 pCurrentDoc->SetCurrent();
07409 }
07410
07411
07412 if (ShowDataAndNotSet)
07413 {
07414 SetGadgetString(_R(IDC_GEOMETRY),&Str);
07415 }
07416 }
07417
07418
07419
07420
07421
07422
07423
07424
07425
07426
07427
07428
07429
07430 void TranspInfoBarOp::ShowCommonTranspType (BOOL ShowDataAndNotSet)
07431 {
07432 String_64 TStr;
07433 TStr.Load (_R(IDS_FILLTOOL_NONE));
07434
07435 INT32 TType = FindCommonTranspType ();
07436 switch (TType)
07437 {
07438 case -1:
07439 TStr.Load(_R(IDS_FILLTOOL_MANY));
07440 CurrentTransTypeIndex = -2;
07441 break;
07442
07443 case 0:
07444 TStr.Load(_R(IDS_FILLTOOL_NONE));
07445 CurrentTransTypeIndex = -1;
07446 break;
07447
07448 case 1:
07449 TStr.Load(_R(IDS_FILLTOOL_PAINT));
07450 CurrentTransTypeIndex = FTMENU_REFLECT;
07451 break;
07452
07453 case 2:
07454 TStr.Load(_R(IDS_FILLTOOL_STAIN));
07455 CurrentTransTypeIndex = FTMENU_SUB;
07456 break;
07457
07458 case 3:
07459 TStr.Load(_R(IDS_FILLTOOL_BLEACH));
07460 CurrentTransTypeIndex = FTMENU_ADD;
07461 break;
07462
07463 case 13:
07464 TStr.Load(_R(IDS_FILLTOOL_CONTRAST));
07465 CurrentTransTypeIndex = FTMENU_CON;
07466 break;
07467
07468 case 16:
07469 TStr.Load(_R(IDS_FILLTOOL_SATURATE));
07470 CurrentTransTypeIndex = FTMENU_SAT;
07471 break;
07472
07473 case 19:
07474 TStr.Load(_R(IDS_FILLTOOL_DARKEN));
07475 CurrentTransTypeIndex = FTMENU_DARK;
07476 break;
07477
07478 case 22:
07479 TStr.Load(_R(IDS_FILLTOOL_LIGHTEN));
07480 CurrentTransTypeIndex = FTMENU_LIGHT;
07481 break;
07482
07483 case 25:
07484 TStr.Load(_R(IDS_FILLTOOL_BRIGHTNESS));
07485 CurrentTransTypeIndex = FTMENU_BRI;
07486 break;
07487
07488 case 28:
07489 TStr.Load(_R(IDS_FILLTOOL_LUMINOSITY));
07490 CurrentTransTypeIndex = FTMENU_LUM;
07491 break;
07492
07493 case 31:
07494 TStr.Load(_R(IDS_FILLTOOL_HUE));
07495 CurrentTransTypeIndex = FTMENU_HUE;
07496 break;
07497 }
07498
07499 if (ShowDataAndNotSet)
07500 {
07501 SetGadgetString(_R(IDC_TRANSPTYPE),&TStr);
07502 }
07503 }
07504
07505
07506
07507
07508
07509
07510
07511
07512
07513
07514
07515
07516
07517 INT32 TranspInfoBarOp::FindCommonTranspType()
07518 {
07519 if (Selection->Count() == 0)
07520 {
07521 AttrFillGeometry* pCurrentFill = GetCurrentGeometry();
07522
07523 if (pCurrentFill != NULL)
07524 {
07525 return pCurrentFill->GetTranspType();
07526 }
07527
07528 return 0;
07529 }
07530
07531 AttrFillGeometry* pAttrNode = AttrFillGeometry::FindFirstSelectedAttr(CC_RUNTIME_CLASS(AttrTranspFillGeometry));
07532
07533
07534 if (pAttrNode == NULL)
07535 return 0;
07536
07537 UINT32 TType = 0;
07538
07539 while (pAttrNode != NULL)
07540 {
07541 if (pAttrNode->GetAttributeType() == CC_RUNTIME_CLASS(AttrTranspFillGeometry))
07542 {
07543 UINT32 NodeTType = pAttrNode->GetTranspType();
07544
07545 if (TType == 0)
07546 TType = NodeTType;
07547
07548 if (TType != NodeTType)
07549 return -1;
07550 }
07551
07552
07553 pAttrNode = AttrFillGeometry::FindNextSelectedAttr(CC_RUNTIME_CLASS(AttrTranspFillGeometry));
07554 }
07555
07556 return TType;
07557 }
07558
07559
07560
07561
07562
07563
07564
07565
07566
07567
07568
07569
07570
07571
07572 void TranspInfoBarOp::ShowCommonMapping(BOOL ShowDataAndNotSet)
07573 {
07574 String_64 Str;
07575
07576 INT32 CommTess = FindCommonTesselate();
07577
07578 switch (CommTess)
07579 {
07580 case -1:
07581 Str.Load(_R(IDS_FILLTOOL_MANY));
07582 CurrentMappingIndex = -2;
07583 break;
07584
07585 case 0:
07586 Str.Load(_R(IDS_FILLTOOL_NONE));
07587 CurrentMappingIndex = -1;
07588 break;
07589
07590 case 1:
07591 Str.Load(_R(IDS_FILLTOOL_MAPSIMPLE));
07592 CurrentMappingIndex = FMMENU_SIMPLE;
07593 break;
07594
07595 case 2:
07596
07597 #ifdef NEW_FEATURES
07598 if(Mode == GRADFILL)
07599 {
07600 Str.Load(_R(IDS_FILLTOOL_MAPSIMPLE));
07601 CurrentMappingIndex = FMMENU_SIMPLE;
07602 break;
07603 }
07604 else
07605 {
07606 Str.Load(_R(IDS_FILLTOOL_MAPREPEAT));
07607 CurrentMappingIndex = FMMENU_REPEATING;
07608 break;
07609 }
07610 case 4:
07611 #endif
07612 case 3:
07613 Str.Load(_R(IDS_FILLTOOL_MAPREPEAT));
07614 CurrentMappingIndex = 2;
07615 break;
07616 }
07617
07618 if (ShowDataAndNotSet)
07619 {
07620 SetGadgetString(_R(IDC_MAPPING),&Str);
07621 }
07622 }
07623
07624
07625
07626
07627
07628
07629
07630
07631
07632
07633
07634 void TranspInfoBarOp::ShowCommonTesselate()
07635 {
07636 String_64 Str;
07637
07638 INT32 CommTess = FindCommonTesselate();
07639
07640 switch (CommTess)
07641 {
07642 case -1:
07643 Str.Load(_R(IDS_FILLTOOL_MANY));
07644 CurrentMappingIndex = FTMENU_REPEAT;
07645 break;
07646
07647 case 0:
07648 Str.Load(_R(IDS_FILLTOOL_NONE));
07649 CurrentMappingIndex = FTMENU_REPEAT;
07650 break;
07651
07652 case 1:
07653 Str.Load(_R(IDS_FILLTOOL_TESS_SIMPLE));
07654 CurrentMappingIndex = FTMENU_SIMPLE;
07655 break;
07656
07657 case 2:
07658 Str.Load(_R(IDS_FILLTOOL_TESS_REPEAT));
07659 CurrentMappingIndex = FTMENU_REPEAT;
07660 break;
07661
07662 case 3:
07663 Str.Load(_R(IDS_FILLTOOL_TESS_REPEATINV));
07664 CurrentMappingIndex = FTMENU_REPEATINV;
07665 break;
07666 }
07667
07668 SetGadgetString(_R(IDC_MAPPING),&Str);
07669
07670 EnableGadget(_R(IDC_MAPPING), TRUE);
07671 }
07672
07673
07674
07675
07676
07677
07678
07679
07680
07681
07682
07683 INT32 TranspInfoBarOp::FindCommonTesselate()
07684 {
07685 INT32 CommonTess = 0;
07686 Node* pNode;
07687 NodeAttribute* pChild;
07688
07689 if (Selection->Count() == 0)
07690 {
07691 AttrTranspFillMapping* pCurrentMapping = GetCurrentMapping();
07692
07693 if (pCurrentMapping != NULL)
07694 {
07695 return pCurrentMapping->GetRepeat();
07696 }
07697
07698 return 0;
07699 }
07700
07701
07702 if (Selection != NULL)
07703 {
07704 EffectsStack* pStack = Selection->GetEffectsStack();
07705 INT32 iStackPos = STACKPOS_TOP;
07706 Range* pLevel = pStack->GetLevelRange(&iStackPos, FALSE);
07707
07708
07709
07710
07711
07712
07713
07714
07715
07716
07717
07718
07719
07720
07721
07722
07723
07724
07725
07726
07727
07728
07729 pNode = pLevel->FindFirst();
07730 while (pNode != NULL)
07731 {
07732 pChild = ((NodeRenderableInk*)pNode)->FindAppliedAttribute(CC_RUNTIME_CLASS(AttrTranspFillMapping));
07733
07734 if (pChild)
07735 {
07736 INT32 Tess = ((AttrTranspFillMapping*)pChild)->GetRepeat();
07737
07738 if (CommonTess == 0)
07739 CommonTess = Tess;
07740
07741 if (Tess != CommonTess)
07742 {
07743 return -1;
07744 }
07745 }
07746
07747 pNode = pLevel->FindNext(pNode);
07748 }
07749
07750 }
07751
07752
07753
07754
07755 return CommonTess;
07756 }
07757
07758
07759
07760
07761
07762
07763
07764
07765
07766
07767
07768 void TranspInfoBarOp::ShowCommonBitmapName()
07769 {
07770 String_64 strName = FindCommonBitmapName();
07771 m_oBitmapDropDown.SelectByLabel(strName);
07772 }
07773
07774
07775
07776
07777
07778
07779
07780
07781
07782
07783
07784 String_64 TranspInfoBarOp::FindCommonBitmapName()
07785 {
07786 String_256 CommonName;
07787 CommonName.Load(_R(IDS_FILLTOOL_NONE));
07788
07789 if (Selection->Count() == 0)
07790 {
07791 AttrFillGeometry* pCurrentFill = GetCurrentGeometry();
07792
07793
07794
07795
07796
07797
07798
07799
07800
07801
07802 if (pCurrentFill && pCurrentFill->IsABitmapFill())
07803 {
07804 CommonName = pCurrentFill->GetBitmap()->ActualBitmap->GetName();
07805 }
07806
07807 return CommonName;
07808 }
07809
07810 String_256 Name;
07811 Name.Load(_R(IDS_FILLTOOL_NONE));
07812
07813 String_256 None;
07814 None.Load(_R(IDS_FILLTOOL_NONE));
07815
07816 String_256 Many;
07817 Many.Load(_R(IDS_FILLTOOL_MANY));
07818
07819
07820
07821 AttrFillGeometry* pAttrNode = AttrTranspFillGeometry::FindFirstSelectedAttr(CC_RUNTIME_CLASS(AttrTranspFillGeometry));
07822
07823
07824 if (pAttrNode == NULL)
07825 return None;
07826
07827 while (pAttrNode != NULL)
07828 {
07829 if (pAttrNode->IsKindOf(CC_RUNTIME_CLASS(AttrBitmapTranspFill)))
07830 {
07831 Name = pAttrNode->GetBitmap()->ActualBitmap->GetName();
07832
07833 if (CommonName == None)
07834 CommonName = Name;
07835
07836 if (Name != CommonName)
07837 {
07838 return Many;
07839 }
07840 }
07841
07842
07843 pAttrNode = AttrTranspFillGeometry::FindNextSelectedAttr(CC_RUNTIME_CLASS(AttrTranspFillGeometry));
07844 }
07845
07846 return CommonName;
07847 }
07848
07849
07850
07851
07852
07853
07854
07855
07856
07857
07858
07859 void TranspInfoBarOp::ShowCommonBitmapDpi()
07860 {
07861 INT32 dpi = FindCommonBitmapDpi();
07862
07863 TCHAR Str[16];
07864 String_64 DpiStr;
07865
07866 if (dpi == 0)
07867 {
07868 DpiStr.Load(_R(IDS_FILLTOOL_NODPI));
07869 }
07870
07871 else if (dpi == -1)
07872 {
07873 DpiStr.Load(_R(IDS_FILLTOOL_MANYDPI));
07874 }
07875
07876 else if (dpi > 0)
07877 {
07878 String_256 jcf(_R(IDS_FILLTOOL_DPI_FORMAT));
07879 camSnprintf(Str, 15, jcf, (INT32) dpi);
07880 DpiStr = Str;
07881 }
07882
07883 SetGadgetString(_R(IDC_SELPOINT), &DpiStr);
07884 }
07885
07886 void TranspInfoBarOp::SetGadgetWritable(INT32 id, BOOL enable)
07887 {
07888 PORTNOTETRACE("other","TranspInfoBarOp::SetGadgetWritable disabled");
07889 #ifndef EXCLUDE_FROM_XARALX
07890
07891 HWND gadget = ::GetDlgItem(WindowID, id);
07892 HWND hEdit = ::ChildWindowFromPoint(gadget, CPoint(1,1));
07893
07894 if (hEdit)
07895 gadget = hEdit;
07896
07897 if (enable)
07898 ::SendMessage(gadget, EM_SETREADONLY, FALSE, 0);
07899 else
07900 ::SendMessage(gadget, EM_SETREADONLY, TRUE, 0);
07901 #endif
07902 }
07903
07904
07905
07906
07907
07908
07909
07910
07911
07912
07913
07914
07915
07916
07917
07918 BOOL TranspInfoBarOp::GetGadgetWritable (INT32 id)
07919 {
07920 PORTNOTETRACE("other","TranspInfoBarOp::GetGadgetWritable disabled");
07921 #ifndef EXCLUDE_FROM_XARALX
07922
07923 HWND gadget = ::GetDlgItem (WindowID, id);
07924
07925
07926 HWND hEdit = ::ChildWindowFromPoint (gadget, CPoint(1,1));
07927
07928 if (hEdit)
07929 gadget = hEdit;
07930
07931 if (GetWindowLong (gadget, GWL_STYLE) & ES_READONLY)
07932 {
07933 return (TRUE);
07934 }
07935 else
07936 {
07937 return (FALSE);
07938 }
07939 #else
07940 return TRUE;
07941 #endif
07942 }
07943
07944
07945
07946
07947
07948
07949
07950
07951
07952
07953
07954 INT32 TranspInfoBarOp::FindCommonBitmapDpi()
07955 {
07956 if (Selection->Count() == 0)
07957 {
07958 AttrFillGeometry* pCurrentFill = GetCurrentGeometry();
07959
07960 if (pCurrentFill && pCurrentFill->IsABitmapFill())
07961 {
07962 return pCurrentFill->GetDPI();
07963 }
07964
07965 return 0;
07966 }
07967
07968
07969 AttrFillGeometry* pAttrNode = AttrFillGeometry::FindFirstSelectedAttr(CC_RUNTIME_CLASS(AttrTranspFillGeometry));
07970
07971
07972 if (pAttrNode == NULL)
07973 return 0;
07974
07975 INT32 CommonDpi = 0;
07976 INT32 Dpi = 0;
07977
07978 while (pAttrNode != NULL)
07979 {
07980 if (pAttrNode->IsKindOf(CC_RUNTIME_CLASS(AttrBitmapFill)))
07981 {
07982 if (pAttrNode->IsKindOf(CC_RUNTIME_CLASS(AttrTextureTranspFill)) ||
07983 pAttrNode->IsKindOf(CC_RUNTIME_CLASS(AttrBitmapTranspFill)) )
07984 {
07985 Dpi = pAttrNode->GetDPI();
07986
07987 if (CommonDpi == 0)
07988 CommonDpi = Dpi;
07989
07990 if (Dpi != CommonDpi)
07991 {
07992 return -1;
07993 }
07994 }
07995 }
07996
07997
07998 pAttrNode = AttrFillGeometry::FindNextSelectedAttr(CC_RUNTIME_CLASS(AttrTranspFillGeometry));
07999 }
08000
08001 return CommonDpi;
08002 }
08003
08004
08005
08006
08007
08008
08009
08010
08011
08012
08013
08014 void TranspInfoBarOp::ShowCommonFractalGrain()
08015 {
08016 double Grain = FindCommonFractalGrain();
08017
08018 TCHAR Str[16];
08019 String_64 GrainStr;
08020
08021 if (Grain == 0)
08022 GrainStr.Load(_R(IDS_FILLTOOL_NOGRAIN));
08023 if (Grain == -1)
08024 GrainStr.Load(_R(IDS_FILLTOOL_MANYGRAIN));
08025 if (Grain > 0)
08026 {
08027 camSnprintf(Str, 15, _T("%.1f"), Grain);
08028 GrainStr = Str;
08029 }
08030
08031 INT32 GrainPos = GetGrainPos(Grain);
08032
08033 SetGadgetString(_R(IDC_SELCOLOUR),&GrainStr);
08034 SetLongGadgetValue(_R(IDC_TRANSPSLIDE), GrainPos);
08035
08036
08037 camSnprintf(Str, 15, _T("%.1f"), Grain);
08038 String_8 PercentStr(Str);
08039 SetGadgetString(_R(IDC_SELCOLOUR), &PercentStr);
08040 }
08041
08042
08043
08044
08045
08046
08047
08048
08049
08050
08051
08052 double TranspInfoBarOp::FindCommonFractalGrain()
08053 {
08054 if (Selection->Count() == 0)
08055 {
08056 AttrFillGeometry* pCurrentFill = GetCurrentGeometry();
08057
08058 if (pCurrentFill && pCurrentFill->IsAFractalFill())
08059 {
08060 return ((FractalTranspFillAttribute*)pCurrentFill->GetAttributeValue())->Graininess.MakeDouble();
08061 }
08062
08063 return 0;
08064 }
08065
08066
08067 AttrFillGeometry* pAttrNode = AttrFillGeometry::FindFirstSelectedAttr(CC_RUNTIME_CLASS(AttrTranspFillGeometry));
08068
08069
08070 if (pAttrNode == NULL)
08071 return 0;
08072
08073 double CommonGrain = 0;
08074
08075 while (pAttrNode != NULL)
08076 {
08077 if (pAttrNode->IsKindOf(CC_RUNTIME_CLASS(AttrFractalTranspFill)))
08078 {
08079 double Grain = ((FractalTranspFillAttribute*)pAttrNode->GetAttributeValue())->Graininess.MakeDouble();
08080
08081 if (CommonGrain == 0)
08082 CommonGrain = Grain;
08083
08084 if (Grain != CommonGrain)
08085 {
08086 return -1;
08087 }
08088 }
08089
08090
08091 pAttrNode = AttrFillGeometry::FindNextSelectedAttr(CC_RUNTIME_CLASS(AttrTranspFillGeometry));
08092 }
08093
08094 return CommonGrain;
08095 }
08096
08097
08098
08099
08100
08101
08102
08103
08104
08105
08106
08107 void TranspInfoBarOp::ShowCommonNoiseScale()
08108 {
08109 double Scale = FindCommonNoiseScale();
08110
08111 BOOL convert = FALSE;
08112
08113 TCHAR Str[16];
08114 String_64 ScaleStr;
08115
08116 if (Scale == 0)
08117 {
08118 ScaleStr.Load(_R(IDS_FILLTOOL_NOGRAIN));
08119 }
08120 if (Scale == -1)
08121 {
08122 ScaleStr.Load(_R(IDS_FILLTOOL_MANYGRAIN));
08123 }
08124 if (Scale > 0)
08125 {
08126 camSnprintf(Str, 15, _T("%.1f"), Scale);
08127 ScaleStr = Str;
08128 convert = TRUE;
08129 }
08130
08131 INT32 ScalePos = GetScalePos(Scale);
08132
08133 SetGadgetString(_R(IDC_SELCOLOUR),&ScaleStr);
08134 SetLongGadgetValue(_R(IDC_TRANSPSLIDE), ScalePos);
08135
08136
08137
08138 if (convert)
08139 {
08140 String_64 Str;
08141
08142 Convert::DoubleToString( Scale, &Str, 1 );
08143
08144 Str.MakePercent ((TCHAR*) Str);
08145
08146 String_64 PercentStr(Str);
08147 SetGadgetString(_R(IDC_SELCOLOUR), &PercentStr);
08148 }
08149 else
08150 {
08151
08152 camSnprintf(Str, 15, _T("%.1f"), Scale);
08153 String_8 PercentStr(Str);
08154 SetGadgetString(_R(IDC_SELCOLOUR), &PercentStr);
08155 }
08156 }
08157
08158
08159
08160
08161
08162
08163
08164
08165
08166
08167
08168 double TranspInfoBarOp::FindCommonNoiseScale()
08169 {
08170 if (Selection->Count() == 0)
08171 {
08172 AttrFillGeometry* pCurrentFill = GetCurrentGeometry();
08173
08174 if (pCurrentFill && IS_A(pCurrentFill, AttrNoiseTranspFill))
08175 {
08176 return ((FractalTranspFillAttribute*)pCurrentFill->GetAttributeValue())->GetGraininess().MakeDouble();
08177 }
08178
08179 return 0;
08180 }
08181
08182
08183 AttrFillGeometry* pAttrNode = AttrFillGeometry::FindFirstSelectedAttr(CC_RUNTIME_CLASS(AttrTranspFillGeometry));
08184
08185
08186 if (pAttrNode == NULL)
08187 return 0;
08188
08189 double CommonScale = 0;
08190
08191 while (pAttrNode != NULL)
08192 {
08193 if (pAttrNode->IsKindOf(CC_RUNTIME_CLASS(AttrNoiseTranspFill)))
08194 {
08195 double Scale = ((FractalTranspFillAttribute*)pAttrNode->GetAttributeValue())->GetGraininess().MakeDouble();
08196
08197 if (CommonScale == 0)
08198 CommonScale = Scale;
08199
08200 if (Scale != CommonScale)
08201 {
08202 return -1;
08203 }
08204 }
08205
08206
08207 pAttrNode = AttrFillGeometry::FindNextSelectedAttr(CC_RUNTIME_CLASS(AttrTranspFillGeometry));
08208 }
08209
08210 return CommonScale;
08211 }
08212
08213
08214
08215
08216
08217
08218
08219
08220
08221
08222
08223 void TranspInfoBarOp::ShowControlPointInfo()
08224 {
08225 String_64 PointStr;
08226 INT32 Transp;
08227
08228
08229 ScanSelectionForControlPoints(&PointStr, &Transp);
08230
08231
08232
08233 if (Transp > 255) Transp = 255;
08234 if (Transp < 0) Transp = 0;
08235
08236
08237 if ((Mode != BITMAPFILL &&
08238 Mode != FRACTALFILL &&
08239 Mode != NOISEFILL) || AttrFillGeometry::SelectionCount > 0)
08240 {
08241 SetGadgetString(_R(IDC_SELPOINT), &PointStr);
08242 }
08243
08244
08245 SetLongGadgetValue(_R(IDC_TRANSPSLIDE), Transp);
08246
08247 DisplayTransparencyPercentString ((double) Transp);
08248
08249
08250
08251
08252
08253
08254
08255
08256
08257
08258
08259
08260
08261
08262
08263
08264
08265
08266
08267
08268 }
08269
08270
08271
08272
08273
08274
08275
08276
08277
08278
08279
08280 void TranspInfoBarOp::ScanSelectionForControlPoints(String_64* PointString, INT32* Transp)
08281 {
08282 *PointString = _T("");
08283 *Transp = -1;
08284
08285
08286 AttrFillGeometry* pAttrNode;
08287 UINT32 count = Selection->Count();
08288
08289
08290 if (count == 0)
08291 {
08292 pAttrNode = GetCurrentGeometry();
08293 }
08294 else
08295 {
08296 pAttrNode = AttrFillGeometry::FindFirstSelectedAttr(CC_RUNTIME_CLASS(AttrTranspFillGeometry));
08297 }
08298
08299 AllowForceToSimpleMapping = TRUE;
08300
08301
08302 if (pAttrNode == NULL)
08303 {
08304 (*PointString).Load(_R(IDS_FILLTOOL_NONE));
08305 *Transp = 0;
08306 return;
08307 }
08308
08309 INT32 SelCount = 0;
08310 BOOL CommonTransp = TRUE;
08311 BOOL CommonPoint = TRUE;
08312
08313 BOOL AllFlat = TRUE;
08314 BOOL AnyNeedSimple = FALSE;
08315
08316 while (pAttrNode != NULL)
08317 {
08318 if (AttrFillGeometry::FillSelectionCount() > 0)
08319 {
08320 if (!(pAttrNode->GetRuntimeClass() == CC_RUNTIME_CLASS(AttrFlatTranspFill)))
08321 {
08322
08323 String_64 PointStr = GetSelectedPoint(pAttrNode);
08324 UINT32 HandleTransp = GetSelectedTransp(pAttrNode);
08325
08326 String_64 Str;
08327 Str.Load(_R(IDS_FILLTOOL_NONE));
08328
08329
08330 if (PointStr != Str)
08331 {
08332
08333 *PointString = PointStr;
08334 SelCount++;
08335
08336 if (*PointString == String_64(_T("")))
08337 *PointString = PointStr;
08338
08339 if (*PointString != PointStr)
08340 CommonPoint = FALSE;
08341
08342 if (*Transp == -1)
08343 *Transp = HandleTransp;
08344
08345 if (*Transp != INT32(HandleTransp))
08346 CommonTransp = FALSE;
08347
08348 AllFlat = FALSE;
08349 }
08350 }
08351 }
08352 else
08353 {
08354 if (pAttrNode->GetRuntimeClass() == CC_RUNTIME_CLASS(AttrFlatTranspFill))
08355 {
08356 if ( !((pAttrNode->GetTranspType() == TT_Mix) && ((*pAttrNode->GetStartTransp()) == 0)) )
08357 {
08358 (*PointString).Load(_R(IDS_FILLTOOL_FLATTRANSP));
08359
08360 if (*Transp == -1)
08361 *Transp = *pAttrNode->GetStartTransp();
08362
08363 if (*Transp != INT32(*pAttrNode->GetStartTransp()))
08364 CommonTransp = FALSE;
08365
08366 SelCount++;
08367 }
08368 }
08369 else
08370 {
08371 if (SelCount > 0)
08372 AllFlat = FALSE;
08373 }
08374 }
08375
08376
08377 if (pAttrNode->IsATranspFill() && pAttrNode->NeedsForceToSimpleMapping())
08378 AnyNeedSimple = TRUE;
08379
08380
08381 if (count > 0)
08382 pAttrNode = AttrFillGeometry::FindNextSelectedAttr(CC_RUNTIME_CLASS(AttrTranspFillGeometry));
08383 else
08384 pAttrNode = NULL;
08385 }
08386
08387 if (AnyNeedSimple)
08388 AllowForceToSimpleMapping = FALSE;
08389
08390 if (AttrFillGeometry::FillSelectionCount() == 0 && !AllFlat)
08391 {
08392 (*PointString).Load(_R(IDS_FILLTOOL_MANY));
08393 }
08394
08395 if (SelCount == 0)
08396 {
08397
08398 (*PointString).Load(_R(IDS_FILLTOOL_NONE));
08399 }
08400
08401
08402 if (!CommonPoint)
08403 {
08404
08405 (*PointString).Load(_R(IDS_FILLTOOL_MANY));
08406 }
08407
08408 if (!CommonTransp)
08409 {
08410 *Transp = 0;
08411 }
08412 }
08413
08414
08415
08416
08417
08418
08419
08420
08421
08422
08423
08424
08425
08426
08427 String_64 TranspInfoBarOp::GetSelectedPoint(AttrFillGeometry* pGeometry)
08428 {
08429 String_64 Str;
08430
08431
08432 UINT32 SelCount = pGeometry->GetSelectionCount();
08433
08434
08435 if (SelCount<1)
08436 {
08437 Str.Load(_R(IDS_FILLTOOL_NONE));
08438 return Str;
08439 }
08440
08441
08442 if (SelCount>1)
08443 {
08444 Str.Load(_R(IDS_FILLTOOL_MANY));
08445 return Str;
08446 }
08447
08448
08449 INT32 i = pGeometry->GetFirstSelectedIndex();
08450 if (ISA_RAMPINDEX(i))
08451 {
08452 Str.Load(_R(IDS_FILLTOOL_RAMPTRANSP));
08453 return Str;
08454 }
08455
08456
08457 switch (i)
08458 {
08459 case FILLCONTROL_STARTPOINT:
08460 Str.Load(_R(IDS_FILLTOOL_STARTTRANS));
08461 break;
08462
08463 case FILLCONTROL_ENDPOINT:
08464 case FILLCONTROL_SECONDARYPOINT:
08465 Str.Load(_R(IDS_FILLTOOL_ENDTRANS));
08466 break;
08467
08468 case FILLCONTROL_ENDPOINT2:
08469 Str.Load(_R(IDS_FILLTOOL_ENDTRANS2));
08470 break;
08471
08472 case FILLCONTROL_ENDPOINT3:
08473 Str.Load(_R(IDS_FILLTOOL_ENDTRANS3));
08474 break;
08475
08476 default:
08477 Str.Load(_R(IDS_FILLTOOL_NONE));
08478 break;
08479 }
08480
08481 return Str;
08482 }
08483
08484
08485
08486
08487
08488
08489
08490
08491
08492
08493
08494
08495
08496
08497
08498
08499
08500
08501
08502
08503
08504
08505
08506
08507
08508
08509
08510
08511
08512
08513
08514
08515
08516
08517
08518
08519
08520
08521
08522
08523
08524
08525
08526
08527
08528
08529
08530
08531
08532
08533
08534
08535
08536
08537
08538
08539
08540
08541
08542
08543
08544
08545
08546
08547
08548
08549
08550
08551 UINT32 TranspInfoBarOp::GetSelectedTransp(AttrFillGeometry* pGeometry)
08552 {
08553 UINT32* pStartTransp = pGeometry->GetStartTransp();
08554 if (pStartTransp == NULL)
08555 return 0;
08556
08557 UINT32* pEndTransp = pGeometry->GetEndTransp();
08558 UINT32 SelCount = pGeometry->GetSelectionCount();
08559
08560
08561 if (SelCount<1)
08562 return 0;
08563
08564 if (SelCount>1)
08565 {
08566 if (pEndTransp!=NULL && ((*pStartTransp) != (*pEndTransp)))
08567 return 0;
08568 }
08569
08570
08571 pStartTransp = pGeometry->GetFirstSelectedTransp();
08572 if (pStartTransp)
08573 return (*pStartTransp);
08574
08575 return 0;
08576 }
08577
08578
08579
08580
08581
08582
08583
08584
08585
08586
08587
08588
08589
08590
08591
08592
08593
08594 void TranspInfoBarOp::EnableControls()
08595 {
08596
08597 BOOL allowed = TRUE;
08598
08599 SelRange * pSel = GetApplication()->FindSelection();
08600
08601 Node * pNode = pSel->FindFirst(FALSE);
08602
08603 while (pNode && allowed)
08604 {
08605 if (pNode->IsKindOf(CC_RUNTIME_CLASS(NodeShadow)))
08606 {
08607 allowed = FALSE;
08608 }
08609
08610 pNode = pSel->FindNext(pNode, FALSE);
08611 }
08612
08613 if (Document::GetSelected() == NULL || !allowed)
08614 {
08615 EnableGadget (_R(IDC_GEOMETRY), FALSE);
08616 EnableGadget (_R(IDC_MAPPING), FALSE);
08617 EnableGadget(_R(IDC_TRANSPTYPE), FALSE);
08618 EnableGadget (_R(IDC_BITMAPEFFECT), FALSE);
08619 EnableGadget (_R(IDC_BIASGAIN), FALSE);
08620 EnableGadget (_R(IDC_SELPOINT), FALSE);
08621 EnableGadget (_R(IDC_TRANSPSLIDE), FALSE);
08622 EnableGadget (_R(IDC_SELCOLOUR), FALSE);
08623
08624 }
08625 else
08626 {
08627
08628 EnableGadget (_R(IDC_GEOMETRY), TRUE);
08629 EnableGadget (_R(IDC_TRANSPTYPE), TRUE);
08630 EnableGadget (_R(IDC_TRANSPSLIDE), TRUE);
08631 EnableGadget (_R(IDC_SELCOLOUR), TRUE);
08632
08633 switch (Mode)
08634 {
08635 case NOFILL:
08636
08637 EnableGadget (_R(IDC_MAPPING), FALSE);
08638 EnableGadget (_R(IDC_BITMAPEFFECT), FALSE);
08639 EnableGadget (_R(IDC_BIASGAIN), FALSE);
08640 EnableGadget (_R(IDC_SELPOINT), FALSE);
08641 EnableGadget (_R(IDC_TRANSPSLIDE), TRUE);
08642 EnableGadget (_R(IDC_SELCOLOUR), TRUE);
08643 break;
08644
08645 case MANYFILLS:
08646 case FLATFILL:
08647
08648 EnableGadget (_R(IDC_MAPPING), FALSE);
08649 EnableGadget (_R(IDC_BITMAPEFFECT), FALSE);
08650 EnableGadget (_R(IDC_BIASGAIN), FALSE);
08651 EnableGadget (_R(IDC_SELPOINT), FALSE);
08652
08653 if (Mode == MANYFILLS)
08654 {
08655 EnableGadget (_R(IDC_TRANSPSLIDE), FALSE);
08656 EnableGadget (_R(IDC_SELCOLOUR), FALSE);
08657 }
08658
08659 CloseProfileDialog (m_BiasGainGadget);
08660 break;
08661
08662 case GRADFILL:
08663 case GRADREPEATFILL:
08664 switch (CurrentGeometryIndex)
08665 {
08666 case FGMENU_LINEARTRANSP:
08667 case FGMENU_CIRCULARTRANSP:
08668 case FGMENU_RADIALTRANSP:
08669
08670 case FGMENU_SQUARETRANSP:
08671
08672 EnableGadget (_R(IDC_MAPPING), TRUE);
08673 EnableGadget (_R(IDC_BITMAPEFFECT), FALSE);
08674
08675
08676
08677 EnableGadget (_R(IDC_BIASGAIN), TRUE);
08678
08679
08680
08681
08682
08683
08684 EnableGadget (_R(IDC_SELPOINT), FALSE);
08685 break;
08686
08687 case FGMENU_CONICALTRANSP:
08688 EnableGadget (_R(IDC_MAPPING), FALSE);
08689 EnableGadget (_R(IDC_BITMAPEFFECT), FALSE);
08690
08691
08692
08693 EnableGadget (_R(IDC_BIASGAIN), TRUE);
08694
08695
08696
08697
08698
08699
08700 EnableGadget (_R(IDC_SELPOINT), FALSE);
08701 break;
08702
08703 case FGMENU_THREECOLTRANSP:
08704 case FGMENU_FOURCOLTRANSP:
08705 EnableGadget (_R(IDC_MAPPING), TRUE);
08706 EnableGadget (_R(IDC_BITMAPEFFECT), FALSE);
08707 EnableGadget (_R(IDC_BIASGAIN), FALSE);
08708 EnableGadget (_R(IDC_SELPOINT), FALSE);
08709 break;
08710 }
08711 break;
08712
08713 case BITMAPFILL:
08714 EnableGadget (_R(IDC_MAPPING), TRUE);
08715 EnableGadget (_R(IDC_BITMAPEFFECT), TRUE);
08716
08717 if (AttrFillGeometry::SelectionCount == 0)
08718 {
08719 EnableGadget (_R(IDC_TRANSPSLIDE), FALSE);
08720 EnableGadget (_R(IDC_SELCOLOUR), FALSE);
08721 }
08722
08723
08724
08725
08726
08727
08728
08729 EnableGadget (_R(IDC_BIASGAIN), TRUE);
08730
08731
08732
08733
08734 if (GetGadgetWritable (_R(IDC_SELPOINT)))
08735 {
08736 EnableGadget (_R(IDC_SELPOINT), FALSE);
08737 }
08738 else
08739 {
08740 EnableGadget (_R(IDC_SELPOINT), TRUE);
08741 }
08742 break;
08743
08744 case FRACTALFILL:
08745 case NOISEFILL:
08746 EnableGadget (_R(IDC_MAPPING), TRUE);
08747 EnableGadget (_R(IDC_BITMAPEFFECT), FALSE);
08748
08749
08750
08751
08752
08753
08754
08755 EnableGadget (_R(IDC_BIASGAIN), TRUE);
08756
08757
08758 if (GetGadgetWritable (_R(IDC_SELPOINT)))
08759 {
08760 EnableGadget (_R(IDC_SELPOINT), FALSE);
08761 }
08762 else
08763 {
08764 EnableGadget (_R(IDC_SELPOINT), TRUE);
08765 }
08766
08767
08768
08769
08770
08771
08772
08773
08774
08775 break;
08776
08777 default:
08778 break;
08779 }
08780
08781
08782
08783
08784
08785
08786
08787
08788
08789
08790
08791
08792
08793
08794
08795
08796
08797
08798
08799
08800
08801
08802
08803
08804
08805
08806
08807
08808
08809
08810
08811
08812
08813
08814
08815
08816
08817
08818
08819
08820
08821
08822
08823
08824
08825
08826
08827 }
08828
08829 }
08830
08831
08832
08833
08834
08835
08836
08837
08838
08839
08840
08841 void TranspInfoBarOp::SetTranspValue(UINT32 Transp, BOOL bIntermediateStep, BOOL bFirstStep)
08842 {
08843
08844
08845
08846
08847
08848
08849
08850
08851
08852
08853
08854
08855
08856
08857
08858
08859 if (bFirstStep)
08860 {
08861
08862
08863 ERROR3IF(m_pAttrApplyOp!=NULL, "Why do we have a drag op already?\n");
08864 if (m_pAttrApplyOp==NULL)
08865 {
08866 m_pDragTransp = new AttrTranspChange;
08867 if (m_pDragTransp == NULL)
08868 return;
08869
08870 m_pDragTransp->SetStartTransp(&Transp);
08871
08872 m_pAttrApplyOp = new OpApplyAttrInteractive;
08873 m_pAttrApplyOp->DoDragAttr(m_pDragTransp);
08874 ERROR3IF(m_pAttrApplyOp!=Operation::GetCurrentDragOp(),
08875 "DoDragAttr should have set itself as the current drag op");
08876 }
08877 }
08878 else if (bIntermediateStep)
08879 {
08880
08881
08882 m_pDragTransp->SetStartTransp(&Transp);
08883
08884 ERROR3IF(m_pAttrApplyOp==NULL, "Why don't we have a drag op yet?\n");
08885 if (m_pAttrApplyOp && m_pAttrApplyOp==Operation::GetCurrentDragOp())
08886 m_pAttrApplyOp->DragAttrChanged(m_pDragTransp);
08887
08888 }
08889 else
08890 {
08891
08892
08893 if (m_pAttrApplyOp==NULL)
08894 {
08895 m_pDragTransp = new AttrTranspChange;
08896 if (m_pDragTransp == NULL)
08897 return;
08898
08899 m_pDragTransp->SetStartTransp(&Transp);
08900
08901 m_pAttrApplyOp = new OpApplyAttrInteractive;
08902 m_pAttrApplyOp->DoDragAttr(m_pDragTransp);
08903 }
08904
08905 m_pDragTransp->SetStartTransp(&Transp);
08906
08907 ERROR3IF(m_pAttrApplyOp==NULL, "Why don't we have a drag op yet?\n");
08908 if (m_pAttrApplyOp)
08909 if (m_pAttrApplyOp==Operation::GetCurrentDragOp())
08910 {
08911 m_pAttrApplyOp->DragAttrFinished(m_pDragTransp);
08912
08913
08914
08915 m_pAttrApplyOp = NULL;
08916 }
08917 else
08918 {
08919
08920
08921 ShowInfo();
08922 m_pAttrApplyOp = NULL;
08923 }
08924
08925 if (m_pDragTransp)
08926 {
08927 delete m_pDragTransp;
08928 m_pDragTransp = NULL;
08929 }
08930 }
08931 }
08932
08933
08934
08935
08936
08937
08938
08939
08940
08941
08942
08943
08944
08945
08946
08947
08948
08949
08950
08951
08952
08953
08954
08955
08956
08957
08958
08959
08960
08961
08962
08963
08964
08965
08966
08967
08968
08969
08970
08971
08972
08973
08974
08975
08976
08977
08978
08979
08980
08981
08982
08983
08984
08985
08986
08987
08988
08989
08990
08991
08992
08993
08994
08995
08996
08997
08998
08999
09000
09001
09002 void TranspInfoBarOp::ChangeFillType()
09003 {
09004 if (CurrentGeometryIndex == FGMENU_NOTRANSP)
09005 {
09006 AttrFillGeometry* NoTransp = new AttrRemoveTransp;
09007 if (NoTransp == NULL)
09008
09009 {
09010 InformError();
09011 return;
09012 }
09013
09014 AttributeManager::AttributeSelected(NULL, NoTransp);
09015 }
09016 else if (CurrentGeometryIndex == FGMENU_FLATTRANSP)
09017 {
09018 AttrFillGeometry* FlatTransp = new AttrMakeFlatTransp;
09019 if (FlatTransp == NULL)
09020 {
09021 InformError();
09022 return;
09023 }
09024
09025 AttributeManager::AttributeSelected(NULL, FlatTransp);
09026 }
09027 else
09028 {
09029
09030
09031 AttrFillGeometry* Mutator = MakeFillMutator();
09032 if (Mutator == NULL)
09033 {
09034 InformError();
09035 return;
09036 }
09037
09038
09039
09040
09041
09042
09043
09044 AttributeManager::AttributeSelected(NULL, Mutator);
09045 Mutator = NULL;
09046
09047
09048
09049
09050
09051
09052
09053 }
09054
09055 if (CurrentGeometryIndex != FGMENU_NOTRANSP)
09056 UpdateBrushAttributes();
09057 }
09058
09059
09060
09061
09062
09063
09064
09065
09066
09067
09068
09069 void TranspInfoBarOp::ChangeFillMapping()
09070 {
09071 if (Mode != BITMAPFILL &&
09072 Mode != FRACTALFILL &&
09073 Mode != GRADREPEATFILL &&
09074
09075 #ifdef NEW_FEATURES
09076 Mode != GRADFILL &&
09077 #endif
09078 Mode != NOISEFILL)
09079 {
09080 return;
09081 }
09082
09083 INT32 Tesselation;
09084
09085 switch (CurrentMappingIndex)
09086 {
09087 case (FTMENU_SIMPLE):
09088 Tesselation = 1;
09089 break;
09090
09091 case (FTMENU_REPEAT):
09092
09093 #ifdef NEW_FEATURES
09094 if(Mode == GRADFILL)
09095 {
09096 Tesselation = 4;
09097 }
09098 else
09099 #endif
09100 {
09101 Tesselation = 2;
09102 }
09103 break;
09104
09105 case (FTMENU_REPEATINV):
09106 Tesselation = 3;
09107 break;
09108
09109 default:
09110 Tesselation = 1;
09111 break;
09112 }
09113
09114 AttrTranspFillMappingLinear* NewMapping = new AttrTranspFillMappingLinear;
09115 if (NewMapping == NULL)
09116 {
09117 InformError();
09118 return;
09119 }
09120
09121 NewMapping->SetRepeat(Tesselation);
09122 AttributeManager::AttributeSelected(NewMapping, NULL);
09123 }
09124
09125
09126
09127
09128
09129
09130
09131
09132
09133
09134
09135
09136
09137
09138 void TranspInfoBarOp::UpdateBrushAttributes()
09139 {
09140 List BrushList;
09141
09142 FillTools::GetSelectedAttrList(&BrushList, CC_RUNTIME_CLASS(AttrBrushType), FALSE, FALSE);
09143
09144 NodeListItem* pItem = (NodeListItem*)BrushList.GetHead();
09145 AttrBrushType* pAttrBrush = NULL;
09146 while (pItem != NULL)
09147 {
09148 pAttrBrush = (AttrBrushType*)(pItem->pNode);
09149 if (pAttrBrush != NULL)
09150 pAttrBrush->SetUseLocalTransp(TRUE);
09151
09152 pItem = (NodeListItem*)BrushList.GetNext(pItem);
09153 }
09154
09155 BrushList.DeleteAll();
09156 }
09157
09158
09159
09160
09161
09162
09163
09164
09165
09166
09167
09168 BOOL TranspInfoBarOp::ChangeBitmapName()
09169 {
09170 NodeAttribute *Attrib = new AttrBitmapTranspFill;
09171 if (Attrib == NULL)
09172 {
09173 InformError();
09174 return (FALSE);
09175 }
09176
09177 Document* pDoc = Document::GetSelected();
09178
09179
09180 BitmapList* Bitmaps = NULL;
09181 if (pDoc) Bitmaps = pDoc->GetBitmapList();
09182
09183 if (Bitmaps == NULL)
09184 return (FALSE);
09185
09186 INT32 BmpIndex = -1;
09187 ListItem* pBmp = Bitmaps->GetHead();
09188
09189 while (pBmp != NULL)
09190 {
09191 if (!((KernelBitmap*)pBmp)->HasBeenDeleted())
09192 BmpIndex++;
09193
09194 if (BmpIndex == CurrentBitmapIndex)
09195 break;
09196
09197 pBmp = Bitmaps->GetNext(pBmp);
09198 }
09199
09200 KernelBitmap* pkBmp = (KernelBitmap*) pBmp;
09201
09202
09203
09204
09205 if (pkBmp->ActualBitmap->GetBitmapInfoHeader()->biBitCount == 32)
09206 {
09207
09208
09209
09210
09211 String_256 QueryString(_R(IDS_QUERYTRANSP321));
09212
09213
09214 Error::SetError(0, QueryString, 0);
09215 INT32 DlgResult = InformMessage(FALSE, _R(IDS_YES), _R(IDS_NO));
09216 Error::ClearError();
09217
09218 switch (DlgResult)
09219 {
09220 case 1:
09221
09222 break;
09223 case 2:
09224 delete (Attrib);
09225 Attrib = NULL;
09226 return (FALSE);
09227 }
09228 }
09229
09230 ((AttrBitmapChange*)Attrib)->AttachBitmap((KernelBitmap*)pBmp);
09231 AttributeManager::AttributeSelected(NULL, Attrib);
09232
09233 return (TRUE);
09234 }
09235
09236
09237
09238
09239
09240
09241
09242
09243
09244
09245
09246 void TranspInfoBarOp::ChangeTranspType()
09247 {
09248
09249
09250 AttrFillGeometry* TypeChange = new AttrTranspTypeChange();
09251
09252
09253
09254
09255 if (TypeChange == NULL)
09256 {
09257 InformError();
09258 return;
09259 }
09260
09261 UINT32 TType = GetTranspType() - 1;
09262 UINT32 Index = 0;
09263
09264 switch(TType)
09265 {
09266 case FTMENU_REFLECT:
09267 case FTMENU_SUB:
09268 case FTMENU_ADD:
09269 {
09270 Index = TType + TT_Mix;
09271 break;
09272 }
09273 case FTMENU_CON:
09274 {
09275 Index = TT_CONTRAST;
09276 break;
09277 }
09278 case FTMENU_SAT:
09279 {
09280 Index = TT_SATURATION;
09281 break;
09282 }
09283 case FTMENU_DARK:
09284 {
09285 Index = TT_DARKEN;
09286 break;
09287 }
09288 case FTMENU_LIGHT:
09289 {
09290 Index = TT_LIGHTEN;
09291 break;
09292 }
09293 case FTMENU_BRI:
09294 {
09295 Index = TT_BRIGHTNESS;
09296 break;
09297 }
09298 case FTMENU_LUM:
09299 {
09300 Index = TT_LUMINOSITY;
09301 break;
09302 }
09303 case FTMENU_HUE:
09304 {
09305 Index = TT_HUE;
09306 break;
09307 }
09308 default:
09309 {
09310 Index = TT_NoTranspType;
09311 }
09312 }
09313
09314 TypeChange->SetTranspType(Index);
09315
09316
09317
09318
09319 AttributeManager::AttributeSelected(NULL, TypeChange);
09320
09321
09322
09323
09324
09325
09326
09327
09328
09329
09330
09331
09332
09333
09334
09335 }
09336
09337
09338
09339
09340
09341
09342
09343
09344
09345
09346
09347
09348 void TranspInfoBarOp::ChangeDPI()
09349 {
09350 BOOL Valid;
09351 String_256 Str = GetStringGadgetValue(_R(IDC_SELPOINT), &Valid);
09352
09353 if (Valid)
09354 {
09355 TRACEUSER( "Will", _T("String = %s\n"),(TCHAR*)Str);
09356
09357 INT32 Length = Str.Length();
09358 TCHAR* StrText = (TCHAR*)Str;
09359
09360 INT32 FirstNum = -1;
09361 INT32 Count = 0;
09362
09363 for (INT32 i = 0; i < Length; ++i)
09364 {
09365 TCHAR chr = StrText[i];
09366 if (FirstNum == -1 && StringBase::IsNumeric(chr))
09367 FirstNum = i;
09368
09369 if (FirstNum != -1)
09370 {
09371 if (StringBase::IsNumeric(chr))
09372 Count++;
09373 else
09374 break;
09375 }
09376 }
09377
09378 String_256 DpiStr;
09379 INT32 Dpi;
09380
09381 if (FirstNum != -1 && Count > 0)
09382 {
09383 Str.Mid(&DpiStr, FirstNum, Count);
09384 Convert::StringToLong(DpiStr, &Dpi);
09385 TRACEUSER( "Will", _T("Dpi = %d\n"),Dpi);
09386
09387 if (Dpi == 0)
09388 Dpi = 1;
09389
09390 AttrValueChange* NewDpi = new AttrBitmapDpiChange;
09391 if (NewDpi == NULL)
09392 {
09393 InformError();
09394 return;
09395 }
09396
09397 NewDpi->MutateTranspFills(TRUE);
09398 ((AttrBitmapDpiChange*)NewDpi)->SetDPI(Dpi);
09399
09400 AttributeManager::AttributeSelected(NULL, NewDpi);
09401 }
09402 else
09403 {
09404 TRACEUSER( "Will", _T("That was rubbish\n"));
09405 ShowCommonBitmapDpi();
09406 }
09407 }
09408 else
09409 TRACEUSER( "Will", _T("String was invalid\n"));
09410 }
09411
09412
09413
09414
09415
09416
09417
09418
09419
09420
09421
09422 void TranspInfoBarOp::ChangeTransparencyValue()
09423 {
09424 BOOL Valid;
09425 String_256 Str = GetStringGadgetValue(_R(IDC_SELCOLOUR), &Valid);
09426
09427 if (Valid)
09428 {
09429 INT32 Length = Str.Length();
09430 TCHAR* StrText = (TCHAR*)Str;
09431
09432 INT32 FirstNum = -1;
09433 INT32 Count = 0;
09434
09435 BOOL FoundDp = FALSE;
09436
09437 for (INT32 i = 0; i < Length; ++i)
09438 {
09439 TCHAR chr = StrText[i];
09440 if (FirstNum == -1 && StringBase::IsNumeric(chr))
09441 FirstNum = i;
09442
09443 if (FirstNum != -1)
09444 {
09445 if (StringBase::IsNumeric(chr))
09446 {
09447 Count++;
09448
09449
09450 }
09451 else if ((chr == '.') && (FoundDp == FALSE))
09452 {
09453 FoundDp = TRUE;
09454 Count++;
09455 }
09456 else
09457 break;
09458 }
09459 }
09460
09461 String_256 TranspValStr;
09462 double TranspVal;
09463
09464 if (FirstNum != -1 && Count > 0)
09465 {
09466 Str.Mid(&TranspValStr, FirstNum, Count);
09467 Convert::StringToDouble(TranspValStr, &TranspVal);
09468
09469
09470
09471 if (TranspVal < 0.0) { TranspVal = 0.0; }
09472 if (TranspVal > 100.0) { TranspVal = 100.0; }
09473
09474
09475
09476 UINT32 Rounded = (UINT32) TranspVal;
09477 double Diff = TranspVal - Rounded;
09478
09479 if (Diff < 0.5)
09480 {
09481 if (Diff < 0.25) { TranspVal = (double) Rounded; }
09482 else { TranspVal = (double) Rounded + 0.5; }
09483 }
09484 else
09485 {
09486 if (Diff < 0.75) { TranspVal = (double) Rounded + 0.5; }
09487 else { TranspVal = (double) ++Rounded; }
09488 }
09489
09490 double AccurateNewVal = ((TranspVal * (double) SliderMax) / 100.0) + 0.5;
09491
09492 SetTranspValue (static_cast<UINT32>(AccurateNewVal));
09493 }
09494 else
09495 {
09496 ShowControlPointInfo ();
09497 }
09498 }
09499 }
09500
09501
09502
09503
09504
09505
09506
09507
09508
09509
09510
09511 void TranspInfoBarOp::ChangeFractalGrain (BOOL useEditbox )
09512 {
09513 if (!useEditbox)
09514 {
09515 BOOL Valid;
09516 INT32 Result = GetLongGadgetValue(_R(IDC_TRANSPSLIDE), 0, SliderMax, 0, &Valid);
09517
09518 if (Valid)
09519 {
09520 double Grain = GetDoubleGrain(Result);
09521
09522 TRACEUSER( "Will", _T("Graininess = %f\n"),Grain);
09523
09524 if (Grain < 0.1)
09525 Grain = 0.1;
09526
09527 if (Grain > 16384)
09528 Grain = 16384;
09529
09530 AttrValueChange* NewGrain = new AttrFractalGrainChange;
09531 if (NewGrain == NULL)
09532 {
09533 InformError();
09534 return;
09535 }
09536
09537 NewGrain->MutateTranspFills(TRUE);
09538 ((FractalFillAttribute*)NewGrain->GetAttributeValue())->Graininess = FIXED16(Grain);
09539
09540 AttributeManager::AttributeSelected(NULL, NewGrain);
09541 }
09542 }
09543 else
09544 {
09545 BOOL Valid;
09546 String_256 Str = GetStringGadgetValue(_R(IDC_SELCOLOUR), &Valid);
09547
09548 if (Valid)
09549 {
09550 INT32 Length = Str.Length();
09551 TCHAR* StrText = (TCHAR*)Str;
09552
09553 INT32 FirstNum = -1;
09554 INT32 Count = 0;
09555
09556 BOOL FoundDp = FALSE;
09557
09558 for (INT32 i = 0; i < Length; ++i)
09559 {
09560 TCHAR chr = StrText[i];
09561 if (FirstNum == -1 && StringBase::IsNumeric(chr))
09562 FirstNum = i;
09563
09564 if (FirstNum != -1)
09565 {
09566 if (StringBase::IsNumeric(chr))
09567 {
09568 Count++;
09569
09570
09571 }
09572 else if ((chr == '.') && (FoundDp == FALSE))
09573 {
09574 FoundDp = TRUE;
09575 Count++;
09576 }
09577 else
09578 break;
09579 }
09580 }
09581
09582 String_256 TranspValStr;
09583 double TranspVal;
09584
09585 if (FirstNum != -1 && Count > 0)
09586 {
09587 Str.Mid(&TranspValStr, FirstNum, Count);
09588 Convert::StringToDouble(TranspValStr, &TranspVal);
09589
09590
09591
09592 if (TranspVal < 0.0) { TranspVal = 0.0; }
09593 if (TranspVal > 128.0) { TranspVal = 128.0; }
09594
09595
09596
09597 UINT32 Rounded = (UINT32) TranspVal;
09598 double Diff = TranspVal - Rounded;
09599
09600 if (Diff < 0.5)
09601 {
09602 if (Diff < 0.25) { TranspVal = (double) Rounded; }
09603 else { TranspVal = (double) Rounded + 0.5; }
09604 }
09605 else
09606 {
09607 if (Diff < 0.75) { TranspVal = (double) Rounded + 0.5; }
09608 else { TranspVal = (double) ++Rounded; }
09609 }
09610
09611
09612
09613
09614
09615
09616 AttrValueChange* NewGrain = new AttrFractalGrainChange;
09617 if (NewGrain == NULL)
09618 {
09619 InformError();
09620 return;
09621 }
09622
09623 NewGrain->MutateTranspFills(TRUE);
09624 ((FractalFillAttribute*)NewGrain->GetAttributeValue())->Graininess = FIXED16( TranspVal);
09625
09626 AttributeManager::AttributeSelected(NULL, NewGrain);
09627 }
09628 else
09629 {
09630 ShowFractalInfo ();
09631 }
09632 }
09633 }
09634 }
09635
09636
09637
09638
09639
09640
09641
09642
09643
09644
09645
09646 void TranspInfoBarOp::ChangeNoiseScale (BOOL useEditbox )
09647 {
09648 if (!useEditbox)
09649 {
09650 BOOL Valid;
09651 INT32 Result = GetLongGadgetValue(_R(IDC_TRANSPSLIDE), 0, SliderMax, 0, &Valid);
09652
09653 if (Valid)
09654 {
09655 double Scale = GetDoubleScale(Result);
09656
09657 TRACEUSER( "Mike", _T("Scale = %f\n"),Scale);
09658
09659 if (Scale < 0)
09660 Scale = 0;
09661
09662 if (Scale > 100)
09663 Scale = 100;
09664
09665 AttrValueChange* NewScale = new AttrNoiseScaleChange;
09666 if (NewScale == NULL)
09667 {
09668 InformError();
09669 return;
09670 }
09671
09672 FIXED16 Grain = FIXED16(Scale);
09673 NewScale->MutateTranspFills(TRUE);
09674 ((NoiseFillAttribute*)NewScale->GetAttributeValue())->SetGraininess(Grain);
09675
09676 AttributeManager::AttributeSelected(NULL, NewScale);
09677 }
09678 }
09679 else
09680 {
09681 BOOL Valid;
09682 String_256 Str = GetStringGadgetValue(_R(IDC_SELCOLOUR), &Valid);
09683
09684 if (Valid)
09685 {
09686 INT32 Length = Str.Length();
09687 TCHAR* StrText = (TCHAR*)Str;
09688
09689 INT32 FirstNum = -1;
09690 INT32 Count = 0;
09691
09692 BOOL FoundDp = FALSE;
09693
09694 for (INT32 i = 0; i < Length; ++i)
09695 {
09696 TCHAR chr = StrText[i];
09697 if (FirstNum == -1 && StringBase::IsNumeric(chr))
09698 FirstNum = i;
09699
09700 if (FirstNum != -1)
09701 {
09702 if (StringBase::IsNumeric(chr))
09703 {
09704 Count++;
09705
09706
09707 }
09708 else if ((chr == '.') && (FoundDp == FALSE))
09709 {
09710 FoundDp = TRUE;
09711 Count++;
09712 }
09713 else
09714 break;
09715 }
09716 }
09717
09718 String_256 TranspValStr;
09719 double TranspVal;
09720
09721 if (FirstNum != -1 && Count > 0)
09722 {
09723 Str.Mid(&TranspValStr, FirstNum, Count);
09724 Convert::StringToDouble(TranspValStr, &TranspVal);
09725
09726
09727
09728 if (TranspVal < 0.0) { TranspVal = 0.0; }
09729 if (TranspVal > 100.0) { TranspVal = 100.0; }
09730
09731
09732
09733 UINT32 Rounded = (UINT32) TranspVal;
09734 double Diff = TranspVal - Rounded;
09735
09736 if (Diff < 0.5)
09737 {
09738 if (Diff < 0.25) { TranspVal = (double) Rounded; }
09739 else { TranspVal = (double) Rounded + 0.5; }
09740 }
09741 else
09742 {
09743 if (Diff < 0.75) { TranspVal = (double) Rounded + 0.5; }
09744 else { TranspVal = (double) ++Rounded; }
09745 }
09746
09747 double AccurateNewVal = ((TranspVal * (double) SliderMax) / 100.0) + 0.5;
09748
09749 UINT32 newVal = static_cast<UINT32>(AccurateNewVal);
09750
09751
09752
09753 AttrValueChange* NewScale = new AttrNoiseScaleChange;
09754 if (NewScale == NULL)
09755 {
09756 InformError();
09757 return;
09758 }
09759
09760 FIXED16 Grain = FIXED16((INT32) newVal);
09761 NewScale->MutateTranspFills(TRUE);
09762 ((NoiseFillAttribute*)NewScale->GetAttributeValue())->SetGraininess(Grain);
09763
09764 AttributeManager::AttributeSelected(NULL, NewScale);
09765 }
09766 else
09767 {
09768 ShowNoiseInfo ();
09769 }
09770 }
09771 }
09772 }
09773
09774
09775
09776
09777
09778
09779
09780
09781
09782
09783
09784
09785
09786 AttrFillGeometry* TranspInfoBarOp::MakeFillMutator()
09787 {
09788 AttrFillGeometry* Fill = NULL;
09789 KernelBitmap* Default;
09790
09791 switch (CurrentGeometryIndex)
09792 {
09793 case (FGMENU_FLATTRANSP):
09794 Fill = new AttrFlatTranspFill;
09795 break;
09796
09797 case (FGMENU_LINEARTRANSP):
09798 Fill = new AttrLinearTranspFill;
09799 break;
09800
09801 case (FGMENU_RADIALTRANSP):
09802 Fill = new AttrRadialTranspFill;
09803 if (Fill != NULL)
09804 ((AttrRadialFill*)Fill)->MakeElliptical();
09805 break;
09806
09807 case (FGMENU_CIRCULARTRANSP):
09808 Fill = new AttrRadialTranspFill;
09809 if (Fill != NULL)
09810 ((AttrRadialFill*)Fill)->MakeCircular();
09811 break;
09812
09813 case (FGMENU_CONICALTRANSP):
09814 Fill = new AttrConicalTranspFill;
09815 break;
09816
09817 case (FGMENU_SQUARETRANSP):
09818 Fill = new AttrSquareTranspFill;
09819 break;
09820
09821 case (FGMENU_THREECOLTRANSP):
09822 Fill = new AttrThreeColTranspFill;
09823 CloseProfileDialog (m_BiasGainGadget);
09824 break;
09825
09826 case (FGMENU_FOURCOLTRANSP):
09827 Fill = new AttrFourColTranspFill;
09828 CloseProfileDialog (m_BiasGainGadget);
09829 break;
09830
09831 case (FGMENU_BITMAPTRANSP):
09832 Fill = new AttrBitmapTranspFill;
09833
09834 Default = KernelBitmap::MakeKernelBitmap();
09835 if (Default == NULL)
09836 {
09837 delete Fill;
09838 return NULL;
09839 }
09840
09841 Fill->AttachBitmap(Default);
09842 break;
09843
09844 case (FGMENU_FRACTALTRANSP):
09845 Fill = new AttrFractalTranspFill;
09846 break;
09847
09848 case (FGMENU_NOISETRANSP):
09849 Fill = new AttrNoiseTranspFill;
09850 break;
09851
09852 default:
09853
09854 Fill = new AttrFlatTranspFill;
09855 break;
09856 }
09857
09858 return Fill;
09859 }
09860
09861
09862
09863
09864
09865
09866
09867
09868
09869
09870
09871 AttrFillGeometry* TranspInfoBarOp::GetCurrentGeometry()
09872 {
09873 CCRuntimeClass* CurrentAttribGroup =
09874 Tool::GetCurrent()->Parent->m_ToolInfo.CurrentAttributeGroup;
09875
09876 Document* CurrentDoc = Document::GetSelected();
09877
09878 if (CurrentDoc == NULL)
09879 return NULL;
09880
09881 return (AttrFillGeometry*)CurrentDoc->GetAttributeMgr()
09882 .GetCurrentAttribute(CurrentAttribGroup,
09883 CC_RUNTIME_CLASS(AttrTranspFillGeometry));
09884 }
09885
09886
09887
09888
09889
09890
09891
09892
09893
09894
09895
09896
09897
09898
09899
09900
09901
09902
09903
09904
09905
09906
09907
09908
09909
09910
09911
09912
09913
09914
09915
09916
09917
09918
09919
09920
09921
09922 AttrTranspFillMapping* TranspInfoBarOp::GetCurrentMapping()
09923 {
09924 CCRuntimeClass* CurrentAttribGroup =
09925 Tool::GetCurrent()->Parent->m_ToolInfo.CurrentAttributeGroup;
09926
09927 Document* CurrentDoc = Document::GetSelected();
09928
09929 if (CurrentDoc == NULL)
09930 return NULL;
09931
09932 return (AttrTranspFillMapping*)CurrentDoc->GetAttributeMgr()
09933 .GetCurrentAttribute(CurrentAttribGroup,
09934 CC_RUNTIME_CLASS(AttrTranspFillMapping));
09935 }
09936
09937 double GetDoubleGrain(INT32 Pos)
09938 {
09939 return ( 128.0 * double(Pos)/double(GetGrainPosMax()) );
09940 }
09941
09942 INT32 GetGrainPos(double Grain)
09943 {
09944 return INT32(Grain * double(GetGrainPosMax()) / 128.0 );
09945 }
09946
09947 INT32 GetGrainPosMax()
09948 {
09949 return (1<<16);
09950 }
09951
09952 double GetDoubleScale(INT32 Pos)
09953 {
09954 return ( 100.0 * double(Pos)/double(GetScalePosMax()) );
09955 }
09956
09957 INT32 GetScalePos(double Scale)
09958 {
09959 return INT32(Scale * double(GetScalePosMax()) / 100.0 );
09960 }
09961
09962 INT32 GetScalePosMax()
09963 {
09964 return (100);
09965 }
09966
09967
09968
09969
09970
09971
09972
09973
09974
09975
09976
09977
09978
09979
09980
09981 AttrFillGeometry* AttrRemoveTransp::MutateFill(AttrFillGeometry* FillToMutate)
09982 {
09983 AttrFillGeometry* NewFill = new AttrFlatTranspFill;
09984 if (NewFill == NULL)
09985 return NULL;
09986
09987 UINT32 TypeNone = TT_Mix;
09988 UINT32 NoTransp = 0;
09989
09990 NewFill->SetTranspType(TypeNone);
09991 NewFill->SetStartTransp(&NoTransp);
09992
09993 if (GetApplication()->GetBlobManager()->GetCurrentInterest().Fill &&
09994 FillToMutate->IsVisible() &&
09995 FillToMutate->FindParent() &&
09996 FillToMutate->FindParent()->IsSelected())
09997 {
09998 FillToMutate->RenderFillBlobs();
09999 }
10000
10001
10002 return NewFill;
10003 }
10004
10005
10006
10007
10008
10009
10010
10011
10012
10013
10014
10015
10016
10017
10018 NodeAttribute* AttrRemoveTransp::GetOtherAttrToApply(BOOL* IsMutate)
10019 {
10020 ERROR3IF(IsMutate == NULL, "NULL flag pointer passed to GetOtherAttrToApply");
10021
10022
10023 NodeAttribute* OtherAttr = new AttrRemoveStrokeTransp;
10024 if (OtherAttr == NULL)
10025 return NULL;
10026
10027 *IsMutate = TRUE;
10028
10029 return OtherAttr;
10030 }
10031
10032
10033
10034
10035
10036
10037
10038
10039
10040
10041
10042
10043 AttrFillGeometry* AttrRemoveStrokeTransp::MutateFill(AttrFillGeometry* FillToMutate)
10044 {
10045 AttrFillGeometry* NewFill = new AttrStrokeTransp;
10046 if (NewFill == NULL)
10047 return NULL;
10048
10049 UINT32 TypeNone = TT_Mix;
10050 UINT32 NoTransp = 0;
10051
10052 NewFill->SetTranspType(TypeNone);
10053 NewFill->SetStartTransp(&NoTransp);
10054
10055
10056 return NewFill;
10057 }
10058
10059
10060
10061
10062
10063
10064
10065
10066
10067
10068
10069
10070 AttrFillGeometry* AttrMakeFlatTransp::MutateFill(AttrFillGeometry* FillToMutate)
10071 {
10072 AttrFillGeometry* NewFill = new AttrFlatTranspFill;
10073 if (NewFill == NULL)
10074 return NULL;
10075
10076 UINT32 Transp = *FillToMutate->GetStartTransp();
10077
10078 if (FillToMutate->GetTranspType() == TT_Mix &&
10079 *FillToMutate->GetStartTransp() == 0)
10080 {
10081 Transp = 128;
10082 }
10083
10084 NewFill->SetTranspType(FillToMutate->GetTranspType());
10085 NewFill->SetStartTransp(&Transp);
10086
10087
10088
10089
10090
10091
10092
10093
10094
10095
10096 if (GetApplication()->GetBlobManager()->GetCurrentInterest().Fill &&
10097 FillToMutate->IsVisible() &&
10098 FillToMutate->FindParent() &&
10099 FillToMutate->FindParent()->IsSelected())
10100 {
10101 FillToMutate->RenderFillBlobs();
10102 }
10103
10104
10105 return NewFill;
10106 }
10107
10108
10109
10110
10111
10112
10113
10114
10115
10116
10117
10118
10119
10120
10121 NodeAttribute* AttrMakeFlatTransp::GetOtherAttrToApply(BOOL* IsMutate)
10122 {
10123 ERROR3IF(IsMutate == NULL, "NULL flag pointer passed to GetOtherAttrToApply");
10124
10125
10126 NodeAttribute* OtherAttr = new AttrStrokeTranspChange;
10127 if (OtherAttr == NULL)
10128 return NULL;
10129
10130 UINT32 Transp = 128;
10131
10132 ((AttrStrokeTranspChange *)OtherAttr)->SetStartTransp(&Transp);
10133
10134 *IsMutate = TRUE;
10135
10136 return OtherAttr;
10137 }
10138
10139
10140
10143
10144
10145
10148
10149
10150
10151
10152
10153
10154
10155
10156
10157
10158
10159
10160
10161
10162 OpChangeFillProfile::OpChangeFillProfile()
10163 {
10164 }
10165
10166
10167
10168
10169
10170
10171
10172
10173
10174
10175
10176
10177
10178
10179 OpChangeFillProfile::~OpChangeFillProfile()
10180 {
10181 }
10182
10183
10184
10185
10186
10187
10188
10189
10190
10191
10192
10193
10194
10195
10196 BOOL OpChangeFillProfile::Declare()
10197 {
10198 return (RegisterOpDescriptor(
10199 0,
10200 _R(IDS_FILLPROFILE),
10201 CC_RUNTIME_CLASS(OpChangeFillProfile),
10202 OPTOKEN_FILLPROFILE,
10203 OpChangeFillProfile::GetState));
10204 }
10205
10206
10207
10208
10209
10210
10211
10212
10213
10214
10215
10216
10217
10218
10219 void OpChangeFillProfile::DoWithParam(OpDescriptor* pOp, OpParam* pParam)
10220 {
10221
10222
10223 DoStartSelOp(TRUE);
10224
10225
10226 CProfileBiasGain Profile;
10227
10228
10229 FillProfileOpParam * pProfileParam = (FillProfileOpParam *)pParam;
10230
10231 List ShadowList;
10232
10233
10234 FillTools::GetSelectedAttrList(&ShadowList, CC_RUNTIME_CLASS(AttrFillGeometry), TRUE, FALSE);
10235
10236 NodeListItem * pItem = (NodeListItem *)ShadowList.GetHead();
10237
10238 CProfileBiasGain OldGain;
10239
10240 while (pItem)
10241 {
10242 if (pItem->pNode)
10243 {
10244
10245 ChangeFillProfileAction * pAction;
10246
10247 ChangeFillProfileAction::Init(this, GetUndoActionList(), (AttrFillGeometry *)pItem->pNode, pProfileParam->Profile,
10248 &pAction);
10249
10250
10251
10252 ObjChangeFlags cFlags;
10253 cFlags.Attribute = TRUE;
10254
10255 ObjChangeParam ObjChange(OBJCHANGE_STARTING,cFlags,NULL,NULL);
10256
10257 (pItem->pNode)->AllowOp(&ObjChange);
10258
10259 ObjChange.Define(OBJCHANGE_FINISHED,cFlags,NULL,NULL);
10260 UpdateAllChangedNodes(&ObjChange);
10261 }
10262
10263 pItem = (NodeListItem *)ShadowList.GetNext(pItem);
10264 }
10265
10266 ShadowList.DeleteAll();
10267
10268 End();
10269 }
10270
10271
10272
10273
10274
10275
10276
10277
10278
10279
10280
10281
10282
10283
10284 OpState OpChangeFillProfile::GetState(String_256* Description, OpDescriptor*)
10285 {
10286 OpState Blobby;
10287
10288 return Blobby;
10289 }
10290
10291
10292
10295
10296
10297
10300
10301
10302
10303
10304
10305
10306
10307
10308
10309
10310
10311
10312
10313
10314 ChangeFillProfileAction::ChangeFillProfileAction()
10315 {
10316 m_pNodeFill = NULL;
10317 }
10318
10319
10320
10321
10322
10323
10324
10325
10326
10327
10328
10329
10330
10331
10332 ChangeFillProfileAction::~ChangeFillProfileAction()
10333 {
10334 }
10335
10336
10337
10338
10339
10340
10341
10342
10343
10344
10345
10346
10347
10348
10349
10350
10351
10352
10353
10354
10355
10356
10357
10358
10359
10360
10361
10362
10363
10364
10365
10366
10367
10368
10369
10370 ActionCode ChangeFillProfileAction::Init(Operation* pOp,
10371 ActionList* pActionList,
10372 AttrFillGeometry* pThisNodeFill,
10373 CProfileBiasGain &Profile,
10374 ChangeFillProfileAction** NewAction,
10375 BOOL bReverse ,
10376 BOOL bCache )
10377 {
10378 UINT32 ActSize = sizeof(ChangeFillProfileAction);
10379
10380 ActionCode Ac = Action::Init(pOp,pActionList,ActSize, CC_RUNTIME_CLASS(ChangeFillProfileAction), (Action**)NewAction);
10381
10382 if (Ac != AC_FAIL)
10383 {
10384 Document * pDoc = Document::GetCurrent();
10385
10386
10387 if (bReverse)
10388 {
10389 pActionList->RemoveItem(*NewAction);
10390 pActionList->AddHead(*NewAction);
10391 }
10392
10393 (*NewAction)->m_pNodeFill = pThisNodeFill;
10394 FillGeometryAttribute* temp = (FillGeometryAttribute*) pThisNodeFill->GetAttributeValue ();
10395 (*NewAction)->m_LastProfile = temp->GetProfile ();
10396
10397 NodeRenderableInk* pNode = (NodeRenderableInk*) pThisNodeFill->FindParent ();
10398
10399
10400
10401 temp->SetProfile(Profile);
10402
10403 pDoc->ForceRedraw(pThisNodeFill->FindParentSpread(),
10404 pNode->GetBoundingRect(), FALSE, pNode);
10405 }
10406
10407 return Ac;
10408 }
10409
10410
10411
10412
10413
10414
10415
10416
10417
10418
10419
10420
10421
10422
10423
10424
10425
10426
10427
10428
10429 void ChangeFillProfileAction::ChangeFillProfileWithNoUndo (CProfileBiasGain &Profile)
10430 {
10431 Document * pDoc = Document::GetCurrent();
10432
10433 List ShadowList;
10434
10435
10436 FillTools::GetSelectedAttrList(&ShadowList, CC_RUNTIME_CLASS(AttrFillGeometry), TRUE, FALSE);
10437
10438 NodeListItem * pItem = (NodeListItem *)ShadowList.GetHead();
10439
10440 CProfileBiasGain OldGain;
10441
10442 while (pItem)
10443 {
10444 if (pItem->pNode)
10445 {
10446 AttrFillGeometry* pThisNodeFill = (AttrFillGeometry *)pItem->pNode;
10447
10448 FillGeometryAttribute* temp = (FillGeometryAttribute*) pThisNodeFill->GetAttributeValue ();
10449 temp->SetProfile(Profile);
10450
10451 NodeRenderableInk* pNode = (NodeRenderableInk*) pThisNodeFill->FindParent ();
10452 Node* pParent = pNode->FindParent ();
10453
10454
10455
10456 if (IS_A(pParent, Layer))
10457 {
10458 pDoc->ForceRedraw(pThisNodeFill->FindParentSpread(),
10459 pNode->GetBoundingRect(), FALSE, pNode);
10460 }
10461 else
10462 {
10463 ObjChangeFlags cFlags;
10464 cFlags.Attribute = TRUE;
10465
10466 ObjChangeParam ObjChange(OBJCHANGE_STARTING,cFlags,NULL,NULL);
10467
10468 (pItem->pNode)->AllowOp(&ObjChange);
10469
10470 ObjChange.Define(OBJCHANGE_FINISHED,cFlags,NULL,NULL);
10471
10472 Operation TempOp;
10473
10474 TempOp.UpdateAllChangedNodes(&ObjChange);
10475 }
10476 }
10477
10478 pItem = (NodeListItem *)ShadowList.GetNext(pItem);
10479 }
10480
10481 ShadowList.DeleteAll();
10482
10483 if (pDoc->GetOpHistory ().CanRedo ())
10484 {
10485
10486 pDoc->GetOpHistory ().DeleteRedoableOps ();
10487
10488
10489 DialogBarOp::SetSystemStateChanged();
10490 DialogBarOp::UpdateStateOfAllBars();
10491 }
10492 }
10493
10494
10495
10496
10497
10498
10499
10500
10501
10502
10503
10504
10505
10506
10507
10508
10509
10510
10511
10512
10513 ActionCode ChangeFillProfileAction::Execute()
10514 {
10515 ActionCode Act;
10516 ChangeFillProfileAction* pAction;
10517
10518 Act = ChangeFillProfileAction::Init( pOperation,
10519 pOppositeActLst,
10520 m_pNodeFill,
10521 m_LastProfile,
10522 &pAction,
10523 TRUE,
10524 FALSE);
10525
10526 return (Act);
10527 }
10528
10529
10530
10533
10534
10535
10538
10539
10540
10541
10542
10543
10544
10545
10546
10547
10548
10549
10550
10551
10552 OpChangeTranspFillProfile::OpChangeTranspFillProfile()
10553 {
10554 }
10555
10556
10557
10558
10559
10560
10561
10562
10563
10564
10565
10566
10567
10568
10569 OpChangeTranspFillProfile::~OpChangeTranspFillProfile()
10570 {
10571 }
10572
10573
10574
10575
10576
10577
10578
10579
10580
10581
10582
10583
10584
10585
10586 BOOL OpChangeTranspFillProfile::Declare()
10587 {
10588 return (RegisterOpDescriptor(
10589 0,
10590 _R(IDS_TRANSPFILLPROFILE),
10591 CC_RUNTIME_CLASS(OpChangeTranspFillProfile),
10592 OPTOKEN_TRANSPFILLPROFILE,
10593 OpChangeTranspFillProfile::GetState));
10594 }
10595
10596
10597
10598
10599
10600
10601
10602
10603
10604
10605
10606
10607
10608
10609
10610 void OpChangeTranspFillProfile::DoWithParam(OpDescriptor* pOp, OpParam* pParam)
10611 {
10612
10613
10614 DoStartSelOp(TRUE);
10615
10616
10617 CProfileBiasGain Profile;
10618
10619
10620 FillProfileOpParam * pProfileParam = (FillProfileOpParam *)pParam;
10621
10622 List ShadowList;
10623
10624
10625 FillTools::GetSelectedAttrList(&ShadowList, CC_RUNTIME_CLASS(AttrTranspFillGeometry), TRUE, TRUE);
10626
10627 NodeListItem * pItem = (NodeListItem *)ShadowList.GetHead();
10628
10629 CProfileBiasGain OldGain;
10630
10631 while (pItem)
10632 {
10633 if (pItem->pNode)
10634 {
10635
10636 ChangeFillProfileAction * pAction;
10637
10638 ChangeFillProfileAction::Init(this, GetUndoActionList(), (AttrFillGeometry *)pItem->pNode, pProfileParam->Profile,
10639 &pAction);
10640
10641
10642
10643 ObjChangeFlags cFlags;
10644 cFlags.Attribute = TRUE;
10645
10646 ObjChangeParam ObjChange(OBJCHANGE_STARTING,cFlags,NULL,NULL);
10647
10648 (pItem->pNode)->AllowOp(&ObjChange);
10649
10650 ObjChange.Define(OBJCHANGE_FINISHED,cFlags,NULL,NULL);
10651 UpdateAllChangedNodes(&ObjChange);
10652 }
10653
10654 pItem = (NodeListItem *)ShadowList.GetNext(pItem);
10655 }
10656
10657 ShadowList.DeleteAll();
10658
10659 End();
10660 }
10661
10662
10663
10664
10665
10666
10667
10668
10669
10670
10671
10672
10673
10674
10675 OpState OpChangeTranspFillProfile::GetState(String_256* Description, OpDescriptor*)
10676 {
10677 OpState Blobby;
10678
10679 return (Blobby);
10680 }
10681
10682
10683
10686
10687
10688
10691
10692
10693
10694
10695
10696
10697
10698
10699
10700
10701
10702
10703
10704
10705 ChangeTranspFillProfileAction::ChangeTranspFillProfileAction()
10706 {
10707 m_pNodeTranspFill = NULL;
10708 }
10709
10710
10711
10712
10713
10714
10715
10716
10717
10718
10719
10720
10721
10722
10723 ChangeTranspFillProfileAction::~ChangeTranspFillProfileAction()
10724 {
10725 }
10726
10727
10728
10729
10730
10731
10732
10733
10734
10735
10736
10737
10738
10739
10740
10741
10742
10743
10744
10745
10746
10747
10748
10749
10750
10751
10752
10753
10754
10755
10756
10757
10758
10759
10760 ActionCode ChangeTranspFillProfileAction::Init(Operation* pOp,
10761 ActionList* pActionList,
10762 AttrFillGeometry* pThisNodeTranspFill,
10763 CProfileBiasGain &Profile,
10764 ChangeTranspFillProfileAction** NewAction,
10765 BOOL bReverse ,
10766 BOOL bCache )
10767 {
10768 UINT32 ActSize = sizeof(ChangeTranspFillProfileAction);
10769
10770 ActionCode Ac = Action::Init(pOp,pActionList,ActSize, CC_RUNTIME_CLASS(ChangeTranspFillProfileAction), (Action**)NewAction);
10771
10772 if (Ac != AC_FAIL)
10773 {
10774 Document * pDoc = Document::GetCurrent();
10775
10776
10777 if (bReverse)
10778 {
10779 pActionList->RemoveItem(*NewAction);
10780 pActionList->AddHead(*NewAction);
10781 }
10782
10783 (*NewAction)->m_pNodeTranspFill = pThisNodeTranspFill;
10784 FillGeometryAttribute* temp = (FillGeometryAttribute*) pThisNodeTranspFill->GetAttributeValue ();
10785 (*NewAction)->m_LastProfile = temp->GetProfile ();
10786
10787 NodeRenderableInk* pNode = (NodeRenderableInk*) pThisNodeTranspFill->FindParent ();
10788
10789
10790
10791 temp->SetProfile(Profile);
10792
10793 pDoc->ForceRedraw(pThisNodeTranspFill->FindParentSpread(),
10794 pNode->GetBoundingRect(), FALSE, pNode);
10795 }
10796
10797 return Ac;
10798 }
10799
10800
10801
10802
10803
10804
10805
10806
10807
10808
10809
10810
10811
10812
10813
10814
10815
10816
10817
10818
10819 void ChangeTranspFillProfileAction::ChangeTranspFillProfileWithNoUndo (CProfileBiasGain &Profile)
10820 {
10821 Document * pDoc = Document::GetCurrent();
10822
10823 List ShadowList;
10824
10825
10826 FillTools::GetSelectedAttrList(&ShadowList, CC_RUNTIME_CLASS(AttrTranspFillGeometry), TRUE, TRUE);
10827
10828 NodeListItem * pItem = (NodeListItem *)ShadowList.GetHead();
10829
10830 CProfileBiasGain OldGain;
10831
10832 while (pItem)
10833 {
10834 if (pItem->pNode)
10835 {
10836 AttrFillGeometry* pThisNodeFill = (AttrFillGeometry *)pItem->pNode;
10837
10838 FillGeometryAttribute* temp = (FillGeometryAttribute*) pThisNodeFill->GetAttributeValue ();
10839 temp->SetProfile(Profile);
10840
10841 NodeRenderableInk* pNode = (NodeRenderableInk*) pThisNodeFill->FindParent ();
10842 Node* pParent = pNode->FindParent ();
10843
10844
10845
10846 if (IS_A(pParent, Layer))
10847 {
10848 pDoc->ForceRedraw(pThisNodeFill->FindParentSpread(),
10849 pNode->GetBoundingRect(), FALSE, pNode);
10850 }
10851 else
10852 {
10853 ObjChangeFlags cFlags;
10854 cFlags.Attribute = TRUE;
10855
10856 ObjChangeParam ObjChange(OBJCHANGE_STARTING,cFlags,NULL,NULL);
10857
10858 (pItem->pNode)->AllowOp(&ObjChange);
10859
10860 ObjChange.Define(OBJCHANGE_FINISHED,cFlags,NULL,NULL);
10861
10862 Operation TempOp;
10863
10864 TempOp.UpdateAllChangedNodes(&ObjChange);
10865 }
10866 }
10867
10868 pItem = (NodeListItem *)ShadowList.GetNext(pItem);
10869 }
10870
10871 ShadowList.DeleteAll();
10872
10873 if (pDoc->GetOpHistory ().CanRedo ())
10874 {
10875
10876 pDoc->GetOpHistory ().DeleteRedoableOps ();
10877
10878
10879 DialogBarOp::SetSystemStateChanged();
10880 DialogBarOp::UpdateStateOfAllBars();
10881 }
10882 }
10883
10884
10885
10886
10887
10888
10889
10890
10891
10892
10893
10894
10895
10896
10897
10898
10899
10900
10901
10902
10903 ActionCode ChangeTranspFillProfileAction::Execute()
10904 {
10905 ActionCode Act;
10906 ChangeFillProfileAction* pAction;
10907
10908 Act = ChangeFillProfileAction::Init( pOperation,
10909 pOppositeActLst,
10910 m_pNodeTranspFill,
10911 m_LastProfile,
10912 &pAction,
10913 TRUE,
10914 FALSE);
10915
10916 return (Act);
10917 }