rbcurse 1.5.0 → 1.5.2
Sign up to get free protection for your applications and to get access to all the features.
- data/Makefile +21 -0
- data/Manifest.txt +6 -0
- data/README.markdown +6 -4
- data/TODO +372 -0
- data/TODO2.txt +121 -0
- data/VERSION +1 -1
- data/examples/README.txt +67 -0
- data/examples/abasiclist.rb +33 -0
- data/examples/alpmenu.rb +42 -0
- data/examples/app.rb +859 -0
- data/examples/app.sample +17 -0
- data/examples/appdirtree.rb +74 -0
- data/examples/appemail.rb +191 -0
- data/examples/appemaillb.rb +308 -0
- data/examples/appgcompose.rb +315 -0
- data/examples/atree.rb +64 -0
- data/examples/common/file.rb +40 -0
- data/examples/common/rmail.rb +257 -0
- data/examples/data.txt +683 -0
- data/examples/data/README.markdown +9 -0
- data/examples/data/brew.txt +38 -0
- data/examples/data/color.2 +37 -0
- data/examples/data/gemlist.txt +60 -0
- data/examples/data/lotr.txt +12 -0
- data/examples/data/ports.txt +136 -0
- data/examples/data/tasks.txt +27 -0
- data/examples/data/todocsv.csv +28 -0
- data/examples/data/unix1.txt +21 -0
- data/examples/data/unix2.txt +11 -0
- data/examples/dbdemo.rb +495 -0
- data/examples/deprecated/appgmail.rb +952 -0
- data/examples/deprecated/splitp.rb +56 -0
- data/examples/deprecated/testscrolllb.rb +86 -0
- data/examples/deprecated/testscrollp.rb +88 -0
- data/examples/deprecated/testscrollta.rb +80 -0
- data/examples/deprecated/testscrolltable.rb +165 -0
- data/examples/deprecated/testsplit.rb +87 -0
- data/examples/deprecated/testsplit2.rb +123 -0
- data/examples/deprecated/testsplit3.rb +215 -0
- data/examples/deprecated/testsplit3_1.rb +244 -0
- data/examples/deprecated/testsplit3a.rb +215 -0
- data/examples/deprecated/testsplit3b.rb +237 -0
- data/examples/deprecated/testsplitta.rb +148 -0
- data/examples/deprecated/testsplittv.rb +142 -0
- data/examples/deprecated/testsplittvv.rb +144 -0
- data/examples/deprecated/testtpane.rb +215 -0
- data/examples/deprecated/testtpane2.rb +145 -0
- data/examples/deprecated/testtpanetable.rb +203 -0
- data/examples/dirtree.rb +88 -0
- data/examples/experimental/resultsetdemo.rb +280 -0
- data/examples/experimental/testmform.rb +35 -0
- data/examples/experimental/testscroller.rb +117 -0
- data/examples/experimental/teststackflow.rb +111 -0
- data/examples/menu1.rb +112 -0
- data/examples/multispl.rb +86 -0
- data/examples/newmessagebox.rb +131 -0
- data/examples/newtabbedwindow.rb +100 -0
- data/examples/newtesttabp.rb +121 -0
- data/examples/qdfilechooser.rb +68 -0
- data/examples/rfe.rb +1239 -0
- data/examples/rfe_renderer.rb +121 -0
- data/examples/sqlc.rb +454 -0
- data/examples/sqlm.rb +437 -0
- data/examples/sqlt.rb +408 -0
- data/examples/status.txt +68 -0
- data/examples/table1.rb +24 -0
- data/examples/term2.rb +84 -0
- data/examples/test1.rb +239 -0
- data/examples/test2.rb +674 -0
- data/examples/testapp.rb +44 -0
- data/examples/testapp2.rb +58 -0
- data/examples/testchars.rb +137 -0
- data/examples/testcombo.rb +91 -0
- data/examples/testkeypress.rb +66 -0
- data/examples/testlistbox.rb +113 -0
- data/examples/testmenu.rb +101 -0
- data/examples/testmulticomp.rb +70 -0
- data/examples/testmulticontainer.rb +94 -0
- data/examples/testmultispl.rb +199 -0
- data/examples/testree.rb +106 -0
- data/examples/testtable.rb +264 -0
- data/examples/testtabp.rb +107 -0
- data/examples/testtodo.rb +584 -0
- data/examples/testvimsplit.rb +112 -0
- data/examples/testwsshortcuts.rb +64 -0
- data/examples/testwsshortcuts2.rb +126 -0
- data/examples/todo.db +0 -0
- data/examples/todo.yml +191 -0
- data/examples/viewtodo.rb +574 -0
- data/lib/rbcurse/deprecated/README.markdown +12 -0
- data/lib/rbcurse/deprecated/rpad.rb +375 -0
- data/lib/rbcurse/deprecated/rscrollpane.rb +512 -0
- data/lib/rbcurse/deprecated/rsplitpane.rb +894 -0
- data/lib/rbcurse/deprecated/rsplitpane2.rb +1009 -0
- data/lib/rbcurse/deprecated/rviewport.rb +204 -0
- data/lib/rbcurse/deprecated/widgets/mapper.rb +130 -0
- data/lib/rbcurse/deprecated/widgets/rmessagebox.rb +348 -0
- data/lib/rbcurse/deprecated/widgets/rtabbedpane.rb +1158 -0
- data/lib/rbcurse/deprecated/widgets/rtabbedwindow.rb +167 -0
- data/lib/rbcurse/deprecated/widgets/scrollable.rb +301 -0
- data/lib/rbcurse/deprecated/widgets/stdscrwindow.rb +309 -0
- data/lib/ver/keyboard2.rb +170 -0
- data/test/test_rbcurse.rb +0 -0
- metadata +131 -9
@@ -0,0 +1,215 @@
|
|
1
|
+
#$LOAD_PATH << "/Users/rahul/work/projects/rbcurse/"
|
2
|
+
#*******************************************************#
|
3
|
+
# testsplit3a.rb #
|
4
|
+
# written by Rahul Kumar #
|
5
|
+
# January 16, 2010 #
|
6
|
+
# #
|
7
|
+
# Test textview, split and textarea inside splitpane #
|
8
|
+
# This wraps a textview inside a scrollpane, and #
|
9
|
+
# puts the SCRP inside a SPLP #
|
10
|
+
#
|
11
|
+
# /----+---------------\
|
12
|
+
# | V| V|
|
13
|
+
# | 1 V| V|
|
14
|
+
# | >>V| V|
|
15
|
+
# +----+ 3 V|
|
16
|
+
# | V| V|
|
17
|
+
# | 2 V| V|
|
18
|
+
# |>>>V|>>>>>> |
|
19
|
+
# \----+---------------/
|
20
|
+
#
|
21
|
+
#
|
22
|
+
#
|
23
|
+
# Released under ruby license. See #
|
24
|
+
# http://www.ruby-lang.org/en/LICENSE.txt #
|
25
|
+
# Copyright 2010, Rahul Kumar #
|
26
|
+
#*******************************************************#
|
27
|
+
require 'rubygems'
|
28
|
+
#require 'ncurses' # FFI
|
29
|
+
require 'logger'
|
30
|
+
require 'rbcurse'
|
31
|
+
require 'rbcurse/rsplitpane'
|
32
|
+
require 'rbcurse/rscrollpane'
|
33
|
+
require 'rbcurse/core/widgets/rtextarea'
|
34
|
+
require 'rbcurse/core/widgets/rtextview'
|
35
|
+
require 'rbcurse/extras/widgets/rlistbox'
|
36
|
+
if $0 == __FILE__
|
37
|
+
include RubyCurses
|
38
|
+
include RubyCurses::Utils
|
39
|
+
|
40
|
+
begin
|
41
|
+
# Initialize curses
|
42
|
+
VER::start_ncurses # this is initializing colors via ColorMap.setup
|
43
|
+
$log = Logger.new((File.join(ENV["LOGDIR"] || "./" ,"rbc13.log")))
|
44
|
+
$log.level = Logger::DEBUG
|
45
|
+
|
46
|
+
@window = VER::Window.root_window
|
47
|
+
|
48
|
+
catch(:close) do
|
49
|
+
colors = Ncurses.COLORS
|
50
|
+
@form = Form.new @window
|
51
|
+
$log.debug " MAIN FORM #{@form} "
|
52
|
+
r = 1; c = 3; ht = 18; w = 70
|
53
|
+
r = 3; c = 7; ht = 24; w = 100
|
54
|
+
|
55
|
+
|
56
|
+
@help = "F1 to quit. To resize split: M-, M+, M=. TAB, M-w, M-n, M-p, M-l, M-h, C-n/p : #{$0}"
|
57
|
+
RubyCurses::Label.new @form, {'text' => @help, "row" => ht+r, "col" => 2, "color" => "yellow"}
|
58
|
+
|
59
|
+
outer = SplitPane.new @form do
|
60
|
+
name "mainpane"
|
61
|
+
row r
|
62
|
+
col c
|
63
|
+
width w
|
64
|
+
height ht
|
65
|
+
orientation :VERTICAL_SPLIT
|
66
|
+
end
|
67
|
+
# note that splitleft has no form. so focus has to be managed XXX
|
68
|
+
splitleft = SplitPane.new nil do
|
69
|
+
name "splitleft-outer"
|
70
|
+
|
71
|
+
#width w/3 # 30
|
72
|
+
#height ht-0 #/2-1
|
73
|
+
|
74
|
+
orientation :HORIZONTAL_SPLIT
|
75
|
+
border_color $promptcolor
|
76
|
+
border_attrib Ncurses::A_NORMAL
|
77
|
+
end
|
78
|
+
taoutrt = TextArea.new nil do
|
79
|
+
name "myTextArea-outrt"
|
80
|
+
#row 0
|
81
|
+
#col 0
|
82
|
+
width w # this is ofcourse large, full width
|
83
|
+
#height (ht/2)-1
|
84
|
+
height ht
|
85
|
+
title "README.md"
|
86
|
+
title_attrib 'bold'
|
87
|
+
print_footer true
|
88
|
+
footer_attrib 'bold'
|
89
|
+
end
|
90
|
+
# taoutrt.show_caret=true
|
91
|
+
|
92
|
+
tvleft1 = TextView.new nil do
|
93
|
+
name "myviewleft1"
|
94
|
+
#row 0
|
95
|
+
#col 0
|
96
|
+
#width w-2
|
97
|
+
height ht
|
98
|
+
#height (ht/2)-1
|
99
|
+
width w/2-1
|
100
|
+
title "README.md"
|
101
|
+
title_attrib 'bold'
|
102
|
+
print_footer true
|
103
|
+
footer_attrib 'bold'
|
104
|
+
end
|
105
|
+
tvleft1.show_caret=true
|
106
|
+
content = File.open("../README.markdown","r").readlines
|
107
|
+
tvleft1.set_content content #, :WRAP_WORD
|
108
|
+
|
109
|
+
# to see lower border i need to set height to ht/2 -2 in both cases, but that
|
110
|
+
# crashes ruby when i reduce height by 1.
|
111
|
+
tvleft2 = TextView.new nil do
|
112
|
+
name "myviewleft2"
|
113
|
+
#row 0
|
114
|
+
#col 0
|
115
|
+
width w/2-1
|
116
|
+
#height ht
|
117
|
+
height (ht/2)-1
|
118
|
+
title "NOTES"
|
119
|
+
title_attrib 'bold'
|
120
|
+
print_footer true
|
121
|
+
footer_attrib 'bold'
|
122
|
+
end
|
123
|
+
tvleft2.show_caret=true
|
124
|
+
content = File.open("../NOTES","r").readlines
|
125
|
+
tvleft2.set_content content #, :WRAP_WORD
|
126
|
+
|
127
|
+
leftscroll1 = ScrollPane.new nil do
|
128
|
+
name "myScrollLeftTop"
|
129
|
+
end
|
130
|
+
leftscroll2 = ScrollPane.new nil do
|
131
|
+
name "myScrollLeftBot"
|
132
|
+
end
|
133
|
+
scroutrt = ScrollPane.new nil do
|
134
|
+
name "myScroll3-outer-right"
|
135
|
+
#width 46
|
136
|
+
end
|
137
|
+
leftscroll1.cascade_changes = true
|
138
|
+
leftscroll2.cascade_changes = true
|
139
|
+
#leftscroll1.preferred_width w/2 #/2 ## should pertain more to horizontal orientation
|
140
|
+
leftscroll1.preferred_height((ht/2)-4) ## this messes things up when we change orientation
|
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(scroutrt)
|
145
|
+
#leftscroll2.preferred_height ht/2-2
|
146
|
+
scroutrt.child(taoutrt)
|
147
|
+
splitleft.first_component(leftscroll1)
|
148
|
+
leftscroll1.child(tvleft1)
|
149
|
+
splitleft.second_component(leftscroll2)
|
150
|
+
leftscroll2.child(tvleft2)
|
151
|
+
#tvleft1.preferred_width w/2 #/2 ## should pertain more to horizontal orientation
|
152
|
+
#tvleft1.preferred_height (ht/2)-1 ## this messes things up when we change orientation
|
153
|
+
#tvleft1.set_resize_weight 0.50
|
154
|
+
ret = splitleft.reset_to_preferred_sizes
|
155
|
+
splitleft.set_resize_weight(0.50) if ret == :ERROR
|
156
|
+
|
157
|
+
splitleft.preferred_width w/2 #w/3
|
158
|
+
splitleft.preferred_height ht/2-2
|
159
|
+
#splitleft.set_resize_weight 0.50
|
160
|
+
#taoutrt.min_width 10
|
161
|
+
#taoutrt.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
|
+
taoutrt << 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
|
@@ -0,0 +1,237 @@
|
|
1
|
+
#$LOAD_PATH << "/Users/rahul/work/projects/rbcurse/"
|
2
|
+
#*******************************************************#
|
3
|
+
# testsplit3b.rb #
|
4
|
+
# written by Rahul Kumar #
|
5
|
+
# January 17, 2010 #
|
6
|
+
# #
|
7
|
+
# Test textview, split and textarea inside splitpane #
|
8
|
+
# This wraps a textview inside a scrollpane, and #
|
9
|
+
# puts the SCRP inside a SPLP #
|
10
|
+
# Adds a listbox to the menagerie of objects. #
|
11
|
+
#
|
12
|
+
# /----+---------------\
|
13
|
+
# | V| V|
|
14
|
+
# | 1 V| V|
|
15
|
+
# | >>V| V|
|
16
|
+
# +----+ 3 V|
|
17
|
+
# | V| V|
|
18
|
+
# | 2 V| V|
|
19
|
+
# |>>>V|>>>>>> |
|
20
|
+
# \----+---------------/
|
21
|
+
#
|
22
|
+
#
|
23
|
+
#
|
24
|
+
# Released under ruby license. See #
|
25
|
+
# http://www.ruby-lang.org/en/LICENSE.txt #
|
26
|
+
# Copyright 2010, Rahul Kumar #
|
27
|
+
#*******************************************************#
|
28
|
+
require 'rubygems'
|
29
|
+
#require 'ncurses' # FFI
|
30
|
+
require 'logger'
|
31
|
+
require 'rbcurse'
|
32
|
+
require 'rbcurse/rsplitpane'
|
33
|
+
require 'rbcurse/rscrollpane'
|
34
|
+
require 'rbcurse/core/widgets/rtextarea'
|
35
|
+
require 'rbcurse/core/widgets/rtextview'
|
36
|
+
require 'rbcurse/extras/widgets/rlistbox'
|
37
|
+
if $0 == __FILE__
|
38
|
+
include RubyCurses
|
39
|
+
include RubyCurses::Utils
|
40
|
+
|
41
|
+
begin
|
42
|
+
# Initialize curses
|
43
|
+
VER::start_ncurses # this is initializing colors via ColorMap.setup
|
44
|
+
$log = Logger.new((File.join(ENV["LOGDIR"] || "./" ,"rbc13.log")))
|
45
|
+
$log.level = Logger::DEBUG
|
46
|
+
show_caret_flag = false #true
|
47
|
+
|
48
|
+
@window = VER::Window.root_window
|
49
|
+
|
50
|
+
catch(:close) do
|
51
|
+
colors = Ncurses.COLORS
|
52
|
+
@form = Form.new @window
|
53
|
+
$log.debug " MAIN FORM #{@form} "
|
54
|
+
r = 1; c = 3; ht = 18; w = 70
|
55
|
+
r = 3; c = 7; ht = 24; w = 100
|
56
|
+
|
57
|
+
|
58
|
+
@help = "F1 to quit. To resize split: M-, M+, M=. TAB, M-w, M-n, M-p, M-l, M-h, C-n/p : #{$0}"
|
59
|
+
RubyCurses::Label.new @form, {'text' => @help, "row" => ht+r, "col" => 2, "color" => "yellow"}
|
60
|
+
|
61
|
+
outer = SplitPane.new @form do
|
62
|
+
name "mainpane"
|
63
|
+
row r
|
64
|
+
col c
|
65
|
+
width w
|
66
|
+
height ht
|
67
|
+
orientation :VERTICAL_SPLIT
|
68
|
+
end
|
69
|
+
# note that splitleft has no form. so focus has to be managed XXX
|
70
|
+
splitleft = SplitPane.new nil do
|
71
|
+
name "splitleft"
|
72
|
+
|
73
|
+
#width w/3 # 30
|
74
|
+
#height ht-0 #/2-1
|
75
|
+
|
76
|
+
orientation :HORIZONTAL_SPLIT
|
77
|
+
border_color $promptcolor
|
78
|
+
border_attrib Ncurses::A_NORMAL
|
79
|
+
end
|
80
|
+
ta1 = TextArea.new nil do
|
81
|
+
name "myTextArea"
|
82
|
+
#row 0
|
83
|
+
#col 0
|
84
|
+
width w # this is ofcourse large, full width
|
85
|
+
#height (ht/2)-1
|
86
|
+
height ht
|
87
|
+
title "README.md"
|
88
|
+
title_attrib 'bold'
|
89
|
+
print_footer true
|
90
|
+
footer_attrib 'bold'
|
91
|
+
end
|
92
|
+
ta1.show_caret = show_caret_flag
|
93
|
+
|
94
|
+
t1 = TextView.new nil do
|
95
|
+
name "myView"
|
96
|
+
#row 0
|
97
|
+
#col 0
|
98
|
+
#width w-2
|
99
|
+
height ht
|
100
|
+
#height (ht/2)-1
|
101
|
+
width w/2-1
|
102
|
+
title "README.md"
|
103
|
+
title_attrib 'bold'
|
104
|
+
print_footer true
|
105
|
+
footer_attrib 'bold'
|
106
|
+
end
|
107
|
+
t1.show_caret = show_caret_flag
|
108
|
+
content = File.open("../README.markdown","r").readlines
|
109
|
+
t1.set_content content #, :WRAP_WORD
|
110
|
+
|
111
|
+
mylist = []
|
112
|
+
0.upto(50) { |v| mylist << "#{v} scrollable data" }
|
113
|
+
$listdata = Variable.new mylist
|
114
|
+
listb = Listbox.new nil do
|
115
|
+
name "mylist"
|
116
|
+
row 0
|
117
|
+
col 0
|
118
|
+
width w/2
|
119
|
+
height ht/2+5
|
120
|
+
list_variable $listdata
|
121
|
+
#selection_mode :SINGLE
|
122
|
+
show_selector true
|
123
|
+
row_selected_symbol "[X] "
|
124
|
+
row_unselected_symbol "[ ] "
|
125
|
+
title "A long list"
|
126
|
+
title_attrib 'reverse'
|
127
|
+
cell_editing_allowed true
|
128
|
+
end
|
129
|
+
## The next 2 are not advised since they don't trigger events
|
130
|
+
#listb.insert 55, "hello ruby", "so long python", "farewell java", "RIP .Net"
|
131
|
+
#$listdata.value.insert 55, "hello ruby", "so long python", "farewell java", "RIP .Net"
|
132
|
+
listb.list_data_model.insert 25, "hello ruby", "so long python", "farewell java", "RIP .Net", "hi lisp", "hi cloJure", "git Go"
|
133
|
+
# to see lower border i need to set height to ht/2 -2 in both cases, but that
|
134
|
+
# crashes ruby when i reduce height by 1.
|
135
|
+
#t2 = TextView.new nil do
|
136
|
+
#name "myView2"
|
137
|
+
##row 0
|
138
|
+
##col 0
|
139
|
+
#width w/2-1
|
140
|
+
##height ht
|
141
|
+
#height (ht/2)-1
|
142
|
+
#title "NOTES"
|
143
|
+
#title_attrib 'bold'
|
144
|
+
#print_footer true
|
145
|
+
#footer_attrib 'bold'
|
146
|
+
#end
|
147
|
+
#content = File.open("../NOTES","r").readlines
|
148
|
+
#t2.set_content content #, :WRAP_WORD
|
149
|
+
|
150
|
+
scroll1 = ScrollPane.new nil do
|
151
|
+
name "myScroll1"
|
152
|
+
end
|
153
|
+
scroll2 = ScrollPane.new nil do
|
154
|
+
name "myScroll2"
|
155
|
+
end
|
156
|
+
scroll3 = ScrollPane.new nil do
|
157
|
+
name "myScroll3"
|
158
|
+
#width 46
|
159
|
+
end
|
160
|
+
#scroll1.preferred_width w/2 #/2 ## should pertain more to horizontal orientation
|
161
|
+
scroll1.preferred_height ht/2-4 ## this messes things up when we change orientation
|
162
|
+
# the outer compo needs child set first else cursor does not reach up from
|
163
|
+
# lower levels. Is the connection broken ?
|
164
|
+
outer.first_component(splitleft)
|
165
|
+
outer.second_component(scroll3)
|
166
|
+
#scroll2.preferred_height ht/2-2
|
167
|
+
scroll3.child(ta1)
|
168
|
+
splitleft.first_component(scroll1)
|
169
|
+
scroll1.child(t1)
|
170
|
+
splitleft.second_component(scroll2)
|
171
|
+
scroll2.child(listb)
|
172
|
+
#scroll2.cascade_changes = true
|
173
|
+
#t1.preferred_width w/2 #/2 ## should pertain more to horizontal orientation
|
174
|
+
#t1.preferred_height (ht/2)-1 ## this messes things up when we change orientation
|
175
|
+
#t1.set_resize_weight 0.50
|
176
|
+
ret = splitleft.reset_to_preferred_sizes
|
177
|
+
splitleft.set_resize_weight(0.50) if ret == :ERROR
|
178
|
+
|
179
|
+
splitleft.preferred_width w/2 #w/3
|
180
|
+
splitleft.preferred_height ht/2-2
|
181
|
+
#splitleft.set_resize_weight 0.50
|
182
|
+
#ta1.min_width 10
|
183
|
+
#ta1.min_height 5
|
184
|
+
#splitleft.min_width 12
|
185
|
+
#splitleft.min_height 6
|
186
|
+
ret = outer.reset_to_preferred_sizes
|
187
|
+
outer.set_resize_weight(0.50) if ret == :ERROR
|
188
|
+
|
189
|
+
File.open("../README.markdown","r") do |file|
|
190
|
+
while (line = file.gets)
|
191
|
+
ta1 << line.chomp
|
192
|
+
end
|
193
|
+
end
|
194
|
+
|
195
|
+
@form.repaint
|
196
|
+
@window.wrefresh
|
197
|
+
Ncurses::Panel.update_panels
|
198
|
+
while((ch = @window.getchar()) != KEY_F1 )
|
199
|
+
str = keycode_tos ch
|
200
|
+
case ch
|
201
|
+
#when ?v.getbyte(0)
|
202
|
+
#$log.debug " ORIENTATION VERTICAL"
|
203
|
+
#outer.orientation(:VERTICAL_SPLIT)
|
204
|
+
#outer.reset_to_preferred_sizes
|
205
|
+
#when ?h.getbyte(0)
|
206
|
+
#$log.debug " ORIENTATION HORIZ"
|
207
|
+
#outer.orientation(:HORIZONTAL_SPLIT)
|
208
|
+
#outer.reset_to_preferred_sizes
|
209
|
+
when ?-.getbyte(0)
|
210
|
+
$log.debug " KEY PRESS -"
|
211
|
+
outer.set_divider_location(outer.divider_location-1)
|
212
|
+
when ?+.getbyte(0)
|
213
|
+
$log.debug " KEY PRESS +"
|
214
|
+
outer.set_divider_location(outer.divider_location+1)
|
215
|
+
when ?=.getbyte(0)
|
216
|
+
$log.debug " KEY PRESS ="
|
217
|
+
outer.set_resize_weight(0.50)
|
218
|
+
end
|
219
|
+
#outer.get_buffer().wclear
|
220
|
+
#outer << "#{ch} got (#{str})"
|
221
|
+
# outer.repaint
|
222
|
+
# outer.buffer_to_screen
|
223
|
+
@form.repaint
|
224
|
+
@form.handle_key(ch)
|
225
|
+
@window.wrefresh
|
226
|
+
end
|
227
|
+
end
|
228
|
+
rescue => ex
|
229
|
+
ensure
|
230
|
+
@window.destroy if !@window.nil?
|
231
|
+
VER::stop_ncurses
|
232
|
+
p ex if ex
|
233
|
+
p(ex.backtrace.join("\n")) if ex
|
234
|
+
$log.debug( ex) if ex
|
235
|
+
$log.debug(ex.backtrace.join("\n")) if ex
|
236
|
+
end
|
237
|
+
end
|