module Rabbit::Renderer::Display::Graffiti
Public Class Methods
new(*args, &block)
click to toggle source
Calls superclass method
# File lib/rabbit/renderer/display/graffiti.rb, line 18 def initialize(*args, &block) super init_graffiti end
Public Instance Methods
attach_to(window, container=nil)
click to toggle source
Calls superclass method
# File lib/rabbit/renderer/display/graffiti.rb, line 23 def attach_to(window, container=nil) super graffiti_mode_action.active = false end
can_undo_graffiti?()
click to toggle source
# File lib/rabbit/renderer/display/graffiti.rb, line 36 def can_undo_graffiti? @graffiti.can_undo? end
change_graffiti_color()
click to toggle source
# File lib/rabbit/renderer/display/graffiti.rb, line 61 def change_graffiti_color @graffiti.change_color do redraw end end
clear_graffiti()
click to toggle source
# File lib/rabbit/renderer/display/graffiti.rb, line 49 def clear_graffiti @graffiti.clear Action.update_graffiti_action_status(@canvas) @area.queue_draw end
graffiti_mode?()
click to toggle source
# File lib/rabbit/renderer/display/graffiti.rb, line 28 def graffiti_mode? graffiti_mode_action.active? end
have_graffiti?()
click to toggle source
# File lib/rabbit/renderer/display/graffiti.rb, line 32 def have_graffiti? @graffiti.have_graffiti? end
toggle_graffiti_mode()
click to toggle source
# File lib/rabbit/renderer/display/graffiti.rb, line 40 def toggle_graffiti_mode if graffiti_mode? update_cursor(:pencil) else restore_cursor(nil) end update_menu end
undo_graffiti()
click to toggle source
# File lib/rabbit/renderer/display/graffiti.rb, line 55 def undo_graffiti @graffiti.undo Action.update_graffiti_action_status(@canvas) @area.queue_draw end
Private Instance Methods
draw_graffiti()
click to toggle source
# File lib/rabbit/renderer/display/graffiti.rb, line 108 def draw_graffiti @graffiti.draw_all_segment(self) end
graffiti_mode_action()
click to toggle source
# File lib/rabbit/renderer/display/graffiti.rb, line 112 def graffiti_mode_action @canvas.action("ToggleGraffitiMode") end
init_graffiti()
click to toggle source
# File lib/rabbit/renderer/display/graffiti.rb, line 68 def init_graffiti @graffiti = Rabbit::Graffiti::Processor.new pressed_button = nil target_button = 1 add_button_press_hook do |event| pressed_button = event.button if graffiti_mode? and event.button == target_button @graffiti.button_press(event.x, event.y, width, height) true else false end end add_button_release_hook do |event, last_button_press_event| pressed_button = nil if graffiti_mode? and event.button == target_button @graffiti.button_release(event.x, event.y, width, height) Action.update_graffiti_action_status(@canvas) true else false end end add_motion_notify_hook do |event| if graffiti_mode? and @graffiti.dragging? and pressed_button == target_button @graffiti.button_motion(event.x, event.y, width, height) redraw true else false end end end