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
00105 #include "camtypes.h"
00106
00107
00108 #include "colormgr.h"
00109
00110
00111
00112
00113
00114
00115
00116
00117
00118
00119 #include "blobs.h"
00120 #include "opgrad.h"
00121
00122
00123 #include "toollist.h"
00124 #include "bitmpinf.h"
00125
00126
00127
00128 #include "fracfill.h"
00129
00130
00131 #include "oilbitmap.h"
00132
00133
00134 #include "ndoptmz.h"
00135 #include "attrmap.h"
00136
00137 #include "cxftags.h"
00138
00139 #include "rechattr.h"
00140
00141 #include "cxfcols.h"
00142
00143 #include "blendatt.h"
00144 #include "lineattr.h"
00145
00146
00147
00148 #include "nodebmp.h"
00149 #include "nodemold.h"
00150 #include "ophist.h"
00151
00152
00153
00154
00155 #include "fillramp.h"
00156
00157 #include "bevtrap.h"
00158
00159 #include "extender.h"
00160
00161 #include "colcomp.h"
00162 #include "cutop.h"
00163 #include "effects_stack.h"
00164
00165
00166 DECLARE_SOURCE("$Revision: 1771 $");
00167
00168
00169
00170
00171 CC_IMPLEMENT_DYNAMIC(AttrFillGeometry, NodeAttribute)
00172 CC_IMPLEMENT_DYNAMIC(AttrTranspFillGeometry, AttrFillGeometry)
00173 CC_IMPLEMENT_DYNAMIC(AttrFlatFill, AttrFillGeometry)
00174 CC_IMPLEMENT_DYNAMIC(AttrLinearFill, AttrFillGeometry)
00175 CC_IMPLEMENT_DYNAMIC(AttrRadialFill, AttrFillGeometry)
00176 CC_IMPLEMENT_DYNAMIC(AttrConicalFill, AttrFillGeometry)
00177 CC_IMPLEMENT_DYNAMIC(AttrSquareFill, AttrFillGeometry)
00178 CC_IMPLEMENT_DYNAMIC(AttrBitmapFill, AttrFillGeometry)
00179 CC_IMPLEMENT_DYNAMIC(AttrFractalFill, AttrBitmapFill)
00180 CC_IMPLEMENT_DYNAMIC(AttrThreeColFill, AttrFillGeometry)
00181 CC_IMPLEMENT_DYNAMIC(AttrFourColFill, AttrThreeColFill)
00182
00183 CC_IMPLEMENT_DYNAMIC(AttrValueChange, AttrFillGeometry)
00184 CC_IMPLEMENT_DYNCREATE(AttrColourChange, AttrValueChange)
00185 CC_IMPLEMENT_DYNCREATE(AttrColourDrop, AttrColourChange)
00186 CC_IMPLEMENT_DYNCREATE(AttrStrokeColourChange, AttrValueChange)
00187 CC_IMPLEMENT_DYNCREATE(AttrStrokeTranspChange, AttrValueChange)
00188 CC_IMPLEMENT_DYNCREATE(AttrStrokeTranspTypeChange, AttrValueChange)
00189 CC_IMPLEMENT_DYNCREATE(AttrTranspChange, AttrValueChange)
00190 CC_IMPLEMENT_DYNCREATE(AttrTranspTypeChange, AttrTranspChange)
00191 CC_IMPLEMENT_DYNCREATE(AttrBitmapChange, AttrValueChange)
00192 CC_IMPLEMENT_DYNCREATE(AttrBitmapTessChange, AttrBitmapChange)
00193 CC_IMPLEMENT_DYNCREATE(AttrBitmapDpiChange, AttrBitmapChange)
00194 CC_IMPLEMENT_DYNCREATE(AttrFractalChange, AttrValueChange)
00195 CC_IMPLEMENT_DYNCREATE(AttrFractalGrainChange, AttrFractalChange)
00196 CC_IMPLEMENT_DYNCREATE(AttrFractalTileableChange, AttrFractalChange)
00197 CC_IMPLEMENT_DYNCREATE(AttrNoiseScaleChange, AttrValueChange)
00198 CC_IMPLEMENT_DYNCREATE(AttrColFillRampChange, AttrValueChange)
00199 CC_IMPLEMENT_DYNCREATE(AttrTranspFillRampChange, AttrValueChange)
00200
00201 CC_IMPLEMENT_DYNCREATE(AttrFlatColourFill, AttrFlatFill)
00202 CC_IMPLEMENT_DYNCREATE(AttrLinearColourFill, AttrLinearFill)
00203 CC_IMPLEMENT_DYNCREATE(AttrRadialColourFill, AttrRadialFill)
00204 CC_IMPLEMENT_DYNCREATE(AttrConicalColourFill, AttrConicalFill)
00205 CC_IMPLEMENT_DYNCREATE(AttrSquareColourFill, AttrSquareFill)
00206 CC_IMPLEMENT_DYNCREATE(AttrBitmapColourFill, AttrBitmapFill)
00207 CC_IMPLEMENT_DYNCREATE(AttrTextureColourFill, AttrFractalFill)
00208 CC_IMPLEMENT_DYNCREATE(AttrFractalColourFill, AttrTextureColourFill)
00209 CC_IMPLEMENT_DYNCREATE(AttrNoiseColourFill, AttrTextureColourFill)
00210 CC_IMPLEMENT_DYNCREATE(AttrThreeColColourFill, AttrThreeColFill)
00211 CC_IMPLEMENT_DYNCREATE(AttrFourColColourFill, AttrFourColFill)
00212
00213 CC_IMPLEMENT_DYNCREATE(AttrFlatTranspFill, AttrFlatFill)
00214 CC_IMPLEMENT_DYNCREATE(AttrLinearTranspFill, AttrLinearFill)
00215 CC_IMPLEMENT_DYNCREATE(AttrRadialTranspFill, AttrRadialFill)
00216 CC_IMPLEMENT_DYNCREATE(AttrConicalTranspFill, AttrConicalFill)
00217 CC_IMPLEMENT_DYNCREATE(AttrSquareTranspFill, AttrSquareFill)
00218 CC_IMPLEMENT_DYNCREATE(AttrBitmapTranspFill, AttrBitmapFill)
00219 CC_IMPLEMENT_DYNCREATE(AttrTextureTranspFill, AttrFractalFill)
00220 CC_IMPLEMENT_DYNCREATE(AttrFractalTranspFill, AttrTextureTranspFill)
00221 CC_IMPLEMENT_DYNCREATE(AttrNoiseTranspFill, AttrTextureTranspFill)
00222
00223 CC_IMPLEMENT_DYNCREATE(AttrThreeColTranspFill, AttrThreeColFill)
00224 CC_IMPLEMENT_DYNCREATE(AttrFourColTranspFill, AttrFourColFill)
00225
00226 CC_IMPLEMENT_DYNAMIC(AttrCircularColourFill, AttrRadialColourFill)
00227 CC_IMPLEMENT_DYNAMIC(AttrCircularTranspFill, AttrRadialTranspFill)
00228
00229 CC_IMPLEMENT_DYNCREATE(AttrFillMapping, NodeAttribute)
00230 CC_IMPLEMENT_DYNCREATE(AttrFillMappingLinear, AttrFillMapping)
00231 CC_IMPLEMENT_DYNCREATE(AttrFillMappingSin, AttrFillMapping)
00232
00233 CC_IMPLEMENT_DYNCREATE(AttrFillEffect, NodeAttribute)
00234 CC_IMPLEMENT_DYNCREATE(AttrFillEffectFade, AttrFillEffect)
00235 CC_IMPLEMENT_DYNCREATE(AttrFillEffectRainbow, AttrFillEffect)
00236 CC_IMPLEMENT_DYNCREATE(AttrFillEffectAltRainbow, AttrFillEffect)
00237
00238 CC_IMPLEMENT_DYNCREATE(AttrTranspFillMapping, NodeAttribute)
00239 CC_IMPLEMENT_DYNCREATE(AttrTranspFillMappingLinear, AttrTranspFillMapping)
00240 CC_IMPLEMENT_DYNCREATE(AttrTranspFillMappingSin, AttrTranspFillMapping)
00241
00242 CC_IMPLEMENT_DYNCREATE(AttrMould, NodeAttribute)
00243
00244
00245 CC_IMPLEMENT_DYNAMIC(AttrChangedMsg, Msg)
00246
00247 CC_IMPLEMENT_MEMDUMP(FillBlobSelectionState, CC_CLASS_MEMDUMP)
00248
00249
00250 CC_IMPLEMENT_DYNAMIC(FillAttrRecordHandler, CamelotRecordHandler)
00251
00252
00253
00254 #define new CAM_DEBUG_NEW
00255
00256
00257 AttrFillGeometry* AttrFillGeometry::EditedFill = NULL;
00258 AttrFillGeometry* AttrFillGeometry::DraggedFill = NULL;
00259
00260
00261 BOOL AttrFillGeometry::DoFillMeshCheck = TRUE;
00262 FillGeometryAttribute* AttrFillGeometry::LastRenderedMesh = NULL;
00263 DocCoord AttrFillGeometry::LastRenderedStartBlob = DocCoord(0,0);
00264 DocCoord AttrFillGeometry::LastRenderedEndBlob = DocCoord(0,0);
00265 DocCoord AttrFillGeometry::LastRenderedEnd2Blob = DocCoord(0,0);
00266 DocCoord AttrFillGeometry::LastRenderedEnd3Blob = DocCoord(0,0);
00267
00268 BOOL AttrFillGeometry::TranspMeshesVisible = FALSE;
00269
00270
00271 UINT32 AttrFillGeometry::SelectionCount = 0;
00272
00273
00274
00275 SelectedAttrs AttrFillGeometry::s_SelAttrs;
00276 CCAttrMap AttrFillGeometry::AttribMap;
00277
00278 FillControl AttrFillGeometry::ControlHit;
00279 AttrFillGeometry* AttrFillGeometry::FillHit;
00280
00281 List AttrFillGeometry::HitList;
00282
00283 INT32 AttrFillGeometry::FractalSeed = 63933;
00284 double AttrFillGeometry::FractalGraininess = 5;
00285 double AttrFillGeometry::FractalGravity = 0;
00286
00287 INT32 AttrFillGeometry::FractalDPI = 96;
00288 INT32 AttrFillGeometry::MaxFractalSize = 256;
00289 BOOL AttrFillGeometry::DoCheckOnFillRampMesh = TRUE;
00290 BOOL AttrFillGeometry::s_bGroupTransparency = TRUE;
00291
00292
00294
00295
00296
00298
00299
00300
00302
00303
00304
00306
00307
00308
00309
00310
00311
00312
00313
00314
00315
00316
00317 BOOL AttrFillGeometry::Init()
00318 {
00319 #ifdef STANDALONE
00320 BOOL ok = TRUE;
00321 #else
00322
00323 BOOL ok = ( OpCreateFill::Init() && OpEditFill::Init() );
00324 #endif
00325
00326 #if !defined(EXCLUDE_FROM_RALPH)
00327
00328
00329 if (Camelot.DeclareSection(_T("DebugFlags"), 1))
00330 {
00331 Camelot.DeclarePref( NULL, _T("DoFillMeshCheck"),
00332 &DoFillMeshCheck, FALSE, TRUE );
00333 }
00334
00335 if (Camelot.DeclareSection(_T("Attributes"), 6))
00336 {
00337 Camelot.DeclarePref(NULL, _T("FractalDPI"), (UINT32*)&FractalDPI);
00338 Camelot.DeclarePref(NULL, _T("MaxFractalSize"), (UINT32*)&MaxFractalSize);
00339 Camelot.DeclarePref(NULL, _T("FractalSeed"), (UINT32*)&FractalSeed);
00340 Camelot.DeclarePref(NULL, _T("FractalGraininess"), &FractalGraininess);
00341 Camelot.DeclarePref(NULL, _T("FractalGravity"), &FractalGravity);
00342 Camelot.DeclarePref(NULL, _T("GroupTransparency"), &s_bGroupTransparency);
00343 }
00344 #endif
00345
00346 #ifndef STANDALONE
00347 if (Camelot.DeclareSection( _T("Dragging"), 3))
00348 {
00349 Camelot.DeclarePref(NULL, _T("InteractiveFillEditing"), &OpEditFill::InteractiveDragUpdate);
00350 Camelot.DeclarePref(NULL, _T("ContinuousFillControlUpdate"), &OpEditFill::ContinuousEOR);
00351 Camelot.DeclarePref(NULL, _T("DelayBeforeFillUpdate"), (UINT32*)&OpEditFill::IdleFillDelay);
00352 }
00353 #endif
00354
00355 return ok;
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 BOOL AttrFillGeometry::CheckAttrClick(DocCoord PointerPos,
00384 ClickType Click,
00385 ClickModifiers ClickMods,
00386 Spread* pSpread)
00387 {
00388 #ifdef STANDALONE
00389 return FALSE;
00390 #else
00391
00392 if ( !(((Camelot.GetBlobManager())->GetCurrentInterest()).Fill) )
00393 return FALSE;
00394
00395
00396 LastRenderedStartBlob = DocCoord(0,0);
00397 LastRenderedEndBlob = DocCoord(0,0);
00398 LastRenderedEnd2Blob = DocCoord(0,0);
00399 LastRenderedEnd3Blob = DocCoord(0,0);
00400
00401 if (Click == CLICKTYPE_UP)
00402 {
00403 if (!HitList.IsEmpty())
00404 {
00405 FillHit = NULL;
00406 ControlHit = FILLCONTROL_NULL;
00407 HitList.DeleteAll();
00408 return TRUE;
00409 }
00410 }
00411
00412 if (Click == CLICKTYPE_SINGLE)
00413 {
00414 FillHit = NULL;
00415 ControlHit = FILLCONTROL_NULL;
00416 HitList.DeleteAll();
00417
00418
00419 CCRuntimeClass* FillType = IsColourMeshVisible() ? CC_RUNTIME_CLASS(AttrFillGeometry)
00420 : CC_RUNTIME_CLASS(AttrTranspFillGeometry);
00421
00422 AttrFillGeometry* pAttr = FindFirstSelectedAttr(FillType);
00423
00424 while (pAttr != NULL)
00425 {
00426
00427 if ( pAttr->OnClick(PointerPos, Click, ClickMods, pSpread) )
00428 {
00429 if (FillHit == NULL)
00430 {
00431 FillHit = pAttr;
00432 }
00433
00434 BOOL InList = FALSE;
00435
00436
00437
00438
00439
00440
00441 if (!HitList.IsEmpty())
00442 {
00443 ListItem* pItem = HitList.GetHead();
00444
00445 while (pItem)
00446 {
00447 NodeAttributePtrItem* NodePtr = (NodeAttributePtrItem*)pItem;
00448
00449 if (NodePtr->NodeAttribPtr == pAttr)
00450 {
00451
00452 InList = TRUE;
00453 break;
00454 }
00455
00456 pItem = HitList.GetNext(pItem);
00457 }
00458 }
00459
00460 if ( !InList &&
00461 IsMeshSame((FillGeometryAttribute*)FillHit->GetAttributeValue(),
00462 (FillGeometryAttribute*)pAttr->GetAttributeValue()) )
00463 {
00464 NodeAttributePtrItem* NodePtr = new NodeAttributePtrItem;
00465
00466 if (NodePtr != NULL)
00467 {
00468
00469 NodePtr->NodeAttribPtr = pAttr;
00470 HitList.AddTail(NodePtr);
00471 }
00472 }
00473
00474 }
00475
00476
00477 pAttr = FindNextSelectedAttr(FillType);
00478 }
00479
00480
00481
00482
00483
00484
00485 BROADCAST_TO_ALL(SelChangingMsg(SelChangingMsg::COLOURATTCHANGED));
00486
00487
00488
00489
00490 }
00491
00492 if (Click == CLICKTYPE_DOUBLE)
00493 {
00494 FillHit = NULL;
00495 ControlHit = FILLCONTROL_NULL;
00496 HitList.DeleteAll();
00497
00498
00499 CCRuntimeClass* FillType = CC_RUNTIME_CLASS(AttrFillGeometry);
00500
00501
00502
00503 SelectedAttrs selattrs;
00504 AttrFillGeometry* pAttr = (AttrFillGeometry*)selattrs.FindFirst(FillType);
00505
00506 BOOL RetVal = FALSE;
00507
00508
00509
00510 while (pAttr != NULL)
00511 {
00512
00513 if ( pAttr->OnClick(PointerPos, Click, ClickMods, pSpread) )
00514 {
00515
00516
00517
00518
00519 RetVal = TRUE;
00520 }
00521
00522
00523 pAttr = (AttrFillGeometry*)selattrs.FindNext(FillType);
00524 }
00525
00526 BROADCAST_TO_ALL(SelChangingMsg(SelChangingMsg::COLOURATTCHANGED));
00527 return (RetVal);
00528 }
00529
00530 if (Click == CLICKTYPE_SINGLE && !HitList.IsEmpty())
00531 {
00532
00533
00534
00535 if (Operation::GetCurrentDragOp() == NULL)
00536 {
00537 NodeAttributePtrItem* HitFillPtr =
00538 (NodeAttributePtrItem*)AttrFillGeometry::HitList.GetHead();
00539
00540 AttrFillGeometry* HitFill = (AttrFillGeometry*)HitFillPtr->NodeAttribPtr;
00541
00542
00543
00544 OpEditFill* pOpEditFill = new OpEditFill;
00545 if (pOpEditFill == NULL)
00546 {
00547
00548 TRACEUSER( "Mike", _T("The Graduated Fill Edit Blob Operation failed to start\n") );
00549
00550
00551
00552 InformError();
00553 }
00554 else
00555 {
00556
00557 if (ISA_RAMPINDEX(ControlHit))
00558 {
00559
00560 if (HitFill->GetColourRamp())
00561 {
00562 HitFill->GetColourRamp()->DeselectAll();
00563 HitFill->GetColourRamp()->SetSelState(ControlHit, 1);
00564 }
00565 }
00566
00567
00568 pOpEditFill->DoDrag(PointerPos, pSpread, HitFill, ControlHit);
00569 }
00570 }
00571
00572 return TRUE;
00573 }
00574
00575
00576 return FALSE;
00577 #endif
00578 }
00579
00580
00581
00582
00583
00584
00585
00586
00587
00588
00589
00590
00591
00592
00593
00594
00595
00596
00597 BOOL AttrFillGeometry::OnClick( DocCoord PointerPos, ClickType Click,
00598 ClickModifiers ClickMods, Spread *pSpread )
00599 {
00600 #ifndef STANDALONE
00601 DocView *pDocView = DocView::GetCurrent();
00602
00603
00604 ERROR3IF(pDocView == NULL, "AttrFillGeometry::OnClick: Could not get current DocView");
00605 if (pDocView==NULL)
00606 return FALSE;
00607
00608 if (!GetApplication()->GetBlobManager()->GetCurrentInterest().Fill ||
00609 !IsVisible())
00610 return FALSE;
00611
00612
00613 if ( Click == CLICKTYPE_SINGLE )
00614 {
00615
00616 FillControl Hit = CheckForControlHit(PointerPos);
00617 if ( Hit != FILLCONTROL_NULL )
00618 {
00619
00620
00621
00622 if (ClickMods.Adjust && !ClickMods.Constrain)
00623 {
00624 if (!(ISA_RAMPINDEX (Hit)))
00625 {
00626 DeselectAllBut(Hit);
00627
00628 ToggleSelection(Hit);
00629 }
00630 else
00631 {
00632 SelectBlob(Hit);
00633 DeselectAllBut(Hit);
00634 }
00635 }
00636 else
00637 {
00638
00639
00640
00641 SelectBlob(Hit);
00642 DeselectAllBut(Hit);
00643
00644 if (ClickMods.Menu)
00645 {
00646 if (ISA_RAMPINDEX (Hit))
00647 {
00648 OpDescriptor* pOpDelete = OpDescriptor::FindOpDescriptor (CC_RUNTIME_CLASS (OpDelete));
00649
00650 if (pOpDelete)
00651 {
00652 pOpDelete->Invoke ();
00653 }
00654 }
00655 }
00656 }
00657
00658 if (ControlHit == FILLCONTROL_NULL)
00659 ControlHit = Hit;
00660
00661 if (Hit != ControlHit)
00662 return FALSE;
00663
00664
00665 return TRUE;
00666 }
00667 else
00668 {
00669
00670
00671 if (!ClickMods.Adjust)
00672 {
00673 DeselectAll();
00674 }
00675
00676
00677 return FALSE;
00678 }
00679 }
00680
00681
00682 if (Click == CLICKTYPE_DOUBLE)
00683 {
00684
00685 FillControl Hit = CheckForControlHit (PointerPos);
00686
00687 if (Hit == FILLCONTROL_RAMPPOINT)
00688 {
00689 DocCoord StartPoint = *(GetStartPoint());
00690 DocCoord EndPoint = *(GetEndPoint());
00691
00692
00693
00694 FindRampPoint(PointerPos, StartPoint, EndPoint);
00695
00696 Spread* pSpread = NULL;
00697 NodeRenderableInk* pNode = NULL;
00698 Pixel32bpp Pix;
00699
00700 Document* TheDoc = Document::GetCurrent();
00701 PORTNOTE("spread", "Multi-spread warning! Should use the passed in spread pointer?")
00702 pSpread = TheDoc->FindFirstSpread ();
00703
00704 if (TheDoc != NULL)
00705 {
00706
00708
00709 pNode = (NodeRenderableInk *) this->FindParent ();
00710
00711 NodeRenderableInk::FindColourForNodeRenderableAtPoint (pSpread, PointerPos, Pix, pNode, this);
00712
00713 if (pNode != NULL)
00714 {
00715
00716
00717 const double conversion = 1.0/255.0;
00718
00719 FIXED24 rValF24 = Pix.Red * conversion;
00720 FIXED24 gValF24 = Pix.Green * conversion;
00721 FIXED24 bValF24 = Pix.Blue * conversion;
00722 FIXED24 tValF24 = Pix.Alpha * conversion;
00723
00724 ColourRGBT theColourRGBT;
00725 theColourRGBT.Red = rValF24;
00726 theColourRGBT.Green = gValF24;
00727 theColourRGBT.Blue = bValF24;
00728 theColourRGBT.Transparent = tValF24;
00729 DocColour* ColourToApply = new DOCCOLOUR_RGBT(&theColourRGBT);
00730
00731 if (ColourToApply == NULL)
00732 {
00733 return (FALSE);
00734 }
00735
00736 DocRect pSimpleBounds;
00737 pSimpleBounds = pNode->GetBoundingRect();
00738
00739 AttrColourDrop* dummyDrop = new AttrColourDrop (PointerPos, pSimpleBounds, *ColourToApply);
00740
00741 if (dummyDrop == NULL)
00742 {
00743 delete (ColourToApply);
00744 return (FALSE);
00745 }
00746
00747
00748
00749 dummyDrop->SetObjectDroppedOn (pNode);
00750
00751 AttributeManager::ApplyAttribToNode(pNode, dummyDrop);
00752
00753 delete (ColourToApply);
00754
00755 return (TRUE);
00756 }
00757 }
00758 return (FALSE);
00759 }
00760 return FALSE;
00761 }
00762
00763 #endif
00764 return FALSE;
00765 }
00766
00767
00768
00769
00770
00771
00772
00773
00774
00775
00776
00777
00778
00779 BOOL AttrFillGeometry::IsFillBeingEdited()
00780 {
00781 #if !defined(EXCLUDE_FROM_RALPH)
00782 if (EditedFill == this)
00783 {
00784 return TRUE;
00785 }
00786
00787 if (EditedFill != NULL && OpEditFill::CreateFill)
00788 {
00789 return TRUE;
00790 }
00791
00792 if (EditedFill == NULL || HitList.IsEmpty())
00793 {
00794 return FALSE;
00795 }
00796
00797 NodeAttributePtrItem* HitFillPtr = (NodeAttributePtrItem*)AttrFillGeometry::HitList.GetHead();
00798
00799 while (HitFillPtr != NULL)
00800 {
00801 if (HitFillPtr->NodeAttribPtr == this)
00802 {
00803 return TRUE;
00804 }
00805
00806 HitFillPtr = (NodeAttributePtrItem*)AttrFillGeometry::HitList.GetNext(HitFillPtr);
00807 }
00808 #endif
00809 return FALSE;
00810 }
00811
00812
00813
00814
00815
00816
00817
00818
00819
00820
00821
00822
00823 BOOL AttrFillGeometry::CheckForFillControlHit(DocCoord Pos, UINT32* Status)
00824 {
00825 #if !defined(EXCLUDE_FROM_RALPH)
00826 if ( !(((Camelot.GetBlobManager())->GetCurrentInterest()).Fill) )
00827 return FALSE;
00828
00829 BOOL HitAControl = FALSE;
00830
00831
00832 CCRuntimeClass* FillType = IsColourMeshVisible() ? CC_RUNTIME_CLASS(AttrFillGeometry)
00833 : CC_RUNTIME_CLASS(AttrTranspFillGeometry);
00834
00835 AttrFillGeometry* pAttr = FindFirstSelectedAttr(FillType);
00836 while (pAttr != NULL)
00837 {
00838
00839 FillControl Hit = pAttr->CheckForControlHit(Pos);
00840
00841 if (Hit != FILLCONTROL_NULL)
00842 {
00843
00844
00845
00846
00847 if ( AttrFillGeometry::SelectionCount == 0)
00848 {
00849
00850 *Status = _R(IDS_FS_CNTRLPNT_SO);
00851 }
00852
00853 if ( AttrFillGeometry::SelectionCount == 1)
00854 {
00855
00856 if ( pAttr->IsSelected(Hit) )
00857 {
00858 if (!ISA_RAMPINDEX(Hit))
00859 {
00860 *Status = _R(IDS_FS_CNTRLPNT_DO);
00861 }
00862 else
00863 {
00864 *Status = _R(IDS_FS_CNTRLPNTMS_DO);
00865 }
00866 }
00867 else
00868 *Status = _R(IDS_FS_CNTRLPNT_SM);
00869 }
00870
00871 if ( AttrFillGeometry::SelectionCount >= 2)
00872 {
00873
00874 if ( pAttr->IsSelected(Hit) )
00875 *Status = _R(IDS_FS_CNTRLPNT_DM);
00876 else
00877 *Status = _R(IDS_FS_CNTRLPNT_SM);
00878 }
00879
00880
00881 HitAControl = TRUE;
00882 break;
00883 }
00884
00885 pAttr = FindNextSelectedAttr(FillType);
00886 }
00887
00888
00889 return HitAControl;
00890 #else
00891 return FALSE;
00892 #endif
00893 }
00894
00895
00896
00897
00898
00899
00900
00901
00902
00903
00904
00905
00906 BOOL AttrFillGeometry::CheckPreviousFillMesh()
00907 {
00908 #if !defined(EXCLUDE_FROM_RALPH)
00909 if (AllowRampRedraw)
00910 {
00911
00912 if (!DoFillMeshCheck)
00913 return FALSE;
00914
00915
00916 if (LastRenderedMesh != NULL && IsMeshSame(LastRenderedMesh, (FillGeometryAttribute*)GetAttributeValue()) )
00917 {
00918
00919 return TRUE;
00920 }
00921 else
00922 {
00923
00924 LastRenderedMesh = (FillGeometryAttribute*)GetAttributeValue();
00925 }
00926
00927 }
00928 #endif
00929
00930 return FALSE;
00931 }
00932
00933 BOOL AttrFillGeometry::IsMeshSame(FillGeometryAttribute* Fill1, FillGeometryAttribute* Fill2)
00934 {
00935 #if !defined(EXCLUDE_FROM_RALPH)
00936 BOOL PointsAreSame = FALSE;
00937
00938 if (Fill1->GetStartPoint() != NULL && Fill2->GetStartPoint() != NULL)
00939 {
00940 if (*Fill1->GetStartPoint() != *Fill2->GetStartPoint())
00941 return FALSE;
00942
00943 PointsAreSame = TRUE;
00944 }
00945
00946 if (Fill1->GetEndPoint() != NULL && Fill2->GetEndPoint() != NULL)
00947 {
00948 if (*Fill1->GetEndPoint() != *Fill2->GetEndPoint())
00949 return FALSE;
00950
00951 PointsAreSame = TRUE;
00952 }
00953
00954 if (Fill1->GetEndPoint2() != NULL && Fill2->GetEndPoint2() != NULL)
00955 {
00956 if (*Fill1->GetEndPoint2() != *Fill2->GetEndPoint2())
00957 return FALSE;
00958
00959 PointsAreSame = TRUE;
00960 }
00961
00962 return PointsAreSame;
00963 #else
00964 return FALSE;
00965 #endif
00966 }
00967
00968 UINT32 AttrFillGeometry::FillSelectionCount()
00969 {
00970 return SelectionCount;
00971 }
00972
00973 void AttrFillGeometry::SetSelectionCount(UINT32 Count)
00974 {
00975 SelectionCount = Count;
00976 }
00977
00978 void AttrFillGeometry::SetTranspMeshesVisible(BOOL Visible)
00979 {
00980 TranspMeshesVisible = Visible;
00981 }
00982
00983 BOOL AttrFillGeometry::IsTranspMeshVisible()
00984 {
00985
00986
00987
00988 return TranspMeshesVisible;
00989 }
00990
00991 BOOL AttrFillGeometry::IsColourMeshVisible()
00992 {
00993
00994
00995
00996 return !TranspMeshesVisible;
00997 }
00998
00999 void AttrFillGeometry::SetLastRenderedBlob(FillControl Control)
01000 {
01001 #if !defined(EXCLUDE_FROM_RALPH)
01002 switch (Control)
01003 {
01004 case FILLCONTROL_STARTPOINT:
01005 if (GetStartPoint() != NULL)
01006 LastRenderedStartBlob = *GetStartPoint();
01007 break;
01008
01009 case FILLCONTROL_ENDPOINT:
01010 if (GetEndPoint() != NULL)
01011 LastRenderedEndBlob = *GetEndPoint();
01012 break;
01013
01014 case FILLCONTROL_SECONDARYPOINT:
01015 case FILLCONTROL_ENDPOINT2:
01016 if (GetEndPoint2() != NULL)
01017 LastRenderedEnd2Blob = *GetEndPoint2();
01018 break;
01019
01020 case FILLCONTROL_ENDPOINT3:
01021 if ((GetStartPoint() != NULL) &&
01022 (GetEndPoint() != NULL) &&
01023 (GetEndPoint2() != NULL))
01024 {
01025 LastRenderedEnd3Blob = *GetEndPoint2() + *GetEndPoint() - *GetStartPoint();
01026 }
01027 break;
01028 }
01029 #endif
01030 }
01031
01032 BOOL AttrFillGeometry::IsBlobSame(FillControl Control)
01033 {
01034 #if !defined(EXCLUDE_FROM_RALPH)
01035 switch (Control)
01036 {
01037 case FILLCONTROL_STARTPOINT:
01038 if (GetStartPoint() != NULL)
01039 return (LastRenderedStartBlob == *GetStartPoint());
01040 break;
01041
01042 case FILLCONTROL_ENDPOINT:
01043 if (GetEndPoint() != NULL)
01044 return (LastRenderedEndBlob == *GetEndPoint());
01045 break;
01046
01047 case FILLCONTROL_SECONDARYPOINT:
01048 case FILLCONTROL_ENDPOINT2:
01049 if (GetEndPoint2() != NULL)
01050 return (LastRenderedEnd2Blob == *GetEndPoint2());
01051 break;
01052
01053 case FILLCONTROL_ENDPOINT3:
01054 if ((GetStartPoint() != NULL) &&
01055 (GetEndPoint() != NULL) &&
01056 (GetEndPoint2() != NULL))
01057 {
01058 DocCoord EndPoint3 = *GetEndPoint2() + *GetEndPoint() - *GetStartPoint();
01059 return (LastRenderedEnd3Blob == EndPoint3);
01060 }
01061 }
01062 #endif
01063 return FALSE;
01064 }
01065
01066
01067
01068
01069
01070
01071
01072
01073
01074
01075
01076
01077
01078
01079
01080
01081 double AttrFillGeometry::FindRampPoint(DocCoord &dc, DocCoord &StartPoint, DocCoord &EndPoint)
01082 {
01083 DocCoord ClickPos = dc;
01084
01085 DocRect dr(StartPoint.x, StartPoint.y, StartPoint.x, StartPoint.y);
01086
01087 if (dr.lo.x > EndPoint.x)
01088 {
01089 dr.lo.x = EndPoint.x;
01090 }
01091
01092 if (dr.lo.y > EndPoint.y)
01093 {
01094 dr.lo.y = EndPoint.y;
01095 }
01096
01097 if (dr.hi.x < EndPoint.x)
01098 {
01099 dr.hi.x = EndPoint.x;
01100 }
01101
01102 if (dr.hi.y < EndPoint.y)
01103 {
01104 dr.hi.y = EndPoint.y;
01105 }
01106
01107
01108 double dBlobSize = (double)(Camelot.GetBlobManager())->GetBlobSize();
01109
01110 if (dr.Width() < (INT32)(dBlobSize * 2))
01111 {
01112
01113 dr.hi.x += (INT32)(dBlobSize * 2);
01114 dr.lo.x -= (INT32)(dBlobSize * 2);
01115 }
01116
01117 if (dr.Height() < (INT32)(dBlobSize * 2))
01118 {
01119 dr.hi.y += (INT32)(dBlobSize * 2);
01120 dr.lo.y -= (INT32)(dBlobSize * 2);
01121 }
01122
01123 if (dr.ContainsCoord(ClickPos))
01124 {
01125
01126
01127
01128 double p = 0;
01129
01130 double dPosX = ClickPos.x;
01131 double dPosY = ClickPos.y;
01132
01133 double dX1 = StartPoint.x;
01134 double dY1 = StartPoint.y;
01135
01136 double dX2 = EndPoint.x;
01137 double dY2 = EndPoint.y;
01138
01139 double dTestPosY = 0;
01140 double dTestPosX = 0;
01141
01142 if (fabs(dX2 - dX1) > fabs(dY2 - dY1))
01143 {
01144 if (dX2 != dX1)
01145 {
01146 p = (dPosX - dX1) / (dX2 - dX1);
01147
01148 dTestPosY = ((dY2 - dY1) * p) + dY1;
01149
01150
01151 if (fabs(dTestPosY - dPosY) < dBlobSize / 2)
01152 {
01153 return p;
01154 }
01155 }
01156 }
01157 else if (dY2 != dY1)
01158 {
01159 p = (dPosY - dY1) / (dY2 - dY1);
01160
01161 dTestPosX = ((dX2 - dX1) * p) + dX1;
01162
01163
01164 if (fabs(dTestPosX - dPosX) < dBlobSize / 2)
01165 {
01166 return p;
01167 }
01168 }
01169 }
01170
01171 return -1;
01172 }
01173
01174
01175
01176
01177
01178
01179
01180
01181
01182
01183
01184
01185
01186
01187
01188
01189 BOOL AttrFillGeometry::NeedsTransparency() const
01190 {
01191 AttrFillGeometry* pNonConst = (AttrFillGeometry*) this;
01192
01193 if (!pNonConst->IsAFractalFill() && pNonConst->GetBitmap() != NULL && pNonConst->GetBitmap()->GetBPP() <= 8)
01194 {
01195 INT32 TranspIndex;
01196
01197
01198 if (pNonConst->GetBitmap()->GetTransparencyIndex(&TranspIndex))
01199 return TRUE;
01200 }
01201
01202 return FALSE;
01203 }
01204
01205
01206
01207
01208
01209
01210
01211
01212
01213
01214
01215
01216 AttrFillGeometry::AttrFillGeometry()
01217 {
01218
01219 SelectionState[FILLCONTROL_STARTPOINT] = FALSE;
01220 SelectionState[FILLCONTROL_ENDPOINT] = FALSE;
01221 SelectionState[FILLCONTROL_ENDPOINT2] = FALSE;
01222 SelectionState[FILLCONTROL_ENDPOINT3] = FALSE;
01223 SelectionState[FILLCONTROL_SECONDARYPOINT] = FALSE;
01224
01225
01226
01227
01228 AttrBounds = DocRect(0,0,0,0);
01229
01230 AllowRampRedraw = TRUE;
01231 AllowBoundsRedraw = TRUE;
01232 }
01233
01234
01235
01236
01237
01238
01239
01240
01241
01242
01243
01244
01245 AttrFillGeometry::~AttrFillGeometry()
01246 {
01247 LastRenderedMesh = NULL;
01248 }
01249
01250
01251
01252
01253
01254
01255
01256
01257
01258
01259
01260
01261
01262
01263
01264
01265
01266 INT32 AttrFillGeometry::operator=(AttrFillGeometry& FillAttrib)
01267 {
01268 ERROR3IF(!FillAttrib.IsAFillAttr(),
01269 "Trying to assign two objects with different types");
01270
01271
01272 AttrBounds = FillAttrib.AttrBounds;
01273
01274
01275 for (INT32 i=0; i < FILLCONTROL_SECONDARYPOINT; i++)
01276 {
01277 SetBlobState(i, FillAttrib.IsSelected(i));
01278 }
01279
01280
01281 *((FillGeometryAttribute*)GetAttributeValue()) = *((FillGeometryAttribute*)FillAttrib.GetAttributeValue());
01282
01283
01284 if (GetRuntimeClass() != FillAttrib.GetRuntimeClass())
01285 ValidateAttributeValue();
01286
01287 return TRUE;
01288 }
01289
01290
01291
01292
01293
01294
01295
01296
01297
01298
01299
01300
01301
01302
01303 BOOL AttrFillGeometry::CopyNodeContents( AttrFillGeometry* NodeCopy)
01304 {
01305
01306 NodeAttribute::CopyNodeContents( NodeCopy );
01307
01308
01309 NodeCopy->AttrBounds = AttrBounds;
01310
01311
01312 for (INT32 i=0; i < FILLCONTROL_SECONDARYPOINT; i++)
01313 {
01314 NodeCopy->SetBlobState(i, IsSelected(i));
01315 }
01316
01317
01318 NodeCopy->GetAttributeValue()->SimpleCopy(GetAttributeValue());
01319
01320 return TRUE;
01321 }
01322
01323
01324
01325
01326
01327
01328
01329
01330
01331
01332
01333
01334
01335
01336
01337 void AttrFillGeometry::PolyCopyNodeContents(NodeRenderable* pNodeCopy)
01338 {
01339 ENSURE(pNodeCopy, "Trying to copy a node's contents into a NULL node");
01340 ENSURE(pNodeCopy->IsKindOf(CC_RUNTIME_CLASS(AttrFillGeometry)), "PolyCopyNodeContents given wrong dest node type");
01341
01342 if (pNodeCopy->IsKindOf(CC_RUNTIME_CLASS(AttrFillGeometry)))
01343 CopyNodeContents((AttrFillGeometry*)pNodeCopy);
01344 }
01345
01346
01347
01348
01349
01350
01351
01352
01353
01354
01355
01356
01357
01358
01359
01360
01361
01362
01363
01364 INT32 AttrFillGeometry::operator==(const NodeAttribute& Attrib)
01365 {
01366
01367 if (((NodeAttribute*)&Attrib)->GetAttributeType() != GetAttributeType())
01368 return FALSE;
01369
01370
01371 AttrFillGeometry* Attr = (AttrFillGeometry*)&Attrib;
01372
01373
01374 return (*((FillGeometryAttribute*)Attr->GetAttributeValue()) == *((FillGeometryAttribute*)GetAttributeValue()) );
01375 }
01376
01377
01378
01379
01380
01381
01382
01383
01384
01385
01386
01387
01388
01389
01390
01391
01392
01393
01394
01395
01396
01397 AttrFillGeometry* AttrFillGeometry::FindFirstSelectedAttr(CCRuntimeClass* AttrType)
01398 {
01399 NodeAttribute* pAttr = s_SelAttrs.FindFirst(AttrType);
01400 if (pAttr && pAttr->IsAFillAttr())
01401 return (AttrFillGeometry*) pAttr;
01402 return NULL;
01403 }
01404
01405
01406
01407
01408
01409
01410
01411
01412
01413
01414
01415
01416
01417
01418 AttrFillGeometry* AttrFillGeometry::FindNextSelectedAttr(CCRuntimeClass* AttrType)
01419 {
01420 NodeAttribute* pAttr = s_SelAttrs.FindNext(AttrType);
01421 if (pAttr && pAttr->IsAFillAttr())
01422 return (AttrFillGeometry*) pAttr;
01423 return NULL;
01424 }
01425
01426
01427
01428
01429
01430
01431
01432
01433
01434
01435
01436
01437
01438
01439
01440
01441
01442 NodeAttribute* SelectedAttrs::FindFirst(CCRuntimeClass* AttrType)
01443 {
01444
01445
01446 m_pAttrSelection = Camelot.FindSelection();
01447 m_pLastSelectedAttr = NULL;
01448 m_pSelNode = NULL;
01449
01450
01451
01452 if (m_pAttrSelectionLevel)
01453 {
01454 delete m_pAttrSelectionLevel;
01455 m_pAttrSelectionLevel = NULL;
01456 }
01457
01458 m_pAttrSelectionLevel = EffectsStack::GetNewLevelRange(NULL, FALSE);
01459
01460 if (m_pAttrSelectionLevel)
01461 {
01462
01463 m_pSelNode = m_pAttrSelectionLevel->FindFirst();
01464 if (m_pSelNode)
01465 {
01466
01467 Node* pAttrNode = m_pSelNode;
01468 if (m_pSelNode->IsAnObject())
01469 pAttrNode = ((NodeRenderableInk*)m_pSelNode)->GetObjectToApplyTo(AttrType);
01470 ENSURE(pAttrNode->IsAnObject(), "Found unexpected non-ink node in FindFirstSelectedAttr");
01471 m_pLastSelectedAttr = ((NodeRenderableInk*)pAttrNode)->FindAppliedAttribute(AttrType);
01472 if (m_pLastSelectedAttr)
01473 return (NodeAttribute*)m_pLastSelectedAttr;
01474 }
01475
01476
01477
01478
01479 return FindNext(AttrType);
01480 }
01481
01482 ENSURE(m_pAttrSelectionLevel==NULL, "Possible Range Leak");
01483 m_pAttrSelection = NULL;
01484 m_pSelNode = NULL;
01485 m_pLastSelectedAttr = NULL;
01486 return NULL;
01487 }
01488
01489
01490
01491
01492
01493
01494
01495
01496
01497
01498
01499
01500
01501
01502 NodeAttribute* SelectedAttrs::FindNext(CCRuntimeClass* AttrType)
01503 {
01504
01505 ERROR2IF((m_pAttrSelection==NULL), NULL, "AttrSelection NULL in FindNextSelectedAttr");
01506 ERROR2IF((m_pAttrSelectionLevel==NULL), NULL, "AttrSelectionLevel NULL in FindNextSelectedAttr");
01507
01508
01509 while (m_pSelNode)
01510 {
01511 m_pSelNode = m_pAttrSelectionLevel->FindNext(m_pSelNode);
01512
01513 if (m_pSelNode)
01514 {
01515
01516 Node* pAttrNode = m_pSelNode;
01517 if (m_pSelNode->IsAnObject())
01518 pAttrNode = ((NodeRenderableInk*)m_pSelNode)->GetObjectToApplyTo(AttrType);
01519 ENSURE(pAttrNode->IsAnObject(), "Found unexpected non-ink node in FindFirstSelectedAttr");
01520 m_pLastSelectedAttr = ((NodeRenderableInk*)pAttrNode)->FindAppliedAttribute(AttrType);
01521 if (m_pLastSelectedAttr)
01522 {
01523 return (NodeAttribute*)m_pLastSelectedAttr;
01524 }
01525 }
01526 }
01527
01528
01529 if (m_pAttrSelectionLevel)
01530 {
01531 delete m_pAttrSelectionLevel;
01532 m_pAttrSelectionLevel = NULL;
01533 }
01534 m_pAttrSelection = NULL;
01535 m_pSelNode = NULL;
01536 m_pLastSelectedAttr = NULL;
01537
01538 return NULL;
01539 }
01540
01541
01542
01543
01544
01545
01546
01547
01548
01549
01550
01551
01552 void AttrFillGeometry::RenderFillBlobs()
01553 {
01554 #if !defined(EXCLUDE_FROM_RALPH)
01555 Node *pNode = this;
01556 while ((pNode != NULL) && !pNode->IsKindOf(CC_RUNTIME_CLASS(Spread)))
01557 pNode = pNode->FindParent();
01558
01559 if (pNode == NULL)
01560 return;
01561
01562 Spread* pSpread = (Spread*)pNode;
01563
01564 DocRect Bounds = GetBlobBoundingRect();
01565
01566
01567
01568
01569 RenderRegionList* pRegionList = GetApplication()->GetRegionList();
01570
01571 if (!pRegionList->IsEmpty())
01572 {
01573 RenderRegion* pRegion = (RenderRegion*)pRegionList->GetHead();
01574
01575 while (pRegion)
01576 {
01577
01578 if (pRegion->GetRenderSpread() == pSpread &&
01579 (pRegion->IsInkRenderStarted || pRegion->NeedsOSPaper))
01580 {
01581
01582 DocRect ClipRect = pRegion->GetRegionRect();
01583
01584 if (ClipRect.IsIntersectedWith(Bounds))
01585 {
01586 ClipRect = ClipRect.Intersection(Bounds);
01587 RenderRegion* pRegion = DocView::RenderOnTop(&ClipRect, pSpread, UnclippedEOR);
01588 while (pRegion)
01589 {
01590 RenderFillBlobs(pRegion);
01591 LastRenderedMesh = NULL;
01592
01593
01594 pRegion = DocView::GetNextOnTop(&ClipRect);
01595 }
01596 }
01597 }
01598
01599
01600 pRegion = (RenderRegion*)pRegionList->GetNext(pRegion);
01601 }
01602 }
01603
01604 RenderRegion* pRegion = DocView::RenderOnTop(&Bounds, pSpread, UnclippedEOR);
01605 while (pRegion)
01606 {
01607 RenderFillBlobs(pRegion);
01608 LastRenderedMesh = NULL;
01609
01610
01611 pRegion = DocView::GetNextOnTop(&Bounds);
01612 }
01613
01614
01615
01616
01617 #endif
01618 }
01619
01620
01621
01622
01623
01624
01625
01626
01627
01628
01629
01630
01631
01632
01633
01634
01635
01636
01637
01638
01639
01640
01641
01642
01643
01644 UINT32 AttrFillGeometry::GetSelectionState(BOOL **pOutputState)
01645 {
01646
01647 if (pOutputState==NULL)
01648 return 0;
01649
01650
01651 (*pOutputState=NULL);
01652
01653
01654 UINT32 Count = GetBlobCount();
01655 if (Count==0)
01656 return 0;
01657
01658
01659 BOOL* pArray = (BOOL*)malloc(Count*sizeof(BOOL));
01660 if (pArray==NULL)
01661 return 0;
01662
01663
01664 INT32 i;
01665 for( i = 0; i<5; i++)
01666 {
01667 pArray[i] = IsSelected(i);
01668 }
01669
01670
01671 FillRamp *pRamp = GetFillRamp();
01672 if (pRamp)
01673 pRamp->GetSelectionState(&pArray[i]);
01674
01675
01676 (*pOutputState = pArray);
01677 return Count;
01678 }
01679
01680
01681
01682
01683
01684
01685
01686
01687
01688
01689
01690
01691
01692
01693 UINT32 AttrFillGeometry::GetBlobCount(BOOL IncludeRamps)
01694 {
01695 UINT32 count=5;
01696 if (IncludeRamps)
01697 {
01698 FillRamp *pRamp = GetFillRamp();
01699 if (pRamp)
01700 count+=pRamp->GetCount();
01701 }
01702 return count;
01703 }
01704
01705
01706
01707
01708
01709
01710
01711
01712
01713
01714
01715
01716
01717
01718
01719
01720
01721
01722
01723
01724
01725
01726
01727
01728
01729
01730
01731
01732
01733
01734
01735 FillRamp* AttrFillGeometry::GetFillRamp()
01736 {
01737 FillRamp* pRamp = GetColourRamp();
01738 if (!pRamp) pRamp = GetTranspRamp();
01739 return pRamp;
01740 }
01741
01742
01743
01744
01745
01746
01747
01748
01749
01750
01751
01752
01753
01754
01755
01756
01757 DocColour* AttrFillGeometry::GetFirstSelectedColour()
01758 {
01759
01760
01761 if (IsSelected(FILLCONTROL_STARTPOINT)) return GetStartColour();
01762 if (IsSelected(FILLCONTROL_ENDPOINT)) return GetEndColour();
01763 if (IsSelected(FILLCONTROL_ENDPOINT2)) return GetEndColour2();
01764 if (IsSelected(FILLCONTROL_ENDPOINT3)) return GetEndColour3();
01765
01766
01767 ColourRamp *pRamp = GetColourRamp();
01768 if (pRamp)
01769 return pRamp->GetFirstSelectedColour();
01770
01771
01772 return NULL;
01773 }
01774
01775
01776
01777
01778
01779
01780
01781
01782
01783
01784
01785
01786
01787
01788
01789
01790
01791
01792 UINT32* AttrFillGeometry::GetFirstSelectedTransp()
01793 {
01794 if (IsSelected(FILLCONTROL_STARTPOINT)) return GetStartTransp();
01795 if (IsSelected(FILLCONTROL_ENDPOINT)) return GetEndTransp();
01796 if (IsSelected(FILLCONTROL_ENDPOINT2)) return GetEndTransp2();
01797 if (IsSelected(FILLCONTROL_ENDPOINT3)) return GetEndTransp3();
01798
01799
01800 TransparencyRamp *pRamp = GetTranspRamp();
01801 if (pRamp)
01802 return pRamp->GetFirstSelectedTransp();
01803
01804
01805 return NULL;
01806 }
01807
01808
01809
01810
01811
01812
01813
01814
01815
01816
01817
01818
01819
01820
01821
01822
01823
01824 INT32 AttrFillGeometry::GetFirstSelectedIndex()
01825 {
01826
01827 for (INT32 i=0; i<FILLCONTROL_SECONDARYPOINT; i++)
01828 {
01829 if (IsSelected(i))
01830 return i;
01831 }
01832
01833
01834
01835 FillRamp *pRamp = GetFillRamp();
01836 if (pRamp)
01837 return pRamp->GetSelectedIndex();
01838
01839
01840 return -1;
01841 }
01842
01843
01844
01845
01846
01847
01848
01849
01850
01851
01852
01853
01854
01855
01856
01857
01858
01859
01860
01861
01862
01863
01864
01865
01866
01867
01868
01869
01870
01871
01872
01873
01874
01875
01876
01877
01878
01879
01880
01881
01882
01883
01884
01885
01886
01887
01888
01889
01890
01891
01892 BOOL AttrFillGeometry::IsSelected(UINT32 Control)
01893 {
01894 #if !defined(EXCLUDE_FROM_RALPH)
01895
01896
01897 if (ISA_RAMPINDEX(Control))
01898 {
01899 FillRamp *pRamp = GetFillRamp();
01900 if (pRamp)
01901 return pRamp->IsSelected(Control);
01902 }
01903
01904 ERROR2IF(Control > NUMCONTROLPOINTS, FALSE, "Invalid control point in IsSelected()");
01905
01906
01907 if (Control == FILLCONTROL_SECONDARYPOINT)
01908 return FALSE;
01909
01910 return SelectionState[Control];
01911 #else
01912 return FALSE;
01913 #endif
01914 }
01915
01916
01917
01918
01919
01920
01921
01922
01923
01924
01925
01926
01927
01928
01929
01930
01931
01932 UINT32 AttrFillGeometry::CountSelectionControlPoints()
01933 {
01934 UINT32 Count = 0;
01935
01936 #if !defined(EXCLUDE_FROM_RALPH)
01937 if (!GetApplication()->GetBlobManager()->GetCurrentInterest().Fill)
01938 return 0;
01939
01940 CCRuntimeClass* FillType = IsColourMeshVisible() ? CC_RUNTIME_CLASS(AttrFillGeometry)
01941 : CC_RUNTIME_CLASS(AttrTranspFillGeometry);
01942
01943
01944 AttrFillGeometry* pAttr = FindFirstSelectedAttr(FillType);
01945
01946 while (pAttr != NULL)
01947 {
01948
01949
01950 if (pAttr->IsVisible())
01951 Count += pAttr->GetSelectionCount();
01952
01953
01954 pAttr = FindNextSelectedAttr(FillType);
01955 }
01956
01957 #endif
01958
01959
01960 return Count;
01961 }
01962
01963
01964
01965
01966
01967
01968
01969
01970
01971
01972
01973
01974
01975
01976
01977
01978
01979 UINT32 AttrFillGeometry::GetSelectionCount()
01980 {
01981 UINT32 Count = 0;
01982 #if !defined(EXCLUDE_FROM_RALPH)
01983
01984
01985 for (INT32 i=0; i < FILLCONTROL_SECONDARYPOINT; i++)
01986 {
01987 if (IsSelected(i)) Count++;
01988 }
01989
01990
01991 FillRamp *pRamp = GetFillRamp();
01992 if (pRamp)
01993 Count += pRamp->CountSelBlobs();
01994
01995 #endif
01996
01997 return Count;
01998 }
01999
02000
02001
02002
02003
02004
02005
02006
02007
02008
02009
02010
02011
02012
02013
02014
02015
02016
02017 void AttrFillGeometry::SetBlobState(FillControl HitControl, BOOL NewState)
02018 {
02019 #if !defined(EXCLUDE_FROM_RALPH)
02020 ChangeBlobState(HitControl, (NewState ? BLOBSTATE_ON : BLOBSTATE_OFF));
02021 #endif
02022 }
02023
02024
02025
02026
02027
02028
02029
02030
02031
02032
02033
02034
02035
02036
02037
02038 void AttrFillGeometry::SelectBlob(FillControl HitControl)
02039 {
02040 #if !defined(EXCLUDE_FROM_RALPH)
02041 ChangeBlobState(HitControl, BLOBSTATE_ON);
02042 #endif
02043 }
02044
02045
02046
02047
02048
02049
02050
02051
02052
02053
02054
02055
02056
02057
02058
02059
02060 void AttrFillGeometry::DeselectBlob(FillControl HitControl)
02061 {
02062 #if !defined(EXCLUDE_FROM_RALPH)
02063 ChangeBlobState(HitControl, BLOBSTATE_OFF);
02064 #endif
02065 }
02066
02067
02068
02069
02070
02071
02072
02073
02074
02075
02076
02077
02078
02079
02080
02081 void AttrFillGeometry::ToggleSelection(FillControl HitControl)
02082 {
02083 #if !defined(EXCLUDE_FROM_RALPH)
02084 ChangeBlobState(HitControl, BLOBSTATE_TOGGLE);
02085 #endif
02086 }
02087
02088
02089
02090
02091
02092
02093
02094
02095
02096
02097
02098
02099
02100
02101
02102 void AttrFillGeometry::ChangeBlobState(FillControl HitControl, INT32 state)
02103 {
02104 #if !defined(EXCLUDE_FROM_RALPH)
02105
02106
02107 if (ISA_RAMPINDEX(HitControl))
02108 {
02109 FillRamp *pRamp = GetFillRamp();
02110 if (pRamp)
02111 {
02112 RenderControl(HitControl,FALSE);
02113 pRamp->SetSelState(HitControl,state);
02114 RenderControl(HitControl,state);
02115
02116
02117 }
02118 return;
02119 }
02120
02121
02122 if (HitControl >= FILLCONTROL_DRAGPOINT)
02123 return;
02124
02125
02126 if (HitControl == FILLCONTROL_SECONDARYPOINT)
02127 HitControl = FILLCONTROL_ENDPOINT;
02128
02129
02130 BOOL oldstate = SelectionState[HitControl];
02131 BOOL newstate = oldstate;
02132
02133
02134 switch (state)
02135 {
02136 case BLOBSTATE_OFF:
02137 newstate = FALSE;
02138 break;
02139 case BLOBSTATE_ON:
02140 newstate = TRUE;
02141 break;
02142 case BLOBSTATE_TOGGLE:
02143 newstate = !oldstate;
02144 break;
02145 }
02146
02147
02148 if (oldstate != newstate)
02149 {
02150
02151 RenderControl(HitControl, FALSE);
02152 SelectionState[HitControl] = newstate;
02153
02154 RenderControl(HitControl, TRUE);
02155 SetLastRenderedBlob(HitControl);
02156 }
02157 #endif
02158 }
02159
02160
02161
02162
02163
02164
02165
02166
02167
02168
02169
02170
02171
02172 void AttrFillGeometry::CycleSelection(BOOL Reverse)
02173 {
02174
02175 FillRamp *pRamp = GetFillRamp();
02176 if (pRamp)
02177 {
02178
02179
02180 BOOL StartPointSelected, EndPointSelected;
02181 FillControl Result, OldSelectedBlob;
02182
02183 if (Reverse)
02184 {
02185 StartPointSelected = IsSelected (FILLCONTROL_STARTPOINT);
02186 EndPointSelected = IsSelected (FILLCONTROL_ENDPOINT);
02187
02188 Result = pRamp->RotateSelLeft (StartPointSelected, EndPointSelected, OldSelectedBlob);
02189
02190 switch (Result)
02191 {
02192 case FILLCONTROL_STARTPOINT:
02193 if (OldSelectedBlob != FILLCONTROL_NULL)
02194 {
02195 SetBlobState (OldSelectedBlob, TRUE);
02196 pRamp->SetSelState (OldSelectedBlob, FALSE);
02197 }
02198
02199 SetBlobState (Result, TRUE);
02200 break;
02201 case FILLCONTROL_ENDPOINT:
02202 ToggleSelection(FILLCONTROL_STARTPOINT);
02203 SetBlobState (Result, TRUE);
02204 break;
02205 default:
02206 if (ISA_RAMPINDEX (Result))
02207 {
02208 if (StartPointSelected) { SetBlobState (FILLCONTROL_STARTPOINT, FALSE); }
02209 if (EndPointSelected) { SetBlobState (FILLCONTROL_ENDPOINT, FALSE); }
02210
02211 if (OldSelectedBlob != FILLCONTROL_NULL)
02212 {
02213 SetBlobState (OldSelectedBlob, TRUE);
02214 pRamp->SetSelState (OldSelectedBlob, FALSE);
02215 }
02216 SetBlobState (Result, TRUE);
02217 }
02218
02219
02220 return;
02221 }
02222 }
02223 else
02224 {
02225 StartPointSelected = IsSelected (FILLCONTROL_STARTPOINT);
02226 EndPointSelected = IsSelected (FILLCONTROL_ENDPOINT);
02227
02228 Result = pRamp->RotateSelRight (StartPointSelected, EndPointSelected, OldSelectedBlob);
02229
02230 switch (Result)
02231 {
02232 case FILLCONTROL_STARTPOINT:
02233 ToggleSelection(FILLCONTROL_ENDPOINT);
02234 SetBlobState (Result, TRUE);
02235 break;
02236 case FILLCONTROL_ENDPOINT:
02237 if (OldSelectedBlob != FILLCONTROL_NULL)
02238 {
02239 SetBlobState (OldSelectedBlob, TRUE);
02240 pRamp->SetSelState (OldSelectedBlob, FALSE);
02241 }
02242
02243 SetBlobState (Result, TRUE);
02244 break;
02245 default:
02246 if (ISA_RAMPINDEX (Result))
02247 {
02248 if (StartPointSelected) { SetBlobState (FILLCONTROL_STARTPOINT, FALSE); }
02249 if (EndPointSelected) { SetBlobState (FILLCONTROL_ENDPOINT, FALSE); }
02250
02251 if (OldSelectedBlob != FILLCONTROL_NULL)
02252 {
02253 SetBlobState (OldSelectedBlob, TRUE);
02254 pRamp->SetSelState (OldSelectedBlob, FALSE);
02255 }
02256 SetBlobState (Result, TRUE);
02257 }
02258
02259
02260 return;
02261 }
02262 }
02263 return;
02264 }
02265 else
02266 {
02267 if (GetSelectionCount() == 1)
02268 {
02269 ToggleSelection(FILLCONTROL_STARTPOINT);
02270 ToggleSelection(FILLCONTROL_ENDPOINT);
02271 }
02272 }
02273 }
02274
02275
02276
02277
02278
02279
02280
02281
02282
02283
02284
02285
02286
02287 void AttrFillGeometry::DeselectAllNoRedraw()
02288 {
02289 #if !defined(EXCLUDE_FROM_RALPH)
02290
02291 SelectionState[FILLCONTROL_STARTPOINT] = FALSE;
02292 SelectionState[FILLCONTROL_ENDPOINT] = FALSE;
02293 SelectionState[FILLCONTROL_ENDPOINT2] = FALSE;
02294 SelectionState[FILLCONTROL_ENDPOINT3] = FALSE;
02295 SelectionState[FILLCONTROL_SECONDARYPOINT] = FALSE;
02296
02297 FillRamp *pRamp = GetFillRamp();
02298 if (pRamp)
02299 pRamp->DeselectAll();
02300 #endif
02301 }
02302
02303
02304
02305
02306
02307
02308
02309
02310
02311
02312
02313 void AttrFillGeometry::DeselectAll()
02314 {
02315 #if !defined(EXCLUDE_FROM_RALPH)
02316
02317 ChangeBlobState(FILLCONTROL_STARTPOINT,BLOBSTATE_OFF);
02318 ChangeBlobState(FILLCONTROL_ENDPOINT ,BLOBSTATE_OFF);
02319 ChangeBlobState(FILLCONTROL_ENDPOINT2 ,BLOBSTATE_OFF);
02320 ChangeBlobState(FILLCONTROL_ENDPOINT3 ,BLOBSTATE_OFF);
02321
02322
02323 FillRamp *pRamp = GetFillRamp();
02324 if (pRamp)
02325 {
02326 UINT32 first,last;
02327 if (pRamp->GetIndexRange(&first,&last))
02328 {
02329 for (UINT32 i=first; i<=last; i++)
02330 ChangeBlobState(i ,BLOBSTATE_OFF);
02331 }
02332 }
02333 #endif
02334 }
02335
02336
02337
02338
02339
02340
02341
02342
02343
02344
02345
02346
02347 void AttrFillGeometry::DeselectAllBut(FillControl HitControl)
02348 {
02349 #if !defined(EXCLUDE_FROM_RALPH)
02350
02351 if (HitControl == FILLCONTROL_SECONDARYPOINT)
02352 HitControl = FILLCONTROL_ENDPOINT;
02353
02354 for (INT32 i=0; i<FILLCONTROL_SECONDARYPOINT; i++)
02355 {
02356 if ((HitControl!=i) && SelectionState[i])
02357 ChangeBlobState(i,BLOBSTATE_OFF);
02358 }
02359
02360
02361 FillRamp *pRamp = GetFillRamp();
02362 if (pRamp)
02363 {
02364 UINT32 first,last;
02365 UINT32 hc = (UINT32)HitControl;
02366 if (pRamp->GetIndexRange(&first,&last))
02367 {
02368 for (UINT32 i=first; i<=last; i++)
02369 if (hc!=i)
02370 ChangeBlobState(i ,BLOBSTATE_OFF);
02371 }
02372 }
02373
02374 #endif
02375 }
02376
02377
02378
02379
02380
02381
02382
02383
02384
02385
02386
02387
02388
02389
02390
02391 FillControl AttrFillGeometry::CheckForControlHit(DocCoord &ClickPos)
02392 {
02393
02394 FillControl HitControl = FILLCONTROL_NULL;
02395 DocRect BlobRect;
02396
02397 if (!GetApplication()->GetBlobManager()->GetCurrentInterest().Fill || !IsVisible())
02398 return FILLCONTROL_NULL;
02399
02400
02401 FillRamp *pRamp = GetFillRamp();
02402 if (pRamp)
02403 {
02404
02405 HitControl = pRamp->HitBlob(ATTRVALUE(), ClickPos);
02406 if (!ISA_RAMPINDEX(HitControl))
02407 {
02408 HitControl=FILLCONTROL_NULL;
02409 }
02410 else
02411 {
02412
02413 return (HitControl);
02414 }
02415 }
02416
02417
02418 if (GetStartPoint() != NULL)
02419 {
02420
02421 (Camelot.GetBlobManager())->GetBlobRect(*GetStartPoint(), &BlobRect);
02422
02423 if ( BlobRect.ContainsCoord(ClickPos) )
02424 HitControl = FILLCONTROL_STARTPOINT;
02425 }
02426
02427 if (GetEndPoint() != NULL)
02428 {
02429
02430 (Camelot.GetBlobManager())->GetBlobRect(*GetEndPoint(), &BlobRect);
02431
02432 if ( BlobRect.ContainsCoord(ClickPos) )
02433 HitControl = FILLCONTROL_ENDPOINT;
02434 }
02435
02436 if (GetEndPoint2() != NULL)
02437 {
02438
02439 (Camelot.GetBlobManager())->GetBlobRect(*GetEndPoint2(), &BlobRect);
02440
02441 if ( BlobRect.ContainsCoord(ClickPos) )
02442 HitControl = FILLCONTROL_SECONDARYPOINT;
02443 }
02444
02445 if (DoCheckOnFillRampMesh)
02446 {
02447
02448 if (HitControl == FILLCONTROL_NULL)
02449 {
02450
02451
02452 if (GetStartPoint() != NULL && GetEndPoint() != NULL)
02453 {
02454
02455 DocCoord StartPoint = *(GetStartPoint());
02456 DocCoord EndPoint = *(GetEndPoint());
02457
02458 double d = FindRampPoint(ClickPos, StartPoint, EndPoint);
02459
02460 if ( d > 0 && d < 1.0)
02461 {
02462 HitControl = FILLCONTROL_RAMPPOINT;
02463 }
02464 }
02465 }
02466 }
02467
02468 return HitControl;
02469 }
02470
02471
02472
02473
02474
02475
02476
02477
02478
02479
02480
02481
02482
02483
02484 void AttrFillGeometry::RenderControl(FillControl Control, BOOL RenderOn)
02485 {
02486 #if !defined(EXCLUDE_FROM_RALPH)
02487 DocRect ControlRect;
02488
02489
02490
02491 NodeRenderable* pParent = (NodeRenderable*)FindParent();
02492 if (pParent == NULL)
02493 return;
02494
02495 if (IsBlobSame(Control))
02496 return;
02497
02498 Spread* pSpread = this->FindParentSpread();
02499
02500 if (ISA_RAMPINDEX(Control))
02501 {
02502 FillRamp* pRamp = GetFillRamp();
02503 if (pRamp)
02504 {
02505 DocCoord point = pRamp->GetGeometryCoord(ATTRVALUE(), Control);
02506 (Camelot.GetBlobManager())->GetBlobRect(point, &ControlRect, TRUE);
02507 RenderFillControl(RenderOn, &ControlRect, pSpread, pParent);
02508 }
02509 return;
02510 }
02511
02512 switch (Control)
02513 {
02514 case FILLCONTROL_STARTPOINT:
02515 if (GetStartPoint() != NULL)
02516 {
02517
02518 (Camelot.GetBlobManager())->GetBlobRect(*GetStartPoint(), &ControlRect);
02519 RenderFillControl(RenderOn, &ControlRect, pSpread, pParent);
02520 }
02521 break;
02522
02523 case FILLCONTROL_ENDPOINT:
02524 case FILLCONTROL_SECONDARYPOINT:
02525 {
02526 if (GetEndPoint() != NULL)
02527 {
02528
02529 (Camelot.GetBlobManager())->GetBlobRect(*GetEndPoint(), &ControlRect);
02530 RenderFillControl(RenderOn, &ControlRect, pSpread, pParent);
02531 }
02532
02533 if (GetEndPoint2() != NULL)
02534 {
02535 (Camelot.GetBlobManager())->GetBlobRect(*GetEndPoint2(), &ControlRect);
02536 RenderFillControl(RenderOn, &ControlRect, pSpread, pParent);
02537 }
02538 }
02539 break;
02540 }
02541 #endif
02542 }
02543
02544
02545
02546
02547
02548
02549
02550
02551
02552
02553
02554
02555
02556 void AttrFillGeometry::RenderFillControl(BOOL RenderOn,
02557 DocRect* ControlRect,
02558 Spread* pSpread,
02559 NodeRenderable* pParent)
02560 {
02561 #if !defined(EXCLUDE_FROM_RALPH)
02562 if (!RenderOn)
02563 {
02564 RenderControlIntoPendingRegions(ControlRect, pSpread, pParent);
02565 }
02566
02567 (Camelot.GetBlobManager())->RenderMyBlobs(ControlRect, pSpread, pParent);
02568 AttrFillGeometry::LastRenderedMesh = NULL;
02569
02570 if (RenderOn)
02571 {
02572 RenderControlIntoPendingRegions(ControlRect, pSpread, pParent);
02573 }
02574 #endif
02575 }
02576
02577
02578
02579
02580
02581
02582
02583
02584
02585
02586
02587
02588 void AttrFillGeometry::RenderControlIntoPendingRegions( DocRect* ControlRect,
02589 Spread* pSpread,
02590 NodeRenderable* pParent)
02591 {
02592 #if !defined(EXCLUDE_FROM_RALPH)
02593 RenderRegionList* pRegionList = GetApplication()->GetRegionList();
02594
02595 if (!pRegionList->IsEmpty())
02596 {
02597 RenderRegion* pRegion = (RenderRegion*)pRegionList->GetHead();
02598
02599 while (pRegion)
02600 {
02601
02602 if (pRegion->GetRenderSpread() == pSpread &&
02603 (pRegion->IsInkRenderStarted || pRegion->NeedsOSPaper))
02604 {
02605
02606 DocRect ClipRect = pRegion->GetRegionRect();
02607
02608 if (ClipRect.IsIntersectedWith(*ControlRect))
02609 {
02610 ClipRect = ClipRect.Intersection(*ControlRect);
02611 (Camelot.GetBlobManager())->RenderMyBlobs(&ClipRect, pSpread, pParent);
02612 }
02613 }
02614
02615
02616 pRegion = (RenderRegion*)pRegionList->GetNext(pRegion);
02617 }
02618 }
02619
02620 AttrFillGeometry::LastRenderedMesh = NULL;
02621 #endif
02622 }
02623
02624
02625
02626
02627
02628
02629
02630
02631
02632
02633
02634
02635
02636
02637 void AttrFillGeometry::OnControlDrag( DocCoord Pos, FillControl& DragControl, ClickModifiers ClickMods)
02638 {
02639 #if !defined(EXCLUDE_FROM_RALPH)
02640
02641
02642
02643 if (ISA_RAMPINDEX(DragControl))
02644 {
02645
02646
02647
02648
02649
02650
02651
02652 FillRamp *pRamp = GetFillRamp();
02653 if (pRamp)
02654 {
02655 float t = ATTRVALUE()->GetGeometryParam(Pos);
02656
02657 FillControl NewDragControl = pRamp->SetPosition(DragControl, t);
02658
02659 if (NewDragControl != DragControl)
02660 {
02661 DragControl = NewDragControl;
02662 }
02663
02664 }
02665 return;
02666 }
02667
02668
02669 ERROR3IF(DragControl > NUMCONTROLPOINTS, "Invalid control point in OnControlDrag()");
02670
02671
02672 switch (DragControl)
02673 {
02674 case FILLCONTROL_STARTPOINT:
02675
02676 if (GetStartPoint() != NULL)
02677 {
02678
02679 if (ClickMods.Constrain)
02680 {
02681
02682
02683 DocView::ConstrainToAngle(*GetEndPoint(), &Pos);
02684 }
02685
02686 SetStartPoint(&Pos);
02687 DocCoord temp = MakeLineAtAngle(*GetStartPoint(), *GetEndPoint(), 90);
02688 SetEndPoint2(&temp);
02689 }
02690 break;
02691
02692 case FILLCONTROL_ENDPOINT:
02693
02694 if (GetEndPoint() != NULL)
02695 {
02696
02697 if (ClickMods.Constrain)
02698 {
02699
02700
02701 DocView::ConstrainToAngle(*GetStartPoint(), &Pos);
02702 }
02703
02704 SetEndPoint(&Pos);
02705 DocCoord temp = MakeLineAtAngle(*GetStartPoint(), *GetEndPoint(), 90);
02706 SetEndPoint2(&temp);
02707 }
02708 break;
02709
02710 case FILLCONTROL_SECONDARYPOINT:
02711
02712 if (GetEndPoint2() != NULL)
02713 {
02714
02715 if (ClickMods.Constrain)
02716 {
02717
02718
02719 DocView::ConstrainToAngle(*GetStartPoint(), &Pos);
02720 }
02721
02722 SetEndPoint2(&Pos);
02723 }
02724 break;
02725 }
02726 #endif
02727 }
02728
02729 void AttrFillGeometry::SetAspectRatio(double Ratio)
02730 {
02731 #if !defined(EXCLUDE_FROM_RALPH)
02732 DocCoord Start = *GetStartPoint();
02733 DocCoord End = *GetEndPoint();
02734
02735 DocCoord End2 = MakeLineAtAngle(Start,
02736 End,
02737 90,
02738 INT32(Start.Distance(End) * Ratio)
02739 );
02740
02741 SetEndPoint2(&End2);
02742 #endif
02743 }
02744
02745
02746
02747
02748
02749
02750
02751
02752
02753
02754
02755
02756
02757
02758 void AttrFillGeometry::GetControlPoints(DocCoord* PointArray, INT32 NumControls)
02759 {
02760 #if !defined(EXCLUDE_FROM_RALPH)
02761
02762 if (NumControls > NUMCONTROLPOINTS)
02763 NumControls = NUMCONTROLPOINTS;
02764
02765
02766 DocCoord Controls[NUMCONTROLPOINTS];
02767
02768 if (GetStartPoint() != NULL)
02769 Controls[FILLCONTROL_STARTPOINT] = *GetStartPoint();
02770 if (GetEndPoint() != NULL)
02771 Controls[FILLCONTROL_ENDPOINT] = *GetEndPoint();
02772 if (GetEndPoint2() != NULL)
02773 Controls[FILLCONTROL_SECONDARYPOINT] = *GetEndPoint2();
02774 if (GetEndPoint2() != NULL)
02775 Controls[FILLCONTROL_ENDPOINT2] = *GetEndPoint2();
02776 if (GetEndPoint3() != NULL)
02777 Controls[FILLCONTROL_ENDPOINT3] = *GetEndPoint3();
02778
02779
02780 for (INT32 i=0; i < NumControls; i++)
02781 {
02782 PointArray[i] = Controls [i];
02783 }
02784 #endif
02785 }
02786
02787
02788
02789
02790
02791
02792
02793
02794
02795
02796
02797
02798
02799
02800
02801 void AttrFillGeometry::SetBoundingRect(DocRect &NewBounds)
02802 {
02803
02804
02805
02806 AttrBounds = NewBounds;
02807 }
02808
02809
02810
02811
02812
02813
02814
02815
02816
02817
02818
02819
02820 BOOL AttrFillGeometry::WriteBoundingRect(BaseCamelotFilter* pFilter)
02821 {
02822 BOOL ok = TRUE;
02823
02824 CamelotFileRecord Rec(pFilter, TAG_CURRENTATTRIBUTEBOUNDS, TAG_CURRENTATTRIBUTEBOUNDS_SIZE);
02825
02826 ok = Rec.Init();
02827
02828 if (ok) ok = Rec.WriteCoord(AttrBounds.lo);
02829 if (ok) ok = Rec.WriteCoord(AttrBounds.hi);
02830
02831
02832
02833 INT32 RecordNumber = 0L;
02834 if (ok) RecordNumber = pFilter->Write(&Rec);
02835
02836
02837 return (ok && RecordNumber > 0);
02838 }
02839
02840
02841
02842
02843
02844
02845
02846
02847
02848
02849
02850
02851
02852 void AttrFillGeometry::TransformSelectedControlPoints( TransformBase& Trans, BOOL* isARampBlob )
02853 {
02854 #if !defined(EXCLUDE_FROM_RALPH)
02855 if ( Trans.TransFills )
02856 {
02857 ClickModifiers ClickMods;
02858 ClickMods.Adjust = TRUE;
02859
02860 if (GetStartPoint() && IsSelected(FILLCONTROL_STARTPOINT))
02861 {
02862 DocCoord Pos = *GetStartPoint();
02863 Trans.Transform( &Pos, 1);
02864
02865 FillControl Start = FILLCONTROL_STARTPOINT;
02866
02867 OnControlDrag(Pos, Start, ClickMods);
02868 }
02869
02870 if (GetEndPoint() && IsSelected(FILLCONTROL_ENDPOINT))
02871 {
02872 DocCoord Pos = *GetEndPoint();
02873 Trans.Transform( &Pos, 1);
02874
02875 FillControl End = FILLCONTROL_ENDPOINT;
02876
02877 OnControlDrag(Pos, End, ClickMods);
02878 }
02879
02880
02881
02882 TransformSelectedFillRampControlPoints (Trans, ClickMods, isARampBlob);
02883 }
02884 #endif
02885 }
02886
02887
02888
02889
02890
02891
02892
02893
02894
02895
02896
02897
02898
02899
02900
02901 void AttrFillGeometry::TransformSelectedFillRampControlPoints (TransformBase& Trans, ClickModifiers ClickMods, BOOL* isARampBlob)
02902 {
02903 if (GetFillRamp ())
02904 {
02905
02906
02907 FillRamp* pRamp = GetFillRamp ();
02908
02909
02910
02911
02912
02913
02914 if (pRamp->CountSelBlobs () > 0)
02915 {
02916 ERROR3IF (pRamp->CountSelBlobs () > 1, "More than one blob is selected! (extras will be ignored)");
02917
02918 if (isARampBlob)
02919 {
02920 *isARampBlob = TRUE;
02921 }
02922
02923
02924
02925 INT32 sel = pRamp->GetSelectedIndex ();
02926
02927 DocCoord Pos = pRamp->GetGeometryCoord ((FillGeometryAttribute*) GetAttributeValue (), sel);
02928 Trans.Transform( &Pos, 1);
02929
02930 FillControl control = sel;
02931
02932
02933 OnControlDrag(Pos, control, ClickMods);
02934
02935 }
02936 }
02937 }
02938
02939
02940
02941
02942
02943
02944
02945
02946
02947
02948
02949
02950
02951
02952
02953
02954
02955 void AttrFillGeometry::TransformToNewBounds(DocRect& NewBounds)
02956 {
02957 #if !defined(EXCLUDE_FROM_RALPH)
02958
02959 DocRect AttrBounds = GetBoundingRect();
02960
02961
02962
02963 if (!NewBounds.IsEmpty() && !AttrBounds.IsEmpty())
02964 {
02965
02966 INT32 NodeWidth = NewBounds.Width();
02967 INT32 NodeHeight = NewBounds.Height();
02968 INT32 AttrWidth = AttrBounds.Width();
02969 INT32 AttrHeight = AttrBounds.Height();
02970
02971
02972 NewBounds.Translate(NodeWidth/2, NodeHeight/2);
02973 AttrBounds.Translate(AttrWidth/2, AttrHeight/2);
02974 DocCoord NodeCentre = NewBounds.lo;
02975 DocCoord AttrCentre = AttrBounds.lo;
02976
02977
02978
02979 Matrix AttrTrans = Matrix(-AttrCentre.x, -AttrCentre.y);
02980
02981
02982 if (!IS_KIND_OF(AttrBitmapFill))
02983 {
02984
02985 AttrTrans *= Matrix(FIXED16(double(NodeWidth) / double(AttrWidth)),
02986 FIXED16(double(NodeHeight) / double(AttrHeight)));
02987 }
02988
02989
02990 AttrTrans *= Matrix(NodeCentre.x, NodeCentre.y);
02991 Trans2DMatrix Trans = Trans2DMatrix(AttrTrans);
02992
02993
02994 Transform(Trans);
02995 }
02996 #endif
02997 }
02998
02999
03000
03001
03002
03003
03004
03005
03006
03007
03008
03009
03010
03011
03012
03013
03014
03015
03016
03017
03018
03019
03020
03021
03022
03023 BOOL AttrFillGeometry::CopyComponentData(BaseDocument* SrcDoc, BaseDocument* NodesDoc)
03024 {
03025
03026 if (!NodeRenderable::CopyComponentData(SrcDoc, NodesDoc))
03027 {
03028 return FALSE;
03029 }
03030
03031 ColourListComponent *pComponent =
03032 (ColourListComponent *) NodesDoc->GetDocComponent(CC_RUNTIME_CLASS(ColourListComponent));
03033
03034 ENSURE (pComponent != NULL, "Could not find ColourListComponent");
03035
03036
03037
03038 DocColour* pDocCol = GetStartColour ();
03039 if (pDocCol) if (pComponent->CopyColourAcross(pDocCol) == CCCOPY_FAILED) { return (FALSE); }
03040 pDocCol = GetEndColour ();
03041 if (pDocCol) if (pComponent->CopyColourAcross(pDocCol) == CCCOPY_FAILED) { return (FALSE); }
03042 pDocCol = GetEndColour2 ();
03043 if (pDocCol) if (pComponent->CopyColourAcross(pDocCol) == CCCOPY_FAILED) { return (FALSE); }
03044 pDocCol = GetEndColour3 ();
03045 if (pDocCol) if (pComponent->CopyColourAcross(pDocCol) == CCCOPY_FAILED) { return (FALSE); }
03046
03047 ColourRamp *pRamp = GetColourRamp();
03048
03049 if (pRamp)
03050 {
03051 return (pRamp->CopyComponentData (SrcDoc, NodesDoc));
03052 }
03053
03054 return (TRUE);
03055 }
03056
03057
03058
03059
03060
03061
03062
03063
03064
03065
03066
03067
03068
03069
03070 DocRect AttrFillGeometry::GetBlobBoundingRect()
03071 {
03072 #if !defined(EXCLUDE_FROM_RALPH)
03073
03074
03075
03076 if ( (!GetApplication()->GetBlobManager()->GetCurrentInterest(TRUE).Fill || !IsVisible()) && DraggedFill != this )
03077 return DocRect(0,0, 0,0);
03078
03079 DocCoord StartPoint = DocCoord(0,0);
03080 DocCoord EndPoint = DocCoord(0,0);
03081
03082
03083 if (GetStartPoint() != NULL)
03084 StartPoint = *GetStartPoint();
03085 if (GetEndPoint() != NULL)
03086 EndPoint = *GetEndPoint();
03087
03088 DocRect StartBlobRect;
03089 DocRect EndBlobRect;
03090
03091 DocRect BoundingRect(StartPoint, StartPoint);
03092
03093
03094 (Camelot.GetBlobManager())->GetBlobRect(StartPoint, &StartBlobRect);
03095 (Camelot.GetBlobManager())->GetBlobRect(EndPoint, &EndBlobRect);
03096
03097
03098
03099
03100 BoundingRect.IncludePoint(StartBlobRect.lo);
03101 BoundingRect.IncludePoint(StartBlobRect.hi);
03102 BoundingRect.IncludePoint(EndBlobRect.lo);
03103 BoundingRect.IncludePoint(EndBlobRect.hi);
03104
03105 IncludeArrowHead(&BoundingRect, StartPoint, EndPoint);
03106
03107
03108 return BoundingRect;
03109 #else
03110 return DocRect(0,0, 0,0);
03111 #endif
03112 }
03113
03114
03115
03116
03117
03118
03119
03120
03121
03122
03123
03124
03125
03126
03127
03128
03129 void AttrFillGeometry::AttributeChanged()
03130 {
03131 ValidateAttributeValue();
03132 }
03133
03134
03135
03136
03137
03138
03139
03140
03141
03142
03143
03144
03145
03146
03147
03148
03149
03150
03151
03152
03153
03154
03155
03156
03157
03158
03159 AttrFillGeometry* AttrFillGeometry::Mutate(AttrFillGeometry* Mutator, BOOL bOptimise)
03160 {
03161 AttrFillGeometry* NewFill = NULL;
03162 #if !defined(EXCLUDE_FROM_RALPH)
03163
03164
03165
03166
03167
03168 if ( Mutator->IsAValueChange() &&
03169 Mutator->GetAttributeType() == GetAttributeType() )
03170 {
03171
03172
03173
03174 NewFill = ((AttrValueChange*)Mutator)->MutateFill(this);
03175 if (NewFill == NULL)
03176 return NULL;
03177 }
03178 else
03179 {
03180
03181
03182
03183
03184 if (IsPerspective() &&
03185 (Mutator->GetRuntimeClass() != GetRuntimeClass()))
03186 return NULL;
03187
03188
03189 CCRuntimeClass* ObjectType = Mutator->GetRuntimeClass();
03190 NewFill = (AttrFillGeometry*)ObjectType->CreateObject();
03191 if (NewFill == NULL)
03192 return NULL;
03193
03194
03195 NewFill->AttrBounds = AttrBounds;
03196
03197
03198 *((FillGeometryAttribute*)NewFill->GetAttributeValue()) = *((FillGeometryAttribute*)this->GetAttributeValue());
03199
03200 if ((!NewFill->IsABitmapFill() || NewFill->IsAFractalFill()) &&
03201 FindParent() != NULL && FindParent()->IsNodeDocument())
03202 {
03203
03204
03205 DocColour DefFillCol;
03206 AttributeManager::FindDefaultColour(ColourManager::GetCurrentColourList(),
03207 _R(IDS_BLACKNAME), &DefFillCol);
03208 if (NewFill->IsAFlatFill())
03209 NewFill->SetStartColour(&DefFillCol);
03210 else
03211 NewFill->SetEndColour(&DefFillCol);
03212 }
03213
03214
03215 ((FillGeometryAttribute*)NewFill->GetAttributeValue())->
03216 SetAspectLock(((FillGeometryAttribute*)Mutator->GetAttributeValue())->IsAspectLocked());
03217
03218
03219 ((FillGeometryAttribute*)NewFill->GetAttributeValue())->
03220 SetProfile(((FillGeometryAttribute*)this->GetAttributeValue())->GetProfile());
03221
03222
03223 ((FillGeometryAttribute*)NewFill->GetAttributeValue())->
03224 SetTranspType(((FillGeometryAttribute*)this->GetAttributeValue())->GetTranspType());
03225
03226
03227 if (this->IsAFractalFill() && Mutator->IsAFractalFill())
03228 {
03229
03230 ((FillGeometryAttribute*)NewFill->GetAttributeValue())->
03231 SetGraininess(((FillGeometryAttribute*)this->GetAttributeValue())->GetGraininess());
03232 }
03233
03234 if (!OpEditFill::CreateFill)
03235 {
03236 if (Mutator->GetBitmap() == NULL && !this->IsAFractalFill())
03237 {
03238
03239
03240 NewFill->CopyBitmap(KernelBitmap::MakeKernelBitmap());
03241 }
03242 else
03243 {
03244
03245 NewFill->CopyBitmap(Mutator->GetBitmap());
03246 }
03247
03248
03249 ((FillGeometryAttribute*)NewFill->GetAttributeValue())->
03250 SetSeed(((FillGeometryAttribute*)Mutator->GetAttributeValue())->GetSeed());
03251
03252 NewFill->RecalcFractal();
03253 }
03254 else
03255 {
03256 NewFill->SetStartPoint(Mutator->GetStartPoint());
03257 NewFill->SetEndPoint(Mutator->GetEndPoint());
03258 NewFill->SetEndPoint2(Mutator->GetEndPoint2());
03259 }
03260
03261
03262
03263
03264
03265
03266
03267
03268
03269
03270
03271
03272
03273 NewFill->SetBlobState(FILLCONTROL_ENDPOINT, TRUE);
03274
03275
03276
03277
03278 Mutator->SetTileable(NewFill->GetTileable());
03279 }
03280
03281
03282
03283
03284
03285
03286
03287 if (NewFill != NULL && *NewFill == *this && bOptimise)
03288 {
03289
03290 delete NewFill;
03291 return NULL;
03292 }
03293
03294 #endif
03295
03296 return NewFill;
03297 }
03298
03299
03300
03301
03302
03303
03304
03305
03306
03307
03308
03309
03310
03311
03312 AttrFillGeometry* AttrFillGeometry::ChangeColour(AttrValueChange* Mutator)
03313 {
03314 AttrFillGeometry* NewFill = NULL;
03315
03316 #if !defined(EXCLUDE_FROM_RALPH)
03317
03318 NewFill = (AttrFillGeometry*)this->SimpleCopy();
03319 if (NewFill == NULL)
03320 return NULL;
03321
03322 if (Mutator->MutateFill(NewFill))
03323 return NewFill;
03324
03325 BOOL Changed = NewFill->ChangeControlColour( (AttrColourChange*)Mutator );
03326
03327
03328 if (!Changed)
03329 {
03330
03331
03332 if (IsVisible() && SelectionCount > 0)
03333 return NewFill;
03334
03335
03336 delete NewFill;
03337 NewFill = new AttrFlatColourFill;
03338 if (NewFill == NULL)
03339 return NULL;
03340
03341
03342 *(FillGeometryAttribute*)(NewFill->GetAttributeValue()) = *(FillGeometryAttribute*)(Mutator->GetAttributeValue());
03343
03344 if (GetApplication()->GetBlobManager()->GetCurrentInterest().Fill && IsVisible())
03345 RenderFillBlobs();
03346 }
03347 #endif
03348
03349
03350 return NewFill;
03351 }
03352
03353
03354
03355
03356
03357
03358
03359
03360
03361
03362
03363
03364
03365
03366
03367 AttrFillGeometry* AttrFillGeometry::ChangeTransp(AttrValueChange* Mutator)
03368 {
03369 AttrFillGeometry* NewFill = NULL;
03370
03371 #if !defined(EXCLUDE_FROM_RALPH)
03372
03373 NewFill = (AttrFillGeometry*)this->SimpleCopy();
03374 if (NewFill == NULL)
03375 return NULL;
03376
03377 if (Mutator->MutateFill(NewFill))
03378 return NewFill;
03379
03380 BOOL Changed = NewFill->ChangeControlTransp( (AttrTranspChange*)Mutator );
03381
03382
03383 if (!Changed)
03384 {
03385
03386
03387 if (IsVisible() && SelectionCount > 0)
03388 return NewFill;
03389
03390
03391 delete NewFill;
03392 NewFill = new AttrFlatTranspFill;
03393 if (NewFill == NULL)
03394 return NULL;
03395
03396
03397 *(FillGeometryAttribute*)(NewFill->GetAttributeValue()) = *(FillGeometryAttribute*)(Mutator->GetAttributeValue());
03398
03399 NewFill->SetTranspType(GetTranspType());
03400
03401 if (GetApplication()->GetBlobManager()->GetCurrentInterest().Fill && IsVisible())
03402 RenderFillBlobs();
03403 }
03404 #endif
03405
03406
03407 return NewFill;
03408 }
03409
03410
03411
03412
03413
03414
03415
03416
03417
03418
03419
03420
03421
03422
03423 BOOL AttrFillGeometry::ChangeControlColour( AttrColourChange* ColourAttr )
03424 {
03425 #if !defined(EXCLUDE_FROM_RALPH)
03426 if (!GetApplication()->GetBlobManager()->GetCurrentInterest().Fill || !IsVisible())
03427 return FALSE;
03428
03429 BOOL ColChanged = FALSE;
03430
03431 DocColour NewColour = *ColourAttr->GetStartColour();
03432
03433
03434 if (SelectionState[FILLCONTROL_STARTPOINT] )
03435 {
03436
03437 SetStartColour(&NewColour);
03438 ColChanged = TRUE;
03439 }
03440
03441
03442 if (SelectionState[FILLCONTROL_ENDPOINT] )
03443 {
03444
03445 SetEndColour(&NewColour);
03446 ColChanged = TRUE;
03447 }
03448
03449
03450 if (SelectionState[FILLCONTROL_ENDPOINT2] )
03451 {
03452
03453 SetEndColour2(&NewColour);
03454 ColChanged = TRUE;
03455 }
03456
03457
03458 if (SelectionState[FILLCONTROL_ENDPOINT3] )
03459 {
03460
03461 SetEndColour3(&NewColour);
03462 ColChanged = TRUE;
03463 }
03464
03465
03466 ColourRamp *pRamp = GetColourRamp();
03467 if (pRamp)
03468 {
03469
03470 if (pRamp->SetSelectedColours(&NewColour)>0)
03471 ColChanged=TRUE;
03472 }
03473
03474
03475 return (ColChanged);
03476 #else
03477 return FALSE;
03478 #endif
03479 }
03480
03481
03482
03483
03484
03485
03486
03487
03488
03489
03490
03491
03492
03493
03494 BOOL AttrFillGeometry::ChangeControlTransp( AttrTranspChange* TranspAttr )
03495 {
03496 #if !defined(EXCLUDE_FROM_RALPH)
03497 if (!GetApplication()->GetBlobManager()->GetCurrentInterest().Fill || !IsVisible())
03498 return FALSE;
03499
03500 if (GetStartTransp() == NULL)
03501 return FALSE;
03502
03503 BOOL TranspChanged = FALSE;
03504
03505
03506 UINT32 NewTransp = *TranspAttr->GetStartTransp();
03507
03508
03509 if (SelectionState[FILLCONTROL_STARTPOINT])
03510 {
03511
03512 SetStartTransp(&NewTransp);
03513 TranspChanged = TRUE;
03514 }
03515
03516
03517 if (SelectionState[FILLCONTROL_ENDPOINT])
03518 {
03519
03520 SetEndTransp(&NewTransp);
03521 TranspChanged = TRUE;
03522 }
03523
03524
03525 if (SelectionState[FILLCONTROL_ENDPOINT2])
03526 {
03527
03528 SetEndTransp2(&NewTransp);
03529 TranspChanged = TRUE;
03530 }
03531
03532
03533 if (SelectionState[FILLCONTROL_ENDPOINT3])
03534 {
03535
03536 SetEndTransp3(&NewTransp);
03537 TranspChanged = TRUE;
03538 }
03539
03540
03541 TransparencyRamp *pRamp = GetTranspRamp();
03542 if (pRamp)
03543 {
03544
03545 if (pRamp->SetSelectedTransp(NewTransp)>0)
03546 TranspChanged=TRUE;
03547 }
03548
03549
03550 return TranspChanged;
03551 #else
03552 return FALSE;
03553 #endif
03554 }
03555
03556
03557
03558
03559
03560
03561
03562
03563
03564
03565
03566
03567
03568
03569
03570 BOOL AttrFillGeometry::EditColourFillRamp( AttrColFillRampChange *pRampAttr )
03571 {
03572 #if !defined(EXCLUDE_FROM_RALPH)
03573
03574
03575 if (pRampAttr==NULL)
03576 return FALSE;
03577
03578 BOOL Changed = FALSE;
03579 ColourRamp *pCRamp;
03580
03581 switch (pRampAttr->GetAction())
03582 {
03583 case ACT_DONOTHING:
03584
03585 ERROR3("Someone's forgotten to set the edit action of the RampChange attr");
03586 break;
03587
03588 case ACT_CREATENEWCOL:
03589 {
03590 pCRamp = GetColourRamp();
03591 if (!pCRamp)
03592 {
03593 FillGeometryAttribute *pAttrValue = ATTRVALUE();
03594 if (pAttrValue->SupportsFillRamps())
03595 {
03596 if (pAttrValue->IS_KIND_OF(GradFillAttribute))
03597 {
03598 pCRamp = ((GradFillAttribute*)pAttrValue)->MakeNewColourRamp();
03599 }
03600 }
03601 }
03602
03603 if (pCRamp)
03604 {
03605 ColRampItem *pItem;
03606 pItem = pCRamp->AddEntry(pRampAttr->GetPosition(), pRampAttr->GetStartColour());
03607 Changed=(pItem!=NULL);
03608 }
03609 }
03610 break;
03611
03612 case ACT_EDITCOLOFITEM:
03613 pCRamp = GetColourRamp();
03614 if (pCRamp)
03615 {
03616 Changed = pCRamp->SetItemColour(pRampAttr->GetIndex(), pRampAttr->GetStartColour());
03617 }
03618 break;
03619
03620 case ACT_EDITCOLOFSELECTED:
03621 pCRamp = GetColourRamp();
03622 if (pCRamp)
03623 {
03624 Changed = (pCRamp->SetSelectedColours(pRampAttr->GetStartColour()))>0;
03625 Changed=TRUE;
03626 }
03627 break;
03628
03629 default:
03630 ERROR3("Unknown action found during AttrFillGeometry::EditColFillRamp");
03631 break;
03632 }
03633
03634 return Changed;
03635 #else
03636 return FALSE;
03637 #endif
03638 }
03639
03640
03641
03642
03643
03644
03645
03646
03647
03648
03649
03650
03651
03652
03653
03654
03655 BOOL AttrFillGeometry::EditTranspFillRamp( AttrTranspFillRampChange *pRampAttr )
03656 {
03657 #if !defined(EXCLUDE_FROM_RALPH)
03658
03659
03660 if (pRampAttr==NULL)
03661 return FALSE;
03662
03663 BOOL Changed = FALSE;
03664 TransparencyRamp *pTRamp;
03665
03666 UINT32 t, *pt = pRampAttr->GetStartTransp();
03667 t = ((pt!=NULL) ? (*pt) : 128);
03668
03669 switch (pRampAttr->GetAction())
03670 {
03671 case ACT_DONOTHING:
03672
03673 ERROR3("Someone's forgotten to set the edit action of the RampChange attr");
03674 break;
03675
03676 case ACT_CREATENEWTRANSP:
03677 {
03678 pTRamp = GetTranspRamp();
03679 if (!pTRamp)
03680 {
03681 FillGeometryAttribute *pAttrValue = ATTRVALUE();
03682 if (pAttrValue->SupportsFillRamps())
03683 {
03684 if (pAttrValue->IS_KIND_OF(GradTranspFillAttribute))
03685 {
03686 pTRamp = ((GradTranspFillAttribute*)pAttrValue)->MakeNewTranspRamp();
03687 }
03688 }
03689 }
03690 if (pTRamp)
03691 {
03692 TranspRampItem *pItem;
03693 pItem = pTRamp->AddEntry(pRampAttr->GetPosition(), t);
03694 Changed=(pItem!=NULL);
03695 }
03696 }
03697 break;
03698
03699 case ACT_EDITTRANSPOFITEM:
03700 pTRamp = GetTranspRamp();
03701 if (pTRamp)
03702 {
03703 Changed = pTRamp->SetItemTransp(pRampAttr->GetIndex(), t);
03704 }
03705 break;
03706
03707 case ACT_EDITTRANSPOFSELECTED:
03708 pTRamp = GetTranspRamp();
03709 if (pTRamp)
03710 {
03711 Changed = (pTRamp->SetSelectedTransp(t))>0;
03712 }
03713 break;
03714
03715 default:
03716 ERROR3("Unknown action found during AttrFillGeometry::EditTranspFillRamp");
03717 break;
03718 }
03719
03720 return Changed;
03721 #else
03722 return FALSE;
03723 #endif
03724 }
03725
03726
03727
03728
03729
03730
03731
03732
03733
03734
03735
03736
03737
03738 DocColour *AttrFillGeometry::EnumerateColourFields(UINT32 Context)
03739 {
03740 #if !defined(EXCLUDE_FROM_RALPH)
03741
03742
03743 DocColour * pColour = NULL;
03744
03745 switch (Context)
03746 {
03747 case 0:
03748 pColour = GetStartColour();
03749 break;
03750
03751 case 1:
03752 pColour = GetEndColour();
03753 break;
03754
03755 case 2:
03756 pColour = GetEndColour2();
03757 break;
03758
03759 case 3:
03760 pColour = GetEndColour3();
03761 break;
03762 }
03763
03764 if (pColour)
03765 {
03766
03767 return (pColour);
03768 }
03769 else
03770 {
03771
03772
03773 ColourRamp *pRamp = GetColourRamp();
03774
03775 INT32 adjuster = 0;
03776
03777
03778 if (GetStartColour()) { adjuster++; }
03779 if (GetEndColour()) { adjuster++; }
03780 if (GetEndColour2()) { adjuster++; }
03781 if (GetEndColour3()) { adjuster++; }
03782
03783 if (pRamp)
03784 {
03785
03786 return (pRamp->EnumerateColourFields(Context-adjuster));
03787 }
03788
03789 }
03790
03791 #endif
03792
03793 return NULL;
03794 }
03795
03796
03797
03798
03799 void AttrFillGeometry::MakePerspective(UndoableOperation* pUndoOp)
03800 {
03801 ((FillGeometryAttribute*)GetAttributeValue())->MakePerspective();
03802 }
03803
03804 void AttrFillGeometry::RemovePerspective(UndoableOperation* pUndoOp)
03805 {
03806 if (IsPerspective() && pUndoOp != NULL)
03807 {
03808 Node* pParent = FindParent();
03809 if (pParent == NULL)
03810 return;
03811
03812 AttrFillGeometry* AttribClone;
03813
03814 ALLOC_WITH_FAIL(AttribClone ,(AttrFillGeometry*)this->SimpleCopy(), pUndoOp)
03815 if (AttribClone == NULL)
03816 return;
03817
03818 AttribClone->RemovePerspective();
03819
03820 HideNodeAction* UndoHideNodeAction;
03821 NodeHidden* pNodeHidden;
03822 if(!pUndoOp->DoHideNode(this, FALSE, &pNodeHidden,FALSE))
03823 return;
03824
03825 AttribClone->AttachNode(pParent, FIRSTCHILD);
03826
03827
03828 if ( HideNodeAction::Init(pUndoOp,
03829 pUndoOp->GetUndoActionList(),
03830 AttribClone,
03831 TRUE,
03832
03833 (Action**)(&UndoHideNodeAction))
03834 == AC_FAIL)
03835 {
03836 AttribClone->CascadeDelete();
03837 delete (AttribClone);
03838 return;
03839 };
03840 }
03841 else
03842 {
03843 ((FillGeometryAttribute*)GetAttributeValue())->RemovePerspective();
03844 }
03845 }
03846
03847
03848
03850
03851
03852
03854
03855
03856
03857
03858
03859
03860
03861
03862
03863
03864
03865 AttrValueChange::AttrValueChange()
03866 {
03867 Colour = TRUE;
03868 Transp = !Colour;
03869 }
03870
03871
03872
03873
03874
03875
03876
03877
03878
03879
03880
03881
03882
03883 CCRuntimeClass* AttrValueChange::GetAttributeType()
03884 {
03885 if (Colour)
03886 return CC_RUNTIME_CLASS(AttrFillGeometry);
03887 else
03888 return CC_RUNTIME_CLASS(AttrTranspFillGeometry);
03889 }
03890
03891
03892
03893
03894
03895
03896
03897
03898
03899
03900
03901 void AttrValueChange::MutateColourFills(BOOL Change)
03902 {
03903 Colour = Change;
03904 Transp = !Colour;
03905 }
03906
03907
03908
03909
03910
03911
03912
03913
03914
03915
03916
03917 void AttrValueChange::MutateTranspFills(BOOL Change)
03918 {
03919 Transp = Change;
03920 Colour = !Transp;
03921 }
03922
03923
03924
03925
03926
03927
03928
03929
03930
03931
03932
03933 AttrTranspChange::AttrTranspChange()
03934 {
03935 Transp = TRUE;
03936 Colour = !Transp;
03937 }
03938
03939
03940
03941
03942
03943
03944
03945
03946
03947
03948
03949
03950
03951
03952 NodeAttribute* AttrTranspChange::GetOtherAttrToApply(BOOL* IsMutate)
03953 {
03954 ERROR3IF(IsMutate == NULL, "NULL flag pointer passed to GetOtherAttrToApply");
03955
03956
03957
03958 if (AttrFillGeometry::FillSelectionCount() > 0)
03959 return NULL;
03960
03961
03962 NodeAttribute* OtherAttr = new AttrStrokeTranspChange;
03963 if (OtherAttr == NULL)
03964 return NULL;
03965
03966 UINT32 Transp = *GetStartTransp();
03967
03968 ((AttrStrokeTranspChange *)OtherAttr)->SetStartTransp(&Transp);
03969
03970 *IsMutate = TRUE;
03971
03972 return OtherAttr;
03973 }
03974
03975
03976
03977
03978
03979
03980
03981
03982
03983
03984
03985
03986 AttrFillGeometry* AttrColourChange::MutateFill(AttrFillGeometry* FillToMutate)
03987 {
03988 #if !defined(EXCLUDE_FROM_RALPH)
03989 if (FillToMutate->IsVisible() &&
03990 FillToMutate->GetSelectionCount() == 0 &&
03991 SelectionCount > 0)
03992 return NULL;
03993
03994
03995 AttrFillGeometry* NewFill = (AttrFillGeometry*)FillToMutate->SimpleCopy();
03996 if (NewFill == NULL)
03997 return NULL;
03998
03999 BOOL Changed = NewFill->ChangeControlColour(this);
04000
04001
04002 if (!Changed)
04003 {
04004 if (NewFill->IsABitmapFill() &&
04005 NewFill->GetSelectionCount() > 0)
04006 {
04007 if (GetApplication()->GetBlobManager()->GetCurrentInterest().Fill && IsVisible())
04008 {
04009
04010
04011
04012 delete NewFill;
04013 return NULL;
04014 }
04015 }
04016
04017
04018 delete NewFill;
04019
04020 NewFill = new AttrFlatColourFill;
04021 if (NewFill == NULL)
04022 return NULL;
04023
04024
04025 *(FillGeometryAttribute*)(NewFill->GetAttributeValue()) = *(FillGeometryAttribute*)(this->GetAttributeValue());
04026
04027 if (GetApplication()->GetBlobManager()->GetCurrentInterest().Fill &&
04028 FillToMutate->IsVisible() &&
04029 FillToMutate->FindParent() &&
04030 FillToMutate->FindParent()->IsSelected())
04031 {
04032 FillToMutate->RenderFillBlobs();
04033 }
04034 }
04035
04036 return NewFill;
04037 #else
04038 return NULL;
04039 #endif
04040 }
04041
04042
04043
04044
04045
04046
04047
04048
04049
04050
04051
04052
04053 AttrFillGeometry* AttrTranspChange::MutateFill(AttrFillGeometry* FillToMutate)
04054 {
04055 #if !defined(EXCLUDE_FROM_RALPH)
04056 if (FillToMutate->IsVisible() &&
04057 FillToMutate->GetSelectionCount() == 0 &&
04058 SelectionCount > 0)
04059 return NULL;
04060
04061
04062 AttrFillGeometry* NewFill = (AttrFillGeometry*)FillToMutate->SimpleCopy();
04063 if (NewFill == NULL)
04064 return NULL;
04065
04066 BOOL Changed = NewFill->ChangeControlTransp(this);
04067
04068
04069 if (!Changed)
04070 {
04071
04072 delete NewFill;
04073
04074 NewFill = new AttrFlatTranspFill;
04075 if (NewFill == NULL)
04076 return NULL;
04077
04078
04079 *(FillGeometryAttribute*)(NewFill->GetAttributeValue()) = *(FillGeometryAttribute*)(this->GetAttributeValue());
04080
04081 NewFill->SetTranspType(FillToMutate->GetTranspType());
04082
04083 if (GetApplication()->GetBlobManager()->GetCurrentInterest().Fill &&
04084 FillToMutate->IsVisible() &&
04085 FillToMutate->FindParent() &&
04086 FillToMutate->FindParent()->IsSelected())
04087 {
04088 FillToMutate->RenderFillBlobs();
04089 }
04090 }
04091
04092
04093 return NewFill;
04094 #else
04095 return NULL;
04096 #endif
04097 }
04098
04099
04100
04101
04102
04103
04104
04105
04106
04107
04108
04109
04110 AttrFillGeometry* AttrBitmapChange::MutateFill(AttrFillGeometry* FillToMutate)
04111 {
04112 #if !defined(EXCLUDE_FROM_RALPH)
04113
04114 AttrFillGeometry* NewFill = (AttrFillGeometry*)FillToMutate->SimpleCopy();
04115 if (NewFill == NULL)
04116 return NULL;
04117
04118
04119
04120
04121
04122
04123
04124
04125
04126
04127
04128
04129
04130
04131
04132
04133
04134
04135 NewFill->CopyBitmap(GetBitmap());
04136
04137 return NewFill;
04138 #else
04139 return NULL;
04140 #endif
04141 }
04142
04143
04144
04145
04146
04147
04148
04149
04150
04151
04152
04153
04154 AttrFillGeometry* AttrBitmapTessChange::MutateFill(AttrFillGeometry* FillToMutate)
04155 {
04156 #if !defined(EXCLUDE_FROM_RALPH)
04157
04158 AttrFillGeometry* NewFill = (AttrFillGeometry*)FillToMutate->SimpleCopy();
04159 if (NewFill == NULL)
04160 return NULL;
04161
04162 NewFill->SetTesselation(GetTesselation());
04163 NewFill->RecalcFractal();
04164
04165 return NewFill;
04166 #else
04167 return NULL;
04168 #endif
04169 }
04170
04171
04172
04173
04174
04175
04176
04177
04178
04179
04180
04181
04182 AttrFillGeometry* AttrBitmapDpiChange::MutateFill(AttrFillGeometry* FillToMutate)
04183 {
04184 #if !defined(EXCLUDE_FROM_RALPH)
04185
04186 AttrFillGeometry* NewFill = (AttrFillGeometry*)FillToMutate->SimpleCopy();
04187 if (NewFill == NULL)
04188 return NULL;
04189
04190 NewFill->SetDPI(Dpi);
04191
04192 return NewFill;
04193 #else
04194 return NULL;
04195 #endif
04196 }
04197
04198
04199
04200
04201
04202
04203
04204
04205
04206
04207
04208
04209 AttrFillGeometry* AttrFractalGrainChange::MutateFill(AttrFillGeometry* FillToMutate)
04210 {
04211 #if !defined(EXCLUDE_FROM_RALPH)
04212
04213 AttrFillGeometry* NewFill = (AttrFillGeometry*)FillToMutate->SimpleCopy();
04214 if (NewFill == NULL)
04215 return NULL;
04216
04217 NewFill->SetGraininess(GetGraininess());
04218 NewFill->RecalcFractal();
04219
04220 return NewFill;
04221 #else
04222 return NULL;
04223 #endif
04224 }
04225
04226
04227
04228
04229
04230
04231
04232
04233
04234
04235
04236
04237 AttrFillGeometry* AttrFractalTileableChange::MutateFill(AttrFillGeometry* FillToMutate)
04238 {
04239 #if !defined(EXCLUDE_FROM_RALPH)
04240
04241 AttrFillGeometry* NewFill = (AttrFillGeometry*)FillToMutate->SimpleCopy();
04242 if (NewFill == NULL)
04243 return NULL;
04244
04245 NewFill->SetTileable(GetTileable());
04246 NewFill->RecalcFractal();
04247
04248 return NewFill;
04249 #else
04250 return NULL;
04251 #endif
04252 }
04253
04254
04255
04256
04257
04258
04259
04260
04261
04262
04263
04264
04265 AttrFillGeometry* AttrTranspTypeChange::MutateFill(AttrFillGeometry* FillToMutate)
04266 {
04267 #if !defined(EXCLUDE_FROM_RALPH)
04268
04269 AttrFillGeometry* NewFill = (AttrFillGeometry*)FillToMutate->SimpleCopy();
04270 if (NewFill == NULL)
04271 return NULL;
04272
04273 NewFill->SetTranspType(GetTranspType());
04274
04275 return NewFill;
04276 #else
04277 return NULL;
04278 #endif
04279 }
04280
04281
04282
04283
04284
04285
04286
04287
04288
04289
04290
04291
04292 AttrFillGeometry* AttrNoiseScaleChange::MutateFill(AttrFillGeometry* FillToMutate)
04293 {
04294 #if !defined(EXCLUDE_FROM_RALPH)
04295
04296 AttrFillGeometry* NewFill = (AttrFillGeometry*)FillToMutate->SimpleCopy();
04297 if (NewFill == NULL)
04298 return NULL;
04299
04300
04301 NewFill->SetGraininess(GetGraininess());
04302 NewFill->RecalcFractal();
04303
04304 return NewFill;
04305 #else
04306 return NULL;
04307 #endif
04308 }
04309
04310
04311
04312
04313
04314
04315
04316
04317
04318
04319
04320
04321
04322
04323 NodeAttribute* AttrTranspTypeChange::GetOtherAttrToApply(BOOL* IsMutate)
04324 {
04325 #if !defined(EXCLUDE_FROM_RALPH)
04326 ERROR3IF(IsMutate == NULL, "NULL flag pointer passed to GetOtherAttrToApply");
04327
04328
04329
04330 NodeAttribute* OtherAttr = new AttrStrokeTranspTypeChange;
04331 if (OtherAttr == NULL)
04332 return NULL;
04333
04334 UINT32 TranspType = GetTranspType();
04335
04336 ((AttrStrokeTranspTypeChange *)OtherAttr)->SetTranspType(TranspType);
04337
04338 *IsMutate = TRUE;
04339
04340 return OtherAttr;
04341 #else
04342 return NULL;
04343 #endif
04344 }
04345
04346
04347
04348
04349
04350
04351
04352
04353
04354
04355
04356
04357 UINT32 AttrValueChange::GetAttrNameID(void)
04358 {
04359 return (_R(IDS_VALUE_CHANGE));
04360 }
04361
04362
04363
04364
04365
04366
04367
04368
04369
04370
04371
04372
04373 UINT32 AttrColourChange::GetAttrNameID(void)
04374 {
04375 return (_R(IDS_COLOUR_CHANGE));
04376 }
04377
04378
04379
04380
04381
04382
04383
04384
04385
04386
04387
04388
04389 UINT32 AttrBitmapChange::GetAttrNameID(void)
04390 {
04391 return (_R(IDS_BITMAP_CHANGE));
04392 }
04393
04394
04395
04396
04397
04398
04399
04400
04401
04402
04403
04404
04405 UINT32 AttrBitmapTessChange::GetAttrNameID(void)
04406 {
04407 return (_R(IDS_BITMAPTESS_CHANGE));
04408 }
04409
04410
04411
04412
04413
04414
04415
04416
04417
04418
04419
04420
04421 UINT32 AttrBitmapDpiChange::GetAttrNameID(void)
04422 {
04423 return (_R(IDS_BITMAPDPI_CHANGE));
04424 }
04425
04426
04427
04428
04429
04430
04431
04432
04433
04434
04435
04436
04437 UINT32 AttrFractalChange::GetAttrNameID(void)
04438 {
04439 return (_R(IDS_FRACTAL_CHANGE));
04440 }
04441
04442
04443
04444
04445
04446
04447
04448
04449
04450
04451
04452
04453 UINT32 AttrFractalGrainChange::GetAttrNameID(void)
04454 {
04455 return (_R(IDS_FRACTALGRAIN_CHANGE));
04456 }
04457
04458
04459
04460
04461
04462
04463
04464
04465
04466
04467
04468
04469 UINT32 AttrFractalTileableChange::GetAttrNameID(void)
04470 {
04471 return (_R(IDS_FRACTAL_CHANGE));
04472 }
04473
04474
04475
04476
04477
04478
04479
04480
04481
04482
04483
04484
04485 UINT32 AttrTranspChange::GetAttrNameID(void)
04486 {
04487 return (_R(IDS_TRANSP_CHANGE));
04488 }
04489
04490
04491
04492
04493
04494
04495
04496
04497
04498
04499
04500
04501 UINT32 AttrTranspTypeChange::GetAttrNameID(void)
04502 {
04503 return (_R(IDS_TRANSPTYPE_CHANGE));
04504 }
04505
04506
04507
04508
04509
04510
04511
04512
04513
04514
04515
04516
04517 UINT32 AttrNoiseScaleChange::GetAttrNameID(void)
04518 {
04519 return (_R(IDS_NOISESCALE_CHANGE));
04520 }
04521
04522
04523
04524
04525
04526
04527
04528
04529
04530
04531
04532
04533
04534
04535 AttrColFillRampChange::AttrColFillRampChange()
04536 {
04537 action = ACT_DONOTHING;
04538 index = FILLRAMP_ILLEGALINDEX;
04539 position = 0.0f;
04540 }
04541
04542
04543
04544
04545
04546
04547
04548
04549
04550
04551
04552
04553
04554
04555
04556
04557 void AttrColFillRampChange::InitForColourAdd(DocColour *pColour, float pos)
04558 {
04559 action = ACT_CREATENEWCOL;
04560 position = pos;
04561 Value.SetStartColour(pColour);
04562 }
04563
04564 void AttrColFillRampChange::InitForColourEdit(UINT32 i, DocColour *pColour)
04565 {
04566 action = ACT_EDITCOLOFITEM;
04567 index = i;
04568 Value.SetStartColour(pColour);
04569 }
04570
04571 void AttrColFillRampChange::InitForSelEdit(DocColour *pColour)
04572 {
04573 action = ACT_EDITCOLOFSELECTED;
04574 index = FILLRAMP_ILLEGALINDEX;
04575 Value.SetStartColour(pColour);
04576 }
04577
04578
04579
04580
04581
04582
04583
04584
04585
04586
04587
04588
04589
04590 UINT32 AttrColFillRampChange::GetAttrNameID()
04591 {
04592 return (_R(IDS_FILLRAMP_COLOURCHANGE));
04593 }
04594
04595
04596
04597
04598
04599
04600
04601
04602
04603
04604
04605
04606
04607
04608
04609 AttrFillGeometry* AttrColFillRampChange::MutateFill(AttrFillGeometry* FillToMutate)
04610 {
04611 #if !defined(EXCLUDE_FROM_RALPH)
04612 if (FillToMutate->IsVisible() &&
04613 FillToMutate->GetSelectionCount() == 0 &&
04614 SelectionCount > 0)
04615 return NULL;
04616
04617
04618 AttrFillGeometry* NewFill = (AttrFillGeometry*)FillToMutate->SimpleCopy();
04619 if (NewFill == NULL)
04620 return NULL;
04621
04622
04623 BOOL Changed = NewFill->EditColourFillRamp(this);
04624
04625
04626 if (!Changed)
04627 {
04628 delete NewFill;
04629 return NULL;
04630 }
04631
04632 return NewFill;
04633 #else
04634 return NULL;
04635 #endif
04636 }
04637
04638
04639
04640
04641
04642
04643
04644
04645
04646
04647
04648 AttrTranspFillRampChange::AttrTranspFillRampChange()
04649 {
04650 action = ACT_DONOTHING;
04651 index = FILLRAMP_ILLEGALINDEX;
04652 position = 0.0f;
04653 }
04654
04655
04656
04657
04658
04659
04660
04661
04662
04663
04664
04665
04666
04667 void AttrTranspFillRampChange::InitForTranspAdd(UINT32 t, float pos)
04668 {
04669 action = ACT_CREATENEWTRANSP;
04670 position = pos;
04671 Value.SetStartTransp(&t);
04672 }
04673
04674 void AttrTranspFillRampChange::InitForTranspEdit(UINT32 i, UINT32 t)
04675 {
04676 action = ACT_EDITTRANSPOFITEM;
04677 index = i;
04678 Value.SetStartTransp(&t);
04679 }
04680
04681 void AttrTranspFillRampChange::InitForSelEdit(UINT32 t)
04682 {
04683 action = ACT_EDITTRANSPOFSELECTED;
04684 index = FILLRAMP_ILLEGALINDEX;
04685 Value.SetStartTransp(&t);
04686 }
04687
04688
04689
04690
04691
04692
04693
04694
04695
04696
04697
04698
04699 UINT32 AttrTranspFillRampChange::GetAttrNameID()
04700 {
04701 return (_R(IDS_FILLRAMP_TRANSPCHANGE));
04702 }
04703
04704
04705
04706
04707
04708
04709
04710
04711
04712
04713
04714
04715
04716
04717
04718 AttrFillGeometry* AttrTranspFillRampChange::MutateFill(AttrFillGeometry* FillToMutate)
04719 {
04720 #if !defined(EXCLUDE_FROM_RALPH)
04721 if (FillToMutate->IsVisible() &&
04722 FillToMutate->GetSelectionCount() == 0 &&
04723 SelectionCount > 0)
04724 return NULL;
04725
04726
04727 AttrFillGeometry* NewFill = (AttrFillGeometry*)FillToMutate->SimpleCopy();
04728 if (NewFill == NULL)
04729 return NULL;
04730
04731
04732 BOOL Changed = NewFill->EditTranspFillRamp(this);
04733
04734
04735 if (!Changed)
04736 {
04737 delete NewFill;
04738 return NULL;
04739 }
04740
04741
04742 return NewFill;
04743 #else
04744 return NULL;
04745 #endif
04746 }
04747
04748
04749
04750
04751
04752
04753
04754
04755
04756
04757
04758
04759 AttrColourDrop::AttrColourDrop(DocCoord &DropPoint, DocRect &ObjectBounds,
04760 DocColour NewColour)
04761 {
04762 #if !defined(EXCLUDE_FROM_RALPH)
04763 SetDropPoint(DropPoint);
04764 SetObjectBounds(ObjectBounds);
04765 SetStartColour(&NewColour);
04766
04767 ObjectHit = NULL;
04768 FillHit = NULL;
04769 ControlHit = FILLCONTROL_NULL;
04770
04771 ObjectIsSelected = FALSE;
04772 #endif
04773 }
04774
04775
04776
04777
04778
04779
04780
04781
04782
04783
04784
04785 void AttrColourDrop::SetDropPoint(DocCoord &DropPoint)
04786 {
04787 DropPos = DropPoint;
04788 }
04789
04790
04791
04792
04793
04794
04795
04796
04797
04798
04799
04800 void AttrColourDrop::SetObjectBounds(DocRect &ObjectBounds)
04801 {
04802 Bounds = ObjectBounds;
04803 }
04804
04805
04806
04807
04808
04809
04810
04811
04812
04813
04814
04815 void AttrColourDrop::SetObjectDroppedOn(NodeRenderableInk* pObject)
04816 {
04817 #if !defined(EXCLUDE_FROM_RALPH)
04818 if (pObject)
04819 {
04820 ObjectHit = pObject;
04821 ObjectIsSelected = pObject->IsSelected();
04822 }
04823 #endif
04824 }
04825
04826
04827
04828
04829
04830
04831
04832
04833
04834
04835
04836 NodeRenderableInk* AttrColourDrop::GetObjectDroppedOn()
04837 {
04838 return ObjectHit;
04839 }
04840
04841
04842
04843
04844
04845
04846
04847
04848
04849
04850
04851 BOOL AttrColourDrop::IsObjectSelected()
04852 {
04853 return (ObjectHit && ObjectIsSelected);
04854 }
04855
04856
04857
04858
04859
04860
04861
04862
04863
04864
04865
04866
04867 UINT32 AttrColourDrop::GetAttrNameID(void)
04868 {
04869 return (_R(IDS_COLOUR_CHANGE));
04870 }
04871
04872
04873
04874
04875
04876
04877
04878
04879
04880
04881
04882
04883 AttrFillGeometry* AttrColourDrop::MutateFill(AttrFillGeometry* FillToMutate)
04884 {
04885 return FillToMutate->DoColourDrop(this);
04886 }
04887
04888
04889
04890
04891
04892
04893
04894
04895
04896
04897
04898
04899
04900
04901 BOOL AttrColourDrop::EffectsParentBounds ()
04902 {
04903 return (TRUE);
04904 }
04905
04906
04907
04908
04909
04910
04911
04912
04913
04914
04915
04916
04917 FillControl AttrFillGeometry::DoColourDropTest(AttrColourDrop* ColDrop,
04918 NodeRenderableInk** Object,
04919 AttrFillGeometry** FillAttr)
04920 {
04921 #if !defined(EXCLUDE_FROM_RALPH)
04922 ERROR2IF(ColDrop == NULL, FILLCONTROL_NULL, "Null ColourDrop passed to DoColourDropTest");
04923
04924 DocCoord DropPoint = ColDrop->GetDropPoint();
04925
04926 FillControl ControlHit = FILLCONTROL_NULL;
04927
04928 if ( (((Camelot.GetBlobManager())->GetCurrentInterest()).Fill) )
04929 {
04930 BOOL HitAControl = FALSE;
04931 HitList.DeleteAll();
04932
04933 AttrFillGeometry* pAttrFound = NULL;
04934
04935
04936 AttrFillGeometry* pAttr = FindFirstSelectedAttr();
04937 while (pAttr != NULL)
04938 {
04939
04940 if (pAttr->GetAttributeType() == CC_RUNTIME_CLASS(AttrFillGeometry))
04941 {
04942
04943 FillControl Hit = pAttr->CheckForControlHit(DropPoint);
04944
04945 if (Hit != FILLCONTROL_NULL)
04946 {
04947
04948 HitAControl = TRUE;
04949
04950 if (pAttrFound == NULL)
04951 {
04952 pAttrFound = pAttr;
04953 ControlHit = Hit;
04954 }
04955
04956 BOOL InList = FALSE;
04957
04958
04959
04960
04961
04962
04963 if (!HitList.IsEmpty())
04964 {
04965 ListItem* pItem = HitList.GetHead();
04966
04967 while (pItem)
04968 {
04969 NodeAttributePtrItem* NodePtr = (NodeAttributePtrItem*)pItem;
04970
04971 if (NodePtr->NodeAttribPtr == pAttr)
04972 {
04973
04974 InList = TRUE;
04975 break;
04976 }
04977
04978 pItem = HitList.GetNext(pItem);
04979 }
04980 }
04981
04982 if (!InList)
04983 {
04984 NodeAttributePtrItem* NodePtr = new NodeAttributePtrItem;
04985
04986 if (NodePtr != NULL)
04987 {
04988
04989 NodePtr->NodeAttribPtr = pAttr;
04990 HitList.AddTail(NodePtr);
04991 }
04992 }
04993 }
04994 }
04995
04996
04997 pAttr = FindNextSelectedAttr();
04998 }
04999
05000 if (HitAControl)
05001 {
05002
05003 if (FillAttr != NULL)
05004 *FillAttr = pAttrFound;
05005
05006 if (Object != NULL)
05007 *Object = (NodeRenderableInk*)pAttrFound->FindParent();
05008
05009 return ControlHit;
05010 }
05011 }
05012
05013 if (*Object == NULL)
05014 {
05015 return FILLCONTROL_NULL;
05016 }
05017
05018
05019 Node* pParent = (Node*)*Object;
05020 ColDrop->SetObjectDroppedOn(*Object);
05021
05022 DocRect ParentBounds = ((NodeRenderableBounded*)*Object)->GetBoundingRect();
05023
05024 AttribMap.RemoveAll();
05025 BOOL FoundAttrs = ((NodeRenderableInk*)pParent)->FindAppliedAttributes(&AttribMap);
05026 if (FoundAttrs)
05027 {
05028 void *pAttr;
05029 if( AttribMap.Lookup( CC_RUNTIME_CLASS(AttrFillGeometry), pAttr ) )
05030 {
05031
05032 ControlHit = ((AttrFillGeometry*)pAttr)->TestColourDrop(ColDrop);
05033 return ControlHit;
05034 }
05035 }
05036 #endif
05037 return FILLCONTROL_NULL;
05038 }
05039
05040
05041
05042
05043
05044
05045
05046
05047
05048
05049
05050
05051 AttrFillGeometry* AttrFillGeometry::DoColourDrop(AttrColourDrop* ColDrop)
05052 {
05053 AttrFillGeometry* NewFill;
05054 DocColour DroppedColour = *ColDrop->GetStartColour();
05055
05056
05057 FillControl ControlHit = TestColourDrop(ColDrop);
05058
05059 if (ControlHit == FILLCONTROL_NULL)
05060 {
05061
05062 NewFill = new AttrFlatColourFill;
05063 if (NewFill == NULL)
05064 return NULL;
05065
05066
05067 NewFill->SetStartColour(&DroppedColour);
05068
05069 BOOL InSelection = ColDrop->IsObjectSelected();
05070
05071 if (InSelection &&
05072 GetApplication()->GetBlobManager()->GetCurrentInterest().Fill &&
05073 IsVisible()
05074 )
05075 {
05076 BOOL UniqueFill = TRUE;
05077
05078 AttrFillGeometry* pAttr = FindFirstSelectedAttr();
05079 while (pAttr != NULL)
05080 {
05081 if (pAttr != this && GetAttributeType() == pAttr->GetAttributeType())
05082 {
05083 if ( IsMeshSame((FillGeometryAttribute*)GetAttributeValue(),
05084 (FillGeometryAttribute*)pAttr->GetAttributeValue()) )
05085 {
05086 UniqueFill = FALSE;
05087 break;
05088 }
05089 }
05090
05091
05092 pAttr = FindNextSelectedAttr();
05093 }
05094
05095
05096
05097
05098
05099 }
05100
05101 return NewFill;
05102 }
05103
05104 if (FindParent() && FindParent()->IsCompound())
05105 {
05106 if (ColDrop->GetObjectDroppedOn() &&
05107 !(ColDrop->GetObjectDroppedOn()->IsCompound()) &&
05108 ColDrop->IsObjectSelected())
05109 {
05110
05111
05112
05113 }
05114 }
05115
05116
05117 NewFill = (AttrFillGeometry*)this->SimpleCopy();
05118 if (NewFill == NULL)
05119 return NULL;
05120
05121 if (!NewFill->ChangeControlColour(DroppedColour, ControlHit, ColDrop))
05122 {
05123 delete NewFill;
05124 return NULL;
05125 }
05126
05127
05128 return NewFill;
05129 }
05130
05131
05132
05133
05134
05135
05136
05137
05138
05139
05140
05141
05142 BOOL AttrFillGeometry::ChangeControlColour(DocColour& Col, FillControl Cntrl,
05143 AttrColourDrop * pColDrop)
05144 {
05145
05146 if (ISA_RAMPINDEX(Cntrl))
05147 {
05148
05149 if (GetColourRamp())
05150 {
05151 ColourRamp * pRamp = GetColourRamp();
05152
05153 return pRamp->SetItemColour(Cntrl, &Col);
05154 }
05155
05156
05157 Cntrl = FILLCONTROL_RAMPPOINT;
05158 }
05159
05160 switch (Cntrl)
05161 {
05162 case FILLCONTROL_STARTPOINT:
05163 SetStartColour(&Col);
05164 break;
05165
05166 case FILLCONTROL_ENDPOINT:
05167 SetEndColour(&Col);
05168 break;
05169
05170 case FILLCONTROL_SECONDARYPOINT:
05171 SetEndColour(&Col);
05172 break;
05173
05174 case FILLCONTROL_ENDPOINT2:
05175 SetEndColour2(&Col);
05176 break;
05177
05178 case FILLCONTROL_ENDPOINT3:
05179 SetEndColour3(&Col);
05180 break;
05181 case FILLCONTROL_RAMPPOINT:
05182 if (pColDrop)
05183 {
05184 CProfileBiasGain DefaultBiasGain;
05185
05186 if (!(GetProfile () == DefaultBiasGain))
05187 {
05188
05189 String_256 QueryString(_R(IDS_ASKMULTIREPLACEPROFILE));
05190
05191
05192 Error::SetError(0, QueryString, 0);
05193 INT32 DlgResult = InformMessage(0, _R(IDS_YES), _R(IDS_NO));
05194 Error::ClearError();
05195
05196 switch (DlgResult)
05197 {
05198 case 1:
05199 SetProfile (DefaultBiasGain);
05200
05201 break;
05202 case 2:
05203 return (FALSE);
05204 }
05205 }
05206
05207 DocCoord DropPoint = pColDrop->GetDropPoint();
05208
05209 double dRampPoint = FindRampPoint(DropPoint, *GetStartPoint(),
05210 *GetEndPoint());
05211
05212
05213 if (GetColourRamp() == NULL)
05214 {
05215 FillGeometryAttribute *pAttrValue = ATTRVALUE();
05216 if (pAttrValue->SupportsFillRamps())
05217 {
05218 if (pAttrValue->IS_KIND_OF(GradFillAttribute))
05219 {
05220 ColourRamp * pRamp = ((GradFillAttribute*)pAttrValue)->MakeNewColourRamp();
05221 pRamp->AddEntry((float)dRampPoint, &Col);
05222 pRamp->Dump();
05223 }
05224 }
05225 }
05226 else
05227 {
05228
05229 FillRamp * pRamp = GetColourRamp();
05230
05231 ColRampItem * pItem = (ColRampItem *)pRamp->GetHead();
05232
05233 while (pItem)
05234 {
05235 if (pItem->GetPosition() == dRampPoint)
05236 {
05237
05238 pItem->SetColour(&Col);
05239 break;
05240 }
05241
05242 pItem = (ColRampItem *)pRamp->GetNext(pItem);
05243 }
05244
05245
05246 if (!pItem)
05247 {
05248 GetColourRamp()->AddEntry((float)dRampPoint, &Col);
05249 GetColourRamp()->Dump();
05250 }
05251 }
05252 }
05253 break;
05254 default:
05255 SetStartColour(&Col);
05256 break;
05257 }
05258
05259 return TRUE;}
05260
05261
05262
05263
05264
05265
05266
05267
05268
05269
05270
05271 BOOL AttrBitmapColourFill::ChangeControlColour(DocColour& Col, FillControl Cntrl,
05272 AttrColourDrop * pColDrop)
05273 {
05274 #if !defined(EXCLUDE_FROM_RALPH)
05275
05276 KernelBitmap* pBitmap = GetBitmap();
05277 KernelBitmap* pGreyBmp = NodeBitmap::CheckGreyscaleBitmap(pBitmap, _R(IDS_MAKEGREY), _R(IDS_DOGREY));
05278
05279 if (pGreyBmp == NULL)
05280 return FALSE;
05281
05282 return AttrFillGeometry::ChangeControlColour(Col, Cntrl);
05283 #else
05284 return FALSE;
05285 #endif
05286 }
05287
05288
05289
05290
05291
05292
05293
05294
05295
05296
05297
05298 FillControl AttrFillGeometry::TestColourDrop(AttrColourDrop* ColDrop)
05299 {
05300 #if !defined(EXCLUDE_FROM_RALPH)
05301
05302 DocCoord DropPoint = ColDrop->GetDropPoint();
05303
05304
05305 return CheckForControlHit(DropPoint);
05306 #else
05307 return FILLCONTROL_NULL;
05308 #endif
05309 }
05310
05311
05312
05313
05314
05315
05316
05317
05318
05319
05320
05321 FillControl AttrFlatFill::TestColourDrop(AttrColourDrop* ColDrop)
05322 {
05323 return FILLCONTROL_NULL;
05324 }
05325
05326
05327
05328
05329
05330
05331
05332
05333
05334
05335
05336 FillControl AttrLinearFill::TestColourDrop(AttrColourDrop* ColDrop)
05337 {
05338 #if !defined(EXCLUDE_FROM_RALPH)
05339
05340 DocCoord DropPoint = ColDrop->GetDropPoint();
05341
05342
05343 FillControl ControlHit = CheckForControlHit(DropPoint);
05344
05345
05346 if (ControlHit != FILLCONTROL_NULL)
05347 return ControlHit;
05348
05349
05350
05351
05352
05353
05354
05355 NodeRenderableInk* pParentObject = ColDrop->GetObjectDroppedOn();
05356 if (pParentObject == NULL)
05357 return FILLCONTROL_NULL;
05358
05359
05360 if (GetStartPoint() == NULL || GetEndPoint() == NULL)
05361 return FILLCONTROL_NULL;
05362
05363 DocCoord StartPoint = *GetStartPoint();
05364 DocCoord EndPoint = *GetEndPoint();
05365
05366
05367 DocCoord MidPoint = DocCoord(StartPoint.x + (EndPoint.x - StartPoint.x)/2,
05368 StartPoint.y + (EndPoint.y - StartPoint.y)/2);
05369
05370 TRACEUSER( "Mike", _T("DropPoint (before) = %d,%d\n"),DropPoint.x, DropPoint.y);
05371
05372 TRACEUSER( "Mike", _T("StartPoint = %d,%d\n"),StartPoint.x, StartPoint.y);
05373 TRACEUSER( "Mike", _T("MidPoint = %d,%d\n"),MidPoint.x, MidPoint.y);
05374 TRACEUSER( "Mike", _T("EndPoint = %d,%d\n"),EndPoint.x, EndPoint.y);
05375
05376
05377 ANGLE LineAngle = CalcLineAngle(MidPoint, EndPoint) - 90;
05378 Matrix Rotate = Matrix(-LineAngle);
05379
05380
05381 DropPoint.translate(-MidPoint.x, -MidPoint.y);
05382 Rotate.transform(&DropPoint);
05383 DropPoint.translate(MidPoint.x, MidPoint.y);
05384
05385 TRACEUSER( "Mike", _T("DropPoint (after) = %d,%d\n"),DropPoint.x, DropPoint.y);
05386
05387
05388
05389
05390
05391 if (DropPoint.x <= MidPoint.x)
05392 ControlHit = FILLCONTROL_STARTPOINT;
05393 else
05394 ControlHit = FILLCONTROL_ENDPOINT;
05395
05396 return ControlHit;
05397 #else
05398 return FILLCONTROL_NULL;
05399 #endif
05400 }
05401
05402
05403
05404
05405
05406
05407
05408
05409
05410
05411
05412 FillControl AttrRadialFill::TestColourDrop(AttrColourDrop* ColDrop)
05413 {
05414 #if !defined(EXCLUDE_FROM_RALPH)
05415 return AttrFillGeometry::TestColourDrop(ColDrop);
05416
05417
05418 DocCoord DropPoint = ColDrop->GetDropPoint();
05419
05420
05421 FillControl ControlHit = CheckForControlHit(DropPoint);
05422
05423
05424 if (ControlHit != FILLCONTROL_NULL)
05425 return ControlHit;
05426
05427
05428
05429
05430
05431
05432
05433 NodeRenderableInk* pParentObject = ColDrop->GetObjectDroppedOn();
05434 if (pParentObject == NULL)
05435 return FILLCONTROL_NULL;
05436
05437
05438 if (GetStartPoint() == NULL || GetEndPoint() == NULL)
05439 return FILLCONTROL_NULL;
05440
05441 DocCoord StartPoint = *GetStartPoint();
05442 DocCoord EndPoint = *GetEndPoint();
05443 DocCoord EndPoint2 = *GetEndPoint2();
05444
05445 double MajRadius = EndPoint.Distance(StartPoint);
05446 double MinRadius = EndPoint2.Distance(StartPoint);
05447
05448 ANGLE MajAngle = CalcLineAngle(StartPoint, EndPoint) + 180;
05449 ANGLE DropAngle = CalcLineAngle(StartPoint, DropPoint) + 180;
05450
05451 ANGLE Diff = DropAngle - MajAngle;
05452
05453 if (Diff >= 180) Diff -= 360;
05454 if (Diff <= -180) Diff += 360;
05455
05456 Diff = ABS(Diff);
05457 if (Diff > 90) Diff = 180 - Diff;
05458
05459 TRACEUSER( "Mike", _T("MajAngle = %f\n"),MajAngle.MakeDouble());
05460 TRACEUSER( "Mike", _T("DropAngle = %f\n"),DropAngle.MakeDouble());
05461 TRACEUSER( "Mike", _T("Diff = %f\n"),Diff.MakeDouble());
05462
05463 double Radius = MajRadius + ((MinRadius - MajRadius) * (Diff.MakeDouble()/90));
05464 double Dist = DropPoint.Distance(StartPoint);
05465
05466 TRACEUSER( "Mike", _T("Radius = %f\n"),Radius);
05467 TRACEUSER( "Mike", _T("Dist = %f\n"),Dist);
05468
05469
05470
05471 if (Dist <= Radius/2)
05472 ControlHit = FILLCONTROL_STARTPOINT;
05473 else
05474 ControlHit = FILLCONTROL_ENDPOINT;
05475
05476 return ControlHit;
05477 #else
05478 return FILLCONTROL_NULL;
05479 #endif
05480 }
05481
05482
05483
05484
05485
05486
05487
05488
05489
05490
05491
05492 FillControl AttrConicalFill::TestColourDrop(AttrColourDrop* ColDrop)
05493 {
05494
05495 DocCoord DropPoint = ColDrop->GetDropPoint();
05496
05497
05498 FillControl ControlHit = CheckForControlHit(DropPoint);
05499
05500
05501 if (ControlHit != FILLCONTROL_NULL)
05502 return ControlHit;
05503
05504
05505
05506
05507
05508
05509
05510 NodeRenderableInk* pParentObject = ColDrop->GetObjectDroppedOn();
05511 if (pParentObject == NULL)
05512 return FILLCONTROL_NULL;
05513
05514
05515 if (GetStartPoint() == NULL || GetEndPoint() == NULL)
05516 return FILLCONTROL_NULL;
05517
05518 DocCoord StartPoint = *GetStartPoint();
05519 DocCoord EndPoint = *GetEndPoint();
05520
05521
05522
05523 ANGLE LineAngle = CalcLineAngle(StartPoint, EndPoint) + 180;
05524 ANGLE DropAngle = CalcLineAngle(StartPoint, DropPoint) + 180;
05525
05526
05527 ANGLE Diff = DropAngle - LineAngle;
05528
05529
05530 if (Diff >= 180)
05531 Diff -= 360;
05532
05533 if (Diff <= -180)
05534 Diff += 360;
05535
05536 TRACEUSER( "Mike", _T("LineAngle = %f\n"),LineAngle.MakeDouble());
05537 TRACEUSER( "Mike", _T("DropAngle = %f\n"),DropAngle.MakeDouble());
05538 TRACEUSER( "Mike", _T("Diff = %f\n"),Diff.MakeDouble());
05539
05540
05541 double d = FindRampPoint(DropPoint, *GetStartPoint(), *GetEndPoint());
05542
05543 if (d >= 0 && d <= 1.0)
05544 {
05545 return FILLCONTROL_RAMPPOINT;
05546 }
05547
05548
05549 if (Diff <= 90 && Diff > -90)
05550 ControlHit = FILLCONTROL_ENDPOINT;
05551 else
05552 ControlHit = FILLCONTROL_STARTPOINT;
05553
05554 return ControlHit;
05555 }
05556
05557
05558
05559
05560
05561
05562
05563
05564
05565
05566
05567
05568
05569 FillControl AttrBitmapFill::TestColourDrop(AttrColourDrop* ColDrop)
05570 {
05571 return AttrFillGeometry::TestColourDrop(ColDrop);
05572 }
05573
05574
05575
05576
05577
05578
05579
05580
05581
05582
05583
05584
05585
05586
05587
05588
05589
05590
05591
05592
05593
05594
05595
05596
05597
05598
05599 KernelBitmap *AttrBitmapFill::EnumerateBitmaps(UINT32 Count)
05600 {
05601 if (IsAFractalFill())
05602 return NULL;
05603
05604 if (Count == 0)
05605 return GetBitmap();
05606
05607 return NULL;
05608 }
05609
05610
05611
05612
05613
05614
05615
05616
05617
05618
05619
05620
05621
05622
05623
05624
05625 BOOL AttrBitmapFill::ReplaceBitmap(KernelBitmap* pOrigBitmap, KernelBitmap* pNewBitmap)
05626 {
05627 if (!IsAFractalFill())
05628 {
05629 if (GetBitmap() == pOrigBitmap)
05630 {
05631 BitmapFillAttribute* pVal = (BitmapFillAttribute*)GetAttributeValue();
05632 if (pVal)
05633 pVal->GetBitmapRef()->Attach(pNewBitmap);
05634
05635 return(TRUE);
05636 }
05637 }
05638
05639 return FALSE;
05640 }
05641
05642
05643
05644
05645
05646
05647
05648
05649
05650
05651
05652
05653
05654
05655
05656 double AttrBitmapFill::GetEffectiveBitmapMinDPI(KernelBitmap* pBitmap)
05657 {
05658 if (!IsAFractalFill() && GetBitmap() == pBitmap)
05659 {
05660
05661 OILBitmap *OilBM = pBitmap->ActualBitmap;
05662 if (OilBM != NULL)
05663 {
05664 BitmapInfo Info;
05665 OilBM->GetInfo(&Info);
05666
05667
05668 INT32 PixWidth = Info.PixelWidth;
05669 INT32 PixHeight = Info.PixelHeight;
05670
05671 DocCoord Start(*GetStartPoint());
05672 DocCoord End(*GetEndPoint());
05673 DocCoord End2(*GetEndPoint2());
05674
05675
05676 INT32 Width = INT32(Start.Distance(End));
05677 INT32 Height = INT32(Start.Distance(End2));
05678
05679
05680
05681 double HDpi = 0;
05682 double VDpi = 0;
05683
05684 if (Width > 0)
05685 HDpi = ((double)PixWidth * 72000.0)/(double)Width;
05686
05687 if (Height > 0)
05688 VDpi = ((double)PixHeight * 72000.0)/(double)Height;
05689
05690
05691 if (HDpi < VDpi)
05692 return(HDpi);
05693 else
05694 return(VDpi);
05695 }
05696 }
05697
05698 return(1e9);
05699 }
05700
05701
05702
05703
05704
05705
05706
05707
05708
05709
05710
05711
05712
05713
05714
05715 NodeAttribute* AttrBitmapFill::GetOtherAttrToApply(BOOL* IsMutate)
05716 {
05717 ERROR3IF(IsMutate == NULL, "NULL flag pointer passed to GetOtherAttrToApply");
05718
05719
05720
05721 NodeAttribute* OtherAttr = NULL;
05722
05723 if (GetAttributeType() == CC_RUNTIME_CLASS(AttrFillGeometry))
05724 {
05725 OtherAttr = new AttrFillMappingLinear;
05726 }
05727 else
05728 {
05729 OtherAttr = new AttrTranspFillMappingLinear;
05730 }
05731
05732 if (OtherAttr == NULL)
05733 {
05734 return (NULL);
05735 }
05736
05737 ((AttrFillMappingLinear*) OtherAttr)->SetRepeat(RT_Repeating);
05738
05739 *IsMutate = FALSE;
05740
05741 return OtherAttr;
05742 }
05743
05744
05745
05746
05748
05749
05750
05752
05753
05754
05755
05756
05757
05758
05759
05760
05761
05762
05763 AttrFlatFill::AttrFlatFill()
05764 {
05765 }
05766
05767
05768
05769
05770
05771
05772
05773
05774
05775
05776
05777
05778
05779
05780 DocRect AttrFlatFill::GetBlobBoundingRect()
05781 {
05782
05783 DocRect BoundingRect(0,0,0,0);
05784
05785
05786 return BoundingRect;
05787 }
05788
05789
05790
05791
05792
05793
05794
05795
05796
05797
05798
05799 void AttrFlatFill::ValidateAttributeValue()
05800 {
05801 }
05802
05804
05805
05806
05808
05809
05810
05811
05812
05813
05814
05815
05816
05817
05818
05819 void AttrFlatColourFill::Render(RenderRegion* pRender)
05820 {
05821 pRender->SetFillGeometry(&Value, FALSE);
05822 }
05823
05824
05825
05826
05827
05828
05829
05830
05831
05832
05833
05834
05835
05836
05837
05838
05839 Node* AttrFlatColourFill::SimpleCopy()
05840 {
05841 AttrFlatColourFill* NodeCopy = new AttrFlatColourFill();
05842 if (NodeCopy == NULL)
05843 return NULL;
05844
05845 CopyNodeContents(NodeCopy);
05846
05847 return NodeCopy;
05848 }
05849
05850
05851
05852
05853
05854
05855
05856
05857
05858
05859
05860
05861 UINT32 AttrFlatColourFill::GetAttrNameID(void)
05862 {
05863 return (_R(IDS_FILL_COLOUR));
05864 }
05865
05866
05867
05868
05869
05870
05871
05872
05873
05874
05875
05876
05877 void AttrFlatColourFill::GetDebugDetails(StringBase* Str)
05878 {
05879 #ifdef _DEBUG
05880 NodeAttribute::GetDebugDetails( Str );
05881
05882 String_256 TempStr;
05883
05884
05885
05886
05887
05888
05889
05890
05891 #endif
05892 }
05893
05894
05895
05896
05897
05898
05899
05900
05901
05902
05903
05904
05905
05906
05907 UINT32 AttrFlatColourFill::GetNodeSize() const
05908 {
05909 return sizeof(AttrFlatColourFill);
05910 }
05911
05912
05913
05914
05915
05916
05917
05918
05919
05920
05921
05922
05923
05924
05925
05926
05927 BOOL AttrFlatColourFill::WritePreChildrenWeb(BaseCamelotFilter* pFilter)
05928 {
05929 #ifdef DO_EXPORT
05930 ERROR2IF(pFilter == NULL,FALSE,"NULL filter param");
05931
05932
05933 INT32 ColRef = pFilter->WriteRecord(&Value.Colour);
05934
05935
05936 BOOL ok = (ColRef != 0);
05937
05938 if (ok)
05939 {
05940 BOOL ColourRequired = TRUE;
05941 INT32 Tag = TAG_FLATFILL;
05942 INT32 Size = TAG_FLATFILL_SIZE;
05943 switch (ColRef)
05944 {
05945 case REF_DEFAULTCOLOUR_TRANSPARENT:
05946 Tag = TAG_FLATFILL_NONE;
05947 Size = TAG_FLATFILL_NONE_SIZE;
05948 ColourRequired = FALSE;
05949 break;
05950 case REF_DEFAULTCOLOUR_BLACK:
05951 Tag = TAG_FLATFILL_BLACK;
05952 Size = TAG_FLATFILL_BLACK_SIZE;
05953 ColourRequired = FALSE;
05954 break;
05955 case REF_DEFAULTCOLOUR_WHITE:
05956 Tag = TAG_FLATFILL_WHITE;
05957 Size = TAG_FLATFILL_WHITE_SIZE;
05958 ColourRequired = FALSE;
05959 break;
05960 }
05961
05962 CamelotFileRecord Rec(pFilter,Tag,Size);
05963
05964 if (ok) ok = Rec.Init();
05965 if (ok && ColourRequired) ok = Rec.WriteReference(ColRef);
05966 if (ok) ok = pFilter->Write(&Rec);
05967 }
05968
05969 if (!ok)
05970 pFilter->GotError(_R(IDE_FILE_WRITE_ERROR));
05971
05972 return ok;
05973 #else
05974 return FALSE;
05975 #endif
05976 }
05977
05978
05979
05980
05981 BOOL AttrFlatColourFill::WritePreChildrenNative(BaseCamelotFilter* pFilter)
05982 {
05983 #ifdef DO_EXPORT
05984 return WritePreChildrenWeb(pFilter);
05985 #else
05986 return FALSE;
05987 #endif
05988 }
05989
05990
05991
05992
05993
05994
05995
05996
05997
05998
05999
06000
06001
06002
06003
06004
06005 BOOL AttrFlatColourFill::WriteColourDefinitions (BaseCamelotFilter* pFilter)
06006 {
06007 INT32 ColRef = pFilter->WriteRecord(&Value.Colour);
06008
06009
06010
06011 return (ColRef != 0);
06012 }
06013
06014
06015
06016
06017
06019
06020
06021
06023
06024
06025
06026
06027
06028
06029
06030
06031
06032
06033
06034 void AttrFlatTranspFill::Render(RenderRegion* pRender)
06035 {
06036 pRender->SetTranspFillGeometry(&Value, FALSE);
06037 }
06038
06039
06040
06041
06042
06043
06044
06045
06046
06047
06048
06049
06050
06051
06052
06053
06054 Node* AttrFlatTranspFill::SimpleCopy()
06055 {
06056 AttrFlatTranspFill* NodeCopy = new AttrFlatTranspFill();
06057 if (NodeCopy == NULL)
06058 return NULL;
06059
06060 CopyNodeContents(NodeCopy);
06061
06062 return NodeCopy;
06063 }
06064
06065
06066
06067
06068
06069
06070
06071
06072
06073
06074
06075
06076 UINT32 AttrFlatTranspFill::GetAttrNameID(void)
06077 {
06078 return (_R(IDS_FILL_COLOUR));
06079 }
06080
06081
06082
06083
06084
06085
06086
06087
06088
06089
06090
06091
06092 void AttrFlatTranspFill::GetDebugDetails(StringBase* Str)
06093 {
06094 #ifdef _DEBUG
06095 NodeAttribute::GetDebugDetails( Str );
06096
06097 String_256 TempStr;
06098
06099 TempStr._MakeMsg( TEXT("\r\nFill") );
06100 (*Str) += TempStr;
06101
06102 TempStr._MakeMsg(TEXT("\r\nStart"));
06103 (*Str) += TempStr;
06104
06105 TempStr._MakeMsg(TEXT("\r\nFill value = #1%u"), *GetStartTransp() );
06106 (*Str) += TempStr;
06107
06108 TempStr._MakeMsg(TEXT("\r\nFill type = #1%u"), GetTranspType() );
06109 (*Str) += TempStr;
06110 #endif
06111 }
06112
06113
06114
06115
06116
06117
06118
06119
06120
06121
06122
06123
06124
06125
06126 UINT32 AttrFlatTranspFill::GetNodeSize() const
06127 {
06128 return sizeof(AttrFlatTranspFill);
06129 }
06130
06131
06132
06133
06134
06135
06136
06137
06138
06139
06140
06141
06142
06143
06144
06145
06146 BOOL AttrFlatTranspFill::WritePreChildrenWeb(BaseCamelotFilter* pFilter)
06147 {
06148 #ifdef DO_EXPORT
06149 ERROR2IF(pFilter == NULL,FALSE,"NULL filter param");
06150 ERROR3IF(Value.Transp > 255,"Transparency level is too high to be stored as a byte");
06151 ERROR3IF(Value.TranspType > 255,"Transparency type is too high to be stored as a byte");
06152
06153 BOOL ok = TRUE;
06154
06155 CamelotFileRecord Rec(pFilter,TAG_FLATTRANSPARENTFILL,TAG_FLATTRANSPARENTFILL_SIZE);
06156
06157 if (ok) ok = Rec.Init();
06158 if (ok) ok = Rec.WriteBYTE(BYTE(Value.Transp));
06159 if (ok) ok = Rec.WriteBYTE(BYTE(Value.TranspType));
06160 if (ok) ok = pFilter->Write(&Rec);
06161
06162 if (!ok)
06163 pFilter->GotError(_R(IDE_FILE_WRITE_ERROR));
06164
06165 return ok;
06166 #else
06167 return FALSE;
06168 #endif
06169 }
06170
06171
06172
06173
06174 BOOL AttrFlatTranspFill::WritePreChildrenNative(BaseCamelotFilter* pFilter)
06175 {
06176 #ifdef DO_EXPORT
06177 return WritePreChildrenWeb(pFilter);
06178 #else
06179 return FALSE;
06180 #endif
06181 }
06182
06183
06184
06185
06186
06187
06188
06189
06190
06191
06192
06193
06194
06195
06196
06197
06198 BOOL AttrFlatTranspFill::HasEquivalentDefaultValue(BOOL bAppearance)
06199 {
06200
06201 return (Value.TranspType==TT_NoTranspType || (Value.TranspType==TT_Mix && Value.Transp == 0));
06202 }
06203
06204
06205
06206
06208
06209
06210
06212
06213
06214
06215
06216
06217
06218
06219
06220
06221
06222
06223
06224
06225 void AttrLinearFill::Transform( TransformBase& Trans )
06226 {
06227 if ( Trans.TransFills )
06228 {
06229 Trans.Transform( GetStartPoint(), 1);
06230 Trans.Transform( GetEndPoint(), 1);
06231 Trans.Transform( GetEndPoint2(), 1);
06232
06233 if (IsPerspective())
06234 Trans.Transform( GetEndPoint3(), 1);
06235 }
06236 }
06237
06238
06239
06240
06241
06242
06243
06244
06245
06246
06247
06248
06249
06250 BOOL AttrLinearFill::CanTransform()
06251 {
06252 return TRUE;
06253 }
06254
06255
06256
06257
06258
06259
06260
06261
06262
06263
06264
06265
06266
06267
06268
06269 FillControl AttrLinearFill::CheckForControlHit(DocCoord &ClickPos)
06270 {
06271 return AttrFillGeometry::CheckForControlHit(ClickPos);
06272
06273 }
06274
06275
06276
06277
06278
06279
06280
06281
06282
06283
06284
06285
06286 AttrFillGeometry* AttrLinearFill::DoColourDrop(AttrColourDrop* ColDrop)
06287 {
06288 return AttrFillGeometry::DoColourDrop(ColDrop);
06289 }
06290
06291
06292
06293
06294
06295
06296
06297
06298
06299
06300
06301
06302 BOOL AttrLinearFill::ChangeControlColour(DocColour& Col, FillControl Cntrl,
06303 AttrColourDrop * pColDrop)
06304 {
06305 return AttrFillGeometry::ChangeControlColour(Col, Cntrl, pColDrop);
06306
06307 }
06308
06309
06310
06311
06312
06313
06314
06315
06316
06317
06318
06319
06320
06321
06322
06323
06324
06325
06326
06327
06328
06329 void AttrLinearFill::RenderFillMesh(RenderRegion* pRender,
06330 DocCoord* ControlPoints, BOOL* SelState,
06331 INT32 NumControlPoints)
06332 {
06333 #if !defined(EXCLUDE_FROM_RALPH)
06334 if (AllowRampRedraw == FALSE)
06335 {
06336 FillRamp *pRamp = GetFillRamp();
06337 if (pRamp)
06338 {
06339 pRamp->RenderSelectedBlob (ATTRVALUE(), pRender);
06340 }
06341
06342 return;
06343 }
06344
06345 DocCoord Start = ControlPoints[FILLCONTROL_STARTPOINT];
06346 DocCoord End = ControlPoints[FILLCONTROL_ENDPOINT];
06347
06348 if (Start == End)
06349 return;
06350
06351 if (SelState == NULL)
06352 {
06353
06354
06355 BOOL Selected[NUMCONTROLPOINTS];
06356 for (INT32 i=0; i< NumControlPoints; i++)
06357 {
06358 Selected[i] = FALSE;
06359 }
06360 SelState = Selected;
06361 }
06362
06363
06364 pRender->SaveContext();
06365
06366
06367 INT32 BlobSize = (Camelot.GetBlobManager())->GetBlobSize();
06368
06369
06370 Path ArrowPath;
06371 ArrowPath.Initialise();
06372 DocCoord LineEnd;
06373 MakeMeshArrow(&ArrowPath, Start, End, &LineEnd);
06374
06375
06376
06377
06378 pRender->SetLineColour(COLOUR_UNSELECTEDBLOB);
06379 pRender->SetFillColour(COLOUR_UNSELECTEDBLOB);
06380
06381
06382
06383 pRender->SetLineWidth(BlobSize/4);
06384 pRender->DrawLine(Start, LineEnd);
06385
06386
06387 pRender->SetLineWidth(0);
06388 pRender->SetLineColour(COLOUR_NONE);
06389 pRender->DrawPath(&ArrowPath);
06390
06391
06392
06393
06394 if (SelState[FILLCONTROL_STARTPOINT])
06395 {
06396
06397
06398 pRender->SetLineColour(COLOUR_NONE);
06399 pRender->SetFillColour(COLOUR_SELECTEDBLOB);
06400 pRender->DrawBlob(Start, BT_SELECTED);
06401 }
06402 else
06403 {
06404
06405
06406 pRender->SetLineColour(COLOUR_NONE);
06407 pRender->SetFillColour(COLOUR_UNSELECTEDBLOB);
06408 pRender->DrawBlob(Start, BT_UNSELECTED);
06409 }
06410
06411
06412 if (SelState[FILLCONTROL_ENDPOINT])
06413 {
06414
06415 pRender->SetLineColour(COLOUR_SELECTEDBLOB);
06416 pRender->SetFillColour(COLOUR_SELECTEDBLOB);
06417 pRender->DrawBlob(End, BT_SELECTED);
06418 }
06419 else
06420 {
06421
06422
06423 pRender->SetLineColour(COLOUR_NONE);
06424 pRender->SetFillColour(COLOUR_UNSELECTEDBLOB);
06425 pRender->DrawBlob(End, BT_UNSELECTED);
06426 }
06427
06428
06429 FillRamp *pRamp = GetFillRamp();
06430 if (pRamp)
06431 {
06432 pRamp->RenderRampBlobs(ATTRVALUE(), pRender, NULL);
06433 }
06434
06435
06436 pRender->RestoreContext();
06437 #endif
06438 }
06439
06440
06441
06442
06443
06444
06445
06446
06447
06448
06449
06450
06451 void AttrFillGeometry::DrawEndBlobs()
06452 {
06453 }
06454
06455
06456
06457
06458
06459
06460
06461
06462
06463
06464
06465
06466 void AttrLinearColourFill::RenderFillBlobs(RenderRegion* pRender)
06467 {
06468 #if !defined(EXCLUDE_FROM_RALPH)
06469 if (!IsVisible())
06470 return;
06471
06472
06473
06474 if (IsFillBeingEdited())
06475 return;
06476
06477
06478 if (CheckPreviousFillMesh())
06479 return;
06480
06481 DocCoord ControlPoints[2];
06482 ControlPoints[0] = (*GetStartPoint());
06483 ControlPoints[1] = (*GetEndPoint());
06484
06485
06486 RenderFillMesh(pRender, ControlPoints, SelectionState, 2);
06487
06488
06489
06490
06491
06492 #endif
06493 }
06494
06495
06496
06497
06498
06499
06500
06501
06502
06503
06504
06505
06506 void AttrLinearTranspFill::RenderFillBlobs(RenderRegion* pRender)
06507 {
06508 #if !defined(EXCLUDE_FROM_RALPH)
06509 if (!IsVisible())
06510 return;
06511
06512
06513
06514 if (IsFillBeingEdited())
06515 return;
06516
06517
06518 if (CheckPreviousFillMesh())
06519 return;
06520
06521 DocCoord ControlPoints[2];
06522 ControlPoints[0] = (*GetStartPoint());
06523 ControlPoints[1] = (*GetEndPoint());
06524
06525
06526 RenderFillMesh(pRender, ControlPoints, SelectionState, 2);
06527
06528
06529
06530
06531
06532 #endif
06533 }
06534
06535
06536
06537
06538
06539
06540
06541
06542
06543
06544
06545 void AttrLinearFill::ValidateAttributeValue()
06546 {
06547 #if !defined(EXCLUDE_FROM_RALPH)
06548 if ((*GetStartPoint()) != DocCoord(0,0) && (*GetEndPoint()) != DocCoord(0,0))
06549 return;
06550
06551
06552 DocRect AttrBounds = DocRect(0,0,0,0);
06553
06554 INT32 Width = DEFAULT_FILLWIDTH;
06555 INT32 Height = DEFAULT_FILLHEIGHT;
06556
06557
06558 if (FindParent() != NULL)
06559 {
06560
06561 SelRange* Selected = GetApplication()->FindSelection();
06562
06563 if (Selected == NULL || Selected->Count() <= 1)
06564 AttrBounds = ((NodeRenderableBounded*)FindParent())->GetBoundingRect(TRUE);
06565 else
06566 AttrBounds = Selected->GetBoundingRect();
06567
06568 Width = AttrBounds.Width();
06569 Height = AttrBounds.Height();
06570 }
06571
06572
06573 if ((*GetStartPoint()) == DocCoord(0,0))
06574 {
06575
06576 DocCoord temp = CentreOf(AttrBounds);
06577 SetStartPoint(&temp);
06578
06579
06580 temp = DocCoord((*GetStartPoint()).x + (Width/2), (*GetStartPoint()).y);
06581 SetEndPoint(&temp);
06582 }
06583
06584
06585 if ((*GetEndPoint()) == DocCoord(0,0))
06586 {
06587 DocCoord temp = DocCoord((*GetStartPoint()).x + (Width/2), (*GetStartPoint()).y);
06588 SetEndPoint(&temp);
06589 }
06590
06591 if ((*GetEndPoint2()) == DocCoord(0,0))
06592 {
06593 DocCoord temp = MakeLineAtAngle(*GetStartPoint(), *GetEndPoint(), 90);
06594 SetEndPoint2(&temp);
06595 }
06596 #endif
06597 }
06598
06600
06601
06602
06604
06605
06606
06607
06608
06609
06610
06611
06612
06613
06614
06615 void AttrLinearColourFill::Render(RenderRegion* pRender)
06616 {
06617 pRender->SetFillGeometry(&Value, FALSE);
06618 }
06619
06620
06621
06622
06623
06624
06625
06626
06627
06628
06629
06630
06631
06632
06633
06634
06635 Node* AttrLinearColourFill::SimpleCopy()
06636 {
06637 AttrLinearColourFill* NodeCopy = new AttrLinearColourFill();
06638 if (NodeCopy == NULL)
06639 return NULL;
06640
06641 CopyNodeContents(NodeCopy);
06642
06643 return NodeCopy;
06644 }
06645
06646
06647
06648
06649
06650
06651
06652
06653
06654
06655
06656
06657 UINT32 AttrLinearColourFill::GetAttrNameID(void)
06658 {
06659 return (_R(IDS_LINEARGRADFILL));
06660 }
06661
06662
06663
06664
06665
06666
06667
06668
06669
06670
06671
06672
06673 void AttrLinearColourFill::GetDebugDetails(StringBase* Str)
06674 {
06675 #ifdef _DEBUG
06676 NodeAttribute::GetDebugDetails( Str );
06677
06678 String_256 TempStr;
06679
06680 TempStr._MakeMsg( TEXT("\r\nLinear Graduated Fill:\r\n"));
06681 (*Str) += TempStr;
06682
06683
06684
06685
06686
06687
06688
06689
06690
06691 TempStr._MakeMsg(TEXT("\r\nStart point =(#1%ld, #2%ld)"),
06692 (*GetStartPoint()).x, (*GetStartPoint()).y);
06693 (*Str) += TempStr;
06694
06695 TempStr._MakeMsg(TEXT("\r\nEnd point =(#1%ld, #2%ld), "),
06696 (*GetEndPoint()).x, (*GetEndPoint()).y);
06697 (*Str) += TempStr;
06698
06699 for (INT32 i=0; i<5; i++)
06700 {
06701 TempStr._MakeMsg(TEXT("\r\nControl #1%ld = #2%ld"),
06702 i, SelectionState[i]);
06703 (*Str) += TempStr;
06704 }
06705 #endif
06706 }
06707
06708
06709
06710
06711
06712
06713
06714
06715
06716
06717
06718
06719
06720
06721 UINT32 AttrLinearColourFill::GetNodeSize() const
06722 {
06723 return sizeof(AttrLinearColourFill);
06724 }
06725
06726
06727
06728
06729
06730
06731
06732
06733
06734
06735
06736
06737
06738
06739
06740
06741 BOOL AttrLinearColourFill::WritePreChildrenWeb(BaseCamelotFilter* pFilter)
06742 {
06743 #ifdef DO_EXPORT
06744 ERROR2IF(pFilter == NULL,FALSE,"NULL filter param");
06745
06746
06747 INT32 StartColRef = pFilter->WriteRecord(&Value.Colour);
06748 INT32 EndColRef = pFilter->WriteRecord(&Value.EndColour);
06749
06750
06751 BOOL bMultistage = FALSE;
06752
06753 ColourRamp * pRamp = GetColourRamp();
06754 INT32 * pRampColRefs = NULL;
06755 double * pPositions = NULL;
06756 ColRampItem * pItem = NULL;
06757 UINT32 NumRampItems = 0;
06758
06759 if (pRamp)
06760 {
06761
06762 if (pRamp->GetCount() > 0)
06763 {
06764 bMultistage = TRUE;
06765 NumRampItems = pRamp->GetCount();
06766
06767 pRampColRefs = new INT32[NumRampItems];
06768 pPositions = new double[NumRampItems];
06769
06770 pItem = (ColRampItem *)pRamp->GetHead();
06771
06772 for (UINT32 i = 0 ; i < NumRampItems; i++)
06773 {
06774 if (pItem)
06775 {
06776 pPositions[i] = pItem->GetPosition();
06777 DocColour tempcolour = pItem->GetColour();
06778 pRampColRefs[i] = pFilter->WriteRecord(&tempcolour);
06779 }
06780
06781 pItem = (ColRampItem *)pRamp->GetNext(pItem);
06782 }
06783 }
06784 }
06785
06786
06787 BOOL ok = ((StartColRef != 0) && (EndColRef != 0));
06788
06789
06790
06791 BOOL b3PointLinear = (!AreLinesPerpendicular(GetStartPoint(), GetEndPoint(), GetEndPoint2()));
06792
06793 if (ok)
06794 {
06795 if (!bMultistage)
06796 {
06797 INT32 tag = TAG_LINEARFILL;
06798 UINT32 size = TAG_LINEARFILL_SIZE;
06799 if (b3PointLinear)
06800 {
06801 tag = TAG_LINEARFILL3POINT;
06802 size = TAG_LINEARFILL3POINT_SIZE;
06803 }
06804
06805 CamelotFileRecord Rec(pFilter, tag, size);
06806
06807 if (ok) ok = Rec.Init();
06808 if (ok) ok = Rec.WriteCoord(Value.StartPoint);
06809 if (ok) ok = Rec.WriteCoord(Value.EndPoint);
06810 if (ok && b3PointLinear) ok = Rec.WriteCoord(Value.EndPoint2);
06811 if (ok) ok = Rec.WriteReference(StartColRef);
06812 if (ok) ok = Rec.WriteReference(EndColRef);
06813 if (ok) ok = Rec.WriteDOUBLE ((double) GetProfile ().GetBias ());
06814 if (ok) ok = Rec.WriteDOUBLE ((double) GetProfile ().GetGain ());
06815 if (ok) ok = pFilter->Write(&Rec);
06816 }
06817 else
06818 {
06819 INT32 tag = TAG_LINEARFILLMULTISTAGE;
06820 INT32 size = TAG_LINEARFILLMULTISTAGE_SIZE;
06821 if (b3PointLinear)
06822 {
06823 tag = TAG_LINEARFILLMULTISTAGE3POINT;
06824 size = TAG_LINEARFILLMULTISTAGE3POINT_SIZE;
06825 }
06826
06827 CamelotFileRecord Rec(pFilter, tag, size);
06828
06829 if (ok) ok = Rec.Init();
06830 if (ok) ok = Rec.WriteCoord(Value.StartPoint);
06831 if (ok) ok = Rec.WriteCoord(Value.EndPoint);
06832 if (ok && b3PointLinear) ok = Rec.WriteCoord(Value.EndPoint2);
06833 if (ok) ok = Rec.WriteReference(StartColRef);
06834 if (ok) ok = Rec.WriteReference(EndColRef);
06835
06836
06837 if (ok) ok = Rec.WriteUINT32(NumRampItems);
06838
06839 for (UINT32 i = 0 ; i < NumRampItems; i++)
06840 {
06841 if (ok) ok = Rec.WriteDOUBLE(pPositions[i]);
06842 if (ok) ok = Rec.WriteReference(pRampColRefs[i]);
06843 }
06844
06845 if (ok) ok = pFilter->Write(&Rec);
06846 }
06847 }
06848
06849 if (pRampColRefs)
06850 delete [] pRampColRefs;
06851
06852 if (pPositions)
06853 delete [] pPositions;
06854
06855 if (!ok)
06856 pFilter->GotError(_R(IDE_FILE_WRITE_ERROR));
06857
06858 return ok;
06859 #else
06860 return FALSE;
06861 #endif
06862 }
06863
06864
06865
06866
06867 BOOL AttrLinearColourFill::WritePreChildrenNative(BaseCamelotFilter* pFilter)
06868 {
06869 #ifdef DO_EXPORT
06870 return WritePreChildrenWeb(pFilter);
06871 #else
06872 return FALSE;
06873 #endif
06874 }
06875
06876
06877
06878
06879
06880
06881
06882
06883
06884
06885
06886
06887
06888
06889
06890
06891 BOOL AttrLinearColourFill::WriteColourDefinitions (BaseCamelotFilter* pFilter)
06892 {
06893
06894 INT32 StartColRef = pFilter->WriteRecord(&Value.Colour);
06895 INT32 EndColRef = pFilter->WriteRecord(&Value.EndColour);
06896
06897 BOOL ok = ((StartColRef != 0) && (EndColRef != 0));
06898
06899 if (ok)
06900 {
06901 ColourRamp * pRamp = GetColourRamp();
06902 if (pRamp)
06903 if (pRamp->GetCount() > 0)
06904 {
06905 ok = pRamp->WriteColourDefinitions (pFilter);
06906 }
06907 }
06908
06909 return (ok);
06910 }
06911
06913
06914
06915
06917
06918
06919
06920
06921
06922
06923
06924
06925
06926
06927
06928 void AttrLinearTranspFill::Render(RenderRegion* pRender)
06929 {
06930 pRender->SetTranspFillGeometry(&Value, FALSE);
06931 }
06932
06933
06934
06935
06936
06937
06938
06939
06940
06941
06942
06943
06944
06945
06946
06947
06948 Node* AttrLinearTranspFill::SimpleCopy()
06949 {
06950 AttrLinearTranspFill* NodeCopy = new AttrLinearTranspFill();
06951 if (NodeCopy == NULL)
06952 return NULL;
06953
06954 CopyNodeContents(NodeCopy);
06955
06956 return NodeCopy;
06957 }
06958
06959
06960
06961
06962
06963
06964
06965
06966
06967
06968
06969
06970 UINT32 AttrLinearTranspFill::GetAttrNameID(void)
06971 {
06972 return (_R(IDS_LINEARTRANSPFILL));
06973 }
06974
06975
06976
06977
06978
06979
06980
06981
06982
06983
06984
06985
06986 void AttrLinearTranspFill::GetDebugDetails(StringBase* Str)
06987 {
06988 #ifdef _DEBUG
06989 NodeAttribute::GetDebugDetails( Str );
06990
06991 String_256 TempStr;
06992
06993 TempStr._MakeMsg( TEXT("\r\nLinear Graduated Transp:\r\n"));
06994 (*Str) += TempStr;
06995
06996 TempStr._MakeMsg(TEXT("\r\nStart = #1%u"), *GetStartTransp() );
06997 (*Str) += TempStr;
06998
06999 TempStr._MakeMsg(TEXT("\r\nEnd = #1%u"), *GetEndTransp() );
07000 (*Str) += TempStr;
07001
07002 TempStr._MakeMsg(TEXT("\r\nStart point =(#1%ld, #2%ld)"),
07003 (*GetStartPoint()).x, (*GetStartPoint()).y);
07004 (*Str) += TempStr;
07005
07006 TempStr._MakeMsg(TEXT("\r\nEnd point =(#1%ld, #2%ld), "),
07007 (*GetEndPoint()).x, (*GetEndPoint()).y);
07008 (*Str) += TempStr;
07009 #endif
07010 }
07011
07012
07013
07014
07015
07016
07017
07018
07019
07020
07021
07022
07023
07024
07025 UINT32 AttrLinearTranspFill::GetNodeSize() const
07026 {
07027 return sizeof(AttrLinearTranspFill);
07028 }
07029
07030
07031
07032
07033
07034
07035
07036
07037
07038
07039
07040
07041
07042
07043
07044
07045 BOOL AttrLinearTranspFill::WritePreChildrenWeb(BaseCamelotFilter* pFilter)
07046 {
07047 #ifdef DO_EXPORT
07048 ERROR2IF(pFilter == NULL,FALSE,"NULL filter param");
07049 ERROR3IF(Value.Transp > 255,"Start transparency level is too high to be stored as a byte");
07050 ERROR3IF(Value.EndTransp > 255,"End transparency level is too high to be stored as a byte");
07051 ERROR3IF(Value.TranspType > 255,"Transparency type is too high to be stored as a byte");
07052
07053 BOOL ok = TRUE;
07054
07055
07056
07057 BOOL b3PointLinear = (!AreLinesPerpendicular(GetStartPoint(), GetEndPoint(), GetEndPoint2()));
07058
07059 INT32 tag = TAG_LINEARTRANSPARENTFILL;
07060 UINT32 size = TAG_LINEARTRANSPARENTFILL_SIZE;
07061 if (b3PointLinear)
07062 {
07063 tag = TAG_LINEARTRANSPARENTFILL3POINT;
07064 size = TAG_LINEARTRANSPARENTFILL3POINT_SIZE;
07065 }
07066
07067 CamelotFileRecord Rec(pFilter, tag, size);
07068
07069 if (ok) ok = Rec.Init();
07070 if (ok) ok = Rec.WriteCoord(Value.StartPoint);
07071 if (ok) ok = Rec.WriteCoord(Value.EndPoint);
07072 if (ok && b3PointLinear) ok = Rec.WriteCoord(Value.EndPoint2);
07073 if (ok) ok = Rec.WriteBYTE(BYTE(Value.Transp));
07074 if (ok) ok = Rec.WriteBYTE(BYTE(Value.EndTransp));
07075 if (ok) ok = Rec.WriteBYTE(BYTE(Value.TranspType));
07076 if (ok) ok = Rec.WriteDOUBLE ((double) GetProfile ().GetBias ());
07077 if (ok) ok = Rec.WriteDOUBLE ((double) GetProfile ().GetGain ());
07078 if (ok) ok = pFilter->Write(&Rec);
07079
07080 if (!ok)
07081 pFilter->GotError(_R(IDE_FILE_WRITE_ERROR));
07082
07083 return ok;
07084 #else
07085 return FALSE;
07086 #endif
07087 }
07088
07089
07090
07091
07092 BOOL AttrLinearTranspFill::WritePreChildrenNative(BaseCamelotFilter* pFilter)
07093 {
07094 #ifdef DO_EXPORT
07095 return WritePreChildrenWeb(pFilter);
07096 #else
07097 return FALSE;
07098 #endif
07099 }
07100
07101
07102
07103
07104
07105
07106
07107
07108
07109
07110
07111
07112
07113
07114
07115
07116 BOOL AttrLinearTranspFill::HasEquivalentDefaultValue(BOOL bAppearance)
07117 {
07118
07119 if (bAppearance)
07120 return (Value.TranspType==TT_NoTranspType || (Value.TranspType==TT_Mix && Value.Transp == 0 && Value.EndTransp==0));
07121 else
07122 return FALSE;
07123 }
07124
07125
07126
07127
07129
07130
07131
07133
07134
07135
07136
07137
07138
07139
07140
07141
07142
07143
07144
07145
07146 void AttrRadialFill::Transform( TransformBase& Trans )
07147 {
07148 if ( Trans.TransFills )
07149 {
07150 Trans.Transform( GetStartPoint(), 1);
07151 Trans.Transform( GetEndPoint(), 1);
07152 Trans.Transform( GetEndPoint2(), 1);
07153
07154 if (IsPerspective())
07155 Trans.Transform( GetEndPoint3(), 1);
07156
07157
07158 if (IsCircular() &&
07159 (!AreLinesPerpendicular(GetStartPoint(), GetEndPoint(), GetEndPoint2()) ||
07160 ( ABS( (*GetStartPoint()).Distance(*GetEndPoint())
07161 - (*GetStartPoint()).Distance(*GetEndPoint2()) ) ) > 5 ))
07162 {
07163
07164 MakeElliptical();
07165 }
07166 }
07167 }
07168
07169
07170
07171
07172
07173
07174
07175
07176
07177
07178
07179
07180
07181 BOOL AttrRadialFill::CanTransform()
07182 {
07183 return TRUE;
07184 }
07185
07186
07187
07188
07189
07190
07191
07192
07193
07194
07195
07196
07197
07198
07199
07200
07201
07202
07203
07204 BOOL AttrRadialFill::NeedsToRenderAtEachBrushStroke() const
07205 {
07206 return TRUE;
07207 }
07208
07209
07210
07211
07212
07213
07214
07215
07216
07217
07218
07219
07220
07221
07222 void AttrRadialFill::OnControlDrag( DocCoord Pos, FillControl& DragControl, ClickModifiers ClickMods)
07223 {
07224 #if !defined(EXCLUDE_FROM_RALPH)
07225
07226 DocCoord StartPoint = *GetStartPoint();
07227 DocCoord EndPoint = *GetEndPoint();
07228 DocCoord EndPoint2 = *GetEndPoint2();
07229
07230 INT32 dx, dy;
07231
07232
07233 switch (DragControl)
07234 {
07235 case FILLCONTROL_STARTPOINT:
07236
07237
07238 dx = StartPoint.x - Pos.x;
07239 dy = StartPoint.y - Pos.y;
07240
07241 EndPoint.translate(-dx, -dy);
07242 EndPoint2.translate(-dx, -dy);
07243
07244 SetEndPoint(&EndPoint);
07245 SetEndPoint2(&EndPoint2);
07246 SetStartPoint(&Pos);
07247 break;
07248
07249 case FILLCONTROL_ENDPOINT:
07250
07251
07252
07253
07254 if (ClickMods.Constrain)
07255 DocView::ConstrainToAngle(StartPoint, &Pos);
07256
07257
07258
07259 if (IsCircular() || ClickMods.Adjust)
07260 {
07261 double OldLen = StartPoint.Distance(EndPoint);
07262 double NewLen = StartPoint.Distance(Pos);
07263 double Ratio = 1.0;
07264
07265 if (OldLen == 0)
07266 Ratio = 0;
07267 else
07268 Ratio = NewLen/OldLen;
07269
07270
07271 DocCoord temp = MakeLineAtAngle(StartPoint, Pos, 90, INT32(StartPoint.Distance(EndPoint2) * Ratio));
07272 SetEndPoint2(&temp);
07273 }
07274 else
07275 {
07276
07277 DocCoord temp = MakeLineAtAngle(StartPoint, Pos, 90, INT32(StartPoint.Distance(EndPoint2)));
07278 SetEndPoint2(&temp);
07279 }
07280
07281 SetEndPoint(&Pos);
07282 break;
07283
07284 case FILLCONTROL_SECONDARYPOINT:
07285
07286
07287
07288
07289 if (ClickMods.Constrain)
07290 DocView::ConstrainToAngle(StartPoint, &Pos);
07291
07292
07293
07294 if (IsCircular() || ClickMods.Adjust)
07295 {
07296 double OldLen = StartPoint.Distance(EndPoint2);
07297 double NewLen = StartPoint.Distance(Pos);
07298 double Ratio = 1.0;
07299
07300 if (OldLen == 0)
07301 Ratio = 0;
07302 else
07303 Ratio = NewLen/OldLen;
07304
07305
07306 DocCoord temp = MakeLineAtAngle(StartPoint, Pos, -90, INT32(StartPoint.Distance(EndPoint) * Ratio));
07307 SetEndPoint(&temp);
07308 }
07309 else
07310 {
07311
07312 DocCoord temp = MakeLineAtAngle(StartPoint, Pos, -90, INT32(StartPoint.Distance(EndPoint)));
07313 SetEndPoint(&temp);
07314 }
07315
07316 SetEndPoint2(&Pos);
07317 break;
07318 default:
07319
07320 if (ISA_RAMPINDEX(DragControl))
07321 {
07322 AttrFillGeometry::OnControlDrag( Pos, DragControl, ClickMods);
07323 }
07324 break;
07325 }
07326 #endif
07327 }
07328
07329
07330
07331
07332
07333
07334
07335
07336
07337
07338
07339 void AttrRadialFill::ValidateAttributeValue()
07340 {
07341 #if !defined(EXCLUDE_FROM_RALPH)
07342 if ((*GetStartPoint()) != DocCoord(0,0) && (*GetEndPoint()) != DocCoord(0,0))
07343 {
07344
07345 if (*GetEndPoint2() == DocCoord(0,0))
07346 {
07347 DocCoord temp = MakeLineAtAngle((*GetStartPoint()), (*GetEndPoint()), 90);
07348 SetEndPoint2(&temp);
07349 return;
07350 }
07351
07352
07353
07354
07355
07356
07357
07358 if (IsCircular())
07359 {
07360
07361
07362 DocCoord temp = MakeLineAtAngle((*GetStartPoint()), (*GetEndPoint()), 90);
07363 SetEndPoint2(&temp);
07364 }
07365
07366 return;
07367 }
07368
07369
07370 DocRect AttrBounds = DocRect(0,0,0,0);
07371
07372 INT32 Width = DEFAULT_FILLWIDTH;
07373 INT32 Height = DEFAULT_FILLHEIGHT;
07374
07375
07376 if (FindParent() != NULL)
07377 {
07378
07379 SelRange* Selected = GetApplication()->FindSelection();
07380
07381 if (Selected == NULL || Selected->Count() <= 1)
07382 AttrBounds = ((NodeRenderableBounded*)FindParent())->GetBoundingRect(TRUE);
07383 else
07384 AttrBounds = Selected->GetBoundingRect();
07385
07386 Width = AttrBounds.Width();
07387 Height = AttrBounds.Height();
07388 }
07389
07390
07391 if ((*GetStartPoint()) == DocCoord(0,0))
07392 {
07393
07394 DocCoord temp = CentreOf(AttrBounds);
07395 SetStartPoint(&temp);
07396
07397 temp = DocCoord((*GetStartPoint()).x + (Width/2), (*GetStartPoint()).y);
07398 SetEndPoint(&temp);
07399 temp = DocCoord((*GetStartPoint()).x, (*GetStartPoint()).y + (Height/2));
07400 SetEndPoint2(&temp);
07401 }
07402
07403
07404 if ((*GetEndPoint()) == DocCoord(0,0))
07405 {
07406 DocCoord temp = DocCoord((*GetStartPoint()).x + (Width/2), (*GetStartPoint()).y);
07407 SetEndPoint(&temp);
07408 temp = DocCoord((*GetStartPoint()).x, (*GetStartPoint()).y + (Height/2));
07409 SetEndPoint2(&temp);
07410 }
07411
07412 if ((*GetEndPoint2()) == DocCoord(0,0))
07413 {
07414 DocCoord temp = MakeLineAtAngle((*GetStartPoint()), (*GetEndPoint()), 90, Height/2);
07415 SetEndPoint2(&temp);
07416 }
07417
07418 if (IsCircular())
07419 {
07420 DocCoord temp = MakeLineAtAngle((*GetStartPoint()), (*GetEndPoint()));
07421 SetEndPoint2(&temp);
07422 }
07423 #endif
07424 }
07425
07426
07427
07428
07429
07430
07431
07432
07433
07434
07435
07436
07437
07438
07439 DocRect AttrRadialFill::GetBlobBoundingRect()
07440 {
07441 #if !defined(EXCLUDE_FROM_RALPH)
07442
07443
07444
07445 if ( (!GetApplication()->GetBlobManager()->GetCurrentInterest(TRUE).Fill || !IsVisible()) && DraggedFill != this )
07446 return DocRect(0,0, 0,0);
07447
07448
07449 DocCoord StartPoint = *GetStartPoint();
07450 DocCoord EndPoint = *GetEndPoint();
07451 DocCoord EndPoint2 = *GetEndPoint2();
07452
07453
07454 DocRect BoundingRect(StartPoint, StartPoint);
07455
07456 if (DraggedFill == this)
07457 {
07458
07459
07460 DocRect StartBlobRect;
07461 DocRect EndBlobRect;
07462
07463 DocRect DragRect = GetMeshEllipseBounds(StartPoint, EndPoint, EndPoint2);
07464
07465
07466 (Camelot.GetBlobManager())->GetBlobRect(DragRect.lo, &StartBlobRect);
07467 (Camelot.GetBlobManager())->GetBlobRect(DragRect.hi, &EndBlobRect);
07468
07469
07470
07471
07472 BoundingRect.IncludePoint(StartBlobRect.lo);
07473 BoundingRect.IncludePoint(StartBlobRect.hi);
07474 BoundingRect.IncludePoint(EndBlobRect.lo);
07475 BoundingRect.IncludePoint(EndBlobRect.hi);
07476 }
07477 else
07478 {
07479
07480 DocRect StartBlobRect;
07481 DocRect EndBlobRect;
07482 DocRect End2BlobRect;
07483
07484
07485 (Camelot.GetBlobManager())->GetBlobRect(StartPoint, &StartBlobRect);
07486 (Camelot.GetBlobManager())->GetBlobRect(EndPoint, &EndBlobRect);
07487 (Camelot.GetBlobManager())->GetBlobRect(EndPoint2, &End2BlobRect);
07488
07489
07490
07491
07492 BoundingRect.IncludePoint(StartBlobRect.lo);
07493 BoundingRect.IncludePoint(StartBlobRect.hi);
07494 BoundingRect.IncludePoint(EndBlobRect.lo);
07495 BoundingRect.IncludePoint(EndBlobRect.hi);
07496 BoundingRect.IncludePoint(End2BlobRect.lo);
07497 BoundingRect.IncludePoint(End2BlobRect.hi);
07498 }
07499
07500 IncludeArrowHead(&BoundingRect, StartPoint, EndPoint);
07501 IncludeArrowHead(&BoundingRect, StartPoint, EndPoint2);
07502
07503
07504 return BoundingRect;
07505 #else
07506 return DocRect(0,0, 0,0);
07507 #endif
07508 }
07509
07510
07511
07512
07513
07514
07515
07516
07517
07518
07519
07520
07521
07522
07523
07524 FillControl AttrRadialFill::CheckForControlHit(DocCoord &ClickPos)
07525 {
07526 #if !defined(EXCLUDE_FROM_RALPH)
07527 if (!GetApplication()->GetBlobManager()->GetCurrentInterest().Fill || !IsVisible())
07528 return FILLCONTROL_NULL;
07529
07530 return AttrFillGeometry::CheckForControlHit(ClickPos);
07531
07532
07533 FillControl HitControl = FILLCONTROL_NULL;
07534 DocRect BlobRect;
07535
07536
07537 DocCoord CentrePoint = *GetStartPoint();
07538 DocCoord EndColBlob = *GetEndPoint();
07539 DocCoord End2ColBlob = *GetEndPoint2();
07540
07541
07542 (Camelot.GetBlobManager())->GetBlobRect(CentrePoint, &BlobRect);
07543
07544 if ( BlobRect.ContainsCoord(ClickPos) )
07545 HitControl = FILLCONTROL_STARTPOINT;
07546
07547
07548 (Camelot.GetBlobManager())->GetBlobRect(EndColBlob, &BlobRect);
07549
07550 if ( BlobRect.ContainsCoord(ClickPos) )
07551 HitControl = FILLCONTROL_ENDPOINT;
07552
07553 if (IsElliptical())
07554 {
07555
07556
07557
07558 (Camelot.GetBlobManager())->GetBlobRect(End2ColBlob, &BlobRect);
07559
07560 if ( BlobRect.ContainsCoord(ClickPos) )
07561 HitControl = FILLCONTROL_SECONDARYPOINT;
07562 }
07563
07564 return HitControl;
07565 #else
07566 return FILLCONTROL_NULL;
07567 #endif
07568 }
07569
07570
07571
07572
07573
07574
07575
07576
07577
07578
07579
07580
07581
07582
07583
07584
07585
07586
07587 void AttrRadialFill::RenderFillMesh(RenderRegion* pRender,
07588 DocCoord* ControlPoints, BOOL* SelState,
07589 INT32 NumControlPoints)
07590 {
07591 #if !defined(EXCLUDE_FROM_RALPH)
07592 if (AllowRampRedraw == FALSE)
07593 {
07594 FillRamp *pRamp = GetFillRamp();
07595 if (pRamp)
07596 {
07597 pRamp->RenderSelectedBlob (ATTRVALUE(), pRender);
07598 }
07599
07600 return;
07601 }
07602
07603 DocCoord Start = ControlPoints[FILLCONTROL_STARTPOINT];
07604 DocCoord End = ControlPoints[FILLCONTROL_ENDPOINT];
07605
07606 if (Start == End)
07607 return;
07608
07609 if (SelState == NULL)
07610 {
07611
07612
07613 BOOL Selected[NUMCONTROLPOINTS];
07614 for (INT32 i=0; i< NumControlPoints; i++)
07615 {
07616 Selected[i] = FALSE;
07617 }
07618 SelState = Selected;
07619 }
07620
07621 DocCoord End2 = ControlPoints[FILLCONTROL_SECONDARYPOINT];
07622
07623
07624 pRender->SaveContext();
07625
07626
07627 INT32 BlobSize = (Camelot.GetBlobManager())->GetBlobSize();
07628
07629
07630 Path ArrowPath;
07631 ArrowPath.Initialise();
07632 DocCoord LineEnd;
07633 MakeMeshArrow(&ArrowPath, Start, End, &LineEnd);
07634
07635
07636
07637 Path ArrowPath2;
07638 DocCoord LineEnd2;
07639
07640 if (IsElliptical())
07641 {
07642
07643 ArrowPath2.Initialise();
07644 MakeMeshArrow(&ArrowPath2, Start, End2, &LineEnd2);
07645 }
07646
07647
07648 pRender->SetLineWidth(0);
07649 pRender->SetLineColour(COLOUR_UNSELECTEDBLOB);
07650 pRender->SetFillColour(COLOUR_UNSELECTEDBLOB);
07651
07652
07653 pRender->SetLineWidth(BlobSize/4);
07654 pRender->DrawLine(Start, LineEnd);
07655
07656
07657 if (IsElliptical())
07658 pRender->DrawLine(Start, LineEnd2);
07659
07660
07661 pRender->SetLineWidth(0);
07662 pRender->SetLineColour(COLOUR_NONE);
07663 pRender->DrawPath(&ArrowPath);
07664
07665
07666 if (IsElliptical())
07667 pRender->DrawPath(&ArrowPath2);
07668
07669 if (DraggedFill == this)
07670 {
07671 if (AllowBoundsRedraw)
07672 {
07673
07674
07675 pRender->SetLineColour(COLOUR_SELECTEDBLOB);
07676 pRender->SetFillColour(COLOUR_NONE);
07677
07678 Path EllipsePath;
07679 EllipsePath.Initialise();
07680
07681 MakeMeshEllipse(&EllipsePath, Start, End, End2);
07682
07683 pRender->DrawPath(&EllipsePath);
07684 }
07685 }
07686
07687
07688
07689
07690 if (SelState[FILLCONTROL_STARTPOINT])
07691 {
07692
07693
07694 pRender->SetLineColour(COLOUR_NONE);
07695 pRender->SetFillColour(COLOUR_SELECTEDBLOB);
07696 pRender->DrawBlob(Start, BT_SELECTED);
07697 }
07698 else
07699 {
07700
07701
07702 pRender->SetLineColour(COLOUR_NONE);
07703 pRender->SetFillColour(COLOUR_UNSELECTEDBLOB);
07704 pRender->DrawBlob(Start, BT_UNSELECTED);
07705 }
07706
07707
07708 if (SelState[FILLCONTROL_ENDPOINT])
07709 {
07710
07711
07712 pRender->SetLineColour(COLOUR_NONE);
07713 pRender->SetFillColour(COLOUR_SELECTEDBLOB);
07714 pRender->DrawBlob(End, BT_SELECTED);
07715 if (IsElliptical())
07716 pRender->DrawBlob(End2,BT_SELECTED);
07717 }
07718 else
07719 {
07720
07721
07722 pRender->SetLineColour(COLOUR_NONE);
07723 pRender->SetFillColour(COLOUR_UNSELECTEDBLOB);
07724 pRender->DrawBlob(End, BT_UNSELECTED);
07725 if (IsElliptical())
07726 pRender->DrawBlob(End2,BT_UNSELECTED);
07727 }
07728
07729
07730 FillRamp *pRamp = GetFillRamp();
07731 if (pRamp)
07732 pRamp->RenderRampBlobs(ATTRVALUE(), pRender, NULL);
07733
07734
07735 pRender->RestoreContext();
07736 #endif
07737 }
07738
07739
07740
07741
07742
07743
07744
07745
07746
07747
07748
07749
07750 void AttrRadialColourFill::RenderFillBlobs(RenderRegion* pRender)
07751 {
07752 #if !defined(EXCLUDE_FROM_RALPH)
07753 if (!IsVisible())
07754 return;
07755
07756
07757
07758 if (IsFillBeingEdited())
07759 return;
07760
07761
07762 if (CheckPreviousFillMesh())
07763 return;
07764
07765 DocCoord ControlPoints[5];
07766 ControlPoints[FILLCONTROL_STARTPOINT] = (*GetStartPoint());
07767 ControlPoints[FILLCONTROL_ENDPOINT] = (*GetEndPoint());
07768 ControlPoints[FILLCONTROL_SECONDARYPOINT] = (*GetEndPoint2());
07769
07770
07771 RenderFillMesh(pRender, ControlPoints, SelectionState, 5);
07772
07773
07774
07775
07776
07777 #endif
07778 }
07779
07780
07781
07782
07783
07784
07785
07786
07787
07788
07789
07790
07791 void AttrRadialTranspFill::RenderFillBlobs(RenderRegion* pRender)
07792 {
07793 #if !defined(EXCLUDE_FROM_RALPH)
07794 if (!IsVisible())
07795 return;
07796
07797
07798
07799 if (IsFillBeingEdited())
07800 return;
07801
07802
07803 if (CheckPreviousFillMesh())
07804 return;
07805
07806 DocCoord ControlPoints[5];
07807 ControlPoints[FILLCONTROL_STARTPOINT] = (*GetStartPoint());
07808 ControlPoints[FILLCONTROL_ENDPOINT] = (*GetEndPoint());
07809 ControlPoints[FILLCONTROL_SECONDARYPOINT] = (*GetEndPoint2());
07810
07811
07812 RenderFillMesh(pRender, ControlPoints, SelectionState, 5);
07813
07814
07815
07816
07817
07818 #endif
07819 }
07820
07821
07822
07823
07824
07825
07826
07827
07828
07829
07830
07831
07832
07833
07834 void AttrRadialFill::MakeCircular()
07835 {
07836 ((FillGeometryAttribute*)GetAttributeValue())->SetAspectLock(TRUE);
07837 }
07838
07839
07840
07841
07842
07843
07844
07845
07846
07847
07848
07849
07850
07851
07852 void AttrRadialFill::MakeElliptical()
07853 {
07854 ((FillGeometryAttribute*)GetAttributeValue())->SetAspectLock(FALSE);
07855 }
07856
07858
07859
07860
07862
07863
07864
07865
07866
07867
07868
07869
07870
07871
07872
07873 void AttrRadialColourFill::Render(RenderRegion* pRender)
07874 {
07875 pRender->SetFillGeometry(&Value, FALSE);
07876 }
07877
07878
07879
07880
07881
07882
07883
07884
07885
07886
07887
07888
07889
07890
07891
07892
07893 Node* AttrRadialColourFill::SimpleCopy()
07894 {
07895 AttrRadialColourFill* NodeCopy = new AttrRadialColourFill();
07896 if (NodeCopy == NULL)
07897 return NULL;
07898
07899 CopyNodeContents(NodeCopy);
07900
07901 return NodeCopy;
07902 }
07903
07904
07905
07906
07907
07908
07909
07910
07911
07912
07913
07914
07915 UINT32 AttrRadialColourFill::GetAttrNameID(void)
07916 {
07917 if (IsElliptical ())
07918 {
07919 return (_R(IDS_ELLIPITICALGRADFILL));
07920 }
07921 else
07922 {
07923 return (_R(IDS_CIRCULARGRADFILL));
07924 }
07925 }
07926
07927
07928
07929
07930
07931
07932
07933
07934
07935
07936
07937
07938
07939
07940 void AttrRadialColourFill::GetDebugDetails(StringBase* Str)
07941 {
07942 #ifdef _DEBUG
07943 NodeAttribute::GetDebugDetails( Str );
07944
07945 String_256 TempStr;
07946
07947 TempStr._MakeMsg( TEXT("\r\nRadial Graduated Fill:\r\n"));
07948 (*Str) += TempStr;
07949
07950
07951
07952
07953
07954
07955
07956
07957
07958 TempStr._MakeMsg(TEXT("\r\nStart point =(#1%ld, #2%ld)"),
07959 (*GetStartPoint()).x, (*GetStartPoint()).y);
07960 (*Str) += TempStr;
07961
07962 TempStr._MakeMsg(TEXT("\r\nEnd point =(#1%ld, #2%ld), "),
07963 (*GetEndPoint()).x, (*GetEndPoint()).y);
07964 (*Str) += TempStr;
07965
07966 TempStr._MakeMsg(TEXT("\r\nEnd point2 = (#1%ld, #2%ld) "),
07967 (*GetEndPoint2()).x, (*GetEndPoint2()).y);
07968 (*Str) += TempStr;
07969 #endif
07970 }
07971
07972
07973
07974
07975
07976
07977
07978
07979
07980
07981
07982
07983
07984 UINT32 AttrRadialColourFill::GetNodeSize() const
07985 {
07986 return sizeof(AttrRadialColourFill);
07987 }
07988
07989
07990
07991
07992
07993
07994
07995
07996
07997
07998
07999
08000
08001
08002
08003
08004 BOOL AttrRadialColourFill::WritePreChildrenWeb(BaseCamelotFilter* pFilter)
08005 {
08006 #ifdef DO_EXPORT
08007 ERROR2IF(pFilter == NULL,FALSE,"NULL filter param");
08008
08009 UINT32 Tag = TAG_CIRCULARFILL;
08010 INT32 TagSize = TAG_CIRCULARFILL_SIZE;
08011
08012 if (IsElliptical())
08013 {
08014 Tag = TAG_ELLIPTICALFILL;
08015 TagSize = TAG_ELLIPTICALFILL_SIZE;
08016 }
08017
08018
08019 INT32 StartColRef = pFilter->WriteRecord(&Value.Colour);
08020 INT32 EndColRef = pFilter->WriteRecord(&Value.EndColour);
08021
08022
08023 BOOL bMultistage = FALSE;
08024
08025
08026 ColourRamp * pRamp = GetColourRamp();
08027 INT32 * pRampColRefs = NULL;
08028 double * pPositions = NULL;
08029 ColRampItem * pItem = NULL;
08030 UINT32 NumRampItems = 0;
08031
08032 if (pRamp)
08033 {
08034
08035 if (pRamp->GetCount() > 0)
08036 {
08037 bMultistage = TRUE;
08038 NumRampItems = pRamp->GetCount();
08039
08040 pRampColRefs = new INT32[NumRampItems];
08041 pPositions = new double[NumRampItems];
08042
08043 pItem = (ColRampItem *)pRamp->GetHead();
08044
08045 for (UINT32 i = 0 ; i < NumRampItems; i++)
08046 {
08047 if (pItem)
08048 {
08049 pPositions[i] = pItem->GetPosition();
08050 DocColour tempcolour = pItem->GetColour();
08051 pRampColRefs[i] = pFilter->WriteRecord(&tempcolour);
08052 }
08053
08054 pItem = (ColRampItem *)pRamp->GetNext(pItem);
08055 }
08056 }
08057 }
08058
08059
08060 BOOL ok = ((StartColRef != 0) && (EndColRef != 0));
08061
08062 if (!bMultistage)
08063 {
08064 if (ok)
08065 {
08066 CamelotFileRecord Rec(pFilter,Tag,TagSize);
08067
08068 if (ok) ok = Rec.Init();
08069 if (ok) ok = Rec.WriteCoord(Value.StartPoint);
08070 if (ok) ok = Rec.WriteCoord(Value.EndPoint);
08071
08072 if (ok && IsElliptical())
08073 ok = Rec.WriteCoord(Value.EndPoint2);
08074
08075 if (ok) ok = Rec.WriteReference(StartColRef);
08076 if (ok) ok = Rec.WriteReference(EndColRef);
08077
08078 if (ok) ok = Rec.WriteDOUBLE ((double) GetProfile ().GetBias ());
08079 if (ok) ok = Rec.WriteDOUBLE ((double) GetProfile ().GetGain ());
08080
08081 if (ok) ok = pFilter->Write(&Rec);
08082 }
08083 }
08084 else
08085 {
08086 if (IsElliptical())
08087 {
08088 Tag = TAG_ELLIPTICALFILLMULTISTAGE;
08089 TagSize = TAG_ELLIPTICALFILLMULTISTAGE_SIZE;
08090 }
08091 else
08092 {
08093 Tag = TAG_CIRCULARFILLMULTISTAGE;
08094 TagSize = TAG_CIRCULARFILLMULTISTAGE_SIZE;
08095 }
08096
08097 if (ok)
08098 {
08099 CamelotFileRecord Rec(pFilter,Tag,TagSize);
08100
08101 if (ok) ok = Rec.Init();
08102 if (ok) ok = Rec.WriteCoord(Value.StartPoint);
08103 if (ok) ok = Rec.WriteCoord(Value.EndPoint);
08104
08105 if (ok && IsElliptical())
08106 ok = Rec.WriteCoord(Value.EndPoint2);
08107
08108 if (ok) ok = Rec.WriteReference(StartColRef);
08109 if (ok) ok = Rec.WriteReference(EndColRef);
08110
08111
08112 if (ok) ok = Rec.WriteUINT32(NumRampItems);
08113
08114 for (UINT32 i = 0 ; i < NumRampItems; i++)
08115 {
08116 if (ok) ok = Rec.WriteDOUBLE(pPositions[i]);
08117 if (ok) ok = Rec.WriteReference(pRampColRefs[i]);
08118 }
08119
08120 if (ok) ok = pFilter->Write(&Rec);
08121 }
08122 }
08123
08124 if (pRampColRefs)
08125 delete [] pRampColRefs;
08126
08127 if (pPositions)
08128 delete [] pPositions;
08129
08130
08131 if (!ok)
08132 pFilter->GotError(_R(IDE_FILE_WRITE_ERROR));
08133
08134 return ok;
08135 #else
08136 return FALSE;
08137 #endif
08138 }
08139
08140
08141
08142
08143 BOOL AttrRadialColourFill::WritePreChildrenNative(BaseCamelotFilter* pFilter)
08144 {
08145 #ifdef DO_EXPORT
08146 return WritePreChildrenWeb(pFilter);
08147 #else
08148 return FALSE;
08149 #endif
08150 }
08151
08152
08153
08154
08155
08156
08157
08158
08159
08160
08161
08162
08163
08164
08165
08166
08167 BOOL AttrRadialColourFill::WriteColourDefinitions (BaseCamelotFilter* pFilter)
08168 {
08169
08170 INT32 StartColRef = pFilter->WriteRecord(&Value.Colour);
08171 INT32 EndColRef = pFilter->WriteRecord(&Value.EndColour);
08172
08173 BOOL ok = ((StartColRef != 0) && (EndColRef != 0));
08174
08175 if (ok)
08176 {
08177 ColourRamp * pRamp = GetColourRamp();
08178 if (pRamp)
08179 if (pRamp->GetCount() > 0)
08180 {
08181 ok = pRamp->WriteColourDefinitions (pFilter);
08182 }
08183 }
08184
08185 return (ok);
08186 }
08187
08189
08190
08191
08193
08194
08195
08196
08197
08198
08199
08200
08201
08202
08203
08204 void AttrRadialTranspFill::Render(RenderRegion* pRender)
08205 {
08206 pRender->SetTranspFillGeometry(&Value, FALSE);
08207 }
08208
08209
08210
08211
08212
08213
08214
08215
08216
08217
08218
08219
08220
08221
08222
08223
08224 Node* AttrRadialTranspFill::SimpleCopy()
08225 {
08226 AttrRadialTranspFill* NodeCopy = new AttrRadialTranspFill();
08227 if (NodeCopy == NULL)
08228 return NULL;
08229
08230 CopyNodeContents(NodeCopy);
08231
08232 return NodeCopy;
08233 }
08234
08235
08236
08237
08238
08239
08240
08241
08242
08243
08244
08245
08246 UINT32 AttrRadialTranspFill::GetAttrNameID(void)
08247 {
08248 if (!IsATranspFill ())
08249 {
08250 if (IsElliptical ())
08251 {
08252 return (_R(IDS_LINEARGRADFILL));
08253 }
08254 else
08255 {
08256 return (_R(IDS_CIRCULARGRADFILL));
08257 }
08258 }
08259 else
08260 {
08261 if (IsElliptical ())
08262 {
08263 return (_R(IDS_ELLIPITICALTRANSPFILL));
08264 }
08265 else
08266 {
08267 return (_R(IDS_CIRCULARTRANSPFILL));
08268 }
08269 }
08270 }
08271
08272
08273
08274
08275
08276
08277
08278
08279
08280
08281
08282
08283 void AttrRadialTranspFill::GetDebugDetails(StringBase* Str)
08284 {
08285 #ifdef _DEBUG
08286 NodeAttribute::GetDebugDetails( Str );
08287
08288 String_256 TempStr;
08289
08290 TempStr._MakeMsg( TEXT("\r\nRadial Graduated Fill:\r\n"));
08291 (*Str) += TempStr;
08292
08293 TempStr._MakeMsg(TEXT("\r\nStart"));
08294 (*Str) += TempStr;
08295
08296 TempStr._MakeMsg(TEXT("\r\nEnd"));
08297 (*Str) += TempStr;
08298
08299 TempStr._MakeMsg(TEXT("\r\nStart point =(#1%ld, #2%ld)"),
08300 (*GetStartPoint()).x, (*GetStartPoint()).y);
08301 (*Str) += TempStr;
08302
08303 TempStr._MakeMsg(TEXT("\r\nEnd point =(#1%ld, #2%ld), "),
08304 (*GetEndPoint()).x, (*GetEndPoint()).y);
08305 (*Str) += TempStr;
08306
08307 TempStr._MakeMsg(TEXT("\r\nEnd point2 = (#1%ld, #2%ld) "),
08308 (*GetEndPoint2()).x, (*GetEndPoint2()).y);
08309 (*Str) += TempStr;
08310 #endif
08311 }
08312
08313
08314
08315
08316
08317
08318
08319
08320
08321
08322
08323
08324
08325 UINT32 AttrRadialTranspFill::GetNodeSize() const
08326 {
08327 return sizeof(AttrRadialTranspFill);
08328 }
08329
08330
08331
08332
08333
08334
08335
08336
08337
08338
08339
08340
08341
08342
08343
08344
08345
08346
08347
08348 BOOL AttrRadialTranspFill::NeedsToRenderAtEachBrushStroke() const
08349 {
08350 return TRUE;
08351 }
08352
08353
08354
08355
08356
08357
08358
08359
08360
08361
08362
08363
08364
08365
08366 BOOL AttrRadialTranspFill::WritePreChildrenWeb(BaseCamelotFilter* pFilter)
08367 {
08368 #ifdef DO_EXPORT
08369 ERROR2IF(pFilter == NULL,FALSE,"NULL filter param");
08370 ERROR3IF(Value.Transp > 255,"Start transparency level is too high to be stored as a byte");
08371 ERROR3IF(Value.EndTransp > 255,"End transparency level is too high to be stored as a byte");
08372 ERROR3IF(Value.TranspType > 255,"Transparency type is too high to be stored as a byte");
08373
08374 BOOL ok = TRUE;
08375
08376 UINT32 Tag = TAG_CIRCULARTRANSPARENTFILL, TagSize = TAG_CIRCULARTRANSPARENTFILL_SIZE;
08377
08378 if (IsElliptical())
08379 {
08380 Tag = TAG_ELLIPTICALTRANSPARENTFILL;
08381 TagSize = TAG_ELLIPTICALTRANSPARENTFILL_SIZE;
08382 }
08383
08384 CamelotFileRecord Rec(pFilter,Tag,TagSize);
08385
08386 if (ok) ok = Rec.Init();
08387 if (ok) ok = Rec.WriteCoord(Value.StartPoint);
08388 if (ok) ok = Rec.WriteCoord(Value.EndPoint);
08389
08390 if (ok && IsElliptical())
08391 if (ok) ok = Rec.WriteCoord(Value.EndPoint2);
08392
08393 if (ok) ok = Rec.WriteBYTE(BYTE(Value.Transp));
08394 if (ok) ok = Rec.WriteBYTE(BYTE(Value.EndTransp));
08395 if (ok) ok = Rec.WriteBYTE(BYTE(Value.TranspType));
08396 if (ok) ok = Rec.WriteDOUBLE ((double) GetProfile ().GetBias ());
08397 if (ok) ok = Rec.WriteDOUBLE ((double) GetProfile ().GetGain ());
08398 if (ok) ok = pFilter->Write(&Rec);
08399
08400 if (!ok)
08401 pFilter->GotError(_R(IDE_FILE_WRITE_ERROR));
08402
08403 return ok;
08404 #else
08405 return FALSE;
08406 #endif
08407 }
08408
08409
08410
08411
08412
08413
08414
08415
08416
08417
08418
08419
08420
08421
08422
08423 BOOL AttrRadialTranspFill::HasEquivalentDefaultValue(BOOL bAppearance)
08424 {
08425
08426 if (bAppearance)
08427 return (Value.TranspType==TT_NoTranspType || (Value.TranspType==TT_Mix && Value.Transp == 0 && Value.EndTransp==0));
08428 else
08429 return FALSE;
08430 }
08431
08432
08433
08434
08435
08436
08437
08438 BOOL AttrRadialTranspFill::WritePreChildrenNative(BaseCamelotFilter* pFilter)
08439 {
08440 #ifdef DO_EXPORT
08441 return WritePreChildrenWeb(pFilter);
08442 #else
08443 return FALSE;
08444 #endif
08445 }
08446
08447
08449
08450
08451
08453
08454
08455
08456
08457
08458
08459
08460
08461
08462
08463
08464
08465
08466 void AttrConicalFill::Transform( TransformBase& Trans )
08467 {
08468 if ( Trans.TransFills )
08469 {
08470 Trans.Transform( GetStartPoint(), 1);
08471 Trans.Transform( GetEndPoint(), 1);
08472
08473
08474 }
08475 }
08476
08477
08478
08479
08480
08481
08482
08483
08484
08485
08486
08487
08488
08489 void AttrConicalFill::TransformSelectedControlPoints( TransformBase& Trans, BOOL* isARampBlob )
08490 {
08491 #if !defined(EXCLUDE_FROM_RALPH)
08492 if ( Trans.TransFills )
08493 {
08494 ClickModifiers ClickMods;
08495 ClickMods.Adjust = TRUE;
08496
08497 if (GetStartPoint() && IsSelected(FILLCONTROL_STARTPOINT))
08498 {
08499 DocCoord Pos = *GetStartPoint();
08500 Trans.Transform( &Pos, 1);
08501
08502 FillControl Pt = FILLCONTROL_DRAGPOINT;
08503
08504 OnControlDrag(Pos, Pt, ClickMods);
08505 }
08506
08507 if (GetEndPoint() && IsSelected(FILLCONTROL_ENDPOINT))
08508 {
08509 DocCoord Pos = *GetEndPoint();
08510 Trans.Transform( &Pos, 1);
08511
08512 FillControl End = FILLCONTROL_ENDPOINT;
08513
08514 OnControlDrag(Pos, End, ClickMods);
08515 }
08516
08517
08518
08519 TransformSelectedFillRampControlPoints (Trans, ClickMods, isARampBlob);
08520 }
08521 #endif
08522 }
08523
08524
08525
08526
08527
08528
08529
08530
08531
08532
08533
08534
08535
08536 BOOL AttrConicalFill::CanTransform()
08537 {
08538 return TRUE;
08539 }
08540
08541
08542
08543
08544
08545
08546
08547
08548
08549
08550
08551
08552
08553
08554
08555
08556 FillControl AttrConicalFill::CheckForControlHit(DocCoord &ClickPos)
08557 {
08558 #if !defined(EXCLUDE_FROM_RALPH)
08559 if (!GetApplication()->GetBlobManager()->GetCurrentInterest().Fill || !IsVisible())
08560 return FILLCONTROL_NULL;
08561
08562
08563 FillControl HitControl = FILLCONTROL_NULL;
08564 DocRect BlobRect;
08565
08566
08567 DocCoord CentrePoint = *GetStartPoint();
08568 DocCoord EndColBlob = *GetEndPoint();
08569 DocCoord StartColBlob = MakeLineAtAngle(CentrePoint, EndColBlob, 180);
08570
08571
08572 (Camelot.GetBlobManager())->GetBlobRect(CentrePoint, &BlobRect);
08573
08574 if ( BlobRect.ContainsCoord(ClickPos) )
08575 HitControl = FILLCONTROL_DRAGPOINT;
08576
08577
08578 (Camelot.GetBlobManager())->GetBlobRect(StartColBlob, &BlobRect);
08579
08580 if ( BlobRect.ContainsCoord(ClickPos) )
08581 HitControl = FILLCONTROL_STARTPOINT;
08582
08583
08584 (Camelot.GetBlobManager())->GetBlobRect(EndColBlob, &BlobRect);
08585
08586 if ( BlobRect.ContainsCoord(ClickPos) )
08587 HitControl = FILLCONTROL_ENDPOINT;
08588
08589
08590 if (HitControl == FILLCONTROL_NULL)
08591 {
08592
08593 if (GetColourRamp())
08594 {
08595
08596
08597
08598 return AttrFillGeometry::CheckForControlHit(ClickPos);
08599 }
08600 else
08601 {
08602
08603 double d = FindRampPoint(ClickPos, *GetStartPoint(), *GetEndPoint());
08604
08605 if (d > 0 && d < 1)
08606 {
08607 return FILLCONTROL_RAMPPOINT;
08608 }
08609 }
08610 }
08611
08612 return HitControl;
08613 #else
08614 return FILLCONTROL_NULL;
08615 #endif
08616 }
08617
08618
08619
08620
08621
08622
08623
08624
08625
08626
08627 AttrFillGeometry* AttrConicalFill::DoColourDrop(AttrColourDrop* ColDrop)
08628 {
08629 AttrFillGeometry* NewFill;
08630 DocColour DroppedColour = *ColDrop->GetStartColour();
08631
08632
08633 FillControl ControlHit = TestColourDrop(ColDrop);
08634
08635 if (ControlHit == FILLCONTROL_NULL)
08636 {
08637
08638 NewFill = new AttrFlatColourFill;
08639 if (NewFill == NULL)
08640 return NULL;
08641
08642
08643 NewFill->SetStartColour(&DroppedColour);
08644
08645 BOOL InSelection = ColDrop->IsObjectSelected();
08646
08647 if (InSelection &&
08648 GetApplication()->GetBlobManager()->GetCurrentInterest().Fill &&
08649 IsVisible()
08650 )
08651 {
08652 BOOL UniqueFill = TRUE;
08653
08654 AttrFillGeometry* pAttr = FindFirstSelectedAttr();
08655 while (pAttr != NULL)
08656 {
08657 if (pAttr != this && GetAttributeType() == pAttr->GetAttributeType())
08658 {
08659 if ( IsMeshSame((FillGeometryAttribute*)GetAttributeValue(),
08660 (FillGeometryAttribute*)pAttr->GetAttributeValue()) )
08661 {
08662 UniqueFill = FALSE;
08663 break;
08664 }
08665 }
08666
08667
08668 pAttr = FindNextSelectedAttr();
08669 }
08670
08671
08672
08673
08674
08675 }
08676
08677 return NewFill;
08678 }
08679
08680 if (FindParent() && FindParent()->IsCompound())
08681 {
08682 if (ColDrop->GetObjectDroppedOn() &&
08683 !(ColDrop->GetObjectDroppedOn()->IsCompound()) &&
08684 ColDrop->IsObjectSelected())
08685 {
08686
08687
08688
08689 }
08690 }
08691
08692
08693 NewFill = (AttrFillGeometry*)this->SimpleCopy();
08694 if (NewFill == NULL)
08695 return NULL;
08696
08697 if (!NewFill->ChangeControlColour(DroppedColour, ControlHit, ColDrop))
08698 {
08699 delete NewFill;
08700 return NULL;
08701 }
08702
08703
08704 Document * pDoc = Document::GetCurrent();
08705
08706 if (pDoc)
08707 pDoc->ForceRedraw(FindParentSpread(), GetBlobBoundingRect(), FALSE, this->FindParent());
08708
08709
08710 return NewFill;
08711 }
08712
08713
08714
08715
08716
08717
08718
08719
08720
08721
08722
08723
08724
08725
08726
08727
08728 void AttrConicalFill::RenderControl(FillControl Control, BOOL RenderOn)
08729 {
08730 #if !defined(EXCLUDE_FROM_RALPH)
08731 DocRect ControlRect;
08732
08733
08734
08735 NodeRenderable* pParent = (NodeRenderable*)FindParent();
08736
08737 if (pParent == NULL)
08738 return;
08739
08740 if (IsBlobSame(Control))
08741 return;
08742
08743 Spread* pSpread = this->FindParentSpread();
08744
08745 DocCoord StartPoint = *GetStartPoint();
08746 DocCoord EndPoint = *GetEndPoint();
08747 DocCoord EndPoint2 =
08748 MakeLineAtAngle(StartPoint, EndPoint, 180);
08749
08750 switch (Control)
08751 {
08752 case FILLCONTROL_DRAGPOINT:
08753
08754 (Camelot.GetBlobManager())->GetBlobRect(StartPoint, &ControlRect);
08755 break;
08756
08757 case FILLCONTROL_STARTPOINT:
08758
08759 (Camelot.GetBlobManager())->GetBlobRect(EndPoint2, &ControlRect);
08760 break;
08761
08762 case FILLCONTROL_ENDPOINT:
08763
08764 (Camelot.GetBlobManager())->GetBlobRect(EndPoint, &ControlRect);
08765 break;
08766 }
08767
08768 if (ISA_RAMPINDEX(Control))
08769 {
08770 FillRamp* pRamp = GetFillRamp();
08771 if (pRamp)
08772 {
08773 DocCoord point = pRamp->GetGeometryCoord(ATTRVALUE(), Control);
08774 (Camelot.GetBlobManager())->GetBlobRect(point, &ControlRect, TRUE);
08775 }
08776 }
08777
08778
08779 RenderFillControl(RenderOn, &ControlRect, pSpread, pParent);
08780 #endif
08781 }
08782
08783
08784
08785
08786
08787
08788
08789
08790
08791
08792
08793
08794
08795
08796 void AttrConicalFill::OnControlDrag( DocCoord Pos, FillControl& DragControl, ClickModifiers ClickMods)
08797 {
08798
08799 DocCoord StartPoint = *GetStartPoint();
08800 DocCoord EndPoint = *GetEndPoint();
08801
08802 INT32 dx, dy;
08803
08804 switch (DragControl)
08805 {
08806 case FILLCONTROL_DRAGPOINT:
08807
08808 dx = StartPoint.x - Pos.x;
08809 dy = StartPoint.y - Pos.y;
08810
08811 EndPoint.translate(-dx, -dy);
08812 SetEndPoint(&EndPoint);
08813 SetStartPoint(&Pos);
08814 break;
08815
08816 case FILLCONTROL_STARTPOINT:
08817
08818
08819
08820 if (ClickMods.Constrain)
08821 DocView::ConstrainToAngle(StartPoint, &Pos);
08822
08823 {
08824 DocCoord coord( MakeLineAtAngle( StartPoint, Pos, 180 ) );
08825 SetEndPoint( &coord );
08826 }
08827 break;
08828
08829 case FILLCONTROL_ENDPOINT:
08830
08831
08832
08833 if (ClickMods.Constrain)
08834 DocView::ConstrainToAngle(StartPoint, &Pos);
08835
08836 SetEndPoint(&Pos);
08837 break;
08838 default:
08839
08840 if (ISA_RAMPINDEX(DragControl))
08841 {
08842 FillRamp *pRamp = GetFillRamp();
08843
08844 if (pRamp)
08845 {
08846 float t = (float)FindRampPoint(Pos, *GetStartPoint(), *GetEndPoint());
08847
08848 if (t > 0 && t < 1.0)
08849 {
08850 FillControl NewDragControl = pRamp->SetPosition(DragControl, t);
08851
08852 if (NewDragControl != DragControl)
08853 {
08854 DragControl = NewDragControl;
08855 }
08856
08857 Document * pDoc = Document::GetCurrent();
08858
08859 if (pDoc)
08860 {
08861 Spread * pSpread = (Spread *)FindParent(CC_RUNTIME_CLASS(Spread));
08862
08863 if (pSpread)
08864 {
08865 if (AllowRampRedraw)
08866 {
08867 pDoc->ForceRedraw(pSpread, GetBlobBoundingRect(), FALSE, this->FindParent());
08868 }
08869 }
08870 else
08871 {
08872 pSpread = Document::GetSelectedSpread();
08873
08874 if (pSpread)
08875 {
08876 if (AllowRampRedraw)
08877 {
08878 pDoc->ForceRedraw(pSpread, GetBlobBoundingRect(), FALSE, this->FindParent());
08879 }
08880
08881 }
08882 }
08883 }
08884
08885 }
08886 }
08887 }
08888 break;
08889 }
08890 }
08891
08892
08893
08894
08895
08896
08897
08898
08899
08900
08901
08902
08903
08904
08905
08906 double AttrConicalFill::FindRampPoint(DocCoord &dc, DocCoord &StartPoint, DocCoord &EndPoint)
08907 {
08908
08909 DocCoord Centre((StartPoint.x + EndPoint.x) / 2, (StartPoint.y + EndPoint.y) / 2);
08910
08911 double dStartX = StartPoint.x;
08912 double dStartY = StartPoint.y;
08913
08914 double dEndX = EndPoint.x;
08915 double dEndY = EndPoint.y;
08916
08917 double dVecX = dEndX - dStartX;
08918 double dVecY = dEndY - dStartY;
08919
08920
08921 double ddX = dc.x - StartPoint.x;
08922 double ddY = dc.y - StartPoint.y;
08923
08924 double DistToPoint = sqrt((ddX * ddX) + (ddY * ddY));
08925
08926
08927
08928 double DistToEndPoint = sqrt((dVecX * dVecX) + (dVecY * dVecY));
08929
08930 double dRMod = 1/DistToEndPoint;
08931 dVecX *= dRMod;
08932 dVecY *= dRMod;
08933
08934 double dToPointX = ((double)dc.x) - dStartX;
08935 double dToPointY = ((double)dc.y) - dStartY;
08936
08937 dRMod = 1/sqrt((dToPointX * dToPointX) + (dToPointY * dToPointY));
08938
08939 dToPointX *= dRMod;
08940 dToPointY *= dRMod;
08941
08942 double dot = (dToPointX * dVecX) + (dToPointY * dVecY);
08943
08944
08945
08946
08947 double dot90 = (-dToPointY * dVecX) + (dToPointX * dVecY);
08948
08949 if (dot > 1.0)
08950 dot = 1.0;
08951
08952 if (dot < -1.0)
08953 dot = -1.0;
08954
08955
08956 double Angle = acos(dot) * 180.0 / 3.142;
08957
08958 double Retn = (180.0 - Angle) / 180.0;
08959
08960 double dBlobSize = (double)(Camelot.GetBlobManager())->GetBlobSize();
08961
08962
08963 if (fabs(DistToPoint - DistToEndPoint) < dBlobSize && dot90 < 0)
08964 {
08965 return Retn;
08966 }
08967
08968 return -1;
08969 }
08970
08971
08972
08973
08974
08975
08976
08977
08978
08979
08980
08981
08982 void AttrConicalFill::ValidateAttributeValue()
08983 {
08984 #if !defined(EXCLUDE_FROM_RALPH)
08985 if ((*GetStartPoint()) != DocCoord(0,0) && (*GetEndPoint()) != DocCoord(0,0))
08986 return;
08987
08988
08989 DocRect AttrBounds = DocRect(0,0,0,0);
08990
08991 INT32 Width = DEFAULT_FILLWIDTH;
08992 INT32 Height = DEFAULT_FILLHEIGHT;
08993
08994
08995 if (FindParent() != NULL)
08996 {
08997
08998 SelRange* Selected = GetApplication()->FindSelection();
08999
09000 if (Selected == NULL || Selected->Count() <= 1)
09001 AttrBounds = ((NodeRenderableBounded*)FindParent())->GetBoundingRect(TRUE);
09002 else
09003 AttrBounds = Selected->GetBoundingRect();
09004
09005 Width = AttrBounds.Width();
09006 Height = AttrBounds.Height();
09007 }
09008
09009
09010 if ((*GetStartPoint()) == DocCoord(0,0))
09011 {
09012
09013 DocCoord temp = CentreOf(AttrBounds);
09014 SetStartPoint(&temp);
09015
09016
09017 temp = DocCoord((*GetStartPoint()).x + (Width/2), (*GetStartPoint()).y);
09018 SetEndPoint(&temp);
09019 }
09020
09021
09022 if ((*GetEndPoint()) == DocCoord(0,0))
09023 {
09024 DocCoord temp = DocCoord((*GetStartPoint()).x + (Width/2), (*GetStartPoint()).y);
09025 SetEndPoint(&temp);
09026 }
09027 #endif
09028 }
09029
09030
09031
09032
09033
09034
09035
09036
09037
09038
09039
09040
09041
09042
09043 DocRect AttrConicalFill::GetBlobBoundingRect()
09044 {
09045 #if !defined(EXCLUDE_FROM_RALPH)
09046
09047
09048
09049 if ( (!GetApplication()->GetBlobManager()->GetCurrentInterest(TRUE).Fill || !IsVisible()) && DraggedFill != this )
09050 return DocRect(0,0, 0,0);
09051
09052
09053 DocCoord StartPoint = *GetStartPoint();
09054 DocCoord EndPoint = *GetEndPoint();
09055 DocCoord EndPoint2 = MakeLineAtAngle(StartPoint, EndPoint, 180);
09056
09057 DocRect StartBlobRect;
09058 DocRect EndBlobRect;
09059
09060 DocRect BoundingRect = GetMeshEllipseBounds(StartPoint, EndPoint);
09061
09062
09063 (Camelot.GetBlobManager())->GetBlobRect(BoundingRect.lo, &StartBlobRect);
09064 (Camelot.GetBlobManager())->GetBlobRect(BoundingRect.hi, &EndBlobRect);
09065
09066
09067
09068
09069 BoundingRect.IncludePoint(StartBlobRect.lo);
09070 BoundingRect.IncludePoint(StartBlobRect.hi);
09071 BoundingRect.IncludePoint(EndBlobRect.lo);
09072 BoundingRect.IncludePoint(EndBlobRect.hi);
09073
09074 DocCoord Temp = MakeLineAtAngle(EndPoint, StartPoint, -90);
09075 IncludeArrowHead(&BoundingRect, Temp, EndPoint);
09076
09077
09078 return BoundingRect;
09079 #else
09080 return DocRect(0,0, 0,0);
09081 #endif
09082 }
09083
09084
09085
09086
09087
09088
09089
09090
09091
09092
09093
09094
09095
09096
09097
09098
09099
09100
09101 void AttrConicalFill::RenderFillMesh(RenderRegion* pRender,
09102 DocCoord* ControlPoints, BOOL* SelState,
09103 INT32 NumControlPoints)
09104 {
09105 #if !defined(EXCLUDE_FROM_RALPH)
09106 if (AllowRampRedraw == FALSE)
09107 {
09108 FillRamp *pRamp = GetFillRamp();
09109 if (pRamp)
09110 {
09111 pRamp->RenderSelectedBlob (ATTRVALUE(), pRender);
09112 }
09113
09114 return;
09115 }
09116
09117 DocCoord Start = ControlPoints[FILLCONTROL_STARTPOINT];
09118 DocCoord End = ControlPoints[FILLCONTROL_ENDPOINT];
09119
09120 if (Start == End)
09121 return;
09122
09123 if (SelState == NULL)
09124 {
09125
09126
09127 BOOL Selected[NUMCONTROLPOINTS];
09128 for (INT32 i=0; i< NumControlPoints; i++)
09129 {
09130 Selected[i] = FALSE;
09131 }
09132 SelState = Selected;
09133 }
09134
09135 DocCoord End2 = MakeLineAtAngle(Start, End, 180);
09136
09137
09138 pRender->SaveContext();
09139
09140
09141 INT32 BlobSize = (Camelot.GetBlobManager())->GetBlobSize();
09142
09143
09144 Path ArrowPath;
09145 ArrowPath.Initialise();
09146 DocCoord LineEnd;
09147 DocCoord Temp = MakeLineAtAngle(End, Start, -90);
09148 MakeMeshArrow(&ArrowPath, Temp, End, &LineEnd);
09149
09150
09151
09152 Path EllipsePath;
09153 EllipsePath.Initialise();
09154 MakeMeshSemiCircle(&EllipsePath, Start, End, LineEnd);
09155
09156
09157 pRender->SetLineColour(COLOUR_UNSELECTEDBLOB);
09158 pRender->SetFillColour(COLOUR_UNSELECTEDBLOB);
09159
09160
09161 pRender->SetFillColour(COLOUR_NONE);
09162
09163 if (DraggedFill == this)
09164 {
09165 if (AllowBoundsRedraw)
09166 {
09167
09168
09169 pRender->DrawLine(Start, End);
09170 pRender->DrawLine(Start, End2);
09171 }
09172 }
09173
09174
09175 pRender->SetLineWidth(BlobSize/4);
09176 pRender->DrawPath(&EllipsePath);
09177
09178
09179 pRender->SetLineWidth(0);
09180 pRender->SetLineColour(COLOUR_NONE);
09181 pRender->SetFillColour(COLOUR_UNSELECTEDBLOB);
09182 pRender->DrawPath(&ArrowPath);
09183
09184
09185
09186 pRender->SetLineColour(COLOUR_NONE);
09187 pRender->SetFillColour(COLOUR_UNSELECTEDBLOB);
09188 pRender->DrawBlob(Start, BT_UNSELECTED);
09189
09190
09191 if (SelState[FILLCONTROL_ENDPOINT])
09192 {
09193
09194
09195 pRender->SetLineColour(COLOUR_NONE);
09196 pRender->SetFillColour(COLOUR_SELECTEDBLOB);
09197 pRender->DrawBlob(End, BT_SELECTED);
09198 }
09199 else
09200 {
09201
09202
09203 pRender->SetLineColour(COLOUR_NONE);
09204 pRender->SetFillColour(COLOUR_UNSELECTEDBLOB);
09205 pRender->DrawBlob(End, BT_UNSELECTED);
09206 }
09207
09208
09209 if (SelState[FILLCONTROL_STARTPOINT])
09210 {
09211
09212
09213 pRender->SetLineColour(COLOUR_NONE);
09214 pRender->SetFillColour(COLOUR_SELECTEDBLOB);
09215 pRender->DrawBlob(End2, BT_SELECTED);
09216 }
09217 else
09218 {
09219
09220
09221 pRender->SetLineColour(COLOUR_NONE);
09222 pRender->SetFillColour(COLOUR_UNSELECTEDBLOB);
09223 pRender->DrawBlob(End2, BT_UNSELECTED);
09224 }
09225
09226
09227 FillRamp *pRamp = GetFillRamp();
09228 if (pRamp)
09229 pRamp->RenderRampBlobs(ATTRVALUE(), pRender, NULL);
09230
09231
09232 pRender->RestoreContext();
09233 #endif
09234 }
09235
09236
09237
09238
09239
09240
09241
09242
09243
09244
09245
09246
09247 void AttrConicalColourFill::RenderFillBlobs(RenderRegion* pRender)
09248 {
09249 #if !defined(EXCLUDE_FROM_RALPH)
09250 if (!IsVisible())
09251 return;
09252
09253
09254
09255 if (IsFillBeingEdited())
09256 return;
09257
09258
09259 if (CheckPreviousFillMesh())
09260 return;
09261
09262 DocCoord ControlPoints[2];
09263 ControlPoints[0] = (*GetStartPoint());
09264 ControlPoints[1] = (*GetEndPoint());
09265
09266
09267 RenderFillMesh(pRender, ControlPoints, SelectionState, 2);
09268
09269
09270
09271
09272
09273 #endif
09274 }
09275
09276
09277
09278
09279
09280
09281
09282
09283
09284
09285
09286
09287 void AttrConicalTranspFill::RenderFillBlobs(RenderRegion* pRender)
09288 {
09289 #if !defined(EXCLUDE_FROM_RALPH)
09290 if (!IsVisible())
09291 return;
09292
09293
09294
09295 if (IsFillBeingEdited())
09296 return;
09297
09298
09299 if (CheckPreviousFillMesh())
09300 return;
09301
09302 DocCoord ControlPoints[2];
09303 ControlPoints[0] = (*GetStartPoint());
09304 ControlPoints[1] = (*GetEndPoint());
09305
09306
09307 RenderFillMesh(pRender, ControlPoints, SelectionState, 2);
09308
09309
09310
09311
09312
09313 #endif
09314 }
09315
09317
09318
09319
09321
09322
09323
09324
09325
09326
09327
09328
09329
09330
09331
09332 void AttrConicalColourFill::Render(RenderRegion* pRender)
09333 {
09334 pRender->SetFillGeometry(&Value, FALSE);
09335 }
09336
09337
09338
09339
09340
09341
09342
09343
09344
09345
09346
09347
09348
09349
09350
09351
09352 Node* AttrConicalColourFill::SimpleCopy()
09353 {
09354 AttrConicalColourFill* NodeCopy = new AttrConicalColourFill();
09355 if (NodeCopy == NULL)
09356 return NULL;
09357
09358 CopyNodeContents(NodeCopy);
09359
09360 return NodeCopy;
09361 }
09362
09363
09364
09365
09366
09367
09368
09369
09370
09371
09372
09373
09374 UINT32 AttrConicalColourFill::GetAttrNameID(void)
09375 {
09376 return (_R(IDS_CONICALGRADFILL));
09377 }
09378
09379
09380
09381
09382
09383
09384
09385
09386
09387
09388
09389
09390 void AttrConicalColourFill::GetDebugDetails(StringBase* Str)
09391 {
09392 #ifdef _DEBUG
09393 NodeAttribute::GetDebugDetails( Str );
09394
09395 String_256 TempStr;
09396
09397 TempStr._MakeMsg( TEXT("\r\nConical Graduated Fill:\r\n"));
09398 (*Str) += TempStr;
09399
09400
09401
09402
09403
09404
09405
09406
09407
09408 TempStr._MakeMsg(TEXT("\r\nStart point =(#1%ld, #2%ld)"),
09409 (*GetStartPoint()).x, (*GetStartPoint()).y);
09410 (*Str) += TempStr;
09411
09412 TempStr._MakeMsg(TEXT("\r\nEnd point =(#1%ld, #2%ld), "),
09413 (*GetEndPoint()).x, (*GetEndPoint()).y);
09414 (*Str) += TempStr;
09415 #endif
09416 }
09417
09418
09419
09420
09421
09422
09423
09424
09425
09426
09427
09428
09429
09430 UINT32 AttrConicalColourFill::GetNodeSize() const
09431 {
09432 return sizeof(AttrConicalColourFill);
09433 }
09434
09435
09436
09437
09438
09439
09440
09441
09442
09443
09444
09445
09446
09447
09448
09449
09450 BOOL AttrConicalColourFill::WritePreChildrenWeb(BaseCamelotFilter* pFilter)
09451 {
09452 #ifdef DO_EXPORT
09453 ERROR2IF(pFilter == NULL,FALSE,"NULL filter param");
09454
09455
09456 INT32 StartColRef = pFilter->WriteRecord(&Value.Colour);
09457 INT32 EndColRef = pFilter->WriteRecord(&Value.EndColour);
09458
09459
09460 BOOL bMultistage = FALSE;
09461
09462 ColourRamp * pRamp = GetColourRamp();
09463 INT32 * pRampColRefs = NULL;
09464 double * pPositions = NULL;
09465 ColRampItem * pItem = NULL;
09466 UINT32 NumRampItems = 0;
09467
09468 if (pRamp)
09469 {
09470
09471 if (pRamp->GetCount() > 0)
09472 {
09473 bMultistage = TRUE;
09474 NumRampItems = pRamp->GetCount();
09475
09476 pRampColRefs = new INT32[NumRampItems];
09477 pPositions = new double[NumRampItems];
09478
09479 pItem = (ColRampItem *)pRamp->GetHead();
09480
09481 for (UINT32 i = 0 ; i < NumRampItems; i++)
09482 {
09483 if (pItem)
09484 {
09485 pPositions[i] = pItem->GetPosition();
09486 DocColour tempcolour = pItem->GetColour();
09487 pRampColRefs[i] = pFilter->WriteRecord(&tempcolour);
09488 }
09489
09490 pItem = (ColRampItem *)pRamp->GetNext(pItem);
09491 }
09492 }
09493 }
09494
09495
09496 BOOL ok = ((StartColRef != 0) && (EndColRef != 0));
09497
09498 if (ok)
09499 {
09500 if (!bMultistage)
09501 {
09502 CamelotFileRecord Rec(pFilter,TAG_CONICALFILL,TAG_CONICALFILL_SIZE);
09503
09504 if (ok) ok = Rec.Init();
09505 if (ok) ok = Rec.WriteCoord(Value.StartPoint);
09506 if (ok) ok = Rec.WriteCoord(Value.EndPoint);
09507 if (ok) ok = Rec.WriteReference(StartColRef);
09508 if (ok) ok = Rec.WriteReference(EndColRef);
09509 if (ok) ok = Rec.WriteDOUBLE ((double) GetProfile ().GetBias ());
09510 if (ok) ok = Rec.WriteDOUBLE ((double) GetProfile ().GetGain ());
09511 if (ok) ok = pFilter->Write(&Rec);
09512 }
09513 else
09514 {
09515 CamelotFileRecord Rec(pFilter,TAG_CONICALFILLMULTISTAGE,
09516 TAG_CONICALFILLMULTISTAGE_SIZE);
09517
09518 if (ok) ok = Rec.Init();
09519 if (ok) ok = Rec.WriteCoord(Value.StartPoint);
09520 if (ok) ok = Rec.WriteCoord(Value.EndPoint);
09521 if (ok) ok = Rec.WriteReference(StartColRef);
09522 if (ok) ok = Rec.WriteReference(EndColRef);
09523
09524
09525 if (ok) ok = Rec.WriteUINT32(NumRampItems);
09526
09527 for (UINT32 i = 0 ; i < NumRampItems; i++)
09528 {
09529 if (ok) ok = Rec.WriteDOUBLE(pPositions[i]);
09530 if (ok) ok = Rec.WriteReference(pRampColRefs[i]);
09531 }
09532
09533 if (ok) ok = pFilter->Write(&Rec);
09534 }
09535 }
09536
09537 if (pPositions)
09538 delete [] pPositions;
09539
09540 if (pRampColRefs)
09541 delete [] pRampColRefs;
09542
09543 if (!ok)
09544 pFilter->GotError(_R(IDE_FILE_WRITE_ERROR));
09545
09546 return ok;
09547 #else
09548 return FALSE;
09549 #endif
09550 }
09551
09552
09553
09554
09555 BOOL AttrConicalColourFill::WritePreChildrenNative(BaseCamelotFilter* pFilter)
09556 {
09557 #ifdef DO_EXPORT
09558 return WritePreChildrenWeb(pFilter);
09559 #else
09560 return FALSE;
09561 #endif
09562 }
09563
09564
09565
09566
09567
09568
09569
09570
09571
09572
09573
09574
09575
09576
09577
09578
09579 BOOL AttrConicalColourFill::WriteColourDefinitions (BaseCamelotFilter* pFilter)
09580 {
09581
09582 INT32 StartColRef = pFilter->WriteRecord(&Value.Colour);
09583 INT32 EndColRef = pFilter->WriteRecord(&Value.EndColour);
09584
09585 BOOL ok = ((StartColRef != 0) && (EndColRef != 0));
09586
09587 if (ok)
09588 {
09589 ColourRamp * pRamp = GetColourRamp();
09590 if (pRamp)
09591 if (pRamp->GetCount() > 0)
09592 {
09593 ok = pRamp->WriteColourDefinitions (pFilter);
09594 }
09595 }
09596
09597 return (ok);
09598 }
09599
09601
09602
09603
09605
09606
09607
09608
09609
09610
09611
09612
09613
09614
09615
09616 void AttrConicalTranspFill::Render(RenderRegion* pRender)
09617 {
09618 pRender->SetTranspFillGeometry(&Value, FALSE);
09619 }
09620
09621
09622
09623
09624
09625
09626
09627
09628
09629
09630
09631
09632
09633
09634
09635
09636 Node* AttrConicalTranspFill::SimpleCopy()
09637 {
09638 AttrConicalTranspFill* NodeCopy = new AttrConicalTranspFill();
09639 if (NodeCopy == NULL)
09640 return NULL;
09641
09642 CopyNodeContents(NodeCopy);
09643
09644 return NodeCopy;
09645 }
09646
09647
09648
09649
09650
09651
09652
09653
09654
09655
09656
09657
09658 UINT32 AttrConicalTranspFill::GetAttrNameID(void)
09659 {
09660 return (_R(IDS_CONICALTRANSPFILL));
09661 }
09662
09663
09664
09665
09666
09667
09668
09669
09670
09671
09672
09673
09674 void AttrConicalTranspFill::GetDebugDetails(StringBase* Str)
09675 {
09676 #ifdef _DEBUG
09677 NodeAttribute::GetDebugDetails( Str );
09678
09679 String_256 TempStr;
09680
09681 TempStr._MakeMsg( TEXT("\r\nConical Graduated Fill:\r\n"));
09682 (*Str) += TempStr;
09683
09684 TempStr._MakeMsg(TEXT("\r\nStart"));
09685 (*Str) += TempStr;
09686
09687 TempStr._MakeMsg(TEXT("\r\nEnd"));
09688 (*Str) += TempStr;
09689
09690 TempStr._MakeMsg(TEXT("\r\nStart point =(#1%ld, #2%ld)"),
09691 (*GetStartPoint()).x, (*GetStartPoint()).y);
09692 (*Str) += TempStr;
09693
09694 TempStr._MakeMsg(TEXT("\r\nEnd point =(#1%ld, #2%ld), "),
09695 (*GetEndPoint()).x, (*GetEndPoint()).y);
09696 (*Str) += TempStr;
09697 #endif
09698 }
09699
09700
09701
09702
09703
09704
09705
09706
09707
09708
09709
09710
09711
09712 UINT32 AttrConicalTranspFill::GetNodeSize() const
09713 {
09714 return sizeof(AttrConicalTranspFill);
09715 }
09716
09717
09718
09719
09720
09721
09722
09723
09724
09725
09726
09727
09728
09729
09730
09731
09732
09733 BOOL AttrConicalTranspFill::WritePreChildrenWeb(BaseCamelotFilter* pFilter)
09734 {
09735 #ifdef DO_EXPORT
09736 ERROR2IF(pFilter == NULL,FALSE,"NULL filter param");
09737 ERROR3IF(Value.Transp > 255,"Start transparency level is too high to be stored as a byte");
09738 ERROR3IF(Value.EndTransp > 255,"End transparency level is too high to be stored as a byte");
09739 ERROR3IF(Value.TranspType > 255,"Transparency type is too high to be stored as a byte");
09740
09741 BOOL ok = TRUE;
09742
09743 CamelotFileRecord Rec(pFilter,TAG_CONICALTRANSPARENTFILL,TAG_CONICALTRANSPARENTFILL_SIZE);
09744
09745 if (ok) ok = Rec.Init();
09746 if (ok) ok = Rec.WriteCoord(Value.StartPoint);
09747 if (ok) ok = Rec.WriteCoord(Value.EndPoint);
09748 if (ok) ok = Rec.WriteBYTE(BYTE(Value.Transp));
09749 if (ok) ok = Rec.WriteBYTE(BYTE(Value.EndTransp));
09750 if (ok) ok = Rec.WriteBYTE(BYTE(Value.TranspType));
09751 if (ok) ok = Rec.WriteDOUBLE ((double) GetProfile ().GetBias ());
09752 if (ok) ok = Rec.WriteDOUBLE ((double) GetProfile ().GetGain ());
09753 if (ok) ok = pFilter->Write(&Rec);
09754
09755 if (!ok)
09756 pFilter->GotError(_R(IDE_FILE_WRITE_ERROR));
09757
09758 return ok;
09759 #else
09760 return FALSE;
09761 #endif
09762 }
09763
09764
09765
09766
09767 BOOL AttrConicalTranspFill::WritePreChildrenNative(BaseCamelotFilter* pFilter)
09768 {
09769 #ifdef DO_EXPORT
09770 return WritePreChildrenWeb(pFilter);
09771 #else
09772 return FALSE;
09773 #endif
09774 }
09775
09776
09777
09778
09779
09780
09781
09782
09783
09784
09785
09786
09787
09788
09789
09790
09791
09792 BOOL AttrConicalTranspFill::HasEquivalentDefaultValue(BOOL bAppearance)
09793 {
09794
09795 if (bAppearance)
09796 return (Value.TranspType==TT_NoTranspType || (Value.TranspType==TT_Mix && Value.Transp == 0 && Value.EndTransp==0));
09797 else
09798 return FALSE;
09799 }
09800
09801
09802
09803
09805
09806
09807
09809
09810
09811
09812
09813
09814
09815
09816
09817
09818
09819
09820
09821 FillControl AttrSquareFill::TestColourDrop(AttrColourDrop* ColDrop)
09822 {
09823 #if !defined(EXCLUDE_FROM_RALPH)
09824
09825 DocCoord DropPoint = ColDrop->GetDropPoint();
09826
09827
09828 FillControl ControlHit = CheckForControlHit(DropPoint);
09829
09830
09831 if (ControlHit != FILLCONTROL_NULL)
09832 return ControlHit;
09833
09834
09835
09836
09837
09838
09839
09840 NodeRenderableInk* pParentObject = ColDrop->GetObjectDroppedOn();
09841 if (pParentObject == NULL)
09842 return FILLCONTROL_NULL;
09843
09844
09845 if (GetStartPoint() == NULL || GetEndPoint() == NULL || GetEndPoint2() == NULL)
09846 return FILLCONTROL_NULL;
09847
09848
09849
09850
09851
09852 DocCoord StartPoint = *GetStartPoint();
09853 DocCoord EndPoint = *GetEndPoint();
09854 DocCoord EndPoint2 = *GetEndPoint2();
09855
09856 DocCoord P = EndPoint - StartPoint;
09857 DocCoord Q = EndPoint2 - StartPoint;
09858 DocCoord N = DropPoint - StartPoint;
09859
09860 double px = P.x;
09861 double py = P.y;
09862 double qx = Q.x;
09863 double qy = Q.y;
09864 double nx = N.x;
09865 double ny = N.y;
09866
09867 double den = (px * qy) - (py * qx);
09868
09869
09870 ControlHit = FILLCONTROL_ENDPOINT;
09871
09872
09873
09874
09875
09876 if (den != 0.0)
09877 {
09878
09879 double u = ((px * ny) - (py * nx)) / den;
09880
09881
09882 if (fabs(u) < 0.5)
09883 {
09884 double t = 1.0;
09885
09886 if (px != 0.0)
09887 t = (nx - (u * qx)) / px;
09888 else
09889 t = (ny - (u * qy)) / py;
09890
09891 if (fabs(t) < 0.5)
09892 ControlHit = FILLCONTROL_STARTPOINT;
09893 }
09894 }
09895
09896 return ControlHit;
09897
09898 #else
09899 return FILLCONTROL_NULL;
09900 #endif
09901 }
09902
09903
09904
09905
09906
09907
09908
09909
09910
09911
09912
09913
09914
09915
09916
09917 void AttrSquareFill::Transform( TransformBase& Trans )
09918 {
09919 if ( Trans.TransFills )
09920 {
09921 Trans.Transform( GetStartPoint(), 1);
09922 Trans.Transform( GetEndPoint(), 1);
09923 Trans.Transform( GetEndPoint2(), 1);
09924
09925 if (IsPerspective())
09926 Trans.Transform( GetEndPoint3(), 1);
09927 }
09928 }
09929
09930
09931
09932
09933
09934
09935
09936
09937
09938
09939
09940
09941
09942
09943
09944 BOOL AttrSquareFill::CanTransform()
09945 {
09946 return TRUE;
09947 }
09948
09949
09950
09951
09952
09953
09954
09955
09956
09957
09958
09959
09960
09961
09962
09963
09964
09965
09966
09967
09968 void AttrSquareFill::RenderFillMesh(RenderRegion* pRender,
09969 DocCoord* ControlPoints, BOOL* SelState,
09970 INT32 NumControlPoints)
09971 {
09972 #if !defined(EXCLUDE_FROM_RALPH)
09973 if (AllowRampRedraw == FALSE)
09974 {
09975 FillRamp *pRamp = GetFillRamp();
09976 if (pRamp)
09977 {
09978 pRamp->RenderSelectedBlob (ATTRVALUE(), pRender);
09979 }
09980
09981 return;
09982 }
09983
09984 DocCoord StartPoint = ControlPoints[FILLCONTROL_STARTPOINT];
09985 DocCoord EndPoint = ControlPoints[FILLCONTROL_ENDPOINT];
09986
09987 if (StartPoint == EndPoint)
09988 return;
09989
09990 if (SelState == NULL)
09991 {
09992
09993
09994 BOOL Selected[NUMCONTROLPOINTS];
09995 for (INT32 i=0; i< NumControlPoints; i++)
09996 {
09997 Selected[i] = FALSE;
09998 }
09999 SelState = Selected;
10000 }
10001
10002 DocCoord EndPoint2 = ControlPoints[FILLCONTROL_SECONDARYPOINT];
10003
10004
10005 pRender->SaveContext();
10006
10007
10008 INT32 BlobSize = (Camelot.GetBlobManager())->GetBlobSize();
10009
10010
10011 Path ArrowPath;
10012 ArrowPath.Initialise();
10013 DocCoord LineEnd;
10014 MakeMeshArrow(&ArrowPath, StartPoint, EndPoint, &LineEnd);
10015
10016
10017 Path ArrowPath2;
10018 ArrowPath2.Initialise();
10019 DocCoord LineEnd2;
10020 MakeMeshArrow(&ArrowPath2, StartPoint, EndPoint2, &LineEnd2);
10021
10022
10023 pRender->SetLineWidth(0);
10024 pRender->SetLineColour(COLOUR_UNSELECTEDBLOB);
10025 pRender->SetFillColour(COLOUR_UNSELECTEDBLOB);
10026
10027
10028 pRender->SetLineWidth(BlobSize/4);
10029 pRender->DrawLine(StartPoint, LineEnd);
10030
10031
10032 pRender->DrawLine(StartPoint, LineEnd2);
10033
10034
10035 pRender->SetLineWidth(0);
10036 pRender->SetLineColour(COLOUR_NONE);
10037 pRender->DrawPath(&ArrowPath);
10038
10039
10040 pRender->DrawPath(&ArrowPath2);
10041
10042 if (DraggedFill == this)
10043 {
10044 if (AllowBoundsRedraw)
10045 {
10046
10047
10048 pRender->SetLineColour(COLOUR_SELECTEDBLOB);
10049 pRender->SetFillColour(COLOUR_NONE);
10050
10051 Path ParaPath;
10052 ParaPath.Initialise();
10053 MakeMeshParallelagram(&ParaPath, StartPoint, EndPoint, EndPoint2);
10054
10055
10056 pRender->DrawPath(&ParaPath);
10057 }
10058 }
10059
10060
10061
10062 pRender->SetLineColour(COLOUR_NONE);
10063
10064
10065 if (SelState[FILLCONTROL_STARTPOINT])
10066 {
10067
10068 pRender->SetFillColour(COLOUR_SELECTEDBLOB);
10069 pRender->DrawBlob(StartPoint, BT_SELECTED);
10070 }
10071 else
10072 {
10073
10074 pRender->SetFillColour(COLOUR_UNSELECTEDBLOB);
10075 pRender->DrawBlob(StartPoint, BT_UNSELECTED);
10076 }
10077
10078
10079 if (SelState[FILLCONTROL_ENDPOINT])
10080 {
10081
10082 pRender->SetFillColour(COLOUR_SELECTEDBLOB);
10083 pRender->DrawBlob(EndPoint, BT_SELECTED);
10084 pRender->DrawBlob(EndPoint2,BT_SELECTED);
10085 }
10086 else
10087 {
10088
10089 pRender->SetFillColour(COLOUR_UNSELECTEDBLOB);
10090 pRender->DrawBlob(EndPoint, BT_UNSELECTED);
10091 pRender->DrawBlob(EndPoint2,BT_UNSELECTED);
10092 }
10093
10094
10095 FillRamp *pRamp = GetFillRamp();
10096 if (pRamp)
10097 pRamp->RenderRampBlobs(ATTRVALUE(), pRender, NULL);
10098
10099
10100 pRender->RestoreContext();
10101 #endif
10102 }
10103
10104
10105
10106
10107
10108
10109
10110
10111
10112
10113
10114
10115
10116
10117
10118
10119 void AttrSquareFill::OnControlDrag(DocCoord Pos, FillControl& DragControl, ClickModifiers ClickMods)
10120 {
10121 #if !defined(EXCLUDE_FROM_RALPH)
10122
10123 DocCoord StartPoint = *GetStartPoint();
10124 DocCoord EndPoint = *GetEndPoint();
10125 DocCoord EndPoint2 = *GetEndPoint2();
10126
10127 INT32 dx, dy;
10128
10129
10130 switch (DragControl)
10131 {
10132 case FILLCONTROL_STARTPOINT:
10133
10134
10135 dx = StartPoint.x - Pos.x;
10136 dy = StartPoint.y - Pos.y;
10137
10138 EndPoint.translate(-dx, -dy);
10139 EndPoint2.translate(-dx, -dy);
10140
10141 SetEndPoint(&EndPoint);
10142 SetEndPoint2(&EndPoint2);
10143 SetStartPoint(&Pos);
10144 break;
10145
10146 case FILLCONTROL_ENDPOINT:
10147
10148
10149
10150
10151 if (ClickMods.Constrain)
10152 DocView::ConstrainToAngle(StartPoint, &Pos);
10153
10154
10155
10156 if (ClickMods.Adjust)
10157 {
10158 double OldLen = StartPoint.Distance(EndPoint);
10159 double NewLen = StartPoint.Distance(Pos);
10160 double Ratio = 1.0;
10161
10162 if (OldLen == 0)
10163 Ratio = 0;
10164 else
10165 Ratio = NewLen/OldLen;
10166
10167
10168 DocCoord temp = MakeLineAtAngle(StartPoint, Pos, 90, INT32(StartPoint.Distance(EndPoint2) * Ratio));
10169 SetEndPoint2(&temp);
10170 }
10171
10172 SetEndPoint(&Pos);
10173 break;
10174
10175 case FILLCONTROL_SECONDARYPOINT:
10176
10177
10178
10179
10180 if (ClickMods.Constrain)
10181 DocView::ConstrainToAngle(StartPoint, &Pos);
10182
10183
10184
10185 if (ClickMods.Adjust)
10186 {
10187 double OldLen = StartPoint.Distance(EndPoint2);
10188 double NewLen = StartPoint.Distance(Pos);
10189 double Ratio = 1.0;
10190
10191 if (OldLen == 0)
10192 Ratio = 0;
10193 else
10194 Ratio = NewLen/OldLen;
10195
10196
10197 DocCoord temp = MakeLineAtAngle(StartPoint, Pos, -90, INT32(StartPoint.Distance(EndPoint) * Ratio));
10198 SetEndPoint(&temp);
10199 }
10200
10201 SetEndPoint2(&Pos);
10202 break;
10203
10204 default:
10205
10206 if (ISA_RAMPINDEX(DragControl))
10207 {
10208 AttrFillGeometry::OnControlDrag( Pos, DragControl, ClickMods);
10209 }
10210 break;
10211 }
10212 #endif
10213 }
10214
10215
10216
10217
10218
10219
10220
10221
10222
10223
10224
10225
10226
10227
10228
10229
10230 DocRect AttrSquareFill::GetBlobBoundingRect()
10231 {
10232 #if !defined(EXCLUDE_FROM_RALPH)
10233
10234
10235
10236 if ( (!GetApplication()->GetBlobManager()->GetCurrentInterest(TRUE).Fill || !IsVisible()) && DraggedFill != this )
10237 return DocRect(0,0, 0,0);
10238
10239
10240 DocCoord StartPoint = *GetStartPoint();
10241 DocCoord EndPoint = *GetEndPoint();
10242 DocCoord EndPoint2 = *GetEndPoint2();
10243
10244
10245 DocRect BoundingRect(StartPoint, StartPoint);
10246
10247 if (DraggedFill == this)
10248 {
10249
10250
10251 DocRect StartBlobRect;
10252 DocRect EndBlobRect;
10253 DocRect DragRect = GetParallelagramBounds(StartPoint, EndPoint, EndPoint2);
10254
10255
10256 (Camelot.GetBlobManager())->GetBlobRect(DragRect.lo, &StartBlobRect);
10257 (Camelot.GetBlobManager())->GetBlobRect(DragRect.hi, &EndBlobRect);
10258
10259
10260
10261
10262 BoundingRect.IncludePoint(StartBlobRect.lo);
10263 BoundingRect.IncludePoint(StartBlobRect.hi);
10264 BoundingRect.IncludePoint(EndBlobRect.lo);
10265 BoundingRect.IncludePoint(EndBlobRect.hi);
10266 }
10267 else
10268 {
10269
10270 DocRect StartBlobRect;
10271 DocRect EndBlobRect;
10272 DocRect End2BlobRect;
10273
10274
10275 (Camelot.GetBlobManager())->GetBlobRect(StartPoint, &StartBlobRect);
10276 (Camelot.GetBlobManager())->GetBlobRect(EndPoint, &EndBlobRect);
10277 (Camelot.GetBlobManager())->GetBlobRect(EndPoint2, &End2BlobRect);
10278
10279
10280
10281
10282 BoundingRect.IncludePoint(StartBlobRect.lo);
10283 BoundingRect.IncludePoint(StartBlobRect.hi);
10284 BoundingRect.IncludePoint(EndBlobRect.lo);
10285 BoundingRect.IncludePoint(EndBlobRect.hi);
10286 BoundingRect.IncludePoint(End2BlobRect.lo);
10287 BoundingRect.IncludePoint(End2BlobRect.hi);
10288 }
10289
10290 IncludeArrowHead(&BoundingRect, StartPoint, EndPoint);
10291 IncludeArrowHead(&BoundingRect, StartPoint, EndPoint2);
10292
10293
10294 return BoundingRect;
10295 #else
10296 return DocRect(0,0,0,0);
10297 #endif
10298 }
10299
10300
10301
10302
10303
10304
10305
10306
10307
10308
10309
10310
10311
10312 void AttrSquareFill::ValidateAttributeValue()
10313 {
10314 #if !defined(EXCLUDE_FROM_RALPH)
10315 if ((*GetStartPoint()) != DocCoord(0,0) && (*GetEndPoint()) != DocCoord(0,0))
10316 {
10317
10318 if (*GetEndPoint2() == DocCoord(0,0))
10319 {
10320 DocCoord temp = MakeLineAtAngle((*GetStartPoint()), (*GetEndPoint()), 90);
10321 SetEndPoint2(&temp);
10322 }
10323
10324 return;
10325 }
10326
10327
10328 DocRect AttrBounds = DocRect(0,0,0,0);
10329
10330 INT32 Width = DEFAULT_FILLWIDTH;
10331 INT32 Height = DEFAULT_FILLHEIGHT;
10332
10333
10334 if (FindParent() != NULL)
10335 {
10336
10337 SelRange* Selected = GetApplication()->FindSelection();
10338
10339 if (Selected == NULL || Selected->Count() <= 1)
10340 AttrBounds = ((NodeRenderableBounded*)FindParent())->GetBoundingRect(TRUE);
10341 else
10342 AttrBounds = Selected->GetBoundingRect();
10343
10344 Width = AttrBounds.Width();
10345 Height = AttrBounds.Height();
10346 }
10347
10348
10349 if ((*GetStartPoint()) == DocCoord(0,0))
10350 {
10351
10352 DocCoord temp = CentreOf(AttrBounds);
10353 SetStartPoint(&temp);
10354
10355
10356 temp = DocCoord((*GetStartPoint()).x + (Width/2), (*GetStartPoint()).y);
10357 SetEndPoint(&temp);
10358 temp = DocCoord((*GetStartPoint()).x, (*GetStartPoint()).y + (Height/2));
10359 SetEndPoint2(&temp);
10360 }
10361
10362
10363 if ((*GetEndPoint()) == DocCoord(0,0))
10364 {
10365 DocCoord temp = DocCoord((*GetStartPoint()).x + (Width/2), (*GetStartPoint()).y);
10366 SetEndPoint(&temp);
10367 temp = DocCoord((*GetStartPoint()).x, (*GetStartPoint()).y + (Height/2));
10368 SetEndPoint2(&temp);
10369 }
10370
10371 if ((*GetEndPoint2()) == DocCoord(0,0))
10372 {
10373 DocCoord temp = MakeLineAtAngle((*GetStartPoint()), (*GetEndPoint()), 90, Height/2);
10374 SetEndPoint2(&temp);
10375 }
10376 #endif
10377 }
10378
10379
10380
10382
10383
10384
10386
10387
10388
10389
10390
10391
10392
10393
10394
10395
10396
10397 void AttrSquareColourFill::Render(RenderRegion* pRender)
10398 {
10399 pRender->SetFillGeometry(&Value, FALSE);
10400 }
10401
10402
10403
10404
10405
10406
10407
10408
10409
10410
10411
10412
10413
10414
10415
10416
10417
10418
10419 Node* AttrSquareColourFill::SimpleCopy()
10420 {
10421 AttrSquareColourFill* NodeCopy = new AttrSquareColourFill();
10422 if (NodeCopy == NULL)
10423 return NULL;
10424
10425 CopyNodeContents(NodeCopy);
10426
10427 return NodeCopy;
10428 }
10429
10430
10431
10432
10433
10434
10435
10436
10437
10438
10439
10440
10441
10442
10443 void AttrSquareColourFill::RenderFillBlobs(RenderRegion* pRender)
10444 {
10445 #if !defined(EXCLUDE_FROM_RALPH)
10446 if (!IsVisible())
10447 return;
10448
10449
10450
10451 if (IsFillBeingEdited())
10452 return;
10453
10454
10455 if (CheckPreviousFillMesh())
10456 return;
10457
10458 DocCoord ControlPoints[5];
10459 ControlPoints[FILLCONTROL_STARTPOINT] = (*GetStartPoint());
10460 ControlPoints[FILLCONTROL_ENDPOINT] = (*GetEndPoint());
10461 ControlPoints[FILLCONTROL_SECONDARYPOINT] = (*GetEndPoint2());
10462
10463
10464 RenderFillMesh(pRender, ControlPoints, SelectionState, 5);
10465
10466
10467
10468
10469
10470 #endif
10471 }
10472
10473
10474
10475
10476
10477
10478
10479
10480
10481
10482
10483
10484
10485
10486 UINT32 AttrSquareColourFill::GetAttrNameID(void)
10487 {
10488 return (_R(IDS_SQUAREGRADFILL));
10489 }
10490
10491
10492
10493
10494
10495
10496
10497
10498
10499
10500
10501
10502
10503
10504 void AttrSquareColourFill::GetDebugDetails(StringBase* Str)
10505 {
10506 #ifdef _DEBUG
10507 NodeAttribute::GetDebugDetails( Str );
10508
10509 String_256 TempStr;
10510
10511 TempStr._MakeMsg( TEXT("\r\nDiamond Graduated Fill:\r\n"));
10512 (*Str) += TempStr;
10513
10514
10515
10516
10517
10518
10519
10520
10521
10522 TempStr._MakeMsg(TEXT("\r\nStart = (#1%ld, #2%ld)"),
10523 (*GetStartPoint()).x, (*GetStartPoint()).y);
10524 (*Str) += TempStr;
10525
10526 TempStr._MakeMsg(TEXT("\r\nEnd = (#1%ld, #2%ld) "),
10527 (*GetEndPoint()).x, (*GetEndPoint()).y);
10528 (*Str) += TempStr;
10529
10530 TempStr._MakeMsg(TEXT("\r\n3rd = (#1%ld, #2%ld) "),
10531 (*GetEndPoint2()).x, (*GetEndPoint2()).y);
10532 (*Str) += TempStr;
10533 #endif
10534 }
10535
10536
10537
10538
10539
10540
10541
10542
10543
10544
10545
10546
10547
10548
10549
10550 UINT32 AttrSquareColourFill::GetNodeSize() const
10551 {
10552 return sizeof(AttrSquareColourFill);
10553 }
10554
10555
10556
10557
10558
10559
10560
10561
10562
10563
10564
10565
10566
10567
10568
10569
10570 BOOL AttrSquareColourFill::WritePreChildrenWeb(BaseCamelotFilter* pFilter)
10571 {
10572 #ifdef DO_EXPORT
10573 ERROR2IF(pFilter == NULL,FALSE,"NULL filter param");
10574
10575
10576 INT32 StartColRef = pFilter->WriteRecord(&Value.Colour);
10577 INT32 EndColRef = pFilter->WriteRecord(&Value.EndColour);
10578
10579
10580 BOOL bMultistage = FALSE;
10581
10582 ColourRamp * pRamp = GetColourRamp();
10583 INT32 * pRampColRefs = NULL;
10584 double * pPositions = NULL;
10585 ColRampItem * pItem = NULL;
10586 UINT32 NumRampItems = 0;
10587
10588 if (pRamp)
10589 {
10590
10591 if (pRamp->GetCount() > 0)
10592 {
10593 bMultistage = TRUE;
10594 NumRampItems = pRamp->GetCount();
10595
10596 pRampColRefs = new INT32[NumRampItems];
10597 pPositions = new double[NumRampItems];
10598
10599 pItem = (ColRampItem *)pRamp->GetHead();
10600
10601 for (UINT32 i = 0 ; i < NumRampItems; i++)
10602 {
10603 if (pItem)
10604 {
10605 pPositions[i] = pItem->GetPosition();
10606 DocColour tempcolour = pItem->GetColour();
10607 pRampColRefs[i] = pFilter->WriteRecord(&tempcolour);
10608 }
10609
10610 pItem = (ColRampItem *)pRamp->GetNext(pItem);
10611 }
10612 }
10613 }
10614
10615
10616 BOOL ok = ((StartColRef != 0) && (EndColRef != 0));
10617
10618 if (ok)
10619 {
10620 if (!bMultistage)
10621 {
10622 CamelotFileRecord Rec(pFilter,TAG_SQUAREFILL,TAG_SQUAREFILL_SIZE);
10623
10624 if (ok) ok = Rec.Init();
10625 if (ok) ok = Rec.WriteCoord(Value.StartPoint);
10626 if (ok) ok = Rec.WriteCoord(Value.EndPoint);
10627 if (ok) ok = Rec.WriteCoord(Value.EndPoint2);
10628 if (ok) ok = Rec.WriteReference(StartColRef);
10629 if (ok) ok = Rec.WriteReference(EndColRef);
10630 if (ok) ok = Rec.WriteDOUBLE ((double) GetProfile ().GetBias ());
10631 if (ok) ok = Rec.WriteDOUBLE ((double) GetProfile ().GetGain ());
10632 if (ok) ok = pFilter->Write(&Rec);
10633 }
10634 else
10635 {
10636 CamelotFileRecord Rec(pFilter,TAG_SQUAREFILLMULTISTAGE,
10637 TAG_SQUAREFILLMULTISTAGE_SIZE);
10638
10639 if (ok) ok = Rec.Init();
10640 if (ok) ok = Rec.WriteCoord(Value.StartPoint);
10641 if (ok) ok = Rec.WriteCoord(Value.EndPoint);
10642 if (ok) ok = Rec.WriteCoord(Value.EndPoint2);
10643 if (ok) ok = Rec.WriteReference(StartColRef);
10644 if (ok) ok = Rec.WriteReference(EndColRef);
10645
10646
10647 if (ok) ok = Rec.WriteUINT32(NumRampItems);
10648
10649 for (UINT32 i = 0 ; i < NumRampItems; i++)
10650 {
10651 if (ok) ok = Rec.WriteDOUBLE(pPositions[i]);
10652 if (ok) ok = Rec.WriteReference(pRampColRefs[i]);
10653 }
10654
10655 if (ok) ok = pFilter->Write(&Rec);
10656 }
10657 }
10658
10659 if (pPositions)
10660 delete [] pPositions;
10661
10662 if (pRampColRefs)
10663 delete [] pRampColRefs;
10664
10665 if (!ok)
10666 pFilter->GotError(_R(IDE_FILE_WRITE_ERROR));
10667
10668 return ok;
10669 #else
10670 return FALSE;
10671 #endif
10672 }
10673
10674
10675
10676
10677
10678
10679
10680
10681
10682
10683
10684
10685
10686
10687
10688
10689 BOOL AttrSquareColourFill::WritePreChildrenNative(BaseCamelotFilter* pFilter)
10690 {
10691 #ifdef DO_EXPORT
10692 return WritePreChildrenWeb(pFilter);
10693 #else
10694 return FALSE;
10695 #endif
10696 }
10697
10698
10699
10700
10701
10702
10703
10704
10705
10706
10707
10708
10709
10710
10711
10712
10713 BOOL AttrSquareColourFill::WriteColourDefinitions (BaseCamelotFilter* pFilter)
10714 {
10715
10716 INT32 StartColRef = pFilter->WriteRecord(&Value.Colour);
10717 INT32 EndColRef = pFilter->WriteRecord(&Value.EndColour);
10718
10719 BOOL ok = ((StartColRef != 0) && (EndColRef != 0));
10720
10721 if (ok)
10722 {
10723 ColourRamp * pRamp = GetColourRamp();
10724 if (pRamp)
10725 if (pRamp->GetCount() > 0)
10726 {
10727 ok = pRamp->WriteColourDefinitions (pFilter);
10728 }
10729 }
10730
10731 return (ok);
10732 }
10733
10735
10736
10737
10739
10740
10741
10742
10743
10744
10745
10746
10747
10748
10749
10750 void AttrSquareTranspFill::Render(RenderRegion* pRender)
10751 {
10752 pRender->SetTranspFillGeometry(&Value, FALSE);
10753 }
10754
10755
10756
10757
10758
10759
10760
10761
10762
10763
10764
10765
10766
10767
10768
10769
10770 BOOL AttrSquareTranspFill::NeedsTransparency() const
10771 {
10772 AttrSquareTranspFill* pNonConst = (AttrSquareTranspFill*) this;
10773 return ( pNonConst->GetTranspType() != TT_Mix ||
10774 *(pNonConst->GetStartTransp()) != 0 ||
10775 *(pNonConst->GetEndTransp()) != 0 );
10776 }
10777
10778
10779
10780
10781
10782
10783
10784
10785
10786
10787
10788
10789
10790
10791
10792
10793
10794
10795 Node* AttrSquareTranspFill::SimpleCopy()
10796 {
10797 AttrSquareTranspFill* NodeCopy = new AttrSquareTranspFill();
10798 if (NodeCopy == NULL)
10799 return NULL;
10800
10801 CopyNodeContents(NodeCopy);
10802
10803 return NodeCopy;
10804 }
10805
10806
10807
10808
10809
10810
10811
10812
10813
10814
10815
10816
10817
10818
10819 void AttrSquareTranspFill::RenderFillBlobs(RenderRegion* pRender)
10820 {
10821 #if !defined(EXCLUDE_FROM_RALPH)
10822 if (!IsVisible())
10823 return;
10824
10825
10826
10827 if (IsFillBeingEdited())
10828 return;
10829
10830
10831 if (CheckPreviousFillMesh())
10832 return;
10833
10834 DocCoord ControlPoints[5];
10835 ControlPoints[FILLCONTROL_STARTPOINT] = (*GetStartPoint());
10836 ControlPoints[FILLCONTROL_ENDPOINT] = (*GetEndPoint());
10837 ControlPoints[FILLCONTROL_SECONDARYPOINT] = (*GetEndPoint2());
10838
10839
10840 RenderFillMesh(pRender, ControlPoints, SelectionState, 5);
10841
10842
10843
10844
10845
10846 #endif
10847 }
10848
10849
10850
10851
10852
10853
10854
10855
10856
10857
10858
10859
10860
10861
10862 UINT32 AttrSquareTranspFill::GetAttrNameID(void)
10863 {
10864 return (_R(IDS_SQUARETRANSPFILL));
10865 }
10866
10867
10868
10869
10870
10871
10872
10873
10874
10875
10876
10877
10878
10879
10880 void AttrSquareTranspFill::GetDebugDetails(StringBase* Str)
10881 {
10882 #ifdef _DEBUG
10883 NodeAttribute::GetDebugDetails( Str );
10884
10885 String_256 TempStr;
10886
10887 TempStr._MakeMsg( TEXT("\r\nSquare Graduated Fill:\r\n"));
10888 (*Str) += TempStr;
10889
10890 TempStr._MakeMsg(TEXT("\r\nStart"));
10891 (*Str) += TempStr;
10892
10893 TempStr._MakeMsg(TEXT("\r\nEnd"));
10894 (*Str) += TempStr;
10895
10896 TempStr._MakeMsg(TEXT("\r\nStart = (#1%ld, #2%ld)"),
10897 (*GetStartPoint()).x, (*GetStartPoint()).y);
10898 (*Str) += TempStr;
10899
10900 TempStr._MakeMsg(TEXT("\r\nEnd = (#1%ld, #2%ld) "),
10901 (*GetEndPoint()).x, (*GetEndPoint()).y);
10902 (*Str) += TempStr;
10903
10904 TempStr._MakeMsg(TEXT("\r\n3rd = (#1%ld, #2%ld) "),
10905 (*GetEndPoint2()).x, (*GetEndPoint2()).y);
10906 (*Str) += TempStr;
10907 #endif
10908 }
10909
10910
10911
10912
10913
10914
10915
10916
10917
10918
10919
10920
10921
10922
10923
10924 UINT32 AttrSquareTranspFill::GetNodeSize() const
10925 {
10926 return sizeof(AttrSquareTranspFill);
10927 }
10928
10929
10930
10931
10932
10933
10934
10935
10936
10937
10938
10939
10940
10941
10942
10943
10944 BOOL AttrSquareTranspFill::WritePreChildrenWeb(BaseCamelotFilter* pFilter)
10945 {
10946 #ifdef DO_EXPORT
10947 ERROR2IF(pFilter == NULL,FALSE,"NULL filter param");
10948 ERROR3IF(Value.Transp > 255,"Start transparency level is too high to be stored as a byte");
10949 ERROR3IF(Value.EndTransp > 255,"End transparency level is too high to be stored as a byte");
10950 ERROR3IF(Value.TranspType > 255,"Transparency type is too high to be stored as a byte");
10951
10952 BOOL ok = TRUE;
10953
10954 CamelotFileRecord Rec(pFilter,TAG_SQUARETRANSPARENTFILL,TAG_SQUARETRANSPARENTFILL_SIZE);
10955
10956 if (ok) ok = Rec.Init();
10957 if (ok) ok = Rec.WriteCoord(Value.StartPoint);
10958 if (ok) ok = Rec.WriteCoord(Value.EndPoint);
10959 if (ok) ok = Rec.WriteCoord(Value.EndPoint2);
10960 if (ok) ok = Rec.WriteBYTE(BYTE(Value.Transp));
10961 if (ok) ok = Rec.WriteBYTE(BYTE(Value.EndTransp));
10962 if (ok) ok = Rec.WriteBYTE(BYTE(Value.TranspType));
10963 if (ok) ok = Rec.WriteDOUBLE ((double) GetProfile ().GetBias ());
10964 if (ok) ok = Rec.WriteDOUBLE ((double) GetProfile ().GetGain ());
10965 if (ok) ok = pFilter->Write(&Rec);
10966
10967 if (!ok)
10968 pFilter->GotError(_R(IDE_FILE_WRITE_ERROR));
10969
10970 return ok;
10971 #else
10972 return FALSE;
10973 #endif
10974 }
10975
10976
10977
10978
10979
10980
10981
10982
10983
10984
10985
10986
10987
10988
10989
10990
10991 BOOL AttrSquareTranspFill::WritePreChildrenNative(BaseCamelotFilter* pFilter)
10992 {
10993 #ifdef DO_EXPORT
10994 return WritePreChildrenWeb(pFilter);
10995 #else
10996 return FALSE;
10997 #endif
10998 }
10999
11000
11001
11002
11003
11004
11005
11006
11007
11008
11009
11010
11011
11012
11013
11014
11015
11016
11017
11018 BOOL AttrSquareTranspFill::HasEquivalentDefaultValue(BOOL bAppearance)
11019 {
11020
11021 if (bAppearance)
11022 return (Value.TranspType==TT_NoTranspType || (Value.TranspType==TT_Mix && Value.Transp == 0 && Value.EndTransp==0));
11023 else
11024 return FALSE;
11025 }
11026
11027
11028
11029
11031
11032
11033
11035
11036
11037
11038
11039
11040
11041
11042
11043
11044
11045
11046
11047
11048
11049 void AttrThreeColFill::TransformSelectedControlPoints( TransformBase& Trans, BOOL* isARampBlob )
11050 {
11051 #if !defined(EXCLUDE_FROM_RALPH)
11052 if ( Trans.TransFills )
11053 {
11054 ClickModifiers ClickMods;
11055 ClickMods.Adjust = FALSE;
11056
11057
11058 if (IsSelected(FILLCONTROL_STARTPOINT))
11059 {
11060 DocCoord Pos = *GetStartPoint();
11061 Trans.Transform( &Pos, 1);
11062
11063 FillControl Start = FILLCONTROL_STARTPOINT;
11064
11065 OnControlDrag(Pos, Start, ClickMods);
11066 }
11067 else
11068 {
11069
11070 if (IsSelected(FILLCONTROL_ENDPOINT))
11071 {
11072 DocCoord Pos = *GetEndPoint();
11073 Trans.Transform( &Pos, 1);
11074
11075 FillControl End = FILLCONTROL_ENDPOINT;
11076
11077 OnControlDrag(Pos, End, ClickMods);
11078 }
11079
11080 if (IsSelected(FILLCONTROL_ENDPOINT2))
11081 {
11082 DocCoord Pos = *GetEndPoint2();
11083 Trans.Transform( &Pos, 1);
11084
11085 FillControl End2 = FILLCONTROL_ENDPOINT2;
11086
11087 OnControlDrag(Pos, End2, ClickMods);
11088 }
11089 }
11090 }
11091 #endif
11092 }
11093
11094
11095
11096
11097
11098
11099
11100
11101
11102
11103
11104
11105
11106 FillControl AttrThreeColFill::TestColourDrop(AttrColourDrop* ColDrop)
11107 {
11108 #if !defined(EXCLUDE_FROM_RALPH)
11109
11110 DocCoord DropPoint = ColDrop->GetDropPoint();
11111
11112
11113 FillControl ControlHit = CheckForControlHit(DropPoint);
11114
11115
11116 if (ControlHit != FILLCONTROL_NULL)
11117 return ControlHit;
11118
11119
11120
11121
11122
11123
11124
11125 NodeRenderableInk* pParentObject = ColDrop->GetObjectDroppedOn();
11126 if (pParentObject == NULL)
11127 return FILLCONTROL_NULL;
11128
11129
11130 if (GetStartPoint() == NULL || GetEndPoint() == NULL || GetEndPoint2() == NULL)
11131 return FILLCONTROL_NULL;
11132
11133 DocCoord StartPoint = *GetStartPoint();
11134 DocCoord EndPoint = *GetEndPoint();
11135 DocCoord EndPoint2 = *GetEndPoint2();
11136
11137 double StartDist = DropPoint.Distance(StartPoint);
11138 double EndDist = DropPoint.Distance(EndPoint);
11139 double End2Dist = DropPoint.Distance(EndPoint2);
11140
11141
11142
11143 if (StartDist < End2Dist)
11144 {
11145 if (StartDist < EndDist)
11146 ControlHit = FILLCONTROL_STARTPOINT;
11147 else
11148 ControlHit = FILLCONTROL_ENDPOINT;
11149 }
11150 else
11151 {
11152 if (EndDist < End2Dist)
11153 ControlHit = FILLCONTROL_ENDPOINT;
11154 else
11155 ControlHit = FILLCONTROL_ENDPOINT2;
11156 }
11157
11158 return ControlHit;
11159 #else
11160 return FILLCONTROL_NULL;
11161 #endif
11162 }
11163
11164
11165
11166
11167
11168
11169
11170
11171
11172
11173
11174
11175
11176
11177
11178 void AttrThreeColFill::Transform( TransformBase& Trans )
11179 {
11180 if ( Trans.TransFills )
11181 {
11182 Trans.Transform( GetStartPoint(), 1);
11183 Trans.Transform( GetEndPoint(), 1);
11184 Trans.Transform( GetEndPoint2(), 1);
11185
11186 if (IsPerspective())
11187 Trans.Transform( GetEndPoint3(), 1);
11188 }
11189 }
11190
11191
11192
11193
11194
11195
11196
11197
11198
11199
11200
11201
11202
11203
11204
11205 BOOL AttrThreeColFill::CanTransform()
11206 {
11207 return TRUE;
11208 }
11209
11210
11211
11212
11213
11214
11215
11216
11217
11218
11219
11220
11221
11222
11223
11224
11225
11226
11227
11228
11229 void AttrThreeColFill::RenderFillMesh(RenderRegion* pRender,
11230 DocCoord* ControlPoints, BOOL* SelState,
11231 INT32 NumControlPoints)
11232 {
11233 #if !defined(EXCLUDE_FROM_RALPH)
11234 DocCoord StartPoint = ControlPoints[FILLCONTROL_STARTPOINT];
11235 DocCoord EndPoint = ControlPoints[FILLCONTROL_ENDPOINT];
11236 DocCoord EndPoint2 = ControlPoints[FILLCONTROL_ENDPOINT2];
11237
11238 if (StartPoint == EndPoint)
11239 return;
11240
11241 if (SelState == NULL)
11242 {
11243
11244
11245 BOOL Selected[NUMCONTROLPOINTS];
11246 for (INT32 i=0; i< NumControlPoints; i++)
11247 {
11248 Selected[i] = FALSE;
11249 }
11250 SelState = Selected;
11251 }
11252
11253
11254 pRender->SaveContext();
11255
11256
11257 INT32 BlobSize = (Camelot.GetBlobManager())->GetBlobSize();
11258
11259
11260 Path ArrowPath;
11261 ArrowPath.Initialise();
11262 DocCoord LineEnd;
11263 MakeMeshArrow(&ArrowPath, StartPoint, EndPoint, &LineEnd);
11264
11265
11266 Path ArrowPath2;
11267 ArrowPath2.Initialise();
11268 DocCoord LineEnd2;
11269 MakeMeshArrow(&ArrowPath2, StartPoint, EndPoint2, &LineEnd2);
11270
11271
11272 pRender->SetLineWidth(0);
11273 pRender->SetLineColour(COLOUR_UNSELECTEDBLOB);
11274 pRender->SetFillColour(COLOUR_UNSELECTEDBLOB);
11275
11276
11277 pRender->SetLineWidth(BlobSize/4);
11278 pRender->DrawLine(StartPoint, LineEnd);
11279
11280
11281 pRender->DrawLine(StartPoint, LineEnd2);
11282
11283
11284 pRender->SetLineWidth(0);
11285 pRender->SetLineColour(COLOUR_NONE);
11286 pRender->DrawPath(&ArrowPath);
11287
11288
11289 pRender->DrawPath(&ArrowPath2);
11290
11291 if (DraggedFill == this)
11292 {
11293
11294 pRender->SetLineColour(COLOUR_SELECTEDBLOB);
11295 pRender->SetFillColour(COLOUR_NONE);
11296 pRender->DrawLine(EndPoint, EndPoint2);
11297 }
11298
11299
11300
11301 pRender->SetLineColour(COLOUR_NONE);
11302
11303
11304 if (SelState[FILLCONTROL_STARTPOINT])
11305 {
11306
11307 pRender->SetFillColour(COLOUR_SELECTEDBLOB);
11308 pRender->DrawBlob(StartPoint, BT_SELECTED);
11309 }
11310 else
11311 {
11312
11313 pRender->SetFillColour(COLOUR_UNSELECTEDBLOB);
11314 pRender->DrawBlob(StartPoint, BT_UNSELECTED);
11315 }
11316
11317
11318 if (SelState[FILLCONTROL_ENDPOINT])
11319 {
11320
11321 pRender->SetFillColour(COLOUR_SELECTEDBLOB);
11322 pRender->DrawBlob(EndPoint, BT_SELECTED);
11323 }
11324 else
11325 {
11326
11327 pRender->SetFillColour(COLOUR_UNSELECTEDBLOB);
11328 pRender->DrawBlob(EndPoint, BT_UNSELECTED);
11329 }
11330
11331
11332 if (SelState[FILLCONTROL_ENDPOINT2])
11333 {
11334
11335 pRender->SetFillColour(COLOUR_SELECTEDBLOB);
11336 pRender->DrawBlob(EndPoint2,BT_SELECTED);
11337 }
11338 else
11339 {
11340
11341 pRender->SetFillColour(COLOUR_UNSELECTEDBLOB);
11342 pRender->DrawBlob(EndPoint2,BT_UNSELECTED);
11343 }
11344
11345
11346 pRender->RestoreContext();
11347 #endif
11348 }
11349
11350
11351
11352
11353
11354
11355
11356
11357
11358
11359
11360
11361
11362
11363
11364
11365 void AttrThreeColFill::OnControlDrag(DocCoord Pos, FillControl& DragControl, ClickModifiers ClickMods)
11366 {
11367 #if !defined(EXCLUDE_FROM_RALPH)
11368
11369 DocCoord StartPoint = *GetStartPoint();
11370 DocCoord EndPoint = *GetEndPoint();
11371 DocCoord EndPoint2 = *GetEndPoint2();
11372
11373 INT32 dx, dy;
11374
11375
11376 switch (DragControl)
11377 {
11378 case FILLCONTROL_STARTPOINT:
11379
11380
11381 dx = StartPoint.x - Pos.x;
11382 dy = StartPoint.y - Pos.y;
11383
11384 EndPoint.translate(-dx, -dy);
11385 EndPoint2.translate(-dx, -dy);
11386
11387 SetEndPoint(&EndPoint);
11388 SetEndPoint2(&EndPoint2);
11389 SetStartPoint(&Pos);
11390 break;
11391
11392 case FILLCONTROL_ENDPOINT:
11393
11394
11395
11396
11397 if (ClickMods.Constrain)
11398 DocView::ConstrainToAngle(StartPoint, &Pos);
11399
11400
11401 if (ClickMods.Adjust)
11402 {
11403 double OldLen = StartPoint.Distance(EndPoint);
11404 double NewLen = StartPoint.Distance(Pos);
11405 double Ratio = 1.0;
11406
11407 if (OldLen == 0)
11408 Ratio = 0;
11409 else
11410 Ratio = NewLen/OldLen;
11411
11412
11413 DocCoord temp = MakeLineAtAngle(StartPoint, Pos, 60, INT32(StartPoint.Distance(EndPoint2) * Ratio));
11414 SetEndPoint2(&temp);
11415 }
11416
11417 SetEndPoint(&Pos);
11418 break;
11419
11420 case FILLCONTROL_ENDPOINT2:
11421
11422
11423
11424
11425 if (ClickMods.Constrain)
11426 DocView::ConstrainToAngle(StartPoint, &Pos);
11427
11428
11429 if (ClickMods.Adjust)
11430 {
11431 double OldLen = StartPoint.Distance(EndPoint2);
11432 double NewLen = StartPoint.Distance(Pos);
11433 double Ratio = 1.0;
11434
11435 if (OldLen == 0)
11436 Ratio = 0;
11437 else
11438 Ratio = NewLen/OldLen;
11439
11440
11441 DocCoord temp = MakeLineAtAngle(StartPoint, Pos, -60, INT32(StartPoint.Distance(EndPoint) * Ratio));
11442 SetEndPoint(&temp);
11443 }
11444
11445 SetEndPoint2(&Pos);
11446 break;
11447 }
11448 #endif
11449 }
11450
11451
11452
11453
11454
11455
11456
11457
11458
11459
11460
11461
11462
11463
11464
11465
11466 DocRect AttrThreeColFill::GetBlobBoundingRect()
11467 {
11468 #if !defined(EXCLUDE_FROM_RALPH)
11469
11470
11471
11472 if ( (!GetApplication()->GetBlobManager()->GetCurrentInterest(TRUE).Fill || !IsVisible()) && DraggedFill != this )
11473 return DocRect(0,0, 0,0);
11474
11475
11476 DocCoord StartPoint = *GetStartPoint();
11477 DocCoord EndPoint = *GetEndPoint();
11478 DocCoord EndPoint2 = *GetEndPoint2();
11479
11480
11481 DocRect BoundingRect(StartPoint, StartPoint);
11482
11483
11484 DocRect BlobRect;
11485
11486
11487
11488
11489
11490 (Camelot.GetBlobManager())->GetBlobRect(StartPoint, &BlobRect);
11491 BoundingRect.IncludePoint(BlobRect.lo);
11492 BoundingRect.IncludePoint(BlobRect.hi);
11493
11494 (Camelot.GetBlobManager())->GetBlobRect(EndPoint, &BlobRect);
11495 BoundingRect.IncludePoint(BlobRect.lo);
11496 BoundingRect.IncludePoint(BlobRect.hi);
11497
11498 (Camelot.GetBlobManager())->GetBlobRect(EndPoint2, &BlobRect);
11499 BoundingRect.IncludePoint(BlobRect.lo);
11500 BoundingRect.IncludePoint(BlobRect.hi);
11501
11502 IncludeArrowHead(&BoundingRect, StartPoint, EndPoint);
11503 IncludeArrowHead(&BoundingRect, StartPoint, EndPoint2);
11504
11505
11506 return BoundingRect;
11507 #else
11508 return DocRect(0,0,0,0);
11509 #endif
11510 }
11511
11512
11513
11514
11515
11516
11517
11518
11519
11520
11521
11522
11523
11524
11525
11526 void AttrThreeColFill::RenderControl(FillControl Control, BOOL RenderOn)
11527 {
11528 #if !defined(EXCLUDE_FROM_RALPH)
11529 DocRect ControlRect;
11530
11531
11532
11533 NodeRenderable* pParent = (NodeRenderable*)FindParent();
11534
11535 if (pParent == NULL)
11536 return;
11537
11538 if (IsBlobSame(Control))
11539 return;
11540
11541 Spread* pSpread = this->FindParentSpread();
11542
11543 switch (Control)
11544 {
11545 case FILLCONTROL_STARTPOINT:
11546 if (GetStartPoint() != NULL)
11547 {
11548
11549 (Camelot.GetBlobManager())->GetBlobRect(*GetStartPoint(), &ControlRect);
11550 RenderFillControl(RenderOn, &ControlRect, pSpread, pParent);
11551 }
11552 break;
11553
11554 case FILLCONTROL_ENDPOINT:
11555 if (GetEndPoint() != NULL)
11556 {
11557
11558 (Camelot.GetBlobManager())->GetBlobRect(*GetEndPoint(), &ControlRect);
11559 RenderFillControl(RenderOn, &ControlRect, pSpread, pParent);
11560 }
11561 break;
11562
11563 case FILLCONTROL_ENDPOINT2:
11564 if (GetEndPoint2() != NULL)
11565 {
11566 (Camelot.GetBlobManager())->GetBlobRect(*GetEndPoint2(), &ControlRect);
11567 RenderFillControl(RenderOn, &ControlRect, pSpread, pParent);
11568 }
11569 break;
11570 }
11571 #endif
11572 }
11573
11574
11575
11576
11577
11578
11579
11580
11581
11582
11583
11584
11585 void AttrThreeColFill::CycleSelection(BOOL Reverse)
11586 {
11587 if (GetSelectionCount() == 1)
11588 {
11589 if (SelectionState[FILLCONTROL_STARTPOINT])
11590 {
11591 DeselectAll();
11592 if (Reverse)
11593 SelectBlob(FILLCONTROL_ENDPOINT2);
11594 else
11595 SelectBlob(FILLCONTROL_ENDPOINT);
11596 }
11597 else if (SelectionState[FILLCONTROL_ENDPOINT])
11598 {
11599 DeselectAll();
11600 if (Reverse)
11601 SelectBlob(FILLCONTROL_STARTPOINT);
11602 else
11603 SelectBlob(FILLCONTROL_ENDPOINT2);
11604 }
11605 else if (SelectionState[FILLCONTROL_ENDPOINT2])
11606 {
11607 DeselectAll();
11608 if (Reverse)
11609 SelectBlob(FILLCONTROL_ENDPOINT);
11610 else
11611 SelectBlob(FILLCONTROL_STARTPOINT);
11612 }
11613 }
11614 }
11615
11616
11617
11618
11619
11620
11621
11622
11623
11624
11625
11626
11627
11628
11629
11630
11631 FillControl AttrThreeColFill::CheckForControlHit(DocCoord &ClickPos)
11632 {
11633
11634 FillControl HitControl = FILLCONTROL_NULL;
11635 #if !defined(EXCLUDE_FROM_RALPH)
11636 DocRect BlobRect;
11637
11638 if (!GetApplication()->GetBlobManager()->GetCurrentInterest().Fill || !IsVisible())
11639 return FILLCONTROL_NULL;
11640
11641
11642
11643 (Camelot.GetBlobManager())->GetBlobRect(*GetStartPoint(), &BlobRect);
11644
11645 if ( BlobRect.ContainsCoord(ClickPos) )
11646 HitControl = FILLCONTROL_STARTPOINT;
11647
11648
11649 (Camelot.GetBlobManager())->GetBlobRect(*GetEndPoint(), &BlobRect);
11650
11651 if ( BlobRect.ContainsCoord(ClickPos) )
11652 HitControl = FILLCONTROL_ENDPOINT;
11653
11654
11655 (Camelot.GetBlobManager())->GetBlobRect(*GetEndPoint2(), &BlobRect);
11656
11657 if ( BlobRect.ContainsCoord(ClickPos) )
11658 HitControl = FILLCONTROL_ENDPOINT2;
11659 #endif
11660 return HitControl;
11661 }
11662
11663
11664
11665
11666
11667
11668
11669
11670
11671
11672
11673
11674
11675
11676 void AttrThreeColFill::ValidateAttributeValue()
11677 {
11678 #if !defined(EXCLUDE_FROM_RALPH)
11679 if ((*GetStartPoint()) != DocCoord(0,0) && (*GetEndPoint()) != DocCoord(0,0))
11680 {
11681
11682 if (*GetEndPoint2() == DocCoord(0,0))
11683 {
11684 DocCoord temp = MakeLineAtAngle((*GetStartPoint()), (*GetEndPoint()), 90);
11685 SetEndPoint2(&temp);
11686 }
11687
11688 return;
11689 }
11690
11691
11692 DocRect AttrBounds = DocRect(0,0,0,0);
11693
11694 INT32 Width = DEFAULT_FILLWIDTH;
11695 INT32 Height = DEFAULT_FILLHEIGHT;
11696
11697
11698 if (FindParent() != NULL)
11699 {
11700
11701 SelRange* Selected = GetApplication()->FindSelection();
11702
11703 if (Selected == NULL || Selected->Count() <= 1)
11704 AttrBounds = ((NodeRenderableBounded*)FindParent())->GetBoundingRect(TRUE);
11705 else
11706 AttrBounds = Selected->GetBoundingRect();
11707
11708 Width = AttrBounds.Width();
11709 Height = AttrBounds.Height();
11710 }
11711
11712
11713 if ((*GetStartPoint()) == DocCoord(0,0))
11714 {
11715
11716 SetStartPoint(&AttrBounds.lo);
11717
11718
11719 DocCoord temp = DocCoord(AttrBounds.hi.x, AttrBounds.lo.y);
11720 SetEndPoint(&temp);
11721 temp = DocCoord(AttrBounds.lo.x, AttrBounds.hi.y);
11722 SetEndPoint2(&temp);
11723 }
11724
11725
11726 if ((*GetEndPoint()) == DocCoord(0,0))
11727 {
11728 DocCoord temp = DocCoord(AttrBounds.hi.x, AttrBounds.lo.y);
11729 SetEndPoint(&temp);
11730 }
11731
11732 if ((*GetEndPoint2()) == DocCoord(0,0))
11733 {
11734 DocCoord temp = DocCoord(AttrBounds.lo.x, AttrBounds.hi.y);
11735 SetEndPoint2(&temp);
11736 }
11737 #endif
11738 }
11739
11740
11741
11743
11744
11745
11747
11748
11749
11750
11751
11752
11753
11754
11755
11756
11757
11758 void AttrThreeColColourFill::Render(RenderRegion* pRender)
11759 {
11760 pRender->SetFillGeometry(&Value, FALSE);
11761 }
11762
11763
11764
11765
11766
11767
11768
11769
11770
11771
11772
11773
11774
11775
11776
11777
11778
11779
11780 Node* AttrThreeColColourFill::SimpleCopy()
11781 {
11782 AttrThreeColColourFill* NodeCopy = new AttrThreeColColourFill();
11783 if (NodeCopy == NULL)
11784 return NULL;
11785
11786 CopyNodeContents(NodeCopy);
11787
11788 return NodeCopy;
11789 }
11790
11791
11792
11793
11794
11795
11796
11797
11798
11799
11800
11801
11802
11803
11804 void AttrThreeColColourFill::RenderFillBlobs(RenderRegion* pRender)
11805 {
11806 #if !defined(EXCLUDE_FROM_RALPH)
11807 if (!IsVisible())
11808 return;
11809
11810
11811
11812 if (IsFillBeingEdited())
11813 return;
11814
11815
11816 if (CheckPreviousFillMesh())
11817 return;
11818
11819 DocCoord ControlPoints[3];
11820 ControlPoints[FILLCONTROL_STARTPOINT] = (*GetStartPoint());
11821 ControlPoints[FILLCONTROL_ENDPOINT] = (*GetEndPoint());
11822 ControlPoints[FILLCONTROL_ENDPOINT2] = (*GetEndPoint2());
11823
11824
11825 RenderFillMesh(pRender, ControlPoints, SelectionState, 3);
11826
11827
11828
11829
11830
11831 #endif
11832 }
11833
11834
11835
11836
11837
11838
11839
11840
11841
11842
11843
11844
11845
11846
11847 UINT32 AttrThreeColColourFill::GetAttrNameID(void)
11848 {
11849 return (_R(IDS_THREECOLGRADFILL));
11850 }
11851
11852
11853
11854
11855
11856
11857
11858
11859
11860
11861
11862
11863
11864
11865 void AttrThreeColColourFill::GetDebugDetails(StringBase* Str)
11866 {
11867 #ifdef _DEBUG
11868 NodeAttribute::GetDebugDetails( Str );
11869
11870 String_256 TempStr;
11871
11872 TempStr._MakeMsg( TEXT("\r\nDiamond Graduated Fill:\r\n"));
11873 (*Str) += TempStr;
11874
11875
11876
11877
11878
11879
11880
11881
11882
11883 TempStr._MakeMsg(TEXT("\r\nStart = (#1%ld, #2%ld)"),
11884 (*GetStartPoint()).x, (*GetStartPoint()).y);
11885 (*Str) += TempStr;
11886
11887 TempStr._MakeMsg(TEXT("\r\nEnd = (#1%ld, #2%ld) "),
11888 (*GetEndPoint()).x, (*GetEndPoint()).y);
11889 (*Str) += TempStr;
11890
11891 TempStr._MakeMsg(TEXT("\r\n3rd = (#1%ld, #2%ld) "),
11892 (*GetEndPoint2()).x, (*GetEndPoint2()).y);
11893 (*Str) += TempStr;
11894 #endif
11895 }
11896
11897
11898
11899
11900
11901
11902
11903
11904
11905
11906
11907
11908
11909
11910
11911 UINT32 AttrThreeColColourFill::GetNodeSize() const
11912 {
11913 return sizeof(AttrThreeColColourFill);
11914 }
11915
11916
11917
11918
11919
11920
11921
11922
11923
11924
11925
11926
11927
11928
11929
11930
11931 BOOL AttrThreeColColourFill::WritePreChildrenWeb(BaseCamelotFilter* pFilter)
11932 {
11933 #ifdef DO_EXPORT
11934 ERROR2IF(pFilter == NULL,FALSE,"NULL filter param");
11935
11936
11937 INT32 StartColRef = pFilter->WriteRecord(&Value.Colour);
11938 INT32 EndColRef = pFilter->WriteRecord(&Value.EndColour);
11939 INT32 EndCol2Ref = pFilter->WriteRecord(&Value.EndColour2);
11940
11941
11942 BOOL ok = ((StartColRef != 0) && (EndColRef != 0) && (EndCol2Ref != 0));
11943
11944 if (ok)
11945 {
11946 CamelotFileRecord Rec(pFilter,TAG_THREECOLFILL,TAG_THREECOLFILL_SIZE);
11947
11948 if (ok) ok = Rec.Init();
11949 if (ok) ok = Rec.WriteCoord(Value.StartPoint);
11950 if (ok) ok = Rec.WriteCoord(Value.EndPoint);
11951 if (ok) ok = Rec.WriteCoord(Value.EndPoint2);
11952 if (ok) ok = Rec.WriteReference(StartColRef);
11953 if (ok) ok = Rec.WriteReference(EndColRef);
11954 if (ok) ok = Rec.WriteReference(EndCol2Ref);
11955 if (ok) ok = pFilter->Write(&Rec);
11956 }
11957
11958 if (!ok)
11959 pFilter->GotError(_R(IDE_FILE_WRITE_ERROR));
11960
11961 return ok;
11962 #else
11963 return FALSE;
11964 #endif
11965 }
11966
11967
11968
11969
11970
11971
11972
11973
11974
11975
11976
11977
11978
11979
11980
11981
11982 BOOL AttrThreeColColourFill::WritePreChildrenNative(BaseCamelotFilter* pFilter)
11983 {
11984 #ifdef DO_EXPORT
11985 return WritePreChildrenWeb(pFilter);
11986 #else
11987 return FALSE;
11988 #endif
11989 }
11990
11991
11992
11993
11994
11995
11996
11997
11998
11999
12000
12001
12002
12003
12004
12005
12006 BOOL AttrThreeColColourFill::WriteColourDefinitions (BaseCamelotFilter* pFilter)
12007 {
12008
12009 INT32 StartColRef = pFilter->WriteRecord(&Value.Colour);
12010 INT32 EndColRef = pFilter->WriteRecord(&Value.EndColour);
12011 INT32 EndCol2Ref = pFilter->WriteRecord(&Value.EndColour2);
12012
12013
12014 BOOL ok = ((StartColRef != 0) && (EndColRef != 0) && (EndCol2Ref != 0));
12015
12016 return (ok);
12017 }
12018
12020
12021
12022
12024
12025
12026
12027
12028
12029
12030
12031
12032
12033
12034
12035 void AttrThreeColTranspFill::Render(RenderRegion* pRender)
12036 {
12037 pRender->SetTranspFillGeometry(&Value, FALSE);
12038 }
12039
12040
12041
12042
12043
12044
12045
12046
12047
12048
12049
12050
12051
12052
12053
12054
12055 BOOL AttrThreeColTranspFill::NeedsTransparency() const
12056 {
12057 AttrThreeColTranspFill* pNonConst = (AttrThreeColTranspFill*) this;
12058 return ( pNonConst->GetTranspType() != TT_Mix ||
12059 *(pNonConst->GetStartTransp()) != 0 ||
12060 *(pNonConst->GetEndTransp()) != 0 ||
12061 *(pNonConst->GetEndTransp2()) != 0 );
12062 }
12063
12064
12065
12066
12067
12068
12069
12070
12071
12072
12073
12074
12075
12076
12077
12078
12079
12080
12081 Node* AttrThreeColTranspFill::SimpleCopy()
12082 {
12083 AttrThreeColTranspFill* NodeCopy = new AttrThreeColTranspFill();
12084 if (NodeCopy == NULL)
12085 return NULL;
12086
12087 CopyNodeContents(NodeCopy);
12088
12089 return NodeCopy;
12090 }
12091
12092
12093
12094
12095
12096
12097
12098
12099
12100
12101
12102
12103
12104
12105 void AttrThreeColTranspFill::RenderFillBlobs(RenderRegion* pRender)
12106 {
12107 #if !defined(EXCLUDE_FROM_RALPH)
12108 if (!IsVisible())
12109 return;
12110
12111
12112
12113 if (IsFillBeingEdited())
12114 return;
12115
12116
12117 if (CheckPreviousFillMesh())
12118 return;
12119
12120 DocCoord ControlPoints[3];
12121 ControlPoints[FILLCONTROL_STARTPOINT] = (*GetStartPoint());
12122 ControlPoints[FILLCONTROL_ENDPOINT] = (*GetEndPoint());
12123 ControlPoints[FILLCONTROL_ENDPOINT2] = (*GetEndPoint2());
12124
12125
12126 RenderFillMesh(pRender, ControlPoints, SelectionState, 3);
12127
12128
12129
12130
12131
12132 #endif
12133 }
12134
12135
12136
12137
12138
12139
12140
12141
12142
12143
12144
12145
12146
12147
12148 UINT32 AttrThreeColTranspFill::GetAttrNameID(void)
12149 {
12150 return (_R(IDS_THREECOLTRANSPFILL));
12151 }
12152
12153
12154
12155
12156
12157
12158
12159
12160
12161
12162
12163
12164
12165
12166 void AttrThreeColTranspFill::GetDebugDetails(StringBase* Str)
12167 {
12168 #ifdef _DEBUG
12169 NodeAttribute::GetDebugDetails( Str );
12170
12171 String_256 TempStr;
12172
12173 TempStr._MakeMsg( TEXT("\r\nThreeCol Graduated Fill:\r\n"));
12174 (*Str) += TempStr;
12175
12176 TempStr._MakeMsg(TEXT("\r\nStart"));
12177 (*Str) += TempStr;
12178
12179 TempStr._MakeMsg(TEXT("\r\nEnd"));
12180 (*Str) += TempStr;
12181
12182 TempStr._MakeMsg(TEXT("\r\nStart = (#1%ld, #2%ld)"),
12183 (*GetStartPoint()).x, (*GetStartPoint()).y);
12184 (*Str) += TempStr;
12185
12186 TempStr._MakeMsg(TEXT("\r\nEnd = (#1%ld, #2%ld) "),
12187 (*GetEndPoint()).x, (*GetEndPoint()).y);
12188 (*Str) += TempStr;
12189
12190 TempStr._MakeMsg(TEXT("\r\n3rd = (#1%ld, #2%ld) "),
12191 (*GetEndPoint2()).x, (*GetEndPoint2()).y);
12192 (*Str) += TempStr;
12193 #endif
12194 }
12195
12196
12197
12198
12199
12200
12201
12202
12203
12204
12205
12206
12207
12208
12209
12210 UINT32 AttrThreeColTranspFill::GetNodeSize() const
12211 {
12212 return sizeof(AttrThreeColTranspFill);
12213 }
12214
12215
12216
12217
12218
12219
12220
12221
12222
12223
12224
12225
12226
12227
12228
12229
12230 BOOL AttrThreeColTranspFill::WritePreChildrenWeb(BaseCamelotFilter* pFilter)
12231 {
12232 #ifdef DO_EXPORT
12233 ERROR2IF(pFilter == NULL,FALSE,"NULL filter param");
12234 ERROR3IF(Value.Transp > 255,"Start transparency level is too high to be stored as a byte");
12235 ERROR3IF(Value.EndTransp > 255,"End transparency level is too high to be stored as a byte");
12236 ERROR3IF(Value.EndTransp2 > 255,"End transparency2 level is too high to be stored as a byte");
12237 ERROR3IF(Value.TranspType > 255,"Transparency type is too high to be stored as a byte");
12238
12239 BOOL ok = TRUE;
12240
12241 CamelotFileRecord Rec(pFilter,TAG_THREECOLTRANSPARENTFILL,TAG_THREECOLTRANSPARENTFILL_SIZE);
12242
12243 if (ok) ok = Rec.Init();
12244 if (ok) ok = Rec.WriteCoord(Value.StartPoint);
12245 if (ok) ok = Rec.WriteCoord(Value.EndPoint);
12246 if (ok) ok = Rec.WriteCoord(Value.EndPoint2);
12247 if (ok) ok = Rec.WriteBYTE(BYTE(Value.Transp));
12248 if (ok) ok = Rec.WriteBYTE(BYTE(Value.EndTransp));
12249 if (ok) ok = Rec.WriteBYTE(BYTE(Value.EndTransp2));
12250 if (ok) ok = Rec.WriteBYTE(BYTE(Value.TranspType));
12251 if (ok) ok = pFilter->Write(&Rec);
12252
12253 if (!ok)
12254 pFilter->GotError(_R(IDE_FILE_WRITE_ERROR));
12255
12256 return ok;
12257 #else
12258 return FALSE;
12259 #endif
12260 }
12261
12262
12263
12264
12265
12266
12267
12268
12269
12270
12271
12272
12273
12274
12275
12276
12277 BOOL AttrThreeColTranspFill::WritePreChildrenNative(BaseCamelotFilter* pFilter)
12278 {
12279 #ifdef DO_EXPORT
12280 return WritePreChildrenWeb(pFilter);
12281 #else
12282 return FALSE;
12283 #endif
12284 }
12285
12286
12287
12288
12289
12290
12291
12292
12293
12294
12295
12296
12297
12298
12299
12300
12301
12302
12303 BOOL AttrThreeColTranspFill::HasEquivalentDefaultValue(BOOL bAppearance)
12304 {
12305
12306 if (bAppearance)
12307 return (Value.TranspType==TT_NoTranspType || (Value.TranspType==TT_Mix && Value.Transp == 0 && Value.EndTransp==0 && Value.EndTransp2==0));
12308 else
12309 return FALSE;
12310 }
12311
12312
12313
12314
12316
12317
12318
12320
12321
12322
12323
12324
12325
12326
12327
12328
12329
12330
12331
12332
12333
12334 void AttrFourColFill::TransformSelectedControlPoints( TransformBase& Trans, BOOL* isARampBlob )
12335 {
12336 #if !defined(EXCLUDE_FROM_RALPH)
12337 TRACE( _T("TransformSelected\n"));
12338
12339 if ( Trans.TransFills )
12340 {
12341 ClickModifiers ClickMods;
12342 ClickMods.Adjust = FALSE;
12343
12344
12345 if (IsSelected(FILLCONTROL_STARTPOINT))
12346 {
12347 DocCoord Pos = *GetStartPoint();
12348 Trans.Transform( &Pos, 1);
12349
12350 FillControl Start = FILLCONTROL_STARTPOINT;
12351
12352 OnControlDrag(Pos, Start, ClickMods);
12353 }
12354 else
12355 {
12356 if (IsSelected(FILLCONTROL_ENDPOINT3))
12357 {
12358 DocCoord Pos = *GetEndPoint2() + *GetEndPoint() - *GetStartPoint();
12359 Trans.Transform( &Pos, 1);
12360
12361 FillControl End3 = FILLCONTROL_ENDPOINT3;
12362
12363 OnControlDrag(Pos, End3, ClickMods);
12364 }
12365 else
12366 {
12367 if (IsSelected(FILLCONTROL_ENDPOINT))
12368 {
12369 DocCoord Pos = *GetEndPoint();
12370 Trans.Transform( &Pos, 1);
12371
12372 FillControl End = FILLCONTROL_ENDPOINT;
12373
12374 OnControlDrag(Pos, End, ClickMods);
12375 }
12376
12377 if (IsSelected(FILLCONTROL_ENDPOINT2))
12378 {
12379 DocCoord Pos = *GetEndPoint2();
12380 Trans.Transform( &Pos, 1);
12381
12382 FillControl End2 = FILLCONTROL_ENDPOINT2;
12383
12384 OnControlDrag(Pos, End2, ClickMods);
12385 }
12386 }
12387 }
12388 }
12389 #endif
12390 }
12391
12392
12393
12394
12395
12396
12397
12398
12399
12400
12401
12402
12403
12404 FillControl AttrFourColFill::TestColourDrop(AttrColourDrop* ColDrop)
12405 {
12406 #if !defined(EXCLUDE_FROM_RALPH)
12407
12408 DocCoord DropPoint = ColDrop->GetDropPoint();
12409
12410
12411 FillControl ControlHit = CheckForControlHit(DropPoint);
12412
12413
12414 if (ControlHit != FILLCONTROL_NULL)
12415 return ControlHit;
12416
12417
12418
12419
12420
12421
12422
12423 NodeRenderableInk* pParentObject = ColDrop->GetObjectDroppedOn();
12424 if (pParentObject == NULL)
12425 return FILLCONTROL_NULL;
12426
12427
12428 if (GetStartPoint() == NULL || GetEndPoint() == NULL || GetEndPoint2() == NULL)
12429 return FILLCONTROL_NULL;
12430
12431 DocCoord StartPoint = *GetStartPoint();
12432 DocCoord EndPoint = *GetEndPoint();
12433 DocCoord EndPoint2 = *GetEndPoint2();
12434 DocCoord EndPoint3 = EndPoint2 + EndPoint - StartPoint;
12435
12436 double StartDist = DropPoint.Distance(StartPoint);
12437 double EndDist = DropPoint.Distance(EndPoint);
12438 double End2Dist = DropPoint.Distance(EndPoint2);
12439 double End3Dist = DropPoint.Distance(EndPoint3);
12440
12441
12442
12443 if (StartDist < End3Dist)
12444 {
12445
12446 if (StartDist < End2Dist)
12447 {
12448
12449 if (StartDist < EndDist)
12450 ControlHit = FILLCONTROL_STARTPOINT;
12451 else
12452 ControlHit = FILLCONTROL_ENDPOINT;
12453 }
12454 else
12455 {
12456
12457 if (EndDist < End2Dist)
12458 ControlHit = FILLCONTROL_ENDPOINT;
12459 else
12460 ControlHit = FILLCONTROL_ENDPOINT2;
12461 }
12462 }
12463 else
12464 {
12465
12466 if (End3Dist < End2Dist)
12467 {
12468
12469 if (End3Dist < EndDist)
12470 ControlHit = FILLCONTROL_ENDPOINT3;
12471 else
12472 ControlHit = FILLCONTROL_ENDPOINT;
12473 }
12474 else
12475 {
12476
12477 if (End2Dist < EndDist)
12478 ControlHit = FILLCONTROL_ENDPOINT2;
12479 else
12480 ControlHit = FILLCONTROL_ENDPOINT;
12481 }
12482 }
12483
12484 return ControlHit;
12485 #else
12486 return FILLCONTROL_NULL;
12487 #endif
12488 }
12489
12490
12491
12492
12493
12494
12495
12496
12497
12498
12499
12500
12501
12502
12503
12504 void AttrFourColFill::Transform( TransformBase& Trans )
12505 {
12506 if ( Trans.TransFills )
12507 {
12508 Trans.Transform( GetStartPoint(), 1);
12509 Trans.Transform( GetEndPoint(), 1);
12510 Trans.Transform( GetEndPoint2(), 1);
12511
12512 if (IsPerspective())
12513 Trans.Transform( GetEndPoint3(), 1);
12514 }
12515 }
12516
12517
12518
12519
12520
12521
12522
12523
12524
12525
12526
12527
12528
12529
12530
12531 BOOL AttrFourColFill::CanTransform()
12532 {
12533 return TRUE;
12534 }
12535
12536
12537
12538
12539
12540
12541
12542
12543
12544
12545
12546
12547
12548
12549
12550
12551
12552
12553
12554
12555 void AttrFourColFill::RenderFillMesh(RenderRegion* pRender,
12556 DocCoord* ControlPoints, BOOL* SelState,
12557 INT32 NumControlPoints)
12558 {
12559 #if !defined(EXCLUDE_FROM_RALPH)
12560 DocCoord StartPoint = ControlPoints[FILLCONTROL_STARTPOINT];
12561 DocCoord EndPoint = ControlPoints[FILLCONTROL_ENDPOINT];
12562 DocCoord EndPoint2 = ControlPoints[FILLCONTROL_ENDPOINT2];
12563
12564 if (StartPoint == EndPoint)
12565 return;
12566
12567 if (SelState == NULL)
12568 {
12569
12570
12571 BOOL Selected[NUMCONTROLPOINTS];
12572 for (INT32 i = 0; i <= FILLCONTROL_ENDPOINT3; i++)
12573 {
12574 Selected[i] = FALSE;
12575 }
12576 SelState = Selected;
12577 }
12578
12579 DocCoord EndPoint3 = EndPoint2 + EndPoint - StartPoint;
12580
12581
12582 pRender->SaveContext();
12583
12584
12585 INT32 BlobSize = (Camelot.GetBlobManager())->GetBlobSize();
12586
12587
12588 Path ArrowPath;
12589 ArrowPath.Initialise();
12590 DocCoord LineEnd;
12591 MakeMeshArrow(&ArrowPath, StartPoint, EndPoint, &LineEnd);
12592
12593
12594 Path ArrowPath2;
12595 ArrowPath2.Initialise();
12596 DocCoord LineEnd2;
12597 MakeMeshArrow(&ArrowPath2, StartPoint, EndPoint2, &LineEnd2);
12598
12599
12600 pRender->SetLineWidth(0);
12601 pRender->SetLineColour(COLOUR_UNSELECTEDBLOB);
12602 pRender->SetFillColour(COLOUR_UNSELECTEDBLOB);
12603
12604
12605 pRender->SetLineWidth(BlobSize/4);
12606 pRender->DrawLine(StartPoint, LineEnd);
12607
12608
12609 pRender->DrawLine(StartPoint, LineEnd2);
12610
12611
12612 pRender->DrawLine(EndPoint, EndPoint3);
12613
12614
12615 pRender->DrawLine(EndPoint2, EndPoint3);
12616
12617
12618 pRender->SetLineWidth(0);
12619 pRender->SetLineColour(COLOUR_NONE);
12620 pRender->DrawPath(&ArrowPath);
12621
12622
12623 pRender->DrawPath(&ArrowPath2);
12624
12625
12626
12627 pRender->SetLineColour(COLOUR_NONE);
12628
12629
12630 if (SelState[FILLCONTROL_STARTPOINT])
12631 {
12632
12633 pRender->SetFillColour(COLOUR_SELECTEDBLOB);
12634 pRender->DrawBlob(StartPoint, BT_SELECTED);
12635 }
12636 else
12637 {
12638
12639 pRender->SetFillColour(COLOUR_UNSELECTEDBLOB);
12640 pRender->DrawBlob(StartPoint, BT_UNSELECTED);
12641 }
12642
12643
12644 if (SelState[FILLCONTROL_ENDPOINT])
12645 {
12646
12647 pRender->SetFillColour(COLOUR_SELECTEDBLOB);
12648 pRender->DrawBlob(EndPoint, BT_SELECTED);
12649 }
12650 else
12651 {
12652
12653 pRender->SetFillColour(COLOUR_UNSELECTEDBLOB);
12654 pRender->DrawBlob(EndPoint, BT_UNSELECTED);
12655 }
12656
12657
12658 if (SelState[FILLCONTROL_ENDPOINT2])
12659 {
12660
12661 pRender->SetFillColour(COLOUR_SELECTEDBLOB);
12662 pRender->DrawBlob(EndPoint2,BT_SELECTED);
12663 }
12664 else
12665 {
12666
12667 pRender->SetFillColour(COLOUR_UNSELECTEDBLOB);
12668 pRender->DrawBlob(EndPoint2,BT_UNSELECTED);
12669 }
12670
12671
12672 if (SelState[FILLCONTROL_ENDPOINT3])
12673 {
12674
12675 pRender->SetFillColour(COLOUR_SELECTEDBLOB);
12676 pRender->DrawBlob(EndPoint3,BT_SELECTED);
12677 }
12678 else
12679 {
12680
12681 pRender->SetFillColour(COLOUR_UNSELECTEDBLOB);
12682 pRender->DrawBlob(EndPoint3,BT_UNSELECTED);
12683 }
12684
12685
12686 pRender->RestoreContext();
12687 #endif
12688 }
12689
12690
12691
12692
12693
12694
12695
12696
12697
12698
12699
12700
12701
12702
12703
12704
12705 void AttrFourColFill::OnControlDrag(DocCoord Pos, FillControl& DragControl, ClickModifiers ClickMods)
12706 {
12707 #if !defined(EXCLUDE_FROM_RALPH)
12708
12709 DocCoord StartPoint = *GetStartPoint();
12710 DocCoord EndPoint = *GetEndPoint();
12711 DocCoord EndPoint2 = *GetEndPoint2();
12712
12713 INT32 dx, dy;
12714
12715
12716 switch (DragControl)
12717 {
12718 case FILLCONTROL_STARTPOINT:
12719
12720
12721 dx = StartPoint.x - Pos.x;
12722 dy = StartPoint.y - Pos.y;
12723
12724 EndPoint.translate(-dx, -dy);
12725 EndPoint2.translate(-dx, -dy);
12726
12727 SetEndPoint(&EndPoint);
12728 SetEndPoint2(&EndPoint2);
12729 SetStartPoint(&Pos);
12730 break;
12731
12732 case FILLCONTROL_ENDPOINT:
12733
12734
12735
12736
12737 if (ClickMods.Constrain)
12738 DocView::ConstrainToAngle(StartPoint, &Pos);
12739
12740
12741
12742 if (ClickMods.Adjust)
12743 {
12744 double OldLen = StartPoint.Distance(EndPoint);
12745 double NewLen = StartPoint.Distance(Pos);
12746 double Ratio = 1.0;
12747
12748 if (OldLen == 0)
12749 Ratio = 0;
12750 else
12751 Ratio = NewLen/OldLen;
12752
12753
12754 DocCoord temp = MakeLineAtAngle(StartPoint, Pos, 90, INT32(StartPoint.Distance(EndPoint2) * Ratio));
12755 SetEndPoint2(&temp);
12756 }
12757
12758 SetEndPoint(&Pos);
12759 break;
12760
12761 case FILLCONTROL_ENDPOINT2:
12762
12763
12764
12765
12766 if (ClickMods.Constrain)
12767 DocView::ConstrainToAngle(StartPoint, &Pos);
12768
12769
12770
12771 if (ClickMods.Adjust)
12772 {
12773 double OldLen = StartPoint.Distance(EndPoint2);
12774 double NewLen = StartPoint.Distance(Pos);
12775 double Ratio = 1.0;
12776
12777 if (OldLen == 0)
12778 Ratio = 0;
12779 else
12780 Ratio = NewLen/OldLen;
12781
12782
12783 DocCoord temp = MakeLineAtAngle(StartPoint, Pos, -90, INT32(StartPoint.Distance(EndPoint) * Ratio));
12784 SetEndPoint(&temp);
12785 }
12786
12787 SetEndPoint2(&Pos);
12788 break;
12789
12790 case FILLCONTROL_ENDPOINT3:
12791 DocCoord P = EndPoint - StartPoint;
12792 DocCoord Q = EndPoint2 - StartPoint;
12793 DocCoord N = Pos - StartPoint;
12794 DocCoord NewEndPoint = EndPoint;
12795 DocCoord NewEndPoint2 = EndPoint2;
12796
12797
12798
12799 if ((Pos.Distance(StartPoint) > 512) &&
12800 (Pos.Distance(EndPoint) > 512) &&
12801 (Pos.Distance(EndPoint2) > 512) )
12802 {
12803 if (ClickMods.Adjust || (P == Q))
12804 {
12805 NewEndPoint = DocCoord(Pos.x, StartPoint.y);
12806 NewEndPoint2 = DocCoord(StartPoint.x, Pos.y);
12807 }
12808 else
12809 {
12810
12811
12812
12813 double px = P.x;
12814 double py = P.y;
12815 double qx = Q.x;
12816 double qy = Q.y;
12817 double nx = N.x;
12818 double ny = N.y;
12819
12820 double den = (px * qy) - (py * qx);
12821
12822 ERROR3IF(floor(den) != den, "Non integer denominator");
12823
12824 if (den != 0.0)
12825 {
12826 double u = ((px * ny) - (py * nx)) / den;
12827
12828 NewEndPoint.x = Pos.x - (INT32) (u * qx);
12829 NewEndPoint.y = Pos.y - (INT32) (u * qy);
12830 NewEndPoint2.x = StartPoint.x + (INT32) (u * qx);
12831 NewEndPoint2.y = StartPoint.y + (INT32) (u * qy);
12832 }
12833 else
12834 {
12835 NewEndPoint = DocCoord(Pos.x, StartPoint.y);
12836 NewEndPoint2 = DocCoord(StartPoint.x, Pos.y);
12837 }
12838 }
12839
12840
12841 if ((StartPoint.Distance(NewEndPoint) > 512) &&
12842 (StartPoint.Distance(NewEndPoint2) > 512) )
12843 {
12844 SetEndPoint(&NewEndPoint);
12845 SetEndPoint2(&NewEndPoint2);
12846 }
12847 }
12848
12849 break;
12850 }
12851 #endif
12852 }
12853
12854
12855
12856
12857
12858
12859
12860
12861
12862
12863
12864
12865
12866
12867
12868
12869 DocRect AttrFourColFill::GetBlobBoundingRect()
12870 {
12871 #if !defined(EXCLUDE_FROM_RALPH)
12872
12873
12874
12875 if ( (!GetApplication()->GetBlobManager()->GetCurrentInterest(TRUE).Fill || !IsVisible()) && DraggedFill != this )
12876 return DocRect(0,0, 0,0);
12877
12878
12879 DocCoord StartPoint = *GetStartPoint();
12880 DocCoord EndPoint = *GetEndPoint();
12881 DocCoord EndPoint2 = *GetEndPoint2();
12882 DocCoord EndPoint3 = EndPoint2 + EndPoint - StartPoint;
12883
12884
12885 DocRect BoundingRect(StartPoint, StartPoint);
12886
12887
12888 DocRect BlobRect;
12889
12890
12891
12892
12893
12894 (Camelot.GetBlobManager())->GetBlobRect(StartPoint, &BlobRect);
12895 BoundingRect.IncludePoint(BlobRect.lo);
12896 BoundingRect.IncludePoint(BlobRect.hi);
12897
12898 (Camelot.GetBlobManager())->GetBlobRect(EndPoint, &BlobRect);
12899 BoundingRect.IncludePoint(BlobRect.lo);
12900 BoundingRect.IncludePoint(BlobRect.hi);
12901
12902 (Camelot.GetBlobManager())->GetBlobRect(EndPoint2, &BlobRect);
12903 BoundingRect.IncludePoint(BlobRect.lo);
12904 BoundingRect.IncludePoint(BlobRect.hi);
12905
12906 (Camelot.GetBlobManager())->GetBlobRect(EndPoint3, &BlobRect);
12907 BoundingRect.IncludePoint(BlobRect.lo);
12908 BoundingRect.IncludePoint(BlobRect.hi);
12909
12910 IncludeArrowHead(&BoundingRect, StartPoint, EndPoint);
12911 IncludeArrowHead(&BoundingRect, StartPoint, EndPoint2);
12912
12913
12914 return BoundingRect;
12915 #else
12916 return DocRect(0,0,0,0);
12917 #endif
12918 }
12919
12920
12921
12922
12923
12924
12925
12926
12927
12928
12929
12930
12931
12932
12933
12934 void AttrFourColFill::RenderControl(FillControl Control, BOOL RenderOn)
12935 {
12936 #if !defined(EXCLUDE_FROM_RALPH)
12937 DocRect ControlRect;
12938
12939
12940
12941 NodeRenderable* pParent = (NodeRenderable*)FindParent();
12942
12943 if (pParent == NULL)
12944 return;
12945
12946 if (IsBlobSame(Control))
12947 return;
12948
12949 Spread* pSpread = this->FindParentSpread();
12950
12951 switch (Control)
12952 {
12953 case FILLCONTROL_STARTPOINT:
12954
12955 (Camelot.GetBlobManager())->GetBlobRect(*GetStartPoint(), &ControlRect);
12956 RenderFillControl(RenderOn, &ControlRect, pSpread, pParent);
12957 break;
12958
12959 case FILLCONTROL_ENDPOINT:
12960 (Camelot.GetBlobManager())->GetBlobRect(*GetEndPoint(), &ControlRect);
12961 RenderFillControl(RenderOn, &ControlRect, pSpread, pParent);
12962 break;
12963
12964 case FILLCONTROL_ENDPOINT2:
12965 (Camelot.GetBlobManager())->GetBlobRect(*GetEndPoint2(), &ControlRect);
12966 RenderFillControl(RenderOn, &ControlRect, pSpread, pParent);
12967 break;
12968
12969 case FILLCONTROL_ENDPOINT3:
12970 DocCoord EndPoint3 = *GetEndPoint2() + *GetEndPoint() - *GetStartPoint();
12971 (Camelot.GetBlobManager())->GetBlobRect(EndPoint3, &ControlRect);
12972 RenderFillControl(RenderOn, &ControlRect, pSpread, pParent);
12973 break;
12974 }
12975 #endif
12976 }
12977
12978
12979
12980
12981
12982
12983
12984
12985
12986
12987
12988
12989
12990 void AttrFourColFill::CycleSelection(BOOL Reverse)
12991 {
12992 if (GetSelectionCount() == 1)
12993 {
12994 if (SelectionState[FILLCONTROL_STARTPOINT])
12995 {
12996 DeselectAll();
12997 if (Reverse)
12998 SelectBlob(FILLCONTROL_ENDPOINT3);
12999 else
13000 SelectBlob(FILLCONTROL_ENDPOINT);
13001 }
13002 else if (SelectionState[FILLCONTROL_ENDPOINT])
13003 {
13004 DeselectAll();
13005 if (Reverse)
13006 SelectBlob(FILLCONTROL_STARTPOINT);
13007 else
13008 SelectBlob(FILLCONTROL_ENDPOINT2);
13009 }
13010 else if (SelectionState[FILLCONTROL_ENDPOINT2])
13011 {
13012 DeselectAll();
13013 if (Reverse)
13014 SelectBlob(FILLCONTROL_ENDPOINT);
13015 else
13016 SelectBlob(FILLCONTROL_ENDPOINT3);
13017 }
13018 else if (SelectionState[FILLCONTROL_ENDPOINT3])
13019 {
13020 DeselectAll();
13021 if (Reverse)
13022 SelectBlob(FILLCONTROL_ENDPOINT2);
13023 else
13024 SelectBlob(FILLCONTROL_STARTPOINT);
13025 }
13026 }
13027 }
13028
13029
13030
13031
13032
13033
13034
13035
13036
13037
13038
13039
13040
13041
13042
13043
13044 FillControl AttrFourColFill::CheckForControlHit(DocCoord &ClickPos)
13045 {
13046
13047 FillControl HitControl = FILLCONTROL_NULL;
13048 #if !defined(EXCLUDE_FROM_RALPH)
13049 DocRect BlobRect;
13050
13051 if (!GetApplication()->GetBlobManager()->GetCurrentInterest().Fill || !IsVisible())
13052 return FILLCONTROL_NULL;
13053
13054
13055 DocCoord StartPoint = *GetStartPoint();
13056 DocCoord EndPoint = *GetEndPoint();
13057 DocCoord EndPoint2 = *GetEndPoint2();
13058 DocCoord EndPoint3 = EndPoint2 + EndPoint - StartPoint;
13059
13060
13061 (Camelot.GetBlobManager())->GetBlobRect(StartPoint, &BlobRect);
13062
13063 if ( BlobRect.ContainsCoord(ClickPos) )
13064 HitControl = FILLCONTROL_STARTPOINT;
13065
13066
13067 (Camelot.GetBlobManager())->GetBlobRect(EndPoint, &BlobRect);
13068
13069 if ( BlobRect.ContainsCoord(ClickPos) )
13070 HitControl = FILLCONTROL_ENDPOINT;
13071
13072
13073 (Camelot.GetBlobManager())->GetBlobRect(EndPoint2, &BlobRect);
13074
13075 if ( BlobRect.ContainsCoord(ClickPos) )
13076 HitControl = FILLCONTROL_ENDPOINT2;
13077
13078
13079 (Camelot.GetBlobManager())->GetBlobRect(EndPoint3, &BlobRect);
13080
13081 if ( BlobRect.ContainsCoord(ClickPos) )
13082 HitControl = FILLCONTROL_ENDPOINT3;
13083 #endif
13084 return HitControl;
13085 }
13086
13087
13088
13089
13090
13091
13092
13093
13094
13095
13096
13097
13098 void AttrFourColFill::ValidateAttributeValue()
13099 {
13100 #if !defined(EXCLUDE_FROM_RALPH)
13101 if ((*GetStartPoint()) != DocCoord(0,0) && (*GetEndPoint()) != DocCoord(0,0))
13102 {
13103
13104 if (*GetEndPoint2() == DocCoord(0,0))
13105 {
13106 DocCoord temp = MakeLineAtAngle((*GetStartPoint()), (*GetEndPoint()), 90);
13107 SetEndPoint2(&temp);
13108 }
13109
13110 return;
13111 }
13112
13113
13114 DocRect AttrBounds = DocRect(0,0,0,0);
13115
13116 INT32 Width = DEFAULT_FILLWIDTH;
13117 INT32 Height = DEFAULT_FILLHEIGHT;
13118
13119
13120 if (FindParent() != NULL)
13121 {
13122
13123 SelRange* Selected = GetApplication()->FindSelection();
13124
13125 if (Selected == NULL || Selected->Count() <= 1)
13126 AttrBounds = ((NodeRenderableBounded*)FindParent())->GetBoundingRect(TRUE);
13127 else
13128 AttrBounds = Selected->GetBoundingRect();
13129
13130 Width = AttrBounds.Width();
13131 Height = AttrBounds.Height();
13132 }
13133
13134
13135 if ((*GetStartPoint()) == DocCoord(0,0))
13136 {
13137
13138 SetStartPoint(&AttrBounds.lo);
13139
13140
13141 DocCoord temp = DocCoord(AttrBounds.hi.x, AttrBounds.lo.y);
13142 SetEndPoint(&temp);
13143 temp = DocCoord(AttrBounds.lo.x, AttrBounds.hi.y);
13144 SetEndPoint2(&temp);
13145 }
13146
13147
13148 if ((*GetEndPoint()) == DocCoord(0,0))
13149 {
13150 DocCoord temp = DocCoord(AttrBounds.hi.x, AttrBounds.lo.y);
13151 SetEndPoint(&temp);
13152 }
13153
13154
13155 if ((*GetEndPoint2()) == DocCoord(0,0))
13156 {
13157 DocCoord temp = DocCoord(AttrBounds.lo.x, AttrBounds.hi.y);
13158 SetEndPoint2(&temp);
13159 }
13160 #endif
13161 }
13162
13163
13164
13166
13167
13168
13170
13171
13172
13173
13174
13175
13176
13177
13178
13179
13180
13181 void AttrFourColColourFill::Render(RenderRegion* pRender)
13182 {
13183 pRender->SetFillGeometry(&Value, FALSE);
13184 }
13185
13186
13187
13188
13189
13190
13191
13192
13193
13194
13195
13196
13197
13198
13199
13200
13201
13202
13203 Node* AttrFourColColourFill::SimpleCopy()
13204 {
13205 AttrFourColColourFill* NodeCopy = new AttrFourColColourFill();
13206 if (NodeCopy == NULL)
13207 return NULL;
13208
13209 CopyNodeContents(NodeCopy);
13210
13211 return NodeCopy;
13212 }
13213
13214
13215
13216
13217
13218
13219
13220
13221
13222
13223
13224
13225
13226
13227 void AttrFourColColourFill::RenderFillBlobs(RenderRegion* pRender)
13228 {
13229 #if !defined(EXCLUDE_FROM_RALPH)
13230 if (!IsVisible())
13231 return;
13232
13233
13234
13235 if (IsFillBeingEdited())
13236 return;
13237
13238
13239 if (CheckPreviousFillMesh())
13240 return;
13241
13242
13243 DocCoord StartPoint = *GetStartPoint();
13244 DocCoord EndPoint = *GetEndPoint();
13245 DocCoord EndPoint2 = *GetEndPoint2();
13246 DocCoord EndPoint3 = EndPoint2 + EndPoint - StartPoint;
13247
13248 DocCoord ControlPoints[4];
13249 ControlPoints[FILLCONTROL_STARTPOINT] = StartPoint;
13250 ControlPoints[FILLCONTROL_ENDPOINT] = EndPoint;
13251 ControlPoints[FILLCONTROL_ENDPOINT2] = EndPoint2;
13252 ControlPoints[FILLCONTROL_ENDPOINT3] = EndPoint3;
13253
13254
13255 RenderFillMesh(pRender, ControlPoints, SelectionState, 4);
13256
13257
13258
13259
13260
13261 #endif
13262 }
13263
13264
13265
13266
13267
13268
13269
13270
13271
13272
13273
13274
13275
13276
13277 UINT32 AttrFourColColourFill::GetAttrNameID(void)
13278 {
13279 return (_R(IDS_FOURCOLGRADFILL));
13280 }
13281
13282
13283
13284
13285
13286
13287
13288
13289
13290
13291
13292
13293
13294
13295 void AttrFourColColourFill::GetDebugDetails(StringBase* Str)
13296 {
13297 #ifdef _DEBUG
13298 NodeAttribute::GetDebugDetails( Str );
13299
13300 String_256 TempStr;
13301
13302 TempStr._MakeMsg( TEXT("\r\nFour colour graduated fill:\r\n"));
13303 (*Str) += TempStr;
13304
13305
13306
13307
13308
13309
13310
13311
13312
13313
13314
13315
13316
13317
13318
13319
13320
13321 TempStr._MakeMsg(TEXT("\r\nStart = (#1%ld, #2%ld)"),
13322 (*GetStartPoint()).x, (*GetStartPoint()).y);
13323 (*Str) += TempStr;
13324
13325 TempStr._MakeMsg(TEXT("\r\nEnd = (#1%ld, #2%ld) "),
13326 (*GetEndPoint()).x, (*GetEndPoint()).y);
13327 (*Str) += TempStr;
13328
13329 TempStr._MakeMsg(TEXT("\r\n3rd = (#1%ld, #2%ld) "),
13330 (*GetEndPoint2()).x, (*GetEndPoint2()).y);
13331 (*Str) += TempStr;
13332 #endif
13333 }
13334
13335
13336
13337
13338
13339
13340
13341
13342
13343
13344
13345
13346
13347
13348
13349 UINT32 AttrFourColColourFill::GetNodeSize() const
13350 {
13351 return sizeof(AttrFourColColourFill);
13352 }
13353
13354
13355
13356
13357
13358
13359
13360
13361
13362
13363
13364
13365
13366
13367
13368
13369 BOOL AttrFourColColourFill::WritePreChildrenWeb(BaseCamelotFilter* pFilter)
13370 {
13371 #ifdef DO_EXPORT
13372 ERROR2IF(pFilter == NULL,FALSE,"NULL filter param");
13373
13374
13375 INT32 StartColRef = pFilter->WriteRecord(&Value.Colour);
13376 INT32 EndColRef = pFilter->WriteRecord(&Value.EndColour);
13377 INT32 EndCol2Ref = pFilter->WriteRecord(&Value.EndColour2);
13378 INT32 EndCol3Ref = pFilter->WriteRecord(&Value.EndColour3);
13379
13380
13381 BOOL ok = ((StartColRef != 0) && (EndColRef != 0) && (EndCol2Ref != 0) && (EndCol3Ref != 0));
13382
13383 if (ok)
13384 {
13385 CamelotFileRecord Rec(pFilter,TAG_FOURCOLFILL,TAG_FOURCOLFILL_SIZE);
13386
13387 if (ok) ok = Rec.Init();
13388 if (ok) ok = Rec.WriteCoord(Value.StartPoint);
13389 if (ok) ok = Rec.WriteCoord(Value.EndPoint);
13390 if (ok) ok = Rec.WriteCoord(Value.EndPoint2);
13391 if (ok) ok = Rec.WriteReference(StartColRef);
13392 if (ok) ok = Rec.WriteReference(EndColRef);
13393 if (ok) ok = Rec.WriteReference(EndCol2Ref);
13394 if (ok) ok = Rec.WriteReference(EndCol3Ref);
13395 if (ok) ok = pFilter->Write(&Rec);
13396 }
13397
13398 if (!ok)
13399 pFilter->GotError(_R(IDE_FILE_WRITE_ERROR));
13400
13401 return ok;
13402 #else
13403 return FALSE;
13404 #endif
13405 }
13406
13407
13408
13409
13410
13411
13412
13413
13414
13415
13416
13417
13418
13419
13420
13421
13422 BOOL AttrFourColColourFill::WritePreChildrenNative(BaseCamelotFilter* pFilter)
13423 {
13424 #ifdef DO_EXPORT
13425 return WritePreChildrenWeb(pFilter);
13426 #else
13427 return FALSE;
13428 #endif
13429 }
13430
13431
13432
13433
13434
13435
13436
13437
13438
13439
13440
13441
13442
13443
13444
13445
13446 BOOL AttrFourColColourFill::WriteColourDefinitions (BaseCamelotFilter* pFilter)
13447 {
13448
13449 INT32 StartColRef = pFilter->WriteRecord(&Value.Colour);
13450 INT32 EndColRef = pFilter->WriteRecord(&Value.EndColour);
13451 INT32 EndCol2Ref = pFilter->WriteRecord(&Value.EndColour2);
13452 INT32 EndCol3Ref = pFilter->WriteRecord(&Value.EndColour3);
13453
13454
13455 BOOL ok = ((StartColRef != 0) && (EndColRef != 0) && (EndCol2Ref != 0) && (EndCol3Ref != 0));
13456
13457 return (ok);
13458 }
13459
13461
13462
13463
13465
13466
13467
13468
13469
13470
13471
13472
13473
13474
13475
13476 void AttrFourColTranspFill::Render(RenderRegion* pRender)
13477 {
13478 pRender->SetTranspFillGeometry(&Value, FALSE);
13479 }
13480
13481
13482
13483
13484
13485
13486
13487
13488
13489
13490
13491
13492
13493
13494
13495
13496 BOOL AttrFourColTranspFill::NeedsTransparency() const
13497 {
13498 AttrFourColTranspFill* pNonConst = (AttrFourColTranspFill*) this;
13499 return ( pNonConst->GetTranspType() != TT_Mix ||
13500 *(pNonConst->GetStartTransp()) != 0 ||
13501 *(pNonConst->GetEndTransp()) != 0 ||
13502 *(pNonConst->GetEndTransp2()) != 0 ||
13503 *(pNonConst->GetEndTransp3()) != 0 );
13504 }
13505
13506
13507
13508
13509
13510
13511
13512
13513
13514
13515
13516
13517
13518
13519
13520
13521
13522
13523 Node* AttrFourColTranspFill::SimpleCopy()
13524 {
13525 AttrFourColTranspFill* NodeCopy = new AttrFourColTranspFill();
13526 if (NodeCopy == NULL)
13527 return NULL;
13528
13529 CopyNodeContents(NodeCopy);
13530
13531 return NodeCopy;
13532 }
13533
13534
13535
13536
13537
13538
13539
13540
13541
13542
13543
13544
13545
13546
13547 void AttrFourColTranspFill::RenderFillBlobs(RenderRegion* pRender)
13548 {
13549 #if !defined(EXCLUDE_FROM_RALPH)
13550 if (!IsVisible())
13551 return;
13552
13553
13554
13555 if (IsFillBeingEdited())
13556 return;
13557
13558
13559 if (CheckPreviousFillMesh())
13560 return;
13561
13562
13563 DocCoord StartPoint = *GetStartPoint();
13564 DocCoord EndPoint = *GetEndPoint();
13565 DocCoord EndPoint2 = *GetEndPoint2();
13566 DocCoord EndPoint3 = EndPoint2 + EndPoint - StartPoint;
13567
13568 DocCoord ControlPoints[4];
13569 ControlPoints[FILLCONTROL_STARTPOINT] = StartPoint;
13570 ControlPoints[FILLCONTROL_ENDPOINT] = EndPoint;
13571 ControlPoints[FILLCONTROL_ENDPOINT2] = EndPoint2;
13572 ControlPoints[FILLCONTROL_ENDPOINT3] = EndPoint3;
13573
13574
13575 RenderFillMesh(pRender, ControlPoints, SelectionState, 4);
13576
13577
13578
13579
13580
13581 #endif
13582 }
13583
13584
13585
13586
13587
13588
13589
13590
13591
13592
13593
13594
13595
13596
13597 UINT32 AttrFourColTranspFill::GetAttrNameID(void)
13598 {
13599 return (_R(IDS_FOURCOLTRANSPFILL));
13600 }
13601
13602
13603
13604
13605
13606
13607
13608
13609
13610
13611
13612
13613
13614
13615 void AttrFourColTranspFill::GetDebugDetails(StringBase* Str)
13616 {
13617 #ifdef _DEBUG
13618 NodeAttribute::GetDebugDetails( Str );
13619
13620 String_256 TempStr;
13621
13622 TempStr._MakeMsg( TEXT("\r\nFourCol Graduated Fill:\r\n"));
13623 (*Str) += TempStr;
13624
13625 TempStr._MakeMsg(TEXT("\r\nStart"));
13626 (*Str) += TempStr;
13627
13628 TempStr._MakeMsg(TEXT("\r\nEnd"));
13629 (*Str) += TempStr;
13630
13631 TempStr._MakeMsg(TEXT("\r\nStart = (#1%ld, #2%ld)"),
13632 (*GetStartPoint()).x, (*GetStartPoint()).y);
13633 (*Str) += TempStr;
13634
13635 TempStr._MakeMsg(TEXT("\r\nEnd = (#1%ld, #2%ld) "),
13636 (*GetEndPoint()).x, (*GetEndPoint()).y);
13637 (*Str) += TempStr;
13638
13639 TempStr._MakeMsg(TEXT("\r\n3rd = (#1%ld, #2%ld) "),
13640 (*GetEndPoint2()).x, (*GetEndPoint2()).y);
13641 (*Str) += TempStr;
13642 #endif
13643 }
13644
13645
13646
13647
13648
13649
13650
13651
13652
13653
13654
13655
13656
13657
13658
13659 UINT32 AttrFourColTranspFill::GetNodeSize() const
13660 {
13661 return sizeof(AttrFourColTranspFill);
13662 }
13663
13664
13665
13666
13667
13668
13669
13670
13671
13672
13673
13674
13675
13676
13677
13678
13679 BOOL AttrFourColTranspFill::WritePreChildrenWeb(BaseCamelotFilter* pFilter)
13680 {
13681 #ifdef DO_EXPORT
13682 ERROR2IF(pFilter == NULL,FALSE,"NULL filter param");
13683 ERROR3IF(Value.Transp > 255,"Start transparency level is too high to be stored as a byte");
13684 ERROR3IF(Value.EndTransp > 255,"End transparency level is too high to be stored as a byte");
13685 ERROR3IF(Value.EndTransp2 > 255,"End transparency2 level is too high to be stored as a byte");
13686 ERROR3IF(Value.EndTransp3 > 255,"End transparency3 level is too high to be stored as a byte");
13687 ERROR3IF(Value.TranspType > 255,"Transparency type is too high to be stored as a byte");
13688
13689 BOOL ok = TRUE;
13690
13691 CamelotFileRecord Rec(pFilter,TAG_FOURCOLTRANSPARENTFILL,TAG_FOURCOLTRANSPARENTFILL_SIZE);
13692
13693 if (ok) ok = Rec.Init();
13694 if (ok) ok = Rec.WriteCoord(Value.StartPoint);
13695 if (ok) ok = Rec.WriteCoord(Value.EndPoint);
13696 if (ok) ok = Rec.WriteCoord(Value.EndPoint2);
13697 if (ok) ok = Rec.WriteBYTE(BYTE(Value.Transp));
13698 if (ok) ok = Rec.WriteBYTE(BYTE(Value.EndTransp));
13699 if (ok) ok = Rec.WriteBYTE(BYTE(Value.EndTransp2));
13700 if (ok) ok = Rec.WriteBYTE(BYTE(Value.EndTransp3));
13701 if (ok) ok = Rec.WriteBYTE(BYTE(Value.TranspType));
13702 if (ok) ok = pFilter->Write(&Rec);
13703
13704 if (!ok)
13705 pFilter->GotError(_R(IDE_FILE_WRITE_ERROR));
13706
13707 return ok;
13708 #else
13709 return FALSE;
13710 #endif
13711 }
13712
13713
13714
13715
13716
13717
13718
13719
13720
13721
13722
13723
13724
13725
13726
13727
13728 BOOL AttrFourColTranspFill::WritePreChildrenNative(BaseCamelotFilter* pFilter)
13729 {
13730 #ifdef DO_EXPORT
13731 return WritePreChildrenWeb(pFilter);
13732 #else
13733 return FALSE;
13734 #endif
13735 }
13736
13737
13738
13739
13740
13741
13742
13743
13744
13745
13746
13747
13748
13749
13750
13751
13752
13753
13754 BOOL AttrFourColTranspFill::HasEquivalentDefaultValue(BOOL bAppearance)
13755 {
13756
13757 if (bAppearance)
13758 return (Value.TranspType==TT_NoTranspType || (Value.TranspType==TT_Mix && Value.Transp == 0 && Value.EndTransp==0 && Value.EndTransp2==0 && Value.EndTransp3==0));
13759 else
13760 return FALSE;
13761 }
13762
13763
13764
13765
13767
13768
13769
13771
13772
13773
13774
13775
13776
13777
13778
13779
13780
13781
13782
13783
13784
13785
13786
13787 BOOL AttrBitmapFill::HidingNode()
13788 {
13789
13790 if (!AttrFillGeometry::HidingNode())
13791 return FALSE;
13792
13793 GetBitmapRef()->RemoveFromTree();
13794
13795 return TRUE;
13796 }
13797
13798
13799
13800
13801
13802
13803
13804
13805
13806
13807
13808
13809
13810
13811
13812
13813
13814 BOOL AttrBitmapFill::ShowingNode()
13815 {
13816
13817 if (!AttrFillGeometry::ShowingNode())
13818 return FALSE;
13819
13820 GetBitmapRef()->AddtoTree();
13821
13822 return TRUE;
13823 }
13824
13825
13826
13827
13828
13829
13830
13831
13832
13833
13834
13835
13836
13837
13838
13839
13840
13841
13842
13843
13844
13845
13846
13847
13848
13849
13850
13851
13852
13853
13854
13855
13856
13857
13858
13859
13860
13861
13862
13863
13864
13865
13866
13867
13868
13869
13870
13871
13872
13873
13874
13875
13876
13877
13878
13879
13880
13881
13882
13883
13884
13885
13886
13887
13888
13889
13890
13891
13892
13893
13894
13895
13896
13897
13898
13899
13900
13901
13902
13903
13904
13905
13906
13907
13908
13909
13910
13911
13912
13913
13914
13915
13916
13917
13918
13919
13920 void AttrBitmapFill::Transform( TransformBase& Trans )
13921 {
13922 if ( Trans.TransFills )
13923 {
13924 Trans.Transform( GetStartPoint(), 1);
13925 Trans.Transform( GetEndPoint(), 1);
13926 Trans.Transform( GetEndPoint2(), 1);
13927 Trans.Transform( GetEndPoint3(), 1);
13928
13929
13930 }
13931 }
13932
13933
13934
13935
13936
13937
13938
13939
13940
13941
13942
13943
13944
13945 void AttrBitmapFill::TransformSelectedControlPoints( TransformBase& Trans, BOOL* isARampBlob )
13946 {
13947 #if !defined(EXCLUDE_FROM_RALPH)
13948 if ( Trans.TransFills )
13949 {
13950 ClickModifiers ClickMods;
13951 ClickMods.Adjust = TRUE;
13952
13953 DocCoord StartPoint = *GetStartPoint();
13954 DocCoord EndPoint = *GetEndPoint();
13955 DocCoord EndPoint2 = *GetEndPoint2();
13956
13957 DocCoord CentrePoint;
13958 DocCoord Drag2Blob;
13959 DocCoord Drag3Blob;
13960
13961 GetBitmapVirtualPoints(StartPoint, EndPoint, EndPoint2,
13962 &CentrePoint, &Drag2Blob, &Drag3Blob);
13963
13964 if (GetStartPoint() && IsSelected(FILLCONTROL_STARTPOINT))
13965 {
13966 Trans.Transform( &CentrePoint, 1);
13967
13968 FillControl Start = FILLCONTROL_STARTPOINT;
13969
13970 OnControlDrag(CentrePoint, Start, ClickMods);
13971 }
13972
13973 if (GetEndPoint() && IsSelected(FILLCONTROL_ENDPOINT))
13974 {
13975 Trans.Transform( &Drag2Blob, 1);
13976
13977 FillControl End = FILLCONTROL_ENDPOINT;
13978
13979 OnControlDrag(Drag2Blob, End, ClickMods);
13980 }
13981 }
13982 #endif
13983 }
13984
13985
13986
13987
13988
13989
13990
13991
13992
13993
13994
13995
13996
13997 BOOL AttrBitmapFill::CanTransform()
13998 {
13999 return TRUE;
14000 }
14001
14002
14003
14004
14005
14006
14007
14008
14009
14010
14011
14012
14013
14014
14015 BOOL AttrBitmapFill::CopyNodeContents( AttrBitmapFill* NodeCopy)
14016 {
14017 ERROR2IF(NodeCopy == NULL, FALSE, "NULL pointer in AttrBitmapFill::CopyNodeContents!");
14018
14019 AttrFillGeometry::CopyNodeContents( NodeCopy );
14020
14021
14022 return TRUE;
14023 }
14024
14025
14026
14027
14028
14029
14030
14031
14032
14033
14034
14035
14036
14037
14038
14039
14040
14041 FillControl AttrBitmapFill::CheckForControlHit(DocCoord &ClickPos)
14042 {
14043 #if !defined(EXCLUDE_FROM_RALPH)
14044 if (!GetApplication()->GetBlobManager()->GetCurrentInterest().Fill || !IsVisible())
14045 return FILLCONTROL_NULL;
14046
14047
14048 FillControl HitControl = FILLCONTROL_NULL;
14049 DocRect BlobRect;
14050
14051 DocCoord StartPoint = *GetStartPoint();
14052 DocCoord EndPoint = *GetEndPoint();
14053 DocCoord EndPoint2 = *GetEndPoint2();
14054
14055
14056
14057
14058
14059
14060
14061
14062
14063
14064 DocCoord CentrePoint;
14065 DocCoord Drag2Blob;
14066 DocCoord Drag3Blob;
14067
14068 GetBitmapVirtualPoints(StartPoint, EndPoint, EndPoint2,
14069 &CentrePoint, &Drag2Blob, &Drag3Blob);
14070
14071
14072 (Camelot.GetBlobManager())->GetBlobRect(CentrePoint, &BlobRect);
14073
14074 if ( BlobRect.ContainsCoord(ClickPos) )
14075 HitControl = FILLCONTROL_STARTPOINT;
14076
14077
14078 (Camelot.GetBlobManager())->GetBlobRect(Drag2Blob, &BlobRect);
14079
14080 if ( BlobRect.ContainsCoord(ClickPos) )
14081 HitControl = FILLCONTROL_ENDPOINT;
14082
14083
14084 (Camelot.GetBlobManager())->GetBlobRect(Drag3Blob, &BlobRect);
14085
14086 if ( BlobRect.ContainsCoord(ClickPos) )
14087 HitControl = FILLCONTROL_SECONDARYPOINT;
14088
14089 return HitControl;
14090 #else
14091 return FILLCONTROL_NULL;
14092 #endif
14093 }
14094
14095
14096
14097
14098
14099
14100
14101
14102
14103
14104
14105
14106
14107
14108 void AttrBitmapFill::OnControlDrag( DocCoord Pos, FillControl& DragControl, ClickModifiers ClickMods)
14109 {
14110 #if !defined(EXCLUDE_FROM_RALPH)
14111
14112 DocCoord StartPoint = *GetStartPoint();
14113 DocCoord EndPoint = *GetEndPoint();
14114 DocCoord EndPoint2 = *GetEndPoint2();
14115
14116 DocCoord CentrePoint;
14117 DocCoord Drag2Blob;
14118 DocCoord Drag3Blob;
14119
14120
14121
14122
14123
14124
14125
14126
14127
14128
14129 GetBitmapVirtualPoints(StartPoint, EndPoint, EndPoint2,
14130 &CentrePoint, &Drag2Blob, &Drag3Blob);
14131
14132 INT32 dx, dy;
14133
14134
14135 switch (DragControl)
14136 {
14137 case FILLCONTROL_STARTPOINT:
14138
14139
14140 dx = CentrePoint.x - Pos.x;
14141 dy = CentrePoint.y - Pos.y;
14142
14143 Drag2Blob.translate(-dx, -dy);
14144 Drag3Blob.translate(-dx, -dy);
14145 CentrePoint = Pos;
14146 break;
14147
14148 case FILLCONTROL_ENDPOINT:
14149
14150
14151
14152 if (ClickMods.Constrain)
14153 DocView::ConstrainToAngle(CentrePoint, &Pos);
14154
14155 if (ClickMods.Adjust)
14156 {
14157
14158 double OldLen = CentrePoint.Distance(Drag2Blob);
14159 double NewLen = CentrePoint.Distance(Pos);
14160 double Ratio = 1.0;
14161
14162 if (OldLen == 0)
14163 Ratio = 0;
14164 else
14165 Ratio = NewLen/OldLen;
14166
14167
14168 Drag3Blob =
14169 MakeLineAtAngle(CentrePoint, Pos, 90, INT32(CentrePoint.Distance(Drag3Blob) * Ratio));
14170 }
14171
14172 Drag2Blob = Pos;
14173 break;
14174
14175 case FILLCONTROL_SECONDARYPOINT:
14176
14177
14178
14179 if (ClickMods.Constrain)
14180 DocView::ConstrainToAngle(CentrePoint, &Pos);
14181
14182 if (ClickMods.Adjust)
14183 {
14184
14185 double OldLen = CentrePoint.Distance(Drag3Blob);
14186 double NewLen = CentrePoint.Distance(Pos);
14187 double Ratio = 1.0;
14188
14189 if (OldLen == 0)
14190 Ratio = 0;
14191 else
14192 Ratio = NewLen/OldLen;
14193
14194
14195 Drag2Blob =
14196 MakeLineAtAngle(CentrePoint, Pos, -90, INT32(CentrePoint.Distance(Drag2Blob) * Ratio));
14197 }
14198
14199 Drag3Blob = Pos;
14200 break;
14201 }
14202
14203
14204
14205 TRACEUSER( "Mike", _T("Centre at %d,%d\n"), CentrePoint.x, CentrePoint.y);
14206
14207 GetBitmapRealPoints(CentrePoint, Drag2Blob, Drag3Blob,
14208 &StartPoint, &EndPoint, &EndPoint2);
14209
14210
14211 SetStartPoint(&StartPoint);
14212 SetEndPoint(&EndPoint);
14213 SetEndPoint2(&EndPoint2);
14214 #endif
14215 }
14216
14217 void AttrBitmapFill::SetAspectRatio(double Ratio)
14218 {
14219 #if !defined(EXCLUDE_FROM_RALPH)
14220
14221 DocCoord StartPoint = *GetStartPoint();
14222 DocCoord EndPoint = *GetEndPoint();
14223 DocCoord EndPoint2 = *GetEndPoint2();
14224
14225 DocCoord CentrePoint;
14226 DocCoord Drag2Blob;
14227 DocCoord Drag3Blob;
14228
14229 GetBitmapVirtualPoints(StartPoint, EndPoint, EndPoint2,
14230 &CentrePoint, &Drag2Blob, &Drag3Blob);
14231
14232 Drag3Blob = MakeLineAtAngle(CentrePoint,
14233 Drag2Blob,
14234 90,
14235 INT32(CentrePoint.Distance(Drag2Blob) * Ratio)
14236 );
14237
14238 GetBitmapRealPoints(CentrePoint, Drag2Blob, Drag3Blob,
14239 &StartPoint, &EndPoint, &EndPoint2);
14240
14241
14242 SetStartPoint(&StartPoint);
14243 SetEndPoint(&EndPoint);
14244 SetEndPoint2(&EndPoint2);
14245 #endif
14246 }
14247
14248
14249
14250
14251
14252
14253
14254
14255
14256
14257
14258
14259 void AttrBitmapFill::ValidateAttributeValue()
14260 {
14261 #if !defined(EXCLUDE_FROM_RALPH)
14262 if ((*GetStartPoint()) != DocCoord(0,0) && (*GetEndPoint()) != DocCoord(0,0) &&
14263 (*GetEndPoint2()) != DocCoord(0,0))
14264 return;
14265
14266
14267 DocRect AttrBounds = DocRect(0,0,0,0);
14268
14269 INT32 Width = DEFAULT_FILLWIDTH;
14270 INT32 Height = DEFAULT_FILLHEIGHT;
14271
14272
14273 if (FindParent() != NULL)
14274 {
14275
14276 SelRange* Selected = GetApplication()->FindSelection();
14277
14278 if (Selected == NULL || Selected->Count() <= 1)
14279 AttrBounds = ((NodeRenderableBounded*)FindParent())->GetBoundingRect(TRUE);
14280 else
14281 AttrBounds = Selected->GetBoundingRect();
14282
14283 Width = AttrBounds.Width();
14284 Height = AttrBounds.Height();
14285 }
14286
14287 BitmapInfo Info;
14288 BOOL GotBitmap = FALSE;
14289
14290
14291 KernelBitmap* KerBmp = ((FillGeometryAttribute*)GetAttributeValue())->GetBitmap();
14292
14293 if (KerBmp && KerBmp->ActualBitmap)
14294 GotBitmap = KerBmp->ActualBitmap->GetInfo( &Info );
14295
14296
14297 INT32 BitmapWidth = (GotBitmap ? Info.RecommendedWidth : Width );
14298 INT32 BitmapHeight = (GotBitmap ? Info.RecommendedHeight : Height );
14299
14300
14301 DocCoord Centre = CentreOf(AttrBounds);
14302
14303
14304 DocCoord StartPoint = *GetStartPoint();
14305 DocCoord EndPoint = *GetEndPoint();
14306 DocCoord EndPoint2 = *GetEndPoint2();
14307
14308
14309 if (StartPoint == DocCoord(0,0))
14310 {
14311
14312 StartPoint = DocCoord(Centre.x - BitmapWidth/2, Centre.y - BitmapHeight/2);
14313
14314 EndPoint = DocCoord(StartPoint.x + BitmapWidth, StartPoint.y);
14315
14316 EndPoint2 = DocCoord(StartPoint.x, StartPoint.y + BitmapHeight);
14317 }
14318
14319
14320 if (EndPoint == DocCoord(0,0))
14321 {
14322 EndPoint = DocCoord(StartPoint.x + BitmapWidth, StartPoint.y);
14323 EndPoint2 = DocCoord(StartPoint.x, StartPoint.y + BitmapHeight);
14324 }
14325
14326
14327 if (EndPoint2 == DocCoord(0,0))
14328 {
14329 EndPoint2 = DocCoord(StartPoint.x, StartPoint.y + BitmapHeight);
14330 }
14331
14332
14333 SetStartPoint(&StartPoint);
14334 SetEndPoint(&EndPoint);
14335 SetEndPoint2(&EndPoint2);
14336 #endif
14337 }
14338
14339
14340
14341
14342
14343
14344
14345
14346
14347
14348
14349
14350
14351
14352
14353
14354
14355
14356 void AttrBitmapFill::RenderFillMesh(RenderRegion* pRender,
14357 DocCoord* ControlPoints, BOOL* SelState,
14358 INT32 NumControlPoints)
14359 {
14360 #if !defined(EXCLUDE_FROM_RALPH)
14361 DocCoord StartPoint = ControlPoints[FILLCONTROL_STARTPOINT];
14362 DocCoord EndPoint = ControlPoints[FILLCONTROL_ENDPOINT];
14363
14364 if (StartPoint == EndPoint)
14365 return;
14366
14367 if (SelState == NULL)
14368 {
14369
14370
14371 BOOL Selected[NUMCONTROLPOINTS];
14372 for (INT32 i=0; i< NumControlPoints; i++)
14373 {
14374 Selected[i] = FALSE;
14375 }
14376 SelState = Selected;
14377 }
14378
14379 DocCoord EndPoint2 = ControlPoints[FILLCONTROL_SECONDARYPOINT];
14380
14381 DocCoord Start;
14382 DocCoord End;
14383 DocCoord End2;
14384
14385
14386 GetBitmapVirtualPoints(StartPoint, EndPoint, EndPoint2,
14387 &Start, &End, &End2);
14388
14389
14390 pRender->SaveContext();
14391
14392
14393 INT32 BlobSize = (Camelot.GetBlobManager())->GetBlobSize();
14394
14395
14396 Path ArrowPath;
14397 ArrowPath.Initialise();
14398 DocCoord LineEnd;
14399 MakeMeshArrow(&ArrowPath, Start, End, &LineEnd);
14400
14401
14402 Path ArrowPath2;
14403 ArrowPath2.Initialise();
14404 DocCoord LineEnd2;
14405 MakeMeshArrow(&ArrowPath2, Start, End2, &LineEnd2);
14406
14407
14408 pRender->SetLineWidth(0);
14409 pRender->SetLineColour(COLOUR_UNSELECTEDBLOB);
14410 pRender->SetFillColour(COLOUR_UNSELECTEDBLOB);
14411
14412
14413 pRender->SetLineWidth(BlobSize/4);
14414 pRender->DrawLine(Start, LineEnd);
14415
14416
14417 pRender->DrawLine(Start, LineEnd2);
14418
14419
14420 pRender->SetLineWidth(0);
14421 pRender->SetLineColour(COLOUR_NONE);
14422 pRender->DrawPath(&ArrowPath);
14423
14424
14425 pRender->DrawPath(&ArrowPath2);
14426
14427 if (DraggedFill == this)
14428 {
14429
14430
14431 pRender->SetLineColour(COLOUR_SELECTEDBLOB);
14432 pRender->SetFillColour(COLOUR_NONE);
14433
14434 Path ParaPath;
14435 ParaPath.Initialise();
14436 MakeMeshParallelagram(&ParaPath, Start, End, End2);
14437
14438
14439 pRender->DrawPath(&ParaPath);
14440 }
14441
14442
14443 pRender->RestoreContext();
14444 #endif
14445 }
14446
14447
14448
14449
14450
14451
14452
14453
14454
14455
14456
14457
14458
14459
14460 DocRect AttrBitmapFill::GetBlobBoundingRect()
14461 {
14462 #if !defined(EXCLUDE_FROM_RALPH)
14463
14464
14465
14466 if ( (!GetApplication()->GetBlobManager()->GetCurrentInterest(TRUE).Fill || !IsVisible()) && DraggedFill != this )
14467 return DocRect(0,0, 0,0);
14468
14469
14470 DocCoord StartPoint = *GetStartPoint();
14471 DocCoord EndPoint = *GetEndPoint();
14472 DocCoord EndPoint2 = *GetEndPoint2();
14473
14474
14475 GetBitmapVirtualPoints(StartPoint, EndPoint, EndPoint2,
14476 &StartPoint, &EndPoint, &EndPoint2);
14477
14478
14479 DocRect BoundingRect(StartPoint, StartPoint);
14480
14481 if (DraggedFill == this)
14482 {
14483
14484
14485 DocRect StartBlobRect;
14486 DocRect EndBlobRect;
14487 DocRect DragRect = GetParallelagramBounds(StartPoint, EndPoint, EndPoint2);
14488
14489
14490 (Camelot.GetBlobManager())->GetBlobRect(DragRect.lo, &StartBlobRect);
14491 (Camelot.GetBlobManager())->GetBlobRect(DragRect.hi, &EndBlobRect);
14492
14493
14494
14495
14496 BoundingRect.IncludePoint(StartBlobRect.lo);
14497 BoundingRect.IncludePoint(StartBlobRect.hi);
14498 BoundingRect.IncludePoint(EndBlobRect.lo);
14499 BoundingRect.IncludePoint(EndBlobRect.hi);
14500 }
14501 else
14502 {
14503
14504 DocRect StartBlobRect;
14505 DocRect EndBlobRect;
14506 DocRect End2BlobRect;
14507
14508
14509 (Camelot.GetBlobManager())->GetBlobRect(StartPoint, &StartBlobRect);
14510 (Camelot.GetBlobManager())->GetBlobRect(EndPoint, &EndBlobRect);
14511 (Camelot.GetBlobManager())->GetBlobRect(EndPoint2, &End2BlobRect);
14512
14513
14514
14515
14516 BoundingRect.IncludePoint(StartBlobRect.lo);
14517 BoundingRect.IncludePoint(StartBlobRect.hi);
14518 BoundingRect.IncludePoint(EndBlobRect.lo);
14519 BoundingRect.IncludePoint(EndBlobRect.hi);
14520 BoundingRect.IncludePoint(End2BlobRect.lo);
14521 BoundingRect.IncludePoint(End2BlobRect.hi);
14522 }
14523
14524 IncludeArrowHead(&BoundingRect, StartPoint, EndPoint);
14525 IncludeArrowHead(&BoundingRect, StartPoint, EndPoint2);
14526
14527
14528 return BoundingRect;
14529 #else
14530 return DocRect(0,0,0,0);
14531 #endif
14532 }
14533
14534
14535
14536
14537
14538
14539
14540
14541
14542
14543
14544 void AttrBitmapFill::DrawEndBlobs()
14545 {
14546 #if !defined(EXCLUDE_FROM_RALPH)
14547 Node *pNode = this;
14548 while ((pNode != NULL) && !pNode->IsKindOf(CC_RUNTIME_CLASS(Spread)))
14549 pNode = pNode->FindParent();
14550
14551 if (pNode == NULL)
14552 return;
14553
14554 Spread* pSpread = (Spread*)pNode;
14555
14556 DocRect Bounds = GetBlobBoundingRect();
14557
14558 DocCoord Start = *GetStartPoint();
14559 DocCoord End = *GetEndPoint();
14560 DocCoord End2 = *GetEndPoint2();
14561
14562 GetBitmapVirtualPoints(Start, End, End2,
14563 &Start, &End, &End2);
14564
14565 RenderRegion* pRender = DocView::RenderOnTop(&Bounds, pSpread, UnclippedEOR);
14566 while (pRender)
14567 {
14568
14569 if (IsSelected(FILLCONTROL_STARTPOINT))
14570 {
14571
14572
14573 pRender->SetLineColour(COLOUR_NONE);
14574 pRender->SetFillColour(COLOUR_SELECTEDBLOB);
14575 pRender->DrawBlob(Start, BT_SELECTED);
14576 }
14577 else
14578 {
14579
14580
14581 pRender->SetLineColour(COLOUR_NONE);
14582 pRender->SetFillColour(COLOUR_UNSELECTEDBLOB);
14583 pRender->DrawBlob(Start, BT_UNSELECTED);
14584 }
14585
14586
14587 if (IsSelected(FILLCONTROL_ENDPOINT))
14588 {
14589
14590
14591 pRender->SetLineColour(COLOUR_NONE);
14592 pRender->SetFillColour(COLOUR_SELECTEDBLOB);
14593 pRender->DrawBlob(End, BT_SELECTED);
14594 pRender->DrawBlob(End2, BT_SELECTED);
14595 }
14596 else
14597 {
14598
14599
14600 pRender->SetLineColour(COLOUR_NONE);
14601 pRender->SetFillColour(COLOUR_UNSELECTEDBLOB);
14602 pRender->DrawBlob(End, BT_UNSELECTED);
14603 pRender->DrawBlob(End2, BT_UNSELECTED);
14604 }
14605
14606
14607 pRender = DocView::GetNextOnTop(&Bounds);
14608 }
14609
14610
14611 AttrFillGeometry::LastRenderedMesh = NULL;
14612 #endif
14613 }
14614
14615
14616
14617
14618
14619
14620
14621
14622
14623
14624
14625
14626
14627
14628
14629
14630
14631
14632
14633
14634
14635
14636
14637
14638 DocRect AttrBitmapFill::ValidateExtend(const ExtendParams& ExtParams)
14639 {
14640
14641
14642
14643 DocCoord doccArray[1] = { FindExtendCentre() };
14644 return Extender::ValidateControlPoints(1, doccArray, ExtParams);
14645
14646 }
14647
14648
14649
14650
14651
14652
14653
14654
14655
14656
14657
14658
14659
14660
14661
14662
14663
14664 void AttrBitmapFill::Extend(const ExtendParams& ExtParams)
14665 {
14666
14667
14668
14669
14670
14671
14672
14673 Node* pParent = FindParent();
14674 if (pParent != NULL)
14675 if (pParent->IsNodePath() || pParent->IsCompound())
14676 TransformTranslateObject(ExtParams);
14677
14678
14679
14680
14681
14682
14683
14684
14685
14686
14687
14688
14689 ExtendParams eps = ExtParams;
14690 eps.xscale = 1 / eps.xscale;
14691 eps.yscale = 1 / eps.yscale;
14692 eps.doccScaleStart = ExtParams.doccScaleEnd;
14693 eps.doccScaleEnd = ExtParams.doccScaleEnd;
14694 TransformStretchObject(eps);
14695 }
14696
14697
14698
14699
14700
14701
14702
14703
14704
14705
14706
14707
14708
14709
14710
14711
14712
14713
14714
14715
14716
14717
14718 void AttrBitmapFill::TransformTranslateObject(const ExtendParams& ExtParams)
14719 {
14720 DocCoord doccCentre = FindExtendCentre();
14721
14722
14723 if (ExtParams.fExtendFlags & X_EXTEND)
14724 {
14725
14726
14727 Node* pParent = FindParent();
14728 if (pParent != NULL && pParent->IsCompound())
14729 {
14730 Trans2DMatrix baseXoffset(ExtParams.doccOffset.x, 0);
14731 Transform(baseXoffset);
14732 }
14733
14734
14735
14736 if (doccCentre.x > ExtParams.doccEndCentre.x + ExtParams.xincExtendBuffer)
14737 {
14738 Trans2DMatrix translateX(ExtParams.xinc, 0);
14739 Transform(translateX);
14740 }
14741 else if (doccCentre.x < ExtParams.doccEndCentre.x - ExtParams.xdecExtendBuffer)
14742 {
14743 Trans2DMatrix translateX(-ExtParams.xdec, 0);
14744 Transform(translateX);
14745 }
14746 }
14747
14748
14749 if (ExtParams.fExtendFlags & Y_EXTEND)
14750 {
14751
14752
14753 Node* pParent = FindParent();
14754 if (pParent != NULL && pParent->IsCompound())
14755 {
14756 Trans2DMatrix baseYoffset(0, ExtParams.doccOffset.y);
14757 Transform(baseYoffset);
14758 }
14759
14760
14761 if (doccCentre.y > ExtParams.doccEndCentre.y + ExtParams.yincExtendBuffer)
14762 {
14763 Trans2DMatrix translateY(0, ExtParams.yinc);
14764 Transform(translateY);
14765 }
14766 else if (doccCentre.y < ExtParams.doccEndCentre.y - ExtParams.ydecExtendBuffer)
14767 {
14768 Trans2DMatrix translateY(0, -ExtParams.ydec);
14769 Transform(translateY);
14770 }
14771 }
14772 }
14773
14774
14775
14777
14778
14779
14781
14782
14783
14784
14785
14786
14787
14788
14789
14790
14791
14792 void AttrBitmapColourFill::Render(RenderRegion* pRender)
14793 {
14794 pRender->SetFillGeometry(&Value, FALSE);
14795 }
14796
14797
14798
14799
14800
14801
14802
14803
14804
14805
14806
14807
14808
14809
14810
14811
14812 Node* AttrBitmapColourFill::SimpleCopy()
14813 {
14814 AttrBitmapColourFill* NodeCopy = new AttrBitmapColourFill();
14815 if (NodeCopy == NULL)
14816 return NULL;
14817
14818 CopyNodeContents(NodeCopy);
14819
14820 return NodeCopy;
14821 }
14822
14823
14824
14825
14826
14827
14828
14829
14830
14831
14832
14833
14834 UINT32 AttrBitmapColourFill::GetAttrNameID(void)
14835 {
14836 return (_R(IDS_BITMAPFILL));
14837 }
14838
14839
14840
14841
14842
14843
14844
14845
14846
14847
14848
14849
14850 void AttrBitmapColourFill::GetDebugDetails(StringBase* Str)
14851 {
14852 #ifdef _DEBUG
14853 NodeAttribute::GetDebugDetails( Str );
14854
14855 String_256 TempStr;
14856
14857 TempStr._MakeMsg( TEXT("\r\nBitmap Fill:\r\n"));
14858 (*Str) += TempStr;
14859
14860 TempStr._MakeMsg(TEXT("\r\nStart = (#1%ld, #2%ld)"),
14861 (*GetStartPoint()).x, (*GetStartPoint()).y);
14862 (*Str) += TempStr;
14863
14864 TempStr._MakeMsg(TEXT("\r\nEnd = (#1%ld, #2%ld) "),
14865 (*GetEndPoint()).x, (*GetEndPoint()).y);
14866 (*Str) += TempStr;
14867
14868 TempStr._MakeMsg(TEXT("\r\n3rd = (#1%ld, #2%ld) "),
14869 (*GetEndPoint2()).x, (*GetEndPoint2()).y);
14870 (*Str) += TempStr;
14871
14872 BitmapInfo Info;
14873 KernelBitmap* KerBmp = ((BitmapFillAttribute*)GetAttributeValue())->GetBitmap();
14874
14875 if (KerBmp && KerBmp->ActualBitmap && KerBmp->ActualBitmap->GetInfo( &Info ) )
14876 {
14877 TempStr._MakeMsg( _T("\r\nBits = (#1%ux#2%ux#3%u) "), Info.PixelWidth,
14878 Info.PixelHeight,
14879 Info.PixelDepth
14880 );
14881 (*Str) += TempStr;
14882 }
14883 #endif
14884 }
14885
14886
14887
14888
14889
14890
14891
14892
14893
14894
14895
14896
14897
14898 UINT32 AttrBitmapColourFill::GetNodeSize() const
14899 {
14900 return sizeof(AttrBitmapColourFill);
14901 }
14902
14903
14904
14905
14906
14907
14908
14909
14910
14911
14912
14913
14914 void AttrBitmapColourFill::RenderFillBlobs(RenderRegion* pRender)
14915 {
14916 #if !defined(EXCLUDE_FROM_RALPH)
14917 if (!IsVisible())
14918 return;
14919
14920
14921
14922 if (IsFillBeingEdited())
14923 return;
14924
14925
14926 if (CheckPreviousFillMesh())
14927 return;
14928
14929 DocCoord ControlPoints[5];
14930 ControlPoints[FILLCONTROL_STARTPOINT] = (*GetStartPoint());
14931 ControlPoints[FILLCONTROL_ENDPOINT] = (*GetEndPoint());
14932 ControlPoints[FILLCONTROL_SECONDARYPOINT] = (*GetEndPoint2());
14933
14934
14935
14936
14937
14938
14939
14940
14941
14942
14943
14944
14945
14946
14947
14948
14949
14950
14951
14952
14953
14954 RenderFillMesh(pRender, ControlPoints, SelectionState, 5);
14955
14956
14957
14958
14959
14960 #endif
14961 }
14962
14963
14964
14965
14966
14967
14968
14969
14970
14971
14972
14973
14974
14975
14976
14977
14978
14979
14980 void AttrBitmapColourFill::RenderFillMesh( RenderRegion* pRender,
14981 DocCoord* ControlPoints, BOOL* SelState,
14982 INT32 NumControlPoints)
14983 {
14984 #if !defined(EXCLUDE_FROM_RALPH)
14985 DocCoord StartPoint = ControlPoints[FILLCONTROL_STARTPOINT];
14986 DocCoord EndPoint = ControlPoints[FILLCONTROL_ENDPOINT];
14987
14988 if (StartPoint == EndPoint)
14989 return;
14990
14991 if (SelState == NULL)
14992 {
14993
14994
14995 BOOL Selected[NUMCONTROLPOINTS];
14996 for (INT32 i=0; i< NumControlPoints; i++)
14997 {
14998 Selected[i] = FALSE;
14999 }
15000 SelState = Selected;
15001 }
15002
15003 DocCoord EndPoint2 = ControlPoints[FILLCONTROL_SECONDARYPOINT];
15004
15005 DocCoord Start;
15006 DocCoord End;
15007 DocCoord End2;
15008
15009
15010 GetBitmapVirtualPoints(StartPoint, EndPoint, EndPoint2,
15011 &Start, &End, &End2);
15012
15013
15014 pRender->SaveContext();
15015
15016
15017 INT32 BlobSize = (Camelot.GetBlobManager())->GetBlobSize();
15018
15019
15020 Path ArrowPath;
15021 ArrowPath.Initialise();
15022 DocCoord LineEnd;
15023 MakeMeshArrow(&ArrowPath, Start, End, &LineEnd);
15024
15025
15026 Path ArrowPath2;
15027 ArrowPath2.Initialise();
15028 DocCoord LineEnd2;
15029 MakeMeshArrow(&ArrowPath2, Start, End2, &LineEnd2);
15030
15031
15032 pRender->SetLineWidth(0);
15033 pRender->SetLineColour(COLOUR_UNSELECTEDBLOB);
15034 pRender->SetFillColour(COLOUR_UNSELECTEDBLOB);
15035
15036
15037 pRender->SetLineWidth(BlobSize/4);
15038 pRender->DrawLine(Start, LineEnd);
15039
15040
15041 pRender->DrawLine(Start, LineEnd2);
15042
15043
15044 pRender->SetLineWidth(0);
15045 pRender->SetLineColour(COLOUR_NONE);
15046 pRender->DrawPath(&ArrowPath);
15047
15048
15049 pRender->DrawPath(&ArrowPath2);
15050
15051 if (DraggedFill == this)
15052 {
15053
15054
15055 pRender->SetLineColour(COLOUR_SELECTEDBLOB);
15056 pRender->SetFillColour(COLOUR_NONE);
15057
15058 Path ParaPath;
15059 ParaPath.Initialise();
15060 MakeMeshParallelagram(&ParaPath, Start, End, End2);
15061
15062
15063 pRender->DrawPath(&ParaPath);
15064 }
15065
15066
15067
15068
15069
15070 if (SelState[FILLCONTROL_STARTPOINT])
15071 {
15072
15073
15074 pRender->SetLineColour(COLOUR_NONE);
15075 pRender->SetFillColour(COLOUR_SELECTEDBLOB);
15076 pRender->DrawBlob(Start, BT_SELECTED);
15077 }
15078 else
15079 {
15080
15081
15082 pRender->SetLineColour(COLOUR_NONE);
15083 pRender->SetFillColour(COLOUR_UNSELECTEDBLOB);
15084 pRender->DrawBlob(Start, BT_UNSELECTED);
15085 }
15086
15087
15088 if (SelState[FILLCONTROL_ENDPOINT])
15089 {
15090
15091
15092 pRender->SetLineColour(COLOUR_NONE);
15093 pRender->SetFillColour(COLOUR_SELECTEDBLOB);
15094 pRender->DrawBlob(End, BT_SELECTED);
15095 pRender->DrawBlob(End2,BT_SELECTED);
15096 }
15097 else
15098 {
15099
15100
15101 pRender->SetLineColour(COLOUR_NONE);
15102 pRender->SetFillColour(COLOUR_UNSELECTEDBLOB);
15103 pRender->DrawBlob(End, BT_UNSELECTED);
15104 pRender->DrawBlob(End2,BT_UNSELECTED);
15105 }
15106
15107
15108
15109 pRender->RestoreContext();
15110 #endif
15111 }
15112
15113
15114
15115
15116
15117
15118
15119
15120
15121
15122
15123
15124
15125 void AttrBitmapColourFill::RenderControl(FillControl Control, BOOL RenderOn)
15126 {
15127 #if !defined(EXCLUDE_FROM_RALPH)
15128 DocRect ControlRect;
15129
15130
15131
15132 NodeRenderable* pParent = (NodeRenderable*)FindParent();
15133
15134 if (pParent == NULL)
15135 return;
15136
15137 if (IsBlobSame(Control))
15138 return;
15139
15140 Spread* pSpread = this->FindParentSpread();
15141
15142 DocCoord StartPoint = *GetStartPoint();
15143 DocCoord EndPoint = *GetEndPoint();
15144 DocCoord EndPoint2 = *GetEndPoint2();
15145
15146 DocCoord CentrePoint;
15147 DocCoord Drag2Blob;
15148 DocCoord Drag3Blob;
15149
15150 GetBitmapVirtualPoints(StartPoint, EndPoint, EndPoint2,
15151 &CentrePoint, &Drag2Blob, &Drag3Blob);
15152
15153 switch (Control)
15154 {
15155 case FILLCONTROL_STARTPOINT:
15156
15157 if (GetStartPoint() != NULL)
15158 {
15159
15160 (Camelot.GetBlobManager())->GetBlobRect(CentrePoint, &ControlRect);
15161 RenderFillControl(RenderOn, &ControlRect, pSpread, pParent);
15162 }
15163 break;
15164
15165 case FILLCONTROL_ENDPOINT:
15166
15167 if (GetEndPoint() != NULL)
15168 {
15169
15170 (Camelot.GetBlobManager())->GetBlobRect(Drag2Blob, &ControlRect);
15171 RenderFillControl(RenderOn, &ControlRect, pSpread, pParent);
15172 }
15173
15174 if (GetEndPoint2() != NULL)
15175 {
15176 (Camelot.GetBlobManager())->GetBlobRect(Drag3Blob, &ControlRect);
15177 RenderFillControl(RenderOn, &ControlRect, pSpread, pParent);
15178 }
15179 break;
15180
15181 case FILLCONTROL_SECONDARYPOINT:
15182
15183 if (GetEndPoint2() != NULL)
15184 {
15185
15186 (Camelot.GetBlobManager())->GetBlobRect(Drag2Blob, &ControlRect);
15187 RenderFillControl(RenderOn, &ControlRect, pSpread, pParent);
15188 }
15189
15190 if (GetEndPoint2() != NULL)
15191 {
15192 (Camelot.GetBlobManager())->GetBlobRect(Drag3Blob, &ControlRect);
15193 RenderFillControl(RenderOn, &ControlRect, pSpread, pParent);
15194 }
15195 break;
15196 }
15197 #endif
15198 }
15199
15200
15201
15202
15203
15204
15205
15206
15207
15208
15209
15210
15211
15212 BOOL AttrBitmapColourFill::ChangeControlColour(AttrColourChange* NewCol)
15213 {
15214 #if !defined(EXCLUDE_FROM_RALPH)
15215
15216 if (SelectionState[FILLCONTROL_STARTPOINT] ||
15217 SelectionState[FILLCONTROL_ENDPOINT])
15218 {
15219 if (GetApplication()->GetBlobManager()->GetCurrentInterest().Fill && IsVisible())
15220 {
15221 KernelBitmap* pBitmap = GetBitmap();
15222 KernelBitmap* pGreyBmp = NodeBitmap::CheckGreyscaleBitmap(pBitmap, _R(IDS_MAKEGREY), _R(IDS_DOGREY));
15223
15224 if (pGreyBmp == NULL)
15225 return FALSE;
15226 }
15227 }
15228
15229 return AttrFillGeometry::ChangeControlColour(NewCol);
15230 #else
15231 return FALSE;
15232 #endif
15233 }
15234
15235
15236
15237
15238
15239
15240
15241
15242
15243
15244
15245
15246
15247
15248
15249
15250 BOOL AttrBitmapColourFill::WritePreChildrenWeb(BaseCamelotFilter* pFilter)
15251 {
15252 #ifdef DO_EXPORT
15253 ERROR2IF(pFilter == NULL,FALSE,"NULL filter param");
15254
15255 BOOL ok = TRUE;
15256
15257
15258 KernelBitmap *pBmp = Value.GetBitmap();
15259 ERROR2IF(pBmp == NULL,FALSE,"CXaraFileNodeBitmap::WriteNodeBitmap pBmp is NULL");
15260
15261
15262 INT32 BitmapRecordRef = pFilter->WriteRecord(pBmp);
15263 ERROR2IF(BitmapRecordRef == 0,FALSE,"CXaraFileNodeBitmap::WriteNodeBitmap BitmapRecordRef is 0");
15264
15265 UINT32 Tag = TAG_BITMAPFILL;
15266 UINT32 TagSize = TAG_BITMAPFILL_SIZE;
15267
15268
15269 DocColour* pStartCol= Value.GetStartColour();
15270 DocColour* pEndCol = Value.GetEndColour();
15271 INT32 StartColRef=0;
15272 INT32 EndColRef=0;
15273
15274 if (pStartCol != NULL && pEndCol != NULL)
15275 {
15276
15277 StartColRef = pFilter->WriteRecord(pStartCol);
15278 EndColRef = pFilter->WriteRecord(pEndCol);
15279
15280 Tag = TAG_CONTONEBITMAPFILL;
15281 TagSize = TAG_CONTONEBITMAPFILL_SIZE;
15282
15283
15284 ok = (StartColRef != 0) && (EndColRef != 0);
15285 }
15286
15287
15288 if (ok) ok = (BitmapRecordRef != 0);
15289
15290 CamelotFileRecord Rec(pFilter,Tag,TagSize);
15291
15292 if (ok) ok = Rec.Init();
15293 if (ok) ok = Rec.WriteCoord(Value.StartPoint);
15294 if (ok) ok = Rec.WriteCoord(Value.EndPoint);
15295 if (ok) ok = Rec.WriteCoord(Value.EndPoint2);
15296
15297 if (Tag == TAG_CONTONEBITMAPFILL)
15298 {
15299 if (ok) ok = Rec.WriteReference(StartColRef);
15300 if (ok) ok = Rec.WriteReference(EndColRef);
15301 }
15302
15303 if (ok) ok = Rec.WriteReference(BitmapRecordRef);
15304 if (ok) ok = Rec.WriteDOUBLE ((double) GetProfile ().GetBias ());
15305 if (ok) ok = Rec.WriteDOUBLE ((double) GetProfile ().GetGain ());
15306 if (ok) ok = pFilter->Write(&Rec);
15307
15308 if (!ok)
15309 pFilter->GotError(_R(IDE_FILE_WRITE_ERROR));
15310
15311 return ok;
15312 #else
15313 return FALSE;
15314 #endif
15315 }
15316
15317
15318
15319
15320 BOOL AttrBitmapColourFill::WritePreChildrenNative(BaseCamelotFilter* pFilter)
15321 {
15322 #ifdef DO_EXPORT
15323 return WritePreChildrenWeb(pFilter);
15324 #else
15325 return FALSE;
15326 #endif
15327 }
15328
15329
15330
15331
15332
15333
15334
15335
15336
15337
15338
15339
15340
15341
15342
15343
15344 BOOL AttrBitmapColourFill::WriteColourDefinitions (BaseCamelotFilter* pFilter)
15345 {
15346
15347 DocColour* pStartCol= Value.GetStartColour();
15348 DocColour* pEndCol = Value.GetEndColour();
15349 INT32 StartColRef, EndColRef;
15350
15351 if (pStartCol != NULL && pEndCol != NULL)
15352 {
15353
15354 StartColRef = pFilter->WriteRecord(pStartCol);
15355 EndColRef = pFilter->WriteRecord(pEndCol);
15356
15357
15358 BOOL ok = ((StartColRef != 0) && (EndColRef != 0));
15359
15360 return (ok);
15361 }
15362
15363 return (TRUE);
15364 }
15365
15366
15368
15369
15370
15372
15373
15374
15375
15376
15377
15378
15379
15380
15381
15382
15383 void AttrBitmapTranspFill::Render(RenderRegion* pRender)
15384 {
15385 pRender->SetTranspFillGeometry(&Value, FALSE);
15386 }
15387
15388
15389
15390
15391
15392
15393
15394
15395
15396
15397
15398
15399
15400
15401
15402
15403 Node* AttrBitmapTranspFill::SimpleCopy()
15404 {
15405 AttrBitmapTranspFill* NodeCopy = new AttrBitmapTranspFill();
15406 if (NodeCopy == NULL)
15407 return NULL;
15408
15409 CopyNodeContents(NodeCopy);
15410
15411 return NodeCopy;
15412 }
15413
15414
15415
15416
15417
15418
15419
15420
15421
15422
15423
15424
15425 UINT32 AttrBitmapTranspFill::GetAttrNameID(void)
15426 {
15427 return (_R(IDS_BITMAPTRANSPFILL));
15428 }
15429
15430
15431
15432
15433
15434
15435
15436
15437
15438
15439
15440
15441 void AttrBitmapTranspFill::GetDebugDetails(StringBase* Str)
15442 {
15443 #ifdef _DEBUG
15444 NodeAttribute::GetDebugDetails( Str );
15445
15446 String_256 TempStr;
15447
15448 TempStr._MakeMsg( TEXT("\r\nBitmap Fill:\r\n"));
15449 (*Str) += TempStr;
15450
15451 TempStr._MakeMsg(TEXT("\r\nStart = (#1%ld, #2%ld)"),
15452 (*GetStartPoint()).x, (*GetStartPoint()).y);
15453 (*Str) += TempStr;
15454
15455 TempStr._MakeMsg(TEXT("\r\nEnd = (#1%ld, #2%ld) "),
15456 (*GetEndPoint()).x, (*GetEndPoint()).y);
15457 (*Str) += TempStr;
15458
15459 TempStr._MakeMsg(TEXT("\r\n3rd = (#1%ld, #2%ld) "),
15460 (*GetEndPoint2()).x, (*GetEndPoint2()).y);
15461 (*Str) += TempStr;
15462
15463 BitmapInfo Info;
15464 KernelBitmap* KerBmp = ((BitmapTranspFillAttribute*)GetAttributeValue())->GetBitmap();
15465
15466 if (KerBmp && KerBmp->ActualBitmap && KerBmp->ActualBitmap->GetInfo( &Info ) )
15467 {
15468 TempStr._MakeMsg( _T("\r\nBits = (#1%ux#2%ux#3%u) "), Info.PixelWidth,
15469 Info.PixelHeight,
15470 Info.PixelDepth
15471 );
15472 (*Str) += TempStr;
15473 }
15474 #endif
15475 }
15476
15477
15478
15479
15480
15481
15482
15483
15484
15485
15486
15487
15488
15489 UINT32 AttrBitmapTranspFill::GetNodeSize() const
15490 {
15491 return sizeof(AttrBitmapTranspFill);
15492 }
15493
15494
15495
15496
15497
15498
15499
15500
15501
15502
15503
15504
15505 void AttrBitmapTranspFill::RenderFillBlobs(RenderRegion* pRender)
15506 {
15507 #if !defined(EXCLUDE_FROM_RALPH)
15508 if (!IsVisible())
15509 return;
15510
15511
15512
15513 if (IsFillBeingEdited())
15514 return;
15515
15516
15517 if (CheckPreviousFillMesh())
15518 return;
15519
15520 DocCoord ControlPoints[5];
15521 ControlPoints[FILLCONTROL_STARTPOINT] = (*GetStartPoint());
15522 ControlPoints[FILLCONTROL_ENDPOINT] = (*GetEndPoint());
15523 ControlPoints[FILLCONTROL_SECONDARYPOINT] = (*GetEndPoint2());
15524
15525
15526 RenderFillMesh(pRender, ControlPoints, SelectionState, 5);
15527
15528
15529
15530
15531
15532 #endif
15533 }
15534
15535 void AttrBitmapTranspFill::RenderFillMesh( RenderRegion* pRender,
15536 DocCoord* ControlPoints, BOOL* SelState,
15537 INT32 NumControlPoints)
15538 {
15539 #if !defined(EXCLUDE_FROM_RALPH)
15540 DocCoord StartPoint = ControlPoints[FILLCONTROL_STARTPOINT];
15541 DocCoord EndPoint = ControlPoints[FILLCONTROL_ENDPOINT];
15542
15543 if (StartPoint == EndPoint)
15544 return;
15545
15546 if (SelState == NULL)
15547 {
15548
15549
15550 BOOL Selected[NUMCONTROLPOINTS];
15551 for (INT32 i=0; i< NumControlPoints; i++)
15552 {
15553 Selected[i] = FALSE;
15554 }
15555 SelState = Selected;
15556 }
15557
15558 DocCoord EndPoint2 = ControlPoints[FILLCONTROL_SECONDARYPOINT];
15559
15560 DocCoord Start;
15561 DocCoord End;
15562 DocCoord End2;
15563
15564
15565 GetBitmapVirtualPoints(StartPoint, EndPoint, EndPoint2,
15566 &Start, &End, &End2);
15567
15568
15569 pRender->SaveContext();
15570
15571
15572 INT32 BlobSize = (Camelot.GetBlobManager())->GetBlobSize();
15573
15574
15575 Path ArrowPath;
15576 ArrowPath.Initialise();
15577 DocCoord LineEnd;
15578 MakeMeshArrow(&ArrowPath, Start, End, &LineEnd);
15579
15580
15581 Path ArrowPath2;
15582 ArrowPath2.Initialise();
15583 DocCoord LineEnd2;
15584 MakeMeshArrow(&ArrowPath2, Start, End2, &LineEnd2);
15585
15586
15587 pRender->SetLineWidth(0);
15588 pRender->SetLineColour(COLOUR_UNSELECTEDBLOB);
15589 pRender->SetFillColour(COLOUR_UNSELECTEDBLOB);
15590
15591
15592 pRender->SetLineWidth(BlobSize/4);
15593 pRender->DrawLine(Start, LineEnd);
15594
15595
15596 pRender->DrawLine(Start, LineEnd2);
15597
15598
15599 pRender->SetLineWidth(0);
15600 pRender->SetLineColour(COLOUR_NONE);
15601 pRender->DrawPath(&ArrowPath);
15602
15603
15604 pRender->DrawPath(&ArrowPath2);
15605
15606 if (DraggedFill == this)
15607 {
15608
15609
15610 pRender->SetLineColour(COLOUR_SELECTEDBLOB);
15611 pRender->SetFillColour(COLOUR_NONE);
15612
15613 Path ParaPath;
15614 ParaPath.Initialise();
15615 MakeMeshParallelagram(&ParaPath, Start, End, End2);
15616
15617
15618 pRender->DrawPath(&ParaPath);
15619 }
15620
15621
15622
15623
15624 if (SelState[FILLCONTROL_STARTPOINT])
15625 {
15626
15627
15628 pRender->SetLineColour(COLOUR_NONE);
15629 pRender->SetFillColour(COLOUR_SELECTEDBLOB);
15630 pRender->DrawBlob(Start, BT_SELECTED);
15631 }
15632 else
15633 {
15634
15635
15636 pRender->SetLineColour(COLOUR_NONE);
15637 pRender->SetFillColour(COLOUR_UNSELECTEDBLOB);
15638 pRender->DrawBlob(Start, BT_UNSELECTED);
15639 }
15640
15641
15642 if (SelState[FILLCONTROL_ENDPOINT])
15643 {
15644
15645
15646 pRender->SetLineColour(COLOUR_NONE);
15647 pRender->SetFillColour(COLOUR_SELECTEDBLOB);
15648 pRender->DrawBlob(End, BT_SELECTED);
15649 pRender->DrawBlob(End2,BT_SELECTED);
15650 }
15651 else
15652 {
15653
15654
15655 pRender->SetLineColour(COLOUR_NONE);
15656 pRender->SetFillColour(COLOUR_UNSELECTEDBLOB);
15657 pRender->DrawBlob(End, BT_UNSELECTED);
15658 pRender->DrawBlob(End2,BT_UNSELECTED);
15659 }
15660
15661
15662 pRender->RestoreContext();
15663 #endif
15664 }
15665
15666 void AttrBitmapTranspFill::RenderControl(FillControl Control, BOOL RenderOn)
15667 {
15668 #if !defined(EXCLUDE_FROM_RALPH)
15669 DocRect ControlRect;
15670
15671
15672
15673 NodeRenderable* pParent = (NodeRenderable*)FindParent();
15674
15675 if (pParent == NULL)
15676 return;
15677
15678 if (IsBlobSame(Control))
15679 return;
15680
15681 Spread* pSpread = this->FindParentSpread();
15682
15683 DocCoord StartPoint = *GetStartPoint();
15684 DocCoord EndPoint = *GetEndPoint();
15685 DocCoord EndPoint2 = *GetEndPoint2();
15686
15687 DocCoord CentrePoint;
15688 DocCoord Drag2Blob;
15689 DocCoord Drag3Blob;
15690
15691 GetBitmapVirtualPoints(StartPoint, EndPoint, EndPoint2,
15692 &CentrePoint, &Drag2Blob, &Drag3Blob);
15693
15694 switch (Control)
15695 {
15696 case FILLCONTROL_STARTPOINT:
15697
15698 if (GetStartPoint() != NULL)
15699 {
15700
15701 (Camelot.GetBlobManager())->GetBlobRect(CentrePoint, &ControlRect);
15702 RenderFillControl(RenderOn, &ControlRect, pSpread, pParent);
15703 }
15704 break;
15705
15706 case FILLCONTROL_ENDPOINT:
15707
15708 if (GetEndPoint() != NULL)
15709 {
15710
15711 (Camelot.GetBlobManager())->GetBlobRect(Drag2Blob, &ControlRect);
15712 RenderFillControl(RenderOn, &ControlRect, pSpread, pParent);
15713 }
15714
15715 if (GetEndPoint2() != NULL)
15716 {
15717 (Camelot.GetBlobManager())->GetBlobRect(Drag3Blob, &ControlRect);
15718 RenderFillControl(RenderOn, &ControlRect, pSpread, pParent);
15719 }
15720 break;
15721
15722 case FILLCONTROL_SECONDARYPOINT:
15723
15724 if (GetEndPoint2() != NULL)
15725 {
15726
15727 (Camelot.GetBlobManager())->GetBlobRect(Drag2Blob, &ControlRect);
15728 RenderFillControl(RenderOn, &ControlRect, pSpread, pParent);
15729 }
15730
15731 if (GetEndPoint2() != NULL)
15732 {
15733 (Camelot.GetBlobManager())->GetBlobRect(Drag3Blob, &ControlRect);
15734 RenderFillControl(RenderOn, &ControlRect, pSpread, pParent);
15735 }
15736 break;
15737 }
15738 #endif
15739 }
15740
15741
15742
15743
15744
15745
15746
15747
15748
15749
15750
15751
15752
15753
15754
15755 BOOL AttrBitmapTranspFill::WritePreChildrenWeb(BaseCamelotFilter* pFilter)
15756 {
15757 #ifdef DO_EXPORT
15758 ERROR2IF(pFilter == NULL,FALSE,"NULL filter param");
15759
15760 BOOL ok = TRUE;
15761
15762
15763 KernelBitmap *pBmp = Value.GetBitmap();
15764 ERROR2IF(pBmp == NULL,FALSE,"CXaraFileNodeBitmap::WriteNodeBitmap pBmp is NULL");
15765
15766
15767 INT32 BitmapRecordRef = pFilter->WriteRecord(pBmp);
15768 ERROR2IF(BitmapRecordRef == 0,FALSE,"CXaraFileNodeBitmap::WriteNodeBitmap BitmapRecordRef is 0");
15769
15770
15771 if (ok) ok = (BitmapRecordRef != 0);
15772
15773 CamelotFileRecord Rec(pFilter,TAG_BITMAPTRANSPARENTFILL,TAG_BITMAPTRANSPARENTFILL_SIZE);
15774
15775 if (ok) ok = Rec.Init();
15776 if (ok) ok = Rec.WriteCoord(Value.StartPoint);
15777 if (ok) ok = Rec.WriteCoord(Value.EndPoint);
15778 if (ok) ok = Rec.WriteCoord(Value.EndPoint2);
15779 if (ok) ok = Rec.WriteBYTE(BYTE(Value.Transp));
15780 if (ok) ok = Rec.WriteBYTE(BYTE(Value.EndTransp));
15781 if (ok) ok = Rec.WriteBYTE(BYTE(Value.TranspType));
15782 if (ok) ok = Rec.WriteReference(BitmapRecordRef);
15783 if (ok) ok = Rec.WriteDOUBLE ((double) GetProfile ().GetBias ());
15784 if (ok) ok = Rec.WriteDOUBLE ((double) GetProfile ().GetGain ());
15785 if (ok) ok = pFilter->Write(&Rec);
15786
15787 if (!ok)
15788 pFilter->GotError(_R(IDE_FILE_WRITE_ERROR));
15789
15790 return ok;
15791 #else
15792 return FALSE;
15793 #endif
15794 }
15795
15796
15797
15798
15799 BOOL AttrBitmapTranspFill::WritePreChildrenNative(BaseCamelotFilter* pFilter)
15800 {
15801 #ifdef DO_EXPORT
15802 return WritePreChildrenWeb(pFilter);
15803 #else
15804 return FALSE;
15805 #endif
15806 }
15807
15808
15809
15810
15811
15812
15813
15814
15815
15816
15817
15818
15819
15820
15821
15822
15823
15824
15825 BOOL AttrBitmapTranspFill::HasEquivalentDefaultValue(BOOL bAppearance)
15826 {
15827
15828 if (bAppearance)
15829 return (Value.TranspType==TT_NoTranspType || (Value.TranspType==TT_Mix && Value.Transp == 0 && Value.EndTransp==0));
15830 else
15831 return FALSE;
15832 }
15833
15834
15835
15836
15838
15839
15840
15842
15843
15844
15845
15846
15847
15848
15849
15850
15851
15852
15853
15854
15855 void AttrFractalFill::Transform( TransformBase& Trans )
15856 {
15857 if ( Trans.TransFills )
15858 {
15859 Trans.Transform( GetStartPoint(), 1);
15860 Trans.Transform( GetEndPoint(), 1);
15861 Trans.Transform( GetEndPoint2(), 1);
15862 Trans.Transform( GetEndPoint3(), 1);
15863
15864
15865
15866 SetFractalDPI(GetDPI());
15867 }
15868 }
15869
15870
15871
15872
15873
15874
15875
15876
15877
15878
15879
15880
15881
15882 BOOL AttrFractalFill::CanTransform()
15883 {
15884 return TRUE;
15885 }
15886
15887
15888
15889
15890
15891
15892
15893
15894
15895
15896
15897
15898
15899
15900 BOOL AttrFractalFill::CopyNodeContents( AttrFractalFill* NodeCopy)
15901 {
15902 ERROR2IF(NodeCopy == NULL, FALSE, "NULL pointer in AttrFractalFill::CopyNodeContents!");
15903
15904 AttrFillGeometry::CopyNodeContents( NodeCopy );
15905
15906
15907 return TRUE;
15908 }
15909
15910
15911
15912
15913
15914
15915
15916
15917
15918
15919
15920
15921
15922
15923
15924
15925 BOOL AttrFractalFill::HidingNode()
15926 {
15927
15928 if (!AttrFillGeometry::HidingNode())
15929 return FALSE;
15930
15931 ((FillGeometryAttribute*)GetAttributeValue())->DetachBitmap();
15932
15933 return TRUE;
15934 }
15935
15936
15937
15938
15939
15940
15941
15942
15943
15944
15945
15946
15947
15948
15949
15950
15951
15952 BOOL AttrFractalFill::ShowingNode()
15953 {
15954
15955 if (!AttrFillGeometry::ShowingNode())
15956 return FALSE;
15957
15958 RecalcFractal();
15959
15960 return TRUE;
15961 }
15962
15963
15964
15965
15966
15967
15968
15969
15970
15971
15972
15973
15974 void AttrFractalFill::ValidateAttributeValue()
15975 {
15976 #if !defined(EXCLUDE_FROM_RALPH)
15977 if ((*GetStartPoint()) != DocCoord(0,0) && (*GetEndPoint()) != DocCoord(0,0) &&
15978 (*GetEndPoint2()) != DocCoord(0,0))
15979 return;
15980
15981
15982 DocRect AttrBounds = DocRect(0,0,0,0);
15983
15984 INT32 Width = DEFAULT_FILLWIDTH;
15985 INT32 Height = DEFAULT_FILLHEIGHT;
15986
15987
15988 if (FindParent() != NULL)
15989 {
15990
15991 SelRange* Selected = GetApplication()->FindSelection();
15992
15993 if (Selected == NULL || Selected->Count() <= 1)
15994 AttrBounds = ((NodeRenderableBounded*)FindParent())->GetBoundingRect(TRUE);
15995 else
15996 AttrBounds = Selected->GetBoundingRect();
15997
15998 Width = AttrBounds.Width();
15999 Height = Width;
16000 }
16001
16002
16003 DocCoord Centre = CentreOf(AttrBounds);
16004
16005
16006 DocCoord StartPoint = *GetStartPoint();
16007 DocCoord EndPoint = *GetEndPoint();
16008 DocCoord EndPoint2 = *GetEndPoint2();
16009
16010 BOOL recalc = FALSE;
16011
16012
16013 if (StartPoint == DocCoord(0,0))
16014 {
16015
16016 StartPoint = DocCoord(Centre.x - Width/2, Centre.y - Height/2);
16017
16018 EndPoint = DocCoord(StartPoint.x + Width, StartPoint.y);
16019
16020 EndPoint2 = DocCoord(StartPoint.x, StartPoint.y + Height);
16021
16022 recalc = TRUE;
16023 }
16024
16025
16026 if (EndPoint == DocCoord(0,0))
16027 {
16028 EndPoint = DocCoord(StartPoint.x + Width, StartPoint.y);
16029 EndPoint2 = DocCoord(StartPoint.x, StartPoint.y + Height);
16030
16031 recalc = TRUE;
16032 }
16033
16034
16035 if (EndPoint2 == DocCoord(0,0))
16036 {
16037 EndPoint2 = DocCoord(StartPoint.x, StartPoint.y + Height);
16038
16039 recalc = TRUE;
16040 }
16041
16042
16043 SetStartPoint(&StartPoint);
16044 SetEndPoint(&EndPoint);
16045 SetEndPoint2(&EndPoint2);
16046
16047 if (recalc)
16048 ((FillGeometryAttribute*)GetAttributeValue())->RecalcFractal();
16049 #endif
16050 }
16051
16052
16053
16054
16055
16056
16057
16058
16059
16060
16061
16062
16063
16064
16065 NodeAttribute* AttrFractalFill::GetOtherAttrToApply(BOOL* IsMutate)
16066 {
16067 #if !defined(EXCLUDE_FROM_RALPH)
16068 ERROR3IF(IsMutate == NULL, "NULL flag pointer passed to GetOtherAttrToApply");
16069
16070
16071
16072 NodeAttribute* OtherAttr = NULL;
16073
16074 BOOL Tileable = GetTileable();
16075
16076 if (GetAttributeType() == CC_RUNTIME_CLASS(AttrFillGeometry))
16077 {
16078 OtherAttr = new AttrFillMappingLinear;
16079 }
16080 else
16081 {
16082 OtherAttr = new AttrTranspFillMappingLinear;
16083 }
16084
16085 if (OtherAttr == NULL)
16086 return NULL;
16087
16088 if (Tileable)
16089 ((AttrFillMappingLinear*)OtherAttr)->SetRepeat(RT_Repeating);
16090 else
16091 ((AttrFillMappingLinear*)OtherAttr)->SetRepeat(RT_RepeatInverted);
16092
16093 *IsMutate = FALSE;
16094
16095 return OtherAttr;
16096 #else
16097 return NULL;
16098 #endif
16099 }
16100
16101 void AttrFractalFill::SetAspectRatio(double Ratio)
16102 {
16103 #if !defined(EXCLUDE_FROM_RALPH)
16104
16105 DocCoord StartPoint = *GetStartPoint();
16106 DocCoord EndPoint = *GetEndPoint();
16107 DocCoord EndPoint2 = *GetEndPoint2();
16108
16109 DocCoord CentrePoint;
16110 DocCoord Drag2Blob;
16111 DocCoord Drag3Blob;
16112
16113 GetBitmapVirtualPoints(StartPoint, EndPoint, EndPoint2,
16114 &CentrePoint, &Drag2Blob, &Drag3Blob);
16115
16116 Drag3Blob = MakeLineAtAngle(CentrePoint,
16117 Drag2Blob,
16118 90,
16119 INT32(CentrePoint.Distance(Drag2Blob) * Ratio)
16120 );
16121
16122 GetBitmapRealPoints(CentrePoint, Drag2Blob, Drag3Blob,
16123 &StartPoint, &EndPoint, &EndPoint2);
16124
16125
16126 SetStartPoint(&StartPoint);
16127 SetEndPoint(&EndPoint);
16128 SetEndPoint2(&EndPoint2);
16129 #endif
16130 }
16131
16132
16133
16135
16136
16137
16139
16140
16141
16142
16143
16144
16145
16146
16147
16148
16149
16150 AttrTextureColourFill::AttrTextureColourFill()
16151 {
16152 }
16153
16154
16155
16156
16157
16158
16159
16160
16161
16162
16163
16164 AttrTextureColourFill::~AttrTextureColourFill()
16165 {
16166 }
16167
16168
16169
16170
16171
16172
16173
16174
16175
16176
16177
16178
16179
16180
16181
16182
16183
16184
16185 Node* AttrTextureColourFill::SimpleCopy()
16186 {
16187 TRACEUSER( "Mike", _T("AttrTextureColourFill::SimpleCopy() called. This should NOT happen."));
16188
16189 AttrTextureColourFill* NodeCopy = new AttrTextureColourFill();
16190 if (NodeCopy == NULL)
16191 return NULL;
16192
16193 CopyNodeContents(NodeCopy);
16194
16195 return NodeCopy;
16196 }
16197
16198
16199
16200
16201
16202
16203
16204
16205
16206
16207
16208
16209
16210 UINT32 AttrTextureColourFill::GetAttrNameID (void)
16211 {
16212 return (_R(IDS_BITMAPFILL));
16213 }
16214
16215
16216
16217 UINT32 AttrFractalColourFill::GetAttrNameID (void)
16218 {
16219 return (_R(IDS_FRACTALCLOUDSGRADFILL));
16220 }
16221
16222 UINT32 AttrNoiseColourFill::GetAttrNameID (void)
16223 {
16224 return (_R(IDS_FRACTALPLASMAGRADFILL));
16225 }
16226
16227
16228
16229
16230
16231
16232
16233
16234
16235
16236
16237
16238
16239
16240 void AttrTextureColourFill::GetDebugDetails(StringBase* Str)
16241 {
16242 #ifdef _DEBUG
16243 NodeAttribute::GetDebugDetails( Str );
16244
16245 String_256 TempStr;
16246
16247 TempStr._MakeMsg( TEXT("\r\nTexture Fill:\r\n"));
16248 (*Str) += TempStr;
16249
16250
16251
16252
16253
16254
16255
16256
16257
16258 TempStr._MakeMsg(TEXT("\r\nStart = (#1%ld, #2%ld)"),
16259 (*GetStartPoint()).x, (*GetStartPoint()).y);
16260 (*Str) += TempStr;
16261
16262 TempStr._MakeMsg(TEXT("\r\nEnd = (#1%ld, #2%ld) "),
16263 (*GetEndPoint()).x, (*GetEndPoint()).y);
16264 (*Str) += TempStr;
16265
16266 TempStr._MakeMsg(TEXT("\r\n3rd = (#1%ld, #2%ld) \n"),
16267 (*GetEndPoint2()).x, (*GetEndPoint2()).y);
16268 (*Str) += TempStr;
16269
16270 #endif
16271 }
16272
16273
16274
16275
16276
16277
16278
16279
16280
16281
16282
16283
16284 void AttrTextureColourFill::Render(RenderRegion* pRender)
16285 {
16286 if (GetBitmap() == NULL || GetBitmap()->ActualBitmap == NULL)
16287 {
16288 if (!RecalcFractal())
16289 return;
16290 }
16291
16292 pRender->SetFillGeometry((ColourFillAttribute*)GetAttributeValue(), FALSE);
16293 }
16294
16295
16296
16297
16298
16299
16300
16301
16302
16303
16304
16305
16306
16307
16308 void AttrTextureColourFill::RenderFillBlobs(RenderRegion* pRender)
16309 {
16310 #if !defined(EXCLUDE_FROM_RALPH)
16311 if (!IsVisible())
16312 return;
16313
16314
16315
16316 if (IsFillBeingEdited())
16317 return;
16318
16319
16320 if (CheckPreviousFillMesh())
16321 return;
16322
16323 DocCoord ControlPoints[5];
16324 ControlPoints[FILLCONTROL_STARTPOINT] = (*GetStartPoint());
16325 ControlPoints[FILLCONTROL_ENDPOINT] = (*GetEndPoint());
16326 ControlPoints[FILLCONTROL_SECONDARYPOINT] = (*GetEndPoint2());
16327
16328
16329 RenderFillMesh(pRender, ControlPoints, SelectionState, 5);
16330
16331
16332
16333
16334
16335 #endif
16336 }
16337
16338
16339
16340
16341
16342
16343
16344
16345
16346
16347
16348
16349
16350
16351
16352
16353
16354 FillControl AttrTextureColourFill::CheckForControlHit(DocCoord &ClickPos)
16355 {
16356 #if !defined(EXCLUDE_FROM_RALPH)
16357 if (!GetApplication()->GetBlobManager()->GetCurrentInterest().Fill || !IsVisible())
16358 return FILLCONTROL_NULL;
16359
16360
16361 FillControl HitControl = FILLCONTROL_NULL;
16362 DocRect BlobRect;
16363
16364 DocCoord StartPoint = *GetStartPoint();
16365 DocCoord EndPoint = *GetEndPoint();
16366 DocCoord EndPoint2 = *GetEndPoint2();
16367
16368
16369
16370
16371
16372
16373
16374
16375
16376
16377 DocCoord CentrePoint;
16378 DocCoord Drag2Blob;
16379 DocCoord Drag3Blob;
16380
16381 GetBitmapVirtualPoints(StartPoint, EndPoint, EndPoint2,
16382 &CentrePoint, &Drag2Blob, &Drag3Blob);
16383
16384
16385 (Camelot.GetBlobManager())->GetBlobRect(CentrePoint, &BlobRect);
16386
16387 if ( BlobRect.ContainsCoord(ClickPos) )
16388 HitControl = FILLCONTROL_STARTPOINT;
16389
16390
16391 (Camelot.GetBlobManager())->GetBlobRect(Drag2Blob, &BlobRect);
16392
16393 if ( BlobRect.ContainsCoord(ClickPos) )
16394 HitControl = FILLCONTROL_ENDPOINT;
16395
16396
16397 (Camelot.GetBlobManager())->GetBlobRect(Drag3Blob, &BlobRect);
16398
16399 if ( BlobRect.ContainsCoord(ClickPos) )
16400 HitControl = FILLCONTROL_SECONDARYPOINT;
16401
16402 return HitControl;
16403 #else
16404 return FILLCONTROL_NULL;
16405 #endif
16406 }
16407
16408
16409
16410
16411
16412
16413
16414
16415
16416
16417
16418
16419
16420
16421
16422 void AttrTextureColourFill::OnControlDrag( DocCoord Pos, FillControl& DragControl, ClickModifiers ClickMods)
16423 {
16424 #if !defined(EXCLUDE_FROM_RALPH)
16425
16426 DocCoord StartPoint = *GetStartPoint();
16427 DocCoord EndPoint = *GetEndPoint();
16428 DocCoord EndPoint2 = *GetEndPoint2();
16429
16430 DocCoord CentrePoint;
16431 DocCoord Drag2Blob;
16432 DocCoord Drag3Blob;
16433
16434
16435
16436
16437
16438
16439
16440
16441
16442
16443 GetBitmapVirtualPoints(StartPoint, EndPoint, EndPoint2,
16444 &CentrePoint, &Drag2Blob, &Drag3Blob);
16445
16446 INT32 dx, dy;
16447
16448
16449 switch (DragControl)
16450 {
16451 case FILLCONTROL_STARTPOINT:
16452
16453
16454 dx = CentrePoint.x - Pos.x;
16455 dy = CentrePoint.y - Pos.y;
16456
16457 Drag2Blob.translate(-dx, -dy);
16458 Drag3Blob.translate(-dx, -dy);
16459 CentrePoint = Pos;
16460 break;
16461
16462 case FILLCONTROL_ENDPOINT:
16463
16464
16465
16466 if (ClickMods.Constrain)
16467 DocView::ConstrainToAngle(CentrePoint, &Pos);
16468
16469 if (ClickMods.Adjust)
16470 {
16471
16472 double OldLen = CentrePoint.Distance(Drag2Blob);
16473 double NewLen = CentrePoint.Distance(Pos);
16474 double Ratio = 1.0;
16475
16476 if (OldLen == 0)
16477 Ratio = 0;
16478 else
16479 Ratio = NewLen/OldLen;
16480
16481
16482 Drag3Blob =
16483 MakeLineAtAngle(CentrePoint, Pos, 90, INT32(CentrePoint.Distance(Drag3Blob) * Ratio));
16484 }
16485
16486 Drag2Blob = Pos;
16487 break;
16488
16489 case FILLCONTROL_SECONDARYPOINT:
16490
16491
16492
16493 if (ClickMods.Constrain)
16494 DocView::ConstrainToAngle(CentrePoint, &Pos);
16495
16496 if (ClickMods.Adjust)
16497 {
16498
16499 double OldLen = CentrePoint.Distance(Drag3Blob);
16500 double NewLen = CentrePoint.Distance(Pos);
16501 double Ratio = 1.0;
16502
16503 if (OldLen == 0)
16504 Ratio = 0;
16505 else
16506 Ratio = NewLen/OldLen;
16507
16508
16509 Drag2Blob =
16510 MakeLineAtAngle(CentrePoint, Pos, -90, INT32(CentrePoint.Distance(Drag2Blob) * Ratio));
16511 }
16512
16513 Drag3Blob = Pos;
16514 break;
16515 }
16516
16517
16518
16519
16520 GetBitmapRealPoints(CentrePoint, Drag2Blob, Drag3Blob,
16521 &StartPoint, &EndPoint, &EndPoint2);
16522
16523
16524 SetStartPoint(&StartPoint);
16525 SetEndPoint(&EndPoint);
16526 SetEndPoint2(&EndPoint2);
16527 #endif
16528 }
16529
16530
16531
16532
16533
16534
16535
16536
16537
16538
16539
16540
16541
16542
16543 void AttrTextureColourFill::RenderControl(FillControl Control, BOOL RenderOn)
16544 {
16545 #if !defined(EXCLUDE_FROM_RALPH)
16546 DocRect ControlRect;
16547
16548
16549
16550 NodeRenderable* pParent = (NodeRenderable*)FindParent();
16551
16552 if (pParent == NULL)
16553 return;
16554
16555 if (IsBlobSame(Control))
16556 return;
16557
16558 Spread* pSpread = this->FindParentSpread();
16559
16560 DocCoord StartPoint = *GetStartPoint();
16561 DocCoord EndPoint = *GetEndPoint();
16562 DocCoord EndPoint2 = *GetEndPoint2();
16563
16564 DocCoord CentrePoint;
16565 DocCoord Drag2Blob;
16566 DocCoord Drag3Blob;
16567
16568 GetBitmapVirtualPoints(StartPoint, EndPoint, EndPoint2,
16569 &CentrePoint, &Drag2Blob, &Drag3Blob);
16570
16571 switch (Control)
16572 {
16573 case FILLCONTROL_STARTPOINT:
16574
16575 if (GetStartPoint() != NULL)
16576 {
16577
16578 (Camelot.GetBlobManager())->GetBlobRect(CentrePoint, &ControlRect);
16579 RenderFillControl(RenderOn, &ControlRect, pSpread, pParent);
16580 }
16581 break;
16582
16583 case FILLCONTROL_ENDPOINT:
16584
16585 if (GetEndPoint() != NULL)
16586 {
16587
16588 (Camelot.GetBlobManager())->GetBlobRect(Drag2Blob, &ControlRect);
16589 RenderFillControl(RenderOn, &ControlRect, pSpread, pParent);
16590 }
16591
16592 if (GetEndPoint2() != NULL)
16593 {
16594 (Camelot.GetBlobManager())->GetBlobRect(Drag3Blob, &ControlRect);
16595 RenderFillControl(RenderOn, &ControlRect, pSpread, pParent);
16596 }
16597 break;
16598
16599 case FILLCONTROL_SECONDARYPOINT:
16600
16601 if (GetEndPoint2() != NULL)
16602 {
16603
16604 (Camelot.GetBlobManager())->GetBlobRect(Drag2Blob, &ControlRect);
16605 RenderFillControl(RenderOn, &ControlRect, pSpread, pParent);
16606 }
16607
16608 if (GetEndPoint2() != NULL)
16609 {
16610 (Camelot.GetBlobManager())->GetBlobRect(Drag3Blob, &ControlRect);
16611 RenderFillControl(RenderOn, &ControlRect, pSpread, pParent);
16612 }
16613 break;
16614 }
16615 #endif
16616 }
16617
16618
16619
16620
16621
16622
16623
16624
16625
16626
16627
16628
16629
16630
16631
16632
16633
16634
16635
16636
16637 void AttrTextureColourFill::RenderFillMesh(RenderRegion* pRender,
16638 DocCoord* ControlPoints, BOOL* SelState,
16639 INT32 NumControlPoints)
16640 {
16641 #if !defined(EXCLUDE_FROM_RALPH)
16642 DocCoord StartPoint = ControlPoints[FILLCONTROL_STARTPOINT];
16643 DocCoord EndPoint = ControlPoints[FILLCONTROL_ENDPOINT];
16644
16645 if (StartPoint == EndPoint)
16646 return;
16647
16648 if (SelState == NULL)
16649 {
16650
16651
16652 BOOL Selected[NUMCONTROLPOINTS];
16653 for (INT32 i=0; i< NumControlPoints; i++)
16654 {
16655 Selected[i] = FALSE;
16656 }
16657 SelState = Selected;
16658 }
16659
16660 DocCoord EndPoint2 = ControlPoints[FILLCONTROL_SECONDARYPOINT];
16661
16662 DocCoord Start;
16663 DocCoord End;
16664 DocCoord End2;
16665
16666
16667 GetBitmapVirtualPoints(StartPoint, EndPoint, EndPoint2,
16668 &Start, &End, &End2);
16669
16670
16671 pRender->SaveContext();
16672
16673
16674 INT32 BlobSize = (Camelot.GetBlobManager())->GetBlobSize();
16675
16676
16677 Path ArrowPath;
16678 ArrowPath.Initialise();
16679 DocCoord LineEnd;
16680 MakeMeshArrow(&ArrowPath, Start, End, &LineEnd);
16681
16682
16683 Path ArrowPath2;
16684 ArrowPath2.Initialise();
16685 DocCoord LineEnd2;
16686 MakeMeshArrow(&ArrowPath2, Start, End2, &LineEnd2);
16687
16688
16689 pRender->SetLineWidth(0);
16690 pRender->SetLineColour(COLOUR_UNSELECTEDBLOB);
16691 pRender->SetFillColour(COLOUR_UNSELECTEDBLOB);
16692
16693
16694 pRender->SetLineWidth(BlobSize/4);
16695 pRender->DrawLine(Start, LineEnd);
16696
16697
16698 pRender->DrawLine(Start, LineEnd2);
16699
16700
16701 pRender->SetLineWidth(0);
16702 pRender->SetLineColour(COLOUR_NONE);
16703 pRender->DrawPath(&ArrowPath);
16704
16705
16706 pRender->DrawPath(&ArrowPath2);
16707
16708 if (DraggedFill == this)
16709 {
16710
16711
16712 pRender->SetLineColour(COLOUR_SELECTEDBLOB);
16713 pRender->SetFillColour(COLOUR_NONE);
16714
16715 Path ParaPath;
16716 ParaPath.Initialise();
16717 MakeMeshParallelagram(&ParaPath, Start, End, End2);
16718
16719
16720 pRender->DrawPath(&ParaPath);
16721 }
16722
16723
16724
16725
16726 if (SelState[FILLCONTROL_STARTPOINT])
16727 {
16728
16729
16730 pRender->SetLineColour(COLOUR_NONE);
16731 pRender->SetFillColour(COLOUR_SELECTEDBLOB);
16732 pRender->DrawBlob(Start, BT_SELECTED);
16733 }
16734 else
16735 {
16736
16737
16738 pRender->SetLineColour(COLOUR_NONE);
16739 pRender->SetFillColour(COLOUR_UNSELECTEDBLOB);
16740 pRender->DrawBlob(Start, BT_UNSELECTED);
16741 }
16742
16743
16744 if (SelState[FILLCONTROL_ENDPOINT])
16745 {
16746
16747
16748 pRender->SetLineColour(COLOUR_NONE);
16749 pRender->SetFillColour(COLOUR_SELECTEDBLOB);
16750 pRender->DrawBlob(End, BT_SELECTED);
16751 pRender->DrawBlob(End2,BT_SELECTED);
16752 }
16753 else
16754 {
16755
16756
16757 pRender->SetLineColour(COLOUR_NONE);
16758 pRender->SetFillColour(COLOUR_UNSELECTEDBLOB);
16759 pRender->DrawBlob(End, BT_UNSELECTED);
16760 pRender->DrawBlob(End2,BT_UNSELECTED);
16761 }
16762
16763
16764 pRender->RestoreContext();
16765 #endif
16766 }
16767
16768
16769
16770
16771
16772
16773
16774
16775
16776
16777
16778
16779
16780
16781
16782
16783
16785
16786
16787
16789
16790
16791
16792
16793
16794
16795
16796
16797
16798
16799
16800
16801 AttrFractalColourFill::AttrFractalColourFill()
16802 {
16803 SetFractalDPI(AttrFillGeometry::FractalDPI);
16804 }
16805
16806
16807
16808
16809
16810
16811
16812
16813
16814
16815
16816 AttrFractalColourFill::~AttrFractalColourFill()
16817 {
16818 }
16819
16820
16821
16822
16823
16824
16825
16826
16827
16828
16829
16830
16831
16832
16833 void AttrFractalColourFill::GetDebugDetails(StringBase* Str)
16834 {
16835 #ifdef _DEBUG
16836 AttrTextureColourFill::GetDebugDetails( Str );
16837
16838 String_256 TempStr;
16839
16840 TempStr._MakeMsg( TEXT("\r\nFractal Fill:\r\n"));
16841 (*Str) += TempStr;
16842
16843 INT32 Seed = ((FractalFillAttribute*)GetAttributeValue())->Seed;
16844
16845
16846
16847
16848 TempStr._MakeMsg(TEXT("\r\n\nSeed = #1%ld "),
16849 (Seed));
16850 (*Str) += TempStr;
16851 #endif
16852 }
16853
16854
16855
16856
16857
16858
16859
16860
16861
16862
16863
16864
16865
16866
16867 UINT32 AttrFractalColourFill::GetNodeSize() const
16868 {
16869 return sizeof(AttrFractalColourFill);
16870 }
16871
16872
16873
16874
16875
16876
16877
16878
16879
16880
16881
16882
16883
16884
16885
16886
16887
16888 Node* AttrFractalColourFill::SimpleCopy()
16889 {
16890 AttrFractalColourFill* NodeCopy = new AttrFractalColourFill();
16891 if (NodeCopy == NULL)
16892 return NULL;
16893
16894 CopyNodeContents(NodeCopy);
16895
16896 return NodeCopy;
16897 }
16898
16899
16900
16901
16902
16903
16904
16905
16906
16907
16908
16909
16910
16911
16912
16913 BOOL AttrFractalColourFill::WritePreChildrenWeb(BaseCamelotFilter* pFilter)
16914 {
16915 #ifdef DO_EXPORT
16916 ERROR2IF(pFilter == NULL,FALSE,"NULL filter param");
16917
16918 BOOL ok = TRUE;
16919
16920
16921 INT32 StartColRef = pFilter->WriteRecord(Value.GetStartColour());
16922 INT32 EndColRef = pFilter->WriteRecord(Value.GetEndColour());
16923
16924
16925 ok = (StartColRef != 0) && (EndColRef != 0);
16926
16927 if (ok)
16928 {
16929 CamelotFileRecord Rec(pFilter,TAG_FRACTALFILL,TAG_FRACTALFILL_SIZE);
16930
16931 if (ok) ok = Rec.Init();
16932 if (ok) ok = Rec.WriteCoord(Value.StartPoint);
16933 if (ok) ok = Rec.WriteCoord(Value.EndPoint);
16934 if (ok) ok = Rec.WriteCoord(Value.EndPoint2);
16935 if (ok) ok = Rec.WriteReference(StartColRef);
16936 if (ok) ok = Rec.WriteReference(EndColRef);
16937
16938 if (ok) ok = Rec.WriteINT32(Value.Seed);
16939 if (ok) ok = Rec.WriteFIXED16(Value.Graininess);
16940 if (ok) ok = Rec.WriteFIXED16(Value.Gravity);
16941 if (ok) ok = Rec.WriteFIXED16(Value.Squash);
16942 if (ok) ok = Rec.WriteINT32(Value.Dpi);
16943 if (ok) ok = Rec.WriteBYTE(Value.Tileable);
16944 if (ok) ok = Rec.WriteDOUBLE ((double) GetProfile ().GetBias ());
16945 if (ok) ok = Rec.WriteDOUBLE ((double) GetProfile ().GetGain ());
16946
16947 if (ok) ok = pFilter->Write(&Rec);
16948 }
16949
16950 if (!ok)
16951 pFilter->GotError(_R(IDE_FILE_WRITE_ERROR));
16952
16953 return ok;
16954 #else
16955 return FALSE;
16956 #endif
16957 }
16958
16959
16960
16961
16962 BOOL AttrFractalColourFill::WritePreChildrenNative(BaseCamelotFilter* pFilter)
16963 {
16964 #ifdef DO_EXPORT
16965 return WritePreChildrenWeb(pFilter);
16966 #else
16967 return FALSE;
16968 #endif
16969 }
16970
16971
16972
16973
16974
16975
16976
16977
16978
16979
16980
16981
16982
16983
16984
16985
16986 BOOL AttrFractalColourFill::WriteColourDefinitions (BaseCamelotFilter* pFilter)
16987 {
16988
16989 INT32 StartColRef = pFilter->WriteRecord(Value.GetStartColour());
16990 INT32 EndColRef = pFilter->WriteRecord(Value.GetEndColour());
16991
16992
16993 BOOL ok = (StartColRef != 0) && (EndColRef != 0);
16994
16995 return (ok);
16996 }
16997
16998
16999
17000
17001
17002
17003
17004
17006
17007
17008
17010
17011
17012
17013
17014
17015
17016
17017
17018
17019
17020
17021 AttrNoiseColourFill::AttrNoiseColourFill()
17022 {
17023 }
17024
17025
17026
17027
17028
17029
17030
17031
17032
17033
17034
17035 AttrNoiseColourFill::~AttrNoiseColourFill()
17036 {
17037 }
17038
17039
17040
17041
17042
17043
17044
17045
17046
17047
17048
17049
17050
17051 void AttrNoiseColourFill::GetDebugDetails(StringBase* Str)
17052 {
17053 #ifdef _DEBUG
17054 AttrTextureColourFill::GetDebugDetails( Str );
17055
17056 String_256 TempStr;
17057
17058 TempStr._MakeMsg( TEXT("\r\nNoise Fill:\r\n"));
17059 (*Str) += TempStr;
17060
17061 double Scale = ((NoiseFillAttribute*)GetAttributeValue())->GetGraininess().MakeDouble();
17062
17063 TempStr._MakeMsg(TEXT("\r\n\nScale = #1%f "),
17064 (Scale));
17065 (*Str) += TempStr;
17066 #endif
17067 }
17068
17069
17070
17071
17072
17073
17074
17075
17076
17077
17078
17079
17080
17081 UINT32 AttrNoiseColourFill::GetNodeSize() const
17082 {
17083 return sizeof(AttrNoiseColourFill);
17084 }
17085
17086
17087
17088
17089
17090
17091
17092
17093
17094
17095
17096
17097
17098
17099
17100
17101
17102 Node* AttrNoiseColourFill::SimpleCopy()
17103 {
17104 AttrNoiseColourFill* NodeCopy = new AttrNoiseColourFill();
17105 if (NodeCopy == NULL)
17106 return NULL;
17107
17108 CopyNodeContents(NodeCopy);
17109
17110 return NodeCopy;
17111 }
17112
17113
17114
17115
17116
17117
17118
17119
17120
17121
17122
17123
17124
17125
17126
17127 BOOL AttrNoiseColourFill::WritePreChildrenWeb(BaseCamelotFilter* pFilter)
17128 {
17129 #ifdef DO_EXPORT
17130 ERROR2IF(pFilter == NULL,FALSE,"NULL filter param");
17131
17132 BOOL ok = TRUE;
17133
17134
17135 INT32 StartColRef = pFilter->WriteRecord(Value.GetStartColour());
17136 INT32 EndColRef = pFilter->WriteRecord(Value.GetEndColour());
17137
17138
17139 ok = (StartColRef != 0) && (EndColRef != 0);
17140
17141 if (ok)
17142 {
17143 CamelotFileRecord Rec(pFilter,TAG_NOISEFILL,TAG_NOISEFILL_SIZE);
17144
17145 if (ok) ok = Rec.Init();
17146 if (ok) ok = Rec.WriteCoord(Value.StartPoint);
17147 if (ok) ok = Rec.WriteCoord(Value.EndPoint);
17148 if (ok) ok = Rec.WriteCoord(Value.EndPoint2);
17149 if (ok) ok = Rec.WriteReference(StartColRef);
17150 if (ok) ok = Rec.WriteReference(EndColRef);
17151 if (ok) ok = Rec.WriteFIXED16(Value.GetGraininess());
17152 if (ok) ok = Rec.WriteINT32(Value.GetSeed());
17153 if (ok) ok = Rec.WriteINT32(Value.GetFractalDPI());
17154 if (ok) ok = Rec.WriteBYTE(Value.GetTileable());
17155 if (ok) ok = Rec.WriteDOUBLE ((double) GetProfile ().GetBias ());
17156 if (ok) ok = Rec.WriteDOUBLE ((double) GetProfile ().GetGain ());
17157
17158 if (ok) ok = pFilter->Write(&Rec);
17159 }
17160
17161 if (!ok)
17162 pFilter->GotError(_R(IDE_FILE_WRITE_ERROR));
17163
17164 return ok;
17165 #else
17166 return FALSE;
17167 #endif
17168 }
17169
17170
17171
17172
17173 BOOL AttrNoiseColourFill::WritePreChildrenNative(BaseCamelotFilter* pFilter)
17174 {
17175 #ifdef DO_EXPORT
17176 return WritePreChildrenWeb(pFilter);
17177 #else
17178 return FALSE;
17179 #endif
17180 }
17181
17182
17183
17184
17185
17186
17187
17188
17189
17190
17191
17192
17193
17194
17195
17196
17197
17198 BOOL AttrNoiseColourFill::WriteColourDefinitions (BaseCamelotFilter* pFilter)
17199 {
17200
17201 INT32 StartColRef = pFilter->WriteRecord(Value.GetStartColour());
17202 INT32 EndColRef = pFilter->WriteRecord(Value.GetEndColour());
17203
17204
17205 BOOL ok = (StartColRef != 0) && (EndColRef != 0);
17206
17207 return (ok);
17208 }
17209
17210
17211
17213
17214
17215
17217
17218
17219
17220
17221
17222
17223
17224
17225
17226
17227
17228 AttrTextureTranspFill::AttrTextureTranspFill()
17229 {
17230 }
17231
17232
17233
17234
17235
17236
17237
17238
17239
17240
17241
17242 AttrTextureTranspFill::~AttrTextureTranspFill()
17243 {
17244 }
17245
17246
17247
17248
17249
17250
17251
17252
17253
17254
17255
17256
17257
17258
17259
17260
17261 BOOL AttrTextureTranspFill::NeedsTransparency() const
17262 {
17263 return TRUE;
17264 }
17265
17266
17267
17268
17269
17270
17271
17272
17273
17274
17275
17276
17277
17278
17279
17280
17281 Node* AttrTextureTranspFill::SimpleCopy()
17282 {
17283 AttrTextureTranspFill* NodeCopy = new AttrTextureTranspFill();
17284 if (NodeCopy == NULL)
17285 return NULL;
17286
17287 CopyNodeContents(NodeCopy);
17288
17289 return NodeCopy;
17290 }
17291
17292
17293
17294
17295
17296
17297
17298
17299
17300
17301
17302
17303 UINT32 AttrTextureTranspFill::GetAttrNameID(void)
17304 {
17305
17306 return (_R(IDS_BITMAPTRANSPFILL));
17307 }
17308
17309 UINT32 AttrFractalTranspFill::GetAttrNameID(void)
17310 {
17311 return (_R(IDS_FRACTALCLOUDSTRANSPFILL));
17312 }
17313
17314 UINT32 AttrNoiseTranspFill::GetAttrNameID(void)
17315 {
17316 return (_R(IDS_FRACTALPLASMATRANSPFILL));
17317 }
17318
17319
17320
17321
17322
17323
17324
17325
17326
17327
17328
17329
17330 void AttrTextureTranspFill::GetDebugDetails(StringBase* Str)
17331 {
17332 #ifdef _DEBUG
17333 NodeAttribute::GetDebugDetails( Str );
17334
17335 String_256 TempStr;
17336
17337 TempStr._MakeMsg( TEXT("\r\nTexture transparency:\r\n"));
17338 (*Str) += TempStr;
17339
17340 TempStr._MakeMsg(TEXT("\r\nStart = (#1%ld, #2%ld)"),
17341 (*GetStartPoint()).x, (*GetStartPoint()).y);
17342 (*Str) += TempStr;
17343
17344 TempStr._MakeMsg(TEXT("\r\nEnd = (#1%ld, #2%ld) "),
17345 (*GetEndPoint()).x, (*GetEndPoint()).y);
17346 (*Str) += TempStr;
17347
17348 TempStr._MakeMsg(TEXT("\r\n3rd = (#1%ld, #2%ld) "),
17349 (*GetEndPoint2()).x, (*GetEndPoint2()).y);
17350 (*Str) += TempStr;
17351 #endif
17352 }
17353
17354
17355
17356
17357
17358
17359
17360
17361
17362
17363
17364
17365
17366 void AttrTextureTranspFill::Render(RenderRegion* pRender)
17367 {
17368 if (GetBitmap() == NULL || GetBitmap()->ActualBitmap == NULL)
17369 {
17370 if (!RecalcFractal())
17371 return;
17372 }
17373
17374 pRender->SetTranspFillGeometry((TranspFillAttribute*)GetAttributeValue(), FALSE);
17375 }
17376
17377
17378
17379
17380
17381
17382
17383
17384
17385
17386
17387
17388
17389 void AttrTextureTranspFill::RenderFillBlobs(RenderRegion* pRender)
17390 {
17391 #if !defined(EXCLUDE_FROM_RALPH)
17392 if (!IsVisible())
17393 return;
17394
17395
17396
17397 if (IsFillBeingEdited())
17398 return;
17399
17400
17401 if (CheckPreviousFillMesh())
17402 return;
17403
17404 DocCoord ControlPoints[5];
17405 ControlPoints[FILLCONTROL_STARTPOINT] = (*GetStartPoint());
17406 ControlPoints[FILLCONTROL_ENDPOINT] = (*GetEndPoint());
17407 ControlPoints[FILLCONTROL_SECONDARYPOINT] = (*GetEndPoint2());
17408
17409
17410 RenderFillMesh(pRender, ControlPoints, SelectionState, 5);
17411
17412
17413
17414
17415
17416 #endif
17417 }
17418
17419
17420
17421
17422
17423
17424
17425
17426
17427
17428
17429
17430
17431
17432
17433
17434
17435
17436
17437 FillControl AttrTextureTranspFill::CheckForControlHit(DocCoord &ClickPos)
17438 {
17439 #if !defined(EXCLUDE_FROM_RALPH)
17440 if (!GetApplication()->GetBlobManager()->GetCurrentInterest().Fill || !IsVisible())
17441 return FILLCONTROL_NULL;
17442
17443
17444 FillControl HitControl = FILLCONTROL_NULL;
17445 DocRect BlobRect;
17446
17447 DocCoord StartPoint = *GetStartPoint();
17448 DocCoord EndPoint = *GetEndPoint();
17449 DocCoord EndPoint2 = *GetEndPoint2();
17450
17451
17452
17453
17454
17455
17456
17457
17458
17459
17460 DocCoord CentrePoint;
17461 DocCoord Drag2Blob;
17462 DocCoord Drag3Blob;
17463
17464 GetBitmapVirtualPoints(StartPoint, EndPoint, EndPoint2,
17465 &CentrePoint, &Drag2Blob, &Drag3Blob);
17466
17467
17468 (Camelot.GetBlobManager())->GetBlobRect(CentrePoint, &BlobRect);
17469
17470 if ( BlobRect.ContainsCoord(ClickPos) )
17471 HitControl = FILLCONTROL_STARTPOINT;
17472
17473
17474 (Camelot.GetBlobManager())->GetBlobRect(Drag2Blob, &BlobRect);
17475
17476 if ( BlobRect.ContainsCoord(ClickPos) )
17477 HitControl = FILLCONTROL_ENDPOINT;
17478
17479
17480 (Camelot.GetBlobManager())->GetBlobRect(Drag3Blob, &BlobRect);
17481
17482 if ( BlobRect.ContainsCoord(ClickPos) )
17483 HitControl = FILLCONTROL_SECONDARYPOINT;
17484
17485 return HitControl;
17486 #else
17487 return FILLCONTROL_NULL;
17488 #endif
17489 }
17490
17491
17492
17493
17494
17495
17496
17497
17498
17499
17500
17501
17502
17503
17504
17505
17506 void AttrTextureTranspFill::OnControlDrag( DocCoord Pos, FillControl& DragControl, ClickModifiers ClickMods)
17507 {
17508 #if !defined(EXCLUDE_FROM_RALPH)
17509
17510 DocCoord StartPoint = *GetStartPoint();
17511 DocCoord EndPoint = *GetEndPoint();
17512 DocCoord EndPoint2 = *GetEndPoint2();
17513
17514 DocCoord CentrePoint;
17515 DocCoord Drag2Blob;
17516 DocCoord Drag3Blob;
17517
17518
17519
17520
17521
17522
17523
17524
17525
17526
17527 GetBitmapVirtualPoints(StartPoint, EndPoint, EndPoint2,
17528 &CentrePoint, &Drag2Blob, &Drag3Blob);
17529
17530 INT32 dx, dy;
17531
17532
17533 switch (DragControl)
17534 {
17535 case FILLCONTROL_STARTPOINT:
17536
17537
17538 dx = CentrePoint.x - Pos.x;
17539 dy = CentrePoint.y - Pos.y;
17540
17541 Drag2Blob.translate(-dx, -dy);
17542 Drag3Blob.translate(-dx, -dy);
17543 CentrePoint = Pos;
17544 break;
17545
17546 case FILLCONTROL_ENDPOINT:
17547
17548
17549
17550 if (ClickMods.Constrain)
17551 DocView::ConstrainToAngle(CentrePoint, &Pos);
17552
17553 if (ClickMods.Adjust)
17554 {
17555
17556 double OldLen = CentrePoint.Distance(Drag2Blob);
17557 double NewLen = CentrePoint.Distance(Pos);
17558 double Ratio = 1.0;
17559
17560 if (OldLen == 0)
17561 Ratio = 0;
17562 else
17563 Ratio = NewLen/OldLen;
17564
17565
17566 Drag3Blob =
17567 MakeLineAtAngle(CentrePoint, Pos, 90, INT32(CentrePoint.Distance(Drag3Blob) * Ratio));
17568 }
17569
17570 Drag2Blob = Pos;
17571 break;
17572
17573 case FILLCONTROL_SECONDARYPOINT:
17574
17575
17576
17577 if (ClickMods.Constrain)
17578 DocView::ConstrainToAngle(CentrePoint, &Pos);
17579
17580 if (ClickMods.Adjust)
17581 {
17582
17583 double OldLen = CentrePoint.Distance(Drag3Blob);
17584 double NewLen = CentrePoint.Distance(Pos);
17585 double Ratio = 1.0;
17586
17587 if (OldLen == 0)
17588 Ratio = 0;
17589 else
17590 Ratio = NewLen/OldLen;
17591
17592
17593 Drag2Blob =
17594 MakeLineAtAngle(CentrePoint, Pos, -90, INT32(CentrePoint.Distance(Drag2Blob) * Ratio));
17595 }
17596
17597 Drag3Blob = Pos;
17598 break;
17599 }
17600
17601
17602
17603
17604 GetBitmapRealPoints(CentrePoint, Drag2Blob, Drag3Blob,
17605 &StartPoint, &EndPoint, &EndPoint2);
17606
17607
17608 SetStartPoint(&StartPoint);
17609 SetEndPoint(&EndPoint);
17610 SetEndPoint2(&EndPoint2);
17611 #endif
17612 }
17613
17614
17615
17616
17617
17618
17619
17620
17621
17622
17623
17624
17625
17626 void AttrTextureTranspFill::RenderControl(FillControl Control, BOOL RenderOn)
17627 {
17628 #if !defined(EXCLUDE_FROM_RALPH)
17629 DocRect ControlRect;
17630
17631
17632
17633 NodeRenderable* pParent = (NodeRenderable*)FindParent();
17634
17635 if (pParent == NULL)
17636 return;
17637
17638 if (IsBlobSame(Control))
17639 return;
17640
17641 Spread* pSpread = this->FindParentSpread();
17642
17643 DocCoord StartPoint = *GetStartPoint();
17644 DocCoord EndPoint = *GetEndPoint();
17645 DocCoord EndPoint2 = *GetEndPoint2();
17646
17647 DocCoord CentrePoint;
17648 DocCoord Drag2Blob;
17649 DocCoord Drag3Blob;
17650
17651 GetBitmapVirtualPoints(StartPoint, EndPoint, EndPoint2,
17652 &CentrePoint, &Drag2Blob, &Drag3Blob);
17653
17654 switch (Control)
17655 {
17656 case FILLCONTROL_STARTPOINT:
17657
17658 if (GetStartPoint() != NULL)
17659 {
17660
17661 (Camelot.GetBlobManager())->GetBlobRect(CentrePoint, &ControlRect);
17662 RenderFillControl(RenderOn, &ControlRect, pSpread, pParent);
17663 }
17664 break;
17665
17666 case FILLCONTROL_ENDPOINT:
17667
17668 if (GetEndPoint() != NULL)
17669 {
17670
17671 (Camelot.GetBlobManager())->GetBlobRect(Drag2Blob, &ControlRect);
17672 RenderFillControl(RenderOn, &ControlRect, pSpread, pParent);
17673 }
17674
17675 if (GetEndPoint2() != NULL)
17676 {
17677 (Camelot.GetBlobManager())->GetBlobRect(Drag3Blob, &ControlRect);
17678 RenderFillControl(RenderOn, &ControlRect, pSpread, pParent);
17679 }
17680 break;
17681
17682 case FILLCONTROL_SECONDARYPOINT:
17683
17684 if (GetEndPoint2() != NULL)
17685 {
17686
17687 (Camelot.GetBlobManager())->GetBlobRect(Drag2Blob, &ControlRect);
17688 RenderFillControl(RenderOn, &ControlRect, pSpread, pParent);
17689 }
17690
17691 if (GetEndPoint2() != NULL)
17692 {
17693 (Camelot.GetBlobManager())->GetBlobRect(Drag3Blob, &ControlRect);
17694 RenderFillControl(RenderOn, &ControlRect, pSpread, pParent);
17695 }
17696 break;
17697 }
17698 #endif
17699 }
17700
17701
17702
17703
17704
17705
17706
17707
17708
17709
17710
17711
17712
17713
17714
17715
17716
17717
17718
17719
17720 void AttrTextureTranspFill::RenderFillMesh(RenderRegion* pRender,
17721 DocCoord* ControlPoints, BOOL* SelState,
17722 INT32 NumControlPoints)
17723 {
17724 #if !defined(EXCLUDE_FROM_RALPH)
17725 DocCoord StartPoint = ControlPoints[FILLCONTROL_STARTPOINT];
17726 DocCoord EndPoint = ControlPoints[FILLCONTROL_ENDPOINT];
17727
17728 if (StartPoint == EndPoint)
17729 return;
17730
17731 if (SelState == NULL)
17732 {
17733
17734
17735 BOOL Selected[NUMCONTROLPOINTS];
17736 for (INT32 i=0; i< NumControlPoints; i++)
17737 {
17738 Selected[i] = FALSE;
17739 }
17740 SelState = Selected;
17741 }
17742
17743 DocCoord EndPoint2 = ControlPoints[FILLCONTROL_SECONDARYPOINT];
17744
17745 DocCoord Start;
17746 DocCoord End;
17747 DocCoord End2;
17748
17749
17750 GetBitmapVirtualPoints(StartPoint, EndPoint, EndPoint2,
17751 &Start, &End, &End2);
17752
17753
17754 pRender->SaveContext();
17755
17756
17757 INT32 BlobSize = (Camelot.GetBlobManager())->GetBlobSize();
17758
17759
17760 Path ArrowPath;
17761 ArrowPath.Initialise();
17762 DocCoord LineEnd;
17763 MakeMeshArrow(&ArrowPath, Start, End, &LineEnd);
17764
17765
17766 Path ArrowPath2;
17767 ArrowPath2.Initialise();
17768 DocCoord LineEnd2;
17769 MakeMeshArrow(&ArrowPath2, Start, End2, &LineEnd2);
17770
17771
17772 pRender->SetLineWidth(0);
17773 pRender->SetLineColour(COLOUR_UNSELECTEDBLOB);
17774 pRender->SetFillColour(COLOUR_UNSELECTEDBLOB);
17775
17776
17777 pRender->SetLineWidth(BlobSize/4);
17778 pRender->DrawLine(Start, LineEnd);
17779
17780
17781 pRender->DrawLine(Start, LineEnd2);
17782
17783
17784 pRender->SetLineWidth(0);
17785 pRender->SetLineColour(COLOUR_NONE);
17786 pRender->DrawPath(&ArrowPath);
17787
17788
17789 pRender->DrawPath(&ArrowPath2);
17790
17791 if (DraggedFill == this)
17792 {
17793
17794
17795 pRender->SetLineColour(COLOUR_SELECTEDBLOB);
17796 pRender->SetFillColour(COLOUR_NONE);
17797
17798 Path ParaPath;
17799 ParaPath.Initialise();
17800 MakeMeshParallelagram(&ParaPath, Start, End, End2);
17801
17802
17803 pRender->DrawPath(&ParaPath);
17804 }
17805
17806
17807
17808
17809 if (SelState[FILLCONTROL_STARTPOINT])
17810 {
17811
17812
17813 pRender->SetLineColour(COLOUR_NONE);
17814 pRender->SetFillColour(COLOUR_SELECTEDBLOB);
17815 pRender->DrawBlob(Start, BT_SELECTED);
17816 }
17817 else
17818 {
17819
17820
17821 pRender->SetLineColour(COLOUR_NONE);
17822 pRender->SetFillColour(COLOUR_UNSELECTEDBLOB);
17823 pRender->DrawBlob(Start, BT_UNSELECTED);
17824 }
17825
17826
17827 if (SelState[FILLCONTROL_ENDPOINT])
17828 {
17829
17830
17831 pRender->SetLineColour(COLOUR_NONE);
17832 pRender->SetFillColour(COLOUR_SELECTEDBLOB);
17833 pRender->DrawBlob(End, BT_SELECTED);
17834 pRender->DrawBlob(End2,BT_SELECTED);
17835 }
17836 else
17837 {
17838
17839
17840 pRender->SetLineColour(COLOUR_NONE);
17841 pRender->SetFillColour(COLOUR_UNSELECTEDBLOB);
17842 pRender->DrawBlob(End, BT_UNSELECTED);
17843 pRender->DrawBlob(End2,BT_UNSELECTED);
17844 }
17845
17846
17847 pRender->RestoreContext();
17848 #endif
17849 }
17850
17851
17852
17854
17855
17856
17858
17859
17860
17861
17862
17863
17864
17865
17866
17867
17868
17869 AttrFractalTranspFill::AttrFractalTranspFill()
17870 {
17871 SetFractalDPI(AttrFillGeometry::FractalDPI);
17872 }
17873
17874
17875
17876
17877
17878
17879
17880
17881
17882
17883
17884 AttrFractalTranspFill::~AttrFractalTranspFill()
17885 {
17886 }
17887
17888
17889
17890
17891
17892
17893
17894
17895
17896
17897
17898
17899
17900 UINT32 AttrFractalTranspFill::GetNodeSize() const
17901 {
17902 return sizeof(AttrFractalTranspFill);
17903 }
17904
17905
17906
17907
17908
17909
17910
17911
17912
17913
17914
17915
17916
17917
17918
17919
17920 Node* AttrFractalTranspFill::SimpleCopy()
17921 {
17922 AttrFractalTranspFill* NodeCopy = new AttrFractalTranspFill();
17923 if (NodeCopy == NULL)
17924 return NULL;
17925
17926 CopyNodeContents(NodeCopy);
17927
17928 return NodeCopy;
17929 }
17930
17931
17932
17933
17934
17935
17936
17937
17938
17939
17940
17941
17942
17943
17944 BOOL AttrFractalTranspFill::WritePreChildrenWeb(BaseCamelotFilter* pFilter)
17945 {
17946 #ifdef DO_EXPORT
17947 ERROR2IF(pFilter == NULL,FALSE,"NULL filter param");
17948
17949 BOOL ok = TRUE;
17950
17951 CamelotFileRecord Rec(pFilter,TAG_FRACTALTRANSPARENTFILL,TAG_FRACTALTRANSPARENTFILL_SIZE);
17952
17953 if (ok) ok = Rec.Init();
17954 if (ok) ok = Rec.WriteCoord(Value.StartPoint);
17955 if (ok) ok = Rec.WriteCoord(Value.EndPoint);
17956 if (ok) ok = Rec.WriteCoord(Value.EndPoint2);
17957
17958 if (ok) ok = Rec.WriteBYTE(BYTE(Value.Transp));
17959 if (ok) ok = Rec.WriteBYTE(BYTE(Value.EndTransp));
17960 if (ok) ok = Rec.WriteBYTE(BYTE(Value.TranspType));
17961
17962 if (ok) ok = Rec.WriteINT32(Value.Seed);
17963 if (ok) ok = Rec.WriteFIXED16(Value.Graininess);
17964 if (ok) ok = Rec.WriteFIXED16(Value.Gravity);
17965 if (ok) ok = Rec.WriteFIXED16(Value.Squash);
17966 if (ok) ok = Rec.WriteINT32(Value.Dpi);
17967 if (ok) ok = Rec.WriteBYTE(Value.Tileable);
17968 if (ok) ok = Rec.WriteDOUBLE ((double) GetProfile ().GetBias ());
17969 if (ok) ok = Rec.WriteDOUBLE ((double) GetProfile ().GetGain ());
17970
17971 if (ok) ok = pFilter->Write(&Rec);
17972
17973 if (!ok)
17974 pFilter->GotError(_R(IDE_FILE_WRITE_ERROR));
17975
17976 return ok;
17977 #else
17978 return FALSE;
17979 #endif
17980 }
17981
17982
17983
17984
17985 BOOL AttrFractalTranspFill::WritePreChildrenNative(BaseCamelotFilter* pFilter)
17986 {
17987 #ifdef DO_EXPORT
17988 return WritePreChildrenWeb(pFilter);
17989 #else
17990 return FALSE;
17991 #endif
17992 }
17993
17994
17995
17996
17997
17998
17999
18000
18001
18002
18003
18004
18005
18006
18007
18008
18009 BOOL AttrFractalTranspFill::HasEquivalentDefaultValue(BOOL bAppearance)
18010 {
18011
18012 if (bAppearance)
18013 return (Value.TranspType==TT_NoTranspType || (Value.TranspType==TT_Mix && Value.Transp == 0 && Value.EndTransp==0));
18014 else
18015 return FALSE;
18016 }
18017
18018
18019
18020
18022
18023
18024
18026
18027
18028
18029
18030
18031
18032
18033
18034
18035
18036
18037 AttrNoiseTranspFill::AttrNoiseTranspFill()
18038 {
18039 SetFractalDPI(AttrFillGeometry::FractalDPI);
18040 }
18041
18042
18043
18044
18045
18046
18047
18048
18049
18050
18051
18052 AttrNoiseTranspFill::~AttrNoiseTranspFill()
18053 {
18054 }
18055
18056
18057
18058
18059
18060
18061
18062
18063
18064
18065
18066
18067
18068 UINT32 AttrNoiseTranspFill::GetNodeSize() const
18069 {
18070 return sizeof(AttrNoiseTranspFill);
18071 }
18072
18073
18074
18075
18076
18077
18078
18079
18080
18081
18082
18083
18084
18085
18086
18087
18088 Node* AttrNoiseTranspFill::SimpleCopy()
18089 {
18090 AttrNoiseTranspFill* NodeCopy = new AttrNoiseTranspFill();
18091 if (NodeCopy == NULL)
18092 return NULL;
18093
18094 CopyNodeContents(NodeCopy);
18095
18096 return NodeCopy;
18097 }
18098
18099
18100
18101
18102
18103
18104
18105
18106
18107
18108
18109
18110
18111
18112 BOOL AttrNoiseTranspFill::WritePreChildrenWeb(BaseCamelotFilter* pFilter)
18113 {
18114 #ifdef DO_EXPORT
18115 ERROR2IF(pFilter == NULL,FALSE,"NULL filter param");
18116
18117 BOOL ok = TRUE;
18118
18119 CamelotFileRecord Rec(pFilter,TAG_NOISETRANSPARENTFILL,TAG_NOISETRANSPARENTFILL_SIZE);
18120
18121 if (ok) ok = Rec.Init();
18122 if (ok) ok = Rec.WriteCoord(Value.StartPoint);
18123 if (ok) ok = Rec.WriteCoord(Value.EndPoint);
18124 if (ok) ok = Rec.WriteCoord(Value.EndPoint2);
18125
18126 if (ok) ok = Rec.WriteBYTE(BYTE(Value.Transp));
18127 if (ok) ok = Rec.WriteBYTE(BYTE(Value.EndTransp));
18128 if (ok) ok = Rec.WriteBYTE(BYTE(Value.TranspType));
18129
18130 if (ok) ok = Rec.WriteFIXED16(Value.GetGraininess());
18131 if (ok) ok = Rec.WriteINT32(Value.GetSeed());
18132 if (ok) ok = Rec.WriteINT32(Value.GetFractalDPI());
18133 if (ok) ok = Rec.WriteBYTE(Value.GetTileable());
18134 if (ok) ok = Rec.WriteDOUBLE ((double) GetProfile ().GetBias ());
18135 if (ok) ok = Rec.WriteDOUBLE ((double) GetProfile ().GetGain ());
18136
18137 if (ok) ok = pFilter->Write(&Rec);
18138
18139 if (!ok)
18140 pFilter->GotError(_R(IDE_FILE_WRITE_ERROR));
18141
18142 return ok;
18143 #else
18144 return FALSE;
18145 #endif
18146 }
18147
18148
18149
18150
18151 BOOL AttrNoiseTranspFill::WritePreChildrenNative(BaseCamelotFilter* pFilter)
18152 {
18153 #ifdef DO_EXPORT
18154 return WritePreChildrenWeb(pFilter);
18155 #else
18156 return FALSE;
18157 #endif
18158 }
18159
18160
18161
18162
18163
18164
18165
18166
18167
18168
18169
18170
18171
18172
18173
18174
18175
18176
18177 BOOL AttrNoiseTranspFill::HasEquivalentDefaultValue(BOOL bAppearance)
18178 {
18179
18180 if (bAppearance)
18181 return (Value.TranspType==TT_NoTranspType || (Value.TranspType==TT_Mix && Value.Transp == 0 && Value.EndTransp==0));
18182 else
18183 return FALSE;
18184 }
18185
18186
18187
18188
18190
18191
18192
18194
18195
18196
18197
18198
18199
18200
18201
18202
18203
18204
18205
18206
18207
18208
18209
18210
18211 INT32 AttrFillMapping::operator==(const NodeAttribute& Attrib)
18212 {
18213 ERROR3IF(!Attrib.IsKindOf(CC_RUNTIME_CLASS(AttrFillMapping)),
18214 "Trying to compare two objects with different types");
18215
18216 return (GetRepeat() == ((AttrFillMapping*)&Attrib)->GetRepeat());
18217 }
18218
18219
18220
18221
18222
18223
18224
18225
18226
18227
18228
18229
18230
18231
18232 NodeAttribute* AttrFillMapping::GetOtherAttrToApply(BOOL* IsMutate)
18233 {
18234 #if !defined(EXCLUDE_FROM_RALPH)
18235 ERROR3IF(IsMutate == NULL, "NULL flag pointer passed to GetOtherAttrToApply");
18236
18237
18238
18239
18240 NodeAttribute* OtherAttr = new AttrFractalTileableChange;
18241 if (OtherAttr == NULL)
18242 return NULL;
18243
18244 ((AttrValueChange*)OtherAttr)->MutateColourFills(TRUE);
18245
18246 INT32 Repeat = GetRepeat();
18247 BOOL Tile;
18248
18249 switch (Repeat)
18250 {
18251 case RT_Simple:
18252 Tile = FALSE;
18253 break;
18254
18255 case RT_Repeating:
18256 Tile = TRUE;
18257 break;
18258
18259 case RT_RepeatInverted:
18260 Tile = FALSE;
18261 break;
18262
18263 default:
18264 Tile = TRUE;
18265 break;
18266 }
18267
18268 ((AttrValueChange*)OtherAttr)->SetTileable(Tile);
18269
18270 *IsMutate = TRUE;
18271
18272 return OtherAttr;
18273 #else
18274 return NULL;
18275 #endif
18276 }
18277
18278
18279 #ifdef _DEBUG
18280 void AttrFillMapping::GetDebugDetails(StringBase* Str)
18281 {
18282 NodeAttribute::GetDebugDetails(Str);
18283 (*Str) += TEXT("\r\nRepeating Value = ");
18284 switch(GetRepeat())
18285 {
18286 case 0 :
18287 (*Str) += TEXT("Flat.");
18288 break;
18289 case 1 :
18290 (*Str) += TEXT("Simple.");
18291 break;
18292 case 2 :
18293 (*Str) += TEXT("Repeating.");
18294 break;
18295 case 3 :
18296 (*Str) += TEXT("InvRepeating.");
18297 break;
18298 case 4 :
18299 (*Str) += TEXT("Repeating Extra.");
18300 break;
18301 default :
18302 (*Str) += TEXT("Not Reconized!");
18303 break;
18304 }
18305 (*Str) += TEXT("\r\n");
18306 }
18307 #endif
18308
18309
18310
18311
18312
18313
18314
18315
18316
18317
18318
18319
18320 void AttrFillMappingLinear::Render( RenderRegion* pRender)
18321 {
18322 pRender->SetFillMapping(&Value, FALSE);
18323 }
18324
18325
18326
18327
18328
18329
18330
18331
18332
18333
18334
18335
18336
18337
18338
18339
18340
18341 Node* AttrFillMappingLinear::SimpleCopy()
18342 {
18343 AttrFillMappingLinear* NodeCopy = new AttrFillMappingLinear;
18344 if (NodeCopy == NULL)
18345 return NULL;
18346
18347 CopyNodeContents(NodeCopy);
18348
18349 return NodeCopy;
18350 }
18351
18352
18353
18354
18355
18356
18357
18358
18359
18360
18361
18362
18363 UINT32 AttrFillMappingLinear::GetAttrNameID(void)
18364 {
18365 return (_R(IDS_FILLMAPPINGLINEAR));
18366 }
18367
18368
18369
18370
18371
18372
18373
18374
18375
18376
18377
18378
18379
18380
18381
18382
18383 BOOL AttrFillMappingLinear::CopyNodeContents(AttrFillMappingLinear* NodeCopy)
18384 {
18385 ERROR2IF(NodeCopy == NULL, FALSE, "NULL pointer in AttrFillMappingLinear::CopyNodeContents!");
18386
18387 NodeAttribute::CopyNodeContents(NodeCopy);
18388
18389
18390 NodeCopy->Value.SimpleCopy(&Value);
18391 return TRUE;
18392 }
18393
18394
18395
18396
18397
18398
18399
18400
18401
18402
18403
18404
18405
18406
18407 void AttrFillMappingLinear::PolyCopyNodeContents(NodeRenderable* pNodeCopy)
18408 {
18409 ENSURE(pNodeCopy, "Trying to copy a node's contents into a NULL node");
18410 ENSURE(IS_A(pNodeCopy, AttrFillMappingLinear), "PolyCopyNodeContents given wrong dest node type");
18411
18412 if (IS_A(pNodeCopy, AttrFillMappingLinear))
18413 CopyNodeContents((AttrFillMappingLinear*)pNodeCopy);
18414 }
18415
18416
18417
18418
18419
18420
18421
18422
18423
18424
18425
18426
18427
18428
18429
18430 UINT32 AttrFillMappingLinear::GetNodeSize() const
18431 {
18432 return (sizeof(AttrFillMappingLinear));
18433 }
18434
18435
18436
18437
18438
18439
18440
18441
18442
18443
18444
18445
18446
18447
18448
18449
18450
18451 BOOL AttrFillMappingLinear::WritePreChildrenWeb(BaseCamelotFilter* pFilter)
18452 {
18453 #ifdef DO_EXPORT
18454 ERROR2IF(pFilter == NULL,FALSE,"NULL filter param");
18455
18456 UINT32 Tag = TAG_UNDEFINED, TagSize = 1;
18457 switch (Value.Repeat)
18458 {
18459 case 0 :
18460 case 1 : Tag = TAG_FILL_NONREPEATING;
18461 TagSize = TAG_FILL_NONREPEATING_SIZE;
18462 break;
18463 case 2 : Tag = TAG_FILL_REPEATING;
18464 TagSize = TAG_FILL_REPEATING_SIZE;
18465 break;
18466 case 3 : Tag = TAG_FILL_REPEATINGINVERTED;
18467 TagSize = TAG_FILL_REPEATINGINVERTED_SIZE;
18468 break;
18469
18470 #ifdef NEW_FEATURES
18471 case 4 : Tag = TAG_FILL_REPEATING_EXTRA;
18472 TagSize = TAG_FILL_REPEATING_EXTRA_SIZE;
18473 break;
18474 #endif
18475 default:
18476 ERROR3("Unknown repeat type in this fill mapping attr");
18477 return FALSE;
18478 break;
18479 }
18480
18481 CamelotFileRecord Rec(pFilter,Tag,TagSize);
18482 return pFilter->Write(&Rec);
18483 #else
18484 return FALSE;
18485 #endif
18486 }
18487
18488
18489
18490
18491 BOOL AttrFillMappingLinear::WritePreChildrenNative(BaseCamelotFilter* pFilter)
18492 {
18493 #ifdef DO_EXPORT
18494 return WritePreChildrenWeb(pFilter);
18495 #else
18496 return FALSE;
18497 #endif
18498 }
18499
18500
18501
18502
18503
18504
18505
18506
18507
18508
18509
18510
18511 void AttrFillMappingSin::Render( RenderRegion* pRender)
18512 {
18513 pRender->SetFillMapping(&Value, FALSE);
18514 }
18515
18516
18517
18518
18519
18520
18521
18522
18523
18524
18525
18526
18527
18528
18529
18530
18531 Node* AttrFillMappingSin::SimpleCopy()
18532 {
18533 AttrFillMappingSin* NodeCopy = new AttrFillMappingSin();
18534 if (NodeCopy == NULL)
18535 return NULL;
18536
18537 CopyNodeContents(NodeCopy);
18538
18539 return NodeCopy;
18540 }
18541
18542
18543
18544
18545
18546
18547
18548
18549
18550
18551
18552
18553 UINT32 AttrFillMappingSin::GetAttrNameID(void)
18554 {
18555 return (_R(IDS_FILLMAPPINGSIN));
18556 }
18557
18558
18559
18560
18561
18562
18563
18564
18565
18566
18567
18568
18569
18570
18571
18572
18573 BOOL AttrFillMappingSin::CopyNodeContents(AttrFillMappingSin* NodeCopy)
18574 {
18575 ERROR2IF(NodeCopy == NULL, FALSE, "NULL pointer in AttrFillMappingSin::CopyNodeContents!");
18576
18577 NodeAttribute::CopyNodeContents(NodeCopy);
18578
18579
18580 NodeCopy->Value.SimpleCopy(&Value);
18581 return TRUE;
18582 }
18583
18584
18585
18586
18587
18588
18589
18590
18591
18592
18593
18594
18595
18596
18597 void AttrFillMappingSin::PolyCopyNodeContents(NodeRenderable* pNodeCopy)
18598 {
18599 ENSURE(pNodeCopy, "Trying to copy a node's contents into a NULL node");
18600 ENSURE(IS_A(pNodeCopy, AttrFillMappingSin), "PolyCopyNodeContents given wrong dest node type");
18601
18602 if (IS_A(pNodeCopy, AttrFillMappingSin))
18603 CopyNodeContents((AttrFillMappingSin*)pNodeCopy);
18604 }
18605
18606
18607
18608
18609
18610
18611
18612
18613
18614
18615
18616
18617
18618
18619
18620 UINT32 AttrFillMappingSin::GetNodeSize() const
18621 {
18622 return (sizeof(AttrFillMappingSin));
18623 }
18624
18625
18626
18627
18628
18629
18630
18631
18632
18633
18634
18635
18636
18637
18638
18639 BOOL AttrFillMappingSin::WritePreChildrenWeb(BaseCamelotFilter* pFilter)
18640 {
18641 #ifdef DO_EXPORT
18642 ERROR2IF(pFilter == NULL,FALSE,"NULL filter param");
18643
18644 ERROR3("v2 file format does not support this attribute");
18645 return FALSE;
18646 #else
18647 return FALSE;
18648 #endif
18649 }
18650
18651
18652
18653
18654 BOOL AttrFillMappingSin::WritePreChildrenNative(BaseCamelotFilter* pFilter)
18655 {
18656 #ifdef DO_EXPORT
18657 return WritePreChildrenWeb(pFilter);
18658 #else
18659 return FALSE;
18660 #endif
18661 }
18662
18663
18664
18665
18666
18667
18668
18669
18670
18671
18672
18673
18674
18675
18676
18677
18678
18679 INT32 AttrFillEffect::operator==(const NodeAttribute& Attrib)
18680 {
18681
18682 return TRUE;
18683 }
18684
18685
18686
18687
18688
18689
18690
18691
18692
18693
18694
18695 void AttrFillEffectFade::Render( RenderRegion* pRender)
18696 {
18697 pRender->SetFillEffect(&Value, FALSE);
18698 }
18699
18700
18701
18702
18703
18704
18705
18706
18707
18708
18709
18710
18711
18712
18713
18714
18715
18716 Node* AttrFillEffectFade::SimpleCopy()
18717 {
18718 AttrFillEffectFade* NodeCopy = new AttrFillEffectFade();
18719 if (NodeCopy == NULL)
18720 return NULL;
18721
18722 CopyNodeContents(NodeCopy);
18723
18724 return NodeCopy;
18725 }
18726
18727
18728
18729
18730
18731
18732
18733
18734
18735
18736
18737
18738 UINT32 AttrFillEffectFade::GetAttrNameID(void)
18739 {
18740 return (_R(IDS_FILLEFFECTFADE));
18741 }
18742
18743
18744
18745
18746
18747
18748
18749
18750
18751
18752
18753
18754
18755
18756
18757
18758 BOOL AttrFillEffectFade::CopyNodeContents(AttrFillEffectFade* NodeCopy)
18759 {
18760 ERROR2IF(NodeCopy == NULL, FALSE, "NULL pointer in AttrFillEffectFade::CopyNodeContents!");
18761
18762 NodeAttribute::CopyNodeContents(NodeCopy);
18763
18764
18765 NodeCopy->Value.SimpleCopy(&Value);
18766 return TRUE;
18767 }
18768
18769
18770
18771
18772
18773
18774
18775
18776
18777
18778
18779
18780
18781
18782 void AttrFillEffectFade::PolyCopyNodeContents(NodeRenderable* pNodeCopy)
18783 {
18784 ENSURE(pNodeCopy, "Trying to copy a node's contents into a NULL node");
18785 ENSURE(IS_A(pNodeCopy, AttrFillEffectFade), "PolyCopyNodeContents given wrong dest node type");
18786
18787 if (IS_A(pNodeCopy, AttrFillEffectFade))
18788 CopyNodeContents((AttrFillEffectFade*)pNodeCopy);
18789 }
18790
18791
18792
18793
18794
18795
18796
18797
18798
18799
18800
18801
18802
18803
18804
18805 UINT32 AttrFillEffectFade::GetNodeSize() const
18806 {
18807 return (sizeof(AttrFillEffectFade));
18808 }
18809
18810
18811
18812
18813
18814
18815
18816
18817
18818
18819
18820
18821
18822
18823
18824 BOOL AttrFillEffectFade::WritePreChildrenWeb(BaseCamelotFilter* pFilter)
18825 {
18826 #ifdef DO_EXPORT
18827 ERROR2IF(pFilter == NULL,FALSE,"NULL filter param");
18828
18829 CamelotFileRecord Rec(pFilter,TAG_FILLEFFECT_FADE,TAG_FILLEFFECT_FADE_SIZE);
18830 return pFilter->Write(&Rec);
18831 #else
18832 return FALSE;
18833 #endif
18834 }
18835
18836
18837
18838
18839 BOOL AttrFillEffectFade::WritePreChildrenNative(BaseCamelotFilter* pFilter)
18840 {
18841 #ifdef DO_EXPORT
18842 return WritePreChildrenWeb(pFilter);
18843 #else
18844 return FALSE;
18845 #endif
18846 }
18847
18848
18849
18850
18851
18852
18853
18854
18855
18856
18857
18858 void AttrFillEffectRainbow::Render( RenderRegion* pRender)
18859 {
18860 pRender->SetFillEffect(&Value, FALSE);
18861 }
18862
18863
18864
18865
18866
18867
18868
18869
18870
18871
18872
18873
18874
18875
18876
18877
18878 Node* AttrFillEffectRainbow::SimpleCopy()
18879 {
18880 AttrFillEffectRainbow* NodeCopy = new AttrFillEffectRainbow();
18881 if (NodeCopy == NULL)
18882 return NULL;
18883
18884 CopyNodeContents(NodeCopy);
18885
18886 return NodeCopy;
18887 }
18888
18889
18890
18891
18892
18893
18894
18895
18896
18897
18898
18899
18900 UINT32 AttrFillEffectRainbow::GetAttrNameID(void)
18901 {
18902 return (_R(IDS_FILLEFFECTRAINBOW));
18903 }
18904
18905
18906
18907
18908
18909
18910
18911
18912
18913
18914
18915
18916
18917
18918
18919
18920 BOOL AttrFillEffectRainbow::CopyNodeContents(AttrFillEffectRainbow* NodeCopy)
18921 {
18922 ERROR2IF(NodeCopy == NULL, FALSE, "NULL pointer in AttrFillEffectRainbow::CopyNodeContents!");
18923
18924 NodeAttribute::CopyNodeContents(NodeCopy);
18925
18926
18927 NodeCopy->Value.SimpleCopy(&Value);
18928 return TRUE;
18929 }
18930
18931
18932
18933
18934
18935
18936
18937
18938
18939
18940
18941
18942
18943
18944 void AttrFillEffectRainbow::PolyCopyNodeContents(NodeRenderable* pNodeCopy)
18945 {
18946 ENSURE(pNodeCopy, "Trying to copy a node's contents into a NULL node");
18947 ENSURE(IS_A(pNodeCopy, AttrFillEffectRainbow), "PolyCopyNodeContents given wrong dest node type");
18948
18949 if (IS_A(pNodeCopy, AttrFillEffectRainbow))
18950 CopyNodeContents((AttrFillEffectRainbow*)pNodeCopy);
18951 }
18952
18953
18954
18955
18956
18957
18958
18959
18960
18961
18962
18963
18964
18965
18966
18967 UINT32 AttrFillEffectRainbow::GetNodeSize() const
18968 {
18969 return (sizeof(AttrFillEffectRainbow));
18970 }
18971
18972
18973
18974
18975
18976
18977
18978
18979
18980
18981
18982
18983
18984
18985
18986
18987 BOOL AttrFillEffectRainbow::WritePreChildrenWeb(BaseCamelotFilter* pFilter)
18988 {
18989 #ifdef DO_EXPORT
18990 ERROR2IF(pFilter == NULL,FALSE,"NULL filter param");
18991
18992 CamelotFileRecord Rec(pFilter,TAG_FILLEFFECT_RAINBOW,TAG_FILLEFFECT_RAINBOW_SIZE);
18993 return pFilter->Write(&Rec);
18994 #else
18995 return FALSE;
18996 #endif
18997 }
18998
18999
19000
19001
19002 BOOL AttrFillEffectRainbow::WritePreChildrenNative(BaseCamelotFilter* pFilter)
19003 {
19004 #ifdef DO_EXPORT
19005 return WritePreChildrenWeb(pFilter);
19006 #else
19007 return FALSE;
19008 #endif
19009 }
19010
19011
19012
19013
19014
19015
19016
19017
19018
19019
19020
19021 void AttrFillEffectAltRainbow::Render( RenderRegion* pRender)
19022 {
19023 pRender->SetFillEffect(&Value, FALSE);
19024 }
19025
19026
19027
19028
19029
19030
19031
19032
19033
19034
19035
19036
19037
19038
19039
19040
19041 Node* AttrFillEffectAltRainbow::SimpleCopy()
19042 {
19043 AttrFillEffectAltRainbow* NodeCopy = new AttrFillEffectAltRainbow();
19044 if (NodeCopy == NULL)
19045 return NULL;
19046
19047 CopyNodeContents(NodeCopy);
19048
19049 return NodeCopy;
19050 }
19051
19052
19053
19054
19055
19056
19057
19058
19059
19060
19061
19062
19063 UINT32 AttrFillEffectAltRainbow::GetAttrNameID(void)
19064 {
19065 return (_R(IDS_FILLEFFECTALTRAINBOW));
19066 }
19067
19068
19069
19070
19071
19072
19073
19074
19075
19076
19077
19078
19079
19080
19081
19082
19083 BOOL AttrFillEffectAltRainbow::CopyNodeContents(AttrFillEffectAltRainbow* NodeCopy)
19084 {
19085 ERROR2IF(NodeCopy == NULL, FALSE, "NULL pointer in AttrFillEffectAltRainbow::CopyNodeContents!");
19086
19087 NodeAttribute::CopyNodeContents(NodeCopy);
19088
19089
19090 NodeCopy->Value.SimpleCopy(&Value);
19091 return TRUE;
19092 }
19093
19094
19095
19096
19097
19098
19099
19100
19101
19102
19103
19104
19105
19106
19107 void AttrFillEffectAltRainbow::PolyCopyNodeContents(NodeRenderable* pNodeCopy)
19108 {
19109 ENSURE(pNodeCopy, "Trying to copy a node's contents into a NULL node");
19110 ENSURE(IS_A(pNodeCopy, AttrFillEffectAltRainbow), "PolyCopyNodeContents given wrong dest node type");
19111
19112 if (IS_A(pNodeCopy, AttrFillEffectAltRainbow))
19113 CopyNodeContents((AttrFillEffectAltRainbow*)pNodeCopy);
19114 }
19115
19116
19117
19118
19119
19120
19121
19122
19123
19124
19125
19126
19127
19128
19129
19130 UINT32 AttrFillEffectAltRainbow::GetNodeSize() const
19131 {
19132 return (sizeof(AttrFillEffectAltRainbow));
19133 }
19134
19135
19136
19137
19138
19139
19140
19141
19142
19143
19144
19145
19146
19147
19148
19149
19150 BOOL AttrFillEffectAltRainbow::WritePreChildrenWeb(BaseCamelotFilter* pFilter)
19151 {
19152 #ifdef DO_EXPORT
19153 ERROR2IF(pFilter == NULL,FALSE,"NULL filter param");
19154
19155 CamelotFileRecord Rec(pFilter,TAG_FILLEFFECT_ALTRAINBOW,TAG_FILLEFFECT_ALTRAINBOW_SIZE);
19156 return pFilter->Write(&Rec);
19157 #else
19158 return FALSE;
19159 #endif
19160 }
19161
19162
19163
19164
19165 BOOL AttrFillEffectAltRainbow::WritePreChildrenNative(BaseCamelotFilter* pFilter)
19166 {
19167 #ifdef DO_EXPORT
19168 return WritePreChildrenWeb(pFilter);
19169 #else
19170 return FALSE;
19171 #endif
19172 }
19173
19174
19175
19176
19177
19178
19179
19180
19181
19182
19183
19184
19185
19186
19187
19188
19189
19190 INT32 AttrTranspFillMapping::operator==(const NodeAttribute& Attrib)
19191 {
19192 ERROR3IF(!Attrib.IsKindOf(CC_RUNTIME_CLASS(AttrTranspFillMapping)),
19193 "Trying to compare two objects with different types");
19194
19195 return (GetRepeat() == ((AttrTranspFillMapping*)&Attrib)->GetRepeat());
19196 }
19197
19198
19199
19200
19201
19202
19203
19204
19205
19206
19207
19208
19209
19210
19211 NodeAttribute* AttrTranspFillMapping::GetOtherAttrToApply(BOOL* IsMutate)
19212 {
19213 #if !defined(EXCLUDE_FROM_RALPH)
19214 ERROR3IF(IsMutate == NULL, "NULL flag pointer passed to GetOtherAttrToApply");
19215
19216
19217
19218
19219 NodeAttribute* OtherAttr = new AttrFractalTileableChange;
19220 if (OtherAttr == NULL)
19221 return NULL;
19222
19223 ((AttrValueChange*)OtherAttr)->MutateTranspFills(TRUE);
19224
19225 INT32 Repeat = GetRepeat();
19226 BOOL Tile;
19227
19228 switch (Repeat)
19229 {
19230 case RT_Simple:
19231 Tile = FALSE;
19232 break;
19233
19234 case RT_Repeating:
19235 Tile = TRUE;
19236 break;
19237
19238 case RT_RepeatInverted:
19239 Tile = FALSE;
19240 break;
19241
19242 default:
19243 Tile = TRUE;
19244 break;
19245 }
19246
19247 ((AttrValueChange*)OtherAttr)->SetTileable(Tile);
19248
19249 *IsMutate = TRUE;
19250
19251 return OtherAttr;
19252 #else
19253 return NULL;
19254 #endif
19255 }
19256
19257
19258
19259
19260
19261
19262
19263
19264
19265
19266
19267 void AttrTranspFillMappingLinear::Render( RenderRegion* pRender)
19268 {
19269 pRender->SetTranspFillMapping(&Value, FALSE);
19270 }
19271
19272
19273
19274
19275
19276
19277
19278
19279
19280
19281
19282
19283
19284
19285
19286
19287
19288 Node* AttrTranspFillMappingLinear::SimpleCopy()
19289 {
19290 AttrTranspFillMappingLinear* NodeCopy = new AttrTranspFillMappingLinear;
19291 if (NodeCopy == NULL)
19292 return NULL;
19293
19294 CopyNodeContents(NodeCopy);
19295
19296 return NodeCopy;
19297 }
19298
19299
19300
19301
19302
19303
19304
19305
19306
19307
19308
19309
19310 UINT32 AttrTranspFillMappingLinear::GetAttrNameID(void)
19311 {
19312 return (_R(IDS_FILLMAPPINGLINEAR));
19313 }
19314
19315
19316
19317
19318
19319
19320
19321
19322
19323
19324
19325
19326
19327
19328
19329
19330 BOOL AttrTranspFillMappingLinear::CopyNodeContents(AttrTranspFillMappingLinear* NodeCopy)
19331 {
19332 ERROR2IF(NodeCopy == NULL, FALSE, "NULL pointer in AttrTranspFillMappingLinear::CopyNodeContents!");
19333
19334 NodeAttribute::CopyNodeContents(NodeCopy);
19335
19336
19337 NodeCopy->Value.SimpleCopy(&Value);
19338 return TRUE;
19339 }
19340
19341
19342
19343
19344
19345
19346
19347
19348
19349
19350
19351
19352
19353
19354 void AttrTranspFillMappingLinear::PolyCopyNodeContents(NodeRenderable* pNodeCopy)
19355 {
19356 ENSURE(pNodeCopy, "Trying to copy a node's contents into a NULL node");
19357 ENSURE(IS_A(pNodeCopy, AttrTranspFillMappingLinear), "PolyCopyNodeContents given wrong dest node type");
19358
19359 if (IS_A(pNodeCopy, AttrTranspFillMappingLinear))
19360 CopyNodeContents((AttrTranspFillMappingLinear*)pNodeCopy);
19361 }
19362
19363
19364
19365
19366
19367
19368
19369
19370
19371
19372
19373
19374
19375
19376
19377 UINT32 AttrTranspFillMappingLinear::GetNodeSize() const
19378 {
19379 return (sizeof(AttrTranspFillMappingLinear));
19380 }
19381
19382
19383
19384
19385
19386
19387
19388
19389
19390
19391
19392
19393
19394
19395
19396
19397 BOOL AttrTranspFillMappingLinear::WritePreChildrenWeb(BaseCamelotFilter* pFilter)
19398 {
19399 #ifdef DO_EXPORT
19400 ERROR2IF(pFilter == NULL,FALSE,"NULL filter param");
19401
19402 UINT32 Tag = TAG_UNDEFINED, TagSize = 1;
19403 switch (Value.Repeat)
19404 {
19405 case 0 :
19406 case 1 : Tag = TAG_TRANSPARENTFILL_NONREPEATING;
19407 TagSize = TAG_TRANSPARENTFILL_NONREPEATING_SIZE;
19408 break;
19409 case 2 : Tag = TAG_TRANSPARENTFILL_REPEATING;
19410 TagSize = TAG_TRANSPARENTFILL_REPEATING_SIZE;
19411 break;
19412 case 3 : Tag = TAG_TRANSPARENTFILL_REPEATINGINVERTED;
19413 TagSize = TAG_TRANSPARENTFILL_REPEATINGINVERTED_SIZE;
19414 break;
19415
19416
19417 #ifdef NEW_FEATURES
19418 case 4 : Tag = TAG_TRANSPARENTFILL_REPEATING_EXTRA;
19419 TagSize = TAG_TRANSPARENTFILL_REPEATING_EXTRA_SIZE;
19420 break;
19421 #endif
19422
19423 default:
19424 ERROR3("Unknown repeat type in this fill mapping attr");
19425 return FALSE;
19426 break;
19427 }
19428
19429 CamelotFileRecord Rec(pFilter,Tag,TagSize);
19430 return pFilter->Write(&Rec);
19431 #else
19432 return FALSE;
19433 #endif
19434 }
19435
19436
19437
19438
19439 BOOL AttrTranspFillMappingLinear::WritePreChildrenNative(BaseCamelotFilter* pFilter)
19440 {
19441 #ifdef DO_EXPORT
19442 return WritePreChildrenWeb(pFilter);
19443 #else
19444 return FALSE;
19445 #endif
19446 }
19447
19448
19449
19450
19451
19452
19453
19454
19455
19456
19457
19458
19459
19460
19461
19462
19463 BOOL AttrTranspFillMappingLinear::HasEquivalentDefaultValue(BOOL bAppearance)
19464 {
19465 return (Value.Repeat==2);
19466 }
19467
19468
19469
19470
19471
19472
19473
19474
19475
19476
19477
19478
19479
19480
19481 void AttrTranspFillMappingSin::Render( RenderRegion* pRender)
19482 {
19483 pRender->SetTranspFillMapping(&Value, FALSE);
19484 }
19485
19486
19487
19488
19489
19490
19491
19492
19493
19494
19495
19496
19497
19498
19499
19500
19501 Node* AttrTranspFillMappingSin::SimpleCopy()
19502 {
19503 AttrTranspFillMappingSin* NodeCopy = new AttrTranspFillMappingSin();
19504 if (NodeCopy == NULL)
19505 return NULL;
19506
19507 CopyNodeContents(NodeCopy);
19508
19509 return NodeCopy;
19510 }
19511
19512
19513
19514
19515
19516
19517
19518
19519
19520
19521
19522
19523 UINT32 AttrTranspFillMappingSin::GetAttrNameID(void)
19524 {
19525 return (_R(IDS_FILLMAPPINGSIN));
19526 }
19527
19528
19529
19530
19531
19532
19533
19534
19535
19536
19537
19538
19539
19540
19541
19542
19543 BOOL AttrTranspFillMappingSin::CopyNodeContents(AttrTranspFillMappingSin* NodeCopy)
19544 {
19545 ERROR2IF(NodeCopy == NULL, FALSE, "NULL pointer in AttrTranspFillMappingSin::CopyNodeContents!");
19546
19547 NodeAttribute::CopyNodeContents(NodeCopy);
19548
19549
19550 NodeCopy->Value.SimpleCopy(&Value);
19551 return TRUE;
19552 }
19553
19554
19555
19556
19557
19558
19559
19560
19561
19562
19563
19564
19565
19566
19567 void AttrTranspFillMappingSin::PolyCopyNodeContents(NodeRenderable* pNodeCopy)
19568 {
19569 ENSURE(pNodeCopy, "Trying to copy a node's contents into a NULL node");
19570 ENSURE(IS_A(pNodeCopy, AttrTranspFillMappingSin), "PolyCopyNodeContents given wrong dest node type");
19571
19572 if (IS_A(pNodeCopy, AttrTranspFillMappingSin))
19573 CopyNodeContents((AttrTranspFillMappingSin*)pNodeCopy);
19574 }
19575
19576
19577
19578
19579
19580
19581
19582
19583
19584
19585
19586
19587
19588
19589
19590 UINT32 AttrTranspFillMappingSin::GetNodeSize() const
19591 {
19592 return (sizeof(AttrTranspFillMappingSin));
19593 }
19594
19595
19596
19597
19598
19599
19600
19601
19602
19603
19604
19605
19606
19607
19608
19609
19610
19611
19612
19613 BOOL AttrTranspFillMappingSin::WritePreChildrenWeb(BaseCamelotFilter* pFilter)
19614 {
19615 #ifdef DO_EXPORT
19616 ERROR2IF(pFilter == NULL,FALSE,"NULL filter param");
19617
19618 ERROR3("v2 file format does not support this attribute");
19619 return FALSE;
19620 #else
19621 return FALSE;
19622 #endif
19623 }
19624
19625
19626
19627
19628 BOOL AttrTranspFillMappingSin::WritePreChildrenNative(BaseCamelotFilter* pFilter)
19629 {
19630 #ifdef DO_EXPORT
19631 return WritePreChildrenWeb(pFilter);
19632 #else
19633 return FALSE;
19634 #endif
19635 }
19636
19637
19638
19639
19640
19641
19642
19643
19644
19645
19646
19647
19648
19649 AttrMould::AttrMould(NodeMould* pMould, MouldGeometry* pMouldShape)
19650 {
19651 SetParentMould(pMould);
19652 SetMouldShape(pMouldShape);
19653 }
19654
19655
19656
19657
19658
19659
19660
19661
19662
19663
19664
19665
19666
19667
19668
19669
19670
19671 INT32 AttrMould::operator==(const NodeAttribute& Attrib)
19672 {
19673 ERROR3IF(!Attrib.IsKindOf(CC_RUNTIME_CLASS(AttrMould)),
19674 "Trying to compare two objects with different types");
19675
19676 return (GetParentMould() == ((AttrMould*)&Attrib)->GetParentMould());
19677 }
19678
19679
19680
19681
19682
19683
19684
19685
19686
19687
19688
19689 void AttrMould::Render( RenderRegion* pRender)
19690 {
19691
19692 }
19693
19694
19695
19696
19697
19698
19699
19700
19701
19702
19703
19704
19705
19706
19707
19708
19709 Node* AttrMould::SimpleCopy()
19710 {
19711 AttrMould* NodeCopy = new AttrMould;
19712 if (NodeCopy == NULL)
19713 return NULL;
19714
19715 CopyNodeContents(NodeCopy);
19716
19717 return NodeCopy;
19718 }
19719
19720
19721
19722
19723
19724
19725
19726
19727
19728
19729
19730
19731 UINT32 AttrMould::GetAttrNameID(void)
19732 {
19733 return (_R(IDS_ATTRMOULD));
19734 }
19735
19736
19737
19738
19739
19740
19741
19742
19743
19744
19745
19746
19747
19748
19749
19750 BOOL AttrMould::CopyNodeContents(AttrMould* NodeCopy)
19751 {
19752 ERROR2IF(NodeCopy == NULL, FALSE, "NULL pointer in AttrMould::CopyNodeContents!");
19753
19754 NodeAttribute::CopyNodeContents(NodeCopy);
19755
19756
19757 NodeCopy->Value.SimpleCopy(&Value);
19758 return TRUE;
19759 }
19760
19761
19762
19763
19764
19765
19766
19767
19768
19769
19770
19771
19772
19773 void AttrMould::PolyCopyNodeContents(NodeRenderable* pNodeCopy)
19774 {
19775 ENSURE(pNodeCopy, "Trying to copy a node's contents into a NULL node");
19776 ENSURE(IS_A(pNodeCopy, AttrMould), "PolyCopyNodeContents given wrong dest node type");
19777
19778 if (IS_A(pNodeCopy, AttrMould))
19779 CopyNodeContents((AttrMould*)pNodeCopy);
19780 }
19781
19782
19783
19784
19785
19786
19787
19788
19789
19790
19791
19792
19793
19794
19795
19796 UINT32 AttrMould::GetNodeSize() const
19797 {
19798 return (sizeof(AttrMould));
19799 }
19800
19801
19802
19803
19804
19805
19806
19807
19808
19809
19810 BOOL AttrFillGeometry::Blend(BlendAttrParam* pBlendParam)
19811 {
19812
19813 ERROR3IF(pBlendParam == NULL,"NULL entry param");
19814 if (pBlendParam == NULL) return FALSE;
19815
19816
19817
19818
19819 if (GetAttributeValue()->Blend(pBlendParam))
19820 {
19821
19822
19823 AttributeValue* pBlendedAttrVal = pBlendParam->GetBlendedAttrVal();
19824
19825 if (pBlendedAttrVal != NULL)
19826 {
19827
19828
19829 NodeAttribute* pBlendedAttr = pBlendedAttrVal->MakeNode();
19830 pBlendParam->SetBlendedAttr(pBlendedAttr);
19831
19832 if (pBlendedAttr != NULL)
19833 {
19834
19835
19836 delete pBlendedAttrVal;
19837 return TRUE;
19838 }
19839 else
19840 {
19841
19842
19843 pBlendParam->SetBlendedAttrVal(pBlendedAttrVal);
19844 return FALSE;
19845 }
19846 }
19847 }
19848
19849 return FALSE;
19850 }
19851
19852
19853
19854
19855
19856
19857
19858
19859
19860
19861
19862
19863
19864
19865
19866
19867
19868
19869
19870
19871
19872
19873
19874
19875
19876
19877 DocRect AttrFillGeometry::ValidateExtend(const ExtendParams& ExtParams)
19878 {
19879
19880 if (!IsAGradFill())
19881 return DocRect(INT32_MAX, INT32_MAX, INT32_MAX, INT32_MAX);
19882
19883
19884 INT32 i = 0;
19885 DocCoord doccHandles[3];
19886 DocCoord* pDocc = GetStartPoint();
19887 if (pDocc != NULL)
19888 doccHandles[i ++] = *pDocc;
19889
19890 pDocc = GetEndPoint();
19891 if (pDocc != NULL)
19892 doccHandles[i ++] = *pDocc;
19893
19894 pDocc = GetEndPoint2();
19895 if (pDocc != NULL)
19896 doccHandles[i ++] = *pDocc;
19897
19898
19899
19900 INT32 numPoints = GetNumberOfControlPoints();
19901 return Extender::ValidateControlPoints(numPoints, doccHandles, ExtParams);
19902 }
19903
19904
19905
19906
19907
19908
19909
19910
19911
19912
19913
19914
19915
19916
19917
19918
19919
19920 void AttrFillGeometry::Extend(const ExtendParams& ExtParams)
19921 {
19922
19923 if (!IsAGradFill())
19924 return;
19925
19926
19927
19928 Node* pParent = FindParent();
19929 if (pParent != NULL)
19930 if (pParent->IsNodePath() || pParent->IsCompound())
19931 TransformTranslateObject(ExtParams);
19932 }
19933
19934
19935
19936
19937
19938
19939
19940
19941
19942
19943
19944
19945
19946
19947
19948
19949
19950
19951
19952
19953
19954
19955
19956
19957 void AttrFillGeometry::TransformTranslateObject(const ExtendParams& ExtParams)
19958 {
19959
19960 INT32 pointIndex = 0;
19961 DocCoord* doccpHandles[3];
19962 DocCoord* pDocc = GetStartPoint();
19963 if (pDocc != NULL)
19964 doccpHandles[pointIndex ++] = pDocc;
19965
19966 pDocc = GetEndPoint();
19967 if (pDocc != NULL)
19968 doccpHandles[pointIndex ++] = pDocc;
19969
19970 pDocc = GetEndPoint2();
19971 if (pDocc != NULL)
19972 doccpHandles[pointIndex ++] = pDocc;
19973
19974 INT32 numPoints = GetNumberOfControlPoints();
19975
19976
19977 if (ExtParams.fExtendFlags & X_EXTEND)
19978 {
19979
19980
19981 Node* pParent = FindParent();
19982 if (pParent != NULL && pParent->IsCompound())
19983 {
19984 Trans2DMatrix baseXoffset(ExtParams.doccOffset.x, 0);
19985 Transform(baseXoffset);
19986 }
19987
19988 for (INT32 i = 0; i < numPoints; i ++)
19989 {
19990 if (doccpHandles[i]->x > ExtParams.doccEndCentre.x + ExtParams.xincExtendBuffer)
19991 doccpHandles[i]->x += ExtParams.xinc;
19992 else if (doccpHandles[i]->x < ExtParams.doccEndCentre.x - ExtParams.xdecExtendBuffer)
19993 doccpHandles[i]->x -= ExtParams.xdec;
19994 }
19995 }
19996
19997
19998 if (ExtParams.fExtendFlags & Y_EXTEND)
19999 {
20000
20001
20002 Node* pParent = FindParent();
20003 if (pParent != NULL && pParent->IsCompound())
20004 {
20005 Trans2DMatrix baseYoffset(0, ExtParams.doccOffset.y);
20006 Transform(baseYoffset);
20007 }
20008
20009 for (INT32 i = 0; i < numPoints; i ++)
20010 {
20011 if (doccpHandles[i]->y > ExtParams.doccEndCentre.y + ExtParams.yincExtendBuffer)
20012 doccpHandles[i]->y += ExtParams.yinc;
20013 else if (doccpHandles[i]->y < ExtParams.doccEndCentre.y - ExtParams.ydecExtendBuffer)
20014 doccpHandles[i]->y -= ExtParams.ydec;
20015 }
20016 }
20017
20018
20019 SetEndPoint3(NULL);
20020 }
20021
20022
20023
20024
20025
20026
20027
20028
20029
20030
20031
20032
20033
20034
20035
20036
20037 void AttrLinearFill::TransformTranslateObject(const ExtendParams& ExtParams)
20038 {
20039
20040 AttrFillGeometry::TransformTranslateObject(ExtParams);
20041
20042
20043
20044 SetEndPoint2(NULL);
20045 }
20046
20047
20048
20049
20050
20051
20052
20053
20054
20055
20056
20057
20058
20059
20060
20061
20062 void AttrRadialFill::TransformTranslateObject(const ExtendParams& ExtParams)
20063 {
20064
20065 AttrFillGeometry::TransformTranslateObject(ExtParams);
20066
20067
20068
20069 if (IsCircular())
20070 {
20071 DocCoord Start = *GetStartPoint();
20072 DocCoord End1 = *GetEndPoint();
20073 DocCoord End2 = MakeLineAtAngle(Start, End1, 90, (INT32)Start.Distance(End1));
20074 SetEndPoint2(&End2);
20075 }
20076 }
20077
20078
20079
20080
20081
20082
20083
20084
20085
20086
20087
20088
20089
20090
20091
20092
20093
20094
20095
20096
20097 BOOL AttrFlatTranspFill::NeedsTransparency() const
20098 {
20099 AttrFlatTranspFill* pNonConst = (AttrFlatTranspFill*) this;
20100 return pNonConst->GetTranspType() != TT_Mix || *(pNonConst->GetStartTransp()) != 0;
20101 }
20102
20103
20104
20105
20106
20107
20108
20109
20110
20111
20112
20113
20114
20115
20116
20117
20118 BOOL AttrLinearTranspFill::NeedsTransparency() const
20119 {
20120 AttrLinearTranspFill* pNonConst = (AttrLinearTranspFill*) this;
20121 return ( pNonConst->GetTranspType() != TT_Mix ||
20122 *(pNonConst->GetStartTransp()) != 0 ||
20123 *(pNonConst->GetEndTransp()) != 0 );
20124 }
20125
20126
20127
20128
20129
20130
20131
20132
20133
20134
20135
20136
20137
20138
20139
20140
20141 BOOL AttrRadialTranspFill::NeedsTransparency() const
20142 {
20143 AttrRadialTranspFill* pNonConst = (AttrRadialTranspFill*) this;
20144 return ( pNonConst->GetTranspType() != TT_Mix ||
20145 *(pNonConst->GetStartTransp()) != 0 ||
20146 *(pNonConst->GetEndTransp()) != 0 );
20147 }
20148
20149
20150
20151
20152
20153
20154
20155
20156
20157
20158
20159
20160
20161
20162
20163
20164 BOOL AttrConicalTranspFill::NeedsTransparency() const
20165 {
20166 AttrConicalTranspFill* pNonConst = (AttrConicalTranspFill*) this;
20167 return ( pNonConst->GetTranspType() != TT_Mix ||
20168 *(pNonConst->GetStartTransp()) != 0 ||
20169 *(pNonConst->GetEndTransp()) != 0 );
20170 }
20171
20172
20173
20174
20175
20176
20177
20178
20179
20180
20181
20182
20183
20184
20185
20186
20187 BOOL AttrBitmapTranspFill::NeedsTransparency() const
20188 {
20189 return TRUE;
20190 }
20191
20192
20193
20194
20195
20196
20197
20198
20199
20200
20201
20202
20203
20204 FillAttrBlobState::FillAttrBlobState()
20205 {
20206 count=0;
20207 pFillAttr=NULL;
20208 SelectionState=NULL;
20209 }
20210
20211
20212
20213
20214
20215
20216
20217
20218
20219
20220
20221 FillAttrBlobState::~FillAttrBlobState()
20222 {
20223 if (SelectionState!=NULL)
20224 {
20225 free(SelectionState);
20226 SelectionState=NULL;
20227 }
20228 }
20229
20230
20231
20232
20233
20234
20235
20236
20237
20238
20239
20240
20241
20242 BOOL FillAttrBlobState::operator==(FillAttrBlobState& BlobState)
20243 {
20244 if (pFillAttr != BlobState.pFillAttr)
20245 return FALSE;
20246
20247 if (count != BlobState.count)
20248 return FALSE;
20249
20250 if (pFillAttr != NULL)
20251 {
20252 if (SelectionState==NULL || BlobState.SelectionState==NULL)
20253 return FALSE;
20254
20255 for (UINT32 i=0; i<count; i++)
20256 {
20257 if (SelectionState[i] != BlobState.SelectionState[i])
20258 return FALSE;
20259 }
20260 }
20261
20262 return TRUE;
20263 }
20264
20265
20266
20267
20268
20269
20270
20271
20272
20273
20274
20275 FillBlobSelectionState::FillBlobSelectionState()
20276 {
20277 BlobCount = 0;
20278 FillType = NULL;
20279 }
20280
20281
20282
20283
20284
20285
20286
20287
20288
20289
20290
20291
20292 FillBlobSelectionState::~FillBlobSelectionState()
20293 {
20294 BlobStateList.DeleteAll();
20295 }
20296
20297
20298
20299
20300
20301
20302
20303
20304
20305
20306
20307
20308
20309 BOOL FillBlobSelectionState::Record()
20310 {
20311 #if !defined(EXCLUDE_FROM_RALPH)
20312 BlobStateList.DeleteAll();
20313 FillType = NULL;
20314
20315 if (GetApplication()->GetBlobManager()->GetCurrentInterest().Fill)
20316 {
20317 FillType = AttrFillGeometry::IsColourMeshVisible() ? CC_RUNTIME_CLASS(AttrFillGeometry)
20318 : CC_RUNTIME_CLASS(AttrTranspFillGeometry);
20319
20320
20321 AttrFillGeometry* pAttr = AttrFillGeometry::FindFirstSelectedAttr(FillType);
20322
20323 while (pAttr != NULL)
20324 {
20325
20326
20327 if (pAttr->IsVisible())
20328 {
20329 if (pAttr->GetSelectionCount() > 0)
20330 {
20331 FillAttrBlobState* pBlobState = new FillAttrBlobState();
20332 if (pBlobState != NULL)
20333 {
20334 pBlobState->pFillAttr = pAttr;
20335 pBlobState->count = pAttr->GetSelectionState(&(pBlobState->SelectionState));
20336 BlobStateList.AddTail(pBlobState);
20337 }
20338 }
20339 }
20340
20341
20342 pAttr = AttrFillGeometry::FindNextSelectedAttr(FillType);
20343 }
20344 }
20345 #endif
20346 return TRUE;
20347 }
20348
20349
20350
20351
20352
20353
20354
20355
20356
20357
20358
20359
20360 BOOL FillBlobSelectionState::operator==(FillBlobSelectionState& SelState)
20361 {
20362 #if !defined(EXCLUDE_FROM_RALPH)
20363
20364 if (FillType != SelState.FillType)
20365 return FALSE;
20366
20367
20368 if (BlobCount != SelState.BlobCount)
20369 return FALSE;
20370
20371
20372 if (BlobStateList.GetCount() != SelState.BlobStateList.GetCount())
20373 return FALSE;
20374
20375
20376 if (BlobStateList.GetCount() > 0)
20377 {
20378 FillAttrBlobState* pBlobState = (FillAttrBlobState*)BlobStateList.GetHead();
20379 FillAttrBlobState* pOtherBlobState = (FillAttrBlobState*)SelState.BlobStateList.GetHead();
20380
20381 while (pBlobState != NULL && pOtherBlobState != NULL)
20382 {
20383 if ( !(*pBlobState == *pOtherBlobState) )
20384 return FALSE;
20385
20386 pBlobState = (FillAttrBlobState*)BlobStateList.GetNext(pBlobState);
20387 pOtherBlobState = (FillAttrBlobState*)SelState.BlobStateList.GetNext(pOtherBlobState);
20388 }
20389 }
20390 #endif
20391 return TRUE;
20392 }
20393
20394
20395
20396
20397
20398
20399
20400
20401
20402
20403
20404
20405
20406
20407
20408
20409
20410
20411
20412
20413 UINT32* FillAttrRecordHandler::GetTagList()
20414 {
20415 static UINT32 TagList[] = { TAG_FLATFILL,
20416 TAG_FLATFILL_NONE,
20417 TAG_FLATFILL_BLACK,
20418 TAG_FLATFILL_WHITE,
20419 TAG_LINEARFILL,
20420 TAG_LINEARFILL3POINT,
20421 TAG_ELLIPTICALFILL,
20422 TAG_CIRCULARFILL,
20423 TAG_CONICALFILL,
20424 TAG_SQUAREFILL,
20425 TAG_THREECOLFILL,
20426 TAG_FOURCOLFILL,
20427 TAG_BITMAPFILL,
20428 TAG_CONTONEBITMAPFILL,
20429 TAG_FRACTALFILL,
20430 TAG_NOISEFILL,
20431
20432 TAG_FLATTRANSPARENTFILL,
20433 TAG_LINEARTRANSPARENTFILL,
20434 TAG_LINEARTRANSPARENTFILL3POINT,
20435 TAG_ELLIPTICALTRANSPARENTFILL,
20436 TAG_CIRCULARTRANSPARENTFILL,
20437 TAG_CONICALTRANSPARENTFILL,
20438 TAG_SQUARETRANSPARENTFILL,
20439 TAG_THREECOLTRANSPARENTFILL,
20440 TAG_FOURCOLTRANSPARENTFILL,
20441 TAG_BITMAPTRANSPARENTFILL,
20442 TAG_FRACTALTRANSPARENTFILL,
20443 TAG_NOISETRANSPARENTFILL,
20444
20445 TAG_FILL_REPEATING,
20446 TAG_FILL_NONREPEATING,
20447 TAG_FILL_REPEATINGINVERTED,
20448
20449 #ifdef NEW_FEATURES
20450 TAG_FILL_REPEATING_EXTRA,
20451 TAG_TRANSPARENTFILL_REPEATING_EXTRA,
20452 #endif
20453 TAG_TRANSPARENTFILL_REPEATING,
20454 TAG_TRANSPARENTFILL_NONREPEATING,
20455 TAG_TRANSPARENTFILL_REPEATINGINVERTED,
20456
20457 TAG_FILLEFFECT_ALTRAINBOW,
20458 TAG_FILLEFFECT_RAINBOW,
20459 TAG_FILLEFFECT_FADE,
20460 TAG_LINEARFILLMULTISTAGE,
20461 TAG_LINEARFILLMULTISTAGE3POINT,
20462 TAG_CIRCULARFILLMULTISTAGE,
20463 TAG_ELLIPTICALFILLMULTISTAGE,
20464 TAG_CONICALFILLMULTISTAGE,
20465 TAG_SQUAREFILLMULTISTAGE,
20466
20467 CXFRH_TAG_LIST_END};
20468
20469 return (UINT32*)&TagList;
20470 }
20471
20472
20473
20474
20475
20476
20477
20478
20479
20480
20481
20482
20483
20484
20485
20486 BOOL FillAttrRecordHandler::HandleRecord(CXaraFileRecord* pCXaraFileRecord)
20487 {
20488 ERROR2IF(pCXaraFileRecord == NULL,FALSE,"pCXaraFileRecord is NULL");
20489
20490 BOOL ok = TRUE;
20491
20492 switch (pCXaraFileRecord->GetTag())
20493 {
20494 case TAG_FLATFILL:
20495 case TAG_FLATFILL_NONE:
20496 case TAG_FLATFILL_BLACK:
20497 case TAG_FLATFILL_WHITE: ok = HandleFlatFillRecord(pCXaraFileRecord); break;
20498
20499 case TAG_LINEARFILL3POINT:
20500 case TAG_LINEARFILL: ok = HandleLinearFillRecord(pCXaraFileRecord); break;
20501 case TAG_LINEARFILLMULTISTAGE3POINT:
20502 case TAG_LINEARFILLMULTISTAGE: ok = HandleMultiStageLinearFillRecord(pCXaraFileRecord); break;
20503 case TAG_ELLIPTICALFILL:
20504 case TAG_CIRCULARFILL: ok = HandleEllipticalFillRecord(pCXaraFileRecord); break;
20505 case TAG_ELLIPTICALFILLMULTISTAGE:
20506 case TAG_CIRCULARFILLMULTISTAGE: ok = HandleMultiStageCircularFillRecord(pCXaraFileRecord); break;
20507 case TAG_CONICALFILL: ok = HandleConicalFillRecord(pCXaraFileRecord); break;
20508 case TAG_CONICALFILLMULTISTAGE: ok = HandleMultiStageConicalFillRecord(pCXaraFileRecord); break;
20509 case TAG_SQUAREFILL: ok = HandleSquareFillRecord(pCXaraFileRecord); break;
20510 case TAG_SQUAREFILLMULTISTAGE: ok = HandleMultiStageSquareFillRecord(pCXaraFileRecord); break;
20511 case TAG_THREECOLFILL: ok = HandleThreeColFillRecord(pCXaraFileRecord); break;
20512 case TAG_FOURCOLFILL: ok = HandleFourColFillRecord(pCXaraFileRecord); break;
20513 case TAG_BITMAPFILL:
20514 case TAG_CONTONEBITMAPFILL: ok = HandleBitmapFillRecord(pCXaraFileRecord); break;
20515 case TAG_FRACTALFILL: ok = HandleFractalFillRecord(pCXaraFileRecord); break;
20516 case TAG_NOISEFILL: ok = HandleNoiseFillRecord(pCXaraFileRecord); break;
20517
20518 case TAG_FLATTRANSPARENTFILL: ok = HandleFlatTransparentFillRecord(pCXaraFileRecord); break;
20519 case TAG_LINEARTRANSPARENTFILL3POINT:
20520 case TAG_LINEARTRANSPARENTFILL: ok = HandleLinearTransparentFillRecord(pCXaraFileRecord); break;
20521 case TAG_ELLIPTICALTRANSPARENTFILL:
20522 case TAG_CIRCULARTRANSPARENTFILL: ok = HandleEllipticalTransparentFillRecord(pCXaraFileRecord); break;
20523 case TAG_CONICALTRANSPARENTFILL: ok = HandleConicalTransparentFillRecord(pCXaraFileRecord); break;
20524 case TAG_SQUARETRANSPARENTFILL: ok = HandleSquareTransparentFillRecord(pCXaraFileRecord); break;
20525 case TAG_THREECOLTRANSPARENTFILL: ok = HandleThreeColTransparentFillRecord(pCXaraFileRecord); break;
20526 case TAG_FOURCOLTRANSPARENTFILL: ok = HandleFourColTransparentFillRecord(pCXaraFileRecord); break;
20527
20528 case TAG_BITMAPTRANSPARENTFILL: ok = HandleBitmapTransparentFillRecord(pCXaraFileRecord); break;
20529 case TAG_FRACTALTRANSPARENTFILL: ok = HandleFractalTransparentFillRecord(pCXaraFileRecord); break;
20530 case TAG_NOISETRANSPARENTFILL: ok = HandleNoiseTransparentFillRecord(pCXaraFileRecord); break;
20531
20532 case TAG_FILL_REPEATING:
20533
20534 #ifdef NEW_FEATURES
20535 case TAG_FILL_REPEATING_EXTRA:
20536 #endif
20537 case TAG_FILL_NONREPEATING:
20538 case TAG_FILL_REPEATINGINVERTED: ok = HandleFillRepeatRecord(pCXaraFileRecord); break;
20539
20540 #ifdef NEW_FEATURES
20541 case TAG_TRANSPARENTFILL_REPEATING_EXTRA:
20542 #endif
20543 case TAG_TRANSPARENTFILL_REPEATING:
20544 case TAG_TRANSPARENTFILL_NONREPEATING:
20545 case TAG_TRANSPARENTFILL_REPEATINGINVERTED: ok = HandleTransparentFillRepeatRecord(pCXaraFileRecord); break;
20546
20547 case TAG_FILLEFFECT_ALTRAINBOW:
20548 case TAG_FILLEFFECT_RAINBOW:
20549 case TAG_FILLEFFECT_FADE: ok = HandleFillEffectRecord(pCXaraFileRecord); break;
20550
20551 default:
20552 ok = FALSE;
20553 ERROR3_PF(("I don't handle records with the tag (%d)\n",pCXaraFileRecord->GetTag()));
20554 break;
20555 }
20556
20557 return ok;
20558 }
20559
20560
20561
20562
20563
20564
20565
20566
20567
20568
20569
20570
20571
20572
20573
20574
20575
20576 BOOL FillAttrRecordHandler::HandleFlatFillRecord(CXaraFileRecord* pCXaraFileRecord)
20577 {
20578 ERROR2IF(pCXaraFileRecord == NULL,FALSE,"pCXaraFileRecord is NULL");
20579
20580 INT32 ColourRef;
20581 INT32 Tag = pCXaraFileRecord->GetTag();
20582 BOOL ok = TRUE;
20583
20584
20585 switch (Tag)
20586 {
20587 case TAG_FLATFILL:
20588 ok = pCXaraFileRecord->ReadINT32(&ColourRef);
20589 break;
20590 case TAG_FLATFILL_NONE:
20591 ColourRef = REF_DEFAULTCOLOUR_TRANSPARENT;
20592 break;
20593 case TAG_FLATFILL_BLACK:
20594 ColourRef = REF_DEFAULTCOLOUR_BLACK;
20595 break;
20596 case TAG_FLATFILL_WHITE:
20597 ColourRef = REF_DEFAULTCOLOUR_WHITE;
20598 break;
20599 default:
20600 ERROR2(FALSE,"I don't handle this tag type");
20601 }
20602
20603 if (ok)
20604 {
20605 AttrFlatColourFill* pAttr = new AttrFlatColourFill;
20606 if (pAttr != NULL)
20607 {
20608 FlatFillAttribute* pValue = (FlatFillAttribute*)pAttr->GetAttributeValue();
20609
20610 if (pValue != NULL)
20611 {
20612 if (ok) ok = GetDocColour(ColourRef,&(pValue->Colour));
20613 if (ok) ok = InsertNode(pAttr);
20614 }
20615 else
20616 ok = FALSE;
20617 }
20618 else
20619 ok = FALSE;
20620 }
20621
20622 return ok;
20623 }
20624
20625
20626
20627
20628
20629
20630
20631
20632
20633
20634
20635
20636
20637
20638
20639
20640 BOOL FillAttrRecordHandler::HandleLinearFillRecord(CXaraFileRecord* pCXaraFileRecord)
20641 {
20642 UINT32 tag = pCXaraFileRecord->GetTag();
20643 ERROR2IF(pCXaraFileRecord == NULL, FALSE, "pCXaraFileRecord is NULL");
20644 ERROR2IF(tag!=TAG_LINEARFILL && tag!=TAG_LINEARFILL3POINT, FALSE, "I don't handle this tag type");
20645
20646 BOOL ok = TRUE;
20647 BOOL b3PointLinear = (tag==TAG_LINEARFILL3POINT);
20648
20649 DocCoord StartPoint, EndPoint, EndPoint2;
20650 INT32 StartColourRef,EndColourRef;
20651 double Bias = 0, Gain = 0;
20652 double* ptrBias = &Bias, *ptrGain = &Gain;
20653
20654
20655 if (ok) ok = pCXaraFileRecord->ReadCoord(&StartPoint);
20656 if (ok) ok = pCXaraFileRecord->ReadCoord(&EndPoint);
20657 if (ok && b3PointLinear) ok = pCXaraFileRecord->ReadCoord(&EndPoint2);
20658 if (ok) ok = pCXaraFileRecord->ReadINT32(&StartColourRef);
20659 if (ok) ok = pCXaraFileRecord->ReadINT32(&EndColourRef);
20660 if (ok) ok = pCXaraFileRecord->ReadDOUBLEnoError (ptrBias);
20661 if (ok) ok = pCXaraFileRecord->ReadDOUBLEnoError (ptrGain);
20662
20663 CProfileBiasGain Profile;
20664
20665 if ((ptrBias != NULL) && (ptrGain != NULL))
20666 {
20667 Profile.SetBias((AFp) Bias);
20668 Profile.SetGain((AFp) Gain);
20669 }
20670
20671 if (ok)
20672 {
20673 AttrLinearColourFill* pAttr = new AttrLinearColourFill;
20674 if (pAttr != NULL)
20675 {
20676
20677 LinearFillAttribute* pValue = (LinearFillAttribute*)pAttr->GetAttributeValue();
20678
20679 if (pValue != NULL)
20680 {
20681
20682 pValue->SetStartPoint(&StartPoint);
20683 pValue->SetEndPoint(&EndPoint);
20684 if (b3PointLinear)
20685 pValue->SetEndPoint2(&EndPoint2);
20686 else
20687 pValue->SetEndPoint2(NULL);
20688
20689
20690 pValue->SetProfile (Profile);
20691
20692
20693 if (ok) ok = GetDocColour(StartColourRef,&(pValue->Colour));
20694 if (ok) ok = GetDocColour(EndColourRef,&(pValue->EndColour));
20695 if (ok) ok = InsertNode(pAttr);
20696 }
20697 else
20698 ok = FALSE;
20699 }
20700 else
20701 ok = FALSE;
20702 }
20703
20704 return ok;
20705 }
20706
20707
20708
20709
20710
20711
20712
20713
20714
20715
20716
20717
20718
20719
20720
20721
20722
20723 BOOL FillAttrRecordHandler::HandleMultiStageLinearFillRecord(CXaraFileRecord* pCXaraFileRecord)
20724 {
20725 UINT32 tag = pCXaraFileRecord->GetTag();
20726 ERROR2IF(pCXaraFileRecord == NULL,FALSE,"pCXaraFileRecord is NULL");
20727 ERROR2IF(tag!=TAG_LINEARFILLMULTISTAGE && tag!=TAG_LINEARFILLMULTISTAGE3POINT, FALSE, "I don't handle this tag type");
20728
20729 BOOL ok = TRUE;
20730 BOOL b3PointLinear = (tag==TAG_LINEARFILLMULTISTAGE3POINT);
20731
20732 DocCoord StartPoint, EndPoint, EndPoint2;
20733 INT32 StartColourRef,EndColourRef;
20734
20735
20736 if (ok) ok = pCXaraFileRecord->ReadCoord(&StartPoint);
20737 if (ok) ok = pCXaraFileRecord->ReadCoord(&EndPoint);
20738 if (ok && b3PointLinear) ok = pCXaraFileRecord->ReadCoord(&EndPoint2);
20739 if (ok) ok = pCXaraFileRecord->ReadINT32(&StartColourRef);
20740 if (ok) ok = pCXaraFileRecord->ReadINT32(&EndColourRef);
20741
20742
20743 INT32 * pColRecs = NULL;
20744 UINT32 NumRecords = 0;
20745
20746 if (ok) ok = pCXaraFileRecord->ReadUINT32(&NumRecords);
20747
20748 pColRecs = new INT32[NumRecords];
20749
20750 double *pPositions = new double[NumRecords];
20751
20752 UINT32 i;
20753 for( i = 0 ; i < NumRecords; i++)
20754 {
20755 if (ok) ok = pCXaraFileRecord->ReadDOUBLE(&(pPositions[i]));
20756 if (ok) ok = pCXaraFileRecord->ReadINT32(&(pColRecs[i]));
20757 }
20758
20759 DocColour Colour;
20760
20761 if (ok)
20762 {
20763 AttrLinearColourFill* pAttr = new AttrLinearColourFill;
20764 if (pAttr != NULL)
20765 {
20766
20767 LinearFillAttribute* pValue = (LinearFillAttribute*)pAttr->GetAttributeValue();
20768
20769 if (pValue != NULL)
20770 {
20771
20772 pValue->SetStartPoint(&StartPoint);
20773 pValue->SetEndPoint(&EndPoint);
20774 if (b3PointLinear)
20775 pValue->SetEndPoint2(&EndPoint2);
20776 else
20777 pValue->SetEndPoint2(NULL);
20778
20779
20780 if (ok) ok = GetDocColour(StartColourRef,&(pValue->Colour));
20781 if (ok) ok = GetDocColour(EndColourRef,&(pValue->EndColour));
20782
20783
20784 ColourRamp * pRamp = pValue->MakeNewColourRamp();
20785
20786 for (i = 0 ; i < NumRecords; i++)
20787 {
20788
20789 if (ok) ok = GetDocColour(pColRecs[i], &Colour);
20790
20791 if (ok) pRamp->AddEntry((float)pPositions[i], &Colour);
20792 }
20793
20794 if (ok) ok = InsertNode(pAttr);
20795 }
20796 else
20797 ok = FALSE;
20798 }
20799 else
20800 ok = FALSE;
20801 }
20802
20803 if (pPositions)
20804 delete [] pPositions;
20805
20806 if (pColRecs)
20807 delete [] pColRecs;
20808
20809 return ok;
20810 }
20811
20812
20813
20814
20815
20816
20817
20818
20819
20820
20821
20822
20823
20824
20825
20826
20827
20828 BOOL FillAttrRecordHandler::HandleEllipticalFillRecord(CXaraFileRecord* pCXaraFileRecord)
20829 {
20830 UINT32 Tag = pCXaraFileRecord->GetTag();
20831
20832 ERROR2IF(pCXaraFileRecord == NULL,FALSE,"pCXaraFileRecord is NULL");
20833 ERROR2IF(Tag != TAG_ELLIPTICALFILL && Tag != TAG_CIRCULARFILL,FALSE,"I don't handle this tag type");
20834
20835 BOOL ok = TRUE;
20836
20837 DocCoord StartPoint, EndPoint, EndPoint2;
20838 INT32 StartColourRef,EndColourRef;
20839 double Bias = 0, Gain = 0;
20840 double* ptrBias = &Bias, *ptrGain = &Gain;
20841
20842
20843 if (ok) ok = pCXaraFileRecord->ReadCoord(&StartPoint);
20844 if (ok) ok = pCXaraFileRecord->ReadCoord(&EndPoint);
20845
20846 if (ok && Tag == TAG_ELLIPTICALFILL)
20847 ok = pCXaraFileRecord->ReadCoord(&EndPoint2);
20848
20849 if (ok) ok = pCXaraFileRecord->ReadINT32(&StartColourRef);
20850 if (ok) ok = pCXaraFileRecord->ReadINT32(&EndColourRef);
20851 if (ok) ok = pCXaraFileRecord->ReadDOUBLEnoError (ptrBias);
20852 if (ok) ok = pCXaraFileRecord->ReadDOUBLEnoError (ptrGain);
20853
20854 CProfileBiasGain Profile;
20855
20856 if ((ptrBias != NULL) && (ptrGain != NULL))
20857 {
20858 Profile.SetBias((AFp) Bias);
20859 Profile.SetGain((AFp) Gain);
20860 }
20861
20862 if (ok)
20863 {
20864 AttrRadialColourFill* pAttr = new AttrRadialColourFill;
20865 if (pAttr != NULL)
20866 {
20867
20868 RadialFillAttribute* pValue = (RadialFillAttribute*)pAttr->GetAttributeValue();
20869
20870 if (pValue != NULL)
20871 {
20872
20873 pValue->SetStartPoint(&StartPoint);
20874 pValue->SetEndPoint(&EndPoint);
20875
20876 if (Tag == TAG_ELLIPTICALFILL)
20877 {
20878 pValue->SetEndPoint2(&EndPoint2);
20879 pValue->MakeElliptical();
20880 }
20881 else
20882 pValue->MakeCircular();
20883
20884
20885 pValue->SetProfile (Profile);
20886
20887
20888 if (ok) ok = GetDocColour(StartColourRef,&(pValue->Colour));
20889 if (ok) ok = GetDocColour(EndColourRef,&(pValue->EndColour));
20890 if (ok) ok = InsertNode(pAttr);
20891 }
20892 else
20893 ok = FALSE;
20894 }
20895 else
20896 ok = FALSE;
20897 }
20898
20899 return ok;
20900 }
20901
20902
20903
20904
20905
20906
20907
20908
20909
20910
20911
20912
20913
20914
20915
20916
20917
20918 BOOL FillAttrRecordHandler::HandleMultiStageCircularFillRecord(
20919 CXaraFileRecord* pCXaraFileRecord)
20920 {
20921 UINT32 Tag = pCXaraFileRecord->GetTag();
20922
20923 ERROR2IF(pCXaraFileRecord == NULL,FALSE,"pCXaraFileRecord is NULL");
20924 ERROR2IF(Tag != TAG_CIRCULARFILLMULTISTAGE &&
20925 Tag != TAG_ELLIPTICALFILLMULTISTAGE,FALSE,"I don't handle this tag type");
20926
20927 BOOL ok = TRUE;
20928
20929 DocCoord StartPoint, EndPoint, EndPoint2;
20930 INT32 StartColourRef,EndColourRef;
20931
20932
20933 if (ok) ok = pCXaraFileRecord->ReadCoord(&StartPoint);
20934 if (ok) ok = pCXaraFileRecord->ReadCoord(&EndPoint);
20935
20936 if (ok && Tag == TAG_ELLIPTICALFILLMULTISTAGE)
20937 ok = pCXaraFileRecord->ReadCoord(&EndPoint2);
20938
20939 if (ok) ok = pCXaraFileRecord->ReadINT32(&StartColourRef);
20940 if (ok) ok = pCXaraFileRecord->ReadINT32(&EndColourRef);
20941
20942
20943 INT32 * pColRecs = NULL;
20944 UINT32 NumRecords = 0;
20945
20946 if (ok) ok = pCXaraFileRecord->ReadUINT32(&NumRecords);
20947
20948 pColRecs = new INT32[NumRecords];
20949
20950 double *pPositions = new double[NumRecords];
20951
20952 for (UINT32 i = 0 ; i < NumRecords; i++)
20953 {
20954 if (ok) ok = pCXaraFileRecord->ReadDOUBLE(&(pPositions[i]));
20955 if (ok) ok = pCXaraFileRecord->ReadINT32(&(pColRecs[i]));
20956 }
20957
20958 DocColour Colour;
20959
20960 if (ok)
20961 {
20962 AttrRadialColourFill* pAttr = new AttrRadialColourFill;
20963 if (pAttr != NULL)
20964 {
20965
20966 RadialFillAttribute* pValue = (RadialFillAttribute*)pAttr->GetAttributeValue();
20967
20968 if (pValue != NULL)
20969 {
20970
20971 pValue->SetStartPoint(&StartPoint);
20972 pValue->SetEndPoint(&EndPoint);
20973
20974 if (Tag == TAG_ELLIPTICALFILLMULTISTAGE)
20975 {
20976 pValue->SetEndPoint2(&EndPoint2);
20977 pValue->MakeElliptical();
20978 }
20979 else
20980 pValue->MakeCircular();
20981
20982
20983 if (ok) ok = GetDocColour(StartColourRef,&(pValue->Colour));
20984 if (ok) ok = GetDocColour(EndColourRef,&(pValue->EndColour));
20985
20986
20987 ColourRamp * pRamp = pValue->MakeNewColourRamp();
20988
20989 for (UINT32 i = 0 ; i < NumRecords; i++)
20990 {
20991
20992 if (ok) ok = GetDocColour(pColRecs[i], &Colour);
20993
20994 if (ok) pRamp->AddEntry((float)pPositions[i], &Colour);
20995 }
20996
20997 if (ok) ok = InsertNode(pAttr);
20998 }
20999 else
21000 ok = FALSE;
21001 }
21002 else
21003 ok = FALSE;
21004 }
21005
21006 delete [] pPositions;
21007 delete [] pColRecs;
21008
21009 return ok;
21010 }
21011
21012
21013
21014
21015
21016
21017
21018
21019
21020
21021
21022
21023
21024
21025
21026
21027 BOOL FillAttrRecordHandler::HandleConicalFillRecord(CXaraFileRecord* pCXaraFileRecord)
21028 {
21029 ERROR2IF(pCXaraFileRecord == NULL,FALSE,"pCXaraFileRecord is NULL");
21030 ERROR2IF(pCXaraFileRecord->GetTag() != TAG_CONICALFILL,FALSE,"I don't handle this tag type");
21031
21032 BOOL ok = TRUE;
21033
21034 DocCoord StartPoint, EndPoint;
21035 INT32 StartColourRef,EndColourRef;
21036 double Bias = 0, Gain = 0;
21037 double* ptrBias = &Bias, *ptrGain = &Gain;
21038
21039
21040 if (ok) ok = pCXaraFileRecord->ReadCoord(&StartPoint);
21041 if (ok) ok = pCXaraFileRecord->ReadCoord(&EndPoint);
21042 if (ok) ok = pCXaraFileRecord->ReadINT32(&StartColourRef);
21043 if (ok) ok = pCXaraFileRecord->ReadINT32(&EndColourRef);
21044 if (ok) ok = pCXaraFileRecord->ReadDOUBLEnoError (ptrBias);
21045 if (ok) ok = pCXaraFileRecord->ReadDOUBLEnoError (ptrGain);
21046
21047 CProfileBiasGain Profile;
21048
21049 if ((ptrBias != NULL) && (ptrGain != NULL))
21050 {
21051 Profile.SetBias((AFp) Bias);
21052 Profile.SetGain((AFp) Gain);
21053 }
21054
21055 if (ok)
21056 {
21057 AttrConicalColourFill* pAttr = new AttrConicalColourFill;
21058 if (pAttr != NULL)
21059 {
21060
21061 ConicalFillAttribute* pValue = (ConicalFillAttribute*)pAttr->GetAttributeValue();
21062
21063 if (pValue != NULL)
21064 {
21065
21066 pValue->SetStartPoint(&StartPoint);
21067 pValue->SetEndPoint(&EndPoint);
21068 pValue->SetEndPoint2(NULL);
21069
21070
21071 pValue->SetProfile (Profile);
21072
21073
21074 if (ok) ok = GetDocColour(StartColourRef,&(pValue->Colour));
21075 if (ok) ok = GetDocColour(EndColourRef,&(pValue->EndColour));
21076 if (ok) ok = InsertNode(pAttr);
21077 }
21078 else
21079 ok = FALSE;
21080 }
21081 else
21082 ok = FALSE;
21083 }
21084
21085 return ok;
21086 }
21087
21088
21089
21090
21091
21092
21093
21094
21095
21096
21097
21098
21099
21100
21101
21102
21103
21104 BOOL FillAttrRecordHandler::HandleMultiStageConicalFillRecord(CXaraFileRecord* pCXaraFileRecord)
21105 {
21106 ERROR2IF(pCXaraFileRecord == NULL,FALSE,"pCXaraFileRecord is NULL");
21107 ERROR2IF(pCXaraFileRecord->GetTag() != TAG_CONICALFILLMULTISTAGE,FALSE,"I don't handle this tag type");
21108
21109 BOOL ok = TRUE;
21110
21111 DocCoord StartPoint, EndPoint;
21112 INT32 StartColourRef,EndColourRef;
21113
21114
21115 if (ok) ok = pCXaraFileRecord->ReadCoord(&StartPoint);
21116 if (ok) ok = pCXaraFileRecord->ReadCoord(&EndPoint);
21117 if (ok) ok = pCXaraFileRecord->ReadINT32(&StartColourRef);
21118 if (ok) ok = pCXaraFileRecord->ReadINT32(&EndColourRef);
21119
21120
21121 INT32 * pColRecs = NULL;
21122 UINT32 NumRecords = 0;
21123
21124 if (ok) ok = pCXaraFileRecord->ReadUINT32(&NumRecords);
21125
21126 pColRecs = new INT32[NumRecords];
21127
21128 double *pPositions = new double[NumRecords];
21129
21130 UINT32 i;
21131 for( i = 0 ; i < NumRecords; i++)
21132 {
21133 if (ok) ok = pCXaraFileRecord->ReadDOUBLE(&(pPositions[i]));
21134 if (ok) ok = pCXaraFileRecord->ReadINT32(&(pColRecs[i]));
21135 }
21136
21137 DocColour Colour;
21138
21139 if (ok)
21140 {
21141 AttrConicalColourFill* pAttr = new AttrConicalColourFill;
21142 if (pAttr != NULL)
21143 {
21144
21145 ConicalFillAttribute* pValue = (ConicalFillAttribute*)pAttr->GetAttributeValue();
21146
21147 if (pValue != NULL)
21148 {
21149
21150 pValue->SetStartPoint(&StartPoint);
21151 pValue->SetEndPoint(&EndPoint);
21152 pValue->SetEndPoint2(NULL);
21153
21154
21155 if (ok) ok = GetDocColour(StartColourRef,&(pValue->Colour));
21156 if (ok) ok = GetDocColour(EndColourRef,&(pValue->EndColour));
21157
21158
21159 ColourRamp * pRamp = pValue->MakeNewColourRamp();
21160
21161 for (i = 0 ; i < NumRecords; i++)
21162 {
21163
21164 if (ok) ok = GetDocColour(pColRecs[i], &Colour);
21165
21166 if (ok) pRamp->AddEntry((float)pPositions[i], &Colour);
21167 }
21168
21169 if (ok) ok = InsertNode(pAttr);
21170 }
21171 else
21172 ok = FALSE;
21173 }
21174 else
21175 ok = FALSE;
21176 }
21177
21178 if (pPositions)
21179 delete [] pPositions;
21180
21181 if (pColRecs)
21182 delete [] pColRecs;
21183
21184 return ok;
21185 }
21186
21187
21188
21189
21190
21191
21192
21193
21194
21195
21196
21197
21198
21199
21200
21201
21202
21203 BOOL FillAttrRecordHandler::HandleSquareFillRecord(CXaraFileRecord* pCXaraFileRecord)
21204 {
21205 UINT32 Tag = pCXaraFileRecord->GetTag();
21206
21207 ERROR2IF(pCXaraFileRecord == NULL,FALSE,"pCXaraFileRecord is NULL");
21208 ERROR2IF(Tag != TAG_SQUAREFILL,FALSE,"I don't handle this tag type");
21209
21210 BOOL ok = TRUE;
21211
21212 DocCoord StartPoint, EndPoint, EndPoint2;
21213 INT32 StartColourRef,EndColourRef;
21214 double Bias = 0, Gain = 0;
21215 double* ptrBias = &Bias, *ptrGain = &Gain;
21216
21217
21218 if (ok) ok = pCXaraFileRecord->ReadCoord(&StartPoint);
21219 if (ok) ok = pCXaraFileRecord->ReadCoord(&EndPoint);
21220 if (ok) ok = pCXaraFileRecord->ReadCoord(&EndPoint2);
21221
21222 if (ok) ok = pCXaraFileRecord->ReadINT32(&StartColourRef);
21223 if (ok) ok = pCXaraFileRecord->ReadINT32(&EndColourRef);
21224 if (ok) ok = pCXaraFileRecord->ReadDOUBLEnoError (ptrBias);
21225 if (ok) ok = pCXaraFileRecord->ReadDOUBLEnoError (ptrGain);
21226
21227 CProfileBiasGain Profile;
21228
21229 if ((ptrBias != NULL) && (ptrGain != NULL))
21230 {
21231 Profile.SetBias((AFp) Bias);
21232 Profile.SetGain((AFp) Gain);
21233 }
21234
21235 if (ok)
21236 {
21237 AttrSquareColourFill* pAttr = new AttrSquareColourFill;
21238 if (pAttr != NULL)
21239 {
21240
21241 SquareFillAttribute* pValue = (SquareFillAttribute*)pAttr->GetAttributeValue();
21242
21243 if (pValue != NULL)
21244 {
21245
21246 pValue->SetStartPoint(&StartPoint);
21247 pValue->SetEndPoint(&EndPoint);
21248 pValue->SetEndPoint2(&EndPoint2);
21249
21250
21251 pValue->SetProfile (Profile);
21252
21253
21254 if (ok) ok = GetDocColour(StartColourRef,&(pValue->Colour));
21255 if (ok) ok = GetDocColour(EndColourRef,&(pValue->EndColour));
21256 if (ok) ok = InsertNode(pAttr);
21257 }
21258 else
21259 ok = FALSE;
21260 }
21261 else
21262 ok = FALSE;
21263 }
21264
21265 return ok;
21266 }
21267
21268
21269
21270
21271
21272
21273
21274
21275
21276
21277
21278
21279
21280
21281
21282
21283 BOOL FillAttrRecordHandler::HandleMultiStageSquareFillRecord(CXaraFileRecord* pCXaraFileRecord)
21284 {
21285 UINT32 Tag = pCXaraFileRecord->GetTag();
21286
21287 ERROR2IF(pCXaraFileRecord == NULL,FALSE,"pCXaraFileRecord is NULL");
21288 ERROR2IF(Tag != TAG_SQUAREFILLMULTISTAGE,FALSE,"I don't handle this tag type");
21289
21290 BOOL ok = TRUE;
21291
21292 DocCoord StartPoint, EndPoint, EndPoint2;
21293 INT32 StartColourRef,EndColourRef;
21294
21295
21296
21297
21298 if (ok) ok = pCXaraFileRecord->ReadCoord(&StartPoint);
21299 if (ok) ok = pCXaraFileRecord->ReadCoord(&EndPoint);
21300 if (ok) ok = pCXaraFileRecord->ReadCoord(&EndPoint2);
21301
21302 if (ok) ok = pCXaraFileRecord->ReadINT32(&StartColourRef);
21303 if (ok) ok = pCXaraFileRecord->ReadINT32(&EndColourRef);
21304
21305
21306
21307
21308 INT32 * pColRecs = NULL;
21309 UINT32 NumRecords = 0;
21310
21311 if (ok) ok = pCXaraFileRecord->ReadUINT32(&NumRecords);
21312
21313 pColRecs = new INT32[NumRecords];
21314
21315 double *pPositions = new double[NumRecords];
21316
21317 UINT32 i;
21318 for( i = 0 ; i < NumRecords; i++)
21319 {
21320 if (ok) ok = pCXaraFileRecord->ReadDOUBLE(&(pPositions[i]));
21321 if (ok) ok = pCXaraFileRecord->ReadINT32(&(pColRecs[i]));
21322 }
21323
21324 DocColour Colour;
21325
21326 if (ok)
21327 {
21328 AttrSquareColourFill* pAttr = new AttrSquareColourFill;
21329 if (pAttr != NULL)
21330 {
21331
21332 SquareFillAttribute* pValue = (SquareFillAttribute*)pAttr->GetAttributeValue();
21333
21334 if (pValue != NULL)
21335 {
21336
21337 pValue->SetStartPoint(&StartPoint);
21338 pValue->SetEndPoint(&EndPoint);
21339 pValue->SetEndPoint2(&EndPoint2);
21340
21341
21342 if (ok) ok = GetDocColour(StartColourRef,&(pValue->Colour));
21343 if (ok) ok = GetDocColour(EndColourRef,&(pValue->EndColour));
21344
21345
21346 ColourRamp * pRamp = pValue->MakeNewColourRamp();
21347
21348 for (i = 0 ; i < NumRecords; i++)
21349 {
21350
21351 if (ok) ok = GetDocColour(pColRecs[i], &Colour);
21352
21353 if (ok) pRamp->AddEntry((float)pPositions[i], &Colour);
21354 }
21355
21356 if (ok) ok = InsertNode(pAttr);
21357 }
21358 else
21359 ok = FALSE;
21360 }
21361 else
21362 ok = FALSE;
21363 }
21364
21365 if (pPositions)
21366 delete [] pPositions;
21367
21368 if (pColRecs)
21369 delete [] pColRecs;
21370
21371 return ok;
21372 }
21373
21374
21375
21376
21377
21378
21379
21380
21381
21382
21383
21384
21385
21386
21387
21388
21389 BOOL FillAttrRecordHandler::HandleThreeColFillRecord(CXaraFileRecord* pCXaraFileRecord)
21390 {
21391 UINT32 Tag = pCXaraFileRecord->GetTag();
21392
21393 ERROR2IF(pCXaraFileRecord == NULL,FALSE,"pCXaraFileRecord is NULL");
21394 ERROR2IF(Tag != TAG_THREECOLFILL,FALSE,"I don't handle this tag type");
21395
21396 BOOL ok = TRUE;
21397
21398 DocCoord StartPoint;
21399 DocCoord EndPoint;
21400 DocCoord EndPoint2;
21401 INT32 StartColourRef;
21402 INT32 EndColourRef;
21403 INT32 EndColour2Ref;
21404
21405
21406 if (ok) ok = pCXaraFileRecord->ReadCoord(&StartPoint);
21407 if (ok) ok = pCXaraFileRecord->ReadCoord(&EndPoint);
21408 if (ok) ok = pCXaraFileRecord->ReadCoord(&EndPoint2);
21409
21410 if (ok) ok = pCXaraFileRecord->ReadINT32(&StartColourRef);
21411 if (ok) ok = pCXaraFileRecord->ReadINT32(&EndColourRef);
21412 if (ok) ok = pCXaraFileRecord->ReadINT32(&EndColour2Ref);
21413
21414 if (ok)
21415 {
21416 AttrThreeColColourFill* pAttr = new AttrThreeColColourFill;
21417 if (pAttr != NULL)
21418 {
21419
21420 ThreeColFillAttribute* pValue = (ThreeColFillAttribute*)pAttr->GetAttributeValue();
21421
21422 if (pValue != NULL)
21423 {
21424
21425 pValue->SetStartPoint(&StartPoint);
21426 pValue->SetEndPoint(&EndPoint);
21427 pValue->SetEndPoint2(&EndPoint2);
21428
21429
21430 if (ok) ok = GetDocColour(StartColourRef,&(pValue->Colour));
21431 if (ok) ok = GetDocColour(EndColourRef,&(pValue->EndColour));
21432 if (ok) ok = GetDocColour(EndColour2Ref,&(pValue->EndColour2));
21433 if (ok) ok = InsertNode(pAttr);
21434 }
21435 else
21436 ok = FALSE;
21437 }
21438 else
21439 ok = FALSE;
21440 }
21441
21442 return ok;
21443 }
21444
21445
21446
21447
21448
21449
21450
21451
21452
21453
21454
21455
21456
21457
21458
21459
21460 BOOL FillAttrRecordHandler::HandleFourColFillRecord(CXaraFileRecord* pCXaraFileRecord)
21461 {
21462 UINT32 Tag = pCXaraFileRecord->GetTag();
21463
21464 ERROR2IF(pCXaraFileRecord == NULL,FALSE,"pCXaraFileRecord is NULL");
21465 ERROR2IF(Tag != TAG_FOURCOLFILL,FALSE,"I don't handle this tag type");
21466
21467 BOOL ok = TRUE;
21468
21469 DocCoord StartPoint;
21470 DocCoord EndPoint;
21471 DocCoord EndPoint2;
21472 INT32 StartColourRef;
21473 INT32 EndColourRef;
21474 INT32 EndColour2Ref;
21475 INT32 EndColour3Ref;
21476
21477
21478 if (ok) ok = pCXaraFileRecord->ReadCoord(&StartPoint);
21479 if (ok) ok = pCXaraFileRecord->ReadCoord(&EndPoint);
21480 if (ok) ok = pCXaraFileRecord->ReadCoord(&EndPoint2);
21481
21482 if (ok) ok = pCXaraFileRecord->ReadINT32(&StartColourRef);
21483 if (ok) ok = pCXaraFileRecord->ReadINT32(&EndColourRef);
21484 if (ok) ok = pCXaraFileRecord->ReadINT32(&EndColour2Ref);
21485 if (ok) ok = pCXaraFileRecord->ReadINT32(&EndColour3Ref);
21486
21487 if (ok)
21488 {
21489 AttrFourColColourFill* pAttr = new AttrFourColColourFill;
21490 if (pAttr != NULL)
21491 {
21492
21493 FourColFillAttribute* pValue = (FourColFillAttribute*)pAttr->GetAttributeValue();
21494
21495 if (pValue != NULL)
21496 {
21497
21498 pValue->SetStartPoint(&StartPoint);
21499 pValue->SetEndPoint(&EndPoint);
21500 pValue->SetEndPoint2(&EndPoint2);
21501
21502
21503 if (ok) ok = GetDocColour(StartColourRef,&(pValue->Colour));
21504 if (ok) ok = GetDocColour(EndColourRef,&(pValue->EndColour));
21505 if (ok) ok = GetDocColour(EndColour2Ref,&(pValue->EndColour2));
21506 if (ok) ok = GetDocColour(EndColour3Ref,&(pValue->EndColour3));
21507 if (ok) ok = InsertNode(pAttr);
21508 }
21509 else
21510 ok = FALSE;
21511 }
21512 else
21513 ok = FALSE;
21514 }
21515
21516 return ok;
21517 }
21518
21519
21520
21521
21522
21523
21524
21525
21526
21527
21528
21529
21530
21531
21532
21533
21534 BOOL FillAttrRecordHandler::HandleBitmapFillRecord(CXaraFileRecord* pCXaraFileRecord)
21535 {
21536 UINT32 Tag = pCXaraFileRecord->GetTag();
21537
21538 ERROR2IF(pCXaraFileRecord == NULL,FALSE,"pCXaraFileRecord is NULL");
21539 ERROR2IF(Tag != TAG_BITMAPFILL && Tag != TAG_CONTONEBITMAPFILL,FALSE,"I don't handle this tag type");
21540
21541 BOOL ok = TRUE;
21542
21543 DocCoord StartPoint, EndPoint, EndPoint2;
21544 INT32 BitmapRef,StartColRef,EndColRef;
21545 double Bias = 0, Gain = 0;
21546 double* ptrBias = &Bias, *ptrGain = &Gain;
21547
21548
21549 if (ok) ok = pCXaraFileRecord->ReadCoord(&StartPoint);
21550 if (ok) ok = pCXaraFileRecord->ReadCoord(&EndPoint);
21551 if (ok) ok = pCXaraFileRecord->ReadCoord(&EndPoint2);
21552
21553 if (Tag == TAG_CONTONEBITMAPFILL)
21554 {
21555 if (ok) ok = pCXaraFileRecord->ReadINT32(&StartColRef);
21556 if (ok) ok = pCXaraFileRecord->ReadINT32(&EndColRef);
21557 }
21558
21559 if (ok) ok = pCXaraFileRecord->ReadINT32(&BitmapRef);
21560 if (ok) ok = pCXaraFileRecord->ReadDOUBLEnoError (ptrBias);
21561 if (ok) ok = pCXaraFileRecord->ReadDOUBLEnoError (ptrGain);
21562
21563 CProfileBiasGain Profile;
21564
21565 if ((ptrBias != NULL) && (ptrGain != NULL))
21566 {
21567 Profile.SetBias((AFp) Bias);
21568 Profile.SetGain((AFp) Gain);
21569 }
21570
21571 if (ok)
21572 {
21573 AttrBitmapColourFill* pAttr = new AttrBitmapColourFill;
21574 if (pAttr != NULL)
21575 {
21576
21577 BitmapFillAttribute* pValue = (BitmapFillAttribute*)pAttr->GetAttributeValue();
21578
21579 if (pValue != NULL)
21580 {
21581
21582 pValue->SetStartPoint(&StartPoint);
21583 pValue->SetEndPoint(&EndPoint);
21584 pValue->SetEndPoint2(&EndPoint2);
21585
21586 if (Tag == TAG_CONTONEBITMAPFILL)
21587 {
21588 DocColour StartCol,EndCol;
21589
21590
21591 if (ok) ok = GetDocColour(StartColRef,&StartCol);
21592 if (ok) ok = GetDocColour(EndColRef,&EndCol);
21593
21594 if (ok)
21595 {
21596 pValue->SetStartColour(&StartCol);
21597 pValue->SetEndColour(&EndCol);
21598 }
21599 }
21600
21601
21602 pValue->SetProfile (Profile);
21603
21604
21605 KernelBitmap * pBitmap = NULL;
21606 pBitmap = GetReadBitmapReference(BitmapRef);
21607
21608 ok = (pBitmap != NULL);
21609 if (ok) ok = pValue->AttachBitmap(pBitmap);
21610 if (ok) ok = InsertNode(pAttr);
21611 }
21612 else
21613 ok = FALSE;
21614 }
21615 else
21616 ok = FALSE;
21617 }
21618
21619 return ok;
21620 }
21621
21622
21623
21624
21625
21626
21627
21628
21629
21630
21631
21632
21633
21634
21635
21636
21637 BOOL FillAttrRecordHandler::HandleFractalFillRecord(CXaraFileRecord* pCXaraFileRecord)
21638 {
21639 ERROR2IF(pCXaraFileRecord == NULL,FALSE,"pCXaraFileRecord is NULL");
21640 ERROR2IF(pCXaraFileRecord->GetTag() != TAG_FRACTALFILL,FALSE,"I don't handle this tag type");
21641
21642 BOOL ok = TRUE;
21643
21644 DocCoord StartPoint, EndPoint, EndPoint2;
21645 INT32 StartColRef,EndColRef, Seed, DPI;
21646 FIXED16 Graininess, Gravity, Squash;
21647 BYTE Tileable;
21648 double Bias = 0, Gain = 0;
21649 double* ptrBias = &Bias, *ptrGain = &Gain;
21650
21651
21652 if (ok) ok = pCXaraFileRecord->ReadCoord(&StartPoint);
21653 if (ok) ok = pCXaraFileRecord->ReadCoord(&EndPoint);
21654 if (ok) ok = pCXaraFileRecord->ReadCoord(&EndPoint2);
21655 if (ok) ok = pCXaraFileRecord->ReadINT32(&StartColRef);
21656 if (ok) ok = pCXaraFileRecord->ReadINT32(&EndColRef);
21657
21658 if (ok) ok = pCXaraFileRecord->ReadINT32(&Seed);
21659 if (ok) ok = pCXaraFileRecord->ReadFIXED16(&Graininess);
21660 if (ok) ok = pCXaraFileRecord->ReadFIXED16(&Gravity);
21661 if (ok) ok = pCXaraFileRecord->ReadFIXED16(&Squash);
21662 if (ok) ok = pCXaraFileRecord->ReadINT32(&DPI);
21663 if (ok) ok = pCXaraFileRecord->ReadBYTE(&Tileable);
21664 if (ok) ok = pCXaraFileRecord->ReadDOUBLEnoError (ptrBias);
21665 if (ok) ok = pCXaraFileRecord->ReadDOUBLEnoError (ptrGain);
21666
21667 CProfileBiasGain Profile;
21668
21669 if ((ptrBias != NULL) && (ptrGain != NULL))
21670 {
21671 Profile.SetBias((AFp) Bias);
21672 Profile.SetGain((AFp) Gain);
21673 }
21674
21675 if (ok)
21676 {
21677 AttrFractalColourFill* pAttr = new AttrFractalColourFill;
21678 if (pAttr != NULL)
21679 {
21680
21681 FractalFillAttribute* pValue = (FractalFillAttribute*)pAttr->GetAttributeValue();
21682
21683 if (pValue != NULL)
21684 {
21685
21686 pValue->SetStartPoint(&StartPoint);
21687 pValue->SetEndPoint(&EndPoint);
21688 pValue->SetEndPoint2(&EndPoint2);
21689
21690
21691 pValue->SetSeed(Seed);
21692 pValue->SetGraininess(Graininess);
21693 pValue->SetGravity(Gravity);
21694 pValue->SetSquash(Squash);
21695 pValue->SetFractalDPI(DPI);
21696 pValue->SetTileable(Tileable);
21697
21698 DocColour StartCol,EndCol;
21699
21700
21701 if (ok) ok = GetDocColour(StartColRef,&StartCol);
21702 if (ok) ok = GetDocColour(EndColRef,&EndCol);
21703 if (ok)
21704 {
21705 pValue->SetStartColour(&StartCol);
21706 pValue->SetEndColour(&EndCol);
21707 }
21708
21709
21710 pValue->SetProfile (Profile);
21711
21712
21713 if (ok) ok = pValue->RecalcFractal();
21714 if (ok) ok = InsertNode(pAttr);
21715 }
21716 else
21717 ok = FALSE;
21718 }
21719 else
21720 ok = FALSE;
21721 }
21722
21723 return ok;
21724 }
21725
21726
21727
21728
21729
21730
21731
21732
21733
21734
21735
21736
21737
21738
21739
21740
21741
21742 BOOL FillAttrRecordHandler::HandleNoiseFillRecord(CXaraFileRecord* pCXaraFileRecord)
21743 {
21744 ERROR2IF(pCXaraFileRecord == NULL,FALSE,"pCXaraFileRecord is NULL");
21745 ERROR2IF(pCXaraFileRecord->GetTag() != TAG_NOISEFILL,FALSE,"I don't handle this tag type");
21746
21747 BOOL ok = TRUE;
21748
21749 DocCoord StartPoint, EndPoint, EndPoint2;
21750 INT32 StartColRef,EndColRef, DPI;
21751 FIXED16 Grain;
21752 INT32 Seed;
21753 BYTE Tileable;
21754 double Bias = 0, Gain = 0;
21755 double* ptrBias = &Bias, *ptrGain = &Gain;
21756
21757
21758 if (ok) ok = pCXaraFileRecord->ReadCoord(&StartPoint);
21759 if (ok) ok = pCXaraFileRecord->ReadCoord(&EndPoint);
21760 if (ok) ok = pCXaraFileRecord->ReadCoord(&EndPoint2);
21761 if (ok) ok = pCXaraFileRecord->ReadINT32(&StartColRef);
21762 if (ok) ok = pCXaraFileRecord->ReadINT32(&EndColRef);
21763 if (ok) ok = pCXaraFileRecord->ReadFIXED16(&Grain);
21764 if (ok) ok = pCXaraFileRecord->ReadINT32(&Seed);
21765 if (ok) ok = pCXaraFileRecord->ReadINT32(&DPI);
21766 if (ok) ok = pCXaraFileRecord->ReadBYTE(&Tileable);
21767 if (ok) ok = pCXaraFileRecord->ReadDOUBLEnoError (ptrBias);
21768 if (ok) ok = pCXaraFileRecord->ReadDOUBLEnoError (ptrGain);
21769
21770 CProfileBiasGain Profile;
21771
21772 if ((ptrBias != NULL) && (ptrGain != NULL))
21773 {
21774 Profile.SetBias((AFp) Bias);
21775 Profile.SetGain((AFp) Gain);
21776 }
21777
21778 if (ok)
21779 {
21780 AttrNoiseColourFill* pAttr = new AttrNoiseColourFill;
21781 if (pAttr != NULL)
21782 {
21783
21784 NoiseFillAttribute* pValue = (NoiseFillAttribute*)pAttr->GetAttributeValue();
21785
21786 if (pValue != NULL)
21787 {
21788
21789 pValue->SetStartPoint(&StartPoint);
21790 pValue->SetEndPoint(&EndPoint);
21791 pValue->SetEndPoint2(&EndPoint2);
21792
21793
21794 pValue->SetGraininess(Grain);
21795 pValue->SetSeed(Seed);
21796 pValue->SetFractalDPI(DPI);
21797 pValue->SetTileable(Tileable);
21798
21799 DocColour StartCol,EndCol;
21800
21801
21802 if (ok) ok = GetDocColour(StartColRef,&StartCol);
21803 if (ok) ok = GetDocColour(EndColRef,&EndCol);
21804 if (ok)
21805 {
21806 pValue->SetStartColour(&StartCol);
21807 pValue->SetEndColour(&EndCol);
21808 }
21809
21810
21811 pValue->SetProfile (Profile);
21812
21813
21814 if (ok) ok = pValue->RecalcFractal();
21815 if (ok) ok = InsertNode(pAttr);
21816 }
21817 else
21818 ok = FALSE;
21819 }
21820 else
21821 ok = FALSE;
21822 }
21823
21824 return ok;
21825 }
21826
21827
21828
21829
21830
21831
21832
21833
21834
21835
21836
21837
21838
21839
21840
21841
21842
21843
21844
21845
21846 BOOL FillAttrRecordHandler::HandleFlatTransparentFillRecord(CXaraFileRecord* pCXaraFileRecord)
21847 {
21848 ERROR2IF(pCXaraFileRecord == NULL,FALSE,"pCXaraFileRecord is NULL");
21849 ERROR2IF(pCXaraFileRecord->GetTag() != TAG_FLATTRANSPARENTFILL,FALSE,"I don't handle this tag type");
21850
21851 BOOL ok = TRUE;
21852
21853 BYTE Transp,TranspType;
21854
21855 if (ok) ok = pCXaraFileRecord->ReadBYTE(&Transp);
21856 if (ok) ok = pCXaraFileRecord->ReadBYTE(&TranspType);
21857
21858 if (ok)
21859 {
21860 AttrFlatTranspFill* pAttr = new AttrFlatTranspFill;
21861 if (pAttr != NULL)
21862 {
21863 FlatTranspFillAttribute* pValue = (FlatTranspFillAttribute*)pAttr->GetAttributeValue();
21864
21865 if (pValue != NULL)
21866 {
21867 pValue->Transp = UINT32(Transp);
21868 pValue->TranspType = UINT32(TranspType);
21869 ok = InsertNode(pAttr);
21870 }
21871 else
21872 ok = FALSE;
21873 }
21874 else
21875 ok = FALSE;
21876 }
21877
21878 return ok;
21879 }
21880
21881
21882
21883
21884
21885
21886
21887
21888
21889
21890
21891
21892
21893
21894
21895
21896 BOOL FillAttrRecordHandler::HandleLinearTransparentFillRecord(CXaraFileRecord* pCXaraFileRecord)
21897 {
21898 UINT32 tag = pCXaraFileRecord->GetTag();
21899 ERROR2IF(pCXaraFileRecord == NULL,FALSE,"pCXaraFileRecord is NULL");
21900 ERROR2IF(tag!=TAG_LINEARTRANSPARENTFILL && tag!=TAG_LINEARTRANSPARENTFILL3POINT, FALSE, "I don't handle this tag type");
21901
21902 BOOL ok = TRUE;
21903 BOOL b3PointLinear = (tag==TAG_LINEARTRANSPARENTFILL3POINT);
21904
21905 DocCoord StartPoint, EndPoint, EndPoint2;
21906 BYTE Transp,EndTransp,TranspType;
21907 double Bias = 0, Gain = 0;
21908 double* ptrBias = &Bias, *ptrGain = &Gain;
21909
21910 if (ok) ok = pCXaraFileRecord->ReadCoord(&StartPoint);
21911 if (ok) ok = pCXaraFileRecord->ReadCoord(&EndPoint);
21912 if (ok && b3PointLinear) ok = pCXaraFileRecord->ReadCoord(&EndPoint2);
21913 if (ok) ok = pCXaraFileRecord->ReadBYTE(&Transp);
21914 if (ok) ok = pCXaraFileRecord->ReadBYTE(&EndTransp);
21915 if (ok) ok = pCXaraFileRecord->ReadBYTE(&TranspType);
21916 if (ok) ok = pCXaraFileRecord->ReadDOUBLEnoError (ptrBias);
21917 if (ok) ok = pCXaraFileRecord->ReadDOUBLEnoError (ptrGain);
21918
21919 CProfileBiasGain Profile;
21920
21921 if ((ptrBias != NULL) && (ptrGain != NULL))
21922 {
21923 Profile.SetBias((AFp) Bias);
21924 Profile.SetGain((AFp) Gain);
21925 }
21926
21927 if (ok)
21928 {
21929 AttrLinearTranspFill* pAttr = new AttrLinearTranspFill;
21930 if (pAttr != NULL)
21931 {
21932 LinearTranspFillAttribute* pValue = (LinearTranspFillAttribute*)pAttr->GetAttributeValue();
21933
21934 if (pValue != NULL)
21935 {
21936 pValue->SetStartPoint(&StartPoint);
21937 pValue->SetEndPoint(&EndPoint);
21938 if (b3PointLinear)
21939 pValue->SetEndPoint2(&EndPoint2);
21940 else
21941 pValue->SetEndPoint2(NULL);
21942 pValue->Transp = UINT32(Transp);
21943 pValue->EndTransp = UINT32(EndTransp);
21944 pValue->TranspType = UINT32(TranspType);
21945 pValue->SetProfile (Profile);
21946 ok = InsertNode(pAttr);
21947 }
21948 else
21949 ok = FALSE;
21950 }
21951 else
21952 ok = FALSE;
21953 }
21954
21955 return ok;
21956 }
21957
21958
21959
21960
21961
21962
21963
21964
21965
21966
21967
21968
21969
21970
21971
21972
21973 BOOL FillAttrRecordHandler::HandleEllipticalTransparentFillRecord(CXaraFileRecord* pCXaraFileRecord)
21974 {
21975 UINT32 Tag = pCXaraFileRecord->GetTag();
21976
21977 ERROR2IF(pCXaraFileRecord == NULL,FALSE,"pCXaraFileRecord is NULL");
21978 ERROR2IF(Tag != TAG_ELLIPTICALTRANSPARENTFILL && Tag != TAG_CIRCULARTRANSPARENTFILL,FALSE,"I don't handle this tag type");
21979
21980 BOOL ok = TRUE;
21981
21982 DocCoord StartPoint, EndPoint, EndPoint2;
21983 BYTE Transp,EndTransp,TranspType;
21984 double Bias = 0, Gain = 0;
21985 double* ptrBias = &Bias, *ptrGain = &Gain;
21986
21987 if (ok) ok = pCXaraFileRecord->ReadCoord(&StartPoint);
21988 if (ok) ok = pCXaraFileRecord->ReadCoord(&EndPoint);
21989
21990 if (ok && Tag == TAG_ELLIPTICALTRANSPARENTFILL)
21991 ok = pCXaraFileRecord->ReadCoord(&EndPoint2);
21992
21993 if (ok) ok = pCXaraFileRecord->ReadBYTE(&Transp);
21994 if (ok) ok = pCXaraFileRecord->ReadBYTE(&EndTransp);
21995 if (ok) ok = pCXaraFileRecord->ReadBYTE(&TranspType);
21996 if (ok) ok = pCXaraFileRecord->ReadDOUBLEnoError (ptrBias);
21997 if (ok) ok = pCXaraFileRecord->ReadDOUBLEnoError (ptrGain);
21998
21999 CProfileBiasGain Profile;
22000
22001 if ((ptrBias != NULL) && (ptrGain != NULL))
22002 {
22003 Profile.SetBias((AFp) Bias);
22004 Profile.SetGain((AFp) Gain);
22005 }
22006
22007 if (ok)
22008 {
22009 AttrRadialTranspFill* pAttr = new AttrRadialTranspFill;
22010 if (pAttr != NULL)
22011 {
22012 RadialTranspFillAttribute* pValue = (RadialTranspFillAttribute*)pAttr->GetAttributeValue();
22013
22014 if (pValue != NULL)
22015 {
22016 pValue->SetStartPoint(&StartPoint);
22017 pValue->SetEndPoint(&EndPoint);
22018
22019 if (Tag == TAG_ELLIPTICALTRANSPARENTFILL)
22020 {
22021 pValue->SetEndPoint2(&EndPoint2);
22022 pValue->MakeElliptical();
22023 }
22024 else
22025 pValue->MakeCircular();
22026
22027 pValue->Transp = UINT32(Transp);
22028 pValue->EndTransp = UINT32(EndTransp);
22029 pValue->TranspType = UINT32(TranspType);
22030 pValue->SetProfile (Profile);
22031 ok = InsertNode(pAttr);
22032 }
22033 else
22034 ok = FALSE;
22035 }
22036 else
22037 ok = FALSE;
22038 }
22039
22040 return ok;
22041 }
22042
22043
22044
22045
22046
22047
22048
22049
22050
22051
22052
22053
22054
22055
22056
22057
22058 BOOL FillAttrRecordHandler::HandleConicalTransparentFillRecord(CXaraFileRecord* pCXaraFileRecord)
22059 {
22060 ERROR2IF(pCXaraFileRecord == NULL,FALSE,"pCXaraFileRecord is NULL");
22061 ERROR2IF(pCXaraFileRecord->GetTag() != TAG_CONICALTRANSPARENTFILL,FALSE,"I don't handle this tag type");
22062
22063 BOOL ok = TRUE;
22064
22065 DocCoord StartPoint, EndPoint;
22066 BYTE Transp,EndTransp,TranspType;
22067 double Bias = 0, Gain = 0;
22068 double* ptrBias = &Bias, *ptrGain = &Gain;
22069
22070 if (ok) ok = pCXaraFileRecord->ReadCoord(&StartPoint);
22071 if (ok) ok = pCXaraFileRecord->ReadCoord(&EndPoint);
22072 if (ok) ok = pCXaraFileRecord->ReadBYTE(&Transp);
22073 if (ok) ok = pCXaraFileRecord->ReadBYTE(&EndTransp);
22074 if (ok) ok = pCXaraFileRecord->ReadBYTE(&TranspType);
22075 if (ok) ok = pCXaraFileRecord->ReadDOUBLEnoError (ptrBias);
22076 if (ok) ok = pCXaraFileRecord->ReadDOUBLEnoError (ptrGain);
22077
22078 CProfileBiasGain Profile;
22079
22080 if ((ptrBias != NULL) && (ptrGain != NULL))
22081 {
22082 Profile.SetBias((AFp) Bias);
22083 Profile.SetGain((AFp) Gain);
22084 }
22085
22086 if (ok)
22087 {
22088 AttrConicalTranspFill* pAttr = new AttrConicalTranspFill;
22089 if (pAttr != NULL)
22090 {
22091 ConicalTranspFillAttribute* pValue = (ConicalTranspFillAttribute*)pAttr->GetAttributeValue();
22092
22093 if (pValue != NULL)
22094 {
22095 pValue->SetStartPoint(&StartPoint);
22096 pValue->SetEndPoint(&EndPoint);
22097 pValue->Transp = UINT32(Transp);
22098 pValue->EndTransp = UINT32(EndTransp);
22099 pValue->TranspType = UINT32(TranspType);
22100 pValue->SetProfile (Profile);
22101 ok = InsertNode(pAttr);
22102 }
22103 else
22104 ok = FALSE;
22105 }
22106 else
22107 ok = FALSE;
22108 }
22109
22110 return ok;
22111 }
22112
22113
22114
22115
22116
22117
22118
22119
22120
22121
22122
22123
22124
22125
22126
22127
22128 BOOL FillAttrRecordHandler::HandleSquareTransparentFillRecord(CXaraFileRecord* pCXaraFileRecord)
22129 {
22130 UINT32 Tag = pCXaraFileRecord->GetTag();
22131
22132 ERROR2IF(pCXaraFileRecord == NULL,FALSE,"pCXaraFileRecord is NULL");
22133 ERROR2IF(Tag != TAG_SQUARETRANSPARENTFILL,FALSE,"I don't handle this tag type");
22134
22135 BOOL ok = TRUE;
22136
22137 DocCoord StartPoint, EndPoint, EndPoint2;
22138 BYTE Transp,EndTransp,TranspType;
22139 double Bias = 0, Gain = 0;
22140 double* ptrBias = &Bias, *ptrGain = &Gain;
22141
22142 if (ok) ok = pCXaraFileRecord->ReadCoord(&StartPoint);
22143 if (ok) ok = pCXaraFileRecord->ReadCoord(&EndPoint);
22144 if (ok) ok = pCXaraFileRecord->ReadCoord(&EndPoint2);
22145
22146 if (ok) ok = pCXaraFileRecord->ReadBYTE(&Transp);
22147 if (ok) ok = pCXaraFileRecord->ReadBYTE(&EndTransp);
22148 if (ok) ok = pCXaraFileRecord->ReadBYTE(&TranspType);
22149 if (ok) ok = pCXaraFileRecord->ReadDOUBLEnoError (ptrBias);
22150 if (ok) ok = pCXaraFileRecord->ReadDOUBLEnoError (ptrGain);
22151
22152 CProfileBiasGain Profile;
22153
22154 if ((ptrBias != NULL) && (ptrGain != NULL))
22155 {
22156 Profile.SetBias((AFp) Bias);
22157 Profile.SetGain((AFp) Gain);
22158 }
22159
22160 if (ok)
22161 {
22162 AttrSquareTranspFill* pAttr = new AttrSquareTranspFill;
22163 if (pAttr != NULL)
22164 {
22165 SquareTranspFillAttribute* pValue = (SquareTranspFillAttribute*)pAttr->GetAttributeValue();
22166
22167 if (pValue != NULL)
22168 {
22169 pValue->SetStartPoint(&StartPoint);
22170 pValue->SetEndPoint(&EndPoint);
22171 pValue->SetEndPoint2(&EndPoint2);
22172
22173 pValue->Transp = UINT32(Transp);
22174 pValue->EndTransp = UINT32(EndTransp);
22175 pValue->TranspType = UINT32(TranspType);
22176 pValue->SetProfile (Profile);
22177 ok = InsertNode(pAttr);
22178 }
22179 else
22180 ok = FALSE;
22181 }
22182 else
22183 ok = FALSE;
22184 }
22185
22186 return ok;
22187 }
22188
22189
22190
22191
22192
22193
22194
22195
22196
22197
22198
22199
22200
22201
22202
22203
22204 BOOL FillAttrRecordHandler::HandleThreeColTransparentFillRecord(CXaraFileRecord* pCXaraFileRecord)
22205 {
22206 UINT32 Tag = pCXaraFileRecord->GetTag();
22207
22208 ERROR2IF(pCXaraFileRecord == NULL,FALSE,"pCXaraFileRecord is NULL");
22209 ERROR2IF(Tag != TAG_THREECOLTRANSPARENTFILL,FALSE,"I don't handle this tag type");
22210
22211 BOOL ok = TRUE;
22212
22213 DocCoord StartPoint;
22214 DocCoord EndPoint;
22215 DocCoord EndPoint2;
22216 BYTE Transp;
22217 BYTE EndTransp;
22218 BYTE EndTransp2;
22219 BYTE TranspType;
22220
22221 if (ok) ok = pCXaraFileRecord->ReadCoord(&StartPoint);
22222 if (ok) ok = pCXaraFileRecord->ReadCoord(&EndPoint);
22223 if (ok) ok = pCXaraFileRecord->ReadCoord(&EndPoint2);
22224
22225 if (ok) ok = pCXaraFileRecord->ReadBYTE(&Transp);
22226 if (ok) ok = pCXaraFileRecord->ReadBYTE(&EndTransp);
22227 if (ok) ok = pCXaraFileRecord->ReadBYTE(&EndTransp2);
22228 if (ok) ok = pCXaraFileRecord->ReadBYTE(&TranspType);
22229
22230 if (ok)
22231 {
22232 AttrThreeColTranspFill* pAttr = new AttrThreeColTranspFill;
22233 if (pAttr != NULL)
22234 {
22235 ThreeColTranspFillAttribute* pValue = (ThreeColTranspFillAttribute*)pAttr->GetAttributeValue();
22236
22237 if (pValue != NULL)
22238 {
22239 pValue->SetStartPoint(&StartPoint);
22240 pValue->SetEndPoint(&EndPoint);
22241 pValue->SetEndPoint2(&EndPoint2);
22242
22243 pValue->Transp = UINT32(Transp);
22244 pValue->EndTransp = UINT32(EndTransp);
22245 pValue->EndTransp2 = UINT32(EndTransp2);
22246 pValue->TranspType = UINT32(TranspType);
22247 ok = InsertNode(pAttr);
22248 }
22249 else
22250 ok = FALSE;
22251 }
22252 else
22253 ok = FALSE;
22254 }
22255
22256 return ok;
22257 }
22258
22259
22260
22261
22262
22263
22264
22265
22266
22267
22268
22269
22270
22271
22272
22273
22274 BOOL FillAttrRecordHandler::HandleFourColTransparentFillRecord(CXaraFileRecord* pCXaraFileRecord)
22275 {
22276 UINT32 Tag = pCXaraFileRecord->GetTag();
22277
22278 ERROR2IF(pCXaraFileRecord == NULL,FALSE,"pCXaraFileRecord is NULL");
22279 ERROR2IF(Tag != TAG_FOURCOLTRANSPARENTFILL,FALSE,"I don't handle this tag type");
22280
22281 BOOL ok = TRUE;
22282
22283 DocCoord StartPoint;
22284 DocCoord EndPoint;
22285 DocCoord EndPoint2;
22286 BYTE Transp;
22287 BYTE EndTransp;
22288 BYTE EndTransp2;
22289 BYTE EndTransp3;
22290 BYTE TranspType;
22291
22292 if (ok) ok = pCXaraFileRecord->ReadCoord(&StartPoint);
22293 if (ok) ok = pCXaraFileRecord->ReadCoord(&EndPoint);
22294 if (ok) ok = pCXaraFileRecord->ReadCoord(&EndPoint2);
22295
22296 if (ok) ok = pCXaraFileRecord->ReadBYTE(&Transp);
22297 if (ok) ok = pCXaraFileRecord->ReadBYTE(&EndTransp);
22298 if (ok) ok = pCXaraFileRecord->ReadBYTE(&EndTransp2);
22299 if (ok) ok = pCXaraFileRecord->ReadBYTE(&EndTransp3);
22300 if (ok) ok = pCXaraFileRecord->ReadBYTE(&TranspType);
22301
22302 if (ok)
22303 {
22304 AttrFourColTranspFill* pAttr = new AttrFourColTranspFill;
22305 if (pAttr != NULL)
22306 {
22307 FourColTranspFillAttribute* pValue = (FourColTranspFillAttribute*)pAttr->GetAttributeValue();
22308
22309 if (pValue != NULL)
22310 {
22311 pValue->SetStartPoint(&StartPoint);
22312 pValue->SetEndPoint(&EndPoint);
22313 pValue->SetEndPoint2(&EndPoint2);
22314
22315 pValue->Transp = UINT32(Transp);
22316 pValue->EndTransp = UINT32(EndTransp);
22317 pValue->EndTransp2 = UINT32(EndTransp2);
22318 pValue->EndTransp3 = UINT32(EndTransp3);
22319 pValue->TranspType = UINT32(TranspType);
22320 ok = InsertNode(pAttr);
22321 }
22322 else
22323 ok = FALSE;
22324 }
22325 else
22326 ok = FALSE;
22327 }
22328
22329 return ok;
22330 }
22331
22332
22333
22334
22335
22336
22337
22338
22339
22340
22341
22342
22343
22344
22345
22346
22347 BOOL FillAttrRecordHandler::HandleBitmapTransparentFillRecord(CXaraFileRecord* pCXaraFileRecord)
22348 {
22349 ERROR2IF(pCXaraFileRecord == NULL,FALSE,"pCXaraFileRecord is NULL");
22350 ERROR2IF(pCXaraFileRecord->GetTag() != TAG_BITMAPTRANSPARENTFILL,FALSE,"I don't handle this tag type");
22351
22352 BOOL ok = TRUE;
22353
22354 DocCoord StartPoint, EndPoint, EndPoint2;
22355 INT32 BitmapRef;
22356 BYTE Transp,EndTransp,TranspType;
22357 double Bias = 0, Gain = 0;
22358 double* ptrBias = &Bias, *ptrGain = &Gain;
22359
22360
22361 if (ok) ok = pCXaraFileRecord->ReadCoord(&StartPoint);
22362 if (ok) ok = pCXaraFileRecord->ReadCoord(&EndPoint);
22363 if (ok) ok = pCXaraFileRecord->ReadCoord(&EndPoint2);
22364 if (ok) ok = pCXaraFileRecord->ReadBYTE(&Transp);
22365 if (ok) ok = pCXaraFileRecord->ReadBYTE(&EndTransp);
22366 if (ok) ok = pCXaraFileRecord->ReadBYTE(&TranspType);
22367 if (ok) ok = pCXaraFileRecord->ReadINT32(&BitmapRef);
22368 if (ok) ok = pCXaraFileRecord->ReadDOUBLEnoError (ptrBias);
22369 if (ok) ok = pCXaraFileRecord->ReadDOUBLEnoError (ptrGain);
22370
22371 CProfileBiasGain Profile;
22372
22373 if ((ptrBias != NULL) && (ptrGain != NULL))
22374 {
22375 Profile.SetBias((AFp) Bias);
22376 Profile.SetGain((AFp) Gain);
22377 }
22378
22379 if (ok)
22380 {
22381 AttrBitmapTranspFill* pAttr = new AttrBitmapTranspFill;
22382 if (pAttr != NULL)
22383 {
22384
22385 BitmapTranspFillAttribute* pValue = (BitmapTranspFillAttribute*)pAttr->GetAttributeValue();
22386
22387 if (pValue != NULL)
22388 {
22389
22390 pValue->SetStartPoint(&StartPoint);
22391 pValue->SetEndPoint(&EndPoint);
22392 pValue->SetEndPoint2(&EndPoint2);
22393 pValue->Transp = UINT32(Transp);
22394 pValue->EndTransp = UINT32(EndTransp);
22395 pValue->TranspType = UINT32(TranspType);
22396 pValue->SetProfile (Profile);
22397
22398
22399 KernelBitmap * pBitmap = NULL;
22400 pBitmap = GetReadBitmapReference(BitmapRef);
22401
22402 ok = (pBitmap != NULL);
22403 if (ok) ok = pValue->AttachBitmap(pBitmap);
22404 if (ok) ok = InsertNode(pAttr);
22405 }
22406 else
22407 ok = FALSE;
22408 }
22409 else
22410 ok = FALSE;
22411 }
22412
22413 return ok;
22414 }
22415
22416
22417
22418
22419
22420
22421
22422
22423
22424
22425
22426
22427
22428
22429
22430
22431 BOOL FillAttrRecordHandler::HandleFractalTransparentFillRecord(CXaraFileRecord* pCXaraFileRecord)
22432 {
22433 ERROR2IF(pCXaraFileRecord == NULL,FALSE,"pCXaraFileRecord is NULL");
22434 ERROR2IF(pCXaraFileRecord->GetTag() != TAG_FRACTALTRANSPARENTFILL,FALSE,"I don't handle this tag type");
22435
22436 BOOL ok = TRUE;
22437
22438 DocCoord StartPoint, EndPoint, EndPoint2;
22439 BYTE Transp,EndTransp,TranspType;
22440 INT32 Seed, DPI;
22441 FIXED16 Graininess, Gravity, Squash;
22442 BYTE Tileable;
22443 double Bias = 0, Gain = 0;
22444 double* ptrBias = &Bias, *ptrGain = &Gain;
22445
22446
22447 if (ok) ok = pCXaraFileRecord->ReadCoord(&StartPoint);
22448 if (ok) ok = pCXaraFileRecord->ReadCoord(&EndPoint);
22449 if (ok) ok = pCXaraFileRecord->ReadCoord(&EndPoint2);
22450 if (ok) ok = pCXaraFileRecord->ReadBYTE(&Transp);
22451 if (ok) ok = pCXaraFileRecord->ReadBYTE(&EndTransp);
22452 if (ok) ok = pCXaraFileRecord->ReadBYTE(&TranspType);
22453
22454 if (ok) ok = pCXaraFileRecord->ReadINT32(&Seed);
22455 if (ok) ok = pCXaraFileRecord->ReadFIXED16(&Graininess);
22456 if (ok) ok = pCXaraFileRecord->ReadFIXED16(&Gravity);
22457 if (ok) ok = pCXaraFileRecord->ReadFIXED16(&Squash);
22458 if (ok) ok = pCXaraFileRecord->ReadINT32(&DPI);
22459 if (ok) ok = pCXaraFileRecord->ReadBYTE(&Tileable);
22460 if (ok) ok = pCXaraFileRecord->ReadDOUBLEnoError (ptrBias);
22461 if (ok) ok = pCXaraFileRecord->ReadDOUBLEnoError (ptrGain);
22462
22463 CProfileBiasGain Profile;
22464
22465 if ((ptrBias != NULL) && (ptrGain != NULL))
22466 {
22467 Profile.SetBias((AFp) Bias);
22468 Profile.SetGain((AFp) Gain);
22469 }
22470
22471 if (ok)
22472 {
22473 AttrFractalTranspFill* pAttr = new AttrFractalTranspFill;
22474 if (pAttr != NULL)
22475 {
22476
22477 FractalTranspFillAttribute* pValue = (FractalTranspFillAttribute*)pAttr->GetAttributeValue();
22478
22479 if (pValue != NULL)
22480 {
22481
22482 pValue->SetStartPoint(&StartPoint);
22483 pValue->SetEndPoint(&EndPoint);
22484 pValue->SetEndPoint2(&EndPoint2);
22485 pValue->Transp = UINT32(Transp);
22486 pValue->EndTransp = UINT32(EndTransp);
22487 pValue->TranspType = UINT32(TranspType);
22488
22489
22490 pValue->SetSeed(Seed);
22491 pValue->SetGraininess(Graininess);
22492 pValue->SetGravity(Gravity);
22493 pValue->SetSquash(Squash);
22494 pValue->SetFractalDPI(DPI);
22495 pValue->SetTileable(Tileable);
22496 pValue->SetProfile (Profile);
22497
22498
22499 if (ok) ok = pValue->RecalcFractal();
22500 if (ok) ok = InsertNode(pAttr);
22501 }
22502 else
22503 ok = FALSE;
22504 }
22505 else
22506 ok = FALSE;
22507 }
22508
22509 return ok;
22510 }
22511
22512
22513
22514
22515
22516
22517
22518
22519
22520
22521
22522
22523
22524
22525
22526
22527
22528
22529 BOOL FillAttrRecordHandler::HandleNoiseTransparentFillRecord(CXaraFileRecord* pCXaraFileRecord)
22530 {
22531 ERROR2IF(pCXaraFileRecord == NULL,FALSE,"pCXaraFileRecord is NULL");
22532 ERROR2IF(pCXaraFileRecord->GetTag() != TAG_NOISETRANSPARENTFILL,FALSE,"I don't handle this tag type");
22533
22534 BOOL ok = TRUE;
22535
22536 DocCoord StartPoint, EndPoint, EndPoint2;
22537 BYTE Transp,EndTransp,TranspType;
22538 INT32 DPI;
22539 FIXED16 Grain;
22540 INT32 Seed;
22541 BYTE Tileable;
22542 double Bias = 0, Gain = 0;
22543 double* ptrBias = &Bias, *ptrGain = &Gain;
22544
22545
22546 if (ok) ok = pCXaraFileRecord->ReadCoord(&StartPoint);
22547 if (ok) ok = pCXaraFileRecord->ReadCoord(&EndPoint);
22548 if (ok) ok = pCXaraFileRecord->ReadCoord(&EndPoint2);
22549 if (ok) ok = pCXaraFileRecord->ReadBYTE(&Transp);
22550 if (ok) ok = pCXaraFileRecord->ReadBYTE(&EndTransp);
22551 if (ok) ok = pCXaraFileRecord->ReadBYTE(&TranspType);
22552 if (ok) ok = pCXaraFileRecord->ReadFIXED16(&Grain);
22553 if (ok) ok = pCXaraFileRecord->ReadINT32(&Seed);
22554 if (ok) ok = pCXaraFileRecord->ReadINT32(&DPI);
22555 if (ok) ok = pCXaraFileRecord->ReadBYTE(&Tileable);
22556 if (ok) ok = pCXaraFileRecord->ReadDOUBLEnoError (ptrBias);
22557 if (ok) ok = pCXaraFileRecord->ReadDOUBLEnoError (ptrGain);
22558
22559 CProfileBiasGain Profile;
22560
22561 if ((ptrBias != NULL) && (ptrGain != NULL))
22562 {
22563 Profile.SetBias((AFp) Bias);
22564 Profile.SetGain((AFp) Gain);
22565 }
22566
22567 if (ok)
22568 {
22569 AttrNoiseTranspFill* pAttr = new AttrNoiseTranspFill;
22570 if (pAttr != NULL)
22571 {
22572
22573 NoiseTranspFillAttribute* pValue = (NoiseTranspFillAttribute*)pAttr->GetAttributeValue();
22574
22575 if (pValue != NULL)
22576 {
22577
22578 pValue->SetStartPoint(&StartPoint);
22579 pValue->SetEndPoint(&EndPoint);
22580 pValue->SetEndPoint2(&EndPoint2);
22581 pValue->Transp = UINT32(Transp);
22582 pValue->EndTransp = UINT32(EndTransp);
22583 pValue->TranspType = UINT32(TranspType);
22584
22585
22586 pValue->SetGraininess(Grain);
22587 pValue->SetSeed(Seed);
22588 pValue->SetFractalDPI(DPI);
22589 pValue->SetTileable(Tileable);
22590 pValue->SetProfile (Profile);
22591
22592
22593 if (ok) ok = pValue->RecalcFractal();
22594 if (ok) ok = InsertNode(pAttr);
22595 }
22596 else
22597 ok = FALSE;
22598 }
22599 else
22600 ok = FALSE;
22601 }
22602
22603 return ok;
22604 }
22605
22606
22607
22608
22609
22610
22611
22612
22613
22614
22615
22616
22617
22618
22619
22620
22621
22622
22623
22624
22625
22626
22627
22628
22629
22630
22631 BOOL FillAttrRecordHandler::HandleFillRepeatRecord(CXaraFileRecord* pCXaraFileRecord)
22632 {
22633 ERROR2IF(pCXaraFileRecord == NULL,FALSE,"pCXaraFileRecord is NULL");
22634
22635 INT32 Repeat;
22636
22637 switch (pCXaraFileRecord->GetTag())
22638 {
22639 case TAG_FILL_NONREPEATING: Repeat = 1; break;
22640 case TAG_FILL_REPEATING: Repeat = 2; break;
22641 case TAG_FILL_REPEATINGINVERTED:Repeat = 3; break;
22642
22643 #ifdef NEW_FEATURES
22644 case TAG_FILL_REPEATING_EXTRA: Repeat = 4; break;
22645 #endif
22646 default:
22647 ERROR3("Do what? I only do fill repeat records mate");
22648 return TRUE;
22649 break;
22650 }
22651
22652 AttrFillMappingLinear* pAttr = new AttrFillMappingLinear;
22653 if (pAttr != NULL)
22654 {
22655 pAttr->Value.Repeat = Repeat;
22656 return InsertNode(pAttr);
22657 }
22658
22659 return FALSE;
22660 }
22661
22662
22663
22664
22665
22666
22667
22668
22669
22670
22671
22672
22673
22674
22675
22676
22677 BOOL FillAttrRecordHandler::HandleTransparentFillRepeatRecord(CXaraFileRecord* pCXaraFileRecord)
22678 {
22679 ERROR2IF(pCXaraFileRecord == NULL,FALSE,"pCXaraFileRecord is NULL");
22680
22681 INT32 Repeat;
22682
22683 switch (pCXaraFileRecord->GetTag())
22684 {
22685 case TAG_TRANSPARENTFILL_NONREPEATING: Repeat = 1; break;
22686 case TAG_TRANSPARENTFILL_REPEATING: Repeat = 2; break;
22687 case TAG_TRANSPARENTFILL_REPEATINGINVERTED: Repeat = 3; break;
22688
22689
22690 #ifdef NEW_FEATURES
22691 case TAG_TRANSPARENTFILL_REPEATING_EXTRA: Repeat = 4; break;
22692 #endif
22693
22694 default:
22695 ERROR3("Do what? I only do trans fill repeat records mate");
22696 return TRUE;
22697 break;
22698 }
22699
22700 AttrTranspFillMappingLinear* pAttr = new AttrTranspFillMappingLinear;
22701 if (pAttr != NULL)
22702 {
22703 pAttr->Value.Repeat = Repeat;
22704 return InsertNode(pAttr);
22705 }
22706
22707 return FALSE;
22708 }
22709
22710
22711
22712
22713
22714
22715
22716
22717
22718
22719
22720
22721
22722
22723
22724
22725 BOOL FillAttrRecordHandler::HandleFillEffectRecord(CXaraFileRecord* pCXaraFileRecord)
22726 {
22727 ERROR2IF(pCXaraFileRecord == NULL,FALSE,"pCXaraFileRecord is NULL");
22728
22729 AttrFillEffect* pAttr = NULL;
22730 switch (pCXaraFileRecord->GetTag())
22731 {
22732 case TAG_FILLEFFECT_ALTRAINBOW: pAttr = new AttrFillEffectAltRainbow; break;
22733 case TAG_FILLEFFECT_RAINBOW: pAttr = new AttrFillEffectRainbow; break;
22734 case TAG_FILLEFFECT_FADE: pAttr = new AttrFillEffectFade; break;
22735
22736 default:
22737 ERROR3("Do what? I only do fill effect records mate");
22738 return TRUE;
22739 break;
22740 }
22741
22742 if (pAttr != NULL)
22743 return InsertNode(pAttr);
22744
22745 return FALSE;
22746 }
22747
22748
22749
22750 DocColour* AttrFillGeometry::GetStartColour() { return ATTRVALUE()->GetStartColour(); }
22751 DocColour* AttrFillGeometry::GetEndColour() { return ATTRVALUE()->GetEndColour(); }
22752 DocColour* AttrFillGeometry::GetEndColour2() { return ATTRVALUE()->GetEndColour2(); }
22753 DocColour* AttrFillGeometry::GetEndColour3() { return ATTRVALUE()->GetEndColour3(); }
22754 UINT32* AttrFillGeometry::GetStartTransp() { return ATTRVALUE()->GetStartTransp(); }
22755 UINT32* AttrFillGeometry::GetEndTransp() { return ATTRVALUE()->GetEndTransp(); }
22756 UINT32* AttrFillGeometry::GetEndTransp2() { return ATTRVALUE()->GetEndTransp2(); }
22757 UINT32* AttrFillGeometry::GetEndTransp3() { return ATTRVALUE()->GetEndTransp3(); }
22758 DocCoord* AttrFillGeometry::GetStartPoint() { return ATTRVALUE()->GetStartPoint(); }
22759 DocCoord* AttrFillGeometry::GetEndPoint() { return ATTRVALUE()->GetEndPoint(); }
22760 DocCoord* AttrFillGeometry::GetEndPoint2() { return ATTRVALUE()->GetEndPoint2(); }
22761 DocCoord* AttrFillGeometry::GetEndPoint3() { return ATTRVALUE()->GetEndPoint3(); }
22762 CProfileBiasGain& AttrFillGeometry::GetProfile () { return ATTRVALUE()->GetProfile (); }
22763
22764 void AttrFillGeometry::SetStartColour(DocColour* NewCol){ ATTRVALUE()->SetStartColour(NewCol); }
22765 void AttrFillGeometry::SetEndColour(DocColour* NewCol) { ATTRVALUE()->SetEndColour(NewCol); }
22766 void AttrFillGeometry::SetEndColour2(DocColour* NewCol) { ATTRVALUE()->SetEndColour2(NewCol); }
22767 void AttrFillGeometry::SetEndColour3(DocColour* NewCol) { ATTRVALUE()->SetEndColour3(NewCol); }
22768 void AttrFillGeometry::SetStartTransp(UINT32* NewTransp){ ATTRVALUE()->SetStartTransp(NewTransp); }
22769 void AttrFillGeometry::SetEndTransp(UINT32* NewTransp) { ATTRVALUE()->SetEndTransp(NewTransp); }
22770 void AttrFillGeometry::SetEndTransp2(UINT32* NewTransp) { ATTRVALUE()->SetEndTransp2(NewTransp); }
22771 void AttrFillGeometry::SetEndTransp3(UINT32* NewTransp) { ATTRVALUE()->SetEndTransp3(NewTransp); }
22772 void AttrFillGeometry::SetStartPoint(DocCoord* Pos) { ATTRVALUE()->SetStartPoint(Pos); }
22773 void AttrFillGeometry::SetEndPoint(DocCoord* Pos) { ATTRVALUE()->SetEndPoint(Pos); }
22774 void AttrFillGeometry::SetEndPoint2(DocCoord* Pos) { ATTRVALUE()->SetEndPoint2(Pos); }
22775 void AttrFillGeometry::SetEndPoint3(DocCoord* Pos) { ATTRVALUE()->SetEndPoint3(Pos); }
22776 void AttrFillGeometry::SetProfile (CProfileBiasGain& SetWith) { ATTRVALUE()->SetProfile(SetWith); }
22777
22778 UINT32 AttrFillGeometry::GetTranspType() { return ATTRVALUE()->GetTranspType(); }
22779 UINT32 AttrFillGeometry::GetDPI() { return ATTRVALUE()->GetDPI(); }
22780 UINT32 AttrFillGeometry::GetFractalDPI() { return ATTRVALUE()->GetFractalDPI(); }
22781 UINT32 AttrFillGeometry::GetFractalDim() { return ATTRVALUE()->GetFractalDim(); }
22782 INT32 AttrFillGeometry::GetSeed() { return ATTRVALUE()->GetSeed(); }
22783 FIXED16 AttrFillGeometry::GetGraininess() { return ATTRVALUE()->GetGraininess(); }
22784 FIXED16 AttrFillGeometry::GetGravity() { return ATTRVALUE()->GetGravity(); }
22785 FIXED16 AttrFillGeometry::GetSquash() { return ATTRVALUE()->GetSquash(); }
22786 BOOL AttrFillGeometry::GetTileable() { return ATTRVALUE()->GetTileable(); }
22787 double AttrFillGeometry::GetNoiseScale() { return ATTRVALUE()->GetNoiseScale(); }
22788
22789 void AttrFillGeometry::SetTranspType(UINT32 NewType) { ATTRVALUE()->SetTranspType(NewType); }
22790 BOOL AttrFillGeometry::SetDPI(UINT32 NewDpi) { return ATTRVALUE()->SetDPI(NewDpi); }
22791 BOOL AttrFillGeometry::SetFractalDPI(UINT32 NewDpi) { return ATTRVALUE()->SetFractalDPI(NewDpi); }
22792 void AttrFillGeometry::SetFractalDim(UINT32 NewDim) { ATTRVALUE()->SetFractalDim(NewDim); }
22793 BOOL AttrFillGeometry::SetSeed(INT32 NewSeed) { return ATTRVALUE()->SetSeed(NewSeed); }
22794 BOOL AttrFillGeometry::SetGraininess(FIXED16 NewGrain) { return ATTRVALUE()->SetGraininess(NewGrain); }
22795 BOOL AttrFillGeometry::SetGravity(FIXED16 NewGrav) { return ATTRVALUE()->SetGravity(NewGrav); }
22796 BOOL AttrFillGeometry::SetSquash(FIXED16 NewSquash) { return ATTRVALUE()->SetSquash(NewSquash); }
22797 BOOL AttrFillGeometry::SetTileable(BOOL NewTile) { return ATTRVALUE()->SetTileable(NewTile); }
22798 BOOL AttrFillGeometry::SetNoiseScale(double ns) { return ATTRVALUE()->SetNoiseScale(ns); }
22799
22800 BOOL AttrFillGeometry::RecalcFractal() { return ATTRVALUE()->RecalcFractal(); }
22801 BOOL AttrFillGeometry::Randomise() { return ATTRVALUE()->Randomise(); }
22802
22803 BOOL AttrFillGeometry::AttachBitmap(KernelBitmap* NewBitmap) { return ATTRVALUE()->AttachBitmap(NewBitmap); }
22804 BOOL AttrFillGeometry::DetachBitmap() { return ATTRVALUE()->DetachBitmap(); }
22805 KernelBitmap* AttrFillGeometry::GetBitmap() { return ATTRVALUE()->GetBitmap(); }
22806 BOOL AttrFillGeometry::CopyBitmap(KernelBitmap* CopyBitmap) { return ATTRVALUE()->CopyBitmap(CopyBitmap); }
22807
22808 KernelBitmapRef* AttrFillGeometry::GetBitmapRef() { return ATTRVALUE()->GetBitmapRef(); }
22809
22810 INT32 AttrFillGeometry::GetTesselation() { return ATTRVALUE()->GetTesselation(); }
22811 void AttrFillGeometry::SetTesselation(INT32 NewTess) { ATTRVALUE()->SetTesselation(NewTess); }
22812 BOOL AttrFillGeometry::IsPerspective() { return ATTRVALUE()->IsPerspective(); }
22813 ColourRamp* AttrFillGeometry::GetColourRamp() { return ATTRVALUE()->GetColourRamp(); }
22814 TransparencyRamp* AttrFillGeometry::GetTranspRamp() { return ATTRVALUE()->GetTranspRamp(); }
22815 void AttrFillGeometry::SetColourRamp(ColourRamp* New) { ATTRVALUE()->SetColourRamp (New); }
22816 void AttrFillGeometry::SetTranspRamp(TransparencyRamp* New) { ATTRVALUE()->SetTranspRamp(New); }
22817
22818
22819
22820
22821
22822
22823
22824
22825
22826
22827
22828
22829
22830
22831
22832
22833
22834 #ifdef XAR_TREE_DIALOG
22835 void FillAttrRecordHandler::GetRecordDescriptionText(CXaraFileRecord* pRecord,StringBase* pStr)
22836 {
22837 if (pStr == NULL || pRecord == NULL)
22838 return;
22839
22840
22841
22842 CamelotRecordHandler::GetRecordDescriptionText(pRecord,pStr);
22843
22844 TCHAR s[256];
22845
22846 UINT32 Tag = pRecord->GetTag();
22847 switch (Tag)
22848 {
22849 case TAG_FLATFILL :
22850 {
22851
22852 INT32 ColourRef;
22853 pRecord->ReadINT32(&ColourRef);
22854 camSprintf(s,_T("Colour reference = %d\r\n"),ColourRef); (*pStr) += s;
22855 }
22856 break;
22857
22858 case TAG_LINEARFILL :
22859 case TAG_LINEARFILL3POINT :
22860 case TAG_ELLIPTICALFILL :
22861 case TAG_CIRCULARFILL :
22862 case TAG_CONICALFILL :
22863 case TAG_SQUAREFILL :
22864 {
22865 DocCoord StartPoint, EndPoint, EndPoint2;
22866 INT32 StartColourRef,EndColourRef;
22867
22868
22869 pRecord->ReadCoord(&StartPoint);
22870 pRecord->ReadCoord(&EndPoint);
22871 if (Tag == TAG_ELLIPTICALFILL || Tag == TAG_SQUAREFILL || Tag==TAG_LINEARFILL3POINT)
22872 pRecord->ReadCoord(&EndPoint2);
22873 pRecord->ReadINT32(&StartColourRef);
22874 pRecord->ReadINT32(&EndColourRef);
22875
22876 camSprintf(s,_T("Start Colour ref\t= %d\r\n"),StartColourRef); (*pStr) += s;
22877 camSprintf(s,_T("End Colour ref\t= %d\r\n"),EndColourRef); (*pStr) += s;
22878 camSprintf(s,_T("Coord 1\t\t= (%d,%d)\r\n"),StartPoint.x,StartPoint.y); (*pStr) += s;
22879 camSprintf(s,_T("Coord 2\t\t= (%d,%d)\r\n"),EndPoint.x,EndPoint.y); (*pStr) += s;
22880 if (Tag == TAG_ELLIPTICALFILL || Tag == TAG_SQUAREFILL || Tag==TAG_LINEARFILL3POINT)
22881 {
22882 camSprintf(s,_T("Coord 3\t\t= (%d,%d)\r\n"),EndPoint2.x,EndPoint2.y); (*pStr) += s;
22883 }
22884 }
22885 break;
22886
22887 case TAG_THREECOLFILL :
22888 case TAG_FOURCOLFILL :
22889 {
22890 DocCoord StartPoint, EndPoint, EndPoint2;
22891 INT32 StartColourRef,EndColourRef, EndColourRef2, EndColourRef3;
22892
22893
22894 pRecord->ReadCoord(&StartPoint);
22895 pRecord->ReadCoord(&EndPoint);
22896 pRecord->ReadCoord(&EndPoint2);
22897 pRecord->ReadINT32(&StartColourRef);
22898 pRecord->ReadINT32(&EndColourRef);
22899 pRecord->ReadINT32(&EndColourRef2);
22900 if (Tag == TAG_FOURCOLFILL)
22901 pRecord->ReadINT32(&EndColourRef3);
22902
22903 camSprintf(s,_T("Start Colour ref\t= %d\r\n"),StartColourRef); (*pStr) += s;
22904 camSprintf(s,_T("End Colour ref\t= %d\r\n"),EndColourRef); (*pStr) += s;
22905 camSprintf(s,_T("End Colour2 ref\t= %d\r\n"),EndColourRef2); (*pStr) += s;
22906 if (Tag == TAG_FOURCOLFILL)
22907 {
22908 camSprintf(s,_T("End Colour3 ref\t= %d\r\n"),EndColourRef3); (*pStr) += s;
22909 }
22910 camSprintf(s,_T("Coord 1\t\t= (%d,%d)\r\n"),StartPoint.x,StartPoint.y); (*pStr) += s;
22911 camSprintf(s,_T("Coord 2\t\t= (%d,%d)\r\n"),EndPoint.x,EndPoint.y); (*pStr) += s;
22912 camSprintf(s,_T("Coord 3\t\t= (%d,%d)\r\n"),EndPoint2.x,EndPoint2.y); (*pStr) += s;
22913 }
22914 break;
22915
22916 case TAG_BITMAPFILL :
22917 case TAG_CONTONEBITMAPFILL :
22918 {
22919 DocCoord StartPoint, EndPoint, EndPoint2;
22920 INT32 BitmapRef;
22921 INT32 StartColourRef,EndColourRef;
22922
22923
22924 pRecord->ReadCoord(&StartPoint);
22925 pRecord->ReadCoord(&EndPoint);
22926 pRecord->ReadCoord(&EndPoint2);
22927 if (Tag == TAG_CONTONEBITMAPFILL)
22928 {
22929 pRecord->ReadINT32(&StartColourRef);
22930 pRecord->ReadINT32(&EndColourRef);
22931 }
22932 pRecord->ReadINT32(&BitmapRef);
22933
22934 camSprintf(s,_T("Bitmap reference\t= %d\r\n"),BitmapRef); (*pStr) += s;
22935 if (Tag == TAG_CONTONEBITMAPFILL)
22936 {
22937 camSprintf(s,_T("Start Colour ref\t= %d\r\n"),StartColourRef); (*pStr) += s;
22938 camSprintf(s,_T("End Colour ref\t= %d\r\n"),EndColourRef); (*pStr) += s;
22939 }
22940 camSprintf(s,_T("Coord 1\t\t= (%d,%d)\r\n"),StartPoint.x,StartPoint.y); (*pStr) += s;
22941 camSprintf(s,_T("Coord 2\t\t= (%d,%d)\r\n"),EndPoint.x,EndPoint.y); (*pStr) += s;
22942 camSprintf(s,_T("Coord 3\t\t= (%d,%d)\r\n"),EndPoint2.x,EndPoint2.y); (*pStr) += s;
22943 }
22944 break;
22945
22946 case TAG_FRACTALFILL:
22947 {
22948 DocCoord StartPoint, EndPoint, EndPoint2;
22949 INT32 StartColRef,EndColRef, Seed, DPI;
22950 FIXED16 Graininess, Gravity, Squash;
22951 BYTE Tileable;
22952 double d = 1.0;
22953
22954
22955 pRecord->ReadCoord(&StartPoint);
22956 pRecord->ReadCoord(&EndPoint);
22957 pRecord->ReadCoord(&EndPoint2);
22958 pRecord->ReadINT32(&StartColRef);
22959 pRecord->ReadINT32(&EndColRef);
22960
22961 pRecord->ReadINT32(&Seed);
22962 pRecord->ReadFIXED16(&Graininess);
22963 pRecord->ReadFIXED16(&Gravity);
22964 pRecord->ReadFIXED16(&Squash);
22965 pRecord->ReadINT32(&DPI);
22966 pRecord->ReadBYTE(&Tileable);
22967
22968 camSprintf(s,_T("Start Colour ref\t= %d\r\n"),StartColRef); (*pStr) += s;
22969 camSprintf(s,_T("End Colour ref\t= %d\r\n"),EndColRef); (*pStr) += s;
22970
22971 camSprintf(s,_T("Coord 1\t\t= (%d,%d)\r\n"),StartPoint.x,StartPoint.y); (*pStr) += s;
22972 camSprintf(s,_T("Coord 2\t\t= (%d,%d)\r\n"),EndPoint.x,EndPoint.y); (*pStr) += s;
22973 camSprintf(s,_T("Coord 3\t\t= (%d,%d)\r\n"),EndPoint2.x,EndPoint2.y); (*pStr) += s;
22974
22975 camSprintf(s,_T("Seed\t\t= %d\r\n"),Seed); (*pStr) += s;
22976
22977 d = Graininess.MakeDouble();camSprintf(s,_T("Graininess\t= %g\r\n"),d); (*pStr) += s;
22978 d = Gravity.MakeDouble(); camSprintf(s,_T("Gravity\t\t= %g\r\n"),d); (*pStr) += s;
22979 d = Squash.MakeDouble(); camSprintf(s,_T("Squash\t\t= %g\r\n"),d); (*pStr) += s;
22980
22981 camSprintf(s,_T("DPI\t\t= %d\r\n"),DPI); (*pStr) += s;
22982 camSprintf(s,_T("Tileable\t\t= %d\r\n"),INT32(Tileable)); (*pStr) += s;
22983 }
22984 break;
22985
22986 case TAG_FLATTRANSPARENTFILL:
22987 {
22988 BYTE Transp,TranspType;
22989 pRecord->ReadBYTE(&Transp);
22990 pRecord->ReadBYTE(&TranspType);
22991
22992 camSprintf(s,_T("Transparency\t\t= %d\r\n"),INT32(Transp)); (*pStr) += s;
22993 camSprintf(s,_T("Transparency Type\t\t= %d\r\n"),INT32(TranspType)); (*pStr) += s;
22994 }
22995 break;
22996
22997 case TAG_LINEARTRANSPARENTFILL:
22998 case TAG_LINEARTRANSPARENTFILL3POINT:
22999 case TAG_ELLIPTICALTRANSPARENTFILL:
23000 case TAG_CIRCULARTRANSPARENTFILL:
23001 case TAG_CONICALTRANSPARENTFILL:
23002 case TAG_SQUARETRANSPARENTFILL:
23003 {
23004 DocCoord StartPoint, EndPoint, EndPoint2;
23005 BYTE Transp,EndTransp,TranspType;
23006
23007 pRecord->ReadCoord(&StartPoint);
23008 pRecord->ReadCoord(&EndPoint);
23009 if (Tag == TAG_ELLIPTICALTRANSPARENTFILL || Tag == TAG_SQUARETRANSPARENTFILL || Tag==TAG_LINEARFILL3POINT)
23010 pRecord->ReadCoord(&EndPoint2);
23011 pRecord->ReadBYTE(&Transp);
23012 pRecord->ReadBYTE(&EndTransp);
23013 pRecord->ReadBYTE(&TranspType);
23014
23015 camSprintf(s,_T("Coord 1\t\t= (%d,%d)\r\n"),StartPoint.x,StartPoint.y); (*pStr) += s;
23016 camSprintf(s,_T("Coord 2\t\t= (%d,%d)\r\n"),EndPoint.x,EndPoint.y); (*pStr) += s;
23017 if (Tag == TAG_ELLIPTICALTRANSPARENTFILL || Tag == TAG_SQUARETRANSPARENTFILL || Tag==TAG_LINEARFILL3POINT)
23018 {
23019 camSprintf(s,_T("Coord 3\t\t= (%d,%d)\r\n"),EndPoint2.x,EndPoint2.y); (*pStr) += s;
23020 }
23021 camSprintf(s,_T("Start Transparency\t= %d\r\n"),INT32(Transp)); (*pStr) += s;
23022 camSprintf(s,_T("End Transparency\t= %d\r\n"),INT32(EndTransp)); (*pStr) += s;
23023 camSprintf(s,_T("Transparency Type\t= %d\r\n"),INT32(TranspType)); (*pStr) += s;
23024 }
23025 break;
23026
23027 case TAG_THREECOLTRANSPARENTFILL:
23028 case TAG_FOURCOLTRANSPARENTFILL:
23029 {
23030 DocCoord StartPoint;
23031 DocCoord EndPoint;
23032 DocCoord EndPoint2;
23033 BYTE Transp;
23034 BYTE EndTransp;
23035 BYTE EndTransp2;
23036 BYTE EndTransp3;
23037 BYTE TranspType;
23038
23039 pRecord->ReadCoord(&StartPoint);
23040 pRecord->ReadCoord(&EndPoint);
23041 pRecord->ReadCoord(&EndPoint2);
23042 pRecord->ReadBYTE(&Transp);
23043 pRecord->ReadBYTE(&EndTransp);
23044 pRecord->ReadBYTE(&EndTransp2);
23045 if (Tag == TAG_FOURCOLTRANSPARENTFILL)
23046 pRecord->ReadBYTE(&EndTransp3);
23047 pRecord->ReadBYTE(&TranspType);
23048
23049 camSprintf(s,_T("Coord 1\t\t= (%d,%d)\r\n"),StartPoint.x,StartPoint.y); (*pStr) += s;
23050 camSprintf(s,_T("Coord 2\t\t= (%d,%d)\r\n"),EndPoint.x,EndPoint.y); (*pStr) += s;
23051 camSprintf(s,_T("Coord 3\t\t= (%d,%d)\r\n"),EndPoint2.x,EndPoint2.y); (*pStr) += s;
23052 camSprintf(s,_T("Start Transparency\t= %d\r\n"),INT32(Transp)); (*pStr) += s;
23053 camSprintf(s,_T("End Transparency\t= %d\r\n"),INT32(EndTransp)); (*pStr) += s;
23054 camSprintf(s,_T("End Transparency2\t= %d\r\n"),INT32(EndTransp2)); (*pStr) += s;
23055
23056 if (Tag == TAG_FOURCOLTRANSPARENTFILL)
23057 {
23058 camSprintf(s,_T("End Transparency3\t= %d\r\n"),INT32(EndTransp3)); (*pStr) += s;
23059 }
23060
23061 camSprintf(s,_T("Transparency Type\t= %d\r\n"),INT32(TranspType)); (*pStr) += s;
23062 }
23063 break;
23064
23065 case TAG_BITMAPTRANSPARENTFILL:
23066 {
23067 DocCoord StartPoint, EndPoint, EndPoint2;
23068 INT32 BitmapRef;
23069 BYTE Transp,EndTransp,TranspType;
23070
23071
23072 pRecord->ReadCoord(&StartPoint);
23073 pRecord->ReadCoord(&EndPoint);
23074 pRecord->ReadCoord(&EndPoint2);
23075 pRecord->ReadBYTE(&Transp);
23076 pRecord->ReadBYTE(&EndTransp);
23077 pRecord->ReadBYTE(&TranspType);
23078 pRecord->ReadINT32(&BitmapRef);
23079
23080 camSprintf(s,_T("Bitmap reference\t= %d\r\n"),BitmapRef); (*pStr) += s;
23081
23082 camSprintf(s,_T("Coord 1\t\t= (%d,%d)\r\n"),StartPoint.x,StartPoint.y); (*pStr) += s;
23083 camSprintf(s,_T("Coord 2\t\t= (%d,%d)\r\n"),EndPoint.x,EndPoint.y); (*pStr) += s;
23084 camSprintf(s,_T("Coord 3\t\t= (%d,%d)\r\n"),EndPoint2.x,EndPoint2.y); (*pStr) += s;
23085
23086 camSprintf(s,_T("Start Transparency\t= %d\r\n"),INT32(Transp)); (*pStr) += s;
23087 camSprintf(s,_T("End Transparency\t= %d\r\n"),INT32(EndTransp)); (*pStr) += s;
23088 camSprintf(s,_T("Transparency Type\t= %d\r\n"),INT32(TranspType)); (*pStr) += s;
23089
23090 }
23091 break;
23092
23093 case TAG_FRACTALTRANSPARENTFILL:
23094 {
23095 DocCoord StartPoint, EndPoint, EndPoint2;
23096 BYTE Transp,EndTransp,TranspType;
23097 INT32 Seed, DPI;
23098 FIXED16 Graininess, Gravity, Squash;
23099 BYTE Tileable;
23100 double d = 1.0;
23101
23102
23103 pRecord->ReadCoord(&StartPoint);
23104 pRecord->ReadCoord(&EndPoint);
23105 pRecord->ReadCoord(&EndPoint2);
23106 pRecord->ReadBYTE(&Transp);
23107 pRecord->ReadBYTE(&EndTransp);
23108 pRecord->ReadBYTE(&TranspType);
23109
23110 pRecord->ReadINT32(&Seed);
23111 pRecord->ReadFIXED16(&Graininess);
23112 pRecord->ReadFIXED16(&Gravity);
23113 pRecord->ReadFIXED16(&Squash);
23114 pRecord->ReadINT32(&DPI);
23115 pRecord->ReadBYTE(&Tileable);
23116
23117 camSprintf(s,_T("Coord 1\t\t= (%d,%d)\r\n"),StartPoint.x,StartPoint.y); (*pStr) += s;
23118 camSprintf(s,_T("Coord 2\t\t= (%d,%d)\r\n"),EndPoint.x,EndPoint.y); (*pStr) += s;
23119 camSprintf(s,_T("Coord 3\t\t= (%d,%d)\r\n"),EndPoint2.x,EndPoint2.y); (*pStr) += s;
23120
23121 camSprintf(s,_T("Start Transparency\t= %d\r\n"),INT32(Transp)); (*pStr) += s;
23122 camSprintf(s,_T("End Transparency\t= %d\r\n"),INT32(EndTransp)); (*pStr) += s;
23123 camSprintf(s,_T("Transparency Type\t= %d\r\n"),INT32(TranspType)); (*pStr) += s;
23124
23125 camSprintf(s,_T("Seed\t\t= %d\r\n"),Seed); (*pStr) += s;
23126
23127 d = Graininess.MakeDouble();camSprintf(s,_T("Graininess\t= %g\r\n"),d); (*pStr) += s;
23128 d = Gravity.MakeDouble(); camSprintf(s,_T("Gravity\t\t= %g\r\n"),d); (*pStr) += s;
23129 d = Squash.MakeDouble(); camSprintf(s,_T("Squash\t\t= %g\r\n"),d); (*pStr) += s;
23130
23131 camSprintf(s,_T("DPI\t\t= %d\r\n"),DPI); (*pStr) += s;
23132 camSprintf(s,_T("Tileable\t\t= %d\r\n"),INT32(Tileable)); (*pStr) += s;
23133 }
23134 break;
23135 }
23136 }
23137 #endif // _DEBUG