rabbit 2.2.1 → 3.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/data/locale/ja/LC_MESSAGES/rabbit.mo +0 -0
- data/doc/_config.yml +2 -2
- data/doc/_layouts/en.html +1 -1
- data/doc/_layouts/ja.html +1 -1
- data/doc/en/news.rd +140 -0
- data/doc/en/sample/hiki/rabbit.hiki +2 -2
- data/doc/en/sample/markdown/rabbit.md +1 -1
- data/doc/en/sample/rd/rabbit.rd +1 -1
- data/doc/en/usage/rabbit-slide.rd +3 -3
- data/doc/images/screenshots/en/blue-circle-raw.png +0 -0
- data/doc/images/screenshots/en/blue-circle.png +0 -0
- data/doc/images/screenshots/en/clear-blue-raw.png +0 -0
- data/doc/images/screenshots/en/clear-blue.png +0 -0
- data/doc/images/screenshots/en/cozmixng-raw.png +0 -0
- data/doc/images/screenshots/en/cozmixng.png +0 -0
- data/doc/images/screenshots/en/dark-gradation-raw.png +0 -0
- data/doc/images/screenshots/en/dark-gradation.png +0 -0
- data/doc/images/screenshots/en/day-white-raw.png +0 -0
- data/doc/images/screenshots/en/day-white.png +0 -0
- data/doc/images/screenshots/en/debian-raw.png +0 -0
- data/doc/images/screenshots/en/debian.png +0 -0
- data/doc/images/screenshots/en/green-circle-raw.png +0 -0
- data/doc/images/screenshots/en/green-circle.png +0 -0
- data/doc/images/screenshots/en/night-black-raw.png +0 -0
- data/doc/images/screenshots/en/night-black.png +0 -0
- data/doc/images/screenshots/en/rabbit-raw.png +0 -0
- data/doc/images/screenshots/en/rabbit.png +0 -0
- data/doc/images/screenshots/en/ranguba-raw.png +0 -0
- data/doc/images/screenshots/en/ranguba.png +0 -0
- data/doc/images/screenshots/en/red-frame-raw.png +0 -0
- data/doc/images/screenshots/en/red-frame.png +0 -0
- data/doc/images/screenshots/en/ruby-gnome2-raw.png +0 -0
- data/doc/images/screenshots/en/ruby-gnome2.png +0 -0
- data/doc/images/screenshots/en/rubykaigi2011-raw.png +0 -0
- data/doc/images/screenshots/en/rubykaigi2011.png +0 -0
- data/doc/images/screenshots/ja/blue-circle-raw.png +0 -0
- data/doc/images/screenshots/ja/blue-circle.png +0 -0
- data/doc/images/screenshots/ja/clear-blue-raw.png +0 -0
- data/doc/images/screenshots/ja/clear-blue.png +0 -0
- data/doc/images/screenshots/ja/cozmixng-raw.png +0 -0
- data/doc/images/screenshots/ja/cozmixng.png +0 -0
- data/doc/images/screenshots/ja/dark-gradation-raw.png +0 -0
- data/doc/images/screenshots/ja/dark-gradation.png +0 -0
- data/doc/images/screenshots/ja/day-white-raw.png +0 -0
- data/doc/images/screenshots/ja/day-white.png +0 -0
- data/doc/images/screenshots/ja/debian-raw.png +0 -0
- data/doc/images/screenshots/ja/debian.png +0 -0
- data/doc/images/screenshots/ja/green-circle-raw.png +0 -0
- data/doc/images/screenshots/ja/green-circle.png +0 -0
- data/doc/images/screenshots/ja/night-black-raw.png +0 -0
- data/doc/images/screenshots/ja/night-black.png +0 -0
- data/doc/images/screenshots/ja/rabbit-raw.png +0 -0
- data/doc/images/screenshots/ja/rabbit.png +0 -0
- data/doc/images/screenshots/ja/ranguba-raw.png +0 -0
- data/doc/images/screenshots/ja/ranguba.png +0 -0
- data/doc/images/screenshots/ja/red-frame-raw.png +0 -0
- data/doc/images/screenshots/ja/red-frame.png +0 -0
- data/doc/images/screenshots/ja/ruby-gnome2-raw.png +0 -0
- data/doc/images/screenshots/ja/ruby-gnome2.png +0 -0
- data/doc/images/screenshots/ja/rubykaigi2011-raw.png +0 -0
- data/doc/images/screenshots/ja/rubykaigi2011.png +0 -0
- data/doc/ja/how-to-make/index.rd +1 -1
- data/doc/ja/news.rd +143 -0
- data/doc/ja/sample/hiki/rabbit.hiki +2 -2
- data/doc/ja/sample/markdown/rabbit.md +1 -1
- data/doc/ja/sample/rd/rabbit.rd +1 -1
- data/doc/ja/slides.rd +1 -1
- data/doc/ja/usage/rabbit-slide.rd +3 -3
- data/doc/ja/users.rd +1 -1
- data/lib/rabbit/action.rb +23 -4
- data/lib/rabbit/canvas.rb +70 -14
- data/lib/rabbit/command/rabbit-slide.rb +252 -67
- data/lib/rabbit/command/rabbit-slide.ui +180 -0
- data/lib/rabbit/command/rabbit.rb +14 -20
- data/lib/rabbit/console.rb +9 -3
- data/lib/rabbit/dependency-canvas.rb +19 -1
- data/lib/rabbit/element.rb +34 -7
- data/lib/rabbit/element/poppler-page.rb +1 -2
- data/lib/rabbit/element/text-container-element.rb +2 -2
- data/lib/rabbit/element/text-renderer.rb +5 -4
- data/lib/rabbit/element/title-slide.rb +8 -0
- data/lib/rabbit/element/video.rb +1 -2
- data/lib/rabbit/filename.rb +39 -0
- data/lib/rabbit/formatter.rb +61 -30
- data/lib/rabbit/frame.rb +1 -19
- data/lib/rabbit/front.rb +23 -2
- data/lib/rabbit/gesture/handler.rb +21 -2
- data/lib/rabbit/graffiti/config-dialog.rb +15 -18
- data/lib/rabbit/gtk.rb +2 -191
- data/lib/rabbit/html/generator.rb +38 -30
- data/lib/rabbit/image-data-loader.rb +6 -1
- data/lib/rabbit/image.rb +22 -4
- data/lib/rabbit/image/base.rb +34 -2
- data/lib/rabbit/image/default.rb +1 -1
- data/lib/rabbit/image/eps.rb +1 -1
- data/lib/rabbit/image/gimp.rb +1 -1
- data/lib/rabbit/info-window.rb +27 -15
- data/lib/rabbit/logger/gui.rb +21 -23
- data/lib/rabbit/logger/stderr.rb +1 -1
- data/lib/rabbit/pango-markup.rb +44 -0
- data/lib/rabbit/parser.rb +20 -3
- data/lib/rabbit/parser/ext/image.rb +25 -8
- data/lib/rabbit/parser/ext/video.rb +21 -2
- data/lib/rabbit/parser/markdown.rb +1 -2
- data/lib/rabbit/parser/pdf.rb +23 -7
- data/lib/rabbit/parser/rd/rd2rabbit-lib.rb +20 -0
- data/lib/rabbit/progress.rb +34 -23
- data/lib/rabbit/renderer.rb +17 -23
- data/lib/rabbit/renderer/base.rb +31 -57
- data/lib/rabbit/renderer/color.rb +46 -53
- data/lib/rabbit/renderer/display/base.rb +71 -62
- data/lib/rabbit/renderer/display/button-handler.rb +2 -1
- data/lib/rabbit/renderer/display/clutter-embed.rb +60 -26
- data/lib/rabbit/renderer/display/drawing-area-base.rb +1 -1
- data/lib/rabbit/renderer/display/drawing-area-primitive.rb +34 -21
- data/lib/rabbit/renderer/display/graffiti.rb +1 -3
- data/lib/rabbit/renderer/display/hook-handler.rb +8 -4
- data/lib/rabbit/renderer/display/key-handler.rb +7 -2
- data/lib/rabbit/renderer/display/magnifier.rb +2 -2
- data/lib/rabbit/renderer/display/progress.rb +10 -2
- data/lib/rabbit/renderer/display/spotlight.rb +2 -2
- data/lib/rabbit/renderer/engine/cairo.rb +0 -3
- data/lib/rabbit/renderer/kernel.rb +54 -0
- data/lib/rabbit/renderer/offscreen.rb +14 -6
- data/lib/rabbit/renderer/print-layout.rb +150 -0
- data/lib/rabbit/renderer/printer.rb +236 -0
- data/lib/rabbit/renderer/screen.rb +288 -0
- data/lib/rabbit/renderer/widget/drawing-area.rb +93 -0
- data/lib/rabbit/size.rb +52 -25
- data/lib/rabbit/slide-configuration.rb +56 -12
- data/lib/rabbit/source.rb +24 -8
- data/lib/rabbit/task/slide.rb +1 -1
- data/lib/rabbit/theme/applier.rb +26 -9
- data/lib/rabbit/theme/base/base.rb +7 -7
- data/lib/rabbit/theme/clear-blue/clear-blue.rb +1 -1
- data/lib/rabbit/theme/image-timer/image-timer.rb +3 -1
- data/lib/rabbit/theme/image-viewer/image-viewer.rb +13 -1
- data/lib/rabbit/theme/image/image.rb +4 -4
- data/lib/rabbit/theme/lightning-talk-toolkit/lightning-talk-toolkit.rb +3 -1
- data/lib/rabbit/theme/tag/tag.rb +12 -4
- data/lib/rabbit/version.rb +2 -2
- data/lib/rabbit/video-window.rb +75 -89
- data/misc/emacs/rabbit-mode.el +11 -7
- data/po/en/rabbit.edit.po +189 -185
- data/po/en/rabbit.po +15 -12
- data/po/fr/rabbit.edit.po +189 -185
- data/po/fr/rabbit.po +15 -12
- data/po/ja/rabbit.edit.po +190 -186
- data/po/ja/rabbit.po +16 -13
- data/rabbit.gemspec +34 -16
- data/test/command/test-rabbit.rb +100 -0
- data/test/{rabbit-test-utils.rb → helper.rb} +7 -4
- data/test/{rabbit-test-utils → helper}/fixture.rb +2 -2
- data/test/{rabbit-test-utils → helper}/parser.rb +2 -2
- data/test/image/test-dia.rb +2 -2
- data/test/image/test-eps.rb +2 -2
- data/test/parser/test-markdown.rb +3 -5
- data/test/parser/test-rd.rb +1 -3
- data/test/parser/test-wiki.rb +3 -5
- data/test/run-test.rb +3 -3
- data/test/test-applier.rb +60 -29
- data/test/test-canvas.rb +70 -0
- data/test/test-color.rb +18 -9
- data/test/test-element.rb +15 -3
- data/test/test-size.rb +25 -22
- data/test/test-slide-configuration.rb +16 -6
- data/test/test-source.rb +15 -5
- data/test/test-utils.rb +15 -1
- metadata +55 -84
- data/lib/rabbit/renderer/print.rb +0 -31
- data/lib/rabbit/renderer/print/base.rb +0 -78
- data/lib/rabbit/renderer/print/cairo.rb +0 -122
- data/lib/rabbit/renderer/print/layout.rb +0 -123
- data/lib/rabbit/renderer/print/multiple.rb +0 -202
- data/lib/rabbit/source/hiki.rb +0 -36
- data/lib/rabbit/source/slide-share.rb +0 -53
@@ -1,31 +0,0 @@
|
|
1
|
-
module Rabbit
|
2
|
-
module Renderer
|
3
|
-
module Print
|
4
|
-
extend Utils
|
5
|
-
|
6
|
-
A4_WIDTH = 596
|
7
|
-
A4_HEIGHT = 842
|
8
|
-
|
9
|
-
class << self
|
10
|
-
@initialized = false
|
11
|
-
def init
|
12
|
-
unless @initialized
|
13
|
-
@initialized = true
|
14
|
-
dir = ::File.join("rabbit", "renderer", "print")
|
15
|
-
require_files_under_directory_in_load_path(dir)
|
16
|
-
end
|
17
|
-
end
|
18
|
-
|
19
|
-
def new(*args, &block)
|
20
|
-
init
|
21
|
-
corresponding_class_under_module(self).new(*args, &block)
|
22
|
-
end
|
23
|
-
|
24
|
-
def printable?
|
25
|
-
init
|
26
|
-
not corresponding_class_under_module(self).nil?
|
27
|
-
end
|
28
|
-
end
|
29
|
-
end
|
30
|
-
end
|
31
|
-
end
|
@@ -1,78 +0,0 @@
|
|
1
|
-
require "rabbit/rabbit"
|
2
|
-
|
3
|
-
require "rabbit/renderer/base"
|
4
|
-
|
5
|
-
module Rabbit
|
6
|
-
module Renderer
|
7
|
-
module Print
|
8
|
-
module Base
|
9
|
-
include Renderer::Base
|
10
|
-
|
11
|
-
attr_writer :filename
|
12
|
-
attr_accessor :show_page
|
13
|
-
|
14
|
-
def initialize(canvas)
|
15
|
-
super
|
16
|
-
@filename = nil
|
17
|
-
end
|
18
|
-
|
19
|
-
def page_width
|
20
|
-
@page_width - page_margin_left - page_margin_right
|
21
|
-
end
|
22
|
-
|
23
|
-
def page_height
|
24
|
-
@page_height - page_margin_top - page_margin_bottom
|
25
|
-
end
|
26
|
-
|
27
|
-
def width
|
28
|
-
page_width
|
29
|
-
end
|
30
|
-
|
31
|
-
def height
|
32
|
-
page_height
|
33
|
-
end
|
34
|
-
|
35
|
-
def paper_width=(value)
|
36
|
-
super
|
37
|
-
init_paper
|
38
|
-
end
|
39
|
-
|
40
|
-
def paper_height=(value)
|
41
|
-
super
|
42
|
-
init_paper
|
43
|
-
end
|
44
|
-
|
45
|
-
def pre_print(slide_size)
|
46
|
-
@show_page = true
|
47
|
-
end
|
48
|
-
|
49
|
-
def printable?
|
50
|
-
true
|
51
|
-
end
|
52
|
-
|
53
|
-
def filename
|
54
|
-
@filename ||= default_filename
|
55
|
-
end
|
56
|
-
|
57
|
-
def draw_slide(slide, simulation)
|
58
|
-
internal_draw_slide(slide, simulation) do
|
59
|
-
if simulation
|
60
|
-
yield
|
61
|
-
else
|
62
|
-
save_context do
|
63
|
-
internal_clip_slide
|
64
|
-
internal_draw_background
|
65
|
-
yield
|
66
|
-
end
|
67
|
-
end
|
68
|
-
end
|
69
|
-
end
|
70
|
-
|
71
|
-
private
|
72
|
-
def default_filename
|
73
|
-
"#{GLib.filename_from_utf8(@canvas.title.gsub(/\n/, ''))}.pdf"
|
74
|
-
end
|
75
|
-
end
|
76
|
-
end
|
77
|
-
end
|
78
|
-
end
|
@@ -1,122 +0,0 @@
|
|
1
|
-
require "rabbit/renderer/engine/cairo"
|
2
|
-
require "rabbit/renderer/print/base"
|
3
|
-
|
4
|
-
module Rabbit
|
5
|
-
module Renderer
|
6
|
-
module Print
|
7
|
-
class Cairo
|
8
|
-
include Engine::Cairo
|
9
|
-
include Base
|
10
|
-
|
11
|
-
class << self
|
12
|
-
def priority
|
13
|
-
if (::Cairo::VERSION <=> [1, 2, 0]) >= 0
|
14
|
-
100
|
15
|
-
else
|
16
|
-
-100
|
17
|
-
end
|
18
|
-
end
|
19
|
-
end
|
20
|
-
|
21
|
-
def initialize(canvas)
|
22
|
-
super
|
23
|
-
init_paper
|
24
|
-
init_color
|
25
|
-
end
|
26
|
-
|
27
|
-
def pre_print(slide_size)
|
28
|
-
super
|
29
|
-
init_context(create_context)
|
30
|
-
end
|
31
|
-
|
32
|
-
def post_print(canceled)
|
33
|
-
return if canceled
|
34
|
-
@context.target.finish
|
35
|
-
end
|
36
|
-
|
37
|
-
def pre_parse
|
38
|
-
end
|
39
|
-
|
40
|
-
def post_parse
|
41
|
-
end
|
42
|
-
|
43
|
-
def post_apply_theme
|
44
|
-
end
|
45
|
-
|
46
|
-
def post_move(old_index, index)
|
47
|
-
end
|
48
|
-
|
49
|
-
def post_move_in_slide(old_index, index)
|
50
|
-
end
|
51
|
-
|
52
|
-
def internal_draw_slide(slide, simulation)
|
53
|
-
yield
|
54
|
-
@context.show_page if !simulation and @show_page
|
55
|
-
end
|
56
|
-
|
57
|
-
def internal_clip_slide(x=0, y=0, w=width, h=height)
|
58
|
-
x, y = from_screen(x, y)
|
59
|
-
@context.rectangle(x, y, w, h)
|
60
|
-
@context.clip
|
61
|
-
end
|
62
|
-
|
63
|
-
def internal_draw_background(x=0, y=0, w=width, h=height)
|
64
|
-
draw_rectangle(true, x, y, w, h, @background)
|
65
|
-
end
|
66
|
-
|
67
|
-
private
|
68
|
-
def init_paper
|
69
|
-
default_width_mm = 360
|
70
|
-
default_height_mm = 270
|
71
|
-
@page_width = @paper_width || default_width_mm
|
72
|
-
@page_height = @paper_height || default_height_mm
|
73
|
-
end
|
74
|
-
|
75
|
-
def init_color
|
76
|
-
super
|
77
|
-
@foreground = make_color("black")
|
78
|
-
@background = make_color(@background_color)
|
79
|
-
end
|
80
|
-
|
81
|
-
def init_dpi
|
82
|
-
super
|
83
|
-
@x_dpi = 300
|
84
|
-
@y_dpi = 300
|
85
|
-
end
|
86
|
-
|
87
|
-
def create_context(output=nil)
|
88
|
-
surface = find_surface(filename, output)
|
89
|
-
surface.set_fallback_resolution(@x_dpi, @y_dpi)
|
90
|
-
::Cairo::Context.new(surface)
|
91
|
-
end
|
92
|
-
|
93
|
-
def create_pango_context
|
94
|
-
context = create_context(StringIO.new).create_pango_layout.context
|
95
|
-
set_font_resolution(context)
|
96
|
-
context
|
97
|
-
end
|
98
|
-
|
99
|
-
def find_surface(filename, output=nil)
|
100
|
-
args = [output || filename, @page_width, @page_height]
|
101
|
-
case File.extname(filename)
|
102
|
-
when /\.ps/i
|
103
|
-
::Cairo::PSSurface.new(*args)
|
104
|
-
when /\.pdf/i
|
105
|
-
::Cairo::PDFSurface.new(*args)
|
106
|
-
when /\.svg/i
|
107
|
-
surface = ::Cairo::SVGSurface.new(*args)
|
108
|
-
surface.restrict_to_version(::Cairo::SVG_VERSION_1_2)
|
109
|
-
surface
|
110
|
-
when /\.cs/i
|
111
|
-
args[0] = ::Cairo::ScriptDevice.new(args[0])
|
112
|
-
::Cairo::ScriptSurface.new(*args)
|
113
|
-
else
|
114
|
-
@canvas.logger.warn(_("can't find printer for %s") % filename)
|
115
|
-
args[0] = "default.ps"
|
116
|
-
::Cairo::PSSurface.new(*args)
|
117
|
-
end
|
118
|
-
end
|
119
|
-
end
|
120
|
-
end
|
121
|
-
end
|
122
|
-
end
|
@@ -1,123 +0,0 @@
|
|
1
|
-
require "forwardable"
|
2
|
-
|
3
|
-
require "rabbit/rabbit"
|
4
|
-
|
5
|
-
module Rabbit
|
6
|
-
module Renderer
|
7
|
-
module Print
|
8
|
-
class LayoutBase
|
9
|
-
extend Forwardable
|
10
|
-
|
11
|
-
class << self
|
12
|
-
def make_layout(renderer)
|
13
|
-
map = LAYOUT_MAPPING.find do |key, value|
|
14
|
-
key === renderer.slides_per_page
|
15
|
-
end
|
16
|
-
if map.nil?
|
17
|
-
raise InvalidPages.new(renderer.slides_per_page)
|
18
|
-
else
|
19
|
-
map[1].new(renderer)
|
20
|
-
end
|
21
|
-
end
|
22
|
-
end
|
23
|
-
|
24
|
-
def_delegators(:@renderer, :slides_per_page)
|
25
|
-
def_delegators(:@renderer, :current_index)
|
26
|
-
def_delegators(:@renderer, :page_width, :page_height)
|
27
|
-
|
28
|
-
def initialize(renderer)
|
29
|
-
@renderer = renderer
|
30
|
-
@margin_left = renderer.margin_left
|
31
|
-
@margin_right = renderer.margin_right
|
32
|
-
@margin_top = renderer.margin_top
|
33
|
-
@margin_bottom = renderer.margin_bottom
|
34
|
-
end
|
35
|
-
end
|
36
|
-
|
37
|
-
class Layout2 < LayoutBase
|
38
|
-
|
39
|
-
def initialize(renderer)
|
40
|
-
super
|
41
|
-
@margin_left ||= 50
|
42
|
-
@margin_right ||= 50
|
43
|
-
@margin_top ||= 30
|
44
|
-
@margin_bottom ||= 30
|
45
|
-
end
|
46
|
-
|
47
|
-
def slide_width
|
48
|
-
page_width - @margin_left - @margin_right
|
49
|
-
end
|
50
|
-
|
51
|
-
def slide_height
|
52
|
-
(page_height / 2) - @margin_top - @margin_bottom
|
53
|
-
end
|
54
|
-
|
55
|
-
def normalize_x(x)
|
56
|
-
x + @margin_left
|
57
|
-
end
|
58
|
-
|
59
|
-
def normalize_y(y)
|
60
|
-
base = @margin_bottom
|
61
|
-
if below?
|
62
|
-
base += @margin_top + @margin_bottom + slide_height
|
63
|
-
end
|
64
|
-
y + base
|
65
|
-
end
|
66
|
-
|
67
|
-
private
|
68
|
-
def below?
|
69
|
-
(current_index % 2) == 1
|
70
|
-
end
|
71
|
-
end
|
72
|
-
|
73
|
-
class LayoutMore < LayoutBase
|
74
|
-
def initialize(renderer)
|
75
|
-
super
|
76
|
-
@margin_left ||= 10
|
77
|
-
@margin_right ||= 10
|
78
|
-
@margin_top ||= 10
|
79
|
-
@margin_bottom ||= 10
|
80
|
-
end
|
81
|
-
|
82
|
-
def slide_width
|
83
|
-
(page_width / 2) - @margin_left - @margin_right
|
84
|
-
end
|
85
|
-
|
86
|
-
def slide_height
|
87
|
-
base = page_height / (slides_per_page / 2.0).ceil
|
88
|
-
base - @margin_top - @margin_bottom
|
89
|
-
end
|
90
|
-
|
91
|
-
def normalize_x(x)
|
92
|
-
base = @margin_left
|
93
|
-
unless left?
|
94
|
-
base += @margin_left + @margin_right + slide_width
|
95
|
-
end
|
96
|
-
x + base
|
97
|
-
end
|
98
|
-
|
99
|
-
def normalize_y(y)
|
100
|
-
nth_col = (normalized_current_index / 2.0).truncate
|
101
|
-
base = @margin_top * (nth_col + 1)
|
102
|
-
base += @margin_bottom * nth_col
|
103
|
-
base += slide_height * nth_col
|
104
|
-
y + base
|
105
|
-
end
|
106
|
-
|
107
|
-
private
|
108
|
-
def left?
|
109
|
-
(normalized_current_index % 2).zero?
|
110
|
-
end
|
111
|
-
|
112
|
-
def normalized_current_index
|
113
|
-
current_index % slides_per_page
|
114
|
-
end
|
115
|
-
end
|
116
|
-
|
117
|
-
LAYOUT_MAPPING = [
|
118
|
-
[2, Layout2],
|
119
|
-
[3..(1.0/0), LayoutMore],
|
120
|
-
]
|
121
|
-
end
|
122
|
-
end
|
123
|
-
end
|
@@ -1,202 +0,0 @@
|
|
1
|
-
require "forwardable"
|
2
|
-
|
3
|
-
require 'rabbit/renderer/kernel'
|
4
|
-
require "rabbit/renderer/print/base"
|
5
|
-
require "rabbit/renderer/print/layout"
|
6
|
-
|
7
|
-
module Rabbit
|
8
|
-
module Renderer
|
9
|
-
module Print
|
10
|
-
class Multiple
|
11
|
-
include Base
|
12
|
-
include Kernel
|
13
|
-
extend Forwardable
|
14
|
-
|
15
|
-
def_delegators(:@canvas, :current_index)
|
16
|
-
|
17
|
-
def_delegators(:@print, :filename, :filename=)
|
18
|
-
def_delegators(:@print, :foreground=, :background=)
|
19
|
-
def_delegators(:@print, :background_image=)
|
20
|
-
|
21
|
-
def_delegators(:@print, :page_width, :page_width=)
|
22
|
-
def_delegators(:@print, :page_height, :page_height=)
|
23
|
-
def_delegators(:@print, :width, :height)
|
24
|
-
|
25
|
-
def_delegators(:@print, :pre_print, :post_print, :post_apply_theme)
|
26
|
-
def_delegators(:@print, :post_move, :post_move_in_slide, :post_iconify)
|
27
|
-
def_delegators(:@print, :post_fullscreen, :post_unfullscreen)
|
28
|
-
def_delegators(:@print, :pre_parse, :post_parse)
|
29
|
-
def_delegators(:@print, :post_toggle_index_mode)
|
30
|
-
def_delegators(:@print, :index_mode_on, :index_mode_off)
|
31
|
-
|
32
|
-
def_delegators(:@print, :make_color, :make_layout)
|
33
|
-
def_delegators(:@print, :create_pango_context)
|
34
|
-
|
35
|
-
def_delegators(:@print, :clear_theme)
|
36
|
-
|
37
|
-
def initialize(canvas)
|
38
|
-
@print = Print.new(canvas)
|
39
|
-
super
|
40
|
-
end
|
41
|
-
|
42
|
-
def width
|
43
|
-
@slide_width ||= @layout.slide_width
|
44
|
-
end
|
45
|
-
|
46
|
-
def height
|
47
|
-
@slide_height ||= @layout.slide_height
|
48
|
-
end
|
49
|
-
|
50
|
-
def page_margin_left=(margin)
|
51
|
-
super
|
52
|
-
@print.page_margin_left = margin
|
53
|
-
end
|
54
|
-
|
55
|
-
def page_margin_right=(margin)
|
56
|
-
super
|
57
|
-
@print.page_margin_right = margin
|
58
|
-
end
|
59
|
-
|
60
|
-
def page_margin_top=(margin)
|
61
|
-
super
|
62
|
-
@print.page_margin_top = margin
|
63
|
-
end
|
64
|
-
|
65
|
-
def page_margin_bottom=(margin)
|
66
|
-
super
|
67
|
-
@print.page_margin_bottom = margin
|
68
|
-
end
|
69
|
-
|
70
|
-
def margin_left=(margin)
|
71
|
-
super
|
72
|
-
@print.margin_left = margin
|
73
|
-
end
|
74
|
-
|
75
|
-
def margin_right=(margin)
|
76
|
-
super
|
77
|
-
@print.margin_right = margin
|
78
|
-
end
|
79
|
-
|
80
|
-
def margin_top=(margin)
|
81
|
-
super
|
82
|
-
@print.margin_top = margin
|
83
|
-
end
|
84
|
-
|
85
|
-
def margin_bottom=(margin)
|
86
|
-
super
|
87
|
-
@print.margin_bottom = margin
|
88
|
-
end
|
89
|
-
|
90
|
-
|
91
|
-
def draw_slide(slide, simulation)
|
92
|
-
@print.show_page = need_show_page?
|
93
|
-
@print.internal_draw_slide(slide, simulation) do
|
94
|
-
if simulation
|
95
|
-
yield
|
96
|
-
else
|
97
|
-
@print.save_context do
|
98
|
-
x, y = normalize(0, 0)
|
99
|
-
@print.internal_clip_slide(x, y, width, height)
|
100
|
-
@print.internal_draw_background(x, y, width, height)
|
101
|
-
yield
|
102
|
-
draw_rectangle(false, 0, 0, width, height, @black)
|
103
|
-
end
|
104
|
-
end
|
105
|
-
end
|
106
|
-
end
|
107
|
-
|
108
|
-
def slides_per_page=(slides)
|
109
|
-
super
|
110
|
-
update_layout
|
111
|
-
end
|
112
|
-
|
113
|
-
def draw_line(x1, y1, x2, y2, color=nil, params={})
|
114
|
-
x1, y1 = normalize(x1, y1)
|
115
|
-
x2, y2 = normalize(x2, y2)
|
116
|
-
@print.draw_line(x1, y1, x2, y2, color, params)
|
117
|
-
end
|
118
|
-
|
119
|
-
def draw_rectangle(filled, x, y, w, h, color=nil, params={})
|
120
|
-
x, y = normalize(x, y)
|
121
|
-
@print.draw_rectangle(filled, x, y, w, h, color, params)
|
122
|
-
end
|
123
|
-
|
124
|
-
def draw_rounded_rectangle(filled, x, y, w, h, radius, color=nil,
|
125
|
-
params={})
|
126
|
-
x, y = normalize(x, y)
|
127
|
-
@print.draw_rounded_rectangle(filled, x, y, w, h, radius,
|
128
|
-
color, params)
|
129
|
-
end
|
130
|
-
|
131
|
-
def draw_arc(filled, x, y, w, h, a1, a2, color=nil, params={})
|
132
|
-
x, y = normalize(x, y)
|
133
|
-
@print.draw_arc(filled, x, y, w, h, a1, a2, color, params)
|
134
|
-
end
|
135
|
-
|
136
|
-
def draw_arc_by_radius(filled, x, y, r, a1, a2, color=nil, params={})
|
137
|
-
x, y = normalize(x, y)
|
138
|
-
@print.draw_arc_by_radius(filled, x, y, r, a1, a2, color, params)
|
139
|
-
end
|
140
|
-
|
141
|
-
def draw_layout(layout, x, y, color=nil, params={})
|
142
|
-
x, y = normalize(x, y)
|
143
|
-
@print.draw_layout(layout, x, y, color, params)
|
144
|
-
end
|
145
|
-
|
146
|
-
def draw_pixbuf(pixbuf, x, y, params={})
|
147
|
-
x, y = normalize(x, y)
|
148
|
-
@print.draw_pixbuf(pixbuf, x, y, params)
|
149
|
-
end
|
150
|
-
|
151
|
-
def draw_rsvg_handle(handle, x, y, params={})
|
152
|
-
x, y = normalize(x, y)
|
153
|
-
@print.draw_rsvg_handle(handle, x, y, params)
|
154
|
-
end
|
155
|
-
|
156
|
-
def draw_poppler_page(handle, x, y, params={})
|
157
|
-
x, y = normalize(x, y)
|
158
|
-
@print.draw_poppler_page(handle, x, y, params)
|
159
|
-
end
|
160
|
-
|
161
|
-
private
|
162
|
-
def init_paper
|
163
|
-
@print.paper_width = A4_WIDTH
|
164
|
-
@print.paper_height = A4_HEIGHT
|
165
|
-
end
|
166
|
-
|
167
|
-
def init_color
|
168
|
-
@white = make_color("white")
|
169
|
-
@black = make_color("black")
|
170
|
-
end
|
171
|
-
|
172
|
-
def update_layout
|
173
|
-
if @slides_per_page
|
174
|
-
@layout = LayoutBase.make_layout(self)
|
175
|
-
else
|
176
|
-
@layout = nil
|
177
|
-
end
|
178
|
-
@slide_width = nil
|
179
|
-
@slide_height = nil
|
180
|
-
end
|
181
|
-
|
182
|
-
def normalize_x(x)
|
183
|
-
@layout.normalize_x(x)
|
184
|
-
end
|
185
|
-
alias nx normalize_x
|
186
|
-
|
187
|
-
def normalize_y(y)
|
188
|
-
@layout.normalize_y(y)
|
189
|
-
end
|
190
|
-
alias ny normalize_y
|
191
|
-
|
192
|
-
def normalize(x, y)
|
193
|
-
[nx(x), ny(y)]
|
194
|
-
end
|
195
|
-
|
196
|
-
def need_show_page?
|
197
|
-
@canvas.last_slide? or ((current_index + 1) % @slides_per_page).zero?
|
198
|
-
end
|
199
|
-
end
|
200
|
-
end
|
201
|
-
end
|
202
|
-
end
|