4 #require './Gmolvie/Gmolvie.rb'
9 pack( 'fill'=>'both', 'side'=>'bottom')
10 TkGrid.rowconfigure(f, 0, 'weight'=>1, 'minsize'=>0)
11 TkGrid.columnconfigure(f, 0, 'weight'=>1, 'minsize'=>0)
12 $txt = TkText.new(f,'wrap'=>'none').grid('row'=>0, 'column'=>0, 'sticky'=>'news')
13 xscr = TkScrollbar.new(f).grid('row'=>1, 'column'=>0, 'sticky'=>'ew')
14 yscr = TkScrollbar.new(f).grid('row'=>0, 'column'=>1, 'sticky'=>'ns')
24 $txt.delete('1.0','end')
26 $txt.title($current = fname)
31 $txt.value = IO.readlines(fname).join('')
32 $txt.set_insert('1.0')
37 fname = Tk.getOpenFile
44 open($current,'w') {|f| f.write($txt.get('1.0', 'end'))}
49 fname = Tk.getSaveFile('initialfile'=>$current)
51 open(fname,'w') {|f| f.write($txt.get('1.0', 'end'))}
52 $root.title($current = fname)
58 pack( 'fill'=>'x', 'side'=>'top')
60 TkMenubutton.new(f, 'text'=>'ファイル', 'underline'=>0){|btn|
62 btn.menu(menu = TkMenu.new(btn, 'tearoff'=>false))
63 menu.add('command','label'=>'ファイルを開く','command'=>proc{open_file})
65 menu.add('command','label'=>'保存','command'=>proc{save_file})
66 menu.add('command','label'=>'別名で保存','command'=>proc{save_as})
68 menu.add('command', 'label'=>'人間をやめる', 'command'=>proc{exit})
71 TkMenubutton.new(f, 'text'=>'mode', 'underline'=>0){|btn|
73 btn.menu(menu = TkMenu.new(btn, 'tearoff'=>false))
74 menu.add('command','label'=>'molvieViewer','command'=>proc{new_file})
75 menu.add('command','label'=>'molvieProgection','command'=>proc{open_file})
76 menu.add('command','label'=>'molvieDock','command'=>proc{save_file})
77 menu.add('command','label'=>'molvieFlight','command'=>proc{save_as})
78 menu.add('command', 'label'=>'molvieMrcViewer', 'command'=>proc{exit})
81 TkMenubutton.new(f, 'text'=>'Display', 'underline'=>0){|btn|
83 btn.menu(menu = TkMenu.new(btn, 'tearoff'=>false))
85 menu.add('command','label'=>'新規のファイル作成','command'=>proc{new_file})
86 menu.add('command','label'=>'ファイルを開く','command'=>proc{open_file})
88 menu.add('command','label'=>'保存','command'=>proc{save_file})
89 menu.add('command','label'=>'別名で保存','command'=>proc{save_as})
91 menu.add('command', 'label'=>'人間をやめる', 'command'=>proc{exit})
99 $current = "temp#{$$}.txt"
102 $current = File.expand_path(ARGV[0])
104 print("にゃにゅ#{$current}\n")
106 print("にゃにゅにょ#{$current}\n")
107 $root.title($current)