canis 0.0.8 → 0.0.10
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +0 -9
- data/CHANGES +3 -0
- data/README.md +5 -3
- data/examples/alpmenu.rb +9 -5
- data/examples/app.sample +2 -2
- data/examples/appemail.rb +15 -15
- data/examples/atree.rb +7 -7
- data/examples/bline.rb +19 -19
- data/examples/common/devel.rb +3 -3
- data/examples/dbdemo.rb +53 -49
- data/examples/dirtree.rb +22 -19
- data/examples/newtabbedwindow.rb +5 -5
- data/examples/newtesttabp.rb +3 -3
- data/examples/tabular.rb +11 -11
- data/examples/tasks.rb +25 -25
- data/examples/term2.rb +8 -8
- data/examples/testbuttons.rb +24 -24
- data/examples/testcombo.rb +5 -5
- data/examples/testdb.rb +6 -6
- data/examples/testfields.rb +16 -16
- data/examples/testflowlayout.rb +3 -3
- data/examples/testkeypress.rb +5 -5
- data/examples/testlistbox.rb +18 -18
- data/examples/testlistbox1.rb +17 -17
- data/examples/testmessagebox.rb +5 -5
- data/examples/testprogress.rb +6 -6
- data/examples/testree.rb +3 -3
- data/examples/testsplitlayout.rb +4 -4
- data/examples/testsplitlayout1.rb +4 -4
- data/examples/teststacklayout.rb +4 -4
- data/examples/testwsshortcuts.rb +1 -1
- data/examples/testwsshortcuts2.rb +4 -4
- data/lib/canis/core/include/colorparser.rb +4 -4
- data/lib/canis/core/include/io.rb +3 -3
- data/lib/canis/core/include/layouts/abstractlayout.rb +3 -3
- data/lib/canis/core/include/layouts/flowlayout.rb +2 -2
- data/lib/canis/core/include/layouts/stacklayout.rb +3 -3
- data/lib/canis/core/system/colormap.rb +3 -3
- data/lib/canis/core/system/window.rb +7 -4
- data/lib/canis/core/util/extras/padreader.rb +2 -2
- data/lib/canis/core/util/rcommandwindow.rb +8 -4
- data/lib/canis/core/util/rdialogs.rb +1 -1
- data/lib/canis/core/util/widgetshortcuts.rb +9 -2
- data/lib/canis/core/widgets/applicationheader.rb +6 -2
- data/lib/canis/core/widgets/divider.rb +6 -2
- data/lib/canis/core/widgets/rmenu.rb +8 -4
- data/lib/canis/core/widgets/rmessagebox.rb +2 -2
- data/lib/canis/core/widgets/rwidget.rb +15 -15
- data/lib/canis/core/widgets/scrollbar.rb +5 -2
- data/lib/canis/core/widgets/table.rb +2 -2
- data/lib/canis/core/widgets/textpad.rb +8 -8
- data/lib/canis/core/widgets/tree.rb +57 -39
- data/lib/canis/core/widgets/tree/treecellrenderer.rb +3 -3
- data/lib/canis/version.rb +1 -1
- metadata +12 -13
- data/lib/canis/core/include/.DS_Store +0 -0
@@ -23,7 +23,7 @@ module Canis
|
|
23
23
|
def ColorMap.get_color_const colorstring
|
24
24
|
# added check for fixnum if we go beyond these constants 2011-11-28
|
25
25
|
# e.g. to use full 256 colors
|
26
|
-
return colorstring if colorstring.is_a?
|
26
|
+
return colorstring if colorstring.is_a? Integer
|
27
27
|
ret = FFI::NCurses.const_get "COLOR_#{colorstring.to_s.upcase}"
|
28
28
|
end
|
29
29
|
## private
|
@@ -43,7 +43,7 @@ module Canis
|
|
43
43
|
#
|
44
44
|
# returns the colors that make up the given pair
|
45
45
|
# you may want to find what makes up $bottomcolor and set color and bgcolor with it.
|
46
|
-
# @param [
|
46
|
+
# @param [Integer] color_pair
|
47
47
|
# @return [Symbol, Symbol] foreground and backgrounf color
|
48
48
|
# @example
|
49
49
|
# color, bgcolor = get_colors_for_pair $datacolor
|
@@ -71,7 +71,7 @@ module Canis
|
|
71
71
|
# @param [Symbol] color such as :black :cyan :yellow
|
72
72
|
# @return [Boolean] true if valid, else false
|
73
73
|
def ColorMap.is_color? color
|
74
|
-
return true if color.is_a?
|
74
|
+
return true if color.is_a? Integer # so we can use 256 colors
|
75
75
|
@@colors.include? color.to_sym
|
76
76
|
end
|
77
77
|
|
@@ -4,7 +4,7 @@
|
|
4
4
|
# Author: jkepler http://github.com/mare-imbrium/canis/
|
5
5
|
# Date: Around for a long time
|
6
6
|
# License: Same as Ruby's License (http://www.ruby-lang.org/LICENSE.txt)
|
7
|
-
# Last update:
|
7
|
+
# Last update: 2017-03-09 20:43
|
8
8
|
#
|
9
9
|
# == CHANGED
|
10
10
|
# removed dead or redudant code - 2014-04-22 - 12:53
|
@@ -318,7 +318,7 @@ module Canis
|
|
318
318
|
#--
|
319
319
|
# removing some methods that not used or used once
|
320
320
|
# leaving here so we not what to do to print in these cases
|
321
|
-
def print(string, width = width)
|
321
|
+
def print(string, width = self.width)
|
322
322
|
w = width == 0? Ncurses.COLS : width
|
323
323
|
waddnstr(string.to_s, w) # changed 2011 dts
|
324
324
|
end
|
@@ -502,7 +502,7 @@ module Canis
|
|
502
502
|
# with some word in yellow, and then the line continues in red.
|
503
503
|
#
|
504
504
|
def printstring_formatted(r,c,content, color, att = Ncurses::A_NORMAL)
|
505
|
-
att = get_attrib att unless att.is_a?
|
505
|
+
att = get_attrib att unless att.is_a? Integer
|
506
506
|
chunkline = convert_to_chunk(content, color, att)
|
507
507
|
printstring_or_chunks r,c, chunkline, color, att
|
508
508
|
end # print
|
@@ -590,8 +590,11 @@ module Canis
|
|
590
590
|
# this works for newmessagebox but not for old one.
|
591
591
|
# Even now in some cases some black shows through, if the widget is printing spaces
|
592
592
|
# such as field or textview on a messagebox.
|
593
|
+
# 2016-01-14 - replacing 1 with space since junk is showing up in some cases.
|
594
|
+
space_char = " ".codepoints.first
|
593
595
|
(row-1).upto(row+height-1) do |r|
|
594
|
-
|
596
|
+
# this loop clears the screen, printing spaces does not work since ncurses does not do anything
|
597
|
+
mvwhline(r, col, space_char, len)
|
595
598
|
end
|
596
599
|
#attroff(Ncurses.COLOR_PAIR(color) | att)
|
597
600
|
|
@@ -4,7 +4,7 @@
|
|
4
4
|
* Author: jkepler (http://github.com/mare-imbrium/canis/)
|
5
5
|
* Date: 22.10.11 - 20:35
|
6
6
|
* License: Same as Ruby's License (http://www.ruby-lang.org/LICENSE.txt)
|
7
|
-
* Last update:
|
7
|
+
* Last update: 2017-03-09 23:12
|
8
8
|
|
9
9
|
== CHANGES
|
10
10
|
== TODO
|
@@ -18,7 +18,7 @@
|
|
18
18
|
# crashes in the most unlikely places. This prevceents me from having to write ternary
|
19
19
|
# e.g.
|
20
20
|
# @layout[:width].ifzero(FFI::NCurses::LINES-2)
|
21
|
-
class
|
21
|
+
class Integer
|
22
22
|
def ifzero v
|
23
23
|
return self if self != 0
|
24
24
|
return v
|
@@ -165,7 +165,11 @@ module Canis
|
|
165
165
|
@window.box 0,0
|
166
166
|
elsif @box
|
167
167
|
@window.attron(Ncurses.COLOR_PAIR($normalcolor) | Ncurses::A_REVERSE)
|
168
|
-
|
168
|
+
|
169
|
+
# 2016-01-14 - replacing 1 with space since junk is showing up in some cases.
|
170
|
+
space_char = " ".codepoints.first
|
171
|
+
#@window.mvhline 0,0,1,@width
|
172
|
+
@window.mvhline 0,0,space_char,@width
|
169
173
|
@window.printstring 0,0,@title, $normalcolor #, 'normal' if @title
|
170
174
|
@window.attroff(Ncurses.COLOR_PAIR($normalcolor) | Ncurses::A_REVERSE)
|
171
175
|
else
|
@@ -433,7 +437,7 @@ module Canis
|
|
433
437
|
# key handler of Controlphandler
|
434
438
|
# This sets +@keyint+ with the value read by window.
|
435
439
|
# This sets +@keychr+ with the +chr+ value of +ch+ if ch between 32 and 127 exclusive.
|
436
|
-
# @param [
|
440
|
+
# @param [Integer] ch is key read by window.
|
437
441
|
def handle_key ch
|
438
442
|
$log.debug " KeyDispatcher GOT KEY #{ch} "
|
439
443
|
@keyint = ch
|
@@ -454,7 +458,7 @@ module Canis
|
|
454
458
|
end
|
455
459
|
|
456
460
|
# checks the key against +@key_map+ if its set
|
457
|
-
# @param [
|
461
|
+
# @param [Integer] ch character read by +Window+
|
458
462
|
# @return [0, :UNHANDLED] 0 if processed, :UNHANDLED if not processed so higher level can process
|
459
463
|
def process_key ch
|
460
464
|
chr = nil
|
@@ -862,7 +866,7 @@ module Canis
|
|
862
866
|
|
863
867
|
# key handler of Controlphandler which overrides KeyDispatcher since we need to
|
864
868
|
# intercept KEY_ENTER
|
865
|
-
# @param [
|
869
|
+
# @param [Integer] ch is key read by window.
|
866
870
|
# WARNING: Please note that if this is used in +Viewer.view+, that +view+
|
867
871
|
# has already trapped CLOSE_KEY which is KEY_ENTER/13 for closing, so we won't get 13
|
868
872
|
# anywhere
|
@@ -297,7 +297,7 @@ def _print_message type, text, aconfig={}, &block #:nodoc:
|
|
297
297
|
if aconfig[:wait]
|
298
298
|
#try this out, if user wants a wait, then it will wait for 5 seconds, or if a key is pressed sooner
|
299
299
|
value = aconfig[:wait]
|
300
|
-
if value.is_a?
|
300
|
+
if value.is_a? Integer
|
301
301
|
value = value * 10
|
302
302
|
else
|
303
303
|
value = 50
|
@@ -245,9 +245,16 @@ module Canis
|
|
245
245
|
return w
|
246
246
|
end
|
247
247
|
def tree config={}, &block
|
248
|
-
#require 'canis/core/widgets/rtree'
|
249
248
|
require 'canis/core/widgets/tree'
|
250
|
-
events = [:TREE_WILL_EXPAND_EVENT,
|
249
|
+
events = [:TREE_WILL_EXPAND_EVENT,
|
250
|
+
:TREE_EXPANDED_EVENT,
|
251
|
+
:TREE_SELECTION_EVENT,
|
252
|
+
:PROPERTY_CHANGE,
|
253
|
+
:LEAVE,
|
254
|
+
:ENTER ,
|
255
|
+
:ENTER_ROW,
|
256
|
+
:TREE_COLLAPSED_EVENT,
|
257
|
+
:TREE_WILL_EXPAND_EVENT] # EXPAND double?
|
251
258
|
block_event = :TREE_WILL_EXPAND_EVENT
|
252
259
|
#config[:height] ||= 10
|
253
260
|
# if no width given, expand to flows width
|
@@ -8,7 +8,7 @@
|
|
8
8
|
# Author: jkepler http://github.com/mare-imbrium/canis-core/
|
9
9
|
# Date:
|
10
10
|
# License: Same as Ruby's License (http://www.ruby-lang.org/LICENSE.txt)
|
11
|
-
# Last update:
|
11
|
+
# Last update: 2016-01-13 18:42
|
12
12
|
#
|
13
13
|
# CHANGES:
|
14
14
|
# For some terminals, like xterm-256color which were not printing spaces
|
@@ -60,6 +60,8 @@ module Canis
|
|
60
60
|
@text2 ||= ""
|
61
61
|
@text_center ||= ""
|
62
62
|
@text_right ||= ""
|
63
|
+
# 2016-01-13 - added since "1" was giving problems in mvhline in some cases
|
64
|
+
@space_char = " ".codepoints.first
|
63
65
|
end
|
64
66
|
# returns value of text1, i.e. text on left of header
|
65
67
|
def getvalue
|
@@ -79,7 +81,9 @@ module Canis
|
|
79
81
|
len = Ncurses.COLS-0 if len == 0
|
80
82
|
# print a bar across the screen
|
81
83
|
@window.attron(Ncurses.COLOR_PAIR(@color_pair) | att)
|
82
|
-
|
84
|
+
# 2016-01-13 - changed since "1" was giving problems in mvhline in some cases
|
85
|
+
#@window.mvhline(@row, @col, 1, len)
|
86
|
+
@window.mvhline(@row, @col, @space_char, len)
|
83
87
|
@window.attroff(Ncurses.COLOR_PAIR(@color_pair) | att)
|
84
88
|
#print_header(@text1 + " %15s " % @text2 + " %20s" % @text_center , posy=0, posx=0)
|
85
89
|
|
@@ -98,6 +98,10 @@ module Canis
|
|
98
98
|
def repaint
|
99
99
|
woffset = 2
|
100
100
|
coffset = 1
|
101
|
+
|
102
|
+
# 2016-01-14 - replacing 1 with space since junk is showing up in some cases (in mvvline/mvhline)
|
103
|
+
space_char = " ".codepoints.first
|
104
|
+
|
101
105
|
if @parent
|
102
106
|
woffset = 0 if @parent.suppress_borders
|
103
107
|
@border_attrib ||= @parent.border_attrib
|
@@ -142,9 +146,9 @@ module Canis
|
|
142
146
|
$log.debug " XXX DIVIDER #{@row} #{@col} #{@length} "
|
143
147
|
case @side
|
144
148
|
when :right, :left
|
145
|
-
@graphic.mvvline(@row, @col,
|
149
|
+
@graphic.mvvline(@row, @col, space_char, @length)
|
146
150
|
when :top, :bottom
|
147
|
-
@graphic.mvhline(@row, @col,
|
151
|
+
@graphic.mvhline(@row, @col, space_char, @length)
|
148
152
|
end
|
149
153
|
@graphic.attroff(Ncurses.COLOR_PAIR(bordercolor) | borderatt)
|
150
154
|
_paint_marker
|
@@ -25,7 +25,6 @@ a user friendly string to identifiy the action, as well as a disabled option.
|
|
25
25
|
Same as Ruby's License (http://www.ruby-lang.org/LICENSE.txt)
|
26
26
|
|
27
27
|
=end
|
28
|
-
#require 'logger'
|
29
28
|
require 'canis'
|
30
29
|
|
31
30
|
include Canis
|
@@ -258,7 +257,7 @@ module Canis
|
|
258
257
|
end
|
259
258
|
## added 2009-01-21 12:09 NEW
|
260
259
|
def remove n
|
261
|
-
if n.is_a?
|
260
|
+
if n.is_a? Integer
|
262
261
|
@items.delete_at n
|
263
262
|
else
|
264
263
|
@items.delete n
|
@@ -735,7 +734,7 @@ module Canis
|
|
735
734
|
|
736
735
|
# set the given menu index as the current or active menu
|
737
736
|
# after closing the active menu.
|
738
|
-
# @param
|
737
|
+
# @param Integer index of menu to activate, starting 0
|
739
738
|
def set_menu index
|
740
739
|
#$log.debug "set meu: #{@active_index} #{index}"
|
741
740
|
# first leave the existing window
|
@@ -897,9 +896,14 @@ module Canis
|
|
897
896
|
@win.bkgd(Ncurses.COLOR_PAIR(5)); # <---- FIXME
|
898
897
|
len = @window.width
|
899
898
|
len = Ncurses.COLS-0 if len == 0
|
899
|
+
|
900
|
+
# 2016-01-14 - replacing 1 with space since junk is showing up in some cases.
|
901
|
+
space_char = " ".codepoints.first
|
902
|
+
|
900
903
|
# print a bar across the screen , which hopefully will not go blank in some terms
|
901
904
|
@window.attron(Ncurses.COLOR_PAIR(@color_pair) | att)
|
902
|
-
|
905
|
+
#@window.mvhline(0, 0, 1, len)
|
906
|
+
@window.mvhline(0, 0, space_char, len)
|
903
907
|
@window.attroff(Ncurses.COLOR_PAIR(@color_pair) | att)
|
904
908
|
@panel = @win.panel
|
905
909
|
return @window
|
@@ -5,7 +5,7 @@
|
|
5
5
|
# Author: jkepler http://github.com/mare-imbrium/canis/
|
6
6
|
# Date: 03.11.11 - 22:15
|
7
7
|
# License: Same as Ruby's License (http://www.ruby-lang.org/LICENSE.txt)
|
8
|
-
# Last update:
|
8
|
+
# Last update: 2017-03-09 23:14
|
9
9
|
# == CHANGES
|
10
10
|
# == TODO
|
11
11
|
# _ <ENTER> should result in OK being pressed if its default, ESC should result in cancel esp 2 time
|
@@ -423,7 +423,7 @@ module Canis
|
|
423
423
|
# e.g. a list was declared and we wish to know the selected_indices
|
424
424
|
def widget n
|
425
425
|
case n
|
426
|
-
when
|
426
|
+
when Integer
|
427
427
|
@form.widgets[n]
|
428
428
|
when String, Symbol
|
429
429
|
@form.by_name[n]
|
@@ -9,7 +9,7 @@
|
|
9
9
|
* Author: jkepler (ABCD)
|
10
10
|
* Date: 2008-11-19 12:49
|
11
11
|
* License: Same as Ruby's License (http://www.ruby-lang.org/LICENSE.txt)
|
12
|
-
* Last update:
|
12
|
+
* Last update: 2017-03-09 23:10
|
13
13
|
|
14
14
|
== CHANGES
|
15
15
|
* 2011-10-2 Added PropertyVetoException to rollback changes to property
|
@@ -47,7 +47,7 @@ end
|
|
47
47
|
# 2009-10-04 14:13 added RK after suggestion on http://www.ruby-forum.com/topic/196618#856703
|
48
48
|
# these are for 1.8 compatibility
|
49
49
|
unless "a"[0] == "a"
|
50
|
-
class
|
50
|
+
class Integer
|
51
51
|
def ord
|
52
52
|
self
|
53
53
|
end
|
@@ -177,7 +177,7 @@ module Canis
|
|
177
177
|
ch.getbyte(0)
|
178
178
|
end
|
179
179
|
# returns a string representation of a given int keycode
|
180
|
-
# @param [
|
180
|
+
# @param [Integer] keycode read by window
|
181
181
|
# In some case, such as Meta/Alt codes, the window reads two ints, but still we are using the param
|
182
182
|
# as the value returned by ?\M-a.getbyte(0) and such, which is typically 128 + key
|
183
183
|
# @return [String] a string representation which is what is to be used when binding a key to an
|
@@ -315,7 +315,7 @@ module Canis
|
|
315
315
|
# Use this in order to create a color pair with the colors
|
316
316
|
# provided, however, if user has not provided, use supplied
|
317
317
|
# default.
|
318
|
-
# @param [
|
318
|
+
# @param [Integer] color_pair created by ncurses
|
319
319
|
# @param [Symbol] color name such as white black cyan magenta red green yellow
|
320
320
|
# @param [Symbol] bgcolor name such as white black cyan magenta red green yellow
|
321
321
|
# @example get_color $promptcolor, :white, :cyan
|
@@ -330,13 +330,13 @@ module Canis
|
|
330
330
|
# convert a string to integer attribute
|
331
331
|
# FIXME: what if user wishes to OR two attribs, this will give error
|
332
332
|
# @param [String] e.g. reverse bold normal underline
|
333
|
-
# if a
|
333
|
+
# if a Integer is passed, it is returned as is assuming to be
|
334
334
|
# an attrib
|
335
335
|
def get_attrib str
|
336
336
|
return FFI::NCurses::A_NORMAL unless str
|
337
337
|
# next line allows us to do a one time conversion and keep the value
|
338
338
|
# in the same variable
|
339
|
-
if str.is_a?
|
339
|
+
if str.is_a? Integer
|
340
340
|
if [
|
341
341
|
FFI::NCurses::A_BOLD,
|
342
342
|
FFI::NCurses::A_REVERSE,
|
@@ -733,7 +733,7 @@ module Canis
|
|
733
733
|
end
|
734
734
|
|
735
735
|
h.each_pair { |name, val|
|
736
|
-
if name.is_a?
|
736
|
+
if name.is_a? Integer
|
737
737
|
name = keycode_tos name
|
738
738
|
elsif name.is_a? String
|
739
739
|
name = keycode_tos(name.getbyte(0))
|
@@ -1480,7 +1480,7 @@ module Canis
|
|
1480
1480
|
oldvalue = @color_pair
|
1481
1481
|
case val.size
|
1482
1482
|
when 1
|
1483
|
-
raise ArgumentError, "Expecting fixnum for color_pair." unless val[0].is_a?
|
1483
|
+
raise ArgumentError, "Expecting fixnum for color_pair." unless val[0].is_a? Integer
|
1484
1484
|
@color_pair = val[0]
|
1485
1485
|
@color, @bgcolor = ColorMap.get_colors_for_pair @color_pair
|
1486
1486
|
when 2
|
@@ -2295,7 +2295,7 @@ module Canis
|
|
2295
2295
|
# this accesses the field created or passed with set_label
|
2296
2296
|
#attr_reader :label
|
2297
2297
|
# this is the class of the field set in +text()+, so value is returned in same class
|
2298
|
-
# @example :
|
2298
|
+
# @example : Integer, Integer, Float
|
2299
2299
|
attr_accessor :datatype # crrently set during set_buffer
|
2300
2300
|
attr_reader :original_value # value on entering field
|
2301
2301
|
attr_accessor :overwrite_mode # true or false INSERT OVERWRITE MODE
|
@@ -2333,10 +2333,10 @@ module Canis
|
|
2333
2333
|
|
2334
2334
|
# NOTE: earlier there was some confusion over type, chars_allowed and datatype
|
2335
2335
|
# Now type and chars_allowed are merged into one.
|
2336
|
-
# If you pass a symbol such as :integer, :float or Float
|
2336
|
+
# If you pass a symbol such as :integer, :float or Float Integer then some
|
2337
2337
|
# standard chars_allowed will be used. Otherwise you may pass a regexp.
|
2338
2338
|
#
|
2339
|
-
# @param symbol :integer, :float, :alpha, :alnum, Float,
|
2339
|
+
# @param symbol :integer, :float, :alpha, :alnum, Float, Integer, Numeric, Regexp
|
2340
2340
|
def type *val
|
2341
2341
|
return @chars_allowed if val.empty?
|
2342
2342
|
|
@@ -2348,7 +2348,7 @@ module Canis
|
|
2348
2348
|
end
|
2349
2349
|
dtype = dtype.to_s.downcase.to_sym if dtype.is_a? String
|
2350
2350
|
case dtype # missing to_sym would have always failed due to to_s 2011-09-30 1.3.1
|
2351
|
-
when :integer,
|
2351
|
+
when :integer, Integer
|
2352
2352
|
@chars_allowed = /\d/
|
2353
2353
|
when :numeric, :float, Numeric, Float
|
2354
2354
|
@chars_allowed = /[\d\.]/
|
@@ -2368,7 +2368,7 @@ module Canis
|
|
2368
2368
|
# NOTE: this should return self for chaining operations and throw an exception
|
2369
2369
|
# if disabled or exceeding size
|
2370
2370
|
# @param [char] a character to add
|
2371
|
-
# @return [
|
2371
|
+
# @return [Integer] 0 if okay, -1 if not editable or exceeding length
|
2372
2372
|
def putch char
|
2373
2373
|
return -1 if !@editable
|
2374
2374
|
return -1 if !@overwrite_mode && (@buffer.length >= @maxlen)
|
@@ -2460,7 +2460,7 @@ module Canis
|
|
2460
2460
|
case dt.to_s
|
2461
2461
|
when "String"
|
2462
2462
|
return @buffer
|
2463
|
-
when "
|
2463
|
+
when "Integer"
|
2464
2464
|
return @buffer.to_i
|
2465
2465
|
when "Float"
|
2466
2466
|
return @buffer.to_f
|
@@ -3226,7 +3226,7 @@ module Canis
|
|
3226
3226
|
_color = @selected_color || _color
|
3227
3227
|
end
|
3228
3228
|
$log.debug "XXX: button #{text} STATE is #{@state} color #{_color} , bg: #{_bgcolor} "
|
3229
|
-
if _bgcolor.is_a?(
|
3229
|
+
if _bgcolor.is_a?( Integer) && _color.is_a?( Integer)
|
3230
3230
|
# i think this means they are colorpairs not colors, but what if we use colors on the 256 scale ?
|
3231
3231
|
# i don;t like this at all.
|
3232
3232
|
else
|
@@ -87,6 +87,9 @@ module Canis
|
|
87
87
|
@graphic = my_win unless @graphic
|
88
88
|
return unless @repaint_required
|
89
89
|
|
90
|
+
# 2016-01-14 - replacing 1 with space in mvvline since junk is showing up in some cases.
|
91
|
+
space_char = " ".codepoints.first
|
92
|
+
|
90
93
|
# first print a right side vertical line
|
91
94
|
#bc = $bottomcolor # dark blue
|
92
95
|
bc = $datacolor
|
@@ -97,7 +100,7 @@ module Canis
|
|
97
100
|
|
98
101
|
@graphic.attron(Ncurses.COLOR_PAIR(bordercolor) | borderatt)
|
99
102
|
#$log.debug " XXX SCROLL #{@row} #{@col} #{@length} "
|
100
|
-
@graphic.mvvline(@row+0, @col,
|
103
|
+
@graphic.mvvline(@row+0, @col, space_char, @length-0)
|
101
104
|
@graphic.attroff(Ncurses.COLOR_PAIR(bordercolor) | borderatt)
|
102
105
|
|
103
106
|
# now calculate and paint the scrollbar
|
@@ -116,7 +119,7 @@ module Canis
|
|
116
119
|
r = @row + scloc
|
117
120
|
c = @col + 0
|
118
121
|
#$log.debug " XXX SCROLLBAR #{r} #{c} #{sclen} "
|
119
|
-
@graphic.mvvline(r, c,
|
122
|
+
@graphic.mvvline(r, c, space_char, sclen)
|
120
123
|
@graphic.attroff(Ncurses.COLOR_PAIR(@scroll_pair) | borderatt)
|
121
124
|
@repaint_required = false
|
122
125
|
end
|
@@ -7,7 +7,7 @@
|
|
7
7
|
# Author: jkepler http://github.com/mare-imbrium/canis/
|
8
8
|
# Date: 2013-03-29 - 20:07
|
9
9
|
# License: Same as Ruby's License (http://www.ruby-lang.org/LICENSE.txt)
|
10
|
-
# Last update:
|
10
|
+
# Last update: 2017-03-09 23:14
|
11
11
|
# ----------------------------------------------------------------------------- #
|
12
12
|
# table.rb Copyright (C) 2012-2014 kepler
|
13
13
|
|
@@ -497,7 +497,7 @@ module Canis
|
|
497
497
|
# Convert current cursor position to a table column
|
498
498
|
# calculate column based on curpos since user may not have
|
499
499
|
# user w and b keys (:next_column)
|
500
|
-
# @return [
|
500
|
+
# @return [Integer] column index base 0
|
501
501
|
def _convert_curpos_to_column #:nodoc:
|
502
502
|
_calculate_column_offsets unless @coffsets
|
503
503
|
x = 0
|
@@ -10,7 +10,7 @@
|
|
10
10
|
# Author: jkepler http://github.com/mare-imbrium/mancurses/
|
11
11
|
# Date: 2011-11-09 - 16:59
|
12
12
|
# License: Same as Ruby's License (http://www.ruby-lang.org/LICENSE.txt)
|
13
|
-
# Last update:
|
13
|
+
# Last update: 2017-03-09 23:14
|
14
14
|
#
|
15
15
|
# == CHANGES
|
16
16
|
# - changed @content to @list since all multirow widgets use that and so do utils etc
|
@@ -1422,9 +1422,9 @@ module Canis
|
|
1422
1422
|
# First time, starts searching current line from cursor position onwards to end of file
|
1423
1423
|
# If no match, then checks from start of file to current line.
|
1424
1424
|
# @param [String, Regex] pattern to search (uses +:index+)
|
1425
|
-
# @param [
|
1426
|
-
# @param [
|
1427
|
-
# @return [Array<
|
1425
|
+
# @param [Integer] line number to start with. Optional. +nil+ means start search from current position.
|
1426
|
+
# @param [Integer] line number to end with. Optional. +nil+ means end search at end of array
|
1427
|
+
# @return [Array<Integer, Integer>] index of line where pattern found, index of offset in line.
|
1428
1428
|
# +nil+ returned if no match.
|
1429
1429
|
# NOTE:
|
1430
1430
|
# startline and endline are more for internal purposes, externally we would call this only with
|
@@ -1577,8 +1577,8 @@ module Canis
|
|
1577
1577
|
# concrete / derived classes should override this for their specific uses.
|
1578
1578
|
# Called if only a row is changed.
|
1579
1579
|
def render pad, lineno, text
|
1580
|
-
FFI::NCurses.mvwaddstr(pad,lineno, 0, @clearstring) if @clearstring
|
1581
|
-
FFI::NCurses.mvwaddstr(pad,lineno, 0, text)
|
1580
|
+
FFI::NCurses.mvwaddstr(pad, lineno, 0, @clearstring) if @clearstring
|
1581
|
+
FFI::NCurses.mvwaddstr(pad, lineno, 0, text)
|
1582
1582
|
end
|
1583
1583
|
end
|
1584
1584
|
|
@@ -1600,8 +1600,8 @@ module Canis
|
|
1600
1600
|
## messabox does have a method to paint the whole window in bg color its in rwidget.rb
|
1601
1601
|
att = NORMAL
|
1602
1602
|
FFI::NCurses.wattron(pad, @cp | att)
|
1603
|
-
FFI::NCurses.mvwaddstr(pad,lineno, 0, @clearstring) if @clearstring
|
1604
|
-
FFI::NCurses.mvwaddstr(pad,lineno, 0, @list[lineno])
|
1603
|
+
FFI::NCurses.mvwaddstr(pad, lineno, 0, @clearstring) if @clearstring
|
1604
|
+
FFI::NCurses.mvwaddstr(pad, lineno, 0, @list[lineno])
|
1605
1605
|
|
1606
1606
|
#FFI::NCurses.mvwaddstr(pad, lineno, 0, text)
|
1607
1607
|
FFI::NCurses.wattroff(pad, @cp | att)
|