rbcurse 1.4.1 → 1.5.0.pre1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (192) hide show
  1. data/CHANGELOG +31 -0
  2. data/README.markdown +69 -11
  3. data/VERSION +1 -1
  4. data/lib/rbcurse.rb +5 -5
  5. metadata +10 -198
  6. data/Makefile +0 -21
  7. data/Manifest.txt +0 -91
  8. data/TODO +0 -372
  9. data/TODO2.txt +0 -118
  10. data/examples/README.txt +0 -67
  11. data/examples/abasiclist.rb +0 -33
  12. data/examples/alpmenu.rb +0 -42
  13. data/examples/app.rb +0 -859
  14. data/examples/app.sample +0 -10
  15. data/examples/appdirtree.rb +0 -75
  16. data/examples/appemail.rb +0 -191
  17. data/examples/appemaillb.rb +0 -308
  18. data/examples/appgcompose.rb +0 -315
  19. data/examples/atree.rb +0 -64
  20. data/examples/common/file.rb +0 -40
  21. data/examples/common/rmail.rb +0 -257
  22. data/examples/data.txt +0 -683
  23. data/examples/data/README.markdown +0 -9
  24. data/examples/data/brew.txt +0 -38
  25. data/examples/data/color.2 +0 -37
  26. data/examples/data/gemlist.txt +0 -60
  27. data/examples/data/lotr.txt +0 -12
  28. data/examples/data/ports.txt +0 -136
  29. data/examples/data/tasks.txt +0 -27
  30. data/examples/data/todocsv.csv +0 -28
  31. data/examples/data/unix1.txt +0 -21
  32. data/examples/data/unix2.txt +0 -11
  33. data/examples/dbdemo.rb +0 -495
  34. data/examples/deprecated/appgmail.rb +0 -952
  35. data/examples/deprecated/splitp.rb +0 -56
  36. data/examples/deprecated/testscrolllb.rb +0 -86
  37. data/examples/deprecated/testscrollp.rb +0 -88
  38. data/examples/deprecated/testscrollta.rb +0 -80
  39. data/examples/deprecated/testscrolltable.rb +0 -165
  40. data/examples/deprecated/testsplit.rb +0 -87
  41. data/examples/deprecated/testsplit2.rb +0 -123
  42. data/examples/deprecated/testsplit3.rb +0 -215
  43. data/examples/deprecated/testsplit3_1.rb +0 -244
  44. data/examples/deprecated/testsplit3a.rb +0 -215
  45. data/examples/deprecated/testsplit3b.rb +0 -237
  46. data/examples/deprecated/testsplitta.rb +0 -148
  47. data/examples/deprecated/testsplittv.rb +0 -142
  48. data/examples/deprecated/testsplittvv.rb +0 -144
  49. data/examples/deprecated/testtpane.rb +0 -215
  50. data/examples/deprecated/testtpane2.rb +0 -145
  51. data/examples/deprecated/testtpanetable.rb +0 -203
  52. data/examples/dirtree.rb +0 -88
  53. data/examples/experimental/resultsetdemo.rb +0 -280
  54. data/examples/experimental/testmform.rb +0 -35
  55. data/examples/experimental/testscroller.rb +0 -117
  56. data/examples/experimental/teststackflow.rb +0 -111
  57. data/examples/menu1.rb +0 -112
  58. data/examples/multispl.rb +0 -86
  59. data/examples/newmessagebox.rb +0 -130
  60. data/examples/newtabbedwindow.rb +0 -100
  61. data/examples/newtesttabp.rb +0 -121
  62. data/examples/qdfilechooser.rb +0 -68
  63. data/examples/rfe.rb +0 -1195
  64. data/examples/rfe_renderer.rb +0 -121
  65. data/examples/sqlc.rb +0 -454
  66. data/examples/sqlm.rb +0 -437
  67. data/examples/sqlt.rb +0 -408
  68. data/examples/status.txt +0 -68
  69. data/examples/table1.rb +0 -24
  70. data/examples/term2.rb +0 -84
  71. data/examples/test1.rb +0 -239
  72. data/examples/test2.rb +0 -674
  73. data/examples/testapp.rb +0 -44
  74. data/examples/testapp2.rb +0 -58
  75. data/examples/testchars.rb +0 -137
  76. data/examples/testcombo.rb +0 -91
  77. data/examples/testkeypress.rb +0 -66
  78. data/examples/testlistbox.rb +0 -113
  79. data/examples/testmenu.rb +0 -101
  80. data/examples/testmulticomp.rb +0 -70
  81. data/examples/testmulticontainer.rb +0 -94
  82. data/examples/testmultispl.rb +0 -199
  83. data/examples/testree.rb +0 -106
  84. data/examples/testtable.rb +0 -263
  85. data/examples/testtabp.rb +0 -107
  86. data/examples/testtodo.rb +0 -584
  87. data/examples/testvimsplit.rb +0 -112
  88. data/examples/testwsshortcuts.rb +0 -64
  89. data/examples/testwsshortcuts2.rb +0 -126
  90. data/examples/todo.db +0 -0
  91. data/examples/todo.yml +0 -191
  92. data/examples/viewtodo.rb +0 -574
  93. data/lib/rbcurse/action.rb +0 -40
  94. data/lib/rbcurse/app.rb +0 -1374
  95. data/lib/rbcurse/applicationheader.rb +0 -102
  96. data/lib/rbcurse/celleditor.rb +0 -112
  97. data/lib/rbcurse/checkboxcellrenderer.rb +0 -57
  98. data/lib/rbcurse/colormap.rb +0 -159
  99. data/lib/rbcurse/comboboxcellrenderer.rb +0 -30
  100. data/lib/rbcurse/common/ansiparser.rb +0 -117
  101. data/lib/rbcurse/common/appmethods.rb +0 -112
  102. data/lib/rbcurse/common/basestack.rb +0 -407
  103. data/lib/rbcurse/common/bordertitle.rb +0 -41
  104. data/lib/rbcurse/common/chunk.rb +0 -177
  105. data/lib/rbcurse/common/colorparser.rb +0 -71
  106. data/lib/rbcurse/common/keydefs.rb +0 -30
  107. data/lib/rbcurse/common/widgetshortcuts.rb +0 -302
  108. data/lib/rbcurse/defaultlistselectionmodel.rb +0 -79
  109. data/lib/rbcurse/deprecated/README.markdown +0 -12
  110. data/lib/rbcurse/deprecated/rscrollpane.rb +0 -512
  111. data/lib/rbcurse/deprecated/rsplitpane.rb +0 -894
  112. data/lib/rbcurse/deprecated/rsplitpane2.rb +0 -1009
  113. data/lib/rbcurse/deprecated/rviewport.rb +0 -204
  114. data/lib/rbcurse/experimental/README.markdown +0 -14
  115. data/lib/rbcurse/experimental/resultsettextview.rb +0 -585
  116. data/lib/rbcurse/experimental/stackflow.rb +0 -478
  117. data/lib/rbcurse/extras/bottomline.rb +0 -1850
  118. data/lib/rbcurse/extras/box.rb +0 -58
  119. data/lib/rbcurse/extras/directorylist.rb +0 -467
  120. data/lib/rbcurse/extras/directorytree.rb +0 -69
  121. data/lib/rbcurse/extras/divider.rb +0 -310
  122. data/lib/rbcurse/extras/focusmanager.rb +0 -31
  123. data/lib/rbcurse/extras/horizlist.rb +0 -203
  124. data/lib/rbcurse/extras/listselectable.rb +0 -264
  125. data/lib/rbcurse/extras/masterdetail.rb +0 -166
  126. data/lib/rbcurse/extras/menutree.rb +0 -63
  127. data/lib/rbcurse/extras/multiform.rb +0 -330
  128. data/lib/rbcurse/extras/multilinelabel.rb +0 -142
  129. data/lib/rbcurse/extras/newmessagebox.rb +0 -328
  130. data/lib/rbcurse/extras/newtabbedpane.rb +0 -612
  131. data/lib/rbcurse/extras/newtabbedwindow.rb +0 -68
  132. data/lib/rbcurse/extras/padreader.rb +0 -189
  133. data/lib/rbcurse/extras/rcomboedit.rb +0 -256
  134. data/lib/rbcurse/extras/resultsetbrowser.rb +0 -281
  135. data/lib/rbcurse/extras/rlink.rb +0 -27
  136. data/lib/rbcurse/extras/rmenulink.rb +0 -21
  137. data/lib/rbcurse/extras/scrollbar.rb +0 -143
  138. data/lib/rbcurse/extras/statusline.rb +0 -94
  139. data/lib/rbcurse/extras/stdscrwindow.rb +0 -309
  140. data/lib/rbcurse/extras/tableextended.rb +0 -40
  141. data/lib/rbcurse/extras/tabular.rb +0 -264
  142. data/lib/rbcurse/extras/tabularwidget.rb +0 -1150
  143. data/lib/rbcurse/extras/textpad.rb +0 -516
  144. data/lib/rbcurse/extras/viewer.rb +0 -136
  145. data/lib/rbcurse/io.rb +0 -850
  146. data/lib/rbcurse/keylabelprinter.rb +0 -178
  147. data/lib/rbcurse/listcellrenderer.rb +0 -140
  148. data/lib/rbcurse/listeditable.rb +0 -310
  149. data/lib/rbcurse/listkeys.rb +0 -37
  150. data/lib/rbcurse/listscrollable.rb +0 -564
  151. data/lib/rbcurse/listselectable.rb +0 -142
  152. data/lib/rbcurse/mapper.rb +0 -130
  153. data/lib/rbcurse/orderedhash.rb +0 -77
  154. data/lib/rbcurse/ractionevent.rb +0 -67
  155. data/lib/rbcurse/rbasiclistbox.rb +0 -768
  156. data/lib/rbcurse/rchangeevent.rb +0 -27
  157. data/lib/rbcurse/rcombo.rb +0 -238
  158. data/lib/rbcurse/rcommandwindow.rb +0 -587
  159. data/lib/rbcurse/rcontainer.rb +0 -415
  160. data/lib/rbcurse/rdialogs.rb +0 -451
  161. data/lib/rbcurse/rinputdataevent.rb +0 -47
  162. data/lib/rbcurse/rlistbox.rb +0 -1196
  163. data/lib/rbcurse/rmenu.rb +0 -939
  164. data/lib/rbcurse/rmessagebox.rb +0 -348
  165. data/lib/rbcurse/rmulticontainer.rb +0 -304
  166. data/lib/rbcurse/rmultisplit.rb +0 -722
  167. data/lib/rbcurse/rmultitextview.rb +0 -306
  168. data/lib/rbcurse/rpopupmenu.rb +0 -755
  169. data/lib/rbcurse/rprogress.rb +0 -118
  170. data/lib/rbcurse/rscrollform.rb +0 -418
  171. data/lib/rbcurse/rtabbedpane.rb +0 -1158
  172. data/lib/rbcurse/rtabbedwindow.rb +0 -167
  173. data/lib/rbcurse/rtable.rb +0 -1718
  174. data/lib/rbcurse/rtextarea.rb +0 -920
  175. data/lib/rbcurse/rtextview.rb +0 -761
  176. data/lib/rbcurse/rtree.rb +0 -780
  177. data/lib/rbcurse/rvimsplit.rb +0 -763
  178. data/lib/rbcurse/rwidget.rb +0 -2915
  179. data/lib/rbcurse/scrollable.rb +0 -301
  180. data/lib/rbcurse/table/tablecellrenderer.rb +0 -86
  181. data/lib/rbcurse/table/tabledatecellrenderer.rb +0 -98
  182. data/lib/rbcurse/tree/treecellrenderer.rb +0 -150
  183. data/lib/rbcurse/tree/treemodel.rb +0 -428
  184. data/lib/rbcurse/undomanager.rb +0 -188
  185. data/lib/rbcurse/vieditable.rb +0 -144
  186. data/lib/ver/keyboard.rb +0 -150
  187. data/lib/ver/keyboard2.rb +0 -170
  188. data/lib/ver/ncurses.rb +0 -218
  189. data/lib/ver/panel.rb +0 -162
  190. data/lib/ver/rpad.rb +0 -375
  191. data/lib/ver/window.rb +0 -882
  192. data/test/test_rbcurse.rb +0 -0
@@ -1,215 +0,0 @@
1
- #$LOAD_PATH << "/Users/rahul/work/projects/rbcurse/"
2
- #*******************************************************#
3
- # testsplit3a.rb #
4
- # written by Rahul Kumar #
5
- # January 16, 2010 #
6
- # #
7
- # Test textview, split and textarea inside splitpane #
8
- # This wraps a textview inside a scrollpane, and #
9
- # puts the SCRP inside a SPLP #
10
- #
11
- # /----+---------------\
12
- # | V| V|
13
- # | 1 V| V|
14
- # | >>V| V|
15
- # +----+ 3 V|
16
- # | V| V|
17
- # | 2 V| V|
18
- # |>>>V|>>>>>> |
19
- # \----+---------------/
20
- #
21
- #
22
- #
23
- # Released under ruby license. See #
24
- # http://www.ruby-lang.org/en/LICENSE.txt #
25
- # Copyright 2010, Rahul Kumar #
26
- #*******************************************************#
27
- require 'rubygems'
28
- #require 'ncurses' # FFI
29
- require 'logger'
30
- require 'rbcurse'
31
- require 'rbcurse/rsplitpane'
32
- require 'rbcurse/rscrollpane'
33
- require 'rbcurse/rtextarea'
34
- require 'rbcurse/rtextview'
35
- require 'rbcurse/rlistbox'
36
- if $0 == __FILE__
37
- include RubyCurses
38
- include RubyCurses::Utils
39
-
40
- begin
41
- # Initialize curses
42
- VER::start_ncurses # this is initializing colors via ColorMap.setup
43
- $log = Logger.new((File.join(ENV["LOGDIR"] || "./" ,"rbc13.log")))
44
- $log.level = Logger::DEBUG
45
-
46
- @window = VER::Window.root_window
47
-
48
- catch(:close) do
49
- colors = Ncurses.COLORS
50
- @form = Form.new @window
51
- $log.debug " MAIN FORM #{@form} "
52
- r = 1; c = 3; ht = 18; w = 70
53
- r = 3; c = 7; ht = 24; w = 100
54
-
55
-
56
- @help = "F1 to quit. To resize split: M-, M+, M=. TAB, M-w, M-n, M-p, M-l, M-h, C-n/p : #{$0}"
57
- RubyCurses::Label.new @form, {'text' => @help, "row" => ht+r, "col" => 2, "color" => "yellow"}
58
-
59
- outer = SplitPane.new @form do
60
- name "mainpane"
61
- row r
62
- col c
63
- width w
64
- height ht
65
- orientation :VERTICAL_SPLIT
66
- end
67
- # note that splitleft has no form. so focus has to be managed XXX
68
- splitleft = SplitPane.new nil do
69
- name "splitleft-outer"
70
-
71
- #width w/3 # 30
72
- #height ht-0 #/2-1
73
-
74
- orientation :HORIZONTAL_SPLIT
75
- border_color $promptcolor
76
- border_attrib Ncurses::A_NORMAL
77
- end
78
- taoutrt = TextArea.new nil do
79
- name "myTextArea-outrt"
80
- #row 0
81
- #col 0
82
- width w # this is ofcourse large, full width
83
- #height (ht/2)-1
84
- height ht
85
- title "README.md"
86
- title_attrib 'bold'
87
- print_footer true
88
- footer_attrib 'bold'
89
- end
90
- # taoutrt.show_caret=true
91
-
92
- tvleft1 = TextView.new nil do
93
- name "myviewleft1"
94
- #row 0
95
- #col 0
96
- #width w-2
97
- height ht
98
- #height (ht/2)-1
99
- width w/2-1
100
- title "README.md"
101
- title_attrib 'bold'
102
- print_footer true
103
- footer_attrib 'bold'
104
- end
105
- tvleft1.show_caret=true
106
- content = File.open("../README.markdown","r").readlines
107
- tvleft1.set_content content #, :WRAP_WORD
108
-
109
- # to see lower border i need to set height to ht/2 -2 in both cases, but that
110
- # crashes ruby when i reduce height by 1.
111
- tvleft2 = TextView.new nil do
112
- name "myviewleft2"
113
- #row 0
114
- #col 0
115
- width w/2-1
116
- #height ht
117
- height (ht/2)-1
118
- title "NOTES"
119
- title_attrib 'bold'
120
- print_footer true
121
- footer_attrib 'bold'
122
- end
123
- tvleft2.show_caret=true
124
- content = File.open("../NOTES","r").readlines
125
- tvleft2.set_content content #, :WRAP_WORD
126
-
127
- leftscroll1 = ScrollPane.new nil do
128
- name "myScrollLeftTop"
129
- end
130
- leftscroll2 = ScrollPane.new nil do
131
- name "myScrollLeftBot"
132
- end
133
- scroutrt = ScrollPane.new nil do
134
- name "myScroll3-outer-right"
135
- #width 46
136
- end
137
- leftscroll1.cascade_changes = true
138
- leftscroll2.cascade_changes = true
139
- #leftscroll1.preferred_width w/2 #/2 ## should pertain more to horizontal orientation
140
- leftscroll1.preferred_height((ht/2)-4) ## this messes things up when we change orientation
141
- # the outer compo needs child set first else cursor does not reach up from
142
- # lower levels. Is the connection broken ?
143
- outer.first_component(splitleft)
144
- outer.second_component(scroutrt)
145
- #leftscroll2.preferred_height ht/2-2
146
- scroutrt.child(taoutrt)
147
- splitleft.first_component(leftscroll1)
148
- leftscroll1.child(tvleft1)
149
- splitleft.second_component(leftscroll2)
150
- leftscroll2.child(tvleft2)
151
- #tvleft1.preferred_width w/2 #/2 ## should pertain more to horizontal orientation
152
- #tvleft1.preferred_height (ht/2)-1 ## this messes things up when we change orientation
153
- #tvleft1.set_resize_weight 0.50
154
- ret = splitleft.reset_to_preferred_sizes
155
- splitleft.set_resize_weight(0.50) if ret == :ERROR
156
-
157
- splitleft.preferred_width w/2 #w/3
158
- splitleft.preferred_height ht/2-2
159
- #splitleft.set_resize_weight 0.50
160
- #taoutrt.min_width 10
161
- #taoutrt.min_height 5
162
- #splitleft.min_width 12
163
- #splitleft.min_height 6
164
- ret = outer.reset_to_preferred_sizes
165
- outer.set_resize_weight(0.50) if ret == :ERROR
166
-
167
- File.open("../README.markdown","r") do |file|
168
- while (line = file.gets)
169
- taoutrt << line.chomp
170
- end
171
- end
172
-
173
- @form.repaint
174
- @window.wrefresh
175
- Ncurses::Panel.update_panels
176
- while((ch = @window.getchar()) != KEY_F1 )
177
- str = keycode_tos ch
178
- case ch
179
- #when ?v.getbyte(0)
180
- #$log.debug " ORIENTATION VERTICAL"
181
- #outer.orientation(:VERTICAL_SPLIT)
182
- #outer.reset_to_preferred_sizes
183
- #when ?h.getbyte(0)
184
- #$log.debug " ORIENTATION HORIZ"
185
- #outer.orientation(:HORIZONTAL_SPLIT)
186
- #outer.reset_to_preferred_sizes
187
- when ?-.getbyte(0)
188
- $log.debug " KEY PRESS -"
189
- outer.set_divider_location(outer.divider_location-1)
190
- when ?+.getbyte(0)
191
- $log.debug " KEY PRESS +"
192
- outer.set_divider_location(outer.divider_location+1)
193
- when ?=.getbyte(0)
194
- $log.debug " KEY PRESS ="
195
- outer.set_resize_weight(0.50)
196
- end
197
- #outer.get_buffer().wclear
198
- #outer << "#{ch} got (#{str})"
199
- # outer.repaint
200
- # outer.buffer_to_screen
201
- @form.repaint
202
- @form.handle_key(ch)
203
- @window.wrefresh
204
- end
205
- end
206
- rescue => ex
207
- ensure
208
- @window.destroy if !@window.nil?
209
- VER::stop_ncurses
210
- p ex if ex
211
- p(ex.backtrace.join("\n")) if ex
212
- $log.debug( ex) if ex
213
- $log.debug(ex.backtrace.join("\n")) if ex
214
- end
215
- end
@@ -1,237 +0,0 @@
1
- #$LOAD_PATH << "/Users/rahul/work/projects/rbcurse/"
2
- #*******************************************************#
3
- # testsplit3b.rb #
4
- # written by Rahul Kumar #
5
- # January 17, 2010 #
6
- # #
7
- # Test textview, split and textarea inside splitpane #
8
- # This wraps a textview inside a scrollpane, and #
9
- # puts the SCRP inside a SPLP #
10
- # Adds a listbox to the menagerie of objects. #
11
- #
12
- # /----+---------------\
13
- # | V| V|
14
- # | 1 V| V|
15
- # | >>V| V|
16
- # +----+ 3 V|
17
- # | V| V|
18
- # | 2 V| V|
19
- # |>>>V|>>>>>> |
20
- # \----+---------------/
21
- #
22
- #
23
- #
24
- # Released under ruby license. See #
25
- # http://www.ruby-lang.org/en/LICENSE.txt #
26
- # Copyright 2010, Rahul Kumar #
27
- #*******************************************************#
28
- require 'rubygems'
29
- #require 'ncurses' # FFI
30
- require 'logger'
31
- require 'rbcurse'
32
- require 'rbcurse/rsplitpane'
33
- require 'rbcurse/rscrollpane'
34
- require 'rbcurse/rtextarea'
35
- require 'rbcurse/rtextview'
36
- require 'rbcurse/rlistbox'
37
- if $0 == __FILE__
38
- include RubyCurses
39
- include RubyCurses::Utils
40
-
41
- begin
42
- # Initialize curses
43
- VER::start_ncurses # this is initializing colors via ColorMap.setup
44
- $log = Logger.new((File.join(ENV["LOGDIR"] || "./" ,"rbc13.log")))
45
- $log.level = Logger::DEBUG
46
- show_caret_flag = false #true
47
-
48
- @window = VER::Window.root_window
49
-
50
- catch(:close) do
51
- colors = Ncurses.COLORS
52
- @form = Form.new @window
53
- $log.debug " MAIN FORM #{@form} "
54
- r = 1; c = 3; ht = 18; w = 70
55
- r = 3; c = 7; ht = 24; w = 100
56
-
57
-
58
- @help = "F1 to quit. To resize split: M-, M+, M=. TAB, M-w, M-n, M-p, M-l, M-h, C-n/p : #{$0}"
59
- RubyCurses::Label.new @form, {'text' => @help, "row" => ht+r, "col" => 2, "color" => "yellow"}
60
-
61
- outer = SplitPane.new @form do
62
- name "mainpane"
63
- row r
64
- col c
65
- width w
66
- height ht
67
- orientation :VERTICAL_SPLIT
68
- end
69
- # note that splitleft has no form. so focus has to be managed XXX
70
- splitleft = SplitPane.new nil do
71
- name "splitleft"
72
-
73
- #width w/3 # 30
74
- #height ht-0 #/2-1
75
-
76
- orientation :HORIZONTAL_SPLIT
77
- border_color $promptcolor
78
- border_attrib Ncurses::A_NORMAL
79
- end
80
- ta1 = TextArea.new nil do
81
- name "myTextArea"
82
- #row 0
83
- #col 0
84
- width w # this is ofcourse large, full width
85
- #height (ht/2)-1
86
- height ht
87
- title "README.md"
88
- title_attrib 'bold'
89
- print_footer true
90
- footer_attrib 'bold'
91
- end
92
- ta1.show_caret = show_caret_flag
93
-
94
- t1 = TextView.new nil do
95
- name "myView"
96
- #row 0
97
- #col 0
98
- #width w-2
99
- height ht
100
- #height (ht/2)-1
101
- width w/2-1
102
- title "README.md"
103
- title_attrib 'bold'
104
- print_footer true
105
- footer_attrib 'bold'
106
- end
107
- t1.show_caret = show_caret_flag
108
- content = File.open("../README.markdown","r").readlines
109
- t1.set_content content #, :WRAP_WORD
110
-
111
- mylist = []
112
- 0.upto(50) { |v| mylist << "#{v} scrollable data" }
113
- $listdata = Variable.new mylist
114
- listb = Listbox.new nil do
115
- name "mylist"
116
- row 0
117
- col 0
118
- width w/2
119
- height ht/2+5
120
- list_variable $listdata
121
- #selection_mode :SINGLE
122
- show_selector true
123
- row_selected_symbol "[X] "
124
- row_unselected_symbol "[ ] "
125
- title "A long list"
126
- title_attrib 'reverse'
127
- cell_editing_allowed true
128
- end
129
- ## The next 2 are not advised since they don't trigger events
130
- #listb.insert 55, "hello ruby", "so long python", "farewell java", "RIP .Net"
131
- #$listdata.value.insert 55, "hello ruby", "so long python", "farewell java", "RIP .Net"
132
- listb.list_data_model.insert 25, "hello ruby", "so long python", "farewell java", "RIP .Net", "hi lisp", "hi cloJure", "git Go"
133
- # to see lower border i need to set height to ht/2 -2 in both cases, but that
134
- # crashes ruby when i reduce height by 1.
135
- #t2 = TextView.new nil do
136
- #name "myView2"
137
- ##row 0
138
- ##col 0
139
- #width w/2-1
140
- ##height ht
141
- #height (ht/2)-1
142
- #title "NOTES"
143
- #title_attrib 'bold'
144
- #print_footer true
145
- #footer_attrib 'bold'
146
- #end
147
- #content = File.open("../NOTES","r").readlines
148
- #t2.set_content content #, :WRAP_WORD
149
-
150
- scroll1 = ScrollPane.new nil do
151
- name "myScroll1"
152
- end
153
- scroll2 = ScrollPane.new nil do
154
- name "myScroll2"
155
- end
156
- scroll3 = ScrollPane.new nil do
157
- name "myScroll3"
158
- #width 46
159
- end
160
- #scroll1.preferred_width w/2 #/2 ## should pertain more to horizontal orientation
161
- scroll1.preferred_height ht/2-4 ## this messes things up when we change orientation
162
- # the outer compo needs child set first else cursor does not reach up from
163
- # lower levels. Is the connection broken ?
164
- outer.first_component(splitleft)
165
- outer.second_component(scroll3)
166
- #scroll2.preferred_height ht/2-2
167
- scroll3.child(ta1)
168
- splitleft.first_component(scroll1)
169
- scroll1.child(t1)
170
- splitleft.second_component(scroll2)
171
- scroll2.child(listb)
172
- #scroll2.cascade_changes = true
173
- #t1.preferred_width w/2 #/2 ## should pertain more to horizontal orientation
174
- #t1.preferred_height (ht/2)-1 ## this messes things up when we change orientation
175
- #t1.set_resize_weight 0.50
176
- ret = splitleft.reset_to_preferred_sizes
177
- splitleft.set_resize_weight(0.50) if ret == :ERROR
178
-
179
- splitleft.preferred_width w/2 #w/3
180
- splitleft.preferred_height ht/2-2
181
- #splitleft.set_resize_weight 0.50
182
- #ta1.min_width 10
183
- #ta1.min_height 5
184
- #splitleft.min_width 12
185
- #splitleft.min_height 6
186
- ret = outer.reset_to_preferred_sizes
187
- outer.set_resize_weight(0.50) if ret == :ERROR
188
-
189
- File.open("../README.markdown","r") do |file|
190
- while (line = file.gets)
191
- ta1 << line.chomp
192
- end
193
- end
194
-
195
- @form.repaint
196
- @window.wrefresh
197
- Ncurses::Panel.update_panels
198
- while((ch = @window.getchar()) != KEY_F1 )
199
- str = keycode_tos ch
200
- case ch
201
- #when ?v.getbyte(0)
202
- #$log.debug " ORIENTATION VERTICAL"
203
- #outer.orientation(:VERTICAL_SPLIT)
204
- #outer.reset_to_preferred_sizes
205
- #when ?h.getbyte(0)
206
- #$log.debug " ORIENTATION HORIZ"
207
- #outer.orientation(:HORIZONTAL_SPLIT)
208
- #outer.reset_to_preferred_sizes
209
- when ?-.getbyte(0)
210
- $log.debug " KEY PRESS -"
211
- outer.set_divider_location(outer.divider_location-1)
212
- when ?+.getbyte(0)
213
- $log.debug " KEY PRESS +"
214
- outer.set_divider_location(outer.divider_location+1)
215
- when ?=.getbyte(0)
216
- $log.debug " KEY PRESS ="
217
- outer.set_resize_weight(0.50)
218
- end
219
- #outer.get_buffer().wclear
220
- #outer << "#{ch} got (#{str})"
221
- # outer.repaint
222
- # outer.buffer_to_screen
223
- @form.repaint
224
- @form.handle_key(ch)
225
- @window.wrefresh
226
- end
227
- end
228
- rescue => ex
229
- ensure
230
- @window.destroy if !@window.nil?
231
- VER::stop_ncurses
232
- p ex if ex
233
- p(ex.backtrace.join("\n")) if ex
234
- $log.debug( ex) if ex
235
- $log.debug(ex.backtrace.join("\n")) if ex
236
- end
237
- end