vedeu 0.4.7 → 0.4.8
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/vedeu/all.rb +1 -2
- data/lib/vedeu/api.rb +1 -0
- data/lib/vedeu/application.rb +2 -4
- data/lib/vedeu/bindings.rb +13 -13
- data/lib/vedeu/configuration/api.rb +6 -9
- data/lib/vedeu/configuration/cli.rb +4 -7
- data/lib/vedeu/cursor/all.rb +2 -2
- data/lib/vedeu/cursor/{move_cursor.rb → move.rb} +6 -6
- data/lib/vedeu/cursor/refresh_cursor.rb +7 -4
- data/lib/vedeu/cursor/{toggle_cursor.rb → toggle.rb} +6 -8
- data/lib/vedeu/debug.rb +2 -0
- data/lib/vedeu/distributed/client.rb +1 -2
- data/lib/vedeu/distributed/server.rb +1 -1
- data/lib/vedeu/distributed/subprocess.rb +3 -2
- data/lib/vedeu/distributed/test_application.rb +2 -4
- data/lib/vedeu/dsl/all.rb +2 -0
- data/lib/vedeu/dsl/components/geometry.rb +45 -10
- data/lib/vedeu/dsl/interface.rb +1 -1
- data/lib/vedeu/events/event.rb +22 -14
- data/lib/vedeu/events/trigger.rb +6 -3
- data/lib/vedeu/geometry/all.rb +6 -1
- data/lib/vedeu/geometry/area.rb +151 -0
- data/lib/vedeu/geometry/canvas.rb +79 -0
- data/lib/vedeu/geometry/centre.rb +83 -0
- data/lib/vedeu/geometry/{content_geometry.rb → content.rb} +3 -3
- data/lib/vedeu/geometry/dimension.rb +81 -0
- data/lib/vedeu/{models → geometry}/geometry.rb +32 -0
- data/lib/vedeu/geometry/grid.rb +1 -2
- data/lib/vedeu/geometry/index_position.rb +3 -11
- data/lib/vedeu/geometry/limit.rb +1 -1
- data/lib/vedeu/geometry/position.rb +5 -0
- data/lib/vedeu/geometry/position_index.rb +3 -5
- data/lib/vedeu/geometry/position_validator.rb +1 -4
- data/lib/vedeu/input/input.rb +1 -2
- data/lib/vedeu/input/mapper.rb +2 -4
- data/lib/vedeu/launcher.rb +1 -1
- data/lib/vedeu/main_loop.rb +2 -0
- data/lib/vedeu/models/all.rb +1 -1
- data/lib/vedeu/models/cell.rb +68 -0
- data/lib/vedeu/models/interface.rb +4 -2
- data/lib/vedeu/output/all.rb +0 -1
- data/lib/vedeu/output/border.rb +6 -6
- data/lib/vedeu/output/clear.rb +6 -5
- data/lib/vedeu/output/colour.rb +1 -1
- data/lib/vedeu/output/esc.rb +2 -2
- data/lib/vedeu/output/output.rb +1 -3
- data/lib/vedeu/output/style.rb +2 -2
- data/lib/vedeu/output/text.rb +17 -1
- data/lib/vedeu/output/translator.rb +1 -8
- data/lib/vedeu/output/virtual_terminal.rb +3 -3
- data/lib/vedeu/output/wordwrap.rb +1 -1
- data/lib/vedeu/repositories/model.rb +1 -1
- data/lib/vedeu/repositories/repository.rb +1 -1
- data/lib/vedeu/support/log.rb +1 -1
- data/lib/vedeu/support/trace.rb +5 -3
- data/test/lib/vedeu/cursor/{move_cursor_test.rb → move_test.rb} +22 -22
- data/test/lib/vedeu/cursor/{toggle_cursor_test.rb → toggle_test.rb} +6 -6
- data/test/lib/vedeu/dsl/components/geometry_test.rb +14 -2
- data/test/lib/vedeu/geometry/area_test.rb +99 -0
- data/test/lib/vedeu/geometry/canvas_test.rb +66 -0
- data/test/lib/vedeu/geometry/centre_test.rb +58 -0
- data/test/lib/vedeu/geometry/{content_geometry_test.rb → content_test.rb} +3 -3
- data/test/lib/vedeu/geometry/dimension_test.rb +99 -0
- data/test/lib/vedeu/{models → geometry}/geometry_test.rb +0 -0
- data/test/lib/vedeu/geometry/index_position_test.rb +3 -9
- data/test/lib/vedeu/geometry/position_index_test.rb +2 -2
- data/test/lib/vedeu/geometry/position_test.rb +6 -0
- data/test/lib/vedeu/models/cell_test.rb +66 -0
- data/test/lib/vedeu/output/virtual_terminal_test.rb +25 -25
- data/vedeu.gemspec +3 -3
- metadata +34 -22
- data/lib/vedeu/output/char_builder.rb +0 -36
- data/test/lib/vedeu/output/char_builder_test.rb +0 -50
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7649a91c05398be50b8403bf37f0f2f46fbd0317
|
4
|
+
data.tar.gz: 2b8f063515e7ae529fc2877ebcf482d821cebbc0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 00be70e455d52864393e79a59f678b3d3d308370eadba24d74cf1ce216b4c84c25859cce8ae33ce43d151bd0173b8c7f555fe4e0455c916a0fa33ed671077b3a
|
7
|
+
data.tar.gz: 2d82fcc1f9ee603023b99c4d1b4a7bde1c9b02578bb68feeac24a1fdaf6e41ddb98845c8336a883a04be5ec3d40fbed5de3202e50449c3052ea9d36895cdb5e7
|
data/lib/vedeu/all.rb
CHANGED
data/lib/vedeu/api.rb
CHANGED
@@ -23,6 +23,7 @@ module Vedeu
|
|
23
23
|
|
24
24
|
def_delegators Vedeu::Borders, :borders
|
25
25
|
def_delegators Vedeu::Buffers, :buffers
|
26
|
+
def_delegators Vedeu::Canvas, :canvas
|
26
27
|
def_delegators Vedeu::Cursors, :cursors
|
27
28
|
def_delegators Vedeu::Cursors, :cursor
|
28
29
|
def_delegators Vedeu::EventsRepository, :events
|
data/lib/vedeu/application.rb
CHANGED
@@ -4,14 +4,12 @@ module Vedeu
|
|
4
4
|
#
|
5
5
|
class Application
|
6
6
|
|
7
|
-
# @param
|
8
|
-
# @return [void]
|
7
|
+
# @param (see #initialize)
|
9
8
|
def self.start(configuration)
|
10
9
|
new(configuration).start
|
11
10
|
end
|
12
11
|
|
13
|
-
# @param
|
14
|
-
# @return [void]
|
12
|
+
# @param (see #initialize)
|
15
13
|
def self.restart(configuration)
|
16
14
|
new(configuration).start
|
17
15
|
end
|
data/lib/vedeu/bindings.rb
CHANGED
@@ -88,32 +88,32 @@ module Vedeu
|
|
88
88
|
Vedeu.bind(:_cursor_hide_) do |name|
|
89
89
|
named = name ? Vedeu.cursors.by_name(name) : Vedeu.cursor
|
90
90
|
|
91
|
-
Vedeu::
|
91
|
+
Vedeu::Toggle.hide(named)
|
92
92
|
end
|
93
93
|
|
94
94
|
# Show the cursor of the named interface or interface currently in focus.
|
95
95
|
Vedeu.bind(:_cursor_show_) do |name|
|
96
96
|
named = name ? Vedeu.cursors.by_name(name) : Vedeu.cursor
|
97
97
|
|
98
|
-
Vedeu::
|
98
|
+
Vedeu::Toggle.show(named)
|
99
99
|
end
|
100
100
|
|
101
|
-
# @see {Vedeu::
|
102
|
-
Vedeu.bind(:_cursor_down_) { |name| Vedeu::
|
101
|
+
# @see {Vedeu::Move}
|
102
|
+
Vedeu.bind(:_cursor_down_) { |name| Vedeu::Move.by_name(:down, name) }
|
103
103
|
|
104
|
-
# @see {Vedeu::
|
105
|
-
Vedeu.bind(:_cursor_left_) { |name| Vedeu::
|
104
|
+
# @see {Vedeu::Move}
|
105
|
+
Vedeu.bind(:_cursor_left_) { |name| Vedeu::Move.by_name(:left, name) }
|
106
106
|
|
107
|
-
# @see {Vedeu::
|
108
|
-
Vedeu.bind(:_cursor_right_) { |name| Vedeu::
|
107
|
+
# @see {Vedeu::Move}
|
108
|
+
Vedeu.bind(:_cursor_right_) { |name| Vedeu::Move.by_name(:right, name) }
|
109
109
|
|
110
|
-
# @see {Vedeu::
|
111
|
-
Vedeu.bind(:_cursor_up_) { |name| Vedeu::
|
110
|
+
# @see {Vedeu::Move}
|
111
|
+
Vedeu.bind(:_cursor_up_) { |name| Vedeu::Move.by_name(:up, name) }
|
112
112
|
|
113
|
-
# @see {Vedeu::
|
114
|
-
Vedeu.bind(:_cursor_origin_) { |name| Vedeu::
|
113
|
+
# @see {Vedeu::Move}
|
114
|
+
Vedeu.bind(:_cursor_origin_) { |name| Vedeu::Move.by_name(:origin, name) }
|
115
115
|
|
116
|
-
# @see {Vedeu::
|
116
|
+
# @see {Vedeu::Move}
|
117
117
|
Vedeu.bind(:_cursor_reset_) { |name| Vedeu.trigger(:_cursor_origin_, name) }
|
118
118
|
|
119
119
|
# When triggered with an interface name will focus that interface and
|
@@ -11,6 +11,11 @@ module Vedeu
|
|
11
11
|
|
12
12
|
include Vedeu::Common
|
13
13
|
|
14
|
+
# @param (see #initialize)
|
15
|
+
def self.configure(&block)
|
16
|
+
new(&block).configuration
|
17
|
+
end
|
18
|
+
|
14
19
|
# Configure Vedeu via a simple configuration API DSL. Options set here
|
15
20
|
# override the default Vedeu configuration set in
|
16
21
|
# {Vedeu::Configuration#defaults}.
|
@@ -20,14 +25,6 @@ module Vedeu
|
|
20
25
|
# ...
|
21
26
|
#
|
22
27
|
# @param block [Proc]
|
23
|
-
# @return [Hash]
|
24
|
-
def self.configure(&block)
|
25
|
-
new(&block).configuration
|
26
|
-
end
|
27
|
-
|
28
|
-
# Returns an instance of Configuration::API.
|
29
|
-
#
|
30
|
-
# @param block [Proc]
|
31
28
|
# @return [Configuration::API]
|
32
29
|
def initialize(&block)
|
33
30
|
instance_eval(&block) if block_given?
|
@@ -35,7 +32,7 @@ module Vedeu
|
|
35
32
|
|
36
33
|
# Returns the configuration options set up by the API DSL.
|
37
34
|
#
|
38
|
-
# @return [Hash]
|
35
|
+
# @return [Hash<Symbol => Boolean, Fixnum, String>]
|
39
36
|
def configuration
|
40
37
|
options.merge!({
|
41
38
|
system_keys: Configuration.default_system_keys.merge!(system_keys)
|
@@ -9,17 +9,14 @@ module Vedeu
|
|
9
9
|
#
|
10
10
|
class CLI
|
11
11
|
|
12
|
-
#
|
13
|
-
# arguments override the client application configuration set via
|
14
|
-
# {Vedeu::API#configure}.
|
15
|
-
#
|
16
|
-
# @param args [Array]
|
17
|
-
# @return [Hash]
|
12
|
+
# @param (see #initialize)
|
18
13
|
def self.configure(args = [])
|
19
14
|
new(args).configuration
|
20
15
|
end
|
21
16
|
|
22
|
-
#
|
17
|
+
# Configure Vedeu via command-line arguments. Options set here via
|
18
|
+
# arguments override the client application configuration set via
|
19
|
+
# {Vedeu::API#configure}.
|
23
20
|
#
|
24
21
|
# @param args [Array]
|
25
22
|
# @return [Configuration::CLI]
|
data/lib/vedeu/cursor/all.rb
CHANGED
@@ -1,8 +1,8 @@
|
|
1
1
|
require 'vedeu/repositories/all'
|
2
2
|
require 'vedeu/cursor/cursor'
|
3
|
-
require 'vedeu/cursor/
|
3
|
+
require 'vedeu/cursor/move'
|
4
4
|
require 'vedeu/cursor/refresh_cursor'
|
5
|
-
require 'vedeu/cursor/
|
5
|
+
require 'vedeu/cursor/toggle'
|
6
6
|
|
7
7
|
module Vedeu
|
8
8
|
end # Vedeu
|
@@ -33,7 +33,7 @@ module Vedeu
|
|
33
33
|
# The cursor will move freely within the bounds of the interface,
|
34
34
|
# irrespective of content.
|
35
35
|
#
|
36
|
-
class
|
36
|
+
class Move
|
37
37
|
|
38
38
|
extend Forwardable
|
39
39
|
|
@@ -46,13 +46,13 @@ module Vedeu
|
|
46
46
|
:height,
|
47
47
|
:width
|
48
48
|
|
49
|
-
# Returns an instance of
|
49
|
+
# Returns an instance of Move.
|
50
50
|
#
|
51
51
|
# @param cursor [Cursor]
|
52
52
|
# @param interface [Interface]
|
53
53
|
# @param dy [Fixnum] Move up (-1), or down (1), or no action (0).
|
54
54
|
# @param dx [Fixnum] Move left (-1), or right (1), or no action (0).
|
55
|
-
# @return [
|
55
|
+
# @return [Move]
|
56
56
|
def initialize(cursor, interface, dy = 0, dx = 0)
|
57
57
|
@cursor = cursor
|
58
58
|
@dy = dy || 0
|
@@ -81,7 +81,7 @@ module Vedeu
|
|
81
81
|
|
82
82
|
end
|
83
83
|
|
84
|
-
new_cursor = Vedeu::
|
84
|
+
new_cursor = Vedeu::Move.send(direction, cursor, interface)
|
85
85
|
|
86
86
|
Vedeu.trigger(:_refresh_cursor_, new_cursor.name)
|
87
87
|
|
@@ -162,7 +162,7 @@ module Vedeu
|
|
162
162
|
# @return [Vedeu::Interface]
|
163
163
|
attr_reader :interface
|
164
164
|
|
165
|
-
# @return [Hash]
|
165
|
+
# @return [Hash<Symbol => Fixnum>]
|
166
166
|
def moved_attributes
|
167
167
|
{
|
168
168
|
x: validator.x,
|
@@ -225,6 +225,6 @@ module Vedeu
|
|
225
225
|
width
|
226
226
|
end
|
227
227
|
|
228
|
-
end #
|
228
|
+
end # Move
|
229
229
|
|
230
230
|
end # Vedeu
|
@@ -1,9 +1,11 @@
|
|
1
1
|
module Vedeu
|
2
2
|
|
3
|
+
# Handle the refreshing (redrawing) of a cursor, without redrawing the whole
|
4
|
+
# interface; unless the cursor's offset has caused the view to change.
|
5
|
+
#
|
3
6
|
class RefreshCursor
|
4
7
|
|
5
|
-
# @param
|
6
|
-
# @return [Array]
|
8
|
+
# @param (see #initialize)
|
7
9
|
def self.render(name)
|
8
10
|
new(name).render
|
9
11
|
end
|
@@ -29,7 +31,8 @@ module Vedeu
|
|
29
31
|
|
30
32
|
# @return [Boolean]
|
31
33
|
def refresh_view?
|
32
|
-
new_cursor.ox >= interface_width ||
|
34
|
+
new_cursor.ox >= interface_width ||
|
35
|
+
new_cursor.oy >= interface_height
|
33
36
|
end
|
34
37
|
|
35
38
|
# @return [Vedeu::Cursor]
|
@@ -37,7 +40,7 @@ module Vedeu
|
|
37
40
|
@new_cursor ||= Vedeu::Cursor.new(cursor.attributes.merge(position))
|
38
41
|
end
|
39
42
|
|
40
|
-
# @return [Hash]
|
43
|
+
# @return [Hash<Symbol => Fixnum>]
|
41
44
|
def position
|
42
45
|
{
|
43
46
|
x: validated_position.x,
|
@@ -2,20 +2,19 @@ module Vedeu
|
|
2
2
|
|
3
3
|
# Adjusts the visibility of the cursor.
|
4
4
|
#
|
5
|
-
class
|
5
|
+
class Toggle
|
6
6
|
|
7
|
-
# Returns an instance of
|
7
|
+
# Returns an instance of Toggle.
|
8
8
|
#
|
9
9
|
# @param cursor [Cursor]
|
10
|
-
# @return [
|
10
|
+
# @return [Toggle]
|
11
11
|
def initialize(cursor)
|
12
12
|
@cursor = cursor
|
13
13
|
end
|
14
14
|
|
15
15
|
# Hides the cursor.
|
16
16
|
#
|
17
|
-
# @param
|
18
|
-
# @return [Cursor]
|
17
|
+
# @param (see #initialize)
|
19
18
|
def self.hide(cursor)
|
20
19
|
return cursor if cursor.invisible?
|
21
20
|
|
@@ -24,8 +23,7 @@ module Vedeu
|
|
24
23
|
|
25
24
|
# Shows the cursor.
|
26
25
|
#
|
27
|
-
# @param
|
28
|
-
# @return [Cursor]
|
26
|
+
# @param (see #initialize)
|
29
27
|
def self.show(cursor)
|
30
28
|
return cursor if cursor.visible?
|
31
29
|
|
@@ -52,6 +50,6 @@ module Vedeu
|
|
52
50
|
# @return [Vedeu::Cursor]
|
53
51
|
attr_reader :cursor
|
54
52
|
|
55
|
-
end #
|
53
|
+
end # Toggle
|
56
54
|
|
57
55
|
end # Vedeu
|
data/lib/vedeu/debug.rb
CHANGED
@@ -1,5 +1,6 @@
|
|
1
1
|
module Vedeu
|
2
2
|
|
3
|
+
# :nocov:
|
3
4
|
# Helps to debug a running application by providing a stack trace of its
|
4
5
|
# execution upon exiting.
|
5
6
|
#
|
@@ -22,5 +23,6 @@ module Vedeu
|
|
22
23
|
# RubyProf::CallTreePrinter.new(result).print(file)
|
23
24
|
end
|
24
25
|
end
|
26
|
+
# :nocov:
|
25
27
|
|
26
28
|
end # Vedeu
|
@@ -7,8 +7,7 @@ module Vedeu
|
|
7
7
|
#
|
8
8
|
class Subprocess
|
9
9
|
|
10
|
-
# @param
|
11
|
-
# @return [Array]
|
10
|
+
# @param (see #initialize)
|
12
11
|
def self.execute!(application)
|
13
12
|
new(application).execute!
|
14
13
|
end
|
@@ -20,6 +19,7 @@ module Vedeu
|
|
20
19
|
@pid = nil
|
21
20
|
end
|
22
21
|
|
22
|
+
# :nocov:
|
23
23
|
# @return [Array]
|
24
24
|
def execute!
|
25
25
|
file_open && file_write && file_close
|
@@ -32,6 +32,7 @@ module Vedeu
|
|
32
32
|
|
33
33
|
self
|
34
34
|
end
|
35
|
+
# :nocov:
|
35
36
|
|
36
37
|
# Sends the KILL signal to the process.
|
37
38
|
#
|
@@ -48,14 +48,12 @@ module Vedeu
|
|
48
48
|
# @return [String]
|
49
49
|
attr_accessor :views
|
50
50
|
|
51
|
-
# @param
|
52
|
-
# @param block [Proc]
|
53
|
-
# @return [String]
|
51
|
+
# @param (see #initialize)
|
54
52
|
def self.build(attributes = {}, &block)
|
55
53
|
new(attributes).build(&block)
|
56
54
|
end
|
57
55
|
|
58
|
-
# @param attributes [Hash]
|
56
|
+
# @param attributes [Hash<Symbol => String>]
|
59
57
|
# @option attributes borders [String]
|
60
58
|
# @option attributes configuration [String]
|
61
59
|
# @option attributes events [String]
|
data/lib/vedeu/dsl/all.rb
CHANGED
@@ -16,6 +16,7 @@ module Vedeu
|
|
16
16
|
|
17
17
|
private
|
18
18
|
|
19
|
+
# :nocov:
|
19
20
|
# Attempts to find the missing method on the client object.
|
20
21
|
#
|
21
22
|
# @param method [Symbol] The name of the method sought.
|
@@ -27,6 +28,7 @@ module Vedeu
|
|
27
28
|
|
28
29
|
client.send(method, *args, &block) if client
|
29
30
|
end
|
31
|
+
# :nocov:
|
30
32
|
|
31
33
|
end # DSL
|
32
34
|
|
@@ -1,4 +1,4 @@
|
|
1
|
-
require 'vedeu/
|
1
|
+
require 'vedeu/geometry/geometry'
|
2
2
|
require 'vedeu/dsl/shared/all'
|
3
3
|
|
4
4
|
module Vedeu
|
@@ -62,13 +62,15 @@ module Vedeu
|
|
62
62
|
|
63
63
|
# Specify the number of characters/rows/lines tall the interface will be.
|
64
64
|
#
|
65
|
-
# @param value [Fixnum]
|
66
|
-
#
|
67
65
|
# @example
|
68
66
|
# geometry 'some_interface' do
|
69
67
|
# height 8
|
70
68
|
# # ...
|
71
69
|
#
|
70
|
+
# @note
|
71
|
+
# This value will be ignored if by `y` and `yn` are set.
|
72
|
+
#
|
73
|
+
# @param value [Fixnum]
|
72
74
|
# @return [Fixnum]
|
73
75
|
def height(value)
|
74
76
|
model.height = value
|
@@ -83,6 +85,9 @@ module Vedeu
|
|
83
85
|
# width 25
|
84
86
|
# # ...
|
85
87
|
#
|
88
|
+
# @note
|
89
|
+
# This value will be ignored if by `x` and `xn` are set.
|
90
|
+
#
|
86
91
|
# @return [Fixnum]
|
87
92
|
def width(value)
|
88
93
|
model.width = value
|
@@ -90,9 +95,6 @@ module Vedeu
|
|
90
95
|
|
91
96
|
# Specify the starting x position (column) of the interface.
|
92
97
|
#
|
93
|
-
# @param value [Fixnum]
|
94
|
-
# @param block [Proc]
|
95
|
-
#
|
96
98
|
# @example
|
97
99
|
# geometry 'some_interface' do
|
98
100
|
# x 7 # start on column 7.
|
@@ -104,17 +106,32 @@ module Vedeu
|
|
104
106
|
# # position, `some_interface` will
|
105
107
|
# # too.
|
106
108
|
#
|
109
|
+
# @param value [Fixnum]
|
110
|
+
# @param block [Proc]
|
107
111
|
# @return [Fixnum]
|
108
|
-
def x(value =
|
112
|
+
def x(value = 1, &block)
|
109
113
|
return model.x = block if block_given?
|
110
114
|
|
111
115
|
model.x = value
|
112
116
|
end
|
113
117
|
|
114
|
-
# Specify the
|
118
|
+
# Specify the ending x position (column) of the interface.
|
119
|
+
#
|
120
|
+
# @example
|
121
|
+
# geometry 'some_interface' do
|
122
|
+
# xn 37 # end at column 37.
|
123
|
+
# # ...
|
124
|
+
#
|
125
|
+
# @note
|
126
|
+
# This value will override `width`.
|
115
127
|
#
|
116
128
|
# @param value [Fixnum]
|
117
|
-
# @
|
129
|
+
# @return [Fixnum]
|
130
|
+
def xn(value)
|
131
|
+
model.xn = value
|
132
|
+
end
|
133
|
+
|
134
|
+
# Specify the starting y position (row/line) of the interface.
|
118
135
|
#
|
119
136
|
# @example
|
120
137
|
# geometry 'some_interface' do
|
@@ -127,13 +144,31 @@ module Vedeu
|
|
127
144
|
# # position, `some_interface`
|
128
145
|
# # will too.
|
129
146
|
#
|
147
|
+
# @param value [Fixnum]
|
148
|
+
# @param block [Proc]
|
130
149
|
# @return [Fixnum]
|
131
|
-
def y(value =
|
150
|
+
def y(value = 1, &block)
|
132
151
|
return model.y = block if block_given?
|
133
152
|
|
134
153
|
model.y = value
|
135
154
|
end
|
136
155
|
|
156
|
+
# Specify the ending y position (row/line) of the interface.
|
157
|
+
#
|
158
|
+
# @example
|
159
|
+
# geometry 'some_interface' do
|
160
|
+
# yn 24 # end at row 24.
|
161
|
+
# # ...
|
162
|
+
#
|
163
|
+
# @note
|
164
|
+
# This value will override `height`.
|
165
|
+
#
|
166
|
+
# @param value [Fixnum]
|
167
|
+
# @return [Fixnum]
|
168
|
+
def yn(value)
|
169
|
+
model.yn = value
|
170
|
+
end
|
171
|
+
|
137
172
|
private
|
138
173
|
|
139
174
|
# @!attribute [r] client
|
data/lib/vedeu/dsl/interface.rb
CHANGED
data/lib/vedeu/events/event.rb
CHANGED
@@ -15,21 +15,21 @@ module Vedeu
|
|
15
15
|
# Events described here assume that you have either included Vedeu in your
|
16
16
|
# class:
|
17
17
|
#
|
18
|
-
#
|
19
|
-
#
|
18
|
+
# class SomeClassInYourApplication
|
19
|
+
# include Vedeu
|
20
20
|
#
|
21
|
-
#
|
22
|
-
#
|
23
|
-
#
|
24
|
-
#
|
21
|
+
# bind :event_name do |arg1, arg2|
|
22
|
+
# # Things that should happen when the event is triggered; these can be
|
23
|
+
# # method calls or the triggering of another event or events.
|
24
|
+
# end
|
25
25
|
#
|
26
26
|
# or, you are prepared to use the `Vedeu` prefix:
|
27
27
|
#
|
28
|
-
#
|
29
|
-
#
|
30
|
-
#
|
31
|
-
#
|
32
|
-
#
|
28
|
+
# class SomeClassInYourApplication
|
29
|
+
# Vedeu.bind(:event_name) do
|
30
|
+
# # Not all events you define will have arguments; like methods.
|
31
|
+
# :do_stuff
|
32
|
+
# end
|
33
33
|
#
|
34
34
|
class Event
|
35
35
|
|
@@ -104,6 +104,7 @@ module Vedeu
|
|
104
104
|
|
105
105
|
end
|
106
106
|
|
107
|
+
# @param (see Vedeu::Trigger.trigger)
|
107
108
|
# @see Vedeu::Trigger.trigger
|
108
109
|
def self.trigger(name, *args)
|
109
110
|
Vedeu::Trigger.trigger(name, *args)
|
@@ -111,9 +112,7 @@ module Vedeu
|
|
111
112
|
|
112
113
|
# Returns a new instance of Event.
|
113
114
|
#
|
114
|
-
# @param
|
115
|
-
# @param options [Hash]
|
116
|
-
# @param closure [Proc] The code to be executed when the event is triggered.
|
115
|
+
# @param (see Vedeu::Event.bind)
|
117
116
|
# @return [Event]
|
118
117
|
def initialize(name, options = {}, closure)
|
119
118
|
@name = name
|
@@ -237,6 +236,8 @@ module Vedeu
|
|
237
236
|
false
|
238
237
|
end
|
239
238
|
|
239
|
+
# Returns the time in seconds since the last triggering of this event.
|
240
|
+
#
|
240
241
|
# @return [Float]
|
241
242
|
def elapsed_time
|
242
243
|
now - @executed_at
|
@@ -257,16 +258,23 @@ module Vedeu
|
|
257
258
|
@now = 0
|
258
259
|
end
|
259
260
|
|
261
|
+
# Returns a boolean indicating if this event has a deadline.
|
262
|
+
#
|
260
263
|
# @return [Boolean]
|
261
264
|
def has_deadline?
|
262
265
|
@deadline > 0
|
263
266
|
end
|
264
267
|
|
268
|
+
# Resets the deadline of this event.
|
269
|
+
#
|
265
270
|
# @return [Fixnum]
|
266
271
|
def reset_deadline
|
267
272
|
@deadline = 0
|
268
273
|
end
|
269
274
|
|
275
|
+
# Sets the deadline for when this event can be executed to a point in the
|
276
|
+
# future determined by the amount of debounce time left.
|
277
|
+
#
|
270
278
|
# @return [NilClass]
|
271
279
|
def set_deadline
|
272
280
|
@deadline = now + debounce
|
data/lib/vedeu/events/trigger.rb
CHANGED
@@ -18,15 +18,16 @@ module Vedeu
|
|
18
18
|
new(name, *args).trigger
|
19
19
|
end
|
20
20
|
|
21
|
-
# @see
|
22
|
-
# @return [Trigger]
|
21
|
+
# @param (see .trigger)
|
22
|
+
# @return [Vedeu::Trigger]
|
23
23
|
def initialize(name, *args)
|
24
24
|
@name = name
|
25
25
|
@args = args
|
26
26
|
@repository = Vedeu.events
|
27
27
|
end
|
28
28
|
|
29
|
-
#
|
29
|
+
# Trigger the event and return the result (if one) or an array of results.
|
30
|
+
#
|
30
31
|
# @return [Array]
|
31
32
|
def trigger
|
32
33
|
if results.one?
|
@@ -57,6 +58,8 @@ module Vedeu
|
|
57
58
|
@results ||= registered_events.map { |event| event.trigger(*args) }
|
58
59
|
end
|
59
60
|
|
61
|
+
# Return all of the registered events for this name.
|
62
|
+
#
|
60
63
|
# @return [Array|Array<Vedeu::Event>]
|
61
64
|
def registered_events
|
62
65
|
return [] unless repository.registered?(name)
|
data/lib/vedeu/geometry/all.rb
CHANGED
@@ -1,6 +1,11 @@
|
|
1
|
+
require 'vedeu/geometry/area'
|
1
2
|
require 'vedeu/geometry/bounding_area'
|
2
|
-
require 'vedeu/geometry/
|
3
|
+
require 'vedeu/geometry/canvas'
|
4
|
+
require 'vedeu/geometry/centre'
|
5
|
+
require 'vedeu/geometry/content'
|
3
6
|
require 'vedeu/geometry/coordinate'
|
7
|
+
require 'vedeu/geometry/dimension'
|
8
|
+
require 'vedeu/geometry/geometry'
|
4
9
|
require 'vedeu/geometry/grid'
|
5
10
|
require 'vedeu/geometry/index_position'
|
6
11
|
require 'vedeu/geometry/limit'
|