home *** CD-ROM | disk | FTP | other *** search
/ Enigma Amiga Life 109 / EnigmaAmiga109CD.iso / software / sviluppo / rxmui / examples / getit.rexx < prev    next >
OS/2 REXX Batch file  |  1999-12-21  |  9KB  |  283 lines

  1. /**/
  2.  
  3. signal on halt
  4. signal on break_c
  5.  
  6. l="rmh.library";if ~show("L",l) then;if ~addlib(l,0,-30) then exit
  7. if AddLibrary("rxmui.library")~=0 then exit
  8.  
  9. call rxmuiopt("DEBUGMODE showerr")
  10.  
  11. global.confwin=0
  12. call createApp
  13. call SetNotifies
  14.  
  15. call set("mwin","open",1)
  16. call getattr("mwin","open","o")
  17. if o=0 then do
  18.     say "can't open window"
  19.     exit
  20. end
  21.  
  22. call handleApp
  23. exit
  24. /***********************************************************************/
  25. handleApp: procedure expose global.
  26. ctrl_c=2**12
  27. s=0
  28. do forever
  29.     call handle("APP","H",s)
  30.     do i=0 to h.num-1
  31.         select
  32.             when h.i="QUIT" then exit
  33.             when h.i="MCONFIG" then call openConfWin(1)
  34.             when h.i="START" then do
  35.                 call openConfWin(0)
  36.                 call start
  37.             end
  38.             otherwise nop
  39.         end
  40.     end
  41.     s=Wait(or(h.signals,ctrl_c))
  42.     if and(s,ctrl_c)>0 then exit
  43. end
  44. exit
  45. /***********************************************************************/
  46. err: procedure expose sigl rxmuierror
  47. parse arg res
  48. say signl "["res"]"
  49.     say getrxmuistring(res) "in line" sigl-1 rxmuierror
  50.     exit
  51. /***********************************************************************/
  52. createApp: procedure expose global.
  53.     call child("STRIP","MPROJECT","MENU")
  54.     mproject.Title="Project"
  55.      call child("MPROJECT",menuitem("MGETANOTHER","Get Another...","G"))
  56.      call child("MPROJECT",menuitem("","BAR"))
  57.      call child("MPROJECT",menuitem("MABOUT","About...","?"))
  58.      call child("MPROJECT",menuitem("MABOUTMUI","About MUI..."))
  59.      call child("MPROJECT",menuitem("","BAR"))
  60.      call child("MPROJECT",menuitem("MHIDE","Hide","H"))
  61.      call child("MPROJECT",menuitem("","BAR"))
  62.      call child("MPROJECT",menuitem("MQUIT","Quit","Q"))
  63.     call child("STRIP","MEDITOR","MENU")
  64.     meditor.Title="Editor"
  65.      call child("MEDITOR",menuitem("MCONFIG","Config...","C"))
  66.     res=NewObj("MENUSTRIP","STRIP",,1)
  67.     if res~=0 then call err(res)
  68.  
  69.     app.Title="GetIt"
  70.     app.Version="$VER: GetIt 1.0 (10.12.99)"
  71.     app.Copyright="©1999, alfie"
  72.     app.Author="alfie"
  73.     app.Description="Http downloader"
  74.     app.Base="GETIT"
  75.     app.SubWindow="MWIN"
  76.      mwin.ID="MAIN"
  77.      mwin.Title="GetIt by alfie"
  78.      mwin.Contents="MGROUP"
  79.      mwin.menustrip="STRIP"
  80.       mgroup.0="G"
  81.        g.frame="GROUP"
  82.        g.class="GROUP"
  83.        g.pagemode=1
  84.        g.activepage=0
  85.         g.0="wdata"
  86.         wdata.class="group"
  87.         wdata.columns=2
  88.          wdata.0=label("_Url","DOUBLE")
  89.          wurl.cyclechain=1;
  90.          wdata.1=String("wurl","u")
  91.          wdata.2=label("_File","DOUBLE")
  92.          wfile.cyclechain=1;
  93.          wdata.3=String("wfile","f")
  94.         g.1="rdata"
  95.         rdata.class="group"
  96.         rdata.columns=2
  97.          rdata.0=label("Url","DOUBLE")
  98.          wurl.cyclechain=1;
  99.          rdata.1=Status("rurl","")
  100.          rdata.2=label("File","DOUBLE")
  101.          rfile.cyclechain=1;
  102.          rdata.3=Status("rfile","")
  103.       mgroup.1="GG"
  104.        gg.class="GROUP"
  105.        gg.horiz=1
  106.         gg.0="info"
  107.          info.class="gauge"
  108.          info.infotext=""
  109.          info.horiz=1
  110.          info.frame="GAUGE"
  111.         ss.weight=10;
  112.         gg.1="pg2"
  113.          pg2.class="group"
  114.          pg2.pagemode=1
  115.          pg2.weight=20
  116.           pg2.0=Button("START","_Start")
  117.           pg2.1=Button("STOP","_Stop")
  118.  
  119.     res=NewObj("APPLICATION","APP",,1)
  120.     if res~=0 then call err(res)
  121.     return
  122. /***********************************************************************/
  123. setNotifies: procedure expose global.
  124.     call set("MWIN","ACTIVEOBJECT","START")
  125.     call Notify("MWIN","CLOSEREQUEST",1,"APP","RETURNID","QUIT")
  126.  
  127.     call Notify("MGETANOTHER","MENUTRIGGER","EVERYTIME","APP","RETURNID")
  128.     call Notify("MABOUT","MENUTRIGGER","EVERYTIME","APP","ABOUT","MWIN")
  129.     call Notify("MABOUTMUI","MENUTRIGGER","EVERYTIME","APP","ABOUTMUI","MWIN")
  130.     call Notify("MHIDE","MENUTRIGGER","EVERYTIME","APP","SET","ICONIFIED",1)
  131.     call Notify("MQUIT","MENUTRIGGER","EVERYTIME","APP","RETURNID","QUIT")
  132.     call Notify("MCONFIG","MENUTRIGGER","EVERYTIME","APP","RETURNID")
  133.  
  134.     call Notify("START","PRESSED",0,"G","SET","ACTIVEPAGE",1)
  135.     call Notify("START","PRESSED",0,"PG2","SET","ACTIVEPAGE",1)
  136.     call Notify("START","PRESSED",0,"MWIN","SET","ACTIVEOBJECT","STOP")
  137.     call Notify("START","PRESSED",0,"app","returnid")
  138.     call Notify("STOP","PRESSED",0,"G","SET","ACTIVEPAGE",0)
  139.     call Notify("STOP","PRESSED",0,"PG2","SET","ACTIVEPAGE",0)
  140.     call Notify("STOP","PRESSED",0,"MWIN","SET","ACTIVEOBJECT","START")
  141.     call Notify("WURL","NEWCONTENTS","EVERYTIME","RURL","SET","CONTENTS","TRIGGERVALUE")
  142.     call Notify("WFILE","NEWCONTENTS","EVERYTIME","RFILE","SET","CONTENTS","TRIGGERVALUE")
  143.     return
  144. /***********************************************************************/
  145. halt:
  146. break_c:
  147.     exit
  148. /**************************************************************************/
  149. openConfWin: procedure expose global.
  150. parse arg o
  151.     if global.confwin=0 then do
  152.         call info("Creating config window...")
  153.         call child("CSTRIP","CMPROJECT","MENU")
  154.         cmproject.Title="Project"
  155.          call child("CMPROJECT",menuitem("CMSAVE","Save","S"))
  156.          call child("CMPROJECT",menuitem("CMUSE","Use","U"))
  157.          call child("CMPROJECT",menuitem("","BAR"))
  158.          call child("CMPROJECT",menuitem("CMQUIT","Quit","Q"))
  159.         call child("CSTRIP","CMEDITOR","MENU")
  160.         cmeditor.Title="Editor"
  161.          call child("CMEDITOR",menuitem("CMRESTORE","Restore","R"))
  162.          call child("CMEDITOR",menuitem("CMLASTSAVEDS","Last saveds","L"))
  163.         res=NewObj("MENUSTRIP","CSTRIP",,1)
  164.         if res~=0 then call err(res)
  165.  
  166.         cwin.ID="CONF"
  167.         cwin.Title="GetIt configuration"
  168.         cwin.menustrip="cstrip"
  169.         cwin.Contents="cmgroup"
  170.           cmgroup.0="CG0"
  171.           cg0.class="group"
  172.           cg0.frame="group"
  173.           cg0.columns=2
  174.           cg0.0=label("Sa_veDir")
  175.           cg0.1="popd"
  176.            popd.class="popasl"
  177.            dir.cyclechain=1
  178.            dir.objectid=1
  179.            popd.string=string("dir",'v')
  180.            popd.drawersonly=1
  181.           cg0.2=label("_Proxy")
  182.           cg0.3="PG"
  183.            pg.class="group"
  184.            pg.horiz=1
  185.            proxy.cyclechain=1
  186.            proxy.objectid=2
  187.            pg.0=string("proxy",'p')
  188.            proxyport.weight=20
  189.            proxyport.cyclechain=1
  190.            proxyport.objectid=3
  191.            pg.1=string("proxyport")
  192.           cg0.4=label("Re_ferer")
  193.           referer.cyclechain=1
  194.           referer.objectid=4
  195.           cg0.5=string("referer",'f')
  196.           cg0.6=label("_Timeout")
  197.           cg0.7="TG"
  198.            tg.class="group"
  199.            tg.horiz=1
  200.             timeout.weight=40
  201.             timeout.cyclechain=1
  202.             timeout.objectid=5
  203.             tg.0=string("timeout",t,)
  204.             tg.1=hspace()
  205.          cmgroup.1="CG1"
  206.            cg1.class="group"
  207.            cg1.frame="group"
  208.           cg1.columns=4
  209.            cg1.0=label("_Resume")
  210.            resume.objectid=6
  211.            cg1.1=checkmark("resume",,'r')
  212.            cg1.2=label("_If modified since")
  213.            ism.objectid=7
  214.            cg1.3=checkmark("ims",,'i')
  215.            cg1.4=label("Use pro_xy")
  216.            useproxy.objectid=8
  217.            cg1.5=checkmark("useproxy",,'x')
  218.            cg1.6=label("_No Cache")
  219.            nocache.objectid=9
  220.            cg1.7=checkmark("nocache",,'n')
  221.            cg1.8=label("_Watch clip")
  222.            wc.objectid=10
  223.            cg1.9=checkmark("wc",,'w')
  224.            cg1.10=hvspace()
  225.          cmgroup.2=hvspace()
  226.          cmgroup.3="CG2"
  227.            cg2.class="group"
  228.           cg2.horiz=1
  229.            cg2.0=button("save","_Save")
  230.            cg2.1=button("use","_Use")
  231.            cg2.2=button("Cancel","_Cancel")
  232.         res=NewObj("window","cwin",,1)
  233.         if res~=0 then call err(res)
  234.  
  235.         call notify("cmsave","menutrigger","everytime","app","save","envarc")
  236.         call notify("cmsave","menutrigger","everytime","cwin","set","open",0)
  237.         call notify("cmsave","menutrigger","everytime","info","set","infotext","Configuration saved")
  238.         call notify("cmuse","menutrigger","everytime","app","save","env")
  239.         call notify("cmuse","menutrigger","everytime","cwin","set","open",0)
  240.         call notify("cmuse","menutrigger","everytime","info","set","infotext","New configuration")
  241.         call notify("cmquit","menutrigger","everytime","cwin","set","open",0)
  242.         call notify("cmrestore","menutrigger","everytime","app","load","env")
  243.         call notify("cmrestore","menutrigger","everytime","info","set","infotext","Configuration restored")
  244.         call notify("cmlastsaveds","menutrigger","everytime","app","load","envarc")
  245.         call notify("cmlastsaveds","menutrigger","everytime","info","set","infotext","Configuration read")
  246.  
  247.         call notify("cwin","closerequest","everytime","cwin","set","open",0)
  248.  
  249.         call notify("save","pressed",0,"app","save","envarc")
  250.         call notify("save","pressed",0,"cwin","set","open",0)
  251.         call notify("save","pressed",0,"info","set","infotext","Configuration saved")
  252.         call notify("use","pressed",0,"app","save","env")
  253.         call notify("use","pressed",0,"cwin","set","open",0)
  254.         call notify("use","pressed",0,"info","set","infotext","New configuration")
  255.         call notify("cancel","pressed",0,"cwin","set","open",0)
  256.  
  257.         call add("app","cwin")
  258.         call info("Reading configuration...")
  259.         call DoMethod("APP","LOAD")
  260.         call info("Waiting...")
  261.         global.confwin=1
  262.     end
  263.     call set("cwin","open",o)
  264.     return
  265. /***********************************************************************/
  266. info: procedure expose global.
  267. parse arg txt
  268.     call set("info","infotext",txt)
  269.     return
  270. /***********************************************************************/
  271. start: procedure expose global.
  272.     get.0="DIR";get.0.attr="CONTENTS"
  273.     get.1="PROXY";get.1.attr="CONTENTS"
  274.     get.2="PROXYPORT";get.2.attr="INTEGER"
  275.     get.3="RESUME";get.3.attr="SELECTED"
  276.     res=multigetattr("GET")
  277.     if res~=0 then call err(res)
  278.     do i=0 to 3
  279.         say get.i get.i.attr
  280.     end
  281.     return
  282. /***********************************************************************/
  283.