dasher
Class CCircleStartHandler

java.lang.Object
  extended by dasher.CDasherComponent
      extended by dasher.CStartHandler
          extended by dasher.CCircleStartHandler

public class CCircleStartHandler
extends CStartHandler

Displays a circle centred around the crosshair which the user can click to start dasher.

Status flags:
-1 undefined
0 = out of circle, stopped
1 = out of circle, started
2 = in circle, stopped
3 = in circle, started
4 = in circle, stopping
5 = in circle, starting


Field Summary
protected  long m_iChangeTime
          Time (recorded as a UNIX timestamp) when the status last changed.
protected  int m_iCircleRadius
          Radius of the displayed circle in Dasher co-ordinates.
protected  int m_iScreenRadius
          Radius of the circle in screen co-ordinates.
protected  int m_iStatus
          Current status of the handler.
 
Fields inherited from class dasher.CStartHandler
m_Interface
 
Fields inherited from class dasher.CDasherComponent
m_EventHandler, m_SettingsStore
 
Constructor Summary
CCircleStartHandler(CEventHandler EventHandler, CSettingsStore SettingsStore, CDasherInterfaceBase Interface)
          Sole constructor.
 
Method Summary
 boolean DecorateView(CDasherView View)
          Draws the start handler to the passed view.
 void HandleEvent(CEvent Event)
          Responds to events:
 void Timer(long iTime, CDasherView m_DasherView, CDasherModel m_DasherModel)
          Updates the start handler's current state dependent on the current mouse position.
 
Methods inherited from class dasher.CDasherComponent
GetBoolParameter, GetLongParameter, GetParameterName, GetParameterType, GetStringParameter, InsertEvent, SetBoolParameter, SetLongParameter, SetStringParameter, UnregisterComponent
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

m_iStatus

protected int m_iStatus
Current status of the handler.


m_iChangeTime

protected long m_iChangeTime
Time (recorded as a UNIX timestamp) when the status last changed.


m_iCircleRadius

protected int m_iCircleRadius
Radius of the displayed circle in Dasher co-ordinates.


m_iScreenRadius

protected int m_iScreenRadius
Radius of the circle in screen co-ordinates.

Constructor Detail

CCircleStartHandler

public CCircleStartHandler(CEventHandler EventHandler,
                           CSettingsStore SettingsStore,
                           CDasherInterfaceBase Interface)
Sole constructor. Creates a start handler in its default start state. Calculates the intial circle radius using LP_CIRCLE_PERCENT and LP_MAX_X.

Parameters:
EventHandler -
SettingsStore -
Interface -
Method Detail

DecorateView

public boolean DecorateView(CDasherView View)
Draws the start handler to the passed view.

Specified by:
DecorateView in class CStartHandler
Parameters:
View - DasherView upon which to run drawing commands.
Returns:
True, to indicate that something has been drawn.

Timer

public void Timer(long iTime,
                  CDasherView m_DasherView,
                  CDasherModel m_DasherModel)
Updates the start handler's current state dependent on the current mouse position.

In a nutshell, it determines whether the mouse is within the circle, and if so, instructs Dasher to start or stop dependent on its current state and how long the user has hovered over the circle.

Specifically, we start and stop if the user has hovered for over 1 second.

Specified by:
Timer in class CStartHandler
Parameters:
iTime - Current system time, as a UNIX time stamp.
m_DasherView - View against which co-ordinate transforms should be performed.
m_DasherModel - Model to which commands should be passed.

HandleEvent

public void HandleEvent(CEvent Event)
Responds to events:

BP_DASHER_PAUSED changes: Updates start handler state so that we don't try to stop when already stopped, etc.

Specified by:
HandleEvent in class CStartHandler
Parameters:
Event - Event received.
See Also:
CEventHandler