home *** CD-ROM | disk | FTP | other *** search
/ GU Photo: Background 1 / GU.iso / pc / win / browser.exe / browser.DXR / 00381.txt < prev    next >
Encoding:
Text File  |  1994-09-30  |  8.6 KB  |  415 lines

  1. global gMode, gNo
  2.  
  3. on startMovie
  4.   InitMachine
  5.   SetManualMode
  6.   set gNo = 0
  7. end
  8. on stopMovie
  9.   clearglobals
  10. end
  11.  
  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.   -- some enviroments should be resumed .
  21.   -- but this version quits simply .
  22.   quit
  23. end
  24. ---
  25. on InitMachine
  26.   global gExtension
  27.   if (the machineType = 256) then
  28.     set gExtension = ".BMP"
  29.   else
  30.     set gExtension = ".pic"
  31.   end if
  32. end
  33.  
  34. --
  35. on LoadPictureForBrowser br, lno
  36.   global gExtension
  37.   --set the trace = TRUE
  38.   
  39.   set l = FindData( br )
  40.   if (0 < l) then
  41.     set kl = GetMembersOfKategorie( br )
  42.     if (lno < 0) then
  43.       set lno = kl -1
  44.     else if (kl <= lno) then
  45.       set lno = 0
  46.     end if
  47.     
  48.     --
  49.     set fname = "gu:240x180:" & GetFName( l + lno ) & gExtension
  50.     set fshortname = GetFName( l + lno ) & gExtension
  51.     set f = FileIO(mNew, "read", fname )
  52.     if (objectp(f)) then
  53.       set the picture of cast (GetHV( l + lno ) & "PICT240x180")  = f(mReadPict)
  54.       put fshortname into field "FileName"
  55.       put (l + lno) into field "search"
  56.     end if
  57.     set gNo = lno
  58.     --set the trace = FALSE
  59.     return lno
  60.   end if
  61.   -- set the trace = FALSE
  62.   return -1
  63. end
  64. on LoadPictureForBrowserAbs br, no
  65.   global gExtension
  66.   
  67.   set l = FindData( br )
  68.   if (0 < no) then
  69.     set fname = "gu:240x180:" & GetFName( no ) & gExtension
  70.     set fshortname = GetFName( no ) & gExtension
  71.     set f = FileIO(mNew, "read", fname )
  72.     if (objectp(f)) then
  73.       set the picture of cast (GetHV( no ) & "PICT240x180")  = f(mReadPict)
  74.       put fshortname into field "FileName"
  75.       put (no) into field "search"
  76.     end if
  77.     set gNo = no - l
  78.   end if
  79. end
  80.  
  81. ----
  82. on FindData br
  83.   set l = the number of lines of field "data"
  84.   repeat with i = 1 to l
  85.     set p = item 2 of line i of field "data"
  86.     if (p = br) then
  87.       return i
  88.     end if
  89.   end repeat
  90.   return 0
  91. end
  92. on GetHV n
  93.   if (n < 1 or the number of lines of field "data" < n) then return EMPTY
  94.   return item 3 of line n of field "data"
  95. end
  96. on GetFName n
  97.   if (n < 1 or the number of lines of field "data" < n) then return EMPTY
  98.   return item 1 of line n of field "data"
  99. end
  100. on GetKategorie n
  101.   if (n < 1 or the number of lines of field "data" < n) then return EMPTY
  102.   return item 2 of line n of field "data"
  103. end
  104. on GetMembersOfKategorie br
  105.   set cnt = 0
  106.   set l = the number of lines of field "data"
  107.   repeat with i = FindData( br ) to l
  108.     set p = item 2 of line i of field "data"
  109.     if (p <> br) then
  110.       exit repeat
  111.     end if
  112.     set cnt = cnt + 1
  113.   end repeat
  114.   return cnt
  115. end
  116. on GetNo nm
  117.   set l = the number of lines of field "data"
  118.   repeat with i = 1 to l
  119.     set p = 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. -- browser modes
  128. on whichMode
  129.   return gMode
  130. end
  131. on SetManualMode
  132.   set gMode = #MANUAL
  133.   when timeOut then nothing
  134.   RadioButtonOFF
  135. end
  136. on SetAutoMode
  137.   set gMode = #AUTO
  138.   when timeOut then AutoView
  139.   set the timeoutLength = 1 * 60
  140.   RadioButtonOn
  141. end
  142. --
  143. on FinishAutoView
  144.   set gMode = #MANUAL
  145.   when timeOut then nothing
  146.   puppetSprite 3, FALSE -- <----
  147.   updatestage
  148. end
  149. --
  150. on AutoView
  151.   if (whichMode() = #AUTO) then
  152.     set gNo = gNo + 1
  153.     set gNo = LoadPictureForBrowser( getLabelName(), gNo )
  154.   end if
  155. end
  156. ----
  157. on RadioButtonOn
  158.   set sp = ClickOn()
  159.   if (0 < sp) then
  160.     puppetSound "Click"
  161.     puppetSprite sp, TRUE
  162.     set the ink of sprite sp = 2
  163.     updatestage
  164.     --
  165.     
  166.     repeat while soundBusy(1)
  167.     end repeat
  168.     
  169.     --
  170.     puppetSound 0
  171.   end if
  172. end
  173. on RadioButtonOFF
  174.   set sp = ClickOn()
  175.   if (0 < sp) then
  176.     puppetSound "Click"
  177.     puppetSprite sp, FALSE
  178.     updatestage
  179.     --
  180.     
  181.     repeat while soundBusy(1)
  182.     end repeat
  183.     
  184.     --
  185.     puppetSound 0
  186.   end if
  187. end
  188.  
  189. ---
  190. on Prev
  191.   if (whichMode() = #MANUAL) then
  192.     set gNo = gNo - 1
  193.     set gNo = LoadPictureForBrowser( getLabelName(), gNo )
  194.   end if
  195. end
  196. on Next
  197.   if (whichMode() = #MANUAL) then
  198.     set gNo = gNo + 1
  199.     set gNo = LoadPictureForBrowser( getLabelName(), gNo )
  200.   end if
  201. end
  202. --
  203. on getLabelName
  204.   set l = the labelList
  205.   set n = (the number of lines of l) - 1
  206.   repeat with i = 1   to   n
  207.     put ","&label( line i of l )  after line i of l
  208.   end repeat
  209.   repeat with i = n   down to 1
  210.     if (value(item 2 of line i of l) <= the frame) then
  211.       return item 1 of line i of l
  212.     end if
  213.   end repeat
  214.   return EMPTY
  215. end 
  216. --
  217. on copyToHDD
  218.   global gExtension
  219.   
  220.   unLoadCast 1, 116
  221.   set l = FindData( getLabelName() )
  222.   if (0 < l) then
  223.     set fname = "gu:"& (field "sizehv") & ":" & GetFName( l + gNo ) & gExtension
  224.     set fshortname = GetFName( l + gNo ) & gExtension
  225.     set f = FileIO(mNew, "read", fname )
  226.     if (objectp(f)) then
  227.       set len = f( mGetLength ) + 200
  228.       -- put len && the freeBytes
  229.       if (len < the freeBlock) then
  230.         set d = FileIO( mNew, "?write", fshortname )
  231.         -- put d
  232.         if (objectp( d )) then
  233.           copyFileIO( d, f )
  234.           d( mDispose )
  235.         end if
  236.       else
  237.         set msg = string( the freeBlock / 1024) & "Kbytes Memory available . But, need" && οΎƒ
  238.                   string( len / 1024) & "Kbytes ."
  239.         alert msg
  240.         
  241.       end if
  242.       f( mDispose )
  243.     end if
  244.   end if
  245.   
  246. end
  247.  
  248. on copyFileIO dest, src
  249.   dest( mWriteString, src( mReadFile ) )
  250.   if (the machinetype <> 256) then dest( mSetFinderInfo, "PICT", "????" )
  251. end
  252. --
  253. on initFullScreen
  254.   global gExtension
  255.   
  256.   set l = FindData( getLabelName() )
  257.   if (0 < l) then
  258.     set fname = "gu:640x480:" & GetFName( l + gNo ) & gExtension
  259.     set f = FileIO(mNew, "read", fname )
  260.     if (objectp(f)) then
  261.       set the picture of cast ("PICT640x480")  = f(mReadPict)
  262.     end if
  263.   end if
  264. end
  265. --
  266. on search
  267.   set br = getLabelName()
  268.   set l = FindData( br )
  269.   set m = l - 1 + GetMembersOfKategorie( br )
  270.   set n = value( field "search" )
  271.   if (l <= n and n <= m) then
  272.     LoadPictureForBrowserAbs br, n
  273.   else
  274.     beep
  275.   end if
  276. end
  277. ----------------------------
  278. --
  279. --
  280. global gLeftTopItemNo, gKategorie, gViewList, gFileLister
  281. on SetupKategorie cate
  282.   set gKategorie = cate
  283.   set gLeftTopItemNo = FindData( cate )
  284.   if (0 < gLeftTopItemNo) then
  285.     set data = prerairShowViewer()
  286.     ShowViewer( data )
  287.   end if
  288. end
  289. on initViewer
  290.   repeat with i = 12 to 20
  291.     puppetsprite i, TRUE
  292.   end repeat
  293.   --
  294.   set gFileLister = birth( script"FileIconLister", 44 )
  295. end
  296. on finishViewer
  297.   repeat with i = 12 to 20
  298.     puppetsprite i, FALSE
  299.   end repeat
  300.   if (objectp(gFileLister)) then
  301.     destroy( gFileLister )
  302.     set gFileLister = 0
  303.   end if
  304. end
  305. on resumeViewer
  306.   initViewer
  307.   ShowViewer( gViewList )
  308.   --set the trace = TRUE
  309.   show( gFileLister )
  310.   --set the trace = FALSE
  311. end
  312.  
  313. on hideViewer
  314.   repeat with i = 12 to 20
  315.     set the visible of sprite i = FALSE
  316.   end repeat
  317.   hide( gFileLister )
  318.   updateStage
  319. end
  320. on appearViewer
  321.   repeat with i = 12 to 20
  322.     set the visible of sprite i = TRUE
  323.   end repeat
  324.   showp( gFileLister )
  325. end
  326.  
  327. on ScrollUp
  328.   set data = prerairScrollUpShowViewer()
  329.   if (data <> EMPTY) then
  330.     ShowViewer( data )
  331.     set gLeftTopItemNo = gLeftTopItemNo + 3
  332.   end if
  333. end
  334. on ScrollDown
  335.   set data = prerairScrollDownShowViewer()
  336.   if (data <> EMPTY) then 
  337.     ShowViewer( data )
  338.     set gLeftTopItemNo = gLeftTopItemNo - 3
  339.   end if
  340. end
  341.  
  342. on ShowViewer data
  343.   repeat with i = 12 to 20
  344.     set cName = line (i - 11) of data
  345.     set the castNum of sprite i = the number of cast cName
  346.   end repeat
  347.   set gViewList = data
  348.   updateStage
  349. end
  350.  
  351. on prerairShowViewer
  352.   set p = FALSE
  353.   set n = gLeftTopItemNo
  354.   set l = ""
  355.   repeat with i = 1 to 9
  356.     set cate = GetKategorie( n + i - 1 )
  357.     if ((cate = gKategorie) and (cate <> EMPTY)) then
  358.       set p = TRUE
  359.       set cName = GetFName( n + i - 1 ) & ".pic"
  360.     else
  361.       set cName = "dummy120x90"
  362.     end if
  363.     put cName & RETURN after l
  364.   end repeat
  365.   if (p) then
  366.     return l
  367.   else
  368.     return EMPTY
  369.   end if
  370. end  
  371.  
  372. on prerairScrollUpShowViewer
  373.   set p = FALSE
  374.   set n = gLeftTopItemNo + 3   -- inc
  375.   set l = ""
  376.   repeat with i = 1 to 9
  377.     set cate = GetKategorie( n + i - 1 )
  378.     
  379.     if ((cate = gKategorie) and (cate <> EMPTY)) then
  380.       set p = TRUE
  381.       set cName = GetFName( n + i - 1 ) & ".pic"
  382.     else
  383.       set cName = "dummy120x90"
  384.     end if
  385.     put cName & RETURN after l
  386.   end repeat
  387.   if (p) then
  388.     return l
  389.   else
  390.     return EMPTY
  391.   end if
  392. end
  393.  
  394. on prerairScrollDownShowViewer
  395.   set p = FALSE
  396.   set n = gLeftTopItemNo - 3   -- dec
  397.   set l = ""
  398.   repeat with i = 1 to 9
  399.     set cate = GetKategorie( n + i - 1 )
  400.     
  401.     if ((cate = gKategorie) and (cate <> EMPTY)) then
  402.       set p = TRUE
  403.       set cName = GetFName( n + i - 1 ) & ".pic"
  404.     else
  405.       set cName = "dummy120x90"
  406.     end if
  407.     put cName & RETURN after l
  408.   end repeat
  409.   if (p) then
  410.     return l
  411.   else
  412.     return EMPTY
  413.   end if
  414. end  
  415.