diff options
author | nagai <nagai@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2004-10-11 04:51:21 +0000 |
---|---|---|
committer | nagai <nagai@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2004-10-11 04:51:21 +0000 |
commit | 3514110b89bee5c37e308b4ca887e66dfe841456 (patch) | |
tree | d280d8542cc44d1cd1a75e8ec87b1f9d231561b7 /ext/tk/sample/demos-jp/widget | |
parent | 05f5928c9d0f094d1e7e21a9bd9d8a8fc2f1a805 (diff) |
* ext/tk/lib/tk/*: untabify
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@7029 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'ext/tk/sample/demos-jp/widget')
-rw-r--r-- | ext/tk/sample/demos-jp/widget | 292 |
1 files changed, 146 insertions, 146 deletions
diff --git a/ext/tk/sample/demos-jp/widget b/ext/tk/sample/demos-jp/widget index 0544127cbb..e8196aec8f 100644 --- a/ext/tk/sample/demos-jp/widget +++ b/ext/tk/sample/demos-jp/widget @@ -28,10 +28,10 @@ when /^4.*/ $font = TkFont.new('-*-Helvetica-Medium-R-Normal--*-140-*-*-*-*-*-*', nil) knjfont = '-*--16-*-jisx0208.1983-0' $kanji_font = TkFont.new('-*-Helvetica-Medium-R-Normal--*-140-*-*-*-*-*-*', - knjfont) + knjfont) TkOption.add('*kanjiFont', knjfont, 'startupFile') $msg_kanji_font=TkFont.new('-*-Helvetica-Medium-R-Normal--*-140-*-*-*-*-*-*', - '-*--24-*-jisx0208.1983-0') + '-*--24-*-jisx0208.1983-0') #when '8.0' # $font = TkFont.new('Helvetica -12') @@ -49,10 +49,10 @@ else $font = TkFont.new('-*-Helvetica-Medium-R-Normal--*-140-*-*-*-*-*-*', nil) knjfont = '-*--16-*-jisx0208.1983-0' $kanji_font = TkFont.new('-*-Helvetica-Medium-R-Normal--*-140-*-*-*-*-*-*', - knjfont) + knjfont) TkOption.add('*kanjiFont', knjfont, 'startupFile') $msg_kanji_font=TkFont.new('-*-Helvetica-Medium-R-Normal--*-140-*-*-*-*-*-*', - '-*--24-*-jisx0208.1983-0') + '-*--24-*-jisx0208.1983-0') end ####### @@ -117,11 +117,11 @@ end # ��˥塼���� TkMenubar.new($root, - [[['File', 0], - ['About ... ', proc{aboutBox}, 0, '<F1>'], - '---', - ['Quit', proc{exit}, 0, 'Meta-Q'] - ]]).pack('side'=>'top', 'fill'=>'x') + [[['File', 0], + ['About ... ', proc{aboutBox}, 0, '<F1>'], + '---', + ['Quit', proc{exit}, 0, 'Meta-Q'] + ]]).pack('side'=>'top', 'fill'=>'x') $root.bind('F1', proc{aboutBox}) $root.bind('Meta-q', proc{exit}) @@ -156,7 +156,7 @@ if $tk_version =~ /^4\.[01]/ else textFrame = TkFrame.new($root) scr = TkScrollbar.new($root, 'orient'=>'vertical', - 'highlightthickness'=>0, 'takefocus'=>1) { + 'highlightthickness'=>0, 'takefocus'=>1) { pack('in'=>textFrame, 'side'=>'right', 'fill'=>'y', 'padx'=>1) } txt = TkText.new($root) { @@ -182,10 +182,10 @@ else statusBar = TkFrame.new($root) {|f| $statusBarLabel = \ TkLabel.new(f, 'text'=>" ", 'relief'=>'sunken', 'bd'=>1, 'anchor'=>'w', - 'font'=>'-*-Helvetica-Medium-R-Normal--*-120-*-*-*-*-*-*') \ + 'font'=>'-*-Helvetica-Medium-R-Normal--*-120-*-*-*-*-*-*') \ .pack('side'=>'left', 'padx'=>2, 'expand'=>'yes', 'fill'=>'both') TkLabel.new(f, 'width'=>8, 'relief'=>'sunken', 'bd'=>1, 'anchor'=>'w', - 'font'=>'-*-Helvetica-Medium-R-Normal--*-120-*-*-*-*-*-*') \ + 'font'=>'-*-Helvetica-Medium-R-Normal--*-120-*-*-*-*-*-*') \ .pack('side'=>'left', 'padx'=>2) }.pack('side'=>'bottom', 'fill'=>'x', 'pady'=>2) end @@ -200,53 +200,53 @@ tag_demospace = TkTextTag.new(txt, 'lmargin1'=>'1c', 'lmargin2'=>'1c') if TkWinfo.depth($root) == 1 tag_demo = TkTextTag.new(txt, 'lmargin1'=>'1c', 'lmargin2'=>'1c', - 'underline'=>1) + 'underline'=>1) $tag_visited = TkTextTag.new(txt, 'lmargin1'=>'1c', 'lmargin2'=>'1c', - 'underline'=>1) + 'underline'=>1) tag_hot = TkTextTag.new(txt, 'background'=>'black', 'foreground'=>'white') else tag_demo = TkTextTag.new(txt, 'lmargin1'=>'1c', 'lmargin2'=>'1c', - 'foreground'=>'blue', 'underline'=>1) + 'foreground'=>'blue', 'underline'=>1) $tag_visited = TkTextTag.new(txt, 'lmargin1'=>'1c', 'lmargin2'=>'1c', - 'foreground'=>'#303080', 'underline'=>1) + 'foreground'=>'#303080', 'underline'=>1) # tag_hot = TkTextTag.new(txt, 'relief'=>'raised', 'borderwidth'=>1, -# 'background'=>'SeaGreen3') +# 'background'=>'SeaGreen3') tag_hot = TkTextTag.new(txt, 'borderwidth'=>1, 'foreground'=>'red') end #tag_demo.bind('Button-1', proc{invoke txt, txt.index('current')}) tag_demo.bind('ButtonRelease-1', - proc{|x,y|invoke txt, txt.index("@#{x},#{y}")}, '%x %y') + proc{|x,y|invoke txt, txt.index("@#{x},#{y}")}, '%x %y') lastLine = TkVariable.new("") newLine = TkVariable.new("") tag_demo.bind('Enter', proc{|x,y| - lastLine.value = txt.index("@#{x},#{y} linestart") - tag_hot.add(lastLine.value, "#{lastLine.value} lineend") - showStatus txt, txt.index("@#{x},#{y}") - }, - '%x %y') + lastLine.value = txt.index("@#{x},#{y} linestart") + tag_hot.add(lastLine.value, "#{lastLine.value} lineend") + showStatus txt, txt.index("@#{x},#{y}") + }, + '%x %y') tag_demo.bind('Leave', - proc{ - tag_hot.remove('1.0','end') - txt.configure('cursor','xterm') - $statusBarLabel.configure('text'=>"") - }) + proc{ + tag_hot.remove('1.0','end') + txt.configure('cursor','xterm') + $statusBarLabel.configure('text'=>"") + }) tag_demo.bind('Motion', proc{|x, y| - newLine.value = txt.index("@#{x},#{y} linestart") - if newLine.value != lastLine.value - tag_hot.remove('1.0','end') - lastLine.value = newLine.value - if ( txt.tag_names("@#{x},#{y}").find{|t| - t.kind_of?(String) && t =~ /^demo-/ - } ) - tag_hot.add(lastLine.value, - "#{lastLine.value} lineend -1 chars") - end - end - showStatus txt, txt.index("@#{x},#{y}") - }, - '%x %y') + newLine.value = txt.index("@#{x},#{y} linestart") + if newLine.value != lastLine.value + tag_hot.remove('1.0','end') + lastLine.value = newLine.value + if ( txt.tag_names("@#{x},#{y}").find{|t| + t.kind_of?(String) && t =~ /^demo-/ + } ) + tag_hot.add(lastLine.value, + "#{lastLine.value} lineend -1 chars") + end + end + showStatus txt, txt.index("@#{x},#{y}") + }, + '%x %y') # �ƥ��������� txt.insert('end', 'Ruby/Tk : Widget', tag_title) @@ -276,47 +276,47 @@ EOT #txt.insert('end',"��٥�, �ܥ���, �����å��ܥ���, �饸���ܥ���\n",tag_middle) txt.insert('end', "��٥�, �ܥ���, �����å��ܥ���, �饸���ܥ���\n", - tag_kanji_title) + tag_kanji_title) txt.insert('end', " \n ", tag_demospace) txt.insert('end', "1. ��٥� (�ƥ�����, �ӥåȥޥå�)\n", - tag_demo, "demo-label") + tag_demo, "demo-label") txt.insert('end', " \n ", tag_demospace) txt.insert('end', "2. ��٥��UNICODE�ƥ����� (��ǽ���б������С�������Tk��ɬ��)\n", tag_demo, "demo-unicodeout") txt.insert('end', " \n ", tag_demospace) txt.insert('end', "3. �ܥ��� \n", tag_demo, "demo-button") txt.insert('end', " \n ", tag_demospace) txt.insert('end', "4. �����å��ܥ��� (ʣ���������ǽ)\n", - tag_demo, "demo-check") + tag_demo, "demo-check") txt.insert('end', " \n ", tag_demospace) txt.insert('end', "5. �����֥����å��ܥ��� (��ǽ���б������С�������Tk��ɬ��)\n", - tag_demo, "demo-check2") + tag_demo, "demo-check2") txt.insert('end', " \n ", tag_demospace) txt.insert('end', "6. �饸���ܥ��� (Ǥ�դΰ�Ĥ������ǽ)\n", - tag_demo, "demo-radio") + tag_demo, "demo-radio") txt.insert('end', " \n ", tag_demospace) txt.insert('end', "7. �饸���ܥ��� (��ǽ���б������С�������Tk��ɬ��)\n", - tag_demo, "demo-radio2") + tag_demo, "demo-radio2") txt.insert('end', " \n ", tag_demospace) txt.insert('end', "8. �����֥饸���ܥ��� (��ǽ���б������С�������Tk��ɬ��)\n", - tag_demo, "demo-radio3") + tag_demo, "demo-radio3") txt.insert('end', " \n ", tag_demospace) txt.insert('end', "9. �ܥ���Ǻ��줿15-�ѥ��륲����\n", - tag_demo, "demo-puzzle") + tag_demo, "demo-puzzle") txt.insert('end', " \n ", tag_demospace) txt.insert('end', "10. �ӥåȥޥåפ���Ѥ�����������ܥ���\n", - tag_demo, "demo-icon") + tag_demo, "demo-icon") txt.insert('end', " \n ", tag_demospace) txt.insert('end', "11. ������ɽ��������ĤΥ�٥�\n", - tag_demo, "demo-image1") + tag_demo, "demo-image1") txt.insert('end', " \n ", tag_demospace) txt.insert('end', "12. �����뤿��δ�ñ�ʥ桼�������ե�����\n", - tag_demo, "demo-image2") + tag_demo, "demo-image2") txt.insert('end', " \n ", tag_demospace) txt.insert('end', "13. �����뤿��δ�ñ�ʥ桼�������ե����� (��ǽ���б������С�������Tk��ɬ��)\n", - tag_demo, "demo-image3") + tag_demo, "demo-image3") txt.insert('end', " \n ", tag_demospace) txt.insert('end', "14. ��٥��դ��ե졼�� (��ǽ���б������С�������Tk��ɬ��)\n", - tag_demo, "demo-labelframe") + tag_demo, "demo-labelframe") txt.insert('end', " \n ", tag_demospace) txt.insert('end', "\n") @@ -326,7 +326,7 @@ txt.insert('end', " \n ", tag_demospace) txt.insert('end', "1. ��ƻ�ܸ�.\n", tag_demo, "demo-states") txt.insert('end', " \n ", tag_demospace) txt.insert('end', "2. ��: ���ץꥱ�������Τ�����ۿ����Ѥ���\n", - "#{tag_demo.id} demo-colors") + "#{tag_demo.id} demo-colors") txt.insert('end', " \n ", tag_demospace) txt.insert('end', "3. �ʸ���\n", tag_demo, "demo-sayings") txt.insert('end', " \n ", tag_demospace) @@ -340,10 +340,10 @@ txt.insert('end', " \n ", tag_demospace) txt.insert('end', "2. ����������С�����\n", tag_demo, "demo-entry2") txt.insert('end', " \n ", tag_demospace) txt.insert('end', "3. ǧ�ڽ����դ��Υ���ȥ�ܥå����ȥѥ���ɥե������ (��ǽ���б������С�������Tk��ɬ��)\n", - tag_demo, "demo-entry3") + tag_demo, "demo-entry3") txt.insert('end', " \n ", tag_demospace) txt.insert('end', "4. ���ԥ�ܥå��� (��ǽ���б������С�������Tk��ɬ��)\n", - tag_demo, "demo-spin") + tag_demo, "demo-spin") txt.insert('end', " \n ", tag_demospace) txt.insert('end', "5. ��ñ�ʥե�����\n", tag_demo, "demo-form") txt.insert('end', " \n ", tag_demospace) @@ -357,13 +357,13 @@ txt.insert('end', " \n ", tag_demospace) txt.insert('end', "2. ɽ����������.\n", tag_demo, "demo-style") txt.insert('end', " \n ", tag_demospace) txt.insert('end', "3. �ϥ��ѡ��ƥ�����(�����Х����).\n", - tag_demo, "demo-bind") + tag_demo, "demo-bind") txt.insert('end', " \n ", tag_demospace) txt.insert('end', "4. ������ɥ�����������ƥ�����\n", - tag_demo, "demo-twind") + tag_demo, "demo-twind") txt.insert('end', " \n ", tag_demospace) txt.insert('end', "5. ������ɥ�����������ƥ����� (��ǽ���б������С�������Tk��ɬ��)\n", - tag_demo, "demo-twind2") + tag_demo, "demo-twind2") txt.insert('end', " \n ", tag_demospace) txt.insert('end', "6. ����\n", tag_demo, "demo-search") txt.insert('end', " \n ", tag_demospace) @@ -387,7 +387,7 @@ txt.insert('end', " \n ", tag_demospace) txt.insert('end', "7. �ե����ץ�� (�ۤʤ륭���Х������ƥ������ˡ�����)\n", tag_demo, "demo-floor2") txt.insert('end', " \n ", tag_demospace) txt.insert('end', "8. �����������ǽ�ʥ����Х�\n", - tag_demo, "demo-cscroll") + tag_demo, "demo-cscroll") txt.insert('end', " \n ", tag_demospace) txt.insert('end', "\n") @@ -403,10 +403,10 @@ txt.insert('end', "\n") txt.insert('end', "�ڥ���ɥ�����ɥ�\n", tag_kanji_title) txt.insert('end', " \n ", tag_demospace) txt.insert('end', "1. ��ʿ���� (��ǽ���б������С�������Tk��ɬ��)\n", - tag_demo.id, "demo-paned1") + tag_demo.id, "demo-paned1") txt.insert('end', " \n ", tag_demospace) txt.insert('end', "2. ��ľ���� (��ǽ���б������С�������Tk��ɬ��)\n", - tag_demo.id, "demo-paned2") + tag_demo.id, "demo-paned2") txt.insert('end', " \n ", tag_demospace) txt.insert('end', "\n") @@ -414,16 +414,16 @@ txt.insert('end', "\n") txt.insert('end', "��˥塼\n", tag_kanji_title) txt.insert('end', " \n ", tag_demospace) txt.insert('end', "1. ��˥塼�ȥ��������ɤ�ޤ��������ɥ�\n", - tag_demo, "demo-menu") + tag_demo, "demo-menu") txt.insert('end', " \n ", tag_demospace) txt.insert('end', "2. ��˥塼�ȥ��������ɤ�ޤ��������ɥ� (Tk8.x ����)\n", - tag_demo, "demo-menu8x") + tag_demo, "demo-menu8x") txt.insert('end', " \n ", tag_demospace) txt.insert('end', "3. �� (��ǽ���б������С�������Tk��ɬ��)\n", - tag_demo, "demo-menu84") + tag_demo, "demo-menu84") txt.insert('end', " \n ", tag_demospace) txt.insert('end', "4. ��˥塼�ܥ��� (Tk8.x ����)\n", - tag_demo, "demo-menubu") + tag_demo, "demo-menubu") txt.insert('end', " \n ", tag_demospace) txt.insert('end', "\n") @@ -444,10 +444,10 @@ txt.insert('end', " \n ", tag_demospace) txt.insert('end', "1. �Ȥ߹��ߤΥӥåȥޥå�\n", tag_demo, "demo-bitmap") txt.insert('end', " \n ", tag_demospace) txt.insert('end', "2. �⡼�������������(�������륰���)\n", - tag_demo, "demo-dialog1") + tag_demo, "demo-dialog1") txt.insert('end', " \n ", tag_demospace) txt.insert('end', "3. �⡼�������������(�������Х륰���)\n", - tag_demo, "demo-dialog2") + tag_demo, "demo-dialog2") txt.insert('end', " \n ", tag_demospace) txt.state('disabled') @@ -483,10 +483,10 @@ def showVars1(parent, *args) } args.each{|vnam,vbody| TkFrame.new(w){|f| - #TkLabel.new(f, 'text'=>"#{vnam}: ").pack('side'=>'left') - TkLabel.new(f, 'text'=>"#{vnam}: ",'width'=>len+2).pack('side'=>'left') - TkLabel.new(f, 'textvariable'=>vbody, 'anchor'=>'w')\ - .pack('side'=>'left', 'expand'=>'yes', 'fill'=>'x') + #TkLabel.new(f, 'text'=>"#{vnam}: ").pack('side'=>'left') + TkLabel.new(f, 'text'=>"#{vnam}: ",'width'=>len+2).pack('side'=>'left') + TkLabel.new(f, 'textvariable'=>vbody, 'anchor'=>'w')\ + .pack('side'=>'left', 'expand'=>'yes', 'fill'=>'x') }.pack('side'=>'top', 'anchor'=>'w', 'fill'=>'x') } TkButton.new(w) { @@ -508,11 +508,11 @@ def showVars2(parent, *args) title "Variable values" TkLabelFrame.new(w, :text=>"�ѿ���:", - :font=>{:family=>'Helvetica', :size=>14}){|f| + :font=>{:family=>'Helvetica', :size=>14}){|f| args.each{|vnam,vbody| - TkGrid(TkLabel.new(f, :text=>"#{vnam}: ", :anchor=>'w'), - TkLabel.new(f, :textvariable=>vbody, :anchor=>'w'), - :padx=>2, :pady=>2, :sticky=>'w') + TkGrid(TkLabel.new(f, :text=>"#{vnam}: ", :anchor=>'w'), + TkLabel.new(f, :textvariable=>vbody, :anchor=>'w'), + :padx=>2, :pady=>2, :sticky=>'w') } f.grid(:sticky=>'news', :padx=>4) @@ -520,7 +520,7 @@ def showVars2(parent, *args) f.grid_rowconfig(100, :weight=>1) } TkButton.new(w, :text=>"λ��", :width=>8, :default=>:active, - :command=>proc{w.destroy}){|b| + :command=>proc{w.destroy}){|b| w.bind('Return', proc{b.invoke}) w.bind('Escape', proc{b.invoke}) @@ -566,7 +566,7 @@ def showStatus (txt, index) else demoname = tag[5..-1] $statusBarLabel.configure('text', - "����ץ�ץ������ \"#{demoname}\" �μ¹� ") + "����ץ�ץ������ \"#{demoname}\" �μ¹� ") newcursor = 'hand2' end txt.configure('cursor'=>newcursor) if cursor != newcursor @@ -583,8 +583,8 @@ def showCode1(demo) #text "λ��" text "�Ĥ���" command proc{ - $code_window.destroy - $code_window = nil + $code_window.destroy + $code_window = nil } }.pack('side'=>'left', 'expand'=>'yes', 'pady'=>2) TkButton.new(f) { @@ -597,43 +597,43 @@ def showCode1(demo) if $tk_version =~ /^4\.[01]/ s = TkScrollbar.new($code_window, 'orient'=>'vertical') $code_text = TkText.new($code_window) { - height 40 - setgrid 'yes' - yscrollcommand proc{|first,last| s.set first,last} + height 40 + setgrid 'yes' + yscrollcommand proc{|first,last| s.set first,last} } s.command(proc{|*args| $code_text.yview(*args)}) s.pack('side'=>'right', 'fill'=>'y') $code_text.pack('side'=>'left', 'expand'=>'yes', 'fill'=>'both') else TkFrame.new($code_window) {|f| - pack('expand'=>'yes', 'fill'=>'both', 'padx'=>1, 'pady'=>1) - - hs = TkScrollbar.new($code_window, 'highlightthickness'=>0, - 'orient'=>'horizontal') - vs = TkScrollbar.new($code_window, 'highlightthickness'=>0, - 'orient'=>'vertical') - $code_text = TkText.new($code_window) {|t| - height 40 - #wrap 'word' - wrap 'char' - xscrollcommand proc{|first,last| hs.set first,last} - yscrollcommand proc{|first,last| vs.set first,last} - setgrid 'yes' - highlightthickness 0 - pady 2 - padx 3 - hs.command(proc{|*args| $code_text.xview(*args)}) - vs.command(proc{|*args| $code_text.yview(*args)}) - } - - $code_text.grid('in'=>f, 'padx'=>1, 'pady'=>1, 'row'=>0, 'column'=>0, - 'rowspan'=>1, 'columnspan'=>1, 'sticky'=>'news') - vs.grid('in'=>f, 'padx'=>1, 'pady'=>1, 'row'=>0, 'column'=>1, - 'rowspan'=>1, 'columnspan'=>1, 'sticky'=>'news') -# xs.grid('in'=>f, '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) + + hs = TkScrollbar.new($code_window, 'highlightthickness'=>0, + 'orient'=>'horizontal') + vs = TkScrollbar.new($code_window, 'highlightthickness'=>0, + 'orient'=>'vertical') + $code_text = TkText.new($code_window) {|t| + height 40 + #wrap 'word' + wrap 'char' + xscrollcommand proc{|first,last| hs.set first,last} + yscrollcommand proc{|first,last| vs.set first,last} + setgrid 'yes' + highlightthickness 0 + pady 2 + padx 3 + hs.command(proc{|*args| $code_text.xview(*args)}) + vs.command(proc{|*args| $code_text.yview(*args)}) + } + + $code_text.grid('in'=>f, 'padx'=>1, 'pady'=>1, 'row'=>0, 'column'=>0, + 'rowspan'=>1, 'columnspan'=>1, 'sticky'=>'news') + vs.grid('in'=>f, 'padx'=>1, 'pady'=>1, 'row'=>0, 'column'=>1, + 'rowspan'=>1, 'columnspan'=>1, 'sticky'=>'news') +# xs.grid('in'=>f, '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) } end else @@ -660,8 +660,8 @@ def showCode2(demo) $code_window = TkToplevel.new(nil) tf = TkFrame.new($code_window) $code_text = TkText.new(tf, :font=>'Courier 10', :height=>30, - :wrap=>'word', :bd=>1, :setgrid=>true, - :highlightthickness=>0, :pady=>2, :padx=>3) + :wrap=>'word', :bd=>1, :setgrid=>true, + :highlightthickness=>0, :pady=>2, :padx=>3) xscr = TkScrollbar.new(tf, :bd=>1){assign($code_text)} yscr = TkScrollbar.new(tf, :bd=>1){assign($code_text)} TkGrid($code_text, yscr, :sticky=>'news') @@ -673,17 +673,17 @@ def showCode2(demo) #b_dis = TkButton.new(bf, :text=>'λ��', :default=>:active, b_dis = TkButton.new(bf, :text=>'�Ĥ���', :default=>:active, - :command=>proc{ - $code_window.destroy - $code_window = nil - }, - :image=>$image['delete'], :compound=>:left) + :command=>proc{ + $code_window.destroy + $code_window = nil + }, + :image=>$image['delete'], :compound=>:left) b_prn = TkButton.new(bf, :text=>'����', - :command=>proc{printCode($code_text, file)}, - :image=>$image['print'], :compound=>:left) + :command=>proc{printCode($code_text, file)}, + :image=>$image['print'], :compound=>:left) b_run = TkButton.new(bf, :text=>'�Ƽ¹�', - :command=>proc{eval($code_text.get('1.0','end'))}, - :image=>$image['refresh'], :compound=>:left) + :command=>proc{eval($code_text.get('1.0','end'))}, + :image=>$image['refresh'], :compound=>:left) TkGrid('x', b_run, b_prn, b_dis, :padx=>4, :pady=>[6,4]) bf.grid_columnconfigure(0, :weight=>1) @@ -694,8 +694,8 @@ def showCode2(demo) $code_window.grid_rowconfigure(0, :weight=>1) $code_window.bind('Return', proc{|win| - b_dis.invoke unless win.kind_of?(TkText) - }, '%W') + b_dis.invoke unless win.kind_of?(TkText) + }, '%W') $code_window.bindinfo('Return').each{|cmd, arg| $code_window.bind_append('Escape', cmd, arg) } @@ -727,8 +727,8 @@ end # Much thanks to Arjen Markus for this. # # Arguments: -# txt - Name of text widget containing code to print -# file - Name of the original file (implicitly for title) +# txt - Name of text widget containing code to print +# file - Name of the original file (implicitly for title) def printCode(txt, file) code = txt.get('1.0', 'end - 1c') @@ -744,27 +744,27 @@ def printCode(txt, file) when 'unix' msg = `lp -c #{fname}` unless $?.exitstatus == 0 - Tk.messageBox(:title=>'Print spooling failure', - :message=>'���顼��ȯ�����ޤ�����' + - '�����˼��Ԥ�����ΤȻפ��ޤ� : ' + msg) + Tk.messageBox(:title=>'Print spooling failure', + :message=>'���顼��ȯ�����ޤ�����' + + '�����˼��Ԥ�����ΤȻפ��ޤ� : ' + msg) end when 'windows' begin - printTextWin32(fname) + printTextWin32(fname) rescue => e - Tk.messageBox(:title=>'Print spooling failure', - :message=>'���顼��ȯ�����ޤ�����' + - '�����˼��Ԥ�����ΤȻפ��ޤ� : ' + - e.message) + Tk.messageBox(:title=>'Print spooling failure', + :message=>'���顼��ȯ�����ޤ�����' + + '�����˼��Ԥ�����ΤȻפ��ޤ� : ' + + e.message) end when 'macintosh' Tk.messageBox(:title=>'Operation not Implemented', - :message=>'������ǽ�Ϥޤ���������Ƥ��ޤ���') + :message=>'������ǽ�Ϥޤ���������Ƥ��ޤ���') else Tk.messageBox(:title=>'Operation not Implemented', - :message=>'���Ф��줿�Ķ� ' + - Tk::TCL_PLATFORM('platform') + - ' ��̤�ΤδĶ��Ǥ��뤿�ᡤ' + + :message=>'���Ф��줿�Ķ� ' + + Tk::TCL_PLATFORM('platform') + + ' ��̤�ΤδĶ��Ǥ��뤿�ᡤ' + '������ǽ�ϼ�������Ƥ��ޤ���: ') end ensure @@ -776,7 +776,7 @@ end # Print a file under Windows # # Arguments: -# filename - Name of the file +# filename - Name of the file # def printTextWin32(fname) require 'win32/registry' @@ -807,12 +807,12 @@ end # def aboutBox Tk.messageBox('icon'=>'info', 'type'=>'ok', 'title'=>'About Widget Demo', - 'message'=>"Ruby/Tk ���������åȥǥ� Ver.1.4.3-jp\n\n" + + 'message'=>"Ruby/Tk ���������åȥǥ� Ver.1.4.3-jp\n\n" + "based on demos of Tk8.1 -- 8.5 " + - "( Copyright:: " + - "(c) 1996-1997 Sun Microsystems, Inc. / " + + "( Copyright:: " + + "(c) 1996-1997 Sun Microsystems, Inc. / " + "(c) 1997-2000 Ajuba Solutions, Inc. / " + - "(c) 2001-2003 Donal K. Fellows )\n\n" + + "(c) 2001-2003 Donal K. Fellows )\n\n" + "Your Ruby & Tk Version ::\n" + "Ruby#{RUBY_VERSION}(#{RUBY_RELEASE_DATE})[#{RUBY_PLATFORM}] / Tk#{$tk_patchlevel}#{(Tk::JAPANIZED_TK)? '-jp': ''}") end @@ -836,7 +836,7 @@ if no_launcher loop do count = 0 $root.winfo_children.each{|w| - count += 1 if w.kind_of?(TkToplevel) + count += 1 if w.kind_of?(TkToplevel) } $root.destroy if count == 0 end |