rbcurse-core 0.0.13 → 0.0.14
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG +10 -0
- data/VERSION +1 -1
- data/lib/rbcurse.rb +1 -1
- data/lib/rbcurse/core/include/bordertitle.rb +3 -1
- data/lib/rbcurse/core/include/chunk.rb +182 -180
- data/lib/rbcurse/core/include/io.rb +445 -443
- data/lib/rbcurse/core/include/listscrollable.rb +257 -254
- data/lib/rbcurse/core/include/vieditable.rb +153 -151
- data/lib/rbcurse/core/system/colormap.rb +146 -143
- data/lib/rbcurse/core/system/ncurses.rb +1 -1
- data/lib/rbcurse/core/util/ansiparser.rb +95 -93
- data/lib/rbcurse/core/util/colorparser.rb +58 -56
- data/lib/rbcurse/core/util/padreader.rb +151 -149
- data/lib/rbcurse/core/widgets/rlist.rb +6 -2
- data/lib/rbcurse/core/widgets/rtabbedwindow.rb +47 -45
- data/lib/rbcurse/core/widgets/textpad.rb +27 -18
- data/rbcurse-core.gemspec +2 -2
- metadata +2 -2
@@ -9,162 +9,164 @@
|
|
9
9
|
|
10
10
|
|
11
11
|
require 'rbcurse/core/include/listeditable'
|
12
|
-
module
|
13
|
-
|
12
|
+
module RubyCurses
|
13
|
+
module ViEditable
|
14
|
+
include ListEditable
|
14
15
|
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
16
|
+
def vieditable_init
|
17
|
+
$log.debug " inside vieditable_init "
|
18
|
+
@editable = true
|
19
|
+
bind_key( ?C, :edit_line)
|
20
|
+
#bind_key( ?o, :insert_line)
|
21
|
+
#bind_key( ?O) { insert_line(@current_index-1) }
|
22
|
+
bind_key( ?o) { insert_line(@current_index+1) }
|
23
|
+
bind_key( ?O) { insert_line(@current_index) }
|
24
|
+
bind_key( ?D, :delete_eol)
|
25
|
+
bind_key( [?d, ?$], :delete_eol)
|
26
|
+
bind_key( [?d, ?d] , :delete_line )
|
27
|
+
bind_key( [?d, ?w], :delete_word )
|
28
|
+
bind_key( [?d, ?t], :delete_till )
|
29
|
+
bind_key( [?d, ?f], :delete_forward )
|
30
|
+
bind_key( ?\C-_ ) { @undo_handler.undo if @undo_handler }
|
31
|
+
bind_key( ?u ) { @undo_handler.undo if @undo_handler }
|
32
|
+
bind_key( ?\C-r ) { @undo_handler.redo if @undo_handler }
|
33
|
+
bind_key( ?x, :delete_curr_char )
|
34
|
+
bind_key( ?X, :delete_prev_char )
|
35
|
+
bind_key( [?y, ?y] , :kill_ring_save )
|
36
|
+
bind_key( ?p, :yank ) # paste after this line
|
37
|
+
bind_key( ?P ) { yank(@current_index - 1) } # should be before this line
|
38
|
+
bind_key(?w, :forward_word)
|
39
|
+
bind_key(?f, :forward_char)
|
40
|
+
bind_key(?\M-y, :yank_pop)
|
41
|
+
bind_key(?\M-w, :kill_ring_save)
|
42
|
+
@_events.push :CHANGE # thru vieditable
|
42
43
|
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
44
|
+
end
|
45
|
+
##
|
46
|
+
# Separate mappings for listboxes.
|
47
|
+
# Some methods don;'t make sense for listboxes and are crashing
|
48
|
+
# since not present for them. f was being overwritten, too.
|
49
|
+
# Sorry for duplication, need to clean this somehow.
|
50
|
+
def vieditable_init_listbox
|
51
|
+
$log.debug " inside vieditable_init_listbox "
|
52
|
+
@editable = true
|
53
|
+
bind_key( ?C, :edit_line)
|
54
|
+
bind_key( ?o) { insert_line(@current_index+1) }
|
55
|
+
bind_key( ?O) { insert_line(@current_index) }
|
56
|
+
bind_key( [?d, ?d] , :delete_line )
|
57
|
+
bind_key( ?\C-_ ) { @undo_handler.undo if @undo_handler }
|
58
|
+
bind_key( ?u ) { @undo_handler.undo if @undo_handler }
|
59
|
+
bind_key( ?\C-r ) { @undo_handler.redo if @undo_handler }
|
60
|
+
bind_key( [?y, ?y] , :kill_ring_save )
|
61
|
+
bind_key( ?p, :yank ) # paste after this line
|
62
|
+
#bind_key( ?P ) { yank(@current_index - 1) } # should be before this line
|
63
|
+
# seems -1 was pasting 2 lines before
|
64
|
+
bind_key( ?P ) { yank(@current_index - 0) } # should be before this line
|
65
|
+
bind_key(?w, :forward_word)
|
66
|
+
bind_key(?\M-y, :yank_pop)
|
67
|
+
bind_key(?\C-y, :yank)
|
68
|
+
bind_key(?\M-w, :kill_ring_save)
|
69
|
+
@_events.push :CHANGE # thru vieditable
|
70
|
+
#bind_key( ?D, :delete_eol)
|
71
|
+
#bind_key( [?d, ?$], :delete_eol)
|
72
|
+
#bind_key(?f, :forward_char)
|
73
|
+
#bind_key( ?x, :delete_curr_char )
|
74
|
+
#bind_key( ?X, :delete_prev_char )
|
75
|
+
#bind_key( [?d, ?w], :delete_word )
|
76
|
+
#bind_key( [?d, ?t], :delete_till )
|
77
|
+
#bind_key( [?d, ?f], :delete_forward )
|
77
78
|
|
78
|
-
|
79
|
+
end
|
79
80
|
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
81
|
+
# currently only adding delete_line and some yank pop functions
|
82
|
+
# These will all give wrong results in table due to _header_offset
|
83
|
+
def vieditable_init_tabular
|
84
|
+
$log.debug " inside vieditable_init tabular"
|
85
|
+
@editable = true
|
86
|
+
#bind_key( ?C, :edit_line)
|
87
|
+
#bind_key( ?o, :insert_line)
|
88
|
+
#bind_key( ?O) { insert_line(@current_index-1) }
|
89
|
+
#bind_key( ?o) { insert_line(@current_index+1) }
|
90
|
+
#bind_key( ?O) { insert_line(@current_index) }
|
91
|
+
bind_key( [?d, ?d] , :delete_line )
|
92
|
+
#bind_key( ?\C-_ ) { @undo_handler.undo if @undo_handler }
|
93
|
+
#bind_key( ?u ) { @undo_handler.undo if @undo_handler }
|
94
|
+
#bind_key( ?\C-r ) { @undo_handler.redo if @undo_handler }
|
95
|
+
bind_key( [?y, ?y] , :kill_ring_save )
|
96
|
+
bind_key( ?p, :yank ) # paste after this line
|
97
|
+
bind_key( ?P ) { yank(@current_index - 1) } # should be before this line
|
98
|
+
bind_key(?\M-y, :yank_pop)
|
99
|
+
bind_key(?\M-w, :kill_ring_save)
|
100
|
+
@_events.push :CHANGE # thru vieditable
|
101
|
+
end
|
101
102
|
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
|
140
|
-
|
141
|
-
|
142
|
-
|
143
|
-
|
144
|
-
|
145
|
-
|
146
|
-
|
147
|
-
|
148
|
-
|
149
|
-
|
150
|
-
|
151
|
-
|
152
|
-
|
153
|
-
|
154
|
-
|
155
|
-
|
156
|
-
|
157
|
-
|
158
|
-
|
159
|
-
|
160
|
-
|
161
|
-
|
162
|
-
|
163
|
-
|
164
|
-
|
103
|
+
##
|
104
|
+
# edit current or given line
|
105
|
+
def edit_line lineno=@current_index
|
106
|
+
line = self[lineno]
|
107
|
+
prompt = "Edit: "
|
108
|
+
maxlen = 80
|
109
|
+
config={};
|
110
|
+
oldline = line.dup
|
111
|
+
config[:default] = line
|
112
|
+
ret, str = rbgetstr(@form.window, $error_message_row, $error_message_col, prompt, maxlen, config)
|
113
|
+
$log.debug " rbgetstr returned #{ret} , #{str} "
|
114
|
+
return if ret != 0
|
115
|
+
self[lineno].replace(str)
|
116
|
+
fire_handler :CHANGE, InputDataEvent.new(0,oldline.length, self, :DELETE_LINE, lineno, oldline) # 2008-12-24 18:34
|
117
|
+
fire_handler :CHANGE, InputDataEvent.new(0,str.length, self, :INSERT_LINE, lineno, str)
|
118
|
+
@repaint_required = true
|
119
|
+
@widget_scrolled = true
|
120
|
+
end
|
121
|
+
##
|
122
|
+
# insert a line
|
123
|
+
# FIXME needs to fire handler 2010-05-23 11:40
|
124
|
+
def insert_line lineno=@current_index
|
125
|
+
prompt = "Insert: "
|
126
|
+
maxlen = 80
|
127
|
+
#config={};
|
128
|
+
#config[:default] = line
|
129
|
+
#ret, str = rbgetstr(@form.window, $error_message_row, $error_message_col, prompt, maxlen, config)
|
130
|
+
ret, str = input_string prompt
|
131
|
+
#ret, str = rbgetstr(@form.window, @row+@height-1, @col+1, prompt, maxlen, config)
|
132
|
+
$log.debug " rbgetstr returned #{ret} , #{str} "
|
133
|
+
return if ret != 0
|
134
|
+
@list.insert lineno, str
|
135
|
+
## added handler on 2010-05-23 11:46 - undo works - tested in testlistbox.rb
|
136
|
+
fire_handler :CHANGE, InputDataEvent.new(0,str.length, self, :INSERT_LINE, lineno, str)
|
137
|
+
@widget_scrolled = true
|
138
|
+
@repaint_required = true
|
139
|
+
end
|
140
|
+
##
|
141
|
+
# common method to edit given string
|
142
|
+
# @param [String] string to edit/modify
|
143
|
+
# @param [String] prompt to display before string
|
144
|
+
# @param [int] max length of input
|
145
|
+
# @return [0, -1] return value 0 if okay, -1 if error
|
146
|
+
#
|
147
|
+
def edit_string string, prompt="Edit: ", maxlen=80
|
148
|
+
config={};
|
149
|
+
config[:default] = string
|
150
|
+
ret, str = rbgetstr(@form.window, $error_message_row, $error_message_col, prompt, maxlen, config)
|
151
|
+
#return str if ret == 0
|
152
|
+
#return ""
|
153
|
+
end
|
154
|
+
##
|
155
|
+
# common method to input a blank string
|
156
|
+
# @param [String] prompt to display before string
|
157
|
+
# @param [int] max length of input
|
158
|
+
# @return [0, -1] return value 0 if okay, -1 if error
|
159
|
+
def input_string prompt="Insert: ", maxlen=80
|
160
|
+
#ret, str = rbgetstr(@form.window, $error_message_row, $error_message_col, prompt, maxlen, config)
|
161
|
+
ret, str = rbgetstr(@form.window, $error_message_row, $error_message_col, prompt, maxlen, config)
|
162
|
+
#return str if ret == 0
|
163
|
+
#return ""
|
164
|
+
end
|
165
|
+
def edit_chars
|
165
166
|
|
166
|
-
|
167
|
-
|
167
|
+
end
|
168
|
+
def edit_word
|
168
169
|
|
169
|
-
|
170
|
+
end
|
171
|
+
end # module
|
170
172
|
end # module
|
@@ -1,162 +1,165 @@
|
|
1
1
|
require 'rbcurse/core/system/ncurses'
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
#
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
2
|
+
|
3
|
+
module RubyCurses
|
4
|
+
module ColorMap
|
5
|
+
# 2010-09-20 12:22 changed colors from string to symbol
|
6
|
+
## private
|
7
|
+
# returns a color constant for a human color string
|
8
|
+
def ColorMap.get_color_const colorstring
|
9
|
+
# added check for fixnum if we go beyond these constants 2011-11-28
|
10
|
+
# e.g. to use full 256 colors
|
11
|
+
return colorstring if colorstring.is_a? Fixnum
|
12
|
+
ret = FFI::NCurses.const_get "COLOR_#{colorstring.to_s.upcase}"
|
13
|
+
end
|
14
|
+
## private
|
15
|
+
# creates a new color pair, puts in color map and returns color_pair
|
16
|
+
# number
|
17
|
+
def ColorMap.install_color fgc, bgc
|
16
18
|
#$log.debug " install_color found #{fgc} #{@bgc} "
|
17
19
|
@color_id += 1
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
20
|
+
fg = ColorMap.get_color_const fgc
|
21
|
+
bg = ColorMap.get_color_const bgc
|
22
|
+
FFI::NCurses.init_pair(@color_id, fg, bg);
|
23
|
+
$color_map[[fgc, bgc]] = @color_id
|
24
|
+
return @color_id
|
25
|
+
end
|
26
|
+
#
|
27
|
+
# returns the colors that make up the given pair
|
28
|
+
# you may want to find what makes up $bottomcolor and set color and bgcolor with it.
|
29
|
+
# @param [Fixnum] color_pair
|
30
|
+
# @return [Symbol, Symbol] foreground and backgrounf color
|
31
|
+
# @example
|
32
|
+
# color, bgcolor = get_colors_for_pair $datacolor
|
33
|
+
#
|
34
|
+
def ColorMap.get_colors_for_pair pair
|
35
|
+
$color_map.invert[pair]
|
36
|
+
end
|
37
|
+
## public
|
38
|
+
# returns a color_pair for a given foreground and background color
|
39
|
+
def ColorMap.get_color fgc, bgc=$def_bg_color
|
40
|
+
fgc = fgc.to_sym if fgc.is_a? String
|
41
|
+
bgc = bgc.to_sym if bgc.is_a? String
|
42
|
+
if $color_map.include? [fgc, bgc]
|
43
|
+
#$log.debug " get_color found #{fgc} #{@bgc} "
|
44
|
+
return $color_map[[fgc, bgc]]
|
45
|
+
else
|
46
|
+
#$log.debug " get_color NOT found #{fgc} #{@bgc} "
|
47
|
+
return ColorMap.install_color fgc, bgc
|
48
|
+
end
|
49
|
+
end
|
50
|
+
def ColorMap.colors
|
51
|
+
@@colors
|
52
|
+
end
|
53
|
+
# returns true if color is a valid one, else false
|
54
|
+
# @param [Symbol] color such as :black :cyan :yellow
|
55
|
+
# @return [Boolean] true if valid, else false
|
56
|
+
def ColorMap.is_color? color
|
57
|
+
return true if color.is_a? Fixnum # so we can use 256 colors
|
58
|
+
@@colors.include? color.to_sym
|
46
59
|
end
|
47
|
-
end
|
48
|
-
def ColorMap.colors
|
49
|
-
@@colors
|
50
|
-
end
|
51
|
-
# returns true if color is a valid one, else false
|
52
|
-
# @param [Symbol] color such as :black :cyan :yellow
|
53
|
-
# @return [Boolean] true if valid, else false
|
54
|
-
def ColorMap.is_color? color
|
55
|
-
return true if color.is_a? Fixnum # so we can use 256 colors
|
56
|
-
@@colors.include? color.to_sym
|
57
|
-
end
|
58
60
|
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
61
|
+
## public
|
62
|
+
# setup color map at start of application
|
63
|
+
def ColorMap.setup
|
64
|
+
@color_id = 0
|
65
|
+
$color_map = {}
|
66
|
+
FFI::NCurses.start_color();
|
67
|
+
# Initialize few color pairs
|
68
|
+
$def_fg_color = :white # pls set these 2 for your application
|
69
|
+
$def_bg_color = :black
|
70
|
+
#COLORS = [COLOR_BLACK, COLOR_RED, COLOR_GREEN, COLOR_YELLOW, COLOR_BLUE,
|
71
|
+
# COLOR_MAGENTA, COLOR_CYAN, COLOR_WHITE]
|
72
|
+
@@colors = [:black, :red, :green, :yellow, :blue, :magenta, :cyan, :white]
|
71
73
|
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
74
|
+
# make foreground colors
|
75
|
+
bg = ColorMap.get_color_const $def_bg_color
|
76
|
+
@@colors[0...@@colors.size].each_with_index do |color, i|
|
77
|
+
next if color == $def_bg_color # NOTE hope this doesn't do something if you change def_bg
|
78
|
+
ColorMap.install_color color, $def_bg_color
|
79
|
+
end
|
80
|
+
$reversecolor = ColorMap.get_color $def_bg_color, $def_fg_color
|
81
|
+
$popupcolor = ColorMap.get_color :cyan, $def_fg_color
|
80
82
|
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
83
|
+
$errorcolor = ColorMap.get_color :white, :red
|
84
|
+
#$promptcolor = $selectedcolor = ColorMap.get_color(:yellow, :red)
|
85
|
+
$promptcolor = ColorMap.get_color(:yellow, :red)
|
86
|
+
$normalcolor = $datacolor = ColorMap.get_color(:white, :black)
|
87
|
+
$bottomcolor = $topcolor = ColorMap.get_color(:white, :blue)
|
88
|
+
$selectedcolor = $datacolor # since we now use reverse attr in list
|
87
89
|
|
88
|
-
|
89
|
-
|
90
|
-
|
90
|
+
$row_selected_attr = Ncurses::A_REVERSE
|
91
|
+
$row_focussed_attr = Ncurses::A_BOLD
|
92
|
+
$row_attr = Ncurses::A_NORMAL
|
91
93
|
|
92
|
-
# $log.debug " colormap SETUP: #{$datacolor} #{$reversecolor} "
|
93
|
-
|
94
|
+
# $log.debug " colormap SETUP: #{$datacolor} #{$reversecolor} "
|
95
|
+
end
|
96
|
+
|
97
|
+
end # modul
|
98
|
+
if $0 == __FILE__
|
99
|
+
require 'logger'
|
100
|
+
require 'ver/window'
|
101
|
+
#include Ncurses # FFI 2011-09-8
|
102
|
+
include ColorMap
|
103
|
+
# Initialize curses
|
104
|
+
begin
|
105
|
+
$log = Logger.new("rbc13.log")
|
106
|
+
VER::start_ncurses
|
107
|
+
@window = VER::Window.root_window
|
108
|
+
$log.level = Logger::DEBUG
|
109
|
+
ColorMap.setup
|
94
110
|
|
95
|
-
|
96
|
-
|
97
|
-
require 'logger'
|
98
|
-
require 'ver/window'
|
99
|
-
#include Ncurses # FFI 2011-09-8
|
100
|
-
include ColorMap
|
101
|
-
# Initialize curses
|
102
|
-
begin
|
103
|
-
$log = Logger.new("rbc13.log")
|
104
|
-
VER::start_ncurses
|
105
|
-
@window = VER::Window.root_window
|
106
|
-
$log.level = Logger::DEBUG
|
107
|
-
ColorMap.setup
|
111
|
+
# Create the window to be associated with the form
|
112
|
+
# Un post form and free the memory
|
108
113
|
|
109
|
-
|
110
|
-
|
114
|
+
catch(:close) do
|
115
|
+
# $log.debug "START ---------"
|
116
|
+
# need to pass a form, not window.
|
117
|
+
r = 1; c = 2; i=0
|
118
|
+
attr = Ncurses::A_NORMAL
|
119
|
+
@window.printstring 20, c, "press 0-9 to change BG color, F1/q to quit. r-everse, n-ormal,b-old ", ColorMap.get_color('white')
|
111
120
|
|
112
|
-
catch(:close) do
|
113
|
-
# $log.debug "START ---------"
|
114
|
-
# need to pass a form, not window.
|
115
|
-
r = 1; c = 2; i=0
|
116
|
-
attr = Ncurses::A_NORMAL
|
117
|
-
@window.printstring 20, c, "press 0-9 to change BG color, F1/q to quit. r-everse, n-ormal,b-old ", ColorMap.get_color('white')
|
118
121
|
|
119
|
-
|
120
122
|
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
|
134
|
-
|
135
|
-
|
123
|
+
while((ch = @window.getchar()) != FFI::NCurses::KEY_F1 )
|
124
|
+
next if ch == -1
|
125
|
+
break if ch == ?q.getbyte(0)
|
126
|
+
case ch
|
127
|
+
when ?r.getbyte(0)
|
128
|
+
attr |= Ncurses::A_REVERSE
|
129
|
+
when ?b.getbyte(0)
|
130
|
+
attr |= Ncurses::A_BOLD
|
131
|
+
when ?n.getbyte(0)
|
132
|
+
attr = Ncurses::A_NORMAL
|
133
|
+
when ?u.getbyte(0)
|
134
|
+
attr |= Ncurses::A_UNDERLINE
|
135
|
+
else
|
136
|
+
i = ch.chr.to_i
|
137
|
+
i = 1 if i > ColorMap::colors.length-1
|
138
|
+
end
|
139
|
+
bg = ColorMap::colors[i]
|
140
|
+
@@colors = %w[black red green yellow blue magenta cyan white]
|
141
|
+
@window.printstring r, c, "%-40s" % "red #{bg} ", ColorMap.get_color('red',bg) , attr
|
142
|
+
@window.printstring 2, c, "%-40s" % "blue #{bg} ", ColorMap.get_color('blue',bg) , attr
|
143
|
+
@window.printstring 3, c, "%-40s" % "white #{bg} ", ColorMap.get_color('white',bg) , attr
|
144
|
+
@window.printstring 4, c, "%-40s" % "green #{bg} ", ColorMap.get_color('green',bg) , attr
|
145
|
+
@window.printstring 5, c, "%-40s" % "cyan #{bg} ", ColorMap.get_color('cyan',bg) , attr
|
146
|
+
@window.printstring 6, c, "%-40s" % "magenta #{bg} ", ColorMap.get_color('magenta',bg) , attr
|
147
|
+
@window.printstring 7, c, "black #{bg} ", ColorMap.get_color('black',bg) , attr
|
148
|
+
@window.wrefresh
|
136
149
|
end
|
137
|
-
|
138
|
-
@@colors = %w[black red green yellow blue magenta cyan white]
|
139
|
-
@window.printstring r, c, "%-40s" % "red #{bg} ", ColorMap.get_color('red',bg) , attr
|
140
|
-
@window.printstring 2, c, "%-40s" % "blue #{bg} ", ColorMap.get_color('blue',bg) , attr
|
141
|
-
@window.printstring 3, c, "%-40s" % "white #{bg} ", ColorMap.get_color('white',bg) , attr
|
142
|
-
@window.printstring 4, c, "%-40s" % "green #{bg} ", ColorMap.get_color('green',bg) , attr
|
143
|
-
@window.printstring 5, c, "%-40s" % "cyan #{bg} ", ColorMap.get_color('cyan',bg) , attr
|
144
|
-
@window.printstring 6, c, "%-40s" % "magenta #{bg} ", ColorMap.get_color('magenta',bg) , attr
|
145
|
-
@window.printstring 7, c, "black #{bg} ", ColorMap.get_color('black',bg) , attr
|
146
|
-
@window.wrefresh
|
150
|
+
# VER::Keyboard.focus = tp
|
147
151
|
end
|
148
|
-
|
149
|
-
|
150
|
-
|
151
|
-
|
152
|
-
|
153
|
-
|
154
|
-
# @window.delwin if !@window.nil?
|
155
|
-
@window.destroy unless @window.nil?
|
152
|
+
rescue => ex
|
153
|
+
ensure
|
154
|
+
# @panel = @window.panel if @window
|
155
|
+
# Ncurses::Panel.del_panel(@panel) if !@panel.nil?
|
156
|
+
# @window.delwin if !@window.nil?
|
157
|
+
@window.destroy unless @window.nil?
|
156
158
|
VER::stop_ncurses
|
157
|
-
|
158
|
-
|
159
|
-
# $log.debug( ex) if ex
|
160
|
-
# $log.debug(ex.backtrace.join("\n")) if ex
|
159
|
+
p ex if ex
|
160
|
+
p(ex.backtrace.join("\n")) if ex
|
161
|
+
# $log.debug( ex) if ex
|
162
|
+
# $log.debug(ex.backtrace.join("\n")) if ex
|
163
|
+
end
|
161
164
|
end
|
162
165
|
end
|