#include <fillattr2.h>
Inheritance diagram for AttrConicalFill:
Public Member Functions | |
AttrConicalFill () | |
AttrConicalFill (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 | TransformSelectedControlPoints (TransformBase &, BOOL *isARampBlob=NULL) |
Transform a grad fill attribute by moving the selected control points. | |
virtual void | RenderFillBlobs (RenderRegion *pRender) |
virtual void | RenderFillMesh (RenderRegion *, DocCoord *, BOOL *, INT32 NumControlPoints=0) |
virtual void | OnControlDrag (DocCoord, FillControl &, ClickModifiers) |
virtual AttributeValue * | GetAttributeValue ()=0 |
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 FillControl | CheckForControlHit (DocCoord &) |
Check to see if a click was on a Fill Control Point. | |
virtual FillControl | TestColourDrop (AttrColourDrop *) |
Check to see which colour will be changed if dropped at this point. | |
virtual BOOL | IsAGradFill () const |
Virtual function for determining if the node is an attribute. | |
virtual AttrFillGeometry * | DoColourDrop (AttrColourDrop *) |
Does colour drop onto conical fills. | |
virtual BOOL | NeedsToRenderAtEachBrushStroke () const |
So that don't have to keep re-rendering attributes whilst drawing a brush, this identifies whether or not the attribute need to be rendered at each step, e.g. radial fills. | |
virtual INT32 | GetNumberOfControlPoints () |
Protected Member Functions | |
virtual void | ValidateAttributeValue () |
Makes sure the Coords of the Fill are sensible. | |
virtual void | RenderControl (FillControl, BOOL) |
Redraws the Fill Control blobs when the selection changes. | |
virtual double | FindRampPoint (DocCoord &dc, DocCoord &StartPoint, DocCoord &EndPoint) |
Gives the value (0 - 1) of the given dc - bearing in mind the start point is the centre of the conical fill and end point is the start point on the conical curve. |
Definition at line 1087 of file fillattr2.h.
|
Definition at line 1092 of file fillattr2.h. 01092 : AttrFillGeometry() {}
|
|
Definition at line 1093 of file fillattr2.h. 01098 : 01099 AttrFillGeometry(ContextNode, Direction, Locked, Mangled, Marked, Selected) {}
|
|
Indicate that this attribute can be transformed.
Reimplemented from NodeRenderable. Definition at line 8536 of file fillattr.cpp. 08537 { 08538 return TRUE; 08539 }
|
|
Check to see if a click was on a Fill Control Point.
Reimplemented from AttrFillGeometry. Definition at line 8556 of file fillattr.cpp. 08557 { 08558 #if !defined(EXCLUDE_FROM_RALPH) 08559 if (!GetApplication()->GetBlobManager()->GetCurrentInterest().Fill || !IsVisible()) 08560 return FILLCONTROL_NULL; 08561 08562 // Set up a default, that indicates not control points hit 08563 FillControl HitControl = FILLCONTROL_NULL; 08564 DocRect BlobRect; 08565 08566 // Get the current control positions 08567 DocCoord CentrePoint = *GetStartPoint(); 08568 DocCoord EndColBlob = *GetEndPoint(); 08569 DocCoord StartColBlob = MakeLineAtAngle(CentrePoint, EndColBlob, 180); 08570 08571 // Get the rectangle around the Centre Control Point 08572 (Camelot.GetBlobManager())->GetBlobRect(CentrePoint, &BlobRect); 08573 // See if the Click Position is within the rectangle 08574 if ( BlobRect.ContainsCoord(ClickPos) ) 08575 HitControl = FILLCONTROL_DRAGPOINT; 08576 08577 // Get the rectangle around the Start Colour Control Point 08578 (Camelot.GetBlobManager())->GetBlobRect(StartColBlob, &BlobRect); 08579 // See if the Click Position is within the rectangle 08580 if ( BlobRect.ContainsCoord(ClickPos) ) 08581 HitControl = FILLCONTROL_STARTPOINT; 08582 08583 // Get the rectangle around the End Colour Control Point 08584 (Camelot.GetBlobManager())->GetBlobRect(EndColBlob, &BlobRect); 08585 // See if the Click Position is within the rectangle 08586 if ( BlobRect.ContainsCoord(ClickPos) ) 08587 HitControl = FILLCONTROL_ENDPOINT; 08588 08589 // check the fill ramp blobs 08590 if (HitControl == FILLCONTROL_NULL) 08591 { 08592 // do we have a fill ramp ? 08593 if (GetColourRamp()) 08594 { 08595 // ColourRamp * pRamp = GetColourRamp(); 08596 08597 // check for a hit 08598 return AttrFillGeometry::CheckForControlHit(ClickPos); 08599 } 08600 else 08601 { 08602 // check the position on the fill ramp 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 }
|
|
Does colour drop onto conical fills.
Reimplemented from AttrFillGeometry. Definition at line 8627 of file fillattr.cpp. 08628 { 08629 AttrFillGeometry* NewFill; 08630 DocColour DroppedColour = *ColDrop->GetStartColour(); 08631 08632 // First test to see which colour we should change 08633 FillControl ControlHit = TestColourDrop(ColDrop); 08634 08635 if (ControlHit == FILLCONTROL_NULL) 08636 { 08637 // No Control points hit, so make a flat fill instead 08638 NewFill = new AttrFlatColourFill; 08639 if (NewFill == NULL) 08640 return NULL; 08641 08642 // and use the mutants colour 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 // Move onto the next attr 08668 pAttr = FindNextSelectedAttr(); 08669 } 08670 08671 /* 08672 if (UniqueFill) 08673 RenderFillBlobs(); 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 // If we are dropping inside a group, then we'll need to remove 08687 // the blobs if this fill is applied to the whole group 08688 // RenderFillBlobs(); 08689 } 08690 } 08691 08692 // Make a copy of this Fill to change 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 // invalidate the region in the document & render the fill blobs 08704 Document * pDoc = Document::GetCurrent(); 08705 08706 if (pDoc) 08707 pDoc->ForceRedraw(FindParentSpread(), GetBlobBoundingRect(), FALSE, this->FindParent()); 08708 08709 // Return the Mutated Fill 08710 return NewFill; 08711 }
|
|
Gives the value (0 - 1) of the given dc - bearing in mind the start point is the centre of the conical fill and end point is the start point on the conical curve.
Reimplemented from AttrFillGeometry. Definition at line 8906 of file fillattr.cpp. 08907 { 08908 //get the dot product 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 // calculate the distance between the point and the centre point 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 // normalise the vector 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 // do the 90 degree dot product as well since we need to know 08945 // whether the point is over the blob itself, or over its mirror 08946 // image 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 // get the angle 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 // is the point in range ? 08963 if (fabs(DistToPoint - DistToEndPoint) < dBlobSize && dot90 < 0) 08964 { 08965 return Retn; 08966 } 08967 08968 return -1; 08969 }
|
|
Implements AttrFillGeometry. Implemented in AttrConicalColourFill, and AttrConicalTranspFill. |
|
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.
Reimplemented from AttrFillGeometry. Definition at line 9043 of file fillattr.cpp. 09044 { 09045 #if !defined(EXCLUDE_FROM_RALPH) 09046 // Optimisation. If there is currently no interest in Fill Blobs 09047 // and this fill is not being Dragged (Fill blobs are turned off during 09048 // a fill drag), then we needn't bother doing anything. 09049 if ( (!GetApplication()->GetBlobManager()->GetCurrentInterest(TRUE).Fill || !IsVisible()) && DraggedFill != this ) 09050 return DocRect(0,0, 0,0); 09051 09052 // Get the Start and End Points 09053 DocCoord StartPoint = *GetStartPoint(); 09054 DocCoord EndPoint = *GetEndPoint(); 09055 DocCoord EndPoint2 = MakeLineAtAngle(StartPoint, EndPoint, 180); 09056 09057 DocRect StartBlobRect; 09058 DocRect EndBlobRect; 09059 // Get the bounds of the funny semi-circle mesh thingy 09060 DocRect BoundingRect = GetMeshEllipseBounds(StartPoint, EndPoint); 09061 09062 // Get the Bounding rect of the Fill Line, including the Blobs on the ends 09063 (Camelot.GetBlobManager())->GetBlobRect(BoundingRect.lo, &StartBlobRect); 09064 (Camelot.GetBlobManager())->GetBlobRect(BoundingRect.hi, &EndBlobRect); 09065 09066 // Now include the Bottom Left and Top Right of each blob in the Bounds. 09067 // We have to do it like this to make sure that the DocRect's coords 09068 // are valid. ie. The Hi's are Higher than the Lo's. 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 // and return it 09078 return BoundingRect; 09079 #else 09080 return DocRect(0,0, 0,0); 09081 #endif 09082 }
|
|
Reimplemented from AttrFillGeometry. Definition at line 1126 of file fillattr2.h.
|
|
Virtual function for determining if the node is an attribute.
Reimplemented from NodeAttribute. Definition at line 1118 of file fillattr2.h. 01118 { return TRUE; }
|
|
So that don't have to keep re-rendering attributes whilst drawing a brush, this identifies whether or not the attribute need to be rendered at each step, e.g. radial fills.
Reimplemented from NodeAttribute. Definition at line 1122 of file fillattr2.h. 01122 { return TRUE;}
|
|
Reimplemented from AttrFillGeometry. Definition at line 8796 of file fillattr.cpp. 08797 { 08798 // Get the current Control Point Positions 08799 DocCoord StartPoint = *GetStartPoint(); 08800 DocCoord EndPoint = *GetEndPoint(); 08801 08802 INT32 dx, dy; 08803 08804 switch (DragControl) 08805 { 08806 case FILLCONTROL_DRAGPOINT: 08807 // They're dragging the Centre Point 08808 dx = StartPoint.x - Pos.x; 08809 dy = StartPoint.y - Pos.y; 08810 // Move the other points relative 08811 EndPoint.translate(-dx, -dy); 08812 SetEndPoint(&EndPoint); 08813 SetStartPoint(&Pos); 08814 break; 08815 08816 case FILLCONTROL_STARTPOINT: 08817 08818 // If the Constrain key is down then constrain the Angle of the 08819 // point, relative to the centre. 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 // If the Constrain key is down then constrain the Angle of the 08832 // point, relative to the centre. 08833 if (ClickMods.Constrain) 08834 DocView::ConstrainToAngle(StartPoint, &Pos); 08835 08836 SetEndPoint(&Pos); 08837 break; 08838 default: 08839 // is the hit point a ramp point ? 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 }
|
|
Redraws the Fill Control blobs when the selection changes.
Reimplemented from AttrFillGeometry. Definition at line 8728 of file fillattr.cpp. 08729 { 08730 #if !defined(EXCLUDE_FROM_RALPH) 08731 DocRect ControlRect; 08732 08733 // Ignore if we're not in the tree yet 08734 // We may be a tempory clone, or something 08735 NodeRenderable* pParent = (NodeRenderable*)FindParent(); 08736 08737 if (pParent == NULL) 08738 return; 08739 08740 if (IsBlobSame(Control)) 08741 return; // Ignore if same as the last blob rendered 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 // Redraw the Centre Point Blob 08754 (Camelot.GetBlobManager())->GetBlobRect(StartPoint, &ControlRect); 08755 break; 08756 08757 case FILLCONTROL_STARTPOINT: 08758 // Redraw the Start Colour Blob 08759 (Camelot.GetBlobManager())->GetBlobRect(EndPoint2, &ControlRect); 08760 break; 08761 08762 case FILLCONTROL_ENDPOINT: 08763 // Redraw the End Colour Blob 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 // Redraw the rectangle we calculated above 08779 RenderFillControl(RenderOn, &ControlRect, pSpread, pParent); 08780 #endif 08781 }
|
|
Reimplemented from AttrFillGeometry. Reimplemented in AttrConicalColourFill, and AttrConicalTranspFill. Definition at line 1107 of file fillattr2.h.
|
|
Reimplemented from AttrFillGeometry. Definition at line 9101 of file fillattr.cpp. 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 // If no selection state passed in, then assume 09126 // all the points are deselected 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 // Remember what attributes were here before 09138 pRender->SaveContext(); 09139 09140 // Get the current blob size in Doc Units 09141 INT32 BlobSize = (Camelot.GetBlobManager())->GetBlobSize(); 09142 09143 // Calculate the Arrow on the End of the Line 09144 Path ArrowPath; 09145 ArrowPath.Initialise(); 09146 DocCoord LineEnd; 09147 DocCoord Temp = MakeLineAtAngle(End, Start, -90); 09148 MakeMeshArrow(&ArrowPath, Temp, End, &LineEnd); 09149 // This will have also calculated a point for us to draw 09150 // the line to, so we don't try and draw though the arrow head. 09151 09152 Path EllipsePath; 09153 EllipsePath.Initialise(); 09154 MakeMeshSemiCircle(&EllipsePath, Start, End, LineEnd); 09155 09156 // Set the line colours etc as we need them 09157 pRender->SetLineColour(COLOUR_UNSELECTEDBLOB); 09158 pRender->SetFillColour(COLOUR_UNSELECTEDBLOB); 09159 09160 // First Draw the Line 09161 pRender->SetFillColour(COLOUR_NONE); 09162 09163 if (DraggedFill == this) 09164 { 09165 if (AllowBoundsRedraw) 09166 { 09167 // If we are being dragged, then draw some lines to show the 09168 // fill angle 09169 pRender->DrawLine(Start, End); 09170 pRender->DrawLine(Start, End2); 09171 } 09172 } 09173 09174 // Render a Circle 09175 pRender->SetLineWidth(BlobSize/4); 09176 pRender->DrawPath(&EllipsePath); 09177 09178 // Render an Arrow at the end of the line 09179 pRender->SetLineWidth(0); 09180 pRender->SetLineColour(COLOUR_NONE); 09181 pRender->SetFillColour(COLOUR_UNSELECTEDBLOB); 09182 pRender->DrawPath(&ArrowPath); 09183 09184 // Now Render the blobs on the path 09185 // pRender->SetLineColour(COLOUR_UNSELECTEDBLOB); 09186 pRender->SetLineColour(COLOUR_NONE); 09187 pRender->SetFillColour(COLOUR_UNSELECTEDBLOB); 09188 pRender->DrawBlob(Start, BT_UNSELECTED); 09189 09190 // Draw a blob at the start point 09191 if (SelState[FILLCONTROL_ENDPOINT]) 09192 { 09193 // Draw Selected Blob 09194 // pRender->SetLineColour(COLOUR_SELECTEDBLOB); 09195 pRender->SetLineColour(COLOUR_NONE); 09196 pRender->SetFillColour(COLOUR_SELECTEDBLOB); 09197 pRender->DrawBlob(End, BT_SELECTED); 09198 } 09199 else 09200 { 09201 // Draw Unselected Blob 09202 // pRender->SetLineColour(COLOUR_UNSELECTEDBLOB); 09203 pRender->SetLineColour(COLOUR_NONE); 09204 pRender->SetFillColour(COLOUR_UNSELECTEDBLOB); 09205 pRender->DrawBlob(End, BT_UNSELECTED); 09206 } 09207 09208 // Draw a blob at the end point 09209 if (SelState[FILLCONTROL_STARTPOINT]) 09210 { 09211 // Draw Selected Blob 09212 // pRender->SetLineColour(COLOUR_SELECTEDBLOB); 09213 pRender->SetLineColour(COLOUR_NONE); 09214 pRender->SetFillColour(COLOUR_SELECTEDBLOB); 09215 pRender->DrawBlob(End2, BT_SELECTED); 09216 } 09217 else 09218 { 09219 // Draw Unselected Blob 09220 // pRender->SetLineColour(COLOUR_UNSELECTEDBLOB); 09221 pRender->SetLineColour(COLOUR_NONE); 09222 pRender->SetFillColour(COLOUR_UNSELECTEDBLOB); 09223 pRender->DrawBlob(End2, BT_UNSELECTED); 09224 } 09225 09226 // now render any ramp blobs 09227 FillRamp *pRamp = GetFillRamp(); 09228 if (pRamp) 09229 pRamp->RenderRampBlobs(ATTRVALUE(), pRender, NULL); 09230 09231 // Put all the old attributes back 09232 pRender->RestoreContext(); 09233 #endif 09234 }
|
|
Check to see which colour will be changed if dropped at this point.
Reimplemented from AttrFillGeometry. Definition at line 5492 of file fillattr.cpp. 05493 { 05494 // So, where was it dropped (or where will it be dropped) 05495 DocCoord DropPoint = ColDrop->GetDropPoint(); 05496 05497 // Look to see if the DropPoint is over any of the Fill Control Points 05498 FillControl ControlHit = CheckForControlHit(DropPoint); 05499 05500 // If it hit one of our control points, then use that 05501 if (ControlHit != FILLCONTROL_NULL) 05502 return ControlHit; 05503 05504 // It didn't hit any of our control points, so if the drop is over 05505 // the object then we'll make a guess as to which control point 05506 // the user would like to change, depending on which area of the 05507 // object the pointer is over. 05508 05509 // First make sure we're actually over an object 05510 NodeRenderableInk* pParentObject = ColDrop->GetObjectDroppedOn(); 05511 if (pParentObject == NULL) 05512 return FILLCONTROL_NULL; // We're not over any object 05513 05514 // Make sure this fill type has some Control Points 05515 if (GetStartPoint() == NULL || GetEndPoint() == NULL) 05516 return FILLCONTROL_NULL; 05517 05518 DocCoord StartPoint = *GetStartPoint(); 05519 DocCoord EndPoint = *GetEndPoint(); 05520 05521 // Get the angle of lines joining the Start and End points, 05522 // and also the Start and Drop points. (And make them 0 to 360). 05523 ANGLE LineAngle = CalcLineAngle(StartPoint, EndPoint) + 180; 05524 ANGLE DropAngle = CalcLineAngle(StartPoint, DropPoint) + 180; 05525 05526 // Get the difference between the two angles 05527 ANGLE Diff = DropAngle - LineAngle; 05528 05529 // and ensure we always get use the shortest path 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 // check for a colour drop on the line 05541 double d = FindRampPoint(DropPoint, *GetStartPoint(), *GetEndPoint()); 05542 05543 if (d >= 0 && d <= 1.0) 05544 { 05545 return FILLCONTROL_RAMPPOINT; 05546 } 05547 05548 // If the difference is greater the +-90, then set the start colour 05549 if (Diff <= 90 && Diff > -90) 05550 ControlHit = FILLCONTROL_ENDPOINT; 05551 else 05552 ControlHit = FILLCONTROL_STARTPOINT; 05553 05554 return ControlHit; 05555 }
|
|
Transform a grad fill attribute by moving the start and end points.
Reimplemented from NodeRenderable. Definition at line 8466 of file fillattr.cpp. 08467 { 08468 if ( Trans.TransFills ) 08469 { 08470 Trans.Transform( GetStartPoint(), 1); 08471 Trans.Transform( GetEndPoint(), 1); 08472 08473 // ValidateAttributeValue(); 08474 } 08475 }
|
|
Transform a grad fill attribute by moving the selected control points.
Reimplemented from AttrFillGeometry. Definition at line 8489 of file fillattr.cpp. 08490 { 08491 #if !defined(EXCLUDE_FROM_RALPH) 08492 if ( Trans.TransFills ) 08493 { 08494 ClickModifiers ClickMods; /* = ClickModifiers::GetClickModifiers();*/ 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 // CGS - wo, lets check the fill ramp as well .... 08518 08519 TransformSelectedFillRampControlPoints (Trans, ClickMods, isARampBlob); 08520 } 08521 #endif 08522 }
|
|
Makes sure the Coords of the Fill are sensible.
Reimplemented from AttrFillGeometry. Definition at line 8982 of file fillattr.cpp. 08983 { 08984 #if !defined(EXCLUDE_FROM_RALPH) 08985 if ((*GetStartPoint()) != DocCoord(0,0) && (*GetEndPoint()) != DocCoord(0,0)) 08986 return; 08987 08988 // Make some defaults 08989 DocRect AttrBounds = DocRect(0,0,0,0); 08990 08991 INT32 Width = DEFAULT_FILLWIDTH; 08992 INT32 Height = DEFAULT_FILLHEIGHT; 08993 08994 // Are we an Orphan ? 08995 if (FindParent() != NULL) 08996 { 08997 // Nope, so we can use Daddies Bounding Box 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 // If the StartPoint is 'NULL' then make all points sensible 09010 if ((*GetStartPoint()) == DocCoord(0,0)) 09011 { 09012 // Start in the middle 09013 DocCoord temp = CentreOf(AttrBounds); 09014 SetStartPoint(&temp); 09015 09016 // End on the Middle Right 09017 temp = DocCoord((*GetStartPoint()).x + (Width/2), (*GetStartPoint()).y); 09018 SetEndPoint(&temp); 09019 } 09020 09021 // If the EndPoint is 'NULL' then make end points sensible 09022 if ((*GetEndPoint()) == DocCoord(0,0)) 09023 { 09024 DocCoord temp = DocCoord((*GetStartPoint()).x + (Width/2), (*GetStartPoint()).y); 09025 SetEndPoint(&temp); 09026 } 09027 #endif 09028 }
|