Class: Rabbit::Renderer::Display::ClutterEmbed

Inherits:
Object
  • Object
show all
Includes:
Base, ButtonHandler, Cursor, Gesture, Graffiti, Info, KeyHandler, Magnifier, Mask, Menu, Progress, Search, Spotlight, Engine::Cairo
Defined in:
lib/rabbit/renderer/display/clutter-embed.rb

Constant Summary

Constants included from ButtonHandler

ButtonHandler::BUTTON_PRESS_ACCEPTING_TIME

Constants included from Mask

Mask::MASK_SIZE_STEP

Constants included from DirtyCount

DirtyCount::TOO_DIRTY

Constants included from GetText

GetText::DOMAIN

Instance Attribute Summary collapse

Attributes included from Base

#adjustment_x, #adjustment_y, #base_height, #base_width, #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

Attributes included from Engine::Cairo

#background, #foreground

Class Method Summary collapse

Instance Method Summary collapse

Methods included from Magnifier

#toggle_magnifier

Methods included from Spotlight

#toggle_spotlight

Methods included from Info

#hide_info_window, #show_info_window, #toggle_info_window

Methods included from KeyHandler

#connect_key, #disconnect_key, #post_terminal, #pre_terminal

Methods included from Search

#search_slide, #searching?, #stop_slide_search

Methods included from Mask

#expand_hole, #narrow_hole, #set_hole

Methods included from Graffiti

#can_undo_graffiti?, #change_graffiti_color, #clear_graffiti, #graffiti_mode?, #have_graffiti?, #toggle_graffiti_mode, #undo_graffiti

Methods included from Base

#create_pango_context, #create_pango_layout, #draw_slide, #height, #make_layout, #size, #update_title, #width

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_theme, #confirm, #connect_key, #create_pango_context, #disconnect_key, #each_slide_pixbuf, #expand_hole, #font_families, #gl_available?, #graffiti_mode?, #have_graffiti?, #hiding?, #narrow_hole, #offscreen_canvas, #post_init_gui, #post_terminal, #pre_terminal, #print, #printable?, #search_slide, #searching?, #setup_event, #stop_slide_search, #toggle_info_window, #toggle_spotlight, #whiteouting?

Methods included from DirtyCount

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

Methods included from GetText

included

Methods included from Engine::Cairo

#alpha_available?, #background_image=, #create_pango_context, #draw_arc, #draw_arc_by_radius, #draw_background, #draw_layout, #draw_line, #draw_lines, #draw_link, #draw_pixbuf, #draw_polygon, #draw_poppler_page, #draw_rectangle, #draw_rounded_rectangle, #draw_rsvg_handle, #finish_context, #finish_renderer, #init_context, #init_renderer, #make_layout, #reflect_context, #restore_context, #rotate_context, #save_context, #scale_context, #set_font_resolution, #set_source_pixbuf, #shear_context, #to_gdk_rgb, #translate_context

Methods included from Kernel

#draw_background, #draw_circle, #draw_circle_by_radius, #draw_cone, #draw_cube, #draw_dodecahedron, #draw_flag, #draw_flag_layout, #draw_icosahedron, #draw_octahedron, #draw_rectangle_flag, #draw_slide, #draw_sphere, #draw_teapot, #draw_tetrahedron, #draw_torus, #draw_triangle_flag, #flag_size, #gl_call_list, #gl_compile, #gl_supported?, #make_color, #new_list_id, #reflect_context, #restore_context, #rotate_context, #save_context, #scale_context, #shear_context, #translate_context, #z_far, #z_view

Constructor Details

#initialize(canvas) ⇒ ClutterEmbed

Returns a new instance of ClutterEmbed.


63
64
65
66
67
68
69
# File 'lib/rabbit/renderer/display/clutter-embed.rb', line 63

def initialize(canvas)
  @recreate_id = nil
  @need_reload_theme = false
  super
  @filename = nil
  init_clutter_embed
end

Instance Attribute Details

#filenameObject

Returns the value of attribute filename.


62
63
64
# File 'lib/rabbit/renderer/display/clutter-embed.rb', line 62

def filename
  @filename
end

Class Method Details

.priorityObject


40
41
42
# File 'lib/rabbit/renderer/display/clutter-embed.rb', line 40

def priority
  0
end

Instance Method Details

#attach_to(window, container = nil) ⇒ Object


211
212
213
214
215
216
217
218
219
# File 'lib/rabbit/renderer/display/clutter-embed.rb', line 211

def attach_to(window, container=nil)
  super

  init_menu
  add_widgets_to_container(@container)
  widget.show
  attach_menu(@window)
  attach_key(@window)
end

#cache_all_slidesObject


246
247
# File 'lib/rabbit/renderer/display/clutter-embed.rb', line 246

def cache_all_slides
end

#clear_slideObject


82
83
84
85
# File 'lib/rabbit/renderer/display/clutter-embed.rb', line 82

def clear_slide
  super
  redraw
end

#detachObject


221
222
223
224
225
226
227
228
229
230
# File 'lib/rabbit/renderer/display/clutter-embed.rb', line 221

def detach
  detach_key(@window)
  detach_menu(@window)
  widget.hide
  unless @window.destroyed?
    remove_widgets_from_container(@container)
  end

  super
end

#display?Boolean

Returns:

  • (Boolean)

198
199
200
# File 'lib/rabbit/renderer/display/clutter-embed.rb', line 198

def display?
  true
end

#index_mode_offObject


170
171
172
# File 'lib/rabbit/renderer/display/clutter-embed.rb', line 170

def index_mode_off
  restore_cursor(:index)
end

#index_mode_onObject


165
166
167
168
# File 'lib/rabbit/renderer/display/clutter-embed.rb', line 165

def index_mode_on
  keep_cursor(:index)
  update_cursor(nil, true)
end

#post_apply_themeObject


99
100
101
# File 'lib/rabbit/renderer/display/clutter-embed.rb', line 99

def post_apply_theme
  recreate_actors
end

#post_fullscreenObject


87
88
89
# File 'lib/rabbit/renderer/display/clutter-embed.rb', line 87

def post_fullscreen
  update_cursor(:blank, true)
end

#post_iconifyObject


96
97
# File 'lib/rabbit/renderer/display/clutter-embed.rb', line 96

def post_iconify
end

#post_move(old_index, index) ⇒ Object


103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
# File 'lib/rabbit/renderer/display/clutter-embed.rb', line 103

def post_move(old_index, index)
  update_title
  update_menu

  old_actor = retrieve_actor(old_index)
  old_actor.hide if old_actor
  actor = retrieve_actor(index)
  if actor and !hiding?
    actor.content.set_size(actor.width, actor.height)
    actor.show
    actor.raise_top
    if old_actor
      transition = @canvas.slides[index].transition
      transition_method = "transition_#{transition}"
      if transition and respond_to?(transition_method, true)
        send(transition_method, old_actor, actor, old_index, index)
      end
    end
  end
end

#post_move_in_slide(old_index, index) ⇒ Object


124
125
126
127
128
129
130
131
132
133
# File 'lib/rabbit/renderer/display/clutter-embed.rb', line 124

def post_move_in_slide(old_index, index)
  actor = retrieve_actor(nil, old_index)
  actor.hide if actor
  actor = retrieve_actor(nil, index)
  if actor and !hiding?
    actor.content.set_size(actor.width, actor.height)
    actor.show
    actor.raise_top
  end
end

#post_parseObject


138
139
140
141
142
143
144
145
146
# File 'lib/rabbit/renderer/display/clutter-embed.rb', line 138

def post_parse
  clear_button_handler
  update_title
  update_menu
  if @need_reload_theme
    @need_reload_theme = false
    reload_theme
  end
end

#post_to_pixbuf(canceled) ⇒ Object


162
163
# File 'lib/rabbit/renderer/display/clutter-embed.rb', line 162

def post_to_pixbuf(canceled)
end

#post_toggle_index_modeObject


151
152
153
# File 'lib/rabbit/renderer/display/clutter-embed.rb', line 151

def post_toggle_index_mode
  recreate_actors
end

#post_unfullscreenObject


91
92
93
94
# File 'lib/rabbit/renderer/display/clutter-embed.rb', line 91

def post_unfullscreen
  update_cursor(nil, true)
  update_menu
end

#pre_parseObject


135
136
# File 'lib/rabbit/renderer/display/clutter-embed.rb', line 135

def pre_parse
end

#pre_to_pixbuf(slide_size) ⇒ Object


155
156
# File 'lib/rabbit/renderer/display/clutter-embed.rb', line 155

def pre_to_pixbuf(slide_size)
end

#pre_toggle_index_modeObject


148
149
# File 'lib/rabbit/renderer/display/clutter-embed.rb', line 148

def pre_toggle_index_mode
end

#redrawObject


75
76
77
78
79
80
# File 'lib/rabbit/renderer/display/clutter-embed.rb', line 75

def redraw
  actor = current_actor
  # TODO: We need more work for periodical redraw
  actor.content.invalidate if actor
  widget.queue_draw
end

#reload_theme(&callback) ⇒ Object


202
203
204
205
206
207
208
209
# File 'lib/rabbit/renderer/display/clutter-embed.rb', line 202

def reload_theme(&callback)
  if @canvas.applying?
    @need_reload_theme = true
  else
    callback ||= Utils.process_pending_events_proc
    @canvas.activate("ReloadTheme", &callback)
  end
end

#reset_adjustmentObject


232
233
234
235
236
237
238
239
240
241
242
243
244
# File 'lib/rabbit/renderer/display/clutter-embed.rb', line 232

def reset_adjustment
  super
  @actors.each do |slide_actors|
    slide_actors.each do |actor|
      actor.x = 0
      actor.y = 0
      actor.set_scale(1, 1)
      actor.set_rotation(Clutter::X_AXIS, 0, 0, 0, 0)
      actor.set_rotation(Clutter::Y_AXIS, 0, 0, 0, 0)
      actor.set_rotation(Clutter::Z_AXIS, 0, 0, 0, 0)
    end
  end
end

#to_pixbufing(i) ⇒ Object


158
159
160
# File 'lib/rabbit/renderer/display/clutter-embed.rb', line 158

def to_pixbufing(i)
  true
end

#toggle_blackoutObject


186
187
188
189
190
191
192
193
194
195
196
# File 'lib/rabbit/renderer/display/clutter-embed.rb', line 186

def toggle_blackout
  super
  if blackouting?
    @stage.color = Clutter::Color.parse("black")
    current_actor.hide
  else
    reset_stage_color
    current_actor.show
  end
  redraw
end

#toggle_whiteoutObject


174
175
176
177
178
179
180
181
182
183
184
# File 'lib/rabbit/renderer/display/clutter-embed.rb', line 174

def toggle_whiteout
  super
  if whiteouting?
    @stage.color = Clutter::Color.parse("white")
    current_actor.hide
  else
    reset_stage_color
    current_actor.show
  end
  redraw
end

#widgetObject


71
72
73
# File 'lib/rabbit/renderer/display/clutter-embed.rb', line 71

def widget
  @embed
end