rbcurse 1.4.0 → 1.4.1.pre2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (142) hide show
  1. data/NOTES +68 -0
  2. data/README.markdown +73 -330
  3. data/TODO2.txt +2 -2
  4. data/VERSION +1 -1
  5. data/examples/abasiclist.rb +8 -2
  6. data/examples/alpmenu.rb +1 -1
  7. data/examples/app.rb +1 -24
  8. data/examples/appdirtree.rb +1 -1
  9. data/examples/appemail.rb +8 -14
  10. data/examples/appemaillb.rb +2 -2
  11. data/examples/appgcompose.rb +7 -5
  12. data/examples/common/file.rb +40 -0
  13. data/examples/{rmail.rb → common/rmail.rb} +0 -0
  14. data/examples/data/README.markdown +9 -0
  15. data/examples/data/brew.txt +38 -0
  16. data/examples/data/color.2 +37 -0
  17. data/examples/data/gemlist.txt +60 -0
  18. data/examples/data/lotr.txt +12 -0
  19. data/examples/data/ports.txt +136 -0
  20. data/examples/data/tasks.txt +27 -0
  21. data/examples/{todocsv.csv → data/todocsv.csv} +0 -0
  22. data/examples/data/unix1.txt +21 -0
  23. data/examples/data/unix2.txt +11 -0
  24. data/examples/dbdemo.rb +49 -14
  25. data/examples/{appgmail.rb → deprecated/appgmail.rb} +1 -1
  26. data/examples/{splitp.rb → deprecated/splitp.rb} +0 -0
  27. data/examples/{testscrolllb.rb → deprecated/testscrolllb.rb} +0 -0
  28. data/examples/{testscrollp.rb → deprecated/testscrollp.rb} +0 -0
  29. data/examples/{testscrollta.rb → deprecated/testscrollta.rb} +0 -0
  30. data/examples/{testscrolltable.rb → deprecated/testscrolltable.rb} +0 -0
  31. data/examples/{testsplit.rb → deprecated/testsplit.rb} +0 -0
  32. data/examples/{testsplit2.rb → deprecated/testsplit2.rb} +0 -0
  33. data/examples/{testsplit3.rb → deprecated/testsplit3.rb} +0 -0
  34. data/examples/{testsplit3_1.rb → deprecated/testsplit3_1.rb} +0 -0
  35. data/examples/{testsplit3a.rb → deprecated/testsplit3a.rb} +0 -0
  36. data/examples/{testsplit3b.rb → deprecated/testsplit3b.rb} +0 -0
  37. data/examples/{testsplitta.rb → deprecated/testsplitta.rb} +0 -0
  38. data/examples/{testsplittv.rb → deprecated/testsplittv.rb} +0 -0
  39. data/examples/{testsplittvv.rb → deprecated/testsplittvv.rb} +0 -0
  40. data/examples/{testtpane.rb → deprecated/testtpane.rb} +0 -0
  41. data/examples/{testtpane2.rb → deprecated/testtpane2.rb} +0 -0
  42. data/examples/{testtpanetable.rb → deprecated/testtpanetable.rb} +0 -0
  43. data/examples/dirtree.rb +17 -7
  44. data/examples/experimental/resultsetdemo.rb +280 -0
  45. data/examples/experimental/testmform.rb +35 -0
  46. data/examples/{testscroller.rb → experimental/testscroller.rb} +1 -19
  47. data/examples/experimental/teststackflow.rb +111 -0
  48. data/examples/menu1.rb +1 -0
  49. data/examples/multispl.rb +4 -4
  50. data/examples/newmessagebox.rb +130 -0
  51. data/examples/newtabbedwindow.rb +100 -0
  52. data/examples/newtesttabp.rb +0 -3
  53. data/examples/qdfilechooser.rb +0 -3
  54. data/examples/rfe.rb +134 -18
  55. data/examples/rfe_renderer.rb +48 -2
  56. data/examples/sqlc.rb +2 -1
  57. data/examples/sqlm.rb +0 -2
  58. data/examples/table1.rb +1 -7
  59. data/examples/term2.rb +4 -1
  60. data/examples/test1.rb +0 -5
  61. data/examples/test2.rb +42 -31
  62. data/examples/testapp2.rb +8 -1
  63. data/examples/testchars.rb +0 -4
  64. data/examples/testcombo.rb +5 -9
  65. data/examples/testkeypress.rb +0 -3
  66. data/examples/testmenu.rb +0 -4
  67. data/examples/testmulticomp.rb +3 -5
  68. data/examples/testmulticontainer.rb +94 -0
  69. data/examples/testtable.rb +0 -5
  70. data/examples/testtabp.rb +16 -18
  71. data/examples/testtodo.rb +1 -5
  72. data/examples/testwsshortcuts.rb +64 -0
  73. data/examples/testwsshortcuts2.rb +126 -0
  74. data/examples/viewtodo.rb +1 -4
  75. data/lib/rbcurse.rb +1 -1
  76. data/lib/rbcurse/app.rb +92 -69
  77. data/lib/rbcurse/applicationheader.rb +46 -6
  78. data/lib/rbcurse/celleditor.rb +1 -9
  79. data/lib/rbcurse/comboboxcellrenderer.rb +0 -4
  80. data/lib/rbcurse/common/ansiparser.rb +117 -0
  81. data/{examples → lib/rbcurse/common}/appmethods.rb +25 -0
  82. data/lib/rbcurse/common/basestack.rb +407 -0
  83. data/lib/rbcurse/common/bordertitle.rb +41 -0
  84. data/lib/rbcurse/common/chunk.rb +177 -0
  85. data/lib/rbcurse/common/colorparser.rb +71 -0
  86. data/lib/rbcurse/common/keydefs.rb +30 -0
  87. data/lib/rbcurse/common/widgetshortcuts.rb +302 -0
  88. data/lib/rbcurse/deprecated/README.markdown +12 -0
  89. data/lib/rbcurse/{rscrollpane.rb → deprecated/rscrollpane.rb} +0 -0
  90. data/lib/rbcurse/{rsplitpane.rb → deprecated/rsplitpane.rb} +0 -0
  91. data/lib/rbcurse/{rsplitpane2.rb → deprecated/rsplitpane2.rb} +0 -0
  92. data/lib/rbcurse/{rviewport.rb → deprecated/rviewport.rb} +0 -0
  93. data/lib/rbcurse/experimental/README.markdown +14 -0
  94. data/lib/rbcurse/experimental/resultsettextview.rb +585 -0
  95. data/lib/rbcurse/experimental/stackflow.rb +478 -0
  96. data/lib/rbcurse/extras/bottomline.rb +85 -16
  97. data/lib/rbcurse/extras/box.rb +58 -0
  98. data/lib/rbcurse/extras/directorylist.rb +1 -1
  99. data/lib/rbcurse/extras/horizlist.rb +203 -0
  100. data/lib/rbcurse/extras/listselectable.rb +8 -0
  101. data/lib/rbcurse/extras/multiform.rb +330 -0
  102. data/lib/rbcurse/extras/multilinelabel.rb +142 -0
  103. data/lib/rbcurse/extras/newmessagebox.rb +328 -0
  104. data/lib/rbcurse/extras/newtabbedpane.rb +612 -0
  105. data/lib/rbcurse/extras/newtabbedwindow.rb +68 -0
  106. data/lib/rbcurse/extras/padreader.rb +189 -0
  107. data/lib/rbcurse/extras/rcomboedit.rb +256 -0
  108. data/lib/rbcurse/extras/resultsetbrowser.rb +281 -0
  109. data/lib/rbcurse/extras/statusline.rb +44 -6
  110. data/lib/rbcurse/extras/tabularwidget.rb +141 -104
  111. data/lib/rbcurse/extras/textpad.rb +516 -0
  112. data/lib/rbcurse/extras/viewer.rb +2 -0
  113. data/lib/rbcurse/io.rb +120 -3
  114. data/lib/rbcurse/listcellrenderer.rb +2 -1
  115. data/lib/rbcurse/listkeys.rb +1 -1
  116. data/lib/rbcurse/listscrollable.rb +72 -7
  117. data/lib/rbcurse/rbasiclistbox.rb +64 -12
  118. data/lib/rbcurse/rchangeevent.rb +0 -1
  119. data/lib/rbcurse/rcombo.rb +54 -59
  120. data/lib/rbcurse/rcommandwindow.rb +46 -10
  121. data/lib/rbcurse/rcontainer.rb +415 -0
  122. data/lib/rbcurse/rdialogs.rb +242 -165
  123. data/lib/rbcurse/rinputdataevent.rb +0 -1
  124. data/lib/rbcurse/rlistbox.rb +19 -9
  125. data/lib/rbcurse/rmessagebox.rb +1 -5
  126. data/lib/rbcurse/rmulticontainer.rb +64 -61
  127. data/lib/rbcurse/rmultitextview.rb +0 -2
  128. data/lib/rbcurse/rpopupmenu.rb +0 -2
  129. data/lib/rbcurse/rscrollform.rb +61 -12
  130. data/lib/rbcurse/rtabbedpane.rb +89 -73
  131. data/lib/rbcurse/rtabbedwindow.rb +53 -211
  132. data/lib/rbcurse/rtable.rb +0 -2
  133. data/lib/rbcurse/rtextarea.rb +14 -14
  134. data/lib/rbcurse/rtextview.rb +165 -50
  135. data/lib/rbcurse/rvimsplit.rb +15 -12
  136. data/lib/rbcurse/rwidget.rb +404 -150
  137. data/lib/rbcurse/table/tablecellrenderer.rb +1 -4
  138. data/lib/rbcurse/table/tabledatecellrenderer.rb +0 -3
  139. data/lib/ver/ncurses.rb +1 -9
  140. data/lib/ver/rpad.rb +375 -0
  141. data/lib/ver/window.rb +262 -440
  142. metadata +73 -31
data/NOTES CHANGED
@@ -2044,3 +2044,71 @@ Sean is coming out with a version 0.4.0 which I am using. rbcurse 1.3.0
2044
2044
  onwards uses ffi-ncurses.
2045
2045
 
2046
2046
  * * * * * * * *
2047
+
2048
+ Subject: color formatting
2049
+ -------------------------
2050
+ Date: 2011-11-03 15:03
2051
+
2052
+ Alot has happened since moving to ffi. New widgets and containers, a new
2053
+ tabbedpane that hopefully doesn't suck and is more rubyesque. However,
2054
+ its amazing how simple the color formatting issue was. Took me only a
2055
+ few minutes to get working with a good regular expression.
2056
+
2057
+ The motivation is to be able to have a document with color formatting. I
2058
+ am using the color formatting code of tmux, i.e., #[fg=green, bg=blue,
2059
+ bold] etc. However, I added an "#[end]" tag which pops the previous
2060
+ color, so now its more like html's span, than the terminal escape
2061
+ sequences which just override the previous.
2062
+
2063
+ I'll ofcourse use this in the statusline, in help screens, and also in
2064
+ some way in textview, and somehow even in messages, alerts, messageboxes
2065
+ etc. It's still rough, does no checking for mistakes and I don't have a
2066
+ routine to wrap text ignoring the color stuff. That will be needed soon.
2067
+
2068
+ * * * * * * * *
2069
+
2070
+ Subject: bifurcating into core and others
2071
+ -----------------------------------------
2072
+ Date: 2011-11-08 18:30
2073
+
2074
+ Perhaps it would be better to divide rbcurse into rbcurse-core and then
2075
+ other packages or gems.
2076
+ This way *core* can remain more or less frozen and bug fixes can be
2077
+ released quickly without waiting for other features to stabilize.
2078
+
2079
+ Changes in other packages can be made without disturbing core. Core can
2080
+ be kept backward compatible. And it can remain light with just form,
2081
+ window, field, buttons, list and perhaps textview.
2082
+
2083
+ Other widgets can be put in other gems. The entire extras, UI patterns,
2084
+ experimental work. There could be a *rbcurse-experimental* which moves to
2085
+ either core or standard as and when it stabilizes.
2086
+
2087
+ 1. rbcurse-core - form, field, label, buttons, dialogs, basiclist, messagebox
2088
+ viewer, menus? , combo - basically whatever is required to run test2 and
2089
+ test1.rb. We must have a minimal number of programs to test for this.
2090
+ Actually, test2 incorporates a lot!
2091
+
2092
+ 2. rbcurse-util
2093
+ menus?, textarea?, tabbedpane, tree
2094
+ tables, tabular, keylabel, progress, scrollbar, statusline,
2095
+
2096
+ 3. rbcurse-extras
2097
+ vimsplit, multi-containers, masterdetail, directorylist etc
2098
+ statuswindow, rcommandwindow
2099
+ link, menulink, container
2100
+
2101
+ 4. rbcurse-experimental
2102
+ resultset,
2103
+ Pad, subwin,derwin from window class, scrollform, app, stack/flow
2104
+ gmailfield
2105
+
2106
+ 5. rbcurse-demos
2107
+ rfe, sqlc/m, dbdemo which can be installed and run from anywhere
2108
+ appemail
2109
+ This must be dependent on a specific version of core and util.
2110
+
2111
+ 6. rbcurse-db
2112
+ database related work - resultsetview etc
2113
+
2114
+ * * * * * * * *
data/README.markdown CHANGED
@@ -1,72 +1,82 @@
1
1
  # rbcurse (for ruby 1.9.x)
2
2
 
3
- * Migrating from ncurses-ruby to ffi-ncurses
3
+ * News!! Migrated from ncurses-ruby to ffi-ncurses since 1.3.0
4
4
 
5
- I have moved rbcurse to ffi-ncurses (earlier ncurses gem) since 1.3.0.
5
+ * After releasing 1.4.1, I will be separating this gem into core, extras and experimental.
6
+ Until now the basic widgets have often been volatile, with sudden changes coming in minor
7
+ versions or patch versions. With 1.5.0, I hope to keep the core stable and back-compat.
6
8
 
7
- Please report bugs on github/rkumar/rbcurse mentioning version. Your program dependency
8
- should be an explicit rbcurse version since I am doing a lot of improvements, cleaning up
9
- etc in the code base.
9
+ I've totally rewritten tabbedpane and messagebox. Much simpler now. Will substitute this with
10
+ existing one in 1.5.0 and push the existing ones into /deprecated. There is now support for
11
+ printing colored text in ansi-escape format or a better format based on tmux's status-line
12
+ config, which allows for nesting of colors. I need to iron out the interface.
10
13
 
11
- If you are looking for the ncurses version, please goto
12
- branch rbcurse1.2.0. I am not likely to support that henceforth due to the difficulty in installing ncurses gem.
14
+ ## DESCRIPTION:
13
15
 
14
- Thanks a lot to Sean O'Halpin for the ffi-ncurses gem and immediately responding
15
- to my queries. I am testing on OSX Snow Leopard with ruby 1.9.2, TERM=screen on zsh.
16
+ A small but comprehensive widget library written in ruby for creating ncurses
17
+ applications. Tested on 1.9.1/2, compatible with 1.8.7.
16
18
 
17
- * 2011-09-14 : I am thinking of using the 1.2.x version for ncurses-ruby - any final
18
- bug fixes etc, and releasing a 1.2.x gem. See the rbcurse1.2.0 branch for more updates.
19
- Also, using 1.3.x and beyond for the ffi-ncurses version. Will start with a pre-release gem and
20
- then do a final after some testing.
19
+ ## FEATURES
21
20
 
22
- * Version that works with ruby 1.9 (backward compatible with 1.8.7)
21
+ * Field : text/entry fields in pure ruby (not ncurses)
22
+ * scrollable list box (also editable lists with Field, checkbox and combos)
23
+ * Textarea : multi-line editable area
24
+ * Textview - read-only textarea with vim keys for navigation
25
+ * togglebutton, radio and check buttons (with mnemonics)
26
+ * message box
27
+ * menubar - with submenus
28
+ * popup list
29
+ * tabbedpane (multiple forms using tabbed metaphor)
30
+ * combobox
31
+ * labels with mnemonics
32
+ * Table: multi-column table - with cell selection and editing, horizontal and
33
+ vertical scrolling
34
+ * MultiContainer = add any number of objects to it (such as tables or text objects) and cycle through them
35
+ (saves screen estate)
36
+ * MultiTextView - have multiple files open for viewing in one component. Since these are readonly files, one can map a lot of single-keys as in vim for operating and cycling through buffers.
37
+ * PromptMenu - A simple interactive menu like the `most` application. Saves on allocating keybindings and memorizing them.
38
+ * multiple key bindings for Procs, block and symbols (as in vim and emacs: `C-x C-f` or `15dd`)
39
+ * Kill-ring concept of emacs for cut-paste operations
40
+ * Unlimited undo and redo in TextArea/Lists (needs to be switched on at present on instance basis)
41
+ * Numeric arguments. (vim: 25dd etc. Or in an editable box, emacs's C-u or Alt-1..9)
42
+ * ScrollForm (testscroller.rb) - a form that takes more fields/objects than can be viewed at a go. Meta keys scroll the form.
43
+ * Many more.
23
44
 
24
- * 1.3.1: Rework of some classes - see CHANGELOG
25
- * 1.3.0: ffi-ification of rbcurses with some minor bug-fixes, deprecations
26
- * 1.2.0: many additions (See CHANGELOG for details)
27
- - App class that wraps the environment and makes application development very easy
28
- - New controls such as:
29
- - vimsplit: allows multiple vertical and horizontal splits in one component
30
- - progress bar
31
- - Tree control
32
- - Divider (can grab and move, so as to visually resize components)
33
- - Scrollbar class that can be easily attached to lists, tables etc
34
- - Tabular data widgets and data converters
45
+ Above may be created using DSL like syntax, or hashes, and modified at
46
+ runtime. Very flexible unlike ncurses forms and fields.
35
47
 
36
- Please see CHANGELOG for changes.
37
48
 
38
- * rbcurse 1.1.4 works with 1.9.2 and also contains some files that got missed out in gemspec.
49
+ ## Download rbcurse
39
50
 
40
- * Corrections due to 1.9.2:
41
- - hash_update: rwidget.rb and rtable.rb
42
- Please report any more errors due to this
43
- - $: does not contain "." (affects some examples only)
51
+ * <https://rubygems.org/gems/rbcurse>
44
52
 
45
- Check downloads at <http://github.com/rkumar/rbcurse/downloads>
53
+ * <http://github.com/rkumar/rbcurse>
46
54
 
47
- test2.rb works - i always give it a quick run after making changes. If using ruby1.9.2, you might say: `ruby -I. test2.rb`.
55
+ ## Screenshots
48
56
 
49
- * <http://totalrecall.wordpress.com> - always has some status posted.
57
+ * <http://www.benegal.org/files/screen/?M=D>
58
+ * <http://totalrecall.wordpress.com>
59
+ * <http://github.com/rkumar/rbcurse/wikis/screenshots>
50
60
 
51
- * <http://rdoc.info/github/rkumar/rbcurse/master> - rdoc
61
+ ## Other links
62
+
63
+ * rbcurse tutorial (WIP - please review and give feedback)
64
+ <http://rbcurse.rubyforge.org/tut0.html>
52
65
 
53
- * Notes/thoughts/ideas on rbcurse - <http://rbcurse.tumblr.com/>
66
+ * <http://totalrecall.wordpress.com> - blog, status, screenshots
54
67
 
55
- * rbcurse on rubyforge: <http://rbcurse.rubyforge.org/> - Occasionally updated.
68
+ * <http://rdoc.info/github/rkumar/rbcurse/master> - rdoc
56
69
 
57
- * See changes on (not updated often)
58
- <http://github.com/rkumar/rbcurse/tree/master/CHANGELOG>
59
70
 
60
71
  * Many working demos in examples folder, such as:
61
72
 
62
- * test2.rb (exit with F1, Or Cancel button/Alt-C) contains various
63
- widgets. F2 for menubar toggling
73
+ * test2.rb - original test program containing various widgets, menu bar and tabbed pane
64
74
 
65
75
  * rfe.rb is a ruby file explorer demo.
66
76
 
67
- * sqlm.rb is a ruby sql client _demo_ (using testd.db at
77
+ * sqlt.rb is a ruby sql client _demo_ (using testd.db at
68
78
  <http://www.benegal.org/files/screen/testd.db>)
69
- (requires gem sqlite3-ruby)
79
+ (requires gem sqlite3)
70
80
  sqlm.rb: uses a multi-container - each query opens a new table in the multicontainer
71
81
 
72
82
  * alpmenu.rb - an alpine like menu screen that calls the following 2 programs
@@ -81,83 +91,25 @@ test2.rb works - i always give it a quick run after making changes. If using rub
81
91
 
82
92
  * appdirtree - demo of file browser using Tree on left and list on right.
83
93
 
94
+ * dbdemo.rb - sqlite database query program
84
95
 
85
- * Screenshots on
86
- <http://www.benegal.org/files/screen/?M=D> (new)
87
- and on blog, <http://totalrecall.wordpress.com>
88
- and http://github.com/rkumar/rbcurse/wikis/screenshots (old)
89
-
90
- * Todo (for 0.1.2):
91
- <http://rubyforge.org/pm/task.php?group_id=7775&group_project_id=13812&func=browse>
92
-
93
- See [TODO2.txt](https://github.com/rkumar/rbcurse/blob/master/TODO2.txt) (created and maintained by [todo.rb](https://github.com/rkumar/todorb), also hosted here)
94
-
95
- * rbcurse tutorial (WIP - please review and give feedback)
96
- <http://rbcurse.rubyforge.org/tut0.html>
97
-
98
- ## DESCRIPTION:
99
-
100
- A small but comprehensive widget library written in ruby for creating ncurses
101
- applications.
102
-
103
- ## FEATURES
104
-
105
- * Field : text/entry fields in pure ruby (not ncurses)
106
- * scrollable list box (also editable lists with Field, checkbox and combos)
107
- * Textarea : multi-line editable area
108
- * togglebutton, radio and check buttons (with mnemonics)
109
- * message box
110
- * menubar - with submenu and CheckBoxMenuItem
111
- * popup list
112
- * tabbedpane (multiple forms using tabbed metaphor)
113
- * combobox
114
- * labels with mnemonics (hotkeys)
115
- * Table: multi-column table - with cell selection and editing, horizontal and
116
- vertical scrolling
117
- * Scrollpanes which can contain textviews, textareas, listboxes. (Avoid using).
118
- * Splitpanes which can contain scrollpanes, textviews/areas, listboxes or splitpanes ... DEPRECATED. Pls use vimplit.
119
- * MultiContainer = add any number of objects to it (such as tables or text objects) and cycle through them
120
- (saves screen estate)
121
- * MultiTextView - have multiple files open for viewing in one component. Since these are readonly files, one can map a lot of single-keys as in vim for operating and cycling through buffers.
122
- * Textview - editable option using vim like keys.
123
- * PromptMenu - A simple interactive menu like the `most` application. Saves on allocating keybindings and memorizing them.
124
- * multiple key bindings for Procs, block and symbols (as in vim and emacs: `C-x C-f` or `15dd`)
125
- * Kill-ring concept of emacs for cut-paste operations
126
- * Unlimited undo and redo in TextArea (needs to be switched on at present on instance basis)
127
- * Numeric arguments. (vim: 25dd etc. Or in an editable box, emacs's C-u or Alt-1..9)
128
- * ScrollForm (testscroller.rb) - a form that takes more fields/objects than can be viewed at a go. Meta keys scroll the form.
129
- * Various others, too
130
-
131
- Above may be created using DSL like syntax, or hashes, and modified at
132
- runtime. Very flexible unlike ncurses forms and fields.
133
-
134
- ## Current work
135
-
136
- * 2011-09-21 : I intend to rewrite the following widgets: tabbedpane, menu, messagebox. These were some of the earliest programs and the code is a mess. I need to work on KEY-RESIZE, too. Catching Ctrl-arrow keys and shift function keys is required.
96
+ ## Recent news
137
97
 
138
- Old:
139
- I've just added vi and emacs key bindings to some classes, multiple object containers such as MultiContainer
140
- and MultiTextView. Emacs like kill-ring in TextArea and TextView. Tabbedpane can have unlimited tabs, we can scroll the tabs. Bunch of other stuff. Multiple keys can be bound to a Proc or symbol as in emacs and vim (dd or C-x C-f).
141
-
142
-
143
- ## Sample programs:
144
-
145
- * test2.rb most basic widgets (including menus)
146
- * sqlm.rb is a ruby sql client demo (using sqlite3-ruby)
147
- * rfe : file explorer or Finder like app
148
- * testcombo.rb combos with various insert policies and vertical
149
- alignments
150
- * testtodo.rb : a todo app based on a yaml file (now csv)
151
- * testmenu.rb : popup menu with multiple levels
152
- * testtabp.rb tabbed pane
153
- * test1.rb various kinds of messageboxes (input, list, custom)
154
- pass 1,2,3,4, or 5 as argument on command line
155
- ruby test1.rb 1
156
- ruby test1.rb 2
98
+ * 1.4.0: Cleanup, some small new features, deprecated stuff, added StatusLine.
99
+ Improvements to 'app'.
100
+ * 1.3.0: ffi-ification of rbcurses with some minor bug-fixes, deprecations
101
+ * 1.2.0: many additions (See CHANGELOG for details)
102
+ - App class that wraps the environment and makes application development very easy
103
+ - New controls such as:
104
+ - vimsplit: allows multiple vertical and horizontal splits in one component
105
+ - progress bar
106
+ - Tree control
107
+ - Divider (can grab and move, so as to visually resize components)
108
+ - Scrollbar class that can be easily attached to lists, tables etc
109
+ - Tabular data widgets and data converters
157
110
 
158
- See screenshots on blog.
111
+ Please see CHANGELOG for changes.
159
112
 
160
- * testtpane.rb - tabbedpane sample with a scrollpane and a textobject.
161
113
 
162
114
  ## PROBLEMS, ISSUES
163
115
 
@@ -176,236 +128,27 @@ The following are issues with terminals (or with ncurses-ruby in some cases) not
176
128
 
177
129
  * Some terminals may not show underlines (e.g screen).
178
130
 
179
- * Some terminals (xterm-color) do not process Function keys, avoid declaring F1 etc if
131
+ * Some terminals do not process Function keys, avoid declaring F1 etc if
180
132
  unsure of client terminals. I have put in fixes for xterm-color F1 and
181
133
  backtab.
182
134
 
183
135
  * To use ALT/META keys on a Mac OS X, in Terminal preferences, under
184
136
  Keyboard, select
185
137
  "use Option as Meta key". All hotkeys are automatically, ALT combinations.
138
+ In Iterm2 also, go to Preferences and select "Esc" for keys.
186
139
 
187
140
  * Some screens do not display window background color under spaces.
188
- This is okay under "screen" and "xterm-color" but not under "xterm". You will notice
141
+ This is okay under "screen" and "xterm-color" but not under "xterm" and "xterm-256color". You will notice
189
142
  this in the message box samples.
190
143
 
191
- I am developing and testing under "screen" under OS X Snow Leopard.
192
-
193
- ## SYNOPSIS:
194
-
195
- See lib/rbcurse/rwidgets.rb.
196
- For test programs, see test1, test2, testcombo etc in examples folder.
197
-
198
- This depends only on "window" provided by ncurses. Does not use forms
199
- and fields. Minor changes and improvements may have happened to sample
200
- code below. **See test programs for latest, working code.**
201
-
202
- THE following samples are only demonstrative of how widgets are built. See samples in examples folder for initialization of ncurses etc which is necessary before the following code can be run. The following samples may be slightly obsolete.
144
+ I am developing and testing under "screen" (compiled with 256 colors) under OSX Lion, using zsh)
203
145
 
204
- ### create a window and a form based on window
205
-
206
- @layout = { :height => 0, :width => 0, :top => 0, :left => 0 }
207
- @win = VER::Window.new(@layout)
208
-
209
- @form = Form.new @win
210
-
211
-
212
- ### create a bunch of fields with dependent labels
213
-
214
- r = 1; c = 22;
215
- %w[ name age company].each do |w|
216
- field = Field.new @form do
217
- name w
218
- row r
219
- col c
220
- display_length 30
221
- set_buffer "abcd #{w}"
222
- set_label Label.new @form, {'text' => w}
223
- end
224
- r += 1
225
- end
226
-
227
- ### create a variable (like TkVariable) and tie a label to it.
228
-
229
- $results = Variable.new
230
- $results.value = "A variable"
231
- var = RubyCurses::Label.new @form, {'text_variable' => $results, "row" => r, "col" => 22}
232
- r += 1
233
-
234
- ### create a list and a list box based on the list.
235
-
236
- mylist = []
237
- 0.upto(100) { |v| mylist << "#{v} scrollable data" }
238
-
239
- field = Listbox.new @form do
240
- name "mylist"
241
- row r
242
- col 1
243
- width 40
244
- height 10
245
- list mylist
246
- end
247
- field.insert 5, "hello ruby", "so long python", "farewell java", "RIP .Net"
248
-
249
- ### create a textarea for entry
250
-
251
- texta = TextArea.new @form do
252
- name "mytext"
253
- row 1
254
- col 52
255
- width 40
256
- height 20
257
- end
258
- texta << "hello there" << "Some text to go into textarea."
259
- texta << "HELLO ruby" << "Some text to go into textarea."
260
-
261
- ### create a check box, updates a Variable
262
-
263
- checkbutton = CheckBox.new @form do
264
- text_variable $results
265
- #value = true
266
- onvalue "selected cb"
267
- offvalue "UNselected cb"
268
- text "Please click me"
269
- row 17
270
- col 22
271
- end
272
-
273
- ### change field properties at any time by referring to them by name
274
-
275
- @form.by_name["age"].display_length = 3
276
- @form.by_name["age"].maxlen = 3
277
- @form.by_name["age"].set_buffer "24"
278
- @form.by_name["name"].set_buffer "Not focusable"
279
- @form.by_name["age"].chars_allowed = /\d/
280
- @form.by_name["company"].type(:ALPHA)
281
- @form.by_name["name"].set_focusable(false)
282
-
283
- @form.by_name["password"].color 'red'
284
- @form.by_name["password"].bgcolor 'blue'
285
-
286
- # restrict entry to some values
287
- password.values(%w[ scotty tiger secret qwerty])
288
-
289
- # validation using ruby's regular expressions
290
-
291
- field.valid_regex(/^[A-Z]\d+/)
292
-
293
- ### bind events to forms, and fields
294
-
295
- @form.bind(:ENTER) { |f| f.label.bgcolor = $promptcolor if f.instance_of? RubyCurses::Field}
296
- @form.bind(:LEAVE) { |f| f.label.bgcolor = $datacolor if f.instance_of? RubyCurses::Field}
297
-
298
- ### create buttons
299
-
300
- ok_button = Button.new @form do
301
- text "OK"
302
- name "OK"
303
- row 18
304
- col 22
305
- end
306
- ok_button.command { |form| $results.value = "OK PRESS:";form.printstr(@window, 23,45, "OK CALLED") }
307
- #text "Cancel"
308
- cancel_button = Button.new @form do
309
- text_variable $results
310
- row 18
311
- col 28
312
- end
313
- cancel_button.command { |form| form.printstr(@window, 23,45, "Cancel CALLED"); throw(:close); }
314
-
315
- ### create radio buttons
316
-
317
- colorlabel = Label.new @form, {'text' => "Select a color:", "row" => 20,
318
- "col" => 22, "color"=> "cyan"}
319
- $radio = Variable.new
320
- radio1 = RadioButton.new @form do
321
- text_variable $radio
322
- text "red"
323
- value "red"
324
- color "red"
325
- row 21
326
- col 22
327
- end
328
- radio2 = RadioButton.new @form do
329
- text_variable $radio
330
- text "green"
331
- value "green"
332
- color "green"
333
- row 22
334
- col 22
335
- end
336
-
337
- ### create a messagebox
338
-
339
- @mb = RubyCurses::MessageBox.new do
340
- title "Enter your name"
341
- message "Enter your name"
342
- type :input
343
- default_value "rahul"
344
- default_button 0
345
- end
346
- #title "Color selector"
347
- #type :custom
348
- #buttons %w[red green blue yellow]
349
- #underlines [0,0,0,0]
350
-
351
- $log.debug "MBOX : #{@mb.selected_index} "
352
- $log.debug "MBOX : #{@mb.input_value} "
353
-
354
- ### create a read-only scrollable view of data
355
-
356
- @textview = TextView.new @form do
357
- name "myView"
358
- row 16
359
- col 52
360
- width 40
361
- height 7
362
- end
363
- content = File.open("../../README.markdown","r").readlines
364
- @textview.set_content content
365
-
366
- ## set it to point to row 21
367
- @textview.top_row 21
368
-
369
-
370
- # lets scroll the text view as we scroll the listbox
371
-
372
- listb.bind(:ENTER_ROW, @textview) { |arow, tview| tview.top_row arow }
373
-
374
- # lets scroll the text view to the line you enter in the numeric
375
- # field
376
- @form.by_name["line"].bind(:LEAVE, @textview) { |fld, tv| tv.top_row(fld.getvalue.to_i) }
377
-
378
- # lets scroll the text view to the first match of the regex you
379
- # enter
380
- @form.by_name["regex"].bind(:LEAVE, @textview) { |fld, tv| tv.top_row(tv.find_first_match(fld.getvalue)) }
381
-
382
- # change the value of colorlabel to the selected radiobutton
383
- # (red or green)
384
-
385
- $radio.update_command(colorlabel) {|tv, label| label.color tv.value}
386
-
387
- # change the attribute of colorlabel to bold or normal
388
-
389
- $results.update_command(colorlabel,checkbutton) {|tv, label, cb|
390
- attrs = cb.value ? 'bold' : nil; label.attrs(attrs)}
391
-
392
- # during menu creation, create a checkboxmenuitem
393
-
394
- item = RubyCurses::CheckBoxMenuItem.new "CheckMe"
395
-
396
- # when selected, make colorlabel attribute reverse.
397
-
398
- item.command(colorlabel){|it, label| att = it.getvalue ? 'reverse' :
399
- nil; label.attrs(att); label.repaint}
400
146
 
401
147
  ## REQUIREMENTS:
402
148
 
403
149
  * ruby 1.9.1, 1.9.2 (I believe it is working on 1.8.7, 1.8.6 as well).
404
150
 
405
- * ffi-ncurses (>= 0.4.0)
406
-
407
- (Note: 1.8.6 users: pls report any issues and suggest a fix or alternative if you encounter a method_missing)
408
-
151
+ * ffi-ncurses (>= 0.4.0) Thanks Sean !
409
152
 
410
153
  ## INSTALL:
411
154