rbcurse 1.2.0 → 1.3.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (113) hide show
  1. data/CHANGELOG +20 -0
  2. data/NOTES +45 -0
  3. data/README.markdown +47 -68
  4. data/TODO2.txt +29 -32
  5. data/VERSION +1 -1
  6. data/examples/abasiclist.rb +2 -0
  7. data/examples/app.rb +2 -2
  8. data/examples/app.sample +10 -0
  9. data/examples/appemail.rb +29 -2
  10. data/examples/appemaillb.rb +1 -1
  11. data/examples/appgcompose.rb +9 -2
  12. data/examples/appmethods.rb +69 -0
  13. data/examples/atree.rb +2 -2
  14. data/examples/menu1.rb +1 -1
  15. data/examples/newtesttabp.rb +8 -5
  16. data/examples/qdfilechooser.rb +6 -3
  17. data/examples/rfe.rb +71 -16
  18. data/examples/rmail.rb +76 -7
  19. data/examples/sqlc.rb +14 -3
  20. data/examples/sqlm.rb +3 -3
  21. data/examples/term.rb +48 -0
  22. data/examples/term2.rb +48 -21
  23. data/examples/test1.rb +2 -2
  24. data/examples/test2.rb +162 -71
  25. data/examples/testapp.rb +2 -2
  26. data/examples/testapp2.rb +1 -1
  27. data/examples/testchars.rb +47 -46
  28. data/examples/testcombo.rb +2 -2
  29. data/examples/testkeypress.rb +2 -2
  30. data/examples/testlistbox.rb +2 -2
  31. data/examples/testmenu.rb +1 -1
  32. data/examples/testmulticomp.rb +1 -1
  33. data/examples/testmultispl.rb +1 -1
  34. data/examples/testree.rb +1 -22
  35. data/examples/testscroller.rb +2 -2
  36. data/examples/testscrolllb.rb +2 -2
  37. data/examples/testscrollp.rb +2 -2
  38. data/examples/testscrollta.rb +2 -2
  39. data/examples/testscrolltable.rb +2 -2
  40. data/examples/testsplit.rb +2 -2
  41. data/examples/testsplit2.rb +2 -2
  42. data/examples/testsplit3.rb +2 -2
  43. data/examples/testsplit3_1.rb +2 -2
  44. data/examples/testsplit3a.rb +2 -2
  45. data/examples/testsplit3b.rb +2 -2
  46. data/examples/testsplitta.rb +2 -2
  47. data/examples/testsplittv.rb +2 -2
  48. data/examples/testsplittvv.rb +2 -2
  49. data/examples/testtable.rb +2 -2
  50. data/examples/testtabp.rb +2 -2
  51. data/examples/testtodo.rb +1 -1
  52. data/examples/testtpane.rb +2 -2
  53. data/examples/testtpane2.rb +2 -2
  54. data/examples/testtpanetable.rb +6 -5
  55. data/examples/testvimsplit.rb +2 -2
  56. data/examples/viewtodo.rb +1 -1
  57. data/lib/rbcurse.rb +2 -1
  58. data/lib/rbcurse/action.rb +1 -1
  59. data/lib/rbcurse/app.rb +51 -14
  60. data/lib/rbcurse/applicationheader.rb +1 -1
  61. data/lib/rbcurse/celleditor.rb +1 -1
  62. data/lib/rbcurse/colormap.rb +11 -11
  63. data/lib/rbcurse/comboboxcellrenderer.rb +1 -1
  64. data/lib/rbcurse/extras/bottomline.rb +22 -10
  65. data/lib/rbcurse/extras/directorylist.rb +14 -1
  66. data/lib/rbcurse/extras/divider.rb +1 -1
  67. data/lib/rbcurse/extras/listselectable.rb +2 -2
  68. data/lib/rbcurse/extras/masterdetail.rb +3 -1
  69. data/lib/rbcurse/extras/scrollbar.rb +1 -1
  70. data/lib/rbcurse/extras/stdscrwindow.rb +75 -24
  71. data/lib/rbcurse/extras/tabular.rb +8 -3
  72. data/lib/rbcurse/extras/viewer.rb +18 -2
  73. data/lib/rbcurse/io.rb +26 -13
  74. data/lib/rbcurse/keylabelprinter.rb +3 -2
  75. data/lib/rbcurse/listcellrenderer.rb +1 -0
  76. data/lib/rbcurse/listkeys.rb +3 -2
  77. data/lib/rbcurse/listselectable.rb +4 -3
  78. data/lib/rbcurse/rbasiclistbox.rb +12 -5
  79. data/lib/rbcurse/rcombo.rb +2 -2
  80. data/lib/rbcurse/rcommandwindow.rb +5 -3
  81. data/lib/rbcurse/rdialogs.rb +8 -2
  82. data/lib/rbcurse/rlistbox.rb +10 -2
  83. data/lib/rbcurse/rmenu.rb +4 -4
  84. data/lib/rbcurse/rmessagebox.rb +10 -5
  85. data/lib/rbcurse/rmulticontainer.rb +21 -8
  86. data/lib/rbcurse/rmultisplit.rb +2 -2
  87. data/lib/rbcurse/rmultitextview.rb +5 -3
  88. data/lib/rbcurse/rpopupmenu.rb +3 -3
  89. data/lib/rbcurse/rprogress.rb +3 -2
  90. data/lib/rbcurse/rscrollform.rb +2 -2
  91. data/lib/rbcurse/rscrollpane.rb +9 -9
  92. data/lib/rbcurse/rsplitpane.rb +2 -2
  93. data/lib/rbcurse/rsplitpane2.rb +2 -2
  94. data/lib/rbcurse/rtabbedpane.rb +48 -12
  95. data/lib/rbcurse/rtabbedwindow.rb +4 -4
  96. data/lib/rbcurse/rtable.rb +6 -3
  97. data/lib/rbcurse/rtextarea.rb +8 -8
  98. data/lib/rbcurse/rtextview.rb +3 -2
  99. data/lib/rbcurse/rtree.rb +2 -2
  100. data/lib/rbcurse/rviewport.rb +2 -2
  101. data/lib/rbcurse/rvimsplit.rb +3 -2
  102. data/lib/rbcurse/rwidget.rb +63 -26
  103. data/lib/rbcurse/scrollable.rb +1 -1
  104. data/lib/rbcurse/table/tablecellrenderer.rb +1 -1
  105. data/lib/rbcurse/table/tabledatecellrenderer.rb +1 -1
  106. data/lib/rbcurse/tree/treemodel.rb +1 -1
  107. data/lib/rbcurse/vieditable.rb +1 -0
  108. data/lib/ver/ncurses.rb +122 -4
  109. data/lib/ver/panel.rb +162 -0
  110. data/lib/ver/window.rb +262 -120
  111. metadata +19 -7
  112. data/examples/keytest.rb +0 -178
  113. data/examples/mpad2.rb +0 -156
@@ -15,11 +15,11 @@
15
15
 
16
16
  =end
17
17
  require 'rubygems'
18
- require 'ncurses'
18
+ #require 'ncurses'
19
19
  require 'logger'
20
20
  require 'rbcurse'
21
21
 
22
- include Ncurses
22
+ #include Ncurses # FFI 2011-09-8
23
23
  include RubyCurses
24
24
  module RubyCurses
25
25
  extend self
@@ -159,7 +159,7 @@ module RubyCurses
159
159
  form = tab.form
160
160
  form.window = @window if form.window.nil? ## XXX
161
161
  panel = form.window.panel
162
- @buttons.last.command { Ncurses::Panel.top_panel(panel)
162
+ @buttons.last.command { Ncurses::Panel.top_panel(panel.pointer)
163
163
  Ncurses::Panel.update_panels();
164
164
  Ncurses.doupdate();
165
165
  form.repaint
@@ -173,7 +173,7 @@ module RubyCurses
173
173
  end
174
174
  def display_form form
175
175
  panel = form.window.panel
176
- Ncurses::Panel.top_panel(panel)
176
+ Ncurses::Panel.top_panel(panel.pointer)
177
177
  Ncurses::Panel.update_panels();
178
178
  Ncurses.doupdate();
179
179
  form.repaint
@@ -25,7 +25,7 @@
25
25
 
26
26
  =end
27
27
  require 'rubygems'
28
- require 'ncurses'
28
+ #require 'ncurses'
29
29
  require 'logger'
30
30
  require 'rbcurse'
31
31
  require 'rbcurse/table/tablecellrenderer'
@@ -34,7 +34,7 @@ require 'rbcurse/checkboxcellrenderer'
34
34
  require 'rbcurse/listselectable'
35
35
  require 'rbcurse/listkeys'
36
36
 
37
- include Ncurses
37
+ #include Ncurses # FFI 2011-09-8
38
38
  include RubyCurses
39
39
  module RubyCurses
40
40
  extend self
@@ -1023,8 +1023,11 @@ module RubyCurses
1023
1023
  marker = @_first_column_print > 0 ? Ncurses::ACS_CKBOARD : Ncurses::ACS_HLINE
1024
1024
  @graphic.mvwaddch @row+@height-1, @col+@_first_column_print+1, marker
1025
1025
  end
1026
+ # print table header
1027
+ # 2011-09-17 added repaint all check so that external components can triger this
1028
+ # e.g. multi-container when it changes tables.
1026
1029
  def print_header
1027
- return unless @table_changed
1030
+ return unless @table_changed || @repaint_all
1028
1031
  $log.debug " TABLE: inside printheader 2009-10-07 11:51 DDD "
1029
1032
 
1030
1033
  r,c = rowcol
@@ -16,14 +16,14 @@ Todo:
16
16
 
17
17
  =end
18
18
  require 'rubygems'
19
- require 'ncurses'
19
+ ##require 'ncurses' # FFI removed
20
20
  require 'logger'
21
21
  require 'rbcurse'
22
22
  require 'rbcurse/listscrollable'
23
23
  require 'rbcurse/rinputdataevent'
24
24
  require 'rbcurse/listeditable'
25
25
 
26
- include Ncurses
26
+ #include Ncurses # FFI 2011-09-8
27
27
  include RubyCurses
28
28
  module RubyCurses
29
29
  extend self
@@ -241,10 +241,10 @@ module RubyCurses
241
241
 
242
242
  def map_keys
243
243
  return if @keys_mapped
244
- bind_key(KEY_LEFT){ cursor_backward }
245
- bind_key(KEY_RIGHT){ cursor_forward }
246
- bind_key(KEY_UP){ up }
247
- bind_key(KEY_DOWN){ down }
244
+ bind_key(Ncurses::KEY_LEFT){ cursor_backward }
245
+ bind_key(Ncurses::KEY_RIGHT){ cursor_forward }
246
+ bind_key(Ncurses::KEY_UP){ up }
247
+ bind_key(Ncurses::KEY_DOWN){ down }
248
248
  bind_key(?\C-a){ cursor_bol }
249
249
  bind_key(?\C-e){ cursor_eol }
250
250
  bind_key(?\C-n) { scroll_forward }
@@ -297,11 +297,11 @@ module RubyCurses
297
297
  #cursor_backward
298
298
  #when KEY_RIGHT
299
299
  #cursor_forward
300
- when KEY_BACKSPACE, KEY_BSPACE
300
+ when Ncurses.KEY_BACKSPACE, Ncurses.KEY_BSPACE
301
301
  if @editable # checking here means that i can programmatically bypass!!
302
302
  delete_prev_char
303
303
  end
304
- when KEY_DELETE, ?\C-d.getbyte(0) # delete char
304
+ when Ncurses.KEY_DELETE, ?\C-d.getbyte(0) # delete char
305
305
  if @editable
306
306
  delete_curr_char
307
307
  end
@@ -16,12 +16,12 @@ TODO
16
16
 
17
17
  =end
18
18
  require 'rubygems'
19
- require 'ncurses'
19
+ #require 'ncurses'
20
20
  require 'logger'
21
21
  require 'rbcurse'
22
22
  require 'rbcurse/listscrollable'
23
23
 
24
- include Ncurses
24
+ #include Ncurses # FFI 2011-09-8
25
25
  include RubyCurses
26
26
  module RubyCurses
27
27
  extend self
@@ -497,6 +497,7 @@ module RubyCurses
497
497
  def sanitize content #:nodoc:
498
498
  if content.is_a? String
499
499
  content.chomp!
500
+ # trying out since gsub giving #<ArgumentError: invalid byte sequence in UTF-8> 2011-09-11
500
501
  content = content.encode("ASCII-8BIT", :invalid => :replace, :undef => :replace, :replace => "?")
501
502
  content.gsub!(/\t/, ' ') # don't display tab
502
503
  content.gsub!(/[^[:print:]]/, '') # don't display non print characters
data/lib/rbcurse/rtree.rb CHANGED
@@ -19,7 +19,7 @@ require 'rbcurse/tree/treecellrenderer'
19
19
 
20
20
  TreeSelectionEvent = Struct.new(:node, :tree, :state, :previous_node, :row_first)
21
21
 
22
- include Ncurses
22
+ #include Ncurses # FFI 2011-09-8
23
23
  module RubyCurses
24
24
  extend self
25
25
  # a representation of heirarchical data in outline form
@@ -430,7 +430,7 @@ module RubyCurses
430
430
 
431
431
  $log.debug "rtree repaint #{@name} graphic #{@graphic}"
432
432
  print_borders unless @suppress_borders # do this once only, unless everything changes
433
- maxlen = @maxlen ||= @width-@internal_width
433
+ maxlen = @maxlen || @width-@internal_width
434
434
  tm = _list()
435
435
  select_default_values
436
436
  rc = row_count
@@ -17,12 +17,12 @@ Major change 2010-02-11 23:32
17
17
 
18
18
  =end
19
19
  #require 'rubygems'
20
- require 'ncurses'
20
+ #require 'ncurses'
21
21
  require 'logger'
22
22
  require 'rbcurse'
23
23
  require 'rbcurse/rchangeevent'
24
24
 
25
- include Ncurses
25
+ #include Ncurses # FFI 2011-09-8
26
26
  include RubyCurses
27
27
  module RubyCurses
28
28
  extend self
@@ -95,7 +95,7 @@ module RubyCurses
95
95
  bind_key([?\C-w,?6], :increase_current_component)
96
96
  bind_key([?\C-w,?5], :decrease_current_component)
97
97
  # this needs to be set at application level
98
- bind_key(KEY_F3) {RubyCurses::FocusManager.toggle_focusable}
98
+ bind_key(FFI::NCurses::KEY_F3) {RubyCurses::FocusManager.toggle_focusable}
99
99
  end
100
100
  def init_vars
101
101
  @repaint_required = true
@@ -498,7 +498,7 @@ module RubyCurses
498
498
  return ret
499
499
  end
500
500
  end
501
- $log.debug "XXX VIM unahdled by comp #{comp.name} "
501
+ $log.debug "XXX VIM key unhandled by comp #{comp.name} "
502
502
  case ch
503
503
  when ?\C-c.getbyte(0)
504
504
  $multiplier = 0
@@ -731,6 +731,7 @@ module RubyCurses
731
731
  if v?
732
732
  case ev.type
733
733
  when KEY_RIGHT
734
+ $log.debug "VIMSPLIT RIGHT "
734
735
  if @rc < @width - 3
735
736
  @recalculate_splits = true
736
737
  @rc += 1
@@ -21,7 +21,7 @@ TODO
21
21
 
22
22
  =end
23
23
  require 'rubygems'
24
- require 'ncurses'
24
+ ##require 'ncurses'
25
25
  require 'logger'
26
26
  #require 'rbcurse/mapper'
27
27
  require 'rbcurse/colormap'
@@ -31,11 +31,20 @@ require 'rbcurse/io'
31
31
 
32
32
  # some of these will get overriden by ncurses when we include
33
33
  KEY_TAB = 9
34
- #KEY_BTAB = 353 # nc gives same
34
+ KEY_F1 = FFI::NCurses::KEY_F1
35
+ KEY_ENTER = 10 # FFI::NCurses::KEY_ENTER gives 343
36
+ KEY_BTAB = 353 # nc gives same
35
37
  KEY_RETURN = 13 # Nc gives 343 for KEY_ENTER
36
38
  KEY_DELETE = 330
37
- KEY_BSPACE = 127 # Nc gives 263 for BACKSPACE
39
+ KEY_BACKSPACE = KEY_BSPACE = 127 # Nc gives 263 for BACKSPACE
38
40
  KEY_CC = 3 # C-c
41
+ KEY_LEFT = FFI::NCurses::KEY_LEFT
42
+ KEY_RIGHT = FFI::NCurses::KEY_RIGHT
43
+ KEY_UP = FFI::NCurses::KEY_UP
44
+ KEY_DOWN = FFI::NCurses::KEY_DOWN
45
+ C_LEFT = 18168
46
+ C_RIGHT = 18167
47
+ S_F9 = 17949126
39
48
 
40
49
  class Object
41
50
  # thanks to terminal-table for this method
@@ -111,7 +120,7 @@ class Fixnum
111
120
  end
112
121
  end unless "a"[0] == "a"
113
122
 
114
- include Ncurses
123
+ #include Ncurses XXX 2011-09-8 testing FFI
115
124
  module RubyCurses
116
125
  extend self
117
126
  include ColorMap
@@ -169,7 +178,7 @@ module RubyCurses
169
178
  return "left"
170
179
  when 261
171
180
  return "right"
172
- when KEY_F1..KEY_F12
181
+ when FFI::NCurses::KEY_F1..FFI::NCurses::KEY_F12
173
182
  return "F"+ (keycode-264).to_s
174
183
  when 330
175
184
  return "delete"
@@ -185,6 +194,12 @@ module RubyCurses
185
194
  return "C-space" # i hope this is correct, just guessing
186
195
  when 160
187
196
  return "M-space" # at least on OSX Leopard now (don't remember this working on PPC)
197
+ when C_LEFT
198
+ return "C-left"
199
+ when C_RIGHT
200
+ return "C-right"
201
+ when S_F9
202
+ return "S_F9"
188
203
  else
189
204
  others=[?\M--,?\M-+,?\M-=,?\M-',?\M-",?\M-;,?\M-:,?\M-\,, ?\M-.,?\M-<,?\M->,?\M-?,?\M-/]
190
205
  others.collect! {|x| x.getbyte(0) } ## added 2009-10-04 14:25 for 1.9
@@ -243,6 +258,7 @@ module RubyCurses
243
258
  when String
244
259
  keycode = keycode.getbyte(0) #if keycode.class==String ## 1.9 2009-10-05 19:40
245
260
  #$log.debug " #{name} Widg String called bind_key BIND #{keycode}, #{keycode_tos(keycode)} "
261
+ $log.debug "XXX XX assigning #{keycode} " if $log.debug?
246
262
  @key_handler[keycode] = blk
247
263
  when Array
248
264
  # for starters lets try with 2 keys only
@@ -252,6 +268,7 @@ module RubyCurses
252
268
  a1 = keycode[1]
253
269
  a1 = keycode[1].getbyte(0) if keycode[1].class == String
254
270
  @key_handler[a0] ||= OrderedHash.new
271
+ $log.debug "XXX XX assigning #{keycode} , A0 #{a0} , A1 #{a1} " if $log.debug?
255
272
  @key_handler[a0][a1] = blk
256
273
  #$log.debug "XXX XX assigning #{keycode} to key_handler " if $log.debug?
257
274
  else
@@ -284,16 +301,21 @@ module RubyCurses
284
301
  $log.debug " process_key: got #{keycode} , #{ch} "
285
302
  yn = ch.chr
286
303
  blk1 = blk[ch]
287
- return nil if blk1.nil?
304
+ window.ungetch(ch) if blk1.nil? # trying 2011-09-27
305
+ return :UNHANDLED if blk1.nil? # changed nil to unhandled 2011-09-27
288
306
  $log.debug " process_key: found block for #{keycode} , #{ch} "
289
307
  blk = blk1
290
308
  end
291
309
  #$log.debug "called process_key #{object}, kc: #{keycode}, args #{@key_args[keycode]}"
292
310
  if blk.is_a? Symbol
293
311
  $log.debug "SYMBOL " if $log.debug?
294
- return send(blk, *@key_args[keycode])
312
+ if respond_to? blk
313
+ return send(blk, *@key_args[keycode])
314
+ else
315
+ alert "This does not respond to #{blk.to_s} "
316
+ end
295
317
  else
296
- $log.debug "BLOCJ " if $log.debug?
318
+ $log.debug "rwidget BLOCK called _process_key " if $log.debug?
297
319
  return blk.call object, *@key_args[keycode]
298
320
  end
299
321
  #0
@@ -337,7 +359,7 @@ module RubyCurses
337
359
  # TODO: if an object throws a subclass of VetoException we should not catch it and throw it back for
338
360
  # caller to catch and take care of, such as prevent LEAVE or update etc.
339
361
  def fire_handler event, object
340
- $log.debug "inside def fire_handler evt:#{event}, o: #{object.class}, hdnler:#{@handler}"
362
+ $log.debug "inside def fire_handler evt:#{event}, o: #{object.class}"
341
363
  if !@handler.nil?
342
364
  if @_events
343
365
  raise ArgumentError, "#{self.class} does not support this event: #{event}. #{@_events} " if !@_events.include? event
@@ -349,15 +371,21 @@ module RubyCurses
349
371
  aeve = @event_args[event]
350
372
  ablk.each_with_index do |blk, ix|
351
373
  #$log.debug "#{self} called EventHandler firehander #{@name}, #{event}, obj: #{object},args: #{aeve[ix]}"
352
- $log.debug "#{self} called EventHandler firehander #{@name}, #{event}"
374
+ #$log.debug "#{self} called EventHandler firehander #{@name}, #{event}"
353
375
  begin
354
376
  blk.call object, *aeve[ix]
377
+ rescue FieldValidationException => fve
378
+ # added 2011-09-26 1.3.0 so a user raised exception on LEAVE
379
+ # keeps cursor in same field.
380
+ raise fve
355
381
  rescue => ex
356
- $log.error "======= Error ERROR in block event #{self}: #{name}, #{event}"
382
+ ## some don't have name
383
+ #$log.error "======= Error ERROR in block event #{self}: #{name}, #{event}"
384
+ $log.error "======= Error ERROR in block event #{self}: #{event}"
357
385
  $log.error ex
358
386
  $log.error(ex.backtrace.join("\n"))
359
387
  #$error_message = "#{ex}" # changed 2010
360
- $error_message.value = "#{ex}"
388
+ $error_message.value = "#{ex.to_s}"
361
389
  Ncurses.beep
362
390
  end
363
391
  end
@@ -566,6 +594,7 @@ module RubyCurses
566
594
  end
567
595
  ##
568
596
  # default repaint method. Called by form for all widgets.
597
+ # XXX widget does not have display_length.
569
598
  def repaint
570
599
  r,c = rowcol
571
600
  $log.debug("widget repaint : r:#{r} c:#{c} col:#{@color}" )
@@ -586,7 +615,7 @@ module RubyCurses
586
615
  def destroy
587
616
  $log.debug "DESTROY : widget #{@name} "
588
617
  panel = @window.panel
589
- Ncurses::Panel.del_panel(panel) if !panel.nil?
618
+ Ncurses::Panel.del_panel(panel.pointer) if !panel.nil?
590
619
  @window.delwin if !@window.nil?
591
620
  end
592
621
  # @deprecated pls call windows method
@@ -1221,6 +1250,9 @@ module RubyCurses
1221
1250
  $log.debug " formrepaint #{@name} calling window.wrefresh #{@window} "
1222
1251
  @window.wrefresh
1223
1252
  Ncurses::Panel.update_panels ## added 2010-11-05 00:30 to see if clears the stdscr problems
1253
+ else
1254
+ $log.warn " XXX formrepaint #{@name} no refresh called 2011-09-19 #{@window} "
1255
+ #@window.wrefresh # trying FFI 2011-09-19
1224
1256
  end
1225
1257
  end
1226
1258
  ##
@@ -1330,7 +1362,7 @@ module RubyCurses
1330
1362
  @active_index = ix0
1331
1363
  @row, @col = f.rowcol
1332
1364
  #$log.debug " WMOVE insdie sele nxt field : ROW #{@row} COL #{@col} "
1333
- @window.wmove @row, @col
1365
+ @window.wmove @row, @col # added RK FFI 2011-09-7
1334
1366
  on_enter f
1335
1367
  f.curpos = 0
1336
1368
  repaint
@@ -1603,7 +1635,8 @@ module RubyCurses
1603
1635
  case ch
1604
1636
  when -1
1605
1637
  return
1606
- when Ncurses::KEY_RESIZE # SIGWINCH
1638
+ #when Ncurses::KEY_RESIZE # SIGWINCH
1639
+ when FFI::NCurses::KEY_RESIZE # SIGWINCH # FFI
1607
1640
  lines = Ncurses.LINES
1608
1641
  cols = Ncurses.COLS
1609
1642
  x = Ncurses.stdscr.getmaxy
@@ -1625,12 +1658,12 @@ module RubyCurses
1625
1658
  ret = select_next_field
1626
1659
  return ret if ret == :NO_NEXT_FIELD
1627
1660
  # alt-shift-tab or backtab (in case Table eats backtab)
1628
- when KEY_BTAB, 481 ## backtab added 2008-12-14 18:41
1661
+ when FFI::NCurses::KEY_BTAB, 481 ## backtab added 2008-12-14 18:41
1629
1662
  ret = select_prev_field
1630
1663
  return ret if ret == :NO_PREV_FIELD
1631
- when KEY_UP
1664
+ when FFI::NCurses::KEY_UP
1632
1665
  select_prev_field
1633
- when KEY_DOWN
1666
+ when FFI::NCurses::KEY_DOWN
1634
1667
  select_next_field
1635
1668
  #when ?\M-L.getbyte(0)
1636
1669
  ### trying out these for fuun and testing splitpane 2010-01-10 20:32
@@ -1649,7 +1682,7 @@ module RubyCurses
1649
1682
  else
1650
1683
  #$log.debug "XXX before calling process_key in form #{ch} " if $log.debug?
1651
1684
  ret = process_key ch, self
1652
- $log.debug " process_key #{ch} got ret #{ret} in #{self} "
1685
+ $log.debug "FORM process_key #{ch} got ret #{ret} in #{self} "
1653
1686
  return :UNHANDLED if ret == :UNHANDLED
1654
1687
  end
1655
1688
  end
@@ -1991,9 +2024,9 @@ module RubyCurses
1991
2024
  end
1992
2025
  def map_keys
1993
2026
  return if @keys_mapped
1994
- bind_key(KEY_LEFT){ cursor_backward }
1995
- bind_key(KEY_RIGHT){ cursor_forward }
1996
- bind_key(KEY_BACKSPACE){ delete_prev_char }
2027
+ bind_key(FFI::NCurses::KEY_LEFT){ cursor_backward }
2028
+ bind_key(FFI::NCurses::KEY_RIGHT){ cursor_forward }
2029
+ bind_key(FFI::NCurses::KEY_BACKSPACE){ delete_prev_char }
1997
2030
  bind_key(127){ delete_prev_char }
1998
2031
  bind_key(330){ delete_curr_char }
1999
2032
  bind_key(?\C-a){ cursor_home }
@@ -2166,6 +2199,7 @@ module RubyCurses
2166
2199
  if modified?
2167
2200
  set_modified true
2168
2201
  end
2202
+ # if super fails we would have still set modified to true
2169
2203
  super
2170
2204
  #return valid
2171
2205
  end
@@ -2497,6 +2531,7 @@ module RubyCurses
2497
2531
  def repaint # button
2498
2532
  #$log.debug("BUTTon repaint : #{self} r:#{@row} c:#{@col} #{getvalue_for_paint}" )
2499
2533
  r,c = @row, @col #rowcol include offset for putting cursor
2534
+ # NOTE: please override both (if using a string), or else it won't work
2500
2535
  @highlight_foreground ||= $reversecolor
2501
2536
  @highlight_background ||= 0
2502
2537
  bgcolor = @state==:HIGHLIGHTED ? @highlight_background : @bgcolor
@@ -2544,13 +2579,13 @@ module RubyCurses
2544
2579
  # Button
2545
2580
  def handle_key ch
2546
2581
  case ch
2547
- when KEY_LEFT, KEY_UP
2582
+ when FFI::NCurses::KEY_LEFT, FFI::NCurses::KEY_UP
2548
2583
  return :UNHANDLED
2549
2584
  # @form.select_prev_field
2550
- when KEY_RIGHT, KEY_DOWN
2585
+ when FFI::NCurses::KEY_RIGHT, FFI::NCurses::KEY_DOWN
2551
2586
  return :UNHANDLED
2552
2587
  # @form.select_next_field
2553
- when KEY_ENTER, 10, 13, 32 # added space bar also
2588
+ when FFI::NCurses::KEY_ENTER, 10, 13, 32 # added space bar also
2554
2589
  if respond_to? :fire
2555
2590
  fire
2556
2591
  end
@@ -2764,7 +2799,9 @@ module RubyCurses
2764
2799
 
2765
2800
  def self.startup
2766
2801
  VER::start_ncurses
2767
- $log = Logger.new("view.log")
2802
+ path = File.join(ENV["LOGDIR"] || "./" ,"rbc13.log")
2803
+ file = File.open(path, File::WRONLY|File::TRUNC|File::CREAT)
2804
+ $log = Logger.new(path)
2768
2805
  $log.level = Logger::DEBUG
2769
2806
  end
2770
2807