Difference between revisions of "Dev:State stroke"
m (Text replace - ']]' to '}}') |
m (moved State stroke to Dev:State stroke) |
(No difference)
|
Latest revision as of 07:37, 22 February 2010
Contents
Description
state_stroke is an 'invisible' mode - that is, you can't select it from the Toolbox. You see it on the Draw Tool and the Sketch Tool between mouse-down and mouse up, it's what's actually drawing to the canvas and taking your data.
NOTE: state_stroke does NOT handle mouse-down! This is to allow your tool to figure out if it needs to do anything different based on where the mouse is clicking, *before* state_stroke is entered!
Provides
EventStroke(stroke_data,width_data,modifier)
- EventStroke is sent to the tool that calls state_stroke as soon as the state exits, along with the stroke data. Intercept this event to do something with the data.
Internals
Events Caught
- EVENT_STOP: event_stop_handler
- EVENT_REFRESH: event_refresh_handler
- EVENT_WORKAREA_MOUSE_BUTTON_UP: event_mouse_up_handler
- EVENT_WORKAREA_MOUSE_BUTTON_DRAG: event_mouse_draw_handler
- EVENT_REFRESH_TOOL_OPTIONS event_refresh_tool_options
StateStroke_Context
State constructor
~StateStroke_Context
State destructor
Restores the previous duck view, refreshes the toolbox, and raises EventStroke on the State Machine.
event_refresh_tool_options
Intercepts the event, and nothing further.
event_stop_handler
exits the state (pop-exception)
event_refresh_handler
Intercepts the event, and nothing further.
event_mouse_up_handler=
MouseUp Handler
If this is the LMB, set 'modifier' for the destructor event from the mouse event's data, then exit the state (pop-exception)
If this is for the RMB, intercept the signal and end.
If this is for any other mouse button, pass it along.
event_mouse_draw_handler
Mouse drag event handler
If this is the LMB, accept the event, add the event's position to stroke_data, and the event's pressure to width_data, and call queue_draw (?).
If it's the RMB, accept the event to keep the context menu from appearing.
Any other button, pass the event along.