vedeu 0.6.35 → 0.6.36
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.codeclimate.yml +3 -3
- data/examples/dsl_alignment.rb +162 -0
- data/examples/{demo_groups.rb → dsl_demo_groups.rb} +0 -0
- data/examples/{hello_worlds.rb → dsl_hello_worlds.rb} +0 -0
- data/examples/{alignment.rb → dsl_horizontal_alignment.rb} +13 -25
- data/examples/dsl_vertical_alignment.rb +183 -0
- data/lib/vedeu/geometry/alignment.rb +14 -25
- data/lib/vedeu/geometry/all.rb +4 -0
- data/lib/vedeu/geometry/area.rb +18 -17
- data/lib/vedeu/geometry/dimension.rb +61 -19
- data/lib/vedeu/geometry/dsl.rb +193 -13
- data/lib/vedeu/geometry/geometry.rb +58 -38
- data/lib/vedeu/geometry/horizontal_alignment.rb +25 -0
- data/lib/vedeu/geometry/vertical_alignment.rb +25 -0
- data/lib/vedeu/geometry/x_dimension.rb +33 -0
- data/lib/vedeu/geometry/y_dimension.rb +33 -0
- data/lib/vedeu/output/compressor.rb +9 -6
- data/lib/vedeu/output/renderers/file.rb +35 -11
- data/lib/vedeu/output/renderers/json.rb +2 -2
- data/lib/vedeu/version.rb +1 -1
- data/test/lib/vedeu/geometry/alignment_test.rb +4 -70
- data/test/lib/vedeu/geometry/area_test.rb +24 -22
- data/test/lib/vedeu/geometry/dimension_test.rb +97 -189
- data/test/lib/vedeu/geometry/dsl_test.rb +191 -24
- data/test/lib/vedeu/geometry/geometry_test.rb +31 -26
- data/test/lib/vedeu/geometry/horizontal_alignment_test.rb +61 -0
- data/test/lib/vedeu/geometry/vertical_alignment_test.rb +55 -0
- data/test/lib/vedeu/geometry/x_dimension_test.rb +74 -0
- data/test/lib/vedeu/geometry/y_dimension_test.rb +74 -0
- data/test/lib/vedeu/output/renderers/file_test.rb +6 -4
- metadata +19 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3edf1e2bc88b118913301844f044fcd633e8833a
|
4
|
+
data.tar.gz: 4710cf6599d6e1a520f6298431ad7287475dfcf9
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0747b79841c05ad9589bfb339e4999665fdf4ad82994a9be7ec566b99303053685665ded9548d9480366226f82206736348a81931916279e7b63037773977c1c
|
7
|
+
data.tar.gz: 5bece749f11c38671a4033d066dbe8efdc610be430232df65017256f978907225636d57a24c778331f1508cedc97e179e98c3f665adc34a85ee9ceadd61e2ada
|
data/.codeclimate.yml
CHANGED
@@ -0,0 +1,162 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require 'bundler/setup'
|
4
|
+
require 'vedeu'
|
5
|
+
|
6
|
+
class AlignmentApp
|
7
|
+
|
8
|
+
Vedeu.bind(:_initialize_) { Vedeu.trigger(:_refresh_) }
|
9
|
+
|
10
|
+
Vedeu.configure do
|
11
|
+
log './tmp/alignment.log'
|
12
|
+
renderers Vedeu::Renderers::File.new(filename: './tmp/alignment.out')
|
13
|
+
end
|
14
|
+
|
15
|
+
Vedeu.interface :top_left_view do
|
16
|
+
border do
|
17
|
+
title 'Top Left'
|
18
|
+
end
|
19
|
+
geometry do
|
20
|
+
align(:top, :left, 20, 4)
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
24
|
+
Vedeu.interface :top_centre_view do
|
25
|
+
border do
|
26
|
+
title 'Top Centre'
|
27
|
+
end
|
28
|
+
geometry do
|
29
|
+
align(:top, :centre, 20, 4)
|
30
|
+
end
|
31
|
+
end
|
32
|
+
|
33
|
+
Vedeu.interface :top_right_view do
|
34
|
+
border do
|
35
|
+
title 'Top Right'
|
36
|
+
end
|
37
|
+
geometry do
|
38
|
+
align(:top, :right, 20, 4)
|
39
|
+
end
|
40
|
+
end
|
41
|
+
|
42
|
+
Vedeu.interface :middle_left_view do
|
43
|
+
border do
|
44
|
+
title 'Middle Left'
|
45
|
+
end
|
46
|
+
geometry do
|
47
|
+
align(:middle, :left, 20, 4)
|
48
|
+
end
|
49
|
+
end
|
50
|
+
|
51
|
+
Vedeu.interface :middle_centre_view do
|
52
|
+
border do
|
53
|
+
title 'Middle Centre'
|
54
|
+
end
|
55
|
+
geometry do
|
56
|
+
align(:middle, :centre, 20, 4)
|
57
|
+
end
|
58
|
+
end
|
59
|
+
|
60
|
+
Vedeu.interface :middle_right_view do
|
61
|
+
border do
|
62
|
+
title 'Middle Right'
|
63
|
+
end
|
64
|
+
geometry do
|
65
|
+
align(:middle, :right, 20, 4)
|
66
|
+
end
|
67
|
+
end
|
68
|
+
|
69
|
+
Vedeu.interface :bottom_left_view do
|
70
|
+
border do
|
71
|
+
title 'Bottom Left'
|
72
|
+
end
|
73
|
+
geometry do
|
74
|
+
align(:bottom, :left, 20, 4)
|
75
|
+
end
|
76
|
+
end
|
77
|
+
|
78
|
+
Vedeu.interface :bottom_centre_view do
|
79
|
+
border do
|
80
|
+
title 'Bottom Centre'
|
81
|
+
end
|
82
|
+
geometry do
|
83
|
+
align(:bottom, :centre, 20, 4)
|
84
|
+
end
|
85
|
+
end
|
86
|
+
|
87
|
+
Vedeu.interface :bottom_right_view do
|
88
|
+
border do
|
89
|
+
title 'Bottom Right'
|
90
|
+
end
|
91
|
+
geometry do
|
92
|
+
align(:bottom, :right, 20, 4)
|
93
|
+
end
|
94
|
+
end
|
95
|
+
|
96
|
+
Vedeu.keymap '_global_' do
|
97
|
+
key('q') { Vedeu.exit }
|
98
|
+
end
|
99
|
+
|
100
|
+
Vedeu.render do
|
101
|
+
view(:top_left_view) do
|
102
|
+
lines do
|
103
|
+
line "top left"
|
104
|
+
end
|
105
|
+
end
|
106
|
+
|
107
|
+
view(:top_centre_view) do
|
108
|
+
lines do
|
109
|
+
line "top centre"
|
110
|
+
end
|
111
|
+
end
|
112
|
+
|
113
|
+
view(:top_right_view) do
|
114
|
+
lines do
|
115
|
+
line "top right"
|
116
|
+
end
|
117
|
+
end
|
118
|
+
|
119
|
+
view(:middle_left_view) do
|
120
|
+
lines do
|
121
|
+
line "middle left"
|
122
|
+
end
|
123
|
+
end
|
124
|
+
|
125
|
+
view(:middle_centre_view) do
|
126
|
+
lines do
|
127
|
+
line "middle centre"
|
128
|
+
end
|
129
|
+
end
|
130
|
+
|
131
|
+
view(:middle_right_view) do
|
132
|
+
lines do
|
133
|
+
line "middle right"
|
134
|
+
end
|
135
|
+
end
|
136
|
+
|
137
|
+
view(:bottom_left_view) do
|
138
|
+
lines do
|
139
|
+
line "bottom left"
|
140
|
+
end
|
141
|
+
end
|
142
|
+
|
143
|
+
view(:bottom_centre_view) do
|
144
|
+
lines do
|
145
|
+
line "bottom centre"
|
146
|
+
end
|
147
|
+
end
|
148
|
+
|
149
|
+
view(:bottom_right_view) do
|
150
|
+
lines do
|
151
|
+
line "bottom right"
|
152
|
+
end
|
153
|
+
end
|
154
|
+
end
|
155
|
+
|
156
|
+
def self.start(argv = ARGV)
|
157
|
+
Vedeu::Launcher.execute!(argv)
|
158
|
+
end
|
159
|
+
|
160
|
+
end # AlignmentApp
|
161
|
+
|
162
|
+
AlignmentApp.start
|
File without changes
|
File without changes
|
@@ -3,7 +3,7 @@
|
|
3
3
|
require 'bundler/setup'
|
4
4
|
require 'vedeu'
|
5
5
|
|
6
|
-
class
|
6
|
+
class HorizontalAlignmentApp
|
7
7
|
|
8
8
|
def self.geometry_stats(name)
|
9
9
|
Vedeu.geometries.by_name(name)
|
@@ -31,7 +31,7 @@ class AlignmentApp
|
|
31
31
|
border_stats(:right_interface)
|
32
32
|
end
|
33
33
|
|
34
|
-
class
|
34
|
+
class CentreHorizontalAlignmentView
|
35
35
|
def render
|
36
36
|
Vedeu.render do
|
37
37
|
view(:centre_interface) do
|
@@ -64,8 +64,8 @@ class AlignmentApp
|
|
64
64
|
Vedeu.bind(:_initialize_) { Vedeu.trigger(:_refresh_) }
|
65
65
|
|
66
66
|
Vedeu.configure do
|
67
|
-
log './tmp/
|
68
|
-
renderers Vedeu::Renderers::File.new(filename: './tmp/
|
67
|
+
log './tmp/horizontal_alignment.log'
|
68
|
+
renderers Vedeu::Renderers::File.new(filename: './tmp/horizontal_alignment.out')
|
69
69
|
end
|
70
70
|
|
71
71
|
Vedeu.interface :left_interface do
|
@@ -73,11 +73,7 @@ class AlignmentApp
|
|
73
73
|
title 'Align: Left'
|
74
74
|
end
|
75
75
|
geometry do
|
76
|
-
|
77
|
-
|
78
|
-
# or you can use:
|
79
|
-
# align_left 30
|
80
|
-
|
76
|
+
align_left 30
|
81
77
|
height 10
|
82
78
|
end
|
83
79
|
end
|
@@ -87,11 +83,7 @@ class AlignmentApp
|
|
87
83
|
title 'Align: Centre'
|
88
84
|
end
|
89
85
|
geometry do
|
90
|
-
|
91
|
-
|
92
|
-
# or you can use:
|
93
|
-
# align_centre 30
|
94
|
-
|
86
|
+
align_centre 40
|
95
87
|
height 15
|
96
88
|
end
|
97
89
|
end
|
@@ -101,11 +93,7 @@ class AlignmentApp
|
|
101
93
|
title 'Align: Right'
|
102
94
|
end
|
103
95
|
geometry do
|
104
|
-
|
105
|
-
|
106
|
-
# or you can use:
|
107
|
-
# align_right 30
|
108
|
-
|
96
|
+
align_right 30
|
109
97
|
height 10
|
110
98
|
end
|
111
99
|
end
|
@@ -116,22 +104,22 @@ class AlignmentApp
|
|
116
104
|
key('h') {
|
117
105
|
Vedeu.trigger(:_view_left_, :centre_interface)
|
118
106
|
|
119
|
-
|
107
|
+
HorizontalAlignmentApp::CentreHorizontalAlignmentView.new.render
|
120
108
|
}
|
121
109
|
key('j') {
|
122
110
|
Vedeu.trigger(:_view_down_, :centre_interface)
|
123
111
|
|
124
|
-
|
112
|
+
HorizontalAlignmentApp::CentreHorizontalAlignmentView.new.render
|
125
113
|
}
|
126
114
|
key('k') {
|
127
115
|
Vedeu.trigger(:_view_up_, :centre_interface)
|
128
116
|
|
129
|
-
|
117
|
+
HorizontalAlignmentApp::CentreHorizontalAlignmentView.new.render
|
130
118
|
}
|
131
119
|
key('l') {
|
132
120
|
Vedeu.trigger(:_view_right_, :centre_interface)
|
133
121
|
|
134
|
-
|
122
|
+
HorizontalAlignmentApp::CentreHorizontalAlignmentView.new.render
|
135
123
|
}
|
136
124
|
end
|
137
125
|
|
@@ -178,6 +166,6 @@ class AlignmentApp
|
|
178
166
|
Vedeu::Launcher.execute!(argv)
|
179
167
|
end
|
180
168
|
|
181
|
-
end #
|
169
|
+
end # HorizontalAlignmentApp
|
182
170
|
|
183
|
-
|
171
|
+
HorizontalAlignmentApp.start
|
@@ -0,0 +1,183 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require 'bundler/setup'
|
4
|
+
require 'vedeu'
|
5
|
+
|
6
|
+
class VerticalAlignmentApp
|
7
|
+
|
8
|
+
def self.geometry_stats(name)
|
9
|
+
Vedeu.geometries.by_name(name)
|
10
|
+
end
|
11
|
+
def self.gl
|
12
|
+
geometry_stats(:top_interface)
|
13
|
+
end
|
14
|
+
def self.gc
|
15
|
+
geometry_stats(:middle_interface)
|
16
|
+
end
|
17
|
+
def self.gr
|
18
|
+
geometry_stats(:bottom_interface)
|
19
|
+
end
|
20
|
+
|
21
|
+
def self.border_stats(name)
|
22
|
+
Vedeu.borders.by_name(name)
|
23
|
+
end
|
24
|
+
def self.bl
|
25
|
+
border_stats(:top_interface)
|
26
|
+
end
|
27
|
+
def self.bc
|
28
|
+
border_stats(:middle_interface)
|
29
|
+
end
|
30
|
+
def self.br
|
31
|
+
border_stats(:bottom_interface)
|
32
|
+
end
|
33
|
+
|
34
|
+
class CentreVerticalAlignmentView
|
35
|
+
def render
|
36
|
+
Vedeu.render do
|
37
|
+
view(:middle_interface) do
|
38
|
+
lines do
|
39
|
+
line "x:#{gc.x}, xn:#{gc.xn} (w:#{gc.width})"
|
40
|
+
line "y:#{gc.y}, yn:#{gc.yn} (h:#{gc.height})"
|
41
|
+
line ""
|
42
|
+
line "bx:#{bc.bx}, bxn:#{bc.bxn} (bw:#{bc.width})"
|
43
|
+
line "by:#{bc.by}, byn:#{bc.byn} (bh:#{bc.height})"
|
44
|
+
line ""
|
45
|
+
line "The 'h', 'j', 'k' and 'l' keys will"
|
46
|
+
line "move this view left, down, up, and"
|
47
|
+
line "right respectively."
|
48
|
+
end
|
49
|
+
end
|
50
|
+
end
|
51
|
+
|
52
|
+
Vedeu.trigger(:_refresh_view, :middle_interface)
|
53
|
+
end
|
54
|
+
|
55
|
+
def gc
|
56
|
+
Vedeu.geometries.by_name(:middle_interface)
|
57
|
+
end
|
58
|
+
|
59
|
+
def bc
|
60
|
+
Vedeu.borders.by_name(:middle_interface)
|
61
|
+
end
|
62
|
+
end
|
63
|
+
|
64
|
+
Vedeu.bind(:_initialize_) { Vedeu.trigger(:_refresh_) }
|
65
|
+
|
66
|
+
Vedeu.configure do
|
67
|
+
log './tmp/vertical_alignment.log'
|
68
|
+
renderers Vedeu::Renderers::File.new(filename: './tmp/vertical_alignment.out')
|
69
|
+
end
|
70
|
+
|
71
|
+
Vedeu.interface :top_interface do
|
72
|
+
border do
|
73
|
+
title 'Align: Top'
|
74
|
+
end
|
75
|
+
geometry do
|
76
|
+
align_top 10
|
77
|
+
|
78
|
+
# or you can use:
|
79
|
+
# align_left 30
|
80
|
+
|
81
|
+
width 30
|
82
|
+
end
|
83
|
+
end
|
84
|
+
|
85
|
+
Vedeu.interface :middle_interface do
|
86
|
+
border do
|
87
|
+
title 'Align: Middle'
|
88
|
+
end
|
89
|
+
geometry do
|
90
|
+
align_middle 15
|
91
|
+
|
92
|
+
# or you can use:
|
93
|
+
# align_centre 30
|
94
|
+
|
95
|
+
width 40
|
96
|
+
end
|
97
|
+
end
|
98
|
+
|
99
|
+
Vedeu.interface :bottom_interface do
|
100
|
+
border do
|
101
|
+
title 'Align: Bottom'
|
102
|
+
end
|
103
|
+
geometry do
|
104
|
+
align_bottom 10
|
105
|
+
|
106
|
+
# or you can use:
|
107
|
+
# align_right 30
|
108
|
+
|
109
|
+
width 30
|
110
|
+
end
|
111
|
+
end
|
112
|
+
|
113
|
+
Vedeu.keymap '_global_' do
|
114
|
+
key('q') { Vedeu.exit }
|
115
|
+
|
116
|
+
key('h') {
|
117
|
+
Vedeu.trigger(:_view_left_, :middle_interface)
|
118
|
+
|
119
|
+
VerticalAlignmentApp::CentreVerticalAlignmentView.new.render
|
120
|
+
}
|
121
|
+
key('j') {
|
122
|
+
Vedeu.trigger(:_view_down_, :middle_interface)
|
123
|
+
|
124
|
+
VerticalAlignmentApp::CentreVerticalAlignmentView.new.render
|
125
|
+
}
|
126
|
+
key('k') {
|
127
|
+
Vedeu.trigger(:_view_up_, :middle_interface)
|
128
|
+
|
129
|
+
VerticalAlignmentApp::CentreVerticalAlignmentView.new.render
|
130
|
+
}
|
131
|
+
key('l') {
|
132
|
+
Vedeu.trigger(:_view_right_, :middle_interface)
|
133
|
+
|
134
|
+
VerticalAlignmentApp::CentreVerticalAlignmentView.new.render
|
135
|
+
}
|
136
|
+
end
|
137
|
+
|
138
|
+
Vedeu.render do
|
139
|
+
view(:top_interface) do
|
140
|
+
lines do
|
141
|
+
line "x:#{gl.x}, xn:#{gl.xn} (w:#{gl.width})"
|
142
|
+
line "y:#{gl.y}, yn:#{gl.yn} (h:#{gl.height})"
|
143
|
+
line ""
|
144
|
+
line "bx:#{bl.bx}, bxn:#{bl.bxn} (bw:#{bl.width})"
|
145
|
+
line "by:#{bl.by}, byn:#{bl.byn} (bh:#{bl.height})"
|
146
|
+
end
|
147
|
+
end
|
148
|
+
|
149
|
+
view(:middle_interface) do
|
150
|
+
lines do
|
151
|
+
line "x:#{gc.x}, xn:#{gc.xn} (w:#{gc.width})"
|
152
|
+
line "y:#{gc.y}, yn:#{gc.yn} (h:#{gc.height})"
|
153
|
+
line ""
|
154
|
+
line "bx:#{bc.bx}, bxn:#{bc.bxn} (bw:#{bc.width})"
|
155
|
+
line "by:#{bc.by}, byn:#{bc.byn} (bh:#{bc.height})"
|
156
|
+
line ""
|
157
|
+
line "The 'h', 'j', 'k' and 'l' keys will"
|
158
|
+
line "move this view left, down, up, and"
|
159
|
+
line "right respectively. The coordinates"
|
160
|
+
line "will not change in this example"
|
161
|
+
line "because they have not been"
|
162
|
+
line "instructed to do so."
|
163
|
+
end
|
164
|
+
end
|
165
|
+
|
166
|
+
view(:bottom_interface) do
|
167
|
+
lines do
|
168
|
+
line "x:#{gr.x}, xn:#{gr.xn} (w:#{gr.width})"
|
169
|
+
line "y:#{gr.y}, yn:#{gr.yn} (h:#{gr.height})"
|
170
|
+
line ""
|
171
|
+
line "bx:#{br.bx}, bxn:#{br.bxn} (bw:#{br.width})"
|
172
|
+
line "by:#{br.by}, byn:#{br.byn} (bh:#{br.height})"
|
173
|
+
end
|
174
|
+
end
|
175
|
+
end
|
176
|
+
|
177
|
+
def self.start(argv = ARGV)
|
178
|
+
Vedeu::Launcher.execute!(argv)
|
179
|
+
end
|
180
|
+
|
181
|
+
end # VerticalAlignmentApp
|
182
|
+
|
183
|
+
VerticalAlignmentApp.start
|