home *** CD-ROM | disk | FTP | other *** search
/ Webster's Millennium Amer…Sign Language Dictionary / ASL.ISO / mac / SHARED.cst / 00010_Script_10 < prev    next >
Text File  |  2001-09-17  |  5KB  |  149 lines

  1. --∂ï
  2. on setBtn1 pos
  3.   global TEMPLATE1, KNOB1, minPos1, maxPos1
  4.   global maxScroll,minScroll,gCat,scrollList
  5.   put max(float(maxscroll-minScroll),1) into scrollRange
  6.   put float(scrollRange/(maxPos1-minPos1)) into scrollRatio
  7.   put max(float((maxPos1-minPos1)/scrollRange),1.0) into sliderRatio
  8.   set the locH of sprite KNOB1 = minPos1 + integer(float(sliderRatio*(pos-1.0)))
  9.   ---------------
  10.   -- f...
  11.   if scrollRange > the width of sprite TEMPLATE1 then 
  12.     setSliderPos2 pos,scrollRange,minScroll
  13.     set theOffsetPos = (minscroll-1)+pos
  14.     --if not (line pos of scrollList="") then EntryByName (line pos of scrollList)
  15.     if not (line pos of scrollList="") then EntryByName (line theOffsetPos of scrollList)
  16.     --
  17.   else 
  18.     set refname = setWord(the locH of sprite KNOB1,scrollRange,scrollRatio,minPos1)
  19.     if not (refname="") then EntryByName refname
  20.   end if
  21.   -- ...this!!
  22.   ---------------
  23.   updatestage
  24. end setBtn1
  25.  
  26. on buttonDown1 
  27.   global TEMPLATE1, KNOB1, minPos1, maxPos1
  28.   global maxScroll,minScroll,gCat,scrollList
  29.   put max(float(maxscroll-minScroll),1) into scrollRange
  30.   
  31.   put scrollRange/(maxPos1-minPos1) into scrollRatio
  32.   
  33.   if the number of lines in scrollList = 2 then set scrollRatio = 0.005
  34.   
  35.   set oldMouseH = the mouseH
  36.   hideEntry
  37.   repeat while the stillDown 
  38.     if oldMouseH <> the mouseH then
  39.       set the locH of sprite KNOB1 = max( minPos1, min( ( the mouseH ) , maxPos1 ) )
  40.       set refname = setWord(the locH of sprite KNOB1,scrollRange,scrollRatio,minPos1)
  41.       updateStage
  42.       set oldMouseH = the mouseH  
  43.     end if
  44.   end repeat
  45.   cursor 4
  46.   EntryByName refname
  47.   showEntry
  48.   cursor 0
  49. end buttonDown1
  50.  
  51. on setWord locRef,scrollRange,scrollRatio,TheLeft
  52.   global scrollList,gWordList--ïïï
  53.   global maxScroll,minScroll
  54.   
  55.   if the number of lines in scrollList = 1 then set scrollRatio = 0
  56.   put float((locRef)-TheLeft)*scrollRatio into scrollLoc
  57.   
  58.   
  59.   put integer(minScroll+scrollLoc) into refVal
  60.   
  61.   put line refVal of scrollList into theWord
  62.   set the text of cast "word name" to theWord
  63.   set the text of cast "word" to theWord
  64.   set tempStr = string(integer(scrollLoc)+1)&"/"&string(integer(maxScroll-minScroll)+1) 
  65.   set the text of cast "word #" to tempStr
  66.   
  67.   --put refVal
  68.   
  69.   return line refVal of scrollList--ïïï
  70. end
  71.  
  72. on setSliderPos aWord
  73.   global gWordList,scrollList
  74.   global TEMPLATE1, KNOB1, minPos1,maxPos1
  75.   if the number of lines of scrollList > 2100 then -- we're in a-z browse mode
  76.     set wordLoc = getPos(gWordList,aWord)
  77.     set posRatio = count(gWordList)/the width of sprite TEMPLATE1
  78.     set sliderPos = minPos1+integer(wordLoc/posRatio)
  79.     set the locH of sprite KNOB1 = max(minPos1, min((sliderPos) , maxPos1))
  80.     set the text of cast "word name" to aWord
  81.     set the text of cast "word" to aWord
  82.     set the text of cast "word #" to string(wordLoc)&"/"&string(count(gWordList))
  83.   else
  84.     set the text of cast "word name" to aWord
  85.     set the text of cast "word" to aWord
  86.     set the text of cast "word #" to "???/???"
  87.   end if
  88.   updatestage
  89. end
  90.  
  91. on setSliderPos2 pos,scrollRange,minScroll
  92.   global gWordList,scrollList
  93.   global TEMPLATE1, KNOB1, minPos1,maxPos1
  94.   global maxScroll,minScroll
  95.   
  96.   --  put "setSliderPos2"
  97.   --  put "minScroll = " & minscroll
  98.   --  put "maxScroll = " & maxscroll
  99.   --  put "scrollRange = " & scrollRange
  100.   --  put "minPos1 = " & minPos1
  101.   --  put "maxPos1 = " & maxPos1
  102.   
  103.   set posRatio = float(scrollRange)/float(the width of sprite TEMPLATE1)
  104.   if posRatio = 0 then set posRatio = 1
  105.   --set posRatio = max(1,float(scrollRange)/float(the width of sprite TEMPLATE1))
  106.   
  107.   set sliderPos = minPos1+integer(float(pos)/posRatio) -- choose "xerox" in find-crash!
  108.   set the locH of sprite KNOB1 = max(minPos1, min((sliderPos) , maxPos1))
  109.   
  110.   set theWord = line (minscroll-1+pos) of scrollList
  111.   set the text of cast "word name" to theWord
  112.   set the text of cast "word" to theWord
  113.   if scrollRange < 2000 then
  114.     set tempStr = string(pos)&"/"&string(integer(maxScroll-minScroll)+1) 
  115.   else set tempStr = string(pos)&"/"&string(count(gWordList))
  116.   
  117.   set the text of cast "word #" to tempStr
  118.   
  119.   updatestage
  120. end
  121.  
  122. on buttonDown2 
  123.   global TEMPLATE2, KNOB2, minPos2, maxPos2,gVideoSpeed
  124.   set oldMouseH = the mouseH
  125.   repeat while the stillDown
  126.     if oldMouseH <> the mouseH then
  127.       set the locH of sprite KNOB2 = max( minPos2, min( ( the mouseH ) , maxPos2 ) )
  128.       set l = the left of sprite TEMPLATE2
  129.       set userLoc = the locH of sprite KNOB2-l
  130.       set slRatio = the width of sprite TEMPLATE2/9
  131.       set gVideoSpeed = max(userLoc/slRatio,1)
  132.       setVideoSpeed 0
  133.       --put tempoRef
  134.       updateStage
  135.       set oldMouseH = the mouseH   
  136.     end if
  137.   end repeat
  138. end buttonDown2 
  139.  
  140. on moveOneEntry dir
  141.   global gWordlist,maxscroll,minScroll
  142.   set the itemDelimiter to "/"
  143.   set aPos = integer(item 1 of field "word #")+dir
  144.   set the itemDelimiter to ","
  145.   if aPos < 1 or aPos > (maxscroll-minScroll)+1 then exit
  146.   hideEntry
  147.   setBtn1 aPos
  148.   showEntry
  149. end