vedeu 0.4.24 → 0.4.25
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/examples/material_colours_app.rb +27 -11
- data/lib/vedeu/bindings.rb +22 -64
- data/lib/vedeu/cursor/cursor.rb +13 -9
- data/lib/vedeu/cursor/move.rb +68 -38
- data/lib/vedeu/debug.rb +5 -5
- data/lib/vedeu/distributed/uri.rb +1 -0
- data/lib/vedeu/geometry/geometry.rb +0 -22
- data/lib/vedeu/geometry/position.rb +1 -0
- data/lib/vedeu/models/all.rb +1 -0
- data/lib/vedeu/models/char.rb +7 -1
- data/lib/vedeu/models/escape_char.rb +49 -0
- data/lib/vedeu/output/border.rb +9 -8
- data/lib/vedeu/output/clear.rb +3 -1
- data/lib/vedeu/output/colour.rb +1 -0
- data/lib/vedeu/output/compressor.rb +6 -12
- data/lib/vedeu/output/presentation.rb +13 -6
- data/lib/vedeu/output/style.rb +1 -0
- data/lib/vedeu/output/translator.rb +1 -0
- data/lib/vedeu/output/viewport.rb +2 -1
- data/lib/vedeu/repositories/collection.rb +1 -0
- data/lib/vedeu/support/terminal.rb +6 -12
- data/test/lib/vedeu/cursor/cursor_test.rb +4 -4
- data/test/lib/vedeu/geometry/geometry_test.rb +0 -9
- data/test/lib/vedeu/models/escape_char_test.rb +56 -0
- data/test/lib/vedeu/output/compressor_test.rb +2 -8
- data/vedeu.gemspec +1 -1
- metadata +5 -5
- data/examples/cursor_app.rb +0 -126
- data/examples/lines_app.rb +0 -71
- data/examples/maximise_unmaximise_app.rb +0 -120
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA1:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: bb6dc29e78bc70eab80c780ef16626cddbdcdf0b
|
|
4
|
+
data.tar.gz: e83efc8abd484c8436ae562fd393bfb745706475
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: fe72d64a341a1447e93f85ffcc7213d3e598ad682ab912689be1c3a0b825c82c9dcaa4402513a9b738f0f9b43b18257d8d161ef384573248588c1690a40d2e4f
|
|
7
|
+
data.tar.gz: 183b719c6624c17c606fc29a3d163cd2b6ded9138a9943c032292f50a0155c8c47abc2474cfcd0da284a506c0830d48761cbcf18e679808b9daae2aaa17458db
|
|
@@ -5,23 +5,24 @@ $LOAD_PATH.unshift(lib_dir) unless $LOAD_PATH.include?(lib_dir)
|
|
|
5
5
|
|
|
6
6
|
require 'vedeu'
|
|
7
7
|
|
|
8
|
-
# An example application to demonstrate colours
|
|
8
|
+
# An example application to demonstrate colours, cursor and interface movement,
|
|
9
|
+
# maximising/unmaximising of interfaces and toggling of cursors and interfaces.
|
|
9
10
|
class VedeuMaterialColoursApp
|
|
10
11
|
|
|
11
12
|
include Vedeu
|
|
12
13
|
|
|
13
14
|
configure do
|
|
14
|
-
|
|
15
|
+
debug!
|
|
15
16
|
log '/tmp/vedeu_material_colours_app.log'
|
|
16
|
-
renderers Vedeu::Renderers::File
|
|
17
|
+
# renderers Vedeu::Renderers::File
|
|
17
18
|
end
|
|
18
19
|
|
|
19
20
|
interface 'main_interface' do
|
|
20
21
|
border 'main_interface' do
|
|
21
|
-
colour foreground: '#ffffff', background:
|
|
22
|
+
colour foreground: '#ffffff', background: :default
|
|
22
23
|
title 'Rainbow!'
|
|
23
24
|
end
|
|
24
|
-
colour foreground: '#ffffff', background:
|
|
25
|
+
colour foreground: '#ffffff', background: :default
|
|
25
26
|
cursor!
|
|
26
27
|
geometry 'main_interface' do
|
|
27
28
|
x 5
|
|
@@ -33,10 +34,10 @@ class VedeuMaterialColoursApp
|
|
|
33
34
|
|
|
34
35
|
interface 'other_interface' do
|
|
35
36
|
border 'other_interface' do
|
|
36
|
-
colour foreground: '#ffffff', background:
|
|
37
|
+
colour foreground: '#ffffff', background: :default
|
|
37
38
|
title 'Wow!'
|
|
38
39
|
end
|
|
39
|
-
colour foreground: '#ffffff', background:
|
|
40
|
+
colour foreground: '#ffffff', background: :default
|
|
40
41
|
cursor!
|
|
41
42
|
geometry 'other_interface' do
|
|
42
43
|
x 27
|
|
@@ -47,10 +48,21 @@ class VedeuMaterialColoursApp
|
|
|
47
48
|
end
|
|
48
49
|
|
|
49
50
|
keymap('_global_') do
|
|
50
|
-
key(:up
|
|
51
|
-
key(:right
|
|
52
|
-
key(:down
|
|
53
|
-
key(:left
|
|
51
|
+
key(:up) { Vedeu.trigger(:_cursor_up_) }
|
|
52
|
+
key(:right) { Vedeu.trigger(:_cursor_right_) }
|
|
53
|
+
key(:down) { Vedeu.trigger(:_cursor_down_) }
|
|
54
|
+
key(:left) { Vedeu.trigger(:_cursor_left_) }
|
|
55
|
+
|
|
56
|
+
key('a') { Vedeu.trigger(:_view_left_, 'main_interface') }
|
|
57
|
+
key('s') { Vedeu.trigger(:_view_down_, 'main_interface') }
|
|
58
|
+
key('d') { Vedeu.trigger(:_view_up_, 'main_interface') }
|
|
59
|
+
key('f') { Vedeu.trigger(:_view_right_, 'main_interface') }
|
|
60
|
+
|
|
61
|
+
key('h') { Vedeu.trigger(:_view_left_, 'other_interface') }
|
|
62
|
+
key('j') { Vedeu.trigger(:_view_down_, 'other_interface') }
|
|
63
|
+
key('k') { Vedeu.trigger(:_view_up_, 'other_interface') }
|
|
64
|
+
key('l') { Vedeu.trigger(:_view_right_, 'other_interface') }
|
|
65
|
+
|
|
54
66
|
key('t') do
|
|
55
67
|
Vedeu.trigger(:_toggle_interface_, 'main_interface')
|
|
56
68
|
Vedeu.trigger(:_toggle_interface_, 'other_interface')
|
|
@@ -59,6 +71,10 @@ class VedeuMaterialColoursApp
|
|
|
59
71
|
key('2') { Vedeu.trigger(:_show_interface_, 'main_interface') }
|
|
60
72
|
key('3') { Vedeu.trigger(:_hide_interface_, 'other_interface') }
|
|
61
73
|
key('4') { Vedeu.trigger(:_show_interface_, 'other_interface') }
|
|
74
|
+
key('m') { Vedeu.trigger(:_maximise_, 'main_interface') }
|
|
75
|
+
key('n') { Vedeu.trigger(:_unmaximise_, 'main_interface') }
|
|
76
|
+
key('b') { Vedeu.trigger(:_maximise_, 'other_interface') }
|
|
77
|
+
key('v') { Vedeu.trigger(:_unmaximise_, 'other_interface') }
|
|
62
78
|
end
|
|
63
79
|
|
|
64
80
|
renders do
|
data/lib/vedeu/bindings.rb
CHANGED
|
@@ -92,23 +92,17 @@ module Vedeu
|
|
|
92
92
|
end
|
|
93
93
|
|
|
94
94
|
# @see {Vedeu::Move}
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
Vedeu::Move.by_name(Vedeu::Cursor, :right, name)
|
|
107
|
-
end
|
|
108
|
-
|
|
109
|
-
# @see {Vedeu::Move}
|
|
110
|
-
Vedeu.bind(:_cursor_up_) do |name|
|
|
111
|
-
Vedeu::Move.by_name(Vedeu::Cursor, :up, name)
|
|
95
|
+
%w(cursor view).each do |model|
|
|
96
|
+
[:down, :left, :right, :up].each do |direction|
|
|
97
|
+
Vedeu.bind("_#{model}_#{direction}_".to_sym) do |name|
|
|
98
|
+
klass = {
|
|
99
|
+
'cursor' => Vedeu::Cursor,
|
|
100
|
+
'view' => Vedeu::Geometry,
|
|
101
|
+
}.fetch(model)
|
|
102
|
+
|
|
103
|
+
Vedeu::Move.by_name(klass, direction, name)
|
|
104
|
+
end
|
|
105
|
+
end
|
|
112
106
|
end
|
|
113
107
|
|
|
114
108
|
# @see {Vedeu::Move}
|
|
@@ -116,26 +110,6 @@ module Vedeu
|
|
|
116
110
|
Vedeu::Move.by_name(Vedeu::Cursor, :origin, name)
|
|
117
111
|
end
|
|
118
112
|
|
|
119
|
-
# @see {Vedeu::Move}
|
|
120
|
-
Vedeu.bind(:_geometry_down_) do |name|
|
|
121
|
-
Vedeu.geometries.by_name(name).move(1, 0)
|
|
122
|
-
end
|
|
123
|
-
|
|
124
|
-
# @see {Vedeu::Move}
|
|
125
|
-
Vedeu.bind(:_geometry_left_) do |name|
|
|
126
|
-
Vedeu.geometries.by_name(name).move(0, -1)
|
|
127
|
-
end
|
|
128
|
-
|
|
129
|
-
# @see {Vedeu::Move}
|
|
130
|
-
Vedeu.bind(:_geometry_right_) do |name|
|
|
131
|
-
Vedeu.geometries.by_name(name).move(0, 1)
|
|
132
|
-
end
|
|
133
|
-
|
|
134
|
-
# @see {Vedeu::Move}
|
|
135
|
-
Vedeu.bind(:_geometry_up_) do |name|
|
|
136
|
-
Vedeu.geometries.by_name(name).move(-1, 0)
|
|
137
|
-
end
|
|
138
|
-
|
|
139
113
|
# @see {Vedeu::Move}
|
|
140
114
|
Vedeu.bind(:_cursor_reset_) { |name| Vedeu.trigger(:_cursor_origin_, name) }
|
|
141
115
|
|
|
@@ -191,14 +165,10 @@ module Vedeu
|
|
|
191
165
|
# Clears the whole terminal space, or the named interface area to be cleared
|
|
192
166
|
# if given.
|
|
193
167
|
Vedeu.bind(:_clear_) do |name|
|
|
194
|
-
|
|
195
|
-
Vedeu::Clear.clear(Vedeu.interfaces.by_name(name),
|
|
196
|
-
clear_border: true, use_terminal_colours: true)
|
|
168
|
+
Vedeu::Terminal.clear unless name
|
|
197
169
|
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
Vedeu::Terminal.clear
|
|
201
|
-
end
|
|
170
|
+
Vedeu::Clear.clear(Vedeu.interfaces.by_name(name),
|
|
171
|
+
clear_border: true, use_terminal_colours: true)
|
|
202
172
|
end
|
|
203
173
|
|
|
204
174
|
# Clears the spaces occupied by the interfaces belonging to the named group.
|
|
@@ -237,27 +207,21 @@ module Vedeu
|
|
|
237
207
|
# This may be rarely used, since the action of showing a group using
|
|
238
208
|
# `Vedeu.trigger(:_show_group_, group_name)` will effectively clear the
|
|
239
209
|
# terminal and show the new group.
|
|
240
|
-
Vedeu.bind(:_hide_group_)
|
|
241
|
-
Vedeu.trigger(:_clear_group_, name)
|
|
242
|
-
end
|
|
210
|
+
Vedeu.bind(:_hide_group_) { |name| Vedeu.trigger(:_clear_group_, name) }
|
|
243
211
|
|
|
244
212
|
# Will hide the named interface. If the interface is currently visible, it
|
|
245
213
|
# will be cleared- rendered blank. To show the interface, the
|
|
246
214
|
# ':_show_interface_' event should be triggered.
|
|
247
215
|
# Triggering the ':_hide_group_' event to which this named interface belongs
|
|
248
216
|
# will also hide the interface.
|
|
249
|
-
Vedeu.bind(:_hide_interface_)
|
|
250
|
-
Vedeu.buffers.by_name(name).hide
|
|
251
|
-
end
|
|
217
|
+
Vedeu.bind(:_hide_interface_) { |name| Vedeu.buffers.by_name(name).hide }
|
|
252
218
|
|
|
253
219
|
# Will show the named interface. If the interface is currently invisible, it
|
|
254
220
|
# will be shown- rendered with its latest content. To hide the interface,
|
|
255
221
|
# the ':_hide_interface_' event should be triggered.
|
|
256
222
|
# Triggering the ':_show_group_' event to which this named interface belongs
|
|
257
223
|
# will also show the interface.
|
|
258
|
-
Vedeu.bind(:_show_interface_)
|
|
259
|
-
Vedeu.buffers.by_name(name).show
|
|
260
|
-
end
|
|
224
|
+
Vedeu.bind(:_show_interface_) { |name| Vedeu.buffers.by_name(name).show }
|
|
261
225
|
|
|
262
226
|
# Will toggle the visibility of the named interface. If the interface is
|
|
263
227
|
# currently visible, the area it occupies will be clears and the interface
|
|
@@ -269,24 +233,18 @@ module Vedeu
|
|
|
269
233
|
# or all of the interface's current position, the interface will overwrite
|
|
270
234
|
# this area- this may cause visual corruption.
|
|
271
235
|
Vedeu.bind(:_toggle_interface_) do |name|
|
|
272
|
-
if
|
|
273
|
-
|
|
236
|
+
if Vedeu.interfaces.by_name(name).visible?
|
|
237
|
+
Vedeu.trigger(:_hide_interface_, name)
|
|
274
238
|
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
else
|
|
279
|
-
Vedeu.trigger(:_show_interface_, name)
|
|
239
|
+
else
|
|
240
|
+
Vedeu.trigger(:_show_interface_, name)
|
|
280
241
|
|
|
281
|
-
end
|
|
282
242
|
end
|
|
283
243
|
end
|
|
284
244
|
|
|
285
245
|
# Will maximise the named interface geometry. This means it will occupy all
|
|
286
246
|
# of the available space on the terminal window.
|
|
287
|
-
Vedeu.bind(:_maximise_)
|
|
288
|
-
Vedeu.geometries.by_name(name).maximise
|
|
289
|
-
end
|
|
247
|
+
Vedeu.bind(:_maximise_) { |name| Vedeu.geometries.by_name(name).maximise }
|
|
290
248
|
|
|
291
249
|
# Will unmaximise the named interface geometry. Previously, if a geometry
|
|
292
250
|
# was maximised, then triggering the unmaximise event will return it to its
|
data/lib/vedeu/cursor/cursor.rb
CHANGED
|
@@ -4,11 +4,8 @@ module Vedeu
|
|
|
4
4
|
# visibility of the cursor within that interface.
|
|
5
5
|
class Cursor
|
|
6
6
|
|
|
7
|
-
extend Forwardable
|
|
8
7
|
include Vedeu::Model
|
|
9
8
|
|
|
10
|
-
def_delegators Vedeu::Esc, :hide_cursor, :show_cursor
|
|
11
|
-
|
|
12
9
|
# @!attribute [r] attributes
|
|
13
10
|
# @return [Hash]
|
|
14
11
|
attr_reader :attributes
|
|
@@ -97,6 +94,17 @@ module Vedeu
|
|
|
97
94
|
|
|
98
95
|
end
|
|
99
96
|
end
|
|
97
|
+
alias_method :to_str, :to_s
|
|
98
|
+
|
|
99
|
+
# @return [Vedeu::EscapeChar]
|
|
100
|
+
def hide_cursor
|
|
101
|
+
@hide_cursor ||= Vedeu::EscapeChar.new(Vedeu::Esc.hide_cursor)
|
|
102
|
+
end
|
|
103
|
+
|
|
104
|
+
# @return [Vedeu::EscapeChar]
|
|
105
|
+
def show_cursor
|
|
106
|
+
@show_cursor ||= Vedeu::EscapeChar.new(Vedeu::Esc.show_cursor)
|
|
107
|
+
end
|
|
100
108
|
|
|
101
109
|
private
|
|
102
110
|
|
|
@@ -133,13 +141,9 @@ module Vedeu
|
|
|
133
141
|
#
|
|
134
142
|
# @return [String]
|
|
135
143
|
def visibility
|
|
136
|
-
if visible?
|
|
137
|
-
show_cursor
|
|
138
|
-
|
|
139
|
-
else
|
|
140
|
-
hide_cursor
|
|
144
|
+
return show_cursor if visible?
|
|
141
145
|
|
|
142
|
-
|
|
146
|
+
hide_cursor
|
|
143
147
|
end
|
|
144
148
|
|
|
145
149
|
end # Cursor
|
data/lib/vedeu/cursor/move.rb
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
module Vedeu
|
|
2
2
|
|
|
3
|
-
# Adjusts the position of the cursor. To use this class, call the
|
|
4
|
-
# event:
|
|
3
|
+
# Adjusts the position of the cursor or view. To use this class, call the
|
|
4
|
+
# appropriate event:
|
|
5
5
|
#
|
|
6
6
|
# @example
|
|
7
7
|
# Vedeu.trigger(:_cursor_down_)
|
|
@@ -23,14 +23,28 @@ module Vedeu
|
|
|
23
23
|
# # Moves the cursor to the top left of the
|
|
24
24
|
# # named or current interface in focus.
|
|
25
25
|
#
|
|
26
|
+
# Vedeu.trigger(:_view_down_, 'my_interface')
|
|
27
|
+
# Vedeu.trigger(:_view_left_, 'my_interface')
|
|
28
|
+
# Vedeu.trigger(:_view_right_, 'my_interface')
|
|
29
|
+
# Vedeu.trigger(:_view_up_, 'my_interface')
|
|
30
|
+
#
|
|
26
31
|
# @note
|
|
27
|
-
# The cursor may not be visible, but it will still move if
|
|
28
|
-
#
|
|
32
|
+
# The cursor or view may not be visible, but it will still move if
|
|
33
|
+
# requested.
|
|
34
|
+
# The cursor will not exceed the border or boundary of the interface, or
|
|
35
|
+
# boundary of the visible terminal.
|
|
29
36
|
# The cursor will move freely within the bounds of the interface,
|
|
30
37
|
# irrespective of content.
|
|
38
|
+
# The view will not exceed the boundary of the visible terminal.
|
|
39
|
+
# The view will move freely within the bounds of the interface,
|
|
40
|
+
# irrespective of content.
|
|
31
41
|
class Move
|
|
32
42
|
|
|
33
|
-
|
|
43
|
+
extend Forwardable
|
|
44
|
+
|
|
45
|
+
def_delegators :geometry, :x, :xn, :y, :yn
|
|
46
|
+
|
|
47
|
+
# Move the named cursor or view, or that which is currently in focus in the
|
|
34
48
|
# specified direction.
|
|
35
49
|
#
|
|
36
50
|
# @param direction [Symbol] The direction of travel. Directions include:
|
|
@@ -46,7 +60,7 @@ module Vedeu
|
|
|
46
60
|
Vedeu::Move.send(direction, entity, name)
|
|
47
61
|
end
|
|
48
62
|
|
|
49
|
-
# Moves the cursor down by one row.
|
|
63
|
+
# Moves the cursor or view down by one row.
|
|
50
64
|
#
|
|
51
65
|
# @param entity [Class]
|
|
52
66
|
# @param name [String]
|
|
@@ -55,7 +69,7 @@ module Vedeu
|
|
|
55
69
|
new(entity, name, 1, 0).move
|
|
56
70
|
end
|
|
57
71
|
|
|
58
|
-
# Moves the cursor left by one column.
|
|
72
|
+
# Moves the cursor or view left by one column.
|
|
59
73
|
#
|
|
60
74
|
# @param entity [Class]
|
|
61
75
|
# @param name [String]
|
|
@@ -64,7 +78,7 @@ module Vedeu
|
|
|
64
78
|
new(entity, name, 0, -1).move
|
|
65
79
|
end
|
|
66
80
|
|
|
67
|
-
# Moves the cursor right by one column.
|
|
81
|
+
# Moves the cursor or view right by one column.
|
|
68
82
|
#
|
|
69
83
|
# @param entity [Class]
|
|
70
84
|
# @param name [String]
|
|
@@ -73,7 +87,7 @@ module Vedeu
|
|
|
73
87
|
new(entity, name, 0, 1).move
|
|
74
88
|
end
|
|
75
89
|
|
|
76
|
-
# Moves the cursor up by one row.
|
|
90
|
+
# Moves the cursor or view up by one row.
|
|
77
91
|
#
|
|
78
92
|
# @param entity [Class]
|
|
79
93
|
# @param name [String]
|
|
@@ -82,7 +96,8 @@ module Vedeu
|
|
|
82
96
|
new(entity, name, -1, 0).move
|
|
83
97
|
end
|
|
84
98
|
|
|
85
|
-
# Moves the cursor to the top left coordinate of the interface
|
|
99
|
+
# Moves the cursor or view to the top left coordinate of the interface or
|
|
100
|
+
# terminal screen.
|
|
86
101
|
#
|
|
87
102
|
# @param entity [Class]
|
|
88
103
|
# @param name [String]
|
|
@@ -94,7 +109,7 @@ module Vedeu
|
|
|
94
109
|
# Returns an instance of Vedeu::Move.
|
|
95
110
|
#
|
|
96
111
|
# @param entity [Class]
|
|
97
|
-
# @param name [String] The name of the cursor.
|
|
112
|
+
# @param name [String] The name of the cursor or view.
|
|
98
113
|
# @param dy [Fixnum] Move up (-1), or down (1), or no action (0).
|
|
99
114
|
# @param dx [Fixnum] Move left (-1), or right (1), or no action (0).
|
|
100
115
|
# @return [Move]
|
|
@@ -105,23 +120,52 @@ module Vedeu
|
|
|
105
120
|
@dx = dx
|
|
106
121
|
end
|
|
107
122
|
|
|
108
|
-
# Returns a newly positioned and stored
|
|
123
|
+
# Returns a newly positioned and stored cursor or view.
|
|
109
124
|
#
|
|
110
|
-
# @return [Cursor]
|
|
125
|
+
# @return [Vedeu::Cursor|Vedeu::Geometry]
|
|
111
126
|
def move
|
|
112
|
-
|
|
127
|
+
model = entity.new(merged_attributes).store
|
|
113
128
|
|
|
114
|
-
|
|
129
|
+
refresh
|
|
115
130
|
|
|
116
|
-
|
|
117
|
-
|
|
131
|
+
model
|
|
132
|
+
end
|
|
118
133
|
|
|
119
|
-
|
|
134
|
+
# @return [void]
|
|
135
|
+
def refresh
|
|
136
|
+
if entity.to_s == 'Vedeu::Geometry'
|
|
137
|
+
Vedeu.trigger(:_clear_)
|
|
138
|
+
Vedeu.trigger(:_refresh_)
|
|
139
|
+
Vedeu.trigger(:_clear_, name)
|
|
120
140
|
Vedeu.trigger(:_refresh_, name)
|
|
121
141
|
|
|
142
|
+
else
|
|
143
|
+
Vedeu.trigger(:_refresh_cursor_, name)
|
|
144
|
+
|
|
122
145
|
end
|
|
146
|
+
end
|
|
123
147
|
|
|
124
|
-
|
|
148
|
+
# @return [Hash<Symbol => Boolean,Fixnum, String>]
|
|
149
|
+
def merged_attributes
|
|
150
|
+
if entity.to_s == 'Vedeu::Geometry'
|
|
151
|
+
{
|
|
152
|
+
centred: false,
|
|
153
|
+
maximised: false,
|
|
154
|
+
name: name,
|
|
155
|
+
x: (x + dx),
|
|
156
|
+
y: (y + dy),
|
|
157
|
+
xn: (xn + dx),
|
|
158
|
+
yn: (yn + dy),
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
else
|
|
162
|
+
cursor.attributes.merge!(
|
|
163
|
+
x: x_position,
|
|
164
|
+
y: y_position,
|
|
165
|
+
ox: ox,
|
|
166
|
+
oy: oy)
|
|
167
|
+
|
|
168
|
+
end
|
|
125
169
|
end
|
|
126
170
|
|
|
127
171
|
protected
|
|
@@ -144,25 +188,6 @@ module Vedeu
|
|
|
144
188
|
|
|
145
189
|
private
|
|
146
190
|
|
|
147
|
-
# Retrieve the attributes of the cursor.
|
|
148
|
-
#
|
|
149
|
-
# @return [Hash<Symbol => Fixnum, String>]
|
|
150
|
-
def attributes
|
|
151
|
-
cursor.attributes
|
|
152
|
-
end
|
|
153
|
-
|
|
154
|
-
# Provide the new attributes for the cursor.
|
|
155
|
-
#
|
|
156
|
-
# @return [Hash<Symbol => Fixnum>]
|
|
157
|
-
def new_attributes
|
|
158
|
-
{
|
|
159
|
-
x: x_position,
|
|
160
|
-
y: y_position,
|
|
161
|
-
ox: ox,
|
|
162
|
-
oy: oy,
|
|
163
|
-
}
|
|
164
|
-
end
|
|
165
|
-
|
|
166
191
|
# Returns the cursors x position based on its current offset.
|
|
167
192
|
#
|
|
168
193
|
# @return [Fixnum]
|
|
@@ -187,6 +212,11 @@ module Vedeu
|
|
|
187
212
|
@cursor ||= Vedeu.cursors.by_name(name)
|
|
188
213
|
end
|
|
189
214
|
|
|
215
|
+
# @return (see Vedeu::Geometries#by_name)
|
|
216
|
+
def geometry
|
|
217
|
+
@geometry ||= Vedeu.geometries.by_name(name)
|
|
218
|
+
end
|
|
219
|
+
|
|
190
220
|
# Apply the direction amount to the cursor offset. If the offset is less
|
|
191
221
|
# than 0, correct to 0.
|
|
192
222
|
#
|