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,15 +1,32 @@
|
|
1
|
-
|
2
|
-
|
1
|
+
# Copyright (C) 2005-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 "erb"
|
18
|
+
require "fileutils"
|
3
19
|
|
4
20
|
begin
|
5
|
-
require
|
21
|
+
require "rss/maker"
|
6
22
|
rescue LoadError
|
7
23
|
end
|
8
24
|
|
9
|
-
require
|
10
|
-
require
|
11
|
-
require
|
12
|
-
require
|
25
|
+
require "rabbit/filename"
|
26
|
+
require "rabbit/front"
|
27
|
+
require "rabbit/keys"
|
28
|
+
require "rabbit/rabbit"
|
29
|
+
require "rabbit/utils"
|
13
30
|
|
14
31
|
module Rabbit
|
15
32
|
module HTML
|
@@ -21,7 +38,14 @@ module Rabbit
|
|
21
38
|
path = ["rabbit", "html", "template.erb"]
|
22
39
|
template_path = Utils.find_path_in_load_path(*path)
|
23
40
|
raise CantFindHTMLTemplate.new(File.join(*path)) if template_path.nil?
|
24
|
-
erb = File.open(template_path)
|
41
|
+
erb = File.open(template_path) do |f|
|
42
|
+
parameters = ERB.instance_method(:initialize).parameters
|
43
|
+
if parameters.include?([:key, :trim_mode])
|
44
|
+
ERB.new(f.read, trim_mode: "-")
|
45
|
+
else
|
46
|
+
ERB.new(f.read, nil, "-")
|
47
|
+
end
|
48
|
+
end
|
25
49
|
erb.def_method(self, "to_html", template_path)
|
26
50
|
|
27
51
|
attr_accessor :pdf_filename, :source_filename
|
@@ -40,7 +64,7 @@ module Rabbit
|
|
40
64
|
@output_index_html = output_index_html
|
41
65
|
@pdf_filename = nil
|
42
66
|
@source_filename = nil
|
43
|
-
FileUtils.mkdir_p(
|
67
|
+
FileUtils.mkdir_p(Filename.new(@base_dir).encode)
|
44
68
|
end
|
45
69
|
|
46
70
|
def save
|
@@ -193,7 +217,7 @@ module Rabbit
|
|
193
217
|
if Object.const_defined?(:RSS)
|
194
218
|
rss = make_rss
|
195
219
|
name = File.join(@base_dir, @rss_filename)
|
196
|
-
File.open(
|
220
|
+
File.open(Filename.new(name).encode, "w") do |f|
|
197
221
|
f.print(rss.to_s)
|
198
222
|
end
|
199
223
|
true
|
@@ -209,31 +233,15 @@ module Rabbit
|
|
209
233
|
format << "-%0#{number_of_places(slide_size)}d%s.%s"
|
210
234
|
end
|
211
235
|
|
212
|
-
def
|
213
|
-
if GLib.const_defined?(:Win32)
|
214
|
-
GLib::Win32.locale_filename_from_utf8(utf8_filename)
|
215
|
-
else
|
216
|
-
if Utils.windows?
|
217
|
-
GLib.locale_from_utf8(utf8_filename)
|
218
|
-
else
|
219
|
-
GLib.filename_from_utf8(utf8_filename)
|
220
|
-
end
|
221
|
-
end
|
222
|
-
end
|
223
|
-
|
224
|
-
def make_filename(slide_number, suffix, optional=nil, convert=true)
|
236
|
+
def make_filename(slide_number, suffix, optional=nil)
|
225
237
|
optional = "-#{optional}" if optional
|
226
238
|
name = filename_format % [slide_number, optional || '', suffix]
|
227
|
-
|
228
|
-
to_filename_encoding(name)
|
229
|
-
else
|
230
|
-
name
|
231
|
-
end
|
239
|
+
Filename.new(name).encode
|
232
240
|
end
|
233
241
|
|
234
242
|
def slide_filename(slide_number=@slide_number)
|
235
243
|
if !outputting_index? and slide_number.zero?
|
236
|
-
File.join(
|
244
|
+
Filename.new(File.join(@base_dir, "index.#{@suffix}")).encode
|
237
245
|
else
|
238
246
|
make_filename(slide_number, @suffix)
|
239
247
|
end
|
@@ -244,7 +252,7 @@ module Rabbit
|
|
244
252
|
end
|
245
253
|
|
246
254
|
def pixbuf_filename(slide_number=@slide_number, optional=nil)
|
247
|
-
make_filename(slide_number, @image_type, optional
|
255
|
+
make_filename(slide_number, @image_type, optional)
|
248
256
|
end
|
249
257
|
|
250
258
|
def output_html(filename)
|
@@ -18,11 +18,15 @@ require "gdk_pixbuf2"
|
|
18
18
|
|
19
19
|
module Rabbit
|
20
20
|
class ImageDataLoader
|
21
|
-
attr_reader :width
|
21
|
+
attr_reader :width
|
22
|
+
attr_reader :height
|
23
|
+
attr_reader :pixbuf
|
24
|
+
attr_reader :animation
|
22
25
|
def initialize(data)
|
23
26
|
@width = 0
|
24
27
|
@height = 0
|
25
28
|
@pixbuf = nil
|
29
|
+
@animation = nil
|
26
30
|
@data = data
|
27
31
|
end
|
28
32
|
|
@@ -40,6 +44,7 @@ module Rabbit
|
|
40
44
|
end
|
41
45
|
loader.signal_handler_disconnect(id)
|
42
46
|
@pixbuf = loader.pixbuf
|
47
|
+
@animation = loader.animation
|
43
48
|
@pixbuf
|
44
49
|
end
|
45
50
|
end
|
data/lib/rabbit/image.rb
CHANGED
@@ -1,11 +1,29 @@
|
|
1
|
+
# Copyright (C) 2004-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.
|
16
|
+
|
1
17
|
require "forwardable"
|
2
18
|
require "tempfile"
|
3
19
|
require 'thread'
|
4
20
|
|
5
|
-
require
|
6
|
-
|
7
|
-
|
8
|
-
|
21
|
+
require "rabbit/image/default"
|
22
|
+
require "rabbit/image/dia"
|
23
|
+
require "rabbit/image/eps"
|
24
|
+
require "rabbit/image/gimp"
|
25
|
+
require "rabbit/image/pdf"
|
26
|
+
require "rabbit/image/svg"
|
9
27
|
|
10
28
|
module Rabbit
|
11
29
|
module ImageManipulable
|
data/lib/rabbit/image/base.rb
CHANGED
@@ -10,10 +10,14 @@ module Rabbit
|
|
10
10
|
extend ModuleLoader
|
11
11
|
|
12
12
|
attr_reader :width, :height, :original_width, :original_height
|
13
|
+
attr_reader :animation
|
13
14
|
|
14
15
|
def initialize(filename, props)
|
15
16
|
@filename = filename
|
16
17
|
@props = normalize_props(props)
|
18
|
+
@animation = nil
|
19
|
+
@animation_iterator = nil
|
20
|
+
@animation_timeout = nil
|
17
21
|
update_size
|
18
22
|
@original_width = @width
|
19
23
|
@original_height = @height
|
@@ -65,7 +69,13 @@ module Rabbit
|
|
65
69
|
:width => width,
|
66
70
|
:height => height,
|
67
71
|
}
|
68
|
-
|
72
|
+
target_pixbuf = pixbuf
|
73
|
+
if @animation_iterator
|
74
|
+
@animation_iterator.advance
|
75
|
+
target_pixbuf = @animation_iterator.pixbuf
|
76
|
+
update_animation_timeout(canvas)
|
77
|
+
end
|
78
|
+
canvas.draw_pixbuf(target_pixbuf, x, y, default_params.merge(params))
|
69
79
|
end
|
70
80
|
|
71
81
|
private
|
@@ -95,7 +105,29 @@ module Rabbit
|
|
95
105
|
|
96
106
|
@width = loader.width
|
97
107
|
@height = loader.height
|
98
|
-
loader.pixbuf
|
108
|
+
@pixbuf = loader.pixbuf
|
109
|
+
@animation = loader.animation
|
110
|
+
if @animation and not @animation.static_image?
|
111
|
+
@animation_iterator = @animation.get_iter
|
112
|
+
else
|
113
|
+
@animation_iterator = nil
|
114
|
+
end
|
115
|
+
if @animation_timeout
|
116
|
+
GLib::Source.remove(@animation_timeout)
|
117
|
+
@animation_timeout = nil
|
118
|
+
end
|
119
|
+
end
|
120
|
+
|
121
|
+
def update_animation_timeout(canvas)
|
122
|
+
delay_time = @animation_iterator.delay_time
|
123
|
+
if delay_time > 0 and @animation_timeout.nil?
|
124
|
+
@animation_timeout = GLib::Timeout.add(delay_time) do
|
125
|
+
canvas.redraw
|
126
|
+
@animation_timeout = nil
|
127
|
+
# update_animation_timeout(canvas)
|
128
|
+
GLib::Source::REMOVE
|
129
|
+
end
|
130
|
+
end
|
99
131
|
end
|
100
132
|
end
|
101
133
|
end
|
data/lib/rabbit/image/default.rb
CHANGED
data/lib/rabbit/image/eps.rb
CHANGED
data/lib/rabbit/image/gimp.rb
CHANGED
@@ -41,7 +41,7 @@ EOC
|
|
41
41
|
if GIMP_COMMANDS.any? {|gimp| run(gimp, *args); File.exist?(png_path)}
|
42
42
|
png_file.open
|
43
43
|
png_file.binmode
|
44
|
-
|
44
|
+
load_data(png_file.read)
|
45
45
|
else
|
46
46
|
raise GIMPCanNotHandleError.new("gimp #{args.join(' ')}",
|
47
47
|
GIMP_COMMANDS)
|
data/lib/rabbit/info-window.rb
CHANGED
@@ -1,4 +1,18 @@
|
|
1
|
-
|
1
|
+
# Copyright (C) 2006-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/gtk'
|
4
18
|
require 'rabbit/dependency-canvas'
|
@@ -11,7 +25,6 @@ require 'rabbit/renderer/display/menu'
|
|
11
25
|
|
12
26
|
module Rabbit
|
13
27
|
class InfoWindow
|
14
|
-
include ERB::Util
|
15
28
|
include GetText
|
16
29
|
|
17
30
|
include Renderer::Display::HookHandler
|
@@ -191,17 +204,9 @@ module Rabbit
|
|
191
204
|
|
192
205
|
def init_note_area
|
193
206
|
@note_area = Gtk::DrawingArea.new
|
194
|
-
|
195
|
-
|
196
|
-
|
197
|
-
draw_text_as_large_as_possible(area, context, note_text)
|
198
|
-
Gdk::Event::PROPAGATE
|
199
|
-
end
|
200
|
-
else
|
201
|
-
@note_area.signal_connect("draw") do |area, context|
|
202
|
-
draw_text_as_large_as_possible(area, context, note_text)
|
203
|
-
Gdk::Event::PROPAGATE
|
204
|
-
end
|
207
|
+
@note_area.signal_connect("draw") do |area, context|
|
208
|
+
draw_text_as_large_as_possible(area, context, note_text)
|
209
|
+
Gdk::Event::PROPAGATE
|
205
210
|
end
|
206
211
|
end
|
207
212
|
|
@@ -271,7 +276,7 @@ module Rabbit
|
|
271
276
|
attrs["font_desc"] = ((height * font_size) / Pango::SCALE).to_s
|
272
277
|
rest_time = @canvas.rest_time
|
273
278
|
attrs["foreground"] = "red" if rest_time and rest_time < 0
|
274
|
-
"
|
279
|
+
PangoMarkup.new("span", attrs, timer_label).to_s
|
275
280
|
end
|
276
281
|
|
277
282
|
def timer_label
|
@@ -292,7 +297,7 @@ module Rabbit
|
|
292
297
|
end
|
293
298
|
attrs = {}
|
294
299
|
attrs["font_desc"] = ((height * 40) / Pango::SCALE).to_s
|
295
|
-
"
|
300
|
+
PangoMarkup.new("span", attrs, text).to_s
|
296
301
|
end
|
297
302
|
|
298
303
|
def update_source
|
@@ -307,6 +312,13 @@ module Rabbit
|
|
307
312
|
end
|
308
313
|
end
|
309
314
|
|
315
|
+
def reload_theme
|
316
|
+
@canvas.reload_theme
|
317
|
+
each do |canvas|
|
318
|
+
canvas.reload_theme
|
319
|
+
end
|
320
|
+
end
|
321
|
+
|
310
322
|
def adjust_slide(base_index=nil)
|
311
323
|
base_index ||= @canvas.current_index
|
312
324
|
@previous_canvas.move_to_if_can([base_index - 1, 0].max)
|
data/lib/rabbit/logger/gui.rb
CHANGED
@@ -11,7 +11,6 @@ module Rabbit
|
|
11
11
|
|
12
12
|
attr_accessor :start_gui_main_loop_automatically
|
13
13
|
def initialize(level=nil, width=450, height=400)
|
14
|
-
Gtk.init
|
15
14
|
super(*[level].compact)
|
16
15
|
@width = width
|
17
16
|
@height = height
|
@@ -61,8 +60,8 @@ module Rabbit
|
|
61
60
|
end
|
62
61
|
|
63
62
|
def append(text, *tags)
|
64
|
-
iter = @buffer.
|
65
|
-
@buffer.
|
63
|
+
iter = @buffer.get_iter_at(offset: -1)
|
64
|
+
@buffer.insert(iter, text.encode("UTF-8"), tags: tags)
|
66
65
|
end
|
67
66
|
|
68
67
|
def title
|
@@ -70,13 +69,12 @@ module Rabbit
|
|
70
69
|
end
|
71
70
|
|
72
71
|
def init_dialog(width=@width, height=@height)
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
@dialog
|
79
|
-
@dialog.vbox.add(init_buffer)
|
72
|
+
@dialog = Gtk::Dialog.new(title: title,
|
73
|
+
buttons: [
|
74
|
+
[Gtk::Stock::CLEAR, :cancel],
|
75
|
+
[Gtk::Stock::CLOSE, :close],
|
76
|
+
])
|
77
|
+
@dialog.child.add(init_buffer)
|
80
78
|
@dialog.set_default_size(width, height)
|
81
79
|
@dialog.title = title
|
82
80
|
set_dialog_delete
|
@@ -86,7 +84,7 @@ module Rabbit
|
|
86
84
|
|
87
85
|
def set_dialog_delete
|
88
86
|
@dialog.signal_connect("destroy") do |widget, event|
|
89
|
-
exit if @current_severity >= Severity::FATAL
|
87
|
+
exit(false) if @current_severity >= Severity::FATAL
|
90
88
|
true
|
91
89
|
end
|
92
90
|
end
|
@@ -94,9 +92,9 @@ module Rabbit
|
|
94
92
|
def set_dialog_response
|
95
93
|
@dialog.signal_connect("response") do |widget, event|
|
96
94
|
case event
|
97
|
-
when Gtk::
|
95
|
+
when Gtk::ResponseType::CANCEL
|
98
96
|
clear_buffer
|
99
|
-
when Gtk::
|
97
|
+
when Gtk::ResponseType::CLOSE
|
100
98
|
quit
|
101
99
|
end
|
102
100
|
true
|
@@ -109,7 +107,7 @@ module Rabbit
|
|
109
107
|
flags = Gtk::AccelFlags::VISIBLE
|
110
108
|
Keys::QUIT_KEYS.each do |val|
|
111
109
|
accel_group.connect(val, mod, flags) do
|
112
|
-
@dialog.signal_emit("response", Gtk::
|
110
|
+
@dialog.signal_emit("response", Gtk::ResponseType::CLOSE)
|
113
111
|
true
|
114
112
|
end
|
115
113
|
end
|
@@ -119,39 +117,39 @@ module Rabbit
|
|
119
117
|
def init_buffer
|
120
118
|
textview = Gtk::TextView.new
|
121
119
|
textview.set_editable(false)
|
122
|
-
textview.set_wrap_mode(
|
120
|
+
textview.set_wrap_mode(:word)
|
123
121
|
@buffer = textview.buffer
|
124
122
|
create_tags
|
125
123
|
scrolled_window = Gtk::ScrolledWindow.new
|
126
|
-
scrolled_window.set_policy(
|
124
|
+
scrolled_window.set_policy(:automatic, :automatic)
|
127
125
|
scrolled_window.add(textview)
|
128
126
|
scrolled_window
|
129
127
|
end
|
130
128
|
|
131
129
|
def create_tags
|
132
130
|
@buffer.create_tag("DEBUG",
|
133
|
-
"weight" =>
|
131
|
+
"weight" => :bold,
|
134
132
|
"foreground" => "blue")
|
135
133
|
@buffer.create_tag("INFO", "foreground" => "blue")
|
136
|
-
@buffer.create_tag("
|
134
|
+
@buffer.create_tag("WARNING", "foreground" => "red")
|
137
135
|
@buffer.create_tag("ERROR",
|
138
|
-
"weight" =>
|
136
|
+
"weight" => :bold,
|
139
137
|
"foreground" => "red")
|
140
138
|
@buffer.create_tag("FATAL",
|
141
139
|
"foreground" => "yellow",
|
142
140
|
"background" => "black")
|
143
141
|
@buffer.create_tag("UNKNOWN",
|
144
|
-
"weight" =>
|
142
|
+
"weight" => :bold,
|
145
143
|
"foreground" => "yellow",
|
146
144
|
"background" => "black")
|
147
145
|
@buffer.create_tag("ANY",
|
148
|
-
"weight" =>
|
146
|
+
"weight" => :bold)
|
149
147
|
@buffer.create_tag("prog_name",
|
150
|
-
"weight" =>
|
148
|
+
"weight" => :bold,
|
151
149
|
"foreground" => "blue",
|
152
150
|
"left_margin" => 10)
|
153
151
|
@buffer.create_tag("message",
|
154
|
-
"weight" =>
|
152
|
+
"weight" => :bold,
|
155
153
|
"left_margin" => 10,
|
156
154
|
"right_margin" => 10)
|
157
155
|
end
|