vedeu 0.4.13 → 0.4.14
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.rubocop.yml +2 -1
- data/.travis.yml +2 -1
- data/Guardfile +6 -5
- data/README.md +3 -30
- data/Rakefile +5 -5
- data/bin/vedeu_drb_client +1 -1
- data/bin/vedeu_drb_server +91 -89
- data/bin/vedeu_test +4 -0
- data/config/rubocop_enabled.yml +5 -10
- data/examples/borders_app.rb +2 -1
- data/examples/colours_app.rb +13 -8
- data/examples/configuration_app.rb +3 -2
- data/examples/cursor_app.rb +16 -11
- data/examples/drb_app.rb +88 -89
- data/examples/focus_app.rb +31 -32
- data/examples/geometry_app.rb +2 -1
- data/examples/hello_world.rb +2 -1
- data/examples/lines_app.rb +2 -1
- data/examples/material_colours_app.rb +126 -0
- data/examples/typed_commands/typed_commands_app.rb +5 -1
- data/examples/view_templates_app/view_templates_app.rb +6 -3
- data/lib/vedeu/all.rb +1 -1
- data/lib/vedeu/api.rb +18 -10
- data/lib/vedeu/application.rb +0 -1
- data/lib/vedeu/bindings.rb +77 -16
- data/lib/vedeu/buffers/all.rb +2 -5
- data/lib/vedeu/buffers/buffer.rb +69 -25
- data/lib/vedeu/buffers/display_buffer.rb +3 -7
- data/lib/vedeu/configuration/all.rb +3 -6
- data/lib/vedeu/configuration/api.rb +28 -4
- data/lib/vedeu/configuration/cli.rb +9 -9
- data/lib/vedeu/configuration/configuration.rb +11 -7
- data/lib/vedeu/cursor/all.rb +3 -6
- data/lib/vedeu/cursor/cursor.rb +22 -14
- data/lib/vedeu/cursor/move.rb +32 -22
- data/lib/vedeu/cursor/refresh_cursor.rb +1 -1
- data/lib/vedeu/debug.rb +2 -1
- data/lib/vedeu/distributed/client.rb +1 -7
- data/lib/vedeu/distributed/server.rb +0 -4
- data/lib/vedeu/distributed/subprocess.rb +1 -1
- data/lib/vedeu/distributed/templates/default_configuration.vedeu +1 -1
- data/lib/vedeu/distributed/test_application.rb +3 -5
- data/lib/vedeu/distributed/uri.rb +2 -2
- data/lib/vedeu/dsl/all.rb +6 -6
- data/lib/vedeu/dsl/components/all.rb +0 -3
- data/lib/vedeu/dsl/components/border.rb +20 -12
- data/lib/vedeu/dsl/components/geometry.rb +68 -3
- data/lib/vedeu/dsl/components/keymap.rb +1 -2
- data/lib/vedeu/dsl/composition.rb +8 -1
- data/lib/vedeu/dsl/interface.rb +61 -11
- data/lib/vedeu/dsl/line.rb +12 -12
- data/lib/vedeu/dsl/shared/all.rb +4 -7
- data/lib/vedeu/dsl/shared/colour.rb +2 -2
- data/lib/vedeu/dsl/shared/text.rb +2 -35
- data/lib/vedeu/dsl/shared/use.rb +2 -2
- data/lib/vedeu/dsl/view.rb +4 -4
- data/lib/vedeu/events/all.rb +3 -5
- data/lib/vedeu/events/event.rb +5 -5
- data/lib/vedeu/geometry/all.rb +11 -16
- data/lib/vedeu/geometry/area.rb +2 -5
- data/lib/vedeu/geometry/canvas.rb +12 -16
- data/lib/vedeu/geometry/dimension.rb +20 -22
- data/lib/vedeu/geometry/geometry.rb +28 -30
- data/lib/vedeu/geometry/grid.rb +1 -1
- data/lib/vedeu/geometry/index_position.rb +7 -0
- data/lib/vedeu/geometry/null_geometry.rb +61 -0
- data/lib/vedeu/geometry/position.rb +0 -3
- data/lib/vedeu/geometry/position_index.rb +7 -0
- data/lib/vedeu/geometry/position_validator.rb +44 -33
- data/lib/vedeu/input/all.rb +5 -4
- data/lib/vedeu/input/keymap.rb +0 -1
- data/lib/vedeu/input/mapper.rb +1 -3
- data/lib/vedeu/launcher.rb +6 -7
- data/lib/vedeu/main_loop.rb +1 -2
- data/lib/vedeu/models/all.rb +1 -0
- data/lib/vedeu/models/cell.rb +5 -8
- data/lib/vedeu/models/char.rb +50 -15
- data/lib/vedeu/models/composition.rb +8 -1
- data/lib/vedeu/models/focus.rb +4 -4
- data/lib/vedeu/models/group.rb +3 -3
- data/lib/vedeu/models/interface.rb +62 -46
- data/lib/vedeu/models/line.rb +1 -1
- data/lib/vedeu/models/null.rb +48 -0
- data/lib/vedeu/models/stream.rb +5 -5
- data/lib/vedeu/output/all.rb +20 -30
- data/lib/vedeu/output/border.rb +93 -40
- data/lib/vedeu/output/clear.rb +100 -15
- data/lib/vedeu/output/colour.rb +56 -12
- data/lib/vedeu/output/compressor.rb +59 -0
- data/lib/vedeu/output/html_char.rb +4 -2
- data/lib/vedeu/output/null_border.rb +16 -4
- data/lib/vedeu/output/output.rb +13 -21
- data/lib/vedeu/output/presentation.rb +28 -23
- data/lib/vedeu/output/refresh.rb +2 -2
- data/lib/vedeu/output/renderers/all.rb +80 -3
- data/lib/vedeu/output/renderers/file_renderer.rb +38 -2
- data/lib/vedeu/output/renderers/html_renderer.rb +6 -4
- data/lib/vedeu/output/renderers/json_renderer.rb +52 -0
- data/lib/vedeu/output/renderers/null_renderer.rb +14 -0
- data/lib/vedeu/output/renderers/terminal_renderer.rb +2 -12
- data/lib/vedeu/output/style.rb +33 -3
- data/lib/vedeu/output/text.rb +98 -1
- data/lib/vedeu/output/translator.rb +30 -7
- data/lib/vedeu/output/viewport.rb +43 -79
- data/lib/vedeu/output/wordwrap.rb +4 -4
- data/lib/vedeu/repositories/all.rb +22 -179
- data/lib/vedeu/repositories/collection.rb +11 -13
- data/lib/vedeu/repositories/collections/all.rb +8 -0
- data/lib/vedeu/repositories/collections/chars.rb +9 -0
- data/lib/vedeu/repositories/collections/events.rb +9 -0
- data/lib/vedeu/repositories/collections/interfaces.rb +9 -0
- data/lib/vedeu/repositories/collections/keys.rb +9 -0
- data/lib/vedeu/repositories/collections/lines.rb +9 -0
- data/lib/vedeu/repositories/collections/streams.rb +9 -0
- data/lib/vedeu/repositories/model.rb +7 -2
- data/lib/vedeu/repositories/repositories/all.rb +14 -0
- data/lib/vedeu/repositories/repositories/background_colours.rb +14 -0
- data/lib/vedeu/repositories/repositories/borders.rb +38 -0
- data/lib/vedeu/repositories/repositories/buffers.rb +36 -0
- data/lib/vedeu/repositories/repositories/colours.rb +63 -0
- data/lib/vedeu/repositories/repositories/cursors.rb +29 -0
- data/lib/vedeu/repositories/repositories/events_repository.rb +24 -0
- data/lib/vedeu/repositories/repositories/foreground_colours.rb +14 -0
- data/lib/vedeu/repositories/repositories/geometries.rb +37 -0
- data/lib/vedeu/repositories/repositories/groups.rb +24 -0
- data/lib/vedeu/repositories/repositories/interfaces_repository.rb +24 -0
- data/lib/vedeu/repositories/repositories/keymaps.rb +24 -0
- data/lib/vedeu/repositories/repositories/menus.rb +24 -0
- data/lib/vedeu/repositories/repository.rb +29 -47
- data/lib/vedeu/storage/all.rb +6 -0
- data/lib/vedeu/storage/associative_store.rb +47 -0
- data/lib/vedeu/storage/conveyor_store.rb +69 -0
- data/lib/vedeu/storage/fifo_store.rb +37 -0
- data/lib/vedeu/storage/store.rb +58 -0
- data/lib/vedeu/support/all.rb +5 -10
- data/lib/vedeu/support/common.rb +0 -8
- data/lib/vedeu/support/log.rb +13 -24
- data/lib/vedeu/support/template.rb +4 -1
- data/lib/vedeu/support/terminal.rb +10 -10
- data/lib/vedeu/support/trace.rb +15 -88
- data/lib/vedeu/support/visibility.rb +73 -0
- data/lib/vedeu.rb +37 -0
- data/test/lib/vedeu/api_test.rb +7 -3
- data/test/lib/vedeu/application_test.rb +9 -3
- data/test/lib/vedeu/bindings_test.rb +21 -0
- data/test/lib/vedeu/buffers/buffer_test.rb +110 -134
- data/test/lib/vedeu/buffers/display_buffer_test.rb +8 -0
- data/test/lib/vedeu/configuration/api_test.rb +5 -1
- data/test/lib/vedeu/configuration/configuration_test.rb +4 -6
- data/test/lib/vedeu/cursor/cursor_test.rb +25 -17
- data/test/lib/vedeu/cursor/move_test.rb +7 -7
- data/test/lib/vedeu/distributed/client_test.rb +1 -1
- data/test/lib/vedeu/distributed/subprocess_test.rb +3 -1
- data/test/lib/vedeu/distributed/uri_test.rb +5 -5
- data/test/lib/vedeu/dsl/components/geometry_test.rb +43 -0
- data/test/lib/vedeu/dsl/components/keymap_test.rb +1 -1
- data/test/lib/vedeu/dsl/composition_test.rb +6 -5
- data/test/lib/vedeu/dsl/interface_test.rb +81 -16
- data/test/lib/vedeu/dsl/shared/colour_test.rb +4 -4
- data/test/lib/vedeu/dsl/shared/text_test.rb +87 -9
- data/test/lib/vedeu/dsl/stream_test.rb +1 -1
- data/test/lib/vedeu/events/event_test.rb +3 -1
- data/test/lib/vedeu/events/trigger_test.rb +8 -4
- data/test/lib/vedeu/geometry/dimension_test.rb +1 -1
- data/test/lib/vedeu/geometry/geometry_test.rb +5 -3
- data/test/lib/vedeu/geometry/index_position_test.rb +30 -7
- data/test/lib/vedeu/geometry/null_geometry_test.rb +57 -0
- data/test/lib/vedeu/geometry/position_index_test.rb +14 -0
- data/test/lib/vedeu/geometry/position_validator_test.rb +17 -3
- data/test/lib/vedeu/input/keymap_test.rb +3 -1
- data/test/lib/vedeu/input/mapper_test.rb +8 -4
- data/test/lib/vedeu/launcher_test.rb +1 -1
- data/test/lib/vedeu/models/cell_test.rb +10 -8
- data/test/lib/vedeu/models/char_test.rb +52 -28
- data/test/lib/vedeu/models/composition_test.rb +26 -4
- data/test/lib/vedeu/models/group_test.rb +11 -5
- data/test/lib/vedeu/models/interface_test.rb +32 -19
- data/test/lib/vedeu/models/line_test.rb +21 -25
- data/test/lib/vedeu/models/menu_test.rb +10 -6
- data/test/lib/vedeu/models/null_test.rb +66 -0
- data/test/lib/vedeu/models/stream_test.rb +13 -10
- data/test/lib/vedeu/output/border_test.rb +29 -8
- data/test/lib/vedeu/output/clear_test.rb +23 -4
- data/test/lib/vedeu/output/colour_test.rb +20 -4
- data/test/lib/vedeu/output/compressor_test.rb +43 -0
- data/test/lib/vedeu/output/html_char_test.rb +29 -17
- data/test/lib/vedeu/output/null_border_test.rb +2 -1
- data/test/lib/vedeu/output/output_test.rb +20 -30
- data/test/lib/vedeu/output/presentation_test.rb +39 -16
- data/test/lib/vedeu/output/refresh_test.rb +14 -10
- data/test/lib/vedeu/output/renderers/all_test.rb +96 -0
- data/test/lib/vedeu/output/renderers/file_renderer_test.rb +1 -1
- data/test/lib/vedeu/output/renderers/html_renderer_test.rb +13 -9
- data/test/lib/vedeu/output/renderers/json_renderer_test.rb +52 -0
- data/test/lib/vedeu/output/renderers/null_renderer_test.rb +19 -0
- data/test/lib/vedeu/output/style_test.rb +41 -1
- data/test/lib/vedeu/output/text_test.rb +61 -10
- data/test/lib/vedeu/output/translator_test.rb +14 -0
- data/test/lib/vedeu/output/viewport_test.rb +22 -3
- data/test/lib/vedeu/output/virtual_terminal_test.rb +3 -3
- data/test/lib/vedeu/output/wordwrap_test.rb +58 -45
- data/test/lib/vedeu/repositories/collections/chars_test.rb +16 -0
- data/test/lib/vedeu/repositories/collections/events_test.rb +16 -0
- data/test/lib/vedeu/repositories/collections/interfaces_test.rb +16 -0
- data/test/lib/vedeu/repositories/collections/keys_test.rb +16 -0
- data/test/lib/vedeu/repositories/collections/lines_test.rb +16 -0
- data/test/lib/vedeu/repositories/collections/streams_test.rb +16 -0
- data/test/lib/vedeu/repositories/repositories/background_colours_test.rb +17 -0
- data/test/lib/vedeu/repositories/repositories/borders_test.rb +51 -0
- data/test/lib/vedeu/repositories/repositories/buffers_test.rb +52 -0
- data/test/lib/vedeu/repositories/repositories/colours_test.rb +16 -0
- data/test/lib/vedeu/repositories/repositories/cursors_test.rb +39 -0
- data/test/lib/vedeu/repositories/repositories/events_repository_test.rb +17 -0
- data/test/lib/vedeu/repositories/repositories/foreground_colours_test.rb +17 -0
- data/test/lib/vedeu/repositories/repositories/geometries_test.rb +42 -0
- data/test/lib/vedeu/repositories/repositories/groups_test.rb +17 -0
- data/test/lib/vedeu/repositories/repositories/interfaces_repositories_test.rb +17 -0
- data/test/lib/vedeu/repositories/repositories/keymaps_test.rb +17 -0
- data/test/lib/vedeu/repositories/repositories/menus_test.rb +17 -0
- data/test/lib/vedeu/repositories/repository_test.rb +16 -36
- data/test/lib/vedeu/storage/associative_store_test.rb +69 -0
- data/test/lib/vedeu/storage/conveyor_store_test.rb +135 -0
- data/test/lib/vedeu/storage/fifo_store_test.rb +47 -0
- data/test/lib/vedeu/storage/store_test.rb +123 -0
- data/test/lib/vedeu/support/common_test.rb +0 -9
- data/test/lib/vedeu/support/terminal_test.rb +78 -55
- data/test/lib/vedeu/support/visibility_test.rb +80 -0
- data/test/test_helper.rb +13 -11
- data/vedeu.gemspec +4 -3
- metadata +92 -32
- data/lib/vedeu/cursor/toggle.rb +0 -55
- data/lib/vedeu/exceptions.rb +0 -37
- data/lib/vedeu/geometry/centre.rb +0 -85
- data/lib/vedeu/geometry/content.rb +0 -70
- data/lib/vedeu/geometry/limit.rb +0 -58
- data/lib/vedeu/output/compositor.rb +0 -62
- data/lib/vedeu/repositories/collections.rb +0 -41
- data/lib/vedeu/support/coercions.rb +0 -60
- data/lib/vedeu/support/sentence.rb +0 -91
- data/lib/vedeu/support/visible.rb +0 -90
- data/test/lib/vedeu/cursor/toggle_test.rb +0 -63
- data/test/lib/vedeu/geometry/centre_test.rb +0 -58
- data/test/lib/vedeu/geometry/content_test.rb +0 -98
- data/test/lib/vedeu/geometry/limit_test.rb +0 -30
- data/test/lib/vedeu/output/compositor_test.rb +0 -48
- data/test/lib/vedeu/repositories/all_test.rb +0 -135
- data/test/lib/vedeu/repositories/collections_test.rb +0 -71
- data/test/lib/vedeu/support/coercions_test.rb +0 -84
- data/test/lib/vedeu/support/sentence_test.rb +0 -56
- data/test/lib/vedeu/support/visible_test.rb +0 -161
data/lib/vedeu/models/char.rb
CHANGED
@@ -23,9 +23,9 @@ module Vedeu
|
|
23
23
|
# @return [Vedeu::Line]
|
24
24
|
attr_accessor :parent
|
25
25
|
|
26
|
-
# @!attribute [
|
26
|
+
# @!attribute [w] value
|
27
27
|
# @return [String]
|
28
|
-
|
28
|
+
attr_writer :value
|
29
29
|
|
30
30
|
# Returns a new instance of Vedeu::Char.
|
31
31
|
#
|
@@ -68,7 +68,7 @@ module Vedeu
|
|
68
68
|
|
69
69
|
# @return [String]
|
70
70
|
def inspect
|
71
|
-
"<Vedeu::Char '#{Vedeu::Esc.escape(
|
71
|
+
"<Vedeu::Char '#{Vedeu::Esc.escape(to_s)}'>"
|
72
72
|
end
|
73
73
|
|
74
74
|
# @return [Vedeu::Position]
|
@@ -84,6 +84,17 @@ module Vedeu
|
|
84
84
|
@position = Vedeu::Position.coerce(value)
|
85
85
|
end
|
86
86
|
|
87
|
+
# @return [String]
|
88
|
+
def value
|
89
|
+
if border
|
90
|
+
Vedeu::Esc.border { @value }
|
91
|
+
|
92
|
+
else
|
93
|
+
@value
|
94
|
+
|
95
|
+
end
|
96
|
+
end
|
97
|
+
|
87
98
|
# Returns the x position for the Char if set.
|
88
99
|
#
|
89
100
|
# @return [Fixnum|NilClass]
|
@@ -107,18 +118,12 @@ module Vedeu
|
|
107
118
|
# @return [Hash]
|
108
119
|
def to_hash
|
109
120
|
{
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
border: border.to_s,
|
117
|
-
foreground: foreground.to_s,
|
118
|
-
style: style.to_s,
|
119
|
-
value: value,
|
120
|
-
x: x,
|
121
|
-
y: y,
|
121
|
+
border: border.to_s,
|
122
|
+
colour: colour_to_hash,
|
123
|
+
parent: parent_to_hash,
|
124
|
+
position: position_to_hash,
|
125
|
+
style: style.to_s,
|
126
|
+
value: value,
|
122
127
|
}
|
123
128
|
end
|
124
129
|
|
@@ -127,12 +132,25 @@ module Vedeu
|
|
127
132
|
@to_html ||= Vedeu::HTMLChar.render(self)
|
128
133
|
end
|
129
134
|
|
135
|
+
# @return [String]
|
136
|
+
def to_json
|
137
|
+
@to_json ||= JSON.generate(to_hash)
|
138
|
+
end
|
139
|
+
|
130
140
|
private
|
131
141
|
|
132
142
|
# @!attribute [r] attributes
|
133
143
|
# @return [Hash]
|
134
144
|
attr_reader :attributes
|
135
145
|
|
146
|
+
# @return [Hash]
|
147
|
+
def colour_to_hash
|
148
|
+
{
|
149
|
+
background: background.to_s,
|
150
|
+
foreground: foreground.to_s,
|
151
|
+
}
|
152
|
+
end
|
153
|
+
|
136
154
|
# The default values for a new instance of this class.
|
137
155
|
#
|
138
156
|
# @return [Hash]
|
@@ -147,6 +165,23 @@ module Vedeu
|
|
147
165
|
}
|
148
166
|
end
|
149
167
|
|
168
|
+
# @return [Hash]
|
169
|
+
def parent_to_hash
|
170
|
+
{
|
171
|
+
background: parent_background.to_s,
|
172
|
+
foreground: parent_foreground.to_s,
|
173
|
+
style: parent_style.to_s,
|
174
|
+
}
|
175
|
+
end
|
176
|
+
|
177
|
+
# @return [Hash]
|
178
|
+
def position_to_hash
|
179
|
+
{
|
180
|
+
y: y,
|
181
|
+
x: x,
|
182
|
+
}
|
183
|
+
end
|
184
|
+
|
150
185
|
end # Char
|
151
186
|
|
152
187
|
end # Vedeu
|
@@ -32,7 +32,7 @@ module Vedeu
|
|
32
32
|
end
|
33
33
|
|
34
34
|
# @param child [Vedeu::Interface]
|
35
|
-
# @return [
|
35
|
+
# @return [Vedeu::Interfaces]
|
36
36
|
def add(child)
|
37
37
|
@interfaces = interfaces.add(child)
|
38
38
|
end
|
@@ -43,6 +43,13 @@ module Vedeu
|
|
43
43
|
end
|
44
44
|
alias_method :value, :interfaces
|
45
45
|
|
46
|
+
# Composition objects do not have a parent.
|
47
|
+
#
|
48
|
+
# @return [NilClass]
|
49
|
+
def parent
|
50
|
+
nil
|
51
|
+
end
|
52
|
+
|
46
53
|
private
|
47
54
|
|
48
55
|
# The default values for a new instance of this class.
|
data/lib/vedeu/models/focus.rb
CHANGED
@@ -42,7 +42,7 @@ module Vedeu
|
|
42
42
|
# @return [String] The name of the interface now in focus.
|
43
43
|
def by_name(name)
|
44
44
|
fail ModelNotFound, "Cannot focus '#{name}' as this interface has not " \
|
45
|
-
|
45
|
+
'been registered.' unless registered?(name)
|
46
46
|
|
47
47
|
storage.rotate!(storage.index(name))
|
48
48
|
|
@@ -82,7 +82,7 @@ module Vedeu
|
|
82
82
|
|
83
83
|
update
|
84
84
|
end
|
85
|
-
alias_method :next,
|
85
|
+
alias_method :next, :next_item
|
86
86
|
alias_method :focus_next, :next_item
|
87
87
|
|
88
88
|
# Put the previous interface relative to the current interface in focus.
|
@@ -93,8 +93,8 @@ module Vedeu
|
|
93
93
|
|
94
94
|
update
|
95
95
|
end
|
96
|
-
alias_method :prev,
|
97
|
-
alias_method :previous,
|
96
|
+
alias_method :prev, :prev_item
|
97
|
+
alias_method :previous, :prev_item
|
98
98
|
alias_method :focus_previous, :prev_item
|
99
99
|
|
100
100
|
# Refresh the interface in focus.
|
data/lib/vedeu/models/group.rb
CHANGED
@@ -37,7 +37,7 @@ module Vedeu
|
|
37
37
|
def add(member)
|
38
38
|
@members = members.add(member)
|
39
39
|
|
40
|
-
Vedeu::Group.new(
|
40
|
+
Vedeu::Group.new(name: name, members: @members).store
|
41
41
|
end
|
42
42
|
|
43
43
|
# Return the members as a Set.
|
@@ -54,14 +54,14 @@ module Vedeu
|
|
54
54
|
def remove(member)
|
55
55
|
@members = members.delete(member)
|
56
56
|
|
57
|
-
Vedeu::Group.new(
|
57
|
+
Vedeu::Group.new(name: name, members: @members).store
|
58
58
|
end
|
59
59
|
|
60
60
|
# Remove all members from the group.
|
61
61
|
#
|
62
62
|
# @return [Group]
|
63
63
|
def reset
|
64
|
-
Vedeu::Group.new(defaults.merge!(
|
64
|
+
Vedeu::Group.new(defaults.merge!(name: name)).store
|
65
65
|
end
|
66
66
|
|
67
67
|
private
|
@@ -1,4 +1,3 @@
|
|
1
|
-
require 'vedeu/geometry/content'
|
2
1
|
require 'vedeu/models/all'
|
3
2
|
require 'vedeu/output/null_border'
|
4
3
|
require 'vedeu/output/presentation'
|
@@ -22,10 +21,6 @@ module Vedeu
|
|
22
21
|
collection Vedeu::Lines
|
23
22
|
member Vedeu::Line
|
24
23
|
|
25
|
-
# @!attribute [rw] colour
|
26
|
-
# @return [void]
|
27
|
-
attr_accessor :colour
|
28
|
-
|
29
24
|
# @!attribute [rw] delay
|
30
25
|
# @return [Fixnum|Float]
|
31
26
|
attr_accessor :delay
|
@@ -42,33 +37,34 @@ module Vedeu
|
|
42
37
|
# @return [Vedeu::Composition]
|
43
38
|
attr_accessor :parent
|
44
39
|
|
45
|
-
# @!attribute [rw]
|
40
|
+
# @!attribute [rw] visible
|
46
41
|
# @return [String|Symbol]
|
47
|
-
attr_accessor :
|
42
|
+
attr_accessor :visible
|
43
|
+
alias_method :visible?, :visible
|
48
44
|
|
49
45
|
# @!attribute [w] lines
|
50
46
|
# @return [Array<Vedeu::Line>]
|
51
47
|
attr_writer :lines
|
52
48
|
|
53
49
|
def_delegators :geometry,
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
50
|
+
:north,
|
51
|
+
:east,
|
52
|
+
:south,
|
53
|
+
:west,
|
54
|
+
:top,
|
55
|
+
:right,
|
56
|
+
:bottom,
|
57
|
+
:left,
|
58
|
+
:y,
|
59
|
+
:yn,
|
60
|
+
:x,
|
61
|
+
:xn,
|
62
|
+
:width,
|
63
|
+
:height,
|
64
|
+
:top_left,
|
65
|
+
:top_right,
|
66
|
+
:bottom_left,
|
67
|
+
:bottom_right
|
72
68
|
|
73
69
|
# Return a new instance of Vedeu::Interface.
|
74
70
|
#
|
@@ -80,6 +76,7 @@ module Vedeu
|
|
80
76
|
# @option attributes name [String]
|
81
77
|
# @option attributes parent [Vedeu::Composition]
|
82
78
|
# @option attributes style [Vedeu::Style]
|
79
|
+
# @option attributes visible [Boolean]
|
83
80
|
# @return [Vedeu::Interface]
|
84
81
|
def initialize(attributes = {})
|
85
82
|
@attributes = defaults.merge!(attributes)
|
@@ -92,6 +89,7 @@ module Vedeu
|
|
92
89
|
@parent = @attributes[:parent]
|
93
90
|
@repository = Vedeu.interfaces
|
94
91
|
@style = @attributes[:style]
|
92
|
+
@visible = @attributes[:visible]
|
95
93
|
end
|
96
94
|
|
97
95
|
# @param child []
|
@@ -106,12 +104,13 @@ module Vedeu
|
|
106
104
|
# @return [Hash]
|
107
105
|
def attributes
|
108
106
|
{
|
109
|
-
colour:
|
110
|
-
delay:
|
111
|
-
group:
|
112
|
-
name:
|
113
|
-
parent:
|
114
|
-
style:
|
107
|
+
colour: colour,
|
108
|
+
delay: delay,
|
109
|
+
group: group,
|
110
|
+
name: name,
|
111
|
+
parent: parent,
|
112
|
+
style: style,
|
113
|
+
visible: true,
|
115
114
|
}
|
116
115
|
end
|
117
116
|
|
@@ -126,18 +125,12 @@ module Vedeu
|
|
126
125
|
#
|
127
126
|
# @return [Vedeu::Border|NilClass]
|
128
127
|
def border
|
129
|
-
@border ||=
|
130
|
-
Vedeu.borders.find(name)
|
131
|
-
|
132
|
-
else
|
133
|
-
Vedeu::NullBorder.new(self)
|
134
|
-
|
135
|
-
end
|
128
|
+
@border ||= Vedeu.borders.by_name(name)
|
136
129
|
end
|
137
130
|
|
138
131
|
# @return [Array<Array<Vedeu::Char>>]
|
139
132
|
def clear
|
140
|
-
Vedeu::Clear.
|
133
|
+
Vedeu::Clear.new(self)
|
141
134
|
end
|
142
135
|
|
143
136
|
# Fetch the cursor belonging to this interface (by name), if one does not
|
@@ -150,7 +143,7 @@ module Vedeu
|
|
150
143
|
|
151
144
|
# @return [Vedeu::Geometry]
|
152
145
|
def geometry
|
153
|
-
@geometry ||= Vedeu.geometries.
|
146
|
+
@geometry ||= Vedeu.geometries.by_name(name)
|
154
147
|
end
|
155
148
|
|
156
149
|
# @return [Vedeu::Lines]
|
@@ -171,11 +164,19 @@ module Vedeu
|
|
171
164
|
|
172
165
|
# @return [Array<Array<Vedeu::Char>>]
|
173
166
|
def render
|
174
|
-
|
175
|
-
|
176
|
-
|
177
|
-
|
178
|
-
|
167
|
+
if visible?
|
168
|
+
[
|
169
|
+
hide_cursor,
|
170
|
+
clear.render,
|
171
|
+
border.render,
|
172
|
+
viewport.render,
|
173
|
+
show_cursor,
|
174
|
+
]
|
175
|
+
|
176
|
+
else
|
177
|
+
[]
|
178
|
+
|
179
|
+
end
|
179
180
|
end
|
180
181
|
|
181
182
|
# @return [Interface]
|
@@ -190,7 +191,7 @@ module Vedeu
|
|
190
191
|
|
191
192
|
# @return [Array<Array<Vedeu::Char>>]
|
192
193
|
def viewport
|
193
|
-
Vedeu::Viewport.
|
194
|
+
Vedeu::Viewport.new(self)
|
194
195
|
end
|
195
196
|
|
196
197
|
private
|
@@ -208,9 +209,24 @@ module Vedeu
|
|
208
209
|
name: '',
|
209
210
|
parent: nil,
|
210
211
|
style: nil,
|
212
|
+
visible: true,
|
211
213
|
}
|
212
214
|
end
|
213
215
|
|
216
|
+
# @return [String]
|
217
|
+
def hide_cursor
|
218
|
+
return Vedeu::Esc.string(:hide_cursor) if cursor.visible?
|
219
|
+
|
220
|
+
''
|
221
|
+
end
|
222
|
+
|
223
|
+
# @return [String]
|
224
|
+
def show_cursor
|
225
|
+
return Vedeu::Esc.string(:show_cursor) if cursor.visible?
|
226
|
+
|
227
|
+
''
|
228
|
+
end
|
229
|
+
|
214
230
|
end # Interface
|
215
231
|
|
216
232
|
end # Vedeu
|
data/lib/vedeu/models/line.rb
CHANGED
@@ -0,0 +1,48 @@
|
|
1
|
+
module Vedeu
|
2
|
+
|
3
|
+
# Represents a empty model.
|
4
|
+
#
|
5
|
+
class Null
|
6
|
+
|
7
|
+
# @return [Vedeu::Null]
|
8
|
+
def initialize; end
|
9
|
+
|
10
|
+
# @return [NilClass]
|
11
|
+
def add(*)
|
12
|
+
nil
|
13
|
+
end
|
14
|
+
|
15
|
+
# @return [NilClass]
|
16
|
+
def colour
|
17
|
+
nil
|
18
|
+
end
|
19
|
+
|
20
|
+
# @return [NilClass]
|
21
|
+
def parent
|
22
|
+
nil
|
23
|
+
end
|
24
|
+
|
25
|
+
# @return [Vedeu::Null]
|
26
|
+
def store
|
27
|
+
self
|
28
|
+
end
|
29
|
+
|
30
|
+
# @return [NilClass]
|
31
|
+
def style
|
32
|
+
nil
|
33
|
+
end
|
34
|
+
|
35
|
+
# @return [FalseClass]
|
36
|
+
def visible?
|
37
|
+
false
|
38
|
+
end
|
39
|
+
alias_method :visible, :visible?
|
40
|
+
|
41
|
+
# @return [FalseClass]
|
42
|
+
def visible=(*)
|
43
|
+
false
|
44
|
+
end
|
45
|
+
|
46
|
+
end # Null
|
47
|
+
|
48
|
+
end # Vedeu
|
data/lib/vedeu/models/stream.rb
CHANGED
@@ -59,11 +59,11 @@ module Vedeu
|
|
59
59
|
return [] if value.empty?
|
60
60
|
|
61
61
|
value.chars.map do |char|
|
62
|
-
member.new(
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
62
|
+
member.new(value: char,
|
63
|
+
parent: parent,
|
64
|
+
colour: colour,
|
65
|
+
style: style,
|
66
|
+
position: nil)
|
67
67
|
end
|
68
68
|
end
|
69
69
|
|
data/lib/vedeu/output/all.rb
CHANGED
@@ -1,30 +1,20 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
require 'vedeu/output/renderers/all'
|
22
|
-
|
23
|
-
require 'vedeu/output/output'
|
24
|
-
|
25
|
-
require 'vedeu/output/viewport'
|
26
|
-
require 'vedeu/output/virtual_terminal'
|
27
|
-
require 'vedeu/output/wordwrap'
|
28
|
-
|
29
|
-
module Vedeu
|
30
|
-
end # Vedeu
|
1
|
+
require_relative 'esc'
|
2
|
+
require_relative 'translator'
|
3
|
+
require_relative 'background'
|
4
|
+
require_relative 'foreground'
|
5
|
+
require_relative 'border'
|
6
|
+
require_relative 'null_border'
|
7
|
+
require_relative 'colour'
|
8
|
+
require_relative 'compressor'
|
9
|
+
require_relative 'clear'
|
10
|
+
require_relative 'presentation'
|
11
|
+
require_relative 'style'
|
12
|
+
require_relative 'text'
|
13
|
+
require_relative 'virtual_buffer'
|
14
|
+
require_relative 'html_char'
|
15
|
+
require_relative 'refresh'
|
16
|
+
require_relative 'renderers/all'
|
17
|
+
require_relative 'output'
|
18
|
+
require_relative 'viewport'
|
19
|
+
require_relative 'virtual_terminal'
|
20
|
+
require_relative 'wordwrap'
|