Class: Rabbit::Front

Inherits:
Object
  • Object
show all
Includes:
MonitorMixin
Defined in:
lib/rabbit/front.rb

Defined Under Namespace

Modules: PublicLevel

Constant Summary collapse

AVAILABLE_INTERFACES =
[]

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(canvas, public_level = nil) ⇒ Front

Returns a new instance of Front.



57
58
59
60
61
62
63
64
65
66
# File 'lib/rabbit/front.rb', line 57

def initialize(canvas, public_level=nil)
  super()
  @canvas = canvas
  @image_type = "png"
  @public_level = public_level || PublicLevel::STRICT
  @previous_width = @canvas.width
  @previous_height = @canvas.height
  setup_public_interface
  clean
end

Instance Attribute Details

#image_typeObject (readonly)

Returns the value of attribute image_type.



55
56
57
# File 'lib/rabbit/front.rb', line 55

def image_type
  @image_type
end

#last_modifiedObject (readonly)

Returns the value of attribute last_modified.



55
56
57
# File 'lib/rabbit/front.rb', line 55

def last_modified
  @last_modified
end

#public_levelObject (readonly)

Returns the value of attribute public_level.



55
56
57
# File 'lib/rabbit/front.rb', line 55

def public_level
  @public_level
end

Instance Method Details

#accept_move?Boolean

Returns:

  • (Boolean)


133
134
135
# File 'lib/rabbit/front.rb', line 133

def accept_move?
  not (@public_level & Front::PublicLevel::MOVE).zero?
end

#append_comment(comment) ⇒ Object



137
138
139
140
141
142
143
# File 'lib/rabbit/front.rb', line 137

def append_comment(comment)
  GLib::Idle.add do
    @canvas.append_comment(comment)
    false
  end
  true
end

#available_interfacesObject



123
124
125
126
127
# File 'lib/rabbit/front.rb', line 123

def available_interfaces
  AVAILABLE_INTERFACES.collect do |name, level, need_clear_cache|
    [name, level, @canvas.method(name).arity]
  end
end

#commentsObject



145
146
147
# File 'lib/rabbit/front.rb', line 145

def comments
  @canvas.comments
end

#current_slide_imageObject



68
69
70
71
# File 'lib/rabbit/front.rb', line 68

def current_slide_image
  update_images_if_need
  @images[@canvas.current_index]
end

#current_slide_numberObject



95
96
97
# File 'lib/rabbit/front.rb', line 95

def current_slide_number
  @canvas.current_index
end

#current_slide_rdObject



78
79
80
81
# File 'lib/rabbit/front.rb', line 78

def current_slide_rd
  slide = @canvas.current_slide
  slide ? slide.to_rd : ""
end

#current_slide_textObject



73
74
75
76
# File 'lib/rabbit/front.rb', line 73

def current_slide_text
  slide = @canvas.current_slide
  slide ? slide.text : ""
end

#first_slide?Boolean

Returns:

  • (Boolean)


99
100
101
# File 'lib/rabbit/front.rb', line 99

def first_slide?
  @canvas.first_slide?
end

#have_next?Boolean

Returns:

  • (Boolean)


111
112
113
# File 'lib/rabbit/front.rb', line 111

def have_next?
  @canvas.have_next?
end

#have_next_slide?Boolean

Returns:

  • (Boolean)


103
104
105
# File 'lib/rabbit/front.rb', line 103

def have_next_slide?
  @canvas.have_next_slide?
end

#have_previous?Boolean

Returns:

  • (Boolean)


115
116
117
# File 'lib/rabbit/front.rb', line 115

def have_previous?
  @canvas.have_previous?
end

#have_previous_slide?Boolean

Returns:

  • (Boolean)


107
108
109
# File 'lib/rabbit/front.rb', line 107

def have_previous_slide?
  @canvas.have_previous_slide?
end

#last_slide?Boolean

Returns:

  • (Boolean)


119
120
121
# File 'lib/rabbit/front.rb', line 119

def last_slide?
  @canvas.last_slide?
end

#slide_titleObject



87
88
89
# File 'lib/rabbit/front.rb', line 87

def slide_title
  @canvas.slide_title
end

#titleObject



83
84
85
# File 'lib/rabbit/front.rb', line 83

def title
  @canvas.title
end

#total_slide_numberObject



91
92
93
# File 'lib/rabbit/front.rb', line 91

def total_slide_number
  @canvas.slide_size
end

#versionObject



129
130
131
# File 'lib/rabbit/front.rb', line 129

def version
  VERSION
end