rabbit 3.0.3 → 3.0.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/Gemfile +31 -0
- data/Rakefile +51 -73
- data/data/locale/ja/LC_MESSAGES/rabbit.mo +0 -0
- data/doc/en/how-to-make/markdown.md +28 -2
- data/doc/en/how-to-make/rd.rd +28 -2
- data/doc/en/install/homebrew.rd +0 -15
- data/doc/en/news.rd +67 -0
- data/doc/en/sample/hiki/rabbit.hiki +1 -1
- 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 +1 -1
- data/doc/en/usage/rabbit.rd +1 -1
- data/doc/ja/how-to-make/markdown.md +25 -5
- data/doc/ja/how-to-make/rd.rd +25 -5
- data/doc/ja/install/homebrew.rd +0 -15
- data/doc/ja/news.rd +67 -0
- data/doc/ja/usage/rabbit.rd +1 -1
- data/lib/rabbit/action.rb +1 -23
- data/lib/rabbit/canvas.rb +2 -10
- data/lib/rabbit/command/rabbit-slide.rb +1 -1
- data/lib/rabbit/command/rabbit.rb +6 -4
- data/lib/rabbit/cursor-manager.rb +5 -5
- data/lib/rabbit/element/text.rb +66 -0
- data/lib/rabbit/error.rb +9 -1
- data/lib/rabbit/frame.rb +22 -2
- data/lib/rabbit/front.rb +1 -1
- data/lib/rabbit/gesture/handler.rb +5 -8
- data/lib/rabbit/gtk.rb +44 -2
- data/lib/rabbit/info-window.rb +16 -2
- data/lib/rabbit/menu.rb +1 -3
- data/lib/rabbit/parser/ext/charty.rb +9 -0
- data/lib/rabbit/parser/markdown/converter.rb +3 -3
- data/lib/rabbit/parser/rd/ext/block-verbatim.rb +0 -12
- data/lib/rabbit/parser/rd/ext/inline-verbatim.rb +23 -0
- data/lib/rabbit/parser/wiki/output.rb +0 -6
- data/lib/rabbit/renderer/base.rb +1 -9
- data/lib/rabbit/renderer/display/base.rb +7 -5
- data/lib/rabbit/renderer/display/button-handler.rb +25 -10
- data/lib/rabbit/renderer/display/cursor.rb +18 -2
- data/lib/rabbit/renderer/display/drawing-area-base.rb +23 -7
- data/lib/rabbit/renderer/display/drawing-area-primitive.rb +35 -20
- data/lib/rabbit/renderer/display/gesture.rb +17 -1
- data/lib/rabbit/renderer/engine/cairo.rb +27 -13
- data/lib/rabbit/renderer/gl.rb +0 -81
- data/lib/rabbit/renderer/kernel.rb +0 -50
- data/lib/rabbit/renderer/offscreen.rb +1 -6
- data/lib/rabbit/renderer/printer.rb +2 -8
- data/lib/rabbit/renderer/screen.rb +6 -7
- data/lib/rabbit/source/argf.rb +17 -1
- data/lib/rabbit/source/base.rb +35 -10
- data/lib/rabbit/source/file.rb +17 -1
- data/lib/rabbit/source/uri.rb +17 -1
- data/lib/rabbit/theme/dark-gradation/dark-gradation.rb +2 -2
- data/lib/rabbit/theme/default-comment/default-comment.rb +1 -5
- data/lib/rabbit/theme/image-slide-number/property.rb +1 -1
- data/lib/rabbit/theme/title-background-image/title-background-image.rb +2 -2
- data/lib/rabbit/trackball.rb +21 -21
- data/lib/rabbit/utils.rb +5 -45
- data/lib/rabbit/version.rb +1 -1
- data/lib/rabbit/video-window.rb +6 -2
- data/po/en/rabbit.edit.po +24 -38
- data/po/en/rabbit.po +9 -21
- data/po/fr/rabbit.edit.po +24 -38
- data/po/fr/rabbit.po +9 -21
- data/po/ja/rabbit.edit.po +56 -58
- data/po/ja/rabbit.po +12 -21
- data/rabbit.gemspec +11 -14
- data/sample/gl-sample.rd +2 -4
- data/sample/rabbit/theme/gl-sample/gl-sample.rb +1 -1
- data/sample/rabbit-en.hiki +1 -1
- data/sample/rabbit-en.md +1 -1
- data/sample/rabbit-en.rd +1 -13
- data/sample/rabbit.rd +1 -13
- data/test/helper.rb +1 -2
- data/test/parser/test-markdown.rb +4 -3
- data/test/parser/test-rd.rb +3 -3
- data/test/parser/test-wiki.rb +2 -2
- data/test/test-readme-parser.rb +15 -12
- data/test/test-source.rb +2 -2
- metadata +35 -122
- 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/lib/rabbit/parser/ext/emacs.rb +0 -121
- data/lib/rabbit/renderer/display/clutter-embed.rb +0 -606
- data/lib/rabbit/theme/clutter-comment/clutter-comment.rb +0 -76
- data/lib/rabbit/theme/clutter-comment/property.rb +0 -3
@@ -1,3 +1,19 @@
|
|
1
|
+
# Copyright (C) 2004-2024 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
|
+
|
1
17
|
require "rabbit/renderer/display/drawing-area-primitive"
|
2
18
|
require "rabbit/renderer/display/menu"
|
3
19
|
require "rabbit/renderer/display/progress"
|
@@ -289,7 +305,7 @@ module Rabbit
|
|
289
305
|
end
|
290
306
|
|
291
307
|
def paint(color_name)
|
292
|
-
context = @
|
308
|
+
context = @surface.create_cairo_context
|
293
309
|
context.set_source_rgba(*Color.parse(color_name).to_a)
|
294
310
|
context.paint
|
295
311
|
end
|
@@ -313,9 +329,9 @@ module Rabbit
|
|
313
329
|
width, height = pixbuf.width, pixbuf.height
|
314
330
|
x = @adjustment_x * width
|
315
331
|
y = @adjustment_y * height
|
316
|
-
@
|
317
|
-
|
318
|
-
|
332
|
+
@surface.draw_pixbuf(@foreground, pixbuf,
|
333
|
+
x, y, 0, 0, width, height,
|
334
|
+
Gdk::RGB::DITHER_NORMAL, 0, 0)
|
319
335
|
if @adjustment_x != 0 or @adjustment_y != 0
|
320
336
|
draw_next_slide
|
321
337
|
end
|
@@ -353,9 +369,9 @@ module Rabbit
|
|
353
369
|
src_height = -adjustment_height
|
354
370
|
end
|
355
371
|
|
356
|
-
@
|
357
|
-
|
358
|
-
|
372
|
+
@surface.draw_pixbuf(@foreground, pixbuf, src_x, src_y,
|
373
|
+
dest_x, dest_y, src_width, src_height,
|
374
|
+
Gdk::RGB::DITHER_NORMAL, 0, 0)
|
359
375
|
end
|
360
376
|
|
361
377
|
def configured_after(widget, event)
|
@@ -1,10 +1,25 @@
|
|
1
|
+
# Copyright (C) 2004-2024 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
|
+
|
1
17
|
require 'rabbit/gtk'
|
2
18
|
|
3
19
|
require "rabbit/utils"
|
4
20
|
require "rabbit/renderer/engine"
|
5
21
|
require "rabbit/renderer/display/base"
|
6
22
|
require 'rabbit/renderer/display/cursor'
|
7
|
-
require 'rabbit/renderer/display/gl'
|
8
23
|
|
9
24
|
module Rabbit
|
10
25
|
module Renderer
|
@@ -13,7 +28,6 @@ module Rabbit
|
|
13
28
|
include Base
|
14
29
|
|
15
30
|
include Cursor
|
16
|
-
include GL
|
17
31
|
|
18
32
|
attr_accessor :filename
|
19
33
|
def initialize(canvas)
|
@@ -27,13 +41,9 @@ module Rabbit
|
|
27
41
|
super
|
28
42
|
|
29
43
|
set_configure_event
|
30
|
-
|
31
|
-
init_gl(@area)
|
32
44
|
end
|
33
45
|
|
34
46
|
def detach
|
35
|
-
finalize_gl
|
36
|
-
|
37
47
|
if !@window.destroyed? and @configure_signal_id
|
38
48
|
@window.signal_handler_disconnect(@configure_signal_id)
|
39
49
|
@configure_signal_id = nil
|
@@ -117,11 +127,6 @@ module Rabbit
|
|
117
127
|
end
|
118
128
|
|
119
129
|
private
|
120
|
-
def init_dpi
|
121
|
-
@x_dpi = ScreenInfo.screen_x_resolution
|
122
|
-
@y_dpi = ScreenInfo.screen_y_resolution
|
123
|
-
end
|
124
|
-
|
125
130
|
def init_drawing_area
|
126
131
|
@area = Gtk::DrawingArea.new
|
127
132
|
@area.can_focus = true
|
@@ -141,15 +146,25 @@ module Rabbit
|
|
141
146
|
end
|
142
147
|
|
143
148
|
def mapped(widget)
|
144
|
-
|
149
|
+
set_surface(widget.native.surface)
|
145
150
|
end
|
146
151
|
|
147
152
|
def set_draw
|
148
|
-
@area.
|
149
|
-
|
150
|
-
|
151
|
-
|
152
|
-
|
153
|
+
if @area.respond_to?(:set_draw_func)
|
154
|
+
@area.set_draw_func do |area, context|
|
155
|
+
surface = area.native.surface
|
156
|
+
update_size(surface.width, surface.height)
|
157
|
+
init_context(context)
|
158
|
+
draw(area)
|
159
|
+
finish_renderer
|
160
|
+
end
|
161
|
+
else
|
162
|
+
@area.signal_connect("draw") do |widget, context|
|
163
|
+
init_context(context)
|
164
|
+
draw(widget)
|
165
|
+
finish_renderer
|
166
|
+
Gdk::Event::PROPAGATE
|
167
|
+
end
|
153
168
|
end
|
154
169
|
end
|
155
170
|
|
@@ -178,8 +193,8 @@ module Rabbit
|
|
178
193
|
end
|
179
194
|
|
180
195
|
def configured(x, y, w, h)
|
181
|
-
@real_width = @
|
182
|
-
@real_height = @
|
196
|
+
@real_width = @surface.width
|
197
|
+
@real_height = @surface.height
|
183
198
|
@size_dirty = true
|
184
199
|
end
|
185
200
|
|
@@ -204,7 +219,7 @@ module Rabbit
|
|
204
219
|
|
205
220
|
def configured_after(widget, event)
|
206
221
|
update_size(event.width, event.height)
|
207
|
-
reload_theme if @
|
222
|
+
reload_theme if @surface
|
208
223
|
end
|
209
224
|
|
210
225
|
def reload_theme(&callback)
|
@@ -1,3 +1,19 @@
|
|
1
|
+
# Copyright (C) 2006-2024 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
|
+
|
1
17
|
require "rabbit/gesture/handler"
|
2
18
|
|
3
19
|
module Rabbit
|
@@ -49,7 +65,7 @@ module Rabbit
|
|
49
65
|
first_move = !@gesture.moved?
|
50
66
|
handled = @gesture.button_motion(event.x, event.y, width, height)
|
51
67
|
queue_draw if handled or first_move
|
52
|
-
init_renderer(@
|
68
|
+
init_renderer(@surface)
|
53
69
|
@gesture.draw_last_locus(self)
|
54
70
|
finish_renderer
|
55
71
|
true
|
@@ -1,3 +1,19 @@
|
|
1
|
+
# Copyright (C) 2005-2024 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
|
+
|
1
17
|
require "cairo"
|
2
18
|
require "stringio"
|
3
19
|
|
@@ -12,10 +28,6 @@ module Rabbit
|
|
12
28
|
|
13
29
|
attr_writer :foreground, :background
|
14
30
|
|
15
|
-
def alpha_available?
|
16
|
-
true
|
17
|
-
end
|
18
|
-
|
19
31
|
def background_image=(pixbuf)
|
20
32
|
surface = ::Cairo::ImageSurface.new(::Cairo::FORMAT_A1, 1, 1)
|
21
33
|
context = ::Cairo::Context.new(surface)
|
@@ -25,8 +37,8 @@ module Rabbit
|
|
25
37
|
pixbuf
|
26
38
|
end
|
27
39
|
|
28
|
-
def init_renderer(
|
29
|
-
init_context(
|
40
|
+
def init_renderer(surface)
|
41
|
+
init_context(surface.create_cairo_context)
|
30
42
|
end
|
31
43
|
|
32
44
|
def finish_renderer
|
@@ -105,7 +117,7 @@ module Rabbit
|
|
105
117
|
x2, y2 = from_screen(x2, y2)
|
106
118
|
@context.save do
|
107
119
|
set_source(color, params)
|
108
|
-
|
120
|
+
set_stroke_options(params)
|
109
121
|
@context.new_path
|
110
122
|
@context.move_to(x1, y1)
|
111
123
|
@context.line_to(x2, y2)
|
@@ -117,7 +129,7 @@ module Rabbit
|
|
117
129
|
x, y = from_screen(x, y)
|
118
130
|
@context.save do
|
119
131
|
set_source(color, params)
|
120
|
-
|
132
|
+
set_stroke_options(params)
|
121
133
|
@context.rectangle(x, y, w, h)
|
122
134
|
apply_cairo_action(filled, params)
|
123
135
|
end
|
@@ -131,7 +143,7 @@ module Rabbit
|
|
131
143
|
|
132
144
|
@context.save do
|
133
145
|
set_source(color, params)
|
134
|
-
|
146
|
+
set_stroke_options(params)
|
135
147
|
@context.new_path
|
136
148
|
@context.rounded_rectangle(x, y, w, h, x_radius, y_radius)
|
137
149
|
apply_cairo_action(filled, params)
|
@@ -149,7 +161,7 @@ module Rabbit
|
|
149
161
|
a1, a2 = convert_angle(a1, a2)
|
150
162
|
@context.save do
|
151
163
|
set_source(color, params)
|
152
|
-
|
164
|
+
set_stroke_options(params)
|
153
165
|
args = [x, y, r, a1, a2]
|
154
166
|
action, = cairo_action(filled, params)
|
155
167
|
@context.move_to(x, y) unless action == :stroke
|
@@ -167,7 +179,7 @@ module Rabbit
|
|
167
179
|
return if points.empty?
|
168
180
|
@context.save do
|
169
181
|
set_source(color, params)
|
170
|
-
|
182
|
+
set_stroke_options(params)
|
171
183
|
@context.move_to(*from_screen(*points.first))
|
172
184
|
points[1..-1].each do |x, y|
|
173
185
|
@context.line_to(*from_screen(x, y))
|
@@ -181,7 +193,7 @@ module Rabbit
|
|
181
193
|
x, y = from_screen(x, y)
|
182
194
|
@context.save do
|
183
195
|
set_source(color, params)
|
184
|
-
|
196
|
+
set_stroke_options(params)
|
185
197
|
@context.move_to(x, y)
|
186
198
|
if params[:stroke]
|
187
199
|
@context.pango_layout_path(layout)
|
@@ -461,12 +473,14 @@ module Rabbit
|
|
461
473
|
end
|
462
474
|
end
|
463
475
|
|
464
|
-
def
|
476
|
+
def set_stroke_options(params)
|
465
477
|
set_line_width(get_line_width(params))
|
466
478
|
[:line_cap, :line_join].each do |key|
|
467
479
|
value = params[key]
|
468
480
|
@context.send("#{key}=", value) if value
|
469
481
|
end
|
482
|
+
value = params[:dash]
|
483
|
+
@context.set_dash(*value) if value
|
470
484
|
end
|
471
485
|
end
|
472
486
|
end
|
data/lib/rabbit/renderer/gl.rb
CHANGED
@@ -22,87 +22,6 @@ module Rabbit
|
|
22
22
|
end
|
23
23
|
end
|
24
24
|
|
25
|
-
def draw_cube(filled, x, y, z, size, color=nil, &block)
|
26
|
-
return super unless gl_available?
|
27
|
-
draw_gl(x, y, z, color, block) do
|
28
|
-
::Gdk::GL.draw_cube(filled, size)
|
29
|
-
end
|
30
|
-
end
|
31
|
-
|
32
|
-
def draw_sphere(filled, x, y, z, radius, slices, stacks,
|
33
|
-
color=nil, &block)
|
34
|
-
return super unless gl_available?
|
35
|
-
draw_gl(x, y, z, color, block) do
|
36
|
-
::Gdk::GL.draw_sphere(filled, radius, slices, stacks)
|
37
|
-
end
|
38
|
-
end
|
39
|
-
|
40
|
-
def draw_cone(filled, x, y, z, base, height, slices, stacks,
|
41
|
-
color=nil, &block)
|
42
|
-
return super unless gl_available?
|
43
|
-
draw_gl(x, y, z, color, block) do
|
44
|
-
::Gdk::GL.draw_cone(filled, base, height, slices, stacks)
|
45
|
-
end
|
46
|
-
end
|
47
|
-
|
48
|
-
def draw_torus(filled, x, y, z, inner_radius, outer_radius,
|
49
|
-
n_sides, rings, color=nil, &block)
|
50
|
-
return super unless gl_available?
|
51
|
-
draw_gl(x, y, z, color, block) do
|
52
|
-
::Gdk::GL.draw_torus(filled, inner_radius,
|
53
|
-
outer_radius, n_sides, rings)
|
54
|
-
end
|
55
|
-
end
|
56
|
-
|
57
|
-
def draw_tetrahedron(filled, x, y, z, color=nil, &block)
|
58
|
-
return super unless gl_available?
|
59
|
-
draw_gl(x, y, z, color, block) do
|
60
|
-
::Gdk::GL.draw_tetrahedron(filled)
|
61
|
-
end
|
62
|
-
end
|
63
|
-
|
64
|
-
def draw_octahedron(filled, x, y, z, color=nil, &block)
|
65
|
-
return super unless gl_available?
|
66
|
-
draw_gl(x, y, z, color, block) do
|
67
|
-
::Gdk::GL.draw_octahedron(filled)
|
68
|
-
end
|
69
|
-
end
|
70
|
-
|
71
|
-
def draw_dodecahedron(filled, x, y, z, color=nil, &block)
|
72
|
-
return super unless gl_available?
|
73
|
-
draw_gl(x, y, z, color, block) do
|
74
|
-
::Gdk::GL.draw_dodecahedron(filled)
|
75
|
-
end
|
76
|
-
end
|
77
|
-
|
78
|
-
def draw_icosahedron(filled, x, y, z, color=nil, &block)
|
79
|
-
return super unless gl_available?
|
80
|
-
draw_gl(x, y, z, color, block) do
|
81
|
-
::Gdk::GL.draw_icosahedron(filled)
|
82
|
-
end
|
83
|
-
end
|
84
|
-
|
85
|
-
def draw_teapot(filled, x, y, z, scale, color=nil, &block)
|
86
|
-
return super unless gl_available?
|
87
|
-
draw_gl(x, y, z, color, block) do
|
88
|
-
::Gdk::GL.draw_teapot(filled, scale)
|
89
|
-
end
|
90
|
-
end
|
91
|
-
|
92
|
-
def gl_compile(id)
|
93
|
-
return super unless gl_available?
|
94
|
-
::GL.NewList(id, ::GL::COMPILE)
|
95
|
-
yield
|
96
|
-
::GL.EndList
|
97
|
-
end
|
98
|
-
|
99
|
-
def gl_call_list(id, x, y, z, color=nil, &block)
|
100
|
-
return super unless gl_available?
|
101
|
-
draw_gl(x, y, z, color, block) do
|
102
|
-
::GL.CallList(id)
|
103
|
-
end
|
104
|
-
end
|
105
|
-
|
106
25
|
def gl_supported?
|
107
26
|
(Gtk::GL::BUILD_VERSION <=> [1, 2, 0]) >= 0
|
108
27
|
end
|
@@ -191,51 +191,6 @@ module Rabbit
|
|
191
191
|
[params["pole_width"] + params["flag_width"], pole_height]
|
192
192
|
end
|
193
193
|
|
194
|
-
def draw_cube(filled, x, y, z, size, color=nil)
|
195
|
-
not_support_method("draw_cube")
|
196
|
-
end
|
197
|
-
|
198
|
-
def draw_sphere(filled, x, y, z, radius, slices, stacks, color=nil)
|
199
|
-
not_support_method("draw_sphere")
|
200
|
-
end
|
201
|
-
|
202
|
-
def draw_cone(filled, x, y, z, base, height, slices, stacks, color=nil)
|
203
|
-
not_support_method("draw_cone")
|
204
|
-
end
|
205
|
-
|
206
|
-
def draw_torus(filled, x, y, z, inner_radius, outer_radius,
|
207
|
-
n_sides, rings, color=nil)
|
208
|
-
not_support_method("draw_torus")
|
209
|
-
end
|
210
|
-
|
211
|
-
def draw_tetrahedron(filled, x, y, z, color=nil)
|
212
|
-
not_support_method("draw_tetrahedron")
|
213
|
-
end
|
214
|
-
|
215
|
-
def draw_octahedron(filled, x, y, z, color=nil)
|
216
|
-
not_support_method("draw_octahedron")
|
217
|
-
end
|
218
|
-
|
219
|
-
def draw_dodecahedron(filled, x, y, z, color=nil)
|
220
|
-
not_support_method("draw_dodecahedron")
|
221
|
-
end
|
222
|
-
|
223
|
-
def draw_icosahedron(filled, x, y, z, color=nil)
|
224
|
-
not_support_method("draw_icosahedron")
|
225
|
-
end
|
226
|
-
|
227
|
-
def draw_teapot(filled, x, y, z, scale, color=nil)
|
228
|
-
not_support_method("draw_teapot")
|
229
|
-
end
|
230
|
-
|
231
|
-
def gl_compile(id)
|
232
|
-
not_support_method("gl_compile")
|
233
|
-
end
|
234
|
-
|
235
|
-
def gl_call_list(id, x, y, z, color=nil)
|
236
|
-
not_support_method("gl_call_list")
|
237
|
-
end
|
238
|
-
|
239
194
|
def gl_supported?
|
240
195
|
false
|
241
196
|
end
|
@@ -248,11 +203,6 @@ module Rabbit
|
|
248
203
|
5.0
|
249
204
|
end
|
250
205
|
|
251
|
-
def new_list_id
|
252
|
-
@list_id += 1
|
253
|
-
@list_id
|
254
|
-
end
|
255
|
-
|
256
206
|
private
|
257
207
|
def get_line_width(params, default=nil)
|
258
208
|
params[:line_width] || default
|
@@ -1,4 +1,4 @@
|
|
1
|
-
# Copyright (C) 2016-
|
1
|
+
# Copyright (C) 2016-2024 Sutou Kouhei <kou@cozmixng.org>
|
2
2
|
#
|
3
3
|
# This program is free software; you can redistribute it and/or modify
|
4
4
|
# it under the terms of the GNU General Public License as published by
|
@@ -118,11 +118,6 @@ module Rabbit
|
|
118
118
|
def offscreen_renderer?
|
119
119
|
true
|
120
120
|
end
|
121
|
-
|
122
|
-
def init_dpi
|
123
|
-
@x_dpi = ScreenInfo.screen_x_resolution
|
124
|
-
@y_dpi = ScreenInfo.screen_y_resolution
|
125
|
-
end
|
126
121
|
end
|
127
122
|
end
|
128
123
|
end
|
@@ -1,4 +1,4 @@
|
|
1
|
-
# Copyright (C) 2005-
|
1
|
+
# Copyright (C) 2005-2024 Sutou Kouhei <kou@cozmixng.org>
|
2
2
|
#
|
3
3
|
# This program is free software; you can redistribute it and/or modify
|
4
4
|
# it under the terms of the GNU General Public License as published by
|
@@ -183,19 +183,13 @@ module Rabbit
|
|
183
183
|
@background = make_color(@background_color)
|
184
184
|
end
|
185
185
|
|
186
|
-
def init_dpi
|
187
|
-
super
|
188
|
-
@x_dpi = 300
|
189
|
-
@y_dpi = 300
|
190
|
-
end
|
191
|
-
|
192
186
|
def update_layout
|
193
187
|
@layout = PrintLayout.create(self, @canvas)
|
194
188
|
end
|
195
189
|
|
196
190
|
def create_context(output=nil)
|
197
191
|
surface = find_surface(filename, output)
|
198
|
-
surface.set_fallback_resolution(
|
192
|
+
surface.set_fallback_resolution(300, 300)
|
199
193
|
::Cairo::Context.new(surface)
|
200
194
|
end
|
201
195
|
|
@@ -1,4 +1,4 @@
|
|
1
|
-
# Copyright (C) 2018 Kouhei
|
1
|
+
# Copyright (C) 2018-2024 Sutou Kouhei <kou@cozmixng.org>
|
2
2
|
#
|
3
3
|
# This program is free software; you can redistribute it and/or modify
|
4
4
|
# it under the terms of the GNU General Public License as published by
|
@@ -79,7 +79,11 @@ module Rabbit
|
|
79
79
|
|
80
80
|
def attach_to(window, container=nil)
|
81
81
|
super
|
82
|
-
|
82
|
+
if container
|
83
|
+
container.add(@fixed)
|
84
|
+
else
|
85
|
+
@window.child = @fixed
|
86
|
+
end
|
83
87
|
@fixed.show
|
84
88
|
attach_key(@window)
|
85
89
|
end
|
@@ -213,11 +217,6 @@ module Rabbit
|
|
213
217
|
end
|
214
218
|
|
215
219
|
private
|
216
|
-
def init_dpi
|
217
|
-
@x_dpi = ScreenInfo.screen_x_resolution
|
218
|
-
@y_dpi = ScreenInfo.screen_y_resolution
|
219
|
-
end
|
220
|
-
|
221
220
|
def init_ui
|
222
221
|
@fixed = Gtk::Fixed.new
|
223
222
|
@fixed.can_focus = true
|
data/lib/rabbit/source/argf.rb
CHANGED
@@ -1,3 +1,19 @@
|
|
1
|
+
# Copyright (C) 2004-2024 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
|
+
|
1
17
|
require "rabbit/source/base"
|
2
18
|
|
3
19
|
module Rabbit
|
@@ -21,7 +37,7 @@ module Rabbit
|
|
21
37
|
@argf.read
|
22
38
|
rescue
|
23
39
|
@logger.error($!.message)
|
24
|
-
""
|
40
|
+
+""
|
25
41
|
end
|
26
42
|
end
|
27
43
|
end
|
data/lib/rabbit/source/base.rb
CHANGED
@@ -1,3 +1,19 @@
|
|
1
|
+
# Copyright (C) 2004-2024 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 'fileutils'
|
2
18
|
require 'tmpdir'
|
3
19
|
|
@@ -35,7 +51,7 @@ module Rabbit
|
|
35
51
|
@source = _read
|
36
52
|
case @encoding
|
37
53
|
when nil
|
38
|
-
enc = guess_encoding(@source)
|
54
|
+
enc = guess_encoding(@source) || Encoding::ASCII_8BIT
|
39
55
|
when Encoding
|
40
56
|
enc = @encoding
|
41
57
|
else
|
@@ -128,15 +144,24 @@ module Rabbit
|
|
128
144
|
end
|
129
145
|
end
|
130
146
|
|
131
|
-
def guess_encoding(
|
132
|
-
|
133
|
-
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
|
147
|
+
def guess_encoding(string)
|
148
|
+
string = string.dup
|
149
|
+
candidates = [
|
150
|
+
Encoding::UTF_8,
|
151
|
+
Encoding::EUCJP_MS,
|
152
|
+
Encoding::EUCJP,
|
153
|
+
Encoding::WINDOWS_31J,
|
154
|
+
Encoding::Shift_JIS,
|
155
|
+
Encoding::CP51932,
|
156
|
+
Encoding::CP50221,
|
157
|
+
Encoding::ISO2022_JP,
|
158
|
+
Encoding::UTF_16BE,
|
159
|
+
Encoding::UTF_16LE,
|
160
|
+
]
|
161
|
+
candidates.find do |candidate|
|
162
|
+
next if candidate.dummy?
|
163
|
+
string.force_encoding(candidate).valid_encoding?
|
164
|
+
end
|
140
165
|
end
|
141
166
|
|
142
167
|
def extract_extension(path)
|
data/lib/rabbit/source/file.rb
CHANGED
@@ -1,3 +1,19 @@
|
|
1
|
+
# Copyright (C) 2004-2024 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
|
+
|
1
17
|
require 'rabbit/source/base'
|
2
18
|
|
3
19
|
module Rabbit
|
@@ -25,7 +41,7 @@ module Rabbit
|
|
25
41
|
rescue SourceUnreadableError
|
26
42
|
@logger.error($!.message)
|
27
43
|
@mtime = Time.now + LimitAccessInterval::MINIMUM_ACCESS_TIME
|
28
|
-
""
|
44
|
+
+""
|
29
45
|
end
|
30
46
|
end
|
31
47
|
|
data/lib/rabbit/source/uri.rb
CHANGED
@@ -1,3 +1,19 @@
|
|
1
|
+
# Copyright (C) 2004-2024 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
|
+
|
1
17
|
require "uri"
|
2
18
|
require "open-uri"
|
3
19
|
|
@@ -52,7 +68,7 @@ module Rabbit
|
|
52
68
|
rescue
|
53
69
|
@logger.error($!.message)
|
54
70
|
@last_modified = Time.now + MINIMUM_ACCESS_TIME
|
55
|
-
""
|
71
|
+
+""
|
56
72
|
end
|
57
73
|
end
|
58
74
|
|