AttrFourColFill Class Reference

FourCol Graduated Fill Attribute class. More...

#include <fillattr2.h>

Inheritance diagram for AttrFourColFill:

AttrFillGeometry NodeAttribute NodeRenderable Node CCObject SimpleCCObject AttrFourColColourFill AttrFourColTranspFill List of all members.

Public Member Functions

 AttrFourColFill ()
 AttrFourColFill (Node *ContextNode, AttachNodeDirection Direction, BOOL Locked=FALSE, BOOL Mangled=FALSE, BOOL Marked=FALSE, BOOL Selected=FALSE)
virtual void Transform (TransformBase &)
 Transform a grad fill attribute by moving the start and end points.
virtual BOOL CanTransform ()
 Indicate that this attribute can be transformed.
virtual void RenderFillBlobs (RenderRegion *pRender)
virtual void RenderFillMesh (RenderRegion *, DocCoord *, BOOL *, INT32 NumControlPoints=0)
virtual void OnControlDrag (DocCoord, FillControl &, ClickModifiers)
virtual void RenderControl (FillControl Control, BOOL RenderOn)
 Renders a specified control.
virtual void CycleSelection (BOOL Reverse)
 Cycles the selection state of the controls.
virtual FillControl CheckForControlHit (DocCoord &ClickPos)
 Check to see if a click was on a Fill Control Point.
virtual AttributeValueGetAttributeValue ()=0
virtual FillControl TestColourDrop (AttrColourDrop *ColDrop)
 Check to see which colour will be changed if dropped at this point.
virtual void TransformSelectedControlPoints (TransformBase &, BOOL *isARampBlob=NULL)
 Transform a grad fill attribute by moving the selected control points.
virtual BOOL IsAGradFill () const
 Virtual function for determining if the node is an attribute.
virtual DocRect GetBlobBoundingRect ()
 Calculates the bounding rectangle of the attrs blobs.This should always be calculated on the fly as the view scale can change without the attr knowing, giving an incorrect result.
virtual BOOL NeedsForceToSimpleMapping ()
virtual INT32 GetNumberOfControlPoints ()

Protected Member Functions

virtual void ValidateAttributeValue ()
 Makes sure the Coords of the Fill are sensible.

Detailed Description

FourCol Graduated Fill Attribute class.

Author:
Tim_Browse (Xara Group Ltd) <camelotdev@xara.com>
Date:
18/07/94
See also:
FourColFillAttribute

Definition at line 1621 of file fillattr2.h.


Constructor & Destructor Documentation

AttrFourColFill::AttrFourColFill  )  [inline]
 

Definition at line 1626 of file fillattr2.h.

01626 : AttrFillGeometry() {}

AttrFourColFill::AttrFourColFill Node ContextNode,
AttachNodeDirection  Direction,
BOOL  Locked = FALSE,
BOOL  Mangled = FALSE,
BOOL  Marked = FALSE,
BOOL  Selected = FALSE
[inline]
 

Definition at line 1627 of file fillattr2.h.

01632                                      : 
01633         AttrFillGeometry(ContextNode, Direction, Locked, Mangled, Marked, Selected) {}


Member Function Documentation

BOOL AttrFourColFill::CanTransform  )  [virtual]
 

Indicate that this attribute can be transformed.

Author:
Gerry_Iles (Xara Group Ltd) <camelotdev@xara.com>
Date:
9/8/96
Returns:
TRUE => transform this attribute.
See also:
Copied from AttrLinearFill

Reimplemented from NodeRenderable.

Definition at line 12531 of file fillattr.cpp.

12532 {
12533     return TRUE;
12534 }

FillControl AttrFourColFill::CheckForControlHit DocCoord ClickPos  )  [virtual]
 

Check to see if a click was on a Fill Control Point.

Author:
Gerry_Iles (Xara Group Ltd) <camelotdev@xara.com>
Date:
14/08/96
Parameters:
ClickPos,The DocCoord position to check. [INPUTS]
Returns:
A FillControl, indicating the Fill Control Point Hit, or FILLCONTROL_NULL, if no points hit.
See also:
FillControl

Reimplemented from AttrFillGeometry.

Definition at line 13044 of file fillattr.cpp.

13045 {
13046     // Set up a default, that indicates not control points hit
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     // Get the control points
13055     DocCoord StartPoint = *GetStartPoint();
13056     DocCoord EndPoint = *GetEndPoint();
13057     DocCoord EndPoint2 = *GetEndPoint2();
13058     DocCoord EndPoint3 = EndPoint2 + EndPoint - StartPoint;
13059 
13060     // Get the rectangle around the Start Control Point
13061     (Camelot.GetBlobManager())->GetBlobRect(StartPoint, &BlobRect);
13062     // See if the Click Position is within the rectangle
13063     if ( BlobRect.ContainsCoord(ClickPos) )
13064         HitControl = FILLCONTROL_STARTPOINT;
13065 
13066     // Get the rectangle around the End Control Point
13067     (Camelot.GetBlobManager())->GetBlobRect(EndPoint, &BlobRect);
13068     // See if the Click Position is within the rectangle
13069     if ( BlobRect.ContainsCoord(ClickPos) )
13070         HitControl = FILLCONTROL_ENDPOINT;
13071 
13072     // Get the rectangle around the Secondary Control Point
13073     (Camelot.GetBlobManager())->GetBlobRect(EndPoint2, &BlobRect);
13074     // See if the Click Position is within the rectangle
13075     if ( BlobRect.ContainsCoord(ClickPos) )
13076         HitControl = FILLCONTROL_ENDPOINT2;
13077 
13078     // Get the rectangle around the Secondary Control Point
13079     (Camelot.GetBlobManager())->GetBlobRect(EndPoint3, &BlobRect);
13080     // See if the Click Position is within the rectangle
13081     if ( BlobRect.ContainsCoord(ClickPos) )
13082         HitControl = FILLCONTROL_ENDPOINT3;
13083 #endif
13084     return HitControl;
13085 }

void AttrFourColFill::CycleSelection BOOL  Reverse  )  [virtual]
 

Cycles the selection state of the controls.

Author:
Gerry_Iles (Xara Group Ltd) <camelotdev@xara.com>
Date:
14/08/96
See also:
FillControl

Reimplemented from AttrFillGeometry.

Definition at line 12990 of file fillattr.cpp.

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 }

virtual AttributeValue* AttrFourColFill::GetAttributeValue  )  [pure virtual]
 

Implements AttrFillGeometry.

Implemented in AttrFourColColourFill, and AttrFourColTranspFill.

DocRect AttrFourColFill::GetBlobBoundingRect  )  [virtual]
 

Calculates the bounding rectangle of the attrs blobs.This should always be calculated on the fly as the view scale can change without the attr knowing, giving an incorrect result.

Author:
Gerry_Iles (Xara Group Ltd) <camelotdev@xara.com>
Date:
9/8/96
Returns:
DocRect - The rectangle that contains all the nodes selection blobs.

Reimplemented from AttrFillGeometry.

Definition at line 12869 of file fillattr.cpp.

12870 {
12871 #if !defined(EXCLUDE_FROM_RALPH)
12872     // Optimisation.  If there is currently no interest in Fill Blobs
12873     // and this fill is not being Dragged (Fill blobs are turned off during
12874     // a fill drag), then we needn't bother doing anything. 
12875     if ( (!GetApplication()->GetBlobManager()->GetCurrentInterest(TRUE).Fill || !IsVisible()) && DraggedFill != this )
12876         return DocRect(0,0, 0,0);
12877 
12878     // Get the control points
12879     DocCoord StartPoint = *GetStartPoint();
12880     DocCoord EndPoint = *GetEndPoint();
12881     DocCoord EndPoint2 = *GetEndPoint2();
12882     DocCoord EndPoint3 = EndPoint2 + EndPoint - StartPoint;
12883 
12884     // Make a dummy bounds from just the Start Point
12885     DocRect BoundingRect(StartPoint, StartPoint);
12886 
12887     // We're not being dragged, so just calc the bounds of the Start and End Blobs
12888     DocRect BlobRect;
12889 
12890     // Get the Bounding rect of the Blob and include the Bottom Left and
12891     // Top Right of each blob in the Bounds.
12892     // We have to do it like this to make sure that the DocRect's coords
12893     // are valid.  ie. The Hi's are Higher than the Lo's.
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     // and return it
12914     return BoundingRect;
12915 #else
12916     return DocRect(0,0,0,0);
12917 #endif
12918 }

virtual INT32 AttrFourColFill::GetNumberOfControlPoints  )  [inline, virtual]
 

Reimplemented from AttrFillGeometry.

Definition at line 1663 of file fillattr2.h.

01663 { return 3; }

virtual BOOL AttrFourColFill::IsAGradFill  )  const [inline, virtual]
 

Virtual function for determining if the node is an attribute.

Author:
Will_Cowling (Xara Group Ltd) <camelotdev@xara.com>
Date:
13/2/95
Parameters:
- [INPUTS]
- [OUTPUTS]
Returns:
TRUE if the node is a NodeAttribute, will return TRUE

Errors:

Reimplemented from NodeAttribute.

Definition at line 1655 of file fillattr2.h.

01655 { return TRUE; } 

virtual BOOL AttrFourColFill::NeedsForceToSimpleMapping  )  [inline, virtual]
 

Reimplemented from AttrFillGeometry.

Definition at line 1659 of file fillattr2.h.

01659 { return (FALSE); }

void AttrFourColFill::OnControlDrag DocCoord  ,
FillControl ,
ClickModifiers 
[virtual]
 

Reimplemented from AttrFillGeometry.

Definition at line 12705 of file fillattr.cpp.

12706 {
12707 #if !defined(EXCLUDE_FROM_RALPH)
12708     // Get the current Control Positions
12709     DocCoord StartPoint = *GetStartPoint();
12710     DocCoord EndPoint = *GetEndPoint();
12711     DocCoord EndPoint2 = *GetEndPoint2();
12712 
12713     INT32 dx, dy;
12714 
12715     // Which control point is being dragged ?
12716     switch (DragControl)
12717     {
12718         case FILLCONTROL_STARTPOINT:
12719         
12720             // Someone is dragging the Centre of the Fill
12721             dx = StartPoint.x - Pos.x;
12722             dy = StartPoint.y - Pos.y;
12723             // Move the other points relative
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             // Someone is dragging the first End Point
12735             
12736             // Constrain the angle if necessary
12737             if (ClickMods.Constrain)
12738                 DocView::ConstrainToAngle(StartPoint, &Pos);
12739 
12740             // The Aspect ratio can be locked either by it being circular
12741             // or by the Shift key      
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                 // Calculate the new end point based on the aspect ratio
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             // Someone is dragging the second End Point
12764             
12765             // Constrain the angle if necessary
12766             if (ClickMods.Constrain)
12767                 DocView::ConstrainToAngle(StartPoint, &Pos);
12768 
12769             // The Aspect ratio can be locked either by it being circular
12770             // or by the Shift key      
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                 // Calculate the new end point based on the aspect ratio
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             // If shift is down or both endpoints are the same
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                     // We are now going to move the two endpoints such that the gradient
12811                     // of all the edges remains constant
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                 // Don't let the points get too close
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 }

void AttrFourColFill::RenderControl FillControl  Control,
BOOL  RenderOn
[virtual]
 

Renders a specified control.

Author:
Gerry_Iles (Xara Group Ltd) <camelotdev@xara.com>
Date:
14/08/96
Parameters:
Control,the control to render [INPUTS] RenderOn, TRUE if rendering blob on FALSE if off
See also:
FillControl

Reimplemented from AttrFillGeometry.

Definition at line 12934 of file fillattr.cpp.

12935 {
12936 #if !defined(EXCLUDE_FROM_RALPH)
12937     DocRect ControlRect;
12938 
12939     // Ignore if we're not in the tree yet
12940     // We may be a tempory clone, or something
12941     NodeRenderable* pParent = (NodeRenderable*)FindParent();
12942 
12943     if (pParent == NULL)
12944         return;
12945 
12946     if (IsBlobSame(Control))
12947         return;         // Ignore if same as the last blob rendered
12948 
12949     Spread* pSpread = this->FindParentSpread();
12950 
12951     switch (Control)
12952     {
12953         case FILLCONTROL_STARTPOINT:
12954             // Redraw the Start Point Blob
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 }

virtual void AttrFourColFill::RenderFillBlobs RenderRegion pRender  )  [inline, virtual]
 

Reimplemented from AttrFillGeometry.

Reimplemented in AttrFourColColourFill, and AttrFourColTranspFill.

Definition at line 1639 of file fillattr2.h.

01639 {};

void AttrFourColFill::RenderFillMesh RenderRegion ,
DocCoord ,
BOOL *  ,
INT32  NumControlPoints = 0
[virtual]
 

Reimplemented from AttrFillGeometry.

Definition at line 12555 of file fillattr.cpp.

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         // If no selection state passed in, then assume
12570         // all the points are deselected
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     // Remember what attributes were here before
12582     pRender->SaveContext();
12583 
12584     // Get the current blob size in Doc Units
12585     INT32 BlobSize = (Camelot.GetBlobManager())->GetBlobSize();
12586 
12587     // Calculate the Arrow on the End of the Line
12588     Path ArrowPath;
12589     ArrowPath.Initialise();
12590     DocCoord LineEnd;
12591     MakeMeshArrow(&ArrowPath, StartPoint, EndPoint, &LineEnd);
12592 
12593     // Calculate the Arrow on the End of the Line2
12594     Path ArrowPath2;
12595     ArrowPath2.Initialise();
12596     DocCoord LineEnd2;
12597     MakeMeshArrow(&ArrowPath2, StartPoint, EndPoint2, &LineEnd2);
12598 
12599     // Set the line colours etc as we need them
12600     pRender->SetLineWidth(0);
12601     pRender->SetLineColour(COLOUR_UNSELECTEDBLOB);
12602     pRender->SetFillColour(COLOUR_UNSELECTEDBLOB);
12603 
12604     // First Draw the Line
12605     pRender->SetLineWidth(BlobSize/4);
12606     pRender->DrawLine(StartPoint, LineEnd);
12607 
12608     // Draw the secondary line
12609     pRender->DrawLine(StartPoint, LineEnd2);
12610 
12611         // Draw a line from EndPoint to EndPoint3
12612     pRender->DrawLine(EndPoint, EndPoint3);
12613 
12614     // Draw a line from EndPoint2 to EndPoint3
12615     pRender->DrawLine(EndPoint2, EndPoint3);
12616 
12617     // Render an Arrow at the end of the line
12618     pRender->SetLineWidth(0);
12619     pRender->SetLineColour(COLOUR_NONE);
12620     pRender->DrawPath(&ArrowPath);
12621 
12622     // and on the end of the secondary line
12623     pRender->DrawPath(&ArrowPath2);
12624     
12625     // Now Render the blobs on the path
12626     // Set the line colour to none
12627     pRender->SetLineColour(COLOUR_NONE);
12628 
12629     // Draw a blob at the start point
12630     if (SelState[FILLCONTROL_STARTPOINT])
12631     {
12632         // Draw Selected Blob
12633         pRender->SetFillColour(COLOUR_SELECTEDBLOB);
12634         pRender->DrawBlob(StartPoint, BT_SELECTED);
12635     }
12636     else
12637     {
12638         // Draw Unselected Blob
12639         pRender->SetFillColour(COLOUR_UNSELECTEDBLOB);
12640         pRender->DrawBlob(StartPoint, BT_UNSELECTED);
12641     }
12642 
12643     // Draw the blobs at the end points
12644     if (SelState[FILLCONTROL_ENDPOINT])
12645     {
12646         // Draw Selected Blobs
12647         pRender->SetFillColour(COLOUR_SELECTEDBLOB);
12648         pRender->DrawBlob(EndPoint, BT_SELECTED);
12649     }
12650     else
12651     {
12652         // Draw Unselected Blobs
12653         pRender->SetFillColour(COLOUR_UNSELECTEDBLOB);
12654         pRender->DrawBlob(EndPoint, BT_UNSELECTED);
12655     }
12656 
12657     // Draw the blobs at the end points
12658     if (SelState[FILLCONTROL_ENDPOINT2])
12659     {
12660         // Draw Selected Blobs
12661         pRender->SetFillColour(COLOUR_SELECTEDBLOB);
12662         pRender->DrawBlob(EndPoint2,BT_SELECTED);
12663     }
12664     else
12665     {
12666         // Draw Unselected Blobs
12667         pRender->SetFillColour(COLOUR_UNSELECTEDBLOB);
12668         pRender->DrawBlob(EndPoint2,BT_UNSELECTED);
12669     }
12670 
12671     // Draw the blobs at the end points
12672     if (SelState[FILLCONTROL_ENDPOINT3])
12673     {
12674         // Draw Selected Blobs
12675         pRender->SetFillColour(COLOUR_SELECTEDBLOB);
12676         pRender->DrawBlob(EndPoint3,BT_SELECTED);
12677     }
12678     else
12679     {
12680         // Draw Unselected Blobs
12681         pRender->SetFillColour(COLOUR_UNSELECTEDBLOB);
12682         pRender->DrawBlob(EndPoint3,BT_UNSELECTED);
12683     }
12684 
12685     // Put all the old attributes back
12686     pRender->RestoreContext();
12687 #endif
12688 }

FillControl AttrFourColFill::TestColourDrop AttrColourDrop ColDrop  )  [virtual]
 

Check to see which colour will be changed if dropped at this point.

Author:
Gerry_Iles (Xara Group Ltd) <camelotdev@xara.com>
Date:
9/8/96
Parameters:
ColDrop - pointer to the [INPUTS]

Reimplemented from AttrFillGeometry.

Definition at line 12404 of file fillattr.cpp.

12405 { 
12406 #if !defined(EXCLUDE_FROM_RALPH)
12407     // So, where was it dropped (or where will it be dropped)
12408     DocCoord DropPoint = ColDrop->GetDropPoint();
12409 
12410     // Look to see if the DropPoint is over any of the Fill Control Points
12411     FillControl ControlHit = CheckForControlHit(DropPoint);
12412     
12413     // If it hit one of our control points, then use that
12414     if (ControlHit != FILLCONTROL_NULL)
12415         return ControlHit;
12416 
12417     // It didn't hit any of our control points, so if the drop is over
12418     // the object then we'll make a guess as to which control point
12419     // the user would like to change, depending on which area of the
12420     // object the pointer is over.
12421 
12422     // First make sure we're actually over an object
12423     NodeRenderableInk* pParentObject = ColDrop->GetObjectDroppedOn();
12424     if (pParentObject == NULL)
12425         return FILLCONTROL_NULL;    // We're not over any object 
12426 
12427     // Make sure this fill type has some Control Points
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     // FInd which point is closest
12442     
12443     if (StartDist < End3Dist)
12444     {
12445         // Start is smallest so far
12446         if (StartDist < End2Dist)
12447         {
12448             // Start is still smallest
12449             if (StartDist < EndDist)
12450                 ControlHit = FILLCONTROL_STARTPOINT;
12451             else
12452                 ControlHit = FILLCONTROL_ENDPOINT;
12453         }
12454         else
12455         {
12456             // End2 is smallest so far
12457             if (EndDist < End2Dist)
12458                 ControlHit = FILLCONTROL_ENDPOINT;
12459             else
12460                 ControlHit = FILLCONTROL_ENDPOINT2;
12461         }
12462     }
12463     else
12464     {
12465         // End3 is smallest so far
12466         if (End3Dist < End2Dist)
12467         {
12468             // End3 is still smallest
12469             if (End3Dist < EndDist)
12470                 ControlHit = FILLCONTROL_ENDPOINT3;
12471             else
12472                 ControlHit = FILLCONTROL_ENDPOINT;
12473         }
12474         else
12475         {
12476             // End2 is smallest so far
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 }

void AttrFourColFill::Transform TransformBase Trans  )  [virtual]
 

Transform a grad fill attribute by moving the start and end points.

Author:
Gerry_Iles (Xara Group Ltd) <camelotdev@xara.com>
Date:
9/8/96
Parameters:
Trans - the transform object to apply to this attribute. [INPUTS]
See also:
Copied from AttrLinearFill

Reimplemented from NodeRenderable.

Definition at line 12504 of file fillattr.cpp.

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 }

void AttrFourColFill::TransformSelectedControlPoints TransformBase Trans,
BOOL *  isARampBlob = NULL
[virtual]
 

Transform a grad fill attribute by moving the selected control points.

Author:
Gerry_Iles (Xara Group Ltd) <camelotdev@xara.com>
Date:
28/8/96
Parameters:
Trans - the transform object to apply to this attribute. [INPUTS]
See also:
NodeRenderable::Transform

Reimplemented from AttrFillGeometry.

Definition at line 12334 of file fillattr.cpp.

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;       // Force adjust off
12343 
12344         // If the start point is selected then just move the fill
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 }

void AttrFourColFill::ValidateAttributeValue  )  [protected, virtual]
 

Makes sure the Coords of the Fill are sensible.

Author:
Gerry_Iles (Xara Group Ltd) <camelotdev@xara.com>
Date:
9/8/96

Reimplemented from AttrFillGeometry.

Definition at line 13098 of file fillattr.cpp.

13099 {
13100 #if !defined(EXCLUDE_FROM_RALPH)
13101     if ((*GetStartPoint()) != DocCoord(0,0) && (*GetEndPoint()) != DocCoord(0,0))
13102     {
13103         // If the EndPoint2 is 'NULL' then make it sensible
13104         if (*GetEndPoint2() == DocCoord(0,0))
13105         {
13106             DocCoord temp = MakeLineAtAngle((*GetStartPoint()), (*GetEndPoint()), 90);
13107             SetEndPoint2(&temp);
13108         }
13109         
13110         return;
13111     }
13112 
13113     // Make up some sensible defaults
13114     DocRect AttrBounds = DocRect(0,0,0,0);
13115 
13116     INT32 Width  = DEFAULT_FILLWIDTH;
13117     INT32 Height = DEFAULT_FILLHEIGHT;
13118 
13119     // Are we an Orphan ?
13120     if (FindParent() != NULL)
13121     {
13122         // Nope, so we can use Daddies Bounding Box
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     // If the StartPoint is 'NULL' then make all points sensible
13135     if ((*GetStartPoint()) == DocCoord(0,0))
13136     {
13137         // Start in the centre of the bounds
13138         SetStartPoint(&AttrBounds.lo);
13139 
13140         // and set End Points to Middle Right, and Middle Top
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     // If EndPoint is 'NULL' then make it sensible
13148     if ((*GetEndPoint()) == DocCoord(0,0))
13149     {
13150         DocCoord temp = DocCoord(AttrBounds.hi.x, AttrBounds.lo.y);
13151         SetEndPoint(&temp);
13152     }
13153 
13154     // If EndPoint2 is 'NULL' then make it sensible
13155     if ((*GetEndPoint2()) == DocCoord(0,0))
13156     {
13157         DocCoord temp = DocCoord(AttrBounds.lo.x, AttrBounds.hi.y);
13158         SetEndPoint2(&temp);
13159     }
13160 #endif
13161 }


The documentation for this class was generated from the following files:
Generated on Sat Nov 10 03:50:20 2007 for Camelot by  doxygen 1.4.4