home *** CD-ROM | disk | FTP | other *** search
-
- #==============================================================================
- # Load electric alias, rebind tcl file completion for precedence.
- proc loadElectricAlias {} {
- global HOME
- uplevel #0 {
- source "$HOME:Tcl:ElectricAlias:electricAlias.tcl"
- }
- message "ElectricAlias loaded."
- bind '\t' tclFileCompletion "Shel"
- enableMenuItem -m install "Electric Alias" off
- }
-
- proc debug {} {
- uplevel #0 {
- set debugging 1
- }
- }
-
-
- proc normalLeftBracket {} {
- insertText "\{"
- }
- proc normalRightBracket {} {
- insertText "\}"
- }
- bind '\[' <zs> normalLeftBracket
- bind '\]' <zs> normalRightBracket
-
- # Select the next or current word. If word already selected, will go to next.
- proc hiliteWord {} {
- if {[getPos]!=[selEnd]} forwardChar
- forwardWord
- set start [getPos]
- backwardWord
- select $start [getPos]
- }
-
- bind 'h' <z> hiliteWord
-
- #================================================================================
- # Mode variables
- #================================================================================
- # For mark stack.
- set markName 0
- set markStack ""
-
- # mapping of windows to current modes.
- set winModes("") ""
-
- # making vars local to windows
- # 'incomingVars' used to hold old var values that have been overwritten in current window
-
- #================================================================================
- # Handle 'flag' and 'var' menu selections.
- #================================================================================
- proc editFlag {menu item} {
- global $item incomingVars localVars modifiedVars
-
- if {[regexp {\? (.*)} $item dummy var]} {
- alphaHelp
- eval select [search -f 1 -r 1 "^$var"]
- return
- }
- lappend modifiedVars $item
- set val [expr ([set $item]-1)*-1]
- markMenuItem $menu $item [expr ($val)?"on":"off"]
- set $item $val
-
- }
-
- proc editVar {menu item} {
- global $item incomingVars localVars modifiedVars
-
- if {[regexp {\? (.*)} $item dummy var]} {
- alphaHelp
- eval select [search -f 1 -r 1 "^$var"]
- return
- }
- lappend modifiedVars $item
- append prmpt "New Value of " $item ": "
- if ![catch {prompt $prmpt [set $item]} res] {
- set $item $res
- }
- }
-
-
-
-
- #================================================================================
-
- # Instantiate a global variable to the path of a file (usually an app). As a
- # side-effect, make the instantiation permanent.
- proc addAppPath {name var} {
- global $var modifiedVars
-
- set $var [getfile "Find '$name' app:"]
- lappend modifiedVars $var
- }
-
-
- proc getFileSig {f} {
- getFileInfo $f arr
- return $arr(creator)
- }
-
- proc getFileType {f} {
- getFileInfo $f arr
- return $arr(type)
- }
-
-
- # Look for given app sig in active processes. If not there, try to
- # launch with 'path' prompting for 'path' if necessary.
- # Return the real name of the app. Don't switch.
-
- # Slightly modified version of 'checkRunning' that looks for any of a
- # list of running apps. The name of the app is returned.
- #
- proc checkRunning {prompt sigs path {in_front 1}} {
- global $path
-
- # See if a process w/ any of the acceptable sigs already running.
- # If so, use it, whether it's the one specified by $path or not.
- #
- foreach proc [processes] {
- # if a running app has the correct sig, ...
- if {[lsearch -exact $sigs [lindex $proc 1]] >= 0} {
- # ...then return its name.
- return [lindex $proc 0]
- }
- }
-
- # If the path variable or the file it references don't exist,
- # or if its sig isn't one that we expect, then prompt the user
- # to locate the app.
- #
- if {![info exists $path] || ![file exists [set $path]]
- || [lsearch -exact $sigs [getFileSig [set $path]]] < 0} {
- if {[catch {addAppPath $prompt $path}]} return
- }
-
- # Check that the user's choice has an acceptable sig
- if {[lsearch -exact $sigs [getFileSig [set $path]]] < 0} {
- unset $path
- message "Inappropriate file chosen"
- return {}
- }
-
- # Launch the app
- if {$in_front} {
- if {[catch {launch -f [set $path]}]} {
- error "Problem with launching file (out of memory?)"
- }
- } else {
- if {[catch {launch [set $path]}]} {
- error "Problem with launching file (out of memory?)"
- }
- }
-
- # Return the name of the chosen application
- return [file tail [set $path]]
- }
-
-
- #================================================================================
- # Excalibur is the only Mac spell-checker that I know of which will handle LaTeX as
- # well as ordinary text.
-
-
- proc spellcheckWindow {} {
- global excaliburPath resumeRevert
-
- catch {checkRunning Excalibur XCLB excaliburPath} name
-
- if {[winDirty]} {
- if {[askyesno "Save '[lindex [winNames] 0]'?"] == "yes"} {
- save
- }
- }
- sendOpenEvent noReply $name [lindex [winNames -f] 0]
- switchTo $name
- set resumeRevert 1
- }
-
- proc spellcheckSelection {} {
- global excaliburPath
-
- catch {checkRunning Excalibur XCLB excaliburPath} name
-
- if {[getPos] == [selEnd]} {
- beep
- message "No selection"
- return;
- }
- copy
- switchTo $name
- }
-
- #================================================================================
-
-
- proc alphaHelp {} {
- global HOME
- edit -r "$HOME:Help:Manual"
- }
-
-
- proc tclHelp {} {
- global HOME
- edit -r "$HOME:Help:Tcl Commands"
- }
-
-
- proc dividingLine {} {
- insertText "===============================================================================\r"
- }
- bind 'l' <C> dividingLine
-
- proc texDividingLine {} {
- insertText "%===============================================================================\r"
- }
- bind 'l' <C> texDividingLine TeX
-
- proc cDividingLine {} {
- insertText "//===============================================================================\r"
- }
- bind 'l' <C> cDividingLine C
- bind 'l' <C> cDividingLine C++
-
- proc tclDividingLine {} {
- insertText "#===============================================================================\r"
- }
- bind 'l' <C> tclDividingLine Tcl
-
-
- #================================================================================
-
- if {![string length [info commands oldCd]]} {
- rename cd oldCd
- }
-
- proc cd args {
- global HOME
- if {[llength $args]} {
- oldCd [string trim [eval list $args] " \{\}"]
- } else {
- oldCd $HOME
- }
- }
-
-
-
- #############################################################################
- # List the name and value of each element of the array $arrName.
- # (Convenient to use as a shell command.)
- #
- # Note: it's slower to insert the lines one-by-one like this, but
- # assembling everything in $lines before inserting can seriously crash Alpha
- # if the result is too big. (Trying to list the contents of $auto_index()
- # will do it.) This method seems to be more robust.
- #
- proc listArray {arrName} {
- global $arrName
- set lines {}
- if {![catch {info vars $arrName}]} {
- foreach nm [array names $arrName] {
- set val [expr \$$arrName\($nm\)]
- append lines "\r\"$nm\"\t\{$val\}"
- }
- insertText $lines
- } else {
- alertnote "\"$arrName\" doesn't exist in this context"
- }
- }
-
-
-
- #================================================================================
-
- proc selectParagraph {} {
- set pos [getPos]
- set start [paraStart $pos]
- set finish [paraFinish $pos]
- goto $start
- select $start $finish
- }
-
- # wrapText == getText ; breakIntoLines ; replaceText
- # Remove text from window, transform (join, del-ws), insert back into window.
- proc fillTextByPar {from to} {
- set text [getText $from $to]
- regsub -all "\r(\[ \t\]*\r)+" $text "\r\r\r" text
- regsub -all "(\[^\r\])\r" $text "\\1 " text
- regsub -all "\[ \t\]+" $text " " text
- return [breakIntoLines $text]
- }
-
- proc fillRegionByPar {{start -1} {finish -1}} {
- # # if {[getPos] == [selEnd]} { return}
- if {($start < 0) || ($finish < 0)} {
- set start [lineStart [getPos]]
- set finish [selEnd] }
- if {$start >= $finish} return
- goto $start
- set text [fillTextByPar $start $finish]
- replaceText $start $finish $text "\r"
- }
-
- #
- # join Lines in region -- if no optional args, use selection
- #
- proc joinRegion {{from -1} {to -1}} {
- if {($from < 0) || ($to < 0)} { set from [getPos] ; set to [selEnd] }
- if {$from >= $to} return
- set text [getText $from $to]
- regsub -all "\r(\[ \t\]*\r)+" $text "\r\r\r" text
- regsub -all "(\[^\r\])\r" $text "\\1 " text
- replaceText $from $to $text "\r"
- }
- # WARNING: regsub ^$ refers to string endpts (not lines)
- # FUTURE: filterLines like perl:
- # replaceText[apply_to_all(cmd,split [getText [getPos] [selEnd]] "\r")]
- # OR: replaceInRegion: dup_\r, $=>\r ??
- #
-
-
- #
- # Remove text from window, transform (delete dup ws), insert back into window.
- #
- # inputs: message, alertnote, askyesno, listpick, prompt KILLS SELECTION.
- # search: bnds = search -forward -regExpr -ignoreCase -matchWords -noabort
- # -l limit pat pos
- #
- proc regsubInRegion {from to srch repl} {
- if {![string length $srch]} return
- if {$from >= $to} return
- set text [getText $from $to]
- regsub -all "$srch" $text "$repl" text
- replaceText $from $to $text
- }
- # while {($pos < $to) &&
- # ![catch {search -s -f 1 -r 1 -i 1 -m 0 "$srch" $pos} mtch]} {
- # set mbeg [lindex $mtch 0]
- # set pos [lindex $mtch 1]
- # replaceText $mbeg $pos $repl }
-
- #proc backSlashSub {arg} { eval [concat return "\"$arg\""] }
-
- proc backSlashSub {arg} {
- regsub -all {\\} $arg {\\\\} arg
- regsub -all {\[} $arg {\\[} arg
- regsub -all {\]} $arg {\\]} arg
- eval [concat return "\"$arg\""]
- }
-
- proc replaceInRegion {} {
- if [catch {prompt "Search RegExpr:" ""} srch] return
- if [catch {prompt "Replace String:" ""} repl] return
- if {![string length $srch]} return
- regsubInRegion [getPos] [selEnd] \
- [backSlashSub "$srch"] [backSlashSub "$repl"]
- }
-
- #
- # Apply command to each line (or paragraph) in selection ;
- # if no cmd arg then prompts for it
- #
- proc filterLines {{cmd 0} {parunit 0}} {
- if {$cmd == 0} {
- if {[catch { prompt "Line-filter command: " "" } cmd]} { return } }
- if {![string length $cmd]} return
- set unitStart lineStart
- set unitEnd nextLineStart
- if {$parunit} {
- set unitStart paraStart
- set unitEnd paraFinish }
- set pos [$unitStart [getPos]]
- set finish [selEnd]
- if {$pos >= $finish} return
- goto $pos
- createTMark "filterLend" $finish
- set next [$unitEnd $pos]
- while {(($next > $pos) && ($pos < $finish))} {
- goto [expr $next-1]
- createTMark "filterLnext" $next
- setMark
- goto $pos
- markHilite
- if {[catch [list uplevel #0 "$cmd"] retval]} {
- select $pos $finish
- alertnote $retval
- return
- }
- if {$next==$finish} break
- set ind [lsearch -regexp [lindex [getTMarks] 0] "filterLend.*"]
- set finish [lindex [lindex [lindex [getTMarks] 0] $ind] 2]
- gotoTMark "filterLnext"
- set pos [$unitStart [getPos]]
- set next [$unitEnd $pos]
- }
- removeTMark "filterLend"
- removeTMark "filterLnext"
- }
-
-
- proc filterParagraphs {{cmd 0}} { filterLines $cmd 1 }
-
- # WARNING: deselecting sets the mark to selEnd
- proc sortParagraphs {{from -1} {to -1}} {
- if {($from < 0) || ($to < 0)} { set from [getPos] ; set to [selEnd] }
- if {$from >= $to} return
- joinRegion {$from $to}
- select [getPos] [nextLineStart [getMark]]
- sortLines
- select [getPos] [getPos]
- regsubInRegion [getPos] [getMark] "\r" "\r\r"
- wrapRegion
- }
-
- #
- # Sample
- #
- proc filterRegion {{from -1} {to -1} {cmd 0} {newwin 0}} {
- if {$cmd == 0} {
- if {[catch { prompt "Eval command: " "" } cmd]} { return }
- }
- if {![string length $cmd]} return
- if {($from < 0) || ($to < 0)} { set from [getPos] ; set to [selEnd] }
- if {$from >= $to} return
- set pos [getPos]
- set text [getText $from $to]
- set text [$cmd $text]
- replaceText $from $to $text "\r"
- goto $pos
- }
-
-
- #
- set lastEvaled ""
- proc evaluate {} {
- global lastEvaled
- if {[string length $lastEvaled]} {
- set p "M-x ($lastEvaled): "
- } else {
- set p "M-x: "
- }
- if {[catch {statusPrompt $p} text]} {return}
- if {![string length $text]} {set text $lastEvaled}
- $text
- set lastEvaled $text
- }
-
-
- # First, define macros to bypass the electric braces.
- proc ordLeftBrace {} {
- insertText " \{"
- }
- bind {'['} <cs> ordLeftBrace
-
- proc ordRightBrace {} {
- insertText "\}"
- blink [matchIt "\}" [expr [getPos]-1]]
- }
- bind {']'} <cs> ordRightBrace
-
- proc quoteWord {} {
- backwardWord
- insertText "'"
- forwardWord
- insertText "'"
- }
- bind ''' <z> quoteWord
-
- #================================================================================
-
- proc tomac {fname} {
- set fd [open $fname "r"]
- set text [read $fd]
- close $fd
- set fd [open $fname "w"]
- regsub "\n" $text "\r" text
- puts -nonewline $fd $text
- close $fd
- }
-
- proc tounix {fname} {
- set fd [open $fname "r"]
- set text [read $fd]
- close $fd
- set fd [open $fname "w"]
- regsub "\r" $text "\n" text
- puts -nonewline $fd $text
- close $fd
- }
-
-
- proc cat args {
- set files ""
- foreach a $args {
- foreach f [glob $a] {
- lappend files $f
- }
- }
- foreach f $files {
- append text "==============<$f>==============\r"
- set fd [open $f "r"]
- append text "[read $fd]\r\r"
- close $fd
- }
- return $text
- }
-
- proc catto args {
- set len [llength $args]
- set to [lindex $args [expr $len -1]]
- set args [lrange $args 0 [expr $len -2]]
-
- set files ""
- foreach a $args {
- foreach f [glob $a] {
- lappend files $f
- }
- }
- foreach f $files {
- append text "==============<$f>==============\r"
- set fd [open $f "r"]
- append text "[read $fd]\r\r"
- close $fd
- }
-
- set dfile $to
- if {[file exists $dfile]} {
- set fid [open $dfile "a"]
- } else {
- set fid [open $dfile "w"]
- }
- puts $fid $text
- close $fid
- }
-
-
- ##############################################################################
- # To be used in the windows created by "matchingLines" or by batch searches.
- #
- # With the cursor positioned in a line corrsponding to a match,
- # go back and select the line in the original file that
- # generated this match. (Like emacs 'Occur' functionality)
- #
- proc gotoMatch {} {
- global tileHeight tileWidth tileTop tileLeft errorHeight errorDisp
- set text [getText [lineStart [getPos]] [expr [nextLineStart [getPos]] - 1]]
- set ind1 [string first "░" $text]
- set ind2 [string last "░" $text]
- if {$ind1 == $ind2} {
- set fname [string trim [string range $text $ind1 end] {░}]
- set msg ""
- } else {
- set fname [string trim [string range $text $ind1 $ind2] {░}]
- set msg [string trim [string range $text $ind2 end] {░}]
- }
-
- set top $tileTop
- set geo [getGeometry]
- if {([lindex $geo 0] != $tileLeft) || ([lindex $geo 1] != $top) || ([lindex $geo 2] != $tileWidth) || ([lindex $geo 3] != $errorHeight) } {
- moveWin $tileLeft $top
- sizeWin $tileWidth $errorHeight
- }
- set mar 22
- incr top [expr $errorHeight + $mar]
- if {[expr {[lsearch [winNames -f] "*$fname"] >= 0}]} {
- if {[string match ":*" $fname]} {
- set fname [file tail $fname]
- }
- bringToFront $fname
- set geo [getGeometry]
- if {([lindex $geo 0] != $tileLeft) || ([lindex $geo 1] != $top) || ([lindex $geo 2] != $tileWidth) || ([lindex $geo 3] != $errorDisp) } {
- sizeWin $tileWidth $errorDisp
- moveWin $tileLeft $top
- }
- } elseif {[file exists $fname]} {
- edit -g $tileLeft $top $tileWidth $errorDisp $fname
- } else {
- if {![string match "*Link*" [getText 0 [nextLineStart 0]]]} {
- alertnote "File \" $fname \" not found."
- }
- return
- }
- if {![regexp {Line ([0-9]+):} $text dummy line]} { error "Garbage" }
- set pos [rowColToPos $line 0]
- select $pos [nextLineStart $pos]
- message $msg
- }
- bind 'c' <Cz> gotoMatch
-
-
- #================================================================================
-
- proc prevIntro {} {
- set res [search -s -f 0 -r 0 {== } [getPos]]
- display [lineStart [expr [lineStart [lindex $res 0]] - 1]]
- }
-
- proc nextIntro {} {
- set res [search -s -f 1 -r 0 {== } [getPos]]
- set res [lindex $res 1]
- set res [search -s -f 1 -r 0 {== } $res]
- display [lineStart [expr [lineStart [lindex $res 0]] - 1]]
- }
-
- #================================================================================
-
- proc searchStart {} {
- global search_start
- select [getPos]
- setMark
- if {[catch {goto $search_start}]} {message "No previous search"}
- }
-
- #================================================================================
-
-
- proc listBindings {} {
- new -n {* Key Bindings *}
- insertText [bindingList]
-
- global infoWindowsDirty
- if {!$infoWindowsDirty} {setWinInfo dirty 0}
- }
-
-
- proc listFunctions {} {
- global winModes
- new -n {* Functions *}
- insertText "===\r\tCommand-double-click on a function to see its definition\r===\r\r" [join [lsort -ignore [info commands]] "\r"] "\r"
- goto 0
- setWinInfo dirty 0
- changeMode [set winModes([lindex [winNames] 0]) Tcl]
- }
-
-
- #================================================================================
-
- proc printArray {arr} {
- global $arr
- foreach n [array names $arr] {
- append text "$n '[set ${arr}($n)]'\r"
- }
- return [string trim $text "\r"]
- }
-
- #================================================================================
-
-
- proc doATab {} {
- global mode
- global ${mode}modeVars
- if {[info exists ${mode}modeVars] && ![set ${mode}modeVars(electricTab)] || [regexp {[^ \t]} [getText [lineStart [getPos]] [getPos]]]} {
- if {[getPos] != [selEnd]} {
- replaceText [getPos] [selEnd] "\t"
- } else {
- insertText "\t"
- }
- } else {
- indentLine
- }
- }
-
- # set ptext [getText [lindex $lst 0] [nextLineStart [lindex $lst 0]]]
- # regsub -all {[^(]} $ptext {} one
- # regsub -all {[^)]} $ptext {} two
- # if {[string length $one] > [string length $two]} {
- # regexp {[^(]*\(} $ptext blah
- # regsub -all {[^ ]} $blah { } lwhite
- # } elseif {($nextC == "\{")} {
- # append lwhite "\t"
- # }
-
- proc indentLine {} {
- global mode
-
- set beg [lineStart [getPos]]
-
- set lst [search -s -f 0 -r 1 -i 0 {^[ \t]*[^ \t\r]} [expr $beg-1]]
- set lwhite [getText [lindex $lst 0] [expr [lindex $lst 1] - 1]]
- set nextC [lookAt [expr [nextLineStart [lindex $lst 1]] - 2]]
-
- if {($nextC == "\{")} {
- append lwhite "\t"
- } elseif {$nextC == ":"} {
- set lwhite "[string range $lwhite 0 [expr [string length $lwhite]-3]]\t"
- }
-
- set text [getText $beg [nextLineStart $beg]]
- regexp {^[ \t]*} $text white
- set len [string length $white]
- set nextC [lookAt [expr $beg + $len]]
- if {$nextC == "\}"} {
- set lwhite [string range $lwhite 0 [expr [string length $lwhite] - 2]]
- }
-
- global ${mode}modeVars
- if {[string match "*:\r" $text] && [info exists ${mode}modeVars(elecColon)] && [set ${mode}modeVars(elecColon)]} {
- if {[string index $lwhite 0] == "\t"} {
- set lwhite "[string range $lwhite 1 [expr [string length $lwhite] - 1]] "
- }
- }
-
- if {$white != $lwhite} {
- replaceText $beg [expr $beg + $len] $lwhite
- }
- goto [expr $beg + [string length $lwhite]]
- }
-
-
- proc indentRegion {} {
- set from [lindex [posToRowCol [getPos]] 0]
- set to [lindex [posToRowCol [selEnd]] 0]
- select [getPos]
- while {$from <= $to} {
- goto [rowColToPos $from 0]
- indentLine
- incr from
- }
- }
-
- #================================================================================
-
- proc sPrompt {msg def} {
- global useStatusBar
- if {!$useStatusBar} {return [prompt $msg $def]}
- if {[catch {statusPrompt "$msg ($def): "} ans]} {
- error "cancel"
- }
- if {![string length $ans]} {return $def}
- return $ans
- }
-
- #================================================================================
- proc quoteChar {} {
- message "Literal keystroke to be inserted:"
- insertText [getChar]
- }
- #===============================================================================
-
- proc saveACopyAs {} {
- if {[file exists [set nm [lindex [winNames -f] 0]]]} {
- set nm2 [putfile "Save a copy as:" [file tail $nm]]
- cp $nm $nm2
- }
- }
- #===============================================================================
- proc removeDups {l} {
- foreach f $l {
- set silly($f) 1
- }
- if {[info exists silly]} {
- return [array names silly]
- }
- }
-
-
- #===============================================================================
-
- proc printHeaderProc {} {
- global printHeader printHeaderTime printHeaderFullPath
-
- if {!$printHeader} return ""
-
- if {$printHeaderFullPath} {
- set text [lindex [winNames -f] 0]
- } else {
- set text [lindex [winNames] 0]
- }
-
- if {$printHeaderTime} {
- append text " [join [mtime [now] short]]"
- }
- }
-
- #===============================================================================
-
- proc toggleNumLock {} {
- global numLock modifiedVars
-
- set numLock [expr -1 * ($numLock - 1)]
- lappend modifiedVars numLock
- }
-
- #===============================================================================
-
- proc register {} {
- global HOME
- # edit -r "$HOME:Help:Registering"
- launch -f "$HOME:Register 1.1.5 Keleher"
- }
-
- #===============================================================================
- # Useful for -command flag of 'lsort'.
- proc sortByTail {one two} {
- string compare [file tail $one] [file tail $two]
- }
-
-
- #===============================================================================
-
- proc cmdDoubleClick {{from -1} {to -1}} {
- global mode
-
- if {$from < 0} {
- set from [getPos]
- set to [selEnd]
- if {$from == $to} {
- message "No selection"
- return
- }
- }
-
- if {[catch {${mode}DblClick $from $to}]} {
- message "No docs"
- }
-
- }
-
- #===============================================================================
-
-
- proc editMark {fname mname args} {
- if {[set pos [lsearch [winNames -f] "*$fname*"]] >= 0} {
- bringToFront [lindex [winNames -f] $pos]
- } else {
- if {[lsearch $args {-r}] >= 0} {
- edit -r "$fname"
- } else {
- edit "$fname"
- }
- }
- if {[lsearch [getNamedMarks -n] $mname] < 0} {
- global mode
- ${mode}MarkFile
- }
- gotoMark $mname
- }
-
-
- proc winDirty {} {
- getWinInfo arr
- return $arr(dirty)
- }
-
-
- #===============================================================================
-
- proc lreverse {l} {
- if {[llength $l] > 1} {
- set first [lindex $l 0]
- set l [lreverse [lrange $l 1 end]]
- lappend l $first
- }
- return $l
- }
-
-
- #===============================================================================
-
-
- set {patternLibrary(Pascal to C Comments)} { {\{([^\}]*)\}} {/* \1 */} }
- set {patternLibrary(C++ to C Comments)} { {//(.*)} {/* \1 */} }
- set {patternLibrary(Space Runs to Tabs)} { { +} {\t} }
-
-
-
- proc getPatternLibrary {} {
- global patternLibrary
-
- foreach nm [array names patternLibrary] {
- lappend nms [concat [list $nm] $patternLibrary($nm)]
- }
- return $nms
- }
-
- proc rememberPatternHook {search replace} {
- global patternLibrary
- if {[catch {set name [prompt "New pattern's name?" ""]}]} {
- return ""
- }
- addArrDef patternLibrary $name [list $search $replace]
- set patternLibrary($name) [list $search $replace]
- return $name
- }
-
- proc deletePatternHook {} {
- global patternLibrary
-
-
- set temp [list prompt "Delete which pattern?" [lindex [array names patternLibrary] 0] "Pats:"]
- set name [eval [concat $temp [array names patternLibrary]]]
- removeArrDef patternLibrary $name
- unset patternLibrary($name)
- }
-
- #===============================================================================
- set htmlEventSuiteIDs(MOSS) {WWW!}
- proc sendUrl {} {
- global htmlBrowserPath htmlEventSuiteIDs
- if {![info exists htmlBrowserPath]} {
- if {[catch {addAppPath "HTML Browser" htmlBrowserPath}]} {
- alertnote "You must choose an HTML browser"
- return
- }
- }
- set sig [getFileSig $htmlBrowserPath]
-
- set name [checkRunning "HTML Browser" $sig htmlBrowserPath]
- if {![string length $name]} {
- alertnote "Couldn't run HTML browser"
- return
- }
-
- if {![info exists htmlEventSuiteIDs($sig)]} {
- alertnote "Can't send URLs to this HTML browser"
- return
- }
- set suite $htmlEventSuiteIDs($sig)
-
- AEBuild "'${sig}'" $suite {OURL} {----} "╥[getSelect]╙"
- switchTo $name
- }
-