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 .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
pack .m.root.l -side left
pack .m.root.e .m.root.p -side left
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 -side left
frame .spacer -height 10
pack .spacer -side top
.c.dev.e insert 0 "/dev/sg0"
}
proc toast {} {
global all joliet follow trans ds rock boot apad dpad bootimg bootcat
if {$ds == "none"} {
set source ""
}
if {$ds == "premade"} {
set source [.ds.tname get]
if {![file isfile $source]} {
alert "Premade data track must be a regular file."
return
}
}
if {$ds == "mkisofs"} {
set source -
set vol [.m.volid.e get]
set root [.m.root.e get]
if {![file isdirectory $root]} {
alert "For on-the-fly ISO image creation, the root of tree must be a directory."
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}
lappend mk $root "|"
}
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}.raw"]
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] }
if {[sure "About to run command:\n\n$cd\n\nAre you sure?"]} {
alert "You don't have write permission to the device you selected. You should probably be running this as root. If that is not an option, get the system administrator to give you write priveleges for the cd-writer."
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.
}
frame .pad.data
checkbutton .pad.data.cb -text {Pad Data Track} -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.}
peruse_populate [file join "$dir" [.peruse.mod.lb get active]]
} else bell
}]
bind .peruse.mod.lb <Double-1> $go
.peruse.control.go config -command $go
}
proc boot_setup {} {
global bootimg bootcat
catch {destroy .boot}
toplevel .boot
wm title .boot {Bootable CD Setup}
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 {Boot Image Path}
label .boot.cat.l -text {Boot Catalog Path}
entry .boot.img.e -width 20 -font 7x14
entry .boot.cat.e -width 20 -font 7x14
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 {Cancel} -command {
destroy .boot
}
button .boot.cmd.revert -text {Revert} -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
# 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
}
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.