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/selection.rb
CHANGED
@@ -30,7 +30,7 @@ module RNDK
|
|
30
30
|
@choice = []
|
31
31
|
@choicelen = []
|
32
32
|
|
33
|
-
self.
|
33
|
+
self.set_box(box)
|
34
34
|
|
35
35
|
# If the height is a negative value, the height will be ROWS-height,
|
36
36
|
# otherwise the height will be the given height.
|
@@ -39,7 +39,7 @@ module RNDK
|
|
39
39
|
# If the width is a negative value, the width will be COLS-width,
|
40
40
|
# otherwise the width will be the given width
|
41
41
|
box_width = RNDK.setWidgetDimension(parent_width, width, 0)
|
42
|
-
box_width = self.
|
42
|
+
box_width = self.set_title(title, box_width)
|
43
43
|
|
44
44
|
# Set the box height.
|
45
45
|
if @title_lines > box_height
|
@@ -178,7 +178,7 @@ module RNDK
|
|
178
178
|
end
|
179
179
|
|
180
180
|
# Set the exit type and return.
|
181
|
-
self.
|
181
|
+
self.set_exit_type(0)
|
182
182
|
return 0
|
183
183
|
end
|
184
184
|
|
@@ -189,7 +189,7 @@ module RNDK
|
|
189
189
|
complete = false
|
190
190
|
|
191
191
|
# Set the exit type
|
192
|
-
self.
|
192
|
+
self.set_exit_type(0)
|
193
193
|
|
194
194
|
# Draw the widget list.
|
195
195
|
self.drawList(@box)
|
@@ -238,13 +238,13 @@ module RNDK
|
|
238
238
|
RNDK.beep
|
239
239
|
end
|
240
240
|
when RNDK::KEY_ESC
|
241
|
-
self.
|
241
|
+
self.set_exit_type(input)
|
242
242
|
complete = true
|
243
243
|
when Ncurses::ERR
|
244
|
-
self.
|
244
|
+
self.set_exit_type(input)
|
245
245
|
complete = true
|
246
246
|
when Ncurses::KEY_ENTER, RNDK::KEY_TAB, RNDK::KEY_RETURN
|
247
|
-
self.
|
247
|
+
self.set_exit_type(input)
|
248
248
|
ret = 1
|
249
249
|
complete = true
|
250
250
|
when RNDK::REFRESH
|
@@ -261,7 +261,7 @@ module RNDK
|
|
261
261
|
|
262
262
|
unless complete
|
263
263
|
self.drawList(@box)
|
264
|
-
self.
|
264
|
+
self.set_exit_type(0)
|
265
265
|
end
|
266
266
|
|
267
267
|
@result_data = ret
|
@@ -355,7 +355,7 @@ module RNDK
|
|
355
355
|
end
|
356
356
|
|
357
357
|
# This sets the background attribute of the widget.
|
358
|
-
def
|
358
|
+
def set_bg_attrib(attrib)
|
359
359
|
Ncurses.wbkgd(@win, attrib)
|
360
360
|
unless @scrollbar_win.nil?
|
361
361
|
Ncurses.wbkgd(@scrollbar_win, attrib)
|
@@ -372,12 +372,12 @@ module RNDK
|
|
372
372
|
self.destroyInfo
|
373
373
|
|
374
374
|
# Clean up the windows.
|
375
|
-
RNDK.
|
376
|
-
RNDK.
|
377
|
-
RNDK.
|
375
|
+
RNDK.window_delete(@scrollbar_win)
|
376
|
+
RNDK.window_delete(@shadow_win)
|
377
|
+
RNDK.window_delete(@win)
|
378
378
|
|
379
379
|
# Clean up the key bindings
|
380
|
-
self.
|
380
|
+
self.clean_bindings(:SELECTION)
|
381
381
|
|
382
382
|
# Unregister this object.
|
383
383
|
RNDK::Screen.unregister(:SELECTION, self)
|
@@ -385,17 +385,17 @@ module RNDK
|
|
385
385
|
|
386
386
|
# This function erases the selection list from the screen.
|
387
387
|
def erase
|
388
|
-
if self.
|
389
|
-
RNDK.
|
390
|
-
RNDK.
|
388
|
+
if self.valid_widget?
|
389
|
+
RNDK.window_erase(@win)
|
390
|
+
RNDK.window_erase(@shadow_win)
|
391
391
|
end
|
392
392
|
end
|
393
393
|
|
394
394
|
# This function sets a couple of the selection list attributes
|
395
395
|
def set(highlight, choices, box)
|
396
396
|
self.setChoices(choices)
|
397
|
-
self.
|
398
|
-
self.
|
397
|
+
self.set_highlight(highlight)
|
398
|
+
self.set_box(box)
|
399
399
|
end
|
400
400
|
|
401
401
|
# This sets the selection list items.
|
@@ -434,7 +434,7 @@ module RNDK
|
|
434
434
|
return
|
435
435
|
end
|
436
436
|
|
437
|
-
self.
|
437
|
+
self.set_title(title, -(@box_width + 1))
|
438
438
|
|
439
439
|
self.setViewSize(@list_size)
|
440
440
|
end
|
@@ -444,7 +444,7 @@ module RNDK
|
|
444
444
|
end
|
445
445
|
|
446
446
|
# This sets the highlight bar.
|
447
|
-
def
|
447
|
+
def set_highlight(highlight)
|
448
448
|
@highlight = highlight
|
449
449
|
end
|
450
450
|
|
data/lib/rndk/slider.rb
CHANGED
@@ -17,7 +17,7 @@ module RNDK
|
|
17
17
|
'G' => Ncurses::KEY_END,
|
18
18
|
'$' => Ncurses::KEY_END,
|
19
19
|
}
|
20
|
-
self.
|
20
|
+
self.set_box(box)
|
21
21
|
box_height = @border_size * 2 + 1
|
22
22
|
|
23
23
|
# Set some basic values of the widget's data field.
|
@@ -42,7 +42,7 @@ module RNDK
|
|
42
42
|
end
|
43
43
|
|
44
44
|
old_width = box_width
|
45
|
-
box_width = self.
|
45
|
+
box_width = self.set_title(title, box_width)
|
46
46
|
horizontal_adjust = (box_width - old_width) / 2
|
47
47
|
|
48
48
|
box_height += @title_lines
|
@@ -164,7 +164,7 @@ module RNDK
|
|
164
164
|
end
|
165
165
|
|
166
166
|
# Set the exit type and return.
|
167
|
-
self.
|
167
|
+
self.set_exit_type(0)
|
168
168
|
return -1
|
169
169
|
end
|
170
170
|
|
@@ -256,7 +256,7 @@ module RNDK
|
|
256
256
|
Ncurses.wmove(@field_win, 0, base)
|
257
257
|
Ncurses.winnstr(@field_win, temp, need)
|
258
258
|
temp << ' '
|
259
|
-
if RNDK.
|
259
|
+
if RNDK.is_char?(input) # Replace the char at the cursor
|
260
260
|
temp[col] = input.chr
|
261
261
|
elsif input == Ncurses::KEY_BACKSPACE
|
262
262
|
# delete the char before the cursor
|
@@ -299,7 +299,7 @@ module RNDK
|
|
299
299
|
complete = false
|
300
300
|
|
301
301
|
# Set the exit type.
|
302
|
-
self.
|
302
|
+
self.set_exit_type(0)
|
303
303
|
|
304
304
|
# Draw the field.
|
305
305
|
self.drawField
|
@@ -335,14 +335,14 @@ module RNDK
|
|
335
335
|
when Ncurses::KEY_END
|
336
336
|
@current = @high
|
337
337
|
when RNDK::KEY_TAB, RNDK::KEY_RETURN, Ncurses::KEY_ENTER
|
338
|
-
self.
|
338
|
+
self.set_exit_type(input)
|
339
339
|
ret = @current
|
340
340
|
complete = true
|
341
341
|
when RNDK::KEY_ESC
|
342
|
-
self.
|
342
|
+
self.set_exit_type(input)
|
343
343
|
complete = true
|
344
344
|
when Ncurses::ERR
|
345
|
-
self.
|
345
|
+
self.set_exit_type(input)
|
346
346
|
complete = true
|
347
347
|
when RNDK::REFRESH
|
348
348
|
@screen.erase
|
@@ -380,7 +380,7 @@ module RNDK
|
|
380
380
|
|
381
381
|
if !complete
|
382
382
|
self.drawField
|
383
|
-
self.
|
383
|
+
self.set_exit_type(0)
|
384
384
|
end
|
385
385
|
|
386
386
|
@return_data = 0
|
@@ -443,7 +443,7 @@ module RNDK
|
|
443
443
|
end
|
444
444
|
|
445
445
|
# This sets the background attribute of the widget.
|
446
|
-
def
|
446
|
+
def set_bg_attrib(attrib)
|
447
447
|
# Set the widget's background attribute.
|
448
448
|
Ncurses.wbkgd(@win, attrib)
|
449
449
|
Ncurses.wbkgd(@field_win, attrib)
|
@@ -456,13 +456,13 @@ module RNDK
|
|
456
456
|
@label = []
|
457
457
|
|
458
458
|
# Clean up the windows.
|
459
|
-
RNDK.
|
460
|
-
RNDK.
|
461
|
-
RNDK.
|
462
|
-
RNDK.
|
459
|
+
RNDK.window_delete(@field_win)
|
460
|
+
RNDK.window_delete(@label_win)
|
461
|
+
RNDK.window_delete(@shadow_win)
|
462
|
+
RNDK.window_delete(@win)
|
463
463
|
|
464
464
|
# Clean the key bindings.
|
465
|
-
self.
|
465
|
+
self.clean_bindings(:SLIDER)
|
466
466
|
|
467
467
|
# Unregister this object.
|
468
468
|
RNDK::Screen.unregister(:SLIDER, self)
|
@@ -470,11 +470,11 @@ module RNDK
|
|
470
470
|
|
471
471
|
# This function erases the widget from the screen.
|
472
472
|
def erase
|
473
|
-
if self.
|
474
|
-
RNDK.
|
475
|
-
RNDK.
|
476
|
-
RNDK.
|
477
|
-
RNDK.
|
473
|
+
if self.valid_widget?
|
474
|
+
RNDK.window_erase(@label_win)
|
475
|
+
RNDK.window_erase(@field_win)
|
476
|
+
RNDK.window_erase(@lwin)
|
477
|
+
RNDK.window_erase(@shadow_win)
|
478
478
|
end
|
479
479
|
end
|
480
480
|
|
@@ -486,7 +486,7 @@ module RNDK
|
|
486
486
|
def set(low, high, value, box)
|
487
487
|
self.setLowHigh(low, high)
|
488
488
|
self.setValue(value)
|
489
|
-
self.
|
489
|
+
self.set_box(box)
|
490
490
|
end
|
491
491
|
|
492
492
|
# This sets the widget's value.
|
data/lib/rndk/swindow.rb
CHANGED
@@ -22,7 +22,7 @@ module RNDK
|
|
22
22
|
'$' => Ncurses::KEY_END,
|
23
23
|
}
|
24
24
|
|
25
|
-
self.
|
25
|
+
self.set_box(box)
|
26
26
|
|
27
27
|
# If the height is a negative value, the height will be
|
28
28
|
# ROWS-height, otherwise the height will be the given height.
|
@@ -31,7 +31,7 @@ module RNDK
|
|
31
31
|
# If the width is a negative value, the width will be
|
32
32
|
# COLS-width, otherwise the widget will be the given width.
|
33
33
|
box_width = RNDK.setWidgetDimension(parent_width, width, 0)
|
34
|
-
box_width = self.
|
34
|
+
box_width = self.set_title(title, box_width)
|
35
35
|
|
36
36
|
# Set the box height.
|
37
37
|
box_height += @title_lines + 1
|
@@ -107,7 +107,7 @@ module RNDK
|
|
107
107
|
# This sets the lines and the box attribute of the scrolling window.
|
108
108
|
def set(list, lines, box)
|
109
109
|
self.setContents(list, lines)
|
110
|
-
self.
|
110
|
+
self.set_box(box)
|
111
111
|
end
|
112
112
|
|
113
113
|
def setupLine(list, x)
|
@@ -325,7 +325,7 @@ module RNDK
|
|
325
325
|
end
|
326
326
|
|
327
327
|
# Set the exit type and return.
|
328
|
-
self.
|
328
|
+
self.set_exit_type(0)
|
329
329
|
end
|
330
330
|
|
331
331
|
# This injects a single character into the widget.
|
@@ -335,7 +335,7 @@ module RNDK
|
|
335
335
|
complete = false
|
336
336
|
|
337
337
|
# Set the exit type.
|
338
|
-
self.
|
338
|
+
self.set_exit_type(0)
|
339
339
|
|
340
340
|
# Draw the window....
|
341
341
|
self.draw(@box)
|
@@ -411,14 +411,14 @@ module RNDK
|
|
411
411
|
when 's'.ord, 'S'.ord
|
412
412
|
self.saveInformation
|
413
413
|
when RNDK::KEY_TAB, RNDK::KEY_RETURN, Ncurses::KEY_ENTER
|
414
|
-
self.
|
414
|
+
self.set_exit_type(input)
|
415
415
|
ret = 1
|
416
416
|
complete = true
|
417
417
|
when RNDK::KEY_ESC
|
418
|
-
self.
|
418
|
+
self.set_exit_type(input)
|
419
419
|
complete = true
|
420
420
|
when Ncurses::ERR
|
421
|
-
self.
|
421
|
+
self.set_exit_type(input)
|
422
422
|
complete = true
|
423
423
|
when RNDK::REFRESH
|
424
424
|
@screen.erase
|
@@ -434,7 +434,7 @@ module RNDK
|
|
434
434
|
|
435
435
|
if !complete
|
436
436
|
self.drawList(@box)
|
437
|
-
self.
|
437
|
+
self.set_exit_type(0)
|
438
438
|
end
|
439
439
|
|
440
440
|
@return_data = ret
|
@@ -498,7 +498,7 @@ module RNDK
|
|
498
498
|
end
|
499
499
|
|
500
500
|
# This sets the background attribute of the widget.
|
501
|
-
def
|
501
|
+
def set_bg_attrib(attrib)
|
502
502
|
Ncurses.wbkgd(@win, attrib)
|
503
503
|
Ncurses.wbkgd(@field_win, attrib)
|
504
504
|
end
|
@@ -517,12 +517,12 @@ module RNDK
|
|
517
517
|
self.cleanTitle
|
518
518
|
|
519
519
|
# Delete the windows.
|
520
|
-
RNDK.
|
521
|
-
RNDK.
|
522
|
-
RNDK.
|
520
|
+
RNDK.window_delete(@shadow_win)
|
521
|
+
RNDK.window_delete(@field_win)
|
522
|
+
RNDK.window_delete(@win)
|
523
523
|
|
524
524
|
# Clean the key bindings.
|
525
|
-
self.
|
525
|
+
self.clean_bindings(:SWINDOW)
|
526
526
|
|
527
527
|
# Unregister this object.
|
528
528
|
RNDK::Screen.unregister(:SWINDOW, self)
|
@@ -530,9 +530,9 @@ module RNDK
|
|
530
530
|
|
531
531
|
# This function erases the scrolling window widget.
|
532
532
|
def erase
|
533
|
-
if self.
|
534
|
-
RNDK.
|
535
|
-
RNDK.
|
533
|
+
if self.valid_widget?
|
534
|
+
RNDK.window_erase(@win)
|
535
|
+
RNDK.window_erase(@shadow_win)
|
536
536
|
end
|
537
537
|
end
|
538
538
|
|
@@ -569,7 +569,7 @@ module RNDK
|
|
569
569
|
' ',
|
570
570
|
'<C> Press any key to continue.',
|
571
571
|
]
|
572
|
-
@screen.
|
572
|
+
@screen.popup_label(mesg, mesg.size)
|
573
573
|
end
|
574
574
|
|
575
575
|
# This function allows the user to dump the information from the
|
@@ -593,7 +593,7 @@ module RNDK
|
|
593
593
|
' ',
|
594
594
|
'<C>Press any key to continue.'
|
595
595
|
]
|
596
|
-
@screen.
|
596
|
+
@screen.popup_label(mesg, 4)
|
597
597
|
|
598
598
|
# Clean up and exit.
|
599
599
|
entry.destroy
|
@@ -639,7 +639,7 @@ module RNDK
|
|
639
639
|
' ',
|
640
640
|
'<C>Press any key to continue.',
|
641
641
|
]
|
642
|
-
@screen.
|
642
|
+
@screen.popup_label(mesg, 3)
|
643
643
|
|
644
644
|
# Clean up and exit
|
645
645
|
fselect.destroy
|
data/lib/rndk/template.rb
CHANGED
@@ -15,7 +15,7 @@ module RNDK
|
|
15
15
|
return nil
|
16
16
|
end
|
17
17
|
|
18
|
-
self.
|
18
|
+
self.set_box(box)
|
19
19
|
|
20
20
|
field_width = plate.size + 2 * @border_size
|
21
21
|
|
@@ -47,7 +47,7 @@ module RNDK
|
|
47
47
|
box_width = field_width + @label_len + 2 * @border_size
|
48
48
|
|
49
49
|
old_width = box_width
|
50
|
-
box_width = self.
|
50
|
+
box_width = self.set_title(title, box_width)
|
51
51
|
horizontal_adjust = (box_width - old_width) / 2
|
52
52
|
|
53
53
|
box_height += @title_lines
|
@@ -152,7 +152,7 @@ module RNDK
|
|
152
152
|
else
|
153
153
|
failed = true
|
154
154
|
end
|
155
|
-
elsif RNDK.
|
155
|
+
elsif RNDK.is_char?(input) && @plate_pos < @plate.size
|
156
156
|
test[mark] = input.chr
|
157
157
|
change = true
|
158
158
|
amount = 1
|
@@ -215,7 +215,7 @@ module RNDK
|
|
215
215
|
end
|
216
216
|
|
217
217
|
# Set the exit type and return.
|
218
|
-
self.
|
218
|
+
self.set_exit_type(0)
|
219
219
|
return ret
|
220
220
|
end
|
221
221
|
|
@@ -225,7 +225,7 @@ module RNDK
|
|
225
225
|
complete = false
|
226
226
|
ret = -1
|
227
227
|
|
228
|
-
self.
|
228
|
+
self.set_exit_type(0)
|
229
229
|
|
230
230
|
# Move the cursor.
|
231
231
|
self.drawField
|
@@ -278,15 +278,15 @@ module RNDK
|
|
278
278
|
if @info.size < @min
|
279
279
|
RNDK.beep
|
280
280
|
else
|
281
|
-
self.
|
281
|
+
self.set_exit_type(input)
|
282
282
|
ret = @info
|
283
283
|
complete = true
|
284
284
|
end
|
285
285
|
when RNDK::KEY_ESC
|
286
|
-
self.
|
286
|
+
self.set_exit_type(input)
|
287
287
|
complete = true
|
288
288
|
when Ncurses::ERR
|
289
|
-
self.
|
289
|
+
self.set_exit_type(input)
|
290
290
|
complete = true
|
291
291
|
when RNDK::REFRESH
|
292
292
|
@screen.erase
|
@@ -303,7 +303,7 @@ module RNDK
|
|
303
303
|
end
|
304
304
|
|
305
305
|
if !complete
|
306
|
-
self.
|
306
|
+
self.set_exit_type(0)
|
307
307
|
end
|
308
308
|
|
309
309
|
@return_data = ret
|
@@ -450,7 +450,7 @@ module RNDK
|
|
450
450
|
end
|
451
451
|
|
452
452
|
# Set the background attribute of the widget.
|
453
|
-
def
|
453
|
+
def set_bg_attrib(attrib)
|
454
454
|
Ncurses.wbkgd(@win, attrib)
|
455
455
|
Ncurses.wbkgd(@field_win, attrib)
|
456
456
|
Ncurses.wbkgd(@label_win, attrib) unless @label_win.nil?
|
@@ -461,31 +461,31 @@ module RNDK
|
|
461
461
|
self.cleanTitle
|
462
462
|
|
463
463
|
# Delete the windows
|
464
|
-
RNDK.
|
465
|
-
RNDK.
|
466
|
-
RNDK.
|
467
|
-
RNDK.
|
464
|
+
RNDK.window_delete(@field_win)
|
465
|
+
RNDK.window_delete(@label_win)
|
466
|
+
RNDK.window_delete(@shadow_win)
|
467
|
+
RNDK.window_delete(@win)
|
468
468
|
|
469
469
|
# Clean the key bindings.
|
470
|
-
self.
|
470
|
+
self.clean_bindings(:TEMPLATE)
|
471
471
|
|
472
472
|
RNDK::Screen.unregister(:TEMPLATE, self)
|
473
473
|
end
|
474
474
|
|
475
475
|
# Erase the widget.
|
476
476
|
def erase
|
477
|
-
if self.
|
478
|
-
RNDK.
|
479
|
-
RNDK.
|
480
|
-
RNDK.
|
481
|
-
RNDK.
|
477
|
+
if self.valid_widget?
|
478
|
+
RNDK.window_erase(@field_win)
|
479
|
+
RNDK.window_erase(@label_win)
|
480
|
+
RNDK.window_erase(@shadow_win)
|
481
|
+
RNDK.window_erase(@win)
|
482
482
|
end
|
483
483
|
end
|
484
484
|
|
485
485
|
# Set the value given to the template
|
486
486
|
def set(new_value, box)
|
487
487
|
self.setValue(new_value)
|
488
|
-
self.
|
488
|
+
self.set_box(box)
|
489
489
|
end
|
490
490
|
|
491
491
|
# Set the value given to the template.
|
data/lib/rndk/version.rb
CHANGED
data/lib/rndk/viewer.rb
CHANGED
@@ -27,7 +27,7 @@ module RNDK
|
|
27
27
|
'$' => Ncurses::KEY_END,
|
28
28
|
}
|
29
29
|
|
30
|
-
self.
|
30
|
+
self.set_box(box)
|
31
31
|
|
32
32
|
box_height = RNDK.setWidgetDimension(parent_height, height, 0)
|
33
33
|
box_width = RNDK.setWidgetDimension(parent_width, width, 0)
|
@@ -113,16 +113,16 @@ module RNDK
|
|
113
113
|
# This function sets various attributes of the widget.
|
114
114
|
def set(title, list, list_size, button_highlight,
|
115
115
|
attr_interp, show_line_info, box)
|
116
|
-
self.
|
117
|
-
self.
|
116
|
+
self.set_title(title)
|
117
|
+
self.set_highlight(button_highlight)
|
118
118
|
self.setInfoLine(show_line_info)
|
119
|
-
self.
|
119
|
+
self.set_box(box)
|
120
120
|
return self.setInfo(list, list_size, attr_interp)
|
121
121
|
end
|
122
122
|
|
123
123
|
# This sets the title of the viewer. (A nil title is allowed.
|
124
124
|
# It just means that the viewer will not have a title when drawn.)
|
125
|
-
def
|
125
|
+
def set_title(title)
|
126
126
|
super(title, -(@box_width + 1))
|
127
127
|
@title_adj = @title_lines
|
128
128
|
|
@@ -191,7 +191,7 @@ module RNDK
|
|
191
191
|
filename = ''
|
192
192
|
if RNDK.checkForLink(list[x], filename) == 1
|
193
193
|
file_contents = []
|
194
|
-
file_len = RNDK.
|
194
|
+
file_len = RNDK.read_file(filename, file_contents)
|
195
195
|
|
196
196
|
if file_len >= 0
|
197
197
|
viewer_size += (file_len - 1)
|
@@ -226,7 +226,7 @@ module RNDK
|
|
226
226
|
file_len = 0
|
227
227
|
|
228
228
|
# Open the file and put it into the viewer
|
229
|
-
file_len = RNDK.
|
229
|
+
file_len = RNDK.read_file(filename, file_contents)
|
230
230
|
if file_len == -1
|
231
231
|
fopen_fmt = if Ncurses.has_colors?
|
232
232
|
then '<C></16>Link Failed: Could not open the file %s'
|
@@ -281,7 +281,7 @@ module RNDK
|
|
281
281
|
end
|
282
282
|
|
283
283
|
# This function sets the highlight type of the buttons.
|
284
|
-
def
|
284
|
+
def set_highlight(button_highlight)
|
285
285
|
@button_highlight = button_highlight
|
286
286
|
end
|
287
287
|
|
@@ -485,13 +485,13 @@ module RNDK
|
|
485
485
|
self.popUpLabel(file_info)
|
486
486
|
refresh = true
|
487
487
|
when RNDK::KEY_ESC
|
488
|
-
self.
|
488
|
+
self.set_exit_type(input)
|
489
489
|
return -1
|
490
490
|
when Ncurses::ERR
|
491
|
-
self.
|
491
|
+
self.set_exit_type(input)
|
492
492
|
return -1
|
493
493
|
when Ncurses::KEY_ENTER, RNDK::KEY_RETURN
|
494
|
-
self.
|
494
|
+
self.set_exit_type(input)
|
495
495
|
return @current_button
|
496
496
|
when RNDK::REFRESH
|
497
497
|
@screen.erase
|
@@ -681,7 +681,7 @@ module RNDK
|
|
681
681
|
end
|
682
682
|
|
683
683
|
# This sets the background attribute of the widget.
|
684
|
-
def
|
684
|
+
def set_bg_attrib(attrib)
|
685
685
|
Ncurses.wbkgd(@win, attrib)
|
686
686
|
end
|
687
687
|
|
@@ -698,11 +698,11 @@ module RNDK
|
|
698
698
|
self.cleanTitle
|
699
699
|
|
700
700
|
# Clean up the windows.
|
701
|
-
RNDK.
|
702
|
-
RNDK.
|
701
|
+
RNDK.window_delete(@shadow_win)
|
702
|
+
RNDK.window_delete(@win)
|
703
703
|
|
704
704
|
# Clean the key bindings.
|
705
|
-
self.
|
705
|
+
self.clean_bindings(:VIEWER)
|
706
706
|
|
707
707
|
# Unregister this object.
|
708
708
|
RNDK::Screen.unregister(:VIEWER, self)
|
@@ -710,9 +710,9 @@ module RNDK
|
|
710
710
|
|
711
711
|
# This function erases the viewer widget from the screen.
|
712
712
|
def erase
|
713
|
-
if self.
|
714
|
-
RNDK.
|
715
|
-
RNDK.
|
713
|
+
if self.valid_widget?
|
714
|
+
RNDK.window_erase(@win)
|
715
|
+
RNDK.window_erase(@shadow_win)
|
716
716
|
end
|
717
717
|
end
|
718
718
|
|