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.



78
79
80
81
82
83
84
85
86
87
# File 'lib/rabbit/front.rb', line 78

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.



76
77
78
# File 'lib/rabbit/front.rb', line 76

def image_type
  @image_type
end

#last_modifiedObject (readonly)

Returns the value of attribute last_modified.



76
77
78
# File 'lib/rabbit/front.rb', line 76

def last_modified
  @last_modified
end

#public_levelObject (readonly)

Returns the value of attribute public_level.



76
77
78
# File 'lib/rabbit/front.rb', line 76

def public_level
  @public_level
end

Instance Method Details

#accept_move?Boolean

Returns:

  • (Boolean)


154
155
156
# File 'lib/rabbit/front.rb', line 154

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

#append_comment(comment) ⇒ Object



158
159
160
161
162
163
164
# File 'lib/rabbit/front.rb', line 158

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

#available_interfacesObject



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

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

#commentsObject



166
167
168
# File 'lib/rabbit/front.rb', line 166

def comments
  @canvas.comments
end

#current_slide_imageObject



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

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

#current_slide_numberObject



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

def current_slide_number
  @canvas.current_index
end

#current_slide_rdObject



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

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

#current_slide_textObject



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

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

#first_slide?Boolean

Returns:

  • (Boolean)


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

def first_slide?
  @canvas.first_slide?
end

#have_next?Boolean

Returns:

  • (Boolean)


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

def have_next?
  @canvas.have_next?
end

#have_next_slide?Boolean

Returns:

  • (Boolean)


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

def have_next_slide?
  @canvas.have_next_slide?
end

#have_previous?Boolean

Returns:

  • (Boolean)


136
137
138
# File 'lib/rabbit/front.rb', line 136

def have_previous?
  @canvas.have_previous?
end

#have_previous_slide?Boolean

Returns:

  • (Boolean)


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

def have_previous_slide?
  @canvas.have_previous_slide?
end

#last_slide?Boolean

Returns:

  • (Boolean)


140
141
142
# File 'lib/rabbit/front.rb', line 140

def last_slide?
  @canvas.last_slide?
end

#slide_titleObject



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

def slide_title
  @canvas.slide_title
end

#titleObject



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

def title
  @canvas.title
end

#total_slide_numberObject



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

def total_slide_number
  @canvas.slide_size
end

#versionObject



150
151
152
# File 'lib/rabbit/front.rb', line 150

def version
  VERSION
end