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

Includes:
Base, HookHandler
Included in:
ClutterEmbed, DrawingAreaPrimitive, Screen
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, #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 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, #offscreen_canvas, #post_init_gui, #post_terminal, #pre_terminal, #print, #printable?, #reset_adjustment, #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) ⇒ Object



61
62
63
64
# File 'lib/rabbit/renderer/display/base.rb', line 61

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

#create_pango_contextObject



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

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

#create_pango_layout(text) ⇒ Object



94
95
96
97
98
# File 'lib/rabbit/renderer/display/base.rb', line 94

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

#detachObject



66
67
68
69
# File 'lib/rabbit/renderer/display/base.rb', line 66

def detach
  @window = nil
  @container = nil
end

#draw_slide(slide, simulation) ⇒ Object



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
144
145
146
147
148
149
150
151
152
153
154
# File 'lib/rabbit/renderer/display/base.rb', line 104

def draw_slide(slide, simulation)
  set_size_ratio(slide.size_ratio)

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

    unless @size.have_logical_margin?
      return
    end

    margin_background = make_color("black")
    save_context do
      scale_context(*@size.logical_scale)
      if @size.have_logical_margin_x?
        draw_rectangle(true,
                       0,
                       0,
                       @size.logical_margin_left,
                       @size.logical_height,
                       margin_background)
        draw_rectangle(true,
                       @size.logical_margin_left + @size.logical_width,
                       0,
                       @size.logical_margin_right,
                       @size.logical_height,
                       margin_background)
      end
      if @size.have_logical_margin_y?
        draw_rectangle(true,
                       0,
                       0,
                       @size.logical_width,
                       @size.logical_margin_top,
                       margin_background)
        draw_rectangle(true,
                       0,
                       @size.logical_margin_top + @size.logical_height,
                       @size.logical_width,
                       @size.logical_margin_bottom,
                       margin_background)
      end
    end
  end
end

#heightObject



43
44
45
46
47
48
49
50
# File 'lib/rabbit/renderer/display/base.rb', line 43

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

#initialize(*args, &block) ⇒ Object



27
28
29
30
31
32
# File 'lib/rabbit/renderer/display/base.rb', line 27

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

#make_layout(text) ⇒ Object



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

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

#redrawObject



57
58
59
# File 'lib/rabbit/renderer/display/base.rb', line 57

def redraw
  widget.queue_draw
end

#sizeObject



52
53
54
55
# File 'lib/rabbit/renderer/display/base.rb', line 52

def size
  refresh_size
  @size
end

#toggle_blackoutObject



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

def toggle_blackout
  super
  update_menu
end

#toggle_whiteoutObject



71
72
73
74
# File 'lib/rabbit/renderer/display/base.rb', line 71

def toggle_whiteout
  super
  update_menu
end

#update_titleObject



100
101
102
# File 'lib/rabbit/renderer/display/base.rb', line 100

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

#widthObject



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

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