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
data/examples/testapp.rb DELETED
@@ -1,44 +0,0 @@
1
- require 'rbcurse/app'
2
-
3
- # this was a test to see how i could have a class and an app inside
4
- # and i could call methods in the class and have variables available
5
- # inside App.
6
- #
7
- # instance_eval inside stack and others was causing the issue putting everything in
8
- # App. However, i have to change the app, to use yield in order not to lose context
9
-
10
- class Testy
11
- attr_accessor :value
12
- def initialize val
13
- @value = val
14
- @my = "oldval"
15
- run
16
- end
17
- def amethod
18
- $log.debug "XXXX amethod called... " if $log.debug?
19
- alert " self #{self.class} amethod "
20
- @my = "hellothere"
21
- end
22
- def run
23
- puts @value
24
- app = App.new
25
- $log.debug " APP : value #{value}" if $log.debug?
26
- header = app.app_header "rbcurse #{Rbcurse::VERSION} " , :text_center => " #{@value} Demo", :text_right =>"New Improved!", :color => :black, :bgcolor => :white, :attr => :bold
27
- app.message "Press F10 to exit from here #{@value} "
28
-
29
- app.stack :margin_top => 2, :margin => 5, :width => 30 do |s|
30
- app.label "Hello: ", :attr => :reverse
31
- f=app.field "abc"
32
- #amethod()
33
- f.bind(:CHANGE) {
34
- amethod()
35
- app.message "now #{@my} "
36
- }
37
-
38
- end # stack
39
- app.safe_loop
40
- end
41
- end
42
- if __FILE__ == $PROGRAM_NAME
43
- Testy.new "FFI-NCURSES"
44
- end
data/examples/testapp2.rb DELETED
@@ -1,58 +0,0 @@
1
- require 'rbcurse/app'
2
-
3
- ####
4
- # If you want to create an application which can run standaalong from terminal, or be passed
5
- # values from a previous form then this is one way you can do it.
6
- #
7
- # this was a test to see how i could have a class and an app inside
8
- # and i could call methods in the class and have variables available
9
- # inside App.
10
- #
11
- # instance_eval inside stack and others was causing the issue putting everything in
12
- # App. However, i have to change the app, to use yield in order not to lose context
13
-
14
- class Testy
15
- attr_accessor :value
16
- def initialize val
17
- @value = val
18
- @my = "oldval"
19
- run
20
- end
21
- # i will call this method from within the App block
22
- def amethod
23
- $log.debug "XXXX amethod called... " if $log.debug?
24
- #alert " self #{self.class} amethod "
25
- # we will access @my from insdie the block, we also access @f from here
26
- @my = "hellothere #{@f.getvalue} "
27
- end
28
- def run
29
-
30
- App.new do |app|
31
- $log.debug " APP : value #{value}" if $log.debug?
32
- header = app.app_header "rbcurse #{Rbcurse::VERSION} ", :text_center => " #{@value} Demo", :text_right =>"New Improved!", :color => :black, :bgcolor => :white, :attr => :bold
33
- app.message "Press F10 to exit from here #{@value} "
34
-
35
- app.stack :margin_top => 2, :margin => 5, :width => 30 do |s|
36
- app.label "Hello: ", :attr => :reverse
37
- @f=app.field "abc"
38
- #amethod()
39
- @f.bind(:CHANGE) {
40
- amethod()
41
- app.message "now #{@my} "
42
- }
43
-
44
- end # stack
45
- app.status_line :row => last_line()
46
-
47
- # earlier style without end, everything had to be explicit but quite simple. Hard to edit since you
48
- # could mess up by inserting inside
49
- s="#[fg=green]testing chunks #[fg=yellow, bg=red, bold]yellow #[reverse] reverseme#[normal]normal#[bg = black]just yellow#[fg=blue],blue now #[underline] underlined text"
50
- # revised, i know allow [end] so you can pop back to whatever was there before.
51
- s="#[fg=green]testing chunks #[fg=yellow, bg=red, bold]yellow #[/end] back to green#[reverse]reverse#[end]#[bg=blue]blue bg #[end],back to green #[/end]plain#[underline] underlined text"
52
- app.window.printstring_formatted 15,1, s, $datacolor, 'normal'
53
- end
54
- end
55
- end
56
- if __FILE__ == $PROGRAM_NAME
57
- Testy.new "SomeData"
58
- end
@@ -1,137 +0,0 @@
1
- require 'logger'
2
- require 'rbcurse'
3
- if $0 == __FILE__
4
- include RubyCurses
5
- include RubyCurses::Utils
6
-
7
- begin
8
- # Initialize curses
9
- VER::start_ncurses # this is initializing colors via ColorMap.setup
10
- $log = Logger.new((File.join(ENV["LOGDIR"] || "./" ,"rbc13.log")))
11
- $log.level = Logger::DEBUG
12
-
13
- @window = VER::Window.root_window
14
-
15
- catch(:close) do
16
- colors = Ncurses.COLORS
17
- @form = Form.new @window
18
- r = 1; c = 1;
19
- arr=[]; sarr=[]
20
-
21
- sarr << "ACS_BBSS"
22
- arr << FFI::NCurses::ACS_BBSS
23
- sarr << "ACS_BLOCK"
24
- arr << FFI::NCurses::ACS_BLOCK
25
- sarr << "ACS_BOARD"
26
- arr << FFI::NCurses::ACS_BOARD
27
- sarr << "ACS_BSBS"
28
- arr << FFI::NCurses::ACS_BSBS
29
- sarr << "ACS_BSSB"
30
- arr << FFI::NCurses::ACS_BSSB
31
- sarr << "ACS_BSSS"
32
- arr << FFI::NCurses::ACS_BSSS
33
- sarr << "ACS_BTEE"
34
- arr << FFI::NCurses::ACS_BTEE
35
- sarr << "ACS_BULLET"
36
- arr << FFI::NCurses::ACS_BULLET
37
- sarr << "ACS_CKBOARD"
38
- arr << FFI::NCurses::ACS_CKBOARD
39
- sarr << "ACS_DARROW"
40
- arr << FFI::NCurses::ACS_DARROW
41
- sarr << "ACS_DEGREE"
42
- arr << FFI::NCurses::ACS_DEGREE
43
- sarr << "ACS_DIAMOND"
44
- arr << FFI::NCurses::ACS_DIAMOND
45
- sarr << "ACS_GEQUAL"
46
- arr << FFI::NCurses::ACS_GEQUAL
47
- sarr << "ACS_HLINE"
48
- arr << FFI::NCurses::ACS_HLINE
49
- sarr << "ACS_LANTERN"
50
- arr << FFI::NCurses::ACS_LANTERN
51
- sarr << "ACS_LARROW"
52
- arr << FFI::NCurses::ACS_LARROW
53
- sarr << "ACS_LEQUAL"
54
- arr << FFI::NCurses::ACS_LEQUAL
55
- sarr << "ACS_LLCORNER"
56
- arr << FFI::NCurses::ACS_LLCORNER
57
- sarr << "ACS_LRCORNER"
58
- arr << FFI::NCurses::ACS_LRCORNER
59
- sarr << "ACS_LTEE"
60
- arr << FFI::NCurses::ACS_LTEE
61
- sarr << "ACS_NEQUAL"
62
- arr << FFI::NCurses::ACS_NEQUAL
63
- sarr << "ACS_PI"
64
- arr << FFI::NCurses::ACS_PI
65
- sarr << "ACS_PLMINUS"
66
- arr << FFI::NCurses::ACS_PLMINUS
67
- sarr << "ACS_PLUS"
68
- arr << FFI::NCurses::ACS_PLUS
69
- sarr << "ACS_RARROW"
70
- arr << FFI::NCurses::ACS_RARROW
71
- sarr << "ACS_RTEE"
72
- arr << FFI::NCurses::ACS_RTEE
73
- sarr << "ACS_S1"
74
- arr << FFI::NCurses::ACS_S1
75
- sarr << "ACS_S3"
76
- arr << FFI::NCurses::ACS_S3
77
- sarr << "ACS_S7"
78
- arr << FFI::NCurses::ACS_S7
79
- sarr << "ACS_S9"
80
- arr << FFI::NCurses::ACS_S9
81
- sarr << "ACS_SBBS"
82
- arr << FFI::NCurses::ACS_SBBS
83
- sarr << "ACS_SBSB"
84
- arr << FFI::NCurses::ACS_SBSB
85
- sarr << "ACS_SBSS"
86
- arr << FFI::NCurses::ACS_SBSS
87
- sarr << "ACS_SSBB"
88
- arr << FFI::NCurses::ACS_SSBB
89
- sarr << "ACS_SSBS"
90
- arr << FFI::NCurses::ACS_SSBS
91
- sarr << "ACS_SSSB"
92
- arr << FFI::NCurses::ACS_SSSB
93
- sarr << "ACS_SSSS"
94
- arr << FFI::NCurses::ACS_SSSS
95
- sarr << "ACS_STERLING"
96
- arr << FFI::NCurses::ACS_STERLING
97
- sarr << "ACS_TTEE"
98
- arr << FFI::NCurses::ACS_TTEE
99
- sarr << "ACS_UARROW"
100
- arr << FFI::NCurses::ACS_UARROW
101
- sarr << "ACS_ULCORNER"
102
- arr << FFI::NCurses::ACS_ULCORNER
103
- sarr << "ACS_URCORNER"
104
- arr << FFI::NCurses::ACS_URCORNER
105
- sarr << "ACS_VLINE"
106
- arr << FFI::NCurses::ACS_VLINE
107
-
108
- sarr.each_index { |i|
109
- @window.mvaddch r,c, arr[i]
110
- @window.mvprintw r,c+2,"%s", :string, sarr[i]
111
- r+=1
112
- if r == 25
113
- r = 1
114
- c+=25
115
- end
116
- }
117
-
118
- #@form.repaint
119
- @window.wrefresh
120
- Ncurses::Panel.update_panels
121
- while((ch = @window.getchar()) != ?q.getbyte(0) )
122
- break if ch == 32 || ch == 13
123
- str = keycode_tos ch
124
- @form.handle_key(ch)
125
- @window.wrefresh
126
- end
127
- end
128
- rescue => ex
129
- ensure
130
- @window.destroy if !@window.nil?
131
- VER::stop_ncurses
132
- p ex if ex
133
- p(ex.backtrace.join("\n")) if ex
134
- $log.debug( ex) if ex
135
- $log.debug(ex.backtrace.join("\n")) if ex
136
- end
137
- end
@@ -1,91 +0,0 @@
1
- #$LOAD_PATH << "/Users/rahul/work/projects/rbcurse/"
2
- require 'logger'
3
- #require 'lib/rbcurse/mapper'
4
- #require 'lib/rbcurse/keylabelprinter'
5
- #require 'lib/rbcurse/commonio'
6
- #require 'lib/rbcurse/rwidget'
7
- #require 'lib/rbcurse/rform'
8
- require 'rbcurse/extras/rcomboedit'
9
- if $0 == __FILE__
10
- include RubyCurses
11
-
12
- begin
13
- # Initialize curses
14
- VER::start_ncurses # this is initializing colors via ColorMap.setup
15
- $log = Logger.new((File.join(ENV["LOGDIR"] || "./" ,"rbc13.log")))
16
- $log.level = Logger::DEBUG
17
-
18
- @window = VER::Window.root_window
19
- # Initialize few color pairs
20
- # Create the window to be associated with the form
21
- # Un post form and free the memory
22
-
23
- catch(:close) do
24
- @form = Form.new @window
25
- r = 1; c = 30;
26
- mylist = []
27
- 0.upto(100) { |i| mylist << i.to_s }
28
- combo = ComboBoxEdit.new @form do
29
- name "combo"
30
- row r
31
- col c
32
- bgcolor :magenta
33
- display_length 10
34
- editable false
35
- list mylist
36
- set_label Label.new @form, {'text' => "Non-edit Combo"}
37
- list_config 'color' => 'black', 'bgcolor'=>'magenta', 'max_visible_items' => 6
38
- end
39
- r+=1
40
- $results = Variable.new
41
- $results.value = "Event:"
42
- status = RubyCurses::Label.new @form, {'text_variable' => $results, "row" => 22, "col" => 2}
43
- # since updated from another window, so explicit repaint required
44
- $results.update_command { status.repaint }
45
-
46
- v_positions = [:BELOW, :SAME, :CENTER, :CENTER, :ABOVE, :ABOVE]
47
- #h_positions = [:SAME, :LEFT, :RIGHT, :SAME, :SAME, :ABOVE]
48
- policies = [:NO_INSERT, :INSERT_AT_TOP, :INSERT_AT_BOTTOM,
49
- :INSERT_AT_CURRENT, :INSERT_BEFORE_CURRENT, :INSERT_AFTER_CURRENT]
50
- policies.each_with_index do |policy, ix|
51
- name="combo#{r}"
52
- list = ListDataModel.new( %w[spotty tiger secret pass torvalds qwerty quail toiletry])
53
- list.bind(:LIST_DATA_EVENT, name) { |lde,n| $results.value = lde.to_s[0,70]; $log.debug " STA: #{$results} #{lde}" }
54
- list.bind(:ENTER_ROW, name) { |obj,n| $results.value = "ENTER_ROW :#{obj.current_index} : #{obj.selected_item} "; $log.debug " ENTER_ROW: #{$results.value} , #{obj}" }
55
- ComboBoxEdit.new @form do
56
- name name
57
- row r
58
- col 30
59
- display_length 10
60
- bgcolor 'cyan'
61
- editable true
62
- #list %w[spotty tiger secret pass torvalds qwerty quail toiletry]
63
- list_data_model list
64
- insert_policy policy
65
- set_label Label.new @form, {'text' => "Combo: "+policy.to_s}
66
- list_config 'color' => 'white', 'bgcolor'=>'blue', 'valign' => v_positions[ix]
67
- end
68
- r+=2
69
- end
70
-
71
- @help = "Use UP and DOWN to navigate values, alt-DOWN for popup, TAB / BACKTAB between fields. F10-quit"
72
- RubyCurses::Label.new @form, {'text' => @help, "row" => 21, "col" => 2, "color" => "yellow"}
73
-
74
- @form.repaint
75
- @window.wrefresh
76
- Ncurses::Panel.update_panels
77
- while((ch = @window.getchar()) != KEY_F10 )
78
- @form.handle_key(ch)
79
- @window.wrefresh
80
- end
81
- end
82
- rescue => ex
83
- ensure
84
- @window.destroy if !@window.nil?
85
- VER::stop_ncurses
86
- p ex if ex
87
- p(ex.backtrace.join("\n")) if ex
88
- $log.debug( ex) if ex
89
- $log.debug(ex.backtrace.join("\n")) if ex
90
- end
91
- end
@@ -1,66 +0,0 @@
1
- require 'logger'
2
- require 'rbcurse'
3
- require 'rbcurse/rtextarea'
4
- #require 'rbcurse/oldrtextarea'
5
- if $0 == __FILE__
6
- include RubyCurses
7
- include RubyCurses::Utils
8
-
9
- begin
10
- # Initialize curses
11
- VER::start_ncurses # this is initializing colors via ColorMap.setup
12
- $log = Logger.new((File.join(ENV["LOGDIR"] || "./" ,"rbc13.log")))
13
-
14
- $log.level = Logger::DEBUG
15
-
16
- @window = VER::Window.root_window
17
-
18
- catch(:close) do
19
- colors = Ncurses.COLORS
20
- $log.debug "START #{colors} colors ---------"
21
- @form = Form.new @window
22
- r = 1; c = 30;
23
-
24
- texta = TextArea.new @form do
25
- name "mytext"
26
- row r
27
- col c
28
- width 60
29
- height 15
30
- editable false
31
- focusable false
32
- title "Keypresses"
33
- auto_scroll true
34
- title_attrib (Ncurses::A_REVERSE | Ncurses::A_BOLD)
35
- end
36
- help = "q to quit. Check keys. F1..10, C-a..z, Alt a-zA-Z0-9, C-left,rt, Sh-F5..10 .: #{$0}"
37
- help1 = "Press in quick succession: 1) M-[, w and (2) M-[, M-w. (3) M-Sh-O, w."
38
- RubyCurses::Label.new @form, {'text' => help, "row" => 21, "col" => 2, "color" => "yellow"}
39
- RubyCurses::Label.new @form, {'text' => help1, "row" => 22, "col" => 2, "color" => "green"}
40
-
41
- @form.repaint
42
- @window.wrefresh
43
- Ncurses::Panel.update_panels
44
- while((ch = @window.getchar()) != ?q.getbyte(0) )
45
- str = keycode_tos ch
46
- $log.debug "#{ch} got (#{str})"
47
- texta << "#{ch} got (#{str})"
48
- texta.repaint
49
- # 2010-01-01 16:00 not much point calling handle_key since textarea is not editable
50
- # and will return unhandled and thus NOT do a repaint. so we have to repaint anyway.
51
- #ret = @form.handle_key(ch)
52
- #$log.debug " form handlekey returned: #{ret} "
53
- @form.repaint
54
- @window.wrefresh
55
- end
56
- end
57
- rescue => ex
58
- ensure
59
- @window.destroy if !@window.nil?
60
- VER::stop_ncurses
61
- p ex if ex
62
- p(ex.backtrace.join("\n")) if ex
63
- $log.debug( ex) if ex
64
- $log.debug(ex.backtrace.join("\n")) if ex
65
- end
66
- end
@@ -1,113 +0,0 @@
1
- # this program tests out various widgets.
2
- #require 'ncurses' # FFI
3
- require 'logger'
4
- require 'rbcurse'
5
- require 'rbcurse/rwidget'
6
- #require 'rbcurse/listcellrenderer'
7
- #require 'rbcurse/celleditor'
8
- require 'rbcurse/rlistbox'
9
- require 'rbcurse/vieditable'
10
- require 'rbcurse/undomanager'
11
- #require 'rbcurse/rmessagebox'
12
- class RubyCurses::Listbox
13
- # vieditable includes listeditable which
14
- # does bring in some functions which can crash program like x and X TODO
15
- # also, f overrides list f mapping. TODO
16
- include ViEditable
17
- end
18
- if $0 == __FILE__
19
- include RubyCurses
20
-
21
- begin
22
- # Initialize curses
23
- VER::start_ncurses # this is initializing colors via ColorMap.setup
24
- $log = Logger.new((File.join(ENV["LOGDIR"] || "./" ,"rbc13.log")))
25
- $log.level = Logger::DEBUG
26
-
27
- @window = VER::Window.root_window
28
- $catch_alt_digits = true; # emacs like alt-1..9 numeric arguments
29
- # Initialize few color pairs
30
- # Create the window to be associated with the form
31
- # Un post form and free the memory
32
-
33
- catch(:close) do
34
- colors = Ncurses.COLORS
35
- $log.debug "START #{colors} colors testlistbox.rb --------- #{@window} "
36
- @form = Form.new @window
37
- @form.window.printstring 0, 30, "Demo of Listbox - rbcurse", $normalcolor, 'reverse'
38
- r = 1; fc = 1;
39
-
40
- $results = Variable.new
41
- $results.value = "A list with vim-like key bindings. Try j k gg G o O C dd u (undo) C-r (redo) f<char> w yy p P. Also try emacs's kill-ring save/yank/cycle using M-w C-y M-y. Also, C-u and M1..9 numeric arguments."
42
- var = RubyCurses::Label.new @form, {'text_variable' => $results, "row" => r+12, "col" => fc, "display_length" => 80, "height" => 5}
43
- r += 1
44
- mylist = []
45
- 0.upto(100) { |v| mylist << "#{v} scrollable data" }
46
- $listdata = Variable.new mylist
47
- listb = Listbox.new @form do
48
- name "mylist"
49
- row r
50
- col 1
51
- width 40
52
- height 11
53
- # list mylist
54
- list_variable $listdata
55
- #selection_mode :SINGLE
56
- show_selector true
57
- row_selected_symbol "[X] "
58
- row_unselected_symbol "[ ] "
59
- title "A long list"
60
- title_attrib 'reverse'
61
- cell_editing_allowed false
62
- end
63
- listb.one_key_selection = false # this allows us to map keys to methods
64
- listb.vieditable_init_listbox
65
- undom = SimpleUndo.new listb
66
-
67
- #listb.list.insert 55, "hello ruby", "so long python", "farewell java", "RIP .Net"
68
-
69
- # just for demo, lets scroll the text view as we scroll this.
70
- # listb.bind(:ENTER_ROW, @textview) { |alist, tview| tview.top_row alist.current_index }
71
-
72
- #list = ListDataModel.new( %w[spotty tiger panther jaguar leopard ocelot lion])
73
- #list.bind(:LIST_DATA_EVENT) { |lde| $message.value = lde.to_s; $log.debug " STA: #{$message.value} #{lde}" }
74
- #list.bind(:ENTER_ROW) { |obj| $message.value = "ENTER_ROW :#{obj.current_index} : #{obj.selected_item} "; $log.debug " ENTER_ROW: #{$message.value} , #{obj}" }
75
-
76
- # using ampersand to set mnemonic
77
- col = 1
78
- row = 20
79
- cancel_button = Button.new @form do
80
- #variable $results
81
- text "&Cancel"
82
- row row
83
- col col + 10
84
- #surround_chars ['{ ',' }'] ## change the surround chars
85
- end
86
- cancel_button.command { |form|
87
- if confirm("Do your really want to quit?")== :YES
88
- throw(:close);
89
- else
90
- $message.value = "Quit aborted"
91
- end
92
- }
93
-
94
-
95
- @form.repaint
96
- @window.wrefresh
97
- Ncurses::Panel.update_panels
98
- while((ch = @window.getchar()) != KEY_F1 )
99
- @form.handle_key(ch)
100
- #@form.repaint
101
- @window.wrefresh
102
- end
103
- end
104
- rescue => ex
105
- ensure
106
- @window.destroy if !@window.nil?
107
- VER::stop_ncurses
108
- p ex if ex
109
- p(ex.backtrace.join("\n")) if ex
110
- $log.debug( ex) if ex
111
- $log.debug(ex.backtrace.join("\n")) if ex
112
- end
113
- end