module Rabbit::Renderer::Base
Attributes
Public Class Methods
Source
# File lib/rabbit/renderer/base.rb, line 51 def initialize(canvas) super() @canvas = canvas @font_families = nil @base_width = nil @base_height = nil @paper_width = nil @paper_height = nil @slides_per_page = 1 @margin_left = nil @margin_right = nil @margin_top = nil @margin_bottom = nil @page_margin_left = nil @page_margin_right = nil @page_margin_top = nil @page_margin_bottom = nil @whiteout = false @blackout = false @list_id = 0 @adjustment_x = 0 @adjustment_y = 0 @progress_foreground = nil @progress_background = nil @graffiti_color = nil @graffiti_line_width = nil @draw_scaled_image = true clean init_dpi init_gl_parameters end
Calls superclass method
Public Instance Methods
Source
# File lib/rabbit/renderer/base.rb, line 267 def add_gesture_action(sequence, action, &block) end
Source
# File lib/rabbit/renderer/base.rb, line 238 def can_undo_graffiti? false end
Source
# File lib/rabbit/renderer/base.rb, line 264 def change_graffiti_color end
Source
# File lib/rabbit/renderer/base.rb, line 183 def clean_if_dirty clean if dirty? end
Source
# File lib/rabbit/renderer/base.rb, line 126 def clear_slide current = @canvas.current_slide current.clear_waiting if current end
Source
# File lib/rabbit/renderer/base.rb, line 187 def clear_theme init_color clear_keys clear_progress_color clear_graffiti_config clear_gesture_actions end
Source
# File lib/rabbit/renderer/base.rb, line 258 def connect_key(keyval, modifier, flags, &block) end
Source
# File lib/rabbit/renderer/base.rb, line 160 def create_pango_context Pango::Context.new end
Source
# File lib/rabbit/renderer/base.rb, line 261 def disconnect_key(keyval, modifier) end
Source
# File lib/rabbit/renderer/base.rb, line 136 def each_slide_pixbuf canvas = offscreen_canvas previous_index = canvas.current_index pre_to_pixbuf(canvas.slide_size) canceled = false canvas.slides.each_with_index do |slide, i| if !to_pixbufing(i) or !yield(slide, canvas.to_pixbuf(i), i) canceled = true break end end post_to_pixbuf(canceled) canvas.move_to_if_can(previous_index) canvas.activate("Quit") if canvas != @canvas end
Source
# File lib/rabbit/renderer/base.rb, line 99 def font_families if @font_families.nil? or @font_families.empty? @font_families = create_pango_context.families end @font_families end
Source
# File lib/rabbit/renderer/base.rb, line 223 def gl_available? @canvas.use_gl? and gl_supported? end
Source
# File lib/rabbit/renderer/base.rb, line 213 def hiding? @blackout or @whiteout end
Source
# File lib/rabbit/renderer/base.rb, line 152 def offscreen_canvas if offscreen_renderer? @canvas else make_canvas_with_offscreen_renderer end end
Source
# File lib/rabbit/renderer/base.rb, line 95 def page_margin_bottom @page_margin_bottom || 0 end
Source
# File lib/rabbit/renderer/base.rb, line 83 def page_margin_left @page_margin_left || 0 end
Source
# File lib/rabbit/renderer/base.rb, line 87 def page_margin_right @page_margin_right || 0 end
Source
# File lib/rabbit/renderer/base.rb, line 91 def page_margin_top @page_margin_top || 0 end
Source
# File lib/rabbit/renderer/base.rb, line 106 def print(&block) if printable? do_print(&block) else canvas = make_canvas_with_printable_renderer pre_print(canvas.slide_size) canceled = false canvas.print do |i| result = printing(i) canceled = !result result end post_print(canceled) canvas.activate("Quit") end end
Source
# File lib/rabbit/renderer/base.rb, line 131 def reset_adjustment @adjustment_x = 0 @adjustment_y = 0 end
Source
# File lib/rabbit/renderer/base.rb, line 248 def search_slide(forward=true) end
Source
# File lib/rabbit/renderer/base.rb, line 208 def toggle_blackout @blackout = !@blackout @whiteout = false end
Source
# File lib/rabbit/renderer/base.rb, line 217 def toggle_info_window end
Source
# File lib/rabbit/renderer/base.rb, line 203 def toggle_whiteout @blackout = false @whiteout = !@whiteout end
Private Instance Methods
Source
# File lib/rabbit/renderer/base.rb, line 404 def clear_gesture_actions init_gesture_actions end
Source
# File lib/rabbit/renderer/base.rb, line 386 def clear_graffiti_config @graffiti_color = nil @graffiti_line_width = nil end
Source
# File lib/rabbit/renderer/base.rb, line 391 def clear_progress_color @progress_foreground = nil @progress_background = nil end
Source
# File lib/rabbit/renderer/base.rb, line 281 def do_print(&block) pre_print(@canvas.slide_size) canceled = false @canvas.slides.each_with_index do |slide, i| @canvas.move_to_if_can(i) current_slide = @canvas.current_slide current_slide.flush current_slide.draw(@canvas) if block and !block.call(i) canceled = true break end end post_print(canceled) end
Source
# File lib/rabbit/renderer/base.rb, line 400 def init_color @background_color = "white" end
Source
# File lib/rabbit/renderer/base.rb, line 362 def init_dpi @x_dpi = 72 @y_dpi = 72 end
Source
# File lib/rabbit/renderer/base.rb, line 408 def init_gesture_actions end
Source
# File lib/rabbit/renderer/base.rb, line 367 def init_gl_parameters angle = 0.0 * (Math::PI / 180.0) axis_x = 1.0 axis_y = 0.0 axis_z = 0.0 sine = Math.sin(0.5 * angle) quaternion = [ axis_x * sine, axis_y * sine, axis_z * sine, Math.cos(0.5 * angle) ] @gl_quaternion = TrackBall::Vector.new(quaternion) @gl_scale = 1.0 end
Source
# File lib/rabbit/renderer/base.rb, line 321 def make_canvas_with_offscreen_renderer make_canvas_with_renderer(Offscreen) do |canvas| setup_size(canvas) setup_3d(canvas) end end
Source
# File lib/rabbit/renderer/base.rb, line 308 def make_canvas_with_printable_renderer renderer = Renderer::Printer make_canvas_with_renderer(renderer) do |canvas| canvas.filename = @canvas.filename setup_size(canvas) setup_margin(canvas) setup_page_margin(canvas) setup_paper_size(canvas) setup_3d(canvas) canvas.slides_per_page = @canvas.slides_per_page end end
Source
# File lib/rabbit/renderer/base.rb, line 297 def make_canvas_with_renderer(renderer) canvas = Canvas.new(@canvas.logger, renderer) yield canvas canvas.apply_theme(@canvas.theme_name) @canvas.source_force_modified(true) do |source| canvas.parse(source) end canvas.toggle_index_mode if @canvas.index_mode? canvas end
Source
# File lib/rabbit/renderer/base.rb, line 356 def not_support_method(name) format = _("%s does not support: %s") msg = format % [self.class.name, name] @canvas.logger.warn(msg) end
Source
# File lib/rabbit/renderer/base.rb, line 277 def offscreen_renderer? false end
Source
# File lib/rabbit/renderer/base.rb, line 352 def setup_3d(canvas) canvas.use_gl = @canvas.use_gl? end
Source
# File lib/rabbit/renderer/base.rb, line 333 def setup_margin(canvas) canvas.margin_left = @canvas.margin_left canvas.margin_right = @canvas.margin_right canvas.margin_top = @canvas.margin_top canvas.margin_bottom = @canvas.margin_bottom end
Source
# File lib/rabbit/renderer/base.rb, line 340 def setup_page_margin(canvas) canvas.page_margin_left = @canvas.page_margin_left canvas.page_margin_right = @canvas.page_margin_right canvas.page_margin_top = @canvas.page_margin_top canvas.page_margin_bottom = @canvas.page_margin_bottom end
Source
# File lib/rabbit/renderer/base.rb, line 347 def setup_paper_size(canvas) canvas.paper_width = @canvas.paper_width canvas.paper_height = @canvas.paper_height end
Source
# File lib/rabbit/renderer/base.rb, line 328 def setup_size(canvas) canvas.width = @canvas.width canvas.height = @canvas.height end