home *** CD-ROM | disk | FTP | other *** search
/ GU Photo: Background 3 / GU.iso / pc / browser_4m_ / browser_4m_.dxr / 00131_main.ls < prev    next >
Encoding:
Text File  |  1994-09-30  |  8.2 KB  |  406 lines

  1. global gmode, gno, 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.   global gextension
  25.   if the machineType = 256 then
  26.     set gextension to ".BMP"
  27.   else
  28.     set gextension to ".pic"
  29.   end if
  30. end
  31.  
  32. on loadpictureforbrowser br, lno
  33.   global gextension, gkategorie
  34.   set l to finddata(br)
  35.   if 0 < l then
  36.     set gkategorie to br
  37.     set kl to getmembersofkategorie(br)
  38.     if lno < 0 then
  39.       set lno to kl - 1
  40.     else
  41.       if kl <= lno then
  42.         set lno to 0
  43.       end if
  44.     end if
  45.     set fname to "gu:240x180:" & getfname(l + lno) & gextension
  46.     set fshortname to getfname(l + lno) & gextension
  47.     set f to fileio(mnew, "read", fname)
  48.     if objectp(f) then
  49.       set the picture of cast (gethv(l + lno) & "PICT240x180") to f(mreadpict)
  50.       put fshortname into field "FileName"
  51.       put l + lno into field "search"
  52.     end if
  53.     set gno to lno
  54.     return lno
  55.   end if
  56.   return -1
  57. end
  58.  
  59. on loadpictureforbrowserabs br, no
  60.   global gextension
  61.   set l to finddata(br)
  62.   if 0 < no then
  63.     set gkategorie to br
  64.     set fname to "gu:240x180:" & getfname(no) & gextension
  65.     set fshortname to getfname(no) & gextension
  66.     set f to fileio(mnew, "read", fname)
  67.     if objectp(f) then
  68.       set the picture of cast (gethv(no) & "PICT240x180") to f(mreadpict)
  69.       put fshortname into field "FileName"
  70.       put no into field "search"
  71.     end if
  72.     set gno to no - l
  73.   end if
  74. end
  75.  
  76. on finddata br
  77.   set l to the number of lines in field "data"
  78.   repeat with i = 1 to l
  79.     set p to item 2 of line i of field "data"
  80.     if p = br then
  81.       return i
  82.     end if
  83.   end repeat
  84.   return 0
  85. end
  86.  
  87. on gethv n
  88.   if (n < 1) or (the number of lines in field "data" < n) then
  89.     return EMPTY
  90.   end if
  91.   return item 3 of line n of field "data"
  92. end
  93.  
  94. on getfname n
  95.   if (n < 1) or (the number of lines in field "data" < n) then
  96.     return EMPTY
  97.   end if
  98.   return item 1 of line n of field "data"
  99. end
  100.  
  101. on getkategorie n
  102.   if (n < 1) or (the number of lines in field "data" < n) then
  103.     return EMPTY
  104.   end if
  105.   return item 2 of line n of field "data"
  106. end
  107.  
  108. on getmembersofkategorie br
  109.   set cnt to 0
  110.   set l to the number of lines in field "data"
  111.   repeat with i = finddata(br) to l
  112.     set p to item 2 of line i of field "data"
  113.     if p <> br then
  114.       exit repeat
  115.     end if
  116.     set cnt to cnt + 1
  117.   end repeat
  118.   return cnt
  119. end
  120.  
  121. on getno nm
  122.   set l to the number of lines in field "data"
  123.   repeat with i = 1 to l
  124.     set p to item 1 of line i of field "data"
  125.     if p = nm then
  126.       return i
  127.     end if
  128.   end repeat
  129.   return 0
  130. end
  131.  
  132. on whichmode
  133.   return gmode
  134. end
  135.  
  136. on setmanualmode
  137.   set gmode to #manual
  138.   when timeOut then nothing
  139.   radiobuttonoff()
  140. end
  141.  
  142. on setautomode
  143.   set gmode to #auto
  144.   when timeOut then AutoView
  145.   set the timeoutLength to 1 * 60
  146.   radiobuttonon()
  147. end
  148.  
  149. on finishautoview
  150.   set gmode to #manual
  151.   when timeOut then nothing
  152.   puppetSprite(3, 0)
  153. end
  154.  
  155. on autoview
  156.   if whichmode() = #auto then
  157.     set gno to gno + 1
  158.     set gno to loadpictureforbrowser(getlabelname(), gno)
  159.   end if
  160. end
  161.  
  162. on radiobuttonon
  163.   set sp to clickOn()
  164.   if 0 < sp then
  165.     puppetSound("Click")
  166.     puppetSprite(sp, 1)
  167.     set the ink of sprite sp to 2
  168.     updateStage()
  169.     repeat while soundBusy(1)
  170.     end repeat
  171.     puppetSound(0)
  172.   end if
  173. end
  174.  
  175. on radiobuttonoff
  176.   set sp to clickOn()
  177.   if 0 < sp then
  178.     puppetSound("Click")
  179.     puppetSprite(sp, 0)
  180.     updateStage()
  181.     repeat while soundBusy(1)
  182.     end repeat
  183.     puppetSound(0)
  184.   end if
  185. end
  186.  
  187. on prev
  188.   if whichmode() = #manual then
  189.     set gno to gno - 1
  190.     set gno to loadpictureforbrowser(getlabelname(), gno)
  191.   end if
  192. end
  193.  
  194. on next
  195.   if whichmode() = #manual then
  196.     set gno to gno + 1
  197.     set gno to loadpictureforbrowser(getlabelname(), gno)
  198.   end if
  199. end
  200.  
  201. on getlabelname
  202.   set l to the labelList
  203.   set n to the number of lines in l - 1
  204.   repeat with i = 1 to n
  205.     put "," & label(line i of l) after line i of l
  206.   end repeat
  207.   repeat with i = n down to 1
  208.     if value(item 2 of line i of l) <= the frame then
  209.       return item 1 of line i of l
  210.     end if
  211.   end repeat
  212.   return EMPTY
  213. end
  214.  
  215. on copytohdd
  216.   global gextension
  217.   unLoadCast(1, 116)
  218.   set l to finddata(getlabelname())
  219.   if 0 < l then
  220.     set fname to "gu:" & field "sizehv" & ":" & getfname(l + gno) & gextension
  221.     set fshortname to getfname(l + gno) & gextension
  222.     set f to fileio(mnew, "read", fname)
  223.     if objectp(f) then
  224.       set len to f(mgetlength) + 200
  225.       if len < the freeBlock then
  226.         set d to fileio(mnew, "?write", fshortname)
  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 copyfileio dest, src
  241.   dest(mwritestring, src(mreadfile))
  242.   if the machineType <> 256 then
  243.     dest(msetfinderinfo, "PICT", "????")
  244.   end if
  245. end
  246.  
  247. on initfullscreen
  248.   global gextension
  249.   preLoadCast(the number of cast "PICT640x480")
  250.   set l to finddata(getlabelname())
  251.   if 0 < l then
  252.     set fname to "gu:640x480:" & getfname(l + gno) & gextension
  253.     set f to fileio(mnew, "read", fname)
  254.     if objectp(f) then
  255.       set the picture of cast "PICT640x480" to f(mreadpict)
  256.     end if
  257.   end if
  258. end
  259.  
  260. on search
  261.   set br to getlabelname()
  262.   set l to finddata(br)
  263.   set m to l - 1 + getmembersofkategorie(br)
  264.   set n to value(field "search")
  265.   if (l <= n) and (n <= m) then
  266.     loadpictureforbrowserabs(br, n)
  267.   else
  268.     beep()
  269.   end if
  270. end
  271.  
  272. on setupkategorie cate
  273.   set gkategorie to cate
  274.   set glefttopitemno to finddata(cate)
  275.   if 0 < glefttopitemno then
  276.     set data to prerairshowviewer()
  277.     showviewer(data)
  278.   end if
  279. end
  280.  
  281. on initviewer
  282.   repeat with i = 12 to 20
  283.     puppetSprite(i, 1)
  284.   end repeat
  285.   set gfilelister to birth(script "FileIconLister", 44)
  286. end
  287.  
  288. on finishviewer
  289.   repeat with i = 12 to 20
  290.     puppetSprite(i, 0)
  291.   end repeat
  292.   if objectp(gfilelister) then
  293.     destroy(gfilelister)
  294.     set gfilelister to 0
  295.   end if
  296. end
  297.  
  298. on resumeviewer
  299.   initviewer()
  300.   showviewer(gviewlist)
  301.   show(gfilelister)
  302. end
  303.  
  304. on hideviewer
  305.   repeat with i = 12 to 20
  306.     set the visible of sprite i to 0
  307.   end repeat
  308.   hide(gfilelister)
  309.   updateStage()
  310. end
  311.  
  312. on appearviewer
  313.   repeat with i = 12 to 20
  314.     set the visible of sprite i to 1
  315.   end repeat
  316.   showp(gfilelister)
  317. end
  318.  
  319. on scrollup
  320.   set data to prerairscrollupshowviewer()
  321.   if data <> EMPTY then
  322.     showviewer(data)
  323.     set glefttopitemno to glefttopitemno + 3
  324.   end if
  325. end
  326.  
  327. on scrolldown
  328.   set data to prerairscrolldownshowviewer()
  329.   if data <> EMPTY then
  330.     showviewer(data)
  331.     set glefttopitemno to glefttopitemno - 3
  332.   end if
  333. end
  334.  
  335. on showviewer data
  336.   repeat with i = 12 to 20
  337.     set cname to line i - 11 of data
  338.     set the castNum of sprite i to the number of cast cname
  339.   end repeat
  340.   set gviewlist to data
  341.   updateStage()
  342. end
  343.  
  344. on prerairshowviewer
  345.   set p to 0
  346.   set n to glefttopitemno
  347.   set l to EMPTY
  348.   repeat with i = 1 to 9
  349.     set cate to getkategorie(n + i - 1)
  350.     if (cate = gkategorie) and (cate <> EMPTY) then
  351.       set p to 1
  352.       set cname to getfname(n + i - 1) & ".pic"
  353.     else
  354.       set cname to "dummy120x90"
  355.     end if
  356.     put cname & RETURN after l
  357.   end repeat
  358.   if p then
  359.     return l
  360.   else
  361.     return EMPTY
  362.   end if
  363. end
  364.  
  365. on prerairscrollupshowviewer
  366.   set p to 0
  367.   set n to glefttopitemno + 3
  368.   set l to EMPTY
  369.   repeat with i = 1 to 9
  370.     set cate to getkategorie(n + i - 1)
  371.     if (cate = gkategorie) and (cate <> EMPTY) then
  372.       set p to 1
  373.       set cname to getfname(n + i - 1) & ".pic"
  374.     else
  375.       set cname to "dummy120x90"
  376.     end if
  377.     put cname & RETURN after l
  378.   end repeat
  379.   if p then
  380.     return l
  381.   else
  382.     return EMPTY
  383.   end if
  384. end
  385.  
  386. on prerairscrolldownshowviewer
  387.   set p to 0
  388.   set n to glefttopitemno - 3
  389.   set l to EMPTY
  390.   repeat with i = 1 to 9
  391.     set cate to getkategorie(n + i - 1)
  392.     if (cate = gkategorie) and (cate <> EMPTY) then
  393.       set p to 1
  394.       set cname to getfname(n + i - 1) & ".pic"
  395.     else
  396.       set cname to "dummy120x90"
  397.     end if
  398.     put cname & RETURN after l
  399.   end repeat
  400.   if p then
  401.     return l
  402.   else
  403.     return EMPTY
  404.   end if
  405. end
  406.