Sha256: 3407ba9a3a46496ead676be00198264dc579ce9c32b37c50dfbac9ea0b0ea3f6

Contents?: true

Size: 1.95 KB

Versions: 31

Compression:

Stored size: 1.95 KB

Contents

@default_headline_line_color ||= "#ff9933"
@default_headline_line_params ||= {}
@default_headline_line_width ||= 1
unless defined?(@default_headline_line_expand)
  @default_headline_line_expand = false
end

match(Slide) do |slides|
  slides.each do |slide|
    slide.margin_set(@margin_top, @margin_right, @margin_bottom, @margin_left)
  end
end

match(Slide, HeadLine) do |headlines|
  name = "head-line"

  delete_post_draw_proc_by_name(name)

  space = @space / 2.0
  top_space = space + @default_headline_line_width / 2.0
  margin_with(:bottom => top_space * 2)
  add_post_draw_proc(name) do |headline, canvas, x, y, w, h, simulation|
    unless simulation
      if @default_headline_line_expand
        line_x, line_w = 0, canvas.width
      else
        line_x, line_w = x, w
      end
      if @default_headline_line_params.respond_to?(:call)
        params = @default_headline_line_params.call(headline, canvas,
                                                    line_x, y + top_space,
                                                    line_w, h - top_space)
      else
        params = @default_headline_line_params
      end
      canvas.draw_line(line_x, y + top_space, line_x + line_w, y + top_space,
                       @default_headline_line_color,
                       params.merge(:line_width => @default_headline_line_width))
    end
    [x, y, w, h]
  end

  headlines.each do |headline|
    slide = headline.slide
    headline.hide if slide.hide_title?
    color = slide["headline-color"]
    headline.font("color", color) if color
    shadow_color = slide["headline-shadow-color"]
    headline.font("shadow-color" => shadow_color) if shadow_color
    align = slide["headline-align"]
    headline.align = align if align
  end
end

match(Slide, Body) do |bodies|
  bodies.each do |body|
    unless body.elements.any? {|element| element.is_a?(Image)}
      body.margin_with(:left => @body_margin_left,
                       :right => @body_margin_right)
    end
  end
end

Version data entries

31 entries across 31 versions & 1 rubygems

Version Path
rabbit-3.0.3 lib/rabbit/theme/default-slide/default-slide.rb
rabbit-3.0.2 lib/rabbit/theme/default-slide/default-slide.rb
rabbit-3.0.1 lib/rabbit/theme/default-slide/default-slide.rb
rabbit-3.0.0 lib/rabbit/theme/default-slide/default-slide.rb
rabbit-2.2.1 lib/rabbit/theme/default-slide/default-slide.rb
rabbit-2.2.0 lib/rabbit/theme/default-slide/default-slide.rb
rabbit-2.1.9 lib/rabbit/theme/default-slide/default-slide.rb
rabbit-2.1.8 lib/rabbit/theme/default-slide/default-slide.rb
rabbit-2.1.7 lib/rabbit/theme/default-slide/default-slide.rb
rabbit-2.1.6 lib/rabbit/theme/default-slide/default-slide.rb
rabbit-2.1.5 lib/rabbit/theme/default-slide/default-slide.rb
rabbit-2.1.4 lib/rabbit/theme/default-slide/default-slide.rb
rabbit-2.1.3 lib/rabbit/theme/default-slide/default-slide.rb
rabbit-2.1.2 lib/rabbit/theme/default-slide/default-slide.rb
rabbit-2.1.1 lib/rabbit/theme/default-slide/default-slide.rb
rabbit-2.1.0 lib/rabbit/theme/default-slide/default-slide.rb
rabbit-2.0.9 lib/rabbit/theme/default-slide/default-slide.rb
rabbit-2.0.8 lib/rabbit/theme/default-slide/default-slide.rb
rabbit-2.0.7 lib/rabbit/theme/default-slide/default-slide.rb
rabbit-2.0.6 lib/rabbit/theme/default-slide/default-slide.rb