Browse Source

Fixing globally togglable text hints

dev
Andy Meneely 11 years ago
parent
commit
985c925d99
  1. 3
      lib/squib/api/settings.rb
  2. 1
      lib/squib/deck.rb
  3. 2
      lib/squib/graphics/text.rb

3
lib/squib/api/settings.rb

@ -7,10 +7,9 @@ module Squib
# Setting a hint to nil or to :off will disable hints. @see samples/text.rb
# @example
# hint text: :cyan
# hint text: :cyan, progress_bar: true
# hint text: :cyan
#
# @param [String] text the color of the text hint. To turn off use :off. @see README.md
# @param [Boolean] progress_bar enable progress bars on long-running operations
# @return [nil] Returns nothing
# @api public
def hint(text: :off)

1
lib/squib/deck.rb

@ -60,6 +60,7 @@ module Squib
@custom_colors = {}
@img_dir = '.'
@progress_bar = Squib::Progress.new(false)
@text_hint = :off
cards.times{ @cards << Squib::Card.new(self, width, height) }
load_config(config)
load_layout(layout)

2
lib/squib/graphics/text.rb

@ -6,7 +6,7 @@ module Squib
# :nodoc:
# @api private
def draw_text_hint(x,y,layout, color)
color ||= @deck.text_hint
color = @deck.text_hint if color.to_s.eql? 'off' and not @deck.text_hint.to_s.eql? 'off'
return if color.to_s.eql? 'off'
# when w,h < 0, it was never set. extents[1] are ink extents
w = layout.width / Pango::SCALE

Loading…
Cancel
Save