rbcurse 1.1.5 → 1.2.0.pre

Sign up to get free protection for your applications and to get access to all the features.
Files changed (123) hide show
  1. data/CHANGELOG +45 -0
  2. data/Makefile +1 -1
  3. data/Manifest.txt +91 -0
  4. data/NOTES +349 -2
  5. data/README.markdown +12 -0
  6. data/VERSION +1 -1
  7. data/examples/abasiclist.rb +25 -0
  8. data/examples/alpmenu.rb +42 -0
  9. data/examples/app.rb +883 -0
  10. data/examples/appcombo.rb +17 -0
  11. data/examples/appdirtree.rb +73 -0
  12. data/examples/appemail.rb +164 -0
  13. data/examples/appemaillb.rb +308 -0
  14. data/examples/appgcompose.rb +303 -0
  15. data/examples/appgmail.rb +951 -0
  16. data/examples/atree.rb +56 -0
  17. data/examples/dirtree.rb +78 -0
  18. data/examples/focusmanager.rb +31 -0
  19. data/examples/imap.rb +48 -0
  20. data/examples/menu1.rb +79 -0
  21. data/examples/multispl.rb +86 -0
  22. data/examples/rfe.rb +3 -4
  23. data/examples/rmail.rb +188 -0
  24. data/examples/s.rb +10 -0
  25. data/examples/scrollbar.rb +104 -0
  26. data/examples/splitp.rb +56 -0
  27. data/examples/table1.rb +30 -0
  28. data/examples/term.rb +48 -0
  29. data/examples/term2.rb +54 -0
  30. data/examples/test1.rb +4 -2
  31. data/examples/test2.rb +9 -9
  32. data/examples/testapp.rb +44 -0
  33. data/examples/testapp2.rb +51 -0
  34. data/examples/testcombo.rb +2 -2
  35. data/examples/testgmail.rb +46 -0
  36. data/examples/testlistbox.rb +0 -1
  37. data/examples/testmultispl.rb +199 -0
  38. data/examples/testree.rb +127 -0
  39. data/examples/testscroller.rb +0 -1
  40. data/examples/testscrolllb.rb +1 -1
  41. data/examples/testscrollp.rb +2 -1
  42. data/examples/testscrollta.rb +1 -1
  43. data/examples/testscrolltable.rb +1 -2
  44. data/examples/testsplit.rb +1 -1
  45. data/examples/testsplit2.rb +1 -1
  46. data/examples/testsplit3.rb +1 -1
  47. data/examples/testsplit3_1.rb +1 -1
  48. data/examples/testsplit3a.rb +1 -1
  49. data/examples/testsplit3b.rb +1 -1
  50. data/examples/testsplitta.rb +1 -1
  51. data/examples/testsplittv.rb +1 -1
  52. data/examples/testsplittvv.rb +1 -1
  53. data/examples/testtodo.rb +491 -488
  54. data/examples/testvimsplit.rb +111 -0
  55. data/examples/todo.db +0 -0
  56. data/examples/todocsv.csv +28 -0
  57. data/examples/viewtodo.rb +408 -403
  58. data/lib/rbcurse/action.rb +1 -0
  59. data/lib/rbcurse/app.rb +1294 -0
  60. data/lib/rbcurse/applicationheader.rb +7 -2
  61. data/lib/rbcurse/checkboxcellrenderer.rb +0 -12
  62. data/lib/rbcurse/colormap.rb +34 -8
  63. data/lib/rbcurse/comboboxcellrenderer.rb +0 -11
  64. data/lib/rbcurse/defaultlistselectionmodel.rb +23 -7
  65. data/lib/rbcurse/extras/bottomline.rb +1681 -0
  66. data/lib/rbcurse/extras/directorylist.rb +445 -0
  67. data/lib/rbcurse/extras/directorytree.rb +69 -0
  68. data/lib/rbcurse/extras/divider.rb +310 -0
  69. data/lib/rbcurse/extras/focusmanager.rb +31 -0
  70. data/lib/rbcurse/extras/listselectable.rb +222 -0
  71. data/lib/rbcurse/extras/masterdetail.rb +164 -0
  72. data/lib/rbcurse/extras/menutree.rb +63 -0
  73. data/lib/rbcurse/extras/rlink.rb +27 -0
  74. data/lib/rbcurse/extras/rmenulink.rb +21 -0
  75. data/lib/rbcurse/extras/scrollbar.rb +134 -0
  76. data/lib/rbcurse/extras/stdscrwindow.rb +247 -0
  77. data/lib/rbcurse/extras/tabular.rb +258 -0
  78. data/lib/rbcurse/extras/tabularwidget.rb +1070 -0
  79. data/lib/rbcurse/extras/viewer.rb +106 -0
  80. data/lib/rbcurse/io.rb +137 -80
  81. data/lib/rbcurse/keylabelprinter.rb +4 -0
  82. data/lib/rbcurse/listcellrenderer.rb +91 -59
  83. data/lib/rbcurse/listscrollable.rb +93 -95
  84. data/lib/rbcurse/listselectable.rb +60 -7
  85. data/lib/rbcurse/ractionevent.rb +67 -0
  86. data/lib/rbcurse/rbasiclistbox.rb +688 -0
  87. data/lib/rbcurse/rcombo.rb +5 -5
  88. data/lib/rbcurse/rcommandwindow.rb +555 -0
  89. data/lib/rbcurse/rinputdataevent.rb +12 -0
  90. data/lib/rbcurse/rlistbox.rb +305 -124
  91. data/lib/rbcurse/rmenu.rb +99 -46
  92. data/lib/rbcurse/rmessagebox.rb +13 -6
  93. data/lib/rbcurse/rmulticontainer.rb +54 -93
  94. data/lib/rbcurse/rmultisplit.rb +731 -0
  95. data/lib/rbcurse/rmultitextview.rb +3 -2
  96. data/lib/rbcurse/rpopupmenu.rb +0 -1
  97. data/lib/rbcurse/rprogress.rb +117 -0
  98. data/lib/rbcurse/rscrollpane.rb +2 -1
  99. data/lib/rbcurse/rsplitpane.rb +94 -20
  100. data/lib/rbcurse/rsplitpane2.rb +1009 -0
  101. data/lib/rbcurse/rtabbedpane.rb +3 -2
  102. data/lib/rbcurse/rtabbedwindow.rb +0 -1
  103. data/lib/rbcurse/rtable.rb +92 -64
  104. data/lib/rbcurse/rtextarea.rb +91 -57
  105. data/lib/rbcurse/rtextview.rb +223 -70
  106. data/lib/rbcurse/rtree.rb +723 -0
  107. data/lib/rbcurse/rviewport.rb +2 -1
  108. data/lib/rbcurse/rvimsplit.rb +768 -0
  109. data/lib/rbcurse/rwidget.rb +524 -325
  110. data/lib/rbcurse/table/tablecellrenderer.rb +1 -1
  111. data/lib/rbcurse/table/tabledatecellrenderer.rb +0 -1
  112. data/lib/rbcurse/tree/treecellrenderer.rb +137 -0
  113. data/lib/rbcurse/tree/treemodel.rb +428 -0
  114. data/lib/rbcurse/vieditable.rb +14 -13
  115. data/lib/ver/ncurses.rb +6 -0
  116. data/lib/ver/window.rb +67 -32
  117. metadata +99 -23
  118. data/bin/rbcurse +0 -0
  119. data/examples/rvimsplit.rb +0 -376
  120. data/examples/todo.rb +0 -1
  121. data/lib/rbcurse/rform.rb +0 -845
  122. data/lib/rbcurse/selectable.rb +0 -94
  123. data/rbcurse.gemspec +0 -188
data/lib/rbcurse/rmenu.rb CHANGED
@@ -12,6 +12,7 @@ NOTE : this program works but is one of the first programs and is untouched. It
12
12
  since its quite crappy.
13
13
  Also, we should move to Action classes as against just blokcs of code. And action class would have
14
14
  a user friendly string to identifiy the action, as well as a disabled option.
15
+ NOTE on 2010-09-10 11:40 : this interface is based on Java's and is not block friendy. Also, i tried to keep the same class to work for horizontal menu bar and vertical submenus as per java's classes and this makes the code very complex. I should just make 2 classes and keep it simple.
15
16
 
16
17
  --------
17
18
  * Date: 2008-11-14 23:43
@@ -59,7 +60,7 @@ module RubyCurses
59
60
  attr_accessor :row
60
61
  attr_accessor :col
61
62
  attr_accessor :width
62
- attr_accessor :accelerator
63
+ attr_writer :accelerator
63
64
  attr_accessor :enabled
64
65
  attr_accessor :text, :mnemonic # changed reader to accessor
65
66
  def initialize text, mnemonic=nil, &block
@@ -76,25 +77,38 @@ module RubyCurses
76
77
  @command = block if block_given?
77
78
  @args = args
78
79
  end
80
+ # add accelerator for a menu item
81
+ # NOTE: accelerator means that the application has tied this string to some action, outside
82
+ # of the menu bar. It does not mean that the menu bar will trigger the action. So the app still has to
83
+ # define the action and bind a key to that accelerator. This is only informative.
84
+ # Had to do this since dsl_accessor was throwing some nilclass does not have []= nomethod error
85
+ # This allows user to put accelerator inside dsl block
86
+ # @example
87
+ # accelerator "Ctrl-X"
88
+ def accelerator(*val)
89
+ if val.empty?
90
+ return @accelerator
91
+ else
92
+ @accelerator = val[0]
93
+ end
94
+ end
79
95
  def on_enter
80
- $log.debug ">>>on enter menuitem : #{@text} #{@row} #{@width} "
81
96
  highlight
82
97
  end
83
98
  def on_leave
84
- $log.debug ">>>on leave menuitem : #{@text} "
85
99
  highlight false
86
100
  end
87
101
  ## XXX it could be a menu again
88
102
  def fire
89
- $log.debug ">>>fire menuitem : #{@text} #{@command} "
103
+ #$log.debug ">>>fire menuitem : #{@text} #{@command} "
90
104
  @command.call self, *@args if !@command.nil?
91
105
  @parent.clear_menus
92
106
  return :CLOSE # added 2009-01-02 00:09 to close only actions, not submenus
93
107
  end
94
108
  def highlight tf=true
95
109
  if @parent.nil? or @parent.window.nil?
96
- $log.debug "HL XXX #{self} parent nil"
97
- $log.debug "HL XXX #{self} - > #{@parent} parent nil"
110
+ #$log.debug "HL XXX #{self} parent nil"
111
+ #$log.debug "HL XXX #{self} - > #{@parent} parent nil"
98
112
  end
99
113
  if tf
100
114
  color = $datacolor
@@ -115,6 +129,7 @@ module RubyCurses
115
129
  acolor = $reversecolor
116
130
  acolor = get_color($reversecolor, 'green', 'white') if !@enabled
117
131
  @parent.window.printstring( @row, 0, "|%-*s|" % [@width, text], acolor)
132
+ if @enabled # 2010-09-10 23:56
118
133
  if !@accelerator.nil?
119
134
  @parent.window.printstring( r, (@width+1)-@accelerator.length, @accelerator, acolor)
120
135
  elsif !@mnemonic.nil?
@@ -125,9 +140,10 @@ module RubyCurses
125
140
  # prev line changed since not working in vt100 and vt200
126
141
  @parent.window.printstring( r, ix+1, charm, $reversecolor, 'reverse') if !ix.nil?
127
142
  end
143
+ end
128
144
  end
129
145
  def destroy
130
- $log.debug "DESTRY menuitem #{@text}"
146
+ $log.debug "DESTROY menuitem #{@text}"
131
147
  end
132
148
  end
133
149
  ##class Menu
@@ -150,12 +166,11 @@ module RubyCurses
150
166
  @@col = 0
151
167
 
152
168
  def initialize text, &block
153
- super text, nil, &block
154
169
  @text = text
155
170
  @items = []
156
171
  @enabled = true
157
172
  @current_menu = []
158
- instance_eval &block if block_given?
173
+ super text, nil, &block
159
174
  @row ||=10
160
175
  @col ||=10
161
176
  @@menus ||= []
@@ -167,17 +182,39 @@ module RubyCurses
167
182
  def to_s
168
183
  @text
169
184
  end
170
- # item could be menuitem or another menu
185
+ # item could be menuitem or another menu (precreated)
171
186
  def add menuitem
187
+ #$log.debug " YYYY inside add menuitem #{menuitem.text} "
172
188
  @items << menuitem
173
189
  return self
174
190
  end
191
+ alias :<< :add
192
+
193
+ # add item method which could be used from blocks
194
+ # add 2010-09-10 12:20 simplifying
195
+ def item text, mnem, &block
196
+ #$log.debug "YYYY inside M: menuitem text #{text} "
197
+ m = MenuItem.new text, mnem, &block
198
+ add m
199
+ return m
200
+ end
201
+ # create a menu within a menu
202
+ # add menu method which could be used from blocks
203
+ # add 2010-09-10 12:20 simplifying
204
+ def menu text, &block
205
+ #$log.debug "YYYY inside M: menu text #{text} "
206
+ m = Menu.new text, &block
207
+ add m
208
+ return m
209
+ end
175
210
  def insert_separator ix
176
211
  @items.insert ix, MenuSeparator.new
177
212
  end
178
213
  def add_separator
179
214
  @items << MenuSeparator.new
180
215
  end
216
+ alias :separator :add_separator
217
+
181
218
  ## added 2009-01-21 12:09 NEW
182
219
  def get_item i
183
220
  @items[i]
@@ -211,7 +248,7 @@ module RubyCurses
211
248
  # DRAW menuitems
212
249
  def repaint # menu.repaint
213
250
  return if @items.nil? or @items.empty?
214
- $log.debug "menu repaint: #{text} row #{@row} col #{@col} "
251
+ #$log.debug "menu repaint: #{text} row #{@row} col #{@col} "
215
252
  if !@parent.is_a? RubyCurses::MenuBar
216
253
  @parent.window.printstring( @row, 0, "|%-*s>|" % [@width-1, text], $reversecolor)
217
254
  @parent.window.refresh
@@ -228,7 +265,7 @@ module RubyCurses
228
265
  # recursive if given one not enabled goes to next enabled
229
266
  def select_item ix0
230
267
  return if @items.nil? or @items.empty?
231
- $log.debug "insdie select item : #{ix0} active: #{@active_index}"
268
+ #$log.debug "insdie select item : #{ix0} active: #{@active_index}"
232
269
  if !@active_index.nil?
233
270
  @items[@active_index].on_leave
234
271
  end
@@ -237,7 +274,7 @@ module RubyCurses
237
274
  if @items[ix0].enabled
238
275
  @items[ix0].on_enter
239
276
  else
240
- $log.debug "insdie sele nxt item ENABLED FALSE : #{ix0}"
277
+ #$log.debug "insdie sele nxt item ENABLED FALSE : #{ix0}"
241
278
  if @active_index > previtem
242
279
  select_next_item
243
280
  else
@@ -248,7 +285,7 @@ module RubyCurses
248
285
  end
249
286
  def select_next_item
250
287
  return if @items.nil? or @items.empty?
251
- $log.debug "insdie sele nxt item : #{@active_index}"
288
+ #$log.debug "insdie sele nxt item : #{@active_index}"
252
289
  @active_index = -1 if @active_index.nil?
253
290
  if @active_index < @items.length-1
254
291
  select_item @active_index + 1
@@ -258,7 +295,7 @@ module RubyCurses
258
295
  end
259
296
  def select_prev_item
260
297
  return if @items.nil? or @items.empty?
261
- $log.debug "insdie sele prv item : #{@active_index}"
298
+ #$log.debug "insdie sele prv item : #{@active_index}"
262
299
  if @active_index > 0
263
300
  select_item @active_index - 1
264
301
  else
@@ -266,7 +303,7 @@ module RubyCurses
266
303
  end
267
304
  end
268
305
  def on_enter # menu.on_enter
269
- $log.debug "menu onenter: #{text} #{@row} #{@col} "
306
+ #$log.debug "menu onenter: #{text} #{@row} #{@col} "
270
307
  # call parent method. XXX
271
308
  if @parent.is_a? RubyCurses::MenuBar
272
309
  @parent.window.printstring( @row, @col, " %s " % text, $datacolor)
@@ -274,24 +311,24 @@ module RubyCurses
274
311
  highlight
275
312
  end
276
313
  if !@window.nil? #and @parent.selected
277
- $log.debug "menu onenter: #{text} calling window,show"
314
+ #$log.debug "menu onenter: #{text} calling window,show"
278
315
  @window.show
279
316
  select_item 0
280
317
  elsif @parent.is_a? RubyCurses::MenuBar and @parent.selected
281
318
  # only on the top level do we open a window if a previous one was opened
282
- $log.debug "menu onenter: #{text} calling repaint CLASS: #{@parent.class}"
319
+ #$log.debug "menu onenter: #{text} calling repaint CLASS: #{@parent.class}"
283
320
  # repaint
284
321
  create_window
285
322
  end
286
323
  end
287
324
  def on_leave # menu.on_leave
288
- $log.debug "menu onleave: #{text} #{@row} #{@col} "
325
+ #$log.debug "menu onleave: #{text} #{@row} #{@col} "
289
326
  # call parent method. XXX
290
327
  if @parent.is_a? RubyCurses::MenuBar
291
328
  @parent.window.printstring( @row, @col, " %s " % text, $reversecolor)
292
329
  @window.hide if !@window.nil?
293
330
  else
294
- $log.debug "MENU SUBMEN. menu onleave: #{text} #{@row} #{@col} "
331
+ #$log.debug "MENU SUBMEN. menu onleave: #{text} #{@row} #{@col} "
295
332
  # parent is a menu
296
333
  highlight false
297
334
  #@parent.current_menu.pop
@@ -300,7 +337,7 @@ module RubyCurses
300
337
  end
301
338
  end
302
339
  def highlight tf=true # menu
303
- $log.debug "MENU SUBMENU menu highlight: #{text} #{@row} #{@col}, PW #{@parent.width} "
340
+ #$log.debug "MENU SUBMENU menu highlight: #{text} #{@row} #{@col}, PW #{@parent.width} "
304
341
  color = tf ? $datacolor : $reversecolor
305
342
  att = tf ? Ncurses::A_REVERSE : Ncurses::A_NORMAL
306
343
  #@parent.window.mvchgat(y=@row, x=1, @width, Ncurses::A_NORMAL, color, nil)
@@ -312,7 +349,7 @@ module RubyCurses
312
349
  def create_window # menu
313
350
  margin = 3
314
351
  @width = array_width @items
315
- $log.debug "create window menu #{@text}: #{@row} ,#{@col},wd #{@width} "
352
+ #$log.debug "create window menu #{@text}: #{@row} ,#{@col},wd #{@width} "
316
353
  @layout = { :height => @items.length+3, :width => @width+margin, :top => @row+1, :left => @col }
317
354
  @win = VER::Window.new(@layout)
318
355
  @window = @win
@@ -343,7 +380,7 @@ module RubyCurses
343
380
  # private
344
381
  def array_width a
345
382
  longest = a.max {|a,b| a.to_s.length <=> b.to_s.length }
346
- $log.debug "array width #{longest}"
383
+ #$log.debug "array width #{longest}"
347
384
  longest.to_s.length
348
385
  end
349
386
  def destroy
@@ -375,18 +412,22 @@ module RubyCurses
375
412
  end
376
413
  case ch
377
414
  when KEY_DOWN
378
- cmenu.select_next_item
415
+ cmenu.select_next_item
416
+ #return cmenu.fire # XXX 2010-10-16 21:39 trying out
417
+ if cmenu.is_a? RubyCurses::Menu
418
+ #alert "is a menu"
419
+ end
379
420
  when KEY_UP
380
421
  cmenu.select_prev_item
381
422
  when KEY_ENTER, 10, 13, 32 # added 32 2008-11-27 23:50
382
423
  return cmenu.fire
383
424
  when KEY_LEFT
384
425
  if cmenu.parent.is_a? RubyCurses::Menu
385
- $log.debug "LEFT IN MENU : #{cmenu.parent.class} len: #{cmenu.parent.current_menu.length}"
386
- $log.debug "left IN MENU : #{cmenu.parent.class} len: #{cmenu.current_menu.length}"
426
+ #$log.debug "LEFT IN MENU : #{cmenu.parent.class} len: #{cmenu.parent.current_menu.length}"
427
+ #$log.debug "left IN MENU : #{cmenu.parent.class} len: #{cmenu.current_menu.length}"
387
428
  end
388
429
  if cmenu.parent.is_a? RubyCurses::Menu and !cmenu.parent.current_menu.empty?
389
- $log.debug " ABOU TO DESTROY DUE TO LEFT"
430
+ #$log.debug " ABOU TO DESTROY DUE TO LEFT"
390
431
  cmenu.parent.current_menu.pop
391
432
  @@menus.pop ## NEW
392
433
  cmenu.destroy
@@ -394,13 +435,13 @@ module RubyCurses
394
435
  return :UNHANDLED
395
436
  end
396
437
  when KEY_RIGHT
397
- $log.debug "RIGHTIN MENU : "
438
+ #$log.debug "RIGHTIN MENU : "
398
439
  if cmenu.parent.is_a? RubyCurses::Menu
399
- $log.debug "right IN MENU : #{cmenu.parent.class} len: #{cmenu.parent.current_menu.length}"
400
- $log.debug "right IN MENU : #{cmenu.parent.class} len: #{cmenu.current_menu.length}"
440
+ #$log.debug "right IN MENU : #{cmenu.parent.class} len: #{cmenu.parent.current_menu.length}"
441
+ #$log.debug "right IN MENU : #{cmenu.parent.class} len: #{cmenu.current_menu.length}"
401
442
  end
402
443
  if cmenu.parent.is_a? RubyCurses::Menu and !cmenu.parent.current_menu.empty?
403
- $log.debug " ABOU TO DESTROY DUE TO RIGHT"
444
+ #$log.debug " ABOU TO DESTROY DUE TO RIGHT"
404
445
  cmenu.parent.current_menu.pop
405
446
  @@menus.pop
406
447
  cmenu.destroy
@@ -420,7 +461,7 @@ module RubyCurses
420
461
  cmenu.items.each do |item|
421
462
  next if !item.respond_to? :mnemonic or item.mnemonic.nil?
422
463
  # $log.debug "inside check_mnemonics #{item.mnemonic}"
423
- if key == item.mnemonic.downcase
464
+ if key == item.mnemonic.downcase && item.enabled # 2010-09-11 00:03 enabled
424
465
  ret = item.fire
425
466
  return ret #0 2009-01-23 00:45
426
467
  end
@@ -429,7 +470,7 @@ module RubyCurses
429
470
  end
430
471
  ## menu
431
472
  def show # menu.show
432
- $log.debug "show (menu) : #{@text} "
473
+ #$log.debug "show (menu) : #{@text} "
433
474
  if @window.nil?
434
475
  create_window
435
476
  end
@@ -464,12 +505,25 @@ module RubyCurses
464
505
  def focusable
465
506
  false
466
507
  end
508
+ # add a precreated menu
467
509
  def add menu
510
+ #$log.debug "YYYY inside MB: add #{menu.text} "
468
511
  @items << menu
469
512
  return self
470
513
  end
514
+ alias :<< :add
515
+
516
+ # add a menu through the block, this would happen through instance eval
517
+ # 2010-09-10 12:07 added while simplifying the interface
518
+ # this calls add so you get the MB back, not a ref to the menu created NOTE
519
+ def menu text, &block
520
+ #$log.debug "YYYY inside MB: menu text #{text} "
521
+ m = Menu.new text, &block
522
+ add m
523
+ return m
524
+ end
471
525
  def next_menu
472
- $log.debug "next meu: #{@active_index} "
526
+ #$log.debug "next meu: #{@active_index} "
473
527
  if @active_index < @items.length-1
474
528
  set_menu @active_index + 1
475
529
  else
@@ -477,7 +531,7 @@ module RubyCurses
477
531
  end
478
532
  end
479
533
  def prev_menu
480
- $log.debug "prev meu: #{@active_index} "
534
+ #$log.debug "prev meu: #{@active_index} "
481
535
  if @active_index > 0
482
536
  set_menu @active_index-1
483
537
  else
@@ -485,7 +539,7 @@ module RubyCurses
485
539
  end
486
540
  end
487
541
  def set_menu index
488
- $log.debug "set meu: #{@active_index} #{index}"
542
+ #$log.debug "set meu: #{@active_index} #{index}"
489
543
  menu = @items[@active_index]
490
544
  menu.on_leave # hide its window, if open
491
545
  @active_index = index
@@ -503,12 +557,12 @@ module RubyCurses
503
557
  begin
504
558
  catch(:menubarclose) do
505
559
  while((ch = @window.getchar()) != @toggle_key )
506
- $log.debug "menuubar inside handle_keys : #{ch}" if ch != -1
560
+ #$log.debug "menuubar inside handle_keys : #{ch}" if ch != -1
507
561
  case ch
508
562
  when -1
509
563
  next
510
564
  when KEY_DOWN
511
- $log.debug "insdie keyDOWN : #{ch}"
565
+ #$log.debug "insdie keyDOWN : #{ch}"
512
566
  if !@selected
513
567
  current_menu.fire
514
568
  else
@@ -518,26 +572,26 @@ module RubyCurses
518
572
  @selected = true
519
573
  when KEY_ENTER, 10, 13, 32
520
574
  @selected = true
521
- $log.debug " mb insdie ENTER : #{current_menu}"
575
+ #$log.debug " mb insdie ENTER : #{current_menu}"
522
576
  ret = current_menu.handle_key ch
523
- $log.debug "ret = #{ret} mb insdie ENTER : #{current_menu}"
577
+ #$log.debug "ret = #{ret} mb insdie ENTER : #{current_menu}"
524
578
  #break; ## 2008-12-29 18:00 This will close after firing
525
579
  #anything
526
580
  break if ret == :CLOSE
527
581
  when KEY_UP
528
- $log.debug " mb insdie keyUPP : #{ch}"
582
+ #$log.debug " mb insdie keyUPP : #{ch}"
529
583
  current_menu.handle_key ch
530
584
  when KEY_LEFT
531
- $log.debug " mb insdie KEYLEFT : #{ch}"
585
+ #$log.debug " mb insdie KEYLEFT : #{ch}"
532
586
  ret = current_menu.handle_key ch
533
587
  prev_menu if ret == :UNHANDLED
534
588
  #display_items if @selected
535
589
  when KEY_RIGHT
536
- $log.debug " mb insdie KEYRIGHT : #{ch}"
590
+ #$log.debug " mb insdie KEYRIGHT : #{ch}"
537
591
  ret = current_menu.handle_key ch
538
592
  next_menu if ret == :UNHANDLED
539
593
  else
540
- $log.debug " mb insdie ELSE : #{ch}"
594
+ #$log.debug " mb insdie ELSE : #{ch}"
541
595
  ret = current_menu.handle_key ch
542
596
  if ret == :UNHANDLED
543
597
  Ncurses.beep
@@ -618,7 +672,6 @@ module RubyCurses
618
672
  end # menubar
619
673
 
620
674
  class CheckBoxMenuItem < MenuItem
621
- include DSL
622
675
  attr_reader :checkbox
623
676
  def initialize text, mnemonic=nil, &block
624
677
  @checkbox = CheckBox.new nil
@@ -655,7 +708,7 @@ module RubyCurses
655
708
  end
656
709
  def method_missing(sym, *args)
657
710
  if checkbox.respond_to? sym
658
- $log.debug("calling CHECKBOXMENU #{sym} called #{args[0]}")
711
+ #$log.debug("calling CHECKBOXMENU #{sym} called #{args[0]}")
659
712
  checkbox.send(sym, args)
660
713
  else
661
714
  $log.error("ERROR CHECKBOXMENU #{sym} called")
@@ -15,7 +15,6 @@ module RubyCurses
15
15
  # dimensions of window should be derived on content
16
16
  #
17
17
  class MessageBox
18
- include DSL
19
18
  include RubyCurses::Utils
20
19
  dsl_accessor :title
21
20
  dsl_accessor :message
@@ -193,9 +192,9 @@ module RubyCurses
193
192
  #$log.debug "popup ENTER : #{field.name}" if !field.nil?
194
193
  @stop = true
195
194
  return
196
- when 9
195
+ when KEY_TAB
197
196
  @form.select_next_field
198
- when 353
197
+ when KEY_BTAB
199
198
  @form.select_prev_field
200
199
  else
201
200
  # fields must return unhandled else we will miss hotkeys.
@@ -243,7 +242,7 @@ module RubyCurses
243
242
  # XXX this needs to go up and decide height of window
244
243
  if @message_height.nil?
245
244
  @message_height = (message.length/display_length)+1
246
- $log.debug " print_message: mh:#{@message_height}, ml: #{message.length}"
245
+ #$log.debug " print_message: mh:#{@message_height}, ml: #{message.length}"
247
246
  end
248
247
  @message_height ||= 1
249
248
  width = @layout[:width]
@@ -258,6 +257,8 @@ module RubyCurses
258
257
  else
259
258
  row=(@layout[:height]/3) if row.nil?
260
259
  @message_col = (width-message.length)/2
260
+ @message_col = 4 if @message_col < 4 # this was often disappearing 2010-10-17 13:00
261
+ #$log.debug "XX ALERT col #{@message_col} w: #{width} len: #{message.length} "
261
262
  end
262
263
  @message_row = row
263
264
  # added 2009-11-05 14:53 to fix erasure of border
@@ -266,7 +267,7 @@ module RubyCurses
266
267
  #@window.printstring( row, @message_col , message, color=$reversecolor)
267
268
  # 2008-12-30 19:45 experimenting with label so we can get justify and wrapping.
268
269
  #@window.printstring( row, @message_col , message, color=$reversecolor)
269
- $log.debug " print_message: row #{row}, col #{@message_col} "
270
+ #$log.debug " print_message: row #{row}, col #{@message_col} "
270
271
  message_label = RubyCurses::Label.new @form, {'text' => message, "name"=>"message_label","row" => row, "col" => @message_col, "display_length" => display_length, "height" => @message_height, "attr"=>"reverse"}
271
272
 
272
273
  end
@@ -298,9 +299,15 @@ module RubyCurses
298
299
  name "input"
299
300
  row r
300
301
  col c
301
- # attr 'reverse'
302
+
302
303
  color 'black'
303
304
  bgcolor 'white'
305
+ # now listcellrenderer only uses BOLD for selected, with a white bgcolor
306
+ # so here it won't show up on white bg
307
+ selected_color 'red'
308
+ selected_bgcolor 'black'
309
+ # just added 2010-10-14 21:24
310
+ border_attrib :reverse
304
311
  width 30
305
312
  height 6
306
313
  list list