rabbit 3.0.0 → 3.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/data/locale/en/LC_MESSAGES/rabbit.mo +0 -0
- data/data/locale/ja/LC_MESSAGES/rabbit.mo +0 -0
- data/doc/_config.yml +2 -2
- data/doc/en/faq.rd +4 -2
- data/doc/en/news.rd +91 -0
- data/doc/en/sample/hiki/rabbit.hiki +0 -4
- data/doc/en/sample/rd/rabbit.rd +0 -4
- data/doc/en/usage/rabbit-slide.rd +3 -3
- data/doc/index.html.en +1 -1
- data/doc/ja/faq.rd +2 -0
- data/doc/ja/news.rd +90 -0
- data/doc/ja/sample/hiki/rabbit.hiki +0 -4
- data/doc/ja/sample/rd/rabbit.rd +0 -4
- data/doc/ja/usage/rabbit-slide.rd +3 -3
- data/doc/ja/users.rd +7 -0
- data/lib/rabbit/action/toggle.rb +7 -0
- data/lib/rabbit/author-configuration.rb +3 -4
- data/lib/rabbit/canvas.rb +11 -1
- data/lib/rabbit/command/rabbit-slide.rb +59 -1
- data/lib/rabbit/command/rabbit-slide.ui +127 -49
- data/lib/rabbit/command/rabbit.rb +5 -9
- data/lib/rabbit/element/image.rb +78 -94
- data/lib/rabbit/element/video.rb +3 -11
- data/lib/rabbit/error.rb +2 -2
- data/lib/rabbit/frame.rb +102 -4
- data/lib/rabbit/gem-pusher.rb +28 -6
- data/lib/rabbit/image/base.rb +97 -26
- data/lib/rabbit/image/dia.rb +21 -6
- data/lib/rabbit/image/pdf.rb +1 -4
- data/lib/rabbit/image/svg.rb +1 -4
- data/lib/rabbit/image.rb +3 -4
- data/lib/rabbit/info-window.rb +106 -80
- data/lib/rabbit/keys.rb +6 -0
- data/lib/rabbit/menu.rb +2 -0
- data/lib/rabbit/parser/ext/charty.rb +58 -0
- data/lib/rabbit/parser/ext/image.rb +2 -1
- data/lib/rabbit/parser/rd/ext/block-verbatim.rb +13 -5
- data/lib/rabbit/progress.rb +1 -1
- data/lib/rabbit/properties.rb +141 -0
- data/lib/rabbit/rabbit.rb +3 -1
- data/lib/rabbit/relative-size.rb +28 -0
- data/lib/rabbit/renderer/base.rb +6 -0
- data/lib/rabbit/renderer/display/drawing-area-base.rb +0 -1
- data/lib/rabbit/renderer/display/drawing-area-primitive.rb +1 -0
- data/lib/rabbit/renderer/display/info.rb +6 -1
- data/lib/rabbit/renderer/display/key-handler.rb +27 -2
- data/lib/rabbit/renderer/engine/cairo.rb +24 -3
- data/lib/rabbit/renderer/screen.rb +0 -1
- data/lib/rabbit/slide-configuration.rb +12 -8
- data/lib/rabbit/task/slide.rb +3 -3
- data/lib/rabbit/theme/clear-blue/clear-blue.rb +3 -1
- data/lib/rabbit/theme/edge-info-toolkit/edge-info-toolkit.rb +12 -2
- data/lib/rabbit/theme/image-slide-number/image-slide-number.rb +1 -1
- data/lib/rabbit/theme/slide-footer-info/slide-footer-info.rb +2 -0
- data/lib/rabbit/theme/tag/tag.rb +9 -2
- data/lib/rabbit/theme-configuration.rb +3 -4
- data/lib/rabbit/version.rb +1 -1
- data/lib/rabbit/video-window.rb +14 -3
- data/lib/rabbit/yaml-loader.rb +39 -0
- data/po/en/rabbit.edit.po +82 -64
- data/po/en/rabbit.po +16 -2
- data/po/fr/rabbit.edit.po +81 -63
- data/po/fr/rabbit.po +15 -1
- data/po/ja/rabbit.edit.po +108 -65
- data/po/ja/rabbit.po +19 -3
- data/sample/can_rabbit.rd +0 -24
- data/sample/rabbit-en.hiki +0 -4
- data/sample/rabbit-en.rd +0 -4
- data/sample/rabbit.hiki +0 -4
- data/sample/rabbit.rd +0 -4
- data/test/test-slide-configuration.rb +3 -2
- metadata +27 -24
@@ -1,29 +1,36 @@
|
|
1
1
|
<?xml version="1.0" encoding="UTF-8"?>
|
2
|
-
<!-- Generated with glade 3.
|
2
|
+
<!-- Generated with glade 3.38.2 -->
|
3
3
|
<interface>
|
4
4
|
<requires lib="gtk+" version="3.20"/>
|
5
|
+
<object class="GtkAdjustment" id="slide-height-adjustment">
|
6
|
+
<property name="upper">4000</property>
|
7
|
+
<property name="step-increment">10</property>
|
8
|
+
<property name="page-increment">100</property>
|
9
|
+
</object>
|
10
|
+
<object class="GtkAdjustment" id="slide-width-adjustment">
|
11
|
+
<property name="upper">4000</property>
|
12
|
+
<property name="step-increment">10</property>
|
13
|
+
<property name="page-increment">100</property>
|
14
|
+
</object>
|
5
15
|
<object class="GtkDialog" id="dialog">
|
6
|
-
<property name="
|
7
|
-
<property name="
|
8
|
-
<child>
|
9
|
-
<placeholder/>
|
10
|
-
</child>
|
16
|
+
<property name="can-focus">False</property>
|
17
|
+
<property name="type-hint">dialog</property>
|
11
18
|
<child internal-child="vbox">
|
12
19
|
<object class="GtkBox">
|
13
|
-
<property name="
|
20
|
+
<property name="can-focus">False</property>
|
14
21
|
<property name="orientation">vertical</property>
|
15
22
|
<property name="spacing">2</property>
|
16
23
|
<child internal-child="action_area">
|
17
24
|
<object class="GtkButtonBox">
|
18
|
-
<property name="
|
19
|
-
<property name="
|
25
|
+
<property name="can-focus">False</property>
|
26
|
+
<property name="layout-style">end</property>
|
20
27
|
<child>
|
21
28
|
<object class="GtkButton" id="cancel-button">
|
22
29
|
<property name="label">gtk-cancel</property>
|
23
30
|
<property name="visible">True</property>
|
24
|
-
<property name="
|
25
|
-
<property name="
|
26
|
-
<property name="
|
31
|
+
<property name="can-focus">True</property>
|
32
|
+
<property name="receives-default">True</property>
|
33
|
+
<property name="use-stock">True</property>
|
27
34
|
</object>
|
28
35
|
<packing>
|
29
36
|
<property name="expand">True</property>
|
@@ -35,9 +42,9 @@
|
|
35
42
|
<object class="GtkButton" id="apply-button">
|
36
43
|
<property name="label">gtk-apply</property>
|
37
44
|
<property name="visible">True</property>
|
38
|
-
<property name="
|
39
|
-
<property name="
|
40
|
-
<property name="
|
45
|
+
<property name="can-focus">True</property>
|
46
|
+
<property name="receives-default">True</property>
|
47
|
+
<property name="use-stock">True</property>
|
41
48
|
</object>
|
42
49
|
<packing>
|
43
50
|
<property name="expand">True</property>
|
@@ -55,90 +62,153 @@
|
|
55
62
|
<child>
|
56
63
|
<object class="GtkBox">
|
57
64
|
<property name="visible">True</property>
|
58
|
-
<property name="
|
65
|
+
<property name="can-focus">False</property>
|
59
66
|
<property name="orientation">vertical</property>
|
60
67
|
<child>
|
61
68
|
<object class="GtkFrame">
|
62
69
|
<property name="visible">True</property>
|
63
|
-
<property name="
|
64
|
-
<property name="
|
65
|
-
<property name="
|
70
|
+
<property name="can-focus">False</property>
|
71
|
+
<property name="label-xalign">0</property>
|
72
|
+
<property name="shadow-type">none</property>
|
66
73
|
<child>
|
67
74
|
<object class="GtkAlignment">
|
68
75
|
<property name="visible">True</property>
|
69
|
-
<property name="
|
70
|
-
<property name="
|
76
|
+
<property name="can-focus">False</property>
|
77
|
+
<property name="left-padding">12</property>
|
71
78
|
<child>
|
79
|
+
<!-- n-columns=3 n-rows=5 -->
|
72
80
|
<object class="GtkGrid">
|
73
81
|
<property name="visible">True</property>
|
74
|
-
<property name="
|
82
|
+
<property name="can-focus">False</property>
|
75
83
|
<child>
|
76
84
|
<object class="GtkLabel">
|
77
85
|
<property name="visible">True</property>
|
78
|
-
<property name="
|
86
|
+
<property name="can-focus">False</property>
|
79
87
|
<property name="halign">end</property>
|
80
88
|
<property name="label" translatable="yes">ID:</property>
|
81
89
|
</object>
|
82
90
|
<packing>
|
83
|
-
<property name="
|
84
|
-
<property name="
|
91
|
+
<property name="left-attach">0</property>
|
92
|
+
<property name="top-attach">0</property>
|
85
93
|
</packing>
|
86
94
|
</child>
|
87
95
|
<child>
|
88
|
-
<object class="
|
96
|
+
<object class="GtkLabel">
|
89
97
|
<property name="visible">True</property>
|
90
|
-
<property name="
|
91
|
-
<property name="
|
98
|
+
<property name="can-focus">False</property>
|
99
|
+
<property name="halign">end</property>
|
100
|
+
<property name="label" translatable="yes">Base name:</property>
|
92
101
|
</object>
|
93
102
|
<packing>
|
94
|
-
<property name="
|
95
|
-
<property name="
|
103
|
+
<property name="left-attach">0</property>
|
104
|
+
<property name="top-attach">1</property>
|
96
105
|
</packing>
|
97
106
|
</child>
|
98
107
|
<child>
|
99
108
|
<object class="GtkLabel">
|
100
109
|
<property name="visible">True</property>
|
101
|
-
<property name="
|
102
|
-
<property name="
|
103
|
-
<property name="label" translatable="yes">Base name:</property>
|
110
|
+
<property name="can-focus">False</property>
|
111
|
+
<property name="label" translatable="yes">Markup language:</property>
|
104
112
|
</object>
|
105
113
|
<packing>
|
106
|
-
<property name="
|
107
|
-
<property name="
|
114
|
+
<property name="left-attach">0</property>
|
115
|
+
<property name="top-attach">2</property>
|
116
|
+
</packing>
|
117
|
+
</child>
|
118
|
+
<child>
|
119
|
+
<object class="GtkLabel">
|
120
|
+
<property name="visible">True</property>
|
121
|
+
<property name="can-focus">False</property>
|
122
|
+
<property name="label" translatable="yes">Height:</property>
|
123
|
+
</object>
|
124
|
+
<packing>
|
125
|
+
<property name="left-attach">0</property>
|
126
|
+
<property name="top-attach">4</property>
|
127
|
+
</packing>
|
128
|
+
</child>
|
129
|
+
<child>
|
130
|
+
<object class="GtkEntry" id="slide-id">
|
131
|
+
<property name="visible">True</property>
|
132
|
+
<property name="can-focus">True</property>
|
133
|
+
<property name="placeholder-text" translatable="yes">rubykaigi2012</property>
|
134
|
+
</object>
|
135
|
+
<packing>
|
136
|
+
<property name="left-attach">1</property>
|
137
|
+
<property name="top-attach">0</property>
|
108
138
|
</packing>
|
109
139
|
</child>
|
110
140
|
<child>
|
111
141
|
<object class="GtkEntry" id="slide-base-name">
|
112
142
|
<property name="visible">True</property>
|
113
|
-
<property name="
|
114
|
-
<property name="
|
143
|
+
<property name="can-focus">True</property>
|
144
|
+
<property name="placeholder-text" translatable="yes">rabbit-introduction</property>
|
115
145
|
</object>
|
116
146
|
<packing>
|
117
|
-
<property name="
|
118
|
-
<property name="
|
147
|
+
<property name="left-attach">1</property>
|
148
|
+
<property name="top-attach">1</property>
|
149
|
+
</packing>
|
150
|
+
</child>
|
151
|
+
<child>
|
152
|
+
<object class="GtkComboBoxText" id="slide-markup-language">
|
153
|
+
<property name="visible">True</property>
|
154
|
+
<property name="can-focus">False</property>
|
155
|
+
</object>
|
156
|
+
<packing>
|
157
|
+
<property name="left-attach">1</property>
|
158
|
+
<property name="top-attach">2</property>
|
159
|
+
</packing>
|
160
|
+
</child>
|
161
|
+
<child>
|
162
|
+
<object class="GtkSpinButton" id="slide-height">
|
163
|
+
<property name="visible">True</property>
|
164
|
+
<property name="can-focus">True</property>
|
165
|
+
<property name="adjustment">slide-height-adjustment</property>
|
166
|
+
<property name="climb-rate">10</property>
|
167
|
+
<property name="numeric">True</property>
|
168
|
+
</object>
|
169
|
+
<packing>
|
170
|
+
<property name="left-attach">1</property>
|
171
|
+
<property name="top-attach">4</property>
|
119
172
|
</packing>
|
120
173
|
</child>
|
121
174
|
<child>
|
122
175
|
<object class="GtkLabel">
|
123
176
|
<property name="visible">True</property>
|
124
|
-
<property name="
|
125
|
-
<property name="label" translatable="yes">
|
177
|
+
<property name="can-focus">False</property>
|
178
|
+
<property name="label" translatable="yes">Width:</property>
|
126
179
|
</object>
|
127
180
|
<packing>
|
128
|
-
<property name="
|
129
|
-
<property name="
|
181
|
+
<property name="left-attach">0</property>
|
182
|
+
<property name="top-attach">3</property>
|
130
183
|
</packing>
|
131
184
|
</child>
|
132
185
|
<child>
|
133
|
-
<object class="
|
186
|
+
<object class="GtkSpinButton" id="slide-width">
|
134
187
|
<property name="visible">True</property>
|
135
|
-
<property name="
|
188
|
+
<property name="can-focus">True</property>
|
189
|
+
<property name="adjustment">slide-width-adjustment</property>
|
190
|
+
<property name="climb-rate">10</property>
|
136
191
|
</object>
|
137
192
|
<packing>
|
138
|
-
<property name="
|
139
|
-
<property name="
|
193
|
+
<property name="left-attach">1</property>
|
194
|
+
<property name="top-attach">3</property>
|
140
195
|
</packing>
|
141
196
|
</child>
|
197
|
+
<child>
|
198
|
+
<placeholder/>
|
199
|
+
</child>
|
200
|
+
<child>
|
201
|
+
<placeholder/>
|
202
|
+
</child>
|
203
|
+
<child>
|
204
|
+
<placeholder/>
|
205
|
+
</child>
|
206
|
+
<child>
|
207
|
+
<placeholder/>
|
208
|
+
</child>
|
209
|
+
<child>
|
210
|
+
<placeholder/>
|
211
|
+
</child>
|
142
212
|
</object>
|
143
213
|
</child>
|
144
214
|
</object>
|
@@ -146,7 +216,7 @@
|
|
146
216
|
<child type="label">
|
147
217
|
<object class="GtkLabel">
|
148
218
|
<property name="visible">True</property>
|
149
|
-
<property name="
|
219
|
+
<property name="can-focus">False</property>
|
150
220
|
<property name="label" translatable="yes">Slide information</property>
|
151
221
|
</object>
|
152
222
|
</child>
|
@@ -158,7 +228,15 @@
|
|
158
228
|
</packing>
|
159
229
|
</child>
|
160
230
|
<child>
|
161
|
-
<
|
231
|
+
<object class="GtkBox">
|
232
|
+
<property name="visible">True</property>
|
233
|
+
<property name="can-focus">False</property>
|
234
|
+
</object>
|
235
|
+
<packing>
|
236
|
+
<property name="expand">False</property>
|
237
|
+
<property name="fill">True</property>
|
238
|
+
<property name="position">1</property>
|
239
|
+
</packing>
|
162
240
|
</child>
|
163
241
|
<child>
|
164
242
|
<placeholder/>
|
@@ -636,14 +636,10 @@ module Rabbit
|
|
636
636
|
end
|
637
637
|
|
638
638
|
def choose_source_file_by_dialog
|
639
|
-
dialog = Gtk::FileChooserDialog.new(_("Choose a Rabbit source file"),
|
640
|
-
|
641
|
-
Gtk::
|
642
|
-
|
643
|
-
[Gtk::Stock::CANCEL,
|
644
|
-
Gtk::Dialog::RESPONSE_CANCEL],
|
645
|
-
[Gtk::Stock::OPEN,
|
646
|
-
Gtk::Dialog::RESPONSE_ACCEPT])
|
639
|
+
dialog = Gtk::FileChooserDialog.new(:title => _("Choose a Rabbit source file"),
|
640
|
+
:action => :open,
|
641
|
+
:buttons => [[Gtk::Stock::CANCEL, :cancel],
|
642
|
+
[Gtk::Stock::OPEN, :accept]])
|
647
643
|
dialog.current_folder = @options.base if @options.base
|
648
644
|
add_source_dialog_filter(dialog, "Rabbit files", "*.rab")
|
649
645
|
add_source_dialog_filter(dialog, "RD files", "*.rd")
|
@@ -652,7 +648,7 @@ module Rabbit
|
|
652
648
|
add_source_dialog_filter(dialog, "Markdown files", "*.md")
|
653
649
|
add_source_dialog_filter(dialog, "All files", "*")
|
654
650
|
file_name = nil
|
655
|
-
if dialog.run == Gtk::
|
651
|
+
if dialog.run == Gtk::ResponseType::ACCEPT
|
656
652
|
file_name = dialog.filename
|
657
653
|
dialog.destroy
|
658
654
|
end
|
data/lib/rabbit/element/image.rb
CHANGED
@@ -1,5 +1,21 @@
|
|
1
|
-
|
2
|
-
|
1
|
+
# Copyright (C) 2004-2020 Sutou Kouhei <kou@cozmixng.org>
|
2
|
+
#
|
3
|
+
# This program is free software; you can redistribute it and/or modify
|
4
|
+
# it under the terms of the GNU General Public License as published by
|
5
|
+
# the Free Software Foundation; either version 2 of the License, or
|
6
|
+
# (at your option) any later version.
|
7
|
+
#
|
8
|
+
# This program is distributed in the hope that it will be useful,
|
9
|
+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
10
|
+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
11
|
+
# GNU General Public License for more details.
|
12
|
+
#
|
13
|
+
# You should have received a copy of the GNU General Public License along
|
14
|
+
# with this program; if not, write to the Free Software Foundation, Inc.,
|
15
|
+
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
16
|
+
|
17
|
+
require "rabbit/image"
|
18
|
+
require "rabbit/element/block-element"
|
3
19
|
|
4
20
|
module Rabbit
|
5
21
|
module Element
|
@@ -13,61 +29,23 @@ module Rabbit
|
|
13
29
|
alias image_draw draw
|
14
30
|
alias draw element_draw
|
15
31
|
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
attr_reader :relative_margin_left, :relative_margin_right
|
22
|
-
attr_reader :relative_padding_top, :relative_padding_bottom
|
23
|
-
attr_reader :relative_padding_left, :relative_padding_right
|
24
|
-
|
25
|
-
def initialize(filename, prop)
|
26
|
-
@filename = filename
|
27
|
-
prop = Utils.stringify_hash_key(prop)
|
28
|
-
super(filename, prop)
|
29
|
-
normalized_prop = {}
|
30
|
-
prop.each do |name, value|
|
31
|
-
normalized_prop[name.gsub(/-/, '_')] = value
|
32
|
-
end
|
33
|
-
prop = normalized_prop
|
34
|
-
%w(caption dither_mode).each do |name|
|
35
|
-
instance_variable_set("@#{name}", prop[name])
|
36
|
-
end
|
37
|
-
%w(keep_scale keep_ratio).each do |name|
|
38
|
-
unless prop[name].nil?
|
39
|
-
self.keep_ratio = true_value?(prop[name])
|
40
|
-
end
|
41
|
-
end
|
42
|
-
%w(as_large_as_possible).each do |name|
|
43
|
-
instance_variable_set("@#{name}", true_value?(prop[name]))
|
44
|
-
end
|
45
|
-
%w(width height
|
46
|
-
x_dither y_dither
|
47
|
-
normalized_width normalized_height
|
48
|
-
relative_width relative_height
|
49
|
-
relative_margin_top relative_margin_bottom
|
50
|
-
relative_margin_left relative_margin_right
|
51
|
-
relative_padding_top relative_padding_bottom
|
52
|
-
relative_padding_left relative_padding_right
|
53
|
-
).each do |name|
|
54
|
-
begin
|
55
|
-
instance_variable_set("@#{name}", prop[name] && Integer(prop[name]))
|
56
|
-
rescue ArgumentError
|
57
|
-
raise InvalidImageSizeError.new(filename, name, prop[name])
|
58
|
-
end
|
59
|
-
end
|
60
|
-
|
61
|
-
setup_draw_parameters(prop)
|
62
|
-
resize(@width, @height)
|
32
|
+
def initialize(filename, props)
|
33
|
+
super(filename, props)
|
34
|
+
setup_draw_parameters
|
35
|
+
resize(properties.get_size("width", @filename),
|
36
|
+
properties.get_size("height", @filename))
|
63
37
|
end
|
64
38
|
|
65
39
|
def draw_element(canvas, x, y, w, h, simulation)
|
66
40
|
draw_image(canvas, x, y, w, h, simulation)
|
67
41
|
end
|
68
42
|
|
43
|
+
def caption
|
44
|
+
self["caption"]
|
45
|
+
end
|
46
|
+
|
69
47
|
def text
|
70
|
-
|
48
|
+
caption.to_s
|
71
49
|
end
|
72
50
|
|
73
51
|
def to_rd
|
@@ -85,22 +63,44 @@ module Rabbit
|
|
85
63
|
html
|
86
64
|
end
|
87
65
|
|
88
|
-
def
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
66
|
+
def relative_width
|
67
|
+
properties.get_relative_size("relative_width", @filename)
|
68
|
+
end
|
69
|
+
|
70
|
+
def relative_height
|
71
|
+
properties.get_relative_size("relative_height", @filename)
|
72
|
+
end
|
73
|
+
|
74
|
+
def relative_margin_top
|
75
|
+
properties.get_relative_size("relative_margin_top", @filename)
|
96
76
|
end
|
97
77
|
|
98
|
-
def
|
99
|
-
@
|
78
|
+
def relative_margin_bottom
|
79
|
+
properties.get_relative_size("relative_margin_bottom", @filename)
|
100
80
|
end
|
101
81
|
|
102
|
-
def
|
103
|
-
@
|
82
|
+
def relative_margin_left
|
83
|
+
properties.get_relative_size("relative_margin_left", @filename)
|
84
|
+
end
|
85
|
+
|
86
|
+
def relative_margin_right
|
87
|
+
properties.get_relative_size("relative_margin_right", @filename)
|
88
|
+
end
|
89
|
+
|
90
|
+
def relative_padding_top
|
91
|
+
properties.get_relative_size("relative_padding_top", @filename)
|
92
|
+
end
|
93
|
+
|
94
|
+
def relative_padding_bottom
|
95
|
+
properties.get_relative_size("relative_padding_bottom", @filename)
|
96
|
+
end
|
97
|
+
|
98
|
+
def relative_padding_left
|
99
|
+
properties.get_relative_size("relative_padding_left", @filename)
|
100
|
+
end
|
101
|
+
|
102
|
+
def relative_padding_right
|
103
|
+
properties.get_relative_size("relative_padding_right", @filename)
|
104
104
|
end
|
105
105
|
|
106
106
|
alias _compile compile
|
@@ -122,23 +122,23 @@ module Rabbit
|
|
122
122
|
end
|
123
123
|
|
124
124
|
def as_large_as_possible?
|
125
|
-
|
125
|
+
properties.get_boolean("as_large_as_possible")
|
126
126
|
end
|
127
127
|
|
128
128
|
private
|
129
|
-
def setup_draw_parameters
|
129
|
+
def setup_draw_parameters
|
130
130
|
@draw_parameters = {}
|
131
131
|
|
132
|
-
@draw_parameters[:reflect] = {} if
|
132
|
+
@draw_parameters[:reflect] = {} if properties.get_boolean("reflect")
|
133
133
|
[:ratio, :alpha].each do |key|
|
134
134
|
name = "reflect_#{key}"
|
135
|
-
value =
|
135
|
+
value = self[name]
|
136
136
|
next unless value
|
137
137
|
@draw_parameters[:reflect] ||= {}
|
138
138
|
@draw_parameters[:reflect][key] = Float(value)
|
139
139
|
end
|
140
140
|
|
141
|
-
alpha =
|
141
|
+
alpha = self["alpha"]
|
142
142
|
@draw_parameters[:alpha] = Float(alpha) if alpha
|
143
143
|
end
|
144
144
|
|
@@ -151,24 +151,24 @@ module Rabbit
|
|
151
151
|
|
152
152
|
def adjust_margin(w, h)
|
153
153
|
@margin_top =
|
154
|
-
|
154
|
+
relative_margin_top&.resolve(h) || @margin_top
|
155
155
|
@margin_bottom =
|
156
|
-
|
156
|
+
relative_margin_bottom&.resolve(h) || @margin_bottom
|
157
157
|
@margin_left =
|
158
|
-
|
158
|
+
relative_margin_left&.resolve(w) || @margin_left
|
159
159
|
@margin_right =
|
160
|
-
|
160
|
+
relative_margin_right&.resolve(w) || @margin_right
|
161
161
|
end
|
162
162
|
|
163
163
|
def adjust_padding(w, h)
|
164
164
|
@padding_top =
|
165
|
-
|
165
|
+
relative_padding_top&.resolve(h) || @padding_top
|
166
166
|
@padding_bottom =
|
167
|
-
|
167
|
+
relative_padding_bottom&.resolve(h) || @padding_bottom
|
168
168
|
@padding_left =
|
169
|
-
|
169
|
+
relative_padding_left&.resolve(w) || @padding_left
|
170
170
|
@padding_right =
|
171
|
-
|
171
|
+
relative_padding_right&.resolve(w) || @padding_right
|
172
172
|
end
|
173
173
|
|
174
174
|
def adjust_size(canvas, x, y, w, h)
|
@@ -177,7 +177,7 @@ module Rabbit
|
|
177
177
|
adjust_margin(base_w, base_h)
|
178
178
|
adjust_padding(base_w, base_h)
|
179
179
|
base_h = base_h - @padding_top - @padding_bottom
|
180
|
-
if
|
180
|
+
if as_large_as_possible?
|
181
181
|
iw = base_w - x
|
182
182
|
ih = base_h - y
|
183
183
|
if iw.to_f / original_width > ih.to_f / original_height
|
@@ -186,27 +186,11 @@ module Rabbit
|
|
186
186
|
ih = nil
|
187
187
|
end
|
188
188
|
else
|
189
|
-
|
190
|
-
|
191
|
-
rw = make_relative_size(@relative_width, base_w)
|
192
|
-
rh = make_relative_size(@relative_height, base_h)
|
193
|
-
iw = nw || rw
|
194
|
-
ih = nh || rh
|
189
|
+
iw = relative_width&.resolve(base_w)
|
190
|
+
ih = relative_height&.resolve(base_h)
|
195
191
|
end
|
196
192
|
resize(iw, ih)
|
197
193
|
end
|
198
|
-
|
199
|
-
def make_normalized_size(size)
|
200
|
-
size && screen_size(size)
|
201
|
-
end
|
202
|
-
|
203
|
-
def make_relative_size(size, parent_size)
|
204
|
-
size && parent_size && ((size / 100.0) * parent_size).ceil
|
205
|
-
end
|
206
|
-
|
207
|
-
def true_value?(value)
|
208
|
-
value == true or value == "true"
|
209
|
-
end
|
210
194
|
end
|
211
195
|
end
|
212
196
|
end
|
data/lib/rabbit/element/video.rb
CHANGED
@@ -14,7 +14,6 @@ module Rabbit
|
|
14
14
|
include TextRenderer
|
15
15
|
|
16
16
|
attr_reader :filename
|
17
|
-
attr_reader :normalized_width, :normalized_height
|
18
17
|
attr_reader :relative_width, :relative_height
|
19
18
|
attr_reader :relative_margin_top, :relative_margin_bottom
|
20
19
|
attr_reader :relative_margin_left, :relative_margin_right
|
@@ -34,7 +33,6 @@ module Rabbit
|
|
34
33
|
instance_variable_set("@#{name}", true_value?(prop[name]))
|
35
34
|
end
|
36
35
|
%w(width height
|
37
|
-
normalized_width normalized_height
|
38
36
|
relative_width relative_height
|
39
37
|
relative_margin_top relative_margin_bottom
|
40
38
|
relative_margin_left relative_margin_right
|
@@ -44,7 +42,7 @@ module Rabbit
|
|
44
42
|
begin
|
45
43
|
instance_variable_set("@#{name}", prop[name] && Integer(prop[name]))
|
46
44
|
rescue ArgumentError
|
47
|
-
raise
|
45
|
+
raise InvalidSizeError.new(filename, name, prop[name])
|
48
46
|
end
|
49
47
|
end
|
50
48
|
|
@@ -126,12 +124,10 @@ module Rabbit
|
|
126
124
|
iw = base_w
|
127
125
|
ih = base_h
|
128
126
|
else
|
129
|
-
nw = make_normalized_size(@normalized_width)
|
130
|
-
nh = make_normalized_size(@normalized_height)
|
131
127
|
rw = make_relative_size(@relative_width, base_w)
|
132
128
|
rh = make_relative_size(@relative_height, base_h)
|
133
|
-
iw =
|
134
|
-
ih =
|
129
|
+
iw = rw || base_w
|
130
|
+
ih = rh || base_h
|
135
131
|
end
|
136
132
|
resize(iw, ih)
|
137
133
|
end
|
@@ -151,10 +147,6 @@ module Rabbit
|
|
151
147
|
end
|
152
148
|
end
|
153
149
|
|
154
|
-
def make_normalized_size(size)
|
155
|
-
size && screen_size(size)
|
156
|
-
end
|
157
|
-
|
158
150
|
def make_relative_size(size, parent_size)
|
159
151
|
size && parent_size && ((size / 100.0) * parent_size).ceil
|
160
152
|
end
|
data/lib/rabbit/error.rb
CHANGED
@@ -181,7 +181,7 @@ module Rabbit
|
|
181
181
|
end
|
182
182
|
end
|
183
183
|
|
184
|
-
class
|
184
|
+
class InvalidSizeError < Error
|
185
185
|
attr_reader :filename, :prop_name, :value
|
186
186
|
def initialize(filename, prop_name, value)
|
187
187
|
@filename = filename
|
@@ -193,7 +193,7 @@ module Rabbit
|
|
193
193
|
:value => value,
|
194
194
|
}
|
195
195
|
super(_("invalid value of size property \"%{prop_name}\" " \
|
196
|
-
"of
|
196
|
+
"of \"%{filename}\": %{value}") % params)
|
197
197
|
end
|
198
198
|
end
|
199
199
|
|