rbcurse 1.4.1 → 1.5.0.pre1
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG +31 -0
- data/README.markdown +69 -11
- data/VERSION +1 -1
- data/lib/rbcurse.rb +5 -5
- metadata +10 -198
- data/Makefile +0 -21
- data/Manifest.txt +0 -91
- data/TODO +0 -372
- data/TODO2.txt +0 -118
- data/examples/README.txt +0 -67
- data/examples/abasiclist.rb +0 -33
- data/examples/alpmenu.rb +0 -42
- data/examples/app.rb +0 -859
- data/examples/app.sample +0 -10
- data/examples/appdirtree.rb +0 -75
- data/examples/appemail.rb +0 -191
- data/examples/appemaillb.rb +0 -308
- data/examples/appgcompose.rb +0 -315
- data/examples/atree.rb +0 -64
- data/examples/common/file.rb +0 -40
- data/examples/common/rmail.rb +0 -257
- data/examples/data.txt +0 -683
- data/examples/data/README.markdown +0 -9
- data/examples/data/brew.txt +0 -38
- data/examples/data/color.2 +0 -37
- data/examples/data/gemlist.txt +0 -60
- data/examples/data/lotr.txt +0 -12
- data/examples/data/ports.txt +0 -136
- data/examples/data/tasks.txt +0 -27
- data/examples/data/todocsv.csv +0 -28
- data/examples/data/unix1.txt +0 -21
- data/examples/data/unix2.txt +0 -11
- data/examples/dbdemo.rb +0 -495
- data/examples/deprecated/appgmail.rb +0 -952
- data/examples/deprecated/splitp.rb +0 -56
- data/examples/deprecated/testscrolllb.rb +0 -86
- data/examples/deprecated/testscrollp.rb +0 -88
- data/examples/deprecated/testscrollta.rb +0 -80
- data/examples/deprecated/testscrolltable.rb +0 -165
- data/examples/deprecated/testsplit.rb +0 -87
- data/examples/deprecated/testsplit2.rb +0 -123
- data/examples/deprecated/testsplit3.rb +0 -215
- data/examples/deprecated/testsplit3_1.rb +0 -244
- data/examples/deprecated/testsplit3a.rb +0 -215
- data/examples/deprecated/testsplit3b.rb +0 -237
- data/examples/deprecated/testsplitta.rb +0 -148
- data/examples/deprecated/testsplittv.rb +0 -142
- data/examples/deprecated/testsplittvv.rb +0 -144
- data/examples/deprecated/testtpane.rb +0 -215
- data/examples/deprecated/testtpane2.rb +0 -145
- data/examples/deprecated/testtpanetable.rb +0 -203
- data/examples/dirtree.rb +0 -88
- data/examples/experimental/resultsetdemo.rb +0 -280
- data/examples/experimental/testmform.rb +0 -35
- data/examples/experimental/testscroller.rb +0 -117
- data/examples/experimental/teststackflow.rb +0 -111
- data/examples/menu1.rb +0 -112
- data/examples/multispl.rb +0 -86
- data/examples/newmessagebox.rb +0 -130
- data/examples/newtabbedwindow.rb +0 -100
- data/examples/newtesttabp.rb +0 -121
- data/examples/qdfilechooser.rb +0 -68
- data/examples/rfe.rb +0 -1195
- data/examples/rfe_renderer.rb +0 -121
- data/examples/sqlc.rb +0 -454
- data/examples/sqlm.rb +0 -437
- data/examples/sqlt.rb +0 -408
- data/examples/status.txt +0 -68
- data/examples/table1.rb +0 -24
- data/examples/term2.rb +0 -84
- data/examples/test1.rb +0 -239
- data/examples/test2.rb +0 -674
- data/examples/testapp.rb +0 -44
- data/examples/testapp2.rb +0 -58
- data/examples/testchars.rb +0 -137
- data/examples/testcombo.rb +0 -91
- data/examples/testkeypress.rb +0 -66
- data/examples/testlistbox.rb +0 -113
- data/examples/testmenu.rb +0 -101
- data/examples/testmulticomp.rb +0 -70
- data/examples/testmulticontainer.rb +0 -94
- data/examples/testmultispl.rb +0 -199
- data/examples/testree.rb +0 -106
- data/examples/testtable.rb +0 -263
- data/examples/testtabp.rb +0 -107
- data/examples/testtodo.rb +0 -584
- data/examples/testvimsplit.rb +0 -112
- data/examples/testwsshortcuts.rb +0 -64
- data/examples/testwsshortcuts2.rb +0 -126
- data/examples/todo.db +0 -0
- data/examples/todo.yml +0 -191
- data/examples/viewtodo.rb +0 -574
- data/lib/rbcurse/action.rb +0 -40
- data/lib/rbcurse/app.rb +0 -1374
- data/lib/rbcurse/applicationheader.rb +0 -102
- data/lib/rbcurse/celleditor.rb +0 -112
- data/lib/rbcurse/checkboxcellrenderer.rb +0 -57
- data/lib/rbcurse/colormap.rb +0 -159
- data/lib/rbcurse/comboboxcellrenderer.rb +0 -30
- data/lib/rbcurse/common/ansiparser.rb +0 -117
- data/lib/rbcurse/common/appmethods.rb +0 -112
- data/lib/rbcurse/common/basestack.rb +0 -407
- data/lib/rbcurse/common/bordertitle.rb +0 -41
- data/lib/rbcurse/common/chunk.rb +0 -177
- data/lib/rbcurse/common/colorparser.rb +0 -71
- data/lib/rbcurse/common/keydefs.rb +0 -30
- data/lib/rbcurse/common/widgetshortcuts.rb +0 -302
- data/lib/rbcurse/defaultlistselectionmodel.rb +0 -79
- data/lib/rbcurse/deprecated/README.markdown +0 -12
- data/lib/rbcurse/deprecated/rscrollpane.rb +0 -512
- data/lib/rbcurse/deprecated/rsplitpane.rb +0 -894
- data/lib/rbcurse/deprecated/rsplitpane2.rb +0 -1009
- data/lib/rbcurse/deprecated/rviewport.rb +0 -204
- data/lib/rbcurse/experimental/README.markdown +0 -14
- data/lib/rbcurse/experimental/resultsettextview.rb +0 -585
- data/lib/rbcurse/experimental/stackflow.rb +0 -478
- data/lib/rbcurse/extras/bottomline.rb +0 -1850
- data/lib/rbcurse/extras/box.rb +0 -58
- data/lib/rbcurse/extras/directorylist.rb +0 -467
- data/lib/rbcurse/extras/directorytree.rb +0 -69
- data/lib/rbcurse/extras/divider.rb +0 -310
- data/lib/rbcurse/extras/focusmanager.rb +0 -31
- data/lib/rbcurse/extras/horizlist.rb +0 -203
- data/lib/rbcurse/extras/listselectable.rb +0 -264
- data/lib/rbcurse/extras/masterdetail.rb +0 -166
- data/lib/rbcurse/extras/menutree.rb +0 -63
- data/lib/rbcurse/extras/multiform.rb +0 -330
- data/lib/rbcurse/extras/multilinelabel.rb +0 -142
- data/lib/rbcurse/extras/newmessagebox.rb +0 -328
- data/lib/rbcurse/extras/newtabbedpane.rb +0 -612
- data/lib/rbcurse/extras/newtabbedwindow.rb +0 -68
- data/lib/rbcurse/extras/padreader.rb +0 -189
- data/lib/rbcurse/extras/rcomboedit.rb +0 -256
- data/lib/rbcurse/extras/resultsetbrowser.rb +0 -281
- data/lib/rbcurse/extras/rlink.rb +0 -27
- data/lib/rbcurse/extras/rmenulink.rb +0 -21
- data/lib/rbcurse/extras/scrollbar.rb +0 -143
- data/lib/rbcurse/extras/statusline.rb +0 -94
- data/lib/rbcurse/extras/stdscrwindow.rb +0 -309
- data/lib/rbcurse/extras/tableextended.rb +0 -40
- data/lib/rbcurse/extras/tabular.rb +0 -264
- data/lib/rbcurse/extras/tabularwidget.rb +0 -1150
- data/lib/rbcurse/extras/textpad.rb +0 -516
- data/lib/rbcurse/extras/viewer.rb +0 -136
- data/lib/rbcurse/io.rb +0 -850
- data/lib/rbcurse/keylabelprinter.rb +0 -178
- data/lib/rbcurse/listcellrenderer.rb +0 -140
- data/lib/rbcurse/listeditable.rb +0 -310
- data/lib/rbcurse/listkeys.rb +0 -37
- data/lib/rbcurse/listscrollable.rb +0 -564
- data/lib/rbcurse/listselectable.rb +0 -142
- data/lib/rbcurse/mapper.rb +0 -130
- data/lib/rbcurse/orderedhash.rb +0 -77
- data/lib/rbcurse/ractionevent.rb +0 -67
- data/lib/rbcurse/rbasiclistbox.rb +0 -768
- data/lib/rbcurse/rchangeevent.rb +0 -27
- data/lib/rbcurse/rcombo.rb +0 -238
- data/lib/rbcurse/rcommandwindow.rb +0 -587
- data/lib/rbcurse/rcontainer.rb +0 -415
- data/lib/rbcurse/rdialogs.rb +0 -451
- data/lib/rbcurse/rinputdataevent.rb +0 -47
- data/lib/rbcurse/rlistbox.rb +0 -1196
- data/lib/rbcurse/rmenu.rb +0 -939
- data/lib/rbcurse/rmessagebox.rb +0 -348
- data/lib/rbcurse/rmulticontainer.rb +0 -304
- data/lib/rbcurse/rmultisplit.rb +0 -722
- data/lib/rbcurse/rmultitextview.rb +0 -306
- data/lib/rbcurse/rpopupmenu.rb +0 -755
- data/lib/rbcurse/rprogress.rb +0 -118
- data/lib/rbcurse/rscrollform.rb +0 -418
- data/lib/rbcurse/rtabbedpane.rb +0 -1158
- data/lib/rbcurse/rtabbedwindow.rb +0 -167
- data/lib/rbcurse/rtable.rb +0 -1718
- data/lib/rbcurse/rtextarea.rb +0 -920
- data/lib/rbcurse/rtextview.rb +0 -761
- data/lib/rbcurse/rtree.rb +0 -780
- data/lib/rbcurse/rvimsplit.rb +0 -763
- data/lib/rbcurse/rwidget.rb +0 -2915
- data/lib/rbcurse/scrollable.rb +0 -301
- data/lib/rbcurse/table/tablecellrenderer.rb +0 -86
- data/lib/rbcurse/table/tabledatecellrenderer.rb +0 -98
- data/lib/rbcurse/tree/treecellrenderer.rb +0 -150
- data/lib/rbcurse/tree/treemodel.rb +0 -428
- data/lib/rbcurse/undomanager.rb +0 -188
- data/lib/rbcurse/vieditable.rb +0 -144
- data/lib/ver/keyboard.rb +0 -150
- data/lib/ver/keyboard2.rb +0 -170
- data/lib/ver/ncurses.rb +0 -218
- data/lib/ver/panel.rb +0 -162
- data/lib/ver/rpad.rb +0 -375
- data/lib/ver/window.rb +0 -882
- data/test/test_rbcurse.rb +0 -0
data/examples/testmenu.rb
DELETED
@@ -1,101 +0,0 @@
|
|
1
|
-
require 'logger'
|
2
|
-
require 'rbcurse'
|
3
|
-
#require 'lib/rbcurse/rform'
|
4
|
-
require 'rbcurse/rpopupmenu'
|
5
|
-
if $0 == __FILE__
|
6
|
-
include RubyCurses
|
7
|
-
|
8
|
-
begin
|
9
|
-
# Initialize curses
|
10
|
-
VER::start_ncurses # this is initializing colors via ColorMap.setup
|
11
|
-
$log = Logger.new((File.join(ENV["LOGDIR"] || "./" ,"rbc13.log")))
|
12
|
-
$log.level = Logger::DEBUG
|
13
|
-
|
14
|
-
@window = VER::Window.root_window
|
15
|
-
# Initialize few color pairs
|
16
|
-
# Create the window to be associated with the form
|
17
|
-
# Un post form and free the memory
|
18
|
-
|
19
|
-
catch(:close) do
|
20
|
-
colors = Ncurses.COLORS
|
21
|
-
$log.debug "START #{colors} colors #{$datacolor} ---------"
|
22
|
-
@form = Form.new @window
|
23
|
-
@form.window.printstring 0, 25, "Demo of Ruby Curses PopupMenu", $normalcolor, 'reverse'
|
24
|
-
r = 1; fc = 12;
|
25
|
-
row = 10; col = 10
|
26
|
-
colorlabel = Label.new @form, {'text' => "A label:", "row" => row, "col" => col, "color"=>"cyan", "mnemonic" => 'A'}
|
27
|
-
|
28
|
-
#@mb = RubyCurses::MenuBar.new
|
29
|
-
#filemenu = RubyCurses::Menu.new "File"
|
30
|
-
filemenu = RubyCurses::PopupMenu.new "File"
|
31
|
-
filemenu.add(item = RubyCurses::PMenuItem.new("Open",'O'))
|
32
|
-
|
33
|
-
filemenu.insert_separator 1
|
34
|
-
filemenu.add(RubyCurses::PMenuItem.new "New",'N')
|
35
|
-
filemenu.add(item = RubyCurses::PMenuItem.new("Save",'S'))
|
36
|
-
filemenu.add(item = RubyCurses::PMenuItem.new("Test",'T'))
|
37
|
-
filemenu.add(item = RubyCurses::PMenuItem.new("Wrap Text",'W'))
|
38
|
-
filemenu.add(item = RubyCurses::PMenuItem.new("Exit",'X'))
|
39
|
-
item.command() {
|
40
|
-
#throw(:menubarclose);
|
41
|
-
throw(:close)
|
42
|
-
}
|
43
|
-
item = RubyCurses::PCheckBoxMenuItem.new "Reverse"
|
44
|
-
#filemenu.create_window
|
45
|
-
# item.onvalue="On"
|
46
|
-
# item.offvalue="Off"
|
47
|
-
#item.checkbox.text "Labelcb"
|
48
|
-
#item.text="Labelcb"
|
49
|
-
# in next line, an explicit repaint is required since label is on another form.
|
50
|
-
#item.command(colorlabel){|it, label| att = it.getvalue ? 'reverse' : nil; label.attr(att); label.repaint}
|
51
|
-
|
52
|
-
|
53
|
-
filemenu.add(item)
|
54
|
-
#@mb.add(filemenu)
|
55
|
-
editmenu = RubyCurses::PMenu.new "Edit"
|
56
|
-
item = RubyCurses::PMenuItem.new "Cut"
|
57
|
-
editmenu.add(item)
|
58
|
-
item.accelerator = "Ctrl-X"
|
59
|
-
item=RubyCurses::PMenuItem.new "Copy"
|
60
|
-
editmenu.add(item)
|
61
|
-
item.accelerator = "Ctrl-C"
|
62
|
-
item=RubyCurses::PMenuItem.new "Paste"
|
63
|
-
editmenu.add(item)
|
64
|
-
item.accelerator = "Ctrl-V"
|
65
|
-
#@mb.add(editmenu)
|
66
|
-
#@mb.add(
|
67
|
-
menu=RubyCurses::PMenu.new("Others")
|
68
|
-
filemenu.add(menu)
|
69
|
-
#item=RubyCurses::PMenuItem.new "Save","S"
|
70
|
-
item = RubyCurses::PMenuItem.new "Config"
|
71
|
-
menu.add(item)
|
72
|
-
item = RubyCurses::PMenuItem.new "Tables"
|
73
|
-
menu.add(item)
|
74
|
-
savemenu = RubyCurses::PMenu.new "EditM"
|
75
|
-
item = RubyCurses::PMenuItem.new "CutM"
|
76
|
-
savemenu.add(item)
|
77
|
-
item = RubyCurses::PMenuItem.new "DeleteM"
|
78
|
-
savemenu.add(item)
|
79
|
-
item = RubyCurses::PMenuItem.new "PasteM"
|
80
|
-
savemenu.add(item)
|
81
|
-
menu.add(savemenu)
|
82
|
-
# 2008-12-20 13:06 no longer hardcoding toggle key of menu_bar.
|
83
|
-
#@mb.toggle_key = KEY_F2
|
84
|
-
#@form.set_menu_bar @mb
|
85
|
-
#@cell = CellRenderer.new "Hello", {"col" => 1, "row"=>29, "justify"=>:right, "display_length" => 30}
|
86
|
-
# END
|
87
|
-
@form.repaint
|
88
|
-
filemenu.show colorlabel, 0,1
|
89
|
-
@window.wrefresh
|
90
|
-
Ncurses::Panel.update_panels
|
91
|
-
end
|
92
|
-
rescue => ex
|
93
|
-
ensure
|
94
|
-
@window.destroy if !@window.nil?
|
95
|
-
VER::stop_ncurses
|
96
|
-
p ex if ex
|
97
|
-
p(ex.backtrace.join("\n")) if ex
|
98
|
-
$log.debug( ex) if ex
|
99
|
-
$log.debug(ex.backtrace.join("\n")) if ex
|
100
|
-
end
|
101
|
-
end
|
data/examples/testmulticomp.rb
DELETED
@@ -1,70 +0,0 @@
|
|
1
|
-
require 'logger'
|
2
|
-
require 'rbcurse'
|
3
|
-
require 'rbcurse/rmulticontainer'
|
4
|
-
require 'rbcurse/rtextarea'
|
5
|
-
if $0 == __FILE__
|
6
|
-
include RubyCurses
|
7
|
-
include RubyCurses::Utils
|
8
|
-
|
9
|
-
begin
|
10
|
-
# Initialize curses
|
11
|
-
VER::start_ncurses # this is initializing colors via ColorMap.setup
|
12
|
-
$log = Logger.new((File.join(ENV["LOGDIR"] || "./" ,"rbc13.log")))
|
13
|
-
$log.level = Logger::DEBUG
|
14
|
-
|
15
|
-
@window = VER::Window.root_window
|
16
|
-
|
17
|
-
catch(:close) do
|
18
|
-
colors = Ncurses.COLORS
|
19
|
-
$log.debug "START #{colors} colors --------- testmulticomp"
|
20
|
-
@form = Form.new @window
|
21
|
-
@ctr = 1
|
22
|
-
r = 1; c = 30;
|
23
|
-
|
24
|
-
mc = MultiContainer.new @form do
|
25
|
-
name "multic"
|
26
|
-
row r
|
27
|
-
col c
|
28
|
-
width 60
|
29
|
-
height 15
|
30
|
-
title "Multiconty"
|
31
|
-
end
|
32
|
-
ctr = 1
|
33
|
-
|
34
|
-
@form.bind_key(?\M-a) do
|
35
|
-
$log.debug " Inside M-a MULTI "
|
36
|
-
texta = TextArea.new do
|
37
|
-
name "mytext#{ctr}"
|
38
|
-
title "Enter Something-#{ctr}"
|
39
|
-
title_attrib (Ncurses::A_REVERSE | Ncurses::A_BOLD)
|
40
|
-
end
|
41
|
-
mc.add texta, "Enter Something #{ctr}"
|
42
|
-
texta << "Hello World"
|
43
|
-
texta << "Hello World"
|
44
|
-
ctr += 1
|
45
|
-
end
|
46
|
-
@help = "F10 to quit. M-a to open new component. M-: for menu #{$0} "
|
47
|
-
RubyCurses::Label.new @form, {'text' => @help, "row" => 21, "col" => 2, "color" => "yellow"}
|
48
|
-
|
49
|
-
@form.repaint
|
50
|
-
@window.wrefresh
|
51
|
-
Ncurses::Panel.update_panels
|
52
|
-
while((ch = @window.getchar()) != KEY_F10 )
|
53
|
-
break if ch == ?\C-q.getbyte(0)
|
54
|
-
str = keycode_tos ch
|
55
|
-
$log.debug "#{ch} got (#{str})"
|
56
|
-
@form.handle_key ch
|
57
|
-
@form.repaint
|
58
|
-
@window.wrefresh
|
59
|
-
end
|
60
|
-
end
|
61
|
-
rescue => ex
|
62
|
-
ensure
|
63
|
-
@window.destroy if !@window.nil?
|
64
|
-
VER::stop_ncurses
|
65
|
-
p ex if ex
|
66
|
-
p(ex.backtrace.join("\n")) if ex
|
67
|
-
$log.debug( ex) if ex
|
68
|
-
$log.debug(ex.backtrace.join("\n")) if ex
|
69
|
-
end
|
70
|
-
end
|
@@ -1,94 +0,0 @@
|
|
1
|
-
##
|
2
|
-
# This tests both multicontainer and container
|
3
|
-
#
|
4
|
-
require 'logger'
|
5
|
-
require 'rbcurse'
|
6
|
-
require 'rbcurse/rmulticontainer'
|
7
|
-
require 'rbcurse/rcontainer'
|
8
|
-
require 'rbcurse/rtextarea'
|
9
|
-
if $0 == __FILE__
|
10
|
-
include RubyCurses
|
11
|
-
include RubyCurses::Utils
|
12
|
-
|
13
|
-
begin
|
14
|
-
# Initialize curses
|
15
|
-
VER::start_ncurses # this is initializing colors via ColorMap.setup
|
16
|
-
$log = Logger.new((File.join(ENV["LOGDIR"] || "./" ,"rbc13.log")))
|
17
|
-
$log.level = Logger::DEBUG
|
18
|
-
|
19
|
-
@window = VER::Window.root_window
|
20
|
-
|
21
|
-
catch(:close) do
|
22
|
-
colors = Ncurses.COLORS
|
23
|
-
$log.debug "START #{colors} colors --------- testmulticomp"
|
24
|
-
@form = Form.new @window
|
25
|
-
@ctr = 1
|
26
|
-
r = 1; c = 30;
|
27
|
-
|
28
|
-
mc = MultiContainer.new @form do
|
29
|
-
name "multic"
|
30
|
-
row r
|
31
|
-
col c
|
32
|
-
width 60
|
33
|
-
height 15
|
34
|
-
title "Multicontainer"
|
35
|
-
end
|
36
|
-
ctr = 1
|
37
|
-
|
38
|
-
c1 = Container.new
|
39
|
-
mc.add c1, "A form"
|
40
|
-
f1 = Field.new nil do
|
41
|
-
name "name"
|
42
|
-
text "rahul"
|
43
|
-
row 1
|
44
|
-
col 10
|
45
|
-
label " Name: "
|
46
|
-
end
|
47
|
-
f2 = Field.new nil, :name => "email", :text => "me@somebody.com", :label => "Email: "
|
48
|
-
c1.add( f1, f2)
|
49
|
-
|
50
|
-
c3 = TextArea.new
|
51
|
-
mc.add c3, "Edit Me"
|
52
|
-
c2 = Container.new
|
53
|
-
mc.add c2, "Another form"
|
54
|
-
attrib = 'underline'
|
55
|
-
f3 = Field.new do
|
56
|
-
name "language"
|
57
|
-
text "ruby"
|
58
|
-
row 1
|
59
|
-
col 10
|
60
|
-
label "Language: "
|
61
|
-
attr attrib
|
62
|
-
end
|
63
|
-
f4 = Field.new nil, :name => "version", :text => "1.9.2", :row => 2, :col => 10,
|
64
|
-
:label => " Version: ", :attr => attrib
|
65
|
-
c2.add( f3, f4)
|
66
|
-
|
67
|
-
@help = "F10 to quit. M-a to open new component. M-: for menu #{$0} "
|
68
|
-
RubyCurses::Label.new @form, {:text => @help, :row => last_line(), :col => 2,
|
69
|
-
:color => 'yellow', :bgcolor => 'red'}
|
70
|
-
f5 = Field.new @form, :name => "version2", :text => "1.9.2", :row => 20, :col => c, :bgcolor => 'blue',
|
71
|
-
:label => "Version: ", :label_color_pair => get_color($datacolor, 'green', 'black')
|
72
|
-
|
73
|
-
@form.repaint
|
74
|
-
@window.wrefresh
|
75
|
-
Ncurses::Panel.update_panels
|
76
|
-
while((ch = @window.getchar()) != KEY_F10 )
|
77
|
-
break if ch == ?\C-q.getbyte(0)
|
78
|
-
str = keycode_tos ch
|
79
|
-
$log.debug "#{ch} got (#{str})"
|
80
|
-
@form.handle_key ch
|
81
|
-
@form.repaint
|
82
|
-
@window.wrefresh
|
83
|
-
end
|
84
|
-
end
|
85
|
-
rescue => ex
|
86
|
-
ensure
|
87
|
-
@window.destroy if !@window.nil?
|
88
|
-
VER::stop_ncurses
|
89
|
-
p ex if ex
|
90
|
-
p(ex.backtrace.join("\n")) if ex
|
91
|
-
$log.debug( ex) if ex
|
92
|
-
$log.debug(ex.backtrace.join("\n")) if ex
|
93
|
-
end
|
94
|
-
end
|
data/examples/testmultispl.rb
DELETED
@@ -1,199 +0,0 @@
|
|
1
|
-
$LOAD_PATH << "/Users/rahul/work/projects/rbcurse/lib"
|
2
|
-
require 'rbcurse'
|
3
|
-
require 'rbcurse/rmultisplit'
|
4
|
-
require 'rbcurse/rlistbox'
|
5
|
-
require 'fileutils'
|
6
|
-
|
7
|
-
#
|
8
|
-
## this sample creates a multisplitpane with n objects
|
9
|
-
##+ and move divider around using - + and =.
|
10
|
-
# TODO:
|
11
|
-
# x Status bar below to reflect full path.
|
12
|
-
# - enter to gotonext component too, or at least make visible if not
|
13
|
-
# but now cursor is showing around everywhere
|
14
|
-
#
|
15
|
-
$counter = 0
|
16
|
-
|
17
|
-
# when displaying a filename, if directory prepend a slash.
|
18
|
-
def format list, fullname=nil
|
19
|
-
list.collect! {|e|
|
20
|
-
if fullname
|
21
|
-
f = File.join(fullname, e)
|
22
|
-
else
|
23
|
-
f = e
|
24
|
-
end
|
25
|
-
if File.directory? f
|
26
|
-
"/" + e
|
27
|
-
else
|
28
|
-
e
|
29
|
-
end
|
30
|
-
}
|
31
|
-
list
|
32
|
-
end
|
33
|
-
# @param [Listbox] new list to bind
|
34
|
-
# @param [Array] array of lists
|
35
|
-
# @param [MultiSplit] msp object to add a new list to
|
36
|
-
def bind_list(listb, lists, splitp)
|
37
|
-
#listb.bind(:ENTER_ROW, mylist) {|lb,list| row_cmd.call(lb,list) }
|
38
|
-
listb.bind(:PRESS) {
|
39
|
-
#@status_row.text = "Selected #{tablelist.get_content()[tablelist.current_index]}"
|
40
|
-
item = "#{listb.get_content()[listb.current_index]}"
|
41
|
-
fullname = File.join(listb.config[:path], item)
|
42
|
-
mylist = nil
|
43
|
-
if File.directory? fullname
|
44
|
-
$log.debug " DIRector is a item #{item} "
|
45
|
-
d = Dir.new(fullname)
|
46
|
-
mylist = d.entries
|
47
|
-
mylist.delete "."
|
48
|
-
mylist.delete ".."
|
49
|
-
format(mylist, fullname)
|
50
|
-
# NOTE that we create component with nil form as container will manage it
|
51
|
-
if lists.empty? || lists.last == listb
|
52
|
-
$counter += 1
|
53
|
-
listc = Listbox.new nil do
|
54
|
-
name "LIST#{$counter}"
|
55
|
-
list mylist
|
56
|
-
title item
|
57
|
-
title_attrib 'reverse'
|
58
|
-
end
|
59
|
-
listc.one_key_selection = false
|
60
|
-
listc.bind(:ENTER) {|l| l.title_attrib 'reverse'; }
|
61
|
-
listc.bind(:LEAVE) {|l| l.title_attrib 'normal'; }
|
62
|
-
# FIXME crashes if file nil
|
63
|
-
row_cmd = lambda {|lb, oldlist| list = lb.list(); file = list[lb.current_index]; file ||= "?"; $message.value = File.join(lb.config[:path], file); }
|
64
|
-
listc.bind(:ENTER_ROW, mylist) {|lb,list| row_cmd.call(lb,list) }
|
65
|
-
splitp.add listc
|
66
|
-
lists << listc
|
67
|
-
listb.config[:child] = listc
|
68
|
-
listc.config[:path] = File.join(listb.config[:path], item)
|
69
|
-
bind_list(listc, lists, splitp)
|
70
|
-
else
|
71
|
-
#l = lists.first
|
72
|
-
l = listb.config[:child]
|
73
|
-
l.list_data_model.remove_all
|
74
|
-
# if empty maybe we should remove it, but its just a demo
|
75
|
-
# what happens is, this comes up again when going through another
|
76
|
-
# directory. First go down rbcurse/lib/rbcurse/extras
|
77
|
-
# then go to examples which has a shallow structure.
|
78
|
-
l.list_data_model.insert 0, *mylist unless mylist.empty?
|
79
|
-
l.config[:path] = fullname
|
80
|
-
l.title = item
|
81
|
-
while true
|
82
|
-
n = l.config[:child]
|
83
|
-
break if n.nil?
|
84
|
-
n.list_data_model.remove_all
|
85
|
-
# TODO should be removed, so focus does not go to it
|
86
|
-
n.title = ""
|
87
|
-
l = n
|
88
|
-
end
|
89
|
-
$log.debug " MYLIST #{mylist} dir #{item} "
|
90
|
-
end
|
91
|
-
splitp.goto_next_component
|
92
|
-
end
|
93
|
-
}
|
94
|
-
end
|
95
|
-
if $0 == __FILE__
|
96
|
-
include RubyCurses
|
97
|
-
include RubyCurses::Utils
|
98
|
-
|
99
|
-
begin
|
100
|
-
# Initialize curses
|
101
|
-
VER::start_ncurses # this is initializing colors via ColorMap.setup
|
102
|
-
$log = Logger.new((File.join(ENV['LOGDIR'] || "./" ,"rbc13.log")))
|
103
|
-
|
104
|
-
$log.level = Logger::DEBUG
|
105
|
-
|
106
|
-
@window = VER::Window.root_window
|
107
|
-
|
108
|
-
catch(:close) do
|
109
|
-
@form = Form.new @window
|
110
|
-
r = 3; c = 7; ht = 18
|
111
|
-
#lastrow = ht+r+5 # 26
|
112
|
-
lastrow = Ncurses.LINES-1
|
113
|
-
|
114
|
-
|
115
|
-
help = "F1 to quit. #{$0} Press Enter on directory, TAB/BTAB to navigate. C-w+-= "
|
116
|
-
RubyCurses::Label.new @form, {:text => help, :row => lastrow, "col" => 2, "color" => "yellow" }
|
117
|
-
title = "Demo of Multi-SplitPane (Column Browse pattern)"
|
118
|
-
RubyCurses::Label.new @form, {:text => title, :row => 1, :col => c, :color => "white" }
|
119
|
-
|
120
|
-
|
121
|
-
splitp = MultiSplit.new @form do
|
122
|
-
name "mypane"
|
123
|
-
row r
|
124
|
-
col c
|
125
|
-
width 70
|
126
|
-
height ht
|
127
|
-
split_count 3
|
128
|
-
unlimited true
|
129
|
-
orientation :VERTICAL_SPLIT
|
130
|
-
max_visible 3
|
131
|
-
end
|
132
|
-
splitp.bind(:PROPERTY_CHANGE){|e| $message.value = e.to_s }
|
133
|
-
|
134
|
-
$message = Variable.new
|
135
|
-
$message.value = "Message Comes Here"
|
136
|
-
message_label = RubyCurses::Label.new @form, {'text_variable' => $message, "name"=>"message_label","row" => ht+r+2, "col" => 1, "display_length" => 80, "height" => 2, 'color' => 'cyan'}
|
137
|
-
$message.update_command() { message_label.repaint } # why ?
|
138
|
-
#message_label.row = splitp.row + splitp.height
|
139
|
-
#message_label.col = splitp.col
|
140
|
-
@form.place_below(message_label)
|
141
|
-
|
142
|
-
|
143
|
-
lists = []
|
144
|
-
FileUtils.cd("..")
|
145
|
-
mylist = Dir.glob('*')
|
146
|
-
mylist.delete_if {|x| x =~ /^\./ || x =~ /^_/ || x =~ /bak$/}
|
147
|
-
format(mylist)
|
148
|
-
# NOTE that we create component with nil form as container will manage it
|
149
|
-
listb = Listbox.new nil do
|
150
|
-
name "mainlist"
|
151
|
-
list mylist
|
152
|
-
title "A short list"
|
153
|
-
title_attrib 'reverse'
|
154
|
-
end
|
155
|
-
listb.config[:path] = Dir.getwd
|
156
|
-
listb.one_key_selection = false
|
157
|
-
splitp.add listb
|
158
|
-
row_cmd = lambda {|lb, list| file = list[lb.current_index]; $message.value = file; # File.stat("#{cur_dir()}/#{file}").inspect
|
159
|
-
}
|
160
|
-
listb.bind(:ENTER_ROW, mylist) {|lb,list| row_cmd.call(lb,list) }
|
161
|
-
listb.bind(:ENTER) {|l| l.title_attrib 'reverse'; }
|
162
|
-
listb.bind(:LEAVE) {|l| l.title_attrib 'normal'; }
|
163
|
-
bind_list(listb, lists, splitp)
|
164
|
-
|
165
|
-
# Dummy field just to see navigation from and to container
|
166
|
-
fname = "Search"
|
167
|
-
r, c = @form.next_position
|
168
|
-
c += fname.length + 1
|
169
|
-
field = Field.new @form do
|
170
|
-
name fname
|
171
|
-
row r
|
172
|
-
col c
|
173
|
-
display_length 30
|
174
|
-
bgcolor 'cyan'
|
175
|
-
#set_buffer "abcd "
|
176
|
-
set_label Label.new @form, {:text => fname, :color=>'white',:bgcolor=>'red', :mnemonic=> 's'}
|
177
|
-
end
|
178
|
-
|
179
|
-
@form.repaint
|
180
|
-
@window.wrefresh
|
181
|
-
Ncurses::Panel.update_panels
|
182
|
-
counter = 0
|
183
|
-
while((ch = @window.getchar()) != KEY_F1 )
|
184
|
-
str = keycode_tos ch
|
185
|
-
@form.handle_key(ch)
|
186
|
-
@window.wrefresh
|
187
|
-
end
|
188
|
-
end
|
189
|
-
rescue => ex
|
190
|
-
ensure
|
191
|
-
@window.destroy if !@window.nil?
|
192
|
-
VER::stop_ncurses
|
193
|
-
p ex if ex
|
194
|
-
puts(ex.backtrace.join("\n")) if ex
|
195
|
-
$log.debug( ex) if ex
|
196
|
-
$log.debug(ex.backtrace.join("\n")) if ex
|
197
|
-
end
|
198
|
-
end
|
199
|
-
|