vedeu 0.8.4 → 0.8.5

Sign up to get free protection for your applications and to get access to all the features.
Files changed (156) hide show
  1. checksums.yaml +4 -4
  2. data/TODO.md +4 -0
  3. data/docs/dsl.md +1 -11
  4. data/docs/dsl/by_method/geometry/align.md +1 -0
  5. data/docs/dsl/by_method/geometry/align_bottom.md +40 -0
  6. data/docs/dsl/by_method/geometry/align_centre.md +40 -0
  7. data/docs/dsl/by_method/geometry/align_left.md +40 -0
  8. data/docs/dsl/by_method/geometry/align_middle.md +40 -0
  9. data/docs/dsl/by_method/geometry/align_right.md +40 -0
  10. data/docs/dsl/by_method/geometry/align_top.md +40 -0
  11. data/docs/dsl/by_method/geometry/columns.md +1 -0
  12. data/docs/dsl/by_method/geometry/height.md +0 -0
  13. data/docs/dsl/by_method/geometry/horizontal_alignment.md +1 -0
  14. data/docs/dsl/by_method/geometry/rows.md +1 -0
  15. data/docs/dsl/by_method/geometry/vertical_alignment.md +1 -0
  16. data/docs/dsl/by_method/geometry/width.md +0 -0
  17. data/docs/dsl/by_method/geometry/x.md +1 -0
  18. data/docs/dsl/by_method/geometry/xn.md +1 -0
  19. data/docs/dsl/by_method/geometry/y.md +1 -0
  20. data/docs/dsl/by_method/geometry/yn.md +1 -0
  21. data/docs/dsl/by_method/render.md +5 -1
  22. data/docs/dsl/by_method/renders.md +31 -1
  23. data/docs/dsl/by_method/view.md +26 -0
  24. data/docs/dsl/by_method/view/stream.md +18 -0
  25. data/docs/dsl/by_method/views.md +32 -1
  26. data/docs/events/by_name/set_border_caption.md +2 -4
  27. data/docs/events/by_name/set_border_title.md +2 -4
  28. data/examples/views/empty_template.rb +0 -4
  29. data/examples/views/full_screen.rb +30 -5
  30. data/examples/views/misc_view.rb +464 -0
  31. data/examples/views/wordwrap.rb +72 -0
  32. data/examples/views/wordwrap.txt +8 -0
  33. data/integrations/dsl_app_021.rb +127 -0
  34. data/integrations/dsl_app_022.rb +133 -0
  35. data/integrations/expected/342_streams.out +1 -1
  36. data/integrations/expected/dsl_app_001.out +1 -1
  37. data/integrations/expected/dsl_app_002.out +1 -1
  38. data/integrations/expected/dsl_app_003.out +1 -1
  39. data/integrations/expected/dsl_app_004.out +1 -1
  40. data/integrations/expected/dsl_app_005.out +1 -1
  41. data/integrations/expected/dsl_app_006.out +1 -1
  42. data/integrations/expected/dsl_app_007.out +1 -1
  43. data/integrations/expected/dsl_app_008.out +1 -1
  44. data/integrations/expected/dsl_app_009.out +1 -1
  45. data/integrations/expected/dsl_app_010.out +1 -1
  46. data/integrations/expected/dsl_app_011.out +1 -1
  47. data/integrations/expected/dsl_app_012.out +1 -1
  48. data/integrations/expected/dsl_app_013.out +1 -1
  49. data/integrations/expected/dsl_app_014.out +1 -1
  50. data/integrations/expected/dsl_app_015.out +1 -1
  51. data/integrations/expected/dsl_app_016.out +1 -1
  52. data/integrations/expected/dsl_app_021.out +1 -0
  53. data/integrations/expected/dsl_app_022.out +1 -0
  54. data/integrations/support/test_interface_021.rb +7 -0
  55. data/integrations/support/test_interface_022.rb +15 -0
  56. data/lib/vedeu/all.rb +4 -2
  57. data/lib/vedeu/borders/border.rb +22 -6
  58. data/lib/vedeu/borders/repository.rb +4 -8
  59. data/lib/vedeu/buffers/buffer.rb +9 -6
  60. data/lib/vedeu/buffers/empty.rb +26 -23
  61. data/lib/vedeu/buffers/view.rb +44 -41
  62. data/lib/vedeu/cells/cursor.rb +0 -2
  63. data/lib/vedeu/cells/empty.rb +0 -1
  64. data/lib/vedeu/cells/escape.rb +0 -2
  65. data/lib/vedeu/coercers/alignment.rb +58 -8
  66. data/lib/vedeu/coercers/horizontal_alignment.rb +13 -9
  67. data/lib/vedeu/coercers/vertical_alignment.rb +13 -8
  68. data/lib/vedeu/common.rb +1 -1
  69. data/lib/vedeu/configuration/configuration.rb +41 -3
  70. data/lib/vedeu/cursors/coordinate.rb +1 -3
  71. data/lib/vedeu/cursors/cursor.rb +2 -6
  72. data/lib/vedeu/dsl/all.rb +1 -2
  73. data/lib/vedeu/dsl/border.rb +6 -6
  74. data/lib/vedeu/dsl/elements.rb +2 -2
  75. data/lib/vedeu/dsl/geometry.rb +7 -7
  76. data/lib/vedeu/dsl/{string → helpers}/align.rb +0 -0
  77. data/lib/vedeu/dsl/helpers/all.rb +17 -0
  78. data/lib/vedeu/dsl/{attributes.rb → helpers/attributes.rb} +0 -0
  79. data/lib/vedeu/dsl/{string → helpers}/text.rb +0 -0
  80. data/lib/vedeu/dsl/{string → helpers}/truncate.rb +0 -0
  81. data/lib/vedeu/dsl/{string → helpers}/wordwrap.rb +0 -0
  82. data/lib/vedeu/dsl/view.rb +11 -19
  83. data/lib/vedeu/dsl/views.rb +16 -106
  84. data/lib/vedeu/geometries/all.rb +0 -1
  85. data/lib/vedeu/geometries/area/area.rb +6 -12
  86. data/lib/vedeu/geometries/area/dimension.rb +21 -44
  87. data/lib/vedeu/geometries/dsl/all.rb +0 -1
  88. data/lib/vedeu/geometries/dsl/dsl.rb +22 -31
  89. data/lib/vedeu/geometries/geometry.rb +6 -0
  90. data/lib/vedeu/geometries/position.rb +6 -3
  91. data/lib/vedeu/geometries/repository.rb +1 -1
  92. data/lib/vedeu/input/mouse.rb +1 -0
  93. data/lib/vedeu/logging/log.rb +3 -6
  94. data/lib/vedeu/menus/dsl.rb +4 -5
  95. data/lib/vedeu/output/compressor.rb +11 -1
  96. data/lib/vedeu/output/viewport.rb +59 -59
  97. data/lib/vedeu/presentation/all.rb +1 -2
  98. data/lib/vedeu/presentation/colour.rb +75 -3
  99. data/lib/vedeu/{geometries/positionable.rb → presentation/position.rb} +4 -4
  100. data/lib/vedeu/presentation/presentation.rb +1 -3
  101. data/lib/vedeu/presentation/styles.rb +16 -1
  102. data/lib/vedeu/repositories/all.rb +0 -1
  103. data/lib/vedeu/sentence.rb +91 -0
  104. data/lib/vedeu/support/point.rb +72 -0
  105. data/lib/vedeu/terminal/terminal.rb +11 -53
  106. data/lib/vedeu/version.rb +1 -1
  107. data/lib/vedeu/views/composition.rb +11 -1
  108. data/lib/vedeu/views/default_attributes.rb +2 -0
  109. data/lib/vedeu/views/line.rb +16 -1
  110. data/lib/vedeu/views/stream.rb +16 -1
  111. data/lib/vedeu/views/view.rb +25 -17
  112. data/test/lib/vedeu/borders/border_test.rb +20 -2
  113. data/test/lib/vedeu/buffers/buffer_test.rb +15 -2
  114. data/test/lib/vedeu/buffers/empty_test.rb +51 -18
  115. data/test/lib/vedeu/buffers/view_test.rb +2 -2
  116. data/test/lib/vedeu/coercers/alignment_test.rb +32 -0
  117. data/test/lib/vedeu/coercers/horizontal_alignment_test.rb +16 -0
  118. data/test/lib/vedeu/coercers/vertical_alignment_test.rb +16 -0
  119. data/test/lib/vedeu/cursors/cursor_test.rb +4 -4
  120. data/test/lib/vedeu/cursors/dsl_test.rb +35 -21
  121. data/test/lib/vedeu/dsl/elements_test.rb +94 -2
  122. data/test/lib/vedeu/dsl/{string → helpers}/align_test.rb +0 -0
  123. data/test/lib/vedeu/dsl/{attributes_test.rb → helpers/attributes_test.rb} +0 -0
  124. data/test/lib/vedeu/dsl/{string → helpers}/text_test.rb +0 -0
  125. data/test/lib/vedeu/dsl/{string → helpers}/truncate_test.rb +0 -0
  126. data/test/lib/vedeu/dsl/{string → helpers}/wordwrap_test.rb +0 -0
  127. data/test/lib/vedeu/dsl/view_test.rb +22 -4
  128. data/test/lib/vedeu/dsl/views_test.rb +8 -5
  129. data/test/lib/vedeu/geometries/dsl/dsl_test.rb +2 -159
  130. data/test/lib/vedeu/geometries/position_test.rb +118 -60
  131. data/test/lib/vedeu/input/mouse_test.rb +1 -6
  132. data/test/lib/vedeu/logging/log_test.rb +14 -3
  133. data/test/lib/vedeu/presentation/colour_test.rb +77 -0
  134. data/test/lib/vedeu/{geometries/positionable_test.rb → presentation/position_test.rb} +4 -4
  135. data/test/lib/vedeu/sentence_test.rb +49 -0
  136. data/test/lib/vedeu/support/point_test.rb +139 -0
  137. data/test/lib/vedeu/terminal/terminal_test.rb +3 -44
  138. data/test/lib/vedeu/views/composition_test.rb +24 -4
  139. data/test/lib/vedeu/views/default_attributes_test.rb +10 -2
  140. data/test/lib/vedeu/views/view_test.rb +8 -15
  141. data/test/support/examples/material_colours_app.rb +0 -6
  142. data/vedeu.gemspec +1 -1
  143. metadata +58 -38
  144. data/examples/views/lines_line_stream.rb +0 -95
  145. data/examples/views/lines_line_streams.rb +0 -75
  146. data/examples/views/lines_line_streams_stream.rb +0 -78
  147. data/examples/views/lines_line_streams_stream_stream.rb +0 -50
  148. data/examples/views/lines_streams.rb +0 -93
  149. data/lib/vedeu/dsl/string/all.rb +0 -16
  150. data/lib/vedeu/geometries/dsl/validator.rb +0 -62
  151. data/lib/vedeu/presentation/background.rb +0 -54
  152. data/lib/vedeu/presentation/foreground.rb +0 -54
  153. data/lib/vedeu/repositories/parent.rb +0 -34
  154. data/test/lib/vedeu/geometries/dsl/validator_test.rb +0 -85
  155. data/test/lib/vedeu/presentation/background_test.rb +0 -74
  156. data/test/lib/vedeu/presentation/foreground_test.rb +0 -75
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: abd33ac728a08d3f956652ebd9d8bac4b7c8174c
4
- data.tar.gz: 9a9e106f52a0313cd07403bf11e2a39ba68c187c
3
+ metadata.gz: 49ac999b75c8f827532fdfd56a33cdc5df094082
4
+ data.tar.gz: 0ce9c396da5d723b9859dd350e6549789646b9e9
5
5
  SHA512:
6
- metadata.gz: 44a86ea06288d4aa5addcd6a9035622e45f489e53c99214ac3191daf64662ea3d85044110a536ed0d30dcebcf2112ebddfddd3e54af71e3c3ae54d9c7d3b1cb1
7
- data.tar.gz: 48cd0c06ff4387e3629e07a162b9ca74b4172e8cf815fe9b93e15dd4f1a3d50c8b7e162ffe6438e72bb7e295e348449ddfcc811d2ebe6914d00f822e3b057094
6
+ metadata.gz: 32b568646e20740ceedb3993f87e9fd45ea8da54eb07103ea85811e67859d981168279075b45c48104aabbce542143651b2603518b0c2e7e3f1e1c8d6244f8ae
7
+ data.tar.gz: 5d5325bf31f0f0cbdbf99726413de072aef1f2b3bf9dd6ba52fb65dc40e6e2d4744bfcfd939edace218c61ac1ed568775af8e3ed8411d44c4da0006e6224a151
data/TODO.md ADDED
@@ -0,0 +1,4 @@
1
+ ## 2016-01-16
2
+
3
+ - Add Vedeu::Index which converts a Vedeu::Point to an array index.
4
+ i.e. Never less than 0, always 1 less than the Vedeu::Point value.
data/docs/dsl.md CHANGED
@@ -113,7 +113,7 @@ end
113
113
 
114
114
  ### Creating a new named geometry
115
115
 
116
- {include:Vedeu::DSL::Geometry::ClassMethods.geometry}
116
+ {include:Vedeu::DSL::Geometry::ClassMethods#geometry}
117
117
 
118
118
  ### Setting the interface dimensions
119
119
 
@@ -150,7 +150,6 @@ end
150
150
  ## Keymaps
151
151
 
152
152
  {include:Vedeu::Input::DSL}
153
- {include:Vedeu::Input::DSL#name}
154
153
 
155
154
  ### Creating a new named group
156
155
 
@@ -161,7 +160,6 @@ end
161
160
  {include:Vedeu::Menus::DSL}
162
161
  {include:Vedeu::Menus::DSL#item}
163
162
  {include:Vedeu::Menus::DSL#items}
164
- {include:Vedeu::Menus::DSL#name}
165
163
 
166
164
  ### Creating a new named menu
167
165
 
@@ -180,14 +178,6 @@ end
180
178
 
181
179
  {include:Vedeu::DSL::Views.views}
182
180
 
183
- ### Specifying view content
184
-
185
- {include:Vedeu::DSL::Line}
186
- {include:Vedeu::DSL::Line#line}
187
- {include:Vedeu::DSL::Line#streams}
188
-
189
- `@todo` More documentation coming soon.
190
-
191
181
  #### Authors Notes
192
182
 
193
183
  The Rubydoc documentation has more specific information about the DSL
@@ -0,0 +1 @@
1
+ @todo Add more documentation.
@@ -0,0 +1,40 @@
1
+ ### align_bottom
2
+
3
+ Providing the optional 'height' will set the interface height,
4
+ overriding any previous or calculated value for 'height'.
5
+
6
+ Aligning the view with the bottom of the terminal:
7
+
8
+ # Vedeu.geometry :my_interface do
9
+ align_bottom
10
+
11
+ # ...
12
+ # end
13
+
14
+ or...
15
+
16
+ # Vedeu.interface :my_interface do
17
+ # geometry do
18
+ align_bottom
19
+
20
+ # ...
21
+ # end
22
+ # end
23
+
24
+ Align this view with the bottom of the terminal and setting the
25
+ height to 20 rows/lines:
26
+
27
+ # Vedeu.geometry :my_interface do
28
+ align_bottom 20
29
+
30
+ # ...
31
+ # end
32
+
33
+ or...
34
+
35
+ # Vedeu.interface :my_interface do
36
+ # geometry do
37
+ align_bottom 20
38
+
39
+ # end
40
+ # end
@@ -0,0 +1,40 @@
1
+ ### align_centre
2
+
3
+ Providing the optional 'width' will set the interface width,
4
+ overriding any previous or calculated value for 'width'.
5
+
6
+ Aligning the view centrally within the terminal:
7
+
8
+ # Vedeu.geometry :my_interface do
9
+ align_centre
10
+
11
+ # ...
12
+ # end
13
+
14
+ or...
15
+
16
+ # Vedeu.interface :my_interface do
17
+ # geometry do
18
+ align_centre
19
+
20
+ # ...
21
+ # end
22
+ # end
23
+
24
+ Align this view centrally within the terminal and setting the
25
+ width to 20 columns/chars:
26
+
27
+ # Vedeu.geometry :my_interface do
28
+ align_centre 20
29
+
30
+ # ...
31
+ # end
32
+
33
+ or...
34
+
35
+ # Vedeu.interface :my_interface do
36
+ # geometry do
37
+ align_centre 20
38
+
39
+ # end
40
+ # end
@@ -0,0 +1,40 @@
1
+ ### align_left
2
+
3
+ Providing the optional 'width' will set the interface width,
4
+ overriding any previous or calculated value for 'width'.
5
+
6
+ Aligning the view to the left within the terminal:
7
+
8
+ # Vedeu.geometry :my_interface do
9
+ align_left
10
+
11
+ # ...
12
+ # end
13
+
14
+ or...
15
+
16
+ # Vedeu.interface :my_interface do
17
+ # geometry do
18
+ align_left
19
+
20
+ # ...
21
+ # end
22
+ # end
23
+
24
+ Align this view to the left within the terminal and setting the
25
+ width to 20 columns/chars:
26
+
27
+ # Vedeu.geometry :my_interface do
28
+ align_left 20
29
+
30
+ # ...
31
+ # end
32
+
33
+ or...
34
+
35
+ # Vedeu.interface :my_interface do
36
+ # geometry do
37
+ align_left 20
38
+
39
+ # end
40
+ # end
@@ -0,0 +1,40 @@
1
+ ### align_middle
2
+
3
+ Providing the optional 'height' will set the interface height,
4
+ overriding any previous or calculated value for 'height'.
5
+
6
+ Aligning the view in the vertical centre of the terminal:
7
+
8
+ # Vedeu.geometry :my_interface do
9
+ align_middle
10
+
11
+ # ...
12
+ # end
13
+
14
+ or...
15
+
16
+ # Vedeu.interface :my_interface do
17
+ # geometry do
18
+ align_middle
19
+
20
+ # ...
21
+ # end
22
+ # end
23
+
24
+ Align this view in the vertical centre of the terminal and setting the
25
+ height to 20 rows/lines:
26
+
27
+ # Vedeu.geometry :my_interface do
28
+ align_middle 20
29
+
30
+ # ...
31
+ # end
32
+
33
+ or...
34
+
35
+ # Vedeu.interface :my_interface do
36
+ # geometry do
37
+ align_middle 20
38
+
39
+ # end
40
+ # end
@@ -0,0 +1,40 @@
1
+ ### align_right
2
+
3
+ Providing the optional 'width' will set the interface width,
4
+ overriding any previous or calculated value for 'width'.
5
+
6
+ Aligning the view to the right within the terminal:
7
+
8
+ # Vedeu.geometry :my_interface do
9
+ align_right
10
+
11
+ # ...
12
+ # end
13
+
14
+ or...
15
+
16
+ # Vedeu.interface :my_interface do
17
+ # geometry do
18
+ align_right
19
+
20
+ # ...
21
+ # end
22
+ # end
23
+
24
+ Align this view to the right within the terminal and setting the
25
+ width to 20 columns/chars:
26
+
27
+ # Vedeu.geometry :my_interface do
28
+ align_right 20
29
+
30
+ # ...
31
+ # end
32
+
33
+ or...
34
+
35
+ # Vedeu.interface :my_interface do
36
+ # geometry do
37
+ align_right 20
38
+
39
+ # end
40
+ # end
@@ -0,0 +1,40 @@
1
+ ### align_top
2
+
3
+ Providing the optional 'height' will set the interface height,
4
+ overriding any previous or calculated value for 'height'.
5
+
6
+ Aligning the view with the top of the terminal:
7
+
8
+ # Vedeu.geometry :my_interface do
9
+ align_top
10
+
11
+ # ...
12
+ # end
13
+
14
+ or...
15
+
16
+ # Vedeu.interface :my_interface do
17
+ # geometry do
18
+ align_top
19
+
20
+ # ...
21
+ # end
22
+ # end
23
+
24
+ Align this view with the top of the terminal and setting the
25
+ height to 20 rows/lines:
26
+
27
+ # Vedeu.geometry :my_interface do
28
+ align_top 20
29
+
30
+ # ...
31
+ # end
32
+
33
+ or...
34
+
35
+ # Vedeu.interface :my_interface do
36
+ # geometry do
37
+ align_top 20
38
+
39
+ # end
40
+ # end
@@ -0,0 +1 @@
1
+ @todo Add more documentation.
File without changes
@@ -0,0 +1 @@
1
+ @todo Add more documentation.
@@ -0,0 +1 @@
1
+ @todo Add more documentation.
@@ -0,0 +1 @@
1
+ @todo Add more documentation.
File without changes
@@ -0,0 +1 @@
1
+ @todo Add more documentation.
@@ -0,0 +1 @@
1
+ @todo Add more documentation.
@@ -0,0 +1 @@
1
+ @todo Add more documentation.
@@ -0,0 +1 @@
1
+ @todo Add more documentation.
@@ -1 +1,5 @@
1
- @todo Add more documentation.
1
+ ### Vedeu.render
2
+
3
+ Alias for `Vedeu.renders`.
4
+
5
+ See {file:docs/dsl/by_method/renders.md}
@@ -1 +1,31 @@
1
- @todo Add more documentation.
1
+ ### Vedeu.renders
2
+
3
+ Also aliased as `Vedeu.render`.
4
+
5
+ Directly write a view buffer to the terminal. Using this method means
6
+ that the refresh event does not need to be triggered after creating
7
+ the views, though can be later triggered when needed.
8
+
9
+ Multiple views can be rendered inside a `renders` block as the example
10
+ below shows:
11
+
12
+ Vedeu.renders do
13
+ view :some_interface do
14
+ # line do
15
+ # stream do
16
+ # left 'Title goes here', width: 35
17
+ # end
18
+ # stream do
19
+ # right Time.now.strftime('%H:%m'), width: 7
20
+ # end
21
+ # end
22
+ end
23
+
24
+ view :other_interface do
25
+ # lines do
26
+ # line 'This is content for the main interface.'
27
+ # line ''
28
+ # line 'Pretty easy eh?'
29
+ # end
30
+ end
31
+ end
@@ -0,0 +1,26 @@
1
+ ### `view`
2
+
3
+ Used within a `Vedeu.renders` or `Vedeu.views` block, the `view` DSL
4
+ method defines a view for the named interface.
5
+
6
+ # Vedeu.renders do
7
+ view :my_interface do
8
+ # ...
9
+ end
10
+
11
+ view :other_interface do
12
+ # ...
13
+ end
14
+ # end
15
+
16
+ or
17
+
18
+ # Vedeu.views do
19
+ view :my_interface do
20
+ # ...
21
+ end
22
+
23
+ view :other_interface do
24
+ # ...
25
+ end
26
+ # end
@@ -0,0 +1,18 @@
1
+ Multiple `stream` entries directly within a `view` are treated as
2
+ individual lines:
3
+
4
+ # Vedeu.render do
5
+ # view(name) do
6
+
7
+ stream do
8
+ # ...
9
+ end
10
+
11
+ stream do
12
+ # ...
13
+ end
14
+
15
+ # end
16
+ # end
17
+
18
+
@@ -1 +1,32 @@
1
- @todo Add more documentation.
1
+ ### Vedeu.views
2
+
3
+ Define a view (content) for an interface.
4
+
5
+ The views declared within this block are stored in their respective
6
+ interface back buffers until a refresh event occurs. When the refresh
7
+ event is triggered, the back buffers are swapped into the front
8
+ buffers and the content here will be rendered.
9
+
10
+ Multiple views can be rendered inside a `views` block as the example
11
+ below shows:
12
+
13
+ Vedeu.views do
14
+ # view :some_interface do
15
+ # line do
16
+ # stream do
17
+ # left 'Title goes here', width: 35
18
+ # end
19
+ # stream do
20
+ # right Time.now.strftime('%H:%m'), width: 7
21
+ # end
22
+ # end
23
+ # end
24
+
25
+ # view :other_interface do
26
+ # lines do
27
+ # line 'This is content for the main interface.'
28
+ # line ''
29
+ # line 'Pretty easy eh?'
30
+ # end
31
+ # end
32
+ end