diff --git a/lib/multi-tk.rb b/lib/multi-tk.rb index d291c926..e1f261f2 100644 --- a/lib/multi-tk.rb +++ b/lib/multi-tk.rb @@ -3519,4 +3519,4 @@ class MultiTkIp module TkCore INTERP = MultiTkIp end -require 'tk' +require 'tk' unless defined?(Tk) diff --git a/lib/thread_tk.rb b/lib/thread_tk.rb index 69ed9386..54b75ae6 100644 --- a/lib/thread_tk.rb +++ b/lib/thread_tk.rb @@ -10,4 +10,4 @@ end module TkCore; RUN_EVENTLOOP_ON_MAIN_THREAD = false; end -require 'tk' +require 'tk' unless defined?(Tk) diff --git a/lib/tk.rb b/lib/tk.rb index 77704931..1d84d93f 100644 --- a/lib/tk.rb +++ b/lib/tk.rb @@ -1317,8 +1317,10 @@ def @tk_cmd_tbl.[]=(idx,val) @add_tk_procs = [] # table of [name, args, body] @force_default_encoding ||= [false] - @encoding ||= [nil] - def @encoding.to_s; self.join(nil); end + unless @encoding + @encoding = [nil] + def @encoding.to_s; self.join(nil); end + end @cb_entry_class = Class.new(TkCallbackEntry){ class << self diff --git a/lib/tk/bgerror.rb b/lib/tk/bgerror.rb index 7b4f625e..f5629ba8 100644 --- a/lib/tk/bgerror.rb +++ b/lib/tk/bgerror.rb @@ -3,7 +3,7 @@ # tkbgerror -- bgerror ( tkerror ) module # 1998/07/16 by Hidetoshi Nagai # -require 'tk' +require 'tk' unless defined?(Tk) module TkBgError extend Tk diff --git a/lib/tk/bindtag.rb b/lib/tk/bindtag.rb index 71b80395..3789eaa0 100644 --- a/lib/tk/bindtag.rb +++ b/lib/tk/bindtag.rb @@ -2,7 +2,7 @@ # # tk/bind.rb : control event binding # -require 'tk' +require 'tk' unless defined?(Tk) class TkBindTag include TkBindCore diff --git a/lib/tk/busy.rb b/lib/tk/busy.rb index 18ebede9..a5c7c863 100644 --- a/lib/tk/busy.rb +++ b/lib/tk/busy.rb @@ -2,7 +2,7 @@ # # tk/busy.rb: support 'tk busy' command (Tcl/Tk8.6 or later) # -require 'tk' +require 'tk' unless defined?(Tk) module Tk::Busy include TkCore diff --git a/lib/tk/button.rb b/lib/tk/button.rb index dc252d8e..7a800d52 100644 --- a/lib/tk/button.rb +++ b/lib/tk/button.rb @@ -2,7 +2,7 @@ # # tk/button.rb : treat button widget # -require 'tk' +require 'tk' unless defined?(Tk) require 'tk/label' class Tk::Button # -require 'tk' +require 'tk' unless defined?(Tk) require 'tk/canvastag' require 'tk/itemconfig' require 'tk/scrollable' diff --git a/lib/tk/canvastag.rb b/lib/tk/canvastag.rb index 9aede092..6f777de1 100644 --- a/lib/tk/canvastag.rb +++ b/lib/tk/canvastag.rb @@ -2,7 +2,7 @@ # # tk/canvastag.rb - methods for treating canvas tags # -require 'tk' +require 'tk' unless defined?(Tk) require 'tk/tagfont' module TkcTagAccess diff --git a/lib/tk/checkbutton.rb b/lib/tk/checkbutton.rb index 521b015b..5848714e 100644 --- a/lib/tk/checkbutton.rb +++ b/lib/tk/checkbutton.rb @@ -2,7 +2,7 @@ # # tk/checkbutton.rb : treat checkbutton widget # -require 'tk' +require 'tk' unless defined?(Tk) require 'tk/radiobutton' class Tk::CheckButton -require 'tk' +require 'tk' unless defined?(Tk) require 'tk/label' require 'tk/scrollable' require 'tk/validation' diff --git a/lib/tk/font.rb b/lib/tk/font.rb index 3c4475d1..c76481cb 100644 --- a/lib/tk/font.rb +++ b/lib/tk/font.rb @@ -4,7 +4,7 @@ # # by Hidetoshi NAGAI (nagai@ai.kyutech.ac.jp) # -require 'tk' +require 'tk' unless defined?(Tk) class TkFont include Tk diff --git a/lib/tk/fontchooser.rb b/lib/tk/fontchooser.rb index fb220da2..01212260 100644 --- a/lib/tk/fontchooser.rb +++ b/lib/tk/fontchooser.rb @@ -2,7 +2,7 @@ # # tk/fontchooser.rb -- "tk fontchooser" support (Tcl/Tk8.6 or later) # -require 'tk' +require 'tk' unless defined?(Tk) require 'tk/font' module TkFont::Chooser diff --git a/lib/tk/frame.rb b/lib/tk/frame.rb index 0682faf3..dbac6e7f 100644 --- a/lib/tk/frame.rb +++ b/lib/tk/frame.rb @@ -2,7 +2,7 @@ # # tk/frame.rb : treat frame widget # -require 'tk' +require 'tk' unless defined?(Tk) class Tk::Frame # -require 'tk' +require 'tk' unless defined?(Tk) module TkManageFocus extend Tk diff --git a/lib/tk/msgcat.rb b/lib/tk/msgcat.rb index 486941d2..29c1dcea 100644 --- a/lib/tk/msgcat.rb +++ b/lib/tk/msgcat.rb @@ -3,7 +3,7 @@ # tk/msgcat.rb : methods for Tcl message catalog # by Hidetoshi Nagai # -require 'tk' +require 'tk' unless defined?(Tk) #class TkMsgCatalog class TkMsgCatalog < TkObject diff --git a/lib/tk/namespace.rb b/lib/tk/namespace.rb index aa09fb36..313a0799 100644 --- a/lib/tk/namespace.rb +++ b/lib/tk/namespace.rb @@ -3,7 +3,7 @@ # tk/namespace.rb : methods to manipulate Tcl/Tk namespace # by Hidetoshi Nagai # -require 'tk' +require 'tk' unless defined?(Tk) class TkNamespace < TkObject extend Tk diff --git a/lib/tk/optiondb.rb b/lib/tk/optiondb.rb index 34d49aae..d8e66c5a 100644 --- a/lib/tk/optiondb.rb +++ b/lib/tk/optiondb.rb @@ -2,7 +2,7 @@ # # tk/optiondb.rb : treat option database # -require 'tk' +require 'tk' unless defined?(Tk) module TkOptionDB include Tk diff --git a/lib/tk/optionobj.rb b/lib/tk/optionobj.rb index 28f957fa..a258248b 100644 --- a/lib/tk/optionobj.rb +++ b/lib/tk/optionobj.rb @@ -8,7 +8,7 @@ # e.g. hash_kv({'aaa'=>1, 'bbb'=>Tk::None, 'ccc'=>3}) # => ["-aaa", 1, "-bbb", "-ccc", 3] # -require 'tk' +require 'tk' unless defined?(Tk) module Tk class OptionObj < Hash diff --git a/lib/tk/pack.rb b/lib/tk/pack.rb index 45926d40..9aad2b05 100644 --- a/lib/tk/pack.rb +++ b/lib/tk/pack.rb @@ -2,7 +2,7 @@ # # tk/pack.rb : control pack geometry manager # -require 'tk' +require 'tk' unless defined?(Tk) module TkPack include Tk diff --git a/lib/tk/package.rb b/lib/tk/package.rb index fe6939c2..4ded5c96 100644 --- a/lib/tk/package.rb +++ b/lib/tk/package.rb @@ -2,7 +2,7 @@ # # tk/package.rb : package command # -require 'tk' +require 'tk' unless defined?(Tk) module TkPackage include TkCore diff --git a/lib/tk/palette.rb b/lib/tk/palette.rb index e118e8db..a8b560f7 100644 --- a/lib/tk/palette.rb +++ b/lib/tk/palette.rb @@ -3,7 +3,7 @@ # tk/palette.rb : methods for Tcl/Tk standard library 'palette.tcl' # 1998/06/21 by Hidetoshi Nagai # -require 'tk' +require 'tk' unless defined?(Tk) module TkPalette include Tk diff --git a/lib/tk/panedwindow.rb b/lib/tk/panedwindow.rb index 285292f0..a8693856 100644 --- a/lib/tk/panedwindow.rb +++ b/lib/tk/panedwindow.rb @@ -2,7 +2,7 @@ # # tk/panedwindow.rb : treat panedwindow # -require 'tk' +require 'tk' unless defined?(Tk) class Tk::PanedWindow # -require 'tk' +require 'tk' unless defined?(Tk) require 'tk/listbox' class TkScrollbox # -require 'tk' +require 'tk' unless defined?(Tk) require 'tk/entry' class Tk::Spinbox -require 'tk' +require 'tk' unless defined?(Tk) require 'tk/itemfont' require 'tk/itemconfig' require 'tk/scrollable' diff --git a/lib/tk/textimage.rb b/lib/tk/textimage.rb index f7329c5d..a4b959e0 100644 --- a/lib/tk/textimage.rb +++ b/lib/tk/textimage.rb @@ -2,7 +2,7 @@ # # tk/textimage.rb - treat Tk text image object # -require 'tk' +require 'tk' unless defined?(Tk) require 'tk/text' class TkTextImage # -require 'tk' +require 'tk' unless defined?(Tk) class TkVirtualEvent/tkextlib/vu.rb diff --git a/lib/tkextlib/vu/dial.rb b/lib/tkextlib/vu/dial.rb index 7eb5650d..2bd12442 100644 --- a/lib/tkextlib/vu/dial.rb +++ b/lib/tkextlib/vu/dial.rb @@ -3,7 +3,7 @@ # ::vu::dial widget # by Hidetoshi NAGAI (nagai@ai.kyutech.ac.jp) # -require 'tk' +require 'tk' unless defined?(Tk) # create module/class module Tk diff --git a/lib/tkextlib/vu/pie.rb b/lib/tkextlib/vu/pie.rb index f7e9cf54..7f3b7248 100644 --- a/lib/tkextlib/vu/pie.rb +++ b/lib/tkextlib/vu/pie.rb @@ -3,7 +3,7 @@ # ::vu::pie widget # by Hidetoshi NAGAI (nagai@ai.kyutech.ac.jp) # -require 'tk' +require 'tk' unless defined?(Tk) # create module/class module Tk diff --git a/lib/tkextlib/vu/spinbox.rb b/lib/tkextlib/vu/spinbox.rb index 082ebd1f..37b16f3c 100644 --- a/lib/tkextlib/vu/spinbox.rb +++ b/lib/tkextlib/vu/spinbox.rb @@ -6,7 +6,7 @@ # a standard spinbox (<= 8.3) # This is the same as the 8.4 core spinbox widget. # -require 'tk' +require 'tk' unless defined?(Tk) if (Tk::TK_MAJOR_VERSION < 8 || (Tk::TK_MAJOR_VERSION == 8 && Tk::TK_MINOR_VERSION < 4)) diff --git a/lib/tkextlib/winico.rb b/lib/tkextlib/winico.rb index 996fc409..e908d466 100644 --- a/lib/tkextlib/winico.rb +++ b/lib/tkextlib/winico.rb @@ -3,7 +3,7 @@ # winico -- Windows Icon extension support # by Hidetoshi NAGAI (nagai@ai.kyutech.ac.jp) # -require 'tk' +require 'tk' unless defined?(Tk) # call setup script for general 'tkextlib' libraries require 'tkextlib/setup.rb' diff --git a/lib/tkextlib/winico/winico.rb b/lib/tkextlib/winico/winico.rb index dda0357a..62eccc7c 100644 --- a/lib/tkextlib/winico/winico.rb +++ b/lib/tkextlib/winico/winico.rb @@ -4,7 +4,7 @@ # by Hidetoshi NAGAI (nagai@ai.kyutech.ac.jp) # -require 'tk' +require 'tk' unless defined?(Tk) # call setup script for general 'tkextlib' libraries require 'tkextlib/setup.rb'