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 | 7554d0b06f53969d56402f3343c35063a7b4b56a (patch) | |
tree | 81258b81d9111c762cb80ca56141cd1f8ce9d0f9 /ext/tk/sample/tkextlib | |
parent | d3caa0ae0ba3a85108ff11919b227a2ddcf290eb (diff) | |
download | ruby-7554d0b06f53969d56402f3343c35063a7b4b56a.tar.gz ruby-7554d0b06f53969d56402f3343c35063a7b4b56a.tar.xz ruby-7554d0b06f53969d56402f3343c35063a7b4b56a.zip |
* ext/tk/lib/tk/*: untabify
git-svn-id: http://svn.ruby-lang.org/repos/ruby/branches/ruby_1_8@7029 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'ext/tk/sample/tkextlib')
70 files changed, 1104 insertions, 1104 deletions
diff --git a/ext/tk/sample/tkextlib/ICONS/viewIcons.rb b/ext/tk/sample/tkextlib/ICONS/viewIcons.rb index fa8741f41..fc88eb5c8 100644 --- a/ext/tk/sample/tkextlib/ICONS/viewIcons.rb +++ b/ext/tk/sample/tkextlib/ICONS/viewIcons.rb @@ -28,17 +28,17 @@ class ViewIcons ent_groups = TkEntry.new(base, :width=>50, :textvariable=>@groups) btn_browse = TkButton.new(base, :text=>'Browse', - :command=>method(:select_icons)) + :command=>method(:select_icons)) btn_view = TkButton.new(base, :text=>'View', - :command=>method(:display_icons)) + :command=>method(:display_icons)) btn_exit = TkButton.new(base, :text=>'Exit', :command=>proc{exit}) @column_btns = {} 6.step(20, 2){|i| @column_btns[i] = TkButton.new(columns, - :text=>i.to_s, :width=>2, - :command=>proc{set_columns(i)} - ).pack(:side=>:left) + :text=>i.to_s, :width=>2, + :command=>proc{set_columns(i)} + ).pack(:side=>:left) } @column_btns[@columns][:relief] = :sunken @@ -91,15 +91,15 @@ class ViewIcons def _create_info_window @info_window = TkToplevel.new(:background=>'lightyellow', :borderwidth=>1, - :relief=>:solid){|w| + :relief=>:solid){|w| lbl_name = TkLabel.new(w, :text=>'Name', :background=>'lightyellow', - :font=>@boldfont, :justify=>:left) + :font=>@boldfont, :justify=>:left) lbl_grps = TkLabel.new(w, :text=>'Groups', :background=>'lightyellow', - :font=>@boldfont, :justify=>:left) + :font=>@boldfont, :justify=>:left) lbl_type = TkLabel.new(w, :text=>'Type', :background=>'lightyellow', - :font=>@boldfont, :justify=>:left) + :font=>@boldfont, :justify=>:left) lbl_size = TkLabel.new(w, :text=>'Size', :background=>'lightyellow', - :font=>@boldfont, :justify=>:left) + :font=>@boldfont, :justify=>:left) lbl_name.grid(:row=>0, :column=>0, :sticky=>:w) lbl_grps.grid(:row=>1, :column=>0, :sticky=>:w) @@ -117,16 +117,16 @@ class ViewIcons @size.grid(:row=>3, :column=>1, :sticky=>:w) def name(txt) - @name['text'] = txt + @name['text'] = txt end def groups(txt) - @grps['text'] = txt + @grps['text'] = txt end def type(txt) - @type['text'] = txt + @type['text'] = txt end def size(txt) - @size['text'] = txt + @size['text'] = txt end overrideredirect(true) @@ -243,9 +243,9 @@ class ViewIcons if Tk::PLATFORM['platform'] == 'unix' TkSelection.handle(Tk.root, method(:primary_transfer), - :selection=>'PRIMARY') + :selection=>'PRIMARY') TkSelection.set_owner(Tk.root, :selection=>'PRIMARY', - :command=>method(:lost_selection)) + :command=>method(:lost_selection)) end Tk.bell @@ -257,18 +257,18 @@ class ViewIcons width = @controls.winfo_width - @icons_window.yscrollbar.winfo_width - 8 @icons_window.configure(:width=>width, :scrollregion=>bbox, - :xscrollincrement=>'0.1i', - :yscrollincrement=>'0.1i') + :xscrollincrement=>'0.1i', + :yscrollincrement=>'0.1i') end def select_icons new_lib = Tk.getOpenFile(:initialdir=>@initial_dir, - :initialfile=>'tkIcons', - :title=>'Select Icon Library', - :filetypes=>[ - ['Icon Libraries', ['tkIcons*']], - ['All Files', ['*']] - ]) + :initialfile=>'tkIcons', + :title=>'Select Icon Library', + :filetypes=>[ + ['Icon Libraries', ['tkIcons*']], + ['All Files', ['*']] + ]) @library.value = new_lib if new_lib.length != 0 display_icons @@ -281,7 +281,7 @@ class ViewIcons unless File.exist?(@library.value) Tk.messageBox(:icon=>'warning', :message=>'File does not exist', - :title=>'viewIcons') + :title=>'viewIcons') return end @@ -306,10 +306,10 @@ class ViewIcons init_info(lbl, name) if column == limit - column = 0 - row += 1 + column = 0 + row += 1 else - column += 1 + column += 1 end } diff --git a/ext/tk/sample/tkextlib/bwidget/basic.rb b/ext/tk/sample/tkextlib/bwidget/basic.rb index f622c142e..c1521651f 100644 --- a/ext/tk/sample/tkextlib/bwidget/basic.rb +++ b/ext/tk/sample/tkextlib/bwidget/basic.rb @@ -30,37 +30,37 @@ module DemoBasic def self._label(parent) lab = Tk::BWidget::Label.new(parent, :text=>'This is a Label widget', - :helptext=>'Label widget') + :helptext=>'Label widget') chk = TkCheckbutton.new(parent, :text=>'Disabled', - :variable=>@@var.ref(lab, 'state'), - :onvalue=>'disabled', :offvalue=>'normal', - :command=>proc{lab[:state] = @@var[lab, 'state']}) + :variable=>@@var.ref(lab, 'state'), + :onvalue=>'disabled', :offvalue=>'normal', + :command=>proc{lab[:state] = @@var[lab, 'state']}) lab.pack(:anchor=>:w, :pady=>4) chk.pack(:anchor=>:w) end def self._entry(parent) ent = Tk::BWidget::Entry.new(parent, :text=>'Press enter', - :helptext=>'Entry widtet', - :command=>proc{ - @@var['entcmd'] = 'command called' - Tk.after(500, proc{@@var['entcmd'] = ''}) - }) + :helptext=>'Entry widtet', + :command=>proc{ + @@var['entcmd'] = 'command called' + Tk.after(500, proc{@@var['entcmd'] = ''}) + }) chk1 = TkCheckbutton.new(parent, :text=>'Disabled', - :variable=>@@var.ref(ent, 'state'), - :onvalue=>'disabled', :offvalue=>'normal', - :command=>proc{ent.state = @@var[ent, 'state']}) + :variable=>@@var.ref(ent, 'state'), + :onvalue=>'disabled', :offvalue=>'normal', + :command=>proc{ent.state = @@var[ent, 'state']}) chk2 = TkCheckbutton.new(parent, :text=>'Non editable', - :variable=>@@var.ref(ent, 'editable'), - :onvalue=>false, :offvalue=>true, - :command=>proc{ - ent.editable = @@var[ent, 'editable'] - }) + :variable=>@@var.ref(ent, 'editable'), + :onvalue=>false, :offvalue=>true, + :command=>proc{ + ent.editable = @@var[ent, 'editable'] + }) lab = TkLabel.new(parent, :textvariable=>@@var.ref('entcmd'), - :foreground=>'red') + :foreground=>'red') ent.pack(:pady=>4, :anchor=>:w) Tk.pack(chk1, chk2, :anchor=>:w) @@ -70,22 +70,22 @@ module DemoBasic def self._button(parent) frame = TkFrame.new(parent) but = Tk::BWidget::Button.new(frame, :text=>'Press me!', - :repeatdelay=>300, - :command=>proc{_butcmd('command')}, - :helptext=>'This is a Button widget') + :repeatdelay=>300, + :command=>proc{_butcmd('command')}, + :helptext=>'This is a Button widget') sep1 = Tk::BWidget::Separator.new(frame, :orient=>:vertical) arr1 = Tk::BWidget::ArrowButton.new(frame, :type=>:button, - :width=>25, :height=>25, :repeatdelay=>300, - :command=>proc{_butcmd('command')}, - :helptext=>"This is an ArrowButton widget\nof type button") + :width=>25, :height=>25, :repeatdelay=>300, + :command=>proc{_butcmd('command')}, + :helptext=>"This is an ArrowButton widget\nof type button") sep2 = Tk::BWidget::Separator.new(frame, :orient=>:vertical) arr2 = Tk::BWidget::ArrowButton.new(frame, :type=>:arrow, - :width=>25, :height=>25, :relief=>:sunken, - :ipadx=>0, :ipady=>0, :repeatdelay=>300, - :command=>proc{_butcmd('command')}, - :helptext=>"This is an ArrowButton widget\nof type arrow") + :width=>25, :height=>25, :relief=>:sunken, + :ipadx=>0, :ipady=>0, :repeatdelay=>300, + :command=>proc{_butcmd('command')}, + :helptext=>"This is an ArrowButton widget\nof type arrow") but.pack(:side=>:left, :padx=>4) sep1.pack(:side=>:left, :padx=>4, :fill=>:y) @@ -95,51 +95,51 @@ module DemoBasic frame.pack Tk::BWidget::Separator.new(parent, - :orient=>:horizontal).pack(:fill=>:x, :pady=>10) + :orient=>:horizontal).pack(:fill=>:x, :pady=>10) labf1 = Tk::BWidget::LabelFrame.new(parent, :text=>'Command', - :side=>:top, :anchor=>:w, - :relief=>:sunken, :borderwidth=>1) + :side=>:top, :anchor=>:w, + :relief=>:sunken, :borderwidth=>1) subf = labf1.get_frame chk1 = TkCheckbutton.new(subf, :text=>'Disabled', - :variable=>@@var.ref('bstate'), - :onvalue=>'disabled', :offvalue=>'normal', - :command=>proc{_bstate(@@var['bstate'], - but, arr1, arr2)}) + :variable=>@@var.ref('bstate'), + :onvalue=>'disabled', :offvalue=>'normal', + :command=>proc{_bstate(@@var['bstate'], + but, arr1, arr2)}) chk2 = TkCheckbutton.new(subf, :text=>"Use armcommand/\ndisarmcommand", - :variable=>@@var.ref('barmcmd'), - :command=>proc{_barmcmd(@@var['barmcmd'], - but, arr1, arr2)}) + :variable=>@@var.ref('barmcmd'), + :command=>proc{_barmcmd(@@var['barmcmd'], + but, arr1, arr2)}) Tk.pack(chk1, chk2, :anchor=>:w) label = TkLabel.new(parent, :textvariable=>@@var.ref('butcmd'), - :foreground=>'red').pack(:side=>:bottom, :pady=>4) + :foreground=>'red').pack(:side=>:bottom, :pady=>4) labf2 = Tk::BWidget::LabelFrame.new(parent, :text=>'Direction', - :side=>:top, :anchor=>:w, - :relief=>:sunken, :borderwidth=>1) + :side=>:top, :anchor=>:w, + :relief=>:sunken, :borderwidth=>1) subf = labf2.get_frame @@var['bside'] = :top [:top, :left, :bottom, :right].each{|dir| TkRadiobutton.new(subf, :text=>"#{dir} arrow", - :variable=>@@var.ref('bside'), :value=>dir, - :command=>proc{_bside(@@var['bside'], arr1, arr2)} - ).pack(:anchor=>:w) + :variable=>@@var.ref('bside'), :value=>dir, + :command=>proc{_bside(@@var['bside'], arr1, arr2)} + ).pack(:anchor=>:w) } labf3 = Tk::BWidget::LabelFrame.new(parent, :text=>'Relief', - :side=>:top, :anchor=>:w, - :relief=>:sunken, :borderwidth=>1) + :side=>:top, :anchor=>:w, + :relief=>:sunken, :borderwidth=>1) subf = labf3.get_frame @@var['brelief'] = :raised [ %w(raised sunken ridge groove), %w(flat solid link)].each{|lrelief| f = TkFrame.new(subf) lrelief.each{|relief| - TkRadiobutton.new(f, :text=>relief, - :variable=>@@var.ref('brelief'), :value=>relief, - :command=>proc{ - _brelief(@@var['brelief'], but, arr1, arr2) - }).pack(:anchor=>:w) + TkRadiobutton.new(f, :text=>relief, + :variable=>@@var.ref('brelief'), :value=>relief, + :command=>proc{ + _brelief(@@var['brelief'], but, arr1, arr2) + }).pack(:anchor=>:w) } f.pack(:side=>:left, :padx=>2, :anchor=>:n) } @@ -164,19 +164,19 @@ module DemoBasic def self._barmcmd(value, but, arr1, arr2) if TkComm.bool(value) but.configure(:armcommand=>proc{_butcmd('arm')}, - :disarmcommand=>proc{_butcmd('disarm')}, - :command=>'') + :disarmcommand=>proc{_butcmd('disarm')}, + :command=>'') [arr1, arr2].each{|arr| - arr.configure(:armcommand=>proc{_butcmd('arm')}, - :disarmcommand=>proc{_butcmd('disarm')}, - :command=>'') + arr.configure(:armcommand=>proc{_butcmd('arm')}, + :disarmcommand=>proc{_butcmd('disarm')}, + :command=>'') } else but.configure(:armcommand=>'', :disarmcommand=>'', - :command=>proc{_butcmd('command')}) + :command=>proc{_butcmd('command')}) [arr1, arr2].each{|arr| - arr.configure(:armcommand=>'', :disarmcommand=>'', - :command=>proc{_butcmd('command')}) + arr.configure(:armcommand=>'', :disarmcommand=>'', + :command=>proc{_butcmd('command')}) } end end diff --git a/ext/tk/sample/tkextlib/bwidget/demo.rb b/ext/tk/sample/tkextlib/bwidget/demo.rb index e192cd636..785d2681a 100644 --- a/ext/tk/sample/tkextlib/bwidget/demo.rb +++ b/ext/tk/sample/tkextlib/bwidget/demo.rb @@ -54,26 +54,26 @@ class BWidget_Demo descmenu = [ '&File', 'all', 'file', 0, [ - ['command', 'E&xit', [], 'Exit BWidget demo', [], - {:command=>proc{exit}}] + ['command', 'E&xit', [], 'Exit BWidget demo', [], + {:command=>proc{exit}}] ], '&Options', 'all', 'options', 0, [ - ['checkbutton', 'Toolbar &1', ['all', 'option'], - 'Show/hide toolbar 1', [], - { :variable=>DemoVar.toolbar1, - :command=>proc{ - DemoVar.mainframe.show_toolbar(0, DemoVar.toolbar1.value) - } - } - ], - ['checkbutton', 'Toolbar &2', ['all', 'option'], - 'Show/hide toolbar 2', [], - { :variable=>DemoVar.toolbar2, - :command=>proc{ - DemoVar.mainframe.show_toolbar(1, DemoVar.toolbar2.value) - } - } - ] + ['checkbutton', 'Toolbar &1', ['all', 'option'], + 'Show/hide toolbar 1', [], + { :variable=>DemoVar.toolbar1, + :command=>proc{ + DemoVar.mainframe.show_toolbar(0, DemoVar.toolbar1.value) + } + } + ], + ['checkbutton', 'Toolbar &2', ['all', 'option'], + 'Show/hide toolbar 2', [], + { :variable=>DemoVar.toolbar2, + :command=>proc{ + DemoVar.mainframe.show_toolbar(1, DemoVar.toolbar2.value) + } + } + ] ] ] @@ -81,63 +81,63 @@ class BWidget_Demo DemoVar.prgindic.value = 0 DemoVar.mainframe = Tk::BWidget::MainFrame.new( - :menu=>descmenu, - :textvariable=>DemoVar.status, - :progressvar=>DemoVar.prgindic - ) + :menu=>descmenu, + :textvariable=>DemoVar.status, + :progressvar=>DemoVar.prgindic + ) # toobar 1 creation DemoVar.prgindic.numeric += 1 DemoVar.mainframe.add_toolbar{|tb1| Tk::BWidget::ButtonBox.new(tb1, :spacing=>0, :padx=>1, :pady=>1){|bbox| - add(:image=>Tk::BWidget::Bitmap.new('new'), - :highlightthickness=>0, :takefocus=>0, :relief=>:link, - :borderwidth=>1, :padx=>1, :pady=>1, - :command=>proc{puts 'select "Create a new file" icon'}, - :helptext=>"Create a new file") - - add(:image=>Tk::BWidget::Bitmap.new('open'), - :highlightthickness=>0, :takefocus=>0, :relief=>:link, - :borderwidth=>1, :padx=>1, :pady=>1, - :command=>proc{puts 'select "Open an existing file" icon'}, - :helptext=>"Open an existing file") - - add(:image=>Tk::BWidget::Bitmap.new('save'), - :highlightthickness=>0, :takefocus=>0, :relief=>:link, - :borderwidth=>1, :padx=>1, :pady=>1, - :command=>proc{puts 'select "Save file" icon'}, - :helptext=>"Save file") - - pack(:side=>:left, :anchor=>:w) + add(:image=>Tk::BWidget::Bitmap.new('new'), + :highlightthickness=>0, :takefocus=>0, :relief=>:link, + :borderwidth=>1, :padx=>1, :pady=>1, + :command=>proc{puts 'select "Create a new file" icon'}, + :helptext=>"Create a new file") + + add(:image=>Tk::BWidget::Bitmap.new('open'), + :highlightthickness=>0, :takefocus=>0, :relief=>:link, + :borderwidth=>1, :padx=>1, :pady=>1, + :command=>proc{puts 'select "Open an existing file" icon'}, + :helptext=>"Open an existing file") + + add(:image=>Tk::BWidget::Bitmap.new('save'), + :highlightthickness=>0, :takefocus=>0, :relief=>:link, + :borderwidth=>1, :padx=>1, :pady=>1, + :command=>proc{puts 'select "Save file" icon'}, + :helptext=>"Save file") + + pack(:side=>:left, :anchor=>:w) } Tk::BWidget::Separator.new(tb1, :orient=>:vertical){ - pack(:side=>:left, :fill=>:y, :padx=>4, :anchor=>:w) + pack(:side=>:left, :fill=>:y, :padx=>4, :anchor=>:w) } DemoVar.prgindic.numeric += 1 Tk::BWidget::ButtonBox.new(tb1, :spacing=>0, :padx=>1, :pady=>1){|bbox| - add(:image=>Tk::BWidget::Bitmap.new('cut'), - :highlightthickness=>0, :takefocus=>0, :relief=>:link, - :borderwidth=>1, :padx=>1, :pady=>1, - :command=>proc{puts 'select "Cut selection" icon'}, - :helptext=>"Cut selection") - - add(:image=>Tk::BWidget::Bitmap.new('copy'), - :highlightthickness=>0, :takefocus=>0, :relief=>:link, - :borderwidth=>1, :padx=>1, :pady=>1, - :command=>proc{puts 'select "Copy selection" icon'}, - :helptext=>"Copy selection") - - add(:image=>Tk::BWidget::Bitmap.new('paste'), - :highlightthickness=>0, :takefocus=>0, :relief=>:link, - :borderwidth=>1, :padx=>1, :pady=>1, - :command=>proc{puts 'select "Paste selection" icon'}, - :helptext=>"Paste selection") - - pack(:side=>:left, :anchor=>:w) + add(:image=>Tk::BWidget::Bitmap.new('cut'), + :highlightthickness=>0, :takefocus=>0, :relief=>:link, + :borderwidth=>1, :padx=>1, :pady=>1, + :command=>proc{puts 'select "Cut selection" icon'}, + :helptext=>"Cut selection") + + add(:image=>Tk::BWidget::Bitmap.new('copy'), + :highlightthickness=>0, :takefocus=>0, :relief=>:link, + :borderwidth=>1, :padx=>1, :pady=>1, + :command=>proc{puts 'select "Copy selection" icon'}, + :helptext=>"Copy selection") + + add(:image=>Tk::BWidget::Bitmap.new('paste'), + :highlightthickness=>0, :takefocus=>0, :relief=>:link, + :borderwidth=>1, :padx=>1, :pady=>1, + :command=>proc{puts 'select "Paste selection" icon'}, + :helptext=>"Paste selection") + + pack(:side=>:left, :anchor=>:w) } } @@ -147,7 +147,7 @@ class BWidget_Demo tb2 = DemoVar.mainframe.add_toolbar DemoVar._wfont = Tk::BWidget::SelectFont::Toolbar.new(tb2, :command=>proc{update_font(DemoVar._wfont[:font])} - ) + ) DemoVar.font = DemoVar._wfont[:font] DemoVar._wfont.pack(:side=>:left, :anchor=>:w) @@ -214,18 +214,18 @@ class BWidget_Demo top.overrideredirect(true) ximg = TkLabel.new(top, :bitmap=>"@#{File.join(DEMODIR,'x1.xbm')}", - :foreground=>'grey90', :background=>'white') + :foreground=>'grey90', :background=>'white') bwimg = TkLabel.new(ximg, :bitmap=>"@#{File.join(DEMODIR,'bwidget.xbm')}", - :foreground=>'grey90', :background=>'white') + :foreground=>'grey90', :background=>'white') frame = TkFrame.new(ximg, :background=>'white') TkLabel.new(frame, :text=>'Loading demo', - :background=>'white', :font=>'times 8').pack + :background=>'white', :font=>'times 8').pack TkLabel.new(frame, :textvariable=>DemoVar.prgtext, - :background=>'white', :font=>'times 8', :width=>35).pack + :background=>'white', :font=>'times 8', :width=>35).pack Tk::BWidget::ProgressBar.new(frame, :width=>50, :height=>10, - :background=>'white', - :variable=>DemoVar.prgindic, - :maximum=>10).pack + :background=>'white', + :variable=>DemoVar.prgindic, + :maximum=>10).pack frame.place(:x=>0, :y=>0, :anchor=>:nw) bwimg.place(:relx=>1, :rely=>1, :anchor=>:se) ximg.pack diff --git a/ext/tk/sample/tkextlib/bwidget/dnd.rb b/ext/tk/sample/tkextlib/bwidget/dnd.rb index fd6cc40dd..1c8b03653 100644 --- a/ext/tk/sample/tkextlib/bwidget/dnd.rb +++ b/ext/tk/sample/tkextlib/bwidget/dnd.rb @@ -13,19 +13,19 @@ module DemoDnD subf = titf1.get_frame ent1 = Tk::BWidget::LabelEntry.new(subf, :label=>'Entry', - :labelwidth=>14, :dragenabled=>true, - :dragevent=>3) + :labelwidth=>14, :dragenabled=>true, + :dragevent=>3) labf1 = Tk::BWidget::LabelFrame.new(subf, :text=>'Label (text)', - :width=>14) + :width=>14) f = labf1.get_frame lab = Tk::BWidget::Label.new(f, :text=>'Drag this text', - :dragenabled=>true, :dragevent=>3).pack + :dragenabled=>true, :dragevent=>3).pack labf2 = Tk::BWidget::LabelFrame.new(subf, :text=>'Label (bitmap)', - :width=>14) + :width=>14) f = labf2.get_frame lab = Tk::BWidget::Label.new(f, :bitmap=>'info', - :dragenabled=>true, :dragevent=>3).pack + :dragenabled=>true, :dragevent=>3).pack Tk.pack(ent1, labf1, labf2, :side=>:top, :fill=>:x, :pady=>4) @@ -33,11 +33,11 @@ module DemoDnD subf = titf2.get_frame ent1 = Tk::BWidget::LabelEntry.new(subf, :label=>'Entry', - :labelwidth=>14, :dropenabled=>true) + :labelwidth=>14, :dropenabled=>true) labf1 = Tk::BWidget::LabelFrame.new(subf, :text=>'Label', :width=>14) f = labf1.get_frame lab = Tk::BWidget::Label.new(f, :dropenabled=>true, - :highlightthickness=>1).pack(:fill=>:x) + :highlightthickness=>1).pack(:fill=>:x) Tk.pack(ent1, labf1, :side=>:top, :fill=>:x, :pady=>4) Tk.pack(titf1, titf2, :pady=>4) diff --git a/ext/tk/sample/tkextlib/bwidget/manager.rb b/ext/tk/sample/tkextlib/bwidget/manager.rb index 65bbe0f9e..776cb3065 100644 --- a/ext/tk/sample/tkextlib/bwidget/manager.rb +++ b/ext/tk/sample/tkextlib/bwidget/manager.rb @@ -33,34 +33,34 @@ module DemoManager def self._mainframe(parent) labf1 = Tk::BWidget::LabelFrame.new(parent, :text=>'Toolbar', - :side=>:top, :anchor=>:w, - :relief=>:sunken, :borderwidth=>2) + :side=>:top, :anchor=>:w, + :relief=>:sunken, :borderwidth=>2) subf = labf1.get_frame chk1 = TkCheckbutton.new(subf, :text=>'View toolbar 1', - :variable=>DemoVar.toolbar1, - :command=>proc{ - DemoVar.mainframe.show_toolbar( - 0, DemoVar.toolbar1.value - ) - }) + :variable=>DemoVar.toolbar1, + :command=>proc{ + DemoVar.mainframe.show_toolbar( + 0, DemoVar.toolbar1.value + ) + }) chk2 = TkCheckbutton.new(subf, :text=>'View toolbar 2', - :variable=>DemoVar.toolbar2, - :command=>proc{ - DemoVar.mainframe.show_toolbar( - 1, DemoVar.toolbar2.value - ) - }) + :variable=>DemoVar.toolbar2, + :command=>proc{ + DemoVar.mainframe.show_toolbar( + 1, DemoVar.toolbar2.value + ) + }) Tk.pack(chk1, chk2, :anchor=>:w, :fill=>:x) labf1.pack(:fill=>:both) labf2 = Tk::BWidget::LabelFrame.new(parent, :text=>'Status bar', - :side=>:top, :anchor=>:w, - :relief=>:sunken, :borderwidth=>2) + :side=>:top, :anchor=>:w, + :relief=>:sunken, :borderwidth=>2) subf = labf2.get_frame chk1 = TkCheckbutton.new(subf, :text=>"Show Progress\nindicator", - :justify=>:left, :variable=>@@progress, - :command=>proc{ _show_progress }) + :justify=>:left, :variable=>@@progress, + :command=>proc{ _show_progress }) chk1.pack(:anchor=>:w, :fill=>:x) Tk.pack(labf1, labf2, :side=>:left, :padx=>4, :fill=>:both) @@ -68,10 +68,10 @@ module DemoManager def self._notebook(parent) TkCheckbutton.new(parent, :text=>'Homogeneous label', - :variable=>@@homogeneous, - :command=>proc{ - DemoVar.notebook[:homogeneous] = @@homogeneous.value - }).pack(:side=>:left, :anchor=>:n, :fill=>:x) + :variable=>@@homogeneous, + :command=>proc{ + DemoVar.notebook[:homogeneous] = @@homogeneous.value + }).pack(:side=>:left, :anchor=>:n, :fill=>:x) end def self._paned(parent) @@ -93,15 +93,15 @@ module DemoManager } sw = Tk::BWidget::ScrolledWindow.new(pane3, :relief=>:sunken, - :borderwidth=>2) + :borderwidth=>2) sf = Tk::BWidget::ScrollableFrame.new(sw) sw.set_widget(sf) subf = sf.get_frame lab = TkLabel.new(subf, :text=>'This is a ScrollableFrame') chk = TkCheckbutton.new(subf, :text=>'Constrained with', - :variable=>@@constw, :command=>proc{ - sf['constrainedwidth'] = @@constw.value - }) + :variable=>@@constw, :command=>proc{ + sf['constrainedwidth'] = @@constw.value + }) lab.pack chk.pack(:anchor=>:w) chk.bind('FocusIn', proc{sf.see(chk)}) @@ -133,13 +133,13 @@ module DemoManager def self._update_progress if @@progress.bool if DemoVar.prgindic.numeric < 100 - DemoVar.prgindic.numeric += 5 + DemoVar.prgindic.numeric += 5 else - @@progress.value = false - DemoVar.mainframe.show_statusbar(:status) - DemoVar.status.value = 'Done' - @@afterobj.stop - Tk.after(500, proc{ DemoVar.status.value = '' }) + @@progress.value = false + DemoVar.mainframe.show_statusbar(:status) + DemoVar.status.value = 'Done' + @@afterobj.stop + Tk.after(500, proc{ DemoVar.status.value = '' }) end else @@afterobj.stop diff --git a/ext/tk/sample/tkextlib/bwidget/select.rb b/ext/tk/sample/tkextlib/bwidget/select.rb index a04d8da48..ea24b47e2 100644 --- a/ext/tk/sample/tkextlib/bwidget/select.rb +++ b/ext/tk/sample/tkextlib/bwidget/select.rb @@ -14,30 +14,30 @@ module DemoSelect titf1 = Tk::BWidget::TitleFrame.new(frame, :text=>'SpinBox') subf = titf1.get_frame spin = Tk::BWidget::SpinBox.new(subf, :range=>[1, 100, 1], - :textvariable=>@@var.ref('spin', 'var'), - :helptext=>'This is the SpinBox') + :textvariable=>@@var.ref('spin', 'var'), + :helptext=>'This is the SpinBox') ent = Tk::BWidget::LabelEntry.new(subf, :label=>'Linked var', - :labelwidth=>10, :labelanchor=>:w, - :textvariable=>@@var.ref('spin', 'var'), - :editable=>0, - :helptext=>"This is an Entry reflecting\nthe linked var of SpinBox") + :labelwidth=>10, :labelanchor=>:w, + :textvariable=>@@var.ref('spin', 'var'), + :editable=>0, + :helptext=>"This is an Entry reflecting\nthe linked var of SpinBox") labf = Tk::BWidget::LabelFrame.new(subf, :text=>'Options', - :side=>:top, :anchor=>:w, - :relief=>:sunken, :borderwidth=>1, - :helptext=>'Modify some options of SpinBox') + :side=>:top, :anchor=>:w, + :relief=>:sunken, :borderwidth=>1, + :helptext=>'Modify some options of SpinBox') subf = labf.get_frame chk1 = TkCheckbutton.new(subf, :text=>'Non editable', - :variable=>@@var.ref('spin', 'editable'), - :onvalue=>false, :offvalue=>true, - :command=>proc{ - spin.editable(@@var['spin', 'editable']) - }) + :variable=>@@var.ref('spin', 'editable'), + :onvalue=>false, :offvalue=>true, + :command=>proc{ + spin.editable(@@var['spin', 'editable']) + }) chk2 = TkCheckbutton.new(subf, :text=>'Disabled', - :variable=>@@var.ref('spin', 'state'), - :onvalue=>'disabled', :offvalue=>'normal', - :command=>proc{ - spin.state(@@var['spin', 'state']) - }) + :variable=>@@var.ref('spin', 'state'), + :onvalue=>'disabled', :offvalue=>'normal', + :command=>proc{ + spin.state(@@var['spin', 'state']) + }) Tk.pack(chk1, chk2, :side=>:left, :anchor=>:w) Tk.pack(spin, ent, labf, :pady=>4, :fill=>:x) titf1.pack @@ -45,33 +45,33 @@ module DemoSelect titf2 = Tk::BWidget::TitleFrame.new(frame, :text=>'ComboBox') subf = titf2.get_frame combo = Tk::BWidget::ComboBox.new(subf, - :textvariable=>@@var.ref('combo', 'var'), - :values=>[ - 'first value', 'second value', - 'third value', 'fourth value', - 'fifth value' - ], - :helptext=>'This is the ComboBox') + :textvariable=>@@var.ref('combo', 'var'), + :values=>[ + 'first value', 'second value', + 'third value', 'fourth value', + 'fifth value' + ], + :helptext=>'This is the ComboBox') ent = Tk::BWidget::LabelEntry.new(subf, :label=>'Linked var', - :labelwidth=>10, :labelanchor=>:w, - :textvariable=>@@var.ref('combo', 'var'), - :editable=>0, :helptext=>"This is an Entry reflecting\nthe linked var of ComboBox") + :labelwidth=>10, :labelanchor=>:w, + :textvariable=>@@var.ref('combo', 'var'), + :editable=>0, :helptext=>"This is an Entry reflecting\nthe linked var of ComboBox") labf = Tk::BWidget::LabelFrame.new(subf, :text=>'Options', :side=>:top, - :anchor=>:w, :relief=>:sunken, - :borderwidth=>1, :helptext=>'Modify some options of ComboBox') + :anchor=>:w, :relief=>:sunken, + :borderwidth=>1, :helptext=>'Modify some options of ComboBox') subf = labf.get_frame chk1 = TkCheckbutton.new(subf, :text=>'Non editable', - :variable=>@@var.ref('combo', 'editable'), - :onvalue=>false, :offvalue=>true, - :command=>proc{ - combo.editable(@@var['combo', 'editable']) - }) + :variable=>@@var.ref('combo', 'editable'), + :onvalue=>false, :offvalue=>true, + :command=>proc{ + combo.editable(@@var['combo', 'editable']) + }) chk2 = TkCheckbutton.new(subf, :text=>'Disabled', - :variable=>@@var.ref('combo', 'state'), - :onvalue=>'disabled', :offvalue=>'normal', - :command=>proc{ - combo.state(@@var['combo', 'state']) - }) + :variable=>@@var.ref('combo', 'state'), + :onvalue=>'disabled', :offvalue=>'normal', + :command=>proc{ + combo.state(@@var['combo', 'state']) + }) Tk.pack(chk1, chk2, :side=>:left, :anchor=>:w) Tk.pack(combo, ent, labf, :pady=>4, :fill=>:x) diff --git a/ext/tk/sample/tkextlib/bwidget/tmpldlg.rb b/ext/tk/sample/tkextlib/bwidget/tmpldlg.rb index 1ed84e21a..3d19c8d09 100644 --- a/ext/tk/sample/tkextlib/bwidget/tmpldlg.rb +++ b/ext/tk/sample/tkextlib/bwidget/tmpldlg.rb @@ -24,14 +24,14 @@ module DemoDialog subf = titf1.get_frame cmd = proc{ TkOption.read_file(File.join(Tk::BWidget::LIBRARY, 'lang', - @@resources.value + '.rc')) } + @@resources.value + '.rc')) } Tk.pack(TkRadiobutton.new(subf, :text=>'English', :value=>'en', - :variable=>@@resources, :command=>cmd), - TkRadiobutton.new(subf, :text=>'French', :value=>'fr', - :variable=>@@resources, :command=>cmd), - TkRadiobutton.new(subf, :text=>'German', :value=>'de', - :variable=>@@resources, :command=>cmd), - :side=>:left) + :variable=>@@resources, :command=>cmd), + TkRadiobutton.new(subf, :text=>'French', :value=>'fr', + :variable=>@@resources, :command=>cmd), + TkRadiobutton.new(subf, :text=>'German', :value=>'de', + :variable=>@@resources, :command=>cmd), + :side=>:left) _tmpldlg(titf2.get_frame) _msgdlg(titf3.get_frame) @@ -47,34 +47,34 @@ module DemoDialog @@tmpl['anchor'] = :c labf1 = Tk::BWidget::LabelFrame.new(parent, :text=>'Button side', - :side=>:top, :anchor=>:w, - :relief=>:sunken, :borderwidth=>1) + :side=>:top, :anchor=>:w, + :relief=>:sunken, :borderwidth=>1) subf = labf1.get_frame Tk.pack(TkRadiobutton.new(subf, :text=>'Bottom', :value=>:bottom, - :variable=>@@tmpl.ref('side'), :anchor=>:w), - TkRadiobutton.new(subf, :text=>'Left', :value=>:left, - :variable=>@@tmpl.ref('side'), :anchor=>:w), - TkRadiobutton.new(subf, :text=>'Right', :value=>:right, - :variable=>@@tmpl.ref('side'), :anchor=>:w), - TkRadiobutton.new(subf, :text=>'Top', :value=>:top, - :variable=>@@tmpl.ref('side'), :anchor=>:w), - :fill=>:x, :anchor=>:w) + :variable=>@@tmpl.ref('side'), :anchor=>:w), + TkRadiobutton.new(subf, :text=>'Left', :value=>:left, + :variable=>@@tmpl.ref('side'), :anchor=>:w), + TkRadiobutton.new(subf, :text=>'Right', :value=>:right, + :variable=>@@tmpl.ref('side'), :anchor=>:w), + TkRadiobutton.new(subf, :text=>'Top', :value=>:top, + :variable=>@@tmpl.ref('side'), :anchor=>:w), + :fill=>:x, :anchor=>:w) labf2 = Tk::BWidget::LabelFrame.new(parent, :text=>'Button anchor', - :side=>:top, :anchor=>:w, - :relief=>:sunken, :borderwidth=>1) + :side=>:top, :anchor=>:w, + :relief=>:sunken, :borderwidth=>1) subf = labf2.get_frame Tk.pack(TkRadiobutton.new(subf, :text=>'North', :value=>:n, - :variable=>@@tmpl.ref('anchor'), :anchor=>:w), - TkRadiobutton.new(subf, :text=>'West', :value=>:w, - :variable=>@@tmpl.ref('anchor'), :anchor=>:w), - TkRadiobutton.new(subf, :text=>'East', :value=>:e, - :variable=>@@tmpl.ref('anchor'), :anchor=>:w), - TkRadiobutton.new(subf, :text=>'South', :value=>:s, - :variable=>@@tmpl.ref('anchor'), :anchor=>:w), - TkRadiobutton.new(subf, :text=>'Center', :value=>:c, - :variable=>@@tmpl.ref('anchor'), :anchor=>:w), - :fill=>:x, :anchor=>:w) + :variable=>@@tmpl.ref('anchor'), :anchor=>:w), + TkRadiobutton.new(subf, :text=>'West', :value=>:w, + :variable=>@@tmpl.ref('anchor'), :anchor=>:w), + TkRadiobutton.new(subf, :text=>'East', :value=>:e, + :variable=>@@tmpl.ref('anchor'), :anchor=>:w), + TkRadiobutton.new(subf, :text=>'South', :value=>:s, + :variable=>@@tmpl.ref('anchor'), :anchor=>:w), + TkRadiobutton.new(subf, :text=>'Center', :value=>:c, + :variable=>@@tmpl.ref('anchor'), :anchor=>:w), + :fill=>:x, :anchor=>:w) sep = Tk::BWidget::Separator.new(parent, :orient=>:horizontal) button = TkButton.new(parent, :text=>'Show', :command=>proc{_show_tmpldlg}) @@ -89,44 +89,44 @@ module DemoDialog @@msg['icon'] = 'info' labf1 = Tk::BWidget::LabelFrame.new(parent, :text=>'Type', :side=>:top, - :anchor=>:w, :relief=>:sunken, - :borderwidth=>1) + :anchor=>:w, :relief=>:sunken, + :borderwidth=>1) subf = labf1.get_frame Tk.pack(TkRadiobutton.new(subf, :text=>'Ok', :value=>'ok', - :variable=>@@msg.ref('type'), :anchor=>:w), - TkRadiobutton.new(subf, :text=>'Ok, Cancel', :value=>'okcancel', - :variable=>@@msg.ref('type'), :anchor=>:w), - TkRadiobutton.new(subf, :text=>'Retry, Cancel', - :value=>'retrycancel', - :variable=>@@msg.ref('type'), :anchor=>:w), - TkRadiobutton.new(subf, :text=>'Yes, No', :value=>'yesno', - :variable=>@@msg.ref('type'), :anchor=>:w), - TkRadiobutton.new(subf, :text=>'Yes, No, Cancel', - :value=>'yesnocancel', - :variable=>@@msg.ref('type'), :anchor=>:w), - TkRadiobutton.new(subf, :text=>'Abort, Retry, Ignore', - :value=>'abortretryignore', - :variable=>@@msg.ref('type'), :anchor=>:w), - :fill=>:x, :anchor=>:w) + :variable=>@@msg.ref('type'), :anchor=>:w), + TkRadiobutton.new(subf, :text=>'Ok, Cancel', :value=>'okcancel', + :variable=>@@msg.ref('type'), :anchor=>:w), + TkRadiobutton.new(subf, :text=>'Retry, Cancel', + :value=>'retrycancel', + :variable=>@@msg.ref('type'), :anchor=>:w), + TkRadiobutton.new(subf, :text=>'Yes, No', :value=>'yesno', + :variable=>@@msg.ref('type'), :anchor=>:w), + TkRadiobutton.new(subf, :text=>'Yes, No, Cancel', + :value=>'yesnocancel', + :variable=>@@msg.ref('type'), :anchor=>:w), + TkRadiobutton.new(subf, :text=>'Abort, Retry, Ignore', + :value=>'abortretryignore', + :variable=>@@msg.ref('type'), :anchor=>:w), + :fill=>:x, :anchor=>:w) Tk.pack(TkRadiobutton.new(subf, :text=>'User', :value=>'user', - :variable=>@@msg.ref('type'), :anchor=>:w), - Tk::BWidget::Entry.new(subf, :textvariable=>@@msg.ref('buttons')), - :side=>:left) + :variable=>@@msg.ref('type'), :anchor=>:w), + Tk::BWidget::Entry.new(subf, :textvariable=>@@msg.ref('buttons')), + :side=>:left) labf2 = Tk::BWidget::LabelFrame.new(parent, :text=>'Icon', :side=>:top, - :anchor=>:w, :relief=>:sunken, - :borderwidth=>1) + :anchor=>:w, :relief=>:sunken, + :borderwidth=>1) subf = labf2.get_frame Tk.pack(TkRadiobutton.new(subf, :text=>'Information', :value=>'info', - :variable=>@@msg.ref('icon'), :anchor=>:w), - TkRadiobutton.new(subf, :text=>'Question', :value=>'question', - :variable=>@@msg.ref('icon'), :anchor=>:w), - TkRadiobutton.new(subf, :text=>'Warning', :value=>'warning', - :variable=>@@msg.ref('icon'), :anchor=>:w), - TkRadiobutton.new(subf, :text=>'Error', :value=>'error', - :variable=>@@msg.ref('icon'), :anchor=>:w), - :fill=>:x, :anchor=>:w) + :variable=>@@msg.ref('icon'), :anchor=>:w), + TkRadiobutton.new(subf, :text=>'Question', :value=>'question', + :variable=>@@msg.ref('icon'), :anchor=>:w), + TkRadiobutton.new(subf, :text=>'Warning', :value=>'warning', + :variable=>@@msg.ref('icon'), :anchor=>:w), + TkRadiobutton.new(subf, :text=>'Error', :value=>'error', + :variable=>@@msg.ref('icon'), :anchor=>:w), + :fill=>:x, :anchor=>:w) sep = Tk::BWidget::Separator.new(parent, :orient=>:horizontal) button = TkButton.new(parent, :text=>'Show', :command=>proc{_show_msgdlg}) @@ -138,15 +138,15 @@ module DemoDialog def self._stddlg(parent) Tk.pack(TkButton.new(parent, :text=>'Select a color '){|w| - command(proc{DemoDialog._show_color(w)}) - }, - TkButton.new(parent, :text=>'Font selector dialog', - :command=>proc{_show_fontdlg}), - TkButton.new(parent, :text=>'Progression dialog', - :command=>proc{_show_progdlg}), - TkButton.new(parent, :text=>'Password dialog', - :command=>proc{_show_passdlg}), - :side=>:left, :padx=>5, :anchor=>:w) + command(proc{DemoDialog._show_color(w)}) + }, + TkButton.new(parent, :text=>'Font selector dialog', + :command=>proc{_show_fontdlg}), + TkButton.new(parent, :text=>'Progression dialog', + :command=>proc{_show_progdlg}), + TkButton.new(parent, :text=>'Password dialog', + :command=>proc{_show_passdlg}), + :side=>:left, :padx=>5, :anchor=>:w) end def self._show_color(w) @@ -159,15 +159,15 @@ module DemoDialog def self._show_tmpldlg dlg = Tk::BWidget::Dialog.new(:relative=>Tk.root, :modal=>:local, - :separator=>true, :title=>'Template dialog', - :side=>@@tmpl['side'], - :anchor=>@@tmpl['anchor'], - :default=>0, :cancel=>1) + :separator=>true, :title=>'Template dialog', + :side=>@@tmpl['side'], + :anchor=>@@tmpl['anchor'], + :default=>0, :cancel=>1) dlg.add('name'=>'ok') dlg.add('name'=>'cancel') TkMessage.new(dlg.get_frame, :text=>"Template\nDialog", :justify=>:center, - :anchor=>:c, :width=>80).pack(:fill=>:both, :expand=>true, - :padx=>100, :pady=>100) + :anchor=>:c, :width=>80).pack(:fill=>:both, :expand=>true, + :padx=>100, :pady=>100) dlg.draw dlg.destroy end @@ -175,16 +175,16 @@ module DemoDialog def self._show_msgdlg @@msgdlg.destroy if @@msgdlg @@msgdlg = Tk::BWidget::MessageDlg.new(:relative=>Tk.root, - :message=>'Message for MessageBox', - :type=>@@msg['type'], - :icon=>@@msg['icon'], - :buttons=>@@msg['buttons']) + :message=>'Message for MessageBox', + :type=>@@msg['type'], + :icon=>@@msg['icon'], + :buttons=>@@msg['buttons']) @@msgdlg.create end def self._show_fontdlg font = Tk::BWidget::SelectFont.new(:relative=>Tk.root, - :font=>DemoVar.font).create + :font=>DemoVar.font).create DemoVar::Demo.update_font(font) end @@ -193,11 +193,11 @@ module DemoDialog @@progval.value = 0 @@progdlg = Tk::BWidget::ProgressDlg.new(:relative=>Tk.root, - :title=>'Wait...', - :type=>'infinite', :width=>20, - :textvariable=>@@progmsg, - :variable=>@@progval, - :stop=>'Stop') { + :title=>'Wait...', + :type=>'infinite', :width=>20, + :textvariable=>@@progmsg, + :variable=>@@progval, + :stop=>'Stop') { command(proc{self.destroy}) create } @@ -206,12 +206,12 @@ module DemoDialog def self._update_progdlg TkTimer.new(20, -1, proc{ - if @@progdlg && @@progdlg.winfo_exist? - @@progval.value = 2 - else - stop - end - }).start + if @@progdlg && @@progdlg.winfo_exist? + @@progval.value = 2 + else + stop + end + }).start end def self._show_passdlg diff --git a/ext/tk/sample/tkextlib/bwidget/tree.rb b/ext/tk/sample/tkextlib/bwidget/tree.rb index 9bfa4f3cc..a355b6759 100644 --- a/ext/tk/sample/tkextlib/bwidget/tree.rb +++ b/ext/tk/sample/tkextlib/bwidget/tree.rb @@ -17,29 +17,29 @@ module DemoTree pane = pw.add(:weight=>1) title = Tk::BWidget::TitleFrame.new(pane, :text=>'Directory tree') sw = Tk::BWidget::ScrolledWindow.new(title.get_frame, - :relief=>:sunken, :borderwidth=>2) + :relief=>:sunken, :borderwidth=>2) tree = Tk::BWidget::Tree.new(sw, :relief=>:flat, :borderwidth=>0, - :width=>15, :highlightthickness=>0, - :redraw=>false, :dropenabled=>true, - :dragenabled=>true, :dragevent=>3, - :droptypes=>[ - 'TREE_NODE', [ - :copy, [], - :move, [], - :link, [] - ], - 'LISTBOX_ITEM', [ - :copy, [], - :move, [], - :link, [] - ] - ], - :opencmd=>proc{|node| - moddir(1, tree, node) - }, - :closecmd=>proc{|node| - moddir(0, tree, node) - }) + :width=>15, :highlightthickness=>0, + :redraw=>false, :dropenabled=>true, + :dragenabled=>true, :dragevent=>3, + :droptypes=>[ + 'TREE_NODE', [ + :copy, [], + :move, [], + :link, [] + ], + 'LISTBOX_ITEM', [ + :copy, [], + :move, [], + :link, [] + ] + ], + :opencmd=>proc{|node| + moddir(1, tree, node) + }, + :closecmd=>proc{|node| + moddir(0, tree, node) + }) sw.set_widget(tree) sw.pack(:side=>:top, :expand=>true, :fill=>:both) @@ -48,27 +48,27 @@ module DemoTree pane = pw.add(:weight=>2) lf = Tk::BWidget::TitleFrame.new(pane, :text=>'Content') sw = Tk::BWidget::ScrolledWindow.new(lf.get_frame, - :scrollbar=>:horizontal, - :auto=>:none, :relief=>:sunken, - :borderwidth=>2) + :scrollbar=>:horizontal, + :auto=>:none, :relief=>:sunken, + :borderwidth=>2) list = Tk::BWidget::ListBox.new(sw, :relief=>:flat, :borderwidth=>0, - :highlightthickness=>0, :width=>20, - :multicolumn=>true, :redraw=>false, - :dragevent=>3, :dropenabled=>true, - :dragenabled=>true, - :droptypes=>[ - 'TREE_NODE', [ - :copy, [], - :move, [], - :link, [] - ], - 'LISTBOX_ITEM', [ - :copy, [], - :move, [], - :link, [] - ] - ]) + :highlightthickness=>0, :width=>20, + :multicolumn=>true, :redraw=>false, + :dragevent=>3, :dropenabled=>true, + :dragenabled=>true, + :droptypes=>[ + 'TREE_NODE', [ + :copy, [], + :move, [], + :link, [] + ], + 'LISTBOX_ITEM', [ + :copy, [], + :move, [], + :link, [] + ] + ]) sw.set_widget(list) Tk.pack(sw, lf, :fill=>:both, :expand=>true) @@ -76,51 +76,51 @@ module DemoTree pw.pack(:fill=>:both, :expand=>true) tree.textbind('ButtonPress-1', - proc{|node, ev| select('tree', 1, tree, list, node)}) + proc{|node, ev| select('tree', 1, tree, list, node)}) tree.textbind('Double-ButtonPress-1', - proc{|node, ev| select('tree', 2, tree, list, node)}) + proc{|node, ev| select('tree', 2, tree, list, node)}) list.textbind('ButtonPress-1', - proc{|node, ev| select('list', 1, tree, list, node)}) + proc{|node, ev| select('list', 1, tree, list, node)}) list.textbind('Double-ButtonPress-1', - proc{|node, ev| select('list', 2, tree, list, node)}) + proc{|node, ev| select('list', 2, tree, list, node)}) list.imagebind('Double-ButtonPress-1', - proc{|node, ev| select('list', 2, tree, list, node)}) + proc{|node, ev| select('list', 2, tree, list, node)}) nb.itemconfigure('demoTree', - :createcmd=>proc{|*args| init(tree, list, *args)}, - :raisecmd=>proc{ - Tk.root.geometry =~ - /\d+x\d+([+-]{1,2}\d+)([+-]{1,2}\d+)/ - global_w = ($1 || 0).to_i - global_h = ($2 || 0).to_i - if @@top - Tk::BWidget.place(@@top, 0, 0, :at, - global_w - Tk.root.winfo_screenwidth, global_h) - @@top.deiconify - Tk.root.bind('Unmap', proc{@@top.withdraw}) - Tk.root.bind('Map', proc{@@top.deiconify}) - Tk.root.bind('Configure', proc{|w| - if w == Tk.root - Tk.root.geometry =~ - /\d+x\d+([+-]{1,2}\d+)([+-]{1,2}\d+)/ - global_w = ($1 || 0).to_i - global_h = ($2 || 0).to_i - BWidget.place(@@top, 0, 0, :at, - global_w - Tk.root.winfo_screenwidth, - global_h) - end - }, '%W') - end - }, - :leavecmd=>proc{ - @@top.withdraw if @@top - Tk.root.bind_remove('Unmap') - Tk.root.bind_remove('Map') - Tk.root.bind_remove('Configure') - return true - }) + :createcmd=>proc{|*args| init(tree, list, *args)}, + :raisecmd=>proc{ + Tk.root.geometry =~ + /\d+x\d+([+-]{1,2}\d+)([+-]{1,2}\d+)/ + global_w = ($1 || 0).to_i + global_h = ($2 || 0).to_i + if @@top + Tk::BWidget.place(@@top, 0, 0, :at, + global_w - Tk.root.winfo_screenwidth, global_h) + @@top.deiconify + Tk.root.bind('Unmap', proc{@@top.withdraw}) + Tk.root.bind('Map', proc{@@top.deiconify}) + Tk.root.bind('Configure', proc{|w| + if w == Tk.root + Tk.root.geometry =~ + /\d+x\d+([+-]{1,2}\d+)([+-]{1,2}\d+)/ + global_w = ($1 || 0).to_i + global_h = ($2 || 0).to_i + BWidget.place(@@top, 0, 0, :at, + global_w - Tk.root.winfo_screenwidth, + global_h) + end + }, '%W') + end + }, + :leavecmd=>proc{ + @@top.withdraw if @@top + Tk.root.bind_remove('Unmap') + Tk.root.bind_remove('Map') + Tk.root.bind_remove('Configure') + return true + }) end def self.init(tree, list, *args) @@ -132,8 +132,8 @@ module DemoTree end tree.insert('end', 'root', 'home', - :text=>rootdir, :data=>rootdir, :open=>true, - :image=>Tk::BWidget::Bitmap.new('openfold')) + :text=>rootdir, :data=>rootdir, :open=>true, + :image=>Tk::BWidget::Bitmap.new('openfold')) getdir(tree, 'home', rootdir) select('tree', 1, tree, list, 'home') tree.redraw(true) @@ -148,8 +148,8 @@ module DemoTree @@top.title('Drag rectangle to scroll directory tree') @@top.transient(Tk.root) Tk::BWidget::ScrollView.new(@@top, :window=>tree, :fill=>'white', - :width=>300, :height=>300, :relief=>:sunken, - :bd=>1).pack(:fill=>:both, :expand=>true) + :width=>300, :height=>300, :relief=>:sunken, + :bd=>1).pack(:fill=>:both, :expand=>true) end def self.getdir(tree, node, path) @@ -158,13 +158,13 @@ module DemoTree lentries.each{|f| basename = File.basename(f) if File.directory?(f) - Tk::BWidget::Tree::Node.new(tree, node, - :index=>'end', :text=>basename, - :image=>Tk::BWidget::Bitmap.new('folder'), - :drawcross=>:allways, :data=>f) - @@count += 1 + Tk::BWidget::Tree::Node.new(tree, node, + :index=>'end', :text=>basename, + :image=>Tk::BWidget::Bitmap.new('folder'), + :drawcross=>:allways, :data=>f) + @@count += 1 else - lfiles << basename + lfiles << basename end } tree.itemconfigure(node, :drawcross=>:auto, :data=>lfiles) @@ -174,9 +174,9 @@ module DemoTree if (idx != 0 && tree.itemcget(node, :drawcross).to_s == 'allways') getdir(tree, node, tree.itemcget(node, :data)) if tree.nodes(node).empty? - tree.itemconfigure(node, :image=>Tk::BWidget::Bitmap.new('folder')) + tree.itemconfigure(node, :image=>Tk::BWidget::Bitmap.new('folder')) else - tree.itemconfigure(node, :image=>Tk::BWidget::Bitmap.new('openfold')) + tree.itemconfigure(node, :image=>Tk::BWidget::Bitmap.new('openfold')) end else img = %w(folder openfold)[idx] || 'openfold' @@ -188,31 +188,31 @@ module DemoTree @@dblclick = true if num == 1 if (where == 'tree' && - tree.selection_get.find{|x| - TkUtil._get_eval_string(x) == TkUtil._get_eval_string(node) - }) - @@dblclick = false - Tk.after(500, proc{edit('tree', tree, list, node)}) - return + tree.selection_get.find{|x| + TkUtil._get_eval_string(x) == TkUtil._get_eval_string(node) + }) + @@dblclick = false + Tk.after(500, proc{edit('tree', tree, list, node)}) + return end if (where == 'list' && - list.selection_get.find{|x| - TkUtil._get_eval_string(x) == TkUtil._get_eval_string(node) - }) - @@dblclick = false - Tk.after(500, proc{edit('list', tree, list, node)}) - return + list.selection_get.find{|x| + TkUtil._get_eval_string(x) == TkUtil._get_eval_string(node) + }) + @@dblclick = false + Tk.after(500, proc{edit('list', tree, list, node)}) + return end if where == 'tree' - select_node(tree, list, node) + select_node(tree, list, node) else - list.selection_set(node) + list.selection_set(node) end elsif (where == 'list' && tree.exist?(node)) parent = tree.parent(node) while TkUtil._get_eval_string(parent) != 'root' - tree.itemconfigure(parent, :open=>true) - parent = tree.parent(parent) + tree.itemconfigure(parent, :open=>true) + parent = tree.parent(parent) end select_node(tree, list, node) end @@ -231,13 +231,13 @@ module DemoTree tree.nodes(node).each{|subnode| list.insert('end', subnode, - :text=>tree.itemcget(subnode, :text), - :image=>Tk::BWidget::Bitmap.new('folder')) + :text=>tree.itemcget(subnode, :text), + :image=>Tk::BWidget::Bitmap.new('folder')) } TkComm.simplelist(dir).each{|f| Tk::BWidget::ListBox::Item.new(list, 'end', :text=>f, - :image=>Tk::BWidget::Bitmap.new('file')) + :image=>Tk::BWidget::Bitmap.new('file')) } end @@ -245,16 +245,16 @@ module DemoTree return if @@dblclick if (where == 'tree' && - tree.selection_get.find{|x| - TkUtil._get_eval_string(x) == TkUtil._get_eval_string(node) - }) + tree.selection_get.find{|x| + TkUtil._get_eval_string(x) == TkUtil._get_eval_string(node) + }) res = tree.edit(node, tree.itemcget(node, :text)) if res != '' - tree.itemconfigure(node, :text=>res) - if list.exist?(node) - list.itemconfigure(node, :text=>res) - end - tree.selection_set(node) + tree.itemconfigure(node, :text=>res) + if list.exist?(node) + list.itemconfigure(node, :text=>res) + end + tree.selection_set(node) end return end @@ -262,17 +262,17 @@ module DemoTree if (where == 'list') res = list.edit(node, list.igemcget(node, :text)) if res != '' - list.itemconfigure(node, :text=>res) - if tree.exist?(node) - tree.itemconfigure(node, :text=>res) - else - cursel = tree.selection_get[0] - index = list.index(node) - tree.nodes(cursel).size - data = TkComm.simplelist(tree.itemcget(cursel, :data)) - data[index] = res - tree.itemconfigure(cursel, :date=>data) - end - list.selection_set(node) + list.itemconfigure(node, :text=>res) + if tree.exist?(node) + tree.itemconfigure(node, :text=>res) + else + cursel = tree.selection_get[0] + index = list.index(node) - tree.nodes(cursel).size + data = TkComm.simplelist(tree.itemcget(cursel, :data)) + data[index] = res + tree.itemconfigure(cursel, :date=>data) + end + list.selection_set(node) end end end @@ -280,9 +280,9 @@ module DemoTree def self.expand(tree, but) unless (cur = tree.selection_get).empty? if TkComm.bool(but) - tree.opentree(cur) + tree.opentree(cur) else - tree.closetree(cur) + tree.closetree(cur) end end end diff --git a/ext/tk/sample/tkextlib/iwidgets/sample/calendar.rb b/ext/tk/sample/tkextlib/iwidgets/sample/calendar.rb index 7a7c65ae8..4dd929c03 100644 --- a/ext/tk/sample/tkextlib/iwidgets/sample/calendar.rb +++ b/ext/tk/sample/tkextlib/iwidgets/sample/calendar.rb @@ -3,8 +3,8 @@ require 'tk' require 'tkextlib/iwidgets' Tk::Iwidgets::Calendar.new(:command=>proc{|arg| puts(arg.date)}, - :weekendbackground=>'mistyrose', - :weekdaybackground=>'ghostwhite', - :outline=>'black', :startday=>'wednesday', - :days=>%w(We Th Fr Sa Su Mo Tu)).pack + :weekendbackground=>'mistyrose', + :weekdaybackground=>'ghostwhite', + :outline=>'black', :startday=>'wednesday', + :days=>%w(We Th Fr Sa Su Mo Tu)).pack Tk.mainloop diff --git a/ext/tk/sample/tkextlib/iwidgets/sample/combobox.rb b/ext/tk/sample/tkextlib/iwidgets/sample/combobox.rb index 5c2e6cbbd..ec9c7a1df 100644 --- a/ext/tk/sample/tkextlib/iwidgets/sample/combobox.rb +++ b/ext/tk/sample/tkextlib/iwidgets/sample/combobox.rb @@ -6,11 +6,11 @@ require 'tkextlib/iwidgets' # Non-editable Dropdown Combobox # cb1 = Tk::Iwidgets::Combobox.new(:labeltext=>'Month:', - :selectioncommand=>proc{ - puts(cb1.get_curselection) - }, - :editable=>false, :listheight=>185, - :popupcursor=>'hand1') + :selectioncommand=>proc{ + puts(cb1.get_curselection) + }, + :editable=>false, :listheight=>185, + :popupcursor=>'hand1') cb1.insert_list('end', *%w(Jan Feb Mar Apr May June Jul Aug Sept Oct Nov Dec)) @@ -19,9 +19,9 @@ cb1.insert_list('end', *%w(Jan Feb Mar Apr May June Jul Aug Sept Oct Nov Dec)) # Editable Dropdown Combobox # cb2 = Tk::Iwidgets::Combobox.new(:labeltext=>'Operating System:', - :selectioncommand=>proc{ - puts(cb2.get_curselection) - }) + :selectioncommand=>proc{ + puts(cb2.get_curselection) + }) cb2.insert_list('end', *%w(Linux HP-UX SunOS Solaris Irix)) cb2.insert_entry('end', 'L') diff --git a/ext/tk/sample/tkextlib/iwidgets/sample/dialogshell.rb b/ext/tk/sample/tkextlib/iwidgets/sample/dialogshell.rb index d4578297e..197521e0a 100644 --- a/ext/tk/sample/tkextlib/iwidgets/sample/dialogshell.rb +++ b/ext/tk/sample/tkextlib/iwidgets/sample/dialogshell.rb @@ -9,6 +9,6 @@ ds.add('Cancel', :text=>'Cancel', :command=>proc{puts 'Cancel'; ds.deactivate}) ds.default('OK') TkButton.new(:text=>'ACTIVATE', :padx=>7, :pady=>7, - :command=>proc{puts ds.activate}).pack(:padx=>10, :pady=>10) + :command=>proc{puts ds.activate}).pack(:padx=>10, :pady=>10) Tk.mainloop diff --git a/ext/tk/sample/tkextlib/iwidgets/sample/disjointlistbox.rb b/ext/tk/sample/tkextlib/iwidgets/sample/disjointlistbox.rb index f7a0e5c48..85c5d03d1 100644 --- a/ext/tk/sample/tkextlib/iwidgets/sample/disjointlistbox.rb +++ b/ext/tk/sample/tkextlib/iwidgets/sample/disjointlistbox.rb @@ -3,7 +3,7 @@ require 'tk' require 'tkextlib/iwidgets' djl = Tk::Iwidgets::Disjointlistbox.new.pack(:fill=>:both, :expand=>true, - :padx=>10, :pady=>10) + :padx=>10, :pady=>10) djl.set_lhs(*[0,2,4,5]) djl.set_rhs(3,6) diff --git a/ext/tk/sample/tkextlib/iwidgets/sample/entryfield-1.rb b/ext/tk/sample/tkextlib/iwidgets/sample/entryfield-1.rb index 24253fcb9..856d883a9 100644 --- a/ext/tk/sample/tkextlib/iwidgets/sample/entryfield-1.rb +++ b/ext/tk/sample/tkextlib/iwidgets/sample/entryfield-1.rb @@ -12,21 +12,21 @@ TkOption.add('*textBackground', 'white') ef = Tk::Iwidgets::Entryfield.new(:command=>proc{puts "Return Pressed"}) fef = Tk::Iwidgets::Entryfield.new(:labeltext=>'Fixed:', - :fixed=>10, :width=>12) + :fixed=>10, :width=>12) nef = Tk::Iwidgets::Entryfield.new(:labeltext=>'Numeric:', - :validate=>:numeric, :width=>12) + :validate=>:numeric, :width=>12) aef = Tk::Iwidgets::Entryfield.new(:labeltext=>'Alphabetic:', - :validate=>:alphabetic, :width=>12, - :invalid=>proc{ - puts "Alphabetic contents invalid" - }) + :validate=>:alphabetic, :width=>12, + :invalid=>proc{ + puts "Alphabetic contents invalid" + }) pef = Tk::Iwidgets::Entryfield.new(:labeltext=>'Password:', :width=>12, - :show=>Tk::UTF8_String("\267"), - ## <=== utf8 character - :command=>proc{puts "Return Pressed"}) + :show=>Tk::UTF8_String("\267"), + ## <=== utf8 character + :command=>proc{puts "Return Pressed"}) Tk::Iwidgets::Labeledwidget.alignlabels(ef, fef, nef, aef, pef) diff --git a/ext/tk/sample/tkextlib/iwidgets/sample/entryfield-2.rb b/ext/tk/sample/tkextlib/iwidgets/sample/entryfield-2.rb index 9a80e4aaf..4a4c2e7eb 100644 --- a/ext/tk/sample/tkextlib/iwidgets/sample/entryfield-2.rb +++ b/ext/tk/sample/tkextlib/iwidgets/sample/entryfield-2.rb @@ -14,20 +14,20 @@ TkOption.add('*textBackground', 'white') ef = Tk::Iwidgets::Entryfield.new(:command=>proc{puts "Return Pressed"}) fef = Tk::Iwidgets::Entryfield.new(:labeltext=>'Fixed:', - :fixed=>10, :width=>12) + :fixed=>10, :width=>12) nef = Tk::Iwidgets::Entryfield.new(:labeltext=>'Numeric:', - :validate=>:numeric, :width=>12) + :validate=>:numeric, :width=>12) aef = Tk::Iwidgets::Entryfield.new(:labeltext=>'Alphabetic:', - :validate=>:alphabetic, :width=>12, - :invalid=>proc{ - puts "Alphabetic contents invalid" - }) + :validate=>:alphabetic, :width=>12, + :invalid=>proc{ + puts "Alphabetic contents invalid" + }) pef = Tk::Iwidgets::Entryfield.new(:labeltext=>'Password:', :width=>12, - :show=>"\267", ## <=== utf8 character - :command=>proc{puts "Return Pressed"}) + :show=>"\267", ## <=== utf8 character + :command=>proc{puts "Return Pressed"}) Tk::Iwidgets::Labeledwidget.alignlabels(ef, fef, nef, aef, pef) diff --git a/ext/tk/sample/tkextlib/iwidgets/sample/entryfield-3.rb b/ext/tk/sample/tkextlib/iwidgets/sample/entryfield-3.rb index e83030839..bddd542f6 100644 --- a/ext/tk/sample/tkextlib/iwidgets/sample/entryfield-3.rb +++ b/ext/tk/sample/tkextlib/iwidgets/sample/entryfield-3.rb @@ -14,20 +14,20 @@ TkOption.add('*textBackground', 'white') ef = Tk::Iwidgets::Entryfield.new(:command=>proc{puts "Return Pressed"}) fef = Tk::Iwidgets::Entryfield.new(:labeltext=>'Fixed:', - :fixed=>10, :width=>12) + :fixed=>10, :width=>12) nef = Tk::Iwidgets::Entryfield.new(:labeltext=>'Numeric:', - :validate=>:numeric, :width=>12) + :validate=>:numeric, :width=>12) aef = Tk::Iwidgets::Entryfield.new(:labeltext=>'Alphabetic:', - :validate=>:alphabetic, :width=>12, - :invalid=>proc{ - puts "Alphabetic contents invalid" - }) + :validate=>:alphabetic, :width=>12, + :invalid=>proc{ + puts "Alphabetic contents invalid" + }) pef = Tk::Iwidgets::Entryfield.new(:labeltext=>'Password:', :width=>12, - :show=>"\267", ## <=== utf8 character - :command=>proc{puts "Return Pressed"}) + :show=>"\267", ## <=== utf8 character + :command=>proc{puts "Return Pressed"}) Tk::Iwidgets::Labeledwidget.alignlabels(ef, fef, nef, aef, pef) diff --git a/ext/tk/sample/tkextlib/iwidgets/sample/extbutton.rb b/ext/tk/sample/tkextlib/iwidgets/sample/extbutton.rb index 83a6a07b6..6971052b6 100644 --- a/ext/tk/sample/tkextlib/iwidgets/sample/extbutton.rb +++ b/ext/tk/sample/tkextlib/iwidgets/sample/extbutton.rb @@ -3,18 +3,18 @@ require 'tk' require 'tkextlib/iwidgets' Tk::Iwidgets::Extbutton.new(:text=>'Bitmap example', :bitmap=>'info', - :background=>'bisque', :activeforeground=>'red', - :bitmapforeground=>'blue', :defaultring=>true, - :command=>proc{ - puts "Bisque is beautiful" - }).pack(:expand=>true) + :background=>'bisque', :activeforeground=>'red', + :bitmapforeground=>'blue', :defaultring=>true, + :command=>proc{ + puts "Bisque is beautiful" + }).pack(:expand=>true) #img = TkPhotoImage.new(:file=>File.join(File.dirname(File.expand_path(__FILE__)), '../../../images/earthris.gif')) img = TkPhotoImage.new(:file=>File.join(File.dirname(File.expand_path(__FILE__)), '../catalog_demo/images/clear.gif')) Tk::Iwidgets::Extbutton.new(:text=>'Image example', :relief=>:ridge, - :image=>img, :imagepos=>:e, :font=>'9x15bold', - :activebackground=>'lightyellow', - :background=>'lightgreen').pack(:expand=>true) + :image=>img, :imagepos=>:e, :font=>'9x15bold', + :activebackground=>'lightyellow', + :background=>'lightgreen').pack(:expand=>true) Tk.mainloop diff --git a/ext/tk/sample/tkextlib/iwidgets/sample/extfileselectionbox.rb b/ext/tk/sample/tkextlib/iwidgets/sample/extfileselectionbox.rb index ef3b14ff4..4738084d9 100644 --- a/ext/tk/sample/tkextlib/iwidgets/sample/extfileselectionbox.rb +++ b/ext/tk/sample/tkextlib/iwidgets/sample/extfileselectionbox.rb @@ -3,6 +3,6 @@ require 'tk' require 'tkextlib/iwidgets' Tk::Iwidgets::Extfileselectionbox.new.pack(:padx=>10, :pady=>10, - :fill=>:both, :expand=>true) + :fill=>:both, :expand=>true) Tk.mainloop diff --git a/ext/tk/sample/tkextlib/iwidgets/sample/extfileselectiondialog.rb b/ext/tk/sample/tkextlib/iwidgets/sample/extfileselectiondialog.rb index 80a31d06e..c1a9b3def 100644 --- a/ext/tk/sample/tkextlib/iwidgets/sample/extfileselectiondialog.rb +++ b/ext/tk/sample/tkextlib/iwidgets/sample/extfileselectiondialog.rb @@ -9,9 +9,9 @@ mainloop = Thread.new{Tk.mainloop} # nmfsd = Tk::Iwidgets::Extfileselectiondialog.new(:title=>'Non-Modal') nmfsd.buttonconfigure('OK', :command=>proc{ - puts "You selected #{nmfsd.get}" - nmfsd.deactivate - }) + puts "You selected #{nmfsd.get}" + nmfsd.deactivate + }) nmfsd.activate # diff --git a/ext/tk/sample/tkextlib/iwidgets/sample/fileselectionbox.rb b/ext/tk/sample/tkextlib/iwidgets/sample/fileselectionbox.rb index f0313d948..2ad3adb97 100644 --- a/ext/tk/sample/tkextlib/iwidgets/sample/fileselectionbox.rb +++ b/ext/tk/sample/tkextlib/iwidgets/sample/fileselectionbox.rb @@ -3,6 +3,6 @@ require 'tk' require 'tkextlib/iwidgets' Tk::Iwidgets::Fileselectionbox.new.pack(:padx=>10, :pady=>10, - :fill=>:both, :expand=>true) + :fill=>:both, :expand=>true) Tk.mainloop diff --git a/ext/tk/sample/tkextlib/iwidgets/sample/fileselectiondialog.rb b/ext/tk/sample/tkextlib/iwidgets/sample/fileselectiondialog.rb index 955e5cbd2..ff22b2f64 100644 --- a/ext/tk/sample/tkextlib/iwidgets/sample/fileselectiondialog.rb +++ b/ext/tk/sample/tkextlib/iwidgets/sample/fileselectiondialog.rb @@ -9,9 +9,9 @@ mainloop = Thread.new{Tk.mainloop} # nmfsd = Tk::Iwidgets::Fileselectiondialog.new(:title=>'Non-Modal') nmfsd.buttonconfigure('OK', :command=>proc{ - puts "You selected #{nmfsd.get}" - nmfsd.deactivate - }) + puts "You selected #{nmfsd.get}" + nmfsd.deactivate + }) nmfsd.activate # diff --git a/ext/tk/sample/tkextlib/iwidgets/sample/hierarchy.rb b/ext/tk/sample/tkextlib/iwidgets/sample/hierarchy.rb index 594158294..c83ae3724 100644 --- a/ext/tk/sample/tkextlib/iwidgets/sample/hierarchy.rb +++ b/ext/tk/sample/tkextlib/iwidgets/sample/hierarchy.rb @@ -11,15 +11,15 @@ def get_files(file) end Tk::Iwidgets::Hierarchy.new(:querycommand=>proc{|arg| get_files(arg.node)}, - :visibleitems=>'30x15', - :labeltext=>ENV['HOME']).pack(:side=>:left, - :expand=>true, - :fill=>:both) + :visibleitems=>'30x15', + :labeltext=>ENV['HOME']).pack(:side=>:left, + :expand=>true, + :fill=>:both) # Tk::Iwidgets::Hierarchy.new(:querycommand=>[proc{|n| get_files(n)}, '%n'], -# :visibleitems=>'30x15', -# :labeltext=>ENV['HOME']).pack(:side=>:left, -# :expand=>true, -# :fill=>:both) +# :visibleitems=>'30x15', +# :labeltext=>ENV['HOME']).pack(:side=>:left, +# :expand=>true, +# :fill=>:both) Tk.mainloop diff --git a/ext/tk/sample/tkextlib/iwidgets/sample/labeledwidget.rb b/ext/tk/sample/tkextlib/iwidgets/sample/labeledwidget.rb index 1fed7d55e..1d2e0a98a 100644 --- a/ext/tk/sample/tkextlib/iwidgets/sample/labeledwidget.rb +++ b/ext/tk/sample/tkextlib/iwidgets/sample/labeledwidget.rb @@ -3,11 +3,11 @@ require 'tk' require 'tkextlib/iwidgets' lw = Tk::Iwidgets::Labeledwidget.new(:labeltext=>'Canvas Widget', - :labelpos=>:s) + :labelpos=>:s) lw.pack(:fill=>:both, :expand=>true, :padx=>10, :pady=>10) cw = TkCanvas.new(lw.child_site, :relief=>:raised, :width=>200, :height=>200, - :borderwidth=>3, :background=>:white) + :borderwidth=>3, :background=>:white) cw.pack(:padx=>10, :pady=>10) Tk.mainloop diff --git a/ext/tk/sample/tkextlib/iwidgets/sample/mainwindow.rb b/ext/tk/sample/tkextlib/iwidgets/sample/mainwindow.rb index 85b28b45e..b87a6d27f 100644 --- a/ext/tk/sample/tkextlib/iwidgets/sample/mainwindow.rb +++ b/ext/tk/sample/tkextlib/iwidgets/sample/mainwindow.rb @@ -5,57 +5,57 @@ require 'tkextlib/iwidgets' mw = Tk::Iwidgets::Mainwindow.new mw.menubar.add(:menubutton, 'file', :text=>'File', :underline=>0, - :padx=>8, :pady=>2, :menu=>[ - [:options, {:tearoff=>false}], + :padx=>8, :pady=>2, :menu=>[ + [:options, {:tearoff=>false}], - [:command, 'new', { - :label=>'New', :underline=>0, - :helpstr=>'Create a new file' - } - ], + [:command, 'new', { + :label=>'New', :underline=>0, + :helpstr=>'Create a new file' + } + ], - [:command, 'open', { - :label=>'Open ...', :underline=>0, - :helpstr=>'Open an existing file' - } - ], + [:command, 'open', { + :label=>'Open ...', :underline=>0, + :helpstr=>'Open an existing file' + } + ], - [:command, 'save', { - :label=>'Save', :underline=>0, - :helpstr=>'Save the current file' - } - ], + [:command, 'save', { + :label=>'Save', :underline=>0, + :helpstr=>'Save the current file' + } + ], - [:command, 'saveas', { - :label=>'Save As', :underline=>5, - :helpstr=>'Save the file as a different name' - } - ], + [:command, 'saveas', { + :label=>'Save As', :underline=>5, + :helpstr=>'Save the file as a different name' + } + ], - [:command, 'print', { - :label=>'Print', :underline=>0, - :helpstr=>'Print the file' - } - ], + [:command, 'print', { + :label=>'Print', :underline=>0, + :helpstr=>'Print the file' + } + ], - [:separator, 'sep1'], + [:separator, 'sep1'], - [:command, 'close', { - :label=>'Close', :underline=>0, - :helpstr=>'Close the file' - } - ], + [:command, 'close', { + :label=>'Close', :underline=>0, + :helpstr=>'Close the file' + } + ], - [:separator, 'sep2'], + [:separator, 'sep2'], - [:command, 'exit', { - :label=>'Exit', :underline=>1, - :helpstr=>'Exit this application' - } - ], + [:command, 'exit', { + :label=>'Exit', :underline=>1, + :helpstr=>'Exit this application' + } + ], - nil - ]) + nil + ]) Tk::Iwidgets::Scrolledtext.new(mw.child_site).pack(:fill=>:both, :expand=>true) diff --git a/ext/tk/sample/tkextlib/iwidgets/sample/menubar.rb b/ext/tk/sample/tkextlib/iwidgets/sample/menubar.rb index c61071470..891761adc 100644 --- a/ext/tk/sample/tkextlib/iwidgets/sample/menubar.rb +++ b/ext/tk/sample/tkextlib/iwidgets/sample/menubar.rb @@ -8,109 +8,109 @@ viewmode = TkVariable.new menu_spec = [ [:menubutton, 'file', { :text=>'File', :menu=>[ - [:options, {:tearoff=>false}], - - [:command, 'new', { - :label=>'New', :helpstr=>'Open new document', - :command=>proc{puts 'NEW'} - } - ], - - [:command, 'close', { - :label=>'Close', :helpstr=>'Close current document', - :command=>proc{puts 'CLOSE'} - } - ], - - [:separator, 'sep1'], - - [:command, 'exit', { - :label=>'Exit', :helpstr=>'Exit application', - :command=>proc{exit} - } - ] + [:options, {:tearoff=>false}], + + [:command, 'new', { + :label=>'New', :helpstr=>'Open new document', + :command=>proc{puts 'NEW'} + } + ], + + [:command, 'close', { + :label=>'Close', :helpstr=>'Close current document', + :command=>proc{puts 'CLOSE'} + } + ], + + [:separator, 'sep1'], + + [:command, 'exit', { + :label=>'Exit', :helpstr=>'Exit application', + :command=>proc{exit} + } + ] ] } ], [:menubutton, 'edit', { :text=>'Edit', :menu=>[ - [:options, {:tearoff=>false}], - - [:command, 'undo', { - :label=>'Undo', :underline=>0, - :helpstr=>'Undo last command', - :command=>proc{puts 'UNDO'} - } - ], - - [:separator, 'sep2'], - - [:command, 'cut', { - :label=>'Cut', :underline=>1, - :helpstr=>'Cut selection to clipboard', - :command=>proc{puts 'CUT'} - } - ], - - [:command, 'copy', { - :label=>'Copy', :underline=>1, - :helpstr=>'Copy selection to clipboard', - :command=>proc{puts 'COPY'} - } - ], - - [:command, 'paste', { - :label=>'Paste', :underline=>0, - :helpstr=>'Paste clipboard contents', - :command=>proc{puts 'PASTE'} - } - ] + [:options, {:tearoff=>false}], + + [:command, 'undo', { + :label=>'Undo', :underline=>0, + :helpstr=>'Undo last command', + :command=>proc{puts 'UNDO'} + } + ], + + [:separator, 'sep2'], + + [:command, 'cut', { + :label=>'Cut', :underline=>1, + :helpstr=>'Cut selection to clipboard', + :command=>proc{puts 'CUT'} + } + ], + + [:command, 'copy', { + :label=>'Copy', :underline=>1, + :helpstr=>'Copy selection to clipboard', + :command=>proc{puts 'COPY'} + } + ], + + [:command, 'paste', { + :label=>'Paste', :underline=>0, + :helpstr=>'Paste clipboard contents', + :command=>proc{puts 'PASTE'} + } + ] ] } ], [:menubutton, 'options', { :text=>'Options', :menu=>[ - [:options, {:tearoff=>false, :selectcolor=>'blue'}], - - [:radiobutton, 'byName', { - :variable=>viewmode, :value=>'NAME', - :label=>'by Name', :helpstr=>'View files by name order', - :command=>proc{puts 'NAME'} - } - ], - - [:radiobutton, 'byDate', { - :variable=>viewmode, :value=>'DATE', - :label=>'by Date', :helpstr=>'View files by date order', - :command=>proc{puts 'DATE'} - } - ], - - [:cascade, 'prefs', { - :label=>'Preferences', :menu=>[ - [:command, 'colors', { - :label=>'Colors...', :helpstr=>'Change text colors', - :command=>proc{puts 'COLORS'} - } - ], - - [:command, 'fonts', { - :label=>'Fonts...', :helpstr=>'Change text font', - :command=>proc{puts 'COLORS'} - } - ] - ] - } - ] + [:options, {:tearoff=>false, :selectcolor=>'blue'}], + + [:radiobutton, 'byName', { + :variable=>viewmode, :value=>'NAME', + :label=>'by Name', :helpstr=>'View files by name order', + :command=>proc{puts 'NAME'} + } + ], + + [:radiobutton, 'byDate', { + :variable=>viewmode, :value=>'DATE', + :label=>'by Date', :helpstr=>'View files by date order', + :command=>proc{puts 'DATE'} + } + ], + + [:cascade, 'prefs', { + :label=>'Preferences', :menu=>[ + [:command, 'colors', { + :label=>'Colors...', :helpstr=>'Change text colors', + :command=>proc{puts 'COLORS'} + } + ], + + [:command, 'fonts', { + :label=>'Fonts...', :helpstr=>'Change text font', + :command=>proc{puts 'COLORS'} + } + ] + ] + } + ] ] } ] ] #mb = Tk::Iwidgets::Menubar.new(:helpvariable=>helpvar, -# :menubuttons=>menu_spec) +# :menubuttons=>menu_spec) mb = Tk::Iwidgets::Menubar.new(:helpvariable=>helpvar) mb.configure(:menubuttons=>menu_spec) diff --git a/ext/tk/sample/tkextlib/iwidgets/sample/menubar2.rb b/ext/tk/sample/tkextlib/iwidgets/sample/menubar2.rb index eec4928af..d6f229265 100644 --- a/ext/tk/sample/tkextlib/iwidgets/sample/menubar2.rb +++ b/ext/tk/sample/tkextlib/iwidgets/sample/menubar2.rb @@ -9,10 +9,10 @@ mb = Tk::Iwidgets::Menubar.new mb.menubuttons = [ [:menubutton, 'file', { :text=>'File', :menu=>[ - [:command, 'new', {:label=>'New'}], - [:command, 'close', {:label=>'Close'}], - [:separator, 'sep1'], - [:command, 'quit', {:label=>'Quit'}] + [:command, 'new', {:label=>'New'}], + [:command, 'close', {:label=>'Close'}], + [:separator, 'sep1'], + [:command, 'quit', {:label=>'Quit'}] ] } ], @@ -26,17 +26,17 @@ mb.add(:command, '.edit.copy', :label=>'Copy', :underline=>1) mb.add(:command, '.edit.paste', :label=>'Paste', :underline=>0) mb.add(:menubutton, '.options', :text=>'Options', :menu=>[ - [:radiobutton, 'byName', { - :variable=>viewmode, :value=>'NAME', :label=>'by Name'} - ], - [:radiobutton, 'byDate', { - :variable=>viewmode, :value=>'DATE', :label=>'by Date'} - ] + [:radiobutton, 'byName', { + :variable=>viewmode, :value=>'NAME', :label=>'by Name'} + ], + [:radiobutton, 'byDate', { + :variable=>viewmode, :value=>'DATE', :label=>'by Date'} + ] ]) mb.add(:cascade, '.options.prefs', :label=>'Preferences', :menu=>[ - [:command, 'colors', {:label=>'Colors...'}], - [:command, 'fonts', {:label=>'Fonts...'}] + [:command, 'colors', {:label=>'Colors...'}], + [:command, 'fonts', {:label=>'Fonts...'}] ]) mb.pack(:side=>:left, :anchor=>:nw, :fill=>:x, :expand=>true) diff --git a/ext/tk/sample/tkextlib/iwidgets/sample/messagebox1.rb b/ext/tk/sample/tkextlib/iwidgets/sample/messagebox1.rb index 3f7b137b1..3221dbc30 100644 --- a/ext/tk/sample/tkextlib/iwidgets/sample/messagebox1.rb +++ b/ext/tk/sample/tkextlib/iwidgets/sample/messagebox1.rb @@ -3,9 +3,9 @@ require 'tk' require 'tkextlib/iwidgets' mb = Tk::Iwidgets::Messagebox.new(:hscrollmode=>:dynamic, - :labeltext=>'Messages', :labelpos=>:n, - :height=>120, :width=>550, - :savedir=>'/tmp', :textbackground=>'#d9d9d9') + :labeltext=>'Messages', :labelpos=>:n, + :height=>120, :width=>550, + :savedir=>'/tmp', :textbackground=>'#d9d9d9') mb.pack(:padx=>5, :pady=>5, :fill=>:both, :expand=>true) mb.type_add('ERROR', :background=>'red', :foreground=>'white', :bell=>true) diff --git a/ext/tk/sample/tkextlib/iwidgets/sample/messagebox2.rb b/ext/tk/sample/tkextlib/iwidgets/sample/messagebox2.rb index 1aae7587e..2f0e3648a 100644 --- a/ext/tk/sample/tkextlib/iwidgets/sample/messagebox2.rb +++ b/ext/tk/sample/tkextlib/iwidgets/sample/messagebox2.rb @@ -3,9 +3,9 @@ require 'tk' require 'tkextlib/iwidgets' mb = Tk::Iwidgets::Messagebox.new(:hscrollmode=>:dynamic, - :labeltext=>'Messages', :labelpos=>:n, - :height=>120, :width=>550, - :savedir=>'/tmp', :textbackground=>'#d9d9d9') + :labeltext=>'Messages', :labelpos=>:n, + :height=>120, :width=>550, + :savedir=>'/tmp', :textbackground=>'#d9d9d9') mb.pack(:padx=>5, :pady=>5, :fill=>:both, :expand=>true) error = mb.type_add(:background=>'red', :foreground=>'white', :bell=>true) diff --git a/ext/tk/sample/tkextlib/iwidgets/sample/messagedialog.rb b/ext/tk/sample/tkextlib/iwidgets/sample/messagedialog.rb index 8cf373f96..6c6bfbca3 100644 --- a/ext/tk/sample/tkextlib/iwidgets/sample/messagedialog.rb +++ b/ext/tk/sample/tkextlib/iwidgets/sample/messagedialog.rb @@ -8,8 +8,8 @@ mainloop = Thread.new{Tk.mainloop} # Standard question message dialog used for confirmation. # md = Tk::Iwidgets::Messagedialog.new(:title=>'Message Dialog', - :text=>'Are you sure ? ', - :bitmap=>'questhead', :modality=>:global) + :text=>'Are you sure ? ', + :bitmap=>'questhead', :modality=>:global) md.buttonconfigure('OK', :text=>'Yes') md.buttonconfigure('Cancel', :text=>'No') @@ -33,8 +33,8 @@ md.destroy bmp = '@' + File.join(File.dirname(File.expand_path(__FILE__)), '../catalog_demo/images/text.xbm') cr = Tk::Iwidgets::Messagedialog.new(:title=>'Copyright', - :bitmap=>bmp, :imagepos=>:n, - :text=>"Copyright 200x XXX Corporation\nAll rights reserved") + :bitmap=>bmp, :imagepos=>:n, + :text=>"Copyright 200x XXX Corporation\nAll rights reserved") cr.hide('Cancel') diff --git a/ext/tk/sample/tkextlib/iwidgets/sample/notebook.rb b/ext/tk/sample/tkextlib/iwidgets/sample/notebook.rb index 77f1c1dc6..e33b81eb6 100644 --- a/ext/tk/sample/tkextlib/iwidgets/sample/notebook.rb +++ b/ext/tk/sample/tkextlib/iwidgets/sample/notebook.rb @@ -5,7 +5,7 @@ require 'tkextlib/iwidgets' # Create the tabnotebook widget and pack it. nb = Tk::Iwidgets::Notebook.new(:width=>100, :height=>100) nb.pack(:anchor=>:nw, :fill=>:both, :expand=>true, - :side=>:left, :padx=>10, :pady=>10) + :side=>:left, :padx=>10, :pady=>10) # Add two pages to the tabnotebook, # labelled "Page One" and "Page Two" diff --git a/ext/tk/sample/tkextlib/iwidgets/sample/notebook2.rb b/ext/tk/sample/tkextlib/iwidgets/sample/notebook2.rb index e14e1207a..649de4f02 100644 --- a/ext/tk/sample/tkextlib/iwidgets/sample/notebook2.rb +++ b/ext/tk/sample/tkextlib/iwidgets/sample/notebook2.rb @@ -5,7 +5,7 @@ require 'tkextlib/iwidgets' # Create the tabnotebook widget and pack it. nb = Tk::Iwidgets::Notebook.new(:width=>100, :height=>100) nb.pack(:anchor=>:nw, :fill=>:both, :expand=>true, - :side=>:top, :padx=>10, :pady=>0) + :side=>:top, :padx=>10, :pady=>0) # Add two pages to the tabnotebook, # labelled "Page One" and "Page Two" diff --git a/ext/tk/sample/tkextlib/iwidgets/sample/optionmenu.rb b/ext/tk/sample/tkextlib/iwidgets/sample/optionmenu.rb index bdeafb691..1fd7a5bc0 100644 --- a/ext/tk/sample/tkextlib/iwidgets/sample/optionmenu.rb +++ b/ext/tk/sample/tkextlib/iwidgets/sample/optionmenu.rb @@ -3,7 +3,7 @@ require 'tk' require 'tkextlib/iwidgets' om = Tk::Iwidgets::Optionmenu.new(:labelmargin=>5, :labelpos=>:w, - :labeltext=>"Operating System :") + :labeltext=>"Operating System :") om.insert('end', 'Unix', 'VMS', 'Linux', 'OS/2', 'Windows NT', 'DOS') om.sort_ascending diff --git a/ext/tk/sample/tkextlib/iwidgets/sample/panedwindow.rb b/ext/tk/sample/tkextlib/iwidgets/sample/panedwindow.rb index 902b2c4bc..6e4458e50 100644 --- a/ext/tk/sample/tkextlib/iwidgets/sample/panedwindow.rb +++ b/ext/tk/sample/tkextlib/iwidgets/sample/panedwindow.rb @@ -12,7 +12,7 @@ pw.pack(:fill=>:both, :expand=>true) pw.child_site_list.each{|pane| TkButton.new(pane, :text=>pane.path, :relief=>:raised, - :borderwidth=>2).pack(:fill=>:both, :expand=>true) + :borderwidth=>2).pack(:fill=>:both, :expand=>true) } pw.fraction(50,30,20) diff --git a/ext/tk/sample/tkextlib/iwidgets/sample/panedwindow2.rb b/ext/tk/sample/tkextlib/iwidgets/sample/panedwindow2.rb index 8928393a8..6779cb57d 100644 --- a/ext/tk/sample/tkextlib/iwidgets/sample/panedwindow2.rb +++ b/ext/tk/sample/tkextlib/iwidgets/sample/panedwindow2.rb @@ -12,7 +12,7 @@ pw.pack(:fill=>:both, :expand=>true) pw.child_site_list.each{|pane| TkButton.new(pane, :text=>pane.path, :relief=>:raised, - :borderwidth=>2).pack(:fill=>:both, :expand=>true) + :borderwidth=>2).pack(:fill=>:both, :expand=>true) } pw.fraction(50,30,20) diff --git a/ext/tk/sample/tkextlib/iwidgets/sample/promptdialog.rb b/ext/tk/sample/tkextlib/iwidgets/sample/promptdialog.rb index 7dbecc6dc..2c643e56f 100644 --- a/ext/tk/sample/tkextlib/iwidgets/sample/promptdialog.rb +++ b/ext/tk/sample/tkextlib/iwidgets/sample/promptdialog.rb @@ -7,7 +7,7 @@ mainloop = Thread.new{Tk.mainloop} TkOption.add('*textBackground', 'white') pd = Tk::Iwidgets::Promptdialog.new(:modality=>:global, :title=>'Password', - :labeltext=>'Password:', :show=>'*') + :labeltext=>'Password:', :show=>'*') pd.hide('Apply') if TkComm.bool(pd.activate) diff --git a/ext/tk/sample/tkextlib/iwidgets/sample/pushbutton.rb b/ext/tk/sample/tkextlib/iwidgets/sample/pushbutton.rb index b1f4d7d11..6e1c3fffe 100644 --- a/ext/tk/sample/tkextlib/iwidgets/sample/pushbutton.rb +++ b/ext/tk/sample/tkextlib/iwidgets/sample/pushbutton.rb @@ -3,7 +3,7 @@ require 'tk' require 'tkextlib/iwidgets' Tk::Iwidgets::Pushbutton.new(:text=>'Hello', - :command=>proc{puts 'Hello World'}, - :defaultring=>true).pack(:padx=>10, :pady=>10) + :command=>proc{puts 'Hello World'}, + :defaultring=>true).pack(:padx=>10, :pady=>10) Tk.mainloop diff --git a/ext/tk/sample/tkextlib/iwidgets/sample/scrolledframe.rb b/ext/tk/sample/tkextlib/iwidgets/sample/scrolledframe.rb index c12b66448..5219847c9 100644 --- a/ext/tk/sample/tkextlib/iwidgets/sample/scrolledframe.rb +++ b/ext/tk/sample/tkextlib/iwidgets/sample/scrolledframe.rb @@ -3,7 +3,7 @@ require 'tk' require 'tkextlib/iwidgets' sf = Tk::Iwidgets::Scrolledframe.new(:width=>150, :height=>180, - :labeltext=>'scrolledframe') + :labeltext=>'scrolledframe') cs = sf.child_site TkButton.new(cs, :text=>'Hello').pack(:pady=>10) diff --git a/ext/tk/sample/tkextlib/iwidgets/sample/scrolledhtml.rb b/ext/tk/sample/tkextlib/iwidgets/sample/scrolledhtml.rb index 6b0827ec8..04334b8da 100644 --- a/ext/tk/sample/tkextlib/iwidgets/sample/scrolledhtml.rb +++ b/ext/tk/sample/tkextlib/iwidgets/sample/scrolledhtml.rb @@ -5,9 +5,9 @@ require 'tkextlib/iwidgets' TkOption.add('*textBackground', 'white') sh = Tk::Iwidgets::Scrolledhtml.new(:fontname=>'helvetica', - :linkcommand=>proc{|href| - sh.import_link(href) - }) + :linkcommand=>proc{|href| + sh.import_link(href) + }) sh.pack(:expand=>true, :fill=>:both, :padx=>10, :pady=>10) sh.import(Tk.getOpenFile(:title=>'select HTML document')) diff --git a/ext/tk/sample/tkextlib/iwidgets/sample/scrolledlistbox.rb b/ext/tk/sample/tkextlib/iwidgets/sample/scrolledlistbox.rb index 98f932d05..0b6975191 100644 --- a/ext/tk/sample/tkextlib/iwidgets/sample/scrolledlistbox.rb +++ b/ext/tk/sample/tkextlib/iwidgets/sample/scrolledlistbox.rb @@ -5,16 +5,16 @@ require 'tkextlib/iwidgets' TkOption.add('*textBackground', 'white') slb = Tk::Iwidgets::Scrolledlistbox.new(:selectmode=>:single, - :vscrollmode=>:static, - :hscrollmode=>:dynamic, - :labeltext=>'List', - :selectioncommand=>proc{ - puts(slb.get_curselection) - }, - :dblclickcommand=>proc{ - puts('Double Click') - puts(slb.get_curselection) - }) + :vscrollmode=>:static, + :hscrollmode=>:dynamic, + :labeltext=>'List', + :selectioncommand=>proc{ + puts(slb.get_curselection) + }, + :dblclickcommand=>proc{ + puts('Double Click') + puts(slb.get_curselection) + }) slb.pack(:expand=>true, :fill=>:both, :padx=>10, :pady=>10) slb.insert('end', *['Hello', 'Out There', 'World']) diff --git a/ext/tk/sample/tkextlib/iwidgets/sample/scrolledtext.rb b/ext/tk/sample/tkextlib/iwidgets/sample/scrolledtext.rb index 59a96fb9f..dd1a99a82 100644 --- a/ext/tk/sample/tkextlib/iwidgets/sample/scrolledtext.rb +++ b/ext/tk/sample/tkextlib/iwidgets/sample/scrolledtext.rb @@ -3,7 +3,7 @@ require 'tk' require 'tkextlib/iwidgets' st = Tk::Iwidgets::Scrolledtext.new(:hscrollmode=>:dynamic, :wrap=>:none, - :labeltext=>'Password File') + :labeltext=>'Password File') st.pack(:expand=>true, :fill=>:both, :padx=>10, :pady=>10) st.import('/etc/passwd') diff --git a/ext/tk/sample/tkextlib/iwidgets/sample/selectionbox.rb b/ext/tk/sample/tkextlib/iwidgets/sample/selectionbox.rb index d19970fac..a5d623ae8 100644 --- a/ext/tk/sample/tkextlib/iwidgets/sample/selectionbox.rb +++ b/ext/tk/sample/tkextlib/iwidgets/sample/selectionbox.rb @@ -5,12 +5,12 @@ require 'tkextlib/iwidgets' TkOption.add('*textBackground', 'white') sb = Tk::Iwidgets::Selectionbox.new.pack(:padx=>10, :pady=>10, - :fill=>:both, :expand=>true) + :fill=>:both, :expand=>true) sb.insert_items('end', *['Hello', 'Out There', 'World']) TkLabel.new(sb.child_site, - :text=>'Child Site is Here').pack(:fill=>:x, :padx=>10, :pady=>10) + :text=>'Child Site is Here').pack(:fill=>:x, :padx=>10, :pady=>10) sb.insert_items(2, 'Cruel Cruel') diff --git a/ext/tk/sample/tkextlib/iwidgets/sample/selectiondialog.rb b/ext/tk/sample/tkextlib/iwidgets/sample/selectiondialog.rb index 4fbb2aa37..f40b41918 100644 --- a/ext/tk/sample/tkextlib/iwidgets/sample/selectiondialog.rb +++ b/ext/tk/sample/tkextlib/iwidgets/sample/selectiondialog.rb @@ -5,7 +5,7 @@ require 'tkextlib/iwidgets' mainloop = Thread.new{Tk.mainloop} TkButton.new(:text=>'QUIT', - :command=>proc{Tk.root.destroy}).pack(:padx=>10, :pady=>10) + :command=>proc{Tk.root.destroy}).pack(:padx=>10, :pady=>10) Tk::Iwidgets::Selectiondialog.new.activate diff --git a/ext/tk/sample/tkextlib/iwidgets/sample/shell.rb b/ext/tk/sample/tkextlib/iwidgets/sample/shell.rb index 850ddb29d..c44b5554a 100644 --- a/ext/tk/sample/tkextlib/iwidgets/sample/shell.rb +++ b/ext/tk/sample/tkextlib/iwidgets/sample/shell.rb @@ -3,15 +3,15 @@ require 'tk' require 'tkextlib/iwidgets' sh = Tk::Iwidgets::Shell.new(:modality=>:application, - :padx=>20, :pady=>20, :title=>'Shell') + :padx=>20, :pady=>20, :title=>'Shell') TkButton.new(:text=>'ACTIVATE', :padx=>7, :pady=>7, - :command=>proc{puts sh.activate}).pack(:padx=>10, :pady=>10) + :command=>proc{puts sh.activate}).pack(:padx=>10, :pady=>10) TkLabel.new(sh.child_site, :text=>'SHELL').pack TkButton.new(sh.child_site, :text=>'YES', - :command=>proc{sh.deactivate 'press YES'}).pack(:fill=>:x) + :command=>proc{sh.deactivate 'press YES'}).pack(:fill=>:x) TkButton.new(sh.child_site, :text=>'NO', - :command=>proc{sh.deactivate 'press NO'}).pack(:fill=>:x) + :command=>proc{sh.deactivate 'press NO'}).pack(:fill=>:x) Tk.mainloop diff --git a/ext/tk/sample/tkextlib/iwidgets/sample/spinint.rb b/ext/tk/sample/tkextlib/iwidgets/sample/spinint.rb index 406408174..0bcdefb76 100644 --- a/ext/tk/sample/tkextlib/iwidgets/sample/spinint.rb +++ b/ext/tk/sample/tkextlib/iwidgets/sample/spinint.rb @@ -5,6 +5,6 @@ require 'tkextlib/iwidgets' TkOption.add('*textBackground', 'white') Tk::Iwidgets::Spinint.new(:labeltext=>'Temperature', :labelpos=>:w, :width=>5, - :fixed=>true, :range=>[32, 212]).pack(:pady=>10) + :fixed=>true, :range=>[32, 212]).pack(:pady=>10) Tk.mainloop diff --git a/ext/tk/sample/tkextlib/iwidgets/sample/spinner.rb b/ext/tk/sample/tkextlib/iwidgets/sample/spinner.rb index 44e8ec303..295d38ee9 100644 --- a/ext/tk/sample/tkextlib/iwidgets/sample/spinner.rb +++ b/ext/tk/sample/tkextlib/iwidgets/sample/spinner.rb @@ -19,10 +19,10 @@ class Spinner_demo < TkWindow def initialize(parent=nil) @spinner = Tk::Iwidgets::Spinner.new(parent, :labeltext=>'Month : ', - :width=>10, :fixed=>10, - :validate=>proc{|c| block_input}, - :decrement=>proc{spin_month -1}, - :increment=>proc{spin_month 1}) + :width=>10, :fixed=>10, + :validate=>proc{|c| block_input}, + :decrement=>proc{spin_month -1}, + :increment=>proc{spin_month 1}) @path = @spinner @spinner.insert(0, Months[0]) end diff --git a/ext/tk/sample/tkextlib/iwidgets/sample/tabnotebook.rb b/ext/tk/sample/tkextlib/iwidgets/sample/tabnotebook.rb index 5a9897845..6f1ecc4fa 100644 --- a/ext/tk/sample/tkextlib/iwidgets/sample/tabnotebook.rb +++ b/ext/tk/sample/tkextlib/iwidgets/sample/tabnotebook.rb @@ -5,7 +5,7 @@ require 'tkextlib/iwidgets' # Create the tabnotebook widget and pack it. tn = Tk::Iwidgets::Tabnotebook.new(:width=>300, :height=>100) tn.pack(:anchor=>:nw, :fill=>:both, :expand=>true, - :side=>:left, :padx=>10, :pady=>10) + :side=>:left, :padx=>10, :pady=>10) # Add two pages to the tabnotebook, # labelled "Page One" and "Page Two" diff --git a/ext/tk/sample/tkextlib/iwidgets/sample/tabnotebook2.rb b/ext/tk/sample/tkextlib/iwidgets/sample/tabnotebook2.rb index c08603f89..4a5eef5a8 100644 --- a/ext/tk/sample/tkextlib/iwidgets/sample/tabnotebook2.rb +++ b/ext/tk/sample/tkextlib/iwidgets/sample/tabnotebook2.rb @@ -5,7 +5,7 @@ require 'tkextlib/iwidgets' # Create the tabnotebook widget and pack it. tn = Tk::Iwidgets::Tabnotebook.new(:width=>300, :height=>100) tn.pack(:anchor=>:nw, :fill=>:both, :expand=>true, - :side=>:top, :padx=>10, :pady=>0) + :side=>:top, :padx=>10, :pady=>0) # Add two pages to the tabnotebook, # labelled "Page One" and "Page Two" diff --git a/ext/tk/sample/tkextlib/iwidgets/sample/toolbar.rb b/ext/tk/sample/tkextlib/iwidgets/sample/toolbar.rb index eba52ba5d..355466eb1 100644 --- a/ext/tk/sample/tkextlib/iwidgets/sample/toolbar.rb +++ b/ext/tk/sample/tkextlib/iwidgets/sample/toolbar.rb @@ -89,7 +89,7 @@ EOD ########################################## bmp_dir = File.join(File.dirname(File.expand_path(__FILE__)), - '../catalog_demo/images') + '../catalog_demo/images') ########################################## diff --git a/ext/tk/sample/tkextlib/iwidgets/sample/watch.rb b/ext/tk/sample/tkextlib/iwidgets/sample/watch.rb index d2b6246bf..808c798ae 100644 --- a/ext/tk/sample/tkextlib/iwidgets/sample/watch.rb +++ b/ext/tk/sample/tkextlib/iwidgets/sample/watch.rb @@ -9,7 +9,7 @@ Thread.new{ } Tk::Iwidgets::Watch.new(:state=>:disabled, :showampm=>:no, - :width=>155, :height=>155){|w| + :width=>155, :height=>155){|w| w.pack(:padx=>10, :pady=>10, :fill=>:both, :expand=>true) # TkTimer.new(1000, -1, proc{w.show; Tk.update}).start TkTimer.new(25, -1, proc{w.show; Tk.update}).start diff --git a/ext/tk/sample/tkextlib/tcllib/datefield.rb b/ext/tk/sample/tkextlib/tcllib/datefield.rb index 1b0a29c0b..cfeca0c6d 100644 --- a/ext/tk/sample/tkextlib/tcllib/datefield.rb +++ b/ext/tk/sample/tkextlib/tcllib/datefield.rb @@ -21,8 +21,8 @@ my_date1.trace('w'){ df = Tk::Tcllib::Datefield.new(:textvariable=>my_date1) Tk.grid(TkLabel.new(:text=>'Enter a date:', :anchor=>:e), df, :sticky=>:ew) Tk.grid(TkLabel.new(:text=>'That date ia a:', :anchor=>:e), - TkLabel.new(:textvariable=>my_date2, :relief=>:sunken, :width=>12), - :sticky=>:ew) + TkLabel.new(:textvariable=>my_date2, :relief=>:sunken, :width=>12), + :sticky=>:ew) df.set_focus diff --git a/ext/tk/sample/tkextlib/tcllib/plotdemos1.rb b/ext/tk/sample/tkextlib/tcllib/plotdemos1.rb index 6077d8ab2..053b0de08 100644 --- a/ext/tk/sample/tkextlib/tcllib/plotdemos1.rb +++ b/ext/tk/sample/tkextlib/tcllib/plotdemos1.rb @@ -24,7 +24,7 @@ Tk.pack(vc1,vc2,vc3, :fill=>:both, :side=>:top) ############################### s = Tk::Tcllib::Plotchart::XYPlot.new(c1, [0.0, 100.0, 10.0], - [0.0, 100.0, 20.0]) + [0.0, 100.0, 20.0]) xd = 5.0 @@ -57,7 +57,7 @@ s.save_plot "aha.ps" s = Tk::Tcllib::Plotchart::Piechart.new(c2) s.plot([ ["Long names", 10], ["Short names", 30], - ["Average", 40], ["Ultra-short names", 5] ]) + ["Average", 40], ["Ultra-short names", 5] ]) # # Note: title should be shifted up @@ -79,7 +79,7 @@ s.title "Cardioid" ############################### s = Tk::Tcllib::Plotchart::Barchart.new(hc1, %w(A B C D E), - [0.0, 10.0, 2.0], 2) + [0.0, 10.0, 2.0], 2) s.plot('series1', [1.0, 4.0, 6.0, 1.0, 7.0], 'red') s.plot('series2', [0.0, 3.0, 7.0, 9.3, 2.0], 'green') @@ -88,7 +88,7 @@ s.title "Arbitrary data" ############################### s = Tk::Tcllib::Plotchart::Barchart.new(hc2, %w(A B C D E), - [0.0, 20.0, 5.0], :stacked) + [0.0, 20.0, 5.0], :stacked) s.plot('series1', [1.0, 4.0, 6.0, 1.0, 7.0], 'red') s.plot('series2', [0.0, 3.0, 7.0, 9.3, 2.0], 'green') @@ -97,7 +97,7 @@ s.title "Stacked diagram" ############################### s = Tk::Tcllib::Plotchart::HorizontalBarchart.new(vc1, [0.0, 10.0, 2.0], - %w(A B C D E), 2) + %w(A B C D E), 2) s.plot('series1', [1.0, 4.0, 6.0, 1.0, 7.0], 'red') s.plot('series2', [0.0, 3.0, 7.0, 9.3, 2.0], 'green') @@ -106,7 +106,7 @@ s.title "Arbitrary data" ############################### s = Tk::Tcllib::Plotchart::HorizontalBarchart.new(vc2, [0.0, 20.0, 5.0], - %w(A B C D E), :stacked) + %w(A B C D E), :stacked) s.plot('series1', [1.0, 4.0, 6.0, 1.0, 7.0], 'red') s.plot('series2', [0.0, 3.0, 7.0, 9.3, 2.0], 'green') @@ -115,7 +115,7 @@ s.title "Stacked diagram" ############################### s = Tk::Tcllib::Plotchart::Timechart.new(vc3, "1 january 2004", - "31 december 2004", 4) + "31 december 2004", 4) s.period("Spring", "1 march 2004", "1 june 2004", 'green') s.period("Summer", "1 june 2004", "1 september 2004", 'yellow') @@ -135,7 +135,7 @@ zc2 = TkCanvas.new(z, :background=>'white', :width=>400, :height=>250) Tk.pack(zc1,zc2) s = Tk::Tcllib::Plotchart::Plot3D.new(zc1, - [0, 10, 3], [-10, 10, 10], [0, 10, 2.5]) + [0, 10, 3], [-10, 10, 10], [0, 10, 2.5]) s.title "3D Plot" s.plot_function{|x, y| @@ -146,12 +146,12 @@ s.plot_function{|x, y| } s = Tk::Tcllib::Plotchart::Plot3D.new(zc2, - [0, 10, 3], [-10, 10, 10], [0, 10, 2.5]) + [0, 10, 3], [-10, 10, 10], [0, 10, 2.5]) s.title "3D Plot - data " s.colour("green", "black") s.plot_data([ [1.0, 2.0, 1.0, 0.0], - [1.1, 3.0, 1.1, -0.5], - [3.0, 1.0, 4.0, 5.0] ]) + [1.1, 3.0, 1.1, -0.5], + [3.0, 1.0, 4.0, 5.0] ]) ############################### diff --git a/ext/tk/sample/tkextlib/tcllib/plotdemos2.rb b/ext/tk/sample/tkextlib/tcllib/plotdemos2.rb index 3fd57f380..33a6f2994 100644 --- a/ext/tk/sample/tkextlib/tcllib/plotdemos2.rb +++ b/ext/tk/sample/tkextlib/tcllib/plotdemos2.rb @@ -13,21 +13,21 @@ Tk.pack(c1,c2, :fill=>:both, :side=>:top) # Set up a strip chart ############################### slipchart = Tk::Tcllib::Plotchart::Stripchart.new(c1, [0.0, 100.0, 10.0], - [0.0, 100.0, 20.0]) + [0.0, 100.0, 20.0]) TkTimer.new(500, -1, proc{|obj| # obj --> TkTimer object - slipchart, xold, xd, yold, yd = obj.return_value - xnew = xold + xd - ynew = yold + (rand() - 0.5) * yd - ynew2 = yold + (rand() - 0.5) * 2.0 * yd - slipchart.plot('series1', xnew, ynew) - slipchart.plot('series2', xnew, ynew2) - obj.stop if xnew >= 200 - [slipchart, xnew, xd, ynew, yd] # return_value - }).start(100, proc{ - # init return_value - [slipchart, 0.0, 15.0, 50.0, 30.0] - }) + slipchart, xold, xd, yold, yd = obj.return_value + xnew = xold + xd + ynew = yold + (rand() - 0.5) * yd + ynew2 = yold + (rand() - 0.5) * 2.0 * yd + slipchart.plot('series1', xnew, ynew) + slipchart.plot('series2', xnew, ynew2) + obj.stop if xnew >= 200 + [slipchart, xnew, xd, ynew, yd] # return_value + }).start(100, proc{ + # init return_value + [slipchart, 0.0, 15.0, 50.0, 30.0] + }) slipchart.title "Aha!" @@ -35,7 +35,7 @@ slipchart.title "Aha!" # Set up an isometric plot ############################### s = Tk::Tcllib::Plotchart::IsometricPlot.new(c2, [0.0, 100.0], [0.0, 200.0], - :noaxes) + :noaxes) s.set_zoom_pan @@ -51,7 +51,7 @@ h = TkToplevel.new(:title=>'h') c = TkCanvas.new(h, :bg=>'white', :width=>400, :height=>200).pack(:fill=>:both) s = Tk::Tcllib::Plotchart::XYPlot.new(c, [0.0, 100.0, 10.0], - [0.0, 100.0, 20.0]) + [0.0, 100.0, 20.0]) s.dataconfig('series1', :colour=>'red', :type=>:symbol) s.dataconfig('series2', :colour=>'green', :type=>:both) diff --git a/ext/tk/sample/tkextlib/tcllib/plotdemos3.rb b/ext/tk/sample/tkextlib/tcllib/plotdemos3.rb index 3b74b1f59..2b5c7642b 100644 --- a/ext/tk/sample/tkextlib/tcllib/plotdemos3.rb +++ b/ext/tk/sample/tkextlib/tcllib/plotdemos3.rb @@ -8,9 +8,9 @@ require 'tkextlib/tcllib/plotchart' ############################### Tk::Tcllib::Plotchart::Stripchart.new([0.0, 100.0, 10.0], - [0.0, 100.0, 20.0], - :background=>'white', - :width=>400, :height=>200){|chart| + [0.0, 100.0, 20.0], + :background=>'white', + :width=>400, :height=>200){|chart| title "Aha!" pack(:fill=>:both, :side=>:top) @@ -21,26 +21,26 @@ Tk::Tcllib::Plotchart::Stripchart.new([0.0, 100.0, 10.0], yd = 30.0 TkTimer.new(500, -1, proc{|obj| # obj --> TkTimer object - xold, yold = obj.return_value - xnew = xold + xd - ynew = yold + (rand() - 0.5) * yd - ynew2 = yold + (rand() - 0.5) * 2.0 * yd + xold, yold = obj.return_value + xnew = xold + xd + ynew = yold + (rand() - 0.5) * yd + ynew2 = yold + (rand() - 0.5) * 2.0 * yd - series1.plot(xnew, ynew) - series2.plot(xnew, ynew2) + series1.plot(xnew, ynew) + series2.plot(xnew, ynew2) - obj.stop if xnew >= 200 + obj.stop if xnew >= 200 - [xnew, ynew] # return_value - }).start(100, proc{ [0.0, 50.0] }) # init return_value + [xnew, ynew] # return_value + }).start(100, proc{ [0.0, 50.0] }) # init return_value } ############################### # Set up an isometric plot ############################### Tk::Tcllib::Plotchart::IsometricPlot.new([0.0, 100.0], [0.0, 200.0], :noaxes, - :background=>'white', - :width=>400, :height=>200){|chart| + :background=>'white', + :width=>400, :height=>200){|chart| pack(:fill=>:both, :side=>:top) set_zoom_pan @@ -55,17 +55,17 @@ Tk::Tcllib::Plotchart::IsometricPlot.new([0.0, 100.0], [0.0, 200.0], :noaxes, ############################### TkToplevel.new(:title=>'h'){|h| Tk::Tcllib::Plotchart::XYPlot.new(h, [0.0, 100.0, 10.0], - [0.0, 100.0, 20.0], - :bg=>'white', - :width=>400, :height=>200){|chart| + [0.0, 100.0, 20.0], + :bg=>'white', + :width=>400, :height=>200){|chart| pack(:fill=>:both) yconfig(:format=>"%12.2e") series1 = Tk::Tcllib::Plotchart::PlotSeries.new(chart, :colour=>'red', - :type=>:symbol) + :type=>:symbol) series2 = Tk::Tcllib::Plotchart::PlotSeries.new(chart, :colour=>'green', - :type=>:both) + :type=>:both) x = 5.0 %w(plus cross circle up down dot upfilled downfilled).each{|sym| diff --git a/ext/tk/sample/tkextlib/tcllib/xyplot.rb b/ext/tk/sample/tkextlib/tcllib/xyplot.rb index 116609e34..8f8c3eb88 100644 --- a/ext/tk/sample/tkextlib/tcllib/xyplot.rb +++ b/ext/tk/sample/tkextlib/tcllib/xyplot.rb @@ -6,7 +6,7 @@ require 'tkextlib/tcllib/plotchart' TkCanvas.new(:background=>'white', :width=>400, :height=>200){|c| pack(:fill=>:both) Tk::Tcllib::Plotchart::XYPlot.new(c, [0.0, 100.0, 10.0], - [0.0, 100.0, 20.0]){ + [0.0, 100.0, 20.0]){ [ [0.0, 32.0], [10.0, 50.0], [25.0, 60.0], [78.0, 11.0] ].each{|x, y| plot('series1', x, y) } diff --git a/ext/tk/sample/tkextlib/tkHTML/hv.rb b/ext/tk/sample/tkextlib/tkHTML/hv.rb index cf93ad3ba..d9f3ea7d7 100644 --- a/ext/tk/sample/tkextlib/tkHTML/hv.rb +++ b/ext/tk/sample/tkextlib/tkHTML/hv.rb @@ -130,12 +130,12 @@ applet_cmd = proc{|w, arglist| # Construct the main HTML viewer # html = Tk::HTML_Widget.new(:padx=>5, :pady=>9, - :formcommand=>form_cmd, - :imagecommand=>image_cmd, - :scriptcommand=>script_cmd, - :appletcommand=>applet_cmd, - :underlinehyperlinks=>0, - :bg=>'white', :tablerelief=>:raised) + :formcommand=>form_cmd, + :imagecommand=>image_cmd, + :scriptcommand=>script_cmd, + :appletcommand=>applet_cmd, + :underlinehyperlinks=>0, + :bg=>'white', :tablerelief=>:raised) vscr = html.yscrollbar(TkScrollbar.new) hscr = html.xscrollbar(TkScrollbar.new) @@ -162,7 +162,7 @@ read_file = proc{|name| ret = nil fp = nil Tk.messageBox(:icon=>'error', :message=>"fail to open '#{name}'", - :type=>:ok) + :type=>:ok) ensure fp.close if fp end @@ -212,15 +212,15 @@ html.clipping_window.bind('1', href_binding, '%x %y') # marking text with the mouse and copying to the clipboard just with tkhtml2.0 working html.clipping_window.bind('B1-Motion', proc{|w, x, y| - w.selection_set(priv['mark'], "@#{x},#{y}") - TkClipboard.clear - # avoid tkhtml0.0 errors - # anyone can fix this for tkhtml0.0 - begin - TkClipboard.append(TkSelection.get) - rescue - end - }, '%W %x %y') + w.selection_set(priv['mark'], "@#{x},#{y}") + TkClipboard.clear + # avoid tkhtml0.0 errors + # anyone can fix this for tkhtml0.0 + begin + TkClipboard.append(TkSelection.get) + rescue + end + }, '%W %x %y') # This procedure is called when the user selects the File/Open # menu option. @@ -249,14 +249,14 @@ refresh = proc{|*args| # top of a hyperlink. # Tk::HTML_Widget::ClippingWindow.bind('Motion', proc{|w, x, y| - parent = w.winfo_parent - url = parent.href(x, y) - unless url.empty? - parent[:cursor] = 'hand2' - else - parent[:cursor] = '' - end - }, '%W %x %y') + parent = w.winfo_parent + url = parent.href(x, y) + unless url.empty? + parent[:cursor] = 'hand2' + else + parent[:cursor] = '' + end + }, '%W %x %y') # # Setup menu # @@ -279,18 +279,18 @@ mbar = Tk.root.add_menubar(menu_spec) # Setup trace # ul_hyper.trace('w', proc{ - html[:underlinehyperlinks] = ul_hyper.value - refresh.call - }) + html[:underlinehyperlinks] = ul_hyper.value + refresh.call + }) show_tbl.trace('w', proc{ - if show_tbl.bool - html[:tablerelief] = :flat - else - html[:tablerelief] = :raised - end - refresh.call - }) + if show_tbl.bool + html[:tablerelief] = :flat + else + html[:tablerelief] = :raised + end + refresh.call + }) show_img.trace('w', refresh) diff --git a/ext/tk/sample/tkextlib/tkHTML/ss.rb b/ext/tk/sample/tkextlib/tkHTML/ss.rb index e71c26f7d..179bdc13c 100644 --- a/ext/tk/sample/tkextlib/tkHTML/ss.rb +++ b/ext/tk/sample/tkextlib/tkHTML/ss.rb @@ -198,7 +198,7 @@ read_file = proc{|name| ret = nil fp = nil Tk.messageBox(:icon=>'error', :message=>"fail to open '#{name}'", - :type=>:ok) + :type=>:ok) ensure fp.close if fp end @@ -291,20 +291,20 @@ fullscreen = proc{ width = root.winfo_screenwidth height = root.winfo_screenheight fswin = TkToplevel.new(:overrideredirect=>true, - :geometry=>"#{width}x#{height}+0+0") + :geometry=>"#{width}x#{height}+0+0") html_fs = Tk::HTML_Widget.new(fswin, :padx=>5, :pady=>9, - :formcommand=>form_cmd, - :imagecommand=>proc{image_cmd.call(0)}, - :scriptcommand=>script_cmd, - :appletcommand=>applet_cmd, - :hyperlinkcommand=>hyper_cmd, - :bg=>'white', :tablerelief=>:raised, - :appletcommand=>proc{|*args| - run_applet('big', *args) - }, - :fontcommand=>pick_font_fs, - :cursor=>:tcross) { + :formcommand=>form_cmd, + :imagecommand=>proc{image_cmd.call(0)}, + :scriptcommand=>script_cmd, + :appletcommand=>applet_cmd, + :hyperlinkcommand=>hyper_cmd, + :bg=>'white', :tablerelief=>:raised, + :appletcommand=>proc{|*args| + run_applet('big', *args) + }, + :fontcommand=>pick_font_fs, + :cursor=>:tcross) { pack(:fill=>:both, :expand=>true) token_handler('meta', proc{|*args| meta.call(self, *args)}) } @@ -361,19 +361,19 @@ menu_spec = [ mbar = root.add_menubar(menu_spec) html = Tk::HTML_Widget.new(:width=>512, :height=>384, - :padx=>5, :pady=>9, - :formcommand=>form_cmd, - :imagecommand=>proc{|*args| - image_cmd.call(1, *args) - }, - :scriptcommand=>script_cmd, - :appletcommand=>applet_cmd, - :hyperlinkcommand=>hyper_cmd, - :fontcommand=>pick_font, - :appletcommand=>proc{|*args| - run_applet.call('small', *args) - }, - :bg=>'white', :tablerelief=>:raised) + :padx=>5, :pady=>9, + :formcommand=>form_cmd, + :imagecommand=>proc{|*args| + image_cmd.call(1, *args) + }, + :scriptcommand=>script_cmd, + :appletcommand=>applet_cmd, + :hyperlinkcommand=>hyper_cmd, + :fontcommand=>pick_font, + :appletcommand=>proc{|*args| + run_applet.call('small', *args) + }, + :bg=>'white', :tablerelief=>:raised) html.token_handler('meta', proc{|*args| meta.call(html, *args)}) diff --git a/ext/tk/sample/tkextlib/tktable/basic.rb b/ext/tk/sample/tkextlib/tktable/basic.rb index a7dfe2a78..ece46b318 100644 --- a/ext/tk/sample/tkextlib/tktable/basic.rb +++ b/ext/tk/sample/tkextlib/tktable/basic.rb @@ -23,19 +23,19 @@ cols = 8 lbl = TkLabel.new(:text=>"TkTable v1 Example") table = Tk::TkTable.new(:rows=>rows, :cols=>cols, :variable=>ary, - :width=>6, :height=>6, - :titlerows=>1, :titlecols=>2, - :roworigin=>-1, :colorigin=>-2, - :rowstretchmode=>:last, :colstretchmode=>:last, - :rowtagcommand=>proc{|row| - row = Integer(row) - return 'OddRow' if row>0 && row%2 == 1 - }, - :coltagcommand=>proc{|col| - col = Integer(col) - return 'OddCol' if col>0 && col%2 == 1 - }, - :selectmode=>:extended, :sparsearray=>false) + :width=>6, :height=>6, + :titlerows=>1, :titlecols=>2, + :roworigin=>-1, :colorigin=>-2, + :rowstretchmode=>:last, :colstretchmode=>:last, + :rowtagcommand=>proc{|row| + row = Integer(row) + return 'OddRow' if row>0 && row%2 == 1 + }, + :coltagcommand=>proc{|col| + col = Integer(col) + return 'OddCol' if col>0 && col%2 == 1 + }, + :selectmode=>:extended, :sparsearray=>false) sx = table.xscrollbar(TkScrollbar.new) sy = table.yscrollbar(TkScrollbar.new) diff --git a/ext/tk/sample/tkextlib/tktable/buttons.rb b/ext/tk/sample/tkextlib/tktable/buttons.rb index b6995bb54..b21e8673c 100644 --- a/ext/tk/sample/tkextlib/tktable/buttons.rb +++ b/ext/tk/sample/tkextlib/tktable/buttons.rb @@ -15,11 +15,11 @@ rows = 20 cols = 20 table = Tk::TkTable.new(:rows=>rows + 1, :cols=>cols + 1, - :variable=>tab, :titlerows=>1, :titlecols=>1, - :roworigin=>-1, :colorigin=>-1, - :colwidth=>4, :width=>8, :height=>8, - :cursor=>'top_left_arrow', :borderwidth=>2, - :flashmode=>false, :state=>:disabled) + :variable=>tab, :titlerows=>1, :titlecols=>1, + :roworigin=>-1, :colorigin=>-1, + :colwidth=>4, :width=>8, :height=>8, + :cursor=>'top_left_arrow', :borderwidth=>2, + :flashmode=>false, :state=>:disabled) sx = table.xscrollbar(TkScrollbar.new) sy = table.yscrollbar(TkScrollbar.new) @@ -40,25 +40,25 @@ table.bind('Leave', proc{|w| w.selection_clear_all}, '%W') # highlight the cell under the mouse table.bind('Motion', proc{|w, x, y| - Tk.callback_break if w.selection_include?(TkComm._at(x,y)) - w.selection_clear_all - w.selection_set(TkComm._at(x,y)) - Tk.callback_break - ## "break" prevents the call to tkTableCheckBorder - }, '%W %x %y') + Tk.callback_break if w.selection_include?(TkComm._at(x,y)) + w.selection_clear_all + w.selection_set(TkComm._at(x,y)) + Tk.callback_break + ## "break" prevents the call to tkTableCheckBorder + }, '%W %x %y') # mousebutton 1 toggles the value of the cell # use of "selection includes" would work here table.bind('1', proc{|w, x, y| - #rc = w.curselection[0] - rc = w.index(TkComm._at(x,y)) - if tab[rc] == 'ON' - tab[rc] = 'OFF' - w.tag_cell('OFF', rc) - else - tab[rc] = 'ON' - w.tag_cell('ON', rc) - end}, '%W %x %y') + #rc = w.curselection[0] + rc = w.index(TkComm._at(x,y)) + if tab[rc] == 'ON' + tab[rc] = 'OFF' + w.tag_cell('OFF', rc) + else + tab[rc] = 'ON' + w.tag_cell('ON', rc) + end}, '%W %x %y') # inititialize the array, titles, and celltags diff --git a/ext/tk/sample/tkextlib/tktable/command.rb b/ext/tk/sample/tkextlib/tktable/command.rb index 950bc0ccb..eb9ddffb7 100644 --- a/ext/tk/sample/tkextlib/tktable/command.rb +++ b/ext/tk/sample/tkextlib/tktable/command.rb @@ -28,44 +28,44 @@ ent_var = TkVariable.new entry = TkEntry.new(:textvariable=>ent_var) table = Tk::TkTable.new(:rows=>rows, :cols=>cols, - :command=>[proc{|mode, cell, val| - if (mode == :w) - data[cell] = val - else - begin - data[cell] # exist - rescue - '' # not exist - end - end - }, '%i %C %s'], - :width=>6, :height=>6, - :titlerows=>1, :titlecols=>1, - :roworigin=>-1, :colorigin=>-1, - :rowstretchmode=>:last, :colstretchmode=>:last, - :rowtagcommand=>proc{|row| - row = Integer(row) - return 'OddRow' if row>0 && row%2 == 1 - }, - :coltagcommand=>proc{|col| - col = Integer(col) - return 'OddCol' if col>0 && col%2 == 1 - }, - :selectmode=>:extended, :flashmode=>true, - :rowstretch=>:unset, :colstretch=>:unset, - :browsecommand=>[proc{|w, s| - cur_var.value = s - ent_var.value = w.get(s) - }, '%W %S'], - :validate=>true, - :validatecommand=>proc{|e| - ent_var.value = e.new_value; true - }) + :command=>[proc{|mode, cell, val| + if (mode == :w) + data[cell] = val + else + begin + data[cell] # exist + rescue + '' # not exist + end + end + }, '%i %C %s'], + :width=>6, :height=>6, + :titlerows=>1, :titlecols=>1, + :roworigin=>-1, :colorigin=>-1, + :rowstretchmode=>:last, :colstretchmode=>:last, + :rowtagcommand=>proc{|row| + row = Integer(row) + return 'OddRow' if row>0 && row%2 == 1 + }, + :coltagcommand=>proc{|col| + col = Integer(col) + return 'OddCol' if col>0 && col%2 == 1 + }, + :selectmode=>:extended, :flashmode=>true, + :rowstretch=>:unset, :colstretch=>:unset, + :browsecommand=>[proc{|w, s| + cur_var.value = s + ent_var.value = w.get(s) + }, '%W %S'], + :validate=>true, + :validatecommand=>proc{|e| + ent_var.value = e.new_value; true + }) =begin - :validatecommand=>[ - proc{|s| - ent_var.value = s; true - }, '%S']) + :validatecommand=>[ + proc{|s| + ent_var.value = s; true + }, '%S']) =end sx = table.xscrollbar(TkScrollbar.new) diff --git a/ext/tk/sample/tkextlib/tktable/debug.rb b/ext/tk/sample/tkextlib/tktable/debug.rb index 30508acea..3200c1c77 100644 --- a/ext/tk/sample/tkextlib/tktable/debug.rb +++ b/ext/tk/sample/tkextlib/tktable/debug.rb @@ -24,16 +24,16 @@ cols = 20 lbl = TkLabel.new(:text=>"TkTable v2 Example") table = Tk::TkTable.new(:rows=>rows, :cols=>cols, :variable=>ary, - :width=>6, :height=>6, - :titlerows=>1, :titlecols=>2, - :roworigin=>-5, :colorigin=>-2, - :coltagcommand=>proc{|col| - col = Integer(col) - return 'OddCol' if col>0 && col%2 == 1 - }, - :selectmode=>:extended, :flashmode=>true, - :rowstretch=>:unset, :colstretch=>:unset, - :selecttitles=>false, :drawmode=>:single) + :width=>6, :height=>6, + :titlerows=>1, :titlecols=>2, + :roworigin=>-5, :colorigin=>-2, + :coltagcommand=>proc{|col| + col = Integer(col) + return 'OddCol' if col>0 && col%2 == 1 + }, + :selectmode=>:extended, :flashmode=>true, + :rowstretch=>:unset, :colstretch=>:unset, + :selecttitles=>false, :drawmode=>:single) sx = table.xscrollbar(TkScrollbar.new) sy = table.yscrollbar(TkScrollbar.new) @@ -68,8 +68,8 @@ table.tag_cell('dis', [2,1], [1,-1], [3,0]) table.set_width([-2,8], [-1,9], [0, 12], [4, 14]) table.set([1,1], "multi-line\ntext\nmight be\ninteresting", - [3,2], "more\nmulti-line\nplaying\n", - [2,2], "null\0byte") + [3,2], "more\nmulti-line\nplaying\n", + [2,2], "null\0byte") # This is in the row span l = TkLabel.new(table, :text=>'Window s', :bg=>'yellow') diff --git a/ext/tk/sample/tkextlib/tktable/dynarows.rb b/ext/tk/sample/tkextlib/tktable/dynarows.rb index 35359046f..d083e2655 100644 --- a/ext/tk/sample/tkextlib/tktable/dynarows.rb +++ b/ext/tk/sample/tkextlib/tktable/dynarows.rb @@ -25,21 +25,21 @@ def table_validate(w, idx) time = Tk.tk_call('clock', 'scan', val) date = [] Tk.tk_call('clock', 'format', time, - :format=>'%m %d %Y').split(' ').each{|item| + :format=>'%m %d %Y').split(' ').each{|item| date << item.sub(/^\s*0*/,'') } w.set(idx, date.join('/')) if row == nrows - 1 if w.get([row,1]) != '' && w.get([row,2]) != '' - w.tag_row_reset(row) - w.set([row,0], row) - nrows += 1 - row += 1 - w.configure(:rows=>nrows) - w.tag_row('unset', row) - w.set([row,0], '*') - w.see([row,1]) - w.activate([row,1]) + w.tag_row_reset(row) + w.set([row,0], row) + nrows += 1 + row += 1 + w.configure(:rows=>nrows) + w.tag_row('unset', row) + w.set([row,0], '*') + w.see([row,1]) + w.activate([row,1]) end end rescue @@ -55,13 +55,13 @@ end lbl = TkLabel.new(:text=>"Dynamic Date Validated Rows") table = Tk::TkTable.new(:rows=>2, :cols=>3, :cache=>1, :selecttype=>:row, - :titlerows=>1, :titlecols=>1, :height=>5, - :colstretch=>:unset, :rowstretch=>:unset, - :autoclear=>true, - :browsecommand=>[ - proc{|w,s| table_validate(w, s)}, - '%W %s' - ]) + :titlerows=>1, :titlecols=>1, :height=>5, + :colstretch=>:unset, :rowstretch=>:unset, + :autoclear=>true, + :browsecommand=>[ + proc{|w,s| table_validate(w, s)}, + '%W %s' + ]) table.set([0,1], 'Begin', [0,2], 'End', [1,0], '*') table.tag_configure('unset', :fg=>'#008811') table.tag_configure('title', :fg=>'red') diff --git a/ext/tk/sample/tkextlib/tktable/maxsize.rb b/ext/tk/sample/tkextlib/tktable/maxsize.rb index a2c5f606a..c9ca745ee 100644 --- a/ext/tk/sample/tkextlib/tktable/maxsize.rb +++ b/ext/tk/sample/tkextlib/tktable/maxsize.rb @@ -24,15 +24,15 @@ cols = 10 lbl = TkLabel.new(:text=>"TkTable v2 Example") table = Tk::TkTable.new(:rows=>rows, :cols=>cols, :variable=>ary, - :width=>6, :height=>8, - :titlerows=>1, :titlecols=>1, - :coltagcommand=>proc{|col| - col = Integer(col) - return 'OddCol' if col>0 && col%2 == 1 - }, - :selectmode=>:extended, - :colstretch=>:unset, :rowstretch=>:unset, - :selecttitles=>false, :drawmode=>:slow) + :width=>6, :height=>8, + :titlerows=>1, :titlecols=>1, + :coltagcommand=>proc{|col| + col = Integer(col) + return 'OddCol' if col>0 && col%2 == 1 + }, + :selectmode=>:extended, + :colstretch=>:unset, :rowstretch=>:unset, + :selecttitles=>false, :drawmode=>:slow) sx = table.xscrollbar(TkScrollbar.new) sy = table.yscrollbar(TkScrollbar.new) diff --git a/ext/tk/sample/tkextlib/tktable/spreadsheet.rb b/ext/tk/sample/tkextlib/tktable/spreadsheet.rb index 5f3ba63bb..9da896f5a 100644 --- a/ext/tk/sample/tkextlib/tktable/spreadsheet.rb +++ b/ext/tk/sample/tkextlib/tktable/spreadsheet.rb @@ -31,11 +31,11 @@ def fill_table(tbl_list, page, r=10, c=10) (0...r).each{|i| (0...c).each{|j| if i!=0 && j!=0 - ary[i,j] = "#{page} #{i},#{j}" + ary[i,j] = "#{page} #{i},#{j}" elsif i!=0 - ary[i,j] = i.to_s + ary[i,j] = i.to_s else - ary[i,j] = (64+j).chr + ary[i,j] = (64+j).chr end } } @@ -68,16 +68,16 @@ fill_table(table_list, page.value) fill_table(table_list, 'BB', Integer(rows/2), Integer(cols/2)) table = Tk::TkTable.new(:rows=>rows, :cols=>cols, :width=>5, :height=>5, - :variable=>table_list[page.value], - :titlerows=>1, :titlecols=>1, - :coltagcommand=>proc{|n| colorize(n)}, - :flashmode=>true, :selectmode=>:extended, - :colstretch=>:unset, :rowstretch=>:unset, - :browsecommand=>proc{|e| cur_var.value = e.new_index}) + :variable=>table_list[page.value], + :titlerows=>1, :titlecols=>1, + :coltagcommand=>proc{|n| colorize(n)}, + :flashmode=>true, :selectmode=>:extended, + :colstretch=>:unset, :rowstretch=>:unset, + :browsecommand=>proc{|e| cur_var.value = e.new_index}) page.trace(:w, proc{|var, elem, op| - changepage(table_list, table, entry, color, var, elem, op) - }) + changepage(table_list, table, entry, color, var, elem, op) + }) table.tag_configure('colored', :bg=>color[page.value]) table.tag_configure('title', :fg=>'red', :relief=>:groove) @@ -107,29 +107,29 @@ Tk.root.grid_rowconfig(2, :weight=>1) table.grid_configure(:sticky=>:news) entry.bind('Return', proc{ - r = table.row_index(:active) - c = table.col_index(:active) - rmax = table[:rows] - cmax = table[:cols] - - c += 1 - if c == cmax - c = table[:titlecols] - r += 1 - if r == rmax - r = table[:titlerows] - end - end - table.activate([r, c]) - table.see('active') - }) + r = table.row_index(:active) + c = table.col_index(:active) + rmax = table[:rows] + cmax = table[:cols] + + c += 1 + if c == cmax + c = table[:titlecols] + r += 1 + if r == rmax + r = table[:titlerows] + end + end + table.activate([r, c]) + table.see('active') + }) menu = TkMenu.new m_file = TkMenu.new(menu) Tk.root.menu(menu) menu.add(:cascade, :label=>'File', :underline=>0, :menu=>m_file) m_file.add(:command, :label=>'Fill Array', - :command=>proc{ fill_table(table_list, page.value) }) + :command=>proc{ fill_table(table_list, page.value) }) m_file.add(:command, :label=>'Quit', :command=>proc{exit}) puts "Table is #{table.path} with array #{(table['variable'])}" diff --git a/ext/tk/sample/tkextlib/tktable/valid.rb b/ext/tk/sample/tkextlib/tktable/valid.rb index 457044166..e5d3f11d8 100644 --- a/ext/tk/sample/tkextlib/tktable/valid.rb +++ b/ext/tk/sample/tkextlib/tktable/valid.rb @@ -54,15 +54,15 @@ end lbl = TkLabel.new(:text=>"TkTable v1 Validated Table Example") table = Tk::TkTable.new(:rows=>rows, :cols=>cols, :cache=>1, - :width=>5, :height=>5, :titlerows=>1, :titlecols=>1, - :coltagcommand=>proc{|n| colorize(n)}, - :flashmode=>true, :selectmode=>:extended, - :colstretch=>:unset, :rowstretch=>:unset, - :validate=>true, - :validatecommand=>proc{|e| - unless e.widget.tag_include?('title', e.index) - validate_proc(e.column, e.new_value) - end } ) + :width=>5, :height=>5, :titlerows=>1, :titlecols=>1, + :coltagcommand=>proc{|n| colorize(n)}, + :flashmode=>true, :selectmode=>:extended, + :colstretch=>:unset, :rowstretch=>:unset, + :validate=>true, + :validatecommand=>proc{|e| + unless e.widget.tag_include?('title', e.index) + validate_proc(e.column, e.new_value) + end } ) fill_headers(table) diff --git a/ext/tk/sample/tkextlib/vu/canvItems.rb b/ext/tk/sample/tkextlib/vu/canvItems.rb index c3e563058..33acf4f7e 100644 --- a/ext/tk/sample/tkextlib/vu/canvItems.rb +++ b/ext/tk/sample/tkextlib/vu/canvItems.rb @@ -10,63 +10,63 @@ xbm = File.join(File.dirname(File.expand_path(__FILE__)), 'm128_000.xbm') sval = [ 11, 22, 33, 44, 55, 66, 77, 88, 99 ] l0 = TkLabel.new(:width=>128, :height=>128, - :bitmap=>"@#{xbm}", :relief=>:groove).pack(:side=>:left) + :bitmap=>"@#{xbm}", :relief=>:groove).pack(:side=>:left) c0 = TkCanvas.new(:width=>80, :height=>80, - :insertwidth=>0, :highlightthickness=>0, - :selectborderwidth=>0, :borderwidth=>2, - :relief=>:ridge).place(:in=>l0, :relx=>0.5, :rely=>0.5, - :anchor=>:c) + :insertwidth=>0, :highlightthickness=>0, + :selectborderwidth=>0, :borderwidth=>2, + :relief=>:ridge).place(:in=>l0, :relx=>0.5, :rely=>0.5, + :anchor=>:c) st = Tk::Vu::TkcStripchart.new(c0, 3, 3, 80, 80, - :background=>"#b7c0d7", :fill=>'slategray3', - :jumpscroll=>1, :outline=>'black', - :scaleline=>'blue', :stripline=>'red', - :selected=>1, :values=>sval) + :background=>"#b7c0d7", :fill=>'slategray3', + :jumpscroll=>1, :outline=>'black', + :scaleline=>'blue', :stripline=>'red', + :selected=>1, :values=>sval) TkcText.create(c0, 40, 40, - :text=>Tk::TCL_PATCHLEVEL, :fill=>'cyan', :tags=>'text') + :text=>Tk::TCL_PATCHLEVEL, :fill=>'cyan', :tags=>'text') l1 = TkLabel.new(:width=>128, :height=>128, - :bitmap=>"@#{xbm}", :relief=>:groove).pack(:side=>:left) + :bitmap=>"@#{xbm}", :relief=>:groove).pack(:side=>:left) c1 = TkCanvas.new(:width=>80, :height=>80, - :insertwidth=>0, :highlightthickness=>0, - :selectborderwidth=>0, :borderwidth=>2, - :relief=>:ridge).place(:in=>l1, :relx=>0.5, :rely=>0.5, - :anchor=>:c) + :insertwidth=>0, :highlightthickness=>0, + :selectborderwidth=>0, :borderwidth=>2, + :relief=>:ridge).place(:in=>l1, :relx=>0.5, :rely=>0.5, + :anchor=>:c) bar1 = Tk::Vu::TkcBarchart.new(c1, 3, 3, 80, 80, - :background=>"#b7c0d7", :scalevalue=>10.0, - :autocolor=>true, :selected=>1, - :outline=>'black', :barline=>'yellow', - :scalelinestyle=>0) + :background=>"#b7c0d7", :scalevalue=>10.0, + :autocolor=>true, :selected=>1, + :outline=>'black', :barline=>'yellow', + :scalelinestyle=>0) bar2 = Tk::Vu::TkcBarchart.new(c1, 53, 3, 80, 80, - :background=>"#b7c0d7", :scalevalue=>10.0, - :autocolor=>true, :selected=>1, - :outline=>'black', :fill=>"#b7c0d7", - :barline=>'red', :scalelinestyle=>22) + :background=>"#b7c0d7", :scalevalue=>10.0, + :autocolor=>true, :selected=>1, + :outline=>'black', :fill=>"#b7c0d7", + :barline=>'red', :scalelinestyle=>22) l2 = TkLabel.new(:width=>128, :height=>128, - :bitmap=>"@#{xbm}", :relief=>:groove).pack(:side=>:left) + :bitmap=>"@#{xbm}", :relief=>:groove).pack(:side=>:left) c2 = TkCanvas.new(:width=>80, :height=>80, - :insertwidth=>0, :highlightthickness=>0, - :selectborderwidth=>0, :borderwidth=>2, - :relief=>:ridge).place(:in=>l2, :relx=>0.5, :rely=>0.5, - :anchor=>:c) + :insertwidth=>0, :highlightthickness=>0, + :selectborderwidth=>0, :borderwidth=>2, + :relief=>:ridge).place(:in=>l2, :relx=>0.5, :rely=>0.5, + :anchor=>:c) begin stick = Tk::Vu::TkcSticker.new(c2, 3, 3, 80, 80, - :text=>"Tcl/Tk", :space=>0, :color=>'red', - :outline=>'red', :font=>'Helvetica 14 bold', - :fill=>'', :stipple=>'', :bar=>'blue', - :orient=>:vertical, :anchor=>:s, - :relheight=>1.0, :relwidth=>0.15, - :relx=>0.1, :rely=>0.0) + :text=>"Tcl/Tk", :space=>0, :color=>'red', + :outline=>'red', :font=>'Helvetica 14 bold', + :fill=>'', :stipple=>'', :bar=>'blue', + :orient=>:vertical, :anchor=>:s, + :relheight=>1.0, :relwidth=>0.15, + :relx=>0.1, :rely=>0.0) rescue stick = nil TkcText.new(c2, 40, 10, :text=>"No Sticker Item") diff --git a/ext/tk/sample/tkextlib/vu/canvSticker.rb b/ext/tk/sample/tkextlib/vu/canvSticker.rb index 431ca56fd..e2cd60497 100644 --- a/ext/tk/sample/tkextlib/vu/canvSticker.rb +++ b/ext/tk/sample/tkextlib/vu/canvSticker.rb @@ -15,7 +15,7 @@ begin st = Tk::Vu::TkcSticker.new(c, 0, 0, 10, 10) rescue Tk.messageBox(:type=>'ok', :title=>"No sticker Item", - :message=>"This build of vu does not include the sticker item") + :message=>"This build of vu does not include the sticker item") exit end #st.delete @@ -57,7 +57,7 @@ steps << proc{ steps << proc{ puts 'A vertical bar appears in the lower right region and text jumps to the left.' st.configure(:anchor=>:n, :relw=>0.3, :relh=>0.7, - :relx=>0.6, :rely=>0.3, :bar=>'red') + :relx=>0.6, :rely=>0.3, :bar=>'red') } steps << proc{ diff --git a/ext/tk/sample/tkextlib/vu/canvSticker2.rb b/ext/tk/sample/tkextlib/vu/canvSticker2.rb index 1e6b59a18..f54e74866 100644 --- a/ext/tk/sample/tkextlib/vu/canvSticker2.rb +++ b/ext/tk/sample/tkextlib/vu/canvSticker2.rb @@ -11,7 +11,7 @@ begin st = Tk::Vu::TkcSticker.new(c, 0, 0, 10, 10) rescue Tk.messageBox(:type=>'ok', :title=>"No sticker Item", - :message=>"This build of vu does not include the sticker item") + :message=>"This build of vu does not include the sticker item") exit end @@ -21,7 +21,7 @@ c.destroy #--- set STRING {{x0 y0 x1 y1} {...text...} {resize point: center} #sti_conf = [ [10, 10, 180, 180], "Sticker äöüß@²³¼½¾", :center ] -#txt_conf = [ [210, 210], "Text äöüß@²³¼½¾", :center ] +#txt_conf = [ [210, 210], "Text äöüß@²³¼½¾", :center ] sti_conf = [ [10, 10, 350, 350], Tk::UTF8_String("Sticker äöüß@²³¼½¾"), :center ] txt_conf = [ [250, 250], @@ -65,32 +65,32 @@ txt = TkcText.new(c, txt_conf[0]){ anchor txt_conf[2] disabledfill '' disabledstipple '' - fill 'blue' - font fnt + fill 'blue' + font fnt justify :left offset '0,0' state '' stipple '' - tags ['tex'] + tags ['tex'] text txt_conf[1] width 0 } #---BINDINGS c.bind('2', proc{ - sti[:orient] = :horizontal - txt[:width] = 0 # horizontal + sti[:orient] = :horizontal + txt[:width] = 0 # horizontal }) c.bind('3', proc{ - sti[:orient] = :vertical - txt[:width] = 1 # top down + sti[:orient] = :vertical + txt[:width] = 1 # top down }) Tk.root.bind('p', proc{ - c.postscript(:file=>'DEMO.ps') - puts "DEMO.ps printed" - }) + c.postscript(:file=>'DEMO.ps') + puts "DEMO.ps printed" + }) Tk.root.bind('q', proc{exit}) diff --git a/ext/tk/sample/tkextlib/vu/dial.rb b/ext/tk/sample/tkextlib/vu/dial.rb index d2ae0990c..09bd3e918 100644 --- a/ext/tk/sample/tkextlib/vu/dial.rb +++ b/ext/tk/sample/tkextlib/vu/dial.rb @@ -13,61 +13,61 @@ v_linked = TkVariable.new v_needle = TkVariable.new volume = Tk::Vu::Dial.new(:label=>"Volume", :from=>-0.1, :to=>0.1, - :resolution=>0.001, :minortickinterval=>0.01, - :tickinterval=>0.1, :beginangle=>-20, - :endangle=>260, :variable=>v_volume) + :resolution=>0.001, :minortickinterval=>0.01, + :tickinterval=>0.1, :beginangle=>-20, + :endangle=>260, :variable=>v_volume) speed = Tk::Vu::Dial.new(:label=>"Speed", :from=>2000, :to=>100, - :resolution=>10, :tickinterval=>100, - :minortickinterval=>0, :variable=>v_speed, - :showtags=>:label, :showvalue=>false) + :resolution=>10, :tickinterval=>100, + :minortickinterval=>0, :variable=>v_speed, + :showtags=>:label, :showvalue=>false) speed.set_tag_constrain(100, 'Fast', 2000, 'Slow') fwd = Tk::Vu::Dial.new(:from=>-10.0, :to=>-20.0, :resolution=>0.1, - :tickinterval=>5.0, :minortickinterval=>1.0, - :variable=>v_dir) + :tickinterval=>5.0, :minortickinterval=>1.0, + :variable=>v_dir) rev = Tk::Vu::Dial.new(:from=>-20.0, :to=>-10.0, :resolution=>0.1, - :tickinterval=>5.0, :minortickinterval=>1.0, - :variable=>v_dir) + :tickinterval=>5.0, :minortickinterval=>1.0, + :variable=>v_dir) small = Tk::Vu::Dial.new(:font=>"Helvetica -10", :from=>0, :to=>10, - :resolution=>0.05, :tickinterval=>2, - :minortickinterval=>0.5, :radius=>20, - :dialcolor=>'red2', :activebackground=>'red', - :variable=>v_rot) + :resolution=>0.05, :tickinterval=>2, + :minortickinterval=>0.5, :radius=>20, + :dialcolor=>'red2', :activebackground=>'red', + :variable=>v_rot) large = Tk::Vu::Dial.new(:font=>"Helvetica -8", :from=>0, :to=>10, - :resolution=>0.05, :tickinterval=>1, - :minortickinterval=>0.25, :radius=>40, - :dialcolor=>'red2', :activebackground=>'red', - :variable=>v_rot) + :resolution=>0.05, :tickinterval=>1, + :minortickinterval=>0.25, :radius=>40, + :dialcolor=>'red2', :activebackground=>'red', + :variable=>v_rot) turn = Tk::Vu::Dial.new(:needlecolor=>'red', :label=>"Linked", - :variable=>v_linked) + :variable=>v_linked) scale = TkScale.new(:label=>"Linked", :variable=>v_linked) d1 = Tk::Vu::Dial.new(:resolution=>0.0001, :from=>-0.1, :to=>0.1, - :showvalue=>true, :minortickinterval=>0.01, - :tickinterval=>0.1, :radius=>30, :label=>"Dial", - :beginangle=>-20, :endangle=>260, :variable=>v_needle, - :relief=>:raised) + :showvalue=>true, :minortickinterval=>0.01, + :tickinterval=>0.1, :radius=>30, :label=>"Dial", + :beginangle=>-20, :endangle=>260, :variable=>v_needle, + :relief=>:raised) d2 = Tk::Vu::Dial.new(:resolution=>0.01, :from=>-0.1, :to=>0.1, - :showvalue=>true, :minortickinterval=>0.01, - :tickinterval=>0.1, :radius=>30, :label=>"Dial 2", - :beginangle=>-20, :endangle=>260, :variable=>v_needle, - :dialrelief=>:flat, :needlecolor=>'red', - :needletype=>:triangle, :relief=>:sunken) + :showvalue=>true, :minortickinterval=>0.01, + :tickinterval=>0.1, :radius=>30, :label=>"Dial 2", + :beginangle=>-20, :endangle=>260, :variable=>v_needle, + :dialrelief=>:flat, :needlecolor=>'red', + :needletype=>:triangle, :relief=>:sunken) d3 = Tk::Vu::Dial.new(:resolution=>0.001, :from=>-0.1, :to=>0.1, - :showvalue=>true, :minortickinterval=>0.01, - :tickinterval=>0.1, :radius=>30, :label=>"Dial 3", - :beginangle=>-20, :endangle=>260, :variable=>v_needle, - :dialrelief=>:flat, :needlecolor=>'blue', - :needletype=>:arc, :relief=>:ridge) + :showvalue=>true, :minortickinterval=>0.01, + :tickinterval=>0.1, :radius=>30, :label=>"Dial 3", + :beginangle=>-20, :endangle=>260, :variable=>v_needle, + :dialrelief=>:flat, :needlecolor=>'blue', + :needletype=>:arc, :relief=>:ridge) f_btns = TkFrame.new f_sep = TkFrame.new(:height=>2, :relief=>:sunken, :bd=>1) @@ -77,12 +77,12 @@ v_volume.value = -0.1 v_speed.value = 500 update = TkTimer.new(proc{v_speed.numeric}, -1, proc{ - if v_volume == volume[:to] - v_volume.numeric = volume[:from] - else - v_volume.numeric += volume[:resolution] - end - }) + if v_volume == volume[:to] + v_volume.numeric = volume[:from] + else + v_volume.numeric += volume[:resolution] + end + }) b_start = TkButton.new(:text=>"Start", :command=>proc{update.start}) b_stop = TkButton.new(:text=>"Stop", :command=>proc{update.stop}) diff --git a/ext/tk/sample/tkextlib/vu/oscilloscope.rb b/ext/tk/sample/tkextlib/vu/oscilloscope.rb index 43254c9b2..2015e4664 100644 --- a/ext/tk/sample/tkextlib/vu/oscilloscope.rb +++ b/ext/tk/sample/tkextlib/vu/oscilloscope.rb @@ -23,43 +23,43 @@ c = TkCanvas.new(:width=>220, :height=>190).pack(:fill=>:both, :expand=>true) #---background TkcRectangle.new(c, geo_fr, :width=>4, :fill=>'aquamarine3', - :tags=>['osc', 'frbg']) + :tags=>['osc', 'frbg']) #---channel 0 ch0 = Tk::Vu::TkcStripchart.new(c, geo_ch0, - :fill=>'', :jumpscroll=>false, - :outline=>'', :scaleline=>'', - :stripline=>'cyan', :tags=>['osc', 'ch0']) + :fill=>'', :jumpscroll=>false, + :outline=>'', :scaleline=>'', + :stripline=>'cyan', :tags=>['osc', 'ch0']) #---channel 1 ch1 = Tk::Vu::TkcStripchart.new(c, geo_ch1, - :fill=>'', :jumpscroll=>0, - :outline=>'', :scaleline=>'', - :stripline=>'red', :tags=>['osc', 'ch1']) + :fill=>'', :jumpscroll=>0, + :outline=>'', :scaleline=>'', + :stripline=>'red', :tags=>['osc', 'ch1']) #---frame TkcRectangle.new(c, geo_fr, :width=>4, :tags=>['osc', 'frfg']) #---position txt1 = TkcText.new(c, geo_t1, :text=>"B1-Motion: X:%X\tY:%Y", - :anchor=>:nw, :tags=>['osc', 'txt1']) + :anchor=>:nw, :tags=>['osc', 'txt1']) #---BINDINGS c.bind('B1-Motion', proc{|x, y, xx, yy| - ch0[:values] = x - ch1[:values] = y - txt1[:text] = "B1-Motion: X:#{xx}\tY:#{yy}" + ch0[:values] = x + ch1[:values] = y + txt1[:text] = "B1-Motion: X:#{xx}\tY:#{yy}" }, '%x %y %X %Y') Tk.root.bind('v', proc{ - puts ch0[:values].join(' ') - puts ch0[:values].size - }) + puts ch0[:values].join(' ') + puts ch0[:values].size + }) Tk.root.bind('p', proc{ - c.postscript(:file=>'DEMO.ps') - puts "DEMO.ps printed" - }) + c.postscript(:file=>'DEMO.ps') + puts "DEMO.ps printed" + }) Tk.root.bind('q', proc{exit}) diff --git a/ext/tk/sample/tkextlib/vu/pie.rb b/ext/tk/sample/tkextlib/vu/pie.rb index a567f840a..ed598d623 100644 --- a/ext/tk/sample/tkextlib/vu/pie.rb +++ b/ext/tk/sample/tkextlib/vu/pie.rb @@ -27,7 +27,7 @@ Tk.grid(pie, :sticky=>:news) Tk.grid(f, :sticky=>:ew) Tk.pack(fast_btn, slow_btn, quit_btn, - :in=>f, :side=>:left, :fill=>:both, :expand=>true, :padx=>6, :pady=>4) + :in=>f, :side=>:left, :fill=>:both, :expand=>true, :padx=>6, :pady=>4) Tk.root.grid_columnconfigure(0, :weight=>1) Tk.root.grid_rowconfigure(0, :weight=>1) @@ -37,20 +37,20 @@ priv = { } pie.bind('ButtonPress-1', proc{|w, x, y| - priv[:x] = x - priv[:y] = y - priv[:pie_in] = (w.winfo_width/1.8 > x) - priv[:angle] = w[:angle] - priv[:origin] = w[:origin] - }, '%W %x %y') + priv[:x] = x + priv[:y] = y + priv[:pie_in] = (w.winfo_width/1.8 > x) + priv[:angle] = w[:angle] + priv[:origin] = w[:origin] + }, '%W %x %y') pie.bind('B1-Motion', proc{|w, x, y| - if priv[:pie_in] - w.configure(:angle=>priv[:angle] + (priv[:y] - y)/3, - :origin=>(priv[:origin] + - ((w.winfo_height/2.2 > y)? -1: 1) * - (priv[:x] - x)/3) % 360) - end - }, '%W %x %y') + if priv[:pie_in] + w.configure(:angle=>priv[:angle] + (priv[:y] - y)/3, + :origin=>(priv[:origin] + + ((w.winfo_height/2.2 > y)? -1: 1) * + (priv[:x] - x)/3) % 360) + end + }, '%W %x %y') Tk.mainloop diff --git a/ext/tk/sample/tkextlib/vu/vu.rb b/ext/tk/sample/tkextlib/vu/vu.rb index df9a7f38a..d078ae16f 100644 --- a/ext/tk/sample/tkextlib/vu/vu.rb +++ b/ext/tk/sample/tkextlib/vu/vu.rb @@ -10,13 +10,13 @@ puts "Show off barchart and dial widgets" speed = TkVariable.new(0) dial = Tk::Vu::Dial.new(:resolution=>0.001, :from=>-0.1, :to=>0.1, - :showvalue=>true, :minortickinterval=>0.01, - :tickinterval=>0.1, :radius=>50, :label=>"Dial", - :beginangle=>-20, :endangle=>260, :dialcolor=>'red3', - :active=>'red2', :variable=>speed) + :showvalue=>true, :minortickinterval=>0.01, + :tickinterval=>0.1, :radius=>50, :label=>"Dial", + :beginangle=>-20, :endangle=>260, :dialcolor=>'red3', + :active=>'red2', :variable=>speed) bar = Tk::Vu::Bargraph.new(:from=>0, :to=>100, :relief=>:groove, - :border=>2, :label=>"Bar Chart") + :border=>2, :label=>"Bar Chart") ####################################### @@ -30,24 +30,24 @@ def rand_bool end update = TkTimer.new(200, -1, proc{ - if (rand() - 0.5 + speed.numeric * 3) > 0 - current += 1 - else - current -= 1 - end - bar.set(current) - if current < green - current = 100 if current <= 0 - bar[:barcolor] = 'green' - elsif current < blue - bar[:barcolor] = 'blue' - elsif current < purple - bar[:barcolor] = 'purple' - else - bar[:barcolor] = 'red' - current = 0 if current >= 100 - end - }) + if (rand() - 0.5 + speed.numeric * 3) > 0 + current += 1 + else + current -= 1 + end + bar.set(current) + if current < green + current = 100 if current <= 0 + bar[:barcolor] = 'green' + elsif current < blue + bar[:barcolor] = 'blue' + elsif current < purple + bar[:barcolor] = 'purple' + else + bar[:barcolor] = 'red' + current = 0 if current >= 100 + end + }) ####################################### @@ -61,7 +61,7 @@ Tk.grid('x', nobar, :sticky=>:ew, :padx=>4, :pady=>4) Tk.grid(quit, '-', '-', :sticky=>:ew, :padx=>4, :pady=>4) Tk.root.grid_columnconfigure(2, :weight=>1) Tk.root.grid_rowconfigure(1, :weight=>1) - + ####################################### Tk.mainloop |