module Rabbit::Renderer::Display::DrawingAreaBase
Public Class Methods
new(canvas)
click to toggle source
Calls superclass method
Rabbit::Renderer::Display::Magnifier::new
# File lib/rabbit/renderer/display/drawing-area-base.rb, line 34 def initialize(canvas) @caching = nil @need_reload_theme = false super end
Public Instance Methods
attach_to(window, container=nil, &block)
click to toggle source
Calls superclass method
Rabbit::Renderer::Display::Magnifier#attach_to
# File lib/rabbit/renderer/display/drawing-area-base.rb, line 203 def attach_to(window, container=nil, &block) super init_menu init_gesture_actions add_widgets_to_container(@container, &block) widget.show attach_menu(@window) attach_key(@window) end
cache_all_slides()
click to toggle source
# File lib/rabbit/renderer/display/drawing-area-base.rb, line 141 def cache_all_slides pre_cache_all_slides(@canvas.slide_size) canceled = false @canvas.slides.each_with_index do |slide, i| @canvas.change_current_index(i) do compile_slide(slide) end unless caching_all_slides(i) canceled = true break end end post_cache_all_slides(canceled) end
caching_all_slides(i)
click to toggle source
# File lib/rabbit/renderer/display/drawing-area-base.rb, line 162 def caching_all_slides(i) update_progress(i) continue = @caching_size == [width, height] && !@canvas.quitted? && !@canvas.applying? continue end
confirm(message)
click to toggle source
# File lib/rabbit/renderer/display/drawing-area-base.rb, line 180 def confirm(message) confirm_dialog(message) == Gtk::MessageDialog::RESPONSE_OK end
detach()
click to toggle source
Calls superclass method
Rabbit::Renderer::Display::DrawingAreaPrimitive#detach
# File lib/rabbit/renderer/display/drawing-area-base.rb, line 214 def detach detach_key(@window) detach_menu(@window) widget.hide unless @window.destroyed? remove_widgets_from_container(@container) end super end
draw_slide(slide, simulation, &block)
click to toggle source
Calls superclass method
# File lib/rabbit/renderer/display/drawing-area-base.rb, line 243 def draw_slide(slide, simulation, &block) super do |*args| block.call(*args) magnify {block.call(*args)} unless simulation end end
index_mode_off()
click to toggle source
Calls superclass method
Rabbit::Renderer::Display::Info#index_mode_off
# File lib/rabbit/renderer/display/drawing-area-base.rb, line 93 def index_mode_off super end
index_mode_on()
click to toggle source
Calls superclass method
Rabbit::Renderer::Display::Info#index_mode_on
# File lib/rabbit/renderer/display/drawing-area-base.rb, line 89 def index_mode_on super end
post_apply_theme()
click to toggle source
Calls superclass method
Rabbit::Renderer::Display::DrawingAreaPrimitive#post_apply_theme
# File lib/rabbit/renderer/display/drawing-area-base.rb, line 40 def post_apply_theme if @need_reload_theme @need_reload_theme = false reload_theme else super update_menu end end
post_cache_all_slides(canceled)
click to toggle source
# File lib/rabbit/renderer/display/drawing-area-base.rb, line 169 def post_cache_all_slides(canceled) end_progress @caching = false return if @canvas.quitted? if canceled reload_theme else @area.queue_draw end end
post_fullscreen()
click to toggle source
Calls superclass method
Rabbit::Renderer::Display::DrawingAreaPrimitive#post_fullscreen
# File lib/rabbit/renderer/display/drawing-area-base.rb, line 58 def post_fullscreen super update_menu end
post_iconify()
click to toggle source
Calls superclass method
Rabbit::Renderer::Display::DrawingAreaPrimitive#post_iconify
# File lib/rabbit/renderer/display/drawing-area-base.rb, line 68 def post_iconify super update_menu end
post_init_gui()
click to toggle source
# File lib/rabbit/renderer/display/drawing-area-base.rb, line 240 def post_init_gui end
post_move(old_index, index)
click to toggle source
Calls superclass method
Rabbit::Renderer::Display::Info#post_move
# File lib/rabbit/renderer/display/drawing-area-base.rb, line 50 def post_move(old_index, index) update_title reset_adjustment clear_graffiti # toggle_graffiti_mode if @graffiti_mode super end
post_parse()
click to toggle source
Calls superclass method
Rabbit::Renderer::Display::Info#post_parse
# File lib/rabbit/renderer/display/drawing-area-base.rb, line 78 def post_parse super clear_button_handler update_title update_menu if @need_reload_theme @need_reload_theme = false reload_theme end end
post_print(canceled)
click to toggle source
# File lib/rabbit/renderer/display/drawing-area-base.rb, line 119 def post_print(canceled) end_progress end
post_to_pixbuf(canceled)
click to toggle source
Calls superclass method
Rabbit::Renderer::Display::DrawingAreaPrimitive#post_to_pixbuf
# File lib/rabbit/renderer/display/drawing-area-base.rb, line 136 def post_to_pixbuf(canceled) super end_progress end
post_toggle_index_mode()
click to toggle source
Calls superclass method
Rabbit::Renderer::Display::DrawingAreaPrimitive#post_toggle_index_mode
# File lib/rabbit/renderer/display/drawing-area-base.rb, line 102 def post_toggle_index_mode @canvas.activate("ClearGraffiti") update_menu update_title super end
post_unfullscreen()
click to toggle source
Calls superclass method
Rabbit::Renderer::Display::DrawingAreaPrimitive#post_unfullscreen
# File lib/rabbit/renderer/display/drawing-area-base.rb, line 63 def post_unfullscreen super update_menu end
pre_cache_all_slides(slide_size)
click to toggle source
# File lib/rabbit/renderer/display/drawing-area-base.rb, line 156 def pre_cache_all_slides(slide_size) @caching = true @caching_size = [width, height] start_progress(slide_size) end
pre_parse()
click to toggle source
Calls superclass method
Rabbit::Renderer::Display::DrawingAreaPrimitive#pre_parse
# File lib/rabbit/renderer/display/drawing-area-base.rb, line 73 def pre_parse super update_menu end
pre_print(slide_size)
click to toggle source
# File lib/rabbit/renderer/display/drawing-area-base.rb, line 109 def pre_print(slide_size) start_progress(slide_size) end
pre_to_pixbuf(slide_size)
click to toggle source
Calls superclass method
Rabbit::Renderer::Display::DrawingAreaPrimitive#pre_to_pixbuf
# File lib/rabbit/renderer/display/drawing-area-base.rb, line 123 def pre_to_pixbuf(slide_size) super start_progress(slide_size) @pixbufing_size = [width, height] end
pre_toggle_index_mode()
click to toggle source
Calls superclass method
Rabbit::Renderer::Display::DrawingAreaPrimitive#pre_toggle_index_mode
# File lib/rabbit/renderer/display/drawing-area-base.rb, line 97 def pre_toggle_index_mode super Utils.process_pending_events end
printing(i)
click to toggle source
# File lib/rabbit/renderer/display/drawing-area-base.rb, line 113 def printing(i) update_progress(i) continue = !@canvas.quitted? continue end
reload_source(&callback)
click to toggle source
Calls superclass method
# File lib/rabbit/renderer/display/drawing-area-base.rb, line 192 def reload_source(&callback) if @canvas.need_reload_source? callback ||= Utils.process_pending_events_proc begin super(callback) rescue @canvas.logger.error($!) end end end
reload_theme(&callback)
click to toggle source
Calls superclass method
Rabbit::Renderer::Display::DrawingAreaPrimitive#reload_theme
# File lib/rabbit/renderer/display/drawing-area-base.rb, line 184 def reload_theme(&callback) if @canvas.applying? @need_reload_theme = true else super end end
reset_adjustment()
click to toggle source
Calls superclass method
# File lib/rabbit/renderer/display/drawing-area-base.rb, line 235 def reset_adjustment super @area.queue_draw end
to_pixbufing(i)
click to toggle source
Calls superclass method
Rabbit::Renderer::Display::DrawingAreaPrimitive#to_pixbufing
# File lib/rabbit/renderer/display/drawing-area-base.rb, line 129 def to_pixbufing(i) update_progress(i) continue = @pixbufing_size == [width, height] && !@canvas.quitted? && !@canvas.applying? super or continue end
toggle_blackout()
click to toggle source
Calls superclass method
# File lib/rabbit/renderer/display/drawing-area-base.rb, line 230 def toggle_blackout super @area.queue_draw end
toggle_whiteout()
click to toggle source
Calls superclass method
# File lib/rabbit/renderer/display/drawing-area-base.rb, line 225 def toggle_whiteout super @area.queue_draw end
Private Instance Methods
add_widgets_to_container(container) { |container, hbox| ... }
click to toggle source
# File lib/rabbit/renderer/display/drawing-area-base.rb, line 251 def add_widgets_to_container(container) @hbox = Gtk::Box.new(:horizontal) @vbox = Gtk::Box.new(:vertical) @vbox.pack_start(@area, :expand => true, :fill => true, :padding => 0) @hbox.pack_end(@vbox, :expand => true, :fill => true, :padding => 0) if block_given? yield(container, @hbox) else container.add(@hbox) end @hbox.show @vbox.show end
configured_after(widget, event)
click to toggle source
Calls superclass method
Rabbit::Renderer::Display::DrawingAreaPrimitive#configured_after
# File lib/rabbit/renderer/display/drawing-area-base.rb, line 361 def configured_after(widget, event) @mask = nil set_hole super unless @caching false end
confirm_dialog(message)
click to toggle source
# File lib/rabbit/renderer/display/drawing-area-base.rb, line 368 def confirm_dialog(message) flags = Gtk::Dialog::MODAL | Gtk::Dialog::DESTROY_WITH_PARENT dialog_type = Gtk::MessageDialog::INFO buttons = Gtk::MessageDialog::BUTTONS_OK_CANCEL dialog = Gtk::MessageDialog.new(nil, flags, dialog_type, buttons, message) result = dialog.run dialog.destroy result end
draw(widget)
click to toggle source
Calls superclass method
Rabbit::Renderer::Display::DrawingAreaPrimitive#draw
# File lib/rabbit/renderer/display/drawing-area-base.rb, line 297 def draw(widget) reload_source unless @caching if whiteouting? paint("white") elsif blackouting? paint("black") else super draw_graffiti draw_gesture draw_spotlight end end
draw_current_slide_pixbuf(pixbuf)
click to toggle source
# File lib/rabbit/renderer/display/drawing-area-base.rb, line 312 def draw_current_slide_pixbuf(pixbuf) width, height = pixbuf.width, pixbuf.height x = @adjustment_x * width y = @adjustment_y * height @drawable.draw_pixbuf(@foreground, pixbuf, x, y, 0, 0, width, height, Gdk::RGB::DITHER_NORMAL, 0, 0) if @adjustment_x != 0 or @adjustment_y != 0 draw_next_slide end end
draw_next_slide()
click to toggle source
# File lib/rabbit/renderer/display/drawing-area-base.rb, line 324 def draw_next_slide @canvas.change_current_index(@canvas.current_index + 1) do draw_current_slide do |pixbuf| draw_next_slide_pixbuf(pixbuf) end end end
draw_next_slide_pixbuf(pixbuf)
click to toggle source
# File lib/rabbit/renderer/display/drawing-area-base.rb, line 332 def draw_next_slide_pixbuf(pixbuf) width, height = pixbuf.size adjustment_width = @adjustment_x * width adjustment_height = @adjustment_y * height src_x = src_y = dest_x = dest_y = 0 src_width = width src_height = height if adjustment_width > 0 dest_x = width - adjustment_width src_width = adjustment_width elsif adjustment_width < 0 src_x = width + adjustment_width src_width = -adjustment_width end if adjustment_height > 0 dest_y = height - adjustment_height src_height = adjustment_height elsif adjustment_height < 0 src_y = height + adjustment_height src_height = -adjustment_height end @drawable.draw_pixbuf(@foreground, pixbuf, src_x, src_y, dest_x, dest_y, src_width, src_height, Gdk::RGB::DITHER_NORMAL, 0, 0) end
init_drawing_area()
click to toggle source
Calls superclass method
Rabbit::Renderer::Display::DrawingAreaPrimitive#init_drawing_area
# File lib/rabbit/renderer/display/drawing-area-base.rb, line 270 def init_drawing_area super event_mask = Gdk::EventMask::BUTTON_PRESS_MASK event_mask |= Gdk::EventMask::BUTTON_RELEASE_MASK event_mask |= Gdk::EventMask::BUTTON1_MOTION_MASK event_mask |= Gdk::EventMask::BUTTON2_MOTION_MASK event_mask |= Gdk::EventMask::BUTTON3_MOTION_MASK event_mask |= Gdk::EventMask::SCROLL_MASK @area.add_events(event_mask) set_key_press_event(@area) set_button_event(@area) set_motion_notify_event set_scroll_event(@area) end
paint(color_name)
click to toggle source
# File lib/rabbit/renderer/display/drawing-area-base.rb, line 291 def paint(color_name) context = @drawable.create_cairo_context context.set_source_rgba(*Color.parse(color_name).to_a) context.paint end
remove_widgets_from_container(container)
click to toggle source
# File lib/rabbit/renderer/display/drawing-area-base.rb, line 265 def remove_widgets_from_container(container) container.remove(@hbox) @hbox = @vbox = nil end
set_motion_notify_event()
click to toggle source
# File lib/rabbit/renderer/display/drawing-area-base.rb, line 285 def set_motion_notify_event @area.signal_connect("motion_notify_event") do |widget, event| call_hook_procs(@motion_notify_hook_procs, event) end end