vedeu 0.6.4 → 0.6.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.codeclimate.yml +40 -0
- data/README.md +1 -0
- data/docs/dsl.md +24 -24
- data/lib/vedeu/all.rb +21 -44
- data/lib/vedeu/api.rb +13 -13
- data/lib/vedeu/application/application_controller.rb +2 -0
- data/lib/vedeu/bindings/movement.rb +53 -18
- data/lib/vedeu/bindings/refresh.rb +1 -1
- data/lib/vedeu/bindings/system.rb +2 -2
- data/lib/vedeu/bindings/visibility.rb +3 -3
- data/lib/vedeu/borders/all.rb +13 -0
- data/lib/vedeu/borders/border.rb +209 -202
- data/lib/vedeu/{dsl/border.rb → borders/dsl.rb} +15 -15
- data/lib/vedeu/{null/border.rb → borders/null.rb} +9 -9
- data/lib/vedeu/borders/render.rb +347 -0
- data/lib/vedeu/borders/repository.rb +19 -0
- data/lib/vedeu/buffers/all.rb +13 -0
- data/lib/vedeu/buffers/buffer.rb +182 -176
- data/lib/vedeu/{null/buffer.rb → buffers/null.rb} +8 -8
- data/lib/vedeu/buffers/repository.rb +24 -0
- data/lib/vedeu/buffers/virtual_buffer.rb +2 -2
- data/lib/vedeu/cursors/all.rb +11 -0
- data/lib/vedeu/cursors/cursor.rb +276 -0
- data/lib/vedeu/cursors/refresh.rb +84 -0
- data/lib/vedeu/cursors/repository.rb +34 -0
- data/lib/vedeu/dsl/interface.rb +9 -9
- data/lib/vedeu/dsl/shared.rb +11 -11
- data/lib/vedeu/{exceptions.rb → error.rb} +2 -2
- data/lib/vedeu/esc/esc.rb +1 -1
- data/lib/vedeu/geometry/all.rb +18 -0
- data/lib/vedeu/geometry/area.rb +170 -160
- data/lib/vedeu/geometry/coordinate.rb +61 -39
- data/lib/vedeu/geometry/dimension.rb +139 -132
- data/lib/vedeu/{dsl/geometry.rb → geometry/dsl.rb} +11 -11
- data/lib/vedeu/geometry/generic_coordinate.rb +159 -153
- data/lib/vedeu/geometry/geometry.rb +310 -212
- data/lib/vedeu/geometry/grid.rb +73 -69
- data/lib/vedeu/{null/geometry.rb → geometry/null.rb} +10 -10
- data/lib/vedeu/geometry/position.rb +124 -120
- data/lib/vedeu/geometry/repository.rb +19 -0
- data/lib/vedeu/input/editor/document.rb +2 -2
- data/lib/vedeu/internal_api.rb +8 -8
- data/lib/vedeu/models/escape.rb +2 -2
- data/lib/vedeu/models/interface.rb +1 -1
- data/lib/vedeu/models/page.rb +89 -0
- data/lib/vedeu/models/row.rb +66 -0
- data/lib/vedeu/models/toggleable.rb +1 -1
- data/lib/vedeu/models/views/char.rb +7 -6
- data/lib/vedeu/models/views/line.rb +1 -1
- data/lib/vedeu/models/views/view.rb +2 -2
- data/lib/vedeu/options.rb +19 -0
- data/lib/vedeu/output/clear/named_interface.rb +1 -1
- data/lib/vedeu/output/direct.rb +1 -1
- data/lib/vedeu/output/presentation.rb +2 -1
- data/lib/vedeu/output/viewport.rb +3 -3
- data/lib/vedeu/repositories/model.rb +9 -1
- data/lib/vedeu/repositories/repository.rb +5 -0
- data/lib/vedeu/terminal/terminal.rb +3 -3
- data/lib/vedeu/version.rb +1 -1
- data/test/lib/vedeu/borders/border_test.rb +299 -291
- data/test/lib/vedeu/{dsl/border_test.rb → borders/dsl_test.rb} +6 -6
- data/test/lib/vedeu/{null/border_test.rb → borders/null_test.rb} +6 -6
- data/test/lib/vedeu/borders/render_test.rb +125 -0
- data/test/lib/vedeu/borders/repository_test.rb +17 -0
- data/test/lib/vedeu/buffers/buffer_test.rb +116 -112
- data/test/lib/vedeu/{null/buffer_test.rb → buffers/null_test.rb} +5 -5
- data/test/lib/vedeu/buffers/repository_test.rb +18 -0
- data/test/lib/vedeu/cursors/cursor_test.rb +370 -0
- data/test/lib/vedeu/cursors/refresh_test.rb +69 -0
- data/test/lib/vedeu/cursors/repository_test.rb +41 -0
- data/test/lib/vedeu/dsl/interface_test.rb +5 -5
- data/test/lib/vedeu/{exceptions_test.rb → error_test.rb} +0 -0
- data/test/lib/vedeu/geometry/area_test.rb +141 -137
- data/test/lib/vedeu/geometry/coordinate_test.rb +93 -89
- data/test/lib/vedeu/geometry/dimension_test.rb +137 -133
- data/test/lib/vedeu/{dsl/geometry_test.rb → geometry/dsl_test.rb} +17 -17
- data/test/lib/vedeu/geometry/generic_coordinate_test.rb +32 -28
- data/test/lib/vedeu/geometry/geometry_test.rb +282 -157
- data/test/lib/vedeu/geometry/grid_test.rb +35 -31
- data/test/lib/vedeu/{null/geometry_test.rb → geometry/null_test.rb} +5 -5
- data/test/lib/vedeu/geometry/position_test.rb +146 -142
- data/test/lib/vedeu/geometry/repository_test.rb +19 -0
- data/test/lib/vedeu/input/editor/document_test.rb +1 -1
- data/test/lib/vedeu/models/escape_test.rb +1 -1
- data/test/lib/vedeu/models/interface_test.rb +2 -2
- data/test/lib/vedeu/models/page_test.rb +235 -0
- data/test/lib/vedeu/models/row_test.rb +111 -0
- data/test/lib/vedeu/models/views/char_test.rb +3 -3
- data/test/lib/vedeu/options_test.rb +57 -0
- data/test/lib/vedeu/output/clear/named_interface_test.rb +1 -1
- data/test/lib/vedeu/output/renderers/json_test.rb +1 -1
- data/test/lib/vedeu/output/viewport_test.rb +15 -9
- data/test/lib/vedeu/refresh/refresh_buffer_test.rb +12 -12
- data/test/lib/vedeu/repositories/repositories_test.rb +1 -1
- data/test/lib/vedeu/repositories/repository_test.rb +7 -0
- data/test/lib/vedeu/terminal/terminal_test.rb +1 -1
- data/test/test_helper.rb +1 -1
- data/vedeu.gemspec +2 -2
- metadata +57 -63
- data/lib/vedeu/borders/borders.rb +0 -15
- data/lib/vedeu/borders/render_border.rb +0 -331
- data/lib/vedeu/buffers/buffers.rb +0 -20
- data/lib/vedeu/cursor/cursor.rb +0 -174
- data/lib/vedeu/cursor/cursors.rb +0 -30
- data/lib/vedeu/cursor/move.rb +0 -239
- data/lib/vedeu/cursor/reposition.rb +0 -78
- data/lib/vedeu/geometry/geometries.rb +0 -15
- data/lib/vedeu/refresh/refresh_cursor.rb +0 -92
- data/test/lib/vedeu/borders/borders_test.rb +0 -13
- data/test/lib/vedeu/borders/render_border_test.rb +0 -121
- data/test/lib/vedeu/buffers/buffers_test.rb +0 -14
- data/test/lib/vedeu/cursor/cursor_test.rb +0 -246
- data/test/lib/vedeu/cursor/cursors_test.rb +0 -37
- data/test/lib/vedeu/cursor/move_test.rb +0 -301
- data/test/lib/vedeu/cursor/reposition_test.rb +0 -63
- data/test/lib/vedeu/geometry/geometries_test.rb +0 -15
- data/test/lib/vedeu/refresh/refresh_cursor_test.rb +0 -65
@@ -146,7 +146,7 @@ module Vedeu
|
|
146
146
|
# Vedeu.trigger(:_maximise_, name)
|
147
147
|
#
|
148
148
|
# @return [TrueClass]
|
149
|
-
# @see Vedeu::Geometry#maximise
|
149
|
+
# @see Vedeu::Geometry::Geometry#maximise
|
150
150
|
def maximise!
|
151
151
|
Vedeu.bind(:_maximise_) do |name|
|
152
152
|
Vedeu.geometries.by_name(name).maximise
|
@@ -184,7 +184,7 @@ module Vedeu
|
|
184
184
|
# Vedeu.trigger(:_unmaximise_, name)
|
185
185
|
#
|
186
186
|
# @return [TrueClass]
|
187
|
-
# @see Vedeu::Geometry#unmaximise
|
187
|
+
# @see Vedeu::Geometry::Geometry#unmaximise
|
188
188
|
def unmaximise!
|
189
189
|
Vedeu.bind(:_unmaximise_) do |name|
|
190
190
|
Vedeu.geometries.by_name(name).unmaximise
|
@@ -52,7 +52,7 @@ module Vedeu
|
|
52
52
|
# @return [TrueClass]
|
53
53
|
def hide_cursor!
|
54
54
|
Vedeu.bind(:_hide_cursor_) do |name|
|
55
|
-
Vedeu::Cursor.hide_cursor(name)
|
55
|
+
Vedeu::Cursors::Cursor.hide_cursor(name)
|
56
56
|
end
|
57
57
|
|
58
58
|
Vedeu.bind_alias(:_cursor_hide_, :_hide_cursor_)
|
@@ -87,7 +87,7 @@ module Vedeu
|
|
87
87
|
# @return [TrueClass]
|
88
88
|
def show_cursor!
|
89
89
|
Vedeu.bind(:_show_cursor_) do |name|
|
90
|
-
Vedeu::Cursor.show_cursor(name)
|
90
|
+
Vedeu::Cursors::Cursor.show_cursor(name)
|
91
91
|
end
|
92
92
|
|
93
93
|
Vedeu.bind_alias(:_cursor_show_, :_show_cursor_)
|
@@ -120,7 +120,7 @@ module Vedeu
|
|
120
120
|
# @return [TrueClass]
|
121
121
|
def toggle_cursor!
|
122
122
|
Vedeu.bind(:_toggle_cursor_) do |name|
|
123
|
-
Vedeu::Cursor.toggle_cursor(name)
|
123
|
+
Vedeu::Cursors::Cursor.toggle_cursor(name)
|
124
124
|
end
|
125
125
|
end
|
126
126
|
|
data/lib/vedeu/borders/border.rb
CHANGED
@@ -1,209 +1,216 @@
|
|
1
1
|
module Vedeu
|
2
2
|
|
3
|
-
|
4
|
-
# or specific edges. The characters which are used for the border parts (e.g.
|
5
|
-
# the corners, verticals and horizontals) can be customised as can the colours
|
6
|
-
# and styles.
|
7
|
-
#
|
8
|
-
# @note Refer to UTF-8 U+2500 to U+257F for border characters. More details
|
9
|
-
# can be found at: http://en.wikipedia.org/wiki/Box-drawing_character
|
10
|
-
#
|
11
|
-
class Border
|
12
|
-
|
13
|
-
extend Forwardable
|
14
|
-
include Vedeu::Common
|
15
|
-
include Vedeu::Model
|
16
|
-
include Vedeu::Presentation
|
17
|
-
|
18
|
-
def_delegators :geometry,
|
19
|
-
:x,
|
20
|
-
:xn,
|
21
|
-
:y,
|
22
|
-
:yn
|
23
|
-
|
24
|
-
def_delegators :interface, :visible?
|
25
|
-
|
26
|
-
# @!attribute [rw] attributes
|
27
|
-
# @return [Hash]
|
28
|
-
attr_accessor :attributes
|
29
|
-
|
30
|
-
# @!attribute [rw] bottom_left
|
31
|
-
# @return [String]
|
32
|
-
attr_accessor :bottom_left
|
33
|
-
|
34
|
-
# @!attribute [rw] bottom_right
|
35
|
-
# @return [String]
|
36
|
-
attr_accessor :bottom_right
|
37
|
-
|
38
|
-
# @!attribute [rw] horizontal
|
39
|
-
# @return [String]
|
40
|
-
attr_accessor :horizontal
|
41
|
-
|
42
|
-
# @!attribute [rw] show_bottom
|
43
|
-
# @return [Boolean]
|
44
|
-
attr_accessor :show_bottom
|
45
|
-
alias_method :bottom?, :show_bottom
|
46
|
-
|
47
|
-
# @!attribute [rw] show_left
|
48
|
-
# @return [Boolean]
|
49
|
-
attr_accessor :show_left
|
50
|
-
alias_method :left?, :show_left
|
51
|
-
|
52
|
-
# @!attribute [rw] show_right
|
53
|
-
# @return [Boolean]
|
54
|
-
attr_accessor :show_right
|
55
|
-
alias_method :right?, :show_right
|
56
|
-
|
57
|
-
# @!attribute [rw] show_top
|
58
|
-
# @return [Boolean]
|
59
|
-
attr_accessor :show_top
|
60
|
-
alias_method :top?, :show_top
|
61
|
-
|
62
|
-
# @!attribute [rw] caption
|
63
|
-
# @return [String]
|
64
|
-
attr_accessor :caption
|
65
|
-
|
66
|
-
# @!attribute [rw] title
|
67
|
-
# @return [String]
|
68
|
-
attr_accessor :title
|
69
|
-
|
70
|
-
# @!attribute [rw] top_left
|
71
|
-
# @return [String]
|
72
|
-
attr_accessor :top_left
|
73
|
-
|
74
|
-
# @!attribute [rw] top_right
|
75
|
-
# @return [String]
|
76
|
-
attr_accessor :top_right
|
77
|
-
|
78
|
-
# @!attribute [rw] vertical
|
79
|
-
# @return [String]
|
80
|
-
attr_accessor :vertical
|
81
|
-
|
82
|
-
# @!attribute [r] name
|
83
|
-
# @return [String]
|
84
|
-
attr_reader :name
|
85
|
-
|
86
|
-
# @!attribute [r] enabled
|
87
|
-
# @return [Boolean]
|
88
|
-
attr_accessor :enabled
|
89
|
-
alias_method :enabled?, :enabled
|
90
|
-
|
91
|
-
# Returns a new instance of Vedeu::Border.
|
92
|
-
#
|
93
|
-
# @param attributes [Hash]
|
94
|
-
# @option attributes bottom_left [String] The bottom left border character.
|
95
|
-
# @option attributes bottom_right [String] The bottom right border
|
96
|
-
# character.
|
97
|
-
# @option attributes colour [Hash]
|
98
|
-
# @option attributes enabled [Boolean] Indicate whether the border is to be
|
99
|
-
# shown for this interface.
|
100
|
-
# @option attributes horizontal [String] The horizontal border character.
|
101
|
-
# @option attributes name [String] The name of the interface to which this
|
102
|
-
# border relates.
|
103
|
-
# @option attributes style [Vedeu::Style]
|
104
|
-
# @option attributes show_bottom [Boolean] Indicate whether the bottom
|
105
|
-
# border is to be shown.
|
106
|
-
# @option attributes show_left [Boolean] Indicate whether the left border
|
107
|
-
# is to be shown.
|
108
|
-
# @option attributes show_right [Boolean] Indicate whether the right border
|
109
|
-
# is to be shown.
|
110
|
-
# @option attributes show_top [Boolean] Indicate whether the top border is
|
111
|
-
# to be shown.
|
112
|
-
# @option attributes title [String] An optional title for when the top
|
113
|
-
# border is to be shown.
|
114
|
-
# @option attributes caption [String] An optional caption for when the
|
115
|
-
# bottom border is to be shown.
|
116
|
-
# @option attributes top_left [String] The top left border character.
|
117
|
-
# @option attributes top_right [String] The top right border character.
|
118
|
-
# @option attributes vertical [String] The vertical border character.
|
119
|
-
# @return [Vedeu::Border]
|
120
|
-
def initialize(attributes = {})
|
121
|
-
@attributes = defaults.merge!(attributes)
|
122
|
-
|
123
|
-
@attributes.each { |key, value| instance_variable_set("@#{key}", value) }
|
124
|
-
end
|
125
|
-
|
126
|
-
# @return [Fixnum]
|
127
|
-
def bx
|
128
|
-
(enabled? && left?) ? x + 1 : x
|
129
|
-
end
|
130
|
-
|
131
|
-
# @return [Fixnum]
|
132
|
-
def bxn
|
133
|
-
(enabled? && right?) ? xn - 1 : xn
|
134
|
-
end
|
135
|
-
|
136
|
-
# @return [Fixnum]
|
137
|
-
def by
|
138
|
-
(enabled? && top?) ? y + 1 : y
|
139
|
-
end
|
140
|
-
|
141
|
-
# @return [Fixnum]
|
142
|
-
def byn
|
143
|
-
(enabled? && bottom?) ? yn - 1 : yn
|
144
|
-
end
|
145
|
-
|
146
|
-
# Returns the width of the interface determined by whether a left, right,
|
147
|
-
# both or neither borders are shown.
|
148
|
-
#
|
149
|
-
# @return [Fixnum]
|
150
|
-
def width
|
151
|
-
(bx..bxn).size
|
152
|
-
end
|
3
|
+
module Borders
|
153
4
|
|
154
|
-
#
|
155
|
-
#
|
5
|
+
# Provides the mechanism to decorate an interface with a border on all
|
6
|
+
# edges, or specific edges. The characters which are used for the border
|
7
|
+
# parts (e.g. the corners, verticals and horizontals) can be customised as
|
8
|
+
# can the colours and styles.
|
156
9
|
#
|
157
|
-
# @
|
158
|
-
|
159
|
-
(by..byn).size
|
160
|
-
end
|
161
|
-
|
162
|
-
# @return [Array<Array<Vedeu::Views::Char>>]
|
163
|
-
def render
|
164
|
-
Vedeu::RenderBorder.with(self)
|
165
|
-
end
|
166
|
-
|
167
|
-
private
|
168
|
-
|
169
|
-
# @return [Vedeu::Geometry]
|
170
|
-
def geometry
|
171
|
-
Vedeu.geometries.by_name(name)
|
172
|
-
end
|
173
|
-
|
174
|
-
# @return [Vedeu::Interface]
|
175
|
-
def interface
|
176
|
-
@interface ||= Vedeu.interfaces.by_name(name)
|
177
|
-
end
|
178
|
-
alias_method :parent, :interface
|
179
|
-
|
180
|
-
# The default values for a new instance of this class.
|
10
|
+
# @note Refer to UTF-8 U+2500 to U+257F for border characters. More details
|
11
|
+
# can be found at: http://en.wikipedia.org/wiki/Box-drawing_character
|
181
12
|
#
|
182
|
-
|
183
|
-
|
184
|
-
|
185
|
-
|
186
|
-
|
187
|
-
|
188
|
-
|
189
|
-
|
190
|
-
|
191
|
-
|
192
|
-
|
193
|
-
|
194
|
-
|
195
|
-
|
196
|
-
|
197
|
-
|
198
|
-
|
199
|
-
|
200
|
-
|
201
|
-
|
202
|
-
|
203
|
-
|
204
|
-
|
205
|
-
|
206
|
-
|
207
|
-
|
13
|
+
class Border
|
14
|
+
|
15
|
+
extend Forwardable
|
16
|
+
include Vedeu::Common
|
17
|
+
include Vedeu::Model
|
18
|
+
include Vedeu::Presentation
|
19
|
+
|
20
|
+
def_delegators :geometry,
|
21
|
+
:x,
|
22
|
+
:xn,
|
23
|
+
:y,
|
24
|
+
:yn
|
25
|
+
|
26
|
+
def_delegators :interface, :visible?
|
27
|
+
|
28
|
+
# @!attribute [rw] attributes
|
29
|
+
# @return [Hash]
|
30
|
+
attr_accessor :attributes
|
31
|
+
|
32
|
+
# @!attribute [rw] bottom_left
|
33
|
+
# @return [String]
|
34
|
+
attr_accessor :bottom_left
|
35
|
+
|
36
|
+
# @!attribute [rw] bottom_right
|
37
|
+
# @return [String]
|
38
|
+
attr_accessor :bottom_right
|
39
|
+
|
40
|
+
# @!attribute [rw] horizontal
|
41
|
+
# @return [String]
|
42
|
+
attr_accessor :horizontal
|
43
|
+
|
44
|
+
# @!attribute [rw] show_bottom
|
45
|
+
# @return [Boolean]
|
46
|
+
attr_accessor :show_bottom
|
47
|
+
alias_method :bottom?, :show_bottom
|
48
|
+
|
49
|
+
# @!attribute [rw] show_left
|
50
|
+
# @return [Boolean]
|
51
|
+
attr_accessor :show_left
|
52
|
+
alias_method :left?, :show_left
|
53
|
+
|
54
|
+
# @!attribute [rw] show_right
|
55
|
+
# @return [Boolean]
|
56
|
+
attr_accessor :show_right
|
57
|
+
alias_method :right?, :show_right
|
58
|
+
|
59
|
+
# @!attribute [rw] show_top
|
60
|
+
# @return [Boolean]
|
61
|
+
attr_accessor :show_top
|
62
|
+
alias_method :top?, :show_top
|
63
|
+
|
64
|
+
# @!attribute [rw] caption
|
65
|
+
# @return [String]
|
66
|
+
attr_accessor :caption
|
67
|
+
|
68
|
+
# @!attribute [rw] title
|
69
|
+
# @return [String]
|
70
|
+
attr_accessor :title
|
71
|
+
|
72
|
+
# @!attribute [rw] top_left
|
73
|
+
# @return [String]
|
74
|
+
attr_accessor :top_left
|
75
|
+
|
76
|
+
# @!attribute [rw] top_right
|
77
|
+
# @return [String]
|
78
|
+
attr_accessor :top_right
|
79
|
+
|
80
|
+
# @!attribute [rw] vertical
|
81
|
+
# @return [String]
|
82
|
+
attr_accessor :vertical
|
83
|
+
|
84
|
+
# @!attribute [r] name
|
85
|
+
# @return [String]
|
86
|
+
attr_reader :name
|
87
|
+
|
88
|
+
# @!attribute [r] enabled
|
89
|
+
# @return [Boolean]
|
90
|
+
attr_accessor :enabled
|
91
|
+
alias_method :enabled?, :enabled
|
92
|
+
|
93
|
+
# Returns a new instance of Vedeu::Borders::Border.
|
94
|
+
#
|
95
|
+
# @param attributes [Hash]
|
96
|
+
# @option attributes bottom_left [String] The bottom left border
|
97
|
+
# character.
|
98
|
+
# @option attributes bottom_right [String] The bottom right border
|
99
|
+
# character.
|
100
|
+
# @option attributes colour [Hash]
|
101
|
+
# @option attributes enabled [Boolean] Indicate whether the border is to
|
102
|
+
# be shown for this interface.
|
103
|
+
# @option attributes horizontal [String] The horizontal border character.
|
104
|
+
# @option attributes name [String] The name of the interface to which this
|
105
|
+
# border relates.
|
106
|
+
# @option attributes style [Vedeu::Style]
|
107
|
+
# @option attributes show_bottom [Boolean] Indicate whether the bottom
|
108
|
+
# border is to be shown.
|
109
|
+
# @option attributes show_left [Boolean] Indicate whether the left border
|
110
|
+
# is to be shown.
|
111
|
+
# @option attributes show_right [Boolean] Indicate whether the right
|
112
|
+
# border is to be shown.
|
113
|
+
# @option attributes show_top [Boolean] Indicate whether the top border is
|
114
|
+
# to be shown.
|
115
|
+
# @option attributes title [String] An optional title for when the top
|
116
|
+
# border is to be shown.
|
117
|
+
# @option attributes caption [String] An optional caption for when the
|
118
|
+
# bottom border is to be shown.
|
119
|
+
# @option attributes top_left [String] The top left border character.
|
120
|
+
# @option attributes top_right [String] The top right border character.
|
121
|
+
# @option attributes vertical [String] The vertical border character.
|
122
|
+
# @return [Vedeu::Borders::Border]
|
123
|
+
def initialize(attributes = {})
|
124
|
+
@attributes = defaults.merge!(attributes)
|
125
|
+
|
126
|
+
@attributes.each do |key, value|
|
127
|
+
instance_variable_set("@#{key}", value)
|
128
|
+
end
|
129
|
+
end
|
130
|
+
|
131
|
+
# @return [Fixnum]
|
132
|
+
def bx
|
133
|
+
(enabled? && left?) ? x + 1 : x
|
134
|
+
end
|
135
|
+
|
136
|
+
# @return [Fixnum]
|
137
|
+
def bxn
|
138
|
+
(enabled? && right?) ? xn - 1 : xn
|
139
|
+
end
|
140
|
+
|
141
|
+
# @return [Fixnum]
|
142
|
+
def by
|
143
|
+
(enabled? && top?) ? y + 1 : y
|
144
|
+
end
|
145
|
+
|
146
|
+
# @return [Fixnum]
|
147
|
+
def byn
|
148
|
+
(enabled? && bottom?) ? yn - 1 : yn
|
149
|
+
end
|
150
|
+
|
151
|
+
# Returns the width of the interface determined by whether a left, right,
|
152
|
+
# both or neither borders are shown.
|
153
|
+
#
|
154
|
+
# @return [Fixnum]
|
155
|
+
def width
|
156
|
+
(bx..bxn).size
|
157
|
+
end
|
158
|
+
|
159
|
+
# Returns the height of the interface determined by whether a top, bottom,
|
160
|
+
# both or neither borders are shown.
|
161
|
+
#
|
162
|
+
# @return [Fixnum]
|
163
|
+
def height
|
164
|
+
(by..byn).size
|
165
|
+
end
|
166
|
+
|
167
|
+
# @return [Array<Array<Vedeu::Views::Char>>]
|
168
|
+
def render
|
169
|
+
Vedeu::Borders::Render.with(self)
|
170
|
+
end
|
171
|
+
|
172
|
+
private
|
173
|
+
|
174
|
+
# @return [Vedeu::Geometry::Geometry]
|
175
|
+
def geometry
|
176
|
+
Vedeu.geometries.by_name(name)
|
177
|
+
end
|
178
|
+
|
179
|
+
# @return [Vedeu::Interface]
|
180
|
+
def interface
|
181
|
+
@interface ||= Vedeu.interfaces.by_name(name)
|
182
|
+
end
|
183
|
+
alias_method :parent, :interface
|
184
|
+
|
185
|
+
# The default values for a new instance of this class.
|
186
|
+
#
|
187
|
+
# @return [Hash]
|
188
|
+
# @see Vedeu::EscapeSequences::Borders
|
189
|
+
def defaults
|
190
|
+
{
|
191
|
+
bottom_left: Vedeu::EscapeSequences::Borders.bottom_left,
|
192
|
+
bottom_right: Vedeu::EscapeSequences::Borders.bottom_right,
|
193
|
+
caption: '',
|
194
|
+
client: nil,
|
195
|
+
colour: nil,
|
196
|
+
enabled: false,
|
197
|
+
horizontal: Vedeu::EscapeSequences::Borders.horizontal,
|
198
|
+
name: '',
|
199
|
+
repository: Vedeu.borders,
|
200
|
+
show_bottom: true,
|
201
|
+
show_left: true,
|
202
|
+
show_right: true,
|
203
|
+
show_top: true,
|
204
|
+
style: nil,
|
205
|
+
title: '',
|
206
|
+
top_left: Vedeu::EscapeSequences::Borders.top_left,
|
207
|
+
top_right: Vedeu::EscapeSequences::Borders.top_right,
|
208
|
+
vertical: Vedeu::EscapeSequences::Borders.vertical,
|
209
|
+
}
|
210
|
+
end
|
211
|
+
|
212
|
+
end # Border
|
213
|
+
|
214
|
+
end # Borders
|
208
215
|
|
209
216
|
end # Vedeu
|