#include <tool.h>
Inheritance diagram for Tool_v1:
Public Member Functions | |
Tool_v1 () | |
virtual | ~Tool_v1 () |
Destroys the tool, performing any clean-up necessary. | |
virtual BOOL | Init () |
Called after tool's constructor to ask it whether it wants to exist or not. Each tool is asked in two passes, so that its existence can depend on another tool. If a tool does not want to exist, it should return FALSE, when it will be deleted. | |
virtual UINT32 | GetToolInterfaceVersion () |
virtual UINT32 | GetID () |
virtual void | Describe (void *Info) |
Asks a tool for more information. The pointer points to a struct such as ToolInfo_v1 which the tool should fill in. All fields should be filled (NULL is OK for char* variables). The type of the pointer is not explicitly defined so the structure can evolve while keeping backward compatibility. | |
virtual void | OnMouseMove (DocCoord, Spread *, ClickModifiers) |
This function should be overridden by any tool that wants to receive mouse move messages, when a drag is NOT in progress. For example, tools can use this function to change the mouse cursor as it moves over a "hot spot". The default implementation does nothing. | |
virtual void | OnClick (DocCoord, ClickType, ClickModifiers, Spread *) |
This function should be overridden by any tool that wants to receive clicks on the document. When DocView receives a click event from the OIL layer it finds the current tool and calls this function. | |
virtual BOOL | OnKeyPress (KeyPress *pKeyPress) |
This function should be overridden by any tool that wants to process key presses. The current tool is the first part of Camelot that gets the chance to process a key press, so tools can override all tool-switching and hot-key combinations if it needs to. | |
virtual BOOL | OnIdle () |
This function should be overridden by any tool that wants to do processing on idle events. This processing should be quick (or split into small, quick bits). Once processing is finished FALSE should be returned (although this does not guarentee then function will not be called again). | |
virtual BOOL | GetStatusLineText (String_256 *ptext, Spread *pSpread, DocCoord DocPos, ClickModifiers ClickMods) |
Each tool should override this function to return valid status line text. | |
virtual BOOL | RegisterToolSwitch (KeyPress *pKeyPress, BOOL FromFile=FALSE) |
This allows you to specify a key press that will be used to switch to the tool temporarily. The pKeyPress should be a valid one created by one of its public constructors. | |
virtual BOOL | DragFinished (DragEndType HowEnded) |
Tools that start drag operations can use this function to find out how well the drag went if the operation calls this function. | |
virtual void | RenderToolBlobs (Spread *, DocRect *) |
This function is called in the main drawing loop to get the tool to render its blobs (ie the centre of rotation for the rotation tool). Since this is the base class version of this function and will be called if the tool does not provide its own RenderToolBlobs function, then it can be assumed that the tool does not need to draw anything, so it does nothing. | |
virtual void | SelectChange (BOOL IsSelected) |
Used to inform a tool that it is being selected or deselected. Default behaviour is to do nothing. A real tool should update the infobar when the tool is selected - this is usually all a tool will do. | |
virtual void | GetRulerOrigin (Spread *pSpread, UserCoord *) |
Gives the current tool the chance to change the coordinates displayed on the ruler. | |
virtual void | RenderRulerBlobs (RulerBase *pRuler, UserRect &UpdateRect, BOOL IsBackground) |
Gives the current tool the chance to render additional blobs on the ruler Is called twice - once before the standard ruler graphics are rendered (to allow additional background to be drawn) and once afterwards. | |
virtual BOOL | GetRulerStatusLineText (String_256 *pText, UserCoord PointerPos, Spread *pSpread, RulerBase *pRuler) |
virtual BOOL | OnRulerClick (UserCoord PointerPos, ClickType Click, ClickModifiers Mods, Spread *pSpread, RulerBase *pRuler) |
BOOL | IsCurrent () const |
Centralised way of doing this. Amazing this function didn't exist before. | |
virtual BOOL | AreToolBlobsRenderedOnSelection () |
Static Public Member Functions | |
static UINT32 | GetOwnerModule (UINT32) |
static BOOL | SetOwnerModule (UINT32, UINT32) |
Public Attributes | |
ToolListItem * | Parent |
Static Protected Attributes | |
static UINT32 | OwnerModuleList [TOOLID_MAX+1] |
Private Member Functions | |
CC_DECLARE_MEMDUMP (Tool_v1) |
Definition at line 310 of file tool.h.
|
Definition at line 316 of file tool.h.
|
|
Destroys the tool, performing any clean-up necessary.
Definition at line 1213 of file tool.cpp.
|
|
Reimplemented in ContourTool, SelectorTool, SliceTool, and TextTool. Definition at line 392 of file tool.h. 00392 {return FALSE;}
|
|
|
|
Asks a tool for more information. The pointer points to a struct such as ToolInfo_v1 which the tool should fill in. All fields should be filled (NULL is OK for char* variables). The type of the pointer is not explicitly defined so the structure can evolve while keeping backward compatibility.
Reimplemented in BezierTool, BlendTool, BlankTool, ContourTool, EllipseTool, GradFillTool, TranspTool, FreeHandTool, GridTool, LiveEffectsTool, MouldTool, PenTool, PushTool, RectangleTool, QuickShapeTool, RotateTool, SelectorTool, SliceTool, TextTool, and ZoomTool. Definition at line 1237 of file tool.cpp. 01238 { 01239 ENSURE(FALSE, "Describe called for base tool class!"); 01240 01241 // Cast structure into the latest one we understand. 01242 ToolInfo_v1 *Info = (ToolInfo_v1 *) InfoPtr; 01243 01244 Info->InfoVersion = 1; 01245 01246 Info->InterfaceVersion = GetToolInterfaceVersion(); // You should always have this line. 01247 01248 // These are all garbage as we should never try to create one of these... 01249 Info->Version = 1; 01250 Info->ID = TOOLID_INVALID; 01251 Info->TextID = 0; 01252 01253 // so we never get instantiated 01254 Info->Family = Info->Name = Info->Purpose = Info->Author = NULL; 01255 }
|
|
Tools that start drag operations can use this function to find out how well the drag went if the operation calls this function.
Reimplemented in SelectorTool, and SliceTool. Definition at line 1462 of file tool.cpp. 01463 { 01464 // Do nothing in the base class version of this function. 01465 // Just let the operation get on with what it was doing 01466 return TRUE; 01467 }
|
|
Reimplemented in BezierTool, BlendTool, BlankTool, ContourTool, EllipseTool, GradFillTool, TranspTool, FreeHandTool, GridTool, LiveEffectsTool, MouldTool, PenTool, PushTool, RectangleTool, QuickShapeTool, RotateTool, SelectorTool, SliceTool, TextTool, and ZoomTool. Definition at line 327 of file tool.h.
|
|
|
|
Gives the current tool the chance to change the coordinates displayed on the ruler.
Reimplemented in TextTool. Definition at line 1543 of file tool.cpp. 01544 { 01545 // Override me if you want! 01546 // Note that overriding this function implies that you will ensure the redraw of the rulers 01547 // as you enter and leave your tool. 01548 }
|
|
Reimplemented in TextTool. Definition at line 1589 of file tool.cpp. 01591 { 01592 // Override me if you want! 01593 return FALSE; 01594 }
|
|
Each tool should override this function to return valid status line text.
Reimplemented in BezierTool, BlendTool, BlankTool, ContourTool, GradFillTool, TranspTool, FreeHandTool, LiveEffectsTool, MouldTool, PenTool, PushTool, QuickShapeBase, SelectorTool, SliceTool, TextTool, and ZoomTool. Definition at line 1372 of file tool.cpp. 01373 { 01374 return FALSE; // defaults to no text 01375 }
|
|
Definition at line 324 of file tool.h.
|
|
Called after tool's constructor to ask it whether it wants to exist or not. Each tool is asked in two passes, so that its existence can depend on another tool. If a tool does not want to exist, it should return FALSE, when it will be deleted.
Reimplemented in BezierTool, BlendTool, BlankTool, ContourTool, EllipseTool, GradFillTool, TranspTool, FreeHandTool, GridTool, LiveEffectsTool, MouldTool, PenTool, PushTool, RectangleTool, QuickShapeBase, QuickShapeTool, RotateTool, SelectorTool, SliceTool, TextTool, and ZoomTool. Definition at line 1190 of file tool.cpp. 01191 { 01192 ENSURE(FALSE, "Init called for base tool class!"); 01193 return FALSE; // Should never try to instantiate a tool base class 01194 }
|
|
Centralised way of doing this. Amazing this function didn't exist before.
Definition at line 1480 of file tool.cpp. 01481 { 01482 if (Tool::GetCurrent() == this) 01483 return TRUE; 01484 else 01485 return FALSE; 01486 }
|
|
This function should be overridden by any tool that wants to receive clicks on the document. When DocView receives a click event from the OIL layer it finds the current tool and calls this function.
Reimplemented in BezierTool, BlendTool, BlankTool, ContourTool, DragTool, GradFillTool, TranspTool, FreeHandTool, GridTool, LiveEffectsTool, MouldTool, PenTool, PushTool, QuickShapeBase, RotateTool, SelectorTool, SliceTool, TextTool, and ZoomTool. Definition at line 1279 of file tool.cpp. 01281 { 01282 ENSURE(FALSE, "OnClick called for base tool class!"); 01283 01284 // DO nothing! 01285 // Click not handled by base class! 01286 }
|
|
This function should be overridden by any tool that wants to do processing on idle events. This processing should be quick (or split into small, quick bits). Once processing is finished FALSE should be returned (although this does not guarentee then function will not be called again).
Reimplemented in FreeHandTool, LiveEffectsTool, SelectorTool, and TextTool. Definition at line 1357 of file tool.cpp. 01358 { 01359 // Return FALSE to turn off 01360 return FALSE; 01361 }
|
|
This function should be overridden by any tool that wants to process key presses. The current tool is the first part of Camelot that gets the chance to process a key press, so tools can override all tool-switching and hot-key combinations if it needs to.
Reimplemented in BezierTool, BlendTool, ContourTool, GradFillTool, TranspTool, PenTool, SelectorTool, SliceTool, TextTool, and ZoomTool. Definition at line 1332 of file tool.cpp. 01333 { 01334 // Return FALSE so the key press gets passed on to others 01335 return FALSE; 01336 }
|
|
This function should be overridden by any tool that wants to receive mouse move messages, when a drag is NOT in progress. For example, tools can use this function to change the mouse cursor as it moves over a "hot spot". The default implementation does nothing.
Reimplemented in BezierTool, BlendTool, BlankTool, ContourTool, GradFillTool, TranspTool, FreeHandTool, GridTool, LiveEffectsTool, MouldTool, PenTool, PushTool, QuickShapeBase, SelectorTool, SliceTool, TextTool, and ZoomTool. Definition at line 1308 of file tool.cpp.
|
|
Reimplemented in TextTool. Definition at line 1618 of file tool.cpp. 01624 { 01625 // Override me if you want! 01626 return FALSE; 01627 }
|
|
This allows you to specify a key press that will be used to switch to the tool temporarily. The pKeyPress should be a valid one created by one of its public constructors.
The means that tool switches defined in file take priority over directly defined ones, so that in the future we may allow the user to choose which key presses he wants to temp tool switching. Also means that a tool can have temp switching codes with defs in a file; useful for third party tools who can't get hold of the bound in kernel resource file.
Definition at line 1406 of file tool.cpp. 01407 { 01408 ENSURE(pKeyPress->IsValid(),"Tool trying to register a tool key switch with an invalid key press object"); 01409 if (!pKeyPress->IsValid()) return FALSE; 01410 01411 Tool* pThisTool = (Tool*)this; 01412 01413 if (FromFile) Tool::RemoveDirectRegToolSwitches(pThisTool); 01414 01415 ToolSwitch* pToolSwitch = (ToolSwitch*)ToolSwitchList.GetHead(); 01416 while (pToolSwitch != NULL) 01417 { 01418 if (pToolSwitch->pTool == pThisTool) 01419 { 01420 // if this tool switch has already been assigned for this tool, return TRUE 01421 if (*pToolSwitch->pKeyPress == *pKeyPress) 01422 { 01423 delete pKeyPress; 01424 return TRUE; 01425 } 01426 } 01427 else 01428 { 01429 // If this tool switch belongs to another tool, return FALSE 01430 if (*pToolSwitch->pKeyPress == *pKeyPress) 01431 return FALSE; 01432 } 01433 01434 pToolSwitch = (ToolSwitch*)ToolSwitchList.GetNext(pToolSwitch); 01435 } 01436 01437 // At this point we know that it is safe to assign the tool switch key press for this tool 01438 01439 // Make a new tool switch 01440 ToolSwitch* pNewToolSwitch = new ToolSwitch(pThisTool,pKeyPress,FromFile); 01441 01442 if (pNewToolSwitch != NULL) 01443 ToolSwitchList.AddTail(pNewToolSwitch); 01444 01445 return (pNewToolSwitch != NULL); 01446 }
|
|
Gives the current tool the chance to render additional blobs on the ruler Is called twice - once before the standard ruler graphics are rendered (to allow additional background to be drawn) and once afterwards.
Reimplemented in TextTool. Definition at line 1567 of file tool.cpp. 01568 { 01569 // Override me if you want! 01570 // Note that overriding this function implies that you will ensure the redraw of the rulers 01571 // as you enter and leave your tool. 01572 }
|
|
This function is called in the main drawing loop to get the tool to render its blobs (ie the centre of rotation for the rotation tool). Since this is the base class version of this function and will be called if the tool does not provide its own RenderToolBlobs function, then it can be assumed that the tool does not need to draw anything, so it does nothing.
Reimplemented in BezierTool, BlendTool, BlankTool, ContourTool, FreeHandTool, GridTool, MouldTool, PenTool, RotateTool, SelectorTool, SliceTool, and TextTool. Definition at line 1504 of file tool.cpp. 01505 { 01506 // If the tool does not want to draw anything then it need not have a 01507 // RenderToolBlobs function and this one will be called instead. 01508 // This draws nothing 01509 }
|
|
Used to inform a tool that it is being selected or deselected. Default behaviour is to do nothing. A real tool should update the infobar when the tool is selected - this is usually all a tool will do.
Reimplemented in BezierTool, BlendTool, BlankTool, ContourTool, GradFillTool, TranspTool, FreeHandTool, GridTool, LiveEffectsTool, MouldTool, PenTool, PushTool, QuickShapeBase, RotateTool, SelectorTool, SliceTool, TextTool, and ZoomTool. Definition at line 1525 of file tool.cpp.
|
|
|
|
|
|
|