summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ext/tcltklib/demo/lines3.rb54
-rw-r--r--ext/tcltklib/demo/lines4.rb54
-rw-r--r--ext/tk/README.fork29
-rw-r--r--ext/tk/lib/tk/after.rb6
-rw-r--r--ext/tk/lib/tk/autoload.rb181
-rw-r--r--ext/tk/lib/tk/bgerror.rb29
-rw-r--r--ext/tk/lib/tk/bindtag.rb78
-rw-r--r--ext/tk/lib/tk/button.rb27
-rw-r--r--ext/tk/lib/tk/canvas.rb697
-rw-r--r--ext/tk/lib/tk/canvastag.rb337
-rw-r--r--ext/tk/lib/tk/checkbutton.rb25
-rw-r--r--ext/tk/lib/tk/clipboard.rb75
-rw-r--r--ext/tk/lib/tk/clock.rb57
-rw-r--r--ext/tk/lib/tk/composite.rb64
-rw-r--r--ext/tk/lib/tk/console.rb29
-rw-r--r--ext/tk/lib/tk/dialog.rb290
-rw-r--r--ext/tk/lib/tk/encodedstr.rb107
-rw-r--r--ext/tk/lib/tk/entry.rb114
-rw-r--r--ext/tk/lib/tk/event.rb142
-rw-r--r--ext/tk/lib/tk/font.rb1407
-rw-r--r--ext/tk/lib/tk/frame.rb123
-rw-r--r--ext/tk/lib/tk/grid.rb182
-rw-r--r--ext/tk/lib/tk/image.rb185
-rw-r--r--ext/tk/lib/tk/itemfont.rb185
-rw-r--r--ext/tk/lib/tk/kinput.rb71
-rw-r--r--ext/tk/lib/tk/label.rb22
-rw-r--r--ext/tk/lib/tk/labelframe.rb20
-rw-r--r--ext/tk/lib/tk/listbox.rb252
-rw-r--r--ext/tk/lib/tk/macpkg.rb68
-rw-r--r--ext/tk/lib/tk/menu.rb460
-rw-r--r--ext/tk/lib/tk/menubar.rb144
-rw-r--r--ext/tk/lib/tk/message.rb19
-rw-r--r--ext/tk/lib/tk/mngfocus.rb33
-rw-r--r--ext/tk/lib/tk/msgcat.rb268
-rw-r--r--ext/tk/lib/tk/namespace.rb293
-rw-r--r--ext/tk/lib/tk/optiondb.rb297
-rw-r--r--ext/tk/lib/tk/pack.rb89
-rw-r--r--ext/tk/lib/tk/package.rb61
-rw-r--r--ext/tk/lib/tk/palette.rb54
-rw-r--r--ext/tk/lib/tk/panedwindow.rb204
-rw-r--r--ext/tk/lib/tk/place.rb110
-rw-r--r--ext/tk/lib/tk/radiobutton.rb32
-rw-r--r--ext/tk/lib/tk/root.rb65
-rw-r--r--ext/tk/lib/tk/scale.rb78
-rw-r--r--ext/tk/lib/tk/scrollable.rb49
-rw-r--r--ext/tk/lib/tk/scrollbar.rb105
-rw-r--r--ext/tk/lib/tk/scrollbox.rb31
-rw-r--r--ext/tk/lib/tk/selection.rb86
-rw-r--r--ext/tk/lib/tk/spinbox.rb39
-rw-r--r--ext/tk/lib/tk/tagfont.rb43
-rw-r--r--ext/tk/lib/tk/text.rb1179
-rw-r--r--ext/tk/lib/tk/textimage.rb72
-rw-r--r--ext/tk/lib/tk/textmark.rb126
-rw-r--r--ext/tk/lib/tk/texttag.rb239
-rw-r--r--ext/tk/lib/tk/textwindow.rb137
-rw-r--r--ext/tk/lib/tk/timer.rb441
-rw-r--r--ext/tk/lib/tk/toplevel.rb211
-rw-r--r--ext/tk/lib/tk/txtwin_abst.rb38
-rw-r--r--ext/tk/lib/tk/validation.rb166
-rw-r--r--ext/tk/lib/tk/variable.rb847
-rw-r--r--ext/tk/lib/tk/virtevent.rb89
-rw-r--r--ext/tk/lib/tk/winfo.rb384
-rw-r--r--ext/tk/lib/tk/winpkg.rb136
-rw-r--r--ext/tk/lib/tk/wm.rb247
-rw-r--r--ext/tk/lib/tk/xim.rb122
-rw-r--r--ext/tk/sample/binding_sample.rb87
-rw-r--r--ext/tk/sample/bindtag_sample.rb127
-rw-r--r--ext/tk/sample/binstr_usage.rb39
-rw-r--r--ext/tk/sample/btn_with_frame.rb20
-rw-r--r--ext/tk/sample/demos-en/README.1st18
-rw-r--r--ext/tk/sample/demos-en/check2.rb107
-rw-r--r--ext/tk/sample/demos-en/floor2.rb1720
-rw-r--r--ext/tk/sample/demos-en/radio3.rb114
-rw-r--r--ext/tk/sample/demos-en/twind2.rb382
-rw-r--r--ext/tk/sample/demos-jp/README.1st20
-rw-r--r--ext/tk/sample/demos-jp/check2.rb107
-rw-r--r--ext/tk/sample/demos-jp/floor2.rb1716
-rw-r--r--ext/tk/sample/demos-jp/radio3.rb114
-rw-r--r--ext/tk/sample/demos-jp/twind2.rb381
-rw-r--r--ext/tk/sample/encstr_usage.rb29
-rw-r--r--ext/tk/sample/images/earth.gifbin0 -> 51712 bytes
-rw-r--r--ext/tk/sample/images/earthris.gifbin0 -> 6343 bytes
-rw-r--r--ext/tk/sample/images/face.xbm173
-rw-r--r--ext/tk/sample/images/flagdown.xbm27
-rw-r--r--ext/tk/sample/images/flagup.xbm27
-rw-r--r--ext/tk/sample/images/gray25.xbm6
-rw-r--r--ext/tk/sample/images/grey.256
-rw-r--r--ext/tk/sample/images/grey.56
-rw-r--r--ext/tk/sample/images/letters.xbm27
-rw-r--r--ext/tk/sample/images/noletter.xbm27
-rw-r--r--ext/tk/sample/images/pattern.xbm6
-rw-r--r--ext/tk/sample/images/tcllogo.gifbin0 -> 2341 bytes
-rw-r--r--ext/tk/sample/images/teapot.ppm56
-rw-r--r--ext/tk/sample/iso2022-kr.txt2
-rw-r--r--ext/tk/sample/msgs_rb/README3
-rw-r--r--ext/tk/sample/msgs_rb/cs.msg84
-rw-r--r--ext/tk/sample/msgs_rb/de.msg88
-rw-r--r--ext/tk/sample/msgs_rb/el.msg98
-rw-r--r--ext/tk/sample/msgs_rb/en.msg83
-rw-r--r--ext/tk/sample/msgs_rb/en_gb.msg7
-rw-r--r--ext/tk/sample/msgs_rb/eo.msg87
-rw-r--r--ext/tk/sample/msgs_rb/es.msg84
-rw-r--r--ext/tk/sample/msgs_rb/fr.msg84
-rw-r--r--ext/tk/sample/msgs_rb/it.msg84
-rw-r--r--ext/tk/sample/msgs_rb/ja.msg13
-rw-r--r--ext/tk/sample/msgs_rb/nl.msg123
-rw-r--r--ext/tk/sample/msgs_rb/pl.msg87
-rw-r--r--ext/tk/sample/msgs_rb/ru.msg87
-rw-r--r--ext/tk/sample/msgs_rb2/README5
-rw-r--r--ext/tk/sample/msgs_rb2/de.msg88
-rw-r--r--ext/tk/sample/msgs_rb2/ja.msg85
-rw-r--r--ext/tk/sample/msgs_tk/README4
-rw-r--r--ext/tk/sample/msgs_tk/cs.msg84
-rw-r--r--ext/tk/sample/msgs_tk/de.msg88
-rw-r--r--ext/tk/sample/msgs_tk/el.msg103
-rw-r--r--ext/tk/sample/msgs_tk/en.msg83
-rw-r--r--ext/tk/sample/msgs_tk/en_gb.msg7
-rw-r--r--ext/tk/sample/msgs_tk/eo.msg87
-rw-r--r--ext/tk/sample/msgs_tk/es.msg84
-rw-r--r--ext/tk/sample/msgs_tk/fr.msg84
-rw-r--r--ext/tk/sample/msgs_tk/it.msg84
-rw-r--r--ext/tk/sample/msgs_tk/ja.msg13
-rw-r--r--ext/tk/sample/msgs_tk/license.terms39
-rw-r--r--ext/tk/sample/msgs_tk/nl.msg123
-rw-r--r--ext/tk/sample/msgs_tk/pl.msg87
-rw-r--r--ext/tk/sample/msgs_tk/ru.msg87
-rw-r--r--ext/tk/sample/propagate.rb30
-rw-r--r--ext/tk/sample/tkmsgcat-load_rb.rb102
-rw-r--r--ext/tk/sample/tkmsgcat-load_rb2.rb102
-rw-r--r--ext/tk/sample/tkmsgcat-load_tk.rb118
-rw-r--r--lib/rss/1.0.rb638
-rw-r--r--lib/rss/dublincore.rb62
-rw-r--r--lib/rss/parser.rb380
-rw-r--r--lib/rss/rss.rb634
-rw-r--r--lib/rss/xmlparser.rb91
-rw-r--r--sample/rss/list_description.rb84
-rw-r--r--sample/rss/rss_recent.rb83
-rw-r--r--test/rss/test_parser.rb470
138 files changed, 22289 insertions, 0 deletions
diff --git a/ext/tcltklib/demo/lines3.rb b/ext/tcltklib/demo/lines3.rb
new file mode 100644
index 0000000000..caa50f92e7
--- /dev/null
+++ b/ext/tcltklib/demo/lines3.rb
@@ -0,0 +1,54 @@
+#! /usr/local/bin/ruby
+
+require "tk"
+
+def drawlines()
+ print Time.now, "\n"
+
+ for j in 0 .. 99
+ print "*"
+ $stdout.flush
+ if (j & 1) != 0
+ col = "blue"
+ else
+ col = "red"
+ end
+ for i in 0 .. 99
+# $a.create(TkcLine, i, 0, 0, 500 - i, "fill"=>col)
+ end
+ end
+
+ print Time.now, "\n"
+
+ for j in 0 .. 99
+ print "*"
+ $stdout.flush
+ if (j & 1) != 0
+ col = "blue"
+ else
+ col = "red"
+ end
+ for i in 0 .. 99
+ $a.create(TkcLine, i, 0, 0, 500 - i, "fill"=>col)
+ end
+ end
+
+ print Time.now, "\n"
+# Tk.root.destroy
+end
+
+$a = TkCanvas.new{
+ height(500)
+ width(500)
+}
+
+$b = TkButton.new{
+ text("draw")
+ command(proc{drawlines()})
+}
+
+TkPack.configure($a, $b, {"side"=>"left"})
+
+Tk.mainloop
+
+# eof
diff --git a/ext/tcltklib/demo/lines4.rb b/ext/tcltklib/demo/lines4.rb
new file mode 100644
index 0000000000..7a1175bce0
--- /dev/null
+++ b/ext/tcltklib/demo/lines4.rb
@@ -0,0 +1,54 @@
+#! /usr/local/bin/ruby
+
+require "tk"
+
+def drawlines()
+ print Time.now, "\n"
+
+ for j in 0 .. 99
+ print "*"
+ $stdout.flush
+ if (j & 1) != 0
+ col = "blue"
+ else
+ col = "red"
+ end
+ for i in 0 .. 99
+# TkCore::INTERP.__invoke($a.path, "create", "line", i.to_s, '0', '0', (500 - i).to_s, "-fill", col)
+ end
+ end
+
+ print Time.now, "\n"
+
+ for j in 0 .. 99
+ print "*"
+ $stdout.flush
+ if (j & 1) != 0
+ col = "blue"
+ else
+ col = "red"
+ end
+ for i in 0 .. 99
+ TkCore::INTERP.__invoke($a.path, "create", "line", i.to_s, '0', '0', (500 - i).to_s, "-fill", col)
+ end
+ end
+
+ print Time.now, "\n"
+# Tk.root.destroy
+end
+
+$a = TkCanvas.new{
+ height(500)
+ width(500)
+}
+
+$b = TkButton.new{
+ text("draw")
+ command(proc{drawlines()})
+}
+
+TkPack.configure($a, $b, {"side"=>"left"})
+
+Tk.mainloop
+
+# eof
diff --git a/ext/tk/README.fork b/ext/tk/README.fork
new file mode 100644
index 0000000000..cda89b003c
--- /dev/null
+++ b/ext/tk/README.fork
@@ -0,0 +1,29 @@
+Ruby/Tk does NOT support forking the process on which Tk interpreter
+is running (unless NEVER control Tk interpreter under the forked child
+process). In the library 'tk.rb', a Tk interpreter is initialized.
+Therefore, if you want running Tk under a child process, please call
+"require 'tk'" in the child process.
+
+For example, the following sample1 will NOT work, and sample2 will
+work properly.
+
+---<sample1: NOT work>---------------------------------------
+require 'tk' ## init Tk interpreter under parent process
+
+exit! if fork ## exit parent process
+
+## child process
+TkButton.new(:text=>'QUIT', :command=>proc{exit}).pack
+Tk.mainloop
+-------------------------------------------------------------
+
+---<sample2: will work>--------------------------------------
+exit! if fork ## exit main process
+
+## child process
+require 'tk' ## init Tk interpreter under child process
+TkButton.new(:text=>'QUIT', :command=>proc{exit}).pack
+Tk.mainloop
+-------------------------------------------------------------
+
+ 2004/04/20 Hidetoshi NAGAI
diff --git a/ext/tk/lib/tk/after.rb b/ext/tk/lib/tk/after.rb
new file mode 100644
index 0000000000..8c58210331
--- /dev/null
+++ b/ext/tk/lib/tk/after.rb
@@ -0,0 +1,6 @@
+#
+# tk/after.rb : methods for Tcl/Tk after command
+#
+# $Id$
+#
+require 'tk/timer'
diff --git a/ext/tk/lib/tk/autoload.rb b/ext/tk/lib/tk/autoload.rb
new file mode 100644
index 0000000000..0a8251af8b
--- /dev/null
+++ b/ext/tk/lib/tk/autoload.rb
@@ -0,0 +1,181 @@
+#
+# autoload
+#
+
+#######################
+# geometry manager
+autoload :TkGrid, 'tk/grid'
+def TkGrid(*args); TkGrid.configure(*args); end
+
+autoload :TkPack, 'tk/pack'
+def TkPack(*args); TkPack.configure(*args); end
+
+autoload :TkPlace, 'tk/place'
+def TkPlace(*args); TkPlace.configure(*args); end
+
+
+#######################
+# others
+autoload :TkBgError, 'tk/bgerror'
+
+autoload :TkBindTag, 'tk/bindtag'
+autoload :TkBindTagAll, 'tk/bindtag'
+autoload :TkDatabaseClass, 'tk/bindtag'
+
+autoload :TkButton, 'tk/button'
+
+autoload :TkConsole, 'tk/console'
+
+autoload :TkCanvas, 'tk/canvas'
+
+autoload :TkcTagAccess, 'tk/canvastag'
+autoload :TkcTag, 'tk/canvastag'
+autoload :TkcTagString, 'tk/canvastag'
+autoload :TkcNamedTag, 'tk/canvastag'
+autoload :TkcTagAll, 'tk/canvastag'
+autoload :TkcTagCurrent, 'tk/canvastag'
+autoload :TkcTagGroup, 'tk/canvastag'
+
+autoload :TkCheckButton, 'tk/checkbutton'
+autoload :TkCheckbutton, 'tk/checkbutton'
+
+autoload :TkClipboard, 'tk/clipboard'
+
+autoload :TkComposite, 'tk/composite'
+
+autoload :TkConsole, 'tk/console'
+
+autoload :TkDialog, 'tk/dialog'
+autoload :TkDialog2, 'tk/dialog'
+autoload :TkWarning, 'tk/dialog'
+autoload :TkWarning2, 'tk/dialog'
+
+autoload :TkEntry, 'tk/entry'
+
+autoload :TkEvent, 'tk/event'
+
+autoload :TkFont, 'tk/font'
+autoload :TkTreatTagFont, 'tk/font'
+
+autoload :TkFrame, 'tk/frame'
+
+autoload :TkImage, 'tk/image'
+autoload :TkBitmapImage, 'tk/image'
+autoload :TkPhotoImage, 'tk/image'
+
+autoload :TkTreatItemFont, 'tk/itemfont'
+
+autoload :TkKinput, 'tk/kinput'
+
+autoload :TkLabel, 'tk/label'
+
+autoload :TkLabelFrame, 'tk/labelframe'
+autoload :TkLabelframe, 'tk/labelframe'
+
+autoload :TkListbox, 'tk/listbox'
+
+autoload :TkMacResource, 'tk/macpkg'
+
+autoload :TkMenu, 'tk/menu'
+autoload :TkMenuClone, 'tk/menu'
+autoload :TkSystemMenu, 'tk/menu'
+autoload :TkSysMenu_Help, 'tk/menu'
+autoload :TkSysMenu_System, 'tk/menu'
+autoload :TkSysMenu_Apple, 'tk/menu'
+autoload :TkMenubutton, 'tk/menu'
+autoload :TkOptionMenubutton, 'tk/menu'
+
+autoload :TkMenubar, 'tk/menubar'
+
+autoload :TkMessage, 'tk/message'
+
+autoload :TkManageFocus, 'tk/mngfocus'
+
+autoload :TkMsgCatalog, 'tk/msgcat'
+autoload :TkMsgCat, 'tk/msgcat'
+
+autoload :TkNamespace, 'tk/namespace'
+
+autoload :TkOptionDB, 'tk/optiondb'
+autoload :TkOption, 'tk/optiondb'
+autoload :TkResourceDB, 'tk/optiondb'
+
+autoload :TkPackage, 'tk/package'
+
+autoload :TkPalette, 'tk/palette'
+
+autoload :TkPanedWindow, 'tk/panedwindow'
+autoload :TkPanedwindow, 'tk/panedwindow'
+
+autoload :TkRadioButton, 'tk/radiobutton'
+autoload :TkRadiobutton, 'tk/radiobutton'
+
+autoload :TkRoot, 'tk/root'
+
+autoload :TkScale, 'tk/scale'
+
+autoload :TkScrollbar, 'tk/scrollbar'
+autoload :TkXScrollbar, 'tk/scrollbar'
+autoload :TkYScrollbar, 'tk/scrollbar'
+
+autoload :TkScrollbox, 'tk/scrollbox'
+
+autoload :TkSelection, 'tk/selection'
+
+autoload :TkSpinbox, 'tk/spinbox'
+
+autoload :TkTreatTagFont, 'tk/tagfont'
+
+autoload :TkText, 'tk/text'
+
+autoload :TkTextImage, 'tk/textimage'
+
+autoload :TkTextMark, 'tk/textmark'
+autoload :TkTextNamedMark, 'tk/textmark'
+autoload :TkTextMarkInsert, 'tk/textmark'
+autoload :TkTextMarkCurrent, 'tk/textmark'
+autoload :TkTextMarkAnchor, 'tk/textmark'
+
+autoload :TkTextTag, 'tk/texttag'
+autoload :TkTextNamedTag, 'tk/texttag'
+autoload :TkTextTagSel, 'tk/texttag'
+
+autoload :TkTextWindow, 'tk/textwindow'
+
+autoload :TkAfter, 'tk/timer'
+autoload :TkTimer, 'tk/timer'
+
+autoload :TkToplevel, 'tk/toplevel'
+
+autoload :TkTextWin, 'tk/txtwin_abst'
+
+autoload :TkValidation, 'tk/validation'
+autoload :TkVariable, 'tk/variable'
+autoload :TkVarAccess, 'tk/variable'
+
+autoload :TkVirtualEvent, 'tk/virtevent'
+
+autoload :TkWinfo, 'tk/winfo'
+
+autoload :TkWinDDE, 'tk/winpkg'
+autoload :TkWinRegistry, 'tk/winpkg'
+
+autoload :TkXIM, 'tk/xim'
+
+
+#######################
+# sub-module of Tk
+module Tk
+ autoload :Clock, 'tk/clock'
+ autoload :Scrollable, 'tk/scrollable'
+ autoload :Wm, 'tk/wm'
+
+ autoload :EncodedString, 'tk/encodedstr'
+ def Tk.EncodedString(str, enc = nil); Tk::EncodedString.new(str, enc); end
+
+ autoload :BinaryString, 'tk/encodedstr'
+ def Tk.BinaryString(str); Tk::BinaryString.new(str); end
+
+ autoload :UTF8_String, 'tk/encodedstr'
+ def Tk.UTF8_String(str); Tk::UTF8_String.new(str); end
+end
diff --git a/ext/tk/lib/tk/bgerror.rb b/ext/tk/lib/tk/bgerror.rb
new file mode 100644
index 0000000000..c82a8e046b
--- /dev/null
+++ b/ext/tk/lib/tk/bgerror.rb
@@ -0,0 +1,29 @@
+#
+# tkbgerror -- bgerror ( tkerror ) module
+# 1998/07/16 by Hidetoshi Nagai <nagai@ai.kyutech.ac.jp>
+#
+require 'tk'
+
+module TkBgError
+ extend Tk
+
+ TkCommandNames = ['bgerror'.freeze].freeze
+
+ def bgerror(message)
+ tk_call('bgerror', message)
+ end
+ alias tkerror bgerror
+ alias show bgerror
+ module_function :bgerror, :tkerror, :show
+
+ def set_handler(hdlr = Proc.new) #==> handler :: proc{|msg| ...body... }
+ tk_call('proc', 'bgerror', 'msg', install_cmd(hdlr) + ' $msg')
+ end
+ def set_default
+ begin
+ tk_call('rename', 'bgerror', '')
+ rescue RuntimeError
+ end
+ end
+ module_function :set_handler, :set_default
+end
diff --git a/ext/tk/lib/tk/bindtag.rb b/ext/tk/lib/tk/bindtag.rb
new file mode 100644
index 0000000000..d309ea6423
--- /dev/null
+++ b/ext/tk/lib/tk/bindtag.rb
@@ -0,0 +1,78 @@
+#
+# tk/bind.rb : control event binding
+#
+require 'tk'
+
+class TkBindTag
+ include TkBindCore
+
+ #BTagID_TBL = {}
+ BTagID_TBL = TkCore::INTERP.create_table
+ Tk_BINDTAG_ID = ["btag".freeze, "00000".taint].freeze
+
+ TkCore::INTERP.init_ip_env{ BTagID_TBL.clear }
+
+ def TkBindTag.id2obj(id)
+ BTagID_TBL[id]? BTagID_TBL[id]: id
+ end
+
+ def TkBindTag.new_by_name(name, *args, &b)
+ return BTagID_TBL[name] if BTagID_TBL[name]
+ self.new(*args, &b).instance_eval{
+ BTagID_TBL.delete @id
+ @id = name
+ BTagID_TBL[@id] = self
+ }
+ end
+
+ def initialize(*args, &b)
+ @id = Tk_BINDTAG_ID.join('')
+ Tk_BINDTAG_ID[1].succ!
+ BTagID_TBL[@id] = self
+ bind(*args, &b) if args != []
+ end
+
+ ALL = self.new_by_name('all')
+
+ def name
+ @id
+ end
+
+ def to_eval
+ @id
+ end
+
+ def inspect
+ #Kernel.format "#<TkBindTag: %s>", @id
+ '#<TkBindTag: ' + @id + '>'
+ end
+end
+
+
+class TkBindTagAll<TkBindTag
+ def TkBindTagAll.new(*args, &b)
+ $stderr.puts "Warning: TkBindTagALL is obsolete. Use TkBindTag::ALL\n"
+
+ TkBindTag::ALL.bind(*args, &b) if args != []
+ TkBindTag::ALL
+ end
+end
+
+
+class TkDatabaseClass<TkBindTag
+ def self.new(name, *args, &b)
+ return BTagID_TBL[name] if BTagID_TBL[name]
+ super(name, *args, &b)
+ end
+
+ def initialize(name, *args, &b)
+ @id = name
+ BTagID_TBL[@id] = self
+ bind(*args, &b) if args != []
+ end
+
+ def inspect
+ #Kernel.format "#<TkDatabaseClass: %s>", @id
+ '#<TkDatabaseClass: ' + @id + '>'
+ end
+end
diff --git a/ext/tk/lib/tk/button.rb b/ext/tk/lib/tk/button.rb
new file mode 100644
index 0000000000..15e87c300d
--- /dev/null
+++ b/ext/tk/lib/tk/button.rb
@@ -0,0 +1,27 @@
+#
+# tk/button.rb : treat button widget
+#
+require 'tk'
+require 'tk/label'
+
+class TkButton<TkLabel
+ TkCommandNames = ['button'.freeze].freeze
+ WidgetClassName = 'Button'.freeze
+ WidgetClassNames[WidgetClassName] = self
+ def create_self(keys)
+ if keys and keys != None
+ tk_call_without_enc('button', @path, *hash_kv(keys, true))
+ else
+ tk_call_without_enc('button', @path)
+ end
+ end
+ private :create_self
+
+ def invoke
+ _fromUTF8(tk_send_without_enc('invoke'))
+ end
+ def flash
+ tk_send_without_enc('flash')
+ self
+ end
+end
diff --git a/ext/tk/lib/tk/canvas.rb b/ext/tk/lib/tk/canvas.rb
new file mode 100644
index 0000000000..7defecdfe4
--- /dev/null
+++ b/ext/tk/lib/tk/canvas.rb
@@ -0,0 +1,697 @@
+#
+# tk/canvas.rb - Tk canvas classes
+# $Date$
+# by Yukihiro Matsumoto <matz@caelum.co.jp>
+# $Date$
+# by Hidetoshi Nagai <nagai@ai.kyutech.ac.jp>
+#
+require 'tk'
+require 'tk/canvastag'
+require 'tk/itemfont'
+require 'tk/scrollable'
+
+module TkTreatCItemFont
+ include TkTreatItemFont
+
+ ItemCMD = ['itemconfigure'.freeze, TkComm::None].freeze
+ def __conf_cmd(idx)
+ ItemCMD[idx]
+ end
+
+ def __item_pathname(tagOrId)
+ if tagOrId.kind_of?(TkcItem) || tagOrId.kind_of?(TkcTag)
+ self.path + ';' + tagOrId.id.to_s
+ else
+ self.path + ';' + tagOrId.to_s
+ end
+ end
+
+ private :__conf_cmd, :__item_pathname
+end
+
+class TkCanvas<TkWindow
+ include TkTreatCItemFont
+ include Scrollable
+
+ TkCommandNames = ['canvas'.freeze].freeze
+ WidgetClassName = 'Canvas'.freeze
+ WidgetClassNames[WidgetClassName] = self
+
+ def __destroy_hook__
+ TkcItem::CItemID_TBL.delete(@path)
+ end
+
+ def create_self(keys)
+ if keys and keys != None
+ tk_call_without_enc('canvas', @path, *hash_kv(keys, true))
+ else
+ tk_call_without_enc('canvas', @path)
+ end
+ end
+ private :create_self
+
+ def tagid(tag)
+ if tag.kind_of?(TkcItem) || tag.kind_of?(TkcTag)
+ tag.id
+ else
+ tag
+ end
+ end
+ private :tagid
+
+
+ def create(type, *args)
+ # create a canvas item without creating a TkcItem object
+ if type.kind_of?(TkcItem)
+ fail ArgumentError, 'TkcItem class expected for 1st argument'
+ end
+ type.create(@path, *args)
+ end
+
+
+ def addtag(tag, mode, *args)
+ tk_send_without_enc('addtag', tagid(tag), mode, *args)
+ self
+ end
+ def addtag_above(tagOrId, target)
+ addtag(tagOrId, 'above', tagid(target))
+ end
+ def addtag_all(tagOrId)
+ addtag(tagOrId, 'all')
+ end
+ def addtag_below(tagOrId, target)
+ addtag(tagOrId, 'below', tagid(target))
+ end
+ def addtag_closest(tagOrId, x, y, halo=None, start=None)
+ addtag(tagOrId, 'closest', x, y, halo, start)
+ end
+ def addtag_enclosed(tagOrId, x1, y1, x2, y2)
+ addtag(tagOrId, 'enclosed', x1, y1, x2, y2)
+ end
+ def addtag_overlapping(tagOrId, x1, y1, x2, y2)
+ addtag(tagOrId, 'overlapping', x1, y1, x2, y2)
+ end
+ def addtag_withtag(tagOrId, tag)
+ addtag(tagOrId, 'withtag', tagid(tag))
+ end
+
+ def bbox(tagOrId, *tags)
+ list(tk_send_without_enc('bbox', tagid(tagOrId),
+ *tags.collect{|t| tagid(t)}))
+ end
+
+ def itembind(tag, context, cmd=Proc.new, args=nil)
+ _bind([path, "bind", tagid(tag)], context, cmd, args)
+ self
+ end
+
+ def itembind_append(tag, context, cmd=Proc.new, args=nil)
+ _bind_append([path, "bind", tagid(tag)], context, cmd, args)
+ self
+ end
+
+ def itembind_remove(tag, context)
+ _bind_remove([path, "bind", tagid(tag)], context)
+ self
+ end
+
+ def itembindinfo(tag, context=nil)
+ _bindinfo([path, "bind", tagid(tag)], context)
+ end
+
+ def canvasx(screen_x, *args)
+ #tk_tcl2ruby(tk_send_without_enc('canvasx', screen_x, *args))
+ number(tk_send_without_enc('canvasx', screen_x, *args))
+ end
+ def canvasy(screen_y, *args)
+ #tk_tcl2ruby(tk_send_without_enc('canvasy', screen_y, *args))
+ number(tk_send_without_enc('canvasy', screen_y, *args))
+ end
+
+ def coords(tag, *args)
+ if args == []
+ tk_split_list(tk_send_without_enc('coords', tagid(tag)))
+ else
+ tk_send_without_enc('coords', tagid(tag), *(args.flatten))
+ end
+ end
+
+ def dchars(tag, first, last=None)
+ tk_send_without_enc('dchars', tagid(tag),
+ _get_eval_enc_str(first), _get_eval_enc_str(last))
+ self
+ end
+
+ def delete(*args)
+ if TkcItem::CItemID_TBL[self.path]
+ find('withtag', *args).each{|item|
+ TkcItem::CItemID_TBL[self.path].delete(item.id)
+ }
+ end
+ tk_send_without_enc('delete', *args.collect{|t| tagid(t)})
+ self
+ end
+ alias remove delete
+
+ def dtag(tag, tag_to_del=None)
+ tk_send_without_enc('dtag', tagid(tag), tag_to_del)
+ self
+ end
+
+ def find(mode, *args)
+ list(tk_send_without_enc('find', mode, *args)).collect!{|id|
+ TkcItem.id2obj(self, id)
+ }
+ end
+ def find_above(target)
+ find('above', tagid(target))
+ end
+ def find_all
+ find('all')
+ end
+ def find_below(target)
+ find('below', tagid(target))
+ end
+ def find_closest(x, y, halo=None, start=None)
+ find('closest', x, y, halo, start)
+ end
+ def find_enclosed(x1, y1, x2, y2)
+ find('enclosed', x1, y1, x2, y2)
+ end
+ def find_overlapping(x1, y1, x2, y2)
+ find('overlapping', x1, y1, x2, y2)
+ end
+ def find_withtag(tag)
+ find('withtag', tag)
+ end
+
+ def itemfocus(tagOrId=nil)
+ if tagOrId
+ tk_send_without_enc('focus', tagid(tagOrId))
+ self
+ else
+ ret = tk_send_without_enc('focus')
+ if ret == ""
+ nil
+ else
+ TkcItem.id2obj(self, ret)
+ end
+ end
+ end
+
+ def gettags(tagOrId)
+ list(tk_send_without_enc('gettags', tagid(tagOrId))).collect{|tag|
+ TkcTag.id2obj(self, tag)
+ }
+ end
+
+ def icursor(tagOrId, index)
+ tk_send_without_enc('icursor', tagid(tagOrId), index)
+ self
+ end
+
+ def index(tagOrId, index)
+ number(tk_send_without_enc('index', tagid(tagOrId), index))
+ end
+
+ def insert(tagOrId, index, string)
+ tk_send_without_enc('insert', tagid(tagOrId), index,
+ _get_eval_enc_str(string))
+ self
+ end
+
+ def itemcget(tagOrId, option)
+ case option.to_s
+ when 'dash', 'activedash', 'disableddash'
+ conf = tk_send_without_enc('itemcget', tagid(tagOrId), "-#{option}")
+ if conf =~ /^[0-9]/
+ list(conf)
+ else
+ conf
+ end
+ when 'text', 'label', 'show', 'data', 'file', 'maskdata', 'maskfile'
+ _fromUTF8(tk_send_without_enc('itemcget', tagid(tagOrId), "-#{option}"))
+ when 'font', 'kanjifont'
+ #fnt = tk_tcl2ruby(tk_send('itemcget', tagid(tagOrId), "-#{option}"))
+ fnt = tk_tcl2ruby(_fromUTF8(tk_send_with_enc('itemcget', tagid(tagOrId), '-font')))
+ unless fnt.kind_of?(TkFont)
+ fnt = tagfontobj(tagid(tagOrId), fnt)
+ end
+ if option.to_s == 'kanjifont' && JAPANIZED_TK && TK_VERSION =~ /^4\.*/
+ # obsolete; just for compatibility
+ fnt.kanji_font
+ else
+ fnt
+ end
+ else
+ tk_tcl2ruby(_fromUTF8(tk_send_without_enc('itemcget', tagid(tagOrId),
+ "-#{option}")))
+ end
+ end
+
+ def itemconfigure(tagOrId, key, value=None)
+ if key.kind_of? Hash
+ key = _symbolkey2str(key)
+ if ( key['font'] || key['kanjifont'] \
+ || key['latinfont'] || key['asciifont'] )
+ tagfont_configure(tagid(tagOrId), key.dup)
+ else
+ _fromUTF8(tk_send_without_enc('itemconfigure', tagid(tagOrId),
+ *hash_kv(key, true)))
+ end
+
+ else
+ if ( key == 'font' || key == :font ||
+ key == 'kanjifont' || key == :kanjifont ||
+ key == 'latinfont' || key == :latinfont ||
+ key == 'asciifont' || key == :asciifont )
+ if value == None
+ tagfontobj(tagid(tagOrId))
+ else
+ tagfont_configure(tagid(tagOrId), {key=>value})
+ end
+ else
+ _fromUTF8(tk_send_without_enc('itemconfigure', tagid(tagOrId),
+ "-#{key}", _get_eval_enc_str(value)))
+ end
+ end
+ self
+ end
+# def itemconfigure(tagOrId, key, value=None)
+# if key.kind_of? Hash
+# tk_send 'itemconfigure', tagid(tagOrId), *hash_kv(key)
+# else
+# tk_send 'itemconfigure', tagid(tagOrId), "-#{key}", value
+# end
+# end
+# def itemconfigure(tagOrId, keys)
+# tk_send 'itemconfigure', tagid(tagOrId), *hash_kv(keys)
+# end
+
+ def itemconfiginfo(tagOrId, key=nil)
+ if TkComm::GET_CONFIGINFO_AS_ARRAY
+ if key
+ case key.to_s
+ when 'dash', 'activedash', 'disableddash'
+ conf = tk_split_simplelist(tk_send_without_enc('itemconfigure', tagid(tagOrId), "-#{key}"))
+ if conf[3] && conf[3] =~ /^[0-9]/
+ conf[3] = list(conf[3])
+ end
+ if conf[4] && conf[4] =~ /^[0-9]/
+ conf[4] = list(conf[4])
+ end
+ when 'text', 'label', 'show', 'data', 'file', 'maskdata', 'maskfile'
+ conf = tk_split_simplelist(_fromUTF8(tk_send_without_enc('itemconfigure', tagid(tagOrId), "-#{key}")))
+ when 'font', 'kanjifont'
+ conf = tk_split_simplelist(_fromUTF8(tk_send_without_enc('itemconfigure', tagid(tagOrId),"-#{key}")))
+ conf[4] = tagfont_configinfo(tagid(tagOrId), conf[4])
+ else
+ conf = tk_split_list(_fromUTF8(tk_send_without_enc('itemconfigure', tagid(tagOrId), "-#{key}")))
+ end
+ conf[0] = conf[0][1..-1]
+ conf
+ else
+ ret = tk_split_simplelist(_fromUTF8(tk_send_without_enc('itemconfigure', tagid(tagOrId)))).collect{|conflist|
+ conf = tk_split_simplelist(conflist)
+ conf[0] = conf[0][1..-1]
+ case conf[0]
+ when 'text', 'label', 'show', 'data', 'file', 'maskdata', 'maskfile'
+ when 'dash', 'activedash', 'disableddash'
+ if conf[3] && conf[3] =~ /^[0-9]/
+ conf[3] = list(conf[3])
+ end
+ if conf[4] && conf[4] =~ /^[0-9]/
+ conf[4] = list(conf[4])
+ end
+ else
+ if conf[3]
+ if conf[3].index('{')
+ conf[3] = tk_split_list(conf[3])
+ else
+ conf[3] = tk_tcl2ruby(conf[3])
+ end
+ end
+ if conf[4]
+ if conf[4].index('{')
+ conf[4] = tk_split_list(conf[4])
+ else
+ conf[4] = tk_tcl2ruby(conf[4])
+ end
+ end
+ end
+ conf[1] = conf[1][1..-1] if conf.size == 2 # alias info
+ conf
+ }
+ fontconf = ret.assoc('font')
+ if fontconf
+ ret.delete_if{|item| item[0] == 'font' || item[0] == 'kanjifont'}
+ fontconf[4] = tagfont_configinfo(tagid(tagOrId), fontconf[4])
+ ret.push(fontconf)
+ else
+ ret
+ end
+ end
+ else # ! TkComm::GET_CONFIGINFO_AS_ARRAY
+ if key
+ case key.to_s
+ when 'dash', 'activedash', 'disableddash'
+ conf = tk_split_simplelist(tk_send_without_enc('itemconfigure',
+ tagid(tagOrId),
+ "-#{key}"))
+ if conf[3] && conf[3] =~ /^[0-9]/
+ conf[3] = list(conf[3])
+ end
+ if conf[4] && conf[4] =~ /^[0-9]/
+ conf[4] = list(conf[4])
+ end
+ when 'text', 'label', 'show', 'data', 'file', 'maskdata', 'maskfile'
+ conf = tk_split_simplelist(_fromUTF8(tk_send_without_enc('itemconfigure', tagid(tagOrId), "-#{key}")))
+ when 'font', 'kanjifont'
+ conf = tk_split_simplelist(_fromUTF8(tk_send_without_enc('itemconfigure', tagid(tagOrId),"-#{key}")))
+ conf[4] = tagfont_configinfo(tagid(tagOrId), conf[4])
+ else
+ conf = tk_split_list(_fromUTF8(tk_send_without_enc('itemconfigure', tagid(tagOrId), "-#{key}")))
+ end
+ key = conf.shift[1..-1]
+ { key => conf }
+ else
+ ret = {}
+ tk_split_simplelist(_fromUTF8(tk_send_without_enc('itemconfigure', tagid(tagOrId)))).each{|conflist|
+ conf = tk_split_simplelist(conflist)
+ key = conf.shift[1..-1]
+ case key
+ when 'text', 'label', 'show', 'data', 'file', 'maskdata', 'maskfile'
+ when 'dash', 'activedash', 'disableddash'
+ if conf[2] && conf[2] =~ /^[0-9]/
+ conf[2] = list(conf[2])
+ end
+ if conf[3] && conf[3] =~ /^[0-9]/
+ conf[3] = list(conf[3])
+ end
+ else
+ if conf[2]
+ if conf[2].index('{')
+ conf[2] = tk_split_list(conf[2])
+ else
+ conf[2] = tk_tcl2ruby(conf[2])
+ end
+ end
+ if conf[3]
+ if conf[3].index('{')
+ conf[3] = tk_split_list(conf[3])
+ else
+ conf[3] = tk_tcl2ruby(conf[3])
+ end
+ end
+ end
+ if conf.size == 1
+ ret[key] = conf[0][1..-1] # alias info
+ else
+ ret[key] = conf
+ end
+ }
+ fontconf = ret['font']
+ if fontconf
+ ret.delete('font')
+ ret.delete('kanjifont')
+ fontconf[3] = tagfont_configinfo(tagid(tagOrId), fontconf[3])
+ ret['font'] = fontconf
+ end
+ ret
+ end
+ end
+ end
+
+ def current_itemconfiginfo(tagOrId, key=nil)
+ if TkComm::GET_CONFIGINFO_AS_ARRAY
+ if key
+ conf = itemconfiginfo(tagOrId, key)
+ {conf[0] => conf[4]}
+ else
+ ret = {}
+ itemconfiginfo(tagOrId).each{|conf|
+ ret[conf[0]] = conf[4] if conf.size > 2
+ }
+ ret
+ end
+ else # ! TkComm::GET_CONFIGINFO_AS_ARRAY
+ ret = {}
+ itemconfiginfo(tagOrId, key).each{|k, conf|
+ ret[k] = conf[-1] if conf.kind_of?(Array)
+ }
+ ret
+ end
+ end
+
+ def lower(tag, below=nil)
+ if below
+ tk_send_without_enc('lower', tagid(tag), tagid(below))
+ else
+ tk_send_without_enc('lower', tagid(tag))
+ end
+ self
+ end
+
+ def move(tag, x, y)
+ tk_send_without_enc('move', tagid(tag), x, y)
+ self
+ end
+
+ def postscript(keys)
+ tk_send("postscript", *hash_kv(keys))
+ end
+
+ def raise(tag, above=nil)
+ if above
+ tk_send_without_enc('raise', tagid(tag), tagid(above))
+ else
+ tk_send_without_enc('raise', tagid(tag))
+ end
+ self
+ end
+
+ def scale(tag, x, y, xs, ys)
+ tk_send_without_enc('scale', tagid(tag), x, y, xs, ys)
+ self
+ end
+
+ def scan_mark(x, y)
+ tk_send_without_enc('scan', 'mark', x, y)
+ self
+ end
+ def scan_dragto(x, y)
+ tk_send_without_enc('scan', 'dragto', x, y)
+ self
+ end
+
+ def select(mode, *args)
+ r = tk_send_without_enc('select', mode, *args)
+ (mode == 'item')? TkcItem.id2obj(self, r): self
+ end
+ def select_adjust(tagOrId, index)
+ select('adjust', tagid(tagOrId), index)
+ end
+ def select_clear
+ select('clear')
+ end
+ def select_from(tagOrId, index)
+ select('from', tagid(tagOrId), index)
+ end
+ def select_item
+ select('item')
+ end
+ def select_to(tagOrId, index)
+ select('to', tagid(tagOrId), index)
+ end
+
+ def itemtype(tag)
+ TkcItem.type2class(tk_send('type', tagid(tag)))
+ end
+end
+
+class TkcItem<TkObject
+ extend Tk
+ include TkcTagAccess
+
+ CItemTypeToClass = {}
+ CItemID_TBL = TkCore::INTERP.create_table
+
+ TkCore::INTERP.init_ip_env{ CItemID_TBL.clear }
+
+ def TkcItem.type2class(type)
+ CItemTypeToClass[type]
+ end
+
+ def TkcItem.id2obj(canvas, id)
+ cpath = canvas.path
+ return id unless CItemID_TBL[cpath]
+ CItemID_TBL[cpath][id]? CItemID_TBL[cpath][id]: id
+ end
+
+ ########################################
+ def self.create(canvas, *args)
+ fail RuntimeError, "TkcItem is an abstract class"
+ end
+ ########################################
+
+ def initialize(parent, *args)
+ unless parent.kind_of?(TkCanvas)
+ fail ArguemntError, "expect TkCanvas for 1st argument"
+ end
+ @parent = @c = parent
+ @path = parent.path
+ fontkeys = {}
+ if args.size == 1 && args[0].kind_of?(Hash)
+ args[0] = _symbolkey2str(args[0])
+ coords = args[0].delete('coords')
+ unless coords.kind_of?(Array)
+ fail "coords parameter must be given by an Array"
+ end
+ args[0,0] = coords.flatten
+ end
+ if args[-1].kind_of? Hash
+ keys = _symbolkey2str(args.pop)
+ ['font', 'kanjifont', 'latinfont', 'asciifont'].each{|key|
+ fontkeys[key] = keys.delete(key) if keys.key?(key)
+ }
+ args.concat(hash_kv(keys))
+ end
+ @id = create_self(*args).to_i ;# 'canvas item id' is integer number
+ CItemID_TBL[@path] = {} unless CItemID_TBL[@path]
+ CItemID_TBL[@path][@id] = self
+ configure(fontkeys) unless fontkeys.empty?
+
+######## old version
+# if args[-1].kind_of? Hash
+# keys = args.pop
+# end
+# @id = create_self(*args).to_i ;# 'canvas item id' is integer number
+# CItemID_TBL[@path] = {} unless CItemID_TBL[@path]
+# CItemID_TBL[@path][@id] = self
+# if keys
+# # tk_call @path, 'itemconfigure', @id, *hash_kv(keys)
+# configure(keys) if keys
+# end
+########
+ end
+ def create_self(*args)
+ self.class.create(@path, *args)
+ end
+ private :create_self
+
+ def id
+ @id
+ end
+
+ def delete
+ @c.delete @id
+ CItemID_TBL[@path].delete(@id) if CItemID_TBL[@path]
+ self
+ end
+ alias remove delete
+ alias destroy delete
+end
+
+class TkcArc<TkcItem
+ CItemTypeToClass['arc'] = self
+ def self.create(path, *args)
+ if args[-1].kind_of?(Hash)
+ keys = args.pop
+ args.concat(hash_kv(keys))
+ end
+ tk_call_without_enc(path, 'create', 'arc', *args)
+ end
+end
+
+class TkcBitmap<TkcItem
+ CItemTypeToClass['bitmap'] = self
+ def self.create(path, *args)
+ if args[-1].kind_of?(Hash)
+ keys = args.pop
+ args.concat(hash_kv(keys))
+ end
+ tk_call_without_enc(path, 'create', 'bitmap', *args)
+ end
+end
+
+class TkcImage<TkcItem
+ CItemTypeToClass['image'] = self
+ def self.create(path, *args)
+ if args[-1].kind_of?(Hash)
+ keys = args.pop
+ args.concat(hash_kv(keys))
+ end
+ tk_call_without_enc(path, 'create', 'image', *args)
+ end
+end
+
+class TkcLine<TkcItem
+ CItemTypeToClass['line'] = self
+ def self.create(path, *args)
+ if args[-1].kind_of?(Hash)
+ keys = args.pop
+ args.concat(hash_kv(keys))
+ end
+ tk_call_without_enc(path, 'create', 'line', *args)
+ end
+end
+
+class TkcOval<TkcItem
+ CItemTypeToClass['oval'] = self
+ def self.create(path, *args)
+ if args[-1].kind_of?(Hash)
+ keys = args.pop
+ args.concat(hash_kv(keys))
+ end
+ tk_call_without_enc(path, 'create', 'oval', *args)
+ end
+end
+
+class TkcPolygon<TkcItem
+ CItemTypeToClass['polygon'] = self
+ def self.create(path, *args)
+ if args[-1].kind_of?(Hash)
+ keys = args.pop
+ args.concat(hash_kv(keys))
+ end
+ tk_call_without_enc(path, 'create', 'polygon', *args)
+ end
+end
+
+class TkcRectangle<TkcItem
+ CItemTypeToClass['rectangle'] = self
+ def self.create(path, *args)
+ if args[-1].kind_of?(Hash)
+ keys = args.pop
+ args.concat(hash_kv(keys))
+ end
+ tk_call_without_enc(path, 'create', 'rectangle', *args)
+ end
+end
+
+class TkcText<TkcItem
+ CItemTypeToClass['text'] = self
+ def self.create(path, *args)
+ if args[-1].kind_of?(Hash)
+ keys = args.pop
+ args.concat(hash_kv(keys))
+ end
+ #tk_call_without_enc(path, 'create', 'text',
+ # *(args.each{|arg| _get_eval_enc_str(arg)}))
+ tk_call(path, 'create', 'text', *args)
+ end
+end
+
+class TkcWindow<TkcItem
+ CItemTypeToClass['window'] = self
+ def self.create(path, *args)
+ if args[-1].kind_of?(Hash)
+ keys = _symbolkey2str(args.pop)
+ win = keys['window']
+ # keys['window'] = win.epath if win.kind_of?(TkWindow)
+ keys['window'] = _epath(win) if win
+ args.concat(hash_kv(keys))
+ end
+ tk_call_without_enc(path, 'create', 'window', *args)
+ end
+end
diff --git a/ext/tk/lib/tk/canvastag.rb b/ext/tk/lib/tk/canvastag.rb
new file mode 100644
index 0000000000..962e08b6e0
--- /dev/null
+++ b/ext/tk/lib/tk/canvastag.rb
@@ -0,0 +1,337 @@
+#
+# tk/canvastag.rb - methods for treating canvas tags
+#
+require 'tk'
+require 'tk/canvas'
+require 'tk/tagfont'
+
+module TkcTagAccess
+ include TkComm
+ include TkTreatTagFont
+
+ def addtag(tag)
+ @c.addtag(tag, 'with', @id)
+ self
+ end
+
+ def bbox
+ @c.bbox(@id)
+ end
+
+ def bind(seq, cmd=Proc.new, args=nil)
+ @c.itembind @id, seq, cmd, args
+ self
+ end
+
+ def bind_append(seq, cmd=Proc.new, args=nil)
+ @c.itembind_append @id, seq, cmd, args
+ self
+ end
+
+ def bind_remove(seq)
+ @c.itembind_remove @id, seq
+ self
+ end
+
+ def bindinfo(seq=nil)
+ @c.itembindinfo @id, seq
+ end
+
+ def cget(option)
+ @c.itemcget @id, option
+ end
+
+ def configure(key, value=None)
+ @c.itemconfigure @id, key, value
+ self
+ end
+# def configure(keys)
+# @c.itemconfigure @id, keys
+# end
+
+ def configinfo(key=nil)
+ @c.itemconfiginfo @id, key
+ end
+
+ def current_configinfo(key=nil)
+ @c.current_itemconfiginfo @id, key
+ end
+
+ def coords(*args)
+ @c.coords @id, *args
+ end
+
+ def dchars(first, last=None)
+ @c.dchars @id, first, last
+ self
+ end
+
+ def dtag(tag_to_del=None)
+ @c.dtag @id, tag_to_del
+ self
+ end
+
+ def find
+ @c.find 'withtag', @id
+ end
+ alias list find
+
+ def focus
+ @c.itemfocus @id
+ end
+
+ def gettags
+ @c.gettags @id
+ end
+
+ def icursor(index)
+ @c.icursor @id, index
+ self
+ end
+
+ def index(index)
+ @c.index @id, index
+ end
+
+ def insert(beforethis, string)
+ @c.insert @id, beforethis, string
+ self
+ end
+
+ def lower(belowthis=None)
+ @c.lower @id, belowthis
+ self
+ end
+
+ def move(xamount, yamount)
+ @c.move @id, xamount, yamount
+ self
+ end
+
+ def raise(abovethis=None)
+ @c.raise @id, abovethis
+ self
+ end
+
+ def scale(xorigin, yorigin, xscale, yscale)
+ @c.scale @id, xorigin, yorigin, xscale, yscale
+ self
+ end
+
+ def select_adjust(index)
+ @c.select('adjust', @id, index)
+ self
+ end
+ def select_from(index)
+ @c.select('from', @id, index)
+ self
+ end
+ def select_to(index)
+ @c.select('to', @id, index)
+ self
+ end
+
+ def itemtype
+ @c.itemtype @id
+ end
+
+ # Following operators support logical expressions of canvas tags
+ # (for Tk8.3+).
+ # If tag1.path is 't1' and tag2.path is 't2', then
+ # ltag = tag1 & tag2; ltag.path => "(t1)&&(t2)"
+ # ltag = tag1 | tag2; ltag.path => "(t1)||(t2)"
+ # ltag = tag1 ^ tag2; ltag.path => "(t1)^(t2)"
+ # ltag = - tag1; ltag.path => "!(t1)"
+ def & (tag)
+ if tag.kind_of? TkObject
+ TkcTagString.new(@c, '(' + @id + ')&&(' + tag.path + ')')
+ else
+ TkcTagString.new(@c, '(' + @id + ')&&(' + tag.to_s + ')')
+ end
+ end
+
+ def | (tag)
+ if tag.kind_of? TkObject
+ TkcTagString.new(@c, '(' + @id + ')||(' + tag.path + ')')
+ else
+ TkcTagString.new(@c, '(' + @id + ')||(' + tag.to_s + ')')
+ end
+ end
+
+ def ^ (tag)
+ if tag.kind_of? TkObject
+ TkcTagString.new(@c, '(' + @id + ')^(' + tag.path + ')')
+ else
+ TkcTagString.new(@c, '(' + @id + ')^(' + tag.to_s + ')')
+ end
+ end
+
+ def -@
+ TkcTagString.new(@c, '!(' + @id + ')')
+ end
+end
+
+class TkcTag<TkObject
+ include TkcTagAccess
+
+ CTagID_TBL = TkCore::INTERP.create_table
+ Tk_CanvasTag_ID = ['ctag'.freeze, '00000'.taint].freeze
+
+ TkCore::INTERP.init_ip_env{ CTagID_TBL.clear }
+
+ def TkcTag.id2obj(canvas, id)
+ cpath = canvas.path
+ return id unless CTagID_TBL[cpath]
+ CTagID_TBL[cpath][id]? CTagID_TBL[cpath][id]: id
+ end
+
+ def initialize(parent, mode=nil, *args)
+ unless parent.kind_of?(TkCanvas)
+ fail ArguemntError, "expect TkCanvas for 1st argument"
+ end
+ @c = parent
+ @cpath = parent.path
+ @path = @id = Tk_CanvasTag_ID.join('')
+ CTagID_TBL[@cpath] = {} unless CTagID_TBL[@cpath]
+ CTagID_TBL[@cpath][@id] = self
+ Tk_CanvasTag_ID[1].succ!
+ if mode
+ tk_call_without_enc(@c.path, "addtag", @id, mode, *args)
+ end
+ end
+ def id
+ @id
+ end
+
+ def delete
+ @c.delete @id
+ CTagID_TBL[@cpath].delete(@id) if CTagID_TBL[@cpath]
+ self
+ end
+ alias remove delete
+ alias destroy delete
+
+ def set_to_above(target)
+ @c.addtag_above(@id, target)
+ self
+ end
+ alias above set_to_above
+
+ def set_to_all
+ @c.addtag_all(@id)
+ self
+ end
+ alias all set_to_all
+
+ def set_to_below(target)
+ @c.addtag_below(@id, target)
+ self
+ end
+ alias below set_to_below
+
+ def set_to_closest(x, y, halo=None, start=None)
+ @c.addtag_closest(@id, x, y, halo, start)
+ self
+ end
+ alias closest set_to_closest
+
+ def set_to_enclosed(x1, y1, x2, y2)
+ @c.addtag_enclosed(@id, x1, y1, x2, y2)
+ self
+ end
+ alias enclosed set_to_enclosed
+
+ def set_to_overlapping(x1, y1, x2, y2)
+ @c.addtag_overlapping(@id, x1, y1, x2, y2)
+ self
+ end
+ alias overlapping set_to_overlapping
+
+ def set_to_withtag(target)
+ @c.addtag_withtag(@id, target)
+ self
+ end
+ alias withtag set_to_withtag
+end
+
+class TkcTagString<TkcTag
+ def self.new(parent, name, *args)
+ if CTagID_TBL[parent.path] && CTagID_TBL[parent.path][name]
+ return CTagID_TBL[parent.path][name]
+ else
+ super(parent, name, *args)
+ end
+ end
+
+ def initialize(parent, name, mode=nil, *args)
+ unless parent.kind_of?(TkCanvas)
+ fail ArguemntError, "expect TkCanvas for 1st argument"
+ end
+ @c = parent
+ @cpath = parent.path
+ @path = @id = name
+ CTagID_TBL[@cpath] = {} unless CTagID_TBL[@cpath]
+ CTagID_TBL[@cpath][@id] = self
+ if mode
+ tk_call_without_enc(@c.path, "addtag", @id, mode, *args)
+ end
+ end
+end
+TkcNamedTag = TkcTagString
+
+class TkcTagAll<TkcTag
+ def initialize(parent)
+ unless parent.kind_of?(TkCanvas)
+ fail ArguemntError, "expect TkCanvas for 1st argument"
+ end
+ @c = parent
+ @cpath = parent.path
+ @path = @id = 'all'
+ CTagID_TBL[@cpath] = {} unless CTagID_TBL[@cpath]
+ CTagID_TBL[@cpath][@id] = self
+ end
+end
+
+class TkcTagCurrent<TkcTag
+ def initialize(parent)
+ unless parent.kind_of?(TkCanvas)
+ fail ArguemntError, "expect TkCanvas for 1st argument"
+ end
+ @c = parent
+ @cpath = parent.path
+ @path = @id = 'current'
+ CTagID_TBL[@cpath] = {} unless CTagID_TBL[@cpath]
+ CTagID_TBL[@cpath][@id] = self
+ end
+end
+
+class TkcGroup<TkcTag
+ Tk_cGroup_ID = ['tkcg'.freeze, '00000'.taint].freeze
+ def create_self(parent, *args)
+ unless parent.kind_of?(TkCanvas)
+ fail ArguemntError, "expect TkCanvas for 1st argument"
+ end
+ @c = parent
+ @cpath = parent.path
+ @path = @id = Tk_cGroup_ID.join('')
+ CTagID_TBL[@cpath] = {} unless CTagID_TBL[@cpath]
+ CTagID_TBL[@cpath][@id] = self
+ Tk_cGroup_ID[1].succ!
+ add(*args) if args != []
+ end
+ private :create_self
+
+ def include(*tags)
+ for i in tags
+ i.addtag @id
+ end
+ self
+ end
+
+ def exclude(*tags)
+ for i in tags
+ i.delete @id
+ end
+ self
+ end
+end
diff --git a/ext/tk/lib/tk/checkbutton.rb b/ext/tk/lib/tk/checkbutton.rb
new file mode 100644
index 0000000000..a1ee5e8764
--- /dev/null
+++ b/ext/tk/lib/tk/checkbutton.rb
@@ -0,0 +1,25 @@
+#
+# tk/checkbutton.rb : treat checkbutton widget
+#
+require 'tk'
+require 'tk/radiobutton'
+
+class TkCheckButton<TkRadioButton
+ TkCommandNames = ['checkbutton'.freeze].freeze
+ WidgetClassName = 'Checkbutton'.freeze
+ WidgetClassNames[WidgetClassName] = self
+ def create_self(keys)
+ if keys and keys != None
+ tk_call_without_enc('checkbutton', @path, *hash_kv(keys, true))
+ else
+ tk_call_without_enc('checkbutton', @path)
+ end
+ end
+ private :create_self
+
+ def toggle
+ tk_send_without_enc('toggle')
+ self
+ end
+end
+TkCheckbutton = TkCheckButton
diff --git a/ext/tk/lib/tk/clipboard.rb b/ext/tk/lib/tk/clipboard.rb
new file mode 100644
index 0000000000..d4205a5c28
--- /dev/null
+++ b/ext/tk/lib/tk/clipboard.rb
@@ -0,0 +1,75 @@
+#
+# tk/clipboard.rb : methods to treat clipboard
+#
+require 'tk'
+
+module TkClipboard
+ include Tk
+ extend Tk
+
+ TkCommandNames = ['clipboard'.freeze].freeze
+
+ def self.clear(win=nil)
+ if win
+ tk_call_without_enc('clipboard', 'clear', '-displayof', win)
+ else
+ tk_call_without_enc('clipboard', 'clear')
+ end
+ end
+ def self.clear_on_display(win)
+ tk_call_without_enc('clipboard', 'clear', '-displayof', win)
+ end
+
+ def self.get(type=nil)
+ if type
+ tk_call_without_enc('clipboard', 'get', '-type', type)
+ else
+ tk_call_without_enc('clipboard', 'get')
+ end
+ end
+ def self.get_on_display(win, type=nil)
+ if type
+ tk_call_without_enc('clipboard', 'get', '-displayof', win, '-type', type)
+ else
+ tk_call_without_enc('clipboard', 'get', '-displayof', win)
+ end
+ end
+
+ def self.set(data, keys=nil)
+ clear
+ append(data, keys)
+ end
+ def self.set_on_display(win, data, keys=nil)
+ clear(win)
+ append_on_display(win, data, keys)
+ end
+
+ def self.append(data, keys=nil)
+ args = ['clipboard', 'append']
+ args.concat(hash_kv(keys))
+ args.concat(['--', data])
+ tk_call(*args)
+ end
+ def self.append_on_display(win, data, keys=nil)
+ args = ['clipboard', 'append', '-displayof', win]
+ args.concat(hash_kv(keys))
+ args.concat(['--', data])
+ tk_call(*args)
+ end
+
+ def clear
+ TkClipboard.clear_on_display(self)
+ self
+ end
+ def get(type=nil)
+ TkClipboard.get_on_display(self, type)
+ end
+ def set(data, keys=nil)
+ TkClipboard.set_on_display(self, data, keys)
+ self
+ end
+ def append(data, keys=nil)
+ TkClipboard.append_on_display(self, data, keys)
+ self
+ end
+end
diff --git a/ext/tk/lib/tk/clock.rb b/ext/tk/lib/tk/clock.rb
new file mode 100644
index 0000000000..88b66129ea
--- /dev/null
+++ b/ext/tk/lib/tk/clock.rb
@@ -0,0 +1,57 @@
+#
+# tk/clock.rb : methods for clock command
+#
+require 'tk'
+
+module Tk
+ module Clock
+ def self.clicks(ms=nil)
+ case ms
+ when nil
+ tk_call_without_enc('clock','clicks').to_i
+ when /^mic/
+ tk_call_without_enc('clock','clicks','-microseconds').to_i
+ when /^mil/
+ tk_call_without_enc('clock','clicks','-milliseconds').to_i
+ else
+ tk_call_without_enc('clock','clicks','-milliseconds').to_i
+ end
+ end
+
+ def self.format(clk, form=nil)
+ if form
+ tk_call('clock','format',clk,'-format',form)
+ else
+ tk_call('clock','format',clk)
+ end
+ end
+
+ def self.formatGMT(clk, form=nil)
+ if form
+ tk_call('clock','format',clk,'-format',form,'-gmt','1')
+ else
+ tk_call('clock','format',clk,'-gmt','1')
+ end
+ end
+
+ def self.scan(str, base=nil)
+ if base
+ tk_call('clock','scan',str,'-base',base).to_i
+ else
+ tk_call('clock','scan',str).to_i
+ end
+ end
+
+ def self.scanGMT(str, base=nil)
+ if base
+ tk_call('clock','scan',str,'-base',base,'-gmt','1').to_i
+ else
+ tk_call('clock','scan',str,'-gmt','1').to_i
+ end
+ end
+
+ def self.seconds
+ tk_call_without_enc('clock','seconds').to_i
+ end
+ end
+end
diff --git a/ext/tk/lib/tk/composite.rb b/ext/tk/lib/tk/composite.rb
new file mode 100644
index 0000000000..ed7796aafb
--- /dev/null
+++ b/ext/tk/lib/tk/composite.rb
@@ -0,0 +1,64 @@
+#
+# tk/composite.rb :
+#
+require 'tk'
+
+module TkComposite
+ include Tk
+ extend Tk
+
+ def initialize(parent=nil, *args)
+ @delegates = {}
+
+ if parent.kind_of? Hash
+ keys = _symbolkey2str(parent)
+ parent = keys.delete('parent')
+ @frame = TkFrame.new(parent)
+ @delegates['DEFAULT'] = @frame
+ @path = @epath = @frame.path
+ initialize_composite(keys)
+ else
+ @frame = TkFrame.new(parent)
+ @delegates['DEFAULT'] = @frame
+ @path = @epath = @frame.path
+ initialize_composite(*args)
+ end
+ end
+
+ def epath
+ @epath
+ end
+
+ def initialize_composite(*args) end
+ private :initialize_composite
+
+ def delegate(option, *wins)
+ if @delegates[option].kind_of?(Array)
+ for i in wins
+ @delegates[option].push(i)
+ end
+ else
+ @delegates[option] = wins
+ end
+ end
+
+ def configure(slot, value=None)
+ if slot.kind_of? Hash
+ slot.each{|slot,value| configure slot, value}
+ else
+ if @delegates and @delegates[slot]
+ for i in @delegates[slot]
+ if not i
+ i = @delegates['DEFALUT']
+ redo
+ else
+ last = i.configure(slot, value)
+ end
+ end
+ last
+ else
+ super
+ end
+ end
+ end
+end
diff --git a/ext/tk/lib/tk/console.rb b/ext/tk/lib/tk/console.rb
new file mode 100644
index 0000000000..855ee6a94f
--- /dev/null
+++ b/ext/tk/lib/tk/console.rb
@@ -0,0 +1,29 @@
+#
+# tk/console.rb : control the console on system without a real console
+#
+require 'tk'
+
+module TkConsole
+ include Tk
+ extend Tk
+
+ TkCommandNames = ['console'.freeze].freeze
+
+ def self.title(str=None)
+ tk_call 'console', str
+ end
+ def self.hide
+ tk_call_without_enc('console', 'hide')
+ end
+ def self.show
+ tk_call_without_enc('console', 'show')
+ end
+ def self.eval(tcl_script)
+ #
+ # supports a Tcl script only
+ # I have no idea to support a Ruby script seamlessly.
+ #
+ _fromUTF8(tk_call_without_enc('console', 'eval',
+ _get_eval_enc_str(tcl_script)))
+ end
+end
diff --git a/ext/tk/lib/tk/dialog.rb b/ext/tk/lib/tk/dialog.rb
new file mode 100644
index 0000000000..30521e126a
--- /dev/null
+++ b/ext/tk/lib/tk/dialog.rb
@@ -0,0 +1,290 @@
+#
+# tk/dialog.rb : create dialog boxes
+#
+require 'tk'
+
+class TkDialog2 < TkWindow
+ extend Tk
+
+ TkCommandNames = ['tk_dialog'.freeze].freeze
+
+ def self.show(*args)
+ dlog = self.new(*args)
+ dlog.show
+ dlog
+ end
+
+ 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 " +
+ "to the dialog button#{i}. It was removed.\n")
+ end
+ c.delete('command'); c.delete(:command)
+ # @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(' ')+'; '
+ }
+ case configs
+ when Proc
+ @buttons.each_index{|i|
+ if (c = configs.call(i)).kind_of? Hash
+ set_config.call(c,i)
+ end
+ }
+
+ when Array
+ @buttons.each_index{|i|
+ if (c = configs[i]).kind_of? Hash
+ set_config.call(c,i)
+ end
+ }
+
+ when Hash
+ @buttons.each_with_index{|s,i|
+ if (c = configs[s]).kind_of? Hash
+ set_config.call(c,i)
+ end
+ }
+ end
+ @config = 'after idle {' + @config + '};' if @config != ""
+ end
+ private :_set_button_config
+
+ # initialize tk_dialog
+ def create_self(keys)
+ #@var = TkVariable.new
+ @val = nil
+
+ @title = title
+
+ @message = message
+ @message_config = message_config
+ @msgframe_config = msgframe_config
+
+ @bitmap = bitmap
+ @bitmap_config = message_config
+
+ @default_button = default_button
+
+ @buttons = buttons
+ @button_configs = proc{|num| button_configs(num)}
+ @btnframe_config = btnframe_config
+
+ #@config = "puts [winfo children .w0000];"
+ @config = ""
+
+ @command = nil
+
+ if keys.kind_of? Hash
+ @title = keys['title'] if keys.key? 'title'
+ @message = keys['message'] if keys.key? 'message'
+ @bitmap = keys['bitmap'] if keys.key? 'bitmap'
+ @bitmap = '{}' if @bitmap == nil || @bitmap == ""
+ @default_button = keys['default'] if keys.key? 'default'
+ @buttons = keys['buttons'] if keys.key? 'buttons'
+
+ @command = keys['prev_command']
+
+ @message_config = keys['message_config'] if keys.key? 'message_config'
+ @msgframe_config = keys['msgframe_config'] if keys.key? 'msgframe_config'
+ @bitmap_config = keys['bitmap_config'] if keys.key? 'bitmap_config'
+ @button_configs = keys['button_configs'] if keys.key? 'button_configs'
+ @btnframe_config = keys['btnframe_config'] if keys.key? 'btnframe_config'
+ end
+
+ if @title.include? ?\s
+ @title = '{' + @title + '}'
+ end
+
+ if @buttons.kind_of? Array
+ _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
+ if @buttons.kind_of? Hash
+ _set_button_config(@buttons)
+ @buttons = @buttons.keys
+ end
+ @buttons = tk_split_simplelist(@buttons) if @buttons.kind_of? String
+ @buttons = @buttons.collect{|s|
+ if s.kind_of? Array
+ s = s.join(' ')
+ end
+ if s.include? ?\s
+ '{' + s + '}'
+ else
+ s
+ end
+ }
+
+ if @message_config.kind_of? Hash
+ # @config << Kernel.format("%s.msg configure %s;",
+ # @path, hash_kv(@message_config).join(' '))
+ @config << @path+'.msg configure '+hash_kv(@message_config).join(' ')+';'
+ end
+
+ if @msgframe_config.kind_of? Hash
+ # @config << Kernel.format("%s.top configure %s;",
+ # @path, hash_kv(@msgframe_config).join(' '))
+ @config << @path+'.top configure '+hash_kv(@msgframe_config).join(' ')+';'
+ end
+
+ if @btnframe_config.kind_of? Hash
+ # @config << Kernel.format("%s.bot configure %s;",
+ # @path, hash_kv(@btnframe_config).join(' '))
+ @config << @path+'.bot configure '+hash_kv(@btnframe_config).join(' ')+';'
+ end
+
+ if @bitmap_config.kind_of? Hash
+ # @config << Kernel.format("%s.bitmap configure %s;",
+ # @path, hash_kv(@bitmap_config).join(' '))
+ @config << @path+'.bitmap configure '+hash_kv(@bitmap_config).join(' ')+';'
+ end
+
+ _set_button_config(@button_configs) if @button_configs
+
+ if @command.kind_of? Proc
+ @command.call(self)
+ end
+ end
+ private :create_self
+
+ def show
+ if @default_button.kind_of? String
+ default_button = @buttons.index(@default_button)
+ else
+ default_button = @default_button
+ end
+ default_button = '{}' if default_button == nil
+ #Tk.ip_eval('eval {global '+@var.id+';'+@config+
+ # '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 + ' ' +
+ String(default_button) + ' ' + @buttons.join(' ')).to_i
+ end
+
+ def value
+ # @var.value.to_i
+ @val
+ end
+ ######################################################
+ # #
+ # these methods must be overridden for each dialog #
+ # #
+ ######################################################
+ private
+
+ def title
+ # returns a title string of the dialog window
+ return "DIALOG"
+ end
+ def message
+ # returns a message text to display on the dialog
+ return "MESSAGE"
+ end
+ def message_config
+ # returns a Hash {option=>value, ...} for the message text
+ return nil
+ end
+ def msgframe_config
+ # returns a Hash {option=>value, ...} for the message text frame
+ return nil
+ end
+ def bitmap
+ # returns a bitmap name or a bitmap file path
+ # (@ + path ; e.g. '@/usr/share/bitmap/sample.xbm')
+ return "info"
+ end
+ def bitmap_config
+ # returns nil or a Hash {option=>value, ...} for the bitmap
+ return nil
+ end
+ def default_button
+ # returns a default button's number or name
+ # if nil or null string, set no-default
+ return 0
+ end
+ def buttons
+ #return "BUTTON1 BUTTON2"
+ return ["BUTTON1", "BUTTON2"]
+ end
+ def button_configs(num)
+ # returns nil / Proc / Array or Hash (see _set_button_config)
+ return nil
+ end
+ def btnframe_config
+ # returns nil or a Hash {option=>value, ...} for the button frame
+ return nil
+ end
+end
+
+
+#
+# TkDialog : with showing at initialize
+#
+class TkDialog < TkDialog2
+ def self.show(*args)
+ self.new(*args)
+ end
+
+ def initialize(*args)
+ super(*args)
+ show
+ end
+end
+
+
+#
+# dialog for warning
+#
+class TkWarning2 < TkDialog2
+ def initialize(parent = nil, mes = nil)
+ if !mes
+ if parent.kind_of? TkWindow
+ mes = ""
+ else
+ mes = parent.to_s
+ parent = nil
+ end
+ end
+ super(parent, :message=>mes)
+ end
+
+ def show(mes = nil)
+ mes_bup = @message
+ @message = mes if mes
+ ret = super()
+ @message = mes_bup
+ ret
+ end
+
+ #######
+ private
+
+ def title
+ return "WARNING";
+ end
+ def bitmap
+ return "warning";
+ end
+ def default_button
+ return 0;
+ end
+ def buttons
+ return "OK";
+ end
+end
+
+class TkWarning < TkWarning2
+ def self.show(*args)
+ self.new(*args)
+ end
+ def initialize(*args)
+ super(*args)
+ show
+ end
+end
diff --git a/ext/tk/lib/tk/encodedstr.rb b/ext/tk/lib/tk/encodedstr.rb
new file mode 100644
index 0000000000..5eb989f420
--- /dev/null
+++ b/ext/tk/lib/tk/encodedstr.rb
@@ -0,0 +1,107 @@
+#
+# tk/encodedstr.rb : Tk::EncodedString class
+#
+require 'tk'
+
+###########################################
+# string with Tcl's encoding
+###########################################
+module Tk
+ class EncodedString < String
+ Encoding = nil
+
+ def self.subst_utf_backslash(str)
+ # str.gsub(/\\u([0-9A-Fa-f]{1,4})/){[$1.hex].pack('U')}
+ TclTkLib._subst_UTF_backslash(str)
+ end
+ def self.utf_backslash(str)
+ self.subst_utf_backslash(str)
+ end
+
+ def self.subst_tk_backslash(str)
+ TclTkLib._subst_Tcl_backslash(str)
+ end
+
+ def self.utf_to_backslash_sequence(str)
+ str.unpack('U*').collect{|c|
+ if c <= 0xFF # ascii character
+ c.chr
+ else
+ format('\u%X', c)
+ end
+ }.join('')
+ end
+ def self.utf_to_backslash(str)
+ self.utf_to_backslash_sequence(str)
+ end
+
+ def self.to_backslash_sequence(str)
+ str.unpack('U*').collect{|c|
+ if c <= 0x1F # control character
+ case c
+ when 0x07; '\a'
+ when 0x08; '\b'
+ when 0x09; '\t'
+ when 0x0a; '\n'
+ when 0x0b; '\v'
+ when 0x0c; '\f'
+ when 0x0d; '\r'
+ else
+ format('\x%02X', c)
+ end
+ elsif c <= 0xFF # ascii character
+ c.chr
+ else
+ format('\u%X', c)
+ end
+ }.join('')
+ end
+
+ def self.new_with_utf_backslash(str, enc = nil)
+ self.new('', enc).replace(self.subst_utf_backslash(str))
+ end
+
+ def self.new_without_utf_backslash(str, enc = nil)
+ self.new('', enc).replace(str)
+ end
+
+ def initialize(str, enc = nil)
+ super(str)
+ @encoding = ( enc ||
+ ((self.class::Encoding)?
+ self.class::Encoding : Tk.encoding_system) )
+ end
+
+ attr_reader :encoding
+ end
+ # def Tk.EncodedString(str, enc = nil)
+ # Tk::EncodedString.new(str, enc)
+ # end
+
+ ##################################
+
+ class BinaryString < EncodedString
+ Encoding = 'binary'.freeze
+ end
+ # def Tk.BinaryString(str)
+ # Tk::BinaryString.new(str)
+ # end
+
+ ##################################
+
+ class UTF8_String < EncodedString
+ Encoding = 'utf-8'.freeze
+ def self.new(str)
+ super(self.subst_utf_backslash(str))
+ end
+
+ def to_backslash_sequence
+ Tk::EncodedString.utf_to_backslash_sequence(self)
+ end
+ alias to_backslash to_backslash_sequence
+ end
+ # def Tk.UTF8_String(str)
+ # Tk::UTF8_String.new(str)
+ # end
+
+end
diff --git a/ext/tk/lib/tk/entry.rb b/ext/tk/lib/tk/entry.rb
new file mode 100644
index 0000000000..2077c1e9e4
--- /dev/null
+++ b/ext/tk/lib/tk/entry.rb
@@ -0,0 +1,114 @@
+#
+# tk/entry.rb - Tk entry classes
+# $Date$
+# by Yukihiro Matsumoto <matz@caelum.co.jp>
+
+require 'tk'
+require 'tk/label'
+require 'tk/scrollable'
+require 'tk/validation'
+
+class TkEntry<TkLabel
+ include Scrollable
+ include TkValidation
+
+ TkCommandNames = ['entry'.freeze].freeze
+ WidgetClassName = 'Entry'.freeze
+ WidgetClassNames[WidgetClassName] = self
+
+
+ def create_self(keys)
+ tk_call_without_enc('entry', @path)
+ if keys and keys != None
+ configure(keys)
+ end
+ end
+ private :create_self
+
+ def bbox(index)
+ list(tk_send_without_enc('bbox', index))
+ end
+ def cursor
+ number(tk_send_without_enc('index', 'insert'))
+ end
+ def cursor=(index)
+ tk_send_without_enc('icursor', index)
+ #self
+ index
+ end
+ def index(index)
+ number(tk_send_without_enc('index', index))
+ end
+ def insert(pos,text)
+ tk_send_without_enc('insert', pos, _get_eval_enc_str(text))
+ self
+ end
+ def delete(first, last=None)
+ tk_send_without_enc('delete', first, last)
+ self
+ end
+ def mark(pos)
+ tk_send_without_enc('scan', 'mark', pos)
+ self
+ end
+ def dragto(pos)
+ tk_send_without_enc('scan', 'dragto', pos)
+ self
+ end
+ def selection_adjust(index)
+ tk_send_without_enc('selection', 'adjust', index)
+ self
+ end
+ def selection_clear
+ tk_send_without_enc('selection', 'clear')
+ self
+ end
+ def selection_from(index)
+ tk_send_without_enc('selection', 'from', index)
+ self
+ end
+ def selection_present()
+ bool(tk_send_without_enc('selection', 'present'))
+ end
+ def selection_range(s, e)
+ tk_send_without_enc('selection', 'range', s, e)
+ self
+ end
+ def selection_to(index)
+ tk_send_without_enc('selection', 'to', index)
+ self
+ end
+
+ def invoke_validate
+ bool(tk_send_without_enc('validate'))
+ end
+ def validate(mode = nil)
+ if mode
+ configure 'validate', mode
+ else
+ invoke_validate
+ end
+ end
+
+ def value
+ _fromUTF8(tk_send_without_enc('get'))
+ end
+ def value= (val)
+ tk_send_without_enc('delete', 0, 'end')
+ tk_send_without_enc('insert', 0, _get_eval_enc_str(val))
+ val
+ end
+ alias get value
+ alias set value=
+
+ def [](*args)
+ self.value[*args]
+ end
+ def []=(*args)
+ val = args.pop
+ str = self.value
+ str[*args] = val
+ self.value = str
+ val
+ end
+end
diff --git a/ext/tk/lib/tk/event.rb b/ext/tk/lib/tk/event.rb
new file mode 100644
index 0000000000..b85c456d41
--- /dev/null
+++ b/ext/tk/lib/tk/event.rb
@@ -0,0 +1,142 @@
+#
+# tk/event.rb - module for event
+#
+require 'tk'
+
+module TkEvent
+ class Event < TkUtil::CallbackSubst
+ module TypeNum
+ KeyPress = 2
+ KeyRelease = 3
+ ButtonPress = 4
+ ButtonRelease = 5
+ MotionNotify = 6
+ EnterNotify = 7
+ LeaveNotify = 8
+ FocusIn = 9
+ FocusOut = 10
+ KeymapNotify = 11
+ Expose = 12
+ GraphicsExpose = 13
+ NoExpose = 14
+ VisibilityNotify = 15
+ CreateNotify = 16
+ DestroyNotify = 17
+ UnmapNotify = 18
+ MapNotify = 19
+ MapRequest = 20
+ ReparentNotify = 21
+ ConfigureNotify = 22
+ ConfigureRequest = 23
+ GravityNotify = 24
+ ResizeRequest = 25
+ CirculateNotify = 26
+ CirculateRequest = 27
+ PropertyNotify = 28
+ SelectionClear = 29
+ SelectionRequest = 30
+ SelectionNotify = 31
+ ColormapNotify = 32
+ ClientMessage = 33
+ MappingNotify = 34
+ end
+
+ # [ <'%' 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 ],
+ [ ?f, ?b, :focus ],
+ [ ?h, ?n, :height ],
+ [ ?i, ?s, :win_hex ],
+ [ ?k, ?n, :keycode ],
+ [ ?m, ?s, :mode ],
+ [ ?o, ?b, :override ],
+ [ ?p, ?s, :place ],
+ [ ?s, ?x, :state ],
+ [ ?t, ?n, :time ],
+ [ ?w, ?n, :width ],
+ [ ?x, ?n, :x ],
+ [ ?y, ?n, :y ],
+ [ ?A, ?s, :char ],
+ [ ?B, ?n, :borderwidth ],
+ [ ?D, ?n, :wheel_delta ],
+ [ ?E, ?b, :send_event ],
+ [ ?K, ?s, :keysym ],
+ [ ?N, ?n, :keysym_num ],
+ [ ?R, ?s, :rootwin_id ],
+ [ ?S, ?s, :subwindow ],
+ [ ?T, ?n, :type ],
+ [ ?W, ?w, :widget ],
+ [ ?X, ?n, :x_root ],
+ [ ?Y, ?n, :y_root ],
+ nil
+ ]
+
+ # [ <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) ],
+
+ [ ?x, proc{|val|
+ begin
+ TkComm::number(val)
+ rescue ArgumentError
+ val
+ end
+ }
+ ],
+
+ nil
+ ]
+
+ # 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.
+ #
+ # 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);
+ end
+
+ def install_bind(cmd, *args)
+ if args.compact.size > 0
+ args = args.join(' ')
+ keys = Event._get_subst_key(args)
+
+ if cmd.kind_of?(String)
+ id = cmd
+ elsif cmd.kind_of?(TkCallbackEntry)
+ id = install_cmd(cmd)
+ else
+ id = install_cmd(proc{|*arg|
+ TkUtil.eval_cmd(cmd, *Event.scan_args(keys, arg))
+ })
+ end
+ id + ' ' + args
+ else
+ keys, args = Event._get_all_subst_keys
+
+ if cmd.kind_of?(String)
+ id = cmd
+ elsif cmd.kind_of?(TkCallbackEntry)
+ id = install_cmd(cmd)
+ else
+ id = install_cmd(proc{|*arg|
+ TkUtil.eval_cmd(cmd, Event.new(*Event.scan_args(keys, arg)))
+ })
+ end
+ id + ' ' + args
+ end
+ end
+end
diff --git a/ext/tk/lib/tk/font.rb b/ext/tk/lib/tk/font.rb
new file mode 100644
index 0000000000..b8f7f1b991
--- /dev/null
+++ b/ext/tk/lib/tk/font.rb
@@ -0,0 +1,1407 @@
+#
+# tk/font.rb - the class to treat fonts on Ruby/Tk
+#
+# by Hidetoshi NAGAI (nagai@ai.kyutech.ac.jp)
+#
+require 'tk'
+
+class TkFont
+ include Tk
+ extend TkCore
+
+ TkCommandNames = ['font'.freeze].freeze
+
+ Tk_FontID = ["@font".freeze, "00000".taint].freeze
+ Tk_FontNameTBL = TkCore::INTERP.create_table
+ Tk_FontUseTBL = TkCore::INTERP.create_table
+
+ TkCore::INTERP.init_ip_env{
+ Tk_FontNameTBL.clear
+ Tk_FontUseTBL.clear
+ }
+
+ # set default font
+ case Tk::TK_VERSION
+ when /^4\.*/
+ DEFAULT_LATIN_FONT_NAME = 'a14'.freeze
+ DEFAULT_KANJI_FONT_NAME = 'k14'.freeze
+
+ when /^8\.*/
+ if JAPANIZED_TK
+ begin
+ fontnames = tk_call('font', 'names')
+ case fontnames
+ when /defaultgui/
+ # Tcl/Tk-JP for Windows
+ ltn = 'defaultgui'
+ 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',
+ '-compound'))
+ else
+ # unknown Tcl/Tk-JP
+ platform = tk_call('set', 'tcl_platform(platform)')
+ case platform
+ when 'unix'
+ ltn = {'family'=>'Helvetica'.freeze,
+ 'size'=>-12, 'weight'=>'bold'.freeze}
+ #knj = 'k14'
+ #knj = '-misc-fixed-medium-r-normal--14-*-*-*-c-*-jisx0208.1983-0'
+ knj = '-*-fixed-bold-r-normal--12-*-*-*-c-*-jisx0208.1983-0'
+ when 'windows'
+ ltn = {'family'=>'MS Sans Serif'.freeze, 'size'=>8}
+ knj = 'mincho'
+ when 'macintosh'
+ ltn = 'system'
+ knj = 'mincho'
+ else # unknown
+ ltn = 'Helvetica'
+ knj = 'mincho'
+ end
+ end
+ rescue
+ ltn = 'Helvetica'
+ knj = 'mincho'
+ end
+
+ else # not JAPANIZED_TK
+ begin
+ platform = tk_call('set', 'tcl_platform(platform)')
+ case platform
+ when 'unix'
+ ltn = {'family'=>'Helvetica'.freeze,
+ 'size'=>-12, 'weight'=>'bold'.freeze}
+ #knj = 'k14'
+ #knj = '-misc-fixed-medium-r-normal--14-*-*-*-c-*-jisx0208.1983-0'
+ knj = '-*-fixed-bold-r-normal--12-*-*-*-c-*-jisx0208.1983-0'
+ when 'windows'
+ ltn = {'family'=>'MS Sans Serif'.freeze, 'size'=>8}
+ knj = 'mincho'
+ when 'macintosh'
+ ltn = 'system'
+ knj = 'mincho'
+ else # unknown
+ ltn = 'Helvetica'
+ knj = 'mincho'
+ end
+ rescue
+ ltn = 'Helvetica'
+ knj = 'mincho'
+ end
+
+ knj = ltn
+ end
+
+ DEFAULT_LATIN_FONT_NAME = ltn.freeze
+ DEFAULT_KANJI_FONT_NAME = knj.freeze
+
+ else # unknown version
+ DEFAULT_LATIN_FONT_NAME = 'Helvetica'.freeze
+ DEFAULT_KANJI_FONT_NAME = 'mincho'.freeze
+
+ end
+
+ if $DEBUG
+ print "default latin font = "; p DEFAULT_LATIN_FONT_NAME
+ print "default kanji font = "; p DEFAULT_KANJI_FONT_NAME
+ end
+
+
+ ###################################
+ class DescendantFont
+ def initialize(compound, type)
+ unless compound.kind_of?(TkFont)
+ fail ArgumentError, "a TkFont object is expected for the 1st argument"
+ end
+ @compound = compound
+ case type
+ when 'kanji', 'latin', 'ascii'
+ @type = type
+ else
+ fail ArgumentError, "unknown type '#{type}'"
+ end
+ end
+
+ def dup
+ fail RuntimeError, "cannot dupulicate a descendant font"
+ end
+ def clone
+ fail RuntimeError, "cannot clone a descendant font"
+ end
+
+ def to_eval
+ @compound.__send__(@type + '_font_id')
+ end
+ def font
+ @compound.__send__(@type + '_font_id')
+ end
+
+ def [](slot)
+ @compound.__send__(@type + '_configinfo', slot)
+ end
+ def []=(slot, value)
+ @compound.__send__(@type + '_configure', slot, value)
+ value
+ end
+
+ def method_missing(id, *args)
+ @compound.__send__(@type + '_' + id.id2name, *args)
+ end
+ end
+
+
+ ###################################
+ # class methods
+ ###################################
+ def TkFont.families(window=nil)
+ case (Tk::TK_VERSION)
+ when /^4\.*/
+ ['fixed']
+
+ when /^8\.*/
+ if window
+ tk_split_simplelist(tk_call('font', 'families', '-displayof', window))
+ else
+ tk_split_simplelist(tk_call('font', 'families'))
+ end
+ end
+ end
+
+ def TkFont.names
+ case (Tk::TK_VERSION)
+ when /^4\.*/
+ r = ['fixed']
+ r += ['a14', 'k14'] if JAPANIZED_TK
+ Tk_FontNameTBL.each_value{|obj| r.push(obj)}
+ r | []
+
+ when /^8\.*/
+ tk_split_simplelist(tk_call('font', 'names'))
+
+ end
+ end
+
+ def TkFont.create_copy(font)
+ fail 'source-font must be a TkFont object' unless font.kind_of? TkFont
+ if TkComm::GET_CONFIGINFOwoRES_AS_ARRAY
+ keys = {}
+ font.configinfo.each{|key,value| keys[key] = value }
+ TkFont.new(font.latin_font_id, font.kanji_font_id, keys)
+ else # ! TkComm::GET_CONFIGINFOwoRES_AS_ARRAY
+ TkFont.new(font.latin_font_id, font.kanji_font_id, font.configinfo)
+ end
+ end
+
+ def TkFont.get_obj(name)
+ if name =~ /^(@font[0-9]+)(|c|l|k)$/
+ Tk_FontNameTBL[$1]
+ else
+ nil
+ end
+ end
+
+ def TkFont.init_widget_font(path, *args)
+ case (Tk::TK_VERSION)
+ when /^4\.*/
+ conf = tk_split_simplelist(tk_call(*args)).
+ find_all{|prop| prop[0..5]=='-font ' || prop[0..10]=='-kanjifont '}.
+ collect{|prop| tk_split_simplelist(prop)}
+ if font_inf = conf.assoc('-font')
+ ltn = font_inf[4]
+ ltn = nil if ltn == []
+ else
+ #ltn = nil
+ raise RuntimeError, "unknown option '-font'"
+ end
+ if font_inf = conf.assoc('-kanjifont')
+ knj = font_inf[4]
+ knj = nil if knj == []
+ else
+ knj = nil
+ end
+ TkFont.new(ltn, knj).call_font_configure(path, *(args + [{}]))
+
+ when /^8\.*/
+ font_prop = tk_split_simplelist(tk_call(*args)).find{|prop|
+ prop[0..5] == '-font '
+ }
+ unless font_prop
+ raise RuntimeError, "unknown option '-font'"
+ end
+ fnt = tk_split_simplelist(font_prop)[4]
+ if fnt == ""
+ TkFont.new(nil, nil).call_font_configure(path, *(args + [{}]))
+ else
+ begin
+ compound = tk_split_simplelist(
+ Hash[*tk_split_simplelist(tk_call('font', 'configure',
+ fnt))].collect{|key,value|
+ [key[1..-1], value]
+ }.assoc('compound')[1])
+ rescue
+ compound = []
+ end
+ if compound == []
+ #TkFont.new(fnt, DEFAULT_KANJI_FONT_NAME) \
+ #.call_font_configure(path, *(args + [{}]))
+ TkFont.new(fnt).call_font_configure(path, *(args + [{}]))
+ else
+ TkFont.new(compound[0], compound[1]) \
+ .call_font_configure(path, *(args + [{}]))
+ end
+ end
+ end
+ end
+
+ def TkFont.used_on(path=nil)
+ if path
+ Tk_FontUseTBL[path]
+ else
+ Tk_FontUseTBL.values | []
+ end
+ end
+
+ def TkFont.failsafe(font)
+ begin
+ if /^8\.*/ === Tk::TK_VERSION && JAPANIZED_TK
+ tk_call('font', 'failsafe', font)
+ end
+ rescue
+ end
+ end
+
+ ###################################
+ # instance methods
+ ###################################
+ private
+ ###################################
+ def initialize(ltn=nil, knj=nil, keys=nil)
+ @id = Tk_FontID.join('')
+ Tk_FontID[1].succ!
+ Tk_FontNameTBL[@id] = self
+
+ @latin_desscendant = nil
+ @kanji_desscendant = nil
+
+ if knj.kind_of?(Hash) && !keys
+ keys = knj
+ knj = nil
+ end
+
+ # compound font check
+ if Tk::TK_VERSION == '8.0' && JAPANIZED_TK
+ begin
+ compound = tk_split_simplelist(tk_call('font', 'configure',
+ ltn, '-compound'))
+ if knj == nil
+ if compound != []
+ ltn, knj = compound
+ end
+ else
+ if compound != []
+ ltn = compound[0]
+ end
+ compound = tk_split_simplelist(tk_call('font', 'configure',
+ knj, '-compound'))
+ if compound != []
+ knj = compound[1]
+ end
+ end
+ rescue
+ end
+ end
+
+ if ltn
+ if JAPANIZED_TK && !knj
+ if Tk::TK_VERSION =~ /^4.*/
+ knj = DEFAULT_KANJI_FONT_NAME
+ else
+ knj = ltn
+ end
+ end
+ else
+ ltn = DEFAULT_LATIN_FONT_NAME
+ knj = DEFAULT_KANJI_FONT_NAME if JAPANIZED_TK && !knj
+ end
+
+ create_compoundfont(ltn, knj, keys)
+ end
+
+ def _get_font_info_from_hash(font)
+ font = _symbolkey2str(font)
+ foundry = (info = font['foundry'] .to_s)? info: '*'
+ family = (info = font['family'] .to_s)? info: '*'
+ weight = (info = font['weight'] .to_s)? info: '*'
+ slant = (info = font['slant'] .to_s)? info: '*'
+ swidth = (info = font['swidth'] .to_s)? info: '*'
+ adstyle = (info = font['adstyle'] .to_s)? info: '*'
+ pixels = (info = font['pixels'] .to_s)? info: '*'
+ points = (info = font['points'] .to_s)? info: '*'
+ resx = (info = font['resx'] .to_s)? info: '*'
+ resy = (info = font['resy'] .to_s)? info: '*'
+ space = (info = font['space'] .to_s)? info: '*'
+ avgWidth = (info = font['avgWidth'].to_s)? info: '*'
+ charset = (info = font['charset'] .to_s)? info: '*'
+ encoding = (info = font['encoding'].to_s)? info: '*'
+
+ [foundry, family, weight, slant, swidth, adstyle,
+ pixels, points, resx, resy, space, avgWidth, charset, encoding]
+ end
+
+ def create_latinfont_tk4x(font)
+ if font.kind_of? Hash
+ @latinfont = '-' + _get_font_info_from_hash(font).join('-') + '-'
+
+ elsif font.kind_of? Array
+ finfo = {}
+ finfo['family'] = font[0].to_s
+ if font[1]
+ fsize = font[1].to_s
+ if fsize != '0' && fsize =~ /^(|\+|-)([0-9]+)$/
+ if $1 == '-'
+ finfo['pixels'] = $2
+ else
+ finfo['points'] = $2
+ end
+ else
+ finfo['points'] = '13'
+ end
+ end
+ font[2..-1].each{|style|
+ case (style)
+ when 'normal'
+ finfo['weight'] = style
+ when 'bold'
+ finfo['weight'] = style
+ when 'roman'
+ finfo['slant'] = 'r'
+ when 'italic'
+ finfo['slant'] = 'i'
+ end
+ }
+
+ @latinfont = '-' + _get_font_info_from_hash(finfo).join('-') + '-'
+
+ elsif font.kind_of? TkFont
+ @latinfont = font.latin_font
+
+ else
+ if font
+ @latinfont = font
+ else
+ @latinfont = DEFAULT_LATIN_FONT_NAME
+ end
+
+ end
+ end
+
+ def create_kanjifont_tk4x(font)
+ unless JAPANIZED_TK
+ @kanjifont = ""
+ return
+ end
+
+ if font.kind_of? Hash
+ @kanjifont = '-' + _get_font_info_from_hash(font).join('-') + '-'
+
+ elsif font.kind_of? Array
+ finfo = {}
+ finfo['family'] = font[0].to_s
+ if font[1]
+ fsize = font[1].to_s
+ if fsize != '0' && fsize =~ /^(|\+|-)([0-9]+)$/
+ if $1 == '-'
+ finfo['pixels'] = $2
+ else
+ finfo['points'] = $2
+ end
+ else
+ finfo['points'] = '13'
+ end
+ end
+ font[2..-1].each{|style|
+ case (style)
+ when 'normal'
+ finfo['weight'] = style
+ when 'bold'
+ finfo['weight'] = style
+ when 'roman'
+ finfo['slant'] = 'r'
+ when 'italic'
+ finfo['slant'] = 'i'
+ end
+ }
+
+ @kanjifont = '-' + _get_font_info_from_hash(finfo).join('-') + '-'
+ elsif font.kind_of? TkFont
+ @kanjifont = font.kanji_font_id
+ else
+ if font
+ @kanjifont = font
+ else
+ @kanjifont = DEFAULT_KANJI_FONT_NAME
+ end
+ end
+ end
+
+ def create_compoundfont_tk4x(ltn, knj, keys)
+ create_latinfont(ltn)
+ create_kanjifont(knj)
+
+ if JAPANIZED_TK
+ @compoundfont = [[@latinfont], [@kanjifont]]
+ @fontslot = {'font'=>@latinfont, 'kanjifont'=>@kanjifont}
+ else
+ @compoundfont = @latinfont
+ @fontslot = {'font'=>@latinfont}
+ end
+ end
+
+ def create_latinfont_tk8x(font)
+ @latinfont = @id + 'l'
+
+ if JAPANIZED_TK
+ if font.kind_of? Hash
+ if font[:charset] || font['charset']
+ tk_call('font', 'create', @latinfont, *hash_kv(font))
+ else
+ tk_call('font', 'create', @latinfont,
+ '-charset', 'iso8859', *hash_kv(font))
+ end
+ elsif font.kind_of? Array
+ tk_call('font', 'create', @latinfont, '-copy', array2tk_list(font))
+ tk_call('font', 'configure', @latinfont, '-charset', 'iso8859')
+ elsif font.kind_of? TkFont
+ tk_call('font', 'create', @latinfont, '-copy', font.latin_font)
+ elsif font
+ tk_call('font', 'create', @latinfont, '-copy', font,
+ '-charset', 'iso8859')
+ else
+ tk_call('font', 'create', @latinfont, '-charset', 'iso8859')
+ end
+ else
+ if font.kind_of? Hash
+ tk_call('font', 'create', @latinfont, *hash_kv(font))
+ else
+ keys = {}
+ if font.kind_of? Array
+ actual_core(array2tk_list(font)).each{|key,val| keys[key] = val}
+ elsif font.kind_of? TkFont
+ actual_core(font.latin_font).each{|key,val| keys[key] = val}
+ elsif font
+ actual_core(font).each{|key,val| keys[key] = val}
+ end
+ tk_call('font', 'create', @latinfont, *hash_kv(keys))
+ end
+
+ if font && @compoundfont
+ keys = {}
+ actual_core(@latinfont).each{|key,val| keys[key] = val}
+ tk_call('font', 'configure', @compoundfont, *hash_kv(keys))
+ end
+ end
+ end
+
+ def create_kanjifont_tk8x(font)
+ @kanjifont = @id + 'k'
+
+ if JAPANIZED_TK
+ if font.kind_of? Hash
+ if font[:charset] || font['charset']
+ tk_call('font', 'create', @kanjifont, *hash_kv(font))
+ else
+ tk_call('font', 'create', @kanjifont,
+ '-charset', 'jisx0208.1983', *hash_kv(font))
+ end
+ elsif font.kind_of? Array
+ tk_call('font', 'create', @kanjifont, '-copy', array2tk_list(font))
+ tk_call('font', 'configure', @kanjifont, '-charset', 'jisx0208.1983')
+ elsif font.kind_of? TkFont
+ tk_call('font', 'create', @kanjifont, '-copy', font.kanji_font_id)
+ elsif font
+ tk_call('font', 'create', @kanjifont, '-copy', font,
+ '-charset', 'jisx0208.1983')
+ else
+ tk_call('font', 'create', @kanjifont, '-charset', 'jisx0208.1983')
+ end
+ # end of JAPANIZED_TK
+
+ else
+ if font.kind_of? Hash
+ tk_call('font', 'create', @kanjifont, *hash_kv(font))
+ else
+ keys = {}
+ if font.kind_of? Array
+ actual_core(array2tk_list(font)).each{|key,val| keys[key] = val}
+ elsif font.kind_of? TkFont
+ actual_core(font.kanji_font_id).each{|key,val| keys[key] = val}
+ elsif font
+ actual_core(font).each{|key,val| keys[key] = val}
+ end
+ tk_call('font', 'create', @kanjifont, *hash_kv(keys))
+ end
+
+ if font && @compoundfont
+ keys = {}
+ actual_core(@kanjifont).each{|key,val| keys[key] = val}
+ tk_call('font', 'configure', @compoundfont, *hash_kv(keys))
+ end
+ end
+ end
+
+ def create_compoundfont_tk8x(ltn, knj, keys)
+ create_latinfont(ltn)
+ create_kanjifont(knj)
+
+ @compoundfont = @id + 'c'
+ if JAPANIZED_TK
+ unless keys
+ keys = {}
+ else
+ keys = keys.dup
+ end
+ if (tk_call('font', 'configure', @latinfont, '-underline') == '1' &&
+ tk_call('font', 'configure', @kanjifont, '-underline') == '1' &&
+ !keys.key?('underline'))
+ keys['underline'] = true
+ end
+ if (tk_call('font', 'configure', @latinfont, '-overstrike') == '1' &&
+ tk_call('font', 'configure', @kanjifont, '-overstrike') == '1' &&
+ !keys.key?('overstrike'))
+ keys['overstrike'] = true
+ end
+
+ @fontslot = {'font'=>@compoundfont}
+ begin
+ tk_call('font', 'create', @compoundfont,
+ '-compound', [@latinfont, @kanjifont], *hash_kv(keys))
+ rescue RuntimeError => e
+ if ltn == knj
+ if e.message =~ /kanji font .* specified/
+ tk_call('font', 'delete', @latinfont)
+ create_latinfont(DEFAULT_LATIN_FONT_NAME)
+ opts = []
+ Hash[*(tk_split_simplelist(tk_call('font', 'configure',
+ @kanjifont)))].each{|k,v|
+ case k
+ when '-size', '-weight', '-slant', '-underline', '-overstrike'
+ opts << k << v
+ end
+ }
+ tk_call('font', 'configure', @latinfont, *opts)
+ 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',
+ @latinfont)))].each{|k,v|
+ case k
+ when '-size', '-weight', '-slant', '-underline', '-overstrike'
+ opts << k << v
+ end
+ }
+ tk_call('font', 'configure', @kanjifont, *opts)
+ tk_call('font', 'create', @compoundfont,
+ '-compound', [@latinfont, @kanjifont], *hash_kv(keys))
+
+ else
+ raise e
+ end
+ else
+ raise e
+ end
+ end
+ else
+ tk_call('font', 'create', @compoundfont)
+
+ latinkeys = {}
+ begin
+ actual_core(@latinfont).each{|key,val| latinkeys[key] = val}
+ rescue
+ latinkeys {}
+ end
+ if latinkeys != {}
+ tk_call('font', 'configure', @compoundfont, *hash_kv(latinkeys))
+ end
+
+ if knj
+ kanjikeys = {}
+ begin
+ actual_core(@kanjifont).each{|key,val| kanjikeys[key] = val}
+ rescue
+ kanjikeys {}
+ end
+ if kanjikeys != {}
+ tk_call('font', 'configure', @compoundfont, *hash_kv(kanjikeys))
+ end
+ end
+
+ @fontslot = {'font'=>@compoundfont}
+ tk_call('font', 'configure', @compoundfont, *hash_kv(keys))
+ end
+ end
+
+ def actual_core_tk4x(font, window=nil, option=nil)
+ # dummy
+ if option
+ ""
+ else
+ [['family',[]], ['size',[]], ['weight',[]], ['slant',[]],
+ ['underline',[]], ['overstrike',[]], ['charset',[]],
+ ['pointadjust',[]]]
+ end
+ end
+
+ def actual_core_tk8x(font, window=nil, option=nil)
+ if option == 'compound'
+ ""
+ elsif option
+ if window
+ tk_call('font', 'actual', font, "-displayof", window, "-#{option}")
+ else
+ tk_call('font', 'actual', font, "-#{option}")
+ end
+ else
+ l = tk_split_simplelist(if window
+ tk_call('font', 'actual', font,
+ "-displayof", window)
+ else
+ tk_call('font', 'actual', font)
+ end)
+ r = []
+ while key=l.shift
+ if key == '-compound'
+ l.shift
+ else
+ r.push [key[1..-1], l.shift]
+ end
+ end
+ r
+ end
+ end
+
+ def configure_core_tk4x(font, slot, value=None)
+ #""
+ self
+ end
+
+ def configinfo_core_tk4x(font, option=nil)
+ # dummy
+ if TkComm::GET_CONFIGINFOwoRES_AS_ARRAY
+ if option
+ ""
+ else
+ [['family',[]], ['size',[]], ['weight',[]], ['slant',[]],
+ ['underline',[]], ['overstrike',[]], ['charset',[]],
+ ['pointadjust',[]]]
+ end
+ else # ! TkComm::GET_CONFIGINFOwoRES_AS_ARRAY
+ current_configinfo_core_tk4x(font, option)
+ end
+ end
+
+ def current_configinfo_core_tk4x(font, option=nil)
+ if option
+ ""
+ else
+ {'family'=>'', 'size'=>'', 'weight'=>'', 'slant'=>'',
+ 'underline'=>'', 'overstrike'=>'', 'charset'=>'', 'pointadjust'=>''}
+ end
+ end
+
+ def configure_core_tk8x(font, slot, value=None)
+ if JAPANIZED_TK
+ begin
+ padjust = tk_call('font', 'configure', font, '-pointadjust')
+ rescue
+ padjust = nil
+ end
+ else
+ padjust = nil
+ end
+ if slot.kind_of? Hash
+ if JAPANIZED_TK && (slot.key?('family') || slot.key?(:family))
+ slot = _symbolkey2str(slot)
+ configure_core_tk8x(font, 'family', slot.delete('family'))
+ end
+
+ if ((slot.key?('size') || slot.key?(:size)) &&
+ padjust && !slot.key?('pointadjust') && !slot.key?(:pointadjust))
+ 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,
+ "-#{slot}", value, '-pointadjust', padjust)
+ elsif JAPANIZED_TK && (slot == 'family' || slot == :family)
+ # coumpund font?
+ begin
+ compound = tk_split_simplelist(tk_call('font', 'configure',
+ font, '-compound'))
+ rescue
+ tk_call('font', 'configure', font, '-family', value)
+ return self
+ end
+ if compound == []
+ tk_call('font', 'configure', font, '-family', value)
+ return self
+ end
+ ltn, knj = compound
+
+ lfnt = tk_call('font', 'create', '-copy', ltn)
+ begin
+ tk_call('font', 'configure', lfnt, '-family', value)
+ latin_replace_core_tk8x(lfnt)
+ rescue RuntimeError => e
+ fail e if $DEBUG
+ ensure
+ tk_call('font', 'delete', lfnt) if lfnt != ''
+ end
+
+ kfnt = tk_call('font', 'create', '-copy', knj)
+ begin
+ tk_call('font', 'configure', kfnt, '-family', value)
+ kanji_replace_core_tk8x(lfnt)
+ rescue RuntimeError => e
+ fail e if $DEBUG
+ ensure
+ tk_call('font', 'delete', kfnt) if kfnt != ''
+ end
+
+ else
+ tk_call('font', 'configure', font, "-#{slot}", value)
+ end
+ self
+ end
+
+ def configinfo_core_tk8x(font, option=nil)
+ if TkComm::GET_CONFIGINFOwoRES_AS_ARRAY
+ if option == 'compound'
+ ""
+ elsif option
+ tk_call('font', 'configure', font, "-#{option}")
+ else
+ l = tk_split_simplelist(tk_call('font', 'configure', font))
+ r = []
+ while key=l.shift
+ if key == '-compound'
+ l.shift
+ else
+ r.push [key[1..-1], l.shift]
+ end
+ end
+ r
+ end
+ else # ! TkComm::GET_CONFIGINFOwoRES_AS_ARRAY
+ current_configinfo_core_tk8x(font, option)
+ end
+ end
+
+ def current_configinfo_core_tk8x(font, option=nil)
+ if option == 'compound'
+ ""
+ elsif option
+ tk_call('font', 'configure', font, "-#{option}")
+ else
+ l = tk_split_simplelist(tk_call('font', 'configure', font))
+ r = {}
+ while key=l.shift
+ if key == '-compound'
+ l.shift
+ else
+ r[key[1..-1]] = l.shift
+ end
+ end
+ r
+ end
+ end
+
+ def delete_core_tk4x
+ Tk_FontNameTBL.delete(@id)
+ Tk_FontUseTBL.delete_if{|key,value| value == self}
+ end
+
+ def delete_core_tk8x
+ begin
+ tk_call('font', 'delete', @latinfont)
+ rescue
+ end
+ begin
+ tk_call('font', 'delete', @kanjifont)
+ rescue
+ end
+ begin
+ tk_call('font', 'delete', @compoundfont)
+ rescue
+ end
+ Tk_FontNameTBL.delete(@id)
+ Tk_FontUseTBL.delete_if{|key,value| value == self}
+ end
+
+ def latin_replace_core_tk4x(ltn)
+ create_latinfont_tk4x(ltn)
+ @compoundfont[0] = [@latinfont] if JAPANIZED_TK
+ @fontslot['font'] = @latinfont
+ Tk_FontUseTBL.dup.each{|w, fobj|
+ if self == fobj
+ begin
+ if w.include?(';')
+ win, tag = w.split(';')
+ winobj = tk_tcl2ruby(win)
+# winobj.tagfont_configure(tag, {'font'=>@latinfont})
+ if winobj.kind_of? TkText
+ tk_call(win, 'tag', 'configure', tag, '-font', @latinfont)
+ elsif winobj.kind_of? TkCanvas
+ tk_call(win, 'itemconfigure', tag, '-font', @latinfont)
+ elsif winobj.kind_of? TkMenu
+ tk_call(win, 'entryconfigure', tag, '-font', @latinfont)
+ else
+ raise RuntimeError, "unknown widget type"
+ end
+ else
+# tk_tcl2ruby(w).font_configure('font'=>@latinfont)
+ tk_call(w, 'configure', '-font', @latinfont)
+ end
+ rescue
+ Tk_FontUseTBL.delete(w)
+ end
+ end
+ }
+ self
+ end
+
+ def kanji_replace_core_tk4x(knj)
+ return self unless JAPANIZED_TK
+
+ create_kanjifont_tk4x(knj)
+ @compoundfont[1] = [@kanjifont]
+ @fontslot['kanjifont'] = @kanjifont
+ Tk_FontUseTBL.dup.each{|w, fobj|
+ if self == fobj
+ begin
+ if w.include?(';')
+ win, tag = w.split(';')
+ winobj = tk_tcl2ruby(win)
+# winobj.tagfont_configure(tag, {'kanjifont'=>@kanjifont})
+ if winobj.kind_of? TkText
+ tk_call(win, 'tag', 'configure', tag, '-kanjifont', @kanjifont)
+ elsif winobj.kind_of? TkCanvas
+ tk_call(win, 'itemconfigure', tag, '-kanjifont', @kanjifont)
+ elsif winobj.kind_of? TkMenu
+ tk_call(win, 'entryconfigure', tag, '-kanjifont', @latinfont)
+ else
+ raise RuntimeError, "unknown widget type"
+ end
+ else
+# tk_tcl2ruby(w).font_configure('kanjifont'=>@kanjifont)
+ tk_call(w, 'configure', '-kanjifont', @kanjifont)
+ end
+ rescue
+ Tk_FontUseTBL.delete(w)
+ end
+ end
+ }
+ self
+ end
+
+ def latin_replace_core_tk8x(ltn)
+ if JAPANIZED_TK
+ begin
+ tk_call('font', 'delete', '@font_tmp')
+ rescue
+ end
+ begin
+ fnt_bup = tk_call('font', 'create', '@font_tmp', '-copy', @latinfont)
+ rescue
+ #fnt_bup = ''
+ fnt_bup = DEFAULT_LATIN_FONT_NAME
+ end
+ end
+
+ begin
+ tk_call('font', 'delete', @latinfont)
+ rescue
+ end
+ create_latinfont(ltn)
+
+ if JAPANIZED_TK
+ keys = self.configinfo
+ tk_call('font', 'delete', @compoundfont)
+ begin
+ tk_call('font', 'create', @compoundfont,
+ '-compound', [@latinfont, @kanjifont], *hash_kv(keys))
+=begin
+ latinkeys = {}
+ begin
+ actual_core(@latinfont).each{|key,val| latinkeys[key] = val}
+ rescue
+ latinkeys {}
+ end
+ if latinkeys != {}
+ tk_call('font', 'configure', @compoundfont, *hash_kv(latinkeys))
+ end
+=end
+ rescue RuntimeError => e
+ tk_call('font', 'delete', @latinfont)
+ if fnt_bup && fnt_bup != ''
+ tk_call('font', 'create', @latinfont, '-copy', fnt_bup)
+ tk_call('font', 'create', @compoundfont,
+ '-compound', [@latinfont, @kanjifont], *hash_kv(keys))
+ tk_call('font', 'delete', fnt_bup)
+ else
+ fail e
+ end
+ end
+
+ else
+ latinkeys = {}
+ begin
+ actual_core(@latinfont).each{|key,val| latinkeys[key] = val}
+ rescue
+ latinkeys {}
+ end
+ if latinkeys != {}
+ tk_call('font', 'configure', @compoundfont, *hash_kv(latinkeys))
+ end
+ end
+ self
+ end
+
+ def kanji_replace_core_tk8x(knj)
+ if JAPANIZED_TK
+ begin
+ tk_call('font', 'delete', '@font_tmp')
+ rescue
+ end
+ begin
+ fnt_bup = tk_call('font', 'create', '@font_tmp', '-copy', @kanjifont)
+ rescue
+ #fnt_bup = ''
+ fnt_bup = DEFAULT_KANJI_FONT_NAME
+ end
+ end
+
+ begin
+ tk_call('font', 'delete', @kanjifont)
+ rescue
+ end
+ create_kanjifont(knj)
+
+ if JAPANIZED_TK
+ keys = self.configinfo
+ tk_call('font', 'delete', @compoundfont)
+ begin
+ 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,
+ '-compound', [@latinfont, @kanjifont], *hash_kv(keys))
+ tk_call('font', 'delete', fnt_bup)
+ else
+ fail e
+ end
+ end
+ end
+ self
+ end
+
+ def measure_core_tk4x(window, text)
+ 0
+ end
+
+ def measure_core_tk8x(window, text)
+ if window
+ number(tk_call('font', 'measure', @compoundfont,
+ '-displayof', window, text))
+ else
+ number(tk_call('font', 'measure', @compoundfont, text))
+ end
+ end
+
+ def metrics_core_tk4x(font, window, option=nil)
+ # dummy
+ if option
+ ""
+ else
+ [['ascent',[]], ['descent',[]], ['linespace',[]], ['fixed',[]]]
+ end
+ end
+
+ def metrics_core_tk8x(font, window, option=nil)
+ if option
+ if window
+ number(tk_call('font', 'metrics', font,
+ "-displayof", window, "-#{option}"))
+ else
+ number(tk_call('font', 'metrics', font, "-#{option}"))
+ end
+ else
+ l = tk_split_list(if window
+ tk_call('font','metrics',font,"-displayof",window)
+ else
+ tk_call('font','metrics',font)
+ end)
+ r = []
+ while key=l.shift
+ r.push [key[1..-1], l.shift.to_i]
+ end
+ r
+ end
+ end
+
+ ###################################
+ # private alias
+ ###################################
+ case (Tk::TK_VERSION)
+ when /^4\.*/
+ alias create_latinfont create_latinfont_tk4x
+ alias create_kanjifont create_kanjifont_tk4x
+ alias create_compoundfont create_compoundfont_tk4x
+ alias actual_core actual_core_tk4x
+ alias configure_core configure_core_tk4x
+ alias configinfo_core configinfo_core_tk4x
+ alias current_configinfo_core current_configinfo_core_tk4x
+ alias delete_core delete_core_tk4x
+ alias latin_replace_core latin_replace_core_tk4x
+ alias kanji_replace_core kanji_replace_core_tk4x
+ alias measure_core measure_core_tk4x
+ alias metrics_core metrics_core_tk4x
+
+ when /^8\.[0-5]/
+ alias create_latinfont create_latinfont_tk8x
+ alias create_kanjifont create_kanjifont_tk8x
+ alias create_compoundfont create_compoundfont_tk8x
+ alias actual_core actual_core_tk8x
+ alias configure_core configure_core_tk8x
+ alias configinfo_core configinfo_core_tk8x
+ alias current_configinfo_core current_configinfo_core_tk8x
+ alias delete_core delete_core_tk8x
+ alias latin_replace_core latin_replace_core_tk8x
+ alias kanji_replace_core kanji_replace_core_tk8x
+ alias measure_core measure_core_tk8x
+ alias metrics_core metrics_core_tk8x
+
+ else
+ alias create_latinfont create_latinfont_tk8x
+ alias create_kanjifont create_kanjifont_tk8x
+ alias create_compoundfont create_compoundfont_tk8x
+ alias actual_core actual_core_tk8x
+ alias configure_core configure_core_tk8x
+ alias configinfo_core configinfo_core_tk8x
+ alias current_configinfo_core current_configinfo_core_tk8x
+ alias delete_core delete_core_tk8x
+ alias latin_replace_core latin_replace_core_tk8x
+ alias kanji_replace_core kanji_replace_core_tk8x
+ alias measure_core measure_core_tk8x
+ alias metrics_core metrics_core_tk8x
+
+ end
+
+ ###################################
+ public
+ ###################################
+ def method_missing(id, *args)
+ name = id.id2name
+ case args.length
+ when 1
+ configure name, args[0]
+ when 0
+ begin
+ configinfo name
+ rescue
+ fail NameError, "undefined local variable or method `#{name}' for #{self.to_s}", error_at
+ end
+ else
+ fail NameError, "undefined method `#{name}' for #{self.to_s}", error_at
+ end
+ end
+
+ def call_font_configure(path, *args)
+ keys = args.pop.update(@fontslot)
+ args.concat(hash_kv(keys))
+ tk_call(*args)
+ Tk_FontUseTBL[path] = self
+ self
+ end
+
+ def used
+ ret = []
+ Tk_FontUseTBL.each{|key,value|
+ if key.include?(';')
+ win, tag = key.split(';')
+ winobj = tk_tcl2ruby(win)
+ if winobj.kind_of? TkText
+ ret.push([winobj, winobj.tagid2obj(tag)])
+ elsif winobj.kind_of? TkCanvas
+ if (tagobj = TkcTag.id2obj(winobj, tag)).kind_of? TkcTag
+ ret.push([winobj, tagobj])
+ elsif (tagobj = TkcItem.id2obj(tag)).kind_of? TkcItem
+ ret.push([winobj, tagobj])
+ else
+ ret.push([winobj, tag])
+ end
+ elsif winobj.kind_of? TkMenu
+ ret.push([winobj, tag])
+ else
+ ret.push([win, tag])
+ end
+ else
+ ret.push(tk_tcl2ruby(key)) if value == self
+ end
+ }
+ ret
+ end
+
+ def id
+ @id
+ end
+
+ def to_eval
+ font
+ end
+
+ def font
+ @compoundfont
+ end
+ alias font_id font
+
+ def latin_font_id
+ @latinfont
+ end
+
+ def latin_font
+ # @latinfont
+ if @latin_descendant
+ @latin_descendant
+ else
+ @latin_descendant = DescendantFont.new(self, 'latin')
+ end
+ end
+ alias latinfont latin_font
+
+ def kanji_font_id
+ @kanjifont
+ end
+
+ def kanji_font
+ # @kanjifont
+ if @kanji_descendant
+ @kanji_descendant
+ else
+ @kanji_descendant = DescendantFont.new(self, 'kanji')
+ end
+ end
+ alias kanjifont kanji_font
+
+ def actual(option=nil)
+ actual_core(@compoundfont, nil, option)
+ end
+
+ def actual_displayof(window, option=nil)
+ window = '.' unless window
+ actual_core(@compoundfont, window, option)
+ end
+
+ def latin_actual(option=nil)
+ actual_core(@latinfont, nil, option)
+ end
+
+ def latin_actual_displayof(window, option=nil)
+ window = '.' unless window
+ actual_core(@latinfont, window, option)
+ end
+
+ def kanji_actual(option=nil)
+ #if JAPANIZED_TK
+ if @kanjifont != ""
+ actual_core(@kanjifont, nil, option)
+ else
+ actual_core_tk4x(nil, nil, option)
+ end
+ end
+
+ def kanji_actual_displayof(window, option=nil)
+ #if JAPANIZED_TK
+ if @kanjifont != ""
+ window = '.' unless window
+ actual_core(@kanjifont, window, option)
+ else
+ actual_core_tk4x(nil, window, option)
+ end
+ end
+
+ def [](slot)
+ configinfo slot
+ end
+
+ def []=(slot, val)
+ configure slot, val
+ val
+ end
+
+ def configure(slot, value=None)
+ configure_core(@compoundfont, slot, value)
+ self
+ end
+
+ def configinfo(slot=nil)
+ configinfo_core(@compoundfont, slot)
+ end
+
+ def current_configinfo(slot=nil)
+ current_configinfo_core(@compoundfont, slot)
+ end
+
+ def delete
+ delete_core
+ end
+
+ def latin_configure(slot, value=None)
+ if JAPANIZED_TK
+ configure_core(@latinfont, slot, value)
+ else
+ configure(slot, value)
+ end
+ self
+ end
+
+ def latin_configinfo(slot=nil)
+ if JAPANIZED_TK
+ configinfo_core(@latinfont, slot)
+ else
+ configinfo(slot)
+ end
+ end
+
+ def kanji_configure(slot, value=None)
+ #if JAPANIZED_TK
+ if @kanjifont != ""
+ configure_core(@kanjifont, slot, value)
+ configure('size'=>configinfo('size')) # to reflect new configuration
+ else
+ #""
+ configure(slot, value)
+ end
+ self
+ end
+
+ def kanji_configinfo(slot=nil)
+ #if JAPANIZED_TK
+ if @kanjifont != ""
+ configinfo_core(@kanjifont, slot)
+ else
+ #[]
+ configinfo(slot)
+ end
+ end
+
+ def replace(ltn, knj)
+ latin_replace(ltn)
+ kanji_replace(knj)
+ self
+ end
+
+ def latin_replace(ltn)
+ latin_replace_core(ltn)
+ reset_pointadjust
+ self
+ end
+
+ def kanji_replace(knj)
+ kanji_replace_core(knj)
+ reset_pointadjust
+ self
+ end
+
+ def measure(text)
+ measure_core(nil, text)
+ end
+
+ def measure_displayof(window, text)
+ window = '.' unless window
+ measure_core(window, text)
+ end
+
+ def metrics(option=nil)
+ metrics_core(@compoundfont, nil, option)
+ end
+
+ def metrics_displayof(window, option=nil)
+ window = '.' unless window
+ metrics_core(@compoundfont, window, option)
+ end
+
+ def latin_metrics(option=nil)
+ metrics_core(@latinfont, nil, option)
+ end
+
+ def latin_metrics_displayof(window, option=nil)
+ window = '.' unless window
+ metrics_core(@latinfont, window, option)
+ end
+
+ def kanji_metrics(option=nil)
+ if JAPANIZED_TK
+ metrics_core(@kanjifont, nil, option)
+ else
+ metrics_core_tk4x(nil, nil, option)
+ end
+ end
+
+ def kanji_metrics_displayof(window, option=nil)
+ if JAPANIZED_TK
+ window = '.' unless window
+ metrics_core(@kanjifont, window, option)
+ else
+ metrics_core_tk4x(nil, window, option)
+ end
+ end
+
+ def reset_pointadjust
+ begin
+ if /^8\.*/ === Tk::TK_VERSION && JAPANIZED_TK
+ configure('pointadjust' => latin_actual.assoc('size')[1].to_f /
+ kanji_actual.assoc('size')[1].to_f )
+ end
+ rescue
+ end
+ self
+ end
+
+ ###################################
+ # public alias
+ ###################################
+ alias ascii_font latin_font
+ alias asciifont latinfont
+ alias create_asciifont create_latinfont
+ alias ascii_actual latin_actual
+ alias ascii_actual_displayof latin_actual_displayof
+ alias ascii_configure latin_configure
+ alias ascii_configinfo latin_configinfo
+ alias ascii_replace latin_replace
+ alias ascii_metrics latin_metrics
+
+ ###################################
+ def dup
+ src = self
+ obj = super()
+ obj.instance_eval{ initialize(src) }
+ obj
+ end
+ def clone
+ src = self
+ obj = super()
+ obj.instance_eval{ initialize(src) }
+ obj
+ end
+end
diff --git a/ext/tk/lib/tk/frame.rb b/ext/tk/lib/tk/frame.rb
new file mode 100644
index 0000000000..6598ceb55c
--- /dev/null
+++ b/ext/tk/lib/tk/frame.rb
@@ -0,0 +1,123 @@
+#
+# tk/frame.rb : treat frame widget
+#
+require 'tk'
+
+class TkFrame<TkWindow
+ TkCommandNames = ['frame'.freeze].freeze
+ WidgetClassName = 'Frame'.freeze
+ WidgetClassNames[WidgetClassName] = self
+
+################# old version
+# def initialize(parent=nil, keys=nil)
+# if keys.kind_of? Hash
+# keys = keys.dup
+# @classname = keys.delete('classname') if keys.key?('classname')
+# @colormap = keys.delete('colormap') if keys.key?('colormap')
+# @container = keys.delete('container') if keys.key?('container')
+# @visual = keys.delete('visual') if keys.key?('visual')
+# end
+# super(parent, keys)
+# end
+#
+# def create_self
+# s = []
+# s << "-class" << @classname if @classname
+# s << "-colormap" << @colormap if @colormap
+# s << "-container" << @container if @container
+# s << "-visual" << @visual if @visual
+# tk_call 'frame', @path, *s
+# end
+#################
+
+ def initialize(parent=nil, keys=nil)
+ my_class_name = nil
+ if self.class < WidgetClassNames[WidgetClassName]
+ my_class_name = self.class.name
+ my_class_name = nil if my_class_name == ''
+ end
+ if parent.kind_of? Hash
+ keys = _symbolkey2str(parent)
+ else
+ if keys
+ keys = _symbolkey2str(keys)
+ keys['parent'] = parent
+ else
+ keys = {'parent'=>parent}
+ end
+ end
+ if keys.key?('classname')
+ keys['class'] = keys.delete('classname')
+ end
+ @classname = keys['class']
+ @colormap = keys['colormap']
+ @container = keys['container']
+ @visual = keys['visual']
+ if !@classname && my_class_name
+ keys['class'] = @classname = my_class_name
+ end
+ if @classname.kind_of? TkBindTag
+ @db_class = @classname
+ @classname = @classname.id
+ elsif @classname
+ @db_class = TkDatabaseClass.new(@classname)
+ else
+ @db_class = self.class
+ @classname = @db_class::WidgetClassName
+ end
+ super(keys)
+ end
+
+ def create_self(keys)
+ if keys and keys != None
+ tk_call_without_enc('frame', @path, *hash_kv(keys))
+ else
+ tk_call_without_enc( 'frame', @path)
+ end
+ end
+ private :create_self
+
+ def database_classname
+ @classname
+ end
+
+ def self.database_class
+ if self == WidgetClassNames[WidgetClassName] || self.name == ''
+ self
+ else
+ TkDatabaseClass.new(self.name)
+ end
+ end
+ def self.database_classname
+ self.database_class.name
+ end
+
+ def self.bind(*args)
+ if self == WidgetClassNames[WidgetClassName] || self.name == ''
+ super(*args)
+ else
+ TkDatabaseClass.new(self.name).bind(*args)
+ end
+ end
+ def self.bind_append(*args)
+ if self == WidgetClassNames[WidgetClassName] || self.name == ''
+ super(*args)
+ else
+ TkDatabaseClass.new(self.name).bind_append(*args)
+ end
+ end
+ def self.bind_remove(*args)
+ if self == WidgetClassNames[WidgetClassName] || self.name == ''
+ super(*args)
+ else
+ TkDatabaseClass.new(self.name).bind_remove(*args)
+ end
+ end
+ def self.bindinfo(*args)
+ if self == WidgetClassNames[WidgetClassName] || self.name == ''
+ super(*args)
+ else
+ TkDatabaseClass.new(self.name).bindinfo(*args)
+ end
+ end
+end
diff --git a/ext/tk/lib/tk/grid.rb b/ext/tk/lib/tk/grid.rb
new file mode 100644
index 0000000000..1516aef4bf
--- /dev/null
+++ b/ext/tk/lib/tk/grid.rb
@@ -0,0 +1,182 @@
+#
+# tk/grid.rb : control grid geometry manager
+#
+require 'tk'
+
+module TkGrid
+ include Tk
+ extend Tk
+
+ TkCommandNames = ['grid'.freeze].freeze
+
+ def anchor(master, anchor=None)
+ # master = master.epath if master.kind_of?(TkObject)
+ master = _epath(master)
+ tk_call_without_enc('grid', 'anchor', master, anchor)
+ end
+
+ def bbox(master, *args)
+ # master = master.epath if master.kind_of?(TkObject)
+ master = _epath(master)
+ args.unshift(master)
+ list(tk_call_without_enc('grid', 'bbox', *args))
+ end
+
+ def configure(win, *args)
+ if args[-1].kind_of?(Hash)
+ opts = args.pop
+ else
+ opts = {}
+ end
+ params = []
+ params.push(_epath(win))
+ args.each{|win|
+ case win
+ when '-', 'x', '^' # RELATIVE PLACEMENT
+ params.push(win)
+ else
+ params.push(_epath(win))
+ end
+ }
+ opts.each{|k, v|
+ params.push("-#{k}")
+ params.push((v.kind_of?(TkObject))? v.epath: v)
+ }
+ tk_call_without_enc("grid", 'configure', *params)
+ end
+
+ def columnconfigure(master, index, args)
+ # master = master.epath if master.kind_of?(TkObject)
+ master = _epath(master)
+ tk_call_without_enc("grid", 'columnconfigure',
+ master, index, *hash_kv(args))
+ end
+
+ def rowconfigure(master, index, args)
+ # master = master.epath if master.kind_of?(TkObject)
+ master = _epath(master)
+ tk_call_without_enc("grid", 'rowconfigure', master, index, *hash_kv(args))
+ end
+
+ def columnconfiginfo(master, index, slot=nil)
+ # master = master.epath if master.kind_of?(TkObject)
+ master = _epath(master)
+ if slot
+ num_or_str(tk_call_without_enc('grid', 'columnconfigure',
+ master, index, "-#{slot}"))
+ else
+ ilist = list(tk_call_without_enc('grid','columnconfigure',master,index))
+ info = {}
+ while key = ilist.shift
+ info[key[1..-1]] = ilist.shift
+ end
+ info
+ end
+ end
+
+ def rowconfiginfo(master, index, slot=nil)
+ # master = master.epath if master.kind_of?(TkObject)
+ master = _epath(master)
+ if slot
+ num_or_str(tk_call_without_enc('grid', 'rowconfigure',
+ master, index, "-#{slot}"))
+ else
+ ilist = list(tk_call_without_enc('grid', 'rowconfigure', master, index))
+ info = {}
+ while key = ilist.shift
+ info[key[1..-1]] = ilist.shift
+ end
+ info
+ end
+ end
+
+ def add(widget, *args)
+ configure(widget, *args)
+ end
+
+ def forget(*args)
+ return '' if args.size == 0
+ wins = args.collect{|win|
+ # (win.kind_of?(TkObject))? win.epath: win
+ _epath(win)
+ }
+ tk_call_without_enc('grid', 'forget', *wins)
+ end
+
+ def info(slave)
+ # slave = slave.epath if slave.kind_of?(TkObject)
+ slave = _epath(slave)
+ ilist = list(tk_call_without_enc('grid', 'info', slave))
+ info = {}
+ while key = ilist.shift
+ info[key[1..-1]] = ilist.shift
+ end
+ return info
+ end
+
+ def location(master, x, y)
+ # master = master.epath if master.kind_of?(TkObject)
+ master = _epath(master)
+ list(tk_call_without_enc('grid', 'location', master, x, y))
+ end
+
+ def propagate(master, bool=None)
+ # master = master.epath if master.kind_of?(TkObject)
+ master = _epath(master)
+ if bool == None
+ bool(tk_call_without_enc('grid', 'propagate', master))
+ else
+ tk_call_without_enc('grid', 'propagate', master, bool)
+ end
+ end
+
+ def remove(*args)
+ return '' if args.size == 0
+ wins = args.collect{|win|
+ # (win.kind_of?(TkObject))? win.epath: win
+ _epath(win)
+ }
+ tk_call_without_enc('grid', 'remove', *wins)
+ end
+
+ def size(master)
+ # master = master.epath if master.kind_of?(TkObject)
+ master = _epath(master)
+ list(tk_call_without_enc('grid', 'size', master))
+ end
+
+ def slaves(master, args)
+ # master = master.epath if master.kind_of?(TkObject)
+ master = _epath(master)
+ list(tk_call_without_enc('grid', 'slaves', master, *hash_kv(args)))
+ end
+
+ module_function :bbox, :forget, :propagate, :info
+ module_function :remove, :size, :slaves, :location
+ module_function :configure, :columnconfigure, :rowconfigure
+ module_function :columnconfiginfo, :rowconfiginfo
+end
+=begin
+def TkGrid(win, *args)
+ if args[-1].kind_of?(Hash)
+ opts = args.pop
+ else
+ opts = {}
+ end
+ params = []
+ params.push((win.kind_of?(TkObject))? win.epath: win)
+ args.each{|win|
+ case win
+ when '-', 'x', '^' # RELATIVE PLACEMENT
+ params.push(win)
+ else
+ params.push((win.kind_of?(TkObject))? win.epath: win)
+ end
+ }
+ opts.each{|k, v|
+ params.push("-#{k}")
+ params.push((v.kind_of?(TkObject))? v.epath: v)
+ }
+ tk_call_without_enc("grid", *params)
+end
+=end
diff --git a/ext/tk/lib/tk/image.rb b/ext/tk/lib/tk/image.rb
new file mode 100644
index 0000000000..70dd096434
--- /dev/null
+++ b/ext/tk/lib/tk/image.rb
@@ -0,0 +1,185 @@
+#
+# tk/image.rb : treat Tk image objects
+#
+
+require 'tk'
+
+class TkImage<TkObject
+ include Tk
+
+ TkCommandNames = ['image'.freeze].freeze
+
+ Tk_IMGTBL = TkCore::INTERP.create_table
+ Tk_Image_ID = ['i'.freeze, '00000'.taint].freeze
+
+ TkCore::INTERP.init_ip_env{ Tk_IMGTBL.clear }
+
+ def initialize(keys=nil)
+ @path = Tk_Image_ID.join('')
+ Tk_Image_ID[1].succ!
+ tk_call_without_enc('image', 'create', @type, @path, *hash_kv(keys, true))
+ Tk_IMGTBL[@path] = self
+ end
+
+ def delete
+ Tk_IMGTBL.delete(@id) if @id
+ tk_call_without_enc('image', 'delete', @path)
+ self
+ end
+ def height
+ number(tk_call_without_enc('image', 'height', @path))
+ end
+ def inuse
+ bool(tk_call_without_enc('image', 'inuse', @path))
+ end
+ def itemtype
+ tk_call_without_enc('image', 'type', @path)
+ end
+ def width
+ number(tk_call_without_enc('image', 'width', @path))
+ end
+
+ def TkImage.names
+ Tk.tk_call_without_enc('image', 'names').split.collect!{|id|
+ (Tk_IMGTBL[id])? Tk_IMGTBL[id] : id
+ }
+ end
+
+ def TkImage.types
+ Tk.tk_call_without_enc('image', 'types').split
+ end
+end
+
+class TkBitmapImage<TkImage
+ def initialize(*args)
+ @type = 'bitmap'
+ super
+ end
+end
+
+class TkPhotoImage<TkImage
+ NullArgOptionKeys = [ "shrink", "grayscale" ]
+
+ def _photo_hash_kv(keys)
+ keys = _symbolkey2str(keys)
+ NullArgOptionKeys.collect{|opt|
+ if keys[opt]
+ keys[opt] = None
+ else
+ keys.delete(opt)
+ end
+ }
+ hash_kv(keys).flatten
+ end
+ private :_photo_hash_kv
+
+ def initialize(*args)
+ @type = 'photo'
+ super
+ end
+
+ def blank
+ tk_send_without_enc('blank')
+ self
+ end
+
+ def cget(option)
+ case option.to_s
+ when 'data', 'file'
+ tk_send 'cget', option
+ else
+ tk_tcl2ruby(tk_send('cget', option))
+ end
+ end
+
+ def copy(src, *opts)
+ if opts.size == 0
+ tk_send('copy', src)
+ elsif opts.size == 1 && opts[0].kind_of?(Hash)
+ tk_send('copy', src, *_photo_hash_kv(opts[0]))
+ else
+ # for backward compatibility
+ args = opts.collect{|term|
+ if term.kind_of?(String) && term.include?(?\s)
+ term.split
+ else
+ term
+ end
+ }.flatten
+ tk_send('copy', source, *args)
+ end
+ self
+ end
+
+ def data(keys={})
+ #tk_send('data', *_photo_hash_kv(keys))
+ tk_split_list(tk_send('data', *_photo_hash_kv(keys)))
+ end
+
+ def get(x, y)
+ tk_send('get', x, y).split.collect{|n| n.to_i}
+ end
+
+ def put(data, *opts)
+ if opts == []
+ tk_send('put', data)
+ elsif opts.size == 1 && opts[0].kind_of?(Hash)
+ tk_send('put', data, *_photo_hash_kv(opts[0]))
+ else
+ # for backward compatibility
+ tk_send('put', data, '-to', *opts)
+ end
+ self
+ end
+
+ def read(file, *opts)
+ if opts.size == 0
+ tk_send('read', file)
+ elsif opts.size == 1 && opts[0].kind_of?(Hash)
+ tk_send('read', file, *_photo_hash_kv(opts[0]))
+ else
+ # for backward compatibility
+ args = opts.collect{|term|
+ if term.kind_of?(String) && term.include?(?\s)
+ term.split
+ else
+ term
+ end
+ }.flatten
+ tk_send('read', file, *args)
+ end
+ self
+ end
+
+ def redither
+ tk_send 'redither'
+ self
+ end
+
+ def get_transparency(x, y)
+ bool(tk_send('transparency', 'get', x, y))
+ end
+ def set_transparency(x, y, st)
+ tk_send('transparency', 'set', x, y, st)
+ self
+ end
+
+ def write(file, *opts)
+ if opts.size == 0
+ tk_send('write', file)
+ elsif opts.size == 1 && opts[0].kind_of?(Hash)
+ tk_send('write', file, *_photo_hash_kv(opts[0]))
+ else
+ # for backward compatibility
+ args = opts.collect{|term|
+ if term.kind_of?(String) && term.include?(?\s)
+ term.split
+ else
+ term
+ end
+ }.flatten
+ tk_send('write', file, *args)
+ end
+ self
+ end
+end
diff --git a/ext/tk/lib/tk/itemfont.rb b/ext/tk/lib/tk/itemfont.rb
new file mode 100644
index 0000000000..6e92fc001c
--- /dev/null
+++ b/ext/tk/lib/tk/itemfont.rb
@@ -0,0 +1,185 @@
+#
+# tk/itemfont.rb : control font of widget items
+#
+require 'tk'
+
+module TkTreatItemFont
+ def __conf_cmd(idx)
+ raise NotImplementedError, "need to define `__conf_cmd'"
+ end
+ def __item_pathname(tagOrId)
+ raise NotImplementedError, "need to define `__item_pathname'"
+ end
+ private :__conf_cmd, :__item_pathname
+
+ def tagfont_configinfo(tagOrId, name = nil)
+ pathname = __item_pathname(tagOrId)
+ ret = TkFont.used_on(pathname)
+ if ret == nil
+=begin
+ if name
+ ret = name
+ else
+ ret = TkFont.init_widget_font(pathname, self.path,
+ __conf_cmd(0), __conf_cmd(1), tagOrId)
+ end
+=end
+ ret = TkFont.init_widget_font(pathname, self.path,
+ __conf_cmd(0), __conf_cmd(1), tagOrId)
+ end
+ ret
+ end
+ alias tagfontobj tagfont_configinfo
+
+ def tagfont_configure(tagOrId, slot)
+ pathname = __item_pathname(tagOrId)
+ slot = _symbolkey2str(slot)
+
+ if slot.key?('font')
+ fnt = slot.delete('font')
+ if fnt.kind_of? TkFont
+ return fnt.call_font_configure(pathname, self.path,
+ __conf_cmd(0), __conf_cmd(1),
+ tagOrId, slot)
+ else
+ if fnt
+ if (slot.key?('kanjifont') ||
+ slot.key?('latinfont') ||
+ slot.key?('asciifont'))
+ fnt = TkFont.new(fnt)
+
+ lfnt = slot.delete('latinfont')
+ lfnt = slot.delete('asciifont') if slot.key?('asciifont')
+ kfnt = slot.delete('kanjifont')
+
+ fnt.latin_replace(lfnt) if lfnt
+ fnt.kanji_replace(kfnt) if kfnt
+ end
+
+ slot['font'] = fnt
+ tk_call(self.path, __conf_cmd(0), __conf_cmd(1),
+ tagOrId, *hash_kv(slot))
+ end
+ return self
+ end
+ end
+
+ lfnt = slot.delete('latinfont')
+ lfnt = slot.delete('asciifont') if slot.key?('asciifont')
+ kfnt = slot.delete('kanjifont')
+
+ if lfnt && kfnt
+ return TkFont.new(lfnt, kfnt).call_font_configure(pathname, self.path,
+ __conf_cmd(0),
+ __conf_cmd(1),
+ tagOrId, slot)
+ end
+
+ latintagfont_configure(tagOrId, lfnt) if lfnt
+ kanjitagfont_configure(tagOrId, kfnt) if kfnt
+
+ tk_call(self.path, __conf_cmd(0), __conf_cmd(1),
+ tagOrId, *hash_kv(slot)) if slot != {}
+ self
+ end
+
+ def latintagfont_configure(tagOrId, ltn, keys=nil)
+ pathname = __item_pathname(tagOrId)
+ if (fobj = TkFont.used_on(pathname))
+ fobj = TkFont.new(fobj) # create a new TkFont object
+ elsif Tk::JAPANIZED_TK
+ fobj = tagfontobj(tagOrId) # create a new TkFont object
+ else
+ tk_call(self.path, __conf_cmd(0), __conf_cmd(1), tagOrId, '-font', ltn)
+ return self
+ end
+
+ if fobj.kind_of?(TkFont)
+ if ltn.kind_of? TkFont
+ conf = {}
+ ltn.latin_configinfo.each{|key,val| conf[key] = val}
+ if keys
+ fobj.latin_configure(conf.update(keys))
+ else
+ fobj.latin_configure(conf)
+ end
+ else
+ fobj.latin_replace(ltn)
+ end
+ end
+
+ return fobj.call_font_configure(pathname, self.path,
+ __conf_cmd(0), __conf_cmd(1), tagOrId, {})
+ end
+ alias asciitagfont_configure latintagfont_configure
+
+ def kanjitagfont_configure(tagOrId, knj, keys=nil)
+ pathname = __item_pathname(tagOrId)
+ if (fobj = TkFont.used_on(pathname))
+ fobj = TkFont.new(fobj) # create a new TkFont object
+ elsif Tk::JAPANIZED_TK
+ fobj = tagfontobj(tagOrId) # create a new TkFont object
+ else
+ tk_call(self.path, __conf_cmd(0), __conf_cmd(1), tagOrId, '-font', knj)
+ return self
+ end
+
+ if fobj.kind_of?(TkFont)
+ if knj.kind_of? TkFont
+ conf = {}
+ knj.kanji_configinfo.each{|key,val| conf[key] = val}
+ if keys
+ fobj.kanji_configure(conf.update(keys))
+ else
+ fobj.kanji_configure(conf)
+ end
+ else
+ fobj.kanji_replace(knj)
+ end
+ end
+
+ return fobj.call_font_configure(pathname, self.path,
+ __conf_cmd(0), __conf_cmd(1), tagOrId, {})
+ end
+
+ def tagfont_copy(tagOrId, window, wintag=nil)
+ pathname = __item_pathname(tagOrId)
+ if wintag
+ fnt = window.tagfontobj(wintag).dup
+ else
+ fnt = window.fontobj.dup
+ end
+ fnt.call_font_configure(pathname, self.path,
+ __conf_cmd(0), __conf_cmd(1), tagOrId, {})
+ return self
+ end
+
+ def latintagfont_copy(tagOrId, window, wintag=nil)
+ pathname = __item_pathname(tagOrId)
+ tagfontobj(tagOrId).dup.call_font_configure(pathname, self.path,
+ __conf_cmd(0), __conf_cmd(1),
+ tagOrId, {})
+ if wintag
+ tagfontobj(tagOrId).
+ latin_replace(window.tagfontobj(wintag).latin_font_id)
+ else
+ tagfontobj(tagOrId).latin_replace(window.fontobj.latin_font_id)
+ end
+ self
+ end
+ alias asciitagfont_copy latintagfont_copy
+
+ def kanjitagfont_copy(tagOrId, window, wintag=nil)
+ pathname = __item_pathname(tagOrId)
+ tagfontobj(tagOrId).dup.call_font_configure(pathname, self.path,
+ __conf_cmd(0), __conf_cmd(1),
+ tagOrId, {})
+ if wintag
+ tagfontobj(tagOrId).
+ kanji_replace(window.tagfontobj(wintag).kanji_font_id)
+ else
+ tagfontobj(tagOrId).kanji_replace(window.fontobj.kanji_font_id)
+ end
+ self
+ end
+end
diff --git a/ext/tk/lib/tk/kinput.rb b/ext/tk/lib/tk/kinput.rb
new file mode 100644
index 0000000000..418b3aec47
--- /dev/null
+++ b/ext/tk/lib/tk/kinput.rb
@@ -0,0 +1,71 @@
+#
+# tk/kinput.rb : control kinput
+#
+require 'tk'
+
+module TkKinput
+ include Tk
+ extend Tk
+
+ TkCommandNames = [
+ 'kinput_start'.freeze,
+ 'kinput_send_spot'.freeze,
+ 'kanjiInput'.freeze
+ ].freeze
+
+ def TkKinput.start(window, style=None)
+ tk_call('kinput_start', window, style)
+ end
+ def kinput_start(style=None)
+ TkKinput.start(self, style)
+ end
+
+ def TkKinput.send_spot(window)
+ tk_call('kinput_send_spot', window)
+ end
+ def kinput_send_spot
+ TkKinput.send_spot(self)
+ end
+
+ def TkKinput.input_start(window, keys=nil)
+ tk_call('kanjiInput', 'start', window, *hash_kv(keys))
+ end
+ def kanji_input_start(keys=nil)
+ TkKinput.input_start(self, keys)
+ end
+
+ def TkKinput.attribute_config(window, slot, value=None)
+ if slot.kind_of? Hash
+ tk_call('kanjiInput', 'attribute', window, *hash_kv(slot))
+ else
+ tk_call('kanjiInput', 'attribute', window, "-#{slot}", value)
+ end
+ end
+ def kinput_attribute_config(slot, value=None)
+ TkKinput.attribute_config(self, slot, value)
+ end
+
+ def TkKinput.attribute_info(window, slot=nil)
+ if slot
+ conf = tk_split_list(tk_call('kanjiInput', 'attribute',
+ window, "-#{slot}"))
+ conf[0] = conf[0][1..-1]
+ conf
+ else
+ tk_split_list(tk_call('kanjiInput', 'attribute', window)).collect{|conf|
+ conf[0] = conf[0][1..-1]
+ conf
+ }
+ end
+ end
+ def kinput_attribute_info(slot=nil)
+ TkKinput.attribute_info(self, slot)
+ end
+
+ def TkKinput.input_end(window)
+ tk_call('kanjiInput', 'end', window)
+ end
+ def kanji_input_end
+ TkKinput.input_end(self)
+ end
+end
diff --git a/ext/tk/lib/tk/label.rb b/ext/tk/lib/tk/label.rb
new file mode 100644
index 0000000000..fe2640958d
--- /dev/null
+++ b/ext/tk/lib/tk/label.rb
@@ -0,0 +1,22 @@
+#
+# tk/label.rb : treat label widget
+#
+require 'tk'
+
+class TkLabel<TkWindow
+ TkCommandNames = ['label'.freeze].freeze
+ WidgetClassName = 'Label'.freeze
+ WidgetClassNames[WidgetClassName] = self
+ def create_self(keys)
+ if keys and keys != None
+ tk_call_without_enc('label', @path, *hash_kv(keys, true))
+ else
+ tk_call_without_enc('label', @path)
+ end
+ end
+ private :create_self
+
+ def textvariable(v)
+ configure 'textvariable', tk_trace_variable(v)
+ end
+end
diff --git a/ext/tk/lib/tk/labelframe.rb b/ext/tk/lib/tk/labelframe.rb
new file mode 100644
index 0000000000..fa658848c8
--- /dev/null
+++ b/ext/tk/lib/tk/labelframe.rb
@@ -0,0 +1,20 @@
+#
+# tk/labelframe.rb : treat labelframe widget
+#
+require 'tk'
+require 'tk/frame'
+
+class TkLabelFrame<TkFrame
+ TkCommandNames = ['labelframe'.freeze].freeze
+ WidgetClassName = 'Labelframe'.freeze
+ WidgetClassNames[WidgetClassName] = self
+ def create_self(keys)
+ if keys and keys != None
+ tk_call_without_enc('labelframe', @path, *hash_kv(keys, true))
+ else
+ tk_call_without_enc('labelframe', @path)
+ end
+ end
+ private :create_self
+end
+TkLabelframe = TkLabelFrame
diff --git a/ext/tk/lib/tk/listbox.rb b/ext/tk/lib/tk/listbox.rb
new file mode 100644
index 0000000000..611226682a
--- /dev/null
+++ b/ext/tk/lib/tk/listbox.rb
@@ -0,0 +1,252 @@
+#
+# tk/listbox.rb : treat listbox widget
+#
+require 'tk'
+require 'tk/scrollable'
+require 'tk/txtwin_abst'
+
+module TkTreatListItemFont
+ include TkTreatItemFont
+
+ ItemCMD = ['itemconfigure'.freeze, TkComm::None].freeze
+ def __conf_cmd(idx)
+ ItemCMD[idx]
+ end
+
+ def __item_pathname(tagOrId)
+ self.path + ';' + tagOrId.to_s
+ end
+
+ private :__conf_cmd, :__item_pathname
+end
+
+
+class TkListbox<TkTextWin
+ include TkTreatListItemFont
+ include Scrollable
+
+ TkCommandNames = ['listbox'.freeze].freeze
+ WidgetClassName = 'Listbox'.freeze
+ WidgetClassNames[WidgetClassName] = self
+
+ def create_self(keys)
+ if keys and keys != None
+ tk_call_without_enc('listbox', @path, *hash_kv(keys, true))
+ else
+ tk_call_without_enc('listbox', @path)
+ end
+ end
+ private :create_self
+
+ def activate(y)
+ tk_send_without_enc('activate', y)
+ self
+ end
+ def curselection
+ list(tk_send_without_enc('curselection'))
+ end
+ def get(first, last=nil)
+ if last
+ tk_split_simplelist(_fromUTF8(tk_send_without_enc('get', first, last)))
+ else
+ _fromUTF8(tk_send_without_enc('get', first))
+ end
+ end
+ def nearest(y)
+ tk_send_without_enc('nearest', y).to_i
+ end
+ def size
+ tk_send_without_enc('size').to_i
+ end
+ def selection_anchor(index)
+ tk_send_without_enc('selection', 'anchor', index)
+ self
+ end
+ def selection_clear(first, last=None)
+ tk_send_without_enc('selection', 'clear', first, last)
+ self
+ end
+ def selection_includes(index)
+ bool(tk_send_without_enc('selection', 'includes', index))
+ end
+ def selection_set(first, last=None)
+ tk_send_without_enc('selection', 'set', first, last)
+ self
+ end
+
+ def index(index)
+ tk_send_without_enc('index', index).to_i
+ end
+
+ def itemcget(index, key)
+ case key.to_s
+ when 'text', 'label', 'show'
+ _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,
+ '-font')))
+ unless fnt.kind_of?(TkFont)
+ fnt = tagfontobj(index, fnt)
+ end
+ if key.to_s == 'kanjifont' && JAPANIZED_TK && TK_VERSION =~ /^4\.*/
+ # obsolete; just for compatibility
+ fnt.kanji_font
+ else
+ fnt
+ end
+ else
+ tk_tcl2ruby(_fromUTF8(tk_send_without_enc('itemcget', index, "-#{key}")))
+ end
+ 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] ||
+ key['asciifont'] || key[:asciifont] )
+ tagfont_configure(index, _symbolkey2str(key))
+ else
+ tk_send_without_enc('itemconfigure', index, *hash_kv(key, true))
+ end
+
+ else
+ if (key == 'font' || key == :font ||
+ key == 'kanjifont' || key == :kanjifont ||
+ key == 'latinfont' || key == :latinfont ||
+ key == 'asciifont' || key == :asciifont )
+ if val == None
+ tagfontobj(index)
+ else
+ tagfont_configure(index, {key=>val})
+ end
+ else
+ tk_call('itemconfigure', index, "-#{key}", val)
+ end
+ end
+ self
+ end
+
+ def itemconfiginfo(index, key=nil)
+ if TkComm::GET_CONFIGINFO_AS_ARRAY
+ if key
+ case key.to_s
+ when 'text', 'label', 'show'
+ conf = tk_split_simplelist(_fromUTF8(tk_send_without_enc('itemconfigure',index,"-#{key}")))
+ when 'font', 'kanjifont'
+ conf = tk_split_simplelist(_fromUTF8(tk_send_without_enc('itemconfigure',index,"-#{key}")))
+ conf[4] = tagfont_configinfo(index, conf[4])
+ else
+ conf = tk_split_list(_fromUTF8(tk_send_without_enc('itemconfigure',index,"-#{key}")))
+ end
+ conf[0] = conf[0][1..-1]
+ conf
+ else
+ ret = tk_split_simplelist(_fromUTF8(tk_send_without_enc('itemconfigure', index))).collect{|conflist|
+ conf = tk_split_simplelist(conflist)
+ conf[0] = conf[0][1..-1]
+ case conf[0]
+ when 'text', 'label', 'show'
+ else
+ if conf[3]
+ if conf[3].index('{')
+ conf[3] = tk_split_list(conf[3])
+ else
+ conf[3] = tk_tcl2ruby(conf[3])
+ end
+ end
+ if conf[4]
+ if conf[4].index('{')
+ conf[4] = tk_split_list(conf[4])
+ else
+ conf[4] = tk_tcl2ruby(conf[4])
+ end
+ end
+ end
+ conf[1] = conf[1][1..-1] if conf.size == 2 # alias info
+ conf
+ }
+ fontconf = ret.assoc('font')
+ if fontconf
+ ret.delete_if{|item| item[0] == 'font' || item[0] == 'kanjifont'}
+ fontconf[4] = tagfont_configinfo(index, fontconf[4])
+ ret.push(fontconf)
+ else
+ ret
+ end
+ end
+ else # ! TkComm::GET_CONFIGINFO_AS_ARRAY
+ if key
+ case key.to_s
+ when 'text', 'label', 'show'
+ conf = tk_split_simplelist(_fromUTF8(tk_send_without_enc('itemconfigure',index,"-#{key}")))
+ when 'font', 'kanjifont'
+ conf = tk_split_simplelist(_fromUTF8(tk_send_without_enc('itemconfigure',index,"-#{key}")))
+ conf[4] = tagfont_configinfo(index, conf[4])
+ else
+ conf = tk_split_list(_fromUTF8(tk_send_without_enc('itemconfigure',index,"-#{key}")))
+ end
+ key = conf.shift[1..-1]
+ { key => conf }
+ else
+ ret = {}
+ tk_split_simplelist(_fromUTF8(tk_send_without_enc('itemconfigure', index))).each{|conflist|
+ conf = tk_split_simplelist(conflist)
+ key = conf.shift[1..-1]
+ case key
+ when 'text', 'label', 'show'
+ else
+ if conf[2]
+ if conf[2].index('{')
+ conf[2] = tk_split_list(conf[2])
+ else
+ conf[2] = tk_tcl2ruby(conf[2])
+ end
+ end
+ if conf[3]
+ if conf[3].index('{')
+ conf[3] = tk_split_list(conf[3])
+ else
+ conf[3] = tk_tcl2ruby(conf[3])
+ end
+ end
+ end
+ if conf.size == 1
+ ret[key] = conf[0][1..-1] # alias info
+ else
+ ret[key] = conf
+ end
+ }
+ fontconf = ret['font']
+ if fontconf
+ ret.delete('font')
+ ret.delete('kanjifont')
+ fontconf[3] = tagfont_configinfo(index, fontconf[3])
+ ret['font'] = fontconf
+ end
+ ret
+ end
+ end
+ end
+
+ def current_itemconfiginfo(index, key=nil)
+ if TkComm::GET_CONFIGINFO_AS_ARRAY
+ if key
+ conf = itemconfiginfo(index, key)
+ {conf[0] => conf[4]}
+ else
+ ret = {}
+ itemconfiginfo(index).each{|conf|
+ ret[conf[0]] = conf[4] if conf.size > 2
+ }
+ ret
+ end
+ else # ! TkComm::GET_CONFIGINFO_AS_ARRAY
+ ret = {}
+ itemconfiginfo(index, key).each{|k, conf|
+ ret[k] = conf[-1] if conf.kind_of?(Array)
+ }
+ ret
+ end
+ end
+end
diff --git a/ext/tk/lib/tk/macpkg.rb b/ext/tk/lib/tk/macpkg.rb
new file mode 100644
index 0000000000..d67a19745b
--- /dev/null
+++ b/ext/tk/lib/tk/macpkg.rb
@@ -0,0 +1,68 @@
+#
+# tk/macpkg.rb : methods for Tcl/Tk packages for Macintosh
+# 2000/11/22 by Hidetoshi Nagai <nagai@ai.kyutech.ac.jp>
+#
+# ATTENTION !!
+# This is NOT TESTED. Because I have no test-environment.
+#
+#
+require 'tk'
+
+module Tk
+ def Tk.load_tclscript_rsrc(resource_name, file=None)
+ # Mac only
+ tk_call('source', '-rsrc', resource_name, file)
+ end
+
+ def Tk.load_tclscript_rsrcid(resource_id, file=None)
+ # Mac only
+ tk_call('source', '-rsrcid', resource_id, file)
+ end
+end
+
+module TkMacResource
+ extend Tk
+ extend TkMacResource
+
+ TkCommandNames = ['resource'.freeze].freeze
+
+ tk_call_without_enc('package', 'require', 'resource')
+
+ def close(rsrcRef)
+ tk_call('resource', 'close', rsrcRef)
+ end
+
+ def delete(rsrcType, opts=nil)
+ tk_call('resource', 'delete', *(hash_kv(opts) << rsrcType))
+ end
+
+ def files(rsrcRef=nil)
+ if rsrcRef
+ tk_call('resource', 'files', rsrcRef)
+ else
+ tk_split_simplelist(tk_call('resource', 'files'))
+ end
+ end
+
+ def list(rsrcType, rsrcRef=nil)
+ tk_split_simplelist(tk_call('resource', 'list', rsrcType, rsrcRef))
+ end
+
+ def open(fname, access=nil)
+ tk_call('resource', 'open', fname, access)
+ end
+
+ def read(rsrcType, rsrcID, rsrcRef=nil)
+ tk_call('resource', 'read', rsrcType, rsrcID, rsrcRef)
+ end
+
+ def types(rsrcRef=nil)
+ tk_split_simplelist(tk_call('resource', 'types', rsrcRef))
+ end
+
+ def write(rsrcType, data, opts=nil)
+ tk_call('resource', 'write', *(hash_kv(opts) << rsrcType << data))
+ end
+
+ module_function :close, :delete, :files, :list, :open, :read, :types, :write
+end
diff --git a/ext/tk/lib/tk/menu.rb b/ext/tk/lib/tk/menu.rb
new file mode 100644
index 0000000000..9c34741b1b
--- /dev/null
+++ b/ext/tk/lib/tk/menu.rb
@@ -0,0 +1,460 @@
+#
+# tk/menu.rb : treat menu and menubutton
+#
+require 'tk'
+
+module TkTreatMenuEntryFont
+ include TkTreatItemFont
+
+ ItemCMD = ['entryconfigure'.freeze, TkComm::None].freeze
+ def __conf_cmd(idx)
+ ItemCMD[idx]
+ end
+
+ def __item_pathname(tagOrId)
+ self.path + ';' + tagOrId.to_s
+ end
+
+ private :__conf_cmd, :__item_pathname
+end
+
+class TkMenu<TkWindow
+ include TkTreatMenuEntryFont
+
+ TkCommandNames = ['menu'.freeze].freeze
+ WidgetClassName = 'Menu'.freeze
+ WidgetClassNames[WidgetClassName] = self
+
+ def create_self(keys)
+ if keys and keys != None
+ tk_call_without_enc('menu', @path, *hash_kv(keys, true))
+ else
+ tk_call_without_enc('menu', @path)
+ end
+ end
+ private :create_self
+
+ def activate(index)
+ tk_send_without_enc('activate', _get_eval_enc_str(index))
+ self
+ end
+ def add(type, keys=nil)
+ tk_send_without_enc('add', type, *hash_kv(keys, true))
+ self
+ end
+ def add_cascade(keys=nil)
+ add('cascade', keys)
+ end
+ def add_checkbutton(keys=nil)
+ add('checkbutton', keys)
+ end
+ def add_command(keys=nil)
+ add('command', keys)
+ end
+ def add_radiobutton(keys=nil)
+ add('radiobutton', keys)
+ end
+ def add_separator(keys=nil)
+ add('separator', keys)
+ end
+ def index(index)
+ ret = tk_send_without_enc('index', _get_eval_enc_str(index))
+ (ret == 'none')? nil: number(ret)
+ end
+ def invoke(index)
+ _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),
+ type, *hash_kv(keys, true))
+ self
+ end
+ def delete(first, last=nil)
+ if last
+ 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))
+ end
+ self
+ end
+ def popup(x, y, index=nil)
+ if index
+ tk_call_without_enc('tk_popup', path, x, y,
+ _get_eval_enc_str(index))
+ else
+ tk_call_without_enc('tk_popup', path, x, y)
+ end
+ self
+ end
+ def post(x, y)
+ _fromUTF8(tk_send_without_enc('post', x, y))
+ end
+ def postcascade(index)
+ tk_send_without_enc('postcascade', _get_eval_enc_str(index))
+ self
+ end
+ def postcommand(cmd=Proc.new)
+ configure_cmd 'postcommand', cmd
+ self
+ end
+ def set_focus
+ tk_call_without_enc('tk_menuSetFocus', path)
+ self
+ end
+ def tearoffcommand(cmd=Proc.new)
+ configure_cmd 'tearoffcommand', cmd
+ self
+ end
+ def menutype(index)
+ tk_send_without_enc('type', _get_eval_enc_str(index))
+ end
+ def unpost
+ tk_send_without_enc('unpost')
+ self
+ end
+ def yposition(index)
+ number(tk_send_without_enc('yposition', _get_eval_enc_str(index)))
+ end
+ def entrycget(index, key)
+ case key.to_s
+ when 'text', 'label', 'show'
+ _fromUTF8(tk_send_without_enc('entrycget',
+ _get_eval_enc_str(index), "-#{key}"))
+ when 'font', 'kanjifont'
+ #fnt = tk_tcl2ruby(tk_send('entrycget', index, "-#{key}"))
+ fnt = tk_tcl2ruby(_fromUTF8(tk_send_without_enc('entrycget', _get_eval_enc_str(index), '-font')))
+ unless fnt.kind_of?(TkFont)
+ fnt = tagfontobj(index, fnt)
+ end
+ if key.to_s == 'kanjifont' && JAPANIZED_TK && TK_VERSION =~ /^4\.*/
+ # obsolete; just for compatibility
+ fnt.kanji_font
+ else
+ fnt
+ end
+ else
+ tk_tcl2ruby(_fromUTF8(tk_send_without_enc('entrycget', _get_eval_enc_str(index), "-#{key}")))
+ end
+ 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] ||
+ key['asciifont'] || key[:asciifont])
+ tagfont_configure(index, _symbolkey2str(key))
+ else
+ 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 ||
+ key == 'asciifont' || key == :asciifont )
+ if val == None
+ tagfontobj(index)
+ else
+ tagfont_configure(index, {key=>val})
+ end
+ else
+ tk_call('entryconfigure', index, "-#{key}", val)
+ end
+ end
+ self
+ end
+
+ def entryconfiginfo(index, key=nil)
+ if TkComm::GET_CONFIGINFO_AS_ARRAY
+ if key
+ case key.to_s
+ when 'text', 'label', 'show'
+ conf = tk_split_simplelist(_fromUTF8(tk_send_without_enc('entryconfigure',_get_eval_enc_str(index),"-#{key}")))
+ when 'font', 'kanjifont'
+ conf = tk_split_simplelist(_fromUTF8(tk_send_without_enc('entryconfigure',_get_eval_enc_str(index),"-#{key}")))
+ conf[4] = tagfont_configinfo(index, conf[4])
+ else
+ conf = tk_split_list(_fromUTF8(tk_send_without_enc('entryconfigure',_get_eval_enc_str(index),"-#{key}")))
+ end
+ conf[0] = conf[0][1..-1]
+ conf
+ else
+ ret = tk_split_simplelist(_fromUTF8(tk_send_without_enc('entryconfigure', _get_eval_enc_str(index)))).collect{|conflist|
+ conf = tk_split_simplelist(conflist)
+ conf[0] = conf[0][1..-1]
+ case conf[0]
+ when 'text', 'label', 'show'
+ else
+ if conf[3]
+ if conf[3].index('{')
+ conf[3] = tk_split_list(conf[3])
+ else
+ conf[3] = tk_tcl2ruby(conf[3])
+ end
+ end
+ if conf[4]
+ if conf[4].index('{')
+ conf[4] = tk_split_list(conf[4])
+ else
+ conf[4] = tk_tcl2ruby(conf[4])
+ end
+ end
+ end
+ conf[1] = conf[1][1..-1] if conf.size == 2 # alias info
+ conf
+ }
+ if fontconf
+ ret.delete_if{|item| item[0] == 'font' || item[0] == 'kanjifont'}
+ fontconf[4] = tagfont_configinfo(index, fontconf[4])
+ ret.push(fontconf)
+ else
+ ret
+ end
+ end
+ else # ! TkComm::GET_CONFIGINFO_AS_ARRAY
+ if key
+ case key.to_s
+ when 'text', 'label', 'show'
+ conf = tk_split_simplelist(_fromUTF8(tk_send_without_enc('entryconfigure',_get_eval_enc_str(index),"-#{key}")))
+ when 'font', 'kanjifont'
+ conf = tk_split_simplelist(_fromUTF8(tk_send_without_enc('entryconfigure',_get_eval_enc_str(index),"-#{key}")))
+ conf[4] = tagfont_configinfo(index, conf[4])
+ else
+ conf = tk_split_list(_fromUTF8(tk_send_without_enc('entryconfigure',_get_eval_enc_str(index),"-#{key}")))
+ end
+ key = conf.shift[1..-1]
+ { key => conf }
+ else
+ ret = {}
+ tk_split_simplelist(_fromUTF8(tk_send_without_enc('entryconfigure', _get_eval_enc_str(index)))).each{|conflist|
+ conf = tk_split_simplelist(conflist)
+ key = conf.shift[1..-1]
+ case key
+ when 'text', 'label', 'show'
+ else
+ if conf[2]
+ if conf[2].index('{')
+ conf[2] = tk_split_list(conf[2])
+ else
+ conf[2] = tk_tcl2ruby(conf[2])
+ end
+ end
+ if conf[3]
+ if conf[3].index('{')
+ conf[3] = tk_split_list(conf[3])
+ else
+ conf[3] = tk_tcl2ruby(conf[3])
+ end
+ end
+ end
+ if conf.size == 1
+ ret[key] = conf[0][1..-1] # alias info
+ else
+ ret[key] = conf
+ end
+ }
+ fontconf = ret['font']
+ if fontconf
+ ret.delete('font')
+ ret.delete('kanjifont')
+ fontconf[3] = tagfont_configinfo(index, fontconf[3])
+ ret['font'] = fontconf
+ end
+ ret
+ end
+ end
+ end
+
+ def current_entryconfiginfo(index, key=nil)
+ if TkComm::GET_CONFIGINFO_AS_ARRAY
+ if key
+ conf = entryconfiginfo(index, key)
+ {conf[0] => conf[4]}
+ else
+ ret = {}
+ entryconfiginfo(index).each{|conf|
+ ret[conf[0]] = conf[4] if conf.size > 2
+ }
+ ret
+ end
+ else # ! TkComm::GET_CONFIGINFO_AS_ARRAY
+ ret = {}
+ entryconfiginfo(index, key).each{|k, conf|
+ ret[k] = conf[-1] if conf.kind_of?(Array)
+ }
+ ret
+ end
+ end
+end
+
+
+class TkMenuClone<TkMenu
+ def initialize(parent, type=None)
+ widgetname = nil
+ if parent.kind_of? Hash
+ keys = _symbolkey2str(parent)
+ parent = keys.delete('parent')
+ widgetname = keys.delete('widgetname')
+ type = keys.delete('type'); type = None unless type
+ end
+ unless parent.kind_of?(TkMenu)
+ fail ArgumentError, "parent must be TkMenu"
+ end
+ @parent = parent
+ install_win(@parent.path, widgetname)
+ tk_call_without_enc(@parent.path, 'clone', @path, type)
+ end
+end
+
+
+module TkSystemMenu
+ def initialize(parent, keys=nil)
+ if parent.kind_of? Hash
+ keys = _symbolkey2str(parent)
+ parent = keys.delete('parent')
+ end
+ unless parent.kind_of? TkMenu
+ fail ArgumentError, "parent must be a TkMenu object"
+ end
+ # @path = Kernel.format("%s.%s", parent.path, self.class::SYSMENU_NAME)
+ @path = parent_path + '.' + self.class::SYSMENU_NAME
+ #TkComm::Tk_WINDOWS[@path] = self
+ TkCore::INTERP.tk_windows[@path] = self
+ if self.method(:create_self).arity == 0
+ p 'create_self has no arg' if $DEBUG
+ create_self
+ configure(keys) if keys
+ else
+ p 'create_self has an arg' if $DEBUG
+ create_self(keys)
+ end
+ end
+end
+
+
+class TkSysMenu_Help<TkMenu
+ # for all platform
+ include TkSystemMenu
+ SYSMENU_NAME = 'help'
+end
+
+
+class TkSysMenu_System<TkMenu
+ # for Windows
+ include TkSystemMenu
+ SYSMENU_NAME = 'system'
+end
+
+
+class TkSysMenu_Apple<TkMenu
+ # for Machintosh
+ include TkSystemMenu
+ SYSMENU_NAME = 'apple'
+end
+
+
+class TkMenubutton<TkLabel
+ TkCommandNames = ['menubutton'.freeze].freeze
+ WidgetClassName = 'Menubutton'.freeze
+ WidgetClassNames[WidgetClassName] = self
+ def create_self(keys)
+ if keys and keys != None
+ tk_call_without_enc('menubutton', @path, *hash_kv(keys, true))
+ else
+ tk_call_without_enc('menubutton', @path)
+ end
+ end
+ private :create_self
+end
+
+
+class TkOptionMenubutton<TkMenubutton
+ TkCommandNames = ['tk_optionMenu'.freeze].freeze
+
+ class OptionMenu<TkMenu
+ def initialize(path) #==> return value of tk_optionMenu
+ @path = path
+ #TkComm::Tk_WINDOWS[@path] = self
+ TkCore::INTERP.tk_windows[@path] = self
+ end
+ end
+
+ def initialize(parent=nil, var=TkVariable.new, firstval=nil, *vals)
+ if parent.kind_of? Hash
+ keys = _symbolkey2str(parent)
+ parent = keys['parent']
+ var = keys['variable'] if keys['variable']
+ firstval, *vals = keys['values']
+ end
+ fail 'variable option must be TkVariable' unless var.kind_of? TkVariable
+ @variable = var
+ firstval = @variable.value unless firstval
+ @variable.value = firstval
+ install_win(if parent then parent.path end)
+ @menu = OptionMenu.new(tk_call('tk_optionMenu', @path, @variable.id,
+ firstval, *vals))
+ end
+
+ def value
+ @variable.value
+ end
+
+ def activate(index)
+ @menu.activate(index)
+ self
+ end
+ def add(value)
+ @menu.add('radiobutton', 'variable'=>@variable,
+ 'label'=>value, 'value'=>value)
+ self
+ end
+ def index(index)
+ @menu.index(index)
+ end
+ def invoke(index)
+ @menu.invoke(index)
+ end
+ def insert(index, value)
+ @menu.add(index, 'radiobutton', 'variable'=>@variable,
+ 'label'=>value, 'value'=>value)
+ self
+ end
+ def delete(index, last=None)
+ @menu.delete(index, last)
+ self
+ end
+ def yposition(index)
+ @menu.yposition(index)
+ end
+ def menu
+ @menu
+ end
+ def menucget(key)
+ @menu.cget(key)
+ end
+ def menuconfigure(key, val=None)
+ @menu.configure(key, val)
+ self
+ end
+ def menuconfiginfo(key=nil)
+ @menu.configinfo(key)
+ end
+ def current_menuconfiginfo(key=nil)
+ @menu.current_configinfo(key)
+ end
+ def entrycget(index, key)
+ @menu.entrycget(index, key)
+ end
+ def entryconfigure(index, key, val=None)
+ @menu.entryconfigure(index, key, val)
+ self
+ end
+ def entryconfiginfo(index, key=nil)
+ @menu.entryconfiginfo(index, key)
+ end
+ def current_entryconfiginfo(index, key=nil)
+ @menu.current_entryconfiginfo(index, key)
+ end
+end
diff --git a/ext/tk/lib/tk/menubar.rb b/ext/tk/lib/tk/menubar.rb
new file mode 100644
index 0000000000..2c2846e9b6
--- /dev/null
+++ b/ext/tk/lib/tk/menubar.rb
@@ -0,0 +1,144 @@
+#
+# tk/menubar.rb
+#
+# Copyright (C) 1998 maeda shugo. All rights reserved.
+# This file can be distributed under the terms of the Ruby.
+
+# Usage:
+#
+# menu_spec = [
+# [['File', 0],
+# ['Open', proc{puts('Open clicked')}, 0],
+# '---',
+# ['Quit', proc{exit}, 0]],
+# [['Edit', 0],
+# ['Cut', proc{puts('Cut clicked')}, 2],
+# ['Copy', proc{puts('Copy clicked')}, 0],
+# ['Paste', proc{puts('Paste clicked')}, 0]]
+# ]
+# menubar = TkMenubar.new(nil, menu_spec,
+# 'tearoff'=>false,
+# 'foreground'=>'grey40',
+# 'activeforeground'=>'red',
+# 'font'=>'-adobe-helvetica-bold-r-*--12-*-iso8859-1')
+# menubar.pack('side'=>'top', 'fill'=>'x')
+#
+#
+# OR
+#
+#
+# menubar = TkMenubar.new
+# menubar.add_menu([['File', 0],
+# ['Open', proc{puts('Open clicked')}, 0],
+# '---',
+# ['Quit', proc{exit}, 0]])
+# menubar.add_menu([['Edit', 0],
+# ['Cut', proc{puts('Cut clicked')}, 2],
+# ['Copy', proc{puts('Copy clicked')}, 0],
+# ['Paste', proc{puts('Paste clicked')}, 0]])
+# menubar.configure('tearoff', false)
+# menubar.configure('foreground', 'grey40')
+# menubar.configure('activeforeground', 'red')
+# menubar.configure('font', '-adobe-helvetica-bold-r-*--12-*-iso8859-1')
+# menubar.pack('side'=>'top', 'fill'=>'x')
+
+# The format of the menu_spec is:
+# [
+# [
+# [button text, underline, accelerator],
+# [menu label, command, underline, accelerator],
+# '---', # separator
+# ...
+# ],
+# ...
+# ]
+
+# underline and accelerator are optional parameters.
+# Hashes are OK instead of Arrays.
+
+# To use add_menu, configuration must be done by calling configure after
+# adding all menus by add_menu, not by the constructor arguments.
+
+require 'tk'
+require 'tk/frame'
+
+class TkMenubar<TkFrame
+
+ include TkComposite
+
+ def initialize(parent = nil, spec = nil, options = nil)
+ if parent.kind_of? Hash
+ options = _symbolkey2str(parent)
+ spec = options.delete('spec')
+ super(options)
+ else
+ super(parent, options)
+ end
+
+ @menus = []
+
+ if spec
+ for menu_info in spec
+ add_menu(menu_info)
+ end
+ end
+
+ if options
+ for key, value in options
+ configure(key, value)
+ end
+ end
+ end
+
+ def add_menu(menu_info)
+ btn_info = menu_info.shift
+ mbtn = TkMenubutton.new(@frame)
+
+ if btn_info.kind_of?(Hash)
+ for key, value in btn_info
+ mbtn.configure(key, value)
+ end
+ elsif btn_info.kind_of?(Array)
+ mbtn.configure('text', btn_info[0]) if btn_info[0]
+ mbtn.configure('underline', btn_info[1]) if btn_info[1]
+ mbtn.configure('accelerator', btn_info[2]) if btn_info[2]
+ else
+ mbtn.configure('text', btn_info)
+ end
+
+ menu = TkMenu.new(mbtn)
+
+ for item_info in menu_info
+ if item_info.kind_of?(Hash)
+ menu.add('command', item_info)
+ elsif item_info.kind_of?(Array)
+ options = {}
+ options['label'] = item_info[0] if item_info[0]
+ options['command'] = item_info[1] if item_info[1]
+ options['underline'] = item_info[2] if item_info[2]
+ options['accelerator'] = item_info[3] if item_info[3]
+ menu.add('command', options)
+ elsif /^-+$/ =~ item_info
+ menu.add('sep')
+ else
+ menu.add('command', 'label' => item_info)
+ end
+ end
+
+ mbtn.menu(menu)
+ @menus.push([mbtn, menu])
+ delegate('tearoff', menu)
+ delegate('foreground', mbtn, menu)
+ delegate('background', mbtn, menu)
+ delegate('disabledforeground', mbtn, menu)
+ delegate('activeforeground', mbtn, menu)
+ delegate('activebackground', mbtn, menu)
+ delegate('font', mbtn, menu)
+ delegate('kanjifont', mbtn, menu)
+ mbtn.pack('side' => 'left')
+ end
+
+ def [](index)
+ return @menus[index]
+ end
+end
diff --git a/ext/tk/lib/tk/message.rb b/ext/tk/lib/tk/message.rb
new file mode 100644
index 0000000000..b359800142
--- /dev/null
+++ b/ext/tk/lib/tk/message.rb
@@ -0,0 +1,19 @@
+#
+# tk/message.rb : treat message widget
+#
+require 'tk'
+require 'tk/label'
+
+class TkMessage<TkLabel
+ TkCommandNames = ['message'.freeze].freeze
+ WidgetClassName = 'Message'.freeze
+ WidgetClassNames[WidgetClassName] = self
+ def create_self(keys)
+ if keys and keys != None
+ tk_call_without_enc('message', @path, *hash_kv(keys, true))
+ else
+ tk_call_without_enc('message', @path)
+ end
+ end
+ private :create_self
+end
diff --git a/ext/tk/lib/tk/mngfocus.rb b/ext/tk/lib/tk/mngfocus.rb
new file mode 100644
index 0000000000..a0f18233be
--- /dev/null
+++ b/ext/tk/lib/tk/mngfocus.rb
@@ -0,0 +1,33 @@
+#
+# tk/mngfocus.rb : methods for Tcl/Tk standard library 'focus.tcl'
+# by Hidetoshi Nagai <nagai@ai.kyutech.ac.jp>
+#
+require 'tk'
+
+module TkManageFocus
+ extend Tk
+
+ TkCommandNames = [
+ 'tk_focusFollowMouse'.freeze,
+ 'tk_focusNext'.freeze,
+ 'tk_focusPrev'.freeze
+ ].freeze
+
+ def TkManageFocus.followsMouse
+ tk_call_without_enc('tk_focusFollowsMouse')
+ end
+
+ def TkManageFocus.next(window)
+ tk_tcl2ruby(tk_call('tk_focusNext', window))
+ end
+ def focusNext
+ TkManageFocus.next(self)
+ end
+
+ def TkManageFocus.prev(window)
+ tk_tcl2ruby(tk_call('tk_focusPrev', window))
+ end
+ def focusPrev
+ TkManageFocus.prev(self)
+ end
+end
diff --git a/ext/tk/lib/tk/msgcat.rb b/ext/tk/lib/tk/msgcat.rb
new file mode 100644
index 0000000000..6c46542faf
--- /dev/null
+++ b/ext/tk/lib/tk/msgcat.rb
@@ -0,0 +1,268 @@
+#
+# tk/msgcat.rb : methods for Tcl message catalog
+# by Hidetoshi Nagai <nagai@ai.kyutech.ac.jp>
+#
+require 'tk'
+
+#class TkMsgCatalog
+class TkMsgCatalog < TkObject
+ include TkCore
+ extend Tk
+ #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::mcunknown'.freeze
+ ].freeze
+
+ tk_call_without_enc('package', 'require', 'Tcl', '8.2')
+
+ if self.const_defined? :FORCE_VERSION
+ tk_call_without_enc('package', 'require', 'msgcat', FORCE_VERSION)
+ else
+ tk_call_without_enc('package', 'require', 'msgcat')
+ end
+
+ MSGCAT_EXT = '.msg'
+
+ UNKNOWN_CBTBL = Hash.new{|hash,key| hash[key] = {}}.taint
+
+ TkCore::INTERP.add_tk_procs('::msgcat::mcunknown', 'args', <<-'EOL')
+ if {[set st [catch {eval {ruby_cmd TkMsgCatalog callback} [namespace current] $args} ret]] != 0} {
+ #return -code $st $ret
+ set idx [string first "\n\n" $ret]
+ if {$idx > 0} {
+ return -code $st \
+ -errorinfo [string range $ret [expr $idx + 2] \
+ [string length $ret]] \
+ [string range $ret 0 [expr $idx - 1]]
+ } else {
+ return -code $st $ret
+ }
+ } else {
+ return $ret
+ }
+ EOL
+
+ def self.callback(namespace, locale, src_str)
+ cmd_tbl = TkMsgCatalog::UNKNOWN_CBTBL[TkCore::INTERP.__getip]
+ cmd = cmd_tbl[namespace]
+ cmd = cmd_tbl['::'] unless cmd # use global scope as interp default
+ return src_str unless cmd # no cmd -> return src-str (default action)
+ begin
+ cmd.call(locale, src_str)
+ rescue Exception => e
+ begin
+ 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 >-------"
+ msg.instance_variable_set(:@encoding, 'utf-8')
+ rescue Exception
+ 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)
+ end
+ end
+
+ def initialize(namespace = nil)
+ if namespace.kind_of?(TkNamespace)
+ @namespace = namespace
+ elsif namespace == nil
+ @namespace = TkNamespace.new('::') # global namespace
+ else
+ @namespace = TkNamespace.new(namespace)
+ end
+ @path = @namespace.path
+
+ @msgcat_ext = '.msg'
+ end
+ attr_accessor :msgcat_ext
+
+ def method_missing(id, *args)
+ # locale(src, trans) ==> set_translation(locale, src, trans)
+ loc = id.id2name
+ case args.length
+ when 0 # set locale
+ self.locale=(loc)
+
+ when 1 # src only, or trans_list
+ if args[0].kind_of?(Array)
+ # trans_list
+ #list = args[0].collect{|src, trans|
+ # [ Tk::UTF8_String.new(src), Tk::UTF8_String.new(trans) ]
+ #}
+ self.set_translation_list(loc, args[0])
+ else
+ # src
+ #self.set_translation(loc, Tk::UTF8_String.new(args[0]))
+ self.set_translation(loc, args[0])
+ end
+
+ when 2 # src and trans, or, trans_list and enc
+ if args[0].kind_of?(Array)
+ else
+ #self.set_translation(loc, args[0], Tk::UTF8_String.new(args[1]))
+ self.set_translation(loc, *args)
+ end
+
+ when 3 # src and trans and enc
+ self.set_translation(loc, *args)
+
+ else
+ fail NameError, "undefined method `#{name}' for #{self.to_s}", error_at
+
+ end
+ end
+
+ # *args ::= form, arg, arg, ...
+ def self.translate(*args)
+ dst = args.collect{|src|
+ tk_call_without_enc('::msgcat::mc', _get_eval_string(src, true))
+ }
+ Tk.UTF8_String(sprintf(*dst))
+ end
+ class << self
+ alias mc translate
+ alias [] translate
+ end
+ def translate(*args)
+ dst = args.collect{|src|
+ @namespace.eval{tk_call_without_enc('::msgcat::mc',
+ _get_eval_string(src, true))}
+ }
+ Tk.UTF8_String(sprintf(*dst))
+ end
+ alias mc translate
+ alias [] translate
+
+ def self.maxlen(*src_strings)
+ tk_call('::msgcat::mcmax', *src_strings).to_i
+ end
+ def maxlen(*src_strings)
+ @namespace.eval{tk_call('::msgcat::mcmax', *src_strings).to_i}
+ end
+
+ def self.locale
+ tk_call('::msgcat::mclocale')
+ end
+ def locale
+ @namespace.eval{tk_call('::msgcat::mclocale')}
+ end
+
+ def self.locale=(locale)
+ tk_call('::msgcat::mclocale', locale)
+ end
+ def locale=(locale)
+ @namespace.eval{tk_call('::msgcat::mclocale', locale)}
+ end
+
+ def self.preferences
+ tk_split_simplelist(tk_call('::msgcat::mcpreferences'))
+ end
+ def preferences
+ tk_split_simplelist(@namespace.eval{tk_call('::msgcat::mcpreferences')})
+ end
+
+ def self.load_tk(dir)
+ number(tk_call('::msgcat::mcload', dir))
+ end
+
+ def self.load_rb(dir)
+ count = 0
+ preferences().each{|loc|
+ file = File.join(dir, loc + self::MSGCAT_EXT)
+ if File.readable?(file)
+ count += 1
+ eval(open(file){|f| f.read})
+ end
+ }
+ count
+ end
+
+ def load_tk(dir)
+ number(@namespace.eval{tk_call('::msgcat::mcload', dir)})
+ end
+
+ def load_rb(dir)
+ count = 0
+ preferences().each{|loc|
+ file = File.join(dir, loc + @msgcat_ext)
+ if File.readable?(file)
+ count += 1
+ @namespace.eval(open(file){|f| f.read})
+ end
+ }
+ count
+ end
+
+ def self.load(dir)
+ self.load_rb(dir)
+ end
+ alias load load_rb
+
+ def self.set_translation(locale, src_str, trans_str=None, enc='utf-8')
+ trans_str = Tk.UTF8_String(_toUTF8(trans_str, enc)) if trans_str != None
+ Tk.UTF8_String(tk_call_without_enc('::msgcat::mcset',
+ locale,
+ _get_eval_string(src_str, true),
+ trans_str))
+ end
+ def set_translation(locale, src_str, trans_str=None, enc='utf-8')
+ trans_str = Tk.UTF8_String(_toUTF8(trans_str, enc)) if trans_str != None
+ Tk.UTF8_String(@namespace.eval{
+ tk_call_without_enc('::msgcat::mcset',
+ locale,
+ _get_eval_string(src_str, true),
+ trans_str)
+ })
+ end
+
+ def self.set_translation_list(locale, trans_list, enc='utf-8')
+ # trans_list ::= [ [src, trans], [src, trans], ... ]
+ list = []
+ trans_list.each{|src, trans|
+ if trans && trans != None
+ list << _get_eval_string(src, true)
+ list << Tk.UTF8_Stirng(_toUTF8(trans, enc))
+ else
+ list << _get_eval_string(src, true) << ''
+ end
+ }
+ number(tk_call_without_enc('::msgcat::mcmset', locale, list))
+ end
+ def set_translation_list(locale, trans_list, enc='utf-8')
+ # trans_list ::= [ [src, trans], [src, trans], ... ]
+ list = []
+ trans_list.each{|src, trans|
+ if trans && trans != None
+ list << _get_eval_string(src, true)
+ list << Tk.UTF8_String(_toUTF8(trans, enc))
+ else
+ list << _get_eval_string(src, true) << ''
+ end
+ }
+ number(@namespace.eval{
+ tk_call_without_enc('::msgcat::mcmset', locale, list)
+ })
+ end
+
+ def self.def_unknown_proc(cmd=Proc.new)
+ TkMsgCatalog::UNKNOWN_CBTBL[TkCore::INTERP.__getip]['::'] = cmd
+ end
+ def def_unknown_proc(cmd=Proc.new)
+ TkMsgCatalog::UNKNOWN_CBTBL[TkCore::INTERP.__getip][@namespace.path] = cmd
+ end
+end
+
+TkMsgCat = TkMsgCatalog
diff --git a/ext/tk/lib/tk/namespace.rb b/ext/tk/lib/tk/namespace.rb
new file mode 100644
index 0000000000..72e9500a49
--- /dev/null
+++ b/ext/tk/lib/tk/namespace.rb
@@ -0,0 +1,293 @@
+#
+# tk/namespace.rb : methods to manipulate Tcl/Tk namespace
+# by Hidetoshi Nagai <nagai@ai.kyutech.ac.jp>
+#
+require 'tk'
+
+class TkNamespace < TkObject
+ extend Tk
+
+ TkCommandNames = [
+ 'namespace'.freeze,
+ ].freeze
+
+ Tk_Namespace_ID_TBL = TkCore::INTERP.create_table
+ Tk_Namespace_ID = ["ns".freeze, "00000".taint].freeze
+
+ class ScopeArgs < Array
+ include Tk
+
+ # alias __tk_call tk_call
+ # alias __tk_call_without_enc tk_call_without_enc
+ # alias __tk_call_with_enc tk_call_with_enc
+ def tk_call(*args)
+ #super('namespace', 'eval', @namespace, *args)
+ args = args.collect{|arg| (s = _get_eval_string(arg))? s: ''}
+ 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))? s: ''}
+ 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))? s: ''}
+ super('namespace', 'eval', @namespace,
+ TkCore::INTERP._merge_tklist(*args))
+ end
+
+ def initialize(namespace, *args)
+ @namespace = namespace
+ super(args.size)
+ self.replace(args)
+ end
+ end
+
+ class NsCode < TkObject
+ def initialize(scope)
+ @scope = scope + ' '
+ end
+ def path
+ @scope
+ end
+ def to_eval
+ @scope
+ end
+ def call(*args)
+ TkCore::INTERP._eval_without_enc(@scope + array2tk_list(args))
+ end
+ end
+
+ alias __tk_call tk_call
+ alias __tk_call_without_enc tk_call_without_enc
+ alias __tk_call_with_enc tk_call_with_enc
+ def tk_call(*args)
+ #super('namespace', 'eval', @fullname, *args)
+ args = args.collect{|arg| (s = _get_eval_string(arg))? s: ''}
+ 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))? s: ''}
+ 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))? s: ''}
+ super('namespace', 'eval', @fullname,
+ TkCore::INTERP._merge_tklist(*args))
+ end
+ alias ns_tk_call tk_call
+ alias ns_tk_call_without_enc tk_call_without_enc
+ alias ns_tk_call_with_enc tk_call_with_enc
+
+ def initialize(name = nil, parent = nil)
+ unless name
+ name = Tk_Namespace_ID.join('')
+ Tk_Namespace_ID[1].succ!
+ end
+ name = __tk_call('namespace', 'current') if name == ''
+ if parent
+ if parent =~ /^::/
+ if name =~ /^::/
+ @fullname = parent + name
+ else
+ @fullname = parent +'::'+ name
+ end
+ else
+ ancestor = __tk_call('namespace', 'current')
+ ancestor = '' if ancestor == '::'
+ if name =~ /^::/
+ @fullname = ancestor + '::' + parent + name
+ else
+ @fullname = ancestor + '::'+ parent +'::'+ name
+ end
+ end
+ else # parent == nil
+ ancestor = __tk_call('namespace', 'current')
+ ancestor = '' if ancestor == '::'
+ if name =~ /^::/
+ @fullname = name
+ else
+ @fullname = ancestor + '::' + name
+ end
+ end
+ @path = @fullname
+ @parent = __tk_call('namespace', 'qualifiers', @fullname)
+ @name = __tk_call('namespace', 'tail', @fullname)
+
+ # create namespace
+ __tk_call('namespace', 'eval', @fullname, '')
+
+ Tk_Namespace_ID_TBL[@fullname] = self
+ end
+
+ def self.children(*args)
+ # args ::= [<namespace>] [<pattern>]
+ # <pattern> must be glob-style pattern
+ tk_split_simplelist(tk_call('namespace', 'children', *args)).collect{|ns|
+ # ns is fullname
+ if Tk_Namesapce_ID.key?(ns)
+ Tk_Namesapce_ID[ns]
+ else
+ ns
+ end
+ }
+ end
+ def children(pattern=None)
+ TkNamespace.children(@fullname, pattern)
+ end
+
+ def self.code(script = Proc.new)
+ TkNamespace.new('').code(script)
+ end
+ def code(script = Proc.new)
+ if script.kind_of?(String)
+ cmd = proc{|*args| ScopeArgs.new(@fullname,*args).instance_eval(script)}
+ elsif script.kind_of?(Proc)
+ cmd = proc{|*args| ScopeArgs.new(@fullname,*args).instance_eval(&script)}
+ else
+ fail ArgumentError, "String or Proc is expected"
+ end
+ TkNamespace::NsCode.new(tk_call_without_enc('namespace', 'code',
+ _get_eval_string(cmd, false)))
+ end
+
+ def self.current
+ tk_call('namespace', 'current')
+ end
+ def current_namespace
+ # ns_tk_call('namespace', 'current')
+ @fullname
+ end
+ alias current current_namespace
+
+ def self.delete(*ns_list)
+ tk_call('namespace', 'delete', *ns_list)
+ end
+ def delete
+ TkNamespece.delete(@fullname)
+ end
+
+ def self.ensemble_create(*keys)
+ tk_call('namespace', 'ensemble', 'create', *hash_kv(keys))
+ end
+ def self.ensemble_configure(cmd, slot, value=None)
+ if slot.kind_of?(Hash)
+ tk_call('namespace', 'ensemble', 'configure', cmd, *hash_kv(slot))
+ else
+ tk_call('namespace', 'ensemble', 'configure', cmd, '-'+slot.to_s, value)
+ end
+ end
+ def self.ensemble_configinfo(cmd, slot = nil)
+ if slot
+ tk_call('namespace', 'ensemble', 'configure', cmd, '-' + slot.to_s)
+ else
+ inf = {}
+ Hash(*tk_split_simplelist(tk_call('namespace', 'ensemble', 'configure', cmd))).each{|k, v| inf[k[1..-1]] = v}
+ inf
+ end
+ end
+ def self.ensemble_exist?(cmd)
+ bool(tk_call('namespace', 'ensemble', 'exists', cmd))
+ end
+
+ def self.eval(namespace, cmd = Proc.new, *args)
+ #tk_call('namespace', 'eval', namespace, cmd, *args)
+ TkNamespace.new(namespece).eval(cmd, *args)
+ end
+ def eval(cmd = Proc.new, *args)
+ #TkNamespace.eval(@fullname, cmd, *args)
+ #ns_tk_call(cmd, *args)
+ code_obj = code(cmd)
+ ret = code_obj.call(*args)
+ uninstall_cmd(TkCore::INTERP._split_tklist(code_obj.path)[-1])
+ ret
+ end
+
+ def self.exist?(ns)
+ bool(tk_call('namespace', 'exists', ns))
+ end
+ def exist?
+ TkNamespece.delete(@fullname)
+ end
+
+ def self.export(*patterns)
+ tk_call('namespace', 'export', *patterns)
+ end
+ def self.export_with_clear(*patterns)
+ tk_call('namespace', 'export', '-clear', *patterns)
+ end
+ def export
+ TkNamespace.export(@fullname)
+ end
+ def export_with_clear
+ TkNamespace.export_with_clear(@fullname)
+ end
+
+ def self.forget(*patterns)
+ tk_call('namespace', 'forget', *patterns)
+ end
+ def forget
+ TkNamespace.forget(@fullname)
+ end
+
+ def self.import(*patterns)
+ tk_call('namespace', 'import', *patterns)
+ end
+ def self.force_import(*patterns)
+ tk_call('namespace', 'import', '-force', *patterns)
+ end
+ def import
+ TkNamespace.import(@fullname)
+ end
+ def force_import
+ TkNamespace.force_import(@fullname)
+ end
+
+ def self.inscope(namespace, script, *args)
+ tk_call('namespace', 'inscope', namespace, script, *args)
+ end
+ def inscope(script, *args)
+ TkNamespace(@fullname, script, *args)
+ end
+
+ def self.origin(cmd)
+ tk_call('namespace', 'origin', cmd)
+ end
+
+ def self.parent(namespace=None)
+ ns = tk_call('namespace', 'parent', namespace)
+ if Tk_Namesapce_ID.key?(ns)
+ Tk_Namesapce_ID[ns]
+ else
+ ns
+ end
+ end
+ def parent
+ tk_call('namespace', 'parent', @fullname)
+ end
+
+ def self.qualifiers(str)
+ tk_call('namespace', 'qualifiers', str)
+ end
+
+ def self.tail(str)
+ tk_call('namespace', 'tail', str)
+ end
+
+ def self.which(name)
+ tk_call('namespace', 'which', name)
+ end
+ def self.which_command(name)
+ tk_call('namespace', 'which', '-command', name)
+ end
+ def self.which_variable(name)
+ tk_call('namespace', 'which', '-variable', name)
+ end
+end
diff --git a/ext/tk/lib/tk/optiondb.rb b/ext/tk/lib/tk/optiondb.rb
new file mode 100644
index 0000000000..588c946440
--- /dev/null
+++ b/ext/tk/lib/tk/optiondb.rb
@@ -0,0 +1,297 @@
+#
+# tk/optiondb.rb : treat option database
+#
+require 'tk'
+
+module TkOptionDB
+ include Tk
+ extend Tk
+
+ TkCommandNames = ['option'.freeze].freeze
+
+ module Priority
+ WidgetDefault = 20
+ StartupFile = 40
+ UserDefault = 60
+ Interactive = 80
+ end
+
+ def add(pat, value, pri=None)
+ if $SAFE >= 4
+ fail SecurityError, "can't call 'TkOptionDB.add' at $SAFE >= 4"
+ end
+ tk_call('option', 'add', pat, value, pri)
+ end
+ def clear
+ if $SAFE >= 4
+ fail SecurityError, "can't call 'TkOptionDB.crear' at $SAFE >= 4"
+ end
+ tk_call_without_enc('option', 'clear')
+ end
+ def get(win, name, klass)
+ tk_call('option', 'get', win ,name, klass)
+ end
+ def readfile(file, pri=None)
+ tk_call('option', 'readfile', file, pri)
+ end
+ module_function :add, :clear, :get, :readfile
+
+ def read_entries(file, f_enc=nil)
+ if TkCore::INTERP.safe?
+ fail SecurityError,
+ "can't call 'TkOptionDB.read_entries' on a safe interpreter"
+ end
+
+ i_enc = Tk.encoding()
+
+ unless f_enc
+ f_enc = i_enc
+ end
+
+ ent = []
+ cline = ''
+ open(file, 'r') {|f|
+ while line = f.gets
+ cline += line.chomp!
+ case cline
+ when /\\$/ # continue
+ cline.chop!
+ next
+ when /^\s*(!|#)/ # coment
+ cline = ''
+ next
+ when /^([^:]+):(.*)$/
+ pat = $1.strip
+ val = $2.lstrip
+ p "ResourceDB: #{[pat, val].inspect}" if $DEBUG
+ pat = TkCore::INTERP._toUTF8(pat, f_enc)
+ pat = TkCore::INTERP._fromUTF8(pat, i_enc)
+ val = TkCore::INTERP._toUTF8(val, f_enc)
+ val = TkCore::INTERP._fromUTF8(val, i_enc)
+ ent << [pat, val]
+ cline = ''
+ else # unknown --> ignore
+ cline = ''
+ next
+ end
+ end
+ }
+ 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|
+ add(pat, val, pri)
+ }
+
+=begin
+ i_enc = Tk.encoding()
+
+ unless f_enc
+ f_enc = i_enc
+ end
+
+ cline = ''
+ open(file, 'r') {|f|
+ while line = f.gets
+ cline += line.chomp!
+ case cline
+ when /\\$/ # continue
+ cline.chop!
+ next
+ when /^\s*!/ # coment
+ cline = ''
+ next
+ when /^([^:]+):\s(.*)$/
+ pat = $1
+ val = $2
+ p "ResourceDB: #{[pat, val].inspect}" if $DEBUG
+ pat = TkCore::INTERP._toUTF8(pat, f_enc)
+ pat = TkCore::INTERP._fromUTF8(pat, i_enc)
+ val = TkCore::INTERP._toUTF8(val, f_enc)
+ val = TkCore::INTERP._fromUTF8(val, i_enc)
+ add(pat, val, pri)
+ cline = ''
+ else # unknown --> ignore
+ cline = ''
+ next
+ end
+ end
+ }
+=end
+ end
+ module_function :read_with_encoding
+
+ # support procs on the resource database
+ @@resource_proc_class = Class.new
+ class << @@resource_proc_class
+ private :new
+
+ CARRIER = '.'.freeze
+ METHOD_TBL = TkCore::INTERP.create_table
+ ADD_METHOD = false
+ SAFE_MODE = 4
+
+=begin
+ def __closed_block_check__(str)
+ depth = 0
+ str.scan(/[{}]/){|x|
+ if x == "{"
+ depth += 1
+ elsif x == "}"
+ depth -= 1
+ end
+ if depth <= 0 && !($' =~ /\A\s*\Z/)
+ fail RuntimeError, "bad string for procedure : #{str.inspect}"
+ end
+ }
+ str
+ end
+ private :__closed_block_check__
+=end
+
+ 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.
+ str
+ end
+
+ def method_missing(id, *args)
+ res_proc, proc_str = self::METHOD_TBL[id]
+
+ proc_source = TkOptionDB.get(self::CARRIER, id.id2name, '').strip
+ res_proc = nil if proc_str != proc_source # resource is changed
+
+ unless res_proc.kind_of? Proc
+ if id == :new || !(self::METHOD_TBL.has_key?(id) || self::ADD_METHOD)
+ 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{
+ begin
+ eval("$SAFE = #{self::SAFE_MODE};\nProc.new" + proc_str)
+ rescue SyntaxError=>err
+ raise SyntaxError,
+ TkCore::INTERP._toUTF8(err.message.gsub(/\(eval\):\d:/,
+ "(#{id.id2name}):"))
+ end
+ }.call
+ self::METHOD_TBL[id] = [res_proc, proc_source]
+ end
+ res_proc.call(*args)
+ end
+
+ private :__check_proc_string__, :method_missing
+ end
+ @@resource_proc_class.freeze
+
+ def __create_new_class(klass, func, safe = 4, add = false, parent = nil)
+ klass = klass.to_s if klass.kind_of? Symbol
+ unless (?A..?Z) === klass[0]
+ fail ArgumentError, "bad string '#{klass}' for class name"
+ end
+ unless func.kind_of? Array
+ fail ArgumentError, "method-list must be Array"
+ end
+ func_str = func.join(' ')
+ if parent == nil
+ install_win(parent)
+ elsif parent <= @@resource_proc_class
+ install_win(parent::CARRIER)
+ else
+ fail ArgumentError, "parent must be Resource-Proc class"
+ end
+ carrier = Tk.tk_call_without_enc('frame', @path, '-class', klass)
+
+ body = <<-"EOD"
+ class #{klass} < TkOptionDB.module_eval('@@resource_proc_class')
+ CARRIER = '#{carrier}'.freeze
+ METHOD_TBL = TkCore::INTERP.create_table
+ ADD_METHOD = #{add}
+ SAFE_MODE = #{safe}
+ %w(#{func_str}).each{|f| METHOD_TBL[f.intern] = nil }
+ end
+ EOD
+
+ if parent.kind_of?(Class) && parent <= @@resource_proc_class
+ parent.class_eval(body)
+ eval(parent.name + '::' + klass)
+ else
+ eval(body)
+ eval('TkOptionDB::' + klass)
+ end
+ end
+ module_function :__create_new_class
+ private_class_method :__create_new_class
+
+ def __remove_methods_of_proc_class(klass)
+ # for security, make these methods invalid
+ class << klass
+ attr_reader :class_eval, :name, :superclass,
+ :ancestors, :const_defined?, :const_get, :const_set,
+ :constants, :included_modules, :instance_methods,
+ :method_defined?, :module_eval, :private_instance_methods,
+ :protected_instance_methods, :public_instance_methods,
+ :remove_const, :remove_method, :undef_method,
+ :to_s, :inspect, :display, :method, :methods,
+ :instance_eval, :instance_variables, :kind_of?, :is_a?,
+ :private_methods, :protected_methods, :public_methods
+ end
+ end
+ module_function :__remove_methods_of_proc_class
+ private_class_method :__remove_methods_of_proc_class
+
+ RAND_BASE_CNT = [0]
+ 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],
+ RAND_BASE_CNT[0]]
+ len = RAND_BASE_CHAR.size
+ (6+rand(10)).times{
+ name << RAND_BASE_CHAR[rand(len),1]
+ }
+ RAND_BASE_CNT[0] = RAND_BASE_CNT[0] + 1
+ name
+ end
+ module_function :__get_random_basename
+ 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.
+ 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?
+ __remove_methods_of_proc_class(new_klass)
+ new_klass.freeze
+ new_klass
+ end
+ module_function :new_proc_class
+
+ def eval_under_random_base(parent = nil, &b)
+ 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)
+ new_klass.freeze
+ ret
+ end
+ module_function :eval_under_random_base
+
+ def new_proc_class_random(klass, func, safe = 4, add = false, &b)
+ eval_under_random_base(){
+ TkOption.new_proc_class(klass, func, safe, add, self, &b)
+ }
+ end
+ module_function :new_proc_class_random
+end
+TkOption = TkOptionDB
+TkResourceDB = TkOptionDB
diff --git a/ext/tk/lib/tk/pack.rb b/ext/tk/lib/tk/pack.rb
new file mode 100644
index 0000000000..79f4d19d82
--- /dev/null
+++ b/ext/tk/lib/tk/pack.rb
@@ -0,0 +1,89 @@
+#
+# tk/pack.rb : control pack geometry manager
+#
+require 'tk'
+
+module TkPack
+ include Tk
+ extend Tk
+
+ TkCommandNames = ['pack'.freeze].freeze
+
+ def configure(win, *args)
+ if args[-1].kind_of?(Hash)
+ opts = args.pop
+ else
+ opts = {}
+ end
+ params = []
+ # params.push((win.kind_of?(TkObject))? win.epath: win)
+ params.push(_epath(win))
+ args.each{|win|
+ # params.push((win.kind_of?(TkObject))? win.epath: win)
+ params.push(_epath(win))
+ }
+ opts.each{|k, v|
+ params.push("-#{k}")
+ # params.push((v.kind_of?(TkObject))? v.epath: v)
+ params.push(_epath(v))
+ }
+ tk_call_without_enc("pack", 'configure', *params)
+ end
+
+ def forget(*args)
+ return '' if args.size == 0
+ wins = args.collect{|win|
+ # (win.kind_of?(TkObject))? win.epath: win
+ _epath(win)
+ }
+ tk_call_without_enc('pack', 'forget', *wins)
+ end
+
+ def info(slave)
+ # slave = slave.epath if slave.kind_of?(TkObject)
+ slave = _epath(slave)
+ ilist = list(tk_call_without_enc('pack', 'info', slave))
+ info = {}
+ while key = ilist.shift
+ info[key[1..-1]] = ilist.shift
+ end
+ return info
+ end
+
+ def propagate(master, bool=None)
+ # master = master.epath if master.kind_of?(TkObject)
+ master = _epath(master)
+ if bool == None
+ bool(tk_call_without_enc('pack', 'propagate', master))
+ else
+ tk_call_without_enc('pack', 'propagate', master, bool)
+ end
+ end
+
+ def slaves(master)
+ # master = master.epath if master.kind_of?(TkObject)
+ master = _epath(master)
+ list(tk_call_without_enc('pack', 'slaves', master))
+ end
+
+ module_function :configure, :forget, :info, :propagate, :slaves
+end
+=begin
+def TkPack(win, *args)
+ if args[-1].kind_of?(Hash)
+ opts = args.pop
+ else
+ opts = {}
+ end
+ params = []
+ params.push((win.kind_of?(TkObject))? win.epath: win)
+ args.each{|win|
+ params.push((win.kind_of?(TkObject))? win.epath: win)
+ }
+ opts.each{|k, v|
+ params.push("-#{k}")
+ params.push((v.kind_of?(TkObject))? v.epath: v)
+ }
+ tk_call_without_enc("pack", *params)
+end
+=end
diff --git a/ext/tk/lib/tk/package.rb b/ext/tk/lib/tk/package.rb
new file mode 100644
index 0000000000..8768bf1c79
--- /dev/null
+++ b/ext/tk/lib/tk/package.rb
@@ -0,0 +1,61 @@
+#
+# tk/package.rb : package command
+#
+require 'tk'
+
+module TkPackage
+ include TkCore
+ extend TkPackage
+
+ TkCommandNames = ['package'.freeze].freeze
+
+ def add_path(path)
+ Tk::AUTO_PATH.value = Tk::AUTO_PATH.to_a << path
+ end
+
+ def forget(package)
+ tk_call('package', 'forget', package)
+ nil
+ end
+
+ def names
+ tk_split_simplelist(tk_call('package', 'names'))
+ end
+
+ def provide(package, version=nil)
+ if version
+ tk_call('package', 'provide', package, version)
+ nil
+ else
+ tk_call('package', 'provide', package)
+ end
+ end
+
+ def present(package, version=None)
+ tk_call('package', 'present', package, version)
+ end
+
+ def present_exact(package, version)
+ tk_call('package', 'present', '-exact', package, version)
+ end
+
+ def require(package, version=None)
+ tk_call('package', 'require', package, version)
+ end
+
+ def require_exact(package, version)
+ tk_call('package', 'require', '-exact', package, version)
+ end
+
+ def versions(package)
+ tk_split_simplelist(tk_call('package', 'versions', package))
+ end
+
+ def vcompare(version1, version2)
+ number(tk_call('package', 'vcompare', version1, version2))
+ end
+
+ def vsatisfies(version1, version2)
+ bool(tk_call('package', 'vsatisfies', version1, version2))
+ end
+end
diff --git a/ext/tk/lib/tk/palette.rb b/ext/tk/lib/tk/palette.rb
new file mode 100644
index 0000000000..abcafcfb3a
--- /dev/null
+++ b/ext/tk/lib/tk/palette.rb
@@ -0,0 +1,54 @@
+#
+# tk/palette.rb : methods for Tcl/Tk standard library 'palette.tcl'
+# 1998/06/21 by Hidetoshi Nagai <nagai@ai.kyutech.ac.jp>
+#
+require 'tk'
+
+module TkPalette
+ include Tk
+ extend Tk
+
+ TkCommandNames = [
+ 'tk_setPalette'.freeze,
+ 'tk_bisque'.freeze,
+ 'tkDarken'.freeze
+ ].freeze
+
+ def TkPalette.set(*args)
+ args = args.to_a.flatten if args.kind_of? Hash
+ tk_call('tk_setPalette', *args)
+ end
+ def TkPalette.setPalette(*args)
+ TkPalette.set(*args)
+ end
+
+ def TkPalette.bisque
+ tk_call('tk_bisque')
+ end
+
+ def TkPalette.darken(color, percent)
+ tk_call('tkDarken', color, percent)
+ end
+
+ def TkPalette.recolorTree(window, colors)
+ if not colors.kind_of?(Hash)
+ fail "2nd arg need to be Hash"
+ end
+
+ colors.each{|key, value|
+ begin
+ if window.cget(key) == tk_call('set', "tkPalette(#{key})")
+ window[key] = colors[key]
+ end
+ rescue
+ # ignore
+ end
+ }
+
+ TkWinfo.children(window).each{|w| TkPalette.recolorTree(w, colors)}
+ end
+
+ def recolorTree(colors)
+ TkPalette.recolorTree(self, colors)
+ end
+end
diff --git a/ext/tk/lib/tk/panedwindow.rb b/ext/tk/lib/tk/panedwindow.rb
new file mode 100644
index 0000000000..1cfc7bad7a
--- /dev/null
+++ b/ext/tk/lib/tk/panedwindow.rb
@@ -0,0 +1,204 @@
+#
+# tk/panedwindow.rb : treat panedwindow
+#
+require 'tk'
+
+class TkPanedWindow<TkWindow
+ TkCommandNames = ['panedwindow'.freeze].freeze
+ WidgetClassName = 'Panedwindow'.freeze
+ WidgetClassNames[WidgetClassName] = self
+ def create_self(keys)
+ if keys and keys != None
+ tk_call_without_enc('panedwindow', @path, *hash_kv(keys, true))
+ else
+ tk_call_without_enc('panedwindow', @path)
+ end
+ end
+ private :create_self
+
+ def add(*args)
+ keys = args.pop
+ fail ArgumentError, "no window in arguments" unless keys
+ if keys && keys.kind_of?(Hash)
+ fail ArgumentError, "no window in arguments" if args == []
+ # args = args.collect{|w| (w.kind_of?(TkObject))? w.epath: w }
+ args = args.collect{|w| _epath(w) }
+ #args.push(hash_kv(keys))
+ args.concat(hash_kv(keys))
+ else
+ args.push(keys) if keys
+ # args = args.collect{|w| (w.kind_of?(TkObject))? w.epath: w }
+ args = args.collect{|w| _epath(w) }
+ end
+ tk_send_without_enc('add', *args)
+ self
+ end
+
+ def forget(win, *wins)
+ wins.unshift(win)
+ # tk_send_without_enc('forget', *((w.kind_of?(TkObject))? w.epath: w))
+ tk_send_without_enc('forget', *(wins.collect{|w| _epath(w)}))
+ self
+ end
+ alias del forget
+ alias delete forget
+ alias remove forget
+
+ def identify(x, y)
+ list(tk_send_without_enc('identify', x, y))
+ end
+
+ def proxy_coord
+ list(tk_send_without_enc('proxy', 'coord'))
+ end
+ def proxy_forget
+ tk_send_without_enc('proxy', 'forget')
+ self
+ end
+ def proxy_place(x, y)
+ tk_send_without_enc('proxy', 'place', x, y)
+ self
+ end
+
+ def sash_coord(index)
+ list(tk_send('sash', 'coord', index))
+ end
+ def sash_dragto(index)
+ tk_send('sash', 'dragto', index, x, y)
+ self
+ end
+ def sash_mark(index, x, y)
+ tk_send('sash', 'mark', index, x, y)
+ self
+ end
+ def sash_place(index, x, y)
+ tk_send('sash', 'place', index, x, y)
+ self
+ end
+
+ def panecget(win, key)
+ # win = win.epath if win.kind_of?(TkObject)
+ win = _epath(win)
+ tk_tcl2ruby(tk_send_without_enc('panecget', win, "-#{key}"))
+ end
+
+ def paneconfigure(win, key, value=nil)
+ # win = win.epath if win.kind_of?(TkObject)
+ win = _epath(win)
+ if key.kind_of? Hash
+ params = []
+ key.each{|k, v|
+ params.push("-#{k}")
+ # params.push((v.kind_of?(TkObject))? v.epath: v)
+ params.push(_epath(v))
+ }
+ tk_send_without_enc('paneconfigure', win, *params)
+ else
+ # value = value.epath if value.kind_of?(TkObject)
+ value = _epath(value)
+ tk_send_without_enc('paneconfigure', win, "-#{key}", value)
+ end
+ self
+ end
+ alias pane_config paneconfigure
+
+ def paneconfiginfo(win, key=nil)
+ if TkComm::GET_CONFIGINFO_AS_ARRAY
+ # win = win.epath if win.kind_of?(TkObject)
+ win = _epath(win)
+ if key
+ conf = tk_split_list(tk_send_without_enc('paneconfigure',
+ win, "-#{key}"))
+ conf[0] = conf[0][1..-1]
+ conf
+ else
+ tk_split_simplelist(tk_send_without_enc('paneconfigure',
+ win)).collect{|conflist|
+ conf = tk_split_simplelist(conflist)
+ conf[0] = conf[0][1..-1]
+ if conf[3]
+ if conf[3].index('{')
+ conf[3] = tk_split_list(conf[3])
+ else
+ conf[3] = tk_tcl2ruby(conf[3])
+ end
+ end
+ if conf[4]
+ if conf[4].index('{')
+ conf[4] = tk_split_list(conf[4])
+ else
+ conf[4] = tk_tcl2ruby(conf[4])
+ end
+ end
+ conf[1] = conf[1][1..-1] if conf.size == 2 # alias info
+ conf
+ }
+ end
+ else # ! TkComm::GET_CONFIGINFO_AS_ARRAY
+ # win = win.epath if win.kind_of?(TkObject)
+ win = _epath(win)
+ if key
+ conf = tk_split_list(tk_send_without_enc('paneconfigure',
+ win, "-#{key}"))
+ key = conf.shift[1..-1]
+ { key => conf }
+ else
+ ret = {}
+ tk_split_simplelist(tk_send_without_enc('paneconfigure',
+ win)).each{|conflist|
+ conf = tk_split_simplelist(conflist)
+ key = conf.shift[1..-1]
+ if key
+ if conf[2].index('{')
+ conf[2] = tk_split_list(conf[2])
+ else
+ conf[2] = tk_tcl2ruby(conf[2])
+ end
+ end
+ if conf[3]
+ if conf[3].index('{')
+ conf[3] = tk_split_list(conf[3])
+ else
+ conf[3] = tk_tcl2ruby(conf[3])
+ end
+ end
+ if conf.size == 1
+ ret[key] = conf[0][1..-1] # alias info
+ else
+ ret[key] = conf
+ end
+ }
+ ret
+ end
+ end
+ end
+ alias pane_configinfo paneconfiginfo
+
+ def current_paneconfiginfo(win, key=nil)
+ if TkComm::GET_CONFIGINFO_AS_ARRAY
+ if key
+ conf = paneconfiginfo(win, key)
+ {conf[0] => conf[4]}
+ else
+ ret = {}
+ paneconfiginfo(win).each{|conf|
+ ret[conf[0]] = conf[4] if conf.size > 2
+ }
+ ret
+ end
+ else # ! TkComm::GET_CONFIGINFO_AS_ARRAY
+ ret = {}
+ paneconfiginfo(win, key).each{|k, conf|
+ ret[k] = conf[-1] if conf.kind_of?(Array)
+ }
+ ret
+ end
+ end
+
+ alias current_pane_configinfo current_paneconfiginfo
+
+ def panes
+ list(tk_send_without_enc('panes'))
+ end
+end
+TkPanedwindow = TkPanedWindow
diff --git a/ext/tk/lib/tk/place.rb b/ext/tk/lib/tk/place.rb
new file mode 100644
index 0000000000..5c2f890e07
--- /dev/null
+++ b/ext/tk/lib/tk/place.rb
@@ -0,0 +1,110 @@
+#
+# tk/place.rb : control place geometry manager
+#
+require 'tk'
+
+module TkPlace
+ include Tk
+ extend Tk
+
+ TkCommandNames = ['place'.freeze].freeze
+
+ def configure(win, slot, value=None)
+ # for >= Tk8.4a2 ?
+ # win = win.epath if win.kind_of?(TkObject)
+ win = _epath(win)
+ if slot.kind_of? Hash
+ params = []
+ slot.each{|k, v|
+ params.push("-#{k}")
+ # params.push((v.kind_of?(TkObject))? v.epath: v)
+ params.push(_epath(v))
+ }
+ tk_call_without_enc('place', 'configure', win, *params)
+ else
+ # value = value.epath if value.kind_of?(TkObject)
+ value = _epath(value)
+ tk_call_without_enc('place', 'configure', win, "-#{slot}", value)
+ end
+ end
+
+ def configinfo(win, slot = nil)
+ # for >= Tk8.4a2 ?
+ if TkComm::GET_CONFIGINFOwoRES_AS_ARRAY
+ # win = win.epath if win.kind_of?(TkObject)
+ win = _epath(win)
+ if slot
+ conf = tk_split_list(tk_call_without_enc('place', 'configure',
+ win, "-#{slot}") )
+ conf[0] = conf[0][1..-1]
+ conf
+ else
+ tk_split_simplelist(tk_call_without_enc('place', 'configure',
+ win)).collect{|conflist|
+ conf = list(conflist)
+ conf[0] = conf[0][1..-1]
+ conf
+ }
+ end
+ else # ! TkComm::GET_CONFIGINFOwoRES_AS_ARRAY
+ current_configinfo(win, slot)
+ end
+ end
+
+ def current_configinfo(win, slot = nil)
+ # win = win.epath if win.kind_of?(TkObject)
+ win = _epath(win)
+ if slot
+ conf = tk_split_list(tk_call_without_enc('place', 'configure',
+ win, "-#{slot}") )
+ { conf[0][1..-1] => conf[1] }
+ else
+ ret = {}
+ tk_split_list(tk_call_without_enc('place','configure',win)).each{|conf|
+ ret[conf[0][1..-1]] = conf[1]
+ }
+ ret
+ end
+ end
+
+ def forget(win)
+ # win = win.epath if win.kind_of?(TkObject)
+ win = _epath(win)
+ tk_call_without_enc('place', 'forget', win)
+ end
+
+ def info(win)
+ # win = win.epath if win.kind_of?(TkObject)
+ win = _epath(win)
+ ilist = list(tk_call_without_enc('place', 'info', win))
+ info = {}
+ while key = ilist.shift
+ info[key[1..-1]] = ilist.shift
+ end
+ return info
+ end
+
+ def slaves(master)
+ # master = master.epath if master.kind_of?(TkObject)
+ master = _epath(master)
+ list(tk_call('place', 'slaves', master))
+ end
+
+ module_function :configure, :configinfo, :forget, :info, :slaves
+end
+=begin
+def TkPlace(win, slot, value=None)
+ win = win.epath if win.kind_of?(TkObject)
+ if slot.kind_of? Hash
+ params = []
+ slot.each{|k, v|
+ params.push("-#{k}")
+ params.push((v.kind_of?(TkObject))? v.epath: v)
+ }
+ tk_call_without_enc('place', win, *params)
+ else
+ value = value.epath if value.kind_of?(TkObject)
+ tk_call_without_enc('place', win, "-#{slot}", value)
+ end
+end
+=end
diff --git a/ext/tk/lib/tk/radiobutton.rb b/ext/tk/lib/tk/radiobutton.rb
new file mode 100644
index 0000000000..e00f0a03eb
--- /dev/null
+++ b/ext/tk/lib/tk/radiobutton.rb
@@ -0,0 +1,32 @@
+#
+# tk/radiobutton.rb : treat radiobutton widget
+#
+require 'tk'
+require 'tk/button'
+
+class TkRadioButton<TkButton
+ TkCommandNames = ['radiobutton'.freeze].freeze
+ WidgetClassName = 'Radiobutton'.freeze
+ WidgetClassNames[WidgetClassName] = self
+ def create_self(keys)
+ if keys and keys != None
+ tk_call_without_enc('radiobutton', @path, *hash_kv(keys, true))
+ else
+ tk_call_without_enc('radiobutton', @path)
+ end
+ end
+ private :create_self
+
+ def deselect
+ tk_send_without_enc('deselect')
+ self
+ end
+ def select
+ tk_send_without_enc('select')
+ self
+ end
+ def variable(v)
+ configure 'variable', tk_trace_variable(v)
+ end
+end
+TkRadiobutton = TkRadioButton
diff --git a/ext/tk/lib/tk/root.rb b/ext/tk/lib/tk/root.rb
new file mode 100644
index 0000000000..487eb78fef
--- /dev/null
+++ b/ext/tk/lib/tk/root.rb
@@ -0,0 +1,65 @@
+#
+# tk/root.rb : treat root widget
+#
+require 'tk'
+require 'tk/wm'
+
+class TkRoot<TkWindow
+ include Wm
+
+=begin
+ ROOT = []
+ def TkRoot.new(keys=nil)
+ if ROOT[0]
+ Tk_WINDOWS["."] = ROOT[0]
+ return ROOT[0]
+ end
+ new = super(:without_creating=>true, :widgetname=>'.')
+ if keys # wm commands
+ keys.each{|k,v|
+ if v.kind_of? Array
+ new.send(k,*v)
+ else
+ new.send(k,v)
+ end
+ }
+ end
+ ROOT[0] = new
+ Tk_WINDOWS["."] = new
+ end
+=end
+ def TkRoot.new(keys=nil, &b)
+ unless TkCore::INTERP.tk_windows['.']
+ TkCore::INTERP.tk_windows['.'] =
+ super(:without_creating=>true, :widgetname=>'.'){}
+ end
+ root = TkCore::INTERP.tk_windows['.']
+ if keys # wm commands
+ keys.each{|k,v|
+ if v.kind_of? Array
+ root.send(k,*v)
+ else
+ root.send(k,v)
+ end
+ }
+ end
+ root.instance_eval(&b) if block_given?
+ root
+ end
+
+ WidgetClassName = 'Tk'.freeze
+ WidgetClassNames[WidgetClassName] = self
+
+ def create_self
+ @path = '.'
+ end
+ private :create_self
+
+ def path
+ "."
+ end
+
+ def TkRoot.destroy
+ TkCore::INTERP._invoke('destroy', '.')
+ end
+end
diff --git a/ext/tk/lib/tk/scale.rb b/ext/tk/lib/tk/scale.rb
new file mode 100644
index 0000000000..9398a6cd52
--- /dev/null
+++ b/ext/tk/lib/tk/scale.rb
@@ -0,0 +1,78 @@
+#
+# tk/scale.rb : treat scale widget
+#
+require 'tk'
+
+class TkScale<TkWindow
+ TkCommandNames = ['scale'.freeze].freeze
+ WidgetClassName = 'Scale'.freeze
+ WidgetClassNames[WidgetClassName] = self
+
+ def create_self(keys)
+ if keys and keys != None
+ if keys.key?('command')
+ cmd = keys.delete('command')
+ keys['command'] = proc{|val| cmd.call(val.to_f)}
+ end
+ tk_call_without_enc('scale', @path, *hash_kv(keys, true))
+ else
+ tk_call_without_enc('scale', @path)
+ end
+ end
+ private :create_self
+
+ def _wrap_command_arg(cmd)
+ proc{|val|
+ if val.kind_of?(String)
+ cmd.call(number(val))
+ else
+ cmd.call(val)
+ end
+ }
+ end
+ private :_wrap_command_arg
+
+ def configure_cmd(slot, value)
+ configure(slot=>value)
+ end
+
+ def configure(slot, value=None)
+ if (slot == 'command' || slot == :command)
+ configure('command'=>value)
+ elsif slot.kind_of?(Hash) &&
+ (slot.key?('command') || slot.key?(:command))
+ slot = _symbolkey2str(slot)
+ slot['command'] = _wrap_command_arg(slot.delete('command'))
+ end
+ super(slot, value)
+ end
+
+ def command(cmd=Proc.new)
+ configure('command'=>cmd)
+ end
+
+ def get(x=None, y=None)
+ number(tk_send_without_enc('get', x, y))
+ end
+
+ def coords(val=None)
+ tk_split_list(tk_send_without_enc('coords', val))
+ end
+
+ def identify(x, y)
+ tk_send_without_enc('identify', x, y)
+ end
+
+ def set(val)
+ tk_send_without_enc('set', val)
+ end
+
+ def value
+ get
+ end
+
+ def value= (val)
+ set(val)
+ val
+ end
+end
diff --git a/ext/tk/lib/tk/scrollable.rb b/ext/tk/lib/tk/scrollable.rb
new file mode 100644
index 0000000000..e591a299ab
--- /dev/null
+++ b/ext/tk/lib/tk/scrollable.rb
@@ -0,0 +1,49 @@
+#
+# tk/scrollable.rb : module for scrollable widget
+#
+require 'tk'
+
+module Tk
+ module Scrollable
+ def xscrollcommand(cmd=Proc.new)
+ configure_cmd 'xscrollcommand', cmd
+ end
+ def yscrollcommand(cmd=Proc.new)
+ configure_cmd 'yscrollcommand', cmd
+ end
+ def xview(*index)
+ if index.size == 0
+ list(tk_send_without_enc('xview'))
+ else
+ tk_send_without_enc('xview', *index)
+ self
+ end
+ end
+ def yview(*index)
+ if index.size == 0
+ list(tk_send_without_enc('yview'))
+ else
+ tk_send_without_enc('yview', *index)
+ self
+ end
+ end
+ def xscrollbar(bar=nil)
+ if bar
+ @xscrollbar = bar
+ @xscrollbar.orient 'horizontal'
+ self.xscrollcommand {|*arg| @xscrollbar.set(*arg)}
+ @xscrollbar.command {|*arg| self.xview(*arg)}
+ end
+ @xscrollbar
+ end
+ def yscrollbar(bar=nil)
+ if bar
+ @yscrollbar = bar
+ @yscrollbar.orient 'vertical'
+ self.yscrollcommand {|*arg| @yscrollbar.set(*arg)}
+ @yscrollbar.command {|*arg| self.yview(*arg)}
+ end
+ @yscrollbar
+ end
+ end
+end
diff --git a/ext/tk/lib/tk/scrollbar.rb b/ext/tk/lib/tk/scrollbar.rb
new file mode 100644
index 0000000000..0ee4423c9a
--- /dev/null
+++ b/ext/tk/lib/tk/scrollbar.rb
@@ -0,0 +1,105 @@
+#
+# tk/scrollbar.rb : treat scrollbar widget
+#
+require 'tk'
+
+class TkScrollbar<TkWindow
+ TkCommandNames = ['scrollbar'.freeze].freeze
+ WidgetClassName = 'Scrollbar'.freeze
+ WidgetClassNames[WidgetClassName] = self
+
+ def create_self(keys)
+ @assigned = []
+ @scroll_proc = proc{|*args|
+ if self.orient == 'horizontal'
+ @assigned.each{|w| w.xview(*args)}
+ else # 'vertical'
+ @assigned.each{|w| w.yview(*args)}
+ end
+ }
+
+ if keys and keys != None
+ tk_call_without_enc('scrollbar', @path, *hash_kv(keys, true))
+ else
+ tk_call_without_enc('scrollbar', @path)
+ end
+ end
+ private :create_self
+
+ def assign(*wins)
+ begin
+ self.command(@scroll_proc) if self.cget('command').cmd != @scroll_proc
+ rescue Exception
+ self.command(@scroll_proc)
+ end
+ orient = self.orient
+ wins.each{|w|
+ @assigned << w unless @assigned.index(w)
+ if orient == 'horizontal'
+ w.xscrollcommand proc{|first, last| self.set(first, last)}
+ else # 'vertical'
+ w.yscrollcommand proc{|first, last| self.set(first, last)}
+ end
+ }
+ self
+ end
+
+ def assigned_list
+ begin
+ return @assigned.dup if self.cget('command').cmd == @scroll_proc
+ rescue Exception
+ end
+ fail RuntimeError, "not depend on the assigned_list"
+ end
+
+ #def delta(deltax=None, deltay=None)
+ def delta(deltax, deltay)
+ number(tk_send_without_enc('delta', deltax, deltay))
+ end
+
+ #def fraction(x=None, y=None)
+ def fraction(x, y)
+ number(tk_send_without_enc('fraction', x, y))
+ end
+
+ def identify(x, y)
+ tk_send_without_enc('identify', x, y)
+ end
+
+ def get
+ #ary1 = tk_send('get').split
+ #ary2 = []
+ #for i in ary1
+ # ary2.push number(i)
+ #end
+ #ary2
+ list(tk_send_without_enc('get'))
+ end
+
+ def set(first, last)
+ tk_send_without_enc('set', first, last)
+ self
+ end
+
+ def activate(element=None)
+ tk_send_without_enc('activate', element)
+ end
+end
+
+class TkXScrollbar<TkScrollbar
+ def create_self(keys)
+ keys = {} unless keys
+ keys['orient'] = 'horizontal'
+ super(keys)
+ end
+ private :create_self
+end
+
+class TkYScrollbar<TkScrollbar
+ def create_self(keys)
+ keys = {} unless keys
+ keys['orient'] = 'vertical'
+ super(keys)
+ end
+ private :create_self
+end
diff --git a/ext/tk/lib/tk/scrollbox.rb b/ext/tk/lib/tk/scrollbox.rb
new file mode 100644
index 0000000000..f0fdece260
--- /dev/null
+++ b/ext/tk/lib/tk/scrollbox.rb
@@ -0,0 +1,31 @@
+#
+# tk/scrollbox.rb - Tk Listbox with Scrollbar
+# as an example of Composite Widget
+# $Date$
+# by Yukihiro Matsumoto <matz@netlab.co.jp>
+#
+require 'tk'
+require 'tk/listbox'
+
+class TkScrollbox<TkListbox
+ include TkComposite
+ def initialize_composite(keys=nil)
+ list = TkListbox.new(@frame)
+ scroll = TkScrollbar.new(@frame)
+ @path = list.path
+
+ list.configure 'yscroll', scroll.path+" set"
+ list.pack 'side'=>'left','fill'=>'both','expand'=>'yes'
+ scroll.configure 'command', list.path+" yview"
+ scroll.pack 'side'=>'right','fill'=>'y'
+
+ delegate('DEFAULT', list)
+ delegate('foreground', list)
+ delegate('background', list, scroll)
+ delegate('borderwidth', @frame)
+ delegate('relief', @frame)
+
+ configure keys if keys
+ end
+ private :initialize_composite
+end
diff --git a/ext/tk/lib/tk/selection.rb b/ext/tk/lib/tk/selection.rb
new file mode 100644
index 0000000000..970c3faa80
--- /dev/null
+++ b/ext/tk/lib/tk/selection.rb
@@ -0,0 +1,86 @@
+#
+# tk/selection.rb : control selection
+#
+require 'tk'
+
+module TkSelection
+ include Tk
+ extend Tk
+
+ TkCommandNames = ['selection'.freeze].freeze
+
+ def self.clear(sel=nil)
+ if sel
+ tk_call_without_enc('selection', 'clear', '-selection', sel)
+ else
+ tk_call_without_enc('selection', 'clear')
+ end
+ end
+ def self.clear_on_display(win, sel=nil)
+ if sel
+ tk_call_without_enc('selection', 'clear',
+ '-displayof', win, '-selection', sel)
+ else
+ tk_call_without_enc('selection', 'clear', '-displayof', win)
+ end
+ end
+ def clear(sel=nil)
+ TkSelection.clear_on_display(self, sel)
+ self
+ end
+
+ def self.get(keys=nil)
+ #tk_call('selection', 'get', *hash_kv(keys))
+ _fromUTF8(tk_call_without_enc('selection', 'get', *hash_kv(keys)))
+ 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',
+ win, *hash_kv(keys)))
+ end
+ def get(keys=nil)
+ TkSelection.get_on_display(self, sel)
+ end
+
+ def self.handle(win, func=Proc.new, keys=nil, &b)
+ if func.kind_of?(Hash) && keys == nil
+ keys = func
+ func = Proc.new(&b)
+ end
+ args = ['selection', 'handle']
+ args.concat(hash_kv(keys))
+ args.concat([win, func])
+ tk_call_without_enc(*args)
+ end
+ def handle(func=Proc.new, keys=nil, &b)
+ TkSelection.handle(self, func, keys, &b)
+ end
+
+ def self.get_owner(sel=nil)
+ if sel
+ window(tk_call_without_enc('selection', 'own', '-selection', sel))
+ else
+ window(tk_call_without_enc('selection', 'own'))
+ end
+ end
+ def self.get_owner_on_display(win, sel=nil)
+ if sel
+ window(tk_call_without_enc('selection', 'own',
+ '-displayof', win, '-selection', sel))
+ else
+ window(tk_call_without_enc('selection', 'own', '-displayof', win))
+ end
+ end
+ def get_owner(sel=nil)
+ TkSelection.get_owner_on_display(self, sel)
+ self
+ end
+
+ def self.set_owner(win, keys=nil)
+ tk_call_without_enc('selection', 'own', *(hash_kv(keys) << win))
+ end
+ def set_owner(keys=nil)
+ TkSelection.set_owner(self, keys)
+ self
+ end
+end
diff --git a/ext/tk/lib/tk/spinbox.rb b/ext/tk/lib/tk/spinbox.rb
new file mode 100644
index 0000000000..1c58f9199b
--- /dev/null
+++ b/ext/tk/lib/tk/spinbox.rb
@@ -0,0 +1,39 @@
+#
+# tk/spinbox.rb - Tk spinbox classes
+# $Date$
+# by Yukihiro Matsumoto <matz@caelum.co.jp>
+#
+require 'tk'
+require 'tk/entry'
+
+class TkSpinbox<TkEntry
+ TkCommandNames = ['spinbox'.freeze].freeze
+ WidgetClassName = 'Spinbox'.freeze
+ WidgetClassNames[WidgetClassName] = self
+
+ def create_self(keys)
+ tk_call_without_enc('spinbox', @path)
+ if keys and keys != None
+ configure(keys)
+ end
+ end
+ private :create_self
+
+ def identify(x, y)
+ tk_send_without_enc('identify', x, y)
+ end
+
+ def spinup
+ tk_send_without_enc('invoke', 'spinup')
+ self
+ end
+
+ def spindown
+ tk_send_without_enc('invoke', 'spindown')
+ self
+ end
+
+ def set(str)
+ _freomUTF8(tk_send_without_enc('set', _get_eval_enc_str(str)))
+ end
+end
diff --git a/ext/tk/lib/tk/tagfont.rb b/ext/tk/lib/tk/tagfont.rb
new file mode 100644
index 0000000000..a106f814be
--- /dev/null
+++ b/ext/tk/lib/tk/tagfont.rb
@@ -0,0 +1,43 @@
+#
+# tk/tagfont.rb : control font of tags
+#
+require 'tk'
+
+module TkTreatTagFont
+ def font_configinfo
+ @parent.tagfont_configinfo(@id)
+ end
+# alias font font_configinfo
+
+ def font_configure(slot)
+ @parent.tagfont_configure(@id, slot)
+ self
+ end
+
+ def latinfont_configure(ltn, keys=nil)
+ @parent.latintagfont_configure(@id, ltn, keys)
+ self
+ end
+ alias asciifont_configure latinfont_configure
+
+ def kanjifont_configure(knj, keys=nil)
+ @parent.kanjitagfont_configure(@id, ltn, keys)
+ self
+ end
+
+ def font_copy(window, wintag=nil)
+ @parent.tagfont_copy(@id, window, wintag)
+ self
+ end
+
+ def latinfont_copy(window, wintag=nil)
+ @parent.latintagfont_copy(@id, window, wintag)
+ self
+ end
+ alias asciifont_copy latinfont_copy
+
+ def kanjifont_copy(window, wintag=nil)
+ @parent.kanjitagfont_copy(@id, window, wintag)
+ self
+ end
+end
diff --git a/ext/tk/lib/tk/text.rb b/ext/tk/lib/tk/text.rb
new file mode 100644
index 0000000000..b1e671e1e0
--- /dev/null
+++ b/ext/tk/lib/tk/text.rb
@@ -0,0 +1,1179 @@
+#
+# tk/text.rb - Tk text classes
+# $Date$
+# by Yukihiro Matsumoto <matz@caelum.co.jp>
+require 'tk'
+require 'tk/itemfont'
+require 'tk/scrollable'
+require 'tk/txtwin_abst'
+
+module TkTreatTextTagFont
+ include TkTreatItemFont
+
+ ItemCMD = ['tag'.freeze, 'configure'.freeze].freeze
+ def __conf_cmd(idx)
+ ItemCMD[idx]
+ end
+
+ def __item_pathname(tagOrId)
+ if tagOrId.kind_of?(TkTextTag)
+ self.path + ';' + tagOrId.id
+ else
+ self.path + ';' + tagOrId
+ end
+ end
+
+ private :__conf_cmd, :__item_pathname
+end
+
+
+class TkText<TkTextWin
+ ItemConfCMD = ['tag'.freeze, 'configure'.freeze].freeze
+ include TkTreatTextTagFont
+ include Scrollable
+
+ TkCommandNames = ['text'.freeze].freeze
+ WidgetClassName = 'Text'.freeze
+ WidgetClassNames[WidgetClassName] = self
+
+ def self.new(*args, &block)
+ obj = super(*args){}
+ obj.init_instance_variable
+ obj.instance_eval(&block) if defined? yield
+ obj
+ end
+
+ def init_instance_variable
+ @cmdtbl = []
+ @tags = {}
+ end
+
+ def __destroy_hook__
+ TTagID_TBL.delete(@path)
+ TMarkID_TBL.delete(@path)
+ end
+
+ def create_self(keys)
+ if keys and keys != None
+ tk_call_without_enc('text', @path, *hash_kv(keys, true))
+ else
+ tk_call_without_enc('text', @path)
+ end
+ init_instance_variable
+ end
+ private :create_self
+
+ def index(index)
+ tk_send_without_enc('index', _get_eval_enc_str(index))
+ end
+
+ def value
+ _fromUTF8(tk_send_without_enc('get', "1.0", "end - 1 char"))
+ end
+
+ def value= (val)
+ tk_send_without_enc('delete', "1.0", 'end')
+ tk_send_without_enc('insert', "1.0", _get_eval_enc_str(val))
+ val
+ end
+
+ def _addcmd(cmd)
+ @cmdtbl.push cmd
+ end
+
+ def _addtag(name, obj)
+ @tags[name] = obj
+ end
+
+ def tagid2obj(tagid)
+ if @tags[tagid]
+ @tags[tagid]
+ else
+ tagid
+ end
+ end
+
+ def tag_names(index=None)
+ tk_split_simplelist(_fromUTF8(tk_send_without_enc('tag', 'names', _get_eval_enc_str(index)))).collect{|elt|
+ tagid2obj(elt)
+ }
+ end
+
+ def mark_names
+ tk_split_simplelist(_fromUTF8(tk_send_without_enc('mark', 'names'))).collect{|elt|
+ tagid2obj(elt)
+ }
+ end
+
+ def mark_gravity(mark, direction=nil)
+ if direction
+ tk_send_without_enc('mark', 'gravity',
+ _get_eval_enc_str(mark), direction)
+ self
+ else
+ tk_send_without_enc('mark', 'gravity', _get_eval_enc_str(mark))
+ end
+ end
+
+ def mark_set(mark, index)
+ 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',
+ *(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',
+ _get_eval_enc_str(index))))
+ end
+ alias next_mark mark_next
+
+ def mark_previous(index)
+ tagid2obj(_fromUTF8(tk_send_without_enc('mark', 'previous',
+ _get_eval_enc_str(index))))
+ end
+ alias previous_mark mark_previous
+
+ def image_cget(index, slot)
+ case slot.to_s
+ when 'text', 'label', 'show', 'data', 'file'
+ _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),
+ "-#{slot}")))
+ end
+ end
+
+ def image_configure(index, slot, value=None)
+ if slot.kind_of? Hash
+ _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}",
+ _get_eval_enc_str(value)))
+ end
+ self
+ end
+
+ def image_configinfo(index, slot = nil)
+ if TkComm::GET_CONFIGINFO_AS_ARRAY
+ if slot
+ case slot.to_s
+ when 'text', 'label', 'show', 'data', 'file'
+ conf = tk_split_simplelist(_fromUTF8(tk_send_without_enc('image', 'configure', _get_eval_enc_str(index), "-#{slot}")))
+ else
+ conf = tk_split_list(_fromUTF8(tk_send_without_enc('image', 'configure', _get_eval_enc_str(index), "-#{slot}")))
+ end
+ conf[0] = conf[0][1..-1]
+ conf
+ else
+ tk_split_simplelist(_fromUTF8(tk_send_without_enc('image', 'configure', _get_eval_enc_str(index)))).collect{|conflist|
+ conf = tk_split_simplelist(conflist)
+ conf[0] = conf[0][1..-1]
+ case conf[0]
+ when 'text', 'label', 'show', 'data', 'file'
+ else
+ if conf[3]
+ if conf[3].index('{')
+ conf[3] = tk_split_list(conf[3])
+ else
+ conf[3] = tk_tcl2ruby(conf[3])
+ end
+ end
+ if conf[4]
+ if conf[4].index('{')
+ conf[4] = tk_split_list(conf[4])
+ else
+ conf[4] = tk_tcl2ruby(conf[4])
+ end
+ end
+ end
+ conf[1] = conf[1][1..-1] if conf.size == 2 # alias info
+ conf
+ }
+ end
+ else # ! TkComm::GET_CONFIGINFO_AS_ARRAY
+ if slot
+ case slot.to_s
+ when 'text', 'label', 'show', 'data', 'file'
+ conf = tk_split_simplelist(_fromUTF8(tk_send_without_enc('image', 'configure', _get_eval_enc_str(index), "-#{slot}")))
+ else
+ conf = tk_split_list(_fromUTF8(tk_send_without_enc('image', 'configure', _get_eval_enc_str(index), "-#{slot}")))
+ end
+ key = conf.shift[1..-1]
+ { key => conf }
+ else
+ ret = {}
+ tk_split_simplelist(_fromUTF8(tk_send_without_enc('image', 'configure', _get_eval_enc_str(index)))).each{|conflist|
+ conf = tk_split_simplelist(conflist)
+ key = conf.shift[1..-1]
+ case key
+ when 'text', 'label', 'show', 'data', 'file'
+ else
+ if conf[2]
+ if conf[2].index('{')
+ conf[2] = tk_split_list(conf[2])
+ else
+ conf[2] = tk_tcl2ruby(conf[2])
+ end
+ end
+ if conf[3]
+ if conf[3].index('{')
+ conf[3] = tk_split_list(conf[3])
+ else
+ conf[3] = tk_tcl2ruby(conf[3])
+ end
+ end
+ end
+ if conf.size == 1
+ ret[key] = conf[0][1..-1] # alias info
+ else
+ ret[key] = conf
+ end
+ }
+ ret
+ end
+ end
+ end
+
+ def current_image_configinfo(index, slot = nil)
+ if TkComm::GET_CONFIGINFO_AS_ARRAY
+ if slot
+ conf = image_configinfo(index, slot)
+ {conf[0] => conf[4]}
+ else
+ ret = {}
+ image_configinfo(index).each{|conf|
+ ret[conf[0]] = conf[4] if conf.size > 2
+ }
+ ret
+ end
+ else # ! TkComm::GET_CONFIGINFO_AS_ARRAY
+ ret = {}
+ image_configinfo(index, slot).each{|k, conf|
+ ret[k] = conf[-1] if conf.kind_of?(Array)
+ }
+ ret
+ end
+ end
+
+ def image_names
+ tk_split_simplelist(_fromUTF8(tk_send_without_enc('image', 'names'))).collect{|elt|
+ tagid2obj(elt)
+ }
+ end
+
+ def set_insert(index)
+ tk_send_without_enc('mark','set','insert', _get_eval_enc_str(index))
+ self
+ end
+
+ def set_current(index)
+ tk_send_without_enc('mark','set','current', _get_eval_enc_str(index))
+ self
+ end
+
+ def insert(index, chars, *tags)
+ if tags[0].kind_of? Array
+ # multiple chars-taglist argument :: str, [tag,...], str, [tag,...], ...
+ args = [chars]
+ while tags.size > 0
+ args << tags.shift.collect{|x|_get_eval_string(x)}.join(' ') # taglist
+ args << tags.shift if tags.size > 0 # chars
+ end
+ super index, *args
+ else
+ # single chars-taglist argument :: str, tag, tag, ...
+ if tags.size == 0
+ super index, chars
+ else
+ super index, chars, tags.collect{|x|_get_eval_string(x)}.join(' ')
+ end
+ end
+ end
+
+ def destroy
+ @tags = {} unless @tags
+ @tags.each_value do |t|
+ t.destroy
+ end
+ super
+ end
+
+ def backspace
+ self.delete 'insert'
+ end
+
+ def bbox(index)
+ list(tk_send_without_enc('bbox', _get_eval_enc_str(index)))
+ end
+
+ def compare(idx1, op, idx2)
+ bool(tk_send_without_enc('compare', _get_eval_enc_str(idx1),
+ op, _get_eval_enc_str(idx2)))
+ end
+
+ def count(idx1, idx2, *opts)
+ opts = opts.collect{|opt| '-' + opt.to_s}
+ number(tk_send_without_enc('count', _get_eval_enc_str(idx1),
+ _get_eval_enc_str(idx2), *opts))
+ end
+
+ def replace(idx1, idx2, *opts)
+ tk_send('replace', idx1, idx2, *opts)
+ self
+ end
+
+ def debug
+ bool(tk_send_without_enc('debug'))
+ end
+ def debug=(boolean)
+ tk_send_without_enc('debug', boolean)
+ #self
+ boolean
+ end
+
+ def dlineinfo(index)
+ list(tk_send_without_enc('dlineinfo', _get_eval_enc_str(index)))
+ end
+
+ def modified?
+ bool(tk_send_without_enc('edit', 'modified'))
+ end
+ def modified(mode)
+ tk_send_without_enc('edit', 'modified', mode)
+ self
+ end
+ def modified=(mode)
+ modified(mode)
+ mode
+ end
+
+ def edit_redo
+ tk_send_without_enc('edit', 'redo')
+ self
+ end
+ def edit_reset
+ tk_send_without_enc('edit', 'reset')
+ self
+ end
+ def edit_separator
+ tk_send_without_enc('edit', 'separator')
+ self
+ end
+ def edit_undo
+ tk_send_without_enc('edit', 'undo')
+ self
+ end
+
+ def xview_pickplace(index)
+ tk_send_without_enc('xview', '-pickplace', _get_eval_enc_str(index))
+ self
+ end
+
+ def yview_pickplace(index)
+ tk_send_without_enc('yview', '-pickplace', _get_eval_enc_str(index))
+ self
+ end
+
+ def text_copy
+ # Tk8.4 feature
+ tk_call_without_enc('tk_textCopy', @path)
+ self
+ end
+
+ def text_cut
+ # Tk8.4 feature
+ tk_call_without_enc('tk_textCut', @path)
+ self
+ end
+
+ def text_paste
+ # Tk8.4 feature
+ tk_call_without_enc('tk_textPaste', @path)
+ self
+ end
+
+ def tag_add(tag, index1, index2=None)
+ tk_send_without_enc('tag', 'add', _get_eval_enc_str(tag),
+ _get_eval_enc_str(index1),
+ _get_eval_enc_str(index2))
+ self
+ end
+ alias addtag tag_add
+ alias add_tag tag_add
+
+ def tag_delete(*tags)
+ tk_send_without_enc('tag', 'delete',
+ *(tags.collect{|tag| _get_eval_enc_str(tag)}))
+ if TkTextTag::TTagID_TBL[@path]
+ tags.each{|tag|
+ if tag.kind_of? TkTextTag
+ TTagID_TBL[@path].delete(tag.id)
+ else
+ TTagID_TBL[@path].delete(tag)
+ end
+ }
+ end
+ self
+ end
+ alias deltag tag_delete
+ alias delete_tag tag_delete
+
+ def tag_bind(tag, seq, cmd=Proc.new, args=nil)
+ _bind([@path, 'tag', 'bind', tag], seq, cmd, args)
+ self
+ end
+
+ def tag_bind_append(tag, seq, cmd=Proc.new, args=nil)
+ _bind_append([@path, 'tag', 'bind', tag], seq, cmd, args)
+ self
+ end
+
+ def tag_bind_remove(tag, seq)
+ _bind_remove([@path, 'tag', 'bind', tag], seq)
+ self
+ end
+
+ def tag_bindinfo(tag, context=nil)
+ _bindinfo([@path, 'tag', 'bind', tag], context)
+ end
+
+ def tag_cget(tag, key)
+ case key.to_s
+ when 'text', 'label', 'show', 'data', 'file'
+ 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}"))
+ fnt = tk_tcl2ruby(_fromUTF8(tk_send_without_enc('tag','cget',_get_eval_enc_str(tag),'-font')))
+ unless fnt.kind_of?(TkFont)
+ fnt = tagfontobj(tag, fnt)
+ end
+ if key.to_s == 'kanjifont' && JAPANIZED_TK && TK_VERSION =~ /^4\.*/
+ # obsolete; just for compatibility
+ fnt.kanji_font
+ else
+ fnt
+ end
+ else
+ tk_tcl2ruby(_fromUTF8(tk_call_without_enc(@path,'tag','cget',_get_eval_enc_str(tag),"-#{key}")))
+ end
+ end
+
+ def tag_configure(tag, key, val=None)
+ if key.kind_of? Hash
+ key = _symbolkey2str(key)
+ if ( key['font'] || key['kanjifont'] \
+ || key['latinfont'] || key['asciifont'] )
+ tagfont_configure(tag, key)
+ else
+ tk_send_without_enc('tag', 'configure', _get_eval_enc_str(tag),
+ *hash_kv(key, true))
+ end
+
+ else
+ if key == 'font' || key == :font ||
+ key == 'kanjifont' || key == :kanjifont ||
+ key == 'latinfont' || key == :latinfont ||
+ key == 'asciifont' || key == :asciifont
+ if val == None
+ tagfontobj(tag)
+ else
+ tagfont_configure(tag, {key=>val})
+ end
+ else
+ tk_send_without_enc('tag', 'configure', _get_eval_enc_str(tag),
+ "-#{key}", _get_eval_enc_str(val))
+ end
+ end
+ self
+ end
+
+ def tag_configinfo(tag, key=nil)
+ if TkComm::GET_CONFIGINFO_AS_ARRAY
+ if key
+ case key.to_s
+ when 'text', 'label', 'show', 'data', 'file'
+ conf = tk_split_simplelist(_fromUTF8(tk_send_without_enc('tag','configure',_get_eval_enc_str(tag),"-#{key}")))
+ when 'font', 'kanjifont'
+ conf = tk_split_simplelist(_fromUTF8(tk_send_without_enc('tag','configure',_get_eval_enc_str(tag),"-#{key}")))
+ conf[4] = tagfont_configinfo(tag, conf[4])
+ else
+ conf = tk_split_list(_fromUTF8(tk_send_without_enc('tag','configure',_get_eval_enc_str(tag),"-#{key}")))
+ end
+ conf[0] = conf[0][1..-1]
+ conf
+ else
+ ret = tk_split_simplelist(_fromUTF8(tk_send('tag','configure',_get_eval_enc_str(tag)))).collect{|conflist|
+ conf = tk_split_simplelist(conflist)
+ conf[0] = conf[0][1..-1]
+ case conf[0]
+ when 'text', 'label', 'show', 'data', 'file'
+ else
+ if conf[3]
+ if conf[3].index('{')
+ conf[3] = tk_split_list(conf[3])
+ else
+ conf[3] = tk_tcl2ruby(conf[3])
+ end
+ end
+ if conf[4]
+ if conf[4].index('{')
+ conf[4] = tk_split_list(conf[4])
+ else
+ conf[4] = tk_tcl2ruby(conf[4])
+ end
+ end
+ end
+ conf[1] = conf[1][1..-1] if conf.size == 2 # alias info
+ conf
+ }
+ fontconf = ret.assoc('font')
+ if fontconf
+ ret.delete_if{|item| item[0] == 'font' || item[0] == 'kanjifont'}
+ fontconf[4] = tagfont_configinfo(tag, fontconf[4])
+ ret.push(fontconf)
+ else
+ ret
+ end
+ end
+ else # ! TkComm::GET_CONFIGINFO_AS_ARRAY
+ if key
+ case key.to_s
+ when 'text', 'label', 'show', 'data', 'file'
+ conf = tk_split_simplelist(_fromUTF8(tk_send_without_enc('tag','configure',_get_eval_enc_str(tag),"-#{key}")))
+ when 'font', 'kanjifont'
+ conf = tk_split_simplelist(_fromUTF8(tk_send_without_enc('tag','configure',_get_eval_enc_str(tag),"-#{key}")))
+ conf[4] = tagfont_configinfo(tag, conf[4])
+ else
+ conf = tk_split_list(_fromUTF8(tk_send_without_enc('tag','configure',_get_eval_enc_str(tag),"-#{key}")))
+ end
+ key = conf.shift[1..-1]
+ { key => conf }
+ else
+ ret = {}
+ tk_split_simplelist(_fromUTF8(tk_send('tag','configure',_get_eval_enc_str(tag)))).each{|conflist|
+ conf = tk_split_simplelist(conflist)
+ key = conf.shift[1..-1]
+ case key
+ when 'text', 'label', 'show', 'data', 'file'
+ else
+ if conf[2]
+ if conf[2].index('{')
+ conf[2] = tk_split_list(conf[2])
+ else
+ conf[2] = tk_tcl2ruby(conf[2])
+ end
+ end
+ if conf[3]
+ if conf[3].index('{')
+ conf[3] = tk_split_list(conf[3])
+ else
+ conf[3] = tk_tcl2ruby(conf[3])
+ end
+ end
+ end
+ if conf.size == 1
+ ret[key] = conf[0][1..-1] # alias info
+ else
+ ret[key] = conf
+ end
+ }
+ fontconf = ret['font']
+ if fontconf
+ ret.delete('font')
+ ret.delete('kanjifont')
+ fontconf[3] = tagfont_configinfo(tag, fontconf[3])
+ ret['font'] = fontconf
+ end
+ ret
+ end
+ end
+ end
+
+ def current_tag_configinfo(tag, key=nil)
+ if TkComm::GET_CONFIGINFO_AS_ARRAY
+ if key
+ conf = tag_configinfo(tag, key)
+ {conf[0] => conf[4]}
+ else
+ ret = {}
+ tag_configinfo(tag).each{|conf|
+ ret[conf[0]] = conf[4] if conf.size > 2
+ }
+ ret
+ end
+ else # ! TkComm::GET_CONFIGINFO_AS_ARRAY
+ ret = {}
+ tag_configinfo(tag, key).each{|k, conf|
+ ret[k] = conf[-1] if conf.kind_of?(Array)
+ }
+ ret
+ end
+ end
+
+ def tag_raise(tag, above=None)
+ 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),
+ _get_eval_enc_str(below))
+ self
+ end
+
+ def tag_remove(tag, *indices)
+ tk_send_without_enc('tag', 'remove', _get_eval_enc_str(tag),
+ *(indces.collect{|idx| _get_eval_enc_str(idx)}))
+ self
+ end
+
+ def tag_ranges(tag)
+ l = tk_split_simplelist(tk_send_without_enc('tag', 'ranges',
+ _get_eval_enc_str(tag)))
+ r = []
+ while key=l.shift
+ r.push [key, l.shift]
+ end
+ r
+ end
+
+ def tag_nextrange(tag, first, last=None)
+ tk_split_list(tk_send_without_enc('tag', 'nextrange',
+ _get_eval_enc_str(tag),
+ _get_eval_enc_str(first),
+ _get_eval_enc_str(last)))
+ end
+
+ def tag_prevrange(tag, first, last=None)
+ tk_split_list(tk_send_without_enc('tag', 'prevrange',
+ _get_eval_enc_str(tag),
+ _get_eval_enc_str(first),
+ _get_eval_enc_str(last)))
+ end
+
+ def window_cget(index, slot)
+ case slot.to_s
+ when 'text', 'label', 'show', 'data', 'file'
+ _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}"))
+ fnt = tk_tcl2ruby(_fromUTF8(tk_send_without_enc('window', 'cget', _get_eval_enc_str(index), '-font')))
+ unless fnt.kind_of?(TkFont)
+ fnt = tagfontobj(index, fnt)
+ end
+ if slot.to_s == 'kanjifont' && JAPANIZED_TK && TK_VERSION =~ /^4\.*/
+ # obsolete; just for compatibility
+ fnt.kanji_font
+ else
+ fnt
+ end
+ else
+ tk_tcl2ruby(_fromUTF8(tk_send_without_enc('window', 'cget', _get_eval_enc_str(index), "-#{slot}")))
+ end
+ end
+
+ def window_configure(index, slot, value=None)
+ if index.kind_of? TkTextWindow
+ index.configure(slot, value)
+ else
+ if slot.kind_of? Hash
+ slot = _symbolkey2str(slot)
+ win = slot['window']
+ # slot['window'] = win.epath if win.kind_of?(TkWindow)
+ slot['window'] = _epath(win) if win
+ if slot['create']
+ p_create = slot['create']
+ if p_create.kind_of? Proc
+=begin
+ slot['create'] = install_cmd(proc{
+ id = p_create.call
+ if id.kind_of?(TkWindow)
+ id.epath
+ else
+ id
+ end
+ })
+=end
+ slot['create'] = install_cmd(proc{_epath(p_create.call)})
+ end
+ end
+ tk_send_without_enc('window', 'configure',
+ _get_eval_enc_str(index),
+ *hash_kv(slot, true))
+ else
+ if slot == 'window' || slot == :window
+ # id = value
+ # value = id.epath if id.kind_of?(TkWindow)
+ value = _epath(value)
+ end
+ if slot == 'create' || slot == :create
+ p_create = value
+ if p_create.kind_of? Proc
+=begin
+ value = install_cmd(proc{
+ id = p_create.call
+ if id.kind_of?(TkWindow)
+ id.epath
+ else
+ id
+ end
+ })
+=end
+ value = install_cmd(proc{_epath(p_create.call)})
+ end
+ end
+ tk_send_without_enc('window', 'configure',
+ _get_eval_enc_str(index),
+ "-#{slot}", _get_eval_enc_str(value))
+ end
+ end
+ self
+ end
+
+ def window_configinfo(win, slot = nil)
+ if TkComm::GET_CONFIGINFO_AS_ARRAY
+ if slot
+ case slot.to_s
+ when 'text', 'label', 'show', 'data', 'file'
+ conf = tk_split_simplelist(_fromUTF8(tk_send('window', 'configure', _get_eval_enc_str(win), "-#{slot}")))
+ else
+ conf = tk_split_list(_fromUTF8(tk_send('window', 'configure', _get_eval_enc_str(win), "-#{slot}")))
+ end
+ conf[0] = conf[0][1..-1]
+ conf
+ else
+ tk_split_simplelist(_fromUTF8(tk_send('window', 'configure', _get_eval_enc_str(win)))).collect{|conflist|
+ conf = tk_split_simplelist(conflist)
+ conf[0] = conf[0][1..-1]
+ case conf[0]
+ when 'text', 'label', 'show', 'data', 'file'
+ else
+ if conf[3]
+ if conf[3].index('{')
+ conf[3] = tk_split_list(conf[3])
+ else
+ conf[3] = tk_tcl2ruby(conf[3])
+ end
+ end
+ if conf[4]
+ if conf[4].index('{')
+ conf[4] = tk_split_list(conf[4])
+ else
+ conf[4] = tk_tcl2ruby(conf[4])
+ end
+ end
+ end
+ conf[1] = conf[1][1..-1] if conf.size == 2 # alias info
+ conf
+ }
+ end
+ else # ! TkComm::GET_CONFIGINFO_AS_ARRAY
+ if slot
+ case slot.to_s
+ when 'text', 'label', 'show', 'data', 'file'
+ conf = tk_split_simplelist(_fromUTF8(tk_send('window', 'configure', _get_eval_enc_str(win), "-#{slot}")))
+ else
+ conf = tk_split_list(_fromUTF8(tk_send('window', 'configure', _get_eval_enc_str(win), "-#{slot}")))
+ end
+ key = conf.shift[1..-1]
+ { key => conf }
+ else
+ ret = {}
+ tk_split_simplelist(_fromUTF8(tk_send('window', 'configure', _get_eval_enc_str(win)))).each{|conflist|
+ conf = tk_split_simplelist(conflist)
+ key = conf.shift[1..-1]
+ case key
+ when 'text', 'label', 'show', 'data', 'file'
+ else
+ if conf[2]
+ if conf[2].index('{')
+ conf[2] = tk_split_list(conf[2])
+ else
+ conf[2] = tk_tcl2ruby(conf[2])
+ end
+ end
+ if conf[3]
+ if conf[3].index('{')
+ conf[3] = tk_split_list(conf[3])
+ else
+ conf[3] = tk_tcl2ruby(conf[3])
+ end
+ end
+ end
+ if conf.size == 1
+ ret[key] = conf[0][1..-1] # alias info
+ else
+ ret[key] = conf
+ end
+ }
+ ret
+ end
+ end
+ end
+
+ def current_window_configinfo(win, slot = nil)
+ if TkComm::GET_CONFIGINFO_AS_ARRAY
+ if slot
+ conf = window_configinfo(win, slot)
+ {conf[0] => conf[4]}
+ else
+ ret = {}
+ window_configinfo(win).each{|conf|
+ ret[conf[0]] = conf[4] if conf.size > 2
+ }
+ ret
+ end
+ else # ! TkComm::GET_CONFIGINFO_AS_ARRAY
+ ret = {}
+ window_configinfo(win, slot).each{|k, conf|
+ ret[k] = conf[-1] if conf.kind_of?(Array)
+ }
+ ret
+ end
+ end
+
+ def window_names
+ tk_split_simplelist(_fromUTF8(tk_send_without_enc('window', 'names'))).collect{|elt|
+ tagid2obj(elt)
+ }
+ end
+
+ def _ktext_length(txt)
+ if $KCODE !~ /n/i
+ return txt.gsub(/[^\Wa-zA-Z_\d]/, ' ').length
+ end
+
+ # $KCODE == 'NONE'
+ if JAPANIZED_TK
+ tk_call_without_enc('kstring', 'length',
+ _get_eval_enc_str(txt)).to_i
+ else
+ begin
+ tk_call_without_enc('encoding', 'convertto', 'ascii',
+ _get_eval_enc_str(txt)).length
+ rescue StandardError, NameError
+ # sorry, I have no plan
+ txt.length
+ end
+ end
+ end
+ private :_ktext_length
+
+ def tksearch(*args)
+ # call 'search' subcommand of text widget
+ # args ::= [<array_of_opts>] <pattern> <start_index> [<stop_index>]
+ # <pattern> must be a regular expression of Tcl
+ all_mode = false
+ opts = args.shift
+ if opts.kind_of?(Array)
+ opts = opts.collect{|opt|
+ opt = opt.to_s
+ all_mode = true if opt == 'all'
+ opt
+ }
+ else
+ args.unshift(opts)
+ opts = []
+ end
+
+ opts << '--'
+
+ if all_mode
+ tk_split_simplelist(tk_send(*(opts + args)))
+ else
+ tk_send(*(opts + args))
+ end
+ end
+
+ def tksearch_with_count(*args)
+ # call 'search' subcommand of text widget
+ # args ::= [<array_of_opts>] <var> <pattern> <start_index> [<stop_index>]
+ # <pattern> must be a regular expression of Tcl
+ all_mode = false
+ opts = args.shift
+ if opts.kind_of?(Array)
+ opts = opts.collect{|opt|
+ opt = opt.to_s
+ all_mode = true if opt == 'all'
+ opt
+ }
+ var = args.shift
+ else
+ var = opts
+ opts = []
+ end
+
+ opts << '-count' << var << '--'
+
+ if all_mode
+ tk_split_simplelist(tk_send(*(opts + args)))
+ else
+ tk_send(*(opts + args))
+ end
+ end
+
+ def search_with_length(pat,start,stop=None)
+ pat = pat.chr if pat.kind_of? Integer
+ if stop != None
+ return ["", 0] if compare(start,'>=',stop)
+ txt = get(start,stop)
+ if (pos = txt.index(pat))
+ match = $&
+ #pos = txt[0..(pos-1)].split('').length if pos > 0
+ 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"),
+ _ktext_length(pat), pat.dup]
+ else
+ #return [index(start + " + #{pos} chars"), $&.split('').length]
+ return [index(start + " + #{pos} chars"),
+ _ktext_length(match), match]
+ end
+ else
+ return ["", 0]
+ end
+ else
+ txt = get(start,'end - 1 char')
+ if (pos = txt.index(pat))
+ match = $&
+ #pos = txt[0..(pos-1)].split('').length if pos > 0
+ 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"),
+ _ktext_length(pat), pat.dup]
+ else
+ #return [index(start + " + #{pos} chars"), $&.split('').length]
+ return [index(start + " + #{pos} chars"),
+ _ktext_length(match), match]
+ end
+ else
+ txt = get('1.0','end - 1 char')
+ if (pos = txt.index(pat))
+ match = $&
+ #pos = txt[0..(pos-1)].split('').length if pos > 0
+ 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"),
+ _ktext_length(pat), pat.dup]
+ else
+ #return [index("1.0 + #{pos} chars"), $&.split('').length]
+ return [index("1.0 + #{pos} chars"), _ktext_length(match), match]
+ end
+ else
+ return ["", 0]
+ end
+ end
+ end
+ end
+
+ def search(pat,start,stop=None)
+ search_with_length(pat,start,stop)[0]
+ end
+
+ def rsearch_with_length(pat,start,stop=None)
+ pat = pat.chr if pat.kind_of? Integer
+ if stop != None
+ return ["", 0] if compare(start,'<=',stop)
+ txt = get(stop,start)
+ if (pos = txt.rindex(pat))
+ match = $&
+ #pos = txt[0..(pos-1)].split('').length if pos > 0
+ pos = _ktext_length(txt[0..(pos-1)]) if pos > 0
+ if pat.kind_of? String
+ #return [index(stop + " + #{pos} chars"), pat.split('').length]
+ return [index(stop + " + #{pos} chars"), _ktext_length(pat), pat.dup]
+ else
+ #return [index(stop + " + #{pos} chars"), $&.split('').length]
+ return [index(stop + " + #{pos} chars"), _ktext_length(match), match]
+ end
+ else
+ return ["", 0]
+ end
+ else
+ txt = get('1.0',start)
+ if (pos = txt.rindex(pat))
+ match = $&
+ #pos = txt[0..(pos-1)].split('').length if pos > 0
+ 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"), _ktext_length(pat), pat.dup]
+ else
+ #return [index("1.0 + #{pos} chars"), $&.split('').length]
+ return [index("1.0 + #{pos} chars"), _ktext_length(match), match]
+ end
+ else
+ txt = get('1.0','end - 1 char')
+ if (pos = txt.rindex(pat))
+ match = $&
+ #pos = txt[0..(pos-1)].split('').length if pos > 0
+ 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"), _ktext_length(pat), pat.dup]
+ else
+ #return [index("1.0 + #{pos} chars"), $&.split('').length]
+ return [index("1.0 + #{pos} chars"), _ktext_length(match), match]
+ end
+ else
+ return ["", 0]
+ end
+ end
+ end
+ end
+
+ def rsearch(pat,start,stop=None)
+ rsearch_with_length(pat,start,stop)[0]
+ end
+
+ def dump(type_info, *index, &block)
+ args = type_info.collect{|inf| '-' + inf}
+ args << '-command' << block if block
+ str = tk_send('dump', *(args + index))
+ result = []
+ sel = nil
+ i = 0
+ while i < str.size
+ # retrieve key
+ idx = str.index(/ /, i)
+ result.push str[i..(idx-1)]
+ i = idx + 1
+
+ # retrieve value
+ case result[-1]
+ when 'text'
+ if str[i] == ?{
+ # text formed as {...}
+ val, i = _retrieve_braced_text(str, i)
+ result.push val
+ else
+ # text which may contain backslahes
+ val, i = _retrieve_backslashed_text(str, i)
+ result.push val
+ end
+ else
+ idx = str.index(/ /, i)
+ val = str[i..(idx-1)]
+ case result[-1]
+ when 'mark'
+ case val
+ when 'insert'
+ result.push TkTextMarkInsert.new(self)
+ when 'current'
+ result.push TkTextMarkCurrent.new(self)
+ when 'anchor'
+ result.push TkTextMarkAnchor.new(self)
+ else
+ result.push tk_tcl2ruby(val)
+ end
+ when 'tagon'
+ if val == 'sel'
+ if sel
+ result.push sel
+ else
+ result.push TkTextTagSel.new(self)
+ end
+ else
+ result.push tk_tcl2ruby(val)
+ end
+ when 'tagoff'
+ result.push tk_tcl2ruby(val)
+ when 'window'
+ result.push tk_tcl2ruby(val)
+ end
+ i = idx + 1
+ end
+
+ # retrieve index
+ idx = str.index(/ /, i)
+ if idx
+ result.push str[i..(idx-1)]
+ i = idx + 1
+ else
+ result.push str[i..-1]
+ break
+ end
+ end
+
+ kvis = []
+ until result.empty?
+ kvis.push [result.shift, result.shift, result.shift]
+ end
+ kvis # result is [[key1, value1, index1], [key2, value2, index2], ...]
+ end
+
+ def _retrieve_braced_text(str, i)
+ cnt = 0
+ idx = i
+ while idx < str.size
+ case str[idx]
+ when ?{
+ cnt += 1
+ when ?}
+ cnt -= 1
+ if cnt == 0
+ break
+ end
+ end
+ idx += 1
+ end
+ return str[i+1..idx-1], idx + 2
+ end
+ private :_retrieve_braced_text
+
+ def _retrieve_backslashed_text(str, i)
+ j = i
+ idx = nil
+ loop {
+ idx = str.index(/ /, j)
+ if str[idx-1] == ?\\
+ j += 1
+ else
+ break
+ end
+ }
+ val = str[i..(idx-1)]
+ val.gsub!(/\\( |\{|\})/, '\1')
+ return val, idx + 1
+ end
+ private :_retrieve_backslashed_text
+
+ def dump_all(*index, &block)
+ dump(['all'], *index, &block)
+ end
+ def dump_mark(*index, &block)
+ dump(['mark'], *index, &block)
+ end
+ def dump_tag(*index, &block)
+ dump(['tag'], *index, &block)
+ end
+ def dump_text(*index, &block)
+ dump(['text'], *index, &block)
+ end
+ def dump_window(*index, &block)
+ dump(['window'], *index, &block)
+ end
+ def dump_image(*index, &block)
+ dump(['image'], *index, &block)
+ end
+end
diff --git a/ext/tk/lib/tk/textimage.rb b/ext/tk/lib/tk/textimage.rb
new file mode 100644
index 0000000000..444d91b0a5
--- /dev/null
+++ b/ext/tk/lib/tk/textimage.rb
@@ -0,0 +1,72 @@
+#
+# tk/textimage.rb - treat Tk text image object
+#
+require 'tk'
+require 'tk/text'
+
+class TkTextImage<TkObject
+ def initialize(parent, index, keys)
+ unless parent.kind_of?(TkText)
+ fail ArguemntError, "expect TkText for 1st argument"
+ end
+ @t = parent
+ if index == 'end'
+ @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',
+ 'end - 1 chars'))
+ else
+ @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',
+ _get_eval_enc_str(index)))
+ end
+ @path.gravity = 'left'
+ @index = @path.path
+ @id = tk_call_without_enc(@t.path, 'image', 'create', @index,
+ *hash_kv(keys, true))
+ end
+
+ def [](slot)
+ cget(slot)
+ end
+ def []=(slot, value)
+ configure(slot, value)
+ value
+ end
+
+ def cget(slot)
+ @t.image_cget(@index, slot)
+ end
+
+ def configure(slot, value=None)
+ @t.image_configure(@index, slot, value)
+ self
+ end
+# def configure(slot, value)
+# tk_call @t.path, 'image', 'configure', @index, "-#{slot}", value
+# end
+
+ def configinfo(slot = nil)
+ @t.image_configinfo(@index, slot)
+ end
+
+ def current_configinfo(slot = nil)
+ @t.current_image_configinfo(@index, slot)
+ end
+
+ def image
+ img = tk_call_without_enc(@t.path, 'image', 'configure', @index, '-image')
+ TkImage::Tk_IMGTBL[img]? TkImage::Tk_IMGTBL[img] : img
+ end
+
+ def image=(value)
+ tk_call_without_enc(@t.path, 'image', 'configure', @index, '-image',
+ _get_eval_enc_str(value))
+ #self
+ value
+ end
+end
diff --git a/ext/tk/lib/tk/textmark.rb b/ext/tk/lib/tk/textmark.rb
new file mode 100644
index 0000000000..faf19b7a62
--- /dev/null
+++ b/ext/tk/lib/tk/textmark.rb
@@ -0,0 +1,126 @@
+#
+# tk/textmark.rb - methods for treating text marks
+#
+require 'tk'
+require 'tk/text'
+
+class TkTextMark<TkObject
+ TMarkID_TBL = TkCore::INTERP.create_table
+ Tk_TextMark_ID = ['mark'.freeze, '00000'.taint].freeze
+
+ TkCore::INTERP.init_ip_env{ TMarkID_TBL.clear }
+
+ def TkTextMark.id2obj(text, id)
+ tpath = text.path
+ return id unless TMarkID_TBL[tpath]
+ TMarkID_TBL[tpath][id]? TMarkID_TBL[tpath][id]: id
+ end
+
+ def initialize(parent, index)
+ unless parent.kind_of?(TkText)
+ fail ArguemntError, "expect TkText for 1st argument"
+ end
+ @parent = @t = parent
+ @tpath = parent.path
+ @path = @id = Tk_TextMark_ID.join('')
+ TMarkID_TBL[@id] = self
+ TMarkID_TBL[@tpath] = {} unless TMarkID_TBL[@tpath]
+ TMarkID_TBL[@tpath][@id] = self
+ Tk_TextMark_ID[1].succ!
+ tk_call_without_enc(@t.path, 'mark', 'set', @id,
+ _get_eval_enc_str(index))
+ @t._addtag id, self
+ end
+
+ def id
+ @id
+ end
+
+ def +(mod)
+ @id + ' + ' + mod
+ end
+ def -(mod)
+ @id + ' - ' + mod
+ end
+
+ def set(where)
+ tk_call_without_enc(@t.path, 'mark', 'set', @id,
+ _get_eval_enc_str(where))
+ self
+ end
+
+ def unset
+ tk_call_without_enc(@t.path, 'mark', 'unset', @id)
+ self
+ end
+ alias destroy unset
+
+ def gravity
+ tk_call_without_enc(@t.path, 'mark', 'gravity', @id)
+ end
+
+ def gravity=(direction)
+ tk_call_without_enc(@t.path, 'mark', 'gravity', @id, direction)
+ #self
+ direction
+ end
+
+ def next(index = nil)
+ if index
+ @t.tagid2obj(_fromUTF8(tk_call_without_enc(@t.path, 'mark', 'next', _get_eval_enc_str(index))))
+ else
+ @t.tagid2obj(_fromUTF8(tk_call_without_enc(@t.path, 'mark', 'next', @id)))
+ end
+ end
+
+ def previous(index = nil)
+ if index
+ @t.tagid2obj(_fromUTF8(tk_call_without_enc(@t.path, 'mark', 'previous', _get_eval_enc_str(index))))
+ else
+ @t.tagid2obj(_fromUTF8(tk_call_without_enc(@t.path, 'mark', 'previous', @id)))
+ end
+ end
+end
+
+class TkTextNamedMark<TkTextMark
+ def self.new(parent, name, *args)
+ if TMarkID_TBL[parent.path] && TMarkID_TBL[parent.path][name]
+ return TMarkID_TBL[parent.path][name]
+ else
+ super(parent, name, *args)
+ end
+ end
+
+ def initialize(parent, name, index=nil)
+ unless parent.kind_of?(TkText)
+ fail ArguemntError, "expect TkText for 1st argument"
+ end
+ @parent = @t = parent
+ @tpath = parent.path
+ @path = @id = name
+ TMarkID_TBL[@id] = self
+ TMarkID_TBL[@tpath] = {} unless TMarkID_TBL[@tpath]
+ TMarkID_TBL[@tpath][@id] = self unless TMarkID_TBL[@tpath][@id]
+ tk_call_without_enc(@t.path, 'mark', 'set', @id,
+ _get_eval_enc_str(index)) if index
+ @t._addtag id, self
+ end
+end
+
+class TkTextMarkInsert<TkTextNamedMark
+ def self.new(parent,*args)
+ super(parent, 'insert', *args)
+ end
+end
+
+class TkTextMarkCurrent<TkTextMark
+ def self.new(parent,*args)
+ super(parent, 'current', *args)
+ end
+end
+
+class TkTextMarkAnchor<TkTextMark
+ def self.new(parent,*args)
+ super(parent, 'anchor', *args)
+ end
+end
diff --git a/ext/tk/lib/tk/texttag.rb b/ext/tk/lib/tk/texttag.rb
new file mode 100644
index 0000000000..c08dffd66f
--- /dev/null
+++ b/ext/tk/lib/tk/texttag.rb
@@ -0,0 +1,239 @@
+#
+# tk/texttag.rb - methods for treating text tags
+#
+require 'tk'
+require 'tk/text'
+require 'tk/tagfont'
+
+class TkTextTag<TkObject
+ include TkTreatTagFont
+
+ TTagID_TBL = TkCore::INTERP.create_table
+ Tk_TextTag_ID = ['tag'.freeze, '00000'.taint].freeze
+
+ TkCore::INTERP.init_ip_env{ TTagID_TBL.clear }
+
+ def TkTextTag.id2obj(text, id)
+ tpath = text.path
+ return id unless TTagID_TBL[tpath]
+ TTagID_TBL[tpath][id]? TTagID_TBL[tpath][id]: id
+ end
+
+ def initialize(parent, *args)
+ unless parent.kind_of?(TkText)
+ fail ArguemntError, "expect TkText for 1st argument"
+ end
+ @parent = @t = parent
+ @tpath = parent.path
+ @path = @id = Tk_TextTag_ID.join('')
+ TTagID_TBL[@id] = self
+ TTagID_TBL[@tpath] = {} unless TTagID_TBL[@tpath]
+ TTagID_TBL[@tpath][@id] = self
+ Tk_TextTag_ID[1].succ!
+ #tk_call @t.path, "tag", "configure", @id, *hash_kv(keys)
+ if args != [] then
+ keys = args.pop
+ if keys.kind_of? Hash then
+ add(*args) if args != []
+ configure(keys)
+ else
+ args.push keys
+ add(*args)
+ end
+ end
+ @t._addtag id, self
+ end
+
+ def id
+ @id
+ end
+
+ def first
+ @id + '.first'
+ end
+
+ def last
+ @id + '.last'
+ end
+
+ def add(*indices)
+ 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,
+ *(indices.collect{|idx| _get_eval_enc_str(idx)}))
+ self
+ end
+
+ def ranges
+ l = tk_split_simplelist(tk_call_without_enc(@t.path, 'tag', 'ranges', @id))
+ r = []
+ while key=l.shift
+ r.push [key, l.shift]
+ end
+ r
+ end
+
+ def nextrange(first, last=None)
+ tk_split_list(tk_call_without_enc(@t.path, 'tag', 'nextrange', @id,
+ _get_eval_enc_str(first),
+ _get_eval_enc_str(last)))
+ end
+
+ def prevrange(first, last=None)
+ tk_split_list(tk_call_without_enc(@t.path, 'tag', 'prevrange', @id,
+ _get_eval_enc_str(first),
+ _get_eval_enc_str(last)))
+ end
+
+ def [](key)
+ cget key
+ end
+
+ def []=(key,val)
+ configure key, val
+ val
+ end
+
+ def cget(key)
+ case key.to_s
+ when 'text', 'label', 'show', 'data', 'file'
+ _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',
+ @id, '-font')))
+ unless fnt.kind_of?(TkFont)
+ fnt = tagfontobj(@id, fnt)
+ end
+ if key.to_s == 'kanjifont' && JAPANIZED_TK && TK_VERSION =~ /^4\.*/
+ # obsolete; just for compatibility
+ fnt.kanji_font
+ else
+ fnt
+ end
+ else
+ tk_tcl2ruby(_fromUTF8(tk_call_without_enc(@t.path, 'tag', 'cget',
+ @id, "-#{key}")))
+ end
+ end
+
+ def configure(key, val=None)
+ @t.tag_configure @id, key, val
+ end
+# def configure(key, val=None)
+# if key.kind_of? Hash
+# tk_call @t.path, 'tag', 'configure', @id, *hash_kv(key)
+# else
+# tk_call @t.path, 'tag', 'configure', @id, "-#{key}", val
+# end
+# end
+# def configure(key, value)
+# if value == FALSE
+# value = "0"
+# elsif value.kind_of? Proc
+# value = install_cmd(value)
+# end
+# tk_call @t.path, 'tag', 'configure', @id, "-#{key}", value
+# end
+
+ def configinfo(key=nil)
+ @t.tag_configinfo @id, key
+ end
+
+ def current_configinfo(key=nil)
+ @t.current_tag_configinfo @id, key
+ end
+
+ def bind(seq, cmd=Proc.new, args=nil)
+ _bind([@t.path, 'tag', 'bind', @id], seq, cmd, args)
+ self
+ end
+
+ def bind_append(seq, cmd=Proc.new, args=nil)
+ _bind_append([@t.path, 'tag', 'bind', @id], seq, cmd, args)
+ self
+ end
+
+ def bind_remove(seq)
+ _bind_remove([@t.path, 'tag', 'bind', @id], seq)
+ self
+ end
+
+ def bindinfo(context=nil)
+ _bindinfo([@t.path, 'tag', 'bind', @id], context)
+ end
+
+ def raise(above=None)
+ 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,
+ _get_eval_enc_str(below))
+ self
+ end
+
+ def destroy
+ tk_call_without_enc(@t.path, 'tag', 'delete', @id)
+ TTagID_TBL[@tpath].delete(@id) if TTagID_TBL[@tpath]
+ self
+ end
+end
+
+class TkTextNamedTag<TkTextTag
+ def self.new(parent, name, *args)
+ if TTagID_TBL[parent.path] && TTagID_TBL[parent.path][name]
+ tagobj = TTagID_TBL[parent.path][name]
+ if args != [] then
+ keys = args.pop
+ if keys.kind_of? Hash then
+ tagobj.add(*args) if args != []
+ tagobj.configure(keys)
+ else
+ args.push keys
+ tagobj.add(*args)
+ end
+ end
+ return tagobj
+ else
+ super(parent, name, *args)
+ end
+ end
+
+ def initialize(parent, name, *args)
+ unless parent.kind_of?(TkText)
+ fail ArguemntError, "expect TkText for 1st argument"
+ end
+ @parent = @t = parent
+ @tpath = parent.path
+ @path = @id = name
+ TTagID_TBL[@tpath] = {} unless TTagID_TBL[@tpath]
+ TTagID_TBL[@tpath][@id] = self unless TTagID_TBL[@tpath][@id]
+ #if mode
+ # tk_call @t.path, "addtag", @id, *args
+ #end
+ if args != [] then
+ keys = args.pop
+ if keys.kind_of? Hash then
+ add(*args) if args != []
+ configure(keys)
+ else
+ args.push keys
+ add(*args)
+ end
+ end
+ @t._addtag id, self
+ end
+end
+
+class TkTextTagSel<TkTextNamedTag
+ def self.new(parent, *args)
+ super(parent, 'sel', *args)
+ end
+end
diff --git a/ext/tk/lib/tk/textwindow.rb b/ext/tk/lib/tk/textwindow.rb
new file mode 100644
index 0000000000..6f609ee5e7
--- /dev/null
+++ b/ext/tk/lib/tk/textwindow.rb
@@ -0,0 +1,137 @@
+#
+# tk/textwindow.rb - treat Tk text window object
+#
+require 'tk'
+require 'tk/text'
+
+class TkTextWindow<TkObject
+ def initialize(parent, index, keys)
+ unless parent.kind_of?(TkText)
+ fail ArguemntError, "expect TkText for 1st argument"
+ end
+ @t = parent
+ if index == 'end'
+ @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',
+ 'end - 1 chars'))
+ else
+ @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', _get_eval_enc_str(index)))
+ end
+ @path.gravity = 'left'
+ @index = @path.path
+ keys = _symbolkey2str(keys)
+ @id = keys['window']
+ # keys['window'] = @id.epath if @id.kind_of?(TkWindow)
+ keys['window'] = _epath(@id) if @id
+ if keys['create']
+ @p_create = keys['create']
+ if @p_create.kind_of? Proc
+=begin
+ keys['create'] = install_cmd(proc{
+ @id = @p_create.call
+ if @id.kind_of?(TkWindow)
+ @id.epath
+ else
+ @id
+ end
+ })
+=end
+ keys['create'] = install_cmd(proc{@id = @p_create.call; _epath(@id)})
+ end
+ end
+ tk_call_without_enc(@t.path, 'window', 'create', @index,
+ *hash_kv(keys, true))
+ end
+
+ def [](slot)
+ cget(slot)
+ end
+ def []=(slot, value)
+ configure(slot, value)
+ value
+ end
+
+ def cget(slot)
+ @t.window_cget(@index, slot)
+ end
+
+ def configure(slot, value=None)
+ if slot.kind_of? Hash
+ slot = _symbolkey2str(slot)
+ if slot['window']
+ @id = slot['window']
+ # slot['window'] = @id.epath if @id.kind_of?(TkWindow)
+ slot['window'] = _epath(@id) if @id
+ end
+ if slot['create']
+ self.create=slot.delete('create')
+ end
+ if slot.size > 0
+ tk_call_without_enc(@t.path, 'window', 'configure', @index,
+ *hash_kv(slot, true))
+ end
+ else
+ if slot == 'window' || slot == :window
+ @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,
+ "-#{slot}", _get_eval_enc_str(value))
+ end
+ end
+ self
+ end
+
+ def configinfo(slot = nil)
+ @t.window_configinfo(@index, slot)
+ end
+
+ def current_configinfo(slot = nil)
+ @t.current_window_configinfo(@index, slot)
+ end
+
+ def window
+ @id
+ end
+
+ def window=(value)
+ @id = value
+ # value = @id.epath if @id.kind_of?(TkWindow)
+ value = _epath(@id) if @id
+ tk_call_without_enc(@t.path, 'window', 'configure', @index,
+ '-window', _get_eval_enc_str(value))
+ value
+ end
+
+ def create
+ @p_create
+ end
+
+ def create=(value)
+ @p_create = value
+ if @p_create.kind_of? Proc
+ value = install_cmd(proc{
+ @id = @p_create.call
+ if @id.kind_of?(TkWindow)
+ @id.epath
+ else
+ @id
+ end
+ })
+ end
+ tk_call_without_enc(@t.path, 'window', 'configure', @index,
+ '-create', _get_eval_enc_str(value))
+ value
+ end
+end
diff --git a/ext/tk/lib/tk/timer.rb b/ext/tk/lib/tk/timer.rb
new file mode 100644
index 0000000000..c53e67682d
--- /dev/null
+++ b/ext/tk/lib/tk/timer.rb
@@ -0,0 +1,441 @@
+#
+# tk/timer.rb : methods for Tcl/Tk after command
+#
+# $Id$
+#
+require 'tk'
+
+class TkTimer
+ include TkCore
+ extend TkCore
+
+ TkCommandNames = ['after'.freeze].freeze
+
+ Tk_CBID = ['a'.freeze, '00000'.taint].freeze
+ Tk_CBTBL = {}.taint
+
+ TkCore::INTERP.add_tk_procs('rb_after', 'id', <<-'EOL')
+ if {[set st [catch {eval {ruby_cmd TkTimer callback} $id} ret]] != 0} {
+ return -code $st $ret
+ } {
+ return $ret
+ }
+ EOL
+
+ DEFAULT_IGNORE_EXCEPTIONS = [ NameError, RuntimeError ].freeze
+
+ ###############################
+ # class methods
+ ###############################
+ def self.callback(obj_id)
+ @after_id = nil
+ ex_obj = Tk_CBTBL[obj_id]
+ return "" if ex_obj == nil; # canceled
+ ex_obj.cb_call
+ end
+
+ def self.info(obj = nil)
+ if obj
+ if obj.kind_of?(TkTimer)
+ if obj.after_id
+ inf = tk_split_list(tk_call_without_enc('after','info',obj.after_id))
+ [Tk_CBTBL[inf[0][1]], inf[1]]
+ else
+ nil
+ end
+ else
+ fail ArgumentError, "TkTimer object is expected"
+ end
+ else
+ tk_call_without_enc('after', 'info').split(' ').collect!{|id|
+ ret = Tk_CBTBL.find{|key,val| val.after_id == id}
+ (ret == nil)? id: ret[1]
+ }
+ end
+ end
+
+ ###############################
+ # instance methods
+ ###############################
+ def do_callback
+ @in_callback = true
+ begin
+ @return_value = @current_proc.call(self)
+ rescue Exception => e
+ if @cancel_on_exception &&
+ @cancel_on_exception.find{|exc| e.kind_of?(exc)}
+ cancel
+ @return_value = e
+ return e
+ else
+ fail e
+ end
+ end
+ if @set_next
+ set_next_callback(@current_args)
+ else
+ @set_next = true
+ end
+ @in_callback = false
+ @return_value
+ end
+
+ def set_callback(sleep, args=nil)
+ @after_script = "rb_after #{@id}"
+ @after_id = tk_call_without_enc('after', sleep, @after_script)
+ @current_args = args
+ @current_script = [sleep, @after_script]
+ self
+ end
+
+ def set_next_callback(args)
+ if @running == false || @proc_max == 0 || @do_loop == 0
+ Tk_CBTBL.delete(@id) ;# for GC
+ @running = false
+ @wait_var.value = 0
+ return
+ end
+ if @current_pos >= @proc_max
+ if @do_loop < 0 || (@do_loop -= 1) > 0
+ @current_pos = 0
+ else
+ Tk_CBTBL.delete(@id) ;# for GC
+ @running = false
+ @wait_var.value = 0
+ return
+ end
+ end
+
+ @current_args = args
+
+ if @sleep_time.kind_of? Proc
+ sleep = @sleep_time.call(self)
+ else
+ sleep = @sleep_time
+ end
+ @current_sleep = sleep
+
+ cmd, *cmd_args = @loop_proc[@current_pos]
+ @current_pos += 1
+ @current_proc = cmd
+
+ set_callback(sleep, cmd_args)
+ end
+
+ def initialize(*args)
+ @id = Tk_CBID.join('')
+ Tk_CBID[1].succ!
+
+ @wait_var = TkVariable.new(0)
+
+ @cb_cmd = TkCore::INTERP.get_cb_entry(self.method(:do_callback))
+
+ @set_next = true
+
+ @init_sleep = 0
+ @init_proc = nil
+ @init_args = []
+
+ @current_script = []
+ @current_proc = nil
+ @current_args = nil
+ @return_value = nil
+
+ @sleep_time = 0
+ @current_sleep = 0
+ @loop_exec = 0
+ @do_loop = 0
+ @loop_proc = []
+ @proc_max = 0
+ @current_pos = 0
+
+ @after_id = nil
+ @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).
+
+ set_procs(*args) if args != []
+
+ @running = false
+ @in_callback = false
+ end
+
+ attr :after_id
+ attr :after_script
+ attr :current_proc
+ attr :current_args
+ attr :current_sleep
+ alias :current_interval :current_sleep
+ attr :return_value
+
+ attr_accessor :loop_exec
+
+ def cb_call
+ @cb_cmd.call
+ end
+
+ def get_procs
+ [@init_sleep, @init_proc, @init_args, @sleep_time, @loop_exec, @loop_proc]
+ end
+
+ def current_status
+ [@running, @current_sleep, @current_proc, @current_args,
+ @do_loop, @cancel_on_exception]
+ end
+
+ def cancel_on_exception?
+ @cancel_on_exception
+ end
+
+ def cancel_on_exception=(mode)
+ if mode.kind_of?(Array)
+ @cancel_on_exception = mode
+ elsif mode
+ @cancel_on_exception = DEFAULT_IGNORE_EXCEPTIONS
+ else
+ @cancel_on_exception = false
+ end
+ #self
+ end
+
+ def running?
+ @running
+ end
+
+ def loop_rest
+ @do_loop
+ end
+
+ def loop_rest=(rest)
+ @do_loop = rest
+ #self
+ end
+
+ def set_procs(interval, loop_exec, *procs)
+ if !interval == 'idle' \
+ && !interval.kind_of?(Integer) && !interval.kind_of?(Proc)
+ fail ArguemntError, "expect Integer or Proc for 1st argument"
+ end
+ @sleep_time = interval
+
+ @loop_proc = []
+ procs.each{|e|
+ if e.kind_of? Proc
+ @loop_proc.push([e])
+ else
+ @loop_proc.push(e)
+ end
+ }
+ @proc_max = @loop_proc.size
+ @current_pos = 0
+
+ @do_loop = 0
+ if loop_exec
+ if loop_exec.kind_of?(Integer) && loop_exec < 0
+ @loop_exec = -1
+ elsif loop_exec == nil || loop_exec == false || loop_exec == 0
+ @loop_exec = 1
+ else
+ if not loop_exec.kind_of?(Integer)
+ fail ArguemntError, "expect Integer for 2nd argument"
+ end
+ @loop_exec = loop_exec
+ end
+ @do_loop = @loop_exec
+ end
+
+ self
+ end
+
+ def add_procs(*procs)
+ procs.each{|e|
+ if e.kind_of? Proc
+ @loop_proc.push([e])
+ else
+ @loop_proc.push(e)
+ end
+ }
+ @proc_max = @loop_proc.size
+
+ self
+ end
+
+ def delete_procs(*procs)
+ procs.each{|e|
+ if e.kind_of? Proc
+ @loop_proc.delete([e])
+ else
+ @loop_proc.delete(e)
+ end
+ }
+ @proc_max = @loop_proc.size
+
+ cancel if @proc_max == 0
+
+ self
+ end
+
+ def delete_at(n)
+ @loop_proc.delete_at(n)
+ @proc_max = @loop_proc.size
+ cancel if @proc_max == 0
+ self
+ end
+
+ def set_start_proc(sleep, init_proc, *init_args)
+ if !sleep == 'idle' && !sleep.kind_of?(Integer)
+ fail ArguemntError, "expect Integer or 'idle' for 1st argument"
+ end
+ @init_sleep = sleep
+ @init_proc = init_proc
+ @init_args = init_args
+ self
+ end
+
+ def start(*init_args)
+ return nil if @running
+
+ Tk_CBTBL[@id] = self
+ @do_loop = @loop_exec
+ @current_pos = 0
+
+ argc = init_args.size
+ if argc > 0
+ sleep = init_args.shift
+ if !sleep == 'idle' && !sleep.kind_of?(Integer)
+ fail ArguemntError, "expect Integer or 'idle' for 1st argument"
+ end
+ @init_sleep = sleep
+ end
+ @init_proc = init_args.shift if argc > 1
+ @init_args = init_args if argc > 0
+
+ @current_sleep = @init_sleep
+ @running = true
+ if @init_proc
+ if not @init_proc.kind_of? Proc
+ fail ArgumentError, "Argument '#{@init_proc}' need to be Proc"
+ end
+ @current_proc = @init_proc
+ set_callback(@init_sleep, @init_args)
+ @set_next = false if @in_callback
+ else
+ set_next_callback(@init_args)
+ end
+
+ self
+ end
+
+ def reset(*reset_args)
+ restart() if @running
+
+ if @init_proc
+ @return_value = @init_proc.call(self)
+ else
+ @return_value = nil
+ end
+
+ @current_pos = 0
+ @current_args = @init_args
+ @set_next = false if @in_callback
+
+ self
+ end
+
+ def restart(*restart_args)
+ cancel if @running
+ if restart_args == []
+ start(@init_sleep, @init_proc, *@init_args)
+ else
+ start(*restart_args)
+ end
+ end
+
+ def cancel
+ @running = false
+ @wait_var.value = 0
+ tk_call 'after', 'cancel', @after_id if @after_id
+ @after_id = nil
+ Tk_CBTBL.delete(@id) ;# for GC
+ self
+ end
+ alias stop cancel
+
+ def continue(wait=nil)
+ fail RuntimeError, "is already running" if @running
+ sleep, cmd = @current_script
+ fail RuntimeError, "no procedure to continue" unless cmd
+ if wait
+ unless wait.kind_of? Integer
+ fail ArguemntError, "expect Integer for 1st argument"
+ end
+ sleep = wait
+ end
+ Tk_CBTBL[@id] = self
+ @running = true
+ @after_id = tk_call_without_enc('after', sleep, cmd)
+ self
+ end
+
+ def skip
+ fail RuntimeError, "is not running now" unless @running
+ cancel
+ Tk_CBTBL[@id] = self
+ @running = true
+ set_next_callback(@current_args)
+ self
+ end
+
+ def info
+ if @after_id
+ inf = tk_split_list(tk_call_without_enc('after', 'info', @after_id))
+ [Tk_CBTBL[inf[0][1]], inf[1]]
+ else
+ nil
+ end
+ end
+
+ def wait(on_thread = true, check_root = false)
+ if $SAFE >= 4
+ fail SecurityError, "can't wait timer at $SAFE >= 4"
+ end
+
+ unless @running
+ if @return_value.kind_of?(Exception)
+ fail @return_value
+ else
+ return @return_value
+ end
+ end
+
+ @wait_var.wait(on_thread, check_root)
+ if @return_value.kind_of?(Exception)
+ fail @return_value
+ else
+ @return_value
+ end
+ end
+ def eventloop_wait(check_root = false)
+ wait(false, check_root)
+ end
+ def thread_wait(check_root = false)
+ wait(true, check_root)
+ end
+ def tkwait(on_thread = true)
+ wait(on_thread, true)
+ end
+ def eventloop_tkwait
+ wait(false, true)
+ end
+ def thread_tkwait
+ wait(true, true)
+ end
+end
+
+TkAfter = TkTimer
diff --git a/ext/tk/lib/tk/toplevel.rb b/ext/tk/lib/tk/toplevel.rb
new file mode 100644
index 0000000000..f8b0f77936
--- /dev/null
+++ b/ext/tk/lib/tk/toplevel.rb
@@ -0,0 +1,211 @@
+#
+# tk/toplevel.rb : treat toplevel widget
+#
+require 'tk'
+require 'tk/wm'
+
+class TkToplevel<TkWindow
+ include Wm
+
+ TkCommandNames = ['toplevel'.freeze].freeze
+ WidgetClassName = 'Toplevel'.freeze
+ WidgetClassNames[WidgetClassName] = self
+
+################# old version
+# def initialize(parent=nil, screen=nil, classname=nil, keys=nil)
+# if screen.kind_of? Hash
+# keys = screen.dup
+# else
+# @screen = screen
+# end
+# @classname = classname
+# if keys.kind_of? Hash
+# keys = keys.dup
+# @classname = keys.delete('classname') if keys.key?('classname')
+# @colormap = keys.delete('colormap') if keys.key?('colormap')
+# @container = keys.delete('container') if keys.key?('container')
+# @screen = keys.delete('screen') if keys.key?('screen')
+# @use = keys.delete('use') if keys.key?('use')
+# @visual = keys.delete('visual') if keys.key?('visual')
+# end
+# super(parent, keys)
+# end
+#
+# def create_self
+# s = []
+# s << "-class" << @classname if @classname
+# s << "-colormap" << @colormap if @colormap
+# s << "-container" << @container if @container
+# s << "-screen" << @screen if @screen
+# s << "-use" << @use if @use
+# s << "-visual" << @visual if @visual
+# tk_call 'toplevel', @path, *s
+# end
+#################
+
+ def _wm_command_option_chk(keys)
+ keys = {} unless keys
+ new_keys = {}
+ wm_cmds = {}
+ keys.each{|k,v|
+ if Wm.method_defined?(k)
+ case k
+ when 'screen','class','colormap','container','use','visual'
+ new_keys[k] = v
+ else
+ case self.method(k).arity
+ when -1,1
+ wm_cmds[k] = v
+ else
+ new_keys[k] = v
+ end
+ end
+ else
+ new_keys[k] = v
+ end
+ }
+ [new_keys, wm_cmds]
+ end
+ private :_wm_command_option_chk
+
+ def initialize(parent=nil, screen=nil, classname=nil, keys=nil)
+ my_class_name = nil
+ if self.class < WidgetClassNames[WidgetClassName]
+ my_class_name = self.class.name
+ my_class_name = nil if my_class_name == ''
+ end
+ if parent.kind_of? Hash
+ keys = _symbolkey2str(parent)
+ if keys.key?('classname')
+ keys['class'] = keys.delete('classname')
+ end
+ @classname = keys['class']
+ @colormap = keys['colormap']
+ @container = keys['container']
+ @screen = keys['screen']
+ @use = keys['use']
+ @visual = keys['visual']
+ if !@classname && my_class_name
+ keys['class'] = @classname = my_class_name
+ end
+ if @classname.kind_of? TkBindTag
+ @db_class = @classname
+ @classname = @classname.id
+ elsif @classname
+ @db_class = TkDatabaseClass.new(@classname)
+ else
+ @db_class = self.class
+ @classname = @db_class::WidgetClassName
+ end
+ keys, cmds = _wm_command_option_chk(keys)
+ super(keys)
+ cmds.each{|k,v|
+ if v.kind_of? Array
+ self.send(k,*v)
+ else
+ self.send(k,v)
+ end
+ }
+ return
+ end
+
+ if screen.kind_of? Hash
+ keys = screen
+ else
+ @screen = screen
+ if classname.kind_of? Hash
+ keys = classname
+ else
+ @classname = classname
+ end
+ end
+ if keys.kind_of? Hash
+ keys = _symbolkey2str(keys)
+ if keys.key?('classname')
+ keys['class'] = keys.delete('classname')
+ end
+ @classname = keys['class'] unless @classname
+ @colormap = keys['colormap']
+ @container = keys['container']
+ @screen = keys['screen'] unless @screen
+ @use = keys['use']
+ @visual = keys['visual']
+ else
+ keys = {}
+ end
+ if !@classname && my_class_name
+ keys['class'] = @classname = my_class_name
+ end
+ if @classname.kind_of? TkBindTag
+ @db_class = @classname
+ @classname = @classname.id
+ elsif @classname
+ @db_class = TkDatabaseClass.new(@classname)
+ else
+ @db_class = self.class
+ @classname = @db_class::WidgetClassName
+ end
+ keys, cmds = _wm_command_option_chk(keys)
+ super(parent, keys)
+ cmds.each{|k,v|
+ if v.kind_of? Array
+ self.send(k,*v)
+ else
+ self.send(k,v)
+ end
+ }
+ end
+
+ def create_self(keys)
+ if keys and keys != None
+ tk_call_without_enc('toplevel', @path, *hash_kv(keys, true))
+ else
+ tk_call_without_enc('toplevel', @path)
+ end
+ end
+ private :create_self
+
+ def specific_class
+ @classname
+ end
+
+ def self.database_class
+ if self == WidgetClassNames[WidgetClassName] || self.name == ''
+ self
+ else
+ TkDatabaseClass.new(self.name)
+ end
+ end
+ def self.database_classname
+ self.database_class.name
+ end
+
+ def self.bind(*args)
+ if self == WidgetClassNames[WidgetClassName] || self.name == ''
+ super(*args)
+ else
+ TkDatabaseClass.new(self.name).bind(*args)
+ end
+ end
+ def self.bind_append(*args)
+ if self == WidgetClassNames[WidgetClassName] || self.name == ''
+ super(*args)
+ else
+ TkDatabaseClass.new(self.name).bind_append(*args)
+ end
+ end
+ def self.bind_remove(*args)
+ if self == WidgetClassNames[WidgetClassName] || self.name == ''
+ super(*args)
+ else
+ TkDatabaseClass.new(self.name).bind_remove(*args)
+ end
+ end
+ def self.bindinfo(*args)
+ if self == WidgetClassNames[WidgetClassName] || self.name == ''
+ super(*args)
+ else
+ TkDatabaseClass.new(self.name).bindinfo(*args)
+ end
+ end
+end
diff --git a/ext/tk/lib/tk/txtwin_abst.rb b/ext/tk/lib/tk/txtwin_abst.rb
new file mode 100644
index 0000000000..63da9da11d
--- /dev/null
+++ b/ext/tk/lib/tk/txtwin_abst.rb
@@ -0,0 +1,38 @@
+#
+# tk/txtwin_abst.rb : TkTextWin abstruct class
+#
+require 'tk'
+
+class TkTextWin<TkWindow
+ def create_self
+ fail RuntimeError, "TkTextWin is an abstract class"
+ end
+ private :create_self
+
+ def bbox(index)
+ list(tk_send_without_enc('bbox', index))
+ end
+ def delete(first, last=None)
+ tk_send_without_enc('delete', first, last)
+ self
+ end
+ def get(*index)
+ _fromUTF8(tk_send_without_enc('get', *index))
+ end
+ def insert(index, *args)
+ tk_send('insert', index, *args)
+ self
+ end
+ def scan_mark(x, y)
+ tk_send_without_enc('scan', 'mark', x, y)
+ self
+ end
+ def scan_dragto(x, y)
+ tk_send_without_enc('scan', 'dragto', x, y)
+ self
+ end
+ def see(index)
+ tk_send_without_enc('see', index)
+ self
+ end
+end
diff --git a/ext/tk/lib/tk/validation.rb b/ext/tk/lib/tk/validation.rb
new file mode 100644
index 0000000000..70e84e6cbf
--- /dev/null
+++ b/ext/tk/lib/tk/validation.rb
@@ -0,0 +1,166 @@
+#
+# tk/validation.rb - validation support module for entry, spinbox, and so on
+#
+require 'tk'
+
+module TkValidation
+ class ValidateCmd
+ include TkComm
+
+ module Action
+ Insert = 1
+ Delete = 0
+ Others = -1
+ Focus = -1
+ Forced = -1
+ Textvariable = -1
+ TextVariable = -1
+ end
+
+ 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 ],
+ nil
+ ]
+
+ proc_tbl = [
+ [ ?n, TkComm.method(:number) ],
+ [ ?s, TkComm.method(:string) ],
+ [ ?w, TkComm.method(:window) ],
+
+ [ ?e, proc{|val|
+ enc = Tk.encoding
+ if enc
+ Tk.fromUTF8(TkComm::string(val), enc)
+ else
+ TkComm::string(val)
+ end
+ }
+ ],
+
+ [ ?x, proc{|val|
+ idx = TkComm::number(val)
+ if idx < 0
+ nil
+ else
+ idx
+ end
+ }
+ ],
+
+ nil
+ ]
+
+ _setup_subst_table(key_tbl, proc_tbl);
+ end
+
+ def initialize(cmd = Proc.new, *args)
+ if args.compact.size > 0
+ args = args.join(' ')
+ keys = ValidateArgs._get_subst_key(args)
+ if cmd.kind_of?(String)
+ id = cmd
+ elsif cmd.kind_of?(TkCallbackEntry)
+ @id = install_cmd(cmd)
+ else
+ @id = install_cmd(proc{|*arg|
+ (cmd.call(*ValidateArgs.scan_args(keys, arg)))? '1':'0'
+ }) + ' ' + args
+ end
+ else
+ keys, args = ValidateArgs._get_all_subst_keys
+ if cmd.kind_of?(String)
+ id = cmd
+ elsif cmd.kind_of?(TkCallbackEntry)
+ @id = install_cmd(cmd)
+ else
+ @id = install_cmd(proc{|*arg|
+ (cmd.call(
+ ValidateArgs.new(*ValidateArgs.scan_args(keys,arg)))
+ )? '1': '0'
+ }) + ' ' + args
+ end
+ end
+ end
+
+ def to_eval
+ @id
+ end
+ end
+
+ #####################################
+
+ def configure(slot, value=TkComm::None)
+ if slot.kind_of? Hash
+ slot = _symbolkey2str(slot)
+ if slot['vcmd'].kind_of? Array
+ cmd, *args = slot['vcmd']
+ slot['vcmd'] = ValidateCmd.new(cmd, args.join(' '))
+ elsif slot['vcmd'].kind_of? Proc
+ slot['vcmd'] = ValidateCmd.new(slot['vcmd'])
+ end
+ if slot['validatecommand'].kind_of? Array
+ cmd, *args = slot['validatecommand']
+ slot['validatecommand'] = ValidateCmd.new(cmd, args.join(' '))
+ elsif slot['validatecommand'].kind_of? Proc
+ slot['validatecommand'] = ValidateCmd.new(slot['validatecommand'])
+ end
+ if slot['invcmd'].kind_of? Array
+ cmd, *args = slot['invcmd']
+ slot['invcmd'] = ValidateCmd.new(cmd, args.join(' '))
+ elsif slot['invcmd'].kind_of? Proc
+ slot['invcmd'] = ValidateCmd.new(slot['invcmd'])
+ end
+ if slot['invalidcommand'].kind_of? Array
+ cmd, *args = slot['invalidcommand']
+ slot['invalidcommand'] = ValidateCmd.new(cmd, args.join(' '))
+ elsif slot['invalidcommand'].kind_of? Proc
+ slot['invalidcommand'] = ValidateCmd.new(slot['invalidcommand'])
+ end
+ super(slot)
+ else
+ if (slot == 'vcmd' || slot == :vcmd ||
+ slot == 'validatecommand' || slot == :validatecommand ||
+ slot == 'invcmd' || slot == :invcmd ||
+ slot == 'invalidcommand' || slot == :invalidcommand)
+ if value.kind_of? Array
+ cmd, *args = value
+ value = ValidateCmd.new(cmd, args.join(' '))
+ elsif value.kind_of? Proc
+ value = ValidateCmd.new(value)
+ end
+ end
+ super(slot, value)
+ end
+ self
+ end
+
+ def validatecommand(cmd = Proc.new, args = nil)
+ if cmd.kind_of?(ValidateCmd)
+ configure('validatecommand', cmd)
+ elsif args
+ configure('validatecommand', [cmd, args])
+ else
+ configure('validatecommand', cmd)
+ end
+ end
+ alias vcmd validatecommand
+
+ def invalidcommand(cmd = Proc.new, args = nil)
+ if cmd.kind_of?(ValidateCmd)
+ configure('invalidcommand', cmd)
+ elsif args
+ configure('invalidcommand', [cmd, args])
+ else
+ configure('invalidcommand', cmd)
+ end
+ end
+ alias invcmd invalidcommand
+end
diff --git a/ext/tk/lib/tk/variable.rb b/ext/tk/lib/tk/variable.rb
new file mode 100644
index 0000000000..c4ec91741d
--- /dev/null
+++ b/ext/tk/lib/tk/variable.rb
@@ -0,0 +1,847 @@
+#
+# tk/variable.rb : treat Tk variable object
+#
+require 'tk'
+
+class TkVariable
+ include Tk
+ extend TkCore
+
+ include Comparable
+
+ #TkCommandNames = ['tkwait'.freeze].freeze
+ TkCommandNames = ['vwait'.freeze].freeze
+
+ #TkVar_CB_TBL = {}
+ #TkVar_ID_TBL = {}
+ TkVar_CB_TBL = TkCore::INTERP.create_table
+ TkVar_ID_TBL = TkCore::INTERP.create_table
+ Tk_VARIABLE_ID = ["v".freeze, "00000".taint].freeze
+
+ #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} {
+ set idx [string first "\n\n" $ret]
+ if {$idx > 0} {
+ global errorInfo
+ set tcl_backtrace $errorInfo
+ set errorInfo [string range $ret [expr $idx + 2] \
+ [string length $ret]]
+ append errorInfo "\n" $tcl_backtrace
+ bgerror [string range $ret 0 [expr $idx - 1]]
+ } else {
+ bgerror $ret
+ }
+ return ""
+ #return -code $st $ret
+ } else {
+ return $ret
+ }
+ EOL
+
+ #def TkVariable.callback(args)
+ def TkVariable.callback(name1, name2, op)
+ #name1,name2,op = tk_split_list(args)
+ #name1,name2,op = tk_split_simplelist(args)
+ if TkVar_CB_TBL[name1]
+ #_get_eval_string(TkVar_CB_TBL[name1].trace_callback(name2,op))
+ begin
+ _get_eval_string(TkVar_CB_TBL[name1].trace_callback(name2, op))
+ rescue Exception => e
+ begin
+ 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 >-------"
+ msg.instance_variable_set(:@encoding, 'utf-8')
+ rescue Exception
+ 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)
+ end
+=begin
+ begin
+ raise 'check backtrace'
+ rescue
+ # ignore backtrace before 'callback'
+ pos = -($!.backtrace.size)
+ end
+ begin
+ _get_eval_string(TkVar_CB_TBL[name1].trace_callback(name2,op))
+ rescue
+ trace = $!.backtrace
+ raise $!, "\n#{trace[0]}: #{$!.message} (#{$!.class})\n" +
+ "\tfrom #{trace[1..pos].join("\n\tfrom ")}"
+ end
+=end
+ else
+ ''
+ end
+ end
+
+ def initialize(val="")
+ @id = Tk_VARIABLE_ID.join('')
+ Tk_VARIABLE_ID[1].succ!
+ TkVar_ID_TBL[@id] = self
+
+ @trace_var = nil
+ @trace_elem = nil
+ @trace_opts = nil
+
+ begin
+ INTERP._unset_global_var(@id)
+ rescue
+ end
+
+ # teach Tk-ip that @id is global var
+ INTERP._invoke_without_enc('global', @id)
+ #INTERP._invoke('global', @id)
+
+ self.value = val
+
+=begin
+ if val == []
+ # INTERP._eval(format('global %s; set %s(0) 0; unset %s(0)',
+ # @id, @id, @id))
+ elsif val.kind_of?(Array)
+ a = []
+ # val.each_with_index{|e,i| a.push(i); a.push(array2tk_list(e))}
+ # s = '"' + a.join(" ").gsub(/[\[\]$"]/, '\\\\\&') + '"'
+ val.each_with_index{|e,i| a.push(i); a.push(e)}
+ #s = '"' + array2tk_list(a).gsub(/[\[\]$"]/, '\\\\\&') + '"'
+ s = '"' + array2tk_list(a).gsub(/[\[\]$"\\]/, '\\\\\&') + '"'
+ INTERP._eval(format('global %s; array set %s %s', @id, @id, s))
+ elsif val.kind_of?(Hash)
+ #s = '"' + val.to_a.collect{|e| array2tk_list(e)}.join(" ")\
+ # .gsub(/[\[\]$"]/, '\\\\\&') + '"'
+ s = '"' + val.to_a.collect{|e| array2tk_list(e)}.join(" ")\
+ .gsub(/[\[\]$"\\]/, '\\\\\&') + '"'
+ INTERP._eval(format('global %s; array set %s %s', @id, @id, s))
+ else
+ #s = '"' + _get_eval_string(val).gsub(/[\[\]$"]/, '\\\\\&') + '"'
+ s = '"' + _get_eval_string(val).gsub(/[\[\]$"\\]/, '\\\\\&') + '"'
+ INTERP._eval(format('global %s; set %s %s', @id, @id, s))
+ end
+=end
+=begin
+ if val.kind_of?(Hash)
+ #s = '"' + val.to_a.collect{|e| array2tk_list(e)}.join(" ")\
+ # .gsub(/[\[\]$"]/, '\\\\\&') + '"'
+ s = '"' + val.to_a.collect{|e| array2tk_list(e)}.join(" ")\
+ .gsub(/[\[\]$"\\]/, '\\\\\&') + '"'
+ INTERP._eval(Kernel.format('global %s; array set %s %s', @id, @id, s))
+ else
+ #s = '"' + _get_eval_string(val).gsub(/[\[\]$"]/, '\\\\\&') + '"'
+ s = '"' + _get_eval_string(val).gsub(/[\[\]$"\\]/, '\\\\\&') + '"'
+ INTERP._eval(Kernel.format('global %s; set %s %s', @id, @id, s))
+ end
+=end
+ end
+
+ def wait(on_thread = false, check_root = false)
+ if $SAFE >= 4
+ fail SecurityError, "can't wait variable at $SAFE >= 4"
+ end
+ on_thread &= (Thread.list.size != 1)
+ if on_thread
+ if check_root
+ INTERP._thread_tkwait('variable', @id)
+ else
+ INTERP._thread_vwait(@id)
+ end
+ else
+ if check_root
+ INTERP._invoke_without_enc('tkwait', 'variable', @id)
+ else
+ INTERP._invoke_without_enc('vwait', @id)
+ end
+ end
+ end
+ def eventloop_wait(check_root = false)
+ wait(false, check_root)
+ end
+ def thread_wait(check_root = false)
+ wait(true, check_root)
+ end
+ def tkwait(on_thread = true)
+ wait(on_thread, true)
+ end
+ def eventloop_tkwait
+ wait(false, true)
+ end
+ def thread_tkwait
+ wait(true, true)
+ end
+
+ def id
+ @id
+ end
+
+ def is_hash?
+ #ITNERP._eval("global #{@id}; array exist #{@id}") == '1'
+ ITNERP._invoke_without_enc('array', 'exist', @id) == '1'
+ end
+
+ def is_scalar?
+ ! is_hash?
+ end
+
+ def keys
+ if (is_scalar?)
+ fail RuntimeError, 'cannot get keys from a scalar variable'
+ end
+ #tk_split_simplelist(INTERP._eval("global #{@id}; array get #{@id}"))
+ tk_split_simplelist(INTERP._fromUTF8(INTERP._invoke_without_enc('array', 'get', @id)))
+ end
+
+
+unless const_defined?(:USE_TCLs_SET_VARIABLE_FUNCTIONS)
+ USE_TCLs_SET_VARIABLE_FUNCTIONS = true
+end
+
+if USE_TCLs_SET_VARIABLE_FUNCTIONS
+ ###########################################################################
+ # use Tcl function version of set tkvariable
+ ###########################################################################
+
+ def value
+ #if INTERP._eval("global #{@id}; array exist #{@id}") == '1'
+ if INTERP._invoke('array', 'exist', @id) == '1'
+ #Hash[*tk_split_simplelist(INTERP._eval("global #{@id}; array get #{@id}"))]
+ Hash[*tk_split_simplelist(INTERP._invoke('array', 'get', @id))]
+ else
+ _fromUTF8(INTERP._get_global_var(@id))
+ end
+ end
+
+ def value=(val)
+ if val.kind_of?(Hash)
+ val.each{|k, v|
+ #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),
+ _get_eval_string(v, true))
+ }
+ self.value
+ elsif val.kind_of?(Array)
+ 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 |
+ TclTkLib::VarAccessFlag::LEAVE_ERR_MSG |
+ TclTkLib::VarAccessFlag::APPEND_VALUE |
+ TclTkLib::VarAccessFlag::LIST_ELEMENT)
+ }
+ self.value
+ else
+ #_fromUTF8(INTERP._set_global_var(@id, _toUTF8(_get_eval_string(val))))
+ _fromUTF8(INTERP._set_global_var(@id, _get_eval_string(val, true)))
+ end
+ end
+
+ def [](index)
+ #_fromUTF8(INTERP._get_global_var2(@id, _toUTF8(_get_eval_string(index))))
+ _fromUTF8(INTERP._get_global_var2(@id, _get_eval_string(index, true)))
+ end
+
+ def []=(index,val)
+ #_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),
+ _get_eval_string(val, true)))
+ end
+
+ def unset(elem=nil)
+ if elem
+ INTERP._unset_global_var2(@id, tk_tcl2ruby(elem))
+ else
+ INTERP._unset_global_var(@id)
+ end
+ end
+ alias remove unset
+
+else
+ ###########################################################################
+ # use Ruby script version of set tkvariable (traditional methods)
+ ###########################################################################
+
+ def value
+ begin
+ INTERP._eval(Kernel.format('global %s; set %s', @id, @id))
+ #INTERP._eval(Kernel.format('set %s', @id))
+ #INTERP._invoke_without_enc('set', @id)
+ rescue
+ 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"
+ fail
+ else
+ Hash[*tk_split_simplelist(INTERP._eval(Kernel.format('global %s; array get %s', @id, @id)))]
+ #Hash[*tk_split_simplelist(_fromUTF8(INTERP._invoke_without_enc('array', 'get', @id)))]
+ end
+ end
+ end
+
+ def value=(val)
+ begin
+ #s = '"' + _get_eval_string(val).gsub(/[\[\]$"]/, '\\\\\&') + '"'
+ s = '"' + _get_eval_string(val).gsub(/[\[\]$"\\]/, '\\\\\&') + '"'
+ INTERP._eval(Kernel.format('global %s; set %s %s', @id, @id, s))
+ #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',
+ @id, @id)) != "1"
+ #if INTERP._eval(Kernel.format('array exists %s', @id)) != "1"
+ #if INTERP._invoke_without_enc('array', 'exists', @id) != "1"
+ fail
+ 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)',
+ # @id, @id, @id))
+ #INTERP._invoke_without_enc('unset', @id)
+ #INTERP._invoke_without_enc('set', @id+'(0)', 0)
+ #INTERP._invoke_without_enc('unset', @id+'(0)')
+ elsif val.kind_of?(Array)
+ a = []
+ val.each_with_index{|e,i| a.push(i); a.push(array2tk_list(e))}
+ #s = '"' + a.join(" ").gsub(/[\[\]$"]/, '\\\\\&') + '"'
+ s = '"' + a.join(" ").gsub(/[\[\]$"\\]/, '\\\\\&') + '"'
+ 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',
+ # @id, @id, s))
+ #INTERP._invoke_without_enc('unset', @id)
+ #_fromUTF8(INTERP._invoke_without_enc('array','set', @id, _toUTF8(s)))
+ elsif val.kind_of?(Hash)
+ #s = '"' + val.to_a.collect{|e| array2tk_list(e)}.join(" ")\
+ # .gsub(/[\[\]$"]/, '\\\\\&') + '"'
+ s = '"' + val.to_a.collect{|e| array2tk_list(e)}.join(" ")\
+ .gsub(/[\[\]$\\"]/, '\\\\\&') + '"'
+ 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',
+ # @id, @id, s))
+ #INTERP._invoke_without_enc('unset', @id)
+ #_fromUTF8(INTERP._invoke_without_enc('array','set', @id, _toUTF8(s)))
+ else
+ fail
+ end
+ end
+ end
+ end
+
+ def [](index)
+ 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) + ')')
+ end
+
+ def []=(index,val)
+ 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,
+ # _get_eval_string(index), _get_eval_string(val)))
+ #INTERP._eval('set ' + @id + '(' + _get_eval_string(index) + ') ' +
+ # _get_eval_string(val))
+ end
+
+ def unset(elem=nil)
+ if elem
+ INTERP._eval(Kernel.format('global %s; unset %s(%s)',
+ @id, @id, tk_tcl2ruby(elem)))
+ #INTERP._eval(Kernel.format('unset %s(%s)', @id, tk_tcl2ruby(elem)))
+ #INTERP._eval('unset ' + @id + '(' + _get_eval_string(elem) + ')')
+ else
+ INTERP._eval(Kernel.format('global %s; unset %s', @id, @id))
+ #INTERP._eval(Kernel.format('unset %s', @id))
+ #INTERP._eval('unset ' + @id)
+ end
+ end
+ alias remove unset
+
+end
+
+ def numeric
+ number(value)
+ end
+ def numeric=(val)
+ case val
+ when Numeric
+ self.value=(val)
+ when TkVariable
+ self.value=(val.numeric)
+ else
+ raise ArgumentError, "Numeric is expected"
+ end
+ val
+ end
+
+ def to_i
+ number(value).to_i
+ end
+
+ def to_f
+ number(value).to_f
+ end
+
+ def to_s
+ #string(value).to_s
+ value
+ end
+
+ def to_sym
+ value.intern
+ end
+
+ def list
+ #tk_split_list(value)
+ tk_split_simplelist(value)
+ end
+ alias to_a list
+
+ def list=(val)
+ case val
+ when Array
+ self.value=(val)
+ when TkVariable
+ self.value=(val.list)
+ else
+ raise ArgumentError, "Array is expected"
+ end
+ val
+ end
+
+ def inspect
+ #Kernel.format "#<TkVariable: %s>", @id
+ '#<TkVariable: ' + @id + '>'
+ end
+
+ def coerce(other)
+ case other
+ when TkVariable
+ [other.value, self.value]
+ when String
+ [other, self.to_s]
+ when Symbol
+ [other, self.to_sym]
+ when Integer
+ [other, self.to_i]
+ when Float
+ [other, self.to_f]
+ when Array
+ [other, self.to_a]
+ else
+ [other, self.value]
+ end
+ end
+
+ def &(other)
+ if other.kind_of?(Array)
+ self.to_a & other.to_a
+ else
+ self.to_i & other.to_i
+ end
+ end
+ def |(other)
+ if other.kind_of?(Array)
+ self.to_a | other.to_a
+ else
+ self.to_i | other.to_i
+ end
+ end
+ def +(other)
+ case other
+ when Array
+ self.to_a + other
+ when String
+ self.value + other
+ else
+ begin
+ number(self.value) + other
+ rescue
+ self.value + other.to_s
+ end
+ end
+ end
+ def -(other)
+ if other.kind_of?(Array)
+ self.to_a - other
+ else
+ number(self.value) - other
+ end
+ end
+ def *(other)
+ begin
+ number(self.value) * other
+ rescue
+ self.value * other
+ end
+ end
+ def /(other)
+ number(self.value) / other
+ end
+ def %(other)
+ begin
+ number(self.value) % other
+ rescue
+ self.value % other
+ end
+ end
+ def **(other)
+ number(self.value) ** other
+ end
+ def =~(other)
+ self.value =~ other
+ end
+
+ def ==(other)
+ case other
+ when TkVariable
+ self.equal?(other)
+ when String
+ self.to_s == other
+ when Symbol
+ self.to_sym == other
+ when Integer
+ self.to_i == other
+ when Float
+ self.to_f == other
+ when Array
+ self.to_a == other
+ when Hash
+ self.value == other
+ else
+ false
+ end
+ end
+
+ def zero?
+ numeric.zero?
+ end
+ def nonzero?
+ !(numeric.zero?)
+ end
+
+ def <=>(other)
+ if other.kind_of?(TkVariable)
+ begin
+ val = other.numeric
+ other = val
+ rescue
+ other = other.value
+ end
+ end
+ if other.kind_of?(Numeric)
+ begin
+ return self.numeric <=> other
+ rescue
+ return self.value <=> other.to_s
+ end
+ else
+ return self.value <=> other
+ end
+ end
+
+ def to_eval
+ @id
+ end
+
+ def trace_callback(elem, op)
+ if @trace_var.kind_of? Array
+ @trace_var.each{|m,e| e.call(self,elem,op) if m.index(op)}
+ end
+ if elem.kind_of?(String) && elem != ''
+ if @trace_elem.kind_of?(Hash) && @trace_elem[elem].kind_of?(Array)
+ @trace_elem[elem].each{|m,e| e.call(self,elem,op) if m.index(op)}
+ end
+ end
+ end
+
+ def trace(opts, cmd = Proc.new)
+ @trace_var = [] if @trace_var == nil
+ opts = ['r','w','u'].find_all{|c| opts.index(c)}.join('')
+ @trace_var.unshift([opts,cmd])
+ if @trace_opts == nil
+ TkVar_CB_TBL[@id] = self
+ @trace_opts = opts.dup
+ Tk.tk_call_without_enc('trace', 'variable', @id, @trace_opts, 'rb_var')
+=begin
+ if /^(8\.([4-9]|[1-9][0-9])|9\.|[1-9][0-9])/ =~ Tk::TCL_VERSION
+ # TCL_VERSION >= 8.4
+ Tk.tk_call_without_enc('trace', 'add', 'variable',
+ @id, @trace_opts, 'rb_var')
+ else
+ # TCL_VERSION <= 8.3
+ Tk.tk_call_without_enc('trace', 'variable', @id, @trace_opts, 'rb_var')
+ end
+=end
+ else
+ newopts = @trace_opts.dup
+ opts.each_byte{|c| newopts += c.chr unless newopts.index(c)}
+ if newopts != @trace_opts
+ Tk.tk_call_without_enc('trace', 'vdelete', @id, @trace_opts, 'rb_var')
+ @trace_opts.replace(newopts)
+ Tk.tk_call_without_enc('trace', 'variable', @id, @trace_opts, 'rb_var')
+=begin
+ if /^(8\.([4-9]|[1-9][0-9])|9\.|[1-9][0-9])/ =~ Tk::TCL_VERSION
+ # TCL_VERSION >= 8.4
+ Tk.tk_call_without_enc('trace', 'remove', 'variable',
+ @id, @trace_opts, 'rb_var')
+ @trace_opts.replace(newopts)
+ Tk.tk_call_without_enc('trace', 'add', 'variable',
+ @id, @trace_opts, 'rb_var')
+ else
+ # TCL_VERSION <= 8.3
+ Tk.tk_call_without_enc('trace', 'vdelete',
+ @id, @trace_opts, 'rb_var')
+ @trace_opts.replace(newopts)
+ Tk.tk_call_without_enc('trace', 'variable',
+ @id, @trace_opts, 'rb_var')
+ end
+=end
+ end
+ end
+ self
+ end
+
+ def trace_element(elem, opts, cmd = Proc.new)
+ @trace_elem = {} if @trace_elem == nil
+ @trace_elem[elem] = [] if @trace_elem[elem] == nil
+ opts = ['r','w','u'].find_all{|c| opts.index(c)}.join('')
+ @trace_elem[elem].unshift([opts,cmd])
+ if @trace_opts == nil
+ TkVar_CB_TBL[@id] = self
+ @trace_opts = opts.dup
+ Tk.tk_call_without_enc('trace', 'variable', @id, @trace_opts, 'rb_var')
+=begin
+ if /^(8\.([4-9]|[1-9][0-9])|9\.|[1-9][0-9])/ =~ Tk::TCL_VERSION
+ # TCL_VERSION >= 8.4
+ Tk.tk_call_without_enc('trace', 'add', 'variable',
+ @id, @trace_opts, 'rb_var')
+ else
+ # TCL_VERSION <= 8.3
+ Tk.tk_call_without_enc('trace', 'variable',
+ @id, @trace_opts, 'rb_var')
+ end
+=end
+ else
+ newopts = @trace_opts.dup
+ opts.each_byte{|c| newopts += c.chr unless newopts.index(c)}
+ if newopts != @trace_opts
+ Tk.tk_call_without_enc('trace', 'vdelete', @id, @trace_opts, 'rb_var')
+ @trace_opts.replace(newopts)
+ Tk.tk_call_without_enc('trace', 'variable', @id, @trace_opts, 'rb_var')
+=begin
+ if /^(8\.([4-9]|[1-9][0-9])|9\.|[1-9][0-9])/ =~ Tk::TCL_VERSION
+ # TCL_VERSION >= 8.4
+ Tk.tk_call_without_enc('trace', 'remove', 'variable',
+ @id, @trace_opts, 'rb_var')
+ @trace_opts.replace(newopts)
+ Tk.tk_call_without_enc('trace', 'add', 'variable',
+ @id, @trace_opts, 'rb_var')
+ else
+ # TCL_VERSION <= 8.3
+ Tk.tk_call_without_enc('trace', 'vdelete',
+ @id, @trace_opts, 'rb_var')
+ @trace_opts.replace(newopts)
+ Tk.tk_call_without_enc('trace', 'variable',
+ @id, @trace_opts, 'rb_var')
+ end
+=end
+ end
+ end
+ self
+ end
+
+ def trace_vinfo
+ return [] unless @trace_var
+ @trace_var.dup
+ end
+ def trace_vinfo_for_element(elem)
+ return [] unless @trace_elem
+ return [] unless @trace_elem[elem]
+ @trace_elem[elem].dup
+ end
+
+ def trace_vdelete(opts,cmd)
+ return self unless @trace_var.kind_of? Array
+ opts = ['r','w','u'].find_all{|c| opts.index(c)}.join('')
+ idx = -1
+ newopts = ''
+ @trace_var.each_with_index{|e,i|
+ if idx < 0 && e[0] == opts && e[1] == cmd
+ idx = i
+ next
+ end
+ e[0].each_byte{|c| newopts += c.chr unless newopts.index(c)}
+ }
+ if idx >= 0
+ @trace_var.delete_at(idx)
+ else
+ return self
+ end
+
+ @trace_elem.each{|elem|
+ @trace_elem[elem].each{|e|
+ e[0].each_byte{|c| newopts += c.chr unless newopts.index(c)}
+ }
+ }
+
+ newopts = ['r','w','u'].find_all{|c| newopts.index(c)}.join('')
+ if newopts != @trace_opts
+ Tk.tk_call_without_enc('trace', 'vdelete', @id, @trace_opts, 'rb_var')
+=begin
+ if /^(8\.([4-9]|[1-9][0-9])|9\.|[1-9][0-9])/ =~ Tk::TCL_VERSION
+ # TCL_VERSION >= 8.4
+ Tk.tk_call_without_enc('trace', 'remove', 'variable',
+ @id, @trace_opts, 'rb_var')
+ else
+ # TCL_VERSION <= 8.3
+ Tk.tk_call_without_enc('trace', 'vdelete',
+ @id, @trace_opts, 'rb_var')
+ end
+=end
+ @trace_opts.replace(newopts)
+ if @trace_opts != ''
+ Tk.tk_call_without_enc('trace', 'variable', @id, @trace_opts, 'rb_var')
+=begin
+ if /^(8\.([4-9]|[1-9][0-9])|9\.|[1-9][0-9])/ =~ Tk::TCL_VERSION
+ # TCL_VERSION >= 8.4
+ Tk.tk_call_without_enc('trace', 'add', 'variable',
+ @id, @trace_opts, 'rb_var')
+ else
+ # TCL_VERSION <= 8.3
+ Tk.tk_call_without_enc('trace', 'variable',
+ @id, @trace_opts, 'rb_var')
+ end
+=end
+ end
+ end
+
+ self
+ end
+
+ def trace_vdelete_for_element(elem,opts,cmd)
+ return self unless @trace_elem.kind_of? Hash
+ return self unless @trace_elem[elem].kind_of? Array
+ opts = ['r','w','u'].find_all{|c| opts.index(c)}.join('')
+ idx = -1
+ @trace_elem[elem].each_with_index{|e,i|
+ if idx < 0 && e[0] == opts && e[1] == cmd
+ idx = i
+ next
+ end
+ }
+ if idx >= 0
+ @trace_elem[elem].delete_at(idx)
+ else
+ return self
+ end
+
+ newopts = ''
+ @trace_var.each{|e|
+ e[0].each_byte{|c| newopts += c.chr unless newopts.index(c)}
+ }
+ @trace_elem.each{|elem|
+ @trace_elem[elem].each{|e|
+ e[0].each_byte{|c| newopts += c.chr unless newopts.index(c)}
+ }
+ }
+
+ newopts = ['r','w','u'].find_all{|c| newopts.index(c)}.join('')
+ if newopts != @trace_opts
+ Tk.tk_call_without_enc('trace', 'vdelete', @id, @trace_opts, 'rb_var')
+=begin
+ if /^(8\.([4-9]|[1-9][0-9])|9\.|[1-9][0-9])/ =~ Tk::TCL_VERSION
+ # TCL_VERSION >= 8.4
+ Tk.tk_call_without_enc('trace', 'remove', 'variable',
+ @id, @trace_opts, 'rb_var')
+ else
+ # TCL_VERSION <= 8.3
+ Tk.tk_call_without_enc('trace', 'vdelete',
+ @id, @trace_opts, 'rb_var')
+ end
+=end
+ @trace_opts.replace(newopts)
+ if @trace_opts != ''
+ Tk.tk_call_without_enc('trace', 'variable', @id, @trace_opts, 'rb_var')
+=begin
+ if /^(8\.([4-9]|[1-9][0-9])|9\.|[1-9][0-9])/ =~ Tk::TCL_VERSION
+ # TCL_VERSION >= 8.4
+ Tk.tk_call_without_enc('trace', 'add', 'variable',
+ @id, @trace_opts, 'rb_var')
+ else
+ # TCL_VERSION <= 8.3
+ Tk.tk_call_without_enc('trace', 'variable', @id,
+ @trace_opts, 'rb_var')
+ end
+=end
+ end
+ end
+
+ self
+ end
+end
+
+
+class TkVarAccess<TkVariable
+ def self.new(name, *args)
+ return TkVar_ID_TBL[name] if TkVar_ID_TBL[name]
+ super(name, *args)
+ end
+
+ def initialize(varname, val=nil)
+ @id = varname
+ TkVar_ID_TBL[@id] = self
+
+ # teach Tk-ip that @id is global var
+ INTERP._invoke_without_enc('global', @id)
+
+ if val
+ #s = '"' + _get_eval_string(val).gsub(/[\[\]$"]/, '\\\\\&') + '"' #"
+ #s = '"' + _get_eval_string(val).gsub(/[\[\]$"\\]/, '\\\\\&') + '"' #"
+ #INTERP._eval(Kernel.format('global %s; set %s %s', @id, @id, s))
+ #INTERP._set_global_var(@id, _toUTF8(_get_eval_string(val)))
+ self.value = val
+ end
+ end
+end
+
+
+module Tk
+ begin
+ auto_path = INTERP._invoke('set', 'auto_path')
+ rescue
+ begin
+ auto_path = INTERP._invoke('set', 'env(TCLLIBPATH)')
+ rescue
+ auto_path = Tk::LIBRARY
+ end
+ end
+
+ AUTO_PATH = TkVarAccess.new('auto_path', auto_path)
+
+=begin
+ AUTO_OLDPATH = tk_split_simplelist(INTERP._invoke('set', 'auto_oldpath'))
+ AUTO_OLDPATH.each{|s| s.freeze}
+ AUTO_OLDPATH.freeze
+=end
+
+ TCL_PACKAGE_PATH = TkVarAccess.new('tcl_pkgPath')
+ PACKAGE_PATH = TCL_PACKAGE_PATH
+
+ TCL_LIBRARY_PATH = TkVarAccess.new('tcl_libPath')
+ LIBRARY_PATH = TCL_LIBRARY_PATH
+
+ TCL_PRECISION = TkVarAccess.new('tcl_precision')
+end
diff --git a/ext/tk/lib/tk/virtevent.rb b/ext/tk/lib/tk/virtevent.rb
new file mode 100644
index 0000000000..bb95ed2421
--- /dev/null
+++ b/ext/tk/lib/tk/virtevent.rb
@@ -0,0 +1,89 @@
+#
+# tk/virtevent.rb : treats virtual events
+# 1998/07/16 by Hidetoshi Nagai <nagai@ai.kyutech.ac.jp>
+#
+require 'tk'
+
+class TkVirtualEvent<TkObject
+ extend Tk
+
+ TkCommandNames = ['event'.freeze].freeze
+
+ TkVirtualEventID = ["<VirtEvent".freeze, "00000".taint, ">".freeze].freeze
+ TkVirtualEventTBL = TkCore::INTERP.create_table
+
+ TkCore::INTERP.init_ip_env{ TkVirtualEventTBL.clear }
+
+ class PreDefVirtEvent<self
+ def initialize(event)
+ @path = @id = event
+ TkVirtualEvent::TkVirtualEventTBL[@id] = self
+ end
+ end
+
+ def TkVirtualEvent.getobj(event)
+ obj = TkVirtualEventTBL[event]
+ if obj
+ obj
+ else
+ if tk_call_without_enc('event', 'info').index("<#{event}>")
+ PreDefVirtEvent.new(event)
+ else
+ fail ArgumentError, "undefined virtual event '<#{event}>'"
+ end
+ end
+ end
+
+ def TkVirtualEvent.info
+ tk_call_without_enc('event', 'info').split(/\s+/).collect!{|seq|
+ TkVirtualEvent.getobj(seq[1..-2])
+ }
+ end
+
+ def initialize(*sequences)
+ @path = @id = TkVirtualEventID.join('')
+ TkVirtualEventID[1].succ!
+ add(*sequences)
+ end
+
+ def add(*sequences)
+ if sequences != []
+ tk_call_without_enc('event', 'add', "<#{@id}>",
+ *(sequences.collect{|seq|
+ "<#{tk_event_sequence(seq)}>"
+ }) )
+ TkVirtualEventTBL[@id] = self
+ end
+ self
+ end
+
+ def delete(*sequences)
+ if sequences == []
+ tk_call_without_enc('event', 'delete', "<#{@id}>")
+ TkVirtualEventTBL.delete(@id)
+ else
+ tk_call_without_enc('event', 'delete', "<#{@id}>",
+ *(sequences.collect{|seq|
+ "<#{tk_event_sequence(seq)}>"
+ }) )
+ TkVirtualEventTBL.delete(@id) if info == []
+ end
+ self
+ end
+
+ def info
+ tk_call_without_enc('event','info',"<#{@id}>").split(/\s+/).collect!{|seq|
+ l = seq.scan(/<*[^<>]+>*/).collect!{|subseq|
+ case (subseq)
+ when /^<<[^<>]+>>$/
+ TkVirtualEvent.getobj(subseq[1..-2])
+ when /^<[^<>]+>$/
+ subseq[1..-2]
+ else
+ subseq.split('')
+ end
+ }.flatten
+ (l.size == 1) ? l[0] : l
+ }
+ end
+end
diff --git a/ext/tk/lib/tk/winfo.rb b/ext/tk/lib/tk/winfo.rb
new file mode 100644
index 0000000000..a3ce2b2cd2
--- /dev/null
+++ b/ext/tk/lib/tk/winfo.rb
@@ -0,0 +1,384 @@
+#
+# tk/winfo.rb : methods for winfo command
+#
+require 'tk'
+
+module TkWinfo
+ include Tk
+ extend Tk
+
+ TkCommandNames = ['winfo'.freeze].freeze
+
+ def TkWinfo.atom(name, win=nil)
+ if 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)))
+ end
+ end
+ def winfo_atom(name)
+ TkWinfo.atom(name, self)
+ end
+
+ def TkWinfo.atomname(id, win=nil)
+ if win
+ _fromUTF8(tk_call_without_enc('winfo', 'atomname',
+ '-displayof', win, id))
+ else
+ _fromUTF8(tk_call_without_enc('winfo', 'atomname', id))
+ end
+ end
+ def winfo_atomname(id)
+ TkWinfo.atomname(id, self)
+ end
+
+ def TkWinfo.cells(window)
+ number(tk_call_without_enc('winfo', 'cells', window))
+ end
+ def winfo_cells
+ TkWinfo.cells self
+ end
+
+ def TkWinfo.children(window)
+ list(tk_call_without_enc('winfo', 'children', window))
+ end
+ def winfo_children
+ TkWinfo.children self
+ end
+
+ def TkWinfo.classname(window)
+ tk_call_without_enc('winfo', 'class', window)
+ end
+ def winfo_classname
+ TkWinfo.classname self
+ end
+ alias winfo_class winfo_classname
+
+ def TkWinfo.colormapfull(window)
+ bool(tk_call_without_enc('winfo', 'colormapfull', window))
+ end
+ def winfo_colormapfull
+ TkWinfo.colormapfull self
+ end
+
+ def TkWinfo.containing(rootX, rootY, win=nil)
+ if win
+ window(tk_call_without_enc('winfo', 'containing',
+ '-displayof', win, rootX, rootY))
+ else
+ window(tk_call_without_enc('winfo', 'containing', rootX, rootY))
+ end
+ end
+ def winfo_containing(x, y)
+ TkWinfo.containing(x, y, self)
+ end
+
+ def TkWinfo.depth(window)
+ number(tk_call_without_enc('winfo', 'depth', window))
+ end
+ def winfo_depth
+ TkWinfo.depth self
+ end
+
+ def TkWinfo.exist?(window)
+ bool(tk_call_without_enc('winfo', 'exists', window))
+ end
+ def winfo_exist?
+ TkWinfo.exist? self
+ end
+
+ def TkWinfo.fpixels(window, dist)
+ number(tk_call_without_enc('winfo', 'fpixels', window, dist))
+ end
+ def winfo_fpixels(dist)
+ TkWinfo.fpixels self, dist
+ end
+
+ def TkWinfo.geometry(window)
+ tk_call_without_enc('winfo', 'geometry', window)
+ end
+ def winfo_geometry
+ TkWinfo.geometry self
+ end
+
+ def TkWinfo.height(window)
+ number(tk_call_without_enc('winfo', 'height', window))
+ end
+ def winfo_height
+ TkWinfo.height self
+ end
+
+ def TkWinfo.id(window)
+ tk_call_without_enc('winfo', 'id', window)
+ end
+ def winfo_id
+ TkWinfo.id self
+ end
+
+ def TkWinfo.interps(window=nil)
+ if window
+ tk_split_simplelist(tk_call_without_enc('winfo', 'interps',
+ '-displayof', window))
+ else
+ tk_split_simplelist(tk_call_without_enc('winfo', 'interps'))
+ end
+ end
+ def winfo_interps
+ TkWinfo.interps self
+ end
+
+ def TkWinfo.mapped?(window)
+ bool(tk_call_without_enc('winfo', 'ismapped', window))
+ end
+ def winfo_mapped?
+ TkWinfo.mapped? self
+ end
+
+ def TkWinfo.manager(window)
+ tk_call_without_enc('winfo', 'manager', window)
+ end
+ def winfo_manager
+ TkWinfo.manager self
+ end
+
+ def TkWinfo.appname(window)
+ tk_call('winfo', 'name', window)
+ end
+ def winfo_appname
+ TkWinfo.appname self
+ end
+
+ def TkWinfo.parent(window)
+ window(tk_call_without_enc('winfo', 'parent', window))
+ end
+ def winfo_parent
+ TkWinfo.parent self
+ end
+
+ def TkWinfo.widget(id, win=nil)
+ if win
+ window(tk_call_without_enc('winfo', 'pathname', '-displayof', win, id))
+ else
+ window(tk_call_without_enc('winfo', 'pathname', id))
+ end
+ end
+ def winfo_widget(id)
+ TkWinfo.widget id, self
+ end
+
+ def TkWinfo.pixels(window, dist)
+ number(tk_call_without_enc('winfo', 'pixels', window, dist))
+ end
+ def winfo_pixels(dist)
+ TkWinfo.pixels self, dist
+ end
+
+ def TkWinfo.reqheight(window)
+ number(tk_call_without_enc('winfo', 'reqheight', window))
+ end
+ def winfo_reqheight
+ TkWinfo.reqheight self
+ end
+
+ def TkWinfo.reqwidth(window)
+ number(tk_call_without_enc('winfo', 'reqwidth', window))
+ end
+ def winfo_reqwidth
+ TkWinfo.reqwidth self
+ end
+
+ def TkWinfo.rgb(window, color)
+ list(tk_call_without_enc('winfo', 'rgb', window, color))
+ end
+ def winfo_rgb(color)
+ TkWinfo.rgb self, color
+ end
+
+ def TkWinfo.rootx(window)
+ number(tk_call_without_enc('winfo', 'rootx', window))
+ end
+ def winfo_rootx
+ TkWinfo.rootx self
+ end
+
+ def TkWinfo.rooty(window)
+ number(tk_call_without_enc('winfo', 'rooty', window))
+ end
+ def winfo_rooty
+ TkWinfo.rooty self
+ end
+
+ def TkWinfo.screen(window)
+ tk_call('winfo', 'screen', window)
+ end
+ def winfo_screen
+ TkWinfo.screen self
+ end
+
+ def TkWinfo.screencells(window)
+ number(tk_call_without_enc('winfo', 'screencells', window))
+ end
+ def winfo_screencells
+ TkWinfo.screencells self
+ end
+
+ def TkWinfo.screendepth(window)
+ number(tk_call_without_enc('winfo', 'screendepth', window))
+ end
+ def winfo_screendepth
+ TkWinfo.screendepth self
+ end
+
+ def TkWinfo.screenheight (window)
+ number(tk_call_without_enc('winfo', 'screenheight', window))
+ end
+ def winfo_screenheight
+ TkWinfo.screenheight self
+ end
+
+ def TkWinfo.screenmmheight(window)
+ number(tk_call_without_enc('winfo', 'screenmmheight', window))
+ end
+ def winfo_screenmmheight
+ TkWinfo.screenmmheight self
+ end
+
+ def TkWinfo.screenmmwidth(window)
+ number(tk_call_without_enc('winfo', 'screenmmwidth', window))
+ end
+ def winfo_screenmmwidth
+ TkWinfo.screenmmwidth self
+ end
+
+ def TkWinfo.screenvisual(window)
+ tk_call_without_enc('winfo', 'screenvisual', window)
+ end
+ def winfo_screenvisual
+ TkWinfo.screenvisual self
+ end
+
+ def TkWinfo.screenwidth(window)
+ number(tk_call_without_enc('winfo', 'screenwidth', window))
+ end
+ def winfo_screenwidth
+ TkWinfo.screenwidth self
+ end
+
+ def TkWinfo.server(window)
+ tk_call('winfo', 'server', window)
+ end
+ def winfo_server
+ TkWinfo.server self
+ end
+
+ def TkWinfo.toplevel(window)
+ window(tk_call_without_enc('winfo', 'toplevel', window))
+ end
+ def winfo_toplevel
+ TkWinfo.toplevel self
+ end
+
+ def TkWinfo.visual(window)
+ tk_call_without_enc('winfo', 'visual', window)
+ end
+ def winfo_visual
+ TkWinfo.visual self
+ end
+
+ def TkWinfo.visualid(window)
+ tk_call_without_enc('winfo', 'visualid', window)
+ end
+ def winfo_visualid
+ TkWinfo.visualid self
+ end
+
+ def TkWinfo.visualsavailable(window, includeids=false)
+ if includeids
+ list(tk_call_without_enc('winfo', 'visualsavailable',
+ window, "includeids"))
+ else
+ list(tk_call_without_enc('winfo', 'visualsavailable', window))
+ end
+ end
+ def winfo_visualsavailable(includeids=false)
+ TkWinfo.visualsavailable self, includeids
+ end
+
+ def TkWinfo.vrootheight(window)
+ number(tk_call_without_enc('winfo', 'vrootheight', window))
+ end
+ def winfo_vrootheight
+ TkWinfo.vrootheight self
+ end
+
+ def TkWinfo.vrootwidth(window)
+ number(tk_call_without_enc('winfo', 'vrootwidth', window))
+ end
+ def winfo_vrootwidth
+ TkWinfo.vrootwidth self
+ end
+
+ def TkWinfo.vrootx(window)
+ number(tk_call_without_enc('winfo', 'vrootx', window))
+ end
+ def winfo_vrootx
+ TkWinfo.vrootx self
+ end
+
+ def TkWinfo.vrooty(window)
+ number(tk_call_without_enc('winfo', 'vrooty', window))
+ end
+ def winfo_vrooty
+ TkWinfo.vrooty self
+ end
+
+ def TkWinfo.width(window)
+ number(tk_call_without_enc('winfo', 'width', window))
+ end
+ def winfo_width
+ TkWinfo.width self
+ end
+
+ def TkWinfo.x(window)
+ number(tk_call_without_enc('winfo', 'x', window))
+ end
+ def winfo_x
+ TkWinfo.x self
+ end
+
+ def TkWinfo.y(window)
+ number(tk_call_without_enc('winfo', 'y', window))
+ end
+ def winfo_y
+ TkWinfo.y self
+ end
+
+ def TkWinfo.viewable(window)
+ bool(tk_call_without_enc('winfo', 'viewable', window))
+ end
+ def winfo_viewable
+ TkWinfo.viewable self
+ end
+
+ def TkWinfo.pointerx(window)
+ number(tk_call_without_enc('winfo', 'pointerx', window))
+ end
+ def winfo_pointerx
+ TkWinfo.pointerx self
+ end
+
+ def TkWinfo.pointery(window)
+ number(tk_call_without_enc('winfo', 'pointery', window))
+ end
+ def winfo_pointery
+ TkWinfo.pointery self
+ end
+
+ def TkWinfo.pointerxy(window)
+ list(tk_call_without_enc('winfo', 'pointerxy', window))
+ end
+ def winfo_pointerxy
+ TkWinfo.pointerxy self
+ end
+end
diff --git a/ext/tk/lib/tk/winpkg.rb b/ext/tk/lib/tk/winpkg.rb
new file mode 100644
index 0000000000..1d7d473387
--- /dev/null
+++ b/ext/tk/lib/tk/winpkg.rb
@@ -0,0 +1,136 @@
+#
+# tk/winpkg.rb : methods for Tcl/Tk packages for Microsoft Windows
+# 2000/11/22 by Hidetoshi Nagai <nagai@ai.kyutech.ac.jp>
+#
+# ATTENTION !!
+# This is NOT TESTED. Because I have no test-environment.
+#
+require 'tk'
+
+module TkWinDDE
+ extend Tk
+ extend TkWinDDE
+
+ TkCommandNames = ['dde'.freeze].freeze
+
+ if self.const_defined? :FORCE_VERSION
+ tk_call_without_enc('package', 'require', 'dde', FORCE_VERSION)
+ else
+ tk_call_without_enc('package', 'require', 'dde')
+ end
+
+ def servername(topic=None)
+ tk_call('dde', 'servername', topic)
+ end
+ def servername(*args)
+ if args.size == 0
+ tk_call('dde', 'servername')
+ else
+ if args[-1].kind_of?(Hash)
+ keys = _symbolkey2str(args.pop)
+ force = (keys.delete('force'))? '-force': None
+ exact = (keys.delete('exact'))? '-exact': None
+ if keys.size == 0
+ tk_call('dde', 'servername', force, exact)
+ elsif args.size == 0
+ tk_call('dde', 'servername', force, exact, *hash_kv(keys))
+ else
+ tk_call('dde', 'servername', force, exact,
+ *((hash_kv(keys) << '--') + args))
+ end
+ end
+ end
+ end
+
+ def execute(service, topic, data)
+ tk_call('dde', 'execute', service, topic, data)
+ end
+
+ def async_execute(service, topic, data)
+ tk_call('dde', '-async', 'execute', service, topic, data)
+ end
+
+ def poke(service, topic, item, data)
+ tk_call('dde', 'poke', service, topic, item, data)
+ end
+
+ def request(service, topic, item)
+ tk_call('dde', 'request', service, topic, item)
+ end
+
+ def binary_request(service, topic, item)
+ tk_call('dde', 'request', '-binary', service, topic, item)
+ end
+
+ def services(service, topic)
+ tk_call('dde', 'services', service, topic)
+ end
+
+ def eval(topic, cmd, *args)
+ tk_call('dde', 'eval', topic, cmd, *args)
+ end
+
+ def async_eval(topic, cmd, *args)
+ tk_call('dde', 'eval', -async, topic, cmd, *args)
+ end
+
+ module_function :servername, :execute, :async_execute,
+ :poke, :request, :services, :eval
+end
+
+module TkWinRegistry
+ extend Tk
+ extend TkWinRegistry
+
+ TkCommandNames = ['registry'.freeze].freeze
+
+ if self.const_defined? :FORCE_VERSION
+ tk_call('package', 'require', 'registry', FORCE_VERSION)
+ else
+ tk_call('package', 'require', 'registry')
+ end
+
+ def broadcast(keynam, timeout=nil)
+ if timeout
+ tk_call('registry', 'broadcast', keynam, '-timeout', timeout)
+ else
+ tk_call('registry', 'broadcast', keynam)
+ end
+ end
+
+ def delete(keynam, valnam=None)
+ tk_call('registry', 'delete', keynam, valnam)
+ end
+
+ def get(keynam, valnam)
+ tk_call('registry', 'get', keynam, valnam)
+ end
+
+ def keys(keynam, pattern=nil)
+ lst = tk_split_simplelist(tk_call('registry', 'keys', keynam))
+ if pattern
+ lst.find_all{|key| key =~ pattern}
+ else
+ lst
+ end
+ end
+
+ def set(keynam, valnam=None, data=None, dattype=None)
+ tk_call('registry', 'set', keynam, valnam, data, dattype)
+ end
+
+ def type(keynam, valnam)
+ tk_call('registry', 'type', keynam, valnam)
+ end
+
+ def values(keynam, pattern=nil)
+ lst = tk_split_simplelist(tk_call('registry', 'values', keynam))
+ if pattern
+ lst.find_all{|val| val =~ pattern}
+ else
+ lst
+ end
+ end
+
+ module_function :delete, :get, :keys, :set, :type, :values
+end
diff --git a/ext/tk/lib/tk/wm.rb b/ext/tk/lib/tk/wm.rb
new file mode 100644
index 0000000000..2467656837
--- /dev/null
+++ b/ext/tk/lib/tk/wm.rb
@@ -0,0 +1,247 @@
+#
+# tk/wm.rb : methods for wm command
+#
+require 'tk'
+
+module Tk
+ module Wm
+ include TkComm
+
+ TkCommandNames = ['wm'.freeze].freeze
+
+ def aspect(*args)
+ if args.length == 0
+ list(tk_call_without_enc('wm', 'aspect', path))
+ else
+ tk_call('wm', 'aspect', path, *args)
+ self
+ end
+ end
+ def attributes(slot=nil,value=None)
+ if slot == nil
+ lst = tk_split_list(tk_call('wm', 'attributes', path))
+ info = {}
+ while key = lst.shift
+ info[key[1..-1]] = lst.shift
+ end
+ info
+ elsif slot.kind_of? Hash
+ tk_call('wm', 'attributes', path, *hash_kv(slot))
+ self
+ elsif value == None
+ tk_call('wm', 'attributes', path, "-#{slot}")
+ else
+ tk_call('wm', 'attributes', path, "-#{slot}", value)
+ self
+ end
+ end
+ def client(name=None)
+ if name == None
+ tk_call('wm', 'client', path)
+ else
+ name = '' if name == nil
+ tk_call('wm', 'client', path, name)
+ self
+ end
+ end
+ def colormapwindows(*args)
+ if args.size == 0
+ list(tk_call_without_enc('wm', 'colormapwindows', path))
+ else
+ tk_call_without_enc('wm', 'colormapwindows', path, *args)
+ self
+ end
+ end
+ def wm_command(value=nil)
+ if value
+ tk_call('wm', 'command', path, value)
+ self
+ else
+ #procedure(tk_call('wm', 'command', path))
+ tk_call('wm', 'command', path)
+ end
+ end
+ def deiconify(ex = true)
+ tk_call_without_enc('wm', 'deiconify', path) if ex
+ self
+ end
+ def focusmodel(mode = nil)
+ if mode
+ tk_call_without_enc('wm', 'focusmodel', path, mode)
+ self
+ else
+ tk_call_without_enc('wm', 'focusmodel', path)
+ end
+ end
+ def frame
+ tk_call_without_enc('wm', 'frame', path)
+ end
+ def geometry(geom=nil)
+ if geom
+ tk_call_without_enc('wm', 'geometry', path, geom)
+ self
+ else
+ tk_call_without_enc('wm', 'geometry', path)
+ end
+ end
+ def wm_grid(*args)
+ if args.size == 0
+ list(tk_call_without_enc('wm', 'grid', path))
+ else
+ tk_call_without_enc('wm', 'grid', path, *args)
+ self
+ end
+ end
+ def group(leader = nil)
+ if leader
+ tk_call('wm', 'group', path, leader)
+ self
+ else
+ window(tk_call('wm', 'group', path))
+ end
+ end
+ def iconbitmap(bmp=nil)
+ if bmp
+ tk_call_without_enc('wm', 'iconbitmap', path, bmp)
+ self
+ else
+ image_obj(tk_call_without_enc('wm', 'iconbitmap', path))
+ end
+ end
+ def iconify(ex = true)
+ tk_call_without_enc('wm', 'iconify', path) if ex
+ self
+ end
+ def iconmask(bmp=nil)
+ if bmp
+ tk_call_without_enc('wm', 'iconmask', path, bmp)
+ self
+ else
+ image_obj(tk_call_without_enc('wm', 'iconmask', path))
+ end
+ end
+ def iconname(name=nil)
+ if name
+ tk_call('wm', 'iconname', path, name)
+ self
+ else
+ tk_call('wm', 'iconname', path)
+ end
+ end
+ def iconposition(*args)
+ if args.size == 0
+ list(tk_call_without_enc('wm', 'iconposition', path))
+ else
+ tk_call_without_enc('wm', 'iconposition', path, *args)
+ self
+ end
+ end
+ def iconwindow(win = nil)
+ if win
+ tk_call_without_enc('wm', 'iconwindow', path, win)
+ self
+ else
+ w = tk_call_without_enc('wm', 'iconwindow', path)
+ (w == '')? nil: window(w)
+ end
+ end
+ def maxsize(*args)
+ if args.size == 0
+ list(tk_call_without_enc('wm', 'maxsize', path))
+ else
+ tk_call_without_enc('wm', 'maxsize', path, *args)
+ self
+ end
+ end
+ def minsize(*args)
+ if args.size == 0
+ list(tk_call_without_enc('wm', 'minsize', path))
+ else
+ tk_call_without_enc('wm', 'minsize', path, *args)
+ self
+ end
+ end
+ def overrideredirect(bool=None)
+ if bool == None
+ bool(tk_call_without_enc('wm', 'overrideredirect', path))
+ else
+ tk_call_without_enc('wm', 'overrideredirect', path, bool)
+ self
+ end
+ end
+ def positionfrom(who=None)
+ if who == None
+ r = tk_call_without_enc('wm', 'positionfrom', path)
+ (r == "")? nil: r
+ else
+ tk_call_without_enc('wm', 'positionfrom', path, who)
+ self
+ end
+ end
+ def protocol(name=nil, cmd=nil)
+ if cmd
+ tk_call_without_enc('wm', 'protocol', path, name, cmd)
+ self
+ elsif name
+ result = tk_call_without_enc('wm', 'protocol', path, name)
+ (result == "")? nil : tk_tcl2ruby(result)
+ else
+ tk_split_simplelist(tk_call_without_enc('wm', 'protocol', path))
+ end
+ end
+ def resizable(*args)
+ if args.length == 0
+ list(tk_call_without_enc('wm', 'resizable', path)).collect{|e| bool(e)}
+ else
+ tk_call_without_enc('wm', 'resizable', path, *args)
+ self
+ end
+ end
+ def sizefrom(who=None)
+ if who == None
+ r = tk_call_without_enc('wm', 'sizefrom', path)
+ (r == "")? nil: r
+ else
+ tk_call_without_enc('wm', 'sizefrom', path, who)
+ self
+ end
+ end
+ def stackorder
+ list(tk_call('wm', 'stackorder', path))
+ end
+ def stackorder_isabove(win)
+ bool(tk_call('wm', 'stackorder', path, 'isabove', win))
+ end
+ def stackorder_isbelow(win)
+ bool(tk_call('wm', 'stackorder', path, 'isbelow', win))
+ end
+ def state(state=nil)
+ if state
+ tk_call_without_enc('wm', 'state', path, state)
+ self
+ else
+ tk_call_without_enc('wm', 'state', path)
+ end
+ end
+ def title(str=nil)
+ if str
+ tk_call('wm', 'title', path, str)
+ self
+ else
+ tk_call('wm', 'title', path)
+ end
+ end
+ def transient(master=nil)
+ if master
+ tk_call_without_enc('wm', 'transient', path, master)
+ self
+ else
+ window(tk_call_without_enc('wm', 'transient', path))
+ end
+ end
+ def withdraw(ex = true)
+ tk_call_without_enc('wm', 'withdraw', path) if ex
+ self
+ end
+ end
+end
diff --git a/ext/tk/lib/tk/xim.rb b/ext/tk/lib/tk/xim.rb
new file mode 100644
index 0000000000..b4dacdc331
--- /dev/null
+++ b/ext/tk/lib/tk/xim.rb
@@ -0,0 +1,122 @@
+#
+# tk/xim.rb : control imput_method
+#
+require 'tk'
+
+module TkXIM
+ include Tk
+ extend Tk
+
+ TkCommandNames = ['imconfigure'.freeze].freeze
+
+ def TkXIM.useinputmethods(value = None, window = nil)
+ if value == None
+ if window
+ bool(tk_call_without_enc('tk', 'useinputmethods',
+ '-displayof', window))
+ else
+ bool(tk_call_without_enc('tk', 'useinputmethods'))
+ end
+ else
+ if window
+ bool(tk_call_without_enc('tk', 'useinputmethods',
+ '-displayof', window, value))
+ else
+ bool(tk_call_without_enc('tk', 'useinputmethods', value))
+ end
+ end
+ end
+
+ def TkXIM.useinputmethods_displayof(window, value = None)
+ TkXIM.useinputmethods(value, window)
+ end
+
+ def TkXIM.caret(window, keys=nil)
+ if keys
+ tk_call_without_enc('tk', 'caret', window, *hash_kv(keys))
+ self
+ else
+ lst = tk_split_list(tk_call_without_enc('tk', 'caret', window))
+ info = {}
+ while key = lst.shift
+ info[key[1..-1]] = lst.shift
+ end
+ info
+ end
+ end
+
+ def TkXIM.configure(window, slot, value=None)
+ begin
+ if /^8\.*/ === Tk::TK_VERSION && JAPANIZED_TK
+ if slot.kind_of? Hash
+ tk_call('imconfigure', window, *hash_kv(slot))
+ else
+ tk_call('imconfigure', window, "-#{slot}", value)
+ end
+ end
+ rescue
+ end
+ end
+
+ def TkXIM.configinfo(window, slot=nil)
+ if TkComm::GET_CONFIGINFOwoRES_AS_ARRAY
+ begin
+ if /^8\.*/ === Tk::TK_VERSION && JAPANIZED_TK
+ if slot
+ conf = tk_split_list(tk_call('imconfigure', window, "-#{slot}"))
+ conf[0] = conf[0][1..-1]
+ conf
+ else
+ tk_split_list(tk_call('imconfigure', window)).collect{|conf|
+ conf[0] = conf[0][1..-1]
+ conf
+ }
+ end
+ else
+ []
+ end
+ rescue
+ []
+ end
+ else # ! TkComm::GET_CONFIGINFOwoRES_AS_ARRAY
+ TkXIM.current_configinfo(window, slot)
+ end
+ end
+
+ def TkXIM.current_configinfo(window, slot=nil)
+ begin
+ if /^8\.*/ === Tk::TK_VERSION && JAPANIZED_TK
+ if slot
+ conf = tk_split_list(tk_call('imconfigure', window, "-#{slot}"))
+ { conf[0][1..-1] => conf[1] }
+ else
+ ret = {}
+ tk_split_list(tk_call('imconfigure', window)).each{|conf|
+ ret[conf[0][1..-1]] = conf[1]
+ }
+ ret
+ end
+ else
+ {}
+ end
+ rescue
+ {}
+ end
+ end
+
+ def useinputmethods(value=None)
+ TkXIM.useinputmethods(value, self)
+ end
+
+ def caret(keys=nil)
+ TkXIM.caret(self, keys=nil)
+ end
+
+ def imconfigure(slot, value=None)
+ TkXIM.configure(self, slot, value)
+ end
+
+ def imconfiginfo(slot=nil)
+ TkXIM.configinfo(self, slot)
+ end
+end
diff --git a/ext/tk/sample/binding_sample.rb b/ext/tk/sample/binding_sample.rb
new file mode 100644
index 0000000000..b98cd66a2e
--- /dev/null
+++ b/ext/tk/sample/binding_sample.rb
@@ -0,0 +1,87 @@
+#!/usr/bin/env ruby
+
+require 'tk'
+
+class Button_clone < TkLabel
+ def initialize(*args)
+ @command = nil
+
+ if args[-1].kind_of?(Hash)
+ keys = _symbolkey2str(args.pop)
+ @command = keys.delete('command')
+
+ keys['highlightthickness'] = 1 unless keys.key?('highlightthickness')
+ keys['padx'] = '3m' unless keys.key?('padx')
+ keys['pady'] = '1m' unless keys.key?('pady')
+ keys['relief'] = 'raised' unless keys.key?('relief')
+
+ args.push(keys)
+ end
+
+ super(*args)
+
+ @press = false
+
+ self.bind('Enter', proc{self.background(self.activebackground)})
+ self.bind('Leave', proc{
+ @press = false
+ self.background(self.highlightbackground)
+ self.relief('raised')
+ })
+
+ self.bind('ButtonPress-1', proc{@press = true; self.relief('sunken')})
+ self.bind('ButtonRelease-1', proc{
+ self.relief('raised')
+ @command.call if @press && @command
+ @press = false
+ })
+ end
+
+ def command(cmd = Proc.new)
+ @command = cmd
+ end
+
+ def invoke
+ if @command
+ @command.call
+ else
+ ''
+ end
+ end
+end
+
+TkLabel.new(:text=><<EOT).pack
+This is a sample of 'event binding'.
+The first button is a normal button widget.
+And the second one is a normal label widget
+but with some bindings like a button widget.
+EOT
+
+lbl = TkLabel.new(:foreground=>'red').pack(:pady=>3)
+
+v = TkVariable.new(0)
+
+TkFrame.new{|f|
+ TkLabel.new(f, :text=>'click count : ').pack(:side=>:left)
+ TkLabel.new(f, :textvariable=>v).pack(:side=>:left)
+}.pack
+
+TkButton.new(:text=>'normal Button widget',
+ :command=>proc{
+ puts 'button is clicked!!'
+ lbl.text 'button is clicked!!'
+ v.numeric += 1
+ }){
+ pack(:fill=>:x, :expand=>true)
+}
+
+Button_clone.new(:text=>'Label with Button binding',
+ :command=>proc{
+ puts 'label is clicked!!'
+ lbl.text 'label is clicked!!'
+ v.numeric += 1
+ }){
+ pack(:fill=>:x, :expand=>true)
+}
+
+Tk.mainloop
diff --git a/ext/tk/sample/bindtag_sample.rb b/ext/tk/sample/bindtag_sample.rb
new file mode 100644
index 0000000000..caf7a2d750
--- /dev/null
+++ b/ext/tk/sample/bindtag_sample.rb
@@ -0,0 +1,127 @@
+#!/usr/bin/env ruby
+require 'tk'
+
+TkLabel.new(:text=><<EOT, :justify=>:left).pack
+This is a sample of bindtags and usage of
+Tk.callback_break/Tk.callback_continue.
+Please check the work of following buttons
+(attend the difference between before/after
+ pressing the bottom button), and see the
+source code.
+EOT
+
+def set_class_bind
+ TkButton.bind('ButtonPress-1',
+ proc{puts 'bind "ButtonPress-1" of TkButton class'})
+ TkButton.bind('ButtonRelease-1',
+ proc{puts 'bind "ButtonRelease-1" of TkButton class'})
+end
+
+# set root binding
+r = TkRoot.new
+r.bind('ButtonPress-1', proc{puts 'bind "ButtonPress-1" of root widget'})
+r.bind('ButtonRelease-1', proc{puts 'bind "ButtonRelease-1" of root widget'})
+
+# set 'all' binding
+TkBindTag::ALL.bind('ButtonPress-1',
+ proc{puts 'bind "ButtonPress-1" of the tag "all"'})
+TkBindTag::ALL.bind('ButtonRelease-1',
+ proc{puts 'bind "ButtonRelease-1" of the tag "all"'})
+
+# create buttons
+b1 = TkButton.new(:text=>'button-1',
+ :command=>proc{puts "command of button-1"}).pack
+b2 = TkButton.new(:text=>'button-2',
+ :command=>proc{puts "command of button-2"}).pack
+b3 = TkButton.new(:text=>'button-3',
+ :command=>proc{puts "command of button-3"}).pack
+b4 = TkButton.new(:text=>'button-4',
+ :command=>proc{puts "command of button-4"}).pack
+b5 = TkButton.new(:text=>'button-5',
+ :command=>proc{puts "command of button-5"}).pack
+
+# set button binding
+b1.bind('ButtonPress-1', proc{puts 'bind "ButtonPress-1" of button-1'})
+b1.bind('ButtonRelease-1', proc{puts 'bind "ButtonRelease-1" of button-1'})
+
+b2.bind('ButtonPress-1', proc{puts 'bind "ButtonPress-1" of button-2'})
+b2.bind('ButtonRelease-1', proc{puts 'bind "ButtonRelease-1" of button-2'})
+
+b3.bind('ButtonPress-1', proc{puts 'bind "ButtonPress-1" of button-3'})
+b3.bind('ButtonRelease-1', proc{puts 'bind "ButtonRelease-1" of button-3'})
+
+b4.bind('ButtonPress-1', proc{puts 'bind "ButtonPress-1" of button-4'})
+b4.bind('ButtonRelease-1', proc{puts 'bind "ButtonRelease-1" of button-4'})
+
+b5.bind('ButtonPress-1', proc{puts 'bind "ButtonPress-1" of button-5'})
+b5.bind('ButtonRelease-1', proc{puts 'bind "ButtonRelease-1" of button-5'})
+
+# create bindtag and set binding
+tag1 = TkBindTag.new
+tag1.bind('ButtonPress-1', proc{puts 'bind "ButtonPress-1" of tag1'})
+tag1.bind('ButtonRelease-1', proc{puts 'bind "ButtonRelease-1" of tag1'})
+
+tag2 = TkBindTag.new
+tag2.bind('ButtonPress-1',
+ proc{
+ puts 'bind "ButtonPress-1" of tag2'
+ puts 'call Tk.callback_continue'
+ Tk.callback_continue
+ puts 'never see this message'
+ })
+tag2.bind('ButtonRelease-1',
+ proc{
+ puts 'bind "ButtonRelease-1" of tag2'
+ puts 'call Tk.callback_continue'
+ Tk.callback_continue
+ puts 'never see this message'
+ })
+
+tag3 = TkBindTag.new
+tag3.bind('ButtonPress-1',
+ proc{
+ puts 'bind "ButtonPress-1" of tag3'
+ puts 'call Tk.callback_break'
+ Tk.callback_break
+ puts 'never see this message'
+ })
+tag3.bind('ButtonRelease-1',
+ proc{
+ puts 'bind "ButtonRelease-1" of tag3'
+ puts 'call Tk.callback_break'
+ Tk.callback_break
+ puts 'never see this message'
+ })
+
+# set bindtags
+p b1.bindtags
+
+tags = b2.bindtags
+tags[2,0] = tag1
+tags[0,0] = tag1
+b2.bindtags(tags)
+p b2.bindtags
+
+tags = b3.bindtags
+tags[2,0] = tag2
+tags[0,0] = tag2
+b3.bindtags(tags)
+p b3.bindtags
+
+tags = b4.bindtags
+tags[2,0] = tag3
+tags[0,0] = tag3
+b4.bindtags(tags)
+p b4.bindtags
+
+b5.bindtags([tag1, TkButton, tag2, b5])
+
+# create button to set button class binding
+TkButton.new(:text=>'set binding to TkButton class',
+ :command=>proc{
+ puts 'call "set_class_bind"'
+ set_class_bind
+ }).pack(:pady=>7)
+
+# start event-loop
+Tk.mainloop
diff --git a/ext/tk/sample/binstr_usage.rb b/ext/tk/sample/binstr_usage.rb
new file mode 100644
index 0000000000..91692856f9
--- /dev/null
+++ b/ext/tk/sample/binstr_usage.rb
@@ -0,0 +1,39 @@
+#!/usr/bin/env ruby
+
+require "tk"
+
+TkMessage.new(:width=>360, :text=><<EOM).pack
+This sample shows how to use a binary sequence between Ruby and Tk. \
+This reads the image data from the file as the binary sequence.
+
+To treat the difference of encodings between on Ruby and on Tk seamlessly, \
+Ruby/Tk converts the encoding of string arguments automatically. \
+I think it is comfortable for users on almost all situations. \
+However, when treats a binary sequence, the convert process makes troubles.
+
+Tk::BinaryString class (subclass of Tk::EncodedString class) is the class \
+to avoid such troubles. Please see the source code of this sample. \
+A Tk::BinaryString instance is used to create the image for the center button.
+EOM
+
+ImgFile=['images','tcllogo.gif'].join(File::Separator)
+
+ph1 = TkPhotoImage.new(:file=>ImgFile)
+p ph1.configinfo
+
+b_str = Tk::BinaryString(IO.read(ImgFile))
+p [b_str, b_str.encoding]
+
+ph2 = TkPhotoImage.new(:data=>b_str)
+p ph2.configinfo
+p ph2.data(:grayscale=>true)
+
+ph3 = TkPhotoImage.new()
+ph3.put(ph2.data(:grayscale=>true))
+
+f = TkFrame.new.pack
+TkButton.new(:parent=>f, :image=>ph1, :command=>proc{exit}).pack(:side=>:left)
+TkButton.new(:parent=>f, :image=>ph2, :command=>proc{exit}).pack(:side=>:left)
+TkButton.new(:parent=>f, :image=>ph3, :command=>proc{exit}).pack(:side=>:left)
+
+Tk.mainloop
diff --git a/ext/tk/sample/btn_with_frame.rb b/ext/tk/sample/btn_with_frame.rb
new file mode 100644
index 0000000000..d04c95a289
--- /dev/null
+++ b/ext/tk/sample/btn_with_frame.rb
@@ -0,0 +1,20 @@
+require 'tk'
+
+class Button_with_Frame < TkButton
+ def create_self(keys)
+ @frame = TkFrame.new('widgetname'=>@path, 'background'=>'yellow')
+ install_win(@path) # create new @path which is a daughter of old @path
+ super(keys)
+ TkPack(@path, :padx=>7, :pady=>7)
+ @epath = @frame.path
+ end
+ def epath
+ @epath
+ end
+end
+
+Button_with_Frame.new(:text=>'QUIT', :command=>proc{exit}) {
+ pack(:padx=>15, :pady=>5)
+}
+
+Tk.mainloop
diff --git a/ext/tk/sample/demos-en/README.1st b/ext/tk/sample/demos-en/README.1st
new file mode 100644
index 0000000000..e031f123d2
--- /dev/null
+++ b/ext/tk/sample/demos-en/README.1st
@@ -0,0 +1,18 @@
+There are Ruby/Tk demo scripts.
+
+Files with '.rb' extension are sub-scripts which are launched 'widget'
+script. Those files don't work independently. Please call them from
+'widget' script.
+
+If you want start some sub-scripts at same time when the launcher
+script tarts, please give the sub-script names as arguments.
+(e.g. /usr/local/bin/ruby widget button.rb entry1.rb text.rb )
+You can ommit '.rb' of the sub-scripts
+(e.g. /usr/local/bin/ruby widget button entry1 text )
+
+If you don't need launcher's main window, give -n option.
+(e.g. /usr/local/bin/ruby widget -n button.rb entry1.rb text.rb )
+
+Others (browse1, hello, and so on) are standalone scripts.
+
+ 2004/04/14 Hidetoshi NAGAI (nagai@ai.kyutech.ac.jp)
diff --git a/ext/tk/sample/demos-en/check2.rb b/ext/tk/sample/demos-en/check2.rb
new file mode 100644
index 0000000000..b01e3ffc93
--- /dev/null
+++ b/ext/tk/sample/demos-en/check2.rb
@@ -0,0 +1,107 @@
+#
+# checkbutton widget demo2 (called by 'widget')
+#
+
+# delete old toplevel widget
+if defined?($check2_demo) && $check2_demo
+ $check2_demo.destroy
+ $check2_demo = nil
+end
+
+# create demo toplevel widget
+$check2_demo = TkToplevel.new {|w|
+ title("Checkbutton Demonstration 2")
+ iconname("check2")
+ positionWindow(w)
+}
+
+# label
+msg = TkLabel.new($check2_demo) {
+ font $font
+ wraplength '4i'
+ justify 'left'
+ text "Four checkbuttons are displayed below. If you click on a button, it will toggle the button's selection state and set a Tcl variable to a value indicating the state of the checkbutton. The first button also follows the state of the other three. If only some of the three are checked, the first button will display the tri-state mode. Click the \"See Variables\" button to see the current values of the variables."
+}
+msg.pack('side'=>'top')
+
+# variable
+safety = TkVariable.new(0)
+wipers = TkVariable.new(0)
+brakes = TkVariable.new(0)
+sober = TkVariable.new(0)
+
+# frame
+TkFrame.new($check2_demo) {|frame|
+ TkGrid(TkFrame.new(frame, :height=>2, :relief=>:sunken, :bd=>2),
+ :columnspan=>4, :row=>0, :sticky=>'ew', :pady=>2)
+ TkGrid('x',
+ TkButton.new(frame, :text=>'See Variables',
+ :image=>$image['view'], :compound=>:left,
+ :command=>proc{
+ showVars($check2_demo,
+ ['safety', safety], ['wipers', wipers],
+ ['brakes', brakes], ['sober', sober])
+ }),
+ TkButton.new(frame, :text=>'See Code',
+ :image=>$image['view'], :compound=>:left,
+ :command=>proc{showCode 'check2'}),
+ TkButton.new(frame, :text=>'Dismiss',
+ :image=>$image['delete'], :compound=>:left,
+ :command=>proc{
+ tmppath = $check2_demo
+ $check2_demo = nil
+ $showVarsWin[tmppath.path] = nil
+ tmppath.destroy
+ }),
+ :padx=>4, :pady=>4)
+ frame.grid_columnconfigure(0, :weight=>1)
+}.pack('side'=>'bottom', 'fill'=>'x')
+
+
+# checkbutton
+TkCheckButton.new($check2_demo, :text=>'Safety Check', :variable=>safety,
+ :relief=>:flat, :onvalue=>'all', :offvalue=>'none',
+ :tristatevalue=>'partial'){
+ pack('side'=>'top', 'pady'=>2, 'anchor'=>'w')
+}
+
+[ TkCheckButton.new($check2_demo, 'text'=>'Wipers OK', 'variable'=>wipers),
+ TkCheckButton.new($check2_demo, 'text'=>'Brakes OK', 'variable'=>brakes),
+ TkCheckButton.new($check2_demo, 'text'=>'Driver Sober', 'variable'=>sober)
+].each{|w|
+ w.relief('flat')
+ w.pack('side'=>'top', 'padx'=>15, 'pady'=>2, 'anchor'=>'w')
+}
+
+# tristate check
+in_check = false
+tristate_check = proc{|n1,n2,op|
+ return if in_check
+
+ in_check = true
+ begin
+ if n1 == safety
+ if safety == 'none'
+ wipers.value = 0
+ brakes.value = 0
+ sober.value = 0
+ elsif safety == 'all'
+ wipers.value = 1
+ brakes.value = 1
+ sober.value = 1
+ end
+ else
+ if wipers == 1 && brakes == 1 && sober == 1
+ safety.value = 'all'
+ elsif wipers == 1 || brakes == 1 || sober == 1
+ safety.value = 'partial'
+ else
+ safety.value = 'none'
+ end
+ end
+ ensure
+ in_check = false
+ end
+}
+
+[wipers, brakes, sober, safety].each{|v| v.trace('w', tristate_check)}
diff --git a/ext/tk/sample/demos-en/floor2.rb b/ext/tk/sample/demos-en/floor2.rb
new file mode 100644
index 0000000000..7e418066d4
--- /dev/null
+++ b/ext/tk/sample/demos-en/floor2.rb
@@ -0,0 +1,1720 @@
+%# floor2.rb
+#
+# This demonstration script creates a canvas widet that displays the
+# floorplan for DEC's Western Research Laboratory.
+#
+# floorDisplay widget demo (called by 'widget')
+#
+
+# floorDisplay2 --
+# Recreate the floorplan display in the canvas given by "w". The
+# floor given by "active" is displayed on top with its office structure
+# visible.
+#
+# Arguments:
+# w - Name of the canvas window.
+# active - Number of active floor (1, 2, or 3).
+
+def floorDisplay2(w,active)
+ return if $activeFloor2 == active
+
+ w.delete('all')
+ $activeFloor2 = active
+
+ # First go through the three floors, displaying the backgrounds for
+ # each floor.
+
+ floor2_bg1(w,$floor2_colors['bg1'],$floor2_colors['outline1'])
+ floor2_bg2(w,$floor2_colors['bg2'],$floor2_colors['outline2'])
+ floor2_bg3(w,$floor2_colors['bg3'],$floor2_colors['outline3'])
+
+ # Raise the background for the active floor so that it's on top.
+
+ w.raise("floor#{active}")
+
+ # Create a dummy item just to mark this point in the display list,
+ # so we can insert highlights here.
+
+ w.create(TkcRectangle,0,100,1,101,'fill'=>'','outline'=>'','tags'=>'marker')
+
+ # Add the walls and labels for the active floor, along with
+ # transparent polygons that define the rooms on the floor.
+ # Make sure that the room polygons are on top.
+
+ $floorLabels2.clear
+ $floorItems2.clear
+ send("floor2_fg#{active}", w, $floor2_colors['offices'])
+ w.raise('room')
+
+ # Offset the floors diagonally from each other.
+
+ w.move('floor1', '2c', '2c')
+ w.move('floor2', '1c', '1c')
+
+ # Create items for the room entry and its label.
+ w.create(TkcWindow, 600, 100, 'anchor'=>'w', 'window'=>$floor2_entry)
+ w.create(TkcText, 600, 100, 'anchor'=>'e', 'text'=>"Room: ")
+ w['scrollregion'] = w.bbox('all')
+end
+
+# newRoom2 --
+# This method is invoked whenever the mouse enters a room
+# in the floorplan. It changes tags so that the current room is
+# highlighted.
+#
+# Arguments:
+# w - The name of the canvas window.
+
+def newRoom2(w)
+ id = w.find_withtag('current')[0]
+ $currentRoom2.value = $floorLabels2[id.id] if id != ""
+ Tk.update(true)
+end
+
+# roomChanged2 --
+# This method is invoked whenever the currentRoom variable changes.
+# It highlights the current room and unhighlights any previous room.
+#
+# Arguments:
+# w - The canvas window displaying the floorplan.
+# args - Not used.
+
+def roomChanged2(w,*args)
+ w.delete('highlight')
+ item = $floorItems2[$currentRoom2.value]
+ return if item == nil
+ new = TkcPolygon.new(w, *(w.coords(item)))
+ new.configure('fill'=>$floor2_colors['active'], 'tags'=>'highlight')
+ w.raise(new, 'marker')
+end
+
+# floor2_bg1 --
+# This method represents part of the floorplan database. When
+# invoked, it instantiates the background information for the first
+# floor.
+#
+# Arguments:
+# w - The canvas window.
+# fill - Fill color to use for the floor's background.
+# outline - Color to use for the floor's outline.
+
+def floor2_bg1(w,fill,outline)
+ w.create(TkcPolygon,347,80,349,82,351,84,353,85,363,92,375,99,386,104,
+ 386,129,398,129,398,162,484,162,484,129,559,129,559,133,725,
+ 133,725,129,802,129,802,389,644,389,644,391,559,391,559,327,
+ 508,327,508,311,484,311,484,278,395,278,395,288,400,288,404,
+ 288,409,290,413,292,418,297,421,302,422,309,421,318,417,325,
+ 411,330,405,332,397,333,344,333,340,334,336,336,335,338,332,
+ 342,331,347,332,351,334,354,336,357,341,359,340,360,335,363,
+ 331,365,326,366,304,366,304,355,258,355,258,387,60,387,60,391,
+ 0,391,0,337,3,337,3,114,8,114,8,25,30,25,30,5,93,5,98,5,104,7,
+ 110,10,116,16,119,20,122,28,123,32,123,68,220,68,220,34,221,
+ 22,223,17,227,13,231,8,236,4,242,2,246,0,260,0,283,1,300,5,
+ 321,14,335,22,348,25,365,29,363,39,358,48,352,56,337,70,
+ 344,76,347,80, 'tags'=>['floor1','bg'], 'fill'=>fill)
+ w.create(TkcLine,386,129,398,129, 'fill'=>outline, 'tags'=>['floor1','bg'])
+ w.create(TkcLine,258,355,258,387, 'fill'=>outline, 'tags'=>['floor1','bg'])
+ w.create(TkcLine,60,387,60,391, 'fill'=>outline, 'tags'=>['floor1','bg'])
+ w.create(TkcLine,0,337,0,391, 'fill'=>outline, 'tags'=>['floor1','bg'])
+ w.create(TkcLine,60,391,0,391, 'fill'=>outline, 'tags'=>['floor1','bg'])
+ w.create(TkcLine,3,114,3,337, 'fill'=>outline, 'tags'=>['floor1','bg'])
+ w.create(TkcLine,258,387,60,387, 'fill'=>outline, 'tags'=>['floor1','bg'])
+ w.create(TkcLine,484,162,398,162, 'fill'=>outline, 'tags'=>['floor1','bg'])
+ w.create(TkcLine,398,162,398,129, 'fill'=>outline, 'tags'=>['floor1','bg'])
+ w.create(TkcLine,484,278,484,311, 'fill'=>outline, 'tags'=>['floor1','bg'])
+ w.create(TkcLine,484,311,508,311, 'fill'=>outline, 'tags'=>['floor1','bg'])
+ w.create(TkcLine,508,327,508,311, 'fill'=>outline, 'tags'=>['floor1','bg'])
+ w.create(TkcLine,559,327,508,327, 'fill'=>outline, 'tags'=>['floor1','bg'])
+ w.create(TkcLine,644,391,559,391, 'fill'=>outline, 'tags'=>['floor1','bg'])
+ w.create(TkcLine,644,389,644,391, 'fill'=>outline, 'tags'=>['floor1','bg'])
+ w.create(TkcLine,559,129,484,129, 'fill'=>outline, 'tags'=>['floor1','bg'])
+ w.create(TkcLine,484,162,484,129, 'fill'=>outline, 'tags'=>['floor1','bg'])
+ w.create(TkcLine,725,133,559,133, 'fill'=>outline, 'tags'=>['floor1','bg'])
+ w.create(TkcLine,559,129,559,133, 'fill'=>outline, 'tags'=>['floor1','bg'])
+ w.create(TkcLine,725,129,802,129, 'fill'=>outline, 'tags'=>['floor1','bg'])
+ w.create(TkcLine,802,389,802,129, 'fill'=>outline, 'tags'=>['floor1','bg'])
+ w.create(TkcLine,3,337,0,337, 'fill'=>outline, 'tags'=>['floor1','bg'])
+ w.create(TkcLine,559,391,559,327, 'fill'=>outline, 'tags'=>['floor1','bg'])
+ w.create(TkcLine,802,389,644,389, 'fill'=>outline, 'tags'=>['floor1','bg'])
+ w.create(TkcLine,725,133,725,129, 'fill'=>outline, 'tags'=>['floor1','bg'])
+ w.create(TkcLine,8,25,8,114, 'fill'=>outline, 'tags'=>['floor1','bg'])
+ w.create(TkcLine,8,114,3,114, 'fill'=>outline, 'tags'=>['floor1','bg'])
+ w.create(TkcLine,30,25,8,25, 'fill'=>outline, 'tags'=>['floor1','bg'])
+ w.create(TkcLine,484,278,395,278, 'fill'=>outline, 'tags'=>['floor1','bg'])
+ w.create(TkcLine,30,25,30,5, 'fill'=>outline, 'tags'=>['floor1','bg'])
+ w.create(TkcLine,93,5,30,5, 'fill'=>outline, 'tags'=>['floor1','bg'])
+ w.create(TkcLine,98,5,93,5, 'fill'=>outline, 'tags'=>['floor1','bg'])
+ w.create(TkcLine,104,7,98,5, 'fill'=>outline, 'tags'=>['floor1','bg'])
+ w.create(TkcLine,110,10,104,7, 'fill'=>outline, 'tags'=>['floor1','bg'])
+ w.create(TkcLine,116,16,110,10, 'fill'=>outline, 'tags'=>['floor1','bg'])
+ w.create(TkcLine,119,20,116,16, 'fill'=>outline, 'tags'=>['floor1','bg'])
+ w.create(TkcLine,122,28,119,20, 'fill'=>outline, 'tags'=>['floor1','bg'])
+ w.create(TkcLine,123,32,122,28, 'fill'=>outline, 'tags'=>['floor1','bg'])
+ w.create(TkcLine,123,68,123,32, 'fill'=>outline, 'tags'=>['floor1','bg'])
+ w.create(TkcLine,220,68,123,68, 'fill'=>outline, 'tags'=>['floor1','bg'])
+ w.create(TkcLine,386,129,386,104, 'fill'=>outline, 'tags'=>['floor1','bg'])
+ w.create(TkcLine,386,104,375,99, 'fill'=>outline, 'tags'=>['floor1','bg'])
+ w.create(TkcLine,375,99,363,92, 'fill'=>outline, 'tags'=>['floor1','bg'])
+ w.create(TkcLine,353,85,363,92, 'fill'=>outline, 'tags'=>['floor1','bg'])
+ w.create(TkcLine,220,68,220,34, 'fill'=>outline, 'tags'=>['floor1','bg'])
+ w.create(TkcLine,337,70,352,56, 'fill'=>outline, 'tags'=>['floor1','bg'])
+ w.create(TkcLine,352,56,358,48, 'fill'=>outline, 'tags'=>['floor1','bg'])
+ w.create(TkcLine,358,48,363,39, 'fill'=>outline, 'tags'=>['floor1','bg'])
+ w.create(TkcLine,363,39,365,29, 'fill'=>outline, 'tags'=>['floor1','bg'])
+ w.create(TkcLine,365,29,348,25, 'fill'=>outline, 'tags'=>['floor1','bg'])
+ w.create(TkcLine,348,25,335,22, 'fill'=>outline, 'tags'=>['floor1','bg'])
+ w.create(TkcLine,335,22,321,14, 'fill'=>outline, 'tags'=>['floor1','bg'])
+ w.create(TkcLine,321,14,300,5, 'fill'=>outline, 'tags'=>['floor1','bg'])
+ w.create(TkcLine,300,5,283,1, 'fill'=>outline, 'tags'=>['floor1','bg'])
+ w.create(TkcLine,283,1,260,0, 'fill'=>outline, 'tags'=>['floor1','bg'])
+ w.create(TkcLine,260,0,246,0, 'fill'=>outline, 'tags'=>['floor1','bg'])
+ w.create(TkcLine,246,0,242,2, 'fill'=>outline, 'tags'=>['floor1','bg'])
+ w.create(TkcLine,242,2,236,4, 'fill'=>outline, 'tags'=>['floor1','bg'])
+ w.create(TkcLine,236,4,231,8, 'fill'=>outline, 'tags'=>['floor1','bg'])
+ w.create(TkcLine,231,8,227,13, 'fill'=>outline, 'tags'=>['floor1','bg'])
+ w.create(TkcLine,223,17,227,13, 'fill'=>outline, 'tags'=>['floor1','bg'])
+ w.create(TkcLine,221,22,223,17, 'fill'=>outline, 'tags'=>['floor1','bg'])
+ w.create(TkcLine,220,34,221,22, 'fill'=>outline, 'tags'=>['floor1','bg'])
+ w.create(TkcLine,340,360,335,363, 'fill'=>outline, 'tags'=>['floor1','bg'])
+ w.create(TkcLine,335,363,331,365, 'fill'=>outline, 'tags'=>['floor1','bg'])
+ w.create(TkcLine,331,365,326,366, 'fill'=>outline, 'tags'=>['floor1','bg'])
+ w.create(TkcLine,326,366,304,366, 'fill'=>outline, 'tags'=>['floor1','bg'])
+ w.create(TkcLine,304,355,304,366, 'fill'=>outline, 'tags'=>['floor1','bg'])
+ w.create(TkcLine,395,288,400,288, 'fill'=>outline, 'tags'=>['floor1','bg'])
+ w.create(TkcLine,404,288,400,288, 'fill'=>outline, 'tags'=>['floor1','bg'])
+ w.create(TkcLine,409,290,404,288, 'fill'=>outline, 'tags'=>['floor1','bg'])
+ w.create(TkcLine,413,292,409,290, 'fill'=>outline, 'tags'=>['floor1','bg'])
+ w.create(TkcLine,418,297,413,292, 'fill'=>outline, 'tags'=>['floor1','bg'])
+ w.create(TkcLine,421,302,418,297, 'fill'=>outline, 'tags'=>['floor1','bg'])
+ w.create(TkcLine,422,309,421,302, 'fill'=>outline, 'tags'=>['floor1','bg'])
+ w.create(TkcLine,421,318,422,309, 'fill'=>outline, 'tags'=>['floor1','bg'])
+ w.create(TkcLine,421,318,417,325, 'fill'=>outline, 'tags'=>['floor1','bg'])
+ w.create(TkcLine,417,325,411,330, 'fill'=>outline, 'tags'=>['floor1','bg'])
+ w.create(TkcLine,411,330,405,332, 'fill'=>outline, 'tags'=>['floor1','bg'])
+ w.create(TkcLine,405,332,397,333, 'fill'=>outline, 'tags'=>['floor1','bg'])
+ w.create(TkcLine,397,333,344,333, 'fill'=>outline, 'tags'=>['floor1','bg'])
+ w.create(TkcLine,344,333,340,334, 'fill'=>outline, 'tags'=>['floor1','bg'])
+ w.create(TkcLine,340,334,336,336, 'fill'=>outline, 'tags'=>['floor1','bg'])
+ w.create(TkcLine,336,336,335,338, 'fill'=>outline, 'tags'=>['floor1','bg'])
+ w.create(TkcLine,335,338,332,342, 'fill'=>outline, 'tags'=>['floor1','bg'])
+ w.create(TkcLine,331,347,332,342, 'fill'=>outline, 'tags'=>['floor1','bg'])
+ w.create(TkcLine,332,351,331,347, 'fill'=>outline, 'tags'=>['floor1','bg'])
+ w.create(TkcLine,334,354,332,351, 'fill'=>outline, 'tags'=>['floor1','bg'])
+ w.create(TkcLine,336,357,334,354, 'fill'=>outline, 'tags'=>['floor1','bg'])
+ w.create(TkcLine,341,359,336,357, 'fill'=>outline, 'tags'=>['floor1','bg'])
+ w.create(TkcLine,341,359,340,360, 'fill'=>outline, 'tags'=>['floor1','bg'])
+ w.create(TkcLine,395,288,395,278, 'fill'=>outline, 'tags'=>['floor1','bg'])
+ w.create(TkcLine,304,355,258,355, 'fill'=>outline, 'tags'=>['floor1','bg'])
+ w.create(TkcLine,347,80,344,76, 'fill'=>outline, 'tags'=>['floor1','bg'])
+ w.create(TkcLine,344,76,337,70, 'fill'=>outline, 'tags'=>['floor1','bg'])
+ w.create(TkcLine,349,82,347,80, 'fill'=>outline, 'tags'=>['floor1','bg'])
+ w.create(TkcLine,351,84,349,82, 'fill'=>outline, 'tags'=>['floor1','bg'])
+ w.create(TkcLine,353,85,351,84, 'fill'=>outline, 'tags'=>['floor1','bg'])
+end
+
+# floor2_bg2 --
+# This method represents part of the floorplan database. When
+# invoked, it instantiates the background information for the first
+# floor.
+#
+# Arguments:
+# w - The canvas window.
+# fill - Fill color to use for the floor's background.
+# outline - Color to use for the floor's outline.
+
+def floor2_bg2(w,fill,outline)
+ w.create(TkcPolygon,559,129,484,129,484,162,398,162,398,129,315,129,
+ 315,133,176,133,176,129,96,129,96,133,3,133,3,339,0,339,0,391,
+ 60,391,60,387,258,387,258,329,350,329,350,311,395,311,395,280,
+ 484,280,484,311,508,311,508,327,558,327,558,391,644,391,644,
+ 367,802,367,802,129,725,129,725,133,559,133,559,129,
+ 'tags'=>['floor2','bg'], 'fill'=>fill)
+ w.create(TkcLine,350,311,350,329, 'fill'=>outline, 'tags'=>['floor2','bg'])
+ w.create(TkcLine,398,129,398,162, 'fill'=>outline, 'tags'=>['floor2','bg'])
+ w.create(TkcLine,802,367,802,129, 'fill'=>outline, 'tags'=>['floor2','bg'])
+ w.create(TkcLine,802,129,725,129, 'fill'=>outline, 'tags'=>['floor2','bg'])
+ w.create(TkcLine,725,133,725,129, 'fill'=>outline, 'tags'=>['floor2','bg'])
+ w.create(TkcLine,559,129,559,133, 'fill'=>outline, 'tags'=>['floor2','bg'])
+ w.create(TkcLine,559,133,725,133, 'fill'=>outline, 'tags'=>['floor2','bg'])
+ w.create(TkcLine,484,162,484,129, 'fill'=>outline, 'tags'=>['floor2','bg'])
+ w.create(TkcLine,559,129,484,129, 'fill'=>outline, 'tags'=>['floor2','bg'])
+ w.create(TkcLine,802,367,644,367, 'fill'=>outline, 'tags'=>['floor2','bg'])
+ w.create(TkcLine,644,367,644,391, 'fill'=>outline, 'tags'=>['floor2','bg'])
+ w.create(TkcLine,644,391,558,391, 'fill'=>outline, 'tags'=>['floor2','bg'])
+ w.create(TkcLine,558,327,558,391, 'fill'=>outline, 'tags'=>['floor2','bg'])
+ w.create(TkcLine,558,327,508,327, 'fill'=>outline, 'tags'=>['floor2','bg'])
+ w.create(TkcLine,508,327,508,311, 'fill'=>outline, 'tags'=>['floor2','bg'])
+ w.create(TkcLine,484,311,508,311, 'fill'=>outline, 'tags'=>['floor2','bg'])
+ w.create(TkcLine,484,280,484,311, 'fill'=>outline, 'tags'=>['floor2','bg'])
+ w.create(TkcLine,398,162,484,162, 'fill'=>outline, 'tags'=>['floor2','bg'])
+ w.create(TkcLine,484,280,395,280, 'fill'=>outline, 'tags'=>['floor2','bg'])
+ w.create(TkcLine,395,280,395,311, 'fill'=>outline, 'tags'=>['floor2','bg'])
+ w.create(TkcLine,258,387,60,387, 'fill'=>outline, 'tags'=>['floor2','bg'])
+ w.create(TkcLine,3,133,3,339, 'fill'=>outline, 'tags'=>['floor2','bg'])
+ w.create(TkcLine,3,339,0,339, 'fill'=>outline, 'tags'=>['floor2','bg'])
+ w.create(TkcLine,60,391,0,391, 'fill'=>outline, 'tags'=>['floor2','bg'])
+ w.create(TkcLine,0,339,0,391, 'fill'=>outline, 'tags'=>['floor2','bg'])
+ w.create(TkcLine,60,387,60,391, 'fill'=>outline, 'tags'=>['floor2','bg'])
+ w.create(TkcLine,258,329,258,387, 'fill'=>outline, 'tags'=>['floor2','bg'])
+ w.create(TkcLine,350,329,258,329, 'fill'=>outline, 'tags'=>['floor2','bg'])
+ w.create(TkcLine,395,311,350,311, 'fill'=>outline, 'tags'=>['floor2','bg'])
+ w.create(TkcLine,398,129,315,129, 'fill'=>outline, 'tags'=>['floor2','bg'])
+ w.create(TkcLine,176,133,315,133, 'fill'=>outline, 'tags'=>['floor2','bg'])
+ w.create(TkcLine,176,129,96,129, 'fill'=>outline, 'tags'=>['floor2','bg'])
+ w.create(TkcLine,3,133,96,133, 'fill'=>outline, 'tags'=>['floor2','bg'])
+ w.create(TkcLine,315,133,315,129, 'fill'=>outline, 'tags'=>['floor2','bg'])
+ w.create(TkcLine,176,133,176,129, 'fill'=>outline, 'tags'=>['floor2','bg'])
+ w.create(TkcLine,96,133,96,129, 'fill'=>outline, 'tags'=>['floor2','bg'])
+end
+
+# floor2_bg3 --
+# This method represents part of the floorplan database. When
+# invoked, it instantiates the background information for the first
+# floor.
+#
+# Arguments:
+# w - The canvas window.
+# fill - Fill color to use for the floor's background.
+# outline - Color to use for the floor's outline.
+
+def floor2_bg3(w,fill,outline)
+ w.create(TkcPolygon,159,300,107,300,107,248,159,248,159,129,96,129,96,
+ 133,21,133,21,331,0,331,0,391,60,391,60,370,159,370,159,300,
+ 'tags'=>['floor3','bg'], 'fill'=>fill)
+ w.create(TkcPolygon,258,370,258,329,350,329,350,311,399,311,399,129,
+ 315,129,315,133,176,133,176,129,159,129,159,370,258,370,
+ 'tags'=>['floor3','bg'], 'fill'=>fill)
+ w.create(TkcLine,96,133,96,129, 'fill'=>outline, 'tags'=>['floor3','bg'])
+ w.create(TkcLine,176,129,96,129, 'fill'=>outline, 'tags'=>['floor3','bg'])
+ w.create(TkcLine,176,129,176,133, 'fill'=>outline, 'tags'=>['floor3','bg'])
+ w.create(TkcLine,315,133,176,133, 'fill'=>outline, 'tags'=>['floor3','bg'])
+ w.create(TkcLine,315,133,315,129, 'fill'=>outline, 'tags'=>['floor3','bg'])
+ w.create(TkcLine,399,129,315,129, 'fill'=>outline, 'tags'=>['floor3','bg'])
+ w.create(TkcLine,399,311,399,129, 'fill'=>outline, 'tags'=>['floor3','bg'])
+ w.create(TkcLine,399,311,350,311, 'fill'=>outline, 'tags'=>['floor3','bg'])
+ w.create(TkcLine,350,329,350,311, 'fill'=>outline, 'tags'=>['floor3','bg'])
+ w.create(TkcLine,350,329,258,329, 'fill'=>outline, 'tags'=>['floor3','bg'])
+ w.create(TkcLine,258,370,258,329, 'fill'=>outline, 'tags'=>['floor3','bg'])
+ w.create(TkcLine,60,370,258,370, 'fill'=>outline, 'tags'=>['floor3','bg'])
+ w.create(TkcLine,60,370,60,391, 'fill'=>outline, 'tags'=>['floor3','bg'])
+ w.create(TkcLine,60,391,0,391, 'fill'=>outline, 'tags'=>['floor3','bg'])
+ w.create(TkcLine,0,391,0,331, 'fill'=>outline, 'tags'=>['floor3','bg'])
+ w.create(TkcLine,21,331,0,331, 'fill'=>outline, 'tags'=>['floor3','bg'])
+ w.create(TkcLine,21,331,21,133, 'fill'=>outline, 'tags'=>['floor3','bg'])
+ w.create(TkcLine,96,133,21,133, 'fill'=>outline, 'tags'=>['floor3','bg'])
+ w.create(TkcLine,107,300,159,300,159,248,107,248,107,300,
+ 'fill'=>outline, 'tags'=>['floor3','bg'])
+end
+
+# floor2_fg1 --
+# This method represents part of the floorplan database. When
+# invoked, it instantiates the foreground information for the first
+# floor (office outlines and numbers).
+#
+# Arguments:
+# w - The canvas window.
+# color - Color to use for drawing foreground information.
+
+def floor2_fg1(w,color)
+ i = TkcPolygon.new(w,375,246,375,172,341,172,341,246,
+ 'fill'=>'', 'tags'=>['floor1','room'])
+ $floorLabels2[i.id] = '101'
+ $floorItems2['101'] = i
+ w.create(TkcText,358,209, 'text'=>'101', 'fill'=>color,
+ 'anchor'=>'c', 'tags'=>['floor1','label'])
+ i = TkcPolygon.new(w,307,240,339,240,339,206,307,206,
+ 'fill'=>'', 'tags'=>['floor1','room'])
+ $floorLabels2[i.id] = 'Pub Lift1'
+ $floorItems2['Pub Lift1'] = i
+ w.create(TkcText,323,223, 'text'=>'Pub Lift1', 'fill'=>color,
+ 'anchor'=>'c', 'tags'=>['floor1','label'])
+ i = TkcPolygon.new(w,339,205,307,205,307,171,339,171,
+ 'fill'=>'', 'tags'=>['floor1','room'])
+ $floorLabels2[i.id] = 'Priv Lift1'
+ $floorItems2['Priv Lift1'] = i
+ w.create(TkcText,323,188, 'text'=>'Priv Lift1', 'fill'=>color,
+ 'anchor'=>'c', 'tags'=>['floor1','label'])
+ i = TkcPolygon.new(w,42,389,42,337,1,337,1,389,
+ 'fill'=>'', 'tags'=>['floor1','room'])
+ $floorLabels2[i.id] = '110'
+ $floorItems2['110'] = i
+ w.create(TkcText,21.5,363, 'text'=>'110', 'fill'=>color,
+ 'anchor'=>'c', 'tags'=>['floor1','label'])
+ i = TkcPolygon.new(w,59,389,59,385,90,385,90,337,44,337,44,389,
+ 'fill'=>'', 'tags'=>['floor1','room'])
+ $floorLabels2[i.id] = '109'
+ $floorItems2['109'] = i
+ w.create(TkcText,67,363, 'text'=>'109', 'fill'=>color,
+ 'anchor'=>'c', 'tags'=>['floor1','label'])
+ i = TkcPolygon.new(w,51,300,51,253,6,253,6,300,
+ 'fill'=>'', 'tags'=>['floor1','room'])
+ $floorLabels2[i.id] = '111'
+ $floorItems2['111'] = i
+ w.create(TkcText,28.5,276.5, 'text'=>'111', 'fill'=>color,
+ 'anchor'=>'c', 'tags'=>['floor1','label'])
+ i = TkcPolygon.new(w,98,248,98,309,79,309,79,248,
+ 'fill'=>'', 'tags'=>['floor1','room'])
+ $floorLabels2[i.id] = '117B'
+ $floorItems2['117B'] = i
+ w.create(TkcText,88.5,278.5, 'text'=>'117B', 'fill'=>color,
+ 'anchor'=>'c', 'tags'=>['floor1','label'])
+ i = TkcPolygon.new(w,51,251,51,204,6,204,6,251,
+ 'fill'=>'', 'tags'=>['floor1','room'])
+ $floorLabels2[i.id] = '112'
+ $floorItems2['112'] = i
+ w.create(TkcText,28.5,227.5, 'text'=>'112', 'fill'=>color,
+ 'anchor'=>'c', 'tags'=>['floor1','label'])
+ i = TkcPolygon.new(w,6,156,51,156,51,203,6,203,
+ 'fill'=>'', 'tags'=>['floor1','room'])
+ $floorLabels2[i.id] = '113'
+ $floorItems2['113'] = i
+ w.create(TkcText,28.5,179.5, 'text'=>'113', 'fill'=>color,
+ 'anchor'=>'c', 'tags'=>['floor1','label'])
+ i = TkcPolygon.new(w,85,169,79,169,79,192,85,192,
+ 'fill'=>'', 'tags'=>['floor1','room'])
+ $floorLabels2[i.id] = '117A'
+ $floorItems2['117A'] = i
+ w.create(TkcText,82,180.5, 'text'=>'117A', 'fill'=>color,
+ 'anchor'=>'c', 'tags'=>['floor1','label'])
+ i = TkcPolygon.new(w,77,302,77,168,53,168,53,302,
+ 'fill'=>'', 'tags'=>['floor1','room'])
+ $floorLabels2[i.id] = '117'
+ $floorItems2['117'] = i
+ w.create(TkcText,65,235, 'text'=>'117', 'fill'=>color,
+ 'anchor'=>'c', 'tags'=>['floor1','label'])
+ i = TkcPolygon.new(w,51,155,51,115,6,115,6,155,
+ 'fill'=>'', 'tags'=>['floor1','room'])
+ $floorLabels2[i.id] = '114'
+ $floorItems2['114'] = i
+ w.create(TkcText,28.5,135, 'text'=>'114', 'fill'=>color,
+ 'anchor'=>'c', 'tags'=>['floor1','label'])
+ i = TkcPolygon.new(w,95,115,53,115,53,168,95,168,
+ 'fill'=>'', 'tags'=>['floor1','room'])
+ $floorLabels2[i.id] = '115'
+ $floorItems2['115'] = i
+ w.create(TkcText,74,141.5, 'text'=>'115', 'fill'=>color,
+ 'anchor'=>'c', 'tags'=>['floor1','label'])
+ i = TkcPolygon.new(w,87,113,87,27,10,27,10,113,
+ 'fill'=>'', 'tags'=>['floor1','room'])
+ $floorLabels2[i.id] = '116'
+ $floorItems2['116'] = i
+ w.create(TkcText,48.5,70, 'text'=>'116', 'fill'=>color,
+ 'anchor'=>'c', 'tags'=>['floor1','label'])
+ i = TkcPolygon.new(w,89,91,128,91,128,113,89,131,
+ 'fill'=>'', 'tags'=>['floor1','room'])
+ $floorLabels2[i.id] = '118'
+ $floorItems2['118'] = i
+ w.create(TkcText,108.5,102, 'text'=>'118', 'fill'=>color,
+ 'anchor'=>'c', 'tags'=>['floor1','label'])
+ i = TkcPolygon.new(w,178,128,178,132,216,132,216,91,
+ 163,91,163,112,149,112,149,128,
+ 'fill'=>'', 'tags'=>['floor1','room'])
+ $floorLabels2[i.id] = '120'
+ $floorItems2['120'] = i
+ w.create(TkcText,189.5,111.5, 'text'=>'120', 'fill'=>color,
+ 'anchor'=>'c', 'tags'=>['floor1','label'])
+ i = TkcPolygon.new(w,79,193,87,193,87,169,136,169,136,192,
+ 156,192,156,169,175,169,175,246,79,246,
+ 'fill'=>'', 'tags'=>['floor1','room'])
+ $floorLabels2[i.id] = '122'
+ $floorItems2['122'] = i
+ w.create(TkcText,131,207.5, 'text'=>'122', 'fill'=>color,
+ 'anchor'=>'c', 'tags'=>['floor1','label'])
+ i = TkcPolygon.new(w,138,169,154,169,154,191,138,191,
+ 'fill'=>'', 'tags'=>['floor1','room'])
+ $floorLabels2[i.id] = '121'
+ $floorItems2['121'] = i
+ w.create(TkcText,146,180, 'text'=>'121', 'fill'=>color,
+ 'anchor'=>'c', 'tags'=>['floor1','label'])
+ i = TkcPolygon.new(w,99,300,126,300,126,309,99,309,
+ 'fill'=>'', 'tags'=>['floor1','room'])
+ $floorLabels2[i.id] = '106A'
+ $floorItems2['106A'] = i
+ w.create(TkcText,112.5,304.5, 'text'=>'106A', 'fill'=>color,
+ 'anchor'=>'c', 'tags'=>['floor1','label'])
+ i = TkcPolygon.new(w,128,299,128,309,150,309,150,248,99,248,99,299,
+ 'fill'=>'', 'tags'=>['floor1','room'])
+ $floorLabels2[i.id] = '105'
+ $floorItems2['105'] = i
+ w.create(TkcText,124.5,278.5, 'text'=>'105', 'fill'=>color,
+ 'anchor'=>'c', 'tags'=>['floor1','label'])
+ i = TkcPolygon.new(w,174,309,174,300,152,300,152,309,
+ 'fill'=>'', 'tags'=>['floor1','room'])
+ $floorLabels2[i.id] = '106B'
+ $floorItems2['106B'] = i
+ w.create(TkcText,163,304.5, 'text'=>'106B', 'fill'=>color,
+ 'anchor'=>'c', 'tags'=>['floor1','label'])
+ i = TkcPolygon.new(w,176,299,176,309,216,309,216,248,152,248,152,299,
+ 'fill'=>'', 'tags'=>['floor1','room'])
+ $floorLabels2[i.id] = '104'
+ $floorItems2['104'] = i
+ w.create(TkcText,184,278.5, 'text'=>'104', 'fill'=>color,
+ 'anchor'=>'c', 'tags'=>['floor1','label'])
+ i = TkcPolygon.new(w,138,385,138,337,91,337,91,385,
+ 'fill'=>'', 'tags'=>['floor1','room'])
+ $floorLabels2[i.id] = '108'
+ $floorItems2['108'] = i
+ w.create(TkcText,114.5,361, 'text'=>'108', 'fill'=>color,
+ 'anchor'=>'c', 'tags'=>['floor1','label'])
+ i = TkcPolygon.new(w,256,337,140,337,140,385,256,385,
+ 'fill'=>'', 'tags'=>['floor1','room'])
+ $floorLabels2[i.id] = '107'
+ $floorItems2['107'] = i
+ w.create(TkcText,198,361, 'text'=>'107', 'fill'=>color,
+ 'anchor'=>'c', 'tags'=>['floor1','label'])
+ i = TkcPolygon.new(w,300,353,300,329,260,329,260,353,
+ 'fill'=>'', 'tags'=>['floor1','room'])
+ $floorLabels2[i.id] = 'Smoking'
+ $floorItems2['Smoking'] = i
+ w.create(TkcText,280,341, 'text'=>'Smoking', 'fill'=>color,
+ 'anchor'=>'c', 'tags'=>['floor1','label'])
+ i = TkcPolygon.new(w,314,135,314,170,306,170,306,246,177,246,177,135,
+ 'fill'=>'', 'tags'=>['floor1','room'])
+ $floorLabels2[i.id] = '123'
+ $floorItems2['123'] = i
+ w.create(TkcText,245.5,190.5, 'text'=>'123', 'fill'=>color,
+ 'anchor'=>'c', 'tags'=>['floor1','label'])
+ i = TkcPolygon.new(w,217,248,301,248,301,326,257,326,257,310,217,310,
+ 'fill'=>'', 'tags'=>['floor1','room'])
+ $floorLabels2[i.id] = '103'
+ $floorItems2['103'] = i
+ w.create(TkcText,259,287, 'text'=>'103', 'fill'=>color,
+ 'anchor'=>'c', 'tags'=>['floor1','label'])
+ i = TkcPolygon.new(w,396,188,377,188,377,169,316,169,316,131,396,131,
+ 'fill'=>'', 'tags'=>['floor1','room'])
+ $floorLabels2[i.id] = '124'
+ $floorItems2['124'] = i
+ w.create(TkcText,356,150, 'text'=>'124', 'fill'=>color,
+ 'anchor'=>'c', 'tags'=>['floor1','label'])
+ i = TkcPolygon.new(w,397,226,407,226,407,189,377,189,377,246,397,246,
+ 'fill'=>'', 'tags'=>['floor1','room'])
+ $floorLabels2[i.id] = '125'
+ $floorItems2['125'] = i
+ w.create(TkcText,392,217.5, 'text'=>'125', 'fill'=>color,
+ 'anchor'=>'c', 'tags'=>['floor1','label'])
+ i = TkcPolygon.new(w,399,187,409,187,409,207,474,207,474,164,399,164,
+ 'fill'=>'', 'tags'=>['floor1','room'])
+ $floorLabels2[i.id] = '126'
+ $floorItems2['126'] = i
+ w.create(TkcText,436.5,185.5, 'text'=>'126', 'fill'=>color,
+ 'anchor'=>'c', 'tags'=>['floor1','label'])
+ i = TkcPolygon.new(w,409,209,409,229,399,229,399,253,
+ 486,253,486,239,474,239,474,209,
+ 'fill'=>'', 'tags'=>['floor1','room'])
+ $floorLabels2[i.id] = '127'
+ $floorItems2['127'] = i
+ w.create(TkcText,436.5,'231', 'text'=>'127', 'fill'=>color,
+ 'anchor'=>'c', 'tags'=>['floor1','label'])
+ i = TkcPolygon.new(w,501,164,501,174,495,174,495,188,
+ 490,188,490,204,476,204,476,164,
+ 'fill'=>'', 'tags'=>['floor1','room'])
+ $floorLabels2[i.id] = 'MShower'
+ $floorItems2['MShower'] = i
+ w.create(TkcText,488.5,'184', 'text'=>'MShower', 'fill'=>color,
+ 'anchor'=>'c', 'tags'=>['floor1','label'])
+ i = TkcPolygon.new(w,497,176,513,176,513,204,492,204,492,190,497,190,
+ 'fill'=>'', 'tags'=>['floor1','room'])
+ $floorLabels2[i.id] = 'Closet'
+ $floorItems2['Closet'] = i
+ w.create(TkcText,502.5,190, 'text'=>'Closet', 'fill'=>color,
+ 'anchor'=>'c', 'tags'=>['floor1','label'])
+ i = TkcPolygon.new(w,476,237,476,206,513,206,513,254,488,254,488,237,
+ 'fill'=>'', 'tags'=>['floor1','room'])
+ $floorLabels2[i.id] = 'WShower'
+ $floorItems2['WShower'] = i
+ w.create(TkcText,494.5,230, 'text'=>'WShower', 'fill'=>color,
+ 'anchor'=>'c', 'tags'=>['floor1','label'])
+ i = TkcPolygon.new(w,486,131,558,131,558,135,724,135,724,166,
+ 697,166,697,275,553,275,531,254,515,254,
+ 515,174,503,174,503,161,486,161,
+ 'fill'=>'', 'tags'=>['floor1','room'])
+ $floorLabels2[i.id] = '130'
+ $floorItems2['130'] = i
+ w.create(TkcText,638.5,205, 'text'=>'130', 'fill'=>color,
+ 'anchor'=>'c', 'tags'=>['floor1','label'])
+ i = TkcPolygon.new(w,308,242,339,242,339,248,342,248,
+ 342,246,397,246,397,276,393,276,
+ 393,309,300,309,300,248,308,248,
+ 'fill'=>'', 'tags'=>['floor1','room'])
+ $floorLabels2[i.id] = '102'
+ $floorItems2['102'] = i
+ w.create(TkcText,367.5,278.5, 'text'=>'102', 'fill'=>color,
+ 'anchor'=>'c', 'tags'=>['floor1','label'])
+ i = TkcPolygon.new(w,397,255,486,255,486,276,397,276,
+ 'fill'=>'', 'tags'=>['floor1','room'])
+ $floorLabels2[i.id] = '128'
+ $floorItems2['128'] = i
+ w.create(TkcText,441.5,265.5, 'text'=>'128', 'fill'=>color,
+ 'anchor'=>'c', 'tags'=>['floor1','label'])
+ i = TkcPolygon.new(w,510,309,486,309,486,255,530,255,
+ 552,277,561,277,561,325,510,325,
+ 'fill'=>'', 'tags'=>['floor1','room'])
+ $floorLabels2[i.id] = '129'
+ $floorItems2['129'] = i
+ w.create(TkcText,535.5,293, 'text'=>'129', 'fill'=>color,
+ 'anchor'=>'c', 'tags'=>['floor1','label'])
+ i = TkcPolygon.new(w,696,281,740,281,740,387,642,387,
+ 642,389,561,389,561,277,696,277,
+ 'fill'=>'', 'tags'=>['floor1','room'])
+ $floorLabels2[i.id] = '133'
+ $floorItems2['133'] = i
+ w.create(TkcText,628.5,335, 'text'=>'133', 'fill'=>color,
+ 'anchor'=>'c', 'tags'=>['floor1','label'])
+ i = TkcPolygon.new(w,742,387,742,281,800,281,800,387,
+ 'fill'=>'', 'tags'=>['floor1','room'])
+ $floorLabels2[i.id] = '132'
+ $floorItems2['132'] = i
+ w.create(TkcText,771,334, 'text'=>'132', 'fill'=>color,
+ 'anchor'=>'c', 'tags'=>['floor1','label'])
+ i = TkcPolygon.new(w,800,168,800,280,699,280,699,168,
+ 'fill'=>'', 'tags'=>['floor1','room'])
+ $floorLabels2[i.id] = '134'
+ $floorItems2['134'] = i
+ w.create(TkcText,749.5,224, 'text'=>'134', 'fill'=>color,
+ 'anchor'=>'c', 'tags'=>['floor1','label'])
+ i = TkcPolygon.new(w,726,131,726,166,800,166,800,131,
+ 'fill'=>'', 'tags'=>['floor1','room'])
+ $floorLabels2[i.id] = '135'
+ $floorItems2['135'] = i
+ w.create(TkcText,763,148.5, 'text'=>'135', 'fill'=>color,
+ 'anchor'=>'c', 'tags'=>['floor1','label'])
+ i = TkcPolygon.new(w,340,360,335,363,331,365,326,366,304,366,
+ 304,312,396,312,396,288,400,288,404,288,
+ 409,290,413,292,418,297,421,302,422,309,
+ 421,318,417,325,411,330,405,332,397,333,
+ 344,333,340,334,336,336,335,338,332,342,
+ 331,347,332,351,334,354,336,357,341,359,
+ 'fill'=>'', 'tags'=>['floor1','room'])
+ $floorLabels2[i.id] = 'Ramona Stair'
+ $floorItems2['Ramona Stair'] = i
+ w.create(TkcText,368,323, 'text'=>'Ramona Stair', 'fill'=>color,
+ 'anchor'=>'c', 'tags'=>['floor1','label'])
+ i = TkcPolygon.new(w,30,23,30,5,93,5,98,5,104,7,110,10,116,16,119,20,
+ 122,28,123,32,123,68,220,68,220,87,90,87,90,23,
+ 'fill'=>'', 'tags'=>['floor1','room'])
+ $floorLabels2[i.id] = 'University Stair'
+ $floorItems2['University Stair'] = i
+ w.create(TkcText,155,77.5, 'text'=>'University Stair', 'fill'=>color,
+ 'anchor'=>'c', 'tags'=>['floor1','label'])
+ i = TkcPolygon.new(w,282,37,295,40,312,49,323,56,337,70,352,56,
+ 358,48,363,39,365,29,348,25,335,22,321,14,
+ 300,5,283,1,260,0,246,0,242,2,236,4,231,8,
+ 227,13,223,17,221,22,220,34,260,34,
+ 'fill'=>'', 'tags'=>['floor1','room'])
+ $floorLabels2[i.id] = 'Plaza Stair'
+ $floorItems2['Plaza Stair'] = i
+ w.create(TkcText,317.5,28.5, 'text'=>'Plaza Stair', 'fill'=>color,
+ 'anchor'=>'c', 'tags'=>['floor1','label'])
+ i = TkcPolygon.new(w,220,34,260,34,282,37,295,40,312,49,
+ 323,56,337,70,350,83,365,94,377,100,
+ 386,104,386,128,220,128,
+ 'fill'=>'', 'tags'=>['floor1','room'])
+ $floorLabels2[i.id] = 'Plaza Deck'
+ $floorItems2['Plaza Deck'] = i
+ w.create(TkcText,303,81, 'text'=>'Plaza Deck', 'fill'=>color,
+ 'anchor'=>'c', 'tags'=>['floor1','label'])
+ i = TkcPolygon.new(w,257,336,77,336,6,336,6,301,77,301,77,310,257,310,
+ 'fill'=>'', 'tags'=>['floor1','room'])
+ $floorLabels2[i.id] = '106'
+ $floorItems2['106'] = i
+ w.create(TkcText,131.5,318.5, 'text'=>'106', 'fill'=>color,
+ 'anchor'=>'c', 'tags'=>['floor1','label'])
+ i = TkcPolygon.new(w,146,110,162,110,162,91,130,91,130,115,95,115,
+ 95,128,114,128,114,151,157,151,157,153,112,153,
+ 112,130,97,130,97,168,175,168,175,131,146,131,
+ 'fill'=>'', 'tags'=>['floor1','room'])
+ $floorLabels2[i.id] = '119'
+ $floorItems2['119'] = i
+ w.create(TkcText,143.5,133, 'text'=>'119', 'fill'=>color,
+ 'anchor'=>'c', 'tags'=>['floor1','label'])
+ w.create(TkcLine,155,191,155,189, 'fill'=>color, 'tags'=>['floor1','wall'])
+ w.create(TkcLine,155,177,155,169, 'fill'=>color, 'tags'=>['floor1','wall'])
+ w.create(TkcLine,96,129,96,169, 'fill'=>color, 'tags'=>['floor1','wall'])
+ w.create(TkcLine,78,169,176,169, 'fill'=>color, 'tags'=>['floor1','wall'])
+ w.create(TkcLine,176,247,176,129, 'fill'=>color, 'tags'=>['floor1','wall'])
+ w.create(TkcLine,340,206,307,206, 'fill'=>color, 'tags'=>['floor1','wall'])
+ w.create(TkcLine,340,187,340,170, 'fill'=>color, 'tags'=>['floor1','wall'])
+ w.create(TkcLine,340,210,340,201, 'fill'=>color, 'tags'=>['floor1','wall'])
+ w.create(TkcLine,340,247,340,224, 'fill'=>color, 'tags'=>['floor1','wall'])
+ w.create(TkcLine,340,241,307,241, 'fill'=>color, 'tags'=>['floor1','wall'])
+ w.create(TkcLine,376,246,376,170, 'fill'=>color, 'tags'=>['floor1','wall'])
+ w.create(TkcLine,307,247,307,170, 'fill'=>color, 'tags'=>['floor1','wall'])
+ w.create(TkcLine,376,170,307,170, 'fill'=>color, 'tags'=>['floor1','wall'])
+ w.create(TkcLine,315,129,315,170, 'fill'=>color, 'tags'=>['floor1','wall'])
+ w.create(TkcLine,147,129,176,129, 'fill'=>color, 'tags'=>['floor1','wall'])
+ w.create(TkcLine,202,133,176,133, 'fill'=>color, 'tags'=>['floor1','wall'])
+ w.create(TkcLine,398,129,315,129, 'fill'=>color, 'tags'=>['floor1','wall'])
+ w.create(TkcLine,258,352,258,387, 'fill'=>color, 'tags'=>['floor1','wall'])
+ w.create(TkcLine,60,387,60,391, 'fill'=>color, 'tags'=>['floor1','wall'])
+ w.create(TkcLine,0,337,0,391, 'fill'=>color, 'tags'=>['floor1','wall'])
+ w.create(TkcLine,60,391,0,391, 'fill'=>color, 'tags'=>['floor1','wall'])
+ w.create(TkcLine,3,114,3,337, 'fill'=>color, 'tags'=>['floor1','wall'])
+ w.create(TkcLine,258,387,60,387, 'fill'=>color, 'tags'=>['floor1','wall'])
+ w.create(TkcLine,52,237,52,273, 'fill'=>color, 'tags'=>['floor1','wall'])
+ w.create(TkcLine,52,189,52,225, 'fill'=>color, 'tags'=>['floor1','wall'])
+ w.create(TkcLine,52,140,52,177, 'fill'=>color, 'tags'=>['floor1','wall'])
+ w.create(TkcLine,395,306,395,311, 'fill'=>color, 'tags'=>['floor1','wall'])
+ w.create(TkcLine,531,254,398,254, 'fill'=>color, 'tags'=>['floor1','wall'])
+ w.create(TkcLine,475,178,475,238, 'fill'=>color, 'tags'=>['floor1','wall'])
+ w.create(TkcLine,502,162,398,162, 'fill'=>color, 'tags'=>['floor1','wall'])
+ w.create(TkcLine,398,129,398,188, 'fill'=>color, 'tags'=>['floor1','wall'])
+ w.create(TkcLine,383,188,376,188, 'fill'=>color, 'tags'=>['floor1','wall'])
+ w.create(TkcLine,408,188,408,194, 'fill'=>color, 'tags'=>['floor1','wall'])
+ w.create(TkcLine,398,227,398,254, 'fill'=>color, 'tags'=>['floor1','wall'])
+ w.create(TkcLine,408,227,398,227, 'fill'=>color, 'tags'=>['floor1','wall'])
+ w.create(TkcLine,408,222,408,227, 'fill'=>color, 'tags'=>['floor1','wall'])
+ w.create(TkcLine,408,206,408,210, 'fill'=>color, 'tags'=>['floor1','wall'])
+ w.create(TkcLine,408,208,475,208, 'fill'=>color, 'tags'=>['floor1','wall'])
+ w.create(TkcLine,484,278,484,311, 'fill'=>color, 'tags'=>['floor1','wall'])
+ w.create(TkcLine,484,311,508,311, 'fill'=>color, 'tags'=>['floor1','wall'])
+ w.create(TkcLine,508,327,508,311, 'fill'=>color, 'tags'=>['floor1','wall'])
+ w.create(TkcLine,559,327,508,327, 'fill'=>color, 'tags'=>['floor1','wall'])
+ w.create(TkcLine,644,391,559,391, 'fill'=>color, 'tags'=>['floor1','wall'])
+ w.create(TkcLine,644,389,644,391, 'fill'=>color, 'tags'=>['floor1','wall'])
+ w.create(TkcLine,514,205,475,205, 'fill'=>color, 'tags'=>['floor1','wall'])
+ w.create(TkcLine,496,189,496,187, 'fill'=>color, 'tags'=>['floor1','wall'])
+ w.create(TkcLine,559,129,484,129, 'fill'=>color, 'tags'=>['floor1','wall'])
+ w.create(TkcLine,484,162,484,129, 'fill'=>color, 'tags'=>['floor1','wall'])
+ w.create(TkcLine,725,133,559,133, 'fill'=>color, 'tags'=>['floor1','wall'])
+ w.create(TkcLine,559,129,559,133, 'fill'=>color, 'tags'=>['floor1','wall'])
+ w.create(TkcLine,725,149,725,167, 'fill'=>color, 'tags'=>['floor1','wall'])
+ w.create(TkcLine,725,129,802,129, 'fill'=>color, 'tags'=>['floor1','wall'])
+ w.create(TkcLine,802,389,802,129, 'fill'=>color, 'tags'=>['floor1','wall'])
+ w.create(TkcLine,739,167,802,167, 'fill'=>color, 'tags'=>['floor1','wall'])
+ w.create(TkcLine,396,188,408,188, 'fill'=>color, 'tags'=>['floor1','wall'])
+ w.create(TkcLine,0,337,9,337, 'fill'=>color, 'tags'=>['floor1','wall'])
+ w.create(TkcLine,58,337,21,337, 'fill'=>color, 'tags'=>['floor1','wall'])
+ w.create(TkcLine,43,391,43,337, 'fill'=>color, 'tags'=>['floor1','wall'])
+ w.create(TkcLine,105,337,75,337, 'fill'=>color, 'tags'=>['floor1','wall'])
+ w.create(TkcLine,91,387,91,337, 'fill'=>color, 'tags'=>['floor1','wall'])
+ w.create(TkcLine,154,337,117,337, 'fill'=>color, 'tags'=>['floor1','wall'])
+ w.create(TkcLine,139,387,139,337, 'fill'=>color, 'tags'=>['floor1','wall'])
+ w.create(TkcLine,227,337,166,337, 'fill'=>color, 'tags'=>['floor1','wall'])
+ w.create(TkcLine,258,337,251,337, 'fill'=>color, 'tags'=>['floor1','wall'])
+ w.create(TkcLine,258,328,302,328, 'fill'=>color, 'tags'=>['floor1','wall'])
+ w.create(TkcLine,302,355,302,311, 'fill'=>color, 'tags'=>['floor1','wall'])
+ w.create(TkcLine,395,311,302,311, 'fill'=>color, 'tags'=>['floor1','wall'])
+ w.create(TkcLine,484,278,395,278, 'fill'=>color, 'tags'=>['floor1','wall'])
+ w.create(TkcLine,395,294,395,278, 'fill'=>color, 'tags'=>['floor1','wall'])
+ w.create(TkcLine,473,278,473,275, 'fill'=>color, 'tags'=>['floor1','wall'])
+ w.create(TkcLine,473,256,473,254, 'fill'=>color, 'tags'=>['floor1','wall'])
+ w.create(TkcLine,533,257,531,254, 'fill'=>color, 'tags'=>['floor1','wall'])
+ w.create(TkcLine,553,276,551,274, 'fill'=>color, 'tags'=>['floor1','wall'])
+ w.create(TkcLine,698,276,553,276, 'fill'=>color, 'tags'=>['floor1','wall'])
+ w.create(TkcLine,559,391,559,327, 'fill'=>color, 'tags'=>['floor1','wall'])
+ w.create(TkcLine,802,389,644,389, 'fill'=>color, 'tags'=>['floor1','wall'])
+ w.create(TkcLine,741,314,741,389, 'fill'=>color, 'tags'=>['floor1','wall'])
+ w.create(TkcLine,698,280,698,167, 'fill'=>color, 'tags'=>['floor1','wall'])
+ w.create(TkcLine,707,280,698,280, 'fill'=>color, 'tags'=>['floor1','wall'])
+ w.create(TkcLine,802,280,731,280, 'fill'=>color, 'tags'=>['floor1','wall'])
+ w.create(TkcLine,741,280,741,302, 'fill'=>color, 'tags'=>['floor1','wall'])
+ w.create(TkcLine,698,167,727,167, 'fill'=>color, 'tags'=>['floor1','wall'])
+ w.create(TkcLine,725,137,725,129, 'fill'=>color, 'tags'=>['floor1','wall'])
+ w.create(TkcLine,514,254,514,175, 'fill'=>color, 'tags'=>['floor1','wall'])
+ w.create(TkcLine,496,175,514,175, 'fill'=>color, 'tags'=>['floor1','wall'])
+ w.create(TkcLine,502,175,502,162, 'fill'=>color, 'tags'=>['floor1','wall'])
+ w.create(TkcLine,475,166,475,162, 'fill'=>color, 'tags'=>['floor1','wall'])
+ w.create(TkcLine,496,176,496,175, 'fill'=>color, 'tags'=>['floor1','wall'])
+ w.create(TkcLine,491,189,496,189, 'fill'=>color, 'tags'=>['floor1','wall'])
+ w.create(TkcLine,491,205,491,189, 'fill'=>color, 'tags'=>['floor1','wall'])
+ w.create(TkcLine,487,238,475,238, 'fill'=>color, 'tags'=>['floor1','wall'])
+ w.create(TkcLine,487,240,487,238, 'fill'=>color, 'tags'=>['floor1','wall'])
+ w.create(TkcLine,487,252,487,254, 'fill'=>color, 'tags'=>['floor1','wall'])
+ w.create(TkcLine,315,133,304,133, 'fill'=>color, 'tags'=>['floor1','wall'])
+ w.create(TkcLine,256,133,280,133, 'fill'=>color, 'tags'=>['floor1','wall'])
+ w.create(TkcLine,78,247,270,247, 'fill'=>color, 'tags'=>['floor1','wall'])
+ w.create(TkcLine,307,247,294,247, 'fill'=>color, 'tags'=>['floor1','wall'])
+ w.create(TkcLine,214,133,232,133, 'fill'=>color, 'tags'=>['floor1','wall'])
+ w.create(TkcLine,217,247,217,266, 'fill'=>color, 'tags'=>['floor1','wall'])
+ w.create(TkcLine,217,309,217,291, 'fill'=>color, 'tags'=>['floor1','wall'])
+ w.create(TkcLine,217,309,172,309, 'fill'=>color, 'tags'=>['floor1','wall'])
+ w.create(TkcLine,154,309,148,309, 'fill'=>color, 'tags'=>['floor1','wall'])
+ w.create(TkcLine,175,300,175,309, 'fill'=>color, 'tags'=>['floor1','wall'])
+ w.create(TkcLine,151,300,175,300, 'fill'=>color, 'tags'=>['floor1','wall'])
+ w.create(TkcLine,151,247,151,309, 'fill'=>color, 'tags'=>['floor1','wall'])
+ w.create(TkcLine,78,237,78,265, 'fill'=>color, 'tags'=>['floor1','wall'])
+ w.create(TkcLine,78,286,78,309, 'fill'=>color, 'tags'=>['floor1','wall'])
+ w.create(TkcLine,106,309,78,309, 'fill'=>color, 'tags'=>['floor1','wall'])
+ w.create(TkcLine,130,309,125,309, 'fill'=>color, 'tags'=>['floor1','wall'])
+ w.create(TkcLine,99,309,99,247, 'fill'=>color, 'tags'=>['floor1','wall'])
+ w.create(TkcLine,127,299,99,299, 'fill'=>color, 'tags'=>['floor1','wall'])
+ w.create(TkcLine,127,309,127,299, 'fill'=>color, 'tags'=>['floor1','wall'])
+ w.create(TkcLine,155,191,137,191, 'fill'=>color, 'tags'=>['floor1','wall'])
+ w.create(TkcLine,137,169,137,191, 'fill'=>color, 'tags'=>['floor1','wall'])
+ w.create(TkcLine,78,171,78,169, 'fill'=>color, 'tags'=>['floor1','wall'])
+ w.create(TkcLine,78,190,78,218, 'fill'=>color, 'tags'=>['floor1','wall'])
+ w.create(TkcLine,86,192,86,169, 'fill'=>color, 'tags'=>['floor1','wall'])
+ w.create(TkcLine,86,192,78,192, 'fill'=>color, 'tags'=>['floor1','wall'])
+ w.create(TkcLine,52,301,3,301, 'fill'=>color, 'tags'=>['floor1','wall'])
+ w.create(TkcLine,52,286,52,301, 'fill'=>color, 'tags'=>['floor1','wall'])
+ w.create(TkcLine,52,252,3,252, 'fill'=>color, 'tags'=>['floor1','wall'])
+ w.create(TkcLine,52,203,3,203, 'fill'=>color, 'tags'=>['floor1','wall'])
+ w.create(TkcLine,3,156,52,156, 'fill'=>color, 'tags'=>['floor1','wall'])
+ w.create(TkcLine,8,25,8,114, 'fill'=>color, 'tags'=>['floor1','wall'])
+ w.create(TkcLine,63,114,3,114, 'fill'=>color, 'tags'=>['floor1','wall'])
+ w.create(TkcLine,75,114,97,114, 'fill'=>color, 'tags'=>['floor1','wall'])
+ w.create(TkcLine,108,114,129,114, 'fill'=>color, 'tags'=>['floor1','wall'])
+ w.create(TkcLine,129,114,129,89, 'fill'=>color, 'tags'=>['floor1','wall'])
+ w.create(TkcLine,52,114,52,128, 'fill'=>color, 'tags'=>['floor1','wall'])
+ w.create(TkcLine,132,89,88,89, 'fill'=>color, 'tags'=>['floor1','wall'])
+ w.create(TkcLine,88,25,88,89, 'fill'=>color, 'tags'=>['floor1','wall'])
+ w.create(TkcLine,88,114,88,89, 'fill'=>color, 'tags'=>['floor1','wall'])
+ w.create(TkcLine,218,89,144,89, 'fill'=>color, 'tags'=>['floor1','wall'])
+ w.create(TkcLine,147,111,147,129, 'fill'=>color, 'tags'=>['floor1','wall'])
+ w.create(TkcLine,162,111,147,111, 'fill'=>color, 'tags'=>['floor1','wall'])
+ w.create(TkcLine,162,109,162,111, 'fill'=>color, 'tags'=>['floor1','wall'])
+ w.create(TkcLine,162,96,162,89, 'fill'=>color, 'tags'=>['floor1','wall'])
+ w.create(TkcLine,218,89,218,94, 'fill'=>color, 'tags'=>['floor1','wall'])
+ w.create(TkcLine,218,89,218,119, 'fill'=>color, 'tags'=>['floor1','wall'])
+ w.create(TkcLine,8,25,88,25, 'fill'=>color, 'tags'=>['floor1','wall'])
+ w.create(TkcLine,258,337,258,328, 'fill'=>color, 'tags'=>['floor1','wall'])
+ w.create(TkcLine,113,129,96,129, 'fill'=>color, 'tags'=>['floor1','wall'])
+ w.create(TkcLine,302,355,258,355, 'fill'=>color, 'tags'=>['floor1','wall'])
+ w.create(TkcLine,386,104,386,129, 'fill'=>color, 'tags'=>['floor1','wall'])
+ w.create(TkcLine,377,100,386,104, 'fill'=>color, 'tags'=>['floor1','wall'])
+ w.create(TkcLine,365,94,377,100, 'fill'=>color, 'tags'=>['floor1','wall'])
+ w.create(TkcLine,350,83,365,94, 'fill'=>color, 'tags'=>['floor1','wall'])
+ w.create(TkcLine,337,70,350,83, 'fill'=>color, 'tags'=>['floor1','wall'])
+ w.create(TkcLine,337,70,323,56, 'fill'=>color, 'tags'=>['floor1','wall'])
+ w.create(TkcLine,312,49,323,56, 'fill'=>color, 'tags'=>['floor1','wall'])
+ w.create(TkcLine,295,40,312,49, 'fill'=>color, 'tags'=>['floor1','wall'])
+ w.create(TkcLine,282,37,295,40, 'fill'=>color, 'tags'=>['floor1','wall'])
+ w.create(TkcLine,260,34,282,37, 'fill'=>color, 'tags'=>['floor1','wall'])
+ w.create(TkcLine,253,34,260,34, 'fill'=>color, 'tags'=>['floor1','wall'])
+ w.create(TkcLine,386,128,386,104, 'fill'=>color, 'tags'=>['floor1','wall'])
+ w.create(TkcLine,113,152,156,152, 'fill'=>color, 'tags'=>['floor1','wall'])
+ w.create(TkcLine,113,152,156,152, 'fill'=>color, 'tags'=>['floor1','wall'])
+ w.create(TkcLine,113,152,113,129, 'fill'=>color, 'tags'=>['floor1','wall'])
+end
+
+# floor2_fg2 --
+# This method represents part of the floorplan database. When
+# invoked, it instantiates the foreground information for the second
+# floor (office outlines and numbers).
+#
+# Arguments:
+# w - The canvas window.
+# color - Color to use for drawing foreground information.
+
+def floor2_fg2(w,color)
+ i = TkcPolygon.new(w,748,188,755,188,755,205,758,205,758,222,
+ 800,222,800,168,748,168,
+ 'fill'=>'', 'tags'=>['floor2','room'])
+ $floorLabels2[i.id] = '238'
+ $floorItems2['238'] = i
+ w.create(TkcText,774,195, 'text'=>'238', 'fill'=>color,
+ 'anchor'=>'c', 'tags'=>['floor2','label'])
+ i = TkcPolygon.new(w,726,188,746,188,746,166,800,166,800,131,726,131,
+ 'fill'=>'', 'tags'=>['floor2','room'])
+ $floorLabels2[i.id] = '237'
+ $floorItems2['237'] = i
+ w.create(TkcText,763,148.5, 'text'=>'237', 'fill'=>color,
+ 'anchor'=>'c', 'tags'=>['floor2','label'])
+ i = TkcPolygon.new(w,497,187,497,204,559,204,559,324,641,324,
+ 643,324,643,291,641,291,641,205,696,205,
+ 696,291,694,291,694,314,715,314,715,291,
+ 715,205,755,205,755,190,724,190,724,187,
+ 'fill'=>'', 'tags'=>['floor2','room'])
+ $floorLabels2[i.id] = '246'
+ $floorItems2['246'] = i
+ w.create(TkcText,600,264, 'text'=>'246', 'fill'=>color,
+ 'anchor'=>'c', 'tags'=>['floor2','label'])
+ i = TkcPolygon.new(w,694,279,643,279,643,314,694,314,
+ 'fill'=>'', 'tags'=>['floor2','room'])
+ $floorLabels2[i.id] = '247'
+ $floorItems2['247'] = i
+ w.create(TkcText,668.5,296.5, 'text'=>'247', 'fill'=>color,
+ 'anchor'=>'c', 'tags'=>['floor2','label'])
+ i = TkcPolygon.new(w,232,250,308,250,308,242,339,242,339,246,
+ 397,246,397,255,476,255,476,250,482,250,559,250,
+ 559,274,482,274,482,278,396,278,396,274,232,274,
+ 'fill'=>'', 'tags'=>['floor2','room'])
+ $floorLabels2[i.id] = '202'
+ $floorItems2['202'] = i
+ w.create(TkcText,285.5,260, 'text'=>'202', 'fill'=>color,
+ 'anchor'=>'c', 'tags'=>['floor2','label'])
+ i = TkcPolygon.new(w,53,228,53,338,176,338,233,338,233,196,
+ 306,196,306,180,175,180,175,169,156,169,
+ 156,196,176,196,176,228,
+ 'fill'=>'', 'tags'=>['floor2','room'])
+ $floorLabels2[i.id] = '206'
+ $floorItems2['206'] = i
+ w.create(TkcText,143,267, 'text'=>'206', 'fill'=>color,
+ 'anchor'=>'c', 'tags'=>['floor2','label'])
+ i = TkcPolygon.new(w,51,277,6,277,6,338,51,338,
+ 'fill'=>'', 'tags'=>['floor2','room'])
+ $floorLabels2[i.id] = '212'
+ $floorItems2['212'] = i
+ w.create(TkcText,28.5,307.5, 'text'=>'212', 'fill'=>color,
+ 'anchor'=>'c', 'tags'=>['floor2','label'])
+ i = TkcPolygon.new(w,557,276,486,276,486,309,510,309,510,325,557,325,
+ 'fill'=>'', 'tags'=>['floor2','room'])
+ $floorLabels2[i.id] = '245'
+ $floorItems2['245'] = i
+ w.create(TkcText,521.5,300.5, 'text'=>'245', 'fill'=>color,
+ 'anchor'=>'c', 'tags'=>['floor2','label'])
+ i = TkcPolygon.new(w,560,389,599,389,599,326,560,326,
+ 'fill'=>'', 'tags'=>['floor2','room'])
+ $floorLabels2[i.id] = '244'
+ $floorItems2['244'] = i
+ w.create(TkcText,579.5,357.5, 'text'=>'244', 'fill'=>color,
+ 'anchor'=>'c', 'tags'=>['floor2','label'])
+ i = TkcPolygon.new(w,601,389,601,326,643,326,643,389,
+ 'fill'=>'', 'tags'=>['floor2','room'])
+ $floorLabels2[i.id] = '243'
+ $floorItems2['243'] = i
+ w.create(TkcText,622,357.5, 'text'=>'243', 'fill'=>color,
+ 'anchor'=>'c', 'tags'=>['floor2','label'])
+ i = TkcPolygon.new(w,688,316,645,316,645,365,688,365,
+ 'fill'=>'', 'tags'=>['floor2','room'])
+ $floorLabels2[i.id] = '242'
+ $floorItems2['242'] = i
+ w.create(TkcText,666.5,340.5, 'text'=>'242', 'fill'=>color,
+ 'anchor'=>'c', 'tags'=>['floor2','label'])
+ i = TkcPolygon.new(w,802,367,759,367,759,226,802,226,
+ 'fill'=>'', 'tags'=>['floor2','room'])
+ $floorLabels2[i.id] = 'Barbecue Deck'
+ $floorItems2['Barbecue Deck'] = i
+ w.create(TkcText,780.5,296.5, 'text'=>'Barbecue Deck', 'fill'=>color,
+ 'anchor'=>'c', 'tags'=>['floor2','label'])
+ i = TkcPolygon.new(w,755,262,755,314,717,314,717,262,
+ 'fill'=>'', 'tags'=>['floor2','room'])
+ $floorLabels2[i.id] = '240'
+ $floorItems2['240'] = i
+ w.create(TkcText,736,288, 'text'=>'240', 'fill'=>color,
+ 'anchor'=>'c', 'tags'=>['floor2','label'])
+ i = TkcPolygon.new(w,755,316,689,316,689,365,755,365,
+ 'fill'=>'', 'tags'=>['floor2','room'])
+ $floorLabels2[i.id] = '241'
+ $floorItems2['241'] = i
+ w.create(TkcText,722,340.5, 'text'=>'241', 'fill'=>color,
+ 'anchor'=>'c', 'tags'=>['floor2','label'])
+ i = TkcPolygon.new(w,755,206,717,206,717,261,755,261,
+ 'fill'=>'', 'tags'=>['floor2','room'])
+ $floorLabels2[i.id] = '239'
+ $floorItems2['239'] = i
+ w.create(TkcText,736,233.5, 'text'=>'239', 'fill'=>color,
+ 'anchor'=>'c', 'tags'=>['floor2','label'])
+ i = TkcPolygon.new(w,695,277,643,277,643,206,695,206,
+ 'fill'=>'', 'tags'=>['floor2','room'])
+ $floorLabels2[i.id] = '248'
+ $floorItems2['248'] = i
+ w.create(TkcText,669,241.5, 'text'=>'248', 'fill'=>color,
+ 'anchor'=>'c', 'tags'=>['floor2','label'])
+ i = TkcPolygon.new(w,676,135,676,185,724,185,724,135,
+ 'fill'=>'', 'tags'=>['floor2','room'])
+ $floorLabels2[i.id] = '236'
+ $floorItems2['236'] = i
+ w.create(TkcText,700,160, 'text'=>'236', 'fill'=>color,
+ 'anchor'=>'c', 'tags'=>['floor2','label'])
+ i = TkcPolygon.new(w,675,135,635,135,635,145,628,145,628,185,675,185,
+ 'fill'=>'', 'tags'=>['floor2','room'])
+ $floorLabels2[i.id] = '235'
+ $floorItems2['235'] = i
+ w.create(TkcText,651.5,160, 'text'=>'235', 'fill'=>color,
+ 'anchor'=>'c', 'tags'=>['floor2','label'])
+ i = TkcPolygon.new(w,626,143,633,143,633,135,572,135,
+ 572,143,579,143,579,185,626,185,
+ 'fill'=>'', 'tags'=>['floor2','room'])
+ $floorLabels2[i.id] = '234'
+ $floorItems2['234'] = i
+ w.create(TkcText,606,160, 'text'=>'234', 'fill'=>color,
+ 'anchor'=>'c', 'tags'=>['floor2','label'])
+ i = TkcPolygon.new(w,557,135,571,135,571,145,578,145,
+ 578,185,527,185,527,131,557,131,
+ 'fill'=>'', 'tags'=>['floor2','room'])
+ $floorLabels2[i.id] = '233'
+ $floorItems2['233'] = i
+ w.create(TkcText,552.5,158, 'text'=>'233', 'fill'=>color,
+ 'anchor'=>'c', 'tags'=>['floor2','label'])
+ i = TkcPolygon.new(w,476,249,557,249,557,205,476,205,
+ 'fill'=>'', 'tags'=>['floor2','room'])
+ $floorLabels2[i.id] = '230'
+ $floorItems2['230'] = i
+ w.create(TkcText,516.5,227, 'text'=>'230', 'fill'=>color,
+ 'anchor'=>'c', 'tags'=>['floor2','label'])
+ i = TkcPolygon.new(w,476,164,486,164,486,131,525,131,525,185,476,185,
+ 'fill'=>'', 'tags'=>['floor2','room'])
+ $floorLabels2[i.id] = '232'
+ $floorItems2['232'] = i
+ w.create(TkcText,500.5,158, 'text'=>'232', 'fill'=>color,
+ 'anchor'=>'c', 'tags'=>['floor2','label'])
+ i = TkcPolygon.new(w,476,186,495,186,495,204,476,204,
+ 'fill'=>'', 'tags'=>['floor2','room'])
+ $floorLabels2[i.id] = '229'
+ $floorItems2['229'] = i
+ w.create(TkcText,485.5,195, 'text'=>'229', 'fill'=>color,
+ 'anchor'=>'c', 'tags'=>['floor2','label'])
+ i = TkcPolygon.new(w,474,207,409,207,409,187,399,187,399,164,474,164,
+ 'fill'=>'', 'tags'=>['floor2','room'])
+ $floorLabels2[i.id] = '227'
+ $floorItems2['227'] = i
+ w.create(TkcText,436.5,185.5, 'text'=>'227', 'fill'=>color,
+ 'anchor'=>'c', 'tags'=>['floor2','label'])
+ i = TkcPolygon.new(w,399,228,399,253,474,253,474,209,409,209,409,228,
+ 'fill'=>'', 'tags'=>['floor2','room'])
+ $floorLabels2[i.id] = '228'
+ $floorItems2['228'] = i
+ w.create(TkcText,436.5,231, 'text'=>'228', 'fill'=>color,
+ 'anchor'=>'c', 'tags'=>['floor2','label'])
+ i = TkcPolygon.new(w,397,246,397,226,407,226,407,189,377,189,377,246,
+ 'fill'=>'', 'tags'=>['floor2','room'])
+ $floorLabels2[i.id] = '226'
+ $floorItems2['226'] = i
+ w.create(TkcText,392,217.5, 'text'=>'226', 'fill'=>color,
+ 'anchor'=>'c', 'tags'=>['floor2','label'])
+ i = TkcPolygon.new(w,377,169,316,169,316,131,397,131,397,188,377,188,
+ 'fill'=>'', 'tags'=>['floor2','room'])
+ $floorLabels2[i.id] = '225'
+ $floorItems2['225'] = i
+ w.create(TkcText,356.5,150, 'text'=>'225', 'fill'=>color,
+ 'anchor'=>'c', 'tags'=>['floor2','label'])
+ i = TkcPolygon.new(w,234,198,306,198,306,249,234,249,
+ 'fill'=>'', 'tags'=>['floor2','room'])
+ $floorLabels2[i.id] = '224'
+ $floorItems2['224'] = i
+ w.create(TkcText,270,223.5, 'text'=>'224', 'fill'=>color,
+ 'anchor'=>'c', 'tags'=>['floor2','label'])
+ i = TkcPolygon.new(w,270,179,306,179,306,170,314,170,314,135,270,135,
+ 'fill'=>'', 'tags'=>['floor2','room'])
+ $floorLabels2[i.id] = '223'
+ $floorItems2['223'] = i
+ w.create(TkcText,292,157, 'text'=>'223', 'fill'=>color,
+ 'anchor'=>'c', 'tags'=>['floor2','label'])
+ i = TkcPolygon.new(w,268,179,221,179,221,135,268,135,
+ 'fill'=>'', 'tags'=>['floor2','room'])
+ $floorLabels2[i.id] = '222'
+ $floorItems2['222'] = i
+ w.create(TkcText,244.5,157, 'text'=>'222', 'fill'=>color,
+ 'anchor'=>'c', 'tags'=>['floor2','label'])
+ i = TkcPolygon.new(w,177,179,219,179,219,135,177,135,
+ 'fill'=>'', 'tags'=>['floor2','room'])
+ $floorLabels2[i.id] = '221'
+ $floorItems2['221'] = i
+ w.create(TkcText,198,157, 'text'=>'221', 'fill'=>color,
+ 'anchor'=>'c', 'tags'=>['floor2','label'])
+ i = TkcPolygon.new(w,299,327,349,327,349,284,341,284,341,276,299,276,
+ 'fill'=>'', 'tags'=>['floor2','room'])
+ $floorLabels2[i.id] = '204'
+ $floorItems2['204'] = i
+ w.create(TkcText,324,301.5, 'text'=>'204', 'fill'=>color,
+ 'anchor'=>'c', 'tags'=>['floor2','label'])
+ i = TkcPolygon.new(w,234,276,297,276,297,327,257,327,257,338,234,338,
+ 'fill'=>'', 'tags'=>['floor2','room'])
+ $floorLabels2[i.id] = '205'
+ $floorItems2['205'] = i
+ w.create(TkcText,265.5,307, 'text'=>'205', 'fill'=>color,
+ 'anchor'=>'c', 'tags'=>['floor2','label'])
+ i = TkcPolygon.new(w,256,385,256,340,212,340,212,385,
+ 'fill'=>'', 'tags'=>['floor2','room'])
+ $floorLabels2[i.id] = '207'
+ $floorItems2['207'] = i
+ w.create(TkcText,234,362.5, 'text'=>'207', 'fill'=>color,
+ 'anchor'=>'c', 'tags'=>['floor2','label'])
+ i = TkcPolygon.new(w,210,340,164,340,164,385,210,385,
+ 'fill'=>'', 'tags'=>['floor2','room'])
+ $floorLabels2[i.id] = '208'
+ $floorItems2['208'] = i
+ w.create(TkcText,187,362.5, 'text'=>'208', 'fill'=>color,
+ 'anchor'=>'c', 'tags'=>['floor2','label'])
+ i = TkcPolygon.new(w,115,340,162,340,162,385,115,385,
+ 'fill'=>'', 'tags'=>['floor2','room'])
+ $floorLabels2[i.id] = '209'
+ $floorItems2['209'] = i
+ w.create(TkcText,138.5,362.5, 'text'=>'209', 'fill'=>color,
+ 'anchor'=>'c', 'tags'=>['floor2','label'])
+ i = TkcPolygon.new(w,89,228,89,156,53,156,53,228,
+ 'fill'=>'', 'tags'=>['floor2','room'])
+ $floorLabels2[i.id] = '217'
+ $floorItems2['217'] = i
+ w.create(TkcText,71,192, 'text'=>'217', 'fill'=>color,
+ 'anchor'=>'c', 'tags'=>['floor2','label'])
+ i = TkcPolygon.new(w,89,169,97,169,97,190,89,190,
+ 'fill'=>'', 'tags'=>['floor2','room'])
+ $floorLabels2[i.id] = '217A'
+ $floorItems2['217A'] = i
+ w.create(TkcText,93,179.5, 'text'=>'217A', 'fill'=>color,
+ 'anchor'=>'c', 'tags'=>['floor2','label'])
+ i = TkcPolygon.new(w,89,156,89,168,95,168,95,135,53,135,53,156,
+ 'fill'=>'', 'tags'=>['floor2','room'])
+ $floorLabels2[i.id] = '216'
+ $floorItems2['216'] = i
+ w.create(TkcText,71,145.5, 'text'=>'216', 'fill'=>color,
+ 'anchor'=>'c', 'tags'=>['floor2','label'])
+ i = TkcPolygon.new(w,51,179,51,135,6,135,6,179,
+ 'fill'=>'', 'tags'=>['floor2','room'])
+ $floorLabels2[i.id] = '215'
+ $floorItems2['215'] = i
+ w.create(TkcText,28.5,157, 'text'=>'215', 'fill'=>color,
+ 'anchor'=>'c', 'tags'=>['floor2','label'])
+ i = TkcPolygon.new(w,51,227,6,227,6,180,51,180,
+ 'fill'=>'', 'tags'=>['floor2','room'])
+ $floorLabels2[i.id] = '214'
+ $floorItems2['214'] = i
+ w.create(TkcText,28.5,203.5, 'text'=>'214', 'fill'=>color,
+ 'anchor'=>'c', 'tags'=>['floor2','label'])
+ i = TkcPolygon.new(w,51,275,6,275,6,229,51,229,
+ 'fill'=>'', 'tags'=>['floor2','room'])
+ $floorLabels2[i.id] = '213'
+ $floorItems2['213'] = i
+ w.create(TkcText,28.5,252, 'text'=>'213', 'fill'=>color,
+ 'anchor'=>'c', 'tags'=>['floor2','label'])
+ i = TkcPolygon.new(w,114,340,67,340,67,385,114,385,
+ 'fill'=>'', 'tags'=>['floor2','room'])
+ $floorLabels2[i.id] = '210'
+ $floorItems2['210'] = i
+ w.create(TkcText,90.5,362.5, 'text'=>'210', 'fill'=>color,
+ 'anchor'=>'c', 'tags'=>['floor2','label'])
+ i = TkcPolygon.new(w,59,389,59,385,65,385,65,340,1,340,1,389,
+ 'fill'=>'', 'tags'=>['floor2','room'])
+ $floorLabels2[i.id] = '211'
+ $floorItems2['211'] = i
+ w.create(TkcText,33,364.5, 'text'=>'211', 'fill'=>color,
+ 'anchor'=>'c', 'tags'=>['floor2','label'])
+ i = TkcPolygon.new(w,393,309,350,309,350,282,342,282,342,276,393,276,
+ 'fill'=>'', 'tags'=>['floor2','room'])
+ $floorLabels2[i.id] = '203'
+ $floorItems2['203'] = i
+ w.create(TkcText,367.5,292.5, 'text'=>'203', 'fill'=>color,
+ 'anchor'=>'c', 'tags'=>['floor2','label'])
+ i = TkcPolygon.new(w,99,191,91,191,91,226,174,226,174,198,
+ 154,198,154,192,109,192,109,169,99,169,
+ 'fill'=>'', 'tags'=>['floor2','room'])
+ $floorLabels2[i.id] = '220'
+ $floorItems2['220'] = i
+ w.create(TkcText,132.5,208.5, 'text'=>'220', 'fill'=>color,
+ 'anchor'=>'c', 'tags'=>['floor2','label'])
+ i = TkcPolygon.new(w,339,205,307,205,307,171,339,171,
+ 'fill'=>'', 'tags'=>['floor2','room'])
+ $floorLabels2[i.id] = 'Priv Lift2'
+ $floorItems2['Priv Lift2'] = i
+ w.create(TkcText,323,188, 'text'=>'Priv Lift2', 'fill'=>color,
+ 'anchor'=>'c', 'tags'=>['floor2','label'])
+ i = TkcPolygon.new(w,307,240,339,240,339,206,307,206,
+ 'fill'=>'', 'tags'=>['floor2','room'])
+ $floorLabels2[i.id] = 'Pub Lift 2'
+ $floorItems2['Pub Lift 2'] = i
+ w.create(TkcText,323,223, 'text'=>'Pub Lift 2', 'fill'=>color,
+ 'anchor'=>'c', 'tags'=>['floor2','label'])
+ i = TkcPolygon.new(w,175,168,97,168,97,131,175,131,
+ 'fill'=>'', 'tags'=>['floor2','room'])
+ $floorLabels2[i.id] = '218'
+ $floorItems2['218'] = i
+ w.create(TkcText,136,149.5, 'text'=>'218', 'fill'=>color,
+ 'anchor'=>'c', 'tags'=>['floor2','label'])
+ i = TkcPolygon.new(w,154,191,111,191,111,169,154,169,
+ 'fill'=>'', 'tags'=>['floor2','room'])
+ $floorLabels2[i.id] = '219'
+ $floorItems2['219'] = i
+ w.create(TkcText,132.5,180, 'text'=>'219', 'fill'=>color,
+ 'anchor'=>'c', 'tags'=>['floor2','label'])
+ i = TkcPolygon.new(w,375,246,375,172,341,172,341,246,
+ 'fill'=>'', 'tags'=>['floor2','room'])
+ $floorLabels2[i.id] = '201'
+ $floorItems2['201'] = i
+ w.create(TkcText,358,209, 'text'=>'201', 'fill'=>color,
+ 'anchor'=>'c', 'tags'=>['floor2','label'])
+ w.create(TkcLine,641,186,678,186, 'fill'=>color, 'tags'=>['floor2','wall'])
+ w.create(TkcLine,757,350,757,367, 'fill'=>color, 'tags'=>['floor2','wall'])
+ w.create(TkcLine,634,133,634,144, 'fill'=>color, 'tags'=>['floor2','wall'])
+ w.create(TkcLine,634,144,627,144, 'fill'=>color, 'tags'=>['floor2','wall'])
+ w.create(TkcLine,572,133,572,144, 'fill'=>color, 'tags'=>['floor2','wall'])
+ w.create(TkcLine,572,144,579,144, 'fill'=>color, 'tags'=>['floor2','wall'])
+ w.create(TkcLine,398,129,398,162, 'fill'=>color, 'tags'=>['floor2','wall'])
+ w.create(TkcLine,174,197,175,197, 'fill'=>color, 'tags'=>['floor2','wall'])
+ w.create(TkcLine,175,197,175,227, 'fill'=>color, 'tags'=>['floor2','wall'])
+ w.create(TkcLine,757,206,757,221, 'fill'=>color, 'tags'=>['floor2','wall'])
+ w.create(TkcLine,396,188,408,188, 'fill'=>color, 'tags'=>['floor2','wall'])
+ w.create(TkcLine,727,189,725,189, 'fill'=>color, 'tags'=>['floor2','wall'])
+ w.create(TkcLine,747,167,802,167, 'fill'=>color, 'tags'=>['floor2','wall'])
+ w.create(TkcLine,747,167,747,189, 'fill'=>color, 'tags'=>['floor2','wall'])
+ w.create(TkcLine,755,189,739,189, 'fill'=>color, 'tags'=>['floor2','wall'])
+ w.create(TkcLine,769,224,757,224, 'fill'=>color, 'tags'=>['floor2','wall'])
+ w.create(TkcLine,802,224,802,129, 'fill'=>color, 'tags'=>['floor2','wall'])
+ w.create(TkcLine,802,129,725,129, 'fill'=>color, 'tags'=>['floor2','wall'])
+ w.create(TkcLine,725,189,725,129, 'fill'=>color, 'tags'=>['floor2','wall'])
+ w.create(TkcLine,725,186,690,186, 'fill'=>color, 'tags'=>['floor2','wall'])
+ w.create(TkcLine,676,133,676,186, 'fill'=>color, 'tags'=>['floor2','wall'])
+ w.create(TkcLine,627,144,627,186, 'fill'=>color, 'tags'=>['floor2','wall'])
+ w.create(TkcLine,629,186,593,186, 'fill'=>color, 'tags'=>['floor2','wall'])
+ w.create(TkcLine,579,144,579,186, 'fill'=>color, 'tags'=>['floor2','wall'])
+ w.create(TkcLine,559,129,559,133, 'fill'=>color, 'tags'=>['floor2','wall'])
+ w.create(TkcLine,725,133,559,133, 'fill'=>color, 'tags'=>['floor2','wall'])
+ w.create(TkcLine,484,162,484,129, 'fill'=>color, 'tags'=>['floor2','wall'])
+ w.create(TkcLine,559,129,484,129, 'fill'=>color, 'tags'=>['floor2','wall'])
+ w.create(TkcLine,526,129,526,186, 'fill'=>color, 'tags'=>['floor2','wall'])
+ w.create(TkcLine,540,186,581,186, 'fill'=>color, 'tags'=>['floor2','wall'])
+ w.create(TkcLine,528,186,523,186, 'fill'=>color, 'tags'=>['floor2','wall'])
+ w.create(TkcLine,511,186,475,186, 'fill'=>color, 'tags'=>['floor2','wall'])
+ w.create(TkcLine,496,190,496,186, 'fill'=>color, 'tags'=>['floor2','wall'])
+ w.create(TkcLine,496,205,496,202, 'fill'=>color, 'tags'=>['floor2','wall'])
+ w.create(TkcLine,475,205,527,205, 'fill'=>color, 'tags'=>['floor2','wall'])
+ w.create(TkcLine,558,205,539,205, 'fill'=>color, 'tags'=>['floor2','wall'])
+ w.create(TkcLine,558,205,558,249, 'fill'=>color, 'tags'=>['floor2','wall'])
+ w.create(TkcLine,558,249,475,249, 'fill'=>color, 'tags'=>['floor2','wall'])
+ w.create(TkcLine,662,206,642,206, 'fill'=>color, 'tags'=>['floor2','wall'])
+ w.create(TkcLine,695,206,675,206, 'fill'=>color, 'tags'=>['floor2','wall'])
+ w.create(TkcLine,695,278,642,278, 'fill'=>color, 'tags'=>['floor2','wall'])
+ w.create(TkcLine,642,291,642,206, 'fill'=>color, 'tags'=>['floor2','wall'])
+ w.create(TkcLine,695,291,695,206, 'fill'=>color, 'tags'=>['floor2','wall'])
+ w.create(TkcLine,716,208,716,206, 'fill'=>color, 'tags'=>['floor2','wall'])
+ w.create(TkcLine,757,206,716,206, 'fill'=>color, 'tags'=>['floor2','wall'])
+ w.create(TkcLine,757,221,757,224, 'fill'=>color, 'tags'=>['floor2','wall'])
+ w.create(TkcLine,793,224,802,224, 'fill'=>color, 'tags'=>['floor2','wall'])
+ w.create(TkcLine,757,262,716,262, 'fill'=>color, 'tags'=>['floor2','wall'])
+ w.create(TkcLine,716,220,716,264, 'fill'=>color, 'tags'=>['floor2','wall'])
+ w.create(TkcLine,716,315,716,276, 'fill'=>color, 'tags'=>['floor2','wall'])
+ w.create(TkcLine,757,315,703,315, 'fill'=>color, 'tags'=>['floor2','wall'])
+ w.create(TkcLine,757,325,757,224, 'fill'=>color, 'tags'=>['floor2','wall'])
+ w.create(TkcLine,757,367,644,367, 'fill'=>color, 'tags'=>['floor2','wall'])
+ w.create(TkcLine,689,367,689,315, 'fill'=>color, 'tags'=>['floor2','wall'])
+ w.create(TkcLine,647,315,644,315, 'fill'=>color, 'tags'=>['floor2','wall'])
+ w.create(TkcLine,659,315,691,315, 'fill'=>color, 'tags'=>['floor2','wall'])
+ w.create(TkcLine,600,325,600,391, 'fill'=>color, 'tags'=>['floor2','wall'])
+ w.create(TkcLine,627,325,644,325, 'fill'=>color, 'tags'=>['floor2','wall'])
+ w.create(TkcLine,644,391,644,315, 'fill'=>color, 'tags'=>['floor2','wall'])
+ w.create(TkcLine,615,325,575,325, 'fill'=>color, 'tags'=>['floor2','wall'])
+ w.create(TkcLine,644,391,558,391, 'fill'=>color, 'tags'=>['floor2','wall'])
+ w.create(TkcLine,563,325,558,325, 'fill'=>color, 'tags'=>['floor2','wall'])
+ w.create(TkcLine,558,391,558,314, 'fill'=>color, 'tags'=>['floor2','wall'])
+ w.create(TkcLine,558,327,508,327, 'fill'=>color, 'tags'=>['floor2','wall'])
+ w.create(TkcLine,558,275,484,275, 'fill'=>color, 'tags'=>['floor2','wall'])
+ w.create(TkcLine,558,302,558,275, 'fill'=>color, 'tags'=>['floor2','wall'])
+ w.create(TkcLine,508,327,508,311, 'fill'=>color, 'tags'=>['floor2','wall'])
+ w.create(TkcLine,484,311,508,311, 'fill'=>color, 'tags'=>['floor2','wall'])
+ w.create(TkcLine,484,275,484,311, 'fill'=>color, 'tags'=>['floor2','wall'])
+ w.create(TkcLine,475,208,408,208, 'fill'=>color, 'tags'=>['floor2','wall'])
+ w.create(TkcLine,408,206,408,210, 'fill'=>color, 'tags'=>['floor2','wall'])
+ w.create(TkcLine,408,222,408,227, 'fill'=>color, 'tags'=>['floor2','wall'])
+ w.create(TkcLine,408,227,398,227, 'fill'=>color, 'tags'=>['floor2','wall'])
+ w.create(TkcLine,398,227,398,254, 'fill'=>color, 'tags'=>['floor2','wall'])
+ w.create(TkcLine,408,188,408,194, 'fill'=>color, 'tags'=>['floor2','wall'])
+ w.create(TkcLine,383,188,376,188, 'fill'=>color, 'tags'=>['floor2','wall'])
+ w.create(TkcLine,398,188,398,162, 'fill'=>color, 'tags'=>['floor2','wall'])
+ w.create(TkcLine,398,162,484,162, 'fill'=>color, 'tags'=>['floor2','wall'])
+ w.create(TkcLine,475,162,475,254, 'fill'=>color, 'tags'=>['floor2','wall'])
+ w.create(TkcLine,398,254,475,254, 'fill'=>color, 'tags'=>['floor2','wall'])
+ w.create(TkcLine,484,280,395,280, 'fill'=>color, 'tags'=>['floor2','wall'])
+ w.create(TkcLine,395,311,395,275, 'fill'=>color, 'tags'=>['floor2','wall'])
+ w.create(TkcLine,307,197,293,197, 'fill'=>color, 'tags'=>['floor2','wall'])
+ w.create(TkcLine,278,197,233,197, 'fill'=>color, 'tags'=>['floor2','wall'])
+ w.create(TkcLine,233,197,233,249, 'fill'=>color, 'tags'=>['floor2','wall'])
+ w.create(TkcLine,307,179,284,179, 'fill'=>color, 'tags'=>['floor2','wall'])
+ w.create(TkcLine,233,249,278,249, 'fill'=>color, 'tags'=>['floor2','wall'])
+ w.create(TkcLine,269,179,269,133, 'fill'=>color, 'tags'=>['floor2','wall'])
+ w.create(TkcLine,220,179,220,133, 'fill'=>color, 'tags'=>['floor2','wall'])
+ w.create(TkcLine,155,191,110,191, 'fill'=>color, 'tags'=>['floor2','wall'])
+ w.create(TkcLine,90,190,98,190, 'fill'=>color, 'tags'=>['floor2','wall'])
+ w.create(TkcLine,98,169,98,190, 'fill'=>color, 'tags'=>['floor2','wall'])
+ w.create(TkcLine,52,133,52,165, 'fill'=>color, 'tags'=>['floor2','wall'])
+ w.create(TkcLine,52,214,52,177, 'fill'=>color, 'tags'=>['floor2','wall'])
+ w.create(TkcLine,52,226,52,262, 'fill'=>color, 'tags'=>['floor2','wall'])
+ w.create(TkcLine,52,274,52,276, 'fill'=>color, 'tags'=>['floor2','wall'])
+ w.create(TkcLine,234,275,234,339, 'fill'=>color, 'tags'=>['floor2','wall'])
+ w.create(TkcLine,226,339,258,339, 'fill'=>color, 'tags'=>['floor2','wall'])
+ w.create(TkcLine,211,387,211,339, 'fill'=>color, 'tags'=>['floor2','wall'])
+ w.create(TkcLine,214,339,177,339, 'fill'=>color, 'tags'=>['floor2','wall'])
+ w.create(TkcLine,258,387,60,387, 'fill'=>color, 'tags'=>['floor2','wall'])
+ w.create(TkcLine,3,133,3,339, 'fill'=>color, 'tags'=>['floor2','wall'])
+ w.create(TkcLine,165,339,129,339, 'fill'=>color, 'tags'=>['floor2','wall'])
+ w.create(TkcLine,117,339,80,339, 'fill'=>color, 'tags'=>['floor2','wall'])
+ w.create(TkcLine,68,339,59,339, 'fill'=>color, 'tags'=>['floor2','wall'])
+ w.create(TkcLine,0,339,46,339, 'fill'=>color, 'tags'=>['floor2','wall'])
+ w.create(TkcLine,60,391,0,391, 'fill'=>color, 'tags'=>['floor2','wall'])
+ w.create(TkcLine,0,339,0,391, 'fill'=>color, 'tags'=>['floor2','wall'])
+ w.create(TkcLine,60,387,60,391, 'fill'=>color, 'tags'=>['floor2','wall'])
+ w.create(TkcLine,258,329,258,387, 'fill'=>color, 'tags'=>['floor2','wall'])
+ w.create(TkcLine,350,329,258,329, 'fill'=>color, 'tags'=>['floor2','wall'])
+ w.create(TkcLine,395,311,350,311, 'fill'=>color, 'tags'=>['floor2','wall'])
+ w.create(TkcLine,398,129,315,129, 'fill'=>color, 'tags'=>['floor2','wall'])
+ w.create(TkcLine,176,133,315,133, 'fill'=>color, 'tags'=>['floor2','wall'])
+ w.create(TkcLine,176,129,96,129, 'fill'=>color, 'tags'=>['floor2','wall'])
+ w.create(TkcLine,3,133,96,133, 'fill'=>color, 'tags'=>['floor2','wall'])
+ w.create(TkcLine,66,387,66,339, 'fill'=>color, 'tags'=>['floor2','wall'])
+ w.create(TkcLine,115,387,115,339, 'fill'=>color, 'tags'=>['floor2','wall'])
+ w.create(TkcLine,163,387,163,339, 'fill'=>color, 'tags'=>['floor2','wall'])
+ w.create(TkcLine,234,275,276,275, 'fill'=>color, 'tags'=>['floor2','wall'])
+ w.create(TkcLine,288,275,309,275, 'fill'=>color, 'tags'=>['floor2','wall'])
+ w.create(TkcLine,298,275,298,329, 'fill'=>color, 'tags'=>['floor2','wall'])
+ w.create(TkcLine,341,283,350,283, 'fill'=>color, 'tags'=>['floor2','wall'])
+ w.create(TkcLine,321,275,341,275, 'fill'=>color, 'tags'=>['floor2','wall'])
+ w.create(TkcLine,375,275,395,275, 'fill'=>color, 'tags'=>['floor2','wall'])
+ w.create(TkcLine,315,129,315,170, 'fill'=>color, 'tags'=>['floor2','wall'])
+ w.create(TkcLine,376,170,307,170, 'fill'=>color, 'tags'=>['floor2','wall'])
+ w.create(TkcLine,307,250,307,170, 'fill'=>color, 'tags'=>['floor2','wall'])
+ w.create(TkcLine,376,245,376,170, 'fill'=>color, 'tags'=>['floor2','wall'])
+ w.create(TkcLine,340,241,307,241, 'fill'=>color, 'tags'=>['floor2','wall'])
+ w.create(TkcLine,340,245,340,224, 'fill'=>color, 'tags'=>['floor2','wall'])
+ w.create(TkcLine,340,210,340,201, 'fill'=>color, 'tags'=>['floor2','wall'])
+ w.create(TkcLine,340,187,340,170, 'fill'=>color, 'tags'=>['floor2','wall'])
+ w.create(TkcLine,340,206,307,206, 'fill'=>color, 'tags'=>['floor2','wall'])
+ w.create(TkcLine,293,250,307,250, 'fill'=>color, 'tags'=>['floor2','wall'])
+ w.create(TkcLine,271,179,238,179, 'fill'=>color, 'tags'=>['floor2','wall'])
+ w.create(TkcLine,226,179,195,179, 'fill'=>color, 'tags'=>['floor2','wall'])
+ w.create(TkcLine,176,129,176,179, 'fill'=>color, 'tags'=>['floor2','wall'])
+ w.create(TkcLine,182,179,176,179, 'fill'=>color, 'tags'=>['floor2','wall'])
+ w.create(TkcLine,174,169,176,169, 'fill'=>color, 'tags'=>['floor2','wall'])
+ w.create(TkcLine,162,169,90,169, 'fill'=>color, 'tags'=>['floor2','wall'])
+ w.create(TkcLine,96,169,96,129, 'fill'=>color, 'tags'=>['floor2','wall'])
+ w.create(TkcLine,175,227,90,227, 'fill'=>color, 'tags'=>['floor2','wall'])
+ w.create(TkcLine,90,190,90,227, 'fill'=>color, 'tags'=>['floor2','wall'])
+ w.create(TkcLine,52,179,3,179, 'fill'=>color, 'tags'=>['floor2','wall'])
+ w.create(TkcLine,52,228,3,228, 'fill'=>color, 'tags'=>['floor2','wall'])
+ w.create(TkcLine,52,276,3,276, 'fill'=>color, 'tags'=>['floor2','wall'])
+ w.create(TkcLine,155,177,155,169, 'fill'=>color, 'tags'=>['floor2','wall'])
+ w.create(TkcLine,110,191,110,169, 'fill'=>color, 'tags'=>['floor2','wall'])
+ w.create(TkcLine,155,189,155,197, 'fill'=>color, 'tags'=>['floor2','wall'])
+ w.create(TkcLine,350,283,350,329, 'fill'=>color, 'tags'=>['floor2','wall'])
+ w.create(TkcLine,162,197,155,197, 'fill'=>color, 'tags'=>['floor2','wall'])
+ w.create(TkcLine,341,275,341,283, 'fill'=>color, 'tags'=>['floor2','wall'])
+end
+
+# floor2_fg3 --
+# This method represents part of the floorplan database. When
+# invoked, it instantiates the foreground information for the third
+# floor (office outlines and numbers).
+#
+# Arguments:
+# w - The canvas window.
+# color - Color to use for drawing foreground information.
+
+def floor2_fg3(w,color)
+ i = TkcPolygon.new(w,89,228,89,180,70,180,70,228,
+ 'fill'=>'', 'tags'=>['floor3','room'])
+ $floorLabels2[i.id] = '316'
+ $floorItems2['316'] = i
+ w.create(TkcText,79.5,204, 'text'=>'316', 'fill'=>color,
+ 'anchor'=>'c', 'tags'=>['floor3','label'])
+ i = TkcPolygon.new(w,115,368,162,368,162,323,115,323,
+ 'fill'=>'', 'tags'=>['floor3','room'])
+ $floorLabels2[i.id] = '309'
+ $floorItems2['309'] = i
+ w.create(TkcText,138.5,345.5, 'text'=>'309', 'fill'=>color,
+ 'anchor'=>'c', 'tags'=>['floor3','label'])
+ i = TkcPolygon.new(w,164,323,164,368,211,368,211,323,
+ 'fill'=>'', 'tags'=>['floor3','room'])
+ $floorLabels2[i.id] = '308'
+ $floorItems2['308'] = i
+ w.create(TkcText,187.5,345.5, 'text'=>'308', 'fill'=>color,
+ 'anchor'=>'c', 'tags'=>['floor3','label'])
+ i = TkcPolygon.new(w,256,368,212,368,212,323,256,323,
+ 'fill'=>'', 'tags'=>['floor3','room'])
+ $floorLabels2[i.id] = '307'
+ $floorItems2['307'] = i
+ w.create(TkcText,234,345.5, 'text'=>'307', 'fill'=>color,
+ 'anchor'=>'c', 'tags'=>['floor3','label'])
+ i = TkcPolygon.new(w,244,276,297,276,297,327,260,327,260,321,244,321,
+ 'fill'=>'', 'tags'=>['floor3','room'])
+ $floorLabels2[i.id] = '305'
+ $floorItems2['305'] = i
+ w.create(TkcText,270.5,301.5, 'text'=>'305', 'fill'=>color,
+ 'anchor'=>'c', 'tags'=>['floor3','label'])
+ i = TkcPolygon.new(w,251,219,251,203,244,203,244,219,
+ 'fill'=>'', 'tags'=>['floor3','room'])
+ $floorLabels2[i.id] = '324B'
+ $floorItems2['324B'] = i
+ w.create(TkcText,247.5,211, 'text'=>'324B', 'fill'=>color,
+ 'anchor'=>'c', 'tags'=>['floor3','label'])
+ i = TkcPolygon.new(w,251,249,244,249,244,232,251,232,
+ 'fill'=>'', 'tags'=>['floor3','room'])
+ $floorLabels2[i.id] = '324A'
+ $floorItems2['324A'] = i
+ w.create(TkcText,247.5,240.5, 'text'=>'324A', 'fill'=>color,
+ 'anchor'=>'c', 'tags'=>['floor3','label'])
+ i = TkcPolygon.new(w,223,135,223,179,177,179,177,135,
+ 'fill'=>'', 'tags'=>['floor3','room'])
+ $floorLabels2[i.id] = '320'
+ $floorItems2['320'] = i
+ w.create(TkcText,200,157, 'text'=>'320', 'fill'=>color,
+ 'anchor'=>'c', 'tags'=>['floor3','label'])
+ i = TkcPolygon.new(w,114,368,114,323,67,323,67,368,
+ 'fill'=>'', 'tags'=>['floor3','room'])
+ $floorLabels2[i.id] = '310'
+ $floorItems2['310'] = i
+ w.create(TkcText,90.5,345.5, 'text'=>'310', 'fill'=>color,
+ 'anchor'=>'c', 'tags'=>['floor3','label'])
+ i = TkcPolygon.new(w,23,277,23,321,68,321,68,277,
+ 'fill'=>'', 'tags'=>['floor3','room'])
+ $floorLabels2[i.id] = '312'
+ $floorItems2['312'] = i
+ w.create(TkcText,45.5,299, 'text'=>'312', 'fill'=>color,
+ 'anchor'=>'c', 'tags'=>['floor3','label'])
+ i = TkcPolygon.new(w,23,229,68,229,68,275,23,275,
+ 'fill'=>'', 'tags'=>['floor3','room'])
+ $floorLabels2[i.id] = '313'
+ $floorItems2['313'] = i
+ w.create(TkcText,45.5,252, 'text'=>'313', 'fill'=>color,
+ 'anchor'=>'c', 'tags'=>['floor3','label'])
+ i = TkcPolygon.new(w,68,227,23,227,23,180,68,180,
+ 'fill'=>'', 'tags'=>['floor3','room'])
+ $floorLabels2[i.id] = '314'
+ $floorItems2['314'] = i
+ w.create(TkcText,40.5,203.5, 'text'=>'314', 'fill'=>color,
+ 'anchor'=>'c', 'tags'=>['floor3','label'])
+ i = TkcPolygon.new(w,95,179,95,135,23,135,23,179,
+ 'fill'=>'', 'tags'=>['floor3','room'])
+ $floorLabels2[i.id] = '315'
+ $floorItems2['315'] = i
+ w.create(TkcText,59,157, 'text'=>'315', 'fill'=>color,
+ 'anchor'=>'c', 'tags'=>['floor3','label'])
+ i = TkcPolygon.new(w,99,226,99,204,91,204,91,226,
+ 'fill'=>'', 'tags'=>['floor3','room'])
+ $floorLabels2[i.id] = '316B'
+ $floorItems2['316B'] = i
+ w.create(TkcText,95,215, 'text'=>'316B', 'fill'=>color,
+ 'anchor'=>'c', 'tags'=>['floor3','label'])
+ i = TkcPolygon.new(w,91,202,99,202,99,180,91,180,
+ 'fill'=>'', 'tags'=>['floor3','room'])
+ $floorLabels2[i.id] = '316A'
+ $floorItems2['316A'] = i
+ w.create(TkcText,95,191, 'text'=>'316A', 'fill'=>color,
+ 'anchor'=>'c', 'tags'=>['floor3','label'])
+ i = TkcPolygon.new(w,97,169,109,169,109,192,154,192,154,198,
+ 174,198,174,226,101,226,101,179,97,179,
+ 'fill'=>'', 'tags'=>['floor3','room'])
+ $floorLabels2[i.id] = '319'
+ $floorItems2['319'] = i
+ w.create(TkcText,141.5,209, 'text'=>'319', 'fill'=>color,
+ 'anchor'=>'c', 'tags'=>['floor3','label'])
+ i = TkcPolygon.new(w,65,368,58,368,58,389,1,389,1,333,23,333,23,323,65,323,
+ 'fill'=>'', 'tags'=>['floor3','room'])
+ $floorLabels2[i.id] = '311'
+ $floorItems2['311'] = i
+ w.create(TkcText,29.5,361, 'text'=>'311', 'fill'=>color,
+ 'anchor'=>'c', 'tags'=>['floor3','label'])
+ i = TkcPolygon.new(w,154,191,111,191,111,169,154,169,
+ 'fill'=>'', 'tags'=>['floor3','room'])
+ $floorLabels2[i.id] = '318'
+ $floorItems2['318'] = i
+ w.create(TkcText,132.5,180, 'text'=>'318', 'fill'=>color,
+ 'anchor'=>'c', 'tags'=>['floor3','label'])
+ i = TkcPolygon.new(w,175,168,97,168,97,131,175,131,
+ 'fill'=>'', 'tags'=>['floor3','room'])
+ $floorLabels2[i.id] = '317'
+ $floorItems2['317'] = i
+ w.create(TkcText,136,149.5, 'text'=>'317', 'fill'=>color,
+ 'anchor'=>'c', 'tags'=>['floor3','label'])
+ i = TkcPolygon.new(w,274,194,274,221,306,221,306,194,
+ 'fill'=>'', 'tags'=>['floor3','room'])
+ $floorLabels2[i.id] = '323'
+ $floorItems2['323'] = i
+ w.create(TkcText,290,207.5, 'text'=>'323', 'fill'=>color,
+ 'anchor'=>'c', 'tags'=>['floor3','label'])
+ i = TkcPolygon.new(w,306,222,274,222,274,249,306,249,
+ 'fill'=>'', 'tags'=>['floor3','room'])
+ $floorLabels2[i.id] = '325'
+ $floorItems2['325'] = i
+ w.create(TkcText,290,235.5, 'text'=>'325', 'fill'=>color,
+ 'anchor'=>'c', 'tags'=>['floor3','label'])
+ i = TkcPolygon.new(w,263,179,224,179,224,135,263,135,
+ 'fill'=>'', 'tags'=>['floor3','room'])
+ $floorLabels2[i.id] = '321'
+ $floorItems2['321'] = i
+ w.create(TkcText,243.5,157, 'text'=>'321', 'fill'=>color,
+ 'anchor'=>'c', 'tags'=>['floor3','label'])
+ i = TkcPolygon.new(w,314,169,306,169,306,192,273,192,
+ 264,181,264,135,314,135,
+ 'fill'=>'', 'tags'=>['floor3','room'])
+ $floorLabels2[i.id] = '322'
+ $floorItems2['322'] = i
+ w.create(TkcText,293.5,163.5, 'text'=>'322', 'fill'=>color,
+ 'anchor'=>'c', 'tags'=>['floor3','label'])
+ i = TkcPolygon.new(w,307,240,339,240,339,206,307,206,
+ 'fill'=>'', 'tags'=>['floor3','room'])
+ $floorLabels2[i.id] = 'Pub Lift3'
+ $floorItems2['Pub Lift3'] = i
+ w.create(TkcText,323,223, 'text'=>'Pub Lift3', 'fill'=>color,
+ 'anchor'=>'c', 'tags'=>['floor3','label'])
+ i = TkcPolygon.new(w,339,205,307,205,307,171,339,171,
+ 'fill'=>'', 'tags'=>['floor3','room'])
+ $floorLabels2[i.id] = 'Priv Lift3'
+ $floorItems2['Priv Lift3'] = i
+ w.create(TkcText,323,188, 'text'=>'Priv Lift3', 'fill'=>color,
+ 'anchor'=>'c', 'tags'=>['floor3','label'])
+ i = TkcPolygon.new(w,350,284,376,284,376,276,397,276,397,309,350,309,
+ 'fill'=>'', 'tags'=>['floor3','room'])
+ $floorLabels2[i.id] = '303'
+ $floorItems2['303'] = i
+ w.create(TkcText,373.5,292.5, 'text'=>'303', 'fill'=>color,
+ 'anchor'=>'c', 'tags'=>['floor3','label'])
+ i = TkcPolygon.new(w,272,203,272,249,252,249,252,230,
+ 244,230,244,221,252,221,252,203,
+ 'fill'=>'', 'tags'=>['floor3','room'])
+ $floorLabels2[i.id] = '324'
+ $floorItems2['324'] = i
+ w.create(TkcText,262,226, 'text'=>'324', 'fill'=>color,
+ 'anchor'=>'c', 'tags'=>['floor3','label'])
+ i = TkcPolygon.new(w,299,276,299,327,349,327,349,284,341,284,341,276,
+ 'fill'=>'', 'tags'=>['floor3','room'])
+ $floorLabels2[i.id] = '304'
+ $floorItems2['304'] = i
+ w.create(TkcText,324,301.5, 'text'=>'304', 'fill'=>color,
+ 'anchor'=>'c', 'tags'=>['floor3','label'])
+ i = TkcPolygon.new(w,375,246,375,172,341,172,341,246,
+ 'fill'=>'', 'tags'=>['floor3','room'])
+ $floorLabels2[i.id] = '301'
+ $floorItems2['301'] = i
+ w.create(TkcText,358,209, 'text'=>'301', 'fill'=>color,
+ 'anchor'=>'c', 'tags'=>['floor3','label'])
+ i = TkcPolygon.new(w,397,246,377,246,377,185,397,185,
+ 'fill'=>'', 'tags'=>['floor3','room'])
+ $floorLabels2[i.id] = '327'
+ $floorItems2['327'] = i
+ w.create(TkcText,387,215.5, 'text'=>'327', 'fill'=>color,
+ 'anchor'=>'c', 'tags'=>['floor3','label'])
+ i = TkcPolygon.new(w,316,131,316,169,377,169,377,185,397,185,397,131,
+ 'fill'=>'', 'tags'=>['floor3','room'])
+ $floorLabels2[i.id] = '326'
+ $floorItems2['326'] = i
+ w.create(TkcText,365.5,150, 'text'=>'326', 'fill'=>color,
+ 'anchor'=>'c', 'tags'=>['floor3','label'])
+ i = TkcPolygon.new(w,308,251,242,251,242,274,342,274,342,282,375, 282,
+ 375,274,397,274,397,248,339,248,339,242,308,242,
+ 'fill'=>'', 'tags'=>['floor3','room'])
+ $floorLabels2[i.id] = '302'
+ $floorItems2['302'] = i
+ w.create(TkcText,319.5,261, 'text'=>'302', 'fill'=>color,
+ 'anchor'=>'c', 'tags'=>['floor3','label'])
+ i = TkcPolygon.new(w,70,321,242,321,242,200,259,200,259,203,272,203,
+ 272,193,263,180,242,180,175,180,175,169,156,169,
+ 156,196,177,196,177,228,107,228,70,228,70,275,107,275,
+ 107,248,160,248,160,301,107,301,107,275,70,275,
+ 'fill'=>'', 'tags'=>['floor3','room'])
+ $floorLabels2[i.id] = '306'
+ $floorItems2['306'] = i
+ w.create(TkcText,200.5,284.5, 'text'=>'306', 'fill'=>color,
+ 'anchor'=>'c', 'tags'=>['floor3','label'])
+ w.create(TkcLine,341,275,341,283, 'fill'=>color, 'tags'=>['floor3','wall'])
+ w.create(TkcLine,162,197,155,197, 'fill'=>color, 'tags'=>['floor3','wall'])
+ w.create(TkcLine,396,247,399,247, 'fill'=>color, 'tags'=>['floor3','wall'])
+ w.create(TkcLine,399,129,399,311, 'fill'=>color, 'tags'=>['floor3','wall'])
+ w.create(TkcLine,258,202,243,202, 'fill'=>color, 'tags'=>['floor3','wall'])
+ w.create(TkcLine,350,283,350,329, 'fill'=>color, 'tags'=>['floor3','wall'])
+ w.create(TkcLine,251,231,243,231, 'fill'=>color, 'tags'=>['floor3','wall'])
+ w.create(TkcLine,243,220,251,220, 'fill'=>color, 'tags'=>['floor3','wall'])
+ w.create(TkcLine,243,250,243,202, 'fill'=>color, 'tags'=>['floor3','wall'])
+ w.create(TkcLine,155,197,155,190, 'fill'=>color, 'tags'=>['floor3','wall'])
+ w.create(TkcLine,110,192,110,169, 'fill'=>color, 'tags'=>['floor3','wall'])
+ w.create(TkcLine,155,192,110,192, 'fill'=>color, 'tags'=>['floor3','wall'])
+ w.create(TkcLine,155,177,155,169, 'fill'=>color, 'tags'=>['floor3','wall'])
+ w.create(TkcLine,176,197,176,227, 'fill'=>color, 'tags'=>['floor3','wall'])
+ w.create(TkcLine,69,280,69,274, 'fill'=>color, 'tags'=>['floor3','wall'])
+ w.create(TkcLine,21,276,69,276, 'fill'=>color, 'tags'=>['floor3','wall'])
+ w.create(TkcLine,69,262,69,226, 'fill'=>color, 'tags'=>['floor3','wall'])
+ w.create(TkcLine,21,228,69,228, 'fill'=>color, 'tags'=>['floor3','wall'])
+ w.create(TkcLine,21,179,75,179, 'fill'=>color, 'tags'=>['floor3','wall'])
+ w.create(TkcLine,69,179,69,214, 'fill'=>color, 'tags'=>['floor3','wall'])
+ w.create(TkcLine,90,220,90,227, 'fill'=>color, 'tags'=>['floor3','wall'])
+ w.create(TkcLine,90,204,90,202, 'fill'=>color, 'tags'=>['floor3','wall'])
+ w.create(TkcLine,90,203,100,203, 'fill'=>color, 'tags'=>['floor3','wall'])
+ w.create(TkcLine,90,187,90,179, 'fill'=>color, 'tags'=>['floor3','wall'])
+ w.create(TkcLine,90,227,176,227, 'fill'=>color, 'tags'=>['floor3','wall'])
+ w.create(TkcLine,100,179,100,227, 'fill'=>color, 'tags'=>['floor3','wall'])
+ w.create(TkcLine,100,179,87,179, 'fill'=>color, 'tags'=>['floor3','wall'])
+ w.create(TkcLine,96,179,96,129, 'fill'=>color, 'tags'=>['floor3','wall'])
+ w.create(TkcLine,162,169,96,169, 'fill'=>color, 'tags'=>['floor3','wall'])
+ w.create(TkcLine,173,169,176,169, 'fill'=>color, 'tags'=>['floor3','wall'])
+ w.create(TkcLine,182,179,176,179, 'fill'=>color, 'tags'=>['floor3','wall'])
+ w.create(TkcLine,176,129,176,179, 'fill'=>color, 'tags'=>['floor3','wall'])
+ w.create(TkcLine,195,179,226,179, 'fill'=>color, 'tags'=>['floor3','wall'])
+ w.create(TkcLine,224,133,224,179, 'fill'=>color, 'tags'=>['floor3','wall'])
+ w.create(TkcLine,264,179,264,133, 'fill'=>color, 'tags'=>['floor3','wall'])
+ w.create(TkcLine,238,179,264,179, 'fill'=>color, 'tags'=>['floor3','wall'])
+ w.create(TkcLine,273,207,273,193, 'fill'=>color, 'tags'=>['floor3','wall'])
+ w.create(TkcLine,273,235,273,250, 'fill'=>color, 'tags'=>['floor3','wall'])
+ w.create(TkcLine,273,224,273,219, 'fill'=>color, 'tags'=>['floor3','wall'])
+ w.create(TkcLine,273,193,307,193, 'fill'=>color, 'tags'=>['floor3','wall'])
+ w.create(TkcLine,273,222,307,222, 'fill'=>color, 'tags'=>['floor3','wall'])
+ w.create(TkcLine,273,250,307,250, 'fill'=>color, 'tags'=>['floor3','wall'])
+ w.create(TkcLine,384,247,376,247, 'fill'=>color, 'tags'=>['floor3','wall'])
+ w.create(TkcLine,340,206,307,206, 'fill'=>color, 'tags'=>['floor3','wall'])
+ w.create(TkcLine,340,187,340,170, 'fill'=>color, 'tags'=>['floor3','wall'])
+ w.create(TkcLine,340,210,340,201, 'fill'=>color, 'tags'=>['floor3','wall'])
+ w.create(TkcLine,340,247,340,224, 'fill'=>color, 'tags'=>['floor3','wall'])
+ w.create(TkcLine,340,241,307,241, 'fill'=>color, 'tags'=>['floor3','wall'])
+ w.create(TkcLine,376,247,376,170, 'fill'=>color, 'tags'=>['floor3','wall'])
+ w.create(TkcLine,307,250,307,170, 'fill'=>color, 'tags'=>['floor3','wall'])
+ w.create(TkcLine,376,170,307,170, 'fill'=>color, 'tags'=>['floor3','wall'])
+ w.create(TkcLine,315,129,315,170, 'fill'=>color, 'tags'=>['floor3','wall'])
+ w.create(TkcLine,376,283,366,283, 'fill'=>color, 'tags'=>['floor3','wall'])
+ w.create(TkcLine,376,283,376,275, 'fill'=>color, 'tags'=>['floor3','wall'])
+ w.create(TkcLine,399,275,376,275, 'fill'=>color, 'tags'=>['floor3','wall'])
+ w.create(TkcLine,341,275,320,275, 'fill'=>color, 'tags'=>['floor3','wall'])
+ w.create(TkcLine,341,283,350,283, 'fill'=>color, 'tags'=>['floor3','wall'])
+ w.create(TkcLine,298,275,298,329, 'fill'=>color, 'tags'=>['floor3','wall'])
+ w.create(TkcLine,308,275,298,275, 'fill'=>color, 'tags'=>['floor3','wall'])
+ w.create(TkcLine,243,322,243,275, 'fill'=>color, 'tags'=>['floor3','wall'])
+ w.create(TkcLine,243,275,284,275, 'fill'=>color, 'tags'=>['floor3','wall'])
+ w.create(TkcLine,258,322,226,322, 'fill'=>color, 'tags'=>['floor3','wall'])
+ w.create(TkcLine,212,370,212,322, 'fill'=>color, 'tags'=>['floor3','wall'])
+ w.create(TkcLine,214,322,177,322, 'fill'=>color, 'tags'=>['floor3','wall'])
+ w.create(TkcLine,163,370,163,322, 'fill'=>color, 'tags'=>['floor3','wall'])
+ w.create(TkcLine,165,322,129,322, 'fill'=>color, 'tags'=>['floor3','wall'])
+ w.create(TkcLine,84,322,117,322, 'fill'=>color, 'tags'=>['floor3','wall'])
+ w.create(TkcLine,71,322,64,322, 'fill'=>color, 'tags'=>['floor3','wall'])
+ w.create(TkcLine,115,322,115,370, 'fill'=>color, 'tags'=>['floor3','wall'])
+ w.create(TkcLine,66,322,66,370, 'fill'=>color, 'tags'=>['floor3','wall'])
+ w.create(TkcLine,52,322,21,322, 'fill'=>color, 'tags'=>['floor3','wall'])
+ w.create(TkcLine,21,331,0,331, 'fill'=>color, 'tags'=>['floor3','wall'])
+ w.create(TkcLine,21,331,21,133, 'fill'=>color, 'tags'=>['floor3','wall'])
+ w.create(TkcLine,96,133,21,133, 'fill'=>color, 'tags'=>['floor3','wall'])
+ w.create(TkcLine,176,129,96,129, 'fill'=>color, 'tags'=>['floor3','wall'])
+ w.create(TkcLine,315,133,176,133, 'fill'=>color, 'tags'=>['floor3','wall'])
+ w.create(TkcLine,315,129,399,129, 'fill'=>color, 'tags'=>['floor3','wall'])
+ w.create(TkcLine,399,311,350,311, 'fill'=>color, 'tags'=>['floor3','wall'])
+ w.create(TkcLine,350,329,258,329, 'fill'=>color, 'tags'=>['floor3','wall'])
+ w.create(TkcLine,258,322,258,370, 'fill'=>color, 'tags'=>['floor3','wall'])
+ w.create(TkcLine,60,370,258,370, 'fill'=>color, 'tags'=>['floor3','wall'])
+ w.create(TkcLine,60,370,60,391, 'fill'=>color, 'tags'=>['floor3','wall'])
+ w.create(TkcLine,0,391,0,331, 'fill'=>color, 'tags'=>['floor3','wall'])
+ w.create(TkcLine,60,391,0,391, 'fill'=>color, 'tags'=>['floor3','wall'])
+ w.create(TkcLine,307,250,307,242, 'fill'=>color, 'tags'=>['floor3','wall'])
+ w.create(TkcLine,273,250,307,250, 'fill'=>color, 'tags'=>['floor3','wall'])
+ w.create(TkcLine,258,250,243,250, 'fill'=>color, 'tags'=>['floor3','wall'])
+end
+
+# Below is the "main program" that creates the floorplan demonstration.
+
+# toplevel widget
+if defined?($floor2_demo) && $floor2_demo
+ $floor2_demo.destroy
+ $floor2_demo = nil
+end
+
+# demo toplevel widget
+$floor2_demo = TkToplevel.new {|w|
+ title("Floorplan Canvas Demonstration 2")
+ iconname("Floorplan2")
+ positionWindow(w)
+ geometry('+20+20')
+ minsize(100,100)
+}
+
+# label
+TkLabel.new($floor2_demo, 'font'=>$font, 'wraplength'=>'8i', 'justify'=>'left',
+ 'text'=>"This window contains a canvas widget showing the floorplan of Digital Equipment Corporation's Western Research Laboratory. It has three levels. At any given time one of the levels is active, meaning that you can see its room structure. To activate a level, click the left mouse button anywhere on it. As the mouse moves over the active level, the room under the mouse lights up and its room number appears in the \"Room:\" entry. You can also type a room number in the entry and the room will light up."){
+ pack('side'=>'top')
+}
+
+# frame
+$floor2_buttons = TkFrame.new($floor2_demo) {|frame|
+ TkButton.new(frame) {
+ text 'Dismiss'
+ command proc{
+ tmppath = $floor2_demo
+ $floor2_demo = nil
+ tmppath.destroy
+ }
+ }.pack('side'=>'left', 'expand'=>'yes')
+
+ TkButton.new(frame) {
+ text 'Show Code'
+ command proc{showCode 'floor2'}
+ }.pack('side'=>'left', 'expand'=>'yes')
+}
+$floor2_buttons.pack('side'=>'bottom', 'fill'=>'x', 'pady'=>'2m')
+
+#
+$floorLabels2 = {}
+$floorItems2 = {}
+
+# canvas
+if $tk_version =~ /^4\.[01]/
+ $floor2_canvas_frame = TkFrame.new($floor2_demo,'bd'=>2,'relief'=>'sunken',
+ 'highlightthickness'=>2)
+ $floor2_canvas = TkCanvas.new($floor2_canvas_frame,
+ 'width'=>900, 'height'=>500, 'borderwidth'=>0,
+ 'highlightthickness'=>0) {|c|
+ TkScrollbar.new($floor2_demo, 'orient'=>'horiz',
+ 'command'=>proc{|*args| c.xview(*args)}){|hs|
+ c.xscrollcommand(proc{|first,last| hs.set first,last})
+ pack('side'=>'bottom', 'fill'=>'x')
+ }
+ TkScrollbar.new($floor2_demo, 'command'=>proc{|*args| c.yview(*args)}){|vs|
+ c.yscrollcommand(proc{|first,last| vs.set first,last})
+ pack('side'=>'right', 'fill'=>'y')
+ }
+ }
+ $floor2_canvas_frame.pack('side'=>'top','fill'=>'both', 'expand'=>'yes')
+ $floor2_canvas.pack('expand'=>'yes', 'fill'=>'both')
+
+else
+ TkFrame.new($floor2_demo) {|f|
+ pack('side'=>'top', 'fill'=>'both', 'expand'=>'yes')
+
+ h = TkScrollbar.new(f, 'highlightthickness'=>0, 'orient'=>'horizontal')
+ v = TkScrollbar.new(f, 'highlightthickness'=>0, 'orient'=>'vertical')
+
+ TkFrame.new(f, 'bd'=>2, 'relief'=>'sunken') {|f1|
+ $floor2_canvas = TkCanvas.new(f1, 'width'=>900, 'height'=>500,
+ 'borderwidth'=>0,
+ 'highlightthickness'=>0) {
+ xscrollcommand(proc{|first,last| h.set first,last})
+ yscrollcommand(proc{|first,last| v.set first,last})
+ pack('expand'=>'yes', 'fill'=>'both')
+ }
+ grid('padx'=>1, 'pady'=>1, 'row'=>0, 'column'=>0,
+ 'rowspan'=>1, 'columnspan'=>1, 'sticky'=>'news')
+ }
+
+ v.grid('padx'=>1, 'pady'=>1, 'row'=>0, 'column'=>1,
+ 'rowspan'=>1, 'columnspan'=>1, 'sticky'=>'news')
+ h.grid('padx'=>1, 'pady'=>1, 'row'=>1, 'column'=>0,
+ 'rowspan'=>1, 'columnspan'=>1, 'sticky'=>'news')
+
+ TkGrid.rowconfigure(f, 0, 'weight'=>1, 'minsize'=>0)
+ TkGrid.columnconfigure(f, 0, 'weight'=>1, 'minsize'=>0)
+
+ pack('expand'=>'yes', 'fill'=>'both', 'padx'=>1, 'pady'=>1)
+
+ v.command(proc{|*args| c.yview(*args)})
+ h.command(proc{|*args| c.xview(*args)})
+ }
+end
+
+
+# Create an entry for displaying and typing in current room.
+
+$currentRoom2 = TkVariable.new
+$floor2_entry = TkEntry.new($floor2_canvas, 'width'=>10, 'relief'=>'sunken',
+ 'bd'=>2, 'textvariable'=>$currentRoom2)
+
+# Choose colors, then fill in the floorplan.
+
+$floor2_colors = {}
+if TkWinfo.depth($floor2_canvas) > 1
+ $floor2_colors['bg1'] = '#a9c1da'
+ $floor2_colors['outline1'] = '#77889a'
+ $floor2_colors['bg2'] = '#9ab0c6'
+ $floor2_colors['outline2'] = '#687786'
+ $floor2_colors['bg3'] = '#8ba0b3'
+ $floor2_colors['outline3'] = '#596673'
+ $floor2_colors['offices'] = 'Black'
+ $floor2_colors['active'] = '#c4d1df'
+else
+ $floor2_colors['bg1'] = 'white'
+ $floor2_colors['outline1'] = 'black'
+ $floor2_colors['bg2'] = 'white'
+ $floor2_colors['outline2'] = 'black'
+ $floor2_colors['bg3'] = 'white'
+ $floor2_colors['outline3'] = 'black'
+ $floor2_colors['offices'] = 'Black'
+ $floor2_colors['active'] = 'black'
+end
+
+$activeFloor2 = ''
+floorDisplay2 $floor2_canvas,3
+
+# Set up event bindings for canvas:
+
+$floor2_canvas.itembind('floor1', '1', proc{floorDisplay2 $floor2_canvas,1})
+$floor2_canvas.itembind('floor2', '1', proc{floorDisplay2 $floor2_canvas,2})
+$floor2_canvas.itembind('floor3', '1', proc{floorDisplay2 $floor2_canvas,3})
+$floor2_canvas.itembind('room', 'Enter', proc{newRoom2 $floor2_canvas})
+$floor2_canvas.itembind('room', 'Leave', proc{$currentRoom2.value = ''})
+$floor2_canvas.bind('2', proc{|x,y| $floor2_canvas.scan_mark x,y}, '%x %y')
+$floor2_canvas.bind('B2-Motion',
+ proc{|x,y| $floor2_canvas.scan_dragto x,y}, '%x %y')
+$floor2_canvas.bind('Destroy', proc{$currentRoom2.unset})
+$currentRoom2.value = ''
+$currentRoom2.trace('w',proc{roomChanged2 $floor2_canvas})
diff --git a/ext/tk/sample/demos-en/radio3.rb b/ext/tk/sample/demos-en/radio3.rb
new file mode 100644
index 0000000000..ca0453416c
--- /dev/null
+++ b/ext/tk/sample/demos-en/radio3.rb
@@ -0,0 +1,114 @@
+# radio3.rb
+#
+# This demonstration script creates a toplevel window containing
+# several radiobutton widgets.
+#
+# radiobutton widget demo (called by 'widget')
+#
+
+# toplevel widget
+if defined?($radio3_demo) && $radio3_demo
+ $radio3_demo.destroy
+ $radio3_demo = nil
+end
+
+# demo toplevel widget
+$radio3_demo = TkToplevel.new {|w|
+ title("Radiobutton Demonstration 3")
+ iconname("radio3")
+ positionWindow(w)
+}
+
+# label
+msg = TkLabel.new($radio3_demo) {
+ font $font
+ wraplength '5i'
+ justify 'left'
+ text "Three groups of radiobuttons are displayed below. If you click on a button then the button will become selected exclusively among all the buttons in its group. A Tcl variable is associated with each group to indicate which of the group's buttons is selected. When the 'Tristate' button is pressed, the radio buttons will display the tri-state mode. Selecting any radio button will return the buttons to their respective on/off state. Click the \"See Variables\" button to see the current values of the variables."
+}
+msg.grid(:row=>0, :column=>0, :columnspan=>3, :sticky=>'nsew')
+
+# variable
+size = TkVariable.new
+color = TkVariable.new
+align = TkVariable.new
+
+# frame
+TkFrame.new($radio3_demo) {|frame|
+ TkGrid(TkFrame.new(frame, :height=>2, :relief=>:sunken, :bd=>2),
+ :columnspan=>4, :row=>0, :sticky=>'ew', :pady=>2)
+ TkGrid('x',
+ TkButton.new(frame, :text=>'See Variables',
+ :image=>$image['view'], :compound=>:left,
+ :command=>proc{
+ showVars($radio3_demo, ['size', size],
+ ['color', color], ['compound', align])
+ }),
+ TkButton.new(frame, :text=>'See Code',
+ :image=>$image['view'], :compound=>:left,
+ :command=>proc{showCode 'radio3'}),
+ TkButton.new(frame, :text=>'Dismiss',
+ :image=>$image['delete'], :compound=>:left,
+ :command=>proc{
+ tmppath = $radio3_demo
+ $radio3_demo = nil
+ $showVarsWin[tmppath.path] = nil
+ tmppath.destroy
+ }),
+ :padx=>4, :pady=>4)
+ frame.grid_columnconfigure(0, :weight=>1)
+ TkGrid(frame, :row=>3, :column=>0, :columnspan=>3, :sticky=>'nsew')
+}
+
+# frame
+f_left = TkLabelFrame.new($radio3_demo, 'text'=>'Point Size',
+ 'pady'=>2, 'padx'=>2)
+f_mid = TkLabelFrame.new($radio3_demo, 'text'=>'Color',
+ 'pady'=>2, 'padx'=>2)
+f_right = TkLabelFrame.new($radio3_demo, 'text'=>'Alignment',
+ 'pady'=>2, 'padx'=>2)
+f_left .grid('column'=>0, 'row'=>1, 'pady'=>'.5c', 'padx'=>'.5c', 'rowspan'=>2)
+f_mid .grid('column'=>1, 'row'=>1, 'pady'=>'.5c', 'padx'=>'.5c', 'rowspan'=>2)
+f_right.grid('column'=>2, 'row'=>1, 'pady'=>'.5c', 'padx'=>'.5c')
+
+TkButton.new($radio3_demo, 'text'=>'Tristate',
+ 'command'=>proc{size.value = 'multi'; color.value = 'multi'}){
+ grid('column'=>2, 'row'=>2, 'pady'=>'.5c', 'padx'=>'.5c')
+}
+
+# radiobutton
+[10, 12, 14, 18, 24].each {|sz|
+ TkRadioButton.new(f_left) {
+ text "Point Size #{sz}"
+ variable size
+ relief 'flat'
+ value sz
+ tristatevalue 'multi'
+ }.pack('side'=>'top', 'pady'=>2, 'anchor'=>'w', 'fill'=>'x')
+}
+
+['Red', 'Green', 'Blue', 'Yellow', 'Orange', 'Purple'].each {|col|
+ TkRadioButton.new(f_mid) {
+ text col
+ variable color
+ relief 'flat'
+ value col.downcase
+ anchor 'w'
+ tristatevalue 'multi'
+ command proc{f_mid.fg(color.value)}
+ }.pack('side'=>'top', 'pady'=>2, 'fill'=>'x')
+}
+
+label = TkLabel.new(f_right, 'text'=>'Label', 'bitmap'=>'questhead',
+ 'compound'=>'left')
+label.configure('width'=>TkWinfo.reqwidth(label), 'compound'=>'top')
+label.height(TkWinfo.reqheight(label))
+a_btn = ['Top', 'Left', 'Right', 'Bottom'].collect{|a|
+ TkRadioButton.new(f_right, 'text'=>a, 'variable'=>align, 'relief'=>'flat',
+ 'value'=>a.downcase, 'indicatoron'=>0, 'width'=>7,
+ 'command'=>proc{label.compound(align.value)})
+}
+
+Tk.grid('x', a_btn[0])
+Tk.grid(a_btn[1], label, a_btn[2])
+Tk.grid('x', a_btn[3])
diff --git a/ext/tk/sample/demos-en/twind2.rb b/ext/tk/sample/demos-en/twind2.rb
new file mode 100644
index 0000000000..95b11a799f
--- /dev/null
+++ b/ext/tk/sample/demos-en/twind2.rb
@@ -0,0 +1,382 @@
+#
+# text (embedded windows) widget demo 2 (called by 'widget')
+#
+
+# delete toplevel widget
+if defined?($twind2_demo) && $twind2_demo
+ $twind2_demo.destroy
+ $twind2_demo = nil
+end
+
+# demo toplevel widget
+$twind2_demo = TkToplevel.new {|w|
+ title("Text Demonstration - Embedded Windows 2")
+ iconname("Embedded Windows")
+ positionWindow(w)
+}
+
+# frame
+$twind2_buttons = TkFrame.new($twind2_demo) {|frame|
+ TkGrid(TkFrame.new(frame, :height=>2, :relief=>:sunken, :bd=>2),
+ :columnspan=>4, :row=>0, :sticky=>'ew', :pady=>2)
+ TkGrid('x',
+ TkButton.new(frame, :text=>'See Code',
+ :image=>$image['view'], :compound=>:left,
+ :command=>proc{showCode 'twind2'}),
+ TkButton.new(frame, :text=>'Dismiss',
+ :image=>$image['delete'], :compound=>:left,
+ :command=>proc{
+ tmppath = $twind2_demo
+ $twind2_demo = nil
+ $showVarsWin[tmppath.path] = nil
+ tmppath.destroy
+ }),
+ :padx=>4, :pady=>4)
+ frame.grid_columnconfigure(0, :weight=>1)
+}
+$twind2_buttons.pack('side'=>'bottom', 'fill'=>'x', 'pady'=>'2m')
+
+# frame
+$twind2_text = nil
+TkFrame.new($twind2_demo, 'highlightthickness'=>2, 'borderwidth'=>2,
+ 'relief'=>'sunken') {|f|
+ $twind2_text = TkText.new(f, 'setgrid'=>true, 'font'=>$font,
+ # 'width'=>'70', 'height'=>35, 'wrap'=>'word',
+ 'width'=>'70', 'height'=>35, 'wrap'=>'char',
+ 'highlightthickness'=>0, 'borderwidth'=>0 ){|t|
+ TkScrollbar.new(f) {|s|
+ command proc{|*args| t.yview(*args)}
+ t.yscrollcommand proc{|first,last| s.set first,last}
+ }.pack('side'=>'right', 'fill'=>'y')
+ }.pack('expand'=>'yes', 'fill'=>'both')
+}.pack('expand'=>'yes', 'fill'=>'both')
+
+# text tags
+$tag2_center = TkTextTag.new($twind2_text,
+ 'justify' =>'center',
+ 'spacing1'=>'5m',
+ 'spacing3'=>'5m' )
+$tag2_buttons = TkTextTag.new($twind2_text,
+ 'lmargin1'=>'1c',
+ 'lmargin2'=>'1c',
+ 'rmargin' =>'1c',
+ 'spacing1'=>'3m',
+ 'spacing2'=>0,
+ 'spacing3'=>0 )
+
+# insert text
+$twind2_text.insert('end',
+ 'A text widget can contain many different kinds of items, ')
+$twind2_text.insert('end',
+ "both active and passive. It can lay these out in various ")
+$twind2_text.insert('end',
+ "ways, with wrapping, tabs, centering, etc. In addition, ")
+$twind2_text.insert('end',
+ "when the contents are too big for the window, smooth ")
+$twind2_text.insert('end', "scrolling in all directions is provided.\n\n")
+
+$twind2_text.insert('end', "A text widget can contain other widgets embedded ")
+$twind2_text.insert('end', "it. These are called \"embedded windows\", ")
+$twind2_text.insert('end', "and they can consist of arbitrary widgets. ")
+$twind2_text.insert('end', "For example, here are two embedded button ")
+$twind2_text.insert('end', "widgets. You can click on the first button to ")
+TkTextWindow.new($twind2_text, 'end',
+ 'window'=>TkButton.new($twind2_text) {
+ text 'ON'
+ command proc{textWindOn2 $twind2_text,$twind2_buttons}
+ cursor 'top_left_arrow'
+ })
+$twind2_text.insert('end', " horizontal scrolling, which also turns off ")
+$twind2_text.insert('end', "word wrapping. Or, you can click on the second ")
+$twind2_text.insert('end', "button to\n")
+TkTextWindow.new($twind2_text, 'end',
+ 'window'=>TkButton.new($twind2_text) {
+ text 'OFF'
+ command proc{textWindOff2 $twind2_text}
+ cursor 'top_left_arrow'
+ })
+$twind2_text.insert('end',
+ " horizontal scrolling and turn back on word wrapping.\n\n")
+
+$twind2_text.insert('end', "Or, here is another example. If you ")
+TkTextWindow.new($twind2_text, 'end',
+ 'window'=>TkButton.new($twind2_text) {
+ text 'Click Here'
+ command proc{textWindPlot2 $twind2_text}
+ cursor 'top_left_arrow'
+ })
+$twind2_text.insert('end',
+ " a canvas displaying an x-y plot will appear right here.")
+$mark2_plot = TkTextMark.new($twind2_text, 'insert')
+$mark2_plot.gravity='left'
+$twind2_text.insert('end',
+ " You can drag the data points around with the mouse, ")
+$twind2_text.insert('end', "or you can click here to ")
+TkTextWindow.new($twind2_text, 'end',
+ 'window'=>TkButton.new($twind2_text) {
+ text 'Delete'
+ command proc{textWindDel2 $twind2_text}
+ cursor 'top_left_arrow'
+ })
+$twind2_text.insert('end', " the plot again.\n\n")
+
+$twind2_text.insert('end',
+ "You may also find it useful to put embedded windows in ")
+$twind2_text.insert('end',
+ "a text without any actual text. In this case the ")
+$twind2_text.insert('end', "text widget acts like a geometry manager. For ")
+$twind2_text.insert('end',
+ "example, here is a collection of buttons laid out ")
+$twind2_text.insert('end',
+ "neatly into rows by the text widget. These buttons ")
+$twind2_text.insert('end',
+ "can be used to change the background color of the ")
+$twind2_text.insert('end', "text widget (\"Default\" restores the color to ")
+$twind2_text.insert('end',
+ "its default). If you click on the button labeled ")
+$twind2_text.insert('end', "\"Short\", it changes to a longer string so that ")
+$twind2_text.insert('end', "you can see how the text widget automatically ")
+$twind2_text.insert('end', "changes the layout. Click on the button again ")
+$twind2_text.insert('end', "to restore the short string.\n")
+
+btn_default = TkButton.new($twind2_text) {|b|
+ text 'Default'
+ command proc{embDefBg2 $twind2_text}
+ cursor 'top_left_arrow'
+}
+TkTextWindow.new($twind2_text, 'end', 'window'=>btn_default, 'padx'=>3)
+embToggle = TkVariable.new('Short')
+TkTextWindow.new($twind2_text, 'end',
+ 'window'=>TkCheckButton.new($twind2_text) {
+ textvariable embToggle
+ indicatoron 0
+ variable embToggle
+ onvalue 'A much longer string'
+ offvalue 'Short'
+ cursor 'top_left_arrow'
+ pady 5
+ padx 2
+ },
+ 'padx'=>3,
+ 'pady'=>2 )
+
+[ 'AntiqueWhite3', 'Bisque1', 'Bisque2', 'Bisque3', 'Bisque4',
+ 'SlateBlue3', 'RoyalBlue1', 'SteelBlue2', 'DeepSkyBlue3', 'LightBlue1',
+ 'DarkSlateGray1', 'Aquamarine2', 'DarkSeaGreen2', 'SeaGreen1',
+ 'Yellow1', 'IndianRed1', 'IndianRed2', 'Tan1', 'Tan4'
+].each{|twind_color|
+ TkTextWindow.new($twind2_text, 'end',
+ 'window'=>TkButton.new($twind2_text) {
+ text twind_color
+ cursor 'top_left_arrow'
+ command proc{$twind2_text.bg twind_color}
+ },
+ 'padx'=>3,
+ 'pady'=>2 )
+}
+
+$tag2_buttons.add(btn_default, 'end')
+
+$text_normal2 = {}
+$text_normal2['border'] = $twind2_text.cget('borderwidth')
+$text_normal2['highlight'] = $twind2_text.cget('highlightthickness')
+$text_normal2['pad'] = $twind2_text.cget('padx')
+
+$twind2_text.insert('end', "\nYou can also change the usual border width and ")
+$twind2_text.insert('end', "highlightthickness and padding.\n")
+
+TkTextWindow.new($twind2_text, 'end',
+ 'window'=>TkButton.new($twind2_text, :text=>"Big borders",
+ :cursor=>'top_left_arrow',
+ 'command'=>proc{
+ textWinBigB2 $twind2_text
+ }))
+
+TkTextWindow.new($twind2_text, 'end',
+ 'window'=>TkButton.new($twind2_text, :text=>"Small borders",
+ :cursor=>'top_left_arrow',
+ 'command'=>proc{
+ textWinSmallB2 $twind2_text
+ }))
+
+TkTextWindow.new($twind2_text, 'end',
+ 'window'=>TkButton.new($twind2_text, :text=>"Big highlight",
+ :cursor=>'top_left_arrow',
+ 'command'=>proc{
+ textWinBigH2 $twind2_text
+ }))
+
+TkTextWindow.new($twind2_text, 'end',
+ 'window'=>TkButton.new($twind2_text, :text=>"Small highlight",
+ :cursor=>'top_left_arrow',
+ 'command'=>proc{
+ textWinSmallH2 $twind2_text
+ }))
+
+TkTextWindow.new($twind2_text, 'end',
+ 'window'=>TkButton.new($twind2_text, :text=>"Big pad",
+ :cursor=>'top_left_arrow',
+ 'command'=>proc{
+ textWinBigP2 $twind2_text
+ }))
+
+TkTextWindow.new($twind2_text, 'end',
+ 'window'=>TkButton.new($twind2_text, :text=>"Small pad",
+ :cursor=>'top_left_arrow',
+ 'command'=>proc{
+ textWinSmallP2 $twind2_text
+ }))
+
+$twind2_text.insert('end',
+ "\n\nFinally, images fit comfortably in text widgets too:")
+
+TkTextImage.new($twind2_text, 'end',
+ 'image'=>TkBitmapImage.new(:file=>[
+ $demo_dir, '..',
+ 'images', 'face.xbm'
+ ].join(File::Separator)))
+
+# methods
+def textWinBigB2(w)
+ w.borderwidth 15
+end
+def textWinSmallB2(w)
+ w.borderwidth $text_normal2['border']
+end
+def textWinBigH2(w)
+ w.highlightthickness 15
+end
+def textWinSmallH2(w)
+ w.highlightthickness $text_normal2['highlight']
+end
+def textWinBigP2(w)
+ w.configure(:padx=>15, :pady=>15)
+end
+def textWinSmallP2(w)
+ w.configure(:padx=>$text_normal2['pad'], :pady=>$text_normal2['pad'])
+end
+
+def textWindOn2 (w,f)
+ if defined? $twind2_scroll
+ begin
+ $twind2_scroll.destroy
+ rescue
+ end
+ $twind2_scroll = nil
+ end
+
+ base = TkWinfo.parent( TkWinfo.parent(w) )
+ $twind2_scroll = TkScrollbar.new(base) {|s|
+ orient 'horizontal'
+ command proc{|*args| w.xview(*args)}
+ w.xscrollcommand proc{|first,last| s.set first,last}
+ w.wrap 'none'
+ pack('after'=>f, 'side'=>'bottom', 'fill'=>'x')
+ }
+
+ return nil
+end
+
+def textWindOff2 (w)
+ if defined? $twind2_scroll
+ begin
+ $twind2_scroll.destroy
+ rescue
+ end
+ $twind2_scroll = nil
+ end
+ w.xscrollcommand ''
+ #w.wrap 'word'
+ w.wrap 'char'
+end
+
+def textWindPlot2 (t)
+ if (defined? $twind2_plot) && (TkWinfo.exist?($twind2_plot))
+ return
+ end
+
+ $twind2_plot = TkCanvas.new(t) {
+ relief 'sunken'
+ width 450
+ height 300
+ cursor 'top_left_arrow'
+ }
+
+ #font = '-Adobe-Helvetica-Medium-R-Normal--*-180-*-*-*-*-*-*'
+ font = 'Helvetica 18'
+
+ TkcLine.new($twind2_plot, 100, 250, 400, 250, 'width'=>2)
+ TkcLine.new($twind2_plot, 100, 250, 100, 50, 'width'=>2)
+ TkcText.new($twind2_plot, 225, 20,
+ 'text'=>"A Simple Plot", 'font'=>font, 'fill'=>'brown')
+
+ (0..10).each {|i|
+ x = 100 + (i * 30)
+ TkcLine.new($twind2_plot, x, 250, x, 245, 'width'=>2)
+ TkcText.new($twind2_plot, x, 254,
+ 'text'=>10*i, 'font'=>font, 'anchor'=>'n')
+ }
+ (0..5).each {|i|
+ y = 250 - (i * 40)
+ TkcLine.new($twind2_plot, 100, y, 105, y, 'width'=>2)
+ TkcText.new($twind2_plot, 96, y,
+ 'text'=>"#{i*50}.0", 'font'=>font, 'anchor'=>'e')
+ }
+
+ for xx, yy in [[12,56],[20,94],[33,98],[32,120],[61,180],[75,160],[98,223]]
+ x = 100 + (3*xx)
+ y = 250 - (4*yy)/5
+ item = TkcOval.new($twind2_plot, x-6, y-6, x+6, y+6,
+ 'width'=>1, 'outline'=>'black', 'fill'=>'SkyBlue2')
+ item.addtag 'point'
+ end
+
+ $twind2_plot.itembind('point', 'Any-Enter',
+ proc{$twind2_plot.itemconfigure 'current', 'fill', 'red'})
+ $twind2_plot.itembind('point', 'Any-Leave',
+ proc{$twind2_plot.itemconfigure 'current', 'fill', 'SkyBlue2'})
+ $twind2_plot.itembind('point', '1',
+ proc{|x,y| embPlotDown2 $twind2_plot,x,y}, "%x %y")
+ $twind2_plot.itembind('point', 'ButtonRelease-1',
+ proc{$twind2_plot.dtag 'selected'})
+ $twind2_plot.bind('B1-Motion',
+ proc{|x,y| embPlotMove2 $twind2_plot,x,y}, "%x %y")
+ while ($twind2_text.get($mark2_plot) =~ /[ \t\n]/)
+ $twind2_text.delete $mark2_plot
+ end
+ $twind2_text.insert $mark2_plot,"\n"
+ TkTextWindow.new($twind2_text, $mark2_plot, 'window'=>$twind2_plot)
+ $tag2_center.add $mark2_plot
+ $twind2_text.insert $mark2_plot,"\n"
+end
+
+$embPlot2 = {'lastX'=>0, 'lastY'=>0}
+
+def embPlotDown2 (w, x, y)
+ w.dtag 'selected'
+ w.addtag_withtag 'selected', 'current'
+ w.raise 'current'
+ $embPlot2['lastX'] = x
+ $embPlot2['lastY'] = y
+end
+
+def embPlotMove2 (w, x, y)
+ w.move 'selected', x - $embPlot2['lastX'], y - $embPlot2['lastY']
+ $embPlot2['lastX'] = x
+ $embPlot2['lastY'] = y
+end
+
+def textWindDel2 (w)
+ if (defined? $twind2_text) && TkWinfo.exist?($twind2_plot)
+ $twind2_text.delete $twind2_plot
+ $twind2_plot = nil
+ while ($twind2_text.get($mark2_plot) =~ /[ \t\n]/)
+ $twind2_text.delete $mark2_plot
+ end
+ $twind2_text.insert $mark2_plot," "
+ end
+end
+
+def embDefBg2 (w)
+ w['background'] = w.configinfo('background')[3]
+end
diff --git a/ext/tk/sample/demos-jp/README.1st b/ext/tk/sample/demos-jp/README.1st
new file mode 100644
index 0000000000..60b278d7b6
--- /dev/null
+++ b/ext/tk/sample/demos-jp/README.1st
@@ -0,0 +1,20 @@
+¤³¤Î¥Ç¥£¥ì¥¯¥È¥ê¤Ë¤Ï Ruby/Tk ¤Î¥Ç¥â¥¹¥¯¥ê¥×¥È¤¬¼ý¤á¤é¤ì¤Æ¤¤¤Þ¤¹¡¥
+
+'.rb' ¤È¤¤¤¦³ÈÄ¥»Ò¤ò»ý¤Ã¤Æ¤¤¤ë¥Õ¥¡¥¤¥ë¤Ï¡¤¥é¥ó¥Á¥ã¨¡¥¹¥¯¥ê¥×¥È¤Ç
+¤¢¤ë 'widget' ¤«¤é¸Æ¤Ó½Ð¤µ¤ì¤ë¥µ¥Ö¥¹¥¯¥ê¥×¥È¤Ç¤¹¡¥¤½¤ì¤¾¤ìÆÈΩ¤Ë
+¤ÏÆ°¤­¤Þ¤»¤ó¡¥'widget' ¥¹¥¯¥ê¥×¥È¤«¤é¸Æ¤Ó½Ð¤·¤Æ¤¯¤À¤µ¤¤¡¥
+
+¤â¤·¥é¥ó¥Á¥ã¨¡¥¹¥¯¥ê¥×¥È 'widget' ¤Îµ¯Æ°¤ÈƱ»þ¤Ë¤¤¤¯¤Ä¤«¤Î¥µ¥Ö¥¹
+¥¯¥ê¥×¥È¤òµ¯Æ°¤·¤¿¤±¤ì¤Ð¡¤¤½¤Î¥µ¥Ö¥¹¥¯¥ê¥×¥È¤Î̾Á°¤ò°ú¿ô¤È¤·¤ÆÍ¿
+¤¨¤Æ¤¯¤À¤µ¤¤¡¥
+( Îã: /usr/local/bin/ruby widget button.rb entry1.rb text.rb )
+¥µ¥Ö¥¹¥¯¥ê¥×¥È¤Î³ÈÄ¥»Ò '.rb' ¤Ï¾Êά¤¹¤ë¤³¤È¤â¤Ç¤­¤Þ¤¹¡¥
+( Îã: /usr/local/bin/ruby widget button entry1 text )
+
+¤â¤·¥é¥ó¥Á¥ã¨¡¥¹¥¯¥ê¥×¥È¤Î¥¦¥£¥ó¥É¥¦¤¬É¬Íפʤ¤¾ì¹ç¤Ë¤Ï¡¤'-n' ¥ª
+¥×¥·¥ç¥ó¤òÍ¿¤¨¤Æ¤¯¤À¤µ¤¤¡¥
+( Îã: /usr/local/bin/ruby widget -n button.rb entry1.rb text.rb )
+
+¾¤Î¥Õ¥¡¥¤¥ë (browse1 ¤ä hello ¤Ê¤É) ¤ÏñÆȤÇÆ°¤«¤¹¤³¤È¤¬²Äǽ¤Ç¤¹¡¥
+
+ 2004/04/14 Hidetoshi NAGAI (nagai@ai.kyutech.ac.jp)
diff --git a/ext/tk/sample/demos-jp/check2.rb b/ext/tk/sample/demos-jp/check2.rb
new file mode 100644
index 0000000000..63d3bf9398
--- /dev/null
+++ b/ext/tk/sample/demos-jp/check2.rb
@@ -0,0 +1,107 @@
+#
+# checkbutton widget demo2 (called by 'widget')
+#
+
+# toplevel widget ¤¬Â¸ºß¤¹¤ì¤Ðºï½ü¤¹¤ë
+if defined?($check2_demo) && $check2_demo
+ $check2_demo.destroy
+ $check2_demo = nil
+end
+
+# demo ÍѤΠtoplevel widget ¤òÀ¸À®
+$check2_demo = TkToplevel.new {|w|
+ title("Checkbutton Demonstration 2")
+ iconname("check2")
+ positionWindow(w)
+}
+
+# label À¸À®
+msg = TkLabel.new($check2_demo) {
+ font $font
+ wraplength '4i'
+ justify 'left'
+ text "²¼¤Ë¤Ï£´¤Ä¤Î¥Á¥§¥Ã¥¯¥Ü¥¿¥ó¤¬É½¼¨¤µ¤ì¤Æ¤¤¤Þ¤¹¡£¥¯¥ê¥Ã¥¯¤¹¤ë¤È¥Ü¥¿¥ó¤ÎÁªÂò¾õÂÖ¤¬ÊѤï¤ê¡¢TclÊÑ¿ô¡ÊTkVariable¥ª¥Ö¥¸¥§¥¯¥È¤Ç¥¢¥¯¥»¥¹¤Ç¤­¤Þ¤¹¡Ë¤Ë¤½¤Î¥Ü¥¿¥ó¤Î¾õÂÖ¤ò¼¨¤¹ÃͤòÀßÄꤷ¤Þ¤¹¡£ºÇ½é¤Î¥Ü¥¿¥ó¤Î¾õÂ֤Ͼ¤Î£³¤Ä¤Î¥Ü¥¿¥ó¤Î¾õÂ֤ˤâ°Í¸¤·¤ÆÊѲ½¤·¤Þ¤¹¡£¤â¤·£³¤Ä¤Î¥Ü¥¿¥ó¤Î°ìÉô¤À¤±¤Ë¥Á¥§¥Ã¥¯¤¬ÉÕ¤±¤é¤ì¤Æ¤¤¤ë¾ì¹ç¡¢ºÇ½é¤Î¥Ü¥¿¥ó¤Ï¥È¥é¥¤¥¹¥Æ¡¼¥È¡Ê£³¾õÂ֡˥⡼¥É¤Ç¤Îɽ¼¨¤ò¹Ô¤¤¤Þ¤¹¡£¸½ºß¤ÎÊÑ¿ô¤ÎÃͤò¸«¤ë¤Ë¤Ï¡ÖÊÑ¿ô»²¾È¡×¥Ü¥¿¥ó¤ò¥¯¥ê¥Ã¥¯¤·¤Æ¤¯¤À¤µ¤¤¡£"
+}
+msg.pack('side'=>'top')
+
+# ÊÑ¿ôÀ¸À®
+safety = TkVariable.new(0)
+wipers = TkVariable.new(0)
+brakes = TkVariable.new(0)
+sober = TkVariable.new(0)
+
+# frame À¸À®
+TkFrame.new($check2_demo) {|frame|
+ TkGrid(TkFrame.new(frame, :height=>2, :relief=>:sunken, :bd=>2),
+ :columnspan=>4, :row=>0, :sticky=>'ew', :pady=>2)
+ TkGrid('x',
+ TkButton.new(frame, :text=>'ÊÑ¿ô»²¾È',
+ :image=>$image['view'], :compound=>:left,
+ :command=>proc{
+ showVars($check2_demo,
+ ['safety', safety], ['wipers', wipers],
+ ['brakes', brakes], ['sober', sober])
+ }),
+ TkButton.new(frame, :text=>'¥³¡¼¥É»²¾È',
+ :image=>$image['view'], :compound=>:left,
+ :command=>proc{showCode 'check2'}),
+ TkButton.new(frame, :text=>'ÊĤ¸¤ë',
+ :image=>$image['delete'], :compound=>:left,
+ :command=>proc{
+ tmppath = $check2_demo
+ $check2_demo = nil
+ $showVarsWin[tmppath.path] = nil
+ tmppath.destroy
+ }),
+ :padx=>4, :pady=>4)
+ frame.grid_columnconfigure(0, :weight=>1)
+}.pack('side'=>'bottom', 'fill'=>'x')
+
+
+# checkbutton À¸À®
+TkCheckButton.new($check2_demo, :text=>'°ÂÁ´À­¸¡ºº', :variable=>safety,
+ :relief=>:flat, :onvalue=>'all', :offvalue=>'none',
+ :tristatevalue=>'partial'){
+ pack('side'=>'top', 'pady'=>2, 'anchor'=>'w')
+}
+
+[ TkCheckButton.new($check2_demo, 'text'=>'¥ï¥¤¥Ñ¡¼ OK', 'variable'=>wipers),
+ TkCheckButton.new($check2_demo, 'text'=>'¥Ö¥ì¡¼¥­ OK', 'variable'=>brakes),
+ TkCheckButton.new($check2_demo, 'text'=>'±¿Å¾¼ê ÁÇÌÌ', 'variable'=>sober)
+].each{|w|
+ w.relief('flat')
+ w.pack('side'=>'top', 'padx'=>15, 'pady'=>2, 'anchor'=>'w')
+}
+
+# tristate check
+in_check = false
+tristate_check = proc{|n1,n2,op|
+ return if in_check
+
+ in_check = true
+ begin
+ if n1 == safety
+ if safety == 'none'
+ wipers.value = 0
+ brakes.value = 0
+ sober.value = 0
+ elsif safety == 'all'
+ wipers.value = 1
+ brakes.value = 1
+ sober.value = 1
+ end
+ else
+ if wipers == 1 && brakes == 1 && sober == 1
+ safety.value = 'all'
+ elsif wipers == 1 || brakes == 1 || sober == 1
+ safety.value = 'partial'
+ else
+ safety.value = 'none'
+ end
+ end
+ ensure
+ in_check = false
+ end
+}
+
+[wipers, brakes, sober, safety].each{|v| v.trace('w', tristate_check)}
diff --git a/ext/tk/sample/demos-jp/floor2.rb b/ext/tk/sample/demos-jp/floor2.rb
new file mode 100644
index 0000000000..e5a8f53f2a
--- /dev/null
+++ b/ext/tk/sample/demos-jp/floor2.rb
@@ -0,0 +1,1716 @@
+#
+# floorDisplay widget demo 2 (called by 'widget')
+#
+
+# floorDisplay2 --
+# Recreate the floorplan display in the canvas given by "w". The
+# floor given by "active" is displayed on top with its office structure
+# visible.
+#
+# Arguments:
+# w - Name of the canvas window.
+# active - Number of active floor (1, 2, or 3).
+
+def floorDisplay2(w,active)
+ return if $activeFloor2 == active
+
+ w.delete('all')
+ $activeFloor2 = active
+
+ # First go through the three floors, displaying the backgrounds for
+ # each floor.
+
+ floor2_bg1(w,$floor2_colors['bg1'],$floor2_colors['outline1'])
+ floor2_bg2(w,$floor2_colors['bg2'],$floor2_colors['outline2'])
+ floor2_bg3(w,$floor2_colors['bg3'],$floor2_colors['outline3'])
+
+ # Raise the background for the active floor so that it's on top.
+
+ w.raise("floor#{active}")
+
+ # Create a dummy item just to mark this point in the display list,
+ # so we can insert highlights here.
+
+ w.create(TkcRectangle,0,100,1,101,'fill'=>'','outline'=>'','tags'=>'marker')
+
+ # Add the walls and labels for the active floor, along with
+ # transparent polygons that define the rooms on the floor.
+ # Make sure that the room polygons are on top.
+
+ $floorLabels2.clear
+ $floorItems2.clear
+ send("floor2_fg#{active}", w, $floor2_colors['offices'])
+ w.raise('room')
+
+ # Offset the floors diagonally from each other.
+
+ w.move('floor1', '2c', '2c')
+ w.move('floor2', '1c', '1c')
+
+ # Create items for the room entry and its label.
+ w.create(TkcWindow, 600, 100, 'anchor'=>'w', 'window'=>$floor2_entry)
+ w.create(TkcText, 600, 100, 'anchor'=>'e', 'text'=>"Éô²°ÈÖ¹æ: ")
+ w['scrollregion'] = w.bbox('all')
+end
+
+# newRoom2 --
+# This method is invoked whenever the mouse enters a room
+# in the floorplan. It changes tags so that the current room is
+# highlighted.
+#
+# Arguments:
+# w - The name of the canvas window.
+
+def newRoom2(w)
+ id = w.find_withtag('current')[0]
+ $currentRoom2.value = $floorLabels2[id.id] if id != ""
+ Tk.update(true)
+end
+
+# roomChanged2 --
+# This method is invoked whenever the currentRoom variable changes.
+# It highlights the current room and unhighlights any previous room.
+#
+# Arguments:
+# w - The canvas window displaying the floorplan.
+# args - Not used.
+
+def roomChanged2(w,*args)
+ w.delete('highlight')
+ item = $floorItems2[$currentRoom2.value]
+ return if item == nil
+ new = TkcPolygon.new(w, *(w.coords(item)))
+ new.configure('fill'=>$floor2_colors['active'], 'tags'=>'highlight')
+ w.raise(new, 'marker')
+end
+
+# floor2_bg1 --
+# This method represents part of the floorplan database. When
+# invoked, it instantiates the background information for the first
+# floor.
+#
+# Arguments:
+# w - The canvas window.
+# fill - Fill color to use for the floor's background.
+# outline - Color to use for the floor's outline.
+
+def floor2_bg1(w,fill,outline)
+ w.create(TkcPolygon,347,80,349,82,351,84,353,85,363,92,375,99,386,104,
+ 386,129,398,129,398,162,484,162,484,129,559,129,559,133,725,
+ 133,725,129,802,129,802,389,644,389,644,391,559,391,559,327,
+ 508,327,508,311,484,311,484,278,395,278,395,288,400,288,404,
+ 288,409,290,413,292,418,297,421,302,422,309,421,318,417,325,
+ 411,330,405,332,397,333,344,333,340,334,336,336,335,338,332,
+ 342,331,347,332,351,334,354,336,357,341,359,340,360,335,363,
+ 331,365,326,366,304,366,304,355,258,355,258,387,60,387,60,391,
+ 0,391,0,337,3,337,3,114,8,114,8,25,30,25,30,5,93,5,98,5,104,7,
+ 110,10,116,16,119,20,122,28,123,32,123,68,220,68,220,34,221,
+ 22,223,17,227,13,231,8,236,4,242,2,246,0,260,0,283,1,300,5,
+ 321,14,335,22,348,25,365,29,363,39,358,48,352,56,337,70,
+ 344,76,347,80, 'tags'=>['floor1','bg'], 'fill'=>fill)
+ w.create(TkcLine,386,129,398,129, 'fill'=>outline, 'tags'=>['floor1','bg'])
+ w.create(TkcLine,258,355,258,387, 'fill'=>outline, 'tags'=>['floor1','bg'])
+ w.create(TkcLine,60,387,60,391, 'fill'=>outline, 'tags'=>['floor1','bg'])
+ w.create(TkcLine,0,337,0,391, 'fill'=>outline, 'tags'=>['floor1','bg'])
+ w.create(TkcLine,60,391,0,391, 'fill'=>outline, 'tags'=>['floor1','bg'])
+ w.create(TkcLine,3,114,3,337, 'fill'=>outline, 'tags'=>['floor1','bg'])
+ w.create(TkcLine,258,387,60,387, 'fill'=>outline, 'tags'=>['floor1','bg'])
+ w.create(TkcLine,484,162,398,162, 'fill'=>outline, 'tags'=>['floor1','bg'])
+ w.create(TkcLine,398,162,398,129, 'fill'=>outline, 'tags'=>['floor1','bg'])
+ w.create(TkcLine,484,278,484,311, 'fill'=>outline, 'tags'=>['floor1','bg'])
+ w.create(TkcLine,484,311,508,311, 'fill'=>outline, 'tags'=>['floor1','bg'])
+ w.create(TkcLine,508,327,508,311, 'fill'=>outline, 'tags'=>['floor1','bg'])
+ w.create(TkcLine,559,327,508,327, 'fill'=>outline, 'tags'=>['floor1','bg'])
+ w.create(TkcLine,644,391,559,391, 'fill'=>outline, 'tags'=>['floor1','bg'])
+ w.create(TkcLine,644,389,644,391, 'fill'=>outline, 'tags'=>['floor1','bg'])
+ w.create(TkcLine,559,129,484,129, 'fill'=>outline, 'tags'=>['floor1','bg'])
+ w.create(TkcLine,484,162,484,129, 'fill'=>outline, 'tags'=>['floor1','bg'])
+ w.create(TkcLine,725,133,559,133, 'fill'=>outline, 'tags'=>['floor1','bg'])
+ w.create(TkcLine,559,129,559,133, 'fill'=>outline, 'tags'=>['floor1','bg'])
+ w.create(TkcLine,725,129,802,129, 'fill'=>outline, 'tags'=>['floor1','bg'])
+ w.create(TkcLine,802,389,802,129, 'fill'=>outline, 'tags'=>['floor1','bg'])
+ w.create(TkcLine,3,337,0,337, 'fill'=>outline, 'tags'=>['floor1','bg'])
+ w.create(TkcLine,559,391,559,327, 'fill'=>outline, 'tags'=>['floor1','bg'])
+ w.create(TkcLine,802,389,644,389, 'fill'=>outline, 'tags'=>['floor1','bg'])
+ w.create(TkcLine,725,133,725,129, 'fill'=>outline, 'tags'=>['floor1','bg'])
+ w.create(TkcLine,8,25,8,114, 'fill'=>outline, 'tags'=>['floor1','bg'])
+ w.create(TkcLine,8,114,3,114, 'fill'=>outline, 'tags'=>['floor1','bg'])
+ w.create(TkcLine,30,25,8,25, 'fill'=>outline, 'tags'=>['floor1','bg'])
+ w.create(TkcLine,484,278,395,278, 'fill'=>outline, 'tags'=>['floor1','bg'])
+ w.create(TkcLine,30,25,30,5, 'fill'=>outline, 'tags'=>['floor1','bg'])
+ w.create(TkcLine,93,5,30,5, 'fill'=>outline, 'tags'=>['floor1','bg'])
+ w.create(TkcLine,98,5,93,5, 'fill'=>outline, 'tags'=>['floor1','bg'])
+ w.create(TkcLine,104,7,98,5, 'fill'=>outline, 'tags'=>['floor1','bg'])
+ w.create(TkcLine,110,10,104,7, 'fill'=>outline, 'tags'=>['floor1','bg'])
+ w.create(TkcLine,116,16,110,10, 'fill'=>outline, 'tags'=>['floor1','bg'])
+ w.create(TkcLine,119,20,116,16, 'fill'=>outline, 'tags'=>['floor1','bg'])
+ w.create(TkcLine,122,28,119,20, 'fill'=>outline, 'tags'=>['floor1','bg'])
+ w.create(TkcLine,123,32,122,28, 'fill'=>outline, 'tags'=>['floor1','bg'])
+ w.create(TkcLine,123,68,123,32, 'fill'=>outline, 'tags'=>['floor1','bg'])
+ w.create(TkcLine,220,68,123,68, 'fill'=>outline, 'tags'=>['floor1','bg'])
+ w.create(TkcLine,386,129,386,104, 'fill'=>outline, 'tags'=>['floor1','bg'])
+ w.create(TkcLine,386,104,375,99, 'fill'=>outline, 'tags'=>['floor1','bg'])
+ w.create(TkcLine,375,99,363,92, 'fill'=>outline, 'tags'=>['floor1','bg'])
+ w.create(TkcLine,353,85,363,92, 'fill'=>outline, 'tags'=>['floor1','bg'])
+ w.create(TkcLine,220,68,220,34, 'fill'=>outline, 'tags'=>['floor1','bg'])
+ w.create(TkcLine,337,70,352,56, 'fill'=>outline, 'tags'=>['floor1','bg'])
+ w.create(TkcLine,352,56,358,48, 'fill'=>outline, 'tags'=>['floor1','bg'])
+ w.create(TkcLine,358,48,363,39, 'fill'=>outline, 'tags'=>['floor1','bg'])
+ w.create(TkcLine,363,39,365,29, 'fill'=>outline, 'tags'=>['floor1','bg'])
+ w.create(TkcLine,365,29,348,25, 'fill'=>outline, 'tags'=>['floor1','bg'])
+ w.create(TkcLine,348,25,335,22, 'fill'=>outline, 'tags'=>['floor1','bg'])
+ w.create(TkcLine,335,22,321,14, 'fill'=>outline, 'tags'=>['floor1','bg'])
+ w.create(TkcLine,321,14,300,5, 'fill'=>outline, 'tags'=>['floor1','bg'])
+ w.create(TkcLine,300,5,283,1, 'fill'=>outline, 'tags'=>['floor1','bg'])
+ w.create(TkcLine,283,1,260,0, 'fill'=>outline, 'tags'=>['floor1','bg'])
+ w.create(TkcLine,260,0,246,0, 'fill'=>outline, 'tags'=>['floor1','bg'])
+ w.create(TkcLine,246,0,242,2, 'fill'=>outline, 'tags'=>['floor1','bg'])
+ w.create(TkcLine,242,2,236,4, 'fill'=>outline, 'tags'=>['floor1','bg'])
+ w.create(TkcLine,236,4,231,8, 'fill'=>outline, 'tags'=>['floor1','bg'])
+ w.create(TkcLine,231,8,227,13, 'fill'=>outline, 'tags'=>['floor1','bg'])
+ w.create(TkcLine,223,17,227,13, 'fill'=>outline, 'tags'=>['floor1','bg'])
+ w.create(TkcLine,221,22,223,17, 'fill'=>outline, 'tags'=>['floor1','bg'])
+ w.create(TkcLine,220,34,221,22, 'fill'=>outline, 'tags'=>['floor1','bg'])
+ w.create(TkcLine,340,360,335,363, 'fill'=>outline, 'tags'=>['floor1','bg'])
+ w.create(TkcLine,335,363,331,365, 'fill'=>outline, 'tags'=>['floor1','bg'])
+ w.create(TkcLine,331,365,326,366, 'fill'=>outline, 'tags'=>['floor1','bg'])
+ w.create(TkcLine,326,366,304,366, 'fill'=>outline, 'tags'=>['floor1','bg'])
+ w.create(TkcLine,304,355,304,366, 'fill'=>outline, 'tags'=>['floor1','bg'])
+ w.create(TkcLine,395,288,400,288, 'fill'=>outline, 'tags'=>['floor1','bg'])
+ w.create(TkcLine,404,288,400,288, 'fill'=>outline, 'tags'=>['floor1','bg'])
+ w.create(TkcLine,409,290,404,288, 'fill'=>outline, 'tags'=>['floor1','bg'])
+ w.create(TkcLine,413,292,409,290, 'fill'=>outline, 'tags'=>['floor1','bg'])
+ w.create(TkcLine,418,297,413,292, 'fill'=>outline, 'tags'=>['floor1','bg'])
+ w.create(TkcLine,421,302,418,297, 'fill'=>outline, 'tags'=>['floor1','bg'])
+ w.create(TkcLine,422,309,421,302, 'fill'=>outline, 'tags'=>['floor1','bg'])
+ w.create(TkcLine,421,318,422,309, 'fill'=>outline, 'tags'=>['floor1','bg'])
+ w.create(TkcLine,421,318,417,325, 'fill'=>outline, 'tags'=>['floor1','bg'])
+ w.create(TkcLine,417,325,411,330, 'fill'=>outline, 'tags'=>['floor1','bg'])
+ w.create(TkcLine,411,330,405,332, 'fill'=>outline, 'tags'=>['floor1','bg'])
+ w.create(TkcLine,405,332,397,333, 'fill'=>outline, 'tags'=>['floor1','bg'])
+ w.create(TkcLine,397,333,344,333, 'fill'=>outline, 'tags'=>['floor1','bg'])
+ w.create(TkcLine,344,333,340,334, 'fill'=>outline, 'tags'=>['floor1','bg'])
+ w.create(TkcLine,340,334,336,336, 'fill'=>outline, 'tags'=>['floor1','bg'])
+ w.create(TkcLine,336,336,335,338, 'fill'=>outline, 'tags'=>['floor1','bg'])
+ w.create(TkcLine,335,338,332,342, 'fill'=>outline, 'tags'=>['floor1','bg'])
+ w.create(TkcLine,331,347,332,342, 'fill'=>outline, 'tags'=>['floor1','bg'])
+ w.create(TkcLine,332,351,331,347, 'fill'=>outline, 'tags'=>['floor1','bg'])
+ w.create(TkcLine,334,354,332,351, 'fill'=>outline, 'tags'=>['floor1','bg'])
+ w.create(TkcLine,336,357,334,354, 'fill'=>outline, 'tags'=>['floor1','bg'])
+ w.create(TkcLine,341,359,336,357, 'fill'=>outline, 'tags'=>['floor1','bg'])
+ w.create(TkcLine,341,359,340,360, 'fill'=>outline, 'tags'=>['floor1','bg'])
+ w.create(TkcLine,395,288,395,278, 'fill'=>outline, 'tags'=>['floor1','bg'])
+ w.create(TkcLine,304,355,258,355, 'fill'=>outline, 'tags'=>['floor1','bg'])
+ w.create(TkcLine,347,80,344,76, 'fill'=>outline, 'tags'=>['floor1','bg'])
+ w.create(TkcLine,344,76,337,70, 'fill'=>outline, 'tags'=>['floor1','bg'])
+ w.create(TkcLine,349,82,347,80, 'fill'=>outline, 'tags'=>['floor1','bg'])
+ w.create(TkcLine,351,84,349,82, 'fill'=>outline, 'tags'=>['floor1','bg'])
+ w.create(TkcLine,353,85,351,84, 'fill'=>outline, 'tags'=>['floor1','bg'])
+end
+
+# floor2_bg2 --
+# This method represents part of the floorplan database. When
+# invoked, it instantiates the background information for the first
+# floor.
+#
+# Arguments:
+# w - The canvas window.
+# fill - Fill color to use for the floor's background.
+# outline - Color to use for the floor's outline.
+
+def floor2_bg2(w,fill,outline)
+ w.create(TkcPolygon,559,129,484,129,484,162,398,162,398,129,315,129,
+ 315,133,176,133,176,129,96,129,96,133,3,133,3,339,0,339,0,391,
+ 60,391,60,387,258,387,258,329,350,329,350,311,395,311,395,280,
+ 484,280,484,311,508,311,508,327,558,327,558,391,644,391,644,
+ 367,802,367,802,129,725,129,725,133,559,133,559,129,
+ 'tags'=>['floor2','bg'], 'fill'=>fill)
+ w.create(TkcLine,350,311,350,329, 'fill'=>outline, 'tags'=>['floor2','bg'])
+ w.create(TkcLine,398,129,398,162, 'fill'=>outline, 'tags'=>['floor2','bg'])
+ w.create(TkcLine,802,367,802,129, 'fill'=>outline, 'tags'=>['floor2','bg'])
+ w.create(TkcLine,802,129,725,129, 'fill'=>outline, 'tags'=>['floor2','bg'])
+ w.create(TkcLine,725,133,725,129, 'fill'=>outline, 'tags'=>['floor2','bg'])
+ w.create(TkcLine,559,129,559,133, 'fill'=>outline, 'tags'=>['floor2','bg'])
+ w.create(TkcLine,559,133,725,133, 'fill'=>outline, 'tags'=>['floor2','bg'])
+ w.create(TkcLine,484,162,484,129, 'fill'=>outline, 'tags'=>['floor2','bg'])
+ w.create(TkcLine,559,129,484,129, 'fill'=>outline, 'tags'=>['floor2','bg'])
+ w.create(TkcLine,802,367,644,367, 'fill'=>outline, 'tags'=>['floor2','bg'])
+ w.create(TkcLine,644,367,644,391, 'fill'=>outline, 'tags'=>['floor2','bg'])
+ w.create(TkcLine,644,391,558,391, 'fill'=>outline, 'tags'=>['floor2','bg'])
+ w.create(TkcLine,558,327,558,391, 'fill'=>outline, 'tags'=>['floor2','bg'])
+ w.create(TkcLine,558,327,508,327, 'fill'=>outline, 'tags'=>['floor2','bg'])
+ w.create(TkcLine,508,327,508,311, 'fill'=>outline, 'tags'=>['floor2','bg'])
+ w.create(TkcLine,484,311,508,311, 'fill'=>outline, 'tags'=>['floor2','bg'])
+ w.create(TkcLine,484,280,484,311, 'fill'=>outline, 'tags'=>['floor2','bg'])
+ w.create(TkcLine,398,162,484,162, 'fill'=>outline, 'tags'=>['floor2','bg'])
+ w.create(TkcLine,484,280,395,280, 'fill'=>outline, 'tags'=>['floor2','bg'])
+ w.create(TkcLine,395,280,395,311, 'fill'=>outline, 'tags'=>['floor2','bg'])
+ w.create(TkcLine,258,387,60,387, 'fill'=>outline, 'tags'=>['floor2','bg'])
+ w.create(TkcLine,3,133,3,339, 'fill'=>outline, 'tags'=>['floor2','bg'])
+ w.create(TkcLine,3,339,0,339, 'fill'=>outline, 'tags'=>['floor2','bg'])
+ w.create(TkcLine,60,391,0,391, 'fill'=>outline, 'tags'=>['floor2','bg'])
+ w.create(TkcLine,0,339,0,391, 'fill'=>outline, 'tags'=>['floor2','bg'])
+ w.create(TkcLine,60,387,60,391, 'fill'=>outline, 'tags'=>['floor2','bg'])
+ w.create(TkcLine,258,329,258,387, 'fill'=>outline, 'tags'=>['floor2','bg'])
+ w.create(TkcLine,350,329,258,329, 'fill'=>outline, 'tags'=>['floor2','bg'])
+ w.create(TkcLine,395,311,350,311, 'fill'=>outline, 'tags'=>['floor2','bg'])
+ w.create(TkcLine,398,129,315,129, 'fill'=>outline, 'tags'=>['floor2','bg'])
+ w.create(TkcLine,176,133,315,133, 'fill'=>outline, 'tags'=>['floor2','bg'])
+ w.create(TkcLine,176,129,96,129, 'fill'=>outline, 'tags'=>['floor2','bg'])
+ w.create(TkcLine,3,133,96,133, 'fill'=>outline, 'tags'=>['floor2','bg'])
+ w.create(TkcLine,315,133,315,129, 'fill'=>outline, 'tags'=>['floor2','bg'])
+ w.create(TkcLine,176,133,176,129, 'fill'=>outline, 'tags'=>['floor2','bg'])
+ w.create(TkcLine,96,133,96,129, 'fill'=>outline, 'tags'=>['floor2','bg'])
+end
+
+# floor2_bg3 --
+# This method represents part of the floorplan database. When
+# invoked, it instantiates the background information for the first
+# floor.
+#
+# Arguments:
+# w - The canvas window.
+# fill - Fill color to use for the floor's background.
+# outline - Color to use for the floor's outline.
+
+def floor2_bg3(w,fill,outline)
+ w.create(TkcPolygon,159,300,107,300,107,248,159,248,159,129,96,129,96,
+ 133,21,133,21,331,0,331,0,391,60,391,60,370,159,370,159,300,
+ 'tags'=>['floor3','bg'], 'fill'=>fill)
+ w.create(TkcPolygon,258,370,258,329,350,329,350,311,399,311,399,129,
+ 315,129,315,133,176,133,176,129,159,129,159,370,258,370,
+ 'tags'=>['floor3','bg'], 'fill'=>fill)
+ w.create(TkcLine,96,133,96,129, 'fill'=>outline, 'tags'=>['floor3','bg'])
+ w.create(TkcLine,176,129,96,129, 'fill'=>outline, 'tags'=>['floor3','bg'])
+ w.create(TkcLine,176,129,176,133, 'fill'=>outline, 'tags'=>['floor3','bg'])
+ w.create(TkcLine,315,133,176,133, 'fill'=>outline, 'tags'=>['floor3','bg'])
+ w.create(TkcLine,315,133,315,129, 'fill'=>outline, 'tags'=>['floor3','bg'])
+ w.create(TkcLine,399,129,315,129, 'fill'=>outline, 'tags'=>['floor3','bg'])
+ w.create(TkcLine,399,311,399,129, 'fill'=>outline, 'tags'=>['floor3','bg'])
+ w.create(TkcLine,399,311,350,311, 'fill'=>outline, 'tags'=>['floor3','bg'])
+ w.create(TkcLine,350,329,350,311, 'fill'=>outline, 'tags'=>['floor3','bg'])
+ w.create(TkcLine,350,329,258,329, 'fill'=>outline, 'tags'=>['floor3','bg'])
+ w.create(TkcLine,258,370,258,329, 'fill'=>outline, 'tags'=>['floor3','bg'])
+ w.create(TkcLine,60,370,258,370, 'fill'=>outline, 'tags'=>['floor3','bg'])
+ w.create(TkcLine,60,370,60,391, 'fill'=>outline, 'tags'=>['floor3','bg'])
+ w.create(TkcLine,60,391,0,391, 'fill'=>outline, 'tags'=>['floor3','bg'])
+ w.create(TkcLine,0,391,0,331, 'fill'=>outline, 'tags'=>['floor3','bg'])
+ w.create(TkcLine,21,331,0,331, 'fill'=>outline, 'tags'=>['floor3','bg'])
+ w.create(TkcLine,21,331,21,133, 'fill'=>outline, 'tags'=>['floor3','bg'])
+ w.create(TkcLine,96,133,21,133, 'fill'=>outline, 'tags'=>['floor3','bg'])
+ w.create(TkcLine,107,300,159,300,159,248,107,248,107,300,
+ 'fill'=>outline, 'tags'=>['floor3','bg'])
+end
+
+# floor2_fg1 --
+# This method represents part of the floorplan database. When
+# invoked, it instantiates the foreground information for the first
+# floor (office outlines and numbers).
+#
+# Arguments:
+# w - The canvas window.
+# color - Color to use for drawing foreground information.
+
+def floor2_fg1(w,color)
+ i = TkcPolygon.new(w,375,246,375,172,341,172,341,246,
+ 'fill'=>'', 'tags'=>['floor1','room'])
+ $floorLabels2[i.id] = '101'
+ $floorItems2['101'] = i
+ w.create(TkcText,358,209, 'text'=>'101', 'fill'=>color,
+ 'anchor'=>'c', 'tags'=>['floor1','label'])
+ i = TkcPolygon.new(w,307,240,339,240,339,206,307,206,
+ 'fill'=>'', 'tags'=>['floor1','room'])
+ $floorLabels2[i.id] = 'Pub Lift1'
+ $floorItems2['Pub Lift1'] = i
+ w.create(TkcText,323,223, 'text'=>'Pub Lift1', 'fill'=>color,
+ 'anchor'=>'c', 'tags'=>['floor1','label'])
+ i = TkcPolygon.new(w,339,205,307,205,307,171,339,171,
+ 'fill'=>'', 'tags'=>['floor1','room'])
+ $floorLabels2[i.id] = 'Priv Lift1'
+ $floorItems2['Priv Lift1'] = i
+ w.create(TkcText,323,188, 'text'=>'Priv Lift1', 'fill'=>color,
+ 'anchor'=>'c', 'tags'=>['floor1','label'])
+ i = TkcPolygon.new(w,42,389,42,337,1,337,1,389,
+ 'fill'=>'', 'tags'=>['floor1','room'])
+ $floorLabels2[i.id] = '110'
+ $floorItems2['110'] = i
+ w.create(TkcText,21.5,363, 'text'=>'110', 'fill'=>color,
+ 'anchor'=>'c', 'tags'=>['floor1','label'])
+ i = TkcPolygon.new(w,59,389,59,385,90,385,90,337,44,337,44,389,
+ 'fill'=>'', 'tags'=>['floor1','room'])
+ $floorLabels2[i.id] = '109'
+ $floorItems2['109'] = i
+ w.create(TkcText,67,363, 'text'=>'109', 'fill'=>color,
+ 'anchor'=>'c', 'tags'=>['floor1','label'])
+ i = TkcPolygon.new(w,51,300,51,253,6,253,6,300,
+ 'fill'=>'', 'tags'=>['floor1','room'])
+ $floorLabels2[i.id] = '111'
+ $floorItems2['111'] = i
+ w.create(TkcText,28.5,276.5, 'text'=>'111', 'fill'=>color,
+ 'anchor'=>'c', 'tags'=>['floor1','label'])
+ i = TkcPolygon.new(w,98,248,98,309,79,309,79,248,
+ 'fill'=>'', 'tags'=>['floor1','room'])
+ $floorLabels2[i.id] = '117B'
+ $floorItems2['117B'] = i
+ w.create(TkcText,88.5,278.5, 'text'=>'117B', 'fill'=>color,
+ 'anchor'=>'c', 'tags'=>['floor1','label'])
+ i = TkcPolygon.new(w,51,251,51,204,6,204,6,251,
+ 'fill'=>'', 'tags'=>['floor1','room'])
+ $floorLabels2[i.id] = '112'
+ $floorItems2['112'] = i
+ w.create(TkcText,28.5,227.5, 'text'=>'112', 'fill'=>color,
+ 'anchor'=>'c', 'tags'=>['floor1','label'])
+ i = TkcPolygon.new(w,6,156,51,156,51,203,6,203,
+ 'fill'=>'', 'tags'=>['floor1','room'])
+ $floorLabels2[i.id] = '113'
+ $floorItems2['113'] = i
+ w.create(TkcText,28.5,179.5, 'text'=>'113', 'fill'=>color,
+ 'anchor'=>'c', 'tags'=>['floor1','label'])
+ i = TkcPolygon.new(w,85,169,79,169,79,192,85,192,
+ 'fill'=>'', 'tags'=>['floor1','room'])
+ $floorLabels2[i.id] = '117A'
+ $floorItems2['117A'] = i
+ w.create(TkcText,82,180.5, 'text'=>'117A', 'fill'=>color,
+ 'anchor'=>'c', 'tags'=>['floor1','label'])
+ i = TkcPolygon.new(w,77,302,77,168,53,168,53,302,
+ 'fill'=>'', 'tags'=>['floor1','room'])
+ $floorLabels2[i.id] = '117'
+ $floorItems2['117'] = i
+ w.create(TkcText,65,235, 'text'=>'117', 'fill'=>color,
+ 'anchor'=>'c', 'tags'=>['floor1','label'])
+ i = TkcPolygon.new(w,51,155,51,115,6,115,6,155,
+ 'fill'=>'', 'tags'=>['floor1','room'])
+ $floorLabels2[i.id] = '114'
+ $floorItems2['114'] = i
+ w.create(TkcText,28.5,135, 'text'=>'114', 'fill'=>color,
+ 'anchor'=>'c', 'tags'=>['floor1','label'])
+ i = TkcPolygon.new(w,95,115,53,115,53,168,95,168,
+ 'fill'=>'', 'tags'=>['floor1','room'])
+ $floorLabels2[i.id] = '115'
+ $floorItems2['115'] = i
+ w.create(TkcText,74,141.5, 'text'=>'115', 'fill'=>color,
+ 'anchor'=>'c', 'tags'=>['floor1','label'])
+ i = TkcPolygon.new(w,87,113,87,27,10,27,10,113,
+ 'fill'=>'', 'tags'=>['floor1','room'])
+ $floorLabels2[i.id] = '116'
+ $floorItems2['116'] = i
+ w.create(TkcText,48.5,70, 'text'=>'116', 'fill'=>color,
+ 'anchor'=>'c', 'tags'=>['floor1','label'])
+ i = TkcPolygon.new(w,89,91,128,91,128,113,89,131,
+ 'fill'=>'', 'tags'=>['floor1','room'])
+ $floorLabels2[i.id] = '118'
+ $floorItems2['118'] = i
+ w.create(TkcText,108.5,102, 'text'=>'118', 'fill'=>color,
+ 'anchor'=>'c', 'tags'=>['floor1','label'])
+ i = TkcPolygon.new(w,178,128,178,132,216,132,216,91,
+ 163,91,163,112,149,112,149,128,
+ 'fill'=>'', 'tags'=>['floor1','room'])
+ $floorLabels2[i.id] = '120'
+ $floorItems2['120'] = i
+ w.create(TkcText,189.5,111.5, 'text'=>'120', 'fill'=>color,
+ 'anchor'=>'c', 'tags'=>['floor1','label'])
+ i = TkcPolygon.new(w,79,193,87,193,87,169,136,169,136,192,
+ 156,192,156,169,175,169,175,246,79,246,
+ 'fill'=>'', 'tags'=>['floor1','room'])
+ $floorLabels2[i.id] = '122'
+ $floorItems2['122'] = i
+ w.create(TkcText,131,207.5, 'text'=>'122', 'fill'=>color,
+ 'anchor'=>'c', 'tags'=>['floor1','label'])
+ i = TkcPolygon.new(w,138,169,154,169,154,191,138,191,
+ 'fill'=>'', 'tags'=>['floor1','room'])
+ $floorLabels2[i.id] = '121'
+ $floorItems2['121'] = i
+ w.create(TkcText,146,180, 'text'=>'121', 'fill'=>color,
+ 'anchor'=>'c', 'tags'=>['floor1','label'])
+ i = TkcPolygon.new(w,99,300,126,300,126,309,99,309,
+ 'fill'=>'', 'tags'=>['floor1','room'])
+ $floorLabels2[i.id] = '106A'
+ $floorItems2['106A'] = i
+ w.create(TkcText,112.5,304.5, 'text'=>'106A', 'fill'=>color,
+ 'anchor'=>'c', 'tags'=>['floor1','label'])
+ i = TkcPolygon.new(w,128,299,128,309,150,309,150,248,99,248,99,299,
+ 'fill'=>'', 'tags'=>['floor1','room'])
+ $floorLabels2[i.id] = '105'
+ $floorItems2['105'] = i
+ w.create(TkcText,124.5,278.5, 'text'=>'105', 'fill'=>color,
+ 'anchor'=>'c', 'tags'=>['floor1','label'])
+ i = TkcPolygon.new(w,174,309,174,300,152,300,152,309,
+ 'fill'=>'', 'tags'=>['floor1','room'])
+ $floorLabels2[i.id] = '106B'
+ $floorItems2['106B'] = i
+ w.create(TkcText,163,304.5, 'text'=>'106B', 'fill'=>color,
+ 'anchor'=>'c', 'tags'=>['floor1','label'])
+ i = TkcPolygon.new(w,176,299,176,309,216,309,216,248,152,248,152,299,
+ 'fill'=>'', 'tags'=>['floor1','room'])
+ $floorLabels2[i.id] = '104'
+ $floorItems2['104'] = i
+ w.create(TkcText,184,278.5, 'text'=>'104', 'fill'=>color,
+ 'anchor'=>'c', 'tags'=>['floor1','label'])
+ i = TkcPolygon.new(w,138,385,138,337,91,337,91,385,
+ 'fill'=>'', 'tags'=>['floor1','room'])
+ $floorLabels2[i.id] = '108'
+ $floorItems2['108'] = i
+ w.create(TkcText,114.5,361, 'text'=>'108', 'fill'=>color,
+ 'anchor'=>'c', 'tags'=>['floor1','label'])
+ i = TkcPolygon.new(w,256,337,140,337,140,385,256,385,
+ 'fill'=>'', 'tags'=>['floor1','room'])
+ $floorLabels2[i.id] = '107'
+ $floorItems2['107'] = i
+ w.create(TkcText,198,361, 'text'=>'107', 'fill'=>color,
+ 'anchor'=>'c', 'tags'=>['floor1','label'])
+ i = TkcPolygon.new(w,300,353,300,329,260,329,260,353,
+ 'fill'=>'', 'tags'=>['floor1','room'])
+ $floorLabels2[i.id] = 'Smoking'
+ $floorItems2['Smoking'] = i
+ w.create(TkcText,280,341, 'text'=>'Smoking', 'fill'=>color,
+ 'anchor'=>'c', 'tags'=>['floor1','label'])
+ i = TkcPolygon.new(w,314,135,314,170,306,170,306,246,177,246,177,135,
+ 'fill'=>'', 'tags'=>['floor1','room'])
+ $floorLabels2[i.id] = '123'
+ $floorItems2['123'] = i
+ w.create(TkcText,245.5,190.5, 'text'=>'123', 'fill'=>color,
+ 'anchor'=>'c', 'tags'=>['floor1','label'])
+ i = TkcPolygon.new(w,217,248,301,248,301,326,257,326,257,310,217,310,
+ 'fill'=>'', 'tags'=>['floor1','room'])
+ $floorLabels2[i.id] = '103'
+ $floorItems2['103'] = i
+ w.create(TkcText,259,287, 'text'=>'103', 'fill'=>color,
+ 'anchor'=>'c', 'tags'=>['floor1','label'])
+ i = TkcPolygon.new(w,396,188,377,188,377,169,316,169,316,131,396,131,
+ 'fill'=>'', 'tags'=>['floor1','room'])
+ $floorLabels2[i.id] = '124'
+ $floorItems2['124'] = i
+ w.create(TkcText,356,150, 'text'=>'124', 'fill'=>color,
+ 'anchor'=>'c', 'tags'=>['floor1','label'])
+ i = TkcPolygon.new(w,397,226,407,226,407,189,377,189,377,246,397,246,
+ 'fill'=>'', 'tags'=>['floor1','room'])
+ $floorLabels2[i.id] = '125'
+ $floorItems2['125'] = i
+ w.create(TkcText,392,217.5, 'text'=>'125', 'fill'=>color,
+ 'anchor'=>'c', 'tags'=>['floor1','label'])
+ i = TkcPolygon.new(w,399,187,409,187,409,207,474,207,474,164,399,164,
+ 'fill'=>'', 'tags'=>['floor1','room'])
+ $floorLabels2[i.id] = '126'
+ $floorItems2['126'] = i
+ w.create(TkcText,436.5,185.5, 'text'=>'126', 'fill'=>color,
+ 'anchor'=>'c', 'tags'=>['floor1','label'])
+ i = TkcPolygon.new(w,409,209,409,229,399,229,399,253,
+ 486,253,486,239,474,239,474,209,
+ 'fill'=>'', 'tags'=>['floor1','room'])
+ $floorLabels2[i.id] = '127'
+ $floorItems2['127'] = i
+ w.create(TkcText,436.5,'231', 'text'=>'127', 'fill'=>color,
+ 'anchor'=>'c', 'tags'=>['floor1','label'])
+ i = TkcPolygon.new(w,501,164,501,174,495,174,495,188,
+ 490,188,490,204,476,204,476,164,
+ 'fill'=>'', 'tags'=>['floor1','room'])
+ $floorLabels2[i.id] = 'MShower'
+ $floorItems2['MShower'] = i
+ w.create(TkcText,488.5,'184', 'text'=>'MShower', 'fill'=>color,
+ 'anchor'=>'c', 'tags'=>['floor1','label'])
+ i = TkcPolygon.new(w,497,176,513,176,513,204,492,204,492,190,497,190,
+ 'fill'=>'', 'tags'=>['floor1','room'])
+ $floorLabels2[i.id] = 'Closet'
+ $floorItems2['Closet'] = i
+ w.create(TkcText,502.5,190, 'text'=>'Closet', 'fill'=>color,
+ 'anchor'=>'c', 'tags'=>['floor1','label'])
+ i = TkcPolygon.new(w,476,237,476,206,513,206,513,254,488,254,488,237,
+ 'fill'=>'', 'tags'=>['floor1','room'])
+ $floorLabels2[i.id] = 'WShower'
+ $floorItems2['WShower'] = i
+ w.create(TkcText,494.5,230, 'text'=>'WShower', 'fill'=>color,
+ 'anchor'=>'c', 'tags'=>['floor1','label'])
+ i = TkcPolygon.new(w,486,131,558,131,558,135,724,135,724,166,
+ 697,166,697,275,553,275,531,254,515,254,
+ 515,174,503,174,503,161,486,161,
+ 'fill'=>'', 'tags'=>['floor1','room'])
+ $floorLabels2[i.id] = '130'
+ $floorItems2['130'] = i
+ w.create(TkcText,638.5,205, 'text'=>'130', 'fill'=>color,
+ 'anchor'=>'c', 'tags'=>['floor1','label'])
+ i = TkcPolygon.new(w,308,242,339,242,339,248,342,248,
+ 342,246,397,246,397,276,393,276,
+ 393,309,300,309,300,248,308,248,
+ 'fill'=>'', 'tags'=>['floor1','room'])
+ $floorLabels2[i.id] = '102'
+ $floorItems2['102'] = i
+ w.create(TkcText,367.5,278.5, 'text'=>'102', 'fill'=>color,
+ 'anchor'=>'c', 'tags'=>['floor1','label'])
+ i = TkcPolygon.new(w,397,255,486,255,486,276,397,276,
+ 'fill'=>'', 'tags'=>['floor1','room'])
+ $floorLabels2[i.id] = '128'
+ $floorItems2['128'] = i
+ w.create(TkcText,441.5,265.5, 'text'=>'128', 'fill'=>color,
+ 'anchor'=>'c', 'tags'=>['floor1','label'])
+ i = TkcPolygon.new(w,510,309,486,309,486,255,530,255,
+ 552,277,561,277,561,325,510,325,
+ 'fill'=>'', 'tags'=>['floor1','room'])
+ $floorLabels2[i.id] = '129'
+ $floorItems2['129'] = i
+ w.create(TkcText,535.5,293, 'text'=>'129', 'fill'=>color,
+ 'anchor'=>'c', 'tags'=>['floor1','label'])
+ i = TkcPolygon.new(w,696,281,740,281,740,387,642,387,
+ 642,389,561,389,561,277,696,277,
+ 'fill'=>'', 'tags'=>['floor1','room'])
+ $floorLabels2[i.id] = '133'
+ $floorItems2['133'] = i
+ w.create(TkcText,628.5,335, 'text'=>'133', 'fill'=>color,
+ 'anchor'=>'c', 'tags'=>['floor1','label'])
+ i = TkcPolygon.new(w,742,387,742,281,800,281,800,387,
+ 'fill'=>'', 'tags'=>['floor1','room'])
+ $floorLabels2[i.id] = '132'
+ $floorItems2['132'] = i
+ w.create(TkcText,771,334, 'text'=>'132', 'fill'=>color,
+ 'anchor'=>'c', 'tags'=>['floor1','label'])
+ i = TkcPolygon.new(w,800,168,800,280,699,280,699,168,
+ 'fill'=>'', 'tags'=>['floor1','room'])
+ $floorLabels2[i.id] = '134'
+ $floorItems2['134'] = i
+ w.create(TkcText,749.5,224, 'text'=>'134', 'fill'=>color,
+ 'anchor'=>'c', 'tags'=>['floor1','label'])
+ i = TkcPolygon.new(w,726,131,726,166,800,166,800,131,
+ 'fill'=>'', 'tags'=>['floor1','room'])
+ $floorLabels2[i.id] = '135'
+ $floorItems2['135'] = i
+ w.create(TkcText,763,148.5, 'text'=>'135', 'fill'=>color,
+ 'anchor'=>'c', 'tags'=>['floor1','label'])
+ i = TkcPolygon.new(w,340,360,335,363,331,365,326,366,304,366,
+ 304,312,396,312,396,288,400,288,404,288,
+ 409,290,413,292,418,297,421,302,422,309,
+ 421,318,417,325,411,330,405,332,397,333,
+ 344,333,340,334,336,336,335,338,332,342,
+ 331,347,332,351,334,354,336,357,341,359,
+ 'fill'=>'', 'tags'=>['floor1','room'])
+ $floorLabels2[i.id] = 'Ramona Stair'
+ $floorItems2['Ramona Stair'] = i
+ w.create(TkcText,368,323, 'text'=>'Ramona Stair', 'fill'=>color,
+ 'anchor'=>'c', 'tags'=>['floor1','label'])
+ i = TkcPolygon.new(w,30,23,30,5,93,5,98,5,104,7,110,10,116,16,119,20,
+ 122,28,123,32,123,68,220,68,220,87,90,87,90,23,
+ 'fill'=>'', 'tags'=>['floor1','room'])
+ $floorLabels2[i.id] = 'University Stair'
+ $floorItems2['University Stair'] = i
+ w.create(TkcText,155,77.5, 'text'=>'University Stair', 'fill'=>color,
+ 'anchor'=>'c', 'tags'=>['floor1','label'])
+ i = TkcPolygon.new(w,282,37,295,40,312,49,323,56,337,70,352,56,
+ 358,48,363,39,365,29,348,25,335,22,321,14,
+ 300,5,283,1,260,0,246,0,242,2,236,4,231,8,
+ 227,13,223,17,221,22,220,34,260,34,
+ 'fill'=>'', 'tags'=>['floor1','room'])
+ $floorLabels2[i.id] = 'Plaza Stair'
+ $floorItems2['Plaza Stair'] = i
+ w.create(TkcText,317.5,28.5, 'text'=>'Plaza Stair', 'fill'=>color,
+ 'anchor'=>'c', 'tags'=>['floor1','label'])
+ i = TkcPolygon.new(w,220,34,260,34,282,37,295,40,312,49,
+ 323,56,337,70,350,83,365,94,377,100,
+ 386,104,386,128,220,128,
+ 'fill'=>'', 'tags'=>['floor1','room'])
+ $floorLabels2[i.id] = 'Plaza Deck'
+ $floorItems2['Plaza Deck'] = i
+ w.create(TkcText,303,81, 'text'=>'Plaza Deck', 'fill'=>color,
+ 'anchor'=>'c', 'tags'=>['floor1','label'])
+ i = TkcPolygon.new(w,257,336,77,336,6,336,6,301,77,301,77,310,257,310,
+ 'fill'=>'', 'tags'=>['floor1','room'])
+ $floorLabels2[i.id] = '106'
+ $floorItems2['106'] = i
+ w.create(TkcText,131.5,318.5, 'text'=>'106', 'fill'=>color,
+ 'anchor'=>'c', 'tags'=>['floor1','label'])
+ i = TkcPolygon.new(w,146,110,162,110,162,91,130,91,130,115,95,115,
+ 95,128,114,128,114,151,157,151,157,153,112,153,
+ 112,130,97,130,97,168,175,168,175,131,146,131,
+ 'fill'=>'', 'tags'=>['floor1','room'])
+ $floorLabels2[i.id] = '119'
+ $floorItems2['119'] = i
+ w.create(TkcText,143.5,133, 'text'=>'119', 'fill'=>color,
+ 'anchor'=>'c', 'tags'=>['floor1','label'])
+ w.create(TkcLine,155,191,155,189, 'fill'=>color, 'tags'=>['floor1','wall'])
+ w.create(TkcLine,155,177,155,169, 'fill'=>color, 'tags'=>['floor1','wall'])
+ w.create(TkcLine,96,129,96,169, 'fill'=>color, 'tags'=>['floor1','wall'])
+ w.create(TkcLine,78,169,176,169, 'fill'=>color, 'tags'=>['floor1','wall'])
+ w.create(TkcLine,176,247,176,129, 'fill'=>color, 'tags'=>['floor1','wall'])
+ w.create(TkcLine,340,206,307,206, 'fill'=>color, 'tags'=>['floor1','wall'])
+ w.create(TkcLine,340,187,340,170, 'fill'=>color, 'tags'=>['floor1','wall'])
+ w.create(TkcLine,340,210,340,201, 'fill'=>color, 'tags'=>['floor1','wall'])
+ w.create(TkcLine,340,247,340,224, 'fill'=>color, 'tags'=>['floor1','wall'])
+ w.create(TkcLine,340,241,307,241, 'fill'=>color, 'tags'=>['floor1','wall'])
+ w.create(TkcLine,376,246,376,170, 'fill'=>color, 'tags'=>['floor1','wall'])
+ w.create(TkcLine,307,247,307,170, 'fill'=>color, 'tags'=>['floor1','wall'])
+ w.create(TkcLine,376,170,307,170, 'fill'=>color, 'tags'=>['floor1','wall'])
+ w.create(TkcLine,315,129,315,170, 'fill'=>color, 'tags'=>['floor1','wall'])
+ w.create(TkcLine,147,129,176,129, 'fill'=>color, 'tags'=>['floor1','wall'])
+ w.create(TkcLine,202,133,176,133, 'fill'=>color, 'tags'=>['floor1','wall'])
+ w.create(TkcLine,398,129,315,129, 'fill'=>color, 'tags'=>['floor1','wall'])
+ w.create(TkcLine,258,352,258,387, 'fill'=>color, 'tags'=>['floor1','wall'])
+ w.create(TkcLine,60,387,60,391, 'fill'=>color, 'tags'=>['floor1','wall'])
+ w.create(TkcLine,0,337,0,391, 'fill'=>color, 'tags'=>['floor1','wall'])
+ w.create(TkcLine,60,391,0,391, 'fill'=>color, 'tags'=>['floor1','wall'])
+ w.create(TkcLine,3,114,3,337, 'fill'=>color, 'tags'=>['floor1','wall'])
+ w.create(TkcLine,258,387,60,387, 'fill'=>color, 'tags'=>['floor1','wall'])
+ w.create(TkcLine,52,237,52,273, 'fill'=>color, 'tags'=>['floor1','wall'])
+ w.create(TkcLine,52,189,52,225, 'fill'=>color, 'tags'=>['floor1','wall'])
+ w.create(TkcLine,52,140,52,177, 'fill'=>color, 'tags'=>['floor1','wall'])
+ w.create(TkcLine,395,306,395,311, 'fill'=>color, 'tags'=>['floor1','wall'])
+ w.create(TkcLine,531,254,398,254, 'fill'=>color, 'tags'=>['floor1','wall'])
+ w.create(TkcLine,475,178,475,238, 'fill'=>color, 'tags'=>['floor1','wall'])
+ w.create(TkcLine,502,162,398,162, 'fill'=>color, 'tags'=>['floor1','wall'])
+ w.create(TkcLine,398,129,398,188, 'fill'=>color, 'tags'=>['floor1','wall'])
+ w.create(TkcLine,383,188,376,188, 'fill'=>color, 'tags'=>['floor1','wall'])
+ w.create(TkcLine,408,188,408,194, 'fill'=>color, 'tags'=>['floor1','wall'])
+ w.create(TkcLine,398,227,398,254, 'fill'=>color, 'tags'=>['floor1','wall'])
+ w.create(TkcLine,408,227,398,227, 'fill'=>color, 'tags'=>['floor1','wall'])
+ w.create(TkcLine,408,222,408,227, 'fill'=>color, 'tags'=>['floor1','wall'])
+ w.create(TkcLine,408,206,408,210, 'fill'=>color, 'tags'=>['floor1','wall'])
+ w.create(TkcLine,408,208,475,208, 'fill'=>color, 'tags'=>['floor1','wall'])
+ w.create(TkcLine,484,278,484,311, 'fill'=>color, 'tags'=>['floor1','wall'])
+ w.create(TkcLine,484,311,508,311, 'fill'=>color, 'tags'=>['floor1','wall'])
+ w.create(TkcLine,508,327,508,311, 'fill'=>color, 'tags'=>['floor1','wall'])
+ w.create(TkcLine,559,327,508,327, 'fill'=>color, 'tags'=>['floor1','wall'])
+ w.create(TkcLine,644,391,559,391, 'fill'=>color, 'tags'=>['floor1','wall'])
+ w.create(TkcLine,644,389,644,391, 'fill'=>color, 'tags'=>['floor1','wall'])
+ w.create(TkcLine,514,205,475,205, 'fill'=>color, 'tags'=>['floor1','wall'])
+ w.create(TkcLine,496,189,496,187, 'fill'=>color, 'tags'=>['floor1','wall'])
+ w.create(TkcLine,559,129,484,129, 'fill'=>color, 'tags'=>['floor1','wall'])
+ w.create(TkcLine,484,162,484,129, 'fill'=>color, 'tags'=>['floor1','wall'])
+ w.create(TkcLine,725,133,559,133, 'fill'=>color, 'tags'=>['floor1','wall'])
+ w.create(TkcLine,559,129,559,133, 'fill'=>color, 'tags'=>['floor1','wall'])
+ w.create(TkcLine,725,149,725,167, 'fill'=>color, 'tags'=>['floor1','wall'])
+ w.create(TkcLine,725,129,802,129, 'fill'=>color, 'tags'=>['floor1','wall'])
+ w.create(TkcLine,802,389,802,129, 'fill'=>color, 'tags'=>['floor1','wall'])
+ w.create(TkcLine,739,167,802,167, 'fill'=>color, 'tags'=>['floor1','wall'])
+ w.create(TkcLine,396,188,408,188, 'fill'=>color, 'tags'=>['floor1','wall'])
+ w.create(TkcLine,0,337,9,337, 'fill'=>color, 'tags'=>['floor1','wall'])
+ w.create(TkcLine,58,337,21,337, 'fill'=>color, 'tags'=>['floor1','wall'])
+ w.create(TkcLine,43,391,43,337, 'fill'=>color, 'tags'=>['floor1','wall'])
+ w.create(TkcLine,105,337,75,337, 'fill'=>color, 'tags'=>['floor1','wall'])
+ w.create(TkcLine,91,387,91,337, 'fill'=>color, 'tags'=>['floor1','wall'])
+ w.create(TkcLine,154,337,117,337, 'fill'=>color, 'tags'=>['floor1','wall'])
+ w.create(TkcLine,139,387,139,337, 'fill'=>color, 'tags'=>['floor1','wall'])
+ w.create(TkcLine,227,337,166,337, 'fill'=>color, 'tags'=>['floor1','wall'])
+ w.create(TkcLine,258,337,251,337, 'fill'=>color, 'tags'=>['floor1','wall'])
+ w.create(TkcLine,258,328,302,328, 'fill'=>color, 'tags'=>['floor1','wall'])
+ w.create(TkcLine,302,355,302,311, 'fill'=>color, 'tags'=>['floor1','wall'])
+ w.create(TkcLine,395,311,302,311, 'fill'=>color, 'tags'=>['floor1','wall'])
+ w.create(TkcLine,484,278,395,278, 'fill'=>color, 'tags'=>['floor1','wall'])
+ w.create(TkcLine,395,294,395,278, 'fill'=>color, 'tags'=>['floor1','wall'])
+ w.create(TkcLine,473,278,473,275, 'fill'=>color, 'tags'=>['floor1','wall'])
+ w.create(TkcLine,473,256,473,254, 'fill'=>color, 'tags'=>['floor1','wall'])
+ w.create(TkcLine,533,257,531,254, 'fill'=>color, 'tags'=>['floor1','wall'])
+ w.create(TkcLine,553,276,551,274, 'fill'=>color, 'tags'=>['floor1','wall'])
+ w.create(TkcLine,698,276,553,276, 'fill'=>color, 'tags'=>['floor1','wall'])
+ w.create(TkcLine,559,391,559,327, 'fill'=>color, 'tags'=>['floor1','wall'])
+ w.create(TkcLine,802,389,644,389, 'fill'=>color, 'tags'=>['floor1','wall'])
+ w.create(TkcLine,741,314,741,389, 'fill'=>color, 'tags'=>['floor1','wall'])
+ w.create(TkcLine,698,280,698,167, 'fill'=>color, 'tags'=>['floor1','wall'])
+ w.create(TkcLine,707,280,698,280, 'fill'=>color, 'tags'=>['floor1','wall'])
+ w.create(TkcLine,802,280,731,280, 'fill'=>color, 'tags'=>['floor1','wall'])
+ w.create(TkcLine,741,280,741,302, 'fill'=>color, 'tags'=>['floor1','wall'])
+ w.create(TkcLine,698,167,727,167, 'fill'=>color, 'tags'=>['floor1','wall'])
+ w.create(TkcLine,725,137,725,129, 'fill'=>color, 'tags'=>['floor1','wall'])
+ w.create(TkcLine,514,254,514,175, 'fill'=>color, 'tags'=>['floor1','wall'])
+ w.create(TkcLine,496,175,514,175, 'fill'=>color, 'tags'=>['floor1','wall'])
+ w.create(TkcLine,502,175,502,162, 'fill'=>color, 'tags'=>['floor1','wall'])
+ w.create(TkcLine,475,166,475,162, 'fill'=>color, 'tags'=>['floor1','wall'])
+ w.create(TkcLine,496,176,496,175, 'fill'=>color, 'tags'=>['floor1','wall'])
+ w.create(TkcLine,491,189,496,189, 'fill'=>color, 'tags'=>['floor1','wall'])
+ w.create(TkcLine,491,205,491,189, 'fill'=>color, 'tags'=>['floor1','wall'])
+ w.create(TkcLine,487,238,475,238, 'fill'=>color, 'tags'=>['floor1','wall'])
+ w.create(TkcLine,487,240,487,238, 'fill'=>color, 'tags'=>['floor1','wall'])
+ w.create(TkcLine,487,252,487,254, 'fill'=>color, 'tags'=>['floor1','wall'])
+ w.create(TkcLine,315,133,304,133, 'fill'=>color, 'tags'=>['floor1','wall'])
+ w.create(TkcLine,256,133,280,133, 'fill'=>color, 'tags'=>['floor1','wall'])
+ w.create(TkcLine,78,247,270,247, 'fill'=>color, 'tags'=>['floor1','wall'])
+ w.create(TkcLine,307,247,294,247, 'fill'=>color, 'tags'=>['floor1','wall'])
+ w.create(TkcLine,214,133,232,133, 'fill'=>color, 'tags'=>['floor1','wall'])
+ w.create(TkcLine,217,247,217,266, 'fill'=>color, 'tags'=>['floor1','wall'])
+ w.create(TkcLine,217,309,217,291, 'fill'=>color, 'tags'=>['floor1','wall'])
+ w.create(TkcLine,217,309,172,309, 'fill'=>color, 'tags'=>['floor1','wall'])
+ w.create(TkcLine,154,309,148,309, 'fill'=>color, 'tags'=>['floor1','wall'])
+ w.create(TkcLine,175,300,175,309, 'fill'=>color, 'tags'=>['floor1','wall'])
+ w.create(TkcLine,151,300,175,300, 'fill'=>color, 'tags'=>['floor1','wall'])
+ w.create(TkcLine,151,247,151,309, 'fill'=>color, 'tags'=>['floor1','wall'])
+ w.create(TkcLine,78,237,78,265, 'fill'=>color, 'tags'=>['floor1','wall'])
+ w.create(TkcLine,78,286,78,309, 'fill'=>color, 'tags'=>['floor1','wall'])
+ w.create(TkcLine,106,309,78,309, 'fill'=>color, 'tags'=>['floor1','wall'])
+ w.create(TkcLine,130,309,125,309, 'fill'=>color, 'tags'=>['floor1','wall'])
+ w.create(TkcLine,99,309,99,247, 'fill'=>color, 'tags'=>['floor1','wall'])
+ w.create(TkcLine,127,299,99,299, 'fill'=>color, 'tags'=>['floor1','wall'])
+ w.create(TkcLine,127,309,127,299, 'fill'=>color, 'tags'=>['floor1','wall'])
+ w.create(TkcLine,155,191,137,191, 'fill'=>color, 'tags'=>['floor1','wall'])
+ w.create(TkcLine,137,169,137,191, 'fill'=>color, 'tags'=>['floor1','wall'])
+ w.create(TkcLine,78,171,78,169, 'fill'=>color, 'tags'=>['floor1','wall'])
+ w.create(TkcLine,78,190,78,218, 'fill'=>color, 'tags'=>['floor1','wall'])
+ w.create(TkcLine,86,192,86,169, 'fill'=>color, 'tags'=>['floor1','wall'])
+ w.create(TkcLine,86,192,78,192, 'fill'=>color, 'tags'=>['floor1','wall'])
+ w.create(TkcLine,52,301,3,301, 'fill'=>color, 'tags'=>['floor1','wall'])
+ w.create(TkcLine,52,286,52,301, 'fill'=>color, 'tags'=>['floor1','wall'])
+ w.create(TkcLine,52,252,3,252, 'fill'=>color, 'tags'=>['floor1','wall'])
+ w.create(TkcLine,52,203,3,203, 'fill'=>color, 'tags'=>['floor1','wall'])
+ w.create(TkcLine,3,156,52,156, 'fill'=>color, 'tags'=>['floor1','wall'])
+ w.create(TkcLine,8,25,8,114, 'fill'=>color, 'tags'=>['floor1','wall'])
+ w.create(TkcLine,63,114,3,114, 'fill'=>color, 'tags'=>['floor1','wall'])
+ w.create(TkcLine,75,114,97,114, 'fill'=>color, 'tags'=>['floor1','wall'])
+ w.create(TkcLine,108,114,129,114, 'fill'=>color, 'tags'=>['floor1','wall'])
+ w.create(TkcLine,129,114,129,89, 'fill'=>color, 'tags'=>['floor1','wall'])
+ w.create(TkcLine,52,114,52,128, 'fill'=>color, 'tags'=>['floor1','wall'])
+ w.create(TkcLine,132,89,88,89, 'fill'=>color, 'tags'=>['floor1','wall'])
+ w.create(TkcLine,88,25,88,89, 'fill'=>color, 'tags'=>['floor1','wall'])
+ w.create(TkcLine,88,114,88,89, 'fill'=>color, 'tags'=>['floor1','wall'])
+ w.create(TkcLine,218,89,144,89, 'fill'=>color, 'tags'=>['floor1','wall'])
+ w.create(TkcLine,147,111,147,129, 'fill'=>color, 'tags'=>['floor1','wall'])
+ w.create(TkcLine,162,111,147,111, 'fill'=>color, 'tags'=>['floor1','wall'])
+ w.create(TkcLine,162,109,162,111, 'fill'=>color, 'tags'=>['floor1','wall'])
+ w.create(TkcLine,162,96,162,89, 'fill'=>color, 'tags'=>['floor1','wall'])
+ w.create(TkcLine,218,89,218,94, 'fill'=>color, 'tags'=>['floor1','wall'])
+ w.create(TkcLine,218,89,218,119, 'fill'=>color, 'tags'=>['floor1','wall'])
+ w.create(TkcLine,8,25,88,25, 'fill'=>color, 'tags'=>['floor1','wall'])
+ w.create(TkcLine,258,337,258,328, 'fill'=>color, 'tags'=>['floor1','wall'])
+ w.create(TkcLine,113,129,96,129, 'fill'=>color, 'tags'=>['floor1','wall'])
+ w.create(TkcLine,302,355,258,355, 'fill'=>color, 'tags'=>['floor1','wall'])
+ w.create(TkcLine,386,104,386,129, 'fill'=>color, 'tags'=>['floor1','wall'])
+ w.create(TkcLine,377,100,386,104, 'fill'=>color, 'tags'=>['floor1','wall'])
+ w.create(TkcLine,365,94,377,100, 'fill'=>color, 'tags'=>['floor1','wall'])
+ w.create(TkcLine,350,83,365,94, 'fill'=>color, 'tags'=>['floor1','wall'])
+ w.create(TkcLine,337,70,350,83, 'fill'=>color, 'tags'=>['floor1','wall'])
+ w.create(TkcLine,337,70,323,56, 'fill'=>color, 'tags'=>['floor1','wall'])
+ w.create(TkcLine,312,49,323,56, 'fill'=>color, 'tags'=>['floor1','wall'])
+ w.create(TkcLine,295,40,312,49, 'fill'=>color, 'tags'=>['floor1','wall'])
+ w.create(TkcLine,282,37,295,40, 'fill'=>color, 'tags'=>['floor1','wall'])
+ w.create(TkcLine,260,34,282,37, 'fill'=>color, 'tags'=>['floor1','wall'])
+ w.create(TkcLine,253,34,260,34, 'fill'=>color, 'tags'=>['floor1','wall'])
+ w.create(TkcLine,386,128,386,104, 'fill'=>color, 'tags'=>['floor1','wall'])
+ w.create(TkcLine,113,152,156,152, 'fill'=>color, 'tags'=>['floor1','wall'])
+ w.create(TkcLine,113,152,156,152, 'fill'=>color, 'tags'=>['floor1','wall'])
+ w.create(TkcLine,113,152,113,129, 'fill'=>color, 'tags'=>['floor1','wall'])
+end
+
+# floor2_fg2 --
+# This method represents part of the floorplan database. When
+# invoked, it instantiates the foreground information for the second
+# floor (office outlines and numbers).
+#
+# Arguments:
+# w - The canvas window.
+# color - Color to use for drawing foreground information.
+
+def floor2_fg2(w,color)
+ i = TkcPolygon.new(w,748,188,755,188,755,205,758,205,758,222,
+ 800,222,800,168,748,168,
+ 'fill'=>'', 'tags'=>['floor2','room'])
+ $floorLabels2[i.id] = '238'
+ $floorItems2['238'] = i
+ w.create(TkcText,774,195, 'text'=>'238', 'fill'=>color,
+ 'anchor'=>'c', 'tags'=>['floor2','label'])
+ i = TkcPolygon.new(w,726,188,746,188,746,166,800,166,800,131,726,131,
+ 'fill'=>'', 'tags'=>['floor2','room'])
+ $floorLabels2[i.id] = '237'
+ $floorItems2['237'] = i
+ w.create(TkcText,763,148.5, 'text'=>'237', 'fill'=>color,
+ 'anchor'=>'c', 'tags'=>['floor2','label'])
+ i = TkcPolygon.new(w,497,187,497,204,559,204,559,324,641,324,
+ 643,324,643,291,641,291,641,205,696,205,
+ 696,291,694,291,694,314,715,314,715,291,
+ 715,205,755,205,755,190,724,190,724,187,
+ 'fill'=>'', 'tags'=>['floor2','room'])
+ $floorLabels2[i.id] = '246'
+ $floorItems2['246'] = i
+ w.create(TkcText,600,264, 'text'=>'246', 'fill'=>color,
+ 'anchor'=>'c', 'tags'=>['floor2','label'])
+ i = TkcPolygon.new(w,694,279,643,279,643,314,694,314,
+ 'fill'=>'', 'tags'=>['floor2','room'])
+ $floorLabels2[i.id] = '247'
+ $floorItems2['247'] = i
+ w.create(TkcText,668.5,296.5, 'text'=>'247', 'fill'=>color,
+ 'anchor'=>'c', 'tags'=>['floor2','label'])
+ i = TkcPolygon.new(w,232,250,308,250,308,242,339,242,339,246,
+ 397,246,397,255,476,255,476,250,482,250,559,250,
+ 559,274,482,274,482,278,396,278,396,274,232,274,
+ 'fill'=>'', 'tags'=>['floor2','room'])
+ $floorLabels2[i.id] = '202'
+ $floorItems2['202'] = i
+ w.create(TkcText,285.5,260, 'text'=>'202', 'fill'=>color,
+ 'anchor'=>'c', 'tags'=>['floor2','label'])
+ i = TkcPolygon.new(w,53,228,53,338,176,338,233,338,233,196,
+ 306,196,306,180,175,180,175,169,156,169,
+ 156,196,176,196,176,228,
+ 'fill'=>'', 'tags'=>['floor2','room'])
+ $floorLabels2[i.id] = '206'
+ $floorItems2['206'] = i
+ w.create(TkcText,143,267, 'text'=>'206', 'fill'=>color,
+ 'anchor'=>'c', 'tags'=>['floor2','label'])
+ i = TkcPolygon.new(w,51,277,6,277,6,338,51,338,
+ 'fill'=>'', 'tags'=>['floor2','room'])
+ $floorLabels2[i.id] = '212'
+ $floorItems2['212'] = i
+ w.create(TkcText,28.5,307.5, 'text'=>'212', 'fill'=>color,
+ 'anchor'=>'c', 'tags'=>['floor2','label'])
+ i = TkcPolygon.new(w,557,276,486,276,486,309,510,309,510,325,557,325,
+ 'fill'=>'', 'tags'=>['floor2','room'])
+ $floorLabels2[i.id] = '245'
+ $floorItems2['245'] = i
+ w.create(TkcText,521.5,300.5, 'text'=>'245', 'fill'=>color,
+ 'anchor'=>'c', 'tags'=>['floor2','label'])
+ i = TkcPolygon.new(w,560,389,599,389,599,326,560,326,
+ 'fill'=>'', 'tags'=>['floor2','room'])
+ $floorLabels2[i.id] = '244'
+ $floorItems2['244'] = i
+ w.create(TkcText,579.5,357.5, 'text'=>'244', 'fill'=>color,
+ 'anchor'=>'c', 'tags'=>['floor2','label'])
+ i = TkcPolygon.new(w,601,389,601,326,643,326,643,389,
+ 'fill'=>'', 'tags'=>['floor2','room'])
+ $floorLabels2[i.id] = '243'
+ $floorItems2['243'] = i
+ w.create(TkcText,622,357.5, 'text'=>'243', 'fill'=>color,
+ 'anchor'=>'c', 'tags'=>['floor2','label'])
+ i = TkcPolygon.new(w,688,316,645,316,645,365,688,365,
+ 'fill'=>'', 'tags'=>['floor2','room'])
+ $floorLabels2[i.id] = '242'
+ $floorItems2['242'] = i
+ w.create(TkcText,666.5,340.5, 'text'=>'242', 'fill'=>color,
+ 'anchor'=>'c', 'tags'=>['floor2','label'])
+ i = TkcPolygon.new(w,802,367,759,367,759,226,802,226,
+ 'fill'=>'', 'tags'=>['floor2','room'])
+ $floorLabels2[i.id] = 'Barbecue Deck'
+ $floorItems2['Barbecue Deck'] = i
+ w.create(TkcText,780.5,296.5, 'text'=>'Barbecue Deck', 'fill'=>color,
+ 'anchor'=>'c', 'tags'=>['floor2','label'])
+ i = TkcPolygon.new(w,755,262,755,314,717,314,717,262,
+ 'fill'=>'', 'tags'=>['floor2','room'])
+ $floorLabels2[i.id] = '240'
+ $floorItems2['240'] = i
+ w.create(TkcText,736,288, 'text'=>'240', 'fill'=>color,
+ 'anchor'=>'c', 'tags'=>['floor2','label'])
+ i = TkcPolygon.new(w,755,316,689,316,689,365,755,365,
+ 'fill'=>'', 'tags'=>['floor2','room'])
+ $floorLabels2[i.id] = '241'
+ $floorItems2['241'] = i
+ w.create(TkcText,722,340.5, 'text'=>'241', 'fill'=>color,
+ 'anchor'=>'c', 'tags'=>['floor2','label'])
+ i = TkcPolygon.new(w,755,206,717,206,717,261,755,261,
+ 'fill'=>'', 'tags'=>['floor2','room'])
+ $floorLabels2[i.id] = '239'
+ $floorItems2['239'] = i
+ w.create(TkcText,736,233.5, 'text'=>'239', 'fill'=>color,
+ 'anchor'=>'c', 'tags'=>['floor2','label'])
+ i = TkcPolygon.new(w,695,277,643,277,643,206,695,206,
+ 'fill'=>'', 'tags'=>['floor2','room'])
+ $floorLabels2[i.id] = '248'
+ $floorItems2['248'] = i
+ w.create(TkcText,669,241.5, 'text'=>'248', 'fill'=>color,
+ 'anchor'=>'c', 'tags'=>['floor2','label'])
+ i = TkcPolygon.new(w,676,135,676,185,724,185,724,135,
+ 'fill'=>'', 'tags'=>['floor2','room'])
+ $floorLabels2[i.id] = '236'
+ $floorItems2['236'] = i
+ w.create(TkcText,700,160, 'text'=>'236', 'fill'=>color,
+ 'anchor'=>'c', 'tags'=>['floor2','label'])
+ i = TkcPolygon.new(w,675,135,635,135,635,145,628,145,628,185,675,185,
+ 'fill'=>'', 'tags'=>['floor2','room'])
+ $floorLabels2[i.id] = '235'
+ $floorItems2['235'] = i
+ w.create(TkcText,651.5,160, 'text'=>'235', 'fill'=>color,
+ 'anchor'=>'c', 'tags'=>['floor2','label'])
+ i = TkcPolygon.new(w,626,143,633,143,633,135,572,135,
+ 572,143,579,143,579,185,626,185,
+ 'fill'=>'', 'tags'=>['floor2','room'])
+ $floorLabels2[i.id] = '234'
+ $floorItems2['234'] = i
+ w.create(TkcText,606,160, 'text'=>'234', 'fill'=>color,
+ 'anchor'=>'c', 'tags'=>['floor2','label'])
+ i = TkcPolygon.new(w,557,135,571,135,571,145,578,145,
+ 578,185,527,185,527,131,557,131,
+ 'fill'=>'', 'tags'=>['floor2','room'])
+ $floorLabels2[i.id] = '233'
+ $floorItems2['233'] = i
+ w.create(TkcText,552.5,158, 'text'=>'233', 'fill'=>color,
+ 'anchor'=>'c', 'tags'=>['floor2','label'])
+ i = TkcPolygon.new(w,476,249,557,249,557,205,476,205,
+ 'fill'=>'', 'tags'=>['floor2','room'])
+ $floorLabels2[i.id] = '230'
+ $floorItems2['230'] = i
+ w.create(TkcText,516.5,227, 'text'=>'230', 'fill'=>color,
+ 'anchor'=>'c', 'tags'=>['floor2','label'])
+ i = TkcPolygon.new(w,476,164,486,164,486,131,525,131,525,185,476,185,
+ 'fill'=>'', 'tags'=>['floor2','room'])
+ $floorLabels2[i.id] = '232'
+ $floorItems2['232'] = i
+ w.create(TkcText,500.5,158, 'text'=>'232', 'fill'=>color,
+ 'anchor'=>'c', 'tags'=>['floor2','label'])
+ i = TkcPolygon.new(w,476,186,495,186,495,204,476,204,
+ 'fill'=>'', 'tags'=>['floor2','room'])
+ $floorLabels2[i.id] = '229'
+ $floorItems2['229'] = i
+ w.create(TkcText,485.5,195, 'text'=>'229', 'fill'=>color,
+ 'anchor'=>'c', 'tags'=>['floor2','label'])
+ i = TkcPolygon.new(w,474,207,409,207,409,187,399,187,399,164,474,164,
+ 'fill'=>'', 'tags'=>['floor2','room'])
+ $floorLabels2[i.id] = '227'
+ $floorItems2['227'] = i
+ w.create(TkcText,436.5,185.5, 'text'=>'227', 'fill'=>color,
+ 'anchor'=>'c', 'tags'=>['floor2','label'])
+ i = TkcPolygon.new(w,399,228,399,253,474,253,474,209,409,209,409,228,
+ 'fill'=>'', 'tags'=>['floor2','room'])
+ $floorLabels2[i.id] = '228'
+ $floorItems2['228'] = i
+ w.create(TkcText,436.5,231, 'text'=>'228', 'fill'=>color,
+ 'anchor'=>'c', 'tags'=>['floor2','label'])
+ i = TkcPolygon.new(w,397,246,397,226,407,226,407,189,377,189,377,246,
+ 'fill'=>'', 'tags'=>['floor2','room'])
+ $floorLabels2[i.id] = '226'
+ $floorItems2['226'] = i
+ w.create(TkcText,392,217.5, 'text'=>'226', 'fill'=>color,
+ 'anchor'=>'c', 'tags'=>['floor2','label'])
+ i = TkcPolygon.new(w,377,169,316,169,316,131,397,131,397,188,377,188,
+ 'fill'=>'', 'tags'=>['floor2','room'])
+ $floorLabels2[i.id] = '225'
+ $floorItems2['225'] = i
+ w.create(TkcText,356.5,150, 'text'=>'225', 'fill'=>color,
+ 'anchor'=>'c', 'tags'=>['floor2','label'])
+ i = TkcPolygon.new(w,234,198,306,198,306,249,234,249,
+ 'fill'=>'', 'tags'=>['floor2','room'])
+ $floorLabels2[i.id] = '224'
+ $floorItems2['224'] = i
+ w.create(TkcText,270,223.5, 'text'=>'224', 'fill'=>color,
+ 'anchor'=>'c', 'tags'=>['floor2','label'])
+ i = TkcPolygon.new(w,270,179,306,179,306,170,314,170,314,135,270,135,
+ 'fill'=>'', 'tags'=>['floor2','room'])
+ $floorLabels2[i.id] = '223'
+ $floorItems2['223'] = i
+ w.create(TkcText,292,157, 'text'=>'223', 'fill'=>color,
+ 'anchor'=>'c', 'tags'=>['floor2','label'])
+ i = TkcPolygon.new(w,268,179,221,179,221,135,268,135,
+ 'fill'=>'', 'tags'=>['floor2','room'])
+ $floorLabels2[i.id] = '222'
+ $floorItems2['222'] = i
+ w.create(TkcText,244.5,157, 'text'=>'222', 'fill'=>color,
+ 'anchor'=>'c', 'tags'=>['floor2','label'])
+ i = TkcPolygon.new(w,177,179,219,179,219,135,177,135,
+ 'fill'=>'', 'tags'=>['floor2','room'])
+ $floorLabels2[i.id] = '221'
+ $floorItems2['221'] = i
+ w.create(TkcText,198,157, 'text'=>'221', 'fill'=>color,
+ 'anchor'=>'c', 'tags'=>['floor2','label'])
+ i = TkcPolygon.new(w,299,327,349,327,349,284,341,284,341,276,299,276,
+ 'fill'=>'', 'tags'=>['floor2','room'])
+ $floorLabels2[i.id] = '204'
+ $floorItems2['204'] = i
+ w.create(TkcText,324,301.5, 'text'=>'204', 'fill'=>color,
+ 'anchor'=>'c', 'tags'=>['floor2','label'])
+ i = TkcPolygon.new(w,234,276,297,276,297,327,257,327,257,338,234,338,
+ 'fill'=>'', 'tags'=>['floor2','room'])
+ $floorLabels2[i.id] = '205'
+ $floorItems2['205'] = i
+ w.create(TkcText,265.5,307, 'text'=>'205', 'fill'=>color,
+ 'anchor'=>'c', 'tags'=>['floor2','label'])
+ i = TkcPolygon.new(w,256,385,256,340,212,340,212,385,
+ 'fill'=>'', 'tags'=>['floor2','room'])
+ $floorLabels2[i.id] = '207'
+ $floorItems2['207'] = i
+ w.create(TkcText,234,362.5, 'text'=>'207', 'fill'=>color,
+ 'anchor'=>'c', 'tags'=>['floor2','label'])
+ i = TkcPolygon.new(w,210,340,164,340,164,385,210,385,
+ 'fill'=>'', 'tags'=>['floor2','room'])
+ $floorLabels2[i.id] = '208'
+ $floorItems2['208'] = i
+ w.create(TkcText,187,362.5, 'text'=>'208', 'fill'=>color,
+ 'anchor'=>'c', 'tags'=>['floor2','label'])
+ i = TkcPolygon.new(w,115,340,162,340,162,385,115,385,
+ 'fill'=>'', 'tags'=>['floor2','room'])
+ $floorLabels2[i.id] = '209'
+ $floorItems2['209'] = i
+ w.create(TkcText,138.5,362.5, 'text'=>'209', 'fill'=>color,
+ 'anchor'=>'c', 'tags'=>['floor2','label'])
+ i = TkcPolygon.new(w,89,228,89,156,53,156,53,228,
+ 'fill'=>'', 'tags'=>['floor2','room'])
+ $floorLabels2[i.id] = '217'
+ $floorItems2['217'] = i
+ w.create(TkcText,71,192, 'text'=>'217', 'fill'=>color,
+ 'anchor'=>'c', 'tags'=>['floor2','label'])
+ i = TkcPolygon.new(w,89,169,97,169,97,190,89,190,
+ 'fill'=>'', 'tags'=>['floor2','room'])
+ $floorLabels2[i.id] = '217A'
+ $floorItems2['217A'] = i
+ w.create(TkcText,93,179.5, 'text'=>'217A', 'fill'=>color,
+ 'anchor'=>'c', 'tags'=>['floor2','label'])
+ i = TkcPolygon.new(w,89,156,89,168,95,168,95,135,53,135,53,156,
+ 'fill'=>'', 'tags'=>['floor2','room'])
+ $floorLabels2[i.id] = '216'
+ $floorItems2['216'] = i
+ w.create(TkcText,71,145.5, 'text'=>'216', 'fill'=>color,
+ 'anchor'=>'c', 'tags'=>['floor2','label'])
+ i = TkcPolygon.new(w,51,179,51,135,6,135,6,179,
+ 'fill'=>'', 'tags'=>['floor2','room'])
+ $floorLabels2[i.id] = '215'
+ $floorItems2['215'] = i
+ w.create(TkcText,28.5,157, 'text'=>'215', 'fill'=>color,
+ 'anchor'=>'c', 'tags'=>['floor2','label'])
+ i = TkcPolygon.new(w,51,227,6,227,6,180,51,180,
+ 'fill'=>'', 'tags'=>['floor2','room'])
+ $floorLabels2[i.id] = '214'
+ $floorItems2['214'] = i
+ w.create(TkcText,28.5,203.5, 'text'=>'214', 'fill'=>color,
+ 'anchor'=>'c', 'tags'=>['floor2','label'])
+ i = TkcPolygon.new(w,51,275,6,275,6,229,51,229,
+ 'fill'=>'', 'tags'=>['floor2','room'])
+ $floorLabels2[i.id] = '213'
+ $floorItems2['213'] = i
+ w.create(TkcText,28.5,252, 'text'=>'213', 'fill'=>color,
+ 'anchor'=>'c', 'tags'=>['floor2','label'])
+ i = TkcPolygon.new(w,114,340,67,340,67,385,114,385,
+ 'fill'=>'', 'tags'=>['floor2','room'])
+ $floorLabels2[i.id] = '210'
+ $floorItems2['210'] = i
+ w.create(TkcText,90.5,362.5, 'text'=>'210', 'fill'=>color,
+ 'anchor'=>'c', 'tags'=>['floor2','label'])
+ i = TkcPolygon.new(w,59,389,59,385,65,385,65,340,1,340,1,389,
+ 'fill'=>'', 'tags'=>['floor2','room'])
+ $floorLabels2[i.id] = '211'
+ $floorItems2['211'] = i
+ w.create(TkcText,33,364.5, 'text'=>'211', 'fill'=>color,
+ 'anchor'=>'c', 'tags'=>['floor2','label'])
+ i = TkcPolygon.new(w,393,309,350,309,350,282,342,282,342,276,393,276,
+ 'fill'=>'', 'tags'=>['floor2','room'])
+ $floorLabels2[i.id] = '203'
+ $floorItems2['203'] = i
+ w.create(TkcText,367.5,292.5, 'text'=>'203', 'fill'=>color,
+ 'anchor'=>'c', 'tags'=>['floor2','label'])
+ i = TkcPolygon.new(w,99,191,91,191,91,226,174,226,174,198,
+ 154,198,154,192,109,192,109,169,99,169,
+ 'fill'=>'', 'tags'=>['floor2','room'])
+ $floorLabels2[i.id] = '220'
+ $floorItems2['220'] = i
+ w.create(TkcText,132.5,208.5, 'text'=>'220', 'fill'=>color,
+ 'anchor'=>'c', 'tags'=>['floor2','label'])
+ i = TkcPolygon.new(w,339,205,307,205,307,171,339,171,
+ 'fill'=>'', 'tags'=>['floor2','room'])
+ $floorLabels2[i.id] = 'Priv Lift2'
+ $floorItems2['Priv Lift2'] = i
+ w.create(TkcText,323,188, 'text'=>'Priv Lift2', 'fill'=>color,
+ 'anchor'=>'c', 'tags'=>['floor2','label'])
+ i = TkcPolygon.new(w,307,240,339,240,339,206,307,206,
+ 'fill'=>'', 'tags'=>['floor2','room'])
+ $floorLabels2[i.id] = 'Pub Lift 2'
+ $floorItems2['Pub Lift 2'] = i
+ w.create(TkcText,323,223, 'text'=>'Pub Lift 2', 'fill'=>color,
+ 'anchor'=>'c', 'tags'=>['floor2','label'])
+ i = TkcPolygon.new(w,175,168,97,168,97,131,175,131,
+ 'fill'=>'', 'tags'=>['floor2','room'])
+ $floorLabels2[i.id] = '218'
+ $floorItems2['218'] = i
+ w.create(TkcText,136,149.5, 'text'=>'218', 'fill'=>color,
+ 'anchor'=>'c', 'tags'=>['floor2','label'])
+ i = TkcPolygon.new(w,154,191,111,191,111,169,154,169,
+ 'fill'=>'', 'tags'=>['floor2','room'])
+ $floorLabels2[i.id] = '219'
+ $floorItems2['219'] = i
+ w.create(TkcText,132.5,180, 'text'=>'219', 'fill'=>color,
+ 'anchor'=>'c', 'tags'=>['floor2','label'])
+ i = TkcPolygon.new(w,375,246,375,172,341,172,341,246,
+ 'fill'=>'', 'tags'=>['floor2','room'])
+ $floorLabels2[i.id] = '201'
+ $floorItems2['201'] = i
+ w.create(TkcText,358,209, 'text'=>'201', 'fill'=>color,
+ 'anchor'=>'c', 'tags'=>['floor2','label'])
+ w.create(TkcLine,641,186,678,186, 'fill'=>color, 'tags'=>['floor2','wall'])
+ w.create(TkcLine,757,350,757,367, 'fill'=>color, 'tags'=>['floor2','wall'])
+ w.create(TkcLine,634,133,634,144, 'fill'=>color, 'tags'=>['floor2','wall'])
+ w.create(TkcLine,634,144,627,144, 'fill'=>color, 'tags'=>['floor2','wall'])
+ w.create(TkcLine,572,133,572,144, 'fill'=>color, 'tags'=>['floor2','wall'])
+ w.create(TkcLine,572,144,579,144, 'fill'=>color, 'tags'=>['floor2','wall'])
+ w.create(TkcLine,398,129,398,162, 'fill'=>color, 'tags'=>['floor2','wall'])
+ w.create(TkcLine,174,197,175,197, 'fill'=>color, 'tags'=>['floor2','wall'])
+ w.create(TkcLine,175,197,175,227, 'fill'=>color, 'tags'=>['floor2','wall'])
+ w.create(TkcLine,757,206,757,221, 'fill'=>color, 'tags'=>['floor2','wall'])
+ w.create(TkcLine,396,188,408,188, 'fill'=>color, 'tags'=>['floor2','wall'])
+ w.create(TkcLine,727,189,725,189, 'fill'=>color, 'tags'=>['floor2','wall'])
+ w.create(TkcLine,747,167,802,167, 'fill'=>color, 'tags'=>['floor2','wall'])
+ w.create(TkcLine,747,167,747,189, 'fill'=>color, 'tags'=>['floor2','wall'])
+ w.create(TkcLine,755,189,739,189, 'fill'=>color, 'tags'=>['floor2','wall'])
+ w.create(TkcLine,769,224,757,224, 'fill'=>color, 'tags'=>['floor2','wall'])
+ w.create(TkcLine,802,224,802,129, 'fill'=>color, 'tags'=>['floor2','wall'])
+ w.create(TkcLine,802,129,725,129, 'fill'=>color, 'tags'=>['floor2','wall'])
+ w.create(TkcLine,725,189,725,129, 'fill'=>color, 'tags'=>['floor2','wall'])
+ w.create(TkcLine,725,186,690,186, 'fill'=>color, 'tags'=>['floor2','wall'])
+ w.create(TkcLine,676,133,676,186, 'fill'=>color, 'tags'=>['floor2','wall'])
+ w.create(TkcLine,627,144,627,186, 'fill'=>color, 'tags'=>['floor2','wall'])
+ w.create(TkcLine,629,186,593,186, 'fill'=>color, 'tags'=>['floor2','wall'])
+ w.create(TkcLine,579,144,579,186, 'fill'=>color, 'tags'=>['floor2','wall'])
+ w.create(TkcLine,559,129,559,133, 'fill'=>color, 'tags'=>['floor2','wall'])
+ w.create(TkcLine,725,133,559,133, 'fill'=>color, 'tags'=>['floor2','wall'])
+ w.create(TkcLine,484,162,484,129, 'fill'=>color, 'tags'=>['floor2','wall'])
+ w.create(TkcLine,559,129,484,129, 'fill'=>color, 'tags'=>['floor2','wall'])
+ w.create(TkcLine,526,129,526,186, 'fill'=>color, 'tags'=>['floor2','wall'])
+ w.create(TkcLine,540,186,581,186, 'fill'=>color, 'tags'=>['floor2','wall'])
+ w.create(TkcLine,528,186,523,186, 'fill'=>color, 'tags'=>['floor2','wall'])
+ w.create(TkcLine,511,186,475,186, 'fill'=>color, 'tags'=>['floor2','wall'])
+ w.create(TkcLine,496,190,496,186, 'fill'=>color, 'tags'=>['floor2','wall'])
+ w.create(TkcLine,496,205,496,202, 'fill'=>color, 'tags'=>['floor2','wall'])
+ w.create(TkcLine,475,205,527,205, 'fill'=>color, 'tags'=>['floor2','wall'])
+ w.create(TkcLine,558,205,539,205, 'fill'=>color, 'tags'=>['floor2','wall'])
+ w.create(TkcLine,558,205,558,249, 'fill'=>color, 'tags'=>['floor2','wall'])
+ w.create(TkcLine,558,249,475,249, 'fill'=>color, 'tags'=>['floor2','wall'])
+ w.create(TkcLine,662,206,642,206, 'fill'=>color, 'tags'=>['floor2','wall'])
+ w.create(TkcLine,695,206,675,206, 'fill'=>color, 'tags'=>['floor2','wall'])
+ w.create(TkcLine,695,278,642,278, 'fill'=>color, 'tags'=>['floor2','wall'])
+ w.create(TkcLine,642,291,642,206, 'fill'=>color, 'tags'=>['floor2','wall'])
+ w.create(TkcLine,695,291,695,206, 'fill'=>color, 'tags'=>['floor2','wall'])
+ w.create(TkcLine,716,208,716,206, 'fill'=>color, 'tags'=>['floor2','wall'])
+ w.create(TkcLine,757,206,716,206, 'fill'=>color, 'tags'=>['floor2','wall'])
+ w.create(TkcLine,757,221,757,224, 'fill'=>color, 'tags'=>['floor2','wall'])
+ w.create(TkcLine,793,224,802,224, 'fill'=>color, 'tags'=>['floor2','wall'])
+ w.create(TkcLine,757,262,716,262, 'fill'=>color, 'tags'=>['floor2','wall'])
+ w.create(TkcLine,716,220,716,264, 'fill'=>color, 'tags'=>['floor2','wall'])
+ w.create(TkcLine,716,315,716,276, 'fill'=>color, 'tags'=>['floor2','wall'])
+ w.create(TkcLine,757,315,703,315, 'fill'=>color, 'tags'=>['floor2','wall'])
+ w.create(TkcLine,757,325,757,224, 'fill'=>color, 'tags'=>['floor2','wall'])
+ w.create(TkcLine,757,367,644,367, 'fill'=>color, 'tags'=>['floor2','wall'])
+ w.create(TkcLine,689,367,689,315, 'fill'=>color, 'tags'=>['floor2','wall'])
+ w.create(TkcLine,647,315,644,315, 'fill'=>color, 'tags'=>['floor2','wall'])
+ w.create(TkcLine,659,315,691,315, 'fill'=>color, 'tags'=>['floor2','wall'])
+ w.create(TkcLine,600,325,600,391, 'fill'=>color, 'tags'=>['floor2','wall'])
+ w.create(TkcLine,627,325,644,325, 'fill'=>color, 'tags'=>['floor2','wall'])
+ w.create(TkcLine,644,391,644,315, 'fill'=>color, 'tags'=>['floor2','wall'])
+ w.create(TkcLine,615,325,575,325, 'fill'=>color, 'tags'=>['floor2','wall'])
+ w.create(TkcLine,644,391,558,391, 'fill'=>color, 'tags'=>['floor2','wall'])
+ w.create(TkcLine,563,325,558,325, 'fill'=>color, 'tags'=>['floor2','wall'])
+ w.create(TkcLine,558,391,558,314, 'fill'=>color, 'tags'=>['floor2','wall'])
+ w.create(TkcLine,558,327,508,327, 'fill'=>color, 'tags'=>['floor2','wall'])
+ w.create(TkcLine,558,275,484,275, 'fill'=>color, 'tags'=>['floor2','wall'])
+ w.create(TkcLine,558,302,558,275, 'fill'=>color, 'tags'=>['floor2','wall'])
+ w.create(TkcLine,508,327,508,311, 'fill'=>color, 'tags'=>['floor2','wall'])
+ w.create(TkcLine,484,311,508,311, 'fill'=>color, 'tags'=>['floor2','wall'])
+ w.create(TkcLine,484,275,484,311, 'fill'=>color, 'tags'=>['floor2','wall'])
+ w.create(TkcLine,475,208,408,208, 'fill'=>color, 'tags'=>['floor2','wall'])
+ w.create(TkcLine,408,206,408,210, 'fill'=>color, 'tags'=>['floor2','wall'])
+ w.create(TkcLine,408,222,408,227, 'fill'=>color, 'tags'=>['floor2','wall'])
+ w.create(TkcLine,408,227,398,227, 'fill'=>color, 'tags'=>['floor2','wall'])
+ w.create(TkcLine,398,227,398,254, 'fill'=>color, 'tags'=>['floor2','wall'])
+ w.create(TkcLine,408,188,408,194, 'fill'=>color, 'tags'=>['floor2','wall'])
+ w.create(TkcLine,383,188,376,188, 'fill'=>color, 'tags'=>['floor2','wall'])
+ w.create(TkcLine,398,188,398,162, 'fill'=>color, 'tags'=>['floor2','wall'])
+ w.create(TkcLine,398,162,484,162, 'fill'=>color, 'tags'=>['floor2','wall'])
+ w.create(TkcLine,475,162,475,254, 'fill'=>color, 'tags'=>['floor2','wall'])
+ w.create(TkcLine,398,254,475,254, 'fill'=>color, 'tags'=>['floor2','wall'])
+ w.create(TkcLine,484,280,395,280, 'fill'=>color, 'tags'=>['floor2','wall'])
+ w.create(TkcLine,395,311,395,275, 'fill'=>color, 'tags'=>['floor2','wall'])
+ w.create(TkcLine,307,197,293,197, 'fill'=>color, 'tags'=>['floor2','wall'])
+ w.create(TkcLine,278,197,233,197, 'fill'=>color, 'tags'=>['floor2','wall'])
+ w.create(TkcLine,233,197,233,249, 'fill'=>color, 'tags'=>['floor2','wall'])
+ w.create(TkcLine,307,179,284,179, 'fill'=>color, 'tags'=>['floor2','wall'])
+ w.create(TkcLine,233,249,278,249, 'fill'=>color, 'tags'=>['floor2','wall'])
+ w.create(TkcLine,269,179,269,133, 'fill'=>color, 'tags'=>['floor2','wall'])
+ w.create(TkcLine,220,179,220,133, 'fill'=>color, 'tags'=>['floor2','wall'])
+ w.create(TkcLine,155,191,110,191, 'fill'=>color, 'tags'=>['floor2','wall'])
+ w.create(TkcLine,90,190,98,190, 'fill'=>color, 'tags'=>['floor2','wall'])
+ w.create(TkcLine,98,169,98,190, 'fill'=>color, 'tags'=>['floor2','wall'])
+ w.create(TkcLine,52,133,52,165, 'fill'=>color, 'tags'=>['floor2','wall'])
+ w.create(TkcLine,52,214,52,177, 'fill'=>color, 'tags'=>['floor2','wall'])
+ w.create(TkcLine,52,226,52,262, 'fill'=>color, 'tags'=>['floor2','wall'])
+ w.create(TkcLine,52,274,52,276, 'fill'=>color, 'tags'=>['floor2','wall'])
+ w.create(TkcLine,234,275,234,339, 'fill'=>color, 'tags'=>['floor2','wall'])
+ w.create(TkcLine,226,339,258,339, 'fill'=>color, 'tags'=>['floor2','wall'])
+ w.create(TkcLine,211,387,211,339, 'fill'=>color, 'tags'=>['floor2','wall'])
+ w.create(TkcLine,214,339,177,339, 'fill'=>color, 'tags'=>['floor2','wall'])
+ w.create(TkcLine,258,387,60,387, 'fill'=>color, 'tags'=>['floor2','wall'])
+ w.create(TkcLine,3,133,3,339, 'fill'=>color, 'tags'=>['floor2','wall'])
+ w.create(TkcLine,165,339,129,339, 'fill'=>color, 'tags'=>['floor2','wall'])
+ w.create(TkcLine,117,339,80,339, 'fill'=>color, 'tags'=>['floor2','wall'])
+ w.create(TkcLine,68,339,59,339, 'fill'=>color, 'tags'=>['floor2','wall'])
+ w.create(TkcLine,0,339,46,339, 'fill'=>color, 'tags'=>['floor2','wall'])
+ w.create(TkcLine,60,391,0,391, 'fill'=>color, 'tags'=>['floor2','wall'])
+ w.create(TkcLine,0,339,0,391, 'fill'=>color, 'tags'=>['floor2','wall'])
+ w.create(TkcLine,60,387,60,391, 'fill'=>color, 'tags'=>['floor2','wall'])
+ w.create(TkcLine,258,329,258,387, 'fill'=>color, 'tags'=>['floor2','wall'])
+ w.create(TkcLine,350,329,258,329, 'fill'=>color, 'tags'=>['floor2','wall'])
+ w.create(TkcLine,395,311,350,311, 'fill'=>color, 'tags'=>['floor2','wall'])
+ w.create(TkcLine,398,129,315,129, 'fill'=>color, 'tags'=>['floor2','wall'])
+ w.create(TkcLine,176,133,315,133, 'fill'=>color, 'tags'=>['floor2','wall'])
+ w.create(TkcLine,176,129,96,129, 'fill'=>color, 'tags'=>['floor2','wall'])
+ w.create(TkcLine,3,133,96,133, 'fill'=>color, 'tags'=>['floor2','wall'])
+ w.create(TkcLine,66,387,66,339, 'fill'=>color, 'tags'=>['floor2','wall'])
+ w.create(TkcLine,115,387,115,339, 'fill'=>color, 'tags'=>['floor2','wall'])
+ w.create(TkcLine,163,387,163,339, 'fill'=>color, 'tags'=>['floor2','wall'])
+ w.create(TkcLine,234,275,276,275, 'fill'=>color, 'tags'=>['floor2','wall'])
+ w.create(TkcLine,288,275,309,275, 'fill'=>color, 'tags'=>['floor2','wall'])
+ w.create(TkcLine,298,275,298,329, 'fill'=>color, 'tags'=>['floor2','wall'])
+ w.create(TkcLine,341,283,350,283, 'fill'=>color, 'tags'=>['floor2','wall'])
+ w.create(TkcLine,321,275,341,275, 'fill'=>color, 'tags'=>['floor2','wall'])
+ w.create(TkcLine,375,275,395,275, 'fill'=>color, 'tags'=>['floor2','wall'])
+ w.create(TkcLine,315,129,315,170, 'fill'=>color, 'tags'=>['floor2','wall'])
+ w.create(TkcLine,376,170,307,170, 'fill'=>color, 'tags'=>['floor2','wall'])
+ w.create(TkcLine,307,250,307,170, 'fill'=>color, 'tags'=>['floor2','wall'])
+ w.create(TkcLine,376,245,376,170, 'fill'=>color, 'tags'=>['floor2','wall'])
+ w.create(TkcLine,340,241,307,241, 'fill'=>color, 'tags'=>['floor2','wall'])
+ w.create(TkcLine,340,245,340,224, 'fill'=>color, 'tags'=>['floor2','wall'])
+ w.create(TkcLine,340,210,340,201, 'fill'=>color, 'tags'=>['floor2','wall'])
+ w.create(TkcLine,340,187,340,170, 'fill'=>color, 'tags'=>['floor2','wall'])
+ w.create(TkcLine,340,206,307,206, 'fill'=>color, 'tags'=>['floor2','wall'])
+ w.create(TkcLine,293,250,307,250, 'fill'=>color, 'tags'=>['floor2','wall'])
+ w.create(TkcLine,271,179,238,179, 'fill'=>color, 'tags'=>['floor2','wall'])
+ w.create(TkcLine,226,179,195,179, 'fill'=>color, 'tags'=>['floor2','wall'])
+ w.create(TkcLine,176,129,176,179, 'fill'=>color, 'tags'=>['floor2','wall'])
+ w.create(TkcLine,182,179,176,179, 'fill'=>color, 'tags'=>['floor2','wall'])
+ w.create(TkcLine,174,169,176,169, 'fill'=>color, 'tags'=>['floor2','wall'])
+ w.create(TkcLine,162,169,90,169, 'fill'=>color, 'tags'=>['floor2','wall'])
+ w.create(TkcLine,96,169,96,129, 'fill'=>color, 'tags'=>['floor2','wall'])
+ w.create(TkcLine,175,227,90,227, 'fill'=>color, 'tags'=>['floor2','wall'])
+ w.create(TkcLine,90,190,90,227, 'fill'=>color, 'tags'=>['floor2','wall'])
+ w.create(TkcLine,52,179,3,179, 'fill'=>color, 'tags'=>['floor2','wall'])
+ w.create(TkcLine,52,228,3,228, 'fill'=>color, 'tags'=>['floor2','wall'])
+ w.create(TkcLine,52,276,3,276, 'fill'=>color, 'tags'=>['floor2','wall'])
+ w.create(TkcLine,155,177,155,169, 'fill'=>color, 'tags'=>['floor2','wall'])
+ w.create(TkcLine,110,191,110,169, 'fill'=>color, 'tags'=>['floor2','wall'])
+ w.create(TkcLine,155,189,155,197, 'fill'=>color, 'tags'=>['floor2','wall'])
+ w.create(TkcLine,350,283,350,329, 'fill'=>color, 'tags'=>['floor2','wall'])
+ w.create(TkcLine,162,197,155,197, 'fill'=>color, 'tags'=>['floor2','wall'])
+ w.create(TkcLine,341,275,341,283, 'fill'=>color, 'tags'=>['floor2','wall'])
+end
+
+# floor2_fg3 --
+# This method represents part of the floorplan database. When
+# invoked, it instantiates the foreground information for the third
+# floor (office outlines and numbers).
+#
+# Arguments:
+# w - The canvas window.
+# color - Color to use for drawing foreground information.
+
+def floor2_fg3(w,color)
+ i = TkcPolygon.new(w,89,228,89,180,70,180,70,228,
+ 'fill'=>'', 'tags'=>['floor3','room'])
+ $floorLabels2[i.id] = '316'
+ $floorItems2['316'] = i
+ w.create(TkcText,79.5,204, 'text'=>'316', 'fill'=>color,
+ 'anchor'=>'c', 'tags'=>['floor3','label'])
+ i = TkcPolygon.new(w,115,368,162,368,162,323,115,323,
+ 'fill'=>'', 'tags'=>['floor3','room'])
+ $floorLabels2[i.id] = '309'
+ $floorItems2['309'] = i
+ w.create(TkcText,138.5,345.5, 'text'=>'309', 'fill'=>color,
+ 'anchor'=>'c', 'tags'=>['floor3','label'])
+ i = TkcPolygon.new(w,164,323,164,368,211,368,211,323,
+ 'fill'=>'', 'tags'=>['floor3','room'])
+ $floorLabels2[i.id] = '308'
+ $floorItems2['308'] = i
+ w.create(TkcText,187.5,345.5, 'text'=>'308', 'fill'=>color,
+ 'anchor'=>'c', 'tags'=>['floor3','label'])
+ i = TkcPolygon.new(w,256,368,212,368,212,323,256,323,
+ 'fill'=>'', 'tags'=>['floor3','room'])
+ $floorLabels2[i.id] = '307'
+ $floorItems2['307'] = i
+ w.create(TkcText,234,345.5, 'text'=>'307', 'fill'=>color,
+ 'anchor'=>'c', 'tags'=>['floor3','label'])
+ i = TkcPolygon.new(w,244,276,297,276,297,327,260,327,260,321,244,321,
+ 'fill'=>'', 'tags'=>['floor3','room'])
+ $floorLabels2[i.id] = '305'
+ $floorItems2['305'] = i
+ w.create(TkcText,270.5,301.5, 'text'=>'305', 'fill'=>color,
+ 'anchor'=>'c', 'tags'=>['floor3','label'])
+ i = TkcPolygon.new(w,251,219,251,203,244,203,244,219,
+ 'fill'=>'', 'tags'=>['floor3','room'])
+ $floorLabels2[i.id] = '324B'
+ $floorItems2['324B'] = i
+ w.create(TkcText,247.5,211, 'text'=>'324B', 'fill'=>color,
+ 'anchor'=>'c', 'tags'=>['floor3','label'])
+ i = TkcPolygon.new(w,251,249,244,249,244,232,251,232,
+ 'fill'=>'', 'tags'=>['floor3','room'])
+ $floorLabels2[i.id] = '324A'
+ $floorItems2['324A'] = i
+ w.create(TkcText,247.5,240.5, 'text'=>'324A', 'fill'=>color,
+ 'anchor'=>'c', 'tags'=>['floor3','label'])
+ i = TkcPolygon.new(w,223,135,223,179,177,179,177,135,
+ 'fill'=>'', 'tags'=>['floor3','room'])
+ $floorLabels2[i.id] = '320'
+ $floorItems2['320'] = i
+ w.create(TkcText,200,157, 'text'=>'320', 'fill'=>color,
+ 'anchor'=>'c', 'tags'=>['floor3','label'])
+ i = TkcPolygon.new(w,114,368,114,323,67,323,67,368,
+ 'fill'=>'', 'tags'=>['floor3','room'])
+ $floorLabels2[i.id] = '310'
+ $floorItems2['310'] = i
+ w.create(TkcText,90.5,345.5, 'text'=>'310', 'fill'=>color,
+ 'anchor'=>'c', 'tags'=>['floor3','label'])
+ i = TkcPolygon.new(w,23,277,23,321,68,321,68,277,
+ 'fill'=>'', 'tags'=>['floor3','room'])
+ $floorLabels2[i.id] = '312'
+ $floorItems2['312'] = i
+ w.create(TkcText,45.5,299, 'text'=>'312', 'fill'=>color,
+ 'anchor'=>'c', 'tags'=>['floor3','label'])
+ i = TkcPolygon.new(w,23,229,68,229,68,275,23,275,
+ 'fill'=>'', 'tags'=>['floor3','room'])
+ $floorLabels2[i.id] = '313'
+ $floorItems2['313'] = i
+ w.create(TkcText,45.5,252, 'text'=>'313', 'fill'=>color,
+ 'anchor'=>'c', 'tags'=>['floor3','label'])
+ i = TkcPolygon.new(w,68,227,23,227,23,180,68,180,
+ 'fill'=>'', 'tags'=>['floor3','room'])
+ $floorLabels2[i.id] = '314'
+ $floorItems2['314'] = i
+ w.create(TkcText,40.5,203.5, 'text'=>'314', 'fill'=>color,
+ 'anchor'=>'c', 'tags'=>['floor3','label'])
+ i = TkcPolygon.new(w,95,179,95,135,23,135,23,179,
+ 'fill'=>'', 'tags'=>['floor3','room'])
+ $floorLabels2[i.id] = '315'
+ $floorItems2['315'] = i
+ w.create(TkcText,59,157, 'text'=>'315', 'fill'=>color,
+ 'anchor'=>'c', 'tags'=>['floor3','label'])
+ i = TkcPolygon.new(w,99,226,99,204,91,204,91,226,
+ 'fill'=>'', 'tags'=>['floor3','room'])
+ $floorLabels2[i.id] = '316B'
+ $floorItems2['316B'] = i
+ w.create(TkcText,95,215, 'text'=>'316B', 'fill'=>color,
+ 'anchor'=>'c', 'tags'=>['floor3','label'])
+ i = TkcPolygon.new(w,91,202,99,202,99,180,91,180,
+ 'fill'=>'', 'tags'=>['floor3','room'])
+ $floorLabels2[i.id] = '316A'
+ $floorItems2['316A'] = i
+ w.create(TkcText,95,191, 'text'=>'316A', 'fill'=>color,
+ 'anchor'=>'c', 'tags'=>['floor3','label'])
+ i = TkcPolygon.new(w,97,169,109,169,109,192,154,192,154,198,
+ 174,198,174,226,101,226,101,179,97,179,
+ 'fill'=>'', 'tags'=>['floor3','room'])
+ $floorLabels2[i.id] = '319'
+ $floorItems2['319'] = i
+ w.create(TkcText,141.5,209, 'text'=>'319', 'fill'=>color,
+ 'anchor'=>'c', 'tags'=>['floor3','label'])
+ i = TkcPolygon.new(w,65,368,58,368,58,389,1,389,1,333,23,333,23,323,65,323,
+ 'fill'=>'', 'tags'=>['floor3','room'])
+ $floorLabels2[i.id] = '311'
+ $floorItems2['311'] = i
+ w.create(TkcText,29.5,361, 'text'=>'311', 'fill'=>color,
+ 'anchor'=>'c', 'tags'=>['floor3','label'])
+ i = TkcPolygon.new(w,154,191,111,191,111,169,154,169,
+ 'fill'=>'', 'tags'=>['floor3','room'])
+ $floorLabels2[i.id] = '318'
+ $floorItems2['318'] = i
+ w.create(TkcText,132.5,180, 'text'=>'318', 'fill'=>color,
+ 'anchor'=>'c', 'tags'=>['floor3','label'])
+ i = TkcPolygon.new(w,175,168,97,168,97,131,175,131,
+ 'fill'=>'', 'tags'=>['floor3','room'])
+ $floorLabels2[i.id] = '317'
+ $floorItems2['317'] = i
+ w.create(TkcText,136,149.5, 'text'=>'317', 'fill'=>color,
+ 'anchor'=>'c', 'tags'=>['floor3','label'])
+ i = TkcPolygon.new(w,274,194,274,221,306,221,306,194,
+ 'fill'=>'', 'tags'=>['floor3','room'])
+ $floorLabels2[i.id] = '323'
+ $floorItems2['323'] = i
+ w.create(TkcText,290,207.5, 'text'=>'323', 'fill'=>color,
+ 'anchor'=>'c', 'tags'=>['floor3','label'])
+ i = TkcPolygon.new(w,306,222,274,222,274,249,306,249,
+ 'fill'=>'', 'tags'=>['floor3','room'])
+ $floorLabels2[i.id] = '325'
+ $floorItems2['325'] = i
+ w.create(TkcText,290,235.5, 'text'=>'325', 'fill'=>color,
+ 'anchor'=>'c', 'tags'=>['floor3','label'])
+ i = TkcPolygon.new(w,263,179,224,179,224,135,263,135,
+ 'fill'=>'', 'tags'=>['floor3','room'])
+ $floorLabels2[i.id] = '321'
+ $floorItems2['321'] = i
+ w.create(TkcText,243.5,157, 'text'=>'321', 'fill'=>color,
+ 'anchor'=>'c', 'tags'=>['floor3','label'])
+ i = TkcPolygon.new(w,314,169,306,169,306,192,273,192,
+ 264,181,264,135,314,135,
+ 'fill'=>'', 'tags'=>['floor3','room'])
+ $floorLabels2[i.id] = '322'
+ $floorItems2['322'] = i
+ w.create(TkcText,293.5,163.5, 'text'=>'322', 'fill'=>color,
+ 'anchor'=>'c', 'tags'=>['floor3','label'])
+ i = TkcPolygon.new(w,307,240,339,240,339,206,307,206,
+ 'fill'=>'', 'tags'=>['floor3','room'])
+ $floorLabels2[i.id] = 'Pub Lift3'
+ $floorItems2['Pub Lift3'] = i
+ w.create(TkcText,323,223, 'text'=>'Pub Lift3', 'fill'=>color,
+ 'anchor'=>'c', 'tags'=>['floor3','label'])
+ i = TkcPolygon.new(w,339,205,307,205,307,171,339,171,
+ 'fill'=>'', 'tags'=>['floor3','room'])
+ $floorLabels2[i.id] = 'Priv Lift3'
+ $floorItems2['Priv Lift3'] = i
+ w.create(TkcText,323,188, 'text'=>'Priv Lift3', 'fill'=>color,
+ 'anchor'=>'c', 'tags'=>['floor3','label'])
+ i = TkcPolygon.new(w,350,284,376,284,376,276,397,276,397,309,350,309,
+ 'fill'=>'', 'tags'=>['floor3','room'])
+ $floorLabels2[i.id] = '303'
+ $floorItems2['303'] = i
+ w.create(TkcText,373.5,292.5, 'text'=>'303', 'fill'=>color,
+ 'anchor'=>'c', 'tags'=>['floor3','label'])
+ i = TkcPolygon.new(w,272,203,272,249,252,249,252,230,
+ 244,230,244,221,252,221,252,203,
+ 'fill'=>'', 'tags'=>['floor3','room'])
+ $floorLabels2[i.id] = '324'
+ $floorItems2['324'] = i
+ w.create(TkcText,262,226, 'text'=>'324', 'fill'=>color,
+ 'anchor'=>'c', 'tags'=>['floor3','label'])
+ i = TkcPolygon.new(w,299,276,299,327,349,327,349,284,341,284,341,276,
+ 'fill'=>'', 'tags'=>['floor3','room'])
+ $floorLabels2[i.id] = '304'
+ $floorItems2['304'] = i
+ w.create(TkcText,324,301.5, 'text'=>'304', 'fill'=>color,
+ 'anchor'=>'c', 'tags'=>['floor3','label'])
+ i = TkcPolygon.new(w,375,246,375,172,341,172,341,246,
+ 'fill'=>'', 'tags'=>['floor3','room'])
+ $floorLabels2[i.id] = '301'
+ $floorItems2['301'] = i
+ w.create(TkcText,358,209, 'text'=>'301', 'fill'=>color,
+ 'anchor'=>'c', 'tags'=>['floor3','label'])
+ i = TkcPolygon.new(w,397,246,377,246,377,185,397,185,
+ 'fill'=>'', 'tags'=>['floor3','room'])
+ $floorLabels2[i.id] = '327'
+ $floorItems2['327'] = i
+ w.create(TkcText,387,215.5, 'text'=>'327', 'fill'=>color,
+ 'anchor'=>'c', 'tags'=>['floor3','label'])
+ i = TkcPolygon.new(w,316,131,316,169,377,169,377,185,397,185,397,131,
+ 'fill'=>'', 'tags'=>['floor3','room'])
+ $floorLabels2[i.id] = '326'
+ $floorItems2['326'] = i
+ w.create(TkcText,365.5,150, 'text'=>'326', 'fill'=>color,
+ 'anchor'=>'c', 'tags'=>['floor3','label'])
+ i = TkcPolygon.new(w,308,251,242,251,242,274,342,274,342,282,375, 282,
+ 375,274,397,274,397,248,339,248,339,242,308,242,
+ 'fill'=>'', 'tags'=>['floor3','room'])
+ $floorLabels2[i.id] = '302'
+ $floorItems2['302'] = i
+ w.create(TkcText,319.5,261, 'text'=>'302', 'fill'=>color,
+ 'anchor'=>'c', 'tags'=>['floor3','label'])
+ i = TkcPolygon.new(w,70,321,242,321,242,200,259,200,259,203,272,203,
+ 272,193,263,180,242,180,175,180,175,169,156,169,
+ 156,196,177,196,177,228,107,228,70,228,70,275,107,275,
+ 107,248,160,248,160,301,107,301,107,275,70,275,
+ 'fill'=>'', 'tags'=>['floor3','room'])
+ $floorLabels2[i.id] = '306'
+ $floorItems2['306'] = i
+ w.create(TkcText,200.5,284.5, 'text'=>'306', 'fill'=>color,
+ 'anchor'=>'c', 'tags'=>['floor3','label'])
+ w.create(TkcLine,341,275,341,283, 'fill'=>color, 'tags'=>['floor3','wall'])
+ w.create(TkcLine,162,197,155,197, 'fill'=>color, 'tags'=>['floor3','wall'])
+ w.create(TkcLine,396,247,399,247, 'fill'=>color, 'tags'=>['floor3','wall'])
+ w.create(TkcLine,399,129,399,311, 'fill'=>color, 'tags'=>['floor3','wall'])
+ w.create(TkcLine,258,202,243,202, 'fill'=>color, 'tags'=>['floor3','wall'])
+ w.create(TkcLine,350,283,350,329, 'fill'=>color, 'tags'=>['floor3','wall'])
+ w.create(TkcLine,251,231,243,231, 'fill'=>color, 'tags'=>['floor3','wall'])
+ w.create(TkcLine,243,220,251,220, 'fill'=>color, 'tags'=>['floor3','wall'])
+ w.create(TkcLine,243,250,243,202, 'fill'=>color, 'tags'=>['floor3','wall'])
+ w.create(TkcLine,155,197,155,190, 'fill'=>color, 'tags'=>['floor3','wall'])
+ w.create(TkcLine,110,192,110,169, 'fill'=>color, 'tags'=>['floor3','wall'])
+ w.create(TkcLine,155,192,110,192, 'fill'=>color, 'tags'=>['floor3','wall'])
+ w.create(TkcLine,155,177,155,169, 'fill'=>color, 'tags'=>['floor3','wall'])
+ w.create(TkcLine,176,197,176,227, 'fill'=>color, 'tags'=>['floor3','wall'])
+ w.create(TkcLine,69,280,69,274, 'fill'=>color, 'tags'=>['floor3','wall'])
+ w.create(TkcLine,21,276,69,276, 'fill'=>color, 'tags'=>['floor3','wall'])
+ w.create(TkcLine,69,262,69,226, 'fill'=>color, 'tags'=>['floor3','wall'])
+ w.create(TkcLine,21,228,69,228, 'fill'=>color, 'tags'=>['floor3','wall'])
+ w.create(TkcLine,21,179,75,179, 'fill'=>color, 'tags'=>['floor3','wall'])
+ w.create(TkcLine,69,179,69,214, 'fill'=>color, 'tags'=>['floor3','wall'])
+ w.create(TkcLine,90,220,90,227, 'fill'=>color, 'tags'=>['floor3','wall'])
+ w.create(TkcLine,90,204,90,202, 'fill'=>color, 'tags'=>['floor3','wall'])
+ w.create(TkcLine,90,203,100,203, 'fill'=>color, 'tags'=>['floor3','wall'])
+ w.create(TkcLine,90,187,90,179, 'fill'=>color, 'tags'=>['floor3','wall'])
+ w.create(TkcLine,90,227,176,227, 'fill'=>color, 'tags'=>['floor3','wall'])
+ w.create(TkcLine,100,179,100,227, 'fill'=>color, 'tags'=>['floor3','wall'])
+ w.create(TkcLine,100,179,87,179, 'fill'=>color, 'tags'=>['floor3','wall'])
+ w.create(TkcLine,96,179,96,129, 'fill'=>color, 'tags'=>['floor3','wall'])
+ w.create(TkcLine,162,169,96,169, 'fill'=>color, 'tags'=>['floor3','wall'])
+ w.create(TkcLine,173,169,176,169, 'fill'=>color, 'tags'=>['floor3','wall'])
+ w.create(TkcLine,182,179,176,179, 'fill'=>color, 'tags'=>['floor3','wall'])
+ w.create(TkcLine,176,129,176,179, 'fill'=>color, 'tags'=>['floor3','wall'])
+ w.create(TkcLine,195,179,226,179, 'fill'=>color, 'tags'=>['floor3','wall'])
+ w.create(TkcLine,224,133,224,179, 'fill'=>color, 'tags'=>['floor3','wall'])
+ w.create(TkcLine,264,179,264,133, 'fill'=>color, 'tags'=>['floor3','wall'])
+ w.create(TkcLine,238,179,264,179, 'fill'=>color, 'tags'=>['floor3','wall'])
+ w.create(TkcLine,273,207,273,193, 'fill'=>color, 'tags'=>['floor3','wall'])
+ w.create(TkcLine,273,235,273,250, 'fill'=>color, 'tags'=>['floor3','wall'])
+ w.create(TkcLine,273,224,273,219, 'fill'=>color, 'tags'=>['floor3','wall'])
+ w.create(TkcLine,273,193,307,193, 'fill'=>color, 'tags'=>['floor3','wall'])
+ w.create(TkcLine,273,222,307,222, 'fill'=>color, 'tags'=>['floor3','wall'])
+ w.create(TkcLine,273,250,307,250, 'fill'=>color, 'tags'=>['floor3','wall'])
+ w.create(TkcLine,384,247,376,247, 'fill'=>color, 'tags'=>['floor3','wall'])
+ w.create(TkcLine,340,206,307,206, 'fill'=>color, 'tags'=>['floor3','wall'])
+ w.create(TkcLine,340,187,340,170, 'fill'=>color, 'tags'=>['floor3','wall'])
+ w.create(TkcLine,340,210,340,201, 'fill'=>color, 'tags'=>['floor3','wall'])
+ w.create(TkcLine,340,247,340,224, 'fill'=>color, 'tags'=>['floor3','wall'])
+ w.create(TkcLine,340,241,307,241, 'fill'=>color, 'tags'=>['floor3','wall'])
+ w.create(TkcLine,376,247,376,170, 'fill'=>color, 'tags'=>['floor3','wall'])
+ w.create(TkcLine,307,250,307,170, 'fill'=>color, 'tags'=>['floor3','wall'])
+ w.create(TkcLine,376,170,307,170, 'fill'=>color, 'tags'=>['floor3','wall'])
+ w.create(TkcLine,315,129,315,170, 'fill'=>color, 'tags'=>['floor3','wall'])
+ w.create(TkcLine,376,283,366,283, 'fill'=>color, 'tags'=>['floor3','wall'])
+ w.create(TkcLine,376,283,376,275, 'fill'=>color, 'tags'=>['floor3','wall'])
+ w.create(TkcLine,399,275,376,275, 'fill'=>color, 'tags'=>['floor3','wall'])
+ w.create(TkcLine,341,275,320,275, 'fill'=>color, 'tags'=>['floor3','wall'])
+ w.create(TkcLine,341,283,350,283, 'fill'=>color, 'tags'=>['floor3','wall'])
+ w.create(TkcLine,298,275,298,329, 'fill'=>color, 'tags'=>['floor3','wall'])
+ w.create(TkcLine,308,275,298,275, 'fill'=>color, 'tags'=>['floor3','wall'])
+ w.create(TkcLine,243,322,243,275, 'fill'=>color, 'tags'=>['floor3','wall'])
+ w.create(TkcLine,243,275,284,275, 'fill'=>color, 'tags'=>['floor3','wall'])
+ w.create(TkcLine,258,322,226,322, 'fill'=>color, 'tags'=>['floor3','wall'])
+ w.create(TkcLine,212,370,212,322, 'fill'=>color, 'tags'=>['floor3','wall'])
+ w.create(TkcLine,214,322,177,322, 'fill'=>color, 'tags'=>['floor3','wall'])
+ w.create(TkcLine,163,370,163,322, 'fill'=>color, 'tags'=>['floor3','wall'])
+ w.create(TkcLine,165,322,129,322, 'fill'=>color, 'tags'=>['floor3','wall'])
+ w.create(TkcLine,84,322,117,322, 'fill'=>color, 'tags'=>['floor3','wall'])
+ w.create(TkcLine,71,322,64,322, 'fill'=>color, 'tags'=>['floor3','wall'])
+ w.create(TkcLine,115,322,115,370, 'fill'=>color, 'tags'=>['floor3','wall'])
+ w.create(TkcLine,66,322,66,370, 'fill'=>color, 'tags'=>['floor3','wall'])
+ w.create(TkcLine,52,322,21,322, 'fill'=>color, 'tags'=>['floor3','wall'])
+ w.create(TkcLine,21,331,0,331, 'fill'=>color, 'tags'=>['floor3','wall'])
+ w.create(TkcLine,21,331,21,133, 'fill'=>color, 'tags'=>['floor3','wall'])
+ w.create(TkcLine,96,133,21,133, 'fill'=>color, 'tags'=>['floor3','wall'])
+ w.create(TkcLine,176,129,96,129, 'fill'=>color, 'tags'=>['floor3','wall'])
+ w.create(TkcLine,315,133,176,133, 'fill'=>color, 'tags'=>['floor3','wall'])
+ w.create(TkcLine,315,129,399,129, 'fill'=>color, 'tags'=>['floor3','wall'])
+ w.create(TkcLine,399,311,350,311, 'fill'=>color, 'tags'=>['floor3','wall'])
+ w.create(TkcLine,350,329,258,329, 'fill'=>color, 'tags'=>['floor3','wall'])
+ w.create(TkcLine,258,322,258,370, 'fill'=>color, 'tags'=>['floor3','wall'])
+ w.create(TkcLine,60,370,258,370, 'fill'=>color, 'tags'=>['floor3','wall'])
+ w.create(TkcLine,60,370,60,391, 'fill'=>color, 'tags'=>['floor3','wall'])
+ w.create(TkcLine,0,391,0,331, 'fill'=>color, 'tags'=>['floor3','wall'])
+ w.create(TkcLine,60,391,0,391, 'fill'=>color, 'tags'=>['floor3','wall'])
+ w.create(TkcLine,307,250,307,242, 'fill'=>color, 'tags'=>['floor3','wall'])
+ w.create(TkcLine,273,250,307,250, 'fill'=>color, 'tags'=>['floor3','wall'])
+ w.create(TkcLine,258,250,243,250, 'fill'=>color, 'tags'=>['floor3','wall'])
+end
+
+# Below is the "main program" that creates the floorplan demonstration.
+
+# toplevel widget ¤¬Â¸ºß¤¹¤ì¤Ðºï½ü¤¹¤ë
+if defined?($floor2_demo) && $floor2_demo
+ $floor2_demo.destroy
+ $floor2_demo = nil
+end
+
+# demo ÍѤΠtoplevel widget ¤òÀ¸À®
+$floor2_demo = TkToplevel.new {|w|
+ title("Floorplan Canvas Demonstration 2")
+ iconname("Floorplan2")
+ positionWindow(w)
+ geometry('+20+20')
+ minsize(100,100)
+}
+
+# label À¸À®
+TkLabel.new($floor2_demo, 'font'=>$font, 'wraplength'=>'8i', 'justify'=>'left',
+ 'text'=>"¤³¤Î¥¦¥£¥ó¥É¥¦¤Ë¤Ï¥Ç¥£¥¸¥¿¥ë¥¨¥¯¥¤¥Ã¥×¥á¥ó¥È¼Ò¤Î¥¦¥§¥¹¥¿¥ó¥ê¥µ¡¼¥Á¥é¥Ü¥é¥È¥ê (DECWRL) ¤Î´Ö¼è¤ê¤¬½ñ¤«¤ì¤¿¥­¥ã¥ó¥Ð¥¹ widget ¤¬Æþ¤Ã¤Æ¤¤¤Þ¤¹¡£¤³¤ì¤Ï 3³¬·ú¤Æ¤Ç¡¢¾ï¤Ë¤½¤Î¤¦¤Á¤Î1³¬Ê¬¤¬ÁªÂò¡¢¤Ä¤Þ¤ê¤½¤Î´Ö¼è¤ê¤¬É½¼¨¤µ¤ì¤ë¤è¤¦¤Ë¤Ê¤Ã¤Æ¤¤¤Þ¤¹¡£¤¢¤ë³¬¤òÁªÂò¤¹¤ë¤Ë¤Ï¡¢¤½¤Î¾å¤Ç¥Þ¥¦¥¹¤Îº¸¥Ü¥¿¥ó¤ò¥¯¥ê¥Ã¥¯¤·¤Æ¤¯¤À¤µ¤¤¡£¥Þ¥¦¥¹¤¬ÁªÂò¤µ¤ì¤Æ¤¤¤ë³¬¤Î¾å¤òÆ°¤¯¤È¡¢¤½¤Î²¼¤Ë¤¢¤ëÉô²°¤Î¿§¤¬ÊѤï¤ê¡¢Éô²°Èֹ椬¡ÖÉô²°ÈÖ¹æ:¡×¥¨¥ó¥È¥ê¤Ëɽ¼¨¤µ¤ì¤Þ¤¹¡£¤Þ¤¿¡¢¥¨¥ó¥È¥ê¤ËÉô²°ÈÖ¹æ¤ò½ñ¤¯¤È¤½¤ÎÉô²°¤Î¿§¤¬ÊѤï¤ê¤Þ¤¹¡£"){
+ pack('side'=>'top')
+}
+
+# frame À¸À®
+$floor2_buttons = TkFrame.new($floor2_demo) {|frame|
+ TkButton.new(frame) {
+ #text 'λ²ò'
+ text 'ÊĤ¸¤ë'
+ command proc{
+ tmppath = $floor2_demo
+ $floor2_demo = nil
+ tmppath.destroy
+ }
+ }.pack('side'=>'left', 'expand'=>'yes')
+
+ TkButton.new(frame) {
+ text '¥³¡¼¥É»²¾È'
+ command proc{showCode 'floor2'}
+ }.pack('side'=>'left', 'expand'=>'yes')
+}
+$floor2_buttons.pack('side'=>'bottom', 'fill'=>'x', 'pady'=>'2m')
+
+# ÊÑ¿ôÀßÄê
+$floorLabels2 = {}
+$floorItems2 = {}
+
+# canvas ÀßÄê
+if $tk_version =~ /^4\.[01]/
+ $floor2_canvas_frame = TkFrame.new($floor2_demo,'bd'=>2,'relief'=>'sunken',
+ 'highlightthickness'=>2)
+ $floor2_canvas = TkCanvas.new($floor2_canvas_frame,
+ 'width'=>900, 'height'=>500, 'borderwidth'=>0,
+ 'highlightthickness'=>0) {|c|
+ TkScrollbar.new($floor2_demo, 'orient'=>'horiz',
+ 'command'=>proc{|*args| c.xview(*args)}){|hs|
+ c.xscrollcommand(proc{|first,last| hs.set first,last})
+ pack('side'=>'bottom', 'fill'=>'x')
+ }
+ TkScrollbar.new($floor2_demo, 'command'=>proc{|*args| c.yview(*args)}){|vs|
+ c.yscrollcommand(proc{|first,last| vs.set first,last})
+ pack('side'=>'right', 'fill'=>'y')
+ }
+ }
+ $floor2_canvas_frame.pack('side'=>'top','fill'=>'both', 'expand'=>'yes')
+ $floor2_canvas.pack('expand'=>'yes', 'fill'=>'both')
+
+else
+ TkFrame.new($floor2_demo) {|f|
+ pack('side'=>'top', 'fill'=>'both', 'expand'=>'yes')
+
+ h = TkScrollbar.new(f, 'highlightthickness'=>0, 'orient'=>'horizontal')
+ v = TkScrollbar.new(f, 'highlightthickness'=>0, 'orient'=>'vertical')
+
+ TkFrame.new(f, 'bd'=>2, 'relief'=>'sunken') {|f1|
+ $floor2_canvas = TkCanvas.new(f1, 'width'=>900, 'height'=>500,
+ 'borderwidth'=>0,
+ 'highlightthickness'=>0) {
+ xscrollcommand(proc{|first,last| h.set first,last})
+ yscrollcommand(proc{|first,last| v.set first,last})
+ pack('expand'=>'yes', 'fill'=>'both')
+ }
+ grid('padx'=>1, 'pady'=>1, 'row'=>0, 'column'=>0,
+ 'rowspan'=>1, 'columnspan'=>1, 'sticky'=>'news')
+ }
+
+ v.grid('padx'=>1, 'pady'=>1, 'row'=>0, 'column'=>1,
+ 'rowspan'=>1, 'columnspan'=>1, 'sticky'=>'news')
+ h.grid('padx'=>1, 'pady'=>1, 'row'=>1, 'column'=>0,
+ 'rowspan'=>1, 'columnspan'=>1, 'sticky'=>'news')
+
+ TkGrid.rowconfigure(f, 0, 'weight'=>1, 'minsize'=>0)
+ TkGrid.columnconfigure(f, 0, 'weight'=>1, 'minsize'=>0)
+
+ pack('expand'=>'yes', 'fill'=>'both', 'padx'=>1, 'pady'=>1)
+
+ v.command(proc{|*args| c.yview(*args)})
+ h.command(proc{|*args| c.xview(*args)})
+ }
+end
+
+# Create an entry for displaying and typing in current room.
+
+$currentRoom2 = TkVariable.new
+$floor2_entry = TkEntry.new($floor2_canvas, 'width'=>10, 'relief'=>'sunken',
+ 'bd'=>2, 'textvariable'=>$currentRoom2)
+
+# Choose colors, then fill in the floorplan.
+
+$floor2_colors = {}
+if TkWinfo.depth($floor2_canvas) > 1
+ $floor2_colors['bg1'] = '#a9c1da'
+ $floor2_colors['outline1'] = '#77889a'
+ $floor2_colors['bg2'] = '#9ab0c6'
+ $floor2_colors['outline2'] = '#687786'
+ $floor2_colors['bg3'] = '#8ba0b3'
+ $floor2_colors['outline3'] = '#596673'
+ $floor2_colors['offices'] = 'Black'
+ $floor2_colors['active'] = '#c4d1df'
+else
+ $floor2_colors['bg1'] = 'white'
+ $floor2_colors['outline1'] = 'black'
+ $floor2_colors['bg2'] = 'white'
+ $floor2_colors['outline2'] = 'black'
+ $floor2_colors['bg3'] = 'white'
+ $floor2_colors['outline3'] = 'black'
+ $floor2_colors['offices'] = 'Black'
+ $floor2_colors['active'] = 'black'
+end
+
+$activeFloor2 = ''
+floorDisplay2 $floor2_canvas,3
+
+# Set up event bindings for canvas:
+
+$floor2_canvas.itembind('floor1', '1', proc{floorDisplay2 $floor2_canvas,1})
+$floor2_canvas.itembind('floor2', '1', proc{floorDisplay2 $floor2_canvas,2})
+$floor2_canvas.itembind('floor3', '1', proc{floorDisplay2 $floor2_canvas,3})
+$floor2_canvas.itembind('room', 'Enter', proc{newRoom2 $floor2_canvas})
+$floor2_canvas.itembind('room', 'Leave', proc{$currentRoom2.value = ''})
+$floor2_canvas.bind('2', proc{|x,y| $floor2_canvas.scan_mark x,y}, '%x %y')
+$floor2_canvas.bind('B2-Motion',
+ proc{|x,y| $floor2_canvas.scan_dragto x,y}, '%x %y')
+$floor2_canvas.bind('Destroy', proc{$currentRoom2.unset})
+$currentRoom2.value = ''
+$currentRoom2.trace('w',proc{roomChanged2 $floor2_canvas})
diff --git a/ext/tk/sample/demos-jp/radio3.rb b/ext/tk/sample/demos-jp/radio3.rb
new file mode 100644
index 0000000000..bdc3ee0bf5
--- /dev/null
+++ b/ext/tk/sample/demos-jp/radio3.rb
@@ -0,0 +1,114 @@
+# radio3.rb
+#
+# This demonstration script creates a toplevel window containing
+# several radiobutton widgets.
+#
+# radiobutton widget demo (called by 'widget')
+#
+
+# toplevel widget
+if defined?($radio3_demo) && $radio3_demo
+ $radio3_demo.destroy
+ $radio3_demo = nil
+end
+
+# demo toplevel widget
+$radio3_demo = TkToplevel.new {|w|
+ title("Radiobutton Demonstration 3")
+ iconname("radio3")
+ positionWindow(w)
+}
+
+# label
+msg = TkLabel.new($radio3_demo) {
+ font $font
+ wraplength '5i'
+ justify 'left'
+ text '²¼¤Ë¤Ï3¤Ä¤Î¥é¥¸¥ª¥Ü¥¿¥ó¥°¥ë¡¼¥×¤¬É½¼¨¤µ¤ì¤Æ¤¤¤Þ¤¹¡£¥Ü¥¿¥ó¤ò¥¯¥ê¥Ã¥¯¤¹¤ë¤È¡¢¤½¤Î¥°¥ë¡¼¥×¤Ë°¤¹¤ë¤¹¤Ù¤Æ¤Î¥Ü¥¿¥ó¤ÎÃæ¤Ç¥¯¥ê¥Ã¥¯¤·¤¿¥Ü¥¿¥ó¤À¤±¤¬ÁªÂò¤µ¤ì¤¿¾õÂ֤ˤʤê¤Þ¤¹¡£³Æ¥°¥ë¡¼¥×¤Ë¤Ï¡¢¤½¤Î¥°¥ë¡¼¥×¤ÎÃæ¤Î¤É¤Î¥Ü¥¿¥ó¤¬ÁªÂò¤µ¤ì¤Æ¤¤¤ë¤«¤ò¼¨¤¹ÊÑ¿ô¤¬³ä¤êÅö¤Æ¤é¤ì¤Æ¤¤¤Þ¤¹¡£¡Ö¥È¥é¥¤¥¹¥Æ¡¼¥È¡×¥Ü¥¿¥ó¤¬²¡¤µ¤ì¤¿¤È¤­¤Ë¤Ï¡¢¥é¥¸¥ª¥Ü¥¿¥ó¤Îɽ¼¨¤¬¥È¥é¥¤¥¹¥Æ¡¼¥È¥â¡¼¥É¤Ë¤Ê¤ê¤Þ¤¹¡£¤¤¤º¤ì¤«¤Î¥Ü¥¿¥ó¤òÁªÂò¤¹¤ì¤Ð¡¢¥Ü¥¿¥ó¤Î¾õÂ֤ϸµ¤Î¤è¤¦¤Ë¸Ä¡¹¤Î¥Ü¥¿¥ó¤Îon/off¾õÂÖ¤ò¼¨¤¹¤è¤¦¤Ë¤Ê¤ê¤Þ¤¹¡£¸½ºß¤ÎÊÑ¿ô¤ÎÃͤò¸«¤ë¤Ë¤Ï¡ÖÊÑ¿ô»²¾È¡×¥Ü¥¿¥ó¤ò¥¯¥ê¥Ã¥¯¤·¤Æ¤¯¤À¤µ¤¤¡£'
+}
+msg.grid(:row=>0, :column=>0, :columnspan=>3, :sticky=>'nsew')
+
+# variable
+size = TkVariable.new
+color = TkVariable.new
+align = TkVariable.new
+
+# frame
+TkFrame.new($radio3_demo) {|frame|
+ TkGrid(TkFrame.new(frame, :height=>2, :relief=>:sunken, :bd=>2),
+ :columnspan=>4, :row=>0, :sticky=>'ew', :pady=>2)
+ TkGrid('x',
+ TkButton.new(frame, :text=>'ÊÑ¿ô»²¾È',
+ :image=>$image['view'], :compound=>:left,
+ :command=>proc{
+ showVars($radio3_demo, ['size', size],
+ ['color', color], ['compound', align])
+ }),
+ TkButton.new(frame, :text=>'¥³¡¼¥É»²¾È',
+ :image=>$image['view'], :compound=>:left,
+ :command=>proc{showCode 'radio3'}),
+ TkButton.new(frame, :text=>'ÊĤ¸¤ë',
+ :image=>$image['delete'], :compound=>:left,
+ :command=>proc{
+ tmppath = $radio3_demo
+ $radio3_demo = nil
+ $showVarsWin[tmppath.path] = nil
+ tmppath.destroy
+ }),
+ :padx=>4, :pady=>4)
+ frame.grid_columnconfigure(0, :weight=>1)
+ TkGrid(frame, :row=>3, :column=>0, :columnspan=>3, :sticky=>'nsew')
+}
+
+# frame
+f_left = TkLabelFrame.new($radio3_demo, 'text'=>'ʸ»ú¥µ¥¤¥º',
+ 'pady'=>2, 'padx'=>2)
+f_mid = TkLabelFrame.new($radio3_demo, 'text'=>'¿§',
+ 'pady'=>2, 'padx'=>2)
+f_right = TkLabelFrame.new($radio3_demo, 'text'=>'¥Ó¥Ã¥È¥Þ¥Ã¥×ÇÛÃÖ',
+ 'pady'=>2, 'padx'=>2)
+f_left .grid('column'=>0, 'row'=>1, 'pady'=>'.5c', 'padx'=>'.5c', 'rowspan'=>2)
+f_mid .grid('column'=>1, 'row'=>1, 'pady'=>'.5c', 'padx'=>'.5c', 'rowspan'=>2)
+f_right.grid('column'=>2, 'row'=>1, 'pady'=>'.5c', 'padx'=>'.5c')
+
+TkButton.new($radio3_demo, 'text'=>'¥È¥é¥¤¥¹¥Æ¡¼¥È',
+ 'command'=>proc{size.value = 'multi'; color.value = 'multi'}){
+ grid('column'=>2, 'row'=>2, 'pady'=>'.5c', 'padx'=>'.5c')
+}
+
+# radiobutton
+[10, 12, 14, 18, 24].each {|sz|
+ TkRadioButton.new(f_left) {
+ text "¥Ý¥¤¥ó¥È¥µ¥¤¥º #{sz}"
+ variable size
+ relief 'flat'
+ value sz
+ tristatevalue 'multi'
+ }.pack('side'=>'top', 'pady'=>2, 'anchor'=>'w', 'fill'=>'x')
+}
+
+['Red', 'Green', 'Blue', 'Yellow', 'Orange', 'Purple'].each {|col|
+ TkRadioButton.new(f_mid) {
+ text col
+ variable color
+ relief 'flat'
+ value col.downcase
+ anchor 'w'
+ tristatevalue 'multi'
+ command proc{f_mid.fg(color.value)}
+ }.pack('side'=>'top', 'pady'=>2, 'fill'=>'x')
+}
+
+label = TkLabel.new(f_right, 'text'=>'¥é¥Ù¥ë', 'bitmap'=>'questhead',
+ 'compound'=>'left')
+label.configure('width'=>TkWinfo.reqwidth(label), 'compound'=>'top')
+label.height(TkWinfo.reqheight(label))
+a_btn = ['Top', 'Left', 'Right', 'Bottom'].collect{|a|
+ TkRadioButton.new(f_right, 'text'=>a, 'variable'=>align, 'relief'=>'flat',
+ 'value'=>a.downcase, 'indicatoron'=>0, 'width'=>7,
+ 'command'=>proc{label.compound(align.value)})
+}
+
+Tk.grid('x', a_btn[0])
+Tk.grid(a_btn[1], label, a_btn[2])
+Tk.grid('x', a_btn[3])
diff --git a/ext/tk/sample/demos-jp/twind2.rb b/ext/tk/sample/demos-jp/twind2.rb
new file mode 100644
index 0000000000..8c871688b3
--- /dev/null
+++ b/ext/tk/sample/demos-jp/twind2.rb
@@ -0,0 +1,381 @@
+#
+# text (embedded windows) widget demo 2 (called by 'widget')
+#
+
+# toplevel widget ¤¬Â¸ºß¤¹¤ì¤Ðºï½ü¤¹¤ë
+if defined?($twind2_demo) && $twind2_demo
+ $twind2_demo.destroy
+ $twind2_demo = nil
+end
+
+# demo ÍѤΠtoplevel widget ¤òÀ¸À®
+$twind2_demo = TkToplevel.new {|w|
+ title("Text Demonstration - Embedded Windows 2")
+ iconname("Embedded Windows")
+ positionWindow(w)
+}
+
+# frame À¸À®
+$twind2_buttons = TkFrame.new($twind2_demo) {|frame|
+ TkGrid(TkFrame.new(frame, :height=>2, :relief=>:sunken, :bd=>2),
+ :columnspan=>4, :row=>0, :sticky=>'ew', :pady=>2)
+ TkGrid('x',
+ TkButton.new(frame, :text=>'¥³¡¼¥É»²¾È',
+ :image=>$image['view'], :compound=>:left,
+ :command=>proc{showCode 'twind2'}),
+ TkButton.new(frame, :text=>'ÊĤ¸¤ë',
+ :image=>$image['delete'], :compound=>:left,
+ :command=>proc{
+ tmppath = $twind2_demo
+ $twind2_demo = nil
+ $showVarsWin[tmppath.path] = nil
+ tmppath.destroy
+ }),
+ :padx=>4, :pady=>4)
+ frame.grid_columnconfigure(0, :weight=>1)
+}
+$twind2_buttons.pack('side'=>'bottom', 'fill'=>'x', 'pady'=>'2m')
+
+# frame À¸À®
+$twind2_text = nil
+TkFrame.new($twind2_demo, 'highlightthickness'=>2, 'borderwidth'=>2,
+ 'relief'=>'sunken') {|f|
+ $twind2_text = TkText.new(f, 'setgrid'=>true, 'font'=>$font,
+ # 'width'=>'70', 'height'=>35, 'wrap'=>'word',
+ 'width'=>'70', 'height'=>35, 'wrap'=>'char',
+ 'highlightthickness'=>0, 'borderwidth'=>0 ){|t|
+ TkScrollbar.new(f) {|s|
+ command proc{|*args| t.yview(*args)}
+ t.yscrollcommand proc{|first,last| s.set first,last}
+ }.pack('side'=>'right', 'fill'=>'y')
+ }.pack('expand'=>'yes', 'fill'=>'both')
+}.pack('expand'=>'yes', 'fill'=>'both')
+
+# ¥¿¥°À¸À®
+$tag2_center = TkTextTag.new($twind2_text,
+ 'justify' =>'center',
+ 'spacing1'=>'5m',
+ 'spacing3'=>'5m' )
+$tag2_buttons = TkTextTag.new($twind2_text,
+ 'lmargin1'=>'1c',
+ 'lmargin2'=>'1c',
+ 'rmargin' =>'1c',
+ 'spacing1'=>'3m',
+ 'spacing2'=>0,
+ 'spacing3'=>0 )
+
+# ¥Æ¥­¥¹¥È¤ÎÀ¸À®
+$twind2_text.insert('end', '¥Æ¥­¥¹¥È¥¦¥£¥¸¥§¥Ã¥È¤Ë¤Ï¿§¡¹¤Ê¼ïÎà¤Î¥¢¥¤¥Æ¥à')
+$twind2_text.insert('end', '¡ÊưŪ¤Ê¤â¤Î¤äÀÅŪ¤Ê¤â¤Î¤ÎξÊý¤¬¤¢¤ê¤Þ¤¹¡Ë¤ò')
+$twind2_text.insert('end', '¿ô¿¤¯´Þ¤á¤ë¤³¤È¤¬¤Ç¤­¤Þ¤¹¡£¤½¤¦¤·¤¿¥¢¥¤¥Æ¥à¤Ï')
+$twind2_text.insert('end', '¹ÔÂؤ¨¡¢¥¿¥Ö¡¢Ãæ±û·¤¨¤Ê¤É¤ÎÍÍ¡¹¤ÊÊýË¡¤Ç')
+$twind2_text.insert('end', 'ÇÛÃÖ¤¹¤ë¤³¤È¤¬¤Ç¤­¤Þ¤¹¡£')
+$twind2_text.insert('end', '²Ã¤¨¤Æ¡¢¥Æ¥­¥¹¥È¥¦¥£¥¸¥§¥Ã¥È¤ÎÆâÍÆʪ¤¬')
+$twind2_text.insert('end', '¥¦¥£¥ó¥É¥¦¥µ¥¤¥º¤ËÈæ¤Ù¤ÆÂ礭¤¹¤®¤ë¾ì¹ç¤Ç¤â')
+$twind2_text.insert('end', '¤¹¤Ù¤Æ¤ÎÊý¸þ¤Ë¥¹¥à¡¼¥º¤Ë¥¹¥¯¥í¡¼¥ë¤µ¤»¤Æ')
+$twind2_text.insert('end', '³Îǧ¤¹¤ë¤³¤È¤¬²Äǽ¤Ç¤¹¡£')
+$twind2_text.insert('end', "\n\n")
+$twind2_text.insert('end', '¥Æ¥­¥¹¥È¥¦¥£¥¸¥§¥Ã¥È¾å¤Ë¤Ï¾¤Î¥¦¥£¥¸¥§¥Ã¥È¤ò')
+$twind2_text.insert('end', '´Þ¤á¤ë¤³¤È¤â¤Ç¤­¤Þ¤¹¡£¤³¤¦¤·¤¿¤â¤Î¤Ï')
+$twind2_text.insert('end', '¡ÖËä¤á¹þ¤ß¥¦¥£¥ó¥É¥¦¡×¤È¸Æ¤Ð¤ì¡¢¤½¤ÎÃæ¤Ë')
+$twind2_text.insert('end', '¤¤¤«¤Ê¤ë¥¦¥£¥¸¥§¥Ã¥È¤Ç¤âµÍ¤á¹þ¤à¤³¤È¤¬¤Ç¤­¤Þ¤¹¡£')
+$twind2_text.insert('end', 'Î㤨¤Ð¡¤¤³¤³¤Ë¤Ï£²¤Ä¤Î')
+$twind2_text.insert('end', '¥Ü¥¿¥ó¥¦¥£¥¸¥§¥Ã¥È¤¬Ëä¤á¹þ¤Þ¤ì¤Æ¤¤¤Þ¤¹¡£')
+$twind2_text.insert('end', 'ºÇ½é¤Î¥Ü¥¿¥ó¤ò¥¯¥ê¥Ã¥¯¤¹¤ë¤È¡¢')
+$twind2_text.insert('end', '¿åÊ¿Êý¸þ¤Î¥¹¥¯¥í¡¼¥ë¤ò ')
+TkTextWindow.new($twind2_text, 'end',
+ 'window'=>TkButton.new($twind2_text) {
+ #text 'ON'
+ text '¥ª¥ó'
+ command proc{textWindOn2 $twind2_text,$twind2_buttons}
+ cursor 'top_left_arrow'
+ })
+$twind2_text.insert('end', "¤Ë¤·¤Þ¤¹¡£¤Þ¤¿¡¢£²¤Ä¤á¤Î¥Ü¥¿¥ó¤ò¥¯¥ê¥Ã¥¯¤¹¤ë¤È\n")
+$twind2_text.insert('end', '¿åÊ¿Êý¸þ¤Î¥¹¥¯¥í¡¼¥ë¤ò')
+TkTextWindow.new($twind2_text, 'end',
+ 'window'=>TkButton.new($twind2_text) {
+ #text 'OFF'
+ text '¥ª¥Õ'
+ command proc{textWindOff2 $twind2_text}
+ cursor 'top_left_arrow'
+ })
+$twind2_text.insert('end', "¤Ë¤·¤Þ¤¹¡£\n\n")
+
+$twind2_text.insert('end', '¼¡¤Ï¤â¤¦¤Ò¤È¤Ä¤ÎÎã¤Ç¤¹¡£')
+TkTextWindow.new($twind2_text, 'end',
+ 'window'=>TkButton.new($twind2_text) {
+ text '¤³¤³¤ò¥¯¥ê¥Ã¥¯'
+ command proc{textWindPlot2 $twind2_text}
+ cursor 'top_left_arrow'
+ })
+$twind2_text.insert('end', '¤¹¤ë¤È¡¢x-y¥×¥í¥Ã¥È¤¬¤³¤³¤Ë¸½¤ì¤Þ¤¹¡£')
+$mark2_plot = TkTextMark.new($twind2_text, 'insert')
+$mark2_plot.gravity='left'
+$twind2_text.insert('end', '¥Þ¥¦¥¹¤Ç¥É¥é¥Ã¥°¤¹¤ë¤³¤È¤Ç¡¢')
+$twind2_text.insert('end', '¥×¥í¥Ã¥È¾å¤Î¥Ç¡¼¥¿ÅÀ¤ò°ÜÆ°¤¹¤ë¤³¤È¤¬¤Ç¤­¤Þ¤¹¡£')
+TkTextWindow.new($twind2_text, 'end',
+ 'window'=>TkButton.new($twind2_text) {
+ text '¾Ãµî'
+ command proc{textWindDel2 $twind2_text}
+ cursor 'top_left_arrow'
+ })
+$twind2_text.insert('end', '¤ò¥¯¥ê¥Ã¥¯¤¹¤ë¤È¸µ¤ËÌá¤ê¤Þ¤¹¡£')
+$twind2_text.insert('end', "\n\n")
+
+$twind2_text.insert('end', 'ɽ¼¨¤¹¤ë¥Æ¥­¥¹¥È¤Ê¤·¤ËËä¤á¹þ¤ß¥¦¥£¥ó¥É¥¦¤À¤±¤ò')
+$twind2_text.insert('end', '¥Æ¥­¥¹¥È¥¦¥£¥¸¥§¥Ã¥È¤Ë´Þ¤á¤ë¤³¤È¤âÍ­ÍѤǤ·¤ç¤¦¡£')
+$twind2_text.insert('end', '¤³¤Î¾ì¹ç¡¢¥Æ¥­¥¹¥È¥¦¥£¥¸¥§¥Ã¥È¤Ï')
+$twind2_text.insert('end', '¥¸¥ª¥á¥È¥ê¥Þ¥Í¡¼¥¸¥ã¤Î¤è¤¦¤ËƯ¤­¤Þ¤¹¡£')
+$twind2_text.insert('end', 'Î㤨¤Ð¡¢¤³¤³¤Ë¤Ï¥Æ¥­¥¹¥È¥¦¥£¥¸¥§¥Ã¥È¤Ë')
+$twind2_text.insert('end', '¤è¤Ã¤Æ¥Ü¥¿¥ó¤¬¤­¤ì¤¤¤ËÀ°Îó¤·¤ÆÇÛÃÖ¤µ¤ì¤Æ¤¤¤Þ¤¹¡£')
+$twind2_text.insert('end', '¤³¤ì¤é¤Î¥Ü¥¿¥ó¤ò¥¯¥ê¥Ã¥¯¤¹¤ë¤³¤È¤Ç¡¢')
+$twind2_text.insert('end', '¤³¤Î¥Æ¥­¥¹¥È¥¦¥£¥¸¥§¥Ã¥È¤ÎÇØ·Ê¿§¤ò')
+$twind2_text.insert('end', 'ÊѤ¨¤ë¤³¤È¤¬¤Ç¤­¤Þ¤¹("¥Ç¥Õ¥©¥ë¥È"¥Ü¥¿¥ó¤Ç')
+$twind2_text.insert('end', '¸µ¤Î¿§¤ËÌ᤹¤³¤È¤¬¤Ç¤­¤Þ¤¹)¡£')
+$twind2_text.insert('end', '"Short"¤È¤¤¤¦¥Ü¥¿¥ó¤ò¥¯¥ê¥Ã¥¯¤¹¤ë¤Èʸ»úÎó¤ÎŤµ¤¬')
+$twind2_text.insert('end', 'ÊѤï¤ê¡¢¥Æ¥­¥¹¥È¥¦¥£¥¸¥§¥Ã¥È¤¬¼«Æ°Åª¤Ë')
+$twind2_text.insert('end', '¥ì¥¤¥¢¥¦¥È¤òÀ°¤¨¤ëÍͻҤò¸«¤ë¤³¤È¤¬¤Ç¤­¤Þ¤¹¡£')
+$twind2_text.insert('end', '¤â¤¦°ìÅÙƱ¤¸¥Ü¥¿¥ó¤ò²¡¤¹¤È¸µ¤ËÌá¤ê¤Þ¤¹¡£')
+$twind2_text.insert('end', "\n")
+
+btn_default = TkButton.new($twind2_text) {|b|
+ text '¥Ç¥Õ¥©¥ë¥È'
+ command proc{embDefBg2 $twind2_text}
+ cursor 'top_left_arrow'
+}
+TkTextWindow.new($twind2_text, 'end', 'window'=>btn_default, 'padx'=>3)
+embToggle = TkVariable.new('Short')
+TkTextWindow.new($twind2_text, 'end',
+ 'window'=>TkCheckButton.new($twind2_text) {
+ textvariable embToggle
+ indicatoron 0
+ variable embToggle
+ onvalue 'A much longer string'
+ offvalue 'Short'
+ cursor 'top_left_arrow'
+ pady 5
+ padx 2
+ },
+ 'padx'=>3,
+ 'pady'=>2 )
+
+[ 'AntiqueWhite3', 'Bisque1', 'Bisque2', 'Bisque3', 'Bisque4',
+ 'SlateBlue3', 'RoyalBlue1', 'SteelBlue2', 'DeepSkyBlue3', 'LightBlue1',
+ 'DarkSlateGray1', 'Aquamarine2', 'DarkSeaGreen2', 'SeaGreen1',
+ 'Yellow1', 'IndianRed1', 'IndianRed2', 'Tan1', 'Tan4'
+].each{|twind_color|
+ TkTextWindow.new($twind2_text, 'end',
+ 'window'=>TkButton.new($twind2_text) {
+ text twind_color
+ cursor 'top_left_arrow'
+ command proc{$twind2_text.bg twind_color}
+ },
+ 'padx'=>3,
+ 'pady'=>2 )
+}
+
+$tag2_buttons.add(btn_default, 'end')
+
+$text_normal2 = {}
+$text_normal2['border'] = $twind2_text.cget('borderwidth')
+$text_normal2['highlight'] = $twind2_text.cget('highlightthickness')
+$text_normal2['pad'] = $twind2_text.cget('padx')
+
+$twind2_text.insert('end', "\nborder width ¤ä highlightthickness, ")
+$twind2_text.insert('end', "padding ¤òÄ̾ï¤ÎÃͤ«¤éÊѹ¹¤¹¤ë¤³¤È¤â²Äǽ¤Ç¤¹¡£\n")
+
+TkTextWindow.new($twind2_text, 'end',
+ 'window'=>TkButton.new($twind2_text, :text=>"Big borders",
+ :cursor=>'top_left_arrow',
+ 'command'=>proc{
+ textWinBigB2 $twind2_text
+ }))
+
+TkTextWindow.new($twind2_text, 'end',
+ 'window'=>TkButton.new($twind2_text, :text=>"Small borders",
+ :cursor=>'top_left_arrow',
+ 'command'=>proc{
+ textWinSmallB2 $twind2_text
+ }))
+
+TkTextWindow.new($twind2_text, 'end',
+ 'window'=>TkButton.new($twind2_text, :text=>"Big highlight",
+ :cursor=>'top_left_arrow',
+ 'command'=>proc{
+ textWinBigH2 $twind2_text
+ }))
+
+TkTextWindow.new($twind2_text, 'end',
+ 'window'=>TkButton.new($twind2_text, :text=>"Small highlight",
+ :cursor=>'top_left_arrow',
+ 'command'=>proc{
+ textWinSmallH2 $twind2_text
+ }))
+
+TkTextWindow.new($twind2_text, 'end',
+ 'window'=>TkButton.new($twind2_text, :text=>"Big pad",
+ :cursor=>'top_left_arrow',
+ 'command'=>proc{
+ textWinBigP2 $twind2_text
+ }))
+
+TkTextWindow.new($twind2_text, 'end',
+ 'window'=>TkButton.new($twind2_text, :text=>"Small pad",
+ :cursor=>'top_left_arrow',
+ 'command'=>proc{
+ textWinSmallP2 $twind2_text
+ }))
+
+$twind2_text.insert('end', "\n\n¹¹¤Ë¥¤¥á¡¼¥¸¤â¥Æ¥­¥¹¥È¥¦¥£¥¸¥§¥Ã¥È¤Ë")
+$twind2_text.insert('end', "¤¦¤Þ¤¯ÇÛÃ֤Ǥ­¤Þ¤¹¡§")
+
+TkTextImage.new($twind2_text, 'end',
+ 'image'=>TkBitmapImage.new(:file=>[
+ $demo_dir, '..',
+ 'images', 'face.xbm'
+ ].join(File::Separator)))
+
+# ¥á¥½¥Ã¥ÉÄêµÁ
+def textWinBigB2(w)
+ w.borderwidth 15
+end
+def textWinSmallB2(w)
+ w.borderwidth $text_normal2['border']
+end
+def textWinBigH2(w)
+ w.highlightthickness 15
+end
+def textWinSmallH2(w)
+ w.highlightthickness $text_normal2['highlight']
+end
+def textWinBigP2(w)
+ w.configure(:padx=>15, :pady=>15)
+end
+def textWinSmallP2(w)
+ w.configure(:padx=>$text_normal2['pad'], :pady=>$text_normal2['pad'])
+end
+
+def textWindOn2 (w,f)
+ if defined? $twind2_scroll
+ begin
+ $twind2_scroll.destroy
+ rescue
+ end
+ $twind2_scroll = nil
+ end
+
+ base = TkWinfo.parent( TkWinfo.parent(w) )
+ $twind2_scroll = TkScrollbar.new(base) {|s|
+ orient 'horizontal'
+ command proc{|*args| w.xview(*args)}
+ w.xscrollcommand proc{|first,last| s.set first,last}
+ w.wrap 'none'
+ pack('after'=>f, 'side'=>'bottom', 'fill'=>'x')
+ }
+
+ return nil
+end
+
+def textWindOff2 (w)
+ if defined? $twind2_scroll
+ begin
+ $twind2_scroll.destroy
+ rescue
+ end
+ $twind2_scroll = nil
+ end
+ w.xscrollcommand ''
+ #w.wrap 'word'
+ w.wrap 'char'
+end
+
+def textWindPlot2 (t)
+ if (defined? $twind2_plot) && (TkWinfo.exist?($twind2_plot))
+ return
+ end
+
+ $twind2_plot = TkCanvas.new(t) {
+ relief 'sunken'
+ width 450
+ height 300
+ cursor 'top_left_arrow'
+ }
+
+ #font = '-Adobe-Helvetica-Medium-R-Normal--*-180-*-*-*-*-*-*'
+ font = 'Helvetica 18'
+
+ TkcLine.new($twind2_plot, 100, 250, 400, 250, 'width'=>2)
+ TkcLine.new($twind2_plot, 100, 250, 100, 50, 'width'=>2)
+ TkcText.new($twind2_plot, 225, 20,
+ 'text'=>"A Simple Plot", 'font'=>font, 'fill'=>'brown')
+
+ (0..10).each {|i|
+ x = 100 + (i * 30)
+ TkcLine.new($twind2_plot, x, 250, x, 245, 'width'=>2)
+ TkcText.new($twind2_plot, x, 254,
+ 'text'=>10*i, 'font'=>font, 'anchor'=>'n')
+ }
+ (0..5).each {|i|
+ y = 250 - (i * 40)
+ TkcLine.new($twind2_plot, 100, y, 105, y, 'width'=>2)
+ TkcText.new($twind2_plot, 96, y,
+ 'text'=>"#{i*50}.0", 'font'=>font, 'anchor'=>'e')
+ }
+
+ for xx, yy in [[12,56],[20,94],[33,98],[32,120],[61,180],[75,160],[98,223]]
+ x = 100 + (3*xx)
+ y = 250 - (4*yy)/5
+ item = TkcOval.new($twind2_plot, x-6, y-6, x+6, y+6,
+ 'width'=>1, 'outline'=>'black', 'fill'=>'SkyBlue2')
+ item.addtag 'point'
+ end
+
+ $twind2_plot.itembind('point', 'Any-Enter',
+ proc{$twind2_plot.itemconfigure 'current', 'fill', 'red'})
+ $twind2_plot.itembind('point', 'Any-Leave',
+ proc{$twind2_plot.itemconfigure 'current', 'fill', 'SkyBlue2'})
+ $twind2_plot.itembind('point', '1',
+ proc{|x,y| embPlotDown2 $twind2_plot,x,y}, "%x %y")
+ $twind2_plot.itembind('point', 'ButtonRelease-1',
+ proc{$twind2_plot.dtag 'selected'})
+ $twind2_plot.bind('B1-Motion',
+ proc{|x,y| embPlotMove2 $twind2_plot,x,y}, "%x %y")
+ while ($twind2_text.get($mark2_plot) =~ /[ \t\n]/)
+ $twind2_text.delete $mark2_plot
+ end
+ $twind2_text.insert $mark2_plot,"\n"
+ TkTextWindow.new($twind2_text, $mark2_plot, 'window'=>$twind2_plot)
+ $tag2_center.add $mark2_plot
+ $twind2_text.insert $mark2_plot,"\n"
+end
+
+$embPlot2 = {'lastX'=>0, 'lastY'=>0}
+
+def embPlotDown2 (w, x, y)
+ w.dtag 'selected'
+ w.addtag_withtag 'selected', 'current'
+ w.raise 'current'
+ $embPlot2['lastX'] = x
+ $embPlot2['lastY'] = y
+end
+
+def embPlotMove2 (w, x, y)
+ w.move 'selected', x - $embPlot2['lastX'], y - $embPlot2['lastY']
+ $embPlot2['lastX'] = x
+ $embPlot2['lastY'] = y
+end
+
+def textWindDel2 (w)
+ if (defined? $twind2_text) && TkWinfo.exist?($twind2_plot)
+ $twind2_text.delete $twind2_plot
+ $twind2_plot = nil
+ while ($twind2_text.get($mark2_plot) =~ /[ \t\n]/)
+ $twind2_text.delete $mark2_plot
+ end
+ $twind2_text.insert $mark2_plot," "
+ end
+end
+
+def embDefBg2 (w)
+ w['background'] = w.configinfo('background')[3]
+end
diff --git a/ext/tk/sample/encstr_usage.rb b/ext/tk/sample/encstr_usage.rb
new file mode 100644
index 0000000000..2155544c64
--- /dev/null
+++ b/ext/tk/sample/encstr_usage.rb
@@ -0,0 +1,29 @@
+require 'tk'
+
+TkMessage.new(:width=>400, :text=><<EOM).pack
+This sample shows how to use Tk::EncodedString class. \
+This reads 'iso2022-kr' text (from discription of \
+Korean language environment of GNU Emacs 20.7.2) \
+and inserts the text into the text widget.
+EOM
+
+t1 = TkText.new(:height=>5).pack
+t2 = TkText.new(:height=>5).pack
+t3 = TkText.new(:height=>5).pack
+
+src_str = IO.readlines('iso2022-kr.txt').join
+
+t1.insert('end',
+ "use neither Tk::EncodedString class nor Tk.encoding= method\n\n")
+t1.insert('end', src_str)
+
+enc_str = Tk::EncodedString(src_str, 'iso2022-kr')
+t2.insert('end',
+ "use Tk::EncodedString class (Tk.encoding => '#{Tk.encoding}')\n\n")
+t2.insert('end', enc_str)
+
+Tk.encoding = 'iso2022-kr'
+t3.insert('end', "use Tk.encoding = 'iso2022-kr'\n\n")
+t3.insert('end', src_str)
+
+Tk.mainloop
diff --git a/ext/tk/sample/images/earth.gif b/ext/tk/sample/images/earth.gif
new file mode 100644
index 0000000000..2c229eb110
--- /dev/null
+++ b/ext/tk/sample/images/earth.gif
Binary files differ
diff --git a/ext/tk/sample/images/earthris.gif b/ext/tk/sample/images/earthris.gif
new file mode 100644
index 0000000000..c4ee473727
--- /dev/null
+++ b/ext/tk/sample/images/earthris.gif
Binary files differ
diff --git a/ext/tk/sample/images/face.xbm b/ext/tk/sample/images/face.xbm
new file mode 100644
index 0000000000..03d829f4d1
--- /dev/null
+++ b/ext/tk/sample/images/face.xbm
@@ -0,0 +1,173 @@
+#define face_width 108
+#define face_height 144
+#define face_x_hot 48
+#define face_y_hot 80
+static char face_bits[] = {
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x09,
+ 0x20, 0x80, 0x24, 0x05, 0x00, 0x80, 0x08, 0x00, 0x00, 0x00, 0x00, 0x88,
+ 0x24, 0x20, 0x80, 0x24, 0x00, 0x00, 0x00, 0x10, 0x80, 0x04, 0x00, 0x01,
+ 0x00, 0x01, 0x40, 0x0a, 0x09, 0x00, 0x92, 0x04, 0x80, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x10, 0x40, 0x12, 0x00, 0x00, 0x10, 0x40, 0x00, 0x00, 0x84,
+ 0x24, 0x40, 0x22, 0xa8, 0x02, 0x14, 0x84, 0x92, 0x40, 0x42, 0x12, 0x04,
+ 0x10, 0x00, 0x00, 0x00, 0x00, 0x52, 0x00, 0x52, 0x11, 0x00, 0x12, 0x00,
+ 0x40, 0x02, 0x00, 0x20, 0x00, 0x08, 0x00, 0xaa, 0x02, 0x54, 0x85, 0x24,
+ 0x00, 0x10, 0x12, 0x00, 0x00, 0x81, 0x44, 0x00, 0x90, 0x5a, 0x00, 0xea,
+ 0x1b, 0x00, 0x80, 0x40, 0x40, 0x02, 0x00, 0x08, 0x00, 0x20, 0xa2, 0x05,
+ 0x8a, 0xb4, 0x6e, 0x45, 0x12, 0x04, 0x08, 0x00, 0x00, 0x00, 0x10, 0x02,
+ 0xa8, 0x92, 0x00, 0xda, 0x5f, 0x10, 0x00, 0x10, 0xa1, 0x04, 0x20, 0x41,
+ 0x02, 0x00, 0x5a, 0x25, 0xa0, 0xff, 0xfb, 0x05, 0x41, 0x02, 0x04, 0x00,
+ 0x00, 0x08, 0x40, 0x80, 0xec, 0x9b, 0xec, 0xfe, 0x7f, 0x01, 0x04, 0x20,
+ 0x90, 0x02, 0x04, 0x00, 0x08, 0x20, 0xfb, 0x2e, 0xf5, 0xff, 0xff, 0x57,
+ 0x00, 0x04, 0x02, 0x00, 0x00, 0x20, 0x01, 0xc1, 0x6e, 0xab, 0xfa, 0xff,
+ 0xff, 0x05, 0x90, 0x20, 0x48, 0x02, 0x00, 0x04, 0x20, 0xa8, 0xdf, 0xb5,
+ 0xfe, 0xff, 0xff, 0x0b, 0x01, 0x00, 0x01, 0x00, 0x80, 0x80, 0x04, 0xe0,
+ 0xbb, 0xef, 0xff, 0xff, 0x7f, 0x01, 0x00, 0x04, 0x48, 0x02, 0x00, 0x20,
+ 0x80, 0xf4, 0x6f, 0xfb, 0xff, 0xff, 0xff, 0x20, 0x90, 0x40, 0x02, 0x00,
+ 0x00, 0x04, 0x08, 0xb8, 0xf6, 0xff, 0xff, 0xdf, 0xbe, 0x12, 0x45, 0x10,
+ 0x90, 0x04, 0x90, 0x00, 0x22, 0xfa, 0xff, 0xff, 0xff, 0xbb, 0xd7, 0xe9,
+ 0x3a, 0x02, 0x02, 0x00, 0x04, 0x90, 0x80, 0xfe, 0xdf, 0xf6, 0xb7, 0xef,
+ 0xbe, 0x56, 0x57, 0x40, 0x48, 0x09, 0x00, 0x04, 0x00, 0xfa, 0xf5, 0xdf,
+ 0xed, 0x5a, 0xd5, 0xea, 0xbd, 0x09, 0x00, 0x00, 0x40, 0x00, 0x92, 0xfe,
+ 0xbf, 0x7d, 0xb7, 0x6a, 0x55, 0xbf, 0xf7, 0x02, 0x11, 0x01, 0x00, 0x91,
+ 0x00, 0xff, 0xff, 0xaf, 0x55, 0x55, 0x5b, 0xeb, 0xef, 0x22, 0x04, 0x04,
+ 0x04, 0x00, 0xa4, 0xff, 0xf7, 0xad, 0xaa, 0xaa, 0xaa, 0xbe, 0xfe, 0x03,
+ 0x20, 0x00, 0x10, 0x44, 0x80, 0xff, 0x7f, 0x55, 0x12, 0x91, 0x2a, 0xeb,
+ 0xbf, 0x0b, 0x82, 0x02, 0x00, 0x00, 0xd1, 0x7f, 0xdf, 0xa2, 0xa4, 0x54,
+ 0x55, 0xfd, 0xfd, 0x47, 0x08, 0x08, 0x00, 0x21, 0xe4, 0xff, 0x37, 0x11,
+ 0x09, 0xa5, 0xaa, 0xb6, 0xff, 0x0d, 0x80, 0x00, 0x00, 0x04, 0xd0, 0xff,
+ 0x4f, 0x44, 0x20, 0x48, 0x55, 0xfb, 0xff, 0x27, 0x11, 0x02, 0x40, 0x40,
+ 0xe2, 0xfb, 0x15, 0x11, 0x4a, 0x55, 0x4a, 0x7d, 0xf7, 0x0f, 0x00, 0x00,
+ 0x04, 0x08, 0xf8, 0xdf, 0x52, 0x44, 0x01, 0x52, 0xb5, 0xfa, 0xff, 0x0f,
+ 0x49, 0x02, 0x00, 0x02, 0xe9, 0xf6, 0x0a, 0x11, 0xa4, 0x88, 0x4a, 0x6d,
+ 0xff, 0x5f, 0x00, 0x00, 0x10, 0x20, 0xf0, 0x2f, 0x21, 0x44, 0x10, 0x52,
+ 0xb5, 0xfa, 0xff, 0x0f, 0x44, 0x04, 0x80, 0x08, 0xf8, 0xab, 0x8a, 0x00,
+ 0x81, 0xa4, 0xd4, 0xd6, 0xfe, 0x2f, 0x00, 0x00, 0x04, 0x40, 0xb5, 0x2d,
+ 0x21, 0x08, 0x04, 0x90, 0xaa, 0xfa, 0xff, 0x1f, 0x11, 0x01, 0x00, 0x04,
+ 0xf0, 0x57, 0x0a, 0x22, 0x40, 0x4a, 0xda, 0x5e, 0xfb, 0x1f, 0x40, 0x00,
+ 0x40, 0x20, 0xba, 0x95, 0x90, 0x00, 0x01, 0xa0, 0xaa, 0xea, 0xff, 0x5f,
+ 0x02, 0x02, 0x00, 0x01, 0xe8, 0x57, 0x05, 0x00, 0x00, 0x12, 0xd5, 0xfe,
+ 0xfd, 0x1f, 0x48, 0x00, 0x04, 0x48, 0x7a, 0x95, 0x08, 0x02, 0x10, 0x40,
+ 0xaa, 0x55, 0xf7, 0x1f, 0x00, 0x09, 0x20, 0x00, 0xf8, 0x57, 0x22, 0x10,
+ 0x00, 0x28, 0xa9, 0xfa, 0xff, 0x5f, 0x02, 0x00, 0x00, 0x49, 0xdd, 0x29,
+ 0x01, 0x00, 0x80, 0x80, 0xaa, 0xd7, 0xff, 0x0f, 0x10, 0x00, 0x08, 0x00,
+ 0xf8, 0x96, 0x08, 0x00, 0x00, 0x20, 0x54, 0xfa, 0xee, 0x3f, 0x81, 0x04,
+ 0x40, 0x24, 0xfe, 0x55, 0x82, 0x00, 0x00, 0x82, 0xd2, 0xad, 0xff, 0x0f,
+ 0x08, 0x00, 0x04, 0x80, 0x6c, 0x97, 0x00, 0x00, 0x02, 0x20, 0xa9, 0xf6,
+ 0xdf, 0x5f, 0x00, 0x02, 0x20, 0x09, 0xfa, 0x49, 0x12, 0x00, 0x20, 0x84,
+ 0x54, 0xdb, 0xfe, 0x1f, 0x91, 0x00, 0x00, 0x00, 0xf8, 0x2b, 0x00, 0x20,
+ 0x00, 0x40, 0xa4, 0xf6, 0xbb, 0x1f, 0x04, 0x00, 0x44, 0x92, 0x7e, 0x95,
+ 0x02, 0x00, 0x00, 0x89, 0xaa, 0xdd, 0xff, 0x1f, 0x20, 0x09, 0x10, 0x00,
+ 0xf4, 0x57, 0x20, 0x01, 0x08, 0x20, 0xa9, 0x76, 0xff, 0x5f, 0x02, 0x00,
+ 0x00, 0x21, 0xfc, 0x4a, 0x05, 0x00, 0x01, 0x80, 0x54, 0xdb, 0xff, 0x1e,
+ 0x08, 0x02, 0x04, 0x08, 0xf9, 0x2b, 0x00, 0x00, 0x40, 0x28, 0xd2, 0xf6,
+ 0xff, 0xbf, 0x80, 0x00, 0x90, 0x00, 0xbc, 0x92, 0x08, 0x10, 0x00, 0x82,
+ 0x54, 0xdb, 0xff, 0x1f, 0x20, 0x00, 0x00, 0x44, 0xf9, 0x55, 0x02, 0x01,
+ 0x00, 0x20, 0xaa, 0xbd, 0xfd, 0x3f, 0x08, 0x04, 0x04, 0x10, 0xf4, 0x2a,
+ 0x01, 0x00, 0x22, 0x80, 0xd4, 0xf6, 0xff, 0x5f, 0x82, 0x00, 0x40, 0x02,
+ 0xf8, 0x55, 0x20, 0x00, 0x00, 0x50, 0x6a, 0xdf, 0xfe, 0x3f, 0x00, 0x00,
+ 0x00, 0x48, 0xe9, 0x4a, 0x05, 0x08, 0x00, 0xa5, 0xd5, 0xf5, 0xff, 0x3f,
+ 0x10, 0x01, 0x10, 0x01, 0xb0, 0xab, 0x92, 0x02, 0x40, 0xf8, 0xbf, 0xde,
+ 0xfe, 0x5f, 0x02, 0x04, 0x04, 0x48, 0xfa, 0xd4, 0x6f, 0x20, 0x84, 0xef,
+ 0xff, 0xfb, 0xff, 0x1f, 0x20, 0x00, 0x00, 0x00, 0xe0, 0xed, 0xbf, 0x0b,
+ 0xa1, 0x7e, 0xff, 0xbf, 0xfd, 0x5f, 0x04, 0x01, 0x20, 0x49, 0xd2, 0xfb,
+ 0xfe, 0x55, 0xd4, 0xff, 0xff, 0xf6, 0xff, 0x07, 0x00, 0x04, 0x00, 0x00,
+ 0xc0, 0xaa, 0xfb, 0x2b, 0xa2, 0xfe, 0xff, 0xdf, 0xee, 0x1f, 0x91, 0x00,
+ 0x82, 0xa4, 0xa4, 0xf5, 0xff, 0x57, 0xd5, 0xff, 0xbf, 0xfd, 0xff, 0x4d,
+ 0x00, 0x00, 0x20, 0x00, 0x88, 0x5b, 0xff, 0x2f, 0x69, 0xff, 0xff, 0xdb,
+ 0xfe, 0x1f, 0x24, 0x02, 0x00, 0x49, 0xa2, 0xd6, 0xff, 0x5f, 0xea, 0xff,
+ 0x7f, 0x7f, 0x7f, 0x0d, 0x00, 0x00, 0x10, 0x00, 0x40, 0xab, 0xf7, 0xbb,
+ 0xf0, 0xdf, 0xff, 0xd5, 0xff, 0xbf, 0x82, 0x04, 0x42, 0x24, 0x91, 0xd5,
+ 0xaa, 0xae, 0xd4, 0xaa, 0x52, 0x7b, 0xff, 0x15, 0x08, 0x00, 0x00, 0x01,
+ 0x04, 0x55, 0xd5, 0x55, 0x70, 0x5b, 0x75, 0xdd, 0xdf, 0x1f, 0x40, 0x00,
+ 0x08, 0x48, 0xa0, 0x4a, 0xa9, 0x56, 0xea, 0x56, 0xad, 0x6a, 0x7d, 0x9b,
+ 0x04, 0x01, 0x00, 0x02, 0x42, 0x2a, 0xd5, 0xaa, 0xa8, 0xaa, 0xaa, 0xfa,
+ 0xdf, 0x2f, 0x10, 0x04, 0x22, 0x48, 0x08, 0x45, 0x2a, 0x15, 0x68, 0x55,
+ 0x55, 0xd7, 0x76, 0x1b, 0x00, 0x00, 0x00, 0x01, 0x40, 0x2a, 0x80, 0xa0,
+ 0xb2, 0x09, 0x48, 0xb9, 0xdf, 0x17, 0x22, 0x01, 0x00, 0x24, 0x45, 0x8a,
+ 0x24, 0x4a, 0x54, 0x51, 0x91, 0xf6, 0x6e, 0x4b, 0x00, 0x04, 0x90, 0x00,
+ 0x80, 0x52, 0x00, 0x20, 0x69, 0x05, 0xa4, 0xaa, 0xff, 0x1e, 0x48, 0x00,
+ 0x02, 0x92, 0x08, 0x05, 0x81, 0x94, 0xd4, 0x92, 0x40, 0xfd, 0xb6, 0x8b,
+ 0x00, 0x01, 0x40, 0x00, 0x82, 0x54, 0x00, 0x48, 0x68, 0x05, 0x90, 0xa4,
+ 0xef, 0x06, 0x24, 0x00, 0x08, 0x12, 0x10, 0x05, 0x00, 0x10, 0xb5, 0x01,
+ 0x42, 0xfb, 0xbf, 0x43, 0x00, 0x09, 0x00, 0x40, 0x81, 0xa8, 0x08, 0x4a,
+ 0xaa, 0x96, 0x90, 0xac, 0x6d, 0x15, 0x22, 0x00, 0x20, 0x09, 0x04, 0x15,
+ 0x80, 0x28, 0xdc, 0x01, 0x24, 0xfb, 0xbf, 0x01, 0x80, 0x04, 0x09, 0x00,
+ 0x40, 0x48, 0x02, 0x45, 0xb2, 0x2e, 0x41, 0x6d, 0xef, 0x05, 0x11, 0x00,
+ 0x40, 0x52, 0x02, 0x15, 0x29, 0x2a, 0xac, 0x42, 0x54, 0xfb, 0x3b, 0x51,
+ 0x84, 0x00, 0x08, 0x00, 0x20, 0x54, 0x80, 0x05, 0xb5, 0x3d, 0xa2, 0xb6,
+ 0xdf, 0x00, 0x20, 0x04, 0x20, 0x49, 0x89, 0xa8, 0x6a, 0x29, 0xac, 0xd6,
+ 0x54, 0xff, 0x3f, 0x84, 0x00, 0x01, 0x04, 0x10, 0x00, 0x94, 0xa8, 0x56,
+ 0xda, 0x5f, 0xab, 0xd5, 0x1e, 0x10, 0x48, 0x00, 0x90, 0x82, 0x48, 0xa8,
+ 0xb2, 0xac, 0xfd, 0x55, 0xd5, 0xfe, 0x9f, 0x80, 0x00, 0x0a, 0x02, 0x08,
+ 0x02, 0x55, 0x5a, 0x75, 0xff, 0xaf, 0xb6, 0xf7, 0x2d, 0x12, 0x92, 0x00,
+ 0x10, 0x20, 0x10, 0xa8, 0x54, 0xd5, 0xbf, 0x5d, 0xad, 0xdd, 0x0f, 0x00,
+ 0x00, 0x04, 0x40, 0x09, 0x84, 0xa8, 0xaa, 0x5a, 0xed, 0xeb, 0x6a, 0xff,
+ 0x9f, 0xa4, 0x24, 0x01, 0x02, 0xa0, 0x20, 0x50, 0x55, 0xd5, 0xbe, 0xae,
+ 0xad, 0xfd, 0x16, 0x00, 0x10, 0x04, 0x20, 0x0a, 0x08, 0xb4, 0xaa, 0x95,
+ 0xaa, 0x7b, 0xb7, 0xdb, 0x5f, 0x92, 0x04, 0x01, 0x84, 0x20, 0x21, 0x51,
+ 0xd5, 0x2a, 0xa9, 0xee, 0xd5, 0xfe, 0x0d, 0x00, 0x20, 0x04, 0x10, 0x00,
+ 0x08, 0x50, 0xe9, 0xd7, 0xd4, 0xfb, 0xb5, 0xff, 0x9f, 0x24, 0x09, 0x01,
+ 0x42, 0x4a, 0xa2, 0x64, 0xd5, 0x55, 0x7b, 0x7f, 0xda, 0x7d, 0x4f, 0x00,
+ 0x20, 0x04, 0x00, 0x80, 0x00, 0xa0, 0x2a, 0x13, 0x84, 0x6a, 0x55, 0xff,
+ 0x1d, 0x48, 0x8a, 0x00, 0x94, 0x24, 0x8a, 0xc8, 0xaa, 0x42, 0x20, 0x5d,
+ 0xf5, 0xff, 0x5f, 0x01, 0x00, 0x02, 0x01, 0x00, 0x20, 0xa2, 0x4a, 0x1a,
+ 0x82, 0x56, 0xda, 0xbd, 0x3f, 0x92, 0x92, 0x00, 0x90, 0x92, 0x00, 0x40,
+ 0x95, 0x6a, 0xf4, 0x55, 0x6d, 0xff, 0xd6, 0x00, 0x00, 0x0a, 0x04, 0x20,
+ 0x14, 0x49, 0x4b, 0xaa, 0xaa, 0x56, 0xf5, 0xff, 0xbf, 0xab, 0xa4, 0x00,
+ 0x20, 0x89, 0x40, 0x80, 0xaa, 0xaa, 0xaa, 0xaa, 0xde, 0xbf, 0xeb, 0x03,
+ 0x00, 0x02, 0x04, 0x02, 0x0a, 0x10, 0x2b, 0x2a, 0x55, 0x5b, 0xf5, 0xff,
+ 0xd7, 0x2f, 0x92, 0x00, 0x10, 0x28, 0x21, 0x01, 0x56, 0x95, 0xa0, 0x56,
+ 0xdf, 0xef, 0xea, 0x87, 0x40, 0x0a, 0x42, 0x41, 0x00, 0x90, 0xaa, 0x52,
+ 0xb6, 0xad, 0xfa, 0xff, 0xd5, 0x2f, 0x14, 0x00, 0x00, 0x04, 0x95, 0x04,
+ 0xaa, 0xac, 0x55, 0x6b, 0xff, 0xb7, 0xea, 0x9f, 0x40, 0x02, 0x28, 0x51,
+ 0x00, 0x40, 0x58, 0xd5, 0xda, 0xd6, 0x6e, 0x7f, 0xf9, 0x3f, 0x12, 0x04,
+ 0x02, 0x04, 0x49, 0x25, 0x55, 0xaa, 0x77, 0xab, 0xff, 0x2b, 0xfd, 0x3f,
+ 0x48, 0x01, 0x20, 0x41, 0x00, 0x00, 0x58, 0xa9, 0xda, 0xea, 0xfd, 0xaf,
+ 0xfa, 0xff, 0x02, 0x04, 0x08, 0x14, 0x29, 0x49, 0x52, 0x55, 0x55, 0x55,
+ 0xff, 0x8d, 0xfe, 0x3f, 0xa8, 0x00, 0x02, 0x41, 0x00, 0x02, 0xa0, 0xa2,
+ 0xaa, 0xea, 0xff, 0x53, 0xfd, 0xff, 0x02, 0x04, 0x50, 0x04, 0x25, 0xa8,
+ 0x54, 0x49, 0x52, 0xb5, 0xbf, 0x8a, 0xfe, 0xff, 0xa9, 0x08, 0x04, 0x50,
+ 0x80, 0x02, 0xa1, 0x2a, 0x95, 0xea, 0xff, 0xa1, 0xff, 0xff, 0x03, 0x02,
+ 0x90, 0x02, 0x09, 0x08, 0x44, 0x49, 0x52, 0xbd, 0x7f, 0xca, 0xff, 0xff,
+ 0x2b, 0x09, 0x04, 0x48, 0x40, 0x82, 0x90, 0x56, 0xa9, 0xf6, 0xbf, 0xd0,
+ 0xff, 0xff, 0x47, 0x00, 0x50, 0x02, 0x15, 0x11, 0x40, 0x95, 0xaa, 0xfd,
+ 0x2f, 0xe9, 0xff, 0xff, 0x8f, 0x0a, 0x84, 0x50, 0x40, 0x84, 0x14, 0xaa,
+ 0x6a, 0xff, 0x5f, 0xf2, 0xff, 0xff, 0x7f, 0x00, 0x10, 0x02, 0x09, 0x10,
+ 0x40, 0x7d, 0xf7, 0xff, 0x0b, 0xfc, 0xff, 0xff, 0xaf, 0x02, 0x84, 0x50,
+ 0x42, 0x85, 0x12, 0xd0, 0xdd, 0xff, 0xa7, 0xf2, 0xff, 0xff, 0xff, 0x04,
+ 0x00, 0x0a, 0x08, 0x10, 0x48, 0xf8, 0xff, 0xff, 0x0a, 0xfe, 0xff, 0xff,
+ 0x7f, 0x03, 0xa4, 0x80, 0xa2, 0x8a, 0x02, 0x68, 0xff, 0xff, 0x52, 0xfd,
+ 0xff, 0xff, 0xff, 0x07, 0x00, 0x2a, 0x08, 0x20, 0x28, 0xdc, 0xff, 0x5f,
+ 0x05, 0xff, 0xff, 0xff, 0xff, 0x0d, 0x92, 0x40, 0x22, 0x09, 0x02, 0xea,
+ 0xfb, 0xaf, 0x48, 0xff, 0xff, 0xff, 0xff, 0x0f, 0x00, 0x12, 0x81, 0xa0,
+ 0x48, 0x9c, 0x6e, 0x93, 0xa2, 0xff, 0xff, 0xff, 0xff, 0x07, 0xa8, 0x40,
+ 0x28, 0x0a, 0x02, 0x74, 0xb5, 0x45, 0x81, 0xff, 0xff, 0xff, 0xff, 0x0f,
+ 0x02, 0x0a, 0x81, 0x20, 0x08, 0xae, 0xaa, 0x90, 0xe8, 0xff, 0xff, 0xff,
+ 0xff, 0x0f, 0x90, 0x40, 0x28, 0x88, 0x12, 0x58, 0x15, 0x50, 0xd0, 0xff,
+ 0xff, 0xff, 0xff, 0x0f, 0x44, 0x0a, 0x41, 0x21, 0x08, 0xae, 0x04, 0x14,
+ 0xf0, 0xff, 0xff, 0xff, 0xff, 0x0f, 0x10, 0x40, 0x14, 0x88, 0x04, 0xba,
+ 0x02, 0x28, 0xe8, 0xff, 0xff, 0xff, 0xff, 0x0f, 0x42, 0x15, 0x41, 0x21,
+ 0x05, 0xad, 0x00, 0x05, 0xf8, 0xff, 0xff, 0xff, 0xff, 0x0f, 0x10, 0x40,
+ 0x24, 0x8a, 0x0e, 0x36, 0x00, 0x0a, 0xf4, 0xff, 0xff, 0xff, 0xff, 0x0f,
+ 0x42, 0x25, 0x90, 0xd0, 0x8b, 0xc2, 0x41, 0x05, 0xfc, 0xff, 0xff, 0xff,
+ 0xff, 0x0f, 0x10, 0x08, 0x05, 0xe8, 0x8e, 0x58, 0x80, 0x02, 0xfa, 0xff,
+ 0xff, 0xff, 0xff, 0x0f, 0x4a, 0x20, 0xa8, 0xba, 0x0b, 0x2b, 0x51, 0x01,
+ 0xfe, 0xff, 0xff, 0xff, 0xff, 0x0f, 0x00, 0x8a, 0x02, 0xe8, 0xaf, 0x84,
+ 0x90, 0x04, 0xfd, 0xff, 0xff, 0xff, 0xff, 0x0f, 0x52, 0x21, 0x54, 0xbf,
+ 0x1f, 0x15, 0xa5, 0x02, 0xfe, 0xff, 0xff, 0xff, 0xff, 0x0f, 0x00, 0x08,
+ 0x01, 0xfa, 0xb6, 0xa4, 0x52, 0x40, 0xff, 0xff, 0xff, 0xff, 0xff, 0x0f,
+ 0x4a, 0xa2, 0x54, 0xef, 0x5f, 0x4b, 0xa4, 0x80, 0xff, 0xff, 0xff, 0xff,
+ 0xff, 0x0f, 0x80, 0x10, 0x82, 0xfe, 0xbf, 0x92, 0x52, 0x42, 0xff, 0xff,
+ 0xff, 0xff, 0xff, 0x0f, 0x12, 0x42, 0xa8, 0xbf, 0x1f, 0x24, 0x80, 0xa0,
+ 0xff, 0xff, 0xff, 0xff, 0xff, 0x0f, 0x84, 0x28, 0x8a, 0xf7, 0x37, 0x80,
+ 0x52, 0x80, 0xff, 0xff, 0xff, 0xff, 0xff, 0x0f, 0x10, 0x82, 0xe0, 0xff,
+ 0x1f, 0x00, 0x20, 0xe1, 0xff, 0xff, 0xff, 0xff, 0xff, 0x0f, 0x84, 0x28,
+ 0xca, 0xff, 0x1f, 0x00, 0x00, 0xc0, 0xff, 0xff, 0xff, 0xff, 0xff, 0x0f,
+ 0x10, 0x42, 0xf0, 0xfd, 0x1b, 0x00, 0x50, 0xf0, 0xff, 0xff, 0xff, 0xff,
+ 0xff, 0x0f, 0xa4, 0x10, 0xc5, 0xff, 0x1f, 0x00, 0x00, 0xe0, 0xff, 0xff,
+ 0xff, 0xff, 0xff, 0x0f, 0x00, 0x22, 0xf8, 0xff, 0x0e, 0x00, 0x00, 0xf0,
+ 0xff, 0xff, 0xff, 0xff, 0xff, 0x0f, 0xaa, 0x88, 0xe2, 0xff, 0x0f, 0x10,
+ 0x00, 0xf0, 0xff, 0xff, 0xff, 0xff, 0xff, 0x0f, 0x00, 0x25, 0xfa, 0xff,
+ 0x0f, 0x01, 0x11, 0xfd, 0xff, 0xff, 0xff, 0xff, 0xff, 0x0f, 0xff, 0xfb,
+ 0xfb, 0xff, 0x7f, 0x5d, 0xd5, 0xfa, 0xff, 0xff, 0xff, 0xff, 0xff, 0x0f};
diff --git a/ext/tk/sample/images/flagdown.xbm b/ext/tk/sample/images/flagdown.xbm
new file mode 100644
index 0000000000..55abc51825
--- /dev/null
+++ b/ext/tk/sample/images/flagdown.xbm
@@ -0,0 +1,27 @@
+#define flagdown_width 48
+#define flagdown_height 48
+static char flagdown_bits[] = {
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1e, 0x00, 0x00,
+ 0x00, 0x00, 0x80, 0x7f, 0x00, 0x00, 0x00, 0x00, 0xe0, 0xe1, 0x00, 0x00,
+ 0x00, 0x00, 0x70, 0x80, 0x01, 0x00, 0x00, 0x00, 0x18, 0x00, 0x03, 0x00,
+ 0x00, 0x00, 0x0c, 0x00, 0x03, 0x00, 0x00, 0x00, 0x06, 0x00, 0x06, 0x04,
+ 0x00, 0x00, 0x03, 0x00, 0x06, 0x06, 0x00, 0x80, 0x01, 0x00, 0x06, 0x07,
+ 0x00, 0xc0, 0x1f, 0x00, 0x87, 0x07, 0x00, 0xe0, 0x7f, 0x80, 0xc7, 0x07,
+ 0x00, 0x70, 0xe0, 0xc0, 0xe5, 0x07, 0x00, 0x38, 0x80, 0xe1, 0x74, 0x07,
+ 0x00, 0x18, 0x80, 0x71, 0x3c, 0x07, 0x00, 0x0c, 0x00, 0x3b, 0x1e, 0x03,
+ 0x00, 0x0c, 0x00, 0x1f, 0x0f, 0x00, 0x00, 0x86, 0x1f, 0x8e, 0x07, 0x00,
+ 0x00, 0x06, 0x06, 0xc6, 0x05, 0x00, 0x00, 0x06, 0x00, 0xc6, 0x05, 0x00,
+ 0x00, 0x06, 0x00, 0xc6, 0x04, 0x00, 0x00, 0x06, 0x00, 0x06, 0x04, 0x00,
+ 0x7f, 0x06, 0x00, 0x06, 0xe4, 0xff, 0x00, 0x06, 0x00, 0x06, 0x04, 0x00,
+ 0x00, 0x06, 0x00, 0x06, 0x04, 0x00, 0x00, 0x06, 0x00, 0x06, 0x06, 0x00,
+ 0x00, 0x06, 0x00, 0x06, 0x03, 0x00, 0x00, 0x06, 0x00, 0x86, 0x01, 0x00,
+ 0x00, 0x06, 0x00, 0xc6, 0x00, 0x00, 0x00, 0x06, 0x00, 0x66, 0x00, 0x00,
+ 0x00, 0x06, 0x00, 0x36, 0x00, 0x00, 0x00, 0x06, 0x00, 0x3e, 0x00, 0x00,
+ 0x00, 0xfe, 0xff, 0x2f, 0x00, 0x00, 0x00, 0xfc, 0xff, 0x27, 0x00, 0x00,
+ 0x00, 0x00, 0x88, 0x20, 0x00, 0x00, 0x00, 0x00, 0x88, 0x20, 0x00, 0x00,
+ 0x00, 0x00, 0x88, 0x20, 0x00, 0x00, 0x00, 0x00, 0x88, 0x20, 0x00, 0x00,
+ 0x00, 0x00, 0x88, 0x20, 0x00, 0x00, 0x00, 0x00, 0x88, 0x20, 0x00, 0x00,
+ 0x00, 0x00, 0x88, 0x20, 0x00, 0x00, 0x00, 0x00, 0x88, 0x20, 0x00, 0x00,
+ 0xf7, 0xbf, 0x8e, 0xfc, 0xdf, 0xf8, 0x9d, 0xeb, 0x9b, 0x76, 0xd2, 0x7a,
+ 0x46, 0x30, 0xe2, 0x0f, 0xe1, 0x47, 0x55, 0x84, 0x48, 0x11, 0x84, 0x19};
diff --git a/ext/tk/sample/images/flagup.xbm b/ext/tk/sample/images/flagup.xbm
new file mode 100644
index 0000000000..6eb0d846a3
--- /dev/null
+++ b/ext/tk/sample/images/flagup.xbm
@@ -0,0 +1,27 @@
+#define flagup_width 48
+#define flagup_height 48
+static char flagup_bits[] = {
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xe0, 0x7f, 0x00,
+ 0x00, 0x00, 0x00, 0xe0, 0x7f, 0x00, 0x00, 0x00, 0x00, 0xef, 0x6a, 0x00,
+ 0x00, 0x00, 0xc0, 0x7b, 0x75, 0x00, 0x00, 0x00, 0xe0, 0xe0, 0x6a, 0x00,
+ 0x00, 0x00, 0x30, 0x60, 0x75, 0x00, 0x00, 0x00, 0x18, 0xe0, 0x7f, 0x00,
+ 0x00, 0x00, 0x0c, 0xe0, 0x7f, 0x00, 0x00, 0x00, 0x06, 0xe0, 0x04, 0x00,
+ 0x00, 0x00, 0x03, 0xe0, 0x04, 0x00, 0x00, 0x80, 0x01, 0xe0, 0x06, 0x00,
+ 0x00, 0xc0, 0x1f, 0xe0, 0x07, 0x00, 0x00, 0xe0, 0x7f, 0xe0, 0x07, 0x00,
+ 0x00, 0x70, 0xe0, 0xe0, 0x05, 0x00, 0x00, 0x38, 0x80, 0xe1, 0x04, 0x00,
+ 0x00, 0x18, 0x80, 0xf1, 0x04, 0x00, 0x00, 0x0c, 0x00, 0xfb, 0x04, 0x00,
+ 0x00, 0x0c, 0x00, 0xff, 0x04, 0x00, 0x00, 0x86, 0x1f, 0xee, 0x04, 0x00,
+ 0x00, 0x06, 0x06, 0xe6, 0x04, 0x00, 0x00, 0x06, 0x00, 0xe6, 0x04, 0x00,
+ 0x00, 0x06, 0x00, 0xe6, 0x04, 0x00, 0x00, 0x06, 0x00, 0x66, 0x04, 0x00,
+ 0x7f, 0x56, 0x52, 0x06, 0xe4, 0xff, 0x00, 0x76, 0x55, 0x06, 0x04, 0x00,
+ 0x00, 0x56, 0x57, 0x06, 0x04, 0x00, 0x00, 0x56, 0x55, 0x06, 0x06, 0x00,
+ 0x00, 0x56, 0xd5, 0x06, 0x03, 0x00, 0x00, 0x06, 0x00, 0x86, 0x01, 0x00,
+ 0x54, 0x06, 0x00, 0xc6, 0x54, 0x55, 0xaa, 0x06, 0x00, 0x66, 0xaa, 0x2a,
+ 0x54, 0x06, 0x00, 0x36, 0x55, 0x55, 0xaa, 0x06, 0x00, 0xbe, 0xaa, 0x2a,
+ 0x54, 0xfe, 0xff, 0x6f, 0x55, 0x55, 0xaa, 0xfc, 0xff, 0xa7, 0xaa, 0x2a,
+ 0x54, 0x01, 0x88, 0x60, 0x55, 0x55, 0xaa, 0xaa, 0x8a, 0xa0, 0xaa, 0x2a,
+ 0x54, 0x55, 0x8d, 0x60, 0x55, 0x55, 0xaa, 0xaa, 0x8a, 0xa0, 0xaa, 0x2a,
+ 0x54, 0x55, 0x8d, 0x60, 0x55, 0x55, 0xaa, 0xaa, 0x8a, 0xa0, 0xaa, 0x2a,
+ 0x54, 0x55, 0x8d, 0x50, 0x55, 0x55, 0xaa, 0xaa, 0x8a, 0xa8, 0xaa, 0x2a,
+ 0x54, 0x55, 0x95, 0x54, 0x55, 0x55, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0x2a,
+ 0x54, 0x55, 0x55, 0x55, 0x55, 0x15, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00};
diff --git a/ext/tk/sample/images/gray25.xbm b/ext/tk/sample/images/gray25.xbm
new file mode 100644
index 0000000000..b234b3cb0b
--- /dev/null
+++ b/ext/tk/sample/images/gray25.xbm
@@ -0,0 +1,6 @@
+#define grey_width 16
+#define grey_height 16
+static char grey_bits[] = {
+ 0x11, 0x11, 0x44, 0x44, 0x11, 0x11, 0x44, 0x44, 0x11, 0x11, 0x44, 0x44,
+ 0x11, 0x11, 0x44, 0x44, 0x11, 0x11, 0x44, 0x44, 0x11, 0x11, 0x44, 0x44,
+ 0x11, 0x11, 0x44, 0x44, 0x11, 0x11, 0x44, 0x44};
diff --git a/ext/tk/sample/images/grey.25 b/ext/tk/sample/images/grey.25
new file mode 100644
index 0000000000..b234b3cb0b
--- /dev/null
+++ b/ext/tk/sample/images/grey.25
@@ -0,0 +1,6 @@
+#define grey_width 16
+#define grey_height 16
+static char grey_bits[] = {
+ 0x11, 0x11, 0x44, 0x44, 0x11, 0x11, 0x44, 0x44, 0x11, 0x11, 0x44, 0x44,
+ 0x11, 0x11, 0x44, 0x44, 0x11, 0x11, 0x44, 0x44, 0x11, 0x11, 0x44, 0x44,
+ 0x11, 0x11, 0x44, 0x44, 0x11, 0x11, 0x44, 0x44};
diff --git a/ext/tk/sample/images/grey.5 b/ext/tk/sample/images/grey.5
new file mode 100644
index 0000000000..37688893f0
--- /dev/null
+++ b/ext/tk/sample/images/grey.5
@@ -0,0 +1,6 @@
+#define grey_width 16
+#define grey_height 16
+static char grey_bits[] = {
+ 0x55, 0x55, 0xaa, 0xaa, 0x55, 0x55, 0xaa, 0xaa, 0x55, 0x55, 0xaa, 0xaa,
+ 0x55, 0x55, 0xaa, 0xaa, 0x55, 0x55, 0xaa, 0xaa, 0x55, 0x55, 0xaa, 0xaa,
+ 0x55, 0x55, 0xaa, 0xaa, 0x55, 0x55, 0xaa, 0xaa};
diff --git a/ext/tk/sample/images/letters.xbm b/ext/tk/sample/images/letters.xbm
new file mode 100644
index 0000000000..0f12568d1a
--- /dev/null
+++ b/ext/tk/sample/images/letters.xbm
@@ -0,0 +1,27 @@
+#define letters_width 48
+#define letters_height 48
+static char letters_bits[] = {
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0xfe, 0xff, 0xff, 0xff, 0x3f, 0x00, 0x02, 0x00, 0x00, 0x00, 0x20,
+ 0x00, 0xfa, 0x00, 0x00, 0x00, 0x2e, 0x00, 0x02, 0x00, 0x00, 0x00, 0x2a,
+ 0x00, 0x3a, 0x00, 0x00, 0x00, 0x2a, 0x00, 0x02, 0x00, 0x00, 0x00, 0x2e,
+ 0xe0, 0xff, 0xff, 0xff, 0xff, 0x21, 0x20, 0x00, 0x00, 0x00, 0x00, 0x21,
+ 0xa0, 0x03, 0x00, 0x00, 0x70, 0x21, 0x20, 0x00, 0x00, 0x00, 0x50, 0x21,
+ 0xa0, 0x1f, 0x00, 0x00, 0x50, 0x21, 0x20, 0x00, 0x00, 0x00, 0x70, 0x21,
+ 0xfe, 0xff, 0xff, 0xff, 0x0f, 0x21, 0x02, 0x00, 0x00, 0x00, 0x08, 0x21,
+ 0xfa, 0x01, 0x00, 0x80, 0x0b, 0x21, 0x02, 0x00, 0x00, 0x80, 0x0a, 0x21,
+ 0xba, 0x01, 0x00, 0x80, 0x0a, 0x21, 0x02, 0x00, 0x00, 0x80, 0x0b, 0x21,
+ 0x3a, 0x00, 0x00, 0x00, 0x08, 0x21, 0x02, 0x00, 0x00, 0x00, 0x08, 0x21,
+ 0x02, 0xc0, 0xfb, 0x03, 0x08, 0x21, 0x02, 0x00, 0x00, 0x00, 0x08, 0x3f,
+ 0x02, 0xc0, 0xbd, 0x0f, 0x08, 0x01, 0x02, 0x00, 0x00, 0x00, 0x08, 0x01,
+ 0x02, 0xc0, 0x7f, 0x7b, 0x08, 0x01, 0x02, 0x00, 0x00, 0x00, 0x08, 0x01,
+ 0x02, 0x00, 0x00, 0x00, 0xf8, 0x01, 0x02, 0x00, 0x00, 0x00, 0x08, 0x00,
+ 0x02, 0x00, 0x00, 0x00, 0x08, 0x00, 0x02, 0x00, 0x00, 0x00, 0x08, 0x00,
+ 0x02, 0x00, 0x00, 0x00, 0x08, 0x00, 0x02, 0x00, 0x00, 0x00, 0x08, 0x00,
+ 0xfe, 0xff, 0xff, 0xff, 0x0f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00};
diff --git a/ext/tk/sample/images/noletter.xbm b/ext/tk/sample/images/noletter.xbm
new file mode 100644
index 0000000000..5774124efe
--- /dev/null
+++ b/ext/tk/sample/images/noletter.xbm
@@ -0,0 +1,27 @@
+#define noletters_width 48
+#define noletters_height 48
+static char noletters_bits[] = {
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf0, 0x1f, 0x00, 0x00,
+ 0x00, 0x00, 0xff, 0xff, 0x01, 0x00, 0x00, 0xc0, 0xff, 0xff, 0x07, 0x00,
+ 0x00, 0xf0, 0x0f, 0xe0, 0x1f, 0x00, 0x00, 0xfc, 0x01, 0x00, 0x7f, 0x00,
+ 0x00, 0x3e, 0x00, 0x00, 0xf8, 0x00, 0x00, 0x1f, 0x00, 0x00, 0xf0, 0x01,
+ 0x80, 0x07, 0x00, 0x00, 0xc0, 0x03, 0xc0, 0x03, 0x00, 0x00, 0xe0, 0x07,
+ 0xe0, 0x01, 0x00, 0x00, 0xf0, 0x0f, 0xe0, 0x00, 0x00, 0x00, 0x78, 0x0e,
+ 0xf0, 0x00, 0x00, 0x00, 0x3c, 0x1e, 0x70, 0x00, 0x00, 0x00, 0x1e, 0x1c,
+ 0x38, 0x00, 0x00, 0x00, 0x0f, 0x38, 0x38, 0x00, 0x00, 0x80, 0x07, 0x38,
+ 0x3c, 0xfc, 0xff, 0xff, 0x7f, 0x78, 0x1c, 0x04, 0x00, 0xe0, 0x41, 0x70,
+ 0x1c, 0x04, 0x00, 0xf0, 0x40, 0x70, 0x1c, 0x74, 0x00, 0x78, 0x4e, 0x70,
+ 0x0e, 0x04, 0x00, 0x3c, 0x4a, 0xe0, 0x0e, 0x74, 0x03, 0x1e, 0x4a, 0xe0,
+ 0x0e, 0x04, 0x00, 0x0f, 0x4e, 0xe0, 0x0e, 0x04, 0x80, 0x07, 0x40, 0xe0,
+ 0x0e, 0x04, 0xf8, 0x0f, 0x40, 0xe0, 0x0e, 0x04, 0xe0, 0x01, 0x40, 0xe0,
+ 0x0e, 0x04, 0xf8, 0x00, 0x40, 0xe0, 0x0e, 0x04, 0x78, 0x00, 0x40, 0xe0,
+ 0x0e, 0x04, 0xfc, 0xf3, 0x40, 0xe0, 0x1c, 0x04, 0x1e, 0x00, 0x40, 0x70,
+ 0x1c, 0x04, 0x0f, 0x00, 0x40, 0x70, 0x1c, 0x84, 0x07, 0x00, 0x40, 0x70,
+ 0x3c, 0xfc, 0xff, 0xff, 0x7f, 0x78, 0x38, 0xe0, 0x01, 0x00, 0x00, 0x38,
+ 0x38, 0xf0, 0x00, 0x00, 0x00, 0x38, 0x70, 0x78, 0x00, 0x00, 0x00, 0x1c,
+ 0xf0, 0x3c, 0x00, 0x00, 0x00, 0x1e, 0xe0, 0x1e, 0x00, 0x00, 0x00, 0x0e,
+ 0xe0, 0x0f, 0x00, 0x00, 0x00, 0x0f, 0xc0, 0x07, 0x00, 0x00, 0x80, 0x07,
+ 0x80, 0x07, 0x00, 0x00, 0xc0, 0x03, 0x00, 0x1f, 0x00, 0x00, 0xf0, 0x01,
+ 0x00, 0x3e, 0x00, 0x00, 0xf8, 0x00, 0x00, 0xfc, 0x01, 0x00, 0x7f, 0x00,
+ 0x00, 0xf0, 0x0f, 0xe0, 0x1f, 0x00, 0x00, 0xc0, 0xff, 0xff, 0x07, 0x00,
+ 0x00, 0x00, 0xff, 0xff, 0x01, 0x00, 0x00, 0x00, 0xf0, 0x1f, 0x00, 0x00};
diff --git a/ext/tk/sample/images/pattern.xbm b/ext/tk/sample/images/pattern.xbm
new file mode 100644
index 0000000000..df31baf789
--- /dev/null
+++ b/ext/tk/sample/images/pattern.xbm
@@ -0,0 +1,6 @@
+#define foo_width 16
+#define foo_height 16
+static char foo_bits[] = {
+ 0x60, 0x06, 0x90, 0x09, 0x90, 0x09, 0xb0, 0x0d, 0x4e, 0x72, 0x49, 0x92,
+ 0x71, 0x8e, 0x8e, 0x71, 0x8e, 0x71, 0x71, 0x8e, 0x49, 0x92, 0x4e, 0x72,
+ 0xb0, 0x0d, 0x90, 0x09, 0x90, 0x09, 0x60, 0x06};
diff --git a/ext/tk/sample/images/tcllogo.gif b/ext/tk/sample/images/tcllogo.gif
new file mode 100644
index 0000000000..4603d4ff41
--- /dev/null
+++ b/ext/tk/sample/images/tcllogo.gif
Binary files differ
diff --git a/ext/tk/sample/images/teapot.ppm b/ext/tk/sample/images/teapot.ppm
new file mode 100644
index 0000000000..78afefbf82
--- /dev/null
+++ b/ext/tk/sample/images/teapot.ppm
@@ -0,0 +1,56 @@
+P6
+256 256
+255
+\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À[7 eOLjQLmSMoTMnSMlRMhPL_9 \À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\ÀnSMtVMzYN~[N~[N\N\O€\O€]O€]O€]O€]O€\O€\O}[NyYNtVM\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\ÀG-wXN}[N€]O„^O†_O†`O‡`Oˆ`Oˆ`OˆaO‰aO‰aO‰aO‰aO‰aO‰aOˆaOˆ`O†_Oƒ^O\N \À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\ÀaMLyYN…_O‰aP‹bPcPŽcPŽdPŽdPdPdPdPdPdPdPdPeP‘eP’eP’eP‘ePdPcP…_OpUM\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\ÀwXN…_OdP“fP•gQ–hQ˜hQ˜iQ™iQ™iQšiQšiQšjQ›jQ›jQœjQœjQœjQœjQœjQ›jQœjQ™iQ“fP‡`O\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\ÀNCJiQL‹bP—hQkQ¡mR¤nR¥oR¥oR¥oR¥oR¥oR¥oR¦oR¦oR¦pR¨pS©qSªqS«rS¬rS«rS©qS¤oRœjQ€]O\KK\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\ÀfOLrUMcPŸlR©qS¯tS²uTµwT·xT¸xT¹yTºyT»zT»zU¼zU¼zU¼zU»zUºyT¸xT¶wT¯tS¡mR‰aOhPL\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\Àa0 cNLqUM€\O”fQ¦pS²wVºzV¿|VÂ}VÄVÆVÇ€VÉ‚WÌ…[Õeæ w÷³‹êª…Ĉg§qT“fQ{ZNYIK9\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\ÀO1{G#‘JkRMqUMtVN–iS¨v\·€d¹bµzZ±vU°uT®sSªqS¤nRœjQ’eP„^OrUMHh>!T4\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\ÀG-V5wE"~I#†M%U+¥e7²l:°g2®b*­a(­`(©^(¥])¡^-›]1ŠS,qC$`9 R3G-\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À@)J/i>!pA"tD"wF$yH&xH&tE$wE#yG%}M+ƒT4S5mE*Z7!K/B*;'\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À‰aO¦oR½{UÇ€VÏ…X<(F-a: e<!h>!j@#k@$h>"d<!c=$hD-fF2[<)K0@);'5$Ë‚VÇ€V¿|U_LKYIK\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À…_O·xTÉ‚Wó«€ûµ‹Ö’k¼|X×>µf-¨^(¡Z'šW&–T&œN>)F-J/b; g>#nD(jB&c<!b=%jH2_A/I0!<(8&5$”J¥Y’S%8&;'?)E,<:HA=HE?IJAISFJYIKXIK\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À£nRÁ}UܘqÊŠe±vU²e,™V&¥V†C
+€@ |> y< u: r9 o7 l6
+j5
+h4
+g3
+5$D,K/b; h>"wM1tK.e="a<#cA,U8&E-<(9&.!a0 b1 c1    
+
++3#@)46G<:HMCIXHK\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\ÀU*´vT¿~X¸{YÃk+›W&‰N$|> u: p8 k5
+f3
+a0 _/ ]. [- I¡\*ª_(‘LkRMmSMmSMnSMnSMD,R3W5mA"|O0|P1j?"c<!a=%Y7"N1F,;'NCJNCJNDJODJODJODJh>!a: X/K%
+g3
+a0 Z- \/ T*Q(ŠHµm8kRMmSMnTMoTMpTMpUM15G15G05G04G04GpUMpTM5^9 d<!yF#O+€N,rC#qB"pB#k?"a: Z7 6ODJPDJPEJQEJQEJREJREJREJRFJSFJSFJSFJSFJe<!X/
+^/ V+Q(L&I$r9  TlRMnSM46G47G47G46G46G46G46G46G36G36G25G25G15G04G/4F.3F
+ˆ`O~[NqUM[- ‰HUGJUGJVGJVGJVHJWHJWHJWHKWHKXHKXHKXHKXHKXHKXIKXIKXIKXIKXIKh>!Y0
+
+L&C!:4
+X&pUMuWMwXNxXN<:H<:H<:H<:H<;H<;H<;H<;H=;H=;H=;H=;H>;H>;H?<H@<HA=HC>HG@ILBIREJ[JKcNLjQL§pR±uTºzUÃ~VÈWË‚XÖŽcäsÒŽe¼{V²vT¨pSžkR•gQŒbP†_O‚^O]O€\O€\O€\O€\O€]O]O]O]O]O]O]O]O]O]O]O€\O€\O~\N}[N|ZNxXN•T%H$
+›W&rVMvWNyYNzYN|ZN}[N}[N><H?<H?<H?<H?<H?<H@<H@<H@<HA=HA=HB=HC>HE?IG@IIAIKBIODJSFJWHK—hQŸlR§pR°b(¾i*Én+Ù|7Û|6Ïr,Íq+Êp-Ãl+»g)±b(®sS§pS lRšiQ•gQePcPŠaPˆaO‡`O‡`O†_O†_O…_O…_O…_O…_O…_O…_O…_O„_O„^O„^Oƒ^Oƒ^O‚]O]O€\O~[N{ZN•T%
+
+
+
+ 
+@%<-$G?@…pfdNLuWM\NdNL\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\ÀTFJvWN‰aP./01„E}[N]O…_Oˆ`O‰aP‹bPŒbPcPcPŽcPdPdPdPeP‘eP’eP’eP“fP“fQ”fQ•gQ•gQ–gQ–hQ—hQ˜hQ™iQšiQ›jQœjQkQkRžlRŸlRžY&¤\'¨^'µ^½bÀcÃeÇi ÄgÀc½b¼a¹`µ^´]¯X¢[' Z'žY&¢mR¡mR¡mR lRŸlRŸlRžkRkQœkQœjQ›jQšjQšiQ™iQ™iQ˜iQ˜hQ—hQ—hQ—hQ–gQ–gQ•gQ•gQ•gQ”fQ”fQ“fQ“fP’eP‘ePdPcP‰aP—O
+ B\À\À\À\À\À\À\À\À\À\À%7!!C*F#P) {dYœze»p€\OgPL\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\ÀSFJ`LKvWNŠaPm6
+ 
+\À\À\À\À\À\À\À\À\À B B
+$5 ¬`(¶e)£nRœjQƒ^OJAI\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\ÀXIK^KKdNLhPLuWM‚]OŒbP”fQeP
+m6
+†`OŽcP“fQ—hQ˜hQ™iQšiQšjQ›jQ›jQ›jQœjQœjQœjQœkQkQkQkRžkRžkRžkRžlRŸlRŸlRŸlR lR lR lR¡mR¡mR¡mR¡mRºg)³c(²c(±b(­V¿cÂeÅi!Åi!Àd¼bº`¹`·_·_¶^¢Q§]'ª_(­`(¹f)£nR£nR£nR£nR£nR£nR£nR¢nR¢nR¢nR¢nR¢nR¢nR¢mR¢mR¢mR¢mR¢mR¢mR¢mR¢mR¢mR¢nR¢mR¢mR£nR¢mR¢mR¡mR mRkR—hQˆGa0 ŠbP mRœjQ“fQ‰aP}[NrUMmSM…L$\À\À\À\À\À\À\À\À B B
+#C, 8&H.Z7 §pR›jQ{ZN\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\ÀQEJ[JK`LKdNLhQLqUM{ZN…_OŽcP–gQ—hQ
+‹bP‘eP–hQšiQ›jQœjQkQkQkRžkRžkRžlRžlRŸlRŸlRŸlRŸlRŸlR lR lR lR mR¡mR¡mR¡mR¡mR¡mR¢mR¢mR¢mR¢nR£nRÀj*ºg)·e)¶d)Âd°XÅgÅhÂe¿c½b½b¾bªU­`(®a(¯a(³c(¾i*¤oR¤oR¤nR¤nR¤nR¤nR¤nR¤nR¤nR¤nR¤nR¤nR¤nR¤nR¤nR¤nR¤nR¤oR¤oR¥oR¥oR¥oR¥oR¥oR¥oR¦oR¦oR¥oR¥oR¤nR¡mR›jQŽQ%Z- œjQ£nRŸlR—hQŽdP…_OuWMpTMnSMkRLa: \À\À\À\À\À\À\À B B&D2
+@*S6#G@IPDJ˜hQmSM\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\ÀVGJ]KKbMLeOLiQLlRMvWN\OˆaO‘eP—hQœjQ•gQ
+\À\À\À\À\À B'D+E$(1 J/jH1NCJUGJYIKUGJ\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\ÀXHK]KKbNLfOLiQLkRMmSMoTMqUMxXN\N†_OŒbP’fP˜hQkQ¡mR¥oR§pS¦pR˜hQ¢mR¥oR¨pSªqS«rS«rS«rS«rS«rS«rS«rS«rS«rS«rS«rSªrSªrSªrS«rS«rS«rS«rS«rS«rS«rS«rS«rS«rS«rS«rS«rS«rS«rS«rS¬rS¬rS¬rS¬rS¬rS¬rS¬rS¬sS¬sS­sS­sS­sS­sS­sS­sS®sS®sS®sS®sS®tS¯tS°tS°uS±uS±uT±uT²uT²uT²uT´vTµwT´vT³vT²uT¯tS¢mR¯tS±uT±uS®tS«rS§pR¢mRkQ—hQ‘ePŠaPƒ^O\N{ZNvXNqUMpTMnSMlRMP%\À\À\À\À B#C*E$.E- .!G$Y:%d<"SFJYIKZIKNCJ\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\ÀPDJZIK_LKdNLgPLjQLlRMnSMpTMqUMuWMyYN€\O†`OcP’fP—hQœjQ¡mR¥oR¨qS«rS«rSªrS mR
+!C+E'0F.4F7%8%U/lG.SFJZIK]KKZIKB=H\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\ÀREJZJK`LKdNLgPLjQLlRMnSMpTMqUMtWMxXN{ZN~[N]O„^O†`O‰aO‹bPdP•gQ™iQœkQ lR¤nR§pSªrS­sS¯tT²uT´vT¶wT·xT¹yT¹yTºyTºyT¹yT¶xT´vT¬rS¢nR—hQ¿|U¿|UÀ|UÀ|UÀ|UÀ|UÀ|UÀ|UÀ|UÀ|UÀ|UÀ|UÀ|UÀ|UÀ}UÀ}UÁ}UÁ}UÁ}UÁ}UÂ}UÂ~UÃ~UÃ~VÃ~VÄVÅ€WÆX®a(ŸlRªrS´vT¸yT¼zU¾|UÁ~VÃXÆ‚[Ɇ_΋dÓ‘jÔ“mÔ“nБlÊŒhĆd½_¶{[°vWªsU¦pS¢nRžkRšiQ˜hQ•gQ“fQ‘ePdPŒbP‰aO†_Oƒ^O€\O|ZNxXNsVMpTMnTMmSMjQL€C B)D&/F-3F47G6%>" Y7 kA$YIK]KK^KKSFJ\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\ÀVGJ\KKbMLeOLhPLkRLmSMnTMpTMrUMuWNyYN|ZN\N‚]O„_O‡`OŠaPŒbPŽcPeP“fP—hQ›jQžlR¢nR¥oS©qT¬sT¯uU²vU´wV¶xV¸yV¹yUºzU»zU¼{U½{U¾{U¾|U¿|U¿|U¿|U¿|U¾{U½{U¼{U¼zU»zTºyT¹yT¸xTµwT³vT´vT´vT´vT´wT´wTµwT·xT¹yTºzT¼zU½{U¾{U¿|UÀ|UÂ}UÄVÅ€WÇ‚YÉ„\͈_ÑŒdÙ”láuç£|쩂ſt명æ¦ÞŸ{Õ—sËŽl†d¹^³yZ­uW¨qU¤oSŸlRžkRœjQšiQ˜hQ–gQ”fQ‘ePdPcPŠaP‡`O„^O]O}[NyYNuWMpTMoTMmSMkRLgPL&D#.E,3F46G;'<(D"iB(VGJ]KK`LK[JKB>H\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\ÀNCJYIK^LKcNLfOLiQLkRMmSMoTMqUMsVMvXNzYN}[N€\O‚^O…_Oˆ`OŠaPŒcPdP‘eP“fQ•gQ—hQ™iQkR mS¤oT¨rU¬tW°wY´zZ¸}\»]¾€^À^Á‚^‚^Â\Á€ZÁYÁXÁ~WÁ~WÂ~VÂ~VÂ~VÃ~VÃ~UÃ~UÄ~UÄ~UÄUÄUÅVÅVÅVÅVÆVÆ€VÆ€VÇ€WÇWÈ‚XɃZË…[͇^ЊaÓdØ’iÜ—nâtè£zî©ó¯‡ø´û¸‘üº“û¹“÷¶ñ±Œé©…à¡~Ö˜vËmÇf»€`´z[®vX©rU¥pT£oS¢nS lRžkRœkRšjQ˜iQ–hQ”fQ’ePdPcP‹bPˆ`O…_O‚]O~[NzYNvWNpTMoTMnSMkRMhQLo7 ,2F36G99HC+@ ]8 nA"\JK`ML_LKSFJ\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\ÀSFJ[JK`LKdNLgPLjQLlRMnSMpTMqUMtVMwXNzZN}[N€]Oƒ^O†_OˆaO‹bPcPdP‘eP“fQ•gQ—hQ™iQ›jRžlR mS£oU§rW¬vZ²{]¹€a¿…fÅŠjËnГqÓ•sÕ–sÕ–rÕ–qÕ”oÓ’mÑjÏgÍŠcˈaɆ^È„\Ç‚[ÆYÅ€XÅ€WÅWÅWÅVÅVÅWÅ€WÆ€WÇXÈ‚YɃ[Ê…\͇_ÏŠaÒeÕ‘hÙ•mÝ™qávä¡zç¤}꧀멃몄騃奀ߠ|Ù›wÓ•rÌmƉh¿„c¸~^²yZ®vX¬tWªsV¨qU¦pT¤oS¢nS mRžlRœkR›jQ™iQ—hQ•gQ“fPePŽcP‹bPˆaO…_O‚^O\N{ZNwXNsVMoTMnSMlRMiQL~I#26G99G?<HA*E$ i@$ZIKaMLbML[JK;:H\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\ÀWHJ]KKbMLeOLhPLjRLlSMnTMpTMrUMuWMxXN{ZN~\N]O„^O†`O‰aO‹bPŽcPdP’eP”fQ–gQ˜hQšiQœkRžlS mT£oU¦rWªuZ¯y]´~aºƒfŠlË’sÔšzÜ¡€ã§†è«‰ë®‹í¯Œí®‹ë¬ˆè¨„ã£~ßžyÚ™tÖ•oÒjÎŒfˈbÈ…_ƃ\ÅZÄ€YÃXÂWÂ~WÂ~WÂ~WÃXÀXÄ€YÅZƃ\Ç…^Ɇ`ˈbÌŠdÍ‹fÎgÎŽiÎŽjÎŽjÍŽjËŒiljgÆd¿ƒaº^¸}]¶|\´{[²yZ°xY®vX¬tWªsV¨qU¦pT¤oS¢nS mRžlRkR›jQ™iQ—hQ•gQ“fP‘ePŽdPŒbP‰aO†_Oƒ^O€\O|ZNxXNtVMpTMnSMmSMjQLgPL99G?<HG-E&b;!YIK`MLdOM`LKNCJ\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\ÀŸlRºyTÄ~UÊ‚XʃYÄXº{W­tUšW'¢[(—hQ lRcP€\OhQL\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\ÀNCJYIK^LKcNLfOLiQLkRLmSMoTMqUMrVMvWNyYN|ZN\N‚]O„_O‡`O‰aPŒbPŽcPdP’fP”gQ–hQ˜iQšjRœkRžlS¡nT¤pU§sW«vZ°z]µb»„gŠlÉ‘sИyØžÞ¤…ã©Šè­ì±ï³‘ﳑ뭊穅⣀ݞzؘtÒ“nÎiɉdÆ…`Â]Á€[¿~Y¾}X½|W½|V¼{V¼{V¼{V¼{V¼{V¼|W¼|W½}X½}Y½~Z½~Z¼~Z»}[º}[º}[º~\º~\º~]º~]¹~]¸~]·}]¶|\´z[²yZ°wY®vX¬tWªsV¨rU¦pT¤oS¢nS mRŸlRkR›jQšiQ˜hQ–gQ“fQ‘ePdPŒcPŠaP‡`O„^O]O}[NyYNuWNpTMnTMmSMkRLhPL|H$D>IQ2P+XHK_LLfQOcNLXIK\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À©qSºyTÃ~VΈ`遲ޜv¾€]ªqS–LŽG|> g3
+S)?*%.—hQ—hQ‘eP‡`OuWM\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\ÀSFJ[JK`LKdNLgPLjQLlRMnSMoTMqUMsVMwXNzYN}[N€\O‚^O…_O‡`OŠaPŒbPŽdP‘eP“fP•gQ—hQ˜iQšjRœkRŸlS¡nT¤pV§sX«vZ°z^¶b¼…gËmÊ’sјzØŸ€Þ¤…ã©Šè­ê¯ë°ê¯Žè¬‹å¨‡à¤‚Ûž|Ö™wÑ“qÌŽlljgÃ…bÀ‚_½\»}Zº{X¹zW¸yV·yU·xU·xU·xT·xT·xU·xU·xU·yV·yV·yW¸zW¸{X¹{Y¹|Zº}[º}[º}\º~\¹~]¹~]¸}]·|\µ{\´z[²yZ°wY®vX¬tWªsV¨rU¦pT¤oS¢nS¡mRŸlRkRœjQšiQ˜hQ–gQ”fQ’ePdPcPŠbP‡`O…_O‚]O~[NzZNvWNrUMoTMmSMlRMiQLeOLJAIJ(h>!]KKfQOgQN_LKD>I\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À™iQ°tS¸yT¼{UÂYÎŒeï­ˆô´Õ—u¶|\ Z'™LˆD
+|>
+
++,!.! "`E6†iYŒlZo\“q]•s^^J™va›wbycŸzd {e¤}foTMqUMsVMuWNwXNyYN{ZN|ZN~[N\O]O‚]Oƒ^O…_O†_O‡`Oˆ`O‰aOŠaP‹bPŒbPŒcPcPŽcPŽdPdPdPdPeP‘eP‘eP‘eP’eP’eP’eP’eP’fP’fP’fP“fP’fP’fP’fP’eP’eP’eP‘eP‘eP‘ePePdPdPdPŽdPŽcPcPŒcPŒbP‹bPŠaP‰aOˆ`O‡`O†_O…_Oƒ^O‚]O]O\O~[N|[N{ZNyYNwXN®ƒi¬ƒiª‚i¨i¦€hŒhR‰fQ†dQ‚bP•wfx]Oˆpdkbtd_m`]OEDG?A;:@.S….S….S….S….S…/S…/S…/S…/S…/S…/S…/S…/S…TxªTxªTxªTxªTxªTx«Tx«Tx«Ty«/S†GlžHlžHlžHlžHlžHlžHlžHlžHlžHlžHlžHlžHlžHlžHlžHlžHlžHlžHlžHlžHlžHlžHlž…ªÜ…ªÜ…ªÜHlžHlžHlžHlžHlžHlžHlžHlžHlžHlžHlžHlžHlžHlžHlžHlžHlžHlžHlžHlžHlžHlž…ªÜ…ªÜ£Ö£Ö£Ö£Ö¤Ö¤Ö¤Ö¤Ö¤ÖEi›€¤Ö€¤Ö€¤Ö€¤Ö€¤Ö€¤Ö€¤Ö€¤Ö€¤Ö€¤Ö€¤Ö€¤Ö€¤×€¤×€¤×€¤×€¥×€¥×€¥×Bg™Bg™Bg™Bg™Bg™&J|&J|&J|&J|&J|&J|&J|&J|&J|&J|&J|&J|&J|Bf˜Bf˜Bf˜Bf˜Bf˜Bf˜Bf˜Bf˜Bf˜Af˜Af˜%J|%J|%J|%J|%J|%J|%J|%J|%J|%J|%I|%I|%I|%I|%I|%I|
++,YA5jPBpSD‹l[o]’q^–t`‚_Kšwbœycžze {f¡}g¤h¨i”lSrVMtWMvWNxXNyYN{ZN|[N~[N\O]O‚]Oƒ^O„_O…_O†`O‡`Oˆ`O‰aPŠaP‹bP‹bPŒbPcPcPŽcPŽcPdPdPdPdPdPdPdPdPePePePePePdPdPdPdPdPdPdPŽcPŽcPcPcPŒbP‹bP‹bPŠaP‰aOˆ`O‡`O†`O…_O„^Oƒ^O‚]O€]O\O~[N|[N{ZNyYNxXN°…j®„j¬„jªƒj¨‚j¦€jŒhSŠgS†eRƒcR|`QŒsf…oe}jcrd`k_]LCDC=@,,3(4F(4F.S….S…/S…/S…/S…/S…/S…/S…/S…TxªTxªTxªTxªTxªTxªTx«Tx«Tx«Ty«Ty«Ty«…ªÜHlžHlžHlžHlžHlžHlžHlžHlžHlžHlžHlžHlžHlžHlžHlžHlžHlžHlžHlžHlžHlžHlžHlžHlž†ªÜHlžHlžHlžHlžHlžHlžHlžHlžHlžHlžHlžHlžHlžHlžHlžHlžHlžHlžHlžHlžHlžHlžHlžHlžHlžChšChš¤Ö€¤Ö€¤Ö€¤Ö€¤ÖEi›Ei›Ei›€¤Ö€¤Ö€¤Ö€¤Ö€¤Ö€¤Ö€¤×€¤×€¤×€¤×Cg™Cg™Cg™Cg™Cg™Cg™Cg™Cg™Cg™Cg™Cg™Cg™Bg™Bg™&J|&J|&J|&J|&J|&J|&J|&J|&J|&J|Bf˜Bf˜Bf˜Bf˜Bf˜Bf˜Bf˜Bf˜Bf˜Bf˜Bf˜Bf˜Bf˜Bf˜Bf˜&J|%J|%J|%J|%J|%J|%J|%J|%J|%J|%J|%J|%I|%I|%I|%I|%I|#5H71O;3V?4iOBoSDsVFo]{[I^Kƒ`L…bN‡dOŸ{f }g¢~h¥€j’kT•mU˜oVšqWrWwXNxXNzYN{ZN}[N~[N\O€]O‚]Oƒ^O„^O…_O…_O†`O‡`Oˆ`O‰aO‰aPŠaP‹bP‹bPŒbPŒbPŒcPcPcPcPŽcPŽcPŽcPŽcPŽcPŽcPŽcPŽcPŽcPŽcPcPcPcPŒcPŒbP‹bP‹bP‹bPŠaP‰aP‰aOˆ`O‡`O†_O…_O„_O„^Oƒ^O]O€\O\N~[N|ZN{ZNyYN›oTšoT™oT—nT¬„lªƒl¨‚ljUŒiTŠhT†fT€cSvi‰rgnfyidqdah^^HBD?<@)+3OZkMYk(5F(5F(5F/S…/S…/S…/S…/S…TxªTxªTxªTxªTxªTxªTx«Tx«Ty«Ty«Ty«Ty«Uy«†ªÜ†ªÜ†ªÜ†ªÜHlžHlžHlžHlžHlžHlžHlžHlžHlžHlžHlžHlžHlžHlžHlžHlžHlžHlžHlžHlž†ªÜ†ªÜ†ªÜ†ªÜ†ªÜHlžHlžHlžHlžHlžHlžHlžHlžHlžHlžHlžHlžHlžHlžHlžHlžHlžHlžHlžHlžHlžHlžHlžDhšDhšDhšChš&K}&K}&K}&K}&K}&K}ChšChšCgšCgšCgšCgšCgšCgšCg™Cg™Cg™Cg™Cg™Cg™Cg™Cg™Cg™Cg™Cg™Cg™Cg™Cg™Cg™Cg™Cg™&J|&J|&J|&J|&J|&J|Bg™Bg™Bg™Bf™Bf™Bf™Bf™Bf™Bf˜Bf˜Bf˜Bf˜Bf˜Bf˜Bf˜Bf˜Bf˜Bf˜Bf˜&J|&J|&J|&J|%J|%J|%J|%J|%J|%J|%J|%J|%J|%J|%J|%I|%I|A99N?;L:2T>4gNBlRD‡k\‹n^z[J~^LaN…cO‡dP‰fQŠgRŒhTjU’lV•nW˜pXšrXsY¶‹q¸qºŽr¼r½r¿s©z[©z[ªz[«{[¬{[¬{ZÅ“rÅ’qÅ’qÅ’pÅ’pÅ‘o­yV­xV¬xU¬wT¬wTŠaPŠbP‹bP‹bP‹bP‹bP‹bP‹bP‹bP‹bP‹bP‹bP‹bP‹bPŠaPŠaPŠaP‰aP‰aOˆaOˆ`O‡`O‡`O†_O…_O„^Oƒ^O‚^O‚]O]O€\O~\N}[N|ZNzYNpTœpU›pUšpU˜oV—oV•nV“mV‘lVkVŒjVˆhVƒfU~cUuj†qh~mfugdkaad\^E@D98?$(2minffm^blV^lMYk(5F(5F/S…TxªTxªTxªTxªTxªTxªTxªTx«Tx«Ty«Ty«Ty«Uy«Uy«†ªÜ†ªÜ†ªÜ†ªÜ†ªÜ†ªÜ†ªÜ†ªÜHlžHlžHlžHlžHlŸHlŸHlŸHlŸHlŸHlŸHlŸHlŸHlŸHlŸHlŸ†ªÝ†ªÝ†ªÝ†ªÝ†ªÝ†ªÝ†ªÝ†ªÝ†ªÝ†ªÝHlŸHlŸHlŸHlŸHlŸHlŸHlŸHlŸHlŸHlŸHlŸHlŸHlŸHlŸHlŸHlŸHlŸHlŸHlŸHlŸHlŸ'K}'K}'K}'K}'K}'K}'K}'K}'K}&K}&K}ChšChšChšChšChšChšChšCgšCgšCgšCgšCgšCgšCg™Cg™Cg™Cg™Cg™Cg™Cg™Cg™Cg™Cg™Cg™Cg™&J|Cg™Cg™Cg™Cg™Cg™Bg™Bg™Bg™Bg™Bg™Bg™Bf™Bf™Bf™Bf™Bf™Bf˜Bf˜Bf˜Bf˜Bf˜Bf˜Bf˜Bf˜&J|&J|&J|&J|&J|&J|&J|%J|%J|%J|%J|%J|%J|%J|Ae˜Ae˜;GY<68I=:I82Q=4XA6~fZ„j\‰m^p`|]L€`NƒcP†eQˆgS¡j£€l¦‚m©„n•oX˜qYšrZt[¶Œr¸sºs¼t½t¾‘t¨z]©{]ª{]«{\«{\¬{\¬{[Ä“sÄ“rÄ’rÄ’qÄ’pÄ‘p¬yWÄoÃnÃmÃlÂŽlÂŽkÁkˆaOˆaOˆaOˆaOˆaOˆaOˆaOˆ`Oˆ`O‡`O‡`O‡`O†`O†_O…_O…_O„_O„^Oƒ^O‚]O]O€]O\O~\N}[N|ZN¶‰l¶‰lµˆmœqV›qVšqV™pW˜pW–oW¬…nª…n§„n¤‚nŸ€n›~n€eW‘xlŠtk‚piykfodcf_`JDG@>C*,5$1MYktr~tstmolinadmX_lNZkMZkTxªTxªTxªTxªTx«Tx«Tx«Ty«Ty«Ty«Uy«Uy«Uy«†ªÝ†ªÝ†ªÝ†ªÝ†ªÝ†ªÝ†«Ý†«Ý†«Ý†«ÝHlŸHlŸHmŸHmŸHmŸHmŸHmŸHmŸHmŸHmŸHmŸHmŸ†«Ý†«Ý†«Ý‡«Ý‡«Ý‡«Ý‡«Ý‡«Ý‡«Ý‡«Ý‡«Ý‡«Ý‡«ÝHmŸHmŸHmŸHmŸHmŸHmŸHmŸHmŸHmŸHmŸHmŸHmŸHmŸHmŸHmŸHmŸHmŸHmŸHmŸHmŸ'K}'K}'K}'K}'K}'K}'K}'K}'K}'K}'K}'K}DhšDhšDhšDhšChšChšChšChšChšChšChšCgšCgšCgšCgšCgšCgšCg™Cg™Cg™Cg™Cg™&J}&J}&J}Cg™Cg™Cg™Cg™Cg™Cg™Cg™Cg™Cg™Cg™Bg™Bg™Bg™Bg™Bg™Bg™Bf™Bf™Bf™Bf™Bf˜Bf˜Bf˜Bf˜Bf˜&J|&J|&J|&J|&J|&J|&J|&J|&J|&J|Af˜Af˜Af˜Af˜;GY;GY;GY1'!D:9N?;N;3]I?zdY€h[†l^‹oasc“ue€bQ„dR‡fT l¢m¦ƒn©…o«‡p®ˆq±Šr³‹sžv] w]¹u»u¼‘u¾‘u¿’v¨{^©{^ª|^«|]«|]«{\¬{\¬{[¬{[¬zZ«zZ«yY«yX«xXÂoÂnÂnÁŽmÁŽm¨uT¨uS§tS§tS§tR¦sR¦sQ…_O…_O…_O„^O„^Oƒ^Oƒ^O‚^O‚]O]O€]O¢rS¡rS¡rS¸‰k·‰l·‰l¶‰m¶‰mµ‰m´‰n³‰n›qWšqX™qX®‡o­‡o«†p¨…p¤ƒp pœp—}o{cXv`Vp]U}nishfhaba\_DAF::B$)4
+., 7(8'A1&F4(L8*oXIw]Jpdasfcvhexkg{mi~oj€qll\Xn^Yp`Zpa[qa\rb]rc^sc^sd_ue`wf`xgayhayhayhbxy‘y‘y‘y‘yy~ywgbvfateasd`qd`pc`nb_la_€ut|ssxqrunpZUXVRWROUMMSHIRIC@967-/3'+0(*-ACF?AD;=@#%(
+.+>1(B3)B2&F4'E4)gTGlXJs^OzcTzaPqfethgvjhbVTcWUdXVeYWfZXg[Yh\Zi]Zi][j^\€us€ususts~tt~tt}tt|st{stut~tt|sszrsyqrwpquoqsmpqloXTXTQWPOULLSSJEA<:=99757335./2113)+.'),)+.8:="(
+"6*#5*">2)>0&A2'C3(I8-^OFbRHfUJjXMq^RwcVzfYfRDfQCdN@zdTqijrjksklrklrklrklqjmpjmpjmojmojmnimmimkhliflscYm`Xg\VbYT^VRE>;A<:>98:77645:873220/0,-/)+.*,/#%( &
+
+&3#.$-% .% .& /&!,#,#@70A71XNHXNHWNHWNHZRLYQLYQLXQLWQLWPLUOLSNLQMKOLJMJJ0//.-.,,-&(+"(!'
+
+ %' %$#" ! !$
+
+
+ 
+
+
+*  
+  ;?E7CU;HY=I[ 
diff --git a/ext/tk/sample/iso2022-kr.txt b/ext/tk/sample/iso2022-kr.txt
new file mode 100644
index 0000000000..2e3fe6ea2a
--- /dev/null
+++ b/ext/tk/sample/iso2022-kr.txt
@@ -0,0 +1,2 @@
+Sample text:
+$)C Hangul (GQ1[) >H3gGO<<?d, >H3gGO=J4O1n
diff --git a/ext/tk/sample/msgs_rb/README b/ext/tk/sample/msgs_rb/README
new file mode 100644
index 0000000000..2e3ff2a9c4
--- /dev/null
+++ b/ext/tk/sample/msgs_rb/README
@@ -0,0 +1,3 @@
+Message catalogs in this directory depend on Tcl/Tk's message catalogs.
+Texts of each locale are copied from Tcl/Tk8.5a1 widget demos.
+Please refer '../msgs_tk/README'.
diff --git a/ext/tk/sample/msgs_rb/cs.msg b/ext/tk/sample/msgs_rb/cs.msg
new file mode 100644
index 0000000000..199f2a73bd
--- /dev/null
+++ b/ext/tk/sample/msgs_rb/cs.msg
@@ -0,0 +1,84 @@
+TkMsgCatalog.new('::tkmsgcat_demo') {
+ cs "Application Error", "Chyba programu"
+ cs "Blue", "Modr\341"
+ cs "Color", "Barva"
+ cs "Delete", "Smazat"
+ cs "Error", "Chyba"
+ cs "Exit", "Konec"
+ cs "Green", "Zelen\341"
+ cs "Red", "\\u010cerven\341"
+ cs "blue", "modr\341"
+ cs "green", "zelen\341"
+ cs "red", "\\u010derven\341"
+}
+
+TkMsgCatalog.new('::tk') {
+ cs "&Abort", "&P\\u0159eru\\u0161it"
+ cs "About...", "O programu..."
+ cs "All Files", "V\\u0161echny soubory"
+ cs "Application Error", "Chyba programu"
+ cs "&Blue", "&Modr\341"
+ cs "&Cancel", "&Zru\\u0161it"
+ cs "Cannot change to the directory \"%1\$s\".\nPermission denied.", "Nemohu zm\\u011bnit atku\341ln\355 adres\341\\u0159 na \"%1\$s\".\nP\\u0159\355stup odm\355tnut."
+ cs "Choose Directory", "V\375b\\u011br adres\341\\u0159e"
+ cs "Clear", "Smazat"
+ cs "Color", "Barva"
+ cs "Console", "Konzole"
+ cs "Copy", "Kop\355rovat"
+ cs "Cut", "Vy\\u0159\355znout"
+ cs "Delete", "Smazat"
+ cs "Details >>", "Detaily >>"
+ cs "Directory \"%1\$s\" does not exist.", "Adres\341\\u0159 \"%1\$s\" neexistuje."
+ cs "&Directory:", "&Adres\341\\u0159:"
+ cs "Error: %1\$s", "Chyba: %1\$s"
+ cs "Exit", "Konec"
+ cs "File \"%1\$s\" already exists.\n\n", "Soubor \"%1\$s\" ji\\u017e existuje.\n\n"
+ cs "File \"%1\$s\" already exists.\nDo you want to overwrite it?", "Soubor \"%1\$s\" ji\\u017e existuje.\nChcete jej p\\u0159epsat?"
+ cs "File \"%1\$s\" does not exist.", "Soubor \"%1\$s\" neexistuje."
+ cs "File &name:", "&Jm\351no souboru:"
+ cs "File &names:", "&Jm\351na soubor\\u016f:"
+ cs "Files of &type:", "&Typy soubor\\u016f:"
+ cs "Fi&les:", "Sou&bory:"
+ cs "&Filter", "&Filtr"
+ cs "Fil&ter:", "Fil&tr:"
+ cs "&Green", "Ze&len\341"
+ cs "Hi"
+ cs "Hide Console", "Skr\375t konsolu"
+ cs "&Ignore", "&Ignorovat"
+ cs "Invalid file name \"%1\$s\".", "\\u0160patn\351 jm\351no souboru \"%1\$s\"."
+ cs "Log Files", "Log soubory"
+ cs "&No", "&Ne"
+ cs "&OK"
+ cs "Ok"
+ cs "Open", "Otev\\u0159\355t"
+ cs "&Open", "&Otev\\u0159\355t"
+ cs "Open Multiple Files", "Otev\\u0159\355t v\355ce soubor\\u016f"
+ cs "Paste", "Vlo\\u017eit"
+ cs "Quit", "Skon\\u010dit"
+ cs "&Red", " \\u010ce&rven\341"
+ cs "Replace existing file?", "Nahradit st\341vaj\355c\355 soubor?"
+ cs "&Retry", "Z&novu"
+ cs "&Save", "&Ulo\\u017eit"
+ cs "Save As", "Ulo\\u017eit jako"
+ cs "Save To Log", "Ulo\\u017eit do logu"
+ cs "Select Log File", "Vybrat log soubor"
+ cs "Select a file to source", "Vybrat soubor k nahr\341n\355"
+ cs "&Selection:", "&V\375b\\u011br:"
+ cs "Skip Messages", "P\\u0159esko\\u010dit zpr\341vy"
+ cs "Source...", "Nahr\341t..."
+ cs "Tcl Scripts", "Tcl skripty"
+ cs "Tcl for Windows", "Tcl pro Windows"
+ cs "Text Files", "Textov\351 soubory"
+ cs "&Yes", "&Ano"
+ cs "abort", "p\\u0159eru\\u0161it"
+ cs "blue", "modr\341"
+ cs "cancel", "zru\\u0161it"
+ cs "extension", "p\\u0159\355pona"
+ cs "extensions", "p\\u0159\355pony"
+ cs "green", "zelen\341"
+ cs "ignore", "ignorovat"
+ cs "ok"
+ cs "red", "\\u010derven\341"
+ cs "retry", "znovu"
+ cs "yes", "ano"
+}
diff --git a/ext/tk/sample/msgs_rb/de.msg b/ext/tk/sample/msgs_rb/de.msg
new file mode 100644
index 0000000000..283874df42
--- /dev/null
+++ b/ext/tk/sample/msgs_rb/de.msg
@@ -0,0 +1,88 @@
+TkMsgCatalog.new('::tkmsgcat_demo') {
+ de "Application Error", "Applikationsfehler"
+ de "Blue", "Blau"
+ de "Color", "Farbe"
+ de "Delete", "L\\u00f6schen"
+ de "Error", "Fehler"
+ de "Exit", "Ende"
+ de "Green", "Gr\\u00fcn"
+ de "Red", "Rot"
+ de "blue", "blau"
+ de "green", "gr\\u00fcn"
+ de "red", "rot"
+}
+
+TkMsgCatalog.new('::tk') {
+ de "&Abort", "&Abbruch"
+ de "&About...", "&\\u00dcber..."
+ de "All Files", "Alle Dateien"
+ de "Application Error", "Applikationsfehler"
+ de "&Blue", "&Blau"
+ de "&Cancel", "&Abbruch"
+ de "Cannot change to the directory \"%1\$s\".\nPermission denied.", "Kann nicht in das Verzeichnis \"%1\$s\" wechseln.\nKeine Rechte vorhanden."
+ de "Choose Directory", "W\\u00e4hle Verzeichnis"
+ de "&Clear", "&R\\u00fccksetzen"
+ de "&Clear Console", "&Konsole l\\u00f6schen"
+ de "Color", "Farbe"
+ de "Console", "Konsole"
+ de "&Copy", "&Kopieren"
+ de "Cu&t", "Aus&schneiden"
+ de "&Delete", "&L\\u00f6schen"
+ de "Details >>"
+ de "Directory \"%1\$s\" does not exist.", "Das Verzeichnis \"%1\$s\" existiert nicht."
+ de "&Directory:", "&Verzeichnis:"
+ de "&Edit", "&Bearbieten"
+ de "Error: %1\$s", "Fehler: %1\$s"
+ de "E&xit", "&Ende"
+ de "&File", "&Datei"
+ de "File \"%1\$s\" already exists.\nDo you want to overwrite it?", "Die Datei \"%1\$s\" ist bereits vorhanden.\nWollen sie diese Datei \\u00fcberschreiben ?"
+ de "File \"%1\$s\" already exists.\n\n", "Die Datei \"%1\$s\" ist bereits vorhanden.\n\n"
+ de "File \"%1\$s\" does not exist.", "Die Datei \"%1\$s\" existiert nicht."
+ de "File &name:", "Datei&name:"
+ de "File &names:", "Datei&namen:"
+ de "Files of &type:", "Dateien des &Typs:"
+ de "Fi&les:", "Dat&eien:"
+ de "&Filter"
+ de "Fil&ter:"
+ de "&Green", "&Gr\\u00fcn"
+ de "&Help", "&Hilfe"
+ de "Hi", "Hallo"
+ de "&Hide Console", "&Konsole unsichtbar machen"
+ de "&Ignore", "&Ignorieren"
+ de "Invalid file name \"%1\$s\".", "Ung\\u00fcltiger Dateiname \"%1\$s\"."
+ de "Log Files", "Protokolldatei"
+ de "&No", "&Nein"
+ de "OK"
+ de "Ok"
+ de "Open", "\\u00d6ffnen"
+ de "&Open", "\\u00d6&ffnen"
+ de "Open Multiple Files"
+ de "P&aste", "E&inf\\u00fcgen"
+ de "&Quit", "&Beenden"
+ de "&Red", "&Rot"
+ de "Replace existing file?", "Existierende Datei ersetzen?"
+ de "&Retry", "&Wiederholen"
+ de "&Save", "&Speichern"
+ de "Save As", "Speichern unter"
+ de "Save To Log", "In Protokoll speichern"
+ de "Select Log File", "Protokolldatei ausw\\u00e4hlen"
+ de "Select a file to source", "Auszuf\\u00fchrende Datei ausw\\u00e4hlen"
+ de "&Selection:", "Auswah&l:"
+ de "Skip Messages", "Weitere Nachrichten \\u00fcberspringen"
+ de "&Source...", "&Ausf\\u00fchren..."
+ de "Tcl Scripts", "Tcl-Skripte"
+ de "Tcl for Windows", "Tcl f\\u00fcr Windows"
+ de "Text Files", "Textdateien"
+ de "&Yes", "&Ja"
+ de "abort", "abbrechen"
+ de "blue", "blau"
+ de "cancel", "abbrechen"
+ de "extension", "Erweiterung"
+ de "extensions", "Erweiterungen"
+ de "green", "gr\\u00fcn"
+ de "ignore", "ignorieren"
+ de "ok"
+ de "red", "rot"
+ de "retry", "wiederholen"
+ de "yes", "ja"
+}
diff --git a/ext/tk/sample/msgs_rb/el.msg b/ext/tk/sample/msgs_rb/el.msg
new file mode 100644
index 0000000000..f314ae03eb
--- /dev/null
+++ b/ext/tk/sample/msgs_rb/el.msg
@@ -0,0 +1,98 @@
+TkMsgCatalog.new('::tkmsgcat_demo') {
+ el 'Application Error', '\u039b\u03ac\u03b8\u03bf\u03c2 \u0395\u03c6\u03b1\u03c1\u03bc\u03bf\u03b3\u03ae\u03c2'
+ el 'Blue', '\u039c\u03c0\u03bb\u03b5'
+ el 'Color', '\u03a7\u03c1\u03ce\u03bc\u03b1'
+ el 'Delete', '\u0394\u03b9\u03b1\u03b3\u03c1\u03b1\u03c6\u03ae'
+ el 'Error', '\u039b\u03ac\u03b8\u03bf\u03c2'
+ el 'Exit', '\u0388\u03be\u03bf\u03b4\u03bf\u03c2'
+ el 'Green', '\u03a0\u03c1\u03ac\u03c3\u03b9\u03bd\u03bf'
+ el 'Red', '\u039a\u03cc\u03ba\u03ba\u03b9\u03bd\u03bf'
+ el 'blue', '\u03bc\u03c0\u03bb\u03b5'
+ el 'green', '\u03c0\u03c1\u03ac\u03c3\u03b9\u03bd\u03bf'
+ el 'red', '\u03ba\u03cc\u03ba\u03ba\u03b9\u03bd\u03bf'
+}
+
+TkMsgCatalog.new('::tk') {
+ el '&Abort', '\u03a4\u03b5\u03c1\u03bc\u03b1\u03c4\u03b9\u03c3\u03bc\u03cc\u03c2'
+ el 'About...', '\u03a3\u03c7\u03b5\u03c4\u03b9\u03ba\u03ac...'
+ el 'All Files', '\u038c\u03bb\u03b1 \u03c4\u03b1 \u0391\u03c1\u03c7\u03b5\u03af\u03b1'
+ el 'Application Error', '\u039b\u03ac\u03b8\u03bf\u03c2 \u0395\u03c6\u03b1\u03c1\u03bc\u03bf\u03b3\u03ae\u03c2'
+ el '&Blue', '\u039c\u03c0\u03bb\u03b5'
+ el '&Cancel', '\u0391\u03ba\u03cd\u03c1\u03c9\u03c3\u03b7'
+ el 'Cannot change to the directory "%1\$s".' "\n" 'Permission denied.', \
+ '\u0394\u03b5\u03bd \u03b5\u03af\u03bd\u03b1\u03b9 \u03b4\u03c5\u03bd\u03b1\u03c4\u03ae \u03b7 \u03b1\u03bb\u03bb\u03b1\u03b3\u03ae \u03ba\u03b1\u03c4\u03b1\u03bb\u03cc\u03b3\u03bf\u03c5 \u03c3\u03b5 "%1\$s".' \
+ "\n" \
+ '\u0397 \u03c0\u03c1\u03cc\u03c3\u03b2\u03b1\u03c3\u03b7 \u03b4\u03b5\u03bd \u03b5\u03c0\u03b9\u03c4\u03c1\u03ad\u03c0\u03b5\u03c4\u03b1\u03b9.'
+ el 'Choose Directory', '\u0395\u03c0\u03b9\u03bb\u03bf\u03b3\u03ae \u039a\u03b1\u03c4\u03b1\u03bb\u03cc\u03b3\u03bf\u03c5'
+ el 'Clear', '\u039a\u03b1\u03b8\u03b1\u03c1\u03b9\u03c3\u03bc\u03cc\u03c2'
+ el 'Color', '\u03a7\u03c1\u03ce\u03bc\u03b1'
+ el 'Console', '\u039a\u03bf\u03bd\u03c3\u03cc\u03bb\u03b1'
+ el 'Copy', '\u0391\u03bd\u03c4\u03b9\u03b3\u03c1\u03b1\u03c6\u03ae'
+ el 'Cut', '\u0391\u03c0\u03bf\u03ba\u03bf\u03c0\u03ae'
+ el 'Delete', '\u0394\u03b9\u03b1\u03b3\u03c1\u03b1\u03c6\u03ae'
+ el 'Details >>', '\u039b\u03b5\u03c0\u03c4\u03bf\u03bc\u03ad\u03c1\u03b5\u03b9\u03b5\u03c2 >>'
+ el 'Directory "%1\$s", does not exist.', \
+ '\u039f \u03ba\u03b1\u03c4\u03ac\u03bb\u03bf\u03b3\u03bf\u03c2 \'%1\$s\' \u03b4\u03b5\u03bd \u03c5\u03c0\u03ac\u03c1\u03c7\u03b5\u03b9.'
+ el '&Directory:', '&\u039a\u03b1\u03c4\u03ac\u03bb\u03bf\u03b3\u03bf\u03c2:'
+ el 'Error: %1\$s', '\u039b\u03ac\u03b8\u03bf\u03c2: %1\$s'
+ el 'Exit', '\u0388\u03be\u03bf\u03b4\u03bf\u03c2'
+ el 'File "%1\$s" already exists.' "\n" 'Do you want to overwrite it?', \
+ '\u03a4\u03bf \u03b1\u03c1\u03c7\u03b5\u03af\u03bf "%1\$s" \u03ae\u03b4\u03b7 \u03c5\u03c0\u03ac\u03c1\u03c7\u03b5\u03b9.' \
+ "\n" \
+ '\u0398\u03ad\u03bb\u03b5\u03c4\u03b5 \u03bd\u03b1 \u03b5\u03c0\u03b9\u03ba\u03b1\u03bb\u03c5\u03c6\u03b8\u03b5\u03af;'
+ el 'File "%1\$s" already exists.' "\n\n", \
+ '\u03a4\u03bf \u03b1\u03c1\u03c7\u03b5\u03af\u03bf "%1\$s" \u03ae\u03b4\u03b7 \u03c5\u03c0\u03ac\u03c1\u03c7\u03b5\u03b9.' "\n\n"
+ el 'File "%1\$s" does not exist.', \
+ '\u03a4\u03bf \u03b1\u03c1\u03c7\u03b5\u03af\u03bf "%1\$s" \u03b4\u03b5\u03bd \u03c5\u03c0\u03ac\u03c1\u03c7\u03b5\u03b9.'
+ el 'File &name:', '\u038c&\u03bd\u03bf\u03bc\u03b1 \u03b1\u03c1\u03c7\u03b5\u03af\u03bf\u03c5:'
+ el 'File &names:', '\u038c&\u03bd\u03bf\u03bc\u03b1 \u03b1\u03c1\u03c7\u03b5\u03af\u03c9\u03bd:'
+ el 'Files of &type:', '\u0391\u03c1\u03c7\u03b5\u03af\u03b1 \u03c4\u03bf\u03c5 &\u03c4\u03cd\u03c0\u03bf\u03c5:'
+ el 'Fi&les:', '\u0391\u03c1\u03c7\u03b5\u03af\u03b1:'
+ el '&Filter', '\u03a6\u03af\u03bb\u03c4\u03c1\u03bf'
+ el 'Fil&ter:', '\u03a6\u03af\u03bb\u03c4\u03c1\u03bf:'
+ el '&Green', '\u03a0\u03c1\u03ac\u03c3\u03b9\u03bd\u03bf'
+ el 'Hi', '\u0393\u03b5\u03b9\u03b1'
+ el 'Hide Console', '\u0391\u03c0\u03cc\u03ba\u03c1\u03c5\u03c8\u03b7 \u03ba\u03bf\u03bd\u03c3\u03cc\u03bb\u03b1\u03c2'
+ el '&Ignore', '\u0391\u03b3\u03bd\u03cc\u03b7\u03c3\u03b7'
+ el 'Invalid file name "%1\$s".', \
+ '\u0386\u03ba\u03c5\u03c1\u03bf \u03cc\u03bd\u03bf\u03bc\u03b1 \u03b1\u03c1\u03c7\u03b5\u03af\u03bf\u03c5 "%1\$s".'
+ el 'Log Files', '\u0391\u03c1\u03c7\u03b5\u03af\u03b1 \u039a\u03b1\u03c4\u03b1\u03b3\u03c1\u03b1\u03c6\u03ae\u03c2'
+ el '&No', '\u038c\u03c7\u03b9'
+ el '&OK', '\u0395\u03bd\u03c4\u03ac\u03be\u03b5\u03b9'
+ el '&Ok', '\u0395\u03bd\u03c4\u03ac\u03be\u03b5\u03b9'
+ el 'Open', '\u0386\u03bd\u03bf\u03b9\u03b3\u03bc\u03b1'
+ el '&Open', '\u0386\u03bd\u03bf\u03b9\u03b3\u03bc\u03b1'
+ el 'Open Multiple Files', \
+ '\u0386\u03bd\u03bf\u03b9\u03b3\u03bc\u03b1 \u03c0\u03bf\u03bb\u03bb\u03b1\u03c0\u03bb\u03ce\u03bd \u03b1\u03c1\u03c7\u03b5\u03af\u03c9\u03bd'
+ el 'Paste', '\u0395\u03c0\u03b9\u03ba\u03cc\u03bb\u03bb\u03b7\u03c3\u03b7'
+ el 'Quit', '\u0388\u03be\u03bf\u03b4\u03bf\u03c2'
+ el '&Red', '\u039a\u03cc\u03ba\u03ba\u03b9\u03bd\u03bf'
+ el 'Replace existing file?', \
+ '\u0395\u03c0\u03b9\u03ba\u03ac\u03bb\u03c5\u03c8\u03b7 \u03c5\u03c0\u03ac\u03c1\u03c7\u03bf\u03bd\u03c4\u03bf\u03c2 \u03b1\u03c1\u03c7\u03b5\u03af\u03bf\u03c5;'
+ el '&Retry', '\u03a0\u03c1\u03bf\u03c3\u03c0\u03ac\u03b8\u03b7\u03c3\u03b5 \u03be\u03b1\u03bd\u03ac'
+ el '&Save', '\u0391\u03c0\u03bf\u03b8\u03ae\u03ba\u03b5\u03c5\u03c3\u03b7'
+ el 'Save As', '\u0391\u03c0\u03bf\u03b8\u03ae\u03ba\u03b5\u03c5\u03c3\u03b7 \u03c3\u03b1\u03bd'
+ el 'Save To Log', '\u0391\u03c0\u03bf\u03b8\u03ae\u03ba\u03b5\u03c5\u03c3\u03b7 \u03c3\u03c4\u03bf \u03b1\u03c1\u03c7\u03b5\u03af\u03bf \u03ba\u03b1\u03c4\u03b1\u03b3\u03c1\u03b1\u03c6\u03ae\u03c2'
+ el 'Select Log File', '\u0395\u03c0\u03b9\u03bb\u03bf\u03b3\u03ae \u03b1\u03c1\u03c7\u03b5\u03af\u03bf\u03c5 \u03ba\u03b1\u03c4\u03b1\u03b3\u03c1\u03b1\u03c6\u03ae\u03c2'
+ el 'Select a file to source', \
+ '\u0395\u03c0\u03b9\u03bb\u03ad\u03be\u03c4\u03b5 \u03b1\u03c1\u03c7\u03b5\u03af\u03bf \u03b3\u03b9\u03b1 \u03b5\u03ba\u03c4\u03ad\u03bb\u03b5\u03c3\u03b7'
+ el '&Selection:', '\u0395\u03c0\u03b9\u03bb\u03bf\u03b3\u03ae:'
+ el 'Skip Messages', '\u0391\u03c0\u03bf\u03c6\u03c5\u03b3\u03ae \u03bc\u03c5\u03bd\u03b7\u03bc\u03ac\u03c4\u03c9\u03bd'
+ el 'Source...', '\u0395\u03ba\u03c4\u03ad\u03bb\u03b5\u03c3\u03b7...'
+ el 'Tcl Scripts', 'Tcl Scripts'
+ el 'Tcl for Windows', 'Tcl \u03b3\u03b9\u03b1 Windows'
+ el 'Text Files', '\u0391\u03c1\u03c7\u03b5\u03af\u03b1 \u039a\u03b5\u03b9\u03bc\u03ad\u03bd\u03bf\u03c5'
+ el '&Yes', '\u039d\u03b1\u03b9'
+ el 'abort', '\u03c4\u03b5\u03c1\u03bc\u03b1\u03c4\u03b9\u03c3\u03bc\u03cc\u03c2'
+ el 'blue', '\u03bc\u03c0\u03bb\u03b5'
+ el 'cancel', '\u03b1\u03ba\u03cd\u03c1\u03c9\u03c3\u03b7'
+ el 'extension', '\u03b5\u03c0\u03ad\u03ba\u03c4\u03b1\u03c3\u03b7'
+ el 'extensions', '\u03b5\u03c0\u03b5\u03ba\u03c4\u03ac\u03c3\u03b5\u03b9\u03c2'
+ el 'green', '\u03c0\u03c1\u03ac\u03c3\u03b9\u03bd\u03bf'
+ el 'ignore', '\u03b1\u03b3\u03bd\u03cc\u03b7\u03c3\u03b7'
+ el 'ok', '\u03b5\u03bd\u03c4\u03ac\u03be\u03b5\u03b9'
+ el 'red', '\u03ba\u03cc\u03ba\u03ba\u03b9\u03bd\u03bf'
+ el 'retry', '\u03c0\u03c1\u03bf\u03c3\u03c0\u03ac\u03b8\u03b7\u03c3\u03b5 \u03be\u03b1\u03bd\u03ac'
+ el 'yes', '\u03bd\u03b1\u03b9'
+}
+
diff --git a/ext/tk/sample/msgs_rb/en.msg b/ext/tk/sample/msgs_rb/en.msg
new file mode 100644
index 0000000000..9b70239511
--- /dev/null
+++ b/ext/tk/sample/msgs_rb/en.msg
@@ -0,0 +1,83 @@
+TkMsgCatalog.new('::tkmsgcat_demo') {
+ en "Application Error"
+ en "Blue"
+ en "Color"
+ en "Delete"
+ en "Error"
+ en "Green"
+ en "Red"
+ en "blue"
+ en "green"
+ en "red"
+}
+
+TkMsgCatalog.new('::tk') {
+ en "&Abort"
+ en "About..."
+ en "All Files"
+ en "Application Error"
+ en "&Blue"
+ en "&Cancel"
+ en "Cannot change to the directory \"%1\$s\".\nPermission denied."
+ en "Choose Directory"
+ en "Clear"
+ en "Color"
+ en "Console"
+ en "Copy"
+ en "Cut"
+ en "Delete"
+ en "Details >>"
+ en "Directory \"%1\$s\" does not exist."
+ en "&Directory:"
+ en "Error: %1\$s"
+ en "Exit"
+ en "File \"%1\$s\" already exists.\nDo you want to overwrite it?"
+ en "File \"%1\$s\" already exists.\n\n"
+ en "File \"%1\$s\" does not exist."
+ en "File &name:"
+ en "File &names:"
+ en "Files of &type:"
+ en "Fi&les:"
+ en "&Filter"
+ en "Fil&ter:"
+ en "&Green"
+ en "Hi"
+ en "Hide Console"
+ en "&Ignore"
+ en "Invalid file name \"%1\$s\"."
+ en "Log Files"
+ en "&No"
+ en "&OK"
+ en "Ok"
+ en "Open"
+ en "&Open"
+ en "Open Multiple Files"
+ en "Paste"
+ en "Quit"
+ en "&Red"
+ en "Replace existing file?"
+ en "&Retry"
+ en "&Save"
+ en "Save As"
+ en "Save To Log"
+ en "Select Log File"
+ en "Select a file to source"
+ en "&Selection:"
+ en "Skip Messages"
+ en "Source..."
+ en "Tcl Scripts"
+ en "Tcl for Windows"
+ en "Text Files"
+ en "&Yes"
+ en "abort"
+ en "blue"
+ en "cancel"
+ en "extension"
+ en "extensions"
+ en "green"
+ en "ignore"
+ en "ok"
+ en "red"
+ en "retry"
+ en "yes"
+}
diff --git a/ext/tk/sample/msgs_rb/en_gb.msg b/ext/tk/sample/msgs_rb/en_gb.msg
new file mode 100644
index 0000000000..97c58959b1
--- /dev/null
+++ b/ext/tk/sample/msgs_rb/en_gb.msg
@@ -0,0 +1,7 @@
+TkMsgCatalog.new('::tkmsgcat_demo') {
+ en_gb 'Color', 'Colour'
+}
+
+TkMsgCatalog.new('::tk') {
+ en_gb 'Color', 'Colour'
+}
diff --git a/ext/tk/sample/msgs_rb/eo.msg b/ext/tk/sample/msgs_rb/eo.msg
new file mode 100644
index 0000000000..1630df5e83
--- /dev/null
+++ b/ext/tk/sample/msgs_rb/eo.msg
@@ -0,0 +1,87 @@
+TkMsgCatalog.new('::tkmsgcat_demo') {
+ eo 'Application Error', 'Aplikoerraro'
+ eo 'Blue', 'Blua'
+ eo 'Color', 'Farbo'
+ eo 'Delete', 'Forprenu'
+ eo 'Error', 'Eraro'
+ eo 'Exit', 'Eliru'
+ eo 'Green', 'Verda'
+ eo 'Red', 'Rosa'
+ eo 'blue', 'blua'
+ eo 'green', 'verda'
+ eo 'red', 'ru\u011da'
+}
+
+TkMsgCatalog.new('::tk') {
+ eo '&Abort', '&\u0108esigo'
+ eo '&About...', 'Pri...'
+ eo 'All Files', '\u0108ioj dosieroj'
+ eo 'Application Error', 'Aplikoerraro'
+ eo '&Blue', '&Blua'
+ eo '&Cancel', '&Rezignu'
+ eo 'Cannot change to the directory "%1\$s".' "\n" 'Permission denied.', 'Neeble \u0109angi al dosierulon "%1\$s".' "\n" 'Vi ne rajtas tion.'
+ eo 'Choose Directory', 'Elektu Dosierujo'
+ eo '&Clear', '&Klaru'
+ eo '&Clear Console', '&Klaru konzolon'
+ eo 'Color', 'Farbo'
+ eo 'Console', 'Konzolo'
+ eo '&Copy', '&Kopiu'
+ eo 'Cu&t', '&Enpo\u015digu'
+ eo '&Delete', '&Forprenu'
+ eo 'Details >>', 'Detaloj >>'
+ eo 'Directory "%1\$s" does not exist.', 'La dosierujo "%1\$s" ne ekzistas.'
+ eo '&Directory:', '&Dosierujo:'
+ eo '&Edit', '&Redaktu'
+ eo 'Error: %1\$s', 'Eraro: %1\$s'
+ eo 'E&xit', '&Eliru'
+ eo '&File', '&Dosiero'
+ eo 'File "%1\$s" already exists.' "\n" 'Do you want to overwrite it?', 'La dosiero "%1\$s" jam ekzistas.' "\n" '\u0108u vi volas anstata\u00fbigi la dosieron?'
+ eo 'File "%1\$s" already exists.' "\n\n", 'La dosiero "%1\$s" jam egzistas.' "\n\n"
+ eo 'File "%1\$s" does not exist.', 'La dosierp "%1\$s" ne estas.'
+ eo 'File &name:', 'Dosiero&nomo:'
+ eo 'File &names:', 'Dosiero&nomoj:'
+ eo 'Files of &type:', 'Dosieroj de &Typo:'
+ eo 'Fi&les:', 'Do&sieroj:'
+ eo '&Filter', '&Filtrilo'
+ eo 'Fil&ter:', '&Filtrilo:'
+ eo '&Green', '&Verda'
+ eo '&Help', '&Helpu'
+ eo 'Hi', 'Saluton'
+ eo '&Hide Console', '&Ka\u015du konzolon'
+ eo '&Ignore', '&Ignoru'
+ eo 'Invalid file name "%1\$s".', 'Malvalida dosieronomo "%1\$s".'
+ eo 'Log Files', 'Protokolo'
+ eo '&No', '&Ne'
+ eo 'OK'
+ eo 'Ok'
+ eo 'Open', 'Malfermu'
+ eo '&Open', '&Malfermu'
+ eo 'Open Multiple Files', 'Melfermu multan dosierojn'
+ eo 'P&aste', '&Elpo\u015digi'
+ eo '&Quit', '&Finigu'
+ eo '&Red', '&Rosa'
+ eo 'Replace existing file?', '\u0108u anstata\u00fbu ekzistantan dosieron?'
+ eo '&Retry', '&Ripetu'
+ eo '&Save', '&Savu'
+ eo 'Save As', 'Savu kiel'
+ eo 'Save To Log', 'Savu en protokolon'
+ eo 'Select Log File', 'Elektu prokolodosieron'
+ eo 'Select a file to source', 'Elektu dosieron por interpreti'
+ eo '&Selection:', '&Elekto:'
+ eo 'Skip Messages', 'transsaltu pluajn mesa\u011dojn'
+ eo '&Source...', '&Fontoprogramo...'
+ eo 'Tcl Scripts', 'Tcl-skriptoj'
+ eo 'Tcl for Windows', 'Tcl por vindoso'
+ eo 'Text Files', 'Tekstodosierojn'
+ eo '&Yes', '&Jes'
+ eo 'abort', '\u0109esigo'
+ eo 'blue', 'blua'
+ eo 'cancel', 'rezignu'
+ eo 'extension', 'ekspansio'
+ eo 'extensions', 'ekspansioj'
+ eo 'green', 'verda'
+ eo 'ignore', 'ignorieren'
+ eo 'red', 'ru\u011da'
+ eo 'retry', 'ripetu'
+ eo 'yes', 'jes'
+}
diff --git a/ext/tk/sample/msgs_rb/es.msg b/ext/tk/sample/msgs_rb/es.msg
new file mode 100644
index 0000000000..460dbe848c
--- /dev/null
+++ b/ext/tk/sample/msgs_rb/es.msg
@@ -0,0 +1,84 @@
+TkMsgCatalog.new('::tkmsgcat_demo') {
+ es "Application Error", "Error de la aplicaci\\u00f3n"
+ es "Blue", "Azul"
+ es "Color", "Color"
+ es "Delete", "Borrar"
+ es "Error", "Error"
+ es "Exit", "Salir"
+ es "Green", "Verde"
+ es "Red", "Rojo"
+ es "blue", "azul"
+ es "green", "verde"
+ es "red", "rojo"
+}
+
+TkMsgCatalog.new('::tk') {
+ es "&Abort", "&Abortar"
+ es "About...", "Acerca de ..."
+ es "All Files", "Todos los archivos"
+ es "Application Error", "Error de la aplicaci\\u00f3n"
+ es "&Blue", "&Azul"
+ es "&Cancel", "&Cancelar"
+ es "Cannot change to the directory \"%1\$s\".\nPermission denied.", "No es posible acceder al directorio \"%1\$s\".\nPermiso denegado."
+ es "Choose Directory", "Elegir directorio"
+ es "Clear", "Borrar"
+ es "Color", "Color"
+ es "Console", "Consola"
+ es "Copy", "Copiar"
+ es "Cut", "Cortar"
+ es "Delete", "Borrar"
+ es "Details >>", "Detalles >>"
+ es "Directory \"%1\$s\" does not exist.", "El directorio \"%1\$s\" no existe."
+ es "&Directory:", "&Directorio:"
+ es "Error: %1\$s", "Error: %1\$s"
+ es "Exit", "Salir"
+ es "File \"%1\$s\" already exists.\nDo you want to overwrite it?", "El archivo \"%1\$s\" ya existe.\nDesea sobreescribirlo?"
+ es "File \"%1\$s\" already exists.\n\n", "El archivo \"%1\$s\" ya existe.\n\n"
+ es "File \"%1\$s\" does not exist.", "El archivo \"%1\$s\" no existe."
+ es "File &name:", "&Nombre de archivo:"
+ es "File &names:", "&Nombres de archivo:"
+ es "Files of &type:", "Archivos de &tipo:"
+ es "Fi&les:", "&Archivos:"
+ es "&Filter", "&Filtro"
+ es "Fil&ter:", "Fil&tro:"
+ es "&Green", "&Verde"
+ es "Hi", "Hola"
+ es "Hide Console", "Esconder la consola"
+ es "&Ignore", "&Ignorar"
+ es "Invalid file name \"%1\$s\".", "Nombre de archivo inv\\u00e1lido \"%1\$s\"."
+ es "Log Files", "Ficheros de traza"
+ es "&No", "&No"
+ es "&OK", "&OK"
+ es "Ok", "Ok"
+ es "Open", "Abrir"
+ es "&Open", "&Abrir"
+ es "Open Multiple Files", "Abrir m\\u00faltiples archivos"
+ es "Paste", "Pegar"
+ es "Quit", "Abandonar"
+ es "&Red", "&Rojo"
+ es "Replace existing file?", "Reemplazar el archivo existente?"
+ es "&Retry", "&Reintentar"
+ es "&Save", "&Salvar"
+ es "Save As", "Salvar como"
+ es "Save To Log", "Salvar al archivo de traza"
+ es "Select Log File", "Elegir un archivo de traza"
+ es "Select a file to source", "Seleccionar un archivo a evaluar"
+ es "&Selection:", "&Selecci\\u00f3n:"
+ es "Skip Messages", "Omitir los mensajes"
+ es "Source...", "Evaluar..."
+ es "Tcl Scripts", "Scripts Tcl"
+ es "Tcl for Windows", "Tcl para Windows"
+ es "Text Files", "Archivos de texto"
+ es "&Yes", "&S\\u00ed"
+ es "abort", "abortar"
+ es "blue", "azul"
+ es "cancel", "cancelar"
+ es "extension", "extensi\\u00f3n"
+ es "extensions", "extensiones"
+ es "green", "verde"
+ es "ignore", "ignorar"
+ es "ok", "ok"
+ es "red", "rojo"
+ es "retry", "reintentar"
+ es "yes", "s\\u00ed"
+}
diff --git a/ext/tk/sample/msgs_rb/fr.msg b/ext/tk/sample/msgs_rb/fr.msg
new file mode 100644
index 0000000000..ea85cf1a39
--- /dev/null
+++ b/ext/tk/sample/msgs_rb/fr.msg
@@ -0,0 +1,84 @@
+TkMsgCatalog.new('::tkmsgcat_demo') {
+ fr 'Application Error', "Erreur d'application"
+ fr 'Blue', 'Bleu'
+ fr 'Color', 'Couleur'
+ fr 'Delete', 'Effacer'
+ fr 'Error', 'Erreur'
+ fr 'Exit', 'Quitter'
+ fr 'Green', 'Vert'
+ fr 'Red', 'Rouge'
+ fr 'blue', 'bleu'
+ fr 'green', 'vert'
+ fr 'red', 'rouge'
+}
+
+TkMsgCatalog.new('::tk') {
+ fr '&Abort', '&Annuler'
+ fr 'About...', '\u00c0 propos...'
+ fr 'All Files', 'Tous les fichiers'
+ fr 'Application Error', "Erreur d'application"
+ fr '&Blue', '&Bleu'
+ fr '&Cancel', '&Annuler'
+ fr 'Cannot change to the directory "%1\$s".' "\n" 'Permission denied.', 'Impossible d\'acc\u00e9der au r\u00e9pertoire "%1\$s".' "\n" 'Permission refus\u00e9e.'
+ fr 'Choose Directory', 'Choisir r\u00e9pertoire'
+ fr 'Clear', 'Effacer'
+ fr 'Color', 'Couleur'
+ fr 'Console'
+ fr 'Copy', 'Copier'
+ fr 'Cut', 'Couper'
+ fr 'Delete', 'Effacer'
+ fr 'Details >>', 'D\u00e9tails >>'
+ fr 'Directory "%1\$s" does not exist.', 'Le r\u00e9pertoire "%1\$s" n\'existe pas.'
+ fr '&Directory:', '&R\u00e9pertoire:'
+ fr 'Error: %1\$s', 'Erreur: %1\$s'
+ fr 'Exit', 'Quitter'
+ fr 'File "%1\$s" already exists.' "\n" 'Do you want to overwrite it?', 'Le fichier "%1\$s" existe d\u00e9j\u00e0.' "\n" 'Voulez-vous l\'\u00e9craser?'
+ fr 'File "%1\$s" already exists.' "\n\n", 'Le fichier "%1\$s" existe d\u00e9j\u00e0.' "\n\n"
+ fr 'File "%1\$s" does not exist.', 'Le fichier "%1\$s" n\'existe pas.'
+ fr 'File &name:', '&Nom de fichier:'
+ fr 'File &names:', '&Noms de fichiers:'
+ fr 'Files of &type:', '&Type de fichiers:'
+ fr 'Fi&les:', 'Fich&iers:'
+ fr '&Filter', '&Filtre'
+ fr 'Fil&ter:', 'Fil&tre:'
+ fr '&Green', '&Vert'
+ fr 'Hi', 'Salut'
+ fr 'Hide Console', 'Cacher la Console'
+ fr '&Ignore', '&Ignorer'
+ fr 'Invalid file name "%1\$s".', 'Nom de fichier invalide "%1\$s".'
+ fr 'Log Files', 'Fichiers de trace'
+ fr '&No', '&Non'
+ fr '&OK'
+ fr 'Ok'
+ fr 'Open', 'Ouvrir'
+ fr '&Open', '&Ouvrir'
+ fr 'Open Multiple Files', 'Ouvrir plusieurs fichiers'
+ fr 'Paste', 'Coller'
+ fr 'Quit', 'Quitter'
+ fr '&Red', '&Rouge'
+ fr 'Replace existing file?', 'Remplacer le fichier existant?'
+ fr '&Retry', '&R\u00e9-essayer'
+ fr '&Save', '&Sauvegarder'
+ fr 'Save As', 'Sauvegarder sous'
+ fr 'Save To Log', 'Sauvegarde au fichier de trace'
+ fr 'Select Log File', 'Choisir un fichier de trace'
+ fr 'Select a file to source', 'Choisir un fichier \u00e0 \u00e9valuer'
+ fr '&Selection:', '&S\u00e9lection:'
+ fr 'Skip Messages', 'Omettre les messages'
+ fr 'Source...', '\u00c9valuer...'
+ fr 'Tcl Scripts', 'Scripts Tcl'
+ fr 'Tcl for Windows', 'Tcl pour Windows'
+ fr 'Text Files', 'Fichiers texte'
+ fr '&Yes', '&Oui'
+ fr 'abort', 'abandonner'
+ fr 'blue', 'bleu'
+ fr 'cancel', 'annuler'
+ fr 'extension'
+ fr 'extensions'
+ fr 'green', 'vert'
+ fr 'ignore', 'ignorer'
+ fr 'ok'
+ fr 'red', 'rouge'
+ fr 'retry', 'r\u00e9essayer'
+ fr 'yes', 'oui'
+}
diff --git a/ext/tk/sample/msgs_rb/it.msg b/ext/tk/sample/msgs_rb/it.msg
new file mode 100644
index 0000000000..a180bdbd99
--- /dev/null
+++ b/ext/tk/sample/msgs_rb/it.msg
@@ -0,0 +1,84 @@
+TkMsgCatalog.new('::tkmsgcat_demo') {
+ it "Application Error", "Errore dell' applicazione"
+ it "Blue", "Blu"
+ it "Color", "Colore"
+ it "Delete", "Incolla"
+ it "Error", "Errore"
+ it "Exit", "Esci"
+ it "Green", "Verde"
+ it "Red", "Rosso"
+ it "blue", "blu"
+ it "green", "verde"
+ it "red", "rosso"
+}
+
+TkMsgCatalog.new('::tk') {
+ it "&Abort", "&Interrompi"
+ it "About...", "Informazioni ..."
+ it "All Files", "Tutti i file"
+ it "Application Error", "Errore dell' applicazione"
+ it "&Blue", "&Blu"
+ it "&Cancel", "&Annulla"
+ it "Cannot change to the directory \"%1\$s\".\nPermission denied.", "Impossibile accedere alla directory \"%1\$s\".\nPermesso negato."
+ it "Choose Directory", "Scegli directory"
+ it "Clear", "Azzera"
+ it "Color", "Colore"
+ it "Console"
+ it "Copy", "Copia"
+ it "Cut", "Taglia"
+ it "Delete", "Incolla"
+ it "Details >>", "Dettagli >>"
+ it "Directory \"%1\$s\" does not exist.", "La directory \"%1\$s\" non esiste."
+ it "&Directory:"
+ it "Error: %1\$s", "Errore: %1\$s"
+ it "Exit", "Esci"
+ it "File \"%1\$s\" already exists.\nDo you want to overwrite it?", "Il file \"%1\$s\" esiste gi\\u00e0.\nVuoi sovrascriverlo?"
+ it "File \"%1\$s\" already exists.\n\n", "Il file \"%1\$s\" esiste gi\\u00e0.\n\n"
+ it "File \"%1\$s\" does not exist.", "Il file \"%1\$s\" non esiste."
+ it "File &name:", "&Nome del file:"
+ it "File &names:", "&Nomi dei file:"
+ it "Files of &type:", "File di &tipo:"
+ it "Fi&les:", "Fi&le:"
+ it "&Filter", "&Filtro"
+ it "Fil&ter:", "Fil&tro:"
+ it "&Green", "&Verde"
+ it "Hi", "Salve"
+ it "Hide Console", "Nascondi la console"
+ it "&Ignore", "&Ignora"
+ it "Invalid file name \"%1\$s\".", "Nome di file non valido \"%1\$s\"."
+ it "Log Files", "File di log"
+ it "&No"
+ it "&OK"
+ it "Ok"
+ it "&Open", "A&pri"
+ it "Open", "Apri"
+ it "Open Multiple Files", "Apri file multipli"
+ it "Paste", "Incolla"
+ it "Quit", "Esci"
+ it "&Red", "&Rosso"
+ it "Replace existing file?", "Sostituisci il file esistente?"
+ it "&Retry", "&Riprova"
+ it "&Save", "&Salva"
+ it "Save As", "Salva come"
+ it "Save To Log", "Salva il log"
+ it "Select Log File", "Scegli un file di log"
+ it "Select a file to source", "Scegli un file da eseguire"
+ it "&Selection:", "&Selezione:"
+ it "Skip Messages", "Salta i messaggi"
+ it "Source...", "Esegui..."
+ it "Tcl Scripts", "Scripts Tcl"
+ it "Tcl for Windows", "Tcl per Windows"
+ it "Text Files", "File di testo"
+ it "&Yes", "&Si"
+ it "abort", "interrompi"
+ it "blue", "blu"
+ it "cancel", "annulla"
+ it "extension", "estensione"
+ it "extensions", "estensioni"
+ it "green", "verde"
+ it "ignore", "ignora"
+ it "ok"
+ it "red", "rosso"
+ it "retry", "riprova"
+ it "yes", "si"
+}
diff --git a/ext/tk/sample/msgs_rb/ja.msg b/ext/tk/sample/msgs_rb/ja.msg
new file mode 100644
index 0000000000..40587c1f1d
--- /dev/null
+++ b/ext/tk/sample/msgs_rb/ja.msg
@@ -0,0 +1,13 @@
+TkMsgCatalog.new('::tkmsgcat_demo') {
+ ja 'Application Error', '\u30A2\u30D7\u30EA\u30B1\u30FC\u30B7\u30E7\u30F3\u30A8\u30E9\u30FC'
+ ja 'Blue', '\u9752'
+ ja 'Color', '\u80CC\u666F\u8272'
+ ja 'Delete', '\u6D88\u53BB'
+ ja 'Error', '\u30A8\u30E9\u30FC'
+ ja 'Exit', '\u7D42\u4E86'
+ ja 'Green', '\u7DD1'
+ ja 'Red', '\u8D64'
+ ja 'blue', '\u9752'
+ ja 'green', '\u7DD1'
+ ja 'red', '\u8D64'
+}
diff --git a/ext/tk/sample/msgs_rb/nl.msg b/ext/tk/sample/msgs_rb/nl.msg
new file mode 100644
index 0000000000..24e41dae86
--- /dev/null
+++ b/ext/tk/sample/msgs_rb/nl.msg
@@ -0,0 +1,123 @@
+TkMsgCatalog.new('::tkmsgcat_demo') {
+ nl "Application Error", "Toepassingsfout"
+ nl "Blue", "Blauw"
+ nl "Color", "Kleur"
+ nl "Delete", "Wissen"
+ nl "Error", "Fout"
+ nl "Exit", "Be\\u00ebindigen"
+ nl "Green", "Groen"
+ nl "Red", "Rood"
+ nl "blue", "blauw"
+ nl "green", "groen"
+ nl "red", "rood"
+}
+
+TkMsgCatalog.new('::tk') {
+ nl "\"%1\$s\" must be an absolute pathname", "\"%1\$s\" moet een absolute pad-naam zijn"
+ nl "%1\$s is not a toplevel window", "%1\$s is geen toplevel window"
+ nl ", or", ", of"
+ nl "-default, -icon, -message, -parent, -title, or -type", "-default, -icon, -message, -parent, -title, of -type"
+ nl "-initialdir, -mustexist, -parent, or -title", "-initialdir, -mustexist, -parent, of -title"
+ nl "&Abort", "&Afbreken"
+ nl "About...", "Over..."
+ nl "All Files", "Alle Bestanden"
+ nl "Application Error", "Toepassingsfout"
+ nl "&Blue", "&Blauw"
+ nl "&Cancel", "&Annuleren"
+ nl "Cannot change to the directory \"%1\$s\".\nPermission denied.", "Kan niet naar map \"%1\$s\" gaan.\nU heeft hiervoor geen toestemming."
+ nl "Choose Directory", "Kies map"
+ nl "Clear", "Wissen"
+ nl "Clear entry, Press OK; Enter %1\$s, press OK", "Wis veld, Druk op OK; typ %1\$s in, druk op OK"
+ nl "&Clear Console", "&Wis Console"
+ nl "Color", "Kleur"
+ nl "Console"
+ nl "Copy", "Kopi\\u00ebren"
+ nl "Cut", "Knippen"
+ nl "Delete", "Wissen"
+ nl "Details"
+ nl "Details >>"
+ nl "Directory \"%1\$s\" does not exist.", "Map \"%1\$s\" bestaat niet."
+ nl "&Directory:", "&Map:"
+ nl "Edit", "Bewerken"
+ nl "Enter \"%1\$s\", press OK", "Typ \"%1\$s\", druk op OK"
+ nl "Enter \"%1\$s\", press OK, enter \"%2\$s\", press OK", "Typ \"%1\$s\", druk op OK, typ \"%2\$s\", druk op OK"
+ nl "Error: %1\$s", "Fout: %1\$s"
+ nl "Exit", "Be\\u00ebindigen"
+ nl "File", "Bestand"
+ nl "File \"%1\$s\" already exists.\n\n", "Bestand \"%1\$s\" bestaat al.\n\n"
+ nl "File \"%1\$s\" already exists.\nDo you want to overwrite it?", "Bestand \"%1\$s\" bestaat al.\nWilt u het overschrijven?"
+ nl "File \"%1\$s\" does not exist.", "Bestand \"%1\$s\" bestaat niet."
+ nl "File &name:", "Bestands&naam:"
+ nl "File &names:", "Bestands&namen:"
+ nl "Files of &type:", "Bestanden van het &type:"
+ nl "Fi&les:", "&Bestanden:"
+ nl "&Filter"
+ nl "Fil&ter:"
+ nl "&Green", "&Groen"
+ nl "Hi", "H\\u00e9"
+ nl "Hide Console", "Verberg Console"
+ nl "&Ignore", "&Negeren"
+ nl "Invalid file name \"%1\$s\".", "Ongeldige bestandsnaam \"%1\$s\"."
+ nl "Log Files", "Log Bestanden"
+ nl "&No", "&Nee"
+ nl "&OK"
+ nl "Ok"
+ nl "&Open", "&Openen"
+ nl "Open", "Openen"
+ nl "Open Multiple Files", "Open meerdere bestanden"
+ nl "Paste", "Plakken"
+ nl "Please press %1\$s", "Druk op %1\$s, A.U.B."
+ nl "Please press ok", "Druk op ok, A.U.B."
+ nl "Press Cancel", "Druk op Annuleren"
+ nl "Press Ok", "Druk op Ok"
+ nl "Quit", "Stoppen"
+ nl "&Red", "&Rood"
+ nl "Replace existing file?", "Vervang bestaand bestand?"
+ nl "&Retry", "&Herhalen"
+ nl "&Save", "Op&slaan"
+ nl "Save As", "Opslaan als"
+ nl "Save To Log", "Opslaan naar Log"
+ nl "Select Log File", "Selecteer Log bestand"
+ nl "Select a file to source", "Selecteer bronbestand"
+ nl "&Selection:", "&Selectie:"
+ nl "Skip Messages", "Berichten overslaan"
+ nl "Source...", "Bron..."
+ nl "Tcl Scripts"
+ nl "Tcl for Windows", "Tcl voor Windows"
+ nl "Text Files", "Tekstbestanden"
+ nl "&Yes", "&Ja"
+ nl "abort", "afbreken"
+ nl "abort, retry, ignore, ok, cancel, no, or yes", "afbreken, opnieuw, negeren, ok, annuleren, nee, of ja"
+ nl "abortretryignore, ok, okcancel, retrycancel, yesno, or yesnocancel", "abortretryignore, ok, okcancel, retrycancel, yesno, of yesnocancel"
+ nl "bad %1\$s value \"%2\$s\": must be %3\$s", "verkeerde %1\$s waarde \"%2\$s\": moet zijn %3\$s"
+ nl "bad file type \"%1\$s\", should be", "verkeerd bestandstype \"%1\$s\", moet zijn"
+ nl "bad option \"%1\$s\": should be %2\$s", "verkeerde optie \"%1\$s\": moet zijn %2\$s"
+ nl "bad window path name \"%1\$s\"", "verkeerde window-padnaam \"%1\$s\""
+ nl "blue", "blauw"
+ nl "can't post %1\$s: it isn't a descendant of %2\$s (this is a new requirement in Tk versions 3.0 and later)", "kan %1\$s niet verzenden: het is geen afstammeling van %2\$s (dit is een nieuwe eis in Tk versies 3.0 en later)"
+ nl "cancel", "annuleren"
+ nl "default button index greater than number of buttons specified for tk_dialog", "default knop index is groter dan het aantal knoppen beschikbaar voor tk_dialog"
+ nl "display name to use (current one otherwise)", "te gebruiken schermnaam (anders huidige scherm)"
+ nl "error, info, question, or warning", "error, info, question, of warning"
+ nl "extension"
+ nl "extensions"
+ nl "focus group \"%1\$s\" doesn't exist", "focusgroep \"%1\$s\" bestaat niet"
+ nl "green", "groen"
+ nl "history event %1\$s"
+ nl "ignore", "negeren"
+ nl "invalid default button \"%1\$s\"", "ongeldige default knop \"%1\$s\""
+ nl "macType"
+ nl "macTypes"
+ nl "must specify a background color", "een achtergrondkleur is verplicht"
+ nl "name of the slave interpreter", "naam van de slaaf-interpreter"
+ nl "no winfo screen . nor env(DISPLAY)", "geen winfo scherm . noch env(DISPLAY)"
+ nl "ok"
+ nl "red", "rood"
+ nl "retry", "opnieuw"
+ nl "should contain 5 or 4 elements", "moet 4 of 5 elementen bevatten"
+ nl "spec"
+ nl "tk_chooseDirectory command", "tk_chooseDirectory opdracht"
+ nl "tk_chooseDirectory command, cancel gives null", "tk_chooseDirectory opdracht, annuleren geeft lege waarde"
+ nl "tk_chooseDirectory command, initialdir", "tk_chooseDirectory opdracht, initi\\u00eble map"
+ nl "yes", "ja"
+}
diff --git a/ext/tk/sample/msgs_rb/pl.msg b/ext/tk/sample/msgs_rb/pl.msg
new file mode 100644
index 0000000000..0b3b4445c2
--- /dev/null
+++ b/ext/tk/sample/msgs_rb/pl.msg
@@ -0,0 +1,87 @@
+TkMsgCatalog.new('::tkmsgcat_demo') {
+ pl 'Application Error', 'Bl\u0105d w Programie'
+ pl 'Blue', 'Niebieski'
+ pl 'Color', 'Kolor'
+ pl 'Delete', 'Usu\u0144'
+ pl 'Error', 'B\u0142\u0105d'
+ pl 'Exit', 'Zako\u0144cz'
+ pl 'Green', 'Zielony'
+ pl 'Red', 'Czerwonz'
+ pl 'blue', 'niebieski'
+ pl 'green', 'zielony'
+ pl 'red', 'czerwony'
+}
+
+TkMsgCatalog.new('::tk') {
+ pl '&Abort', '&Anuluj'
+ pl '&About...', 'O Programie...'
+ pl 'All Files', 'Wszystkie pliki'
+ pl 'Application Error', 'Bl\u0105d w Programie'
+ pl '&Blue', '&Niebieski'
+ pl '&Cancel', '&Anuluj'
+ pl 'Cannot change to the directory "%1\$s".' "\n" 'Permission denied.', 'Katalog "%1\$s" nie mo\u017ce zosta\u0107 odczytany lub nie istnieje.'
+ pl 'Choose Directory', 'Wybierz katalog'
+ pl '&Clear', '&Wyczy\u015b\u0107'
+ pl '&Clear Console', '&Wyczy\u015b\u0107 konsol\u0119'
+ pl 'Color', 'Kolor'
+ pl 'Console', 'Konsola'
+ pl '&Copy', '&Kopiuj'
+ pl 'Cu&t', '&Wytnij'
+ pl '&Delete', '&Usu\u0144'
+ pl 'Details >>', 'Detale >>'
+ pl 'Directory "%1\$s" does not exist.', 'Katalog "%1\$s" nie istniej.'
+ pl '&Directory:', '&Katalog:'
+ pl '&Edit', '&Edytuj'
+ pl 'Error: %1\$s', 'B\u0142\u0105d: %1\$s'
+ pl 'E&xit', '&Zako\u0144cz'
+ pl '&File', '&Plik'
+ pl 'File "%1\$s" already exists.' "\n" 'Do you want to overwrite it?', 'Plik "%1\$s" ju\u017c istnieje.' "\n" 'Czy chcesz go zast\u0105pi\u0107?'
+ pl 'File "%1\$s" already exists.' "\n\n", 'Plik "%1\$s" ju\u017c istnieje. ' "\n\n"
+ pl 'File "%1\$s" does not exist.', 'Plik "%1\$s" nie istnieje.'
+ pl 'File &name:', 'Nazwa &pliku:'
+ pl 'File &names:', 'Nazwy &plik\u00f3w:'
+ pl 'Files of &type:', 'Pliki &typu:'
+ pl 'Fi&les:', 'Pli&ki:'
+ pl '&Filter', '&Filter'
+ pl 'Fil&ter:', '&Filter:'
+ pl '&Green', '&Zielony'
+ pl '&Help', '&Pomoc'
+ pl 'Hi', 'Witaj'
+ pl '&Hide Console', '&Schowaj konsol\u0119'
+ pl '&Ignore', '&Ignoruj'
+ pl 'Invalid file name "%1\$s".', 'Niew\u0142a\u015bciwa nazwa pliku "%1\$s".'
+ pl 'Log Files', 'Protoko\u0142uj'
+ pl '&No', '&Nie'
+ pl 'OK'
+ pl 'Ok'
+ pl 'Open', 'Wczytaj'
+ pl '&Open', '&Wczytaj'
+ pl 'Open Multiple Files', 'Wczytuj wiele plik\u00f3w'
+ pl 'P&aste', '&Wklej'
+ pl '&Quit', '&Zako\u0144cz'
+ pl '&Red', '&Czerwonz'
+ pl 'Replace existing file?', 'Czy zost\u0105pi\u0107 instniej\u0105cy plik?'
+ pl '&Retry', '&Powt\u00f3rz'
+ pl '&Save', '&Zapisz'
+ pl 'Save As', 'Zapisz jako'
+ pl 'Save To Log', 'Wpisz do protoko\u0142u'
+ pl 'Select Log File', 'Wybierz plik proko\u0142u'
+ pl 'Select a file to source', 'Wybierz plik do wykonania'
+ pl '&Selection:', '&Wyb\u00f3r:'
+ pl 'Skip Messages', 'Omi\u0144 pozosta\u0142e komunikaty'
+ pl '&Source...', '&Kod \u017ar\u00f3d\u0142owy...'
+ pl 'Tcl Scripts', 'Tcl-skrypty'
+ pl 'Tcl for Windows', 'Tcl dla Okienek (Windows)'
+ pl 'Text Files', 'Pliki Tekstowe'
+ pl '&Yes', '&Tak'
+ pl 'abort', 'zako\u0144cz'
+ pl 'blue', 'niebieski'
+ pl 'cancel', 'anuluj'
+ pl 'extension', 'rozszerzenie'
+ pl 'extensions', 'rozszerzenia'
+ pl 'green', 'zielony'
+ pl 'ignore', 'ignoruj'
+ pl 'red', 'czerwony'
+ pl 'retry', 'potw\u00f3rz'
+ pl 'yes', 'tak'
+}
diff --git a/ext/tk/sample/msgs_rb/ru.msg b/ext/tk/sample/msgs_rb/ru.msg
new file mode 100644
index 0000000000..d6739ceb56
--- /dev/null
+++ b/ext/tk/sample/msgs_rb/ru.msg
@@ -0,0 +1,87 @@
+TkMsgCatalog.new('::tkmsgcat_demo') {
+ ru 'Application Error', '\u041e\u0448\u0438\u0431\u043a\u0430 \u0432 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0435'
+ ru 'Blue', ' \u0413\u043e\u043b\u0443\u0431\u043e\u0439'
+ ru 'Color', '\u0426\u0432\u0435\u0442'
+ ru 'Delete', '\u0423\u0434\u0430\u043b\u0438\u0442\u044c'
+ ru 'Error', '\u041e\u0448\u0438\u0431\u043a\u0430'
+ ru 'Exit', '\u0412\u044b\u0445\u043e\u0434'
+ ru 'Green', '\u0417\u0435\u043b\u0435\u043d\u044b\u0439'
+ ru 'Red', '\u041a\u0440\u0430\u0441\u043d\u044b\u0439'
+ ru 'blue', ' \u0433\u043e\u043b\u0443\u0431\u043e\u0439'
+ ru 'green', ' \u0437\u0435\u043b\u0435\u043d\u044b\u0439'
+ ru 'red', ' \u043a\u0440\u0430\u0441\u043d\u044b\u0439'
+}
+
+TkMsgCatalog.new('::tk') {
+ ru '&Abort', '&\u041e\u0442\u043c\u0435\u043d\u0438\u0442\u044c'
+ ru 'About...', '\u041f\u0440\u043e...'
+ ru 'All Files', '\u0412\u0441\u0435 \u0444\u0430\u0439\u043b\u044b'
+ ru 'Application Error', '\u041e\u0448\u0438\u0431\u043a\u0430 \u0432 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0435'
+ ru '&Blue', ' &\u0413\u043e\u043b\u0443\u0431\u043e\u0439'
+ ru '&Cancel', '\u041e\u0442&\u043c\u0435\u043d\u0430'
+ ru 'Cannot change to the directory "%1\$s".' "\n" 'Permission denied.' \
+ '\u041d\u0435 \u043c\u043e\u0433\u0443 \u043f\u0435\u0440\u0435\u0439\u0442\u0438 \u0432 \u043a\u0430\u0442\u0430\u043b\u043e\u0433 "%1\$s".' "\n" '\u041d\u0435\u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u043f\u0440\u0430\u0432 \u0434\u043e\u0441\u0442\u0443\u043f\u0430'
+ ru 'Choose Directory', '\u0412\u044b\u0431\u0435\u0440\u0438\u0442\u0435 \u043a\u0430\u0442\u0430\u043b\u043e\u0433'
+ ru 'Clear', '\u041e\u0447\u0438\u0441\u0442\u0438\u0442\u044c'
+ ru 'Color', '\u0426\u0432\u0435\u0442'
+ ru 'Console', '\u041a\u043e\u043d\u0441\u043e\u043b\u044c'
+ ru 'Copy', '\u041a\u043e\u043f\u0438\u0440\u043e\u0432\u0430\u0442\u044c'
+ ru 'Cut', '\u0412\u044b\u0440\u0435\u0437\u0430\u0442\u044c'
+ ru 'Delete', '\u0423\u0434\u0430\u043b\u0438\u0442\u044c'
+ ru 'Details >>', '\u041f\u043e\u0434\u0440\u043e\u0431\u043d\u0435\u0435 >>'
+ ru 'Directory "%1\$s" does not exist.', '\u041a\u0430\u0442\u0430\u043b\u043e\u0433\u0430 "%1\$s" \u043d\u0435 \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u0435\u0442.'
+ ru '&Directory:', '&\u041a\u0430\u0442\u0430\u043b\u043e\u0433:'
+ ru 'Error: %1\$s', '\u041e\u0448\u0438\u0431\u043a\u0430: %1\$s'
+ ru 'Exit', '\u0412\u044b\u0445\u043e\u0434'
+ ru 'File "%1\$s" already exists.' "\n" 'Do you want to overwrite it?' \
+ '\u0424\u0430\u0439\u043b "%1\$s" \u0443\u0436\u0435 \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u0435\u0442.' "\n" '\u0417\u0430\u043c\u0435\u043d\u0438\u0442\u044c \u0435\u0433\u043e?'
+ ru 'File "%1\$s" already exists.' "\n\n", '\u0424\u0430\u0439\u043b "%1\$s" \u0443\u0436\u0435 \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u0435\u0442.' "\n\n"
+ ru 'File "%1\$s" does not exist.', '\u0424\u0430\u0439\u043b "%1\$s" \u043d\u0435 \u043d\u0430\u0439\u0434\u0435\u043d.'
+ ru 'File &name:', '&\u0418\u043c\u044f \u0444\u0430\u0439\u043b\u0430:'
+ ru 'File &names:', '&\u0418\u043c\u0435\u043d\u0430 \u0444\u0430\u0439\u043b\u043e\u0432:'
+ ru 'Files of &type:', '&\u0422\u0438\u043f \u0444\u0430\u0439\u043b\u043e\u0432:'
+ ru 'Fi&les:', '\u0424\u0430\u0439&\u043b\u044b:'
+ ru '&Filter', '&\u0424\u0438\u043b\u044c\u0442\u0440'
+ ru 'Fil&ter:', '\u0424\u0438\u043b\u044c&\u0442\u0440:'
+ ru '&Green', ' &\u0417\u0435\u043b\u0435\u043d\u044b\u0439'
+ ru 'Hi', '\u041f\u0440\u0438\u0432\u0435\u0442'
+ ru 'Hide Console', '\u0421\u043f\u0440\u044f\u0442\u0430\u0442\u044c \u043a\u043e\u043d\u0441\u043e\u043b\u044c'
+ ru '&Ignore', '&\u0418\u0433\u043d\u043e\u0440\u0438\u0440\u043e\u0432\u0430\u0442\u044c'
+ ru 'Invalid file name "%1\$s".', '\u041d\u0435\u0432\u0435\u0440\u043d\u043e\u0435 \u0438\u043c\u044f \u0444\u0430\u0439\u043b\u0430 "%1\$s".'
+ ru 'Log Files', '\u0424\u0430\u0439\u043b\u044b \u0436\u0443\u0440\u043d\u0430\u043b\u0430'
+ ru '&No', '&\u041d\u0435\u0442'
+ ru '&OK', '&\u041e\u041a'
+ ru 'Ok', '\u0414\u0430'
+ ru 'Open', '\u041e\u0442\u043a\u0440\u044b\u0442\u044c'
+ ru '&Open', '&\u041e\u0442\u043a\u0440\u044b\u0442\u044c'
+ ru 'Open Multiple Files', '\u041e\u0442\u043a\u0440\u044b\u0442\u044c \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0444\u0430\u0439\u043b\u043e\u0432'
+ ru 'Paste', '\u0412\u0441\u0442\u0430\u0432\u0438\u0442\u044c'
+ ru 'Quit', '\u0412\u044b\u0445\u043e\u0434'
+ ru '&Red', ' &\u041a\u0440\u0430\u0441\u043d\u044b\u0439'
+ ru 'Replace existing file?', '\u0417\u0430\u043c\u0435\u043d\u0438\u0442\u044c \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u044e\u0449\u0438\u0439 \u0444\u0430\u0439\u043b?'
+ ru '&Retry', '&\u041f\u043e\u0432\u0442\u043e\u0440\u0438\u0442\u044c'
+ ru '&Save', '&\u0421\u043e\u0445\u0440\u0430\u043d\u0438\u0442\u044c'
+ ru 'Save As', '\u0421\u043e\u0445\u0440\u0430\u043d\u0438\u0442\u044c \u043a\u0430\u043a'
+ ru 'Save To Log', '\u0421\u043e\u0445\u0440\u0430\u043d\u0438\u0442\u044c \u0432 \u0436\u0443\u0440\u043d\u0430\u043b'
+ ru 'Select Log File', '\u0412\u044b\u0431\u0440\u0430\u0442\u044c \u0436\u0443\u0440\u043d\u0430\u043b'
+ ru 'Select a file to source', '\u0412\u044b\u0431\u0435\u0440\u0438\u0442\u0435 \u0444\u0430\u0439\u043b \u0434\u043b\u044f \u0438\u043d\u0442\u0435\u0440\u043f\u0440\u0435\u0442\u0430\u0446\u0438\u0438'
+ ru '&Selection:', '&Selection:'
+ ru 'Skip Messages', '\u041f\u0440\u043e\u043f\u0443\u0441\u0442\u0438\u0442\u044c \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u044f'
+ ru 'Source...', '\u0418\u043d\u0442\u0435\u0440\u043f\u0440\u0435\u0442\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0444\u0430\u0439\u043b...'
+ ru 'Tcl Scripts', '\u041f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0430 \u043d\u0430 \u044f\u0437\u044b\u043a\u0435 TCL'
+ ru 'Tcl for Windows', 'TCL \u0434\u043b\u044f Windows'
+ ru 'Text Files', '\u0422\u0435\u043a\u0441\u0442\u043e\u0432\u044b\u0435 \u0444\u0430\u0439\u043b\u044b'
+ ru '&Yes', '&\u0414\u0430'
+ ru 'abort', '\u043e\u0442\u043c\u0435\u043d\u0430'
+ ru 'blue', ' \u0433\u043e\u043b\u0443\u0431\u043e\u0439'
+ ru 'cancel', '\u043e\u0442\u043c\u0435\u043d\u0430'
+ ru 'extension', '\u0440\u0430\u0441\u0448\u0438\u0440\u0435\u043d\u0438\u0435'
+ ru 'extensions', '\u0440\u0430\u0441\u0448\u0438\u0440\u0435\u043d\u0438\u044f'
+ ru 'green', ' \u0437\u0435\u043b\u0435\u043d\u044b\u0439'
+ ru 'ignore', '\u043f\u0440\u043e\u043f\u0443\u0441\u0442\u0438\u0442\u044c'
+ ru 'ok', '\u043e\u043a'
+ ru 'red', ' \u043a\u0440\u0430\u0441\u043d\u044b\u0439'
+ ru 'retry', '\u043f\u043e\u0432\u0442\u043e\u0440\u0438\u0442\u044c'
+ ru 'yes', '\u0434\u0430'
+}
+
diff --git a/ext/tk/sample/msgs_rb2/README b/ext/tk/sample/msgs_rb2/README
new file mode 100644
index 0000000000..b8aa114e1b
--- /dev/null
+++ b/ext/tk/sample/msgs_rb2/README
@@ -0,0 +1,5 @@
+Message catalogs in this directory are written in encodings except
+UTF-8. As if you have a trouble to edit UTF-8 text, you can write
+message catalogs in your familier encoding.
+
+Please see '../msgs_rb/README' too.
diff --git a/ext/tk/sample/msgs_rb2/de.msg b/ext/tk/sample/msgs_rb2/de.msg
new file mode 100644
index 0000000000..0d6c82d9e5
--- /dev/null
+++ b/ext/tk/sample/msgs_rb2/de.msg
@@ -0,0 +1,88 @@
+TkMsgCatalog.new('::tkmsgcat_demo') {
+ de 'Application Error', 'Applikationsfehler'
+ de 'Blue', 'Blau'
+ de 'Color', 'Farbe'
+ de 'Delete', 'Löschen', 'iso8859-1'
+ de 'Error', 'Fehler'
+ de 'Exit', 'Ende'
+ de 'Green', 'Grün', 'iso8859-1'
+ de 'Red', 'Rot'
+ de 'blue', 'blau'
+ de 'green', 'grün', 'iso8859-1'
+ de 'red', 'rot'
+}
+
+TkMsgCatalog.new('::tk') {
+ de "&Abort", "&Abbruch"
+ de "&About...", "&Über...", 'iso8859-1'
+ de "All Files", "Alle Dateien"
+ de "Application Error", "Applikationsfehler"
+ de "&Blue", "&Blau"
+ de "&Cancel", "&Abbruch"
+ de "Cannot change to the directory \"%1\$s\".\nPermission denied.", "Kann nicht in das Verzeichnis \"%1\$s\" wechseln.\nKeine Rechte vorhanden."
+ de "Choose Directory", "Wähle Verzeichnis", 'iso8859-1'
+ de "&Clear", "&Rücksetzen", 'iso8859-1'
+ de "&Clear Console", "&Konsole löschen", 'iso8859-1'
+ de "Color", "Farbe"
+ de "Console", "Konsole"
+ de "&Copy", "&Kopieren"
+ de "Cu&t", "Aus&schneiden"
+ de '&Delete', '&Löschen', 'iso8859-1'
+ de "Details >>"
+ de "Directory \"%1\$s\" does not exist.", "Das Verzeichnis \"%1\$s\" existiert nicht."
+ de "&Directory:", "&Verzeichnis:"
+ de "&Edit", "&Bearbieten"
+ de "Error: %1\$s", "Fehler: %1\$s"
+ de "E&xit", "&Ende"
+ de "&File", "&Datei"
+ de "File \"%1\$s\" already exists.\nDo you want to overwrite it?", "Die Datei \"%1\$s\" ist bereits vorhanden.\nWollen sie diese Datei überschreiben ?", 'iso8859-1'
+ de "File \"%1\$s\" already exists.\n\n", "Die Datei \"%1\$s\" ist bereits vorhanden.\n\n"
+ de "File \"%1\$s\" does not exist.", "Die Datei \"%1\$s\" existiert nicht."
+ de "File &name:", "Datei&name:"
+ de "File &names:", "Datei&namen:"
+ de "Files of &type:", "Dateien des &Typs:"
+ de "Fi&les:", "Dat&eien:"
+ de "&Filter"
+ de "Fil&ter:"
+ de '&Green', '&Grün', 'iso8859-1'
+ de "&Help", "&Hilfe"
+ de "Hi", "Hallo"
+ de "&Hide Console", "&Konsole unsichtbar machen"
+ de "&Ignore", "&Ignorieren"
+ de "Invalid file name \"%1\$s\".", "Ungültiger Dateiname \"%1\$s\".", 'iso8859-1'
+ de "Log Files", "Protokolldatei"
+ de "&No", "&Nein"
+ de "OK"
+ de "Ok"
+ de "Open", "Öffnen", 'iso8859-1'
+ de "&Open", "Ö&ffnen", 'iso8859-1'
+ de "Open Multiple Files"
+ de "P&aste", "E&infügen", 'iso8859-1'
+ de "&Quit", "&Beenden"
+ de "&Red", "&Rot"
+ de "Replace existing file?", "Existierende Datei ersetzen?"
+ de "&Retry", "&Wiederholen"
+ de "&Save", "&Speichern"
+ de "Save As", "Speichern unter"
+ de "Save To Log", "In Protokoll speichern"
+ de "Select Log File", "Protokolldatei auswählen", 'iso8859-1'
+ de "Select a file to source", "Auszuführende Datei auswählen", 'iso8859-1'
+ de "&Selection:", "Auswah&l:"
+ de "Skip Messages", "Weitere Nachrichten überspringen", 'iso8859-1'
+ de "&Source...", "&Ausführen...", 'iso8859-1'
+ de "Tcl Scripts", "Tcl-Skripte"
+ de "Tcl for Windows", "Tcl für Windows", 'iso8859-1'
+ de "Text Files", "Textdateien"
+ de "&Yes", "&Ja"
+ de "abort", "abbrechen"
+ de "blue", "blau"
+ de "cancel", "abbrechen"
+ de "extension", "Erweiterung"
+ de "extensions", "Erweiterungen"
+ de 'green', 'grün', 'iso8859-1'
+ de "ignore", "ignorieren"
+ de "ok"
+ de "red", "rot"
+ de "retry", "wiederholen"
+ de "yes", "ja"
+}
diff --git a/ext/tk/sample/msgs_rb2/ja.msg b/ext/tk/sample/msgs_rb2/ja.msg
new file mode 100644
index 0000000000..84e89aa6ef
--- /dev/null
+++ b/ext/tk/sample/msgs_rb2/ja.msg
@@ -0,0 +1,85 @@
+TkMsgCatalog.new('::tkmsgcat_demo') {
+ ja 'Application Error', '¥¢¥×¥ê¥±¡¼¥·¥ç¥ó¥¨¥é¡¼', 'euc-jp'
+ ja 'Blue', 'ÀÄ', 'euc-jp'
+ ja 'Color', '¿§ÁªÂò', 'euc-jp'
+ ja 'Delete', '¾Ãµî', 'euc-jp'
+ ja 'Error', '¥¨¥é¡¼', 'euc-jp'
+ ja 'Exit', '½ªÎ»', 'euc-jp'
+ ja 'Green', 'ÎÐ', 'euc-jp'
+ ja 'Red', 'ÀÖ', 'euc-jp'
+ ja 'blue', 'ÀÄ', 'euc-jp'
+ ja 'green', 'ÎÐ', 'euc-jp'
+ ja 'red', 'ÀÖ', 'euc-jp'
+}
+
+TkMsgCatalog.new('::tk') {
+ ja "&Abort", '̾ȧ', 'euc-jp'
+ ja "About..."
+ ja "All Files", '¤¹¤Ù¤Æ¤Î¥Õ¥¡¥¤¥ë', 'euc-jp'
+ ja "Application Error", '¥¢¥×¥ê¥±¡¼¥·¥ç¥ó¥¨¥é¡¼', 'euc-jp'
+ ja "&Blue", 'ÀÄ', 'euc-jp'
+ ja "&Cancel", '¼è¤ê¾Ã¤·', 'euc-jp'
+ ja "Cannot change to the directory \"%1\$s\".\nPermission denied.", "¥Ç¥£¥ì¥¯¥È¥ê \"%1\$s\" ¤ËÊѹ¹¤Ç¤­¤Þ¤»¤ó¡¥\nµö²Ä¤¬¤¢¤ê¤Þ¤»¤ó¡¥", 'euc-jp'
+ ja "Choose Directory", '¥Ç¥£¥ì¥¯¥È¥ê¤òÁªÂò', 'euc-jp'
+ ja "Clear", '¾Ãµî', 'euc-jp'
+ ja "Color", '¿§', 'euc-jp'
+ ja "Console", '¥³¥ó¥½¡¼¥ë', 'euc-jp'
+ ja "Copy", '¥³¥Ô¡¼', 'euc-jp'
+ ja "Cut", 'ÀÚ¤ê¼è¤ê', 'euc-jp'
+ ja "Delete", '¾Ãµî', 'euc-jp'
+ ja "Details >>", '¾ÜºÙ >>', 'euc-jp'
+ ja "Directory \"%1\$s\" does not exist.", '"%1$s" ¤È¤¤¤¦¥Ç¥£¥ì¥¯¥È¥ê¤Ï¸ºß¤·¤Þ¤»¤ó¡¥', 'euc-jp'
+ ja "&Directory:", '¥Ç¥£¥ì¥¯¥È¥ê', 'euc-jp'
+ ja "Error: %1\$s"
+ ja "Exit", '½ªÎ»', 'euc-jp'
+ ja "File \"%1\$s\" already exists.\nDo you want to overwrite it?", "\"%1\$s\" ¤È¤¤¤¦¥Õ¥¡¥¤¥ë¤Ï´û¤Ë¸ºß¤·¤Æ¤¤¤Þ¤¹¡¥\n½ñ¤­´¹¤¨¤Þ¤¹¤«¡©", 'euc-jp'
+ ja "File \"%1\$s\" already exists.\n\n", "\"%1\$s\" ¤È¤¤¤¦¥Õ¥¡¥¤¥ë¤Ï´û¤Ë¸ºß¤·¤Æ¤¤¤Þ¤¹¡¥\n\n", 'euc-jp'
+ ja "File \"%1\$s\" does not exist.", '"%1$s" ¤È¤¤¤¦¥Õ¥¡¥¤¥ë¤Ï¸ºß¤·¤Þ¤»¤ó¡¥', 'euc-jp'
+ ja "File &name:", '¥Õ¥¡¥¤¥ë̾', 'euc-jp'
+ ja "File &names:", '¥Õ¥¡¥¤¥ë̾', 'euc-jp'
+ ja "Files of &type:", '¥Õ¥¡¥¤¥ë·Á¼°', 'euc-jp'
+ ja "Fi&les:", '¥Õ¥¡¥¤¥ë', 'euc-jp'
+ ja "&Filter", '¥Õ¥£¥ë¥¿¡¼', 'euc-jp'
+ ja "Fil&ter:", '¥Õ¥£¥ë¥¿¡¼', 'euc-jp'
+ ja "&Green", 'ÎÐ', 'euc-jp'
+ ja "Hi", '¤³¤ó¤Ë¤Á¤Ï', 'euc-jp'
+ ja "Hide Console", '¥³¥ó¥½¡¼¥ë¤ò±£¤¹', 'euc-jp'
+ ja "&Ignore", '̵»ë', 'euc-jp'
+ ja "Invalid file name \"%1\$s\".", '"%1$s" ¤ÏÉÔÀµ¤Ê¥Õ¥¡¥¤¥ë̾¤Ç¤¹¡¥', 'euc-jp'
+ ja "Log Files", '¥í¥°¥Õ¥¡¥¤¥ë', 'euc-jp'
+ ja "&No", '¤¤¤¤¤¨', 'euc-jp'
+ ja "&OK", 'λ²ò', 'euc-jp'
+ ja "OK", 'λ²ò', 'euc-jp'
+ ja "Ok", 'λ²ò', 'euc-jp'
+ ja "Open", '³«¤¯', 'euc-jp'
+ ja "&Open", '³«¤¯', 'euc-jp'
+ ja "Open Multiple Files", 'Ê£¿ô¤Î¥Õ¥¡¥¤¥ë¤ò³«¤¯', 'euc-jp'
+ ja "Paste", 'Ž¤êÉÕ¤±', 'euc-jp'
+ ja "Quit", '½ªÎ»', 'euc-jp'
+ ja "&Red", 'ÀÖ', 'euc-jp'
+ ja "Replace existing file?", '´û¸¤Î¥Õ¥¡¥¤¥ë¤òÃÖ¤­´¹¤¨¤Þ¤¹¤«¡©', 'euc-jp'
+ ja "&Retry", 'ºÆ¼Â¹Ô', 'euc-jp'
+ ja "&Save", 'Êݸ', 'euc-jp'
+ ja "Save As", '̾Á°¤òÉÕ¤±¤ÆÊݸ', 'euc-jp'
+ ja "Save To Log", '¥í¥°¤òÊݸ', 'euc-jp'
+ ja "Select Log File", '¥í¥°¥Õ¥¡¥¤¥ë¤òÁªÂò', 'euc-jp'
+ ja "Select a file to source", '¥½¡¼¥¹¥Õ¥¡¥¤¥ë¤òÁªÂò', 'euc-jp'
+ ja "&Selection:", 'ÁªÂò', 'euc-jp'
+ ja "Skip Messages", '¥á¥Ã¥»¡¼¥¸¤ò¤È¤Ð¤¹', 'euc-jp'
+ ja "Source...", '¥½¡¼¥¹...', 'euc-jp'
+ ja "Tcl Scripts", 'Tcl ¥¹¥¯¥ê¥×¥È', 'euc-jp'
+ ja "Tcl for Windows"
+ ja "Text Files", '¥Æ¥­¥¹¥È¥Õ¥¡¥¤¥ë', 'euc-jp'
+ ja "&Yes", '¤Ï¤¤', 'euc-jp'
+ ja "abort", '̾ȧ', 'euc-jp'
+ ja "blue", 'ÀÄ', 'euc-jp'
+ ja "cancel", '¼è¤ê¾Ã¤·', 'euc-jp'
+ ja "extension", '³ÈÄ¥»Ò', 'euc-jp'
+ ja "extensions", '³ÈÄ¥»Ò', 'euc-jp'
+ ja "green", 'ÎÐ', 'euc-jp'
+ ja "ignore", '̵»ë', 'euc-jp'
+ ja "ok", 'λ²ò', 'euc-jp'
+ ja "red", 'ÀÖ', 'euc-jp'
+ ja "retry", 'ºÆ¼Â¹Ô', 'euc-jp'
+ ja "yes", '¤Ï¤¤', 'euc-jp'
+}
diff --git a/ext/tk/sample/msgs_tk/README b/ext/tk/sample/msgs_tk/README
new file mode 100644
index 0000000000..c7422e3a9b
--- /dev/null
+++ b/ext/tk/sample/msgs_tk/README
@@ -0,0 +1,4 @@
+Almost all of Message-Catalog files in this directory are quoted
+from Tcl/Tk8.5a1 source archive (only a little are modified for
+'tkmsgcat-load_tk.rb'). Please read the file 'license.terms' in
+this directry (That was included in demo directory of Tcl/Tk8.5a1).
diff --git a/ext/tk/sample/msgs_tk/cs.msg b/ext/tk/sample/msgs_tk/cs.msg
new file mode 100644
index 0000000000..697070985e
--- /dev/null
+++ b/ext/tk/sample/msgs_tk/cs.msg
@@ -0,0 +1,84 @@
+namespace eval ::tkmsgcat_demo {
+ ::msgcat::mcset cs "Application Error" "Chyba programu"
+ ::msgcat::mcset cs "Blue" "Modr\341"
+ ::msgcat::mcset cs "Color" "Barva"
+ ::msgcat::mcset cs "Delete" "Smazat"
+ ::msgcat::mcset cs "Error" "Chyba"
+ ::msgcat::mcset cs "Exit" "Konec"
+ ::msgcat::mcset cs "Green" "Zelen\341"
+ ::msgcat::mcset cs "Red" "\u010cerven\341"
+ ::msgcat::mcset cs "blue" "modr\341"
+ ::msgcat::mcset cs "green" "zelen\341"
+ ::msgcat::mcset cs "red" "\u010derven\341"
+}
+
+namespace eval ::tk {
+ ::msgcat::mcset cs "&Abort" "&P\u0159eru\u0161it"
+ ::msgcat::mcset cs "About..." "O programu..."
+ ::msgcat::mcset cs "All Files" "V\u0161echny soubory"
+ ::msgcat::mcset cs "Application Error" "Chyba programu"
+ ::msgcat::mcset cs "&Blue" "&Modr\341"
+ ::msgcat::mcset cs "&Cancel" "&Zru\u0161it"
+ ::msgcat::mcset cs "Cannot change to the directory \"%1\$s\".\nPermission denied." "Nemohu zm\u011bnit atku\341ln\355 adres\341\u0159 na \"%1\$s\".\nP\u0159\355stup odm\355tnut."
+ ::msgcat::mcset cs "Choose Directory" "V\375b\u011br adres\341\u0159e"
+ ::msgcat::mcset cs "Clear" "Smazat"
+ ::msgcat::mcset cs "Color" "Barva"
+ ::msgcat::mcset cs "Console" "Konzole"
+ ::msgcat::mcset cs "Copy" "Kop\355rovat"
+ ::msgcat::mcset cs "Cut" "Vy\u0159\355znout"
+ ::msgcat::mcset cs "Delete" "Smazat"
+ ::msgcat::mcset cs "Details >>" "Detaily >>"
+ ::msgcat::mcset cs "Directory \"%1\$s\" does not exist." "Adres\341\u0159 \"%1\$s\" neexistuje."
+ ::msgcat::mcset cs "&Directory:" "&Adres\341\u0159:"
+ ::msgcat::mcset cs "Error: %1\$s" "Chyba: %1\$s"
+ ::msgcat::mcset cs "Exit" "Konec"
+ ::msgcat::mcset cs "File \"%1\$s\" already exists.\n\n" "Soubor \"%1\$s\" ji\u017e existuje.\n\n"
+ ::msgcat::mcset cs "File \"%1\$s\" already exists.\nDo you want to overwrite it?" "Soubor \"%1\$s\" ji\u017e existuje.\nChcete jej p\u0159epsat?"
+ ::msgcat::mcset cs "File \"%1\$s\" does not exist." "Soubor \"%1\$s\" neexistuje."
+ ::msgcat::mcset cs "File &name:" "&Jm\351no souboru:"
+ ::msgcat::mcset cs "File &names:" "&Jm\351na soubor\u016f:"
+ ::msgcat::mcset cs "Files of &type:" "&Typy soubor\u016f:"
+ ::msgcat::mcset cs "Fi&les:" "Sou&bory:"
+ ::msgcat::mcset cs "&Filter" "&Filtr"
+ ::msgcat::mcset cs "Fil&ter:" "Fil&tr:"
+ ::msgcat::mcset cs "&Green" "Ze&len\341"
+ ::msgcat::mcset cs "Hi"
+ ::msgcat::mcset cs "Hide Console" "Skr\375t konsolu"
+ ::msgcat::mcset cs "&Ignore" "&Ignorovat"
+ ::msgcat::mcset cs "Invalid file name \"%1\$s\"." "\u0160patn\351 jm\351no souboru \"%1\$s\"."
+ ::msgcat::mcset cs "Log Files" "Log soubory"
+ ::msgcat::mcset cs "&No" "&Ne"
+ ::msgcat::mcset cs "&OK"
+ ::msgcat::mcset cs "Ok"
+ ::msgcat::mcset cs "Open" "Otev\u0159\355t"
+ ::msgcat::mcset cs "&Open" "&Otev\u0159\355t"
+ ::msgcat::mcset cs "Open Multiple Files" "Otev\u0159\355t v\355ce soubor\u016f"
+ ::msgcat::mcset cs "Paste" "Vlo\u017eit"
+ ::msgcat::mcset cs "Quit" "Skon\u010dit"
+ ::msgcat::mcset cs "&Red" " \u010ce&rven\341"
+ ::msgcat::mcset cs "Replace existing file?" "Nahradit st\341vaj\355c\355 soubor?"
+ ::msgcat::mcset cs "&Retry" "Z&novu"
+ ::msgcat::mcset cs "&Save" "&Ulo\u017eit"
+ ::msgcat::mcset cs "Save As" "Ulo\u017eit jako"
+ ::msgcat::mcset cs "Save To Log" "Ulo\u017eit do logu"
+ ::msgcat::mcset cs "Select Log File" "Vybrat log soubor"
+ ::msgcat::mcset cs "Select a file to source" "Vybrat soubor k nahr\341n\355"
+ ::msgcat::mcset cs "&Selection:" "&V\375b\u011br:"
+ ::msgcat::mcset cs "Skip Messages" "P\u0159esko\u010dit zpr\341vy"
+ ::msgcat::mcset cs "Source..." "Nahr\341t..."
+ ::msgcat::mcset cs "Tcl Scripts" "Tcl skripty"
+ ::msgcat::mcset cs "Tcl for Windows" "Tcl pro Windows"
+ ::msgcat::mcset cs "Text Files" "Textov\351 soubory"
+ ::msgcat::mcset cs "&Yes" "&Ano"
+ ::msgcat::mcset cs "abort" "p\u0159eru\u0161it"
+ ::msgcat::mcset cs "blue" "modr\341"
+ ::msgcat::mcset cs "cancel" "zru\u0161it"
+ ::msgcat::mcset cs "extension" "p\u0159\355pona"
+ ::msgcat::mcset cs "extensions" "p\u0159\355pony"
+ ::msgcat::mcset cs "green" "zelen\341"
+ ::msgcat::mcset cs "ignore" "ignorovat"
+ ::msgcat::mcset cs "ok"
+ ::msgcat::mcset cs "red" "\u010derven\341"
+ ::msgcat::mcset cs "retry" "znovu"
+ ::msgcat::mcset cs "yes" "ano"
+}
diff --git a/ext/tk/sample/msgs_tk/de.msg b/ext/tk/sample/msgs_tk/de.msg
new file mode 100644
index 0000000000..437f2ed9e7
--- /dev/null
+++ b/ext/tk/sample/msgs_tk/de.msg
@@ -0,0 +1,88 @@
+namespace eval ::tkmsgcat_demo {
+ ::msgcat::mcset de "Application Error" "Applikationsfehler"
+ ::msgcat::mcset de "Blue" "Blau"
+ ::msgcat::mcset de "Color" "Farbe"
+ ::msgcat::mcset de "Delete" "L\u00f6schen"
+ ::msgcat::mcset de "Error" "Fehler"
+ ::msgcat::mcset de "Exit" "Ende"
+ ::msgcat::mcset de "Green" "Gr\u00fcn"
+ ::msgcat::mcset de "Red" "Rot"
+ ::msgcat::mcset de "blue" "blau"
+ ::msgcat::mcset de "green" "gr\u00fcn"
+ ::msgcat::mcset de "red" "rot"
+}
+
+namespace eval ::tk {
+ ::msgcat::mcset de "&Abort" "&Abbruch"
+ ::msgcat::mcset de "&About..." "&\u00dcber..."
+ ::msgcat::mcset de "All Files" "Alle Dateien"
+ ::msgcat::mcset de "Application Error" "Applikationsfehler"
+ ::msgcat::mcset de "&Blue" "&Blau"
+ ::msgcat::mcset de "&Cancel" "&Abbruch"
+ ::msgcat::mcset de "Cannot change to the directory \"%1\$s\".\nPermission denied." "Kann nicht in das Verzeichnis \"%1\$s\" wechseln.\nKeine Rechte vorhanden."
+ ::msgcat::mcset de "Choose Directory" "W\u00e4hle Verzeichnis"
+ ::msgcat::mcset de "&Clear" "&R\u00fccksetzen"
+ ::msgcat::mcset de "&Clear Console" "&Konsole l\u00f6schen"
+ ::msgcat::mcset de "Color" "Farbe"
+ ::msgcat::mcset de "Console" "Konsole"
+ ::msgcat::mcset de "&Copy" "&Kopieren"
+ ::msgcat::mcset de "Cu&t" "Aus&schneiden"
+ ::msgcat::mcset de "&Delete" "&L\u00f6schen"
+ ::msgcat::mcset de "Details >>"
+ ::msgcat::mcset de "Directory \"%1\$s\" does not exist." "Das Verzeichnis \"%1\$s\" existiert nicht."
+ ::msgcat::mcset de "&Directory:" "&Verzeichnis:"
+ ::msgcat::mcset de "&Edit" "&Bearbieten"
+ ::msgcat::mcset de "Error: %1\$s" "Fehler: %1\$s"
+ ::msgcat::mcset de "E&xit" "&Ende"
+ ::msgcat::mcset de "&File" "&Datei"
+ ::msgcat::mcset de "File \"%1\$s\" already exists.\nDo you want to overwrite it?" "Die Datei \"%1\$s\" ist bereits vorhanden.\nWollen sie diese Datei \u00fcberschreiben ?"
+ ::msgcat::mcset de "File \"%1\$s\" already exists.\n\n" "Die Datei \"%1\$s\" ist bereits vorhanden.\n\n"
+ ::msgcat::mcset de "File \"%1\$s\" does not exist." "Die Datei \"%1\$s\" existiert nicht."
+ ::msgcat::mcset de "File &name:" "Datei&name:"
+ ::msgcat::mcset de "File &names:" "Datei&namen:"
+ ::msgcat::mcset de "Files of &type:" "Dateien des &Typs:"
+ ::msgcat::mcset de "Fi&les:" "Dat&eien:"
+ ::msgcat::mcset de "&Filter"
+ ::msgcat::mcset de "Fil&ter:"
+ ::msgcat::mcset de "&Green" "&Gr\u00fcn"
+ ::msgcat::mcset de "&Help" "&Hilfe"
+ ::msgcat::mcset de "Hi" "Hallo"
+ ::msgcat::mcset de "&Hide Console" "&Konsole unsichtbar machen"
+ ::msgcat::mcset de "&Ignore" "&Ignorieren"
+ ::msgcat::mcset de "Invalid file name \"%1\$s\"." "Ung\u00fcltiger Dateiname \"%1\$s\"."
+ ::msgcat::mcset de "Log Files" "Protokolldatei"
+ ::msgcat::mcset de "&No" "&Nein"
+ ::msgcat::mcset de "OK"
+ ::msgcat::mcset de "Ok"
+ ::msgcat::mcset de "Open" "\u00d6ffnen"
+ ::msgcat::mcset de "&Open" "\u00d6&ffnen"
+ ::msgcat::mcset de "Open Multiple Files"
+ ::msgcat::mcset de "P&aste" "E&inf\u00fcgen"
+ ::msgcat::mcset de "&Quit" "&Beenden"
+ ::msgcat::mcset de "&Red" "&Rot"
+ ::msgcat::mcset de "Replace existing file?" "Existierende Datei ersetzen?"
+ ::msgcat::mcset de "&Retry" "&Wiederholen"
+ ::msgcat::mcset de "&Save" "&Speichern"
+ ::msgcat::mcset de "Save As" "Speichern unter"
+ ::msgcat::mcset de "Save To Log" "In Protokoll speichern"
+ ::msgcat::mcset de "Select Log File" "Protokolldatei ausw\u00e4hlen"
+ ::msgcat::mcset de "Select a file to source" "Auszuf\u00fchrende Datei ausw\u00e4hlen"
+ ::msgcat::mcset de "&Selection:" "Auswah&l:"
+ ::msgcat::mcset de "Skip Messages" "Weitere Nachrichten \u00fcberspringen"
+ ::msgcat::mcset de "&Source..." "&Ausf\u00fchren..."
+ ::msgcat::mcset de "Tcl Scripts" "Tcl-Skripte"
+ ::msgcat::mcset de "Tcl for Windows" "Tcl f\u00fcr Windows"
+ ::msgcat::mcset de "Text Files" "Textdateien"
+ ::msgcat::mcset de "&Yes" "&Ja"
+ ::msgcat::mcset de "abort" "abbrechen"
+ ::msgcat::mcset de "blue" "blau"
+ ::msgcat::mcset de "cancel" "abbrechen"
+ ::msgcat::mcset de "extension" "Erweiterung"
+ ::msgcat::mcset de "extensions" "Erweiterungen"
+ ::msgcat::mcset de "green" "gr\u00fcn"
+ ::msgcat::mcset de "ignore" "ignorieren"
+ ::msgcat::mcset de "ok"
+ ::msgcat::mcset de "red" "rot"
+ ::msgcat::mcset de "retry" "wiederholen"
+ ::msgcat::mcset de "yes" "ja"
+}
diff --git a/ext/tk/sample/msgs_tk/el.msg b/ext/tk/sample/msgs_tk/el.msg
new file mode 100644
index 0000000000..1e3a539647
--- /dev/null
+++ b/ext/tk/sample/msgs_tk/el.msg
@@ -0,0 +1,103 @@
+namespace eval ::tkmsgcat_demo {
+ ::msgcat::mcset el "Application Error" "\u039b\u03ac\u03b8\u03bf\u03c2 \u0395\u03c6\u03b1\u03c1\u03bc\u03bf\u03b3\u03ae\u03c2"
+ ::msgcat::mcset el "Blue" "\u039c\u03c0\u03bb\u03b5"
+ ::msgcat::mcset el "Color" "\u03a7\u03c1\u03ce\u03bc\u03b1"
+ ::msgcat::mcset el "Delete" "\u0394\u03b9\u03b1\u03b3\u03c1\u03b1\u03c6\u03ae"
+ ::msgcat::mcset el "Error" "\u039b\u03ac\u03b8\u03bf\u03c2"
+ ::msgcat::mcset el "Exit" "\u0388\u03be\u03bf\u03b4\u03bf\u03c2"
+ ::msgcat::mcset el "Green" "\u03a0\u03c1\u03ac\u03c3\u03b9\u03bd\u03bf"
+ ::msgcat::mcset el "Red" "\u039a\u03cc\u03ba\u03ba\u03b9\u03bd\u03bf"
+ ::msgcat::mcset el "blue" "\u03bc\u03c0\u03bb\u03b5"
+ ::msgcat::mcset el "green" "\u03c0\u03c1\u03ac\u03c3\u03b9\u03bd\u03bf"
+ ::msgcat::mcset el "red" "\u03ba\u03cc\u03ba\u03ba\u03b9\u03bd\u03bf"
+}
+
+
+# followings are same to original file included into Tk8.5a1's widget demos.
+
+## Messages for the Greek (Hellenic - "el") language.
+## Please report any changes/suggestions to:
+## petasis@iit.demokritos.gr
+
+namespace eval ::tk {
+ ::msgcat::mcset el "&Abort" "\u03a4\u03b5\u03c1\u03bc\u03b1\u03c4\u03b9\u03c3\u03bc\u03cc\u03c2"
+ ::msgcat::mcset el "About..." "\u03a3\u03c7\u03b5\u03c4\u03b9\u03ba\u03ac..."
+ ::msgcat::mcset el "All Files" "\u038c\u03bb\u03b1 \u03c4\u03b1 \u0391\u03c1\u03c7\u03b5\u03af\u03b1"
+ ::msgcat::mcset el "Application Error" "\u039b\u03ac\u03b8\u03bf\u03c2 \u0395\u03c6\u03b1\u03c1\u03bc\u03bf\u03b3\u03ae\u03c2"
+ ::msgcat::mcset el "&Blue" "\u039c\u03c0\u03bb\u03b5"
+ ::msgcat::mcset el "&Cancel" "\u0391\u03ba\u03cd\u03c1\u03c9\u03c3\u03b7"
+ ::msgcat::mcset el \
+"Cannot change to the directory \"%1\$s\".\nPermission denied." \
+"\u0394\u03b5\u03bd \u03b5\u03af\u03bd\u03b1\u03b9 \u03b4\u03c5\u03bd\u03b1\u03c4\u03ae \u03b7 \u03b1\u03bb\u03bb\u03b1\u03b3\u03ae \u03ba\u03b1\u03c4\u03b1\u03bb\u03cc\u03b3\u03bf\u03c5 \u03c3\u03b5 \"%1\$s\".\n\u0397 \u03c0\u03c1\u03cc\u03c3\u03b2\u03b1\u03c3\u03b7 \u03b4\u03b5\u03bd \u03b5\u03c0\u03b9\u03c4\u03c1\u03ad\u03c0\u03b5\u03c4\u03b1\u03b9."
+ ::msgcat::mcset el "Choose Directory" "\u0395\u03c0\u03b9\u03bb\u03bf\u03b3\u03ae \u039a\u03b1\u03c4\u03b1\u03bb\u03cc\u03b3\u03bf\u03c5"
+ ::msgcat::mcset el "Clear" "\u039a\u03b1\u03b8\u03b1\u03c1\u03b9\u03c3\u03bc\u03cc\u03c2"
+ ::msgcat::mcset el "Color" "\u03a7\u03c1\u03ce\u03bc\u03b1"
+ ::msgcat::mcset el "Console" "\u039a\u03bf\u03bd\u03c3\u03cc\u03bb\u03b1"
+ ::msgcat::mcset el "Copy" "\u0391\u03bd\u03c4\u03b9\u03b3\u03c1\u03b1\u03c6\u03ae"
+ ::msgcat::mcset el "Cut" "\u0391\u03c0\u03bf\u03ba\u03bf\u03c0\u03ae"
+ ::msgcat::mcset el "Delete" "\u0394\u03b9\u03b1\u03b3\u03c1\u03b1\u03c6\u03ae"
+ ::msgcat::mcset el "Details >>" "\u039b\u03b5\u03c0\u03c4\u03bf\u03bc\u03ad\u03c1\u03b5\u03b9\u03b5\u03c2 >>"
+ ::msgcat::mcset el "Directory \"%1\$s\" does not exist." \
+ "\u039f \u03ba\u03b1\u03c4\u03ac\u03bb\u03bf\u03b3\u03bf\u03c2 \"%1\$s\" \u03b4\u03b5\u03bd \u03c5\u03c0\u03ac\u03c1\u03c7\u03b5\u03b9."
+ ::msgcat::mcset el "&Directory:" "&\u039a\u03b1\u03c4\u03ac\u03bb\u03bf\u03b3\u03bf\u03c2:"
+ ::msgcat::mcset el "Error: %1\$s" "\u039b\u03ac\u03b8\u03bf\u03c2: %1\$s"
+ ::msgcat::mcset el "Exit" "\u0388\u03be\u03bf\u03b4\u03bf\u03c2"
+ ::msgcat::mcset el \
+ "File \"%1\$s\" already exists.\nDo you want to overwrite it?" \
+ "\u03a4\u03bf \u03b1\u03c1\u03c7\u03b5\u03af\u03bf \"%1\$s\" \u03ae\u03b4\u03b7 \u03c5\u03c0\u03ac\u03c1\u03c7\u03b5\u03b9.\n\u0398\u03ad\u03bb\u03b5\u03c4\u03b5 \u03bd\u03b1 \u03b5\u03c0\u03b9\u03ba\u03b1\u03bb\u03c5\u03c6\u03b8\u03b5\u03af;"
+ ::msgcat::mcset el "File \"%1\$s\" already exists.\n\n" \
+ "\u03a4\u03bf \u03b1\u03c1\u03c7\u03b5\u03af\u03bf \"%1\$s\" \u03ae\u03b4\u03b7 \u03c5\u03c0\u03ac\u03c1\u03c7\u03b5\u03b9.\n\n"
+ ::msgcat::mcset el "File \"%1\$s\" does not exist." \
+ "\u03a4\u03bf \u03b1\u03c1\u03c7\u03b5\u03af\u03bf \"%1\$s\" \u03b4\u03b5\u03bd \u03c5\u03c0\u03ac\u03c1\u03c7\u03b5\u03b9."
+ ::msgcat::mcset el "File &name:" "\u038c&\u03bd\u03bf\u03bc\u03b1 \u03b1\u03c1\u03c7\u03b5\u03af\u03bf\u03c5:"
+ ::msgcat::mcset el "File &names:" "\u038c&\u03bd\u03bf\u03bc\u03b1 \u03b1\u03c1\u03c7\u03b5\u03af\u03c9\u03bd:"
+ ::msgcat::mcset el "Files of &type:" "\u0391\u03c1\u03c7\u03b5\u03af\u03b1 \u03c4\u03bf\u03c5 &\u03c4\u03cd\u03c0\u03bf\u03c5:"
+ ::msgcat::mcset el "Fi&les:" "\u0391\u03c1\u03c7\u03b5\u03af\u03b1:"
+ ::msgcat::mcset el "&Filter" "\u03a6\u03af\u03bb\u03c4\u03c1\u03bf"
+ ::msgcat::mcset el "Fil&ter:" "\u03a6\u03af\u03bb\u03c4\u03c1\u03bf:"
+ ::msgcat::mcset el "&Green" "\u03a0\u03c1\u03ac\u03c3\u03b9\u03bd\u03bf"
+ ::msgcat::mcset el "Hi" "\u0393\u03b5\u03b9\u03b1"
+ ::msgcat::mcset el "Hide Console" "\u0391\u03c0\u03cc\u03ba\u03c1\u03c5\u03c8\u03b7 \u03ba\u03bf\u03bd\u03c3\u03cc\u03bb\u03b1\u03c2"
+ ::msgcat::mcset el "&Ignore" "\u0391\u03b3\u03bd\u03cc\u03b7\u03c3\u03b7"
+ ::msgcat::mcset el "Invalid file name \"%1\$s\"." \
+ "\u0386\u03ba\u03c5\u03c1\u03bf \u03cc\u03bd\u03bf\u03bc\u03b1 \u03b1\u03c1\u03c7\u03b5\u03af\u03bf\u03c5 \"%1\$s\"."
+ ::msgcat::mcset el "Log Files" "\u0391\u03c1\u03c7\u03b5\u03af\u03b1 \u039a\u03b1\u03c4\u03b1\u03b3\u03c1\u03b1\u03c6\u03ae\u03c2"
+ ::msgcat::mcset el "&No" "\u038c\u03c7\u03b9"
+ ::msgcat::mcset el "&OK" "\u0395\u03bd\u03c4\u03ac\u03be\u03b5\u03b9"
+ ::msgcat::mcset el "&Ok" "\u0395\u03bd\u03c4\u03ac\u03be\u03b5\u03b9"
+ ::msgcat::mcset el "Open" "\u0386\u03bd\u03bf\u03b9\u03b3\u03bc\u03b1"
+ ::msgcat::mcset el "&Open" "\u0386\u03bd\u03bf\u03b9\u03b3\u03bc\u03b1"
+ ::msgcat::mcset el "Open Multiple Files" \
+ "\u0386\u03bd\u03bf\u03b9\u03b3\u03bc\u03b1 \u03c0\u03bf\u03bb\u03bb\u03b1\u03c0\u03bb\u03ce\u03bd \u03b1\u03c1\u03c7\u03b5\u03af\u03c9\u03bd"
+ ::msgcat::mcset el "Paste" "\u0395\u03c0\u03b9\u03ba\u03cc\u03bb\u03bb\u03b7\u03c3\u03b7"
+ ::msgcat::mcset el "Quit" "\u0388\u03be\u03bf\u03b4\u03bf\u03c2"
+ ::msgcat::mcset el "&Red" "\u039a\u03cc\u03ba\u03ba\u03b9\u03bd\u03bf"
+ ::msgcat::mcset el "Replace existing file?" \
+ "\u0395\u03c0\u03b9\u03ba\u03ac\u03bb\u03c5\u03c8\u03b7 \u03c5\u03c0\u03ac\u03c1\u03c7\u03bf\u03bd\u03c4\u03bf\u03c2 \u03b1\u03c1\u03c7\u03b5\u03af\u03bf\u03c5;"
+ ::msgcat::mcset el "&Retry" "\u03a0\u03c1\u03bf\u03c3\u03c0\u03ac\u03b8\u03b7\u03c3\u03b5 \u03be\u03b1\u03bd\u03ac"
+ ::msgcat::mcset el "&Save" "\u0391\u03c0\u03bf\u03b8\u03ae\u03ba\u03b5\u03c5\u03c3\u03b7"
+ ::msgcat::mcset el "Save As" "\u0391\u03c0\u03bf\u03b8\u03ae\u03ba\u03b5\u03c5\u03c3\u03b7 \u03c3\u03b1\u03bd"
+ ::msgcat::mcset el "Save To Log" "\u0391\u03c0\u03bf\u03b8\u03ae\u03ba\u03b5\u03c5\u03c3\u03b7 \u03c3\u03c4\u03bf \u03b1\u03c1\u03c7\u03b5\u03af\u03bf \u03ba\u03b1\u03c4\u03b1\u03b3\u03c1\u03b1\u03c6\u03ae\u03c2"
+ ::msgcat::mcset el "Select Log File" "\u0395\u03c0\u03b9\u03bb\u03bf\u03b3\u03ae \u03b1\u03c1\u03c7\u03b5\u03af\u03bf\u03c5 \u03ba\u03b1\u03c4\u03b1\u03b3\u03c1\u03b1\u03c6\u03ae\u03c2"
+ ::msgcat::mcset el "Select a file to source" \
+ "\u0395\u03c0\u03b9\u03bb\u03ad\u03be\u03c4\u03b5 \u03b1\u03c1\u03c7\u03b5\u03af\u03bf \u03b3\u03b9\u03b1 \u03b5\u03ba\u03c4\u03ad\u03bb\u03b5\u03c3\u03b7"
+ ::msgcat::mcset el "&Selection:" "\u0395\u03c0\u03b9\u03bb\u03bf\u03b3\u03ae:"
+ ::msgcat::mcset el "Skip Messages" "\u0391\u03c0\u03bf\u03c6\u03c5\u03b3\u03ae \u03bc\u03c5\u03bd\u03b7\u03bc\u03ac\u03c4\u03c9\u03bd"
+ ::msgcat::mcset el "Source..." "\u0395\u03ba\u03c4\u03ad\u03bb\u03b5\u03c3\u03b7..."
+ ::msgcat::mcset el "Tcl Scripts" "Tcl Scripts"
+ ::msgcat::mcset el "Tcl for Windows" "Tcl \u03b3\u03b9\u03b1 Windows"
+ ::msgcat::mcset el "Text Files" "\u0391\u03c1\u03c7\u03b5\u03af\u03b1 \u039a\u03b5\u03b9\u03bc\u03ad\u03bd\u03bf\u03c5"
+ ::msgcat::mcset el "&Yes" "\u039d\u03b1\u03b9"
+ ::msgcat::mcset el "abort" "\u03c4\u03b5\u03c1\u03bc\u03b1\u03c4\u03b9\u03c3\u03bc\u03cc\u03c2"
+ ::msgcat::mcset el "blue" "\u03bc\u03c0\u03bb\u03b5"
+ ::msgcat::mcset el "cancel" "\u03b1\u03ba\u03cd\u03c1\u03c9\u03c3\u03b7"
+ ::msgcat::mcset el "extension" "\u03b5\u03c0\u03ad\u03ba\u03c4\u03b1\u03c3\u03b7"
+ ::msgcat::mcset el "extensions" "\u03b5\u03c0\u03b5\u03ba\u03c4\u03ac\u03c3\u03b5\u03b9\u03c2"
+ ::msgcat::mcset el "green" "\u03c0\u03c1\u03ac\u03c3\u03b9\u03bd\u03bf"
+ ::msgcat::mcset el "ignore" "\u03b1\u03b3\u03bd\u03cc\u03b7\u03c3\u03b7"
+ ::msgcat::mcset el "ok" "\u03b5\u03bd\u03c4\u03ac\u03be\u03b5\u03b9"
+ ::msgcat::mcset el "red" "\u03ba\u03cc\u03ba\u03ba\u03b9\u03bd\u03bf"
+ ::msgcat::mcset el "retry" "\u03c0\u03c1\u03bf\u03c3\u03c0\u03ac\u03b8\u03b7\u03c3\u03b5 \u03be\u03b1\u03bd\u03ac"
+ ::msgcat::mcset el "yes" "\u03bd\u03b1\u03b9"
+}
+
diff --git a/ext/tk/sample/msgs_tk/en.msg b/ext/tk/sample/msgs_tk/en.msg
new file mode 100644
index 0000000000..de586d195e
--- /dev/null
+++ b/ext/tk/sample/msgs_tk/en.msg
@@ -0,0 +1,83 @@
+namespace eval ::tkmsgcat_demo {
+ ::msgcat::mcset en "Application Error"
+ ::msgcat::mcset en "Blue"
+ ::msgcat::mcset en "Color"
+ ::msgcat::mcset en "Delete"
+ ::msgcat::mcset en "Error"
+ ::msgcat::mcset en "Green"
+ ::msgcat::mcset en "Red"
+ ::msgcat::mcset en "blue"
+ ::msgcat::mcset en "green"
+ ::msgcat::mcset en "red"
+}
+
+namespace eval ::tk {
+ ::msgcat::mcset en "&Abort"
+ ::msgcat::mcset en "About..."
+ ::msgcat::mcset en "All Files"
+ ::msgcat::mcset en "Application Error"
+ ::msgcat::mcset en "&Blue"
+ ::msgcat::mcset en "&Cancel"
+ ::msgcat::mcset en "Cannot change to the directory \"%1\$s\".\nPermission denied."
+ ::msgcat::mcset en "Choose Directory"
+ ::msgcat::mcset en "Clear"
+ ::msgcat::mcset en "Color"
+ ::msgcat::mcset en "Console"
+ ::msgcat::mcset en "Copy"
+ ::msgcat::mcset en "Cut"
+ ::msgcat::mcset en "Delete"
+ ::msgcat::mcset en "Details >>"
+ ::msgcat::mcset en "Directory \"%1\$s\" does not exist."
+ ::msgcat::mcset en "&Directory:"
+ ::msgcat::mcset en "Error: %1\$s"
+ ::msgcat::mcset en "Exit"
+ ::msgcat::mcset en "File \"%1\$s\" already exists.\nDo you want to overwrite it?"
+ ::msgcat::mcset en "File \"%1\$s\" already exists.\n\n"
+ ::msgcat::mcset en "File \"%1\$s\" does not exist."
+ ::msgcat::mcset en "File &name:"
+ ::msgcat::mcset en "File &names:"
+ ::msgcat::mcset en "Files of &type:"
+ ::msgcat::mcset en "Fi&les:"
+ ::msgcat::mcset en "&Filter"
+ ::msgcat::mcset en "Fil&ter:"
+ ::msgcat::mcset en "&Green"
+ ::msgcat::mcset en "Hi"
+ ::msgcat::mcset en "Hide Console"
+ ::msgcat::mcset en "&Ignore"
+ ::msgcat::mcset en "Invalid file name \"%1\$s\"."
+ ::msgcat::mcset en "Log Files"
+ ::msgcat::mcset en "&No"
+ ::msgcat::mcset en "&OK"
+ ::msgcat::mcset en "Ok"
+ ::msgcat::mcset en "Open"
+ ::msgcat::mcset en "&Open"
+ ::msgcat::mcset en "Open Multiple Files"
+ ::msgcat::mcset en "Paste"
+ ::msgcat::mcset en "Quit"
+ ::msgcat::mcset en "&Red"
+ ::msgcat::mcset en "Replace existing file?"
+ ::msgcat::mcset en "&Retry"
+ ::msgcat::mcset en "&Save"
+ ::msgcat::mcset en "Save As"
+ ::msgcat::mcset en "Save To Log"
+ ::msgcat::mcset en "Select Log File"
+ ::msgcat::mcset en "Select a file to source"
+ ::msgcat::mcset en "&Selection:"
+ ::msgcat::mcset en "Skip Messages"
+ ::msgcat::mcset en "Source..."
+ ::msgcat::mcset en "Tcl Scripts"
+ ::msgcat::mcset en "Tcl for Windows"
+ ::msgcat::mcset en "Text Files"
+ ::msgcat::mcset en "&Yes"
+ ::msgcat::mcset en "abort"
+ ::msgcat::mcset en "blue"
+ ::msgcat::mcset en "cancel"
+ ::msgcat::mcset en "extension"
+ ::msgcat::mcset en "extensions"
+ ::msgcat::mcset en "green"
+ ::msgcat::mcset en "ignore"
+ ::msgcat::mcset en "ok"
+ ::msgcat::mcset en "red"
+ ::msgcat::mcset en "retry"
+ ::msgcat::mcset en "yes"
+}
diff --git a/ext/tk/sample/msgs_tk/en_gb.msg b/ext/tk/sample/msgs_tk/en_gb.msg
new file mode 100644
index 0000000000..1aa5b49380
--- /dev/null
+++ b/ext/tk/sample/msgs_tk/en_gb.msg
@@ -0,0 +1,7 @@
+namespace eval ::tkmsgcat_demo {
+ ::msgcat::mcset en_gb Color Colour
+}
+
+namespace eval ::tk {
+ ::msgcat::mcset en_gb Color Colour
+}
diff --git a/ext/tk/sample/msgs_tk/eo.msg b/ext/tk/sample/msgs_tk/eo.msg
new file mode 100644
index 0000000000..e683cef297
--- /dev/null
+++ b/ext/tk/sample/msgs_tk/eo.msg
@@ -0,0 +1,87 @@
+namespace eval ::tkmsgcat_demo {
+ ::msgcat::mcset eo "Application Error" "Aplikoerraro"
+ ::msgcat::mcset eo "Blue" "Blua"
+ ::msgcat::mcset eo "Color" "Farbo"
+ ::msgcat::mcset eo "Delete" "Forprenu"
+ ::msgcat::mcset eo "Error" "Eraro"
+ ::msgcat::mcset eo "Exit" "Eliru"
+ ::msgcat::mcset eo "Green" "Verda"
+ ::msgcat::mcset eo "Red" "Rosa"
+ ::msgcat::mcset eo "blue" "blua"
+ ::msgcat::mcset eo "green" "verda"
+ ::msgcat::mcset eo "red" "ru\u011da"
+}
+
+namespace eval ::tk {
+ ::msgcat::mcset eo "&Abort" "&\u0108esigo"
+ ::msgcat::mcset eo "&About..." "Pri..."
+ ::msgcat::mcset eo "All Files" "\u0108ioj dosieroj"
+ ::msgcat::mcset eo "Application Error" "Aplikoerraro"
+ ::msgcat::mcset eo "&Blue" "&Blua"
+ ::msgcat::mcset eo "&Cancel" "&Rezignu"
+ ::msgcat::mcset eo "Cannot change to the directory \"%1\$s\".\nPermission denied." "Neeble \u0109angi al dosierulon \"%1\$s\".\nVi ne rajtas tion."
+ ::msgcat::mcset eo "Choose Directory" "Elektu Dosierujo"
+ ::msgcat::mcset eo "&Clear" "&Klaru"
+ ::msgcat::mcset eo "&Clear Console" "&Klaru konzolon"
+ ::msgcat::mcset eo "Color" "Farbo"
+ ::msgcat::mcset eo "Console" "Konzolo"
+ ::msgcat::mcset eo "&Copy" "&Kopiu"
+ ::msgcat::mcset eo "Cu&t" "&Enpo\u015digu"
+ ::msgcat::mcset eo "&Delete" "&Forprenu"
+ ::msgcat::mcset eo "Details >>" "Detaloj >>"
+ ::msgcat::mcset eo "Directory \"%1\$s\" does not exist." "La dosierujo \"%1\$s\" ne ekzistas."
+ ::msgcat::mcset eo "&Directory:" "&Dosierujo:"
+ ::msgcat::mcset eo "&Edit" "&Redaktu"
+ ::msgcat::mcset eo "Error: %1\$s" "Eraro: %1\$s"
+ ::msgcat::mcset eo "E&xit" "&Eliru"
+ ::msgcat::mcset eo "&File" "&Dosiero"
+ ::msgcat::mcset eo "File \"%1\$s\" already exists.\nDo you want to overwrite it?" "La dosiero \"%1\$s\" jam ekzistas.\n\u0108u vi volas anstata\u00fbigi la dosieron?"
+ ::msgcat::mcset eo "File \"%1\$s\" already exists.\n\n" "La dosiero \"%1\$s\" jam egzistas. \n\n"
+ ::msgcat::mcset eo "File \"%1\$s\" does not exist." "La dosierp \"%1\$s\" ne estas."
+ ::msgcat::mcset eo "File &name:" "Dosiero&nomo:"
+ ::msgcat::mcset eo "File &names:" "Dosiero&nomoj:"
+ ::msgcat::mcset eo "Files of &type:" "Dosieroj de &Typo:"
+ ::msgcat::mcset eo "Fi&les:" "Do&sieroj:"
+ ::msgcat::mcset eo "&Filter" "&Filtrilo"
+ ::msgcat::mcset eo "Fil&ter:" "&Filtrilo:"
+ ::msgcat::mcset eo "&Green" "&Verda"
+ ::msgcat::mcset eo "&Help" "&Helpu"
+ ::msgcat::mcset eo "Hi" "Saluton"
+ ::msgcat::mcset eo "&Hide Console" "&Ka\u015du konzolon"
+ ::msgcat::mcset eo "&Ignore" "&Ignoru"
+ ::msgcat::mcset eo "Invalid file name \"%1\$s\"." "Malvalida dosieronomo \"%1\$s\"."
+ ::msgcat::mcset eo "Log Files" "Protokolo"
+ ::msgcat::mcset eo "&No" "&Ne"
+ ::msgcat::mcset eo "OK"
+ ::msgcat::mcset eo "Ok"
+ ::msgcat::mcset eo "Open" "Malfermu"
+ ::msgcat::mcset eo "&Open" "&Malfermu"
+ ::msgcat::mcset eo "Open Multiple Files" "Melfermu multan dosierojn"
+ ::msgcat::mcset eo "P&aste" "&Elpo\u015digi"
+ ::msgcat::mcset eo "&Quit" "&Finigu"
+ ::msgcat::mcset eo "&Red" "&Rosa"
+ ::msgcat::mcset eo "Replace existing file?" "\u0108u anstata\u00fbu ekzistantan dosieron?"
+ ::msgcat::mcset eo "&Retry" "&Ripetu"
+ ::msgcat::mcset eo "&Save" "&Savu"
+ ::msgcat::mcset eo "Save As" "Savu kiel"
+ ::msgcat::mcset eo "Save To Log" "Savu en protokolon"
+ ::msgcat::mcset eo "Select Log File" "Elektu prokolodosieron"
+ ::msgcat::mcset eo "Select a file to source" "Elektu dosieron por interpreti"
+ ::msgcat::mcset eo "&Selection:" "&Elekto:"
+ ::msgcat::mcset eo "Skip Messages" "transsaltu pluajn mesa\u011dojn"
+ ::msgcat::mcset eo "&Source..." "&Fontoprogramo..."
+ ::msgcat::mcset eo "Tcl Scripts" "Tcl-skriptoj"
+ ::msgcat::mcset eo "Tcl for Windows" "Tcl por vindoso"
+ ::msgcat::mcset eo "Text Files" "Tekstodosierojn"
+ ::msgcat::mcset eo "&Yes" "&Jes"
+ ::msgcat::mcset eo "abort" "\u0109esigo"
+ ::msgcat::mcset eo "blue" "blua"
+ ::msgcat::mcset eo "cancel" "rezignu"
+ ::msgcat::mcset eo "extension" "ekspansio"
+ ::msgcat::mcset eo "extensions" "ekspansioj"
+ ::msgcat::mcset eo "green" "verda"
+ ::msgcat::mcset eo "ignore" "ignorieren"
+ ::msgcat::mcset eo "red" "ru\u011da"
+ ::msgcat::mcset eo "retry" "ripetu"
+ ::msgcat::mcset eo "yes" "jes"
+}
diff --git a/ext/tk/sample/msgs_tk/es.msg b/ext/tk/sample/msgs_tk/es.msg
new file mode 100644
index 0000000000..ba981236a3
--- /dev/null
+++ b/ext/tk/sample/msgs_tk/es.msg
@@ -0,0 +1,84 @@
+namespace eval ::tkmsgcat_demo {
+ ::msgcat::mcset es "Application Error" "Error de la aplicaci\u00f3n"
+ ::msgcat::mcset es "Blue" "Azul"
+ ::msgcat::mcset es "Color" "Color"
+ ::msgcat::mcset es "Delete" "Borrar"
+ ::msgcat::mcset es "Error" "Error"
+ ::msgcat::mcset es "Exit" "Salir"
+ ::msgcat::mcset es "Green" "Verde"
+ ::msgcat::mcset es "Red" "Rojo"
+ ::msgcat::mcset es "blue" "azul"
+ ::msgcat::mcset es "green" "verde"
+ ::msgcat::mcset es "red" "rojo"
+}
+
+namespace eval ::tk {
+ ::msgcat::mcset es "&Abort" "&Abortar"
+ ::msgcat::mcset es "About..." "Acerca de ..."
+ ::msgcat::mcset es "All Files" "Todos los archivos"
+ ::msgcat::mcset es "Application Error" "Error de la aplicaci\u00f3n"
+ ::msgcat::mcset es "&Blue" "&Azul"
+ ::msgcat::mcset es "&Cancel" "&Cancelar"
+ ::msgcat::mcset es "Cannot change to the directory \"%1\$s\".\nPermission denied." "No es posible acceder al directorio \"%1\$s\".\nPermiso denegado."
+ ::msgcat::mcset es "Choose Directory" "Elegir directorio"
+ ::msgcat::mcset es "Clear" "Borrar"
+ ::msgcat::mcset es "Color" "Color"
+ ::msgcat::mcset es "Console" "Consola"
+ ::msgcat::mcset es "Copy" "Copiar"
+ ::msgcat::mcset es "Cut" "Cortar"
+ ::msgcat::mcset es "Delete" "Borrar"
+ ::msgcat::mcset es "Details >>" "Detalles >>"
+ ::msgcat::mcset es "Directory \"%1\$s\" does not exist." "El directorio \"%1\$s\" no existe."
+ ::msgcat::mcset es "&Directory:" "&Directorio:"
+ ::msgcat::mcset es "Error: %1\$s" "Error: %1\$s"
+ ::msgcat::mcset es "Exit" "Salir"
+ ::msgcat::mcset es "File \"%1\$s\" already exists.\nDo you want to overwrite it?" "El archivo \"%1\$s\" ya existe.\nDesea sobreescribirlo?"
+ ::msgcat::mcset es "File \"%1\$s\" already exists.\n\n" "El archivo \"%1\$s\" ya existe.\n\n"
+ ::msgcat::mcset es "File \"%1\$s\" does not exist." "El archivo \"%1\$s\" no existe."
+ ::msgcat::mcset es "File &name:" "&Nombre de archivo:"
+ ::msgcat::mcset es "File &names:" "&Nombres de archivo:"
+ ::msgcat::mcset es "Files of &type:" "Archivos de &tipo:"
+ ::msgcat::mcset es "Fi&les:" "&Archivos:"
+ ::msgcat::mcset es "&Filter" "&Filtro"
+ ::msgcat::mcset es "Fil&ter:" "Fil&tro:"
+ ::msgcat::mcset es "&Green" "&Verde"
+ ::msgcat::mcset es "Hi" "Hola"
+ ::msgcat::mcset es "Hide Console" "Esconder la consola"
+ ::msgcat::mcset es "&Ignore" "&Ignorar"
+ ::msgcat::mcset es "Invalid file name \"%1\$s\"." "Nombre de archivo inv\u00e1lido \"%1\$s\"."
+ ::msgcat::mcset es "Log Files" "Ficheros de traza"
+ ::msgcat::mcset es "&No" "&No"
+ ::msgcat::mcset es "&OK" "&OK"
+ ::msgcat::mcset es "Ok" "Ok"
+ ::msgcat::mcset es "Open" "Abrir"
+ ::msgcat::mcset es "&Open" "&Abrir"
+ ::msgcat::mcset es "Open Multiple Files" "Abrir m\u00faltiples archivos"
+ ::msgcat::mcset es "Paste" "Pegar"
+ ::msgcat::mcset es "Quit" "Abandonar"
+ ::msgcat::mcset es "&Red" "&Rojo"
+ ::msgcat::mcset es "Replace existing file?" "Reemplazar el archivo existente?"
+ ::msgcat::mcset es "&Retry" "&Reintentar"
+ ::msgcat::mcset es "&Save" "&Salvar"
+ ::msgcat::mcset es "Save As" "Salvar como"
+ ::msgcat::mcset es "Save To Log" "Salvar al archivo de traza"
+ ::msgcat::mcset es "Select Log File" "Elegir un archivo de traza"
+ ::msgcat::mcset es "Select a file to source" "Seleccionar un archivo a evaluar"
+ ::msgcat::mcset es "&Selection:" "&Selecci\u00f3n:"
+ ::msgcat::mcset es "Skip Messages" "Omitir los mensajes"
+ ::msgcat::mcset es "Source..." "Evaluar..."
+ ::msgcat::mcset es "Tcl Scripts" "Scripts Tcl"
+ ::msgcat::mcset es "Tcl for Windows" "Tcl para Windows"
+ ::msgcat::mcset es "Text Files" "Archivos de texto"
+ ::msgcat::mcset es "&Yes" "&S\u00ed"
+ ::msgcat::mcset es "abort" "abortar"
+ ::msgcat::mcset es "blue" "azul"
+ ::msgcat::mcset es "cancel" "cancelar"
+ ::msgcat::mcset es "extension" "extensi\u00f3n"
+ ::msgcat::mcset es "extensions" "extensiones"
+ ::msgcat::mcset es "green" "verde"
+ ::msgcat::mcset es "ignore" "ignorar"
+ ::msgcat::mcset es "ok" "ok"
+ ::msgcat::mcset es "red" "rojo"
+ ::msgcat::mcset es "retry" "reintentar"
+ ::msgcat::mcset es "yes" "s\u00ed"
+}
diff --git a/ext/tk/sample/msgs_tk/fr.msg b/ext/tk/sample/msgs_tk/fr.msg
new file mode 100644
index 0000000000..ebbba48ca1
--- /dev/null
+++ b/ext/tk/sample/msgs_tk/fr.msg
@@ -0,0 +1,84 @@
+namespace eval ::tkmsgcat_demo {
+ ::msgcat::mcset fr "Application Error" "Erreur d'application"
+ ::msgcat::mcset fr "Blue" "Bleu"
+ ::msgcat::mcset fr "Color" "Couleur"
+ ::msgcat::mcset fr "Delete" "Effacer"
+ ::msgcat::mcset fr "Error" "Erreur"
+ ::msgcat::mcset fr "Exit" "Quitter"
+ ::msgcat::mcset fr "Green" "Vert"
+ ::msgcat::mcset fr "Red" "Rouge"
+ ::msgcat::mcset fr "blue" "bleu"
+ ::msgcat::mcset fr "green" "vert"
+ ::msgcat::mcset fr "red" "rouge"
+}
+
+namespace eval ::tk {
+ ::msgcat::mcset fr "&Abort" "&Annuler"
+ ::msgcat::mcset fr "About..." "\u00c0 propos..."
+ ::msgcat::mcset fr "All Files" "Tous les fichiers"
+ ::msgcat::mcset fr "Application Error" "Erreur d'application"
+ ::msgcat::mcset fr "&Blue" "&Bleu"
+ ::msgcat::mcset fr "&Cancel" "&Annuler"
+ ::msgcat::mcset fr "Cannot change to the directory \"%1\$s\".\nPermission denied." "Impossible d'acc\u00e9der au r\u00e9pertoire \"%1\$s\".\nPermission refus\u00e9e."
+ ::msgcat::mcset fr "Choose Directory" "Choisir r\u00e9pertoire"
+ ::msgcat::mcset fr "Clear" "Effacer"
+ ::msgcat::mcset fr "Color" "Couleur"
+ ::msgcat::mcset fr "Console"
+ ::msgcat::mcset fr "Copy" "Copier"
+ ::msgcat::mcset fr "Cut" "Couper"
+ ::msgcat::mcset fr "Delete" "Effacer"
+ ::msgcat::mcset fr "Details >>" "D\u00e9tails >>"
+ ::msgcat::mcset fr "Directory \"%1\$s\" does not exist." "Le r\u00e9pertoire \"%1\$s\" n'existe pas."
+ ::msgcat::mcset fr "&Directory:" "&R\u00e9pertoire:"
+ ::msgcat::mcset fr "Error: %1\$s" "Erreur: %1\$s"
+ ::msgcat::mcset fr "Exit" "Quitter"
+ ::msgcat::mcset fr "File \"%1\$s\" already exists.\nDo you want to overwrite it?" "Le fichier \"%1\$s\" existe d\u00e9j\u00e0.\nVoulez-vous l'\u00e9craser?"
+ ::msgcat::mcset fr "File \"%1\$s\" already exists.\n\n" "Le fichier \"%1\$s\" existe d\u00e9j\u00e0.\n\n"
+ ::msgcat::mcset fr "File \"%1\$s\" does not exist." "Le fichier \"%1\$s\" n'existe pas."
+ ::msgcat::mcset fr "File &name:" "&Nom de fichier:"
+ ::msgcat::mcset fr "File &names:" "&Noms de fichiers:"
+ ::msgcat::mcset fr "Files of &type:" "&Type de fichiers:"
+ ::msgcat::mcset fr "Fi&les:" "Fich&iers:"
+ ::msgcat::mcset fr "&Filter" "&Filtre"
+ ::msgcat::mcset fr "Fil&ter:" "Fil&tre:"
+ ::msgcat::mcset fr "&Green" "&Vert"
+ ::msgcat::mcset fr "Hi" "Salut"
+ ::msgcat::mcset fr "Hide Console" "Cacher la Console"
+ ::msgcat::mcset fr "&Ignore" "&Ignorer"
+ ::msgcat::mcset fr "Invalid file name \"%1\$s\"." "Nom de fichier invalide \"%1\$s\"."
+ ::msgcat::mcset fr "Log Files" "Fichiers de trace"
+ ::msgcat::mcset fr "&No" "&Non"
+ ::msgcat::mcset fr "&OK"
+ ::msgcat::mcset fr "Ok"
+ ::msgcat::mcset fr "Open" "Ouvrir"
+ ::msgcat::mcset fr "&Open" "&Ouvrir"
+ ::msgcat::mcset fr "Open Multiple Files" "Ouvrir plusieurs fichiers"
+ ::msgcat::mcset fr "Paste" "Coller"
+ ::msgcat::mcset fr "Quit" "Quitter"
+ ::msgcat::mcset fr "&Red" "&Rouge"
+ ::msgcat::mcset fr "Replace existing file?" "Remplacer le fichier existant?"
+ ::msgcat::mcset fr "&Retry" "&R\u00e9-essayer"
+ ::msgcat::mcset fr "&Save" "&Sauvegarder"
+ ::msgcat::mcset fr "Save As" "Sauvegarder sous"
+ ::msgcat::mcset fr "Save To Log" "Sauvegarde au fichier de trace"
+ ::msgcat::mcset fr "Select Log File" "Choisir un fichier de trace"
+ ::msgcat::mcset fr "Select a file to source" "Choisir un fichier \u00e0 \u00e9valuer"
+ ::msgcat::mcset fr "&Selection:" "&S\u00e9lection:"
+ ::msgcat::mcset fr "Skip Messages" "Omettre les messages"
+ ::msgcat::mcset fr "Source..." "\u00c9valuer..."
+ ::msgcat::mcset fr "Tcl Scripts" "Scripts Tcl"
+ ::msgcat::mcset fr "Tcl for Windows" "Tcl pour Windows"
+ ::msgcat::mcset fr "Text Files" "Fichiers texte"
+ ::msgcat::mcset fr "&Yes" "&Oui"
+ ::msgcat::mcset fr "abort" "abandonner"
+ ::msgcat::mcset fr "blue" "bleu"
+ ::msgcat::mcset fr "cancel" "annuler"
+ ::msgcat::mcset fr "extension"
+ ::msgcat::mcset fr "extensions"
+ ::msgcat::mcset fr "green" "vert"
+ ::msgcat::mcset fr "ignore" "ignorer"
+ ::msgcat::mcset fr "ok"
+ ::msgcat::mcset fr "red" "rouge"
+ ::msgcat::mcset fr "retry" "r\u00e9essayer"
+ ::msgcat::mcset fr "yes" "oui"
+}
diff --git a/ext/tk/sample/msgs_tk/it.msg b/ext/tk/sample/msgs_tk/it.msg
new file mode 100644
index 0000000000..b144fcc073
--- /dev/null
+++ b/ext/tk/sample/msgs_tk/it.msg
@@ -0,0 +1,84 @@
+namespace eval ::tkmsgcat_demo {
+ ::msgcat::mcset it "Application Error" "Errore dell' applicazione"
+ ::msgcat::mcset it "Blue" "Blu"
+ ::msgcat::mcset it "Color" "Colore"
+ ::msgcat::mcset it "Delete" "Incolla"
+ ::msgcat::mcset it "Error" "Errore"
+ ::msgcat::mcset it "Exit" "Esci"
+ ::msgcat::mcset it "Green" "Verde"
+ ::msgcat::mcset it "Red" "Rosso"
+ ::msgcat::mcset it "blue" "blu"
+ ::msgcat::mcset it "green" "verde"
+ ::msgcat::mcset it "red" "rosso"
+}
+
+namespace eval ::tk {
+ ::msgcat::mcset it "&Abort" "&Interrompi"
+ ::msgcat::mcset it "About..." "Informazioni ..."
+ ::msgcat::mcset it "All Files" "Tutti i file"
+ ::msgcat::mcset it "Application Error" "Errore dell' applicazione"
+ ::msgcat::mcset it "&Blue" "&Blu"
+ ::msgcat::mcset it "&Cancel" "&Annulla"
+ ::msgcat::mcset it "Cannot change to the directory \"%1\$s\".\nPermission denied." "Impossibile accedere alla directory \"%1\$s\".\nPermesso negato."
+ ::msgcat::mcset it "Choose Directory" "Scegli directory"
+ ::msgcat::mcset it "Clear" "Azzera"
+ ::msgcat::mcset it "Color" "Colore"
+ ::msgcat::mcset it "Console"
+ ::msgcat::mcset it "Copy" "Copia"
+ ::msgcat::mcset it "Cut" "Taglia"
+ ::msgcat::mcset it "Delete" "Incolla"
+ ::msgcat::mcset it "Details >>" "Dettagli >>"
+ ::msgcat::mcset it "Directory \"%1\$s\" does not exist." "La directory \"%1\$s\" non esiste."
+ ::msgcat::mcset it "&Directory:"
+ ::msgcat::mcset it "Error: %1\$s" "Errore: %1\$s"
+ ::msgcat::mcset it "Exit" "Esci"
+ ::msgcat::mcset it "File \"%1\$s\" already exists.\nDo you want to overwrite it?" "Il file \"%1\$s\" esiste gi\u00e0.\nVuoi sovrascriverlo?"
+ ::msgcat::mcset it "File \"%1\$s\" already exists.\n\n" "Il file \"%1\$s\" esiste gi\u00e0.\n\n"
+ ::msgcat::mcset it "File \"%1\$s\" does not exist." "Il file \"%1\$s\" non esiste."
+ ::msgcat::mcset it "File &name:" "&Nome del file:"
+ ::msgcat::mcset it "File &names:" "&Nomi dei file:"
+ ::msgcat::mcset it "Files of &type:" "File di &tipo:"
+ ::msgcat::mcset it "Fi&les:" "Fi&le:"
+ ::msgcat::mcset it "&Filter" "&Filtro"
+ ::msgcat::mcset it "Fil&ter:" "Fil&tro:"
+ ::msgcat::mcset it "&Green" "&Verde"
+ ::msgcat::mcset it "Hi" "Salve"
+ ::msgcat::mcset it "Hide Console" "Nascondi la console"
+ ::msgcat::mcset it "&Ignore" "&Ignora"
+ ::msgcat::mcset it "Invalid file name \"%1\$s\"." "Nome di file non valido \"%1\$s\"."
+ ::msgcat::mcset it "Log Files" "File di log"
+ ::msgcat::mcset it "&No"
+ ::msgcat::mcset it "&OK"
+ ::msgcat::mcset it "Ok"
+ ::msgcat::mcset it "&Open" "A&pri"
+ ::msgcat::mcset it "Open" "Apri"
+ ::msgcat::mcset it "Open Multiple Files" "Apri file multipli"
+ ::msgcat::mcset it "Paste" "Incolla"
+ ::msgcat::mcset it "Quit" "Esci"
+ ::msgcat::mcset it "&Red" "&Rosso"
+ ::msgcat::mcset it "Replace existing file?" "Sostituisci il file esistente?"
+ ::msgcat::mcset it "&Retry" "&Riprova"
+ ::msgcat::mcset it "&Save" "&Salva"
+ ::msgcat::mcset it "Save As" "Salva come"
+ ::msgcat::mcset it "Save To Log" "Salva il log"
+ ::msgcat::mcset it "Select Log File" "Scegli un file di log"
+ ::msgcat::mcset it "Select a file to source" "Scegli un file da eseguire"
+ ::msgcat::mcset it "&Selection:" "&Selezione:"
+ ::msgcat::mcset it "Skip Messages" "Salta i messaggi"
+ ::msgcat::mcset it "Source..." "Esegui..."
+ ::msgcat::mcset it "Tcl Scripts" "Scripts Tcl"
+ ::msgcat::mcset it "Tcl for Windows" "Tcl per Windows"
+ ::msgcat::mcset it "Text Files" "File di testo"
+ ::msgcat::mcset it "&Yes" "&Si"
+ ::msgcat::mcset it "abort" "interrompi"
+ ::msgcat::mcset it "blue" "blu"
+ ::msgcat::mcset it "cancel" "annulla"
+ ::msgcat::mcset it "extension" "estensione"
+ ::msgcat::mcset it "extensions" "estensioni"
+ ::msgcat::mcset it "green" "verde"
+ ::msgcat::mcset it "ignore" "ignora"
+ ::msgcat::mcset it "ok"
+ ::msgcat::mcset it "red" "rosso"
+ ::msgcat::mcset it "retry" "riprova"
+ ::msgcat::mcset it "yes" "si"
+}
diff --git a/ext/tk/sample/msgs_tk/ja.msg b/ext/tk/sample/msgs_tk/ja.msg
new file mode 100644
index 0000000000..44a25839db
--- /dev/null
+++ b/ext/tk/sample/msgs_tk/ja.msg
@@ -0,0 +1,13 @@
+namespace eval ::tkmsgcat_demo {
+ ::msgcat::mcset ja "Application Error" "\u30A2\u30D7\u30EA\u30B1\u30FC\u30B7\u30E7\u30F3\u30A8\u30E9\u30FC"
+ ::msgcat::mcset ja "Blue" "\u9752"
+ ::msgcat::mcset ja "Color" "\u80CC\u666F\u8272"
+ ::msgcat::mcset ja "Delete" "\u6D88\u53BB"
+ ::msgcat::mcset ja "Error" "\u30A8\u30E9\u30FC"
+ ::msgcat::mcset ja "Exit" "\u7D42\u4E86"
+ ::msgcat::mcset ja "Green" "\u7DD1"
+ ::msgcat::mcset ja "Red" "\u8D64"
+ ::msgcat::mcset ja "blue" "\u9752"
+ ::msgcat::mcset ja "green" "\u7DD1"
+ ::msgcat::mcset ja "red" "\u8D64"
+}
diff --git a/ext/tk/sample/msgs_tk/license.terms b/ext/tk/sample/msgs_tk/license.terms
new file mode 100644
index 0000000000..03ca6fcb31
--- /dev/null
+++ b/ext/tk/sample/msgs_tk/license.terms
@@ -0,0 +1,39 @@
+This software is copyrighted by the Regents of the University of
+California, Sun Microsystems, Inc., and other parties. The following
+terms apply to all files associated with the software unless explicitly
+disclaimed in individual files.
+
+The authors hereby grant permission to use, copy, modify, distribute,
+and license this software and its documentation for any purpose, provided
+that existing copyright notices are retained in all copies and that this
+notice is included verbatim in any distributions. No written agreement,
+license, or royalty fee is required for any of the authorized uses.
+Modifications to this software may be copyrighted by their authors
+and need not follow the licensing terms described here, provided that
+the new terms are clearly indicated on the first page of each file where
+they apply.
+
+IN NO EVENT SHALL THE AUTHORS OR DISTRIBUTORS BE LIABLE TO ANY PARTY
+FOR DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES
+ARISING OUT OF THE USE OF THIS SOFTWARE, ITS DOCUMENTATION, OR ANY
+DERIVATIVES THEREOF, EVEN IF THE AUTHORS HAVE BEEN ADVISED OF THE
+POSSIBILITY OF SUCH DAMAGE.
+
+THE AUTHORS AND DISTRIBUTORS SPECIFICALLY DISCLAIM ANY WARRANTIES,
+INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE, AND NON-INFRINGEMENT. THIS SOFTWARE
+IS PROVIDED ON AN "AS IS" BASIS, AND THE AUTHORS AND DISTRIBUTORS HAVE
+NO OBLIGATION TO PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR
+MODIFICATIONS.
+
+GOVERNMENT USE: If you are acquiring this software on behalf of the
+U.S. government, the Government shall have only "Restricted Rights"
+in the software and related documentation as defined in the Federal
+Acquisition Regulations (FARs) in Clause 52.227.19 (c) (2). If you
+are acquiring the software on behalf of the Department of Defense, the
+software shall be classified as "Commercial Computer Software" and the
+Government shall have only "Restricted Rights" as defined in Clause
+252.227-7013 (c) (1) of DFARs. Notwithstanding the foregoing, the
+authors grant the U.S. Government and others acting in its behalf
+permission to use and distribute the software in accordance with the
+terms specified in this license.
diff --git a/ext/tk/sample/msgs_tk/nl.msg b/ext/tk/sample/msgs_tk/nl.msg
new file mode 100644
index 0000000000..d9642e808c
--- /dev/null
+++ b/ext/tk/sample/msgs_tk/nl.msg
@@ -0,0 +1,123 @@
+namespace eval ::tkmsgcat_demo {
+ ::msgcat::mcset nl "Application Error" "Toepassingsfout"
+ ::msgcat::mcset nl "Blue" "Blauw"
+ ::msgcat::mcset nl "Color" "Kleur"
+ ::msgcat::mcset nl "Delete" "Wissen"
+ ::msgcat::mcset nl "Error" "Fout"
+ ::msgcat::mcset nl "Exit" "Be\u00ebindigen"
+ ::msgcat::mcset nl "Green" "Groen"
+ ::msgcat::mcset nl "Red" "Rood"
+ ::msgcat::mcset nl "blue" "blauw"
+ ::msgcat::mcset nl "green" "groen"
+ ::msgcat::mcset nl "red" "rood"
+}
+
+namespace eval ::tk {
+ ::msgcat::mcset nl "\"%1\$s\" must be an absolute pathname" "\"%1\$s\" moet een absolute pad-naam zijn"
+ ::msgcat::mcset nl "%1\$s is not a toplevel window" "%1\$s is geen toplevel window"
+ ::msgcat::mcset nl ", or" ", of"
+ ::msgcat::mcset nl "-default, -icon, -message, -parent, -title, or -type" "-default, -icon, -message, -parent, -title, of -type"
+ ::msgcat::mcset nl "-initialdir, -mustexist, -parent, or -title" "-initialdir, -mustexist, -parent, of -title"
+ ::msgcat::mcset nl "&Abort" "&Afbreken"
+ ::msgcat::mcset nl "About..." "Over..."
+ ::msgcat::mcset nl "All Files" "Alle Bestanden"
+ ::msgcat::mcset nl "Application Error" "Toepassingsfout"
+ ::msgcat::mcset nl "&Blue" "&Blauw"
+ ::msgcat::mcset nl "&Cancel" "&Annuleren"
+ ::msgcat::mcset nl "Cannot change to the directory \"%1\$s\".\nPermission denied." "Kan niet naar map \"%1\$s\" gaan.\nU heeft hiervoor geen toestemming."
+ ::msgcat::mcset nl "Choose Directory" "Kies map"
+ ::msgcat::mcset nl "Clear" "Wissen"
+ ::msgcat::mcset nl "Clear entry, Press OK; Enter %1\$s, press OK" "Wis veld, Druk op OK; typ %1\$s in, druk op OK"
+ ::msgcat::mcset nl "&Clear Console" "&Wis Console"
+ ::msgcat::mcset nl "Color" "Kleur"
+ ::msgcat::mcset nl "Console"
+ ::msgcat::mcset nl "Copy" "Kopi\u00ebren"
+ ::msgcat::mcset nl "Cut" "Knippen"
+ ::msgcat::mcset nl "Delete" "Wissen"
+ ::msgcat::mcset nl "Details"
+ ::msgcat::mcset nl "Details >>"
+ ::msgcat::mcset nl "Directory \"%1\$s\" does not exist." "Map \"%1\$s\" bestaat niet."
+ ::msgcat::mcset nl "&Directory:" "&Map:"
+ ::msgcat::mcset nl "Edit" "Bewerken"
+ ::msgcat::mcset nl "Enter \"%1\$s\", press OK" "Typ \"%1\$s\", druk op OK"
+ ::msgcat::mcset nl "Enter \"%1\$s\", press OK, enter \"%2\$s\", press OK" "Typ \"%1\$s\", druk op OK, typ \"%2\$s\", druk op OK"
+ ::msgcat::mcset nl "Error: %1\$s" "Fout: %1\$s"
+ ::msgcat::mcset nl "Exit" "Be\u00ebindigen"
+ ::msgcat::mcset nl "File" "Bestand"
+ ::msgcat::mcset nl "File \"%1\$s\" already exists.\n\n" "Bestand \"%1\$s\" bestaat al.\n\n"
+ ::msgcat::mcset nl "File \"%1\$s\" already exists.\nDo you want to overwrite it?" "Bestand \"%1\$s\" bestaat al.\nWilt u het overschrijven?"
+ ::msgcat::mcset nl "File \"%1\$s\" does not exist." "Bestand \"%1\$s\" bestaat niet."
+ ::msgcat::mcset nl "File &name:" "Bestands&naam:"
+ ::msgcat::mcset nl "File &names:" "Bestands&namen:"
+ ::msgcat::mcset nl "Files of &type:" "Bestanden van het &type:"
+ ::msgcat::mcset nl "Fi&les:" "&Bestanden:"
+ ::msgcat::mcset nl "&Filter"
+ ::msgcat::mcset nl "Fil&ter:"
+ ::msgcat::mcset nl "&Green" "&Groen"
+ ::msgcat::mcset nl "Hi" "H\u00e9"
+ ::msgcat::mcset nl "Hide Console" "Verberg Console"
+ ::msgcat::mcset nl "&Ignore" "&Negeren"
+ ::msgcat::mcset nl "Invalid file name \"%1\$s\"." "Ongeldige bestandsnaam \"%1\$s\"."
+ ::msgcat::mcset nl "Log Files" "Log Bestanden"
+ ::msgcat::mcset nl "&No" "&Nee"
+ ::msgcat::mcset nl "&OK"
+ ::msgcat::mcset nl "Ok"
+ ::msgcat::mcset nl "&Open" "&Openen"
+ ::msgcat::mcset nl "Open" "Openen"
+ ::msgcat::mcset nl "Open Multiple Files" "Open meerdere bestanden"
+ ::msgcat::mcset nl "Paste" "Plakken"
+ ::msgcat::mcset nl "Please press %1\$s" "Druk op %1\$s, A.U.B."
+ ::msgcat::mcset nl "Please press ok" "Druk op ok, A.U.B."
+ ::msgcat::mcset nl "Press Cancel" "Druk op Annuleren"
+ ::msgcat::mcset nl "Press Ok" "Druk op Ok"
+ ::msgcat::mcset nl "Quit" "Stoppen"
+ ::msgcat::mcset nl "&Red" "&Rood"
+ ::msgcat::mcset nl "Replace existing file?" "Vervang bestaand bestand?"
+ ::msgcat::mcset nl "&Retry" "&Herhalen"
+ ::msgcat::mcset nl "&Save" "Op&slaan"
+ ::msgcat::mcset nl "Save As" "Opslaan als"
+ ::msgcat::mcset nl "Save To Log" "Opslaan naar Log"
+ ::msgcat::mcset nl "Select Log File" "Selecteer Log bestand"
+ ::msgcat::mcset nl "Select a file to source" "Selecteer bronbestand"
+ ::msgcat::mcset nl "&Selection:" "&Selectie:"
+ ::msgcat::mcset nl "Skip Messages" "Berichten overslaan"
+ ::msgcat::mcset nl "Source..." "Bron..."
+ ::msgcat::mcset nl "Tcl Scripts"
+ ::msgcat::mcset nl "Tcl for Windows" "Tcl voor Windows"
+ ::msgcat::mcset nl "Text Files" "Tekstbestanden"
+ ::msgcat::mcset nl "&Yes" "&Ja"
+ ::msgcat::mcset nl "abort" "afbreken"
+ ::msgcat::mcset nl "abort, retry, ignore, ok, cancel, no, or yes" "afbreken, opnieuw, negeren, ok, annuleren, nee, of ja"
+ ::msgcat::mcset nl "abortretryignore, ok, okcancel, retrycancel, yesno, or yesnocancel" "abortretryignore, ok, okcancel, retrycancel, yesno, of yesnocancel"
+ ::msgcat::mcset nl "bad %1\$s value \"%2\$s\": must be %3\$s" "verkeerde %1\$s waarde \"%2\$s\": moet zijn %3\$s"
+ ::msgcat::mcset nl "bad file type \"%1\$s\", should be" "verkeerd bestandstype \"%1\$s\", moet zijn"
+ ::msgcat::mcset nl "bad option \"%1\$s\": should be %2\$s" "verkeerde optie \"%1\$s\": moet zijn %2\$s"
+ ::msgcat::mcset nl "bad window path name \"%1\$s\"" "verkeerde window-padnaam \"%1\$s\""
+ ::msgcat::mcset nl "blue" "blauw"
+ ::msgcat::mcset nl "can't post %1\$s: it isn't a descendant of %2\$s (this is a new requirement in Tk versions 3.0 and later)" "kan %1\$s niet verzenden: het is geen afstammeling van %2\$s (dit is een nieuwe eis in Tk versies 3.0 en later)"
+ ::msgcat::mcset nl "cancel" "annuleren"
+ ::msgcat::mcset nl "default button index greater than number of buttons specified for tk_dialog" "default knop index is groter dan het aantal knoppen beschikbaar voor tk_dialog"
+ ::msgcat::mcset nl "display name to use (current one otherwise)" "te gebruiken schermnaam (anders huidige scherm)"
+ ::msgcat::mcset nl "error, info, question, or warning" "error, info, question, of warning"
+ ::msgcat::mcset nl "extension"
+ ::msgcat::mcset nl "extensions"
+ ::msgcat::mcset nl "focus group \"%1\$s\" doesn't exist" "focusgroep \"%1\$s\" bestaat niet"
+ ::msgcat::mcset nl "green" "groen"
+ ::msgcat::mcset nl "history event %1\$s"
+ ::msgcat::mcset nl "ignore" "negeren"
+ ::msgcat::mcset nl "invalid default button \"%1\$s\"" "ongeldige default knop \"%1\$s\""
+ ::msgcat::mcset nl "macType"
+ ::msgcat::mcset nl "macTypes"
+ ::msgcat::mcset nl "must specify a background color" "een achtergrondkleur is verplicht"
+ ::msgcat::mcset nl "name of the slave interpreter" "naam van de slaaf-interpreter"
+ ::msgcat::mcset nl "no winfo screen . nor env(DISPLAY)" "geen winfo scherm . noch env(DISPLAY)"
+ ::msgcat::mcset nl "ok"
+ ::msgcat::mcset nl "red" "rood"
+ ::msgcat::mcset nl "retry" "opnieuw"
+ ::msgcat::mcset nl "should contain 5 or 4 elements" "moet 4 of 5 elementen bevatten"
+ ::msgcat::mcset nl "spec"
+ ::msgcat::mcset nl "tk_chooseDirectory command" "tk_chooseDirectory opdracht"
+ ::msgcat::mcset nl "tk_chooseDirectory command, cancel gives null" "tk_chooseDirectory opdracht, annuleren geeft lege waarde"
+ ::msgcat::mcset nl "tk_chooseDirectory command, initialdir" "tk_chooseDirectory opdracht, initi\u00eble map"
+ ::msgcat::mcset nl "yes" "ja"
+}
diff --git a/ext/tk/sample/msgs_tk/pl.msg b/ext/tk/sample/msgs_tk/pl.msg
new file mode 100644
index 0000000000..2699e42bdf
--- /dev/null
+++ b/ext/tk/sample/msgs_tk/pl.msg
@@ -0,0 +1,87 @@
+namespace eval ::tkmsgcat_demo {
+ ::msgcat::mcset pl "Application Error" "Bl\u0105d w Programie"
+ ::msgcat::mcset pl "Blue" "Niebieski"
+ ::msgcat::mcset pl "Color" "Kolor"
+ ::msgcat::mcset pl "Delete" "Usu\u0144"
+ ::msgcat::mcset pl "Error" "B\u0142\u0105d"
+ ::msgcat::mcset pl "Exit" "Zako\u0144cz"
+ ::msgcat::mcset pl "Green" "Zielony"
+ ::msgcat::mcset pl "Red" "Czerwonz"
+ ::msgcat::mcset pl "blue" "niebieski"
+ ::msgcat::mcset pl "green" "zielony"
+ ::msgcat::mcset pl "red" "czerwony"
+}
+
+namespace eval ::tk {
+ ::msgcat::mcset pl "&Abort" "&Anuluj"
+ ::msgcat::mcset pl "&About..." "O Programie..."
+ ::msgcat::mcset pl "All Files" "Wszystkie pliki"
+ ::msgcat::mcset pl "Application Error" "Bl\u0105d w Programie"
+ ::msgcat::mcset pl "&Blue" "&Niebieski"
+ ::msgcat::mcset pl "&Cancel" "&Anuluj"
+ ::msgcat::mcset pl "Cannot change to the directory \"%1\$s\".\nPermission denied." "Katalog \"%1\$s\" nie mo\u017ce zosta\u0107 odczytany lub nie istnieje."
+ ::msgcat::mcset pl "Choose Directory" "Wybierz katalog"
+ ::msgcat::mcset pl "&Clear" "&Wyczy\u015b\u0107"
+ ::msgcat::mcset pl "&Clear Console" "&Wyczy\u015b\u0107 konsol\u0119"
+ ::msgcat::mcset pl "Color" "Kolor"
+ ::msgcat::mcset pl "Console" "Konsola"
+ ::msgcat::mcset pl "&Copy" "&Kopiuj"
+ ::msgcat::mcset pl "Cu&t" "&Wytnij"
+ ::msgcat::mcset pl "&Delete" "&Usu\u0144"
+ ::msgcat::mcset pl "Details >>" "Detale >>"
+ ::msgcat::mcset pl "Directory \"%1\$s\" does not exist." "Katalog \"%1\$s\" nie istniej."
+ ::msgcat::mcset pl "&Directory:" "&Katalog:"
+ ::msgcat::mcset pl "&Edit" "&Edytuj"
+ ::msgcat::mcset pl "Error: %1\$s" "B\u0142\u0105d: %1\$s"
+ ::msgcat::mcset pl "E&xit" "&Zako\u0144cz"
+ ::msgcat::mcset pl "&File" "&Plik"
+ ::msgcat::mcset pl "File \"%1\$s\" already exists.\nDo you want to overwrite it?" "Plik \"%1\$s\" ju\u017c istnieje.\nCzy chcesz go zast\u0105pi\u0107?"
+ ::msgcat::mcset pl "File \"%1\$s\" already exists.\n\n" "Plik \"%1\$s\" ju\u017c istnieje. \n\n"
+ ::msgcat::mcset pl "File \"%1\$s\" does not exist." "Plik \"%1\$s\" nie istnieje."
+ ::msgcat::mcset pl "File &name:" "Nazwa &pliku:"
+ ::msgcat::mcset pl "File &names:" "Nazwy &plik\u00f3w:"
+ ::msgcat::mcset pl "Files of &type:" "Pliki &typu:"
+ ::msgcat::mcset pl "Fi&les:" "Pli&ki:"
+ ::msgcat::mcset pl "&Filter" "&Filter"
+ ::msgcat::mcset pl "Fil&ter:" "&Filter:"
+ ::msgcat::mcset pl "&Green" "&Zielony"
+ ::msgcat::mcset pl "&Help" "&Pomoc"
+ ::msgcat::mcset pl "Hi" "Witaj"
+ ::msgcat::mcset pl "&Hide Console" "&Schowaj konsol\u0119"
+ ::msgcat::mcset pl "&Ignore" "&Ignoruj"
+ ::msgcat::mcset pl "Invalid file name \"%1\$s\"." "Niew\u0142a\u015bciwa nazwa pliku \"%1\$s\"."
+ ::msgcat::mcset pl "Log Files" "Protoko\u0142uj"
+ ::msgcat::mcset pl "&No" "&Nie"
+ ::msgcat::mcset pl "OK"
+ ::msgcat::mcset pl "Ok"
+ ::msgcat::mcset pl "Open" "Wczytaj"
+ ::msgcat::mcset pl "&Open" "&Wczytaj"
+ ::msgcat::mcset pl "Open Multiple Files" "Wczytuj wiele plik\u00f3w"
+ ::msgcat::mcset pl "P&aste" "&Wklej"
+ ::msgcat::mcset pl "&Quit" "&Zako\u0144cz"
+ ::msgcat::mcset pl "&Red" "&Czerwonz"
+ ::msgcat::mcset pl "Replace existing file?" "Czy zost\u0105pi\u0107 instniej\u0105cy plik?"
+ ::msgcat::mcset pl "&Retry" "&Powt\u00f3rz"
+ ::msgcat::mcset pl "&Save" "&Zapisz"
+ ::msgcat::mcset pl "Save As" "Zapisz jako"
+ ::msgcat::mcset pl "Save To Log" "Wpisz do protoko\u0142u"
+ ::msgcat::mcset pl "Select Log File" "Wybierz plik proko\u0142u"
+ ::msgcat::mcset pl "Select a file to source" "Wybierz plik do wykonania"
+ ::msgcat::mcset pl "&Selection:" "&Wyb\u00f3r:"
+ ::msgcat::mcset pl "Skip Messages" "Omi\u0144 pozosta\u0142e komunikaty"
+ ::msgcat::mcset pl "&Source..." "&Kod \u017ar\u00f3d\u0142owy..."
+ ::msgcat::mcset pl "Tcl Scripts" "Tcl-skrypty"
+ ::msgcat::mcset pl "Tcl for Windows" "Tcl dla Okienek (Windows)"
+ ::msgcat::mcset pl "Text Files" "Pliki Tekstowe"
+ ::msgcat::mcset pl "&Yes" "&Tak"
+ ::msgcat::mcset pl "abort" "zako\u0144cz"
+ ::msgcat::mcset pl "blue" "niebieski"
+ ::msgcat::mcset pl "cancel" "anuluj"
+ ::msgcat::mcset pl "extension" "rozszerzenie"
+ ::msgcat::mcset pl "extensions" "rozszerzenia"
+ ::msgcat::mcset pl "green" "zielony"
+ ::msgcat::mcset pl "ignore" "ignoruj"
+ ::msgcat::mcset pl "red" "czerwony"
+ ::msgcat::mcset pl "retry" "potw\u00f3rz"
+ ::msgcat::mcset pl "yes" "tak"
+}
diff --git a/ext/tk/sample/msgs_tk/ru.msg b/ext/tk/sample/msgs_tk/ru.msg
new file mode 100644
index 0000000000..a1192b7095
--- /dev/null
+++ b/ext/tk/sample/msgs_tk/ru.msg
@@ -0,0 +1,87 @@
+namespace eval ::tkmsgcat_demo {
+ ::msgcat::mcset ru "Application Error" "\u041e\u0448\u0438\u0431\u043a\u0430 \u0432 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0435"
+ ::msgcat::mcset ru "Blue" " \u0413\u043e\u043b\u0443\u0431\u043e\u0439"
+ ::msgcat::mcset ru "Color" "\u0426\u0432\u0435\u0442"
+ ::msgcat::mcset ru "Delete" "\u0423\u0434\u0430\u043b\u0438\u0442\u044c"
+ ::msgcat::mcset ru "Error" "\u041e\u0448\u0438\u0431\u043a\u0430"
+ ::msgcat::mcset ru "Exit" "\u0412\u044b\u0445\u043e\u0434"
+ ::msgcat::mcset ru "Green" "\u0417\u0435\u043b\u0435\u043d\u044b\u0439"
+ ::msgcat::mcset ru "Red" "\u041a\u0440\u0430\u0441\u043d\u044b\u0439"
+ ::msgcat::mcset ru "blue" " \u0433\u043e\u043b\u0443\u0431\u043e\u0439"
+ ::msgcat::mcset ru "green" " \u0437\u0435\u043b\u0435\u043d\u044b\u0439"
+ ::msgcat::mcset ru "red" " \u043a\u0440\u0430\u0441\u043d\u044b\u0439"
+}
+
+namespace eval ::tk {
+ ::msgcat::mcset ru "&Abort" "&\u041e\u0442\u043c\u0435\u043d\u0438\u0442\u044c"
+ ::msgcat::mcset ru "About..." "\u041f\u0440\u043e..."
+ ::msgcat::mcset ru "All Files" "\u0412\u0441\u0435 \u0444\u0430\u0439\u043b\u044b"
+ ::msgcat::mcset ru "Application Error" "\u041e\u0448\u0438\u0431\u043a\u0430 \u0432 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0435"
+ ::msgcat::mcset ru "&Blue" " &\u0413\u043e\u043b\u0443\u0431\u043e\u0439"
+ ::msgcat::mcset ru "&Cancel" "\u041e\u0442&\u043c\u0435\u043d\u0430"
+ ::msgcat::mcset ru "Cannot change to the directory \"%1\$s\".\nPermission denied." \
+ "\u041d\u0435 \u043c\u043e\u0433\u0443 \u043f\u0435\u0440\u0435\u0439\u0442\u0438 \u0432 \u043a\u0430\u0442\u0430\u043b\u043e\u0433 \"%1\$s\".\n\u041d\u0435\u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u043f\u0440\u0430\u0432 \u0434\u043e\u0441\u0442\u0443\u043f\u0430"
+ ::msgcat::mcset ru "Choose Directory" "\u0412\u044b\u0431\u0435\u0440\u0438\u0442\u0435 \u043a\u0430\u0442\u0430\u043b\u043e\u0433"
+ ::msgcat::mcset ru "Clear" "\u041e\u0447\u0438\u0441\u0442\u0438\u0442\u044c"
+ ::msgcat::mcset ru "Color" "\u0426\u0432\u0435\u0442"
+ ::msgcat::mcset ru "Console" "\u041a\u043e\u043d\u0441\u043e\u043b\u044c"
+ ::msgcat::mcset ru "Copy" "\u041a\u043e\u043f\u0438\u0440\u043e\u0432\u0430\u0442\u044c"
+ ::msgcat::mcset ru "Cut" "\u0412\u044b\u0440\u0435\u0437\u0430\u0442\u044c"
+ ::msgcat::mcset ru "Delete" "\u0423\u0434\u0430\u043b\u0438\u0442\u044c"
+ ::msgcat::mcset ru "Details >>" "\u041f\u043e\u0434\u0440\u043e\u0431\u043d\u0435\u0435 >>"
+ ::msgcat::mcset ru "Directory \"%1\$s\" does not exist." "\u041a\u0430\u0442\u0430\u043b\u043e\u0433\u0430 \"%1\$s\" \u043d\u0435 \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u0435\u0442."
+ ::msgcat::mcset ru "&Directory:" "&\u041a\u0430\u0442\u0430\u043b\u043e\u0433:"
+ ::msgcat::mcset ru "Error: %1\$s" "\u041e\u0448\u0438\u0431\u043a\u0430: %1\$s"
+ ::msgcat::mcset ru "Exit" "\u0412\u044b\u0445\u043e\u0434"
+ ::msgcat::mcset ru "File \"%1\$s\" already exists.\nDo you want to overwrite it?" \
+ "\u0424\u0430\u0439\u043b \"%1\$s\" \u0443\u0436\u0435 \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u0435\u0442.\n\u0417\u0430\u043c\u0435\u043d\u0438\u0442\u044c \u0435\u0433\u043e?"
+ ::msgcat::mcset ru "File \"%1\$s\" already exists.\n\n" "\u0424\u0430\u0439\u043b \"%1\$s\" \u0443\u0436\u0435 \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u0435\u0442.\n\n"
+ ::msgcat::mcset ru "File \"%1\$s\" does not exist." "\u0424\u0430\u0439\u043b \"%1\$s\" \u043d\u0435 \u043d\u0430\u0439\u0434\u0435\u043d."
+ ::msgcat::mcset ru "File &name:" "&\u0418\u043c\u044f \u0444\u0430\u0439\u043b\u0430:"
+ ::msgcat::mcset ru "File &names:" "&\u0418\u043c\u0435\u043d\u0430 \u0444\u0430\u0439\u043b\u043e\u0432:"
+ ::msgcat::mcset ru "Files of &type:" "&\u0422\u0438\u043f \u0444\u0430\u0439\u043b\u043e\u0432:"
+ ::msgcat::mcset ru "Fi&les:" "\u0424\u0430\u0439&\u043b\u044b:"
+ ::msgcat::mcset ru "&Filter" "&\u0424\u0438\u043b\u044c\u0442\u0440"
+ ::msgcat::mcset ru "Fil&ter:" "\u0424\u0438\u043b\u044c&\u0442\u0440:"
+ ::msgcat::mcset ru "&Green" " &\u0417\u0435\u043b\u0435\u043d\u044b\u0439"
+ ::msgcat::mcset ru "Hi" "\u041f\u0440\u0438\u0432\u0435\u0442"
+ ::msgcat::mcset ru "Hide Console" "\u0421\u043f\u0440\u044f\u0442\u0430\u0442\u044c \u043a\u043e\u043d\u0441\u043e\u043b\u044c"
+ ::msgcat::mcset ru "&Ignore" "&\u0418\u0433\u043d\u043e\u0440\u0438\u0440\u043e\u0432\u0430\u0442\u044c"
+ ::msgcat::mcset ru "Invalid file name \"%1\$s\"." "\u041d\u0435\u0432\u0435\u0440\u043d\u043e\u0435 \u0438\u043c\u044f \u0444\u0430\u0439\u043b\u0430 \"%1\$s\"."
+ ::msgcat::mcset ru "Log Files" "\u0424\u0430\u0439\u043b\u044b \u0436\u0443\u0440\u043d\u0430\u043b\u0430"
+ ::msgcat::mcset ru "&No" "&\u041d\u0435\u0442"
+ ::msgcat::mcset ru "&OK" "&\u041e\u041a"
+ ::msgcat::mcset ru "Ok" "\u0414\u0430"
+ ::msgcat::mcset ru "Open" "\u041e\u0442\u043a\u0440\u044b\u0442\u044c"
+ ::msgcat::mcset ru "&Open" "&\u041e\u0442\u043a\u0440\u044b\u0442\u044c"
+ ::msgcat::mcset ru "Open Multiple Files" "\u041e\u0442\u043a\u0440\u044b\u0442\u044c \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0444\u0430\u0439\u043b\u043e\u0432"
+ ::msgcat::mcset ru "Paste" "\u0412\u0441\u0442\u0430\u0432\u0438\u0442\u044c"
+ ::msgcat::mcset ru "Quit" "\u0412\u044b\u0445\u043e\u0434"
+ ::msgcat::mcset ru "&Red" " &\u041a\u0440\u0430\u0441\u043d\u044b\u0439"
+ ::msgcat::mcset ru "Replace existing file?" "\u0417\u0430\u043c\u0435\u043d\u0438\u0442\u044c \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u044e\u0449\u0438\u0439 \u0444\u0430\u0439\u043b?"
+ ::msgcat::mcset ru "&Retry" "&\u041f\u043e\u0432\u0442\u043e\u0440\u0438\u0442\u044c"
+ ::msgcat::mcset ru "&Save" "&\u0421\u043e\u0445\u0440\u0430\u043d\u0438\u0442\u044c"
+ ::msgcat::mcset ru "Save As" "\u0421\u043e\u0445\u0440\u0430\u043d\u0438\u0442\u044c \u043a\u0430\u043a"
+ ::msgcat::mcset ru "Save To Log" "\u0421\u043e\u0445\u0440\u0430\u043d\u0438\u0442\u044c \u0432 \u0436\u0443\u0440\u043d\u0430\u043b"
+ ::msgcat::mcset ru "Select Log File" "\u0412\u044b\u0431\u0440\u0430\u0442\u044c \u0436\u0443\u0440\u043d\u0430\u043b"
+ ::msgcat::mcset ru "Select a file to source" "\u0412\u044b\u0431\u0435\u0440\u0438\u0442\u0435 \u0444\u0430\u0439\u043b \u0434\u043b\u044f \u0438\u043d\u0442\u0435\u0440\u043f\u0440\u0435\u0442\u0430\u0446\u0438\u0438"
+ ::msgcat::mcset ru "&Selection:" "&Selection:"
+ ::msgcat::mcset ru "Skip Messages" "\u041f\u0440\u043e\u043f\u0443\u0441\u0442\u0438\u0442\u044c \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u044f"
+ ::msgcat::mcset ru "Source..." "\u0418\u043d\u0442\u0435\u0440\u043f\u0440\u0435\u0442\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0444\u0430\u0439\u043b..."
+ ::msgcat::mcset ru "Tcl Scripts" "\u041f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0430 \u043d\u0430 \u044f\u0437\u044b\u043a\u0435 TCL"
+ ::msgcat::mcset ru "Tcl for Windows" "TCL \u0434\u043b\u044f Windows"
+ ::msgcat::mcset ru "Text Files" "\u0422\u0435\u043a\u0441\u0442\u043e\u0432\u044b\u0435 \u0444\u0430\u0439\u043b\u044b"
+ ::msgcat::mcset ru "&Yes" "&\u0414\u0430"
+ ::msgcat::mcset ru "abort" "\u043e\u0442\u043c\u0435\u043d\u0430"
+ ::msgcat::mcset ru "blue" " \u0433\u043e\u043b\u0443\u0431\u043e\u0439"
+ ::msgcat::mcset ru "cancel" "\u043e\u0442\u043c\u0435\u043d\u0430"
+ ::msgcat::mcset ru "extension" "\u0440\u0430\u0441\u0448\u0438\u0440\u0435\u043d\u0438\u0435"
+ ::msgcat::mcset ru "extensions" "\u0440\u0430\u0441\u0448\u0438\u0440\u0435\u043d\u0438\u044f"
+ ::msgcat::mcset ru "green" " \u0437\u0435\u043b\u0435\u043d\u044b\u0439"
+ ::msgcat::mcset ru "ignore" "\u043f\u0440\u043e\u043f\u0443\u0441\u0442\u0438\u0442\u044c"
+ ::msgcat::mcset ru "ok" "\u043e\u043a"
+ ::msgcat::mcset ru "red" " \u043a\u0440\u0430\u0441\u043d\u044b\u0439"
+ ::msgcat::mcset ru "retry" "\u043f\u043e\u0432\u0442\u043e\u0440\u0438\u0442\u044c"
+ ::msgcat::mcset ru "yes" "\u0434\u0430"
+}
+
diff --git a/ext/tk/sample/propagate.rb b/ext/tk/sample/propagate.rb
new file mode 100644
index 0000000000..a6fbc9725a
--- /dev/null
+++ b/ext/tk/sample/propagate.rb
@@ -0,0 +1,30 @@
+#!/usr/bin/env ruby
+require 'tk'
+
+TkLabel.new(:text=>"Please click the bottom frame").pack
+
+f = TkFrame.new(:width=>400, :height=>100, :background=>'yellow',
+ :relief=>'ridge', :borderwidth=>5).pack
+
+# TkPack.propagate(f, false) # <== important!!
+f.pack_propagate(false) # <== important!!
+
+list = (1..3).collect{|n|
+ TkButton.new(f, :text=>"button#{'-X'*n}"){
+ command proc{
+ puts "button#{'-X'*n}"
+ self.unpack
+ }
+ }
+}
+
+list.unshift(nil)
+
+f.bind('1', proc{
+ w = list.shift
+ w.unpack if w
+ list.push(w)
+ list[0].pack(:expand=>true, :anchor=>:center) if list[0]
+ })
+
+Tk.mainloop
diff --git a/ext/tk/sample/tkmsgcat-load_rb.rb b/ext/tk/sample/tkmsgcat-load_rb.rb
new file mode 100644
index 0000000000..6a3289e061
--- /dev/null
+++ b/ext/tk/sample/tkmsgcat-load_rb.rb
@@ -0,0 +1,102 @@
+#!/usr/bin/env ruby
+
+require 'tk'
+
+demo_dir = File.dirname($0)
+msgcat_dir = [demo_dir, 'msgs_rb'].join(File::Separator)
+top_win = nil
+#msgcat = TkMsgCatalog.new('::tk')
+msgcat = TkMsgCatalog.new('::tkmsgcat_demo')
+default_locale = msgcat.locale
+#msgcat.load_rb(msgcat_dir)
+msgcat.load(msgcat_dir)
+
+col_proc = TkComm.install_bind(proc{|w, color, frame, label|
+ TkComm.window(frame).background(color)
+ Tk.update
+ TkComm.window(label).text(
+ msgcat["%1$s:: %2$s", 'Color',
+ color.capitalize])
+ w.flash; w.flash
+ Tk.callback_break;
+ }, "%W")
+
+del_proc = TkComm.install_cmd(proc{top_win.destroy; top_win = nil})
+
+err_proc = TkComm.install_cmd(proc{fail(RuntimeError,
+ msgcat['Application Error'])})
+
+show_sample = proc{|loc|
+ top_win = TkToplevel.new(:title=>loc)
+
+ msgcat.locale = loc
+ #msgcat.load_rb(msgcat_dir)
+ msgcat.load(msgcat_dir)
+
+ TkLabel.new(top_win){
+ text "preferences:: #{msgcat.preferences.join(' ')}"
+ pack(:pady=>10, :padx=>10)
+ }
+
+ lbl = TkLabel.new(top_win, :text=>msgcat["%1$s:: %2$s",
+ 'Color', '']).pack(:anchor=>'w')
+
+ bg = TkFrame.new(top_win).pack(:ipadx=>20, :ipady=>10,
+ :expand=>true, :fill=>:both)
+
+ TkFrame.new(bg){|f|
+ ['blue', 'green', 'red'].each{|col|
+ TkButton.new(f, :text=>msgcat[col]){
+ bind('ButtonRelease-1', col_proc, "#{col} #{bg.path} #{lbl.path}")
+ }.pack(:fill=>:x)
+ }
+ }.pack(:anchor=>'center', :pady=>15)
+
+ TkFrame.new(top_win){|f|
+ TkButton.new(f, :text=>msgcat['Delete'],
+ :command=>del_proc).pack(:side=>:right, :padx=>5)
+ TkButton.new(f, :text=>msgcat['Error'],
+ :command=>err_proc).pack(:side=>:left, :padx=>5)
+ }.pack(:side=>:bottom, :fill=>:x)
+
+ top_win
+}
+
+
+# listbox for locale list
+TkLabel.new(:text=>"Please click a locale.").pack(:padx=>5, :pady=>3)
+
+TkFrame.new{|f|
+ TkButton.new(f, :text=>msgcat['Exit'],
+ :command=>proc{exit}).pack(:side=>:right, :padx=>5)
+}.pack(:side=>:bottom, :fill=>:x)
+
+f = TkFrame.new.pack(:side=>:top, :fill=>:both, :expand=>true)
+lbox = TkListbox.new(f).pack(:side=>:left, :fill=>:both, :expand=>true)
+lbox.yscrollbar(TkScrollbar.new(f, :width=>12).pack(:side=>:right, :fill=>:y))
+
+lbox.bind('ButtonRelease-1'){|ev|
+ idx = lbox.index("@#{ev.x},#{ev.y}")
+ if idx == 0
+ loc = default_locale
+ else
+ loc = lbox.get(idx)
+ end
+ if top_win != nil && top_win.exist?
+ top_win.destroy
+ end
+ top_win = show_sample.call(loc)
+}
+
+lbox.insert('end', 'default')
+
+Dir.entries(msgcat_dir).sort.each{|f|
+ if f =~ /^(.*).msg$/
+ lbox.insert('end', $1)
+ end
+}
+
+top_win = show_sample.call(default_locale)
+
+# start eventloop
+Tk.mainloop
diff --git a/ext/tk/sample/tkmsgcat-load_rb2.rb b/ext/tk/sample/tkmsgcat-load_rb2.rb
new file mode 100644
index 0000000000..720ab94e13
--- /dev/null
+++ b/ext/tk/sample/tkmsgcat-load_rb2.rb
@@ -0,0 +1,102 @@
+#!/usr/bin/env ruby
+
+require 'tk'
+
+demo_dir = File.dirname($0)
+msgcat_dir = [demo_dir, 'msgs_rb2'].join(File::Separator)
+top_win = nil
+#msgcat = TkMsgCatalog.new('::tk')
+msgcat = TkMsgCatalog.new('::tkmsgcat_demo')
+default_locale = msgcat.locale
+#msgcat.load_rb(msgcat_dir)
+msgcat.load(msgcat_dir)
+
+col_proc = TkComm.install_bind(proc{|w, color, frame, label|
+ TkComm.window(frame).background(color)
+ Tk.update
+ TkComm.window(label).text(
+ msgcat["%1$s:: %2$s", 'Color',
+ color.capitalize])
+ w.flash; w.flash
+ Tk.callback_break;
+ }, "%W")
+
+del_proc = TkComm.install_cmd(proc{top_win.destroy; top_win = nil})
+
+err_proc = TkComm.install_cmd(proc{fail(RuntimeError,
+ msgcat['Application Error'])})
+
+show_sample = proc{|loc|
+ top_win = TkToplevel.new(:title=>loc)
+
+ msgcat.locale = loc
+ #msgcat.load_rb(msgcat_dir)
+ msgcat.load(msgcat_dir)
+
+ TkLabel.new(top_win){
+ text "preferences:: #{msgcat.preferences.join(' ')}"
+ pack(:pady=>10, :padx=>10)
+ }
+
+ lbl = TkLabel.new(top_win, :text=>msgcat["%1$s:: %2$s",
+ 'Color', '']).pack(:anchor=>'w')
+
+ bg = TkFrame.new(top_win).pack(:ipadx=>20, :ipady=>10,
+ :expand=>true, :fill=>:both)
+
+ TkFrame.new(bg){|f|
+ ['blue', 'green', 'red'].each{|col|
+ TkButton.new(f, :text=>msgcat[col]){
+ bind('ButtonRelease-1', col_proc, "#{col} #{bg.path} #{lbl.path}")
+ }.pack(:fill=>:x)
+ }
+ }.pack(:anchor=>'center', :pady=>15)
+
+ TkFrame.new(top_win){|f|
+ TkButton.new(f, :text=>msgcat['Delete'],
+ :command=>del_proc).pack(:side=>:right, :padx=>5)
+ TkButton.new(f, :text=>msgcat['Error'],
+ :command=>err_proc).pack(:side=>:left, :padx=>5)
+ }.pack(:side=>:bottom, :fill=>:x)
+
+ top_win
+}
+
+
+# listbox for locale list
+TkLabel.new(:text=>"Please click a locale.").pack(:padx=>5, :pady=>3)
+
+TkFrame.new{|f|
+ TkButton.new(f, :text=>msgcat['Exit'],
+ :command=>proc{exit}).pack(:side=>:right, :padx=>5)
+}.pack(:side=>:bottom, :fill=>:x)
+
+f = TkFrame.new.pack(:side=>:top, :fill=>:both, :expand=>true)
+lbox = TkListbox.new(f).pack(:side=>:left, :fill=>:both, :expand=>true)
+lbox.yscrollbar(TkScrollbar.new(f, :width=>12).pack(:side=>:right, :fill=>:y))
+
+lbox.bind('ButtonRelease-1'){|ev|
+ idx = lbox.index("@#{ev.x},#{ev.y}")
+ if idx == 0
+ loc = default_locale
+ else
+ loc = lbox.get(idx)
+ end
+ if top_win != nil && top_win.exist?
+ top_win.destroy
+ end
+ top_win = show_sample.call(loc)
+}
+
+lbox.insert('end', 'default')
+
+Dir.entries(msgcat_dir).sort.each{|f|
+ if f =~ /^(.*).msg$/
+ lbox.insert('end', $1)
+ end
+}
+
+top_win = show_sample.call(default_locale)
+
+# start eventloop
+Tk.mainloop
diff --git a/ext/tk/sample/tkmsgcat-load_tk.rb b/ext/tk/sample/tkmsgcat-load_tk.rb
new file mode 100644
index 0000000000..8ad26a5f27
--- /dev/null
+++ b/ext/tk/sample/tkmsgcat-load_tk.rb
@@ -0,0 +1,118 @@
+#!/usr/bin/env ruby
+
+require 'tk'
+
+demo_dir = File.dirname($0)
+msgcat_dir = [demo_dir, 'msgs_tk'].join(File::Separator)
+top_win = nil
+#msgcat = TkMsgCatalog.new('::tk')
+msgcat = TkMsgCatalog.new('::tkmsgcat_demo')
+default_locale = msgcat.locale
+msgcat.load_tk(msgcat_dir)
+
+col_proc = TkComm.install_bind(proc{|w, color, frame, label|
+ TkComm.window(frame).background(color)
+ Tk.update
+ TkComm.window(label).text(
+ msgcat.mc("%1$s:: %2$s", 'Color',
+ color.capitalize))
+ w.flash; w.flash
+ Tk.callback_break;
+ }, "%W")
+
+del_proc = TkComm.install_cmd(proc{top_win.destroy; top_win = nil})
+
+err_proc = TkComm.install_cmd(proc{fail(RuntimeError,
+ msgcat.mc('Application Error'))})
+
+show_sample = proc{|loc|
+ top_win = TkToplevel.new(:title=>loc)
+
+ msgcat.locale = loc
+ msgcat.load_tk(msgcat_dir)
+
+ TkLabel.new(top_win){
+ text "preferences:: #{msgcat.preferences.join(' ')}"
+ pack(:pady=>10, :padx=>10)
+ }
+
+ lbl = TkLabel.new(top_win, :text=>msgcat.mc("%1$s:: %2$s",
+ 'Color', '')).pack(:anchor=>'w')
+
+ bg = TkFrame.new(top_win).pack(:ipadx=>20, :ipady=>10,
+ :expand=>true, :fill=>:both)
+
+ TkFrame.new(bg){|f|
+ ['blue', 'green', 'red'].each{|col|
+ TkButton.new(f, :text=>msgcat.mc(col)){
+ bind('ButtonRelease-1', col_proc, "#{col} #{bg.path} #{lbl.path}")
+ }.pack(:fill=>:x)
+=begin
+ TkButton.new(f, :text=>msgcat.mc(col),
+ :command=>proc{
+ bg.background col
+ lbl.text msgcat.mc("%1$s:: %2$s", 'Color', col.capitalize)
+ }).pack(:fill=>:x)
+=end
+ }
+ }.pack(:anchor=>'center', :pady=>15)
+
+ TkFrame.new(top_win){|f|
+ TkButton.new(f, :text=>msgcat.mc('Delete'),
+ :command=>del_proc).pack(:side=>:right, :padx=>5)
+ TkButton.new(f, :text=>msgcat.mc('Error'),
+ :command=>err_proc).pack(:side=>:left, :padx=>5)
+=begin
+ TkButton.new(f, :text=>msgcat.mc('Delete'),
+ :command=>proc{
+ top_win.destroy
+ top_win = nil
+ }).pack(:side=>:right, :padx=>5)
+ TkButton.new(f, :text=>msgcat.mc('Error'),
+ :command=>proc{
+ fail RuntimeError, msgcat.mc('Application Error')
+ }).pack(:side=>:left, :padx=>5)
+=end
+ }.pack(:side=>:bottom, :fill=>:x)
+
+ top_win
+}
+
+
+# listbox for locale list
+TkLabel.new(:text=>"Please click a locale.").pack(:padx=>5, :pady=>3)
+
+TkFrame.new{|f|
+ TkButton.new(f, :text=>msgcat.mc('Exit'),
+ :command=>proc{exit}).pack(:side=>:right, :padx=>5)
+}.pack(:side=>:bottom, :fill=>:x)
+
+f = TkFrame.new.pack(:side=>:top, :fill=>:both, :expand=>true)
+lbox = TkListbox.new(f).pack(:side=>:left, :fill=>:both, :expand=>true)
+lbox.yscrollbar(TkScrollbar.new(f, :width=>12).pack(:side=>:right, :fill=>:y))
+
+lbox.bind('ButtonRelease-1'){|ev|
+ idx = lbox.index("@#{ev.x},#{ev.y}")
+ if idx == 0
+ loc = default_locale
+ else
+ loc = lbox.get(idx)
+ end
+ if top_win != nil && top_win.exist?
+ top_win.destroy
+ end
+ top_win = show_sample.call(loc)
+}
+
+lbox.insert('end', 'default')
+
+Dir.entries(msgcat_dir).sort.each{|f|
+ if f =~ /^(.*).msg$/
+ lbox.insert('end', $1)
+ end
+}
+
+top_win = show_sample.call(default_locale)
+
+# start eventloop
+Tk.mainloop
diff --git a/lib/rss/1.0.rb b/lib/rss/1.0.rb
new file mode 100644
index 0000000000..696b492ada
--- /dev/null
+++ b/lib/rss/1.0.rb
@@ -0,0 +1,638 @@
+require "rss/parser"
+
+module RSS
+
+ module RSS10
+ NSPOOL = {}
+ ELEMENTS = []
+ end
+
+ class RDF < Element
+
+ include RSS10
+ include RootElementMixin
+ include XMLStyleSheetMixin
+
+ class << self
+
+ def required_uri
+ URI
+ end
+
+ end
+
+ TAG_NAME.replace('RDF')
+
+ PREFIX = 'rdf'
+ URI = "http://www.w3.org/1999/02/22-rdf-syntax-ns#"
+
+ install_ns('', ::RSS::URI)
+ install_ns(PREFIX, URI)
+
+ [
+ ["channel", nil],
+ ["image", "?"],
+ ["item", "+"],
+ ["textinput", "?"],
+ ].each do |tag, occurs|
+ install_model(tag, occurs)
+ end
+
+ %w(channel image textinput).each do |x|
+ install_have_child_element(x)
+ end
+
+ install_have_children_element("item")
+
+ attr_accessor :rss_version, :version, :encoding, :standalone
+
+ def initialize(version=nil, encoding=nil, standalone=nil)
+ super('1.0', version, encoding, standalone)
+ end
+
+ def to_s(convert=true)
+ rv = <<-EORDF
+#{xmldecl}
+#{xml_stylesheet_pi}<#{PREFIX}:RDF#{ns_declaration}>
+#{channel_element(false)}
+#{image_element(false)}
+#{item_elements(false)}
+#{textinput_element(false)}
+#{other_element(false, "\t")}
+</#{PREFIX}:RDF>
+EORDF
+ rv = @converter.convert(rv) if convert and @converter
+ rv
+ end
+
+ private
+ def rdf_validate(tags)
+ _validate(tags, [])
+ end
+
+ def children
+ [@channel, @image, @textinput, *@item]
+ end
+
+ def _tags
+ rv = [
+ [::RSS::URI, "channel"],
+ [::RSS::URI, "image"],
+ ].delete_if {|x| send(x[1]).nil?}
+ @item.each do |x|
+ rv << [::RSS::URI, "item"]
+ end
+ rv << [::RSS::URI, "textinput"] if @textinput
+ rv
+ end
+
+ class Seq < Element
+
+ include RSS10
+
+ class << self
+
+ def required_uri
+ URI
+ end
+
+ end
+
+ TAG_NAME.replace('Seq')
+
+ install_have_children_element("li")
+
+ install_must_call_validator('rdf', ::RSS::RDF::URI)
+
+ def initialize(li=[])
+ super()
+ @li = li
+ end
+
+ def to_s(convert=true)
+ <<-EOT
+ <#{PREFIX}:Seq>
+#{li_elements(convert, "\t\t\t\t")}
+#{other_element(convert, "\t\t\t\t")}
+ </#{PREFIX}:Seq>
+EOT
+ end
+
+ private
+ def children
+ @li
+ end
+
+ def rdf_validate(tags)
+ _validate(tags, [["li", '*']])
+ end
+
+ def _tags
+ rv = []
+ @li.each do |x|
+ rv << [URI, "li"]
+ end
+ rv
+ end
+
+ end
+
+ class Li < Element
+
+ include RSS10
+
+ class << self
+
+ def required_uri
+ URI
+ end
+
+ end
+
+ [
+ ["resource", [URI, nil], true]
+ ].each do |name, uri, required|
+ install_get_attribute(name, uri, required)
+ end
+
+ def initialize(resource=nil)
+ super()
+ @resource = resource
+ end
+
+ def to_s(convert=true)
+ if @resource
+ rv = %Q!<#{PREFIX}:li resource="#{h @resource}" />\n!
+ rv = @converter.convert(rv) if convert and @converter
+ rv
+ else
+ ''
+ end
+ end
+
+ private
+ def _attrs
+ [
+ ["resource", true]
+ ]
+ end
+
+ end
+
+ class Channel < Element
+
+ include RSS10
+
+ class << self
+
+ def required_uri
+ ::RSS::URI
+ end
+
+ end
+
+ [
+ ["about", URI, true]
+ ].each do |name, uri, required|
+ install_get_attribute(name, uri, required)
+ end
+
+ %w(title link description).each do |x|
+ install_text_element(x)
+ end
+
+ %w(image items textinput).each do |x|
+ install_have_child_element(x)
+ end
+
+ [
+ ['title', nil],
+ ['link', nil],
+ ['description', nil],
+ ['image', '?'],
+ ['items', nil],
+ ['textinput', '?'],
+ ].each do |tag, occurs|
+ install_model(tag, occurs)
+ end
+
+ def initialize(about=nil)
+ super()
+ @about = about
+ end
+
+ def to_s(convert=true)
+ about = ''
+ about << %Q!#{PREFIX}:about="#{h @about}"! if @about
+ rv = <<-EOT
+ <channel #{about}>
+ #{title_element(false)}
+ #{link_element(false)}
+ #{description_element(false)}
+ #{image_element(false)}
+#{items_element(false)}
+ #{textinput_element(false)}
+#{other_element(false, "\t\t")}
+ </channel>
+EOT
+ rv = @converter.convert(rv) if convert and @converter
+ rv
+ end
+
+ private
+ def children
+ [@image, @items, @textinput]
+ end
+
+ def _tags
+ [
+ [::RSS::URI, 'title'],
+ [::RSS::URI, 'link'],
+ [::RSS::URI, 'description'],
+ [::RSS::URI, 'image'],
+ [::RSS::URI, 'items'],
+ [::RSS::URI, 'textinput'],
+ ].delete_if do |x|
+ send(x[1]).nil?
+ end
+ end
+
+ def _attrs
+ [
+ ["about", true]
+ ]
+ end
+
+ class Image < Element
+
+ include RSS10
+
+ class << self
+
+ def required_uri
+ ::RSS::URI
+ end
+
+ end
+
+ [
+ ["resource", URI, true]
+ ].each do |name, uri, required|
+ install_get_attribute(name, uri, required)
+ end
+
+ def initialize(resource=nil)
+ super()
+ @resource = resource
+ end
+
+ def to_s(convert=true)
+ if @resource
+ rv = %Q!<image #{PREFIX}:resource="#{h @resource}" />!
+ rv = @converter.convert(rv) if convert and @converter
+ rv
+ else
+ ''
+ end
+ end
+
+ private
+ def _attrs
+ [
+ ["resource", true]
+ ]
+ end
+
+ end
+
+ class Textinput < Element
+
+ include RSS10
+
+ class << self
+
+ def required_uri
+ ::RSS::URI
+ end
+
+ end
+
+ [
+ ["resource", URI, true]
+ ].each do |name, uri, required|
+ install_get_attribute(name, uri, required)
+ end
+
+ def initialize(resource=nil)
+ super()
+ @resource = resource
+ end
+
+ def to_s(convert=true)
+ if @resource
+ rv = %Q|<textinput #{PREFIX}:resource="#{h @resource}" />|
+ rv = @converter.convert(rv) if convert and @converter
+ rv
+ else
+ ''
+ end
+ end
+
+ private
+ def _attrs
+ [
+ ["resource", true],
+ ]
+ end
+
+ end
+
+ class Items < Element
+
+ include RSS10
+
+ Seq = ::RSS::RDF::Seq
+ class Seq
+ unless const_defined?(:Li)
+ Li = ::RSS::RDF::Li
+ end
+ end
+
+ class << self
+
+ def required_uri
+ ::RSS::URI
+ end
+
+ end
+
+ install_have_child_element("Seq")
+
+ install_must_call_validator('rdf', ::RSS::RDF::URI)
+
+ def initialize(seq=Seq.new)
+ super()
+ @Seq = seq
+ end
+
+ def to_s(convert=true)
+ <<-EOT
+ <items>
+#{Seq_element(convert)}
+#{other_element(convert, "\t\t\t")}
+ </items>
+EOT
+ end
+
+ private
+ def children
+ [@Seq]
+ end
+
+ private
+ def _tags
+ rv = []
+ rv << [URI, 'Seq'] unless @Seq.nil?
+ rv
+ end
+
+ def rdf_validate(tags)
+ _validate(tags, [["Seq", nil]])
+ end
+
+ end
+
+ end
+
+ class Image < Element
+
+ include RSS10
+
+ class << self
+
+ def required_uri
+ ::RSS::URI
+ end
+
+ end
+
+ [
+ ["about", URI, true]
+ ].each do |name, uri, required|
+ install_get_attribute(name, uri, required)
+ end
+
+ %w(title url link).each do |x|
+ install_text_element(x)
+ end
+
+ [
+ ['title', nil],
+ ['url', nil],
+ ['link', nil],
+ ].each do |tag, occurs|
+ install_model(tag, occurs)
+ end
+
+ def initialize(about=nil)
+ super()
+ @about = about
+ end
+
+ def to_s(convert=true)
+ about = ''
+ about << %Q!#{PREFIX}:about="#{h @about}"! if @about
+ rv = <<-EOT
+ <image #{about}>
+ #{title_element(false)}
+ #{url_element(false)}
+ #{link_element(false)}
+#{other_element(false, "\t\t")}
+ </image>
+EOT
+ rv = @converter.convert(rv) if convert and @converter
+ rv
+ end
+
+ private
+ def _tags
+ [
+ [::RSS::URI, 'title'],
+ [::RSS::URI, 'url'],
+ [::RSS::URI, 'link'],
+ ].delete_if do |x|
+ send(x[1]).nil?
+ end
+ end
+
+ def _attrs
+ [
+ ["about", true],
+ ]
+ end
+
+ end
+
+ class Item < Element
+
+ include RSS10
+
+ class << self
+
+ def required_uri
+ ::RSS::URI
+ end
+
+ end
+
+ [
+ ["about", URI, true]
+ ].each do |name, uri, required|
+ install_get_attribute(name, uri, required)
+ end
+
+ %w(title link description).each do |x|
+ install_text_element(x)
+ end
+
+ [
+ ["title", nil],
+ ["link", nil],
+ ["description", "?"],
+ ].each do |tag, occurs|
+ install_model(tag, occurs)
+ end
+
+ def initialize(about=nil)
+ super()
+ @about = about
+ end
+
+ def to_s(convert=true)
+ about = ''
+ about << %Q!#{PREFIX}:about="#{h @about}"! if @about
+ rv = <<-EOT
+ <item #{about}>
+ #{title_element(false)}
+ #{link_element(false)}
+ #{description_element(false)}
+#{other_element(false, "\t\t")}
+ </item>
+EOT
+ rv = @converter.convert(rv) if convert and @converter
+ rv
+ end
+
+ private
+ def _tags
+ [
+ [::RSS::URI, 'title'],
+ [::RSS::URI, 'link'],
+ [::RSS::URI, 'description'],
+ ].delete_if do |x|
+ send(x[1]).nil?
+ end
+ end
+
+ def _attrs
+ [
+ ["about", true],
+ ]
+ end
+
+ end
+
+ class Textinput < Element
+
+ include RSS10
+
+ class << self
+
+ def required_uri
+ ::RSS::URI
+ end
+
+ end
+
+ [
+ ["about", URI, true]
+ ].each do |name, uri, required|
+ install_get_attribute(name, uri, required)
+ end
+
+ %w(title description name link).each do |x|
+ install_text_element(x)
+ end
+
+ [
+ ["title", nil],
+ ["description", nil],
+ ["name", nil],
+ ["link", nil],
+ ].each do |tag, occurs|
+ install_model(tag, occurs)
+ end
+
+ def initialize(about=nil)
+ super()
+ @about = about
+ end
+
+ def to_s(convert=true)
+ about = ''
+ about << %Q!#{PREFIX}:about="#{h @about}"! if @about
+ rv = <<-EOT
+ <textinput #{about}>
+ #{title_element(false)}
+ #{description_element(false)}
+ #{name_element(false)}
+ #{link_element(false)}
+#{other_element(false, "\t\t")}
+ </textinput>
+EOT
+ rv = @converter.convert(rv) if convert and @converter
+ rv
+ end
+
+ private
+ def _tags
+ [
+ [::RSS::URI, 'title'],
+ [::RSS::URI, 'description'],
+ [::RSS::URI, 'name'],
+ [::RSS::URI, 'link'],
+ ].delete_if do |x|
+ send(x[1]).nil?
+ end
+ end
+
+ def _attrs
+ [
+ ["about", true],
+ ]
+ end
+
+ end
+
+ end
+
+ RSS10::ELEMENTS.each do |x|
+ BaseListener.install_get_text_element(x, URI, "#{x}=")
+ end
+
+ module ListenerMixin
+ private
+ def start_RDF(tag_name, prefix, attrs, ns)
+ check_ns(tag_name, prefix, ns, RDF::URI)
+
+ @rss = RDF.new(@version, @encoding, @standalone)
+ @rss.do_validate = @do_validate
+ @rss.xml_stylesheets = @xml_stylesheets
+ @last_element = @rss
+ @proc_stack.push Proc.new { |text, tags|
+ @rss.validate_for_stream(tags) if @do_validate
+ }
+ end
+ end
+
+end
diff --git a/lib/rss/dublincore.rb b/lib/rss/dublincore.rb
new file mode 100644
index 0000000000..dcf8e46c65
--- /dev/null
+++ b/lib/rss/dublincore.rb
@@ -0,0 +1,62 @@
+require "rss/1.0"
+
+module RSS
+
+ DC_PREFIX = 'dc'
+ DC_URI = "http://purl.org/dc/elements/1.1/"
+
+ RDF.install_ns(DC_PREFIX, DC_URI)
+
+ module DublinCoreModel
+
+ extend BaseModel
+
+ ELEMENTS = []
+
+ def self.included(mod)
+ mod.module_eval(<<-EOC)
+ %w(title description creator subject publisher
+ contributor type format identifier source
+ language relation coverage rights).each do |x|
+ install_text_element("\#{DC_PREFIX}_\#{x}")
+ end
+
+ %w(date).each do |x|
+ install_date_element("\#{DC_PREFIX}_\#{x}", 'w3cdtf', x)
+ end
+ EOC
+ end
+
+ def dc_validate(tags)
+ counter = {}
+ ELEMENTS.each do |x|
+ counter[x] = 0
+ end
+
+ tags.each do |tag|
+ key = "#{DC_PREFIX}_#{tag}"
+ raise UnknownTagError.new(tag, DC_URI) unless counter.has_key?(key)
+ counter[key] += 1
+ raise TooMuchTagError.new(tag, tag_name) if counter[key] > 1
+ end
+ end
+
+ end
+
+ # For backward compatibility
+ DublincoreModel = DublinCoreModel
+
+ class RDF
+ class Channel; include DublinCoreModel; end
+ class Image; include DublinCoreModel; end
+ class Item; include DublinCoreModel; end
+ class Textinput; include DublinCoreModel; end
+ end
+
+ prefix_size = DC_PREFIX.size + 1
+ DublinCoreModel::ELEMENTS.uniq!
+ DublinCoreModel::ELEMENTS.each do |x|
+ BaseListener.install_get_text_element(x[prefix_size..-1], DC_URI, "#{x}=")
+ end
+
+end
diff --git a/lib/rss/parser.rb b/lib/rss/parser.rb
new file mode 100644
index 0000000000..e1c61f46ae
--- /dev/null
+++ b/lib/rss/parser.rb
@@ -0,0 +1,380 @@
+require "forwardable"
+
+require "rss/rss"
+
+module RSS
+
+ class NotWellFormedError < Error
+ attr_reader :line, :element
+ def initialize(line=nil, element=nil)
+ message = "This is not well formed XML"
+ if element or line
+ message << "\nerror occurred"
+ message << " in #{element}" if element
+ message << " at about #{line} line" if line
+ end
+ message << "\n#{yield}" if block_given?
+ super(message)
+ end
+ end
+
+ class XMLParserNotFound < Error
+ def initialize
+ super("available XML parser does not found in " <<
+ "#{AVAILABLE_PARSER_LIBRARIES.inspect}.")
+ end
+ end
+
+ class NotValidXMLParser < Error
+ def initialize(parser)
+ super("#{parser} is not available XML parser. " <<
+ "available XML parser is " <<
+ "#{AVAILABLE_PARSERS.inspect}.")
+ end
+ end
+
+ class NSError < InvalidRSSError
+ attr_reader :tag, :prefix, :uri
+ def initialize(tag, prefix, require_uri)
+ @tag, @prefix, @uri = tag, prefix, require_uri
+ super("prefix <#{prefix}> doesn't associate uri " <<
+ "<#{require_uri}> in tag <#{tag}>")
+ end
+ end
+
+ class Parser
+
+ extend Forwardable
+
+ class << self
+
+ @@default_parser = nil
+
+ def default_parser
+ @@default_parser || AVAILABLE_PARSERS.first
+ end
+
+ def default_parser=(new_value)
+ if AVAILABLE_PARSERS.include?(new_value)
+ @@default_parser = new_value
+ else
+ raise NotValidXMLParser.new(new_value)
+ end
+ end
+
+ def parse(rss, do_validate=true, ignore_unknown_element=true, parser_class=default_parser)
+ parser = new(rss, parser_class)
+ parser.do_validate = do_validate
+ parser.ignore_unknown_element = ignore_unknown_element
+ parser.parse
+ end
+
+ end
+
+ def_delegators(:@parser, :parse, :rss,
+ :ignore_unknown_element,
+ :ignore_unknown_element=, :do_validate,
+ :do_validate=)
+
+ def initialize(rss, parser_class=self.class.default_parser)
+ @parser = parser_class.new(rss)
+ end
+ end
+
+ class BaseParser
+
+ def initialize(rss)
+ @listener = listener.new
+ @rss = rss
+ end
+
+ def rss
+ @listener.rss
+ end
+
+ def ignore_unknown_element
+ @listener.ignore_unknown_element
+ end
+
+ def ignore_unknown_element=(new_value)
+ @listener.ignore_unknown_element = new_value
+ end
+
+ def do_validate
+ @listener.do_validate
+ end
+
+ def do_validate=(new_value)
+ @listener.do_validate = new_value
+ end
+
+ def parse
+ if @listener.rss.nil?
+ _parse
+ end
+ @listener.rss
+ end
+
+ end
+
+ class BaseListener
+
+ extend Utils
+
+ class << self
+
+ @@setter = {}
+ def install_setter(uri, tag_name, setter)
+ @@setter[uri] = {} unless @@setter.has_key?(uri)
+ @@setter[uri][tag_name] = setter
+ end
+
+ def setter(uri, tag_name)
+ begin
+ @@setter[uri][tag_name]
+ rescue NameError
+ nil
+ end
+ end
+
+ def available_tags(uri)
+ begin
+ @@setter[uri].keys
+ rescue NameError
+ []
+ end
+ end
+
+ def install_get_text_element(name, uri, setter)
+ install_setter(uri, name, setter)
+ def_get_text_element(name, *get_file_and_line_from_caller(1))
+ end
+
+ private
+
+ def def_get_text_element(name, file, line)
+ unless private_instance_methods(false).include?("start_#{name}")
+ module_eval(<<-EOT, file, line)
+ def start_#{name}(name, prefix, attrs, ns)
+ uri = ns[prefix]
+ if @do_validate
+ tags = self.class.available_tags(uri)
+ unless tags.include?(name)
+ raise UnknownTagError.new(name, uri)
+ end
+ end
+ start_get_text_element(name, prefix, ns, uri)
+ end
+ EOT
+ end
+ send("private", "start_#{name}")
+ end
+
+ end
+
+ end
+
+ module ListenerMixin
+
+ attr_reader :rss
+
+ attr_accessor :ignore_unknown_element
+ attr_accessor :do_validate
+
+ def initialize
+ @rss = nil
+ @ignore_unknown_element = true
+ @do_validate = true
+ @ns_stack = [{}]
+ @tag_stack = [[]]
+ @text_stack = ['']
+ @proc_stack = []
+ @last_element = nil
+ @version = @encoding = @standalone = nil
+ @xml_stylesheets = []
+ end
+
+ def xmldecl(version, encoding, standalone)
+ @version, @encoding, @standalone = version, encoding, standalone
+ end
+
+ def instruction(name, content)
+ if name == "xml-stylesheet"
+ params = parse_pi_content(content)
+ if params.has_key?("href")
+ @xml_stylesheets << XMLStyleSheet.new(*params)
+ end
+ end
+ end
+
+ def tag_start(name, attributes)
+ @text_stack.push('')
+
+ ns = @ns_stack.last.dup
+ attrs = {}
+ attributes.each do |n, v|
+ if n =~ /\Axmlns:?/
+ ns[$POSTMATCH] = v
+ else
+ attrs[n] = v
+ end
+ end
+ @ns_stack.push(ns)
+
+ prefix, local = split_name(name)
+ @tag_stack.last.push([ns[prefix], local])
+ @tag_stack.push([])
+ if respond_to?("start_#{local}", true)
+ send("start_#{local}", local, prefix, attrs, ns.dup)
+ else
+ start_else_element(local, prefix, attrs, ns.dup)
+ end
+ end
+
+ def tag_end(name)
+ if DEBUG
+ p "end tag #{name}"
+ p @tag_stack
+ end
+ text = @text_stack.pop
+ tags = @tag_stack.pop
+ pr = @proc_stack.pop
+ pr.call(text, tags) unless pr.nil?
+ end
+
+ def text(data)
+ @text_stack.last << data
+ end
+
+ private
+
+ CONTENT_PATTERN = /\s*([^=]+)=(["'])([^\2]+?)\2/
+ def parse_pi_content(content)
+ params = {}
+ content.scan(CONTENT_PATTERN) do |name, quote, value|
+ params[name] = value
+ end
+ params
+ end
+
+ def start_else_element(local, prefix, attrs, ns)
+ class_name = local[0,1].upcase << local[1..-1]
+ current_class = @last_element.class
+# begin
+ if current_class.constants.include?(class_name)
+ next_class = current_class.const_get(class_name)
+ start_have_something_element(local, prefix, attrs, ns, next_class)
+# rescue NameError
+ else
+ if @ignore_unknown_element
+ @proc_stack.push(nil)
+ else
+ parent = "ROOT ELEMENT???"
+ if current_class.const_defined?("TAG_NAME")
+ parent = current_class.const_get("TAG_NAME")
+ end
+ raise NotExceptedTagError.new(local, parent)
+ end
+ end
+ end
+
+ NAMESPLIT = /^(?:([\w:][-\w\d.]*):)?([\w:][-\w\d.]*)/
+ def split_name(name)
+ name =~ NAMESPLIT
+ [$1 || '', $2]
+ end
+
+ def check_ns(tag_name, prefix, ns, require_uri)
+ if @do_validate
+ if ns[prefix] == require_uri
+ #ns.delete(prefix)
+ else
+ raise NSError.new(tag_name, prefix, require_uri)
+ end
+ end
+ end
+
+ def start_get_text_element(tag_name, prefix, ns, required_uri)
+ @proc_stack.push Proc.new {|text, tags|
+ setter = self.class.setter(required_uri, tag_name)
+ setter ||= "#{tag_name}="
+ if @last_element.respond_to?(setter)
+ @last_element.send(setter, text.to_s)
+ else
+ if @do_validate and not @ignore_unknown_element
+ raise NotExceptedTagError.new(tag_name, @last_element.tag_name)
+ end
+ end
+ }
+ end
+
+ def start_have_something_element(tag_name, prefix, attrs, ns, klass)
+
+ check_ns(tag_name, prefix, ns, klass.required_uri)
+
+ args = []
+
+ klass.get_attributes.each do |a_name, a_uri, required|
+
+ if a_uri.is_a?(String) or !a_uri.respond_to?(:include?)
+ a_uri = [a_uri]
+ end
+ unless a_uri == [nil]
+ for prefix, uri in ns
+ if a_uri.include?(uri)
+ val = attrs["#{prefix}:#{a_name}"]
+ break if val
+ end
+ end
+ end
+ if val.nil? and a_uri.include?(nil)
+ val = attrs[a_name]
+ end
+
+ if @do_validate and required and val.nil?
+ raise MissingAttributeError.new(tag_name, a_name)
+ end
+
+ args << val
+ end
+
+ previous = @last_element
+ next_element = klass.send(:new, *args)
+ next_element.do_validate = @do_validate
+ setter = ""
+ setter << "#{klass.required_prefix}_" if klass.required_prefix
+ setter << "#{tag_name}="
+ @last_element.send(setter, next_element)
+ @last_element = next_element
+ @proc_stack.push Proc.new { |text, tags|
+ p(@last_element.class) if DEBUG
+ @last_element.content = text if klass.have_content?
+ @last_element.validate_for_stream(tags) if @do_validate
+ @last_element = previous
+ }
+ end
+
+ end
+
+ unless const_defined? :AVAILABLE_PARSER_LIBRARIES
+ AVAILABLE_PARSER_LIBRARIES = [
+ ["rss/xmlparser", :XMLParserParser],
+ ["rss/xmlscanner", :XMLScanParser],
+ ["rss/rexmlparser", :REXMLParser],
+ ]
+ end
+
+ AVAILABLE_PARSERS = []
+
+ AVAILABLE_PARSER_LIBRARIES.each do |lib, parser|
+ begin
+ require lib
+ AVAILABLE_PARSERS.push(const_get(parser))
+ rescue LoadError
+ end
+ end
+
+ if AVAILABLE_PARSERS.empty?
+ raise XMLParserNotFound
+ end
+end
diff --git a/lib/rss/rss.rb b/lib/rss/rss.rb
new file mode 100644
index 0000000000..fbd134c9c9
--- /dev/null
+++ b/lib/rss/rss.rb
@@ -0,0 +1,634 @@
+require "time"
+
+class Time
+ class << self
+ unless respond_to?(:w3cdtf)
+ def w3cdtf(date)
+ if /\A\s*
+ (-?\d+)-(\d\d)-(\d\d)
+ (?:T
+ (\d\d):(\d\d)(?::(\d\d))?
+ (\.\d+)?
+ (Z|[+-]\d\d:\d\d)?)?
+ \s*\z/ix =~ date and (($5 and $8) or (!$5 and !$8))
+ datetime = [$1.to_i, $2.to_i, $3.to_i, $4.to_i, $5.to_i, $6.to_i]
+ datetime << $7.to_f * 1000000 if $7
+ if $8
+ Time.utc(*datetime) - zone_offset($8)
+ else
+ Time.local(*datetime)
+ end
+ else
+ raise ArgumentError.new("invalid date: #{date.inspect}")
+ end
+ end
+ end
+ end
+
+ unless instance_methods.include?("w3cdtf")
+ alias w3cdtf iso8601
+ end
+end
+
+require "English"
+require "rss/utils"
+require "rss/converter"
+require "rss/xml-stylesheet"
+
+module RSS
+
+ VERSION = "0.0.8"
+
+ DEBUG = false
+
+ class Error < StandardError; end
+
+ class OverlappedPrefixError < Error
+ attr_reader :prefix
+ def initialize(prefix)
+ @prefix = prefix
+ end
+ end
+
+ class InvalidRSSError < Error; end
+
+ class MissingTagError < InvalidRSSError
+ attr_reader :tag, :parent
+ def initialize(tag, parent)
+ @tag, @parent = tag, parent
+ super("tag <#{tag}> is missing in tag <#{parent}>")
+ end
+ end
+
+ class TooMuchTagError < InvalidRSSError
+ attr_reader :tag, :parent
+ def initialize(tag, parent)
+ @tag, @parent = tag, parent
+ super("tag <#{tag}> is too much in tag <#{parent}>")
+ end
+ end
+
+ class MissingAttributeError < InvalidRSSError
+ attr_reader :tag, :attribute
+ def initialize(tag, attribute)
+ @tag, @attribute = tag, attribute
+ super("attribute <#{attribute}> is missing in tag <#{tag}>")
+ end
+ end
+
+ class UnknownTagError < InvalidRSSError
+ attr_reader :tag, :uri
+ def initialize(tag, uri)
+ @tag, @uri = tag, uri
+ super("tag <#{tag}> is unknown in namespace specified by uri <#{uri}>")
+ end
+ end
+
+ class NotExceptedTagError < InvalidRSSError
+ attr_reader :tag, :parent
+ def initialize(tag, parent)
+ @tag, @parent = tag, parent
+ super("tag <#{tag}> is not expected in tag <#{parent}>")
+ end
+ end
+
+ class NotAvailableValueError < InvalidRSSError
+ attr_reader :tag, :value
+ def initialize(tag, value)
+ @tag, @value = tag, value
+ super("value <#{value}> of tag <#{tag}> is not available.")
+ end
+ end
+
+ class UnknownConversionMethodError < Error
+ attr_reader :to, :from
+ def initialize(to, from)
+ @to = to
+ @from = from
+ super("can't convert to #{to} from #{from}.")
+ end
+ end
+ # for backward compatibility
+ UnknownConvertMethod = UnknownConversionMethodError
+
+ class ConversionError < Error
+ attr_reader :string, :to, :from
+ def initialize(string, to, from)
+ @string = string
+ @to = to
+ @from = from
+ super("can't convert #{@string} to #{to} from #{from}.")
+ end
+ end
+
+ module BaseModel
+
+ include Utils
+
+ def install_have_child_element(name)
+ add_need_initialize_variable(name)
+
+ attr_accessor name
+ install_element(name) do |n, elem_name|
+ <<-EOC
+ if @#{n}
+ "\#{indent}\#{@#{n}.to_s(convert)}"
+ else
+ ''
+ end
+EOC
+ end
+ end
+ alias_method(:install_have_attribute_element, :install_have_child_element)
+
+ def install_have_children_element(name, postfix="s")
+ add_have_children_element(name)
+
+ def_children_accessor(name, postfix)
+ install_element(name, postfix) do |n, elem_name|
+ <<-EOC
+ rv = ''
+ @#{n}.each do |x|
+ rv << "\#{indent}\#{x.to_s(convert)}"
+ end
+ rv
+EOC
+ end
+ end
+
+ def install_text_element(name)
+ self::ELEMENTS << name
+ add_need_initialize_variable(name)
+
+ attr_writer name
+ convert_attr_reader name
+ install_element(name) do |n, elem_name|
+ <<-EOC
+ if @#{n}
+ rv = "\#{indent}<#{elem_name}>"
+ value = html_escape(@#{n})
+ if convert and @converter
+ rv << @converter.convert(value)
+ else
+ rv << value
+ end
+ rv << "</#{elem_name}>"
+ rv
+ else
+ ''
+ end
+EOC
+ end
+ end
+
+ def install_date_element(name, type, disp_name=name)
+ self::ELEMENTS << name
+ add_need_initialize_variable(name)
+
+ # accessor
+ convert_attr_reader name
+ module_eval(<<-EOC, *get_file_and_line_from_caller(2))
+ def #{name}=(new_value)
+ if new_value.kind_of?(Time)
+ @#{name} = new_value
+ else
+ if @do_validate
+ begin
+ @#{name} = Time.send('#{type}', new_value)
+ rescue ArgumentError
+ raise NotAvailableValueError.new('#{disp_name}', new_value)
+ end
+ else
+ @#{name} = nil
+ if /\\A\\s*\\z/ !~ new_value.to_s
+ begin
+ @#{name} = Time.parse(new_value)
+ rescue ArgumentError
+ end
+ end
+ end
+ end
+
+ # Is it need?
+ if @#{name}
+ class << @#{name}
+ alias_method(:_to_s, :to_s) unless respond_to?(:_to_s)
+ alias_method(:to_s, :#{type})
+ end
+ end
+
+ end
+EOC
+
+ install_element(name) do |n, elem_name|
+ <<-EOC
+ if @#{n}
+ rv = "\#{indent}<#{elem_name}>"
+ value = html_escape(@#{n}.#{type})
+ if convert and @converter
+ rv << @converter.convert(value)
+ else
+ rv << value
+ end
+ rv << "</#{elem_name}>"
+ rv
+ else
+ ''
+ end
+EOC
+ end
+
+ end
+
+ private
+ def install_element(name, postfix="")
+ elem_name = name.sub('_', ':')
+ module_eval(<<-EOC, *get_file_and_line_from_caller(2))
+ def #{name}_element#{postfix}(convert=true, indent='')
+ #{yield(name, elem_name)}
+ end
+ private :#{name}_element#{postfix}
+EOC
+ end
+
+ def convert_attr_reader(*attrs)
+ attrs.each do |attr|
+ attr = attr.id2name if attr.kind_of?(Integer)
+ module_eval(<<-EOC, *get_file_and_line_from_caller(2))
+ def #{attr}
+ if @converter
+ @converter.convert(@#{attr})
+ else
+ @#{attr}
+ end
+ end
+EOC
+ end
+ end
+
+ def def_children_accessor(accessor_name, postfix="s")
+ module_eval(<<-EOC, *get_file_and_line_from_caller(2))
+ def #{accessor_name}#{postfix}
+ @#{accessor_name}
+ end
+
+ def #{accessor_name}(*args)
+ if args.empty?
+ @#{accessor_name}.first
+ else
+ @#{accessor_name}.send("[]", *args)
+ end
+ end
+
+ def #{accessor_name}=(*args)
+ if args.size == 1
+ @#{accessor_name}.push(args[0])
+ else
+ @#{accessor_name}.send("[]=", *args)
+ end
+ end
+ alias_method(:set_#{accessor_name}, :#{accessor_name}=)
+EOC
+ end
+
+ end
+
+ URI = "http://purl.org/rss/1.0/"
+
+ class Element
+
+ extend BaseModel
+ include Utils
+
+ class << self
+
+ def inherited(klass)
+ klass.module_eval(<<-EOC)
+ public
+
+ TAG_NAME = name.split('::').last.downcase
+
+
+ @@must_call_validators = {::RSS::URI => ''}
+
+ def self.must_call_validators
+ @@must_call_validators
+ end
+
+ def self.install_must_call_validator(prefix, uri)
+ @@must_call_validators[uri] = prefix
+ end
+
+ @@model = []
+
+ def self.model
+ @@model
+ end
+
+ def self.install_model(tag, occurs=nil)
+ if m = @@model.find {|t, o| t == tag}
+ m[1] = occurs
+ else
+ @@model << [tag, occurs]
+ end
+ end
+
+ @@get_attributes = []
+
+ def self.get_attributes()
+ @@get_attributes
+ end
+
+ def self.install_get_attribute(name, uri, required=true)
+ attr_writer name
+ convert_attr_reader name
+ @@get_attributes << [name, uri, required]
+ end
+
+ @@have_content = false
+
+ def self.content_setup
+ attr_writer :content
+ convert_attr_reader :content
+ @@have_content = true
+ end
+
+ def self.have_content?
+ @@have_content
+ end
+
+ @@have_children_elements = []
+
+ def self.have_children_elements
+ @@have_children_elements
+ end
+
+ def self.add_have_children_element(variable_name)
+ @@have_children_elements << variable_name
+ end
+
+ @@need_initialize_variables = []
+
+ def self.add_need_initialize_variable(variable_name)
+ @@need_initialize_variables << variable_name
+ end
+
+ def self.need_initialize_variables
+ @@need_initialize_variables
+ end
+
+ EOC
+ end
+
+ def required_prefix
+ nil
+ end
+
+ def required_uri
+ nil
+ end
+
+ def install_ns(prefix, uri)
+ if self::NSPOOL.has_key?(prefix)
+ raise OverlappedPrefixError.new(prefix)
+ end
+ self::NSPOOL[prefix] = uri
+ end
+
+ end
+
+ attr_accessor :do_validate
+
+ def initialize(do_validate=true)
+ @converter = nil
+ @do_validate = do_validate
+ initialize_variables
+ end
+
+ def tag_name
+ self.class::TAG_NAME
+ end
+
+ def converter=(converter)
+ @converter = converter
+ children.each do |child|
+ child.converter = converter unless child.nil?
+ end
+ end
+
+ def validate
+ validate_attribute
+ __validate
+ end
+
+ def validate_for_stream(tags)
+ __validate(tags, false)
+ end
+
+ private
+ def initialize_variables
+ self.class.need_initialize_variables.each do |variable_name|
+ instance_eval("@#{variable_name} = nil")
+ end
+ initialize_have_children_elements
+ @content = "" if self.class.have_content?
+ end
+
+ def initialize_have_children_elements
+ self.class.have_children_elements.each do |variable_name|
+ instance_eval("@#{variable_name} = []")
+ end
+ end
+
+ # not String class children.
+ def children
+ []
+ end
+
+ # default #validate() argument.
+ def _tags
+ []
+ end
+
+ def _attrs
+ []
+ end
+
+ def __validate(tags=_tags, recursive=true)
+ if recursive
+ children.compact.each do |child|
+ child.validate
+ end
+ end
+ must_call_validators = self.class::must_call_validators
+ tags = tag_filter(tags.dup)
+ p tags if DEBUG
+ self.class::NSPOOL.each do |prefix, uri|
+ if tags.has_key?(uri) and !must_call_validators.has_key?(uri)
+ meth = "#{prefix}_validate"
+ send(meth, tags[uri]) if respond_to?(meth, true)
+ end
+ end
+ must_call_validators.each do |uri, prefix|
+ send("#{prefix}_validate", tags[uri])
+ end
+ end
+
+ def validate_attribute
+ _attrs.each do |a_name, required|
+ if required and send(a_name).nil?
+ raise MissingAttributeError.new(self.class::TAG_NAME, a_name)
+ end
+ end
+ end
+
+ def other_element(convert, indent='')
+ rv = ''
+ private_methods.each do |meth|
+ if /\A([^_]+)_[^_]+_elements?\z/ =~ meth and
+ self.class::NSPOOL.has_key?($1)
+ res = send(meth, convert)
+ rv << "#{indent}#{res}\n" if /\A\s*\z/ !~ res
+ end
+ end
+ rv
+ end
+
+ def _validate(tags, model=self.class.model)
+ count = 1
+ do_redo = false
+ not_shift = false
+ tag = nil
+
+ model.each_with_index do |elem, i|
+
+ if DEBUG
+ p "before"
+ p tags
+ p elem
+ end
+
+ if not_shift
+ not_shift = false
+ elsif tags
+ tag = tags.shift
+ end
+
+ if DEBUG
+ p "mid"
+ p count
+ end
+
+ case elem[1]
+ when '?'
+ if count > 2
+ raise TooMuchTagError.new(elem[0], tag_name)
+ else
+ if elem[0] == tag
+ do_redo = true
+ else
+ not_shift = true
+ end
+ end
+ when '*'
+ if elem[0] == tag
+ do_redo = true
+ else
+ not_shift = true
+ end
+ when '+'
+ if elem[0] == tag
+ do_redo = true
+ else
+ if count > 1
+ not_shift = true
+ else
+ raise MissingTagError.new(elem[0], tag_name)
+ end
+ end
+ else
+ if elem[0] == tag
+ if model[i+1] and model[i+1][0] != elem[0] and
+ tags and tags.first == elem[0]
+ raise TooMuchTagError.new(elem[0], tag_name)
+ end
+ else
+ raise MissingTagError.new(elem[0], tag_name)
+ end
+ end
+
+ if DEBUG
+ p "after"
+ p not_shift
+ p do_redo
+ p tag
+ end
+
+ if do_redo
+ do_redo = false
+ count += 1
+ redo
+ else
+ count = 1
+ end
+
+ end
+
+ if !tags.nil? and !tags.empty?
+ raise NotExceptedTagError.new(tag, tag_name)
+ end
+
+ end
+
+ def tag_filter(tags)
+ rv = {}
+ tags.each do |tag|
+ rv[tag[0]] = [] unless rv.has_key?(tag[0])
+ rv[tag[0]].push(tag[1])
+ end
+ rv
+ end
+
+ end
+
+ module RootElementMixin
+
+ attr_reader :output_encoding
+
+ def initialize(rss_version, version=nil, encoding=nil, standalone=nil)
+ super()
+ @rss_version = rss_version
+ @version = version || '1.0'
+ @encoding = encoding
+ @standalone = standalone
+ @output_encoding = nil
+ end
+
+ def output_encoding=(enc)
+ @output_encoding = enc
+ self.converter = Converter.new(@output_encoding, @encoding)
+ end
+
+ private
+ def xmldecl
+ rv = %Q[<?xml version="#{@version}"]
+ if @output_encoding or @encoding
+ rv << %Q[ encoding="#{@output_encoding or @encoding}"]
+ end
+ rv << %Q[ standalone="#{@standalone}"] if @standalone
+ rv << '?>'
+ rv
+ end
+
+ def ns_declaration
+ rv = ''
+ self.class::NSPOOL.each do |prefix, uri|
+ prefix = ":#{prefix}" unless prefix.empty?
+ rv << %Q|\n\txmlns#{prefix}="#{html_escape(uri)}"|
+ end
+ rv
+ end
+
+ end
+
+end
diff --git a/lib/rss/xmlparser.rb b/lib/rss/xmlparser.rb
new file mode 100644
index 0000000000..7be0dc9a11
--- /dev/null
+++ b/lib/rss/xmlparser.rb
@@ -0,0 +1,91 @@
+begin
+ require "xml/parser"
+rescue LoadError
+ require "xmlparser"
+end
+
+begin
+ require "xml/encoding-ja"
+rescue LoadError
+ require "xmlencoding-ja"
+ if defined?(Kconv)
+ module XMLEncoding_ja
+ class SJISHandler
+ include Kconv
+ end
+ end
+ end
+end
+
+module XML
+ class Parser
+ unless defined?(Error)
+ Error = ::XMLParserError
+ end
+ end
+end
+
+module RSS
+
+ class REXMLLikeXMLParser < ::XML::Parser
+
+ include ::XML::Encoding_ja
+
+ def listener=(listener)
+ @listener = listener
+ end
+
+ def startElement(name, attrs)
+ @listener.tag_start(name, attrs)
+ end
+
+ def endElement(name)
+ @listener.tag_end(name)
+ end
+
+ def character(data)
+ @listener.text(data)
+ end
+
+ def xmlDecl(version, encoding, standalone)
+ @listener.xmldecl(version, encoding, standalone == 1)
+ end
+
+ def processingInstruction(target, content)
+ @listener.instruction(target, content)
+ end
+
+ end
+
+ class XMLParserParser < BaseParser
+
+ private
+ def listener
+ XMLParserListener
+ end
+
+ def _parse
+ begin
+ parser = REXMLLikeXMLParser.new
+ parser.listener = @listener
+ parser.parse(@rss)
+ rescue ::XML::Parser::Error => e
+ raise NotWellFormedError.new(parser.line){e.message}
+ end
+ end
+
+ end
+
+ class XMLParserListener < BaseListener
+
+ include ListenerMixin
+
+ def xmldecl(version, encoding, standalone)
+ super
+ # Encoding is converted to UTF-8 when XMLParser parses XML.
+ @encoding = 'UTF-8'
+ end
+
+ end
+
+end
diff --git a/sample/rss/list_description.rb b/sample/rss/list_description.rb
new file mode 100644
index 0000000000..e0b59ea659
--- /dev/null
+++ b/sample/rss/list_description.rb
@@ -0,0 +1,84 @@
+#!/usr/bin/env ruby
+
+require "nkf"
+class String
+ # From tdiary.rb
+ def shorten( len = 120 )
+ lines = NKF::nkf( "-e -m0 -f#{len}", self.gsub( /\n/, ' ' ) ).split( /\n/ )
+ lines[0].concat( '...' ) if lines[0] and lines[1]
+ lines[0]
+ end
+end
+
+require "rss/1.0"
+require "rss/2.0"
+require "rss/dublincore"
+
+channels = {}
+verbose = false
+
+def error(exception)
+ mark = "=" * 20
+ mark = "#{mark} error #{mark}"
+ puts mark
+ puts exception.class
+ puts exception.message
+ puts exception.backtrace
+ puts mark
+end
+
+before_time = Time.now
+ARGV.each do |fname|
+ if fname == '-v'
+ verbose = true
+ next
+ end
+ rss = nil
+ f = File.new(fname).read
+ begin
+ ## do validate parse
+ rss = RSS::Parser.parse(f)
+ rescue RSS::InvalidRSSError
+ error($!) if verbose
+ ## do non validate parse for invalid RSS 1.0
+ begin
+ rss = RSS::Parser.parse(f, false)
+ rescue RSS::Error
+ ## invalid RSS.
+ error($!) if verbose
+ end
+ rescue RSS::Error
+ error($!) if verbose
+ end
+ if rss.nil?
+ puts "#{fname} does not include RSS 1.0 or 0.9x/2.0"
+ else
+ begin
+ rss.output_encoding = "euc-jp"
+ rescue RSS::UnknownConversionMethodError
+ error($!) if verbose
+ end
+ rss.channel.title ||= "Unknown"
+ rss.items.each do |item|
+ item.title ||= "Unknown"
+ channels[rss.channel.title] ||= []
+ channels[rss.channel.title] << item if item.description
+ end
+ end
+end
+processing_time = Time.now - before_time
+
+channels.sort do |x, y|
+ x[0] <=> y[0]
+end[0..20].each do |title, items|
+ puts "Channel: #{title}" unless items.empty?
+ items.sort do |x, y|
+ x.title <=> y.title
+ end[0..10].each do |item|
+ puts " Item: #{item.title.shorten(50)}"
+ puts " Description: #{item.description.shorten(50)}"
+ end
+end
+
+puts "Used XML parser: #{RSS::Parser.default_parser}"
+puts "Processing time: #{processing_time}s"
diff --git a/sample/rss/rss_recent.rb b/sample/rss/rss_recent.rb
new file mode 100644
index 0000000000..8e40151e1c
--- /dev/null
+++ b/sample/rss/rss_recent.rb
@@ -0,0 +1,83 @@
+#!/usr/bin/env ruby
+
+require "nkf"
+class String
+ # From tdiary.rb
+ def shorten( len = 120 )
+ lines = NKF::nkf( "-e -m0 -f#{len}", self.gsub( /\n/, ' ' ) ).split( /\n/ )
+ lines[0].concat( '...' ) if lines[0] and lines[1]
+ lines[0]
+ end
+end
+
+require "rss/1.0"
+require "rss/2.0"
+require "rss/dublincore"
+
+items = []
+verbose = false
+
+def error(exception)
+ mark = "=" * 20
+ mark = "#{mark} error #{mark}"
+ puts mark
+ puts exception.class
+ puts exception.message
+ puts exception.backtrace
+ puts mark
+end
+before_time = Time.now
+ARGV.each do |fname|
+ if fname == '-v'
+ verbose = true
+ next
+ end
+ rss = nil
+ f = File.new(fname).read
+ begin
+ ## do validate parse
+ rss = RSS::Parser.parse(f)
+ rescue RSS::InvalidRSSError
+ error($!) if verbose
+ ## do non validate parse for invalid RSS 1.0
+ begin
+ rss = RSS::Parser.parse(f, false)
+ rescue RSS::Error
+ ## invalid RSS.
+ error($!) if verbose
+ end
+ rescue RSS::Error
+ error($!) if verbose
+ end
+ if rss.nil?
+ puts "#{fname} does not include RSS 1.0 or 0.9x/2.0"
+ else
+ begin
+ rss.output_encoding = "euc-jp"
+ rescue RSS::UnknownConversionMethodError
+ error($!) if verbose
+ end
+ rss.items.each do |item|
+ if item.respond_to?(:pubDate) and item.pubDate
+ class << item
+ alias_method(:dc_date, :pubDate)
+ end
+ end
+ if item.respond_to?(:dc_date) and item.dc_date
+ items << [rss.channel, item]
+ end
+ end
+ end
+end
+processing_time = Time.now - before_time
+
+items.sort do |x, y|
+ y[1].dc_date <=> x[1].dc_date
+end[0..20].each do |channel, item|
+ puts "#{item.dc_date.localtime.iso8601}: " <<
+ "#{channel.title}: #{item.title}"
+ puts " Description: #{item.description.shorten(50)}" if item.description
+end
+
+puts "Used XML parser: #{RSS::Parser.default_parser}"
+puts "Processing time: #{processing_time}s"
diff --git a/test/rss/test_parser.rb b/test/rss/test_parser.rb
new file mode 100644
index 0000000000..05ff9748ad
--- /dev/null
+++ b/test/rss/test_parser.rb
@@ -0,0 +1,470 @@
+# -*- tab-width: 2 -*- vim: ts=2
+
+require "rss-testcase"
+
+require "rss/1.0"
+
+module RSS
+ class TestParser < TestCase
+
+ def setup
+ @_default_parser = Parser.default_parser
+ end
+
+ def teardown
+ Parser.default_parser = @_default_parser
+ end
+
+ def test_RDF
+ assert_ns("", RDF::URI) do
+ Parser.parse(<<-EOR)
+#{make_xmldecl}
+<RDF/>
+EOR
+ end
+
+ assert_ns("", RDF::URI) do
+ Parser.parse(<<-EOR)
+#{make_xmldecl}
+<RDF xmlns="hoge"/>
+EOR
+ end
+
+ assert_ns("rdf", RDF::URI) do
+ Parser.parse(<<-EOR)
+#{make_xmldecl}
+<rdf:RDF xmlns:rdf="hoge"/>
+EOR
+ end
+
+ assert_parse(<<-EOR, :missing_tag, "channel", "RDF")
+#{make_xmldecl}
+<rdf:RDF xmlns:rdf="#{RSS::RDF::URI}"/>
+EOR
+
+ assert_parse(<<-EOR, :missing_tag, "channel", "RDF")
+#{make_xmldecl}
+<RDF xmlns="#{RSS::RDF::URI}"/>
+EOR
+
+ assert_parse(<<-EOR, :missing_tag, "channel", "RDF")
+#{make_xmldecl}
+<RDF xmlns="#{RSS::RDF::URI}"/>
+EOR
+
+ assert_parse(make_RDF(<<-EOR), :missing_tag, "item", "RDF")
+#{make_channel}
+EOR
+
+ assert_parse(make_RDF(<<-EOR), :missing_tag, "item", "RDF")
+#{make_channel}
+#{make_image}
+EOR
+
+ assert_parse(make_RDF(<<-EOR), :missing_tag, "item", "RDF")
+#{make_channel}
+#{make_textinput}
+EOR
+
+ assert_too_much_tag("image", "RDF") do
+ Parser.parse(make_RDF(<<-EOR))
+#{make_channel}
+#{make_image}
+#{make_image}
+#{make_item}
+#{make_textinput}
+EOR
+ end
+
+ assert_not_excepted_tag("image", "RDF") do
+ Parser.parse(make_RDF(<<-EOR))
+#{make_channel}
+#{make_item}
+#{make_image}
+#{make_textinput}
+EOR
+ end
+
+ assert_parse(make_RDF(<<-EOR), :nothing_raised)
+#{make_channel}
+#{make_image}
+#{make_item}
+EOR
+
+ assert_parse(make_RDF(<<-EOR), :nothing_raised)
+#{make_channel}
+#{make_image}
+#{make_item}
+#{make_textinput}
+EOR
+
+ 1.step(15, 3) do |i|
+ rss = make_RDF() do
+ res = make_channel
+ i.times { res << make_item }
+ res
+ end
+ assert_parse(rss, :nothing_raised)
+ end
+
+ end
+
+ def test_channel
+
+ assert_parse(make_RDF(<<-EOR), :missing_attribute, "channel", "about")
+<channel />
+EOR
+
+ assert_parse(make_RDF(<<-EOR), :missing_tag, "title", "channel")
+<channel rdf:about="http://example.com/"/>
+EOR
+
+ assert_parse(make_RDF(<<-EOR), :missing_tag, "link", "channel")
+<channel rdf:about="http://example.com/">
+ <title>hoge</title>
+</channel>
+EOR
+
+ assert_parse(make_RDF(<<EOR), :missing_tag, "description", "channel")
+<channel rdf:about="http://example.com/">
+ <title>hoge</title>
+ <link>http://example.com/</link>
+</channel>
+EOR
+
+ assert_parse(make_RDF(<<-EOR), :missing_tag, "items", "channel")
+<channel rdf:about="http://example.com/">
+ <title>hoge</title>
+ <link>http://example.com/</link>
+ <description>hogehoge</description>
+</channel>
+EOR
+
+ assert_parse(make_RDF(<<-EOR), :missing_attribute, "image", "resource")
+<channel rdf:about="http://example.com/">
+ <title>hoge</title>
+ <link>http://example.com/</link>
+ <description>hogehoge</description>
+ <image/>
+</channel>
+EOR
+
+ assert_parse(make_RDF(<<-EOR), :missing_tag, "items", "channel")
+<channel rdf:about="http://example.com/">
+ <title>hoge</title>
+ <link>http://example.com/</link>
+ <description>hogehoge</description>
+ <image rdf:resource="http://example.com/hoge.png" />
+</channel>
+EOR
+
+ rss = make_RDF(<<-EOR)
+<channel rdf:about="http://example.com/">
+ <title>hoge</title>
+ <link>http://example.com/</link>
+ <description>hogehoge</description>
+ <image rdf:resource="http://example.com/hoge.png" />
+ <items/>
+</channel>
+EOR
+
+ assert_missing_tag("Seq", "items") do
+ Parser.parse(rss)
+ end
+
+ assert_missing_tag("item", "RDF") do
+ Parser.parse(rss, false).validate
+ end
+
+ assert_parse(make_RDF(<<-EOR), :missing_tag, "item", "RDF")
+<channel rdf:about="http://example.com/">
+ <title>hoge</title>
+ <link>http://example.com/</link>
+ <description>hogehoge</description>
+ <image rdf:resource="http://example.com/hoge.png" />
+ <items>
+ <rdf:Seq>
+ </rdf:Seq>
+ </items>
+</channel>
+EOR
+
+ assert_parse(make_RDF(<<-EOR), :missing_attribute, "textinput", "resource")
+<channel rdf:about="http://example.com/">
+ <title>hoge</title>
+ <link>http://example.com/</link>
+ <description>hogehoge</description>
+ <image rdf:resource="http://example.com/hoge.png" />
+ <items>
+ <rdf:Seq>
+ </rdf:Seq>
+ </items>
+ <textinput/>
+</channel>
+EOR
+
+ assert_parse(make_RDF(<<-EOR), :missing_tag, "item", "RDF")
+<channel rdf:about="http://example.com/">
+ <title>hoge</title>
+ <link>http://example.com/</link>
+ <description>hogehoge</description>
+ <image rdf:resource="http://example.com/hoge.png" />
+ <items>
+ <rdf:Seq>
+ </rdf:Seq>
+ </items>
+ <textinput rdf:resource="http://example.com/search" />
+</channel>
+EOR
+
+ end
+
+ def test_rdf_li
+
+ rss = make_RDF(<<-EOR)
+<channel rdf:about="http://example.com/">
+ <title>hoge</title>
+ <link>http://example.com/</link>
+ <description>hogehoge</description>
+ <image rdf:resource="http://example.com/hoge.png" />
+ <items>
+ <rdf:Seq>
+ <rdf:li \#{rdf_li_attr}/>
+ </rdf:Seq>
+ </items>
+ <textinput rdf:resource="http://example.com/search" />
+</channel>
+#{make_item}
+EOR
+
+ source = Proc.new do |rdf_li_attr|
+ eval(%Q[%Q[#{rss}]], binding)
+ end
+
+ attr = %q[resource="http://example.com/hoge"]
+ assert_parse(source.call(attr), :nothing_raised)
+
+ attr = %q[rdf:resource="http://example.com/hoge"]
+ assert_parse(source.call(attr), :nothing_raised)
+
+ assert_parse(source.call(""), :missing_attribute, "li", "resource")
+ end
+
+ def test_image
+
+ assert_parse(make_RDF(<<-EOR), :missing_attribute, "image", "about")
+#{make_channel}
+<image>
+</image>
+EOR
+
+ assert_parse(make_RDF(<<-EOR), :missing_tag, "title", "image")
+#{make_channel}
+<image rdf:about="http://example.com/hoge.png">
+</image>
+EOR
+
+ assert_parse(make_RDF(<<-EOR), :missing_tag, "url", "image")
+#{make_channel}
+<image rdf:about="http://example.com/hoge.png">
+ <title>hoge</title>
+</image>
+EOR
+
+ assert_parse(make_RDF(<<-EOR), :missing_tag, "link", "image")
+#{make_channel}
+<image rdf:about="http://example.com/hoge.png">
+ <title>hoge</title>
+ <url>http://example.com/hoge.png</url>
+</image>
+EOR
+
+ rss = make_RDF(<<-EOR)
+#{make_channel}
+<image rdf:about="http://example.com/hoge.png">
+ <title>hoge</title>
+ <link>http://example.com/</link>
+ <url>http://example.com/hoge.png</url>
+</image>
+EOR
+
+ assert_missing_tag("url", "image") do
+ Parser.parse(rss)
+ end
+
+ assert_missing_tag("item", "RDF") do
+ Parser.parse(rss, false).validate
+ end
+
+ assert_parse(make_RDF(<<-EOR), :missing_tag, "item", "RDF")
+#{make_channel}
+<image rdf:about="http://example.com/hoge.png">
+ <title>hoge</title>
+ <url>http://example.com/hoge.png</url>
+ <link>http://example.com/</link>
+</image>
+EOR
+
+ end
+
+ def test_item
+
+ assert_parse(make_RDF(<<-EOR), :missing_attribute, "item", "about")
+#{make_channel}
+#{make_image}
+<item>
+</item>
+EOR
+
+ assert_parse(make_RDF(<<-EOR), :missing_tag, "title", "item")
+#{make_channel}
+#{make_image}
+<item rdf:about="http://example.com/hoge.html">
+</item>
+EOR
+
+ assert_parse(make_RDF(<<-EOR), :missing_tag, "link", "item")
+#{make_channel}
+#{make_image}
+<item rdf:about="http://example.com/hoge.html">
+ <title>hoge</title>
+</item>
+EOR
+
+ assert_too_much_tag("title", "item") do
+ Parser.parse(make_RDF(<<-EOR))
+#{make_channel}
+#{make_image}
+<item rdf:about="http://example.com/hoge.html">
+ <title>hoge</title>
+ <title>hoge</title>
+ <link>http://example.com/hoge.html</link>
+</item>
+EOR
+ end
+
+ assert_parse(make_RDF(<<-EOR), :nothing_raised)
+#{make_channel}
+#{make_image}
+<item rdf:about="http://example.com/hoge.html">
+ <title>hoge</title>
+ <link>http://example.com/hoge.html</link>
+</item>
+EOR
+
+ assert_parse(make_RDF(<<-EOR), :nothing_raised)
+#{make_channel}
+#{make_image}
+<item rdf:about="http://example.com/hoge.html">
+ <title>hoge</title>
+ <link>http://example.com/hoge.html</link>
+ <description>hogehoge</description>
+</item>
+EOR
+
+ end
+
+ def test_textinput
+
+ assert_parse(make_RDF(<<-EOR), :missing_attribute, "textinput", "about")
+#{make_channel}
+#{make_image}
+#{make_item}
+<textinput>
+</textinput>
+EOR
+
+ assert_parse(make_RDF(<<-EOR), :missing_tag, "title", "textinput")
+#{make_channel}
+#{make_image}
+#{make_item}
+<textinput rdf:about="http://example.com/search.html">
+</textinput>
+EOR
+
+ assert_parse(make_RDF(<<-EOR), :missing_tag, "description", "textinput")
+#{make_channel}
+#{make_image}
+#{make_item}
+<textinput rdf:about="http://example.com/search.html">
+ <title>hoge</title>
+</textinput>
+EOR
+
+ assert_too_much_tag("title", "textinput") do
+ Parser.parse(make_RDF(<<-EOR))
+#{make_channel}
+#{make_image}
+#{make_item}
+<textinput rdf:about="http://example.com/search.html">
+ <title>hoge</title>
+ <title>hoge</title>
+ <description>hogehoge</description>
+</textinput>
+EOR
+ end
+
+ assert_parse(make_RDF(<<-EOR), :missing_tag, "name", "textinput")
+#{make_channel}
+#{make_image}
+#{make_item}
+<textinput rdf:about="http://example.com/search.html">
+ <title>hoge</title>
+ <description>hogehoge</description>
+</textinput>
+EOR
+
+ assert_parse(make_RDF(<<-EOR), :missing_tag, "link", "textinput")
+#{make_channel}
+#{make_image}
+#{make_item}
+<textinput rdf:about="http://example.com/search.html">
+ <title>hoge</title>
+ <description>hogehoge</description>
+ <name>key</name>
+</textinput>
+EOR
+
+ assert_parse(make_RDF(<<-EOR), :nothing_raised)
+#{make_channel}
+#{make_image}
+#{make_item}
+<textinput rdf:about="http://example.com/search.html">
+ <title>hoge</title>
+ <description>hogehoge</description>
+ <name>key</name>
+ <link>http://example.com/search.html</link>
+</textinput>
+EOR
+
+ end
+
+ def test_ignore
+
+ rss = make_RDF(<<-EOR)
+#{make_channel}
+#{make_item}
+<a/>
+EOR
+
+ assert_parse(rss, :nothing_raised)
+
+ assert_not_excepted_tag("a", "RDF") do
+ Parser.parse(rss, true, false)
+ end
+
+ end
+
+ def test_default_parser
+ assert_nothing_raised() do
+ Parser.default_parser = RSS::AVAILABLE_PARSERS.first
+ end
+
+ assert_raise(RSS::NotValidXMLParser) do
+ Parser.default_parser = RSS::Parser
+ end
+ end
+
+ end
+end
+