home *** CD-ROM | disk | FTP | other *** search
/ Amiga ISO Collection / AmigaUtilCD1.iso / GFX / MPEG / mpegui21.lha / MPEGIntuition.e < prev    next >
Encoding:
Text File  |  2000-06-11  |  33.8 KB  |  929 lines

  1. /******************(E)(D)evelopment(S)ystem***************
  2. ** FileName:   mpegplayer_2.e
  3. ** Author:     Sauron
  4. ** Company:    GUILT
  5. ** Date:       06-11-95     Time:   19:24:20
  6. ** $VER:       2.12b
  7. ***************************************©Sauron***********/
  8. /*********[Revision History]****[Last Update: 06-11-95]**/
  9. /*
  10. ** Version:   2.12b
  11. ** Comment:   N/A
  12. **
  13. **
  14. **
  15. **
  16. **   This Amiga E source is only an example of E programing.
  17. **   You can use part of it in your own programe (Place me on your thx. 
  18. **   list :) but you CAN'T create any other Intuition by changing names
  19. **   only !!!!
  20. **
  21. **
  22. **
  23. */
  24.  
  25. OPT OSVERSION=37
  26.  
  27. MODULE 'gadtools', 'libraries/gadtools', 'intuition/intuition','intuition/gadgetclass',
  28.        'intuition/screens', 'graphics/text',    'ReqTools','commodities','libraries/commodities',
  29.        'exec/types','exec/ports','exec/memory','dos/dos','devices/inputevent',
  30.        'libraries/ReqTools','exec/lists', 'exec/nodes', 'utility/tagitem',
  31.         'workbench/startup','workbench/workbench','icon','keymap'
  32.  
  33. /*-- Function return values. --*/
  34. ENUM NONE,NOCONTEXT, NOGADGET, NOWB, NOVISUAL, OPENGT, NOWINDOW,NO_MP,
  35.      NO_ICONLIB,NO_GADTOOLS,NO_REQTOOLS,NO_ICON
  36.  
  37. /*-- Gadget IDs. --*/
  38. ENUM DELETEBUTTON_ID, STRING_ID, LISTVIEW_ID,
  39.      INFOBUTTON_ID, PLAYBUTTON_ID ,LOADBUTTON_ID
  40.  
  41. RAISE "MEM" IF New()=NIL,
  42.       "MEM" IF String()=NIL
  43.  
  44. CONST FILEREQ=0
  45.  
  46. /*-- Standard SrcGen stuff. --*/
  47. DEF win=NIL:PTR TO window,dither[20]:STRING,
  48.     scr=NIL:PTR TO screen,prr,x,y,
  49.     glist=NIL,dir[100]:STRING,buf[50]:STRING,
  50.     visual=NIL,count,gattext[100]:STRING,
  51.     infos:PTR TO gadget,chippointer,prio,
  52.     messageClass,rodzajDit,plik[100]:STRING,class,
  53.     offx, offy, tattr,mainfile[200]:STRING,mppath[100]:STRING,
  54.     appath[100]:STRING,noap=FALSE,shit=FALSE,
  55.     robot[100]:STRING,req:PTR TO rtfilerequester,myreq:requester
  56.  
  57. /*-- Listview and supporting gadgets. --*/
  58. DEF list=NIL:PTR TO mlh,            /* Exec list holds listview items         */
  59.     listView=NIL:PTR TO gadget,     /* Listview gadget                        */
  60.     infoButton=NIL:PTR TO gadget,
  61.     loadButton=NIL:PTR TO gadget,
  62.     playButton=NIL:PTR TO gadget,
  63.     textX=NIL:PTR TO gadget,
  64.     textY=NIL:PTR TO gadget,
  65.     textSize=NIL:PTR TO gadget,
  66.     textKB=NIL:PTR TO gadget,
  67.     textComp=NIL:PTR TO gadget,
  68.     textFrames=NIL:PTR TO gadget,
  69.     textTime=NIL:PTR TO gadget,
  70.     textKlata=NIL:PTR TO gadget,
  71.     checkRAM=NIL:PTR TO gadget,
  72.     checkLoop=NIL:PTR TO gadget,
  73.     checkNOP=NIL:PTR TO gadget,
  74.     checkNOB=NIL:PTR TO gadget,
  75.     saveButton=NIL:PTR TO gadget, /* Button gadget TO delete an item        */
  76.     stringGadget=NIL:PTR TO gadget, /* String gadget, value added to listview */
  77.     stringGadgetValue:PTR TO CHAR,   /* Pointer to string gadget buffer        */
  78.     check=FALSE,ch1=TRUE,ch2=TRUE,ch3=TRUE,ch4=TRUE,lue,player=1
  79.  
  80. PROC initList(l:PTR TO mlh)
  81. /*-- Initialize an exec list. --*/
  82.   l.head:=l+4
  83.   l.tail:=NIL
  84.   l.tailpred:=l
  85. ENDPROC
  86.  
  87. CHAR '$VER: MPEGInt. v2.12b by SAURON (c) 1995',0
  88.  
  89. PROC setupScreen()
  90. /*-- Open libraries and get screen info. --*/
  91.   IF (gadtoolsbase:=OpenLibrary('gadtools.library',37))=NIL THEN RETURN OPENGT
  92.   IF (scr:=LockPubScreen('Workbench'))=NIL THEN RETURN NOWB
  93.   IF (visual:=GetVisualInfoA(scr,NIL))=NIL THEN RETURN NOVISUAL
  94.   offy:=scr.wbortop+Int(scr.rastport+58)-10
  95.   tattr:=['topaz.font',8,0,0]:textattr
  96. ENDPROC  NONE
  97.  
  98. PROC closeScreen()
  99. /*-- Free resources, close screen and libraries. --*/
  100.   IF glist THEN FreeGadgets(glist)
  101.   IF visual THEN FreeVisualInfo(visual)
  102.   IF scr THEN UnlockPubScreen(NIL,scr)
  103.   IF gadtoolsbase THEN CloseLibrary(gadtoolsbase)
  104. ENDPROC
  105.  
  106. PROC createGadgets()
  107. /*-- Initialize gadget structures and create 'em. --*/
  108.   DEF g, stringInfo:PTR TO stringinfo
  109.   /*-- Init exec list to hold listview items.  Starts out empty. --*/
  110.   list:=New(SIZEOF mlh)
  111.   initList(list)
  112.   IF (g:=CreateContext({glist}))=NIL THEN RETURN NOCONTEXT
  113.   IF (g:=listView:=CreateGadgetA(LISTVIEW_KIND,g,
  114.     [offx+179,offy+26,130,104,'Dither type',tattr,LISTVIEW_ID,0,visual,0]:newgadget,
  115.     [GTLV_LABELS,list,
  116.      GTLV_SHOWSELECTED,NIL,
  117.      TAG_DONE]))=NIL THEN RETURN NOGADGET
  118.   IF (g:=textX:=CreateGadgetA(TEXT_KIND,g,
  119.     [offx+17,offy+31,32,12,'X',tattr,1,2,visual,0]:newgadget,
  120.     [GTTX_TEXT,'000',
  121.      GTTX_BORDER,1,
  122.      NIL]))=NIL THEN RETURN NOGADGET
  123.   IF (g:=textY:=CreateGadgetA(TEXT_KIND,g,
  124.     [offx+131,offy+31,32,12,'SIZE Y',tattr,2,1,visual,0]:newgadget,
  125.     [GTTX_TEXT,'000',
  126.      GTTX_BORDER,1,
  127.      NIL]))=NIL THEN RETURN NOGADGET
  128.   IF (g:=textTime:=CreateGadgetA(TEXT_KIND,g,
  129.     [offx+59,offy+46,104,12,'Time',tattr,3,1,visual,0]:newgadget,
  130.     [GTTX_TEXT,'00000.000000',
  131.      GTTX_BORDER,1,
  132.      NIL]))=NIL THEN RETURN NOGADGET
  133.   IF (g:=textFrames:=CreateGadgetA(TEXT_KIND,g,
  134.     [offx+83,offy+61,80,12,'Frame/s',tattr,4,1,visual,0]:newgadget,
  135.     [GTTX_TEXT,'00.000000',
  136.      GTTX_BORDER,1,
  137.      NIL]))=NIL THEN RETURN NOGADGET
  138.   IF (g:=textSize:=CreateGadgetA(TEXT_KIND,g,
  139.     [offx+83,offy+77,80,12,'Frame/B',tattr,5,1,visual,0]:newgadget,
  140.     [GTTX_TEXT,'000.00000',
  141.      GTTX_BORDER,1,
  142.      NIL]))=NIL THEN RETURN NOGADGET
  143.   IF (g:=textComp:=CreateGadgetA(TEXT_KIND,g,
  144.     [offx+98,offy+92,65,12,'Compress.',tattr,6,1,visual,0]:newgadget,
  145.     [GTTX_TEXT,'00:00.0',
  146.      GTTX_BORDER,1,
  147.      NIL]))=NIL THEN RETURN NOGADGET
  148.   IF (g:=textKB:=CreateGadgetA(TEXT_KIND,g,
  149.     [offx+42,offy+108,41,12,'KB',tattr,7,1,visual,0]:newgadget,
  150.     [GTTX_TEXT,'000000000',
  151.      GTTX_BORDER,1,
  152.      NIL]))=NIL THEN RETURN NOGADGET
  153.   IF (g:=textKlata:=CreateGadgetA(TEXT_KIND,g,
  154.     [offx+122,offy+108,41,12,'Fr.',tattr,7,1,visual,0]:newgadget,
  155.     [GTTX_TEXT,'0000',
  156.      GTTX_BORDER,1,
  157.      NIL]))=NIL THEN RETURN NOGADGET
  158.   IF ch1=0
  159.    IF (g:=checkRAM:=CreateGadgetA(CHECKBOX_KIND,g,
  160.      [offx+134,offy+132,26,11,'RAM',tattr,8,1,visual,0]:newgadget,
  161.      [GTCB_CHECKED]))=NIL THEN RETURN NOGADGET
  162.   ELSE
  163.    IF (g:=checkRAM:=CreateGadgetA(CHECKBOX_KIND,g,
  164.      [offx+134,offy+132,26,11,'RAM',tattr,8,1,visual,0]:newgadget,
  165.      [NIL]))=NIL THEN RETURN NOGADGET
  166.   ENDIF
  167.   IF ch4=0
  168.    IF (g:=checkNOP:=CreateGadgetA(CHECKBOX_KIND,g,
  169.      [offx+167,offy+132,26,11,'NOP',tattr,9,2,visual,0]:newgadget,
  170.      [GTCB_CHECKED]))=NIL THEN RETURN NOGADGET
  171.   ELSE
  172.    IF (g:=checkNOP:=CreateGadgetA(CHECKBOX_KIND,g,
  173.      [offx+167,offy+132,26,11,'NOP',tattr,9,2,visual,0]:newgadget,
  174.      [NIL]))=NIL THEN RETURN NOGADGET
  175.   ENDIF
  176.   IF ch2=0
  177.    IF (g:=checkLoop:=CreateGadgetA(CHECKBOX_KIND,g,
  178.      [offx+134,offy+147,26,11,'LOOP',tattr,10,1,visual,0]:newgadget,
  179.      [GTCB_CHECKED]))=NIL THEN RETURN NOGADGET
  180.   ELSE
  181.    IF (g:=checkLoop:=CreateGadgetA(CHECKBOX_KIND,g,
  182.      [offx+134,offy+147,26,11,'LOOP',tattr,10,1,visual,0]:newgadget,
  183.      [NIL]))=NIL THEN RETURN NOGADGET
  184.   ENDIF
  185.   IF ch3=0
  186.    IF (g:=checkNOB:=CreateGadgetA(CHECKBOX_KIND,g,
  187.      [offx+167,offy+147,26,11,'NOB',tattr,11,2,visual,0]:newgadget,
  188.      [GTCB_CHECKED]))=NIL THEN RETURN NOGADGET
  189.   ELSE
  190.    IF (g:=checkNOB:=CreateGadgetA(CHECKBOX_KIND,g,
  191.      [offx+167,offy+147,26,11,'NOB',tattr,11,2,visual,0]:newgadget,
  192.      [NIL]))=NIL THEN RETURN NOGADGET
  193.   ENDIF
  194.   IF (g:=loadButton:=CreateGadgetA(BUTTON_KIND,g,
  195.     [offx+17,offy+178,20,14,'L',tattr,12,0,visual,0]:newgadget,
  196.     [NIL]))=NIL THEN RETURN NOGADGET
  197.   IF (g:=stringGadget:=CreateGadgetA(STRING_KIND,g,
  198.     [offx+38,offy+179,263,12,'File ',tattr,13,4,visual,0]:newgadget,
  199.     [GTST_STRING,gattext,
  200.      GTST_MAXCHARS,256,
  201.      NIL]))=NIL THEN RETURN NOGADGET
  202.      stringInfo:=stringGadget.specialinfo
  203.      stringGadgetValue:=stringInfo.buffer
  204.   IF (g:=playButton:=CreateGadgetA(BUTTON_KIND,g,
  205.     [offx+15,offy+131,66,29,'PLAY',tattr,14,16,visual,0]:newgadget,
  206.     [NIL]))=NIL THEN RETURN NOGADGET
  207.   IF (g:=infoButton:=CreateGadgetA(BUTTON_KIND,g,
  208.     [offx+244,offy+131,58,14,'About',tattr,15,16,visual,0]:newgadget,
  209.     [NIL]))=NIL THEN RETURN NOGADGET
  210.   IF (g:=saveButton:=CreateGadgetA(BUTTON_KIND,g,
  211.     [offx+244,offy+147,58,13,'SAVE',tattr,16,16,visual,0]:newgadget,
  212.     [NIL]))=NIL THEN RETURN NOGADGET
  213. ENDPROC  NONE
  214.  
  215. PROC openWindow()
  216.   IF createGadgets()<>NONE THEN RETURN NOGADGET
  217.   /*-- Note WA_IDCMP to get messages from the listview gadget: --*/
  218.   IF (win:=OpenWindowTagList(NIL,
  219.     [WA_LEFT,         x,
  220.      WA_TOP,          y,
  221.      WA_WIDTH,        offx+316,
  222.      WA_HEIGHT,       offy+200,
  223.      WA_MINWIDTH, 240, WA_MINHEIGHT,  11,
  224.      WA_IDCMP,        (IDCMP_REFRESHWINDOW OR IDCMP_CLOSEWINDOW OR IDCMP_GADGETUP OR
  225.                        IDCMP_MOUSEMOVE OR LISTVIEWIDCMP OR SCROLLERIDCMP
  226. OR IDCMP_NEWSIZE),
  227.      WA_FLAGS,        (WFLG_DRAGBAR OR WFLG_DEPTHGADGET OR WFLG_CLOSEGADGET OR
  228.                        WFLG_SMART_REFRESH OR WFLG_ACTIVATE/* OR WFLG_HASZOOM*/),
  229.      WA_TITLE,'Sauron MPEG Intuition V2.12b',
  230.      WA_CUSTOMSCREEN, scr,
  231.      WA_MINWIDTH,     67,
  232.      WA_MINHEIGHT,    21,
  233.      WA_MAXWIDTH,     $2C0,
  234.      WA_MAXHEIGHT,    277,
  235.      WA_AUTOADJUST,   1,
  236.      WA_GADGETS,      glist,
  237.      TAG_DONE]))=NIL THEN RETURN NOWINDOW
  238.   PrintIText(win.rport,
  239.     [1,0,0,50,14,tattr,'MPEG Info',NIL]:intuitext,offx,offy)
  240.   DrawBevelBoxA(win.rport,7+offx,165+offy,302,31,
  241.     [GT_VISUALINFO,visual,NIL])
  242.   DrawBevelBoxA(win.rport,7+offx,127+offy,302,37,
  243.     [GT_VISUALINFO,visual,NIL])
  244.   DrawBevelBoxA(win.rport,7+offx,26+offy,170,100,
  245.     [GT_VISUALINFO,visual,NIL])
  246.   Gt_RefreshWindow(win, NIL)
  247. ENDPROC NONE
  248.  
  249. PROC closeWindow()
  250.   IF win THEN CloseWindow(win)
  251. ENDPROC
  252.  
  253. PROC wait4message(win:PTR TO window)
  254.   DEF mes:PTR TO intuimessage, type
  255.   REPEAT
  256.     type:=0
  257.     IF mes:=Gt_GetIMsg(win.userport)
  258.       type:=mes.class
  259.       SELECT type
  260.         CASE IDCMP_NEWSIZE
  261.         CASE IDCMP_GADGETUP
  262.           /*-- Any old gadget will do.  The address is used --*/
  263.           /*-- to identify which one sent the message.      --*/
  264.           infos:=mes.iaddress
  265.           infos.gadgetid:=mes.code
  266.         SELECT infos
  267. /*         CASE stringGadget
  268.            StrCopy(gattext,stringGadgetValue)
  269.            RightStr(buf,gattext,porow())
  270.            Gt_SetGadgetAttrsA (stringGadget, win, NIL,
  271.                       [GTST_STRING,gattext,TAG_DONE])*/
  272.          CASE listView
  273.            rodzajDit:=mes.code
  274.          ENDSELECT
  275.           IF mes.code THEN check:=TRUE ELSE check:=FALSE
  276.          CASE IDCMP_REFRESHWINDOW
  277.           Gt_BeginRefresh(win)
  278.           Gt_EndRefresh(win,TRUE)
  279.           name()
  280.           type:=0
  281.       ENDSELECT
  282.       Gt_ReplyIMsg(mes)
  283.     ELSE
  284.       WaitPort(win.userport)
  285.     ENDIF
  286.   UNTIL type
  287. ENDPROC type
  288.  
  289. PROC addToList()
  290.   DEF newNode=NIL:PTR TO ln, node:PTR TO ln,
  291.       len, itemPosition=0
  292.   newNode:=New(SIZEOF ln)
  293.   len:=StrLen(lue)
  294.   newNode.name:=String(len)
  295.   StrCopy(newNode.name, lue, ALL)
  296. /*-- Detach the exec LIST from the listview gadget. --*/
  297.   Gt_SetGadgetAttrsA (listView, win, NIL, [GTLV_LABELS, -1, TAG_DONE])
  298. /*-- Decide where TO insert the new item.  Sorted on first character. --*/
  299.   node:=list.head
  300.   Insert(list, newNode, node.pred)
  301. /*  ENDIF*/
  302.   /*-- Reattach the exec list to the listview gadget. --*/
  303.   Gt_SetGadgetAttrsA (listView, win, NIL,
  304.                       [GTLV_LABELS, list,
  305.                        GTLV_TOP,    itemPosition,
  306.                        TAG_DONE])
  307. ENDPROC
  308.  
  309. PROC main() HANDLE
  310. DEF listItemPosition=0,waitpointer,mp_Task,pentla
  311. waitpointer:=[$0000, $0000,
  312.               $0400, $07C0,
  313.               $0000, $07C0,
  314.               $0100, $0380,
  315.               $0000, $07E0,
  316.               $07C0, $1FF8,
  317.               $1FF0, $3FEC,
  318.               $3FF8, $7FDE,
  319.               $3FF8, $7FBE,
  320.               $7FFC, $FF7F,
  321.               $7EFC, $FFFF,
  322.               $7FFC, $FFFF,
  323.               $3FF8, $7FFE,
  324.               $3FF8, $7FFE,
  325.               $1FF0, $3FFC,
  326.               $07C0, $1FF8,
  327.               $0000, $07E0,
  328.               $0000, $0000]:INT
  329.  
  330. IF chippointer:=AllocVec(72,MEMF_CHIP)
  331.  CopyMemQuick(waitpointer,chippointer,72)
  332. ENDIF
  333.   IF reqtoolsbase:=OpenLibrary('reqtools.library',37)
  334.    ikona()
  335.     IF FileLength(mppath)<=0
  336.       Raise(NO_MP)
  337.     ENDIF
  338.    IF setupScreen()=NONE
  339.     IF openWindow()=NONE
  340.      lue:='AMP-hiresham'
  341.      addToList()
  342.      lue:='AMP-ham6'
  343.      addToList()
  344.      lue:='AMP-color'
  345.      addToList()
  346.      lue:='Opal15'
  347.      addToList()
  348.      lue:='Opal24'
  349.      addToList()
  350.      lue:='Village24'
  351.      addToList()
  352.      lue:='EGS24'
  353.      addToList()
  354.      lue:='Retina24'
  355.      addToList()
  356.      lue:='Mono'
  357.      addToList()
  358.      lue:='FS4'
  359.      addToList()
  360.      lue:='FS2 Fast'
  361.      addToList()
  362.      lue:='FS2'
  363.      addToList()
  364.      lue:='Ordered2'
  365.      addToList()
  366.      lue:='Ordered'
  367.      addToList()
  368.      lue:='Hybrid2'
  369.      addToList()
  370.      lue:='Hybrid'
  371.      addToList()
  372.      lue:='Threshold'
  373.      addToList()
  374.      lue:='MBordered'
  375.      addToList()
  376.      lue:='2x2'
  377.      addToList()
  378.      lue:='Color'
  379.      addToList()
  380.      lue:='HAM6'
  381.      addToList()
  382.      lue:='HAM8'
  383.      addToList()
  384.      lue:='Gray'
  385.      addToList()
  386.      lue:='Gray8'
  387.      addToList()
  388.      rodzajDit:=prr
  389.      inform()
  390.       REPEAT
  391.         messageClass:=wait4message(win)
  392.         SELECT messageClass
  393.           CASE IDCMP_GADGETUP
  394.             SELECT infos  /* pointer to gadget */             
  395.               CASE infoButton
  396.                inform()
  397.               CASE saveButton
  398.                IF req:=RtAllocRequestA(FILEREQ,0)
  399.                  IF beginWait(win, myreq)
  400.                    RtEZRequestA('Prg. MP needs(?!?!?!??) path < 31 chars.',
  401.                    'BI-LA KAIFA !!!!',0,0,0)
  402.                    RtChangeReqAttrA(req,[RTFI_DIR,dir])
  403.                     IF RtFileRequestA(req,NIL,'Pick a drawer TO save !!!'
  404.                       ,[RTFI_FLAGS,(FREQF_NOFILES OR FREQF_SAVE)])
  405.                       StrCopy(robot,req.dir)
  406.                       StrCopy(plik,robot)
  407.                       StringF(robot,'IFF24.%%%%')
  408.                       IF RtGetStringA(robot,100,'Enter a file pattern !!!',0,0)
  409.                          StrAdd(plik,'/')
  410.                          StrAdd(plik,robot)
  411.                            IF StrLen(plik)>31
  412.                              RtEZRequestA('It must be under 31 chars !!!!.',
  413.                              'Doup !!! Sorry I''ll try again !!',0,0,0)
  414.                            ELSE
  415.                          StringF(robot,'\s -saveiff \s \s',mppath,plik,gattext)
  416.                          Execute(robot,NIL,0)
  417.                          robot[]:=0
  418.                       ENDIF
  419.                     ENDIF
  420.                  ENDIF
  421.                  endWait(win, myreq)
  422.                  RtFreeRequest(req)
  423.                 ENDIF
  424.                ENDIF
  425.         CASE playButton
  426.             IF (noap=1) AND (rodzajDit>20)
  427.                shit:=1
  428.             ENDIF
  429.              IF shit=0
  430.               IF mp_Task:=Open('ram:pracfile',NEWFILE)
  431.                IF FileLength(stringGadgetValue)<>0
  432. /* 
  433. ******  Buttons OFF
  434. */
  435.            Gt_SetGadgetAttrsA (loadButton, win, NIL,
  436.                       [GA_DISABLED,1,TAG_DONE])
  437.            Gt_SetGadgetAttrsA (playButton, win, NIL,
  438.                       [GA_DISABLED,1,TAG_DONE])
  439.            Gt_SetGadgetAttrsA (saveButton, win, NIL,
  440.                       [GA_DISABLED,1,TAG_DONE])
  441.            Gt_SetGadgetAttrsA (infoButton, win, NIL,
  442.                       [GA_DISABLED,1,TAG_DONE])
  443.  
  444.                 IF rodzajDit=0 THEN StrCopy(dither,' -dither gray8 ',ALL)
  445.                 IF rodzajDit=1 THEN StrCopy(dither,' -dither gray ',ALL)
  446.                 IF rodzajDit=2 THEN StrCopy(dither,' -dither ham8 ',ALL)
  447.                 IF rodzajDit=3 THEN StrCopy(dither,' -dither ham6 ',ALL)
  448.                 IF rodzajDit=4 THEN StrCopy(dither,' -dither color ',ALL)
  449.                 IF rodzajDit=5 THEN StrCopy(dither,' -dither 2x2 ',ALL)
  450.                 IF rodzajDit=6 THEN StrCopy(dither,' -dither mbordered ',ALL)
  451.                 IF rodzajDit=7 THEN StrCopy(dither,' -dither threshold ',ALL)
  452.                 IF rodzajDit=8 THEN StrCopy(dither,' -dither hybrid ',ALL)
  453.                 IF rodzajDit=9 THEN StrCopy(dither,' -dither hybrid2 ',ALL)
  454.                 IF rodzajDit=10 THEN StrCopy(dither,' -dither ordered ',ALL)
  455.                 IF rodzajDit=11 THEN StrCopy(dither,' -dither ordered2 ',ALL)
  456.                 IF rodzajDit=12 THEN StrCopy(dither,' -dither fs2 ',ALL)
  457.                 IF rodzajDit=13 THEN StrCopy(dither,' -dither fs2fast ',ALL)
  458.                 IF rodzajDit=14 THEN StrCopy(dither,' -dither fs4 ',ALL)
  459.                 IF rodzajDit=15 THEN StrCopy(dither,' -dither mono ',ALL)
  460.                 IF rodzajDit=16 THEN StrCopy(dither,' -dither retina24 ',ALL)
  461.                 IF rodzajDit=17 THEN StrCopy(dither,' -dither egs24 ',ALL)
  462.                 IF rodzajDit=18 THEN StrCopy(dither,' -dither village24 ',ALL)
  463.                 IF rodzajDit=19 THEN StrCopy(dither,' -dither opal24 ',ALL)
  464.                 IF rodzajDit=20 THEN StrCopy(dither,' -dither opal15 ',ALL)
  465.                 IF rodzajDit=21 THEN StrCopy(dither,' -dither color ',ALL)
  466.                 IF rodzajDit=22 THEN StrCopy(dither,' -dither ham6 ',ALL)
  467.                 IF rodzajDit=23 THEN StrCopy(dither,' -dither hiresham ',ALL)
  468.                 StringF(mainfile,'')
  469.                  IF rodzajDit>20
  470.                     StrAdd(mainfile,appath,ALL)
  471.                     player:=2
  472.                  ELSE
  473.                     StrAdd(mainfile,mppath,ALL)
  474.                     player:=1
  475.                  ENDIF
  476.                   IF ch3=0 THEN StrAdd(mainfile,' -nob',ALL)
  477.                   IF ch4=0 THEN StrAdd(mainfile,' -nob',ALL)
  478.                     StrAdd(mainfile,dither,ALL)
  479. /*                  IF beginWait(win, myreq)
  480. */
  481.                     count:=0
  482.                   IF ch2=0 THEN RtGetLongA({pentla},'Write LOOP number:',0,0)
  483.                   IF pentla=0 THEN pentla:=1
  484.                   IF ch1=0
  485.                     StringF(robot,'C:Copy \s TO Ram:\s',stringGadgetValue,buf)
  486.                     Execute(robot,NIL,0)
  487.                     StrAdd(mainfile,'RAM:')
  488.                     StrAdd(mainfile,buf)
  489.                       REPEAT
  490.                         Execute(mainfile,0,mp_Task)
  491.                         count:=count+1
  492.                       UNTIL count=pentla
  493.                     pentla:=1
  494.                     StringF(mainfile,'C:Delete >NIL: RAM:\s',buf)
  495.                     Execute(mainfile,0,mp_Task)
  496.                   ELSE
  497.                     StrAdd(mainfile,stringGadgetValue,ALL)
  498.                       REPEAT
  499.                         Execute(mainfile,0,mp_Task)
  500.                         count:=count+1
  501.                       UNTIL count=pentla
  502.                     pentla:=1
  503.                  ENDIF
  504. /*                    endWait(win, myreq)*/
  505. /* Button's OK
  506. */
  507.            Gt_SetGadgetAttrsA (loadButton, win, NIL,
  508.                       [GA_DISABLED,0,TAG_DONE])
  509.            Gt_SetGadgetAttrsA (playButton, win, NIL,
  510.                       [GA_DISABLED,0,TAG_DONE])
  511.            Gt_SetGadgetAttrsA (saveButton, win, NIL,
  512.                       [GA_DISABLED,0,TAG_DONE])
  513.            Gt_SetGadgetAttrsA (infoButton, win, NIL,
  514.                       [GA_DISABLED,0,TAG_DONE])
  515.  
  516.                ENDIF
  517.               ENDIF
  518.                  Close(mp_Task)
  519.                  IF (FileLength('RAM:pracfile')>10) AND (FileLength
  520.                      ('RAM:pracfile')<175)
  521.                     wpis()
  522.                  ELSE
  523.                  ENDIF
  524.                 ENDIF
  525. /* ENDIF*/
  526.                shit:=0
  527.               CASE loadButton
  528.                IF req:=RtAllocRequestA(FILEREQ,0)
  529.                 IF beginWait(win, myreq)
  530.                  /*buf[]:=0 */
  531.                  RtChangeReqAttrA(req,[RTFI_DIR,dir,RTFI_MATCHPAT,
  532.                  '#?.(MPEG|MP|MPG)'])
  533.                   IF RtFileRequestA(req,buf,'Pick an mpeg anim !!!'
  534.                    ,[RT_WAITPOINTER,(512),RTFI_FLAGS,(FREQF_PATGAD),
  535.                    RTFI_OKTEXT,('SURE')])
  536.                    StrCopy(plik,buf)
  537.                    StrCopy(dir,req.dir)
  538.                     IF StrCmp(req.dir[StrLen(dir)-1],':')
  539.                      StrCopy(gattext,dir)
  540.                      StrAdd(gattext,plik)
  541.                     ELSEIF StrCmp(req.dir[StrLen(dir)-1],'/')
  542.                      StrCopy(gattext,dir)
  543.                      StrAdd(gattext,plik)
  544.                     ELSEIF StrLen(dir)<1
  545.                      StrCopy(gattext,dir)
  546.                      StrAdd(gattext,plik)
  547.                     ELSE
  548.                      StrCopy(gattext,dir)
  549.                      StrAdd(gattext,'/')
  550.                      StrAdd(gattext,plik)
  551.                     ENDIF
  552.                    Gt_SetGadgetAttrsA (stringGadget, win, NIL,
  553.                    [GTST_STRING,gattext,TAG_DONE])
  554.                    StrCopy(dir,req.dir)
  555.                    RtFreeRequest(req)
  556.                   ENDIF
  557.                   endWait(win, myreq)
  558.                 ENDIF
  559.                ENDIF
  560.               CASE listView
  561.                 listItemPosition:=infos.gadgetid /* note the use of this field! */
  562.               CASE checkRAM
  563.                 ch1:=check+1
  564.               CASE checkLoop
  565.                 ch2:=check+1
  566.               CASE checkNOP
  567.                 ch3:=check+1
  568.               CASE checkNOB
  569.                 ch4:=check+1
  570.            ENDSELECT
  571.           CASE IDCMP_INTUITICKS
  572.             NOP/*  these are being sent FOR some shitty reason }:-( */
  573.         ENDSELECT
  574.       UNTIL messageClass=IDCMP_CLOSEWINDOW
  575.       closeWindow()
  576.     ENDIF
  577.   ENDIF
  578.   CloseLibrary(reqtoolsbase)
  579.  ELSE
  580.   Raise(NO_REQTOOLS)
  581.  ENDIF
  582.   closeScreen()
  583.   CleanUp(0)
  584. EXCEPT
  585.   SELECT exception
  586.       IF reqtoolsbase THEN CloseLibrary(reqtoolsbase)
  587.       CASE NO_MP
  588.                          EasyRequestArgs(NIL,
  589.                         [SIZEOF easystruct, 0, 'MPEGInt. Request Window',
  590.                         '   I can''t find MP program   \n   check path in icon prefs',
  591.                         'OK :(']:easystruct,
  592.                         NIL,NIL)
  593.       CASE NO_ICONLIB
  594.                         EasyRequestArgs(NIL,
  595.                         [SIZEOF easystruct, 0, 'MPEGInt. Request Window',
  596.                         '   Sorry no icon.library\nin your''s LIBS: dir',
  597.                         'OK I''ll copy it']:easystruct,
  598.                         NIL,NIL)
  599.       CASE NO_ICON
  600.                         EasyRequestArgs(NIL,
  601.                         [SIZEOF easystruct, 0, 'MPEGInt. Request Window',
  602.                         'Sorry, you need TO run\n this program from WB',
  603.                         'OK (I understand)']:easystruct,
  604.                         NIL,NIL)
  605.       CASE NO_REQTOOLS
  606.                         EasyRequestArgs(NIL,
  607.                         [SIZEOF easystruct, 0, 'MPEGInt. Request Window',
  608.                         ' Sorry no ReqTools.library\n   in your''s LIBS: dir',
  609.                         'OK I''ll copy it']:easystruct,
  610.                         NIL,NIL)
  611.       DEFAULT
  612.       WriteF('Well there is some error ( >:-< ) blââââdddd np.\n')
  613.       WriteF('Excident nr: "\s"\n', [exception, 0])
  614.       closeWindow()
  615.       closeScreen()
  616.       CleanUp(0)
  617.   ENDSELECT
  618. ENDPROC
  619.  
  620. PROC beginWait(win, waitRequest)
  621.  InitRequester(waitRequest)
  622.  IF Request(waitRequest, win)
  623.   SetPointer(win,chippointer, 16, 16, -6, 0)
  624.   RETURN TRUE
  625.  ELSE
  626.   RETURN FALSE
  627.  ENDIF
  628. ENDPROC
  629.  
  630. PROC endWait(win, waitRequest)
  631.  ClearPointer(win)
  632.  EndRequest(waitRequest, win)
  633. ENDPROC
  634.  
  635. PROC name()
  636.   SetWindowTitles(win,'Sauron MPEG Intuition V2.12b', Not(0))
  637. ENDPROC
  638.  
  639. PROC inform()
  640.  
  641. DEF w=NIL:PTR TO window
  642. IF beginWait(win, myreq)
  643.  IF w:=OpenWindowTagList(NIL,[WA_FLAGS,$E,WA_IDCMP,$268,
  644.                   WA_TOP,win.topedge+40,WA_LEFT,win.leftedge+8,
  645.                   WA_WIDTH,300,WA_HEIGHT,140,WA_TITLE,'About MPEG intuition V2.12b',0])
  646.                   SetStdRast(w.rport)
  647.                   Colour(2,0)
  648.                   TextF(70,30,'Sauron MPEG Intuition')
  649.                   TextF(50,45,'by Sauron (c) 1995 v2.12b')
  650.                   Colour(1,0)
  651.                   TextF(55,65,'Bugs & Develope send TO:')
  652.                   TextF(45,75,'Adrian (SAURON) Siemieniak')
  653.                   TextF(45,85,'sauron@sco.zsi.pwr.wroc.pl')
  654.                   TextF(35,95,'sauron@sun1000.ci.pwr.wroc.pl')
  655.                   TextF(75,105,'tel.(071) 24-10-20')
  656.                   TextF(15,125,'---------------------------------')
  657.                   WHILE (class:=WaitIMessage(w))<>IDCMP_CLOSEWINDOW
  658.                   ENDWHILE
  659.                    CloseWindow(w)
  660.                   name()
  661.  ENDIF
  662. endWait(win, myreq)
  663. ENDIF
  664. ENDPROC
  665.  
  666. PROC wpis()
  667.   DEF inputstring[80]:STRING,work[20]:STRING,work2[14]:STRING,mp_Task,x,y,a,b
  668.   IF mp_Task:=Open('ram:pracfile',OLDFILE)
  669.       ReadStr(mp_Task,inputstring)
  670.       StrCopy(work2,'')
  671.    IF player=1
  672.       ReadStr(mp_Task,inputstring)
  673.       MidStr(work,inputstring,41,StrLen(inputstring)-46)
  674.       FOR a:=0 TO 12-StrLen(work) DO StrAdd(work2,' ')
  675.       x:= RealVal(work)
  676.       StrAdd(work2,work)
  677.       Gt_SetGadgetAttrsA (textTime, win, NIL,
  678.                   [GTTX_TEXT,work2,GTTX_BORDER,1,NIL])
  679.  
  680.       ReadStr(mp_Task,inputstring)
  681.       a:= InStr(inputstring,' x',10)
  682.       MidStr(work,inputstring,11,a-11)
  683.       Gt_SetGadgetAttrsA (textX, win, NIL,
  684.                   [GTTX_TEXT,work,GTTX_BORDER,1,NIL])
  685.       a:= InStr(inputstring,'x ',10)
  686.       b:= InStr(inputstring,' Pi',10)
  687.       b:= b-2-a
  688.       IF b=2
  689.           a:=a-1
  690.           b:=3
  691.       ENDIF
  692.       MidStr(work,inputstring,a+2,b)
  693.       Gt_SetGadgetAttrsA (textY, win, NIL,
  694.                   [GTTX_TEXT,work,GTTX_BORDER,1,NIL])
  695.  
  696.       ReadStr(mp_Task,inputstring)
  697.       StrCopy(work2,'')
  698.       MidStr(work,inputstring,17,StrLen(inputstring)-6)
  699.       FOR a:=0 TO 8-StrLen(work) DO StrAdd(work2,' ')
  700.       y:= RealVal(work)
  701.       StrAdd(work2,work)
  702.       Gt_SetGadgetAttrsA (textFrames, win, NIL,
  703.                   [GTTX_TEXT,work2,GTTX_BORDER,1,NIL])
  704.  
  705.       ReadStr(mp_Task,inputstring)
  706.       UpperStr(inputstring)
  707.       StrCopy(work2,'')
  708.       a:= InStr(inputstring,' BYTES',13)
  709.       MidStr(work,inputstring,16,a-16)
  710.       FOR a:=1 TO 9- StrLen(work) DO StrAdd(work2,' ')
  711.       StrAdd(work2,work)
  712.       Gt_SetGadgetAttrsA (textSize, win, NIL,
  713.                   [GTTX_TEXT,work2,GTTX_BORDER,1,NIL])
  714.       a:= InStr(inputstring,'TE ',42)
  715.       MidStr(work,inputstring,a+2,7)
  716.       Gt_SetGadgetAttrsA (textComp, win, NIL,
  717.                   [GTTX_TEXT,work,GTTX_BORDER,1,NIL])
  718.     ELSE
  719.       ReadStr(mp_Task,inputstring)
  720.       MidStr(work,inputstring,41,StrLen(inputstring)-46)
  721.       FOR a:=0 TO 12-StrLen(work) DO StrAdd(work2,' ')
  722.       x:= RealVal(work)
  723.       StrAdd(work2,work)
  724.       Gt_SetGadgetAttrsA (textTime, win, NIL,
  725.                   [GTTX_TEXT,work2,GTTX_BORDER,1,NIL])
  726.  
  727.       ReadStr(mp_Task,inputstring)
  728.       StrCopy(work2,'')
  729.       MidStr(work,inputstring,17,StrLen(inputstring)-6)
  730.       FOR a:=0 TO 8-StrLen(work) DO StrAdd(work2,' ')
  731.       y:= RealVal(work)
  732.       StrAdd(work2,work)
  733.       Gt_SetGadgetAttrsA (textFrames, win, NIL,
  734.                   [GTTX_TEXT,work2,GTTX_BORDER,1,NIL])
  735.  
  736.       ReadStr(mp_Task,inputstring)
  737.       a:= InStr(inputstring,'*',10)
  738.       MidStr(work,inputstring,12,a-12)
  739.       Gt_SetGadgetAttrsA (textX, win, NIL,
  740.                   [GTTX_TEXT,work,GTTX_BORDER,1,NIL])
  741.       a:= InStr(inputstring,'*',10)
  742.       b:= InStr(inputstring,' pi',10)
  743.       b:= b-2-a
  744.       IF b=1
  745.           b:=2
  746.           MidStr(work2,inputstring,a+1,b)
  747.           StringF(work,' \s',work2)
  748.       ELSEIF
  749.           MidStr(work,inputstring,a+1,b+2)
  750.       ENDIF
  751.       Gt_SetGadgetAttrsA (textY, win, NIL,
  752.                   [GTTX_TEXT,work,GTTX_BORDER,1,NIL])
  753.  
  754.       StrCopy(work2,'')
  755.       b:= !x*y
  756.       a:= FileLength(gattext)/(!b!)
  757.       StringF(work,'\d.2',a)
  758.       FOR a:=0 TO 8-StrLen(work) DO StrAdd(work2,' ')
  759.       StrAdd(work2,work)
  760.       Gt_SetGadgetAttrsA (textSize, win, NIL,
  761.                   [GTTX_TEXT,work2,GTTX_BORDER,1,NIL])
  762.  
  763.    ENDIF
  764.  
  765. /* File length procedure*/
  766.       StrCopy(work2,'')
  767.       StringF(work,'\d',FileLength(gattext))
  768.       a:= Val(work)
  769.       b:=Div(a,1024)
  770.       StringF(work,'\d',b)
  771.       FOR a:=0 TO 3-StrLen(work) DO StrAdd(work2,' ')
  772.       StrAdd(work2,work)
  773.       Gt_SetGadgetAttrsA (textKB,win ,NIL,
  774.                   [GTTX_TEXT,work2,GTTX_BORDER,1,NIL])
  775.  
  776. /* Frames counter procedure */
  777.       b:=!x*y
  778.       StringF(work,'\d',!b!)
  779.       StrCopy(work2,'')
  780.       FOR a:=0 TO 3-StrLen(work) DO StrAdd(work2,' ')
  781.       StrAdd(work2,work)
  782.       Gt_SetGadgetAttrsA (textKlata,win ,NIL,
  783.                   [GTTX_TEXT,work2,GTTX_BORDER,1,NIL])
  784.     Close(mp_Task)
  785.   ENDIF
  786. ENDPROC
  787.  
  788.  
  789. PROC ikona()
  790.         DEF wb:PTR TO wbstartup,wba:PTR TO wbarg,dobj:PTR TO diskobject,toolarray,
  791.         str,olddir=0,pri=0,read=0
  792.         IF (iconbase:=OpenLibrary('icon.library',37))
  793.         ELSE
  794.             Raise(NO_ICONLIB)
  795.         ENDIF
  796.    IF wbmessage
  797.                 wb:=wbmessage ; wba:=wb.arglist
  798.                 IF (wba.lock>0) AND (wba.name>0)
  799.                         olddir:=CurrentDir(wba.lock)
  800.                 ENDIF
  801.                  IF (dobj:=GetDiskObject(wba.name))>0
  802.                     toolarray:=dobj.tooltypes
  803.                        IF (str:=FindToolType(toolarray,'MP_PATH'))>0
  804.                          StrCopy(mppath,str,ALL)
  805.                        ENDIF
  806.                        IF (str:=FindToolType(toolarray,'AP_PATH'))>0
  807.                          StrCopy(appath,str,ALL)
  808.                          IF FileLength(appath)<=0
  809.                              noap:=1
  810.                          EasyRequestArgs(NIL,
  811.                         [SIZEOF easystruct, 0, 'MPEGInt. Request Window',
  812.                         '   I can''t find Amipeg program   \n     check path in icon prefs',
  813.                         'OK :(']:easystruct,
  814.                         NIL,NIL)
  815.                          ENDIF
  816.                        ENDIF
  817.                        IF (str:=FindToolType(toolarray,'MP_PRIO'))>0
  818.                          pri:=Val(str,read)
  819.                           IF read=0
  820.                            prio:=pri
  821.                           ENDIF
  822.                        ENDIF
  823.                        IF (str:=FindToolType(toolarray,'MP_ANIMPATH'))>0
  824.                          StrCopy(dir,str,ALL)
  825.                        ENDIF
  826.                        IF (str:=FindToolType(toolarray,'MP_ANIMNAME'))>0
  827.                         IF StrCmp(req.dir[StrLen(dir)-1],':')
  828.                          StrCopy(gattext,dir)
  829.                          StrAdd(gattext,str)
  830.                         ELSEIF StrCmp(req.dir[StrLen(dir)-1],'/')
  831.                          StrCopy(gattext,dir)
  832.                          StrAdd(gattext,str)
  833.                         ELSEIF StrLen(dir)<1
  834.                          StrCopy(gattext,dir)
  835.                          StrAdd(gattext,str)
  836.                         ELSE
  837.                          StrCopy(gattext,dir)
  838.                          StrAdd(gattext,'/')
  839.                          StrAdd(gattext,str)
  840.                         ENDIF
  841.                        ENDIF
  842.                        IF (str:=FindToolType(toolarray,'MP_DITHER'))>0
  843.                          IF StrCmp(UpperStr(str),'GRAY8')
  844.                              prr:=0
  845.                          ELSEIF StrCmp(UpperStr(str),'GRAY')
  846.                              prr:=1
  847.                          ELSEIF StrCmp(UpperStr(str),'HAM8')
  848.                              prr:=2
  849.                          ELSEIF StrCmp(UpperStr(str),'HAM6')
  850.                              prr:=3
  851.                          ELSEIF StrCmp(UpperStr(str),'COLOR')
  852.                              prr:=4
  853.                          ELSEIF StrCmp(UpperStr(str),'2X2')
  854.                              prr:=5
  855.                          ELSEIF StrCmp(UpperStr(str),'MBORDERED')
  856.                              prr:=6
  857.                          ELSEIF StrCmp(UpperStr(str),'TRESHOLD')
  858.                              prr:=7
  859.                          ELSEIF StrCmp(UpperStr(str),'HYBRID')
  860.                              prr:=8
  861.                          ELSEIF StrCmp(UpperStr(str),'HYBRID2')
  862.                              prr:=9
  863.                          ELSEIF StrCmp(UpperStr(str),'ORDERED')
  864.                              prr:=10
  865.                          ELSEIF StrCmp(UpperStr(str),'ORDERED2')
  866.                              prr:=11
  867.                          ELSEIF StrCmp(UpperStr(str),'FS2')
  868.                              prr:=12
  869.                          ELSEIF StrCmp(UpperStr(str),'FS2FAST')
  870.                              prr:=13
  871.                          ELSEIF StrCmp(UpperStr(str),'FS4')
  872.                              prr:=14
  873.                          ELSEIF StrCmp(UpperStr(str),'MONO')
  874.                              prr:=15
  875.                          ELSEIF StrCmp(UpperStr(str),'RETINA24')
  876.                              prr:=16
  877.                          ELSEIF StrCmp(UpperStr(str),'EGS24')
  878.                              prr:=17
  879.                          ELSEIF StrCmp(UpperStr(str),'VILLAGE24')
  880.                              prr:=18
  881.                          ELSEIF StrCmp(UpperStr(str),'OPAL24')
  882.                              prr:=19
  883.                          ELSEIF StrCmp(UpperStr(str),'OPAL15')
  884.                              prr:=20
  885.                          ELSEIF StrCmp(UpperStr(str),'AMP-COLOR')
  886.                              prr:=21
  887.                          ELSEIF StrCmp(UpperStr(str),'AMP-HAM6')
  888.                              prr:=22
  889.                          ELSEIF StrCmp(UpperStr(str),'AMP-HIRESHAM')
  890.                              prr:=23
  891.                          ELSE
  892.                              EasyRequestArgs(NIL,
  893.                             [SIZEOF easystruct, 0, 'Request Window Name',
  894.                             '   Unknow dither type\nspecified in icon tooltype',
  895.                             'OK I''ll use DEFAULT (gray8)']:easystruct,
  896.                             NIL,NIL)
  897.                          ENDIF
  898.                        ENDIF
  899.                        IF (str:=FindToolType(toolarray,'X_WIN'))>0
  900.                          pri:=Val(str,read)
  901.                           IF read=0
  902.                            x:=pri
  903.                           ENDIF
  904.                        ENDIF
  905.                        IF (str:=FindToolType(toolarray,'Y_WIN'))>0
  906.                          pri:=Val(str,read)
  907.                           IF read=0
  908.                            y:=pri
  909.                           ENDIF
  910.                        ENDIF
  911.                        IF (str:=FindToolType(toolarray,'MP_RAM'))>0
  912.                          IF StrCmp(UpperStr(str),'YES') THEN ch1:=0
  913.                        ENDIF
  914.                        IF (str:=FindToolType(toolarray,'MP_NOP'))>0
  915.                          IF StrCmp(UpperStr(str),'YES') THEN ch4:=0
  916.                        ENDIF
  917.                        IF (str:=FindToolType(toolarray,'MP_NOB'))>0
  918.                          IF StrCmp(UpperStr(str),'YES') THEN ch3:=0
  919.                        ENDIF
  920.                        IF (str:=FindToolType(toolarray,'MP_LOOP'))>0
  921.                          IF StrCmp(UpperStr(str),'YES') THEN ch2:=0
  922.                        ENDIF
  923.               CloseLibrary(iconbase)
  924.           ENDIF
  925.    ELSE
  926.        Raise(NO_ICON)
  927.    ENDIF
  928. ENDPROC
  929.