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.
Files changed (192) hide show
  1. data/CHANGELOG +31 -0
  2. data/README.markdown +69 -11
  3. data/VERSION +1 -1
  4. data/lib/rbcurse.rb +5 -5
  5. metadata +10 -198
  6. data/Makefile +0 -21
  7. data/Manifest.txt +0 -91
  8. data/TODO +0 -372
  9. data/TODO2.txt +0 -118
  10. data/examples/README.txt +0 -67
  11. data/examples/abasiclist.rb +0 -33
  12. data/examples/alpmenu.rb +0 -42
  13. data/examples/app.rb +0 -859
  14. data/examples/app.sample +0 -10
  15. data/examples/appdirtree.rb +0 -75
  16. data/examples/appemail.rb +0 -191
  17. data/examples/appemaillb.rb +0 -308
  18. data/examples/appgcompose.rb +0 -315
  19. data/examples/atree.rb +0 -64
  20. data/examples/common/file.rb +0 -40
  21. data/examples/common/rmail.rb +0 -257
  22. data/examples/data.txt +0 -683
  23. data/examples/data/README.markdown +0 -9
  24. data/examples/data/brew.txt +0 -38
  25. data/examples/data/color.2 +0 -37
  26. data/examples/data/gemlist.txt +0 -60
  27. data/examples/data/lotr.txt +0 -12
  28. data/examples/data/ports.txt +0 -136
  29. data/examples/data/tasks.txt +0 -27
  30. data/examples/data/todocsv.csv +0 -28
  31. data/examples/data/unix1.txt +0 -21
  32. data/examples/data/unix2.txt +0 -11
  33. data/examples/dbdemo.rb +0 -495
  34. data/examples/deprecated/appgmail.rb +0 -952
  35. data/examples/deprecated/splitp.rb +0 -56
  36. data/examples/deprecated/testscrolllb.rb +0 -86
  37. data/examples/deprecated/testscrollp.rb +0 -88
  38. data/examples/deprecated/testscrollta.rb +0 -80
  39. data/examples/deprecated/testscrolltable.rb +0 -165
  40. data/examples/deprecated/testsplit.rb +0 -87
  41. data/examples/deprecated/testsplit2.rb +0 -123
  42. data/examples/deprecated/testsplit3.rb +0 -215
  43. data/examples/deprecated/testsplit3_1.rb +0 -244
  44. data/examples/deprecated/testsplit3a.rb +0 -215
  45. data/examples/deprecated/testsplit3b.rb +0 -237
  46. data/examples/deprecated/testsplitta.rb +0 -148
  47. data/examples/deprecated/testsplittv.rb +0 -142
  48. data/examples/deprecated/testsplittvv.rb +0 -144
  49. data/examples/deprecated/testtpane.rb +0 -215
  50. data/examples/deprecated/testtpane2.rb +0 -145
  51. data/examples/deprecated/testtpanetable.rb +0 -203
  52. data/examples/dirtree.rb +0 -88
  53. data/examples/experimental/resultsetdemo.rb +0 -280
  54. data/examples/experimental/testmform.rb +0 -35
  55. data/examples/experimental/testscroller.rb +0 -117
  56. data/examples/experimental/teststackflow.rb +0 -111
  57. data/examples/menu1.rb +0 -112
  58. data/examples/multispl.rb +0 -86
  59. data/examples/newmessagebox.rb +0 -130
  60. data/examples/newtabbedwindow.rb +0 -100
  61. data/examples/newtesttabp.rb +0 -121
  62. data/examples/qdfilechooser.rb +0 -68
  63. data/examples/rfe.rb +0 -1195
  64. data/examples/rfe_renderer.rb +0 -121
  65. data/examples/sqlc.rb +0 -454
  66. data/examples/sqlm.rb +0 -437
  67. data/examples/sqlt.rb +0 -408
  68. data/examples/status.txt +0 -68
  69. data/examples/table1.rb +0 -24
  70. data/examples/term2.rb +0 -84
  71. data/examples/test1.rb +0 -239
  72. data/examples/test2.rb +0 -674
  73. data/examples/testapp.rb +0 -44
  74. data/examples/testapp2.rb +0 -58
  75. data/examples/testchars.rb +0 -137
  76. data/examples/testcombo.rb +0 -91
  77. data/examples/testkeypress.rb +0 -66
  78. data/examples/testlistbox.rb +0 -113
  79. data/examples/testmenu.rb +0 -101
  80. data/examples/testmulticomp.rb +0 -70
  81. data/examples/testmulticontainer.rb +0 -94
  82. data/examples/testmultispl.rb +0 -199
  83. data/examples/testree.rb +0 -106
  84. data/examples/testtable.rb +0 -263
  85. data/examples/testtabp.rb +0 -107
  86. data/examples/testtodo.rb +0 -584
  87. data/examples/testvimsplit.rb +0 -112
  88. data/examples/testwsshortcuts.rb +0 -64
  89. data/examples/testwsshortcuts2.rb +0 -126
  90. data/examples/todo.db +0 -0
  91. data/examples/todo.yml +0 -191
  92. data/examples/viewtodo.rb +0 -574
  93. data/lib/rbcurse/action.rb +0 -40
  94. data/lib/rbcurse/app.rb +0 -1374
  95. data/lib/rbcurse/applicationheader.rb +0 -102
  96. data/lib/rbcurse/celleditor.rb +0 -112
  97. data/lib/rbcurse/checkboxcellrenderer.rb +0 -57
  98. data/lib/rbcurse/colormap.rb +0 -159
  99. data/lib/rbcurse/comboboxcellrenderer.rb +0 -30
  100. data/lib/rbcurse/common/ansiparser.rb +0 -117
  101. data/lib/rbcurse/common/appmethods.rb +0 -112
  102. data/lib/rbcurse/common/basestack.rb +0 -407
  103. data/lib/rbcurse/common/bordertitle.rb +0 -41
  104. data/lib/rbcurse/common/chunk.rb +0 -177
  105. data/lib/rbcurse/common/colorparser.rb +0 -71
  106. data/lib/rbcurse/common/keydefs.rb +0 -30
  107. data/lib/rbcurse/common/widgetshortcuts.rb +0 -302
  108. data/lib/rbcurse/defaultlistselectionmodel.rb +0 -79
  109. data/lib/rbcurse/deprecated/README.markdown +0 -12
  110. data/lib/rbcurse/deprecated/rscrollpane.rb +0 -512
  111. data/lib/rbcurse/deprecated/rsplitpane.rb +0 -894
  112. data/lib/rbcurse/deprecated/rsplitpane2.rb +0 -1009
  113. data/lib/rbcurse/deprecated/rviewport.rb +0 -204
  114. data/lib/rbcurse/experimental/README.markdown +0 -14
  115. data/lib/rbcurse/experimental/resultsettextview.rb +0 -585
  116. data/lib/rbcurse/experimental/stackflow.rb +0 -478
  117. data/lib/rbcurse/extras/bottomline.rb +0 -1850
  118. data/lib/rbcurse/extras/box.rb +0 -58
  119. data/lib/rbcurse/extras/directorylist.rb +0 -467
  120. data/lib/rbcurse/extras/directorytree.rb +0 -69
  121. data/lib/rbcurse/extras/divider.rb +0 -310
  122. data/lib/rbcurse/extras/focusmanager.rb +0 -31
  123. data/lib/rbcurse/extras/horizlist.rb +0 -203
  124. data/lib/rbcurse/extras/listselectable.rb +0 -264
  125. data/lib/rbcurse/extras/masterdetail.rb +0 -166
  126. data/lib/rbcurse/extras/menutree.rb +0 -63
  127. data/lib/rbcurse/extras/multiform.rb +0 -330
  128. data/lib/rbcurse/extras/multilinelabel.rb +0 -142
  129. data/lib/rbcurse/extras/newmessagebox.rb +0 -328
  130. data/lib/rbcurse/extras/newtabbedpane.rb +0 -612
  131. data/lib/rbcurse/extras/newtabbedwindow.rb +0 -68
  132. data/lib/rbcurse/extras/padreader.rb +0 -189
  133. data/lib/rbcurse/extras/rcomboedit.rb +0 -256
  134. data/lib/rbcurse/extras/resultsetbrowser.rb +0 -281
  135. data/lib/rbcurse/extras/rlink.rb +0 -27
  136. data/lib/rbcurse/extras/rmenulink.rb +0 -21
  137. data/lib/rbcurse/extras/scrollbar.rb +0 -143
  138. data/lib/rbcurse/extras/statusline.rb +0 -94
  139. data/lib/rbcurse/extras/stdscrwindow.rb +0 -309
  140. data/lib/rbcurse/extras/tableextended.rb +0 -40
  141. data/lib/rbcurse/extras/tabular.rb +0 -264
  142. data/lib/rbcurse/extras/tabularwidget.rb +0 -1150
  143. data/lib/rbcurse/extras/textpad.rb +0 -516
  144. data/lib/rbcurse/extras/viewer.rb +0 -136
  145. data/lib/rbcurse/io.rb +0 -850
  146. data/lib/rbcurse/keylabelprinter.rb +0 -178
  147. data/lib/rbcurse/listcellrenderer.rb +0 -140
  148. data/lib/rbcurse/listeditable.rb +0 -310
  149. data/lib/rbcurse/listkeys.rb +0 -37
  150. data/lib/rbcurse/listscrollable.rb +0 -564
  151. data/lib/rbcurse/listselectable.rb +0 -142
  152. data/lib/rbcurse/mapper.rb +0 -130
  153. data/lib/rbcurse/orderedhash.rb +0 -77
  154. data/lib/rbcurse/ractionevent.rb +0 -67
  155. data/lib/rbcurse/rbasiclistbox.rb +0 -768
  156. data/lib/rbcurse/rchangeevent.rb +0 -27
  157. data/lib/rbcurse/rcombo.rb +0 -238
  158. data/lib/rbcurse/rcommandwindow.rb +0 -587
  159. data/lib/rbcurse/rcontainer.rb +0 -415
  160. data/lib/rbcurse/rdialogs.rb +0 -451
  161. data/lib/rbcurse/rinputdataevent.rb +0 -47
  162. data/lib/rbcurse/rlistbox.rb +0 -1196
  163. data/lib/rbcurse/rmenu.rb +0 -939
  164. data/lib/rbcurse/rmessagebox.rb +0 -348
  165. data/lib/rbcurse/rmulticontainer.rb +0 -304
  166. data/lib/rbcurse/rmultisplit.rb +0 -722
  167. data/lib/rbcurse/rmultitextview.rb +0 -306
  168. data/lib/rbcurse/rpopupmenu.rb +0 -755
  169. data/lib/rbcurse/rprogress.rb +0 -118
  170. data/lib/rbcurse/rscrollform.rb +0 -418
  171. data/lib/rbcurse/rtabbedpane.rb +0 -1158
  172. data/lib/rbcurse/rtabbedwindow.rb +0 -167
  173. data/lib/rbcurse/rtable.rb +0 -1718
  174. data/lib/rbcurse/rtextarea.rb +0 -920
  175. data/lib/rbcurse/rtextview.rb +0 -761
  176. data/lib/rbcurse/rtree.rb +0 -780
  177. data/lib/rbcurse/rvimsplit.rb +0 -763
  178. data/lib/rbcurse/rwidget.rb +0 -2915
  179. data/lib/rbcurse/scrollable.rb +0 -301
  180. data/lib/rbcurse/table/tablecellrenderer.rb +0 -86
  181. data/lib/rbcurse/table/tabledatecellrenderer.rb +0 -98
  182. data/lib/rbcurse/tree/treecellrenderer.rb +0 -150
  183. data/lib/rbcurse/tree/treemodel.rb +0 -428
  184. data/lib/rbcurse/undomanager.rb +0 -188
  185. data/lib/rbcurse/vieditable.rb +0 -144
  186. data/lib/ver/keyboard.rb +0 -150
  187. data/lib/ver/keyboard2.rb +0 -170
  188. data/lib/ver/ncurses.rb +0 -218
  189. data/lib/ver/panel.rb +0 -162
  190. data/lib/ver/rpad.rb +0 -375
  191. data/lib/ver/window.rb +0 -882
  192. data/test/test_rbcurse.rb +0 -0
data/examples/testree.rb DELETED
@@ -1,106 +0,0 @@
1
- require 'rbcurse'
2
- require 'rbcurse/rtree'
3
-
4
- if $0 == __FILE__
5
- $choice = ARGV[0].to_i || 1
6
- class Tester
7
- def initialize
8
- acolor = $reversecolor
9
- end
10
- def run
11
- @window = VER::Window.root_window
12
- @form = Form.new @window
13
-
14
- h = 20; w = 75; t = 3; l = 4
15
- #$choice = 1
16
- case $choice
17
- when 1
18
- root = TreeNode.new "ROOT"
19
- subroot = TreeNode.new "subroot"
20
- leaf1 = TreeNode.new "leaf 1"
21
- leaf2 = TreeNode.new "leaf 2"
22
-
23
- model = DefaultTreeModel.new root
24
- #model.insert_node_into(subroot, root, 0)
25
- #model.insert_node_into(leaf1, subroot, 0)
26
- #model.insert_node_into(leaf2, subroot, 1)
27
- root << subroot
28
- subroot << leaf1 << leaf2
29
- leaf1 << "leaf11"
30
- leaf1 << "leaf12"
31
-
32
- root.add "blocky", true do
33
- add "block2"
34
- add "block3" do
35
- add "block31"
36
- end
37
- end
38
- Tree.new @form, :data => model, :row =>2, :col=>2, :height => 20, :width => 30
39
-
40
- when 2
41
-
42
- # use an array to populate
43
- # we need to do root_visible = false so you get just a list
44
- model = %W[ ruby cobol jruby smalltalk fortran piethon purrl lithp ]
45
- Tree.new @form, :data => model, :row =>2, :col=>2, :height => 20, :width => 30
46
-
47
- when 3
48
-
49
- # use an Has to populate
50
- #model = { :ruby => %W[ "jruby", "mri", "yarv", "rubinius", "macruby" ], :python => %W[ cpython jython laden-swallow ] }
51
- model = { :ruby => [ "jruby", {:mri => %W[ 1.8.6 1.8.7]}, {:yarv => %W[1.9.1 1.9.2]}, "rubinius", "macruby" ], :python => %W[ cpython jython laden-swallow ] }
52
-
53
- Tree.new @form, :data => model, :row =>2, :col=>2, :height => 20, :width => 30
54
- #when 4
55
- else
56
- Tree.new @form, :row =>2, :col=>2, :height => 20, :width => 30 do
57
- root "root" do
58
- branch "hello" do
59
- leaf "world"
60
- end
61
- branch "goodbyee" do
62
- leaf "java"
63
- end
64
- end
65
- end
66
-
67
- end
68
-
69
- #
70
- @help = "F1 to quit. Pass command-line argument 1,2,3,4 #{$0} "
71
- RubyCurses::Label.new @form, {'text' => @help, "row" => 1, "col" => 2, "color" => "yellow"}
72
- @form.repaint
73
- @window.wrefresh
74
- Ncurses::Panel.update_panels
75
- while((ch = @window.getchar()) != KEY_F1 )
76
- ret = @form.handle_key(ch)
77
- @window.wrefresh
78
- if ret == :UNHANDLED
79
- str = keycode_tos ch
80
- $log.debug " UNHANDLED #{str} by Vim #{ret} "
81
- end
82
- end
83
-
84
- @window.destroy
85
-
86
- end
87
- end
88
- include RubyCurses
89
- include RubyCurses::Utils
90
- # Initialize curses
91
- begin
92
- # XXX update with new color and kb
93
- VER::start_ncurses # this is initializing colors via ColorMap.setup
94
- $log = Logger.new("rbc13.log")
95
- $log.level = Logger::DEBUG
96
- n = Tester.new
97
- n.run
98
- rescue => ex
99
- ensure
100
- VER::stop_ncurses
101
- p ex if ex
102
- puts(ex.backtrace.join("\n")) if ex
103
- $log.debug( ex) if ex
104
- $log.debug(ex.backtrace.join("\n")) if ex
105
- end
106
- end
@@ -1,263 +0,0 @@
1
- require 'rbcurse'
2
- require 'rbcurse/rcombo'
3
- require 'rbcurse/rtable'
4
- require 'rbcurse/celleditor'
5
- #require 'rbcurse/table/tablecellrenderer'
6
- require 'rbcurse/comboboxcellrenderer'
7
- require 'rbcurse/action'
8
-
9
- ##
10
- # a renderer which paints alternate lines with
11
- # another color, for people with poor taste.
12
- class MyRenderer < TableCellRenderer
13
- def initialize text="", config={}, &block
14
- super
15
- @orig_bgcolor = @bgcolor
16
- @orig_color = @color
17
- end
18
- def repaint graphic, r=@row,c=@col, value=@text, focussed=false, selected=false
19
- @bgcolor = @orig_bgcolor
20
- @color = @orig_color
21
- if !focussed and !selected
22
- @bgcolor = r % 2 == 0 ? "green" : @orig_bgcolor
23
- @color = r % 2 == 0 ? "black" : @orig_color
24
- end
25
- super
26
- end
27
- end
28
- if $0 == __FILE__
29
- include RubyCurses
30
- include RubyCurses::Utils
31
-
32
- begin
33
- # Initialize curses
34
- VER::start_ncurses # this is initializing colors via ColorMap.setup
35
- $log = Logger.new((File.join(ENV["LOGDIR"] || "./" ,"rbc13.log")))
36
- $log.level = Logger::DEBUG
37
-
38
- @window = VER::Window.root_window
39
-
40
- catch(:close) do
41
- colors = Ncurses.COLORS
42
- $log.debug "START #{colors} colors ---------"
43
- @form = Form.new @window
44
- @window.printstring 0,30,"Demo of Ruby Curses Table: Edit, Resize, Insert, Move, Delete Row/Col", $datacolor
45
- r = 1; c = 30;
46
- data = [["You're beautiful",3,"James Blunt",3.21, true, "WIP"],
47
- ["Where are you",3,"London Beat",3.47, true, "WIP"],
48
- ["I'll always love my mama",92,"Intruders",412, true, "Fin"],
49
- ["I believe in love",4,"Paula Cole",110.0, false, "Cancel"],
50
- ["Red Sky at night",4,"Dave Gilmour",102.72, false, "Postp"],
51
- ["Midnight and you",8,"Barry White",12.72, false, "Todo"],
52
- ["Let the music play",9,"Barry White",12.2, false, "WIP"],
53
- ["I swear",nil,"Boyz II Men",112.7, true, "Cancel"],
54
- ["Believe",9,"Elton John",12.2, false, "Todo"],
55
- ["Private Dancer",9,"Tina Turner",12.2, false, "Todo"],
56
- ["Liberian Girl",9,"Michael Jackson",12.2, false, "Todo"],
57
- ["Like a prayer",163,"Charlotte Perrelli",5.4, false, "WIP"]]
58
-
59
- colnames = %w[ Song Cat Artist Ratio Flag Status]
60
- statuses = ["Todo", "WIP", "Fin", "Cancel", "Postp"]
61
-
62
- texta = Table.new @form do
63
- name "mytext"
64
- row r
65
- col c
66
- width 78
67
- height 15
68
- #title "A Table"
69
- #title_attrib (Ncurses::A_REVERSE | Ncurses::A_BOLD)
70
- cell_editing_allowed true
71
- editing_policy :EDITING_AUTO
72
- set_data data, colnames
73
- end
74
- sel_col = Variable.new 0
75
- sel_col.value = 0
76
- tcm = texta.get_table_column_model
77
- selcolname = texta.get_column_name sel_col.value
78
- #
79
- ## key bindings fo texta
80
- # column widths
81
- tcm.column(0).width 24
82
- tcm.column(1).width 5
83
- tcm.column(2).width 18
84
- #tcm.column(2).editable false
85
- tcm.column(3).width 7
86
- tcm.column(4).width 5
87
- tcm.column(5).width 8
88
- texta.configure() do
89
- bind_key(330) { texta.remove_column(tcm.column(texta.focussed_col)) rescue "" }
90
- bind_key(?+) {
91
- acolumn = texta.get_column selcolname
92
- w = acolumn.width + 1
93
- acolumn.width w
94
- #texta.table_structure_changed
95
- }
96
- bind_key(?-) {
97
- acolumn = texta.get_column selcolname
98
- w = acolumn.width - 1
99
- if w > 3
100
- acolumn.width w
101
- #texta.table_structure_changed
102
- end
103
- }
104
- bind_key(?>) {
105
- colcount = tcm.column_count-1
106
- #texta.move_column sel_col.value, sel_col.value+1 unless sel_col.value == colcount
107
- col = texta.focussed_col
108
- texta.move_column col, col+1 unless col == colcount
109
- }
110
- bind_key(?<) {
111
- col = texta.focussed_col
112
- texta.move_column col, col-1 unless col == 0
113
- #texta.move_column sel_col.value, sel_col.value-1 unless sel_col.value == 0
114
- }
115
- #bind_key(KEY_RIGHT) { sel_col.value = sel_col.value+1; current_column sel_col.value}
116
- #bind_key(KEY_LEFT) { sel_col.value = sel_col.value-1;current_column sel_col.value}
117
- end
118
- keylabel = RubyCurses::Label.new @form, {'text' => "", "row" => r+16, "col" => c, "color" => "yellow", "bgcolor"=>"blue", "display_length"=>60, "height"=>2}
119
- eventlabel = RubyCurses::Label.new @form, {'text' => "Events:", "row" => r+19, "col" => c, "color" => "white", "bgcolor"=>"blue", "display_length"=>60, "height"=>2}
120
-
121
- # report some events
122
- texta.table_model.bind(:TABLE_MODEL_EVENT){|e| eventlabel.text = "Event: #{e}"}
123
- texta.get_table_column_model.bind(:TABLE_COLUMN_MODEL_EVENT){|e| eventlabel.text = "Event: #{e}"}
124
- texta.bind(:TABLE_TRAVERSAL_EVENT){|e| eventlabel.text = "Event: #{e}"}
125
-
126
- @help = "C-q to quit. M-Tab (next col) C-n (Pg Dn), C-p (Pg Up), M-0 Top, M-9 End, C-x (select). Columns:- Narrow, + expand, > < switch"
127
- RubyCurses::Label.new @form, {'text' => @help, "row" => Ncurses.LINES-3, "col" => 2, "color" => "yellow", "height"=>2}
128
-
129
- str_renderer = TableCellRenderer.new ""
130
- num_renderer = TableCellRenderer.new "", { "justify" => :right }
131
- bool_renderer = CheckBoxCellRenderer.new "", {"parent" => texta, "display_length"=>5}
132
- combo_renderer = RubyCurses::ComboBoxCellRenderer.new nil, {"parent" => texta, "display_length"=> 8}
133
- combo_editor = RubyCurses::CellEditor.new(RubyCurses::ComboBox.new nil, {"focusable"=>false, "visible"=>false, "list"=>statuses, "display_length"=>8})
134
- texta.set_default_cell_renderer_for_class "String", str_renderer
135
- texta.set_default_cell_renderer_for_class "Fixnum", num_renderer
136
- texta.set_default_cell_renderer_for_class "Float", num_renderer
137
- texta.set_default_cell_renderer_for_class "TrueClass", bool_renderer
138
- texta.set_default_cell_renderer_for_class "FalseClass", bool_renderer
139
- texta.get_table_column_model.column(5).cell_editor = combo_editor
140
- =begin
141
- field = Field.new @form do
142
- name "value"
143
- row r+18
144
- col c
145
- display_length 30
146
- bgcolor "cyan"
147
- set_label Label.new @form, {'text' => "Value", 'mnemonic'=> 'V'}
148
- # bind :ENTER do $editing = true end
149
- # bind :LEAVE do $editing = false end
150
- end
151
- =end
152
- buttrow = r+21 #Ncurses.LINES-4
153
- b_newrow = Button.new @form do
154
- text "&New"
155
- row buttrow
156
- col c
157
- bind(:ENTER) { eventlabel.text "New button adds a new row at the bottom " }
158
- end
159
- tm = texta.table_model
160
- b_newrow.command {
161
- cc = texta.get_table_column_model.column_count
162
- # need to get datatypes etc, this is just a junk test
163
- tmp=[]
164
- #0.upto(cc-1) { tmp << "" }
165
- 0.upto(cc-1) { tmp << nil }
166
- tm << tmp
167
- #texta.table_data_changed
168
- keylabel.text = "Added a row"
169
- alert("Added a row at bottom of table")
170
-
171
- }
172
-
173
- # using ampersand to set mnemonic
174
- b_delrow = Button.new @form do
175
- text "&Delete"
176
- row buttrow
177
- col c+10
178
- bind(:ENTER) { eventlabel.text "Deletes focussed row" }
179
- end
180
- b_delrow.command { |form|
181
- row = texta.focussed_row
182
- if confirm("Do your really want to delete row #{row}?")== :YES
183
- tm.delete_at row
184
- #texta.table_data_changed
185
- else
186
- #$message.value = "Quit aborted"
187
- end
188
- }
189
- b_change = Button.new @form do
190
- text "&Lock"
191
- row buttrow
192
- col c+20
193
- command {
194
- r = texta.focussed_row
195
- c = sel_col.value
196
- #$log.debug " Update gets #{field.getvalue.class}"
197
- #texta.set_value_at(r, c, field.getvalue)
198
- toggle = texta.column(texta.focussed_col()).editable
199
- if toggle.nil? or toggle==true
200
- toggle = false
201
- text "Un&lock"
202
- else
203
- toggle = true
204
- text "&Lock "
205
- end
206
- eventlabel.text "Set column #{texta.focussed_col()} editable to #{toggle}"
207
- texta.column(texta.focussed_col()).editable toggle
208
- alert("Set column #{texta.focussed_col()} editable to #{toggle}")
209
- }
210
- bind(:ENTER) { eventlabel.text "Toggles editable state of current column " }
211
- end
212
- b_insert = Button.new @form do
213
- text "&Insert"
214
- row buttrow
215
- col c+32
216
- command {
217
- # this does not trigger a data change since we are not updating model. so update
218
- # on pressing up or down
219
- #0.upto(100) { |i| data << ["test", rand(100), "abc:#{i}", rand(100)/2.0]}
220
- #texta.table_data_changed
221
- }
222
- bind(:ENTER) { eventlabel.text "Does nothing " }
223
- end
224
-
225
-
226
- @form.repaint
227
- @window.wrefresh
228
- Ncurses::Panel.update_panels
229
- while((ch = @window.getchar()) != ?\C-q.getbyte(0) )
230
- begin
231
- colcount = tcm.column_count-1
232
- s = keycode_tos ch
233
- keylabel.text = "Pressed #{ch} , #{s}"
234
- @form.handle_key(ch)
235
-
236
- sel_col.value = tcm.column_count-1 if sel_col.value > tcm.column_count-1
237
- sel_col.value = 0 if sel_col.value < 0
238
- selcolname = texta.get_column_name sel_col.value
239
- keylabel.text = "Pressed #{ch} , #{s}. Column selected #{texta.focussed_col}: Width:#{tcm.column(sel_col.value).width} #{selcolname}. Focussed Row: #{texta.focussed_row}, Rows: #{texta.table_model.row_count}, Cols: #{colcount}"
240
- s = texta.get_value_at(texta.focussed_row, texta.focussed_col)
241
- #s = s.to_s
242
- ## $log.debug " updating Field #{s}, #{s.class}"
243
- ## field.set_buffer s unless field.state == :HIGHLIGHTED # $editing
244
-
245
- @form.repaint
246
- @window.wrefresh
247
- rescue => ex
248
- $log.debug( ex) if ex
249
- $log.debug(ex.backtrace.join("\n")) if ex
250
- alert ex.to_s
251
- end
252
- end
253
- end
254
- rescue => ex
255
- ensure
256
- @window.destroy if !@window.nil?
257
- VER::stop_ncurses
258
- p ex if ex
259
- p(ex.backtrace.join("\n")) if ex
260
- $log.debug( ex) if ex
261
- $log.debug(ex.backtrace.join("\n")) if ex
262
- end
263
- end
data/examples/testtabp.rb DELETED
@@ -1,107 +0,0 @@
1
- require 'logger'
2
- require 'rbcurse'
3
- #require 'rbcurse/rtabbedpane'
4
- require 'rbcurse/rtabbedwindow'
5
-
6
- class TestTabbedPane
7
- def initialize
8
- acolor = $reversecolor
9
- #$config_hash ||= {}
10
- end
11
- def run
12
- $config_hash ||= Variable.new Hash.new
13
- #configvar.update_command(){ |v| $config_hash[v.source()] = v.value }
14
- @tw = RubyCurses::TabbedWindow.new nil do
15
- height 18
16
- width 60
17
- row 5
18
- col 20
19
- button_type :ok
20
- end
21
- @tp = @tw.tabbed_pane
22
- @tab1 = @tw.add_tab "&Language"
23
- f1 = @tp.form @tab1
24
- #$radio = Variable.new
25
- radio1 = RadioButton.new f1 do
26
- #variable $radio
27
- variable $config_hash
28
- name "radio1"
29
- text "ruby"
30
- value "ruby"
31
- color "red"
32
- row 4
33
- col 2
34
- end
35
- radio2 = RadioButton.new f1 do
36
- #variable $radio
37
- variable $config_hash
38
- name "radio1"
39
- text "jruby"
40
- value "jruby"
41
- color "green"
42
- row 5
43
- col 2
44
- end
45
- radio3 = RadioButton.new f1 do
46
- #variable $radio
47
- variable $config_hash
48
- name "radio1"
49
- text "macruby"
50
- value "macruby"
51
- color "cyan"
52
- row 6
53
- col 2
54
- end
55
- @tab2 = @tw.add_tab "&Settings"
56
- #f2 = @tab2.form
57
- f2 = @tp.form @tab2
58
- r = 2
59
- butts = [ "Use &HTTP/1.0", "Use &frames", "&Use SSL" ]
60
- bcodes = %w[ HTTP, FRAMES, SSL ]
61
- butts.each_with_index do |t, i|
62
- RubyCurses::CheckBox.new f2 do
63
- text butts[i]
64
- variable $config_hash
65
- name bcodes[i]
66
- row r+i
67
- col 4
68
- end
69
- end
70
- @tab3 = @tw.add_tab "&Editors"
71
- #f3 = @tab3.form
72
- f3 = @tp.form @tab3
73
- butts = %w[ &Vim E&macs &Jed &Other ]
74
- bcodes = %w[ VIM EMACS JED OTHER]
75
- row = 3
76
- butts.each_with_index do |name, i|
77
- RubyCurses::CheckBox.new f3 do
78
- text name
79
- variable $config_hash
80
- name bcodes[i]
81
- row row
82
- col 4
83
- end
84
- row +=1
85
- end
86
- @tw.show
87
- @tw.handle_keys
88
- end
89
- end
90
- if $0 == __FILE__
91
- # Initialize curses
92
- begin
93
- # XXX update with new color and kb
94
- VER::start_ncurses # this is initializing colors via ColorMap.setup
95
- $log = Logger.new((File.join(ENV["LOGDIR"] || "./" ,"rbc13.log")))
96
- $log.level = Logger::DEBUG
97
- n = TestTabbedPane.new
98
- n.run
99
- rescue => ex
100
- ensure
101
- VER::stop_ncurses
102
- p ex if ex
103
- p(ex.backtrace.join("\n")) if ex
104
- $log.debug( ex) if ex
105
- $log.debug(ex.backtrace.join("\n")) if ex
106
- end
107
- end