GradFillTool Class Reference

The fill tool. More...

#include <filltool.h>

Inheritance diagram for GradFillTool:

DragTool Tool_v1 List of all members.

Public Member Functions

 GradFillTool ()
 Constructs a Fill Tool.
 ~GradFillTool ()
 Destructor. Does nothing.
BOOL Init ()
 Used to check if the Tool was properly constructed.
void Describe (void *InfoPtr)
 Allows the tool manager to extract information about the tool.
UINT32 GetID ()
virtual void SelectChange (BOOL)
 Creates/destroys/pushes/pops the rectangle tool's cursor.
virtual void OnClick (DocCoord, ClickType, ClickModifiers, Spread *)
 To handle a Mouse Click event for the Selector Tool. It starts up a Selector Operation.
virtual void OnMouseMove (DocCoord Pos, Spread *pSpread, ClickModifiers ClickMods)
 Called whenever the mouse position changes. We use this to update the cursor and status messages.
virtual BOOL OnKeyPress (KeyPress *pKeyPress)
 Checks for fill tool keys.
virtual BOOL GetStatusLineText (String_256 *, Spread *, DocCoord, ClickModifiers)
 generate up-to-date text for the status line (called on idles)
void GetCursorAndStatus (DocCoord, Spread *, Cursor **, String_256 *)
void ToggleControlPoints (BOOL Reverse)
 Toggles the selection state of all visible fill control blobs.

Static Public Member Functions

static BOOL IsCurrentTool ()
static void EnableFillNudge ()
 Enables the fill control point nudging.
static void DisableFillNudge ()
 Disables the fill control point nudging.
static BOOL IsFillNudgeEnabled ()
 Checks for to see if the fill nudging is currently enabled or not.

Static Public Attributes

static BOOL AllowFillNudges = TRUE

Private Member Functions

 CC_DECLARE_MEMDUMP (GradFillTool)

Static Private Member Functions

static void DisplayStatusBarHelp (UINT32 StatusID)
 Displays the given status help string in the status bar.

Private Attributes

DocCoord ClickStart
DocCoord StartPos
SpreadStartSpread
DocRect SelectionBox
BOOL IsSelection
CursorpCurrentCursor
CursorpGradFillCursor
CursorpGradPointCursor
INT32 CurrentCursorID
AttrFillGeometryEditingFill
BOOL DoubleClicked
BOOL OpBusy

Static Private Attributes

static TCHARFamilyName = _T("Fill Tools")
static TCHARToolName = _T("Graduated Fill Tool")
static TCHARPurpose = _T("Graduated Filling of Objects")
static TCHARAuthor = _T("Will")
static UINT32 LastStatusID
static BOOL CurrentTool
static GradInfoBarOppGradInfoBarOp
static TranspInfoBarOppTranspInfoBarOp
static BOOL NudgeFills = FALSE

Detailed Description

The fill tool.

Author:
Will_Cowling (Xara Group Ltd) <camelotdev@xara.com>
Date:
3/10/94

Definition at line 277 of file filltool.h.


Constructor & Destructor Documentation

GradFillTool::GradFillTool  ) 
 

Constructs a Fill Tool.

Author:
Will_Cowling (Xara Group Ltd) <camelotdev@xara.com>
Date:
19/7/94

Definition at line 593 of file filltool.cpp.

00594 {
00595     ClickStart = DocCoord(0,0);
00596     IsSelection = FALSE;
00597     StartSpread = NULL;
00598     pGradFillCursor = NULL;
00599     CurrentCursorID = 0;
00600 
00601     NudgeFills = FALSE;
00602 }

GradFillTool::~GradFillTool  ) 
 

Destructor. Does nothing.

Author:
Will_Cowling (Xara Group Ltd) <camelotdev@xara.com>
Date:
19/7/94

Definition at line 614 of file filltool.cpp.

00615 {
00616     // Dummy destructor
00617 }


Member Function Documentation

GradFillTool::CC_DECLARE_MEMDUMP GradFillTool   )  [private]
 

void GradFillTool::Describe void *  InfoPtr  )  [virtual]
 

Allows the tool manager to extract information about the tool.

Author:
Will_Cowling (Xara Group Ltd) <camelotdev@xara.com>
Date:
19/7/94
Parameters:
InfoPtr - A pointer to a tool info block. It is passed cast to void* as [INPUTS] the version of the tool is unknown at this point. Later versions of the Tool class may have more items in this block, that this tool will not use
InfoPtr - The structure pointed to by InfoPtr will have had all the info [OUTPUTS] that this version of the Tool knows about

Reimplemented from Tool_v1.

Definition at line 689 of file filltool.cpp.

00690 {
00691     // Cast structure into the latest one we understand.
00692     ToolInfo_v1 *Info = (ToolInfo_v1 *) InfoPtr;
00693 
00694     Info -> InfoVersion = 1;
00695     
00696     Info -> InterfaceVersion = GetToolInterfaceVersion();  // You should always have this line.
00697         
00698     // These are all arbitrary at present.
00699     Info -> Version = 1;
00700     Info -> ID      = GetID();
00701     Info -> TextID   = _R(IDS_GRADFILL_TOOL);
00702     Info -> BubbleID = _R(IDBBL_FILL_TOOL);
00703 
00704     Info -> Family  = FamilyName;
00705     Info -> Name    = ToolName;
00706     Info -> Purpose = Purpose;
00707     Info -> Author  = Author;
00708 
00709     Info -> InfoBarDialog = 0;
00710 }

void GradFillTool::DisableFillNudge  )  [static]
 

Disables the fill control point nudging.

Author:
Will_Cowling (Xara Group Ltd) <camelotdev@xara.com>
Date:
29/3/94
Returns:
Errors: -

Definition at line 1265 of file filltool.cpp.

01266 {
01267     if (!GradFillTool::AllowFillNudges || !NudgeFills)
01268         return;
01269 
01270     NudgeFills = FALSE;
01271 
01272     //Un-alias all the nudge ops back like they were.
01273     
01274     OpDescriptor* pOpDesc = OpDescriptor::FindOpDescriptor(OPTOKEN_NUDGEUP1);  
01275     pOpDesc->RemoveAlias();  
01276     pOpDesc = OpDescriptor::FindOpDescriptor(OPTOKEN_NUDGEUP5);  
01277     pOpDesc->RemoveAlias();  
01278     pOpDesc = OpDescriptor::FindOpDescriptor(OPTOKEN_NUDGEUP10);  
01279     pOpDesc->RemoveAlias();  
01280     pOpDesc = OpDescriptor::FindOpDescriptor(OPTOKEN_NUDGEUPFIFTH);
01281     pOpDesc->RemoveAlias();
01282     pOpDesc = OpDescriptor::FindOpDescriptor(OPTOKEN_NUDGEUPPIXEL1);
01283     pOpDesc->RemoveAlias();
01284     pOpDesc = OpDescriptor::FindOpDescriptor(OPTOKEN_NUDGEUPPIXEL10);
01285     pOpDesc->RemoveAlias();
01286 
01287     pOpDesc = OpDescriptor::FindOpDescriptor(OPTOKEN_NUDGEDOWN1);  
01288     pOpDesc->RemoveAlias();  
01289     pOpDesc = OpDescriptor::FindOpDescriptor(OPTOKEN_NUDGEDOWN5);  
01290     pOpDesc->RemoveAlias();  
01291     pOpDesc = OpDescriptor::FindOpDescriptor(OPTOKEN_NUDGEDOWN10);  
01292     pOpDesc->RemoveAlias();  
01293     pOpDesc = OpDescriptor::FindOpDescriptor(OPTOKEN_NUDGEDOWNFIFTH);
01294     pOpDesc->RemoveAlias();
01295     pOpDesc = OpDescriptor::FindOpDescriptor(OPTOKEN_NUDGEDOWNPIXEL1);
01296     pOpDesc->RemoveAlias();
01297     pOpDesc = OpDescriptor::FindOpDescriptor(OPTOKEN_NUDGEDOWNPIXEL10);
01298     pOpDesc->RemoveAlias();
01299 
01300     pOpDesc = OpDescriptor::FindOpDescriptor(OPTOKEN_NUDGELEFT1);  
01301     pOpDesc->RemoveAlias();  
01302     pOpDesc = OpDescriptor::FindOpDescriptor(OPTOKEN_NUDGELEFT5);  
01303     pOpDesc->RemoveAlias();  
01304     pOpDesc = OpDescriptor::FindOpDescriptor(OPTOKEN_NUDGELEFT10);  
01305     pOpDesc->RemoveAlias();  
01306     pOpDesc = OpDescriptor::FindOpDescriptor(OPTOKEN_NUDGELEFTFIFTH);
01307     pOpDesc->RemoveAlias();
01308     pOpDesc = OpDescriptor::FindOpDescriptor(OPTOKEN_NUDGELEFTPIXEL1);
01309     pOpDesc->RemoveAlias();
01310     pOpDesc = OpDescriptor::FindOpDescriptor(OPTOKEN_NUDGELEFTPIXEL10);
01311     pOpDesc->RemoveAlias();
01312 
01313 
01314     pOpDesc = OpDescriptor::FindOpDescriptor(OPTOKEN_NUDGERIGHT1);  
01315     pOpDesc->RemoveAlias();  
01316     pOpDesc = OpDescriptor::FindOpDescriptor(OPTOKEN_NUDGERIGHT5);  
01317     pOpDesc->RemoveAlias();  
01318     pOpDesc = OpDescriptor::FindOpDescriptor(OPTOKEN_NUDGERIGHT10);  
01319     pOpDesc->RemoveAlias();  
01320     pOpDesc = OpDescriptor::FindOpDescriptor(OPTOKEN_NUDGERIGHTFIFTH);
01321     pOpDesc->RemoveAlias();
01322     pOpDesc = OpDescriptor::FindOpDescriptor(OPTOKEN_NUDGERIGHTPIXEL1);
01323     pOpDesc->RemoveAlias();
01324     pOpDesc = OpDescriptor::FindOpDescriptor(OPTOKEN_NUDGERIGHTPIXEL10);
01325     pOpDesc->RemoveAlias();
01326 }

void GradFillTool::DisplayStatusBarHelp UINT32  StatusID  )  [static, private]
 

Displays the given status help string in the status bar.

Author:
Will_Cowling (Xara Group Ltd) <camelotdev@xara.com>
Date:
9/8/94
Parameters:
StatusID = ID of status help string [INPUTS]
- [OUTPUTS]
Returns:
-
See also:
-

Definition at line 1530 of file filltool.cpp.

01531 {
01532     String_256 StatusMsg("");
01533     StatusMsg.Load(StatusID);
01534     GetApplication()->UpdateStatusBarText(&StatusMsg);
01535     LastStatusID = StatusID;
01536 }

void GradFillTool::EnableFillNudge  )  [static]
 

Enables the fill control point nudging.

Author:
Will_Cowling (Xara Group Ltd) <camelotdev@xara.com>
Date:
29/3/94
Returns:
Errors: -

Definition at line 1189 of file filltool.cpp.

01190 {
01191     if (!GradFillTool::AllowFillNudges || NudgeFills)
01192         return;
01193     
01194     //Alias all the nudge ops to the fill specific ones.
01195     OpFillNudge::NudgeColours(TRUE);
01196     
01197     OpDescriptor* pOpDesc;
01198 
01199     pOpDesc = OpDescriptor::FindOpDescriptor(OPTOKEN_NUDGEUP1) ;
01200     if (pOpDesc) pOpDesc->AliasOperation(CC_RUNTIME_CLASS(OpFillNudgeUp1),NULL,0);
01201     pOpDesc = OpDescriptor::FindOpDescriptor(OPTOKEN_NUDGEUP5);  
01202     if (pOpDesc) pOpDesc->AliasOperation(CC_RUNTIME_CLASS(OpFillNudgeUp5),NULL,0);  
01203     pOpDesc = OpDescriptor::FindOpDescriptor(OPTOKEN_NUDGEUP10);  
01204     if (pOpDesc) pOpDesc->AliasOperation(CC_RUNTIME_CLASS(OpFillNudgeUp10),NULL,0);  
01205     pOpDesc = OpDescriptor::FindOpDescriptor(OPTOKEN_NUDGEUPFIFTH);
01206     if (pOpDesc) pOpDesc->AliasOperation(CC_RUNTIME_CLASS(OpFillNudgeUpFifth),NULL,0);
01207     pOpDesc = OpDescriptor::FindOpDescriptor(OPTOKEN_NUDGEUPPIXEL1);
01208     if (pOpDesc) pOpDesc->AliasOperation(CC_RUNTIME_CLASS(OpFillNudgeUpPixel1),NULL,0);
01209     pOpDesc = OpDescriptor::FindOpDescriptor(OPTOKEN_NUDGEUPPIXEL10);
01210     if (pOpDesc) pOpDesc->AliasOperation(CC_RUNTIME_CLASS(OpFillNudgeUpPixel10),NULL,0);
01211 
01212     pOpDesc = OpDescriptor::FindOpDescriptor(OPTOKEN_NUDGEDOWN1);  
01213     if (pOpDesc) pOpDesc->AliasOperation(CC_RUNTIME_CLASS(OpFillNudgeDown1),NULL,0);  
01214     pOpDesc = OpDescriptor::FindOpDescriptor(OPTOKEN_NUDGEDOWN5);  
01215     if (pOpDesc) pOpDesc->AliasOperation(CC_RUNTIME_CLASS(OpFillNudgeDown5),NULL,0);  
01216     pOpDesc = OpDescriptor::FindOpDescriptor(OPTOKEN_NUDGEDOWN10);  
01217     if (pOpDesc) pOpDesc->AliasOperation(CC_RUNTIME_CLASS(OpFillNudgeDown10),NULL,0);  
01218     pOpDesc = OpDescriptor::FindOpDescriptor(OPTOKEN_NUDGEDOWNFIFTH);
01219     if (pOpDesc) pOpDesc->AliasOperation(CC_RUNTIME_CLASS(OpFillNudgeDownFifth),NULL,0);
01220     pOpDesc = OpDescriptor::FindOpDescriptor(OPTOKEN_NUDGEDOWNPIXEL1);
01221     if (pOpDesc) pOpDesc->AliasOperation(CC_RUNTIME_CLASS(OpFillNudgeDownPixel1),NULL,0);
01222     pOpDesc = OpDescriptor::FindOpDescriptor(OPTOKEN_NUDGEDOWNPIXEL10);
01223     if (pOpDesc) pOpDesc->AliasOperation(CC_RUNTIME_CLASS(OpFillNudgeDownPixel10),NULL,0);
01224 
01225     pOpDesc = OpDescriptor::FindOpDescriptor(OPTOKEN_NUDGELEFT1);  
01226     if (pOpDesc) pOpDesc->AliasOperation(CC_RUNTIME_CLASS(OpFillNudgeLeft1),NULL,0);  
01227     pOpDesc = OpDescriptor::FindOpDescriptor(OPTOKEN_NUDGELEFT5);  
01228     if (pOpDesc) pOpDesc->AliasOperation(CC_RUNTIME_CLASS(OpFillNudgeLeft5),NULL,0);  
01229     pOpDesc = OpDescriptor::FindOpDescriptor(OPTOKEN_NUDGELEFT10);  
01230     if (pOpDesc) pOpDesc->AliasOperation(CC_RUNTIME_CLASS(OpFillNudgeLeft10),NULL,0);  
01231     pOpDesc = OpDescriptor::FindOpDescriptor(OPTOKEN_NUDGELEFTFIFTH);
01232     if (pOpDesc) pOpDesc->AliasOperation(CC_RUNTIME_CLASS(OpFillNudgeLeftFifth),NULL,0);
01233     pOpDesc = OpDescriptor::FindOpDescriptor(OPTOKEN_NUDGELEFTPIXEL1);
01234     if (pOpDesc) pOpDesc->AliasOperation(CC_RUNTIME_CLASS(OpFillNudgeLeftPixel1),NULL,0);
01235     pOpDesc = OpDescriptor::FindOpDescriptor(OPTOKEN_NUDGELEFTPIXEL10);
01236     if (pOpDesc) pOpDesc->AliasOperation(CC_RUNTIME_CLASS(OpFillNudgeLeftPixel10),NULL,0);
01237 
01238     pOpDesc = OpDescriptor::FindOpDescriptor(OPTOKEN_NUDGERIGHT1);  
01239     if (pOpDesc) pOpDesc->AliasOperation(CC_RUNTIME_CLASS(OpFillNudgeRight1),NULL,0);  
01240     pOpDesc = OpDescriptor::FindOpDescriptor(OPTOKEN_NUDGERIGHT5);  
01241     if (pOpDesc) pOpDesc->AliasOperation(CC_RUNTIME_CLASS(OpFillNudgeRight5),NULL,0);  
01242     pOpDesc = OpDescriptor::FindOpDescriptor(OPTOKEN_NUDGERIGHT10);  
01243     if (pOpDesc) pOpDesc->AliasOperation(CC_RUNTIME_CLASS(OpFillNudgeRight10),NULL,0);  
01244     pOpDesc = OpDescriptor::FindOpDescriptor(OPTOKEN_NUDGERIGHTFIFTH);
01245     if (pOpDesc) pOpDesc->AliasOperation(CC_RUNTIME_CLASS(OpFillNudgeRightFifth),NULL,0);
01246     pOpDesc = OpDescriptor::FindOpDescriptor(OPTOKEN_NUDGERIGHTPIXEL1);
01247     if (pOpDesc) pOpDesc->AliasOperation(CC_RUNTIME_CLASS(OpFillNudgeRightPixel1),NULL,0);
01248     pOpDesc = OpDescriptor::FindOpDescriptor(OPTOKEN_NUDGERIGHTPIXEL10);
01249     if (pOpDesc) pOpDesc->AliasOperation(CC_RUNTIME_CLASS(OpFillNudgeRightPixel10),NULL,0);
01250     
01251     NudgeFills = TRUE;
01252 }

void GradFillTool::GetCursorAndStatus DocCoord  ,
Spread ,
Cursor **  ,
String_256
 

Definition at line 1388 of file filltool.cpp.

01390 {
01391     // Setup defaults
01392     UINT32 Status;
01393     Cursor* pNewCursor = pGradFillCursor;
01394 
01395     AttrFillGeometry::DoCheckOnFillRampMesh = FALSE;        // disable this feature
01396 
01397     // Is the mouse over any of our fill control points ?
01398     if ( AttrFillGeometry::CheckForFillControlHit(Pos, &Status) )
01399     {
01400         // Status will have been updated
01401 
01402         // Change the cursor, to indicate the mouse is over a control point
01403         pNewCursor = pGradPointCursor;
01404     }
01405     else
01406     {
01407         INT32 Index = pGradInfoBarOp->CurrentGeometryIndex;
01408 
01409         if (TempGeometryIndex != -1)
01410             Index = TempGeometryIndex;
01411 
01412         // Check our menu status
01413         switch (Index)
01414         {      
01415             // If fill controls are selected then we indicate 
01416             // that a click will deselect them.
01417             // Otherwise we just show what kind of fill will
01418             // be created when the user drags.
01419 
01420             case (FGMENU_FLAT):
01421                 if ( AttrFillGeometry::FillSelectionCount() > 0 )
01422                     Status = _R(IDS_FS_CREATELINEAR_S);     
01423                 else                                    
01424                     Status = _R(IDS_FS_CREATELINEAR);
01425                 break;
01426 
01427             case (FGMENU_LINEAR):
01428                 if ( AttrFillGeometry::FillSelectionCount() > 0 )
01429                     Status = _R(IDS_FS_CREATELINEAR_S);     
01430                 else                                    
01431                     Status = _R(IDS_FS_CREATELINEAR);
01432                 break;
01433 
01434             case (FGMENU_CIRCULAR):
01435                 if ( AttrFillGeometry::FillSelectionCount() > 0 )
01436                     Status = _R(IDS_FS_CREATECIRCLE_S);
01437                 else
01438                     Status = _R(IDS_FS_CREATECIRCLE);
01439                 break;
01440 
01441             case (FGMENU_RADIAL):
01442                 if ( AttrFillGeometry::FillSelectionCount() > 0 )
01443                     Status = _R(IDS_FS_CREATEELLIP_S);
01444                 else
01445                     Status = _R(IDS_FS_CREATEELLIP);
01446                 break;
01447 
01448             case (FGMENU_CONICAL):
01449                 if ( AttrFillGeometry::FillSelectionCount() > 0 )
01450                     Status = _R(IDS_FS_CREATECONICAL_S);
01451                 else
01452                     Status = _R(IDS_FS_CREATECONICAL);
01453                 break;
01454 
01455             case (FGMENU_SQUARE):
01456                 if ( AttrFillGeometry::FillSelectionCount() > 0 )
01457                     Status = _R(IDS_FS_CREATESQUARE_S);
01458                 else
01459                     Status = _R(IDS_FS_CREATESQUARE);
01460                 break;
01461 
01462             case (FGMENU_THREECOL):
01463                 if ( AttrFillGeometry::FillSelectionCount() > 0 )
01464                     Status = _R(IDS_FS_CREATETHREECOL_S);
01465                 else
01466                     Status = _R(IDS_FS_CREATETHREECOL);
01467                 break;
01468 
01469             case (FGMENU_FOURCOL):
01470                 if ( AttrFillGeometry::FillSelectionCount() > 0 )
01471                     Status = _R(IDS_FS_CREATEFOURCOL_S);
01472                 else
01473                     Status = _R(IDS_FS_CREATEFOURCOL);
01474                 break;
01475 
01476             case (FGMENU_BITMAP):
01477                 if ( AttrFillGeometry::FillSelectionCount() > 0 )
01478                     Status = _R(IDS_FS_CREATEBITMAP_S);
01479                 else
01480                     Status = _R(IDS_FS_CREATEBITMAP);
01481                 break;
01482 
01483             case (FGMENU_FRACTAL):
01484                 if ( AttrFillGeometry::FillSelectionCount() > 0 )
01485                     Status = _R(IDS_FS_CREATEFRACTAL_S);
01486                 else
01487                     Status = _R(IDS_FS_CREATEFRACTAL);
01488                 break;
01489 
01490             case (FGMENU_NOISE):
01491                 if ( AttrFillGeometry::FillSelectionCount() > 0 )
01492                     Status = _R(IDS_FS_CREATENOISE_S);
01493                 else
01494                     Status = _R(IDS_FS_CREATENOISE);
01495                 break;
01496 
01497             default:
01498                 // Er .. Dunno what kind of fill this is ?
01499                 Status = _R(IDS_FS_CREATELINEAR);
01500                 break;
01501         }
01502     }
01503 
01504     if (pStatus != NULL)
01505     {
01506         pStatus->Load(Status);
01507         LastStatusID = Status;
01508     }
01509 
01510     if (pCursor != NULL)
01511         *pCursor = pNewCursor;
01512 
01513     AttrFillGeometry::DoCheckOnFillRampMesh = TRUE;         // enable again
01514 }

UINT32 GradFillTool::GetID void   )  [inline, virtual]
 

Reimplemented from Tool_v1.

Definition at line 287 of file filltool.h.

00287 { return TOOLID_GRADFILL; };

BOOL GradFillTool::GetStatusLineText String_256 ptext,
Spread pSpread,
DocCoord  DocPos,
ClickModifiers  ClickMods
[virtual]
 

generate up-to-date text for the status line (called on idles)

Author:
Will_Cowling (Xara Group Ltd) <camelotdev@xara.com>
Date:
9/12/94
Parameters:
pSpread - pointer to spread under mouse (else NULL) [INPUTS] DocPos - position of mouse in doc (in spread coords) ClickMods - mouse click modifiers
ptext - text for status line [OUTPUTS]
Returns:
TRUE if outputting valid text

Reimplemented from Tool_v1.

Definition at line 1362 of file filltool.cpp.

01364 {
01365     ERROR3IF(ptext==NULL,"GradFillTool::GetStatusLineText() - ptext passed as null");
01366 
01367     if (ClickMods.Adjust)
01368         TempGeometryIndex = FGMENU_CIRCULAR;
01369     else
01370         TempGeometryIndex = -1;
01371 
01372     GetCursorAndStatus(DocPos, pSpread, NULL, ptext);
01373 
01374     return TRUE;
01375 }

BOOL GradFillTool::Init void   )  [virtual]
 

Used to check if the Tool was properly constructed.

Author:
Will_Cowling (Xara Group Ltd) <camelotdev@xara.com>
Date:
19/7/94
Returns:
FALSE if it does not want to be created, TRUE otherwise
See also:
GradFillTool::GradFillTool

Reimplemented from Tool_v1.

Definition at line 631 of file filltool.cpp.

00632 {
00633     BOOL ok = TRUE;
00634 
00635     ok = OpChangeFillProfile::Declare();
00636 
00637 #if 0
00638     if (ok)
00639     {
00640         // Is everything ok so far ?
00641         CCResTextFile       file;               // Resource File
00642         GradInfoBarOpCreate BarCreate;          // Object that creates GradInfoBarOp objects
00643 
00644                 ok = file.open(_R(IDM_GRAD_BAR), _R(IDT_INFO_BAR_RES));     // Open resource
00645         if (ok) ok = DialogBarOp::ReadBarsFromFile(file,BarCreate); // Read and create info bar
00646         if (ok) file.close();                                       // Close resource
00647 
00648         ENSURE(ok,"Unable to load gradbar.ini from resource\n"); 
00649         String_32 str = String_32(_R(IDS_FILLTOOL_FILLINFOBARNAME));
00650         DialogBarOp* pDialogBarOp = DialogBarOp::FindDialogBarOp(str);
00651     }
00652 #endif
00653 
00654     if (ok)
00655     {
00656         // Info bar now exists.  Now get a pointer to it
00657         pGradInfoBarOp = new GradInfoBarOp(_R(IDD_GRADFILLDLG));
00658 
00659         if (pGradInfoBarOp)
00660         {
00661             // Set our default menu items
00662             pGradInfoBarOp->CurrentGeometryIndex = FGMENU_LINEAR;
00663             pGradInfoBarOp->CurrentMappingIndex = FMMENU_SIMPLE;
00664             pGradInfoBarOp->CurrentEffectIndex = FEMENU_FADE;
00665         } else
00666             ok=FALSE;
00667 
00668         ENSURE(ok,"Couldn't find grad tool info bar");
00669     }
00670 
00671     return (ok);
00672 }

static BOOL GradFillTool::IsCurrentTool  )  [inline, static]
 

Definition at line 298 of file filltool.h.

00298 { return CurrentTool; }

BOOL GradFillTool::IsFillNudgeEnabled  )  [static]
 

Checks for to see if the fill nudging is currently enabled or not.

Author:
Will_Cowling (Xara Group Ltd) <camelotdev@xara.com>
Date:
29/3/94
Returns:
TRUE - Fill nudging is disabled FALSE - Fill nudging is enabled

Errors: -

Definition at line 1341 of file filltool.cpp.

01342 {
01343     return NudgeFills;
01344 }

void GradFillTool::OnClick DocCoord  PointerPos,
ClickType  Click,
ClickModifiers  ClickMods,
Spread pSpread
[virtual]
 

To handle a Mouse Click event for the Selector Tool. It starts up a Selector Operation.

Author:
Will_Cowling (Xara Group Ltd) <camelotdev@xara.com>
Date:
19/7/94
Parameters:
PointerPos - The Coords (in DocCoords) of the point where the mouse button [INPUTS] was clicked Click - Describes the type of click that was detected. ClickMods - Indicates which buttons caused the click and which modifers were pressed at the same time
Returns:
TRUE if it handled the Click, FALSE otherwise
See also:
Tool::MouseClick; ClickType; ClickModifiers

Reimplemented from DragTool.

Definition at line 866 of file filltool.cpp.

00868 {
00869     if (ClickMods.Menu) return;                         // Don't do anything if the user clicked the Menu button
00870 
00871     // See if there is already a drag going on
00872     if (Operation::GetCurrentDragOp()!=NULL)
00873         return;
00874 
00875     if ( AttrFillGeometry::CheckAttrClick(PointerPos, Click, ClickMods, pSpread) )
00876     {
00877         // nastiness ALERT !!!!!
00878 
00879         // since we can now double click to insert a multi-stage fill blob, we also MUST
00880         // select that blob once it is created.  ONLY problem is that we cannot do this
00881         // (since it dosen't exist) UNTIL we have redrawn the screen ....
00882         
00883         if ( Click == CLICKTYPE_DOUBLE )
00884         {
00885             SelRange *Selected = GetApplication()->FindSelection();
00886             Node *Current = Selected->FindFirst();
00887 
00888             if (Current!=NULL)
00889             {
00890                 Spread *pSpread2 = Current->FindParentSpread();
00891                 RenderToolBlobs(pSpread2, NULL);
00892                 
00893                 // the only sensible way to select the new blob is to fake a mouse click on it ....
00894                 
00895                 AttrFillGeometry::CheckAttrClick(PointerPos, CLICKTYPE_SINGLE, ClickMods, pSpread2);
00896 
00897                 // now fake an onmousemove to get our cursor/status line to change as well!
00898                 
00899                 OnMouseMove (PointerPos, pSpread, ClickMods);
00900             }
00901         }
00902         
00903         return;     // An Attribute claimed the click
00904     }
00905 
00906     // Make sure this click is one that we want
00907     if ( Click == CLICKTYPE_SINGLE )
00908     {
00909         StartPos = PointerPos;
00910         StartSpread = pSpread;
00911         DoubleClicked = FALSE;
00912     }
00913 
00914     if ( Click == CLICKTYPE_UP )
00915     {
00916         StartPos = DocCoord(0,0);
00917         StartSpread = NULL;
00918         DoubleClicked = FALSE;
00919     }
00920 
00921     if ( Click == CLICKTYPE_DOUBLE )
00922     {
00923         DoubleClicked = TRUE;       
00924     }
00925 
00926     if ( Click == CLICKTYPE_DRAG )
00927     {
00928         if (StartSpread == NULL)
00929             return;
00930 
00931         // Just what we wanted - Someone is dragging the mouse about
00932         // We need to make an operation to perform the drag with
00933 //      OpCreateFill* pOp = new OpCreateFill;
00934         OpEditFill* pOp = new OpEditFill;
00935         if (pOp == NULL)
00936         {
00937             // Inform the person doing the clicking that life is not looking so good
00938             InformError();
00939         }
00940         else
00941         {
00942             AttrFillGeometry* Fill = NULL;
00943             // Start the drag operation and pass in the Anchor Point to the push operation
00944 
00945             if (ClickMods.Adjust)
00946             {
00947                 Fill = new AttrRadialColourFill;
00948                 if (Fill != NULL)
00949                     ((AttrRadialFill*)Fill)->MakeCircular();
00950             }
00951 #ifndef WEBSTER
00952             else if (DoubleClicked)
00953             {
00954                 Fill = new AttrConicalColourFill;
00955             }
00956 #endif //WEBSTER
00957             else
00958             {
00959                 switch (pGradInfoBarOp->CurrentGeometryIndex)
00960                 {
00961                     case (FGMENU_FLAT):
00962                         // DMc changed - for the multiple colour fills
00963                         Fill = new AttrLinearColourFill;
00964                         break;
00965 
00966                     case (FGMENU_LINEAR):
00967                         Fill = new AttrLinearColourFill;
00968                         break;
00969 
00970                     case (FGMENU_CIRCULAR):
00971                         Fill = new AttrRadialColourFill;
00972                         if (Fill != NULL)
00973                             ((AttrRadialFill*)Fill)->MakeCircular();
00974                         break;
00975 
00976                     case (FGMENU_RADIAL):
00977                         Fill = new AttrRadialColourFill;
00978                         break;
00979 
00980                     case (FGMENU_CONICAL):
00981                         Fill = new AttrConicalColourFill;
00982                         break;
00983 
00984                     case (FGMENU_SQUARE):
00985                         Fill = new AttrSquareColourFill;
00986                         break;
00987 
00988                     case (FGMENU_THREECOL):
00989                         Fill = new AttrThreeColColourFill;
00990                         break;
00991 
00992                     case (FGMENU_FOURCOL):
00993                         Fill = new AttrFourColColourFill;
00994                         break;
00995 
00996                     case (FGMENU_BITMAP):
00997                         Fill = new AttrBitmapColourFill;
00998 
00999                         Fill->AttachBitmap(NULL);
01000                         Fill->SetTesselation(pGradInfoBarOp->CurrentMappingIndex+1);
01001                         break;
01002 
01003                     case (FGMENU_FRACTAL):
01004                         Fill = new AttrFractalColourFill;
01005                         Fill->SetTesselation(pGradInfoBarOp->CurrentMappingIndex+1);
01006                         break;
01007 
01008                     case (FGMENU_NOISE):
01009                         Fill = new AttrNoiseColourFill;
01010                         Fill->SetTesselation(pGradInfoBarOp->CurrentMappingIndex+1);
01011                         break;
01012 
01013                     default:
01014                         // Er .. Dunno what kind of fill this is ?
01015                         Fill = new AttrLinearColourFill;
01016                         break;
01017                 }
01018             }
01019     
01020             if (Fill == NULL)
01021             {
01022                 InformError();
01023                 return;
01024             }
01025 
01026             pOp->DoCreate(StartPos, StartSpread, Fill);
01027         }
01028 
01029         StartPos = DocCoord(0,0);
01030         StartSpread = NULL;
01031         DoubleClicked = FALSE;
01032         return;
01033     }
01034 
01035     // call the base class ....
01036 
01037     DragTool::OnClick (PointerPos, Click, ClickMods, pSpread);
01038 }

BOOL GradFillTool::OnKeyPress KeyPress pKeyPress  )  [virtual]
 

Checks for fill tool keys.

Author:
Will_Cowling (Xara Group Ltd) <camelotdev@xara.com>
Date:
29/3/94
Parameters:
pKeyPress = Ptr to a platform-indy key press object [INPUTS]
- [OUTPUTS]
Returns:
TRUE - the key press was processed, so do NOT pass on FALSE - not processed, so let others have a bash

Errors: -

Reimplemented from Tool_v1.

Definition at line 1092 of file filltool.cpp.

01093 {
01094     if (pKeyPress->GetVirtKey() == CAMKEY(TAB) &&
01095         !pKeyPress->IsRelease() &&
01096         !pKeyPress->IsRepeat())
01097     {
01098         // Toggle the selection state of all visible fill control points
01099         ToggleControlPoints(pKeyPress->IsAdjust());
01100 
01101         return TRUE;
01102     }
01103 
01104     if ( IsFillNudgeEnabled() &&
01105         (pKeyPress->GetVirtKey() == CAMKEY(UP) ||
01106          pKeyPress->GetVirtKey() == CAMKEY(DOWN) ||
01107          pKeyPress->GetVirtKey() == CAMKEY(LEFT) ||
01108          pKeyPress->GetVirtKey() == CAMKEY(RIGHT)) )
01109     {
01110         // If we are nudging, then stop the Attribute manager from sending
01111         // tons of messages, until the nudge stops.
01112         if (pKeyPress->IsRelease())
01113             AttributeManager::SendMessages = TRUE;
01114         else
01115             AttributeManager::SendMessages = FALSE;
01116 
01117         // Pass on the nudge keys
01118         return FALSE;
01119     }
01120     return FALSE;
01121 }

void GradFillTool::OnMouseMove DocCoord  Pos,
Spread pSpread,
ClickModifiers  ClickMods
[virtual]
 

Called whenever the mouse position changes. We use this to update the cursor and status messages.

Author:
Will_Cowling (Xara Group Ltd) <camelotdev@xara.com>
Date:
19/07/94
Parameters:
Pos - The current position of the mouse. [INPUTS] pSpread - The current spread.

Reimplemented from Tool_v1.

Definition at line 1053 of file filltool.cpp.

01054 {
01055     // Setup defaults
01056     Cursor* pCursor = pGradFillCursor;
01057     String_256 Status;
01058 
01059     if (ClickMods.Adjust)
01060         TempGeometryIndex = FGMENU_CIRCULAR;
01061     else
01062         TempGeometryIndex = -1;
01063 
01064     GetCursorAndStatus(Pos, pSpread, &pCursor, &Status);
01065 
01066     if (pCursor != pCurrentCursor)
01067     {
01068         // We're using the wrong shape!! 
01069         pCurrentCursor = pCursor;
01070         CursorStack::GSetTop(pCurrentCursor, CurrentCursorID);
01071     }
01072         
01073     // Display the status text
01074     GetApplication()->UpdateStatusBarText(&Status);
01075 }

void GradFillTool::SelectChange BOOL  isSelected  )  [virtual]
 

Creates/destroys/pushes/pops the rectangle tool's cursor.

Author:
Will_Cowling (Xara Group Ltd) <camelotdev@xara.com>
Date:
19/07/94
Parameters:
- [INPUTS]
- [OUTPUTS]
Returns:
-

Errors: Debug warning if creating the cursor fails.

See also:
-

Reimplemented from Tool_v1.

Definition at line 729 of file filltool.cpp.

00730 {
00731     if (isSelected)
00732     {
00733         // This tool has just been selected.  Create an appropriate cursor, in this case
00734         // we can use the operating system-provided crosshair cursor.
00735         pGradFillCursor  = new Cursor(this, _R(IDC_GRADTOOLCURSOR));
00736         pGradPointCursor = new Cursor(this, _R(IDC_GRADPOINTCURSOR));
00737 
00738         // Did the cursor create ok ?
00739         if (!pGradFillCursor || !pGradFillCursor->IsValid())
00740         {
00741             return;
00742         }
00743 
00744         // Did the cursor create ok ?
00745         if (!pGradPointCursor || !pGradPointCursor->IsValid())
00746         {
00747             return;
00748         }
00749 
00750         pCurrentCursor = pGradFillCursor;
00751         CurrentCursorID = CursorStack::GPush(pGradFillCursor, FALSE);   // Push cursor, but don't display now
00752 
00753         // Create and display the tool's info bar
00754         CurrentTool = TRUE;
00755         AttrFillGeometry::SetTranspMeshesVisible(FALSE);
00756 
00757         // Which blobs do I want displayed
00758         BlobManager* BlobMgr = GetApplication()->GetBlobManager();
00759         if (BlobMgr != NULL)
00760         {
00761             // Decide which blobs to display
00762             BlobStyle MyBlobs;
00763             MyBlobs.Tiny = TRUE;
00764             MyBlobs.Fill = TRUE;
00765 
00766             // tell the blob manager
00767             BlobMgr->ToolInterest(MyBlobs);
00768         }
00769 
00770         // Re-Count the number of selected fill control points
00771         AttrFillGeometry::SetSelectionCount(AttrFillGeometry::CountSelectionControlPoints());
00772 
00773         pGradInfoBarOp->Create();
00774         pGradInfoBarOp->EnableControls ();
00775 
00776         if (AttrFillGeometry::SelectionCount > 0)
00777             EnableFillNudge();
00778 
00779         TempGeometryIndex = -1;
00780         //CurrentGeometryIndex = ;
00781 
00782         SelRange *Selected = GetApplication()->FindSelection();
00783 
00784         // There is a selection if there is a document, and it has some selected object(s)
00785         IsSelection = (Document::GetCurrent() != NULL && Selected->Count() > 0);
00786 
00787         if (IsSelection)
00788         {
00789             SelectionBox  = Selected->GetBoundingRect();
00790 
00791             Node* Current = Selected->FindFirst();
00792             if (Current != NULL)
00793             {
00794                 Spread *pSpread = Current->FindParentSpread();
00795                 RenderToolBlobs(pSpread, NULL);
00796             }
00797         }
00798     }
00799     else
00800     {
00801 //      pGradInfoBarOp->ResetHiddenGadgetStates ();
00802         
00803         DisableFillNudge();
00804 
00805         // Deselection - destroy the tool's cursor, if there is one.
00806         if (pGradFillCursor)
00807         {
00808             CursorStack::GPop(CurrentCursorID);
00809             delete pGradFillCursor;
00810             delete pGradPointCursor;
00811 
00812             pCurrentCursor = NULL;
00813             CurrentCursorID = 0;
00814         }
00815 
00816         pGradInfoBarOp->CloseProfileDialog (pGradInfoBarOp->m_BiasGainGadget);
00817 
00818         pGradInfoBarOp->Delete();
00819 
00820         CurrentTool = FALSE;
00821 
00822         // If needed, draw the [tool blobs? OK, who forgot to finish the comment?!]
00823         if (IsSelection && Document::GetCurrent()!=NULL)
00824         {
00825             SelRange *Selected = GetApplication()->FindSelection();
00826             Node *Current = Selected->FindFirst();
00827 
00828             if (Current!=NULL)
00829             {
00830                 Spread *pSpread = Current->FindParentSpread();
00831                 RenderToolBlobs(pSpread, NULL);
00832             }
00833         }
00834 
00835         // ensure any tool object blobs are removed.
00836         BlobManager* BlobMgr = GetApplication()->GetBlobManager();
00837         if (BlobMgr != NULL)
00838         {
00839             BlobStyle bsRemoves;
00840             bsRemoves.ToolObject = TRUE;
00841             BlobMgr->RemoveInterest(bsRemoves);
00842         }
00843     }
00844 }

void GradFillTool::ToggleControlPoints BOOL  Reverse  ) 
 

Toggles the selection state of all visible fill control blobs.

Author:
Will_Cowling (Xara Group Ltd) <camelotdev@xara.com>
Date:
29/3/94
Parameters:
Reverse - if true the points will cycle in the opposite direction [INPUTS]

Definition at line 1134 of file filltool.cpp.

01135 {
01136     // Switch control points
01137     AttrFillGeometry::LastRenderedStartBlob = DocCoord(0,0);
01138     AttrFillGeometry::LastRenderedEndBlob = DocCoord(0,0);
01139     AttrFillGeometry::LastRenderedEnd2Blob = DocCoord(0,0);
01140     AttrFillGeometry::LastRenderedEnd3Blob = DocCoord(0,0);
01141 
01142     AttrFillGeometry* pAttrNode = AttrFillGeometry::FindFirstSelectedAttr();
01143 
01144     // Return if there aren't any
01145     if (pAttrNode == NULL)
01146         return;
01147 
01148     // We only toggle if there are some points selected
01149     BOOL DoToggle = AttrFillGeometry::FillSelectionCount() > 0;
01150 
01151     while (pAttrNode != NULL)
01152     {
01153         if (pAttrNode->IsAColourFill())
01154         {
01155             if (DoToggle)
01156             {
01157                 // We're going to toggle the selected control points.
01158                 if (pAttrNode->GetSelectionCount() > 0)
01159                 {
01160                     pAttrNode->CycleSelection(Reverse);
01161                 }
01162             }
01163             else
01164             {
01165                 // There were no points selected, so we'll just
01166                 // select all the start points.
01167                 pAttrNode->SelectBlob(FILLCONTROL_STARTPOINT);
01168             }
01169         }
01170 
01171         // Check the next fill
01172         pAttrNode = AttrFillGeometry::FindNextSelectedAttr();
01173     }
01174 
01175     BROADCAST_TO_ALL(SelChangingMsg(SelChangingMsg::COLOURATTCHANGED)); 
01176 }


Member Data Documentation

BOOL GradFillTool::AllowFillNudges = TRUE [static]
 

Definition at line 307 of file filltool.h.

TCHAR * GradFillTool::Author = _T("Will") [static, private]
 

Reimplemented from DragTool.

Definition at line 313 of file filltool.h.

DocCoord GradFillTool::ClickStart [private]
 

Definition at line 322 of file filltool.h.

INT32 GradFillTool::CurrentCursorID [private]
 

Definition at line 337 of file filltool.h.

BOOL GradFillTool::CurrentTool [static, private]
 

Definition at line 319 of file filltool.h.

BOOL GradFillTool::DoubleClicked [private]
 

Definition at line 343 of file filltool.h.

AttrFillGeometry* GradFillTool::EditingFill [private]
 

Definition at line 342 of file filltool.h.

TCHAR * GradFillTool::FamilyName = _T("Fill Tools") [static, private]
 

Reimplemented from DragTool.

Definition at line 310 of file filltool.h.

BOOL GradFillTool::IsSelection [private]
 

Definition at line 330 of file filltool.h.

UINT32 GradFillTool::LastStatusID [static, private]
 

Definition at line 317 of file filltool.h.

BOOL GradFillTool::NudgeFills = FALSE [static, private]
 

Definition at line 346 of file filltool.h.

BOOL GradFillTool::OpBusy [private]
 

Definition at line 344 of file filltool.h.

Cursor* GradFillTool::pCurrentCursor [private]
 

Definition at line 333 of file filltool.h.

Cursor* GradFillTool::pGradFillCursor [private]
 

Definition at line 334 of file filltool.h.

GradInfoBarOp * GradFillTool::pGradInfoBarOp [static, private]
 

Definition at line 339 of file filltool.h.

Cursor* GradFillTool::pGradPointCursor [private]
 

Definition at line 335 of file filltool.h.

TranspInfoBarOp * GradFillTool::pTranspInfoBarOp [static, private]
 

Definition at line 340 of file filltool.h.

TCHAR * GradFillTool::Purpose = _T("Graduated Filling of Objects") [static, private]
 

Reimplemented from DragTool.

Definition at line 312 of file filltool.h.

DocRect GradFillTool::SelectionBox [private]
 

Definition at line 327 of file filltool.h.

DocCoord GradFillTool::StartPos [private]
 

Definition at line 323 of file filltool.h.

Spread* GradFillTool::StartSpread [private]
 

Definition at line 324 of file filltool.h.

TCHAR * GradFillTool::ToolName = _T("Graduated Fill Tool") [static, private]
 

Reimplemented from DragTool.

Definition at line 311 of file filltool.h.


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