home *** CD-ROM | disk | FTP | other *** search
/ Amiga Plus 2004 #2 / Amiga Plus CD - 2004 - No. 02.iso / AmigaPlus / Tools / Development / RxMUI / Examples / AmIRC.rexx < prev    next >
Encoding:
OS/2 REXX Batch file  |  2004-01-31  |  8.2 KB  |  229 lines

  1. /* Amirc 2.2 GUI ?!? */
  2.  
  3. signal on halt
  4. signal on break_c
  5.  
  6. call Init
  7. call CreateApp
  8. call HandleApp
  9. /* Never reached */
  10. /***********************************************************************/
  11. Init: procedure expose global.
  12.     l="rmh.library";if ~show("L",l) then;if ~addlib(l,0,-30) then exit
  13.     if AddLibrary("rexxsupport.library","rxmui.library")~=0 then exit
  14.     call ProgDir()
  15.     global.ub=0
  16.     return
  17. /***********************************************************************/
  18. CreateApp: procedure expose global.
  19.     app.Title="Amirc"
  20.     app.Version="$VER: Amirc 2.2 (3.6.2002)"
  21.     app.Copyright="Copyright © 2002 by Alfonso Ranieri"
  22.     app.Author="Alfonso Ranieri"
  23.     app.Description="Amirc GUI clone"
  24.     app.Base="AIRC"
  25.     app.MenuStrip="strip"
  26.      call child("strip","mproject","Menu")
  27.       mproject.Title="Project"
  28.        call child("mproject",menuitem("mservers","Server...","S"))
  29.        call child("mproject",menuitem("","Bar"))
  30.        call child("mproject",menuitem("mlog","Active log","","Chekit Toggle"))
  31.        call child("mproject",menuitem("","Bar"))
  32.        call child("mproject",menuitem("mhide","Hide","H"))
  33.        call child("mproject",menuitem("","Bar"))
  34.        call child("mproject",menuitem("mhelp","Help..."))
  35.        call child("mproject",menuitem("","Bar"))
  36.        call child("mproject",menuitem("maboutAmirc","About Amirc...","?"))
  37.        call child("mproject",menuitem("maboutmui","About MUI..."))
  38.        call child("mproject",menuitem("","bar"))
  39.        call child("mproject",menuitem("mquit","Quit","Q"))
  40.     app.SubWindow="mwin"
  41.      mwin.Title="Amirc"
  42.      mwin.ID="AIRC"
  43.      mwin.Contents="mgroup"
  44.       call child("mgroup","g1","Group")
  45.        g1.Horiz=1
  46.        g1.HorizSpacing=0
  47.         channels.Weight=0;call child("g1",Button("Channels","#amiga"))
  48.        call child("g1","tp","Group")
  49.         tp.PageMode=1
  50.          call child("tp",String("Topic"))
  51.          call child("tp",Text("STopic","a"))
  52.        call child("g1",MakeTinyToggle("T","T",1))
  53.        call child("g1",MakeTinyToggle("N","N",1))
  54.        call child("g1",MakeTinyToggle("S","S",0))
  55.        call child("g1",MakeTinyToggle("I","I",0))
  56.        call child("g1",MakeTinyToggle("M","M",0))
  57.        call child("g1",MakeTinyToggle("L","L",0))
  58.        MaxUsers.Disabled=1;MaxUsers.Weight=0;call child("g1",string("MaxUsers"))
  59.        call child("g1",MakeTinyToggle("K","k",0))
  60.        key.Disabled=1;key.Weight=0;call child("g1",String("Key"))
  61.        call child("G1",MakeTinyToggle("B","B",0))
  62.       call child("mgroup","g2","Group")
  63.        g2.Horiz=1
  64.         call child("g2","talk","Group")
  65.         call child("talk","msg","NListview")
  66.          msg.List="List"
  67.           list.Class="NList"
  68.           list.Input=0
  69.           list.AutoCopyToClip=1
  70.           list.Format="PREPARSE" d2c(27)"r COL=0 BAR, COL=1 BAR"
  71.           list.WrapCol=x2d(62)
  72.           list.AutoVisible=0
  73.            list.0="poing|CA rulezza, MUI suka"
  74.            list.1="«Kick»|poing è stato cacciato da #amigaita da alfie : poing suka"
  75.            list.2="alfie|rxmui.library rulez! :)"
  76.            list.3="alfie|Open 'buttons' with an editor, modify and save it! :-)"
  77.         call child("talk","me","Group")
  78.          me.Horiz=1
  79.           call child("me","lamp","Lamp")
  80.           call child("me",Label("alfie"))
  81.           call child("me","DUMMY1","GROUP")
  82.            dummy1.Horiz=1
  83.            dummy1.HorizSpacing=0
  84.             call child("dummy1",String("mymsg"))
  85.             e.Weight=0;call child("dummy1",Button("E","L"))
  86.        call child("g2",MakeObj(,"Balance"))
  87.        call child("g2","utils","Group")
  88.         utils.Weight=10
  89.          call child("utils","users","NListview")
  90.           users.List="ulist"
  91.            ulist.0="alfie"
  92.            ulist.1="jhon"
  93.          hbar.Weight=0;call child("utils",MakeObj("hbar","HBar",0))
  94.     app.SubWindow.1="cwin"
  95.      cwin.Title="Preferred channels"
  96.      cwin.ID="CWIN"
  97.      cwin.Contents="cwmgroup"
  98.       cwmgroup.FrameTitle="(doubleclick on a channel to join it)"
  99.       call child("cwmgroup","clistview","NListview")
  100.        clistview.List="clist"
  101.         clist.class="NList"
  102.          clist.0="#amiga"
  103.          clist.1="#amigaita"
  104.       call child("cwmgroup","cwg","Group")
  105.        cwg.Horiz=1
  106.         call child("cwg",Label("Add:"))
  107.         call child("cwg",String("ac"))
  108.         call child("cwg",Button("rc","Remove"))
  109.  
  110.     if NewObj("APPLICATION","APP")>0 then exit
  111.  
  112.     call CreateUserButtons
  113.  
  114.     call Notify("mwin","CloseRequest",1,"app","ReturnID","QUIT")
  115.     call Notify("cwin","CloseRequest",1,"cwin","Set","Open",0)
  116.  
  117.     call Notify("channels","Pressed",0,"cwin","Set","open",1)
  118.  
  119.     call Notify("msg","entries","EveryTime","msg","Set","first","bottom")
  120.  
  121.     call Notify("channels","Pressed",0,"app","ReturnID")
  122.  
  123.     call Notify("topic","NewContents","EveryTime","stopic","Set","Contents","TriggerValue")
  124.  
  125.     call Notify("T","Selected",0,"msg","insert","«mode»|not protected","bottom")
  126.     call Notify("T","Selected",1,"msg","insert","«mode»|protected","bottom")
  127.     call Notify("T","Selected","EveryTime","tp","Set","activepage","TriggerValue")
  128.     call Notify("S","Selected",1,"msg","insert","«mode»|secret","bottom")
  129.     call Notify("S","Selected",0,"msg","insert","«mode»|not secret","bottom")
  130.     call Notify("I","Selected",1,"msg","insert","«mode»|invite only","bottom")
  131.     call Notify("I","Selected",0,"msg","insert","«mode»|not invite","bottom")
  132.     call Notify("M","Selected",1,"msg","insert","«mode»|moderated","bottom")
  133.     call Notify("M","Selected",0,"msg","insert","«mode»|not moderated","bottom")
  134.     call Notify("L","Selected","EveryTime","maxusers","Set","disabled","notTriggerValue")
  135.     call Notify("K","Selected","EveryTime","key","Set","disabled","notTriggerValue")
  136.     call Notify("B","Selected","EveryTime","app","returnid")
  137.  
  138.     call Notify("maboutamirc","MenuTrigger","EveryTime","app","About","mwin")
  139.     call Notify("maboutmui","MenuTrigger","EveryTime","app","AboutMUI","mwin")
  140.     call Notify("mquit","MenuTrigger","EveryTime","app","ReturnID","QUIT")
  141.     call Notify("mhide","MenuTrigger","EveryTime","app","Set","Iconified",1)
  142.  
  143.     call set("topic","Contents","rxmui.library is out !!!")
  144.     call set("stopic","Contents","rxmui.library is out !!!")
  145.  
  146.     call set("mwin","Open",1)
  147.  
  148.     return
  149. /***********************************************************************/
  150. HandleApp: procedure expose global.
  151.     noti=StartNotify("PROGDIR:buttons")
  152.     ns=NotifySignal(noti)
  153.     ctrl_c=2**12
  154.     mask=or(ctrl_c,ns)
  155.     do forever
  156.         call NewHandle("APP","H",mask)
  157.         if and(h.signals,ctrl_c)>0 then exit
  158.         if and(h.signals,ns)>0 then call createUserButtons
  159.         if h.EventFlag then
  160.             select
  161.                 when h.event="QUIT" then exit
  162.                 otherwise say h.event
  163.             end
  164.     end
  165.     /* never reached */
  166. /***********************************************************************/
  167. CreateUserButtons: procedure expose global.
  168.     if ~open("in","PROGDIR:buttons","r") then do
  169.         say "can't open buttons file"
  170.         return
  171.     end
  172.  
  173.     call DoMethod("utils","InitChange")
  174.  
  175.     if global.ub then do
  176.         call Dispose("userbuttons")
  177.         call set("users","ContextMenu","")
  178.         call Dispose("ubmenu")
  179.     end
  180.  
  181.     ubmenu.0="mactions"
  182.      mactions.class="Menu"
  183.      mactions.Title="Actions"
  184.  
  185.     userbuttons.Columns=2
  186.     userbuttons.Spacing=0
  187.     userbuttons.Weight=0
  188.  
  189.     i=0
  190.     do while ~eof("in")
  191.         line=readln("in")
  192.         if line="" then iterate
  193.         userbuttons.i=button("ub"i,line)
  194.         mactions.i=MenuItem("um"i,line)
  195.         i=i+1
  196.     end
  197.  
  198.     call close("in")
  199.  
  200.     if NewObj("Group","userbuttons")>0 then exit
  201.     call Add("utils","userbuttons")
  202.  
  203.     if NewObj("Menustrip","ubmenu")>0 then exit
  204.     call set("users","ContextMenu","ubmenu")
  205.  
  206.     call DoMethod("utils","ExitChange")
  207.  
  208.     global.ub=1
  209.  
  210.     return
  211. /***********************************************************************/
  212. MakeTinyToggle: procedure expose global.
  213. parse arg name,text,state
  214.     b.Contents=text
  215.     b.InputMode="Toggle"
  216.     b.ShowSelState=1
  217.     b.Selected=state
  218.     b.Font="Button"
  219.     b.Frame="Button"
  220.     b.Background="ButtonBack"
  221.     b.Weight=0
  222.     if NewObj("Text",name,"B")>0 then exit
  223.     return name
  224. /***********************************************************************/
  225. halt:
  226. break_c:
  227.     exit
  228. /***********************************************************************/
  229.