rndk 0.0.1 → 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/demos/appointment.rb +40 -25
- data/demos/clock.rb +22 -11
- data/demos/fileview.rb +141 -0
- data/examples/01-hello-world.rb +1 -2
- data/examples/02-colors.rb +58 -0
- data/examples/03-markup.rb +70 -0
- data/examples/04-quick-widgets.rb +72 -0
- data/examples/05-position-widget.rb +3 -6
- data/examples/calendar.rb +104 -0
- data/examples/scroll.rb +106 -0
- data/lib/rndk/alphalist.rb +14 -14
- data/lib/rndk/button.rb +21 -21
- data/lib/rndk/buttonbox.rb +18 -18
- data/lib/rndk/calendar.rb +333 -240
- data/lib/rndk/core/color.rb +136 -0
- data/lib/rndk/core/display.rb +23 -12
- data/lib/rndk/core/draw.rb +32 -26
- data/lib/rndk/core/markup.rb +561 -0
- data/lib/rndk/core/quick_widgets.rb +232 -12
- data/lib/rndk/core/screen.rb +16 -17
- data/lib/rndk/core/utils.rb +143 -0
- data/lib/rndk/core/widget.rb +133 -92
- data/lib/rndk/dialog.rb +17 -17
- data/lib/rndk/entry.rb +21 -21
- data/lib/rndk/fselect.rb +16 -16
- data/lib/rndk/graph.rb +10 -10
- data/lib/rndk/histogram.rb +10 -10
- data/lib/rndk/itemlist.rb +20 -20
- data/lib/rndk/label.rb +66 -45
- data/lib/rndk/marquee.rb +10 -10
- data/lib/rndk/matrix.rb +27 -27
- data/lib/rndk/mentry.rb +22 -22
- data/lib/rndk/menu.rb +14 -14
- data/lib/rndk/radio.rb +19 -19
- data/lib/rndk/scale.rb +21 -21
- data/lib/rndk/scroll.rb +19 -19
- data/lib/rndk/scroller.rb +2 -0
- data/lib/rndk/selection.rb +20 -20
- data/lib/rndk/slider.rb +21 -21
- data/lib/rndk/swindow.rb +20 -20
- data/lib/rndk/template.rb +21 -21
- data/lib/rndk/version.rb +1 -1
- data/lib/rndk/viewer.rb +18 -18
- data/lib/rndk.rb +99 -777
- data/rndk.gemspec +1 -1
- metadata +12 -3
data/lib/rndk/graph.rb
CHANGED
@@ -14,11 +14,11 @@ module RNDK
|
|
14
14
|
parent_width = Ncurses.getmaxx rndkscreen.window
|
15
15
|
parent_height = Ncurses.getmaxy rndkscreen.window
|
16
16
|
|
17
|
-
self.
|
17
|
+
self.set_box(false)
|
18
18
|
|
19
19
|
box_height = RNDK.setWidgetDimension(parent_height, height, 3)
|
20
20
|
box_width = RNDK.setWidgetDimension(parent_width, width, 0)
|
21
|
-
box_width = self.
|
21
|
+
box_width = self.set_title(title, box_width)
|
22
22
|
box_height += @title_lines
|
23
23
|
box_width = [parent_width, box_width].min
|
24
24
|
box_height = [parent_height, box_height].min
|
@@ -236,7 +236,7 @@ module RNDK
|
|
236
236
|
end
|
237
237
|
|
238
238
|
# Set the background attribute of the widget.
|
239
|
-
def
|
239
|
+
def set_bg_attrib(attrib)
|
240
240
|
Ncurses.wbkgd(@win, attrib)
|
241
241
|
end
|
242
242
|
|
@@ -266,11 +266,11 @@ module RNDK
|
|
266
266
|
ydiff = current_y - ypos
|
267
267
|
|
268
268
|
# Move the window to the new location.
|
269
|
-
RNDK.
|
270
|
-
RNDK.
|
269
|
+
RNDK.window_move(@win, -xdiff, -ydiff)
|
270
|
+
RNDK.window_move(@shadow_win, -xdiff, -ydiff)
|
271
271
|
|
272
272
|
# Touch the windows so they 'move'.
|
273
|
-
RNDK
|
273
|
+
RNDK.window_refresh(@screen.window)
|
274
274
|
|
275
275
|
# Reraw the windowk if they asked for it
|
276
276
|
if refresh_flag
|
@@ -378,14 +378,14 @@ module RNDK
|
|
378
378
|
|
379
379
|
def destroy
|
380
380
|
self.cleanTitle
|
381
|
-
self.
|
381
|
+
self.clean_bindings(:GRAPH)
|
382
382
|
RNDK::Screen.unregister(:GRAPH, self)
|
383
|
-
RNDK.
|
383
|
+
RNDK.window_delete(@win)
|
384
384
|
end
|
385
385
|
|
386
386
|
def erase
|
387
|
-
if self.
|
388
|
-
RNDK.
|
387
|
+
if self.valid_widget?
|
388
|
+
RNDK.window_erase(@win)
|
389
389
|
end
|
390
390
|
end
|
391
391
|
|
data/lib/rndk/histogram.rb
CHANGED
@@ -8,7 +8,7 @@ module RNDK
|
|
8
8
|
parent_width = Ncurses.getmaxx(rndkscreen.window)
|
9
9
|
parent_height = Ncurses.getmaxy(rndkscreen.window)
|
10
10
|
|
11
|
-
self.
|
11
|
+
self.set_box(box)
|
12
12
|
|
13
13
|
box_height = RNDK.setWidgetDimension(parent_height, height, 2)
|
14
14
|
old_height = box_height
|
@@ -16,7 +16,7 @@ module RNDK
|
|
16
16
|
box_width = RNDK.setWidgetDimension(parent_width, width, 0)
|
17
17
|
old_width = box_width
|
18
18
|
|
19
|
-
box_width = self.
|
19
|
+
box_width = self.set_title(title, -(box_width + 1))
|
20
20
|
|
21
21
|
# Increment the height by number of lines in in the title
|
22
22
|
box_height += @title_lines
|
@@ -99,7 +99,7 @@ module RNDK
|
|
99
99
|
self.setValue(low, high, value)
|
100
100
|
self.setFillerChar(filler)
|
101
101
|
self.setStatsAttr(stats_attr)
|
102
|
-
self.
|
102
|
+
self.set_box(box)
|
103
103
|
end
|
104
104
|
|
105
105
|
# Set the values for the widget.
|
@@ -308,7 +308,7 @@ module RNDK
|
|
308
308
|
end
|
309
309
|
|
310
310
|
# Set the background attribute of the widget.
|
311
|
-
def
|
311
|
+
def set_bg_attrib(attrib)
|
312
312
|
Ncurses.wbkgd(@win, attrib)
|
313
313
|
end
|
314
314
|
|
@@ -387,11 +387,11 @@ module RNDK
|
|
387
387
|
self.cleanTitle
|
388
388
|
|
389
389
|
# Clean up the windows.
|
390
|
-
RNDK.
|
391
|
-
RNDK.
|
390
|
+
RNDK.window_delete(@shadow_win)
|
391
|
+
RNDK.window_delete(@win)
|
392
392
|
|
393
393
|
# Clean the key bindings.
|
394
|
-
self.
|
394
|
+
self.clean_bindings(:HISTOGRAM)
|
395
395
|
|
396
396
|
# Unregister this object.
|
397
397
|
RNDK::Screen.unregister(:HISTOGRAM, self)
|
@@ -399,9 +399,9 @@ module RNDK
|
|
399
399
|
|
400
400
|
# Erase the widget from the screen.
|
401
401
|
def erase
|
402
|
-
if self.
|
403
|
-
RNDK.
|
404
|
-
RNDK.
|
402
|
+
if self.valid_widget?
|
403
|
+
RNDK.window_erase(@win)
|
404
|
+
RNDK.window_erase(@shadow_win)
|
405
405
|
end
|
406
406
|
end
|
407
407
|
|
data/lib/rndk/itemlist.rb
CHANGED
@@ -14,7 +14,7 @@ module RNDK
|
|
14
14
|
return nil
|
15
15
|
end
|
16
16
|
|
17
|
-
self.
|
17
|
+
self.set_box(box)
|
18
18
|
box_height = (@border_size * 2) + 1
|
19
19
|
|
20
20
|
# Set some basic values of the item list
|
@@ -32,7 +32,7 @@ module RNDK
|
|
32
32
|
# Set the box width. Allow an extra char in field width for cursor
|
33
33
|
field_width = self.maximumFieldWidth + 1
|
34
34
|
box_width = field_width + @label_len + 2 * @border_size
|
35
|
-
box_width = self.
|
35
|
+
box_width = self.set_title(title, box_width)
|
36
36
|
box_height += @title_lines
|
37
37
|
|
38
38
|
# Make sure we didn't extend beyond the dimensions of the window
|
@@ -137,7 +137,7 @@ module RNDK
|
|
137
137
|
end
|
138
138
|
|
139
139
|
# Set the exit type and exit.
|
140
|
-
self.
|
140
|
+
self.set_exit_type(0)
|
141
141
|
return ret
|
142
142
|
end
|
143
143
|
|
@@ -148,7 +148,7 @@ module RNDK
|
|
148
148
|
complete = false
|
149
149
|
|
150
150
|
# Set the exit type.
|
151
|
-
self.
|
151
|
+
self.set_exit_type(0)
|
152
152
|
|
153
153
|
# Draw the widget field
|
154
154
|
self.drawField(true)
|
@@ -185,13 +185,13 @@ module RNDK
|
|
185
185
|
when '$'.ord
|
186
186
|
@current_item = @list_size - 1
|
187
187
|
when RNDK::KEY_ESC
|
188
|
-
self.
|
188
|
+
self.set_exit_type(input)
|
189
189
|
complete = true
|
190
190
|
when Ncurses::ERR
|
191
|
-
self.
|
191
|
+
self.set_exit_type(input)
|
192
192
|
complete = true
|
193
193
|
when RNDK::KEY_TAB, RNDK::KEY_RETURN, Ncurses::KEY_ENTER
|
194
|
-
self.
|
194
|
+
self.set_exit_type(input)
|
195
195
|
ret = @current_item
|
196
196
|
complete = true
|
197
197
|
when RNDK::REFRESH
|
@@ -210,7 +210,7 @@ module RNDK
|
|
210
210
|
|
211
211
|
if !complete
|
212
212
|
self.drawField(true)
|
213
|
-
self.
|
213
|
+
self.set_exit_type(0)
|
214
214
|
end
|
215
215
|
|
216
216
|
@result_data = ret
|
@@ -251,7 +251,7 @@ module RNDK
|
|
251
251
|
end
|
252
252
|
|
253
253
|
# This sets the background attribute of the widget
|
254
|
-
def
|
254
|
+
def set_bg_attrib(attrib)
|
255
255
|
Ncurses.wbkgd(@win, attrib)
|
256
256
|
Ncurses.wbkgd(@field_win, attrib)
|
257
257
|
Ncurses.wbkgd(@label_win, attrib) unless @label_win.nil?
|
@@ -285,11 +285,11 @@ module RNDK
|
|
285
285
|
|
286
286
|
# This function removes the widget from the screen.
|
287
287
|
def erase
|
288
|
-
if self.
|
289
|
-
RNDK.
|
290
|
-
RNDK.
|
291
|
-
RNDK.
|
292
|
-
RNDK.
|
288
|
+
if self.valid_widget?
|
289
|
+
RNDK.window_erase(@field_win)
|
290
|
+
RNDK.window_erase(@label_win)
|
291
|
+
RNDK.window_erase(@win)
|
292
|
+
RNDK.window_erase(@shadow_win)
|
293
293
|
end
|
294
294
|
end
|
295
295
|
|
@@ -304,13 +304,13 @@ module RNDK
|
|
304
304
|
self.destroyInfo
|
305
305
|
|
306
306
|
# Delete the windows
|
307
|
-
RNDK.
|
308
|
-
RNDK.
|
309
|
-
RNDK.
|
310
|
-
RNDK.
|
307
|
+
RNDK.window_delete(@field_win)
|
308
|
+
RNDK.window_delete(@label_win)
|
309
|
+
RNDK.window_delete(@shadow_win)
|
310
|
+
RNDK.window_delete(@win)
|
311
311
|
|
312
312
|
# Clean the key bindings.
|
313
|
-
self.
|
313
|
+
self.clean_bindings(:ITEMLIST)
|
314
314
|
|
315
315
|
RNDK::Screen.unregister(:ITEMLIST, self)
|
316
316
|
end
|
@@ -318,7 +318,7 @@ module RNDK
|
|
318
318
|
# This sets multiple attributes of the widget.
|
319
319
|
def set(list, count, current, box)
|
320
320
|
self.setValues(list, count, current)
|
321
|
-
self.
|
321
|
+
self.set_box(box)
|
322
322
|
end
|
323
323
|
|
324
324
|
# This function sets the contents of the list
|
data/lib/rndk/label.rb
CHANGED
@@ -2,26 +2,41 @@ require 'rndk'
|
|
2
2
|
|
3
3
|
module RNDK
|
4
4
|
|
5
|
+
# Pop-up Label window.
|
6
|
+
#
|
5
7
|
class LABEL < RNDK::Widget
|
6
8
|
|
7
9
|
# Raw Ncurses window.
|
8
10
|
attr_accessor :win
|
9
11
|
|
10
|
-
|
12
|
+
# Creates a Label Widget.
|
13
|
+
#
|
14
|
+
# * `xplace` is the x position - can be an integer or `RNDK::LEFT`,
|
15
|
+
# `RNDK::RIGHT`, `RNDK::CENTER`.
|
16
|
+
# * `yplace` is the y position - can be an integer or `RNDK::TOP`,
|
17
|
+
# `RNDK::BOTTOM`, `RNDK::CENTER`.
|
18
|
+
# * `message` is an Array of Strings with all the lines you'd want
|
19
|
+
# to show. RNDK markup applies (see RNDK#Markup).
|
20
|
+
# * `box` if the Widget is drawn with a box outside it.
|
21
|
+
# * `shadow` turns on/off the shadow around the Widget.
|
22
|
+
#
|
23
|
+
# If the Widget cannot be created, returns `nil`.
|
24
|
+
def initialize(rndkscreen, xplace, yplace, mesg, box, shadow)
|
25
|
+
return nil if mesg.class != Array or mesg.empty?
|
26
|
+
|
11
27
|
super()
|
28
|
+
rows = mesg.size
|
12
29
|
|
13
|
-
parent_width = Ncurses.getmaxx
|
14
|
-
parent_height = Ncurses.getmaxy
|
30
|
+
parent_width = Ncurses.getmaxx rndkscreen.window
|
31
|
+
parent_height = Ncurses.getmaxy rndkscreen.window
|
15
32
|
box_width = -2**30 # -INFINITY
|
16
33
|
box_height = 0
|
17
34
|
xpos = [xplace]
|
18
35
|
ypos = [yplace]
|
19
36
|
x = 0
|
20
37
|
|
21
|
-
|
22
|
-
|
23
|
-
self.setBox box
|
24
|
-
box_height = rows + 2 * @border_size
|
38
|
+
self.set_box box
|
39
|
+
box_height = rows + 2*@border_size
|
25
40
|
|
26
41
|
@info = []
|
27
42
|
@info_len = []
|
@@ -43,7 +58,7 @@ module RNDK
|
|
43
58
|
|
44
59
|
# Create the string alignments.
|
45
60
|
(0...rows).each do |x|
|
46
|
-
@info_pos[x] = RNDK.justifyString(box_width - 2
|
61
|
+
@info_pos[x] = RNDK.justifyString(box_width - 2*@border_size,
|
47
62
|
@info_len[x],
|
48
63
|
@info_pos[x])
|
49
64
|
end
|
@@ -93,20 +108,25 @@ module RNDK
|
|
93
108
|
rndkscreen.register(:LABEL, self)
|
94
109
|
end
|
95
110
|
|
96
|
-
#
|
97
|
-
def activate(actions)
|
98
|
-
self.draw
|
111
|
+
# Obsolete entrypoint which calls Label#draw.
|
112
|
+
def activate(actions=[])
|
113
|
+
self.draw @box
|
99
114
|
end
|
100
115
|
|
101
|
-
#
|
102
|
-
|
103
|
-
|
104
|
-
|
116
|
+
# Sets multiple attributes of the Widget.
|
117
|
+
#
|
118
|
+
# See Label#initialize.
|
119
|
+
def set(mesg, box)
|
120
|
+
self.set_message mesg
|
121
|
+
self.set_box box
|
105
122
|
end
|
106
123
|
|
107
|
-
#
|
108
|
-
|
124
|
+
# Sets the contents of the Label Widget.
|
125
|
+
# @note `info` is an Array of Strings.
|
126
|
+
def set_message info
|
127
|
+
return if info.class != Array or info.empty?
|
109
128
|
|
129
|
+
info_size = info.size
|
110
130
|
# Clean out the old message.
|
111
131
|
(0...@rows).each do |x|
|
112
132
|
@info[x] = ''
|
@@ -132,10 +152,11 @@ module RNDK
|
|
132
152
|
|
133
153
|
# Redraw the label widget.
|
134
154
|
self.erase
|
135
|
-
self.draw
|
155
|
+
self.draw @box
|
136
156
|
end
|
137
157
|
|
138
|
-
|
158
|
+
# Returns current contents of the Widget.
|
159
|
+
def get_message(size)
|
139
160
|
size << @rows
|
140
161
|
return @info
|
141
162
|
end
|
@@ -148,13 +169,15 @@ module RNDK
|
|
148
169
|
super(@win)
|
149
170
|
end
|
150
171
|
|
151
|
-
#
|
152
|
-
def
|
172
|
+
# Sets the background attribute/color of the widget.
|
173
|
+
def set_bg_attrib attrib
|
153
174
|
Ncurses.wbkgd(@win, attrib)
|
154
175
|
end
|
155
176
|
|
156
|
-
#
|
157
|
-
|
177
|
+
# Draws the Label Widget on the Screen.
|
178
|
+
#
|
179
|
+
# If `box` is `true`, the Widget is drawn with a box.
|
180
|
+
def draw(box=false)
|
158
181
|
|
159
182
|
# Is there a shadow?
|
160
183
|
Draw.drawShadow(@shadow_win) unless @shadow_win.nil?
|
@@ -178,38 +201,36 @@ module RNDK
|
|
178
201
|
|
179
202
|
# This erases the label widget
|
180
203
|
def erase
|
181
|
-
RNDK.
|
182
|
-
RNDK.
|
204
|
+
RNDK.window_erase @win
|
205
|
+
RNDK.window_erase @shadow_win
|
183
206
|
end
|
184
207
|
|
185
|
-
#
|
186
|
-
#
|
187
|
-
# def move(xplace, yplace, relative, refresh_flag)
|
188
|
-
# end
|
189
|
-
|
190
|
-
# This destroys the label object pointer.
|
208
|
+
# Removes the Widget from the Screen, deleting it's
|
209
|
+
# internal windows.
|
191
210
|
def destroy
|
192
|
-
RNDK.
|
193
|
-
RNDK.
|
211
|
+
RNDK.window_delete @shadow_win
|
212
|
+
RNDK.window_delete @win
|
194
213
|
|
195
|
-
self.
|
214
|
+
self.clean_bindings :LABEL
|
196
215
|
|
197
216
|
RNDK::Screen.unregister(:LABEL, self)
|
198
217
|
end
|
199
218
|
|
200
|
-
#
|
201
|
-
|
202
|
-
|
219
|
+
# Waits for the user to press a key.
|
220
|
+
#
|
221
|
+
# If no key is provided, waits for a
|
222
|
+
# single keypress of any key.
|
223
|
+
def wait(key=0)
|
203
224
|
|
204
225
|
if key.ord == 0
|
205
|
-
code = self.getch
|
206
|
-
|
207
|
-
|
208
|
-
|
209
|
-
|
210
|
-
|
211
|
-
|
212
|
-
|
226
|
+
code = self.getch
|
227
|
+
return code
|
228
|
+
end
|
229
|
+
|
230
|
+
# Only exit when a specific key is hit
|
231
|
+
loop do
|
232
|
+
code = self.getch
|
233
|
+
break if code == key.ord
|
213
234
|
end
|
214
235
|
code
|
215
236
|
end
|
data/lib/rndk/marquee.rb
CHANGED
@@ -12,7 +12,7 @@ module RNDK
|
|
12
12
|
@width = width
|
13
13
|
@shadow = shadow
|
14
14
|
|
15
|
-
self.
|
15
|
+
self.set_box(box)
|
16
16
|
if @win.nil?
|
17
17
|
self.destroy
|
18
18
|
# return (0);
|
@@ -37,7 +37,7 @@ module RNDK
|
|
37
37
|
end
|
38
38
|
|
39
39
|
# Keep the box info, setting BorderOf()
|
40
|
-
self.
|
40
|
+
self.set_box(box)
|
41
41
|
|
42
42
|
padding = if mesg[-1] == ' ' then 0 else 1 end
|
43
43
|
|
@@ -158,11 +158,11 @@ module RNDK
|
|
158
158
|
# This destroys the widget.
|
159
159
|
def destroy
|
160
160
|
# Clean up the windows.
|
161
|
-
RNDK.
|
162
|
-
RNDK.
|
161
|
+
RNDK.window_delete(@shadow_win)
|
162
|
+
RNDK.window_delete(@win)
|
163
163
|
|
164
164
|
# Clean the key bindings.
|
165
|
-
self.
|
165
|
+
self.clean_bindings(:MARQUEE)
|
166
166
|
|
167
167
|
# Unregister this object.
|
168
168
|
RNDK::Screen.unregister(:MARQUEE, self)
|
@@ -170,14 +170,14 @@ module RNDK
|
|
170
170
|
|
171
171
|
# This erases the widget.
|
172
172
|
def erase
|
173
|
-
if self.
|
174
|
-
RNDK.
|
175
|
-
RNDK.
|
173
|
+
if self.valid_widget?
|
174
|
+
RNDK.window_erase(@win)
|
175
|
+
RNDK.window_erase(@shadow_win)
|
176
176
|
end
|
177
177
|
end
|
178
178
|
|
179
179
|
# This sets the widgets box attribute.
|
180
|
-
def
|
180
|
+
def set_box(box)
|
181
181
|
xpos = if @win.nil? then 0 else Ncurses.getbegx(@win) end
|
182
182
|
ypos = if @win.nil? then 0 else Ncurses.getbegy(@win) end
|
183
183
|
|
@@ -195,7 +195,7 @@ module RNDK
|
|
195
195
|
end
|
196
196
|
|
197
197
|
# This sets the background attribute of the widget.
|
198
|
-
def
|
198
|
+
def set_bg_attrib(attrib)
|
199
199
|
Ncurses.wbkgd(@win, attrib)
|
200
200
|
end
|
201
201
|
|
data/lib/rndk/matrix.rb
CHANGED
@@ -31,7 +31,7 @@ module RNDK
|
|
31
31
|
RNDK::BACKCHAR => Ncurses::KEY_PPAGE,
|
32
32
|
}
|
33
33
|
|
34
|
-
self.
|
34
|
+
self.set_box(box)
|
35
35
|
borderw = if @box then 1 else 0 end
|
36
36
|
|
37
37
|
# Make sure that the number of rows/cols/vrows/vcols is not zero.
|
@@ -108,7 +108,7 @@ module RNDK
|
|
108
108
|
end
|
109
109
|
max_width -= (col_space - 1)
|
110
110
|
box_width = [max_width, box_width].max
|
111
|
-
box_width = self.
|
111
|
+
box_width = self.set_title(title, box_width)
|
112
112
|
|
113
113
|
# Make sure the dimensions of the window didn't extend
|
114
114
|
# beyond the dimensions of the parent window
|
@@ -228,7 +228,7 @@ module RNDK
|
|
228
228
|
@shadow_win = nil
|
229
229
|
@callbackfn = lambda do |matrix, input|
|
230
230
|
disptype = matrix.colvanlues[matrix.col]
|
231
|
-
plainchar = Display.
|
231
|
+
plainchar = Display.filter_by_display_type(disptype, input)
|
232
232
|
charcount = matrix.info[matrix.row][matrix.col].size
|
233
233
|
|
234
234
|
if plainchar == Ncurses::ERR
|
@@ -241,7 +241,7 @@ module RNDK
|
|
241
241
|
1,
|
242
242
|
matrix.info[matrix.row][matrix.col].size + 1)
|
243
243
|
Ncurses.waddch(matrix.CurMatrixCell,
|
244
|
-
if Display.
|
244
|
+
if Display.is_hidden_display_type(disptype)
|
245
245
|
then matrix.filler
|
246
246
|
else plainchar
|
247
247
|
end)
|
@@ -307,7 +307,7 @@ module RNDK
|
|
307
307
|
end
|
308
308
|
|
309
309
|
# Set the exit type and exit.
|
310
|
-
self.
|
310
|
+
self.set_exit_type(0)
|
311
311
|
return -1
|
312
312
|
end
|
313
313
|
|
@@ -321,7 +321,7 @@ module RNDK
|
|
321
321
|
complete = false
|
322
322
|
|
323
323
|
# Set the exit type.
|
324
|
-
self.
|
324
|
+
self.set_exit_type(0)
|
325
325
|
|
326
326
|
# Move the cursor to the correct position within the cell.
|
327
327
|
if @colwidths[@ccol] == 1
|
@@ -542,11 +542,11 @@ module RNDK
|
|
542
542
|
self.drawOldCell
|
543
543
|
end
|
544
544
|
Ncurses.wrefresh self.CurMatrixCell
|
545
|
-
self.
|
545
|
+
self.set_exit_type(input)
|
546
546
|
ret = 1
|
547
547
|
complete = true
|
548
548
|
when Ncurses::ERR
|
549
|
-
self.
|
549
|
+
self.set_exit_type(input)
|
550
550
|
complete = true
|
551
551
|
when RNDK::KEY_ESC
|
552
552
|
if !@box_cell
|
@@ -556,7 +556,7 @@ module RNDK
|
|
556
556
|
self.drawOldCell
|
557
557
|
end
|
558
558
|
Ncurses.wrefresh self.CurMatrixCell
|
559
|
-
self.
|
559
|
+
self.set_exit_type(input)
|
560
560
|
complete = true
|
561
561
|
when RNDK::REFRESH
|
562
562
|
@screen.erase
|
@@ -612,7 +612,7 @@ module RNDK
|
|
612
612
|
@oldvcol = @col
|
613
613
|
|
614
614
|
# Set the exit type and exit.
|
615
|
-
self.
|
615
|
+
self.set_exit_type(0)
|
616
616
|
end
|
617
617
|
|
618
618
|
@result_data = ret
|
@@ -635,7 +635,7 @@ module RNDK
|
|
635
635
|
|
636
636
|
# If the column is only one char.
|
637
637
|
(1..@colwidths[@ccol]).each do |x|
|
638
|
-
ch = if x <= infolen && !Display.
|
638
|
+
ch = if x <= infolen && !Display.is_hidden_display_type(disptype)
|
639
639
|
then RNDK.CharOf(@info[@row][@col][x - 1])
|
640
640
|
else @filler
|
641
641
|
end
|
@@ -677,7 +677,7 @@ module RNDK
|
|
677
677
|
|
678
678
|
# Draw in the cell info.
|
679
679
|
(1..@colwidths[col]).each do |x|
|
680
|
-
ch = if x <= infolen && !Display.
|
680
|
+
ch = if x <= infolen && !Display.is_hidden_display_type(disptype)
|
681
681
|
then RNDK.CharOf(@info[vrow][vcol][x-1]).ord | highlight
|
682
682
|
else @filler
|
683
683
|
end
|
@@ -878,21 +878,21 @@ module RNDK
|
|
878
878
|
self.cleanTitle
|
879
879
|
|
880
880
|
# Clear the matrix windows.
|
881
|
-
RNDK.
|
882
|
-
(1..@vrows).each { |x| RNDK.
|
883
|
-
(1..@vcols).each { |x| RNDK.
|
881
|
+
RNDK.window_delete(@cell[0][0])
|
882
|
+
(1..@vrows).each { |x| RNDK.window_delete @cell[x][0] }
|
883
|
+
(1..@vcols).each { |x| RNDK.window_delete @cell[0][x] }
|
884
884
|
|
885
885
|
(1..@vrows).each do |x|
|
886
886
|
(1..@vcols).each do |y|
|
887
|
-
RNDK.
|
887
|
+
RNDK.window_delete @cell[x][y]
|
888
888
|
end
|
889
889
|
end
|
890
890
|
|
891
|
-
RNDK.
|
892
|
-
RNDK.
|
891
|
+
RNDK.window_delete @shadow_win
|
892
|
+
RNDK.window_delete @win
|
893
893
|
|
894
894
|
# Clean the key bindings.
|
895
|
-
self.
|
895
|
+
self.clean_bindings(:MATRIX)
|
896
896
|
|
897
897
|
# Unregister this object.
|
898
898
|
RNDK::Screen.unregister(:MATRIX, self)
|
@@ -900,21 +900,21 @@ module RNDK
|
|
900
900
|
|
901
901
|
# This function erases the matrix widget from the screen.
|
902
902
|
def erase
|
903
|
-
if self.
|
903
|
+
if self.valid_widget?
|
904
904
|
# Clear the matrix cells.
|
905
|
-
RNDK.
|
905
|
+
RNDK.window_erase @cell[0][0]
|
906
906
|
|
907
|
-
(1..@vrows).each { |x| RNDK.
|
908
|
-
(1..@vcols).each { |x| RNDK.
|
907
|
+
(1..@vrows).each { |x| RNDK.window_erase @cell[x][0] }
|
908
|
+
(1..@vcols).each { |x| RNDK.window_erase @cell[0][x] }
|
909
909
|
|
910
910
|
(1..@vrows).each do |x|
|
911
911
|
(1..@vcols).each do |y|
|
912
|
-
RNDK.
|
912
|
+
RNDK.window_erase @cell[x][y]
|
913
913
|
end
|
914
914
|
end
|
915
915
|
|
916
|
-
RNDK.
|
917
|
-
RNDK.
|
916
|
+
RNDK.window_erase @shadow_win
|
917
|
+
RNDK.window_erase @win
|
918
918
|
end
|
919
919
|
end
|
920
920
|
|
@@ -1159,7 +1159,7 @@ module RNDK
|
|
1159
1159
|
end
|
1160
1160
|
|
1161
1161
|
# This sets the background attribute of the widget.
|
1162
|
-
def
|
1162
|
+
def set_bg_attrib(attrib)
|
1163
1163
|
Ncurses.wbkgd(@win, attrib)
|
1164
1164
|
|
1165
1165
|
# TODO what the hell?
|