Commit d7da0f68 authored by Jean-Louis Thirot's avatar Jean-Louis Thirot Committed by Alexandre Julliard

Added graphical configuration tool wineconf.tcl.

parent 62de4b98
set AlternateFstab "No /etc/fstab on your system, please, give an alternate filename"
set IsCDwrite "is a cdrom.\n\n Please, let me know if you want to write CDs on this device."
set RootDrives1 "I need to know which directories from the root (that is "
set RootDrives2 "on your system) you want to use under wine. Any folder wher you wish to put Applications or store files must show up there. Choose in the left list below. Selected folders will appear on the right list."
set WhereTmp "Could not find /tmp, enter the folder to use for temporary files"
proc TkW:autoconf {outfile} {
# This files scans the fstab, then creates a wine.conf file
# parsed to wineconf for further editings....
# MS DOS drives are sorted following the rules explained in tools/wineconf
global PATH
global TMPLetter WINLetter SYSLetter
global OUTF
set OUTF [open $outfile w]
TkW:InitNewConfig
set err [TkW:readFStab]
TkW:SortDosDrives
TkW:addRootDrives
set TMP [TkW:SearchTmp]
TkW:ShowDrives
set Windows [TkW:FindWindows]
set System "$Windows/system"
set Windows [TkW:Unix2Dos $Windows]
set System [TkW:Unix2Dos $System]
TkW:MiscEndConf $TMP
puts $OUTF "\[Wine\]\nwindows=$Windows"
puts $OUTF "system=$System"
puts $OUTF "Temp=[TkW:Unix2Dos $TMP]"
puts $OUTF "Path= $Windows\;$System\;$PATH"
#Quick and dirty... I'm tired now!
#puts $OUTF "SymbolTableFile=[exec find / -name wine.sym -print]"
puts $OUTF "printer=on"
puts $OUTF ""
puts $OUTF "\[DllDefaults\]"
puts $OUTF "\;EXTRA_LD_LIBRARY_PATH=\$\{HOME\}/wine/cvs/lib"
puts $OUTF ""
puts $OUTF "\[DllPairs\]"
puts $OUTF "kernel = kernel32"
puts $OUTF "gdi = gdi32"
puts $OUTF "user = user32"
puts $OUTF "commdlg = comdlg32"
puts $OUTF "commctrl= comctl32"
puts $OUTF "ver = version"
puts $OUTF "shell = shell32"
puts $OUTF "lzexpand= lz32"
puts $OUTF "mmsystem= winmm"
puts $OUTF "msvideo = msvfw32"
puts $OUTF "winsock = wsock32"
puts $OUTF ""
puts $OUTF "\[DllOverrides\]"
puts $OUTF "kernel32, gdi32, user32 = builtin"
puts $OUTF "kernel, gdi, user = builtin"
puts $OUTF "toolhelp = builtin"
puts $OUTF "comdlg32, commdlg = elfdll, builtin, native"
puts $OUTF "version, ver = elfdll, builtin, native"
puts $OUTF "shell32, shell = builtin, native"
puts $OUTF "lz32, lzexpand = builtin, native"
puts $OUTF "commctrl, comctl32 = builtin, native"
puts $OUTF "sock32, winsock = builtin"
puts $OUTF "advapi32, crtdll, ntdll = builtin, native"
puts $OUTF "mpr, winspool = builtin, native"
puts $OUTF "ddraw, dinput, dsound = builtin, native"
puts $OUTF "winmm, mmsystem = builtin"
puts $OUTF "msvideo, msvfw32 = builtin, native"
puts $OUTF "w32skrnl = builtin"
puts $OUTF "wnaspi32, wow32 = builtin"
puts $OUTF "system, display, wprocs = builtin"
puts $OUTF "wineps = builtin"
puts $OUTF ""
puts $OUTF "\[options\]"
puts $OUTF "AllocSystemColors=100"
puts $OUTF ""
puts $OUTF "\[fonts\]"
puts $OUTF "Resolution = 96 "
puts $OUTF "Default = -adobe-times-"
puts $OUTF ""
puts $OUTF "\[serialports\]"
puts $OUTF "Com1=/dev/ttyS0"
puts $OUTF "Com2=/dev/ttyS1"
puts $OUTF "Com3=/dev/modem,38400"
puts $OUTF "Com4=/dev/modem"
puts $OUTF ""
puts $OUTF "\[parallelports\]"
puts $OUTF "Lpt1=/dev/lp0"
puts $OUTF ""
puts $OUTF "\[spooler\]"
puts $OUTF "LPT1:=|lpr"
puts $OUTF "LPT2:=|gs -sDEVICE=bj200 -sOutputFile=/tmp/fred -q -"
puts $OUTF "LPT3:=/dev/lp3"
puts $OUTF ""
puts $OUTF "\[ports\]"
puts $OUTF "\;read=0x779,0x379,0x280-0x2a0"
puts $OUTF "\;write=0x779,0x379,0x280-0x2a0"
puts $OUTF ""
puts $OUTF "\[spy\]"
puts $OUTF "Exclude=WM_SIZE"
puts $OUTF ";WM_TIMER"
puts $OUTF ""
puts $OUTF "\[Tweak.Layout\]"
puts $OUTF ";WineLook=xxx (supported styles are \'Win31\'(default),"
puts $OUTF ";\'Win95\', \'Win98\')"
puts $OUTF "WineLook=Win31"
puts $OUTF ""
puts $OUTF "\[programs\]"
puts $OUTF "Default=]"
puts $OUTF "Startup="
close $OUTF
}
proc TkW:readFStab {} {
global AlternateFstab OK CANCEL
if {![file exist /etc/fstab]} {
TkW:GetFileName $AlternateFstab $OK $CANCEL File
TkW:FStabError 1
return 1
} else {
set FSTAB "/etc/fstab"
}
if {![file readable $FSTAB]} {TkW:FStabError 2;return 1}
set FStab [open /etc/fstab]
while {![eof $FStab]} {
gets $FStab line
set line [string trim $line]
if {[string range $line 0 0] != "#" && $line != ""} {
#we have an entry
switch [lindex $line 2] {
swap {}
proc {}
minix {TkW:addUnixDrive $line}
ext2 {TkW:addUnixDrive $line}
xiafs {TkW:addUnixDrive $line}
vfat {TkW:addDosDrive $line}
msdos {TkW:addDosDrive msdos}
hpfs {TkW:addDosDrive $line}
iso9660 {TkW:addCdRomDrive $line}
nfs {TkW:addNetDrive $line}
auto {TkW:addAutoDrive $line}
default {TkW:unknownDeviceType $line}
}
}
}
}
proc TkW:addRootDrives {} {
global RootDrives1 RootDrives2 OK CANCEL WAIT lineroot ADD REMOVE
global NunixDrives UnixPath UnixDevice UnixLabel UnixType UnixSerial UnixFS
global exclude All
set drivelist ""
set drivelist "$drivelist [glob -nocomplain /*]"
set List ""
set excludes "$exclude /boot /lost+found /lib /etc /var /sbin /initrd\
/cdrom /floppy /include /man /dev /proc /bin /mnt /tmp"
set n 0
foreach i $drivelist {
if {[file isdir $i]} {
set skip 0
foreach k $excludes {
if {$k == $i} {
set skip 1
}
}
if {$skip == 0} {set List "$List$i "}
}
}
set List [lsort $List]
set n 0
foreach i $List {
set All($n) $i;set n [expr $n + 1]
}
set dev [lindex $lineroot 0]
toplevel .rootDr -background #ffffff
wm title .rootDr "Wine Autoconfigurator"
label .rootDr.banner -backgr #0000ff -foregr #ffffff \
-text "$RootDrives1$dev $RootDrives2" \
-wraplength 300
pack .rootDr.banner -fill x
frame .rootDr.lists -backgr #ffffff
pack .rootDr.lists -padx 10 -pady 10
listbox .rootDr.lists.left -width 20 -height 10
pack .rootDr.lists.left -padx 10 -pady 0 -side left
frame .rootDr.lists.buttons -backgr #ffffff
pack .rootDr.lists.buttons -padx 10 -pady 0 -side left
button .rootDr.lists.buttons.add -text "$ADD >>" -width 8\
-command {TkW:AddRootDrInList [.rootDr.lists.left cursel]}
pack .rootDr.lists.buttons.add -padx 10 -pady 0 -side top
button .rootDr.lists.buttons.space -text "" -backgr #ffffff \
-border 0 -highlightb #ffffff -relief flat -width 8 -state disabled
pack .rootDr.lists.buttons.space -padx 10 -pady 0 -side top
button .rootDr.lists.buttons.rem -text "<< $REMOVE" -width 8\
-command {TkW:RemRootDrInList [.rootDr.lists.right cursel]}
pack .rootDr.lists.buttons.rem -padx 10 -pady 0 -side top
listbox .rootDr.lists.right -width 20 -height 10
pack .rootDr.lists.right -padx 10 -pady 0
frame .rootDr.cmd -background #ffffff
pack .rootDr.cmd -side bottom -anchor c -pady 5
button .rootDr.cmd.ok -text OK -width 8 \
-command {destroy .rootDr;set WAIT 0}
pack .rootDr.cmd.ok -side left
foreach i $List {
.rootDr.lists.left insert end $i
}
global ToAddList;set ToAddList ""
bind .rootDr.lists.left <Double-ButtonPress-1> {
TkW:AddRootDrInList [.rootDr.lists.left nearest %y]}
bind .rootDr.lists.right <Double-ButtonPress-1> {
TkW:RemRootDrInList [.rootDr.lists.right nearest %y]}
set WAIT wait
while {$WAIT == "wait" } {update}
foreach i $ToAddList {
set NunixDrives [expr $NunixDrives + 1]
set UnixPath($NunixDrives) $i
set exclude "$exclude$UnixPath($NunixDrives) "
set UnixLabel($NunixDrives) $i
set UnixType($NunixDrives) hd
set UnixFS($NunixDrives) win95
}
}
proc TkW:AddRootDrInList {N} {
global All ToAddList Nadd Add
if {![info exists All($N)]} {return}
foreach i $ToAddList {
if {$i == $All($N)} {return}
}
set ToAddList [lsort "$ToAddList $All($N)"]
.rootDr.lists.right delete 0 end
set Nadd 0
foreach i $ToAddList {
.rootDr.lists.right insert end $i
set Add($Nadd) $i
set Nadd [expr $Nadd + 1]
}
}
proc TkW:RemRootDrInList {N} {
global All ToAddList Nadd Add
if {![info exists Add($N)]} {return}
set NewList ""
foreach i $ToAddList {
if {$i != $Add($N)} {set NewList "$NewList$i "}
}
set ToAddList $NewList
set Nadd 0
.rootDr.lists.right delete 0 end
foreach i $ToAddList {
.rootDr.lists.right insert end $i
set Add($Nadd) $i
set Nadd [expr $Nadd + 1]
}
}
proc TkW:addUnixDrive {line} {
global lineroot
#pre-processing for the case of the root:
if {![file exists [lindex $line 1]]} {return}
if {[lindex $line 1] != "/"} { TkW:addUnixDriveOK $line} {set lineroot $line}
}
proc TkW:addUnixDriveOK {line} {
# for now, I'll consider any unix file as ext2...
# may be this should improve a bit!
global NunixDrives UnixPath UnixDevice UnixLabel UnixType UnixSerial UnixFS
global TMPDRIVE HOMEDRIVE exclude
set NunixDrives [expr $NunixDrives +1]
set UnixDevice($NunixDrives) [lindex $line 0]
set UnixType($NunixDrives) "hd"
set UnixPath($NunixDrives) [lindex $line 1]
set exclude "$exclude$UnixPath($NunixDrives) "
set UnixLabel($NunixDrives) "UNIX $NunixDrives"
if {[string first "/tmp" $UnixPath($NunixDrives)] > 0 && $TMPDRIVE == 0} {
set UnixLabel($NunixDrives) "TEMP"
}
if {[string first "/home" $UnixDevice($NunixDrives)] > 0 && $HOMEDRIVE == 0} {
set UnixLabel($NunixDrives) "HOME"
}
set UnixDevice($NunixDrives) ""
set UnixSerial($NunixDrives) ""
set UnixFS($NunixDrives) "win95"
set UnixType($NunixDrives) "hd"
}
proc TkW:addDosDrive {line} {
# for now, I'll consider any dos file as ext2...
# may be this should improve a bit!
global NdosDrives DosPath DosDevice DosLabel DosType DosSerial DosFS
global TMPDRIVE HOMEDRIVE exclude
if {![file exists [lindex $line 1]]} {return}
if { [string first "/dev/fd" [lindex $line 0]] == 0 } {
TkW:addFloppy $line
return
}
set NdosDrives [expr $NdosDrives +1]
set DosDevice($NdosDrives) [lindex $line 0]
set DosPath($NdosDrives) [lindex $line 1]
set exclude "$exclude$DosPath($NdosDrives) "
set DosLabel($NdosDrives) ""
set DosType($NdosDrives) "win95"
if {[lindex $line 2] == "msods"} {
set DosFS($NdosDrives)
} else {
set DosFS($NdosDrives) "win95"
}
set DosSerial($NdosDrives) ""
}
proc TkW:unknownDeviceType {line} {
TkW:message "Error\n\
[lindex $line 0] (mounted on [lindex $line 1]) : Unknown device type. Please, mail thirot@univ-brest.fr for me to add this filesystem to the list of detected FS.\n\
\n Thank you.\
\n Jean-Louis Thirot"
global WAIT
set WAIT wait
while {$WAIT == "wait"} {update}
}
proc TkW:InitNewConfig {} {
global NunixDrives UnixPath UnixDevice UnixLabel UnixType UnixSerial UnixFS
global NdosDrives DosPath DosDevice DosLabel DosType DosSerial DosFS
global Ncdroms CDPath CDDevice CDLabel CDType CDSerial CDFS
global Nfloppys FLOPPYPath FLOPPYDevice FLOPPYLabel FLOPPYType FLOPPYSerial FLOPPYFS
global NnetDrives
global TMPDRIVE HOMEDRIVE
global exclude; set exclude ""
set TMPDRIVE 0
set HOMEDRIVE 0
set NunixDrives 0
set NdosDrives 0
set Ncdroms 0
set Nfloppys 0
set NnetDrives 0
}
proc TkW:ShowDrives {} {
global NunixDrives UnixPath UnixDevice UnixLabel UnixType UnixSerial UnixFS
global NdosDrives DosPath DosDevice DosLabel DosType DosSerial DosFS
global Ncdroms CDPath CDDevice CDLabel CDType CDSerial CDFS
global NnetDrives NetPath NetLabel
global Nfloppys FLOPPYPath
global DriveRank DRIVEUNIXPATH DRIVEDOSPATH NDRIVES
global OUTF
set NDRIVES 0
set letters {let: C D E F G H I J K L M N O P Q R S T U V W X Y Z}
set lettersF {let: A B C D E F G H I J K L M N O P Q R S T U V W X Y Z}
for {set i 1} {$i <= $NdosDrives} {set i [expr $i + 1]} {
set NDRIVES [expr $NDRIVES + 1]
set rank $DriveRank($i)
puts $OUTF "\[Drive [lindex $letters $i]\]"
set Letter($NDRIVES) [lindex $letters $i]
set DRIVEUNIXPATH($NDRIVES) $DosPath($rank)
set DRIVEDOSPATH($NDRIVES) "[lindex $letters $i]:\\"
puts $OUTF "Path=$DosPath($rank)"
puts $OUTF "Type=hd"
puts $OUTF "Label=MS-DOS $rank"
puts $OUTF "Filesystem=$DosFS($rank)"
puts $OUTF ""
}
for {set i 1} {$i <= $Nfloppys} {set i [expr $i + 1]} {
if {$i > 2} {
set NDRIVES [expr $NDRIVES + 1]
set NLet $NDRIVES
set DRIVEDOSPATH($NDRIVES) "[lindex $lettersF $NLet]:\\"
set DRIVEUNIXPATH($NDRIVES) $FLOPPYPath($i)
} else {
set NLet $i
#set DRIVEDOSPATH($i) "[lindex $lettersF $NLet]:\\"
#set DRIVEUNIXPATH($i) $FLOPPYPath($i)
}
puts $OUTF "\[Drive [lindex $lettersF $NLet]\]"
puts $OUTF "Path=$FLOPPYPath($i)"
puts $OUTF "Type=floppy"
puts $OUTF "Label=Floppy $i"
puts $OUTF "Serial=87654321"
puts $OUTF ""
}
for {set i 1} {$i <= $Ncdroms} {set i [expr $i + 1]} {
set NDRIVES [expr $NDRIVES + 1]
puts $OUTF "\[Drive [lindex $letters $NDRIVES]\]"
puts $OUTF "Path=$CDPath($i)"
set DRIVEDOSPATH($NDRIVES) "[lindex $letters $NDRIVES]:\\"
set DRIVEUNIXPATH($NDRIVES) $CDPath($i)
puts $OUTF "Type=cdrom"
puts $OUTF "Label=CDROM $i"
puts $OUTF "Filesystem=$UnixFS($i)"
if {$CDDevice($i) != ""} {puts $OUTF "Device=$CDDevice($i)"}
puts $OUTF ""
}
for {set i 1} {$i <= $NunixDrives} {set i [expr $i + 1]} {
set NDRIVES [expr $NDRIVES + 1]
puts $OUTF "\[Drive [lindex $letters $NDRIVES]\]"
set DRIVEDOSPATH($NDRIVES) "[lindex $letters $NDRIVES]:\\"
set DRIVEUNIXPATH($NDRIVES) $UnixPath($i)
puts $OUTF "Path=$UnixPath($i)"
puts $OUTF "Type=hd"
puts $OUTF "Label=$UnixLabel($i)"
puts $OUTF "Filesystem=$UnixFS($i)"
puts $OUTF ""
}
for {set i 1} {$i <= $NnetDrives} {set i [expr $i + 1]} {
set NDRIVES [expr $NDRIVES + 1]
puts $OUTF "\[Drive [lindex $letters $NDRIVES]\]"
set DRIVEDOSPATH($NDRIVES) "[lindex $letters $NDRIVES]:\\"
set DRIVEUNIXPATH($NDRIVES) $NetPath($i)
puts $OUTF "Path=$NetPath($i)"
puts $OUTF "Type=network"
puts $OUTF "Label=$NetLabel($i)"
puts $OUTF "Filesystem=win95"
puts $OUTF ""
}
}
proc TkW:MiscEndConf {temp} {
#Create an acceptable PATH variable, and
# gets the TMP WINDOWS and SYSTEM drive letters:
global PATH NDRIVES Letter DRIVEPATH
global TMPLetter
set PATH ""
for {set i 1} {$i<= $NDRIVES} {set i [expr $i + 1]} {
if {[info exists Letter($i)]} {
if {[info exists DRIVEPATH($i)]} {
if {$DRIVEPATH($i) == $temp} {
set TMPLetter $Letter($i)
}
set PATH "$PATH\;$Letter($i):\\"
}
}
}
return
}
proc TkW:Unix2Dos {unixpath} {
global NDRIVES DRIVEDOSPATH DRIVEUNIXPATH
set dospath ""
# First, search the corresponding drive:
for {set i 1} {$i<=$NDRIVES} {set i [expr $i + 1]} {
set n [string first $DRIVEUNIXPATH($i) $unixpath]
if {$n == 0} {
set dospath $DRIVEDOSPATH($i)
set N [expr [string length $DRIVEUNIXPATH($i)] + 1]
break
}
}
# Now, add the remaining part of the path
for {set i $N} {$i <= [string length $unixpath]} {set i [expr $i + 1]} {
set newchar [string range $unixpath $i $i]
if {$newchar != "/"} {
set dospath "$dospath$newchar"
} else {
set dospath "$dospath\\"
}
}
return $dospath
}
proc TkW:addCdRomDrive {line} {
global Ncdroms CDPath CDDevice CDLabel CDType CDSerial CDFS
global IsCDwrite YES NO WAIT
if {![file exists [lindex $line 1]]} {return}
set Ncdroms [expr $Ncdroms + 1]
set CDFS($Ncdroms) "iso9660"
set CDPath($Ncdroms) [lindex $line 1]
set dev [lindex $line 0]
TkW:message2 "Device $dev $IsCDwrite" $YES $NO
set WAIT wait
while {$WAIT == "wait"} {update}
if {$WAIT == "opt1"} {set CDDevice($Ncdroms) $dev} {set CDDevice($Ncdroms) ""}
set CDLabel($Ncdroms) "CDrom"
}
proc TkW:addNetDrive {line} {
global NnetDrives NetPath NetLabel
set NnetDrives [expr $NnetDrives + 1]
set NetPath($NnetDrives) [lindex $line 1]
set NetLabel($NnetDrives) [file tail $NetPath($NnetDrives)]
}
proc TkW:addFloppy {line} {
global Nfloppys FLOPPYPath FLOPPYDevice FLOPPYLabel FLOPPYType FLOPPYSerial FLOPPYFS
if {![file exists [lindex $line 1]]} {return}
set Nfloppys [expr $Nfloppys + 1]
set FLOPPYPath($Nfloppys) [lindex $line 1]
set FLOPPYDevice($Nfloppys) [lindex $line 0]
}
proc TkW:SortDosDrives {} {
global NdosDrives DosDevice DriveRank
set devlist ""
for {set i 1} {$i <= $NdosDrives} {set i [expr $i + 1]} {
set devlist "$devlist $DosDevice($i):TKW:$i"
}
set devlist [lsort $devlist]
set i 1
foreach dev $devlist {
set n1 [expr [string first ":TKW:" $dev] + 5]
set n2 [string length $dev]
set DriveRank([string range $dev $n1 $n2]) $i
set i [expr $i + 1]
}
}
proc TkW:SearchTmp {} {
global exclude
global NunixDrives UnixPath UnixLabel UnixType UnixFS
global NdosDrives DosPath DosLabel DosType DosFS
global WAITfilename GetFileName NDRIVES DRIVEUNIXPATH DRIVEDOSPATH
global WhereTmp OK CANCEL
# Check if it /tmp is alreaddy mounted (when it has it's own partition)
foreach i $exclude {
if {$i == "/tmp"} {return /tmp}
}
# check that we have a /tmp:
if {[file exists /tmp] } {
set NunixDrives [expr $NunixDrives + 1]
set UnixPath($NunixDrives) /tmp
set exclude "$exclude$UnixPath($NunixDrives) "
set UnixLabel($NunixDrives) "TEMP"
set UnixType($NunixDrives) hd
set UnixFS($NunixDrives) win95
return /tmp
} else {
#Could add here a search for c:\TEMP or c:|windows\temp
set WAITfilename wait
TkW:GetFileName $WhereTmp $OK $CANCEL Folder
# check if this folder is on a drive that has an entry in
# wineconf (Must be a unix or dos drive)
for {set i 1} {$i<=$NdosDrives} {set i [expr $i +1]} {
if {[string first $DosPath($i) $GetFileName] == 0} {
return $GetFileName
}
}
for {set i 1} {$i<=$NunixDrives} {set i [expr $i +1]} {
if {[string first $UnixPath($i) $GetFileName] == 0} {
return $GetFileName
}
}
# I'll consider this new one as unix, althought if it's win fs that's ok
set NunixDrives [expr $NunixDrives + 1]
set UnixPath($NunixDrives) $GetFileName
set exclude "$exclude$UnixPath($NunixDrives) "
set UnixLabel($NunixDrives) "TEMP"
set UnixType($NunixDrives) hd
set UnixFS($NunixDrives) win95
return $GetFileName
}
}
proc TkW:FindWindows {} {
global NdosDrives DosPath WINLetter SYSLetter Letter
#first attempt: C:\windows (would avoid to search)
if {[file exist $DosPath(1)/windows]} {
return "$DosPath(1)/windows"
}
for {set i 1} {$i<=$NdosDrives} {set i [expr $i + 1]} {
set searchWin [open "| find $DosPath($i) -name win.ini -print" r+]
while {![eof $searchWin]} {
gets $searchWin Found
close $searchWin
set Found [file dirname $Found]
return $Found
}
}
close $searchWin
}
set DIRBROWSE "Browse Folders"
set FolderSelection "Selection:"
set FILTERFOLD "Search Filter (Folders):"
set FILTERFILES "Search Filter (Files):"
set RESCAN Rescan
set VIEW View
proc TkW:dirbrowse {pattern patternF mode} {
# input arg: initial pattern mode (File or Folder
# returns selected folders as a global SelectFolder
# or selected file as a global: SelectFile
# variable: SelectFolder
# You can use WAITbrowse in the calling app to wait
# for dirbrowse to exit (set to 0 on exit, or -1 on CANCEL)
global WAITbrowse
global SelectFolder
global SelectFile
if {![info exists SelectFile]} {set SelectFile ""}
if {![info exists SelectFolder]} {set SelectFolder [pwd]}
global ndirs nfiles;set ndirs 0;set nfiles 0
global ModeBrowse Restore;set Restore $SelectFolder
global FTPcd
if {$mode == "local"} {set FTPcd 1} {set FTPcd 0}
set ModeBrowse $mode
global DIRBROWSE WinBrowse
###################
# CREATING WIDGETS
###################
if {$mode != "local" } {
toplevel .dirbrowse -class Toplevel \
-background #feffff
wm focusmodel .dirbrowse passive
wm geometry .dirbrowse 464x296
wm maxsize .dirbrowse 1265 994
wm minsize .dirbrowse 1 1
wm overrideredirect .dirbrowse 0
wm resizable .dirbrowse 1 1
wm deiconify .dirbrowse
wm title .dirbrowse "TkWine: $DIRBROWSE"
set WinBrowse dirbrowse
} else {
set WinBrowse ftp.browsers.local
#frame .$WinBrowse -background #feffff -height 300 -width 464
}
# Lang globals:
global FolderSelection OK CANCEL FILTERFOLD FILTERFILES
global RESCAN VIEW HELP
# Other globals:
global BrowsePattern;set BrowsePattern $pattern
global BrowsePatternF;set BrowsePatternF $patternF
global dirscroll MouseY
# label and entrybox for selection:
label .$WinBrowse.foldselLab \
-font -Adobe-Helvetica-Medium-R-Normal-*-*-120-*-*-*-*-*-* \
-relief groove -text $FolderSelection
entry .$WinBrowse.foldsel \
-font -Adobe-Helvetica-Medium-R-Normal-*-*-120-*-*-*-*-*-* \
-textvariable SelectFolder
if {$ModeBrowse == "File"} {
.$WinBrowse.foldsel configure -textvar SelectFile
}
# frame for display of currently available folders:
frame .$WinBrowse.dirframe \
-borderwidth 1 -height 30 -relief sunken -width 30 \
-background #dddddd
scrollbar .$WinBrowse.dirframe_scr -width 10
frame .$WinBrowse.fileframe \
-borderwidth 1 -height 30 -relief sunken -width 30
scrollbar .$WinBrowse.fileframe_scr -width 10
# label/entry for pattern
label .$WinBrowse.patternLab \
-font -Adobe-Helvetica-Medium-R-Normal-*-*-120-*-*-*-*-*-* \
-relief groove -text $FILTERFOLD
entry .$WinBrowse.patternF \
-font -Adobe-Helvetica-Medium-R-Normal-*-*-120-*-*-*-*-*-* \
-textvariable BrowsePatternF
label .$WinBrowse.patternLabF \
-font -Adobe-Helvetica-Medium-R-Normal-*-*-120-*-*-*-*-*-* \
-relief groove -text $FILTERFILES
entry .$WinBrowse.pattern \
-font -Adobe-Helvetica-Medium-R-Normal-*-*-120-*-*-*-*-*-* \
-textvariable BrowsePattern
frame .$WinBrowse.fra25 \
-borderwidth 1 -height 30 -relief sunken -width 30
menubutton .$WinBrowse.fra25.men26 \
-font -Adobe-Helvetica-Medium-R-Normal-*-*-120-*-*-*-*-*-* \
-menu .$WinBrowse.fra25.men26.m -padx 4 -pady 3 -relief ridge -text $VIEW
menu .$WinBrowse.fra25.men26.m \
-font -Adobe-Helvetica-Medium-R-Normal-*-*-120-*-*-*-*-*-*
button .$WinBrowse.fra25.but28 \
-font -Adobe-Helvetica-Medium-R-Normal-*-*-120-*-*-*-*-*-* -padx 9 \
-pady 3 -relief ridge -text $HELP
button .$WinBrowse.butOK \
-font -Adobe-Helvetica-Medium-R-Normal-*-*-120-*-*-*-*-*-* -padx 9 \
-pady 3 -text $OK \
-command {destroy .$WinBrowse
set WAITbrowse 0
return "$SelectFolder $SelectFile"
}
button .$WinBrowse.butCANCEL \
-font -Adobe-Helvetica-Medium-R-Normal-*-*-120-*-*-*-*-*-* -padx 9 \
-pady 3 -text $CANCEL \
-command {destroy .$WinBrowse
set WAITbrowse -1
return "$SelectFolder $SelectFile"
}
button .$WinBrowse.butRESCAN \
-font -Adobe-Helvetica-Medium-R-Normal-*-*-120-*-*-*-*-*-* -padx 9 \
-pady 3 -text $RESCAN -command {TkW:DisplayCurrentDir $BrowsePattern}
###################
# SETTING GEOMETRY
###################
global YHeight;set YHeight 170
if {$mode !="local" && $mode != "remote"} {
place .$WinBrowse.foldselLab \
-x 47 -y 270 -width 78 -height 20 -anchor nw -bordermode ignore
place .$WinBrowse.foldsel \
-x 148 -y 268 -width 290 -height 24 -anchor nw -bordermode ignore
place .$WinBrowse.dirframe \
-x 5 -y 90 -width 145 -height $YHeight -anchor nw -bordermode ignore
place .$WinBrowse.dirframe_scr -x 150 -y 90 -width 17 -height $YHeight
place .$WinBrowse.fileframe \
-x 180 -y 90 -width 175 -height 170 -anchor nw -bordermode ignore
place .$WinBrowse.fileframe_scr -x 355 -y 90 -width 17 -height $YHeight
place .$WinBrowse.patternLab \
-x 27 -y 60 -width 143 -height 20 -anchor nw -bordermode ignore
place .$WinBrowse.pattern \
-x 190 -y 58 -width 150 -height 24 -anchor nw -bordermode ignore
place .$WinBrowse.patternLabF \
-x 27 -y 35 -width 143 -height 20 -anchor nw -bordermode ignore
place .$WinBrowse.patternF \
-x 190 -y 32 -width 150 -height 24 -anchor nw -bordermode ignore
place .$WinBrowse.fra25 \
-x 0 -y 1 -width 455 -height 25 -anchor nw -bordermode ignore
place .$WinBrowse.fra25.men26 \
-x -1 -y 0 -width 67 -height 24 -anchor nw -bordermode ignore
place .$WinBrowse.fra25.but28 \
-x 397 -y -3 -width 60 -height 28 -anchor nw -bordermode ignore
place .$WinBrowse.butOK \
-x 380 -y 115 -width 77 -height 28 -anchor nw -bordermode ignore
place .$WinBrowse.butCANCEL \
-x 380 -y 155 -width 77 -height 28 -anchor nw -bordermode ignore
place .$WinBrowse.butRESCAN \
-x 380 -y 195 -width 77 -height 28 -anchor nw -bordermode ignore
} else {
# case of ftp filebrowser ....
bind .$WinBrowse.pattern <Return> {.$WinBrowse.butRESCAN invoke}
bind .$WinBrowse.patternF <Return> {.$WinBrowse.butRESCAN invoke}
place .$WinBrowse.pattern -x 0 -y 3 -width 145 -height 25
place .$WinBrowse.patternF -x 163 -y 3 -width 145 -height 25
place .$WinBrowse.dirframe -x 0 -y 28 -width 145 -height $YHeight
place .$WinBrowse.dirframe_scr -x 145 -y 28 -width 17 -height $YHeight
place .$WinBrowse.fileframe -x 163 -y 28 -width 145 -height $YHeight
place .$WinBrowse.fileframe_scr -x 308 -y 28 -width 17 -height $YHeight
}
# binding the scrollbar:
bind .$WinBrowse.dirframe_scr <ButtonPress> { TkW:ScrollDirs %x %y }
bind .$WinBrowse.dirframe_scr <ButtonRelease> { set dirscroll no; grab release .$WinBrowse.dirframe_scr }
bind .$WinBrowse.dirframe_scr <Motion> { set MouseY %y }
bind .$WinBrowse.fileframe_scr <ButtonPress> { TkW:ScrollFiles %x %y }
bind .$WinBrowse.fileframe_scr <ButtonRelease> { set filescroll no; grab release .$WinBrowse.fileframe_scr }
bind .$WinBrowse.fileframe_scr <Motion> { set MouseY %y }
global TKW
image create photo "fold" -file \
$TKW/shared/icons/smalls/small_folder_yellow.gif
image create photo "unknown" -file \
$TKW/shared/icons/smalls/unknown.gif
image create photo "execfile" -file \
$TKW/shared/icons/smalls/exec.gif
image create photo "imgfile" -file \
$TKW/shared/icons/smalls/xpaint.gif
image create photo "htmlfile" -file \
$TKW/shared/icons/smalls/html.gif
#image create photo "up" -file $TKW/shared/icons/up.gif
TkW:DisplayCurrentDir $BrowsePattern
}
proc TkW:DisplayCurrentDir {BrowsePattern} {
global ndirs nfiles Ybase dirlist filelist FYbase specialwhere
global FYbase BrowsePatternF ModeBrowse
DestroyDirs
set ndirs 0
set dirlist ""
set filelist ""
# First we get the directory list:
if {$ModeBrowse != "remote"} {
set fileList ""
set fileList [glob -nocomplain [pwd]/$BrowsePattern]
set fileList "$fileList [glob -nocomplain [pwd]/.$BrowsePattern]"
set UpLevel 0
foreach i $fileList {
if {[file tail $i] == ".."} {set UpLevel 1}
if { [file isdir $i] } { set dirlist "$dirlist \"$i\"" }
}
set fileList ""
set fileList [glob -nocomplain [pwd]/$BrowsePatternF]
set fileList "$fileList [glob -nocomplain [pwd]/.$BrowsePatternF]"
foreach i $fileList {
if { ![file isdir $i] } { set filelist "$filelist \"$i\"" }
}
if {$UpLevel == 0} {set dirlist ".. $dirlist"}
set dirlist [lsort $dirlist]
set filelist [lsort $filelist]
} else {set filelist ""; set dirlist ".."}
set Ybase 5
set FYbase 5
TkW:ShowDirs
TkW:ShowFiles
}
proc TkW:ShowDirs {} {
global dirlist ndirs
DestroyDirs
set ndirs 0
set showedIn 0
set showedbelow 0
set showedabove 0
foreach i $dirlist {
set inout [TkW:showdir $i]
if {$inout == 0} {set showedIn [expr $showedIn + 1]}
if {$inout == -1} {set showedabove [expr $showedabove + 1]}
if {$inout == 1} {set showedbelow [expr $showedbelow + 1]}
}
# Scrollbars management:
TkW:DirBrowseScroll [expr (100.*$showedabove/$ndirs)/100.] \
[expr 1. - (100.*$showedbelow/$ndirs)/100.]
update
}
proc TkW:DirBrowseScroll { y1 y2} {
global SliderY1 SliderY2 WinBrowse
set SliderY1 $y1
set SliderY2 $y2
.$WinBrowse.dirframe_scr set $y1 $y2
}
proc TkW:FileBrowseScroll { y1 y2} {
global FSliderY1 FSliderY2 WinBrowse
set FSliderY1 $y1
set FSliderY2 $y2
.$WinBrowse.fileframe_scr set $y1 $y2
}
proc TkW:hilightFold {y} {
global YDIRS ndirs DIRS SelectNum WinBrowse
global SelectFolder BrowsePattern FTPcd
if { $y > $YDIRS($ndirs)} {set num $ndirs} else {
set i 1
set ok 0
while {$ok == 0} {
if {
$YDIRS($i) < $y &&\
$y <= $YDIRS([expr $i + 1])} {
set num $i
set ok 1
} else { set i [expr $i + 1] }
}
}
if {$SelectFolder == $DIRS($num)} {
cd $SelectFolder
if {$FTPcd == 1} {FTP_Lcd $SelectFolder}
set SelectFolder [pwd]
TkW:DisplayCurrentDir $BrowsePattern
unset SelectNum
} else {
.$WinBrowse.dirframe.label$num configure -background #ffffff
set SelectFolder $DIRS($num)
if {[info exists SelectNum]} {
.$WinBrowse.dirframe.label$SelectNum configure \
-background #dddddd
}
set SelectNum $num
}
update
}
proc TkW:showdir {fulldirname} {
global TKW ndirs Ybase YHeight YDIRS DIRS Ydecal ModeBrowse WinBrowse
set Ydecal 20
set dirname [file tail $fulldirname]
if {$dirname == "."} return
set Y [expr $Ybase + $ndirs * $Ydecal]
set In 0
if {$Y < 0 } {set In -1}
if {$Y > [expr $YHeight - $Ydecal]} { set In 1 }
set ndirs [expr $ndirs + 1]
set YDIRS($ndirs) $Y
set DIRS($ndirs) $fulldirname
label .$WinBrowse.dirframe.icon$ndirs -image fold
label .$WinBrowse.dirframe.label$ndirs -text $dirname\
-font -Adobe-Helvetica-Medium-R-Normal-*-*-120-*-*-*-*-*-*
if {$In == 0} {
place .$WinBrowse.dirframe.icon$ndirs -x 5 -y $Y
place .$WinBrowse.dirframe.label$ndirs -x 30 -y $Y
}
#dirframe bindings
bind .$WinBrowse.dirframe.icon$ndirs <Button-1> {
set Y [expr %Y - [winfo rooty .$WinBrowse.dirframe] -$Ybase]
TkW:hilightFold $Y
}
#dirframe bindings
bind .$WinBrowse.dirframe.label$ndirs <ButtonPress-1> {
set Y [expr %Y - [winfo rooty .$WinBrowse.dirframe] -$Ybase]
TkW:hilightFold $Y
}
return $In
}
proc TkW:ScrollDirs {X Y} {
global Ybase Ydecal ndirs dirscroll global nextLoop MouseY WinBrowse
global SliderY1 SliderY2 YHeight Nabove Nbelow
set MinBase [expr -$Ydecal * ($ndirs - [expr $YHeight/$Ydecal])]
set Slider1 $SliderY1
set Slider2 $SliderY2
set MaxSlide1 [expr 1-($SliderY2-$SliderY1)]
set MinSlide2 [expr $SliderY2-$SliderY1]
switch [.$WinBrowse.dirframe_scr identify $X $Y] {
{arrow1} { set dirscroll UP; set modeUP 1}
{arrow2} { set dirscroll DOWN;set modeDOWN 1}
{slider} {set dirscroll SLIDER}
{trough1} {set dirscroll UP; set modeUP page}
{trough2} {set dirscroll DOWN;set modeDOWN page}
}
while {$dirscroll == "UP"} {
if {$modeUP == "1"} {set XUP 1} {
set XUP [expr ($YHeight/$Ydecal ) -1]
}
set Ybase [expr $Ybase + $XUP * $Ydecal]
if {$Ybase > $Ydecal} {
set Ybase 5
set dirscroll no
set Slider1 0
set Slider2 $MinSlide2
}
TkW:ReShowDirs
TkW:DirBrowseScroll [expr (100.*$Nabove/$ndirs)/100.] \
[expr 1. - (100.*$Nbelow/$ndirs)/100.]
set nextLoop 0
after 30 {set nextLoop 1}
while {$nextLoop == 0} {update}
set Slider1 $SliderY1
set Slider2 $SliderY2
}
while {$dirscroll == "DOWN"} {
if {$modeDOWN == "1"} {set XDOWN 1} {
set XDOWN [expr ($YHeight/$Ydecal ) -1]
}
set Ybase [expr $Ybase - $XDOWN * $Ydecal]
if {$Ybase < $MinBase} {
set Ybase $MinBase
set dirscroll no
set Slider2 1
set Slider1 $MaxSlide1
}
TkW:ReShowDirs
TkW:DirBrowseScroll [expr (100.*$Nabove/$ndirs)/100.] \
[expr 1. - (100.*$Nbelow/$ndirs)/100.]
set nextLoop 0
after 30 {set nextLoop 1}
while {$nextLoop == 0} {update}
set Slider1 $SliderY1
set Slider2 $SliderY2
}
while {$dirscroll == "SLIDER"} {
set nextLoop 0
after 20 {set nextLoop 1}
while {$nextLoop == 0} {
set Delta [expr (100.*($MouseY - $Y)/$YHeight)/100. ]
set Slider1 [expr $SliderY1 +$Delta]
set Slider2 [expr $SliderY2 +$Delta]
if {$Slider2 > 1} {
set Slider2 1
set Slider1 $MaxSlide1
}
if {$Slider1 < 0} {
set Slider1 0
set Slider2 $MinSlide2
}
.$WinBrowse.dirframe_scr set $Slider1 $Slider2
set Ybase [expr 5 - $Slider1 * $ndirs *$Ydecal]
TkW:ReShowDirs
update
}
}
set SliderY1 $Slider1
set SliderY2 $Slider2
}
proc TkW:ScrollFiles {X Y} {
global FYbase Ydecal nfiles filescroll nextLoop MouseY WinBrowse
global FSliderY1 FSliderY2 YHeight NFabove NFbelow
set MinBase [expr -$Ydecal * ($nfiles - [expr $YHeight/$Ydecal])]
set FSlider1 $FSliderY1
set FSlider2 $FSliderY2
set MaxSlide1 [expr 1-($FSliderY2-$FSliderY1)]
set MinSlide2 [expr $FSliderY2-$FSliderY1]
switch [.$WinBrowse.fileframe_scr identify $X $Y] {
{arrow1} { set filescroll UP; set modeUP 1}
{arrow2} { set filescroll DOWN;set modeDOWN 1}
{slider} {set filescroll SLIDER}
{trough1} {set filescroll UP; set modeUP page}
{trough2} {set filescroll DOWN;set modeDOWN page}
}
while {$filescroll == "UP"} {
if {$modeUP == "1"} {set XUP 1} {
set XUP [expr ($YHeight/$Ydecal ) -1]
}
set FYbase [expr $FYbase + $XUP * $Ydecal]
if {$FYbase > $Ydecal} {
set FYbase 5
set filescroll no
set FSlider1 0
set FSlider2 $MinSlide2
}
TkW:ReShowFiles
if {$nfiles != 0} {
TkW:FileBrowseScroll [expr (100.*$NFabove/$nfiles)/100.] \
[expr 1. - (100.*$NFbelow/$nfiles)/100.]
} else {
TkW:FileBrowseScroll 0 1
}
set nextLoop 0
after 30 {set nextLoop 1}
while {$nextLoop == 0} {update}
set FSlider1 $FSliderY1
set FSlider2 $FSliderY2
}
while {$filescroll == "DOWN"} {
if {$modeDOWN == "1"} {set XDOWN 1} {
set XDOWN [expr ($YHeight/$Ydecal ) -1]
}
set FYbase [expr $FYbase - $XDOWN * $Ydecal]
if {$FYbase < $MinBase} {
set FYbase $MinBase
set filescroll no
set FSlider2 1
set FSlider1 $MaxSlide1
}
TkW:ReShowFiles
if {$nfiles != 0} {
TkW:FileBrowseScroll [expr (100.*$NFabove/$nfiles)/100.] \
[expr 1. - (100.*$NFbelow/$nfiles)/100.]
} else {
TkW:FileBrowseScroll 0 1
}
set nextLoop 0
after 30 {set nextLoop 1}
while {$nextLoop == 0} {update}
set FSlider1 $FSliderY1
set FSlider2 $FSliderY2
}
while {$filescroll == "SLIDER"} {
set nextLoop 0
after 20 {set nextLoop 1}
while {$nextLoop == 0} {
set Delta [expr (100.*($MouseY - $Y)/$YHeight)/100. ]
set FSlider1 [expr $FSliderY1 +$Delta]
set FSlider2 [expr $FSliderY2 +$Delta]
if {$FSlider2 > 1} {
set FSlider2 1
set FSlider1 $MaxSlide1
}
if {$FSlider1 < 0} {
set FSlider1 0
set FSlider2 $MinSlide2
}
.$WinBrowse.fileframe_scr set $FSlider1 $FSlider2
set FYbase [expr 5 - $FSlider1 * $nfiles *$Ydecal]
TkW:ReShowFiles
update
}
}
set FSliderY1 $FSlider1
set FSliderY2 $FSlider2
}
proc TkW:ReShowDirs {} {
global dirlist Ybase Ydecal ndirs YHeight WinBrowse
global Nabove Nbelow
set n 0
set Nabove 0
set Nbelow 0
foreach i $dirlist {
set dirname [file tail $i]
if {$dirname != "."} {
set Y0 [expr $Ybase + $n * $Ydecal]
if {$Y0 < -5} {set Nabove [expr $Nabove + 1]}
if {$Y0 > [expr $YHeight - $Ydecal]} { set Nbelow [expr $Nbelow + 1]}
set n [expr $n + 1]
place .$WinBrowse.dirframe.icon$n -x 5 -y $Y0
place .$WinBrowse.dirframe.label$n -x 30 -y $Y0
}
}
}
proc TkW:ReShowFiles {} {
global filelist FYbase Ydecal nfiles YHeight WinBrowse
global NFabove NFbelow
set n 0
set NFabove 0
set NFbelow 0
foreach i $filelist {
set filename [file tail $i]
if {$filename != "."} {
set Y0 [expr $FYbase + $n * $Ydecal]
if {$Y0 < -5} {set NFabove [expr $NFabove + 1]}
if {$Y0 > [expr $YHeight - $Ydecal]} { set NFbelow [expr $NFbelow + 1]}
set n [expr $n + 1]
place .$WinBrowse.fileframe.icon$n -x 5 -y $Y0
place .$WinBrowse.fileframe.label$n -x 30 -y $Y0
}
}
}
proc TkW:ShowFiles {} {
global filelist nfiles
DestroyFiles
set nfiles 0
set FshowedIn 0
set NFbelow 0
set NFabove 0
foreach i $filelist {
set inout [TkW:showfile $i]
if {$inout == 0} {set FshowedIn [expr $FshowedIn + 1]}
if {$inout == -1} {set NFabove [expr $NFabove + 1]}
if {$inout == 1} {set NFbelow [expr $NFbelow + 1]}
}
# Scrollbar management:
if {$nfiles != 0} {
TkW:FileBrowseScroll [expr (100.*$NFabove/$nfiles)/100.] \
[expr 1. - (100.*$NFbelow/$nfiles)/100.]
} else {
TkW:FileBrowseScroll 0 1
}
}
proc TkW:showfile {fullfilename} {
global TKW nfiles FYbase YHeight YFILES Ydecal FILES
set Y [expr $FYbase + $nfiles * $Ydecal]
set In 0
if {$Y < 0 } {set In -1}
if {$Y > [expr $YHeight - $Ydecal]} { set In 1 }
set nfiles [expr $nfiles + 1]
set YFILES($nfiles) $Y
set FILES($nfiles) $fullfilename
createPlaceFileIcon $nfiles $Y
return $In
}
proc createPlaceFileIcon {n Y} {
global FILES ModeBrowse WinBrowse
set fullfilename $FILES($n)
set icon unknown
if {[file executable $fullfilename]} {set icon execfile}
if {[file extension $fullfilename] == ".html"} {set icon htmlfile}
if {[file extension $fullfilename] == ".htm"} {set icon htmlfile}
if {[file extension $fullfilename] == ".gif"} {set icon imgfile}
if {[file extension $fullfilename] == ".jpg"} {set icon imgfile}
set filename [file tail $fullfilename]
label .$WinBrowse.fileframe.icon$n -image $icon
label .$WinBrowse.fileframe.label$n -text $filename\
-font -Adobe-Helvetica-Medium-R-Normal-*-*-120-*-*-*-*-*-*\
-background #dddddd
place .$WinBrowse.fileframe.icon$n -x 5 -y $Y
place .$WinBrowse.fileframe.label$n -x 30 -y $Y
if {$ModeBrowse == "File"} {
#fileframe bindings
bind .$WinBrowse.fileframe.icon$n <Button-1> {
set Y [expr %Y - [winfo rooty .$WinBrowse.fileframe] -$FYbase]
TkW:hilightFile $Y
}
bind .$WinBrowse.fileframe.icon$n <Double-Button-1> {
destroy .$WinBrowse
set WAITbrowse 0
return "$SelectFolder $SelectFile"
}
#fileframe bindings
bind .$WinBrowse.fileframe.label$n <ButtonPress-1> {
set Y [expr %Y - [winfo rooty .$WinBrowse.fileframe] -$FYbase]
TkW:hilightFile $Y
}
bind .$WinBrowse.fileframe.label$n <Double-Button-1> {
destroy .$WinBrowse
set WAITbrowse 0
return "$SelectFolder $SelectFile"
}
}
}
proc DestroyDirs {} {
global ndirs WinBrowse
for {set i 1} {$i <= $ndirs} {set i [expr $i + 1 ]} {
if {[winfo exists .$WinBrowse.dirframe.icon$i]} {
destroy .$WinBrowse.dirframe.icon$i
destroy .$WinBrowse.dirframe.label$i
}
}
}
proc DestroyFiles {} {
global nfiles WinBrowse
for {set i 1} {$i <= $nfiles} {set i [expr $i + 1 ]} {
if {[winfo exists .$WinBrowse.fileframe.icon$i]} {
destroy .$WinBrowse.fileframe.icon$i
destroy .$WinBrowse.fileframe.label$i
}
}
}
proc TkW:hilightFile {y} {
global YFILES nfiles FILES SelectNumF WinBrowse
global SelectFile BrowsePattern
if { $y > $YFILES($nfiles)} {set num $nfiles} else {
set i 1
set ok 0
while {$ok == 0} {
if {
$YFILES($i) < $y &&\
$y <= $YFILES([expr $i + 1])} {
set num $i
set ok 1
} else { set i [expr $i + 1] }
}
}
if {$SelectFile == $FILES($num)} {
return
} else {
.$WinBrowse.fileframe.label$num configure -background #ffffff
set SelectFile $FILES($num)
if {[info exists SelectNumF]} {
.$WinBrowse.fileframe.label$SelectNumF configure -background #dddddd
}
set SelectNumF $num
}
update
}
set TO TO
set OK OK
set QUIT QUIT
set CANCEL CANCEL
set GO GO
set YES YES
set NO NO
set NEXT NEXT
set SAVE SAVE
set SKIP SKIP
set MSG_title "TkWine:Messenger"
set SUCCES succesfull
set HELP HELP; set START START
set RESTART RESTART
set CLOSE CLOSE
set OPTIONS Options
set pathtosetup [pwd]/setupfiles
set MAKE make
set CONF configure
set INSTALL install
#related to exit:
set EXIT_title "TkWineSetup Exit"
set CONFIRMQUIT "This will close TkWineSetup.\n \"Quit Saving\" will store your choices (source and install folders, compilation options etc..) for the next start. \"Quit No Save\" aborts any changes you made."
set QUITSAVING "Quit Saving"
set QUITNOSAVE "Quit No Save"
#related to browsers:
set GETDIRtitle "TkWineSetup - Get directory"
set FOLDBROWSEtitle "TkWineSetup - Directories browser"
set BROWSE BROWSE
set CHFOLD "Choose folder"
set CHFOLDsel "Selected directory:"
#related to downloads:
set DOWNLOADING "Dowload file:"
#related to the internal file viewer:
set ScrollEdits "Scroll to bottom on input"
set EditTitle "TkWine Text Viewer"
set errorTitle "\n*************** TkWine Error ****************\n\
\n An error occured, that I could not resolve. This might be \n\n\
a) An invalid entry \n\
b) An error in the script\n\
In any case, this error should be detected by the script, even an invalid\
entry deserve better error message than this one!!\n\
The following lines are tk output. it might be uninteligible for you, but it makes sense for the maintainers. If you're keen to provide a bug reports, please, send the following info to thirot@univ-brest.fr.\n\n\
(this info can be send in attachement, the file name is /tmp/tkwerror)\n\
In some cases, however, the error is harmless. Feel free to add comment about this when you send me the file. If you want to receive the patch via email, please mention this in your mail. \n\
Sorry not to make it better at once... I'll try to improve. \
\nThanks for using TkWine.\
\n Bye,\
\n Jean-Louis,\
\n TkWine primary contact.\n\
======================================================================="
#!/usr/bin/wish
#############################################################################
# Visual Tcl v1.07 Project
#
#################################
# GLOBAL VARIABLES
#
global widget;
#################################
proc TkW:GetFileName {message opt1 opt2 searchtype} {
global OK MSG_title WAITfilename TKW GetFileName BROWSE WAITbrowse
global SearchType
set SearchType $searchtype
set base .getfilename
if {[winfo exists .getfilename]} {
wm deiconify .getfilename; return
}
###################
# CREATING WIDGETS
###################
toplevel .getfilename -class Toplevel \
-background #ffffff
wm focusmodel .getfilename passive
wm maxsize .getfilename 1265 994
wm minsize .getfilename 1 1
wm overrideredirect .getfilename 0
wm resizable .getfilename 1 1
wm deiconify .getfilename
wm geometry .getfilename +100+100
wm title .getfilename $MSG_title
#wm iconbitmap .getfilename @$TKW/shared/images/setup2.xbm
#wm iconmask .getfilename @$TKW/shared/images/setupmask2.xbm
#creates the message widget:
message .getfilename.msg -justify center -text $message \
-background #dddddd -aspect 300
# Creates the entry box:
global GetFileName
entry .getfilename.ent -textvar GetFileName -relief sunken -width 50
button .getfilename.but1 \
-background #dddddd \
-font -Adobe-Helvetica-Medium-R-Normal-*-*-120-*-*-*-*-*-* -padx 9 \
-pady 3 -text $opt1 -width 8 -state disabled \
-command {
destroy .getfilename
set WAITfilename opt1
return
}
button .getfilename.but2 \
-background #dddddd \
-font -Adobe-Helvetica-Medium-R-Normal-*-*-120-*-*-*-*-*-* -padx 9 \
-pady 3 -text $opt2 -width 8\
-command {destroy .getfilename; set WAITfilename opt2; return}
button .getfilename.but3 \
-background #dddddd \
-font -Adobe-Helvetica-Medium-R-Normal-*-*-120-*-*-*-*-*-* -padx 9 \
-pady 3 -text $BROWSE -width 8\
-command {TkW:dirbrowse * * $SearchType
set WAITbrowse 1
while {$WAITbrowse == 1} {update}
if {$WAITbrowse == 0} {
if {$SearchType == "File"} {
set GetFileName $SelectFile
} else {
set GetFileName $SelectFolder
}
}
update
}
###################
###################
# SETTING GEOMETRY
###################
#set H2 [expr $H +10]
pack .getfilename.msg -padx 5 -pady 5
#-anchor nw -bordermode ignore
pack .getfilename.ent -padx 5 -pady 5
pack .getfilename.but1 -padx 30 -pady 10 -side left
pack .getfilename.but3 -padx 0 -pady 10 -side left
pack .getfilename.but2 -padx 30 -pady 10 -side left
#-x 110 -y $H2 -width 100 -height 28 -anchor nw -bordermode ignore
#bind .getfilename.ent <KeyPress-Return> {.getfilename.but1 invoke}
while {[winfo exists .getfilename]} {
if {[file exists $GetFileName]} {
.getfilename.but1 configure -state normal
} else {
.getfilename.but1 configure -state disabled
}
update
}
}
#!/usr/bin/wish
#############################################################################
# Visual Tcl v1.07 Project
#
#################################
# GLOBAL VARIABLES
#
global widget;
#################################
proc TkW:message {message} {
global OK MSG_title WAIT TKW
set base .msg
if {[winfo exists .msg]} {
wm deiconify .msg; return
}
###################
# CREATING WIDGETS
###################
toplevel .msg -class Toplevel \
-background #ffffff
#-background #4c92fe
wm focusmodel .msg passive
wm maxsize .msg 1265 994
wm minsize .msg 200 1
wm overrideredirect .msg 0
wm resizable .msg 1 1
wm deiconify .msg
wm geometry .msg +100+100
wm title .msg $MSG_title
#wm iconbitmap .msg @$TKW/shared/images/setup2.xbm
#wm iconmask .msg @$TKW/shared/images/setupmask2.xbm
#creates the message widget:
message .msg.msg -justify center -text $message -background #dddddd -aspect 300
button .msg.but18 \
-background #dddddd \
-font -Adobe-Helvetica-Medium-R-Normal-*-*-120-*-*-*-*-*-* -padx 9 \
-pady 3 -text button -textvariable $OK -width 8\
-command {
destroy .msg
set WAIT done
}
###################
# SETTING GEOMETRY
###################
#set H2 [expr $H +10]
pack .msg.msg -padx 5 -pady 5
#-anchor nw -bordermode ignore
pack .msg.but18 -side bottom -padx 5 -pady 5
#-x 110 -y $H2 -width 100 -height 28 -anchor nw -bordermode ignore
#pack .msg.lab19 -width 50 -height 30 -padx 10 -pady 10
#pack .msg.but18
}
#!/usr/bin/wish
#############################################################################
# Visual Tcl v1.07 Project
#
#################################
# GLOBAL VARIABLES
#
global widget;
#################################
proc TkW:message2 {message opt1 opt2} {
global OK MSG_title WAIT TKW
set base .msg
if {[winfo exists .msg]} {
wm deiconify .msg; return
}
###################
# CREATING WIDGETS
###################
toplevel .msg -class Toplevel \
-background #ffffff
wm focusmodel .msg passive
wm maxsize .msg 1265 994
wm minsize .msg 1 1
wm overrideredirect .msg 0
wm resizable .msg 1 1
wm deiconify .msg
wm geometry .msg +100+100
wm title .msg $MSG_title
#wm iconbitmap .msg @$TKW/shared/images/setup2.xbm
#wm iconmask .msg @$TKW/shared/images/setupmask2.xbm
#creates the message widget:
message .msg.msg -justify center -text $message -background #dddddd -aspect 300
button .msg.but1 \
-background #dddddd \
-font -Adobe-Helvetica-Medium-R-Normal-*-*-120-*-*-*-*-*-* -padx 9 \
-pady 3 -text $opt1 -width 8 \
-command {destroy .msg; set WAIT opt1; return}
button .msg.but2 \
-background #dddddd \
-font -Adobe-Helvetica-Medium-R-Normal-*-*-120-*-*-*-*-*-* -padx 9 \
-pady 3 -text $opt2 -width 8\
-command {destroy .msg; set WAIT opt2; return}
###################
# SETTING GEOMETRY
###################
#set H2 [expr $H +10]
pack .msg.msg -padx 5 -pady 5
#-anchor nw -bordermode ignore
pack .msg.but1 -padx 5 -pady 5 -side left
pack .msg.but2 -padx 5 -pady 5 -fill x
#-x 110 -y $H2 -width 100 -height 28 -anchor nw -bordermode ignore
}
proc TkW:exit {} {
global EXIT_title QUITSAVING QUITNOSAVE CANCEL TKW
set base .saveRC
if {![winfo exists .choosemethod]} {
cd $TKW
TkW:choosemethod
return
}
TkW:CloseOtherWindows
TkW:debug "Other should be detroyed now......"
if {[winfo exists .saveRC]} {
wm deiconify .saveRC; return
}
TkW:debug "Entering TkW:exit"
###################
# CREATING WIDGETS
###################
toplevel .saveRC -class Toplevel \
-background #ffffff
wm focusmodel .saveRC passive
wm geometry .saveRC 412x163+404+267
wm maxsize .saveRC 1265 994
wm minsize .saveRC 1 1
wm overrideredirect .saveRC 0
wm resizable .saveRC 1 1
wm deiconify .saveRC
wm title .saveRC "$EXIT_title"
#wm iconbitmap .saveRC @$TKW/setupfiles/images/setup2.xbm
#wm iconmask .saveRC @$TKW/setupfiles/images/setupmask2.xbm
label .saveRC.lab18 \
-background #dddddd \
-font -Adobe-Helvetica-Medium-R-Normal-*-*-160-*-*-*-*-*-* \
-foreground #0000f6 -relief groove -text label \
-textvariable CONFIRMQUIT -wraplength 350
button .saveRC.but19 \
-font -Adobe-Helvetica-Medium-R-Normal-*-*-120-*-*-*-*-*-* -padx 9 \
-pady 3 -text button -textvariable QUITSAVING -command {TkW:saveRC;exit}
button .saveRC.but20 \
-font -Adobe-Helvetica-Medium-R-Normal-*-*-120-*-*-*-*-*-* -padx 9 \
-pady 3 -text button -textvariable QUITNOSAVE -command {exit}
button .saveRC.but21 \
-font -Adobe-Helvetica-Medium-R-Normal-*-*-120-*-*-*-*-*-* -padx 9 \
-pady 3 -text button -textvariable CANCEL -command {destroy .saveRC}
###################
# SETTING GEOMETRY
###################
place .saveRC.lab18 \
-x 5 -y 5 -width 403 -height 110 -anchor nw -bordermode ignore
place .saveRC.but19 \
-x 5 -y 120 -width 135 -height 38 -anchor nw -bordermode ignore
place .saveRC.but20 \
-x 138 -y 120 -width 135 -height 38 -anchor nw -bordermode ignore
place .saveRC.but21 \
-x 273 -y 120 -width 135 -height 38 -anchor nw -bordermode ignore
}
proc TkW:CloseOtherWindows {} {
set Wins ".wineconf .compile .install .insbin"
foreach i $Wins { if [winfo exists $i] {destroy $i}}
return
}
proc TkW:saveRC {} {
# This proc saves the ~/.winesetuprc file
# all the last compile option, source dest, install dire,
# and the like are saved.
# Could be improved by adding a "default" button in some places so some
#changes could be ignore there....
# For now, it saves all the last selections.
# Opens the ~/.winesetuprc for writting:
set savein [open ~/.winesetuprc w]
# Puts the comments as well as the content:
puts $savein "#"
puts $savein "# System description:"
puts $savein "#"
global distrib; puts $savein "set distrib \"$distrib\""
global kernel; puts $savein "set kernel \"$kernel\""
global processor; puts $savein "set processor \"$processor\""
global FTPNUM bz2docdest bz2exedest
global BROWSER;puts $savein "set BROWSER \"$BROWSER\""
puts $savein "#"
puts $savein "# Method:"
puts $savein "#"
global choosenmethod; puts $savein "set choosenmethod \"$choosenmethod\""
puts $savein "#"
puts $savein "# Compile options"
puts $savein "#"
puts $savein "# where to search the archive"
global dir_search; puts $savein "set dir_search \"$dir_search\""
puts $savein "# where to put the executable"
global bindir; puts $savein "set bindir \"$bindir\""
puts $savein "# options"
global debug trace noemu dll nolib clean
puts $savein "set debug $debug ; set trace $trace ; set noemu $noemu ; set dll $dll ; set nolib $nolib ; set clean $clean"
puts $savein "# where to put the source tree"
global srcdest; puts $savein "set srcdest \"$srcdest\""
puts $savein "# where is the top of the source tree"
global winedir; puts $savein "set winedir \"$winedir\""
puts $savein "#"
puts $savein "# Number in the list of ftp site to use"
puts $savein "set FTPNUM $FTPNUM"
puts $savein "#"
puts $savein "# BZIP@ exe and doc dest"
puts $savein "set bz2exedest $bz2exedest"
puts $savein "set bz2docdest $bz2docdest"
puts $savein "# "
puts $savein "# memory from last start"
puts $savein "# "
global laststart ; puts $savein "set laststart \"$laststart\""
}
set WC_banner "Configuring wine - Please, fill in all sections"
set WC_drivesSect "Drive section: Add the drives wine will need"
set WC_path "Path"
set WC_type "Type"
set WC_label "Label"
set WC_fstype "FS type"
set EDIT Edit
set REMOVE Remove
set ADD Add
set WC_wineSect "Wine section : please, check all path below"
set WC_windows "Windows"
set WC_system "System"
set WC_temp "Temp"
set WC_Symbols "Symbols"
set WC_winepath "Click here to change the PATH variable"
set WC_serialSect "Serial ports"
set CLEAR "Clear"
set WC_pathtitle "TkWineSetup Edit PATH "
set WC_parallelSect "Parallel ports"
set WC_logSect "Runtime Log file"
set WC_exclude "Exlude messages"
set WC_wineLook "Wine look"
set WC_confserial "TkWineSetup - Configuring Serial Ports"
set WC_confparallel "TkWineSetup - Configuring Parallel Ports"
set WC_confdrives "TkWineSetup - Configuring Drives"
set WC_serialbanner "Serial Ports Configuration.\n\n\
Attach each device that you\n may need to a DOS port"
set WC_driveSetBanner "Drive settings"
set WC_editPathBanner "TkWineSetup: give search path for wine"
set WC_PPbanner "Parallel Ports Configuration.\n\n\
Attach each device that you\n may need to a DOS port"
set chdrives1 {Drive letter}
set chdrives2 "Drive Unix Path"
set chdrives3 "Drive type"
set chdrives4 "File System Type"
set chdrives5 "Label"
set chdrives6 "Device"
set chdrives7 "Serial Number"
set WC_helpondrives "Drives settings\n\n\
List of drives availlable to wine. For each drive, you must specify the drive\
letter, the type of the drive (floppy, hard drive, cdrom or network), the\
filesystem type (mounted as unix (ext2), msdos (fat) or win95 (vfat). \n\n\
To edit the parameters of a drive, select this drive and choose Edit.\n\n\
Click Add to insert a new drive.\n\n \ A star at the beginning of the line\
warns you that\ TkWineSetup cannot find the selected path. This is either an\
error (if the drive does not exist) or a reference to an unmounted drive."
set WC_helponwine "Wine System settings\n\n\
Windows: Used to specify where wine would find the windows\
directory (usually c:\\windows under dos).\n\n \
System: Used to specify the system directory (usually
C:\\windows\\system under DOS)\n\n \
Temp: Used to specify where windows\
applications should store temporary files (usually /tmp on unixes).\n\n \
Symbols: give the full path to the symbol table required for wine\
internal debugger \
(usually, this file is named wine.sym) \n\n \
You also need to set the PATH variable (same as standart dos \
PATH variable) to tell wine where to search your windows application.\n\n \
All path can be given both in UNIX or MSDOS syntax."
set WC_helponserial "Serial Ports configuration\n\n\
The left list shows the DOS name of communication port, and the rigth\
column shows on which device it is attached. For exemple, if you\
have a modem on /dev/cua0, and you put com1 attached\
to /dev/cua0, then you will have to set your modem on com1\
in windows application that requires it. It is common to\
have a link /dev/modem pointing to the device where the modem\
is attached, check with ls -l /dev/modem. You can specify\
the max speed on each port (eg /dev/modem,38400 specify a port\
attached to /dev/modem with a max speed of 38400 bps on that\
prot).\n\n \
If you have problems with the recognition of ports at runtime,\
try to start wine -debugmsg +comm and see what you get"
set WC_helponPP "Parallel Ports configuration\n\n\
The left list shows the DOS name of parallel port, and the rigth\
column shows on which device it is attached. For exemple, if you\
have a printer on /dev/lpt1, and you put lpt1 attached\
to /dev/lpt1, then you will have to set your printer on lpt1\
in windows application that requires it. It is common to\
have a link /dev/printer pointing to the device where the printer\
is attached, check with ls -l /dev/printer."
set WC_helponmisc "Spy\n\n \
Give in the entry box below the name of the file that wine\
will use at run time as logfile.\n\n\
The Exclude message button below allow to select which\
message to exclude (or include) from the log\
(NOT IMPLEMENTED YET in TkWineSetup,\
edit the file ~/.winerc manually), or leave the default (no exclude).\n\n\
Wine look\n\n\
Choose the prefered look (Win 3.1, Win95 or Win 98) to use. \
This can be overidden when starting an application.\n "
set WC_oneletter " is not valid.\n Drive letter can only be a SINGLE alpha character"
set WC_usedletter " is not valid.\n Drive letter alreaddy in use"
set WC_11letters " is not valid.\n Label cannot exeed 11 characters"
set WC_givepath "You MUST specify a UNIX path"
set WCHLP(1) "Enter Drive letter (this must be a single character) to use for \
MSDOS like path"
set WCHLP(2) "Enter Drive full path in UNIX syntax."
set WCHLP(3) "Choose the type of drive that you want"
set WCHLP(4) "Choose the file system type to use\
to access this drive\
\n\nWARNING\n\n
This is NOT the way it is mounted on your UNIX box, but the way\
you want wine to see it. Say unix for case sensitive search, winxx for case non sensitive file search.\
So, if windows app are about to read/write files on this drive, it should be\
set to winxx. This includes the TMP drives, EVEN IF IT'S A UNIX FILESYSTEM.\n\n\
If the drives spans several file systems\
(like CDroms or floppies can do)\
then leave blank or say unix"
set WCHLP(5) "Enter the desired Label.\
Must not be more than 11 characters.\
(Label is optional)."
set WCHLP(6) "Enter the device (as in /dev/fd0).\n
This is not requiered if\
the drive is mounted at the time\
you start wine."
set WCHLP(7) "Enter the drive serial number\
as an 8-characters hexadecimal number.\
(optional)."
set WC_quit "Any unsaved changes you made will be lost.\n
are you sure you want to quit?"
set WC_quitreally "Quit anyway"
set WC_noquit "Cancel"
set ChDefautConf "Choose the prefered configuration file to use as the default one"
set DejaConf "Use existing config file:"
set GiveCustomDefault "Enter (or choose) the configuration file to use"
set GenereConf "Auto-generate a new configuration file"
set TkWBuiltConf "Use TkWine built-in configuration file (not recommended)"
set AutoConfFail " Warning: An error occured while running tools/wineconf.\n\
You can still edit the generated file (if it does not crashes) but \n\
some parts are probably missing. Check for a newer release of wine where wineconf could have been imporved"
proc TkW:wineconf {DefaultConfFile} {
global WC_banner WC_driveSect WC_path WC_type WC_label WC_fstype
global EDIT SAVE REMOVE ADD WC_wineSect WC_windows WC_system WC_temp
global WC_Symbols WC_winepath WC_serialSect CLEAR WC_parallelSect
global WC_logSect WC_exclude WC_wineLook
global windowspath varpath syspath tmppath symbols winelook
global ndrives drive drivepath drivetype drivefstype drivelabel
global drivedevice driveserial
global resolution defaultfont
global readport writeport TKW WAITconf
global exclude default_progs startup allocsyscolors winelook wine_logfile
global com lpt spool nspool alias nalias
global WC_helpondrives WC_helponwine WC_helponserial WC_helponPP
global WC_helponmisc WAIT WC_quit WC_quit
global WC_quitreally WC_noquit
if {[winfo exist .choosemethod] } {destroy .choosemethod}
if {[winfo exist .install] } {destroy .install}
set base .wineconf
if {[winfo exists .wineconf]} {
wm deiconify .wineconf; return
}
###################
# CREATING WIDGETS
###################
toplevel .wineconf -class Toplevel \
-background #3c1cfe
wm focusmodel .wineconf passive
wm geometry .wineconf 462x600+148+153
wm maxsize .wineconf 1265 994
wm minsize .wineconf 1 1
wm overrideredirect .wineconf 0
wm resizable .wineconf 1 1
wm deiconify .wineconf
wm title .wineconf "TkWineSetup Configuring Wine"
#wm iconbitmap .wineconf @$TKW/setupfiles/images/setup2.xbm
#wm iconmask .wineconf @$TKW/setupfiles/images/setupmask2.xbm
label .wineconf.lab18 \
-background #fcfefe \
-font -Adobe-Helvetica-Medium-R-Normal-*-*-120-*-*-*-*-*-* \
-relief groove -text label -textvariable WC_banner
canvas .wineconf.can01 \
-background #fee0b4 -borderwidth 2 -height 207 -relief ridge \
-width 296
label .wineconf.can01.lab22 \
-background #fefefe \
-font -Adobe-Helvetica-Medium-R-Normal-*-*-120-*-*-*-*-*-* \
-relief groove -text label -textvariable WC_drivesSect
listbox .wineconf.can01.lis23 \
-font -Adobe-Helvetica-Medium-R-Normal-*-*-120-*-*-*-*-*-* \
-yscrollcommand {.wineconf.can01.scrDrives set }
scrollbar .wineconf.can01.scrDrives \
-borderwidth 1 -orient vert -width 10 \
-command { .wineconf.can01.lis23 yview }
listbox .wineconf.can01.lis24 \
-font -Adobe-Helvetica-Medium-R-Normal-*-*-120-*-*-*-*-*-*
listbox .wineconf.can01.lis25 \
-font -Adobe-Helvetica-Medium-R-Normal-*-*-120-*-*-*-*-*-*
listbox .wineconf.can01.lis26 \
-font -Adobe-Helvetica-Medium-R-Normal-*-*-120-*-*-*-*-*-*
button .wineconf.can01.but28 \
-font -Adobe-Helvetica-Medium-R-Normal-*-*-120-*-*-*-*-*-* -padx 9 \
-pady 3 -text button -textvariable ADD \
-command {TkW:drives new}
button .wineconf.can01.but29 \
-font -Adobe-Helvetica-Medium-R-Normal-*-*-120-*-*-*-*-*-* -padx 9 \
-pady 3 -state disabled -text button -textvariable REMOVE \
-command {TkW:delDrive $sel_drive}
button .wineconf.can01.but30 \
-font -Adobe-Helvetica-Medium-R-Normal-*-*-120-*-*-*-*-*-* -padx 9 \
-pady 3 -state disabled -text button -textvariable EDIT \
-command {TkW:drives $sel_drive}
label .wineconf.can01.lab31 \
-font -Adobe-Helvetica-Medium-R-Normal-*-*-120-*-*-*-*-*-* \
-relief groove -text label -textvariable WC_path
label .wineconf.can01.lab32 \
-font -Adobe-Helvetica-Medium-R-Normal-*-*-120-*-*-*-*-*-* \
-relief groove -text label -textvariable WC_type
label .wineconf.can01.lab33 \
-font -Adobe-Helvetica-Medium-R-Normal-*-*-120-*-*-*-*-*-* \
-relief groove -text label -textvariable WC_label
label .wineconf.can01.lab34 \
-font -Adobe-Helvetica-Medium-R-Normal-*-*-120-*-*-*-*-*-* \
-relief groove -text label -textvariable WC_fstype
button .wineconf.can01.but51 \
-font -Adobe-Helvetica-Medium-R-Normal-*-*-120-*-*-*-*-*-* -padx 9 \
-pady 3 -text button -textvariable HELP \
-command {TkW:message $WC_helpondrives}
#section wine
canvas .wineconf.can37 \
-background #fedcdc -borderwidth 2 -height 207 -relief ridge \
-width 296
label .wineconf.can37.lab39 \
-background #fefefe \
-font -Adobe-Helvetica-Medium-R-Normal-*-*-120-*-*-*-*-*-* \
-relief groove -text label -textvariable WC_wineSect
label .wineconf.can37.lab40 \
-font -Adobe-Helvetica-Medium-R-Normal-*-*-120-*-*-*-*-*-* \
-relief groove -text label -textvariable WC_windows
label .wineconf.can37.lab41 \
-font -Adobe-Helvetica-Medium-R-Normal-*-*-120-*-*-*-*-*-* \
-relief groove -text label -textvariable WC_system
button .wineconf.can37.but42 \
-font -Adobe-Helvetica-Medium-R-Normal-*-*-120-*-*-*-*-*-* \
-relief groove -textvariable WC_winepath \
-command TkW:editWinePath
button .wineconf.can37.but43 \
-font -Adobe-Helvetica-Medium-R-Normal-*-*-120-*-*-*-*-*-* -padx 9 \
-pady 3 -text button -textvariable HELP \
-command {TkW:message $WC_helponwine}
entry .wineconf.can37.ent45 \
-font -Adobe-Helvetica-Medium-R-Normal-*-*-120-*-*-*-*-*-* \
-textvariable windowspath
entry .wineconf.can37.ent46 \
-font -Adobe-Helvetica-Medium-R-Normal-*-*-120-*-*-*-*-*-* \
-textvariable syspath
label .wineconf.can37.lab47 \
-font -Adobe-Helvetica-Medium-R-Normal-*-*-120-*-*-*-*-*-* \
-relief groove -text label -textvariable WC_temp
label .wineconf.can37.lab48 \
-font -Adobe-Helvetica-Medium-R-Normal-*-*-120-*-*-*-*-*-* \
-relief groove -text label -textvariable WC_Symbols
entry .wineconf.can37.ent49 \
-font -Adobe-Helvetica-Medium-R-Normal-*-*-120-*-*-*-*-*-* \
-textvariable tmppath
entry .wineconf.can37.ent50 \
-font -Adobe-Helvetica-Medium-R-Normal-*-*-120-*-*-*-*-*-* \
-textvariable symbols
# section serialports
canvas .wineconf.can53 \
-background #fedcdc -borderwidth 2 -relief ridge
label .wineconf.can53.lab57 \
-background #fefefe \
-font -Adobe-Helvetica-Medium-R-Normal-*-*-120-*-*-*-*-*-* \
-relief groove -text label -textvariable WC_serialSect
listbox .wineconf.can53.lis58 \
-font -Adobe-Helvetica-Medium-R-Normal-*-*-120-*-*-*-*-*-*
listbox .wineconf.can53.lis59 \
-font -Adobe-Helvetica-Medium-R-Normal-*-*-120-*-*-*-*-*-* \
-yscrollcommand {.wineconf.can53.scr60 set }
scrollbar .wineconf.can53.scr60 \
-borderwidth 1 -orient vert -width 10 \
-command { .wineconf.can53.lis59 yview }
button .wineconf.can53.but63 \
-font -Adobe-Helvetica-Medium-R-Normal-*-*-120-*-*-*-*-*-* -padx 9 \
-pady 3 -text button -textvariable EDIT \
-command {TkW:editports com}
button .wineconf.can53.but64 \
-font -Adobe-Helvetica-Medium-R-Normal-*-*-120-*-*-*-*-*-* -padx 9 \
-pady 3 -text button -textvariable CLEAR -state disabled \
-command {
set com([expr $sel_com + 1]) " "
TkW:setboxes
.wineconf.can53.but64 configure -state disabled
}
button .wineconf.can53.help \
-font -Adobe-Helvetica-Medium-R-Normal-*-*-120-*-*-*-*-*-* -padx 9 \
-pady 3 -text button -textvariable HELP\
-command {TkW:message $WC_helponserial}
#section parallelports
canvas .wineconf.can54 \
-background #fedcdc -borderwidth 2 -relief ridge
label .wineconf.can54.lab65 \
-background #fefefe \
-font -Adobe-Helvetica-Medium-R-Normal-*-*-120-*-*-*-*-*-* \
-relief groove -text label -textvariable WC_parallelSect
listbox .wineconf.can54.lis67 \
-font -Adobe-Helvetica-Medium-R-Normal-*-*-120-*-*-*-*-*-* \
-yscrollcommand {.wineconf.can54.scr71 set }
listbox .wineconf.can54.lis68 \
-font -Adobe-Helvetica-Medium-R-Normal-*-*-120-*-*-*-*-*-*
button .wineconf.can54.but69 \
-font -Adobe-Helvetica-Medium-R-Normal-*-*-120-*-*-*-*-*-* -padx 9 \
-pady 3 -text button -textvariable EDIT \
-command {TkW:editports lpt}
button .wineconf.can54.but70 \
-font -Adobe-Helvetica-Medium-R-Normal-*-*-120-*-*-*-*-*-* -padx 9 \
-pady 3 -text button -textvariable CLEAR -state disabled \
-command {
set lpt([expr $sel_port + 1]) " "
TkW:setboxes
.wineconf.can54.but70 configure -state disabled
}
scrollbar .wineconf.can54.scr71 \
-borderwidth 1 -orient vert -width 10 \
-command {.wineconf.can54.lis67 yview}
button .wineconf.can54.help \
-font -Adobe-Helvetica-Medium-R-Normal-*-*-120-*-*-*-*-*-* -padx 9 \
-pady 3 -text button -textvariable HELP\
-command {TkW:message $WC_helponPP}
#sections spy et Tweak.Layout
canvas .wineconf.can55 \
-background #fedcdc -borderwidth 2 -height 207 -relief ridge \
-width 296
label .wineconf.can55.lab72 \
-background #fefefe \
-font -Adobe-Helvetica-Medium-R-Normal-*-*-120-*-*-*-*-*-* \
-relief groove -text label -textvariable WC_logSect
entry .wineconf.can55.ent74 \
-font -Adobe-Helvetica-Medium-R-Normal-*-*-120-*-*-*-*-*-* \
-textvariable wine_logfile
button .wineconf.can55.but75 \
-font -Adobe-Helvetica-Medium-R-Normal-*-*-120-*-*-*-*-*-* -padx 9 \
-pady 3 -text button -textvariable WC_exclude
label .wineconf.can55.lab76 \
-background #fefefe \
-font -Adobe-Helvetica-Medium-R-Normal-*-*-120-*-*-*-*-*-* \
-relief groove -text label -textvariable WC_wineLook
menubutton .wineconf.can55.men78 \
-font -Adobe-Helvetica-Medium-R-Normal-*-*-120-*-*-*-*-*-* \
-menu .wineconf.can55.men78.m -padx 4 -pady 3 -text menu \
-textvariable winelook
menu .wineconf.can55.men78.m \
-cursor {} -font -Adobe-Helvetica-Medium-R-Normal-*-*-120-*-*-*-*-*-*
.wineconf.can55.men78.m add command \
-command {set winelook "Win31"} -label {Win 3.1}
.wineconf.can55.men78.m add command \
-command {set winelook "Win95"} -label win95/98
.wineconf.can55.men78.m add command \
-command {set winelook "Win98"} -label {Win 98}
button .wineconf.can55.help \
-font -Adobe-Helvetica-Medium-R-Normal-*-*-120-*-*-*-*-*-* -padx 9 \
-pady 3 -text button -textvariable HELP \
-command {TkW:message $WC_helponmisc}
#main window buttons:
button .wineconf.but80 \
-command {
set WAIT wait
TkW:message2 $WC_quit $WC_quitreally $WC_noquit
while {$WAIT == "wait"} {update}
if {$WAIT == "opt1"} { if {[winfo exists .desktop]} {
destroy .wineconf
set WAITconf 0
return
} else {
exit
}
}
} \
-font -Adobe-Helvetica-Medium-R-Normal-*-*-120-*-*-*-*-*-* -padx 9 \
-pady 3 -text button -textvariable QUIT
button .wineconf.save \
-command TkW:writewinerc \
-font -Adobe-Helvetica-Medium-R-Normal-*-*-120-*-*-*-*-*-* -padx 9 \
-pady 3 -text button -textvariable SAVE
###################
# SETTING GEOMETRY
###################
place .wineconf.lab18 \
-x 3 -y 5 -width 453 -height 20 -anchor nw -bordermode ignore
#placing drives sctions widgets:
place .wineconf.can01 \
-x 5 -y 35 -width 466 -height 180 -anchor nw -bordermode ignore
place .wineconf.can01.lab22 \
-x 0 -y 0 -width 443 -height 25 -anchor nw -bordermode ignore
place .wineconf.can01.lis23 \
-x 10 -y 56 -width 130 -height 113 -anchor nw -bordermode ignore
place .wineconf.can01.lis24 \
-x 139 -y 55 -width 85 -height 113 -anchor nw -bordermode ignore
place .wineconf.can01.lis25 \
-x 223 -y 55 -width 65 -height 113 -anchor nw -bordermode ignore
place .wineconf.can01.lis26 \
-x 288 -y 55 -width 65 -height 113 -anchor nw -bordermode ignore
place .wineconf.can01.scrDrives \
-x 353 -y 55 -width 16 -height 113 -anchor nw -bordermode ignore
# bind lis23-26
bind .wineconf.can01.lis23 <ButtonRelease> {
set sel_drive [ .wineconf.can01.lis23 nearest %y]
#enable related button
.wineconf.can01.but30 configure -state normal
.wineconf.can01.but29 configure -state normal
# disable the tow CLEAR buttons of ports:
.wineconf.can54.but70 configure -state disabled
.wineconf.can53.but64 configure -state disabled
}
bind .wineconf.can01.lis24 <ButtonRelease> {
set sel_drive [ .wineconf.can01.lis23 nearest %y]
.wineconf.can01.lis23 selection set $sel_drive
.wineconf.can01.but30 configure -state normal
.wineconf.can01.but29 configure -state normal
# disable the tow CLEAR buttons of ports:
.wineconf.can54.but70 configure -state disabled
.wineconf.can53.but64 configure -state disabled
}
bind .wineconf.can01.lis25 <ButtonRelease> {
set sel_drive [ .wineconf.can01.lis23 nearest %y]
.wineconf.can01.lis23 selection set $sel_drive
.wineconf.can01.but30 configure -state normal
.wineconf.can01.but29 configure -state normal
# disble the tow CLEAR buttons of ports:
.wineconf.can54.but70 configure -state disabled
.wineconf.can53.but64 configure -state disabled
}
bind .wineconf.can01.lis26 <ButtonRelease> {
set sel_drive [ .wineconf.can01.lis23 nearest %y]
.wineconf.can01.lis23 selection set $sel_drive
.wineconf.can01.but30 configure -state normal
.wineconf.can01.but29 configure -state normal
# disble the tow CLEAR buttons of ports:
.wineconf.can54.but70 configure -state disabled
.wineconf.can53.but64 configure -state disabled
}
place .wineconf.can01.but28 \
-x 375 -y 44 -width 60 -height 28 -anchor nw -bordermode ignore
place .wineconf.can01.but29 \
-x 375 -y 76 -width 60 -height 28 -anchor nw -bordermode ignore
place .wineconf.can01.but30 \
-x 375 -y 110 -width 60 -height 28 -anchor nw -bordermode ignore
place .wineconf.can01.lab31 \
-x 13 -y 36 -width 128 -height 20 -anchor nw -bordermode ignore
place .wineconf.can01.lab32 \
-x 140 -y 36 -width 83 -height 20 -anchor nw -bordermode ignore
place .wineconf.can01.lab33 \
-x 223 -y 36 -width 68 -height 20 -anchor nw -bordermode ignore
place .wineconf.can01.lab34 \
-x 290 -y 36 -width 68 -height 20 -anchor nw -bordermode ignore
place .wineconf.can01.but51 \
-x 375 -y 141 -width 60 -height 28 -anchor nw -bordermode ignore
#placing wine sctions widgets:
place .wineconf.can37 \
-x 5 -y 230 -width 449 -height 115 -anchor nw -bordermode ignore
place .wineconf.can37.lab39 \
-x 3 -y 1 -width 443 -height 20 -anchor nw -bordermode ignore
place .wineconf.can37.lab40 \
-x 7 -y 29 -width 58 -height 20 -anchor nw -bordermode ignore
place .wineconf.can37.lab41 \
-x 7 -y 55 -width 58 -height 20 -anchor nw -bordermode ignore
place .wineconf.can37.but42 \
-x 7 -y 84 -width 248 -height 20 -anchor nw -bordermode ignore
place .wineconf.can37.but43 \
-x 375 -y 80 -width 60 -height 28 -anchor nw -bordermode ignore
place .wineconf.can37.ent45 \
-x 74 -y 26 -width 150 -height 24 -anchor nw -bordermode ignore
place .wineconf.can37.ent46 \
-x 74 -y 52 -width 150 -height 24 -anchor nw -bordermode ignore
place .wineconf.can37.lab47 \
-x 239 -y 29 -width 58 -height 20 -anchor nw -bordermode ignore
place .wineconf.can37.lab48 \
-x 239 -y 54 -width 58 -height 20 -anchor nw -bordermode ignore
place .wineconf.can37.ent49 \
-x 304 -y 26 -width 135 -height 24 -anchor nw -bordermode ignore
place .wineconf.can37.ent50 \
-x 304 -y 52 -width 135 -height 24 -anchor nw -bordermode ignore
#placing serialports sections widgets:
place .wineconf.can53 \
-x 9 -y 356 -width 144 -height 180 -anchor nw -bordermode ignore
place .wineconf.can53.lab57 \
-x 3 -y 3 -width 138 -height 20 -anchor nw -bordermode ignore
place .wineconf.can53.lis58 \
-x 3 -y 25 -width 40 -height 83 -anchor nw -bordermode ignore
place .wineconf.can53.lis59 \
-x 44 -y 25 -width 85 -height 83 -anchor nw -bordermode ignore
# bind lis59 to select lis58 at the same time...
bind .wineconf.can53.lis58 <ButtonRelease> {
set sel_com [ .wineconf.can53.lis58 nearest %y]
.wineconf.can53.lis58 selection set $sel_com
#disbale other list related buttons:
.wineconf.can01.but30 configure -state disabled
.wineconf.can01.but29 configure -state disabled
# disable/enable the tow CLEAR buttons of ports:
.wineconf.can54.but70 configure -state disabled
.wineconf.can53.but64 configure -state normal
}
# bind lis58 to select lis59 at the same time...
bind .wineconf.can53.lis59 <ButtonRelease> {
set sel_com [ .wineconf.can53.lis59 nearest %y]
.wineconf.can53.lis58 selection set $sel_com
#disbale other list related buttons:
.wineconf.can01.but30 configure -state disabled
.wineconf.can01.but29 configure -state disabled
# disable/enable the tow CLEAR buttons of ports:
.wineconf.can54.but70 configure -state disabled
.wineconf.can53.but64 configure -state normal
}
place .wineconf.can53.scr60 \
-x 123 -y 26 -width 16 -height 80 -anchor nw -bordermode ignore
place .wineconf.can53.but63 \
-x 10 -y 115 -width 60 -height 28 -anchor nw -bordermode ignore
place .wineconf.can53.but64 \
-x 78 -y 115 -width 60 -height 28 -anchor nw -bordermode ignore
place .wineconf.can53.help \
-x 10 -y 145 -width 130 -height 28 -anchor nw -bordermode ignore
#placing parallelports sections widgets:
place .wineconf.can54 \
-x 160 -y 356 -width 144 -height 180 -anchor nw -bordermode ignore
place .wineconf.can54.lab65 \
-x 1 -y 3 -width 143 -height 20 -anchor nw -bordermode ignore
place .wineconf.can54.lis67 \
-x 5 -y 26 -width 45 -height 83 -anchor nw -bordermode ignore
place .wineconf.can54.lis68 \
-x 50 -y 25 -width 75 -height 83 -anchor nw -bordermode ignore
# bind lis67
bind .wineconf.can54.lis68 <ButtonRelease> {
set sel_port [ .wineconf.can53.lis59 nearest %y]
#disbale other list related buttons:
.wineconf.can01.but30 configure -state disabled
.wineconf.can01.but29 configure -state disabled
# disable/enable the tow CLEAR buttons of ports:
.wineconf.can54.but70 configure -state normal
.wineconf.can53.but64 configure -state disabled
}
# bind lis68 to select lis67 at the same time...
bind .wineconf.can54.lis67 <ButtonRelease> {
set sel_port [ .wineconf.can53.lis59 nearest %y]
.wineconf.can54.lis67 selection set $sel_port
#disbale other list related buttons:
.wineconf.can01.but30 configure -state disabled
.wineconf.can01.but29 configure -state disabled
# disable/enable the tow CLEAR buttons of ports:
.wineconf.can54.but70 configure -state normal
.wineconf.can53.but64 configure -state disabled
}
place .wineconf.can54.but69 \
-x 10 -y 115 -width 60 -height 28 -anchor nw -bordermode ignore
place .wineconf.can54.but70 \
-x 78 -y 115 -width 60 -height 28 -anchor nw -bordermode ignore
place .wineconf.can54.scr71 \
-x 123 -y 26 -width 16 -height 80 -anchor nw -bordermode ignore
place .wineconf.can54.help \
-x 10 -y 145 -width 130 -height 28 -anchor nw -bordermode ignore
#placing spy and Tweak.Layout sections widgets:
place .wineconf.can55 \
-x 313 -y 357 -width 139 -height 180 -anchor nw -bordermode ignore
place .wineconf.can55.lab72 \
-x 3 -y 3 -width 133 -height 20 -anchor nw -bordermode ignore
place .wineconf.can55.ent74 \
-x 5 -y 25 -width 130 -height 24 -anchor nw -bordermode ignore
place .wineconf.can55.but75 \
-x 5 -y 50 -width 130 -height 28 -anchor nw -bordermode ignore
place .wineconf.can55.lab76 \
-x 3 -y 83 -width 133 -height 20 -anchor nw -bordermode ignore
place .wineconf.can55.men78 \
-x 10 -y 110 -width 122 -height 24 -anchor nw -bordermode ignore
place .wineconf.can55.help \
-x 5 -y 145 -width 130 -height 28 -anchor nw -bordermode ignore
#Main window buttons:
pack .wineconf.but80 -padx 5 -pady 1 -side bottom -fill x
pack .wineconf.save -padx 5 -side bottom -fill x
# initialise the arrays
TkW:initarrays
# Now start reading the .winerc (or the default wine.ini)
TkW:readwinerc $DefaultConfFile
# Set the listboxes:
TkW:setboxes
#updates the scollings
set WAITconf 1
while {$WAITconf == 1} { TkW:scrollwindows }
}
proc TkW:readwinerc {DefaultConfFile} {
global sect ndrives drive n rcout line wine_logfile winelook
global nspool nalias srcdest TKW
TkW:debug "Entering readwinerc -----------------------------"
# OPEN THE FILE Read-Only:
TkW:fixme "TkW:wineconf::\
Detection of wine.ini will fail when ~/.winerc ~/wine.conf not there"
if {[file exist $DefaultConfFile] } then {
set winerc [open $DefaultConfFile r]
} else {
TkW:message "No file $DefaultConfFile... This is a TkWine error"
return
}
# Adds a fe setting in case they're missing (actually, they are in the std file) in the wine.ini
set winelook Win95
set wine_logfile /tmp/winelog
# OPEN /tmp/tkwwinerc for writting
set rcout [open /tmp/tkwinerc w]
set ndrives -1
set nspool 0
set nalias -1
global NDllOver NDllPairs DllPairs DllOver
set NDllOver 0
set NDllPairs 0
# Read line by line
set charread 0
while {$charread != -1} {
set charread [gets $winerc line]
set line [string trim $line]
set n [expr $charread - 1]
set idok 0
TkW:debug "READ:$line-$charread"
if {[string match ";*" $line]} {
#puts $rcout $line
TkW:debug Comment; set idok 1}
# The two lines below SHOULD work... they don't
#if {[string match "\[*\]" $line]} \
#{TkW:debug Section;set idok 1}
## a ugly replacement:
if {"[string range $line 0 0][string range $line $n $n]"\
== "\[\]"} {
TkW:sections
set idok 1
}
if {$idok != 1 && [string match "*=*" $line]} {
TkW:assign
TkW:debug Assignment
set idok 1
}
if {!$idok && $charread > 0} {
TkW:debug "Error::Unknow line in .winerc"
puts "************Warning: Error in config \
file ****************"
puts "Line $line incomprehensible"
}
}
}
proc TkW:sections {} {
global sect ndrives drive n rcout line
global drivepath drivelabel drivetype drivefstype driveserial drivedevice
set sect [string tolower [string range $line 1 [expr $n - 1]]]
if {[string tolower [string range $sect 0 4]] == "drive"} {
set ndrives [expr $ndrives + 1]
set drive($ndrives) [string range $sect 6 6]
set drivepath($ndrives) ""
set drivelabel($ndrives) ""
set drivetype($ndrives) ""
set drivefstype($ndrives) ""
set driveserial($ndrives) ""
set drivedevice($ndrives) ""
set sect drive
TkW:debug "Section $sect $drive($ndrives)"
#puts $rcout "\[$sect $drive($ndrives)\]"
} else {
TkW:debug "Section $sect"
#puts $rcout "\[$sect]"
}
}
proc TkW:assign {} {
global sect ndrives drive n rcout line
global windowspath varpath syspath tmppath symbols winelook
global ndrives drive drivepath drivetype drivefstype drivelabel
global drivedevice driveserial
global resolution defaultfont
global readport writeport
global exclude default_progs startup allocsyscolors winelook wine_logfile
global com lpt spool nspool alias nalias
global NDllOver NDllPairs
global DllOver DllPairs
set equalis [string first "=" $line ]
set varname [string tolower [string trim [string range $line 0 [expr $equalis - 1]]]]
set value [string trim [string range $line [expr $equalis + 1] $n]]
if {$varname == "default"} {set varname Default}
switch $varname {
{path} {
switch $sect {
{drive} {set drivepath($ndrives) $value}
{wine} {set varpath $value;update}
{default} {TkW:conferror $sect $varname $value}
}
}
{type} {
if {$sect != "drive"} then {
TkW:conferror $sect $varname $value
} else {
set drivetype($ndrives) $value
}
}
{label} {
if {$sect != "drive"} then {
TkW:conferror $sect $varname $value
} else {
set drivelabel($ndrives) $value
}
}
{serial} {
if {$sect != "drive"} then {
TkW:conferror $sect $varname $value
} else {
set driveserial($ndrives) $value
}
}
{filesystem} {
if {$sect != "drive"} then {
TkW:conferror $sect $varname $value
} else {
set drivefstype($ndrives) $value
}
}
{device} {
if {$sect != "drive"} then {
TkW:conferror $sect $varname $value
} else {
set drivedevice($ndrives) $value
}
}
{windows} {
if {$sect != "wine"} then {
TkW:conferror $sect $varname $value
} else {
set windowspath $value
}
}
{system} {
if {$sect != "wine"} then {
TkW:conferror $sect $varname $value
} else {
set syspath $value
}
}
{temp} {
if {$sect != "wine"} then {
TkW:conferror $sect $varname $value
} else {
set tmppath $value
}
}
{symboltablefile} {
if {$sect != "wine"} then {
TkW:conferror $sect\
$varname $value
} else {
set symbols $value
}
}
{resolution} {
if {$sect != "fonts"} then {
TkW:conferror $sect $varname $value
} else {
set resolution $value
}
}
{Default} {
switch $sect {
{fonts} { set defaultfont $value}
{programs} {set default_progs $value}
{default} { TkW:conferror \
$sect $varname $value }
}
}
{read} {
if {$sect != "ports"} then {
TkW:conferror $sect $varname $value
} else {
set readport $value
}
}
{write} {
if {$sect != "ports"} then {
TkW:conferror $sect $varname $value
} else {
set writeport $value
}
}
{file} {
if {$sect != "spy"} then {
TkW:conferror $sect $varname $value
} else {
set wine_logfile $value
}
}
{exclude} {
if {$sect != "spy"} then {
TkW:conferror $sect $varname $value
} else {
set Exclude $value
}
}
{allocsystemcolors} {
if {$sect != "options"} then {
TkW:conferror $sect $varname\
$value
} else {
set allocsyscolors $value
}
}
{winelook} {
if {$sect != "tweak.layout"} then {
TkW:conferror $sect $varname\
$value
} else {
set winelook $value
}
}
{startup} {
if {$sect != "programs"} then {
TkW:conferror $sect $varname\
$value
} else {
set startup $value
}
}
{printer} {
if {$sect != "wine"} then {
TkW:conferror $sect $varname\
$value
} else {
set printer $value
}
}
{default} {
if {$sect == "dllpairs"} {
set NDllPairs [expr $NDllPairs + 1]
set DllPairs($NDllPairs) "$varname = $value"
return
}
if {$sect == "dlloverrides"} {
set NDllOver [expr $NDllOver + 1]
set DllOver($NDllOver) "$varname = $value"
return
}
if {[string tolower [string trim [string range $line 0 2]]] == "lpt" && [string range $line 4 4 ] == ":" } {
if {$sect != "spooler"} then {
TkW:conferror $sect $varname $value
} else {
set nspool [expr $nspool + 1]
set spool($nspool) $value
}
return
}
set varname2 [string tolower [string trim \
[string range $line 0 [expr $equalis - 2]]]]
set letter [string tolower [string range $line [expr $equalis - 1]\
[expr $equalis - 1] ]]
#set varname2 [string tolower $varname2]
switch $varname2 {
{com} {
if {$sect != "serialports"} then {
TkW:conferror $sect $varname\
$value
} else {
set com($letter) $value
}
}
{lpt} {
if {$sect != "parallelports"} then {
TkW:conferror $sect $varname\
$value
} else {
set lpt($letter) $value
}
}
{alias} {
if {$sect != "fonts"} then {
TkW:conferror $sect $varname\
$value
} else {
set nalias [expr $nalias + 1]
set alias($nalias) $value
}
}
{default} {
TkW:conferror $sect $varname $value
}
}
}
}
}
proc TkW:conferror {sect varname value} {
puts "ERROR IN CONFIG FILE, FOUND $varname=$value in section $sect"
}
proc TkW:setboxes {} {
global ndrives drive drivepath drivetype drivefstype drivelabel
global drivedevice driveserial
global com lpt
.wineconf.can01.lis23 delete 0 end
.wineconf.can01.lis24 delete 0 end
.wineconf.can01.lis25 delete 0 end
.wineconf.can01.lis26 delete 0 end
for {set i 0} {$i <= $ndrives } {set i [expr $i + 1]} {
TkW:debug "Drive $i : $drive($i) $drivepath($i) $drivetype($i)\
$drivelabel($i)"
TkW:debug " $drivefstype($i) $drivedevice($i) $driveserial($i)"
set yes " "
if {![file isdirectory $drivepath($i)]} {set yes "*"}
.wineconf.can01.lis23 insert end \
"$yes\($drive($i):\\) $drivepath($i) "
.wineconf.can01.lis24 insert end \
"$yes$drivetype($i)"
.wineconf.can01.lis25 insert end \
"$yes$drivelabel($i)"
.wineconf.can01.lis26 insert end \
"$yes$drivefstype($i)"
}
.wineconf.can53.lis59 delete 0 end
.wineconf.can53.lis58 delete 0 end
for {set i 1} {$i <= 8 } {set i [expr $i + 1]} {
.wineconf.can53.lis58 insert end "com$i"
.wineconf.can53.lis59 insert end $com($i)
}
.wineconf.can54.lis67 delete 0 end
.wineconf.can54.lis68 delete 0 end
for {set i 1} {$i <= 8 } {set i [expr $i + 1]} {
.wineconf.can54.lis67 insert end "lpt$i"
.wineconf.can54.lis68 insert end $lpt($i)
}
}
proc TkW:scrollwindows {} {
global OldPos
if {![info exists OldPos]} {set OldPos 0}
# Serial
set lis58pos [.wineconf.can53.lis59 yview]; set a 1
foreach i $lis58pos { if {$a} {set pos $i}; set a 0 }
.wineconf.can53.lis58 yview moveto $pos
# // ports
set lis67pos [.wineconf.can54.lis67 yview]; set a 1
foreach i $lis67pos { if {$a} {set pos $i}; set a 0 }
.wineconf.can54.lis68 yview moveto $pos
# drives:
set lis23pos [.wineconf.can01.lis23 yview]; set a 1
foreach i $lis23pos { if {$a} {set pos $i}; set a 0 }
if {$lis23pos != $OldPos} {
TkW:debug "listbox23 has move from $OldPos to $lis23pos"
TkW:debug "listbox24 goes to $pos "
}
set OldPos $lis23pos
.wineconf.can01.lis24 yview moveto $pos
.wineconf.can01.lis25 yview moveto $pos
.wineconf.can01.lis26 yview moveto $pos
update
}
proc TkW:initarrays {} {
global com lpt spool
for {set i 1 } {$i <= 8 } {set i [expr $i + 1]} {
set com($i) ""
set lpt($i) ""
}
for {set i 1 } {$i <= 8 } {set i [expr $i + 1]} {
set spool($i) ""
}
}
proc TkW:editports {comlpt} {
global OK CANCEL com portch lpt lptcom win banner TKW
global WC_confserial WC_confparallel WC_PPbanner WC_serialbanner
.wineconf.can54.but69 configure -state disabled
.wineconf.can53.but63 configure -state disabled
# this is a ugly trick as buttons command need a global variable, not an arg
set lptcom $comlpt
if {$comlpt == "com"} then {
set win .comedit
set title $WC_confserial
set banner $WC_serialbanner
} else {
set win .lptedit
set title $WC_confparallel
set banner $WC_PPbanner
}
toplevel $win -class Toplevel \
-background #3c1cfe
wm focusmodel $win passive
wm geometry $win 205x365+448+253
wm maxsize $win 1265 994
wm minsize $win 1 1
wm overrideredirect $win 0
wm resizable $win 1 1
wm deiconify $win
wm title $win $title
#wm iconbitmap $win @$TKW/setupfiles/images/setup2.xbm
#wm iconmask $win @$TKW/setupfiles/images/setupmask2.xbm
# creating the Banner
label "$win.banner" \
-background #dc96dc \
-font -Adobe-Helvetica-Medium-R-Normal-*-*-120-*-*-*-*-*-*\
-relief groove -text $banner
# creating the labels and entries
for {set i 1} {$i <= 8} {set i [expr $i + 1 ]} {
set portch($i) $com($i)
if {$comlpt == "com"} then {
set portch($i) $com($i)
} else {
set portch($i) $lpt($i)
}
label "$win.lab$i" \
-background #dc96dc \
-font -Adobe-Helvetica-Medium-R-Normal-*-*-120-*-*-*-*-*-*\
-relief groove -text "Com$i"
entry "$win.ent$i" \
-font -Adobe-Helvetica-Medium-R-Normal-*-*-120-*-*-*-*-*-*\
-textvariable portch($i)
set Y [expr 55 + $i * 30]
place "$win.lab$i"\
-x 5 -y $Y -width 45 -height 28 \
-anchor nw -bordermode ignore
place "$win.ent$i"\
-x 55 -y $Y -width 145 -height 28 \
-anchor nw -bordermode ignore
}
button $win.but80 \
-command {
for {set i 1} {$i <= 8} {set i [expr $i + 1]} {
if {$lptcom == "com"} then {
set com($i) $portch($i)
} else {
set lpt($i) $portch($i)
}
.wineconf.can54.but69 configure -state normal
.wineconf.can53.but63 configure -state normal
}
destroy $win
TkW:setboxes
} \
-font -Adobe-Helvetica-Medium-R-Normal-*-*-120-*-*-*-*-*-*\
-padx 9 -pady 3 -text button -textvariable OK
place $win.banner -x 5 -y 5 -width 195 -height 70
place $win.but80 \
-x 5 -y 335 -width 100 -height 28 \
-anchor nw -bordermode ignore
button $win.but81 \
-command {destroy $win
.wineconf.can54.but69 configure -state normal
.wineconf.can53.but63 configure -state normal
}\
-font -Adobe-Helvetica-Medium-R-Normal-*-*-120-*-*-*-*-*-*\
-padx 9 -pady 3 -text button -textvariable CANCEL \
place $win.but81 \
-x 105 -y 335 -width 100 -height 28 \
-anchor nw -bordermode ignore
}
proc TkW:drives {n} {
global ndrives drive drivepath drivetype drivefstype drivelabel
global drivedevice driveserial TKW
global WC_confdrives HELP WCHLP WC_driveSetBanner
global chdrives1 chdrives2 chdrives3 chdrives4
global chdrives5 chdrives6 chdrives7
global win i num ch drOK
set chdrives(1) $chdrives1
set chdrives(2) $chdrives2
set chdrives(3) $chdrives3
set chdrives(4) $chdrives4
set chdrives(5) $chdrives5
set chdrives(6) $chdrives6
set chdrives(7) $chdrives7
if {$n == "new"} then {
set num [expr $ndrives + 1]
set ch(1) ""
set ch(2) ""
set ch(3) ""
set ch(4) ""
set ch(5) ""
set ch(6) ""
set ch(7) ""
} else {
set num $n
set ch(1) $drive($num)
set ch(2) $drivepath($num)
set ch(3) $drivetype($num)
set ch(4) $drivefstype($num)
set ch(5) $drivelabel($num)
set ch(6) $drivedevice($num)
set ch(7) $driveserial($num)
}
TkW:debug "Entering TkW:drives - drive number: $num"
.wineconf.can01.but28 configure -state disabled
.wineconf.can01.but29 configure -state disabled
.wineconf.can01.but30 configure -state disabled
# re-enable the tow EDIT buttons of ports:
.wineconf.can54.but69 configure -state disabled
.wineconf.can53.but63 configure -state disabled
set win .drivedit
set title $WC_confdrives
toplevel $win -class Toplevel \
-background #3c1cfe
wm focusmodel $win passive
wm geometry $win 305x325+448+253
wm maxsize $win 1265 994
wm minsize $win 1 1
wm overrideredirect $win 0
wm resizable $win 1 1
wm deiconify $win
wm title $win $title
#wm iconbitmap $win @$TKW/setupfiles/images/setup2.xbm
#wm iconmask $win @$TKW/setupfiles/images/setupmask2.xbm
# setting the banner:
label "$win.banner" \
-background #dc96dc \
-font -Adobe-Helvetica-Medium-R-Normal-*-*-120-*-*-*-*-*-*\
-relief groove -text $WC_driveSetBanner -height 35
# creating the labels and entries
# setting HELP buttons
button $win.hlp1\
-font -Adobe-Helvetica-Medium-R-Normal-*-*-120-*-*-*-*-*-*\
-padx 9 -pady 3 -text button -textvariable HELP \
-command {TkW:message $WCHLP(1)}
button $win.hlp2\
-font -Adobe-Helvetica-Medium-R-Normal-*-*-120-*-*-*-*-*-*\
-padx 9 -pady 3 -text button -textvariable HELP \
-command {TkW:message $WCHLP(2)}
button $win.hlp3\
-font -Adobe-Helvetica-Medium-R-Normal-*-*-120-*-*-*-*-*-*\
-padx 9 -pady 3 -text button -textvariable HELP \
-command {TkW:message $WCHLP(3)}
button $win.hlp4\
-font -Adobe-Helvetica-Medium-R-Normal-*-*-120-*-*-*-*-*-*\
-padx 9 -pady 3 -text button -textvariable HELP \
-command {TkW:message $WCHLP(4)}
button $win.hlp5\
-font -Adobe-Helvetica-Medium-R-Normal-*-*-120-*-*-*-*-*-*\
-padx 9 -pady 3 -text button -textvariable HELP \
-command {TkW:message $WCHLP(5)}
button $win.hlp6\
-font -Adobe-Helvetica-Medium-R-Normal-*-*-120-*-*-*-*-*-*\
-padx 9 -pady 3 -text button -textvariable HELP \
-command {TkW:message $WCHLP(6)}
button $win.hlp7\
-font -Adobe-Helvetica-Medium-R-Normal-*-*-120-*-*-*-*-*-*\
-padx 9 -pady 3 -text button -textvariable HELP \
-command {TkW:message $WCHLP(7)}
for {set i 1} {$i <= 7} {set i [expr $i + 1 ]} {
label "$win.lab$i" \
-background #dc96dc \
-font -Adobe-Helvetica-Medium-R-Normal-*-*-120-*-*-*-*-*-*\
-relief groove -text $chdrives($i)
if {$i < 3 || $i > 4} then {
entry "$win.ent$i" \
-font -Adobe-Helvetica-Medium-R-Normal-*-*-120-*-*-*-*-*-*\
-text text -textvariable ch($i)
} else {
menubutton $win.ent$i \
-font -Adobe-Helvetica-Medium-R-Normal-*-*-120-*-*-*-*-*-* \
-menu $win.ent$i.m -padx 4 -pady 3 \
-text text -textvariable ch($i)
}
# settings the menus:
if {$i == 3} then {
menu $win.ent$i.m \
-cursor {} \
-font -Adobe-Helvetica-Medium-R-Normal-*-*-120-*-*-*-*-*-*
$win.ent$i.m add command \
-command {set ch(3) "hd"} -label {Hard Drive}
$win.ent$i.m add command \
-command {set ch(3) "floppy"} -label {Floppy}
$win.ent$i.m add command \
-command {set ch(3) "cdrom"} -label {CDrom}
$win.ent$i.m add command \
-command {set ch(3) "network"} \
-label {network}
}
if {$i == 4} then {
menu $win.ent$i.m \
-cursor {} \
-font -Adobe-Helvetica-Medium-R-Normal-*-*-120-*-*-*-*-*-*
$win.ent$i.m add command \
-command {set ch(4) "msdos"} -label {msdos}
$win.ent$i.m add command \
-command {set ch(4) "win95"} -label {Win95}
$win.ent$i.m add command \
-command {set ch(4) "Unix"} -label {Unix}
}
set Y [expr 40 + $i * 30]
place "$win.lab$i"\
-x 5 -y $Y -width 145 -height 28 \
-anchor nw -bordermode ignore
place "$win.ent$i"\
-x 150 -y $Y -width 85 -height 28 \
-anchor nw -bordermode ignore
place "$win.hlp$i"\
-x 235 -y $Y -width 55 -height 28 \
-anchor nw -bordermode ignore
}
button $win.but80 \
-command {
TkW:checkdrives
if {$drOK} {
set drive($num) $ch(1)
set drivepath($num) $ch(2)
set drivetype($num) $ch(3)
set drivefstype($num) $ch(4)
set drivelabel($num) $ch(5)
set drivedevice($num) $ch(6)
set driveserial($num) $ch(7)
destroy $win
if {$num > $ndrives} {set ndrives $num}
TkW:setboxes
.wineconf.can01.but28 configure -state normal
# re-enable the tow EDIT buttons of ports:
.wineconf.can54.but69 configure -state normal
.wineconf.can53.but63 configure -state normal
}
} \
-font -Adobe-Helvetica-Medium-R-Normal-*-*-120-*-*-*-*-*-*\
-padx 9 -pady 3 -text button -textvariable OK \
place $win.but80 \
-x 5 -y 290 -width 145 -height 28 \
-anchor nw -bordermode ignore
button $win.but81 \
-command {
destroy $win
.wineconf.can01.but28 configure -state normal
#.wineconf.can01.but29 configure -state normal
#.wineconf.can01.but30 configure -state normal
# re-enable the tow EDIT buttons of ports:
#.wineconf.can54.but69 configure -state normal
#.wineconf.can53.but63 configure -state normal
}\
-font -Adobe-Helvetica-Medium-R-Normal-*-*-120-*-*-*-*-*-*\
-padx 9 -pady 3 -text button -textvariable CANCEL \
place $win.but81 \
-x 150 -y 290 -width 145 -height 28 \
-anchor nw -bordermode ignore
place $win.banner -width 290 -height 35 -x 5 -y 5
}
proc TkW:checkdrives {} {
global ndrives ch num drOK drive
global WC_givepath WC_oneletter WC_usedletter WC_11letters
if {[string length $ch(1)] != 1} {
TkW:message "$ch(1) $WC_oneletter"
set drOK 0
return
}
if {[string length $ch(5)] > 11} {
TkW:message "$ch(5) $WC_11letters"
set drOK 0
return
}
for {set i 0} {$i <=$ndrives} {set i [expr $i + 1]} {
if {$i != $num && [string tolower $ch(1)]\
== [string tolower $drive($i)] } {
TkW:message "$ch(1)$WC_usedletter"
set drOK 0
return
}
}
if { $ch(2) == ""} {TkW:message $WC_givepath; set drOK 0;return}
if { $ch(3) == ""} {set ch(3) hd}
if { $ch(4) == ""} {set ch(4) unix}
if { $ch(5) == ""} {set ch(5) "Drive $ch(1)"}
set drOK 1
}
proc TkW:editWinePath {} {
global OK varpath WC_editPathBanner WC_pathtitle TKW
TkW:debug "Entering TkW:editWinePath with path set to $varpath"
global ndrives dri
# Create the toplevel
toplevel .editpath -class Toplevel \
-background #3c1cfe
wm focusmodel .editpath passive
wm geometry .editpath 410x100+448+253
wm maxsize .editpath 1265 994
wm minsize .editpath 1 1
wm overrideredirect .editpath 0
wm resizable .editpath 1 1
wm deiconify .editpath
wm title .editpath $WC_pathtitle
#wm iconbitmap .editpath @$TKW/setupfiles/images/setup2.xbm
#wm iconmask .editpath @$TKW/setupfiles/images/setupmask2.xbm
#Creates the Banner
label .editpath.banner \
-background #dc96dc \
-font -Adobe-Helvetica-Medium-R-Normal-*-*-120-*-*-*-*-*-*\
-relief groove -text $WC_editPathBanner
#Creates the entry box
entry .editpath.ent \
-background #dc96dc \
-font -Adobe-Helvetica-Medium-R-Normal-*-*-120-*-*-*-*-*-*\
-relief groove -textvariable varpath
#Creates OK button
button .editpath.ok\
-background #dc96dc \
-font -Adobe-Helvetica-Medium-R-Normal-*-*-120-*-*-*-*-*-*\
-relief groove -text $OK -command {destroy .editpath}
place .editpath.banner -x 5 -y 5 -width 400 -height 30
place .editpath.ent -x 5 -y 40 -width 400 -height 30
place .editpath.ok -x 5 -y 70 -width 400 -height 30
}
proc TkW:writewinerc {} {
global windowspath varpath syspath tmppath symbols winelook
global ndrives drive drivepath drivetype drivefstype drivelabel
global drivedevice driveserial
global resolution defaultfont HOME
global readport writeport
global exclude default_progs startup allocsyscolors winelook wine_logfile
global com lpt spool nspool alias nalias
global NDllPairs NDllOver DllPairs DllOver
# open file for writing:;;
# move the old file:
if {[file exists ~/.winerc]} {
set free 1
while {[file exists ~/.winerc.$free]} {
set free [expr $free + 1]
}
exec mv -f $HOME/.winerc $HOME/.winerc.$free
}
set out [open ~/.winerc w]
# writes drives
# Puts the usual comments:
puts $out ";;"
puts $out ";; MS-DOS drives configuration "
puts $out ";;"
puts $out ";; Each section has the following format:"
puts $out ";; \[Drive X\]"
puts $out ";; Path=xxx (Unix path for drive root)"
puts $out ";; Type=xxx (supported types are 'floppy', 'hd', 'cdrom' and 'network')"
puts $out ";; Label=xxx (drive label, at most 11 characters)"
puts $out ";; Serial=xxx (serial number, 8 characters hexadecimal number)"
puts $out ";; Filesystem=xxx (supported types are 'msdos','win95','unix')"
puts $out ";; Device=/dev/xx (only if you want to allow raw device access)"
puts $out ";; "
for {set i 0} {$i <= $ndrives} {set i [expr $i + 1]} {
puts $out "\[Drive $drive($i)\]"
puts $out "Path=$drivepath($i)"
puts $out "Type=$drivetype($i)"
puts $out "Label=$drivelabel($i)"
if {$drivefstype($i) == ""} {set drivefstype($i) unix}
puts $out "Filesystem=$drivefstype($i)"
if {$driveserial($i) != "" } {puts $out "Serial=$driveserial($i)"}
if {$drivedevice($i) != "" } {puts $out "Device=$drivedevice($i)"}
puts $out ""
}
#write wine section
puts $out "\[wine\]"
puts $out "Windows=$windowspath"
puts $out "System=$syspath"
puts $out "Temp=$tmppath"
puts $out "Path=$varpath"
puts $out "SymbolTableFile=$symbols"
puts $out ""
# write options
TkW:fixme "Option not supported in wineconf, write de default"
puts $out "\[options\]"
puts $out "AllocSystemColors=$allocsyscolors"
puts $out ""
# DllPairs:
puts $out "\[DllPairs\]"
for {set i 1} {$i <= $NDllPairs} {set i [expr $i + 1]} {
puts $out $DllPairs($i)
}
puts $out
# DllOverrides:
puts $out "\[DllOverrides\]"
for {set i 1} {$i <= $NDllOver} {set i [expr $i + 1]} {
puts $out $DllOver($i)
}
puts $out
# write fonts section
TkW:fixme "fonts support to be added to wineconf...."
puts $out "\[fonts\]"
puts $out ";Read documentation/fonts before adding aliases"
puts $out "Resolution = $resolution"
puts $out "Default = $defaultfont"
puts $out ""
# write serial
puts $out "\[serialports\]"
for {set i 1} {$i <= 8} {set i [expr $i + 1]} {
if {$com($i) != ""} {puts $out "Com$i=$com($i)"}
}
puts $out ""
# write parallel
puts $out "\[parallelports\]"
for {set i 1} {$i <= 8} {set i [expr $i + 1]} {
if {$lpt($i) != ""} {puts $out "Lpt$i=$lpt($i)"}
}
puts $out ""
# write spooler
puts $out "\[spooler\]"
for {set i 1} {$i <= 8} {set i [expr $i + 1]} {
if {$spool($i) != ""} {puts $out "LPT$i:=$spool($i)"}
}
puts $out ""
# write ports
puts $out "\[ports]"
if {[info exists readport]} {puts $out $readport} {puts $out ";read=0x779,0x379,0x280-0x2a0"}
if {[info exists writeport]} {puts $out $writeport} {puts $out ";write=0x779,0x379,0x280-0x2a0"}
puts $out ""
#write spy
puts $out "\[spy\]"
puts $out "file=$wine_logfile"
if {[info exists exclude]} {puts $out "Exclude=$exclude"} {puts $out "Exclude=WM_SIZE;WM_TIMER;"}
puts $out ""
#write Tweak.Layout
puts $out "\[Tweak.Layout\]"
puts $out ";; WineLook=xxx (supported styles are \'Win31\'(default), \'Win95\', \'Win98\')"
puts $out "WineLook=Win95"
}
proc TkW:delDrive {n} {
global ndrives drive drivepath drivetype drivefstype drivelabel
global drivedevice driveserial
TkW:debug "Remove drive [expr $n + 1]"
for {set i $n} {$i<$ndrives} {set i [expr $i +1]} {
set i1 [expr $i + 1]
set drive($i) $drive($i1)
set drivepath($i) $drivepath($i1)
set drivelabel($i) $drivelabel($i1)
set drivetype($i) $drivetype($i1)
set drivefstype($i) $drivefstype($i1)
set driveserial($i) $driveserial($i1)
}
set ndrives [expr $ndrives - 1]
TkW:setboxes
}
proc TkW:debug {msg} {
}
proc TkW:fixme {msg} {
}
proc TkW:wineconf1 {} {
# propmt the user for a choice of the default config file:
# can be:
# Existing {--> menu ~/.winerc or /etc/wineconf or custom}
# autogenarated with tools/wineconf
# built-in the script
# test of existing is preformed first; test of existing wineconf also
#
set ExistEtc [TkW:ListConfig /etc/wine.conf]
set ExistHome [TkW:ListConfig "~/.winerc"]
TkW:AskUserConfMethod $ExistEtc $ExistHome
tkwait vis .askConf
while [winfo exists .askConf] {update}
}
proc TkW:ListConfig {fileConf} {
global HOME
set ExistConf 0
if [file writa $fileConf] {return 1} {return 0}
}
proc TkW:AskUserConfMethod {ExistEtc ExistHome} {
global USER ChDefautConf DejaConf HOME OK CANCEL WAITfilename
global DefaultType EtcState HomeState GiveCustomDefault Default
global GetFileName GenereConf TkWBuiltConf
toplevel .askConf -backgr #ffffff
label .askConf.banner -text $ChDefautConf -backgr #0000ff \
-foregr #ffffff -height 2
pack .askConf.banner -side top -fill x
if {$USER == "root" && $ExistEtc == 1} {
set Default /etc/wine.conf
} else {
if {$ExistHome == 1} {set Default "~/.winerc"} \
else {set Default Custom}
}
if {[file writable /etc/wine.conf]} {set EtcState normal} {set EtcState disabled}
if {$ExistHome == 1} {set HomeState normal} {set HomeState disabled}
set DefaultType 0
frame .askConf.deja -width 200 -backgr #ffffff
radiobutton .askConf.deja.rad -backgr #dddddd -text $DejaConf\
-anchor nw -value 0 -variable DefaultType \
-indicatoron 1 -relief raised -selectcolor #00ff00
pack .askConf.deja.rad -side left -padx 5
menubutton .askConf.deja.men -backgr #dddddd \
-menu .askConf.deja.men.m -width 50 -text $Default\
-relief raised
menu .askConf.deja.men.m -cursor {} -tearoff 0
.askConf.deja.men.m add command \
-command {
set Default "$HOME/.winerc"
.askConf.deja.men configure -text $Default
} -label "~/.winerc" -state $HomeState
.askConf.deja.men.m add command \
-command {
set Default "/etc/wine.conf"
.askConf.deja.men configure -text $Default
} -state $EtcState \
-label "/etc/wine.conf (System wide configuration)"
.askConf.deja.men.m add command \
-command {
TkW:GetFileName $GiveCustomDefault $OK $CANCEL File
#set WAITfilename wait
#while {$WAITfilename == "wait"} {update}
if {$WAITfilename == "opt1"} {
set Default $GetFileName
}
.askConf.deja.men configure -text $Default
update
} \
-label "Custom (Give your own configuration file)"
pack .askConf.deja -padx 5 -pady 10
pack .askConf.deja.men
label .askConf.img -image wine_half -backgr #ffffff -relief flat
pack .askConf.img -side right -anchor se -padx 5 -pady 5
# Next radiobutton: tools/wineconf:
frame .askConf.radio -backgr #ffffff -relief flat
radiobutton .askConf.radio.generate -text $GenereConf\
-anchor nw -value 1 -variable DefaultType \
-selectcolor #00ff00 -relief raised
pack .askConf.radio.generate -padx 5 -pady 5 -anchor w -fill x
# Next radiobutton : TkWine Built-in
radiobutton .askConf.radio.tkwbuilt -text $TkWBuiltConf\
-anchor nw -value 2 -variable DefaultType \
-selectcolor #00ff00 -relief raised
pack .askConf.radio.tkwbuilt -padx 5 -pady 5 -anchor w -fill x
pack .askConf.radio -padx 0 -pady 0 -anchor w
# now OK or CANCEL....
frame .askConf.buttons -backgr #ffffff -relief flat -height 25
button .askConf.buttons.ok -width 8 -text $OK -command {
destroy .askConf
TkW:CallWineConf
}
button .askConf.buttons.cancel -width 8 -text $CANCEL -command {
destroy .askConf
}
pack .askConf.buttons.ok -side left -padx 25 -pady 5
pack .askConf.buttons.cancel -side left -padx 5 -pady 5
pack .askConf.buttons -anchor w -padx 5
}
proc TkW:CallWineConf {} {
global Default DefaultType TKW
switch $DefaultType {
0 {TkW:wineconf $Default}
1 {
set FoundWineConf 0
set FoundWineConf [TkW:autoconf /tmp/auto_generated_wineconf]
while {$FoundWineConf == 0} update
TkW:wineconf /tmp/auto_generated_wineconf
}
2 {TkW:wineconf $TKW/setupfiles/wine.ini}
}
}
proc TkW:GenereTmpConf {wineconfTool} {
global specialwhere
set wherearewe ConfTool
set Pipe [open "| $wineconfTool " r+]
exec rm -f /tmp/auto_generated_wineconf
set TmpConf [open /tmp/auto_generated_wineconf w]
while {![eof $Pipe]} {
gets $Pipe line
puts $TmpConf $line
}
close $TmpConf
set specialwhere CloseWineAutoConf
close $Pipe
}
#!/bin/sh
# the next line restarts using wish \
exec wish $0 ${1+"$@"}
proc load_libs {} {
global TKW
set libLIST [glob $TKW/wineconf.libs/*.tcl]
foreach i $libLIST {
uplevel #0 [list source $i]
}
}
proc load_lang { lang} {
global TKW
set langLIST [glob $TKW/wineconf.libs/*.$lang]
foreach i $langLIST {
uplevel #0 [list source $i]
}
}
global TKW
if {![info exists TKW]} {
set TKW .
wm geom . 0x0
load_libs
load_lang eng
#global TKW;set TKW [pwd]
global USER; set USER [exec whoami]
global env HOME; set HOME $env(HOME)
image create photo wine_half -file wineconf.libs/wine-half.gif
TkW:wineconf1
TkW:autoconf
exit
} else {
load_libs
load_lang eng
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment