Class: Hed::MainWnd
- Inherits:
-
Object
- Object
- Hed::MainWnd
- Defined in:
- lib/hed/mainwnd.rb
Instance Method Summary collapse
- #buffer=(buf) ⇒ Object
-
#initialize ⇒ MainWnd
constructor
A new instance of MainWnd.
- #refresh ⇒ Object
Constructor Details
#initialize ⇒ MainWnd
Returns a new instance of MainWnd.
12 13 14 15 16 17 18 19 20 |
# File 'lib/hed/mainwnd.rb', line 12 def initialize @win = Curses::Window.new Curses.lines, Curses.cols, 0, 0 @addrwin = @win.subwin Curses.lines, 8, 0, 0 @binwin = @win.subwin Curses.lines, 16*3+1, 0, 8+2 @textwin = @win.subwin Curses.lines, 16, 0, 8+2 + 16*3+1+2 @win.setpos 0, 10 end |
Instance Method Details
#buffer=(buf) ⇒ Object
22 23 24 |
# File 'lib/hed/mainwnd.rb', line 22 def buffer= buf @buf = buf end |
#refresh ⇒ Object
26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 |
# File 'lib/hed/mainwnd.rb', line 26 def refresh Curses.lines.times do |y| @addrwin.setpos y, 0 @addrwin << '%08xd' % [y*16] end Curses.lines.times do |y| @binwin.setpos y, 0 16.times do |x| @binwin << '%02x ' % @buf[y*16+x].unpack('C') @binwin << ' ' if x == 16/2 - 1 end end Curses.lines.times do |y| @textwin.setpos y, 0 @textwin << @buf[y*16..(y+1)*16].gsub(/[^[:print:]]/, '⌘') end @win.refresh end |