Class: PM::Geometry

Inherits:
Object
  • Object
show all
Includes:
Curses
Defined in:
lib/patchmaster/curses/geometry.rb

Overview

Defines positions and sizes of windows. Rects contain [height, width, top, left], which is the order used by Curses::Window.new.

Instance Method Summary collapse

Constructor Details

#initializeGeometry

Returns a new instance of Geometry.



9
10
11
12
13
14
15
16
17
18
19
# File 'lib/patchmaster/curses/geometry.rb', line 9

def initialize
  @top_height = (lines() - 1) * 2 / 3
  @bot_height = (lines() - 1) - @top_height
  @top_width = cols() / 3

  @sls_height = @top_height / 3
  @sl_height = @top_height - @sls_height

  @info_width = cols() - (@top_width * 2)
  @info_left = @top_width * 2
end

Instance Method Details

#help_rectObject



49
50
51
# File 'lib/patchmaster/curses/geometry.rb', line 49

def help_rect
  [lines() - 6, cols() - 6, 3, 3]
end

#info_rectObject



45
46
47
# File 'lib/patchmaster/curses/geometry.rb', line 45

def info_rect
  [@top_height, @info_width, 0, @info_left]
end

#message_rectObject



41
42
43
# File 'lib/patchmaster/curses/geometry.rb', line 41

def message_rect
  [1, cols(), lines()-1, 0]
end

#patch_rectObject



37
38
39
# File 'lib/patchmaster/curses/geometry.rb', line 37

def patch_rect
  [@bot_height, cols(), @top_height, 0]
end

#song_list_rectObject



21
22
23
# File 'lib/patchmaster/curses/geometry.rb', line 21

def song_list_rect
  [@sl_height, @top_width, 0, 0]
end

#song_lists_rectObject



29
30
31
# File 'lib/patchmaster/curses/geometry.rb', line 29

def song_lists_rect
  [@sls_height, @top_width, @sl_height, 0]
end

#song_rectObject



25
26
27
# File 'lib/patchmaster/curses/geometry.rb', line 25

def song_rect
  [@sl_height, @top_width, 0, @top_width]
end

#trigger_rectObject



33
34
35
# File 'lib/patchmaster/curses/geometry.rb', line 33

def trigger_rect
  [@sls_height, @top_width, @sl_height, @top_width]
end