home *** CD-ROM | disk | FTP | other *** search
/ CD-ROM Today (BR) Volume 3 #5 / CDRV3N5.ISO / demo / launchdm.dir / 00004.ls < prev    next >
Encoding:
Text File  |  1996-07-11  |  3.6 KB  |  174 lines

  1. on cleanup
  2.   if the machineType <> 256 then
  3.     releaseRearWindow()
  4.   end if
  5. end
  6.  
  7. on blackout
  8.   global black
  9.   initRearWindow()
  10.   coverDesktop(black)
  11. end
  12.  
  13. on initRearWindow
  14.   global rwObj, gMaxColors, deskTopPattern, black
  15.   set x to the colorDepth
  16.   if x >= 8 then
  17.     set gMaxColors to 255
  18.   end if
  19.   if x = 4 then
  20.     set gMaxColors to 15
  21.   end if
  22.   if x = 2 then
  23.     set gMaxColors to 3
  24.   end if
  25.   if x = 1 then
  26.     set gMaxColors to 0
  27.   end if
  28.   initGlobals()
  29.   if objectp(rwObj) then
  30.     rwObj(mdispose)
  31.   end if
  32.   makeObjIfNeeded()
  33. end
  34.  
  35. on releaseRearWindow
  36.   global rwObj
  37.   if objectp(rwObj) then
  38.     rwObj(mdispose)
  39.   end if
  40. end
  41.  
  42. on initGlobals
  43.   global white, ltGray, gray, dkGray, black, deskTopPattern
  44.   set white to -1
  45.   set ltGray to -2
  46.   set gray to -3
  47.   set dkGray to -4
  48.   set black to -5
  49.   set deskTopPattern to -99
  50. end
  51.  
  52. on displayAppName
  53.   global rwObj
  54.   set returnStr to rwObj(mGetAppName)
  55. end
  56.  
  57. on coverDesktop patVar
  58.   global rwObj
  59.   makeObjIfNeeded()
  60.   rwObj(mPatToWindow, patVar)
  61. end
  62.  
  63. on loadPICT
  64.   global rwObj
  65.   makeObjIfNeeded()
  66.   set fileName to the pathName & "Background.PICT"
  67.   set retValue to rwObj(mPICTToWindow, fileName, 1, -99)
  68.   if value(retValue) < 0 then
  69.     alert("System error" && retValue && "trying to load PICT file" && QUOTE & fileName & QUOTE)
  70.     stopMovie()
  71.     exit
  72.   end if
  73. end
  74.  
  75. on loadCast castName
  76.   global rwObj
  77.   makeObjIfNeeded()
  78.   set myPic to the picture of cast castName
  79.   set retValue to rwObj(mCastToWindow, myPic, 1, -99)
  80.   if value(retValue) < 0 then
  81.     alert("Error trying to load castMember" && QUOTE & castName & QUOTE)
  82.     stopMovie()
  83.     exit
  84.   end if
  85. end
  86.  
  87. on UnCoverDesktop
  88.   global rwObj
  89.   if objectp(rwObj) then
  90.     rwObj(mdispose)
  91.   end if
  92.   unLoad()
  93. end
  94.  
  95. on makeObjIfNeeded
  96.   global rwObj
  97.   if not objectp(rwObj) then
  98.     set rwObj to RearWindow(mnew, "M")
  99.     if value(rwObj) < 0 then
  100.       alert("System error" && rwObj && "trying to create the RearWindow object in RAM (multiple-monitor config).")
  101.       stopMovie()
  102.       exit
  103.     end if
  104.     writeStageAndScreenBounds()
  105.     if the freeBlock < rwObj(mGetMemoryNeeded) then
  106.       if objectp(rwObj) then
  107.         rwObj(mdispose)
  108.         set rwObj to RearWindow(mnew, "S")
  109.       end if
  110.       if value(rwObj) < 0 then
  111.         alert("System error" && rwObj && "trying to create the RearWindow object in RAM (single-monitor config).")
  112.         stopMovie()
  113.         exit
  114.       end if
  115.       writeStageAndScreenBounds()
  116.     end if
  117.   end if
  118. end
  119.  
  120. on writeStageAndScreenBounds
  121. end
  122.  
  123. on fillWithIndexColor
  124.   global rwObj
  125.   makeObjIfNeeded()
  126.   set patVar to value(field "colorIndex")
  127.   rwObj(mIndexColorToWindow, patVar)
  128. end
  129.  
  130. on fillWithRGBColor
  131.   global rwObj
  132.   makeObjIfNeeded()
  133.   rwObj(mRGBColorToWindow, 10000, 25000, 65000)
  134. end
  135.  
  136. on bumpCIndex direction
  137.   global rwObj, white, gMaxColors
  138.   set cIndex to value(field "colorIndex")
  139.   if integerp(cIndex) then
  140.     set cIndex to cIndex + direction
  141.     if (cIndex < 0) or (cIndex > gMaxColors) then
  142.       exit
  143.     else
  144.       put string(cIndex) into field "colorIndex"
  145.       if cIndex then
  146.         makeObjIfNeeded()
  147.         rwObj(mIndexColorToWindow, cIndex)
  148.       else
  149.         coverDesktop(white)
  150.       end if
  151.       repeat while the stillDown
  152.         set cIndex to cIndex + direction
  153.         if (cIndex < 0) or (cIndex > gMaxColors) then
  154.           exit
  155.           next repeat
  156.         end if
  157.         put string(cIndex) into field "colorIndex"
  158.         if cIndex then
  159.           makeObjIfNeeded()
  160.           rwObj(mIndexColorToWindow, cIndex)
  161.           next repeat
  162.         end if
  163.         coverDesktop(white)
  164.       end repeat
  165.     end if
  166.   end if
  167. end
  168.  
  169. on wait n
  170.   startTimer()
  171.   repeat while the timer < n
  172.   end repeat
  173. end
  174.