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
00106 #ifndef INC_FILLATTR
00107 #define INC_FILLATTR
00108
00109 #include "attr.h"
00110 #include "nodeattr.h"
00111 #include "msg.h"
00112 #include "bitmap.h"
00113 #include "list.h"
00114 #include "binds.h"
00115 #include "clikmods.h"
00116
00117
00118 class TransparencyRamp;
00119 class ColourRamp;
00120 class CProfileBiasGain;
00121 class FillGeometryAttribute;
00122 class AttrValueChange;
00123 class AttrColourChange;
00124 class AttrTranspChange;
00125 class AttrColourDrop;
00126 class FillRamp;
00127 class AttrColFillRampChange;
00128 class AttrTranspFillRampChange;
00129 class UndoableOperation;
00130 class SelectedAttrs;
00131 class MouldGeometry;
00132 class NodeMould;
00133
00134
00135
00136
00137
00138
00139
00140
00141
00142
00143
00144
00145
00146
00147
00148
00149
00150
00151
00152
00153
00154
00155
00156
00157 typedef INT32 FillControl;
00158
00159 enum
00160 {
00161 FILLCONTROL_STARTPOINT,
00162 FILLCONTROL_ENDPOINT,
00163 FILLCONTROL_ENDPOINT2,
00164 FILLCONTROL_ENDPOINT3,
00165 FILLCONTROL_SECONDARYPOINT,
00166 FILLCONTROL_DRAGPOINT,
00167 FILLCONTROL_DRAGPOINT2,
00168 FILLCONTROL_DRAGPOINT3,
00169 FILLCONTROL_MANY,
00170 FILLCONTROL_RAMPPOINT,
00171 FILLCONTROL_NULL
00172 };
00173
00174 enum
00175 {
00176 BLOBSTATE_OFF,
00177 BLOBSTATE_ON,
00178 BLOBSTATE_TOGGLE
00179 };
00180
00181 #define NUMCONTROLPOINTS FILLCONTROL_NULL
00182
00183 #define DEFAULT_FILLWIDTH 72000;
00184 #define DEFAULT_FILLHEIGHT 72000;
00185
00186 #define ATTRVALUE() ((FillGeometryAttribute*)GetAttributeValue())
00187
00189
00190
00191
00193
00194
00195
00196
00197
00198
00199
00200
00201
00202
00203
00204
00205
00206 class AttrFillGeometry : public NodeAttribute
00207 {
00208 CC_DECLARE_DYNCREATE(AttrFillGeometry)
00209
00210 public:
00211 AttrFillGeometry();
00212 ~AttrFillGeometry();
00213 AttrFillGeometry(Node* ContextNode,
00214 AttachNodeDirection Direction,
00215 BOOL Locked=FALSE,
00216 BOOL Mangled=FALSE,
00217 BOOL Marked=FALSE,
00218 BOOL Selected=FALSE):
00219 NodeAttribute(ContextNode, Direction, Locked, Mangled, Marked, Selected) {}
00220
00221 static BOOL Init();
00222
00223 virtual INT32 operator==(const NodeAttribute& NodeAttrib);
00224 virtual INT32 operator=(AttrFillGeometry& FillAttrib);
00225
00226
00227 virtual void RenderFillBlobs(RenderRegion* pRender) {}
00228 virtual void RenderFillMesh(RenderRegion*, DocCoord* , BOOL*, INT32 NumControlPoints = 0) {}
00229 virtual void RenderFillBlobs();
00230
00231
00232 BOOL AllowRampRedraw;
00233 void DisableRampRedraw () { AllowRampRedraw = FALSE; }
00234 void EnableRampRedraw () { AllowRampRedraw = TRUE; }
00235
00236
00237
00238 BOOL AllowBoundsRedraw;
00239 void DisableBoundsRedraw () { AllowBoundsRedraw = FALSE; }
00240 void EnableBoundsRedraw () { AllowBoundsRedraw = TRUE; }
00241
00242 virtual void DrawEndBlobs();
00243
00244 virtual DocColour* GetStartColour();
00245 virtual DocColour* GetEndColour();
00246 virtual DocColour* GetEndColour2();
00247 virtual DocColour* GetEndColour3();
00248 virtual UINT32* GetStartTransp();
00249 virtual UINT32* GetEndTransp();
00250 virtual UINT32* GetEndTransp2();
00251 virtual UINT32* GetEndTransp3();
00252 virtual DocCoord* GetStartPoint();
00253 virtual DocCoord* GetEndPoint();
00254 virtual DocCoord* GetEndPoint2();
00255 virtual DocCoord* GetEndPoint3();
00256 virtual CProfileBiasGain& GetProfile ();
00257
00258 virtual void SetStartColour(DocColour* NewCol);
00259 virtual void SetEndColour(DocColour* NewCol);
00260 virtual void SetEndColour2(DocColour* NewCol);
00261 virtual void SetEndColour3(DocColour* NewCol);
00262 virtual void SetStartTransp(UINT32* NewTransp);
00263 virtual void SetEndTransp(UINT32* NewTransp);
00264 virtual void SetEndTransp2(UINT32* NewTransp);
00265 virtual void SetEndTransp3(UINT32* NewTransp);
00266 virtual void SetStartPoint(DocCoord* Pos);
00267 virtual void SetEndPoint(DocCoord* Pos);
00268 virtual void SetEndPoint2(DocCoord* Pos);
00269 virtual void SetEndPoint3(DocCoord* Pos);
00270 virtual void SetProfile (CProfileBiasGain& SetWith);
00271
00272 virtual UINT32 GetTranspType();
00273 virtual UINT32 GetDPI();
00274 virtual UINT32 GetFractalDPI();
00275 virtual UINT32 GetFractalDim();
00276 virtual INT32 GetSeed();
00277 virtual FIXED16 GetGraininess();
00278 virtual FIXED16 GetGravity();
00279 virtual FIXED16 GetSquash();
00280 virtual BOOL GetTileable();
00281 virtual double GetNoiseScale();
00282
00283 virtual void SetTranspType(UINT32 NewType);
00284 virtual BOOL SetDPI(UINT32 NewDpi);
00285 virtual BOOL SetFractalDPI(UINT32 NewDpi);
00286 virtual void SetFractalDim(UINT32 NewDim);
00287 virtual BOOL SetSeed(INT32 NewSeed);
00288 virtual BOOL SetGraininess(FIXED16 NewGrain);
00289 virtual BOOL SetGravity(FIXED16 NewGrav);
00290 virtual BOOL SetSquash(FIXED16 NewSquash);
00291 virtual BOOL SetTileable(BOOL NewTile);
00292 virtual BOOL SetNoiseScale(double ns);
00293
00294 virtual BOOL RecalcFractal();
00295 virtual BOOL Randomise();
00296
00297 virtual BOOL AttachBitmap(KernelBitmap* NewBitmap);
00298 virtual BOOL DetachBitmap();
00299 virtual KernelBitmap* GetBitmap();
00300 virtual BOOL CopyBitmap(KernelBitmap* CopyBitmap);
00301
00302 virtual KernelBitmapRef* GetBitmapRef();
00303
00304 virtual INT32 GetTesselation();
00305 virtual void SetTesselation(INT32 NewTess);
00306
00307 virtual BOOL IsPerspective();
00308 virtual ColourRamp* GetColourRamp();
00309 virtual TransparencyRamp* GetTranspRamp();
00310 virtual void SetColourRamp(ColourRamp* New);
00311 virtual void SetTranspRamp(TransparencyRamp* New);
00312
00313 virtual void MakePerspective(UndoableOperation* pUndoOp = NULL);
00314 virtual void RemovePerspective(UndoableOperation* pUndoOp = NULL);
00315
00316 virtual DocColour *EnumerateColourFields(UINT32 Context);
00317
00318 virtual AttributeValue* GetAttributeValue() = 0;
00319 virtual DocRect GetBlobBoundingRect();
00320 virtual ANGLE GetSecondaryAngle() { return 0; }
00321
00322 FillRamp* GetFillRamp();
00323
00324
00325 DocColour* GetFirstSelectedColour();
00326 UINT32* GetFirstSelectedTransp();
00327 INT32 GetFirstSelectedIndex();
00328
00329
00330 DocRect GetBoundingRect() { return AttrBounds; }
00331 void SetBoundingRect(DocRect &NewBounds);
00332 BOOL WriteBoundingRect(BaseCamelotFilter* pFilter);
00333
00334
00335 virtual BOOL OnClick( DocCoord, ClickType, ClickModifiers, Spread * );
00336
00337 virtual void GetControlPoints(DocCoord*, INT32);
00338 virtual void OnControlDrag( DocCoord, FillControl&, ClickModifiers );
00339 virtual void SetAspectRatio(double Ratio);
00340
00341 UINT32 GetSelectionState(BOOL**);
00342 BOOL IsSelected(UINT32 Control);
00343
00344 UINT32 GetSelectionCount();
00345 UINT32 GetBlobCount(BOOL IncludeRamps=TRUE);
00346
00347 virtual void SetBlobState(FillControl, BOOL);
00348 virtual void ToggleSelection(FillControl);
00349 virtual void SelectBlob(FillControl);
00350 virtual void DeselectBlob(FillControl);
00351 virtual void DeselectAll();
00352 virtual void DeselectAllBut(FillControl);
00353 virtual void DeselectAllNoRedraw();
00354
00355 virtual void CycleSelection(BOOL Reverse);
00356
00357 static AttrFillGeometry* FindFirstSelectedAttr(CCRuntimeClass* AttrType = (CCRuntimeClass*)CC_RUNTIME_CLASS(AttrFillGeometry));
00358 static AttrFillGeometry* FindNextSelectedAttr(CCRuntimeClass* AttrType = (CCRuntimeClass*)CC_RUNTIME_CLASS(AttrFillGeometry));
00359
00360 static UINT32 CountSelectionControlPoints();
00361 static BOOL CheckAttrClick( DocCoord PointerPos, ClickType Click, ClickModifiers ClickMods, Spread* pSpread);
00362 static BOOL CheckForFillControlHit(DocCoord Pos, UINT32* Status);
00363
00364 static FillControl DoColourDropTest(AttrColourDrop*, NodeRenderableInk**, AttrFillGeometry** FillAttr = NULL);
00365
00366 static BOOL IsTranspMeshVisible();
00367 static BOOL IsColourMeshVisible();
00368
00369 virtual BOOL IsVisible() { return IsColourMeshVisible(); }
00370 virtual BOOL NeedsTransparency() const;
00371
00372 virtual FillControl CheckForControlHit(DocCoord &);
00373
00374 virtual AttrFillGeometry* Mutate(AttrFillGeometry*, BOOL bOptimise = TRUE);
00375 virtual AttrFillGeometry* ChangeAttrValue(AttrValueChange*) { return NULL; }
00376
00377 virtual void AttributeChanged();
00378
00379 static UINT32 FillSelectionCount();
00380 static void SetSelectionCount(UINT32);
00381 static void SetTranspMeshesVisible(BOOL);
00382
00383 virtual BOOL Blend(BlendAttrParam* pBlendParam);
00384
00385 virtual AttrFillGeometry* DoColourDrop(AttrColourDrop*);
00386 virtual FillControl TestColourDrop(AttrColourDrop*);
00387
00388 virtual BOOL ChangeControlColour(AttrColourChange *);
00389 virtual BOOL ChangeControlTransp(AttrTranspChange *);
00390 virtual BOOL ChangeControlColour(DocColour&, FillControl, AttrColourDrop * pColDrop = NULL);
00391 virtual BOOL EditColourFillRamp(AttrColFillRampChange *);
00392 virtual BOOL EditTranspFillRamp(AttrTranspFillRampChange *);
00393
00394 virtual BOOL IsAFillAttr() const { return TRUE; }
00395
00396 virtual void TransformSelectedControlPoints( TransformBase&, BOOL* isARampBlob = NULL );
00397 virtual void TransformSelectedFillRampControlPoints (TransformBase&, ClickModifiers ClickMods, BOOL* isARampBlob);
00398
00399
00400
00401 virtual void TransformToNewBounds(DocRect& NewBounds);
00402
00403 virtual BOOL NeedsForceToSimpleMapping() { return(TRUE); }
00404
00405 virtual BOOL IsARadialColourFill() const { return FALSE;}
00406
00407 virtual BOOL CopyComponentData(BaseDocument* SrcDoc, BaseDocument* NodesDoc);
00408
00409 virtual BOOL WriteColourDefinitions (BaseCamelotFilter* pFilter) { return (TRUE); }
00410
00411 virtual void PolyCopyNodeContents(NodeRenderable* pNodeCopy);
00412
00413 protected:
00414 virtual void ValidateAttributeValue() { }
00415 virtual BOOL CopyNodeContents(AttrFillGeometry* NodeCopy);
00416 virtual void RenderControl(FillControl, BOOL);
00417
00418 void RenderFillControl(BOOL RenderOn,
00419 DocRect* ControlRect,
00420 Spread* pSpread,
00421 NodeRenderable* pParent);
00422
00423 void RenderControlIntoPendingRegions(DocRect* ControlRect,
00424 Spread* pSpread,
00425 NodeRenderable* pParent);
00426
00427 AttrFillGeometry* ChangeColour(AttrValueChange*);
00428 AttrFillGeometry* ChangeTransp(AttrValueChange*);
00429
00430 BOOL CheckPreviousFillMesh();
00431 BOOL IsFillBeingEdited();
00432 static BOOL IsMeshSame(FillGeometryAttribute* , FillGeometryAttribute*);
00433
00434 void SetLastRenderedBlob(FillControl);
00435 BOOL IsBlobSame(FillControl);
00436 void ChangeBlobState(FillControl, INT32);
00437
00438
00439
00440
00441
00442
00443 public:
00444 virtual BOOL IsTypeExtendible() const { return TRUE; }
00445 virtual DocRect ValidateExtend(const ExtendParams& ExtParams);
00446 virtual void Extend(const ExtendParams& ExtParams);
00447
00448
00449 virtual DocCoord FindExtendCentre() { return *GetStartPoint(); }
00450
00451
00452 virtual void TransformTranslateObject(const ExtendParams& ExtParams);
00453
00454
00455
00456
00457 virtual INT32 GetNumberOfControlPoints() { return 0; }
00458
00459 public:
00460 static AttrFillGeometry* EditedFill;
00461 static AttrFillGeometry* DraggedFill;
00462 static List HitList;
00463
00464 static BOOL DoFillMeshCheck;
00465 static FillGeometryAttribute* LastRenderedMesh;
00466
00467 static DocCoord LastRenderedStartBlob;
00468 static DocCoord LastRenderedEndBlob;
00469 static DocCoord LastRenderedEnd2Blob;
00470 static DocCoord LastRenderedEnd3Blob;
00471
00472 static UINT32 SelectionCount;
00473
00474 static INT32 FractalSeed;
00475 static double FractalGraininess;
00476 static double FractalGravity;
00477
00478 static INT32 FractalDPI;
00479 static INT32 MaxFractalSize;
00480
00481 static BOOL TranspMeshesVisible;
00482
00483 static BOOL DoCheckOnFillRampMesh;
00484
00485
00486
00487
00488
00489 static BOOL s_bGroupTransparency;
00490
00491 protected:
00492 BOOL SelectionState[5];
00493
00494 static FillControl ControlHit;
00495 static AttrFillGeometry* FillHit;
00496
00497 static SelectedAttrs s_SelAttrs;
00498 static CCAttrMap AttribMap;
00499
00500
00501 DocRect AttrBounds;
00502
00503
00504
00505 virtual double FindRampPoint(DocCoord &dc, DocCoord &StartPoint, DocCoord &EndPoint);
00506 };
00507
00508
00509
00510
00511
00512
00513
00514
00515
00516
00517
00518
00519
00520 class SelectedAttrs : public CCObject
00521 {
00522 public:
00523 SelectedAttrs()
00524 {
00525 m_pAttrSelectionLevel = NULL;
00526 m_pAttrSelection = NULL;
00527 m_pSelNode = NULL;
00528 m_pLastSelectedAttr = NULL;
00529 }
00530
00531 ~SelectedAttrs()
00532 {
00533 if (m_pAttrSelectionLevel)
00534 {
00535 delete m_pAttrSelectionLevel;
00536 m_pAttrSelectionLevel = NULL;
00537 }
00538 }
00539
00540 NodeAttribute* FindFirst(CCRuntimeClass* AttrType = (CCRuntimeClass*)CC_RUNTIME_CLASS(AttrFillGeometry));
00541 NodeAttribute* FindNext(CCRuntimeClass* AttrType = (CCRuntimeClass*)CC_RUNTIME_CLASS(AttrFillGeometry));
00542
00543 private:
00544 Range* m_pAttrSelectionLevel;
00545 SelRange* m_pAttrSelection;
00546 Node* m_pSelNode;
00547 NodeAttribute* m_pLastSelectedAttr;
00548 };
00549
00550
00551
00552
00553
00554
00555
00556
00557
00558
00559
00560
00561
00562 class AttrTranspFillGeometry : public virtual AttrFillGeometry
00563 {
00564 CC_DECLARE_DYNAMIC(AttrTranspFillGeometry)
00565
00566 public:
00567 AttrTranspFillGeometry() : AttrFillGeometry() {}
00568 };
00569
00570
00571
00572
00573
00574
00575
00576
00577
00578
00579
00580
00581
00582
00583 class AttrValueChange : public AttrFillGeometry
00584 {
00585 CC_DECLARE_DYNAMIC(AttrValueChange)
00586
00587 public:
00588 AttrValueChange();
00589
00590 virtual UINT32 GetAttrNameID(void);
00591
00592 virtual AttributeValue* GetAttributeValue() = 0;
00593 virtual CCRuntimeClass* GetAttributeType();
00594
00595 virtual void MutateColourFills(BOOL Change);
00596 virtual void MutateTranspFills(BOOL Change);
00597
00598 virtual AttrFillGeometry* MutateFill(AttrFillGeometry* FillToMutate) { return NULL; }
00599
00600 virtual BOOL IsAValueChange() const { return TRUE; }
00601
00602 protected:
00603 BOOL Colour;
00604 BOOL Transp;
00605 };
00606
00607
00608
00609
00610
00611
00612
00613
00614
00615
00616
00617
00618 class AttrFlatFill : public AttrFillGeometry
00619 {
00620 CC_DECLARE_DYNCREATE(AttrFlatFill)
00621
00622 public:
00623 AttrFlatFill();
00624 AttrFlatFill(Node* ContextNode,
00625 AttachNodeDirection Direction,
00626 BOOL Locked=FALSE,
00627 BOOL Mangled=FALSE,
00628 BOOL Marked=FALSE,
00629 BOOL Selected=FALSE):
00630 AttrFillGeometry(ContextNode, Direction, Locked, Mangled, Marked, Selected) {}
00631
00632
00633 virtual BOOL OnClick( DocCoord, ClickType, ClickModifiers, Spread * ) { return FALSE; }
00634
00635 virtual DocRect GetBlobBoundingRect();
00636
00637 virtual BOOL ChangeControlColour(AttrColourChange *) { return FALSE; }
00638 virtual BOOL ChangeControlTransp(AttrTranspChange *) { return FALSE; }
00639
00640 virtual void ToggleSelection(FillControl Blob) { DeselectBlob(Blob); }
00641 virtual void SelectBlob(FillControl Blob) { DeselectBlob(Blob); }
00642
00643 virtual FillControl TestColourDrop(AttrColourDrop*);
00644
00645 virtual BOOL IsAFlatFill() const { return TRUE; }
00646
00647 protected:
00648 virtual void ValidateAttributeValue();
00649 };
00650
00651
00652
00653
00654
00655
00656
00657
00658
00659
00660
00661
00662
00663
00664
00665 class AttrChangedMsg: public Msg
00666 {
00667 CC_DECLARE_DYNAMIC(AttrChangedMsg);
00668 public:
00669
00670 AttrFillGeometry* pChangedFill;
00671 AttrChangedMsg(AttrFillGeometry* pFill): pChangedFill(pFill) { }
00672 };
00673
00674
00675
00676
00677
00678
00679
00680
00681
00682
00683
00684
00685
00686 class FillAttrBlobState : public ListItem
00687 {
00688 public:
00689 FillAttrBlobState();
00690 ~FillAttrBlobState();
00691
00692 BOOL operator==(FillAttrBlobState& BlobState);
00693
00694 public:
00695 AttrFillGeometry* pFillAttr;
00696 UINT32 count;
00697 BOOL* SelectionState;
00698 };
00699
00700
00701
00702
00703
00704
00705
00706
00707
00708
00709
00710
00711
00712 class FillBlobSelectionState : public CC_CLASS_MEMDUMP
00713 {
00714 CC_DECLARE_MEMDUMP(FillBlobSelectionState);
00715
00716 public:
00717 FillBlobSelectionState();
00718 ~FillBlobSelectionState();
00719 BOOL Record();
00720 BOOL operator==(FillBlobSelectionState& SelState);
00721
00722 void DeleteAll() { BlobStateList.DeleteAll(); }
00723
00724 private:
00725
00726 CCRuntimeClass* FillType;
00727 UINT32 BlobCount;
00728 List BlobStateList;
00729 };
00730
00731
00732 #endif // INC_FILLATTR