📄 xdeview
字号:
-command "Encode"._MainMenu._File._Menu add separator._MainMenu._File._Menu add command -label "Helpers" -underline 0 \ -command "MimeSetup"._MainMenu._File._Menu add command -label "Save Setup" -underline 0 \ -command "SaveSetup"._MainMenu._File._Menu add separator._MainMenu._File._Menu add command -label "Quit" -underline 0 \ -command "Quit"._MainMenu._Options._Menu add checkbutton -label "Fast Scanning" \ -underline 0 -selectcolor black -variable OptionFast._MainMenu._Options._Menu add checkbutton -label "Automatic Overwrite" \ -underline 10 -selectcolor black -variable OptionOverwrite._MainMenu._Options._Menu add checkbutton -label "Desperate Mode" \ -underline 10 -selectcolor black -variable OptionDesperate._MainMenu._Options._Menu add checkbutton -label "Verbose Mode" \ -underline 0 -selectcolor black -variable OptionVerbose._MainMenu._Options._Menu add checkbutton -label "Alternate Bracket Policy" \ -underline 0 -selectcolor black -variable OptionBracket._MainMenu._Options._Menu add checkbutton -label "Dumb Mode" \ -underline 0 -selectcolor black -variable OptionDumbness._MainMenu._Options._Menu add checkbutton -label "Handle Text Files" \ -underline 0 -selectcolor black -variable OptionUsetext._MainMenu._Options._Menu add checkbutton -label "Auto Info" \ -underline 5 -selectcolor black -variable OptionAutoInfo._MainMenu._Options._Menu add checkbutton -label "Remove Input Files" \ -underline 0 -selectcolor black -variable OptionRemove._MainMenu._Options._Menu add checkbutton -label "MIME Compliance" \ -underline 0 -selectcolor black -variable OptionMoreMime._MainMenu._Actions._Menu add command -label "Decode" -underline 0 \ -command "Decode"._MainMenu._Actions._Menu add command -label "Rename" -underline 0 \ -command "Rename"._MainMenu._Actions._Menu add command -label "Decode All" -underline 7 \ -command "DecodeAll"._MainMenu._Actions._Menu add command -label "Info" -underline 0 \ -command "Info"._MainMenu._Actions._Menu add command -label "Execute" -underline 0 \ -command "Execute"._MainMenu._Actions._Menu add command -label "List Text File" -underline 0 \ -command "List"._MainMenu._Help._Menu add command -label "About ..." -underline 0 \ -command "About"._MainMenu._Help._Menu add command -label "License ..." -underline 0 \ -command "License"#._MainMenu._Help._Menu add command -label "Index ..." -underline 0 \# -command "Index"pack ._MainMenu._File ._MainMenu._Options ._MainMenu._Actions \ ._MainMenu._Help -side leftpack ._MainMenu._Help -side righttk_menuBar ._MainMenu ._MainMenu._File ._MainMenu._Options \ ._MainMenu._Actions ._MainMenu._Help## middle part, on the left the file listboxes, on the right some buttons#frame ._MainFrame -relief raised -bd 2## Left: file listboxes and scrollbar#frame ._MainFrame._FileList## definition of the second listbox which I couldn't get to work properly## Design 1##listbox ._MainFrame._FileList._Status -relief sunken -width 4 \# -yscrollcommand "\# UpdateListScroll ._MainFrame._FileList._Status \# ._MainFrame._FileList._Liste \# ._MainFrame._FileList._Scrollbar "#listbox ._MainFrame._FileList._Liste -relief sunken -selectmode extended \# -yscrollcommand "\# UpdateListScroll ._MainFrame._FileList._Status \# ._MainFrame._FileList._Liste \# ._MainFrame._FileList._Scrollbar "#scrollbar ._MainFrame._FileList._Scrollbar -command " \# UpdateSBScroll ._MainFrame._FileList._Status \# ._MainFrame._FileList._Liste \# ._MainFrame._FileList._Scrollbar "#pack ._MainFrame._FileList._Status -side left -padx 8 -pady 8 -fill y## Design 2##listbox ._MainFrame._FileList._Liste -relief sunken -selectmode extended \# -yscrollcommand "._MainFrame._FileList._Scrollbar set"#scrollbar ._MainFrame._FileList._Scrollbar \# -command "._MainFrame._FileList._Liste yview"#pack ._MainFrame._FileList._Liste -side left -padx 8 -pady 8 \# -expand true -fill both## Design 3#listbox ._MainFrame._FileList._Status -relief sunken -width 8 \ -yscrollcommand { ._MainFrame._FileList._Scrollbar set } \ -exportselection falselistbox ._MainFrame._FileList._Liste -relief sunken -selectmode extended \ -yscrollcommand { ._MainFrame._FileList._Scrollbar set } \ -exportselection falsescrollbar ._MainFrame._FileList._Scrollbar \ -command ScrollCommandpack ._MainFrame._FileList._Status -side left -padx 8 -pady 8 -fill ypack ._MainFrame._FileList._Liste -side left -padx 8 -pady 8 \ -expand true -fill bothpack ._MainFrame._FileList._Scrollbar -pady 8 -side right -fill yif { [ lindex [ ._MainFrame._FileList._Liste configure -width ] 4 ] < 20 } { ._MainFrame._FileList._Liste configure -width 20}## Right: some buttons#frame ._MainFrame._Buttonsbutton ._MainFrame._Buttons._Load -text "Load" -command "Load"button ._MainFrame._Buttons._Decode -text "Decode" -command "Decode"button ._MainFrame._Buttons._Execute -text "Execute" -command "Execute"button ._MainFrame._Buttons._Info -text "Info" -command "Info"button ._MainFrame._Buttons._Quit -text "Quit" -command "Quit"pack ._MainFrame._Buttons._Load \ ._MainFrame._Buttons._Decode ._MainFrame._Buttons._Execute \ ._MainFrame._Buttons._Info ._MainFrame._Buttons._Quit \ -ipadx 4 -ipady 4 -fill x -padx 2 -pady 2## packe MainFrame#pack ._MainFrame._FileList -side left -expand true -fill bothpack ._MainFrame._Buttons -side right -padx 8 -pady 8 -anchor center## Down: Save Path#frame ._SPEntry -relief raised -bd 2button ._SPEntry._Label -text "Save Path:" -bd 1 -command { set NewPath [ tk_SelectFiles "Savefile Path" 0 2 $SaveFilePath ] if { $NewPath != "" } { if { [ CheckWritable $NewPath ] } { set SaveFilePath [ CompressSlashes $NewPath ] } }}entry ._SPEntry._Path -relief sunken -textvariable SaveFilePathpack ._SPEntry._Label -side left -padx 4 -pady 4pack ._SPEntry._Path -side right -padx 4 -pady 4 -fill x -expand true## noch weiter unten: Statuszeile#frame ._Status -relief sunken -bd 1label ._Status._Desc -text "Status: " \ -font -Adobe-Helvetica-Bold-R-Normal--*-100-*-*-*-*-*-*label ._Status._Text -text "OK" -justify left -anchor w \ -font -Adobe-Helvetica-Bold-R-Normal--*-100-*-*-*-*-*-*pack ._Status._Desc -side left -padx 2 -pady 2pack ._Status._Text -side left -pady 2 -fill x## Packe alles zusammen#pack ._MainMenu -side top -fill xpack ._Status -side bottom -fill xpack ._SPEntry -side bottom -fill xpack ._MainFrame -expand true -fill both## Bindings#bind ._SPEntry._Path <Return> { if { $SaveFilePath == {} } { set SaveFilePath [ pwd ] } set SaveFilePath [ CompressSlashes $SaveFilePath ] CheckWritable $SaveFilePath}## AutoInfo pops up Info about a file whenever the user clicks on it#bind ._MainFrame._FileList._Liste <Button-1> { if { $OptionAutoInfo } { set TheInfoFile [ ._MainFrame._FileList._Liste index @%x,%y ] if { $TheInfoFile != "" } { InfoFile $TheInfoFile } }}## ----------------------------------------------------------------------### A File Selector Box for multiple files in Tk## Frank Pilhofer Feb/Mar 1996### Default Path and Pattern#set MFSLoadFilterPath [pwd]set MFSLoadFilterPattern "*"## directory separator#if { $tcl_platform(platform) == "windows" } { set ds "\\" set parent ".."} elseif { $tcl_platform(platform) == "macintosh" } { set ds ":" set parent ":"} else { set ds "/" set parent ".."}################################################################################ General helper functions################################################################################ Canonicalize a path: compress multiple slashes, remove slash at end,# expand double-dots and perform tilde expansion#proc CompressSlashes { Path } { global ds parent set thepath [ file split $Path ] set lastel [ expr [ llength $thepath ] - 1 ] set newpat {} set ignore 0 set element "." for { set index $lastel } { $index >= 0 } { incr index -1 } { set element [ lindex $thepath $index ] if { $element == {} } { } elseif { $element == "." } { } elseif { $element == $parent } { incr ignore } elseif { $index == 0 && [ string range $element 0 0 ] == "~" } { set hopath [ file split [ glob -nocomplain $element ] ] if { $hopath == {} } { tk_dialog ._Dialog { User does not exist } "This user does\ not exist." {} 0 OK } elseif { $ignore } { if { $ignore > [ llength $hopath ] } { set newpat [ linsert $newpat 0 {} ] } else { set holen [ llength $hopath ] set newpat [ concat [ lrange $hopath 0 \ [ expr $holen - $ignore - 1 ] ] \ $newpat ] } } else { set newpat [ concat $hopath $newpat ] } } elseif { $ignore } { incr ignore -1 } else { set newpat [ linsert $newpat 0 $element ] } } if { $element == {} } { set newpat [ linsert $newpat 0 {} ] } elseif { $element == $ds } { } elseif { $element == "." || $element == $parent } { if { $ignore } { set curdir [ file split [ pwd ] ] if { $ignore > [ llength $curdir ] } { set newpat [ linsert $newpat 0 {} ] } else { set cdlen [ llength $curdir ] set newpat [ concat [ lrange $curdir 0 \ [ expr $cdlen - $ignore - 1 ] ] \ $newpat ] } } else { set newpat [ linsert $newpat 0 "." ] } } else { set newpat [ linsert $newpat 0 "." ] } set ThePath [ eval file join $newpat ]# if { $ThePath == {} } {# set ThePath [ file join "" ]# } return $ThePath}## Canonize our search pattern#proc CanonPattern { Pattern } { global MFSLoadFilterPath global MFSLoadFilterPattern global ds parent set ThePath [ CompressSlashes $Pattern ] set TheDir [ file dirname $ThePath ] set TheFile [ file tail $ThePath ] # split up by directory and pattern if { $TheDir == {} } { set MFSLoadFilterPath "." set MFSLoadFilterPattern "*" } elseif { [ file exists $ThePath ] && [ file isdirectory $ThePath ] } { set MFSLoadFilterPath $ThePath if { $MFSLoadFilterPattern == {} } { set MFSLoadFilterPattern "*" } } else { set MFSLoadFilterPath $TheDir set MFSLoadFilterPattern $TheFile } set MFSCurPattern [ file join $MFSLoadFilterPath $MFSLoadFilterPattern ] return $MFSCurPattern}## Add new value to a listbox if it's not already there#proc AddToLb { lb value } { set count [ $lb size ] for { set index 0 ; set found 0 } { $index < $count } { incr index } { if { [ $lb get $index ] == $value } { set found 1 break } } if { $found == 0 } { $lb insert end $value }}## Update elements in Listboxes after directory or filter change#proc MFSSelectShow { havefiles } { global MFSLoadFilterPath global MFSLoadFilterPattern global ds parent if { $havefiles } { global MFSlbf } global MFSlbd if { $havefiles } { $MFSlbf delete 0 end } $MFSlbd delete 0 end if { ! [ file readable $MFSLoadFilterPath ] } { tk_dialog ._Dialog { File Error } "You do not have the proper\ permissions to browse this Directory: $MFSLoadFilterPath" \ {} 0 OK if { [ file pathtype $MFSLoadFilterPath ] == "absolute" } { if { [ llength [ file split $MFSLoadFilterPath ] ] > 1 } { $MFSlbd insert 0 $parent$ds } } return } # # insert files into file list # if { $havefiles } { set pat [ file join $MFSLoadFilterPath $MFSLoadFilterPattern ] foreach file [ lsort [ glob -nocomplain -- $pat ] ] { set basename [ file tail $file ] if { ! [ file isdirectory $file ] } { $MFSlbf insert end $basename } } } # # insert directories into directory list # set pat [ file join $MFSLoadFilterPath * ] foreach file [ lsort [ glob -nocomplain -- $pat ] ] { set basename [ file tail $file ] if { [ file isdirectory $file ] } { append basename / $MFSlbd insert end $basename } } if { [ file pathtype $MFSLoadFilterPath ] == "absolute" } { if { [ llength [ file split $MFSLoadFilterPath ] ] > 1 } { $MFSlbd insert 0 $parent$ds } } $MFSlbd insert 0 "./"}proc SelectAddFromList { lb } { global MFSLoadFilterPath global MFSLoadFilterPattern global ds parent global MFSlbi set Selection [ $lb curselection ] set SelItems [ llength $Selection ] for { set index 0 } { $index < $SelItems } { incr index } { set SelFile [ $lb get [ lindex $Selection $index ] ] set TheFile [ file join $MFSLoadFilterPath $SelFile ] if { ! [ file readable $TheFile ] } { tk_dialog ._Dialog { File Error } "You do not have the proper\ permissions to read this file or directory: $TheFile" \ {} 0 OK } else { set TheFile [ CompressSlashes $TheFile ] if { [ file isdirectory $TheFile ] && $TheFile != $ds } { append TheFile $ds } AddToLb $MFSlbi $TheFile } } return 0}############################################################################### Main function##############################################################################
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -