wxruby3-shapes 0.9.0.pre.beta.3

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 (112) hide show
  1. checksums.yaml +7 -0
  2. data/.yardopts +12 -0
  3. data/CREDITS.md +18 -0
  4. data/INSTALL.md +39 -0
  5. data/LICENSE +21 -0
  6. data/README.md +118 -0
  7. data/assets/screenshot.png +0 -0
  8. data/bin/wx-shapes +9 -0
  9. data/lib/wx/shapes/arrow_base.rb +86 -0
  10. data/lib/wx/shapes/arrows/circle_arrow.rb +39 -0
  11. data/lib/wx/shapes/arrows/diamond_arrow.rb +33 -0
  12. data/lib/wx/shapes/arrows/open_arrow.rb +56 -0
  13. data/lib/wx/shapes/arrows/solid_arrow.rb +69 -0
  14. data/lib/wx/shapes/art/shape_canvas/page.xpm +73 -0
  15. data/lib/wx/shapes/auto_layout.rb +358 -0
  16. data/lib/wx/shapes/base.rb +33 -0
  17. data/lib/wx/shapes/canvas_history.rb +84 -0
  18. data/lib/wx/shapes/connection_point.rb +238 -0
  19. data/lib/wx/shapes/core.rb +19 -0
  20. data/lib/wx/shapes/diagram.rb +659 -0
  21. data/lib/wx/shapes/events.rb +389 -0
  22. data/lib/wx/shapes/printout.rb +136 -0
  23. data/lib/wx/shapes/serializable.rb +440 -0
  24. data/lib/wx/shapes/serialize/core.rb +40 -0
  25. data/lib/wx/shapes/serialize/id.rb +82 -0
  26. data/lib/wx/shapes/serialize/wx.rb +104 -0
  27. data/lib/wx/shapes/serializer/json.rb +258 -0
  28. data/lib/wx/shapes/serializer/yaml.rb +125 -0
  29. data/lib/wx/shapes/shape.rb +2129 -0
  30. data/lib/wx/shapes/shape_canvas.rb +3285 -0
  31. data/lib/wx/shapes/shape_data_object.rb +43 -0
  32. data/lib/wx/shapes/shape_handle.rb +287 -0
  33. data/lib/wx/shapes/shape_list.rb +161 -0
  34. data/lib/wx/shapes/shapes/bitmap_shape.rb +257 -0
  35. data/lib/wx/shapes/shapes/circle_shape.rb +136 -0
  36. data/lib/wx/shapes/shapes/control_shape.rb +483 -0
  37. data/lib/wx/shapes/shapes/curve_shape.rb +231 -0
  38. data/lib/wx/shapes/shapes/diamond_shape.rb +62 -0
  39. data/lib/wx/shapes/shapes/edit_text_shape.rb +317 -0
  40. data/lib/wx/shapes/shapes/ellipse_shape.rb +106 -0
  41. data/lib/wx/shapes/shapes/flex_grid_shape.rb +78 -0
  42. data/lib/wx/shapes/shapes/grid_shape.rb +404 -0
  43. data/lib/wx/shapes/shapes/line_shape.rb +907 -0
  44. data/lib/wx/shapes/shapes/multi_sel_rect.rb +214 -0
  45. data/lib/wx/shapes/shapes/ortho_shape.rb +357 -0
  46. data/lib/wx/shapes/shapes/polygon_shape.rb +294 -0
  47. data/lib/wx/shapes/shapes/rect_shape.rb +378 -0
  48. data/lib/wx/shapes/shapes/round_ortho_shape.rb +131 -0
  49. data/lib/wx/shapes/shapes/round_rect_shape.rb +142 -0
  50. data/lib/wx/shapes/shapes/square_shape.rb +119 -0
  51. data/lib/wx/shapes/shapes/text_shape.rb +324 -0
  52. data/lib/wx/shapes/thumbnail.rb +234 -0
  53. data/lib/wx/shapes/version.rb +12 -0
  54. data/lib/wx/shapes/wx.rb +29 -0
  55. data/lib/wx/shapes.rb +18 -0
  56. data/lib/wx/wx-shapes/base.rb +87 -0
  57. data/lib/wx/wx-shapes/cmd/sampler.rb +58 -0
  58. data/lib/wx/wx-shapes/cmd/test.rb +27 -0
  59. data/rakelib/yard/templates/default/fulldoc/html/css/wxruby3.css +7 -0
  60. data/rakelib/yard/templates/default/layout/html/setup.rb +5 -0
  61. data/rakelib/yard/yard/relative_markdown_links/version.rb +8 -0
  62. data/rakelib/yard/yard/relative_markdown_links.rb +39 -0
  63. data/rakelib/yard/yard-custom-templates.rb +2 -0
  64. data/rakelib/yard/yard-relative_markdown_links.rb +4 -0
  65. data/samples/demo/art/AlignBottom.xpm +35 -0
  66. data/samples/demo/art/AlignCenter.xpm +35 -0
  67. data/samples/demo/art/AlignLeft.xpm +35 -0
  68. data/samples/demo/art/AlignMiddle.xpm +35 -0
  69. data/samples/demo/art/AlignRight.xpm +35 -0
  70. data/samples/demo/art/AlignTop.xpm +35 -0
  71. data/samples/demo/art/Bitmap.xpm +25 -0
  72. data/samples/demo/art/Circle.xpm +22 -0
  73. data/samples/demo/art/Curve.xpm +21 -0
  74. data/samples/demo/art/Diamond.xpm +22 -0
  75. data/samples/demo/art/EditText.xpm +21 -0
  76. data/samples/demo/art/Ellipse.xpm +22 -0
  77. data/samples/demo/art/FixedRect.xpm +22 -0
  78. data/samples/demo/art/FlexGrid.xpm +22 -0
  79. data/samples/demo/art/GC.xpm +23 -0
  80. data/samples/demo/art/Grid.xpm +22 -0
  81. data/samples/demo/art/Line.xpm +21 -0
  82. data/samples/demo/art/NoSource.xpm +69 -0
  83. data/samples/demo/art/OrthoLine.xpm +21 -0
  84. data/samples/demo/art/Rect.xpm +22 -0
  85. data/samples/demo/art/RoundOrthoLine.xpm +21 -0
  86. data/samples/demo/art/RoundRect.xpm +22 -0
  87. data/samples/demo/art/Shadow.xpm +23 -0
  88. data/samples/demo/art/StandAloneLine.xpm +22 -0
  89. data/samples/demo/art/Text.xpm +21 -0
  90. data/samples/demo/art/Tool.xpm +23 -0
  91. data/samples/demo/art/sample.xpm +251 -0
  92. data/samples/demo/demo.rb +658 -0
  93. data/samples/demo/frame_canvas.rb +422 -0
  94. data/samples/demo/images/motyl.bmp +0 -0
  95. data/samples/demo/images/motyl2.bmp +0 -0
  96. data/samples/sample1/art/sample.xpm +251 -0
  97. data/samples/sample1/sample.rb +263 -0
  98. data/samples/sample2/art/sample.xpm +251 -0
  99. data/samples/sample2/sample.rb +133 -0
  100. data/samples/sample2/sample_canvas.rb +35 -0
  101. data/samples/sample2/sample_shape.rb +108 -0
  102. data/samples/sample3/art/sample.xpm +251 -0
  103. data/samples/sample3/sample.rb +281 -0
  104. data/samples/sample4/art/sample.xpm +251 -0
  105. data/samples/sample4/sample.rb +180 -0
  106. data/tests/art/motyl.bmp +0 -0
  107. data/tests/lib/wxapp_runner.rb +64 -0
  108. data/tests/serializer_tests.rb +521 -0
  109. data/tests/test_grid_shapes.rb +42 -0
  110. data/tests/test_serialize.rb +7 -0
  111. data/tests/test_serialize_yaml.rb +17 -0
  112. metadata +242 -0
@@ -0,0 +1,234 @@
1
+ # Wx::SF::Thumbnail - canvas thumbnail class
2
+ # Copyright (c) M.J.N. Corino, The Netherlands
3
+
4
+ module Wx::SF
5
+
6
+ class Thumbnail < Wx::Panel
7
+
8
+ # Internally used IDs
9
+ module ID
10
+ include Wx::IDHelper
11
+ UPDATETIMER = self.next_id
12
+ M_SHOWELEMENTS = self.next_id
13
+ M_SHOWCONNECTIONS = self.next_id
14
+ end
15
+
16
+ # Thumbnail style
17
+ class THUMBSTYLE < Wx::Enum
18
+ # Show diagram elements (excluding connections) in the thumbnail.
19
+ SHOW_ELEMENTS = self.new(1)
20
+ # Show diagram connections in the thumbnail.
21
+ SHOW_CONNECTIONS = self.new(2)
22
+ end
23
+
24
+ def initialize(parent)
25
+ super(parent, Wx::ID_ANY, size: [200, 150], style: Wx::TAB_TRAVERSAL | Wx::FULL_REPAINT_ON_RESIZE)
26
+ set_extra_style(Wx::WS_EX_BLOCK_EVENTS)
27
+ set_size_hints([10, 10])
28
+
29
+ @canvas = nil
30
+ @scale = 1.0
31
+ @thumb_style = THUMBSTYLE::SHOW_ELEMENTS | THUMBSTYLE::SHOW_CONNECTIONS
32
+ @prev_mouse_pos = nil
33
+
34
+ @update_timer = Wx::Timer.new(self, ID::UPDATETIMER)
35
+
36
+ set_background_style(Wx::BG_STYLE_PAINT)
37
+
38
+ evt_paint :_on_paint
39
+ evt_erase_background :_on_erase_background
40
+ evt_motion :_on_mouse_move
41
+ evt_left_down :_on_left_down
42
+ evt_right_down :_on_right_down
43
+ evt_timer(ID::UPDATETIMER, :_on_timer)
44
+ evt_update_ui(ID::M_SHOWELEMENTS, :_on_update_show_elements)
45
+ evt_update_ui(ID::M_SHOWCONNECTIONS, :_on_update_show_connections)
46
+ evt_menu(ID::M_SHOWELEMENTS, :_on_show_elements)
47
+ evt_menu(ID::M_SHOWCONNECTIONS, :_on_show_connections)
48
+ end
49
+
50
+ # Access (get/set) thumbnail style.
51
+ attr_accessor :thumb_style
52
+
53
+ # Set canvas managed by the thumbnail.
54
+ # @param [ShapeCanvas] canvas shape canvas
55
+ def set_canvas(canvas)
56
+ @canvas = canvas
57
+
58
+ if @canvas
59
+ @update_timer.start(100)
60
+ else
61
+ @update_timer.stop
62
+ refresh(false)
63
+ end
64
+ end
65
+
66
+ # Implementation of drawing of the thumbnail's content. This virtual function can be overridden
67
+ # by the user for customization of the thumbnail appearance.
68
+ # @param [Wx::DC] dc Reference to output device context
69
+ def draw_content(dc)
70
+ # HINT: overload it for custom actions...
71
+ bmp_pen = nil
72
+ @canvas.get_diagram.get_all_shapes.each do |shape|
73
+ if (@thumb_style & THUMBSTYLE::SHOW_CONNECTIONS) != 0 && shape.is_a?(LineShape)
74
+ shape.draw(dc, WITHOUTCHILDREN)
75
+ elsif (@thumb_style & THUMBSTYLE::SHOW_ELEMENTS) != 0
76
+ if shape.is_a?(BitmapShape)
77
+ bmp_pen ||= Wx::Pen.new(Wx::BLACK, 1, Wx::PENSTYLE_DOT)
78
+ dc.with_pen(bmp_pen) do
79
+ dc.with_brush(Wx::WHITE_BRUSH) do
80
+ dc.draw_rectangle(shape.get_bounding_box)
81
+ end
82
+ end
83
+ elsif !shape.is_a?(LineShape)
84
+ shape.draw(dc, WITHOUTCHILDREN)
85
+ end
86
+ end
87
+ end
88
+ end
89
+
90
+ protected
91
+
92
+ # Internally used event handler.
93
+ # @param [Wx::PaintEvent] _event
94
+ def _on_paint(_event)
95
+ paint_buffered do |dc|
96
+ # clear background
97
+ dc.set_background(Wx::Brush.new(Wx::Colour.new(150, 150, 150)))
98
+ dc.clear
99
+
100
+ if @canvas
101
+ sz_canvas = @canvas.get_client_size
102
+ vsx, vsy = @canvas.get_virtual_size
103
+ sz_canvas_offset = get_canvas_offset
104
+ sz_thumb = get_client_size
105
+
106
+ # scale and copy bitmap to DC
107
+ cx = vsx.to_f
108
+ cy = vsy.to_f
109
+ tx = sz_thumb.x
110
+ ty = sz_thumb.y
111
+
112
+ if (tx/ty) > (cx/cy)
113
+ @scale = ty/cy
114
+ else
115
+ @scale = tx/cx
116
+ end
117
+
118
+ # draw virtual canvas area
119
+ dc.with_pen(Wx::WHITE_PEN) do
120
+ dc.with_brush(Wx::Brush.new(Wx::Colour.new(240, 240, 240))) do
121
+ dc.draw_rectangle(0, 0, (cx*@scale).to_i, (cy*@scale).to_i)
122
+
123
+ # draw top level shapes
124
+ Wx::ScaledDC.draw_on(dc, @scale * @canvas.get_scale) do |sdc|
125
+ draw_content(sdc)
126
+ end
127
+
128
+ # draw canvas client area
129
+ dc.set_pen(Wx::RED_PEN)
130
+ dc.set_brush(Wx::TRANSPARENT_BRUSH)
131
+ dc.draw_rectangle((sz_canvas_offset.x.to_f*@scale).to_i, (sz_canvas_offset.y.to_f*@scale).to_i, (sz_canvas.x.to_f*@scale).to_i, (sz_canvas.y.to_f*@scale).to_i)
132
+ end
133
+ end
134
+ end
135
+
136
+ dc.set_background(Wx::NULL_BRUSH)
137
+ end
138
+ end
139
+
140
+ # Get offset (view start) of managed shape canvas defined in pixels.
141
+ # @return [Wx::Size] Canvas offset in pixels
142
+ def get_canvas_offset
143
+ if @canvas
144
+ ux, uy = @canvas.get_scroll_pixels_per_unit
145
+ offset_x, offset_y = @canvas.get_view_start
146
+
147
+ return Wx::Size.new(offset_x*ux, offset_y*uy)
148
+ end
149
+ Wx::Size.new
150
+ end
151
+
152
+ private
153
+
154
+ # Internally used event handler.
155
+ # @param [Wx::EraseEvent] _event
156
+ def _on_erase_background(_event)
157
+ # noop
158
+ end
159
+
160
+ # Internally used event handler.
161
+ # @param [Wx::MouseEvent] event
162
+ def _on_mouse_move(event)
163
+ if @canvas && is_shown && event.dragging
164
+ ux, uy = @canvas.get_scroll_pixels_per_unit
165
+
166
+ sz_delta = @prev_mouse_pos ? event.get_position - @prev_mouse_pos : event.get_position
167
+ sz_canvas_offset = get_canvas_offset
168
+
169
+ @canvas.scroll(((sz_delta.x/@scale + sz_canvas_offset.x)/ux).to_i, ((sz_delta.y/@scale + sz_canvas_offset.y)/uy).to_i)
170
+
171
+ @prev_mouse_pos = event.get_position
172
+
173
+ refresh(false)
174
+ end
175
+ end
176
+
177
+ # Internally used event handler.
178
+ # @param [Wx::MouseEvent] event
179
+ def _on_left_down(event)
180
+ @prev_mouse_pos = event.get_position
181
+ end
182
+
183
+ # Internally used event handler.
184
+ # @param [Wx::MouseEvent] event
185
+ def _on_right_down(event)
186
+ menu_popup = Wx::Menu.new
187
+
188
+ menu_popup.append_check_item(IDM_SHOWELEMENTS, 'Show elements')
189
+ menu_popup.append_check_item(IDM_SHOWCONNECTIONS, 'Show connections')
190
+
191
+ popup_menu(menu_popup, event.get_position)
192
+ end
193
+
194
+ # Internally used event handler.
195
+ # @param [Wx::TimerEvent] _event
196
+ def _on_timer(_event)
197
+ refresh(false) if @canvas && is_shown
198
+ end
199
+
200
+ # Internally used event handler.
201
+ # @param [Wx::CommandEvent] _event
202
+ def _on_show_elements(_event)
203
+ if (@thumb_style & THUMBSTYLE::SHOW_ELEMENTS) != 0
204
+ @thumb_style &= ~THUMBSTYLE::SHOW_ELEMENTS
205
+ else
206
+ @thumb_style |= THUMBSTYLE::SHOW_ELEMENTS
207
+ end
208
+ end
209
+
210
+ # Internally used event handler.
211
+ # @param [Wx::CommandEvent] _event
212
+ def _on_show_connections(_event)
213
+ if (@thumb_style & THUMBSTYLE::SHOW_CONNECTIONS) != 0
214
+ @thumb_style &= ~THUMBSTYLE::SHOW_CONNECTIONS
215
+ else
216
+ @thumb_style |= THUMBSTYLE::SHOW_CONNECTIONS
217
+ end
218
+ end
219
+
220
+ # Internally used event handler.
221
+ # @param [Wx::UpdateUIEvent] event
222
+ def _on_update_show_elements(event)
223
+ event.check((@thumb_style & THUMBSTYLE::SHOW_ELEMENTS) != 0)
224
+ end
225
+
226
+ # Internally used event handler.
227
+ # @param [Wx::UpdateUIEvent] event
228
+ def _on_update_show_connections(event)
229
+ event.check((@thumb_style & THUMBSTYLE::SHOW_CONNECTIONS) != 0)
230
+ end
231
+
232
+ end
233
+
234
+ end
@@ -0,0 +1,12 @@
1
+ # Wx::SF version
2
+ # Copyright (c) M.J.N. Corino, The Netherlands
3
+
4
+ module Wx
5
+
6
+ module SF
7
+
8
+ VERSION = '0.9.0-beta.3'
9
+
10
+ end
11
+
12
+ end
@@ -0,0 +1,29 @@
1
+ # Wx - extensions
2
+ # Copyright (c) M.J.N. Corino, The Netherlands
3
+
4
+ module Wx
5
+
6
+ class Wx::RealPoint
7
+
8
+ # Returns distance from this point to given point.
9
+ # @param [Wx::RealPoint,Wx::Point,Array(Integer,Integer)] pt2
10
+ # @return [Float] distance to given point
11
+ def distance_to(pt2)
12
+ if Array === pt2 && pt2.size == 2
13
+ to_x, to_y = pt2
14
+ else
15
+ to_x = pt2.x; to_y = pt2.y
16
+ end
17
+ Math.sqrt((to_x - self.x)*(to_x - self.x) + (to_y - self.y)*(to_y - self.y))
18
+ end
19
+ alias :distance :distance_to
20
+
21
+ # Returns this point as a Wx::Size
22
+ # @return [Wx::Size]
23
+ def to_size
24
+ Wx::Size.new(self.x.to_i, self.y.to_i)
25
+ end
26
+
27
+ end
28
+
29
+ end
data/lib/wx/shapes.rb ADDED
@@ -0,0 +1,18 @@
1
+ # Wx::SF loader for wxRuby3/Shapes
2
+ # Copyright (c) M.J.N. Corino, The Netherlands
3
+
4
+ require 'wx/core'
5
+ require 'wx/prt'
6
+
7
+ require 'wx/shapes/version'
8
+ require 'wx/shapes/core'
9
+ require 'wx/shapes/wx'
10
+ require 'wx/shapes/base'
11
+ require 'wx/shapes/serializable'
12
+ require 'wx/shapes/connection_point'
13
+ require 'wx/shapes/shape_list'
14
+ require 'wx/shapes/shape'
15
+ require 'wx/shapes/events'
16
+ require 'wx/shapes/diagram'
17
+ require 'wx/shapes/auto_layout'
18
+ require 'wx/shapes/thumbnail'
@@ -0,0 +1,87 @@
1
+ # wx-shapes command handler base
2
+ # Copyright (c) M.J.N. Corino, The Netherlands
3
+
4
+ require 'optparse'
5
+ require "rbconfig"
6
+
7
+ module WxShapes
8
+
9
+ RUBY = ENV["RUBY"] || File.join(
10
+ RbConfig::CONFIG["bindir"],
11
+ RbConfig::CONFIG["ruby_install_name"] + RbConfig::CONFIG["EXEEXT"]).sub(/.*\s.*/m, '"\&"')
12
+
13
+ module Commands
14
+
15
+ class << self
16
+
17
+ def commands
18
+ @commands ||= ::Hash.new do |hash, key|
19
+ STDERR.puts "Unknown command #{key} specified."
20
+ exit(1)
21
+ end
22
+ end
23
+ private :commands
24
+
25
+ def options
26
+ @options ||= {
27
+ :verbose => false
28
+ }
29
+ end
30
+ private :options
31
+
32
+ def register(cmdid, cmdhandler)
33
+ commands[cmdid.to_s] = case
34
+ when Proc === cmdhandler || Method === cmdhandler
35
+ cmdhandler
36
+ when cmdhandler.respond_to?(:run)
37
+ Proc.new { |args| cmdhandler.run(args) }
38
+ else
39
+ raise RuntimeError, "Invalid wx-shapes command handler : #{cmdhandler}"
40
+ end
41
+ end
42
+
43
+ def describe_all
44
+ puts " wx-shapes commands:"
45
+ commands.each do |id, cmd|
46
+ puts
47
+ puts cmd.call(:describe)
48
+ end
49
+ puts
50
+ end
51
+
52
+ def run(cmdid, args)
53
+ commands[cmdid.to_s].call(args)
54
+ end
55
+
56
+ def parse_args(args)
57
+ opts = OptionParser.new
58
+ opts.banner = "Usage: wx-shapes [global options] COMMAND [arguments]\n\n" +
59
+ " COMMAND\t\t\tSpecifies wx-shapes command to execute."
60
+ opts.separator ''
61
+ opts.on('-v', '--verbose',
62
+ 'Show verbose output') { |v| ::WxShapes::Commands.options[:verbose] = true }
63
+ opts.on('-h', '--help',
64
+ 'Show this message.') do |v|
65
+ puts opts
66
+ puts
67
+ describe_all
68
+ exit(0)
69
+ end
70
+ opts.raise_unknown = false
71
+ opts.parse!(args)
72
+ end
73
+ end
74
+ end
75
+
76
+ def self.run(argv = ARGV)
77
+ # parse global options (upto first command)
78
+ argv = WxShapes::Commands.parse_args(argv)
79
+ while !argv.empty?
80
+ WxShapes::Commands.run(argv.shift, argv)
81
+ end
82
+ end
83
+ end
84
+
85
+ Dir[File.join(__dir__, 'cmd', '*.rb')].each do |file|
86
+ require file
87
+ end
@@ -0,0 +1,58 @@
1
+ # wx-shapes sampler command handler
2
+ # Copyright (c) M.J.N. Corino, The Netherlands
3
+ #--------------------------------------------------------------------
4
+
5
+ require 'fileutils'
6
+
7
+ module WxShapes
8
+ module Commands
9
+ class Sampler
10
+ OPTIONS = {
11
+ save_path: nil
12
+ }
13
+
14
+ def self.description
15
+ " sampler help|[SAMPLE [copy PATH]]\tRun wxRuby3/Shapes sample application (or copy sample)."
16
+ end
17
+
18
+ def self.run(argv)
19
+ if argv == :describe
20
+ description
21
+ else
22
+ arg = argv.shift || 'demo'
23
+ if arg == 'help'
24
+ puts "Usage: wx-shapes [global options] sampler help|[SAMPLE [copy PATH]]\n\n" +
25
+ "\twhere SAMPLE := optional name of the sample to run or copy (sample1/2/3/4 or demo; default is 'demo')\n" +
26
+ "\t PATH := optional path to copy sample to"
27
+ else
28
+ if arg != 'copy'
29
+ sample = arg
30
+ arg = argv.shift
31
+ else
32
+ sample = 'demo'
33
+ end
34
+ sample_dir = File.join(WxShapes::ROOT, 'samples', sample)
35
+ unless File.directory?(sample_dir)
36
+ STDERR.puts "ERROR: Unknown sample #{sample}"
37
+ exit(1)
38
+ end
39
+ if arg == 'copy'
40
+ dest = argv.shift
41
+ unless dest && File.directory?(dest)
42
+ STDERR.puts "ERROR: Invalid destination folder #{dest}"
43
+ exit(1)
44
+ end
45
+ Dir[File.join(sample_dir, '*')].each do |fp|
46
+ FileUtils.cp_r(fp, dest, verbose: true)
47
+ end
48
+ else
49
+ exec(RUBY, File.join(sample_dir, sample.gsub(/\d+/, '')+'.rb'))
50
+ end
51
+ end
52
+ end
53
+ end
54
+ end
55
+
56
+ self.register('sampler', Sampler)
57
+ end
58
+ end
@@ -0,0 +1,27 @@
1
+ # wx-shapes unit test command handler
2
+ # Copyright (c) M.J.N. Corino, The Netherlands
3
+ #--------------------------------------------------------------------
4
+
5
+ require 'fileutils'
6
+
7
+ module WxShapes
8
+ module Commands
9
+ class Test
10
+ def self.description
11
+ " test\t\t\tRun wxRuby3/Shapes regression tests."
12
+ end
13
+
14
+ def self.run(argv)
15
+ if argv == :describe
16
+ description
17
+ else
18
+ Dir[File.join(WxShapes::ROOT, 'tests', 'test_*.rb')].each do |test|
19
+ system(RUBY, test)
20
+ end
21
+ end
22
+ end
23
+ end
24
+
25
+ self.register('test', Test)
26
+ end
27
+ end
@@ -0,0 +1,7 @@
1
+
2
+ blockquote {
3
+ background: #f7f7f9;
4
+ border-left: .25em solid #e1e1e8;
5
+ margin: 14px;
6
+ padding-left: 14px;
7
+ }
@@ -0,0 +1,5 @@
1
+
2
+ def stylesheets
3
+ # Load the existing stylesheets while appending the custom one
4
+ super + %w(css/wxruby3.css)
5
+ end
@@ -0,0 +1,8 @@
1
+ # frozen_string_literal: true
2
+
3
+ module YARD
4
+ module RelativeMarkdownLinks
5
+ # Current version of the yard-relative_markdown_links gem.
6
+ VERSION = "0.4.1"
7
+ end
8
+ end
@@ -0,0 +1,39 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "nokogiri"
4
+ require "uri"
5
+ require "yard"
6
+ require_relative 'relative_markdown_links/version'
7
+
8
+ module YARD # rubocop:disable Style/Documentation
9
+ # GitHub and YARD render Markdown files differently. In particular, relative
10
+ # links between Markdown files that work in GitHub don't work in YARD.
11
+ # For example, if you have `[hello](FOO.md)` in your README, YARD renders it
12
+ # as `<a href="FOO.md">hello</a>`, creating a broken link in your docs.
13
+ #
14
+ # With this plugin enabled, you'll get `<a href="file.FOO.html">hello</a>`
15
+ # instead, which correctly links through to the rendered HTML file.
16
+ module RelativeMarkdownLinks
17
+ # Resolves relative links from Markdown files.
18
+ # @param [String] text the HTML fragment in which to resolve links.
19
+ # @return [String] HTML with relative links to extra files converted to `{file:}` links.
20
+ def resolve_links(text)
21
+ html = Nokogiri::HTML.fragment(text)
22
+ html.css("a[href]").each do |link|
23
+ href = URI(link["href"])
24
+
25
+ if href.relative? && options.files
26
+ fnames = options.files.map(&:filename)
27
+ if fnames.include?(href.path)
28
+ link.replace "{file:#{href} #{link.inner_html}}"
29
+ elsif href.path.end_with?('_md.html') && (fname = fnames.find {|fnm| fnm.end_with?(href.path.sub(/_md.html\Z/, '.md')) })
30
+ link.replace "{file:#{fname} #{link.inner_html}}"
31
+ end
32
+ end
33
+ end
34
+ super(html.to_s)
35
+ end
36
+ end
37
+
38
+ Templates::Template.extra_includes << RelativeMarkdownLinks
39
+ end
@@ -0,0 +1,2 @@
1
+
2
+ YARD::Templates::Engine.register_template_path File.join(__dir__, 'templates')
@@ -0,0 +1,4 @@
1
+ # frozen_string_literal: true
2
+ # Adapted from the 'yard-relative_markdown_links' gem; Copyright © 2018 Andrew Haines
3
+
4
+ require_relative 'yard/relative_markdown_links'
@@ -0,0 +1,35 @@
1
+ /* XPM */
2
+ static const char * AlignBottom_xpm[] = {
3
+ "16 16 16 1",
4
+ " c #000000",
5
+ ". c #800000",
6
+ "+ c #008000",
7
+ "@ c #808000",
8
+ "# c #000080",
9
+ "$ c #800080",
10
+ "% c None",
11
+ "& c #808080",
12
+ "* c #C0C0C0",
13
+ "= c #FF0000",
14
+ "- c #00FF00",
15
+ "; c #FFFF00",
16
+ "> c #0000FF",
17
+ ", c #FF00FF",
18
+ "' c #00FFFF",
19
+ ") c #FFFFFF",
20
+ "%%%%%%%%%%%%%%%%",
21
+ "%%%%%%%%%%%%%%%%",
22
+ "%%%%%%%%%%%%%%%%",
23
+ "%%%%%%%% %%",
24
+ "%%%%%%%% )))) %%",
25
+ "%%%%%%%% )))) %%",
26
+ "%%%%%%%% )))) %%",
27
+ "%% % )))) %%",
28
+ "%% ))) % )))) %%",
29
+ "%% ))) % )))) %%",
30
+ "%% ))) % )))) %%",
31
+ "%% ))) % )))) %%",
32
+ "%% ))) % )))) %%",
33
+ "% %",
34
+ "%%%%%%%%%%%%%%%%",
35
+ "%%%%%%%%%%%%%%%%"};
@@ -0,0 +1,35 @@
1
+ /* XPM */
2
+ static const char * AlignCenter_xpm[] = {
3
+ "16 16 16 1",
4
+ " c #000000",
5
+ ". c #800000",
6
+ "+ c #008000",
7
+ "@ c #808000",
8
+ "# c #000080",
9
+ "$ c #800080",
10
+ "% c None",
11
+ "& c #808080",
12
+ "* c #C0C0C0",
13
+ "= c #FF0000",
14
+ "- c #00FF00",
15
+ "; c #FFFF00",
16
+ "> c #0000FF",
17
+ ", c #FF00FF",
18
+ "' c #00FFFF",
19
+ ") c #FFFFFF",
20
+ "%%%%%%%%%%%%%%%%",
21
+ "%%%%%%% %%%%%%%%",
22
+ "%%%% %%%%%",
23
+ "%%%% )) )) %%%%%",
24
+ "%%%% )) )) %%%%%",
25
+ "%%%% )) )) %%%%%",
26
+ "%%%% %%%%%",
27
+ "%%%%%%% %%%%%%%%",
28
+ "%% %%%",
29
+ "%% )))) )))) %%%",
30
+ "%% )))) )))) %%%",
31
+ "%% )))) )))) %%%",
32
+ "%% )))) )))) %%%",
33
+ "%% %%%",
34
+ "%%%%%%% %%%%%%%%",
35
+ "%%%%%%%%%%%%%%%%"};
@@ -0,0 +1,35 @@
1
+ /* XPM */
2
+ static const char * AlignLeft_xpm[] = {
3
+ "16 16 16 1",
4
+ " c #000000",
5
+ ". c #800000",
6
+ "+ c #008000",
7
+ "@ c #808000",
8
+ "# c #000080",
9
+ "$ c #800080",
10
+ "% c None",
11
+ "& c #808080",
12
+ "* c #C0C0C0",
13
+ "= c #FF0000",
14
+ "- c #00FF00",
15
+ "; c #FFFF00",
16
+ "> c #0000FF",
17
+ ", c #FF00FF",
18
+ "' c #00FFFF",
19
+ ") c #FFFFFF",
20
+ "%%%%%%%%%%%%%%%%",
21
+ "%% %%%%%%%%%%%%%",
22
+ "%% %%%%%%%",
23
+ "%% ))))) %%%%%%%",
24
+ "%% ))))) %%%%%%%",
25
+ "%% ))))) %%%%%%%",
26
+ "%% %%%%%%%",
27
+ "%% %%%%%%%%%%%%%",
28
+ "%% %%%",
29
+ "%% ))))))))) %%%",
30
+ "%% ))))))))) %%%",
31
+ "%% ))))))))) %%%",
32
+ "%% ))))))))) %%%",
33
+ "%% %%%",
34
+ "%% %%%%%%%%%%%%%",
35
+ "%%%%%%%%%%%%%%%%"};
@@ -0,0 +1,35 @@
1
+ /* XPM */
2
+ static const char * AlignMiddle_xpm[] = {
3
+ "16 16 16 1",
4
+ " c #000000",
5
+ ". c #800000",
6
+ "+ c #008000",
7
+ "@ c #808000",
8
+ "# c #000080",
9
+ "$ c #800080",
10
+ "% c None",
11
+ "& c #808080",
12
+ "* c #C0C0C0",
13
+ "= c #FF0000",
14
+ "- c #00FF00",
15
+ "; c #FFFF00",
16
+ "> c #0000FF",
17
+ ", c #FF00FF",
18
+ "' c #00FFFF",
19
+ ") c #FFFFFF",
20
+ "%%%%%%%%%%%%%%%%",
21
+ "%%%%%%%%%%%%%%%%",
22
+ "%% %%%%%%%%",
23
+ "%% )))) %%%%%%%%",
24
+ "%% )))) % %%",
25
+ "%% )))) % ))) %%",
26
+ "%% )))) % ))) %%",
27
+ "% %",
28
+ "%% )))) % ))) %%",
29
+ "%% )))) % ))) %%",
30
+ "%% )))) % %%",
31
+ "%% )))) %%%%%%%%",
32
+ "%% %%%%%%%%",
33
+ "%%%%%%%%%%%%%%%%",
34
+ "%%%%%%%%%%%%%%%%",
35
+ "%%%%%%%%%%%%%%%%"};