rndk 0.0.1 → 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- 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/core/widget.rb
CHANGED
@@ -60,13 +60,39 @@ module RNDK
|
|
60
60
|
def erase
|
61
61
|
end
|
62
62
|
|
63
|
+
# Moves the Widget to the given position.
|
64
|
+
#
|
65
|
+
# * `xplace` and `yplace` are the new position of the Widget.
|
66
|
+
#
|
67
|
+
# * `xplace` may be an integer or one of the pre-defined
|
68
|
+
# values `RNDK::TOP`, `RNDK::BOTTOM`, and `RNDK::CENTER`.
|
69
|
+
#
|
70
|
+
# * `yplace` may be an integer or one of the pre-defined
|
71
|
+
# values `RNDK::LEFT`, `RNDK::RIGHT`, and `RNDK::CENTER`.
|
72
|
+
#
|
73
|
+
# * `relative` states whether the `xplace`/`yplace` pair is a
|
74
|
+
# relative move over it's current position or an absolute move
|
75
|
+
# over the Screen's top.
|
76
|
+
#
|
77
|
+
# For example, if `xplace = 1` and `yplace = 2` and `relative = true`,
|
78
|
+
# the Widget would move one row down and two columns right.
|
79
|
+
#
|
80
|
+
# If the value of relative was `false` then the widget would move to
|
81
|
+
# the position `(1,2)`.
|
82
|
+
#
|
83
|
+
# Do not use the values `TOP`, `BOTTOM`, `LEFT`, `RIGHT`, or `CENTER`
|
84
|
+
# when `relative = true` - weird things may happen.
|
85
|
+
#
|
86
|
+
# * `refresh_flag` is a boolean value which states whether the
|
87
|
+
# Widget will get refreshed after the move.
|
88
|
+
#
|
63
89
|
def move(xplace, yplace, relative, refresh_flag)
|
64
90
|
self.move_specific(xplace, yplace, relative, refresh_flag, [@win, @shadow_win], [])
|
65
91
|
end
|
66
92
|
|
67
93
|
def move_specific(xplace, yplace, relative, refresh_flag, windows, subwidgets)
|
68
|
-
current_x = Ncurses.getbegx
|
69
|
-
current_y = Ncurses.getbegy
|
94
|
+
current_x = Ncurses.getbegx @win
|
95
|
+
current_y = Ncurses.getbegy @win
|
70
96
|
xpos = xplace
|
71
97
|
ypos = yplace
|
72
98
|
|
@@ -90,7 +116,7 @@ module RNDK
|
|
90
116
|
|
91
117
|
# Move the window to the new location.
|
92
118
|
windows.each do |window|
|
93
|
-
RNDK.
|
119
|
+
RNDK.window_move(window, -xdiff, -ydiff)
|
94
120
|
end
|
95
121
|
|
96
122
|
subwidgets.each do |subwidget|
|
@@ -98,7 +124,7 @@ module RNDK
|
|
98
124
|
end
|
99
125
|
|
100
126
|
# Touch the windows so they 'move'
|
101
|
-
RNDK
|
127
|
+
RNDK.window_refresh @screen.window
|
102
128
|
|
103
129
|
# Redraw the window, if they asked for it
|
104
130
|
if refresh_flag
|
@@ -106,10 +132,14 @@ module RNDK
|
|
106
132
|
end
|
107
133
|
end
|
108
134
|
|
109
|
-
|
135
|
+
# Makes the Widget react to `char` just as if the user
|
136
|
+
# had pressed it.
|
137
|
+
#
|
138
|
+
# Nice to simulate batch actions on a Widget.
|
139
|
+
def inject char
|
110
140
|
end
|
111
141
|
|
112
|
-
def
|
142
|
+
def set_box(box)
|
113
143
|
@box = box
|
114
144
|
@border_size = if @box then 1 else 0 end
|
115
145
|
end
|
@@ -169,7 +199,7 @@ module RNDK
|
|
169
199
|
end
|
170
200
|
|
171
201
|
# This sets the background color of the widget.
|
172
|
-
def
|
202
|
+
def set_bg_color color
|
173
203
|
return if color.nil? || color == ''
|
174
204
|
|
175
205
|
junk1 = []
|
@@ -179,43 +209,46 @@ module RNDK
|
|
179
209
|
holder = RNDK.char2Chtype(color, junk1, junk2)
|
180
210
|
|
181
211
|
# Set the widget's background color
|
212
|
+
|
213
|
+
## FIXME BUG WTF
|
214
|
+
## What does this function do?
|
215
|
+
## Couldn't find anything on it
|
182
216
|
self.SetBackAttrObj(holder[0])
|
183
217
|
end
|
184
218
|
|
185
219
|
# Set the widget's title.
|
186
|
-
def
|
187
|
-
if
|
188
|
-
|
189
|
-
|
190
|
-
|
191
|
-
|
192
|
-
|
193
|
-
|
194
|
-
|
195
|
-
|
196
|
-
|
197
|
-
|
198
|
-
|
199
|
-
box_width = [box_width, max_width + 2 * @border_size].max
|
200
|
-
else
|
201
|
-
box_width = -(box_width - 1)
|
202
|
-
end
|
203
|
-
|
204
|
-
# For each line in the title convert from string to chtype array
|
205
|
-
title_width = box_width - (2 * @border_size)
|
206
|
-
@title = []
|
207
|
-
@title_pos = []
|
208
|
-
@title_len = []
|
209
|
-
(0...@title_lines).each do |x|
|
210
|
-
len_x = []
|
211
|
-
pos_x = []
|
212
|
-
@title << RNDK.char2Chtype(temp[x], len_x, pos_x)
|
213
|
-
@title_len.concat(len_x)
|
214
|
-
@title_pos << RNDK.justifyString(title_width, len_x[0], pos_x[0])
|
220
|
+
def set_title (title, box_width)
|
221
|
+
return if title.nil?
|
222
|
+
|
223
|
+
temp = title.split "\n"
|
224
|
+
@title_lines = temp.size
|
225
|
+
|
226
|
+
if box_width >= 0
|
227
|
+
max_width = 0
|
228
|
+
temp.each do |line|
|
229
|
+
len = []
|
230
|
+
align = []
|
231
|
+
holder = RNDK.char2Chtype(line, len, align)
|
232
|
+
max_width = [len[0], max_width].max
|
215
233
|
end
|
234
|
+
box_width = [box_width, max_width + 2 * @border_size].max
|
235
|
+
else
|
236
|
+
box_width = -(box_width - 1)
|
216
237
|
end
|
217
238
|
|
218
|
-
|
239
|
+
# For each line in the title convert from string to chtype array
|
240
|
+
title_width = box_width - (2 * @border_size)
|
241
|
+
@title = []
|
242
|
+
@title_pos = []
|
243
|
+
@title_len = []
|
244
|
+
(0...@title_lines).each do |x|
|
245
|
+
len_x = []
|
246
|
+
pos_x = []
|
247
|
+
@title << RNDK.char2Chtype(temp[x], len_x, pos_x)
|
248
|
+
@title_len.concat(len_x)
|
249
|
+
@title_pos << RNDK.justifyString(title_width, len_x[0], pos_x[0])
|
250
|
+
end
|
251
|
+
box_width
|
219
252
|
end
|
220
253
|
|
221
254
|
# Draw the widget's title
|
@@ -244,23 +277,26 @@ module RNDK
|
|
244
277
|
@post_process_data = data
|
245
278
|
end
|
246
279
|
|
247
|
-
# Set the
|
248
|
-
#
|
249
|
-
#
|
250
|
-
|
251
|
-
|
252
|
-
|
253
|
-
|
254
|
-
|
255
|
-
|
280
|
+
# Set the Widget#exit_type based on the input `char`.
|
281
|
+
#
|
282
|
+
# According to default keybindings, if `char` is:
|
283
|
+
#
|
284
|
+
# RETURN or TAB:: Sets `:NORMAL`.
|
285
|
+
# ESCAPE:: Sets `:ESCAPE_HIT`.
|
286
|
+
# Otherwise:: Unless treated specifically by the
|
287
|
+
# Widget, sets `:EARLY_EXIT`.
|
288
|
+
#
|
289
|
+
def set_exit_type char
|
290
|
+
case char
|
291
|
+
when Ncurses::ERR then @exit_type = :ERROR
|
292
|
+
when RNDK::KEY_ESC then @exit_type = :ESCAPE_HIT
|
293
|
+
when 0 then @exit_type = :EARLY_EXIT
|
256
294
|
when RNDK::KEY_TAB, Ncurses::KEY_ENTER, RNDK::KEY_RETURN
|
257
295
|
@exit_type = :NORMAL
|
258
|
-
when 0
|
259
|
-
@exit_type = :EARLY_EXIT
|
260
296
|
end
|
261
297
|
end
|
262
298
|
|
263
|
-
def
|
299
|
+
def valid_widget?
|
264
300
|
result = false
|
265
301
|
if RNDK::ALL_OBJECTS.include?(self)
|
266
302
|
result = self.validObjType(self.object_type)
|
@@ -268,47 +304,12 @@ module RNDK
|
|
268
304
|
result
|
269
305
|
end
|
270
306
|
|
271
|
-
|
272
|
-
|
273
|
-
test = self.bindableObject(rndktype)
|
274
|
-
result = Ncurses.wgetch @input_window
|
275
|
-
|
276
|
-
if result >= 0 && !(test.nil?) && test.binding_list.include?(result) &&
|
277
|
-
test.binding_list[result][0] == :getc
|
278
|
-
result = test.binding_list[result][1]
|
279
|
-
elsif test.nil? || !(test.binding_list.include?(result)) ||
|
280
|
-
test.binding_list[result][0].nil?
|
281
|
-
case result
|
282
|
-
when "\r".ord, "\n".ord
|
283
|
-
result = Ncurses::KEY_ENTER
|
284
|
-
when "\t".ord
|
285
|
-
result = RNDK::KEY_TAB
|
286
|
-
when RNDK::DELETE
|
287
|
-
result = Ncurses::KEY_DC
|
288
|
-
when "\b".ord
|
289
|
-
result = Ncurses::KEY_BACKSPACE
|
290
|
-
when RNDK::BEGOFLINE
|
291
|
-
result = Ncurses::KEY_HOME
|
292
|
-
when RNDK::ENDOFLINE
|
293
|
-
result = Ncurses::KEY_END
|
294
|
-
when RNDK::FORCHAR
|
295
|
-
result = Ncurses::KEY_RIGHT
|
296
|
-
when RNDK::BACKCHAR
|
297
|
-
result = Ncurses::KEY_LEFT
|
298
|
-
when RNDK::NEXT
|
299
|
-
result = RNDK::KEY_TAB
|
300
|
-
when RNDK::PREV
|
301
|
-
result = Ncurses::KEY_BTAB
|
302
|
-
end
|
303
|
-
end
|
304
|
-
|
305
|
-
return result
|
306
|
-
end
|
307
|
-
|
308
|
-
def getch(function_key)
|
307
|
+
# FIXME TODO What does `function_key` does?
|
308
|
+
def getch(function_key=[])
|
309
309
|
key = self.getc
|
310
310
|
function_key << (key >= Ncurses::KEY_MIN && key <= Ncurses::KEY_MAX)
|
311
|
-
|
311
|
+
|
312
|
+
key
|
312
313
|
end
|
313
314
|
|
314
315
|
def bindableObject(rndktype)
|
@@ -337,7 +338,7 @@ module RNDK
|
|
337
338
|
end
|
338
339
|
end
|
339
340
|
|
340
|
-
def
|
341
|
+
def clean_bindings(type)
|
341
342
|
obj = self.bindableObject(type)
|
342
343
|
if !(obj.nil?) && !(obj.binding_list.nil?)
|
343
344
|
obj.binding_list.clear
|
@@ -374,8 +375,11 @@ module RNDK
|
|
374
375
|
return result
|
375
376
|
end
|
376
377
|
|
377
|
-
# Allows the user to move the Widget around
|
378
|
-
# via the cursor/keypad keys.
|
378
|
+
# Allows the user to move the Widget around
|
379
|
+
# the screen via the cursor/keypad keys.
|
380
|
+
#
|
381
|
+
# `win` is the main window of the Widget - from which
|
382
|
+
# subwins derive.
|
379
383
|
#
|
380
384
|
# The following key bindings can be used to move the
|
381
385
|
# Widget around the screen:
|
@@ -402,7 +406,7 @@ module RNDK
|
|
402
406
|
# Escape:: Returns the widget to its original position.
|
403
407
|
# Return:: Exits the function and leaves the Widget where it was.
|
404
408
|
#
|
405
|
-
def position
|
409
|
+
def position win
|
406
410
|
parent = @screen.window
|
407
411
|
orig_x = Ncurses.getbegx win
|
408
412
|
orig_y = Ncurses.getbegy win
|
@@ -501,6 +505,43 @@ module RNDK
|
|
501
505
|
end
|
502
506
|
end
|
503
507
|
|
508
|
+
protected
|
509
|
+
|
510
|
+
# Gets a raw character from internal Ncurses window
|
511
|
+
# and returns the result, capped to sane values.
|
512
|
+
def getc
|
513
|
+
rndktype = self.object_type
|
514
|
+
test = self.bindableObject rndktype
|
515
|
+
result = Ncurses.wgetch @input_window
|
516
|
+
|
517
|
+
if (result >= 0) and
|
518
|
+
(not test.nil?) and
|
519
|
+
(test.binding_list.include? result) and
|
520
|
+
(test.binding_list[result][0] == :getc)
|
521
|
+
|
522
|
+
result = test.binding_list[result][1]
|
523
|
+
|
524
|
+
elsif (test.nil?) or
|
525
|
+
(not test.binding_list.include? result) or
|
526
|
+
(test.binding_list[result][0].nil?)
|
527
|
+
|
528
|
+
case result
|
529
|
+
when "\r".ord, "\n".ord then result = Ncurses::KEY_ENTER
|
530
|
+
when "\t".ord then result = RNDK::KEY_TAB
|
531
|
+
when RNDK::DELETE then result = Ncurses::KEY_DC
|
532
|
+
when "\b".ord then result = Ncurses::KEY_BACKSPACE
|
533
|
+
when RNDK::BEGOFLINE then result = Ncurses::KEY_HOME
|
534
|
+
when RNDK::ENDOFLINE then result = Ncurses::KEY_END
|
535
|
+
when RNDK::FORCHAR then result = Ncurses::KEY_RIGHT
|
536
|
+
when RNDK::BACKCHAR then result = Ncurses::KEY_LEFT
|
537
|
+
when RNDK::NEXT then result = RNDK::KEY_TAB
|
538
|
+
when RNDK::PREV then result = Ncurses::KEY_BTAB
|
539
|
+
end
|
540
|
+
end
|
541
|
+
|
542
|
+
return result
|
543
|
+
end
|
544
|
+
|
504
545
|
end
|
505
546
|
end
|
506
547
|
|
data/lib/rndk/dialog.rb
CHANGED
@@ -27,7 +27,7 @@ module RNDK
|
|
27
27
|
return nil
|
28
28
|
end
|
29
29
|
|
30
|
-
self.
|
30
|
+
self.set_box(box)
|
31
31
|
box_height = if separator then 1 else 0 end
|
32
32
|
box_height += rows + 2 * @border_size + 1
|
33
33
|
|
@@ -146,7 +146,7 @@ module RNDK
|
|
146
146
|
end
|
147
147
|
|
148
148
|
# Set the exit type and exit
|
149
|
-
self.
|
149
|
+
self.set_exit_type(0)
|
150
150
|
return -1
|
151
151
|
end
|
152
152
|
|
@@ -159,7 +159,7 @@ module RNDK
|
|
159
159
|
complete = false
|
160
160
|
|
161
161
|
# Set the exit type.
|
162
|
-
self.
|
162
|
+
self.set_exit_type(0)
|
163
163
|
|
164
164
|
# Check if there is a pre-process function to be called.
|
165
165
|
unless @pre_process_func.nil?
|
@@ -192,12 +192,12 @@ module RNDK
|
|
192
192
|
@screen.erase
|
193
193
|
@screen.refresh
|
194
194
|
when RNDK::KEY_ESC
|
195
|
-
self.
|
195
|
+
self.set_exit_type(input)
|
196
196
|
complete = true
|
197
197
|
when Ncurses::ERR
|
198
|
-
self.
|
198
|
+
self.set_exit_type(input)
|
199
199
|
when Ncurses::KEY_ENTER, RNDK::KEY_RETURN
|
200
|
-
self.
|
200
|
+
self.set_exit_type(input)
|
201
201
|
ret = @current_button
|
202
202
|
complete = true
|
203
203
|
end
|
@@ -213,7 +213,7 @@ module RNDK
|
|
213
213
|
unless complete
|
214
214
|
self.drawButtons
|
215
215
|
Ncurses.wrefresh @win
|
216
|
-
self.
|
216
|
+
self.set_exit_type(0)
|
217
217
|
end
|
218
218
|
|
219
219
|
@result_data = ret
|
@@ -257,11 +257,11 @@ module RNDK
|
|
257
257
|
# This function destroys the dialog widget.
|
258
258
|
def destroy
|
259
259
|
# Clean up the windows.
|
260
|
-
RNDK.
|
261
|
-
RNDK.
|
260
|
+
RNDK.window_delete(@win)
|
261
|
+
RNDK.window_delete(@shadow_win)
|
262
262
|
|
263
263
|
# Clean the key bindings
|
264
|
-
self.
|
264
|
+
self.clean_bindings(:DIALOG)
|
265
265
|
|
266
266
|
# Unregister this object
|
267
267
|
RNDK::Screen.unregister(:DIALOG, self)
|
@@ -269,21 +269,21 @@ module RNDK
|
|
269
269
|
|
270
270
|
# This function erases the dialog widget from the screen.
|
271
271
|
def erase
|
272
|
-
if self.
|
273
|
-
RNDK.
|
274
|
-
RNDK.
|
272
|
+
if self.valid_widget?
|
273
|
+
RNDK.window_erase(@win)
|
274
|
+
RNDK.window_erase(@shadow_win)
|
275
275
|
end
|
276
276
|
end
|
277
277
|
|
278
278
|
# This sets attributes of the dialog box.
|
279
279
|
def set(highlight, separator, box)
|
280
|
-
self.
|
280
|
+
self.set_highlight(highlight)
|
281
281
|
self.setSeparator(separator)
|
282
|
-
self.
|
282
|
+
self.set_box(box)
|
283
283
|
end
|
284
284
|
|
285
285
|
# This sets the highlight attribute for the buttons.
|
286
|
-
def
|
286
|
+
def set_highlight(highlight)
|
287
287
|
@highlight = highlight
|
288
288
|
end
|
289
289
|
|
@@ -301,7 +301,7 @@ module RNDK
|
|
301
301
|
end
|
302
302
|
|
303
303
|
# This sets the background attribute of the widget.
|
304
|
-
def
|
304
|
+
def set_bg_attrib(attrib)
|
305
305
|
Ncurses.wbkgd(@win, attrib)
|
306
306
|
end
|
307
307
|
|
data/lib/rndk/entry.rb
CHANGED
@@ -28,7 +28,7 @@ module RNDK
|
|
28
28
|
xpos = xplace
|
29
29
|
ypos = yplace
|
30
30
|
|
31
|
-
self.
|
31
|
+
self.set_box(box)
|
32
32
|
box_height = @border_size * 2 + 1
|
33
33
|
|
34
34
|
# If the field_width is a negative value, the field_width will be
|
@@ -50,7 +50,7 @@ module RNDK
|
|
50
50
|
end
|
51
51
|
|
52
52
|
old_width = box_width
|
53
|
-
box_width = self.
|
53
|
+
box_width = self.set_title(title, box_width)
|
54
54
|
horizontal_adjust = (box_width - old_width) / 2
|
55
55
|
|
56
56
|
box_height += @title_lines
|
@@ -120,7 +120,7 @@ module RNDK
|
|
120
120
|
@box_height = box_height
|
121
121
|
@disp_type = disp_type
|
122
122
|
@callbackfn = lambda do |entry, character|
|
123
|
-
plainchar = Display.
|
123
|
+
plainchar = Display.filter_by_display_type(entry, character)
|
124
124
|
|
125
125
|
if plainchar == Ncurses::ERR || entry.info.size >= entry.max
|
126
126
|
RNDK.beep
|
@@ -215,7 +215,7 @@ module RNDK
|
|
215
215
|
complete = false
|
216
216
|
|
217
217
|
# Set the exit type
|
218
|
-
self.
|
218
|
+
self.set_exit_type(0)
|
219
219
|
|
220
220
|
# Refresh the widget field.
|
221
221
|
self.drawField
|
@@ -308,7 +308,7 @@ module RNDK
|
|
308
308
|
end
|
309
309
|
end
|
310
310
|
when RNDK::KEY_ESC
|
311
|
-
self.
|
311
|
+
self.set_exit_type(input)
|
312
312
|
complete = true
|
313
313
|
when RNDK::ERASE
|
314
314
|
if @info.size != 0
|
@@ -338,14 +338,14 @@ module RNDK
|
|
338
338
|
end
|
339
339
|
when RNDK::KEY_TAB, RNDK::KEY_RETURN, Ncurses::KEY_ENTER
|
340
340
|
if @info.size >= @min
|
341
|
-
self.
|
341
|
+
self.set_exit_type(input)
|
342
342
|
ret = @info
|
343
343
|
complete = true
|
344
344
|
else
|
345
345
|
RNDK.beep
|
346
346
|
end
|
347
347
|
when Ncurses::ERR
|
348
|
-
self.
|
348
|
+
self.set_exit_type(input)
|
349
349
|
complete = true
|
350
350
|
when RNDK::REFRESH
|
351
351
|
@screen.erase
|
@@ -361,7 +361,7 @@ module RNDK
|
|
361
361
|
end
|
362
362
|
|
363
363
|
unless complete
|
364
|
-
self.
|
364
|
+
self.set_exit_type(0)
|
365
365
|
end
|
366
366
|
|
367
367
|
@result_data = ret
|
@@ -431,7 +431,7 @@ module RNDK
|
|
431
431
|
# If there is information in the field then draw it in.
|
432
432
|
if !(@info.nil?) && @info.size > 0
|
433
433
|
# Redraw the field.
|
434
|
-
if Display.
|
434
|
+
if Display.is_hidden_display_type(@disp_type)
|
435
435
|
(@left_char...@info.size).each do |x|
|
436
436
|
Ncurses.mvwaddch(@field_win, 0, x - @left_char, @hidden)
|
437
437
|
end
|
@@ -448,11 +448,11 @@ module RNDK
|
|
448
448
|
|
449
449
|
# This erases an entry widget from the screen.
|
450
450
|
def erase
|
451
|
-
if self.
|
452
|
-
RNDK.
|
453
|
-
RNDK.
|
454
|
-
RNDK.
|
455
|
-
RNDK.
|
451
|
+
if self.valid_widget?
|
452
|
+
RNDK.window_erase(@field_win)
|
453
|
+
RNDK.window_erase(@label_win)
|
454
|
+
RNDK.window_erase(@win)
|
455
|
+
RNDK.window_erase(@shadow_win)
|
456
456
|
end
|
457
457
|
end
|
458
458
|
|
@@ -460,12 +460,12 @@ module RNDK
|
|
460
460
|
def destroy
|
461
461
|
self.cleanTitle
|
462
462
|
|
463
|
-
RNDK.
|
464
|
-
RNDK.
|
465
|
-
RNDK.
|
466
|
-
RNDK.
|
463
|
+
RNDK.window_delete(@field_win)
|
464
|
+
RNDK.window_delete(@label_win)
|
465
|
+
RNDK.window_delete(@shadow_win)
|
466
|
+
RNDK.window_delete(@win)
|
467
467
|
|
468
|
-
self.
|
468
|
+
self.clean_bindings(:ENTRY)
|
469
469
|
|
470
470
|
RNDK::Screen.unregister(:ENTRY, self)
|
471
471
|
end
|
@@ -533,7 +533,7 @@ module RNDK
|
|
533
533
|
end
|
534
534
|
|
535
535
|
# This sets the background attribute of the widget.
|
536
|
-
def
|
536
|
+
def set_bg_attrib(attrib)
|
537
537
|
Ncurses.wbkgd(@win, attrib)
|
538
538
|
Ncurses.wbkgd(@field_win, attrib)
|
539
539
|
unless @label_win.nil?
|
@@ -542,7 +542,7 @@ module RNDK
|
|
542
542
|
end
|
543
543
|
|
544
544
|
# This sets the attribute of the entry field.
|
545
|
-
def
|
545
|
+
def set_highlight(highlight, cursor)
|
546
546
|
Ncurses.wbkgd(@field_win, highlight)
|
547
547
|
@field_attr = highlight
|
548
548
|
Ncurses.curs_set(cursor)
|
data/lib/rndk/fselect.rb
CHANGED
@@ -18,7 +18,7 @@ module RNDK
|
|
18
18
|
RNDK::FORCHAR => Ncurses::KEY_NPAGE,
|
19
19
|
}
|
20
20
|
|
21
|
-
self.
|
21
|
+
self.set_box(box)
|
22
22
|
|
23
23
|
# If the height is a negative value the height will be ROWS-height,
|
24
24
|
# otherwise the height will be the given height
|
@@ -312,7 +312,7 @@ module RNDK
|
|
312
312
|
# mesg[0] = copyChar (errorMessage ("<C>Cannot delete file: %s"));
|
313
313
|
# mesg[1] = copyChar (" ");
|
314
314
|
# mesg[2] = copyChar("<C>Press any key to continue.");
|
315
|
-
#
|
315
|
+
# popup_label(ScreenOf (fselect), (RNDK_CSTRING2) mesg, 3);
|
316
316
|
# freeCharList (mesg, 3);
|
317
317
|
end
|
318
318
|
end
|
@@ -392,10 +392,10 @@ module RNDK
|
|
392
392
|
|
393
393
|
# This erases the file selector from the screen.
|
394
394
|
def erase
|
395
|
-
if self.
|
395
|
+
if self.valid_widget?
|
396
396
|
@scroll_field.erase
|
397
397
|
@entry_field.erase
|
398
|
-
RNDK.
|
398
|
+
RNDK.window_erase(@win)
|
399
399
|
end
|
400
400
|
end
|
401
401
|
|
@@ -479,7 +479,7 @@ module RNDK
|
|
479
479
|
end
|
480
480
|
|
481
481
|
# Set the exit type and exit.
|
482
|
-
self.
|
482
|
+
self.set_exit_type(0)
|
483
483
|
return 0
|
484
484
|
end
|
485
485
|
|
@@ -524,7 +524,7 @@ module RNDK
|
|
524
524
|
end
|
525
525
|
|
526
526
|
if !complete
|
527
|
-
self.
|
527
|
+
self.set_exit_type(0)
|
528
528
|
end
|
529
529
|
|
530
530
|
@result_data = ret
|
@@ -545,7 +545,7 @@ module RNDK
|
|
545
545
|
|
546
546
|
# Set the attributes of the entry field/scrolling list.
|
547
547
|
self.setFillerChar(filler)
|
548
|
-
self.
|
548
|
+
self.set_highlight(highlight)
|
549
549
|
|
550
550
|
# Only do the directory stuff if the directory is not nil.
|
551
551
|
if !(directory.nil?) && directory.size > 0
|
@@ -569,7 +569,7 @@ module RNDK
|
|
569
569
|
]
|
570
570
|
|
571
571
|
# Pop up a message.
|
572
|
-
@screen.
|
572
|
+
@screen.popup_label(mesg, 4)
|
573
573
|
|
574
574
|
# Get out of here.
|
575
575
|
self.erase
|
@@ -699,9 +699,9 @@ module RNDK
|
|
699
699
|
end
|
700
700
|
|
701
701
|
# This sets the highlight bar of the scrolling list.
|
702
|
-
def
|
702
|
+
def set_highlight(highlight)
|
703
703
|
@highlight = highlight
|
704
|
-
@scroll_field.
|
704
|
+
@scroll_field.set_highlight(highlight)
|
705
705
|
end
|
706
706
|
|
707
707
|
def getHighlight
|
@@ -835,22 +835,22 @@ module RNDK
|
|
835
835
|
end
|
836
836
|
|
837
837
|
# This sets the background attribute of the widget.
|
838
|
-
def
|
839
|
-
@entry_field.
|
840
|
-
@scroll_field.
|
838
|
+
def set_bg_attrib(attrib)
|
839
|
+
@entry_field.set_bg_attrib(attrib)
|
840
|
+
@scroll_field.set_bg_attrib(attrib)
|
841
841
|
end
|
842
842
|
|
843
843
|
# This destroys the file selector.
|
844
844
|
def destroy
|
845
|
-
self.
|
845
|
+
self.clean_bindings(:FSELECT)
|
846
846
|
|
847
847
|
# Destroy the other RNDK objects
|
848
848
|
@scroll_field.destroy
|
849
849
|
@entry_field.destroy
|
850
850
|
|
851
851
|
# Free up the windows
|
852
|
-
RNDK.
|
853
|
-
RNDK.
|
852
|
+
RNDK.window_delete(@shadow_win)
|
853
|
+
RNDK.window_delete(@win)
|
854
854
|
|
855
855
|
# Clean the key bindings.
|
856
856
|
# Unregister the object.
|