~ubuntu-branches/ubuntu/vivid/rabbit/vivid

« back to all changes in this revision

Viewing changes to lib/rabbit/theme/default-foot-text/default-foot-text.rb

  • Committer: Bazaar Package Importer
  • Author(s): Youhei SASAKI
  • Date: 2009-07-22 22:15:37 UTC
  • Revision ID: james.westby@ubuntu.com-20090722221537-iy7foj73p2kyuumi
Tags: upstream-0.6.1
ImportĀ upstreamĀ versionĀ 0.6.1

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
@foot_text_block_line_color ||= "#ff9933"
 
2
@foot_text_block_line_width ||= 1
 
3
@foot_text_block_line_length_ratio ||= 0.5
 
4
 
 
5
match("**", FootTextBlock) do
 
6
  name = "foot-text-block"
 
7
  space = @space / 2.0
 
8
 
 
9
  delete_pre_draw_proc_by_name(name)
 
10
  each do |block|
 
11
    unless block.elements.empty?
 
12
      block.margin_with(:top => space * 3)
 
13
 
 
14
      block.add_pre_draw_proc(name) do |canvas, x, y, w, h, simulation|
 
15
        unless simulation
 
16
          args = [
 
17
            x,
 
18
            y - space * 2,
 
19
            (x + w * @foot_text_block_line_length_ratio).ceil,
 
20
            y - space * 2,
 
21
            @foot_text_block_line_color,
 
22
            {:line_width => @foot_text_block_line_width},
 
23
          ]
 
24
          canvas.draw_line(*args)
 
25
        end
 
26
        [x, y, w, h]
 
27
      end
 
28
    end
 
29
  end
 
30
end
 
31
 
 
32
match("**", FootText) do
 
33
  each do |text|
 
34
    if text["order_added"]
 
35
      order_text = text.elements.first
 
36
    else
 
37
      order_text = Text.new("(*#{text.order})")
 
38
      text.unshift(order_text)
 
39
      text["order_added"] = true
 
40
    end
 
41
    order_text.prop_set("foreground", "blue")
 
42
    order_text.prop_set("size", @script_font_size)
 
43
    order_text.prop_set("rise", (@script_font_size / 2.0).ceil)
 
44
  end
 
45
end
 
46
 
 
47
match("**", Footnote) do
 
48
  prop_set("foreground", "blue")
 
49
  each do |note|
 
50
    note.text = "(*#{note.order})"
 
51
  end
 
52
end