vedeu 0.6.60 → 0.6.61
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/docs/dsl.md +18 -18
- data/docs/events/drb.md +2 -8
- data/docs/events/view.md +2 -2
- data/docs/events/visibility.md +1 -4
- data/lib/vedeu/all.rb +1 -1
- data/lib/vedeu/borders/border.rb +1 -1
- data/lib/vedeu/borders/refresh.rb +1 -1
- data/lib/vedeu/buffers/empty.rb +6 -4
- data/lib/vedeu/buffers/view.rb +78 -7
- data/lib/vedeu/cursors/cursor.rb +7 -5
- data/lib/vedeu/cursors/refresh.rb +1 -1
- data/lib/vedeu/cursors/reposition.rb +5 -3
- data/lib/vedeu/cursors/repository.rb +4 -6
- data/lib/vedeu/dsl/shared.rb +5 -5
- data/lib/vedeu/editor/cropper.rb +1 -1
- data/lib/vedeu/editor/cursor.rb +2 -2
- data/lib/vedeu/editor/item.rb +3 -3
- data/lib/vedeu/error.rb +1 -1
- data/lib/vedeu/esc/esc.rb +1 -1
- data/lib/vedeu/events/aliases.rb +2 -2
- data/lib/vedeu/{geometry → geometries}/alignment.rb +8 -8
- data/lib/vedeu/geometries/all.rb +31 -0
- data/lib/vedeu/{geometry → geometries}/area.rb +8 -8
- data/lib/vedeu/{geometry → geometries}/coordinate.rb +5 -5
- data/lib/vedeu/{geometry → geometries}/dimension.rb +6 -6
- data/lib/vedeu/{geometry → geometries}/dsl.rb +22 -22
- data/lib/vedeu/{geometry → geometries}/geometry.rb +15 -15
- data/lib/vedeu/{geometry → geometries}/grid.rb +6 -6
- data/lib/vedeu/{geometry → geometries}/horizontal_alignment.rb +3 -3
- data/lib/vedeu/{geometry → geometries}/move.rb +5 -5
- data/lib/vedeu/{geometry → geometries}/position.rb +18 -18
- data/lib/vedeu/{geometry → geometries}/repository.rb +9 -9
- data/lib/vedeu/{geometry → geometries}/validator.rb +3 -3
- data/lib/vedeu/{geometry → geometries}/vertical_alignment.rb +3 -3
- data/lib/vedeu/{geometry → geometries}/x_dimension.rb +4 -4
- data/lib/vedeu/{geometry → geometries}/y_dimension.rb +4 -4
- data/lib/vedeu/groups/group.rb +2 -1
- data/lib/vedeu/input/store.rb +2 -1
- data/lib/vedeu/interfaces/clear.rb +8 -6
- data/lib/vedeu/interfaces/interface.rb +1 -1
- data/lib/vedeu/models/cell.rb +2 -2
- data/lib/vedeu/models/escape.rb +2 -2
- data/lib/vedeu/models/focus.rb +2 -1
- data/lib/vedeu/models/page.rb +3 -2
- data/lib/vedeu/models/row.rb +10 -1
- data/lib/vedeu/models/views/char.rb +6 -6
- data/lib/vedeu/models/views/line.rb +1 -1
- data/lib/vedeu/output/compressor.rb +10 -15
- data/lib/vedeu/output/presentation/presentation.rb +1 -1
- data/lib/vedeu/output/renderers/all.rb +7 -8
- data/lib/vedeu/output/viewport.rb +1 -1
- data/lib/vedeu/repositories/store.rb +2 -2
- data/lib/vedeu/terminal/buffer.rb +46 -102
- data/lib/vedeu/terminal/terminal.rb +10 -2
- data/lib/vedeu/version.rb +1 -1
- data/test/lib/vedeu/borders/refresh_test.rb +1 -1
- data/test/lib/vedeu/buffers/empty_test.rb +3 -3
- data/test/lib/vedeu/buffers/view_test.rb +48 -1
- data/test/lib/vedeu/cursors/cursor_test.rb +2 -2
- data/test/lib/vedeu/editor/cropper_test.rb +1 -1
- data/test/lib/vedeu/editor/cursor_test.rb +1 -1
- data/test/lib/vedeu/editor/document_test.rb +2 -2
- data/test/lib/vedeu/{geometry → geometries}/alignment_test.rb +5 -5
- data/test/lib/vedeu/{geometry → geometries}/area_test.rb +4 -4
- data/test/lib/vedeu/{geometry → geometries}/coordinate.rb +5 -5
- data/test/lib/vedeu/{geometry → geometries}/dimension_test.rb +7 -5
- data/test/lib/vedeu/{geometry → geometries}/dsl_test.rb +31 -27
- data/test/lib/vedeu/{geometry → geometries}/geometry_test.rb +10 -7
- data/test/lib/vedeu/{geometry → geometries}/grid_test.rb +13 -9
- data/test/lib/vedeu/{geometry → geometries}/horizontal_alignment_test.rb +3 -3
- data/test/lib/vedeu/{geometry → geometries}/move_test.rb +10 -10
- data/test/lib/vedeu/{geometry → geometries}/position_test.rb +16 -15
- data/test/lib/vedeu/{geometry → geometries}/repository_test.rb +3 -3
- data/test/lib/vedeu/{geometry → geometries}/validator_test.rb +4 -4
- data/test/lib/vedeu/{geometry → geometries}/vertical_alignment_test.rb +3 -3
- data/test/lib/vedeu/{geometry → geometries}/x_dimension_test.rb +3 -3
- data/test/lib/vedeu/{geometry → geometries}/y_dimension_test.rb +3 -3
- data/test/lib/vedeu/interfaces/clear_test.rb +1 -1
- data/test/lib/vedeu/models/cell_test.rb +1 -1
- data/test/lib/vedeu/models/escape_test.rb +2 -2
- data/test/lib/vedeu/models/page_test.rb +18 -2
- data/test/lib/vedeu/models/views/char_test.rb +3 -3
- data/test/lib/vedeu/output/compressor_test.rb +30 -16
- data/test/lib/vedeu/output/renderers/html_test.rb +1 -1
- data/test/lib/vedeu/output/renderers/json_test.rb +17 -1
- data/test/lib/vedeu/output/viewport_test.rb +1 -1
- data/test/lib/vedeu/terminal/buffer_test.rb +6 -18
- data/test/lib/vedeu/terminal/terminal_test.rb +1 -1
- data/test/support/examples/material_colours_app.rb +2 -0
- data/test/test_helper.rb +1 -1
- metadata +48 -48
- data/lib/vedeu/geometry/all.rb +0 -31
data/lib/vedeu/esc/esc.rb
CHANGED
data/lib/vedeu/events/aliases.rb
CHANGED
@@ -69,10 +69,10 @@ module Vedeu
|
|
69
69
|
alias_method :remove, :unbind_alias
|
70
70
|
|
71
71
|
# @return [Hash<Symbol => Array<Symbol>>]
|
72
|
-
def reset
|
72
|
+
def reset!
|
73
73
|
@storage = in_memory
|
74
74
|
end
|
75
|
-
alias_method :reset
|
75
|
+
alias_method :reset, :reset!
|
76
76
|
|
77
77
|
# Access to the storage for this repository.
|
78
78
|
#
|
@@ -1,14 +1,14 @@
|
|
1
1
|
module Vedeu
|
2
2
|
|
3
|
-
module
|
3
|
+
module Geometries
|
4
4
|
|
5
5
|
# The subclasses of this class, HorizontalAlignment and
|
6
6
|
# VerticalAlignment provide the mechanism to align an interface or
|
7
7
|
# view horizontally or vertically within the available terminal
|
8
8
|
# space.
|
9
9
|
#
|
10
|
-
# @see Vedeu::
|
11
|
-
# @see Vedeu::
|
10
|
+
# @see Vedeu::Geometries::HorizontalAlignment
|
11
|
+
# @see Vedeu::Geometries::VerticalAlignment
|
12
12
|
#
|
13
13
|
# @api private
|
14
14
|
#
|
@@ -20,8 +20,8 @@ module Vedeu
|
|
20
20
|
new(value).align
|
21
21
|
end
|
22
22
|
|
23
|
-
# @param value [NilClass|Symbol|Vedeu::
|
24
|
-
# @return [Vedeu::
|
23
|
+
# @param value [NilClass|Symbol|Vedeu::Geometries::Alignment]
|
24
|
+
# @return [Vedeu::Geometries::Alignment]
|
25
25
|
def self.coerce(value = nil)
|
26
26
|
if value.is_a?(self)
|
27
27
|
value
|
@@ -35,10 +35,10 @@ module Vedeu
|
|
35
35
|
end
|
36
36
|
end
|
37
37
|
|
38
|
-
# Returns a new instance of Vedeu::
|
38
|
+
# Returns a new instance of Vedeu::Geometries::Alignment.
|
39
39
|
#
|
40
40
|
# @param value [NilClass|Symbol]
|
41
|
-
# @return [Vedeu::
|
41
|
+
# @return [Vedeu::Geometries::Alignment]
|
42
42
|
def initialize(value = nil)
|
43
43
|
@value = value
|
44
44
|
end
|
@@ -139,6 +139,6 @@ module Vedeu
|
|
139
139
|
|
140
140
|
end # Alignment
|
141
141
|
|
142
|
-
end #
|
142
|
+
end # Geometries
|
143
143
|
|
144
144
|
end # Vedeu
|
@@ -0,0 +1,31 @@
|
|
1
|
+
module Vedeu
|
2
|
+
|
3
|
+
# The Geometry group of classes all handle the size of interfaces in
|
4
|
+
# relation to the current size of the terminal. This helps Vedeu to
|
5
|
+
# draw content in a consistent way.
|
6
|
+
#
|
7
|
+
# You can define the geometry of your interfaces using the
|
8
|
+
# {Vedeu::Geometries::DSL}.
|
9
|
+
#
|
10
|
+
module Geometries
|
11
|
+
|
12
|
+
end # Geometries
|
13
|
+
|
14
|
+
end # Vedeu
|
15
|
+
|
16
|
+
require 'vedeu/geometries/alignment'
|
17
|
+
require 'vedeu/geometries/horizontal_alignment'
|
18
|
+
require 'vedeu/geometries/vertical_alignment'
|
19
|
+
require 'vedeu/geometries/area'
|
20
|
+
require 'vedeu/geometries/coordinate'
|
21
|
+
require 'vedeu/geometries/dimension'
|
22
|
+
require 'vedeu/geometries/x_dimension'
|
23
|
+
require 'vedeu/geometries/y_dimension'
|
24
|
+
require 'vedeu/geometries/validator'
|
25
|
+
require 'vedeu/geometries/dsl'
|
26
|
+
require 'vedeu/geometries/coordinate'
|
27
|
+
require 'vedeu/geometries/geometry'
|
28
|
+
require 'vedeu/geometries/grid'
|
29
|
+
require 'vedeu/geometries/move'
|
30
|
+
require 'vedeu/geometries/position'
|
31
|
+
require 'vedeu/geometries/repository'
|
@@ -1,6 +1,6 @@
|
|
1
1
|
module Vedeu
|
2
2
|
|
3
|
-
module
|
3
|
+
module Geometries
|
4
4
|
|
5
5
|
# Define an area from dimensions or points.
|
6
6
|
#
|
@@ -54,7 +54,7 @@ module Vedeu
|
|
54
54
|
# @option attributes yn [Fixnum]
|
55
55
|
# @option attributes y_yn [Fixnum]
|
56
56
|
# @option attributes y_default [Fixnum]
|
57
|
-
# @return [Vedeu::
|
57
|
+
# @return [Vedeu::Geometries::Area]
|
58
58
|
def self.from_attributes(attributes = {})
|
59
59
|
y_attributes = {
|
60
60
|
alignment: attributes[:vertical_alignment],
|
@@ -70,8 +70,8 @@ module Vedeu
|
|
70
70
|
d_dn: attributes[:x_xn],
|
71
71
|
maximised: attributes[:maximised],
|
72
72
|
}
|
73
|
-
y_yn = Vedeu::
|
74
|
-
x_xn = Vedeu::
|
73
|
+
y_yn = Vedeu::Geometries::YDimension.pair(y_attributes)
|
74
|
+
x_xn = Vedeu::Geometries::XDimension.pair(x_attributes)
|
75
75
|
|
76
76
|
new(name: attributes[:name],
|
77
77
|
y: y_yn[0],
|
@@ -87,7 +87,7 @@ module Vedeu
|
|
87
87
|
# @param yn [Fixnum] The ending row/line position.
|
88
88
|
# @param x [Fixnum] The starting column/character position.
|
89
89
|
# @param xn [Fixnum] The ending column/character position.
|
90
|
-
# @return [Vedeu::
|
90
|
+
# @return [Vedeu::Geometries::Area]
|
91
91
|
def initialize(name:, y:, yn:, x:, xn:)
|
92
92
|
@name = name
|
93
93
|
@y = y
|
@@ -98,7 +98,7 @@ module Vedeu
|
|
98
98
|
|
99
99
|
# An object is equal when its values are the same.
|
100
100
|
#
|
101
|
-
# @param other [Vedeu::
|
101
|
+
# @param other [Vedeu::Geometries::Area]
|
102
102
|
# @return [Boolean]
|
103
103
|
def eql?(other)
|
104
104
|
self.class == other.class && y == other.y && yn == other.yn &&
|
@@ -262,11 +262,11 @@ module Vedeu
|
|
262
262
|
|
263
263
|
# @return [Vedeu::Borders::Border]
|
264
264
|
def border
|
265
|
-
@
|
265
|
+
@_border ||= Vedeu.borders.by_name(name)
|
266
266
|
end
|
267
267
|
|
268
268
|
end # Area
|
269
269
|
|
270
|
-
end #
|
270
|
+
end # Geometries
|
271
271
|
|
272
272
|
end # Vedeu
|
@@ -1,6 +1,6 @@
|
|
1
1
|
module Vedeu
|
2
2
|
|
3
|
-
module
|
3
|
+
module Geometries
|
4
4
|
|
5
5
|
# Crudely corrects out of range values.
|
6
6
|
#
|
@@ -8,13 +8,13 @@ module Vedeu
|
|
8
8
|
#
|
9
9
|
class Coordinate
|
10
10
|
|
11
|
-
# Return a new instance of Vedeu::
|
11
|
+
# Return a new instance of Vedeu::Geometries::Coordinate.
|
12
12
|
#
|
13
13
|
# @param attributes [Hash<Symbol => Fixnum|String|Symbol>]
|
14
14
|
# @option attributes name [String|Symbol]
|
15
15
|
# @option attributes type [Symbol]
|
16
16
|
# @option attributes offset [Fixnum]
|
17
|
-
# @return [Vedeu::
|
17
|
+
# @return [Vedeu::Geometries::Coordinate]
|
18
18
|
def initialize(attributes = {})
|
19
19
|
defaults.merge!(attributes).each do |key, value|
|
20
20
|
instance_variable_set("@#{key}", value)
|
@@ -84,7 +84,7 @@ module Vedeu
|
|
84
84
|
|
85
85
|
# Returns the geometry for the interface.
|
86
86
|
#
|
87
|
-
# @return (see Vedeu::
|
87
|
+
# @return (see Vedeu::Geometries::Repository#by_name)
|
88
88
|
def geometry
|
89
89
|
@geometry ||= Vedeu.geometries.by_name(name)
|
90
90
|
end
|
@@ -172,6 +172,6 @@ module Vedeu
|
|
172
172
|
|
173
173
|
end # Coordinate
|
174
174
|
|
175
|
-
end #
|
175
|
+
end # Geometries
|
176
176
|
|
177
177
|
end # Vedeu
|
@@ -1,6 +1,6 @@
|
|
1
1
|
module Vedeu
|
2
2
|
|
3
|
-
module
|
3
|
+
module Geometries
|
4
4
|
|
5
5
|
# A Dimension is either the height or width of an entity.
|
6
6
|
#
|
@@ -25,7 +25,7 @@ module Vedeu
|
|
25
25
|
new(attributes).pair
|
26
26
|
end
|
27
27
|
|
28
|
-
# Returns a new instance of Vedeu::
|
28
|
+
# Returns a new instance of Vedeu::Geometries::Dimension.
|
29
29
|
#
|
30
30
|
# @param attributes [Hash<Symbol => Fixnum, NilClass>]
|
31
31
|
# @option attributes alignment [Symbol]
|
@@ -37,7 +37,7 @@ module Vedeu
|
|
37
37
|
# @option attributes default [Fixnum|NilClass]
|
38
38
|
# The terminal width or height.
|
39
39
|
# @option attributes maximised [Boolean]
|
40
|
-
# @return [Vedeu::
|
40
|
+
# @return [Vedeu::Geometries::Dimension]
|
41
41
|
def initialize(attributes = {})
|
42
42
|
defaults.merge!(attributes).each do |key, value|
|
43
43
|
instance_variable_set("@#{key}", value)
|
@@ -76,9 +76,9 @@ module Vedeu
|
|
76
76
|
|
77
77
|
private
|
78
78
|
|
79
|
-
# @return [Vedeu::
|
79
|
+
# @return [Vedeu::Geometries::Alignment]
|
80
80
|
def alignment
|
81
|
-
Vedeu::
|
81
|
+
Vedeu::Geometries::Alignment.coerce(@alignment)
|
82
82
|
end
|
83
83
|
|
84
84
|
# Return the dimension.
|
@@ -257,6 +257,6 @@ module Vedeu
|
|
257
257
|
|
258
258
|
end # Dimension
|
259
259
|
|
260
|
-
end #
|
260
|
+
end # Geometries
|
261
261
|
|
262
262
|
end # Vedeu
|
@@ -1,6 +1,6 @@
|
|
1
1
|
module Vedeu
|
2
2
|
|
3
|
-
module
|
3
|
+
module Geometries
|
4
4
|
|
5
5
|
# Geometry allows the configuration of the position and size of an
|
6
6
|
# interface. Within Vedeu, as the same for ANSI terminals, has the
|
@@ -76,7 +76,7 @@ module Vedeu
|
|
76
76
|
include Vedeu::Common
|
77
77
|
include Vedeu::DSL
|
78
78
|
include Vedeu::DSL::Use
|
79
|
-
include Vedeu::
|
79
|
+
include Vedeu::Geometries::Validator
|
80
80
|
|
81
81
|
# Specify the geometry of an interface or view with a simple
|
82
82
|
# DSL.
|
@@ -89,11 +89,11 @@ module Vedeu
|
|
89
89
|
# to which this geometry belongs.
|
90
90
|
# @param block [Proc]
|
91
91
|
# @raise [Vedeu::Error::RequiresBlock]
|
92
|
-
# @return [Vedeu::
|
92
|
+
# @return [Vedeu::Geometries::Geometry]
|
93
93
|
def self.geometry(name, &block)
|
94
94
|
fail Vedeu::Error::RequiresBlock unless block_given?
|
95
95
|
|
96
|
-
Vedeu::
|
96
|
+
Vedeu::Geometries::Geometry.build(name: name, &block).store
|
97
97
|
end
|
98
98
|
|
99
99
|
# Instructs Vedeu to align the interface/view either left,
|
@@ -114,7 +114,7 @@ module Vedeu
|
|
114
114
|
# @param width [Fixnum] The width of the aligned interface/view.
|
115
115
|
# @raise [Vedeu::Error::InvalidSyntax] When the value or width
|
116
116
|
# is not given.
|
117
|
-
# @return [Vedeu::
|
117
|
+
# @return [Vedeu::Geometries::Geometry]
|
118
118
|
# def alignment(value, width)
|
119
119
|
# fail Vedeu::Error::InvalidSyntax,
|
120
120
|
# 'No alignment given. Valid values are :center, :centre, ' \
|
@@ -122,7 +122,7 @@ module Vedeu
|
|
122
122
|
# fail Vedeu::Error::InvalidSyntax,
|
123
123
|
# 'No width given.'.freeze unless present?(width)
|
124
124
|
|
125
|
-
# model.alignment = Vedeu::
|
125
|
+
# model.alignment = Vedeu::Geometries::Alignment.align(value)
|
126
126
|
# model.width = width
|
127
127
|
# model
|
128
128
|
# end
|
@@ -146,7 +146,7 @@ module Vedeu
|
|
146
146
|
# is not given.
|
147
147
|
# - When the vertical is given (and not :none) and the height
|
148
148
|
# is not given.
|
149
|
-
# @return [Vedeu::
|
149
|
+
# @return [Vedeu::Geometries::Geometry]
|
150
150
|
def align(vertical, horizontal, width, height)
|
151
151
|
validate_vertical_alignment!(vertical)
|
152
152
|
validate_horizontal_alignment!(horizontal)
|
@@ -160,12 +160,12 @@ module Vedeu
|
|
160
160
|
# @param value [Symbol] One of :center, :centre, :left, :none,
|
161
161
|
# :right.
|
162
162
|
# @param width [Fixnum] The number of characters/columns.
|
163
|
-
# @return [Vedeu::
|
163
|
+
# @return [Vedeu::Geometries::Geometry]
|
164
164
|
def horizontal_alignment(value, width)
|
165
165
|
validate_horizontal_alignment!(value)
|
166
166
|
validate_width!(width)
|
167
167
|
|
168
|
-
model.horizontal_alignment = Vedeu::
|
168
|
+
model.horizontal_alignment = Vedeu::Geometries::HorizontalAlignment
|
169
169
|
.coerce(value)
|
170
170
|
model.width = width
|
171
171
|
model
|
@@ -173,12 +173,12 @@ module Vedeu
|
|
173
173
|
|
174
174
|
# @param value [Symbol] One of :bottom, :middle, :none, :top.
|
175
175
|
# @param height [Fixnum] The number of lines/rows.
|
176
|
-
# @return [Vedeu::
|
176
|
+
# @return [Vedeu::Geometries::Geometry]
|
177
177
|
def vertical_alignment(value, height)
|
178
178
|
validate_vertical_alignment!(value)
|
179
179
|
validate_height!(height)
|
180
180
|
|
181
|
-
model.vertical_alignment = Vedeu::
|
181
|
+
model.vertical_alignment = Vedeu::Geometries::VerticalAlignment
|
182
182
|
.coerce(value)
|
183
183
|
model.height = height
|
184
184
|
model
|
@@ -207,7 +207,7 @@ module Vedeu
|
|
207
207
|
# @param height [Fixnum] The number of lines/rows.
|
208
208
|
# @raise [Vedeu::Error::InvalidSyntax] When the height is not
|
209
209
|
# given.
|
210
|
-
# @return [Vedeu::
|
210
|
+
# @return [Vedeu::Geometries::Geometry]
|
211
211
|
def align_bottom(height)
|
212
212
|
vertical_alignment(:bottom, height)
|
213
213
|
end
|
@@ -236,7 +236,7 @@ module Vedeu
|
|
236
236
|
# @param width [Fixnum] The number of characters/columns.
|
237
237
|
# @raise [Vedeu::Error::InvalidSyntax] When the width is not
|
238
238
|
# given.
|
239
|
-
# @return [Vedeu::
|
239
|
+
# @return [Vedeu::Geometries::Geometry]
|
240
240
|
def align_centre(width)
|
241
241
|
horizontal_alignment(:centre, width)
|
242
242
|
end
|
@@ -264,7 +264,7 @@ module Vedeu
|
|
264
264
|
# @param width [Fixnum] The number of characters/columns.
|
265
265
|
# @raise [Vedeu::Error::InvalidSyntax] When the width is not
|
266
266
|
# given.
|
267
|
-
# @return [Vedeu::
|
267
|
+
# @return [Vedeu::Geometries::Geometry]
|
268
268
|
def align_left(width)
|
269
269
|
horizontal_alignment(:left, width)
|
270
270
|
end
|
@@ -292,7 +292,7 @@ module Vedeu
|
|
292
292
|
# @param height [Fixnum] The number of lines/rows.
|
293
293
|
# @raise [Vedeu::Error::InvalidSyntax] When the height is not
|
294
294
|
# given.
|
295
|
-
# @return [Vedeu::
|
295
|
+
# @return [Vedeu::Geometries::Geometry]
|
296
296
|
def align_middle(height)
|
297
297
|
vertical_alignment(:middle, height)
|
298
298
|
end
|
@@ -319,7 +319,7 @@ module Vedeu
|
|
319
319
|
# @param width [Fixnum] The number of characters/columns.
|
320
320
|
# @raise [Vedeu::Error::InvalidSyntax] When the width is not
|
321
321
|
# given.
|
322
|
-
# @return [Vedeu::
|
322
|
+
# @return [Vedeu::Geometries::Geometry]
|
323
323
|
def align_right(width)
|
324
324
|
horizontal_alignment(:right, width)
|
325
325
|
end
|
@@ -347,7 +347,7 @@ module Vedeu
|
|
347
347
|
# @param height [Fixnum] The number of lines/rows.
|
348
348
|
# @raise [Vedeu::Error::InvalidSyntax] When the height is not
|
349
349
|
# given.
|
350
|
-
# @return [Vedeu::
|
350
|
+
# @return [Vedeu::Geometries::Geometry]
|
351
351
|
def align_top(height)
|
352
352
|
vertical_alignment(:top, height)
|
353
353
|
end
|
@@ -368,7 +368,7 @@ module Vedeu
|
|
368
368
|
# not between 1 and 12 inclusive.
|
369
369
|
# @return [Fixnum|Vedeu::Error::OutOfRange]
|
370
370
|
def columns(value)
|
371
|
-
Vedeu::
|
371
|
+
Vedeu::Geometries::Grid.columns(value)
|
372
372
|
end
|
373
373
|
|
374
374
|
# Specify the number of characters/rows/lines tall the interface
|
@@ -402,7 +402,7 @@ module Vedeu
|
|
402
402
|
# not between 1 and 12 inclusive.
|
403
403
|
# @return [Fixnum]
|
404
404
|
def rows(value)
|
405
|
-
Vedeu::
|
405
|
+
Vedeu::Geometries::Grid.rows(value)
|
406
406
|
end
|
407
407
|
|
408
408
|
# Specify the number of characters/columns wide the interface
|
@@ -508,11 +508,11 @@ module Vedeu
|
|
508
508
|
|
509
509
|
end # DSL
|
510
510
|
|
511
|
-
end #
|
511
|
+
end # Geometries
|
512
512
|
|
513
513
|
# @!method geometry
|
514
|
-
# @see Vedeu::
|
515
|
-
def_delegators Vedeu::
|
514
|
+
# @see Vedeu::Geometries::DSL.geometry
|
515
|
+
def_delegators Vedeu::Geometries::DSL,
|
516
516
|
:geometry
|
517
517
|
|
518
518
|
end # Vedeu
|
@@ -1,6 +1,6 @@
|
|
1
1
|
module Vedeu
|
2
2
|
|
3
|
-
module
|
3
|
+
module Geometries
|
4
4
|
|
5
5
|
# @todo Consider storing the Terminal size at the time of first
|
6
6
|
# creation, this allows us to return the interface to its original
|
@@ -88,22 +88,22 @@ module Vedeu
|
|
88
88
|
new(attributes).store(&block)
|
89
89
|
end
|
90
90
|
|
91
|
-
# Returns a new instance of Vedeu::
|
91
|
+
# Returns a new instance of Vedeu::Geometries::Geometry.
|
92
92
|
#
|
93
93
|
# @param attributes [Hash<Symbol => Boolean|Fixnum|String|
|
94
|
-
# Symbol|Vedeu::
|
94
|
+
# Symbol|Vedeu::Geometries::Repository]
|
95
95
|
# @option attributes horizontal_alignment [Symbol]
|
96
96
|
# @option attributes vertical_alignment [Symbol]
|
97
97
|
# @option attributes maximised [Boolean]
|
98
98
|
# @option attributes height [Fixnum]
|
99
99
|
# @option attributes name [String|Symbol]
|
100
|
-
# @option attributes repository [Vedeu::
|
100
|
+
# @option attributes repository [Vedeu::Geometries::Repository]
|
101
101
|
# @option attributes width [Fixnum]
|
102
102
|
# @option attributes x [Fixnum]
|
103
103
|
# @option attributes xn [Fixnum]
|
104
104
|
# @option attributes y [Fixnum]
|
105
105
|
# @option attributes yn [Fixnum]
|
106
|
-
# @return [Vedeu::
|
106
|
+
# @return [Vedeu::Geometries::Geometry]
|
107
107
|
def initialize(attributes = {})
|
108
108
|
defaults.merge!(attributes).each do |key, value|
|
109
109
|
instance_variable_set("@#{key}", value)
|
@@ -111,7 +111,7 @@ module Vedeu
|
|
111
111
|
end
|
112
112
|
|
113
113
|
# @return [Hash<Symbol => Boolean|Fixnum|String|Symbol|
|
114
|
-
# Vedeu::
|
114
|
+
# Vedeu::Geometries::Repository]
|
115
115
|
def attributes
|
116
116
|
{
|
117
117
|
client: @client,
|
@@ -136,15 +136,15 @@ module Vedeu
|
|
136
136
|
# the client application object that is currently invoking a
|
137
137
|
# DSL method. It is required so that we can send messages to
|
138
138
|
# the client application object should we need to.
|
139
|
-
# @return [Vedeu::
|
139
|
+
# @return [Vedeu::Geometries::DSL] The DSL instance for this
|
140
140
|
# model.
|
141
141
|
def deputy(client = nil)
|
142
|
-
Vedeu::
|
142
|
+
Vedeu::Geometries::DSL.new(self, client)
|
143
143
|
end
|
144
144
|
|
145
145
|
# An object is equal when its values are the same.
|
146
146
|
#
|
147
|
-
# @param other [Vedeu::
|
147
|
+
# @param other [Vedeu::Geometries::Geometry]
|
148
148
|
# @return [Boolean]
|
149
149
|
def eql?(other)
|
150
150
|
self.class == other.class && name == other.name
|
@@ -157,7 +157,7 @@ module Vedeu
|
|
157
157
|
# @example
|
158
158
|
# Vedeu.trigger(:_maximise_, name)
|
159
159
|
#
|
160
|
-
# @return [Vedeu::
|
160
|
+
# @return [Vedeu::Geometries::Geometry|NilClass]
|
161
161
|
def maximise
|
162
162
|
return self if maximised?
|
163
163
|
|
@@ -178,7 +178,7 @@ module Vedeu
|
|
178
178
|
# @example
|
179
179
|
# Vedeu.trigger(:_unmaximise_, name)
|
180
180
|
#
|
181
|
-
# @return [Vedeu::
|
181
|
+
# @return [Vedeu::Geometries::Geometry|NilClass]
|
182
182
|
def unmaximise
|
183
183
|
return self unless maximised?
|
184
184
|
|
@@ -193,9 +193,9 @@ module Vedeu
|
|
193
193
|
|
194
194
|
private
|
195
195
|
|
196
|
-
# @return [Vedeu::
|
196
|
+
# @return [Vedeu::Geometries::Area]
|
197
197
|
def area
|
198
|
-
@area = Vedeu::
|
198
|
+
@area = Vedeu::Geometries::Area.from_attributes(area_attributes)
|
199
199
|
end
|
200
200
|
|
201
201
|
# @return [Hash<Symbol => Boolean|Fixnum>]
|
@@ -217,7 +217,7 @@ module Vedeu
|
|
217
217
|
# Returns the default options/attributes for this class.
|
218
218
|
#
|
219
219
|
# @return [Hash<Symbol => Boolean|Fixnum|NilClass|String|Symbol|
|
220
|
-
# Vedeu::
|
220
|
+
# Vedeu::Geometries::Repository]
|
221
221
|
def defaults
|
222
222
|
{
|
223
223
|
client: nil,
|
@@ -237,6 +237,6 @@ module Vedeu
|
|
237
237
|
|
238
238
|
end # Geometry
|
239
239
|
|
240
|
-
end #
|
240
|
+
end # Geometries
|
241
241
|
|
242
242
|
end # Vedeu
|