summaryrefslogtreecommitdiff
path: root/ext
diff options
context:
space:
mode:
authorknu <knu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2008-05-31 11:44:49 +0000
committerknu <knu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2008-05-31 11:44:49 +0000
commitf072d4e34a70d79a78d06616aad3658dd6b97141 (patch)
treee057c597ca1693829f73ebba7161435fc7176685 /ext
parent0d0c31ff8414edc38417b7b172819275e03f4dc3 (diff)
Merge from ruby_1_8.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8_7@16719 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'ext')
-rw-r--r--ext/tk/sample/demos-en/toolbar.rb10
-rw-r--r--ext/tk/sample/demos-en/ttkprogress.rb6
-rw-r--r--ext/tk/sample/demos-en/widget68
-rw-r--r--ext/tk/sample/demos-jp/widget67
4 files changed, 80 insertions, 71 deletions
diff --git a/ext/tk/sample/demos-en/toolbar.rb b/ext/tk/sample/demos-en/toolbar.rb
index 700db68146..5cf863717b 100644
--- a/ext/tk/sample/demos-en/toolbar.rb
+++ b/ext/tk/sample/demos-en/toolbar.rb
@@ -18,11 +18,12 @@ $toolbar_demo = TkToplevel.new {|w|
base_frame = Ttk::Frame.new($toolbar_demo).pack(:fill=>:both, :expand=>true)
if Tk.windowingsystem != 'aqua'
- msg = Ttk::Label.new(base_frame, :wraplength=>'4i', :text=><<EOL)
+ msg = Ttk::Label.new(base_frame, :wraplength=>'4i',
+ :text=>Tk::UTF8_String.new(<<EOL))
This is a demonstration of how to do \
a toolbar that is styled correctly \
and which can be torn off (this feature reqrires Tcl/Tk8.5). \
-The buttons are configured to be \u201Ctoolbar style\u201D buttons by \
+The buttons are configured to be \\u201Ctoolbar style\\u201D buttons by \
telling them that they are to use the Toolbutton style. At the left \
end of the toolbar is a simple marker that the cursor changes to a \
movement icon over; drag that away from the toolbar to tear off the \
@@ -31,10 +32,11 @@ toolbar is no longer needed, just close it like any normal toplevel \
and it will reattach to the window it was torn off from.
EOL
else
- msg = Ttk::Label.new(base_frame, :wraplength=>'4i', :text=><<EOL)
+ msg = Ttk::Label.new(base_frame, :wraplength=>'4i',
+ :text=>Tk::UTF8_String.new(<<EOL))
This is a demonstration of how to do \
a toolbar that is styled correctly. The buttons are configured to \
-be \u201Ctoolbar style\u201D buttons by telling them that they are \
+be \\u201Ctoolbar style\\u201D buttons by telling them that they are \
to use the Toolbutton style.
EOL
end
diff --git a/ext/tk/sample/demos-en/ttkprogress.rb b/ext/tk/sample/demos-en/ttkprogress.rb
index d1b882f546..3eb9a64a4a 100644
--- a/ext/tk/sample/demos-en/ttkprogress.rb
+++ b/ext/tk/sample/demos-en/ttkprogress.rb
@@ -18,11 +18,11 @@ $ttkprogress_demo = TkToplevel.new {|w|
base_frame = TkFrame.new($ttkprogress_demo).pack(:fill=>:both, :expand=>true)
Ttk::Label.new(base_frame, :font=>$font, :wraplength=>'4i', :justify=>:left,
- :text=><<EOL).pack(:side=>:top, :fill=>:x)
+ :text=>Tk::UTF8_String.new(<<EOL)).pack(:side=>:top, :fill=>:x)
Below are two progress bars. \
-The top one is a \u201Cdeterminate\u201D progress bar, \
+The top one is a \\u201Cdeterminate\\u201D progress bar, \
which is used for showing how far through a defined task the program has got. \
-The bottom one is an \u201Cindeterminate\u201D progress bar, \
+The bottom one is an \\u201Cindeterminate\\u201D progress bar, \
which is used to show that the program is busy \
but does not know how long for. Both are run here in self-animated mode, \
which can be turned on and off using the buttons underneath.
diff --git a/ext/tk/sample/demos-en/widget b/ext/tk/sample/demos-en/widget
index dc40f0a95f..9a0605d8b9 100644
--- a/ext/tk/sample/demos-en/widget
+++ b/ext/tk/sample/demos-en/widget
@@ -775,6 +775,12 @@ def showCode1(demo)
TkLabel.new(f,'text'=>' pos:').pack('side'=>'left')
posnum =TkLabel.new(f,'text'=>'').pack('side'=>'left')
+ $set_linenum = proc{|w|
+ line, pos = w.index('insert').split('.')
+ linenum.text = line
+ posnum.text = pos
+ }
+
f.pack('side'=>'bottom', 'expand'=>'true', 'fill'=>'x')
if $tk_version =~ /^4\.[01]/
@@ -820,10 +826,21 @@ def showCode1(demo)
TkGrid.columnconfigure(f, 0, 'weight'=>1, 'minsize'=>0)
}
end
+
+ btag = TkBindTag.new
+
+ btag.bind('Key', $set_linenum, '%W')
+ btag.bind('Button', $set_linenum, '%W')
+
+ btags = $code_text.bindtags
+ btags.insert(btags.index($code_text.class) + 1, btag)
+ $code_text.bindtags = btags
+
else
$code_window.deiconify
$code_window.raise
end
+
$code_window.title("Demo code: #{file}")
$code_window.iconname(file)
# fid = open(file, 'r')
@@ -835,22 +852,7 @@ def showCode1(demo)
#$code_text.set_insert('1.0')
TkTextMarkInsert.new($code_text,'1.0')
- btag = TkBindTag.new
-
- set_linenum = proc{|w|
- line, pos = w.index('insert').split('.')
- linenum.text = line
- posnum.text = pos
- }
-
- btag.bind('Key', set_linenum, '%W')
- btag.bind('Button', set_linenum, '%W')
-
- btags = $code_text.bindtags
- btags.insert(btags.index($code_text.class) + 1, btag)
- $code_text.bindtags = btags
-
- set_linenum.call($code_text)
+ $set_linenum.call($code_text)
fid.close
end
@@ -879,6 +881,12 @@ def showCode2(demo)
TkLabel.new(lf, :text=>' pos:').pack(:side=>:left)
posnum =TkLabel.new(lf, :text=>'').pack(:side=>:left)
+ $set_linenum = proc{|w|
+ line, pos = w.index('insert').split('.')
+ linenum.text = line
+ posnum.text = pos
+ }
+
b_dis = TkButton.new(bf, :text=>'Dismiss', :default=>:active,
:command=>proc{
$code_window.destroy
@@ -909,6 +917,17 @@ def showCode2(demo)
$code_window.bindinfo('Return').each{|cmd, arg|
$code_window.bind_append('Escape', cmd, arg)
}
+
+ btag = TkBindTag.new
+
+ btag.bind('Key', $set_linenum, '%W')
+ btag.bind('Button', $set_linenum, '%W')
+ btag.bind('Configure', $set_linenum, '%W')
+
+ btags = $code_text.bindtags
+ btags.insert(btags.index($code_text.class) + 1, btag)
+ $code_text.bindtags = btags
+
else
$code_window.deiconify
$code_window.raise
@@ -921,22 +940,7 @@ def showCode2(demo)
$code_text.insert('1.0', fid.read)
TkTextMarkInsert.new($code_text,'1.0')
- btag = TkBindTag.new
-
- set_linenum = proc{|w|
- line, pos = w.index('insert').split('.')
- linenum.text = line
- posnum.text = pos
- }
-
- btag.bind('Key', set_linenum, '%W')
- btag.bind('Button', set_linenum, '%W')
-
- btags = $code_text.bindtags
- btags.insert(btags.index($code_text.class) + 1, btag)
- $code_text.bindtags = btags
-
- set_linenum.call($code_text)
+ $set_linenum.call($code_text)
fid.close
end
diff --git a/ext/tk/sample/demos-jp/widget b/ext/tk/sample/demos-jp/widget
index 60ec5b5e96..8eb699e513 100644
--- a/ext/tk/sample/demos-jp/widget
+++ b/ext/tk/sample/demos-jp/widget
@@ -814,6 +814,12 @@ def showCode1(demo)
TkLabel.new(f,'text'=>' pos:').pack('side'=>'left')
posnum =TkLabel.new(f,'text'=>'').pack('side'=>'left')
+ $set_linenum = proc{|w|
+ line, pos = w.index('insert').split('.')
+ linenum.text = line
+ posnum.text = pos
+ }
+
f.pack('side'=>'bottom', 'expand'=>'true', 'fill'=>'x')
if $tk_version =~ /^4\.[01]/
@@ -858,10 +864,21 @@ def showCode1(demo)
TkGrid.columnconfigure(f, 0, 'weight'=>1, 'minsize'=>0)
}
end
+
+ btag = TkBindTag.new
+
+ btag.bind('Key', $set_linenum, '%W')
+ btag.bind('Button', $set_linenum, '%W')
+
+ btags = $code_text.bindtags
+ btags.insert(btags.index($code_text.class) + 1, btag)
+ $code_text.bindtags = btags
+
else
$code_window.deiconify
$code_window.raise
end
+
$code_window.title("Demo code: #{file}")
$code_window.iconname(file)
# fid = open(file, 'r')
@@ -873,22 +890,7 @@ def showCode1(demo)
#$code_text.set_insert('1.0')
TkTextMarkInsert.new($code_text,'1.0')
- btag = TkBindTag.new
-
- set_linenum = proc{|w|
- line, pos = w.index('insert').split('.')
- linenum.text = line
- posnum.text = pos
- }
-
- btag.bind('Key', set_linenum, '%W')
- btag.bind('Button', set_linenum, '%W')
-
- btags = $code_text.bindtags
- btags.insert(btags.index($code_text.class) + 1, btag)
- $code_text.bindtags = btags
-
- set_linenum.call($code_text)
+ $set_linenum.call($code_text)
fid.close
end
@@ -917,6 +919,12 @@ def showCode2(demo)
TkLabel.new(lf, :text=>' pos:').pack(:side=>:left)
posnum =TkLabel.new(lf, :text=>'').pack(:side=>:left)
+ $set_linenum = proc{|w|
+ line, pos = w.index('insert').split('.')
+ linenum.text = line
+ posnum.text = pos
+ }
+
#b_dis = TkButton.new(bf, :text=>'λ²ò', :default=>:active,
b_dis = TkButton.new(bf, :text=>'ÊĤ¸¤ë', :default=>:active,
:command=>proc{
@@ -948,6 +956,16 @@ def showCode2(demo)
$code_window.bindinfo('Return').each{|cmd, arg|
$code_window.bind_append('Escape', cmd, arg)
}
+
+ btag = TkBindTag.new
+
+ btag.bind('Key', $set_linenum, '%W')
+ btag.bind('Button', $set_linenum, '%W')
+
+ btags = $code_text.bindtags
+ btags.insert(btags.index($code_text.class) + 1, btag)
+ $code_text.bindtags = btags
+
else
$code_window.deiconify
$code_window.raise
@@ -960,22 +978,7 @@ def showCode2(demo)
$code_text.insert('1.0', fid.read)
TkTextMarkInsert.new($code_text,'1.0')
- btag = TkBindTag.new
-
- set_linenum = proc{|w|
- line, pos = w.index('insert').split('.')
- linenum.text = line
- posnum.text = pos
- }
-
- btag.bind('Key', set_linenum, '%W')
- btag.bind('Button', set_linenum, '%W')
-
- btags = $code_text.bindtags
- btags.insert(btags.index($code_text.class) + 1, btag)
- $code_text.bindtags = btags
-
- set_linenum.call($code_text)
+ $set_linenum.call($code_text)
fid.close
end