TranspTool Class Reference

The transparency tool. More...

#include <filltool.h>

Inheritance diagram for TranspTool:

DragTool Tool_v1 List of all members.

Public Member Functions

 TranspTool ()
 Constructs a Transparency Tool.
 ~TranspTool ()
 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. Notes: Changed by Gerry (8/96) to use new CycleSelection call.

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.

Private Member Functions

 CC_DECLARE_MEMDUMP (TranspTool)

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
CursorpTranspCursor
CursorpTranspPointCursor
INT32 CurrentCursorID
AttrFillGeometryEditingFill
BOOL DoubleClicked
BOOL OpBusy

Static Private Attributes

static TCHARFamilyName = _T("Fill Tools")
static TCHARToolName = _T("Transparency Tool")
static TCHARPurpose = _T("Alter the transparency of objects")
static TCHARAuthor = _T("Will")
static UINT32 LastStatusID
static BOOL CurrentTool
static TranspInfoBarOppTranspInfoBarOp
static BOOL NudgeFills = FALSE

Detailed Description

The transparency tool.

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

Definition at line 359 of file filltool.h.


Constructor & Destructor Documentation

TranspTool::TranspTool  ) 
 

Constructs a Transparency Tool.

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

Definition at line 1560 of file filltool.cpp.

01561 {
01562     ClickStart = DocCoord(0,0);
01563     IsSelection = FALSE;
01564     StartSpread = NULL;
01565     pTranspCursor = NULL;
01566     CurrentCursorID = 0;
01567 
01568     CurrentTool = FALSE;
01569     NudgeFills = FALSE;
01570 }

TranspTool::~TranspTool  ) 
 

Destructor. Does nothing.

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

Definition at line 1582 of file filltool.cpp.

01583 {
01584     // Dummy destructor
01585 }


Member Function Documentation

TranspTool::CC_DECLARE_MEMDUMP TranspTool   )  [private]
 

void TranspTool::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 1658 of file filltool.cpp.

01659 {
01660     // Cast structure into the latest one we understand.
01661     ToolInfo_v1 *Info = (ToolInfo_v1 *) InfoPtr;
01662 
01663     Info -> InfoVersion = 1;
01664     
01665     Info -> InterfaceVersion = GetToolInterfaceVersion();  // You should always have this line.
01666         
01667     // These are all arbitrary at present.
01668     Info -> Version = 1;
01669     Info -> ID      = GetID();
01670     Info -> TextID   = _R(IDS_TRANSP_TOOL);
01671     Info -> BubbleID = _R(IDBBL_TRANSP_TOOL);
01672 
01673     Info -> Family  = FamilyName;
01674     Info -> Name    = ToolName;
01675     Info -> Purpose = Purpose;
01676     Info -> Author  = Author;
01677 
01678     Info -> InfoBarDialog = 0;
01679 }

void TranspTool::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 2271 of file filltool.cpp.

02272 {
02273     if (!GradFillTool::AllowFillNudges || !NudgeFills)
02274         return;
02275 
02276     NudgeFills = FALSE;
02277 
02278     //Un-alias all the nudge ops back like they were.
02279     OpDescriptor* pOpDesc = OpDescriptor::FindOpDescriptor(OPTOKEN_NUDGEUP1);  
02280     pOpDesc->RemoveAlias();  
02281     pOpDesc = OpDescriptor::FindOpDescriptor(OPTOKEN_NUDGEUP5);  
02282     pOpDesc->RemoveAlias();  
02283     pOpDesc = OpDescriptor::FindOpDescriptor(OPTOKEN_NUDGEUP10);  
02284     pOpDesc->RemoveAlias();  
02285     pOpDesc = OpDescriptor::FindOpDescriptor(OPTOKEN_NUDGEUPFIFTH);  
02286     pOpDesc->RemoveAlias();  
02287     pOpDesc = OpDescriptor::FindOpDescriptor(OPTOKEN_NUDGEUPPIXEL1);  
02288     pOpDesc->RemoveAlias();  
02289     pOpDesc = OpDescriptor::FindOpDescriptor(OPTOKEN_NUDGEUPPIXEL10);  
02290     pOpDesc->RemoveAlias();  
02291 
02292     pOpDesc = OpDescriptor::FindOpDescriptor(OPTOKEN_NUDGEDOWN1);  
02293     pOpDesc->RemoveAlias();  
02294     pOpDesc = OpDescriptor::FindOpDescriptor(OPTOKEN_NUDGEDOWN5);  
02295     pOpDesc->RemoveAlias();  
02296     pOpDesc = OpDescriptor::FindOpDescriptor(OPTOKEN_NUDGEDOWN10);  
02297     pOpDesc->RemoveAlias();  
02298     pOpDesc = OpDescriptor::FindOpDescriptor(OPTOKEN_NUDGEDOWNFIFTH);  
02299     pOpDesc->RemoveAlias();  
02300     pOpDesc = OpDescriptor::FindOpDescriptor(OPTOKEN_NUDGEDOWNPIXEL1);  
02301     pOpDesc->RemoveAlias();  
02302     pOpDesc = OpDescriptor::FindOpDescriptor(OPTOKEN_NUDGEDOWNPIXEL10);  
02303     pOpDesc->RemoveAlias();  
02304 
02305     pOpDesc = OpDescriptor::FindOpDescriptor(OPTOKEN_NUDGELEFT1);  
02306     pOpDesc->RemoveAlias();  
02307     pOpDesc = OpDescriptor::FindOpDescriptor(OPTOKEN_NUDGELEFT5);  
02308     pOpDesc->RemoveAlias();  
02309     pOpDesc = OpDescriptor::FindOpDescriptor(OPTOKEN_NUDGELEFT10);  
02310     pOpDesc->RemoveAlias();  
02311     pOpDesc = OpDescriptor::FindOpDescriptor(OPTOKEN_NUDGELEFTFIFTH);  
02312     pOpDesc->RemoveAlias();  
02313     pOpDesc = OpDescriptor::FindOpDescriptor(OPTOKEN_NUDGELEFTPIXEL1);  
02314     pOpDesc->RemoveAlias();  
02315     pOpDesc = OpDescriptor::FindOpDescriptor(OPTOKEN_NUDGELEFTPIXEL10);  
02316     pOpDesc->RemoveAlias();  
02317 
02318     pOpDesc = OpDescriptor::FindOpDescriptor(OPTOKEN_NUDGERIGHT1);  
02319     pOpDesc->RemoveAlias();  
02320     pOpDesc = OpDescriptor::FindOpDescriptor(OPTOKEN_NUDGERIGHT5);  
02321     pOpDesc->RemoveAlias();  
02322     pOpDesc = OpDescriptor::FindOpDescriptor(OPTOKEN_NUDGERIGHT10);  
02323     pOpDesc->RemoveAlias();  
02324     pOpDesc = OpDescriptor::FindOpDescriptor(OPTOKEN_NUDGERIGHTFIFTH);  
02325     pOpDesc->RemoveAlias();  
02326     pOpDesc = OpDescriptor::FindOpDescriptor(OPTOKEN_NUDGERIGHTPIXEL1);  
02327     pOpDesc->RemoveAlias();  
02328     pOpDesc = OpDescriptor::FindOpDescriptor(OPTOKEN_NUDGERIGHTPIXEL10);  
02329     pOpDesc->RemoveAlias();  
02330 }

void TranspTool::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 2537 of file filltool.cpp.

02538 {
02539     String_256 StatusMsg("");
02540     StatusMsg.Load(StatusID);
02541     GetApplication()->UpdateStatusBarText(&StatusMsg);
02542     LastStatusID = StatusID;
02543 }

void TranspTool::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 2196 of file filltool.cpp.

02197 {
02198     if (!GradFillTool::AllowFillNudges || NudgeFills)
02199         return;
02200 
02201     //Alias all the nudge ops to the fill specific ones.
02202     OpFillNudge::NudgeColours(FALSE);
02203 
02204     OpDescriptor* pOpDesc = OpDescriptor::FindOpDescriptor(OPTOKEN_NUDGEUP1);  
02205     pOpDesc->AliasOperation(CC_RUNTIME_CLASS(OpFillNudgeUp1),NULL,0);  
02206     pOpDesc = OpDescriptor::FindOpDescriptor(OPTOKEN_NUDGEUP5);  
02207     pOpDesc->AliasOperation(CC_RUNTIME_CLASS(OpFillNudgeUp5),NULL,0);  
02208     pOpDesc = OpDescriptor::FindOpDescriptor(OPTOKEN_NUDGEUP10);  
02209     pOpDesc->AliasOperation(CC_RUNTIME_CLASS(OpFillNudgeUp10),NULL,0);  
02210     pOpDesc = OpDescriptor::FindOpDescriptor(OPTOKEN_NUDGEUPFIFTH);  
02211     pOpDesc->AliasOperation(CC_RUNTIME_CLASS(OpFillNudgeUpFifth),NULL,0);  
02212     pOpDesc = OpDescriptor::FindOpDescriptor(OPTOKEN_NUDGEUPPIXEL1);  
02213     pOpDesc->AliasOperation(CC_RUNTIME_CLASS(OpFillNudgeUpPixel1),NULL,0);  
02214     pOpDesc = OpDescriptor::FindOpDescriptor(OPTOKEN_NUDGEUPPIXEL10);  
02215     pOpDesc->AliasOperation(CC_RUNTIME_CLASS(OpFillNudgeUpPixel10),NULL,0);  
02216 
02217     pOpDesc = OpDescriptor::FindOpDescriptor(OPTOKEN_NUDGEDOWN1);  
02218     pOpDesc->AliasOperation(CC_RUNTIME_CLASS(OpFillNudgeDown1),NULL,0);  
02219     pOpDesc = OpDescriptor::FindOpDescriptor(OPTOKEN_NUDGEDOWN5);  
02220     pOpDesc->AliasOperation(CC_RUNTIME_CLASS(OpFillNudgeDown5),NULL,0);  
02221     pOpDesc = OpDescriptor::FindOpDescriptor(OPTOKEN_NUDGEDOWN10);  
02222     pOpDesc->AliasOperation(CC_RUNTIME_CLASS(OpFillNudgeDown10),NULL,0);  
02223     pOpDesc = OpDescriptor::FindOpDescriptor(OPTOKEN_NUDGEDOWNFIFTH);  
02224     pOpDesc->AliasOperation(CC_RUNTIME_CLASS(OpFillNudgeDownFifth),NULL,0);  
02225     pOpDesc = OpDescriptor::FindOpDescriptor(OPTOKEN_NUDGEDOWNPIXEL1);  
02226     pOpDesc->AliasOperation(CC_RUNTIME_CLASS(OpFillNudgeDownPixel1),NULL,0);  
02227     pOpDesc = OpDescriptor::FindOpDescriptor(OPTOKEN_NUDGEDOWNPIXEL10);  
02228     pOpDesc->AliasOperation(CC_RUNTIME_CLASS(OpFillNudgeDownPixel10),NULL,0);  
02229 
02230     pOpDesc = OpDescriptor::FindOpDescriptor(OPTOKEN_NUDGELEFT1);  
02231     pOpDesc->AliasOperation(CC_RUNTIME_CLASS(OpFillNudgeLeft1),NULL,0);  
02232     pOpDesc = OpDescriptor::FindOpDescriptor(OPTOKEN_NUDGELEFT5);  
02233     pOpDesc->AliasOperation(CC_RUNTIME_CLASS(OpFillNudgeLeft5),NULL,0);  
02234     pOpDesc = OpDescriptor::FindOpDescriptor(OPTOKEN_NUDGELEFT10);  
02235     pOpDesc->AliasOperation(CC_RUNTIME_CLASS(OpFillNudgeLeft10),NULL,0);  
02236     pOpDesc = OpDescriptor::FindOpDescriptor(OPTOKEN_NUDGELEFTFIFTH);  
02237     pOpDesc->AliasOperation(CC_RUNTIME_CLASS(OpFillNudgeLeftFifth),NULL,0);  
02238     pOpDesc = OpDescriptor::FindOpDescriptor(OPTOKEN_NUDGELEFTPIXEL1);  
02239     pOpDesc->AliasOperation(CC_RUNTIME_CLASS(OpFillNudgeLeftPixel1),NULL,0);  
02240     pOpDesc = OpDescriptor::FindOpDescriptor(OPTOKEN_NUDGELEFTPIXEL10);  
02241     pOpDesc->AliasOperation(CC_RUNTIME_CLASS(OpFillNudgeLeftPixel10),NULL,0);  
02242 
02243     pOpDesc = OpDescriptor::FindOpDescriptor(OPTOKEN_NUDGERIGHT1);  
02244     pOpDesc->AliasOperation(CC_RUNTIME_CLASS(OpFillNudgeRight1),NULL,0);  
02245     pOpDesc = OpDescriptor::FindOpDescriptor(OPTOKEN_NUDGERIGHT5);  
02246     pOpDesc->AliasOperation(CC_RUNTIME_CLASS(OpFillNudgeRight5),NULL,0);  
02247     pOpDesc = OpDescriptor::FindOpDescriptor(OPTOKEN_NUDGERIGHT10);  
02248     pOpDesc->AliasOperation(CC_RUNTIME_CLASS(OpFillNudgeRight10),NULL,0);  
02249     pOpDesc = OpDescriptor::FindOpDescriptor(OPTOKEN_NUDGERIGHTFIFTH);  
02250     pOpDesc->AliasOperation(CC_RUNTIME_CLASS(OpFillNudgeRightFifth),NULL,0);  
02251     pOpDesc = OpDescriptor::FindOpDescriptor(OPTOKEN_NUDGERIGHTPIXEL1);  
02252     pOpDesc->AliasOperation(CC_RUNTIME_CLASS(OpFillNudgeRightPixel1),NULL,0);  
02253     pOpDesc = OpDescriptor::FindOpDescriptor(OPTOKEN_NUDGERIGHTPIXEL10);  
02254     pOpDesc->AliasOperation(CC_RUNTIME_CLASS(OpFillNudgeRightPixel10),NULL,0);  
02255 
02256 
02257     NudgeFills = TRUE;
02258 }

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

Definition at line 2392 of file filltool.cpp.

02394 {
02395     // Setup defaults
02396     UINT32 Status;
02397     Cursor* pNewCursor = pTranspCursor;
02398 
02399     // Is the mouse over any of our fill control points ?
02400     if ( AttrFillGeometry::CheckForFillControlHit(Pos, &Status) )
02401     {
02402         // Status will have been updated
02403 
02404         // Change the cursor, to indicate the mouse is over a control point
02405         pNewCursor = pTranspPointCursor;
02406     }
02407     else
02408     {
02409         INT32 Index = pTranspInfoBarOp->CurrentGeometryIndex;
02410 
02411         if (TempGeometryIndex != -1)
02412             Index = TempGeometryIndex;
02413 
02414         // Check our menu status
02415         switch (Index)
02416         {      
02417             // If fill controls are selected then we indicate 
02418             // that a click will deselect them.
02419             // Otherwise we just show what kind of fill will
02420             // be created when the user drags.
02421 
02422             case (FGMENU_NOTRANSP):
02423                 if ( AttrFillGeometry::FillSelectionCount() > 0 )
02424                     Status = _R(IDS_TS_CREATELINEAR_S);     
02425                 else                                    
02426                     Status = _R(IDS_TS_CREATELINEAR);
02427                 break;
02428 
02429             case (FGMENU_FLATTRANSP):
02430                 if ( AttrFillGeometry::FillSelectionCount() > 0 )
02431                     Status = _R(IDS_TS_CREATELINEAR_S);     
02432                 else                                    
02433                     Status = _R(IDS_TS_CREATELINEAR);
02434                 break;
02435 
02436             case (FGMENU_LINEARTRANSP):
02437                 if ( AttrFillGeometry::FillSelectionCount() > 0 )
02438                     Status = _R(IDS_TS_CREATELINEAR_S);     
02439                 else                                    
02440                     Status = _R(IDS_TS_CREATELINEAR);
02441                 break;
02442 
02443             case (FGMENU_CIRCULARTRANSP):
02444                 if ( AttrFillGeometry::FillSelectionCount() > 0 )
02445                     Status = _R(IDS_TS_CREATECIRCLE_S);
02446                 else
02447                     Status = _R(IDS_TS_CREATECIRCLE);
02448                 break;
02449 
02450             case (FGMENU_RADIALTRANSP):
02451                 if ( AttrFillGeometry::FillSelectionCount() > 0 )
02452                     Status = _R(IDS_TS_CREATEELLIP_S);
02453                 else
02454                     Status = _R(IDS_TS_CREATEELLIP);
02455                 break;
02456 
02457             case (FGMENU_CONICALTRANSP):
02458                 if ( AttrFillGeometry::FillSelectionCount() > 0 )
02459                     Status = _R(IDS_TS_CREATECONICAL_S);
02460                 else
02461                     Status = _R(IDS_TS_CREATECONICAL);
02462                 break;
02463 
02464             case (FGMENU_SQUARETRANSP):
02465                 if ( AttrFillGeometry::FillSelectionCount() > 0 )
02466                     Status = _R(IDS_TS_CREATESQUARE_S);
02467                 else
02468                     Status = _R(IDS_TS_CREATESQUARE);
02469                 break;
02470 
02471             case (FGMENU_THREECOLTRANSP):
02472                 if ( AttrFillGeometry::FillSelectionCount() > 0 )
02473                     Status = _R(IDS_TS_CREATETHREECOL_S);
02474                 else
02475                     Status = _R(IDS_TS_CREATETHREECOL);
02476                 break;
02477 
02478             case (FGMENU_FOURCOLTRANSP):
02479                 if ( AttrFillGeometry::FillSelectionCount() > 0 )
02480                     Status = _R(IDS_TS_CREATEFOURCOL_S);
02481                 else
02482                     Status = _R(IDS_TS_CREATEFOURCOL);
02483                 break;
02484 
02485             case (FGMENU_BITMAPTRANSP):
02486                 if ( AttrFillGeometry::FillSelectionCount() > 0 )
02487                     Status = _R(IDS_TS_CREATEBITMAP_S);
02488                 else
02489                     Status = _R(IDS_TS_CREATEBITMAP);
02490                 break;
02491 
02492             case (FGMENU_FRACTALTRANSP):
02493                 if ( AttrFillGeometry::FillSelectionCount() > 0 )
02494                     Status = _R(IDS_TS_CREATEFRACTAL_S);
02495                 else
02496                     Status = _R(IDS_TS_CREATEFRACTAL);
02497                 break;
02498             
02499             case (FGMENU_NOISETRANSP):
02500                 if ( AttrFillGeometry::FillSelectionCount() > 0 )
02501                     Status = _R(IDS_TS_CREATENOISE_S);
02502                 else
02503                     Status = _R(IDS_TS_CREATENOISE);
02504                 break;
02505 
02506             default:
02507                 // Er .. Dunno what kind of fill this is ?
02508                 Status = _R(IDS_TS_CREATELINEAR);
02509                 break;
02510         }
02511     }
02512 
02513     if (pStatus != NULL)
02514     {
02515         pStatus->Load(Status);
02516         LastStatusID = Status;
02517     }
02518 
02519     if (pCursor != NULL)
02520         *pCursor = pNewCursor;
02521 }

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

Reimplemented from Tool_v1.

Definition at line 369 of file filltool.h.

00369 { return TOOLID_TRANSP; };

BOOL TranspTool::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 2366 of file filltool.cpp.

02368 {
02369     ERROR3IF(ptext==NULL,"TranspTool::GetStatusLineText() - ptext passed as null");
02370 
02371     if (ClickMods.Adjust)
02372         TempGeometryIndex = FGMENU_CIRCULARTRANSP;
02373     else
02374         TempGeometryIndex = -1;
02375 
02376     GetCursorAndStatus(DocPos, pSpread, NULL, ptext);
02377 
02378     return TRUE;
02379 }

BOOL TranspTool::Init void   )  [virtual]
 

Used to check if the Tool was properly constructed.

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

Reimplemented from Tool_v1.

Definition at line 1599 of file filltool.cpp.

01600 {
01601     BOOL ok = TRUE;
01602 
01603     ok = OpChangeTranspFillProfile::Declare();
01604 
01605 #if 0
01606     if (ok)
01607     {
01608         CCResTextFile       file;               // Resource File
01609         TranspInfoBarOpCreate BarCreate;        // Object that creates TranspInfoBarOp objects
01610 
01611                 ok = file.open(_R(IDM_TRANSP_BAR), _R(IDT_INFO_BAR_RES));       // Open resource
01612         if (ok) ok = DialogBarOp::ReadBarsFromFile(file,BarCreate); // Read and create info bar
01613         if (ok) file.close();                                       // Close resource
01614 
01615         ENSURE(ok,"Unable to load transbar.ini from resource\n"); 
01616 
01617         // Info bar now exists.  Now get a pointer to it
01618         String_32 str = String_32(_R(IDS_FILLTOOL_TRANINFOBARNAME));
01619         DialogBarOp* pDialogBarOp = DialogBarOp::FindDialogBarOp(str);
01620 
01621     }
01622 #endif
01623     if (ok)
01624     {
01625         pTranspInfoBarOp = new TranspInfoBarOp(_R(IDD_TRANFILLDLG));
01626 
01627         if (pTranspInfoBarOp)
01628         {
01629             // Set our default menu items
01630             pTranspInfoBarOp->CurrentGeometryIndex = FGMENU_LINEARTRANSP;
01631             pTranspInfoBarOp->CurrentMappingIndex = FMMENU_SIMPLE;
01632             pTranspInfoBarOp->CurrentTypeIndex = FTMENU_REFLECT;
01633         } else
01634             ok=FALSE;
01635 
01636         ENSURE(ok,"Unable to load transbar.ini from resource\n"); 
01637 
01638     }
01639 
01640     return (ok);
01641 }

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

Definition at line 380 of file filltool.h.

00380 { return CurrentTool; }

BOOL TranspTool::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 2345 of file filltool.cpp.

02346 {
02347     return NudgeFills;
02348 }

void TranspTool::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 Note: WEBSTER-Martin-22/11/96 disallow editting and creation of transparency types we don't want Webster to have.

Reimplemented from DragTool.

Definition at line 1846 of file filltool.cpp.

01848 {
01849     if (ClickMods.Menu) return;                         // Don't do anything if the user clicked the Menu button
01850 
01851     // See if there is already a drag going on
01852     if (Operation::GetCurrentDragOp()!=NULL)
01853         return;
01854 
01855     if ( AttrFillGeometry::CheckAttrClick(PointerPos, Click, ClickMods, pSpread) )
01856     {   
01857         return;     // An Attribute claimed the click
01858     }
01859 
01860     // Make sure this click is one that we want
01861     if ( Click == CLICKTYPE_SINGLE )
01862     {
01863         StartPos = PointerPos;
01864         StartSpread = pSpread;
01865         DoubleClicked = FALSE;
01866     }
01867 
01868     // Make sure this click is one that we want
01869     if ( Click == CLICKTYPE_UP )
01870     {
01871         StartPos = DocCoord(0,0);
01872         StartSpread = NULL;
01873         DoubleClicked = FALSE;
01874     }
01875 
01876     if ( Click == CLICKTYPE_DOUBLE )
01877     {
01878         DoubleClicked = TRUE;       
01879     }
01880 
01881     if ( Click == CLICKTYPE_DRAG )
01882     {
01883         // is there a shadow node in the selection ? if so, don't start a drag
01884         // DMc - check for nodes which transparency can't be applied to
01885         BOOL allowed = TRUE;
01886 
01887         Range Sel(*(GetApplication()->FindSelection()));
01888 
01889         INT32 Count = Sel.Count();
01890         INT32 ShadCount = 0;
01891 
01892         Node * pNode = Sel.FindFirst(FALSE);
01893         
01894         while (pNode)
01895         {
01896             if (pNode->IsKindOf(CC_RUNTIME_CLASS(NodeShadow)))
01897             {
01898                 allowed = FALSE;
01899                 ((NodeShadow*)pNode)->DeSelect(TRUE);
01900                 ShadCount ++;
01901             }
01902 
01903             pNode = Sel.FindNext(pNode, FALSE);
01904         }
01905 
01906         if (!allowed && Count == ShadCount)
01907         {
01908             return;
01909         }
01910 
01911         if (!allowed)
01912         {
01913             GetApplication()->UpdateSelection();
01914         }
01915 
01916         if (StartSpread == NULL)
01917             return;
01918 
01919         // Just what we wanted - Someone is dragging the mouse about
01920         // We need to make an operation to perform the drag with
01921 //      OpCreateFill* pOp = new OpCreateFill;
01922         OpEditFill* pOp = new OpEditFill;
01923         if (pOp == NULL)
01924         {
01925             // Inform the person doing the clicking that life is not looking so good
01926             InformError();
01927         }
01928         else
01929         {
01930             AttrFillGeometry* Fill = NULL;
01931             // Start the drag operation and pass in the Anchor Point to the push operation
01932 
01933             if (ClickMods.Adjust)
01934             {
01935                 Fill = new AttrRadialTranspFill;
01936                 if (Fill != NULL)
01937                     ((AttrRadialFill*)Fill)->MakeCircular();
01938             }
01939 #ifndef WEBSTER
01940             else if (DoubleClicked)
01941             {
01942                 //this could never be executed anyway even in Camelot - MAB 20/03/97
01943                 Fill = new AttrConicalTranspFill;
01944             }
01945 #endif //WEBSTER
01946             else
01947             {
01948                 switch (pTranspInfoBarOp->CurrentGeometryIndex)
01949                 {
01950                     case (FGMENU_NOTRANSP):
01951                         Fill = new AttrLinearTranspFill;
01952                         break;
01953 
01954                     case (FGMENU_FLATTRANSP):
01955                         Fill = new AttrLinearTranspFill;
01956                         break;
01957 
01958                     case (FGMENU_LINEARTRANSP):
01959                         Fill = new AttrLinearTranspFill;
01960                         break;
01961 
01962                     case (FGMENU_CIRCULARTRANSP):
01963                         Fill = new AttrRadialTranspFill;
01964                         if (Fill != NULL)
01965                             ((AttrRadialFill*)Fill)->MakeCircular();
01966                         break;
01967 
01968                     case (FGMENU_RADIALTRANSP):
01969                         Fill = new AttrRadialTranspFill;
01970                         break;
01971 
01972                     case (FGMENU_CONICALTRANSP):
01973                         Fill = new AttrConicalTranspFill;
01974                         break;
01975 
01976                     case (FGMENU_SQUARETRANSP):
01977                         Fill = new AttrSquareTranspFill;
01978                         break;
01979 
01980                     case (FGMENU_THREECOLTRANSP):
01981                         Fill = new AttrThreeColTranspFill;
01982                         break;
01983 
01984                     case (FGMENU_FOURCOLTRANSP):
01985                         Fill = new AttrFourColTranspFill;
01986                         break;
01987 
01988                     case (FGMENU_BITMAPTRANSP):
01989                     {
01990                         Fill = new AttrBitmapTranspFill;
01991 
01992                         KernelBitmap* Default = NULL;
01993                         Default = KernelBitmap::MakeKernelBitmap();
01994                         if (Default == NULL)
01995                         {
01996                             InformError();
01997                             delete Fill;
01998                             return;
01999                         }
02000 
02001                         Fill->AttachBitmap(Default);
02002                         Fill->SetTesselation(pTranspInfoBarOp->CurrentMappingIndex+1);
02003                         break;
02004                     }
02005 
02006                     case (FGMENU_FRACTALTRANSP):
02007                         Fill = new AttrFractalTranspFill;
02008                         Fill->SetTesselation(pTranspInfoBarOp->CurrentMappingIndex+1);
02009                         break;
02010 
02011                     case (FGMENU_NOISETRANSP):
02012                         Fill = new AttrNoiseTranspFill;
02013                         Fill->SetTesselation(pTranspInfoBarOp->CurrentMappingIndex+1);
02014                         break;
02015 
02016                     default:
02017                         // Er .. Dunno what kind of fill this is ?
02018                         Fill = new AttrLinearTranspFill;
02019                         break;
02020                 }
02021             }
02022             
02023             if (Fill == NULL)
02024             {
02025                 InformError();
02026                 delete pOp;
02027                 return;
02028             }
02029 
02030             Fill->SetTranspType(pTranspInfoBarOp->GetTranspType());
02031 
02032 //          pOp->DoDrag(Fill, StartSpread, StartPos);
02033             pOp->DoCreate(StartPos, StartSpread, Fill);
02034         }
02035 
02036         StartPos = DocCoord(0,0);
02037         StartSpread = NULL;
02038         DoubleClicked = FALSE;
02039         return;
02040     }
02041 
02042     // call the base class ....
02043 
02044     DragTool::OnClick (PointerPos, Click, ClickMods, pSpread);
02045 }

BOOL TranspTool::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 2099 of file filltool.cpp.

02100 {
02101     if (pKeyPress->GetVirtKey() == CAMKEY(TAB) &&
02102         !pKeyPress->IsRelease() &&
02103         !pKeyPress->IsRepeat())
02104     {
02105         // Toggle the selection state of all visible fill control points
02106         ToggleControlPoints(pKeyPress->IsAdjust());
02107 
02108         return TRUE;
02109     }
02110 
02111     if ( IsFillNudgeEnabled() &&
02112         (pKeyPress->GetVirtKey() == CAMKEY(UP) ||
02113          pKeyPress->GetVirtKey() == CAMKEY(DOWN) ||
02114          pKeyPress->GetVirtKey() == CAMKEY(LEFT) ||
02115          pKeyPress->GetVirtKey() == CAMKEY(RIGHT)) )
02116     {
02117         // If we are nudging, then stop the Attribute manager from sending
02118         // tons of messages, until the nudge stops.
02119         if (pKeyPress->IsRelease())
02120             AttributeManager::SendMessages = TRUE;
02121         else
02122             AttributeManager::SendMessages = FALSE;
02123 
02124         // Pass on the nudge keys
02125         return FALSE;
02126     }
02127     return FALSE;
02128 }

void TranspTool::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 2060 of file filltool.cpp.

02061 {
02062     // Setup defaults
02063     Cursor* pCursor = pTranspCursor;
02064     String_256 Status;
02065 
02066     if (ClickMods.Adjust)
02067         TempGeometryIndex = FGMENU_CIRCULARTRANSP;
02068     else
02069         TempGeometryIndex = -1;
02070 
02071     GetCursorAndStatus(Pos, pSpread, &pCursor, &Status);
02072 
02073     if (pCursor != pCurrentCursor)
02074     {
02075         // We're using the wrong shape!! 
02076         pCurrentCursor = pCursor;
02077         CursorStack::GSetTop(pCurrentCursor, CurrentCursorID);
02078     }
02079         
02080     // Display the status text
02081     GetApplication()->UpdateStatusBarText(&Status);
02082 }

void TranspTool::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 1698 of file filltool.cpp.

01699 {
01700     if (isSelected)
01701     {
01702         // This tool has just been selected.  Create an appropriate cursor, in this case
01703         // we can use the operating system-provided crosshair cursor.
01704         pTranspCursor  = new Cursor(this, _R(IDC_TRANSPTOOLCURSOR));
01705         pTranspPointCursor = new Cursor(this, _R(IDC_TRANSPPOINTCURSOR));
01706 
01707         // Did the cursor create ok ?
01708         if (!pTranspCursor || !pTranspCursor->IsValid())
01709         {
01710             return;
01711         }
01712 
01713         // Did the cursor create ok ?
01714         if (!pTranspPointCursor || !pTranspPointCursor->IsValid())
01715         {
01716             return;
01717         }
01718 
01719         pCurrentCursor = pTranspCursor;
01720         CurrentCursorID = CursorStack::GPush(pTranspCursor, FALSE); // Push cursor, but don't display now
01721 
01722         // Create and display the tool's info bar
01723         CurrentTool = FALSE;
01724         AttrFillGeometry::SetTranspMeshesVisible(FALSE);
01725 
01726         BlobManager* BlobMgr = GetApplication()->GetBlobManager();
01727 
01728         BlobStyle MyBlobs = BlobMgr->GetCurrentInterest();
01729         if (MyBlobs.Fill)
01730         {
01731             MyBlobs.Fill = FALSE;
01732             MyBlobs.Effect = FALSE;
01733             BlobMgr->ToolInterest(MyBlobs);
01734         }
01735 
01736         CurrentTool = TRUE;
01737         AttrFillGeometry::SetTranspMeshesVisible(TRUE);
01738 
01739         SelRange *Selected = GetApplication()->FindSelection();
01740 
01741         BlobStyle ToolBlobs;
01742         ToolBlobs.Fill = TRUE;
01743         ToolBlobs.Tiny = TRUE;
01744         ToolBlobs.Effect = TRUE;
01745         BlobMgr->ToolInterest(ToolBlobs);
01746 
01747         // Re-Count the number of selected fill control points
01748         AttrFillGeometry::SetSelectionCount(AttrFillGeometry::CountSelectionControlPoints());
01749 
01750         pTranspInfoBarOp->Create();
01751 
01752         if (AttrFillGeometry::SelectionCount > 0)
01753             EnableFillNudge();
01754 
01755         TempGeometryIndex = -1;
01756 
01757         // There is a selection if there is a document, and it has some selected object(s)
01758         IsSelection = (Document::GetCurrent() != NULL && Selected->Count() > 0);
01759 
01760         if (IsSelection)
01761         {
01762             SelectionBox  = Selected->GetBoundingRect();
01763 
01764             Node* Current = Selected->FindFirst();
01765             if (Current != NULL)
01766             {
01767                 Spread *pSpread = Current->FindParentSpread();
01768                 RenderToolBlobs(pSpread, NULL);
01769             }
01770         }
01771     }
01772     else
01773     {
01774         DisableFillNudge();
01775 
01776         // Deselection - destroy the tool's cursor, if there is one.
01777         if (pTranspCursor)
01778         {
01779             CursorStack::GPop(CurrentCursorID);
01780             delete pTranspCursor;
01781             delete pTranspPointCursor;
01782 
01783             pCurrentCursor = NULL;
01784             CurrentCursorID = 0;
01785         }
01786 
01787         pTranspInfoBarOp->CloseProfileDialog(pTranspInfoBarOp->m_BiasGainGadget);
01788         
01789         pTranspInfoBarOp->Delete();
01790 
01791         CurrentTool = TRUE;
01792         AttrFillGeometry::SetTranspMeshesVisible(TRUE);
01793 
01794         BlobManager* BlobMgr = GetApplication()->GetBlobManager();
01795 
01796         BlobStyle MyBlobs = BlobMgr->GetCurrentInterest();
01797         MyBlobs.Fill = FALSE;
01798         MyBlobs.Effect = FALSE;
01799         BlobMgr->ToolInterest(MyBlobs);
01800 
01801         CurrentTool = FALSE;
01802         AttrFillGeometry::SetTranspMeshesVisible(FALSE);
01803 
01804         // If needed, draw the [tool blobs? OK, who forgot to finish the comment?!]
01805         if (IsSelection && Document::GetCurrent()!=NULL)
01806         {
01807             SelRange *Selected = GetApplication()->FindSelection();
01808             Node *Current = Selected->FindFirst();
01809 
01810             if (Current!=NULL)
01811             {
01812                 Spread *pSpread = Current->FindParentSpread();
01813                 RenderToolBlobs(pSpread, NULL);
01814             }
01815         }
01816 
01817         // ensure any tool object blobs are removed.
01818         BlobStyle bsRemoves;
01819         bsRemoves.ToolObject = TRUE;
01820         BlobMgr->RemoveInterest(bsRemoves);
01821     }
01822 }

void TranspTool::ToggleControlPoints BOOL  Reverse  ) 
 

Toggles the selection state of all visible fill control blobs. Notes: Changed by Gerry (8/96) to use new CycleSelection call.

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

Definition at line 2142 of file filltool.cpp.

02143 {
02144     // Switch control points
02145     AttrFillGeometry::LastRenderedStartBlob = DocCoord(0,0);
02146     AttrFillGeometry::LastRenderedEndBlob = DocCoord(0,0);
02147     AttrFillGeometry::LastRenderedEnd2Blob = DocCoord(0,0);
02148     AttrFillGeometry::LastRenderedEnd3Blob = DocCoord(0,0);
02149 
02150     AttrFillGeometry* pAttrNode = AttrFillGeometry::FindFirstSelectedAttr(CC_RUNTIME_CLASS(AttrTranspFillGeometry));
02151 
02152     // Return if there aren't any
02153     if (pAttrNode == NULL)
02154         return;
02155 
02156     // We only toggle if there are some points selected
02157     BOOL DoToggle = AttrFillGeometry::FillSelectionCount() > 0;
02158 
02159     while (pAttrNode != NULL)
02160     {
02161         if (pAttrNode->IsATranspFill())
02162         {
02163             if (DoToggle)
02164             {
02165                 // We're going to toggle the selected control points.
02166                 if (pAttrNode->GetSelectionCount() > 0)
02167                 {
02168                     pAttrNode->CycleSelection(Reverse);
02169                 }
02170             }
02171             else
02172             {
02173                 // There were no points selected, so we'll just
02174                 // select all the start points.
02175                 pAttrNode->SelectBlob(FILLCONTROL_STARTPOINT);
02176             }
02177         }
02178 
02179         // Check the next fill
02180         pAttrNode = AttrFillGeometry::FindNextSelectedAttr(CC_RUNTIME_CLASS(AttrTranspFillGeometry));
02181     }
02182 
02183     BROADCAST_TO_ALL(SelChangingMsg(SelChangingMsg::COLOURATTCHANGED)); 
02184 }


Member Data Documentation

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

Reimplemented from DragTool.

Definition at line 392 of file filltool.h.

DocCoord TranspTool::ClickStart [private]
 

Definition at line 401 of file filltool.h.

INT32 TranspTool::CurrentCursorID [private]
 

Definition at line 416 of file filltool.h.

BOOL TranspTool::CurrentTool [static, private]
 

Definition at line 398 of file filltool.h.

BOOL TranspTool::DoubleClicked [private]
 

Definition at line 421 of file filltool.h.

AttrFillGeometry* TranspTool::EditingFill [private]
 

Definition at line 420 of file filltool.h.

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

Reimplemented from DragTool.

Definition at line 389 of file filltool.h.

BOOL TranspTool::IsSelection [private]
 

Definition at line 409 of file filltool.h.

UINT32 TranspTool::LastStatusID [static, private]
 

Definition at line 396 of file filltool.h.

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

Definition at line 424 of file filltool.h.

BOOL TranspTool::OpBusy [private]
 

Definition at line 422 of file filltool.h.

Cursor* TranspTool::pCurrentCursor [private]
 

Definition at line 412 of file filltool.h.

Cursor* TranspTool::pTranspCursor [private]
 

Definition at line 413 of file filltool.h.

TranspInfoBarOp * TranspTool::pTranspInfoBarOp [static, private]
 

Definition at line 418 of file filltool.h.

Cursor* TranspTool::pTranspPointCursor [private]
 

Definition at line 414 of file filltool.h.

TCHAR * TranspTool::Purpose = _T("Alter the transparency of objects") [static, private]
 

Reimplemented from DragTool.

Definition at line 391 of file filltool.h.

DocRect TranspTool::SelectionBox [private]
 

Definition at line 406 of file filltool.h.

DocCoord TranspTool::StartPos [private]
 

Definition at line 402 of file filltool.h.

Spread* TranspTool::StartSpread [private]
 

Definition at line 403 of file filltool.h.

TCHAR * TranspTool::ToolName = _T("Transparency Tool") [static, private]
 

Reimplemented from DragTool.

Definition at line 390 of file filltool.h.


The documentation for this class was generated from the following files:
Generated on Sat Nov 10 04:02:27 2007 for Camelot by  doxygen 1.4.4