rabbit 0.6.3 → 0.6.4
Sign up to get free protection for your applications and to get access to all the features.
- data/NEWS.en +87 -1
- data/NEWS.ja +87 -1
- data/README.en +3 -1
- data/README.ja +5 -3
- data/bin/rabbit +18 -0
- data/lib/rabbit/canvas.rb +4 -1
- data/lib/rabbit/element/base.rb +1 -1
- data/lib/rabbit/element/image.rb +4 -0
- data/lib/rabbit/element/text-renderer.rb +27 -9
- data/lib/rabbit/frame.rb +18 -3
- data/lib/rabbit/html/generator.rb +7 -2
- data/lib/rabbit/parser/pdf.rb +1 -1
- data/lib/rabbit/rabbit.rb +1 -1
- data/lib/rabbit/renderer/display/drawing-area-base.rb +6 -2
- data/lib/rabbit/theme/applier.rb +12 -0
- data/lib/rabbit/theme/default-slide/default-slide.rb +10 -2
- data/lib/rabbit/theme/entry.rb +40 -7
- data/lib/rabbit/theme/per-slide-background-color/per-slide-background-color.rb +18 -0
- data/lib/rabbit/theme/per-slide-background-color/property.rb +16 -0
- data/lib/rabbit/theme/per-slide-background-image/per-slide-background-image.rb +39 -0
- data/lib/rabbit/theme/per-slide-background-image/property.rb +16 -0
- data/lib/rabbit/theme/searcher.rb +21 -7
- data/lib/rabbit/theme/title-shadow/title-shadow.rb +1 -27
- data/po/en/rabbit.po +238 -189
- data/po/fr/rabbit.po +239 -189
- data/po/ja/rabbit.po +240 -195
- metadata +27 -3
@@ -0,0 +1,18 @@
|
|
1
|
+
proc_name = "per-slide-background-color"
|
2
|
+
|
3
|
+
match(Slide) do |slides|
|
4
|
+
slides.each do |slide|
|
5
|
+
slide.delete_pre_draw_proc_by_name(proc_name)
|
6
|
+
|
7
|
+
background_color = slide["background-color"]
|
8
|
+
next if background_color.nil?
|
9
|
+
|
10
|
+
slide.add_pre_draw_proc(proc_name) do |canvas, x, y, w, h, simulation|
|
11
|
+
unless simulation
|
12
|
+
canvas.draw_rectangle(true, 0, 0, canvas.width, canvas.height,
|
13
|
+
background_color)
|
14
|
+
end
|
15
|
+
[x, y, w, h]
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
@@ -0,0 +1,16 @@
|
|
1
|
+
@category = N_("Toolkit")
|
2
|
+
@title = N_("PerSlideBackgroundColor")
|
3
|
+
@abstract = N_("Toolkit to set background color of each slide")
|
4
|
+
@description = N_("Set background color of each slide.\n" \
|
5
|
+
"\n" \
|
6
|
+
"Each image is specified as a slide property:\n" \
|
7
|
+
" = target slide\n" \
|
8
|
+
" \n" \
|
9
|
+
" ...\n" \
|
10
|
+
" \n" \
|
11
|
+
" == properties\n" \
|
12
|
+
" \n" \
|
13
|
+
" : background-color\n" \
|
14
|
+
" black\n")
|
15
|
+
@parameters = {
|
16
|
+
}
|
@@ -0,0 +1,39 @@
|
|
1
|
+
proc_name = "per-slide-background-image"
|
2
|
+
|
3
|
+
match(Slide) do |slides|
|
4
|
+
slides.each do |slide|
|
5
|
+
slide.delete_pre_draw_proc_by_name(proc_name)
|
6
|
+
|
7
|
+
background_image = slide["background-image"]
|
8
|
+
next if background_image.nil?
|
9
|
+
|
10
|
+
properties = {}
|
11
|
+
slide.user_property.each do |name, value|
|
12
|
+
if /\Abackground-image-/ =~ name
|
13
|
+
properties[$POSTMATCH.gsub(/-/, '_')] = value
|
14
|
+
end
|
15
|
+
end
|
16
|
+
image = Image.new(canvas.full_path(background_image), properties)
|
17
|
+
image.horizontal_centering = true
|
18
|
+
image.vertical_centering = true
|
19
|
+
slide.add_pre_draw_proc(proc_name) do |canvas, x, y, w, h, simulation|
|
20
|
+
if simulation
|
21
|
+
_x, _y, _w, _h = 0, 0, canvas.width, canvas.height
|
22
|
+
image.compile(canvas, _x, _y, _w, _h)
|
23
|
+
if image.do_vertical_centering?
|
24
|
+
adjust_height = ((_h - image.height - image.padding_bottom) / 2.0).ceil
|
25
|
+
if _y + adjust_height > 0
|
26
|
+
_y += adjust_height
|
27
|
+
_h -= adjust_height
|
28
|
+
image.compile(canvas, _x, _y, _w, _h)
|
29
|
+
end
|
30
|
+
end
|
31
|
+
if image.do_horizontal_centering?
|
32
|
+
image.do_horizontal_centering(canvas, _x, _y, _w, _h)
|
33
|
+
end
|
34
|
+
end
|
35
|
+
image.draw(simulation)
|
36
|
+
[x, y, w, h]
|
37
|
+
end
|
38
|
+
end
|
39
|
+
end
|
@@ -0,0 +1,16 @@
|
|
1
|
+
@category = N_("Toolkit")
|
2
|
+
@title = N_("PerSlideBackgroundImage")
|
3
|
+
@abstract = N_("Toolkit to display an image as a background of each slide")
|
4
|
+
@description = N_("Displays an image as a background of each slide.\n" \
|
5
|
+
"\n" \
|
6
|
+
"Each image is specified as a slide property:\n" \
|
7
|
+
" = target slide\n" \
|
8
|
+
" \n" \
|
9
|
+
" ...\n" \
|
10
|
+
" \n" \
|
11
|
+
" == properties\n" \
|
12
|
+
" \n" \
|
13
|
+
" : background-image\n" \
|
14
|
+
" my-picture.png\n")
|
15
|
+
@parameters = {
|
16
|
+
}
|
@@ -46,6 +46,12 @@ module Rabbit
|
|
46
46
|
else
|
47
47
|
collector = "collect_all_theme"
|
48
48
|
end
|
49
|
+
|
50
|
+
unless only_image
|
51
|
+
entry = SingleFileEntry.new(base_directory, theme_name)
|
52
|
+
return entry if entry.available?
|
53
|
+
end
|
54
|
+
|
49
55
|
found_entry = nil
|
50
56
|
__send__(collector) do |entry|
|
51
57
|
if theme_name == entry.name
|
@@ -53,6 +59,7 @@ module Rabbit
|
|
53
59
|
break
|
54
60
|
end
|
55
61
|
end
|
62
|
+
|
56
63
|
raise LoadError, "can't find theme: #{theme_name}." if found_entry.nil?
|
57
64
|
found_entry
|
58
65
|
end
|
@@ -86,15 +93,22 @@ module Rabbit
|
|
86
93
|
end
|
87
94
|
|
88
95
|
def collect_theme(&block)
|
89
|
-
_collect_theme(
|
96
|
+
_collect_theme(theme_load_path, DirectoryEntry, &block)
|
90
97
|
end
|
91
98
|
|
92
99
|
def collect_image_theme(&block)
|
93
|
-
_collect_theme(
|
94
|
-
"image_dir", :image, &block)
|
100
|
+
_collect_theme(image_load_path, ImageDirectoryEntry, "image_dir", &block)
|
95
101
|
end
|
96
|
-
|
97
|
-
def
|
102
|
+
|
103
|
+
def theme_load_path
|
104
|
+
$LOAD_PATH
|
105
|
+
end
|
106
|
+
|
107
|
+
def image_load_path
|
108
|
+
Config::IMAGE_PATH + $LOAD_PATH
|
109
|
+
end
|
110
|
+
|
111
|
+
def _collect_theme(path, entry_class, converter=nil, &block)
|
98
112
|
converter ||= "theme_dir"
|
99
113
|
themes = []
|
100
114
|
theme_name = {}
|
@@ -103,8 +117,8 @@ module Rabbit
|
|
103
117
|
if File.directory?(base_name)
|
104
118
|
Dir.foreach(base_name) do |theme|
|
105
119
|
next if /\A..?\z/ =~ theme
|
106
|
-
|
107
|
-
|
120
|
+
file = File.join(File.expand_path(base_name), theme)
|
121
|
+
entry = entry_class.new(file)
|
108
122
|
if entry.available? and !theme_name.has_key?(theme)
|
109
123
|
block.call(entry) if block
|
110
124
|
themes << entry
|
@@ -3,31 +3,5 @@ proc_name = "title-shadow"
|
|
3
3
|
@title_shadow_color ||= "#6f6f6fcc"
|
4
4
|
|
5
5
|
match(TitleSlide, Title) do |titles|
|
6
|
-
|
7
|
-
shadow_layout = nil
|
8
|
-
move_x = nil
|
9
|
-
move_y = nil
|
10
|
-
|
11
|
-
titles.delete_pre_draw_proc_by_name(proc_name)
|
12
|
-
|
13
|
-
titles.add_pre_draw_proc(proc_name) do |title, canvas, x, y, w, h, simulation|
|
14
|
-
unless simulation
|
15
|
-
if shadow_layout.nil?
|
16
|
-
font_size = title.pixel_font_size
|
17
|
-
move_x = screen_x(font_size.to_f / screen_size(10))
|
18
|
-
move_y = screen_y(font_size.to_f / screen_size(20))
|
19
|
-
|
20
|
-
shadow_title = title.clone
|
21
|
-
shadow_title.font :color => nil
|
22
|
-
shadow_layout = canvas.make_layout(shadow_title.markuped_text)
|
23
|
-
shadow_layout.set_width(w * Pango::SCALE)
|
24
|
-
if title.do_horizontal_centering?
|
25
|
-
shadow_layout.set_alignment(Pango::Layout::ALIGN_CENTER)
|
26
|
-
end
|
27
|
-
end
|
28
|
-
args = [shadow_layout, x + move_x, y + move_y, @title_shadow_color]
|
29
|
-
canvas.draw_layout(*args)
|
30
|
-
end
|
31
|
-
[x, y, w, h]
|
32
|
-
end
|
6
|
+
titles[0]["shadow-color"] = @title_shadow_color
|
33
7
|
end
|