home *** CD-ROM | disk | FTP | other *** search
/ Macwelt 1 / Macwelt DVD 1.toast / Web-Publishing / HTML-Editoren / Alpha ƒ / Tcl / Modes / HTML and CSS Modes / cssBuildDialog.tcl next >
Encoding:
Text File  |  2001-01-15  |  24.6 KB  |  700 lines

  1. ## -*-Tcl-*-
  2.  # ###################################################################
  3.  #  CSS mode - tools for editing CSS documents
  4.  # 
  5.  #  FILE: "cssBuildDialog.tcl"
  6.  #                                    created: 00-01-02 00.22.20 
  7.  #                                last update: 01-01-15 20.21.29 
  8.  #  Author: Johan Linde
  9.  #  E-mail: <alpha_www_tools@go.to>
  10.  #     www: <http://go.to/alpha_www_tools>
  11.  #  
  12.  # Version: 2.0
  13.  # 
  14.  # Copyright 1997-2001 by Johan Linde
  15.  #  
  16.  # This program is free software; you can redistribute it and/or modify
  17.  # it under the terms of the GNU General Public License as published by
  18.  # the Free Software Foundation; either version 2 of the License, or
  19.  # (at your option) any later version.
  20.  # 
  21.  # This program is distributed in the hope that it will be useful,
  22.  # but WITHOUT ANY WARRANTY; without even the implied warranty of
  23.  # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  24.  # GNU General Public License for more details.
  25.  # 
  26.  # You should have received a copy of the GNU General Public License
  27.  # along with this program; if not, write to the Free Software
  28.  # Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  29.  # 
  30.  # ###################################################################
  31.  ##
  32.  
  33. #===============================================================================
  34. # This file contain procs for building the dialogs for CSS 
  35. # properties. For each type of property there is a proc
  36. # css::BuildDialog<type>
  37. #===============================================================================
  38.  
  39. #===============================================================================
  40. # ◊◊◊◊ Dialog building ◊◊◊◊ #
  41. #===============================================================================
  42.  
  43. # group
  44. proc css::BuildDialoggroup {group v b hp wp bt ba ind} {
  45.     upvar $v val $b box $hp hpos $wp wpos $bt buttons $ba buttonAction $ind index
  46.     
  47.     global css::Group css::Property css::Descriptor css::IsDescriptor css::ExtraDialog
  48.     foreach prop [set css::Group($group)] {
  49.         if {${css::IsDescriptor}} {
  50.             set p [set css::Descriptor($prop)]
  51.         } else {
  52.             set p [set css::Property($prop)]
  53.         }
  54.         eval css::BuildDialog$p $prop val box hpos wpos buttons buttonAction index        
  55.     }
  56.     if {[info exists css::ExtraDialog($group)]} {
  57.         eval [set css::ExtraDialog($group)] hpos box
  58.     }
  59.     
  60.     css::ShorthandBox $group hpos box
  61. }
  62.  
  63. # @charset
  64. proc css::BuildDialog@charset {prop v b hp wp bt ba ind} {
  65.     upvar $v val $b box $hp hpos $wp wpos $ind index
  66.     lappend box -t "charset:" 10 $hpos 120 [expr {$hpos + 15}]
  67.     lappend box -e [lindex $val $index] 120 $hpos 450 [expr {$hpos + 15}]
  68.     incr hpos 30
  69. }
  70.  
  71. # @import
  72. proc css::BuildDialog@import {prop v b hp wp bt ba ind} {
  73.     upvar $v val $b box $hp hpos $wp wpos $bt buttons $ba buttonAction $ind index
  74.     lappend box -t "url:" 10 $hpos 120 [expr {$hpos + 15}]
  75.     css::UrlBox val box hpos wpos index buttons buttonAction
  76.     lappend box -t "media type(s):" 10 $hpos 120 [expr {$hpos + 15}]
  77.     css::MediaList val box hpos wpos index buttons buttonAction
  78. }
  79.  
  80. # @media
  81. proc css::BuildDialog@media {prop v b hp wp bt ba ind} {
  82.     upvar $v val $b box $hp hpos $wp wpos $bt buttons $ba buttonAction $ind index
  83.     lappend box -t "media type(s):" 10 $hpos 120 [expr {$hpos + 15}]
  84.     css::MediaList val box hpos wpos index buttons buttonAction
  85. }
  86.  
  87. # @page 
  88. proc css::BuildDialog@page {prop v b hp wp bt ba ind} {
  89.     upvar $v val $b box $hp hpos $wp wpos $ind index
  90.     lappend box -t "page name:" 10 $hpos 120 [expr {$hpos + 15}] \
  91.       -e [lindex $val $index] 130 $hpos 250 [expr {$hpos + 15}] \
  92.       -t "pseudo-page:" 260 $hpos 350 [expr {$hpos + 15}] \
  93.       -m [concat [list [lindex $val [expr {$index + 1}]] { }] :left :right :first] \
  94.       360 $hpos 450 [expr {$hpos + 20}]
  95.     incr index 2
  96.     incr hpos 30
  97. }
  98.  
  99. # choices
  100. proc css::BuildDialogchoices {prop v b hp wp bt ba ind} {
  101.     upvar $v val $b box $hp hpos $wp wpos $ind index
  102.     
  103.     global css::Choices css::IsDescriptor
  104.     css::PropertyPrompt $prop $hpos wpos box
  105.     # Special case with font-stretch descriptor
  106.     set ch [set css::Choices($prop)]
  107.     if {${css::IsDescriptor} && $prop == "font-stretch"} {set ch [lrange $ch 2 end]}
  108.     css::ChoiceList $ch val box hpos wpos index
  109.     incr hpos 30
  110. }
  111.  
  112. # color
  113. proc css::BuildDialogcolor {prop v b hp wp bt ba ind} {
  114.     upvar $v val $b box $hp hpos $wp wpos $bt buttons $ba buttonAction $ind index
  115.     
  116.     css::PropertyPrompt $prop $hpos wpos box
  117.     css::ChoiceList "" val box hpos wpos index
  118.     incr hpos 30
  119.     css::ColorBox val box hpos wpos index buttons buttonAction
  120. }
  121.  
  122. # url
  123. proc css::BuildDialogurl {prop v b hp wp bt ba ind} {
  124.     upvar $v val $b box $hp hpos $wp wpos $bt buttons $ba buttonAction $ind index
  125.     
  126.     css::PropertyPrompt $prop $hpos wpos box
  127.     css::ChoiceList "" val box hpos wpos index
  128.     css::UrlBox val box hpos wpos index buttons buttonAction
  129. }
  130.  
  131. # family = like font-family and voice-family
  132. proc css::BuildDialogfamily {prop v b hp wp bt ba ind} {
  133.     upvar $v val $b box $hp hpos $wp wpos $bt buttons $ba buttonAction $ind index
  134.     
  135.     css::BuildDialogchoices $prop val box hpos wpos buttons buttonAction index
  136.     lappend box -e [lindex $val $index] 10 $hpos 450 [expr {$hpos + 15}]
  137.     lappend box -b Add $wpos [expr {$hpos - 30}] [expr {$wpos + 60}] [expr {$hpos - 10}]
  138.     lappend buttons [expr {$index + 1}]
  139.     set buttonAction([expr {$index + 1}]) css::FamilyAddButton
  140.     incr index 2
  141.     set wpos 10
  142.     incr hpos 30
  143. }
  144.  
  145. # integer
  146. proc css::BuildDialoginteger {prop v b hp wp bt ba ind} {
  147.     upvar $v val $b box $hp hpos $wp wpos $ind index
  148.     
  149.     css::PropertyPrompt $prop $hpos wpos box
  150.     css::ChoiceList "" val box hpos wpos index
  151.     css::NumberNoUnitBox $hpos wpos val index box
  152.     incr hpos 30
  153. }
  154.  
  155. # number
  156. proc css::BuildDialognumber {prop v b hp wp bt ba ind} {
  157.     upvar $v val $b box $hp hpos $wp wpos $bt buttons $ba buttonAction $ind index
  158.     css::BuildDialoginteger $prop val box hpos wpos buttons buttonAction index
  159. }
  160.  
  161. # nlpc = number, length, percentage, or choices
  162. proc css::BuildDialognlpc {prop v b hp wp bt ba ind} {
  163.     upvar $v val $b box $hp hpos $wp wpos $ind index
  164.     css::NumChoice $prop length 1 1 val box hpos wpos index
  165. }
  166.  
  167. # lpc = length, percentage, or choices
  168. proc css::BuildDialoglpc {prop v b hp wp bt ba ind} {
  169.     upvar $v val $b box $hp hpos $wp wpos $ind index
  170.     css::NumChoice $prop length 1 0 val box hpos wpos index
  171. }
  172.  
  173. # npc = number, percentage, or choices
  174. proc css::BuildDialognpc {prop v b hp wp bt ba ind} {
  175.     upvar $v val $b box $hp hpos $wp wpos $ind index
  176.     css::NumChoice $prop number 1 1 val box hpos wpos index
  177. }
  178.  
  179. # lc = length or choices
  180. proc css::BuildDialoglc {prop v b hp wp bt ba ind} {
  181.     upvar $v val $b box $hp hpos $wp wpos $ind index
  182.     css::NumChoice $prop length 0 0 val box hpos wpos index
  183. }
  184.  
  185. # ac = angle or choices
  186. proc css::BuildDialogac {prop v b hp wp bt ba ind} {
  187.     upvar $v val $b box $hp hpos $wp wpos $ind index
  188.     css::NumChoice $prop angle 0 0 val box hpos wpos index
  189. }
  190.  
  191. # fc = frequency or choices
  192. proc css::BuildDialogfc {prop v b hp wp bt ba ind} {
  193.     upvar $v val $b box $hp hpos $wp wpos $ind index
  194.     css::NumChoice $prop frequency 0 0 val box hpos wpos index
  195. }
  196.  
  197. # cc = color or choices
  198. proc css::BuildDialogcc {prop v b hp wp bt ba ind} {
  199.     upvar $v val $b box $hp hpos $wp wpos $bt buttons $ba buttonAction $ind index
  200.     
  201.     css::BuildDialogchoices $prop val box hpos wpos bt ba index
  202.     css::ColorBox val box hpos wpos index buttons buttonAction
  203. }
  204.  
  205. # uc = url or choices
  206. proc css::BuildDialoguc {prop v b hp wp bt ba ind} {
  207.     upvar $v val $b box $hp hpos $wp wpos $bt buttons $ba buttonAction $ind index
  208.     
  209.     css::BuildDialogchoices $prop val box hpos wpos bt ba index
  210.     css::UrlBox val box hpos wpos index buttons buttonAction
  211. }
  212.  
  213. # lp = length or percentage
  214. proc css::BuildDialoglp {prop v b hp wp bt ba ind} {
  215.     upvar $v val $b box $hp hpos $wp wpos $ind index
  216.     
  217.     css::PropertyPrompt $prop $hpos wpos box
  218.     css::ChoiceList "" val box hpos wpos index
  219.     css::NumberBox $hpos wpos val index box length 1 0
  220.     incr hpos 30
  221. }
  222.  
  223. # tp = time or percentage
  224. proc css::BuildDialogtp {prop v b hp wp bt ba ind} {
  225.     upvar $v val $b box $hp hpos $wp wpos $ind index
  226.     
  227.     css::PropertyPrompt $prop $hpos wpos box
  228.     css::ChoiceList "" val box hpos wpos index
  229.     css::NumberBox $hpos wpos val index box time 1 0
  230.     incr hpos 30
  231. }
  232.  
  233. # ic = integer or choices
  234. proc css::BuildDialogic {prop v b hp wp bt ba ind} {
  235.     upvar $v val $b box $hp hpos $wp wpos $ind index
  236.     
  237.     global css::Choices
  238.     css::PropertyPrompt $prop $hpos wpos box
  239.     css::ChoiceList [set css::Choices($prop)] val box hpos wpos index
  240.     css::NumberNoUnitBox $hpos wpos val index box
  241.     incr hpos 30
  242.     
  243. }
  244.  
  245. # nc = number or choices
  246. proc css::BuildDialognc {prop v b hp wp bt ba ind} {
  247.     upvar $v val $b box $hp hpos $wp wpos $bt buttons $ba buttonAction $ind index
  248.     css::BuildDialogic $prop val box hpos wpos buttons buttonAction index
  249. }
  250.  
  251. # border
  252. proc css::BuildDialogborder {prop v b hp wp bt ba ind} {
  253.     upvar $v val $b box $hp hpos $wp wpos $bt buttons $ba buttonAction $ind index
  254.     global css::Property css::Choices
  255.     css::PropertyPrompt border-width $hpos wpos box
  256.     css::ChoiceList [set css::Choices(border-top-width)] val box hpos wpos index
  257.     css::NumberBox $hpos wpos val index box length 0 0
  258.     incr hpos 30
  259.     set wpos [css::PropertyPrompt border-style $hpos $wpos box]
  260.     css::ChoiceList [set css::Choices(border-top-style)] val box hpos wpos index
  261.     incr hpos 30
  262.     set wpos [css::PropertyPrompt border-color $hpos $wpos box]
  263.     css::ChoiceList "" val box hpos wpos index
  264.     incr hpos 30
  265.     css::ColorBox val box hpos wpos index buttons buttonAction
  266.     css::ShorthandBox $prop hpos box
  267. }
  268.  
  269. # clip
  270. proc css::BuildDialogclip {prop v b hp wp bt ba ind} {
  271.     upvar $v val $b box $hp hpos $wp wpos $ind index
  272.     global css::Choices
  273.     css::PropertyPrompt $prop $hpos wpos box
  274.     css::ChoiceList [set css::Choices(clip)] val box hpos wpos index
  275.     incr hpos 30
  276.     set wpos 40
  277.     foreach side {top right bottom left} {
  278.         lappend box -t $side: $wpos $hpos [expr {$wpos + 60}] [expr {$hpos + 15}]
  279.         incr wpos 60
  280.         lappend box -c auto [lindex $val $index] $wpos $hpos [expr {$wpos + 70}] [expr {$hpos + 15}]
  281.         incr index
  282.         incr wpos 70
  283.         css::NumberBox $hpos wpos val index box length 0 0
  284.         set wpos 40
  285.         incr hpos 30
  286.     }
  287. }
  288.  
  289. # quotes
  290. proc css::BuildDialogquotes {prop v b hp wp bt ba ind} {
  291.     upvar $v val $b box $hp hpos $wp wpos $bt buttons $ba buttonAction $ind index
  292.     css::BuildDialogchoices $prop val box hpos wpos buttons buttonAction index
  293.     lappend box -e [lindex $val $index] 130 $hpos 190 [expr {$hpos + 15}] \
  294.       -e [lindex $val [incr index]] 210 $hpos 270 [expr {$hpos + 15}] \
  295.       -b Add 290 $hpos 350 [expr {$hpos + 20}] \
  296.       -e [lindex $val [incr index 2]] 10 [expr {$hpos + 30}] 450 [expr {$hpos + 45}]
  297.     lappend buttons [expr {$index - 1}]
  298.     set buttonAction([expr {$index - 1}]) css::QuotesAddButton
  299.     incr index
  300.     incr hpos 50
  301. }
  302.  
  303. # counter
  304. proc css::BuildDialogcounter {prop v b hp wp bt ba ind} {
  305.     upvar $v val $b box $hp hpos $wp wpos $bt buttons $ba buttonAction $ind index
  306.     css::BuildDialogchoices $prop val box hpos wpos buttons buttonAction index
  307.     lappend box -e [lindex $val $index] 10 $hpos 450 [expr {$hpos + 15}]
  308.     incr index
  309.     incr hpos 30
  310. }
  311.  
  312. # size
  313. proc css::BuildDialogsize {prop v b hp wp bt ba ind} {
  314.     upvar $v val $b box $hp hpos $wp wpos $ind index
  315.     css::BuildDialogchoices $prop val box hpos wpos bt ba index
  316.     set wpos 130
  317.     css::NumberBox $hpos wpos val index box length 0 0
  318.     css::NumberBox $hpos wpos val index box length 0 0
  319.     incr hpos 30
  320. }
  321.  
  322. # content
  323. proc css::BuildDialogcontent {prop v b hp wp bt ba ind} {
  324.     upvar $v val $b box $hp hpos $wp wpos $bt buttons $ba buttonAction $ind index
  325.     css::BuildDialogchoices $prop val box hpos wpos bt ba index
  326.     lappend box -e [lindex $val $index] 10 $hpos 450 [expr {$hpos + 35}] \
  327.       -b Add $wpos [expr {$hpos - 30}] [expr {$wpos + 60}] [expr {$hpos - 10}]
  328.     lappend buttons [expr {$index + 1}]
  329.     set buttonAction([expr {$index + 1}]) css::ContentAddButton
  330.     incr index 2
  331.     incr hpos 50
  332.     set hpos2 [expr {$hpos + 20}]
  333.     lappend box -b URL 20 $hpos 85 $hpos2 -b Counter 110 $hpos 175 $hpos2 -b Counters 200 $hpos 265 $hpos2 -b Attr 290 $hpos 355 $hpos2
  334.     incr hpos 20
  335.     lappend buttons $index [incr index] [incr index] [incr index]
  336.     set buttonAction([expr {$index - 3}]) css::URLButton
  337.     set buttonAction([expr {$index - 2}]) css::CounterButton
  338.     set buttonAction([expr {$index - 1}]) css::CountersButton
  339.     set buttonAction($index) css::AttrButton
  340. }
  341.  
  342. # marks
  343. proc css::BuildDialogmarks {prop v b hp wp bt ba ind} {
  344.     upvar $v val $b box $hp hpos $wp wpos $ind index
  345.     css::PropertyPrompt $prop $hpos wpos box
  346.     css::ChoiceList none val box hpos wpos index
  347.     incr wpos 40
  348.     lappend box -c crop [lindex $val $index] $wpos $hpos [expr {$wpos + 70}] [expr {$hpos + 15}]
  349.     incr index
  350.     incr wpos 70
  351.     lappend box -c cross [lindex $val $index] $wpos $hpos [expr {$wpos + 70}] [expr {$hpos + 15}]
  352.     incr index
  353.     incr hpos 10
  354. }
  355.  
  356. # page
  357. proc css::BuildDialogpage {prop v b hp wp bt ba ind} {
  358.     upvar $v val $b box $hp hpos $wp wpos $ind index
  359.     css::PropertyPrompt $prop $hpos wpos box
  360.     lappend box -c auto [lindex $val $index] $wpos $hpos [expr {$wpos + 70}] [expr {$hpos + 15}]
  361.     incr index
  362.     lappend box -e [lindex $val $index] [expr {$wpos + 80}] $hpos 450 [expr {$hpos + 15}]
  363.     incr index
  364.     incr hpos 10
  365. }
  366.  
  367. # backpos
  368. proc css::BuildDialogbackpos {prop v b hp wp bt ba ind} {
  369.     upvar $v val $b box $hp hpos $wp wpos $ind index
  370.     css::PropertyPrompt $prop $hpos wpos box
  371.     lappend box -c inherit [lindex $val $index] $wpos $hpos [expr {$wpos + 70}] [expr {$hpos + 15}]
  372.     incr wpos 70; incr index
  373.     css::ChoiceList {top center bottom} val box hpos wpos index 0
  374.     css::ChoiceList {left center right} val box hpos wpos index 0
  375.     incr hpos 30; set wpos 170
  376.     css::NumberBox $hpos wpos val index box length 1 0
  377.     css::NumberBox $hpos wpos val index box length 1 0
  378.     incr hpos 30
  379. }
  380.  
  381. # fontstyle
  382. proc css::BuildDialogfontstyle {prop v b hp wp bt ba ind} {
  383.     upvar $v val $b box $hp hpos $wp wpos $bt buttons $ba buttonAction $ind index
  384.     css::BuildDialogfamily $prop val box hpos wpos buttons buttonAction index
  385.     incr hpos -60
  386.     lappend box -c all [lindex $val $index] 320 $hpos 400 [expr {$hpos + 15}]
  387.     incr index
  388.     incr hpos 60
  389. }
  390.  
  391. # fontvariant
  392. proc css::BuildDialogfontvariant {prop v b hp wp bt ba ind} {
  393.     upvar $v val $b box $hp hpos $wp wpos $bt buttons $ba buttonAction $ind index
  394.     css::BuildDialogfamily $prop val box hpos wpos buttons buttonAction index    
  395. }
  396.  
  397. # fontsize
  398. proc css::BuildDialogfontsize {prop v b hp wp bt ba ind} {
  399.     upvar $v val $b box $hp hpos $wp wpos $ind index
  400.     css::PropertyPrompt $prop $hpos wpos box
  401.     css::NumberBox $hpos wpos val index box length 0 0
  402.     lappend box -c all [lindex $val $index] 320 $hpos 400 [expr {$hpos + 15}]
  403.     incr index
  404.     incr hpos 30
  405.     lappend box -e [lindex $val $index] 10 $hpos 450 [expr {$hpos + 15}]
  406.     incr index
  407.     incr hpos 30
  408. }
  409.  
  410. # panose
  411. proc css::BuildDialogpanose {prop v b hp wp bt ba ind} {
  412.     upvar $v val $b box $hp hpos $wp wpos $ind index
  413.     css::PropertyPrompt $prop $hpos wpos box
  414.     for {set i 0} {$i < 10} {incr i} {
  415.         if {$i == 5} {incr hpos 30; set wpos 130}
  416.         css::NumberNoUnitBox $hpos wpos val index box
  417.     }
  418.     incr index 10
  419.     incr hpos 30
  420. }
  421.  
  422. # widths
  423. proc css::BuildDialogwidths {prop v b hp wp bt ba ind} {
  424.     upvar $v val $b box $hp hpos $wp wpos $ind index
  425.     css::PropertyPrompt $prop $hpos wpos box
  426.     lappend box -e [lindex $val $index]    $wpos $hpos 450 [expr {$hpos + 35}]
  427.     incr index
  428.     incr hpos 50
  429. }
  430.  
  431. # bbox
  432. proc css::BuildDialogbbox {prop v b hp wp bt ba ind} {
  433.     upvar $v val $b box $hp hpos $wp wpos $ind index
  434.     css::PropertyPrompt $prop $hpos wpos box
  435.     css::NumberNoUnitBox $hpos wpos val index box
  436.     css::NumberNoUnitBox $hpos wpos val index box
  437.     css::NumberNoUnitBox $hpos wpos val index box
  438.     css::NumberNoUnitBox $hpos wpos val index box
  439.     incr hpos 30
  440. }
  441.  
  442. # unirange
  443. proc css::BuildDialogunirange {prop v b hp wp bt ba ind} {
  444.     upvar $v val $b box $hp hpos $wp wpos $ind index
  445.     css::PropertyPrompt $prop $hpos wpos box
  446.     lappend box -e [lindex $val $index] $wpos $hpos 450 [expr {$hpos + 50}]
  447.     incr index
  448.     set wpos 10
  449.     incr hpos 65
  450. }
  451.  
  452. # src
  453. proc css::BuildDialogsrc {prop v b hp wp bt ba ind} {
  454.     upvar $v val $b box $hp hpos $wp wpos $bt buttons $ba buttonAction $ind index
  455.     css::BuildDialogurl $prop val box hpos wpos buttons buttonAction index
  456.     lappend box -t format: 40 $hpos 120 [expr {$hpos + 15}] \
  457.       -e [lindex $val $index] 130 $hpos 450 [expr {$hpos + 15}] \
  458.       -t "font face name:" 40 [expr {$hpos + 25}] 140 [expr {$hpos + 40}] \
  459.       -e [lindex $val [incr index]] 150 [expr {$hpos + 25}] 450 [expr {$hpos + 40}] \
  460.       -b Add 40 [expr {$hpos + 50}] 100 [expr {$hpos + 70}] \
  461.       -e [lindex $val [incr index 2]] 130 [expr {$hpos + 50}] 450 [expr {$hpos + 130}]
  462.     incr hpos 130
  463.     lappend buttons [expr {$index - 1}]
  464.     set buttonAction([expr {$index - 1}]) css::SrcButton
  465.     incr index
  466. }
  467.  
  468. # textalign
  469. proc css::BuildDialogtextalign {prop v b hp wp bt ba ind} {
  470.     upvar $v val $b box $hp hpos $wp wpos $ind index
  471.     global css::Choices
  472.     css::PropertyPrompt $prop $hpos wpos box
  473.     css::ChoiceList [set css::Choices($prop)] val box hpos wpos index
  474.     lappend box -e [lindex $val $index] 235 $hpos 450 [expr {$hpos + 15}]
  475.     incr index
  476.     set wpos 10
  477.     incr hpos 30
  478. }
  479.  
  480. # textdecoration
  481. proc css::BuildDialogtextdecoration {prop v b hp wp bt ba ind} {
  482.     upvar $v val $b box $hp hpos $wp wpos $ind index
  483.     global css::Choices
  484.     css::PropertyPrompt $prop $hpos wpos box
  485.     css::ChoiceList none val box hpos wpos index
  486.     set ch [set css::Choices($prop)]
  487.     lappend box -c [lindex $ch 0] [lindex $val $index] $wpos $hpos [expr {$wpos + 100}] [expr {$hpos + 15}]
  488.     incr wpos 110; incr index
  489.     lappend box -c [lindex $ch 1] [lindex $val $index] $wpos $hpos [expr {$wpos + 100}] [expr {$hpos + 15}]
  490.     set wpos 270; incr hpos 30; incr index
  491.     lappend box -c [lindex $ch 2] [lindex $val $index] $wpos $hpos [expr {$wpos + 100}] [expr {$hpos + 15}]
  492.     incr wpos 110; incr index
  493.     lappend box -c [lindex $ch 3] [lindex $val $index] $wpos $hpos [expr {$wpos + 100}] [expr {$hpos + 15}]
  494.     incr hpos 30; incr index
  495. }
  496.  
  497. # textshadow
  498. proc css::BuildDialogtextshadow {prop v b hp wp bt ba ind} {
  499.     upvar $v val $b box $hp hpos $wp wpos $bt buttons $ba buttonAction $ind index
  500.     css::PropertyPrompt $prop $hpos wpos box
  501.     css::ChoiceList none val box hpos wpos index
  502.     lappend box -n " "
  503.     set wpos 40
  504.     incr hpos 30
  505.     foreach item {horizontal vertical blur} {
  506.         lappend box -t $item: $wpos $hpos [expr {$wpos + 80}] [expr {$hpos + 15}]
  507.         incr wpos 80
  508.         css::NumberBox $hpos wpos val index box length 0 0
  509.         set wpos 40
  510.         incr hpos 30
  511.     }    
  512.     css::ColorBox val box hpos wpos index buttons buttonAction
  513.     lappend box -b Add 40 [expr {$hpos - 40}] 105 [expr {$hpos - 20}]
  514.     lappend buttons $index
  515.     set buttonAction($index) css::AddTextShadow
  516.     incr index
  517.     lappend box -e [lindex $val $index] 10 $hpos 420 [expr {$hpos + 60}]
  518.     incr hpos 60
  519. }
  520.  
  521. # borderspacing
  522. proc css::BuildDialogborderspacing {prop v b hp wp bt ba ind} {
  523.     upvar $v val $b box $hp hpos $wp wpos $ind index
  524.     css::PropertyPrompt $prop $hpos wpos box
  525.     css::ChoiceList "" val box hpos wpos index
  526.     incr hpos 30; set wpos 130
  527.     css::NumberBox $hpos wpos val index box length 0 0
  528.     css::NumberBox $hpos wpos val index box length 0 0
  529.     incr hpos 30    
  530. }
  531.  
  532. # cursor
  533. proc css::BuildDialogcursor {prop v b hp wp bt ba ind} {
  534.     upvar $v val $b box $hp hpos $wp wpos $bt buttons $ba buttonAction $ind index
  535.     global css::Choices
  536.     css::PropertyPrompt $prop $hpos wpos box
  537.     css::UrlBox val box hpos wpos index buttons buttonAction
  538.     lappend box -e [lindex $val $index] $wpos $hpos 450 [expr {$hpos + 50}] \
  539.       -b Add 40 $hpos 105 [expr {$hpos + 20}]
  540.     lappend buttons [incr index]
  541.     set buttonAction($index) css::CursorAddButton
  542.     incr index
  543.     incr hpos 60
  544.     css::ChoiceList [set css::Choices($prop)] val box hpos wpos index
  545.     incr hpos 20
  546. }
  547.  
  548. # playduring
  549. proc css::BuildDialogplayduring {prop v b hp wp bt ba ind} {
  550.     upvar $v val $b box $hp hpos $wp wpos $bt buttons $ba buttonAction $ind index
  551.     css::BuildDialogchoices $prop val box hpos wpos bt ba index
  552.     css::UrlBox val box hpos wpos index buttons buttonAction
  553.     lappend box -c mix [lindex $val $index] $wpos $hpos [expr {$wpos + 95}] [expr {$hpos + 15}]
  554.     incr index
  555.     lappend box -c repeat [lindex $val $index] [expr {$wpos + 100}] $hpos [expr {$wpos + 195}] [expr {$hpos + 15}]
  556.     incr index
  557.     incr hpos 30
  558. }
  559.  
  560. # azimuth
  561. proc css::BuildDialogazimuth {prop v b hp wp bt ba ind} {
  562.     upvar $v val $b box $hp hpos $wp wpos $ind index
  563.     global css::Choices
  564.     css::PropertyPrompt $prop $hpos wpos box
  565.     css::ChoiceList [set css::Choices($prop)] val box hpos wpos index
  566.     css::NumberBox $hpos wpos val index box angle 0 0
  567.     incr hpos 30; set wpos 130
  568.     css::ChoiceList {left-side far-left left center-left center center-right right far-right right-side} val box hpos wpos index 0
  569.     lappend box -c behind [lindex $val $index] $wpos $hpos [expr {$wpos + 95}] [expr {$hpos + 15}]
  570.     incr index
  571.     incr hpos 30
  572. }
  573.  
  574. #===============================================================================
  575. # ◊◊◊◊ Dialog building help procs ◊◊◊◊ #
  576. #===============================================================================
  577.  
  578. proc css::PropertyPrompt {prop hpos wp b} {
  579.     upvar $b box $wp wpos
  580.     set wpos 10
  581.     set ex 0
  582.     if {[string length $prop] > 14} {set ex 35}
  583.     if {[string length $prop] > 20} {set ex 55}
  584.     lappend box -t ${prop}: $wpos $hpos [expr {$wpos + 110 + $ex}] [expr {$hpos + 15}]
  585.     incr wpos 120
  586.     incr wpos $ex
  587. }
  588.  
  589. proc css::NumChoice {prop type percent number v b hp wp ind} {
  590.     upvar $v val $b box $hp hpos $wp wpos $ind index
  591.     global css::Choices
  592.     set wpos [css::PropertyPrompt $prop $hpos $wpos box]
  593.     css::ChoiceList [set css::Choices($prop)] val box hpos wpos index
  594.     css::NumberBox $hpos wpos val index box $type $percent $number
  595.     incr hpos 30
  596. }
  597.  
  598. proc css::NumberBox {hpos wp v ind b type percent number} {
  599.     upvar $v val $wp wpos $b box $ind index
  600.     
  601.     global css::Units
  602.     set units [set css::Units($type)]
  603.     if {$percent} {lappend units %}
  604.     set uw 110
  605.     if {$number} {set units "{ } $units"; set uw 160}
  606.     lappend box -e [lindex $val $index] $wpos $hpos [expr {$wpos + 50}] [expr {$hpos + 15}]
  607.     lappend box -m [concat [list [lindex $val [expr {$index + 1}]]] $units] \
  608.       [expr {$wpos + 60}] $hpos [expr {$wpos + $uw}] [expr {$hpos + 20}]
  609.     incr index 2
  610.     incr wpos [expr {60 + $uw}]
  611. }
  612.  
  613. proc css::NumberNoUnitBox {hpos wp v ind b} {
  614.     upvar $v val $wp wpos $b box $ind index
  615.     
  616.     lappend box -e [lindex $val $index] $wpos $hpos [expr {$wpos + 50}] [expr {$hpos + 15}]
  617.     incr wpos 60
  618.     incr index
  619. }
  620.  
  621. proc css::ChoiceList {items v b hp wp ind {inherit 1}} {
  622.     upvar $v val $b box $hp hpos $wp wpos $ind index
  623.     
  624.     global css::IsDescriptor
  625.     if {${css::IsDescriptor} && ![llength $items]} {return}
  626.     if {[llength $items]} {
  627.         set inh ""
  628.         if {!${css::IsDescriptor} && $inherit} {set inh "inherit -"}
  629.         lappend box -m [concat  [list [lindex $val $index]] $inh {" "} $items] \
  630.           $wpos $hpos [expr {$wpos + 95}] [expr {$hpos + 20}]
  631.     } else {
  632.         lappend box -c inherit [lindex $val $index] $wpos $hpos [expr {$wpos + 95}] [expr {$hpos + 15}]
  633.     }
  634.     incr wpos 105
  635.     incr index
  636. }
  637.  
  638. proc css::ColorBox {v b hp wp ind bt ba} {
  639.     upvar $v val $b box $hp hpos $wp wpos $ind index $bt buttons $ba buttonAction
  640.     global html::userColors html::basicColors css::Colors
  641.     set htmlColors [lsort [array names html::userColors]]
  642.      append htmlColors " - " ${html::basicColors} " - " ${css::Colors}
  643.     lappend box -e [lindex $val $index] 130 $hpos 200 [expr {$hpos + 15}] \
  644.     -m [concat [list [lindex $val [expr {$index + 1}]] { }] $htmlColors] \
  645.     210 $hpos 350 [expr {$hpos + 20}] \
  646.     -b "New Color…" 360 $hpos 460 [expr {$hpos + 20}]
  647.     incr index 3
  648.     lappend buttons [expr {$index - 1}]
  649.     set buttonAction([expr {$index - 1}]) css::ColorButton
  650.     set wpos 120
  651.     incr hpos 40    
  652. }
  653.  
  654. proc css::UrlBox {v b hp wp ind bt ba} {
  655.     upvar $v val $b box $hp hpos $wp wpos $ind index $bt buttons $ba buttonAction
  656.     global HTMLmodeVars
  657.     lappend box -e [lindex $val $index] 130 $hpos 460 [expr {$hpos + 15}] \
  658.     -m [concat [list [lindex $val [expr {$index + 1}]] { }] $HTMLmodeVars(URLs)] \
  659.     130 [expr {$hpos + 25}] 460 [expr {$hpos + 45}] \
  660.     -b "File…" 10 [expr {$hpos + 20}] 70 [expr {$hpos + 40}]
  661.     incr index 3
  662.     lappend buttons [expr {$index - 1}]
  663.     set buttonAction([expr {$index - 1}]) css::FileButton
  664.     set wpos 120
  665.     incr hpos 50
  666. }
  667.  
  668. proc css::MediaList {v b hp wp ind bt ba} {
  669.     upvar $v val $b box $hp hpos $wp wpos $ind index $bt buttons $ba buttonAction
  670.     
  671.     global HTMLmodeVars
  672.     lappend box -m [concat [list [lindex $val $index] { }] $HTMLmodeVars(mediatypes)] \
  673.       130 $hpos 260 [expr {$hpos + 20}] \
  674.       -e [lindex $val [expr {$index + 1}]] 130 [expr {$hpos + 30}] 460 [expr {$hpos + 45}] \
  675.       -b Add 270 $hpos 330 [expr {$hpos + 20}]
  676.     lappend buttons [expr {$index + 2}]
  677.     set buttonAction([expr {$index + 2}]) css::FamilyAddButton
  678.     incr index 3
  679.     incr hpos 60
  680. }
  681.  
  682.  
  683. proc css::ShorthandBox {group hp b} {
  684.     upvar $hp hpos $b box
  685.     global css::Shorthand css::UseShort css::InheritAll
  686.     if {[set css::Shorthand($group)]} {
  687.         lappend box -c "Inherit all" ${css::InheritAll} 10 $hpos 150 [expr {$hpos + 15}]
  688.         lappend box -c "Use shorthand form if possible" ${css::UseShort} 160 $hpos 400 [expr {$hpos + 15}]
  689.         incr hpos 20
  690.     }
  691. }
  692.  
  693. proc css::AllValuesBox {hp b} {
  694.     upvar $hp hpos $b box
  695.     global css::SetAllValues
  696.     lappend box -r "Set all values individually" ${css::SetAllValues} 10 $hpos 300 [expr {$hpos + 15}]
  697.     lappend box -r "Add missing values automatically if possible" [expr {!${css::SetAllValues}}] 10 [expr {$hpos + 20}] 350 [expr {$hpos + 35}]
  698.     incr hpos 40    
  699. }
  700.