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.
Files changed (137) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile +31 -0
  3. data/Rakefile +51 -73
  4. data/data/locale/ja/LC_MESSAGES/rabbit.mo +0 -0
  5. data/doc/en/how-to-make/markdown.md +28 -2
  6. data/doc/en/how-to-make/rd.rd +28 -2
  7. data/doc/en/install/homebrew.rd +0 -15
  8. data/doc/en/news.rd +67 -0
  9. data/doc/en/sample/hiki/rabbit.hiki +1 -1
  10. data/doc/en/sample/markdown/rabbit.md +1 -1
  11. data/doc/en/sample/rd/rabbit.rd +1 -1
  12. data/doc/en/usage/rabbit-slide.rd +1 -1
  13. data/doc/en/usage/rabbit.rd +1 -1
  14. data/doc/ja/how-to-make/markdown.md +25 -5
  15. data/doc/ja/how-to-make/rd.rd +25 -5
  16. data/doc/ja/install/homebrew.rd +0 -15
  17. data/doc/ja/news.rd +67 -0
  18. data/doc/ja/usage/rabbit.rd +1 -1
  19. data/lib/rabbit/action.rb +1 -23
  20. data/lib/rabbit/canvas.rb +2 -10
  21. data/lib/rabbit/command/rabbit-slide.rb +1 -1
  22. data/lib/rabbit/command/rabbit.rb +6 -4
  23. data/lib/rabbit/cursor-manager.rb +5 -5
  24. data/lib/rabbit/element/text.rb +66 -0
  25. data/lib/rabbit/error.rb +9 -1
  26. data/lib/rabbit/frame.rb +22 -2
  27. data/lib/rabbit/front.rb +1 -1
  28. data/lib/rabbit/gesture/handler.rb +5 -8
  29. data/lib/rabbit/gtk.rb +44 -2
  30. data/lib/rabbit/info-window.rb +16 -2
  31. data/lib/rabbit/menu.rb +1 -3
  32. data/lib/rabbit/parser/ext/charty.rb +9 -0
  33. data/lib/rabbit/parser/markdown/converter.rb +3 -3
  34. data/lib/rabbit/parser/rd/ext/block-verbatim.rb +0 -12
  35. data/lib/rabbit/parser/rd/ext/inline-verbatim.rb +23 -0
  36. data/lib/rabbit/parser/wiki/output.rb +0 -6
  37. data/lib/rabbit/renderer/base.rb +1 -9
  38. data/lib/rabbit/renderer/display/base.rb +7 -5
  39. data/lib/rabbit/renderer/display/button-handler.rb +25 -10
  40. data/lib/rabbit/renderer/display/cursor.rb +18 -2
  41. data/lib/rabbit/renderer/display/drawing-area-base.rb +23 -7
  42. data/lib/rabbit/renderer/display/drawing-area-primitive.rb +35 -20
  43. data/lib/rabbit/renderer/display/gesture.rb +17 -1
  44. data/lib/rabbit/renderer/engine/cairo.rb +27 -13
  45. data/lib/rabbit/renderer/gl.rb +0 -81
  46. data/lib/rabbit/renderer/kernel.rb +0 -50
  47. data/lib/rabbit/renderer/offscreen.rb +1 -6
  48. data/lib/rabbit/renderer/printer.rb +2 -8
  49. data/lib/rabbit/renderer/screen.rb +6 -7
  50. data/lib/rabbit/source/argf.rb +17 -1
  51. data/lib/rabbit/source/base.rb +35 -10
  52. data/lib/rabbit/source/file.rb +17 -1
  53. data/lib/rabbit/source/uri.rb +17 -1
  54. data/lib/rabbit/theme/dark-gradation/dark-gradation.rb +2 -2
  55. data/lib/rabbit/theme/default-comment/default-comment.rb +1 -5
  56. data/lib/rabbit/theme/image-slide-number/property.rb +1 -1
  57. data/lib/rabbit/theme/title-background-image/title-background-image.rb +2 -2
  58. data/lib/rabbit/trackball.rb +21 -21
  59. data/lib/rabbit/utils.rb +5 -45
  60. data/lib/rabbit/version.rb +1 -1
  61. data/lib/rabbit/video-window.rb +6 -2
  62. data/po/en/rabbit.edit.po +24 -38
  63. data/po/en/rabbit.po +9 -21
  64. data/po/fr/rabbit.edit.po +24 -38
  65. data/po/fr/rabbit.po +9 -21
  66. data/po/ja/rabbit.edit.po +56 -58
  67. data/po/ja/rabbit.po +12 -21
  68. data/rabbit.gemspec +11 -14
  69. data/sample/gl-sample.rd +2 -4
  70. data/sample/rabbit/theme/gl-sample/gl-sample.rb +1 -1
  71. data/sample/rabbit-en.hiki +1 -1
  72. data/sample/rabbit-en.md +1 -1
  73. data/sample/rabbit-en.rd +1 -13
  74. data/sample/rabbit.rd +1 -13
  75. data/test/helper.rb +1 -2
  76. data/test/parser/test-markdown.rb +4 -3
  77. data/test/parser/test-rd.rb +3 -3
  78. data/test/parser/test-wiki.rb +2 -2
  79. data/test/test-readme-parser.rb +15 -12
  80. data/test/test-source.rb +2 -2
  81. metadata +35 -122
  82. data/doc/images/screenshots/en/blue-circle-raw.png +0 -0
  83. data/doc/images/screenshots/en/blue-circle.png +0 -0
  84. data/doc/images/screenshots/en/clear-blue-raw.png +0 -0
  85. data/doc/images/screenshots/en/clear-blue.png +0 -0
  86. data/doc/images/screenshots/en/cozmixng-raw.png +0 -0
  87. data/doc/images/screenshots/en/cozmixng.png +0 -0
  88. data/doc/images/screenshots/en/dark-gradation-raw.png +0 -0
  89. data/doc/images/screenshots/en/dark-gradation.png +0 -0
  90. data/doc/images/screenshots/en/day-white-raw.png +0 -0
  91. data/doc/images/screenshots/en/day-white.png +0 -0
  92. data/doc/images/screenshots/en/debian-raw.png +0 -0
  93. data/doc/images/screenshots/en/debian.png +0 -0
  94. data/doc/images/screenshots/en/green-circle-raw.png +0 -0
  95. data/doc/images/screenshots/en/green-circle.png +0 -0
  96. data/doc/images/screenshots/en/night-black-raw.png +0 -0
  97. data/doc/images/screenshots/en/night-black.png +0 -0
  98. data/doc/images/screenshots/en/rabbit-raw.png +0 -0
  99. data/doc/images/screenshots/en/rabbit.png +0 -0
  100. data/doc/images/screenshots/en/ranguba-raw.png +0 -0
  101. data/doc/images/screenshots/en/ranguba.png +0 -0
  102. data/doc/images/screenshots/en/red-frame-raw.png +0 -0
  103. data/doc/images/screenshots/en/red-frame.png +0 -0
  104. data/doc/images/screenshots/en/ruby-gnome2-raw.png +0 -0
  105. data/doc/images/screenshots/en/ruby-gnome2.png +0 -0
  106. data/doc/images/screenshots/en/rubykaigi2011-raw.png +0 -0
  107. data/doc/images/screenshots/en/rubykaigi2011.png +0 -0
  108. data/doc/images/screenshots/ja/blue-circle-raw.png +0 -0
  109. data/doc/images/screenshots/ja/blue-circle.png +0 -0
  110. data/doc/images/screenshots/ja/clear-blue-raw.png +0 -0
  111. data/doc/images/screenshots/ja/clear-blue.png +0 -0
  112. data/doc/images/screenshots/ja/cozmixng-raw.png +0 -0
  113. data/doc/images/screenshots/ja/cozmixng.png +0 -0
  114. data/doc/images/screenshots/ja/dark-gradation-raw.png +0 -0
  115. data/doc/images/screenshots/ja/dark-gradation.png +0 -0
  116. data/doc/images/screenshots/ja/day-white-raw.png +0 -0
  117. data/doc/images/screenshots/ja/day-white.png +0 -0
  118. data/doc/images/screenshots/ja/debian-raw.png +0 -0
  119. data/doc/images/screenshots/ja/debian.png +0 -0
  120. data/doc/images/screenshots/ja/green-circle-raw.png +0 -0
  121. data/doc/images/screenshots/ja/green-circle.png +0 -0
  122. data/doc/images/screenshots/ja/night-black-raw.png +0 -0
  123. data/doc/images/screenshots/ja/night-black.png +0 -0
  124. data/doc/images/screenshots/ja/rabbit-raw.png +0 -0
  125. data/doc/images/screenshots/ja/rabbit.png +0 -0
  126. data/doc/images/screenshots/ja/ranguba-raw.png +0 -0
  127. data/doc/images/screenshots/ja/ranguba.png +0 -0
  128. data/doc/images/screenshots/ja/red-frame-raw.png +0 -0
  129. data/doc/images/screenshots/ja/red-frame.png +0 -0
  130. data/doc/images/screenshots/ja/ruby-gnome2-raw.png +0 -0
  131. data/doc/images/screenshots/ja/ruby-gnome2.png +0 -0
  132. data/doc/images/screenshots/ja/rubykaigi2011-raw.png +0 -0
  133. data/doc/images/screenshots/ja/rubykaigi2011.png +0 -0
  134. data/lib/rabbit/parser/ext/emacs.rb +0 -121
  135. data/lib/rabbit/renderer/display/clutter-embed.rb +0 -606
  136. data/lib/rabbit/theme/clutter-comment/clutter-comment.rb +0 -76
  137. data/lib/rabbit/theme/clutter-comment/property.rb +0 -3
data/lib/rabbit/canvas.rb CHANGED
@@ -1,4 +1,4 @@
1
- # Copyright (C) 2004-2021 Sutou Kouhei <kou@cozmixng.org>
1
+ # Copyright (C) 2004-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
@@ -93,14 +93,6 @@ module Rabbit
93
93
  def_delegators(:@renderer, :draw_poppler_page)
94
94
  def_delegators(:@renderer, :draw_link)
95
95
 
96
- def_delegators(:@renderer, :draw_cube, :draw_sphere, :draw_cone)
97
- def_delegators(:@renderer, :draw_torus, :draw_tetrahedron)
98
- def_delegators(:@renderer, :draw_octahedron, :draw_dodecahedron)
99
- def_delegators(:@renderer, :draw_icosahedron, :draw_teapot)
100
-
101
- def_delegators(:@renderer, :gl_compile, :gl_call_list)
102
- def_delegators(:@renderer, :new_list_id)
103
-
104
96
  def_delegators(:@renderer, :z_far, :z_view)
105
97
 
106
98
  def_delegators(:@renderer, :flag_size)
@@ -110,7 +102,6 @@ module Rabbit
110
102
  def_delegators(:@renderer, :confirm)
111
103
 
112
104
  def_delegators(:@renderer, :display?, :printable?)
113
- def_delegators(:@renderer, :x_dpi, :y_dpi)
114
105
 
115
106
  def_delegators(:@renderer, :whiteouting?, :blackouting?)
116
107
  def_delegators(:@renderer, :toggle_whiteout, :toggle_blackout)
@@ -684,6 +675,7 @@ module Rabbit
684
675
 
685
676
  def reset_timer
686
677
  @limit_time = nil
678
+ reload_theme
687
679
  end
688
680
 
689
681
  def apply_timer
@@ -189,7 +189,7 @@ module Rabbit
189
189
  end
190
190
 
191
191
  parser.on("--allotted-time=TIME",
192
- _("Allotted time in presentaion"),
192
+ _("Allotted time in presentation"),
193
193
  _("(e.g.: %s)") % "--allotted-time=5m",
194
194
  _("(optional)")) do |allotted_time|
195
195
  @data.allotted_time = allotted_time
@@ -1,4 +1,4 @@
1
- # Copyright (C) 2004-2019 Sutou Kouhei <kou@cozmixng.org>
1
+ # Copyright (C) 2004-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
@@ -853,9 +853,11 @@ module Rabbit
853
853
  setup_3d_info(canvas)
854
854
  frame.init_gui(@options.width, @options.height, true)
855
855
  frame.fullscreen if @options.full_screen
856
- native_window = frame.window.window
857
- if @options.show_native_window_id and native_window.respond_to?(:xid)
858
- @logger.info(_("Window ID: %d") % native_window.xid)
856
+ if @options.show_native_window_id
857
+ native_surface = frame.window.surface
858
+ if native_surface.respond_to?(:xid)
859
+ @logger.info(_("Window ID: %d") % native_surface.xid)
860
+ end
859
861
  end
860
862
  apply_theme_if_need(frame)
861
863
  parse(frame, source, !Utils.windows?)
@@ -1,4 +1,4 @@
1
- # Copyright (C) 2006-2015 Kouhei Sutou <kou@cozmixng.org>
1
+ # Copyright (C) 2006-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
@@ -39,17 +39,17 @@ module Rabbit
39
39
  @stocks[name].push(@current)
40
40
  end
41
41
 
42
- def restore(drawable, name)
42
+ def restore(surface, name)
43
43
  if name.nil?
44
44
  type = @current
45
45
  else
46
46
  type = @stocks[name].pop
47
47
  end
48
- drawable.cursor = type_to_cursor(type)
48
+ surface.cursor = type_to_cursor(type)
49
49
  end
50
50
 
51
- def update(drawable, type)
52
- drawable.cursor = type_to_cursor(type)
51
+ def update(surface, type)
52
+ surface.cursor = type_to_cursor(type)
53
53
  end
54
54
 
55
55
  private
@@ -1,3 +1,19 @@
1
+ # Copyright (C) 2006-2023 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/element/text-element'
2
18
  require 'rabbit/element/text-container-element'
3
19
  require 'rabbit/element/text-block-element'
@@ -8,6 +24,56 @@ module Rabbit
8
24
  include TextElement
9
25
  end
10
26
 
27
+ class FontAwesomeText
28
+ include TextElement
29
+
30
+ class << self
31
+ def [](name)
32
+ mapping[name]
33
+ end
34
+
35
+ private
36
+ @mapping = nil
37
+ def mapping
38
+ @mapping ||= File.open(css_path) do |css|
39
+ mapping = {}
40
+ names = []
41
+ css.each_line do |line|
42
+ case line
43
+ when /\A\.fa-(.+?):before/
44
+ names << Regexp.last_match[1]
45
+ when /\A\s*content:\s*\"\\(.+?)\"/
46
+ code_point = Integer(Regexp.last_match[1], 16)
47
+ character = [code_point].pack("U")
48
+ names.each do |name|
49
+ mapping[name] = character
50
+ end
51
+ names.clear
52
+ when /\A}/
53
+ names.clear
54
+ end
55
+ end
56
+ mapping
57
+ end
58
+ end
59
+
60
+ def css_path
61
+ ENV["RABBIT_FONT_AWESOME_CSS"] ||
62
+ "/usr/share/fonts-font-awesome/css/font-awesome.css" # Debian
63
+ end
64
+ end
65
+
66
+ def initialize(*args)
67
+ super(*args)
68
+ @character = self.class[@text]
69
+ raise UnknownFontAwesomeNameError.new(@text) if @character.nil?
70
+ end
71
+
72
+ def markuped_text
73
+ "<span font_family=\"FontAwesome\">#{@character}</span>"
74
+ end
75
+ end
76
+
11
77
  class TextContainer
12
78
  include TextContainerElement
13
79
  end
data/lib/rabbit/error.rb CHANGED
@@ -1,4 +1,4 @@
1
- # Copyright (C) 2004-2022 Sutou Kouhei <kou@cozmixng.org>
1
+ # Copyright (C) 2004-2023 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
@@ -228,4 +228,12 @@ module Rabbit
228
228
  super(_("print isn't supported"))
229
229
  end
230
230
  end
231
+
232
+ class UnknownFontAwesomeNameError < Error
233
+ attr_reader :name
234
+ def initialize(name)
235
+ @name = name
236
+ super(_("unknown Font Awesome name: %s") % @name)
237
+ end
238
+ end
231
239
  end
data/lib/rabbit/frame.rb CHANGED
@@ -1,9 +1,30 @@
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 "forwardable"
2
18
  require "rabbit/gtk"
3
19
  require "rexml/text"
4
20
 
5
21
  begin
6
- require "vte3"
22
+ case ENV["RABBIT_GTK"]
23
+ when "4"
24
+ require "vte4"
25
+ else
26
+ require "vte3"
27
+ end
7
28
  rescue LoadError
8
29
  end
9
30
 
@@ -12,7 +33,6 @@ require "rabbit/utils"
12
33
 
13
34
  module Rabbit
14
35
  class Frame
15
- include ScreenInfo
16
36
  extend Forwardable
17
37
 
18
38
  def_delegators(:@window, :icon, :icon=, :set_icon)
data/lib/rabbit/front.rb CHANGED
@@ -229,7 +229,7 @@ module Rabbit
229
229
  send_arguments = [name.to_s.dump, *arg_list].join(', ')
230
230
  dirty_source = nil
231
231
  dirty_source = "dirty!" if need_clear_cache
232
- if (level & PublicLevel::CONTROL).zero?
232
+ if (level & (PublicLevel::MOVE | PublicLevel::CONTROL)).zero?
233
233
  instance_eval(<<-EOS, __FILE__, __LINE__ + 1)
234
234
  def self.#{name}(#{arg_str})
235
235
  result = @canvas.__send__(#{send_arguments})
@@ -1,4 +1,4 @@
1
- # Copyright (C) 2006-2017 Kouhei Sutou <kou@cozmixng.org>
1
+ # Copyright (C) 2006-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
@@ -93,13 +93,10 @@ module Rabbit
93
93
  end
94
94
 
95
95
  def draw(renderer)
96
- if @back_color.alpha == 1.0 or
97
- (@back_color.alpha < 1.0 and renderer.alpha_available?)
98
- size = renderer.size
99
- args = [true, 0, 0, size.real_width, size.real_height]
100
- args << @back_color
101
- renderer.draw_rectangle(*args)
102
- end
96
+ size = renderer.size
97
+ renderer.draw_rectangle(true,
98
+ 0, 0, size.real_width, size.real_height,
99
+ @back_color)
103
100
 
104
101
  draw_available_marks(renderer, next_available_motions)
105
102
 
data/lib/rabbit/gtk.rb CHANGED
@@ -1,4 +1,4 @@
1
- # Copyright (C) 2014-2018 Kouhei Sutou <kou@cozmixng.org>
1
+ # Copyright (C) 2014-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
@@ -14,4 +14,46 @@
14
14
  # with this program; if not, write to the Free Software Foundation, Inc.,
15
15
  # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
16
16
 
17
- require "gtk3"
17
+ case ENV["RABBIT_GTK"]
18
+ when "4"
19
+ require "gtk4"
20
+ else
21
+ require "gtk3"
22
+ end
23
+
24
+ Gtk.init if Gtk.respond_to?(:init)
25
+
26
+ module Gtk
27
+ if const_defined?(:Action)
28
+ class Action
29
+ alias _activate activate
30
+ def activate(&block)
31
+ @block = block
32
+ _activate
33
+ ensure
34
+ @block = nil
35
+ end
36
+
37
+ def block_given?
38
+ not @block.nil?
39
+ end
40
+
41
+ def call(*args, &block)
42
+ @block.call(*args, &block)
43
+ end
44
+ end
45
+ end
46
+
47
+ unless const_defined?(:Native)
48
+ # For GTK 3
49
+ #
50
+ # GTK 4 renames Gdk::Window to Gdk::Surface
51
+ class Widget
52
+ def native
53
+ self
54
+ end
55
+
56
+ alias_method :surface, :window
57
+ end
58
+ end
59
+ end
@@ -1,4 +1,4 @@
1
- # Copyright (C) 2006-2018 Kouhei Sutou <kou@cozmixng.org>
1
+ # Copyright (C) 2006-2023 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
@@ -230,7 +230,12 @@ module Rabbit
230
230
  def init_timer_area
231
231
  @timer_area = Gtk::DrawingArea.new
232
232
  @timer_area.signal_connect("draw") do |area, context|
233
- context.set_source_rgb(1, 0, 0) if rest_time and rest_time < 0
233
+ draw_background(area, context)
234
+ if rest_time and rest_time < 0
235
+ context.set_source_rgb(1, 0, 0)
236
+ else
237
+ context.set_source_rgb(0, 0, 0)
238
+ end
234
239
  draw_text_as_large_as_possible(area,
235
240
  context,
236
241
  timer_text,
@@ -242,6 +247,8 @@ module Rabbit
242
247
  def init_note_area
243
248
  @note_area = Gtk::DrawingArea.new
244
249
  @note_area.signal_connect("draw") do |area, context|
250
+ draw_background(area, context)
251
+ context.set_source_rgb(0, 0, 0)
245
252
  draw_text_as_large_as_possible(area, context, note_text)
246
253
  Gdk::Event::PROPAGATE
247
254
  end
@@ -253,6 +260,13 @@ module Rabbit
253
260
  adjust_slide
254
261
  end
255
262
 
263
+ def draw_background(area, context)
264
+ context.save do
265
+ context.set_source_rgb(1, 1, 1)
266
+ context.paint
267
+ end
268
+ end
269
+
256
270
  def note_text
257
271
  note = @canvas.current_slide["note"]
258
272
  return note if note.nil?
data/lib/rabbit/menu.rb CHANGED
@@ -1,4 +1,4 @@
1
- # Copyright (C) 2004-2015 Kouhei Sutou <kou@cozmixng.org>
1
+ # Copyright (C) 2004-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
@@ -92,7 +92,6 @@ module Rabbit
92
92
 
93
93
  @jump_to_merge_id = @merge.new_merge_id
94
94
  @jump_to_actions = Gtk::ActionGroup.new("JumpToActions")
95
- @jump_to_actions_keeper = [] # Workaround for > Ruby/GTK2 0.16
96
95
  @merge.insert_action_group(@jump_to_actions, 0)
97
96
  jump_to_path = "/popup/JumpTo"
98
97
  jump_to_action = canvas.action("JumpTo")
@@ -100,7 +99,6 @@ module Rabbit
100
99
  canvas.slides.each_with_index do |slide, i|
101
100
  action = make_jump_to_action(jump_to_action, slide.title, i)
102
101
  @jump_to_actions.add_action(action)
103
- @jump_to_actions_keeper << action # Workaround for > Ruby/GTK2 0.16
104
102
  @merge.add_ui(@jump_to_merge_id, jump_to_path, action.name,
105
103
  action.name, :auto, false)
106
104
  end
@@ -27,6 +27,12 @@ module Rabbit
27
27
  require "charty"
28
28
  backend = prop["backend"]
29
29
  ::Charty::Backends.use(backend) if backend
30
+ font_family = prop["font-family"]
31
+ if font_family and backend == "pyplot"
32
+ default_font_family = ::Matplotlib.rcParams["font.sans-serif"]
33
+ ::Matplotlib.rcParams["font.sans-serif"] =
34
+ [font_family, *default_font_family]
35
+ end
30
36
  data = CSV.read(path, headers: true, converters: :all)
31
37
  type = prop["type"]
32
38
  case type
@@ -50,6 +56,9 @@ module Rabbit
50
56
  end
51
57
  image_file = Tempfile.new(["rabbit-image-charty", ".svg"])
52
58
  plotter.save(image_file.path)
59
+ if font_family and backend == "pyplot"
60
+ ::Matplotlib.rcParams["font.sans-serif"] = default_font_family
61
+ end
53
62
  image_file
54
63
  end
55
64
  end
@@ -1,4 +1,4 @@
1
- # Copyright (C) 2012-2022 Sutou Kouhei <kou@cozmixng.org>
1
+ # Copyright (C) 2012-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
@@ -170,10 +170,10 @@ module Rabbit
170
170
  _("multiple ![alt]{image}s in a paragraph isn't supported.")
171
171
  end
172
172
  if child_types.include?(:img)
173
- message =
173
+ format =
174
174
  _("![alt]{image} and other contents in a paragraph " \
175
175
  "isn't supported: %{types}")
176
- raise ParseError, message % {types: child_types}
176
+ raise ParseError, format % {types: child_types}
177
177
  end
178
178
  if element.options[:transparent] and child_types == [:text]
179
179
  element.children.first.value.chomp!
@@ -26,7 +26,6 @@ require "rabbit/parser/ext/aafigure"
26
26
  require "rabbit/parser/ext/blockdiag"
27
27
  require "rabbit/parser/ext/charty"
28
28
  require "rabbit/parser/ext/coderay"
29
- require "rabbit/parser/ext/emacs"
30
29
  require "rabbit/parser/ext/enscript"
31
30
  require "rabbit/parser/ext/rouge"
32
31
  require "rabbit/parser/ext/tex"
@@ -120,17 +119,6 @@ module Rabbit
120
119
  result || default_ext_block_verbatim(label, src, src, visitor)
121
120
  end
122
121
 
123
- def ext_block_verb_emacs(label, source, content, visitor)
124
- return nil unless /\Aemacs(?:\s+(.+))?\z/i =~ label
125
- mode_line = $1
126
-
127
- src, prop = parse_source(source)
128
- logger = visitor.logger
129
-
130
- result = Parser::Ext::Emacs.highlight(src, logger, mode_line)
131
- result || default_ext_block_verbatim(label, src, src, visitor)
132
- end
133
-
134
122
  def ext_block_verb_rt(label, source, content, visitor)
135
123
  return nil unless /\Art\z/i =~ label
136
124
  unless defined?(RT2RabbitVisitor)
@@ -1,3 +1,19 @@
1
+ # Copyright (C) 2007-2023 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/utils'
2
18
  require 'rabbit/parser/ext/inline'
3
19
  require 'rabbit/parser/rd/ext/base'
@@ -88,6 +104,13 @@ module Rabbit
88
104
  CustomTag.new(name)
89
105
  end
90
106
  end
107
+
108
+ def ext_inline_verb_font_awesome(label, source, content, visitor)
109
+ label = label.to_s
110
+ return nil unless /\Afont-awesome:(.+?)\z/ =~ label
111
+ name = $1
112
+ FontAwesomeText.new(name)
113
+ end
91
114
  end
92
115
  end
93
116
  end
@@ -25,7 +25,6 @@ require "rabbit/parser/ext/tex"
25
25
  require "rabbit/parser/ext/aafigure"
26
26
  require "rabbit/parser/ext/blockdiag"
27
27
  require "rabbit/parser/ext/coderay"
28
- require "rabbit/parser/ext/emacs"
29
28
  require "rabbit/parser/ext/entity"
30
29
  require "rabbit/parser/ext/rouge"
31
30
 
@@ -530,11 +529,6 @@ module Rabbit
530
529
  Ext::CodeRay.highlight(lang, source, logger)
531
530
  end
532
531
 
533
- def emacs(source, mode_line=nil)
534
- logger = @output.canvas.logger
535
- Ext::Emacs.highlight(source, logger, mode_line)
536
- end
537
-
538
532
  def rouge(lang, source)
539
533
  logger = @output.canvas.logger
540
534
  Ext::Rouge.highlight(lang, source, logger)
@@ -1,4 +1,4 @@
1
- # Copyright (C) 2004-2019 Kouhei Sutou <kou@cozmixng.org>
1
+ # Copyright (C) 2004-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
@@ -33,7 +33,6 @@ module Rabbit
33
33
 
34
34
  def_delegators(:@canvas, :reload_source)
35
35
 
36
- attr_reader :x_dpi, :y_dpi
37
36
  attr_accessor :base_width
38
37
  attr_accessor :base_height
39
38
  attr_accessor :paper_width, :paper_height, :slides_per_page
@@ -67,7 +66,6 @@ module Rabbit
67
66
  @page_margin_bottom = nil
68
67
  @whiteout = false
69
68
  @blackout = false
70
- @list_id = 0
71
69
  @adjustment_x = 0
72
70
  @adjustment_y = 0
73
71
  @progress_foreground = nil
@@ -76,7 +74,6 @@ module Rabbit
76
74
  @graffiti_line_width = nil
77
75
  @draw_scaled_image = true
78
76
  clean
79
- init_dpi
80
77
  init_gl_parameters
81
78
  end
82
79
 
@@ -359,11 +356,6 @@ module Rabbit
359
356
  @canvas.logger.warn(msg)
360
357
  end
361
358
 
362
- def init_dpi
363
- @x_dpi = 72
364
- @y_dpi = 72
365
- end
366
-
367
359
  def init_gl_parameters
368
360
  angle = 0.0 * (Math::PI / 180.0)
369
361
  axis_x = 1.0
@@ -1,4 +1,4 @@
1
- # Copyright (C) 2006-2019 Kouhei Sutou <kou@cozmixng.org>
1
+ # Copyright (C) 2006-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
@@ -25,7 +25,7 @@ module Rabbit
25
25
  include HookHandler
26
26
 
27
27
  def initialize(*args, &block)
28
- @drawable = nil
28
+ @surface = nil
29
29
  @size = nil
30
30
  @size_dirty = true
31
31
  super
@@ -154,9 +154,9 @@ module Rabbit
154
154
  end
155
155
 
156
156
  private
157
- def set_drawable(drawable)
158
- @drawable = drawable
159
- set_default_size(@drawable.width, @drawable.height)
157
+ def set_surface(surface)
158
+ @surface = surface
159
+ set_default_size(@surface.width, @surface.height)
160
160
  end
161
161
 
162
162
  def set_default_size(w, h)
@@ -175,6 +175,8 @@ module Rabbit
175
175
  end
176
176
 
177
177
  def update_size(w, h)
178
+ return if @real_width == w and @real_height == h
179
+
178
180
  @real_width = w
179
181
  @real_height = h
180
182
  @size_dirty = true
@@ -1,4 +1,20 @@
1
- require 'rabbit/gtk'
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
+
17
+ require "rabbit/gtk"
2
18
 
3
19
  module Rabbit
4
20
  module Renderer
@@ -45,17 +61,16 @@ module Rabbit
45
61
  end
46
62
  end
47
63
 
48
- BUTTON_PRESS_HANDLER = {
49
- Gdk::EventType::BUTTON_PRESS => "handle_button_press",
50
- Gdk::EventType::BUTTON2_PRESS => "handle_button2_press",
51
- Gdk::EventType::BUTTON3_PRESS => "handle_button3_press",
52
- }
53
-
54
64
  def handle_button_release(event, last_button_press_event)
55
65
  press_event_type = last_button_press_event.event_type
56
- if BUTTON_PRESS_HANDLER.has_key?(press_event_type)
57
- __send__(BUTTON_PRESS_HANDLER[press_event_type],
58
- last_button_press_event, event)
66
+ handlers = {
67
+ Gdk::EventType::BUTTON_PRESS => :handle_button_press,
68
+ Gdk::EventType::BUTTON2_PRESS => :handle_button2_press,
69
+ Gdk::EventType::BUTTON3_PRESS => :handle_button3_press,
70
+ }
71
+ handler = handlers[press_event_type]
72
+ if handler
73
+ __send__(handler, last_button_press_event, event)
59
74
  start_button_handler
60
75
  end
61
76
  true
@@ -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/cursor-manager"
2
18
 
3
19
  module Rabbit
@@ -19,13 +35,13 @@ module Rabbit
19
35
  end
20
36
 
21
37
  def restore_cursor(name)
22
- @cursor_manager.restore(@drawable, name)
38
+ @cursor_manager.restore(@surface, name)
23
39
  end
24
40
 
25
41
  def update_cursor(cursor_type, update_current_cursor=false)
26
42
  @cursor_manager.current = cursor_type if update_current_cursor
27
43
  cursor_type = :pencil if @graffiti_mode
28
- @cursor_manager.update(@drawable, cursor_type)
44
+ @cursor_manager.update(@surface, cursor_type)
29
45
  end
30
46
  end
31
47
  end