aboutsummaryrefslogtreecommitdiff
path: root/monitor.rb
diff options
context:
space:
mode:
Diffstat (limited to 'monitor.rb')
-rw-r--r--monitor.rb20
1 files changed, 10 insertions, 10 deletions
diff --git a/monitor.rb b/monitor.rb
index 65df79f..c2a57f8 100644
--- a/monitor.rb
+++ b/monitor.rb
@@ -5,11 +5,11 @@ require_relative 'ini_read'
5require_relative 'windows' 5require_relative 'windows'
6require_relative 'buffer' 6require_relative 'buffer'
7 7
8def make_bufwins(sections) 8def make_bufwins(sections,size)
9 bufwins = [] 9 bufwins = []
10 sections.each { |section_name,section| 10 sections.each { |section_name,section|
11 bufwin = Buff_Win.new(Ncurses.COLS()-Ncurses.COLS()/4, 11 bufwin = Buff_Win.new(Ncurses.COLS()-size*Ncurses.COLS()/100,
12 Ncurses.COLS()/4, 12 size*Ncurses.COLS()/100,
13 section) 13 section)
14 bufwins.push(bufwin) 14 bufwins.push(bufwin)
15 } 15 }
@@ -22,11 +22,11 @@ def update_buffers(bufwins)
22 end 22 end
23end 23end
24 24
25def redraw_all(list,bufwins,curr_bufwin) 25def redraw_all(list,bufwins,curr_bufwin, size)
26 bufwins.each do |bufwin| 26 bufwins.each do |bufwin|
27 bufwin.move_resize(Ncurses.COLS()-Ncurses.COLS()/4,Ncurses.COLS()/4) 27 bufwin.move_resize(Ncurses.COLS()-size*Ncurses.COLS()/100,size*Ncurses.COLS()/100)
28 end 28 end
29 list.resize(Ncurses.LINES(), Ncurses.COLS()/4) 29 list.resize(Ncurses.LINES(), size*Ncurses.COLS()/100)
30 list.clear() 30 list.clear()
31 list.print_list() 31 list.print_list()
32 list.refresh() 32 list.refresh()
@@ -48,8 +48,8 @@ begin
48 Ncurses.init_pair(10, Ncurses::COLOR_WHITE, Ncurses::COLOR_BLACK) 48 Ncurses.init_pair(10, Ncurses::COLOR_WHITE, Ncurses::COLOR_BLACK)
49 49
50 50
51 list = List_Win.new(inistruct.sections) 51 list = List_Win.new(inistruct.sections, inistruct.global['list_size'])
52 bufwins = make_bufwins(inistruct.sections) 52 bufwins = make_bufwins(inistruct.sections, inistruct.global['list_size'])
53 entry = 0 53 entry = 0
54 cur_bufwin = bufwins[entry] 54 cur_bufwin = bufwins[entry]
55 cur_bufwin.show_win() 55 cur_bufwin.show_win()
@@ -67,11 +67,11 @@ begin
67 cur_bufwin.show_win() 67 cur_bufwin.show_win()
68 list.print_list(entry=entry) 68 list.print_list(entry=entry)
69 when 12 #ctrl+L 69 when 12 #ctrl+L
70 redraw_all(list,bufwins,cur_bufwin) 70 redraw_all(list,bufwins,cur_bufwin, inistruct.global['list_size'])
71 when 18 #ctrl+R 71 when 18 #ctrl+R
72 cur_bufwin.update(force=true) 72 cur_bufwin.update(force=true)
73 when Ncurses::KEY_RESIZE 73 when Ncurses::KEY_RESIZE
74 redraw_all(list,bufwins,cur_bufwin) 74 redraw_all(list,bufwins,cur_bufwin, inistruct.global['list_size'])
75 when Ncurses::KEY_LEFT 75 when Ncurses::KEY_LEFT
76 cur_bufwin.hscroll(scroll=-1) 76 cur_bufwin.hscroll(scroll=-1)
77 when Ncurses::KEY_RIGHT 77 when Ncurses::KEY_RIGHT