rbcurse 1.5.2 → 1.5.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (100) hide show
  1. data/README.markdown +3 -2
  2. data/VERSION +1 -1
  3. metadata +6 -103
  4. data/examples/README.txt +0 -67
  5. data/examples/abasiclist.rb +0 -33
  6. data/examples/alpmenu.rb +0 -42
  7. data/examples/app.rb +0 -859
  8. data/examples/app.sample +0 -17
  9. data/examples/appdirtree.rb +0 -74
  10. data/examples/appemail.rb +0 -191
  11. data/examples/appemaillb.rb +0 -308
  12. data/examples/appgcompose.rb +0 -315
  13. data/examples/atree.rb +0 -64
  14. data/examples/common/file.rb +0 -40
  15. data/examples/common/rmail.rb +0 -257
  16. data/examples/data.txt +0 -683
  17. data/examples/data/README.markdown +0 -9
  18. data/examples/data/brew.txt +0 -38
  19. data/examples/data/color.2 +0 -37
  20. data/examples/data/gemlist.txt +0 -60
  21. data/examples/data/lotr.txt +0 -12
  22. data/examples/data/ports.txt +0 -136
  23. data/examples/data/tasks.txt +0 -27
  24. data/examples/data/todocsv.csv +0 -28
  25. data/examples/data/unix1.txt +0 -21
  26. data/examples/data/unix2.txt +0 -11
  27. data/examples/dbdemo.rb +0 -495
  28. data/examples/deprecated/appgmail.rb +0 -952
  29. data/examples/deprecated/splitp.rb +0 -56
  30. data/examples/deprecated/testscrolllb.rb +0 -86
  31. data/examples/deprecated/testscrollp.rb +0 -88
  32. data/examples/deprecated/testscrollta.rb +0 -80
  33. data/examples/deprecated/testscrolltable.rb +0 -165
  34. data/examples/deprecated/testsplit.rb +0 -87
  35. data/examples/deprecated/testsplit2.rb +0 -123
  36. data/examples/deprecated/testsplit3.rb +0 -215
  37. data/examples/deprecated/testsplit3_1.rb +0 -244
  38. data/examples/deprecated/testsplit3a.rb +0 -215
  39. data/examples/deprecated/testsplit3b.rb +0 -237
  40. data/examples/deprecated/testsplitta.rb +0 -148
  41. data/examples/deprecated/testsplittv.rb +0 -142
  42. data/examples/deprecated/testsplittvv.rb +0 -144
  43. data/examples/deprecated/testtpane.rb +0 -215
  44. data/examples/deprecated/testtpane2.rb +0 -145
  45. data/examples/deprecated/testtpanetable.rb +0 -203
  46. data/examples/dirtree.rb +0 -88
  47. data/examples/experimental/resultsetdemo.rb +0 -280
  48. data/examples/experimental/testmform.rb +0 -35
  49. data/examples/experimental/testscroller.rb +0 -117
  50. data/examples/experimental/teststackflow.rb +0 -111
  51. data/examples/menu1.rb +0 -112
  52. data/examples/multispl.rb +0 -86
  53. data/examples/newmessagebox.rb +0 -131
  54. data/examples/newtabbedwindow.rb +0 -100
  55. data/examples/newtesttabp.rb +0 -121
  56. data/examples/qdfilechooser.rb +0 -68
  57. data/examples/rfe.rb +0 -1239
  58. data/examples/rfe_renderer.rb +0 -121
  59. data/examples/sqlc.rb +0 -454
  60. data/examples/sqlm.rb +0 -437
  61. data/examples/sqlt.rb +0 -408
  62. data/examples/status.txt +0 -68
  63. data/examples/table1.rb +0 -24
  64. data/examples/term2.rb +0 -84
  65. data/examples/test1.rb +0 -239
  66. data/examples/test2.rb +0 -674
  67. data/examples/testapp.rb +0 -44
  68. data/examples/testapp2.rb +0 -58
  69. data/examples/testchars.rb +0 -137
  70. data/examples/testcombo.rb +0 -91
  71. data/examples/testkeypress.rb +0 -66
  72. data/examples/testlistbox.rb +0 -113
  73. data/examples/testmenu.rb +0 -101
  74. data/examples/testmulticomp.rb +0 -70
  75. data/examples/testmulticontainer.rb +0 -94
  76. data/examples/testmultispl.rb +0 -199
  77. data/examples/testree.rb +0 -106
  78. data/examples/testtable.rb +0 -264
  79. data/examples/testtabp.rb +0 -107
  80. data/examples/testtodo.rb +0 -584
  81. data/examples/testvimsplit.rb +0 -112
  82. data/examples/testwsshortcuts.rb +0 -64
  83. data/examples/testwsshortcuts2.rb +0 -126
  84. data/examples/todo.db +0 -0
  85. data/examples/todo.yml +0 -191
  86. data/examples/viewtodo.rb +0 -574
  87. data/lib/rbcurse.rb +0 -8
  88. data/lib/rbcurse/deprecated/README.markdown +0 -12
  89. data/lib/rbcurse/deprecated/rpad.rb +0 -375
  90. data/lib/rbcurse/deprecated/rscrollpane.rb +0 -512
  91. data/lib/rbcurse/deprecated/rsplitpane.rb +0 -894
  92. data/lib/rbcurse/deprecated/rsplitpane2.rb +0 -1009
  93. data/lib/rbcurse/deprecated/rviewport.rb +0 -204
  94. data/lib/rbcurse/deprecated/widgets/mapper.rb +0 -130
  95. data/lib/rbcurse/deprecated/widgets/rmessagebox.rb +0 -348
  96. data/lib/rbcurse/deprecated/widgets/rtabbedpane.rb +0 -1158
  97. data/lib/rbcurse/deprecated/widgets/rtabbedwindow.rb +0 -167
  98. data/lib/rbcurse/deprecated/widgets/scrollable.rb +0 -301
  99. data/lib/rbcurse/deprecated/widgets/stdscrwindow.rb +0 -309
  100. data/lib/ver/keyboard2.rb +0 -170
@@ -1,87 +0,0 @@
1
- #$LOAD_PATH << "/Users/rahul/work/projects/rbcurse/"
2
- require 'rubygems'
3
- #require 'ncurses' # FFI
4
- require 'logger'
5
- require 'rbcurse'
6
- require 'rbcurse/rsplitpane'
7
- #require 'rbcurse/rtestwidget'
8
- #
9
- ## this sample creates a single scrollpane, and allows you to change orientation
10
- ##+ and move divider around using - + and =.
11
- #
12
- if $0 == __FILE__
13
- include RubyCurses
14
- include RubyCurses::Utils
15
-
16
- begin
17
- # Initialize curses
18
- VER::start_ncurses # this is initializing colors via ColorMap.setup
19
- $log = Logger.new((File.join(ENV["LOGDIR"] || "./" ,"rbc13.log")))
20
- $log.level = Logger::DEBUG
21
-
22
- @window = VER::Window.root_window
23
-
24
- catch(:close) do
25
- colors = Ncurses.COLORS
26
- @form = Form.new @window
27
- r = 3; c = 7; ht = 18
28
- # filler just to see that we are covering correct space and not wasting lines or cols
29
- filler = "*" * 88
30
- (ht+2).times(){|i| @form.window.printstring(i,r, filler, $datacolor) }
31
-
32
-
33
- @help = "q to quit. v h - + = : #{$0} . Check logger too"
34
- RubyCurses::Label.new @form, {'text' => @help, "row" => ht+r, "col" => 2, "color" => "yellow"}
35
-
36
- $message = Variable.new
37
- $message.value = "Message Comes Here"
38
- message_label = RubyCurses::Label.new @form, {'text_variable' => $message, "name"=>"message_label","row" => ht+r+2, "col" => 1, "display_length" => 60, "height" => 2, 'color' => 'cyan'}
39
- $message.update_command() { message_label.repaint } # why ?
40
-
41
- splitp = SplitPane.new @form do
42
- name "mypane"
43
- row r
44
- col c
45
- width 70
46
- height ht
47
- # focusable false
48
- #orientation :VERTICAL_SPLIT
49
- end
50
- splitp.bind(:PROPERTY_CHANGE){|e| $message.value = e.to_s }
51
-
52
- @form.repaint
53
- @window.wrefresh
54
- Ncurses::Panel.update_panels
55
- while((ch = @window.getchar()) != ?q.getbyte(0) )
56
- str = keycode_tos ch
57
- case ch
58
- when ?v.getbyte(0)
59
- splitp.orientation(:VERTICAL_SPLIT)
60
- splitp.reset_to_preferred_sizes
61
- when ?h.getbyte(0)
62
- splitp.orientation(:HORIZONTAL_SPLIT)
63
- splitp.reset_to_preferred_sizes
64
- when ?-.getbyte(0)
65
- splitp.set_divider_location(splitp.divider_location-1)
66
- when ?+.getbyte(0)
67
- splitp.set_divider_location(splitp.divider_location+1)
68
- when ?=.getbyte(0)
69
- splitp.set_resize_weight(0.50)
70
- end
71
- #splitp.get_buffer().wclear
72
- #splitp << "#{ch} got (#{str})"
73
- splitp.repaint # since the above keys are not being handled inside
74
- @form.handle_key(ch)
75
- @window.wrefresh
76
- end
77
- end
78
- rescue => ex
79
- ensure
80
- @window.destroy if !@window.nil?
81
- VER::stop_ncurses
82
- p ex if ex
83
- p(ex.backtrace.join("\n")) if ex
84
- $log.debug( ex) if ex
85
- $log.debug(ex.backtrace.join("\n")) if ex
86
- end
87
- end
@@ -1,123 +0,0 @@
1
- #$LOAD_PATH << "/Users/rahul/work/projects/rbcurse/"
2
- require 'rubygems'
3
- #require 'ncurses' # FFI
4
- require 'logger'
5
- require 'rbcurse'
6
- require 'rbcurse/rsplitpane'
7
- #require 'rbcurse/rtestwidget'
8
- if $0 == __FILE__
9
- include RubyCurses
10
- include RubyCurses::Utils
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
-
20
- catch(:close) do
21
- colors = Ncurses.COLORS
22
- @form = Form.new @window
23
- r = 3; c = 5; ht = 18; w = 70
24
- # filler just to see that we are covering correct space and not wasting lines or cols
25
- filler = "*" * 88
26
- # (ht+2).times(){|i| @form.window.printstring(i,r, filler, $datacolor) }
27
-
28
-
29
- @help = "q to quit. v for vertical split, h - horizontal. -/+/= to resize split. : #{$0}"
30
- RubyCurses::Label.new @form, {'text' => @help, "row" => ht+r, "col" => 2, "color" => "yellow"}
31
- splitp = SplitPane.new @form do
32
- name "mainpane"
33
- row r
34
- col c
35
- width w
36
- height ht
37
- #focusable false
38
- #orientation :VERTICAL_SPLIT
39
- orientation :HORIZONTAL_SPLIT
40
- #set_resize_weight 0.60
41
- end
42
- # note that splitc has no form. so focus has to be managed XXX
43
- splitc = SplitPane.new nil do
44
- name "FC"
45
- #row r
46
- #col c
47
-
48
- ## earlier commented now bombing
49
- #width w-4 # 30
50
- #height ht/2-1
51
-
52
- #focusable false
53
- #orientation :HORIZONTAL_SPLIT
54
- orientation :VERTICAL_SPLIT
55
- border_color $promptcolor
56
- border_attrib Ncurses::A_NORMAL
57
- end
58
- splitc2 = SplitPane.new nil do
59
- name "2C"
60
- #
61
- ## not present earlier now bombing
62
- #width w-4
63
- #height ht/2-1
64
-
65
- orientation :VERTICAL_SPLIT
66
- border_color $promptcolor
67
- border_attrib Ncurses::A_REVERSE
68
- end
69
- splitp.first_component(splitc)
70
- splitp.second_component(splitc2)
71
- splitc.preferred_width w/2
72
- splitc.preferred_height ht/2-2
73
- splitc.set_resize_weight 0.50
74
- splitc2.min_width 15
75
- splitc2.min_height 5
76
- splitc.min_width 12
77
- splitc.min_height 6
78
- ret = splitp.reset_to_preferred_sizes
79
- splitp.set_resize_weight(0.50) if ret == :ERROR
80
-
81
- @form.repaint
82
- @window.wrefresh
83
- Ncurses::Panel.update_panels
84
- while((ch = @window.getchar()) != ?q.getbyte(0) )
85
- str = keycode_tos ch
86
- case ch
87
- when ?v.getbyte(0)
88
- $log.debug " ORIENTATION VERTICAL"
89
- splitp.orientation(:VERTICAL_SPLIT)
90
- splitp.reset_to_preferred_sizes
91
- when ?h.getbyte(0)
92
- $log.debug " ORIENTATION HORIZ"
93
- splitp.orientation(:HORIZONTAL_SPLIT)
94
- splitp.reset_to_preferred_sizes
95
- when ?-.getbyte(0)
96
- $log.debug " KEY PRESS -"
97
- splitp.set_divider_location(splitp.divider_location-1)
98
- when ?+.getbyte(0)
99
- $log.debug " KEY PRESS +"
100
- splitp.set_divider_location(splitp.divider_location+1)
101
- when ?=.getbyte(0)
102
- $log.debug " KEY PRESS ="
103
- splitp.set_resize_weight(0.50)
104
- end
105
- #splitp.get_buffer().wclear
106
- #splitp << "#{ch} got (#{str})"
107
- # splitp.repaint
108
- # splitp.buffer_to_screen
109
- @form.repaint
110
- @form.handle_key(ch)
111
- @window.wrefresh
112
- end
113
- end
114
- rescue => ex
115
- ensure
116
- @window.destroy if !@window.nil?
117
- VER::stop_ncurses
118
- p ex if ex
119
- p(ex.backtrace.join("\n")) if ex
120
- $log.debug( ex) if ex
121
- $log.debug(ex.backtrace.join("\n")) if ex
122
- end
123
- end
@@ -1,215 +0,0 @@
1
- #$LOAD_PATH << "/Users/rahul/work/projects/rbcurse/"
2
- #*******************************************************#
3
- # testsplit3.rb #
4
- # written by Rahul Kumar #
5
- # January 14, 2010 #
6
- # #
7
- # test textview, split and textarea inside splitpane #
8
- # #
9
- #
10
- # /----+---------------\
11
- # | | |
12
- # | 1 | |
13
- # +----+ 3 |
14
- # | 2 | |
15
- # | | |
16
- # \----+---------------/
17
- #
18
- # Please note, this is *not* the ideal way of placing a textview directly inside a
19
- # splitpane, unless you size it so that the entire TV is visible inside
20
- # the splitpane. If the TV is too large, you won't be able to scroll down to the
21
- # bottom-most portion using TV's inbuilt scrolling (C-n C-p). This is *not* a bug.
22
- # TV does not know you've put it inside a small SPLP.
23
- #
24
- # The ideal way is to put a TV inside a scrollpane, and put the scrollpane inside
25
- # a SPLP just like all frames on the internet do. That is the subject of the next example.
26
- #
27
- #
28
- # Released under ruby license. See #
29
- # http://www.ruby-lang.org/en/LICENSE.txt #
30
- # Copyright 2010, Rahul Kumar #
31
- #*******************************************************#
32
- require 'rubygems'
33
- #require 'ncurses' # FFI
34
- require 'logger'
35
- require 'rbcurse'
36
- require 'rbcurse/rsplitpane'
37
- require 'rbcurse/core/widgets/rtextarea'
38
- require 'rbcurse/core/widgets/rtextview'
39
- require 'rbcurse/extras/widgets/rlistbox'
40
- if $0 == __FILE__
41
- include RubyCurses
42
- include RubyCurses::Utils
43
-
44
- begin
45
- # Initialize curses
46
- VER::start_ncurses # this is initializing colors via ColorMap.setup
47
- $log = Logger.new((File.join(ENV["LOGDIR"] || "./" ,"rbc13.log")))
48
- $log.level = Logger::DEBUG
49
-
50
- @window = VER::Window.root_window
51
-
52
- catch(:close) do
53
- colors = Ncurses.COLORS
54
- @form = Form.new @window
55
- @form.name = "Form::MAINFORM"
56
- $log.debug " MAIN FORM #{@form} #{$0} "
57
- r = 3; c = 5; ht = 18; w = 90
58
- # r = 0; c = 0; ht = 20; w = 100
59
-
60
-
61
- @help = "F1 to quit. -/+/= to resize outer split, M-, M+, M= for inner split: #{$0}"
62
- RubyCurses::Label.new @form, {'text' => @help, "row" => ht+r+2, "col" => 2, "color" => "yellow"}
63
-
64
- outer = SplitPane.new @form do
65
- name "mainpane"
66
- row r
67
- col c
68
- width w
69
- height ht
70
- #focusable false
71
- orientation :VERTICAL_SPLIT
72
- #orientation :HORIZONTAL_SPLIT
73
- #set_resize_weight 0.60
74
- border_color $promptcolor
75
- end
76
- # note that splitleft has no form. so focus has to be managed XXX
77
- splitleft = SplitPane.new nil do
78
- name "C1-leftpane"
79
- #row r
80
- #col c
81
-
82
- ## earlier commented now bombing
83
- #width w/2 # 30
84
- #height ht-2 #/2-1
85
-
86
- #focusable false
87
- orientation :HORIZONTAL_SPLIT
88
- #orientation :VERTICAL_SPLIT
89
- border_color $promptcolor
90
- border_attrib Ncurses::A_NORMAL
91
- end
92
- ta1 = TextArea.new nil do
93
- name "myTextArea-right"
94
- #row 0
95
- #col 0
96
- width w/2-2
97
- #height (ht/2)-1
98
- height ht
99
- title "README.md"
100
- title_attrib 'bold'
101
- print_footer true
102
- footer_attrib 'bold'
103
- #should_create_buffer true
104
- end
105
-
106
- t1 = TextView.new nil do
107
- name "myView-left-first"
108
- #row 0
109
- #col 0
110
- #width w-2
111
- #height ht
112
- height (ht/2)-1
113
- width w/2 #-1
114
- title "README.md"
115
- title_attrib 'bold'
116
- print_footer true
117
- footer_attrib 'bold'
118
- #should_create_buffer true
119
- end
120
- content = File.open("../README.markdown","r").readlines
121
- t1.set_content content #, :WRAP_WORD
122
-
123
- # to see lower border i need to set height to ht/2 -2 in both cases, but that
124
- # crashes ruby when i reduce height by 1.
125
- t2 = TextView.new nil do
126
- name "myView2-left-second"
127
- #row 0
128
- #col 0
129
- width w/2
130
- #height ht
131
- height (ht/2)-1
132
- title "NOTES"
133
- title_attrib 'bold'
134
- print_footer true
135
- footer_attrib 'bold'
136
- #should_create_buffer true
137
- end
138
- content = File.open("../NOTES","r").readlines
139
- t2.set_content content #, :WRAP_WORD
140
-
141
- # the outer compo needs child set first else cursor does not reach up from
142
- # lower levels. Is the connection broken ?
143
- outer.first_component(splitleft)
144
- outer.second_component(ta1)
145
- splitleft.first_component(t1)
146
- splitleft.second_component(t2)
147
- t1.preferred_width w/2 #/2 ## should pertain more to horizontal orientation
148
- t1.preferred_height((ht/2)-1) ## this messes things up when we change orientation
149
- #t1.set_resize_weight 0.50
150
- t2.min_width 15
151
- t2.min_height 5
152
- t1.min_width 12
153
- t1.min_height 5
154
- ret = splitleft.reset_to_preferred_sizes
155
- splitleft.set_resize_weight(0.50) if ret == :ERROR
156
-
157
- splitleft.preferred_width w/2
158
- splitleft.preferred_height ht/2-2
159
- #splitleft.set_resize_weight 0.50
160
- ta1.min_width 10
161
- ta1.min_height 5
162
- splitleft.min_width 12
163
- splitleft.min_height 6
164
- ret = outer.reset_to_preferred_sizes
165
- outer.set_resize_weight(0.50) if ret == :ERROR
166
-
167
- File.open("../README.markdown","r") do |file|
168
- while (line = file.gets)
169
- ta1 << line.chomp
170
- end
171
- end
172
-
173
- @form.repaint
174
- @window.wrefresh
175
- Ncurses::Panel.update_panels
176
- while((ch = @window.getchar()) != KEY_F1 )
177
- str = keycode_tos ch
178
- case ch
179
- #when ?v.getbyte(0)
180
- #$log.debug " ORIENTATION VERTICAL"
181
- #outer.orientation(:VERTICAL_SPLIT)
182
- #outer.reset_to_preferred_sizes
183
- #when ?h.getbyte(0)
184
- #$log.debug " ORIENTATION HORIZ"
185
- #outer.orientation(:HORIZONTAL_SPLIT)
186
- #outer.reset_to_preferred_sizes
187
- when ?-.getbyte(0)
188
- $log.debug " KEY PRESS -"
189
- outer.set_divider_location(outer.divider_location-1)
190
- when ?+.getbyte(0)
191
- $log.debug " KEY PRESS +"
192
- outer.set_divider_location(outer.divider_location+1)
193
- when ?=.getbyte(0)
194
- $log.debug " KEY PRESS ="
195
- outer.set_resize_weight(0.50)
196
- end
197
- #outer.get_buffer().wclear
198
- #outer << "#{ch} got (#{str})"
199
- # outer.repaint
200
- # outer.buffer_to_screen
201
- @form.repaint
202
- @form.handle_key(ch)
203
- @window.wrefresh
204
- end
205
- end
206
- rescue => ex
207
- ensure
208
- @window.destroy if !@window.nil?
209
- VER::stop_ncurses
210
- p ex if ex
211
- p(ex.backtrace.join("\n")) if ex
212
- $log.debug( ex) if ex
213
- $log.debug(ex.backtrace.join("\n")) if ex
214
- end
215
- end
@@ -1,244 +0,0 @@
1
- #$LOAD_PATH << "/Users/rahul/work/projects/rbcurse/"
2
- #*******************************************************#
3
- # testsplit3.rb #
4
- # written by Rahul Kumar #
5
- # January 14, 2010 #
6
- # #
7
- # test textview, split and textarea inside splitpane #
8
- # #
9
- #
10
- # /---------|----------\
11
- # | | |
12
- # | 1 | 3 |
13
- # +---------|----------|
14
- # | 2 | 4 |
15
- # | | |
16
- # \---------|----------/
17
- #
18
- #
19
- # Released under ruby license. See #
20
- # http://www.ruby-lang.org/en/LICENSE.txt #
21
- # Copyright 2010, Rahul Kumar #
22
- #*******************************************************#
23
- require 'rubygems'
24
- #require 'ncurses' # FFI
25
- require 'logger'
26
- require 'rbcurse'
27
- require 'rbcurse/rsplitpane'
28
- require 'rbcurse/core/widgets/rtextarea'
29
- require 'rbcurse/core/widgets/rtextview'
30
- require 'rbcurse/extras/widgets/rlistbox'
31
- if $0 == __FILE__
32
- include RubyCurses
33
- include RubyCurses::Utils
34
-
35
- begin
36
- # Initialize curses
37
- VER::start_ncurses # this is initializing colors via ColorMap.setup
38
- $log = Logger.new((File.join(ENV["LOGDIR"] || "./" ,"rbc13.log")))
39
- $log.level = Logger::DEBUG
40
- show_caret_flag = true
41
-
42
- @window = VER::Window.root_window
43
-
44
- catch(:close) do
45
- colors = Ncurses.COLORS
46
- @form = Form.new @window
47
- @form.name = "Form::MAINFORM"
48
- r = 1; c = 3; ht = 18; w = 70
49
- r = 3; c = 7; ht = 24; w = 100
50
-
51
-
52
- @help = "F1 to quit. -/+/= to resize outer split, M-, M+, M= for inner split: #{$0}"
53
- RubyCurses::Label.new @form, {'text' => @help, "row" => ht+r, "col" => 2, "color" => "yellow"}
54
-
55
- outer = SplitPane.new @form do
56
- name "mainpane"
57
- row r
58
- col c
59
- width w
60
- height ht
61
- #focusable false
62
- orientation :VERTICAL_SPLIT
63
- #orientation :HORIZONTAL_SPLIT
64
- #set_resize_weight 0.60
65
- end
66
- # note that splitleft has no form. so focus has to be managed XXX
67
- splitleft = SplitPane.new nil do
68
- name "C1-left"
69
- #row r
70
- #col c
71
-
72
- ## earlier commented now bombing
73
- width w/2 # 30
74
- height ht #/2-1
75
-
76
- #focusable false
77
- orientation :HORIZONTAL_SPLIT
78
- #orientation :VERTICAL_SPLIT
79
- border_color $promptcolor
80
- border_attrib Ncurses::A_NORMAL
81
- end
82
- splitrt = SplitPane.new nil do
83
- name "C1-rt"
84
- #row r
85
- #col c
86
-
87
- ## earlier commented now bombing
88
- width w/2 # 30
89
- height ht #/2-1
90
-
91
- #focusable false
92
- orientation :HORIZONTAL_SPLIT
93
- #orientation :VERTICAL_SPLIT
94
- border_color $promptcolor
95
- border_attrib Ncurses::A_NORMAL
96
- end
97
- ta1 = TextArea.new nil do
98
- name "myTextArea1-left-bot"
99
- #row 0
100
- #col 0
101
- width w/2-2
102
- height (ht/2)-1
103
- #height ht
104
- title "README.mark"
105
- title_attrib 'bold'
106
- print_footer true
107
- footer_attrib 'bold'
108
- end
109
- #ta1.show_caret=show_caret_flag
110
- ta2 = TextArea.new nil do
111
- name "myTextArea2-right-bot"
112
- #row 0
113
- #col 0
114
- width w/2-2
115
- height (ht/2)-1
116
- #height ht
117
- title "Scratch Pad"
118
- title_attrib 'reverse'
119
- print_footer true
120
- footer_attrib 'bold'
121
- end
122
- #ta2.show_caret=show_caret_flag
123
-
124
- t1 = TextView.new nil do
125
- name "myView-right-top"
126
- #row 0
127
- #col 0
128
- #width w-2
129
- height ht
130
- #height (ht/2)-1
131
- width w/2-1
132
- title "README.md"
133
- title_attrib 'bold'
134
- print_footer true
135
- footer_attrib 'bold'
136
- end
137
- #t1.show_caret=show_caret_flag
138
- content = File.open("../README.markdown","r").readlines
139
- t1.set_content content #, :WRAP_WORD
140
-
141
- # to see lower border i need to set height to ht/2 -2 in both cases, but that
142
- # crashes ruby when i reduce height by 1.
143
- t2 = TextView.new nil do
144
- name "myView2-left-top"
145
- #row 0
146
- #col 0
147
- width w/2-1
148
- height ht
149
- #height (ht/2)-1
150
- title "NOTES"
151
- title_attrib 'bold'
152
- print_footer true
153
- footer_attrib 'bold'
154
- end
155
- #t2.show_caret=show_caret_flag
156
- content = File.open("../NOTES","r").readlines
157
- t2.set_content content #, :WRAP_WORD
158
-
159
- # the outer compo needs child set first else cursor does not reach up from
160
- # lower levels. Is the connection broken ?
161
- outer.first_component(splitleft)
162
- outer.second_component(splitrt)
163
- splitleft.first_component(t2)
164
- splitleft.second_component(ta1)
165
- splitrt.first_component(t1)
166
- splitrt.second_component(ta2)
167
- t2.preferred_width w/2 #/2 ## should pertain more to horizontal orientation
168
- t2.preferred_height((ht/2)-1) ## this messes things up when we change orientation
169
- t1.preferred_width w/2 #/2 ## should pertain more to horizontal orientation
170
- t1.preferred_height((ht/2)-1) ## this messes things up when we change orientation
171
- #t1.set_resize_weight 0.50
172
- t2.min_width 15
173
- t2.min_height 5
174
- t1.min_width 12
175
- t1.min_height 5
176
- ta1.min_width 10
177
- ta1.min_height 5
178
- ta2.min_width 10
179
- ta2.min_height 5
180
- ret = splitleft.reset_to_preferred_sizes
181
- splitleft.set_resize_weight(0.50) if ret == :ERROR
182
- ret = splitrt.reset_to_preferred_sizes
183
- splitrt.set_resize_weight(0.50) if ret == :ERROR
184
-
185
- splitleft.preferred_width w/2
186
- splitleft.preferred_height ht/2-2
187
- splitleft.min_width 12
188
- splitleft.min_height 6
189
- splitrt.preferred_width w/2
190
- splitrt.preferred_height ht/2-2
191
- splitrt.min_width 12
192
- splitrt.min_height 6
193
- ret = outer.reset_to_preferred_sizes
194
- outer.set_resize_weight(0.50) if ret == :ERROR
195
-
196
- File.open("../README.markdown","r") do |file|
197
- while (line = file.gets)
198
- ta1 << line.chomp
199
- end
200
- end
201
-
202
- @form.repaint
203
- @window.wrefresh
204
- Ncurses::Panel.update_panels
205
- while((ch = @window.getchar()) != KEY_F1 )
206
- str = keycode_tos ch
207
- #case ch
208
- #when ?v.getbyte(0)
209
- #$log.debug " ORIENTATION VERTICAL"
210
- #outer.orientation(:VERTICAL_SPLIT)
211
- #outer.reset_to_preferred_sizes
212
- #when ?h.getbyte(0)
213
- #$log.debug " ORIENTATION HORIZ"
214
- #outer.orientation(:HORIZONTAL_SPLIT)
215
- #outer.reset_to_preferred_sizes
216
- #when ?-.getbyte(0)
217
- #$log.debug " KEY PRESS -"
218
- #outer.set_divider_location(outer.divider_location-1)
219
- #when ?+.getbyte(0)
220
- #$log.debug " KEY PRESS +"
221
- #outer.set_divider_location(outer.divider_location+1)
222
- #when ?=.getbyte(0)
223
- #$log.debug " KEY PRESS ="
224
- #outer.set_resize_weight(0.50)
225
- #end
226
- #outer.get_buffer().wclear
227
- #outer << "#{ch} got (#{str})"
228
- # outer.repaint
229
- # outer.buffer_to_screen
230
- @form.repaint
231
- @form.handle_key(ch)
232
- @window.wrefresh
233
- end
234
- end
235
- rescue => ex
236
- ensure
237
- @window.destroy if !@window.nil?
238
- VER::stop_ncurses
239
- p ex if ex
240
- p(ex.backtrace.join("\n")) if ex
241
- $log.debug( ex) if ex
242
- $log.debug(ex.backtrace.join("\n")) if ex
243
- end
244
- end