home *** CD-ROM | disk | FTP | other *** search
-
- /*
- ** $VER: EditUserVars.edge 1.13 (Sunday 08-Aug-93 02:36:57)
- **
- ** View/edit the user variables in Edge.
- ** NOTE: needs rexxarplib.library v3.0
- **
- ** Written by Thomas liljetoft
- */
-
-
- options results
-
- /* first get the argument */
-
- parse arg type
- if upper(type) = GLOBAL then
- do
- titlestr = "Edit global user variables."
- id = "_GE_"
- end
- else
- do
- titlestr = "Edit local user variables."
- id = "_FE_"
- end
-
- /* load 'rexxarplib.library' if not loaded */
- if ~show('l','rexxarplib.library') then
- call addlib('rexxarplib.library',0,-30)
-
- /* get screen environment data */
-
- 'getenvvar' _ge_screenname
- screenname = result
- 'getenvvar' _ge_barheight
- barheight = result
- 'getenvvar' _ge_visualscreenheight
- screenheight = result
-
- myportname = EDITUSERVARPORT||upper(device)
- myhostname = EDITUSERVARHOST||upper(device)
-
- /* try to create a port */
-
- myport = openport(myportname)
- if c2d(myport) == 0 then do
- 'requestnotify' title '"EditUserVars error"' "Couldn't open '"myportname"', am exiting"
- exit(0)
- end
-
- /* try to create our rexxarp host */
-
- address AREXX "'call createhost("myhostname","myportname","'"'screenname'"'")'"
- address command waitforport myhostname
- if ~showlist('p',myhostname) then do
- 'requestnotify' title '"EditUserVars error"' "Couldn't create '"myhostname"', am exiting"
- exit(0)
- end
-
- /* setup window stuff, colors, idcmp, font, etc */
-
- call setreqcolor(myhostname,SHADOW,1)
- call setreqcolor(myhostname,BOX,2)
- call setreqcolor(myhostname,OKAY,1)
-
- idcmp = 'CLOSEWINDOW+GADGETUP+VANILLAKEY'
- flags = 'ACTIVATE+WINDOWCLOSE+WINDOWDRAG+WINDOWDEPTH'
-
- window_w = 600
- window_h = 188+barheight
- if window_h + barheight > screenheight then
- window_t = screenheight - window_h
- else
- window_t = barheight
-
- call openwindow(myhostname,20,window_t,window_w,window_h,idcmp,flags,titlestr)
- call setfont(myhostname,"topaz.font",8,0,1,8)
- call setapen(myhostname,1)
- call modifyhost(myhostname,VANILLAKEY,"%l %a")
-
- /* get the user vars and attach each to a string gadget */
-
- do i = 0 to 9
- call move(myhostname,12,i*15+barheight+12)
- call text(myhostname,id||"User"i)
- 'getenvvar' id||user||i
- call AddGadget(myhostname,124,i*15+barheight+6,i,result,i||"%1%g",464,RIDGEBORDER)
- end
-
- /* add the Flag gadget */
-
- call move(myhostname,12,150+barheight+12)
- call text(myhostname,id||"UserFlags")
- 'getenvvar' id||"userflags"
- call AddGadget(myhostname,124,150+barheight+6,10,result,10||"%1%g",464,RIDGEBORDER)
-
- /* and the 'Ok' and 'Cancel' gadgets */
-
- call addgadget(myhostname,12,window_h - 16,10," Ok ","Ok")
- call addgadget(myhostname,window_w - 80,window_h - 16,10," Cancel ","Cancel")
-
- /* main loop */
-
- do forever
-
- if quitflag = 1 then leave
-
- call waitpkt(myportname)
-
- do inner_loop = 1
-
- pkt = getpkt(myportname)
- if c2d(pkt) = 0 then leave inner_loop
- command = getarg(pkt,0)
- parse var command command value
- call reply(pkt,0)
-
- select
-
- /* quit (cancel) by clicking 'Cancel', pressing 'c' or 'C' or 'ESC' */
-
- when (command = CLOSEWINDOW) | (command = VANILLAKEY & (value = '' | upper(value) = 'C')) | (command = "Cancel") then
- do
- call closewindow(myhostname)
- quitflag = 1
- end
-
- /* ok by clicking 'Ok' or pressing 'o' or 'O' */
-
- when (command = "Ok") | (command = VANILLAKEY & upper(value) = 'O') then
- do
- do i = 0 to 10
- call readgadget(myhostname,i)
- do wait = 1
- call waitpkt(myportname)
- pkt = getpkt(myportname)
- if c2d(pkt) ~= 0 then
- do
- command = getarg(pkt,0)
- string = getarg(pkt,1)
- call reply(pkt,0)
- parse var command command
- if command >= 0 & command <= 10 then
- do
- if i = 10 then
- 'putenvvar' id||"userflags" '"'string'"'
- else
- 'putenvvar' id||user||i '"'string'"'
- leave wait
- end
- end
- end
- end
- call closewindow(myhostname)
- quitflag = 1
- end
-
- /* by pressng keys '0' to '9' the user may activate the stringgadgets */
-
- when command = VANILLAKEY & value >=0 & value <= 9 then
- do
- call activategadget(myhostname,strip(value))
- end
-
- /* by pressng 'f' or 'F' the user may activate the flag stringgadget */
-
- when command = VANILLAKEY & upper(value) = 'F' then
- do
- call activategadget(myhostname,10)
- end
- otherwise nop
- end
- end
- end
-
- call closeport(myportname)
-
- exit(0)
-