vedeu 0.6.8 → 0.6.9
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.yardopts +9 -0
- data/README.md +1 -1
- data/docs/api.md +60 -67
- data/docs/configuration.md +8 -5
- data/docs/events.md +31 -15
- data/docs/events/application.md +12 -0
- data/docs/events/document.md +57 -0
- data/docs/events/drb.md +43 -0
- data/docs/events/focus.md +24 -0
- data/docs/events/menu.md +57 -0
- data/docs/events/movement.md +57 -0
- data/docs/events/refresh.md +25 -0
- data/docs/events/system.md +90 -0
- data/docs/events/visibility.md +68 -0
- data/lib/vedeu.rb +2 -2
- data/lib/vedeu/all.rb +3 -2
- data/lib/vedeu/api.rb +18 -18
- data/lib/vedeu/application/controller.rb +1 -1
- data/lib/vedeu/application/helper.rb +1 -1
- data/lib/vedeu/application/view.rb +1 -1
- data/lib/vedeu/bindings/application.rb +1 -12
- data/lib/vedeu/bindings/bindings.rb +3 -1
- data/lib/vedeu/bindings/document.rb +9 -62
- data/lib/vedeu/bindings/drb.rb +12 -56
- data/lib/vedeu/bindings/focus.rb +3 -28
- data/lib/vedeu/bindings/menus.rb +10 -66
- data/lib/vedeu/bindings/movement.rb +4 -69
- data/lib/vedeu/bindings/refresh.rb +3 -33
- data/lib/vedeu/bindings/system.rb +14 -100
- data/lib/vedeu/bindings/visibility.rb +20 -71
- data/lib/vedeu/borders/all.rb +4 -3
- data/lib/vedeu/borders/border.rb +39 -33
- data/lib/vedeu/borders/dsl.rb +40 -33
- data/lib/vedeu/borders/null.rb +2 -2
- data/lib/vedeu/borders/render.rb +29 -24
- data/lib/vedeu/borders/repository.rb +2 -2
- data/lib/vedeu/buffers/all.rb +8 -7
- data/lib/vedeu/buffers/buffer.rb +47 -39
- data/lib/vedeu/buffers/null.rb +2 -2
- data/lib/vedeu/buffers/refresh.rb +4 -3
- data/lib/vedeu/buffers/virtual_buffer.rb +122 -118
- data/lib/vedeu/buffers/virtual_buffers.rb +62 -56
- data/lib/vedeu/colours/background.rb +2 -1
- data/lib/vedeu/colours/colour.rb +21 -19
- data/lib/vedeu/colours/foreground.rb +2 -1
- data/lib/vedeu/colours/repository.rb +6 -5
- data/lib/vedeu/colours/translator.rb +39 -35
- data/lib/vedeu/configuration/api.rb +59 -51
- data/lib/vedeu/configuration/cli.rb +9 -7
- data/lib/vedeu/configuration/configuration.rb +41 -32
- data/lib/vedeu/cursors/cursor.rb +1 -1
- data/lib/vedeu/cursors/refresh.rb +20 -16
- data/lib/vedeu/distributed/server.rb +8 -6
- data/lib/vedeu/distributed/subprocess.rb +90 -86
- data/lib/vedeu/distributed/uri.rb +4 -3
- data/lib/vedeu/dsl/composition.rb +2 -2
- data/lib/vedeu/dsl/group.rb +4 -4
- data/lib/vedeu/dsl/interface.rb +5 -5
- data/lib/vedeu/dsl/presentation.rb +2 -2
- data/lib/vedeu/dsl/text.rb +1 -1
- data/lib/vedeu/editor/cropper.rb +4 -4
- data/lib/vedeu/editor/cursor.rb +6 -4
- data/lib/vedeu/editor/document.rb +20 -18
- data/lib/vedeu/editor/editor.rb +2 -2
- data/lib/vedeu/editor/line.rb +10 -5
- data/lib/vedeu/editor/lines.rb +2 -2
- data/lib/vedeu/internal_api.rb +4 -4
- data/lib/vedeu/models/focus.rb +197 -191
- data/lib/vedeu/models/group.rb +171 -159
- data/lib/vedeu/models/groups.rb +14 -10
- data/lib/vedeu/models/interface.rb +116 -110
- data/lib/vedeu/models/interfaces.rb +24 -20
- data/lib/vedeu/models/toggleable.rb +4 -4
- data/lib/vedeu/models/views/char.rb +1 -1
- data/lib/vedeu/models/views/composition.rb +1 -1
- data/lib/vedeu/models/views/line.rb +1 -1
- data/lib/vedeu/models/views/stream.rb +1 -1
- data/lib/vedeu/models/views/view.rb +1 -1
- data/lib/vedeu/null/interface.rb +1 -1
- data/lib/vedeu/null/view.rb +1 -1
- data/lib/vedeu/output/clear/named_interface.rb +1 -1
- data/lib/vedeu/output/compressor.rb +78 -73
- data/lib/vedeu/output/direct.rb +61 -57
- data/lib/vedeu/output/output.rb +34 -29
- data/lib/vedeu/output/{presentation.rb → presentation/presentation.rb} +2 -1
- data/lib/vedeu/output/presentation/style.rb +64 -18
- data/lib/vedeu/output/presentation/styles.rb +39 -0
- data/lib/vedeu/output/renderers/html.rb +2 -2
- data/lib/vedeu/output/renderers/json.rb +2 -1
- data/lib/vedeu/output/renderers/terminal.rb +3 -3
- data/lib/vedeu/output/renderers/text.rb +3 -3
- data/lib/vedeu/output/text.rb +186 -180
- data/lib/vedeu/output/wordwrap.rb +142 -138
- data/lib/vedeu/refresh/refresh.rb +2 -2
- data/lib/vedeu/templating/helpers.rb +11 -6
- data/lib/vedeu/templating/view_template.rb +1 -1
- data/lib/vedeu/terminal/terminal.rb +2 -2
- data/lib/vedeu/version.rb +1 -1
- data/test/lib/vedeu/borders/render_test.rb +1 -1
- data/test/lib/vedeu/buffers/buffer_test.rb +16 -14
- data/test/lib/vedeu/buffers/virtual_buffer_test.rb +105 -101
- data/test/lib/vedeu/buffers/virtual_buffers_test.rb +43 -39
- data/test/lib/vedeu/colours/colour_test.rb +4 -4
- data/test/lib/vedeu/cursors/cursor_test.rb +2 -2
- data/test/lib/vedeu/cursors/repository_test.rb +3 -3
- data/test/lib/vedeu/distributed/subprocess_test.rb +33 -29
- data/test/lib/vedeu/dsl/group_test.rb +3 -3
- data/test/lib/vedeu/dsl/interface_test.rb +6 -5
- data/test/lib/vedeu/dsl/line_test.rb +4 -2
- data/test/lib/vedeu/dsl/presentation_test.rb +2 -2
- data/test/lib/vedeu/dsl/text_test.rb +8 -8
- data/test/lib/vedeu/editor/document_test.rb +10 -6
- data/test/lib/vedeu/input/keymap_test.rb +1 -10
- data/test/lib/vedeu/models/focus_test.rb +177 -170
- data/test/lib/vedeu/models/group_test.rb +99 -95
- data/test/lib/vedeu/models/groups_test.rb +13 -9
- data/test/lib/vedeu/models/interface_test.rb +93 -87
- data/test/lib/vedeu/models/interfaces_test.rb +24 -20
- data/test/lib/vedeu/models/views/char_test.rb +2 -2
- data/test/lib/vedeu/models/views/line_test.rb +11 -7
- data/test/lib/vedeu/models/views/stream_test.rb +1 -1
- data/test/lib/vedeu/models/views/view_test.rb +1 -1
- data/test/lib/vedeu/output/clear/named_group_test.rb +1 -1
- data/test/lib/vedeu/output/clear/named_interface_test.rb +3 -1
- data/test/lib/vedeu/output/compressor_test.rb +126 -122
- data/test/lib/vedeu/output/direct_test.rb +49 -43
- data/test/lib/vedeu/output/output_test.rb +35 -31
- data/test/lib/vedeu/output/{presentation_test.rb → presentation/presentation_test.rb} +11 -7
- data/test/lib/vedeu/output/presentation/style_test.rb +88 -48
- data/test/lib/vedeu/output/presentation/styles_test.rb +84 -0
- data/test/lib/vedeu/output/text_test.rb +109 -105
- data/test/lib/vedeu/output/viewport_test.rb +3 -1
- data/test/lib/vedeu/output/wordwrap_test.rb +209 -205
- data/test/lib/vedeu/refresh/refresh_test.rb +3 -1
- data/test/lib/vedeu/templating/helpers_test.rb +6 -6
- data/test/lib/vedeu/templating/view_template_test.rb +1 -1
- metadata +17 -8
- data/lib/vedeu/output/style.rb +0 -76
- data/test/lib/vedeu/output/style_test.rb +0 -120
data/lib/vedeu/models/group.rb
CHANGED
@@ -1,163 +1,175 @@
|
|
1
1
|
module Vedeu
|
2
2
|
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
@
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
|
140
|
-
|
141
|
-
|
142
|
-
|
143
|
-
|
144
|
-
|
145
|
-
|
146
|
-
|
147
|
-
|
148
|
-
|
149
|
-
|
150
|
-
|
151
|
-
|
152
|
-
|
153
|
-
|
154
|
-
|
155
|
-
|
156
|
-
|
157
|
-
|
158
|
-
|
159
|
-
|
160
|
-
|
161
|
-
|
3
|
+
module Models
|
4
|
+
|
5
|
+
# Interfaces can be associated with one another by being members
|
6
|
+
# of the same Group. A Group is a collection of interface names.
|
7
|
+
#
|
8
|
+
class Group
|
9
|
+
|
10
|
+
include Vedeu::Model
|
11
|
+
include Vedeu::Toggleable
|
12
|
+
|
13
|
+
# @!attribute [rw] name
|
14
|
+
# @return [String]
|
15
|
+
attr_accessor :name
|
16
|
+
|
17
|
+
# Return a new instance of Vedeu::Models::Group.
|
18
|
+
#
|
19
|
+
# @note
|
20
|
+
# A group being visible or not may not necessarily mean the
|
21
|
+
# members are of the same state.
|
22
|
+
#
|
23
|
+
# @param attributes [Hash]
|
24
|
+
# @option attributes members [Set] A collection of names of
|
25
|
+
# interfaces belonging to this group.
|
26
|
+
# @option attributes name [String] The name of the group.
|
27
|
+
# @option attributes repository [Vedeu::Repository] The storage
|
28
|
+
# for all Group models.
|
29
|
+
# @option attributes visible [Boolean] Whether the group is
|
30
|
+
# visible or not.
|
31
|
+
# @return [Vedeu::Models::Group]
|
32
|
+
def initialize(attributes = {})
|
33
|
+
@attributes = defaults.merge!(attributes)
|
34
|
+
|
35
|
+
@attributes.each do |key, value|
|
36
|
+
instance_variable_set("@#{key}", value)
|
37
|
+
end
|
38
|
+
end
|
39
|
+
|
40
|
+
# Add a member to the group by name.
|
41
|
+
#
|
42
|
+
# @param member [String]
|
43
|
+
# @return [Vedeu::Models::Group]
|
44
|
+
def add(member)
|
45
|
+
attrs = attributes.merge!(members: members.add(member))
|
46
|
+
|
47
|
+
Vedeu::Models::Group.new(attrs).store
|
48
|
+
end
|
49
|
+
|
50
|
+
# Returns the attributes of the group.
|
51
|
+
#
|
52
|
+
# @return [Hash<Symbol => void>]
|
53
|
+
def attributes
|
54
|
+
{
|
55
|
+
name: name,
|
56
|
+
members: members,
|
57
|
+
repository: repository,
|
58
|
+
visible: visible,
|
59
|
+
}
|
60
|
+
end
|
61
|
+
|
62
|
+
# Return the members of the group sorted by the zindex of the
|
63
|
+
# members.
|
64
|
+
#
|
65
|
+
# @return [Array<String>]
|
66
|
+
def by_zindex
|
67
|
+
interfaces.sort { |a, b| a.zindex <=> b.zindex }.map(&:name)
|
68
|
+
end
|
69
|
+
|
70
|
+
# Hide the named group of interfaces, or without a name, the group of the
|
71
|
+
# currently focussed interface. Useful for hiding part of that which is
|
72
|
+
# currently displaying in the terminal.
|
73
|
+
#
|
74
|
+
# @note
|
75
|
+
# The action of showing a group will effectively clear the terminal and
|
76
|
+
# show the new group, therefore hiding the group may not be necessary.
|
77
|
+
#
|
78
|
+
# @example
|
79
|
+
# Vedeu.trigger(:_hide_group_, name)
|
80
|
+
# Vedeu.hide_group(name)
|
81
|
+
#
|
82
|
+
# @return [Vedeu::Models::Group]
|
83
|
+
def hide
|
84
|
+
super
|
85
|
+
|
86
|
+
@members.each do |member|
|
87
|
+
Vedeu::Models::Interface.hide_interface(member)
|
88
|
+
end
|
89
|
+
|
90
|
+
self
|
91
|
+
end
|
92
|
+
|
93
|
+
# Return the members of the group.
|
94
|
+
#
|
95
|
+
# @return [Set]
|
96
|
+
def members
|
97
|
+
@_members ||= Set.new(@members)
|
98
|
+
end
|
99
|
+
|
100
|
+
# Remove a member from the group by name.
|
101
|
+
#
|
102
|
+
# @param member [String]
|
103
|
+
# @return [Vedeu::Models::Group]
|
104
|
+
def remove(member)
|
105
|
+
attrs = attributes.merge!(members: members.delete(member))
|
106
|
+
|
107
|
+
Vedeu::Models::Group.new(attrs).store
|
108
|
+
end
|
109
|
+
|
110
|
+
# Remove all members from the group.
|
111
|
+
#
|
112
|
+
# @return [Vedeu::Models::Group]
|
113
|
+
def reset
|
114
|
+
attrs = defaults.merge!(name: name)
|
115
|
+
|
116
|
+
Vedeu::Models::Group.new(attrs).store
|
117
|
+
end
|
118
|
+
|
119
|
+
# Show the named group of interfaces, or without a name, the group of the
|
120
|
+
# currently focussed interface.
|
121
|
+
#
|
122
|
+
# @example
|
123
|
+
# Vedeu.trigger(:_show_group_, name)
|
124
|
+
# Vedeu.show_group(name)
|
125
|
+
#
|
126
|
+
# @return [Vedeu::Models::Group]
|
127
|
+
def show
|
128
|
+
super
|
129
|
+
|
130
|
+
@members.each do |member|
|
131
|
+
Vedeu::Models::Interface.show_interface(member)
|
132
|
+
end
|
133
|
+
|
134
|
+
self
|
135
|
+
end
|
136
|
+
|
137
|
+
# Toggle the visibility of the group with the given name.
|
138
|
+
#
|
139
|
+
# @example
|
140
|
+
# Vedeu.trigger(:_toggle_group, name)
|
141
|
+
# Vedeu.toggle_group(name)
|
142
|
+
#
|
143
|
+
# @return [Vedeu::Models::Group]
|
144
|
+
def toggle
|
145
|
+
super
|
146
|
+
|
147
|
+
self
|
148
|
+
end
|
149
|
+
|
150
|
+
private
|
151
|
+
|
152
|
+
# Returns the default options/attributes for this class.
|
153
|
+
#
|
154
|
+
# @return [Hash]
|
155
|
+
def defaults
|
156
|
+
{
|
157
|
+
members: Set.new,
|
158
|
+
name: '',
|
159
|
+
repository: Vedeu.groups,
|
160
|
+
visible: true,
|
161
|
+
}
|
162
|
+
end
|
163
|
+
|
164
|
+
# Return the interfaces for all members of the group.
|
165
|
+
#
|
166
|
+
# @return [Array<Vedeu::Models::Interface]
|
167
|
+
def interfaces
|
168
|
+
members.map { |name| Vedeu.interfaces.by_name(name) }
|
169
|
+
end
|
170
|
+
|
171
|
+
end # Group
|
172
|
+
|
173
|
+
end # Models
|
162
174
|
|
163
175
|
end # Vedeu
|
data/lib/vedeu/models/groups.rb
CHANGED
@@ -1,20 +1,24 @@
|
|
1
1
|
module Vedeu
|
2
2
|
|
3
|
-
|
4
|
-
#
|
5
|
-
class Groups < Vedeu::Repository
|
3
|
+
module Models
|
6
4
|
|
7
|
-
|
5
|
+
# Allows the storing of view groups.
|
6
|
+
#
|
7
|
+
class Groups < Vedeu::Repository
|
8
8
|
|
9
|
-
|
10
|
-
real Vedeu::Group
|
9
|
+
singleton_class.send(:alias_method, :groups, :repository)
|
11
10
|
|
12
|
-
|
11
|
+
null Vedeu::Models::Group
|
12
|
+
real Vedeu::Models::Group
|
13
13
|
|
14
|
-
|
14
|
+
end # Groups
|
15
15
|
|
16
|
-
|
16
|
+
class Group
|
17
17
|
|
18
|
-
|
18
|
+
repo Vedeu::Models::Groups.repository
|
19
|
+
|
20
|
+
end # Group
|
21
|
+
|
22
|
+
end # Models
|
19
23
|
|
20
24
|
end # Vedeu
|
@@ -1,125 +1,131 @@
|
|
1
1
|
module Vedeu
|
2
2
|
|
3
|
-
|
4
|
-
# {Vedeu::Geometry::Geometry}.
|
5
|
-
#
|
6
|
-
class Interface
|
3
|
+
module Models
|
7
4
|
|
8
|
-
|
9
|
-
|
10
|
-
include Vedeu::Toggleable
|
11
|
-
|
12
|
-
# @!attribute [r] attributes
|
13
|
-
# @return [Hash]
|
14
|
-
attr_reader :attributes
|
15
|
-
|
16
|
-
# @!attribute [rw] client
|
17
|
-
# @return [Fixnum|Float]
|
18
|
-
attr_accessor :client
|
19
|
-
|
20
|
-
# @!attribute [rw] delay
|
21
|
-
# @return [Fixnum|Float]
|
22
|
-
attr_accessor :delay
|
23
|
-
|
24
|
-
# @!attribute [rw] group
|
25
|
-
# @return [Symbol|String]
|
26
|
-
attr_accessor :group
|
27
|
-
|
28
|
-
# @!attribute [rw] name
|
29
|
-
# @return [String]
|
30
|
-
attr_accessor :name
|
31
|
-
|
32
|
-
# @!attribute [rw] parent
|
33
|
-
# @return [Vedeu::Views::Composition]
|
34
|
-
attr_accessor :parent
|
35
|
-
|
36
|
-
# @!attribute [rw] zindex
|
37
|
-
# @return [Fixnum]
|
38
|
-
attr_accessor :zindex
|
39
|
-
|
40
|
-
# Return a new instance of Vedeu::Interface.
|
41
|
-
#
|
42
|
-
# @param attributes [Hash]
|
43
|
-
# @option attributes client [Vedeu::Client]
|
44
|
-
# @option attributes colour [Vedeu::Colours::Colour]
|
45
|
-
# @option attributes delay [Float]
|
46
|
-
# @option attributes group [String]
|
47
|
-
# @option attributes name [String]
|
48
|
-
# @option attributes parent [Vedeu::Views::Composition]
|
49
|
-
# @option attributes repository [Vedeu::Interfaces]
|
50
|
-
# @option attributes style [Vedeu::Style]
|
51
|
-
# @option attributes visible [Boolean]
|
52
|
-
# @option attributes zindex [Fixnum]
|
53
|
-
# @return [Vedeu::Interface]
|
54
|
-
def initialize(attributes = {})
|
55
|
-
@attributes = defaults.merge!(attributes)
|
56
|
-
|
57
|
-
@attributes.each { |key, value| instance_variable_set("@#{key}", value) }
|
58
|
-
end
|
59
|
-
|
60
|
-
# Hide a named interface buffer, or without a name, the buffer of the
|
61
|
-
# currently focussed interface.
|
62
|
-
#
|
63
|
-
# @example
|
64
|
-
# Vedeu.hide_interface(name)
|
5
|
+
# An Interface represents a portion of the terminal defined by
|
6
|
+
# {Vedeu::Geometry::Geometry}.
|
65
7
|
#
|
66
|
-
|
67
|
-
|
68
|
-
|
8
|
+
class Interface
|
9
|
+
|
10
|
+
include Vedeu::Model
|
11
|
+
include Vedeu::Presentation
|
12
|
+
include Vedeu::Toggleable
|
13
|
+
|
14
|
+
# @!attribute [r] attributes
|
15
|
+
# @return [Hash]
|
16
|
+
attr_reader :attributes
|
17
|
+
|
18
|
+
# @!attribute [rw] client
|
19
|
+
# @return [Fixnum|Float]
|
20
|
+
attr_accessor :client
|
21
|
+
|
22
|
+
# @!attribute [rw] delay
|
23
|
+
# @return [Fixnum|Float]
|
24
|
+
attr_accessor :delay
|
25
|
+
|
26
|
+
# @!attribute [rw] group
|
27
|
+
# @return [Symbol|String]
|
28
|
+
attr_accessor :group
|
29
|
+
|
30
|
+
# @!attribute [rw] name
|
31
|
+
# @return [String]
|
32
|
+
attr_accessor :name
|
33
|
+
|
34
|
+
# @!attribute [rw] parent
|
35
|
+
# @return [Vedeu::Views::Composition]
|
36
|
+
attr_accessor :parent
|
37
|
+
|
38
|
+
# @!attribute [rw] zindex
|
39
|
+
# @return [Fixnum]
|
40
|
+
attr_accessor :zindex
|
41
|
+
|
42
|
+
# Return a new instance of Vedeu::Models::Interface.
|
43
|
+
#
|
44
|
+
# @param attributes [Hash]
|
45
|
+
# @option attributes client [Vedeu::Client]
|
46
|
+
# @option attributes colour [Vedeu::Colours::Colour]
|
47
|
+
# @option attributes delay [Float]
|
48
|
+
# @option attributes group [String]
|
49
|
+
# @option attributes name [String]
|
50
|
+
# @option attributes parent [Vedeu::Views::Composition]
|
51
|
+
# @option attributes repository [Vedeu::Models::Interfaces]
|
52
|
+
# @option attributes style [Vedeu::Presentation::Style]
|
53
|
+
# @option attributes visible [Boolean]
|
54
|
+
# @option attributes zindex [Fixnum]
|
55
|
+
# @return [Vedeu::Models::Interface]
|
56
|
+
def initialize(attributes = {})
|
57
|
+
@attributes = defaults.merge!(attributes)
|
58
|
+
|
59
|
+
@attributes.each do |key, value|
|
60
|
+
instance_variable_set("@#{key}", value)
|
61
|
+
end
|
62
|
+
end
|
69
63
|
|
70
|
-
|
71
|
-
|
64
|
+
# Hide a named interface buffer, or without a name, the buffer of the
|
65
|
+
# currently focussed interface.
|
66
|
+
#
|
67
|
+
# @example
|
68
|
+
# Vedeu.hide_interface(name)
|
69
|
+
#
|
70
|
+
# @return [void]
|
71
|
+
def hide
|
72
|
+
super
|
73
|
+
|
74
|
+
Vedeu.buffers.by_name(name).hide
|
75
|
+
end
|
72
76
|
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
77
|
+
# Show the named interface buffer, or without a name, the buffer of the
|
78
|
+
# currently focussed interface.
|
79
|
+
#
|
80
|
+
# @example
|
81
|
+
# Vedeu.show_interface(name)
|
82
|
+
#
|
83
|
+
# @return [void]
|
84
|
+
def show
|
85
|
+
super
|
86
|
+
|
87
|
+
Vedeu.buffers.by_name(name).show
|
88
|
+
end
|
82
89
|
|
83
|
-
|
84
|
-
|
90
|
+
# Toggle the visibility of the interface with the given name.
|
91
|
+
#
|
92
|
+
# @example
|
93
|
+
# Vedeu.toggle_interface(name)
|
94
|
+
#
|
95
|
+
# @return [void]
|
96
|
+
def toggle
|
97
|
+
if visible?
|
98
|
+
hide
|
85
99
|
|
86
|
-
|
87
|
-
|
88
|
-
# @example
|
89
|
-
# Vedeu.toggle_interface(name)
|
90
|
-
#
|
91
|
-
# @return [void]
|
92
|
-
def toggle
|
93
|
-
if visible?
|
94
|
-
hide
|
100
|
+
else
|
101
|
+
show
|
95
102
|
|
96
|
-
|
97
|
-
|
103
|
+
end
|
104
|
+
end
|
98
105
|
|
106
|
+
private
|
107
|
+
|
108
|
+
# The default values for a new instance of this class.
|
109
|
+
#
|
110
|
+
# @return [Hash]
|
111
|
+
def defaults
|
112
|
+
{
|
113
|
+
client: nil,
|
114
|
+
colour: Vedeu::Colours::Colour.coerce(background: :default,
|
115
|
+
foreground: :default),
|
116
|
+
delay: 0.0,
|
117
|
+
group: '',
|
118
|
+
name: '',
|
119
|
+
parent: nil,
|
120
|
+
repository: Vedeu.interfaces,
|
121
|
+
style: :normal,
|
122
|
+
visible: true,
|
123
|
+
zindex: 0,
|
124
|
+
}
|
99
125
|
end
|
100
|
-
end
|
101
126
|
|
102
|
-
|
127
|
+
end # Interface
|
103
128
|
|
104
|
-
|
105
|
-
#
|
106
|
-
# @return [Hash]
|
107
|
-
def defaults
|
108
|
-
{
|
109
|
-
client: nil,
|
110
|
-
colour: Vedeu::Colours::Colour.coerce(background: :default,
|
111
|
-
foreground: :default),
|
112
|
-
delay: 0.0,
|
113
|
-
group: '',
|
114
|
-
name: '',
|
115
|
-
parent: nil,
|
116
|
-
repository: Vedeu.interfaces,
|
117
|
-
style: :normal,
|
118
|
-
visible: true,
|
119
|
-
zindex: 0,
|
120
|
-
}
|
121
|
-
end
|
122
|
-
|
123
|
-
end # Interface
|
129
|
+
end # Models
|
124
130
|
|
125
131
|
end # Vedeu
|