Module: Rabbit::Renderer::Display::Base

Includes:
Base, HookHandler
Included in:
ClutterEmbed, DrawingAreaPrimitive
Defined in:
lib/rabbit/renderer/display/base.rb

Constant Summary

Constants included from DirtyCount

DirtyCount::TOO_DIRTY

Constants included from GetText

GetText::DOMAIN

Instance Attribute Summary

Attributes included from Base

#adjustment_x, #adjustment_y, #draw_scaled_image, #gl_quaternion, #gl_scale, #graffiti_color, #graffiti_line_width, #margin_bottom, #margin_left, #margin_right, #margin_top, #page_margin_bottom, #page_margin_left, #page_margin_right, #page_margin_top, #paper_height, #paper_width, #progress_background, #progress_foreground, #slides_per_page, #x_dpi, #y_dpi

Instance Method Summary collapse

Methods included from HookHandler

#add_button_press_hook, #add_button_release_hook, #add_motion_notify_hook, #add_scroll_hook, #call_hook_procs, #clear_button_press_hook, #clear_button_release_hook, #clear_hooks, #clear_motion_notify_hook, #clear_scroll_hook

Methods included from Base

#add_gesture_action, #blackouting?, #can_undo_graffiti?, #change_graffiti_color, #clean, #clean_if_dirty, #clear_slide, #clear_theme, #confirm, #connect_key, #disconnect_key, #display?, #each_slide_pixbuf, #expand_hole, #font_families, #gl_available?, #graffiti_mode?, #have_graffiti?, #hiding?, #narrow_hole, #off_screen_canvas, #post_init_gui, #print, #printable?, #reset_adjustment, #search_slide, #searching?, #setup_event, #stop_slide_search, #to_attrs, #toggle_info_window, #toggle_spotlight, #whiteouting?

Methods included from DirtyCount

#bit_dirty, #dirty, #dirty?, #dirty_count_clean, #very_dirty

Methods included from GetText

included

Instance Method Details

#attach_to(window, container = nil) ⇒ Object



47
48
49
50
51
52
# File 'lib/rabbit/renderer/display/base.rb', line 47

def attach_to(window, container=nil)
  @window = window
  @container = container || @window

  set_configure_event
end

#create_pango_contextObject



81
82
83
84
85
# File 'lib/rabbit/renderer/display/base.rb', line 81

def create_pango_context
  context = widget.create_pango_context
  set_font_resolution(context)
  context
end

#create_pango_layout(text) ⇒ Object



87
88
89
90
91
# File 'lib/rabbit/renderer/display/base.rb', line 87

def create_pango_layout(text)
  layout = widget.create_pango_layout(text)
  set_font_resolution(layout.context)
  layout
end

#detachObject



54
55
56
57
58
59
60
61
62
# File 'lib/rabbit/renderer/display/base.rb', line 54

def detach
  if !@window.destroyed? and @configure_signal_id
    @window.signal_handler_disconnect(@configure_signal_id)
    @configure_signal_id = nil
  end

  @window = nil
  @container = nil
end

#draw_slide(slide, simulation) ⇒ Object



97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
# File 'lib/rabbit/renderer/display/base.rb', line 97

def draw_slide(slide, simulation)
  set_size_ratio(slide.size_ratio || @default_size_ratio)

  if simulation
    super
  else
    save_context do
      translate_context(@size.logical_margin_left,
                        @size.logical_margin_top)
      super
    end

    unless @size.have_logical_margin?
      return
    end

    margin_background = make_color("black")
    if @size.have_logical_margin_x?
      draw_rectangle(true,
                     0,
                     0,
                     @size.logical_margin_left,
                     @size.real_height,
                     margin_background)
      draw_rectangle(true,
                     @size.real_width - @size.logical_margin_right,
                     0,
                     @size.logical_margin_right,
                     @size.real_height,
                     margin_background)
    end
    if @size.have_logical_margin_y?
      draw_rectangle(true,
                     0,
                     0,
                     @size.real_width,
                     @size.logical_margin_top,
                     margin_background)
      draw_rectangle(true,
                     0,
                     @size.real_height - @size.logical_margin_bottom,
                     @size.real_width,
                     @size.logical_margin_bottom,
                     margin_background)
    end
  end
end

#heightObject



29
30
31
32
33
34
35
36
# File 'lib/rabbit/renderer/display/base.rb', line 29

def height
  refresh_size
  if @size
    @size.logical_height
  else
    nil
  end
end

#initialize(*args, &block) ⇒ Object



11
12
13
14
15
16
17
18
# File 'lib/rabbit/renderer/display/base.rb', line 11

def initialize(*args, &block)
  @drawable = nil
  @size = nil
  @size_dirty = true
  @default_size_ratio = nil
  @size_ratio = nil
  super
end

#make_layout(text) ⇒ Object



74
75
76
77
78
79
# File 'lib/rabbit/renderer/display/base.rb', line 74

def make_layout(text)
  attrs, text = Pango.parse_markup(text)
  layout = create_pango_layout(text)
  layout.set_attributes(attrs)
  layout
end

#redrawObject



43
44
45
# File 'lib/rabbit/renderer/display/base.rb', line 43

def redraw
  widget.queue_draw
end

#sizeObject



38
39
40
41
# File 'lib/rabbit/renderer/display/base.rb', line 38

def size
  refresh_size
  @size
end

#toggle_blackoutObject



69
70
71
72
# File 'lib/rabbit/renderer/display/base.rb', line 69

def toggle_blackout
  super
  update_menu
end

#toggle_whiteoutObject



64
65
66
67
# File 'lib/rabbit/renderer/display/base.rb', line 64

def toggle_whiteout
  super
  update_menu
end

#update_titleObject



93
94
95
# File 'lib/rabbit/renderer/display/base.rb', line 93

def update_title
  @canvas.update_title(@canvas.slide_title)
end

#widthObject



20
21
22
23
24
25
26
27
# File 'lib/rabbit/renderer/display/base.rb', line 20

def width
  refresh_size
  if @size
    @size.logical_width
  else
    nil
  end
end