class Rabbit::Front
Constants
- AVAILABLE_INTERFACES
Attributes
Public Class Methods
Source
# File lib/rabbit/front.rb, line 78 def initialize(canvas, public_level=nil) super() @canvas = canvas @image_type = "png" @public_level = public_level || PublicLevel::STRICT @previous_width = @canvas.width @previous_height = @canvas.height setup_public_interface clean end
Calls superclass method
Public Instance Methods
Source
# File lib/rabbit/front.rb, line 154 def accept_move? not (@public_level & Front::PublicLevel::MOVE).zero? end
Source
# File lib/rabbit/front.rb, line 158 def append_comment(comment) GLib::Idle.add do @canvas.append_comment(comment) false end true end
Source
# File lib/rabbit/front.rb, line 144 def available_interfaces AVAILABLE_INTERFACES.collect do |name, level, need_clear_cache| [name, level, @canvas.method(name).arity] end end
Source
# File lib/rabbit/front.rb, line 89 def current_slide_image update_images_if_need @images[@canvas.current_index] end
Source
# File lib/rabbit/front.rb, line 116 def current_slide_number @canvas.current_index end
Source
# File lib/rabbit/front.rb, line 99 def current_slide_rd slide = @canvas.current_slide slide ? slide.to_rd : "" end
Source
# File lib/rabbit/front.rb, line 94 def current_slide_text slide = @canvas.current_slide slide ? slide.text : "" end
Source
# File lib/rabbit/front.rb, line 120 def first_slide? @canvas.first_slide? end
Source
# File lib/rabbit/front.rb, line 124 def have_next_slide? @canvas.have_next_slide? end
Source
# File lib/rabbit/front.rb, line 136 def have_previous? @canvas.have_previous? end
Source
# File lib/rabbit/front.rb, line 128 def have_previous_slide? @canvas.have_previous_slide? end
Source
# File lib/rabbit/front.rb, line 112 def total_slide_number @canvas.slide_size end
Private Instance Methods
Source
# File lib/rabbit/front.rb, line 177 def _check_dirty if dirty? clean if offscreen_canvas.need_reload_source? offscreen_canvas.reload_source synchronize end end end
Source
# File lib/rabbit/front.rb, line 171 def check_dirty mon_synchronize do _check_dirty end end
Source
# File lib/rabbit/front.rb, line 256 def clean @offscreen_canvas = nil @dirty = false @images = [] @last_modified = @canvas.last_modified end
Source
# File lib/rabbit/front.rb, line 204 def dirty? @dirty or @last_modified < @canvas.last_modified or offscreen_canvas.need_reload_source? end
Source
# File lib/rabbit/front.rb, line 267 def offscreen_canvas @offscreen_canvas ||= @canvas.offscreen_canvas end
Source
# File lib/rabbit/front.rb, line 216 def setup_public_interface AVAILABLE_INTERFACES.each do |name, level, need_clear_cache| arg_list = [] arg_list.concat(Utils.arg_list(@canvas.method(name).arity)) arg_str = arg_list.join(", ") if (@public_level & level).zero? instance_eval(<<-EOS, __FILE__, __LINE__ + 1) def self.#{name}(#{arg_str}) raise NotAvailableInterfaceError.new(#{name.to_s.dump}) end EOS else send_arguments = [name.to_s.dump, *arg_list].join(', ') dirty_source = nil dirty_source = "dirty!" if need_clear_cache if (level & (PublicLevel::MOVE | PublicLevel::CONTROL)).zero? instance_eval(<<-EOS, __FILE__, __LINE__ + 1) def self.#{name}(#{arg_str}) result = @canvas.__send__(#{send_arguments}) #{dirty_source} result end EOS else instance_eval(<<-EOS, __FILE__, __LINE__ + 1) def self.#{name}(#{arg_str}) GLib::Idle.add do @canvas.__send__(#{send_arguments}) #{dirty_source} false end true end EOS end end end end
Source
# File lib/rabbit/front.rb, line 210 def synchronize @last_modified = @canvas.last_modified @previous_width = @canvas.width @previous_height = @canvas.height end
Source
# File lib/rabbit/front.rb, line 187 def update_images_if_need mon_synchronize do _check_dirty index = @canvas.current_index if @images[index].nil? prev_size = [@previous_width, @previous_height] current_size = [@canvas.width, @canvas.height] if prev_size != current_size offscreen_canvas.reload_theme end pixbuf = offscreen_canvas.to_pixbuf(index) @images[index] = pixbuf.save_to_buffer(@image_type) synchronize end end end