vedeu 0.6.20 → 0.6.21
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.yardopts +1 -1
- data/README.md +4 -0
- data/Rakefile +13 -0
- data/bin/vedeu_drb_server +6 -6
- data/docs/api.md +14 -0
- data/docs/dsl.md +12 -12
- data/docs/events/document.md +4 -2
- data/docs/events/drb.md +4 -0
- data/docs/events/focus.md +2 -0
- data/docs/events/menu.md +2 -0
- data/docs/events/movement.md +7 -5
- data/docs/events/refresh.md +2 -0
- data/docs/events/system.md +5 -0
- data/docs/events/view.md +2 -0
- data/docs/events/visibility.md +2 -0
- data/lib/vedeu.rb +0 -23
- data/lib/vedeu/all.rb +2 -4
- data/lib/vedeu/application/application_view.rb +1 -1
- data/lib/vedeu/borders/all.rb +3 -3
- data/lib/vedeu/borders/border.rb +2 -2
- data/lib/vedeu/borders/dsl.rb +21 -27
- data/lib/vedeu/borders/null.rb +2 -15
- data/lib/vedeu/borders/render.rb +1 -1
- data/lib/vedeu/borders/repository.rb +9 -0
- data/lib/vedeu/buffers/buffer.rb +2 -2
- data/lib/vedeu/buffers/null.rb +1 -31
- data/lib/vedeu/buffers/refresh.rb +8 -8
- data/lib/vedeu/buffers/repository.rb +9 -0
- data/lib/vedeu/colours/backgrounds.rb +9 -0
- data/lib/vedeu/colours/colour.rb +1 -1
- data/lib/vedeu/colours/foregrounds.rb +9 -0
- data/lib/vedeu/common.rb +22 -13
- data/lib/vedeu/configuration/configuration.rb +6 -0
- data/lib/vedeu/cursors/cursor.rb +13 -8
- data/lib/vedeu/cursors/refresh.rb +2 -2
- data/lib/vedeu/cursors/repository.rb +18 -1
- data/lib/vedeu/distributed/server.rb +23 -0
- data/lib/vedeu/distributed/templates/default_borders.vedeu +1 -1
- data/lib/vedeu/distributed/templates/default_geometries.vedeu +1 -1
- data/lib/vedeu/distributed/templates/default_interfaces.vedeu +1 -1
- data/lib/vedeu/distributed/templates/default_keymaps.vedeu +1 -1
- data/lib/vedeu/distributed/templates/default_menus.vedeu +1 -1
- data/lib/vedeu/distributed/templates/default_views.vedeu +1 -1
- data/lib/vedeu/dsl/composition.rb +7 -17
- data/lib/vedeu/dsl/dsl.rb +12 -0
- data/lib/vedeu/dsl/interface.rb +32 -33
- data/lib/vedeu/dsl/keymap.rb +13 -19
- data/lib/vedeu/dsl/line.rb +3 -13
- data/lib/vedeu/dsl/shared.rb +5 -5
- data/lib/vedeu/dsl/stream.rb +0 -10
- data/lib/vedeu/dsl/use.rb +6 -6
- data/lib/vedeu/dsl/view.rb +17 -19
- data/lib/vedeu/editor/cursor.rb +32 -10
- data/lib/vedeu/editor/document.rb +33 -35
- data/lib/vedeu/editor/editor.rb +3 -4
- data/lib/vedeu/editor/insert.rb +1 -1
- data/lib/vedeu/editor/line.rb +1 -8
- data/lib/vedeu/editor/lines.rb +1 -1
- data/lib/vedeu/editor/repository.rb +9 -0
- data/lib/vedeu/esc/esc.rb +2 -1
- data/lib/vedeu/events/aliases.rb +8 -1
- data/lib/vedeu/events/event.rb +8 -0
- data/lib/vedeu/events/repository.rb +9 -0
- data/lib/vedeu/events/trigger.rb +9 -5
- data/lib/vedeu/geometry/coordinate.rb +2 -2
- data/lib/vedeu/geometry/dsl.rb +32 -38
- data/lib/vedeu/geometry/generic_coordinate.rb +1 -1
- data/lib/vedeu/geometry/geometry.rb +3 -3
- data/lib/vedeu/geometry/null.rb +2 -24
- data/lib/vedeu/geometry/repository.rb +9 -0
- data/lib/vedeu/groups/clear.rb +7 -3
- data/lib/vedeu/groups/dsl.rb +29 -35
- data/lib/vedeu/groups/group.rb +28 -4
- data/lib/vedeu/groups/refresh.rb +3 -2
- data/lib/vedeu/groups/repository.rb +9 -0
- data/lib/vedeu/input/capture.rb +1 -1
- data/lib/vedeu/input/keymap.rb +2 -1
- data/lib/vedeu/input/keymaps.rb +9 -0
- data/lib/vedeu/input/mapper.rb +4 -0
- data/lib/vedeu/input/translator.rb +1 -1
- data/lib/vedeu/logging/debug.rb +13 -0
- data/lib/vedeu/logging/log.rb +8 -0
- data/lib/vedeu/logging/timer.rb +13 -0
- data/lib/vedeu/menus/dsl.rb +8 -18
- data/lib/vedeu/menus/menu.rb +8 -4
- data/lib/vedeu/menus/null.rb +1 -1
- data/lib/vedeu/menus/repository.rb +9 -0
- data/lib/vedeu/models/cell.rb +5 -0
- data/lib/vedeu/models/escape.rb +5 -0
- data/lib/vedeu/models/focus.rb +20 -5
- data/lib/vedeu/models/interface.rb +10 -1
- data/lib/vedeu/models/interfaces.rb +9 -0
- data/lib/vedeu/models/toggleable.rb +19 -4
- data/lib/vedeu/models/views/char.rb +6 -1
- data/lib/vedeu/models/views/html_char.rb +1 -4
- data/lib/vedeu/models/views/line.rb +1 -1
- data/lib/vedeu/models/views/view.rb +1 -1
- data/lib/vedeu/null/generic.rb +14 -2
- data/lib/vedeu/null/interface.rb +1 -1
- data/lib/vedeu/null/view.rb +1 -1
- data/lib/vedeu/output/clear/interface.rb +5 -1
- data/lib/vedeu/output/compressor.rb +8 -4
- data/lib/vedeu/output/direct.rb +4 -4
- data/lib/vedeu/output/presentation/all.rb +15 -0
- data/lib/vedeu/output/presentation/presentation.rb +0 -7
- data/lib/vedeu/output/refresh/refresh.rb +1 -3
- data/lib/vedeu/output/renderers/all.rb +10 -0
- data/lib/vedeu/output/renderers/terminal.rb +1 -3
- data/lib/vedeu/repositories/collection.rb +3 -3
- data/lib/vedeu/repositories/model.rb +1 -1
- data/lib/vedeu/repositories/repository.rb +8 -8
- data/lib/vedeu/repositories/store.rb +3 -2
- data/lib/vedeu/runtime/application.rb +4 -0
- data/lib/vedeu/runtime/bootstrap.rb +1 -1
- data/lib/vedeu/runtime/flags.rb +7 -0
- data/lib/vedeu/runtime/main_loop.rb +2 -0
- data/lib/vedeu/runtime/router.rb +4 -0
- data/lib/vedeu/templating/decoder.rb +1 -1
- data/lib/vedeu/templating/encoder.rb +1 -1
- data/lib/vedeu/templating/helpers.rb +2 -0
- data/lib/vedeu/templating/template.rb +1 -1
- data/lib/vedeu/terminal/buffer.rb +7 -0
- data/lib/vedeu/terminal/terminal.rb +8 -0
- data/lib/vedeu/version.rb +1 -1
- data/test/lib/vedeu/borders/dsl_test.rb +0 -6
- data/test/lib/vedeu/borders/null_test.rb +0 -12
- data/test/lib/vedeu/buffers/null_test.rb +0 -37
- data/test/lib/vedeu/common_test.rb +33 -0
- data/test/lib/vedeu/cursors/cursor_test.rb +1 -1
- data/test/lib/vedeu/dsl/composition_test.rb +0 -6
- data/test/lib/vedeu/dsl/dsl_test.rb +1 -0
- data/test/lib/vedeu/dsl/interface_test.rb +0 -6
- data/test/lib/vedeu/dsl/keymap_test.rb +0 -5
- data/test/lib/vedeu/dsl/line_test.rb +0 -7
- data/test/lib/vedeu/dsl/stream_test.rb +0 -7
- data/test/lib/vedeu/editor/cursor_test.rb +23 -8
- data/test/lib/vedeu/editor/document_test.rb +27 -23
- data/test/lib/vedeu/editor/line_test.rb +0 -30
- data/test/lib/vedeu/geometry/dsl_test.rb +0 -5
- data/test/lib/vedeu/geometry/null_test.rb +0 -30
- data/test/lib/vedeu/groups/dsl_test.rb +0 -6
- data/test/lib/vedeu/groups/group_test.rb +15 -7
- data/test/lib/vedeu/menus/dsl_test.rb +0 -5
- data/test/lib/vedeu/models/cell_test.rb +4 -0
- data/test/lib/vedeu/models/escape_test.rb +4 -0
- data/test/lib/vedeu/models/views/char_test.rb +4 -0
- data/test/lib/vedeu/null/generic_test.rb +13 -0
- data/test/lib/vedeu/terminal/buffer_test.rb +3 -2
- data/test/lib/vedeu_test.rb +81 -3
- data/test/support/examples/borders_app.rb +1 -3
- data/test/support/examples/drb_app.rb +1 -3
- data/test/support/examples/editor_app.rb +2 -4
- data/test/support/examples/focus_app.rb +1 -3
- data/test/support/examples/hello_world.rb +1 -6
- data/test/support/examples/material_colours_app.rb +1 -3
- data/test/support/examples/view_templates_app/view_templates_app.rb +1 -3
- data/test/support/helpers/model_test_class.rb +1 -5
- data/test/support/who.rb +29 -0
- data/test/test_helper.rb +0 -1
- metadata +5 -17
- data/lib/vedeu/api/all.rb +0 -15
- data/lib/vedeu/api/external.rb +0 -194
- data/lib/vedeu/api/internal.rb +0 -177
- data/test/lib/vedeu/api/external_test.rb +0 -74
- data/test/lib/vedeu/api/internal_test.rb +0 -33
- data/test/support/examples/typed_commands/command.erb +0 -1
- data/test/support/examples/typed_commands/output.erb +0 -1
- data/test/support/examples/typed_commands/status.erb +0 -1
- data/test/support/examples/typed_commands/typed_commands_app.rb +0 -94
@@ -335,4 +335,10 @@ module Vedeu
|
|
335
335
|
|
336
336
|
end # Configuration
|
337
337
|
|
338
|
+
# @!method configure
|
339
|
+
# @see Vedeu::Configuration.configure
|
340
|
+
# @!method configuration
|
341
|
+
# @see Vedeu::Configuration.configuration
|
342
|
+
def_delegators Vedeu::Configuration, :configure, :configuration
|
343
|
+
|
338
344
|
end # Vedeu
|
data/lib/vedeu/cursors/cursor.rb
CHANGED
@@ -22,7 +22,7 @@ module Vedeu
|
|
22
22
|
attr_reader :attributes
|
23
23
|
|
24
24
|
# @!attribute [r] name
|
25
|
-
# @return [String]
|
25
|
+
# @return [String|Symbol]
|
26
26
|
attr_reader :name
|
27
27
|
|
28
28
|
# @!attribute [w] ox
|
@@ -33,10 +33,6 @@ module Vedeu
|
|
33
33
|
# @return [Fixnum]
|
34
34
|
attr_writer :oy
|
35
35
|
|
36
|
-
# @!attribute [r] state
|
37
|
-
# @return [Boolean|Symbol]
|
38
|
-
attr_reader :state
|
39
|
-
|
40
36
|
# @!attribute [w] x
|
41
37
|
# @return [Fixnum]
|
42
38
|
attr_writer :x
|
@@ -45,7 +41,7 @@ module Vedeu
|
|
45
41
|
# @return [Fixnum]
|
46
42
|
attr_writer :y
|
47
43
|
|
48
|
-
# @param
|
44
|
+
# @param (see #initialize)
|
49
45
|
# @return [Vedeu::Cursors::Cursor]
|
50
46
|
def self.store(attributes)
|
51
47
|
new(attributes).store
|
@@ -54,8 +50,8 @@ module Vedeu
|
|
54
50
|
# Returns a new instance of Vedeu::Cursors::Cursor.
|
55
51
|
#
|
56
52
|
# @param attributes [Hash]
|
57
|
-
# @option attributes name [String] The name of the
|
58
|
-
# this cursor belongs to.
|
53
|
+
# @option attributes name [String|Symbol] The name of the
|
54
|
+
# interface this cursor belongs to.
|
59
55
|
# @option attributes ox [Fixnum] The offset x coordinate.
|
60
56
|
# @option attributes oy [Fixnum] The offset y coordinate.
|
61
57
|
# @option attributes repository
|
@@ -280,4 +276,13 @@ module Vedeu
|
|
280
276
|
|
281
277
|
end # Cursors
|
282
278
|
|
279
|
+
# @!method hide_cursor
|
280
|
+
# @see Vedeu::Toggleable::ClassMethods.hide
|
281
|
+
# @!method show_cursor
|
282
|
+
# @see Vedeu::Toggleable::ClassMethods#show
|
283
|
+
# @!method toggle_cursor
|
284
|
+
# @see Vedeu::Toggleable::ClassMethods#toggle
|
285
|
+
def_delegators Vedeu::Cursors::Cursor, :hide_cursor, :show_cursor,
|
286
|
+
:toggle_cursor
|
287
|
+
|
283
288
|
end # Vedeu
|
@@ -21,7 +21,7 @@ module Vedeu
|
|
21
21
|
|
22
22
|
# Returns a new instance of Vedeu::Cursors::Refresh.
|
23
23
|
#
|
24
|
-
# @param name [String] The name of the cursor.
|
24
|
+
# @param name [String|Symbol] The name of the cursor.
|
25
25
|
# @return [Vedeu::Cursors::Refresh]
|
26
26
|
def initialize(name = nil)
|
27
27
|
@name = name || Vedeu.focus
|
@@ -44,7 +44,7 @@ module Vedeu
|
|
44
44
|
protected
|
45
45
|
|
46
46
|
# @!attribute [r] name
|
47
|
-
# @return [String]
|
47
|
+
# @return [String|Symbol]
|
48
48
|
attr_reader :name
|
49
49
|
|
50
50
|
private
|
@@ -10,8 +10,12 @@ module Vedeu
|
|
10
10
|
|
11
11
|
class << self
|
12
12
|
|
13
|
+
# Fetch the cursor of the currently focussed interface/view.
|
14
|
+
#
|
15
|
+
# @example
|
16
|
+
# Vedeu.cursor
|
17
|
+
#
|
13
18
|
# @return [Vedeu::Cursors::Cursor]
|
14
|
-
# @see Vedeu::API::External.cursor
|
15
19
|
def cursor
|
16
20
|
cursors.by_name(Vedeu.focus) if Vedeu.focus
|
17
21
|
end
|
@@ -31,4 +35,17 @@ module Vedeu
|
|
31
35
|
|
32
36
|
end # Cursors
|
33
37
|
|
38
|
+
# @!method cursor
|
39
|
+
# @see Vedeu::Cursors::Repository.cursor
|
40
|
+
def_delegators Vedeu::Cursors::Repository, :cursor
|
41
|
+
|
42
|
+
# Manipulate the repository of cursors.
|
43
|
+
#
|
44
|
+
# @example
|
45
|
+
# Vedeu.cursors
|
46
|
+
#
|
47
|
+
# @!method cursors
|
48
|
+
# @return [Vedeu::Cursors::Repository]
|
49
|
+
def_delegators Vedeu::Cursors::Repository, :cursors
|
50
|
+
|
34
51
|
end # Vedeu
|
@@ -87,6 +87,9 @@ module Vedeu
|
|
87
87
|
|
88
88
|
# Restart the DRb server.
|
89
89
|
#
|
90
|
+
# @example
|
91
|
+
# Vedeu.drb_restart
|
92
|
+
#
|
90
93
|
# @return [void]
|
91
94
|
def restart
|
92
95
|
log('Attempting to restart')
|
@@ -128,6 +131,9 @@ module Vedeu
|
|
128
131
|
|
129
132
|
# Start the DRb server.
|
130
133
|
#
|
134
|
+
# @example
|
135
|
+
# Vedeu.drb_start
|
136
|
+
#
|
131
137
|
# @return [Vedeu::Distributed::Server]
|
132
138
|
def start
|
133
139
|
log('Attempting to start')
|
@@ -148,6 +154,9 @@ module Vedeu
|
|
148
154
|
|
149
155
|
# Fetch the status of the DRb server.
|
150
156
|
#
|
157
|
+
# @example
|
158
|
+
# Vedeu.drb_status
|
159
|
+
#
|
151
160
|
# @return [Symbol]
|
152
161
|
def status
|
153
162
|
log('Fetching status')
|
@@ -169,6 +178,9 @@ module Vedeu
|
|
169
178
|
|
170
179
|
# Stop the DRb server.
|
171
180
|
#
|
181
|
+
# @example
|
182
|
+
# Vedeu.drb_stop
|
183
|
+
#
|
172
184
|
# @return [void]
|
173
185
|
def stop
|
174
186
|
log('Attempting to stop')
|
@@ -225,4 +237,15 @@ module Vedeu
|
|
225
237
|
|
226
238
|
end # Distributed
|
227
239
|
|
240
|
+
# @!method drb_restart
|
241
|
+
# @see Vedeu::Distributed::Server#restart
|
242
|
+
# @!method drb_start
|
243
|
+
# @see Vedeu::Distributed::Server#start
|
244
|
+
# @!method drb_status
|
245
|
+
# @see Vedeu::Distributed::Server#status
|
246
|
+
# @!method drb_stop
|
247
|
+
# @see Vedeu::Distributed::Server#stop
|
248
|
+
def_delegators Vedeu::Distributed::Server, :drb_restart, :drb_start,
|
249
|
+
:drb_status, :drb_stop
|
250
|
+
|
228
251
|
end # Vedeu
|
@@ -42,16 +42,6 @@ module Vedeu
|
|
42
42
|
|
43
43
|
include Vedeu::DSL
|
44
44
|
|
45
|
-
# Returns an instance of DSL::Composition.
|
46
|
-
#
|
47
|
-
# @param model [Vedeu::Views::Composition]
|
48
|
-
# @param client [Object]
|
49
|
-
# @return [Vedeu::DSL::Composition]
|
50
|
-
def initialize(model, client = nil)
|
51
|
-
@model = model
|
52
|
-
@client = client
|
53
|
-
end
|
54
|
-
|
55
45
|
# Define a view.
|
56
46
|
#
|
57
47
|
# A view is just an Interface object.
|
@@ -61,13 +51,13 @@ module Vedeu
|
|
61
51
|
# don't need to specify everything again.
|
62
52
|
#
|
63
53
|
# @todo More documentation required.
|
64
|
-
# @param name [String] The name of the interface you are
|
54
|
+
# @param name [String|Symbol] The name of the interface you are
|
65
55
|
# targetting for this view.
|
66
56
|
# @param block [Proc] The directives you wish to send to this
|
67
57
|
# interface.
|
68
58
|
#
|
69
59
|
# @example
|
70
|
-
# view
|
60
|
+
# view :my_interface do
|
71
61
|
# # ...
|
72
62
|
# end
|
73
63
|
#
|
@@ -85,14 +75,14 @@ module Vedeu
|
|
85
75
|
#
|
86
76
|
# @example
|
87
77
|
# Vedeu.renders do
|
88
|
-
# template_for(
|
78
|
+
# template_for(:my_interface,
|
89
79
|
# '/path/to/template.erb',
|
90
80
|
# @some_object, options)
|
91
81
|
# end
|
92
82
|
#
|
93
83
|
# @todo More documentation required.
|
94
84
|
#
|
95
|
-
# @param name [String] The name of interface for which this
|
85
|
+
# @param name [String|Symbol] The name of interface for which this
|
96
86
|
# template's content belongs to.
|
97
87
|
# @param filename [String] The filename (including path) to the
|
98
88
|
# template to be used. Yoy can use `File.dirname(__FILE__)` to
|
@@ -123,7 +113,7 @@ module Vedeu
|
|
123
113
|
|
124
114
|
private
|
125
115
|
|
126
|
-
# @param name [String]
|
116
|
+
# @param name [String|Symbol]
|
127
117
|
# @param lines [Vedeu::Views::Lines]
|
128
118
|
# @return [Hash]
|
129
119
|
def template_attributes(name, lines)
|
@@ -133,7 +123,7 @@ module Vedeu
|
|
133
123
|
# Return the current attributes combined with the existing
|
134
124
|
# interface attributes defined by the interface.
|
135
125
|
#
|
136
|
-
# @param name [String] The name of the interface.
|
126
|
+
# @param name [String|Symbol] The name of the interface.
|
137
127
|
# @return [Hash]
|
138
128
|
def new_attributes(name)
|
139
129
|
attributes.merge!(existing_attributes(name))
|
@@ -141,7 +131,7 @@ module Vedeu
|
|
141
131
|
|
142
132
|
# Retrieve the attributes of the interface by name.
|
143
133
|
#
|
144
|
-
# @param name [String] The name of the interface.
|
134
|
+
# @param name [String|Symbol] The name of the interface.
|
145
135
|
# @return [Hash]
|
146
136
|
def existing_attributes(name)
|
147
137
|
Vedeu.interfaces.by_name(name).attributes
|
data/lib/vedeu/dsl/dsl.rb
CHANGED
@@ -4,6 +4,18 @@ module Vedeu
|
|
4
4
|
#
|
5
5
|
module DSL
|
6
6
|
|
7
|
+
# Returns an instance of the DSL class including {Vedeu::DSL}.
|
8
|
+
#
|
9
|
+
# @param model [void] The model class which the DSL class is
|
10
|
+
# wrapping.
|
11
|
+
# @param client [void] The class where the DSL methods are being
|
12
|
+
# used.
|
13
|
+
# @return [void] An instance of the DSL class.
|
14
|
+
def initialize(model, client = nil)
|
15
|
+
@model = model
|
16
|
+
@client = client
|
17
|
+
end
|
18
|
+
|
7
19
|
protected
|
8
20
|
|
9
21
|
# @!attribute [r] client
|
data/lib/vedeu/dsl/interface.rb
CHANGED
@@ -22,12 +22,12 @@ module Vedeu
|
|
22
22
|
# define your the views of your application without their
|
23
23
|
# content.
|
24
24
|
#
|
25
|
-
# Vedeu.interface
|
25
|
+
# Vedeu.interface :my_interface do
|
26
26
|
# # ... some code
|
27
27
|
# end
|
28
28
|
#
|
29
|
-
# @param name [String] The name of the interface. Used
|
30
|
-
# reference the interface throughout your application's
|
29
|
+
# @param name [String|Symbol] The name of the interface. Used
|
30
|
+
# to reference the interface throughout your application's
|
31
31
|
# execution lifetime.
|
32
32
|
# @param block [Proc] A set of attributes which define the
|
33
33
|
# features of the interface.
|
@@ -54,6 +54,7 @@ module Vedeu
|
|
54
54
|
# registered, and also adds interface's name to list of
|
55
55
|
# focussable interfaces.
|
56
56
|
#
|
57
|
+
# @param name [String|Symbol]
|
57
58
|
# @see Vedeu::Buffers::Buffer
|
58
59
|
# @return [Vedeu::Buffers::Buffer]
|
59
60
|
def add_buffers!(name)
|
@@ -63,6 +64,7 @@ module Vedeu
|
|
63
64
|
# Registers a new cursor for the interface unless already
|
64
65
|
# registered.
|
65
66
|
#
|
67
|
+
# @param name [String|Symbol]
|
66
68
|
# @return [Vedeu::Cursors::Cursor]
|
67
69
|
def add_cursor!(name)
|
68
70
|
Vedeu::Cursors::Cursor.store(name: name)
|
@@ -71,6 +73,7 @@ module Vedeu
|
|
71
73
|
# Registers interface name in focus list unless already
|
72
74
|
# registered.
|
73
75
|
#
|
76
|
+
# @param name [String|Symbol]
|
74
77
|
# @return [void]
|
75
78
|
def add_focusable!(name)
|
76
79
|
Vedeu.focusable.add(name) unless Vedeu.focusable.registered?(name)
|
@@ -86,16 +89,6 @@ module Vedeu
|
|
86
89
|
|
87
90
|
end # Eigenclass
|
88
91
|
|
89
|
-
# Returns an instance of Vedeu::DSL::Interface.
|
90
|
-
#
|
91
|
-
# @param model [Vedeu::DSL::Interface]
|
92
|
-
# @param client [Object]
|
93
|
-
# @return [Vedeu::DSL::Interface]
|
94
|
-
def initialize(model, client = nil)
|
95
|
-
@model = model
|
96
|
-
@client = client
|
97
|
-
end
|
98
|
-
|
99
92
|
# Set the cursor visibility on an interface.
|
100
93
|
#
|
101
94
|
# @param value [Boolean] Any value other than nil or false will
|
@@ -103,7 +96,7 @@ module Vedeu
|
|
103
96
|
# to true.
|
104
97
|
#
|
105
98
|
# @example
|
106
|
-
# Vedeu.interface
|
99
|
+
# Vedeu.interface :my_interface do
|
107
100
|
# cursor true # => show the cursor for this interface
|
108
101
|
# # or...
|
109
102
|
# cursor :show # => both of these are equivalent to line
|
@@ -113,14 +106,14 @@ module Vedeu
|
|
113
106
|
# # ...
|
114
107
|
# end
|
115
108
|
#
|
116
|
-
# Vedeu.interface
|
109
|
+
# Vedeu.interface :my_interface do
|
117
110
|
# cursor false # => hide the cursor for this interface
|
118
111
|
# # or...
|
119
112
|
# cursor nil # => as above
|
120
113
|
# # ...
|
121
114
|
# end
|
122
115
|
#
|
123
|
-
# Vedeu.view
|
116
|
+
# Vedeu.view :my_interface do
|
124
117
|
# cursor true # => Specify the visibility of the cursor when
|
125
118
|
# # the view is rendered.
|
126
119
|
# # ...
|
@@ -147,7 +140,7 @@ module Vedeu
|
|
147
140
|
# @param value [Fixnum|Float] Time in seconds. (0.5 = 500ms).
|
148
141
|
#
|
149
142
|
# @example
|
150
|
-
# Vedeu.interface
|
143
|
+
# Vedeu.interface :my_interface do
|
151
144
|
# delay 0.5 # interface will not update more often than
|
152
145
|
# # every 500ms.
|
153
146
|
# # ...
|
@@ -166,7 +159,7 @@ module Vedeu
|
|
166
159
|
# focus. However, this behaviour can be overridden:
|
167
160
|
#
|
168
161
|
# ```ruby
|
169
|
-
# Vedeu.focus_by_name
|
162
|
+
# Vedeu.focus_by_name :some_interface
|
170
163
|
# ```
|
171
164
|
#
|
172
165
|
# When the above is specified (outside of a `Vedeu.interface`
|
@@ -182,13 +175,13 @@ module Vedeu
|
|
182
175
|
# multiple interfaces at once.
|
183
176
|
#
|
184
177
|
# @example
|
185
|
-
# Vedeu.interface
|
186
|
-
# group
|
178
|
+
# Vedeu.interface :my_interface do
|
179
|
+
# group :main_screen
|
187
180
|
# # ...
|
188
181
|
# end
|
189
182
|
#
|
190
|
-
# @param name [String] The name of the group to which
|
191
|
-
# interface should belong.
|
183
|
+
# @param name [String|Symbol] The name of the group to which
|
184
|
+
# this interface should belong.
|
192
185
|
# @return [Vedeu::Groups::Group]
|
193
186
|
def group(name)
|
194
187
|
return false unless present?(name)
|
@@ -198,6 +191,8 @@ module Vedeu
|
|
198
191
|
Vedeu.groups.by_name(name).add(model.name)
|
199
192
|
end
|
200
193
|
|
194
|
+
# @param name [String|Symbol] The name of the interface to which
|
195
|
+
# this keymap should belong.
|
201
196
|
# @see Vedeu::DSL::Keymap.keymap
|
202
197
|
def keymap(name = model.name, &block)
|
203
198
|
Vedeu.keymap(name, &block)
|
@@ -207,15 +202,15 @@ module Vedeu
|
|
207
202
|
# The name of the interface. Used to reference the interface
|
208
203
|
# throughout your application's execution lifetime.
|
209
204
|
#
|
210
|
-
# @param value [String]
|
205
|
+
# @param value [String|Symbol]
|
211
206
|
#
|
212
207
|
# @example
|
213
208
|
# Vedeu.interface do
|
214
|
-
# name
|
209
|
+
# name :my_interface
|
215
210
|
# # ...
|
216
211
|
# end
|
217
212
|
#
|
218
|
-
# @return [String]
|
213
|
+
# @return [String|Symbol]
|
219
214
|
def name(value)
|
220
215
|
model.name = value
|
221
216
|
end
|
@@ -230,7 +225,7 @@ module Vedeu
|
|
230
225
|
# Set the interface to visible.
|
231
226
|
#
|
232
227
|
# @example
|
233
|
-
# Vedeu.interface
|
228
|
+
# Vedeu.interface :my_interface do
|
234
229
|
# show!
|
235
230
|
#
|
236
231
|
# # ... some code
|
@@ -244,7 +239,7 @@ module Vedeu
|
|
244
239
|
# Set the interface to invisible.
|
245
240
|
#
|
246
241
|
# @example
|
247
|
-
# Vedeu.interface
|
242
|
+
# Vedeu.interface :my_interface do
|
248
243
|
# # ... some code
|
249
244
|
# end
|
250
245
|
#
|
@@ -255,8 +250,8 @@ module Vedeu
|
|
255
250
|
|
256
251
|
# Use a value from another model.
|
257
252
|
#
|
258
|
-
# @param name [String] The name of the interface model
|
259
|
-
# to use a value from.
|
253
|
+
# @param name [String|Symbol] The name of the interface model
|
254
|
+
# you wish to use a value from.
|
260
255
|
# @return [Vedeu::Models::Interface]
|
261
256
|
def use(name)
|
262
257
|
model.repository.by_name(name)
|
@@ -268,21 +263,21 @@ module Vedeu
|
|
268
263
|
# evaluate to true.
|
269
264
|
#
|
270
265
|
# @example
|
271
|
-
# Vedeu.interface
|
266
|
+
# Vedeu.interface :my_interface do
|
272
267
|
# visible true # => show the interface
|
273
268
|
# # or...
|
274
269
|
# show! # => as above
|
275
270
|
# # ... some code
|
276
271
|
# end
|
277
272
|
#
|
278
|
-
# Vedeu.interface
|
273
|
+
# Vedeu.interface :my_interface do
|
279
274
|
# visible false # => hide the interface
|
280
275
|
# # or...
|
281
276
|
# hide! # => as above
|
282
277
|
# # ... some code
|
283
278
|
# end
|
284
279
|
#
|
285
|
-
# Vedeu.view
|
280
|
+
# Vedeu.view :my_interface do
|
286
281
|
# visible false
|
287
282
|
# # ... some code
|
288
283
|
# end
|
@@ -304,7 +299,7 @@ module Vedeu
|
|
304
299
|
# --2--
|
305
300
|
# --1-- # rendered first
|
306
301
|
#
|
307
|
-
# Vedeu.interface
|
302
|
+
# Vedeu.interface :my_interface do
|
308
303
|
# zindex 3
|
309
304
|
# # ...
|
310
305
|
# end
|
@@ -321,4 +316,8 @@ module Vedeu
|
|
321
316
|
|
322
317
|
end # DSL
|
323
318
|
|
319
|
+
# @!method interface
|
320
|
+
# @see Vedeu::DSL::Interface.interface
|
321
|
+
def_delegators Vedeu::DSL::Interface, :interface
|
322
|
+
|
324
323
|
end # Vedeu
|