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
data/lib/rabbit/logger/stderr.rb
CHANGED
@@ -0,0 +1,44 @@
|
|
1
|
+
# Copyright (C) 2018 Kouhei Sutou <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 "cgi/util"
|
18
|
+
|
19
|
+
module Rabbit
|
20
|
+
class PangoMarkup
|
21
|
+
def initialize(name, attributes, content=nil)
|
22
|
+
@name = name
|
23
|
+
@attributes = attributes
|
24
|
+
@content = content
|
25
|
+
end
|
26
|
+
|
27
|
+
def to_s
|
28
|
+
tag = "<#{@name}"
|
29
|
+
@attributes.each do |name, value|
|
30
|
+
next if value.nil?
|
31
|
+
formatter_name = Utils.to_class_name(name)
|
32
|
+
if Format.const_defined?(formatter_name)
|
33
|
+
formatter = Format.const_get(formatter_name).new(value)
|
34
|
+
value = formatter.pango_value
|
35
|
+
end
|
36
|
+
tag << " #{CGI.escapeHTML(name.to_s)}='#{CGI.escapeHTML(value.to_s)}'"
|
37
|
+
end
|
38
|
+
tag << ">"
|
39
|
+
tag << @content.to_s if @content
|
40
|
+
tag << "</#{@name}>"
|
41
|
+
tag
|
42
|
+
end
|
43
|
+
end
|
44
|
+
end
|
data/lib/rabbit/parser.rb
CHANGED
@@ -1,7 +1,24 @@
|
|
1
|
-
|
1
|
+
# Copyright (C) 2007-2017 Kouhei Sutou <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.
|
2
16
|
|
3
|
-
|
4
|
-
|
17
|
+
require "rabbit/parser/image"
|
18
|
+
require "rabbit/parser/markdown"
|
19
|
+
require "rabbit/parser/pdf"
|
20
|
+
require "rabbit/parser/rd"
|
21
|
+
require "rabbit/parser/wiki"
|
5
22
|
|
6
23
|
module Rabbit
|
7
24
|
module Parser
|
@@ -1,9 +1,26 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
1
|
+
# Copyright (C) 2007-2018 Kouhei Sutou <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.
|
5
16
|
|
6
|
-
require
|
17
|
+
require "uri"
|
18
|
+
require "cgi"
|
19
|
+
require "open-uri"
|
20
|
+
require "fileutils"
|
21
|
+
|
22
|
+
require "rabbit/element"
|
23
|
+
require "rabbit/filename"
|
7
24
|
|
8
25
|
module Rabbit
|
9
26
|
module Parser
|
@@ -39,7 +56,7 @@ module Rabbit
|
|
39
56
|
end
|
40
57
|
|
41
58
|
module Private
|
42
|
-
ALLOWED_IMG_URL_SCHEME = [
|
59
|
+
ALLOWED_IMG_URL_SCHEME = ["http", "https", "file"]
|
43
60
|
|
44
61
|
module_function
|
45
62
|
def uri_string_to_image_filename(canvas, uri_string)
|
@@ -58,7 +75,7 @@ module Rabbit
|
|
58
75
|
def uri_to_image_filename(canvas, uri)
|
59
76
|
case uri.scheme.to_s.downcase
|
60
77
|
when "file"
|
61
|
-
|
78
|
+
Filename.new(uri.path).encode
|
62
79
|
when "http", "https", "ftp"
|
63
80
|
other_uri_filename(canvas, uri)
|
64
81
|
else
|
@@ -67,7 +84,7 @@ module Rabbit
|
|
67
84
|
end
|
68
85
|
|
69
86
|
def local_path_to_image_filename(canvas, path)
|
70
|
-
path = Pathname.new(
|
87
|
+
path = Pathname.new(Filename.new(path).encode)
|
71
88
|
return path.to_s if path.absolute?
|
72
89
|
|
73
90
|
expanded_path = canvas.full_path(path.to_s)
|
@@ -1,10 +1,29 @@
|
|
1
|
-
|
1
|
+
# Copyright (C) 2012 Narihiro Nakamura <authornari@gmail.com>
|
2
|
+
# Copyright (C) 2018 Kouhei Sutou <kou@cozmixng.org>
|
3
|
+
#
|
4
|
+
# This program is free software; you can redistribute it and/or modify
|
5
|
+
# it under the terms of the GNU General Public License as published by
|
6
|
+
# the Free Software Foundation; either version 2 of the License, or
|
7
|
+
# (at your option) any later version.
|
8
|
+
#
|
9
|
+
# This program is distributed in the hope that it will be useful,
|
10
|
+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
11
|
+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
12
|
+
# GNU General Public License for more details.
|
13
|
+
#
|
14
|
+
# You should have received a copy of the GNU General Public License along
|
15
|
+
# with this program; if not, write to the Free Software Foundation, Inc.,
|
16
|
+
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
17
|
+
|
18
|
+
require "rabbit/element"
|
19
|
+
require "rabbit/parser/ext/image"
|
2
20
|
|
3
21
|
module Rabbit
|
4
22
|
module Parser
|
5
23
|
module Ext
|
6
24
|
module Video
|
7
|
-
def make_video(canvas,
|
25
|
+
def make_video(canvas, uri_str, prop)
|
26
|
+
path = Image::Private.uri_string_to_image_filename(canvas, uri_str)
|
8
27
|
begin
|
9
28
|
Element::Video.new(path, prop)
|
10
29
|
rescue Error
|
data/lib/rabbit/parser/pdf.rb
CHANGED
@@ -1,3 +1,19 @@
|
|
1
|
+
# Copyright (C) 2007-2018 Kouhei Sutou <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
|
+
|
1
17
|
require "tempfile"
|
2
18
|
|
3
19
|
require "poppler"
|
@@ -26,13 +42,13 @@ module Rabbit
|
|
26
42
|
|
27
43
|
include Element
|
28
44
|
def parse
|
29
|
-
doc = Poppler::Document.new(@source.read)
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
45
|
+
doc = Poppler::Document.new(:data => @source.read)
|
46
|
+
doc.each_with_index do |page, i|
|
47
|
+
if i.zero?
|
48
|
+
@canvas << PopplerTitleSlide.new(page, doc)
|
49
|
+
else
|
50
|
+
@canvas << PopplerSlide.new(page)
|
51
|
+
end
|
36
52
|
end
|
37
53
|
end
|
38
54
|
end
|
@@ -8,6 +8,26 @@ require "rabbit/parser/rd/ext/refer"
|
|
8
8
|
require "rabbit/parser/rd/ext/inline-verbatim"
|
9
9
|
require "rabbit/parser/rd/ext/block-verbatim"
|
10
10
|
|
11
|
+
module Rabbit
|
12
|
+
module Parser
|
13
|
+
class RD
|
14
|
+
module NoURLMark
|
15
|
+
def to_reference_content
|
16
|
+
[::RD::StringElement.new(url)]
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
22
|
+
|
23
|
+
module RD
|
24
|
+
class Reference
|
25
|
+
class URL
|
26
|
+
prepend Rabbit::Parser::RD::NoURLMark
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
30
|
+
|
11
31
|
module Rabbit
|
12
32
|
module Parser
|
13
33
|
class RD
|
data/lib/rabbit/progress.rb
CHANGED
@@ -4,6 +4,8 @@ module Rabbit
|
|
4
4
|
class Progress
|
5
5
|
attr_reader :window, :foreground, :background
|
6
6
|
def initialize
|
7
|
+
@width = 100
|
8
|
+
@height = 20
|
7
9
|
@foreground = nil
|
8
10
|
@background = nil
|
9
11
|
end
|
@@ -27,8 +29,8 @@ module Rabbit
|
|
27
29
|
@window = Gtk::Window.new(:popup)
|
28
30
|
@window.transient_for = parent
|
29
31
|
@window.app_paintable = true
|
32
|
+
@window.set_default_size(@width, @height)
|
30
33
|
@bar = Gtk::ProgressBar.new
|
31
|
-
@bar.show_text = true
|
32
34
|
@window.add(@bar)
|
33
35
|
@window.show_all
|
34
36
|
@bar.fraction = @current = 0
|
@@ -52,6 +54,7 @@ module Rabbit
|
|
52
54
|
end
|
53
55
|
|
54
56
|
def hide
|
57
|
+
@max = nil
|
55
58
|
@window.destroy
|
56
59
|
@bar = nil
|
57
60
|
@window = nil
|
@@ -59,29 +62,37 @@ module Rabbit
|
|
59
62
|
|
60
63
|
private
|
61
64
|
def setup_progress_color
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
65
|
+
css = <<-CSS
|
66
|
+
progress {
|
67
|
+
padding: 0px;
|
68
|
+
padding-top: #{@height}px;
|
69
|
+
padding-bottom: #{@height}px;
|
70
|
+
}
|
71
|
+
|
72
|
+
trough {
|
73
|
+
border-width: 0px;
|
74
|
+
}
|
75
|
+
CSS
|
76
|
+
if @foreground
|
77
|
+
css << <<-CSS
|
78
|
+
progress {
|
79
|
+
background-color: #{@foreground.to_css_rgba};
|
80
|
+
border-color: #{@foreground.to_css_rgba};
|
81
|
+
}
|
82
|
+
CSS
|
83
|
+
end
|
84
|
+
if @background
|
85
|
+
css << <<-CSS
|
86
|
+
progressbar,
|
87
|
+
trough {
|
88
|
+
background-color: #{@background.to_css_rgba};
|
89
|
+
}
|
90
|
+
CSS
|
84
91
|
end
|
92
|
+
provider = Gtk::CssProvider.new
|
93
|
+
provider.load(:data => css)
|
94
|
+
@bar.style_context.add_provider(provider,
|
95
|
+
Gtk::StyleProvider::PRIORITY_USER)
|
85
96
|
end
|
86
97
|
end
|
87
98
|
end
|
data/lib/rabbit/renderer.rb
CHANGED
@@ -1,27 +1,21 @@
|
|
1
|
-
|
1
|
+
# Copyright (C) 2004-2018 Kouhei Sutou <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.
|
2
16
|
|
3
17
|
require "rabbit/renderer/color"
|
4
18
|
require "rabbit/renderer/display"
|
5
19
|
require "rabbit/renderer/offscreen"
|
6
|
-
require "rabbit/renderer/
|
7
|
-
|
8
|
-
module Rabbit
|
9
|
-
module Renderer
|
10
|
-
extend Utils
|
11
|
-
|
12
|
-
class << self
|
13
|
-
def printable?
|
14
|
-
Print.printable?
|
15
|
-
end
|
16
|
-
|
17
|
-
def printable_renderer(slides_per_page)
|
18
|
-
raise NoPrintSupportError unless printable?
|
19
|
-
if slides_per_page > 1
|
20
|
-
Print::Multiple
|
21
|
-
else
|
22
|
-
Print
|
23
|
-
end
|
24
|
-
end
|
25
|
-
end
|
26
|
-
end
|
27
|
-
end
|
20
|
+
require "rabbit/renderer/printer"
|
21
|
+
require "rabbit/renderer/screen"
|
data/lib/rabbit/renderer/base.rb
CHANGED
@@ -1,3 +1,19 @@
|
|
1
|
+
# Copyright (C) 2004-2019 Kouhei Sutou <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
|
+
|
1
17
|
require "forwardable"
|
2
18
|
require "erb"
|
3
19
|
require "rabbit/gtk"
|
@@ -18,6 +34,8 @@ module Rabbit
|
|
18
34
|
def_delegators(:@canvas, :reload_source)
|
19
35
|
|
20
36
|
attr_reader :x_dpi, :y_dpi
|
37
|
+
attr_accessor :base_width
|
38
|
+
attr_accessor :base_height
|
21
39
|
attr_accessor :paper_width, :paper_height, :slides_per_page
|
22
40
|
attr_accessor :margin_left, :margin_right
|
23
41
|
attr_accessor :margin_top, :margin_bottom
|
@@ -34,9 +52,11 @@ module Rabbit
|
|
34
52
|
super()
|
35
53
|
@canvas = canvas
|
36
54
|
@font_families = nil
|
55
|
+
@base_width = nil
|
56
|
+
@base_height = nil
|
37
57
|
@paper_width = nil
|
38
58
|
@paper_height = nil
|
39
|
-
@slides_per_page =
|
59
|
+
@slides_per_page = 1
|
40
60
|
@margin_left = nil
|
41
61
|
@margin_right = nil
|
42
62
|
@margin_top = nil
|
@@ -156,16 +176,6 @@ module Rabbit
|
|
156
176
|
def setup_event(area)
|
157
177
|
end
|
158
178
|
|
159
|
-
def to_attrs(hash)
|
160
|
-
hash.collect do |key, value|
|
161
|
-
if value
|
162
|
-
"#{h key}='#{h value}'"
|
163
|
-
else
|
164
|
-
nil
|
165
|
-
end
|
166
|
-
end.compact.join(" ")
|
167
|
-
end
|
168
|
-
|
169
179
|
def clean
|
170
180
|
dirty_count_clean
|
171
181
|
end
|
@@ -290,9 +300,10 @@ module Rabbit
|
|
290
300
|
end
|
291
301
|
|
292
302
|
def make_canvas_with_printable_renderer
|
293
|
-
renderer = Renderer
|
303
|
+
renderer = Renderer::Printer
|
294
304
|
make_canvas_with_renderer(renderer) do |canvas|
|
295
305
|
canvas.filename = @canvas.filename
|
306
|
+
setup_size(canvas)
|
296
307
|
setup_margin(canvas)
|
297
308
|
setup_page_margin(canvas)
|
298
309
|
setup_paper_size(canvas)
|
@@ -303,12 +314,16 @@ module Rabbit
|
|
303
314
|
|
304
315
|
def make_canvas_with_offscreen_renderer
|
305
316
|
make_canvas_with_renderer(Offscreen) do |canvas|
|
306
|
-
canvas
|
307
|
-
canvas.height = @canvas.height
|
317
|
+
setup_size(canvas)
|
308
318
|
setup_3d(canvas)
|
309
319
|
end
|
310
320
|
end
|
311
321
|
|
322
|
+
def setup_size(canvas)
|
323
|
+
canvas.width = @canvas.width
|
324
|
+
canvas.height = @canvas.height
|
325
|
+
end
|
326
|
+
|
312
327
|
def setup_margin(canvas)
|
313
328
|
canvas.margin_left = @canvas.margin_left
|
314
329
|
canvas.margin_right = @canvas.margin_right
|
@@ -324,55 +339,14 @@ module Rabbit
|
|
324
339
|
end
|
325
340
|
|
326
341
|
def setup_paper_size(canvas)
|
327
|
-
|
328
|
-
|
329
|
-
canvas.paper_height = @canvas.paper_height
|
330
|
-
else
|
331
|
-
canvas.paper_width = @canvas.width
|
332
|
-
canvas.paper_height = @canvas.height
|
333
|
-
end
|
342
|
+
canvas.paper_width = @canvas.paper_width
|
343
|
+
canvas.paper_height = @canvas.paper_height
|
334
344
|
end
|
335
345
|
|
336
346
|
def setup_3d(canvas)
|
337
347
|
canvas.use_gl = @canvas.use_gl?
|
338
348
|
end
|
339
349
|
|
340
|
-
def setup_flag_params(pole_height, default_flag_width_ratio, params)
|
341
|
-
params = params.dup
|
342
|
-
|
343
|
-
text = params["text"]
|
344
|
-
text_attrs = params["text_attributes"] || {}
|
345
|
-
if text
|
346
|
-
markupped_text = "<span #{to_attrs(text_attrs)}>#{text}</span>"
|
347
|
-
layout = make_layout(markupped_text)
|
348
|
-
text_width, text_height = layout.pixel_size
|
349
|
-
params["layout"] = layout
|
350
|
-
params["text_width"] = text_width
|
351
|
-
params["text_height"] = text_height
|
352
|
-
flag_width_default = [
|
353
|
-
text_width * default_flag_width_ratio,
|
354
|
-
pole_height / 2
|
355
|
-
].max
|
356
|
-
flag_height_default = [text_height, flag_width_default].max
|
357
|
-
else
|
358
|
-
params["layout"] = nil
|
359
|
-
flag_width_default = flag_height_default = nil
|
360
|
-
end
|
361
|
-
|
362
|
-
params["pole_width"] = params["pole_width"] || 2
|
363
|
-
params["pole_color"] ||= "black"
|
364
|
-
flag_height = params["flag_height"] ||
|
365
|
-
flag_height_default || pole_height / 2
|
366
|
-
flag_height = [flag_height, pole_height].min
|
367
|
-
params["flag_height"] = flag_height
|
368
|
-
params["flag_width"] ||= flag_width_default || flag_height
|
369
|
-
params["flag_color"] ||= "red"
|
370
|
-
params["flag_frame_width"] ||= params["pole_width"]
|
371
|
-
params["flag_frame_color"] ||= params["pole_color"]
|
372
|
-
|
373
|
-
params
|
374
|
-
end
|
375
|
-
|
376
350
|
def not_support_method(name)
|
377
351
|
format = _("%s does not support: %s")
|
378
352
|
msg = format % [self.class.name, name]
|