Class: Zgomot::UI::StrWindow
Instance Attribute Summary collapse
-
#current ⇒ Object
readonly
Returns the value of attribute current.
-
#height ⇒ Object
readonly
Returns the value of attribute height.
-
#rows ⇒ Object
readonly
Returns the value of attribute rows.
-
#select_mode ⇒ Object
readonly
Returns the value of attribute select_mode.
-
#selected ⇒ Object
readonly
Returns the value of attribute selected.
-
#top ⇒ Object
readonly
Returns the value of attribute top.
-
#widths ⇒ Object
readonly
Returns the value of attribute widths.
-
#window ⇒ Object
readonly
Returns the value of attribute window.
Instance Method Summary collapse
- #dec_selected ⇒ Object
- #delete ⇒ Object
- #display ⇒ Object
- #inc_selected ⇒ Object
-
#initialize(height, top) ⇒ StrWindow
constructor
A new instance of StrWindow.
- #select ⇒ Object
- #set_select_mode ⇒ Object
- #tog ⇒ Object
Constructor Details
#initialize(height, top) ⇒ StrWindow
Returns a new instance of StrWindow.
175 176 177 178 179 180 181 |
# File 'lib/zgomot/ui/windows.rb', line 175 def initialize(height, top) @select_mode, @selected, @top, @current, @height = false, [], top, 0, height @widths = Zgomot::UI::Output::STREAM_OUTPUT_FORMAT_WIDTHS TitleWindow.new('Streams', COLOR_BORDER, top, COLOR_BLUE) TableRowWindow.new(Zgomot::UI::Output::STREAM_HEADER, widths, COLOR_BORDER, top + 3, COLOR_BORDER) add_streams(top + 3) end |
Instance Attribute Details
#current ⇒ Object (readonly)
Returns the value of attribute current.
174 175 176 |
# File 'lib/zgomot/ui/windows.rb', line 174 def current @current end |
#height ⇒ Object (readonly)
Returns the value of attribute height.
174 175 176 |
# File 'lib/zgomot/ui/windows.rb', line 174 def height @height end |
#rows ⇒ Object (readonly)
Returns the value of attribute rows.
174 175 176 |
# File 'lib/zgomot/ui/windows.rb', line 174 def rows @rows end |
#select_mode ⇒ Object (readonly)
Returns the value of attribute select_mode.
174 175 176 |
# File 'lib/zgomot/ui/windows.rb', line 174 def select_mode @select_mode end |
#selected ⇒ Object (readonly)
Returns the value of attribute selected.
174 175 176 |
# File 'lib/zgomot/ui/windows.rb', line 174 def selected @selected end |
#top ⇒ Object (readonly)
Returns the value of attribute top.
174 175 176 |
# File 'lib/zgomot/ui/windows.rb', line 174 def top @top end |
#widths ⇒ Object (readonly)
Returns the value of attribute widths.
174 175 176 |
# File 'lib/zgomot/ui/windows.rb', line 174 def widths @widths end |
#window ⇒ Object (readonly)
Returns the value of attribute window.
174 175 176 |
# File 'lib/zgomot/ui/windows.rb', line 174 def window @window end |
Instance Method Details
#dec_selected ⇒ Object
197 198 199 200 201 |
# File 'lib/zgomot/ui/windows.rb', line 197 def dec_selected if select_mode @current = (current - 1) % streams.length end end |
#delete ⇒ Object
224 225 226 227 228 229 |
# File 'lib/zgomot/ui/windows.rb', line 224 def delete selected.each do |s| stream = streams[s] Zgomot::Midi::Stream.delete(stream.name) end end |
#display ⇒ Object
182 183 184 185 186 187 188 189 190 191 |
# File 'lib/zgomot/ui/windows.rb', line 182 def display if streams.length == rows.length (0..streams.length-1).each do |i| stream = streams[i] rows[i].display(stream.info, stream_color(stream, i)) end else add_streams(top + 3) end end |
#inc_selected ⇒ Object
192 193 194 195 196 |
# File 'lib/zgomot/ui/windows.rb', line 192 def inc_selected if select_mode @current = (current + 1) % streams.length end end |
#select ⇒ Object
202 203 204 205 206 207 208 |
# File 'lib/zgomot/ui/windows.rb', line 202 def select if selected.include?(current) @selected.delete(current) else @selected << current end end |
#set_select_mode ⇒ Object
209 210 211 212 213 214 215 216 217 |
# File 'lib/zgomot/ui/windows.rb', line 209 def set_select_mode if select_mode @select_mode = false @selected = [] @current = 0 else @select_mode = true end end |