* eval.c (rb_mod_include): load modules in argument order.
* st.c (st_init_table_with_size): num_bins should be prime numbers (no decrement). * st.c (rehash): ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@2147 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
3fc04d9361
commit
e88d2cec1f
@ -1,3 +1,12 @@
|
|||||||
|
Wed Feb 27 16:30:50 2002 Yukihiro Matsumoto <matz@ruby-lang.org>
|
||||||
|
|
||||||
|
* eval.c (rb_mod_include): load modules in argument order.
|
||||||
|
|
||||||
|
* st.c (st_init_table_with_size): num_bins should be prime numbers
|
||||||
|
(no decrement).
|
||||||
|
|
||||||
|
* st.c (rehash): ditto.
|
||||||
|
|
||||||
Wed Feb 27 13:18:49 2002 WATANABE Hirofumi <eban@ruby-lang.org>
|
Wed Feb 27 13:18:49 2002 WATANABE Hirofumi <eban@ruby-lang.org>
|
||||||
|
|
||||||
* io.c (READ_DATA_PENDING): uClibc support.
|
* io.c (READ_DATA_PENDING): uClibc support.
|
||||||
|
10
eval.c
10
eval.c
@ -5791,12 +5791,12 @@ rb_mod_include(argc, argv, module)
|
|||||||
VALUE *argv;
|
VALUE *argv;
|
||||||
VALUE module;
|
VALUE module;
|
||||||
{
|
{
|
||||||
int i;
|
while (argc--) {
|
||||||
|
VALUE m = argv[argc];
|
||||||
|
|
||||||
for (i=0; i<argc; i++) {
|
Check_Type(m, T_MODULE);
|
||||||
Check_Type(argv[i], T_MODULE);
|
rb_funcall(m, rb_intern("append_features"), 1, module);
|
||||||
rb_funcall(argv[i], rb_intern("append_features"), 1, module);
|
rb_funcall(m, rb_intern("included"), 1, module);
|
||||||
rb_funcall(argv[i], rb_intern("included"), 1, module);
|
|
||||||
}
|
}
|
||||||
return module;
|
return module;
|
||||||
}
|
}
|
||||||
|
469
ext/tk/lib/tk.rb
469
ext/tk/lib/tk.rb
@ -2174,6 +2174,123 @@ module TkTreatFont
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
module TkTreatItemFont
|
||||||
|
def __conf_cmd(idx)
|
||||||
|
raise NotImplementError, "need to define `__conf_cmd'"
|
||||||
|
end
|
||||||
|
def __item_pathname(tagOrId)
|
||||||
|
raise NotImplementError, "need to define `__item_pathname'"
|
||||||
|
end
|
||||||
|
private :__conf_cmd, :__item_pathname
|
||||||
|
|
||||||
|
def tagfont_configinfo(tagOrId)
|
||||||
|
pathname = __item_pathname(tagOrId)
|
||||||
|
ret = TkFont.used_on(pathname)
|
||||||
|
if ret == nil
|
||||||
|
ret = TkFont.init_widget_font(pathname, self.path,
|
||||||
|
__conf_cmd(0), __conf_cmd(1), tagOrId)
|
||||||
|
end
|
||||||
|
ret
|
||||||
|
end
|
||||||
|
alias tagfontobj tagfont_configinfo
|
||||||
|
|
||||||
|
def tagfont_configure(tagOrId, slot)
|
||||||
|
pathname = __item_pathname(tagOrId)
|
||||||
|
if (fnt = slot.delete('font'))
|
||||||
|
if fnt.kind_of? TkFont
|
||||||
|
return fnt.call_font_configure(pathname, self.path,
|
||||||
|
__conf_cmd(0), __conf_cmd(1),
|
||||||
|
tagOrId, slot)
|
||||||
|
else
|
||||||
|
latintagfont_configure(tagOrId, fnt) if fnt
|
||||||
|
end
|
||||||
|
end
|
||||||
|
if (ltn = slot.delete('latinfont'))
|
||||||
|
latintagfont_configure(tagOrId, ltn) if ltn
|
||||||
|
end
|
||||||
|
if (ltn = slot.delete('asciifont'))
|
||||||
|
latintagfont_configure(tagOrId, ltn) if ltn
|
||||||
|
end
|
||||||
|
if (knj = slot.delete('kanjifont'))
|
||||||
|
kanjitagfont_configure(tagOrId, knj) if knj
|
||||||
|
end
|
||||||
|
|
||||||
|
tk_call(self.path, __conf_cmd(0), __conf_cmd(1),
|
||||||
|
tagOrId, *hash_kv(slot)) if slot != {}
|
||||||
|
self
|
||||||
|
end
|
||||||
|
|
||||||
|
def latintagfont_configure(tagOrId, ltn, keys=nil)
|
||||||
|
fobj = tagfontobj(tagOrId)
|
||||||
|
if ltn.kind_of? TkFont
|
||||||
|
conf = {}
|
||||||
|
ltn.latin_configinfo.each{|key,val| conf[key] = val if val != []}
|
||||||
|
if conf == {}
|
||||||
|
fobj.latin_replace(ltn)
|
||||||
|
fobj.latin_configure(keys) if keys
|
||||||
|
elsif keys
|
||||||
|
fobj.latin_configure(conf.update(keys))
|
||||||
|
else
|
||||||
|
fobj.latin_configure(conf)
|
||||||
|
end
|
||||||
|
else
|
||||||
|
fobj.latin_replace(ltn)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
alias asciitagfont_configure latintagfont_configure
|
||||||
|
|
||||||
|
def kanjitagfont_configure(tagOrId, knj, keys=nil)
|
||||||
|
fobj = tagfontobj(tagOrId)
|
||||||
|
if knj.kind_of? TkFont
|
||||||
|
conf = {}
|
||||||
|
knj.kanji_configinfo.each{|key,val| conf[key] = val if val != []}
|
||||||
|
if conf == {}
|
||||||
|
fobj.kanji_replace(knj)
|
||||||
|
fobj.kanji_configure(keys) if keys
|
||||||
|
elsif keys
|
||||||
|
fobj.kanji_configure(conf.update(keys))
|
||||||
|
else
|
||||||
|
fobj.kanji_configure(conf)
|
||||||
|
end
|
||||||
|
else
|
||||||
|
fobj.kanji_replace(knj)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
def tagfont_copy(tagOrId, window, wintag=nil)
|
||||||
|
if wintag
|
||||||
|
window.tagfontobj(wintag).configinfo.each{|key,value|
|
||||||
|
tagfontobj(tagOrId).configure(key,value)
|
||||||
|
}
|
||||||
|
tagfontobj(tagOrId).replace(window.tagfontobj(wintag).latin_font,
|
||||||
|
window.tagfontobj(wintag).kanji_font)
|
||||||
|
else
|
||||||
|
window.tagfont(wintag).configinfo.each{|key,value|
|
||||||
|
tagfontobj(tagOrId).configure(key,value)
|
||||||
|
}
|
||||||
|
tagfontobj(tagOrId).replace(window.fontobj.latin_font,
|
||||||
|
window.fontobj.kanji_font)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
def latintagfont_copy(tagOrId, window, wintag=nil)
|
||||||
|
if wintag
|
||||||
|
tagfontobj(tagOrId).latin_replace(window.tagfontobj(wintag).latin_font)
|
||||||
|
else
|
||||||
|
tagfontobj(tagOrId).latin_replace(window.fontobj.latin_font)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
alias asciitagfont_copy latintagfont_copy
|
||||||
|
|
||||||
|
def kanjitagfont_copy(tagOrId, window, wintag=nil)
|
||||||
|
if wintag
|
||||||
|
tagfontobj(tagOrId).kanji_replace(window.tagfontobj(wintag).kanji_font)
|
||||||
|
else
|
||||||
|
tagfontobj(tagOrId).kanji_replace(window.fontobj.kanji_font)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
class TkObject<TkKernel
|
class TkObject<TkKernel
|
||||||
include Tk
|
include Tk
|
||||||
include TkTreatFont
|
include TkTreatFont
|
||||||
@ -2332,10 +2449,24 @@ class TkWindow<TkObject
|
|||||||
|
|
||||||
def initialize(parent=nil, keys=nil)
|
def initialize(parent=nil, keys=nil)
|
||||||
install_win(if parent then parent.path end)
|
install_win(if parent then parent.path end)
|
||||||
create_self
|
if self.method(:create_self).arity == 0
|
||||||
if keys
|
p 'create_self has no arg' if $DEBUG
|
||||||
# tk_call @path, 'configure', *hash_kv(keys)
|
create_self
|
||||||
configure(keys)
|
if keys
|
||||||
|
# tk_call @path, 'configure', *hash_kv(keys)
|
||||||
|
configure(keys)
|
||||||
|
end
|
||||||
|
else
|
||||||
|
p 'create_self has an arg' if $DEBUG
|
||||||
|
fontkeys = {}
|
||||||
|
if keys
|
||||||
|
keys = keys.dup
|
||||||
|
['font', 'kanjifont', 'latinfont', 'asciifont'].each{|key|
|
||||||
|
fontkeys[key] = keys.delete(key) if keys.key?(key)
|
||||||
|
}
|
||||||
|
end
|
||||||
|
create_self(keys)
|
||||||
|
font_configure(fontkeys) unless fontkeys.empty?
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -2407,11 +2538,11 @@ class TkWindow<TkObject
|
|||||||
end
|
end
|
||||||
|
|
||||||
def grid_columnconfig(index, keys)
|
def grid_columnconfig(index, keys)
|
||||||
tk_call('grid', 'columnconfigure', epath, index, hash_kv(keys))
|
tk_call('grid', 'columnconfigure', epath, index, *hash_kv(keys))
|
||||||
end
|
end
|
||||||
|
|
||||||
def grid_rowconfig(index, keys)
|
def grid_rowconfig(index, keys)
|
||||||
tk_call('grid', 'rowconfigure', epath, index, hash_kv(keys))
|
tk_call('grid', 'rowconfigure', epath, index, *hash_kv(keys))
|
||||||
end
|
end
|
||||||
|
|
||||||
def grid_columnconfiginfo(index, slot=nil)
|
def grid_columnconfiginfo(index, slot=nil)
|
||||||
@ -2640,34 +2771,66 @@ class TkToplevel<TkWindow
|
|||||||
WidgetClassName
|
WidgetClassName
|
||||||
end
|
end
|
||||||
|
|
||||||
|
################# old version
|
||||||
|
# def initialize(parent=nil, screen=nil, classname=nil, keys=nil)
|
||||||
|
# if screen.kind_of? Hash
|
||||||
|
# keys = screen.dup
|
||||||
|
# else
|
||||||
|
# @screen = screen
|
||||||
|
# end
|
||||||
|
# @classname = classname
|
||||||
|
# if keys.kind_of? Hash
|
||||||
|
# keys = keys.dup
|
||||||
|
# @classname = keys.delete('classname') if keys.key?('classname')
|
||||||
|
# @colormap = keys.delete('colormap') if keys.key?('colormap')
|
||||||
|
# @container = keys.delete('container') if keys.key?('container')
|
||||||
|
# @screen = keys.delete('screen') if keys.key?('screen')
|
||||||
|
# @use = keys.delete('use') if keys.key?('use')
|
||||||
|
# @visual = keys.delete('visual') if keys.key?('visual')
|
||||||
|
# end
|
||||||
|
# super(parent, keys)
|
||||||
|
# end
|
||||||
|
#
|
||||||
|
# def create_self
|
||||||
|
# s = []
|
||||||
|
# s << "-class" << @classname if @classname
|
||||||
|
# s << "-colormap" << @colormap if @colormap
|
||||||
|
# s << "-container" << @container if @container
|
||||||
|
# s << "-screen" << @screen if @screen
|
||||||
|
# s << "-use" << @use if @use
|
||||||
|
# s << "-visual" << @visual if @visual
|
||||||
|
# tk_call 'toplevel', @path, *s
|
||||||
|
# end
|
||||||
|
#################
|
||||||
|
|
||||||
def initialize(parent=nil, screen=nil, classname=nil, keys=nil)
|
def initialize(parent=nil, screen=nil, classname=nil, keys=nil)
|
||||||
if screen.kind_of? Hash
|
if screen.kind_of? Hash
|
||||||
keys = screen.dup
|
keys = screen
|
||||||
else
|
else
|
||||||
@screen = screen
|
@screen = screen
|
||||||
end
|
end
|
||||||
@classname = classname
|
@classname = classname
|
||||||
if keys.kind_of? Hash
|
if keys.kind_of? Hash
|
||||||
keys = keys.dup
|
if keys.key?('classname')
|
||||||
@classname = keys.delete('classname') if keys.key?('classname')
|
keys = keys.dup
|
||||||
@colormap = keys.delete('colormap') if keys.key?('colormap')
|
keys['class'] = keys.delete('classname')
|
||||||
@container = keys.delete('container') if keys.key?('container')
|
end
|
||||||
@screen = keys.delete('screen') if keys.key?('screen')
|
@classname = keys['class']
|
||||||
@use = keys.delete('use') if keys.key?('use')
|
@colormap = keys['colormap']
|
||||||
@visual = keys.delete('visual') if keys.key?('visual')
|
@container = keys['container']
|
||||||
|
@screen = keys['screen']
|
||||||
|
@use = keys['use']
|
||||||
|
@visual = keys['visual']
|
||||||
end
|
end
|
||||||
super(parent, keys)
|
super(parent, keys)
|
||||||
end
|
end
|
||||||
|
|
||||||
def create_self
|
def create_self(keys)
|
||||||
s = []
|
if keys and keys != None
|
||||||
s << "-class" << @classname if @classname
|
tk_call 'toplevel', @path, *hash_kv(keys)
|
||||||
s << "-colormap" << @colormap if @colormap
|
else
|
||||||
s << "-container" << @container if @container
|
tk_call 'toplevel', @path
|
||||||
s << "-screen" << @screen if @screen
|
end
|
||||||
s << "-use" << @use if @use
|
|
||||||
s << "-visual" << @visual if @visual
|
|
||||||
tk_call 'toplevel', @path, *s
|
|
||||||
end
|
end
|
||||||
|
|
||||||
def specific_class
|
def specific_class
|
||||||
@ -2682,24 +2845,48 @@ class TkFrame<TkWindow
|
|||||||
WidgetClassName
|
WidgetClassName
|
||||||
end
|
end
|
||||||
|
|
||||||
|
################# old version
|
||||||
|
# def initialize(parent=nil, keys=nil)
|
||||||
|
# if keys.kind_of? Hash
|
||||||
|
# keys = keys.dup
|
||||||
|
# @classname = keys.delete('classname') if keys.key?('classname')
|
||||||
|
# @colormap = keys.delete('colormap') if keys.key?('colormap')
|
||||||
|
# @container = keys.delete('container') if keys.key?('container')
|
||||||
|
# @visual = keys.delete('visual') if keys.key?('visual')
|
||||||
|
# end
|
||||||
|
# super(parent, keys)
|
||||||
|
# end
|
||||||
|
#
|
||||||
|
# def create_self
|
||||||
|
# s = []
|
||||||
|
# s << "-class" << @classname if @classname
|
||||||
|
# s << "-colormap" << @colormap if @colormap
|
||||||
|
# s << "-container" << @container if @container
|
||||||
|
# s << "-visual" << @visual if @visual
|
||||||
|
# tk_call 'frame', @path, *s
|
||||||
|
# end
|
||||||
|
#################
|
||||||
|
|
||||||
def initialize(parent=nil, keys=nil)
|
def initialize(parent=nil, keys=nil)
|
||||||
if keys.kind_of? Hash
|
if keys.kind_of? Hash
|
||||||
keys = keys.dup
|
if keys.key?('classname')
|
||||||
@classname = keys.delete('classname') if keys.key?('classname')
|
keys = keys.dup
|
||||||
@colormap = keys.delete('colormap') if keys.key?('colormap')
|
keys['class'] = keys.delete('classname')
|
||||||
@container = keys.delete('container') if keys.key?('container')
|
end
|
||||||
@visual = keys.delete('visual') if keys.key?('visual')
|
@classname = keys['class']
|
||||||
|
@colormap = keys['colormap']
|
||||||
|
@container = keys['container']
|
||||||
|
@visual = keys['visual']
|
||||||
end
|
end
|
||||||
super(parent, keys)
|
super(parent, keys)
|
||||||
end
|
end
|
||||||
|
|
||||||
def create_self
|
def create_self(keys)
|
||||||
s = []
|
if keys and keys != None
|
||||||
s << "-class" << @classname if @classname
|
tk_call 'frame', @path, *hash_kv(keys)
|
||||||
s << "-colormap" << @colormap if @colormap
|
else
|
||||||
s << "-container" << @container if @container
|
tk_call 'frame', @path
|
||||||
s << "-visual" << @visual if @visual
|
end
|
||||||
tk_call 'frame', @path, *s
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -2709,8 +2896,12 @@ class TkLabel<TkWindow
|
|||||||
def self.to_eval
|
def self.to_eval
|
||||||
WidgetClassName
|
WidgetClassName
|
||||||
end
|
end
|
||||||
def create_self
|
def create_self(keys)
|
||||||
tk_call 'label', @path
|
if keys and keys != None
|
||||||
|
tk_call 'label', @path, *hash_kv(keys)
|
||||||
|
else
|
||||||
|
tk_call 'label', @path
|
||||||
|
end
|
||||||
end
|
end
|
||||||
def textvariable(v)
|
def textvariable(v)
|
||||||
configure 'textvariable', tk_trace_variable(v)
|
configure 'textvariable', tk_trace_variable(v)
|
||||||
@ -2722,8 +2913,12 @@ class TkButton<TkLabel
|
|||||||
def TkButton.to_eval
|
def TkButton.to_eval
|
||||||
'Button'
|
'Button'
|
||||||
end
|
end
|
||||||
def create_self
|
def create_self(keys)
|
||||||
tk_call 'button', @path
|
if keys and keys != None
|
||||||
|
tk_call 'button', @path, *hash_kv(keys)
|
||||||
|
else
|
||||||
|
tk_call 'button', @path
|
||||||
|
end
|
||||||
end
|
end
|
||||||
def invoke
|
def invoke
|
||||||
tk_send 'invoke'
|
tk_send 'invoke'
|
||||||
@ -2738,8 +2933,12 @@ class TkRadioButton<TkButton
|
|||||||
def TkRadioButton.to_eval
|
def TkRadioButton.to_eval
|
||||||
'Radiobutton'
|
'Radiobutton'
|
||||||
end
|
end
|
||||||
def create_self
|
def create_self(keys)
|
||||||
tk_call 'radiobutton', @path
|
if keys and keys != None
|
||||||
|
tk_call 'radiobutton', @path, *hash_kv(keys)
|
||||||
|
else
|
||||||
|
tk_call 'radiobutton', @path
|
||||||
|
end
|
||||||
end
|
end
|
||||||
def deselect
|
def deselect
|
||||||
tk_send 'deselect'
|
tk_send 'deselect'
|
||||||
@ -2758,8 +2957,12 @@ class TkCheckButton<TkRadioButton
|
|||||||
def TkCheckButton.to_eval
|
def TkCheckButton.to_eval
|
||||||
'Checkbutton'
|
'Checkbutton'
|
||||||
end
|
end
|
||||||
def create_self
|
def create_self(keys)
|
||||||
tk_call 'checkbutton', @path
|
if keys and keys != None
|
||||||
|
tk_call 'checkbutton', @path, *hash_kv(keys)
|
||||||
|
else
|
||||||
|
tk_call 'checkbutton', @path
|
||||||
|
end
|
||||||
end
|
end
|
||||||
def toggle
|
def toggle
|
||||||
tk_send 'toggle'
|
tk_send 'toggle'
|
||||||
@ -2772,8 +2975,12 @@ class TkMessage<TkLabel
|
|||||||
def TkMessage.to_eval
|
def TkMessage.to_eval
|
||||||
'Message'
|
'Message'
|
||||||
end
|
end
|
||||||
def create_self
|
def create_self(keys)
|
||||||
tk_call 'message', @path
|
if keys and keys != None
|
||||||
|
tk_call 'message', @path, *hash_kv(keys)
|
||||||
|
else
|
||||||
|
tk_call 'message', @path
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -2784,8 +2991,12 @@ class TkScale<TkWindow
|
|||||||
WidgetClassName
|
WidgetClassName
|
||||||
end
|
end
|
||||||
|
|
||||||
def create_self
|
def create_self(keys)
|
||||||
tk_call 'scale', path
|
if keys and keys != None
|
||||||
|
tk_call 'scale', @path, *hash_kv(keys)
|
||||||
|
else
|
||||||
|
tk_call 'scale', @path
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def get(x=None, y=None)
|
def get(x=None, y=None)
|
||||||
@ -2820,8 +3031,12 @@ class TkScrollbar<TkWindow
|
|||||||
WidgetClassName
|
WidgetClassName
|
||||||
end
|
end
|
||||||
|
|
||||||
def create_self
|
def create_self(keys)
|
||||||
tk_call 'scrollbar', path
|
if keys and keys != None
|
||||||
|
tk_call 'scrollbar', @path, *hash_kv(keys)
|
||||||
|
else
|
||||||
|
tk_call 'scrollbar', @path
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def delta(deltax=None, deltay=None)
|
def delta(deltax=None, deltay=None)
|
||||||
@ -2885,15 +3100,33 @@ class TkTextWin<TkWindow
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
module TkTreatListItemFont
|
||||||
|
include TkTreatItemFont
|
||||||
|
|
||||||
|
ItemCMD = ['itemconfigure', TkComm::None]
|
||||||
|
def __conf_cmd(idx)
|
||||||
|
ItemCMD[idx]
|
||||||
|
end
|
||||||
|
|
||||||
|
def __item_pathname(tagOrId)
|
||||||
|
self.path + ';' + tagOrId.to_s
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
class TkListbox<TkTextWin
|
class TkListbox<TkTextWin
|
||||||
|
include TkTreatListItemFont
|
||||||
include Scrollable
|
include Scrollable
|
||||||
|
|
||||||
WidgetClassNames['Listbox'] = self
|
WidgetClassNames['Listbox'] = self
|
||||||
def TkListbox.to_eval
|
def TkListbox.to_eval
|
||||||
'Listbox'
|
'Listbox'
|
||||||
end
|
end
|
||||||
def create_self
|
def create_self(keys)
|
||||||
tk_call 'listbox', path
|
if keys and keys != None
|
||||||
|
tk_call 'listbox', @path, *hash_kv(keys)
|
||||||
|
else
|
||||||
|
tk_call 'listbox', @path
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def activate(y)
|
def activate(y)
|
||||||
@ -2949,7 +3182,7 @@ class TkListbox<TkTextWin
|
|||||||
else
|
else
|
||||||
if (key == 'font' || key == 'kanjifont' ||
|
if (key == 'font' || key == 'kanjifont' ||
|
||||||
key == 'latinfont' || key == 'asciifont' )
|
key == 'latinfont' || key == 'asciifont' )
|
||||||
tagfont_configure({key=>val})
|
tagfont_configure(index, {key=>val})
|
||||||
else
|
else
|
||||||
tk_call 'itemconfigure', index, "-#{key}", val
|
tk_call 'itemconfigure', index, "-#{key}", val
|
||||||
end
|
end
|
||||||
@ -2995,109 +3228,15 @@ class TkListbox<TkTextWin
|
|||||||
end
|
end
|
||||||
|
|
||||||
module TkTreatMenuEntryFont
|
module TkTreatMenuEntryFont
|
||||||
def tagfont_configinfo(index)
|
include TkTreatItemFont
|
||||||
pathname = self.path + ';' + index
|
|
||||||
ret = TkFont.used_on(pathname)
|
|
||||||
if ret == nil
|
|
||||||
ret = TkFont.init_widget_font(pathname,
|
|
||||||
self.path, 'entryconfigure', index)
|
|
||||||
end
|
|
||||||
ret
|
|
||||||
end
|
|
||||||
alias tagfontobj tagfont_configinfo
|
|
||||||
|
|
||||||
def tagfont_configure(index, slot)
|
ItemCMD = ['entryconfigure', TkComm::None]
|
||||||
pathname = self.path + ';' + index
|
def __conf_cmd(idx)
|
||||||
if (fnt = slot.delete('font'))
|
ItemCMD[idx]
|
||||||
if fnt.kind_of? TkFont
|
|
||||||
return fnt.call_font_configure(pathname,
|
|
||||||
self.path,'entryconfigure',index,slot)
|
|
||||||
else
|
|
||||||
latintagfont_configure(index, fnt) if fnt
|
|
||||||
end
|
|
||||||
end
|
|
||||||
if (ltn = slot.delete('latinfont'))
|
|
||||||
latintagfont_configure(index, ltn) if ltn
|
|
||||||
end
|
|
||||||
if (ltn = slot.delete('asciifont'))
|
|
||||||
latintagfont_configure(index, ltn) if ltn
|
|
||||||
end
|
|
||||||
if (knj = slot.delete('kanjifont'))
|
|
||||||
kanjitagfont_configure(index, knj) if knj
|
|
||||||
end
|
|
||||||
|
|
||||||
tk_call(self.path, 'entryconfigure', index, *hash_kv(slot)) if slot != {}
|
|
||||||
self
|
|
||||||
end
|
end
|
||||||
|
|
||||||
def latintagfont_configure(index, ltn, keys=nil)
|
def __item_pathname(tagOrId)
|
||||||
fobj = tagfontobj(index)
|
self.path + ';' + tagOrId.to_s
|
||||||
if ltn.kind_of? TkFont
|
|
||||||
conf = {}
|
|
||||||
ltn.latin_configinfo.each{|key,val| conf[key] = val if val != []}
|
|
||||||
if conf == {}
|
|
||||||
fobj.latin_replace(ltn)
|
|
||||||
fobj.latin_configure(keys) if keys
|
|
||||||
elsif keys
|
|
||||||
fobj.latin_configure(conf.update(keys))
|
|
||||||
else
|
|
||||||
fobj.latin_configure(conf)
|
|
||||||
end
|
|
||||||
else
|
|
||||||
fobj.latin_replace(ltn)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
alias asciitagfont_configure latintagfont_configure
|
|
||||||
|
|
||||||
def kanjitagfont_configure(index, knj, keys=nil)
|
|
||||||
fobj = tagfontobj(index)
|
|
||||||
if knj.kind_of? TkFont
|
|
||||||
conf = {}
|
|
||||||
knj.kanji_configinfo.each{|key,val| conf[key] = val if val != []}
|
|
||||||
if conf == {}
|
|
||||||
fobj.kanji_replace(knj)
|
|
||||||
fobj.kanji_configure(keys) if keys
|
|
||||||
elsif keys
|
|
||||||
fobj.kanji_configure(conf.update(keys))
|
|
||||||
else
|
|
||||||
fobj.kanji_configure(conf)
|
|
||||||
end
|
|
||||||
else
|
|
||||||
fobj.kanji_replace(knj)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
def tagfont_copy(index, window, wintag=nil)
|
|
||||||
if wintag
|
|
||||||
window.tagfontobj(wintag).configinfo.each{|key,value|
|
|
||||||
tagfontobj(index).configure(key,value)
|
|
||||||
}
|
|
||||||
tagfontobj(index).replace(window.tagfontobj(wintag).latin_font,
|
|
||||||
window.tagfontobj(wintag).kanji_font)
|
|
||||||
else
|
|
||||||
window.tagfont(wintag).configinfo.each{|key,value|
|
|
||||||
tagfontobj(index).configure(key,value)
|
|
||||||
}
|
|
||||||
tagfontobj(index).replace(window.fontobj.latin_font,
|
|
||||||
window.fontobj.kanji_font)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
def latintagfont_copy(index, window, wintag=nil)
|
|
||||||
if wintag
|
|
||||||
tagfontobj(index).latin_replace(window.tagfontobj(wintag).latin_font)
|
|
||||||
else
|
|
||||||
tagfontobj(index).latin_replace(window.fontobj.latin_font)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
alias asciitagfont_copy latintagfont_copy
|
|
||||||
|
|
||||||
def kanjitagfont_copy(index, window, wintag=nil)
|
|
||||||
if wintag
|
|
||||||
tagfontobj(index).kanji_replace(window.tagfontobj(wintag).kanji_font)
|
|
||||||
else
|
|
||||||
tagfontobj(index).kanji_replace(window.fontobj.kanji_font)
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -3109,8 +3248,12 @@ class TkMenu<TkWindow
|
|||||||
def self.to_eval
|
def self.to_eval
|
||||||
WidgetClassName
|
WidgetClassName
|
||||||
end
|
end
|
||||||
def create_self
|
def create_self(keys)
|
||||||
tk_call 'menu', path
|
if keys and keys != None
|
||||||
|
tk_call 'menu', @path, *hash_kv(keys)
|
||||||
|
else
|
||||||
|
tk_call 'menu', @path
|
||||||
|
end
|
||||||
end
|
end
|
||||||
def activate(index)
|
def activate(index)
|
||||||
tk_send 'activate', index
|
tk_send 'activate', index
|
||||||
@ -3235,8 +3378,14 @@ module TkSystemMenu
|
|||||||
fail unless parent.kind_of? TkMenu
|
fail unless parent.kind_of? TkMenu
|
||||||
@path = format("%s.%s", parent.path, self.type::SYSMENU_NAME)
|
@path = format("%s.%s", parent.path, self.type::SYSMENU_NAME)
|
||||||
TkComm::Tk_WINDOWS[@path] = self
|
TkComm::Tk_WINDOWS[@path] = self
|
||||||
create_self
|
if self.method(:create_self).arity == 0
|
||||||
configure(keys) if keys
|
p 'create_self has no arg' if $DEBUG
|
||||||
|
create_self
|
||||||
|
configure(keys) if keys
|
||||||
|
else
|
||||||
|
p 'create_self has an arg' if $DEBUG
|
||||||
|
create_self(keys)
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -3263,8 +3412,12 @@ class TkMenubutton<TkLabel
|
|||||||
def TkMenubutton.to_eval
|
def TkMenubutton.to_eval
|
||||||
'Menubutton'
|
'Menubutton'
|
||||||
end
|
end
|
||||||
def create_self
|
def create_self(keys)
|
||||||
tk_call 'menubutton', path
|
if keys and keys != None
|
||||||
|
tk_call 'menubutton', @path, *hash_kv(keys)
|
||||||
|
else
|
||||||
|
tk_call 'menubutton', @path
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
#
|
|
||||||
# tkcanvas.rb - Tk canvas classes
|
# tkcanvas.rb - Tk canvas classes
|
||||||
# $Date$
|
# $Date$
|
||||||
# by Yukihiro Matsumoto <matz@caelum.co.jp>
|
# by Yukihiro Matsumoto <matz@caelum.co.jp>
|
||||||
@ -9,116 +9,18 @@ require "tk"
|
|||||||
require 'tkfont'
|
require 'tkfont'
|
||||||
|
|
||||||
module TkTreatCItemFont
|
module TkTreatCItemFont
|
||||||
def tagfont_configinfo(tagOrId)
|
include TkTreatItemFont
|
||||||
|
|
||||||
|
ItemCMD = ['itemconfigure', TkComm::None]
|
||||||
|
def __conf_cmd(idx)
|
||||||
|
ItemCMD[idx]
|
||||||
|
end
|
||||||
|
|
||||||
|
def __item_pathname(tagOrId)
|
||||||
if tagOrId.kind_of?(TkcItem) || tagOrId.kind_of?(TkcTag)
|
if tagOrId.kind_of?(TkcItem) || tagOrId.kind_of?(TkcTag)
|
||||||
pathname = self.path + ';' + tagOrId.id.to_s
|
self.path + ';' + tagOrId.id.to_s
|
||||||
else
|
else
|
||||||
pathname = self.path + ';' + tagOrId.to_s
|
self.path + ';' + tagOrId.to_s
|
||||||
end
|
|
||||||
ret = TkFont.used_on(pathname)
|
|
||||||
if ret == nil
|
|
||||||
ret = TkFont.init_widget_font(pathname,
|
|
||||||
self.path, 'itemconfigure', tagOrId)
|
|
||||||
end
|
|
||||||
ret
|
|
||||||
end
|
|
||||||
alias tagfontobj tagfont_configinfo
|
|
||||||
|
|
||||||
def tagfont_configure(tagOrId, slot)
|
|
||||||
if tagOrId.kind_of?(TkcItem) || tagOrId.kind_of?(TkcTag)
|
|
||||||
pathname = self.path + ';' + tagOrId.id.to_s
|
|
||||||
else
|
|
||||||
pathname = self.path + ';' + tagOrId.to_s
|
|
||||||
end
|
|
||||||
if (fnt = slot.delete('font'))
|
|
||||||
if fnt.kind_of? TkFont
|
|
||||||
return fnt.call_font_configure(pathname,
|
|
||||||
self.path,'itemconfigure',tagOrId,slot)
|
|
||||||
else
|
|
||||||
latintagfont_configure(tagOrId, fnt) if fnt
|
|
||||||
end
|
|
||||||
end
|
|
||||||
if (ltn = slot.delete('latinfont'))
|
|
||||||
latintagfont_configure(tagOrId, ltn) if ltn
|
|
||||||
end
|
|
||||||
if (ltn = slot.delete('asciifont'))
|
|
||||||
latintagfont_configure(tagOrId, ltn) if ltn
|
|
||||||
end
|
|
||||||
if (knj = slot.delete('kanjifont'))
|
|
||||||
kanjitagfont_configure(tagOrId, knj) if knj
|
|
||||||
end
|
|
||||||
|
|
||||||
tk_call(self.path, 'itemconfigure', tagOrId, *hash_kv(slot)) if slot != {}
|
|
||||||
self
|
|
||||||
end
|
|
||||||
|
|
||||||
def latintagfont_configure(tagOrId, ltn, keys=nil)
|
|
||||||
fobj = tagfontobj(tagOrId)
|
|
||||||
if ltn.kind_of? TkFont
|
|
||||||
conf = {}
|
|
||||||
ltn.latin_configinfo.each{|key,val| conf[key] = val if val != []}
|
|
||||||
if conf == {}
|
|
||||||
fobj.latin_replace(ltn)
|
|
||||||
fobj.latin_configure(keys) if keys
|
|
||||||
elsif keys
|
|
||||||
fobj.latin_configure(conf.update(keys))
|
|
||||||
else
|
|
||||||
fobj.latin_configure(conf)
|
|
||||||
end
|
|
||||||
else
|
|
||||||
fobj.latin_replace(ltn)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
alias asciitagfont_configure latintagfont_configure
|
|
||||||
|
|
||||||
def kanjitagfont_configure(tagOrId, knj, keys=nil)
|
|
||||||
fobj = tagfontobj(tagOrId)
|
|
||||||
if knj.kind_of? TkFont
|
|
||||||
conf = {}
|
|
||||||
knj.kanji_configinfo.each{|key,val| conf[key] = val if val != []}
|
|
||||||
if conf == {}
|
|
||||||
fobj.kanji_replace(knj)
|
|
||||||
fobj.kanji_configure(keys) if keys
|
|
||||||
elsif keys
|
|
||||||
fobj.kanji_configure(conf.update(keys))
|
|
||||||
else
|
|
||||||
fobj.kanji_configure(conf)
|
|
||||||
end
|
|
||||||
else
|
|
||||||
fobj.kanji_replace(knj)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
def tagfont_copy(tagOrId, window, wintag=nil)
|
|
||||||
if wintag
|
|
||||||
window.tagfontobj(wintag).configinfo.each{|key,value|
|
|
||||||
tagfontobj(tagOrId).configure(key,value)
|
|
||||||
}
|
|
||||||
tagfontobj(tagOrId).replace(window.tagfontobj(wintag).latin_font,
|
|
||||||
window.tagfontobj(wintag).kanji_font)
|
|
||||||
else
|
|
||||||
window.tagfont(tagOrId).configinfo.each{|key,value|
|
|
||||||
tagfontobj(tagOrId).configure(key,value)
|
|
||||||
}
|
|
||||||
tagfontobj(tagOrId).replace(window.fontobj.latin_font,
|
|
||||||
window.fontobj.kanji_font)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
def latintagfont_copy(tagOrId, window, wintag=nil)
|
|
||||||
if wintag
|
|
||||||
tagfontobj(tagOrId).latin_replace(window.tagfontobj(wintag).latin_font)
|
|
||||||
else
|
|
||||||
tagfontobj(tagOrId).latin_replace(window.fontobj.latin_font)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
alias asciitagfont_copy latintagfont_copy
|
|
||||||
|
|
||||||
def kanjitagfont_copy(tagOrId, window, wintag=nil)
|
|
||||||
if wintag
|
|
||||||
tagfontobj(tagOrId).kanji_replace(window.tagfontobj(wintag).kanji_font)
|
|
||||||
else
|
|
||||||
tagfontobj(tagOrId).kanji_replace(window.fontobj.kanji_font)
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@ -133,8 +35,12 @@ class TkCanvas<TkWindow
|
|||||||
WidgetClassName
|
WidgetClassName
|
||||||
end
|
end
|
||||||
|
|
||||||
def create_self
|
def create_self(keys)
|
||||||
tk_call 'canvas', path
|
if keys and keys != None
|
||||||
|
tk_call 'canvas', @path, *hash_kv(keys)
|
||||||
|
else
|
||||||
|
tk_call 'canvas', @path
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def tagid(tag)
|
def tagid(tag)
|
||||||
@ -736,16 +642,32 @@ class TkcItem<TkObject
|
|||||||
end
|
end
|
||||||
@parent = @c = parent
|
@parent = @c = parent
|
||||||
@path = parent.path
|
@path = parent.path
|
||||||
|
fontkeys = {}
|
||||||
if args[-1].kind_of? Hash
|
if args[-1].kind_of? Hash
|
||||||
|
args = args.dup
|
||||||
keys = args.pop
|
keys = args.pop
|
||||||
|
['font', 'kanjifont', 'latinfont', 'asciifont'].each{|key|
|
||||||
|
fontkeys[key] = keys.delete(key) if keys.key?(key)
|
||||||
|
}
|
||||||
|
args += hash_kv(keys)
|
||||||
end
|
end
|
||||||
@id = create_self(*args).to_i ;# 'canvas item id' is integer number
|
@id = create_self(*args).to_i ;# 'canvas item id' is integer number
|
||||||
CItemID_TBL[@path] = {} unless CItemID_TBL[@path]
|
CItemID_TBL[@path] = {} unless CItemID_TBL[@path]
|
||||||
CItemID_TBL[@path][@id] = self
|
CItemID_TBL[@path][@id] = self
|
||||||
if keys
|
font_configure(fontkeys) unless fontkeys.empty?
|
||||||
# tk_call @path, 'itemconfigure', @id, *hash_kv(keys)
|
|
||||||
configure(keys) if keys
|
######## old version
|
||||||
end
|
# if args[-1].kind_of? Hash
|
||||||
|
# keys = args.pop
|
||||||
|
# end
|
||||||
|
# @id = create_self(*args).to_i ;# 'canvas item id' is integer number
|
||||||
|
# CItemID_TBL[@path] = {} unless CItemID_TBL[@path]
|
||||||
|
# CItemID_TBL[@path][@id] = self
|
||||||
|
# if keys
|
||||||
|
# # tk_call @path, 'itemconfigure', @id, *hash_kv(keys)
|
||||||
|
# configure(keys) if keys
|
||||||
|
# end
|
||||||
|
########
|
||||||
end
|
end
|
||||||
def create_self(*args); end
|
def create_self(*args); end
|
||||||
private :create_self
|
private :create_self
|
||||||
|
@ -55,8 +55,12 @@ class TkEntry<TkLabel
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def create_self
|
def create_self(keys)
|
||||||
tk_call 'entry', @path
|
if keys and keys != None
|
||||||
|
tk_call 'entry', @path, *hash_kv(keys)
|
||||||
|
else
|
||||||
|
tk_call 'entry', @path
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def bbox(index)
|
def bbox(index)
|
||||||
@ -191,8 +195,12 @@ class TkSpinbox<TkEntry
|
|||||||
WidgetClassName
|
WidgetClassName
|
||||||
end
|
end
|
||||||
|
|
||||||
def create_self
|
def create_self(keys)
|
||||||
tk_call 'spinbox', @path
|
if keys and keys != None
|
||||||
|
tk_call 'spinbox', @path, *hash_kv(keys)
|
||||||
|
else
|
||||||
|
tk_call 'spinbox', @path
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def identify(x, y)
|
def identify(x, y)
|
||||||
|
@ -996,7 +996,7 @@ module TkTreatTagFont
|
|||||||
def font_configinfo
|
def font_configinfo
|
||||||
@parent.tagfont_configinfo(@id)
|
@parent.tagfont_configinfo(@id)
|
||||||
end
|
end
|
||||||
alias font font_configinfo
|
# alias font font_configinfo
|
||||||
|
|
||||||
def font_configure(slot)
|
def font_configure(slot)
|
||||||
@parent.tagfont_configure(@id, slot)
|
@parent.tagfont_configure(@id, slot)
|
||||||
|
@ -7,121 +7,24 @@ require 'tk.rb'
|
|||||||
require 'tkfont'
|
require 'tkfont'
|
||||||
|
|
||||||
module TkTreatTextTagFont
|
module TkTreatTextTagFont
|
||||||
def tagfont_configinfo(tag)
|
include TkTreatItemFont
|
||||||
if tag.kind_of? TkTextTag
|
|
||||||
pathname = self.path + ';' + tag.id
|
|
||||||
else
|
|
||||||
pathname = self.path + ';' + tag
|
|
||||||
end
|
|
||||||
ret = TkFont.used_on(pathname)
|
|
||||||
if ret == nil
|
|
||||||
ret = TkFont.init_widget_font(pathname,
|
|
||||||
self.path, 'tag', 'configure', tag)
|
|
||||||
end
|
|
||||||
ret
|
|
||||||
end
|
|
||||||
alias tagfontobj tagfont_configinfo
|
|
||||||
|
|
||||||
def tagfont_configure(tag, slot)
|
ItemCMD = ['tag', 'configure']
|
||||||
if tag.kind_of? TkTextTag
|
def __conf_cmd(idx)
|
||||||
pathname = self.path + ';' + tag.id
|
ItemCMD[idx]
|
||||||
else
|
|
||||||
pathname = self.path + ';' + tag
|
|
||||||
end
|
|
||||||
if (fnt = slot.delete('font'))
|
|
||||||
if fnt.kind_of? TkFont
|
|
||||||
return fnt.call_font_configure(pathname,
|
|
||||||
self.path,'tag','configure',tag,slot)
|
|
||||||
else
|
|
||||||
latintagfont_configure(tag, fnt) if fnt
|
|
||||||
end
|
|
||||||
end
|
|
||||||
if (ltn = slot.delete('latinfont'))
|
|
||||||
latintagfont_configure(tag, ltn) if ltn
|
|
||||||
end
|
|
||||||
if (ltn = slot.delete('asciifont'))
|
|
||||||
latintagfont_configure(tag, ltn) if ltn
|
|
||||||
end
|
|
||||||
if (knj = slot.delete('kanjifont'))
|
|
||||||
kanjitagfont_configure(tag, knj) if knj
|
|
||||||
end
|
|
||||||
|
|
||||||
tk_call(self.path, 'tag', 'configure', tag, *hash_kv(slot)) if slot != {}
|
|
||||||
self
|
|
||||||
end
|
end
|
||||||
|
|
||||||
def latintagfont_configure(tag, ltn, keys=nil)
|
def __item_pathname(tagOrId)
|
||||||
fobj = tagfontobj(tag)
|
if tagOrId.kind_of?(TkTextTag)
|
||||||
if ltn.kind_of? TkFont
|
self.path + ';' + tagOrId.id
|
||||||
conf = {}
|
|
||||||
ltn.latin_configinfo.each{|key,val| conf[key] = val if val != []}
|
|
||||||
if conf == {}
|
|
||||||
fobj.latin_replace(ltn)
|
|
||||||
fobj.latin_configure(keys) if keys
|
|
||||||
elsif keys
|
|
||||||
fobj.latin_configure(conf.update(keys))
|
|
||||||
else
|
|
||||||
fobj.latin_configure(conf)
|
|
||||||
end
|
|
||||||
else
|
else
|
||||||
fobj.latin_replace(ltn)
|
self.path + ';' + tagOrId
|
||||||
end
|
|
||||||
end
|
|
||||||
alias asciitagfont_configure latintagfont_configure
|
|
||||||
|
|
||||||
def kanjitagfont_configure(tag, knj, keys=nil)
|
|
||||||
fobj = tagfontobj(tag)
|
|
||||||
if knj.kind_of? TkFont
|
|
||||||
conf = {}
|
|
||||||
knj.kanji_configinfo.each{|key,val| conf[key] = val if val != []}
|
|
||||||
if conf == {}
|
|
||||||
fobj.kanji_replace(knj)
|
|
||||||
fobj.kanji_configure(keys) if keys
|
|
||||||
elsif keys
|
|
||||||
fobj.kanji_configure(conf.update(keys))
|
|
||||||
else
|
|
||||||
fobj.kanji_configure(conf)
|
|
||||||
end
|
|
||||||
else
|
|
||||||
fobj.kanji_replace(knj)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
def tagfont_copy(tag, window, wintag=nil)
|
|
||||||
if wintag
|
|
||||||
window.tagfontobj(wintag).configinfo.each{|key,value|
|
|
||||||
tagfontobj(tag).configure(key,value)
|
|
||||||
}
|
|
||||||
tagfontobj(tag).replace(window.tagfontobj(wintag).latin_font,
|
|
||||||
window.tagfontobj(wintag).kanji_font)
|
|
||||||
else
|
|
||||||
window.tagfont(wintag).configinfo.each{|key,value|
|
|
||||||
tagfontobj(tag).configure(key,value)
|
|
||||||
}
|
|
||||||
tagfontobj(tag).replace(window.fontobj.latin_font,
|
|
||||||
window.fontobj.kanji_font)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
def latintagfont_copy(tag, window, wintag=nil)
|
|
||||||
if wintag
|
|
||||||
tagfontobj(tag).latin_replace(window.tagfontobj(wintag).latin_font)
|
|
||||||
else
|
|
||||||
tagfontobj(tag).latin_replace(window.fontobj.latin_font)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
alias asciitagfont_copy latintagfont_copy
|
|
||||||
|
|
||||||
def kanjitagfont_copy(tag, window, wintag=nil)
|
|
||||||
if wintag
|
|
||||||
tagfontobj(tag).kanji_replace(window.tagfontobj(wintag).kanji_font)
|
|
||||||
else
|
|
||||||
tagfontobj(tag).kanji_replace(window.fontobj.kanji_font)
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
class TkText<TkTextWin
|
class TkText<TkTextWin
|
||||||
|
ItemConfCMD = ['tag', 'configure']
|
||||||
include TkTreatTextTagFont
|
include TkTreatTextTagFont
|
||||||
include Scrollable
|
include Scrollable
|
||||||
|
|
||||||
@ -143,8 +46,12 @@ class TkText<TkTextWin
|
|||||||
@tags = {}
|
@tags = {}
|
||||||
end
|
end
|
||||||
|
|
||||||
def create_self
|
def create_self(keys)
|
||||||
tk_call 'text', @path
|
if keys and keys != None
|
||||||
|
tk_call 'text', @path, *hash_kv(keys)
|
||||||
|
else
|
||||||
|
tk_call 'text', @path
|
||||||
|
end
|
||||||
init_instance_variable
|
init_instance_variable
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -298,7 +205,7 @@ class TkText<TkTextWin
|
|||||||
else
|
else
|
||||||
if key == 'font' || key == 'kanjifont' ||
|
if key == 'font' || key == 'kanjifont' ||
|
||||||
key == 'latinfont' || key == 'asciifont'
|
key == 'latinfont' || key == 'asciifont'
|
||||||
tagfont_configure({key=>val})
|
tagfont_configure(tag, {key=>val})
|
||||||
else
|
else
|
||||||
tk_send 'tag', 'configure', tag, "-#{key}", val
|
tk_send 'tag', 'configure', tag, "-#{key}", val
|
||||||
end
|
end
|
||||||
|
@ -836,6 +836,7 @@ r_object(arg)
|
|||||||
|
|
||||||
case TYPE_FALSE:
|
case TYPE_FALSE:
|
||||||
v = Qfalse;
|
v = Qfalse;
|
||||||
|
break;
|
||||||
|
|
||||||
case TYPE_FIXNUM:
|
case TYPE_FIXNUM:
|
||||||
{
|
{
|
||||||
|
13
st.c
13
st.c
@ -165,7 +165,7 @@ st_init_table_with_size(type, size)
|
|||||||
tbl = alloc(st_table);
|
tbl = alloc(st_table);
|
||||||
tbl->type = type;
|
tbl->type = type;
|
||||||
tbl->num_entries = 0;
|
tbl->num_entries = 0;
|
||||||
tbl->num_bins = size-1;
|
tbl->num_bins = size;
|
||||||
tbl->bins = (st_table_entry **)Calloc(size, sizeof(st_table_entry*));
|
tbl->bins = (st_table_entry **)Calloc(size, sizeof(st_table_entry*));
|
||||||
|
|
||||||
return tbl;
|
return tbl;
|
||||||
@ -211,7 +211,7 @@ st_free_table(table)
|
|||||||
register st_table_entry *ptr, *next;
|
register st_table_entry *ptr, *next;
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
for(i = 0; i <= table->num_bins; i++) {
|
for(i = 0; i < table->num_bins; i++) {
|
||||||
ptr = table->bins[i];
|
ptr = table->bins[i];
|
||||||
while (ptr != 0) {
|
while (ptr != 0) {
|
||||||
next = ptr->next;
|
next = ptr->next;
|
||||||
@ -267,7 +267,7 @@ st_lookup(table, key, value)
|
|||||||
#define ADD_DIRECT(table, key, value, hash_val, bin_pos)\
|
#define ADD_DIRECT(table, key, value, hash_val, bin_pos)\
|
||||||
{\
|
{\
|
||||||
st_table_entry *entry;\
|
st_table_entry *entry;\
|
||||||
if (table->num_entries/(table->num_bins+1) > ST_DEFAULT_MAX_DENSITY) {\
|
if (table->num_entries/(table->num_bins) > ST_DEFAULT_MAX_DENSITY) {\
|
||||||
rehash(table);\
|
rehash(table);\
|
||||||
bin_pos = hash_val % table->num_bins;\
|
bin_pos = hash_val % table->num_bins;\
|
||||||
}\
|
}\
|
||||||
@ -328,8 +328,7 @@ rehash(table)
|
|||||||
new_num_bins = new_size(old_num_bins+1);
|
new_num_bins = new_size(old_num_bins+1);
|
||||||
new_bins = (st_table_entry**)Calloc(new_num_bins, sizeof(st_table_entry*));
|
new_bins = (st_table_entry**)Calloc(new_num_bins, sizeof(st_table_entry*));
|
||||||
|
|
||||||
new_num_bins--;
|
for(i = 0; i < old_num_bins; i++) {
|
||||||
for(i = 0; i <= old_num_bins; i++) {
|
|
||||||
ptr = table->bins[i];
|
ptr = table->bins[i];
|
||||||
while (ptr != 0) {
|
while (ptr != 0) {
|
||||||
next = ptr->next;
|
next = ptr->next;
|
||||||
@ -350,7 +349,7 @@ st_copy(old_table)
|
|||||||
{
|
{
|
||||||
st_table *new_table;
|
st_table *new_table;
|
||||||
st_table_entry *ptr, *entry;
|
st_table_entry *ptr, *entry;
|
||||||
int i, num_bins = old_table->num_bins+1;
|
int i, num_bins = old_table->num_bins;
|
||||||
|
|
||||||
new_table = alloc(st_table);
|
new_table = alloc(st_table);
|
||||||
if (new_table == 0) {
|
if (new_table == 0) {
|
||||||
@ -487,7 +486,7 @@ st_foreach(table, func, arg)
|
|||||||
enum st_retval retval;
|
enum st_retval retval;
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
for(i = 0; i <= table->num_bins; i++) {
|
for(i = 0; i < table->num_bins; i++) {
|
||||||
last = 0;
|
last = 0;
|
||||||
for(ptr = table->bins[i]; ptr != 0;) {
|
for(ptr = table->bins[i]; ptr != 0;) {
|
||||||
retval = (*func)(ptr->key, ptr->record, arg);
|
retval = (*func)(ptr->key, ptr->record, arg);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user