Added graphical configuration tool wineconf.tcl.

This commit is contained in:
Jean-Louis Thirot 1999-05-08 18:39:04 +00:00 committed by Alexandre Julliard
parent 62de4b9867
commit d7da0f68ee
14 changed files with 3433 additions and 0 deletions

View File

@ -0,0 +1,8 @@
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"

View File

@ -0,0 +1,630 @@
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
}

View File

@ -0,0 +1,6 @@
set DIRBROWSE "Browse Folders"
set FolderSelection "Selection:"
set FILTERFOLD "Search Filter (Folders):"
set FILTERFILES "Search Filter (Files):"
set RESCAN Rescan
set VIEW View

View File

@ -0,0 +1,663 @@
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
}

View File

@ -0,0 +1,57 @@
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\
======================================================================="

View File

@ -0,0 +1,99 @@
#!/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
}
}

View File

@ -0,0 +1,58 @@
#!/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
}

View File

@ -0,0 +1,58 @@
#!/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
}

View File

@ -0,0 +1,123 @@
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\""
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.0 KiB

View File

@ -0,0 +1,152 @@
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"

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,151 @@
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
}

35
tools/wineconf.tcl Executable file
View File

@ -0,0 +1,35 @@
#!/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
}