Class: Zgomot::UI::MainWindow
Class Attribute Summary collapse
-
.cc_window ⇒ Object
readonly
Returns the value of attribute cc_window.
-
.error_window ⇒ Object
readonly
Returns the value of attribute error_window.
-
.globals_window ⇒ Object
readonly
Returns the value of attribute globals_window.
-
.main_window ⇒ Object
readonly
Returns the value of attribute main_window.
-
.str_window ⇒ Object
readonly
Returns the value of attribute str_window.
Class Method Summary collapse
Class Attribute Details
.cc_window ⇒ Object (readonly)
Returns the value of attribute cc_window.
42 43 44 |
# File 'lib/zgomot/ui/windows.rb', line 42 def cc_window @cc_window end |
.error_window ⇒ Object (readonly)
Returns the value of attribute error_window.
42 43 44 |
# File 'lib/zgomot/ui/windows.rb', line 42 def error_window @error_window end |
.globals_window ⇒ Object (readonly)
Returns the value of attribute globals_window.
42 43 44 |
# File 'lib/zgomot/ui/windows.rb', line 42 def globals_window @globals_window end |
.main_window ⇒ Object (readonly)
Returns the value of attribute main_window.
42 43 44 |
# File 'lib/zgomot/ui/windows.rb', line 42 def main_window @main_window end |
.str_window ⇒ Object (readonly)
Returns the value of attribute str_window.
42 43 44 |
# File 'lib/zgomot/ui/windows.rb', line 42 def str_window @str_window end |
Class Method Details
.dash ⇒ Object
90 91 92 93 94 95 96 97 98 99 100 101 102 103 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 |
# File 'lib/zgomot/ui/windows.rb', line 90 def dash init_curses @globals_window = GlobalsWindow.new(0) str_height = 2*(Curses.lines - GLOBALS_HEIGHT - ERROR_WINDOW_HEIGHT)/3 @cc_window = CCWindow.new(Curses.lines - str_height - GLOBALS_HEIGHT - ERROR_WINDOW_HEIGHT, str_height + GLOBALS_HEIGHT) @str_window = StrWindow.new(str_height, GLOBALS_HEIGHT) @error_window = ErrorWindow.new(Curses.lines - ERROR_WINDOW_HEIGHT) Curses.refresh poll loop do begin case Curses.getch when ?t str_window.tog str_window.set_select_mode update when ?d str_window.delete str_window.set_select_mode update when Curses::Key::UP str_window.dec_selected update when Curses::Key::DOWN str_window.inc_selected update when 10 str_window.select update when ?p Zgomot::Midi::Stream.play update when ?s Zgomot::Midi::Stream.stop update when ?q @thread.kill Curses.close_screen break end rescue Exception => e Zgomot.set_last_error(e.) end end end |
.init_curses ⇒ Object
43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 |
# File 'lib/zgomot/ui/windows.rb', line 43 def init_curses Curses.init_screen Curses.noecho Curses.stdscr.keypad(true) Curses.start_color Curses.curs_set(0) Curses.init_color(COLOR_GREY, 700, 700, 700) Curses.init_color(COLOR_GOLD, 1000, 840, 0) Curses.init_color(COLOR_GREEN, 484, 980, 0) Curses.init_color(COLOR_PINK, 1000, 100, 575) Curses.init_color(COLOR_BLUE, 117, 575, 1000) Curses.init_color(COLOR_VIOLET, 810, 410, 980) Curses.init_color(COLOR_MAGENTA, 1000, 200, 1000) Curses.init_color(COLOR_YELLOW_GREEN, 750, 980, 410) Curses.init_color(COLOR_LIGHT_BLUE,600, 1000, 1000) Curses.init_color(COLOR_ORANGE,1000 , 600, 0) Curses.init_color(COLOR_RED, 750, 0, 0) Curses.init_pair(COLOR_GOLD,COLOR_GOLD,COLOR_BLACK) Curses.init_pair(COLOR_GREEN,COLOR_GREEN,COLOR_BLACK) Curses.init_pair(COLOR_PINK,COLOR_PINK,COLOR_BLACK) Curses.init_pair(COLOR_BLUE,COLOR_BLUE,COLOR_BLACK) Curses.init_pair(COLOR_BORDER,COLOR_GREY,COLOR_BLACK) Curses.init_pair(COLOR_IDLE,COLOR_GOLD,COLOR_BLACK) Curses.init_pair(COLOR_ACTIVE,COLOR_GREEN,COLOR_BLACK) Curses.init_pair(COLOR_STREAM_PLAYING_SELECTED,COLOR_BLACK,COLOR_GREEN) Curses.init_pair(COLOR_STREAM_PAUSED_SELECTED,COLOR_BLACK,COLOR_GOLD) Curses.init_pair(COLOR_CC_SWITCH_TRUE,COLOR_ORANGE,COLOR_BLACK) Curses.init_pair(COLOR_CC_SWITCH_FALSE,COLOR_LIGHT_BLUE,COLOR_BLACK) Curses.init_pair(COLOR_CC_IDLE,COLOR_VIOLET,COLOR_BLACK) Curses.init_pair(COLOR_CC_ACTIVE,COLOR_BLACK,COLOR_VIOLET) Curses.init_pair(COLOR_ERROR,COLOR_RED,COLOR_BLACK) end |
.poll ⇒ Object
82 83 84 85 86 87 88 89 |
# File 'lib/zgomot/ui/windows.rb', line 82 def poll @thread = Thread.new do loop do update sleep(Zgomot::Midi::Clock.beat_sec) end end end |
.update ⇒ Object
75 76 77 78 79 80 81 |
# File 'lib/zgomot/ui/windows.rb', line 75 def update globals_window.display cc_window.display str_window.display error_window.display Curses.refresh end |