Class: Reight::SoundEditor::Tool

Inherits:
Button
  • Object
show all
Defined in:
lib/reight/app/sound/tool.rb

Direct Known Subclasses

Brush, Eraser

Instance Attribute Summary collapse

Attributes inherited from Button

#icon, #label

Instance Method Summary collapse

Methods inherited from Button

#click, #disabled?, #disabled_icon, #draw, #enabled?, #hover, #pressed, #pressing?, #released, #sprite

Methods included from HasHelp

#help, #set_help

Methods included from Hookable

#hook

Methods included from Activatable

#activated, #activated!, #active=, #active?

Constructor Details

#initialize(app, *a, **k, &b) ⇒ Tool

Returns a new instance of Tool.



6
7
8
9
# File 'lib/reight/app/sound/tool.rb', line 6

def initialize(app, *a, **k, &b)
  super(*a, **k, &b)
  @app = app
end

Instance Attribute Details

#appObject (readonly)

Returns the value of attribute app.



11
12
13
# File 'lib/reight/app/sound/tool.rb', line 11

def app
  @app
end

Instance Method Details

#canvasObject



13
# File 'lib/reight/app/sound/tool.rb', line 13

def canvas  = app.canvas

#canvas_clicked(x, y, button) ⇒ Object



27
# File 'lib/reight/app/sound/tool.rb', line 27

def canvas_clicked( x, y, button) = nil

#canvas_dragged(x, y, button) ⇒ Object



26
# File 'lib/reight/app/sound/tool.rb', line 26

def canvas_dragged( x, y, button) = nil

#canvas_moved(x, y) ⇒ Object



25
# File 'lib/reight/app/sound/tool.rb', line 25

def canvas_moved(   x, y)         = nil

#canvas_pressed(x, y, button) ⇒ Object



23
# File 'lib/reight/app/sound/tool.rb', line 23

def canvas_pressed( x, y, button) = nil

#canvas_released(x, y, button) ⇒ Object



24
# File 'lib/reight/app/sound/tool.rb', line 24

def canvas_released(x, y, button) = nil

#historyObject



15
# File 'lib/reight/app/sound/tool.rb', line 15

def history = app.history

#nameObject



17
# File 'lib/reight/app/sound/tool.rb', line 17

def name = self.class.name.split('::').last

#pick_tone(x, y) ⇒ Object



19
20
21
# File 'lib/reight/app/sound/tool.rb', line 19

def pick_tone(x, y)
  canvas.tone = canvas.tone_at x, y
end