module Rabbit::Renderer::Base

Attributes

adjustment_x[RW]
adjustment_y[RW]
base_height[RW]
base_width[RW]
draw_scaled_image[RW]
gl_quaternion[RW]
gl_scale[RW]
graffiti_color[RW]
graffiti_line_width[RW]
margin_bottom[RW]
margin_left[RW]
margin_right[RW]
margin_top[RW]
page_margin_bottom[W]
page_margin_left[W]
page_margin_right[W]
page_margin_top[W]
paper_height[RW]
paper_width[RW]
progress_background[RW]
progress_foreground[RW]
slides_per_page[RW]
x_dpi[R]
y_dpi[R]

Public Class Methods

new(canvas) click to toggle source
Calls superclass method
# 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

Public Instance Methods

add_gesture_action(sequence, action, &block) click to toggle source
# File lib/rabbit/renderer/base.rb, line 267
def add_gesture_action(sequence, action, &block)
end
blackouting?() click to toggle source
# File lib/rabbit/renderer/base.rb, line 199
def blackouting?
  @blackout
end
can_undo_graffiti?() click to toggle source
# File lib/rabbit/renderer/base.rb, line 238
def can_undo_graffiti?
  false
end
change_graffiti_color() click to toggle source
# File lib/rabbit/renderer/base.rb, line 264
def change_graffiti_color
end
clean() click to toggle source
# File lib/rabbit/renderer/base.rb, line 179
def clean
  dirty_count_clean
end
clean_if_dirty() click to toggle source
# File lib/rabbit/renderer/base.rb, line 183
def clean_if_dirty
  clean if dirty?
end
clear_slide() click to toggle source
# File lib/rabbit/renderer/base.rb, line 126
def clear_slide
  current = @canvas.current_slide
  current.clear_waiting if current
end
clear_theme() click to toggle 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
confirm() click to toggle source
# File lib/rabbit/renderer/base.rb, line 172
def confirm
  true
end
connect_key(keyval, modifier, flags, &block) click to toggle source
# File lib/rabbit/renderer/base.rb, line 258
def connect_key(keyval, modifier, flags, &block)
end
create_pango_context() click to toggle source
# File lib/rabbit/renderer/base.rb, line 160
def create_pango_context
  Pango::Context.new
end
disconnect_key(keyval, modifier) click to toggle source
# File lib/rabbit/renderer/base.rb, line 261
def disconnect_key(keyval, modifier)
end
display?() click to toggle source
# File lib/rabbit/renderer/base.rb, line 168
def display?
  false
end
each_slide_pixbuf() { |slide, to_pixbuf, i| ... } click to toggle 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
expand_hole() click to toggle source
# File lib/rabbit/renderer/base.rb, line 242
def expand_hole
end
font_families() click to toggle 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
gl_available?() click to toggle source
# File lib/rabbit/renderer/base.rb, line 223
def gl_available?
  @canvas.use_gl? and gl_supported?
end
graffiti_mode?() click to toggle source
# File lib/rabbit/renderer/base.rb, line 230
def graffiti_mode?
  false
end
have_graffiti?() click to toggle source
# File lib/rabbit/renderer/base.rb, line 234
def have_graffiti?
  false
end
hiding?() click to toggle source
# File lib/rabbit/renderer/base.rb, line 213
def hiding?
  @blackout or @whiteout
end
narrow_hole() click to toggle source
# File lib/rabbit/renderer/base.rb, line 245
def narrow_hole
end
offscreen_canvas() click to toggle source
# File lib/rabbit/renderer/base.rb, line 152
def offscreen_canvas
  if offscreen_renderer?
    @canvas
  else
    make_canvas_with_offscreen_renderer
  end
end
page_margin_bottom() click to toggle source
# File lib/rabbit/renderer/base.rb, line 95
def page_margin_bottom
  @page_margin_bottom || 0
end
page_margin_left() click to toggle source
# File lib/rabbit/renderer/base.rb, line 83
def page_margin_left
  @page_margin_left || 0
end
page_margin_right() click to toggle source
# File lib/rabbit/renderer/base.rb, line 87
def page_margin_right
  @page_margin_right || 0
end
page_margin_top() click to toggle source
# File lib/rabbit/renderer/base.rb, line 91
def page_margin_top
  @page_margin_top || 0
end
post_init_gui() click to toggle source
# File lib/rabbit/renderer/base.rb, line 227
def post_init_gui
end
post_terminal() click to toggle source
# File lib/rabbit/renderer/base.rb, line 273
def post_terminal
end
pre_terminal() click to toggle source
# File lib/rabbit/renderer/base.rb, line 270
def pre_terminal
end
print(&block) click to toggle source
printable?() click to toggle source
# File lib/rabbit/renderer/base.rb, line 164
def printable?
  false
end
redraw() click to toggle source
# File lib/rabbit/renderer/base.rb, line 123
def redraw
end
reset_adjustment() click to toggle source
# File lib/rabbit/renderer/base.rb, line 131
def reset_adjustment
  @adjustment_x = 0
  @adjustment_y = 0
end
search_slide(forward=true) click to toggle source
# File lib/rabbit/renderer/base.rb, line 248
def search_slide(forward=true)
end
searching?() click to toggle source
# File lib/rabbit/renderer/base.rb, line 254
def searching?
  false
end
setup_event(area) click to toggle source
# File lib/rabbit/renderer/base.rb, line 176
def setup_event(area)
end
toggle_blackout() click to toggle source
# File lib/rabbit/renderer/base.rb, line 208
def toggle_blackout
  @blackout = !@blackout
  @whiteout = false
end
toggle_info_window() click to toggle source
# File lib/rabbit/renderer/base.rb, line 217
def toggle_info_window
end
toggle_spotlight() click to toggle source
# File lib/rabbit/renderer/base.rb, line 220
def toggle_spotlight
end
toggle_whiteout() click to toggle source
# File lib/rabbit/renderer/base.rb, line 203
def toggle_whiteout
  @blackout = false
  @whiteout = !@whiteout
end
whiteouting?() click to toggle source
# File lib/rabbit/renderer/base.rb, line 195
def whiteouting?
  @whiteout
end

Private Instance Methods

clear_gesture_actions() click to toggle source
# File lib/rabbit/renderer/base.rb, line 404
def clear_gesture_actions
  init_gesture_actions
end
clear_graffiti_config() click to toggle source
# File lib/rabbit/renderer/base.rb, line 386
def clear_graffiti_config
  @graffiti_color = nil
  @graffiti_line_width = nil
end
clear_keys() click to toggle source
# File lib/rabbit/renderer/base.rb, line 383
def clear_keys
end
clear_progress_color() click to toggle source
# File lib/rabbit/renderer/base.rb, line 391
def clear_progress_color
  @progress_foreground = nil
  @progress_background = nil
end
do_print(&block) click to toggle 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
init_color() click to toggle source
# File lib/rabbit/renderer/base.rb, line 400
def init_color
  @background_color = "white"
end
init_dpi() click to toggle source
# File lib/rabbit/renderer/base.rb, line 362
def init_dpi
  @x_dpi = 72
  @y_dpi = 72
end
init_gesture_actions() click to toggle source
# File lib/rabbit/renderer/base.rb, line 408
def init_gesture_actions
end
init_gl_parameters() click to toggle 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
invert_y(y) click to toggle source
# File lib/rabbit/renderer/base.rb, line 396
def invert_y(y)
  height - y
end
make_canvas_with_offscreen_renderer() click to toggle 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
make_canvas_with_printable_renderer() click to toggle 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
make_canvas_with_renderer(renderer) { |canvas| ... } click to toggle 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
not_support_method(name) click to toggle 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
offscreen_renderer?() click to toggle source
# File lib/rabbit/renderer/base.rb, line 277
def offscreen_renderer?
  false
end
setup_3d(canvas) click to toggle source
# File lib/rabbit/renderer/base.rb, line 352
def setup_3d(canvas)
  canvas.use_gl = @canvas.use_gl?
end
setup_margin(canvas) click to toggle 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
setup_page_margin(canvas) click to toggle 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
setup_paper_size(canvas) click to toggle 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
setup_size(canvas) click to toggle source
# File lib/rabbit/renderer/base.rb, line 328
def setup_size(canvas)
  canvas.width = @canvas.width
  canvas.height = @canvas.height
end