artofillusion.ui
Class EditingTool

java.lang.Object
  extended by artofillusion.ui.EditingTool
Direct Known Subclasses:
CreateCameraTool, CreateCubeTool, CreateCurveTool, CreateCylinderTool, CreateLightTool, CreatePolygonTool, CreateSphereTool, CreateSplineMeshTool, GenericTool, MeshEditingTool, MoveObjectTool, MoveScaleRotateObjectTool, MoveUVViewTool, MoveViewTool, RotateObjectTool, RotateViewTool, ScaleObjectTool, SkeletonTool

public abstract class EditingTool
extends java.lang.Object

EditingTool is the superclass of tools for editing objects or scenes. An EditingTool has an image which appears in a tool palette, allowing the tool to be selected. When selected, the editing tool responds to events in the scene or object viewer.

An EditingTool specifies what types of mouse clicks it wants to receive by the value it returns from its whichClicks() method. This should be a sum of the contants OBJECT_CLICKS (for mouse clicks on objects), HANDLE_CLICKS (for mouse clicks on handles), and ALL_CLICKS (for all mouse clicks regardless of what they are on). The exact definition of an "object" or "handle" is not specified. It is up to the ViewerCanvas generating the events to decide what constitutes an object or handle.

An EditingTool may also specify whether the current selection may be changed while that tool is active by the value it returns from its allowSelectionChanges() method. This method is always called after mousePressed(), allowing the tool to first determine what was clicked on before deciding whether to allow the selection to change in response to the click.

More precisely, here is the sequence of actions a ViewerCanvas performs when the mouse is pressed:

  1. If the active EditingTool has requested ALL_CLICKS, its mousePressed() method is invoked.
  2. The ViewerCanvas determines what was clicked on.
  3. The active EditingTool's allowSelectionChanges() method is invoked and, if it returns true, the selection is updated in response to the click.
  4. If the click was on a handle and the active EditingTool has requested HANDLE_CLICKS, its mousePressedOnHandle() method is invoked.
  5. Otherwise, if the click was on an object and the active EditingTool has requested OBJECT_CLICKS, its mousePressedOnObject() method is invoked.


Field Summary
static int ALL_CLICKS
           
static int HANDLE_CLICKS
           
static int OBJECT_CLICKS
           
 
Constructor Summary
EditingTool(EditingWindow win)
           
 
Method Summary
 void activate()
           
 boolean allowSelectionChanges()
          Get whether the selection may be changed while this tool is active.
 void deactivate()
           
 void drawOverlay(ViewerCanvas view)
          Draw any graphics that this tool overlays on top of the view.
 ToolButton getButton()
          Get the ToolButton used to represent this tool in a ToolPalette.
 java.lang.String getToolTipText()
          Get the tool tip text to display for this tool (or null if it does not have a tool tip).
 EditingWindow getWindow()
          Get the EditingWindow to which this tool belongs.
 boolean hilightSelection()
          Get whether the current selection should be hilighted when this tool is active.
 void iconDoubleClicked()
           
 boolean isEditable()
          Get whether this tool opens a configuration dialog when double-clicked.
 void keyPressed(KeyPressedEvent e, ViewerCanvas view)
           
 void mouseDragged(WidgetMouseEvent e, ViewerCanvas view)
           
 void mouseMoved(WidgetMouseEvent e, ViewerCanvas view)
           
 void mousePressed(WidgetMouseEvent e, ViewerCanvas view)
           
 void mousePressedOnHandle(WidgetMouseEvent e, ViewerCanvas view, int obj, int handle)
           
 void mousePressedOnObject(WidgetMouseEvent e, ViewerCanvas view, int obj)
           
 void mouseReleased(WidgetMouseEvent e, ViewerCanvas view)
           
 int whichClicks()
          Get what types of mouse clicks this tool wants to receive.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

ALL_CLICKS

public static final int ALL_CLICKS
See Also:
Constant Field Values

OBJECT_CLICKS

public static final int OBJECT_CLICKS
See Also:
Constant Field Values

HANDLE_CLICKS

public static final int HANDLE_CLICKS
See Also:
Constant Field Values
Constructor Detail

EditingTool

public EditingTool(EditingWindow win)
Method Detail

getWindow

public EditingWindow getWindow()
Get the EditingWindow to which this tool belongs.


getButton

public ToolButton getButton()
Get the ToolButton used to represent this tool in a ToolPalette.


getToolTipText

public java.lang.String getToolTipText()
Get the tool tip text to display for this tool (or null if it does not have a tool tip).


whichClicks

public int whichClicks()
Get what types of mouse clicks this tool wants to receive. This should be a sum of the constants ALL_CLICKS, OBJECT_CLICKS, or HANDLE_CLICKS.


allowSelectionChanges

public boolean allowSelectionChanges()
Get whether the selection may be changed while this tool is active. The default implementation returns true if whichClicks() requests either OBJECT_CLICKS or HANDLE_CLICKS.


hilightSelection

public boolean hilightSelection()
Get whether the current selection should be hilighted when this tool is active.


drawOverlay

public void drawOverlay(ViewerCanvas view)
Draw any graphics that this tool overlays on top of the view.


mousePressed

public void mousePressed(WidgetMouseEvent e,
                         ViewerCanvas view)

mousePressedOnObject

public void mousePressedOnObject(WidgetMouseEvent e,
                                 ViewerCanvas view,
                                 int obj)

mousePressedOnHandle

public void mousePressedOnHandle(WidgetMouseEvent e,
                                 ViewerCanvas view,
                                 int obj,
                                 int handle)

mouseReleased

public void mouseReleased(WidgetMouseEvent e,
                          ViewerCanvas view)

mouseDragged

public void mouseDragged(WidgetMouseEvent e,
                         ViewerCanvas view)

mouseMoved

public void mouseMoved(WidgetMouseEvent e,
                       ViewerCanvas view)

keyPressed

public void keyPressed(KeyPressedEvent e,
                       ViewerCanvas view)

activate

public void activate()

deactivate

public void deactivate()

isEditable

public boolean isEditable()
Get whether this tool opens a configuration dialog when double-clicked.


iconDoubleClicked

public void iconDoubleClicked()


Copyright © 1999-2011 by Peter Eastman.