canis 0.0.8 → 0.0.10

Sign up to get free protection for your applications and to get access to all the features.
Files changed (57) hide show
  1. checksums.yaml +4 -4
  2. data/.gitignore +0 -9
  3. data/CHANGES +3 -0
  4. data/README.md +5 -3
  5. data/examples/alpmenu.rb +9 -5
  6. data/examples/app.sample +2 -2
  7. data/examples/appemail.rb +15 -15
  8. data/examples/atree.rb +7 -7
  9. data/examples/bline.rb +19 -19
  10. data/examples/common/devel.rb +3 -3
  11. data/examples/dbdemo.rb +53 -49
  12. data/examples/dirtree.rb +22 -19
  13. data/examples/newtabbedwindow.rb +5 -5
  14. data/examples/newtesttabp.rb +3 -3
  15. data/examples/tabular.rb +11 -11
  16. data/examples/tasks.rb +25 -25
  17. data/examples/term2.rb +8 -8
  18. data/examples/testbuttons.rb +24 -24
  19. data/examples/testcombo.rb +5 -5
  20. data/examples/testdb.rb +6 -6
  21. data/examples/testfields.rb +16 -16
  22. data/examples/testflowlayout.rb +3 -3
  23. data/examples/testkeypress.rb +5 -5
  24. data/examples/testlistbox.rb +18 -18
  25. data/examples/testlistbox1.rb +17 -17
  26. data/examples/testmessagebox.rb +5 -5
  27. data/examples/testprogress.rb +6 -6
  28. data/examples/testree.rb +3 -3
  29. data/examples/testsplitlayout.rb +4 -4
  30. data/examples/testsplitlayout1.rb +4 -4
  31. data/examples/teststacklayout.rb +4 -4
  32. data/examples/testwsshortcuts.rb +1 -1
  33. data/examples/testwsshortcuts2.rb +4 -4
  34. data/lib/canis/core/include/colorparser.rb +4 -4
  35. data/lib/canis/core/include/io.rb +3 -3
  36. data/lib/canis/core/include/layouts/abstractlayout.rb +3 -3
  37. data/lib/canis/core/include/layouts/flowlayout.rb +2 -2
  38. data/lib/canis/core/include/layouts/stacklayout.rb +3 -3
  39. data/lib/canis/core/system/colormap.rb +3 -3
  40. data/lib/canis/core/system/window.rb +7 -4
  41. data/lib/canis/core/util/extras/padreader.rb +2 -2
  42. data/lib/canis/core/util/rcommandwindow.rb +8 -4
  43. data/lib/canis/core/util/rdialogs.rb +1 -1
  44. data/lib/canis/core/util/widgetshortcuts.rb +9 -2
  45. data/lib/canis/core/widgets/applicationheader.rb +6 -2
  46. data/lib/canis/core/widgets/divider.rb +6 -2
  47. data/lib/canis/core/widgets/rmenu.rb +8 -4
  48. data/lib/canis/core/widgets/rmessagebox.rb +2 -2
  49. data/lib/canis/core/widgets/rwidget.rb +15 -15
  50. data/lib/canis/core/widgets/scrollbar.rb +5 -2
  51. data/lib/canis/core/widgets/table.rb +2 -2
  52. data/lib/canis/core/widgets/textpad.rb +8 -8
  53. data/lib/canis/core/widgets/tree.rb +57 -39
  54. data/lib/canis/core/widgets/tree/treecellrenderer.rb +3 -3
  55. data/lib/canis/version.rb +1 -1
  56. metadata +12 -13
  57. data/lib/canis/core/include/.DS_Store +0 -0
@@ -13,20 +13,20 @@ require 'canis'
13
13
  require 'canis/core/include/appmethods.rb'
14
14
  def help_text
15
15
  <<-eos
16
- BUTTONS HELP
16
+ BUTTONS HELP
17
17
 
18
18
  This is some help text for testbuttons.
19
19
  To select any button press the SPACEBAR, although ENTER will also work.
20
20
  You may also press the mnemonic or hotkey on the label..
21
21
 
22
- The toggle button toggles the kind of dialog for the Cancel button. Modern look
22
+ The toggle button toggles the kind of dialog for the Cancel button. Modern look
23
23
  and feel refers to a popup with buttons. This is like the links editor.
24
24
 
25
25
  Classic look and feel refers to a line at the bottom of the screen, with a y/n prompt.
26
26
  THis is like a lot of older apps, i think Pine and maybe vim.
27
27
 
28
28
 
29
- Alt-c/F10 - Exit application
29
+ Alt-c/F10 - Exit application
30
30
 
31
31
 
32
32
 
@@ -42,7 +42,7 @@ if $0 == __FILE__
42
42
  # Initialize curses
43
43
  Canis::start_ncurses # this is initializing colors via ColorMap.setup
44
44
  path = File.join(ENV["LOGDIR"] || "./" ,"canis14.log")
45
- file = File.open(path, File::WRONLY|File::TRUNC|File::CREAT)
45
+ file = File.open(path, File::WRONLY|File::TRUNC|File::CREAT)
46
46
  $log = Logger.new(path)
47
47
  $log.level = Logger::DEBUG
48
48
 
@@ -50,8 +50,8 @@ if $0 == __FILE__
50
50
  @lookfeel = :dialog # or :classic
51
51
 
52
52
  @window = Canis::Window.root_window
53
- # Initialize few color pairs
54
- # Create the window to be associated with the form
53
+ # Initialize few color pairs
54
+ # Create the window to be associated with the form
55
55
  # Un post form and free the memory
56
56
 
57
57
  catch(:close) do
@@ -67,7 +67,7 @@ if $0 == __FILE__
67
67
 
68
68
  _mess = "Message Comes Here"
69
69
  message_label = Canis::Label.new @form, {text: _mess,
70
- :name=>"message_label",:row => Ncurses.LINES-1, :col => 1, :width => 60,
70
+ :name=>"message_label",:row => Ncurses.LINES-1, :col => 1, :width => 60,
71
71
  :height => 2, :color => :cyan}
72
72
 
73
73
  $results = Variable.new
@@ -108,7 +108,7 @@ if $0 == __FILE__
108
108
  mnemonic('T')
109
109
  #underline 0
110
110
  togglebutton.command do
111
- if togglebutton.value
111
+ if togglebutton.value
112
112
  message_label.text "Modern look and feel for dialogs"
113
113
  else
114
114
  message_label.text "Classic look and feel for dialogs"
@@ -119,20 +119,20 @@ if $0 == __FILE__
119
119
  @form.bind(:LEAVE) { |f| f.label && f.label.bgcolor = 'black' if f.respond_to? :label}
120
120
 
121
121
  row += 1
122
- colorlabel = Label.new @form, {'text' => "Select a color:", "row" => row, "col" => col,
122
+ colorlabel = Label.new @form, {'text' => "Select a color:", "row" => row, "col" => col,
123
123
  "color"=>"cyan", "mnemonic" => 'S'}
124
124
  #$radio = Variable.new
125
125
  #$radio.update_command(colorlabel) {|tv, label| label.color tv.value; }
126
126
  #
127
- #$radio.update_command() {|tv| @form.widgets.each { |e| next unless e.is_a? Widget;
127
+ #$radio.update_command() {|tv| @form.widgets.each { |e| next unless e.is_a? Widget;
128
128
  #e.bgcolor tv.value }; }
129
129
 
130
130
  # whenever updated set colorlabel and messagelabel to bold
131
- $results.update_command(colorlabel,checkbutton) {|tv, label, cb|
131
+ $results.update_command(colorlabel,checkbutton) {|tv, label, cb|
132
132
  attrs = cb.value ? 'bold' : 'normal'; label.attr(attrs); message_label.attr(attrs)}
133
133
 
134
134
 
135
- checkbutton1.command do
135
+ checkbutton1.command do
136
136
  attrs = checkbutton1.value ? 'reverse' : 'normal'; colorlabel.attr(attrs); message_label.attr(attrs)
137
137
  end
138
138
  row += 1
@@ -178,17 +178,17 @@ if $0 == __FILE__
178
178
  end
179
179
  #$radio.update_command(colorlabel) {|tv, label| label.color tv.value; }
180
180
  #
181
- #$radio.update_command() {|tv| @form.widgets.each { |e| next unless e.is_a? Widget;
181
+ #$radio.update_command() {|tv| @form.widgets.each { |e| next unless e.is_a? Widget;
182
182
  #e.bgcolor tv.value }; }
183
183
  colorlabel.label_for radio1
184
184
 
185
185
  group = ButtonGroup.new
186
- [radio1, radio2, radio11, radio22].each { |r|
186
+ [radio1, radio2, radio11, radio22].each { |r|
187
187
  group.add r
188
188
  }
189
189
  group.command(colorlabel) {|tv, label| label.color tv.value; }
190
190
  #
191
- group.command() {|tv| @form.widgets.each { |e| next unless e.is_a? Widget;
191
+ group.command() {|tv| @form.widgets.each { |e| next unless e.is_a? Widget;
192
192
  e.bgcolor tv.value }; }
193
193
 
194
194
  # instead of using frozen, I will use a PropertyVeto
@@ -202,7 +202,7 @@ if $0 == __FILE__
202
202
  raise PropertyVetoException.new("Cannot change this!", e)
203
203
  end
204
204
  }
205
- [radio1, radio2, radio11, radio22].each { |r|
205
+ [radio1, radio2, radio11, radio22].each { |r|
206
206
  r.bind(:PROPERTY_CHANGE) do |e| veto.call(e, r.text) end
207
207
  }
208
208
 
@@ -223,7 +223,7 @@ if $0 == __FILE__
223
223
  #highlight_foreground "blue"
224
224
  mnemonic 'O'
225
225
  end
226
- ok_button.command() { |eve|
226
+ ok_button.command() { |eve|
227
227
  alert("Hope you enjoyed this demo - Press the Cancel button to quit", {'title' => "Hello", :bgcolor => :blue , :color => :white})
228
228
  }
229
229
 
@@ -238,15 +238,15 @@ if $0 == __FILE__
238
238
  #highlight_background "white"
239
239
  #highlight_foreground "blue"
240
240
  #surround_chars ['{ ',' }'] ## change the surround chars
241
- cancel_button.command { |aeve|
241
+ cancel_button.command { |aeve|
242
242
  #if @lookfeel == :dialog
243
243
  if togglebutton.value == true
244
- ret = confirm("Do your really want to quit?")
244
+ ret = confirm("Do your really want to quit?")
245
245
  else
246
- ret = rb_confirm("Do your really want to quit?")
246
+ ret = rb_confirm("Do your really want to quit?")
247
247
  end
248
- if ret
249
- throw(:close);
248
+ if ret
249
+ throw(:close);
250
250
  else
251
251
  message_label.text = "Quit aborted"
252
252
  end
@@ -263,9 +263,9 @@ if $0 == __FILE__
263
263
  begin
264
264
  @form.handle_key(ch)
265
265
 
266
- rescue FieldValidationException => fve
266
+ rescue FieldValidationException => fve
267
267
  alert fve.to_s
268
-
268
+
269
269
  f = @form.get_current_field
270
270
  # lets restore the value
271
271
  if f.respond_to? :restore_original_value
@@ -4,7 +4,7 @@ require 'canis/core/widgets/rcombo'
4
4
  require 'canis/core/include/appmethods.rb'
5
5
  def help_text
6
6
  <<-eos
7
- # COMBO HELP
7
+ # COMBO HELP
8
8
 
9
9
  This is some help text for |Combos|
10
10
 
@@ -30,13 +30,13 @@ if $0 == __FILE__
30
30
  # Initialize curses
31
31
  Canis::start_ncurses # this is initializing colors via ColorMap.setup
32
32
  path = File.join(ENV["LOGDIR"] || "./" ,"canis14.log")
33
- file = File.open(path, File::WRONLY|File::TRUNC|File::CREAT)
33
+ file = File.open(path, File::WRONLY|File::TRUNC|File::CREAT)
34
34
  $log = Logger.new(path)
35
35
  $log.level = Logger::DEBUG
36
36
 
37
37
  @window = Canis::Window.root_window
38
- # Initialize few color pairs
39
- # Create the window to be associated with the form
38
+ # Initialize few color pairs
39
+ # Create the window to be associated with the form
40
40
  # Un post form and free the memory
41
41
 
42
42
  catch(:close) do
@@ -49,7 +49,7 @@ if $0 == __FILE__
49
49
 
50
50
 
51
51
 
52
- cb = ComboBox.new @form, :row => 7, :col => 2, :width => 20,
52
+ cb = ComboBox.new @form, :row => 7, :col => 2, :width => 20,
53
53
  :list => %w[xterm xterm-color xterm-256color screen vt100 vt102],
54
54
  :arrow_key_policy => :popup,
55
55
  :label => "Declare terminal as: "
@@ -48,9 +48,9 @@ def _edit h, row, title
48
48
  bw = get_color $datacolor, :black, :white
49
49
  mb = MessageBox.new config do
50
50
  txt = nil
51
- h.each_with_index { |f, i|
51
+ h.each_with_index { |f, i|
52
52
  txt = row[i] || ""
53
- add LabeledField.new :label => "%*s:" % [_w, f], :text => txt.chomp, :name => i.to_s,
53
+ add LabeledField.new :label => "%*s:" % [_w, f], :text => txt.chomp, :name => i.to_s,
54
54
  :bgcolor => :cyan,
55
55
  :width => 50,
56
56
  :label_color_pair => bw
@@ -59,7 +59,7 @@ def _edit h, row, title
59
59
  end
60
60
  index = mb.run
61
61
  return nil if index != 0
62
- h.each_with_index { |e, i|
62
+ h.each_with_index { |e, i|
63
63
  f = mb.widget(i.to_s)
64
64
  row[i] = f.text
65
65
  }
@@ -69,7 +69,7 @@ begin
69
69
  # Initialize curses
70
70
  Canis::start_ncurses # this is initializing colors via ColorMap.setup
71
71
  path = File.join(ENV["LOGDIR"] || "./" ,"canis14.log")
72
- logfilename = File.open(path, File::WRONLY|File::TRUNC|File::CREAT)
72
+ logfilename = File.open(path, File::WRONLY|File::TRUNC|File::CREAT)
73
73
  $log = Logger.new(logfilename)
74
74
  $log.level = Logger::DEBUG
75
75
 
@@ -84,7 +84,7 @@ begin
84
84
  @window = Canis::Window.root_window
85
85
  @form = Form.new @window
86
86
 
87
- #header = app_header "0.0.1", :text_center => "Movie Database", :text_right =>"" , :name => "header" , :color => :white, :bgcolor => lineback , :attr => :bold
87
+ #header = app_header "0.0.1", :text_center => "Movie Database", :text_right =>"" , :name => "header" , :color => :white, :bgcolor => lineback , :attr => :bold
88
88
 
89
89
 
90
90
 
@@ -146,7 +146,7 @@ begin
146
146
  tv.bind_key(?i) { insert_row(tv) }
147
147
  tv.bind_key(?D) { tv.delete_at tv.current_index }
148
148
  @form.bind_key(?\M-c, "Filter") {
149
- tv = @form.by_name["tv"];
149
+ tv = @form.by_name["tv"];
150
150
  str = get_string "Enter name of director:"
151
151
  if str && str.length > 0
152
152
  m = tv.matching_indices do |ix, fields|
@@ -3,7 +3,7 @@ require 'canis'
3
3
  require 'canis/core/include/appmethods.rb'
4
4
  def help_text
5
5
  <<-eos
6
- # FIELD HELP
6
+ # FIELD HELP
7
7
 
8
8
  This is some help text for |Fields|
9
9
 
@@ -16,8 +16,8 @@ Use Alt (meta) with the highlighted character to jump to that field.
16
16
  <Alt-m> goes to line, <Alt-p> to password.
17
17
 
18
18
  Notice how the field label (for first 3 fields) becomes red when focused (as in Pine/Alpine). This uses
19
- the event `:ENTER` and `:LEAVE` and +set_label+. The other fields use `LabeledField+. In the first 3, the
20
- labels row and col have not been specified, so are calculated. In the last 3, label's lcol and lrow are
19
+ the event `:ENTER` and `:LEAVE` and +set_label+. The other fields use `LabeledField+. In the first 3, the
20
+ labels row and col have not been specified, so are calculated. In the last 3, label's lcol and lrow are
21
21
  specified for custom placement.
22
22
 
23
23
 
@@ -49,15 +49,15 @@ if $0 == __FILE__
49
49
  # Initialize curses
50
50
  Canis::start_ncurses # this is initializing colors via ColorMap.setup
51
51
  path = File.join(ENV["LOGDIR"] || "./" ,"canis14.log")
52
- file = File.open(path, File::WRONLY|File::TRUNC|File::CREAT)
52
+ file = File.open(path, File::WRONLY|File::TRUNC|File::CREAT)
53
53
  $log = Logger.new(path)
54
54
  $log.level = Logger::DEBUG
55
55
 
56
56
  @lookfeel = :classic # :dialog # or :classic
57
57
 
58
58
  @window = Canis::Window.root_window
59
- # Initialize few color pairs
60
- # Create the window to be associated with the form
59
+ # Initialize few color pairs
60
+ # Create the window to be associated with the form
61
61
  # Un post form and free the memory
62
62
 
63
63
  catch(:close) do
@@ -70,11 +70,11 @@ if $0 == __FILE__
70
70
  mnemonics = %w[ n l r p]
71
71
  %w[ name line regex password].each_with_index do |w,i|
72
72
  field = Field.new @form do
73
- name w
74
- row r
75
- col fc
73
+ name w
74
+ row r
75
+ col fc
76
76
  width 30
77
- #text "abcd "
77
+ #text "abcd "
78
78
  set_label Label.new @form, {:text => w, :color=> :cyan, :mnemonic => mnemonics[i]}
79
79
  end
80
80
  r += 1
@@ -87,7 +87,7 @@ if $0 == __FILE__
87
87
 
88
88
  @form.by_name["name"].text( "Not focusable").
89
89
  focusable(false)
90
-
90
+
91
91
  @form.by_name["regex"].valid_regex(/^[A-Z][a-z]*/).
92
92
  text( "SYNOP").
93
93
  width(10).
@@ -102,10 +102,10 @@ if $0 == __FILE__
102
102
  r += 3
103
103
  l1 = Label.new @form, :name => "LabeledField", :attr => 'bold', :text => "Profile", :row => r, :col => fc
104
104
  r += 1
105
- f1 = LabeledField.new @form, :name => "name1", :maxlen => 20, :width => 20, :bgcolor => :white,
105
+ f1 = LabeledField.new @form, :name => "name1", :maxlen => 20, :width => 20, :bgcolor => :white,
106
106
  :color => :black, :text => "abc", :label => ' Name: ', :row => r, :col => fc
107
107
  r += 1
108
- f2 = LabeledField.new @form, :name => "email", :width => 20, :bgcolor => :white,
108
+ f2 = LabeledField.new @form, :name => "email", :width => 20, :bgcolor => :white,
109
109
  :color => :blue, :text => "me@google.com", :label => ' Email: ', :row => r, :col => fc
110
110
  r += 3
111
111
  f3 = LabeledField.new @form
@@ -129,7 +129,7 @@ if $0 == __FILE__
129
129
  bgcolor(:white).color(:black).
130
130
  row(r+i).col(fc).lcol(01)
131
131
  end
132
- @form.bind_key(FFI::NCurses::KEY_F3,'view log') {
132
+ @form.bind_key(FFI::NCurses::KEY_F3,'view log') {
133
133
  require 'canis/core/util/viewer'
134
134
  Canis::Viewer.view(path || "canis14.log", :close_key => KEY_ENTER, :title => "<Enter> to close")
135
135
  }
@@ -162,10 +162,10 @@ if $0 == __FILE__
162
162
  begin
163
163
  @form.handle_key(ch)
164
164
 
165
- rescue FieldValidationException => fve
165
+ rescue FieldValidationException => fve
166
166
  #alert fve.to_s
167
167
  textdialog fve
168
-
168
+
169
169
  f = @form.get_current_field
170
170
  # lets restore the value
171
171
  if f.respond_to? :restore_original_value
@@ -1,6 +1,6 @@
1
1
  # ----------------------------------------------------------------------------- #
2
2
  # File: testflowlayout.rb
3
- # Description:
3
+ # Description:
4
4
  # Author: j kepler http://github.com/mare-imbrium/canis/
5
5
  # Date: 2014-05-09 - 20:24
6
6
  # License: MIT
@@ -21,7 +21,7 @@ if __FILE__ == $PROGRAM_NAME
21
21
  lb2 = Listbox.new @form, :list => `gem list --local`.split("\n") , :name => "mylist2"
22
22
  =begin
23
23
 
24
- alist = %w[ ruby perl python java jruby macruby rubinius rails rack sinatra pylons django cakephp grails]
24
+ alist = %w[ ruby perl python java jruby macruby rubinius rails rack sinatra pylons django cakephp grails]
25
25
  str = "Hello, people of Earth.\nI am HAL, a textbox.\nUse arrow keys, j/k/h/l/gg/G/C-a/C-e/C-n/C-p\n"
26
26
  str << alist.join("\n")
27
27
  tv = TextPad.new @form, :name => "text", :text => str.split("\n")
@@ -40,4 +40,4 @@ if __FILE__ == $PROGRAM_NAME
40
40
 
41
41
  st = status_line :row => -1
42
42
  end # app
43
- end # if
43
+ end # if
@@ -1,5 +1,5 @@
1
1
  # demo to test keypresses
2
- # press any key and see the value that ncurses or our routines catch.
2
+ # press any key and see the value that ncurses or our routines catch.
3
3
  # Press alt and control combinations and Function keys
4
4
  # Ideally each key should return only one value. Sometimes, some TERM setting
5
5
  # or terminal emulator may not give correct values or may give different values
@@ -37,7 +37,7 @@ if $0 == __FILE__
37
37
  # please use a hash to pass these values, avoid this old style
38
38
  # i want to move away from it as it comlpicates code
39
39
  texta = TextPad.new @form do
40
- name "mytext"
40
+ name "mytext"
41
41
  row r
42
42
  col c
43
43
  width w
@@ -49,7 +49,7 @@ if $0 == __FILE__
49
49
  title_attrib (Ncurses::A_BOLD)
50
50
  end
51
51
  help = "q to quit. escdelay is #{nd}. Check keys. F1..10, C-a..z, Alt a-zA-Z0-9, C-left,rt, Sh-F5..10 .: #{$0}"
52
- help1 = "Press in quick succession: 1) M-[, w and (2) M-[, M-w. (3) M-Sh-O, w."
52
+ help1 = "Press in quick succession: 1) M-[, w and (2) M-[, M-w. (3) M-Sh-O, w."
53
53
  Canis::Label.new @form, {'text' => help, "row" => r+h+1, "col" => 2, "color" => "yellow"}
54
54
  Canis::Label.new @form, {'text' => help1, "row" => r+h+2, "col" => 2, "color" => "green"}
55
55
  texta.text = ["Press any key, Function, control, alt etc to see ","if it works.",
@@ -59,8 +59,8 @@ if $0 == __FILE__
59
59
  @window.wrefresh
60
60
  Ncurses::Panel.update_panels
61
61
  while((ch = @window.getchar()) != 999 )
62
- str = keycode_tos ch if ch.is_a? Fixnum
63
- #str1 = @window.key_tos ch if ch.is_a? Fixnum
62
+ str = keycode_tos ch if ch.is_a? Integer
63
+ #str1 = @window.key_tos ch if ch.is_a? Integer
64
64
  str1 = $key_chr
65
65
  $log.debug "#{ch} got (#{str} $key_chr:#{str1})"
66
66
  texta << "#{ch} got (#{str}) #{str1}"
@@ -1,20 +1,20 @@
1
1
  # NOTE: If the listbox is empty, that could mean that you have not generated
2
2
  # ri documentation for this version of ruby. You can do so by doing:
3
- # rvm docs generate-ri
4
- # or
3
+ # rvm docs generate-ri
4
+ # or
5
5
  # rvm docs generate
6
6
  # (This assumes you are using rvm)
7
7
  #
8
- # WARNING : IF THIS PROGRAM HANGS check the ri command
8
+ # WARNING : IF THIS PROGRAM HANGS check the ri command
9
9
  # Maybe your version of ri has different options and is going interactive.
10
10
  # ruby 1.9.3's ri requires a -l option or else if becomes interactive.
11
11
  # this program tests out a listbox
12
- # This is written in the old style where we start and end ncurses and initiate a
12
+ # This is written in the old style where we start and end ncurses and initiate a
13
13
  # getch loop. It gives more control.
14
14
  # The new style is to use App which does the ncurses setup and teardown, as well
15
15
  # as manages keys. It also takes care of logger and includes major stuff.
16
16
  # NOTE : this is the new listbox (based on Textpad version, the original
17
- # version has been moved to deprecated. 2014-04-08 - 18:32
17
+ # version has been moved to deprecated. 2014-04-08 - 18:32
18
18
  require 'logger'
19
19
  require 'canis'
20
20
  require 'canis/core/widgets/listbox'
@@ -39,14 +39,14 @@ end
39
39
  Press <ENTER> on a class name on the first list, to view `ri` information
40
40
  for it on the right.
41
41
 
42
- Tab to right box, navigate to a method name, and press <ENTER> on a method
42
+ Tab to right box, navigate to a method name, and press <ENTER> on a method
43
43
  name, to see its details in a popup screen.
44
44
  Press */* <slash> in any box to search. e.g "/String" will take you to the
45
45
  first occurrence of "String". <n> will take you to the next match.
46
46
 
47
47
  To go quickly to the first Class starting with 'S', type <f> followed by <S>.
48
48
  Then press <n> to go to next match.
49
-
49
+
50
50
  =========================================================================
51
51
  ## Vim Edit Keys
52
52
 
@@ -64,7 +64,7 @@ These are not of use here, but are demonstrative of list capabilities.
64
64
  ## Buffers
65
65
 
66
66
  Ordinary a [[textpad]] contains only one buffer. However, the one on the right
67
- is extended for multiple buffers. Pressing <ENTER> on the left on several
67
+ is extended for multiple buffers. Pressing <ENTER> on the left on several
68
68
  rows opens multiple buffers on the right. Use <M-n> (Alt-N) and <M-p> to navigate.
69
69
  ALternatively, <:> maps to a menu, so :n and :p may also be used.
70
70
  <BACKSPACE> will also go to previous buffer, like a browser.
@@ -81,15 +81,15 @@ if $0 == __FILE__
81
81
  # Initialize curses
82
82
  Canis::start_ncurses # this is initializing colors via ColorMap.setup
83
83
  path = File.join(ENV["LOGDIR"] || "./" ,"canis14.log")
84
- logfilename = File.open(path, File::WRONLY|File::TRUNC|File::CREAT)
84
+ logfilename = File.open(path, File::WRONLY|File::TRUNC|File::CREAT)
85
85
  $log = Logger.new(logfilename)
86
86
  $log.level = Logger::DEBUG
87
87
 
88
88
  @window = Canis::Window.root_window
89
89
  $log.debug " WINDOW #{FFI::NCurses.LINES} "
90
90
  $catch_alt_digits = true; # emacs like alt-1..9 numeric arguments
91
- # Initialize few color pairs
92
- # Create the window to be associated with the form
91
+ # Initialize few color pairs
92
+ # Create the window to be associated with the form
93
93
  # Un post form and free the memory
94
94
 
95
95
  catch(:close) do
@@ -103,14 +103,14 @@ if $0 == __FILE__
103
103
  r = 1; fc = 1;
104
104
 
105
105
  # this is the old style of using a label at the screen bottom, you can use the status_line
106
-
106
+
107
107
  v = "F10 quits. F1 Help. Try j k gg G o O C dd f<char> w yy p P / . Press ENTER on Class or Method"
108
- var = Canis::Label.new @form, {'text' => v, "row" => FFI::NCurses.LINES-2,
108
+ var = Canis::Label.new @form, {'text' => v, "row" => FFI::NCurses.LINES-2,
109
109
  "col" => fc, "width" => 100}
110
110
 
111
111
  h = FFI::NCurses.LINES-3
112
112
  file = "./data/ports.txt"
113
- #mylist = File.open(file,'r').readlines
113
+ #mylist = File.open(file,'r').readlines
114
114
  mylist = `ri -l `.split("\n")
115
115
  w = 25
116
116
  #0.upto(100) { |v| mylist << "#{v} scrollable data" }
@@ -131,8 +131,8 @@ if $0 == __FILE__
131
131
  listb.vieditable_init_listbox
132
132
  include Io
133
133
  listb.bind_key(?r, 'get file'){ get_file("Get a file:") }
134
- listb.bind(:PRESS) {
135
- w = @form.by_name["tv"];
134
+ listb.bind(:PRESS) {
135
+ w = @form.by_name["tv"];
136
136
  #lines = `ri -f bs #{listb.current_value}`.split("\n")
137
137
  #lines = `ri -f ansi #{listb.current_value} 2>&1`.gsub('','').split("\n")
138
138
  lines = get_data listb.current_value
@@ -144,7 +144,7 @@ if $0 == __FILE__
144
144
 
145
145
  tv = Canis::TextPad.new @form, :row => r, :col => w+1, :height => h, :width => FFI::NCurses.COLS-w-1,
146
146
  :name => "tv", :title => "Press Enter on method"
147
- tv.set_content ["Press Enter on list to view ri information in this area.",
147
+ tv.set_content ["Press Enter on list to view ri information in this area.",
148
148
  "Press ENTER on method name to see details"]
149
149
  require 'canis/core/include/multibuffer'
150
150
  tv.extend(Canis::MultiBuffers)
@@ -157,7 +157,7 @@ if $0 == __FILE__
157
157
  w = ev.word_under_cursor.strip
158
158
  # check that user did not hit enter on empty area
159
159
  if w != ""
160
- #_text = `ri -f bs #{tv.title}.#{w} 2>&1`
160
+ #_text = `ri -f bs #{tv.title}.#{w} 2>&1`
161
161
  #_text = _text.split("\n")
162
162
  _text = get_data "#{tv.title}.#{w}"
163
163
  if _text && _text.size != 0