#!/bin/sh # the next line restarts using wish (Emacs clue: -*- tcl -*- ) \ exec wish "$0" "$@" #------------------------------------------------------------------------- # CDR Toaster Version 1.12J <日本語版> # # オリジナル(英語版:Version 1.12)の作者: # CDR-Toaster is copyright 1999 Ian Kjos # # 日本語化改造: 2001年5月13日 R.川岸 #------------------------------------------------------------------------- #------------------------------------------------------------------------- # メイン画面 #------------------------------------------------------------------------- proc interface {} { wm title . "CDR Toaster - [version]" label .title -text {CDR Toaster} -fg blue \ -font -*-times-bold-r-*-*-30-*-*-*-*-*-*-* frame .b -border 3 -relief raised button .b.burn -text {書込み開始} set m .b.trick.m menubutton .b.trick -text {処理選択} -menu $m -relief raised -border 2 menu $m -tearoff 0 $m add command -label "ISOイメージ作成用にCDROMを読込む" -command read_iso $m add command -label "CDROMからオーディオトラックを読込む" \ -command read_audio $m add command -label "CDRWメディアを抹消" -command blank_cdrw button .b.quit -text {終了} set m .b.help.m menubutton .b.help -text {ヘルプ} -menu $m -relief raised -border 2 menu $m -tearoff 0 $m add command -label "CDR Toasterについて" -command help $m add command -label "用語説明" -command help_clarify frame .audio label .audio.la -text {オーディオトラック・リスト} frame .audio.f -border 3 -relief sunken listbox .audio.f.lb -height 16 -width 30 -selectmode browse \ -yscrollcommand {.audio.f.sb set} scrollbar .audio.f.sb -orient v -command {.audio.f.lb yview} frame .audio.m button .audio.m.up -text {上に移動} -command { set num [.audio.f.lb curselection] if {""==$num} return if {$num==0} return flip $num incr num -1 .audio.f.lb selection set $num .audio.f.lb see $num } button .audio.m.dn -text {下に移動} -command { set num [.audio.f.lb curselection] if {""==$num} return incr num 1 if {$num==[.audio.f.lb index end]} return flip $num .audio.f.lb selection set $num .audio.f.lb see $num } frame .audio.ar -relief flat button .audio.ar.add -text {追加} -command audio_add button .audio.ar.rem -text {削除} -command audio_remove button .audio.remall -text {全て削除} -command audio_removeall label .lds -text "元のデータ・トラック" frame .ds -border 3 -relief sunken radiobutton .ds.none -text {オーディオのみのディスク作成} \ -variable {ds} -value none radiobutton .ds.mk -text {オンザフライのデータトラック作成} \ -variable {ds} -value mkisofs radiobutton .ds.pre -text {作成済みのデータトラックを使用} \ -variable {ds} -value premade entry .ds.tname -width 20 -font 7x14 .ds.tname insert 0 "image.iso" ## Andrew found the missing code, so now TK8 users (of which I have become) ## can reap the benefits of a standard dialog. # Lets make the selection button if you have tk8.0 + if {[info tclversion] >= 8.0} { button .ds.select -text {選択} -command {my_image} } else { button .ds.select -text {選択} -command { perusefile .ds.tname delete 0 end .ds.tname insert 0 $perusedfile } } label .lm -text {データトラック作成のオプション} frame .m -border 3 -relief sunken frame .m.scan checkbutton .m.scan.all -text {全ファイル(バックアップ等)} -variable {all} checkbutton .m.scan.links -text {シンボルリンクに従う} -variable {follow} frame .m.file checkbutton .m.file.joliet -text {Joliet サポート} -variable {joliet} checkbutton .m.file.trans -text {変換テーブル (古い)} -variable {trans} frame .m.rock -border 0 -relief flat label .m.rock.l -text {Rock Ridge:} radiobutton .m.rock.none -text {None} -variable {rock} -value none radiobutton .m.rock.rational -text {Rationalized} -variable {rock} -value rat radiobutton .m.rock.literal -text {Literal} -variable {rock} -value lit frame .m.volid -border 0 label .m.volid.l -text {ボリューム ID (name)} entry .m.volid.e -width 32 -font 7x14 frame .m.root -border 0 -relief flat label .m.root.l -text {Root of Tree} entry .m.root.e -width 24 -font 7x14 button .m.root.p -text "選択" -command { peruse .m.root.e delete 0 end .m.root.e insert 0 $perused } frame .m.custom -border 0 checkbutton .m.custom.use -text "カスタム・レイアウトを使用" \ -variable custom(use) button .m.custom.b -text {カスタム・レイアウトの設定} -command custom_layout frame .m.boot checkbutton .m.boot.check -text "El Torito ブート可能 CD" -variable boot button .m.boot.opts -text "ブートの設定" -command boot_setup label .lc -text {cdrecord のオプション} frame .c -border 3 -relief sunken frame .c.flag checkbutton .c.flag.dummy -text {ダミー書き込み} -variable {dummy} checkbutton .c.flag.eject -text {終了時イジェクト} -variable {eject} button .c.flag.pad -text "埋込み..." -command padbox frame .c.dev -border 0 -relief flat label .c.dev.l -text {デバイス} entry .c.dev.e -width 20 -font 7x14 -textvariable device frame .c.speed label .c.speed.l -text "速度:" radiobutton .c.speed.1 -text "1x" -variable speed -value 1 radiobutton .c.speed.2 -text "2x" -variable speed -value 2 radiobutton .c.speed.4 -text "4x" -variable speed -value 4 radiobutton .c.speed.6 -text "6x" -variable speed -value 6 radiobutton .c.speed.8 -text "8x" -variable speed -value 8 radiobutton .c.speed.10 -text "10x" -variable speed -value 10 radiobutton .c.speed.12 -text "12x" -variable speed -value 12 pack .title -side top pack .b -side top -ipadx 30 -ipady 10 pack .b.burn -side left -expand 1 pack .b.trick -side left -expand 1 -ipady 1 -ipadx 1 pack .b.quit -side left -expand 1 pack .b.help -side left -expand 1 pack .audio -side right -anchor n pack .audio.la -side top pack .audio.f -side top pack .audio.f.lb -side left pack .audio.f.sb -side left -fill y pack .audio.m -side top pack .audio.m.up -side left pack .audio.m.dn -side left pack .audio.ar -side top pack .audio.ar.add -side left pack .audio.ar.rem -side left pack .audio.remall -side top pack .lds -side top pack .ds -side top -padx 5 pack .ds.none -side bottom -anchor w pack .ds.mk -side bottom -anchor w pack .ds.pre -side left -anchor w pack .ds.tname -side left -anchor w pack .ds.select -side right -anchor n pack .lm -side top pack .m -side top pack .m.scan -side top -fill x pack .m.scan.all -side left pack .m.scan.links -side right pack .m.file -side top -fill x pack .m.file.joliet -side left pack .m.file.trans -side right pack .m.rock -side top -anchor w pack .m.rock.l -side left pack .m.rock.none -side left pack .m.rock.rational -side left pack .m.rock.literal -side left pack .m.volid -side top -anchor w pack .m.volid.l -side left pack .m.volid.e -side left pack .m.root -side top -anchor w -fill x pack .m.root.l -side left pack .m.root.e .m.root.p -side left pack .m.custom -side top -fill x pack .m.custom.use -side left pack .m.custom.b -side right pack .m.boot -side top -anchor w -fill x pack .m.boot.check -side left pack .m.boot.opts -side left -expand 1 pack .lc -side top pack .c -side top pack .c.flag -side top pack .c.flag.dummy -side left pack .c.flag.eject -side left pack .c.flag.pad -side left pack .c.dev -side top pack .c.dev.l -side left pack .c.dev.e -side left pack .c.speed -side top pack .c.speed.l .c.speed.1 .c.speed.2 .c.speed.4 .c.speed.6 .c.speed.8 \ .c.speed.10 .c.speed.12 -side left frame .spacer -height 10 pack .spacer -side top } #------------------------------------------------------------------------- # CD-R 書込み #------------------------------------------------------------------------- proc toast {} { global apad dpad ds if {$ds == "none"} { set source "" } if {$ds == "premade"} { set source [.ds.tname get] if {![file isfile $source]} { alert "作成済みのデータトラックは、正規のファイルでなければいけません。" return } } if {$ds == "mkisofs"} { set source - set mk [make_mkisofs_cmd] if {$mk == ""} { return } } set cd [base_cdrec] set nuke "" set convlist "" if {$source != ""} { lappend cd -data if $dpad {lappend cd "-pad"} lappend cd $source } set tmp [.audio.f.lb get 0 end] if {$tmp == ""} { if {$ds == "none"} { alert "No audio tracks were specified for an audio-only disk. This makes no sense. オーディオ・オンリー・ディスク用のオーディオ・トラックが指定されていません。これは無意味です。" return } } else { lappend cd -audio if $apad {lappend cd "-pad"} else { if $dpad {lappend cd "-nopad"} } set warned 0 foreach i $tmp { ## Have to validate audio track type switch [file extension $i] { .mp2 - .mpg - .mp3 { if {$warned == 0} { # Give use opportunity to opt out. Also collect info for # conversion. set tempdir [get_mp3_burn_info] if {$tempdir==""} { alert "An understandable choice." return } set warned 1 } # Queue for conversion burning, and nuking. # Yes, there are race conditions. No, I don't care too much. If # you have a fix for the race conditions which is not too # complicated, tell me and I'll probably add your fix. Thanks. set tail [file tail $i] set tempfile [file join $tempdir "###${tail}.wav"] if [file exists $tempfile] { alert "$tempfile already exists. I will cancel the burn and let you decide what to do." return } lappend convlist $i lappend nuke $tempfile lappend cd $tempfile } .wav - .raw - .pcm { # queue for burning lappend cd $i } default { # Note the offending file for the user. alert "I don't recognize the file extention on '$i'. For safety reasons, I won't burn that file as an audio track.\n\nI'd suggest removing it and others like it from the audio track list." return } } } } if {$ds == "mkisofs"} { set cd [concat $mk $cd] } set shellCommand $cd regsub -all {///PIPE///} $shellCommand "|" shellCommand if {[sure "下記のコマンド:\n\n$shellCommand\n\nを実行しますか?"]} { set err 0 set err [catch { # Run necessary conversions if [llength $convlist] { toplevel .conv wm title .conv "Converting MP3s" text .conv.t -width 80 -height [llength $convlist] pack .conv.t foreach orig $convlist tempfile $nuke { .conv.t insert end "$orig --> $tempfile ..." update exec mpg123 -s $orig | sox -t raw -w -s -c 2 -r 44100 - -t wav $tempfile >&/dev/null .conv.t insert end " Done.\n" } destroy .conv } }] set cmd_list [list $cd] if $err { alert "Some error occured during the MPEG conversion process. You probably ran out of space or don't have the mpg123 and sox tools installed." } else { # Remove temp files when done... foreach tempfile $nuke { lappend cmd_list [list rm $tempfile] } dispatch $cmd_list {CD Burn Progress} } } } #------------------------------------------------------------------------- # オーディオトラックを追加 #------------------------------------------------------------------------- proc audio_add {} { catch {destroy .add} toplevel .add wm title .add {オーディオトラックを追加} label .add.l -text {トラック名 (Globals OK)} entry .add.e -width 32 -font 7x14 button .add.ok -text {OK} -command { set tmp [glob -nocomplain [.add.e get]] foreach i $tmp {.audio.f.lb insert end $i} destroy .add } button .add.cancel -text {キャンセル} -command { destroy .add } pack .add.l -side top pack .add.e -side top pack .add.ok -side left pack .add.cancel -side right } #------------------------------------------------------------------------- # オーディオトラックを削除 #------------------------------------------------------------------------- proc audio_remove {} { set victim [.audio.f.lb curselection] catch {.audio.f.lb delete $victim} } #------------------------------------------------------------------------- # 全てのオーディオトラックを削除 #------------------------------------------------------------------------- proc audio_removeall {} { .audio.f.lb delete 0 end } #------------------------------------------------------------------------- # #------------------------------------------------------------------------- proc flip n { .audio.f.lb selection clear 0 end set above [expr $n - 1] set tmp [.audio.f.lb get $n] .audio.f.lb insert $above $tmp .audio.f.lb delete [expr $n + 1] } #------------------------------------------------------------------------- # 警告メッセージを表示する #------------------------------------------------------------------------- proc alert msg { tk_dialog .alert Alert $msg info 0 "了解" } #------------------------------------------------------------------------- # ヘルプを表示する #------------------------------------------------------------------------- proc help {} { catch {destroy .help} toplevel .help wm title .help {Help!} button .help.ok -text {閉じる} -command {destroy .help} text .help.t -width 60 -height 18 -yscrollcommand {.help.sb set} -wrap word scrollbar .help.sb -orient v -command {.help.t yview} pack .help.ok -side bottom pack .help.t -side left pack .help.sb -side left -fill y #.help.t insert 1.0 "About CDR-Toaster version [version]" #.help.t insert end { # #This is a graphical front-end for the excellent programs 'mkisofs', 'cdrecord', and 'cdparanoia'. #It's good for: # o Avoiding coasters due to command-line mistakes # o Eliminating the tedium of consulting documentation # o Feeling more secure in a correct set of options # o Being lazy # #As you can guess, I wrote it for what it's good for. # #CDR-Toaster is copyright 1999 Ian Kjos # #CDR-Toaster contains some code contributed by: # Daniel Caujolle-Bert # Andrew Williams # Claus Brunzema # Aaron Sherman # Fred D. Feirtag # And a cast of thousands! # # If you don't see your name here and you should, # please send me some e-mail about it. Preferably # with a diff. # #CDR-Toaster is availible under the GNU General #Public License version 2.0 or later (at your option). #This license can be found at #http://www.gnu.org/copyleft/gpl.html # #} .help.t insert 1.0 "CDR-Toaster version [version] について" .help.t insert end { これは 'mkisofs', 'cdrecord', 'cdparanoia' という素晴らしい プログラムのグラフィカルなフロントエンドです。 以下のようなことに適しています。 o コマンドラインでの間違いを避ける。 o ドキュメントを調べる退屈さをなくす。 o オプションの正しい組み合わせで、より安全に。 o 不精になる。 あなたの想像通り、私は wrote it for what it's good for.??? CDR-Toaster is copyright 1999 Ian Kjos CDR-Toaster は、以下の方が貢献されたコードを利用しています。 Daniel Caujolle-Bert Andrew Williams Claus Brunzema Aaron Sherman Fred D. Feirtag そして、数千人のキャスト! あなたの名前がここに見あたらなくて、且つ、入れるべきである なら Eメールでそのことをお知らせ下さい。できれば diff で。 CDR-Toaster は、GPL2 (GNU General Public License version 2.0) またはそれ以降の条項の下で利用可能です。 このライセンスは下記のところから入手できます。 http://www.gnu.org/copyleft/gpl.html } .help.t config -state disabled } #------------------------------------------------------------------------- # 確認 #------------------------------------------------------------------------- proc sure msg { return [expr ![tk_dialog .alert {確認} $msg questhead -1 {はい} {いいえ}]] } #------------------------------------------------------------------------- # ISOイメージ作成用に CDROM を読込む #------------------------------------------------------------------------- proc read_iso {} { catch {destroy .top} toplevel .top wm title .top "ISO イメージ読み込み" frame .top.dev -border 0 -relief flat frame .top.file -border 0 -relief flat frame .top.b -border 0 -relief flat label .top.dev.l -text {読み込みデバイス:} label .top.file.l -text {書き込みファイル:} entry .top.dev.e -width 20 -font 7x14 entry .top.file.e -width 20 -font 7x14 button .top.b.ok -text {実行} -command { if {![file readable [.top.dev.e get]]} { alert " '[.top.dev.e get]'の読み込み権限がありません。 あなたは、たぶんこれを root 権限で実行する必要があります。" return } set cmd_echo [list echo "This takes a good while."] set cmd_dd [list dd if=[.top.dev.e get] of=[.top.file.e get] bs=1024k] set cmd_eject [list eject [.top.dev.e get]] dispatch [list $cmd_echo $cmd_dd $cmd_eject] "ISO イメージ読込み中" destroy .top } button .top.b.dis -text {キャンセル} -command { destroy .top } pack .top.dev -side top pack .top.file -side top pack .top.b -side top -fill x pack .top.dev.l -side left pack .top.file.l -side left pack .top.dev.e -side left pack .top.file.e -side left pack .top.b.ok -side left -expand 1 pack .top.b.dis -side left -expand 1 .top.dev.e insert 0 [detect_cdrom_device] .top.file.e insert 0 "image.iso" } #------------------------------------------------------------------------- # CD-ROM からオーディオトラックを読込む #------------------------------------------------------------------------- proc read_audio {} { catch {destroy .top} toplevel .top wm title .top "オーディオトラック読込み" frame .top.path1 label .top.path1.l -text "(オプション) Rip するソース: " entry .top.path1.source -width 15 button .top.path1.peruse -text "選択" -command { peruse_block .top.path1.source delete 0 end .top.path1.source insert 0 $perusedfile } frame .top.path2 label .top.path2.l -text "Rip の格納先: " entry .top.path2.dest button .top.path2.peruse -text "選択" -command { peruse .top.path2.dest delete 0 end .top.path2.dest insert 0 $perused } frame .top.1 -border 0 -relief flat frame .top.2 -border 0 -relief flat frame .top.3 -border 0 -relief flat frame .top.4 -border 0 -relief flat radiobutton .top.1.entire -text {ディスクを丸ごとRip} -variable {rip} \ -value {all} radiobutton .top.2.track -text {トラック:} -variable {rip} -value {track} radiobutton .top.3.custom -text {特別オプション} -variable {rip} \ -value {custom} button .top.4.ok -text {実行} -command { set tmp "Ripping Audio" switch $rip { all { if {[.top.path1.source get] != ""} { set dp [list "cdparanoia -d [.top.path1.source get] -w -B 1-"] } else { set dp [list "cdparanoia -s -w -B 1-"] } } track { if {[.top.path1.source get] != ""} { set dp [list "cdparanoia -d [.top.path1.source get] -w \ -B [.top.2.from get]-[.top.2.to get]"] } else { set dp [list "cdparanoia -s -w -B [.top.2.from get]-[.top.2.to get]"] } } custom { set dp [list "cdparanoia [.top.3.opt get]"] } } if {[.top.path2.dest get] != ""} { set dp [concat [list "cd [.top.path2.dest get]"] $dp] } dispatch $dp $tmp destroy .top } button .top.4.dis -text {キャンセル} -command { destroy .top } label .top.2.lfr -text {From:} entry .top.2.from -width 4 -font 7x14 label .top.2.lto -text {To:} entry .top.2.to -width 4 -font 7x14 entry .top.3.opt -width 20 -font 7x14 pack .top.path1 -side top -fill x pack .top.path1.l .top.path1.source .top.path1.peruse -side left pack .top.path2 -side top -fill x pack .top.path2.l .top.path2.dest .top.path2.peruse -side left pack .top.1 -side top -fill x pack .top.2 -side top -fill x pack .top.3 -side top -fill x pack .top.4 -side top -fill x pack .top.1.entire -side left -anchor w pack .top.2.track -side left -anchor w pack .top.3.custom -side left -anchor w pack .top.4.ok -side left -expand 1 pack .top.4.dis -side left -expand 1 pack .top.2.lfr -side left -anchor e pack .top.2.from -side left -anchor e pack .top.2.lto -side left -anchor e pack .top.2.to -side left -anchor e pack .top.3.opt -side left -anchor e global rip set rip all } #------------------------------------------------------------------------- # CD-RW メディアを抹消 #------------------------------------------------------------------------- proc blank_cdrw {} { global blank catch {destroy .top} toplevel .top wm title .top "Blank CDRW Media" frame .top.type -border 0 -relief flat frame .top.b -border 0 -relief flat label .top.type.l -text {Blank Type} frame .top.type.r radiobutton .top.type.all -text {ディスク全体} -variable {blank} -value {all} radiobutton .top.type.session -text {セッション} -variable {blank} \ -value {session} radiobutton .top.type.track -text {トラック} -variable {blank} -value {track} radiobutton .top.type.fast -text {高速} -variable {blank} -value {fast} radiobutton .top.type.r.unreserve -text {Unreserve} -variable {blank} \ -value {unreserve} radiobutton .top.type.r.trtail -text {Track Tail} -variable {blank} \ -value {trtail} radiobutton .top.type.r.unclose -text {Unclose} -variable {blank} \ -value {unclose} button .top.b.ok -text {実行} -command { set cmd [base_cdrec] lappend cmd "blank=${blank}" dispatch [list $cmd] "Blanking CDRW: ${blank}" destroy .top } button .top.b.dis -text {キャンセル} -command { destroy .top } pack .top.type -side top pack .top.b -side top -fill x pack .top.type.l -side left pack .top.type.r -side right -fill y pack .top.type.all -side top -anchor w pack .top.type.session -side top -anchor w pack .top.type.track -side top -anchor w pack .top.type.fast -side top -anchor w pack .top.type.r.unreserve -side top -anchor w pack .top.type.r.trtail -side top -anchor w pack .top.type.r.unclose -side top -anchor w pack .top.b.ok -side left -expand 1 pack .top.b.dis -side left -expand 1 set blank session } #------------------------------------------------------------------------- # コマンド発行 #------------------------------------------------------------------------- proc dispatch {cmdList title} { set shellCommand "" set systype [exec /bin/uname -s] switch $systype { "SunOS" { set xdir "/usr/openwin/bin" } default { set xdir "/usr/X11R6/bin" } } foreach cmd $cmdList { set tmp [join $cmd "' '"] append shellCommand "'$tmp'; " } regsub -all {\'///PIPE///\'} $shellCommand "|" shellCommand append shellCommand "echo Done. Press Enter; read" puts $shellCommand exec $xdir/xterm -geometry 80x6 -title $title -e sh -c $shellCommand & } #------------------------------------------------------------------------- # #------------------------------------------------------------------------- proc base_cdrec {} { global dummy eject speed set cd [list cdrecord -v] if {$dummy} {lappend cd -dummy} if {$eject} {lappend cd -eject} set dev [.c.dev.e get] if {![check_device $dev]} { alert "選択したデバイスへの書き込み権限がありません。これはたぶん root 権限で実行する必要があります。それができない場合は、あなたに cd-writerの特権を与えるように、システム管理者に言って下さい。" return -code return } lappend cd "dev=$dev" "speed=$speed" return $cd } #------------------------------------------------------------------------- # 用語説明のヘルプ #------------------------------------------------------------------------- proc help_clarify {} { catch {destroy .help} toplevel .help wm title .help {Help!} set helpstuff { {All Files} { Ordinarily files with names containing '#' or '~' are backup files on Linux. CDR-Toaster will instruct mkisofs to skip these files in the creation of a CD. If you DON'T want to skip them, click this box. } {全ファイル} { 通例 Linux において '#' または '~' を含む名前のファ イルは、バックアップファイルです。CDR-Toaster は mkisofs に対して CD 作成時にこれらのファイルをスキッ プするように指示します。これらをスキップしたくない 場合は、このボックスをクリックして下さい。 } {Joliet support} { This stores long filenames on a CD so Windows 9x/NT machines can read them. Unlike the Joliet CDs produced on MS-Windows, you can still see the 8.3 filenames on MS-Dos and other systems that don't support Joliet. Linux kernels 2.2 and up can also read Joliet names. } {Joliet サポート} { これは CD 上にロングファイルネームを格納します。 従って Windows 9x/NT マシンで、それらを読み込むことが できます。MS-Windows 上で作成された Joliet CD と異なり Joliet をサポートしていない MS-DOS や他のシステムでも 8.3 形式のファイル名として見ることができます。 Linux カーネル 2.2 およびそれ以上では、Joliet 形式の 名前も見ることができます。 } {Rock Ridge} { This is another way to store long filenames on a CD. It works with all Un*x-like systems that also support CDs. It allows file permissions, ownership info, and symbolic links to be stored and appear as such on the CD. If you choose "Literal", the final CD will look in all respects identical to the directory hierarchy it was created from, except for some reason you can't write to it. This could be good for system backups. If you choose "Rationalized", you get a more generally useful CD. It sets the user and group of all files to root, removes SUID and SGID bits, makes all files and folders readable globally, sets all execute bits for anything that has any execute bits, and clears all write bits. } {Rock Ridge} { これは CD 上にロングファイルネームを格納するための別の 方法です。CD をサポートする全ての Un*x ライクなシステム で動作します。これは、ファイル・パーッミション、所有者 情報、格納先へのシンボリックリンクが可能であり、そのよ うに CD 上に書かれます。 "Literal" を選ぶと、最終的な CD はちょっと覗くでしょう 全ての同一に関して はディレクトリ階層と同じ 書き込みできなかった何らかの理由以外は????? これはシステムのバックアップに適しています。 "Rationalized" を選ぶと、もっと一般的に便利な CD ができ ます。これは全てのファイルのユーザとグループを root に し、SUID と SGID ビットを取り除き、全てのファイルとフォ ルダをグローバルに読み取り可能にし、実行ビットが何であれ 全ての実行ビットをセットし、全ての書き込みビットをクリア します。 } {Follow SymLinks} { Normally symbolic links are ignored, unless you use Rock Ridge, when they are copied literally. If you want the actual files and folders pointed to by the symbolic links to show up on the CD, check this box. 通常、シンボリック・リンクは、それらが文字通りにコピーさ れた時に Rock Ridge を使うのでなければ無視されます。 シンボリック・リンクが指す実際のファイルとフォルダを CD に 書きたいなら、このボックスをチェックして下さい。 } {Translation Tables} { Puts a file called "TRANS.TBL" in every directory on the CD which maps 8.3 files to their long equivalents. Very simple, very old. CD 上の各ディレクトリ内に "TRANS.TBL" と呼ばれるファイルを 置きます。これは 8.3 形式のファイル名を同等の長いファイル名 にマップします。非常にシンプルで非常に古いです。????? } {MPEG Compressed Audio} { CDR-Toaster will extract MPEG Compressed audio (mp3) if you have mpg123 and sox installed. This way you can burn an audio CD from mp3 files. The sound will not be as good quality as the original uncompressed audio, but that's the trade off that a lossy compression like MPEG makes to attain the high ratios that it does. For more information, point your web browser at these: http://www.mpeg.org/MPEG/ http://drogo.cselt.stet.it/mpeg/ } {MPEG 圧縮オーディオ} { mpg123 と sox がインストールされていれば CDR-Toaster は MPEG 圧縮オーディオ (mp3) を展開します。 この方法は、MP3 ファイルからオーディオ CD を焼くことがで きます。サウンドの音質は、オリジナルの圧縮されていないも のと比べると良くないです。しかし、これは MPEG が高い圧縮 比を達成するための不可逆圧縮との兼ね合いです。 詳しくは、WEBブラウザで以下を参照して下さい。 http://www.mpeg.org/MPEG/ http://drogo.cselt.stet.it/mpeg/ } {PCM vs. WAV} { WAV is a format composed of 44 bytes of header data, then raw PCM data. PCM means only pulse code modulation, which is to say a digitial audio format made of numbers to signify each sample. There is no attempt made to compress the signals beyond the decisions of sample rate and dynamic range. For CDR-Toaster to burn audio, you can feed it either a raw PCM file or a WAV file. WAV files are better because they contain enough information in the header to ensure that the audio format is correct. To get an audio track to burn properly, the PCM data needs to be composed of exactly the same structure as on a CD - that is 41.1 khz 16 bit stereo. Anything else and you get an unusable audio track. When using WAV files ripped from a CD, (as CDPARANOIA does) you will get files that are already correct. If you want to use a WAV file you recorded yourself, it is wise to ensure you recorded cd-quality (16 bit stereo 44.1khz) uncompressed audio. If you did otherwise, there are many format converters available which can convert to this format without any signal loss. The other issue with audio files you record yourself is that they must be a precise multiple of 1/75th of a second. This is where audio padding comes into play. If you do not have the right number of samples, the Pad Audio option can round up using absolute silence. } {Burning Bootable CDs} { When your computer boots from a CD, it treats part of the CD as a floppy drive. The emulation is at the BIOS level, so programs like the Linux Kernel operate normally but programs like LILO or SYSLINUX are fooled. All attempts to access the (primary) floppy drive are mapped to the "BOOT" extent on the CD. Step by step, the easiest way to make a bootable CD is as follows: 1. Make a real live floppy disk that boots your computer ok. There are many rescue disk packages which are good for this purpose, or you can use your operating system install disk. Make sure the floppy actually boots properly. 2. Copy this floppy disk to an image file. Under Linux you can type: dd if=/dev/fd0 of=bootimage.bin bs=18k 3. Put this file in the directory you are going to make your CD from: mv bootimage.bin /tmp/my_cdrom/ 4. Bring up CDR-Toaster. Put a check in the "El Torito Bootable CD" box, and click the "Boot Setup" button. 5. For "Boot Image Path" type "bootimage.bin" 6. For "Boot Catalog Path" type "bootcat.bin" 7. Click OK, and set the "Root of Tree" appropriately. From the example above, it would be "/tmp/my_cdrom" 8. Finish burning your CD as you would normally. 9. Set your bios to boot from CD, and things should be happy. The Boot Catalog is a place for information about the Boot Image. It is generated automatically. It need not exist beforehand. In fact, if it does exist, it will be overwritten. Both paths are interpretted relative to the root of the CD. For more information, see "man mkisofs". It should be on your system for CDR-Toaster to operate properly. } {Using ATAPI CDR(W) Devices} { ATAPI CDR(W)s are special. The Linux kernel needs to be compiled specially for them to work properly. Basically, you must TURN OFF IDE CDROM support and instead use both "SCSI emulation" and "SCSI generic support". If you have never compiled a kernel before, you are wise to read the Kernel Howto. I tend to use "make menuconfig" to configure the kernel, and these are the things I did: Under "Block devices", I set "Include IDE/ATAPI CDROM support" to "n" and I set "SCSI emulation support" to "Y". Under "SCSI support", I make sure there is "SCSI CD-ROM support" and "SCSI generic support" turned on. Since I have no true SCSI cards, I need nothing from the "SCSI low-level drivers" section. I built and installed this kernel. As a result, my CD-ROM detected as a scsi device (/dev/scd0 in my case) during bootup and I have been able to burn to /dev/sg0 as is the default in CDR-Toaster. For more information on the special needs of your CDR(W), see the documentation for "cdrecord" which is the burn program that CDR-Toaster calls out to. } } frame .help.b set m .help.b.topic.m menubutton .help.b.topic -menu $m -text {トピック} -relief raised menu $m button .help.b.ok -text {閉じる} -command {destroy .help} text .help.t -width 60 -height 18 -yscrollcommand {.help.sb set} -wrap word scrollbar .help.sb -orient v -command {.help.t yview} pack .help.b -side bottom -fill x pack .help.b.topic -side left pack .help.b.ok -side bottom pack .help.t -side left pack .help.sb -side left -fill y .help.t insert 1.0 {Clarifications: } foreach {topic body} $helpstuff { set end [.help.t index end] set line [expr $end - 1] $m add command -label $topic -command ".help.t yview $line" .help.t insert end " o $topic\n" .help.t insert end "$body\n" .help.t tag add head $line $end } .help.t tag configure head -foreground white -background blue -font 8x16 .help.t tag add top 1.0 2.0 .help.t tag config top -foreground white -background blue -font 10x20 .help.t config -state disabled } #------------------------------------------------------------------------- # 埋め込みの選択 #------------------------------------------------------------------------- proc padbox {} { catch {destroy .pad} toplevel .pad wm title .pad {埋め込みオプション} frame .pad.audio checkbutton .pad.audio.cb -text {オーディオトラックの埋め込み} -variable {apad} message .pad.audio.amesg -text {This option will pad audio track data to be a multiple of 2352 bytes. The padding is done with all zeroes which means complete silence. See also PCM vs. WAV in help. このオプションは、オーディオトラックのデータに複数の2352バイトを埋め込みます。埋め込まれるものは全てゼロのバイトで、これは完全に無音であることを意味します。ヘルプの「PCM 対 WAV」の項をご覧下さい。 } frame .pad.data checkbutton .pad.data.cb -text {データトラックの埋め込み} -variable {dpad} message .pad.data.dmesg -text {This option appends 15 sectors of zeroes to each data track. This works around a bug in very old Linux kernels. このオプションは、各データトラック毎にゼロを15セクタぶん追加します。これは非常に古い Linux カーネルのバグへの対策です。 } button .pad.ok -text {閉じる} -command {destroy .pad} pack .pad.audio -fill x pack .pad.audio.cb -side left -anchor n pack .pad.audio.amesg pack .pad.data -fill x pack .pad.data.cb -side left -anchor n pack .pad.data.dmesg pack .pad.ok } #------------------------------------------------------------------------- # フォルダ選択 #------------------------------------------------------------------------- proc peruse {} { # Just browse directories global perused set perused "" catch {destroy .peruse} toplevel .peruse # wm title .peruse {Peruse Folders} wm title .peruse {フォルダ選択} frame .peruse.dir -border 0 -relief flat frame .peruse.mod -border 0 -relief flat frame .peruse.control -border 0 -relief flat menubutton .peruse.dir.up -menu .peruse.dir.up.m -relief raised -border 2 button .peruse.dir.ok -text {<-- 決定} -command {} listbox .peruse.mod.lb -height 10 -width 20 -selectmode browse \ -yscrollcommand {.peruse.mod.sb set} scrollbar .peruse.mod.sb -orient v -command {.peruse.mod.lb yview} button .peruse.control.go -text {掘り下げる} -command {} button .peruse.control.cancel -text {キャンセル} -command {} pack .peruse.dir -side top -fill x pack .peruse.mod -side top -fill x pack .peruse.control -side top -fill x pack .peruse.dir.up -side left pack .peruse.dir.ok -side right pack .peruse.mod.lb -side left -fill y -anchor w pack .peruse.mod.sb -side left -fill y -anchor w pack .peruse.control.go -side left -expand 1 pack .peruse.control.cancel -side left -expand 1 peruse_populate [pwd] tkwait window .peruse } #------------------------------------------------------------------------- # ファイル選択 #------------------------------------------------------------------------- proc perusefile {} { # Just browse files global perusedfile set perusedfile "" catch {destroy .perusefile} toplevel .perusefile wm title .perusefile {ファイル選択} frame .perusefile.dir -border 0 -relief flat frame .perusefile.mod -border 0 -relief flat frame .perusefile.control -border 0 -relief flat menubutton .perusefile.dir.up -menu .perusefile.dir.up.m -relief raised -border 2 button .perusefile.dir.ok -text {<-- Accept} -command { } listbox .perusefile.mod.lb -height 10 -width 20 -selectmode browse -yscrollcommand {.perusefile.mod.sb set} scrollbar .perusefile.mod.sb -orient v -command {.perusefile.mod.lb yview} button .perusefile.control.go -text {Delve} -command { } button .perusefile.control.cancel -text {キャンセル} -command { } pack .perusefile.dir -side top -fill x pack .perusefile.mod -side top -fill x pack .perusefile.control -side top -fill x pack .perusefile.dir.up -side left pack .perusefile.dir.ok -side right pack .perusefile.mod.lb -side left -fill y -anchor w pack .perusefile.mod.sb -side left -fill y -anchor w pack .perusefile.control.go -side left -expand 1 pack .perusefile.control.cancel -side left -expand 1 perusefile_populate [pwd] tkwait window .perusefile } #------------------------------------------------------------------------- # #------------------------------------------------------------------------- proc peruse_populate dir { set tmp [file tail $dir] if {$tmp == ""} {set tmp /} .peruse.dir.up configure -text $tmp set m .peruse.dir.up.m catch { destroy $m } menu $m -tearoff 0 set up / foreach dcomp [file split $dir] { set up [file join $up $dcomp] $m add command -label $dcomp -command "peruse_populate \"$up\"" } .peruse.mod.lb delete 0 end set tmp [lsort [glob $dir/.* $dir/*]] foreach dcan $tmp { if [file isdirectory $dcan] { set tail [file tail $dcan] if {$tail != "." && $tail != ".."} { .peruse.mod.lb insert end $tail } } } ## Bindings .peruse.control.cancel config -command { set perused "" destroy .peruse } .peruse.dir.ok config -command [subst { set perused "$dir" destroy .peruse }] set go [subst -nocommands { if {[.peruse.mod.lb get active] != ""} { peruse_populate [file join "$dir" [.peruse.mod.lb get active]] } else bell }] bind .peruse.mod.lb $go .peruse.control.go config -command $go } #------------------------------------------------------------------------- # #------------------------------------------------------------------------- proc perusefile_populate dir { set tmp [file tail $dir] if {$tmp == ""} {set tmp /} .perusefile.dir.up configure -text $tmp set m .perusefile.dir.up.m catch { destroy $m } menu $m -tearoff 0 set up / foreach dcomp [file split $dir] { set up [file join $up $dcomp] $m add command -label $dcomp -command "perusefile_populate \"$up\"" } .perusefile.mod.lb delete 0 end if {[catch {lsort [glob $dir/.* $dir/*]} catchvar]} { set tmp "" } else { set tmp $catchvar } foreach dcan $tmp { set tail [file tail $dcan] if {$tail != "." && $tail != ".."} { .perusefile.mod.lb insert end $tail } } ## Bindings .perusefile.control.cancel config -command { set perusedfile "" destroy .perusefile } .perusefile.dir.ok config -command [subst { set perusedfile "$dir" destroy .perusefile }] set go [subst -nocommands { if {[.perusefile.mod.lb get active] != ""} { perusefile_populate [file join "$dir" [.perusefile.mod.lb get active]] } else bell }] bind .perusefile.mod.lb $go .perusefile.control.go config -command $go } #------------------------------------------------------------------------- # ブートの設定 #------------------------------------------------------------------------- proc boot_setup {} { global bootimg bootcat catch {destroy .boot} toplevel .boot wm title .boot {ブート可能 CD の設定} frame .boot.img -border 0 -relief flat frame .boot.cat -border 0 -relief flat frame .boot.cmd -border 0 -relief flat label .boot.img.l -text {ブートイメージのパス} label .boot.cat.l -text {ブートカタログのパス} entry .boot.img.e -width 30 -font 7x14 entry .boot.cat.e -width 30 -font 7x14 # Got TK8? You get a pretty button. if {[info tclversion] >= 8.0} { button .boot.img.b -text {選択} -command open_bootfile button .boot.cat.c -text {選択} -command open_catfile } button .boot.cmd.ok -text {OK} -command { set bootimg [.boot.img.e get] set bootcat [.boot.cat.e get] destroy .boot } button .boot.cmd.cancel -text {キャンセル} -command { destroy .boot } button .boot.cmd.revert -text {やりなおし} -command { .boot.img.e delete 0 end .boot.cat.e delete 0 end .boot.img.e insert 0 $bootimg .boot.cat.e insert 0 $bootcat } # Populate Data Fields .boot.img.e insert 0 $bootimg .boot.cat.e insert 0 $bootcat pack .boot.img -side top -fill x pack .boot.cat -side top -fill x pack .boot.cmd -side top -fill x pack .boot.img.l -side left pack .boot.cat.l -side left pack .boot.img.e -side right pack .boot.cat.e -side right pack .boot.cmd.ok -side left -expand 1 pack .boot.cmd.cancel -side left -expand 1 pack .boot.cmd.revert -side left -expand 1 # Got TK8? You get a pretty button. if {[info tclversion] >= 8.0} { pack .boot.img.b -side right pack .boot.cat.c -side right } # frame .m.img # label .m.img.l -text "Boot Image Path" # entry .m.img.e # frame .m.cat # label .m.cat.l -text "Boot Catalog Path" # entry .m.cat.e } #------------------------------------------------------------------------- # MP3 書込み情報を得る #------------------------------------------------------------------------- proc get_mp3_burn_info {} { # Returns either the empty list, indicating a cancelation, # or the temp directory. global perused set warn {\ You have chosen to burn an MPEG compressed file as an audio track. This will not be the same quality as the original from which it was made. However, the burn can proceed if given a space to uncompress the audio files. Do you wish to proceed?} set go [sure $warn] if {!$go} { return {} } set df [exec -keepnewline df] catch {destroy .df} toplevel .df wm title .df {Free Disk Space} text .df.t -width 80 -height 10 -setgrid 1 -yscrollcommand {.df.sb set} scrollbar .df.sb -orient v -command {.df.t yview} .df.t insert end "Please browse to a directory with sufficient free space.\n\n" .df.t insert end $df .df.t config -state disabled pack .df.sb -side right -fill y pack .df.t -side left peruse destroy .df alert "Be aware that the MP3 conversion process typically takes some time." return $perused } #------------------------------------------------------------------------- # データトラックのカスタム・レイアウトの設定 #------------------------------------------------------------------------- proc custom_layout {} { global custom catch {destroy .custom} toplevel .custom wm title .custom {カスタム CD レイアウト} frame .custom.dirs -border 0 -relief flat frame .custom.table -border 0 -relief flat frame .custom.cmds -border 0 -relief flat frame .custom.help -border 0 -relief flat label .custom.dirs.a -text {作成するコンテンツ:} label .custom.dirs.b -text {Show up on CD within:} foreach x {0 1 2 3 4 5 6 7 8 9} { frame .custom.table.$x -border 0 -relief flat button .custom.table.$x.peruse -text {選択} -command "custom_peruse $x" entry .custom.table.$x.from -width 25 -font 7x14 entry .custom.table.$x.to -width 25 -font 7x14 button .custom.table.$x.clear -text {クリア} -command [subst { .custom.table.$x.from delete 0 end .custom.table.$x.to delete 0 end }] pack .custom.table.$x -side top -fill x pack .custom.table.$x.peruse -side left -anchor w pack .custom.table.$x.from -side left -anchor w pack .custom.table.$x.clear -side right -anchor e pack .custom.table.$x.to -side right -anchor e } scrollbar .custom.help.sb -orient v -command {} -command {.custom.help.t yview} text .custom.help.t -width 70 -height 10 -setgrid 1 \ -yscrollcommand {.custom.help.sb set} button .custom.cmds.ok -text {OK} -command { set from {} set to {} foreach s [pack slaves .custom.table] { lappend from [$s.from get] lappend to [$s.to get] } set custom(from) $from set custom(to) $to set custom(use) 1 destroy .custom } button .custom.cmds.revert -text {やりなおし} -command { foreach s [pack slaves .custom.table] from $custom(from) to $custom(to) { $s.from delete 0 end $s.to delete 0 end $s.from insert 0 $from $s.to insert 0 $to } } button .custom.cmds.cancel -text {キャンセル} -command { destroy .custom } pack .custom.dirs -side top -fill x pack .custom.table -side top -fill x pack .custom.cmds -side top -fill x pack .custom.help -side top -fill both -expand 1 pack .custom.dirs.a -side left -anchor w pack .custom.dirs.b -side right -anchor e pack .custom.help.sb -side right -fill y -anchor e pack .custom.help.t -side right -fill both -anchor w pack .custom.cmds.ok -side left -expand 1 pack .custom.cmds.revert -side left -expand 1 pack .custom.cmds.cancel -side left -expand 1 .custom.cmds.revert invoke .custom.help.t insert 1.0 { カスタム CD レイアウトのヘルプ This was always the biggest pain for me. I want stuff from the hard drive from arbitrary places to show up on the final CD in (other) arbitrary places. これは私にとって常に最大の苦痛です。私は任意の場所の最後の CD 上に 現れるための任意の場所からハードディスクからのものが欲しいです。??? I've tried to make this fairly general. Name what you want on the left, and where to put it on the right. The one thing to remember is that if you put a directory on the left, you have to give it a name on the right unless you want a whole bunch of files sprayed all over the root of the CD. 私はこれをかなり一般的にするように試みました。左側にあなたが望む名前、 右側はそれを置くところです。一つ覚えておくべきことは、左側にディレク トリを置いた場合、CD のルートの全てにわたって吹きかけられたファイルの 全てのかたまりを望むのでない限り、右側にその名前を与えなければならない ことです。?????????????????????? The names you give on the right do not have to exist anywhere except your imagination. If they don't exist within other parts of what you burn, the directories will be automatically created to exist on the CD. Directories created in this way will be owned by root.root and have permissions 555 (read/exec for all). 右側に与えた名前は、あなたの想像以外に、どこにも存在してはいけません。 あなたが焼く他の部分に、それらが存在しなければ CD上に現れるための ディレクトリが自動的に作成されます。 この方法で作成されるディレクトリは root.root によって所有され、パーミ ッションは 555 (だれでも読込み可能、実行可能)となります。 I'm not yet sure how these custom layouts interact with bootable CD creation. I think that you specify the boot paths relative to the final CD image. I know it works that way in the simple case. 私は、これらのカスタムレイアウトがブート可能 CD の作成とどのような 相互作用があるのか、まだ確信がありません。 私はあなたが最終的な CD イメージに関するブートパスを指定すると思います。 簡単なケースでは、その方法で動作することを知っています。 } .custom.help.t tag add cool 1.0 2.0 .custom.help.t tag config cool -font 10x20 .custom.help.t tag config cool -background blue .custom.help.t tag config cool -foreground white .custom.help.t config -state disabled } #------------------------------------------------------------------------- # カスタム・レイアウトの選択 #------------------------------------------------------------------------- proc custom_peruse x { global perused peruse if {$perused != ""} { .custom.table.$x.from delete 0 end .custom.table.$x.from insert 0 $perused }} #------------------------------------------------------------------------- # mkisofs コマンド作成 #------------------------------------------------------------------------- proc make_mkisofs_cmd {} { global all joliet follow trans ds rock global boot bootimg bootcat custom set vol [.m.volid.e get] set root [.m.root.e get] # Presumably this is not necessary if there is a custom layout. if {![file isdirectory $root]} { alert "オンザフライでのイメージ作成では、ツリーのルートは、ディレクトリにしなければなりません。" return } set mk mkisofs if {$all} {lappend mk -all-files} if {$joliet} {lappend mk -joliet} switch -exact $rock { none {} rat {lappend mk -r} lit {lappend mk -R} } if {$follow} {lappend mk -follow-links} if {$trans} {lappend mk -translation-table} if {$boot} { if {($bootimg == "") || ($bootcat == "")} { alert "You selected 'Bootable CD' but either the boot image or boot catalog entries are blank. This will not work." return } if {![file exists [file join $root $bootimg]]} { alert "[file join $root $bootimg] is not there. You can't make a bootable CD without a bootimage." return } if {[file exists [file join $root $bootcat]]} { if {![sure "[file join $root $bootcat] will be overwritten if you continue. Is this ok?"]} {return} } lappend mk -b $bootimg -c $bootcat } else { if {$bootimg != ""} { set ok [sure "You have stuff in the bootimage entry, but have not chosen the 'Bootable CD' option. Do you want a standard non-bootable cd?"] if {!$ok} {return} } } if {$vol != ""} {lappend mk -volid $vol} ## Here we need to (maybe) process the custom layout entries. lappend mk $root if {$custom(use)} { foreach dir $custom(from) graftpoint $custom(to) { if {$dir == ""} continue set isdir [file isdirectory $dir] if {$isdir} {set dir "$dir/"} lappend mk "$graftpoint/=$dir" } } ## Last gasp. # use a illegal filename as symbol for the pipe so it can be recognized later lappend mk "///PIPE///" return $mk } #------------------------------------------------------------------------- # ブートファイルを開く #------------------------------------------------------------------------- proc open_bootfile {} { set types { {{ディスクイメージ} {.img} } {{全てのファイル} * } } set boot_img [tk_getOpenFile -filetypes $types -initialdir ~/ \ -title {イメージ選択}] .boot.img.e delete 0 250 .boot.img.e insert 0 $boot_img } #------------------------------------------------------------------------- # カタログファイルを開く #------------------------------------------------------------------------- proc open_catfile {} { set types { {{全てのファイル} * } } set boot_cat [tk_getOpenFile -filetypes $types -initialdir ~/ \ -title {ファイル選択}] .boot.cat.e delete 0 250 .boot.cat.e insert 0 $boot_cat } #------------------------------------------------------------------------- # デバイスチェック #------------------------------------------------------------------------- proc check_device dev { if {[file writable $dev]} { return 1 } # Now gotta test for numeric device specification set len [string length $dev] set field {0123456789,} for {set i 0} {$i < $len} {incr i} { set try [string index $dev $i] if {![string match *$try* $field]} {return 0} } return 1 } #------------------------------------------------------------------------- # この CDR-Toaster のバージョンを返す。 # Just return the version of this CDR-Toaster copy. # Keeps everything in one place. #------------------------------------------------------------------------- proc version {} { return "1.12" } #------------------------------------------------------------------------- # CD-ROM デバイス検出 # Try some likely prospects: #------------------------------------------------------------------------- proc detect_cdrom_device {} { set prospects [list "/dev/cdrom" "/dev/cdroms/cdrom0"] foreach try $prospects { if {[file exists $try] && ! [file isdirectory $try]} { return $try } } # Give up and hope for user input. return "/dev/" } #------------------------------------------------------------------------- # イメージ選択 #------------------------------------------------------------------------- proc my_image {} { ## TK8.0+ Dialog for file selection set types { {{ISO9660 イメージ} {.iso} } {{XCD-Roast イメージ} {.raw} } {{全てのファイル} * } } set image [tk_getOpenFile -filetypes $types -defaultextension *.raw \ -initialdir /iso -title {イメージ選択}] .ds.tname delete 0 250 .ds.tname insert 0 $image } #------------------------------------------------------------------------- # ブロックデバイスの選択 #------------------------------------------------------------------------- proc peruse_block args { # This procedure should use the "peruse" strategy to let # the user select a block-special file. # Also, I'm going to re-write the layout so it looks better. # global perusedfile set perusedfile "" set w ".perusefile" catch {destroy $w} toplevel $w #wm title $w {Peruse Block Devices} wm title $w {ブロックデバイスの選択} frame $w.up frame $w.dir frame $w.file frame $w.ctl menubutton $w.up.mb -menu $w.up.mb.m -relief raised -border 2 listbox $w.dir.lb -yscrollcommand [list $w.dir.sb set] listbox $w.file.lb -yscrollcommand [list $w.file.sb set] scrollbar $w.dir.sb -orient v -command [list $w.dir.lb yview] scrollbar $w.file.sb -orient v -command [list $w.file.lb yview] button $w.ctl.accept -text {承諾} -command {} button $w.ctl.cancel -text {キャンセル} -command {} pack $w.up -side top -fill x pack $w.dir $w.file $w.ctl -side left -fill y pack $w.dir.sb $w.file.sb -side right -fill y pack $w.dir.lb $w.file.lb $w.up.mb -side left pack $w.ctl.accept $w.ctl.cancel -side top peruse_block_populate "/dev" tkwait window $w return $perusedfile } #------------------------------------------------------------------------- # #------------------------------------------------------------------------- proc peruse_block_populate dir { # Here we fill in the info for the peruse window and # configure up the bindings. set w ".perusefile" # Configure the menu button set tmp [file tail $dir] if {$tmp == ""} {set tmp /} $w.up.mb configure -text $tmp # Replace the menu set m $w.up.mb.m catch {destroy $m} menu $m -tearoff 0 set up / foreach dcomp [file split $dir] { set up [file join $up $dcomp] $m add command -label $dcomp -command "peruse_block_populate \"$up\"" } ### Populate the list boxes: # empty them $w.dir.lb delete 0 end $w.file.lb delete 0 end # enumerate the interesting files set file_list [lsort [glob -nocomplain -- $dir/.* $dir/*]] # place them in the correct box foreach file $file_list { set tail [file tail $file] if {$tail != "." && $tail != ".."} { file stat $file stat set type $stat(type) if {$type == "directory"} { $w.dir.lb insert end [file tail $file] } elseif {$type == "blockSpecial"} { $w.file.lb insert end [file tail $file] } } } ## Bindings $w.ctl.cancel config -command { set perusedfile "" destroy .perusefile } $w.ctl.accept config -command [list peruse_block_accept $dir] set go [subst -nocommands { if {[$w.dir.lb get active] != ""} { peruse_block_populate [file join "$dir" [$w.dir.lb get active]] } else bell }] bind $w.dir.lb $go # .perusefile.control.go config -command $go } #------------------------------------------------------------------------- # #------------------------------------------------------------------------- proc peruse_block_accept dir { # If appropriate, pluck the currently selected file name from the file # list and set it into the return global. global perusedfile set w ".perusefile" set chosen [$w.file.lb get active] if {$chosen != ""} { set perusedfile [file join $dir $chosen] destroy $w } } #------------------------------------------------------------------------- # メイン処理 #------------------------------------------------------------------------- # This is CDR-Toaster set device "/dev/sg0" set speed 2 set joliet 1 set rock none set dummy 1 set eject 1 set ds mkisofs set apad 1 set dpad 0 set bootimg "" set bootcat "" set custom(from) {} set custom(to) {} set custom(use) 0 interface ;# メイン画面を表示する .b.quit configure -command {destroy .} .b.burn configure -command {toast} #==== End of CDR-Toaster =================================================