From ef260b085eea729efaa46e93ac71d08a3fa210c6 Mon Sep 17 00:00:00 2001 From: matz Date: Sun, 30 Mar 2008 15:00:12 +0000 Subject: revert git backfire in r15860; sorry git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15861 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- ext/tk/sample/encstr_usage.rb | 5 +++-- ext/tk/sample/irbtkw.rbw | 24 +++++++++++++++++++++++- ext/tk/sample/tkrttimer.rb | 13 +++++++++++-- 3 files changed, 37 insertions(+), 5 deletions(-) (limited to 'ext/tk/sample') diff --git a/ext/tk/sample/encstr_usage.rb b/ext/tk/sample/encstr_usage.rb index 4285ec861c..b22c2504ac 100644 --- a/ext/tk/sample/encstr_usage.rb +++ b/ext/tk/sample/encstr_usage.rb @@ -11,7 +11,7 @@ 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 +src_str = IO.readlines(File.join(File.dirname(__FILE__),'iso2022-kr.txt')).join t1.insert('end', "use neither Tk::EncodedString class nor Tk.encoding= method\n\n") @@ -23,7 +23,8 @@ t2.insert('end', t2.insert('end', enc_str) Tk.encoding = 'iso2022-kr' -t3.insert('end', "use Tk.encoding = 'iso2022-kr'\n\n") +t3.insert('end', "use Tk.encoding = 'iso2022-kr' (Tk.force_default_encoding? == #{Tk.force_default_encoding?})\n\n") + t3.insert('end', src_str) Tk.mainloop diff --git a/ext/tk/sample/irbtkw.rbw b/ext/tk/sample/irbtkw.rbw index f6a35be6ed..3fb6dde626 100644 --- a/ext/tk/sample/irbtkw.rbw +++ b/ext/tk/sample/irbtkw.rbw @@ -4,7 +4,7 @@ # # by Hidetoshi NAGAI (nagai@ai.kyutech.ac.jp) # -release = '2006/11/06' +release = '2008/03/08' require 'tk' begin @@ -15,10 +15,32 @@ end require 'irb' +if TkCore::WITH_ENCODING +else + # $KCODE setup + case Tk.encoding + when 'shiftjis', 'cp932' + $KCODE='SJIS' + when 'euc-jp' + $KCODE='EUC' + when 'utf-8', 'unicode' + $KCODE='UTF8' + else + # unknown + end +end + # console setup top = TkToplevel.new(:title=>'IRB console') top.protocol(:WM_DELETE_WINDOW){ Tk.exit } +case (Tk.windowingsystem) +when 'win32' + fnt = ['MS Gothic', '-12'] +else + fnt = ['courier', '-12'] +end + console = TkTextIO.new(top, :mode=>:console, :width=>80).pack(:side=>:left, :expand=>true, :fill=>:both) diff --git a/ext/tk/sample/tkrttimer.rb b/ext/tk/sample/tkrttimer.rb index 531f4a8d5a..0abd4ecbd2 100644 --- a/ext/tk/sample/tkrttimer.rb +++ b/ext/tk/sample/tkrttimer.rb @@ -17,8 +17,17 @@ TkLabel.new(f2, :text=>'use TkRTTimer class').pack label2 = TkLabel.new(:parent=>f2, :relief=>:raised, :width=>10).pack(:fill=>:both) -TkLabel.new(:text=>'Interval setting of each timer is 10 ms.', - :padx=>10, :pady=>5).pack +TkLabel.new(:padx=>10, :pady=>5, :justify=>'left', :text=><