wxruby3-shapes 0.9.0.pre.beta.3 → 0.9.6
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/INSTALL.md +5 -7
- data/README.md +38 -6
- data/assets/logo.svg +339 -0
- data/assets/logo.xpm +60 -0
- data/assets/screenshot.png +0 -0
- data/assets/social.png +0 -0
- data/bin/wx-shapes +1 -1
- data/lib/wx/shapes/arrow_base.rb +4 -11
- data/lib/wx/shapes/arrows/circle_arrow.rb +22 -11
- data/lib/wx/shapes/arrows/circle_prong_arrow.rb +48 -0
- data/lib/wx/shapes/arrows/cross_bar_arrow.rb +57 -0
- data/lib/wx/shapes/arrows/cross_bar_circle_arrow.rb +56 -0
- data/lib/wx/shapes/arrows/cross_bar_prong_arrow.rb +49 -0
- data/lib/wx/shapes/arrows/crossed_circle.rb +46 -0
- data/lib/wx/shapes/arrows/cup_arrow.rb +65 -0
- data/lib/wx/shapes/arrows/diamond_arrow.rb +8 -13
- data/lib/wx/shapes/arrows/double_cross_bar_arrow.rb +27 -0
- data/lib/wx/shapes/arrows/filled_arrow.rb +60 -0
- data/lib/wx/shapes/arrows/line_arrow.rb +67 -0
- data/lib/wx/shapes/arrows/open_arrow.rb +22 -23
- data/lib/wx/shapes/arrows/prong_arrow.rb +42 -0
- data/lib/wx/shapes/arrows/solid_arrow.rb +21 -35
- data/lib/wx/shapes/arrows/square_arrow.rb +37 -0
- data/lib/wx/shapes/auto_layout.rb +2 -2
- data/lib/wx/shapes/base.rb +1 -1
- data/lib/wx/shapes/canvas_history.rb +20 -0
- data/lib/wx/shapes/connection_point.rb +10 -6
- data/lib/wx/shapes/diagram.rb +98 -78
- data/lib/wx/shapes/events.rb +8 -8
- data/lib/wx/shapes/printout.rb +3 -16
- data/lib/wx/shapes/serializable.rb +2 -436
- data/lib/wx/shapes/serialize/wx.rb +30 -18
- data/lib/wx/shapes/shape.rb +211 -168
- data/lib/wx/shapes/shape_canvas.rb +728 -267
- data/lib/wx/shapes/shape_data_object.rb +99 -18
- data/lib/wx/shapes/shape_handle.rb +18 -11
- data/lib/wx/shapes/shape_list.rb +34 -67
- data/lib/wx/shapes/shapes/bitmap_shape.rb +23 -24
- data/lib/wx/shapes/shapes/box_shape.rb +389 -0
- data/lib/wx/shapes/shapes/circle_shape.rb +19 -22
- data/lib/wx/shapes/shapes/control_shape.rb +77 -41
- data/lib/wx/shapes/shapes/curve_shape.rb +38 -31
- data/lib/wx/shapes/shapes/diamond_shape.rb +7 -17
- data/lib/wx/shapes/shapes/edit_text_shape.rb +6 -9
- data/lib/wx/shapes/shapes/ellipse_shape.rb +12 -15
- data/lib/wx/shapes/shapes/flex_grid_shape.rb +58 -33
- data/lib/wx/shapes/shapes/grid_shape.rb +259 -161
- data/lib/wx/shapes/shapes/line_shape.rb +155 -161
- data/lib/wx/shapes/shapes/manager_shape.rb +77 -0
- data/lib/wx/shapes/shapes/multi_sel_rect.rb +8 -8
- data/lib/wx/shapes/shapes/ortho_shape.rb +31 -36
- data/lib/wx/shapes/shapes/polygon_shape.rb +23 -29
- data/lib/wx/shapes/shapes/rect_shape.rb +95 -53
- data/lib/wx/shapes/shapes/round_ortho_shape.rb +6 -8
- data/lib/wx/shapes/shapes/round_rect_shape.rb +20 -24
- data/lib/wx/shapes/shapes/square_shape.rb +14 -17
- data/lib/wx/shapes/shapes/text_shape.rb +95 -53
- data/lib/wx/shapes/version.rb +1 -1
- data/lib/wx/shapes/wx.rb +16 -7
- data/lib/wx/wx-shapes/cmd/test.rb +1 -1
- data/samples/demo/arrows.json +1 -0
- data/samples/demo/arrows.yaml +793 -0
- data/samples/demo/art/HBox.xpm +22 -0
- data/samples/demo/art/VBox.xpm +22 -0
- data/samples/demo/art/logo.xpm +60 -0
- data/samples/demo/class.json +1 -0
- data/samples/demo/class.yaml +5631 -0
- data/samples/demo/demo.rb +301 -91
- data/samples/demo/dialogs.rb +1405 -0
- data/samples/demo/erd.json +1 -0
- data/samples/demo/erd.yaml +4072 -0
- data/samples/demo/frame_canvas.rb +409 -33
- data/samples/sample1/art/logo.xpm +60 -0
- data/samples/sample1/sample.rb +11 -11
- data/samples/sample2/art/logo.xpm +60 -0
- data/samples/sample2/sample.rb +2 -2
- data/samples/sample2/sample_shape.rb +15 -15
- data/samples/sample3/art/logo.xpm +60 -0
- data/samples/sample3/sample.rb +3 -3
- data/samples/sample4/art/logo.xpm +60 -0
- data/samples/sample4/sample.rb +2 -2
- data/tests/lib/wxapp_runner.rb +4 -0
- data/tests/serializer_tests.rb +8 -441
- data/tests/test_grid_shapes.rb +2 -2
- data/tests/test_serialize_xml.rb +17 -0
- data/tests/test_serialize_yaml.rb +2 -2
- metadata +78 -28
- data/lib/wx/shapes/serialize/core.rb +0 -40
- data/lib/wx/shapes/serialize/id.rb +0 -82
- data/lib/wx/shapes/serializer/json.rb +0 -258
- data/lib/wx/shapes/serializer/yaml.rb +0 -125
- data/samples/demo/art/sample.xpm +0 -251
- data/samples/sample1/art/sample.xpm +0 -251
- data/samples/sample2/art/sample.xpm +0 -251
- data/samples/sample3/art/sample.xpm +0 -251
- data/samples/sample4/art/sample.xpm +0 -251
data/samples/sample2/sample.rb
CHANGED
@@ -36,7 +36,7 @@ class SFSample2Frame < Wx::Frame
|
|
36
36
|
def initialize(title)
|
37
37
|
super(nil, Wx::StandardID::ID_ANY, title, size: [800,600])
|
38
38
|
|
39
|
-
self.icon = Wx::Icon(:
|
39
|
+
self.icon = Wx::Icon(:logo)
|
40
40
|
|
41
41
|
evt_close :on_close
|
42
42
|
|
@@ -129,5 +129,5 @@ class SFSample2Frame < Wx::Frame
|
|
129
129
|
end
|
130
130
|
|
131
131
|
Wx::App.run do
|
132
|
-
SFSample2Frame.new('wxShapeFramework Sample
|
132
|
+
SFSample2Frame.new('wxShapeFramework Sample 2').show
|
133
133
|
end
|
@@ -11,96 +11,96 @@ class SampleShape < Wx::SF::RectShape
|
|
11
11
|
|
12
12
|
# override required wxSF virtual functions
|
13
13
|
def on_left_click(pos)
|
14
|
-
SFSample2Frame.log(SFSample2Frame::LOGTYPE::MouseEvent, "Called handler: 'on_left_click', Shape ID: #{
|
14
|
+
SFSample2Frame.log(SFSample2Frame::LOGTYPE::MouseEvent, "Called handler: 'on_left_click', Shape ID: #{self.object_id}, Position: #{pos}\n")
|
15
15
|
|
16
16
|
# call original handler if required
|
17
17
|
super
|
18
18
|
end
|
19
19
|
def on_right_click(pos)
|
20
|
-
SFSample2Frame.log(SFSample2Frame::LOGTYPE::MouseEvent, "Called handler: 'on_right_click', Shape ID: #{
|
20
|
+
SFSample2Frame.log(SFSample2Frame::LOGTYPE::MouseEvent, "Called handler: 'on_right_click', Shape ID: #{self.object_id}, Position: #{pos}\n")
|
21
21
|
|
22
22
|
# call original handler if required
|
23
23
|
super
|
24
24
|
end
|
25
25
|
def on_left_double_click(pos)
|
26
|
-
SFSample2Frame.log(SFSample2Frame::LOGTYPE::MouseEvent, "Called handler: 'on_left_double_click', Shape ID: #{
|
26
|
+
SFSample2Frame.log(SFSample2Frame::LOGTYPE::MouseEvent, "Called handler: 'on_left_double_click', Shape ID: #{self.object_id}, Position: #{pos}\n")
|
27
27
|
|
28
28
|
# call original handler if required
|
29
29
|
super
|
30
30
|
end
|
31
31
|
def on_right_double_click(pos)
|
32
|
-
SFSample2Frame.log(SFSample2Frame::LOGTYPE::MouseEvent, "Called handler: 'on_right_double_click', Shape ID: #{
|
32
|
+
SFSample2Frame.log(SFSample2Frame::LOGTYPE::MouseEvent, "Called handler: 'on_right_double_click', Shape ID: #{self.object_id}, Position: #{pos}\n")
|
33
33
|
|
34
34
|
# call original handler if required
|
35
35
|
super
|
36
36
|
end
|
37
37
|
|
38
38
|
def on_begin_drag(pos)
|
39
|
-
SFSample2Frame.log(SFSample2Frame::LOGTYPE::MouseEvent, "Called handler: 'on_begin_drag', Shape ID: #{
|
39
|
+
SFSample2Frame.log(SFSample2Frame::LOGTYPE::MouseEvent, "Called handler: 'on_begin_drag', Shape ID: #{self.object_id}, Position: #{pos}\n")
|
40
40
|
|
41
41
|
# call original handler if required
|
42
42
|
super
|
43
43
|
end
|
44
44
|
def on_dragging(pos)
|
45
|
-
SFSample2Frame.log(SFSample2Frame::LOGTYPE::MouseEvent, "Called handler: 'on_dragging', Shape ID: #{
|
45
|
+
SFSample2Frame.log(SFSample2Frame::LOGTYPE::MouseEvent, "Called handler: 'on_dragging', Shape ID: #{self.object_id}, Position: #{pos}\n")
|
46
46
|
|
47
47
|
# call original handler if required
|
48
48
|
super
|
49
49
|
end
|
50
50
|
def on_end_drag(pos)
|
51
|
-
SFSample2Frame.log(SFSample2Frame::LOGTYPE::MouseEvent, "Called handler: 'on_end_drag', Shape ID: #{
|
51
|
+
SFSample2Frame.log(SFSample2Frame::LOGTYPE::MouseEvent, "Called handler: 'on_end_drag', Shape ID: #{self.object_id}, Position: #{pos}\n")
|
52
52
|
|
53
53
|
# call original handler if required
|
54
54
|
super
|
55
55
|
end
|
56
56
|
|
57
57
|
def on_begin_handle(handle)
|
58
|
-
SFSample2Frame.log(SFSample2Frame::LOGTYPE::HandleEvent, "Called handler: 'on_begin_handle()', Shape ID: #{
|
58
|
+
SFSample2Frame.log(SFSample2Frame::LOGTYPE::HandleEvent, "Called handler: 'on_begin_handle()', Shape ID: #{self.object_id}, Handle type: #{handle.type}\n")
|
59
59
|
|
60
60
|
# call original handler if required
|
61
61
|
super
|
62
62
|
end
|
63
63
|
def on_handle(handle)
|
64
|
-
SFSample2Frame.log(SFSample2Frame::LOGTYPE::HandleEvent, "Called handler: 'on_handle()', Shape ID: #{
|
64
|
+
SFSample2Frame.log(SFSample2Frame::LOGTYPE::HandleEvent, "Called handler: 'on_handle()', Shape ID: #{self.object_id}, Handle type: #{handle.type}\n")
|
65
65
|
|
66
66
|
# call original handler if required
|
67
67
|
super
|
68
68
|
end
|
69
69
|
def on_end_handle(handle)
|
70
|
-
SFSample2Frame.log(SFSample2Frame::LOGTYPE::HandleEvent, "Called handler: 'on_end_handle()', Shape ID: #{
|
70
|
+
SFSample2Frame.log(SFSample2Frame::LOGTYPE::HandleEvent, "Called handler: 'on_end_handle()', Shape ID: #{self.object_id}, Handle type: #{handle.type}\n")
|
71
71
|
|
72
72
|
# call original handler if required
|
73
73
|
super
|
74
74
|
end
|
75
75
|
|
76
76
|
def on_mouse_enter(pos)
|
77
|
-
SFSample2Frame.log(SFSample2Frame::LOGTYPE::MouseEvent, "Called handler: 'on_mouse_enter', Shape ID: #{
|
77
|
+
SFSample2Frame.log(SFSample2Frame::LOGTYPE::MouseEvent, "Called handler: 'on_mouse_enter', Shape ID: #{self.object_id}, Position: #{pos}\n")
|
78
78
|
|
79
79
|
# call original handler if required
|
80
80
|
super
|
81
81
|
end
|
82
82
|
def on_mouse_over(pos)
|
83
|
-
SFSample2Frame.log(SFSample2Frame::LOGTYPE::MouseEvent, "Called handler: 'on_mouse_over', Shape ID: #{
|
83
|
+
SFSample2Frame.log(SFSample2Frame::LOGTYPE::MouseEvent, "Called handler: 'on_mouse_over', Shape ID: #{self.object_id}, Position: #{pos}\n")
|
84
84
|
|
85
85
|
# call original handler if required
|
86
86
|
super
|
87
87
|
end
|
88
88
|
def on_mouse_leave(pos)
|
89
|
-
SFSample2Frame.log(SFSample2Frame::LOGTYPE::MouseEvent, "Called handler: 'on_mouse_leave', Shape ID: #{
|
89
|
+
SFSample2Frame.log(SFSample2Frame::LOGTYPE::MouseEvent, "Called handler: 'on_mouse_leave', Shape ID: #{self.object_id}, Position: #{pos}\n")
|
90
90
|
|
91
91
|
# call original handler if required
|
92
92
|
super
|
93
93
|
end
|
94
94
|
|
95
95
|
def on_key(key)
|
96
|
-
SFSample2Frame.log(SFSample2Frame::LOGTYPE::KeyEvent, "Called handler: 'on_key()', Shape ID: #{
|
96
|
+
SFSample2Frame.log(SFSample2Frame::LOGTYPE::KeyEvent, "Called handler: 'on_key()', Shape ID: #{self.object_id}, Key code: #{key}\n")
|
97
97
|
|
98
98
|
# call original handler if required
|
99
99
|
super
|
100
100
|
end
|
101
101
|
|
102
102
|
def on_child_dropped(pos, child)
|
103
|
-
SFSample2Frame.log(SFSample2Frame::LOGTYPE::ChildDropEvent, "Called handler: 'on_child_dropped()', Parent shape ID: #{
|
103
|
+
SFSample2Frame.log(SFSample2Frame::LOGTYPE::ChildDropEvent, "Called handler: 'on_child_dropped()', Parent shape ID: #{self.object_id}, Child shape ID: #{child.object_id}\n")
|
104
104
|
|
105
105
|
# call original handler if required
|
106
106
|
super
|
@@ -0,0 +1,60 @@
|
|
1
|
+
/* XPM */
|
2
|
+
static char * logo_xpm[] = {
|
3
|
+
"32 32 25 1",
|
4
|
+
" c None",
|
5
|
+
". c #FFD700",
|
6
|
+
"+ c #000000",
|
7
|
+
"@ c #B22222",
|
8
|
+
"# c #060400",
|
9
|
+
"$ c #052092",
|
10
|
+
"% c #041C91",
|
11
|
+
"& c #051F92",
|
12
|
+
"* c #062594",
|
13
|
+
"= c #041E91",
|
14
|
+
"- c #000004",
|
15
|
+
"; c #052192",
|
16
|
+
"> c #051F8F",
|
17
|
+
", c #052293",
|
18
|
+
"' c #B22323",
|
19
|
+
") c #751616",
|
20
|
+
"! c #062393",
|
21
|
+
"~ c #02128F",
|
22
|
+
"{ c #041B91",
|
23
|
+
"] c #000021",
|
24
|
+
"^ c #00000D",
|
25
|
+
"/ c #052091",
|
26
|
+
"( c #000002",
|
27
|
+
"_ c #041D91",
|
28
|
+
": c #041D92",
|
29
|
+
" ",
|
30
|
+
" ............ ",
|
31
|
+
" ............ ",
|
32
|
+
" ............+++++++++ ",
|
33
|
+
" ............ + ",
|
34
|
+
" .... .... +++++ ",
|
35
|
+
" .... .... +++ ",
|
36
|
+
" .... .... + ",
|
37
|
+
" .... .... @@@@@ ",
|
38
|
+
" ............ @@@@@@@@ ",
|
39
|
+
" ............ @@@@@@@@@@@ ",
|
40
|
+
" ............ @@@ @@@ ",
|
41
|
+
" ............ @@@ @@@ ",
|
42
|
+
" # @@@ @@@ ",
|
43
|
+
" +++ @@@ @@@ ",
|
44
|
+
" +++++ @@@ @@@ ",
|
45
|
+
" + $% @@@ @@@ ",
|
46
|
+
" + &**= @@@@ @@@@ ",
|
47
|
+
" + &****$ @@@@@@@@@@@ ",
|
48
|
+
" -&******; @@@@@@@@@ ",
|
49
|
+
" >*** ***, '@@@@@@ ",
|
50
|
+
" &*** ***, ) ",
|
51
|
+
" &*** ***! + ",
|
52
|
+
" ~*** **; + ",
|
53
|
+
" {*** **; + ",
|
54
|
+
" %*** **$] + ",
|
55
|
+
" %*** **$^+ + ",
|
56
|
+
" %*****/(+++++++++++ ",
|
57
|
+
" _***$ ++ ",
|
58
|
+
" :*$ + ",
|
59
|
+
" * ",
|
60
|
+
" "};
|
data/samples/sample3/sample.rb
CHANGED
@@ -112,7 +112,7 @@ class SFSample3Frame < Wx::Frame
|
|
112
112
|
def initialize(title)
|
113
113
|
super(nil, Wx::StandardID::ID_ANY, title, size: [800,600])
|
114
114
|
|
115
|
-
self.icon = Wx::Icon(:
|
115
|
+
self.icon = Wx::Icon(:logo)
|
116
116
|
|
117
117
|
if Wx.has_feature?(:USE_MENUS)
|
118
118
|
# create a menu bar
|
@@ -244,7 +244,7 @@ class SFSample3Frame < Wx::Frame
|
|
244
244
|
# update the text shape and its parent(s)
|
245
245
|
text.update
|
246
246
|
# display some info...
|
247
|
-
Wx.log_message("New text of the star with ID #{text.get_parent_shape.
|
247
|
+
Wx.log_message("New text of the star with ID #{text.get_parent_shape.object_id} is : '#{event.text}'")
|
248
248
|
end
|
249
249
|
end
|
250
250
|
|
@@ -252,7 +252,7 @@ class SFSample3Frame < Wx::Frame
|
|
252
252
|
Wx::FileDialog(self, 'Load diagram from file...', Dir.getwd, '', "JSON Files (*.json)|*.json", Wx::FD_OPEN) do |dlg|
|
253
253
|
if dlg.show_modal == Wx::ID_OK
|
254
254
|
File.open(dlg.get_path, 'r') do |f|
|
255
|
-
@canvas.set_diagram(
|
255
|
+
@canvas.set_diagram(FIRM::Serializable.deserialize(f))
|
256
256
|
@canvas.clear_canvas_history
|
257
257
|
@canvas.save_canvas_state
|
258
258
|
end
|
@@ -0,0 +1,60 @@
|
|
1
|
+
/* XPM */
|
2
|
+
static char * logo_xpm[] = {
|
3
|
+
"32 32 25 1",
|
4
|
+
" c None",
|
5
|
+
". c #FFD700",
|
6
|
+
"+ c #000000",
|
7
|
+
"@ c #B22222",
|
8
|
+
"# c #060400",
|
9
|
+
"$ c #052092",
|
10
|
+
"% c #041C91",
|
11
|
+
"& c #051F92",
|
12
|
+
"* c #062594",
|
13
|
+
"= c #041E91",
|
14
|
+
"- c #000004",
|
15
|
+
"; c #052192",
|
16
|
+
"> c #051F8F",
|
17
|
+
", c #052293",
|
18
|
+
"' c #B22323",
|
19
|
+
") c #751616",
|
20
|
+
"! c #062393",
|
21
|
+
"~ c #02128F",
|
22
|
+
"{ c #041B91",
|
23
|
+
"] c #000021",
|
24
|
+
"^ c #00000D",
|
25
|
+
"/ c #052091",
|
26
|
+
"( c #000002",
|
27
|
+
"_ c #041D91",
|
28
|
+
": c #041D92",
|
29
|
+
" ",
|
30
|
+
" ............ ",
|
31
|
+
" ............ ",
|
32
|
+
" ............+++++++++ ",
|
33
|
+
" ............ + ",
|
34
|
+
" .... .... +++++ ",
|
35
|
+
" .... .... +++ ",
|
36
|
+
" .... .... + ",
|
37
|
+
" .... .... @@@@@ ",
|
38
|
+
" ............ @@@@@@@@ ",
|
39
|
+
" ............ @@@@@@@@@@@ ",
|
40
|
+
" ............ @@@ @@@ ",
|
41
|
+
" ............ @@@ @@@ ",
|
42
|
+
" # @@@ @@@ ",
|
43
|
+
" +++ @@@ @@@ ",
|
44
|
+
" +++++ @@@ @@@ ",
|
45
|
+
" + $% @@@ @@@ ",
|
46
|
+
" + &**= @@@@ @@@@ ",
|
47
|
+
" + &****$ @@@@@@@@@@@ ",
|
48
|
+
" -&******; @@@@@@@@@ ",
|
49
|
+
" >*** ***, '@@@@@@ ",
|
50
|
+
" &*** ***, ) ",
|
51
|
+
" &*** ***! + ",
|
52
|
+
" ~*** **; + ",
|
53
|
+
" {*** **; + ",
|
54
|
+
" %*** **$] + ",
|
55
|
+
" %*** **$^+ + ",
|
56
|
+
" %*****/(+++++++++++ ",
|
57
|
+
" _***$ ++ ",
|
58
|
+
" :*$ + ",
|
59
|
+
" * ",
|
60
|
+
" "};
|
data/samples/sample4/sample.rb
CHANGED
@@ -41,7 +41,7 @@ class SFSample4Frame < Wx::Frame
|
|
41
41
|
def initialize(title)
|
42
42
|
super(nil, Wx::StandardID::ID_ANY, title, size: [800,600])
|
43
43
|
|
44
|
-
self.icon = Wx::Icon(:
|
44
|
+
self.icon = Wx::Icon(:logo)
|
45
45
|
|
46
46
|
if Wx.has_feature?(:USE_MENUS)
|
47
47
|
# create a menu bar
|
@@ -166,7 +166,7 @@ class SFSample4Frame < Wx::Frame
|
|
166
166
|
# or/and the widget as well. Note that GUI controls differ in a way how they process events
|
167
167
|
# so the behaviour can be different for various widgets.
|
168
168
|
shape.set_event_processing(Wx::SF::ControlShape::EVTPROCESSING::MOUSE2CANVAS | Wx::SF::ControlShape::EVTPROCESSING::KEY2CANVAS)
|
169
|
-
|
169
|
+
shape.set_event_processing(Wx::SF::ControlShape::EVTPROCESSING::MOUSE2GUI | Wx::SF::ControlShape::EVTPROCESSING::KEY2GUI)
|
170
170
|
end
|
171
171
|
|
172
172
|
# ... and process standard canvas operations
|