home *** CD-ROM | disk | FTP | other *** search
Text File | 1997-11-02 | 31.5 KB | 963 lines | [TEXT/ALFA] |
- ## -*-Tcl-*-
- # ###################################################################
- # HTML mode - tools for editing HTML documents
- #
- # FILE: "htmlMenu.tcl"
- # created: 96-04-29 21.31.40
- # last update: 97-10-31 22.02.16
- # Author: Johan Linde
- # E-mail: <jl@theophys.kth.se>
- # www: <http://bach.theophys.kth.se/~jl/Alpha.html>
- #
- # Version: 2.0.3
- #
- # Copyright 1996, 1997 by Johan Linde
- #
- # This software may be used freely, and distributed freely, as long as the
- # receiver is not obligated in any way by receiving it.
- #
- # If you make improvements to this file, please share them!
- #
- # ###################################################################
- ##
-
- proc htmlMenu.tcl {} {}
-
- # Loading of packages.
- proc htmlHTML3.2andCSS {} {htmlLoadPackage 3}
- proc htmlExtensions {} {htmlLoadPackage 1}
-
- proc htmlLoadPackage {level} {
- global htmlPackageToUse
- global HTMLmodeVars modifiedModeVars
-
- if {$level != $htmlPackageToUse} {
- set HTMLmodeVars(htmlPackageToUse) $level
- set htmlPackageToUse $level
- lappend modifiedModeVars {htmlPackageToUse HTMLmodeVars}
- if {$htmlPackageToUse == 1} {
- htmlExtensions.tcl
- htmlDisableSome 3 on
- htmlMarkExtUtil
- message "Extensions"
- } else {
- html32.tcl
- htmlMark32Util
- message "HTML 3.2"
- }
- htmlDisMark
- }
- }
-
- proc htmlMarkExt {} {
- markMenuItem -m {Packages} {Extensions} 1
- markMenuItem -m {Packages} {HTML 3.2 and CSS} 0
- }
-
- proc htmlMarkExtUtil {} {
- global htmlUtilsMenu htmlElemKeyBinding htmlAdditionExist htmlShownWarning
- enableMenuItem $htmlUtilsMenu Extend [expr ![info exists htmlShownWarning]]
- htmlEnableExtend [info exists htmlElemKeyBinding] $htmlAdditionExist
- }
-
- proc htmlMark32 {} {
- markMenuItem -m {Packages} {Extensions} 0
- markMenuItem -m {Packages} {HTML 3.2 and CSS} 1
- }
-
- proc htmlMark32Util {} {
- global htmlUtilsMenu
- enableMenuItem $htmlUtilsMenu Extend off
- }
-
- # Hide and show Netscape and IE.
- proc htmlHideNetscapeOnly {} {htmlHide Netscape}
- proc htmlHideIEOnly {} {htmlHide IE}
-
- proc htmlHide {what} {
- global htmlDisabledItems1 htmlDisabledNetscape htmlDisabledIE HTMLmodeVars modifiedModeVars
-
- htmlDisableSome 1 on
- set HTMLmodeVars(hide${what}) [expr ![set HTMLmodeVars(hide${what})]]
- lappend modifiedModeVars [list hide$what HTMLmodeVars]
- markMenuItem -m Packages "Hide $what Only" [set HTMLmodeVars(hide${what})]
- htmlSetDis1
- htmlDisableSome 1 off
- message "[lindex {Show Hide} [set HTMLmodeVars(hide${what})]] $what only."
- }
-
- # Disable some HTML elements
- proc htmlDisableSome {num onoff} {
- global htmlElemKeyBinding htmlDisabledItems3 htmlDisabledItems1 htmlMenu
- foreach i [set htmlDisabledItems$num] {
- set it [split $i /]
- enableMenuItem [lindex $it 0] [lindex $it 1] $onoff
- }
- # Disable Custom menu in HTML 3.2
- if {[info exists htmlElemKeyBinding]} {enableMenuItem $htmlMenu Custom [expr $num == 1]}
- }
-
- proc htmlUseBigBrother {} {
- global HTMLmodeVars modifiedModeVars
- set HTMLmodeVars(useBigBrother) [expr !$HTMLmodeVars(useBigBrother)]
- if {[catch {nameFromAppl Bbth}]} {
- set HTMLmodeVars(useBigBrother) 0
- enableMenuItem {Check Links} {Use Big Brother} off
- }
- markMenuItem -m {Check Links} {Use Big Brother} $HTMLmodeVars(useBigBrother)
- lappend modifiedModeVars {useBigBrother HTMLmodeVars}
- message "[lindex {"Don't use" Use} [set HTMLmodeVars(useBigBrother)]] Big Brother."
- }
-
- proc htmlHideCSSAttributes {} {
- global HTMLmodeVars modifiedModeVars
- set HTMLmodeVars(hideStyleAttrs) [expr !$HTMLmodeVars(hideStyleAttrs)]
- markMenuItem -m Packages "Hide CSS Attributes" $HTMLmodeVars(hideStyleAttrs)
- lappend modifiedModeVars {hideStyleAttrs HTMLmodeVars}
- message "[lindex {Show Hide} [set HTMLmodeVars(hideStyleAttrs)]] CSS attributes."
- }
-
- # Called from HTML menu to change browser.
- proc htmlToggleBrowser {brws} {
- global htmlBrowsers browserSig modifiedVars
- foreach b $htmlBrowsers {
- if {$brws == [lindex $b 1]} {set browserSig [lindex $b 0]}
- }
- lappend modifiedVars browserSig
- }
-
- # Called whenever browserSig is changed.
- proc htmlToggleBrowser2 {args} {
- global browserSig htmlBrowsers HTMLmodeVars
- if {[lsearch -exact $HTMLmodeVars(browsers) $browserSig] < 0} {htmlAddBrowser $browserSig}
- foreach b $htmlBrowsers {
- if {$browserSig == [lindex $b 0]} {
- markMenuItem -m Browsers [lindex $b 1] on
- } else {
- markMenuItem -m Browsers [lindex $b 1] off
- }
- }
- }
-
- # Add a browser to Browser menu.
- proc htmlAddBrowser {{sig ""}} {
- global htmlBrowsers HTMLmodeVars modifiedModeVars browserSig
- if {$sig == ""} {
- set fil [getfile "Locate a web browser."]
- set sig [getFileSig $fil]
- }
- if {[catch {nameFromAppl $sig} fil]} {
- alertnote "Couldn't get the name of the browser. If nothing else helps try rebuilding the desktop."
- return
- }
- if {[lsearch -exact $HTMLmodeVars(browsers) $sig] >= 0} {return}
- lappend HTMLmodeVars(browsers) $sig
- lappend modifiedModeVars {browsers HTMLmodeVars}
- lappend htmlBrowsers [list $sig [set app [file tail $fil]]]
- htmlAddBrowserItem $app $sig
- if {$sig == $browserSig} {markMenuItem -m "Browsers" $app on }
- message "$app added to Browsers menu."
- }
-
- # Remove a browser from Browser menu.
- proc htmlRemoveBrowser {} {
- global htmlBrowsers HTMLmodeVars modifiedModeVars browserSig modifiedVars
- foreach b $htmlBrowsers {
- lappend tmp [lindex $b 1]
- }
- if {[catch {listpick -p "Select browser to remove" $tmp} brws] || $brws == ""} {return}
- for {set i 0} {$i < [llength $htmlBrowsers]} {incr i} {
- if {$brws == [lindex [lindex $htmlBrowsers $i] 1]} {
- deleteMenuItem -m Browsers $brws
- if {[lindex $HTMLmodeVars(browsers) $i] == $browserSig} {
- set j 0
- if {$i == 0} {incr j}
- if {$j < [llength $HTMLmodeVars(browsers)]} {set browserSig [lindex $HTMLmodeVars(browsers) $j]}
- lappend modifiedVars browserSig
- }
- set htmlBrowsers [lreplace $htmlBrowsers $i $i]
- set HTMLmodeVars(browsers) [lreplace $HTMLmodeVars(browsers) $i $i]
- }
- }
- lappend modifiedModeVars {browsers HTMLmodeVars}
- message "$brws removed from Browsers menu."
- }
-
- proc htmlAddBrowserItem {app sig} {
- switch $sig {
- MOSS {
- if {[string match "*Navigator*" $app]} {
- set ic 85
- } else {
- set ic 86
- }
- }
- MSIE {set ic 87}
- OlG1 {set ic 88}
- dogz {set ic 73}
- default {set ic 78}
- }
- addMenuItem -m Browsers [menu::itemWithIcon $app $ic]
- }
-
-
- proc htmlEnableURLs {onoff} {
- enableMenuItem URLs "Clean Up…" $onoff
- enableMenuItem URLs "Clear" $onoff
- enableMenuItem URLs "Export…" $onoff
- }
-
- proc htmlEnablewindows {onoff} {
- global htmlUtilsMenu
- enableMenuItem $htmlUtilsMenu Windows $onoff
- }
-
- proc htmlEnableExtend {a b} {
- enableMenuItem Extend "Change Key Binding…" $a
- enableMenuItem Extend "Change Type and Layout…" $a
- enableMenuItem Extend "Remove Attributes…" $b
- enableMenuItem Extend "Remove Additions…" $b
- }
-
- proc htmlUseAttrsIsEnabled {} {
- global HTMLmodeVars
- return [expr !$HTMLmodeVars(useBigWindows) || !$HTMLmodeVars(changeInBigWindows) || $HTMLmodeVars(useAttsApplyToDialogs)]
- }
-
- # This proc is not used any more. It now gives a warning message if the user
- # call it to define new elements in HTMLprefs.tcl.
- proc htmlNewElemVar {{list ""} {var ""} {val ""}} {
- global htmlShownWarning htmlUtilsMenu
- if {![info exists htmlShownWarning]} {
- beep
- dialog -w 350 -h 290 -t "The way to add custom elements to HTML mode has changed."\
- 10 10 340 45 \
- -t "New elements can now be added with the functions found in the submenu\
- Extend in the HTML Utilities menu. However, this submenu is disabled until you remove all\
- your definitions of custom elements from HTMLPrefs.tcl and restart Alpha."\
- 10 55 340 150\
- -t "Read more in the section 'Extending HTML mode' in the\
- HTML mode manual about how to avoid this message and how\
- to add new elements to HTML mode." 10 160 340 250\
- -b OK 20 260 85 280
- set htmlShownWarning 1
- enableMenuItem $htmlUtilsMenu Extend off
- }
- }
-
- proc htmlSetAttrUsed {num elem used} {
- global htmlElemAttrUsed htmlElemAttrUsed3
- if {![info exists htmlElemAttrUsed${num}($elem)]} {set htmlElemAttrUsed${num}($elem) $used}
- }
-
-
-
- #===============================================================================
- # Character entities
- #===============================================================================
-
- proc htmlNewCharVar {var val} {
- global htmlSpecialCharacter
- global htmlCharacterSpecial
- set htmlSpecialCharacter($var) $val
- set htmlCharacterSpecial($val) $var
- }
-
- proc htmlNewCapCharVar {var men val} {
- global htmlSpecialCapCharacter
- global htmlCapCharacterSpecial
- global htmlCapCharSpecMenu
- set htmlSpecialCapCharacter($var) $val
- set htmlCapCharacterSpecial($val) $var
- set htmlCapCharSpecMenu($men) $val
- }
-
- htmlNewCharVar "ß" szlig
- htmlNewCharVar "à" agrave
- htmlNewCharVar "á" aacute
- htmlNewCharVar "â" acirc
- htmlNewCharVar "ã" atilde
- htmlNewCharVar "ä" auml
- htmlNewCharVar "å" aring
- htmlNewCharVar "æ" aelig
- htmlNewCharVar "ç" ccedil
- htmlNewCharVar "è" egrave
- htmlNewCharVar "é" eacute
- htmlNewCharVar "ê" ecirc
- htmlNewCharVar "ë" euml
- htmlNewCharVar "ì" igrave
- htmlNewCharVar "í" iacute
- htmlNewCharVar "î" icirc
- htmlNewCharVar "ï" iuml
- htmlNewCharVar "eth" eth
- htmlNewCharVar "ñ" ntilde
- htmlNewCharVar "ò" ograve
- htmlNewCharVar "ó" oacute
- htmlNewCharVar "ô" ocirc
- htmlNewCharVar "õ" otilde
- htmlNewCharVar "ö" ouml
- htmlNewCharVar "ø" oslash
- htmlNewCharVar "ù" ugrave
- htmlNewCharVar "ú" uacute
- htmlNewCharVar "û" ucirc
- htmlNewCharVar "ü" uuml
- htmlNewCharVar "y´" yacute
- htmlNewCharVar "thorn" thorn
- htmlNewCharVar "ÿ" yuml
-
- htmlNewCapCharVar "À" "À" Agrave
- htmlNewCapCharVar "Á" "A´" Aacute
- htmlNewCapCharVar "Â" "A^" Acirc
- htmlNewCapCharVar "Ã" "Ã" Atilde
- htmlNewCapCharVar "Ä" "Ä" Auml
- htmlNewCapCharVar "Å" "Å" Aring
- htmlNewCapCharVar "Æ" "Æ" Aelig
- htmlNewCapCharVar "Ç" "Ç" Ccedil
- htmlNewCapCharVar "È" "E`" Egrave
- htmlNewCapCharVar "É" "É" Eacute
- htmlNewCapCharVar "Ê" "E^" Ecirc
- htmlNewCapCharVar "Ë" "E¨" Euml
- htmlNewCapCharVar "Ì" "I`" Igrave
- htmlNewCapCharVar "Í" "I´" Iacute
- htmlNewCapCharVar "Î" "I^" Icirc
- htmlNewCapCharVar "Ï" "I¨" Iuml
- htmlNewCapCharVar "ETH" "ETH" ETH
- htmlNewCapCharVar "Ñ" "Ñ" Ntilde
- htmlNewCapCharVar "Ò" "O`" Ograve
- htmlNewCapCharVar "Ó" "O´" Oacute
- htmlNewCapCharVar "Ô" "O^" Ocirc
- htmlNewCapCharVar "Õ" "Õ" Otilde
- htmlNewCapCharVar "Ö" "Ö" Ouml
- htmlNewCapCharVar "Ø" "Ø" Oslash
- htmlNewCapCharVar "Ù" "U`" Ugrave
- htmlNewCapCharVar "Ú" "U´" Uacute
- htmlNewCapCharVar "Û" "U^" Ucirc
- htmlNewCapCharVar "Ü" "Ü" Uuml
- htmlNewCapCharVar "Y´" "Y´" Yacute
- htmlNewCapCharVar "THORN" "THORN" THORN
-
- set htmlSpecialSymbCharacter(\") quot
- set htmlSpecialSymbCharacter(ampersand) amp
- set htmlSpecialSymbCharacter([list less than]) lt
- set htmlSpecialSymbCharacter([list greater than]) gt
- set htmlSpecialSymbCharacter([list nonbreak space]) nbsp
- set htmlSpecialSymbCharacter(¡) "#161"
- set htmlSpecialSymbCharacter(¢) "#162"
- set htmlSpecialSymbCharacter(£) "#163"
- set htmlSpecialSymbCharacter(currency) "#164"
- set htmlSpecialSymbCharacter(¥) "#165"
- set htmlSpecialSymbCharacter(§) "#167"
- set htmlSpecialSymbCharacter(©) copy
- set htmlSpecialSymbCharacter(ª) "#170"
- set htmlSpecialSymbCharacter(«) "#171"
- set htmlSpecialSymbCharacter(®) reg
- set htmlSpecialSymbCharacter(°) "#176"
- set htmlSpecialSymbCharacter(±) "#177"
- set htmlSpecialSymbCharacter(µ) "#181"
- set htmlSpecialSymbCharacter(¶) "#182"
- set htmlSpecialSymbCharacter(middot) "#183"
- set htmlSpecialSymbCharacter(º) "#186"
- set htmlSpecialSymbCharacter(») "#187"
- set htmlSpecialSymbCharacter([list a quarter]) "#188"
- set htmlSpecialSymbCharacter([list a half]) "#189"
- set htmlSpecialSymbCharacter([list three quarters]) "#190"
- set htmlSpecialSymbCharacter(¿) "#191"
- set htmlSpecialSymbCharacter(times) "#215"
- set htmlSpecialSymbCharacter(÷) "#247"
-
-
- rename htmlNewCharVar ""
- rename htmlNewCapCharVar ""
-
- #===============================================================================
- # Menu Processing
- #===============================================================================
-
- proc htmlMenuItem {menu item} {
- global htmlElemProc htmlDisabledItems1 htmlDisabledItems3 htmlPackageToUse
- global screenWidth defWidth
-
- if {$htmlPackageToUse == 3 && $menu == "Custom"} {beep; return}
- foreach it [set htmlDisabledItems$htmlPackageToUse] {
- if {[lindex [split $it /] 1] == $menu || "${menu}/$item" == $it} {beep; return}
- }
-
- switch -glob $menu {
- "•*" {
- switch $item {
- "Use Attributes" {
- if {![htmlUseAttrsIsEnabled]} {beep; return}
- htmlChooseUseAttr
- }
- "Last Modified" {htmlInsertLastMod}
- default {eval html[join $item ""]}
- }
- }
- "Browsers" {
- switch $item {
- "Send File to Browser" {htmlSendWindow}
- "Add" {htmlAddBrowser}
- "Remove" {htmlRemoveBrowser}
- default {htmlToggleBrowser $item}
- }
- }
- "Packages" {eval html[join $item ""]}
- "Preferences" {HTMLmodifyFlags [lindex $item 0]}
- "Palettes" {float -m "$item" -t 50 -l [expr $screenWidth - $defWidth > 110 ? $defWidth : $screenWidth - 110] -z HTML}
- "Editing" {
- switch $item {
- "Literal Tab" {replaceText [getPos] [selEnd] "\t"}
- default {eval html[join $item ""]}
- }
- }
- "Validate" {eval html[join $item ""]}
- "Character Translation" {
- switch $item {
- "åäö -> HTML" {htmlCharacterstohtml 0}
- "HTML -> åäö" {htmltoCharacters 0}
- "<>& -> HTML" {htmlCharacterstohtml 1}
- "HTML -> <>&" {htmltoCharacters 1}
- default {eval html[join $item ""]}
- }
- }
- "URLs" {
- switch $item {
- "Clean Up" {htmlCleanUpCache URLs}
- "Clear" {htmlClearCache URLs}
- default {eval html[join $item ""]}
- }
- }
- "Windows" {
- switch $item {
- "Clean Up" {htmlCleanUpCache windows}
- "Clear" {htmlClearCache windows}
- default {eval html[join $item ""]}
- }
- }
- "Check Links" {eval html[join $item ""]}
- "Includes" {eval html[join $item ""]}
- "Home Page Windows" {
- switch $item {
- "Open" {htmlOpenHPwin}
- default {eval html[join $item ""]}
- }
- }
- "Extend" {eval html[join $item ""]}
- "Style Sheets" {
- switch $item {
- Style {htmlTag {htmlBuildCR2Elem STYLE}}
- Span {htmlTag {htmlBuildElem SPAN}}
- Import {cssDialog @import}
- Display {cssDialog Display}
- default {
- if {[info commands html[join $item ""]] != ""} {
- eval html[join $item ""]
- } else {
- cssDialog [join [string tolower $item] -]}
- }
- }
- }
- "Headers" {
- switch $item {
- "Header1" {htmlTag {htmlBuildCRElem H1 1}}
- "H1 no attr" {htmlTag {htmlBuildCRElem H1 1 NOATTR}}
- "Header2" {htmlTag {htmlBuildCRElem H2 1}}
- "H2 no attr" {htmlTag {htmlBuildCRElem H2 1 NOATTR}}
- "Header3" {htmlTag {htmlBuildCRElem H3 1}}
- "H3 no attr" {htmlTag {htmlBuildCRElem H3 1 NOATTR}}
- "Header4" {htmlTag {htmlBuildCRElem H4 1}}
- "H4 no attr" {htmlTag {htmlBuildCRElem H4 1 NOATTR}}
- "Header5" {htmlTag {htmlBuildCRElem H5 1}}
- "H5 no attr" {htmlTag {htmlBuildCRElem H5 1 NOATTR}}
- "Header6" {htmlTag {htmlBuildCRElem H6 1}}
- "H6 no attr" {htmlTag {htmlBuildCRElem H6 1 NOATTR}}
- default {eval html[join $item ""]}
- }
- }
- "Blocks and Dividers" {
- switch $item {
- "Paragraph" {htmlElemParagraph}
- "P no attr" {htmlElemParagraph NOATTR}
- "Division" {htmlTag {htmlBuildCR2Elem DIV}}
- "Block Quote" {htmlTag {htmlBuildCR2Elem BLOCKQUOTE}}
- "Address" {htmlTag {htmlBuildCRElem ADDRESS}}
- "Center" {htmlTag {htmlBuildCR2Elem CENTER}}
- "Preformatted" {htmlTag {htmlBuildCR2Elem PRE}}
- "Multi Column" {htmlTag {htmlBuildCR2Elem MULTICOL}}
- "Spacing" {htmlTag {htmlBuildOpening SPACER}}
- "Line Break" {htmlTag {htmlBuildOpening BR 0 1}}
- "BR no attr" {htmlTag {htmlBuildOpening BR 0 1 NOATTR}}
- "Horizontal Rule" {htmlTag {htmlBuildOpening HR 1 1}}
- "HR no attr" {htmlTag {htmlBuildOpening HR 1 1 NOATTR}}
- "No Line Break" {htmlTag {htmlBuildElem NOBR}}
- "Word Break" {htmlTag {htmlBuildOpening WBR 0 1}}
- default {eval html[join $item ""]}
- }
- }
- "Styles" {
- switch $item {
- "Font" {htmlTag {htmlBuildElem FONT}}
- "Basefont" {htmlTag {htmlBuildOpening BASEFONT 1 1}}
- "Marquee" {htmlTag {htmlBuildCRElem MARQUEE}}
- "Bold" {htmlTag {htmlBuildElem B}}
- "Italic" {htmlTag {htmlBuildElem I}}
- "Strike out" {htmlTag {htmlBuildElem STRIKE}}
- "Underlined" {htmlTag {htmlBuildElem U}}
- "Subscript" {htmlTag {htmlBuildElem SUB}}
- "Superscript" {htmlTag {htmlBuildElem SUP}}
- "Bigger" {htmlTag {htmlBuildElem BIG}}
- "Smaller" {htmlTag {htmlBuildElem SMALL}}
- "Emphasis" {htmlTag {htmlBuildElem EM}}
- "Strong" {htmlTag {htmlBuildElem STRONG}}
- "Definition" {htmlTag {htmlBuildElem DFN}}
- "Code" {htmlTag {htmlBuildElem CODE}}
- "Variable" {htmlTag {htmlBuildElem VAR}}
- "Citation" {htmlTag {htmlBuildElem CITE}}
- "Keyboard" {htmlTag {htmlBuildElem KBD}}
- "Typewriter" {htmlTag {htmlBuildElem TT}}
- "Sample" {htmlTag {htmlBuildElem SAMP}}
- "Blinking" {htmlTag {htmlBuildElem BLINK}}
- default {eval html[join $item ""]}
- }
- }
- "Links" {
- switch $item {
- "Link or Anchor" {htmlTag {htmlBuildElem A}}
- "Image" {htmlTag {htmlBuildOpening IMG}}
- Object {htmlTag {htmlBuildCR2Elem OBJECT}}
- Sound {htmlTag {htmlBuildOpening BGSOUND 1 1}}
- default {eval html[join $item ""]}
- }
- }
- "Plug-ins" {
- switch $item {
- "General" {htmlTag {htmlBuildOpening EMBED}}
- "LiveAudio" {htmlTag {htmlBuildOpening EMBED 0 0 LIVEAUDIO}}
- "LiveVideo" {htmlTag {htmlBuildOpening EMBED 0 0 LIVEVIDEO}}
- "QuickTime Movie" {htmlTag {htmlBuildOpening EMBED 0 0 "QUICKTIME MOVIE"}}
- "QuickTime VR" {htmlTag {htmlBuildOpening EMBED 0 0 "QUICKTIME VR"}}
- "RealAudio" {htmlTag {htmlBuildOpening EMBED 0 0 REALAUDIO}}
- "No Embed" {htmlTag {htmlBuildCR2Elem NOEMBED}}
- default {eval html[join $item ""]}
- }
- }
- "Lists" {
- switch $item {
- "Bulleted" {htmlTag {htmlBuildList UL "LI IN UL" UL}}
- "UL no attr" {htmlTag {htmlBuildList UL NOATTR NOATTR}}
- "New Bulleted Item" {htmlTag {htmlBuildListEntry "LI IN UL"}}
- "Numbered" {htmlTag {htmlBuildList OL "LI IN OL" OL}}
- "OL no attr" {htmlTag {htmlBuildList OL NOATTR NOATTR}}
- "New Numbered Item" {htmlTag {htmlBuildListEntry "LI IN OL"}}
- "Directory" {htmlTag {htmlBuildList DIR LI}}
- "Menu" {htmlTag {htmlBuildList MENU LI}}
- "New List Item" {htmlTag {htmlBuildListEntry LI}}
- "Discursive" {htmlTag {htmlBuildList DL}}
- default {eval html[join $item ""]}
- }
- }
- "Forms" {
- switch $item {
- "Form" {htmlTag {htmlBuildCR2Elem FORM}}
- "Text" {htmlTag {htmlBuildInputElem TEXT}}
- "Checkbox" {htmlTag {htmlBuildInputElem CHECKBOX}}
- "Button" {htmlTag {htmlBuildInputElem BUTTON}}
- "Radio" {htmlTag {htmlBuildInputElem RADIO}}
- "Submit" {htmlTag {htmlBuildInputElem SUBMIT}}
- "Reset" {htmlTag {htmlBuildInputElem RESET}}
- "Password" {htmlTag {htmlBuildInputElem PASSWORD}}
- "Hidden" {htmlTag {htmlBuildInputElem HIDDEN}}
- "Image" {htmlTag {htmlBuildInputElem IMAGE}}
- "File Upload" {htmlTag {htmlBuildInputElem FILE}}
- "Select" {htmlTag {htmlBuildCR2Elem SELECT}}
- "Option" {htmlTag {htmlBuildOpening OPTION 1 1}}
- "Textarea" {htmlTag {htmlBuildCRElem TEXTAREA}}
- "Key Generator" {htmlTag {htmlBuildOpening KEYGEN 1 1}}
- default {eval html[join $item ""]}
- }
- }
- "Tables" {
- switch $item {
- Table {htmlTag {htmlBuildCR2Elem TABLE}}
- Row {htmlTag {htmlBuildCR2Elem TR}}
- "TR no attr" {htmlTag {htmlBuildCR2Elem TR NOATTR}}
- Header {htmlTag {htmlBuildElem TH}}
- "TH no attr" {htmlTag {htmlBuildElem TH NOATTR}}
- Cell {htmlTag {htmlBuildElem TD}}
- "TD no attr" {htmlTag {htmlBuildElem TD NOATTR}}
- Caption {htmlTag {htmlBuildCRElem CAPTION}}
- Head {htmlTag {htmlBuildOpening THEAD 1 1}}
- Body {htmlTag {htmlBuildOpening TBODY 1 1}}
- Foot {htmlTag {htmlBuildOpening TFOOT 1 1}}
- "Column Group" {htmlTag {htmlBuildOpening COLGROUP 1 1}}
- Column {htmlTag {htmlBuildOpening COL 1 1}}
- default {eval html[join $item ""]}
- }
- }
- "Frames" {
- switch $item {
- Frameset {htmlTag {htmlBuildCR2Elem FRAMESET}}
- Frame {htmlTag {htmlBuildOpening FRAME 1 1}}
- "Inline Frame" {htmlTag {htmlBuildElem IFRAME}}
- "No Frames" {htmlTag {htmlBuildCR2Elem NOFRAMES}}
- default {eval html[join $item ""]}
- }
- }
- "Image Maps" {
- switch $item {
- Map {htmlTag {htmlBuildCR2Elem MAP}}
- Area {htmlTag {htmlBuildOpening AREA 1 1}}
- default {eval html[join $item ""]}
- }
- }
- "Java and JavaScript" {
- switch $item {
- Applet {htmlTag {htmlBuildCR2Elem APPLET}}
- Parameter {htmlTag {htmlBuildOpening PARAM 1 1}}
- Script {htmlTag {htmlBuildCR2Elem SCRIPT}}
- "No Script" {htmlTag {htmlBuildCR2Elem NOSCRIPT}}
- default {eval html[join $item ""]}
- }
- }
- "Layers" {
- switch $item {
- Layer {htmlTag {htmlBuildCR2Elem LAYER}}
- "Inline Layer" {htmlTag {htmlBuildCRElem ILAYER}}
- "No Layer" {htmlTag {htmlBuildCR2Elem NOLAYER}}
- default {eval html[join $item ""]}
- }
- }
- "Other" {
- switch $item {
- "Base" {htmlTag {htmlBuildOpening BASE 1 1}}
- "Isindex" {htmlTag {htmlBuildOpening ISINDEX 1 1}}
- "Link" {htmlTag {htmlBuildOpening LINK 1 1}}
- "Meta" {htmlTag {htmlBuildOpening META 1 1}}
- default {eval html[join $item ""]}
- }
- }
- "Character Entities" {
- switch $item {
- "Add" {htmlAddCommonChars}
- "Default" {htmlDefaultCommonChars}
- "Clear" {htmlClearCommonChars}
- default {htmlInsertCharacter $item}
- }
- }
- "*Chars" {
- htmlInsertCharacter $item
- }
- "Custom" {
- htmlTag $htmlElemProc([string toupper $item])
- }
- }
- }
-
-
- # Variables defining the sub menus. More variables in hctsmslMenu.tcl
-
- set htmlHTMLSub {{"<I/t" "Help"} {"<B/m" "Use Attributes…"} {"<B<U<I/D" "New Document…"}}
-
- set htmlBrowsersSub {{"<U<O/S" "Send File to Browser"} "(-" {"" "Add…"} {"" "Remove…"} "(-"}
-
- set htmlPackagesSub {{"" "HTML 3.2 and CSS"} {"" Extensions} "(-" {"" "Hide CSS Attributes"}
- {"" "Hide Netscape Only"} {"" "Hide IE Only"}}
-
- set htmlPreferencesSub {{"" "General…"} {"" "Indentation…"} {"" "JavaScript and CSS…"}
- {"" "Checking Links…"} {"" "Word Wrapping…"}}
-
- set htmlUtilitiesSub {{"" "Colors…"} {"" "Home Pages…"} {"" "Footers…"} {"" "Key Bindings…"}
- {"<O/I" "Reformat Paragraph/Reformat Document"} {"" "Save to FTP Server/Forget Passwords"} {"" "Move Files…"} {"" "Last Modified…"} {"" "Document Size"} {"" "Document Index…"}}
-
- set htmlEditingSub {{"<O/B" "Select Container/Select Opening"}
- {"<U<O/B" "Select in Container"}
- {"<B/e" "Untag/Untag and Select"} {"<B/f" "Remove Opening"}
- {"<B/g" "Change Container…/Change Opening…"} {"<B/h" "Change Choice"}
- {"<B/i" "Reveal Color"} {"<B/j" "Insert Attributes"} {"" "Quote All Attributes"} "(-" {"<O/c" "Word Complete"} {"/c" "Next Tab Mark"}
- {"<U/c" "Previous Tab Mark"} {"<I/c" "Literal Tab"} {"<B/c" "Remove Marks"} {"" "Remove Tags"}}
-
- set htmlValidateSub {{"" "Find Unbalanced Tags"} {"" "Check Tags"}}
-
- set htmlCharacterSub {{"" "åäö -> HTML"} {"" "HTML -> åäö"}}
-
- set htmlURLsSub {{"" "Clean Up…"} {"" "Clear"} {"" "Import…"} {"" "Export…"} {"" "Add Folder…"}
- {"" "Add Selection"} {"" "Add Clipboard"}}
-
- set htmlWindowsSub {{"" "Clean Up…"} {"" "Clear"}}
-
- set htmlCheckSub {{"" "Check Window"} {"" "Check Home Page…"} {"" "Check Folder…"} {"" "Check File…"}
- {"" "Check Remote Links"} "(-" {"" "Use Big Brother"}}
-
- set htmlIncludesSub {{"" "Insert Include Tags…"} "(-" {"" "Update Window"} {"" "Update Home Page…"}
- {"" "Update Folder…"} {"" "Update File…"}}
-
- set htmlHomeSub {{"" Open…} {"<U<O/V" "Paste URL"} {"" "Refresh Windows"}}
-
- set htmlExtendSub {{"" "New Element…"} {"" "New Attributes…"} {"" "New Choices…"} {"" "Change Key Binding…"}
- {"" "Change Type and Layout…"} {"" "Remove Attributes…"} {"" "Remove Additions…"}}
-
- set htmlUtilSubMenus {Utilities Editing Validate {Character Translation} URLs Windows
- {Check Links} Includes {Home Page Windows} Extend}
-
- #
- # The menu.
- #
- # <B = control <I = option <U = shift <O = command <S = dynamic
-
- proc htmlBuildMenu {{msg "Building HTML menu…"}} {
- global htmlPackageToUse HTMLmodeVars htmlMenu
- # htmlPackageToUse must be set here. It's used globally in many places.
- set htmlPackageToUse $HTMLmodeVars(htmlPackageToUse)
- # Check if user used HTML 2.0!
- if {[lsearch -exact {1 3} $htmlPackageToUse] < 0} {
- set htmlPackageToUse 3
- set HTMLmodeVars(htmlPackageToUse) 3
- lappend modifiedModeVars {htmlPackageToUse HTMLmodeVars}
- }
-
- if {$htmlPackageToUse == 1} {
- htmlExtensions.tcl
- } else {
- html32.tcl
- }
-
- if {[catch {htmlReadCache "HTML menu cache"}]} {
- message $msg
- htmlBuildMenu0
- } else {
- message "Reading HTML menu definition…"
- }
- insertMenu $htmlMenu
-
- htmlPackagesMenuExtra
- htmlDisMark
- # Disable Use Attrs menu if status bar isn't used.
- if {![htmlUseAttrsIsEnabled]} {
- enableMenuItem $htmlMenu "Use Attributes…" off
- }
- htmlBrowsersMenuExtra
- }
-
- proc htmlBuildMenu0 {} {
- global htmlCustomMenuList htmlPackageToUse modifiedModeVars htmlStartElements
- global htmlMenu HTMLmodeVars htmlSpecialCharacter
- global htmlCapCharSpecMenu htmlSpecialSymbCharacter
- global htmlElemKeyBinding htmlMenuKey
- global htmlSubMenus customHTMLpalettes
-
- set commonChars $HTMLmodeVars(commonChars)
- # Build submenus
- htmlReadMenuKeys
- foreach me $htmlSubMenus {
- set [lindex $me 0]Menu [htmlBuildOneMenu $me]
- }
-
-
- lappend htmlMenuList [list menu -M HTML -p htmlMenuItem -m -n Browsers $BrowsersMenu]
- append htmlMenuList " " [lindex $HTMLMenu 0]
- lappend htmlMenuList [list menu -M HTML -p htmlMenuItem -m -n Packages $PackagesMenu]
- lappend htmlMenuList [list menu -M HTML -p htmlMenuItem -m -n Preferences $PreferencesMenu]
- # add custom pallettes if any
- if {[info exists customHTMLpalettes]} {
- lappend htmlMenuList [list menu -M HTML -p htmlMenuItem -m -n Palettes $customHTMLpalettes]
- }
- lappend htmlMenuList [lindex $HTMLMenu 1] "(-" [lindex $HTMLMenu 2]
- for {set i $htmlStartElements} {$i < [llength $htmlSubMenus]} {incr i} {
- lappend htmlMenuList [list menu -M HTML -p htmlMenuItem -m -n [lindex $htmlSubMenus $i] [set [lindex [lindex $htmlSubMenus $i] 0]Menu]]
- }
-
- # Allow user to insert custom menu items
- if {[info exists htmlElemKeyBinding]} {
- foreach elem [lsort [array names htmlElemKeyBinding]] {
- lappend customMenuList "$htmlElemKeyBinding($elem)[string range $elem 0 0][string tolower [string range $elem 1 end]]"
- }
- set htmlCustomMenu [list menu -M HTML -p htmlMenuItem -m -n "Custom" $customMenuList]
- lappend htmlMenuList $htmlCustomMenu
- }
-
- # Show alert if user uses old way of defining custom elements.
- if {[info exists htmlCustomMenuList]} {htmlNewElemVar}
-
- # Character entities
- set htmlSmallCharsMenu [list menu -M HTML -p htmlMenuItem -m -n "Small Chars" \
- [lsort [array names htmlSpecialCharacter]]]
- set htmlCapCharsMenu [list menu -M HTML -p htmlMenuItem -m -c -n "Capital Chars" \
- [lsort [array names htmlCapCharSpecMenu]]]
- set htmlSymbCharsMenu [list menu -M HTML -p htmlMenuItem -m -n "Other Chars" \
- [lsort [array names htmlSpecialSymbCharacter]]]
- set tmp $commonChars
- if {[llength $commonChars]} {lappend tmp "(-"}
- lappend tmp Add… Default Clear $htmlSmallCharsMenu $htmlCapCharsMenu $htmlSymbCharsMenu
- set htmlCharsMenu [list menu -M HTML -p htmlMenuItem -m -n "Character Entities" $tmp]
- lappend htmlMenuList $htmlCharsMenu
-
- # Define menu
- menu -M HTML -m -p htmlMenuItem -n $htmlMenu $htmlMenuList
-
- set h {menu -M HTML -m -p htmlMenuItem -n $htmlMenu}
- lappend h $htmlMenuList
- htmlSaveCache "HTML menu cache" $h
- catch {unset htmlMenuKey}
- }
-
-
- proc htmlRebuildMenu {msg} {
- htmlDeleteCache "HTML menu cache"
- htmlBuildMenu $msg
- }
-
- # Mark subpackages
- proc htmlPackagesMenuExtra {} {
- global HTMLmodeVars
- if {$HTMLmodeVars(hideNetscape)} {markMenuItem -m Packages "Hide Netscape Only" 1 }
- if {$HTMLmodeVars(hideIE)} {markMenuItem -m Packages "Hide IE Only" 1 }
- if {$HTMLmodeVars(hideStyleAttrs)} {markMenuItem -m Packages "Hide CSS Attributes" 1 }
- }
-
- # Add browsers to Browser menu
- proc htmlBrowsersMenuExtra {} {
- global HTMLmodeVars browserSig modifiedModeVars htmlBrowsers
- if {[lsearch -exact $HTMLmodeVars(browsers) $browserSig] < 0} {
- lappend HTMLmodeVars(browsers) $browserSig
- lappend modifiedModeVars {browsers HTMLmodeVars}
- }
- set htmlBrowsers {}
- set tmpbrws {}
- foreach brws $HTMLmodeVars(browsers) {
- if {![catch {nameFromAppl $brws} name]} {
- set name [file tail $name]
- lappend htmlBrowsers [list $brws $name]
- lappend tmpbrws $brws
- htmlAddBrowserItem $name $brws
- if {$brws == $browserSig} {markMenuItem -m "Browsers" $name on }
- } else {
- lappend modifiedModeVars {browsers HTMLmodeVars}
- }
- }
- set HTMLmodeVars(browsers) $tmpbrws
- }
-
- # Mark and disable some stuff
- proc htmlDisMark {} {
- global htmlPackageToUse
- htmlDisableSome $htmlPackageToUse off
- if {$htmlPackageToUse == 1} {
- htmlMarkExt
- } else {
- htmlMark32
- }
- }
-
- proc htmlBuildUtilsMenu {{msg "Building HTML Utilities menu…"}} {
- global htmlUtilsMenu
-
- if {[catch {htmlReadCache "HTML Utilities menu cache"}]} {
- message $msg
- htmlBuildUtilsMenu0
- } else {
- message "Reading HTML Utilities menu definition…"
- }
- insertMenu $htmlUtilsMenu
-
- htmlCharacterMenuExtra
- htmlCheckMenuExtra
- htmlURLsMenuExtra
- htmlWindowsMenuExtra
- htmlUtilDisMark
-
- }
-
- proc htmlRebuildUtilsMenu {msg} {
- htmlDeleteCache "HTML Utilities menu cache"
- htmlBuildUtilsMenu $msg
- }
-
- proc htmlBuildUtilsMenu0 {} {
- global htmlUtilSubMenus HTMLmodeVars htmlPackageToUse htmlUtilsMenu htmlMenuKey
- # Build submenus
- htmlReadMenuKeys
- foreach me $htmlUtilSubMenus {
- set [lindex $me 0]Menu [htmlBuildOneMenu $me]
- }
-
- foreach me [lrange $htmlUtilSubMenus 1 end] {
- lappend utilSubs [list menu -M HTML -p htmlMenuItem -m -n $me [set [lindex $me 0]Menu]]
- }
-
- menu -M HTML -p htmlMenuItem -m \
- -n $htmlUtilsMenu [concat [lrange $UtilitiesMenu 0 3] "(-" \
- $utilSubs "(-" [lrange $UtilitiesMenu 4 end]]
-
- set h {menu -M HTML -p htmlMenuItem -m -n $htmlUtilsMenu}
- lappend h [concat [lrange $UtilitiesMenu 0 3] "(-" \
- $utilSubs "(-" [lrange $UtilitiesMenu 4 end]]
- htmlSaveCache "HTML Utilities menu cache" $h
- catch {unset htmlMenuKey}
- }
-
- # Add some things to translation menu.
- proc htmlCharacterMenuExtra {} {
- addMenuItem -m -l "" "Character Translation" "<>& -> HTML"
- addMenuItem -m -l "" "Character Translation" "HTML -> <>&"
- }
-
- # Check if Big Brother exists and if it should be used.
- proc htmlCheckMenuExtra {} {
- global HTMLmodeVars modifiedModeVars
- if {[catch {nameFromAppl Bbth}]} {
- enableMenuItem "Check Links" "Use Big Brother" off
- enableMenuItem "Check Links" "Check Remote Links" off
- if {$HTMLmodeVars(useBigBrother)} {
- set HTMLmodeVars(useBigBrother) 0
- lappend modifiedModeVars {useBigBrother HTMLmodeVars}
- }
- } elseif {$HTMLmodeVars(useBigBrother)} {
- markMenuItem -m {Check Links} {Use Big Brother} 1
- }
- }
-
- # Disable URLs menu if cache is empty.
- proc htmlURLsMenuExtra {} {
- global HTMLmodeVars
- if {![llength $HTMLmodeVars(URLs)]} {htmlEnableURLs off}
- }
-
- # Disable Windows menu if cache is empty.
- proc htmlWindowsMenuExtra {} {
- global HTMLmodeVars
- if {![llength $HTMLmodeVars(windows)]} {htmlEnablewindows off}
- }
-
- # Mark and disable some stuff
- proc htmlUtilDisMark {} {
- global htmlPackageToUse
- htmlDisableSome $htmlPackageToUse off
- if {$htmlPackageToUse == 1} {
- htmlMarkExtUtil
- } else {
- htmlMark32Util
- }
- }
-
- proc htmlSetDis1 {} {
- global HTMLmodeVars htmlDisabledItems1 htmlDisabledNetscape htmlDisabledIE
- set htmlDisabledItems1 ""
- if {$HTMLmodeVars(hideNetscape)} {append htmlDisabledItems1 " " $htmlDisabledNetscape}
- if {$HTMLmodeVars(hideIE)} {append htmlDisabledItems1 " " $htmlDisabledIE}
- }
-
- # Disabled menu items
- set htmlDisabledNetscape [list "Blocks and Dividers/Multi Column" \
- "Blocks and Dividers/Spacing" "Styles/Blinking" "Forms/Key Generator" "${htmlMenu}/Layers"]
- set htmlDisabledIE [list "Styles/Marquee" "Links/Sound"]
-
- htmlSetDis1
-
- set htmlDisabledItems3 [list "Packages/Hide Netscape Only" "Packages/Hide IE Only" \
- "Blocks and Dividers/Multi Column" \
- "Blocks and Dividers/Spacing" "Blocks and Dividers/No Line Break" \
- "Blocks and Dividers/Word Break" "Styles/Marquee" "Styles/Blinking" "Links/Object" \
- "Links/Sound" "${htmlMenu}/Plug-ins" "Tables/Head" "Tables/Body" \
- "Tables/Foot" "Tables/Column Group" "Tables/Column" "Forms/Button" "Forms/Key Generator" \
- "${htmlMenu}/Frames" "Java and JavaScript/Script" "Java and JavaScript/No Script" "${htmlMenu}/Layers"]
-