Class: HDLRuby::High::Std::Board::SCOPE

Inherits:
Struct
  • Object
show all
Defined in:
lib/HDLRuby/ui/hruby_board.rb

Overview

Class describing an oscilloscope.

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#hreadObject

Returns the value of attribute hread

Returns:

  • (Object)

    the current value of hread



131
132
133
# File 'lib/HDLRuby/ui/hruby_board.rb', line 131

def hread
  @hread
end

#idObject

Returns the value of attribute id

Returns:

  • (Object)

    the current value of id



131
132
133
# File 'lib/HDLRuby/ui/hruby_board.rb', line 131

def id
  @id
end

#maxObject

Returns the value of attribute max

Returns:

  • (Object)

    the current value of max



131
132
133
# File 'lib/HDLRuby/ui/hruby_board.rb', line 131

def max
  @max
end

#minObject

Returns the value of attribute min

Returns:

  • (Object)

    the current value of min



131
132
133
# File 'lib/HDLRuby/ui/hruby_board.rb', line 131

def min
  @min
end

Instance Method Details

#to_htmlObject



132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
# File 'lib/HDLRuby/ui/hruby_board.rb', line 132

def to_html
  # Prepare the min, max and blank strings.
  min = self.min.to_s
  max = self.max.to_s
  blank = (min.size > max.size) ? min : max;
  # Generate the html.
  return '<div>' +
      '<div class="hdiv"><div class="r-blank">' + blank + '</div>' + # just for adjusting the position with the scope.
        '<div class="scopetitle">' +self.hread.to_s + '</div>\\n' + 
      "</div>\\n" +
      '<div class="scopepane">' +
        '<div class="hdiv">\\n' +
          '<div class="y-range">' + 
            '<div class="u-value">' + max + '</div>' +
            '<div class="d-value">' + min + '</div></div>' +
          '<div class="scope" id=' + self.id.to_s +
            ' data-min="' + min + '" data-max="' + max + '"' + 
            ' data-pos="0" data-previous="0" data-value="0">' +
            '<canvas class="screen"></canvas>' +
          "</div>\\n" +
        "</div>\\n" +
        '<div class="hdiv"><div class="r-blank">' + blank + '</div>' + # just for adjusting the position with the scope.
          '<div class="x-range">' + 
            '<div class="l-value">' + "&nbsp;0&nbsp;" + '</div>' +
            '<div class="r-value">' + "100" + '</div></div>' +
          "</div>\\n" +
        "</div>\\n" +
      "</div>\\n" +
    "</div>\\n"
end