home *** CD-ROM | disk | FTP | other *** search
- /*
- ** Agnen ver 0.9 by Mahdi/Sauron and Sihaja (:)
- **
- ** This program send by Signal(0 CTRL_C to task called 'Background CLI'
- ** Thats mean to all progrmas run by run or execute functions
- */
-
- OPT OSVERSION=37
-
- MODULE 'gadtools','libraries/gadtools','intuition/intuition',
- 'intuition/screens', 'intuition/gadgetclass', 'graphics/text',
- 'amigalib/tasks','dos/dos'
-
- ENUM NONE,NOCONTEXT,NOGADGET,NOWB,NOVISUAL,OPENGT,NOWINDOW,NOMENUS
-
- DEF project0wnd:PTR TO window,
- project0glist,
- terButton=NIL:PTR TO gadget,
- decButton=NIL:PTR TO gadget,
- hexButton=NIL:PTR TO gadget,
- infos:PTR TO gadget,
- scr:PTR TO screen,
- visual=NIL,
-
- offx,offy,tattr,process,processOld,processDEC[10]:STRING,processHEX[10]:STRING
-
- PROC setupscreen()
- IF (gadtoolsbase:=OpenLibrary('gadtools.library',37))=NIL THEN RETURN OPENGT
- IF (scr:=LockPubScreen('Workbench'))=NIL THEN RETURN NOWB
- IF (visual:=GetVisualInfoA(scr,NIL))=NIL THEN RETURN NOVISUAL
- offy:=scr.wbortop+Int(scr.rastport+58)-10
- tattr:=['topaz.font',8,0,0]:textattr
- ENDPROC
-
- CHAR '$VER: Agnen v1.0 by MAHDI/SAURON (c) 1995',0
-
- PROC closedownscreen()
- IF visual THEN FreeVisualInfo(visual)
- IF scr THEN UnlockPubScreen(NIL,scr)
- IF gadtoolsbase THEN CloseLibrary(gadtoolsbase)
- ENDPROC
-
- PROC openproject0window()
- DEF g:PTR TO gadget
- IF (g:=CreateContext({project0glist}))=NIL THEN RETURN NOCONTEXT
- IF (g:=terButton:=CreateGadgetA(BUTTON_KIND,g,
- [offx+15,offy+16,105,27,'Terminate',tattr,0,16,visual,0]:newgadget,
- [NIL]))=NIL THEN RETURN NOGADGET
- IF (g:=decButton:=CreateGadgetA(TEXT_KIND,g,
- [offx+166,offy+16,92,11,'DEC',tattr,1,1,visual,0]:newgadget,
- [GTTX_TEXT,' NO TASK',
- GTTX_BORDER,1,
- NIL]))=NIL THEN RETURN NOGADGET
- IF (g:=hexButton:=CreateGadgetA(TEXT_KIND,g,
- [offx+166,offy+32,92,11,'HEX',tattr,2,1,visual,0]:newgadget,
- [GTTX_TEXT,' NO TASK',
- GTTX_BORDER,1,
- NIL]))=NIL THEN RETURN NOGADGET
- IF (project0wnd:=OpenWindowTagList(NIL,
- [WA_LEFT,175,
- WA_TOP,44,
- WA_WIDTH,offx+275,
- WA_HEIGHT,offy+50,
- WA_IDCMP,$24C077E,
- WA_FLAGS,$100E,
- WA_TITLE,'Agnen - task terminator',
- WA_SCREENTITLE,'Agnen by Mahdi/Sauron',
- WA_CUSTOMSCREEN,scr,
- WA_MINWIDTH,67,
- WA_MINHEIGHT,21,
- WA_MAXWIDTH,$2D2,
- WA_MAXHEIGHT,283,
- WA_AUTOADJUST,1,
- WA_AUTOADJUST,1,
- WA_GADGETS,project0glist,
- NIL]))=NIL THEN RETURN NOWINDOW
- Gt_RefreshWindow(project0wnd,NIL)
- ENDPROC
-
- PROC closeproject0window()
- IF project0wnd THEN CloseWindow(project0wnd)
- IF project0glist THEN FreeGadgets(project0glist)
- ENDPROC
-
- PROC wait4message(win:PTR TO window)
- DEF mes:PTR TO intuimessage,type
- REPEAT
- type:=0
- IF process:=FindTask('Background CLI')
- IF process<>processOld
- processOld:=process
- StringF(processDEC,' \d',process)
- StringF(processHEX,' \h',process)
- Gt_SetGadgetAttrsA (decButton, project0wnd, NIL,
- [GTTX_TEXT,processDEC,NIL])
- Gt_SetGadgetAttrsA (hexButton, project0wnd, NIL,
- [GTTX_TEXT,processHEX,NIL])
- ELSEIF process=0
- Gt_SetGadgetAttrsA (decButton, project0wnd, NIL,
- [GTTX_TEXT,' NO TASK',NIL])
- Gt_SetGadgetAttrsA (hexButton, project0wnd, NIL,
- [GTTX_TEXT,' NO TASK',NIL])
- ENDIF
- ELSE
- ENDIF
- IF mes:=Gt_GetIMsg(win.userport)
- type:=mes.class
- IF type=IDCMP_MENUPICK
- infos:=mes.code
- ELSEIF type=IDCMP_GADGETUP
- infos:=mes.iaddress
- infos.gadgetid:=mes.code
- ELSEIF type=IDCMP_REFRESHWINDOW
- Gt_BeginRefresh(win)
- Gt_EndRefresh(win,TRUE)
- type:=0
- ELSEIF type<>IDCMP_CLOSEWINDOW /* remove these if you like */
- type:=0
- ENDIF
- Gt_ReplyIMsg(mes)
- ELSE
- WaitPort(win.userport)
- ENDIF
- UNTIL type
- ENDPROC type
-
- PROC reporterr(er)
- DEF erlist:PTR TO LONG
- IF er
- erlist:=['get context','create gadget','lock wb','get visual infos',
- 'open "gadtools.library" v37+','open window','create menus']
- EasyRequestArgs(0,[20,0,0,'Could not \s!','ok'],0,[erlist[er-1]])
- ENDIF
- ENDPROC er
-
- PROC main()
- DEF messageClass
- IF reporterr(setupscreen())=0
- reporterr(openproject0window())
- REPEAT
- messageClass:=wait4message(project0wnd)
- SELECT messageClass
- CASE IDCMP_GADGETUP
- SELECT infos /* pointer TO gadget */
- CASE terButton
- Signal(process,SIGBREAKF_CTRL_C)
- Gt_SetGadgetAttrsA (decButton, project0wnd, NIL,
- [GTTX_TEXT,'TERMINATED',NIL])
- Gt_SetGadgetAttrsA (hexButton, project0wnd, NIL,
- [GTTX_TEXT,'TERMINATED',NIL])
- ENDSELECT
- ENDSELECT
- UNTIL messageClass=IDCMP_CLOSEWINDOW
- closeproject0window()
- IF CtrlC() THEN BRA x
- ENDIF
- x: closedownscreen()
- ENDPROC
-
-