diff options
Diffstat (limited to 'ext/tk/lib/tk')
48 files changed, 813 insertions, 813 deletions
diff --git a/ext/tk/lib/tk/autoload.rb b/ext/tk/lib/tk/autoload.rb index 79b6e01eb8..df888eb927 100644 --- a/ext/tk/lib/tk/autoload.rb +++ b/ext/tk/lib/tk/autoload.rb @@ -250,69 +250,69 @@ autoload :TkXIM, 'tk/xim' module Tk @TOPLEVEL_ALIAS_TABLE = {} @TOPLEVEL_ALIAS_TABLE[:Tk] = { - :TkButton => 'tk/button', + :TkButton => 'tk/button', - :TkCanvas => 'tk/canvas', + :TkCanvas => 'tk/canvas', - :TkCheckButton => 'tk/checkbutton', - :TkCheckbutton => 'tk/checkbutton', + :TkCheckButton => 'tk/checkbutton', + :TkCheckbutton => 'tk/checkbutton', - # :TkDialog => 'tk/dialog', - # :TkDialog2 => 'tk/dialog', - # :TkDialogObj => 'tk/dialog', - # :TkWarning => 'tk/dialog', - # :TkWarning2 => 'tk/dialog', - # :TkWarningObj => 'tk/dialog', + # :TkDialog => 'tk/dialog', + # :TkDialog2 => 'tk/dialog', + # :TkDialogObj => 'tk/dialog', + # :TkWarning => 'tk/dialog', + # :TkWarning2 => 'tk/dialog', + # :TkWarningObj => 'tk/dialog', - :TkEntry => 'tk/entry', + :TkEntry => 'tk/entry', - :TkFrame => 'tk/frame', + :TkFrame => 'tk/frame', - :TkLabel => 'tk/label', + :TkLabel => 'tk/label', - :TkLabelFrame => 'tk/labelframe', - :TkLabelframe => 'tk/labelframe', + :TkLabelFrame => 'tk/labelframe', + :TkLabelframe => 'tk/labelframe', - :TkListbox => 'tk/listbox', + :TkListbox => 'tk/listbox', - :TkMacResource => 'tk/macpkg', + :TkMacResource => 'tk/macpkg', - :TkMenu => 'tk/menu', - :TkMenuClone => 'tk/menu', - :TkCloneMenu => 'tk/menu', - # :TkSystemMenu => 'tk/menu', - :TkSysMenu_Help => 'tk/menu', - :TkSysMenu_System => 'tk/menu', - :TkSysMenu_Apple => 'tk/menu', - :TkMenubutton => 'tk/menu', - :TkMenuButton => 'tk/menu', - :TkOptionMenubutton => 'tk/menu', - :TkOptionMenuButton => 'tk/menu', + :TkMenu => 'tk/menu', + :TkMenuClone => 'tk/menu', + :TkCloneMenu => 'tk/menu', + # :TkSystemMenu => 'tk/menu', + :TkSysMenu_Help => 'tk/menu', + :TkSysMenu_System => 'tk/menu', + :TkSysMenu_Apple => 'tk/menu', + :TkMenubutton => 'tk/menu', + :TkMenuButton => 'tk/menu', + :TkOptionMenubutton => 'tk/menu', + :TkOptionMenuButton => 'tk/menu', - :TkMessage => 'tk/message', + :TkMessage => 'tk/message', - :TkPanedWindow => 'tk/panedwindow', - :TkPanedwindow => 'tk/panedwindow', + :TkPanedWindow => 'tk/panedwindow', + :TkPanedwindow => 'tk/panedwindow', - :TkRadioButton => 'tk/radiobutton', - :TkRadiobutton => 'tk/radiobutton', + :TkRadioButton => 'tk/radiobutton', + :TkRadiobutton => 'tk/radiobutton', - # :TkRoot => 'tk/root', + # :TkRoot => 'tk/root', - :TkScale => 'tk/scale', + :TkScale => 'tk/scale', - :TkScrollbar => 'tk/scrollbar', - :TkXScrollbar => 'tk/scrollbar', - :TkYScrollbar => 'tk/scrollbar', + :TkScrollbar => 'tk/scrollbar', + :TkXScrollbar => 'tk/scrollbar', + :TkYScrollbar => 'tk/scrollbar', - :TkSpinbox => 'tk/spinbox', + :TkSpinbox => 'tk/spinbox', - :TkText => 'tk/text', + :TkText => 'tk/text', - :TkToplevel => 'tk/toplevel', + :TkToplevel => 'tk/toplevel', - :TkWinDDE => 'tk/winpkg', - :TkWinRegistry => 'tk/winpkg', + :TkWinDDE => 'tk/winpkg', + :TkWinRegistry => 'tk/winpkg', } @TOPLEVEL_ALIAS_OWNER = {} @@ -361,7 +361,7 @@ class << Tk # check already autoloaded if (table = @TOPLEVEL_ALIAS_TABLE[current = @current_default_widget_set]) table.each{|sym, file| - if !Object.autoload?(sym) && Object.const_defined?(sym) && + if !Object.autoload?(sym) && Object.const_defined?(sym) && @TOPLEVEL_ALIAS_TABLE[current][sym].kind_of?(String) # autoload -> class @TOPLEVEL_ALIAS_TABLE[current][sym] = Object.const_get(sym) @@ -399,9 +399,9 @@ Tk.default_widget_set = :Tk ############################################ # Ttk (Tile) support =begin -if major > 8 || - (major == 8 && minor > 5) || - (major == 8 && minor == 5 && type >= TclTkLib::RELEASE_TYPE::BETA) +if major > 8 || + (major == 8 && minor > 5) || + (major == 8 && minor == 5 && type >= TclTkLib::RELEASE_TYPE::BETA) # Tcl/Tk 8.5 beta or later Object.autoload :Ttk, 'tkextlib/tile' Tk.autoload :Tile, 'tkextlib/tile' diff --git a/ext/tk/lib/tk/canvas.rb b/ext/tk/lib/tk/canvas.rb index 36ea008a17..b05a619939 100644 --- a/ext/tk/lib/tk/canvas.rb +++ b/ext/tk/lib/tk/canvas.rb @@ -13,7 +13,7 @@ module TkCanvasItemConfig def __item_strval_optkeys(id) # maybe need to override super(id) + [ - 'fill', 'activefill', 'disabledfill', + 'fill', 'activefill', 'disabledfill', 'outline', 'activeoutline', 'disabledoutline' ] end @@ -117,7 +117,7 @@ class Tk::Canvas<TkWindow end def bbox(tagOrId, *tags) - list(tk_send_without_enc('bbox', tagid(tagOrId), + list(tk_send_without_enc('bbox', tagid(tagOrId), *tags.collect{|t| tagid(t)})) end @@ -181,7 +181,7 @@ class Tk::Canvas<TkWindow end def dchars(tag, first, last=None) - tk_send_without_enc('dchars', tagid(tag), + tk_send_without_enc('dchars', tagid(tag), _get_eval_enc_str(first), _get_eval_enc_str(last)) self end @@ -214,7 +214,7 @@ class Tk::Canvas<TkWindow alias deltag dtag def find(mode, *args) - list(tk_send_without_enc('find', mode, *args)).collect!{|id| + list(tk_send_without_enc('find', mode, *args)).collect!{|id| TkcItem.id2obj(self, id) } end @@ -270,7 +270,7 @@ class Tk::Canvas<TkWindow end def insert(tagOrId, index, string) - tk_send_without_enc('insert', tagid(tagOrId), index, + tk_send_without_enc('insert', tagid(tagOrId), index, _get_eval_enc_str(string)) self end @@ -300,7 +300,7 @@ class Tk::Canvas<TkWindow fnt end else - tk_tcl2ruby(_fromUTF8(tk_send_without_enc('itemcget', tagid(tagOrId), + tk_tcl2ruby(_fromUTF8(tk_send_without_enc('itemcget', tagid(tagOrId), "-#{option}"))) end end @@ -315,16 +315,16 @@ class Tk::Canvas<TkWindow || key['latinfont'] || key['asciifont'] ) tagfont_configure(tagid(tagOrId), key.dup) else - _fromUTF8(tk_send_without_enc('itemconfigure', tagid(tagOrId), + _fromUTF8(tk_send_without_enc('itemconfigure', tagid(tagOrId), *hash_kv(key, true))) end else if ( key == 'coords' || key == :coords ) self.coords(tagOrId, value) - elsif ( key == 'font' || key == :font || - key == 'kanjifont' || key == :kanjifont || - key == 'latinfont' || key == :latinfont || + elsif ( key == 'font' || key == :font || + key == 'kanjifont' || key == :kanjifont || + key == 'latinfont' || key == :latinfont || key == 'asciifont' || key == :asciifont ) if value == None tagfontobj(tagid(tagOrId)) @@ -332,7 +332,7 @@ class Tk::Canvas<TkWindow tagfont_configure(tagid(tagOrId), {key=>value}) end else - _fromUTF8(tk_send_without_enc('itemconfigure', tagid(tagOrId), + _fromUTF8(tk_send_without_enc('itemconfigure', tagid(tagOrId), "-#{key}", _get_eval_enc_str(value))) end end @@ -389,16 +389,16 @@ class Tk::Canvas<TkWindow else if conf[3] if conf[3].index('{') - conf[3] = tk_split_list(conf[3]) + conf[3] = tk_split_list(conf[3]) else - conf[3] = tk_tcl2ruby(conf[3]) + conf[3] = tk_tcl2ruby(conf[3]) end end if conf[4] if conf[4].index('{') - conf[4] = tk_split_list(conf[4]) + conf[4] = tk_split_list(conf[4]) else - conf[4] = tk_tcl2ruby(conf[4]) + conf[4] = tk_tcl2ruby(conf[4]) end end end @@ -421,8 +421,8 @@ class Tk::Canvas<TkWindow when 'coords' {'coords' => ['', '', '', self.coords(tagOrId)]} when 'dash', 'activedash', 'disableddash' - conf = tk_split_simplelist(tk_send_without_enc('itemconfigure', - tagid(tagOrId), + conf = tk_split_simplelist(tk_send_without_enc('itemconfigure', + tagid(tagOrId), "-#{key}")) if conf[3] && conf[3] =~ /^[0-9]/ conf[3] = list(conf[3]) @@ -457,16 +457,16 @@ class Tk::Canvas<TkWindow else if conf[2] if conf[2].index('{') - conf[2] = tk_split_list(conf[2]) + conf[2] = tk_split_list(conf[2]) else - conf[2] = tk_tcl2ruby(conf[2]) + conf[2] = tk_tcl2ruby(conf[2]) end end if conf[3] if conf[3].index('{') - conf[3] = tk_split_list(conf[3]) + conf[3] = tk_split_list(conf[3]) else - conf[3] = tk_tcl2ruby(conf[3]) + conf[3] = tk_tcl2ruby(conf[3]) end end end @@ -676,7 +676,7 @@ class TkcItem<TkObject fail RuntimeError, "#{self} is an abstract class" end args, fontkeys = _parse_create_args(args) - idnum = tk_call_without_enc(canvas.path, 'create', + idnum = tk_call_without_enc(canvas.path, 'create', self::CItemTypeName, *args) canvas.itemconfigure(idnum, fontkeys) unless fontkeys.empty? idnum.to_i # 'canvas item id' is an integer number diff --git a/ext/tk/lib/tk/canvastag.rb b/ext/tk/lib/tk/canvastag.rb index 49796d80b2..4e57a159bf 100644 --- a/ext/tk/lib/tk/canvastag.rb +++ b/ext/tk/lib/tk/canvastag.rb @@ -218,7 +218,7 @@ class TkcTag<TkObject CTagID_TBL.mutex.synchronize{ if CTagID_TBL[cpath] CTagID_TBL[cpath][id]? CTagID_TBL[cpath][id]: id - else + else id end } @@ -414,7 +414,7 @@ class TkcGroup<TkcTag include(*args) if args != [] end #private :create_self - + def include(*tags) for i in tags #i.addtag(@id) diff --git a/ext/tk/lib/tk/checkbutton.rb b/ext/tk/lib/tk/checkbutton.rb index b1186a87ed..c1c4905c5e 100644 --- a/ext/tk/lib/tk/checkbutton.rb +++ b/ext/tk/lib/tk/checkbutton.rb @@ -26,5 +26,5 @@ end Tk::Checkbutton = Tk::CheckButton #TkCheckButton = Tk::CheckButton unless Object.const_defined? :TkCheckButton #TkCheckbutton = Tk::Checkbutton unless Object.const_defined? :TkCheckbutton -Tk.__set_toplevel_aliases__(:Tk, Tk::CheckButton, +Tk.__set_toplevel_aliases__(:Tk, Tk::CheckButton, :TkCheckButton, :TkCheckbutton) diff --git a/ext/tk/lib/tk/composite.rb b/ext/tk/lib/tk/composite.rb index 883d43c3ea..9a4aafda18 100644 --- a/ext/tk/lib/tk/composite.rb +++ b/ext/tk/lib/tk/composite.rb @@ -1,5 +1,5 @@ # -# tk/composite.rb : +# tk/composite.rb : # require 'tk' @@ -358,7 +358,7 @@ module TkComposite opt, wins = tbl[0] next unless wins && wins[-1] if slot == opt - info_list.delete_if{|i| i[0] == slot} << + info_list.delete_if{|i| i[0] == slot} << wins[-1].configinfo(slot) else info = wins[-1].configinfo(opt) @@ -367,7 +367,7 @@ module TkComposite end else opt, wins = tbl[-1] - info_list.delete_if{|i| i[0] == slot} << + info_list.delete_if{|i| i[0] == slot} << [slot, '', '', '', wins[-1].cget(opt)] end } diff --git a/ext/tk/lib/tk/console.rb b/ext/tk/lib/tk/console.rb index 26ce262caa..64e257594c 100644 --- a/ext/tk/lib/tk/console.rb +++ b/ext/tk/lib/tk/console.rb @@ -28,7 +28,7 @@ module TkConsole # supports a Tcl script only # I have no idea to support a Ruby script seamlessly. # - _fromUTF8(tk_call_without_enc('console', 'eval', + _fromUTF8(tk_call_without_enc('console', 'eval', _get_eval_enc_str(tcl_script))) end def self.maininterp_eval(tcl_script) @@ -36,7 +36,7 @@ module TkConsole # supports a Tcl script only # I have no idea to support a Ruby script seamlessly. # - _fromUTF8(tk_call_without_enc('consoleinterp', 'eval', + _fromUTF8(tk_call_without_enc('consoleinterp', 'eval', _get_eval_enc_str(tcl_script))) end @@ -45,7 +45,7 @@ module TkConsole # supports a Tcl script only # I have no idea to support a Ruby script seamlessly. # - _fromUTF8(tk_call_without_enc('consoleinterp', 'record', + _fromUTF8(tk_call_without_enc('consoleinterp', 'record', _get_eval_enc_str(tcl_script))) end diff --git a/ext/tk/lib/tk/dialog.rb b/ext/tk/lib/tk/dialog.rb index 180da101e3..7ef7820699 100644 --- a/ext/tk/lib/tk/dialog.rb +++ b/ext/tk/lib/tk/dialog.rb @@ -18,11 +18,11 @@ class TkDialogObj < TkWindow def _set_button_config(configs) set_config = proc{|c,i| if $VERBOSE && (c.has_key?('command') || c.has_key?(:command)) - STDERR.print("Warning: cannot give a command option " + + STDERR.print("Warning: cannot give a command option " + "to the dialog button#{i}. It was removed.\n") end c.delete('command'); c.delete(:command) - # @config << Kernel.format("%s.button%s configure %s; ", + # @config << Kernel.format("%s.button%s configure %s; ", # @path, i, hash_kv(c).join(' ')) # @config << @path+'.button'+i.to_s+' configure '+hash_kv(c).join(' ')+'; ' @config << @path+'.button'+i.to_s+' configure '+ @@ -103,7 +103,7 @@ class TkDialogObj < TkWindow #end if @buttons.kind_of?(Array) - _set_button_config(@buttons.collect{|cfg| + _set_button_config(@buttons.collect{|cfg| (cfg.kind_of? Array)? cfg[1]: nil}) @buttons = @buttons.collect{|cfg| (cfg.kind_of? Array)? cfg[0]: cfg} end @@ -127,7 +127,7 @@ class TkDialogObj < TkWindow =end if @message_config.kind_of?(Hash) - # @config << Kernel.format("%s.msg configure %s;", + # @config << Kernel.format("%s.msg configure %s;", # @path, hash_kv(@message_config).join(' ')) # @config << @path+'.msg configure '+hash_kv(@message_config).join(' ')+';' @config << @path+'.msg configure '+ @@ -135,7 +135,7 @@ class TkDialogObj < TkWindow end if @msgframe_config.kind_of?(Hash) - # @config << Kernel.format("%s.top configure %s;", + # @config << Kernel.format("%s.top configure %s;", # @path, hash_kv(@msgframe_config).join(' ')) # @config << @path+'.top configure '+hash_kv(@msgframe_config).join(' ')+';' @config << @path+'.top configure '+ @@ -143,7 +143,7 @@ class TkDialogObj < TkWindow end if @btnframe_config.kind_of?(Hash) - # @config << Kernel.format("%s.bot configure %s;", + # @config << Kernel.format("%s.bot configure %s;", # @path, hash_kv(@btnframe_config).join(' ')) # @config << @path+'.bot configure '+hash_kv(@btnframe_config).join(' ')+';' @config << @path+'.bot configure '+ @@ -151,7 +151,7 @@ class TkDialogObj < TkWindow end if @bitmap_config.kind_of?(Hash) - # @config << Kernel.format("%s.bitmap configure %s;", + # @config << Kernel.format("%s.bitmap configure %s;", # @path, hash_kv(@bitmap_config).join(' ')) # @config << @path+'.bitmap configure '+hash_kv(@bitmap_config).join(' ')+';' @config << @path+'.bitmap configure '+ @@ -176,19 +176,19 @@ class TkDialogObj < TkWindow # default_button = '{}' if default_button == nil default_button = '' if default_button == nil #Tk.ip_eval('eval {global '+@var.id+';'+@config+ - # 'set '+@var.id+' [tk_dialog '+ + # 'set '+@var.id+' [tk_dialog '+ # @path+" "+@title+" {#{@message}} "+@bitmap+" "+ # String(default_button)+" "+@buttons.join(' ')+']}') Tk.ip_eval(@config) - # @val = Tk.ip_eval('tk_dialog ' + @path + ' ' + @title + - # ' {' + @message + '} ' + @bitmap + ' ' + + # @val = Tk.ip_eval('tk_dialog ' + @path + ' ' + @title + + # ' {' + @message + '} ' + @bitmap + ' ' + # String(default_button) + ' ' + @buttons.join(' ')).to_i - # @val = Tk.ip_eval(self.class::TkCommandNames[0] + ' ' + @path + ' ' + - # @title + ' {' + @message + '} ' + @bitmap + ' ' + + # @val = Tk.ip_eval(self.class::TkCommandNames[0] + ' ' + @path + ' ' + + # @title + ' {' + @message + '} ' + @bitmap + ' ' + # String(default_button) + ' ' + @buttons.join(' ')).to_i @val = Tk.ip_eval(array2tk_list([ - self.class::TkCommandNames[0], - @path, @title, @message, @bitmap, + self.class::TkCommandNames[0], + @path, @title, @message, @bitmap, String(default_button) ].concat(@buttons))).to_i end @@ -226,7 +226,7 @@ class TkDialogObj < TkWindow return nil end def bitmap - # returns a bitmap name or a bitmap file path + # returns a bitmap name or a bitmap file path # (@ + path ; e.g. '@/usr/share/bitmap/sample.xbm') return "info" end diff --git a/ext/tk/lib/tk/encodedstr.rb b/ext/tk/lib/tk/encodedstr.rb index 02de0b0d85..59fbb1911d 100644 --- a/ext/tk/lib/tk/encodedstr.rb +++ b/ext/tk/lib/tk/encodedstr.rb @@ -67,11 +67,11 @@ module Tk def initialize(str, enc = nil) super(str) - # @encoding = ( enc || - # ((self.class::Encoding)? + # @encoding = ( enc || + # ((self.class::Encoding)? # self.class::Encoding : Tk.encoding_system) ) enc ||= (self.class::Encoding)? - self.class::Encoding : + self.class::Encoding : ((Tk.encoding)? Tk.encoding : Tk.encoding_system) if TkCore::WITH_ENCODING unless encobj = Tk::Encoding::ENCODING_TABLE.get_obj(enc) diff --git a/ext/tk/lib/tk/event.rb b/ext/tk/lib/tk/event.rb index d8aad6248b..d07b3b5a85 100644 --- a/ext/tk/lib/tk/event.rb +++ b/ext/tk/lib/tk/event.rb @@ -53,39 +53,39 @@ module TkEvent #-----+-------------------+------------------+-----------------------# # ID | const | group_flag | context_name # #-----+-------------------+------------------+-----------------------# - [ 2, :KeyPress, Grp::KEY, 'KeyPress', 'Key' ], - [ 3, :KeyRelease, Grp::KEY, 'KeyRelease' ], - [ 4, :ButtonPress, Grp::BUTTON, 'ButtonPress', 'Button' ], - [ 5, :ButtonRelease, Grp::BUTTON, 'ButtonRelease' ], - [ 6, :MotionNotify, Grp::MOTION, 'Motion' ], - [ 7, :EnterNotify, Grp::CROSSING, 'Enter' ], - [ 8, :LeaveNotify, Grp::CROSSING, 'Leave' ], - [ 9, :FocusIn, Grp::FOCUS, 'FocusIn' ], - [ 10, :FocusOut, Grp::FOCUS, 'FocusOut' ], - [ 11, :KeymapNotify, 0, ], - [ 12, :Expose, Grp::EXPOSE, 'Expose' ], - [ 13, :GraphicsExpose, Grp::EXPOSE, ], - [ 14, :NoExpose, 0, ], - [ 15, :VisibilityNotify, Grp::VISIBILITY, 'Visibility' ], - [ 16, :CreateNotify, Grp::CREATE, 'Create' ], - [ 17, :DestroyNotify, Grp::DESTROY, 'Destroy' ], - [ 18, :UnmapNotify, Grp::UNMAP, 'Unmap' ], - [ 19, :MapNotify, Grp::MAP, 'Map' ], - [ 20, :MapRequest, Grp::MAPREQ, 'MapRequest' ], - [ 21, :ReparentNotify, Grp::REPARENT, 'Reparent' ], - [ 22, :ConfigureNotify, Grp::CONFIG, 'Configure' ], - [ 23, :ConfigureRequest, Grp::CONFIGREQ, 'ConfigureRequest' ], - [ 24, :GravityNotify, Grp::GRAVITY, 'Gravity' ], - [ 25, :ResizeRequest, Grp::RESIZEREQ, 'ResizeRequest' ], - [ 26, :CirculateNotify, Grp::CIRC, 'Circulate' ], - [ 27, :CirculateRequest, 0, 'CirculateRequest' ], - [ 28, :PropertyNotify, Grp::PROP, 'Property' ], - [ 29, :SelectionClear, 0, ], - [ 30, :SelectionRequest, 0, ], - [ 31, :SelectionNotify, 0, ], - [ 32, :ColormapNotify, Grp::COLORMAP, 'Colormap' ], - [ 33, :ClientMessage, 0, ], - [ 34, :MappingNotify, 0, ], + [ 2, :KeyPress, Grp::KEY, 'KeyPress', 'Key' ], + [ 3, :KeyRelease, Grp::KEY, 'KeyRelease' ], + [ 4, :ButtonPress, Grp::BUTTON, 'ButtonPress', 'Button' ], + [ 5, :ButtonRelease, Grp::BUTTON, 'ButtonRelease' ], + [ 6, :MotionNotify, Grp::MOTION, 'Motion' ], + [ 7, :EnterNotify, Grp::CROSSING, 'Enter' ], + [ 8, :LeaveNotify, Grp::CROSSING, 'Leave' ], + [ 9, :FocusIn, Grp::FOCUS, 'FocusIn' ], + [ 10, :FocusOut, Grp::FOCUS, 'FocusOut' ], + [ 11, :KeymapNotify, 0, ], + [ 12, :Expose, Grp::EXPOSE, 'Expose' ], + [ 13, :GraphicsExpose, Grp::EXPOSE, ], + [ 14, :NoExpose, 0, ], + [ 15, :VisibilityNotify, Grp::VISIBILITY, 'Visibility' ], + [ 16, :CreateNotify, Grp::CREATE, 'Create' ], + [ 17, :DestroyNotify, Grp::DESTROY, 'Destroy' ], + [ 18, :UnmapNotify, Grp::UNMAP, 'Unmap' ], + [ 19, :MapNotify, Grp::MAP, 'Map' ], + [ 20, :MapRequest, Grp::MAPREQ, 'MapRequest' ], + [ 21, :ReparentNotify, Grp::REPARENT, 'Reparent' ], + [ 22, :ConfigureNotify, Grp::CONFIG, 'Configure' ], + [ 23, :ConfigureRequest, Grp::CONFIGREQ, 'ConfigureRequest' ], + [ 24, :GravityNotify, Grp::GRAVITY, 'Gravity' ], + [ 25, :ResizeRequest, Grp::RESIZEREQ, 'ResizeRequest' ], + [ 26, :CirculateNotify, Grp::CIRC, 'Circulate' ], + [ 27, :CirculateRequest, 0, 'CirculateRequest' ], + [ 28, :PropertyNotify, Grp::PROP, 'Property' ], + [ 29, :SelectionClear, 0, ], + [ 30, :SelectionRequest, 0, ], + [ 31, :SelectionNotify, 0, ], + [ 32, :ColormapNotify, Grp::COLORMAP, 'Colormap' ], + [ 33, :ClientMessage, 0, ], + [ 34, :MappingNotify, 0, ], [ 35, :VirtualEvent, Grp::VIRTUAL, ], [ 36, :ActivateNotify, Grp::ACTIVATE, 'Activate' ], [ 37, :DeactivateNotify, Grp::ACTIVATE, 'Deactivate' ], @@ -153,12 +153,12 @@ module TkEvent FIELD_FLAG = { # key => flag - 'above' => Grp::CONFIG, + 'above' => Grp::CONFIG, 'borderwidth' => (Grp::CREATE|Grp::CONFIG), - 'button' => Grp::BUTTON, - 'count' => Grp::EXPOSE, - 'data' => (Grp::VIRTUAL|Grp::STRING_DATA), - 'delta' => Grp::MWHEEL, + 'button' => Grp::BUTTON, + 'count' => Grp::EXPOSE, + 'data' => (Grp::VIRTUAL|Grp::STRING_DATA), + 'delta' => Grp::MWHEEL, 'detail' => (Grp::FOCUS|Grp::CROSSING), 'focus' => Grp::CROSSING, 'height' => (Grp::EXPOSE|Grp::CONFIG), @@ -191,23 +191,23 @@ module TkEvent } FIELD_OPERATION = { - 'root' => proc{|val| + 'root' => proc{|val| begin Tk.tk_call_without_enc('winfo', 'pathname', val) val rescue nil end - }, + }, - 'subwindow' => proc{|val| + 'subwindow' => proc{|val| begin Tk.tk_call_without_enc('winfo', 'pathname', val) val rescue nil end - }, + }, 'window' => proc{|val| nil} } @@ -280,7 +280,7 @@ module TkEvent Tk.event_generate(win, type_name, opts) else # If type is KEY event, focus should be set to target widget. - # If not set, original widget will get the same event. + # If not set, original widget will get the same event. # That will make infinite loop. w = Tk.tk_call_without_enc('focus') begin @@ -296,58 +296,58 @@ module TkEvent # [ <'%' subst-key char>, <proc type char>, <instance var (accessor) name>] KEY_TBL = [ - [ ?#, ?n, :serial ], - [ ?a, ?s, :above ], - [ ?b, ?n, :num ], - [ ?c, ?n, :count ], - [ ?d, ?s, :detail ], + [ ?#, ?n, :serial ], + [ ?a, ?s, :above ], + [ ?b, ?n, :num ], + [ ?c, ?n, :count ], + [ ?d, ?s, :detail ], # ?e - [ ?f, ?b, :focus ], + [ ?f, ?b, :focus ], # ?g - [ ?h, ?n, :height ], - [ ?i, ?s, :win_hex ], + [ ?h, ?n, :height ], + [ ?i, ?s, :win_hex ], # ?j - [ ?k, ?n, :keycode ], + [ ?k, ?n, :keycode ], # ?l - [ ?m, ?s, :mode ], + [ ?m, ?s, :mode ], # ?n - [ ?o, ?b, :override ], - [ ?p, ?s, :place ], + [ ?o, ?b, :override ], + [ ?p, ?s, :place ], # ?q # ?r - [ ?s, ?x, :state ], - [ ?t, ?n, :time ], + [ ?s, ?x, :state ], + [ ?t, ?n, :time ], # ?u - [ ?v, ?n, :value_mask ], - [ ?w, ?n, :width ], - [ ?x, ?n, :x ], - [ ?y, ?n, :y ], + [ ?v, ?n, :value_mask ], + [ ?w, ?n, :width ], + [ ?x, ?n, :x ], + [ ?y, ?n, :y ], # ?z - [ ?A, ?s, :char ], - [ ?B, ?n, :borderwidth ], + [ ?A, ?s, :char ], + [ ?B, ?n, :borderwidth ], # ?C - [ ?D, ?n, :wheel_delta ], - [ ?E, ?b, :send_event ], + [ ?D, ?n, :wheel_delta ], + [ ?E, ?b, :send_event ], # ?F # ?G # ?H # ?I # ?J - [ ?K, ?s, :keysym ], + [ ?K, ?s, :keysym ], # ?L # ?M - [ ?N, ?n, :keysym_num ], + [ ?N, ?n, :keysym_num ], # ?O - [ ?P, ?s, :property ], + [ ?P, ?s, :property ], # ?Q - [ ?R, ?s, :rootwin_id ], - [ ?S, ?s, :subwindow ], - [ ?T, ?n, :type ], + [ ?R, ?s, :rootwin_id ], + [ ?S, ?s, :subwindow ], + [ ?T, ?n, :type ], # ?U # ?V - [ ?W, ?w, :widget ], - [ ?X, ?n, :x_root ], - [ ?Y, ?n, :y_root ], + [ ?W, ?w, :widget ], + [ ?X, ?n, :x_root ], + [ ?Y, ?n, :y_root ], # ?Z nil ] @@ -356,16 +356,16 @@ module TkEvent # the subst-key string will be converted to a bytecode (128+idx). LONGKEY_TBL = [ # for example, for %CTT and %CST subst-key on tkdnd-2.0 - # ['CTT', ?l, :drop_target_type], - # ['CST', ?l, :drop_source_type], + # ['CTT', ?l, :drop_target_type], + # ['CST', ?l, :drop_source_type], ] # [ <proc type char>, <proc/method to convert tcl-str to ruby-obj>] PROC_TBL = [ - [ ?n, TkComm.method(:num_or_str) ], - [ ?s, TkComm.method(:string) ], - [ ?b, TkComm.method(:bool) ], - [ ?w, TkComm.method(:window) ], + [ ?n, TkComm.method(:num_or_str) ], + [ ?s, TkComm.method(:string) ], + [ ?b, TkComm.method(:bool) ], + [ ?w, TkComm.method(:window) ], [ ?x, proc{|val| begin @@ -374,7 +374,7 @@ module TkEvent val end } - ], + ], nil ] @@ -399,25 +399,25 @@ module TkEvent # setup tables to be used by scan_args, _get_subst_key, _get_all_subst_keys # - # _get_subst_key() and _get_all_subst_keys() generates key-string - # which describe how to convert callback arguments to ruby objects. - # When binding parameters are given, use _get_subst_key(). - # But when no parameters are given, use _get_all_subst_keys() to - # create a Event class object as a callback parameter. + # _get_subst_key() and _get_all_subst_keys() generates key-string + # which describe how to convert callback arguments to ruby objects. + # When binding parameters are given, use _get_subst_key(). + # But when no parameters are given, use _get_all_subst_keys() to + # create a Event class object as a callback parameter. # - # scan_args() is used when doing callback. It convert arguments - # ( which are Tcl strings ) to ruby objects based on the key string - # that is generated by _get_subst_key() or _get_all_subst_keys(). + # scan_args() is used when doing callback. It convert arguments + # ( which are Tcl strings ) to ruby objects based on the key string + # that is generated by _get_subst_key() or _get_all_subst_keys(). # _setup_subst_table(KEY_TBL, PROC_TBL) # _setup_subst_table(KEY_TBL, LONGKEY_TBL, PROC_TBL) # if use longname-keys # - # NOTE: The order of parameters which passed to callback procedure is + # NOTE: The order of parameters which passed to callback procedure is # <extra_arg>, <extra_arg>, ... , <subst_arg>, <subst_arg>, ... # - # If you need support extra arguments given by Tcl/Tk, + # If you need support extra arguments given by Tcl/Tk, # please override _get_extra_args_tbl # #def self._get_extra_args_tbl @@ -436,15 +436,15 @@ module TkEvent alias sendevent send_event =end ALIAS_TBL = { - :button => :num, - :data => :detail, - :delta => :wheel_delta, - :root => :rootwin_id, - :rootx => :x_root, - :root_x => :x_root, - :rooty => :y_root, - :root_y => :y_root, - :sendevent => :send_event, + :button => :num, + :data => :detail, + :delta => :wheel_delta, + :root => :rootwin_id, + :rootx => :x_root, + :root_x => :x_root, + :rooty => :y_root, + :root_y => :y_root, + :sendevent => :send_event, :window => :widget } diff --git a/ext/tk/lib/tk/font.rb b/ext/tk/lib/tk/font.rb index 62d628c132..da6482c122 100644 --- a/ext/tk/lib/tk/font.rb +++ b/ext/tk/lib/tk/font.rb @@ -20,7 +20,7 @@ class TkFont Tk_FontNameTBL = TkCore::INTERP.create_table Tk_FontUseTBL = TkCore::INTERP.create_table - TkCore::INTERP.init_ip_env{ + TkCore::INTERP.init_ip_env{ Tk_FontNameTBL.mutex.synchronize{ Tk_FontNameTBL.clear } Tk_FontUseTBL.mutex.synchronize{ Tk_FontUseTBL.clear } } @@ -66,8 +66,8 @@ class TkFont knj = 'defaultgui' when /Mincho:Helvetica-Bold-12/ # Tcl/Tk-JP for UNIX/X - ltn, knj = tk_split_simplelist(tk_call('font', 'configure', - 'Mincho:Helvetica-Bold-12', + ltn, knj = tk_split_simplelist(tk_call('font', 'configure', + 'Mincho:Helvetica-Bold-12', '-compound')) else # unknown Tcl/Tk-JP @@ -75,7 +75,7 @@ class TkFont platform = Tk::PLATFORM['platform'] case platform when 'unix' - ltn = {'family'=>'Helvetica'.freeze, + ltn = {'family'=>'Helvetica'.freeze, 'size'=>-12, 'weight'=>'bold'.freeze} #knj = 'k14' #knj = '-misc-fixed-medium-r-normal--14-*-*-*-c-*-jisx0208.1983-0' @@ -102,7 +102,7 @@ class TkFont platform = Tk::PLATFORM['platform'] case platform when 'unix' - ltn = {'family'=>'Helvetica'.freeze, + ltn = {'family'=>'Helvetica'.freeze, 'size'=>-12, 'weight'=>'bold'.freeze} when 'windows' ltn = {'family'=>'MS Sans Serif'.freeze, 'size'=>8} @@ -294,7 +294,7 @@ class TkFont end h = Hash[TkFont.metrics(fnt)] - h.keys.each{|k| + h.keys.each{|k| case TkFont::MetricsType[k.to_s] when ?n h[k] = TkComm::num_or_str(h[k]) @@ -331,7 +331,7 @@ class TkFont end h = Hash[TkFont.metrics_displayof(fnt, win, option)] - h.keys.each{|k| + h.keys.each{|k| case TkFont::MetricsType[k.to_s] when ?n h[k] = TkComm::num_or_str(h[k]) @@ -459,7 +459,7 @@ class TkFont else begin compound = tk_split_simplelist( - Hash[*tk_split_simplelist(tk_call('font', 'configure', + Hash[*tk_split_simplelist(tk_call('font', 'configure', fnt))].collect{|k,v| [k[1..-1], v] }.assoc('compound')[1]) @@ -473,7 +473,7 @@ class TkFont TkFont.new(fnt).call_font_configure([path, key], *args) end else - TkFont.new(compound[0], + TkFont.new(compound[0], compound[1]).call_font_configure([path, key], *args) end end @@ -570,7 +570,7 @@ class TkFont if JAPANIZED_TK tk_call('font', 'create', @latinfont, '-charset', 'iso8859') tk_call('font', 'create', @kanjifont, '-charset', 'jisx0208.1983') - tk_call('font', 'create', @compoundfont, + tk_call('font', 'create', @compoundfont, '-compound', [@latinfont, @kanjifont]) else tk_call('font', 'create', @latinfont) @@ -614,7 +614,7 @@ class TkFont # compound font check if Tk::TK_VERSION == '8.0' && JAPANIZED_TK begin - compound = tk_split_simplelist(tk_call('font', 'configure', + compound = tk_split_simplelist(tk_call('font', 'configure', ltn, '-compound')) if knj == nil if compound != [] @@ -624,7 +624,7 @@ class TkFont if compound != [] ltn = compound[0] end - compound = tk_split_simplelist(tk_call('font', 'configure', + compound = tk_split_simplelist(tk_call('font', 'configure', knj, '-compound')) if compound != [] knj = compound[1] @@ -639,7 +639,7 @@ class TkFont if Tk::TK_VERSION =~ /^4..*/ knj = DEFAULT_KANJI_FONT_NAME else - knj = ltn + knj = ltn end end else @@ -806,7 +806,7 @@ class TkFont if font[:charset] || font['charset'] tk_call('font', 'create', @latinfont, *hash_kv(font)) else - tk_call('font', 'create', @latinfont, + tk_call('font', 'create', @latinfont, '-charset', 'iso8859', *hash_kv(font)) end elsif font.kind_of? Array @@ -815,7 +815,7 @@ class TkFont elsif font.kind_of? TkFont tk_call('font', 'create', @latinfont, '-copy', font.latin_font) elsif font - tk_call('font', 'create', @latinfont, '-copy', font, + tk_call('font', 'create', @latinfont, '-copy', font, '-charset', 'iso8859') else tk_call('font', 'create', @latinfont, '-charset', 'iso8859') @@ -851,7 +851,7 @@ class TkFont if font[:charset] || font['charset'] tk_call('font', 'create', @kanjifont, *hash_kv(font)) else - tk_call('font', 'create', @kanjifont, + tk_call('font', 'create', @kanjifont, '-charset', 'jisx0208.1983', *hash_kv(font)) end elsif font.kind_of? Array @@ -860,7 +860,7 @@ class TkFont elsif font.kind_of? TkFont tk_call('font', 'create', @kanjifont, '-copy', font.kanji_font_id) elsif font - tk_call('font', 'create', @kanjifont, '-copy', font, + tk_call('font', 'create', @kanjifont, '-copy', font, '-charset', 'jisx0208.1983') else tk_call('font', 'create', @kanjifont, '-charset', 'jisx0208.1983') @@ -922,7 +922,7 @@ class TkFont @fontslot = {'font'=>@compoundfont} # @fontslot['font'] = @compoundfont begin - tk_call('font', 'create', @compoundfont, + tk_call('font', 'create', @compoundfont, '-compound', [@latinfont, @kanjifont], *hash_kv(keys)) rescue RuntimeError => e if ltn == knj @@ -930,7 +930,7 @@ class TkFont tk_call('font', 'delete', @latinfont) create_latinfont(DEFAULT_LATIN_FONT_NAME) opts = [] - Hash[*(tk_split_simplelist(tk_call('font', 'configure', + Hash[*(tk_split_simplelist(tk_call('font', 'configure', @kanjifont)))].each{|k,v| case k when '-size', '-weight', '-slant', '-underline', '-overstrike' @@ -938,14 +938,14 @@ class TkFont end } tk_call('font', 'configure', @latinfont, *opts) - tk_call('font', 'create', @compoundfont, + tk_call('font', 'create', @compoundfont, '-compound', [@latinfont, @kanjifont], *hash_kv(keys)) elsif e.message =~ /ascii font .* specified/ tk_call('font', 'delete', @kanjifont) create_kanjifont(DEFAULT_KANJI_FONT_NAME) opts = [] - Hash[*(tk_split_simplelist(tk_call('font', 'configure', + Hash[*(tk_split_simplelist(tk_call('font', 'configure', @latinfont)))].each{|k,v| case k when '-size', '-weight', '-slant', '-underline', '-overstrike' @@ -953,7 +953,7 @@ class TkFont end } tk_call('font', 'configure', @kanjifont, *opts) - tk_call('font', 'create', @compoundfont, + tk_call('font', 'create', @compoundfont, '-compound', [@latinfont, @kanjifont], *hash_kv(keys)) else @@ -1392,7 +1392,7 @@ class TkFont end h = Hash[metrics(option)] - h.keys.each{|k| + h.keys.each{|k| case TkFont::MetricsType[k.to_s] when ?n h[k] = TkComm::num_or_str(h[k]) @@ -1424,7 +1424,7 @@ class TkFont end h = Hash[metrics_displayof(win, option)] - h.keys.each{|k| + h.keys.each{|k| case TkFont::MetricsType[k.to_s] when ?n h[k] = TkComm::num_or_str(h[k]) @@ -1459,7 +1459,7 @@ class TkFont end h = Hash[latin_metrics(option)] - h.keys.each{|k| + h.keys.each{|k| case TkFont::MetricsType[k.to_s] when ?n h[k] = TkComm::num_or_str(h[k]) @@ -1495,7 +1495,7 @@ class TkFont end h = Hash[latin_metrics_displayof(win, option)] - h.keys.each{|k| + h.keys.each{|k| case TkFont::MetricsType[k.to_s] when ?n h[k] = TkComm::num_or_str(h[k]) @@ -1532,7 +1532,7 @@ class TkFont end h = Hash[kanji_metrics(option)] - h.keys.each{|k| + h.keys.each{|k| case TkFont::MetricsType[k.to_s] when ?n h[k] = TkComm::num_or_str(h[k]) @@ -1570,7 +1570,7 @@ class TkFont end h = Hash[kanji_metrics_displayof(win, option)] - h.keys.each{|k| + h.keys.each{|k| case TkFont::MetricsType[k.to_s] when ?n h[k] = TkComm::num_or_str(h[k]) @@ -1586,7 +1586,7 @@ class TkFont def reset_pointadjust begin if /^8\..*/ === Tk::TK_VERSION && JAPANIZED_TK - configure('pointadjust' => latin_actual.assoc('size')[1].to_f / + configure('pointadjust' => latin_actual.assoc('size')[1].to_f / kanji_actual.assoc('size')[1].to_f ) end rescue @@ -1659,8 +1659,8 @@ module TkFont::CoreMethods '' end else - [['family',''], ['size',0], ['weight',''], ['slant',''], - ['underline',false], ['overstrike',false], ['charset',''], + [['family',''], ['size',0], ['weight',''], ['slant',''], + ['underline',false], ['overstrike',false], ['charset',''], ['pointadjust',0]] end end @@ -1672,7 +1672,7 @@ module TkFont::CoreMethods "" elsif option if win - val = tk_call('font', 'actual', font, + val = tk_call('font', 'actual', font, "-displayof", win, "-#{option}") else val = tk_call('font', 'actual', font, "-#{option}") @@ -1687,7 +1687,7 @@ module TkFont::CoreMethods end else l = tk_split_simplelist(if win - tk_call('font', 'actual', font, + tk_call('font', 'actual', font, "-displayof", win) else tk_call('font', 'actual', font) @@ -1733,8 +1733,8 @@ module TkFont::CoreMethods '' end else - [['family',''], ['size',0], ['weight',''], ['slant',''], - ['underline',false], ['overstrike',false], ['charset',''], + [['family',''], ['size',0], ['weight',''], ['slant',''], + ['underline',false], ['overstrike',false], ['charset',''], ['pointadjust',1.0]] end else # ! TkComm::GET_CONFIGINFOwoRES_AS_ARRAY @@ -1753,8 +1753,8 @@ module TkFont::CoreMethods '' end else - {'family'=>'', 'size'=>0, 'weight'=>'', 'slant'=>'', - 'underline'=>false, 'overstrike'=>false, + {'family'=>'', 'size'=>0, 'weight'=>'', 'slant'=>'', + 'underline'=>false, 'overstrike'=>false, 'charset'=>false, 'pointadjust'=>1.0} end end @@ -1775,20 +1775,20 @@ module TkFont::CoreMethods configure_core_tk8x(font, 'family', slot.delete('family')) end - if ((slot.key?('size') || slot.key?(:size)) && + if ((slot.key?('size') || slot.key?(:size)) && padjust && !slot.key?('pointadjust') && !slot.key?(:pointadjust)) - tk_call('font', 'configure', font, + tk_call('font', 'configure', font, '-pointadjust', padjust, *hash_kv(slot)) else tk_call('font', 'configure', font, *hash_kv(slot)) end elsif (slot == 'size' || slot == :size) && padjust != nil - tk_call('font', 'configure', font, + tk_call('font', 'configure', font, "-#{slot}", value, '-pointadjust', padjust) elsif JAPANIZED_TK && (slot == 'family' || slot == :family) # coumpund font? begin - compound = tk_split_simplelist(tk_call('font', 'configure', + compound = tk_split_simplelist(tk_call('font', 'configure', font, '-compound')) rescue tk_call('font', 'configure', font, '-family', value) @@ -1819,7 +1819,7 @@ module TkFont::CoreMethods ensure tk_call('font', 'delete', kfnt) if kfnt != '' end - + else tk_call('font', 'configure', font, "-#{slot}", value) end @@ -2044,7 +2044,7 @@ module TkFont::CoreMethods keys = self.configinfo tk_call('font', 'delete', @compoundfont) begin - tk_call('font', 'create', @compoundfont, + tk_call('font', 'create', @compoundfont, '-compound', [@latinfont, @kanjifont], *hash_kv(keys)) =begin latinkeys = {} @@ -2061,7 +2061,7 @@ module TkFont::CoreMethods tk_call('font', 'delete', @latinfont) if fnt_bup && fnt_bup != '' tk_call('font', 'create', @latinfont, '-copy', fnt_bup) - tk_call('font', 'create', @compoundfont, + tk_call('font', 'create', @compoundfont, '-compound', [@latinfont, @kanjifont], *hash_kv(keys)) tk_call('font', 'delete', fnt_bup) else @@ -2082,7 +2082,7 @@ module TkFont::CoreMethods # not exist? (deleted?) -> create font tk_call('font', 'create', @compoundfont, *hash_kv(latinkeys)) end - end + end self end @@ -2112,20 +2112,20 @@ module TkFont::CoreMethods keys = self.configinfo tk_call('font', 'delete', @compoundfont) begin - tk_call('font', 'create', @compoundfont, + tk_call('font', 'create', @compoundfont, '-compound', [@latinfont, @kanjifont], *hash_kv(keys)) rescue RuntimeError => e tk_call('font', 'delete', @kanjifont) if fnt_bup && fnt_bup != '' tk_call('font', 'create', @kanjifont, '-copy', fnt_bup) - tk_call('font', 'create', @compoundfont, + tk_call('font', 'create', @compoundfont, '-compound', [@latinfont, @kanjifont], *hash_kv(keys)) tk_call('font', 'delete', fnt_bup) else fail e end end - end + end self end @@ -2137,7 +2137,7 @@ module TkFont::CoreMethods font = '{}' if font == '' if win - number(tk_call('font', 'measure', font, + number(tk_call('font', 'measure', font, '-displayof', win, text)) else number(tk_call('font', 'measure', font, text)) @@ -2158,7 +2158,7 @@ module TkFont::CoreMethods if option if win - number(tk_call('font', 'metrics', font, + number(tk_call('font', 'metrics', font, "-displayof", win, "-#{option}")) else number(tk_call('font', 'metrics', font, "-#{option}")) @@ -2304,12 +2304,12 @@ end ####################################### # define system font names ####################################### -if Tk::TCL_MAJOR_VERSION > 8 || +if Tk::TCL_MAJOR_VERSION > 8 || (Tk::TCL_MAJOR_VERSION == 8 && Tk::TCL_MINOR_VERSION >= 5) # add standard fonts of Tcl/Tk 8.5+ TkFont::SYSTEM_FONT_NAMES.add [ - 'TkDefaultFont', 'TkTextFont', 'TkFixedFont', 'TkMenuFont', - 'TkHeadingFont', 'TkCaptionFont', 'TkSmallCaptionFont', + 'TkDefaultFont', 'TkTextFont', 'TkFixedFont', 'TkMenuFont', + 'TkHeadingFont', 'TkCaptionFont', 'TkSmallCaptionFont', 'TkIconFont', 'TkTooltipFont' ] end @@ -2323,22 +2323,22 @@ TkFont::SYSTEM_FONT_NAMES.add [ # -- macintosh, macosx TkFont::SYSTEM_FONT_NAMES.add ['system', 'application'] -if Tk::TCL_MAJOR_VERSION > 8 || +if Tk::TCL_MAJOR_VERSION > 8 || (Tk::TCL_MAJOR_VERSION == 8 && Tk::TCL_MINOR_VERSION >= 5) TkFont::SYSTEM_FONT_NAMES.add ['menu'] end # -- macosx (Aqua theme) -if Tk::TCL_MAJOR_VERSION > 8 || +if Tk::TCL_MAJOR_VERSION > 8 || (Tk::TCL_MAJOR_VERSION == 8 && Tk::TCL_MINOR_VERSION >= 5) TkFont::SYSTEM_FONT_NAMES.add [ - 'systemSystemFont', 'systemEmphasizedSystemFont', - 'systemSmallSystemFont', 'systemSmallEmphasizedSystemFont', - 'systemApplicationFont', 'systemLabelFont', 'systemViewsFont', - 'systemMenuTitleFont', 'systemMenuItemFont', 'systemMenuItemMarkFont', - 'systemMenuItemCmdKeyFont', 'systemWindowTitleFont', - 'systemPushButtonFont', 'systemUtilityWindowTitleFont', - 'systemAlertHeaderFont', 'systemToolbarFont', 'systemMiniSystemFont', + 'systemSystemFont', 'systemEmphasizedSystemFont', + 'systemSmallSystemFont', 'systemSmallEmphasizedSystemFont', + 'systemApplicationFont', 'systemLabelFont', 'systemViewsFont', + 'systemMenuTitleFont', 'systemMenuItemFont', 'systemMenuItemMarkFont', + 'systemMenuItemCmdKeyFont', 'systemWindowTitleFont', + 'systemPushButtonFont', 'systemUtilityWindowTitleFont', + 'systemAlertHeaderFont', 'systemToolbarFont', 'systemMiniSystemFont', 'systemDetailSystemFont', 'systemDetailEmphasizedSystemFont' ] end diff --git a/ext/tk/lib/tk/grid.rb b/ext/tk/lib/tk/grid.rb index 0dfd7263a7..ca476a6ab5 100644 --- a/ext/tk/lib/tk/grid.rb +++ b/ext/tk/lib/tk/grid.rb @@ -101,7 +101,7 @@ module TkGrid def columnconfigure(master, index, args) # master = master.epath if master.kind_of?(TkObject) master = _epath(master) - tk_call_without_enc("grid", 'columnconfigure', + tk_call_without_enc("grid", 'columnconfigure', master, index, *hash_kv(args)) end alias column columnconfigure @@ -119,15 +119,15 @@ module TkGrid if slot case slot when 'uniform', :uniform - tk_call_without_enc('grid', 'columnconfigure', + tk_call_without_enc('grid', 'columnconfigure', master, index, "-#{slot}") else - num_or_str(tk_call_without_enc('grid', 'columnconfigure', + num_or_str(tk_call_without_enc('grid', 'columnconfigure', master, index, "-#{slot}")) end else #ilist = list(tk_call_without_enc('grid','columnconfigure',master,index)) - ilist = simplelist(tk_call_without_enc('grid', 'columnconfigure', + ilist = simplelist(tk_call_without_enc('grid', 'columnconfigure', master, index)) info = {} while key = ilist.shift @@ -148,15 +148,15 @@ module TkGrid if slot case slot when 'uniform', :uniform - tk_call_without_enc('grid', 'rowconfigure', + tk_call_without_enc('grid', 'rowconfigure', master, index, "-#{slot}") else - num_or_str(tk_call_without_enc('grid', 'rowconfigure', + num_or_str(tk_call_without_enc('grid', 'rowconfigure', master, index, "-#{slot}")) end else #ilist = list(tk_call_without_enc('grid', 'rowconfigure', master, index)) - ilist = simplelist(tk_call_without_enc('grid', 'rowconfigure', + ilist = simplelist(tk_call_without_enc('grid', 'rowconfigure', master, index)) info = {} while key = ilist.shift diff --git a/ext/tk/lib/tk/image.rb b/ext/tk/lib/tk/image.rb index dffdc19644..09f173909d 100644 --- a/ext/tk/lib/tk/image.rb +++ b/ext/tk/lib/tk/image.rb @@ -45,7 +45,7 @@ class TkImage<TkObject keys.delete('imagename') keys.delete('without_creating') obj.instance_eval{ - tk_call_without_enc('image', 'create', + tk_call_without_enc('image', 'create', @type, @path, *hash_kv(keys, true)) } end @@ -78,7 +78,7 @@ class TkImage<TkObject } end unless without_creating - tk_call_without_enc('image', 'create', + tk_call_without_enc('image', 'create', @type, @path, *hash_kv(keys, true)) end end diff --git a/ext/tk/lib/tk/itemconfig.rb b/ext/tk/lib/tk/itemconfig.rb index 9c6a98d0f8..cd05d7ea53 100644 --- a/ext/tk/lib/tk/itemconfig.rb +++ b/ext/tk/lib/tk/itemconfig.rb @@ -31,10 +31,10 @@ module TkItemConfigOptkeys def __item_strval_optkeys(id) # maybe need to override [ - 'text', 'label', 'show', 'data', 'file', 'maskdata', 'maskfile', - 'activebackground', 'activeforeground', 'background', - 'disabledforeground', 'disabledbackground', 'foreground', - 'highlightbackground', 'highlightcolor', 'insertbackground', + 'text', 'label', 'show', 'data', 'file', 'maskdata', 'maskfile', + 'activebackground', 'activeforeground', 'background', + 'disabledforeground', 'disabledbackground', 'foreground', + 'highlightbackground', 'highlightcolor', 'insertbackground', 'selectbackground', 'selectforeground', 'troughcolor' ] end @@ -148,7 +148,7 @@ module TkItemConfigMethod def __item_configinfo_struct(id) # maybe need to override - {:key=>0, :alias=>1, :db_name=>1, :db_class=>2, + {:key=>0, :alias=>1, :db_name=>1, :db_class=>2, :default_value=>3, :current_value=>4} end private :__item_configinfo_struct @@ -402,7 +402,7 @@ module TkItemConfigMethod fontkey = $2 # conf = tk_split_simplelist(_fromUTF8(tk_call_without_enc(*(__item_confinfo_cmd(tagid(tagOrId)) << "-#{fontkey}")))) conf = tk_split_simplelist(tk_call_without_enc(*(__item_confinfo_cmd(tagid(tagOrId)) << "-#{fontkey}")), false, true) - conf[__item_configinfo_struct(tagid(tagOrId))[:key]] = + conf[__item_configinfo_struct(tagid(tagOrId))[:key]] = conf[__item_configinfo_struct(tagid(tagOrId))[:key]][1..-1] if ( ! __item_configinfo_struct(tagid(tagOrId))[:alias] \ || conf.size > __item_configinfo_struct(tagid(tagOrId))[:alias] + 1 ) @@ -414,7 +414,7 @@ module TkItemConfigMethod elsif ( __item_configinfo_struct(tagid(tagOrId))[:alias] \ && conf.size == __item_configinfo_struct(tagid(tagOrId))[:alias] + 1 \ && conf[__item_configinfo_struct(tagid(tagOrId))[:alias]][0] == ?- ) - conf[__item_configinfo_struct(tagid(tagOrId))[:alias]] = + conf[__item_configinfo_struct(tagid(tagOrId))[:alias]] = conf[__item_configinfo_struct(tagid(tagOrId))[:alias]][1..-1] end conf @@ -464,7 +464,7 @@ module TkItemConfigMethod if ( __item_configinfo_struct(tagid(tagOrId))[:default_value] \ && conf[__item_configinfo_struct(tagid(tagOrId))[:default_value]] ) begin - conf[__item_configinfo_struct(tagid(tagOrId))[:default_value]] = + conf[__item_configinfo_struct(tagid(tagOrId))[:default_value]] = number(conf[__item_configinfo_struct(tagid(tagOrId))[:default_value]]) rescue conf[__item_configinfo_struct(tagid(tagOrId))[:default_value]] = nil @@ -472,7 +472,7 @@ module TkItemConfigMethod end if ( conf[__item_configinfo_struct(tagid(tagOrId))[:current_value]] ) begin - conf[__item_configinfo_struct(tagid(tagOrId))[:current_value]] = + conf[__item_configinfo_struct(tagid(tagOrId))[:current_value]] = number(conf[__item_configinfo_struct(tagid(tagOrId))[:current_value]]) rescue conf[__item_configinfo_struct(tagid(tagOrId))[:current_value]] = nil @@ -485,11 +485,11 @@ module TkItemConfigMethod if ( __item_configinfo_struct(tagid(tagOrId))[:default_value] \ && conf[__item_configinfo_struct(tagid(tagOrId))[:default_value]] ) - conf[__item_configinfo_struct(tagid(tagOrId))[:default_value]] = + conf[__item_configinfo_struct(tagid(tagOrId))[:default_value]] = num_or_str(conf[__item_configinfo_struct(tagid(tagOrId))[:default_value]]) end if ( conf[__item_configinfo_struct(tagid(tagOrId))[:current_value]] ) - conf[__item_configinfo_struct(tagid(tagOrId))[:current_value]] = + conf[__item_configinfo_struct(tagid(tagOrId))[:current_value]] = num_or_str(conf[__item_configinfo_struct(tagid(tagOrId))[:current_value]]) end @@ -500,7 +500,7 @@ module TkItemConfigMethod if ( __item_configinfo_struct(tagid(tagOrId))[:default_value] \ && conf[__item_configinfo_struct(tagid(tagOrId))[:default_value]] ) begin - conf[__item_configinfo_struct(tagid(tagOrId))[:default_value]] = + conf[__item_configinfo_struct(tagid(tagOrId))[:default_value]] = bool(conf[__item_configinfo_struct(tagid(tagOrId))[:default_value]]) rescue conf[__item_configinfo_struct(tagid(tagOrId))[:default_value]] = nil @@ -508,7 +508,7 @@ module TkItemConfigMethod end if ( conf[__item_configinfo_struct(tagid(tagOrId))[:current_value]] ) begin - conf[__item_configinfo_struct(tagid(tagOrId))[:current_value]] = + conf[__item_configinfo_struct(tagid(tagOrId))[:current_value]] = bool(conf[__item_configinfo_struct(tagid(tagOrId))[:current_value]]) rescue conf[__item_configinfo_struct(tagid(tagOrId))[:current_value]] = nil @@ -521,11 +521,11 @@ module TkItemConfigMethod if ( __item_configinfo_struct(tagid(tagOrId))[:default_value] \ && conf[__item_configinfo_struct(tagid(tagOrId))[:default_value]] ) - conf[__item_configinfo_struct(tagid(tagOrId))[:default_value]] = + conf[__item_configinfo_struct(tagid(tagOrId))[:default_value]] = simplelist(conf[__item_configinfo_struct(tagid(tagOrId))[:default_value]]) end if ( conf[__item_configinfo_struct(tagid(tagOrId))[:current_value]] ) - conf[__item_configinfo_struct(tagid(tagOrId))[:current_value]] = + conf[__item_configinfo_struct(tagid(tagOrId))[:current_value]] = simplelist(conf[__item_configinfo_struct(tagid(tagOrId))[:current_value]]) end @@ -536,12 +536,12 @@ module TkItemConfigMethod if ( __item_configinfo_struct(tagid(tagOrId))[:default_value] \ && conf[__item_configinfo_struct(tagid(tagOrId))[:default_value]] \ && conf[__item_configinfo_struct(tagid(tagOrId))[:default_value]] =~ /^[0-9]/ ) - conf[__item_configinfo_struct(tagid(tagOrId))[:default_value]] = + conf[__item_configinfo_struct(tagid(tagOrId))[:default_value]] = list(conf[__item_configinfo_struct(tagid(tagOrId))[:default_value]]) end if ( conf[__item_configinfo_struct(tagid(tagOrId))[:current_value]] \ && conf[__item_configinfo_struct(tagid(tagOrId))[:current_value]] =~ /^[0-9]/ ) - conf[__item_configinfo_struct(tagid(tagOrId))[:current_value]] = + conf[__item_configinfo_struct(tagid(tagOrId))[:current_value]] = list(conf[__item_configinfo_struct(tagid(tagOrId))[:current_value]]) end @@ -574,13 +574,13 @@ module TkItemConfigMethod # conf = tk_split_list(_fromUTF8(tk_call_without_enc(*(__item_confinfo_cmd(tagid(tagOrId)) << "-#{slot}")))) conf = tk_split_list(tk_call_without_enc(*(__item_confinfo_cmd(tagid(tagOrId)) << "-#{slot}")), 0, false, true) end - conf[__item_configinfo_struct(tagid(tagOrId))[:key]] = + conf[__item_configinfo_struct(tagid(tagOrId))[:key]] = conf[__item_configinfo_struct(tagid(tagOrId))[:key]][1..-1] if ( __item_configinfo_struct(tagid(tagOrId))[:alias] \ && conf.size == __item_configinfo_struct(tagid(tagOrId))[:alias] + 1 \ && conf[__item_configinfo_struct(tagid(tagOrId))[:alias]][0] == ?- ) - conf[__item_configinfo_struct(tagid(tagOrId))[:alias]] = + conf[__item_configinfo_struct(tagid(tagOrId))[:alias]] = conf[__item_configinfo_struct(tagid(tagOrId))[:alias]][1..-1] end @@ -591,7 +591,7 @@ module TkItemConfigMethod # conf = tk_split_simplelist(conflist) ret = tk_split_simplelist(tk_call_without_enc(*(__item_confinfo_cmd(tagid(tagOrId)))), false, false).collect{|conflist| conf = tk_split_simplelist(conflist, false, true) - conf[__item_configinfo_struct(tagid(tagOrId))[:key]] = + conf[__item_configinfo_struct(tagid(tagOrId))[:key]] = conf[__item_configinfo_struct(tagid(tagOrId))[:key]][1..-1] optkey = conf[__item_configinfo_struct(tagid(tagOrId))[:key]] @@ -627,7 +627,7 @@ module TkItemConfigMethod if ( __item_configinfo_struct(tagid(tagOrId))[:default_value] \ && conf[__item_configinfo_struct(tagid(tagOrId))[:default_value]] ) begin - conf[__item_configinfo_struct(tagid(tagOrId))[:default_value]] = + conf[__item_configinfo_struct(tagid(tagOrId))[:default_value]] = number(conf[__item_configinfo_struct(tagid(tagOrId))[:default_value]]) rescue conf[__item_configinfo_struct(tagid(tagOrId))[:default_value]] = nil @@ -635,7 +635,7 @@ module TkItemConfigMethod end if ( conf[__item_configinfo_struct(tagid(tagOrId))[:current_value]] ) begin - conf[__item_configinfo_struct(tagid(tagOrId))[:current_value]] = + conf[__item_configinfo_struct(tagid(tagOrId))[:current_value]] = number(conf[__item_configinfo_struct(tagid(tagOrId))[:current_value]]) rescue conf[__item_configinfo_struct(tagid(tagOrId))[:current_value]] = nil @@ -645,11 +645,11 @@ module TkItemConfigMethod when /^(#{__item_numstrval_optkeys(tagid(tagOrId)).join('|')})$/ if ( __item_configinfo_struct(tagid(tagOrId))[:default_value] \ && conf[__item_configinfo_struct(tagid(tagOrId))[:default_value]] ) - conf[__item_configinfo_struct(tagid(tagOrId))[:default_value]] = + conf[__item_configinfo_struct(tagid(tagOrId))[:default_value]] = num_or_str(conf[__item_configinfo_struct(tagid(tagOrId))[:default_value]]) end if ( conf[__item_configinfo_struct(tagid(tagOrId))[:current_value]] ) - conf[__item_configinfo_struct(tagid(tagOrId))[:current_value]] = + conf[__item_configinfo_struct(tagid(tagOrId))[:current_value]] = num_or_str(conf[__item_configinfo_struct(tagid(tagOrId))[:current_value]]) end @@ -657,7 +657,7 @@ module TkItemConfigMethod if ( __item_configinfo_struct(tagid(tagOrId))[:default_value] \ && conf[__item_configinfo_struct(tagid(tagOrId))[:default_value]] ) begin - conf[__item_configinfo_struct(tagid(tagOrId))[:default_value]] = + conf[__item_configinfo_struct(tagid(tagOrId))[:default_value]] = bool(conf[__item_configinfo_struct(tagid(tagOrId))[:default_value]]) rescue conf[__item_configinfo_struct(tagid(tagOrId))[:default_value]] = nil @@ -665,7 +665,7 @@ module TkItemConfigMethod end if ( conf[__item_configinfo_struct(tagid(tagOrId))[:current_value]] ) begin - conf[__item_configinfo_struct(tagid(tagOrId))[:current_value]] = + conf[__item_configinfo_struct(tagid(tagOrId))[:current_value]] = bool(conf[__item_configinfo_struct(tagid(tagOrId))[:current_value]]) rescue conf[__item_configinfo_struct(tagid(tagOrId))[:current_value]] = nil @@ -675,11 +675,11 @@ module TkItemConfigMethod when /^(#{__item_listval_optkeys(tagid(tagOrId)).join('|')})$/ if ( __item_configinfo_struct(tagid(tagOrId))[:default_value] \ && conf[__item_configinfo_struct(tagid(tagOrId))[:default_value]] ) - conf[__item_configinfo_struct(tagid(tagOrId))[:default_value]] = + conf[__item_configinfo_struct(tagid(tagOrId))[:default_value]] = simplelist(conf[__item_configinfo_struct(tagid(tagOrId))[:default_value]]) end if ( conf[__item_configinfo_struct(tagid(tagOrId))[:current_value]] ) - conf[__item_configinfo_struct(tagid(tagOrId))[:current_value]] = + conf[__item_configinfo_struct(tagid(tagOrId))[:current_value]] = simplelist(conf[__item_configinfo_struct(tagid(tagOrId))[:current_value]]) end @@ -687,12 +687,12 @@ module TkItemConfigMethod if ( __item_configinfo_struct(tagid(tagOrId))[:default_value] \ && conf[__item_configinfo_struct(tagid(tagOrId))[:default_value]] \ && conf[__item_configinfo_struct(tagid(tagOrId))[:default_value]] =~ /^[0-9]/ ) - conf[__item_configinfo_struct(tagid(tagOrId))[:default_value]] = + conf[__item_configinfo_struct(tagid(tagOrId))[:default_value]] = list(conf[__item_configinfo_struct(tagid(tagOrId))[:default_value]]) end if ( conf[__item_configinfo_struct(tagid(tagOrId))[:current_value]] \ && conf[__item_configinfo_struct(tagid(tagOrId))[:current_value]] =~ /^[0-9]/ ) - conf[__item_configinfo_struct(tagid(tagOrId))[:current_value]] = + conf[__item_configinfo_struct(tagid(tagOrId))[:current_value]] = list(conf[__item_configinfo_struct(tagid(tagOrId))[:current_value]]) end @@ -719,20 +719,20 @@ module TkItemConfigMethod if ( __item_configinfo_struct(tagid(tagOrId))[:default_value] \ && conf[__item_configinfo_struct(tagid(tagOrId))[:default_value]] ) if conf[__item_configinfo_struct(tagid(tagOrId))[:default_value]].index('{') - conf[__item_configinfo_struct(tagid(tagOrId))[:default_value]] = - tk_split_list(conf[__item_configinfo_struct(tagid(tagOrId))[:default_value]]) + conf[__item_configinfo_struct(tagid(tagOrId))[:default_value]] = + tk_split_list(conf[__item_configinfo_struct(tagid(tagOrId))[:default_value]]) else - conf[__item_configinfo_struct(tagid(tagOrId))[:default_value]] = - tk_tcl2ruby(conf[__item_configinfo_struct(tagid(tagOrId))[:default_value]]) + conf[__item_configinfo_struct(tagid(tagOrId))[:default_value]] = + tk_tcl2ruby(conf[__item_configinfo_struct(tagid(tagOrId))[:default_value]]) end end if conf[__item_configinfo_struct(tagid(tagOrId))[:current_value]] if conf[__item_configinfo_struct(tagid(tagOrId))[:current_value]].index('{') - conf[__item_configinfo_struct(tagid(tagOrId))[:current_value]] = - tk_split_list(conf[__item_configinfo_struct(tagid(tagOrId))[:current_value]]) + conf[__item_configinfo_struct(tagid(tagOrId))[:current_value]] = + tk_split_list(conf[__item_configinfo_struct(tagid(tagOrId))[:current_value]]) else - conf[__item_configinfo_struct(tagid(tagOrId))[:current_value]] = - tk_tcl2ruby(conf[__item_configinfo_struct(tagid(tagOrId))[:current_value]]) + conf[__item_configinfo_struct(tagid(tagOrId))[:current_value]] = + tk_tcl2ruby(conf[__item_configinfo_struct(tagid(tagOrId))[:current_value]]) end end end @@ -740,7 +740,7 @@ module TkItemConfigMethod if ( __item_configinfo_struct(tagid(tagOrId))[:alias] \ && conf.size == __item_configinfo_struct(tagid(tagOrId))[:alias] + 1 \ && conf[__item_configinfo_struct(tagid(tagOrId))[:alias]][0] == ?- ) - conf[__item_configinfo_struct(tagid(tagOrId))[:alias]] = + conf[__item_configinfo_struct(tagid(tagOrId))[:alias]] = conf[__item_configinfo_struct(tagid(tagOrId))[:alias]][1..-1] end @@ -774,7 +774,7 @@ module TkItemConfigMethod fontkey = $2 # conf = tk_split_simplelist(_fromUTF8(tk_call_without_enc(*(__item_confinfo_cmd(tagid(tagOrId)) << "-#{fontkey}")))) conf = tk_split_simplelist(tk_call_without_enc(*(__item_confinfo_cmd(tagid(tagOrId)) << "-#{fontkey}")), false, true) - conf[__item_configinfo_struct(tagid(tagOrId))[:key]] = + conf[__item_configinfo_struct(tagid(tagOrId))[:key]] = conf[__item_configinfo_struct(tagid(tagOrId))[:key]][1..-1] if ( ! __item_configinfo_struct(tagid(tagOrId))[:alias] \ @@ -788,7 +788,7 @@ module TkItemConfigMethod elsif ( __item_configinfo_struct(tagid(tagOrId))[:alias] \ && conf.size == __item_configinfo_struct(tagid(tagOrId))[:alias] + 1 ) if conf[__item_configinfo_struct(tagid(tagOrId))[:alias]][0] == ?- - conf[__item_configinfo_struct(tagid(tagOrId))[:alias]] = + conf[__item_configinfo_struct(tagid(tagOrId))[:alias]] = conf[__item_configinfo_struct(tagid(tagOrId))[:alias]][1..-1] end { conf[0] => conf[1] } @@ -841,7 +841,7 @@ module TkItemConfigMethod if ( __item_configinfo_struct(tagid(tagOrId))[:default_value] \ && conf[__item_configinfo_struct(tagid(tagOrId))[:default_value]] ) begin - conf[__item_configinfo_struct(tagid(tagOrId))[:default_value]] = + conf[__item_configinfo_struct(tagid(tagOrId))[:default_value]] = number(conf[__item_configinfo_struct(tagid(tagOrId))[:default_value]]) rescue conf[__item_configinfo_struct(tagid(tagOrId))[:default_value]] = nil @@ -849,7 +849,7 @@ module TkItemConfigMethod end if ( conf[__item_configinfo_struct(tagid(tagOrId))[:current_value]] ) begin - conf[__item_configinfo_struct(tagid(tagOrId))[:current_value]] = + conf[__item_configinfo_struct(tagid(tagOrId))[:current_value]] = number(conf[__item_configinfo_struct(tagid(tagOrId))[:current_value]]) rescue conf[__item_configinfo_struct(tagid(tagOrId))[:current_value]] = nil @@ -862,11 +862,11 @@ module TkItemConfigMethod if ( __item_configinfo_struct(tagid(tagOrId))[:default_value] \ && conf[__item_configinfo_struct(tagid(tagOrId))[:default_value]] ) - conf[__item_configinfo_struct(tagid(tagOrId))[:default_value]] = + conf[__item_configinfo_struct(tagid(tagOrId))[:default_value]] = num_or_stre(conf[__item_configinfo_struct(tagid(tagOrId))[:default_value]]) end if ( conf[__item_configinfo_struct(tagid(tagOrId))[:current_value]] ) - conf[__item_configinfo_struct(tagid(tagOrId))[:current_value]] = + conf[__item_configinfo_struct(tagid(tagOrId))[:current_value]] = num_or_str(conf[__item_configinfo_struct(tagid(tagOrId))[:current_value]]) end @@ -877,7 +877,7 @@ module TkItemConfigMethod if ( __item_configinfo_struct(tagid(tagOrId))[:default_value] \ && conf[__item_configinfo_struct(tagid(tagOrId))[:default_value]] ) begin - conf[__item_configinfo_struct(tagid(tagOrId))[:default_value]] = + conf[__item_configinfo_struct(tagid(tagOrId))[:default_value]] = bool(conf[__item_configinfo_struct(tagid(tagOrId))[:default_value]]) rescue conf[__item_configinfo_struct(tagid(tagOrId))[:default_value]] = nil @@ -885,7 +885,7 @@ module TkItemConfigMethod end if ( conf[__item_configinfo_struct(tagid(tagOrId))[:current_value]] ) begin - conf[__item_configinfo_struct(tagid(tagOrId))[:current_value]] = + conf[__item_configinfo_struct(tagid(tagOrId))[:current_value]] = bool(conf[__item_configinfo_struct(tagid(tagOrId))[:current_value]]) rescue conf[__item_configinfo_struct(tagid(tagOrId))[:current_value]] = nil @@ -898,11 +898,11 @@ module TkItemConfigMethod if ( __item_configinfo_struct(tagid(tagOrId))[:default_value] \ && conf[__item_configinfo_struct(tagid(tagOrId))[:default_value]] ) - conf[__item_configinfo_struct(tagid(tagOrId))[:default_value]] = + conf[__item_configinfo_struct(tagid(tagOrId))[:default_value]] = simplelist(conf[__item_configinfo_struct(tagid(tagOrId))[:default_value]]) end if ( conf[__item_configinfo_struct(tagid(tagOrId))[:current_value]] ) - conf[__item_configinfo_struct(tagid(tagOrId))[:current_value]] = + conf[__item_configinfo_struct(tagid(tagOrId))[:current_value]] = simplelist(conf[__item_configinfo_struct(tagid(tagOrId))[:current_value]]) end @@ -913,12 +913,12 @@ module TkItemConfigMethod if ( __item_configinfo_struct(tagid(tagOrId))[:default_value] \ && conf[__item_configinfo_struct(tagid(tagOrId))[:default_value]] \ && conf[__item_configinfo_struct(tagid(tagOrId))[:default_value]] =~ /^[0-9]/ ) - conf[__item_configinfo_struct(tagid(tagOrId))[:default_value]] = + conf[__item_configinfo_struct(tagid(tagOrId))[:default_value]] = list(conf[__item_configinfo_struct(tagid(tagOrId))[:default_value]]) end if ( conf[__item_configinfo_struct(tagid(tagOrId))[:current_value]] \ && conf[__item_configinfo_struct(tagid(tagOrId))[:current_value]] =~ /^[0-9]/ ) - conf[__item_configinfo_struct(tagid(tagOrId))[:current_value]] = + conf[__item_configinfo_struct(tagid(tagOrId))[:current_value]] = list(conf[__item_configinfo_struct(tagid(tagOrId))[:current_value]]) end @@ -951,13 +951,13 @@ module TkItemConfigMethod # conf = tk_split_list(_fromUTF8(tk_call_without_enc(*(__item_confinfo_cmd(tagid(tagOrId)) << "-#{slot}")))) conf = tk_split_list(tk_call_without_enc(*(__item_confinfo_cmd(tagid(tagOrId)) << "-#{slot}")), 0, false, true) end - conf[__item_configinfo_struct(tagid(tagOrId))[:key]] = + conf[__item_configinfo_struct(tagid(tagOrId))[:key]] = conf[__item_configinfo_struct(tagid(tagOrId))[:key]][1..-1] if ( __item_configinfo_struct(tagid(tagOrId))[:alias] \ && conf.size == __item_configinfo_struct(tagid(tagOrId))[:alias] + 1 ) if conf[__item_configinfo_struct(tagid(tagOrId))[:alias]][0] == ?- - conf[__item_configinfo_struct(tagid(tagOrId))[:alias]] = + conf[__item_configinfo_struct(tagid(tagOrId))[:alias]] = conf[__item_configinfo_struct(tagid(tagOrId))[:alias]][1..-1] end { conf[0] => conf[1] } @@ -971,7 +971,7 @@ module TkItemConfigMethod # conf = tk_split_simplelist(conflist) tk_split_simplelist(tk_call_without_enc(*(__item_confinfo_cmd(tagid(tagOrId)))), false, false).each{|conflist| conf = tk_split_simplelist(conflist, false, true) - conf[__item_configinfo_struct(tagid(tagOrId))[:key]] = + conf[__item_configinfo_struct(tagid(tagOrId))[:key]] = conf[__item_configinfo_struct(tagid(tagOrId))[:key]][1..-1] optkey = conf[__item_configinfo_struct(tagid(tagOrId))[:key]] @@ -1007,7 +1007,7 @@ module TkItemConfigMethod if ( __item_configinfo_struct(tagid(tagOrId))[:default_value] \ && conf[__item_configinfo_struct(tagid(tagOrId))[:default_value]] ) begin - conf[__item_configinfo_struct(tagid(tagOrId))[:default_value]] = + conf[__item_configinfo_struct(tagid(tagOrId))[:default_value]] = number(conf[__item_configinfo_struct(tagid(tagOrId))[:default_value]]) rescue conf[__item_configinfo_struct(tagid(tagOrId))[:default_value]] = nil @@ -1015,7 +1015,7 @@ module TkItemConfigMethod end if ( conf[__item_configinfo_struct(tagid(tagOrId))[:current_value]] ) begin - conf[__item_configinfo_struct(tagid(tagOrId))[:current_value]] = + conf[__item_configinfo_struct(tagid(tagOrId))[:current_value]] = number(conf[__item_configinfo_struct(tagid(tagOrId))[:current_value]]) rescue conf[__item_configinfo_struct(tagid(tagOrId))[:current_value]] = nil @@ -1025,11 +1025,11 @@ module TkItemConfigMethod when /^(#{__item_numstrval_optkeys(tagid(tagOrId)).join('|')})$/ if ( __item_configinfo_struct(tagid(tagOrId))[:default_value] \ && conf[__item_configinfo_struct(tagid(tagOrId))[:default_value]] ) - conf[__item_configinfo_struct(tagid(tagOrId))[:default_value]] = + conf[__item_configinfo_struct(tagid(tagOrId))[:default_value]] = num_or_str(conf[__item_configinfo_struct(tagid(tagOrId))[:default_value]]) end if ( conf[__item_configinfo_struct(tagid(tagOrId))[:current_value]] ) - conf[__item_configinfo_struct(tagid(tagOrId))[:current_value]] = + conf[__item_configinfo_struct(tagid(tagOrId))[:current_value]] = num_or_str(conf[__item_configinfo_struct(tagid(tagOrId))[:current_value]]) end @@ -1037,7 +1037,7 @@ module TkItemConfigMethod if ( __item_configinfo_struct(tagid(tagOrId))[:default_value] \ && conf[__item_configinfo_struct(tagid(tagOrId))[:default_value]] ) begin - conf[__item_configinfo_struct(tagid(tagOrId))[:default_value]] = + conf[__item_configinfo_struct(tagid(tagOrId))[:default_value]] = bool(conf[__item_configinfo_struct(tagid(tagOrId))[:default_value]]) rescue conf[__item_configinfo_struct(tagid(tagOrId))[:default_value]] = nil @@ -1045,7 +1045,7 @@ module TkItemConfigMethod end if ( conf[__item_configinfo_struct(tagid(tagOrId))[:current_value]] ) begin - conf[__item_configinfo_struct(tagid(tagOrId))[:current_value]] = + conf[__item_configinfo_struct(tagid(tagOrId))[:current_value]] = bool(conf[__item_configinfo_struct(tagid(tagOrId))[:current_value]]) rescue conf[__item_configinfo_struct(tagid(tagOrId))[:current_value]] = nil @@ -1055,11 +1055,11 @@ module TkItemConfigMethod when /^(#{__item_listval_optkeys(tagid(tagOrId)).join('|')})$/ if ( __item_configinfo_struct(tagid(tagOrId))[:default_value] \ && conf[__item_configinfo_struct(tagid(tagOrId))[:default_value]] ) - conf[__item_configinfo_struct(tagid(tagOrId))[:default_value]] = + conf[__item_configinfo_struct(tagid(tagOrId))[:default_value]] = simplelist(conf[__item_configinfo_struct(tagid(tagOrId))[:default_value]]) end if ( conf[__item_configinfo_struct(tagid(tagOrId))[:current_value]] ) - conf[__item_configinfo_struct(tagid(tagOrId))[:current_value]] = + conf[__item_configinfo_struct(tagid(tagOrId))[:current_value]] = simplelist(conf[__item_configinfo_struct(tagid(tagOrId))[:current_value]]) end @@ -1067,12 +1067,12 @@ module TkItemConfigMethod if ( __item_configinfo_struct(tagid(tagOrId))[:default_value] \ && conf[__item_configinfo_struct(tagid(tagOrId))[:default_value]] \ && conf[__item_configinfo_struct(tagid(tagOrId))[:default_value]] =~ /^[0-9]/ ) - conf[__item_configinfo_struct(tagid(tagOrId))[:default_value]] = + conf[__item_configinfo_struct(tagid(tagOrId))[:default_value]] = list(conf[__item_configinfo_struct(tagid(tagOrId))[:default_value]]) end if ( conf[__item_configinfo_struct(tagid(tagOrId))[:current_value]] \ && conf[__item_configinfo_struct(tagid(tagOrId))[:current_value]] =~ /^[0-9]/ ) - conf[__item_configinfo_struct(tagid(tagOrId))[:current_value]] = + conf[__item_configinfo_struct(tagid(tagOrId))[:current_value]] = list(conf[__item_configinfo_struct(tagid(tagOrId))[:current_value]]) end @@ -1099,19 +1099,19 @@ module TkItemConfigMethod if ( __item_configinfo_struct(tagid(tagOrId))[:default_value] \ && conf[__item_configinfo_struct(tagid(tagOrId))[:default_value]] ) if conf[__item_configinfo_struct(tagid(tagOrId))[:default_value]].index('{') - conf[__item_configinfo_struct(tagid(tagOrId))[:default_value]] = - tk_split_list(conf[__item_configinfo_struct(tagid(tagOrId))[:default_value]]) + conf[__item_configinfo_struct(tagid(tagOrId))[:default_value]] = + tk_split_list(conf[__item_configinfo_struct(tagid(tagOrId))[:default_value]]) else - conf[__item_configinfo_struct(tagid(tagOrId))[:default_value]] = + conf[__item_configinfo_struct(tagid(tagOrId))[:default_value]] = tk_tcl2ruby(conf[__item_configinfo_struct(tagid(tagOrId))[:default_value]]) end end if conf[__item_configinfo_struct(tagid(tagOrId))[:current_value]] if conf[__item_configinfo_struct(tagid(tagOrId))[:current_value]].index('{') - conf[__item_configinfo_struct(tagid(tagOrId))[:current_value]] = - tk_split_list(conf[__item_configinfo_struct(tagid(tagOrId))[:current_value]]) + conf[__item_configinfo_struct(tagid(tagOrId))[:current_value]] = + tk_split_list(conf[__item_configinfo_struct(tagid(tagOrId))[:current_value]]) else - conf[__item_configinfo_struct(tagid(tagOrId))[:current_value]] = + conf[__item_configinfo_struct(tagid(tagOrId))[:current_value]] = tk_tcl2ruby(conf[__item_configinfo_struct(tagid(tagOrId))[:current_value]]) end end @@ -1120,7 +1120,7 @@ module TkItemConfigMethod if ( __item_configinfo_struct(tagid(tagOrId))[:alias] \ && conf.size == __item_configinfo_struct(tagid(tagOrId))[:alias] + 1 ) if conf[__item_configinfo_struct(tagid(tagOrId))[:alias]][0] == ?- - conf[__item_configinfo_struct(tagid(tagOrId))[:alias]] = + conf[__item_configinfo_struct(tagid(tagOrId))[:alias]] = conf[__item_configinfo_struct(tagid(tagOrId))[:alias]][1..-1] end ret[conf[0]] = conf[1] @@ -1187,7 +1187,7 @@ module TkItemConfigMethod end slot = conf[__item_configinfo_struct(tagid(tagOrId))[:alias]] end while(org_slot != slot) - fail RuntimeError, + fail RuntimeError, "there is a configure alias loop about '#{org_slot}'" else ret = {} diff --git a/ext/tk/lib/tk/itemfont.rb b/ext/tk/lib/tk/itemfont.rb index 4c5c917c57..b5da4fa1ef 100644 --- a/ext/tk/lib/tk/itemfont.rb +++ b/ext/tk/lib/tk/itemfont.rb @@ -32,22 +32,22 @@ module TkTreatItemFont if key pathname = [win, tag, key].join(';') - TkFont.used_on(pathname) || - TkFont.init_widget_font(pathname, + TkFont.used_on(pathname) || + TkFont.init_widget_font(pathname, *(__item_confinfo_cmd(tagid(tagOrId)))) elsif optkeys.size == 1 pathname = [win, tag, optkeys[0]].join(';') - TkFont.used_on(pathname) || - TkFont.init_widget_font(pathname, + TkFont.used_on(pathname) || + TkFont.init_widget_font(pathname, *(__item_confinfo_cmd(tagid(tagOrId)))) else fonts = {} optkeys.each{|key| key = key.to_s pathname = [win, tag, key].join(';') - fonts[key] = - TkFont.used_on(pathname) || - TkFont.init_widget_font(pathname, + fonts[key] = + TkFont.used_on(pathname) || + TkFont.init_widget_font(pathname, *(__item_confinfo_cmd(tagid(tagOrId)))) } fonts @@ -73,13 +73,13 @@ module TkTreatItemFont slot.delete(a_optkey) slot.delete(k_optkey) - fnt.call_font_configure([pathname, optkey], + fnt.call_font_configure([pathname, optkey], *(__item_config_cmd(tagid(tagOrId)) << {})) next else if fnt - if (slot.key?(l_optkey) || - slot.key?(a_optkey) || + if (slot.key?(l_optkey) || + slot.key?(a_optkey) || slot.key?(k_optkey)) fnt = TkFont.new(fnt) @@ -90,7 +90,7 @@ module TkTreatItemFont fnt.latin_replace(lfnt) if lfnt fnt.kanji_replace(kfnt) if kfnt - fnt.call_font_configure([pathname, optkey], + fnt.call_font_configure([pathname, optkey], *(__item_config_cmd(tagid(tagOrId)) << {})) next else @@ -115,7 +115,7 @@ module TkTreatItemFont kfnt = slot.delete(k_optkey) if lfnt && kfnt - TkFont.new(lfnt, kfnt).call_font_configure([pathname, optkey], + TkFont.new(lfnt, kfnt).call_font_configure([pathname, optkey], *(__item_config_cmd(tagid(tagOrId)) << {})) elsif lfnt latintagfont_configure([lfnt, optkey]) @@ -264,10 +264,10 @@ module TkTreatItemFont end if targetkey - fnt.call_font_configure([__item_pathname(tagid(tagOrId)), targetkey], + fnt.call_font_configure([__item_pathname(tagid(tagOrId)), targetkey], *(__item_config_cmd(tagid(tagOrId)) << {})) else - fnt.call_font_configure(__item_pathname(tagid(tagOrId)), + fnt.call_font_configure(__item_pathname(tagid(tagOrId)), *(__item_config_cmd(tagid(tagOrId)) << {})) end self @@ -276,10 +276,10 @@ module TkTreatItemFont def latintagfont_copy(tagOrId, win, wintag=nil, winkey=nil, targetkey=nil) if targetkey - fontobj(targetkey).dup.call_font_configure([__item_pathname(tagid(tagOrId)), targetkey], + fontobj(targetkey).dup.call_font_configure([__item_pathname(tagid(tagOrId)), targetkey], *(__item_config_cmd(tagid(tagOrId)) << {})) else - fontobj.dup.call_font_configure(__item_pathname(tagid(tagOrId)), + fontobj.dup.call_font_configure(__item_pathname(tagid(tagOrId)), *(__item_config_cmd(tagid(tagOrId)) << {})) end @@ -302,10 +302,10 @@ module TkTreatItemFont def kanjifont_copy(tagOrId, win, wintag=nil, winkey=nil, targetkey=nil) if targetkey - fontobj(targetkey).dup.call_font_configure([__item_pathname(tagid(tagOrId)), targetkey], + fontobj(targetkey).dup.call_font_configure([__item_pathname(tagid(tagOrId)), targetkey], *(__item_config_cmd(tagid(tagOrId)) << {})) else - fontobj.dup.call_font_configure(__item_pathname(tagid(tagOrId)), + fontobj.dup.call_font_configure(__item_pathname(tagid(tagOrId)), *(__item_config_cmd(tagid(tagOrId)) << {})) end diff --git a/ext/tk/lib/tk/kinput.rb b/ext/tk/lib/tk/kinput.rb index a29dbcdb72..b63f756def 100644 --- a/ext/tk/lib/tk/kinput.rb +++ b/ext/tk/lib/tk/kinput.rb @@ -8,8 +8,8 @@ module TkKinput extend Tk TkCommandNames = [ - 'kinput_start'.freeze, - 'kinput_send_spot'.freeze, + 'kinput_start'.freeze, + 'kinput_send_spot'.freeze, 'kanjiInput'.freeze ].freeze @@ -47,7 +47,7 @@ module TkKinput def TkKinput.attribute_info(win, slot=nil) if slot - conf = tk_split_list(tk_call('kanjiInput', 'attribute', + conf = tk_split_list(tk_call('kanjiInput', 'attribute', win, "-#{slot}")) conf[0] = conf[0][1..-1] conf diff --git a/ext/tk/lib/tk/listbox.rb b/ext/tk/lib/tk/listbox.rb index bb039ffb0e..4357fafc27 100644 --- a/ext/tk/lib/tk/listbox.rb +++ b/ext/tk/lib/tk/listbox.rb @@ -92,7 +92,7 @@ class Tk::Listbox<TkTextWin fail ArgumentError, 'an Array is expected' end tk_send_without_enc('delete', '0', 'end') - tk_send_without_enc('insert', '0', + tk_send_without_enc('insert', '0', *(vals.collect{|v| _get_eval_enc_str(v)})) vals end @@ -110,7 +110,7 @@ class Tk::Listbox<TkTextWin _fromUTF8(tk_send_without_enc('itemcget', index, "-#{key}")) when 'font', 'kanjifont' #fnt = tk_tcl2ruby(tk_send('itemcget', index, "-#{key}")) - fnt = tk_tcl2ruby(_fromUTF8(tk_send_without_enc('itemcget', index, + fnt = tk_tcl2ruby(_fromUTF8(tk_send_without_enc('itemcget', index, '-font'))) unless fnt.kind_of?(TkFont) fnt = tagfontobj(index, fnt) @@ -127,9 +127,9 @@ class Tk::Listbox<TkTextWin end def itemconfigure(index, key, val=None) if key.kind_of? Hash - if (key['font'] || key[:font] || - key['kanjifont'] || key[:kanjifont] || - key['latinfont'] || key[:latinfont] || + if (key['font'] || key[:font] || + key['kanjifont'] || key[:kanjifont] || + key['latinfont'] || key[:latinfont] || key['asciifont'] || key[:asciifont] ) tagfont_configure(index, _symbolkey2str(key)) else @@ -137,9 +137,9 @@ class Tk::Listbox<TkTextWin end else - if (key == 'font' || key == :font || - key == 'kanjifont' || key == :kanjifont || - key == 'latinfont' || key == :latinfont || + if (key == 'font' || key == :font || + key == 'kanjifont' || key == :kanjifont || + key == 'latinfont' || key == :latinfont || key == 'asciifont' || key == :asciifont ) if val == None tagfontobj(index) @@ -176,16 +176,16 @@ class Tk::Listbox<TkTextWin else if conf[3] if conf[3].index('{') - conf[3] = tk_split_list(conf[3]) + conf[3] = tk_split_list(conf[3]) else - conf[3] = tk_tcl2ruby(conf[3]) + conf[3] = tk_tcl2ruby(conf[3]) end end if conf[4] if conf[4].index('{') - conf[4] = tk_split_list(conf[4]) + conf[4] = tk_split_list(conf[4]) else - conf[4] = tk_tcl2ruby(conf[4]) + conf[4] = tk_tcl2ruby(conf[4]) end end end @@ -224,16 +224,16 @@ class Tk::Listbox<TkTextWin else if conf[2] if conf[2].index('{') - conf[2] = tk_split_list(conf[2]) + conf[2] = tk_split_list(conf[2]) else - conf[2] = tk_tcl2ruby(conf[2]) + conf[2] = tk_tcl2ruby(conf[2]) end end if conf[3] if conf[3].index('{') - conf[3] = tk_split_list(conf[3]) + conf[3] = tk_split_list(conf[3]) else - conf[3] = tk_tcl2ruby(conf[3]) + conf[3] = tk_tcl2ruby(conf[3]) end end end diff --git a/ext/tk/lib/tk/menu.rb b/ext/tk/lib/tk/menu.rb index 0e4f419e15..3e122e6987 100644 --- a/ext/tk/lib/tk/menu.rb +++ b/ext/tk/lib/tk/menu.rb @@ -155,13 +155,13 @@ class Tk::Menu<TkWindow _fromUTF8(tk_send_without_enc('invoke', _get_eval_enc_str(index))) end def insert(index, type, keys=nil) - tk_send_without_enc('insert', _get_eval_enc_str(index), + tk_send_without_enc('insert', _get_eval_enc_str(index), type, *hash_kv(keys, true)) self end def delete(first, last=nil) if last - tk_send_without_enc('delete', _get_eval_enc_str(first), + tk_send_without_enc('delete', _get_eval_enc_str(first), _get_eval_enc_str(last)) else tk_send_without_enc('delete', _get_eval_enc_str(first)) @@ -170,7 +170,7 @@ class Tk::Menu<TkWindow end def popup(x, y, index=nil) if index - tk_call_without_enc('tk_popup', path, x, y, + tk_call_without_enc('tk_popup', path, x, y, _get_eval_enc_str(index)) else tk_call_without_enc('tk_popup', path, x, y) @@ -214,7 +214,7 @@ class Tk::Menu<TkWindow def entrycget(index, key) case key.to_s when 'text', 'label', 'show' - _fromUTF8(tk_send_without_enc('entrycget', + _fromUTF8(tk_send_without_enc('entrycget', _get_eval_enc_str(index), "-#{key}")) when 'font', 'kanjifont' #fnt = tk_tcl2ruby(tk_send('entrycget', index, "-#{key}")) @@ -234,20 +234,20 @@ class Tk::Menu<TkWindow end def entryconfigure(index, key, val=None) if key.kind_of? Hash - if (key['font'] || key[:font] || - key['kanjifont'] || key[:kanjifont] || - key['latinfont'] || key[:latinfont] || + if (key['font'] || key[:font] || + key['kanjifont'] || key[:kanjifont] || + key['latinfont'] || key[:latinfont] || key['asciifont'] || key[:asciifont]) tagfont_configure(index, _symbolkey2str(key)) else - tk_send_without_enc('entryconfigure', _get_eval_enc_str(index), + tk_send_without_enc('entryconfigure', _get_eval_enc_str(index), *hash_kv(key, true)) end else - if (key == 'font' || key == :font || - key == 'kanjifont' || key == :kanjifont || - key == 'latinfont' || key == :latinfont || + if (key == 'font' || key == :font || + key == 'kanjifont' || key == :kanjifont || + key == 'latinfont' || key == :latinfont || key == 'asciifont' || key == :asciifont ) if val == None tagfontobj(index) @@ -284,16 +284,16 @@ class Tk::Menu<TkWindow else if conf[3] if conf[3].index('{') - conf[3] = tk_split_list(conf[3]) + conf[3] = tk_split_list(conf[3]) else - conf[3] = tk_tcl2ruby(conf[3]) + conf[3] = tk_tcl2ruby(conf[3]) end end if conf[4] if conf[4].index('{') - conf[4] = tk_split_list(conf[4]) + conf[4] = tk_split_list(conf[4]) else - conf[4] = tk_tcl2ruby(conf[4]) + conf[4] = tk_tcl2ruby(conf[4]) end end end @@ -331,16 +331,16 @@ class Tk::Menu<TkWindow else if conf[2] if conf[2].index('{') - conf[2] = tk_split_list(conf[2]) + conf[2] = tk_split_list(conf[2]) else - conf[2] = tk_tcl2ruby(conf[2]) + conf[2] = tk_tcl2ruby(conf[2]) end end if conf[3] if conf[3].index('{') - conf[3] = tk_split_list(conf[3]) + conf[3] = tk_split_list(conf[3]) else - conf[3] = tk_tcl2ruby(conf[3]) + conf[3] = tk_tcl2ruby(conf[3]) end end end @@ -509,18 +509,18 @@ class Tk::Menubutton<Tk::Label if keys and keys != None unless TkConfigMethod.__IGNORE_UNKNOWN_CONFIGURE_OPTION__ # tk_call_without_enc('menubutton', @path, *hash_kv(keys, true)) - tk_call_without_enc(self.class::TkCommandNames[0], @path, + tk_call_without_enc(self.class::TkCommandNames[0], @path, *hash_kv(keys, true)) else begin - tk_call_without_enc(self.class::TkCommandNames[0], @path, + tk_call_without_enc(self.class::TkCommandNames[0], @path, *hash_kv(keys, true)) rescue tk_call_without_enc(self.class::TkCommandNames[0], @path) keys = __check_available_configure_options(keys) unless keys.empty? tk_call_without_enc('destroy', @path) rescue nil - tk_call_without_enc(self.class::TkCommandNames[0], @path, + tk_call_without_enc(self.class::TkCommandNames[0], @path, *hash_kv(keys, true)) end end @@ -571,7 +571,7 @@ class Tk::OptionMenubutton<Tk::Menubutton parent = nil if !args.empty? && (args[0].kind_of?(TkWindow) || args[0] == nil) keys.delete('parent') # ignore - parent = args.shift + parent = args.shift else parent = keys.delete('parent') end @@ -579,7 +579,7 @@ class Tk::OptionMenubutton<Tk::Menubutton @variable = nil if !args.empty? && (args[0].kind_of?(TkVariable) || args[0] == nil) keys.delete('variable') # ignore - @variable = args.shift + @variable = args.shift else @variable = keys.delete('variable') end @@ -593,7 +593,7 @@ class Tk::OptionMenubutton<Tk::Menubutton end install_win(if parent then parent.path end) - @menu = OptionMenu.new(tk_call('tk_optionMenu', + @menu = OptionMenu.new(tk_call('tk_optionMenu', @path, @variable.id, *args)) configure(keys) if keys @@ -612,7 +612,7 @@ class Tk::OptionMenubutton<Tk::Menubutton self end def add(value) - @menu.add('radiobutton', 'variable'=>@variable, + @menu.add('radiobutton', 'variable'=>@variable, 'label'=>value, 'value'=>value) self end @@ -623,7 +623,7 @@ class Tk::OptionMenubutton<Tk::Menubutton @menu.invoke(index) end def insert(index, value) - @menu.insert(index, 'radiobutton', 'variable'=>@variable, + @menu.insert(index, 'radiobutton', 'variable'=>@variable, 'label'=>value, 'value'=>value) self end @@ -677,5 +677,5 @@ end Tk::OptionMenuButton = Tk::OptionMenubutton #TkOptionMenubutton = Tk::OptionMenubutton unless Object.const_defined? :TkOptionMenubutton #TkOptionMenuButton = Tk::OptionMenuButton unless Object.const_defined? :TkOptionMenuButton -Tk.__set_toplevel_aliases__(:Tk, Tk::OptionMenubutton, +Tk.__set_toplevel_aliases__(:Tk, Tk::OptionMenubutton, :TkOptionMenubutton, :TkOptionMenuButton) diff --git a/ext/tk/lib/tk/menubar.rb b/ext/tk/lib/tk/menubar.rb index ef9da809b9..ac537cb4ec 100644 --- a/ext/tk/lib/tk/menubar.rb +++ b/ext/tk/lib/tk/menubar.rb @@ -2,7 +2,7 @@ # tk/menubar.rb # # Original version: -# Copyright (C) 1998 maeda shugo. All rights reserved. +# Copyright (C) 1998 maeda shugo. All rights reserved. # This file can be distributed under the terms of the Ruby. # Usage: @@ -52,18 +52,18 @@ # {:label=>'Open', :command=>proc{puts('Open clicked')}, :underline=>0}, # '---', # ['Check_A', TkVariable.new(true), 6], -# {:type=>'checkbutton', :label=>'Check_B', +# {:type=>'checkbutton', :label=>'Check_B', # :variable=>TkVariable.new, :underline=>6}, # '---', # ['Radio_X', [radio_var, 'x'], 6], # ['Radio_Y', [radio_var, 'y'], 6], # ['Radio_Z', [radio_var, 'z'], 6], # '---', -# ['cascade', [ -# ['sss', proc{p 'sss'}, 0], -# ['ttt', proc{p 'ttt'}, 0], -# ['uuu', proc{p 'uuu'}, 0], -# ['vvv', proc{p 'vvv'}, 0], +# ['cascade', [ +# ['sss', proc{p 'sss'}, 0], +# ['ttt', proc{p 'ttt'}, 0], +# ['uuu', proc{p 'uuu'}, 0], +# ['vvv', proc{p 'vvv'}, 0], # ], 0], # '---', # ['Quit', proc{exit}, 0]], @@ -92,7 +92,7 @@ require 'tk/menuspec' class TkMenubar<Tk::Frame include TkComposite include TkMenuSpec - + def initialize(parent = nil, spec = nil, options = nil) if parent.kind_of? Hash options = _symbolkey2str(parent) @@ -103,7 +103,7 @@ class TkMenubar<Tk::Frame end @menus = [] - + spec.each{|info| add_menu(info)} if spec options.each{|key, value| configure(key, value)} if options @@ -124,7 +124,7 @@ class TkMenubar<Tk::Frame delegate('font', mbtn, menu, *submenus) delegate('kanjifont', mbtn, menu, *submenus) end - + def [](index) return @menus[index] end diff --git a/ext/tk/lib/tk/menuspec.rb b/ext/tk/lib/tk/menuspec.rb index 2a2eb9ba3c..3f38ab5140 100644 --- a/ext/tk/lib/tk/menuspec.rb +++ b/ext/tk/lib/tk/menuspec.rb @@ -3,7 +3,7 @@ # Hidethoshi NAGAI (nagai@ai.kyutech.ac.jp) # # based on tkmenubar.rb : -# Copyright (C) 1998 maeda shugo. All rights reserved. +# Copyright (C) 1998 maeda shugo. All rights reserved. # This file can be distributed under the terms of the Ruby. # # The format of the menu_spec is: @@ -14,24 +14,24 @@ # [text, underline, configs], # menu button/entry (*1) # [label, command, underline, accelerator, configs], # command entry # [label, TkVar_obj, underline, accelerator, configs], # checkbutton entry -# [label, [TkVar_obj, value], +# [label, [TkVar_obj, value], # underline, accelerator, configs], # radiobutton entry -# [label, [[...menu_info...], [...menu_info...], ...], +# [label, [[...menu_info...], [...menu_info...], ...], # underline, accelerator, configs], # cascade entry (*2) # '---', # separator # ... # ] # -# underline, accelerator, and configs are optional pearameters. -# Hashes are OK instead of Arrays. Then the entry type ('command', +# underline, accelerator, and configs are optional pearameters. +# Hashes are OK instead of Arrays. Then the entry type ('command', # 'checkbutton', 'radiobutton' or 'cascade') is given by 'type' key # (e.g. :type=>'cascade'). When type is 'cascade', an array of menu_info # is acceptable for 'menu' key (then, create sub-menu). # # NOTE: (*1) -# If you want to make special menus (*.help for UNIX, *.system for Win, -# and *.apple for Mac), append 'menu_name'=>name (name is 'help' for UNIX, -# 'system' for Win, and 'apple' for Mac) option to the configs hash of +# If you want to make special menus (*.help for UNIX, *.system for Win, +# and *.apple for Mac), append 'menu_name'=>name (name is 'help' for UNIX, +# 'system' for Win, and 'apple' for Mac) option to the configs hash of # menu button/entry information. # # NOTE: (*2) @@ -39,7 +39,7 @@ # to the configs of the cascade entry. module TkMenuSpec - def _create_menu(parent, menu_info, menu_name = nil, + def _create_menu(parent, menu_info, menu_name = nil, tearoff = false, default_opts = nil) if tearoff.kind_of?(Hash) default_opts = tearoff @@ -80,7 +80,7 @@ module TkMenuSpec menu_opts.update(_symbolkey2str(options.delete('menu_config') || {})) if item_type == 'cascade' && options['menu'].kind_of?(Array) # create cascade menu - submenu = _create_menu(menu, options['menu'], menu_name, + submenu = _create_menu(menu, options['menu'], menu_name, tearoff, menu_opts) options['menu'] = submenu end @@ -117,7 +117,7 @@ module TkMenuSpec menu_config = opts.delete('menu_config') || {} menu_opts.update(_symbolkey2str(menu_config)) end - submenu = _create_menu(menu, item_info[1], menu_name, + submenu = _create_menu(menu, item_info[1], menu_name, tearoff, menu_opts) options['menu'] = submenu end @@ -155,7 +155,7 @@ module TkMenuSpec def _use_menubar?(parent) use_menubar = false if parent.kind_of?(Tk::Root) || parent.kind_of?(Tk::Toplevel) - true + true elsif parent.current_configinfo.has_key?('menu') true else @@ -214,7 +214,7 @@ module TkMenuSpec keys = {:label=>btn_info} end - menu = _create_menu(mbar, menu_info[1..-1], menu_name, + menu = _create_menu(mbar, menu_info[1..-1], menu_name, tearoff, default_opts) menu.tearoff(tearoff) @@ -251,9 +251,9 @@ module TkMenuSpec mbtn.pack('side' => 'left') - menu = _create_menu(mbtn, menu_info[1..-1], menu_name, + menu = _create_menu(mbtn, menu_info[1..-1], menu_name, tearoff, default_opts) - + mbtn.menu(menu) [mbtn, menu] diff --git a/ext/tk/lib/tk/mngfocus.rb b/ext/tk/lib/tk/mngfocus.rb index 1a2049c8a8..a05fb94f8e 100644 --- a/ext/tk/lib/tk/mngfocus.rb +++ b/ext/tk/lib/tk/mngfocus.rb @@ -8,8 +8,8 @@ module TkManageFocus extend Tk TkCommandNames = [ - 'tk_focusFollowMouse'.freeze, - 'tk_focusNext'.freeze, + 'tk_focusFollowMouse'.freeze, + 'tk_focusNext'.freeze, 'tk_focusPrev'.freeze ].freeze diff --git a/ext/tk/lib/tk/msgcat.rb b/ext/tk/lib/tk/msgcat.rb index 162953f425..f90dbc5efa 100644 --- a/ext/tk/lib/tk/msgcat.rb +++ b/ext/tk/lib/tk/msgcat.rb @@ -11,13 +11,13 @@ class TkMsgCatalog < TkObject #extend TkMsgCatalog TkCommandNames = [ - '::msgcat::mc'.freeze, - '::msgcat::mcmax'.freeze, - '::msgcat::mclocale'.freeze, - '::msgcat::mcpreferences'.freeze, - '::msgcat::mcload'.freeze, - '::msgcat::mcset'.freeze, - '::msgcat::mcmset'.freeze, + '::msgcat::mc'.freeze, + '::msgcat::mcmax'.freeze, + '::msgcat::mclocale'.freeze, + '::msgcat::mcpreferences'.freeze, + '::msgcat::mcload'.freeze, + '::msgcat::mcset'.freeze, + '::msgcat::mcmset'.freeze, '::msgcat::mcunknown'.freeze ].freeze @@ -69,10 +69,10 @@ class TkMsgCatalog < TkObject exit!(1) rescue Exception => e begin - msg = _toUTF8(e.class.inspect) + ': ' + - _toUTF8(e.message) + "\n" + - "\n---< backtrace of Ruby side >-----\n" + - _toUTF8(e.backtrace.join("\n")) + + msg = _toUTF8(e.class.inspect) + ': ' + + _toUTF8(e.message) + "\n" + + "\n---< backtrace of Ruby side >-----\n" + + _toUTF8(e.backtrace.join("\n")) + "\n---< backtrace of Tk side >-------" if TkCore::WITH_ENCODING msg.force_encoding('utf-8') @@ -80,9 +80,9 @@ class TkMsgCatalog < TkObject msg.instance_variable_set(:@encoding, 'utf-8') end rescue Exception - msg = e.class.inspect + ': ' + e.message + "\n" + - "\n---< backtrace of Ruby side >-----\n" + - e.backtrace.join("\n") + + msg = e.class.inspect + ': ' + e.message + "\n" + + "\n---< backtrace of Ruby side >-----\n" + + e.backtrace.join("\n") + "\n---< backtrace of Tk side >-------" end fail(e, msg) @@ -153,7 +153,7 @@ class TkMsgCatalog < TkObject end def translate(*args) dst = args.collect{|src| - @namespace.eval{tk_call_without_enc('::msgcat::mc', + @namespace.eval{tk_call_without_enc('::msgcat::mc', _get_eval_string(src, true))} } Tk.UTF8_String(sprintf(*dst)) @@ -229,29 +229,29 @@ class TkMsgCatalog < TkObject def self.set_translation(locale, src_str, trans_str=None, enc='utf-8') if trans_str && trans_str != None trans_str = Tk.UTF8_String(_toUTF8(trans_str, enc)) - Tk.UTF8_String(tk_call_without_enc('::msgcat::mcset', - locale, - _get_eval_string(src_str, true), + Tk.UTF8_String(tk_call_without_enc('::msgcat::mcset', + locale, + _get_eval_string(src_str, true), trans_str)) else - Tk.UTF8_String(tk_call_without_enc('::msgcat::mcset', - locale, + Tk.UTF8_String(tk_call_without_enc('::msgcat::mcset', + locale, _get_eval_string(src_str, true))) end end def set_translation(locale, src_str, trans_str=None, enc='utf-8') if trans_str && trans_str != None - trans_str = Tk.UTF8_String(_toUTF8(trans_str, enc)) + trans_str = Tk.UTF8_String(_toUTF8(trans_str, enc)) Tk.UTF8_String(@namespace.eval{ - tk_call_without_enc('::msgcat::mcset', - locale, - _get_eval_string(src_str, true), + tk_call_without_enc('::msgcat::mcset', + locale, + _get_eval_string(src_str, true), trans_str) }) else Tk.UTF8_String(@namespace.eval{ - tk_call_without_enc('::msgcat::mcset', - locale, + tk_call_without_enc('::msgcat::mcset', + locale, _get_eval_string(src_str, true))}) end end @@ -261,7 +261,7 @@ class TkMsgCatalog < TkObject list = [] trans_list.each{|src, trans| if trans && trans != None - list << _get_eval_string(src, true) + list << _get_eval_string(src, true) list << Tk.UTF8_Stirng(_toUTF8(trans, enc)) else list << _get_eval_string(src, true) << '' @@ -274,7 +274,7 @@ class TkMsgCatalog < TkObject list = [] trans_list.each{|src, trans| if trans && trans != None - list << _get_eval_string(src, true) + list << _get_eval_string(src, true) list << Tk.UTF8_String(_toUTF8(trans, enc)) else list << _get_eval_string(src, true) << '' diff --git a/ext/tk/lib/tk/namespace.rb b/ext/tk/lib/tk/namespace.rb index 20a8d65215..dfb162cda8 100644 --- a/ext/tk/lib/tk/namespace.rb +++ b/ext/tk/lib/tk/namespace.rb @@ -8,7 +8,7 @@ class TkNamespace < TkObject extend Tk TkCommandNames = [ - 'namespace'.freeze, + 'namespace'.freeze, ].freeze Tk_Namespace_ID_TBL = TkCore::INTERP.create_table @@ -46,7 +46,7 @@ class TkNamespace < TkObject private :__config_cmd def __configinfo_struct - {:key=>0, :alias=>nil, :db_name=>nil, :db_class=>nil, + {:key=>0, :alias=>nil, :db_name=>nil, :db_class=>nil, :default_value=>nil, :current_value=>2} end private :__configinfo_struct @@ -122,8 +122,8 @@ class TkNamespace < TkObject if TkComm::GET_CONFIGINFO_AS_ARRAY Tk_Namespace_ID_TBL.mutex.synchronize{ - info.map!{|inf| - if inf[0] == 'namespace' && + info.map!{|inf| + if inf[0] == 'namespace' && TkNamespace::Tk_Namespace_ID_TBL.key?(inf[-1]) [inf[0], TkNamespace::Tk_Namespace_ID_TBL[inf[-1]]] else @@ -160,19 +160,19 @@ class TkNamespace < TkObject def tk_call(*args) #super('namespace', 'eval', @namespace, *args) args = args.collect{|arg| (s = _get_eval_string(arg, true))? s: ''} - super('namespace', 'eval', @namespace, + super('namespace', 'eval', @namespace, TkCore::INTERP._merge_tklist(*args)) end def tk_call_without_enc(*args) #super('namespace', 'eval', @namespace, *args) args = args.collect{|arg| (s = _get_eval_string(arg, true))? s: ''} - super('namespace', 'eval', @namespace, + super('namespace', 'eval', @namespace, TkCore::INTERP._merge_tklist(*args)) end def tk_call_with_enc(*args) #super('namespace', 'eval', @namespace, *args) args = args.collect{|arg| (s = _get_eval_string(arg, true))? s: ''} - super('namespace', 'eval', @namespace, + super('namespace', 'eval', @namespace, TkCore::INTERP._merge_tklist(*args)) end @@ -223,19 +223,19 @@ class TkNamespace < TkObject def tk_call(*args) #super('namespace', 'eval', @fullname, *args) args = args.collect{|arg| (s = _get_eval_string(arg, true))? s: ''} - super('namespace', 'eval', @fullname, + super('namespace', 'eval', @fullname, TkCore::INTERP._merge_tklist(*args)) end def tk_call_without_enc(*args) #super('namespace', 'eval', @fullname, *args) args = args.collect{|arg| (s = _get_eval_string(arg, true))? s: ''} - super('namespace', 'eval', @fullname, + super('namespace', 'eval', @fullname, TkCore::INTERP._merge_tklist(*args)) end def tk_call_with_enc(*args) #super('namespace', 'eval', @fullname, *args) args = args.collect{|arg| (s = _get_eval_string(arg, true))? s: ''} - super('namespace', 'eval', @fullname, + super('namespace', 'eval', @fullname, TkCore::INTERP._merge_tklist(*args)) end alias ns_tk_call tk_call @@ -318,7 +318,7 @@ class TkNamespace < TkObject else fail ArgumentError, "String or Proc is expected" end - TkNamespace::NsCode.new(tk_call_without_enc('namespace', 'code', + TkNamespace::NsCode.new(tk_call_without_enc('namespace', 'code', _get_eval_string(cmd, false))) end =end @@ -350,8 +350,8 @@ class TkNamespace < TkObject else fail ArgumentError, "String or Proc is expected" end - TkNamespace::NsCode.new(tk_call_without_enc('namespace', 'code', - _get_eval_string(cmd, false)), + TkNamespace::NsCode.new(tk_call_without_enc('namespace', 'code', + _get_eval_string(cmd, false)), true) end diff --git a/ext/tk/lib/tk/optiondb.rb b/ext/tk/lib/tk/optiondb.rb index 186811d37d..9d366c13ea 100644 --- a/ext/tk/lib/tk/optiondb.rb +++ b/ext/tk/lib/tk/optiondb.rb @@ -44,7 +44,7 @@ module TkOptionDB def read_entries(file, f_enc=nil) if TkCore::INTERP.safe? - fail SecurityError, + fail SecurityError, "can't call 'TkOptionDB.read_entries' on a safe interpreter" end @@ -86,7 +86,7 @@ module TkOptionDB ent end module_function :read_entries - + def read_with_encoding(file, f_enc=nil, pri=None) # try to read the file as an OptionDB file read_entries(file, f_enc).each{|pat, val| @@ -136,7 +136,7 @@ module TkOptionDB @@resource_proc_class.const_set(:CARRIER, '.'.freeze) - @@resource_proc_class.instance_variable_set('@method_tbl', + @@resource_proc_class.instance_variable_set('@method_tbl', TkCore::INTERP.create_table) @@resource_proc_class.instance_variable_set('@add_method', false) @@resource_proc_class.instance_variable_set('@safe_mode', 4) @@ -144,7 +144,7 @@ module TkOptionDB class << @@resource_proc_class private :new -=begin +=begin CARRIER = '.'.freeze METHOD_TBL = TkCore::INTERP.create_table ADD_METHOD = false @@ -171,7 +171,7 @@ module TkOptionDB def __check_proc_string__(str) # If you want to check the proc_string, do it in this method. - # Please define this in the block given to 'new_proc_class' method. + # Please define this in the block given to 'new_proc_class' method. str end @@ -186,20 +186,20 @@ module TkOptionDB unless TkComm._callback_entry?(res_proc) #if id == :new || !(self::METHOD_TBL.has_key?(id) || self::ADD_METHOD) if id == :new || !(@method_tbl.has_key?(id) || @add_method) - raise NoMethodError, + raise NoMethodError, "not support resource-proc '#{id.id2name}' for #{self.name}" end proc_str = proc_source proc_str = '{' + proc_str + '}' unless /\A\{.*\}\Z/ =~ proc_str #proc_str = __closed_block_check__(proc_str) proc_str = __check_proc_string__(proc_str) - res_proc = proc{ + res_proc = proc{ begin #eval("$SAFE = #{self::SAFE_MODE};\nProc.new" + proc_str) eval("$SAFE = #{@safe_mode};\nProc.new" + proc_str) rescue SyntaxError=>err - raise SyntaxError, - TkCore::INTERP._toUTF8(err.message.gsub(/\(eval\):\d:/, + raise SyntaxError, + TkCore::INTERP._toUTF8(err.message.gsub(/\(eval\):\d:/, "(#{id.id2name}):")) end }.call @@ -291,7 +291,7 @@ module TkOptionDB cmd_klass.instance_variable_set('@method_tbl', TkCore::INTERP.create_table) cmd_klass.instance_variable_set('@add_method', add) cmd_klass.instance_variable_set('@safe_mode', safe) - func.each{|f| + func.each{|f| cmd_klass.instance_variable_get('@method_tbl')[f.to_s.intern] = nil } =begin @@ -310,14 +310,14 @@ module TkOptionDB # for security, make these methods invalid class << klass def __null_method(*args); nil; end - [ :class_eval, :name, :superclass, :clone, :dup, :autoload, :autoload?, - :ancestors, :const_defined?, :const_get, :const_set, :const_missing, - :class_variables, :constants, :included_modules, :instance_methods, - :method_defined?, :module_eval, :private_instance_methods, - :protected_instance_methods, :public_instance_methods, - :singleton_methods, :remove_const, :remove_method, :undef_method, - :to_s, :inspect, :display, :method, :methods, :respond_to?, - :instance_variable_get, :instance_variable_set, :instance_method, + [ :class_eval, :name, :superclass, :clone, :dup, :autoload, :autoload?, + :ancestors, :const_defined?, :const_get, :const_set, :const_missing, + :class_variables, :constants, :included_modules, :instance_methods, + :method_defined?, :module_eval, :private_instance_methods, + :protected_instance_methods, :public_instance_methods, + :singleton_methods, :remove_const, :remove_method, :undef_method, + :to_s, :inspect, :display, :method, :methods, :respond_to?, + :instance_variable_get, :instance_variable_set, :instance_method, :instance_eval, :instance_exec, :instance_variables, :kind_of?, :is_a?, :private_methods, :protected_methods, :public_methods ].each{|m| alias_method(m, :__null_method) @@ -331,7 +331,7 @@ module TkOptionDB RAND_BASE_HEAD = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' RAND_BASE_CHAR = RAND_BASE_HEAD + 'abcdefghijklmnopqrstuvwxyz0123456789_' def __get_random_basename - name = '%s%03d' % [RAND_BASE_HEAD[rand(RAND_BASE_HEAD.size),1], + name = '%s%03d' % [RAND_BASE_HEAD[rand(RAND_BASE_HEAD.size),1], RAND_BASE_CNT[0]] len = RAND_BASE_CHAR.size (6+rand(10)).times{ @@ -344,9 +344,9 @@ module TkOptionDB private_class_method :__get_random_basename # define new proc class : - # If you want to modify the new class or create a new subclass, - # you must do such operation in the block parameter. - # Because the created class is flozen after evaluating the block. + # If you want to modify the new class or create a new subclass, + # you must do such operation in the block parameter. + # Because the created class is flozen after evaluating the block. def new_proc_class(klass, func, safe = 4, add = false, parent = nil, &b) new_klass = __create_new_class(klass, func, safe, add, parent) new_klass.class_eval(&b) if block_given? @@ -357,7 +357,7 @@ module TkOptionDB module_function :new_proc_class def eval_under_random_base(parent = nil, &b) - new_klass = __create_new_class(__get_random_basename(), + new_klass = __create_new_class(__get_random_basename(), [], 4, false, parent) ret = new_klass.class_eval(&b) if block_given? __remove_methods_of_proc_class(new_klass) diff --git a/ext/tk/lib/tk/optionobj.rb b/ext/tk/lib/tk/optionobj.rb index 8fe7e0ee5a..29b06da0eb 100644 --- a/ext/tk/lib/tk/optionobj.rb +++ b/ext/tk/lib/tk/optionobj.rb @@ -1,10 +1,10 @@ # # tk/optionobj.rb : control options for a group of widgets # -# NOTE: If you want to use key-only option (no value), -# use Tk::None for the value of the key-only option. +# NOTE: If you want to use key-only option (no value), +# use Tk::None for the value of the key-only option. # -# e.g. hash_kv({'aaa'=>1, 'bbb'=>Tk::None, 'ccc'=>3}) +# e.g. hash_kv({'aaa'=>1, 'bbb'=>Tk::None, 'ccc'=>3}) # => ["-aaa", 1, "-bbb", "-ccc", 3] # require 'tk' @@ -36,7 +36,7 @@ module Tk def _remove_win(win) if win.kind_of?(Array) widget, method = win - @observ.delete_if{|x| + @observ.delete_if{|x| if x.kind_of?(Array) x[0] == widget else @@ -56,15 +56,15 @@ module Tk private :_remove_win def assign(*wins) - # win := + # win := # widget #==> call widget.configure(hash) # [widget] #==> call widget.configure(hash) # [widget, nil, {src=>target, ... }] - # #==> call widget.configure(hash) + # #==> call widget.configure(hash) # with converting hash-key # [widget, method] #==> call widget.method(hash) # [widget, method, {src=>target, ... }] - # #==> call widget.method(hash) + # #==> call widget.method(hash) # with converting hash-key # [widget [receiver, method, arg, ... ]] # #==> call receiver.method(arg, ... , hash) @@ -74,7 +74,7 @@ module Tk # # src := option_name_on_optobj # - # target := + # target := # nil #==> not use the src # option_name_on_target_widget # [ option_name_on_target_widget, ... ] @@ -123,7 +123,7 @@ module Tk next unless key if key.kind_of?(Array) key.each{|k| hash[k] = val} - else + else hash[key] = val end } diff --git a/ext/tk/lib/tk/palette.rb b/ext/tk/lib/tk/palette.rb index 2d08d50f6a..9462bb0667 100644 --- a/ext/tk/lib/tk/palette.rb +++ b/ext/tk/lib/tk/palette.rb @@ -9,8 +9,8 @@ module TkPalette extend Tk TkCommandNames = [ - 'tk_setPalette'.freeze, - 'tk_bisque'.freeze, + 'tk_setPalette'.freeze, + 'tk_bisque'.freeze, 'tkDarken'.freeze ].freeze diff --git a/ext/tk/lib/tk/panedwindow.rb b/ext/tk/lib/tk/panedwindow.rb index 030144e677..4e70ede9bf 100644 --- a/ext/tk/lib/tk/panedwindow.rb +++ b/ext/tk/lib/tk/panedwindow.rb @@ -128,10 +128,10 @@ class Tk::PanedWindow<TkWindow # win = win.epath if win.kind_of?(TkObject) win = _epath(win) if key - #conf = tk_split_list(tk_send_without_enc('paneconfigure', + #conf = tk_split_list(tk_send_without_enc('paneconfigure', # win, "-#{key}")) - conf = tk_split_list(tk_send_without_enc('paneconfigure', - win, "-#{key}"), + conf = tk_split_list(tk_send_without_enc('paneconfigure', + win, "-#{key}"), false, true) conf[0] = conf[0][1..-1] if conf[0] == 'hide' @@ -140,10 +140,10 @@ class Tk::PanedWindow<TkWindow end conf else - #tk_split_simplelist(tk_send_without_enc('paneconfigure', + #tk_split_simplelist(tk_send_without_enc('paneconfigure', # win)).collect{|conflist| # conf = tk_split_simplelist(conflist) - tk_split_simplelist(tk_send_without_enc('paneconfigure', win), + tk_split_simplelist(tk_send_without_enc('paneconfigure', win), false, false).collect{|conflist| conf = tk_split_simplelist(conflist, false, true) conf[0] = conf[0][1..-1] @@ -151,18 +151,18 @@ class Tk::PanedWindow<TkWindow if conf[0] == 'hide' conf[3] = bool(conf[3]) unless conf[3].empty? elsif conf[3].index('{') - conf[3] = tk_split_list(conf[3]) + conf[3] = tk_split_list(conf[3]) else - conf[3] = tk_tcl2ruby(conf[3]) + conf[3] = tk_tcl2ruby(conf[3]) end end if conf[4] if conf[0] == 'hide' conf[4] = bool(conf[4]) unless conf[4].empty? elsif conf[4].index('{') - conf[4] = tk_split_list(conf[4]) + conf[4] = tk_split_list(conf[4]) else - conf[4] = tk_tcl2ruby(conf[4]) + conf[4] = tk_tcl2ruby(conf[4]) end end conf[1] = conf[1][1..-1] if conf.size == 2 # alias info @@ -173,10 +173,10 @@ class Tk::PanedWindow<TkWindow # win = win.epath if win.kind_of?(TkObject) win = _epath(win) if key - #conf = tk_split_list(tk_send_without_enc('paneconfigure', + #conf = tk_split_list(tk_send_without_enc('paneconfigure', # win, "-#{key}")) - conf = tk_split_list(tk_send_without_enc('paneconfigure', - win, "-#{key}"), + conf = tk_split_list(tk_send_without_enc('paneconfigure', + win, "-#{key}"), false, true) key = conf.shift[1..-1] if key == 'hide' @@ -186,10 +186,10 @@ class Tk::PanedWindow<TkWindow { key => conf } else ret = {} - #tk_split_simplelist(tk_send_without_enc('paneconfigure', + #tk_split_simplelist(tk_send_without_enc('paneconfigure', # win)).each{|conflist| # conf = tk_split_simplelist(conflist) - tk_split_simplelist(tk_send_without_enc('paneconfigure', win), + tk_split_simplelist(tk_send_without_enc('paneconfigure', win), false, false).each{|conflist| conf = tk_split_simplelist(conflist, false, true) key = conf.shift[1..-1] @@ -197,18 +197,18 @@ class Tk::PanedWindow<TkWindow if key == 'hide' conf[2] = bool(conf[2]) unless conf[2].empty? elsif conf[2].index('{') - conf[2] = tk_split_list(conf[2]) + conf[2] = tk_split_list(conf[2]) else - conf[2] = tk_tcl2ruby(conf[2]) + conf[2] = tk_tcl2ruby(conf[2]) end end if conf[3] if key == 'hide' conf[3] = bool(conf[3]) unless conf[3].empty? elsif conf[3].index('{') - conf[3] = tk_split_list(conf[3]) + conf[3] = tk_split_list(conf[3]) else - conf[3] = tk_tcl2ruby(conf[3]) + conf[3] = tk_tcl2ruby(conf[3]) end end if conf.size == 1 @@ -254,5 +254,5 @@ end Tk::Panedwindow = Tk::PanedWindow #TkPanedWindow = Tk::PanedWindow unless Object.const_defined? :TkPanedWindow #TkPanedwindow = Tk::Panedwindow unless Object.const_defined? :TkPanedwindow -Tk.__set_toplevel_aliases__(:Tk, Tk::PanedWindow, +Tk.__set_toplevel_aliases__(:Tk, Tk::PanedWindow, :TkPanedWindow, :TkPanedwindow) diff --git a/ext/tk/lib/tk/place.rb b/ext/tk/lib/tk/place.rb index f7ebdfcbd6..109d866fda 100644 --- a/ext/tk/lib/tk/place.rb +++ b/ext/tk/lib/tk/place.rb @@ -35,9 +35,9 @@ module TkPlace # win = win.epath if win.kind_of?(TkObject) win = _epath(win) if slot - #conf = tk_split_list(tk_call_without_enc('place', 'configure', + #conf = tk_split_list(tk_call_without_enc('place', 'configure', # win, "-#{slot}") ) - conf = tk_split_simplelist(tk_call_without_enc('place', 'configure', + conf = tk_split_simplelist(tk_call_without_enc('place', 'configure', win, "-#{slot}") ) conf[0] = conf[0][1..-1] conf[1] = tk_tcl2ruby(conf[1]) @@ -46,7 +46,7 @@ module TkPlace conf[4] = tk_tcl2ruby(conf[1]) conf else - tk_split_simplelist(tk_call_without_enc('place', 'configure', + tk_split_simplelist(tk_call_without_enc('place', 'configure', win)).collect{|conflist| #conf = list(conflist) conf = simplelist(conflist).collect!{|inf| tk_tcl2ruby(inf)} @@ -63,16 +63,16 @@ module TkPlace # win = win.epath if win.kind_of?(TkObject) win = _epath(win) if slot - #conf = tk_split_list(tk_call_without_enc('place', 'configure', + #conf = tk_split_list(tk_call_without_enc('place', 'configure', # win, "-#{slot}") ) - conf = tk_split_simplelist(tk_call_without_enc('place', 'configure', + conf = tk_split_simplelist(tk_call_without_enc('place', 'configure', win, "-#{slot}") ) # { conf[0][1..-1] => conf[1] } { conf[0][1..-1] => tk_tcl2ruby(conf[4]) } else ret = {} #tk_split_list(tk_call_without_enc('place','configure',win)).each{|conf| - tk_split_simplelist(tk_call_without_enc('place', 'configure', + tk_split_simplelist(tk_call_without_enc('place', 'configure', win)).each{|conf_list| #ret[conf[0][1..-1]] = conf[1] conf = simplelist(conf_list) diff --git a/ext/tk/lib/tk/radiobutton.rb b/ext/tk/lib/tk/radiobutton.rb index 1f864ec06b..1d75dc220d 100644 --- a/ext/tk/lib/tk/radiobutton.rb +++ b/ext/tk/lib/tk/radiobutton.rb @@ -67,5 +67,5 @@ end Tk::Radiobutton = Tk::RadioButton #TkRadioButton = Tk::RadioButton unless Object.const_defined? :TkRadioButton #TkRadiobutton = Tk::Radiobutton unless Object.const_defined? :TkRadiobutton -Tk.__set_toplevel_aliases__(:Tk, Tk::RadioButton, +Tk.__set_toplevel_aliases__(:Tk, Tk::RadioButton, :TkRadioButton, :TkRadiobutton) diff --git a/ext/tk/lib/tk/root.rb b/ext/tk/lib/tk/root.rb index 7237b4c614..ca6260927a 100644 --- a/ext/tk/lib/tk/root.rb +++ b/ext/tk/lib/tk/root.rb @@ -16,7 +16,7 @@ class Tk::Root<TkWindow def Root.new(keys=nil, &b) unless TkCore::INTERP.tk_windows['.'] - TkCore::INTERP.tk_windows['.'] = + TkCore::INTERP.tk_windows['.'] = super(:without_creating=>true, :widgetname=>'.'){} end root = TkCore::INTERP.tk_windows['.'] @@ -70,8 +70,8 @@ class Tk::Root<TkWindow def add_menu(menu_info, tearoff=false, opts=nil) # See tk/menuspec.rb for menu_info. - # opts is a hash of default configs for all of cascade menus. - # Configs of menu_info can override it. + # opts is a hash of default configs for all of cascade menus. + # Configs of menu_info can override it. if tearoff.kind_of?(Hash) opts = tearoff tearoff = false @@ -82,7 +82,7 @@ class Tk::Root<TkWindow def add_menubar(menu_spec, tearoff=false, opts=nil) # See tk/menuspec.rb for menu_spec. # opts is a hash of default configs for all of cascade menus. - # Configs of menu_spec can override it. + # Configs of menu_spec can override it. menu_spec.each{|info| add_menu(info, tearoff, opts)} self.menu end diff --git a/ext/tk/lib/tk/scale.rb b/ext/tk/lib/tk/scale.rb index 7e758d92f4..58283216b8 100644 --- a/ext/tk/lib/tk/scale.rb +++ b/ext/tk/lib/tk/scale.rb @@ -16,11 +16,11 @@ class Tk::Scale<TkWindow end unless TkConfigMethod.__IGNORE_UNKNOWN_CONFIGURE_OPTION__ #tk_call_without_enc('scale', @path, *hash_kv(keys, true)) - tk_call_without_enc(self.class::TkCommandNames[0], @path, + tk_call_without_enc(self.class::TkCommandNames[0], @path, *hash_kv(keys, true)) else begin - tk_call_without_enc(self.class::TkCommandNames[0], @path, + tk_call_without_enc(self.class::TkCommandNames[0], @path, *hash_kv(keys, true)) rescue tk_call_without_enc(self.class::TkCommandNames[0], @path) @@ -33,7 +33,7 @@ class Tk::Scale<TkWindow configure(keys) else # re-create widget - tk_call_without_enc(self.class::TkCommandNames[0], @path, + tk_call_without_enc(self.class::TkCommandNames[0], @path, *hash_kv(keys, true)) end end @@ -69,7 +69,7 @@ class Tk::Scale<TkWindow def configure(slot, value=None) if (slot == 'command' || slot == :command) configure('command'=>value) - elsif slot.kind_of?(Hash) && + elsif slot.kind_of?(Hash) && (slot.key?('command') || slot.key?(:command)) slot = _symbolkey2str(slot) slot['command'] = _wrap_command_arg(slot.delete('command')) diff --git a/ext/tk/lib/tk/scrollbar.rb b/ext/tk/lib/tk/scrollbar.rb index 87db46a9f9..decc4205c4 100644 --- a/ext/tk/lib/tk/scrollbar.rb +++ b/ext/tk/lib/tk/scrollbar.rb @@ -10,7 +10,7 @@ class Tk::Scrollbar<TkWindow def create_self(keys) @assigned = [] - @scroll_proc = proc{|*args| + @scroll_proc = proc{|*args| if self.orient == 'horizontal' @assigned.each{|w| w.xview(*args)} else # 'vertical' @@ -21,11 +21,11 @@ class Tk::Scrollbar<TkWindow if keys and keys != None unless TkConfigMethod.__IGNORE_UNKNOWN_CONFIGURE_OPTION__ #tk_call_without_enc('scrollbar', @path, *hash_kv(keys, true)) - tk_call_without_enc(self.class::TkCommandNames[0], @path, + tk_call_without_enc(self.class::TkCommandNames[0], @path, *hash_kv(keys, true)) else begin - tk_call_without_enc(self.class::TkCommandNames[0], @path, + tk_call_without_enc(self.class::TkCommandNames[0], @path, *hash_kv(keys, true)) rescue tk_call_without_enc(self.class::TkCommandNames[0], @path) @@ -38,7 +38,7 @@ class Tk::Scrollbar<TkWindow configure(keys) else # re-create widget - tk_call_without_enc(self.class::TkCommandNames[0], @path, + tk_call_without_enc(self.class::TkCommandNames[0], @path, *hash_kv(keys, true)) end end diff --git a/ext/tk/lib/tk/selection.rb b/ext/tk/lib/tk/selection.rb index 5caa6ef8ef..ba0a6f49f9 100644 --- a/ext/tk/lib/tk/selection.rb +++ b/ext/tk/lib/tk/selection.rb @@ -18,7 +18,7 @@ module TkSelection end def self.clear_on_display(win, sel=nil) if sel - tk_call_without_enc('selection', 'clear', + tk_call_without_enc('selection', 'clear', '-displayof', win, '-selection', sel) else tk_call_without_enc('selection', 'clear', '-displayof', win) @@ -35,7 +35,7 @@ module TkSelection end def self.get_on_display(win, keys=nil) #tk_call('selection', 'get', '-displayof', win, *hash_kv(keys)) - _fromUTF8(tk_call_without_enc('selection', 'get', '-displayof', + _fromUTF8(tk_call_without_enc('selection', 'get', '-displayof', win, *hash_kv(keys))) end def get(keys=nil) @@ -65,7 +65,7 @@ module TkSelection end def self.get_owner_on_display(win, sel=nil) if sel - window(tk_call_without_enc('selection', 'own', + window(tk_call_without_enc('selection', 'own', '-displayof', win, '-selection', sel)) else window(tk_call_without_enc('selection', 'own', '-displayof', win)) diff --git a/ext/tk/lib/tk/spinbox.rb b/ext/tk/lib/tk/spinbox.rb index 34dc1904f7..2fcc916237 100644 --- a/ext/tk/lib/tk/spinbox.rb +++ b/ext/tk/lib/tk/spinbox.rb @@ -13,15 +13,15 @@ class Tk::Spinbox<Tk::Entry class SpinCommand < TkValidateCommand class ValidateArgs < TkUtil::CallbackSubst KEY_TBL = [ - [ ?d, ?s, :direction ], - [ ?s, ?e, :current ], - [ ?W, ?w, :widget ], + [ ?d, ?s, :direction ], + [ ?s, ?e, :current ], + [ ?W, ?w, :widget ], nil ] PROC_TBL = [ - [ ?s, TkComm.method(:string) ], - [ ?w, TkComm.method(:window) ], + [ ?s, TkComm.method(:string) ], + [ ?w, TkComm.method(:window) ], [ ?e, proc{|val| #enc = Tk.encoding @@ -32,7 +32,7 @@ class Tk::Spinbox<Tk::Entry TkComm::string(val) end } - ], + ], nil ] diff --git a/ext/tk/lib/tk/text.rb b/ext/tk/lib/tk/text.rb index 4ec82bed1d..42b8be475e 100644 --- a/ext/tk/lib/tk/text.rb +++ b/ext/tk/lib/tk/text.rb @@ -281,7 +281,7 @@ class Tk::Text<TkTextWin def create_self(keys) #if keys and keys != None # #tk_call_without_enc('text', @path, *hash_kv(keys, true)) - # tk_call_without_enc(self.class::TkCommandNames[0], @path, + # tk_call_without_enc(self.class::TkCommandNames[0], @path, # *hash_kv(keys, true)) #else # #tk_call_without_enc('text', @path) @@ -306,7 +306,7 @@ class Tk::Text<TkTextWin end def index(idx) - Tk::Text::IndexString.new(tk_send_without_enc('index', + Tk::Text::IndexString.new(tk_send_without_enc('index', _get_eval_enc_str(idx))) end @@ -375,7 +375,7 @@ class Tk::Text<TkTextWin def mark_gravity(mark, direction=nil) if direction - tk_send_without_enc('mark', 'gravity', + tk_send_without_enc('mark', 'gravity', _get_eval_enc_str(mark), direction) self else @@ -384,27 +384,27 @@ class Tk::Text<TkTextWin end def mark_set(mark, index) - tk_send_without_enc('mark', 'set', _get_eval_enc_str(mark), + tk_send_without_enc('mark', 'set', _get_eval_enc_str(mark), _get_eval_enc_str(index)) self end alias set_mark mark_set def mark_unset(*marks) - tk_send_without_enc('mark', 'unset', + tk_send_without_enc('mark', 'unset', *(marks.collect{|mark| _get_eval_enc_str(mark)})) self end alias unset_mark mark_unset def mark_next(index) - tagid2obj(_fromUTF8(tk_send_without_enc('mark', 'next', + tagid2obj(_fromUTF8(tk_send_without_enc('mark', 'next', _get_eval_enc_str(index)))) end alias next_mark mark_next def mark_previous(index) - tagid2obj(_fromUTF8(tk_send_without_enc('mark', 'previous', + tagid2obj(_fromUTF8(tk_send_without_enc('mark', 'previous', _get_eval_enc_str(index)))) end alias previous_mark mark_previous @@ -412,11 +412,11 @@ class Tk::Text<TkTextWin def image_cget_strict(index, slot) case slot.to_s when 'text', 'label', 'show', 'data', 'file' - _fromUTF8(tk_send_without_enc('image', 'cget', + _fromUTF8(tk_send_without_enc('image', 'cget', _get_eval_enc_str(index), "-#{slot}")) else - tk_tcl2ruby(_fromUTF8(tk_send_without_enc('image', 'cget', - _get_eval_enc_str(index), + tk_tcl2ruby(_fromUTF8(tk_send_without_enc('image', 'cget', + _get_eval_enc_str(index), "-#{slot}"))) end end @@ -445,13 +445,13 @@ class Tk::Text<TkTextWin def image_configure(index, slot, value=None) if slot.kind_of?(Hash) - _fromUTF8(tk_send_without_enc('image', 'configure', - _get_eval_enc_str(index), + _fromUTF8(tk_send_without_enc('image', 'configure', + _get_eval_enc_str(index), *hash_kv(slot, true))) else - _fromUTF8(tk_send_without_enc('image', 'configure', - _get_eval_enc_str(index), - "-#{slot}", + _fromUTF8(tk_send_without_enc('image', 'configure', + _get_eval_enc_str(index), + "-#{slot}", _get_eval_enc_str(value))) end self @@ -481,16 +481,16 @@ class Tk::Text<TkTextWin else if conf[3] if conf[3].index('{') - conf[3] = tk_split_list(conf[3]) + conf[3] = tk_split_list(conf[3]) else - conf[3] = tk_tcl2ruby(conf[3]) + conf[3] = tk_tcl2ruby(conf[3]) end end if conf[4] if conf[4].index('{') - conf[4] = tk_split_list(conf[4]) + conf[4] = tk_split_list(conf[4]) else - conf[4] = tk_tcl2ruby(conf[4]) + conf[4] = tk_tcl2ruby(conf[4]) end end end @@ -522,16 +522,16 @@ class Tk::Text<TkTextWin else if conf[2] if conf[2].index('{') - conf[2] = tk_split_list(conf[2]) + conf[2] = tk_split_list(conf[2]) else - conf[2] = tk_tcl2ruby(conf[2]) + conf[2] = tk_tcl2ruby(conf[2]) end end if conf[3] if conf[3].index('{') - conf[3] = tk_split_list(conf[3]) + conf[3] = tk_split_list(conf[3]) else - conf[3] = tk_tcl2ruby(conf[3]) + conf[3] = tk_tcl2ruby(conf[3]) end end end @@ -620,7 +620,7 @@ class Tk::Text<TkTextWin end def compare(idx1, op, idx2) - bool(tk_send_without_enc('compare', _get_eval_enc_str(idx1), + bool(tk_send_without_enc('compare', _get_eval_enc_str(idx1), op, _get_eval_enc_str(idx2))) end @@ -643,7 +643,7 @@ class Tk::Text<TkTextWin def count_info(idx1, idx2, update=true) # Tk8.5 feature opts = [ - :chars, :displaychars, :displayindices, :displaylines, + :chars, :displaychars, :displayindices, :displaylines, :indices, :lines, :xpixels, :ypixels ] if update @@ -737,8 +737,8 @@ class Tk::Text<TkTextWin end def tag_add(tag, index1, index2=None) - tk_send_without_enc('tag', 'add', _get_eval_enc_str(tag), - _get_eval_enc_str(index1), + tk_send_without_enc('tag', 'add', _get_eval_enc_str(tag), + _get_eval_enc_str(index1), _get_eval_enc_str(index2)) self end @@ -746,15 +746,15 @@ class Tk::Text<TkTextWin alias add_tag tag_add def tag_delete(*tags) - tk_send_without_enc('tag', 'delete', + tk_send_without_enc('tag', 'delete', *(tags.collect{|tag| _get_eval_enc_str(tag)})) TkTextTag::TTagID_TBL.mutex.synchronize{ if TkTextTag::TTagID_TBL[@path] tags.each{|tag| if tag.kind_of?(TkTextTag) - TkTextTag::TTagID_TBL[@path].delete(tag.id) + TkTextTag::TTagID_TBL[@path].delete(tag.id) else - TkTextTag::TTagID_TBL[@path].delete(tag) + TkTextTag::TTagID_TBL[@path].delete(tag) end } end @@ -807,7 +807,7 @@ class Tk::Text<TkTextWin def tag_cget(tag, key) case key.to_s when 'text', 'label', 'show', 'data', 'file' - tk_call_without_enc(@path, 'tag', 'cget', + tk_call_without_enc(@path, 'tag', 'cget', _get_eval_enc_str(tag), "-#{key}") when 'font', 'kanjifont' #fnt = tk_tcl2ruby(tk_send('tag', 'cget', tag, "-#{key}")) @@ -833,14 +833,14 @@ class Tk::Text<TkTextWin || key['latinfont'] || key['asciifont'] ) tagfont_configure(tag, key) else - tk_send_without_enc('tag', 'configure', _get_eval_enc_str(tag), + tk_send_without_enc('tag', 'configure', _get_eval_enc_str(tag), *hash_kv(key, true)) end else - if key == 'font' || key == :font || + if key == 'font' || key == :font || key == 'kanjifont' || key == :kanjifont || - key == 'latinfont' || key == :latinfont || + key == 'latinfont' || key == :latinfont || key == 'asciifont' || key == :asciifont if val == None tagfontobj(tag) @@ -848,7 +848,7 @@ class Tk::Text<TkTextWin tagfont_configure(tag, {key=>val}) end else - tk_send_without_enc('tag', 'configure', _get_eval_enc_str(tag), + tk_send_without_enc('tag', 'configure', _get_eval_enc_str(tag), "-#{key}", _get_eval_enc_str(val)) end end @@ -878,16 +878,16 @@ class Tk::Text<TkTextWin else if conf[3] if conf[3].index('{') - conf[3] = tk_split_list(conf[3]) + conf[3] = tk_split_list(conf[3]) else - conf[3] = tk_tcl2ruby(conf[3]) + conf[3] = tk_tcl2ruby(conf[3]) end end if conf[4] if conf[4].index('{') - conf[4] = tk_split_list(conf[4]) + conf[4] = tk_split_list(conf[4]) else - conf[4] = tk_tcl2ruby(conf[4]) + conf[4] = tk_tcl2ruby(conf[4]) end end end @@ -926,16 +926,16 @@ class Tk::Text<TkTextWin else if conf[2] if conf[2].index('{') - conf[2] = tk_split_list(conf[2]) + conf[2] = tk_split_list(conf[2]) else - conf[2] = tk_tcl2ruby(conf[2]) + conf[2] = tk_tcl2ruby(conf[2]) end end if conf[3] if conf[3].index('{') - conf[3] = tk_split_list(conf[3]) + conf[3] = tk_split_list(conf[3]) else - conf[3] = tk_tcl2ruby(conf[3]) + conf[3] = tk_tcl2ruby(conf[3]) end end end @@ -980,19 +980,19 @@ class Tk::Text<TkTextWin =end def tag_raise(tag, above=None) - tk_send_without_enc('tag', 'raise', _get_eval_enc_str(tag), + tk_send_without_enc('tag', 'raise', _get_eval_enc_str(tag), _get_eval_enc_str(above)) self end def tag_lower(tag, below=None) - tk_send_without_enc('tag', 'lower', _get_eval_enc_str(tag), + tk_send_without_enc('tag', 'lower', _get_eval_enc_str(tag), _get_eval_enc_str(below)) self end def tag_remove(tag, *indices) - tk_send_without_enc('tag', 'remove', _get_eval_enc_str(tag), + tk_send_without_enc('tag', 'remove', _get_eval_enc_str(tag), *(indices.collect{|idx| _get_eval_enc_str(idx)})) self end @@ -1001,7 +1001,7 @@ class Tk::Text<TkTextWin #l = tk_split_simplelist(tk_send_without_enc('tag', 'ranges', # _get_eval_enc_str(tag))) l = tk_split_simplelist(tk_send_without_enc('tag', 'ranges', - _get_eval_enc_str(tag)), + _get_eval_enc_str(tag)), false, true) r = [] while key=l.shift @@ -1011,18 +1011,18 @@ class Tk::Text<TkTextWin end def tag_nextrange(tag, first, last=None) - simplelist(tk_send_without_enc('tag', 'nextrange', - _get_eval_enc_str(tag), - _get_eval_enc_str(first), + simplelist(tk_send_without_enc('tag', 'nextrange', + _get_eval_enc_str(tag), + _get_eval_enc_str(first), _get_eval_enc_str(last))).collect{|idx| Tk::Text::IndexString.new(idx) } end def tag_prevrange(tag, first, last=None) - simplelist(tk_send_without_enc('tag', 'prevrange', - _get_eval_enc_str(tag), - _get_eval_enc_str(first), + simplelist(tk_send_without_enc('tag', 'prevrange', + _get_eval_enc_str(tag), + _get_eval_enc_str(first), _get_eval_enc_str(last))).collect{|idx| Tk::Text::IndexString.new(idx) } @@ -1032,7 +1032,7 @@ class Tk::Text<TkTextWin def window_cget(index, slot) case slot.to_s when 'text', 'label', 'show', 'data', 'file' - _fromUTF8(tk_send_without_enc('window', 'cget', + _fromUTF8(tk_send_without_enc('window', 'cget', _get_eval_enc_str(index), "-#{slot}")) when 'font', 'kanjifont' #fnt = tk_tcl2ruby(tk_send('window', 'cget', index, "-#{slot}")) @@ -1076,12 +1076,12 @@ class Tk::Text<TkTextWin slot['create'] = install_cmd(proc{_epath(p_create.call)}) end end - tk_send_without_enc('window', 'configure', - _get_eval_enc_str(index), + tk_send_without_enc('window', 'configure', + _get_eval_enc_str(index), *hash_kv(slot, true)) else if slot == 'window' || slot == :window - # id = value + # id = value # value = id.epath if id.kind_of?(TkWindow) value = _epath(value) end @@ -1101,8 +1101,8 @@ class Tk::Text<TkTextWin value = install_cmd(proc{_epath(p_create.call)}) end end - tk_send_without_enc('window', 'configure', - _get_eval_enc_str(index), + tk_send_without_enc('window', 'configure', + _get_eval_enc_str(index), "-#{slot}", _get_eval_enc_str(value)) end end @@ -1129,16 +1129,16 @@ class Tk::Text<TkTextWin else if conf[3] if conf[3].index('{') - conf[3] = tk_split_list(conf[3]) + conf[3] = tk_split_list(conf[3]) else - conf[3] = tk_tcl2ruby(conf[3]) + conf[3] = tk_tcl2ruby(conf[3]) end end if conf[4] if conf[4].index('{') - conf[4] = tk_split_list(conf[4]) + conf[4] = tk_split_list(conf[4]) else - conf[4] = tk_tcl2ruby(conf[4]) + conf[4] = tk_tcl2ruby(conf[4]) end end end @@ -1166,16 +1166,16 @@ class Tk::Text<TkTextWin else if conf[2] if conf[2].index('{') - conf[2] = tk_split_list(conf[2]) + conf[2] = tk_split_list(conf[2]) else - conf[2] = tk_tcl2ruby(conf[2]) + conf[2] = tk_tcl2ruby(conf[2]) end end if conf[3] if conf[3].index('{') - conf[3] = tk_split_list(conf[3]) + conf[3] = tk_split_list(conf[3]) else - conf[3] = tk_tcl2ruby(conf[3]) + conf[3] = tk_tcl2ruby(conf[3]) end end end @@ -1231,11 +1231,11 @@ class Tk::Text<TkTextWin # $KCODE == 'NONE' if JAPANIZED_TK - tk_call_without_enc('kstring', 'length', + tk_call_without_enc('kstring', 'length', _get_eval_enc_str(txt)).to_i else begin - tk_call_without_enc('encoding', 'convertto', 'ascii', + tk_call_without_enc('encoding', 'convertto', 'ascii', _get_eval_enc_str(txt)).length rescue StandardError, NameError # sorry, I have no plan @@ -1324,11 +1324,11 @@ class Tk::Text<TkTextWin pos = _ktext_length(txt[0..(pos-1)]) if pos > 0 if pat.kind_of?(String) #return [index(start + " + #{pos} chars"), pat.split('').length] - return [index(start + " + #{pos} chars"), + return [index(start + " + #{pos} chars"), _ktext_length(pat), pat.dup] else #return [index(start + " + #{pos} chars"), $&.split('').length] - return [index(start + " + #{pos} chars"), + return [index(start + " + #{pos} chars"), _ktext_length(match), match] end else @@ -1342,11 +1342,11 @@ class Tk::Text<TkTextWin pos = _ktext_length(txt[0..(pos-1)]) if pos > 0 if pat.kind_of?(String) #return [index(start + " + #{pos} chars"), pat.split('').length] - return [index(start + " + #{pos} chars"), + return [index(start + " + #{pos} chars"), _ktext_length(pat), pat.dup] else #return [index(start + " + #{pos} chars"), $&.split('').length] - return [index(start + " + #{pos} chars"), + return [index(start + " + #{pos} chars"), _ktext_length(match), match] end else @@ -1357,7 +1357,7 @@ class Tk::Text<TkTextWin pos = _ktext_length(txt[0..(pos-1)]) if pos > 0 if pat.kind_of?(String) #return [index("1.0 + #{pos} chars"), pat.split('').length] - return [index("1.0 + #{pos} chars"), + return [index("1.0 + #{pos} chars"), _ktext_length(pat), pat.dup] else #return [index("1.0 + #{pos} chars"), $&.split('').length] @@ -1447,7 +1447,7 @@ class Tk::Text<TkTextWin idx = str.index(/ /, i) result.push str[i..(idx-1)] i = idx + 1 - + # retrieve value case result[-1] when 'text' @@ -1505,7 +1505,7 @@ class Tk::Text<TkTextWin break end end - + kvis = [] until result.empty? kvis.push [result.shift, result.shift, result.shift] diff --git a/ext/tk/lib/tk/textimage.rb b/ext/tk/lib/tk/textimage.rb index fb306a9c17..99027a06fb 100644 --- a/ext/tk/lib/tk/textimage.rb +++ b/ext/tk/lib/tk/textimage.rb @@ -16,19 +16,19 @@ class TkTextImage<TkObject @path = TkTextMark.new(@t, tk_call(@t.path, 'index', 'end - 1 chars')) elsif index.kind_of? TkTextMark if tk_call_without_enc(@t.path,'index',index.path) == tk_call_without_enc(@t.path,'index','end') - @path = TkTextMark.new(@t, tk_call_without_enc(@t.path, 'index', + @path = TkTextMark.new(@t, tk_call_without_enc(@t.path, 'index', 'end - 1 chars')) else - @path = TkTextMark.new(@t, tk_call_without_enc(@t.path, 'index', + @path = TkTextMark.new(@t, tk_call_without_enc(@t.path, 'index', index.path)) end else - @path = TkTextMark.new(@t, tk_call_without_enc(@t.path, 'index', + @path = TkTextMark.new(@t, tk_call_without_enc(@t.path, 'index', _get_eval_enc_str(index))) end @path.gravity = 'left' @index = @path.path - @id = tk_call_without_enc(@t.path, 'image', 'create', @index, + @id = tk_call_without_enc(@t.path, 'image', 'create', @index, *hash_kv(keys, true)).freeze @path.gravity = 'right' end @@ -78,7 +78,7 @@ class TkTextImage<TkObject end def image=(value) - tk_call_without_enc(@t.path, 'image', 'configure', @index, '-image', + tk_call_without_enc(@t.path, 'image', 'configure', @index, '-image', _get_eval_enc_str(value)) #self value diff --git a/ext/tk/lib/tk/textmark.rb b/ext/tk/lib/tk/textmark.rb index 72c1ce1ab4..e9743475e0 100644 --- a/ext/tk/lib/tk/textmark.rb +++ b/ext/tk/lib/tk/textmark.rb @@ -25,7 +25,7 @@ class TkTextMark<TkObject if TMarkID_TBL[tpath] TMarkID_TBL[tpath][id]? TMarkID_TBL[tpath][id]: id else - id + id end } end @@ -46,7 +46,7 @@ class TkTextMark<TkObject TMarkID_TBL[@tpath] = {} unless TMarkID_TBL[@tpath] TMarkID_TBL[@tpath][@id] = self } - tk_call_without_enc(@t.path, 'mark', 'set', @id, + tk_call_without_enc(@t.path, 'mark', 'set', @id, _get_eval_enc_str(index)) @t._addtag id, self end @@ -100,7 +100,7 @@ class TkTextMark<TkObject end def set(where) - tk_call_without_enc(@t.path, 'mark', 'set', @id, + tk_call_without_enc(@t.path, 'mark', 'set', @id, _get_eval_enc_str(where)) self end @@ -159,7 +159,7 @@ class TkTextNamedMark<TkTextMark end if obj && index - tk_call_without_enc(parent.path, 'mark', 'set', name, + tk_call_without_enc(parent.path, 'mark', 'set', name, _get_eval_enc_str(index)) end obj @@ -175,7 +175,7 @@ class TkTextNamedMark<TkTextMark @parent = @t = parent @tpath = parent.path @path = @id = name - tk_call_without_enc(@t.path, 'mark', 'set', @id, + tk_call_without_enc(@t.path, 'mark', 'set', @id, _get_eval_enc_str(index)) if index @t._addtag @id, self end diff --git a/ext/tk/lib/tk/texttag.rb b/ext/tk/lib/tk/texttag.rb index b08d923ea1..7bd59bf8ee 100644 --- a/ext/tk/lib/tk/texttag.rb +++ b/ext/tk/lib/tk/texttag.rb @@ -26,7 +26,7 @@ class TkTextTag<TkObject TTagID_TBL.mutex.synchronize{ if TTagID_TBL[tpath] TTagID_TBL[tpath][id]? TTagID_TBL[tpath][id]: id - else + else id end } @@ -84,13 +84,13 @@ class TkTextTag<TkObject end def add(*indices) - tk_call_without_enc(@t.path, 'tag', 'add', @id, + tk_call_without_enc(@t.path, 'tag', 'add', @id, *(indices.collect{|idx| _get_eval_enc_str(idx)})) self end def remove(*indices) - tk_call_without_enc(@t.path, 'tag', 'remove', @id, + tk_call_without_enc(@t.path, 'tag', 'remove', @id, *(indices.collect{|idx| _get_eval_enc_str(idx)})) self end @@ -105,16 +105,16 @@ class TkTextTag<TkObject end def nextrange(first, last=None) - simplelist(tk_call_without_enc(@t.path, 'tag', 'nextrange', @id, - _get_eval_enc_str(first), + simplelist(tk_call_without_enc(@t.path, 'tag', 'nextrange', @id, + _get_eval_enc_str(first), _get_eval_enc_str(last))).collect{|idx| Tk::Text::IndexString.new(idx) } end def prevrange(first, last=None) - simplelist(tk_call_without_enc(@t.path, 'tag', 'prevrange', @id, - _get_eval_enc_str(first), + simplelist(tk_call_without_enc(@t.path, 'tag', 'prevrange', @id, + _get_eval_enc_str(first), _get_eval_enc_str(last))).collect{|idx| Tk::Text::IndexString.new(idx) } @@ -142,7 +142,7 @@ class TkTextTag<TkObject _fromUTF8(tk_call_without_enc(@t.path, 'tag', 'cget', @id, "-#{key}")) when 'font', 'kanjifont' #fnt = tk_tcl2ruby(tk_call(@t.path, 'tag', 'cget', @id, "-#{key}")) - fnt = tk_tcl2ruby(_fromUTF8(tk_call_without_enc(@t.path, 'tag', 'cget', + fnt = tk_tcl2ruby(_fromUTF8(tk_call_without_enc(@t.path, 'tag', 'cget', @id, '-font'))) unless fnt.kind_of?(TkFont) fnt = tagfontobj(@id, fnt) @@ -154,7 +154,7 @@ class TkTextTag<TkObject fnt end else - tk_tcl2ruby(_fromUTF8(tk_call_without_enc(@t.path, 'tag', 'cget', + tk_tcl2ruby(_fromUTF8(tk_call_without_enc(@t.path, 'tag', 'cget', @id, "-#{key}"))) end end @@ -227,13 +227,13 @@ class TkTextTag<TkObject end def raise(above=None) - tk_call_without_enc(@t.path, 'tag', 'raise', @id, + tk_call_without_enc(@t.path, 'tag', 'raise', @id, _get_eval_enc_str(above)) self end def lower(below=None) - tk_call_without_enc(@t.path, 'tag', 'lower', @id, + tk_call_without_enc(@t.path, 'tag', 'lower', @id, _get_eval_enc_str(below)) self end diff --git a/ext/tk/lib/tk/textwindow.rb b/ext/tk/lib/tk/textwindow.rb index 004422e4f3..49327b2c81 100644 --- a/ext/tk/lib/tk/textwindow.rb +++ b/ext/tk/lib/tk/textwindow.rb @@ -13,14 +13,14 @@ class TkTextWindow<TkObject #end @t = parent if index == 'end' || index == :end - @path = TkTextMark.new(@t, tk_call_without_enc(@t.path, 'index', + @path = TkTextMark.new(@t, tk_call_without_enc(@t.path, 'index', 'end - 1 chars')) elsif index.kind_of?(TkTextMark) if tk_call_without_enc(@t.path,'index',index.path) == tk_call_without_enc(@t.path,'index','end') - @path = TkTextMark.new(@t, tk_call_without_enc(@t.path, 'index', + @path = TkTextMark.new(@t, tk_call_without_enc(@t.path, 'index', 'end - 1 chars')) else - @path = TkTextMark.new(@t, tk_call_without_enc(@t.path, 'index', + @path = TkTextMark.new(@t, tk_call_without_enc(@t.path, 'index', index.path)) end else @@ -49,7 +49,7 @@ class TkTextWindow<TkObject keys['create'] = install_cmd(proc{@id = @p_create.call; _epath(@id)}) end end - tk_call_without_enc(@t.path, 'window', 'create', @index, + tk_call_without_enc(@t.path, 'window', 'create', @index, *hash_kv(keys, true)) @path.gravity = 'right' end @@ -80,7 +80,7 @@ class TkTextWindow<TkObject if slot.kind_of?(Hash) slot = _symbolkey2str(slot) if slot['window'] - @id = slot['window'] + @id = slot['window'] # slot['window'] = @id.epath if @id.kind_of?(TkWindow) slot['window'] = _epath(@id) if @id end @@ -88,19 +88,19 @@ class TkTextWindow<TkObject self.create=slot.delete('create') end if slot.size > 0 - tk_call_without_enc(@t.path, 'window', 'configure', @index, + tk_call_without_enc(@t.path, 'window', 'configure', @index, *hash_kv(slot, true)) end else if slot == 'window' || slot == :window - @id = value + @id = value # value = @id.epath if @id.kind_of?(TkWindow) value = _epath(@id) if @id end if slot == 'create' || slot == :create self.create=value else - tk_call_without_enc(@t.path, 'window', 'configure', @index, + tk_call_without_enc(@t.path, 'window', 'configure', @index, "-#{slot}", _get_eval_enc_str(value)) end end @@ -123,7 +123,7 @@ class TkTextWindow<TkObject @id = value # value = @id.epath if @id.kind_of?(TkWindow) value = _epath(@id) if @id - tk_call_without_enc(@t.path, 'window', 'configure', @index, + tk_call_without_enc(@t.path, 'window', 'configure', @index, '-window', _get_eval_enc_str(value)) value end @@ -145,7 +145,7 @@ class TkTextWindow<TkObject end }) end - tk_call_without_enc(@t.path, 'window', 'configure', @index, + tk_call_without_enc(@t.path, 'window', 'configure', @index, '-create', _get_eval_enc_str(value)) value end diff --git a/ext/tk/lib/tk/timer.rb b/ext/tk/lib/tk/timer.rb index 91840d0575..686d4bd483 100644 --- a/ext/tk/lib/tk/timer.rb +++ b/ext/tk/lib/tk/timer.rb @@ -76,7 +76,7 @@ class TkTimer rescue Interrupt exit!(1) rescue Exception => e - if @cancel_on_exception && + if @cancel_on_exception && @cancel_on_exception.find{|exc| e.kind_of?(exc)} cancel @return_value = e @@ -180,12 +180,12 @@ class TkTimer @after_script = nil @cancel_on_exception = DEFAULT_IGNORE_EXCEPTIONS - # Unless @cancel_on_exception, Ruby/Tk shows an error dialog box when - # an excepsion is raised on TkTimer callback procedure. - # If @cancel_on_exception is an array of exception classes and the raised - # exception is included in the array, Ruby/Tk cancels executing TkTimer - # callback procedures silently (TkTimer#cancel is called and no dialog is - # shown). + # Unless @cancel_on_exception, Ruby/Tk shows an error dialog box when + # an excepsion is raised on TkTimer callback procedure. + # If @cancel_on_exception is an array of exception classes and the raised + # exception is included in the array, Ruby/Tk cancels executing TkTimer + # callback procedures silently (TkTimer#cancel is called and no dialog is + # shown). if b case args.size @@ -229,7 +229,7 @@ class TkTimer end def current_status - [@running, @current_sleep, @current_proc, @current_args, + [@running, @current_sleep, @current_proc, @current_args, @do_loop, @cancel_on_exception] end @@ -484,11 +484,11 @@ class TkTimer def at_end(*arg, &b) if arg.empty? - if b + if b @at_end_proc = b - else + else # no proc - return @at_end_proc + return @at_end_proc end else fail ArgumentError, "wrong number of arguments" if arg.length != 1 || b @@ -504,17 +504,17 @@ class TkTimer unless @running if @return_value.kind_of?(Exception) - fail @return_value + fail @return_value else - return @return_value + return @return_value end end @wait_var.wait(on_thread, check_root) if @return_value.kind_of?(Exception) - fail @return_value + fail @return_value else - @return_value + @return_value end end def eventloop_wait(check_root = false) @@ -628,12 +628,12 @@ class TkRTTimer < TkTimer if @est_time @est_time = Time.at(@est_time.to_i, @est_time.usec + sleep*1000) else - @est_time = Time.at(@cb_start_time.to_i, + @est_time = Time.at(@cb_start_time.to_i, @cb_start_time.usec + sleep*1000) end now = Time.now - real_sleep = ((@est_time.to_i - now.to_i + @offset_s)*1000.0 + + real_sleep = ((@est_time.to_i - now.to_i + @offset_s)*1000.0 + (@est_time.usec - now.usec + @offset_u)/1000.0).round if real_sleep <= 0 real_sleep = 0 @@ -653,7 +653,7 @@ class TkRTTimer < TkTimer if @current_sleep == 0 @offset_list.push([ - @offset_s - @cb_start_time.to_i, + @offset_s - @cb_start_time.to_i, @offset_u - @cb_start_time.usec ]) else diff --git a/ext/tk/lib/tk/toplevel.rb b/ext/tk/lib/tk/toplevel.rb index bd6e8307f5..917264aef7 100644 --- a/ext/tk/lib/tk/toplevel.rb +++ b/ext/tk/lib/tk/toplevel.rb @@ -38,7 +38,7 @@ class Tk::Toplevel<TkWindow # s << "-class" << @classname if @classname # s << "-colormap" << @colormap if @colormap # s << "-container" << @container if @container -# s << "-screen" << @screen if @screen +# s << "-screen" << @screen if @screen # s << "-use" << @use if @use # s << "-visual" << @visual if @visual # tk_call 'toplevel', @path, *s @@ -113,7 +113,7 @@ class Tk::Toplevel<TkWindow @use = keys['use'] @visual = keys['visual'] if !@classname && my_class_name - keys['class'] = @classname = my_class_name + keys['class'] = @classname = my_class_name end if @classname.kind_of? TkBindTag @db_class = @classname @@ -127,7 +127,7 @@ class Tk::Toplevel<TkWindow end keys, cmds = _wm_command_option_chk(keys) super(keys) - cmds.each{|k,v| + cmds.each{|k,v| if v.kind_of? Array self.__send__(k,*v) else @@ -162,7 +162,7 @@ class Tk::Toplevel<TkWindow keys = {} end if !@classname && my_class_name - keys['class'] = @classname = my_class_name + keys['class'] = @classname = my_class_name end if @classname.kind_of? TkBindTag @db_class = @classname @@ -176,7 +176,7 @@ class Tk::Toplevel<TkWindow end keys, cmds = _wm_command_option_chk(keys) super(parent, keys) - cmds.each{|k,v| + cmds.each{|k,v| if v.kind_of? Array self.send(k,*v) else @@ -200,8 +200,8 @@ class Tk::Toplevel<TkWindow def add_menu(menu_info, tearoff=false, opts=nil) # See tk/menuspec.rb for menu_info. - # opts is a hash of default configs for all of cascade menus. - # Configs of menu_info can override it. + # opts is a hash of default configs for all of cascade menus. + # Configs of menu_info can override it. if tearoff.kind_of?(Hash) opts = tearoff tearoff = false @@ -212,7 +212,7 @@ class Tk::Toplevel<TkWindow def add_menubar(menu_spec, tearoff=false, opts=nil) # See tk/menuspec.rb for menu_spec. # opts is a hash of default configs for all of cascade menus. - # Configs of menu_spec can override it. + # Configs of menu_spec can override it. menu_spec.each{|info| add_menu(info, tearoff, opts)} self.menu end diff --git a/ext/tk/lib/tk/ttk_selector.rb b/ext/tk/lib/tk/ttk_selector.rb index 72ed637a38..7a0dd34038 100644 --- a/ext/tk/lib/tk/ttk_selector.rb +++ b/ext/tk/lib/tk/ttk_selector.rb @@ -5,53 +5,53 @@ # toplevel classes/modules module Tk @TOPLEVEL_ALIAS_TABLE[:Ttk] = { - :TkButton => 'tkextlib/tile/tbutton', + :TkButton => 'tkextlib/tile/tbutton', - :TkCheckbutton => 'tkextlib/tile/tcheckbutton', - :TkCheckButton => 'tkextlib/tile/tcheckbutton', + :TkCheckbutton => 'tkextlib/tile/tcheckbutton', + :TkCheckButton => 'tkextlib/tile/tcheckbutton', - # :TkDialog => 'tkextlib/tile/dialog', + # :TkDialog => 'tkextlib/tile/dialog', - :TkEntry => 'tkextlib/tile/tentry', + :TkEntry => 'tkextlib/tile/tentry', - :TkCombobox => 'tkextlib/tile/tcombobox', + :TkCombobox => 'tkextlib/tile/tcombobox', - :TkFrame => 'tkextlib/tile/tframe', + :TkFrame => 'tkextlib/tile/tframe', - :TkLabel => 'tkextlib/tile/tlabel', + :TkLabel => 'tkextlib/tile/tlabel', - :TkLabelframe => 'tkextlib/tile/tlabelframe', - :TkLabelFrame => 'tkextlib/tile/tlabelframe', + :TkLabelframe => 'tkextlib/tile/tlabelframe', + :TkLabelFrame => 'tkextlib/tile/tlabelframe', - :TkMenubutton => 'tkextlib/tile/tmenubutton', - :TkMenuButton => 'tkextlib/tile/tmenubutton', + :TkMenubutton => 'tkextlib/tile/tmenubutton', + :TkMenuButton => 'tkextlib/tile/tmenubutton', - :TkNotebook => 'tkextlib/tile/tnotebook', + :TkNotebook => 'tkextlib/tile/tnotebook', - # :TkPaned => 'tkextlib/tile/tpaned', - :TkPanedwindow => 'tkextlib/tile/tpaned', - :TkPanedWindow => 'tkextlib/tile/tpaned', + # :TkPaned => 'tkextlib/tile/tpaned', + :TkPanedwindow => 'tkextlib/tile/tpaned', + :TkPanedWindow => 'tkextlib/tile/tpaned', - :TkProgressbar => 'tkextlib/tile/tprogressbar', + :TkProgressbar => 'tkextlib/tile/tprogressbar', - :TkRadiobutton => 'tkextlib/tile/tradiobutton', - :TkRadioButton => 'tkextlib/tile/tradiobutton', + :TkRadiobutton => 'tkextlib/tile/tradiobutton', + :TkRadioButton => 'tkextlib/tile/tradiobutton', - :TkScale => 'tkextlib/tile/tscale', - # :TkProgress => 'tkextlib/tile/tscale', + :TkScale => 'tkextlib/tile/tscale', + # :TkProgress => 'tkextlib/tile/tscale', - :TkScrollbar => 'tkextlib/tile/tscrollbar', - :TkXScrollbar => 'tkextlib/tile/tscrollbar', - :TkYScrollbar => 'tkextlib/tile/tscrollbar', + :TkScrollbar => 'tkextlib/tile/tscrollbar', + :TkXScrollbar => 'tkextlib/tile/tscrollbar', + :TkYScrollbar => 'tkextlib/tile/tscrollbar', - :TkSeparator => 'tkextlib/tile/tseparator', + :TkSeparator => 'tkextlib/tile/tseparator', - :TkSizeGrip => 'tkextlib/tile/sizegrip', - :TkSizegrip => 'tkextlib/tile/sizegrip', + :TkSizeGrip => 'tkextlib/tile/sizegrip', + :TkSizegrip => 'tkextlib/tile/sizegrip', - # :TkSquare => 'tkextlib/tile/tsquare', + # :TkSquare => 'tkextlib/tile/tsquare', - :TkTreeview => 'tkextlib/tile/treeview', + :TkTreeview => 'tkextlib/tile/treeview', } @TOPLEVEL_ALIAS_TABLE[:Tile] = @TOPLEVEL_ALIAS_TABLE[:Ttk] @@ -66,9 +66,9 @@ module Tk ################################################ - @TOPLEVEL_ALIAS_SETUP_PROC[:Tile] = + @TOPLEVEL_ALIAS_SETUP_PROC[:Tile] = @TOPLEVEL_ALIAS_SETUP_PROC[:Ttk] = proc{|mod| - unless Tk.autoload?(:Tile) || Tk.const_defined?(:Tile) + unless Tk.autoload?(:Tile) || Tk.const_defined?(:Tile) Object.autoload :Ttk, 'tkextlib/tile' Tk.autoload :Tile, 'tkextlib/tile' end diff --git a/ext/tk/lib/tk/validation.rb b/ext/tk/lib/tk/validation.rb index 60bd433cdc..0ebd5c51b7 100644 --- a/ext/tk/lib/tk/validation.rb +++ b/ext/tk/lib/tk/validation.rb @@ -211,21 +211,21 @@ class TkValidateCommand class ValidateArgs < TkUtil::CallbackSubst KEY_TBL = [ - [ ?d, ?n, :action ], - [ ?i, ?x, :index ], - [ ?s, ?e, :current ], - [ ?v, ?s, :type ], - [ ?P, ?e, :value ], - [ ?S, ?e, :string ], - [ ?V, ?s, :triggered ], - [ ?W, ?w, :widget ], + [ ?d, ?n, :action ], + [ ?i, ?x, :index ], + [ ?s, ?e, :current ], + [ ?v, ?s, :type ], + [ ?P, ?e, :value ], + [ ?S, ?e, :string ], + [ ?V, ?s, :triggered ], + [ ?W, ?w, :widget ], nil ] PROC_TBL = [ - [ ?n, TkComm.method(:number) ], - [ ?s, TkComm.method(:string) ], - [ ?w, TkComm.method(:window) ], + [ ?n, TkComm.method(:number) ], + [ ?s, TkComm.method(:string) ], + [ ?w, TkComm.method(:window) ], [ ?e, proc{|val| #enc = Tk.encoding @@ -236,7 +236,7 @@ class TkValidateCommand TkComm::string(val) end } - ], + ], [ ?x, proc{|val| idx = TkComm::number(val) @@ -246,7 +246,7 @@ class TkValidateCommand idx end } - ], + ], nil ] @@ -272,7 +272,7 @@ class TkValidateCommand _setup_subst_table(KEY_TBL, PROC_TBL); # - # NOTE: The order of parameters which passed to callback procedure is + # NOTE: The order of parameters which passed to callback procedure is # <extra_arg>, <extra_arg>, ... , <subst_arg>, <subst_arg>, ... # diff --git a/ext/tk/lib/tk/variable.rb b/ext/tk/lib/tk/variable.rb index b73a4677da..bdd441705b 100644 --- a/ext/tk/lib/tk/variable.rb +++ b/ext/tk/lib/tk/variable.rb @@ -29,7 +29,7 @@ class TkVariable major, minor, type, patchlevel = TclTkLib.get_version USE_OLD_TRACE_OPTION_STYLE = (major < 8) || (major == 8 && minor < 4) - #TkCore::INTERP.add_tk_procs('rb_var', 'args', + #TkCore::INTERP.add_tk_procs('rb_var', 'args', # "ruby [format \"TkVariable.callback %%Q!%s!\" $args]") TkCore::INTERP.add_tk_procs('rb_var', 'args', <<-'EOL') if {[set st [catch {eval {ruby_cmd TkVariable callback} $args} ret]] != 0} { @@ -65,10 +65,10 @@ class TkVariable exit!(1) rescue Exception => e begin - msg = _toUTF8(e.class.inspect) + ': ' + - _toUTF8(e.message) + "\n" + - "\n---< backtrace of Ruby side >-----\n" + - _toUTF8(e.backtrace.join("\n")) + + msg = _toUTF8(e.class.inspect) + ': ' + + _toUTF8(e.message) + "\n" + + "\n---< backtrace of Ruby side >-----\n" + + _toUTF8(e.backtrace.join("\n")) + "\n---< backtrace of Tk side >-------" if TkCore::WITH_ENCODING msg.force_encoding('utf-8') @@ -76,9 +76,9 @@ class TkVariable msg.instance_variable_set(:@encoding, 'utf-8') end rescue Exception - msg = e.class.inspect + ': ' + e.message + "\n" + - "\n---< backtrace of Ruby side >-----\n" + - e.backtrace.join("\n") + + msg = e.class.inspect + ': ' + e.message + "\n" + + "\n---< backtrace of Ruby side >-----\n" + + e.backtrace.join("\n") + "\n---< backtrace of Tk side >-------" end fail(e, msg) @@ -94,7 +94,7 @@ class TkVariable _get_eval_string(TkVar_CB_TBL[name1].trace_callback(name2,op)) rescue trace = $!.backtrace - raise $!, "\n#{trace[0]}: #{$!.message} (#{$!.class})\n" + + raise $!, "\n#{trace[0]}: #{$!.message} (#{$!.class})\n" + "\tfrom #{trace[1..pos].join("\n\tfrom ")}" end =end @@ -112,7 +112,7 @@ class TkVariable end # - # default_value is available only when the variable is an assoc array. + # default_value is available only when the variable is an assoc array. # def default_value(val=nil, &b) if b @@ -322,7 +322,7 @@ class TkVariable =begin if val == [] - # INTERP._eval(format('global %s; set %s(0) 0; unset %s(0)', + # INTERP._eval(format('global %s; set %s(0) 0; unset %s(0)', # @id, @id, @id)) elsif val.kind_of?(Array) a = [] @@ -370,7 +370,7 @@ class TkVariable else INTERP._thread_vwait(@id) end - else + else if check_root INTERP._invoke_without_enc('tkwait', 'variable', @id) else @@ -421,7 +421,7 @@ class TkVariable else # array index = elems.collect{|idx| _get_eval_string(idx, true)}.join(',') - TkComm.bool(tk_call('info', 'exist', "#{@id}")) && + TkComm.bool(tk_call('info', 'exist', "#{@id}")) && TkComm.bool(tk_call('info', 'exist', "#{@id}(#{index})")) end end @@ -433,7 +433,7 @@ class TkVariable #tk_split_simplelist(INTERP._eval("global #{@id}; array get #{@id}")) INTERP._invoke_without_enc('global', @id) #tk_split_simplelist(INTERP._fromUTF8(INTERP._invoke_without_enc('array', 'names', @id))) - tk_split_simplelist(INTERP._invoke_without_enc('array', 'names', @id), + tk_split_simplelist(INTERP._invoke_without_enc('array', 'names', @id), false, true) end @@ -484,9 +484,9 @@ if USE_TCLs_SET_VARIABLE_FUNCTIONS if val.kind_of?(Hash) self.clear val.each{|k, v| - #INTERP._set_global_var2(@id, _toUTF8(_get_eval_string(k)), + #INTERP._set_global_var2(@id, _toUTF8(_get_eval_string(k)), # _toUTF8(_get_eval_string(v))) - INTERP._set_global_var2(@id, _get_eval_string(k, true), + INTERP._set_global_var2(@id, _get_eval_string(k, true), _get_eval_string(v, true)) } self.value @@ -494,11 +494,11 @@ if USE_TCLs_SET_VARIABLE_FUNCTIONS =begin INTERP._set_global_var(@id, '') val.each{|v| - #INTERP._set_variable(@id, _toUTF8(_get_eval_string(v)), - INTERP._set_variable(@id, _get_eval_string(v, true), - TclTkLib::VarAccessFlag::GLOBAL_ONLY | + #INTERP._set_variable(@id, _toUTF8(_get_eval_string(v)), + INTERP._set_variable(@id, _get_eval_string(v, true), + TclTkLib::VarAccessFlag::GLOBAL_ONLY | TclTkLib::VarAccessFlag::LEAVE_ERR_MSG | - TclTkLib::VarAccessFlag::APPEND_VALUE | + TclTkLib::VarAccessFlag::APPEND_VALUE | TclTkLib::VarAccessFlag::LIST_ELEMENT) } self.value @@ -535,9 +535,9 @@ if USE_TCLs_SET_VARIABLE_FUNCTIONS val = val._value if !type && type != :variable && val.kind_of?(TkVariable) index = args.collect{|idx| _get_eval_string(idx, true)}.join(',') _fromUTF8(INTERP._set_global_var2(@id, index, _get_eval_string(val, true))) - #_fromUTF8(INTERP._set_global_var2(@id, _toUTF8(_get_eval_string(index)), + #_fromUTF8(INTERP._set_global_var2(@id, _toUTF8(_get_eval_string(index)), # _toUTF8(_get_eval_string(val)))) - #_fromUTF8(INTERP._set_global_var2(@id, _get_eval_string(index, true), + #_fromUTF8(INTERP._set_global_var2(@id, _get_eval_string(index, true), # _get_eval_string(val, true))) end @@ -562,7 +562,7 @@ else #INTERP._eval(Kernel.format('set %s', @id)) #INTERP._invoke_without_enc('set', @id) rescue - if INTERP._eval(Kernel.format('global %s; array exists %s', + if INTERP._eval(Kernel.format('global %s; array exists %s', @id, @id)) != "1" #if INTERP._eval(Kernel.format('array exists %s', @id)) != "1" #if INTERP._invoke_without_enc('array', 'exists', @id) != "1" @@ -583,7 +583,7 @@ else #INTERP._eval(Kernel.format('set %s %s', @id, s)) #_fromUTF8(INTERP._invoke_without_enc('set', @id, _toUTF8(s))) rescue - if INTERP._eval(Kernel.format('global %s; array exists %s', + if INTERP._eval(Kernel.format('global %s; array exists %s', @id, @id)) != "1" #if INTERP._eval(Kernel.format('array exists %s', @id)) != "1" #if INTERP._invoke_without_enc('array', 'exists', @id) != "1" @@ -591,7 +591,7 @@ else else if val == [] INTERP._eval(Kernel.format('global %s; unset %s; set %s(0) 0; unset %s(0)', @id, @id, @id, @id)) - #INTERP._eval(Kernel.format('unset %s; set %s(0) 0; unset %s(0)', + #INTERP._eval(Kernel.format('unset %s; set %s(0) 0; unset %s(0)', # @id, @id, @id)) #INTERP._invoke_without_enc('unset', @id) #INTERP._invoke_without_enc('set', @id+'(0)', 0) @@ -601,9 +601,9 @@ else val.each_with_index{|e,i| a.push(i); a.push(array2tk_list(e, true))} #s = '"' + a.join(" ").gsub(/[\[\]$"]/, '\\\\\&') + '"' s = '"' + a.join(" ").gsub(/[\[\]$"\\]/, '\\\\\&') + '"' - INTERP._eval(Kernel.format('global %s; unset %s; array set %s %s', + INTERP._eval(Kernel.format('global %s; unset %s; array set %s %s', @id, @id, @id, s)) - #INTERP._eval(Kernel.format('unset %s; array set %s %s', + #INTERP._eval(Kernel.format('unset %s; array set %s %s', # @id, @id, s)) #INTERP._invoke_without_enc('unset', @id) #_fromUTF8(INTERP._invoke_without_enc('array','set', @id, _toUTF8(s))) @@ -612,9 +612,9 @@ else # .gsub(/[\[\]$"]/, '\\\\\&') + '"' s = '"' + val.to_a.collect{|e| array2tk_list(e, true)}.join(" ")\ .gsub(/[\[\]$\\"]/, '\\\\\&') + '"' - INTERP._eval(Kernel.format('global %s; unset %s; array set %s %s', + INTERP._eval(Kernel.format('global %s; unset %s; array set %s %s', @id, @id, @id, s)) - #INTERP._eval(Kernel.format('unset %s; array set %s %s', + #INTERP._eval(Kernel.format('unset %s; array set %s %s', # @id, @id, s)) #INTERP._invoke_without_enc('unset', @id) #_fromUTF8(INTERP._invoke_without_enc('array','set', @id, _toUTF8(s))) @@ -640,7 +640,7 @@ else end end #INTERP._eval(Kernel.format('global %s; set %s(%s)', @id, @id, index)) - #INTERP._eval(Kernel.format('global %s; set %s(%s)', + #INTERP._eval(Kernel.format('global %s; set %s(%s)', # @id, @id, _get_eval_string(index))) #INTERP._eval(Kernel.format('set %s(%s)', @id, _get_eval_string(index))) #INTERP._eval('set ' + @id + '(' + _get_eval_string(index) + ')') @@ -651,13 +651,13 @@ else type = default_element_value_type(args) val = val._value if !type && type != :variable && val.kind_of?(TkVariable) index = args.collect{|idx| _get_eval_string(idx)}.join(',') - INTERP._eval(Kernel.format('global %s; set %s(%s) %s', @id, @id, + INTERP._eval(Kernel.format('global %s; set %s(%s) %s', @id, @id, index, _get_eval_string(val))) - #INTERP._eval(Kernel.format('global %s; set %s(%s) %s', @id, @id, + #INTERP._eval(Kernel.format('global %s; set %s(%s) %s', @id, @id, # _get_eval_string(index), _get_eval_string(val))) - #INTERP._eval(Kernel.format('set %s(%s) %s', @id, + #INTERP._eval(Kernel.format('set %s(%s) %s', @id, # _get_eval_string(index), _get_eval_string(val))) - #INTERP._eval('set ' + @id + '(' + _get_eval_string(index) + ') ' + + #INTERP._eval('set ' + @id + '(' + _get_eval_string(index) + ') ' + # _get_eval_string(val)) end @@ -669,7 +669,7 @@ else else index = elems.collect{|idx| _get_eval_string(idx, true)}.join(',') INTERP._eval(Kernel.format('global %s; unset %s(%s)', @id, @id, index)) - #INTERP._eval(Kernel.format('global %s; unset %s(%s)', + #INTERP._eval(Kernel.format('global %s; unset %s(%s)', # @id, @id, _get_eval_string(elem))) #INTERP._eval(Kernel.format('unset %s(%s)', @id, tk_tcl2ruby(elem))) #INTERP._eval('unset ' + @id + '(' + _get_eval_string(elem) + ')') @@ -1348,10 +1348,10 @@ end TkVar_CB_TBL[@id] = self @trace_opts = opts if USE_OLD_TRACE_OPTION_STYLE - Tk.tk_call_without_enc('trace', 'variable', + Tk.tk_call_without_enc('trace', 'variable', @id, @trace_opts, 'rb_var ' << @id) else - Tk.tk_call_without_enc('trace', 'add', 'variable', + Tk.tk_call_without_enc('trace', 'add', 'variable', @id, @trace_opts, 'rb_var ' << @id) end else @@ -1359,19 +1359,19 @@ end if USE_OLD_TRACE_OPTION_STYLE opts.each_byte{|c| newopts.concat(c.chr) unless newopts.index(c.chr)} if newopts != @trace_opts - Tk.tk_call_without_enc('trace', 'vdelete', + Tk.tk_call_without_enc('trace', 'vdelete', @id, @trace_opts, 'rb_var ' << @id) @trace_opts.replace(newopts) - Tk.tk_call_without_enc('trace', 'variable', + Tk.tk_call_without_enc('trace', 'variable', @id, @trace_opts, 'rb_var ' << @id) end else newopts |= opts unless (newopts - @trace_opts).empty? - Tk.tk_call_without_enc('trace', 'remove', 'variable', + Tk.tk_call_without_enc('trace', 'remove', 'variable', @id, @trace_opts, 'rb_var ' << @id) @trace_opts.replace(newopts) - Tk.tk_call_without_enc('trace', 'add', 'variable', + Tk.tk_call_without_enc('trace', 'add', 'variable', @id, @trace_opts, 'rb_var ' << @id) end end @@ -1382,7 +1382,7 @@ end def trace_element(elem, opts, cmd = Proc.new) if @elem - fail(RuntimeError, + fail(RuntimeError, "invalid for a TkVariable which denotes an element of Tcl's array") end @@ -1394,10 +1394,10 @@ end TkVar_CB_TBL[@id] = self @trace_opts = opts if USE_OLD_TRACE_OPTION_STYLE - Tk.tk_call_without_enc('trace', 'add', 'variable', + Tk.tk_call_without_enc('trace', 'add', 'variable', @id, @trace_opts, 'rb_var ' << @id) else - Tk.tk_call_without_enc('trace', 'variable', + Tk.tk_call_without_enc('trace', 'variable', @id, @trace_opts, 'rb_var ' << @id) end else @@ -1405,19 +1405,19 @@ end if USE_OLD_TRACE_OPTION_STYLE opts.each_byte{|c| newopts.concat(c.chr) unless newopts.index(c.chr)} if newopts != @trace_opts - Tk.tk_call_without_enc('trace', 'vdelete', + Tk.tk_call_without_enc('trace', 'vdelete', @id, @trace_opts, 'rb_var ' << @id) @trace_opts.replace(newopts) - Tk.tk_call_without_enc('trace', 'variable', + Tk.tk_call_without_enc('trace', 'variable', @id, @trace_opts, 'rb_var ' << @id) end else newopts |= opts unless (newopts - @trace_opts).empty? - Tk.tk_call_without_enc('trace', 'remove', 'variable', + Tk.tk_call_without_enc('trace', 'remove', 'variable', @id, @trace_opts, 'rb_var ' << @id) @trace_opts.replace(newopts) - Tk.tk_call_without_enc('trace', 'add', 'variable', + Tk.tk_call_without_enc('trace', 'add', 'variable', @id, @trace_opts, 'rb_var ' << @id) end end @@ -1434,7 +1434,7 @@ end def trace_info_for_element(elem) if @elem - fail(RuntimeError, + fail(RuntimeError, "invalid for a TkVariable which denotes an element of Tcl's array") end return [] unless @trace_elem @@ -1468,7 +1468,7 @@ end else newopts = [] @trace_var.each_with_index{|e, i| - if idx < 0 && e[1] == cmd && + if idx < 0 && e[1] == cmd && e[0].size == opts.size && (e[0] - opts).empty? # find idx = i @@ -1479,7 +1479,7 @@ end end if idx >= 0 - @trace_var.delete_at(idx) + @trace_var.delete_at(idx) else return self end @@ -1498,21 +1498,21 @@ end diff = false @trace_opts.each_byte{|c| break if (diff = ! newopts.index(c))} if diff - Tk.tk_call_without_enc('trace', 'vdelete', + Tk.tk_call_without_enc('trace', 'vdelete', @id, @trace_opts, 'rb_var ' << @id) @trace_opts.replace(newopts) unless @trace_opts.empty? - Tk.tk_call_without_enc('trace', 'variable', + Tk.tk_call_without_enc('trace', 'variable', @id, @trace_opts, 'rb_var ' << @id) end end else unless (@trace_opts - newopts).empty? - Tk.tk_call_without_enc('trace', 'remove', 'variable', + Tk.tk_call_without_enc('trace', 'remove', 'variable', @id, @trace_opts, 'rb_var ' << @id) @trace_opts.replace(newopts) unless @trace_opts.empty? - Tk.tk_call_without_enc('trace', 'add', 'variable', + Tk.tk_call_without_enc('trace', 'add', 'variable', @id, @trace_opts, 'rb_var ' << @id) end end @@ -1525,7 +1525,7 @@ end def trace_remove_for_element(elem,opts,cmd) if @elem - fail(RuntimeError, + fail(RuntimeError, "invalid for a TkVariable which denotes an element of Tcl's array") end return self unless @trace_elem.kind_of? Hash @@ -1550,7 +1550,7 @@ end } else @trace_elem[elem].each_with_index{|e, i| - if idx < 0 && e[1] == cmd && + if idx < 0 && e[1] == cmd && e[0].size == opts.size && (e[0] - opts).empty? # find idx = i @@ -1567,7 +1567,7 @@ end if USE_OLD_TRACE_OPTION_STYLE newopts = '' - @trace_var.each{|e| + @trace_var.each{|e| e[0].each_byte{|c| newopts.concat(c.chr) unless newopts.index(c.chr)} } @trace_elem.each{|elem| @@ -1591,21 +1591,21 @@ end diff = false @trace_opts.each_byte{|c| break if (diff = ! newopts.index(c))} if diff - Tk.tk_call_without_enc('trace', 'vdelete', + Tk.tk_call_without_enc('trace', 'vdelete', @id, @trace_opts, 'rb_var ' << @id) @trace_opts.replace(newopts) unless @trace_opts.empty? - Tk.tk_call_without_enc('trace', 'variable', + Tk.tk_call_without_enc('trace', 'variable', @id, @trace_opts, 'rb_var ' << @id) end end else unless (@trace_opts - newopts).empty? - Tk.tk_call_without_enc('trace', 'remove', 'variable', + Tk.tk_call_without_enc('trace', 'remove', 'variable', @id, @trace_opts, 'rb_var ' << @id) @trace_opts.replace(newopts) unless @trace_opts.empty? - Tk.tk_call_without_enc('trace', 'add', 'variable', + Tk.tk_call_without_enc('trace', 'add', 'variable', @id, @trace_opts, 'rb_var ' << @id) end end @@ -1621,7 +1621,7 @@ class TkVarAccess<TkVariable def self.new(name, *args) if name.kind_of?(TkVariable) name.value = args[0] unless args.empty? - return name + return name end name = name.to_s @@ -1649,7 +1649,7 @@ class TkVarAccess<TkVariable fail ArgumentError, "already exist as a scalar variable" end name.value = args[0] unless args.empty? - return name + return name end name = name.to_s diff --git a/ext/tk/lib/tk/virtevent.rb b/ext/tk/lib/tk/virtevent.rb index ae31ac1f8f..ba771da647 100644 --- a/ext/tk/lib/tk/virtevent.rb +++ b/ext/tk/lib/tk/virtevent.rb @@ -80,8 +80,8 @@ class TkVirtualEvent<TkObject def _add_sequences(seq_ary) unless seq_ary.empty? - tk_call_without_enc('event', 'add', "<#{@id}>", - *(seq_ary.collect{|seq| + tk_call_without_enc('event', 'add', "<#{@id}>", + *(seq_ary.collect{|seq| "<#{tk_event_sequence(seq)}>" }) ) end @@ -106,8 +106,8 @@ class TkVirtualEvent<TkObject TkVirtualEventTBL.delete(@id) } else - tk_call_without_enc('event', 'delete', "<#{@id}>", - *(sequences.collect{|seq| + tk_call_without_enc('event', 'delete', "<#{@id}>", + *(sequences.collect{|seq| "<#{tk_event_sequence(seq)}>" }) ) if tk_call_without_enc('event','info',"<#{@id}>").empty? diff --git a/ext/tk/lib/tk/winfo.rb b/ext/tk/lib/tk/winfo.rb index c649b4a0c9..b10cfe6760 100644 --- a/ext/tk/lib/tk/winfo.rb +++ b/ext/tk/lib/tk/winfo.rb @@ -14,7 +14,7 @@ module TkWinfo def TkWinfo.atom(name, win=nil) if win - number(tk_call_without_enc('winfo', 'atom', '-displayof', win, + number(tk_call_without_enc('winfo', 'atom', '-displayof', win, _get_eval_enc_str(name))) else number(tk_call_without_enc('winfo', 'atom', _get_eval_enc_str(name))) @@ -26,7 +26,7 @@ module TkWinfo def TkWinfo.atomname(id, win=nil) if win - _fromUTF8(tk_call_without_enc('winfo', 'atomname', + _fromUTF8(tk_call_without_enc('winfo', 'atomname', '-displayof', win, id)) else _fromUTF8(tk_call_without_enc('winfo', 'atomname', id)) @@ -67,7 +67,7 @@ module TkWinfo def TkWinfo.containing(rootX, rootY, win=nil) if win - window(tk_call_without_enc('winfo', 'containing', + window(tk_call_without_enc('winfo', 'containing', '-displayof', win, rootX, rootY)) else window(tk_call_without_enc('winfo', 'containing', rootX, rootY)) @@ -128,7 +128,7 @@ module TkWinfo false, true) else #tk_split_simplelist(tk_call_without_enc('winfo', 'interps')) - tk_split_simplelist(tk_call_without_enc('winfo', 'interps'), + tk_split_simplelist(tk_call_without_enc('winfo', 'interps'), false, true) end end @@ -303,7 +303,7 @@ module TkWinfo def TkWinfo.visualsavailable(win, includeids=false) if includeids - list(tk_call_without_enc('winfo', 'visualsavailable', + list(tk_call_without_enc('winfo', 'visualsavailable', win, "includeids")) else list(tk_call_without_enc('winfo', 'visualsavailable', win)) diff --git a/ext/tk/lib/tk/winpkg.rb b/ext/tk/lib/tk/winpkg.rb index 89fb391c77..a131731560 100644 --- a/ext/tk/lib/tk/winpkg.rb +++ b/ext/tk/lib/tk/winpkg.rb @@ -45,7 +45,7 @@ module Tk::WinDDE elsif args.size == 0 tk_call('dde', 'servername', force, exact, *hash_kv(keys)) else - tk_call('dde', 'servername', force, exact, + tk_call('dde', 'servername', force, exact, *((hash_kv(keys) << '--') + args)) end else @@ -86,7 +86,7 @@ module Tk::WinDDE tk_call('dde', 'eval', -async, topic, cmd, *args) end - module_function :servername, :execute, :async_execute, + module_function :servername, :execute, :async_execute, :poke, :request, :services, :eval end diff --git a/ext/tk/lib/tk/wm.rb b/ext/tk/lib/tk/wm.rb index 0394296189..b1a2ed886a 100644 --- a/ext/tk/lib/tk/wm.rb +++ b/ext/tk/lib/tk/wm.rb @@ -123,7 +123,7 @@ module Tk TOPLEVEL_METHODCALL_OPTKEYS['focusmodel'] = 'focusmodel' def Wm.forget(win) - # Tcl/Tk 8.5+ + # Tcl/Tk 8.5+ # work with dockable frames tk_call_without_enc('wm', 'forget', win.epath) win @@ -200,7 +200,7 @@ module Tk if imgs.empty? win.instance_eval{ @wm_iconphoto = nil unless defined? @wm_iconphoto - return @wm_iconphoto + return @wm_iconphoto } end @@ -308,10 +308,10 @@ module Tk def Wm.manage(win, use_id = nil) # Tcl/Tk 8.5+ feature # -------------------------------------------------------------- - # In the future release, I want to support to embed the 'win' + # In the future release, I want to support to embed the 'win' # into the container which has window-id 'use-id'. - # It may give users frexibility on controlling their GUI. - # However, it may be difficult for current Tcl/Tk (Tcl/Tk8.5.1), + # It may give users frexibility on controlling their GUI. + # However, it may be difficult for current Tcl/Tk (Tcl/Tk8.5.1), # because it seems to require to modify Tcl/Tk's source code. # -------------------------------------------------------------- if use_id diff --git a/ext/tk/lib/tk/xim.rb b/ext/tk/lib/tk/xim.rb index 0ac8559bb9..c0126c5175 100644 --- a/ext/tk/lib/tk/xim.rb +++ b/ext/tk/lib/tk/xim.rb @@ -12,14 +12,14 @@ module TkXIM def TkXIM.useinputmethods(value = None, win = nil) if value == None if win - bool(tk_call_without_enc('tk', 'useinputmethods', + bool(tk_call_without_enc('tk', 'useinputmethods', '-displayof', win)) else bool(tk_call_without_enc('tk', 'useinputmethods')) end else if win - bool(tk_call_without_enc('tk', 'useinputmethods', + bool(tk_call_without_enc('tk', 'useinputmethods', '-displayof', win, value)) else bool(tk_call_without_enc('tk', 'useinputmethods', value)) |