Module: Rabbit::Renderer::Display::DrawingAreaBase

Includes:
ButtonHandler, DrawingAreaPrimitive, Gesture, Graffiti, Info, KeyHandler, Magnifier, Mask, Menu, Progress, ScrollHandler, Search, Spotlight
Included in:
DrawingArea
Defined in:
lib/rabbit/renderer/display/drawing-area-base.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

Attributes included from DrawingAreaPrimitive

#filename

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

Instance Method Summary collapse

Methods included from Magnifier

#toggle_magnifier

Methods included from Spotlight

#toggle_spotlight

Methods included from Info

#hide_info_window, #post_move_in_slide, #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 DrawingAreaPrimitive

#clear_slide, #display?, #post_move_in_slide, #widget

Methods included from GL

#draw_cone, #draw_cube, #draw_dodecahedron, #draw_icosahedron, #draw_octahedron, #draw_sphere, #draw_teapot, #draw_tetrahedron, #draw_torus, #gl_call_list, #gl_compile, #gl_supported?

Methods included from Base

#create_pango_context, #create_pango_layout, #height, #make_layout, #redraw, #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_slide, #clear_theme, #connect_key, #create_pango_context, #disconnect_key, #display?, #each_slide_pixbuf, #expand_hole, #font_families, #gl_available?, #graffiti_mode?, #have_graffiti?, #hiding?, #narrow_hole, #offscreen_canvas, #post_terminal, #pre_terminal, #print, #printable?, #redraw, #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

Instance Method Details

#attach_to(window, container = nil, &block) ⇒ Object


203
204
205
206
207
208
209
210
211
212
# File 'lib/rabbit/renderer/display/drawing-area-base.rb', line 203

def attach_to(window, container=nil, &block)
  super

  init_menu
  init_gesture_actions
  add_widgets_to_container(@container, &block)
  widget.show
  attach_menu(@window)
  attach_key(@window)
end

#cache_all_slidesObject


141
142
143
144
145
146
147
148
149
150
151
152
153
154
# File 'lib/rabbit/renderer/display/drawing-area-base.rb', line 141

def cache_all_slides
  pre_cache_all_slides(@canvas.slide_size)
  canceled = false
  @canvas.slides.each_with_index do |slide, i|
    @canvas.change_current_index(i) do
      compile_slide(slide)
    end
    unless caching_all_slides(i)
      canceled = true
      break
    end
  end
  post_cache_all_slides(canceled)
end

#caching_all_slides(i) ⇒ Object


162
163
164
165
166
167
# File 'lib/rabbit/renderer/display/drawing-area-base.rb', line 162

def caching_all_slides(i)
  update_progress(i)
  continue = @caching_size == [width, height] &&
    !@canvas.quitted? && !@canvas.applying?
  continue
end

#confirm(message) ⇒ Object


180
181
182
# File 'lib/rabbit/renderer/display/drawing-area-base.rb', line 180

def confirm(message)
  confirm_dialog(message) == Gtk::MessageDialog::RESPONSE_OK
end

#detachObject


214
215
216
217
218
219
220
221
222
223
# File 'lib/rabbit/renderer/display/drawing-area-base.rb', line 214

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

  super
end

#draw_slide(slide, simulation, &block) ⇒ Object


243
244
245
246
247
248
# File 'lib/rabbit/renderer/display/drawing-area-base.rb', line 243

def draw_slide(slide, simulation, &block)
  super do |*args|
    block.call(*args)
    magnify {block.call(*args)} unless simulation
  end
end

#index_mode_offObject


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

def index_mode_off
  super
end

#index_mode_onObject


89
90
91
# File 'lib/rabbit/renderer/display/drawing-area-base.rb', line 89

def index_mode_on
  super
end

#initialize(canvas) ⇒ Object


34
35
36
37
38
# File 'lib/rabbit/renderer/display/drawing-area-base.rb', line 34

def initialize(canvas)
  @caching = nil
  @need_reload_theme = false
  super
end

#post_apply_themeObject


40
41
42
43
44
45
46
47
48
# File 'lib/rabbit/renderer/display/drawing-area-base.rb', line 40

def post_apply_theme
  if @need_reload_theme
    @need_reload_theme = false
    reload_theme
  else
    super
    update_menu
  end
end

#post_cache_all_slides(canceled) ⇒ Object


169
170
171
172
173
174
175
176
177
178
# File 'lib/rabbit/renderer/display/drawing-area-base.rb', line 169

def post_cache_all_slides(canceled)
  end_progress
  @caching = false
  return if @canvas.quitted?
  if canceled
    reload_theme
  else
    @area.queue_draw
  end
end

#post_fullscreenObject


58
59
60
61
# File 'lib/rabbit/renderer/display/drawing-area-base.rb', line 58

def post_fullscreen
  super
  update_menu
end

#post_iconifyObject


68
69
70
71
# File 'lib/rabbit/renderer/display/drawing-area-base.rb', line 68

def post_iconify
  super
  update_menu
end

#post_init_guiObject


240
241
# File 'lib/rabbit/renderer/display/drawing-area-base.rb', line 240

def post_init_gui
end

#post_move(old_index, index) ⇒ Object


50
51
52
53
54
55
56
# File 'lib/rabbit/renderer/display/drawing-area-base.rb', line 50

def post_move(old_index, index)
  update_title
  reset_adjustment
  clear_graffiti
  # toggle_graffiti_mode if @graffiti_mode
  super
end

#post_parseObject


78
79
80
81
82
83
84
85
86
87
# File 'lib/rabbit/renderer/display/drawing-area-base.rb', line 78

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

#post_print(canceled) ⇒ Object


119
120
121
# File 'lib/rabbit/renderer/display/drawing-area-base.rb', line 119

def post_print(canceled)
  end_progress
end

#post_to_pixbuf(canceled) ⇒ Object


136
137
138
139
# File 'lib/rabbit/renderer/display/drawing-area-base.rb', line 136

def post_to_pixbuf(canceled)
  super
  end_progress
end

#post_toggle_index_modeObject


102
103
104
105
106
107
# File 'lib/rabbit/renderer/display/drawing-area-base.rb', line 102

def post_toggle_index_mode
  @canvas.activate("ClearGraffiti")
  update_menu
  update_title
  super
end

#post_unfullscreenObject


63
64
65
66
# File 'lib/rabbit/renderer/display/drawing-area-base.rb', line 63

def post_unfullscreen
  super
  update_menu
end

#pre_cache_all_slides(slide_size) ⇒ Object


156
157
158
159
160
# File 'lib/rabbit/renderer/display/drawing-area-base.rb', line 156

def pre_cache_all_slides(slide_size)
  @caching = true
  @caching_size = [width, height]
  start_progress(slide_size)
end

#pre_parseObject


73
74
75
76
# File 'lib/rabbit/renderer/display/drawing-area-base.rb', line 73

def pre_parse
  super
  update_menu
end

#pre_print(slide_size) ⇒ Object


109
110
111
# File 'lib/rabbit/renderer/display/drawing-area-base.rb', line 109

def pre_print(slide_size)
  start_progress(slide_size)
end

#pre_to_pixbuf(slide_size) ⇒ Object


123
124
125
126
127
# File 'lib/rabbit/renderer/display/drawing-area-base.rb', line 123

def pre_to_pixbuf(slide_size)
  super
  start_progress(slide_size)
  @pixbufing_size = [width, height]
end

#pre_toggle_index_modeObject


97
98
99
100
# File 'lib/rabbit/renderer/display/drawing-area-base.rb', line 97

def pre_toggle_index_mode
  super
  Utils.process_pending_events
end

#printing(i) ⇒ Object


113
114
115
116
117
# File 'lib/rabbit/renderer/display/drawing-area-base.rb', line 113

def printing(i)
  update_progress(i)
  continue = !@canvas.quitted?
  continue
end

#reload_source(&callback) ⇒ Object


192
193
194
195
196
197
198
199
200
201
# File 'lib/rabbit/renderer/display/drawing-area-base.rb', line 192

def reload_source(&callback)
  if @canvas.need_reload_source?
    callback ||= Utils.process_pending_events_proc
    begin
      super(callback)
    rescue
      @canvas.logger.error($!)
    end
  end
end

#reload_theme(&callback) ⇒ Object


184
185
186
187
188
189
190
# File 'lib/rabbit/renderer/display/drawing-area-base.rb', line 184

def reload_theme(&callback)
  if @canvas.applying?
    @need_reload_theme = true
  else
    super
  end
end

#reset_adjustmentObject


235
236
237
238
# File 'lib/rabbit/renderer/display/drawing-area-base.rb', line 235

def reset_adjustment
  super
  @area.queue_draw
end

#to_pixbufing(i) ⇒ Object


129
130
131
132
133
134
# File 'lib/rabbit/renderer/display/drawing-area-base.rb', line 129

def to_pixbufing(i)
  update_progress(i)
  continue = @pixbufing_size == [width, height] &&
    !@canvas.quitted? && !@canvas.applying?
  super or continue
end

#toggle_blackoutObject


230
231
232
233
# File 'lib/rabbit/renderer/display/drawing-area-base.rb', line 230

def toggle_blackout
  super
  @area.queue_draw
end

#toggle_whiteoutObject


225
226
227
228
# File 'lib/rabbit/renderer/display/drawing-area-base.rb', line 225

def toggle_whiteout
  super
  @area.queue_draw
end