home *** CD-ROM | disk | FTP | other *** search
/ GU Photo: Background 3 / GU.iso / pc / win / browser.exe / browser.DXR / 00130_main.ls < prev    next >
Encoding:
Text File  |  1994-09-30  |  11.2 KB  |  510 lines

  1. global gmode, gno, gextension, glefttopitemno, gkategorie, gviewlist, gfilelister
  2.  
  3. on startMovie
  4.   initmachine()
  5.   setmanualmode()
  6.   set gno to 0
  7. end
  8.  
  9. on stopMovie
  10.   clearGlobals()
  11. end
  12.  
  13. on listlinkfile n, m
  14.   repeat with i = n to m
  15.     put the fileName of cast i
  16.   end repeat
  17. end
  18.  
  19. on quitbrowser
  20.   quit()
  21. end
  22.  
  23. on initmachine
  24.   if the machineType = 256 then
  25.     set gextension to ".BMP"
  26.   else
  27.     set gextension to ".pic"
  28.   end if
  29. end
  30.  
  31. on loadpictureforbrowser br, lno
  32.   global gextension
  33.   set l to finddata(br)
  34.   if 0 < l then
  35.     set kl to getmembersofkategorie(br)
  36.     if lno < 0 then
  37.       set lno to kl - 1
  38.     else
  39.       if kl <= lno then
  40.         set lno to 0
  41.       end if
  42.     end if
  43.     set fshortname to getfname(l + lno) & gextension
  44.     set the picture of cast (gethv(l + lno) & "PICT240x180") to the picture of cast ("8240" & fshortname)
  45.     put fshortname into field "FileName"
  46.     put l + lno into field "search"
  47.     set gno to lno
  48.     return lno
  49.   end if
  50.   return -1
  51. end
  52.  
  53. on loadpictureforbrowserabs br, no
  54.   global gextension
  55.   set l to finddata(br)
  56.   if 0 < no then
  57.     set fshortname to getfname(no) & gextension
  58.     set the picture of cast (gethv(no) & "PICT240x180") to the picture of cast ("8240" & fshortname)
  59.     put fshortname into field "FileName"
  60.     put no into field "search"
  61.     set gno to no - l
  62.   end if
  63. end
  64.  
  65. on SetupBrowser cate, no
  66. end
  67.  
  68. on EndBrowser
  69. end
  70.  
  71. on finddata br
  72.   set l to the number of lines in field "data"
  73.   repeat with i = 1 to l
  74.     set p to item 2 of line i of field "data"
  75.     if p = br then
  76.       return i
  77.     end if
  78.   end repeat
  79.   return 0
  80. end
  81.  
  82. on gethv n
  83.   if (n < 1) or (the number of lines in field "data" < n) then
  84.     return EMPTY
  85.   end if
  86.   return item 3 of line n of field "data"
  87. end
  88.  
  89. on getfname n
  90.   if (n < 1) or (the number of lines in field "data" < n) then
  91.     return EMPTY
  92.   end if
  93.   return item 1 of line n of field "data"
  94. end
  95.  
  96. on getkategorie n
  97.   if (n < 1) or (the number of lines in field "data" < n) then
  98.     return EMPTY
  99.   end if
  100.   return item 2 of line n of field "data"
  101. end
  102.  
  103. on getmembersofkategorie br
  104.   set cnt to 0
  105.   set l to the number of lines in field "data"
  106.   repeat with i = finddata(br) to l
  107.     set p to item 2 of line i of field "data"
  108.     if p <> br then
  109.       exit repeat
  110.     end if
  111.     set cnt to cnt + 1
  112.   end repeat
  113.   return cnt
  114. end
  115.  
  116. on getno nm
  117.   set l to the number of lines in field "data"
  118.   repeat with i = 1 to l
  119.     set p to item 1 of line i of field "data"
  120.     if p = nm then
  121.       return i
  122.     end if
  123.   end repeat
  124.   return 0
  125. end
  126.  
  127. on whichmode
  128.   return gmode
  129. end
  130.  
  131. on setmanualmode
  132.   set gmode to #manual
  133.   when timeOut then nothing
  134.   RadioButtonOFF()
  135. end
  136.  
  137. on setautomode
  138.   set gmode to #auto
  139.   when timeOut then AutoView
  140.   set the timeoutLength to 1 * 60
  141.   RadioButtonOn()
  142. end
  143.  
  144. on FinishAutoView
  145.   set gmode to #manual
  146.   when timeOut then nothing
  147.   puppetSprite(3, 0)
  148.   updateStage()
  149. end
  150.  
  151. on autoview
  152.   if whichmode() = #auto then
  153.     set gno to gno + 1
  154.     set gno to loadpictureforbrowser(getlabelname(), gno)
  155.   end if
  156. end
  157.  
  158. on RadioButtonOn
  159.   set sp to clickOn()
  160.   if 0 < sp then
  161.     puppetSound("Click")
  162.     puppetSprite(sp, 1)
  163.     set the ink of sprite sp to 2
  164.     updateStage()
  165.     repeat while soundBusy(1)
  166.     end repeat
  167.     puppetSound(0)
  168.   end if
  169. end
  170.  
  171. on RadioButtonOFF
  172.   set sp to clickOn()
  173.   if 0 < sp then
  174.     puppetSound("Click")
  175.     puppetSprite(sp, 0)
  176.     updateStage()
  177.     repeat while soundBusy(1)
  178.     end repeat
  179.     puppetSound(0)
  180.   end if
  181. end
  182.  
  183. on prev
  184.   if whichmode() = #manual then
  185.     set gno to gno - 1
  186.     set gno to loadpictureforbrowser(getlabelname(), gno)
  187.   end if
  188. end
  189.  
  190. on next
  191.   if whichmode() = #manual then
  192.     set gno to gno + 1
  193.     set gno to loadpictureforbrowser(getlabelname(), gno)
  194.   end if
  195. end
  196.  
  197. on getlabelname
  198.   set l to the labelList
  199.   set n to the number of lines in l - 1
  200.   repeat with i = 1 to n
  201.     put "," & label(line i of l) after line i of l
  202.   end repeat
  203.   repeat with i = n down to 1
  204.     if value(item 2 of line i of l) <= the frame then
  205.       return item 1 of line i of l
  206.     end if
  207.   end repeat
  208.   return EMPTY
  209. end
  210.  
  211. on copytohdd
  212.   global gextension
  213.   unLoadCast(1, 116)
  214.   unLoadCast(172, 272)
  215.   unLoadCast(274, 374)
  216.   set l to finddata(getlabelname())
  217.   if 0 < l then
  218.     set path to the pathName
  219.     set fname to path & EMPTY & getdatadir() & getfname(l + gno) & gextension
  220.     set fshortname to getfname(l + gno) & gextension
  221.     set f to FileIO(mnew, "read", fname)
  222.     if objectp(f) then
  223.       set len to f(mGetLength) + 200
  224.       if len < the freeBlock then
  225.         set d to FileIO(mnew, "?write", fshortname)
  226.         updateStage()
  227.         if objectp(d) then
  228.           copyfileio(d, f)
  229.           d(mdispose)
  230.         end if
  231.       else
  232.         set msg to string(the freeBlock / 1024) & "Kbytes Memory available . But, need" && string(len / 1024) & "Kbytes ."
  233.         alert(msg)
  234.       end if
  235.       f(mdispose)
  236.     end if
  237.   end if
  238. end
  239.  
  240. on getdatadir
  241.   if the machineType = 256 then
  242.     set pre to EMPTY
  243.     if field "colorDepth" = "8bit" then
  244.       set pre to "8"
  245.     end if
  246.     if field "sizehv" = "120x90" then
  247.       return pre & "120" & "¥"
  248.     else
  249.       if field "sizehv" = "240x180" then
  250.         return pre & "240" & "¥"
  251.       else
  252.         if field "sizehv" = "640x480" then
  253.           return pre & "640" & "¥"
  254.         end if
  255.       end if
  256.     end if
  257.   else
  258.     return field "sizehv" & ":"
  259.   end if
  260.   return EMPTY
  261. end
  262.  
  263. on eventEater
  264.   dontPassEvent()
  265. end
  266.  
  267. on copyfileio dest, src
  268.   when mouseUp then eventEater
  269.   when mouseDown then eventEater
  270.   when keyUp then eventEater
  271.   when keyDown then eventEater
  272.   cursor(4)
  273.   set len to src(mGetLength)
  274.   set p to len / 64
  275.   set q to len mod 64
  276.   repeat with i = 1 to p
  277.     dest(mWriteChar, src(mReadChar))
  278.     dest(mWriteChar, src(mReadChar))
  279.     dest(mWriteChar, src(mReadChar))
  280.     dest(mWriteChar, src(mReadChar))
  281.     dest(mWriteChar, src(mReadChar))
  282.     dest(mWriteChar, src(mReadChar))
  283.     dest(mWriteChar, src(mReadChar))
  284.     dest(mWriteChar, src(mReadChar))
  285.     dest(mWriteChar, src(mReadChar))
  286.     dest(mWriteChar, src(mReadChar))
  287.     dest(mWriteChar, src(mReadChar))
  288.     dest(mWriteChar, src(mReadChar))
  289.     dest(mWriteChar, src(mReadChar))
  290.     dest(mWriteChar, src(mReadChar))
  291.     dest(mWriteChar, src(mReadChar))
  292.     dest(mWriteChar, src(mReadChar))
  293.     dest(mWriteChar, src(mReadChar))
  294.     dest(mWriteChar, src(mReadChar))
  295.     dest(mWriteChar, src(mReadChar))
  296.     dest(mWriteChar, src(mReadChar))
  297.     dest(mWriteChar, src(mReadChar))
  298.     dest(mWriteChar, src(mReadChar))
  299.     dest(mWriteChar, src(mReadChar))
  300.     dest(mWriteChar, src(mReadChar))
  301.     dest(mWriteChar, src(mReadChar))
  302.     dest(mWriteChar, src(mReadChar))
  303.     dest(mWriteChar, src(mReadChar))
  304.     dest(mWriteChar, src(mReadChar))
  305.     dest(mWriteChar, src(mReadChar))
  306.     dest(mWriteChar, src(mReadChar))
  307.     dest(mWriteChar, src(mReadChar))
  308.     dest(mWriteChar, src(mReadChar))
  309.     dest(mWriteChar, src(mReadChar))
  310.     dest(mWriteChar, src(mReadChar))
  311.     dest(mWriteChar, src(mReadChar))
  312.     dest(mWriteChar, src(mReadChar))
  313.     dest(mWriteChar, src(mReadChar))
  314.     dest(mWriteChar, src(mReadChar))
  315.     dest(mWriteChar, src(mReadChar))
  316.     dest(mWriteChar, src(mReadChar))
  317.     dest(mWriteChar, src(mReadChar))
  318.     dest(mWriteChar, src(mReadChar))
  319.     dest(mWriteChar, src(mReadChar))
  320.     dest(mWriteChar, src(mReadChar))
  321.     dest(mWriteChar, src(mReadChar))
  322.     dest(mWriteChar, src(mReadChar))
  323.     dest(mWriteChar, src(mReadChar))
  324.     dest(mWriteChar, src(mReadChar))
  325.     dest(mWriteChar, src(mReadChar))
  326.     dest(mWriteChar, src(mReadChar))
  327.     dest(mWriteChar, src(mReadChar))
  328.     dest(mWriteChar, src(mReadChar))
  329.     dest(mWriteChar, src(mReadChar))
  330.     dest(mWriteChar, src(mReadChar))
  331.     dest(mWriteChar, src(mReadChar))
  332.     dest(mWriteChar, src(mReadChar))
  333.     dest(mWriteChar, src(mReadChar))
  334.     dest(mWriteChar, src(mReadChar))
  335.     dest(mWriteChar, src(mReadChar))
  336.     dest(mWriteChar, src(mReadChar))
  337.     dest(mWriteChar, src(mReadChar))
  338.     dest(mWriteChar, src(mReadChar))
  339.     dest(mWriteChar, src(mReadChar))
  340.     dest(mWriteChar, src(mReadChar))
  341.   end repeat
  342.   repeat with i = 1 to q
  343.     dest(mWriteChar, src(mReadChar))
  344.   end repeat
  345.   if the machineType <> 256 then
  346.     dest(mSetFinderInfo, "PICT", "????")
  347.   end if
  348.   when mouseUp then nothing
  349.   when mouseDown then nothing
  350.   when keyUp then nothing
  351.   when keyDown then nothing
  352.   cursor(-1)
  353. end
  354.  
  355. on initfullscreen
  356.   global gextension
  357.   set l to finddata(getlabelname())
  358.   if 0 < l then
  359.     set fshortname to getfname(l + gno) & gextension
  360.     set the picture of cast "PICT640x480" to the picture of cast ("8640" & fshortname)
  361.   end if
  362. end
  363.  
  364. on search
  365.   set br to getlabelname()
  366.   set l to finddata(br)
  367.   set m to l - 1 + getmembersofkategorie(br)
  368.   set n to value(field "search")
  369.   if (l <= n) and (n <= m) then
  370.     loadpictureforbrowserabs(br, n)
  371.   else
  372.     beep()
  373.   end if
  374. end
  375.  
  376. on setupkategorie cate
  377.   set gkategorie to cate
  378.   set glefttopitemno to finddata(cate)
  379.   if 0 < glefttopitemno then
  380.     set data to prerairshowviewer()
  381.     showviewer(data)
  382.   end if
  383. end
  384.  
  385. on initviewer
  386.   repeat with i = 12 to 20
  387.     puppetSprite(i, 1)
  388.   end repeat
  389.   set gfilelister to birth(script "FileIconLister", 44)
  390. end
  391.  
  392. on finishviewer
  393.   repeat with i = 12 to 20
  394.     puppetSprite(i, 0)
  395.   end repeat
  396.   if objectp(gfilelister) then
  397.     destroy(gfilelister)
  398.     set gfilelister to 0
  399.   end if
  400. end
  401.  
  402. on resumeviewer
  403.   initviewer()
  404.   showviewer(gviewlist)
  405.   show(gfilelister)
  406. end
  407.  
  408. on hideviewer
  409.   repeat with i = 12 to 20
  410.     set the visible of sprite i to 0
  411.   end repeat
  412.   hide(gfilelister)
  413.   updateStage()
  414. end
  415.  
  416. on appearviewer
  417.   repeat with i = 12 to 20
  418.     set the visible of sprite i to 1
  419.   end repeat
  420.   showp(gfilelister)
  421. end
  422.  
  423. on scrollup
  424.   set data to prerairscrollupshowviewer()
  425.   if data <> EMPTY then
  426.     showviewer(data)
  427.     set glefttopitemno to glefttopitemno + 3
  428.   end if
  429. end
  430.  
  431. on scrolldown
  432.   set data to prerairscrolldownshowviewer()
  433.   if data <> EMPTY then
  434.     showviewer(data)
  435.     set glefttopitemno to glefttopitemno - 3
  436.   end if
  437. end
  438.  
  439. on showviewer data
  440.   repeat with i = 12 to 20
  441.     set cname to line i - 11 of data
  442.     set the castNum of sprite i to the number of cast cname
  443.   end repeat
  444.   set gviewlist to data
  445.   updateStage()
  446. end
  447.  
  448. on prerairshowviewer
  449.   set p to 0
  450.   set n to glefttopitemno
  451.   set l to EMPTY
  452.   repeat with i = 1 to 9
  453.     set cate to getkategorie(n + i - 1)
  454.     if (cate = gkategorie) and (cate <> EMPTY) then
  455.       set p to 1
  456.       set cname to getfname(n + i - 1) & gextension
  457.     else
  458.       set cname to "dummy120x90"
  459.     end if
  460.     put cname & RETURN after l
  461.   end repeat
  462.   if p then
  463.     return l
  464.   else
  465.     return EMPTY
  466.   end if
  467. end
  468.  
  469. on prerairscrollupshowviewer
  470.   set p to 0
  471.   set n to glefttopitemno + 3
  472.   set l to EMPTY
  473.   repeat with i = 1 to 9
  474.     set cate to getkategorie(n + i - 1)
  475.     if (cate = gkategorie) and (cate <> EMPTY) then
  476.       set p to 1
  477.       set cname to getfname(n + i - 1) & gextension
  478.     else
  479.       set cname to "dummy120x90"
  480.     end if
  481.     put cname & RETURN after l
  482.   end repeat
  483.   if p then
  484.     return l
  485.   else
  486.     return EMPTY
  487.   end if
  488. end
  489.  
  490. on prerairscrolldownshowviewer
  491.   set p to 0
  492.   set n to glefttopitemno - 3
  493.   set l to EMPTY
  494.   repeat with i = 1 to 9
  495.     set cate to getkategorie(n + i - 1)
  496.     if (cate = gkategorie) and (cate <> EMPTY) then
  497.       set p to 1
  498.       set cname to getfname(n + i - 1) & gextension
  499.     else
  500.       set cname to "dummy120x90"
  501.     end if
  502.     put cname & RETURN after l
  503.   end repeat
  504.   if p then
  505.     return l
  506.   else
  507.     return EMPTY
  508.   end if
  509. end
  510.