Class: Zgomot::UI::StrWindow

Inherits:
Object
  • Object
show all
Defined in:
lib/zgomot/ui/windows.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(top) ⇒ StrWindow

Returns a new instance of StrWindow.



160
161
162
163
164
165
166
# File 'lib/zgomot/ui/windows.rb', line 160

def initialize(top)
  @tog_mode, @selected = false, 0
  @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

#rowsObject (readonly)

Returns the value of attribute rows.



159
160
161
# File 'lib/zgomot/ui/windows.rb', line 159

def rows
  @rows
end

#selectedObject (readonly)

Returns the value of attribute selected.



159
160
161
# File 'lib/zgomot/ui/windows.rb', line 159

def selected
  @selected
end

#tog_modeObject (readonly)

Returns the value of attribute tog_mode.



159
160
161
# File 'lib/zgomot/ui/windows.rb', line 159

def tog_mode
  @tog_mode
end

#widthsObject (readonly)

Returns the value of attribute widths.



159
160
161
# File 'lib/zgomot/ui/windows.rb', line 159

def widths
  @widths
end

#windowObject (readonly)

Returns the value of attribute window.



159
160
161
# File 'lib/zgomot/ui/windows.rb', line 159

def window
  @window
end

Instance Method Details

#dec_selectedObject



178
179
180
181
182
# File 'lib/zgomot/ui/windows.rb', line 178

def dec_selected
  if tog_mode
    @selected = (selected - 1) % streams.length
  end
end

#displayObject



167
168
169
170
171
172
# File 'lib/zgomot/ui/windows.rb', line 167

def display
  (0..streams.length-1).each do |i|
    stream = streams[i]
    rows[i].display(stream.info, stream_color(stream, i))
  end
end

#inc_selectedObject



173
174
175
176
177
# File 'lib/zgomot/ui/windows.rb', line 173

def inc_selected
  if tog_mode
   @selected = (selected + 1) % streams.length
  end
end

#set_tog_modeObject



183
184
185
186
# File 'lib/zgomot/ui/windows.rb', line 183

def set_tog_mode
  @selected = 0
  @tog_mode = tog_mode ? false : true
end

#togObject



187
188
189
190
191
# File 'lib/zgomot/ui/windows.rb', line 187

def tog
  stream = streams[selected]
  Zgomot::Midi::Stream.tog(stream.name)
  set_tog_mode
end