Method: CDK::VIEWER#drawInfo
- Defined in:
- lib/cdk/components/viewer.rb
#drawInfo ⇒ Object
This draws the viewer info lines.
711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 |
# File 'lib/cdk/components/viewer.rb', line 711 def drawInfo temp = '' line_adjust = false # Clear the window. @win.werase self.drawTitle(@win) # Draw in the current line at the top. if @show_line_info == true # Set up the info line and draw it. if @in_progress temp = 'processing...' elsif @list_size != 0 temp = '%d/%d %2.0f%%' % [@current_top + 1, @list_size, ((1.0 * @current_top + 1) / (@list_size)) * 100] else temp = '%d/%d %2.0f%%' % [0, 0, 0.0] end # The list_adjust variable tells us if we have to shift down one line # because the person asked for the line X of Y line at the top of the # screen. We only want to set this to true if they asked for the info # line and there is no title or if the two items overlap. if @title_lines == '' || @title_pos[0] < temp.size + 2 list_adjust = true end Draw.writeChar(@win, 1, if list_adjust then @title_lines else 0 end + 1, temp, CDK::HORIZONTAL, 0, temp.size) end # Determine the last line to draw. last_line = [@list_size, @view_size].min last_line -= if list_adjust then 1 else 0 end # Redraw the list. (0...last_line).each do |x| if @current_top + x < @list_size screen_pos = @list_pos[@current_top + x] + 1 - @left_char Draw.writeChtype(@win, if screen_pos >= 0 then screen_pos else 1 end, x + @title_lines + if list_adjust then 1 else 0 end + 1, @list[x + @current_top], CDK::HORIZONTAL, if screen_pos >= 0 then 0 else @left_char - @list_pos[@current_top + x] end, @list_len[x + @current_top]) end end # Box it if we have to. if @box Draw.drawObjBox(@win, self) wrefresh end # Draw the separation line. if > 0 boxattr = @BXAttr (1..@box_width).each do |x| @win.mvwaddch(@box_height - 3, x, @HZChar | boxattr) end @win.mvwaddch(@box_height - 3, 0, Ncurses::ACS_LTEE | boxattr) @win.mvwaddch(@box_height - 3, @win.getmaxx - 1, Ncurses::ACS_RTEE | boxattr) end # Draw the buttons. This will call refresh on the viewer win. self.drawButtons end |