home *** CD-ROM | disk | FTP | other *** search
- on indexScrollWindow whichDirection, dontMoveSlider
- global indexWindowObject
- set whichField to the textName of indexWindowObject
- set fullScrollDist to the fullScrollDist of indexWindowObject
- set pageScrollDist to the pageScrollDist of indexWindowObject
- set theLineHeight to the textHeight of field whichField
- set maxScrollTop to fullScrollDist
- set linesPerPage to (pageScrollDist + (theLineHeight / 2)) / theLineHeight
- set oldScrollTop to the scrollTop of member whichField
- if whichDirection = "pageUp" then
- set newTop to the scrollTop of member whichField - pageScrollDist
- if newTop < 0 then
- set newTop to 0
- end if
- set the scrollTop of member whichField to newTop
- else
- if whichDirection = "pageDown" then
- set distLeft to maxScrollTop - the scrollTop of member whichField
- set linesLeft to (distLeft + (theLineHeight / 2)) / theLineHeight
- set maxLines to (maxScrollTop + (theLineHeight / 2)) / theLineHeight
- if linesLeft >= linesPerPage then
- set the scrollTop of member whichField to the scrollTop of member whichField + pageScrollDist
- else
- set the scrollTop of member whichField to maxScrollTop
- end if
- else
- if integerp(whichDirection) then
- if whichDirection <= 0 then
- set newTop to the scrollTop of member whichField + (whichDirection * theLineHeight)
- else
- set nextHeight to oldScrollTop + (whichDirection * theLineHeight)
- if nextHeight <= maxScrollTop then
- set newTop to the scrollTop of member whichField + (whichDirection * theLineHeight)
- else
- set newTop to the scrollTop of member whichField + (maxScrollTop - oldScrollTop)
- end if
- end if
- else
- if whichDirection > 1 then
- set whichDirection to 1.0
- end if
- set whichLine to integer(whichDirection * maxScrollTop / theLineHeight) + 1
- set currentLine to (oldScrollTop / theLineHeight) + 1
- set newTop to the scrollTop of member whichField + ((whichLine - currentLine) * theLineHeight)
- end if
- if newTop < 0 then
- set newTop to 0
- end if
- set the scrollTop of member whichField to newTop
- end if
- end if
- set the currentLine of indexWindowObject to 0
- if dontMoveSlider then
- return
- end if
- indexResetSlider()
- end
-
- on indexResetSlider
- global indexWindowObject
- set whichField to the textName of indexWindowObject
- set fullScrollDist to the fullScrollDist of indexWindowObject
- set pageScrollDist to the pageScrollDist of indexWindowObject
- set maxScrollTop to fullScrollDist
- if maxScrollTop <= 0 then
- set maxScrollTop to 1
- end if
- set newScrollTop to the scrollTop of member whichField
- set sliderSprite to the sliderSprite of indexWindowObject
- set barRect to the barRect of indexWindowObject
- puppetSprite(sliderSprite, 1)
- set sliderHeight to the height of sprite sliderSprite
- set sliderMinV to getAt(barRect, 2) + (sliderHeight / 2)
- set sliderMaxV to getAt(barRect, 4) - (sliderHeight / 2) - 1
- set sliderRange to sliderMaxV - sliderMinV
- set newV to sliderMinV + (newScrollTop * sliderRange / maxScrollTop)
- if newV < sliderMinV then
- set newV to sliderMinV
- else
- if newV > sliderMaxV then
- set newV to sliderMaxV
- end if
- end if
- if fullScrollDist <= 0 then
- set the visible of sprite sliderSprite to 0
- set the visible of sprite the upArrowSprite of indexWindowObject to 0
- set the visible of sprite the downArrowSprite of indexWindowObject to 0
- else
- set the visible of sprite sliderSprite to 1
- set the locV of sprite sliderSprite to newV
- set the visible of sprite the upArrowSprite of indexWindowObject to 1
- set the visible of sprite the downArrowSprite of indexWindowObject to 1
- end if
- updateStage()
- indexUpdateSliderRect()
- end
-