Method: AbstractLayout#_init_layout
- Defined in:
- lib/canis/core/include/layouts/abstractlayout.rb
#_init_layout ⇒ Object
does some initial common calculations that hopefully should be common across layouters so that do_layout can be ovveridden while calling this.
114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 |
# File 'lib/canis/core/include/layouts/abstractlayout.rb', line 114 def _init_layout # when user gives a negative value, we recalc and overwrite so the need to save, for a redraw. @saved_width ||= @width @saved_height ||= @height lines = Ncurses.LINES - 1 columns = Ncurses.COLS - 1 if @height_pc @height = ((lines - @top_margin - @bottom_margin) * @height_pc).floor elsif @saved_height <= 0 @height = lines - @saved_height - @top_margin - @bottom_margin end $log.debug " layout height = #{@height} " if @width_pc @width = ((columns - @left_margin - @right_margin) * width_pc).floor elsif @saved_width <= 0 # if width was -1 we have overwritten it so now we cannot recalc it. it remains the same @width = columns - @saved_width - @left_margin - @right_margin end $log.debug " layout wid = #{@width} " # if user has not specified, then get all the objects @components ||= @form..select do |w| w.visible != false && !@ignore_list.include?(w.class.to_s.downcase); end $log.debug " components #{@components.count} " end |