Class: Rabbit::Renderer::Screen

Inherits:
Object
  • Object
show all
Extended by:
Forwardable
Includes:
Display::Base, Display::Cursor, Display::KeyHandler
Defined in:
lib/rabbit/renderer/screen.rb

Constant Summary

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

Instance Method Summary collapse

Methods included from Display::KeyHandler

#connect_key, #disconnect_key, #post_terminal, #pre_terminal

Methods included from Display::Base

#create_pango_context, #create_pango_layout, #height, #make_layout, #redraw, #size, #toggle_blackout, #toggle_whiteout, #update_title, #width

Methods included from Display::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?, #redraw, #reset_adjustment, #search_slide, #searching?, #setup_event, #stop_slide_search, #toggle_blackout, #toggle_info_window, #toggle_spotlight, #toggle_whiteout, #whiteouting?

Methods included from DirtyCount

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

Methods included from GetText

included

Constructor Details

#initialize(canvas) ⇒ Screen

Returns a new instance of Screen.


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

def initialize(canvas)
  super
  @filename = nil
  init_ui
end

Instance Attribute Details

#filenameObject

Returns the value of attribute filename.


73
74
75
# File 'lib/rabbit/renderer/screen.rb', line 73

def filename
  @filename
end

Instance Method Details

#attach_to(window, container = nil) ⇒ Object


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

def attach_to(window, container=nil)
  super
  @window.add(@fixed)
  @fixed.show
  attach_key(@window)
end

#clear_slideObject


97
98
99
100
101
# File 'lib/rabbit/renderer/screen.rb', line 97

def clear_slide
  super
  @slide_widget.clear_compiled_slide
  redraw
end

#detachObject


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

def detach
  detach_key(@window)
  @fixed.hide
  super
end

#display?Boolean

TODO: screen?

Returns:

  • (Boolean)

163
164
165
# File 'lib/rabbit/renderer/screen.rb', line 163

def display?
  true
end

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


167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
# File 'lib/rabbit/renderer/screen.rb', line 167

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

  if simulation
    @slide_widget.draw_slide(slide, simulation, &block)
  else
    @slide_widget.save_context do
      @slide_widget.translate_context(@size.logical_margin_left,
                                      @size.logical_margin_top)
      @slide_widget.draw_slide(slide, simulation, &block)
    end

    unless @size.have_logical_margin?
      return
    end

    margin_background = @slide_widget.make_color("black")
    if @size.have_logical_margin_x?
      @slide_widget.draw_rectangle(true,
                                   0,
                                   0,
                                   @size.logical_margin_left,
                                   @size.real_height,
                                   margin_background)
      @slide_widget.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?
      @slide_widget.draw_rectangle(true,
                                   0,
                                   0,
                                   @size.real_width,
                                   @size.logical_margin_top,
                                   margin_background)
      @slide_widget.draw_rectangle(true,
                                   0,
                                   @size.real_height - @size.logical_margin_bottom,
                                   @size.real_width,
                                   @size.logical_margin_bottom,
                                   margin_background)
    end
  end
end

#index_mode_offObject


158
159
160
# File 'lib/rabbit/renderer/screen.rb', line 158

def index_mode_off
  restore_cursor(:index)
end

#index_mode_onObject


153
154
155
156
# File 'lib/rabbit/renderer/screen.rb', line 153

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

#post_apply_themeObject


116
117
118
119
# File 'lib/rabbit/renderer/screen.rb', line 116

def post_apply_theme
  @slide_widget.clear_compiled_slides
  queue_draw
end

#post_fullscreenObject


103
104
105
106
# File 'lib/rabbit/renderer/screen.rb', line 103

def post_fullscreen
  update_cursor(:blank, true)
  @slide_widget.clear_compiled_slides
end

#post_iconifyObject


113
114
# File 'lib/rabbit/renderer/screen.rb', line 113

def post_iconify
end

#post_move(old_index, index) ⇒ Object


121
122
123
# File 'lib/rabbit/renderer/screen.rb', line 121

def post_move(old_index, index)
  queue_draw
end

#post_move_in_slide(old_index, index) ⇒ Object


125
126
127
# File 'lib/rabbit/renderer/screen.rb', line 125

def post_move_in_slide(old_index, index)
  queue_draw
end

#post_parseObject


132
133
134
# File 'lib/rabbit/renderer/screen.rb', line 132

def post_parse
  @slide_widget.clear_compiled_slides
end

#post_to_pixbuf(canceled) ⇒ Object


150
151
# File 'lib/rabbit/renderer/screen.rb', line 150

def post_to_pixbuf(canceled)
end

#post_toggle_index_modeObject


139
140
141
# File 'lib/rabbit/renderer/screen.rb', line 139

def post_toggle_index_mode
  queue_draw
end

#post_unfullscreenObject


108
109
110
111
# File 'lib/rabbit/renderer/screen.rb', line 108

def post_unfullscreen
  update_cursor(nil, true)
  update_menu
end

#pre_parseObject


129
130
# File 'lib/rabbit/renderer/screen.rb', line 129

def pre_parse
end

#pre_to_pixbuf(slide_size) ⇒ Object


143
144
# File 'lib/rabbit/renderer/screen.rb', line 143

def pre_to_pixbuf(slide_size)
end

#pre_toggle_index_modeObject


136
137
# File 'lib/rabbit/renderer/screen.rb', line 136

def pre_toggle_index_mode
end

#to_pixbufing(i) ⇒ Object


146
147
148
# File 'lib/rabbit/renderer/screen.rb', line 146

def to_pixbufing(i)
  true
end

#widgetObject


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

def widget
  @fixed
end