* This can only be assembled under DEVPAC V3.01 since there are many opcodes * only DEVPAC 3.01 understands. As far as I know. NOLIST OPT ow-,o+,ow6+,NODEBUG,NOLINE *AUTO: make KCommodity ;* $Revision Header built by KCommodity by Kai Iske *** (do not edit) ************ ;* ;* © Copyright by GuntherSoft ;* ;* File : KCommodity.Asm ;* Created on : Sunday, 05-Jan-92 14:22:48 ;* Created by : Kai Iske ;* Current revision : V1.70 ;* ;* ;* Purpose ;* ------- ;* This is a multifunctional Commodity including many useful tools. ;* The best part of it is the revision control system this header was made ;* with. All previous LogMessages got lost due to change to KCommodity to ;* arrange the new ones. ;* ;* Revision V1.70 ;* -------------- ;* changed on Thursday, 19-Mar-92 16:02:34 by Kai Iske. LogMessage : ;* Many, many, many, many changes made. See History.TXT for a complete list ;* ;* Revision V1.63 ;* -------------- ;* changed on Sunday, 15-Mar-92 01:14:29 by Kai Iske. LogMessage : ;* Bugs in ESC-WindowClose, LeftyMouse and MouseBlanking removed. ;* When Mouse is blanked no other sprites will be turned off now. ;* Shell created now gets all the paths you used a PATH for. ;* ;* Revision V1.62 ;* -------------- ;* changed on Friday, 13-Mar-92 01:18:36 by Kai Iske. LogMessage : ;* Added an Online-Help function giving help for almost every function ;* KCommodity provides. Some bug fixes and remakes. ;* ;* Revision V1.61 ;* -------------- ;* changed on Wednesday, 11-Mar-92 22:33:00 by Kai Iske. LogMessage : ;* All windows (except for Clock-Window) are menu driven now. The old shortcuts ;* are kept. Improved StringGadget-Editing by adding a StringEdit-Hook. Menu- ;* ShortCuts may be used while editing a StringGadget. Normal ShortCuts may ;* still be used for convenience. ;* ;* Revision V1.60 ;* -------------- ;* changed on Wednesday, 11-Mar-92 02:09:43 by Kai Iske. LogMessage : ;* Added function to map german "Umlauts" so that these are translated into ;* "normal" chars. Registration may be printed out now. ;* ;* Revision V1.59 ;* -------------- ;* changed on Friday, 21-Feb-92 00:24:52 by Kai Iske. LogMessage : ;* Removed most of the ToolTypes, since all settings may be stored to a file. ;* Added an AppIcon and an AppMenuItem for easy popup of the control-window ;* (for people who can`t remember HotKeys) ;* ;* Revision V1.58 ;* -------------- ;* changed on Tuesday, 18-Feb-92 01:32:26 by Kai Iske. LogMessage : ;* Added HotKeys for all windows of KCommodity. HotKey for Shell added. ;* HotKey definitions may be done within a window now ;* ;* Revision V1.57 ;* -------------- ;* changed on Sunday, 16-Feb-92 04:25:26 by Kai Iske. LogMessage : ;* Preferences can be saved to alternative files to have several settings ;* available. Interfaces between routines enhanced. KCommodity didn`t get ;* quite larger (due to optimaziation). Control window now has menues. ;* ;* Revision V1.56 ;* -------------- ;* changed on Monday, 10-Feb-92 02:58:12 by Kai Iske. LogMessage : ;* Shortened KCommodity. Added Window-Close via ESC-Key. Bugs removed. ;* Layout changed. ;* ;* Revision V1.55 ;* -------------- ;* changed on Sunday, 09-Feb-92 03:32:21 by Kai Iske. LogMessage : ;* Bugs removed. Added function to display costs for one day in telefone bill. ;* Lefty mouse function added. When channels get stolen KCommodity will try ;* to reallocate new ones the next time. ;* ;* Revision V1.54 ;* -------------- ;* changed on 02-Feb-92, Sunday 02-Feb-92 by Kai Iske. LogMessage : ;* TimeZone/Tariff defaults can be set and will be saved to PREFSFILE. ;* Position of PrefsWindow may be changed via ToolType/ARexx. ESC-Key is the ;* terminator for a window. WB can be popped to fron when control window ;* should be (re)opened. PrefsWindow-Pos may be set. ;* ;* Revision V1.53 ;* -------------- ;* changed on 31-Jan-92, Friday 31-Jan-92 by 23:10:34. LogMessage : ;* Now also generates Revision Headers for Pascal/Modula programs. ;* Revision defines for Assembler improved since now macros are created. ;* Added a gadget and an ARexx command to clear the logfile. ;* ;* Revision V1.52 ;* -------------- ;* changed on Friday, 31-Jan-92 22:02:26 by Kai Iske. LogMessage : ;* Now the time and online displays and checks area handeled by a spererate ;* process so that the displays and values are always adjusted correctly. ;* Move the bill-checkbox-gadgets to the preferences window. ;* ;* Revision V1.51 ;* -------------- ;* changed on Sunday, 26-Jan-92 00:05:39 by Kai Iske. LogMessage : ;* Added a telefone bill calculator, which keeps track of all logins made and ;* saves them to a logfile. 3 definable times/unit for normal or cheap tariff. ;* Accumulated costs can be retrieved. Writing to log file can be turned off. ;* ;* Revision V1.50 ;* -------------- ;* changed on Sunday, 19-Jan-92 23:19:59 by Kai Iske. LogMessage : ;* Added new displaymodes in (Window)-TitleBar. Total amount of free memory, ;* graphical display of free memory and accumulated online time. ;* ;* Revision V1.49 ;* -------------- ;* changed on Saturday, 18-Jan-92 23:23:55 by Kai Iske. LogMessage : ;* Again some stupid bugs removed (why not). Added KeyStroke-Clicker with ;* userdefinable volume. Changed layout. Screen/Mouse-Times are reset to ;* previous values if a wrong one was entered. ;* ;* Revision V1.48 ;* -------------- ;* changed on Saturday, 18-Jan-92 02:28:32 by Kai Iske. LogMessage : ;* Now includes Window-Cycling with user-definable Qualifiers. ;* Bug hunting, but I still don`t know why it sometimes crashes on other ;* machines, but not on mine. ;* ;* Revision V1.47 ;* -------------- ;* changed on Monday, 13-Jan-92 23:05:42 by Kai Iske. LogMessage : ;* Now adds revision date within defines and skips defines if commented out ;* or just thrown away. Bug in finding the current dir removed. ;* ;* Revision V1.46 ;* -------------- ;* changed on Monday, 13-Jan-92 17:15:37 by Kai Iske. LogMessage : ;* Bug hunting. But still XOper displays some weird info. I think that`s a bug ;* of XOper2.3 since it displays these infos while KCommodity isn`t running. ;* Revision control system now gives one more define : DATE of revision ;* ;* Revision V1.45 ;* -------------- ;* changed on Monday, 13-Jan-92 13:50:39 by Kai Iske. LogMessage : ;* Removed some weird bugs which made KCommodity crash the system. ;* ;* Revision V1.44 ;* -------------- ;* changed on Sunday, 12-Jan-92 00:04:32 by Kai Iske. LogMessage : ;* Bug hunt (I hope the final). Some modifications the user probably won`t ;* notice ;* ;* Revision V1.43 ;* -------------- ;* changed on Saturday, 11-Jan-92 03:26:14 by Kai Iske. LogMessage : ;* Error in Event-Handler removed due to the fact that not all registers have ;* been stored on stack before workthrough of routine ;* ;* Revision V1.42 ;* -------------- ;* changed on Friday, 10-Jan-92 23:23:00 by Kai Iske. LogMessage : ;* Added a Screen/Mouseblanker. Mouse is either blanked after the given period ;* of time or when key pressed. Blanking is turned off when pressing a key ;* or moving the mouse. ;* ;* Revision V1.41 ;* -------------- ;* changed on Friday, 10-Jan-92 16:09:29 by Kai Iske. LogMessage : ;* Did some 'tuning'. ARexx ClockWinPos wasn`t recognized just after a ;* ClockWin 1. Control window comes to front if already active and HotKey is ;* pressed. ;* ;* Revision V1.40 ;* -------------- ;* changed on Thursday, 09-Jan-92 18:33:19 by Kai Iske. LogMessage : ;* Did some fine things on layout :-). Now a screentitle is set for all ;* windows used by KCommodity. Also all windows are centered when poped up ;* but they will keep their positions moved to during runtime ;* ;* Revision V1.39 ;* -------------- ;* changed on Thursday, 09-Jan-92 15:39:22 by Kai Iske. LogMessage : ;* Bad errors removed. KCommodity didn`t keep track of absolute path of file. ;* Now uses CurrentDir if no ???: is specified to get a correct lock to a ;* file. It gets the lock of ARexx`s Process->pr_CurrentDir. Clock is now ;* visible again :-) ;* ;* Revision V1.38 ;* -------------- ;* changed on Monday, 06-Jan-92 14:40:20 by Kai Iske. LogMessage : ;* Corrected a little bug in environment variable settings ;* ;* Revision V1.37 ;* -------------- ;* changed on Sunday, 05-Jan-92 15:22:13 by Kai Iske. LogMessage : ;* Added possibilty to 'jump over' some revisions by inserting the next ;* revision number into gadgets ;* ;* Revision V1.36 ;* -------------- ;* --- Initial release --- ;* ;********************************************************************************* REVISION MACRO ; This is the macro for the revision number dc.b "1.70" ENDM REVDATE MACRO ; This is the macro for the revision date dc.b "19-Mar-92" ENDM INCLUDE KCommodity.i ; Include our Headers ; For DevPac >= 3 the preincludes ; will be loaded ; Otherwise the includes will be taken INCDIR AH: INCLUDE Misc/MyMacros.i ; Include MyMacros ********************************************************************** * Versionnumber of libs, we need * ********************************************************************** NEED_LIBVER EQU 37 AREXXBUFFSIZE EQU 8192 HOTKEYSIZE EQU 128 LOADBUFFSIZE EQU 512 FILEBUFFSIZE EQU 256 LOGENTRYSIZE EQU 80 ALARMTIMESIZE EQU 10 HELPMAXSIZE EQU 2560 STATUSLINESIZE EQU 128 DEPTHWIDTH EQU 28 MAXBARLEN EQU 150 MAXPAGES EQU 5 TIMEPAGE EQU 0 DMEMPAGE EQU 1 TMEMPAGE EQU 2 GMEMPAGE EQU 3 ONLINEPAGE EQU 4 ESCKEY EQU $1B HELPKEY EQU $5f RESCKEY EQU $45 SIGTIMEREMAKE EQU SIGBREAKF_CTRL_F SIGHANDSHAKE EQU SIGBREAKF_CTRL_E SIGBILLWIN EQU SIGBREAKF_CTRL_D SECTION MyCode,CODE bra.s START ********************************************************************** * Versionstring for C:Version-Prg * * I place it right here, so that it can be found quickly * ********************************************************************** VersionString dc.b 0,"$VER: KCommodity V" REVISION dc.b " (" REVDATE dc.b ")",0 EVEN ********************************************************************** * Main program * ********************************************************************** START movem.l d1-d7/a0-a6,-(sp) move.l $4,a6 ; Test, if we`re running under 2.x cmp.w #36,LIB_VERSION(a6) bge.s .IsOver20 bsr OnlyKick20 bra .EndPrg * First of all some needed initializations .IsOver20 bsr OpenLibs ; Open libs tst.l d0 beq .OpenError bsr InitMem ; Initialize the memory-buffers tst.l d0 beq .OpenError * Now to the ToolTypes/CommandLine parsing sub.l a1,a1 ; Get pointer to our process CALLSYS FindTask move.l d0,OurTask move.l d0,a4 tst.l pr_CLI(a4) ; Did we come from WB ? bne.s .GoOn ; Yep -> go on .FromWB lea pr_MsgPort(a4),a0 ; Get WB-Message CALLSYS WaitPort lea pr_MsgPort(a4),a0 DOLIB GetMsg move.l d0,WBMsg move.l d0,a4 move.l sm_ArgList(a4),a4 ; Get pointer to ArgList cmp.l #0,a4 beq.s .GoOn move.l wa_Lock(a4),d1 ; Get lock to Prg-Dir LNKLIB CurrentDir,_DOSBase move.l wa_Name(a4),a0 ; Get .info-File LNKLIB GetDiskObject,_IconBase move.l d0,MyDiskObj tst.l d0 beq .EndPrg move.l d0,a0 move.l do_ToolTypes(a0),MyToolTypes ; Store pointer to ToolTypes .GoOn bsr MakeHotKeys ; Copy defaults to hotkey buffs lea StrEditHook,a0 ; Initialize the StringEdit-Hook move.l #StrEditFunc,h_Entry(a0) move.l #0,h_SubEntry(a0) move.l #0,h_Data(a0) bsr LoadPrefs ; Read in log preferences move.l PTimeZone,d0 ; Set new modes and timezone move.l d0,TimeZone ; This is only done on startup move.l PTariff,d0 move.b d0,CheapMode move.l OurTask,a0 ; Check where to get parameters from tst.l pr_CLI(a0) beq.s .GetTypes bsr GetCommandLine ; Get command line tst.l d7 ; Error ??? beq.s .OpenError bra.s .WildThing .GetTypes bsr GetToolTypes ; Get ToolTypes * Now initialize the main thingies .WildThing bsr InitBroker ; Initialize broker tst.l d0 beq.s .OpenError bsr InitGfx ; Initialize graphics tst.l d0 beq.s .OpenError bsr InitAudio ; Init Audio-Stuff tst.l d0 beq.s .OpenError bsr InitConsole ; Open Console-Device tst.l d0 beq.s .OpenError bsr InitChecker ; Init the timer process tst.l CheckerProc beq.s .OpenError bsr InitRexxProc ; Init Rexx process tst.l RexxProc beq.s .OpenError bsr InitAppIcon ; Init our AppIcon bsr InitAppItem ; Init AppTools menuitem tst.b DoPopUp ; If pop up was requested beq.s .NoInitPop bsr OpenOurWindow ; Do so tst.l d0 bne.s .OpenError .NoInitPop bsr EnableBroker ; Start broker bsr CheckBroker ; Do the wild thing bra.s .EndPrg .OpenError tst.l ErrorNum ; Error occured ? blt.s .NoErrorDisp bsr DisplayError ; Display error .NoErrorDisp moveq #10,d0 ; Set error code bra.s .CloseDown .EndPrg moveq #0,d0 ; No error .CloseDown move.l d0,-(sp) CALLSYS Forbid ; Disable any messages to our stuff bsr RemoveBroker ; Close resources bsr RemoveAppItems bsr RemoveAppIcon ; Remove AppIcon-Stuff bsr RemoveConsole ; Remove Console-Device bsr RemoveAudio ; Remove Audio-Stuff bsr RemoveGfx ; Remove our gfx CALLSYS Permit ; So, that`s ok. bsr DeleteEnvs ; Remove environment vars tst.l MyDiskObj ; Got a Disk-Object ? beq.s .NoDiskObj move.l MyDiskObj,a0 ; release it LNKLIB FreeDiskObject,_IconBase .NoDiskObj tst.l WBMsg ; Got a workbench message ? beq.s .NoWBMsg CALLSYS Forbid move.l WBMsg,a1 DOLIB ReplyMsg ; Do a reply .NoWBMsg bsr RemoveMem ; Remove those needed resources bsr CloseLibs move.l (sp)+,d0 movem.l (sp)+,d1-d7/a0-a6 rts ********************************************************************** * Attempt to load the libs * ********************************************************************** OpenLibs move.l #0,ErrorNum lea IntName,a1 move.l a1,EasyArg move.l #NEED_LIBVER,d0 CALLSYS OpenLibrary tst.l d0 beq .LibError move.l d0,_IntuitionBase lea DosName,a1 move.l a1,EasyArg move.l #NEED_LIBVER,d0 DOLIB OpenLibrary tst.l d0 beq .LibError move.l d0,_DOSBase lea IconName,a1 move.l a1,EasyArg move.l #NEED_LIBVER,d0 DOLIB OpenLibrary tst.l d0 beq .LibError move.l d0,_IconBase lea ComName,a1 move.l a1,EasyArg move.l #NEED_LIBVER,d0 DOLIB OpenLibrary tst.l d0 beq .LibError move.l d0,_CxBase lea LayerName,a1 move.l a1,EasyArg move.l #NEED_LIBVER,d0 DOLIB OpenLibrary tst.l d0 beq .LibError move.l d0,_LayersBase lea GadName,a1 move.l a1,EasyArg moveq #NEED_LIBVER,d0 DOLIB OpenLibrary tst.l d0 beq.s .LibError move.l d0,_GadToolsBase lea GfxName,a1 move.l a1,EasyArg move.l #NEED_LIBVER,d0 DOLIB OpenLibrary tst.l d0 beq.s .LibError move.l d0,_GfxBase lea RexxSysName,a1 move.l a1,EasyArg move.l #0,d0 DOLIB OpenLibrary tst.l d0 beq.s .LibError move.l d0,_RexxSysBase lea AslName,a1 move.l a1,EasyArg move.l #NEED_LIBVER,d0 DOLIB OpenLibrary tst.l d0 beq.s .LibError move.l d0,_AslBase lea WBName,a1 move.l a1,EasyArg move.l #NEED_LIBVER,d0 DOLIB OpenLibrary move.l d0,_WorkBenchBase tst.l d0 beq.s .LibError .LibError rts ********************************************************************** * Close Libs again * ********************************************************************** CloseLibs tst.l _WorkBenchBase beq.s .NoWBBase move.l _WorkBenchBase,a1 CALLSYS CloseLibrary .NoWBBase tst.l _AslBase beq.s .NoAslBase move.l _AslBase,a1 CALLSYS CloseLibrary .NoAslBase tst.l _RexxSysBase beq.s .NoRexxSysBase move.l _RexxSysBase,a1 CALLSYS CloseLibrary .NoRexxSysBase tst.l _GfxBase beq.s .NoGfxBase move.l _GfxBase,a1 CALLSYS CloseLibrary .NoGfxBase tst.l _GadToolsBase beq.s .NoGadToolsBase move.l _GadToolsBase,a1 CALLSYS CloseLibrary .NoGadToolsBase tst.l _LayersBase beq.s .NoLayersBase move.l _LayersBase,a1 CALLSYS CloseLibrary .NoLayersBase tst.l _CxBase beq.s .NoCxBase move.l _CxBase,a1 CALLSYS CloseLibrary .NoCxBase tst.l _IconBase beq.s .NoIconBase move.l _IconBase,a1 CALLSYS CloseLibrary .NoIconBase tst.l _DOSBase beq.s .NoDosBase move.l _DOSBase,a1 CALLSYS CloseLibrary .NoDosBase tst.l _IntuitionBase beq.s .NoIntBase move.l _IntuitionBase,a1 CALLSYS CloseLibrary .NoIntBase rts ********************************************************************** * Initialize some structures from system-memory * ********************************************************************** InitMem move.l #18,ErrorNum ; A small dummy buffer move.l #AREXXBUFFSIZE,d0 move.l #MEMF_CLEAR|MEMF_PUBLIC,d1 CALLSYS AllocMem move.l d0,ARexxBuffer tst.l d0 beq.s .Error move.l #19,ErrorNum ; Timer Request move.l #IOTV_SIZE,d0 move.l #MEMF_CLEAR|MEMF_PUBLIC,d1 DOLIB AllocMem move.l d0,TimerReq tst.l d0 beq.s .Error move.l #20,ErrorNum ; Audio Request move.l #ioa_SIZEOF,d0 move.l #MEMF_CLEAR|MEMF_PUBLIC,d1 DOLIB AllocMem move.l d0,AudioReq tst.l d0 beq.s .Error move.l #21,ErrorNum ; Console Request move.l #IOSTD_SIZE,d0 move.l #MEMF_CLEAR|MEMF_PUBLIC,d1 DOLIB AllocMem move.l d0,ConsoleReq tst.l d0 beq.s .Error moveq #1,d0 .Error rts ********************************************************************** * Remove used resources * ********************************************************************** RemoveMem tst.l ConsoleReq beq.s .NoConsoleReq move.l ConsoleReq,a1 move.l #IOSTD_SIZE,d0 CALLSYS FreeMem .NoConsoleReq tst.l AudioReq beq.s .NoAudioReq move.l AudioReq,a1 move.l #ioa_SIZEOF,d0 CALLSYS FreeMem .NoAudioReq tst.l TimerReq beq.s .NoTimerReq move.l TimerReq,a1 move.l #IOTV_SIZE,d0 CALLSYS FreeMem .NoTimerReq tst.l ARexxBuffer beq.s .NoReadBuff move.l ARexxBuffer,a1 move.l #AREXXBUFFSIZE,d0 CALLSYS FreeMem .NoReadBuff rts ********************************************************************** * Init the Rastport for the title bar * ********************************************************************** InitGfx link a5,#-4 jsr LockScreen tst.l d0 beq .NoGfx move.l d0,a0 ; Get font for titlebar move.l sc_BarLayer(a0),a0 move.l lr_rp(a0),a0 move.l rp_Font(a0),a0 ; A0 = Font used in bar layer-rastport lea TxtAttr,a1 ; Store attributes of font move.l LN_NAME(a0),ta_Name(a1) moveq #0,d7 move.w tf_YSize(a0),d7 ; Get height of font move.w d7,ta_YSize(a1) ; and for bitplanes of title move.b tf_Style(a0),ta_Style(a1) move.b tf_Flags(a0),ta_Flags(a1) move.l -4(a5),a0 move.l sc_FirstWindow(a0),a0 move.l wd_RPort(a0),a0 ; Get depth of workbench move.l rp_BitMap(a0),a0 moveq #0,d0 move.b bm_Depth(a0),d0 move.w d0,BitMapDepth moveq #0,d1 move.l -4(a5),a0 move.w sc_Width(a0),d1 move.w d1,BitMapWidth ; Store sizes move.w d7,BitMapHeight ; To get the full width and height ; isn`t quite intelligent, but ; it doesn`t take too much memory. ; SO WHAT move.l #13,ErrorNum ; Get mem for BitMap move.l #bm_SIZEOF,d0 move.l #MEMF_PUBLIC|MEMF_CLEAR,d1 CALLSYS AllocMem move.l d0,MyBitMap tst.l d0 beq .NoGfx move.l #14,ErrorNum ; Get mem for RastPort move.l #rp_SIZEOF,d0 move.l #MEMF_PUBLIC|MEMF_CLEAR,d1 CALLSYS AllocMem move.l d0,MyRastPort tst.l d0 beq .NoGfx move.l MyBitMap,a0 ; Initialize our BitMap move.w BitMapDepth,d0 move.w BitMapWidth,d1 move.w BitMapHeight,d2 LNKLIB InitBitMap,_GfxBase move.l #7,ErrorNum move.l MyBitMap,a4 move.w bm_BytesPerRow(a4),d1 ; Get bytes per row mulu BitMapHeight,d1 move.l d1,BitMapSize ; Store size for one plane lea bm_Planes(a4),a4 ; Get address of Planes array move.w BitMapDepth,d7 ; Make all planes subq.w #1,d7 .MakeBitMaps move.l BitMapSize,d0 move.l #MEMF_CHIP|MEMF_CLEAR,d1 CALLSYS AllocMem tst.l d0 beq .NoGfx move.l d0,(a4)+ dbf d7,.MakeBitMaps move.l MyRastPort,a1 ; Init RPort LNKLIB InitRastPort,_GfxBase move.l MyRastPort,a1 move.l MyBitMap,a0 move.l a0,rp_BitMap(a1) ; Add pointer of BitMap to RPort moveq #1,d0 DOLIB SetRast ; Clear RPort move.l #8,ErrorNum lea TxtAttr,a0 ; Try to open font in RAM first DOLIB OpenFont move.l d0,MyFont tst.l d0 bne.s .GotFont lea DiskFontName,a1 ; If it failed try to open moveq #NEED_LIBVER,d0 ; diskfont.library CALLSYS OpenLibrary tst.l d0 beq .NoGfx ; If that also fails -> quit move.l d0,_DiskFontBase lea TxtAttr,a0 ; Try to get font from disk LNKLIB OpenDiskFont,_DiskFontBase move.l d0,MyFont tst.l d0 bne.s .GotDiskFont ; Ok -> go on move.l _DiskFontBase,a1 ; Close lib and quit CALLSYS CloseLibrary bra.s .NoGfx .GotDiskFont move.l _DiskFontBase,a1 ; Close lib CALLSYS CloseLibrary .GotFont move.l MyRastPort,a1 ; Set font for rastport move.l MyFont,a0 LNKLIB SetFont,_GfxBase move.l MyRastPort,a1 ; Set draw mode move.l #RP_JAM2,d0 DOLIB SetDrMd move.l MyRastPort,a1 ; Set back pen moveq #1,d0 DOLIB SetBPen move.l MyRastPort,a1 moveq #0,d0 DOLIB SetAPen move.l #MEMF_TOTAL,d1 ; Get total available mem CALLSYS AvailMem move.l d0,MaxMem moveq #1,d0 .NoGfx move.l d0,-(sp) bsr UnlockScreen move.l (sp)+,d0 unlk a5 rts ********************************************************************** * Removes the Gfx areas again * ********************************************************************** RemoveGfx bsr OnScreen ; UnBlank Screen bsr OnMouse ; UnBlank mouse bsr ClearTitleBar ; Clear title bar bsr CloseHotKeyWin ; Close HotKey window bsr CloseClockWin ; Close clock window bsr ClosePrefsWin ; Close preferences window bsr CloseOurWindow ; Close down the window tst.l MyFont ; Did we have a font beq.s .GotNoFont move.l MyFont,a1 ; Close font LNKLIB CloseFont,_GfxBase .GotNoFont tst.l MyRastPort ; Free rastport beq.s .GotNoRastPort move.l MyRastPort,a1 move.l #rp_SIZEOF,d0 CALLSYS FreeMem .GotNoRastPort tst.l MyBitMap beq.s .AllFreed move.l MyBitMap,a4 ; Free bitplanes of BitMap lea bm_Planes(a4),a4 move.w BitMapDepth,d7 subq.w #1,d7 .ClearBitPlanes move.l (a4)+,d0 beq.s .FreeBitMap move.l d0,a1 move.l BitMapSize,d0 CALLSYS FreeMem dbf d7,.ClearBitPlanes .FreeBitMap move.l MyBitMap,a1 ; Free bitmap move.l #bm_SIZEOF,d0 CALLSYS FreeMem .AllFreed rts ********************************************************************** * Initialize the timer device * ********************************************************************** InitTimer move.l #6,ErrorNum CALLSYS CreateMsgPort ; Try to create a msg port move.l d0,TimerPort tst.l d0 beq .NoTimer move.l d0,a1 moveq #1,d0 moveq #0,d1 move.b MP_SIGBIT(a1),d1 ; Get sig flag asl.l d1,d0 move.l d0,TimerSigFlag move.l #TimerPortName,LN_NAME(a1) move.b #0,LN_PRI(a1) DOLIB AddPort move.l #0,ErrorNum lea TimerName,a0 ; Try to open timer.device move.l a0,EasyArg move.l #UNIT_VBLANK,d0 move.l TimerReq,a1 move.l TimerPort,MN_REPLYPORT(a1) move.b #0,LN_PRI(a1) moveq #0,d1 DOLIB OpenDevice tst.l d0 beq.s .GotDevice moveq #0,d0 bra.s .NoTimer .GotDevice move.l TimerReq,a1 ; Set structure move.w #TR_ADDREQUEST,IO_COMMAND(a1) move.b #0,IO_FLAGS(a1) move.b #0,IO_ERROR(a1) move.l #0,IOTV_TIME+TV_SECS(a1) ; Set first timer amount move.l #1000,IOTV_TIME+TV_MICRO(a1) ; for task wakeup DOLIB SendIO moveq #1,d0 move.l #-1,ErrorNum .NoTimer rts ********************************************************************** * Remove timer device resources * ********************************************************************** RemoveTimer move.l TimerReq,a1 ; Did we have a device ? tst.l IO_DEVICE(a1) ble.s .NoTimerDevice move.l TimerReq,a1 ; Request still running ? CALLSYS AbortIO move.l TimerPort,a0 ; Wait for reply DOLIB WaitPort move.l TimerReq,a1 DOLIB CloseDevice ; Close it a fast as possible, so .NoTimerDevice tst.l TimerPort ; that no more msgs can arrive beq.s .NoTimerPort move.l TimerPort,a1 CALLSYS RemPort ; Remove port from system move.l TimerPort,a0 DOLIB DeleteMsgPort .NoTimerPort rts ********************************************************************** * Open Up console device for RAWKEYCONVERT * ********************************************************************** InitConsole move.l #0,ErrorNum lea ConsoleName,a0 move.l a0,EasyArg move.l #CONU_LIBRARY,d0 ; We don`t need no unit move.l ConsoleReq,a1 move.l #0,d1 CALLSYS OpenDevice tst.l d0 bne.s .ConsoleError move.l ConsoleReq,a1 move.l IO_DEVICE(a1),_ConsoleBase ; Get base moveq #1,d0 rts .ConsoleError moveq #0,d0 rts ********************************************************************** * Close ConsoleDevice again * ********************************************************************** RemoveConsole move.l ConsoleReq,a1 tst.l IO_DEVICE(a1) ble.s .Error CALLSYS CloseDevice .Error rts ********************************************************************** * Init Audio-Datas * ********************************************************************** InitAudio move.l #15,ErrorNum CALLSYS CreateMsgPort ; Create port move.l d0,AudioPort tst.l d0 beq .AudioError move.l d0,a1 move.b MP_SIGBIT(a1),d0 ; Get sigmask move.l #AudioPortName,LN_NAME(a1) move.b #0,LN_PRI(a1) DOLIB AddPort move.l #0,ErrorNum lea AudioName,a0 move.l a0,EasyArg move.l #0,d0 move.l AudioReq,a1 move.w #0,ioa_AllocKey(a1) move.l #0,ioa_Data(a1) move.l #0,ioa_Length(a1) move.l AudioPort,MN_REPLYPORT(a1) move.b #50,LN_PRI(a1) move.l #0,d1 DOLIB OpenDevice ; Open device tst.l d0 bne.s .AudioError move.l #16,ErrorNum bsr.s AllocChannel ; Try to allocate a channel tst.l d0 bne.s .GoOn bsr DisplayError ; Display error on failure .GoOn move.l #17,ErrorNum move.l AudioReq,a1 ; Initial soundwrite for setup move.w #CMD_WRITE,IO_COMMAND(a1) move.b #ADIOF_PERVOL|ADIOF_NOWAIT,IO_FLAGS(a1) move.w #150,ioa_Period(a1) move.w #0,ioa_Volume(a1) move.l #88,ioa_Length(a1) move.l #ClickData,ioa_Data(a1) move.w #1,ioa_Cycles(a1) move.l IO_DEVICE(a1),a6 jsr DEV_BEGINIO(a6) move.l AudioReq,a1 CALLSYS WaitIO moveq #1,d0 rts .AudioError moveq #0,d0 rts ********************************************************************** * Try to allocate a channel * ********************************************************************** AllocChannel move.l AudioReq,a1 move.w #ADCMD_ALLOCATE,IO_COMMAND(a1) move.b #ADIOF_NOWAIT|IOF_QUICK,IO_FLAGS(a1) move.l #AnyChannel,ioa_Data(a1) move.l #8,ioa_Length(a1) move.l IO_DEVICE(a1),a6 jsr DEV_BEGINIO(a6) move.l AudioReq,a1 move.w ioa_AllocKey(a1),AllocKey tst.b IO_ERROR(a1) beq.s .NoError move.w #0,AllocKey ; On error clear the allockey moveq #0,d0 move.b d0,KeyClick ; ... the click function move.l #CLICKGAD,d1 ; and the gadget tick bsr SetControlBox moveq #0,d0 rts .NoError moveq #1,d0 rts ********************************************************************** * Remove Audio-Stuff * ********************************************************************** RemoveAudio move.l AudioReq,a1 tst.l IO_DEVICE(a1) ble.s .NoAudioDevice move.l AudioReq,a1 ; Wait for request to be finished CALLSYS AbortIO move.l AudioReq,a1 ; Close device DOLIB CloseDevice .NoAudioDevice tst.l AudioPort ; Remove port beq.s .NoAudioPort move.l AudioPort,a1 CALLSYS RemPort move.l AudioPort,a0 DOLIB DeleteMsgPort .NoAudioPort rts ********************************************************************** * Initialize the ARexx Port * ********************************************************************** InitARexx move.l #11,ErrorNum CALLSYS CreateMsgPort ; Create a Msg Port for ARexx move.l d0,ARexxPort tst.l d0 beq.s .ARexxError move.l d0,a1 moveq #0,d0 moveq #1,d1 move.b MP_SIGBIT(a1),d0 ; Get Sig flag asl.l d0,d1 move.l d1,ARexxSigFlag lea ARexxPortName,a0 move.l a0,LN_NAME(a1) move.b #0,LN_PRI(a1) DOLIB AddPort ; Add port to system moveq #1,d0 move.l #-1,ErrorNum .ARexxError rts ********************************************************************** * Remove our ARexx port from System * ********************************************************************** RemoveARexx tst.l ARexxPort beq.s .NoARexxPort move.l ARexxPort,a1 bsr KillMessages ; Kill remaining messages CALLSYS RemPort ; Remove port move.l ARexxPort,a0 DOLIB DeleteMsgPort .NoARexxPort rts ********************************************************************** * Initialize and start broker * ********************************************************************** InitBroker bsr RemoveBroker ; Begin from scratch move.l #-1,d0 ; Try to allocate signal for CALLSYS AllocSignal ; alarm move.l d0,AlarmSigBit tst.l d0 blt .NoBroker moveq #1,d1 asl.l d0,d1 move.l d1,AlarmSigFlag move.l #-1,d0 ; Try to allocate signal for DOLIB AllocSignal ; Help move.l d0,HelpSigBit tst.l d0 blt .NoBroker moveq #1,d1 asl.l d0,d1 move.l d1,HelpSigFlag lea PortName,a1 ; Find port name CALLSYS FindPort ; This is for identification move.l d0,DoublePort ; whether we are to quit move.l OurTask,a1 ; We have to be faster than move.l ToolPri,d0 ; the Input-Device CALLSYS SetTaskPri move.l d0,OldPri move.l #1,ErrorNum DOLIB CreateMsgPort ; Try to set msg-port move.l d0,BrokerPort tst.l d0 beq .NoBroker move.l d0,a1 moveq #1,d0 moveq #0,d1 move.b MP_SIGBIT(a1),d1 asl.l d1,d0 move.l d0,BrokerSigFlag ; Calc sig-flag lea PortName,a0 move.l a0,LN_NAME(a1) move.b #0,LN_PRI(a1) DOLIB AddPort ; Add port to system move.l #2,ErrorNum lea MyBrokerDef,a0 ; Create broker move.l BrokerPort,nb_Port(a0) ; add Port-Address move.l CXPri,d0 move.b d0,nb_Pri(a0) ; and Priority moveq #0,d0 ; No errors LNKLIB CxBroker,_CxBase ; install broker structure tst.l d0 beq .NoBroker move.l d0,MyBroker move.l #3,ErrorNum ; Generate CUSTOM object lea RawEventAction(pc),a5 ; for Input-Events move.l #RAWEVENTID,d7 bsr InitCustom tst.l d0 beq .NoBroker move.l a4,EventFilter pea 9 ; Set PopUp key pea PopUpFilter pea POPUPKEYID pea DefaultPopUpKey pea PopUpKey jsr SetHotKey lea 20(sp),sp tst.l d0 beq .NoBroker pea 10 ; Set Page-Key pea PageFilter pea PAGEKEYID pea DefPageHotKey pea PageHotKey jsr SetHotKey lea 20(sp),sp tst.l d0 beq .NoBroker pea 22 ; Set prefs hotkey pea PrefsFilter pea PREFSKEYID pea DefPrefsHotKey pea PrefsHotKey jsr SetHotKey lea 20(sp),sp tst.l d0 beq .NoBroker pea 23 ; Set bill hotkey pea BillFilter pea BILLKEYID pea DefBillHotKey pea BillHotKey jsr SetHotKey lea 20(sp),sp tst.l d0 beq .NoBroker pea 24 ; Set HotWin hotkey pea HotKeyFilter pea HOTWINKEYID pea DefHotWinHotKey pea HotWinHotKey jsr SetHotKey lea 20(sp),sp tst.l d0 beq .NoBroker pea 25 ; Set Shell HotKey pea ShellFilter pea SHELLKEYID pea DefShellHotKey pea ShellHotKey jsr SetHotKey lea 20(sp),sp tst.l d0 beq.s .NoBroker pea 27 ; Set Umlaut HotKey pea UmlautFilter pea UMLAUTKEYID pea DefUmlautHK pea UmlautHotKey jsr SetHotKey lea 20(sp),sp tst.l d0 beq.s .NoBroker move.l #4,ErrorNum move.l EventFilter,a0 ; Check for an error in filter DOLIB CxObjError,_CxBase ; For activation stuff tst.l d0 bne.s .NoBroker move.l #5,ErrorNum move.l MyBroker,a0 ; Check for an error in broker DOLIB CxObjError,_CxBase tst.l d0 bne.s .NoBroker bsr DisableBroker ; Enable broker moveq #1,d0 ; No error rts .NoBroker moveq #0,d0 ; error occured rts ********************************************************************** * Remove the broker * ********************************************************************** RemoveBroker tst.l BrokerPort ; Remove broker and all beq.s .NoPort ; attached objects move.b #0,Disabled ; Disable broker bsr DisableBroker move.l MyBroker,a0 ; Delete broker LNKLIB DeleteCxObjAll,_CxBase move.l BrokerPort,a1 bsr KillMessages ; remove messages CALLSYS RemPort move.l BrokerPort,a0 ; Finally delete the DOLIB DeleteMsgPort ; Messageport .NoPort tst.l AlarmSigBit blt.s .NoSigBit move.l AlarmSigBit,d0 CALLSYS FreeSignal ; Free Help-Signal .NoSigBit tst.l HelpSigBit blt.s .NoHelpSig move.l HelpSigBit,d0 CALLSYS FreeSignal .NoHelpSig move.l OurTask,a1 ; Reset old Task-Pri move.l OldPri,d0 ; Necessary when launched from CLI CALLSYS SetTaskPri rts ********************************************************************** * Add an AppIcon. This one uses the Broker-Port * ********************************************************************** InitAppIcon move.l #22,ErrorNum ; Create a Msg-Port CALLSYS CreateMsgPort tst.l d0 beq.s .Error move.l d0,AppPort move.l d0,a1 move.b #0,LN_PRI(a1) move.l #AppPortName,LN_NAME(a1) moveq #0,d0 moveq #1,d1 move.b MP_SIGBIT(a1),d0 asl.l d0,d1 move.l d1,AppSigFlag ; Get SigFlag moveq #1,d0 moveq #0,d1 DOLIB AddPort moveq #1,d0 tst.b DispAppIcon beq.s .End move.l #22,ErrorNum lea AppIconText,a0 ; Display AppIcon move.l AppPort,a1 sub.l a2,a2 lea KCXAppIconDef,a3 sub.l a4,a4 LNKLIB AddAppIconA,_WorkBenchBase move.l d0,KCXAppIcon tst.l d0 bne.s .End .Error bsr DisplayError .End rts ********************************************************************** * Remove our AppIcon * ********************************************************************** RemoveAppIcon tst.l KCXAppIcon ; First remove icon beq.s .NoIcon move.l KCXAppIcon,a0 LNKLIB RemoveAppIcon,_WorkBenchBase move.l #0,KCXAppIcon .NoIcon tst.l AppPort beq.s .NoPort move.l AppPort,a1 ; Clear all pending messages bsr KillMessages move.l AppPort,a1 ; Remove port CALLSYS RemPort move.l AppPort,a0 DOLIB DeleteMsgPort .NoPort rts ********************************************************************** * Add some menu items to the tools menu * ********************************************************************** InitAppItem move.l #MAINITEM,d0 ; Create an item move.l #0,d1 lea AppMenuTxt,a0 move.l AppPort,a1 sub.l a2,a2 LNKLIB AddAppMenuItemA,_WorkBenchBase move.l d0,KCXAppMenuItem tst.l d0 bne.s .End move.l #23,ErrorNum bsr DisplayError .End rts ********************************************************************** * Remove our menu items again * ********************************************************************** RemoveAppItems tst.l KCXAppMenuItem beq.s .NoRemove move.l KCXAppMenuItem,a0 LNKLIB RemoveAppMenuItem,_WorkBenchBase .NoRemove rts ********************************************************************** * Try to set a hotkey. Inputs are given on stack : * * 1. HotKey Definition * * 2. Default HotKey Definition * * 3. HotKey ID * * 4. Address of filter * * 5. Errornumber * ********************************************************************** SetHotKey CARGS #8,HotKey.l,DefHotKey.l,ID.l,Filter.l,Error.l link a5,#-HOTKEYSIZE move.l #26,ErrorNum move.l HotKey(a5),EasyArg move.l HotKey(a5),a0 ; Try to set "user" hotkey move.l ID(a5),d7 bsr.s InitHotKey tst.l d0 bne.s .GotUserHotKey ; Got it -> go on move.l HotKey(a5),a0 ; Clone user-hotkey lea -HOTKEYSIZE(a5),a1 bsr StrCpy move.l DefHotKey(a5),a0 ; Try default move.l HotKey(a5),a1 bsr StrCpy ; First copy it move.l DefHotKey(a5),a0 move.l ID(a5),d7 bsr.s InitHotKey tst.l d0 bne.s .GotDefHotKey ; Error ??? bsr DisplayError ; Display error bra.s .Error .GotDefHotKey move.l Error(a5),ErrorNum ; Tell user we`re using ours lea -HOTKEYSIZE(a5),a0 move.l a0,EasyArg bsr DisplayError .GotUserHotKey move.l Filter(a5),a0 move.l a4,(a0) move.l MyBroker,a0 move.l a4,a1 LNKLIB AttachCxObj,_CxBase ; Attach hotkey stuff unlk a5 moveq #1,d0 rts .Error unlk a5 moveq #0,d0 rts ********************************************************************** * Try to create a hotkey * ********************************************************************** InitHotKey move.l #CX_FILTER,d0 ; Try to create the hotkey sub.l a1,a1 DOLIB CreateCxObj,_CxBase ; Create a filter for descriptive string tst.l d0 beq.s .Error move.l d0,a4 moveq #CX_SEND,d0 move.l BrokerPort,a0 move.l d7,a1 ; Set ID for HotKey DOLIB CreateCxObj,_CxBase ; Create a SENDER object to our port move.l a4,a0 move.l d0,a1 DOLIB AttachCxObj,_CxBase ; Attach it to the filter moveq #CX_TRANSLATE,d0 sub.l a0,a0 move.l a0,a1 DOLIB CreateCxObj,_CxBase ; Create a translator for msg move.l a4,a0 move.l d0,a1 DOLIB AttachCxObj,_CxBase ; Attach it move.l a4,a0 DOLIB CxObjError,_CxBase ; Any errors ?? tst.l d0 beq.s .GotHotKey ; Nope -> go on move.l a4,a0 DOLIB DeleteCxObjAll,_CxBase ; Delete hotkey .Error moveq #0,d0 rts .GotHotKey moveq #1,d0 rts **********+*********************************************************** * Try to initialize a CUSTOM-Filter * ********************************************************************** InitCustom move.l #CX_FILTER,d0 ; Install a Commodities-Object sub.l a0,a0 ; which works as a filter sub.l a1,a1 ; for Input-Events DOLIB CreateCxObj tst.l d0 beq.s .End move.l d0,a4 move.l MyBroker,a0 ; Attach Filter to Broker move.l a4,a1 DOLIB AttachCxObj move.l a4,a0 ; Init Filter with values lea MyCustomIXDef,a1 DOLIB SetFilterIX move.l #CX_CUSTOM,d0 ; Create signal-object move.l a5,a0 move.l d7,a1 DOLIB CreateCxObj tst.l d0 beq.s .End move.l a4,a0 ; Attach new object move.l d0,a1 DOLIB AttachCxObj .End rts ********************************************************************** * Copy default hotkeys to "user" buffers * ********************************************************************** MakeHotKeys lea DefaultPopUpKey,a0 lea PopUpKey,a1 bsr StrCpy lea DefPageHotKey,a0 lea PageHotKey,a1 bsr StrCpy lea DefPrefsHotKey,a0 lea PrefsHotKey,a1 bsr StrCpy lea DefBillHotKey,a0 lea BillHotKey,a1 bsr StrCpy lea DefHotWinHotKey,a0 lea HotWinHotKey,a1 bsr StrCpy lea DefShellHotKey,a0 lea ShellHotKey,a1 bsr StrCpy lea DefUmlautHK,a0 lea UmlautHotKey,a1 bsr StrCpy rts ********************************************************************** * Get the given tooltypes * ********************************************************************** GetToolTypes tst.l MyToolTypes bne.s .GoOn rts .GoOn move.l MyToolTypes,a0 lea ToolPriStr,a1 ; Change Tool-Pri ? LNKLIB FindToolType,_IconBase tst.l d0 beq.s .NoToolPri ; No -> go on move.l d0,d1 move.l #ToolPri,d2 LNKLIB StrToLong,_DOSBase tst.l d0 bge.s .NoToolPri move.l #0,ToolPri .NoToolPri move.l MyToolTypes,a0 lea PriStr,a1 ; Change broker pri ? LNKLIB FindToolType,_IconBase tst.l d0 beq.s .NoCxPri ; No -> go on move.l d0,d1 move.l #CXPri,d2 LNKLIB StrToLong,_DOSBase ; Set pri tst.l d0 bge.s .NoCxPri move.l #0,CXPri .NoCxPri move.l MyToolTypes,a0 lea PortNameStr,a1 LNKLIB FindToolType,_IconBase ; New ARexx-PortName ? tst.l d0 beq.s .NoPortName move.l d0,a0 lea ARexxPortName,a1 moveq #15,d7 ; Copy only 16 Chars bsr StrNCpy .NoPortName move.l MyToolTypes,a0 lea KeyStr,a1 DOLIB FindToolType ; Do we have a new pop up key ? tst.l d0 beq.s .NoPopKey ; Nope -> go on move.l d0,a0 lea PopUpKey,a1 ; Copy PopUpKey bsr StrCpy .NoPopKey move.l MyToolTypes,a0 ; Check for PopUp flag lea PopUpStr,a1 DOLIB FindToolType tst.l d0 beq.s .DoNotPopUp move.l d0,a0 ; Do we have a NO flag lea NoString,a1 DOLIB MatchToolValue tst.l d0 beq.s .DoNotPopUp move.b #0,DoPopUp ; Let the window pop up .DoNotPopUp move.l MyToolTypes,a0 ; Display AppIcon ? lea IconStr,a1 DOLIB FindToolType tst.l d0 beq.s .NoAppIcon move.b #0,DispAppIcon .NoAppIcon rts ********************************************************************** * Parse the command line * ********************************************************************** GetCommandLine move.l #((HELP_ARG+1)*4),d0 ; Get buffer for parsed arguments move.l #MEMF_CLEAR|MEMF_PUBLIC,d1 CALLSYS AllocVec move.l d0,Args moveq #0,d7 move.l #12,ErrorNum ; Set Errornumber tst.l d0 beq .NoCommand move.l #CLITemplate,d1 ; Parse commandline move.l Args,d2 moveq #0,d3 LNKLIB ReadArgs,_DOSBase move.l d0,MyRDArgs moveq #0,d7 move.l #12,ErrorNum ; Set errornumber tst.l d0 beq .NoCommand move.l Args,a5 ; Now check args tst.l (CXPRI_ARG*4)(a5) ; Get Priority for broker ? beq.s .NoCxPri move.l (CXPRI_ARG*4)(a5),a0 move.l (a0),CXPri .NoCxPri tst.l (CXKEY_ARG*4)(a5) ; New PopKey ??? beq.s .NoCxKey move.l (CXKEY_ARG*4)(a5),a0 lea PopUpKey,a1 bsr StrCpy .NoCxKey tst.l (CXPOP_ARG*4)(a5) ; Do popup ??? beq.s .CxPopUp move.l (CXPOP_ARG*4)(a5),a0 lea NoString,a1 moveq #-1,d7 bsr StrCmp tst.l d0 bne.s .CxPopUp move.b #0,DoPopUp ; Clear flag .CxPopUp tst.l (PORT_ARG*4)(a5) ; New Portname ??? beq.s .NoPortName move.l (PORT_ARG*4)(a5),a0 lea ARexxPortName,a1 moveq #15,d7 ; Only 16 chars allowed bsr StrNCpy .NoPortName tst.l (PRGPRI_ARG*4)(a5) ; New toolpri ??? beq.s .NoToolPri move.l (PRGPRI_ARG*4)(a5),a0 move.l (a0),d0 move.l d0,ToolPri .NoToolPri tst.l (ICON_ARG*4)(a5) ; Display Icon ??? beq.s .Icon move.b #0,DispAppIcon .Icon tst.l (HELP_ARG*4)(a5) ; Display Help ??? beq.s .NoCommand LNKLIB Output,_DOSBase move.l d0,d1 move.l #CliHelpPage,d2 move.l #CliHelpPageLen,d3 DOLIB Write moveq #0,d7 move.l #-1,ErrorNum bra.s .HelpDone .NoCommand moveq #1,d7 .HelpDone tst.l MyRDArgs beq.s .NoRDArgs move.l MyRDArgs,d1 ; Free structure passed by ReadArgs() LNKLIB FreeArgs,_DOSBase .NoRDArgs tst.l Args beq.s .NoArgs move.l Args,a1 ; Free Vector-Table CALLSYS FreeVec .NoArgs rts ********************************************************************** * Try to read in the default PrefsFile * ********************************************************************** LoadPrefs move.l #LOADBUFFSIZE,d0 move.l #MEMF_CLEAR|MEMF_PUBLIC,d1 CALLSYS AllocMem move.l d0,LoadBuffer tst.l d0 bne.s .GoOn move.l #12,ErrorNum bsr DisplayError rts .GoOn move.l #PrefsFileName,d1 ; Try to open file move.l d1,EasyArg move.l #MODE_OLDFILE,d2 LNKLIB Open,_DOSBase move.l d0,d7 tst.l d0 beq .AOk move.l d7,d1 ; Read flags move.l #DoActivate,d2 move.l #FLAGSET,d3 DOLIB Read cmp.l #FLAGSET,d0 bne .AOk move.l d7,d1 move.l #ScreenTime,d2 move.l #LONGQUAL,d3 DOLIB Read cmp.l #LONGQUAL,d0 bne .AOk lea WindowDefs,a4 ; Read in window positions .ReadWinPos tst.l (a4) beq.s .NoMorePos move.l d7,d1 ; Read bill win pos move.l (a4)+,a0 lea nw_LeftEdge(a0),a0 move.l a0,d2 move.l #4,d3 DOLIB Read cmp.l #4,d0 bne .AOk bra .ReadWinPos .NoMorePos move.l d7,d1 ; Read in rest move.l LoadBuffer,d2 move.l #$FFFFFF,d3 DOLIB Read tst.l d0 ble .AOk lea HotKeyGadStat,a4 ; Copy new HotKeys move.l LoadBuffer,a0 move.l #6,d6 .NewHotKeys move.l (a4)+,a1 bsr StrCpy dbf d6,.NewHotKeys lea SystemParam,a1 ; Copy new Shell-Command bsr StrCpy lea AlarmStartVal,a1 ; Copy new alarm time bsr StrCpy lea LogFileName,a1 ; Copy full name to buffer bsr StrCpy move.l a0,a4 ; Store pointer to values lea LogFileName,a0 ; Extract dir name sub.l a2,a2 .ExtractFile tst.b (a0) beq.s .FileEnd cmp.b #':',(a0) beq.s .GotDir cmp.b #'/',(a0) bne.s .NoDir .GotDir move.l a0,a2 ; Store pointer to last dir symbol .NoDir addq.l #1,a0 bra.s .ExtractFile .FileEnd cmp.l #0,a2 ; Dir symbol found ? beq.s .NoPath ; Nope -> go on move.b 1(a2),d6 ; Store char move.b #0,1(a2) ; Set end of dir name lea LogFileName,a0 ; Copy dir name lea LogPath,a1 bsr StrCpy move.b d6,1(a2) ; Restore file name bra.s .EndDir .NoPath move.b #0,LogPath ; No dir name given .EndDir lea 1(a2),a0 ; Copy filename lea LogFile,a1 bsr StrCpy move.l a4,a0 lea CostUnit1,a1 ; Copy values move.l #27,d6 .CopyRest move.b (a0)+,(a1)+ dbf d6,.CopyRest lea PTimeZone,a1 ; Copy timezone and tariff move.l #7,d6 .CopyModes move.b (a0)+,(a1)+ dbf d6,.CopyModes lea FileReqWidth,a1 ; Copy width and height of filereq lea FileReqHeight,a2 lea 4(a0),a3 move.l #3,d6 .CopySize move.b (a0)+,(a1)+ move.b (a3)+,(a2)+ dbf d6,.CopySize lea 4(a0),a0 lea FileReqLeft,a1 ; Copy position of filereq lea FileReqTop,a2 lea 4(a0),a3 move.l #3,d6 .CopyPos move.b (a0)+,(a1)+ move.b (a3)+,(a2)+ dbf d6,.CopyPos .AOk tst.l d7 ; Close file beq .End move.l d7,d1 LNKLIB Close,_DOSBase bsr RemakeGadgets ; Remake checkboxes move.l #FRONTGAD,d0 ; Remake POP qualifier lea ControlGads,a0 move.l WndHandle,a1 move.l PopQualNum,d1 lea PopQualList,a2 bsr SetCycleGad move.l #ESCQUALGAD,d0 ; Remake close qualifier move.l ESCQualNum,d1 lea ControlGads,a0 move.l WndHandle,a1 lea ESCQualList,a2 bsr SetCycleGad move.l #SCREENGAD,d0 ; Remake screentime gadget lea ControlGads,a0 move.l WndHandle(pc),a1 move.l #3,d1 move.l ScreenTime,d2 bsr SetIntegerGad move.l #MOUSEGAD,d0 ; Remake mousetime gadget lea ControlGads,a0 move.l WndHandle,a1 moveq #3,d1 move.l MouseTime,d2 bsr SetIntegerGad move.l #VOLGAD,d0 ; Remake volume gadget lea ControlGads,a0 move.l WndHandle,a1 moveq #2,d1 move.l ClickVol,d2 bsr SetIntegerGad lea CostUnit1,a3 ; Remake these 6 cost gadgets moveq #1,d7 moveq #5,d6 .RemakeCosts move.l d7,d0 lea PrefsGads,a0 move.l PrefsHandle,a1 moveq #4,d1 move.l (a3)+,d2 addq.l #1,d7 bsr SetIntegerGad dbf d6,.RemakeCosts move.l #COSTGAD,d0 ; Remake cost/unit gad lea PrefsGads,a0 move.l PrefsHandle,a1 moveq #4,d1 move.l CostUnit,d2 bsr SetIntegerGad move.l #LOGFILEGAD,d0 ; Remake Log-FileName lea PrefsGads,a0 move.l PrefsHandle,a1 move.l #286,d1 lea LogFileName,a2 bsr SetStringGad move.l #PTIMEGAD,d1 ; Set Prefs time gad lea PrefsGads,a0 move.l PrefsHandle,a1 move.l PTimeZone,d0 lea PrefsTimeLabels,a2 bsr SetMXGad move.l #PMODEGAD,d1 ; Set Prefs mode gad lea PrefsGads,a0 move.l PrefsHandle,a1 move.l PTariff,d0 lea PrefsModeLabels,a2 bsr SetMXGad move.l #BILLPOPGAD,d1 ; Set POPUP gadget lea PrefsGads,a0 move.l PrefsHandle,a1 move.b BillPopUp,d0 bsr SetCheckBox move.l #LOGCALLGAD,d1 ; Set LogCalls gadget lea PrefsGads,a0 move.l PrefsHandle,a1 move.b LogCalls,d0 bsr SetCheckBox move.b #1,DoRemakeCosts bsr RemakeCosts ; Remake costs to new values move.l LoadBuffer,a3 ; Remake new HotKeys move.l #POPUPGAD,d7 move.l HotKeyHandle,a0 lea HotWinTitle,a1 move.l PopUpFilter,a4 lea PopUpKey,a5 bsr RemakeHotKey move.l a3,a0 bsr StrLen lea 1(a3,d0),a3 move.l #PAGEGAD,d7 sub.l a0,a0 sub.l a1,a1 move.l PageFilter,a4 lea PageHotKey,a5 bsr RemakeHotKey move.l a3,a0 bsr StrLen lea 1(a3,d0),a3 move.l #BILLKEYGAD,d7 move.l BillHandle,a0 lea BillTitle,a1 move.l BillFilter,a4 lea BillHotKey,a5 bsr RemakeHotKey move.l a3,a0 bsr StrLen lea 1(a3,d0),a3 move.l #PREFSKEYGAD,d7 move.l PrefsHandle,a0 lea PrefsTitle,a1 move.l PrefsFilter,a4 lea PrefsHotKey,a5 bsr RemakeHotKey move.l a3,a0 bsr StrLen lea 1(a3,d0),a3 move.l #HOTKEYGAD,d7 move.l HotKeyHandle,a0 lea HotWinTitle,a1 move.l HotKeyFilter,a4 lea HotWinHotKey,a5 bsr RemakeHotKey move.l a3,a0 bsr StrLen lea 1(a3,d0),a3 move.l #SHELLGAD,d7 sub.l a0,a0 sub.l a1,a1 move.l ShellFilter,a4 lea ShellHotKey,a5 bsr RemakeHotKey move.l a3,a0 bsr StrLen lea 1(a3,d0),a3 move.l #UMLAUTKEYGAD,d7 sub.l a0,a0 sub.l a1,a1 move.l UmlautFilter,a4 lea UmlautHotKey,a5 bsr RemakeHotKey move.l a3,a0 bsr StrLen lea 1(a3,d0),a3 move.l #USERSHELLGAD,d0 ; Remake shell command lea ControlGads,a0 move.l WndHandle,a1 move.l #64,d1 lea SystemParam,a2 bsr SetStringGad tst.l BillHandle beq.s .NoBillRePos lea BillWinDef,a1 move.w nw_LeftEdge(a1),d0 move.w nw_TopEdge(a1),d1 move.l BillHandle,a0 move.w wd_Width(a0),d2 move.w wd_Height(a0),d3 LNKLIB ChangeWindowBox,_IntuitionBase .NoBillRePos tst.l ClockHandle beq.s .End lea ClockWinDef,a1 move.w nw_LeftEdge(a1),d0 move.w nw_TopEdge(a1),d1 move.l ClockHandle,a0 move.w wd_Width(a0),d2 move.w wd_Height(a0),d3 LNKLIB ChangeWindowBox,_IntuitionBase .End tst.l LoadBuffer beq.s .NoBuff move.l LoadBuffer,a1 move.l #LOADBUFFSIZE,d0 CALLSYS FreeMem .NoBuff rts ********************************************************************** * Save preferences to disk * ********************************************************************** SavePrefs move.l #PrefsFileName,d1 ; Write new prefs to file move.l d1,EasyArg move.l #MODE_NEWFILE,d2 LNKLIB Open,_DOSBase move.l d0,d7 tst.l d0 beq .Error move.l d7,d1 move.l #DoActivate,d2 ; Write bool-flags move.l #FLAGSET,d3 DOLIB Write cmp.l #FLAGSET,d0 blt .Error move.l d7,d1 move.l #ScreenTime,d2 ; Long values move.l #LONGQUAL,d3 DOLIB Write cmp.l #LONGQUAL,d0 blt .Error lea WindowDefs,a4 .WriteWinPos tst.l (a4) beq.s .NoMorePos move.l (a4)+,a0 ; Store pos of window lea nw_LeftEdge(a0),a0 move.l d7,d1 move.l a0,d2 move.l #4,d3 DOLIB Write cmp.l #4,d0 blt .Error bra.s .WriteWinPos .NoMorePos lea HotKeyGadStat,a4 ; Store HotKeys moveq #6,d5 .WriteHotKeys move.l d7,d1 move.l (a4)+,a0 bsr StrLen move.l a0,d2 move.l d0,d3 addq.l #1,d3 move.l d3,d6 DOLIB Write cmp.l d6,d0 bne .Error dbf d5,.WriteHotKeys move.l d7,d1 ; Write NewShell command lea SystemParam,a0 bsr StrLen move.l a0,d2 move.l d0,d3 addq.l #1,d3 move.l d3,d6 DOLIB Write cmp.l d6,d0 bne .Error move.l d7,d1 ; Write Alarm time lea AlarmStartVal,a0 bsr StrLen move.l a0,d2 move.l d0,d3 addq.l #1,d3 move.l d3,d6 DOLIB Write cmp.l d6,d0 bne .Error move.l d7,d1 lea LogFileName,a0 ; Write filename for LogFile bsr StrLen move.l d0,d3 move.l d0,d6 addq.l #1,d3 move.l a0,d2 DOLIB Write cmp.l d6,d0 blt .Error move.l d7,d1 move.l #CostUnit1,d2 ; Write new settings move.l #28,d3 DOLIB Write cmp.l #28,d0 blt.s .Error move.l d7,d1 move.l #PTimeZone,d2 ; Write timezone and tariff move.l #8,d3 DOLIB Write cmp.l #8,d0 blt.s .Error move.l d7,d1 move.l #FileReqWidth,d2 ; Write FileReq-Width move.l #4,d3 DOLIB Write cmp.l #4,d0 blt.s .Error move.l d7,d1 move.l #FileReqHeight,d2 ; Write FileReq-Height move.l #4,d3 DOLIB Write cmp.l #4,d0 blt.s .Error move.l d7,d1 move.l #FileReqLeft,d2 ; Write FileReq-LeftEdge move.l #4,d3 DOLIB Write cmp.l #4,d0 blt.s .Error move.l d7,d1 move.l #FileReqTop,d2 ; Write FileReq-TopEdge move.l #4,d3 DOLIB Write cmp.l #4,d0 blt.s .Error bra.s .AOk .Error DOLIB IoErr ; Error occured ? move.l d0,ErrorNum move.l d7,-(sp) bsr DisplayError move.l (sp)+,d7 .AOk tst.l d7 beq.s .End move.l d7,d1 ; Close file LNKLIB Close,_DOSBase .End rts ********************************************************************** * This routine initializes the process to handle all timer events * ********************************************************************** InitChecker move.l #CheckerTags,d1 ; Start Process with tags LNKLIB CreateNewProc,_DOSBase tst.l d0 beq.s .Error move.l #SIGHANDSHAKE,d0 ; Wait for reply CALLSYS Wait .Error rts ********************************************************************** * Install the ARexx-Process * ********************************************************************** InitRexxProc move.l #RexxTags,d1 ; Start Process LNKLIB CreateNewProc,_DOSBase tst.l d0 beq.s .Error move.l #SIGHANDSHAKE,d0 ; Wait for reply CALLSYS Wait .Error rts ********************************************************************** * This is the small process to handle timer events * ********************************************************************** TimeChecker movem.l RegsAll,-(sp) bsr InitTimer ; Init timer tst.l d0 beq CheckerError move.l OurTask,a1 ; Signal mother move.l #SIGHANDSHAKE,d0 CALLSYS Signal sub.l a1,a1 CALLSYS FindTask move.l d0,CheckerProc .Loop move.l TimerSigFlag(pc),d0 ; Wait for signal of timer or.l #SIGHANDSHAKE,d0 ; for signal to go away or.l #SIGTIMEREMAKE,d0 ; for signal to remake display or.l #SIGBILLWIN,d0 ; pop up bill window or.l BillSigFlag(pc),d0 ; message from bill window or.l ClockSigFlag(pc),d0 ; message from clock window CALLSYS Wait move.l d0,CheckerProcSig move.l CheckerProcSig(pc),d0 ; Are we to go away ? and.l #SIGHANDSHAKE,d0 bne CheckerError ; Yep -> do so move.l CheckerProcSig(pc),d0 ; Signal of timer device ? and.l TimerSigFlag(pc),d0 beq.s .NoTimerMsg move.l TimerPort(pc),a0 ; Get message pending CALLSYS GetMsg bsr SetTime ; Set new time bsr CheckOnline ; Set new online time move.l TimerReq(pc),a1 ; Reset timer for wakeup move.l #1,IOTV_TIME+TV_SECS(a1) ; the next second move.l #0,IOTV_TIME+TV_MICRO(a1) CALLSYS SendIO bra .Loop .NoTimerMsg move.l CheckerProcSig(pc),d0 ; Only remake time display ? and.l #SIGTIMEREMAKE,d0 beq.s .NoTimeRemake bsr SetTime ; Yep -> do so bsr RemakeCosts ; Also redisplay billstuff .NoTimeRemake move.l CheckerProcSig(pc),d0 ; Pop up bill window ? and.l #SIGBILLWIN,d0 beq.s .NoBillOpenUp bsr OpenBillWin .NoBillOpenUp move.l CheckerProcSig,d0 ; Window from clock window ? and.l ClockSigFlag,d0 beq.s .NoClockMsg .LoopClockMsg move.l ClockHandle(pc),a0 move.l wd_UserPort(a0),a0 CALLSYS GetMsg tst.l d0 beq.s .NoClockMsg move.l d0,a1 move.l im_Class(a1),d7 DOLIB ReplyMsg cmp.l #IDCMP_CLOSEWINDOW,d7 ; Clock window closed ? bne.s .NoClockClose move.b #0,ClockWin bsr CloseClockWin tst.l WndHandle beq.s .NoClockMsg move.b ClockWin(pc),d0 move.l #WINDOWGAD,d1 ; Set checkbox tick bsr SetControlBox bra.s .NoClockMsg .NoClockClose cmp.l #IDCMP_CHANGEWINDOW,d7 ; Window moved ? bne.s .LoopClockMsg move.l ClockHandle,a0 lea ClockWinDef,a1 bsr StoreWinPos bra .LoopClockMsg .NoClockMsg move.l CheckerProcSig(pc),d0 ; Did it come from the and.l BillSigFlag(pc),d0 ; Bill window ? beq .Loop bsr.s CheckBillWindow bra .Loop CheckerError bsr CloseBillWin ; Close the billwindow bsr RemoveTimer ; Remove timer device move.l OurTask(pc),a1 ; Signal mother that we`re fine move.l #SIGHANDSHAKE,d0 CALLSYS Signal movem.l (sp)+,RegsAll rts ********************************************************************** * Check the BillWindow-Messages * ********************************************************************** CheckBillWindow move.l BillHandle(pc),a0 ; Get message move.l wd_UserPort(a0),a0 LNKLIB GT_GetIMsg,_GadToolsBase tst.l d0 beq NoBillMsg move.l d0,a1 move.l im_Class(a1),d6 move.w im_Code(a1),d5 cmp.w #'a',d5 blt.s .End and.w #~$20,d5 .End move.l d6,d0 and.l #(IDCMP_GADGETUP|IDCMP_GADGETDOWN),d0 beq.s .NoGad move.l im_IAddress(a1),a4 .NoGad move.w gg_GadgetID(a4),d7 DOLIB GT_ReplyIMsg cmp.l #IDCMP_CLOSEWINDOW,d6 ; Window close ??? bne.s NoBillClose bsr CloseBillWin bra NoBillMsg NoBillClose cmp.l #IDCMP_CHANGEWINDOW,d6 ; Window moved ? bne.s NoBillChange move.l BillHandle,a0 lea BillWinDef,a1 bsr StoreWinPos bra NoBillMsg NoBillChange cmp.l #GADGETDOWN,d6 bne.s NoBillGadDown cmp.w #TIMEZONEGAD,d7 ; Changed timezone ? bne.s NoTimeZoneGad move.b #1,DoRemakeCosts ext.l d5 move.l d5,TimeZone bsr RemakeCosts bra CheckBillWindow NoTimeZoneGad cmp.w #CHEAPMODEGAD,d7 ; Changed timemode bne CheckBillWindow move.b #1,DoRemakeCosts move.b d5,CheapMode bsr RemakeCosts bra CheckBillWindow NoBillGadDown cmp.l #IDCMP_VANILLAKEY,d6 bne NoBillVKey cmp.w #ESCKEY,d5 ; Hide window ? bne.s BNoEscKey BEscKey bsr CloseBillWin bra NoBillMsg BNoEscKey cmp.w #TIME1KEY,d5 ; Change time zone ? blt.s NoTimeKeys cmp.w #TIME3KEY,d5 bgt.s NoTimeKeys sub.w #'1',d5 ; Calc new zone BTime move.b #1,DoRemakeCosts ext.l d5 move.l d5,TimeZone move.l d5,d0 move.l #TIMEZONEGAD,d1 lea TimeZoneLabels,a2 lea BillGads,a0 move.l BillHandle,a1 bsr SetMXGad bsr RemakeCosts bra CheckBillWindow NoTimeKeys cmp.w #NORMALKEY,d5 ; Activate normal time mode ? bne.s NoNormalKey NormalKey move.b #1,DoRemakeCosts move.b #0,CheapMode bsr RemakeCosts moveq #0,d0 move.l #CHEAPMODEGAD,d1 lea CheapLabels,a2 lea BillGads,a0 move.l BillHandle,a1 bsr SetMXGad bra CheckBillWindow NoNormalKey cmp.w #CHEAPKEY,d5 ; Activate cheap time mode ? bne CheckBillWindow CheapKey move.b #1,DoRemakeCosts move.b #1,CheapMode bsr RemakeCosts moveq #1,d0 move.l #CHEAPMODEGAD,d1 lea CheapLabels,a2 lea BillGads,a0 move.l BillHandle,a1 bsr SetMXGad bra CheckBillWindow NoBillVKey cmp.l #IDCMP_RAWKEY,d6 ; User pressed help bne.s NoBillRKey cmp.w #HELPKEY,d5 bne CheckBillWindow lea BillHelpFile,a0 lea HelpName,a1 bsr StrCpy move.b #1,HelpPage move.l OurTask,a1 move.l HelpSigFlag,d0 CALLSYS Signal bra CheckBillWindow NoBillRKey cmp.l #IDCMP_MENUHELP,d6 ; User needs help bne.s NoBillMenuHelp move.w d5,HelpItem move.l OurTask,a1 move.l HelpSigFlag,d0 CALLSYS Signal bra CheckBillWindow NoBillMenuHelp cmp.l #IDCMP_MENUPICK,d6 bne CheckBillWindow cmp.w #-1,d5 beq.s EndBillMenu move.w d5,d2 and.w #$1f,d2 ; Get menunumber move.w d5,d1 asr.w #5,d1 and.w #$3f,d1 ; Get itemnumber move.w d1,d5 move.l BillMenu,a1 bsr GetMenuPtr GTMENUITEM_USERDATA a2,a0 cmp.l #0,a0 beq.s EndBillMenu jmp (a0) EndBillMenu bra CheckBillWindow NoBillMsg rts ********************************************************************** * This is the process to check for ARexx-Commands * ********************************************************************** RexxChecker movem.l RegsAll,-(sp) bsr InitARexx ; Init ARexx-Port tst.l d0 beq.s NoRexx move.l OurTask,a1 ; Signal mother A.Ok move.l #SIGHANDSHAKE,d0 CALLSYS Signal sub.l a1,a1 CALLSYS FindTask move.l d0,RexxProc CheckRexx move.l #SIGHANDSHAKE,d0 ; Wait for signals or.l ARexxSigFlag(pc),d0 CALLSYS Wait move.l d0,RexxSig move.l RexxSig(pc),d0 ; Remove Process ? and.l #SIGHANDSHAKE,d0 bne.s NoRexx move.l RexxSig(pc),d0 ; Did it come from ARexx ? and.l ARexxSigFlag(pc),d0 beq.s CheckRexx bsr HandleARexx ; Handle ARexx commands bra CheckRexx NoRexx bsr RemoveARexx ; Remove ARexx-Port move.l OurTask,a1 ; Signal mother A.Ok move.l #SIGHANDSHAKE,d0 CALLSYS Signal movem.l (sp)+,RegsAll rts ********************************************************************** * Wait for a signal * ********************************************************************** CheckBroker tst.w QuitBroker ; Quit our broker ? bne AbortBroker move.l #SIGBREAKF_CTRL_C,d0 ; Accept a BREAK (like from c:break) or.l BrokerSigFlag(pc),d0 ; Wait for sig on port of or.l WindowSigFlag(pc),d0 ; ... window or.l PrefsSigFlag(pc),d0 ; ... Preferences window or.l HotKeySigFlag(pc),d0 ; ... HotKey window or.l AlarmSigFlag(pc),d0 ; ... Display alarm or.l HelpSigFlag(pc),d0 ; ... Help for Bill window or.l AppSigFlag(pc),d0 ; ... of App-Icon CALLSYS Wait move.l d0,ThisSig move.l ThisSig(pc),d0 ; Got signal from child to and.l AlarmSigFlag(pc),d0 ; alarm beq.s NoAlarmDisp bsr OnScreen ; Turn on everything, so that bsr OnMouse ; User can see what`s up link a5,#-4 bsr LockScreen tst.l d0 beq.s .Error move.l -4(a5),d7 move.l d7,a0 LNKLIB ScreenToFront,_IntuitionBase move.l d7,a0 DOLIB DisplayBeep move.l WndHandle(pc),a0 bsr SetBusy lea MyEasyRequest,a1 ; Display Easy-Requester move.l #EasyTitle,es_Title(a1) move.l #AlarmText,es_TextFormat(a1) move.l #EasyGadget,es_GadgetFormat(a1) sub.l a0,a0 sub.l a2,a2 sub.l a3,a3 DOLIB EasyRequestArgs move.l WndHandle(pc),a0 bsr UnBusy .Error bsr UnlockScreen unlk a5 NoAlarmDisp move.l ThisSig(pc),d0 and.l BrokerSigFlag(pc),d0 ; If it was on the Msg-Port beq NoCxMsgs WorkAllMsgs move.l BrokerPort(pc),a0 ; Check the msgs CALLSYS GetMsg tst.l d0 beq NoCxMsgs move.l d0,a4 move.l a4,a0 ; Get Msg-Type LNKLIB CxMsgType,_CxBase move.l d0,MsgType move.l a4,a0 ; Get ID of msg DOLIB CxMsgID move.l d0,MsgID move.l a4,a1 CALLSYS ReplyMsg cmp.l #CXM_COMMAND,MsgType ; Commodities command ? bne NoXCommand ; Yep -> go on move.l MsgID(pc),d0 cmp.l #CXCMD_KILL,d0 ; Are we to go away ? bne.s NoKill move.w #1,QuitBroker bra WorkAllMsgs NoKill cmp.l #CXCMD_DISABLE,d0 ; Disable broker ? bne.s DontDisable bsr DisableBroker move.b #1,Disabled bra WorkAllMsgs DontDisable cmp.l #CXCMD_ENABLE,d0 ; Enable ??? bne.s DontEnable move.b #0,Disabled move.b #1,TimeReset bsr EnableBroker bra WorkAllMsgs DontEnable cmp.l #CXCMD_UNIQUE,d0 ; Another broker with same name bne.s NoUnique ; -> Quit program move.w #1,QuitBroker bra WorkAllMsgs NoUnique cmp.l #CXCMD_APPEAR,d0 ; Open our window ? bne.s NoAppear bsr OpenOurWindow bra WorkAllMsgs NoAppear cmp.l #CXCMD_DISAPPEAR,d0 ; Close our window ? bne WorkAllMsgs bsr CloseOurWindow ; Close it bra WorkAllMsgs NoXCommand cmp.l #CXM_IEVENT,MsgType ; Pop up key used ??? bne WorkAllMsgs ; Nope -> Loop for msgs cmp.l #POPUPKEYID,MsgID ; Are we to pop up ? bne.s NoPopUpWindow bsr OpenOurWindow ; Open our window bra WorkAllMsgs NoPopUpWindow cmp.l #PAGEKEYID,MsgID ; Change display mode of time ? bne.s NoPageChange addq.l #1,PageNum cmp.l #MAXPAGES,PageNum blt.s .End move.l #0,PageNum .End bsr ClearTitleBar bsr SigTime bra WorkAllMsgs NoPageChange cmp.l #PREFSKEYID,MsgID ; Pop Up prefs window ? bne.s NoPrefsPopUp bsr OpenPrefsWin bra WorkAllMsgs NoPrefsPopUp cmp.l #BILLKEYID,MsgID ; Pop Up Bill window ? bne.s NoBillHotKey move.l CheckerProc(pc),a1 move.l #SIGBILLWIN,d0 CALLSYS Signal bra WorkAllMsgs NoBillHotKey cmp.l #HOTWINKEYID,MsgID ; Pop Up HotKey window ? bne.s NoHotWinPop bsr OpenHotKeyWin bra WorkAllMsgs NoHotWinPop cmp.l #SHELLKEYID,MsgID ; Pop Up Shell ? bne NoShellPop move.l #SystemInOut,d1 ; Open the dummy Files NIL: move.l #MODE_NEWFILE,d2 LNKLIB Open,_DOSBase move.l d0,SysInput move.l #SystemInOut,d1 move.l #MODE_NEWFILE,d2 DOLIB Open move.l d0,SysOutput move.l OurTask(pc),a0 ; Make Path-List, only if NOT tst.l pr_CLI(a0) ; Startet from CLI beq.s .NoPath move.l #TAG_DONE,SysCLI ; Clear remaining tags bra .GotPath .NoPath move.l #NP_Path,SysCLI ; Allow Process tags move.l pr_CurrentDir(a0),d1 ; Clone mother`s current dir LNKLIB DupLock,_DOSBase tst.l d0 beq .NoProc move.l d0,SysDir lea WBPName,a1 ; Try to get a pointer to a process CALLSYS FindTask ; we can clone the pathlist from tst.l d0 ; Try to get the Workbench, bne.s .GotProc ; AmigaShell, InitialCLI, lea ICLIName,a1 ; Background CLI or New CLI processes DOLIB FindTask ; This is needed, so that the new tst.l d0 ; shell may execute Prgs, which bne.s .GotProc ; are located in dirs you lea NCLIName,a1 ; worked a PATH on. DOLIB FindTask ; We have to arrange a pathlist tst.l d0 ; which looks like this : bne.s .GotProc ; Size of block, Link to next, Lock-BPTR lea AShellName,a1 DOLIB FindTask tst.l d0 bne.s .GotProc lea BCLIName,a1 DOLIB FindTask tst.l d0 beq .NoProc .GotProc DOLIB Forbid move.l d0,a0 ; So we have a process -> go on move.l pr_CLI(a0),d0 ; Get pointer to it`s CLI-Structure asl.l #2,d0 ; Convert the BPTR move.l d0,a0 ; Get pointer to A0 move.l cli_CommandDir(a0),d0 ; Get pointer to CommandDir asl.l #2,d0 ; Convert to normal Pointer move.l d0,a4 ; Store pointer lea SysPath,a5 ; Get Pointer to Tags-Entry .GetPath cmp.l #0,a4 ; No (more) path ? beq.s .GotPath ; -> Start Shell moveq #12,d0 ; Allocate a small link-structure move.l #MEMF_PUBLIC|MEMF_CLEAR,d1 CALLSYS AllocMem tst.l d0 ; Could not get mem for one more beq.s .GotPath ; path lock -> start Shell move.l d0,d1 ; Get pointer to memory block addq.l #4,d1 ; Point to middle of these 3 LongWords asr.l #2,d1 ; Convert to BPTR move.l d1,(a5) ; Store Pointer to structure move.l d0,a5 ; Let A5 point to new memory block addq.l #4,a5 ; -> right to the middle move.l d0,a3 ; Store pointer move.l 4(a4),d1 ; Duplicate Lock to Path LNKLIB DupLock,_DOSBase move.l d0,8(a3) ; Store LockPointer move.l #0,4(a3) ; Clear link-pointer move.l #12,0(a3) ; Store length of one Path-Entry move.l (a4),d0 ; Get pointer to mother`s next path asl.l #2,d0 ; Convert to normal pointer move.l d0,a4 ; Now restart for next path bra.s .GetPath .GotPath CALLSYS Permit move.l #SystemComm,d1 ; Start Shell... move.l #SystemTags,d2 LNKLIB SystemTagList,_DOSBase .NoProc bra WorkAllMsgs NoShellPop cmp.l #UMLAUTKEYID,MsgID ; Change "Umlaut" mode ? bne WorkAllMsgs bchg #0,MapUmlaut move.b MapUmlaut,d0 move.l #UMLAUTGAD,d1 bsr SetControlBox bra WorkAllMsgs NoCxMsgs move.l ThisSig(pc),d0 and.l WindowSigFlag(pc),d0 ; Sig from window ? beq NoWindowMsg LoopWndMsg move.l WndHandle(pc),a0 ; Loop for all messages move.l wd_UserPort(a0),a0 LNKLIB GT_GetIMsg,_GadToolsBase ; Get gadtools message tst.l d0 beq NoWindowMsg move.l d0,a1 move.l im_Class(a1),d6 ; Get class move.w im_Code(a1),d5 ; Get code cmp.w #'a',d5 blt.s .End and.w #~$20,d5 .End move.l d6,d0 and.l #(IDCMP_GADGETUP|IDCMP_GADGETDOWN),d0 beq.s .NoGad move.l im_IAddress(a1),a4 ; Get gadget id move.w gg_GadgetID(a4),d7 .NoGad DOLIB GT_ReplyIMsg ; Reply gadtools msg cmp.l #IDCMP_CLOSEWINDOW,d6 ; Close gadget selected bne.s NoRemoveWin bsr CloseOurWindow bra NoWindowMsg ; Skip the rest NoRemoveWin cmp.l #IDCMP_CHANGEWINDOW,d6 ; Window moved ? bne.s NoControlMove move.l WndHandle,a0 lea MyWindowDef,a1 bsr StoreWinPos bra LoopWndMsg NoControlMove cmp.l #IDCMP_MENUHELP,d6 bne.s NoMenuHelp bsr RemakeGadgets ; Remake possible changes to toggle entries moveq #1,d0 bsr OnlineHelp bra LoopWndMsg NoMenuHelp cmp.l #IDCMP_MENUPICK,d6 bne NoMenuPick cmp.w #-1,d5 beq EndMainMenu move.w d5,d2 and.w #$1f,d2 ; Get menunumber move.w d5,d1 asr.w #5,d1 and.w #$3f,d1 ; Get itemnumber move.l MainMenu,a1 bsr GetMenuPtr GTMENUITEM_USERDATA a2,a0 cmp.l #0,a0 beq.s EndMainMenu jmp (a0) DisplayAbout move.l WndHandle(pc),a0 ; Display about bsr SetBusy lea MyEasyRequest,a1 ; Display Easy-Requester move.l #EasyTitle,es_Title(a1) move.l #AboutText,es_TextFormat(a1) move.l #AboutGadgets,es_GadgetFormat(a1) sub.l a0,a0 sub.l a2,a2 sub.l a3,a3 LNKLIB EasyRequestArgs,_IntuitionBase tst.l d0 bne.s .NoRegister move.l #PrtName,d1 move.l #MODE_NEWFILE,d2 LNKLIB Open,_DOSBase tst.l d0 beq.s .NoRegister move.l d0,d7 move.l d0,d1 move.l #RegisterTxt,d2 move.l #REGISTERLEN,d3 DOLIB Write .Error move.l d7,d1 DOLIB Close .NoRegister move.l WndHandle(pc),a0 bsr UnBusy bra.s EndMainMenu ReSavePrefs bsr SavePrefs EndMainMenu move.l DoActWindow,a1 cmp.l #0,a1 beq.s .End cmp.l WndHandle,a1 bne.s .End move.l DoActGadget,a0 sub.l a2,a2 LNKLIB ActivateGadget,_IntuitionBase move.l #0,DoActWindow move.l #0,DoActGadget .End bra LoopWndMsg NoMenuPick cmp.l #IDCMP_GADGETUP,d6 ; Gadget released bne NoGadgetUp cmp.w #ACTIGAD,d7 ; Do activations ? bne.s NoActiGad bchg #0,DoActivate bra LoopWndMsg NoActiGad cmp.w #MODEGAD,d7 ; Change activation mode ? bne.s NoModeGad bchg #0,MouseMode ; Invert flag of Activation-Mode bra LoopWndMsg NoModeGad cmp.w #DISPLAYGAD,d7 ; Clock on/off ? bne.s NoDisplayGad bchg #0,ShowClock tst.b ShowClock bne.s .End bsr ClearTitleBar bsr CloseClockWin .End bsr SigTime bra LoopWndMsg NoDisplayGad cmp.w #WINDOWGAD,d7 ; Display clock in window ? bne.s NoWindowGad bchg #0,ClockWin move.b #1,ShowClock moveq #1,d0 move.l #DISPLAYGAD,d1 bsr SetControlBox bsr ClearTitleBar bsr SigTime bra LoopWndMsg NoWindowGad cmp.w #SECSGAD,d7 ; Display seconds ? bne.s NoSecGad bchg #0,ShowSecs bsr ClearTitleBar bsr SigTime bra LoopWndMsg NoSecGad cmp.w #AMIGAD,d7 ; Set to american date ? bne.s NoAmiGad bchg #0,AmiDate bsr ClearTitleBar bsr SigTime bra LoopWndMsg NoAmiGad cmp.w #CLICKGAD,d7 ; Enable/Disable Key-Click ? bne.s NoClickGad bchg #0,KeyClick bra LoopWndMsg NoClickGad cmp.w #DAYGAD,d7 ; Display day ? bne.s NoDayGad bchg #0,ShowDay bsr ClearTitleBar bsr SigTime bra LoopWndMsg NoDayGad cmp.w #SHORTGAD,d7 ; Shorten the day ? bne.s NoShortGad bchg #0,ShortDay bsr ClearTitleBar bsr SigTime bra LoopWndMsg NoShortGad cmp.w #DATEGAD,d7 ; Display date ? bne.s NoDateGad bchg #0,ShowDate bsr ClearTitleBar bsr SigTime bra LoopWndMsg NoDateGad cmp.w #ALARMMODEGAD,d7 ; Enable/Disable alarm ? bne.s NoAlarmModeGad bchg #0,DoAlarm bra LoopWndMsg NoAlarmModeGad cmp.w #BILLGAD,d7 ; Open bill window ? bne.s NoBillGad move.l CheckerProc(pc),a1 move.l #SIGBILLWIN,d0 CALLSYS Signal bra LoopWndMsg NoBillGad cmp.w #PREFSGAD,d7 ; Activate preferences ? bne.s NoPrefsGad bsr OpenPrefsWin bra LoopWndMsg NoPrefsGad cmp.w #ENVGAD,d7 ; Enable/Disable env vars ? bne.s NoEnvGad bchg #0,SetEnv tst.b SetEnv bne.s .NoDel bsr DeleteEnvs .NoDel bsr SigTime bra LoopWndMsg NoEnvGad cmp.w #CYCLEGAD,d7 ; Enable/Disable Window-Cycling ? bne.s NoCycleGad bchg #0,CycleWin bra LoopWndMsg NoCycleGad cmp.w #WBFRONTGAD,d7 ; Enable/Disable WB to front ? bne.s NoWBFrontGad bchg #0,WBFront bra LoopWndMsg NoWBFrontGad cmp.w #LEFTYGAD,d7 ; Enable/Disable LeftyMouse ? bne.s NoLeftyGad bchg #0,LeftyMouse bra LoopWndMsg NoLeftyGad cmp.w #WESCGAD,d7 ; Enable/Disable ESC-Close ? bne.s NoEscGad bchg #0,ESCClose bra LoopWndMsg NoEscGad cmp.w #UMLAUTGAD,d7 ; Enable/Disable "Umaluts" ? bne.s NoUmlautGad bchg #0,MapUmlaut bra LoopWndMsg NoUmlautGad cmp.w #LOADGAD,d7 ; Load prefs bne.s NoLoadGad move.l #0,-(sp) move.w #0,-(sp) pea PrefsFileName pea PrefsFile pea PrefsPath pea PrefsLoadHeader move.l WndHandle,-(sp) jsr GetFileName lea 26(sp),sp tst.l d0 beq.s .End bsr LoadPrefs .End bra LoopWndMsg NoLoadGad cmp.w #SAVEGAD,d7 ; Save prefs bne.s NoSaveGad move.l #0,-(sp) move.w #0,-(sp) pea PrefsFileName pea PrefsFile pea PrefsPath pea PrefsSaveHeader move.l WndHandle,-(sp) jsr GetFileName lea 26(sp),sp tst.l d0 beq.s .End bsr SavePrefs .End bra LoopWndMsg NoSaveGad cmp.w #ENABLEGAD,d7 ; Enable broker ? bne.s NoEnGad move.b #0,Disabled move.b #1,TimeReset bsr EnableBroker bra LoopWndMsg NoEnGad cmp.w #DISABLEGAD,d7 ; Disable broker ? bne.s NoDisGad bsr DisableBroker move.b #1,Disabled bra LoopWndMsg NoDisGad cmp.w #HIDEGAD,d7 ; Hide window again bne.s NoHideGad bsr CloseOurWindow bra NoWindowMsg NoHideGad cmp.w #QUITGAD,d7 ; Quit hole stuff ? bne.s NoQuitGad move.w #1,QuitBroker bra LoopWndMsg NoQuitGad cmp.w #SETALARMGAD,d7 ; Alarm time altered ? bne.s NoSetAlarmGad move.l #SETALARMGAD,d0 lea ControlGads,a0 bsr GetGadgetPtr move.l gg_SpecialInfo(a0),a0 move.l si_Buffer(a0),a0 bsr CheckAlarmTime bra LoopWndMsg NoSetAlarmGad cmp.w #SCREENGAD,d7 ; Screen time altered ? bne.s NoScreenGad move.l ScreenTime,d7 move.l #SCREENGAD,d0 lea ControlGads,a0 bsr GetGadgetPtr move.l a0,a4 move.l gg_SpecialInfo(a4),a5 move.l si_LongInt(a5),d0 ; Retrieve data entered tst.l d0 blt.s .Error ; negative value -> error move.l d0,ScreenTime ; store new time bra.s .End .Error move.l d7,ScreenTime ; disable screen blanker move.l #SCREENGAD,d0 lea ControlGads,a0 move.l WndHandle(pc),a1 move.l #3,d1 move.l d7,d2 bsr SetIntegerGad .End move.b #1,TimeReset bra LoopWndMsg NoScreenGad cmp.w #MOUSEGAD,d7 ; Change mouse time ? bne.s NoMouseGad move.l MouseTime,d7 move.l #MOUSEGAD,d0 lea ControlGads,a0 bsr GetGadgetPtr move.l a0,a4 move.l gg_SpecialInfo(a4),a5 move.l si_LongInt(a5),d0 ; retrieve time entered tst.l d0 blt.s .Error ; negative value -> error move.l d0,MouseTime ; Store new time bra.s .End .Error move.l d7,MouseTime ; deactivate timer move.l #MOUSEGAD,d0 lea ControlGads,a0 move.l WndHandle,a1 moveq #3,d1 move.l d7,d2 bsr SetIntegerGad .End move.b #1,TimeReset bra LoopWndMsg NoMouseGad cmp.w #FRONTGAD,d7 ; Cycle gadget for bne.s NoFrontGad ; Click qualifier pressed ? addq.l #1,PopQualNum ; Increase Qualifier number cmp.l #POPQUALCNT,PopQualNum ; Exceited maxmum ? blt.s .End move.l #0,PopQualNum ; Reset number .End bra LoopWndMsg NoFrontGad cmp.w #ESCQUALGAD,d7 ; Cycle gadget for bne.s NoESCQualGad ; ESC qualifier pressed ? addq.l #1,ESCQualNum ; Increase Qualifier number cmp.l #ESCQUALCNT,ESCQualNum ; Exceited maxmum ? blt.s .End move.l #0,ESCQualNum ; Reset number .End bra LoopWndMsg NoESCQualGad cmp.w #HOTWINGAD,d7 ; Open HotKeys window ? bne.s NoHotKeysGad bsr OpenHotKeyWin bra LoopWndMsg NoHotKeysGad cmp.w #VOLGAD,d7 ; Change click volume ? bne.s NoVolGad move.l #VOLGAD,d0 lea ControlGads,a0 bsr GetGadgetPtr move.l a0,a4 move.l gg_SpecialInfo(a4),a5 move.l si_LongInt(a5),d0 ; Check for invalid number tst.l d0 blt.s .Error cmp.l #64,d0 bgt.s .Error move.l d0,ClickVol bra LoopWndMsg .Error move.l ClickVol,si_LongInt(a5) ; Remake string move.l #VOLGAD,d0 lea ControlGads,a0 move.l WndHandle,a1 moveq #2,d1 move.l ClickVol,d2 bsr SetIntegerGad NoVolGad cmp.w #USERSHELLGAD,d7 ; Change Shell-Command ? bne LoopWndMsg move.l gg_SpecialInfo(a4),a0 move.l si_Buffer(a0),a0 lea SystemParam,a1 bsr StrCpy bra LoopWndMsg NoGadgetUp cmp.l #IDCMP_RAWKEY,d6 bne.s NoCRawKey cmp.w #HELPKEY,d5 ; Display help ? bne LoopWndMsg lea MainHelpFile,a0 lea HelpName,a1 bsr StrCpy bsr OtherHelp bra LoopWndMsg NoCRawKey cmp.l #IDCMP_VANILLAKEY,d6 ; Any keys pressed bne LoopWndMsg cmp.w #ACTIKEY,d5 ; Do activations ? bne.s NoActiKey ActiKey bchg #0,DoActivate move.b DoActivate(pc),d0 move.l #ACTIGAD,d1 bsr SetControlBox bra EndMainMenu NoActiKey cmp.w #MODEKEY,d5 ; Change activation mode ? bne.s NoModeKey ModeKey bchg #0,MouseMode ; Invert flag of Activation-Mode move.b MouseMode(pc),d0 ; Get mode move.l #MODEGAD,d1 bsr SetControlBox bra EndMainMenu NoModeKey cmp.w #DISPLAYKEY,d5 ; Clock on/off ? bne.s NoDisplayKey DisplayKey bchg #0,ShowClock move.b ShowClock(pc),d0 ; reflect new choice move.l #DISPLAYGAD,d1 bsr SetControlBox bsr ClearTitleBar ; Clear titlebar bsr CloseClockWin ; Close clock window bsr SigTime bra EndMainMenu NoDisplayKey cmp.w #WINDOWKEY,d5 ; Display clock in window ? bne.s NoWindowKey WindowKey bchg #0,ClockWin move.b #1,ShowClock move.b ClockWin(pc),d0 move.l #WINDOWGAD,d1 bsr SetControlBox moveq #1,d0 move.l #DISPLAYGAD,d1 bsr SetControlBox bsr ClearTitleBar bsr SigTime bra EndMainMenu NoWindowKey cmp.w #SECSKEY,d5 ; Display seconds ? bne.s NoSecKey SecsKey bchg #0,ShowSecs move.b ShowSecs(pc),d0 move.l #SECSGAD,d1 bsr SetControlBox bsr ClearTitleBar bsr SigTime bra EndMainMenu NoSecKey cmp.w #AMIKEY,d5 ; Set to american date ? bne.s NoAmiKey AmiKey bchg #0,AmiDate move.b AmiDate(pc),d0 move.l #AMIGAD,d1 bsr SetControlBox bsr ClearTitleBar bsr SigTime bra EndMainMenu NoAmiKey cmp.w #CLICKKEY,d5 ; Enable/Disable Key-Click ? bne.s NoClickKey ClickKey bchg #0,KeyClick move.b KeyClick(pc),d0 move.l #CLICKGAD,d1 bsr SetControlBox bra EndMainMenu NoClickKey cmp.w #DAYKEY,d5 ; Display day ? bne.s NoDayKey DayKey bchg #0,ShowDay move.b ShowDay(pc),d0 move.l #DAYGAD,d1 bsr SetControlBox bsr ClearTitleBar bsr SigTime bra EndMainMenu NoDayKey cmp.w #SHORTKEY,d5 ; Shorten day ? bne.s NoShortKey ShortKey bchg #0,ShortDay move.b ShortDay(pc),d0 move.l #SHORTGAD,d1 bsr SetControlBox bsr ClearTitleBar bsr SigTime bra EndMainMenu NoShortKey cmp.w #DATEKEY,d5 ; Display date ? bne.s NoDateKey DateKey bchg #0,ShowDate move.b ShowDate(pc),d0 move.l #DATEGAD,d1 bsr SetControlBox bsr ClearTitleBar bsr SigTime bra EndMainMenu NoDateKey cmp.w #ALARMMODEKEY,d5 ; Enable/Disable alarm ? bne.s NoAlarmModeKey AlarmModeKey bchg #0,DoAlarm move.b DoAlarm(pc),d0 move.l #ALARMMODEGAD,d1 bsr SetControlBox bra EndMainMenu NoAlarmModeKey cmp.w #BILLKEY,d5 ; Open bill window ? bne.s NoBillKey BillKey move.l #BILLGAD,d0 lea ControlGads,a0 move.l WndHandle,a5 bsr ButtonCheck move.l CheckerProc(pc),a1 move.l #SIGBILLWIN,d0 CALLSYS Signal bra EndMainMenu NoBillKey cmp.w #PREFSKEY,d5 ; Open prefs window ? bne.s NoPrefsKey PrefsKey move.l #PREFSGAD,d0 lea ControlGads,a0 move.l WndHandle,a5 bsr ButtonCheck bsr OpenPrefsWin bra EndMainMenu NoPrefsKey cmp.w #ENVKEY,d5 ; Enable/Disable env vars ? bne.s NoEnvKey EnvKey bchg #0,SetEnv tst.b SetEnv bne.s .NoDel bsr DeleteEnvs ; Delete vars, if turned off .NoDel move.b SetEnv(pc),d0 move.l #ENVGAD,d1 bsr SetControlBox bsr ClearTitleBar bsr SigTime bra EndMainMenu NoEnvKey cmp.w #CYCLEKEY,d5 ; Enable/Disable Window-Cycling ? bne.s NoCycleKey CycleKey bchg #0,CycleWin move.b CycleWin(pc),d0 move.l #CYCLEGAD,d1 bsr SetControlBox bra EndMainMenu NoCycleKey cmp.w #VOLKEY,d5 ; Enter new volume ? bne.s NoVolKey VolKey move.l #VOLGAD,d0 lea ControlGads,a0 move.l WndHandle,a1 bsr ActStringGad bra EndMainMenu NoVolKey cmp.w #WBFRONTKEY,d5 ; Enable/Disable WB front ? bne.s NoWBFrontKey WBFrontKey bchg #0,WBFront move.b WBFront(pc),d0 move.l #WBFRONTGAD,d1 bsr SetControlBox bra EndMainMenu NoWBFrontKey cmp.w #LEFTYKEY,d5 ; Enable/Disable LeftyMouse ? bne.s NoLeftyKey LeftyKey bchg #0,LeftyMouse move.b LeftyMouse(pc),d0 move.l #LEFTYGAD,d1 bsr SetControlBox bra EndMainMenu NoLeftyKey cmp.w #WESCKEY,d5 ; Enable/Disable ESC-Close ? bne.s NoEscKey WESCKey bchg #0,ESCClose move.b ESCClose(pc),d0 move.l #WESCGAD,d1 bsr SetControlBox bra EndMainMenu NoEscKey cmp.w #UMLAUTKEY,d5 ; Enable/Disable Umlauts ? bne.s NoUmlautKey UmlautKey bchg #0,MapUmlaut move.b MapUmlaut(pc),d0 move.l #UMLAUTGAD,d1 bsr SetControlBox bra EndMainMenu NoUmlautKey cmp.w #LOADKEY,d5 ; Load prefs ? bne.s NoLoadKey DoLoadPrefs move.l #LOADGAD,d0 lea ControlGads,a0 move.l WndHandle,a5 bsr ButtonCheck move.l #0,-(sp) move.w #0,-(sp) pea PrefsFileName pea PrefsFile pea PrefsPath pea PrefsLoadHeader move.l WndHandle,-(sp) jsr GetFileName lea 26(sp),sp tst.l d0 beq.s .End bsr LoadPrefs .End bra EndMainMenu NoLoadKey cmp.w #SAVEKEY,d5 ; save prefs ? bne.s NoSaveKey DoSaveAsPrefs move.l #SAVEGAD,d0 lea ControlGads,a0 move.l WndHandle,a5 bsr ButtonCheck move.l #0,-(sp) move.w #0,-(sp) pea PrefsFileName pea PrefsFile pea PrefsPath pea PrefsSaveHeader move.l WndHandle,-(sp) jsr GetFileName lea 26(sp),sp tst.l d0 beq.s .End bsr SavePrefs .End bra EndMainMenu NoSaveKey cmp.w #HOTWINKEY,d5 ; Open HotKey window ? bne.s NoHotWinKey HotWinKey move.l #HOTWINGAD,d0 lea ControlGads,a0 move.l WndHandle,a5 bsr ButtonCheck bsr OpenHotKeyWin bra EndMainMenu NoHotWinKey cmp.w #ENABLEKEY,d5 ; Enable ? bne.s NoEnKey EnableKey move.b #0,Disabled move.b #1,TimeReset bsr EnableBroker move.l #ENABLEGAD,d0 lea ControlGads,a0 move.l WndHandle,a5 bsr ButtonCheck bra EndMainMenu NoEnKey cmp.w #DISABLEKEY,d5 ; Disable ? bne.s NoDisKey DisableKey bsr DisableBroker move.b #1,Disabled move.l #DISABLEGAD,d0 lea ControlGads,a0 move.l WndHandle,a5 bsr ButtonCheck bra EndMainMenu NoDisKey cmp.w #ESCKEY,d5 ; Hide stuff ? beq.s HideKey cmp.w #HIDEKEY,d5 bne.s NoHideKey HideKey move.l #HIDEGAD,d0 lea ControlGads,a0 move.l WndHandle,a5 bsr ButtonCheck EndControl bsr CloseOurWindow bra NoWindowMsg NoHideKey cmp.w #QUITKEY,d5 ; Quit stuff ? bne.s NoQuitKey QuitKey move.l #QUITGAD,d0 lea ControlGads,a0 move.l WndHandle,a5 bsr ButtonCheck move.w #1,QuitBroker bra EndMainMenu NoQuitKey cmp.w #SETALARMKEY,d5 ; Enter new alarm time ? bne.s NoSetAlarmKey SetAlarmKey move.l #SETALARMGAD,d0 ; Activate gadget lea ControlGads,a0 move.l WndHandle,a1 bsr ActStringGad bra EndMainMenu NoSetAlarmKey cmp.w #SCREENKEY,d5 ; Enter new screentimeout ? bne.s NoScreenKey ScreenKey move.l #SCREENGAD,d0 lea ControlGads,a0 move.l WndHandle,a1 bsr ActStringGad bra EndMainMenu NoScreenKey cmp.w #MOUSEKEY,d5 ; Enter new mousetimeout ? bne.s NoMouseKey MouseKey move.l #MOUSEGAD,d0 lea ControlGads,a0 move.l WndHandle,a1 bsr ActStringGad bra EndMainMenu NoMouseKey cmp.w #FRONTKEY,d5 ; Change Front/Back qualifier bne.s NoFrontKey FrontKey addq.l #1,PopQualNum ; Increase Qualifier number cmp.l #POPQUALCNT,PopQualNum blt.s .End move.l #0,PopQualNum .End move.l #FRONTGAD,d0 lea ControlGads,a0 move.l WndHandle,a1 move.l PopQualNum(pc),d1 lea PopQualList,a2 bsr SetCycleGad bra EndMainMenu NoFrontKey cmp.w #ESCQUALKEY,d5 ; Change ESC-Qualifier ? bne.s NoESCQualKey ESCKey addq.l #1,ESCQualNum ; Increase Qualifier number cmp.l #ESCQUALCNT,ESCQualNum blt.s .End move.l #0,ESCQualNum .End move.l #ESCQUALGAD,d0 move.l ESCQualNum(pc),d1 lea ControlGads,a0 move.l WndHandle,a1 lea ESCQualList,a2 bsr SetCycleGad bra EndMainMenu NoESCQualKey cmp.w #USERSHELLKEY,d5 ; Change User shell ? bne LoopWndMsg UserShellKey move.l #USERSHELLGAD,d0 lea ControlGads,a0 move.l WndHandle,a1 bsr ActStringGad bra EndMainMenu NoWindowMsg move.l ThisSig(pc),d0 ; Did it come from the preferences and.l PrefsSigFlag(pc),d0 ; window ? beq NoPrefsMsg LoopPrefsMsg move.l PrefsHandle(pc),a0 ; Get message move.l wd_UserPort(a0),a0 LNKLIB GT_GetIMsg,_GadToolsBase tst.l d0 beq NoPrefsMsg move.l d0,a1 ; Get important data move.l im_Class(a1),d6 move.w im_Code(a1),d5 cmp.w #'a',d5 blt.s .End and.w #~$20,d5 .End move.l d6,d0 and.l #(IDCMP_GADGETUP|IDCMP_GADGETDOWN),d0 beq.s .NoGad move.l im_IAddress(a1),a4 move.w gg_GadgetID(a4),d7 .NoGad DOLIB GT_ReplyIMsg DoLogMsgs cmp.l #IDCMP_CLOSEWINDOW,d6 ; Window to be closed ? bne.s NoPrefsClose bsr ClosePrefsWin bra NoPrefsMsg NoPrefsClose cmp.l #IDCMP_ACTIVEWINDOW,d6 ; Window activated ? beq Normal1Key cmp.l #IDCMP_CHANGEWINDOW,d6 ; Window moved ? bne.s NoPrefsMove move.l PrefsHandle,a0 lea PrefsWinDef,a1 bsr StoreWinPos bra LoopPrefsMsg NoPrefsMove cmp.l #IDCMP_GADGETUP,d6 ; Gadget released ? bne NoPrefsGadUp cmp.w #CHEAP3GAD,d7 ; One of the cost gadgets ? bgt.s NoCostTimeGad ext.l d7 ; Calc offset to time move.l d7,d6 ; Copy number of gadget subq.w #1,d7 ; within structure move.l d7,d0 asr.w #1,d0 ; D0 = Offset to timezone move.l d0,d1 asl.w #1,d1 sub.l d1,d7 ; D7 = Offset to normal/cheap lea CostUnit1,a0 asl.l #3,d0 asl.l #2,d7 lea 0(a0,d0),a0 move.l 0(a0,d7),d1 ; Get old cost move.l gg_SpecialInfo(a4),a3 move.l si_LongInt(a3),d0 ; Get new one tst.l d0 ; Less zero or even equal ? ble.s .Error move.l d0,0(a0,d7) ; Store new time bra.s .End .Error move.l d6,d0 lea PrefsGads,a0 move.l PrefsHandle,a1 move.l d1,d2 move.l #4,d1 bsr SetIntegerGad .End move.b #1,DoRemakeCosts bsr RemakeCosts bra LoopPrefsMsg NoCostTimeGad cmp.w #COSTGAD,d7 ; New cost/unit entered ? bne.s NoCostGad move.l gg_SpecialInfo(a4),a3 move.l si_LongInt(a3),d0 ; Get new value tst.l d0 ; <= 0 ? ble.s .Error move.l d0,CostUnit ; Store new value bra.s .End .Error move.l #COSTGAD,d0 lea PrefsGads,a0 move.l PrefsHandle,a1 moveq #4,d1 move.l CostUnit,d2 bsr SetIntegerGad .End move.b #1,DoRemakeCosts bsr RemakeCosts bra LoopPrefsMsg NoCostGad cmp.w #CLEARLOGGAD,d7 ; Clear log file ? bne.s NoClearGad move.l #LogFileName,d1 LNKLIB DeleteFile,_DOSBase bra LoopPrefsMsg NoClearGad cmp.w #BILLPOPGAD,d7 ; Enable/Disable PopUp fo BillWin bne.s NoBillPopGad bchg #0,BillPopUp bra LoopPrefsMsg NoBillPopGad cmp.w #LOGCALLGAD,d7 ; Enable/Disable phone logs ? bne.s NoLogGad bchg #0,LogCalls bra LoopPrefsMsg NoLogGad cmp.w #SAVETOGAD,d7 ; Select a file via ASL-Request ? bne.s NoSaveToGad pea PrefsGads move.w #LOGFILEGAD,-(sp) pea LogFileName pea LogFile pea LogPath pea LogFileHeader move.l PrefsHandle,-(sp) jsr GetFileName lea 26(sp),sp bra LoopPrefsMsg NoSaveToGad cmp.w #LOGFILEGAD,d7 ; Entered new logfilename ? bne NoLogFileGad link a3,#-FILEBUFFSIZE ; Get Buffer for FileName move.l gg_SpecialInfo(a4),a5 ; Check if can be saved to dir move.l si_Buffer(a5),a0 lea -FILEBUFFSIZE(a3),a1 bsr StrCpy ; copy new filename lea -FILEBUFFSIZE(a3),a0 bsr StrLen subq.l #1,d0 .CheckLoop cmp.b #':',(a0) ; Dir entered ? beq.s .DoDirCheck cmp.b #'/',(a0) beq.s .DoDirCheck addq.l #1,a0 dbf d0,.CheckLoop bra.s .OnlyFile .DoDirCheck move.l a0,a1 ; Yep...Extract dir name .FindDir tst.b (a0) beq.s .NameEnd cmp.b #'/',(a0) bne.s .Loop move.l a0,a1 .Loop addq.l #1,a0 bra.s .FindDir .NameEnd move.b #0,1(a1) ; Dir name extracted lea -FILEBUFFSIZE(a3),a0 ; try to lock it move.l a0,EasyArg move.l a0,d1 move.l #ACCESS_READ,d2 LNKLIB Lock,_DOSBase tst.l d0 bne.s .Ok DOLIB IoErr ; Error move.l d0,ErrorNum bsr DisplayError bra.s .Error .Ok move.l d0,d1 ; No Error DOLIB UnLock .OnlyFile move.l si_Buffer(a5),a0 ; Copy new filename lea LogFileName,a1 bsr StrCpy bra LoopPrefsMsg .Error move.l #LOGFILEGAD,d0 lea PrefsGads,a0 move.l PrefsHandle,a1 move.l #286,d1 lea LogFileName,a2 bsr SetStringGad unlk a3 ; Clear buffer bra LoopPrefsMsg NoLogFileGad cmp.w #TOTALSUMGAD,d7 ; Display total sum ? bne LoopPrefsMsg bsr DisplayTotalSum bra LoopPrefsMsg NoPrefsGadUp cmp.l #IDCMP_GADGETDOWN,d6 ; MX gadget used ? bne.s NoPrefsGadDown cmp.w #PTIMEGAD,d7 ; Changed time ? bne.s NoPTimeGad ext.l d5 move.l d5,PTimeZone bra LoopPrefsMsg NoPTimeGad cmp.w #PMODEGAD,d7 ; Changed tariff ? bne LoopPrefsMsg ext.l d5 move.l d5,PTariff bra LoopPrefsMsg NoPrefsGadDown cmp.l #IDCMP_VANILLAKEY,d6 ; Key pressed ? bne NoPrefsVKey cmp.w #ESCKEY,d5 ; Hide window ? bne.s PNoEscKey PEscKey bsr ClosePrefsWin bra NoPrefsMsg PNoEscKey cmp.w #NORMAL1KEY,d5 ; Activate first integer gad ? bne.s NoNormal1Key Normal1Key move.l #NORMAL1GAD,d0 lea PrefsGads,a0 move.l PrefsHandle(pc),a1 bsr ActStringGad bra EndPrefsMenu NoNormal1Key cmp.w #SAVETOKEY,d5 ; Select new log filename ? bne.s NoSaveToKey SaveToKey move.l #SAVETOGAD,d0 lea PrefsGads,a0 move.l PrefsHandle,a5 bsr ButtonCheck pea PrefsGads move.w #LOGFILEGAD,-(sp) pea LogFileName pea LogFile pea LogPath pea LogFileHeader move.l PrefsHandle,-(sp) jsr GetFileName lea 26(sp),sp bra EndPrefsMenu NoSaveToKey cmp.w #TOTALSUMKEY,d5 ; Display total costs ? bne.s NoTotalSumGad TotalSumKey move.l #TOTALSUMGAD,d0 lea PrefsGads,a0 move.l PrefsHandle,a5 bsr ButtonCheck bsr DisplayTotalSum bra EndPrefsMenu NoTotalSumGad cmp.w #CLEARLOGKEY,d5 ; Clear log file ? bne.s NoClearKey ClearLogKey move.l #CLEARLOGGAD,d0 lea PrefsGads,a0 move.l PrefsHandle,a5 bsr ButtonCheck move.l #LogFileName,d1 LNKLIB DeleteFile,_DOSBase bra EndPrefsMenu NoClearKey cmp.w #LOGCALLKEY,d5 ; Enable/Disable phone logs ? bne.s NoLogKey LogCallKey bchg #0,LogCalls move.b LogCalls(pc),d0 move.l #LOGCALLGAD,d1 bra.s SetPrefsBox NoLogKey cmp.w #BILLPOPKEY,d5 ; Enable/Disable PopUp of BillWin bne.s NoBillPopKey BillPopKey bchg #0,BillPopUp move.b BillPopUp(pc),d0 move.l #BILLPOPGAD,d1 SetPrefsBox lea PrefsGads,a0 move.l PrefsHandle,a1 movem.l d0/d1,-(sp) bsr SetCheckBox movem.l (sp)+,d0/d1 sub.l #10,d1 moveq #1,d2 move.l PrefsHandle,a0 move.l PrefsMenu,a1 bsr SetToggleMenu bra EndPrefsMenu NoBillPopKey cmp.w #TIME1KEY,d5 ; Changed time zone ? blt.s NoPTimeKey cmp.w #TIME3KEY,d5 bgt.s NoPTimeKey sub.w #'1',d5 DoTime123Key ext.l d5 move.l d5,PTimeZone move.l d5,d0 move.l #PTIMEGAD,d1 lea PrefsTimeLabels,a2 bra.s RemakePMx NoPTimeKey cmp.w #PNORMALKEY,d5 ; Change tariff ? blt EndPrefsMenu cmp.w #PCHEAPKEY,d5 bgt EndPrefsMenu sub.w #'4',d5 DoTariff45Key ext.l d5 move.l d5,PTariff move.l d5,d0 move.l #PMODEGAD,d1 lea PrefsModeLabels,a2 RemakePMx lea PrefsGads,a0 move.l PrefsHandle(pc),a1 bsr SetMXGad bra EndPrefsMenu NoPrefsVKey cmp.l #IDCMP_RAWKEY,d6 bne.s NoPrefsRKey cmp.w #HELPKEY,d5 ; User pressed help ? bne LoopPrefsMsg lea PrefsHelpFile,a0 lea HelpName,a1 bsr StrCpy bsr OtherHelp bra LoopPrefsMsg NoPrefsRKey cmp.l #IDCMP_MENUHELP,d6 ; User pressed help in menu ? bne.s NoPrefsHelp moveq #0,d0 ; Remake possible move.b BillPopUp,d0 ; changes to toggle entries moveq #0,d1 moveq #1,d2 move.l PrefsHandle,a0 move.l PrefsMenu,a1 bsr SetToggleMenu moveq #0,d0 move.b LogCalls,d0 moveq #1,d1 moveq #1,d2 move.l PrefsHandle,a0 move.l PrefsMenu,a1 bsr SetToggleMenu moveq #2,d0 bsr OnlineHelp bra LoopPrefsMsg NoPrefsHelp cmp.l #IDCMP_MENUPICK,d6 bne LoopPrefsMsg cmp.w #-1,d5 beq.s EndPrefsMenu move.w d5,d2 and.w #$1f,d2 ; Get menunumber move.w d5,d1 asr.w #5,d1 and.w #$3f,d1 ; Get itemnumber move.w d1,d5 move.l PrefsMenu,a1 bsr GetMenuPtr GTMENUITEM_USERDATA a2,a0 cmp.l #0,a0 beq.s EndPrefsMenu jmp (a0) Time123Key subq.w #2,d5 ; Change timezone bra DoTime123Key Tariff45Key subq.w #6,d5 ; Change tariff bra DoTariff45Key ChangeLogName lea PrefsGads,a0 move.l #LOGFILEGAD,d0 bsr GetGadgetPtr move.l PrefsHandle,a1 sub.l a2,a2 LNKLIB ActivateGadget,_IntuitionBase bra.s EndPrefsMenu EndPrefsMenu move.l DoActWindow,a1 cmp.l #0,a1 beq.s .End cmp.l PrefsHandle,a1 bne.s .End move.l DoActGadget,a0 sub.l a2,a2 LNKLIB ActivateGadget,_IntuitionBase move.l #0,DoActWindow move.l #0,DoActGadget .End bra LoopPrefsMsg NoPrefsMsg move.l ThisSig,d0 ; Msg from HotKey window ? and.l HotKeySigFlag,d0 beq NoHotKeyMsg LoopHotKeyMsg move.l HotKeyHandle,a0 move.l wd_UserPort(a0),a0 LNKLIB GT_GetIMsg,_GadToolsBase tst.l d0 beq NoHotKeyMsg move.l d0,a1 ; Get important data move.l im_Class(a1),d6 move.w im_Code(a1),d5 cmp.w #'a',d5 blt.s .End and.w #~$20,d5 .End move.l d6,d0 and.l #(IDCMP_GADGETUP|IDCMP_GADGETDOWN),d0 beq.s .NoGad move.l im_IAddress(a1),a4 move.w gg_GadgetID(a4),d7 .NoGad DOLIB GT_ReplyIMsg cmp.l #IDCMP_CLOSEWINDOW,d6 ; Close window ? bne.s NoHotKeyClose bsr CloseHotKeyWin bra NoHotKeyMsg NoHotKeyClose cmp.l #IDCMP_ACTIVEWINDOW,d6 ; Window active ? beq HPopUpKey cmp.l #IDCMP_CHANGEWINDOW,d6 ; Window moved ? bne.s NoHotKeyMove move.l HotKeyHandle,a0 lea HotKeyWinDef,a1 bsr StoreWinPos bra LoopHotKeyMsg NoHotKeyMove cmp.l #IDCMP_GADGETUP,d6 ; Gadget released ? bne NoHotKeyGadUp cmp.w #POPUPGAD,d7 ; Change PopUp HotKey ? bne.s NoPopUpGad move.l gg_SpecialInfo(a4),a3 move.l si_Buffer(a3),a3 move.l WndHandle,a0 lea ControlTitle,a1 move.l PopUpFilter,a4 lea PopUpKey,a5 bsr RemakeHotKey bra LoopHotKeyMsg NoPopUpGad cmp.w #PAGEGAD,d7 ; Released Page-Gadget bne.s NoPageGad move.l gg_SpecialInfo(a4),a3 move.l si_Buffer(a3),a3 sub.l a0,a0 sub.l a1,a1 move.l PageFilter,a4 lea PageHotKey,a5 bsr RemakeHotKey bra LoopHotKeyMsg NoPageGad cmp.w #BILLKEYGAD,d7 ; Changed Bill HotKey ? bne.s NoBillKeyGad move.l gg_SpecialInfo(a4),a3 move.l si_Buffer(a3),a3 move.l BillHandle,a0 lea BillTitle,a1 move.l BillFilter,a4 lea BillHotKey,a5 bsr RemakeHotKey bra LoopHotKeyMsg NoBillKeyGad cmp.w #PREFSKEYGAD,d7 ; Changed preferences HotKey ? bne.s NoPrefsKeyGad move.l gg_SpecialInfo(a4),a3 move.l si_Buffer(a3),a3 move.l PrefsHandle,a0 lea PrefsTitle,a1 move.l PrefsFilter,a4 lea PrefsHotKey,a5 bsr RemakeHotKey bra LoopHotKeyMsg NoPrefsKeyGad cmp.w #HOTKEYGAD,d7 ; Changed HotWin HotKey ? bne.s NoHotKeyGad move.l gg_SpecialInfo(a4),a3 move.l si_Buffer(a3),a3 move.l HotKeyHandle,a0 lea HotWinTitle,a1 move.l HotKeyFilter,a4 lea HotWinHotKey,a5 bsr RemakeHotKey bra LoopHotKeyMsg NoHotKeyGad cmp.w #SHELLGAD,d7 ; Change Shell HotKey ? bne.s NoShellGad move.l gg_SpecialInfo(a4),a3 move.l si_Buffer(a3),a3 sub.l a0,a0 sub.l a1,a1 move.l ShellFilter,a4 lea ShellHotKey,a5 bsr RemakeHotKey bra LoopHotKeyMsg NoShellGad cmp.w #UMLAUTKEYGAD,d7 ; Change Umlaut HotKey ? bne LoopHotKeyMsg move.l gg_SpecialInfo(a4),a3 move.l si_Buffer(a3),a3 sub.l a0,a0 sub.l a1,a1 move.l UmlautFilter,a4 lea UmlautHotKey,a5 bsr RemakeHotKey bra LoopHotKeyMsg NoHotKeyGadUp cmp.l #IDCMP_VANILLAKEY,d6 ; Key Pressed ? bne NoHotVKey cmp.w #POPUPKEY,d5 ; Change PopUp-Key ? bne.s NoPopUpKey HPopUpKey move.l #POPUPGAD,d0 bra.s ActHotKeyGad NoPopUpKey cmp.w #PAGEKEY,d5 ; Change Page-Key ? bne.s NoPageKey HPageKey move.l #PAGEGAD,d0 bra.s ActHotKeyGad NoPageKey cmp.w #BILLKEYKEY,d5 ; Change Bill-Key ? bne.s NoBillKeyKey HBillKey move.l #BILLKEYGAD,d0 bra.s ActHotKeyGad NoBillKeyKey cmp.w #PREFSKEYKEY,d5 ; Change Prefs-Key ? bne.s NoPrefsKeyKey HPrefsKey move.l #PREFSKEYGAD,d0 bra.s ActHotKeyGad NoPrefsKeyKey cmp.w #HOTKEYKEY,d5 ; Change HotKey-Key ? bne.s NoHotKeyKey HHotKey move.l #HOTKEYGAD,d0 bra.s ActHotKeyGad NoHotKeyKey cmp.w #SHELLKEY,d5 ; Change Shell-Key ? bne.s NoShellKey HShellKey move.l #SHELLGAD,d0 bra.s ActHotKeyGad NoShellKey cmp.w #UMLAUTKEYKEY,d5 ; Change Umlaut HotKey ? bne.s NoUmlautKeyKey HUmlautKey move.l #UMLAUTKEYGAD,d0 ActHotKeyGad lea HotKeyGads,a0 move.l HotKeyHandle,a1 bsr ActStringGad bra LoopHotKeyMsg NoUmlautKeyKey cmp.w #ESCKEY,d5 ; Close window ? bne LoopHotKeyMsg HEscKey bsr CloseHotKeyWin bra.s NoHotKeyMsg NoHotVKey cmp.l #IDCMP_RAWKEY,d6 ; User pressed help ? bne.s NoHotRKey cmp.w #HELPKEY,d5 bne LoopHotKeyMsg lea HotKeyHelpFile,a0 lea HelpName,a1 bsr StrCpy bsr OtherHelp bra LoopHotKeyMsg NoHotRKey cmp.l #IDCMP_MENUHELP,d6 ; Menu help ? bne.s NoHotKeyHelp moveq #4,d0 bsr OnlineHelp bra LoopHotKeyMsg NoHotKeyHelp cmp.l #IDCMP_MENUPICK,d6 ; Menu picked ? bne LoopHotKeyMsg cmp.w #-1,d5 beq.s EndHotKeyMenu move.w d5,d2 and.w #$1f,d2 ; Get menunumber move.w d5,d1 asr.w #5,d1 and.w #$3f,d1 ; Get itemnumber move.w d1,d5 move.l HotKeyMenu,a1 bsr GetMenuPtr GTMENUITEM_USERDATA a2,a0 cmp.l #0,a0 beq.s EndHotKeyMenu jmp (a0) EndHotKeyMenu bra LoopHotKeyMsg NoHotKeyMsg move.l ThisSig(pc),d0 ; App-Message ? and.l AppSigFlag(pc),d0 beq.s NoAppMsg .LoopAppMsg move.l AppPort,a0 ; Get message CALLSYS GetMsg tst.l d0 beq.s NoAppMsg move.l d0,a1 cmp.w #MTYPE_APPICON,am_Type(a1) ; Did it come from window ? bne.s .NoAppIcon tst.l am_NumArgs(a1) bne.s .ReplyAppMsg tst.l am_ArgList(a1) bne.s .ReplyAppMsg move.l a1,-(sp) bsr OpenOurWindow ; Open our window move.l (sp)+,a1 bra.s .ReplyAppMsg .NoAppIcon cmp.w #MTYPE_APPMENUITEM,am_Type(a1) ; Was a menu item ? bne.s .ReplyAppMsg cmp.l #MAINITEM,am_ID(a1) ; The control-window ? bne.s .ReplyAppMsg move.l a1,-(sp) bsr OpenOurWindow ; Open it move.l (sp)+,a1 .ReplyAppMsg CALLSYS ReplyMsg bra .LoopAppMsg NoAppMsg move.l ThisSig(pc),d0 ; Display Help for Bill ? and.l HelpSigFlag(pc),d0 beq.s NoHelpMsg move.w HelpItem,d5 moveq #3,d0 bsr OnlineHelp NoHelpMsg bra CheckBroker ; Loop for all stuff AbortBroker bsr OnMouse move.l WndHandle(pc),a0 ; Set control window to busy bsr SetBusy move.l RexxProc,a1 ; Tell Rexx-Proc to go away move.l #SIGHANDSHAKE,d0 CALLSYS Signal move.l #SIGHANDSHAKE,d0 ; wait for reply CALLSYS Wait move.l CheckerProc,a1 ; Tell Time-Proc to go away move.l #SIGHANDSHAKE,d0 CALLSYS Signal move.l #SIGHANDSHAKE,d0 ; wait for reply CALLSYS Wait move.b #0,Disabled ; Disable broker bsr DisableBroker rts ********************************************************************** * Open our window. if not already open :-) * ********************************************************************** OpenOurWindow tst.l WndHandle ; Window already open ? beq.s .End move.l WndHandle(pc),a0 LNKLIB WindowToFront,_IntuitionBase tst.b WBFront beq.s .NoWB move.l WndHandle(pc),a0 move.l wd_WScreen(a0),a0 DOLIB ScreenToFront,_IntuitionBase .NoWB rts .End link a5,#-4 bsr LockScreen tst.l d0 beq NoWindow2Open tst.b WBFront beq.s .NoWBFront move.l -4(a5),a0 LNKLIB ScreenToFront,_IntuitionBase .NoWBFront move.l -4(a5),a0 ; Get visual info for screen sub.l a1,a1 LNKLIB GetVisualInfoA,_GadToolsBase tst.l d0 beq NoWindow2Open move.l d0,VisInfo lea DummyNewGadget,a0 ; Store visual info in newgadget move.l d0,gng_VisualInfo(a0) lea MyWindowDef(pc),a0 ; Try to open our window move.l #WINWIDTH,WinWidth move.l #WINHEIGHT,WinHeight move.l #WINIDCMP,WinIDCMP move.l #WINFLAGS,WinFlags move.l #1,DoMenuHelp lea WindowTags,a1 LNKLIB OpenWindowTagList,_IntuitionBase move.l d0,WndHandle tst.l d0 beq NoWindow2Open move.l d0,a0 ; Get the sig flag for port move.l wd_UserPort(a0),a0 moveq #0,d0 move.b MP_SIGBIT(a0),d0 moveq #1,d1 asl.l d0,d1 move.l d1,WindowSigFlag lea MainMenuDef,a0 ; Create menu strip sub.l a1,a1 ; No tags LNKLIB CreateMenusA,_GadToolsBase move.l d0,MainMenu tst.l d0 beq NoWindow2Open move.l MainMenu(pc),a0 ; Do the layout on window move.l VisInfo(pc),a1 sub.l a2,a2 DOLIB LayoutMenusA tst.l d0 beq NoWindow2Open move.l WindowSigFlag(pc),d0 ; Wait until window popped up CALLSYS Wait .WLoop move.l WndHandle(pc),a0 move.l wd_UserPort(a0),a0 DOLIB GetMsg tst.l d0 beq.s .WEnd move.l d0,a1 DOLIB ReplyMsg bra.s .WLoop .WEnd move.l WndHandle(pc),a0 moveq #0,d7 move.b wd_BorderTop(a0),d7 lea FirstGadget(pc),a0 ; Create a context gadget LNKLIB CreateContext,_GadToolsBase tst.l d0 beq NoWindow2Open move.l d0,ThisGadget move.w #1,GadNum ; Reset Gadget ID lea GadgetAttrs,a4 ; List of attributes for new gads lea ControlGads,a3 CreateGads move.l (a4)+,d0 ; Get address of gad-text beq.s AllGadsDone ; = 0 ? -> No more gads lea DummyNewGadget,a1 move.l d0,gng_GadgetText(a1) ; Store text move.w #GADWIDTH,gng_Width(a1) ; Store width move.w #GADHEIGHT,gng_Height(a1) move.l (a4)+,gng_Flags(a1) ; Store new flags move.l (a4)+,d0 ; Get gadget kind move.w (a4)+,gng_LeftEdge(a1) ; Store left and top edge move.w (a4)+,d6 add.w d7,d6 ; Remake for height of window border move.w d6,gng_TopEdge(a1) move.l ThisGadget(pc),a0 ; Get pointer of prev. gad lea ButtonTags,a2 ; Get pointer to tags DOLIB CreateGadgetA ; Create gadget tst.l d0 ; A Ok ? -> Go on beq NoWindow2Open move.l d0,(a3)+ move.l d0,ThisGadget ; Store pointer for next gadget addq.w #1,GadNum ; increase ID bra CreateGads ; Loop for all AllGadsDone lea AlarmStartVal,a0 ; Create AlarmTime string gadget move.l a0,StringConts move.l #8,StrMax lea DummyNewGadget,a1 move.l #AlarmGadTxt,gng_GadgetText(a1) move.w #STRGADWIDTH,gng_Width(a1) move.w #INTERWIDTH+154,gng_LeftEdge(a1) move.w #97,d6 add.w d7,d6 move.w d6,gng_TopEdge(a1) move.l #PLACETEXT_LEFT,gng_Flags(a1) move.l #STRING_KIND,d0 move.l ThisGadget(pc),a0 lea StringTags,a2 DOLIB CreateGadgetA tst.l d0 beq NoWindow2Open move.l d0,(a3)+ move.l d0,ThisGadget addq.w #1,GadNum lea SystemParam,a0 ; Create User Shell string gadget move.l a0,StringConts move.l #128,StrMax lea DummyNewGadget,a1 move.l #ShellGadTxt,gng_GadgetText(a1) move.w #STRGADWIDTH,gng_Width(a1) move.w #INTERWIDTH+154,gng_LeftEdge(a1) move.w #110,d6 add.w d7,d6 move.w d6,gng_TopEdge(a1) move.l #PLACETEXT_LEFT,gng_Flags(a1) move.l #STRING_KIND,d0 move.l ThisGadget(pc),a0 lea StringTags,a2 DOLIB CreateGadgetA tst.l d0 beq NoWindow2Open move.l d0,(a3)+ move.l d0,ThisGadget addq.w #1,GadNum move.l ScreenTime,d0 ; Create screenblank gadget move.l d0,IntConts move.l #3,IntMax lea DummyNewGadget,a1 move.l #ScrBTxt,gng_GadgetText(a1) move.w #INTGADWIDTH,gng_Width(a1) move.w #WINWIDTH-37-INTERWIDTH,gng_LeftEdge(a1) move.w #97,d6 add.w d7,d6 move.w d6,gng_TopEdge(a1) move.l #INTEGER_KIND,d0 move.l ThisGadget(pc),a0 lea IntegerTags,a2 DOLIB CreateGadgetA tst.l d0 beq NoWindow2Open move.l d0,(a3)+ move.l d0,ThisGadget addq.w #1,GadNum move.l MouseTime,d0 ; Create mouseblank gadget move.l d0,IntConts lea DummyNewGadget,a1 move.l #MouseBTxt,gng_GadgetText(a1) move.w #INTGADWIDTH,gng_Width(a1) move.w #110,d6 add.w d7,d6 move.w d6,gng_TopEdge(a1) move.w #WINWIDTH-37-INTERWIDTH,gng_LeftEdge(a1) move.l #INTEGER_KIND,d0 move.l ThisGadget(pc),a0 lea IntegerTags,a2 DOLIB CreateGadgetA tst.l d0 beq NoWindow2Open move.l d0,(a3)+ move.l d0,ThisGadget addq.w #1,GadNum move.l ClickVol,d0 ; Create clickvolume move.l d0,IntConts move.l #2,IntMax lea DummyNewGadget,a1 move.l #ClickVolTxt,gng_GadgetText(a1) move.w #INTGADWIDTH,gng_Width(a1) move.w #123,d6 add.w d7,d6 move.w d6,gng_TopEdge(a1) move.w #WINWIDTH-INTERWIDTH-37,gng_LeftEdge(a1) move.l #INTEGER_KIND,d0 move.l ThisGadget(pc),a0 lea IntegerTags,a2 DOLIB CreateGadgetA tst.l d0 beq NoWindow2Open move.l d0,(a3)+ move.l d0,ThisGadget addq.w #1,GadNum move.l #PopQualList,CycLabels ; Create front gadget move.l PopQualNum(pc),d0 ; Set label to be move.l d0,CycActive ; the active one lea DummyNewGadget,a1 move.l #FrontGadTxt,gng_GadgetText(a1) move.w #CYCLEWIDTH,gng_Width(a1) move.w #84,d6 add.w d7,d6 move.w d6,gng_TopEdge(a1) move.w #INTERWIDTH+154,gng_LeftEdge(a1) move.l #PLACETEXT_LEFT,gng_Flags(a1) move.l #CYCLE_KIND,d0 move.l ThisGadget(pc),a0 lea CycleTags,a2 DOLIB CreateGadgetA tst.l d0 beq NoWindow2Open move.l d0,(a3)+ move.l d0,ThisGadget addq.w #1,GadNum lea DummyNewGadget,a1 ; Create bill gadget move.l #TeleBillTxt,gng_GadgetText(a1) move.w #140,gng_Width(a1) move.w #123,d6 add.w d7,d6 move.w d6,gng_TopEdge(a1) move.w #INTERWIDTH,gng_LeftEdge(a1) move.l #PLACETEXT_IN,gng_Flags(a1) move.l #BUTTON_KIND,d0 move.l ThisGadget(pc),a0 lea ButtonTags,a2 DOLIB CreateGadgetA tst.l d0 beq NoWindow2Open move.l d0,(a3)+ move.l d0,ThisGadget addq.w #1,GadNum lea DummyNewGadget,a1 ; Create preferences gadget move.l #TelePrefsTxt,gng_GadgetText(a1) move.w #164,gng_Width(a1) move.w #123,d6 add.w d7,d6 move.w d6,gng_TopEdge(a1) move.w #INTERWIDTH*2+140,gng_LeftEdge(a1) move.l #PLACETEXT_IN,gng_Flags(a1) move.l #BUTTON_KIND,d0 move.l ThisGadget(pc),a0 lea ButtonTags,a2 DOLIB CreateGadgetA tst.l d0 beq NoWindow2Open move.l d0,(a3)+ move.l d0,ThisGadget addq.w #1,GadNum move.l #ESCQualList,CycLabels ; Create ESC-Qualifier gadget move.l ESCQualNum(pc),d0 ; Set label to be move.l d0,CycActive ; the active one lea DummyNewGadget(pc),a1 move.l #ESCGadTxt,gng_GadgetText(a1) move.w #CYCLEWIDTH,gng_Width(a1) move.w #84,d6 add.w d7,d6 move.w d6,gng_TopEdge(a1) move.w #WINWIDTH-CYCLEWIDTH,gng_LeftEdge(a1) move.l #PLACETEXT_LEFT,gng_Flags(a1) move.l #CYCLE_KIND,d0 move.l ThisGadget(pc),a0 lea CycleTags,a2 DOLIB CreateGadgetA tst.l d0 beq NoWindow2Open move.l d0,(a3)+ move.l d0,ThisGadget addq.w #1,GadNum lea DummyNewGadget(pc),a1 ; Create HotKeys gadget move.l #HotKeyGadTxt,gng_GadgetText(a1) move.w #120,gng_Width(a1) move.w #123,d6 add.w d7,d6 move.w d6,gng_TopEdge(a1) move.w #INTERWIDTH*3+140+164,gng_LeftEdge(a1) move.l #PLACETEXT_IN,gng_Flags(a1) move.l #BUTTON_KIND,d0 move.l ThisGadget(pc),a0 lea ButtonTags(pc),a2 DOLIB CreateGadgetA tst.l d0 beq.s NoWindow2Open move.l d0,(a3)+ move.l d0,ThisGadget addq.w #1,GadNum move.l WndHandle(pc),a0 ; Add gadgets to window move.l FirstGadget(pc),a1 move.l #-1,d0 move.l #-1,d1 sub.l a2,a2 LNKLIB AddGList,_IntuitionBase move.l FirstGadget(pc),a0 ; Make them appear move.l WndHandle(pc),a1 sub.l a2,a2 move.l #-1,d0 DOLIB RefreshGList move.l WndHandle(pc),a0 ; Append menu to window move.l MainMenu(pc),a1 LNKLIB SetMenuStrip,_IntuitionBase bsr RemakeGadgets bsr UnlockScreen moveq #0,d0 unlk a5 rts NoWindow2Open bsr.s CloseOurWindow bsr UnlockScreen move.l #12,ErrorNum bsr DisplayError moveq #-1,d0 unlk a5 rts ********************************************************************** * This part closes our window * ********************************************************************** CloseOurWindow tst.l WndHandle beq.s NoWindow2Close move.l WndHandle(pc),a0 ; Store new coords in structure lea MyWindowDef(pc),a1 ; So that window appears at same bsr StoreWinPos move.l WndHandle(pc),a0 ; Remove remaining msgs LNKLIB CloseWindow,_IntuitionBase ; Close Window NoWindow2Close tst.l FirstGadget beq.s GotNoGadgets move.l FirstGadget(pc),a0 ; Free GadTools-Gadgets LNKLIB FreeGadgets,_GadToolsBase GotNoGadgets tst.l MainMenu ; Free GadTools-Menus beq.s .NoMenu move.l MainMenu(pc),a0 LNKLIB FreeMenus,_GadToolsBase .NoMenu tst.l VisInfo ; Free Visual-Info beq.s NoVisInfo move.l VisInfo(pc),a0 LNKLIB FreeVisualInfo,_GadToolsBase NoVisInfo move.l #0,WndHandle ; Clear flags for later move.l #0,WindowSigFlag ; identification move.l #0,FirstGadget move.l #0,MainMenu move.l #0,VisInfo rts ********************************************************************** * Open clock window. Width in D6 * ********************************************************************** OpenClockWin add.w #DEPTHWIDTH*2+8,d6 ; approximate width of close/depth gadgets move.w d6,ClockWidth ; Store for compare tst.l ClockHandle ; Window already open ? bne ClockWinOpen bsr ClearTitleBar ; Clear titlebar first link a5,#-4 bsr LockScreen tst.l d0 beq ClockError lea ClockWinDef(pc),a0 ; Set width to time width move.w ClockWidth(pc),nw_Width(a0) move.l MyFont(pc),a1 move.w tf_YSize(a1),d1 addq.w #3,d1 move.w d1,nw_Height(a0) move.l -4(a5),a1 bsr AdjustWinPos move.l #CLOCKWIDTH,WinWidth move.l #CLOCKHEIGHT,WinHeight move.l #CLOCKIDCMP,WinIDCMP move.l #CLOCKFLAGS,WinFlags move.l #0,DoMenuHelp lea WindowTags(pc),a1 LNKLIB OpenWindowTagList,_IntuitionBase move.l d0,ClockHandle tst.l d0 bne.s GotClockWin move.b #0,ClockWin ; On failure close moveq #0,d0 ; disable clockwin mode move.l #WINDOWGAD,d1 bsr SetControlBox bra.s ClockError GotClockWin move.l ClockHandle(pc),a0 ; Get sig flag moveq #0,d0 move.l wd_UserPort(a0),a0 move.b MP_SIGBIT(a0),d0 moveq #1,d1 asl.l d0,d1 move.l d1,ClockSigFlag bsr UnlockScreen unlk a5 ClockWinOpen move.l ClockHandle(pc),a0 ; Current width not equal moveq #0,d0 ; to width needed moveq #0,d1 moveq #0,d2 moveq #0,d3 move.w wd_LeftEdge(a0),d0 move.w wd_TopEdge(a0),d1 move.w ClockWidth(pc),d2 cmp.w wd_Width(a0),d2 beq.s CWidthOk moveq #0,d3 move.b wd_BorderTop(a0),d3 LNKLIB ChangeWindowBox,_IntuitionBase ; so readjust width bsr ClockRemake ; Wait until window has been remade CWidthOk moveq #1,d0 rts ClockError bsr UnlockScreen moveq #0,d0 unlk a5 rts ********************************************************************** * Close clockwindow and remove pointer * ********************************************************************** CloseClockWin tst.l ClockHandle beq.s NoCWOpen move.l ClockHandle(pc),a0 ; Store new coords in structure lea ClockWinDef(pc),a1 ; so that window appears at bsr StoreWinPos LNKLIB CloseWindow,_IntuitionBase ; and now....CLOSE IT NoCWOpen move.l #0,ClockHandle move.l #0,ClockSigFlag rts ********************************************************************** * Open the bill window * ********************************************************************** OpenBillWin tst.l BillHandle beq.s .End move.l BillHandle,a0 LNKLIB WindowToFront,_IntuitionBase rts .End link a5,#-4 bsr LockScreen tst.l d0 beq .BillWinError move.l -4(a5),a0 ; Get Visual Info sub.l a1,a1 LNKLIB GetVisualInfoA,_GadToolsBase move.l d0,BillVisInfo tst.l d0 beq .BillWinError lea DummyNewGadget(pc),a0 move.l d0,gng_VisualInfo(a0) move.l d0,BevelVisInfo move.l #BILLWINWIDTH,WinWidth ; Open the window move.l #BILLWINHEIGHT,WinHeight move.l #BILLWINIDCMP,WinIDCMP move.l #BILLWINFLAGS,WinFlags move.l #1,DoMenuHelp lea BillMenuDef,a0 ; Create menu strip sub.l a1,a1 ; No tags LNKLIB CreateMenusA,_GadToolsBase move.l d0,BillMenu tst.l d0 beq .BillWinError move.l BillMenu(pc),a0 ; Do the layout on window move.l BillVisInfo(pc),a1 sub.l a2,a2 DOLIB LayoutMenusA tst.l d0 beq .BillWinError lea BillWinDef(pc),a0 move.l -4(a5),a1 bsr AdjustWinPos lea WindowTags(pc),a1 LNKLIB OpenWindowTagList,_IntuitionBase move.l d0,BillHandle tst.l d0 beq .BillWinError move.l BillHandle(pc),a0 move.l wd_UserPort(a0),a0 moveq #0,d0 moveq #1,d1 move.b MP_SIGBIT(a0),d0 ; Get Sig flag asl.l d0,d1 move.l d1,BillSigFlag move.l BillHandle(pc),a0 moveq #0,d7 move.b wd_BorderTop(a0),d7 move.l wd_RPort(a0),BillRPort move.l BillRPort(pc),a0 ; Print ITexts lea BillITxts,a1 moveq #0,d0 move.l d7,d1 LNKLIB PrintIText,_IntuitionBase move.l BillRPort(pc),a0 ; Draw bevel boxes move.l #INTERWIDTH,d0 move.l #BEVELHEIGHT,d1 add.l d7,d1 move.l #BEVELWIDTH,d2 move.l #BEVELHEIGHT,d3 lea BevelTag(pc),a1 LNKLIB DrawBevelBoxA,_GadToolsBase move.l BillRPort(pc),a0 move.l #INTERWIDTH+BEVELWIDTH+INTERWIDTH,d0 move.l #BEVELHEIGHT,d1 add.l d7,d1 move.l #BEVELWIDTH,d2 move.l #BEVELHEIGHT,d3 lea BevelTag(pc),a1 DOLIB DrawBevelBoxA move.l BillRPort(pc),a0 move.l #INTERWIDTH+((BEVELWIDTH+INTERWIDTH)*2),d0 move.l #BEVELHEIGHT,d1 add.l d7,d1 move.l #BEVELWIDTH,d2 move.l #BEVELHEIGHT,d3 lea BevelTag(pc),a1 DOLIB DrawBevelBoxA move.l BillRPort(pc),a0 move.l #INTERWIDTH,d0 move.l #BEVELHEIGHT*4+10,d1 add.l d7,d1 move.l #(BEVELWIDTH*3)+(INTERWIDTH*2),d2 move.l #BEVELHEIGHT,d3 lea BevelTag(pc),a1 DOLIB DrawBevelBoxA lea BillGadget(pc),a0 ; Create Context gadget DOLIB CreateContext move.l d0,ThisGadget tst.l d0 beq .BillWinError move.w #1,GadNum lea DummyNewGadget(pc),a1 ; Creat Time MX gadgets lea BillGads,a4 move.l #TimeZoneLabels,MxLabels move.l TimeZone,MxActive move.w #BEVELHEIGHT*2+2,d0 add.w d7,d0 move.w d0,gng_TopEdge(a1) move.w #INTERWIDTH,gng_LeftEdge(a1) move.w #17,gng_Width(a1) move.w #9,gng_Height(a1) move.l #PLACETEXT_RIGHT,gng_Flags(a1) move.l #MX_KIND,d0 move.l ThisGadget(pc),a0 lea MxTags(pc),a2 DOLIB CreateGadgetA tst.l d0 beq .BillWinError move.l d0,(a4)+ move.l d0,ThisGadget addq.w #1,GadNum lea DummyNewGadget(pc),a1 ; Create CHEAP MX gadgets move.l #CheapLabels,MxLabels moveq #0,d0 move.b CheapMode(pc),d0 move.l d0,MxActive move.w #BEVELHEIGHT*2+2,d0 add.w d7,d0 move.w d0,gng_TopEdge(a1) move.w #INTERWIDTH+(INTERWIDTH+BEVELWIDTH)*2,gng_LeftEdge(a1) move.w #17,gng_Width(a1) move.w #9,gng_Height(a1) move.l #PLACETEXT_RIGHT,gng_Flags(a1) move.l #MX_KIND,d0 move.l ThisGadget(pc),a0 lea MxTags(pc),a2 DOLIB CreateGadgetA tst.l d0 beq.s .BillWinError move.l d0,(a4)+ move.l d0,ThisGadget addq.w #1,GadNum move.l BillHandle(pc),a0 ; Add gadgets to window move.l BillGadget(pc),a1 sub.l a2,a2 moveq #-1,d0 moveq #-1,d1 LNKLIB AddGList,_IntuitionBase move.l BillGadget(pc),a0 ; Make `em appear move.l BillHandle(pc),a1 sub.l a2,a2 moveq #-1,d0 DOLIB RefreshGList move.l BillHandle(pc),a0 ; Append menu to window move.l BillMenu(pc),a1 LNKLIB SetMenuStrip,_IntuitionBase bra.s .NoBillClose .BillWinError bsr.s CloseBillWin .NoBillClose bsr UnlockScreen unlk a5 rts ********************************************************************** * Close the Bill window again * ********************************************************************** CloseBillWin tst.l BillHandle ; Close window beq.s .NoWin move.l BillHandle(pc),a0 ; Store new coords of window lea BillWinDef,a1 bsr StoreWinPos LNKLIB CloseWindow,_IntuitionBase .NoWin tst.l BillGadget ; Free gadgets beq.s .NoGads move.l BillGadget(pc),a0 LNKLIB FreeGadgets,_GadToolsBase .NoGads tst.l BillMenu ; Free GadTools-Menus beq.s .NoMenu move.l BillMenu(pc),a0 LNKLIB FreeMenus,_GadToolsBase .NoMenu tst.l BillVisInfo ; Free visual info beq.s .NoVisInfo move.l BillVisInfo(pc),a0 LNKLIB FreeVisualInfo,_GadToolsBase .NoVisInfo move.l #0,BillHandle ; Reset stuff move.l #0,BillSigFlag move.l #0,BillGadget move.l #0,BillVisInfo move.l #0,BillMenu rts ********************************************************************** * Open the preferences window * ********************************************************************** OpenPrefsWin tst.l PrefsHandle beq.s .GoOn move.l PrefsHandle,a0 LNKLIB WindowToFront,_IntuitionBase rts .GoOn link a5,#-4 bsr LockScreen tst.l d0 beq .PrefsWinError move.l -4(a5),a0 ; Get visual info sub.l a1,a1 LNKLIB GetVisualInfoA,_GadToolsBase tst.l d0 beq .PrefsWinError move.l d0,PrefsVisInfo lea DummyNewGadget(pc),a0 move.l d0,gng_VisualInfo(a0) move.l #PREFSWINWIDTH,WinWidth ; Try to open the window move.l #PREFSWINHEIGHT,WinHeight move.l #PREFSWINIDCMP,WinIDCMP move.l #PREFSWINFLAGS,WinFlags move.l #1,DoMenuHelp lea PrefsWinDef(pc),a0 move.l -4(a5),a1 bsr AdjustWinPos lea WindowTags(pc),a1 LNKLIB OpenWindowTagList,_IntuitionBase move.l d0,PrefsHandle tst.l d0 beq .PrefsWinError move.l PrefsHandle(pc),a0 moveq #0,d0 moveq #1,d1 move.l wd_UserPort(a0),a0 move.b MP_SIGBIT(a0),d0 ; Get the sigmask asl.l d0,d1 move.l d1,PrefsSigFlag lea PrefsMenuDef,a0 ; Create menu strip sub.l a1,a1 ; No tags LNKLIB CreateMenusA,_GadToolsBase move.l d0,PrefsMenu tst.l d0 beq .PrefsWinError move.l PrefsMenu(pc),a0 ; Do the layout on window move.l PrefsVisInfo(pc),a1 sub.l a2,a2 DOLIB LayoutMenusA tst.l d0 beq .PrefsWinError lea PrefsGadget(pc),a0 LNKLIB CreateContext,_GadToolsBase move.l d0,ThisGadget tst.l d0 beq .PrefsWinError move.l PrefsHandle(pc),a0 moveq #0,d7 move.b wd_BorderTop(a0),d7 move.w #1,GadNum lea CostUnit1,a4 ; Loop for all integer gads lea PrefsGadTxts,a3 move.l d7,d5 addq.l #2,d5 move.l #2,d6 moveq #0,d4 .GadLoop lea DummyNewGadget(pc),a1 ; Create normal gad move.l cu_Normal(a4),IntConts move.l #4,IntMax move.w #PREFINTGADWIDTH,gng_Width(a1) move.w #GADHEIGHT,gng_Height(a1) move.w #160,gng_LeftEdge(a1) move.w d5,gng_TopEdge(a1) move.l (a3)+,gng_GadgetText(a1) move.l #PLACETEXT_LEFT,gng_Flags(a1) move.l #INTEGER_KIND,d0 move.l ThisGadget(pc),a0 lea IntegerTags(pc),a2 DOLIB CreateGadgetA tst.l d0 beq .PrefsWinError move.l d0,ThisGadget lea PrefsGads,a0 move.l d0,0(a0,d4) addq.l #4,d4 addq.w #1,GadNum lea DummyNewGadget(pc),a1 ; Create cheap gad move.l cu_Cheap(a4),IntConts move.w #368,gng_LeftEdge(a1) move.l (a3)+,gng_GadgetText(a1) move.l #INTEGER_KIND,d0 move.l ThisGadget(pc),a0 lea IntegerTags(pc),a2 DOLIB CreateGadgetA tst.l d0 beq .PrefsWinError move.l d0,ThisGadget lea PrefsGads,a0 move.l d0,0(a0,d4) addq.l #4,d4 addq.w #1,GadNum addq.l #8,a4 add.l #GADHEIGHT+INTERHEIGHT,d5 dbf d6,.GadLoop move.l CostUnit,d0 ; Create cost/unit gad move.l d0,IntConts lea DummyNewGadget(pc),a1 move.w d5,gng_TopEdge(a1) move.w #200,gng_LeftEdge(a1) move.l (a3)+,gng_GadgetText(a1) move.l #INTEGER_KIND,d0 move.l ThisGadget(pc),a0 lea IntegerTags(pc),a2 DOLIB CreateGadgetA tst.l d0 beq .PrefsWinError lea PrefsGads,a0 move.l d0,0(a0,d4) addq.l #4,d4 move.l d0,ThisGadget addq.w #1,GadNum add.l #GADHEIGHT+INTERHEIGHT,d5 lea DummyNewGadget(pc),a1 ; Creat Time MX gadgets move.l #PrefsTimeLabels,MxLabels move.l PTimeZone,MxActive move.w #GADWIDTH,gng_Width(a1) move.w d5,gng_TopEdge(a1) move.w #INTERWIDTH,gng_LeftEdge(a1) move.w #17,gng_Width(a1) move.w #9,gng_Height(a1) move.l #PLACETEXT_RIGHT,gng_Flags(a1) move.l #MX_KIND,d0 move.l ThisGadget(pc),a0 lea MxTags(pc),a2 DOLIB CreateGadgetA tst.l d0 beq .PrefsWinError lea PrefsGads,a0 move.l d0,0(a0,d4) addq.l #4,d4 move.l d0,ThisGadget addq.w #1,GadNum lea DummyNewGadget(pc),a1 ; Create CHEAP MX gadgets move.l #PrefsModeLabels,MxLabels moveq #0,d0 move.l PTariff,d0 move.l d0,MxActive move.w #PREFSWINWIDTH-18,gng_LeftEdge(a1) move.w #17,gng_Width(a1) move.w #9,gng_Height(a1) move.l #PLACETEXT_LEFT,gng_Flags(a1) move.l #MX_KIND,d0 move.l ThisGadget(pc),a0 lea MxTags(pc),a2 DOLIB CreateGadgetA tst.l d0 beq .PrefsWinError lea PrefsGads,a0 move.l d0,0(a0,d4) addq.l #4,d4 move.l d0,ThisGadget addq.w #1,GadNum add.l #INTERHEIGHT*2+(10*3),d5 lea DummyNewGadget(pc),a1 ; Create PopBill-Win gadget move.w #GADWIDTH,gng_Width(a1) move.w #GADHEIGHT,gng_Height(a1) move.w #INTERWIDTH,gng_LeftEdge(a1) move.w d5,gng_TopEdge(a1) move.l (a3)+,gng_GadgetText(a1) move.l #PLACETEXT_RIGHT,gng_Flags(a1) moveq #0,d0 ; Set state of gadget move.b BillPopUp(pc),d0 move.l d0,SelectMode move.l #CHECKBOX_KIND,d0 move.l ThisGadget(pc),a0 lea CheckBoxTags(pc),a2 DOLIB CreateGadgetA tst.l d0 beq .PrefsWinError lea PrefsGads,a0 move.l d0,0(a0,d4) addq.l #4,d4 move.l d0,ThisGadget addq.w #1,GadNum lea DummyNewGadget(pc),a1 ; Create LogCalls gadget move.w #INTERWIDTH+190,gng_LeftEdge(a1) move.l (a3)+,gng_GadgetText(a1) moveq #0,d0 ; Set mode of gadget move.b LogCalls(pc),d0 move.l d0,SelectMode move.l #CHECKBOX_KIND,d0 move.l ThisGadget(pc),a0 lea CheckBoxTags(pc),a2 DOLIB CreateGadgetA tst.l d0 beq .PrefsWinError lea PrefsGads,a0 move.l d0,0(a0,d4) addq.l #4,d4 move.l d0,ThisGadget addq.w #1,GadNum lea DummyNewGadget(pc),a1 ; Create Clear Log gadget move.w #PREFSWINWIDTH-GADWIDTH-1,gng_LeftEdge(a1) move.l (a3)+,gng_GadgetText(a1) move.l #PLACETEXT_IN,gng_Flags(a1) move.l #BUTTON_KIND,d0 move.l ThisGadget(pc),a0 lea ButtonTags(pc),a2 DOLIB CreateGadgetA tst.l d0 beq .PrefsWinError lea PrefsGads,a0 move.l d0,0(a0,d4) addq.l #4,d4 move.l d0,ThisGadget addq.w #1,GadNum add.l #GADHEIGHT+INTERHEIGHT,d5 lea DummyNewGadget(pc),a1 ; Create save to gad move.w d5,gng_TopEdge(a1) move.w #GADWIDTH+32,gng_Width(a1) move.w #INTERWIDTH,gng_LeftEdge(a1) move.l (a3)+,gng_GadgetText(a1) move.l #PLACETEXT_IN,gng_Flags(a1) move.l #BUTTON_KIND,d0 move.l ThisGadget(pc),a0 lea ButtonTags(pc),a2 DOLIB CreateGadgetA tst.l d0 beq .PrefsWinError lea PrefsGads,a0 move.l d0,0(a0,d4) addq.l #4,d4 move.l d0,ThisGadget addq.w #1,GadNum move.l #LogFileName,StringConts ; Create string gad move.l #286,StrMax lea DummyNewGadget(pc),a1 move.w #164,gng_Width(a1) move.w #GADWIDTH+32+INTERWIDTH*2,gng_LeftEdge(a1) move.l #0,gng_GadgetText(a1) move.l #0,gng_Flags(a1) move.l #STRING_KIND,d0 move.l ThisGadget(pc),a0 lea StringTags(pc),a2 DOLIB CreateGadgetA tst.l d0 beq .PrefsWinError lea PrefsGads,a0 move.l d0,0(a0,d4) addq.l #4,d4 move.l d0,ThisGadget addq.w #1,GadNum lea DummyNewGadget(pc),a1 ; Create total sum gad move.w #GADWIDTH+24,gng_Width(a1) move.w #GADWIDTH+INTERWIDTH*3+194,gng_LeftEdge(a1) move.l (a3)+,gng_GadgetText(a1) move.l #PLACETEXT_IN,gng_Flags(a1) move.l #BUTTON_KIND,d0 move.l ThisGadget(pc),a0 lea ButtonTags(pc),a2 DOLIB CreateGadgetA tst.l d0 beq .PrefsWinError lea PrefsGads,a0 move.l d0,0(a0,d4) addq.l #4,d4 move.l d0,ThisGadget addq.w #1,GadNum add.l #GADHEIGHT+INTERHEIGHT,d5 move.l PrefsHandle(pc),a0 ; Add gadgets to window move.l PrefsGadget(pc),a1 sub.l a2,a2 moveq #-1,d0 moveq #-1,d1 LNKLIB AddGList,_IntuitionBase move.l PrefsGadget(pc),a0 ; Display them move.l PrefsHandle(pc),a1 sub.l a2,a2 moveq #-1,d0 DOLIB RefreshGList move.l PrefsHandle(pc),a0 ; Append menu to window move.l PrefsMenu(pc),a1 LNKLIB SetMenuStrip,_IntuitionBase moveq #0,d0 move.b BillPopUp,d0 moveq #0,d1 moveq #1,d2 move.l PrefsHandle,a0 move.l PrefsMenu,a1 bsr SetToggleMenu moveq #0,d0 move.b LogCalls,d0 moveq #1,d1 moveq #1,d2 move.l PrefsHandle,a0 move.l PrefsMenu,a1 bsr SetToggleMenu bra.s .End .PrefsWinError bsr.s ClosePrefsWin .End bsr UnlockScreen unlk a5 rts ********************************************************************** * Close the preferences window * ********************************************************************** ClosePrefsWin tst.l PrefsHandle ; Close window if there beq.s .NoWindow move.l PrefsHandle(pc),a0 ; Store new coords lea PrefsWinDef(pc),a1 bsr StoreWinPos LNKLIB CloseWindow,_IntuitionBase .NoWindow tst.l PrefsGadget ; Remove gadgets, if there beq.s .NoGadgets move.l PrefsGadget(pc),a0 LNKLIB FreeGadgets,_GadToolsBase .NoGadgets tst.l PrefsMenu ; Free GadTools-Menus beq.s .NoMenu move.l PrefsMenu(pc),a0 LNKLIB FreeMenus,_GadToolsBase .NoMenu tst.l PrefsVisInfo ; And free visual info beq.s .NoVisInfo move.l PrefsVisInfo(pc),a0 LNKLIB FreeVisualInfo,_GadToolsBase .NoVisInfo move.l #0,PrefsHandle move.l #0,PrefsSigFlag move.l #0,PrefsGadget move.l #0,PrefsVisInfo move.l #0,PrefsMenu rts ********************************************************************** * Open up the HotKeys window * ********************************************************************** OpenHotKeyWin tst.l HotKeyHandle beq.s .GoOn move.l HotKeyHandle,a0 LNKLIB WindowToFront,_IntuitionBase rts .GoOn link a5,#-4 bsr LockScreen tst.l d0 beq .KeyWinError move.l -4(a5),a0 ; Get visual info sub.l a1,a1 LNKLIB GetVisualInfoA,_GadToolsBase tst.l d0 beq .KeyWinError move.l d0,HotKeyVisInfo lea DummyNewGadget(pc),a0 move.l d0,gng_VisualInfo(a0) move.l #KEYWINWIDTH,WinWidth ; Try to open the window move.l #KEYWINHEIGHT,WinHeight move.l #KEYWINIDCMP,WinIDCMP move.l #KEYWINFLAGS,WinFlags move.l #1,DoMenuHelp lea HotKeyWinDef(pc),a0 move.l -4(a5),a1 bsr AdjustWinPos lea WindowTags(pc),a1 LNKLIB OpenWindowTagList,_IntuitionBase move.l d0,HotKeyHandle tst.l d0 beq .KeyWinError move.l HotKeyHandle(pc),a0 moveq #0,d0 moveq #1,d1 move.l wd_UserPort(a0),a0 move.b MP_SIGBIT(a0),d0 ; Get the sigmask asl.l d0,d1 move.l d1,HotKeySigFlag lea HotKeyMenuDef,a0 ; Create menu strip sub.l a1,a1 ; No tags LNKLIB CreateMenusA,_GadToolsBase move.l d0,HotKeyMenu tst.l d0 beq .KeyWinError move.l HotKeyMenu(pc),a0 ; Do the layout on window move.l HotKeyVisInfo(pc),a1 sub.l a2,a2 DOLIB LayoutMenusA tst.l d0 beq .KeyWinError lea HotKeyGadget(pc),a0 LNKLIB CreateContext,_GadToolsBase move.l d0,ThisGadget tst.l d0 beq .KeyWinError move.l HotKeyHandle(pc),a0 moveq #0,d7 move.b wd_BorderTop(a0),d7 move.w #1,GadNum add.w #INTERHEIGHT,d7 lea HotKeyGads,a4 lea HotKeyGadStat,a3 moveq #0,d5 move.l #6,d6 .DoHotKeyGads move.l (a3)+,StringConts move.l #80,StrMax lea DummyNewGadget(pc),a1 lea HotKeyGadTxts,a0 move.l 0(a0,d5),gng_GadgetText(a1) move.w #STRGADWIDTH,gng_Width(a1) move.w #GADHEIGHT,gng_Height(a1) move.w #KEYWINWIDTH-INTERWIDTH-STRGADWIDTH,gng_LeftEdge(a1) move.w d7,gng_TopEdge(a1) move.l #PLACETEXT_LEFT,gng_Flags(a1) move.l #STRING_KIND,d0 move.l ThisGadget(pc),a0 lea StringTags(pc),a2 DOLIB CreateGadgetA tst.l d0 beq.s .KeyWinError move.l d0,(a4)+ move.l d0,ThisGadget addq.w #1,GadNum add.w #13,d7 addq.l #4,d5 dbf d6,.DoHotKeyGads move.l HotKeyHandle(pc),a0 ; Add gadgets to window move.l HotKeyGadget(pc),a1 sub.l a2,a2 moveq #-1,d0 moveq #-1,d1 LNKLIB AddGList,_IntuitionBase move.l HotKeyGadget(pc),a0 ; Display them move.l HotKeyHandle(pc),a1 sub.l a2,a2 moveq #-1,d0 DOLIB RefreshGList move.l HotKeyHandle(pc),a0 ; Append menu to window move.l HotKeyMenu(pc),a1 LNKLIB SetMenuStrip,_IntuitionBase bra.s .End .KeyWinError bsr.s CloseHotKeyWin .End bsr UnlockScreen unlk a5 rts ********************************************************************** * Close HotKey-Window again * ********************************************************************** CloseHotKeyWin tst.l HotKeyHandle ; Close window if there beq.s .NoWindow move.l HotKeyHandle(pc),a0 ; Store new coords lea HotKeyWinDef(pc),a1 bsr StoreWinPos LNKLIB CloseWindow,_IntuitionBase .NoWindow tst.l HotKeyGadget ; Remove gadgets, if there beq.s .NoGadgets move.l HotKeyGadget(pc),a0 LNKLIB FreeGadgets,_GadToolsBase .NoGadgets tst.l HotKeyMenu ; Free GadTools-Menus beq.s .NoMenu move.l HotKeyMenu(pc),a0 LNKLIB FreeMenus,_GadToolsBase .NoMenu tst.l HotKeyVisInfo ; And free visual info beq.s .NoVisInfo move.l HotKeyVisInfo(pc),a0 LNKLIB FreeVisualInfo,_GadToolsBase .NoVisInfo move.l #0,HotKeyHandle move.l #0,HotKeySigFlag move.l #0,HotKeyGadget move.l #0,HotKeyVisInfo move.l #0,HotKeyMenu rts ********************************************************************** * Close the message window again * ********************************************************************** CloseLogWin tst.l LogHandle ; Close window again beq.s .NoWin move.l LogHandle(pc),a0 LNKLIB CloseWindow,_IntuitionBase .NoWin tst.l LogGadget beq.s .NoGads move.l LogGadget(pc),a0 LNKLIB FreeGadgets,_GadToolsBase .NoGads tst.l LogMenu ; Free GadTools-Menus beq.s .NoMenu move.l LogMenu(pc),a0 LNKLIB FreeMenus,_GadToolsBase .NoMenu tst.l LogVisInfo beq.s .NoVisInfo move.l LogVisInfo(pc),a0 LNKLIB FreeVisualInfo,_GadToolsBase .NoVisInfo move.l #0,LogHandle move.l #0,LogGadget move.l #0,LogVisInfo move.l #0,LogMenu rts ********************************************************************** * Wait until remakes on clockwindow are made * ********************************************************************** ClockRemake move.l ClockHandle(pc),a0 ; Wait until window popped up move.l wd_UserPort(a0),a0 CALLSYS WaitPort .Loop move.l ClockHandle(pc),a0 move.l wd_UserPort(a0),a0 DOLIB GetMsg tst.l d0 beq.s .End move.l d0,a1 DOLIB ReplyMsg bra.s .Loop .End rts ********************************************************************** * This is the routine to handle RAW-Mouse actions * ********************************************************************** RawEventAction CARGS CxMsg.l,CxObj.l move.l CxMsg(sp),a0 movem.l d0-d7/a1-a6,-(sp) LNKLIB CxMsgData,_CxBase tst.l d0 ; Got an event ? beq NoEvent move.l d0,a0 move.l a0,IEvent ; Store event address EventLoop move.l IEvent(pc),a0 moveq #0,d0 move.b ie_Class(a0),d0 move.w d0,IEClass ; Store class tst.b LeftyMouse ; We have to swap Buttonqualifiers beq.s .NoLeftyAll ; for every message if needed move.w ie_Qualifier(a0),d0 move.w d0,d1 btst #IEQUALIFIERB_RBUTTON,d1 ; Pressed right button ? beq.s .NoRight bset #IEQUALIFIERB_LEFTBUTTON,d0 ; Set left button press beq.s .CheckLeft .NoRight bclr #IEQUALIFIERB_LEFTBUTTON,d0 .CheckLeft btst #IEQUALIFIERB_LEFTBUTTON,d1 ; Pressed left button ? beq.s .NoLeft bset #IEQUALIFIERB_RBUTTON,d0 ; Set right button beq.s .SaveButton .NoLeft bclr #IEQUALIFIERB_RBUTTON,d0 .SaveButton move.w d0,ie_Qualifier(a0) .NoLeftyAll cmp.w #IECLASS_RAWMOUSE,IEClass ; Mouse moved ??? bne NoRawMouse tst.b LeftyMouse ; Swap buttoncodes for rawmouse beq.s .NoLeftyMouse move.l IEvent(pc),a0 move.w ie_Code(a0),d0 move.w d0,d1 and.w #$7f,d0 cmp.w #IECODE_LBUTTON,d0 beq.s .SwapButton cmp.w #IECODE_RBUTTON,d0 bne.s .NoLeftyMouse .SwapButton eor.w #1,d1 move.w d1,ie_Code(a0) .NoLeftyMouse tst.b DoActivate beq.s .End1 tst.b MouseMode beq.s .End1 bsr Activate ; Activate window if needed .End1 bsr ResetTimer tst.b ScrTimeOut beq.s .NoScr bsr OnScreen ; Activate screen if not blanked .NoScr tst.b MouseTimeOut ; Mouse still blanked ? bne.s .NoMouse bsr OnMouse ; Allways ctivate mouse .NoMouse move.b #0,MouseTimeOut ; Mouse and screen are not timed move.b #0,ScrTimeOut ; out anymore tst.b CycleWin ; Window-Cycling enabled ? beq NoTimerEvent move.l IEvent(pc),a1 move.w ie_Code(a1),d1 cmp.w #IECODE_LBUTTON,d1 ; Left button pressed ? bne.s .NoPopFront lea PopQualFlags(pc),a0 ; Get current qualifier move.l PopQualNum(pc),d0 asl.l #2,d0 move.w 0(a0,d0),d2 move.w ie_Qualifier(a1),d1 and.w d2,d1 bne.s .DoPopFront ; Left one pressed ? move.w 2(a0,d0),d2 move.w ie_Qualifier(a1),d1 and.w d2,d1 beq.s .NoPopFront ; Right one pressed ? .DoPopFront move.b #IECLASS_NULL,ie_Class(a1) ; Clear Event for other move.w #0,ie_Code(a1) move.w #0,ie_Qualifier(a1) bsr FindWindow ; Find window underneith layer tst.l d0 beq.s .NoPopFront ; No layer, no window move.l d0,a1 tst.l lr_ClipRect(a1) ; window hidden by others ? beq.s .NoPopFront ; Nope -> no movement to front move.l lr_ClipRect(a1),a1 tst.l cr_Next(a1) beq.s .NoPopFront ; REALLY ??? move.l d0,a0 move.l lr_Window(a0),a0 move.l wd_Flags(a0),d0 move.l d0,d1 and.l #WFLG_BACKDROP,d0 ; BackDrop window ??? bne.s .NoPopFront and.l #WFLG_DEPTHGADGET,d1 ; Does the window have a DEPTH-Gad ??? beq.s .NoPopFront ; Nope -> no pop to front LNKLIB WindowToFront,_IntuitionBase bra NoTimerEvent .NoPopFront move.l IEvent(pc),a1 move.w ie_Code(a1),d1 cmp.w #IECODE_RBUTTON,d1 ; Right button pressed ? bne.s .NoPopBack lea PopQualFlags(pc),a0 move.l PopQualNum(pc),d0 ; Get current qualifier asl.l #2,d0 move.w 0(a0,d0),d2 move.w ie_Qualifier(a1),d1 and.w d2,d1 ; Left one pressed ? bne.s .DoPopBack move.w 2(a0,d0),d2 move.w ie_Qualifier(a1),d1 and.w d2,d1 ; Right one pressed ? beq.s .NoPopBack .DoPopBack move.b #IECLASS_NULL,ie_Class(a1) ; Clear event for others move.w #0,ie_Code(a1) move.w #0,ie_Qualifier(a1) bsr FindWindow ; Find layer tst.l d0 beq.s .NoPopBack ; No layer, no window move.l d0,a0 move.l lr_Window(a0),a0 move.l wd_Flags(a0),d0 move.l d0,d1 and.l #WFLG_BACKDROP,d0 ; BackDrop window ? bne.s .NoPopBack and.l #WFLG_DEPTHGADGET,d1 ; DEPTH-Gad there ? beq.s .NoPopBack ; Nope -> go on LNKLIB WindowToBack,_IntuitionBase .NoPopBack bra NoTimerEvent NoRawMouse cmp.w #IECLASS_RAWKEY,IEClass ; Key pressed ??? bne NoRawKey move.l IEvent(pc),a1 ; If key released -> break move.w ie_Code(a1),d0 and.w #IECODE_UP_PREFIX,d0 bne NoTimerEvent move.l IEvent(pc),a0 lea ie_TimeStamp(a0),a0 ; Reset screen delay move.l TV_SECS(a0),d0 add.l ScreenTime(pc),d0 move.l d0,ScreenOff tst.b ScrTimeOut ; Screen blanked ? beq.s .NoScr bsr OnScreen ; UnBlank it .NoScr move.b #0,ScrTimeOut ; Screen timed out bsr OffMouse ; On key-press allways blank mouse tst.b DoActivate beq.s .End1 tst.b MouseMode bne.s .End1 bsr Activate ; Activate window if needed .End1 tst.b KeyClick ; Enabled Key-Click ? beq .NoClickYet move.l AudioReq(pc),a1 ; Request still running ? CALLSYS CheckIO tst.l d0 beq .NoClickYet ; Yep-> no click link a5,#-128 move.l IEvent(pc),a0 ; Convert RAW-Key lea -128(a5),a1 move.b #0,(a1) ; Clear previous keys move.l #128,d1 sub.l a2,a2 LNKLIB RawKeyConvert,_ConsoleBase ; Convert raw key lea -128(a5),a1 move.b (a1),d0 unlk a5 tst.b d0 ; No keys ? beq.s .NoClickYet cmp.b #$9b,d0 ; Initial ANSI-Code beq.s .NoClickYet ; No click cmp.b #$09,d0 ; TAB-Key pressed ? beq.s .NoClickYet move.l IEvent(pc),a1 ; Let it click tst.w ie_Code(a1) beq.s .NoClickYet tst.w AllocKey ; Lost allockey ? bne.s .ReClick ; Nope -> go on bsr AllocChannel ; Try to reallocate a channel tst.l d0 ; Failure ? beq.s .NoClickYet ; Yep -> sorry, no sound .ReClick move.l AudioReq(pc),a1 ; Let`s hear it for the click move.w #CMD_WRITE,IO_COMMAND(a1) move.b #ADIOF_PERVOL|ADIOF_NOWAIT,IO_FLAGS(a1) move.w #150,ioa_Period(a1) move.l ClickVol(pc),d0 move.w d0,ioa_Volume(a1) move.l #88,ioa_Length(a1) move.l #ClickData,ioa_Data(a1) move.w #1,ioa_Cycles(a1) move.l IO_DEVICE(a1),a6 jsr DEV_BEGINIO(a6) move.l AudioReq(pc),a1 ; Error ? tst.b IO_ERROR(a1) beq.s .NoClickYet bsr AllocChannel ; Yep -> so try to reget a channel .NoClickYet tst.b ESCClose ; ESC for closing windows ? beq .NoEscape move.l IEvent(pc),a1 ; Get event move.w ie_Code(a1),d0 ; Get code cmp.w #RESCKEY,d0 ; ESC pressed ? bne .NoEscape ; Nope -> go on lea PopQualFlags(pc),a0 move.l ESCQualNum(pc),d0 ; Get current qualifier asl.l #2,d0 move.w 0(a0,d0),d2 move.w ie_Qualifier(a1),d1 and.w d2,d1 ; Left one pressed ? bne.s .DoEscape move.w 2(a0,d0),d2 move.w ie_Qualifier(a1),d1 and.w d2,d1 ; Right one pressed ? beq .NoEscape .DoEscape bsr FindWindow ; Find window underneith mouse tst.l d0 ; No layer -> no close beq .NoEscape move.l d0,a0 move.l lr_Window(a0),a3 ; Not a window-layer ??? cmp.l #0,a3 beq .NoEscape ; Yep -> no close move.l wd_Flags(a3),d0 ; Window has a closegadget ? and.l #WFLG_CLOSEGADGET,d0 beq .NoEscape ; Nope -> go on tst.l wd_FirstRequest(a3) ; Requester visible ??? bne .NoEscape move.l a3,a0 ; Only active windows can be closed LNKLIB ActivateWindow,_IntuitionBase moveq #0,d7 ; Clear flag for GADGETUP move.l wd_FirstGadget(a3),a3 .CheckGads cmp.l #0,a3 ; Search for a selected gadget beq.s .GadsChecked move.w gg_Flags(a3),d0 and.w #GFLG_SELECTED,d0 beq.s .NotSelected move.l a3,d7 ; Got one bra.s .GadsChecked ; No other Gadget can be selected .NotSelected move.l gg_NextGadget(a3),a3 bra.s .CheckGads .GadsChecked link a5,#-ie_SIZEOF tst.l d7 ; If no selected gadget was found beq.s .NoGadgetUp ; -> go on lea -ie_SIZEOF(a5),a0 ; fill in Event structure move.l #0,ie_NextEvent(a0) move.b #IECLASS_GADGETUP,ie_Class(a0) move.b #0,ie_SubClass(a0) move.w #0,ie_Code(a0) move.w #0,ie_Qualifier(a0) move.l d7,ie_EventAddress(a0) ; Add address of gadget move.l IEvent(pc),a1 ; Copy time lea ie_TimeStamp(a1),a1 lea ie_TimeStamp(a0),a2 move.l TV_SECS(a1),TV_SECS(a2) move.l TV_MICRO(a1),TV_MICRO(a2) LNKLIB AddIEvents,_CxBase ; Add event .NoGadgetUp lea -ie_SIZEOF(a5),a0 ; fill in Event structure move.l #0,ie_NextEvent(a0) move.b #IECLASS_CLOSEWINDOW,ie_Class(a0) move.b #0,ie_SubClass(a0) move.w #0,ie_Code(a0) move.w #0,ie_Qualifier(a0) move.l #0,ie_EventAddress(a0) ; Add address of window move.l IEvent(pc),a1 ; Copy time lea ie_TimeStamp(a1),a1 lea ie_TimeStamp(a0),a2 move.l TV_SECS(a1),TV_SECS(a2) move.l TV_MICRO(a1),TV_MICRO(a2) LNKLIB AddIEvents,_CxBase ; Add event unlk a5 move.l IEvent(pc),a0 ; Clear this event, so that move.b #IECLASS_NULL,ie_Class(a0) ; CLI windows don`t get mixed up move.b #0,ie_SubClass(a0) ; and go away appropriately move.w #0,ie_Qualifier(a0) move.l #0,ie_EventAddress(a0) bra NoTimerEvent .NoEscape tst.b MapUmlaut ; Map "Umlauts" ? beq NoTimerEvent move.l IEvent(pc),a1 ; Check for "Umlauts" move.w ie_Code(a1),d0 lea UmlautTab,a3 ; Get UmlautTab moveq #3,d7 .GetUmlaut cmp.w (a3),d0 ; Got "Umlaut" ? beq.s .GotUmlaut ; Yep -> go on lea 12(a3),a3 ; Next one dbf d7,.GetUmlaut bra NoTimerEvent ; No "Umlaut" .GotUmlaut move.w ie_Qualifier(a1),d1 ; Get qualifier move.w d1,d0 ; Shifted ? and.w #(IEQUALIFIER_LSHIFT|IEQUALIFIER_RSHIFT),d0 beq.s .NoShift addq.l #6,a3 ; Get corresponding shifted char tst.w (a3) ; Skip shifted ß beq NoTimerEvent .NoShift link a5,#-(ie_SIZEOF*2) ; Get space for two IEs lea -(ie_SIZEOF*2)(a5),a4 move.b ie_SubClass(a1),d0 ; Get subclass move.l ie_EventAddress(a1),d2 ; Address lea ie_TimeStamp(a1),a2 move.l TV_SECS(a2),d3 ; And seconds move.l a4,d7 ; Link IEs add.l #ie_SIZEOF,d7 move.l d7,ie_NextEvent(a4) move.b #IECLASS_RAWKEY,ie_Class(a4) ; Set class move.b d0,ie_SubClass(a4) move.w 2(a3),ie_Code(a4) ; Get first char move.w d1,ie_Qualifier(a4) move.l d2,ie_EventAddress(a4) lea ie_TimeStamp(a4),a2 ; Set time for correct blanking move.l d3,TV_SECS(a2) move.l #0,TV_MICRO(a2) lea ie_SIZEOF(a4),a0 ; Clear link to next move.l #0,ie_NextEvent(a0) move.b #IECLASS_RAWKEY,ie_Class(a0) move.b d0,ie_SubClass(a0) move.w 4(a3),ie_Code(a0) ; Get second char for "Umlaut" move.w #0,ie_Qualifier(a0) move.l d2,ie_EventAddress(a0) lea ie_TimeStamp(a0),a2 addq.l #1,d3 move.l d3,TV_SECS(a2) ; One second past last event :-) move.l #0,TV_MICRO(a2) move.l a4,a0 LNKLIB AddIEvents,_CxBase ; Add events unlk a5 move.l IEvent(pc),a0 ; Clear current event move.b #IECLASS_NULL,ie_Class(a0) move.b #0,ie_SubClass(a0) move.w #0,ie_Qualifier(a0) move.l #0,ie_EventAddress(a0) bra NoTimerEvent NoRawKey cmp.w #IECLASS_TIMER,IEClass ; Timer event ? bne NoTimerEvent tst.b TimeReset ; Reset timers ? beq.s .NoTime ; (if times were altered) bsr ResetTimer bra NoTimerEvent .NoTime move.l IEvent(pc),a0 lea ie_TimeStamp(a0),a0 tst.l ScreenTime ; Screen to be blanked ? beq .NoScreenOff ; nope -> go on move.l ScreenOff(pc),d0 ; Screen timeout ? sub.l TV_SECS(a0),d0 bge .NoScreenOff ; Nope -> go on move.l TV_SECS(a0),d1 ; Set time for next timeout add.l ScreenTime(pc),d1 add.l #10,d1 move.l d0,ScreenOff move.b #1,ScrTimeOut ; Screen and mouse are timed out move.b #1,MouseTimeOut cmp.l #-10,d0 ; Within range of 10 ble.s .NoScreenOff tst.l BlankHandle ; Screen already blanked ? bne.s .End ; Yep -> pop it to front lea BlankScreenDef(pc),a0 ; Open dummy (Blank) screen LNKLIB OpenScreen,_IntuitionBase move.l d0,BlankHandle tst.l d0 beq.s NoTimerEvent move.l d0,a0 lea sc_ViewPort(a0),a0 ; Set all cols to black moveq #0,d0 moveq #0,d1 moveq #0,d2 moveq #0,d3 LNKLIB SetRGB4,_GfxBase DOLIB WaitTOF ; Delay the thingy move.b #0,SprOff ; ReBlank mouse pointer bsr OffMouse ; Disable mouse bra.s NoTimerEvent .End move.l BlankHandle(pc),a0 ; Get screen to front :-) LNKLIB ScreenToFront,_IntuitionBase move.b #0,SprOff ; ReBlank Mouse bsr.s OffMouse .NoScreenOff tst.l MouseTime ; Mouse to be blanked ? beq.s .NoMouseOff ; Nope -> go on move.l IEvent(pc),a0 ; Check, whether time for lea ie_TimeStamp(a0),a0 ; blank has come move.l MouseOff(pc),d0 sub.l TV_SECS(a0),d0 bge.s .NoMouseOff ; Nope -> go on move.l TV_SECS(a0),d1 ; Store new values for next add.l MouseTime(pc),d1 ; blank. addq.l #1,d1 move.l d1,MouseOff move.b #1,MouseTimeOut ; Only mouse is blanked now cmp.l #-10,d0 ; Timeout within range of ble.s .NoMouseOff ; about 10 bsr.s OffMouse ; Blank mouse .NoMouseOff NoTimerEvent move.l IEvent(pc),a0 ; Try to get next event linked move.l ie_NextEvent(a0),d0 ; to this one beq.s NoEvent ; No other one -> that`s it move.l d0,IEvent ; Store address bra EventLoop ; Loop NoEvent movem.l (sp)+,d0-d7/a1-a6 rts ********************************************************************** * Reset the timers * ********************************************************************** ResetTimer move.l IEvent(pc),a0 lea ie_TimeStamp(a0),a0 move.l TV_SECS(a0),d0 ; Get current seconds move.l d0,d1 add.l ScreenTime(pc),d0 ; add delay for screen blank move.l d0,ScreenOff add.l MouseTime(pc),d1 ; add delay for mouse blank move.l d1,MouseOff move.b #0,TimeReset rts ********************************************************************** * Blank the mouse * ********************************************************************** OffMouse CALLSYS Forbid ; Disable stuff for a while tst.b SprOff bne.s .NoSpr0 move.l _GfxBase(pc),a0 move.l gb_copinit(a0),a0 lea copinit_sprstrtup(a0),a0 ; Get pointer to copper-sprite-list moveq #7,d7 ; Check for 8 Sprite-Ptrs .Spr0Loop cmp.w #$0120,(a0) bne.s .FindSpr0 cmp.w #$0122,4(a0) beq.s .GotSpr0 .FindSpr0 addq.l #8,a0 bra.s .Spr0Loop .GotSpr0 lea OldSprite,a1 ; Store old pointer to sprite move.w 2(a0),(a1)+ move.w 6(a0),(a1) move.l #NoSpriteDat,d0 ; We would like to have a move.w d0,6(a0) ; blank sprite swap d0 move.w d0,2(a0) .NoSpr0 CALLSYS Permit ; Reenable things rts ********************************************************************** * UnBlank mouse * ********************************************************************** OnMouse CALLSYS Forbid move.l _GfxBase,a0 move.l gb_copinit(a0),a0 lea copinit_sprstrtup(a0),a0 moveq #7,d7 ; Check for 8 Sprite-Ptrs .Spr0Loop cmp.w #$0120,(a0) bne.s .FindSpr0 cmp.w #$0122,4(a0) beq.s .GotSpr0 .FindSpr0 addq.l #8,a0 bra.s .Spr0Loop .GotSpr0 lea OldSprite(pc),a1 tst.w (a1) blt.s .NoSpr0 move.w (a1)+,2(a0) ; Restore old pointer move.w (a1),6(a0) .NoSpr0 CALLSYS Permit rts ********************************************************************** * UnBlank screen * ********************************************************************** OnScreen tst.l BlankHandle ; Close blank-screen if there beq.s .End move.l BlankHandle(pc),a0 LNKLIB CloseScreen,_IntuitionBase LNKLIB WaitTOF,_GfxBase ; a little delay move.l #0,BlankHandle .End rts ********************************************************************** * This is the activation-routine * ********************************************************************** Activate bsr FindWindow tst.l d0 beq.s .NotAct movem.l d0/a0,-(sp) moveq #0,d0 LNKLIB LockIBase,_IntuitionBase move.l d0,MyILock movem.l (sp)+,d0/a0 move.l ActWindow(pc),a1 tst.l wd_FirstRequest(a1) ; active window got a requester ? beq.s .GoOn ; No -> go on sub.l a0,a0 ; Yep -> no activation bra.s .GotWindow .GoOn move.l sc_FirstWindow(a0),a0 ; Get first window of screen .CheckWindows cmp.l #0,a0 beq.s .WindowOK bsr.s CheckWinGads ; Checks Gadgets within window cmp.l #0,a0 beq.s .GotWindow move.l wd_NextWindow(a0),a0 ; Get next window bra.s .CheckWindows ; Check all windows on screen .WindowOK move.l d0,a0 move.l lr_Window(a0),a0 cmp.l ActWindow(pc),a0 ; Window already active ? bne.s .GotWindow ; -> don`t activate sub.l a0,a0 .GotWindow move.l a0,-(sp) move.l MyILock(pc),a0 DOLIB UnlockIBase move.l (sp)+,a0 cmp.l #0,a0 beq.s .NotAct DOLIB ActivateWindow ; activate window .NotAct rts ********************************************************************** * Checks for any active gadgets within a window * ********************************************************************** CheckWinGads movem.l d1/a1,-(sp) move.l wd_FirstGadget(a0),a1 ; First gadget of window .CheckGadgets cmp.l #0,a1 beq.s .GadgetsChecked move.w gg_GadgetType(a1),d1 ; Is it a string-gadget ? and.w #STRGADGET,d1 beq.s .NoStrGad ; No -> go on move.w gg_Flags(a1),d1 ; Is it selected ? and.w #SELECTED,d1 bne.s .NoWindow ; Yep -> No more actions .NoStrGad move.l gg_NextGadget(a1),a1 ; Check all gads in window bra .CheckGadgets .NoWindow sub.l a0,a0 .GadgetsChecked movem.l (sp)+,d1/a1 rts ********************************************************************** * Find underneith mousepointer * ********************************************************************** FindWindow moveq #0,d0 ; Lock Intuition-Base LNKLIB LockIBase,_IntuitionBase move.l d0,MyILock move.l _IntuitionBase(pc),a0 moveq #0,d0 moveq #0,d1 move.w ib_MouseX(a0),d0 ; Get mouse-koords move.w ib_MouseY(a0),d1 move.l d0,MouseX move.l d1,MouseY move.l ib_ActiveWindow(a0),ActWindow ; Is a requester active on move.l ib_FirstScreen(a0),a0 CheckScreens move.l MouseX(pc),d0 move.l MouseY(pc),d1 lea sc_ViewPort(a0),a1 move.w vp_Modes(a1),d2 move.w d2,d3 ; Recalc mouse-coords and.w #V_HIRES,d3 ; for screen-resolution bne.s IsHires asr.l #1,d0 IsHires and.w #V_LACE,d2 bne.s IsLace asr.l #1,d1 IsLace movem.l a0/a1/d1,-(sp) ; Check layer moveq #0,d2 move.w vp_DxOffset(a1),d2 ; Offset of screen sub.l d2,d0 move.w vp_DyOffset(a1),d2 sub.l d2,d1 lea sc_LayerInfo(a0),a0 LNKLIB WhichLayer,_LayersBase movem.l (sp)+,a0/a1/d1 tst.l d0 bne.s GotLayer move.l sc_NextScreen(a0),a0 ; Next Screen cmp.l #0,a0 ; No more screens ? beq.s ScreenError ; Error bra CheckScreens ; Find screen ScreenError moveq #0,d0 GotLayer movem.l d0/a0,-(sp) move.l MyILock(pc),a0 ; UnLock IntuitionBase LNKLIB UnlockIBase,_IntuitionBase move.l #0,MyILock movem.l (sp)+,d0/a0 rts ********************************************************************** * Signal the timer process to remake the time * ********************************************************************** SigTime move.l CheckerProc(pc),a1 move.l #SIGTIMEREMAKE,d0 CALLSYS Signal rts ********************************************************************** * Display new time * ********************************************************************** SetTime lea MyDateTime(pc),a0 ; Get datestamp move.l a0,d1 LNKLIB DateStamp,_DOSBase lea MyDateTime(pc),a0 ; Do the string formatings move.b #FORMAT_DOS,dat_Format(a0) move.l #RevDayString,dat_StrDay(a0) ; First create the whole string move.l #RevDateString,dat_StrDate(a0) ; for revision move.l #RevTimeString,dat_StrTime(a0) move.l a0,d1 DOLIB DateToStr lea MyDateTime(pc),a0 ; Do the string formatings tst.b AmiDate beq.s .Loop1 move.b #FORMAT_USA,dat_Format(a0) ; Set american date format bra.s .Loop2 .Loop1 move.b #FORMAT_CDN,dat_Format(a0) ; Set "canadian" date format .Loop2 move.b #0,dat_Flags(a0) move.l #AllDayString,dat_StrDay(a0) ; First create the whole string move.l #AllDateString,dat_StrDate(a0) ; for environment variables move.l #AllTimeString,dat_StrTime(a0) move.l a0,d1 DOLIB DateToStr tst.b SetEnv ; Write env vars beq.s NoEnvTime move.l #EnvDayString,d1 ; set env vars move.l #AllDayString,d2 moveq #-1,d3 move.l #GVF_GLOBAL_ONLY,d4 DOLIB SetVar tst.l d0 beq.s .Error move.l #EnvDateString,d1 move.l #AllDateString,d2 moveq #-1,d3 move.l #GVF_GLOBAL_ONLY,d4 DOLIB SetVar tst.l d0 beq.s .Error move.l #EnvTimeString,d1 move.l #AllTimeString,d2 moveq #-1,d3 move.l #GVF_GLOBAL_ONLY,d4 DOLIB SetVar tst.l d0 bne.s NoEnvTime .Error move.b #0,SetEnv ; Disable setenv if errors moveq #0,d0 ; occured move.l #ENVGAD,d1 bsr SetControlBox NoEnvTime move.b #0,DayString ; clear previous strings move.b #0,DateString move.b #0,TimeString lea MyDateTime(pc),a0 tst.b ShowDay ; Now create the rest for clock beq.s .Loop3 ; display move.l #DayString,dat_StrDay(a0) bra.s .Loop4 .Loop3 move.l #0,dat_StrDay(a0) .Loop4 tst.b ShowDate ; Are we to show a date ? beq.s .Loop5 move.l #DateString,dat_StrDate(a0) ; Yep bra.s .Loop6 .Loop5 move.l #0,dat_StrDate(a0) ; Nope .Loop6 move.l #TimeString,dat_StrTime(a0) move.l a0,d1 DOLIB DateToStr tst.l d0 beq NoTime bsr CheckForAlarm ; Are we to alarm ? tst.b ShowClock ; Show clock ? beq NoTime tst.l PageNum ; Display normal time ? bgt.s NoClockDisp lea TimeFormats,a0 ; Change to different tst.b ShortDay ; time format strings beq.s .Loop7 addq.l #8,a0 ; Use the ones with long days .Loop7 tst.b ShowSecs bne.s .Loop8 addq.l #4,a0 ; use the one without secs .Loop8 move.l (a0),a0 lea FormatData(pc),a1 lea PutChProc(pc),a2 lea FinalString(pc),a3 CALLSYS RawDoFmt bsr MakeDisplay ; Display the stuff bra NoTime NoClockDisp cmp.l #DMEMPAGE,PageNum ; Display Chip/Fast mem seperately ? bne.s NoDoubleMem move.l #MEMF_CHIP,d1 ; Get available memory CALLSYS AvailMem move.l d0,ChipMem move.l #MEMF_FAST,d1 DOLIB AvailMem move.l d0,FastMem lea FormMemString,a0 ; Format string lea ChipMem,a1 lea PutChProc(pc),a2 lea FinalString(pc),a3 DOLIB RawDoFmt bsr MakeDisplay ; Display bra NoTime NoDoubleMem cmp.l #TMEMPAGE,PageNum ; Display total memory ? bne.s NoTotalMem move.l #MEMF_CHIP,d1 ; Calc total memory CALLSYS AvailMem move.l d0,d7 move.l #MEMF_FAST,d1 DOLIB AvailMem add.l d0,d7 move.l d7,TotalMem lea FormTMemString,a0 lea TotalMem,a1 lea PutChProc(pc),a2 lea FinalString(pc),a3 DOLIB RawDoFmt bsr MakeDisplay bra NoTime NoTotalMem cmp.l #GMEMPAGE,PageNum ; Display fillgauge bne NoGfxMem link a5,#-4 bsr LockScreen tst.l d0 bne.s .GoOn move.l #0,PageNum bra NoGfxMem .GoOn move.l MyRastPort(pc),a1 moveq #1,d0 LNKLIB SetRast,_GfxBase move.l #MEMF_CHIP,d1 ; Calc total memory CALLSYS AvailMem move.l d0,d7 move.l #MEMF_FAST,d1 DOLIB AvailMem add.l d7,d0 move.l MaxMem,d7 sub.l d0,d7 move.l MyRastPort(pc),a1 ; Get length of E and F lea EString(pc),a0 ; chars moveq #1,d0 LNKLIB TextLength,_GfxBase move.l d0,EWidth move.l d0,d5 move.l MyRastPort(pc),a1 lea FString(pc),a0 moveq #1,d0 DOLIB TextLength move.l d0,FWidth add.l d5,d0 ; d0 length of both add.l #MAXBARLEN,d0 addq.l #4,d0 move.l d0,BlitWidth moveq #0,d2 move.l -4(a5),a0 move.w sc_Width(a0),d2 sub.l #DEPTHWIDTH,d2 sub.l d0,d2 move.l d2,LeftEdge move.l #MAXBARLEN,d0 ; Get maximum length of bar move.l d7,d1 bsr _mulu move.l MaxMem,d1 bsr _divu move.l d0,d5 ; D5 = Length of gauge move.l MyRastPort(pc),a1 moveq #2,d0 LNKLIB SetAPen,_GfxBase move.l MyRastPort(pc),a1 ; Write E moveq #0,d1 move.l MyFont(pc),a0 move.w tf_Baseline(a0),d1 moveq #0,d0 DOLIB Move move.l MyRastPort(pc),a1 lea EString(pc),a0 moveq #1,d0 DOLIB Text tst.b ClockWin ; Window enabled ? bne.s .End ; Yep -> no title colors move.l MyRastPort(pc),a1 ; Draw "non-filled" rec moveq #0,d0 DOLIB SetAPen move.l MyRastPort(pc),a1 move.l EWidth(pc),d0 addq.l #2,d0 moveq #0,d1 move.l d0,d2 add.l #MAXBARLEN,d2 moveq #0,d3 move.l MyFont(pc),a0 move.w tf_YSize(a0),d3 subq.l #1,d3 DOLIB RectFill .End move.l MyRastPort(pc),a1 ; Draw gauge tst.b ClockWin beq.s .InTitle moveq #2,d0 bra.s .SetPen .InTitle moveq #3,d0 .SetPen DOLIB SetAPen move.l MyRastPort(pc),a1 move.l EWidth(pc),d0 addq.l #2,d0 moveq #0,d1 move.l d5,d2 add.l d0,d2 moveq #0,d3 move.l MyFont(pc),a0 move.w tf_YSize(a0),d3 subq.l #1,d3 DOLIB RectFill move.l MyRastPort(pc),a1 ; Draw F moveq #2,d0 DOLIB SetAPen move.l MyRastPort(pc),a1 move.l EWidth(pc),d0 addq.l #4,d0 add.l #MAXBARLEN,d0 move.l MyFont(pc),a0 moveq #0,d1 move.w tf_Baseline(a0),d1 DOLIB Move move.l MyRastPort(pc),a1 lea FString(pc),a0 moveq #1,d0 DOLIB Text move.l MyRastPort(pc),a1 ; Reset color for our RastPort moveq #0,d0 DOLIB SetAPen tst.b ClockWin ; Window active ? beq.s TitleGauge tst.l ClockHandle ; Window already there ? bne.s .Clear lea ClockWinDef(pc),a0 ; No window title move.l #0,nw_Title(a0) move.l BlitWidth(pc),d6 bsr OpenClockWin tst.l d0 beq NoTime bra.s .NoClear .Clear move.l ClockHandle(pc),a0 tst.l wd_Title(a0) ; Window-Title already cleard ? beq.s .NoClear sub.l a1,a1 ; Clear window-title move.l #-1,a2 LNKLIB SetWindowTitles,_IntuitionBase .NoClear move.l ClockHandle(pc),a1 ; Blit gauge into window-title move.l wd_RPort(a1),a1 move.l #DEPTHWIDTH,d2 bra.s DoGauge TitleGauge bsr CloseClockWin move.l -4(a5),a1 ; Blit gauge into title/window move.l sc_BarLayer(a1),a1 move.l lr_rp(a1),a1 move.l LeftEdge(pc),d2 DoGauge move.l MyRastPort(pc),a0 moveq #0,d0 moveq #0,d1 move.l #1,d3 move.l BlitWidth(pc),d4 moveq #0,d5 move.w BitMapHeight(pc),d5 move.l #$c0,d6 LNKLIB ClipBlit,_GfxBase bsr UnlockScreen unlk a5 bra.s NoTime NoGfxMem cmp.l #ONLINEPAGE,PageNum ; Display online-time ? bne.s NoTime ; Nope -> go on lea OnlineFormStr(pc),a0 ; Copy online string lea FinalString(pc),a1 bsr StrCpy lea OnlineString(pc),a0 ; Concat time string lea FinalString(pc),a1 bsr StrCat bsr.s MakeDisplay NoTime rts ********************************************************************** * Make up the display for clock/memory * ********************************************************************** MakeDisplay lea FinalString(pc),a0 ; Get length of time string bsr StrLen move.l d0,d7 move.l MyRastPort(pc),a1 ; Get width of string (pixels) LNKLIB TextLength,_GfxBase move.l d0,d6 tst.b ClockWin ; Display in window ? beq.s DisplayInTitle ; Nope -> do it in title bsr OpenClockWin tst.l d0 beq NoDisplay move.l ClockHandle(pc),a0 ; Set new title of window lea FinalString(pc),a1 move.l #-1,a2 LNKLIB SetWindowTitles,_IntuitionBase rts DisplayInTitle link a5,#-4 bsr LockScreen tst.l d0 beq NoDisplay movem.l d6/d7,-(sp) ; store width/length of string bsr CloseClockWin move.l MyRastPort(pc),a1 ; Clear rastport moveq #1,d0 LNKLIB SetRast,_GfxBase moveq #0,d1 ; Move cursor to position move.l MyFont(pc),a0 move.w tf_Baseline(a0),d1 move.l MyRastPort(pc),a1 moveq #0,d0 DOLIB Move movem.l (sp)+,d6/d7 move.l MyRastPort(pc),a1 ; Draw string lea FinalString(pc),a0 move.l d7,d0 DOLIB Text moveq #0,d2 move.l -4(a5),a0 move.w sc_Width(a0),d2 ; Get width of screen sub.l #DEPTHWIDTH,d2 ; Skip depth gadget sub.l d6,d2 ; Skip width of string move.l d2,LeftEdge ; Store new X-Position in TitleBar move.l d6,d4 add.w #DEPTHWIDTH,d6 cmp.w BitMapWidth(pc),d6 ; If width to be blitted is ble.s .End ; > Plane width : Skip some pixels move.w BitMapWidth(pc),d4 sub.w #DEPTHWIDTH,d4 .End move.l d4,BlitWidth ; Store width of string move.l MyRastPort(pc),a0 ; Blit our rastport into moveq #0,d0 ; rastport of layer which moveq #0,d1 ; is the titlebar move.l -4(a5),a1 move.l sc_BarLayer(a1),a1 move.l lr_rp(a1),a1 move.l #1,d3 moveq #0,d5 move.w BitMapHeight(pc),d5 move.l #$c0,d6 DOLIB ClipBlit NoDisplay bsr UnlockScreen unlk a5 rts ********************************************************************** * Clears the workbench titlebar * ********************************************************************** ClearTitleBar link a5,#-4 bsr LockScreen tst.l d0 beq.s .End move.l MyRastPort(pc),a1 moveq #1,d0 ; Clear rastport LNKLIB SetRast,_GfxBase move.l MyRastPort(pc),a0 ; Blit moveq #0,d0 ; to restore titlebar shape moveq #0,d1 move.l -4(a5),a1 move.l sc_BarLayer(a1),a1 move.l lr_rp(a1),a1 move.l LeftEdge(pc),d2 move.l #1,d3 moveq #0,d5 move.w BitMapHeight(pc),d5 move.l BlitWidth(pc),d4 move.l #$c0,d6 DOLIB ClipBlit .End bsr UnlockScreen unlk a5 rts ********************************************************************** * Routine for keeping up the correct online time * ********************************************************************** CheckOnline lea FormAlarmSStr(pc),a0 ; Create Onlinetime lea OnlineHour(pc),a1 lea PutChProc(pc),a2 lea OnlineString(pc),a3 CALLSYS RawDoFmt tst.b Online ; Already online ? bne StillOnline lea $bfd000,a5 btst #CIAB_COMCD,ciapra(a5) bne NotOnline move.b #1,Online ; Reset flags move.l #0,OnlineHour move.l #0,OnlineMinute move.l #3,OnlineSeconds ; We already have a connect of about 3 secs move.l #0,NextUnit move.l #1,UnitsDone move.l #0,TotalCost lea AllTimeString(pc),a0 ; Copy current time and date lea LogInTime(pc),a1 bsr StrCpy lea AllDateString(pc),a0 lea LogInDate(pc),a1 bsr StrCpy lea AllTimeString+6(pc),a0 lea CopyTime(pc),a1 bsr StrCpy tst.b BillPopUp beq.s StillOnline tst.l BillHandle beq.s .GoOn move.b #1,NoBillPopDown .GoOn movem.l RegsAll,-(sp) bsr OpenBillWin movem.l (sp)+,RegsAll StillOnline lea $bfd000,a5 btst #CIAB_COMCD,ciapra(a5) ; Still online ? beq .GoOn move.b #0,Online ; Nope.... tst.b LogCalls ; Save log to file ? beq .NoReenable move.w #'N',d0 ; Set char for either normal tst.b CheapMode beq.s .NoCheap move.w #'C',d0 ; ... or cheap mode .NoCheap move.w d0,LogEntryTariff move.l #0,CostMajor ; Calc total costs move.l #0,CostMinor move.l TotalCost(pc),d0 .CostLoop cmp.l #100,d0 blt.s .CostEnd sub.l #100,d0 addq.l #1,CostMajor bra.s .CostLoop .CostEnd move.l d0,CostMinor link a5,#-LOGENTRYSIZE ; Get Buffer for log-entry lea LogEntryFormat(pc),a0 ; Format log entry lea LogEntryDat(pc),a1 lea PutChProc(pc),a2 lea -LOGENTRYSIZE(a5),a3 CALLSYS RawDoFmt move.l #LogFileName,d1 ; Open log file move.l #MODE_READWRITE,d2 LNKLIB Open,_DOSBase tst.l d0 beq.s .NoLogWrite move.l d0,d7 move.l d0,d1 moveq #0,d2 move.l #OFFSET_END,d3 ; Seek to end DOLIB Seek lea -LOGENTRYSIZE(a5),a0 move.l d7,d1 move.l a0,d2 ; Write new logentry DOLIB FPuts move.l d7,d1 DOLIB Close .NoLogWrite unlk a5 .NoReenable tst.b BillPopUp beq.s .EndLogOff tst.b NoBillPopDown bne.s .EndLogOff bsr CloseBillWin .EndLogOff move.b #0,NoBillPopDown bra NotOnline .GoOn move.b #1,Online ; Yep, we`re online link a5,#-4 lea -4(a5),a4 lea AllTimeString+6(pc),a0 ; Get current seconds move.l a0,d1 move.l a4,d2 LNKLIB StrToLong,_DOSBase move.l d1,d7 ; Convert to long lea CopyTime(pc),a0 ; Get last seconds move.l a0,d1 move.l a4,d2 DOLIB StrToLong ; Convert to long unlk a5 moveq #0,d0 .GetValue cmp.l d1,d7 ; Got seconds elapsed ? beq.s .GotValue ; Yep -> go on addq.l #1,d0 ; One more second done addq.l #1,d1 cmp.l #60,d1 ; Over 60 boundary ? bne.s .GetValue moveq #0,d1 ; Restart from scratch bra.s .GetValue .GotValue add.l d0,OnlineSeconds ; Remake online time cmp.l #60,OnlineSeconds ; One minute done ? blt.s .End ; Nope -> go on sub.l #60,OnlineSeconds addq.l #1,OnlineMinute cmp.l #60,OnlineMinute ; One our online ? GOSH bne.s .End ; Nope -> go on move.l #0,OnlineMinute addq.l #1,OnlineHour .End lea AllTimeString+6(pc),a0 ; Copy current time lea CopyTime(pc),a1 bsr StrCpy subq.l #1,NextUnit addq.l #1,UnitsDone NotOnline bsr.s RemakeCosts rts ********************************************************************** * Remake texts within Bill window * ********************************************************************** RemakeCosts tst.b Online ; Are we online ? beq.s .NotOnline tst.l NextUnit ; Next unit bgt.s .NotOnline ; Nope... move.l TimeZone(pc),d0 ; Get timezone asl.l #3,d0 lea CostUnit1(pc),a0 tst.b CheapMode beq.s .Normal move.l cu_Cheap(a0,d0),d0 ; Get costs for cheap mode bra.s .GoOn .Normal move.l cu_Normal(a0,d0),d0 ; or for normal mode .GoOn move.l d0,NextUnit ; Store for next unit calc move.l CostUnit(pc),d0 ; Remake costs add.l d0,TotalCost bsr DisplayCost .NotOnline tst.b DoRemakeCosts beq.s .NoCostRemake move.b #0,DoRemakeCosts move.l TimeZone(pc),d0 ; Changed time/cheap mode ? lea CostUnit1(pc),a0 asl.l #3,d0 tst.b CheapMode beq.s .RemNormal move.l cu_Cheap(a0,d0),d0 ; Get new time bra.s .GoOnRemake .RemNormal move.l cu_Normal(a0,d0),d0 .GoOnRemake move.l UnitsDone(pc),d2 divu d0,d2 and.l #$0000ffff,d2 tst.b Online beq.s .NoInitial tst.l TotalCost bne.s .DoInitial .DoInitial addq.l #1,d2 ; D2 = Number of units done for new time .NoInitial move.l CostUnit(pc),d3 mulu d3,d2 ; Get new costs for new time move.l d2,TotalCost ; Store costs move.l UnitsDone(pc),d2 ; Units done divu d0,d2 ; Calc overlap for next unit clr.w d2 swap d2 sub.l d2,d0 ; D0 = Event for next unit bge.s .NoSubUnit ; On negative value neg.l d0 ; make it positive .NoSubUnit move.l d0,NextUnit bsr DisplayCost .NoCostRemake move.l #0,CostMajor move.l #0,CostMinor move.l TimeZone(pc),d0 ; Calc total costs asl.l #3,d0 lea CostUnit1(pc),a0 lea 0(a0,d0),a0 tst.b CheapMode beq.s .StillNormal move.l cu_Cheap(a0),d1 ; either for cheap mode bra.s .StillCheap .StillNormal move.l cu_Normal(a0),d1 ; or for normal mode .StillCheap move.l #3600,d0 divu d1,d0 and.l #$0000ffff,d0 ; d0 = Number of units/hour move.l CostUnit(pc),d1 mulu d1,d0 ; d0 = costs/hour .TotLoop cmp.l #100,d0 ; convert value blt.s .EndLoop sub.l #100,d0 addq.l #1,CostMajor bra.s .TotLoop .EndLoop move.l d0,CostMinor lea PerHourForm(pc),a0 ; Convert values to string lea CostMajor(pc),a1 lea PutChProc(pc),a2 lea PerHourBuff(pc),a3 CALLSYS RawDoFmt tst.l BillHandle beq.s NoCostCalc move.l BillHandle(pc),a0 ; Print out texts moveq #0,d1 move.b wd_BorderTop(a0),d1 move.l BillRPort(pc),a0 lea BillVarStrings(pc),a1 moveq #0,d0 LNKLIB PrintIText,_IntuitionBase NoCostCalc rts ********************************************************************** * Display new costs of telefone call * ********************************************************************** DisplayCost move.l TotalCost(pc),d0 move.l #0,CostMajor move.l #0,CostMinor .Loop cmp.l #100,d0 ; Calc costs blt.s .LoopEnd sub.l #100,d0 addq.l #1,CostMajor bra.s .Loop .LoopEnd move.l d0,CostMinor lea CostFormString(pc),a0 ; Convert values lea CostMajor(pc),a1 lea PutChProc(pc),a2 lea CostString(pc),a3 CALLSYS RawDoFmt rts ********************************************************************** * Display the total sum of phone calls * ********************************************************************** DisplayTotalSum move.l #LogFileName,d1 ; First check size of file move.l #ACCESS_READ,d2 LNKLIB Lock,_DOSBase move.l d0,d7 tst.l d0 ; IS IT THERE ? bne.s .GotFile rts .GotFile link a5,#-fib_SIZEOF ; Get FIB lea -fib_SIZEOF(a5),a0 move.l d7,d1 ; Get FileInfo move.l a0,d2 DOLIB Examine move.l d7,d1 DOLIB UnLock ; Unlock file lea -fib_SIZEOF(a5),a0 ; Check size tst.l fib_Size(a0) ; on zero quit bne.s .SizeOk unlk a5 rts .SizeOk unlk a5 link a5,#-(LOGENTRYSIZE*2) ; Get buffer for a log-entry move.l #LogFileName,d1 ; Open Log file move.l #MODE_OLDFILE,d2 DOLIB Open move.l d0,FileHand tst.l d0 beq .EndTotSum move.l #ConWinDef,d1 ; Open CON: Window move.l #MODE_OLDFILE,d2 DOLIB Open move.l d0,TempHand tst.l d0 beq .EndTotSum move.l TempHand(pc),d1 move.l #ClearStr,d2 move.l #ClearStrLen,d3 DOLIB Write moveq #0,d7 ; Clear linenumber moveq #0,d5 move.l d7,BillMajor ; and cost move.l d7,BillMinor move.l d7,BillTotalCost move.l d7,BillDayCost .SumLoop move.l FileHand(pc),d1 ; Get one line lea -(LOGENTRYSIZE*2)(a5),a0 move.l a0,d2 move.l #(LOGENTRYSIZE*2)-1,d3 DOLIB FGets tst.l d0 bne.s .GoOn bsr DisplayDaySum ; Display final day costs moveq #-1,d7 ; Indicate end of file bra.s .EndOfAll .GoOn bsr CheckDay move.l TempHand(pc),d1 ; Display line lea -(LOGENTRYSIZE*2)(a5),a0 move.l a0,d2 DOLIB FPuts lea -(LOGENTRYSIZE*2)(a5),a4 ; Get start of major-cost lea 72(a4),a4 move.l a4,a3 .LoopMinor cmp.b #'.',(a3)+ ; find period beq.s .GotMinor bra.s .LoopMinor .GotMinor move.b #0,-1(a3) ; Extract minor cost move.b #0,2(a3) move.l a4,d1 move.l #BillMajor,d2 DOLIB StrToLong tst.l d0 ble .EndTotSum mulu #100,d1 move.l d1,d6 ; Get costs move.l a3,d1 move.l #BillMinor,d2 DOLIB StrToLong tst.l d0 ble .EndTotSum add.l d1,d6 ; .... add.l d6,BillTotalCost add.l d6,BillDayCost addq.l #1,d7 ; One line done cmp.l #12,d7 ; 12 lines done ? blt .SumLoop moveq #0,d7 ; Reset line number .EndOfAll tst.l d7 ; All lines done ? beq.s .NoFinalCost move.l BillTotalCost(pc),d6 divu #100,d6 move.w d6,d5 swap d6 ext.l d6 move.l d6,BillMinor ext.l d5 move.l d5,BillMajor lea FinalCostForm(pc),a0 ; Format final cost string lea BillMajor(pc),a1 lea PutChProc(pc),a2 lea -(LOGENTRYSIZE*2)(a5),a3 CALLSYS RawDoFmt move.l TempHand(pc),d1 ; Display string lea -(LOGENTRYSIZE*2)(a5),a0 move.l a0,d2 LNKLIB FPuts,_DOSBase .NoFinalCost move.l TempHand(pc),d1 ; Display prompt move.l #PressKey,d2 move.l #PressKeyLen,d3 DOLIB Write move.l TempHand(pc),d1 ; Wait for return DOLIB FGetC tst.l d7 blt.s .EndTotSum bra .SumLoop .EndTotSum unlk a5 ; Free buffer tst.l FileHand ; Close files beq.s .NoFileHand move.l FileHand(pc),d1 DOLIB Close .NoFileHand tst.l TempHand beq.s .NoTempHand move.l TempHand(pc),d1 DOLIB Close .NoTempHand move.l #0,TempHand move.l #0,FileHand rts ********************************************************************** * Check for a difference in dates * ********************************************************************** CheckDay move.l d7,d6 ; Store old line number tst.b d5 ; First day read ? beq.s .FirstDay lea -(LOGENTRYSIZE*2)(a5),a0 ; Compare dates lea BillDayStr(pc),a1 moveq #7,d7 bsr StrCmp tst.l d0 beq.s .End ; On equal -> go on bsr.s DisplayDaySum ; Display sum for a day .FirstDay lea -(LOGENTRYSIZE*2)(a5),a0 ; Copy date to buffer lea BillDayStr(pc),a1 moveq #7,d7 bsr StrNCpy moveq #1,d5 ; Set flag .End move.l d6,d7 rts ********************************************************************** * Display the sum for a day * ********************************************************************** DisplayDaySum movem.l RegsAll,-(sp) link a5,#-(LOGENTRYSIZE*2) ; Get buffer for a line move.l BillDayCost(pc),d3 ; Get costs divu #100,d3 ; convert `em move.w d3,d4 swap d3 ext.l d3 move.l d3,BillMinor ext.l d4 move.l d4,BillMajor lea DayCostForm(pc),a0 ; Format string lea BillDayPtr(pc),a1 lea PutChProc(pc),a2 lea -(LOGENTRYSIZE*2)(a5),a3 CALLSYS RawDoFmt move.l #0,BillDayCost move.l TempHand(pc),d1 ; Make it appear lea -(LOGENTRYSIZE*2)(a5),a0 move.l a0,d2 LNKLIB FPuts,_DOSBase addq.l #3,d6 ; three more lines written unlk a5 movem.l (sp)+,RegsAll rts ********************************************************************** * Check the entered alarmtime * ********************************************************************** CheckAlarmTime movem.l RegsAll,-(sp) link a5,#-ALARMTIMESIZE ; Get buffer for alarmtime lea -ALARMTIMESIZE(a5),a1 bsr StrCpy lea -ALARMTIMESIZE(a5),a0 cmp.b #':',2(a0) ; Is a : at correct place ? bne TimeError move.b #0,2(a0) lea 3(a0),a1 ; A1 = Pointer to minutes sub.l a2,a2 move.l #-1,AlarmSecs cmp.b #':',5(a0) ; Seconds entered ? bne.s NoSecs ; Nope -> leave them alone move.b #0,5(a0) lea 6(a0),a2 ; A2 = Pointer to secs move.l a2,a3 bsr CheckDigits tst.l d0 bne TimeError NoSecs move.l a0,a3 ; Check if digits are ok bsr CheckDigits tst.l d0 bne TimeError move.l a1,a3 bsr CheckDigits tst.l d0 bne TimeError movem.l a1/a2,-(sp) ; Convert strings to longs move.l a0,d1 move.l #AlarmHour,d2 LNKLIB StrToLong,_DOSBase movem.l (sp)+,a1/a2 move.l a2,-(sp) move.l a1,d1 move.l #AlarmMins,d2 DOLIB StrToLong move.l (sp)+,a2 lea FormAlarmNSStr(pc),a0 cmp.l #0,a2 ; Skip secs if wanted beq.s NoNeedSecs move.l a2,d1 move.l #AlarmSecs,d2 DOLIB StrToLong lea FormAlarmSStr(pc),a0 cmp.l #59,AlarmSecs ble.s NoNeedSecs sub.l #60,AlarmSecs ; Correct Seconds NoNeedSecs cmp.l #23,AlarmHour ble.s HourOk sub.l #24,AlarmHour ; Correct hour bra.s NoNeedSecs HourOk cmp.l #59,AlarmMins ble.s MinsOk sub.l #60,AlarmMins ; Correct minutes MinsOk lea AlarmHour(pc),a1 ; Reformat string lea PutChProc(pc),a2 lea -ALARMTIMESIZE(a5),a3 CALLSYS RawDoFmt lea -ALARMTIMESIZE(a5),a0 ; Copy string to startup-string lea AlarmStartVal(pc),a1 bsr StrCpy move.l #SETALARMGAD,d0 lea ControlGads(pc),a0 move.l WndHandle(pc),a1 moveq #8,d1 lea -ALARMTIMESIZE(a5),a2 bsr SetStringGad unlk a5 movem.l (sp)+,RegsAll rts TimeError move.l #SETALARMGAD,d0 lea ControlGads(pc),a0 move.l WndHandle(pc),a1 moveq #8,d1 lea AlarmStartVal,a2 bsr SetStringGad unlk a5 movem.l (sp)+,RegsAll rts ********************************************************************** * Check if only digits are there * ********************************************************************** CheckDigits moveq #0,d0 cmp.b #'0',(a3) blt.s DigitError cmp.b #'9',(a3) bgt.s DigitError cmp.b #'0',1(a3) blt.s DigitError cmp.b #'9',1(a3) bgt.s DigitError rts DigitError moveq #1,d0 rts ********************************************************************** * Check if we`re to alarm * ********************************************************************** CheckForAlarm tst.b DoAlarm ; Are we to alarm ? beq NoAlarm link a5,#-LEN_DATSTRING lea TimeString(pc),a0 ; Get current time lea -LEN_DATSTRING(a5),a1 bsr StrCpy lea -LEN_DATSTRING(a5),a4 move.b #0,2(a4) ; Clear :s move.b #0,5(a4) move.l a4,d1 ; make em to longs move.l #ThisHour,d2 LNKLIB StrToLong,_DOSBase lea 3(a4),a0 move.l a0,d1 move.l #ThisMins,d2 DOLIB StrToLong lea 6(a4),a0 move.l a0,d1 move.l #ThisSecs,d2 DOLIB StrToLong unlk a5 move.l AlarmHour(pc),d0 move.l AlarmMins(pc),d1 move.l AlarmSecs(pc),d2 blt.s NoSecsComp ; Compare secs (-1 if not) cmp.l ThisSecs(pc),d2 bne.s NoAlarm NoSecsComp cmp.l ThisMins(pc),d1 ; Compare rest bne.s NoAlarm cmp.l ThisHour(pc),d0 bne.s NoAlarm move.l OurTask(pc),a1 ; Signal mother to alarm move.l AlarmSigFlag(pc),d0 CALLSYS Signal NoAlarm rts ********************************************************************** * Get a file name via ASL-Requester * * Parameters must be passed on stack in given order * * 1. Pointer to window * * 2. Pointer to requester header * * 3. Pointer to path * * 4. Pointer to filename * * 5. Pointer to complete filename * * 6. Number of gadget to change * * 7. Pointer to GadgetArray * ********************************************************************** GetFileName CARGS #8,.Window.l,.Header.l,.Path.l,.FileName.l,.CompleteName.l,.GadgetNum.w,.GadgetList.l link a5,#0 LNKLIB AllocFileRequest,_AslBase ; Get structure for filerequester move.l d0,MyAslRequest tst.l d0 beq NoLogFileName move.l .Window(a5),FileReqWin ; Set up filerequester move.l .Path(a5),FileReqDir move.l .FileName(a5),FileReqFile move.l .Header(a5),FileReqHeader move.l MyAslRequest(pc),a0 lea AslFileTags(pc),a1 LNKLIB AslRequest,_AslBase ; Do the request move.l d0,d7 tst.l d0 beq .Canceled move.l MyAslRequest(pc),a2 move.l rf_Dir(a2),a0 move.l .Path(a5),a1 ; Copy Dir name bsr StrCpy move.l rf_Dir(a2),a0 move.l .CompleteName(a5),a1 bsr StrCpy ; and to full name move.l .CompleteName(a5),a0 bsr StrLen tst.l d0 beq.s .End lea -1(a0,d0),a0 move.b (a0),d0 tst.b d0 ; No Dir name ? beq.s .End cmp.b #':',d0 ; Only device beq.s .End cmp.b #'/',d0 ; Path beq.s .End move.b #'/',-1(a1) ; Add a slash to full filename .End move.l rf_File(a2),a0 ; Copy filename move.l .FileName(a5),a1 bsr StrCpy move.l rf_File(a2),a0 ; and concat it to full name move.l .CompleteName(a5),a1 bsr StrCat move.w .GadgetNum(a5),d0 ext.l d0 tst.l d0 beq.s .Canceled move.l .GadgetList(a5),a0 move.l .Window(a5),a1 move.l #286,d1 move.l .CompleteName(a5),a2 bsr SetStringGad moveq #1,d7 .Canceled move.l MyAslRequest(pc),a0 ; Copy new position of filereq move.w rf_LeftEdge(a0),d0 move.w rf_TopEdge(a0),d1 ext.l d0 ext.l d1 move.l d0,FileReqLeft move.l d1,FileReqTop move.w rf_Width(a0),d0 move.w rf_Height(a0),d1 ext.l d0 ext.l d1 move.l d0,FileReqWidth move.l d1,FileReqHeight LNKLIB FreeFileRequest,_AslBase ; Free request NoLogFileName unlk a5 move.l d7,d0 rts ********************************************************************** * This part removes all waiting msgs for a port * ********************************************************************** KillMessages CARGS #0,Wnd.L,Port.L,Base.L movem.l a0/a1/a6,-(sp) ; Store pointers .Loop move.l Port(sp),a0 ; Get pointer to port CALLSYS GetMsg tst.l d0 beq.s NoMoreMsgs move.l d0,a1 ; Reply msg DOLIB ReplyMsg bra .Loop NoMoreMsgs movem.l (sp)+,a0/a1/a6 ; Reget pointers rts ********************************************************************** * This is the routine for handleing ARexx command * ********************************************************************** HandleARexx move.l ARexxPort(pc),a0 ; Get ARexx msg CALLSYS GetMsg move.l d0,MyARexxMsg tst.l d0 beq AllARexxDone move.l d0,a0 move.l ACTION(a0),d0 ; Get action to be taken move.l d0,ARexxAction move.l ARG0(a0),ARexxCommand move.l #RC_OK,AResult1 move.l #0,AResult2 and.l #RXCOMM,d0 ; Is it a command ? beq ARexxCommDone move.l ARexxCommand(pc),a0 ; Check for activate command lea ActivateStr(pc),a1 bsr CheckARexxComm tst.l d0 bne.s ANoActivate bsr CheckABool tst.l d0 blt ACommFail move.b d0,DoActivate move.l #ACTIGAD,d1 bsr SetControlBox bra ARexxCommDone ANoActivate move.l ARexxCommand(pc),a0 ; Check for MouseMode command lea MouseStr(pc),a1 bsr CheckARexxComm tst.l d0 bne.s ANoMouseMode bsr CheckABool tst.l d0 blt ACommFail move.b d0,MouseMode move.l #MODEGAD,d1 bsr SetControlBox bra ARexxCommDone ANoMouseMode move.l ARexxCommand(pc),a0 ; Check for ShowClock command lea ShowCStr(pc),a1 bsr CheckARexxComm tst.l d0 bne.s ANoShowClock bsr CheckABool ; Check for flags (0/1) tst.l d0 blt ACommFail move.b d0,ShowClock ; Save flags move.l #DISPLAYGAD,d1 bsr SetControlBox bsr ClearTitleBar bsr SigTime tst.b ShowClock bne.s ANoWinClose bsr CloseClockWin ANoWinClose bra ARexxCommDone ANoShowClock move.l ARexxCommand(pc),a0 ; Activate ClockWindow ? lea ClockWStr(pc),a1 bsr CheckARexxComm tst.l d0 bne.s ANoClockWin bsr CheckABool tst.l d0 blt ACommFail move.b d0,ClockWin move.l #WINDOWGAD,d1 bsr SetControlBox bsr ClearTitleBar bsr SigTime bra ARexxCommDone ANoClockWin move.l ARexxCommand(pc),a0 ; Reposition clockwindow ? lea ClockPosStr(pc),a1 bsr CheckARexxComm tst.l d0 bne.s ANoWinPos move.l ARexxBuffer(pc),a1 bsr StrCpy bsr GetWinPos tst.l d0 beq ACommFail lea ClockWinDef(pc),a0 move.l WinLeftEdge(pc),d0 ; Store in NewWindow-Structure move.l WinTopEdge(pc),d1 move.w d0,nw_LeftEdge(a0) move.w d1,nw_TopEdge(a0) tst.l ClockHandle ; Clockwindow open ? beq.s NoReposClockWin move.l ClockHandle(pc),a0 cmp.w wd_LeftEdge(a0),d0 bne.s .DoWinRepos cmp.w wd_TopEdge(a0),d1 beq.s NoReposClockWin .DoWinRepos moveq #0,d2 moveq #0,d3 move.w wd_Width(a0),d2 move.b wd_BorderTop(a0),d3 LNKLIB ChangeWindowBox,_IntuitionBase ; Resize bsr ClockRemake NoReposClockWin bra ARexxCommDone ANoWinPos move.l ARexxCommand(pc),a0 ; Display date ? lea ShowDateStr(pc),a1 bsr CheckARexxComm tst.l d0 bne.s ANoShowDate bsr CheckABool tst.l d0 blt ACommFail move.b d0,ShowDate move.l #DATEGAD,d1 bsr SetControlBox bsr ClearTitleBar bsr SigTime bra ARexxCommDone ANoShowDate move.l ARexxCommand(pc),a0 ; Show day ? lea ShowDayStr(pc),a1 bsr CheckARexxComm tst.l d0 bne.s ANoShowDay bsr CheckABool tst.l d0 blt ACommFail move.b d0,ShowDay move.l #DAYGAD,d1 bsr SetControlBox bsr ClearTitleBar bsr SigTime bra ARexxCommDone ANoShowDay move.l ARexxCommand(pc),a0 ; Short day string ? lea ShortDayStr(pc),a1 bsr CheckARexxComm tst.l d0 bne.s ANoShortDay bsr CheckABool tst.l d0 blt ACommFail move.b d0,ShortDay move.l #SHORTGAD,d1 bsr SetControlBox bsr ClearTitleBar bsr SigTime bra ARexxCommDone ANoShortDay move.l ARexxCommand(pc),a0 ; Show seconds ? lea ShowSecsStr(pc),a1 bsr CheckARexxComm tst.l d0 bne.s ANoShowSecs bsr CheckABool tst.l d0 blt ACommFail move.b d0,ShowSecs move.l #SECSGAD,d1 bsr SetControlBox bsr ClearTitleBar bsr SigTime bra ARexxCommDone ANoShowSecs move.l ARexxCommand(pc),a0 ; Show american date ? lea AmiDateStr(pc),a1 bsr CheckARexxComm tst.l d0 bne.s ANoAmiDate bsr CheckABool tst.l d0 blt ACommFail move.b d0,AmiDate move.l #AMIGAD,d1 bsr SetControlBox bsr ClearTitleBar bsr SigTime bra ARexxCommDone ANoAmiDate move.l ARexxCommand(pc),a0 ; Change Control HotKey ? lea KeyStr,a1 bsr CheckARexxComm tst.l d0 bne.s ANoConKey move.l a0,a3 move.l #POPUPGAD,d7 move.l WndHandle,a0 lea ControlTitle,a1 move.l PopUpFilter,a4 lea PopUpKey,a5 bsr RemakeHotKey ANoConKey move.l ARexxCommand(pc),a0 ; Change Page HotKey ? lea PageStr(pc),a1 bsr CheckARexxComm tst.l d0 bne.s ANoPageKey move.l a0,a3 move.l #PAGEGAD,d7 sub.l a0,a0 sub.l a1,a1 move.l PageFilter,a4 lea PageHotKey,a5 bsr RemakeHotKey bra ARexxCommDone ANoPageKey move.l ARexxCommand(pc),a0 ; Change display page ? lea PageNumStr(pc),a1 bsr CheckARexxComm tst.l d0 bne.s ANoPageNum move.l PageNum(pc),d7 move.l a0,d1 move.l #PageNum,d2 LNKLIB StrToLong,_DOSBase tst.l d0 ble.s .Error tst.l PageNum blt.s .Error cmp.l #MAXPAGES,PageNum blt.s .End .Error move.l #0,PageNum .End bsr ClearTitleBar bsr SigTime bra ARexxCommDone ANoPageNum move.l ARexxCommand(pc),a0 ; Activate alarm lea AlarmStr(pc),a1 bsr CheckARexxComm tst.l d0 bne.s ANoAlarm bsr CheckABool tst.l d0 blt ACommFail move.b d0,DoAlarm move.l #ALARMMODEGAD,d1 bsr SetControlBox bra ARexxCommDone ANoAlarm move.l ARexxCommand(pc),a0 ; Set alarm time ? lea AlarmTimeStr(pc),a1 bsr CheckARexxComm tst.l d0 bne.s ANoAlarmTime move.l ARexxBuffer(pc),a1 bsr StrCpy move.l ARexxBuffer(pc),a0 bsr StrLen cmp.l #8,d0 ; StringLen > 8 bgt ACommFail ; -> error bsr CheckAlarmTime bra ARexxCommDone ANoAlarmTime move.l ARexxCommand(pc),a0 ; Enable/Disable env vars ? lea SetEnvStr(pc),a1 bsr CheckARexxComm tst.l d0 bne.s ANoSetEnv bsr CheckABool ; Bool flag ??? tst.l d0 blt ACommFail move.b d0,SetEnv move.l #ENVGAD,d1 bsr SetControlBox tst.b SetEnv bne.s .NoDel bsr DeleteEnvs ; Delete vars if setenv is off .NoDel bsr SigTime ; Set the time bra ARexxCommDone ANoSetEnv move.l ARexxCommand(pc),a0 ; New screenblank time ? lea ScreenTStr(pc),a1 bsr CheckARexxComm tst.l d0 bne.s ANoScreenTime move.l ScreenTime(pc),d7 move.l ARexxBuffer(pc),a1 bsr StrCpy move.l ARexxBuffer,d1 move.l #ScreenTime,d2 LNKLIB StrToLong,_DOSBase ; Get new time tst.l ScreenTime ; negative ? ble.s .Error ; disable blank tst.l d0 bge.s .GoOn .Error move.l d7,ScreenTime .GoOn move.l #SCREENGAD,d0 lea ControlGads,a0 move.l WndHandle,a1 moveq #3,d1 move.l ScreenTime,d2 ; Display new time bsr SetIntegerGad move.b #1,TimeReset bra ARexxCommDone ANoScreenTime move.l ARexxCommand(pc),a0 ; New mouseblank time ? lea MouseTStr(pc),a1 bsr CheckARexxComm tst.l d0 bne.s ANoMouseTime move.l MouseTime(pc),d7 move.l ARexxBuffer(pc),a1 bsr StrCpy move.l ARexxBuffer,d1 move.l #MouseTime,d2 LNKLIB StrToLong,_DOSBase ; Get new time tst.l MouseTime ; Negative -> disable blank ble.s .Error tst.l d0 bge.s .GoOn .Error move.l d7,MouseTime .GoOn move.l #MOUSEGAD,d0 lea ControlGads,a0 move.l WndHandle,a1 moveq #3,d1 move.l MouseTime,d2 bsr SetIntegerGad move.b #1,TimeReset bra ARexxCommDone ANoMouseTime move.l ARexxCommand(pc),a0 lea ClickVStr(pc),a1 ; Remake click volume ? bsr CheckARexxComm tst.l d0 bne.s ANoClickVol move.l ClickVol(pc),d7 move.l ARexxBuffer(pc),a1 bsr StrCpy move.l ARexxBuffer,d1 move.l #ClickVol,d2 LNKLIB StrToLong,_DOSBase tst.l d0 ble.s .Error cmp.l #64,ClickVol bgt.s .Error tst.l ClickVol bge.s .GoOn .Error move.l d7,ClickVol .GoOn move.l #VOLGAD,d0 lea ControlGads,a0 move.l WndHandle,a1 moveq #2,d1 move.l ClickVol,d2 bsr SetIntegerGad bra ARexxCommDone ANoClickVol move.l ARexxCommand(pc),a0 ; Remake cycle qualifier ? lea CycleStr(pc),a1 bsr CheckARexxComm tst.l d0 bne.s ANoCycleQual move.l ARexxBuffer(pc),a1 bsr StrCpy move.l PopQualNum(pc),d7 ; Get old number move.l ARexxBuffer,d1 move.l #PopQualNum,d2 LNKLIB StrToLong,_DOSBase ; Get number tst.l d0 blt.s .Error tst.l PopQualNum blt.s .Error cmp.l #POPQUALCNT,PopQualNum blt.s .End1 .Error move.l d7,PopQualNum ; Remake to old value .End1 move.l #FRONTGAD,d0 move.l PopQualNum(pc),d1 lea ControlGads,a0 move.l WndHandle,a1 lea PopQualList,a2 bsr SetCycleGad bra ARexxCommDone ANoCycleQual move.l ARexxCommand(pc),a0 ; Enable/Disable Window-Cycling ? lea CycleWStr(pc),a1 bsr CheckARexxComm tst.l d0 bne.s ANoCycleWin bsr CheckABool tst.l d0 blt ACommFail move.b d0,CycleWin move.l #CYCLEGAD,d1 bsr SetControlBox bra ARexxCommDone ANoCycleWin move.l ARexxCommand(pc),a0 ; Enable/Disable click ? lea ClickStr(pc),a1 bsr CheckARexxComm tst.l d0 bne.s ANoClickOff bsr CheckABool tst.l d0 blt ACommFail move.b d0,KeyClick move.l #CLICKGAD,d1 bsr SetControlBox bra ARexxCommDone ANoClickOff move.l ARexxCommand(pc),a0 ; Enable/Disable phone logs ? lea LogCallStr(pc),a1 bsr CheckARexxComm tst.l d0 bne.s ANoLogCalls bsr CheckABool tst.l d0 blt ACommFail move.b d0,LogCalls ; Set mode move.l #LOGCALLGAD,d1 lea PrefsGads,a0 move.l PrefsHandle,a1 bsr SetCheckBox bra ARexxCommDone ANoLogCalls move.l ARexxCommand(pc),a0 ; Reposition bill window ? lea BillPosStr(pc),a1 bsr CheckARexxComm tst.l d0 bne.s ANoBillWinPos move.l ARexxBuffer(pc),a1 bsr StrCpy bsr GetWinPos tst.l d0 beq ACommFail lea BillWinDef(pc),a0 move.l WinLeftEdge(pc),d0 ; Store in NewWindow-Structure move.l WinTopEdge(pc),d1 move.w d0,nw_LeftEdge(a0) move.w d1,nw_TopEdge(a0) tst.l BillHandle ; BillWindow open ? beq.s .End move.l BillHandle(pc),a0 cmp.w wd_LeftEdge(a0),d0 bne.s .DoWinRepos cmp.w wd_TopEdge(a0),d1 beq.s .End .DoWinRepos moveq #0,d2 moveq #0,d3 move.w wd_Width(a0),d2 move.w wd_Height(a0),d3 LNKLIB ChangeWindowBox,_IntuitionBase ; Resize .End bra ARexxCommDone ANoBillWinPos move.l ARexxCommand(pc),a0 lea BillWinStr(pc),a1 ; Popup billwindow on carrier detect ? bsr CheckARexxComm tst.l d0 bne.s ANoBillPopUp bsr CheckABool tst.l d0 blt ACommFail move.b d0,BillPopUp ; set new state move.l #BILLPOPGAD,d1 lea PrefsGads,a0 move.l PrefsHandle,a1 bsr SetCheckBox bra ARexxCommDone ANoBillPopUp move.l ARexxCommand(pc),a0 ; Clear log file ? lea AClearLogStr(pc),a1 bsr CheckARexxComm tst.l d0 bne.s ANoClearLog move.l #LogFileName,d1 LNKLIB DeleteFile,_DOSBase bra ARexxCommDone ANoClearLog move.l ARexxCommand(pc),a0 ; Reposition Prefs window ? lea PrefsPosStr(pc),a1 bsr CheckARexxComm tst.l d0 bne.s ANoPrefsPos move.l ARexxBuffer(pc),a1 bsr StrCpy bsr GetWinPos tst.l d0 beq ACommFail lea BillWinDef(pc),a0 move.l WinLeftEdge(pc),d0 ; Store in NewWindow-Structure move.l WinTopEdge(pc),d1 move.w d0,nw_LeftEdge(a0) move.w d1,nw_TopEdge(a0) tst.l PrefsHandle ; PrefsWindow open ? beq.s .End move.l PrefsHandle(pc),a0 cmp.w wd_LeftEdge(a0),d0 bne.s .DoWinRepos cmp.w wd_TopEdge(a0),d1 beq.s .End .DoWinRepos moveq #0,d2 moveq #0,d3 move.w wd_Width(a0),d2 move.w wd_Height(a0),d3 LNKLIB ChangeWindowBox,_IntuitionBase ; Resize .End bra ARexxCommDone ANoPrefsPos move.l ARexxCommand(pc),a0 ; Enable/Disable WB PopUp lea WBFrontStr(pc),a1 bsr CheckARexxComm tst.l d0 bne.s ANoWBFront bsr CheckABool tst.l d0 blt ACommFail move.b d0,WBFront ; set new state move.l #WBFRONTGAD,d1 bsr SetControlBox bra ARexxCommDone ANoWBFront move.l ARexxCommand(pc),a0 ; Enable/Disable LeftyMouse ? lea LeftyStr(pc),a1 bsr CheckARexxComm tst.l d0 bne.s ANoLeftyMouse bsr CheckABool tst.l d0 blt ACommFail move.b d0,LeftyMouse move.l #LEFTYGAD,d1 bsr SetControlBox bra ARexxCommDone ANoLeftyMouse move.l ARexxCommand(pc),a0 ; Enable/Disable ESC-Close ? lea ESCCloseStr(pc),a1 bsr CheckARexxComm tst.l d0 bne.s ANoESCClose bsr CheckABool tst.l d0 blt ACommFail move.b d0,ESCClose move.l #WESCGAD,d1 bsr SetControlBox bra ARexxCommDone ANoESCClose move.l ARexxCommand(pc),a0 ; Remake cycle qualifier ? lea ESCQualStr(pc),a1 bsr CheckARexxComm tst.l d0 bne.s ANoESCQual move.l ARexxBuffer(pc),a1 bsr StrCpy move.l ESCQualNum(pc),d7 ; Get old number move.l ARexxBuffer,d1 move.l #ESCQualNum,d2 LNKLIB StrToLong,_DOSBase ; Get number tst.l d0 blt.s .Error tst.l ESCQualNum blt.s .Error cmp.l #ESCQUALCNT,ESCQualNum blt.s .End1 .Error move.l d7,ESCQualNum ; Remake to old value .End1 move.l #ESCQUALGAD,d0 move.l ESCQualNum(pc),d1 lea ControlGads,a0 move.l WndHandle,a1 lea ESCQualList,a2 bsr SetCycleGad bra ARexxCommDone ANoESCQual move.l ARexxCommand(pc),a0 ; Enable/Disable "Map Umlauts ?" lea UmlautOnStr(pc),a1 bsr CheckARexxComm tst.l d0 bne.s ANoUmlautOn bsr CheckABool tst.l d0 blt ACommFail move.b d0,MapUmlaut move.l #UMLAUTGAD,d1 bsr SetControlBox bra ARexxCommDone ANoUmlautOn move.l ARexxCommand(pc),a0 ; Enable broker ? lea EnableStr(pc),a1 bsr CheckARexxComm tst.l d0 bne.s ANoEnable move.b #0,Disabled move.b #1,TimeReset bsr EnableBroker bra ARexxCommDone ANoEnable move.l ARexxCommand(pc),a0 ; Disable broker ? lea DisableStr(pc),a1 bsr CheckARexxComm tst.l d0 bne.s ANoDisable bsr DisableBroker bsr OnScreen bsr OnMouse move.b #1,Disabled bra ARexxCommDone ANoDisable move.l ARexxCommand(pc),a0 ; Hide window ? lea HideStr(pc),a1 bsr CheckARexxComm tst.l d0 bne.s ANoHide bsr CloseOurWindow bra ARexxCommDone ANoHide move.l ARexxCommand(pc),a0 ; PopUp window ? lea APopUpStr(pc),a1 bsr CheckARexxComm tst.l d0 bne.s ANoPopUp bsr OpenOurWindow bra ARexxCommDone ANoPopUp move.l ARexxCommand(pc),a0 ; Return a status ? lea AStatusStr(pc),a1 bsr CheckARexxComm tst.l d0 bne.s ANoStatus bsr ReturnStatus tst.l d0 beq ACommFail bra ARexxCommDone ANoStatus move.l ARexxCommand(pc),a0 ; Do a revision ? lea AReviseStr(pc),a1 bsr CheckARexxComm tst.l d0 bne ANoRevise move.l ARexxBuffer(pc),a1 bsr StrCpy move.l ARexxBuffer(pc),a1 move.l a1,a0 .Loop tst.b (a1) ; Get filename beq ACommFail cmp.b #' ',(a1) beq.s GotFileName cmp.b #'"',(a1) beq.s GotFileName cmp.b #"'",(a1) beq.s GotFileName addq.l #1,a1 bra .Loop GotFileName move.b #0,(a1)+ move.l a1,a4 lea FileName(pc),a1 ; Copy filename bsr StrCpy move.l a4,a0 bsr SkipBlanks move.l a0,a4 lea AReviseCStr(pc),a1 ; C or ASM revision ? bsr CheckARexxComm tst.l d0 bne NoCMode move.l #CHeader,RevHeader ; Set C strings move.l #CLineNL,RevLineNL move.l #CLine,RevLine move.l #CCopyRight,RevCompany move.l #CFile,RevFile move.l #CCreatedOn,RevCreatedOn move.l #CAuthor,RevAuthor move.l #CRevision,RevRevision move.l #CPurpose,RevPurpose move.l #CLog,RevLog move.l #CLogInit,RevLogInit move.l #CEnd,RevEnd move.l #CRevDefine1,RevDefine bra GotMode NoCMode move.l a4,a0 lea AReviseAsmStr(pc),a1 bsr CheckARexxComm tst.l d0 bne NoAsmMode move.l #AsmHeader,RevHeader ; Set ASM strings move.l #AsmLineNL,RevLineNL move.l #AsmLine,RevLine move.l #AsmCopyRight,RevCompany move.l #AsmFile,RevFile move.l #AsmCreatedOn,RevCreatedOn move.l #AsmAuthor,RevAuthor move.l #AsmRevision,RevRevision move.l #AsmPurpose,RevPurpose move.l #AsmLog,RevLog move.l #AsmLogInit,RevLogInit move.l #AsmEnd,RevEnd move.l #AsmRevDefine1,RevDefine bra GotMode NoAsmMode move.l a4,a0 lea ARevisePasStr(pc),a1 bsr CheckARexxComm tst.l d0 bne ACommFail move.l #PASHeader,RevHeader ; Set PAS strings move.l #CLineNL,RevLineNL move.l #CLine,RevLine move.l #CCopyRight,RevCompany move.l #CFile,RevFile move.l #CCreatedOn,RevCreatedOn move.l #CAuthor,RevAuthor move.l #CRevision,RevRevision move.l #CPurpose,RevPurpose move.l #CLog,RevLog move.l #PASLogInit,RevLogInit move.l #PASEnd,RevEnd move.l #PASRevDefine1,RevDefine GotMode bsr DoRevision tst.l d0 beq ACommFail bra ARexxCommDone ANoRevise move.l ARexxCommand,a0 ; Load new prefs ? lea ALoadPrefsStr,a1 bsr CheckARexxComm tst.l d0 bne.s ANoLoadPrefs move.l a0,a4 lea PrefsFileName,a0 move.l ARexxBuffer,a1 bsr StrCpy move.l a4,a0 lea PrefsFileName,a1 bsr StrCpy bsr LoadPrefs move.l ARexxBuffer,a0 lea PrefsFileName,a1 bsr StrCpy bra ARexxCommDone ANoLoadPrefs move.l ARexxCommand,a0 ; Save prefs to file ? lea ASavePrefsStr,a1 bsr CheckARexxComm tst.l d0 bne.s ANoSavePrefs move.l a0,a4 lea PrefsFileName,a0 move.l ARexxBuffer,a1 bsr StrCpy move.l a4,a0 lea PrefsFileName,a1 bsr StrCpy bsr SavePrefs move.l ARexxBuffer,a0 lea PrefsFileName,a1 bsr StrCpy bra ARexxCommDone ANoSavePrefs move.l ARexxCommand(pc),a0 ; Change Bill HotKey ? lea BillKeyStr(pc),a1 bsr CheckARexxComm tst.l d0 bne.s ANoBillKey move.l a0,a3 move.l #BILLKEYGAD,d7 move.l BillHandle,a0 lea BillTitle,a1 move.l BillFilter,a4 lea BillHotKey,a5 bsr RemakeHotKey bra ARexxCommDone ANoBillKey move.l ARexxCommand(pc),a0 ; Change Prefs HotKey ? lea PrefsKeyStr(pc),a1 bsr CheckARexxComm tst.l d0 bne.s ANoPrefsKey move.l a0,a3 move.l #PREFSKEYGAD,d7 move.l PrefsHandle,a0 lea PrefsTitle,a1 move.l PrefsFilter,a4 lea PrefsHotKey,a5 bsr RemakeHotKey bra ARexxCommDone ANoPrefsKey move.l ARexxCommand(pc),a0 ; Change HotKeys HotKey ? lea HotKeyStr(pc),a1 bsr CheckARexxComm tst.l d0 bne.s ANoHotKey move.l a0,a3 move.l #HOTKEYGAD,d7 move.l HotKeyHandle,a0 lea HotWinTitle,a1 move.l HotKeyFilter,a4 lea HotWinHotKey,a5 bsr RemakeHotKey bra ARexxCommDone ANoHotKey move.l ARexxCommand(pc),a0 ; Change Shell HotKey ? lea ShellKeyStr(pc),a1 bsr CheckARexxComm tst.l d0 bne.s ANoShellKey move.l a0,a3 move.l #SHELLGAD,d7 sub.l a0,a0 sub.l a1,a1 move.l ShellFilter,a4 lea ShellHotKey,a5 bsr RemakeHotKey bra ARexxCommDone ANoShellKey move.l ARexxCommand(pc),a0 ; Change Umlaut HotKey ? lea UmlautKeyStr(pc),a1 bsr CheckARexxComm tst.l d0 bne.s ANoUmlautKey move.l a0,a3 move.l #UMLAUTKEYGAD,d7 sub.l a0,a0 sub.l a1,a1 move.l UmlautFilter,a4 lea UmlautHotKey,a5 bsr RemakeHotKey bra.s ARexxCommDone ANoUmlautKey move.l ARexxCommand(pc),a0 ; Change Shell command ? lea ShellCommStr(pc),a1 bsr CheckARexxComm tst.l d0 bne.s ANoShellComm lea SystemParam,a1 bsr StrCpy move.l #USERSHELLGAD,d0 lea ControlGads,a0 move.l WndHandle,a1 move.l #64,d1 lea SystemParam,a2 bsr SetStringGad bra.s ARexxCommDone ANoShellComm bra.s ARexxCommDone ACommFail move.l #RC_FAIL,AResult1 ; Command failed move.l #0,AResult2 ARexxCommDone move.l MyARexxMsg(pc),a1 move.l AResult1(pc),rm_Result1(a1) move.l AResult2(pc),rm_Result2(a1) CALLSYS ReplyMsg bra HandleARexx AllARexxDone rts ********************************************************************** * Return a status value to the calling program * ********************************************************************** ReturnStatus movem.l RegsAll,-(sp) link a5,#-STATUSLINESIZE ; Get buffer for status move.l ARexxAction(pc),d0 ; Result expected ? and.l #RXFF_RESULT,d0 beq StatError ; Nope -> go on lea -STATUSLINESIZE(a5),a1 bsr StrCpy lea -STATUSLINESIZE(a5),a0 move.l a0,d1 move.l #StatusNum,d2 LNKLIB StrToLong,_DOSBase ; Convert statusnumber to long tst.l d0 ble StatError move.l StatusNum(pc),d0 ; Check if status num is ok cmp.l #StatusCount,d0 bgt StatError subq.l #1,d0 asl.l #3,d0 lea ARexxStatus(pc),a0 lea 0(a0,d0),a2 ; Get address for stat info cmp.l #RESULTCLOCKPOS,(a2) ; Give position of clockwindow ? bne.s NoClockStatus lea ClockWinDef(pc),a0 move.w nw_LeftEdge(a0),ResultWinData ; Store position move.w nw_TopEdge(a0),ResultWinData+2 lea ResultWinFormat(pc),a0 lea ResultWinData(pc),a1 bra MakeResultStr NoClockStatus cmp.l #RESULTTIME,(a2) ; Return alarm time ? bne.s NoTimeStatus lea AlarmStartVal(pc),a0 lea -STATUSLINESIZE(a5),a1 bsr StrCpy bra ResultStrDone NoTimeStatus cmp.l #RESULTPOP,(a2) ; Return STATUS on poped up ? bne.s NoPopedUpStatus tst.l WndHandle beq.s .False lea TrueStr(pc),a0 bra.s .DoPop .False lea FalseStr(pc),a0 .DoPop lea -STATUSLINESIZE(a5),a1 bsr StrCpy bra ResultStrDone NoPopedUpStatus cmp.l #RESULTBILLPOS,(a2) ; Give position of billwindow ? bne.s NoBillStatus lea BillWinDef(pc),a0 move.w nw_LeftEdge(a0),ResultWinData ; Store position move.w nw_TopEdge(a0),ResultWinData+2 lea ResultWinFormat(pc),a0 lea ResultWinData(pc),a1 bra.s MakeResultStr NoBillStatus cmp.l #RESULTPREFSPOS,(a2) ; Give position of prefswindow ? bne.s NoPrefsStatus lea PrefsWinDef(pc),a0 move.w nw_LeftEdge(a0),ResultWinData ; Store position move.w nw_TopEdge(a0),ResultWinData+2 lea ResultWinFormat(pc),a0 lea ResultWinData(pc),a1 bra.s MakeResultStr NoPrefsStatus moveq #0,d0 move.l 4(a2),a3 lea ResultFormat(pc),a0 lea ResultData(pc),a1 cmp.l #RESULTBYTE,(a2) ; Is stored as byte ? bne.s NoByteResult move.b (a3),d0 move.l d0,ResultData bra.s MakeResultStr NoByteResult cmp.l #RESULTWORD,(a2) ; ... as word ? bne.s NoWordResult move.w (a3),d0 move.l d0,ResultData bra.s MakeResultStr NoWordResult cmp.l #RESULTLONG,(a2) ; ... as long ? bne.s NoLongResult move.l (a3),d0 move.l d0,ResultData bra.s MakeResultStr NoLongResult cmp.l #RESULTSTRING,(a2) ; Return a string ? bne.s StatError move.l a3,a0 lea -STATUSLINESIZE(a5),a1 bsr StrCpy bra.s ResultStrDone MakeResultStr lea PutChProc(pc),a2 ; Convert string lea -STATUSLINESIZE(a5),a3 CALLSYS RawDoFmt ResultStrDone lea -STATUSLINESIZE(a5),a0 bsr StrLen LNKLIB CreateArgstring,_RexxSysBase ; Create argstring and store it tst.l d0 ; If an error occured indicate it beq.s StatError move.l d0,AResult2 EndStatus unlk a5 movem.l (sp)+,RegsAll moveq #1,d0 rts StatError unlk a5 movem.l (sp)+,RegsAll moveq #0,d0 rts ********************************************************************** * Checks, if we know the ARexx command * ********************************************************************** CheckARexxComm moveq #0,d0 moveq #0,d1 .Loop move.b (a0)+,d0 ; Get chars from buffer move.b (a1)+,d1 or.b #$20,d0 ; Make it case in-sensitive or.b #$20,d1 cmp.b #$20,d0 ; Argstring end ? beq.s .StringOk cmp.b d0,d1 beq.s .Loop .StringFalse moveq #1,d0 ; Error flag rts .StringOk cmp.b #$20,d1 ; Our string also ending ? bne .StringFalse ; Nope -> go on bsr SkipBlanks moveq #0,d0 ; Command OK rts ********************************************************************** * Checks for flags (0/1) in an ARexx-Command * ********************************************************************** CheckABool cmp.b #'0',(a0) beq.s .False cmp.b #'1',(a0) beq.s .True moveq #-1,d0 rts .False moveq #0,d0 rts .True moveq #1,d0 rts ********************************************************************** * Enter a log message and revise the text * ********************************************************************** DoRevision move.l #0,OurLock lea FileName(pc),a0 .LoopDev cmp.b #':',(a0) ; Find out whether filename beq.s .GotDev ; is given with complete path tst.b (a0) beq.s .NoDev addq.l #1,a0 bra.s .LoopDev .NoDev move.l MyARexxMsg(pc),a0 ; Lock to current Dir of move.l MN_REPLYPORT(a0),a0 ; ARexx. Normaly the workdirectory move.l MP_SIGTASK(a0),a0 ; your editor is running on. move.l pr_CurrentDir(a0),d1 ; If a path is specified move.l #0,EasyArg ; for this version skip description LNKLIB DupLock,_DOSBase move.l d0,OurLock tst.l d0 beq NoRevision move.l d0,d1 DOLIB CurrentDir move.l d0,PastLock tst.l d0 beq NoRevision .GotDev bsr CheckRevision ; Check if Revision already there tst.l d7 blt NoRevision link a5,#-4 bsr LockScreen tst.l d0 beq .LogWinErr move.l -4(a5),a0 ; Get visual info for screen sub.l a1,a1 LNKLIB GetVisualInfoA,_GadToolsBase move.l d0,LogVisInfo tst.l d0 beq .LogWinErr lea DummyNewGadget(pc),a0 ; Store visual info in newgadget move.l d0,gng_VisualInfo(a0) move.l -4(a5),a0 ; Pop Up WBench screen LNKLIB ScreenToFront,_IntuitionBase lea LogWinDef(pc),a0 ; Try to open window move.l #LOGWINWIDTH,WinWidth move.l #LOGWINHEIGHT,WinHeight move.l #LOGWINIDCMP,WinIDCMP move.l #LOGWINFLAGS,WinFlags move.l #0,DoMenuHelp lea WindowTags(pc),a1 DOLIB OpenWindowTagList move.l d0,LogHandle tst.l d0 beq .LogWinErr bsr UnlockScreen lea LogMenuDef,a0 ; Create menu strip sub.l a1,a1 ; No tags LNKLIB CreateMenusA,_GadToolsBase move.l d0,LogMenu tst.l d0 beq .LogWinErr move.l LogMenu(pc),a0 ; Do the layout on window move.l LogVisInfo(pc),a1 sub.l a2,a2 DOLIB LayoutMenusA tst.l d0 beq .LogWinErr lea LogGadget(pc),a0 ; Create context gadget LNKLIB CreateContext,_GadToolsBase move.l d0,ThisGadget tst.l d0 beq .LogWinErr move.l LogHandle(pc),a0 moveq #0,d5 move.b wd_BorderTop(a0),d5 ; Get height of border of window move.w #1,GadNum ; Reset gadget ID move.l #0,StringConts move.l #75,StrMax moveq #5,d7 ; Start height moveq #4,d6 lea LogGads,a4 .Loop lea DummyNewGadget(pc),a1 move.w #LOGSGADWIDTH,gng_Width(a1) move.w #GADHEIGHT,gng_Height(a1) move.w #INTERWIDTH,gng_LeftEdge(a1) move.l d5,d1 add.w d7,d1 ; Make Top Edge of gadget move.w d1,gng_TopEdge(a1) move.l #0,gng_Flags(a1) move.l #STRING_KIND,d0 ; Create string gadgets move.l ThisGadget(pc),a0 lea StringTags(pc),a2 DOLIB CreateGadgetA tst.l d0 beq .LogWinErr move.l d0,(a4)+ move.l d0,ThisGadget addq.w #1,GadNum add.l #13,d7 dbf d6,.Loop lea DummyNewGadget(pc),a1 ; Create OK gadget move.w #GADWIDTH,gng_Width(a1) move.w #INTERWIDTH,gng_LeftEdge(a1) move.l d5,d1 add.w d7,d1 move.w d1,gng_TopEdge(a1) move.l #LogOkText,gng_GadgetText(a1) move.l #PLACETEXT_IN,gng_Flags(a1) move.l #BUTTON_KIND,d0 move.l ThisGadget(pc),a0 lea ButtonTags(pc),a2 DOLIB CreateGadgetA tst.l d0 beq .LogWinErr move.l d0,(a4)+ move.l d0,ThisGadget addq.w #1,GadNum lea DummyNewGadget(pc),a1 ; Create CANCEL gadget move.w #(LOGWINWIDTH-GADWIDTH-INTERWIDTH+6),gng_LeftEdge(a1) move.l #LogCancelText,gng_GadgetText(a1) move.l #BUTTON_KIND,d0 move.l ThisGadget(pc),a0 lea ButtonTags(pc),a2 DOLIB CreateGadgetA tst.l d0 beq .LogWinErr move.l d0,(a4)+ move.l d0,ThisGadget addq.w #1,GadNum move.l #0,IntConts ; Create major revision move.l #2,IntMax lea DummyNewGadget(pc),a1 move.w #275,gng_LeftEdge(a1) move.w #LOGINTWIDTH,gng_Width(a1) move.l #LogRevText,gng_GadgetText(a1) move.l #PLACETEXT_LEFT,gng_Flags(a1) move.l #INTEGER_KIND,d0 move.l ThisGadget(pc),a0 lea IntegerTags(pc),a2 DOLIB CreateGadgetA tst.l d0 beq .LogWinErr move.l d0,(a4)+ move.l d0,ThisGadget addq.w #1,GadNum lea DummyNewGadget(pc),a1 ; Create minor revision move.w #330,gng_LeftEdge(a1) move.l #LogPointText,gng_GadgetText(a1) move.l #PLACETEXT_LEFT,gng_Flags(a1) move.l #INTEGER_KIND,d0 move.l ThisGadget(pc),a0 lea IntegerTags(pc),a2 DOLIB CreateGadgetA tst.l d0 beq.s .LogWinErr move.l d0,(a4)+ move.l d0,ThisGadget move.l LogHandle(pc),a0 ; Add gadgets to list move.l LogGadget(pc),a1 move.l #-1,d0 move.l #-1,d1 sub.l a2,a2 LNKLIB AddGList,_IntuitionBase move.l LogGadget(pc),a0 ; Let`s display em move.l LogHandle(pc),a1 sub.l a2,a2 moveq #-1,d0 DOLIB RefreshGList move.l LogHandle(pc),a0 ; Append menu to window move.l LogMenu(pc),a1 LNKLIB SetMenuStrip,_IntuitionBase move.l LogHandle(pc),a0 sub.l a1,a1 LNKLIB GT_RefreshWindow,_GadToolsBase bsr UnlockScreen unlk a5 bra.s .GotLogWin .LogWinErr bsr UnlockScreen unlk a5 bra NoLogWin .GotLogWin lea NewMsg(pc),a1 ; and messages move.w #(77*5)-1,d7 .Loop1 move.b #0,(a1)+ dbf d7,.Loop1 tst.b OnlyLog ; Enter a new LogMessage ? bne.s DoOnlyLog move.l LogHandle(pc),a0 ; Set window title for purpose lea PurposeWinTitle(pc),a1 move.l #-1,a2 DOLIB SetWindowTitles bsr CheckRevInput cmp.b #2,LogInputEnd beq NoErrorFound lea NewMsg(pc),a3 bsr CopyMessage ; Copy entered message bra.s PurpDone DoOnlyLog move.l LogHandle(pc),a0 ; Change to log title lea LogWinTitle(pc),a1 move.l #-1,a2 DOLIB SetWindowTitles bsr CheckRevInput cmp.b #2,LogInputEnd beq NoErrorFound lea NewMsg(pc),a3 bsr CopyMessage ; Copy entered message PurpDone bsr CloseLogWin ; Close input-window move.l #Author,RevAuthorDat ; Set strings to defaults move.l #Company,RevCompanyDat move.l #AuthorString,d1 ; Try to get Author env move.l #Author,d2 move.l #40,d3 move.l #GVF_GLOBAL_ONLY,d4 LNKLIB GetVar,_DOSBase tst.l d0 bgt.s GotAuthor move.l #DefaultName,RevAuthorDat GotAuthor move.l #CompanyString,d1 ; Try to get company env move.l #Company,d2 move.l #40,d3 move.l #GVF_GLOBAL_ONLY,d4 LNKLIB GetVar,_DOSBase tst.l d0 bgt.s GotCompany move.l #DefaultName,RevCompanyDat GotCompany move.l #8,d0 ; Get version number lea LogGads,a0 bsr GetGadgetPtr move.l gg_SpecialInfo(a0),a0 move.l si_LongInt(a0),d0 move.w d0,RevRevisionDat move.l #9,d0 ; Get revision number lea LogGads,a0 bsr GetGadgetPtr move.l gg_SpecialInfo(a0),a0 move.l si_LongInt(a0),d0 move.w d0,RevRevisionDat+2 move.l #FileName,d1 ; Open File move.l d1,EasyArg move.l #MODE_OLDFILE,d2 LNKLIB Open,_DOSBase move.l d0,InHand tst.l d0 beq NoRevision move.l #TempName,d1 move.l #MODE_NEWFILE,d2 ; Open temporaryfile DOLIB Open move.l d0,OutHand tst.l d0 beq NoRevision tst.b OnlyLog ; Enter new LogMessage ? beq WriteHeader .Loop move.l InHand(pc),d1 ; Seek for our header within move.l ARexxBuffer,d2 ; first 15 lines move.l #AREXXBUFFSIZE,d3 DOLIB FGets tst.l d0 ble NoRevision move.l OutHand(pc),d1 ; Store data unequal to header move.l ARexxBuffer,d2 DOLIB FPuts tst.l d0 blt NoRevision move.l RevHeader(pc),a0 move.l ARexxBuffer(pc),a1 moveq #-1,d7 bsr StrCmp tst.l d0 beq.s GotHeader bra .Loop GotHeader moveq #5,d7 ; Skip comming 6 lines bsr RSkipLines tst.l d0 beq NoRevision move.l InHand(pc),d1 ; Get line of current revision move.l ARexxBuffer,d2 move.l #AREXXBUFFSIZE,d3 DOLIB FGets tst.l d0 ble NoRevision tst.w RevRevisionDat bne.s UserRev tst.w RevRevisionDat+2 bne.s UserRev move.l ARexxBuffer(pc),a4 ; Get address of major version value lea 23(a4),a4 move.l a4,a0 .Find cmp.b #'.',(a0)+ ; Find . separating major and minor revision beq.s .GotIt bra .Find .GotIt move.b #0,-1(a0) move.l a0,d1 ; Convert value to long move.l ARexxBuffer,d2 addq.l #4,d2 DOLIB StrToLong move.l a4,d1 move.l ARexxBuffer,d2 DOLIB StrToLong move.l ARexxBuffer(pc),a0 move.l (a0),d0 move.l 4(a0),d1 addq.l #1,d1 cmp.l #100,d1 ; Over 100 ? bne.s GotNewRev move.l #0,d1 addq.l #1,d0 GotNewRev move.w d0,RevRevisionDat ; Store major version value move.w d1,RevRevisionDat+2 ; Store minor value UserRev move.l RevRevision(pc),a0 ; Convert to new string lea RevRevisionDat(pc),a1 bsr PrintF move.l OutHand(pc),d1 ; Write new string move.l ARexxBuffer,d2 DOLIB FPuts tst.l d0 blt NoRevision moveq #3,d7 ; Skip the next 4 lines bsr RSkipLines tst.l d0 blt NoRevision .Loop move.l InHand(pc),d1 ; Skip purpose description move.l ARexxBuffer,d2 move.l #AREXXBUFFSIZE,d3 DOLIB FGets tst.l d0 ble NoRevision move.l ARexxBuffer(pc),a0 bsr StrLen cmp.l #3,d0 beq.s .GotIt move.l OutHand(pc),d1 move.l ARexxBuffer,d2 DOLIB FPuts tst.l d0 blt NoRevision bra .Loop .GotIt move.l RevLog(pc),a0 ; generate new log entry lea RevRevisionDat(pc),a1 bsr PrintF move.l OutHand(pc),d1 move.l ARexxBuffer,d2 DOLIB FPuts tst.l d0 blt NoRevision lea NewMsg(pc),a4 bsr RWriteMessage ; Write new logmessage tst.l d0 blt NoRevision move.l OutHand(pc),d1 move.l RevLineNL(pc),d2 DOLIB FPuts tst.l d0 blt NoRevision .LoopHeader move.l InHand(pc),d1 ; Search for end of header move.l ARexxBuffer,d2 move.l #AREXXBUFFSIZE,d3 DOLIB FGets tst.l d0 ble NoRevision move.l OutHand(pc),d1 move.l ARexxBuffer,d2 DOLIB FPuts tst.l d0 blt NoRevision move.l RevEnd(pc),a0 move.l ARexxBuffer(pc),a1 moveq #-1,d7 bsr StrCmp tst.l d0 beq.s GotHeaderEnd bra .LoopHeader GotHeaderEnd move.l InHand(pc),d1 ; Read next line, move.l ARexxBuffer,d2 ; following header move.l #AREXXBUFFSIZE,d3 DOLIB FGets tst.l d0 ble NoRevision move.l ARexxBuffer(pc),a0 bsr StrLen move.l InHand(pc),d1 ; Reset filepointer to last read move.l d0,d2 ; position neg.l d2 move.l #OFFSET_CURRENT,d3 DOLIB Seek move.l ARexxBuffer(pc),a0 ; Did we read in a define ? move.l RevDefine(pc),a1 move.l #12,d7 bsr StrCmp tst.l d0 bne WriteRest ; Nope -> go on RemakeDefs move.w RevRevisionDat(pc),d0 move.w RevRevisionDat+2(pc),d1 move.w d0,RevDefineDat move.w d1,RevDefineDat+2 move.l RevDefine(pc),a0 ; Write new define lea RevDefineDat(pc),a1 bsr PrintF move.l OutHand(pc),d1 move.l ARexxBuffer,d2 DOLIB FPuts tst.l d0 blt NoRevision moveq #1,d7 ; Skip lines cmp.l #AsmRevDefine1,RevDefine ; Revise Asm source bne.s NoAsmSkip add.l #4,d7 ; skip one more line bra.s DoSkip NoAsmSkip cmp.l #PASRevDefine1,RevDefine bne.s DoSkip addq.l #1,d7 DoSkip move.l InHand(pc),d1 move.l ARexxBuffer,d2 move.l #AREXXBUFFSIZE,d3 DOLIB FGets tst.l d0 ble NoRevision dbf d7,DoSkip bra WriteRest ; Append rest of file WriteHeader cmp.w #0,RevRevisionDat bne.s .UserDat cmp.w #0,RevRevisionDat+2 bne.s .UserDat moveq #1,d0 moveq #0,d1 move.w d0,RevRevisionDat move.w d1,RevRevisionDat+2 .UserDat move.l OutHand(pc),d1 ; Write Header move.l RevHeader(pc),d2 DOLIB FPuts tst.l d0 blt NoRevision move.l RevCompany(pc),a0 ; Convert company string lea RevCompanyDat(pc),a1 bsr PrintF move.l OutHand(pc),d1 move.l ARexxBuffer,d2 DOLIB FPuts tst.l d0 blt NoRevision move.l RevFile(pc),a0 ; convert and write filename lea RevFileDat(pc),a1 bsr PrintF move.l OutHand(pc),d1 move.l ARexxBuffer,d2 DOLIB FPuts tst.l d0 blt NoRevision move.l RevCreatedOn(pc),a0 ; do creation date lea RevCreatedOnDat(pc),a1 bsr PrintF move.l OutHand(pc),d1 move.l ARexxBuffer,d2 DOLIB FPuts tst.l d0 blt NoRevision move.l RevAuthor(pc),a0 ; do author lea RevAuthorDat(pc),a1 bsr PrintF move.l OutHand(pc),d1 move.l ARexxBuffer,d2 DOLIB FPuts tst.l d0 blt NoRevision move.l RevRevision(pc),a0 ; Do initial revision lea RevRevisionDat(pc),a1 bsr PrintF move.l OutHand(pc),d1 move.l ARexxBuffer,d2 DOLIB FPuts tst.l d0 blt NoRevision move.l OutHand(pc),d1 ; Write purpose header move.l RevPurpose(pc),d2 DOLIB FPuts tst.l d0 blt NoRevision lea NewMsg(pc),a4 ; Write purpose message bsr RWriteMessage tst.l d0 blt NoRevision move.l RevLogInit(pc),a0 lea RevRevisionDat(pc),a1 bsr PrintF move.l OutHand(pc),d1 ; Write initial log message move.l ARexxBuffer,d2 DOLIB FPuts tst.l d0 blt NoRevision move.w RevRevisionDat(pc),d0 move.w RevRevisionDat+2(pc),d1 move.w d0,RevDefineDat move.w d1,RevDefineDat+2 move.l RevDefine(pc),a0 ; Write initial define lea RevDefineDat(pc),a1 bsr PrintF move.l OutHand(pc),d1 move.l ARexxBuffer,d2 DOLIB FPuts tst.l d0 blt NoRevision WriteRest move.l OutHand(pc),d1 ; Write the remaining part of file DOLIB Flush move.l InHand(pc),d1 DOLIB Flush .Loop move.l InHand(pc),d1 ; Read a maximum of 4096 bytes move.l ARexxBuffer,d2 move.l #AREXXBUFFSIZE,d3 DOLIB Read tst.l d0 beq.s RestWritten ; End of file -> go on blt NoRevision ; Error -> quit move.l d0,d3 move.l OutHand(pc),d1 ; Write buffer to temp file move.l ARexxBuffer,d2 DOLIB Write tst.l d0 ble NoRevision bra .Loop RestWritten move.l OutHand(pc),d1 ; Close files LNKLIB Close,_DOSBase move.l InHand(pc),d1 DOLIB Close move.l #0,OutHand move.l #0,InHand move.l #FileName,d1 ; Copy file back move.l d1,EasyArg move.l #MODE_NEWFILE,d2 DOLIB Open move.l d0,InHand tst.l d0 beq.s NoRevision move.l #TempName,d1 move.l d1,EasyArg move.l #MODE_OLDFILE,d2 DOLIB Open move.l d0,OutHand tst.l d0 beq.s NoRevision .Loop move.l OutHand(pc),d1 ; Read in 4096 bytes move.l ARexxBuffer,d2 move.l #AREXXBUFFSIZE,d3 DOLIB Read tst.l d0 ; 0 read -> end it beq.s NoErrorFound blt.s NoRevision move.l d0,d3 ; Store read bytes to new file move.l InHand(pc),d1 move.l ARexxBuffer,d2 DOLIB Write tst.l d0 blt.s NoRevision bra .Loop NoRevision LNKLIB IoErr,_DOSBase ; Get error number tst.l d0 beq.s NoErrorFound move.l d0,ErrorNum bsr DisplayError ; Display error moveq #0,d7 bra.s GotError NoErrorFound moveq #1,d7 GotError move.l #TempName,d1 ; Delete file, if possible LNKLIB DeleteFile,_DOSBase tst.l OutHand ; Close files beq.s NoTempFile move.l OutHand(pc),d1 DOLIB Close move.l #TempName,d1 ; Delete file, if possible DOLIB DeleteFile NoTempFile tst.l InHand ; Close input handle beq.s NoLogWin move.l InHand(pc),d1 DOLIB Close NoLogWin tst.l OurLock beq.s .NoLock move.l PastLock(pc),d1 LNKLIB CurrentDir,_DOSBase move.l OurLock(pc),d1 DOLIB UnLock .NoLock move.l #0,InHand move.l #0,OutHand bsr CloseLogWin ; Close our window (AGAIN ???) .NoPort move.l ARexxAction(pc),d1 and.l #RXFF_RESULT,d1 beq.s .End cmp.b #2,LogInputEnd bne.s .NoCancel lea FalseStr(pc),a0 ; Create BOOL for error bsr StrLen LNKLIB CreateArgstring,_RexxSysBase tst.l d0 beq.s .End move.l d0,AResult2 bra.s .End .NoCancel lea TrueStr(pc),a0 ; Create BOOL for ok bsr StrLen LNKLIB CreateArgstring,_RexxSysBase tst.l d0 beq.s .End move.l d0,AResult2 .End move.l d7,d0 rts ********************************************************************** * Checks for inputs from Purpose/Log msg window * ********************************************************************** CheckRevInput move.b #0,LogInputEnd ; Set end flag for quit LoopLog tst.b LogInputEnd ; Are we to quit bne LogInputOver move.l LogHandle(pc),a0 ; Wait for a message move.l wd_UserPort(a0),a0 CALLSYS WaitPort LoopLogMsg move.l LogHandle(pc),a0 ; get it move.l wd_UserPort(a0),a0 LNKLIB GT_GetIMsg,_GadToolsBase tst.l d0 beq.s LoopLog move.l d0,a1 move.l im_Class(a1),d6 move.l d6,d0 and.l #(IDCMP_GADGETUP|IDCMP_GADGETDOWN),d0 beq.s .NoGad move.l im_IAddress(a1),a4 move.w gg_GadgetID(a4),d7 .NoGad move.w im_Code(a1),d5 cmp.w #'a',d5 blt.s .End and.w #~$20,d5 .End DOLIB GT_ReplyIMsg cmp.l #IDCMP_ACTIVEWINDOW,d6 ; Window activated ? bne.s LogWinInAct moveq #1,d0 lea LogGads,a0 move.l LogHandle(pc),a1 bsr ActStringGad bra LoopLogMsg LogWinInAct cmp.l #IDCMP_GADGETUP,d6 ; Gadget released bne.s LogNoGadUp cmp.w #6,d7 ; Ok gadget ? bne.s LogNoOk move.b #1,LogInputEnd ; Yep -> quit input bra.s LoopLogMsg LogNoOk cmp.w #7,d7 ; Cancel gadget ? bne.s LoopLogMsg move.b #2,LogInputEnd bra LoopLogMsg LogNoGadUp cmp.l #IDCMP_VANILLAKEY,d6 ; Keypress ? bne.s LogNoVKey moveq #0,d0 cmp.w #OKKEY,d5 ; o pressed ? bne.s LogNoOkKey LogOK move.b #1,LogInputEnd ; quit moveq #6,d0 bra.s LogFeedBack LogNoOkKey cmp.w #ESCKEY,d5 ; Cancel ? beq.s LogCancel cmp.w #CANCELKEY,d5 ; c pressed ? bne LoopLogMsg LogCancel move.b #2,LogInputEnd moveq #7,d0 LogFeedBack tst.l d0 beq LoopLogMsg lea LogGads,a0 move.l LogHandle,a5 bsr ButtonCheck bra LoopLogMsg LogNoVKey cmp.l #IDCMP_MENUPICK,d6 ; Picked a menu ? bne.s NoLogMenu cmp.w #-1,d5 beq.s EndLogMenu move.w d5,d2 and.w #$1f,d2 ; Get menunumber move.w d5,d1 asr.w #5,d1 and.w #$3f,d1 ; Get itemnumber move.l LogMenu,a1 bsr GetMenuPtr GTMENUITEM_USERDATA a2,a0 cmp.l #0,a0 beq.s EndLogMenu jmp (a0) EndLogMenu bra LoopLogMsg NoLogMenu cmp.l #IDCMP_CHANGEWINDOW,d6 ; Window moved ? bne LoopLogMsg move.l LogHandle(pc),a0 ; Store new position lea LogWinDef(pc),a1 bsr StoreWinPos bra LoopLogMsg LogInputOver rts ********************************************************************** * Checks for existing revision * ********************************************************************** CheckRevision move.l #FileName,d1 ; Try to open file move.l #MODE_OLDFILE,d2 move.l d1,EasyArg LNKLIB Open,_DOSBase move.l d0,InHand tst.l d0 beq.s FileNotFound moveq #14,d7 CheckLines move.l InHand(pc),d1 ; Search for our header move.l ARexxBuffer,d2 ; within the first 15 lines move.l #AREXXBUFFSIZE,d3 DOLIB FGets tst.l d0 beq.s FileError blt.s FileNotFound move.l RevHeader(pc),a0 move.l ARexxBuffer(pc),a1 moveq #-1,d7 bsr StrCmp ; current line our header ? tst.l d0 beq.s IsMine ; Yep -> go on dbf d7,CheckLines ; Loop FileError moveq #0,d7 ; Nothing found bra.s EndCheckRev IsMine moveq #1,d7 ; Got it bra.s EndCheckRev FileNotFound moveq #-1,d7 EndCheckRev move.b d7,OnlyLog ; store flag tst.l InHand ; Close file again beq.s .End move.l InHand(pc),d1 DOLIB Close move.l #0,InHand .End rts ********************************************************************** * Skip the following bytes * ********************************************************************** RSkipLines move.l InHand(pc),d1 ; Read line move.l ARexxBuffer,d2 move.l #AREXXBUFFSIZE,d3 DOLIB FGets tst.l d0 ble.s .Error move.l OutHand(pc),d1 ; Store line move.l ARexxBuffer,d2 DOLIB FPuts tst.l d0 blt.s .Error dbf d7,RSkipLines ; Loop moveq #1,d0 rts .Error moveq #0,d0 rts ********************************************************************** * Writes Log/Purpose message to file * ********************************************************************** RWriteMessage moveq #4,d7 ; Now loop for message lines .LoopPurp tst.b (a4) ; line ok ? beq.s .EndPurp move.l OutHand(pc),d1 ; Write initial chars move.l RevLine(pc),d2 DOLIB FPuts tst.l d0 blt.s .Error move.l a4,a0 bsr StrLen move.b #$0a,0(a0,d0) move.l OutHand(pc),d1 move.l a4,d2 DOLIB FPuts tst.l d0 blt.s .Error .EndPurp lea 77(a4),a4 ; Loop dbf d7,.LoopPurp .Error rts ********************************************************************** * Copy message eneterd to desired location * ********************************************************************** CopyMessage lea LogGads(pc),a2 ; Copy contents of string gads move.l (a2),a2 moveq #4,d7 ; Loop for 5 gadgets .Loop move.l gg_SpecialInfo(a2),a0 move.l si_Buffer(a0),a0 move.l a3,a1 bsr StrCpy ; Copy string to buffer move.l gg_NextGadget(a2),a2 lea 77(a3),a3 ; Next buffer dbf d7,.Loop rts ********************************************************************** * Deletes our environment variables * ********************************************************************** DeleteEnvs move.l #EnvDayString,d1 move.l #GVF_GLOBAL_ONLY,d2 LNKLIB DeleteVar,_DOSBase move.l #EnvDateString,d1 move.l #GVF_GLOBAL_ONLY,d2 DOLIB DeleteVar move.l #EnvTimeString,d1 move.l #GVF_GLOBAL_ONLY,d2 DOLIB DeleteVar rts ********************************************************************** * Display Msg that only to be run under Kick2.x * ********************************************************************** OnlyKick20 move.l OurTask,a1 ; Did we come from WB ? tst.l pr_CLI(a1) beq.s .FromWB LNKLIB Output,_DOSBase move.l d0,d1 move.l #Only20Txt,d2 move.l #Only20TxtEnd-Only20Txt,d3 DOLIB Write rts .FromWB lea IntName(pc),a1 ; try to open IntBase moveq #0,d0 CALLSYS OpenLibrary tst.l d0 beq.s OnlyKick20Ret move.l d0,_IntuitionBase sub.l a0,a0 ; Display requester lea Only20ITxt(pc),a1 lea OkITxt(pc),a2 move.l a2,a3 move.l #0,d0 move.l #0,d1 move.l #300,d2 move.l #60,d3 LNKLIB AutoRequest,_IntuitionBase OnlyKick20Ret rts ********************************************************************** * Display an error * ********************************************************************** DisplayError tst.l ErrorNum bge.s .GoOn rts .GoOn move.l ErrorNum(pc),d0 ; Get error num cmp.l #2,d0 ; Is it the broker set up error ? bne.s NoDoubleMean ; Nope -> go on tst.l DoublePort ; Did we already had a port ? beq.s NoDoubleMean ; Nope -> go on rts NoDoubleMean movem.l RegsAll,-(sp) cmp.l #200,d0 ; Display DOS error ? blt.s .OurError ; Nope -> go on sub.l #200,d0 asl.l #2,d0 lea DosErrors(pc),a0 move.l 0(a0,d0),a0 ; Get dos error bra.s .DosError .OurError lea EasyTexts(pc),a0 asl.l #2,d0 move.l 0(a0,d0),a0 ; get adr of error-txt .DosError lea MyEasyRequest(pc),a1 ; Display Easy-Requester move.l #EasyTitle,es_Title(a1) move.l a0,es_TextFormat(a1) move.l #EasyGadget,es_GadgetFormat(a1) sub.l a0,a0 sub.l a2,a2 lea EasyArg(pc),a3 LNKLIB EasyRequestArgs,_IntuitionBase move.l #-1,ErrorNum move.l #0,EasyArg movem.l (sp)+,RegsAll rts ********************************************************************** * Compare two strings * ********************************************************************** StrCmp moveq #0,d0 moveq #0,d1 movem.l a0/a1,-(sp) ; Store pointers .Loop move.b (a0)+,d0 ; get chars move.b (a1)+,d1 tst.b d0 ; Source string ended ? beq.s .EndSrc ; yep -> final check cmp.b #$0a,d0 ; a newline ? beq.s .EndSrc ; yep -> final check or.b #$20,d0 ; make case-insensitive or.b #$20,d1 cmp.b d0,d1 ; equal ? bne.s .Invalid dbf d7,.Loop movem.l (sp)+,a0/a1 moveq #0,d0 rts .Invalid moveq #1,d0 ; Error flag movem.l (sp)+,a0/a1 rts .EndSrc cmp.b d0,d1 ; last chars equal ? bne.s .Invalid ; Nope -> error moveq #0,d0 ; a ok movem.l (sp)+,a0/a1 rts ********************************************************************** * Copy a string * ********************************************************************** StrCpy move.b (a0)+,d0 move.b d0,(a1)+ tst.b d0 beq.s .End bra.s StrCpy .End rts ********************************************************************** * Concat 2 string * ********************************************************************** StrCat tst.b (a1)+ beq.s .Loop bra StrCat .Loop subq.l #1,a1 bra StrCpy ********************************************************************** * Copy a string up to x chars or end of string * ********************************************************************** StrNCpy move.b (a0)+,d0 move.b d0,(a1)+ tst.b d0 beq.s .End dbf d7,StrNCpy .End rts ********************************************************************** * Calc length of a string * ********************************************************************** StrLen move.l a0,-(sp) moveq #0,d0 .Loop tst.b (a0)+ beq.s .End addq.w #1,d0 bne.s .Loop .End move.l (sp)+,a0 rts ********************************************************************** * Just skip the blanks in a string * ********************************************************************** SkipBlanks cmp.b #' ',(a0) ; Loop while there are spaces beq.s .NoEnd ; and tabs cmp.b #$09,(a0) beq.s .NoEnd cmp.b #'"',(a0) beq.s .NoEnd cmp.b #"'",(a0) beq.s .NoEnd tst.b (a0) beq.s .GotEnd bra.s .GotEnd .NoEnd addq.l #1,a0 bra.s SkipBlanks .GotEnd rts ********************************************************************** * Just a printf * ********************************************************************** PrintF movem.l RegsAll,-(sp) lea PutChProc(pc),a2 move.l ARexxBuffer(pc),a3 CALLSYS RawDoFmt movem.l (sp)+,RegsAll rts ********************************************************************** * Small dummy for RawDoFmt * ********************************************************************** PutChProc move.b d0,(a3)+ rts ********************************************************************** * Enable the broker * ********************************************************************** EnableBroker movem.l RegsAll,-(sp) tst.b Disabled ; Don`t enable when disabled bne.s .End move.l MyBroker(pc),a0 moveq #1,d0 LNKLIB ActivateCxObj,_CxBase bsr OnScreen bsr OnMouse .End movem.l (sp)+,RegsAll rts ********************************************************************** * Disable broker again * ********************************************************************** DisableBroker movem.l RegsAll,-(sp) tst.b Disabled bne.s .End move.l MyBroker(pc),a0 moveq #0,d0 LNKLIB ActivateCxObj,_CxBase bsr OnScreen bsr OnMouse .End movem.l (sp)+,RegsAll rts ********************************************************************** * Set new window positions * ********************************************************************** GetWinPos move.l ARexxBuffer(pc),a4 move.l a4,a5 .FindSlash tst.b (a5) ; If there was no / in pos -> quit beq.s .NoWinPos cmp.b #'/',(a5)+ beq.s .GotSlash bra .FindSlash .GotSlash move.b #0,-1(a5) ; Remove slash with 0 move.l a4,d1 ; a4 = String XPos / a5 = YPos move.l #WinLeftEdge,d2 ; Get offset LNKLIB StrToLong,_DOSBase tst.l d1 blt.s .LError tst.l d0 ; If coord is > 0 -> go on bge.s .WinSLOk .LError move.l #0,WinLeftEdge ; Set to 0 .WinSLOk move.l a5,d1 move.l #WinTopEdge,d2 ; Get Y offset DOLIB StrToLong,_DOSBase tst.l d1 blt.s .TError tst.l d0 bge.s .WinSTOk .TError move.l #0,WinTopEdge ; Set to 0 if specified < 0 .WinSTOk moveq #1,d0 rts .NoWinPos moveq #0,d0 rts ********************************************************************** * Adjusts the window so that it will reside within screen * ********************************************************************** AdjustWinPos move.w nw_LeftEdge(a0),d0 ; Get position where window might "end" move.w nw_TopEdge(a0),d1 add.w nw_Width(a0),d0 add.w nw_Height(a0),d1 move.w sc_Width(a1),d2 move.w sc_Height(a1),d3 cmp.w d0,d2 bge.s .LOk sub.w nw_Width(a0),d2 ; readjust left edge move.w d2,nw_LeftEdge(a0) .LOk cmp.w d1,d3 bge.s .ROk sub.w nw_Height(a0),d3 ; readjust top edge move.w d3,nw_TopEdge(a0) .ROk rts ********************************************************************** * Store new position of window within NewWindow * ********************************************************************** StoreWinPos move.w wd_LeftEdge(a0),nw_LeftEdge(a1) move.w wd_TopEdge(a0),nw_TopEdge(a1) rts ********************************************************************** * Remake the CheckBox ticks if the main window is open * ********************************************************************** RemakeGadgets move.b DoActivate(pc),d0 ; Set checkbox-ticks move.l #ACTIGAD,d1 ; according to modes bsr SetControlBox move.b MouseMode(pc),d0 move.l #MODEGAD,d1 bsr SetControlBox move.b ShowClock(pc),d0 move.l #DISPLAYGAD,d1 bsr SetControlBox move.b ClockWin(pc),d0 move.l #WINDOWGAD,d1 bsr SetControlBox move.b ShowSecs(pc),d0 move.l #SECSGAD,d1 bsr SetControlBox move.b AmiDate(pc),d0 move.l #AMIGAD,d1 bsr SetControlBox move.b ShowDay(pc),d0 move.l #DAYGAD,d1 bsr SetControlBox move.b ShowDate(pc),d0 move.l #DATEGAD,d1 bsr SetControlBox move.b ShortDay(pc),d0 move.l #SHORTGAD,d1 bsr SetControlBox move.b DoAlarm(pc),d0 move.l #ALARMMODEGAD,d1 bsr SetControlBox move.b SetEnv(pc),d0 move.l #ENVGAD,d1 bsr SetControlBox move.b CycleWin(pc),d0 move.l #CYCLEGAD,d1 bsr SetControlBox move.b KeyClick(pc),d0 move.l #CLICKGAD,d1 bsr SetControlBox move.b WBFront(pc),d0 move.l #WBFRONTGAD,d1 bsr.s SetControlBox move.b LeftyMouse(pc),d0 move.l #LEFTYGAD,d1 bsr.s SetControlBox move.b ESCClose(pc),d0 move.l #WESCGAD,d1 bsr.s SetControlBox move.b MapUmlaut(pc),d0 move.l #UMLAUTGAD,d1 bsr.s SetControlBox rts ********************************************************************** * Give visual feedback for button press * * D0 = Number of gadget * * A0 = Pointer to first gadget * * A5 = Pointer to window * ********************************************************************** ButtonCheck movem.l RegsAll,-(sp) cmp.l #0,a5 beq.s .End bsr GetGadgetPtr move.l a0,a4 or.w #GFLG_SELECTED,gg_Flags(a4) move.l a4,a0 move.l a5,a1 sub.l a2,a2 moveq #1,d0 LNKLIB RefreshGList,_IntuitionBase moveq #5,d1 LNKLIB Delay,_DOSBase and.w #~GFLG_SELECTED,gg_Flags(a4) move.l a4,a0 move.l a5,a1 sub.l a2,a2 moveq #1,d0 LNKLIB RefreshGList,_IntuitionBase .End movem.l (sp)+,RegsAll rts ********************************************************************** * Only a small dummy for shorter access to ControlCheckGads * * D0 = CheckBox mode * * D1 = Number of gadget * ********************************************************************** SetControlBox movem.l d0-d1,-(sp) lea ControlGads,a0 move.l WndHandle,a1 bsr.s SetCheckBox movem.l (sp)+,d0-d1 subq.l #1,d1 moveq #1,d2 bra.s SetControlMenu ********************************************************************** * Set a checkbox to specified value * * D0 = Mode * * D1 = Number of gadget * * A0 = Address of GadgetList * * A1 = Address of window * ********************************************************************** SetCheckBox movem.l RegsAll,-(sp) cmp.l #0,a1 beq.s .End and.l #$000000ff,d0 move.l d0,SelectMode ; Set tag state move.l d1,d0 bsr GetGadgetPtr sub.l a2,a2 lea CheckBoxTags(pc),a3 ; Set new gadget attributes LNKLIB GT_SetGadgetAttrsA,_GadToolsBase .End movem.l (sp)+,RegsAll rts ********************************************************************** * Get a pointer to a menuitem * * A1 = Pointer to menustrip * * D1 = ItemNumber * * D2 = MenuNumber * ********************************************************************** GetMenuPtr ext.l d1 ext.l d2 move.l a1,a2 .GetMenu tst.l d2 beq.s .GotMenu move.l mu_NextMenu(a2),a2 subq.l #1,d2 bra.s .GetMenu .GotMenu move.l mu_FirstItem(a2),a2 .GetItem tst.l d1 beq.s .GotItem move.l mi_NextItem(a2),a2 subq.l #1,d1 bra.s .GetItem .GotItem rts ********************************************************************** * Set a control toogle menu to specified value * * D0 = Mode * * D1 = ItemNumber * * D2 = MenuNumber * ********************************************************************** SetControlMenu move.l MainMenu,a1 move.l WndHandle,a0 bra.s SetToggleMenu ********************************************************************** * Set a toggle menu to specified value * * D0 = Mode * * D1 = ItemNumber * * D2 = MenuNumber * * A0 = Window * * A1 = Menu * ********************************************************************** SetToggleMenu cmp.l #0,a0 beq.s .End bsr GetMenuPtr move.w mi_Flags(a2),d1 ; Get Flags for menu tst.b d0 beq.s .ClearFlag or.w #CHECKED,d1 bra.s .FlagAltered .ClearFlag and.w #~CHECKED,d1 .FlagAltered move.w d1,mi_Flags(a2) move.l a0,a4 LNKLIB ResetMenuStrip,_IntuitionBase move.l a4,a0 sub.l a1,a1 LNKLIB GT_RefreshWindow,_GadToolsBase .End rts ********************************************************************** * Set MX Gadget to specified value * * D0 = Number of button active * * D1 = Number of gadget * * A0 = Address of GadgetList * * A1 = Address of window * * A2 = Address of labels * ********************************************************************** SetMXGad movem.l RegsAll,-(sp) cmp.l #0,a1 beq.s .End and.l #$000000ff,d0 move.l d0,MxActive move.l a2,MxLabels move.l d1,d0 bsr GetGadgetPtr sub.l a2,a2 lea MxTags(pc),a3 LNKLIB GT_SetGadgetAttrsA,_GadToolsBase .End movem.l (sp)+,RegsAll rts ********************************************************************** * Set a cycle gadget to a specified value * * D0 = Number of gadget * * A0 = Address of GadgetList * * A1 = Pointer to window * * A2 = Pointer to labels * * D1 = Number of setting * ********************************************************************** SetCycleGad movem.l RegsAll,-(sp) cmp.l #0,a1 beq.s .End move.l d1,CycActive move.l a2,CycLabels bsr GetGadgetPtr sub.l a2,a2 lea CycleTags,a3 LNKLIB GT_SetGadgetAttrsA,_GadToolsBase .End movem.l (sp)+,RegsAll rts ********************************************************************** * Set the contents of a string gadget * * D0 = Number of gadget * * A0 = Address of GadgetList * * A1 = Pointer to window * * D1 = Maximum of chars * * A2 = Pointer to new string * ********************************************************************** SetStringGad movem.l RegsAll,-(sp) cmp.l #0,a1 beq.s .End bsr.s GetGadgetPtr move.l d1,StrMax move.l a2,StringConts sub.l a2,a2 lea StringTags,a3 LNKLIB GT_SetGadgetAttrsA,_GadToolsBase .End movem.l (sp)+,RegsAll rts ********************************************************************** * Set the contents of a string gadget * * D0 = Number of gadget * * A0 = Address of GadgetList * * A1 = Pointer to window * * D1 = Maximum of chars * * D2 = New value * ********************************************************************** SetIntegerGad movem.l RegsAll,-(sp) cmp.l #0,a1 beq.s .End move.l d1,IntMax move.l d2,IntConts bsr.s GetGadgetPtr sub.l a2,a2 lea IntegerTags,a3 LNKLIB GT_SetGadgetAttrsA,_GadToolsBase .End movem.l (sp)+,RegsAll rts ********************************************************************** * Activate a string gadget * * D0 = Number of gadget * * A0 = Pointer to GadgetList * * A1 = Pointer to Window * ********************************************************************** ActStringGad movem.l RegsAll,-(sp) bsr.s GetGadgetPtr sub.l a2,a2 LNKLIB ActivateGadget,_IntuitionBase movem.l (sp)+,RegsAll rts ********************************************************************** * Get Address of a gadget * * D0 = Number of gadget * * A0 = Pointer to first gadget * ********************************************************************** GetGadgetPtr subq.l #1,d0 asl.l #2,d0 move.l 0(a0,d0),a0 rts ********************************************************************** * Changes a HotKey for a Filter * * D7 = Number of gadget to change * * A0 = Pointer to window * * A1 = Pointer to string * * A4 = Pointer to filter * * A5 = Pointer to filterdescription * * A3 = Pointer to new filterdescription * ********************************************************************** RemakeHotKey tst.l MyBroker ; Execute routine, only if bne.s .GoOn ; Broker is really there rts .GoOn movem.l RegsAll,-(sp) movem.l a0/a1,-(sp) bsr DisableBroker ; Disable the broker link a2,#-HOTKEYSIZE ; Create local buffer move.l a5,a0 ; Copy old hotkey lea -HOTKEYSIZE(a2),a1 bsr StrCpy move.l a3,a0 ; Copy new HotKey move.l a5,a1 bsr StrCpy move.l a4,a0 ; Try to set new filter move.l a5,a1 LNKLIB SetFilter,_CxBase move.l a4,a0 ; Error occured ? DOLIB CxObjError tst.l d0 beq.s GotNewChangeHK ; Nope -> go on lea -HOTKEYSIZE(a2),a0 ; Remake HotKey move.l a5,a1 bsr StrCpy move.l a4,a0 ; Reset old hotkey move.l a5,a1 DOLIB SetFilter GotNewChangeHK unlk a2 movem.l (sp)+,a0/a1 cmp.l #0,a0 beq.s .NoNewTitle move.l #-1,a2 LNKLIB SetWindowTitles,_IntuitionBase .NoNewTitle move.l d7,d0 lea HotKeyGads,a0 move.l HotKeyHandle(pc),a1 move.l #30,d1 move.l a5,a2 bsr SetStringGad bsr EnableBroker movem.l (sp)+,RegsAll rts ********************************************************************** * Set busy for a window and disable all it`s gadgets * * A0 = Pointer to window * ********************************************************************** SetBusy movem.l RegsAll,-(sp) cmp.l #0,a0 beq.s .End move.l a0,a4 ; Set pointer lea BusyPtr,a1 move.l #16,d0 move.l #16,d1 move.l #-6,d2 move.l #0,d3 LNKLIB SetPointer,_IntuitionBase move.l #1,GadDisable move.l wd_FirstGadget(a4),a5 .Loop cmp.l #0,a5 ; Disable all gadgets beq.s .End move.l a5,a0 move.l a4,a1 sub.l a2,a2 lea DisableTag(pc),a3 LNKLIB GT_SetGadgetAttrsA,_GadToolsBase move.l gg_NextGadget(a5),a5 bra.s .Loop .End movem.l (sp)+,RegsAll rts ********************************************************************** * Un-Busy a window and reenable all gadgets again * * A0 = Pointer to window to be re-enabled * ********************************************************************** UnBusy movem.l RegsAll,-(sp) cmp.l #0,a0 beq.s .End move.l a0,a4 ; Clear pointer LNKLIB ClearPointer,_IntuitionBase move.l #0,GadDisable move.l wd_FirstGadget(a4),a5 ; Enable all gadgets .Loop cmp.l #0,a5 beq.s .End move.l a5,a0 move.l a4,a1 sub.l a2,a2 lea DisableTag(pc),a3 LNKLIB GT_SetGadgetAttrsA,_GadToolsBase move.l gg_NextGadget(a5),a5 bra.s .Loop .End movem.l (sp)+,RegsAll rts ********************************************************************** * Lock the Workbench-Screen * ********************************************************************** LockScreen sub.l a0,a0 LNKLIB LockPubScreen,_IntuitionBase move.l d0,-4(a5) rts ********************************************************************** * Unlock the locked screen * ********************************************************************** UnlockScreen tst.l -4(a5) beq.s .End sub.l a0,a0 move.l -4(a5),a1 LNKLIB UnlockPubScreen,_IntuitionBase .End rts ********************************************************************** * Display Online-Help text for given Menu-Entry * * D0 = Windownumber (1 = Control, 2 = Prefs, 3 = Bill, 4 = HotKey * ********************************************************************** OnlineHelp tst.b HelpPage bne.s OtherHelp cmp.w #-1,d5 beq NoHelp move.w d5,d2 and.w #$1f,d2 ; Get menunumber move.w d5,d1 asr.w #5,d1 and.w #$3f,d1 ; Get itemnumber ext.l d2 ext.l d1 mulu #1000,d0 ; Make unique FileName mulu #100,d2 add.l d0,d1 add.l d2,d1 move.l d1,HelpNum lea LIntFormat,a0 ; Convert to string lea HelpNum,a1 lea PutChProc,a2 lea HelpName,a3 CALLSYS RawDoFmt OtherHelp move.l #HELPMAXSIZE,d0 ; Try to allocate buffer move.l #MEMF_CLEAR,d1 ; for helptext CALLSYS AllocMem move.l d0,HelpBuffer tst.l d0 bne.s .GoOn move.l #12,ErrorNum bsr DisplayError rts .GoOn move.l #HelpFile,d1 ; Try to open Help file move.l #MODE_OLDFILE,d2 LNKLIB Open,_DOSBase tst.l d0 beq NoHelp move.l d0,d7 move.l d0,d1 move.l HelpBuffer,d2 ; Read in text move.l #$ffffff,d3 DOLIB Read move.l d0,d6 move.l d7,d1 DOLIB Close ; Close file tst.l d6 blt NoHelp move.l HelpBuffer(pc),a0 ; Copy header of help text lea HelpDescr(pc),a1 .CopyHeader move.b (a0)+,d0 cmp.b #$0a,d0 beq.s .HeaderDone move.b d0,(a1)+ bra.s .CopyHeader .HeaderDone move.b #0,(a1) move.l a0,HelpText moveq #0,d0 ; Calc number of lines of .CalcLines tst.b (a0) ; Help text beq.s .GotLines cmp.b #$0a,(a0) bne.s .NoLine addq.l #1,d0 .NoLine addq.l #1,a0 bra.s .CalcLines .GotLines move.l d0,ScrollTotal ; Write new settings move.l #0,ScrollTop move.l #9,ScrollVis link a5,#-4 ; Lock screen bsr LockScreen tst.l d0 beq HelpWinError move.l -4(a5),a0 ; Get visual info sub.l a1,a1 LNKLIB GetVisualInfoA,_GadToolsBase move.l d0,HelpVisInfo tst.l d0 beq HelpWinError lea DummyNewGadget(pc),a0 move.l d0,gng_VisualInfo(a0) move.l d0,BevelVisInfo move.l #HELPWINWIDTH,WinWidth move.l #HELPWINHEIGHT,WinHeight move.l #HELPWINIDCMP,WinIDCMP move.l #HELPWINFLAGS,WinFlags lea HelpWinDef(pc),a0 ; Open window move.l -4(a5),a1 bsr AdjustWinPos lea WindowTags(pc),a1 LNKLIB OpenWindowTagList,_IntuitionBase move.l d0,HelpHandle tst.l d0 beq HelpWinError lea HelpMenuDef,a0 ; Create menu strip sub.l a1,a1 ; No tags LNKLIB CreateMenusA,_GadToolsBase move.l d0,HelpMenu tst.l d0 beq HelpWinError move.l HelpMenu(pc),a0 ; Do the layout on window move.l HelpVisInfo(pc),a1 sub.l a2,a2 DOLIB LayoutMenusA tst.l d0 beq HelpWinError move.l HelpHandle(pc),a0 move.l wd_RPort(a0),HelpRPort moveq #0,d7 move.b wd_BorderTop(a0),d7 move.l HelpRPort(pc),a0 ; Draw text-box move.l #INTERWIDTH,d0 move.l #INTERHEIGHT,d1 add.l d7,d1 move.l #HELPWINWIDTH-30,d2 move.l #HELPWINHEIGHT-(INTERHEIGHT*2),d3 lea BevelTag(pc),a1 LNKLIB DrawBevelBoxA,_GadToolsBase lea HelpGadget(pc),a0 ; Create Context-Gadget LNKLIB CreateContext,_GadToolsBase tst.l d0 beq HelpWinError move.l d0,ThisGadget move.w #1,GadNum lea DummyNewGadget(pc),a1 ; Create scroller gadget move.w #INTERHEIGHT,d0 add.w d7,d0 move.w d0,gng_TopEdge(a1) move.w #HELPWINWIDTH-20,gng_LeftEdge(a1) move.w #20,gng_Width(a1) move.w #HELPWINHEIGHT-(INTERHEIGHT*2),d0 move.w d0,gng_Height(a1) move.l #0,gng_GadgetText(a1) move.l #0,gng_Flags(a1) move.l #SCROLLER_KIND,d0 move.l ThisGadget,a0 lea ScrollerTags,a2 DOLIB CreateGadgetA tst.l d0 beq HelpWinError move.l d0,HelpScroll lea GadgetTxtAttr(pc),a0 ; Set font for window LNKLIB OpenFont,_GfxBase move.l d0,HelpFont tst.l d0 beq HelpWinError move.l HelpRPort(pc),a1 move.l d0,a0 DOLIB SetFont move.l HelpHandle(pc),a0 ; Add gadgets to window move.l HelpGadget(pc),a1 move.l #-1,d0 move.l #-1,d1 sub.l a2,a2 LNKLIB AddGList,_IntuitionBase move.l HelpGadget(pc),a0 ; Make them appear move.l HelpHandle(pc),a1 sub.l a2,a2 move.l #-1,d0 DOLIB RefreshGList move.l HelpHandle,a0 move.l HelpMenu,a1 DOLIB SetMenuStrip move.l HelpHandle,a0 ; Redisplay gadget sub.l a1,a1 LNKLIB GT_RefreshWindow,_GadToolsBase move.l WndHandle,a0 ; Make all gadgets busy bsr SetBusy move.l PrefsHandle,a0 bsr SetBusy move.l HotKeyHandle,a0 bsr SetBusy bsr PrintHelp ; Print first help page HelpWinLoop move.l HelpHandle(pc),a0 ; Wait for message move.l wd_UserPort(a0),a0 CALLSYS WaitPort HelpMsgLoop move.l HelpHandle(pc),a0 move.l wd_UserPort(a0),a0 LNKLIB GT_GetIMsg,_GadToolsBase tst.l d0 beq HelpWinLoop move.l d0,a1 ; Get important data move.l im_Class(a1),d6 move.w im_Code(a1),d5 move.w im_Qualifier(a1),d7 DOLIB GT_ReplyIMsg cmp.l #IDCMP_CLOSEWINDOW,d6 ; Closed Help window ? beq HelpWinEnd cmp.l #IDCMP_GADGETUP,d6 ; Gadget released ? bne.s NoHelpGadUp move.b #0,Scrolling ; No moving-scroll ext.l d5 ; Display new page cmp.l ScrollTop,d5 beq.s NoHelpGadUp move.l d5,ScrollTop movem.l d5-d7,-(sp) bsr PrintHelp movem.l (sp)+,d5-d7 NoHelpGadUp cmp.l #IDCMP_GADGETDOWN,d6 ; Gadget pressed ? bne.s NoHelpGadDown move.b #1,Scrolling NoHelpGadDown cmp.l #IDCMP_GADGETDOWN,d6 beq.s .DoScroll cmp.l #IDCMP_MOUSEMOVE,d6 ; Mouse moved bne.s .NoScroll tst.b Scrolling ; and scrolling enabled ? beq.s .NoScroll cmp.l #9,ScrollTotal ; Display new area ble.s .NoScroll .DoScroll ext.l d5 cmp.l ScrollTop,d5 beq.s .NoScroll move.l d5,ScrollTop movem.l d5-d7,-(sp) bsr PrintHelp movem.l (sp)+,d5-d7 .NoScroll cmp.l #IDCMP_RAWKEY,d6 bne NoHelpRKey cmp.w #RESCKEY,d5 ; On ESC -> quit Help beq HelpWinEnd and.w #(IEQUALIFIER_LSHIFT|IEQUALIFIER_RSHIFT),d7 bne.s PageMove cmp.w #CURSORUP,d5 ; Unshifted CURSOR keys move bne.s NoRowUp HelpRowUp tst.l ScrollTop beq HelpMsgLoop subq.l #1,ScrollTop ; up one line bra DoKeyMove NoRowUp cmp.w #CURSORDOWN,d5 bne.s NoRowDown HelpRowDown cmp.l #9,ScrollTotal ble HelpMsgLoop move.l ScrollTotal(pc),d0 sub.l #9,d0 cmp.l ScrollTop,d0 ble HelpMsgLoop addq.l #1,ScrollTop ; down one line bra.s DoKeyMove NoRowDown bra HelpMsgLoop PageMove cmp.w #CURSORUP,d5 bne.s NoPageUp HelpPageUp tst.l ScrollTop beq HelpMsgLoop cmp.l #8,ScrollTop bge.s .UpFull move.l #0,ScrollTop bra.s .UpPage .UpFull subq.l #8,ScrollTop ; up one page .UpPage bra.s DoKeyMove NoPageUp cmp.w #CURSORDOWN,d5 bne.s NoPageDown HelpPageDown cmp.l #9,ScrollTotal ble HelpMsgLoop move.l ScrollTop(pc),d0 add.l #8,d0 ; down one page move.l ScrollTotal(pc),d1 sub.l #8,d1 cmp.l d1,d0 blt.s .DownFull move.l d1,d0 .DownFull cmp.l ScrollTop,d0 beq HelpMsgLoop move.l d0,ScrollTop bra.s DoKeyMove NoPageDown bra HelpMsgLoop DoKeyMove bsr PrintHelp ; Print new area move.l HelpScroll,a0 ; Remake scroll gadget move.l HelpHandle,a1 sub.l a2,a2 lea ScrollerTags,a3 LNKLIB GT_SetGadgetAttrsA,_GadToolsBase bra HelpMsgLoop NoHelpRKey cmp.l #IDCMP_MENUPICK,d6 ; Menu picked ? bne.s NoHelpMenu cmp.w #-1,d5 beq.s EndHelpMenu move.w d5,d2 and.w #$1f,d2 ; Get menunumber move.w d5,d1 asr.w #5,d1 and.w #$3f,d1 ; Get itemnumber move.w d1,d5 move.l HelpMenu,a1 bsr GetMenuPtr GTMENUITEM_USERDATA a2,a0 cmp.l #0,a0 beq.s EndHelpMenu jmp (a0) ; execute menu function EndHelpMenu bra HelpMsgLoop NoHelpMenu cmp.l #IDCMP_CHANGEWINDOW,d6 ; Window moved ? bne.s NoHelpMoved move.l HelpHandle,a0 lea HelpWinDef,a1 bsr StoreWinPos bra HelpMsgLoop NoHelpMoved bra HelpMsgLoop HelpWinEnd move.l WndHandle,a0 ; Unbusy windows bsr UnBusy move.l PrefsHandle,a0 bsr UnBusy move.l HotKeyHandle,a0 bsr UnBusy HelpWinError bsr UnlockScreen ; Unlock screen unlk a5 tst.l HelpFont beq.s .NoFont move.l HelpFont,a1 ; Close font LNKLIB CloseFont,_GfxBase .NoFont tst.l HelpHandle beq.s .NoWin move.l HelpHandle,a0 LNKLIB CloseWindow,_IntuitionBase ; Close window .NoWin tst.l HelpGadget beq.s .NoGad move.l HelpGadget,a0 LNKLIB FreeGadgets,_GadToolsBase ; Free gadget .NoGad tst.l HelpMenu beq.s .NoMenu move.l HelpMenu,a0 LNKLIB FreeMenus,_GadToolsBase ; Free menues .NoMenu tst.l HelpVisInfo beq.s .NoVisInfo move.l HelpVisInfo,a0 LNKLIB FreeVisualInfo,_GadToolsBase ; Free VisInfo .NoVisInfo move.l #0,HelpHandle move.l #0,HelpGadget move.l #0,HelpVisInfo move.l #0,HelpFont move.l #0,HelpMenu NoHelp move.b #0,HelpPage tst.l HelpBuffer beq.s .NoBuff move.l HelpBuffer,a1 move.l #HELPMAXSIZE,d0 CALLSYS FreeMem .NoBuff rts ********************************************************************** * Print out 9 lines of a helptext * ********************************************************************** PrintHelp move.l HelpHandle(pc),a0 moveq #0,d7 move.b wd_BorderTop(a0),d7 move.l HelpRPort(pc),a1 moveq #0,d0 LNKLIB SetAPen,_GfxBase move.l HelpRPort(pc),a1 move.l #INTERWIDTH+2,d0 move.l #INTERHEIGHT+1,d1 add.l d7,d1 move.l #HELPWINWIDTH-28,d2 move.l #(HELPWINHEIGHT-(INTERHEIGHT*2)),d3 add.l d7,d3 DOLIB RectFill move.l HelpRPort(pc),a1 moveq #1,d0 DOLIB SetAPen add.l #INTERHEIGHT*3+2,d7 addq.l #2,d7 move.l HelpText(pc),a4 moveq #8,d6 move.l ScrollTop(pc),d0 .FindFirst tst.l d0 beq.s .GotFirst .FindNext cmp.b #$0a,(a4)+ bne .FindNext subq.l #1,d0 bra.s .FindFirst .GotFirst tst.b (a4) beq.s .HelpDone move.l HelpRPort(pc),a1 move.l #INTERWIDTH+4,d0 move.l d7,d1 LNKLIB Move,_GfxBase move.l HelpRPort(pc),a1 move.l a4,a0 moveq #0,d0 .GetLength cmp.b #$0a,(a4)+ beq.s .GotLength addq.l #1,d0 bra.s .GetLength .GotLength DOLIB Text add.l #9,d7 dbf d6,.GotFirst .HelpDone rts ********************************************************************** * Edit Hook for String/Integer gadgets * * A0 = Pointer to Hook itself * * A1 = Pointer to parameter * * A2 = Pointer to SGWork-Structure * * Provided editing is : * * Activating the next gadget on RETURN press * * Actuvating the previous gadget on CONTROL RETURN press * * Simulating HELP-Exit of gadget on ESC-Press * * Accessing menus via Key-Stroke RIGHT AMIGA - ShortCut * * Using CURSOR UP/DOWN for entering previous/next gadget * * Using CONTROL CURSOR LEFT/RIGHT to get to the prev/next word * ********************************************************************** StrEditFunc movem.l RegsAll,-(sp) cmp.l #SGH_KEY,0(a1) ; Key pressed ? bne .End move.l sgw_Actions(a2),d0 move.l d0,d1 and.l #SGA_END,d0 ; Gadget released ? beq.s .NoReturn ; Nope -> go on cmp.w #HELPKEY,sgw_Code(a2) ; HELP used to escape ? beq.s .NoReturn ; Yep -> go on move.l sgw_IEvent(a2),a3 move.w ie_Qualifier(a3),d2 and.w #(IEQUALIFIER_CONTROL),d2 beq.s .NextGadget or.l #SGA_PREVACTIVE,d1 ; On control previous gadget bra.s .ActGadget .NextGadget or.l #SGA_NEXTACTIVE,d1 .ActGadget move.l d1,sgw_Actions(a2) bra .End .NoReturn move.l sgw_IEvent(a2),a3 ; User pressed ESC ? cmp.w #RESCKEY,ie_Code(a3) bne.s .NoEsc move.l #SGA_END,sgw_Actions(a2) ; Simulate release of gadget move.w #HELPKEY,sgw_Code(a2) bra .End .NoEsc cmp.w #$4c,ie_Code(a3) ; Cursor UP ? bne.s .NoUp move.l #SGA_END|SGA_PREVACTIVE,sgw_Actions(a2) move.w #$44,sgw_Code(a2) bra .End .NoUp cmp.w #$4d,ie_Code(a3) ; Cursor DOWN ? bne.s .NoDown move.l #SGA_END|SGA_NEXTACTIVE,sgw_Actions(a2) move.w #$44,sgw_Code(a2) bra .End .NoDown move.w ie_Qualifier(a3),d0 and.w #IEQUALIFIER_CONTROL,d0 ; CONTROL pressed ? beq .NoWordJump move.l sgw_WorkBuffer(a2),a1 ; Get pointer to buffer move.w sgw_BufferPos(a2),d0 ; Get cursor position cmp.w #$4f,ie_Code(a3) ; Jump to left word ? beq.s .JumpLeft cmp.w #$4e,ie_Code(a3) ; Jump to right word ? beq.s .JumpRight bra .NoWordJump .JumpLeft tst.w d0 ; Already at beginning ? beq .End moveq #-1,d1 ; Set new position .LeftLoop1 tst.w d0 ; All done ? blt.s .FirstLeft ; Yep -> first loop donw cmp.b #' ',0(a1,d0.w) ; Got a space ? beq.s .NoCharLeft ; Yep -> loop move.w d0,d1 ; Nope -> Store new position bra.s .FirstLeft .NoCharLeft subq.w #1,d0 ; Next char to the left bra.s .LeftLoop1 .FirstLeft cmp.w #-1,d1 ; Got new position ? bne.s .NoNegLeft moveq #0,d1 ; Nope -> clear position .NoNegLeft tst.w d1 ; New position marked ? beq.s .JumpedLeft ; Nope -> jump to first char move.w d1,d0 ; Copy new position moveq #-1,d1 ; Clear position .LeftLoop2 tst.w d0 ; Already at first char ? blt.s .JumpedLeft ; Yep -> position cursor cmp.b #' ',0(a1,d0.w) ; Now skip chars different to space bne.s .NoSpaceLeft move.w d0,d1 ; Store first pos of char after space addq.w #1,d1 bra.s .JumpedLeft ; DONE .NoSpaceLeft subq.w #1,d0 ; Loop for chars bra .LeftLoop2 .JumpedLeft tst.w d1 ; Do we have a new position ? bge.s .GotLeft ; Yep -> Repos move.w #0,sgw_BufferPos(a2) ; Set cursor to first char bra.s .LeftDone .GotLeft move.w d1,sgw_BufferPos(a2) ; Set cursor to new position .LeftDone move.w #EO_MOVECURSOR,sgw_EditOp(a2) bra .End .JumpRight cmp.w sgw_NumChars(a2),d0 ; Already at end of string ? beq .End ; Yep -> no movement moveq #-1,d1 .RightLoop cmp.w sgw_NumChars(a2),d0 ; All chars checked ? beq.s .JumpedRight ; Yep -> end of movement cmp.b #' ',0(a1,d0.w) ; Space encountered ? bne.s .NoSpaceRight ; Nope -> go on .RightSpaceLoop cmp.w sgw_NumChars(a2),d0 ; All chars checked ? beq.s .JumpedRight ; Yep -> end of movement cmp.b #' ',0(a1,d0.w) ; Still a space ? beq.s .NoRightChar ; Yep -> loop for spaces move.w d0,d1 ; Got new word bra.s .JumpedRight ; -> Do movement .NoRightChar addq.w #1,d0 ; Next char (SPACE) bra .RightSpaceLoop ; Loop for spaces .NoSpaceRight addq.w #1,d0 ; Loop for normal chars bra .RightLoop .JumpedRight tst.w d1 ; Got new position ? bge.s .GotRight ; Yep -> do so move.w sgw_NumChars(a2),sgw_BufferPos(a2) bra.s .RightDone .GotRight move.w d1,sgw_BufferPos(a2) ; Store new position .RightDone move.w #EO_MOVECURSOR,sgw_EditOp(a2) bra.s .End .NoWordJump move.l sgw_IEvent(a2),a3 move.w ie_Qualifier(a3),d0 ; Right Amiga pressed ? and.w #IEQUALIFIER_RCOMMAND,d0 beq.s .NoAmiga cmp.w #96,ie_Code(a3) ; Char entered ? bge.s .NoAmiga move.w ie_Qualifier(a3),d0 ; Any shift pressed ? and.w #(IEQUALIFIER_LSHIFT|IEQUALIFIER_RSHIFT),d0 bne.s .DoMenu cmp.w #$32,ie_Code(a3) ; Magic X beq.s .NoAmiga cmp.w #$10,ie_Code(a3) ; or Q pressed ? beq.s .NoAmiga .DoMenu move.l sgw_Actions(a2),d0 ; Ok -> Then use the menues or.l #(SGA_END|SGA_REUSE),d0 and.l #~(SGA_USE|SGA_BEEP),d0 move.l d0,sgw_Actions(a2) move.l sgw_GadgetInfo(a2),a0 move.l ggi_Window(a0),DoActWindow ; Tell menu owner to reactivate move.l sgw_Gadget(a2),DoActGadget ; gadget bra.s .End .NoAmiga .End movem.l (sp)+,RegsAll rts ********************************************************************** * A large multiplication routine LONG * LONG * ********************************************************************** _mulu move.w d1,d2 mulu.w d0,d2 move.l d1,d3 swap d3 mulu.w d0,d3 swap d3 clr.w d3 add.l d3,d2 swap d0 mulu.w d1,d0 swap d0 clr.w d0 add.l d2,d0 rts ********************************************************************** * A large division routine LONG / LONG * ********************************************************************** _divu move.l d1,-(a7) bsr.s .l1 move.l (a7)+,d1 tst.l d0 rts .l1 swap d1 tst.w d1 bne.s .l2 swap d1 move.w d1,-(a7) move.w d0,-(a7) clr.w d0 swap d0 divu.w d1,d0 move.l d0,d1 swap d0 move.w (a7)+,d1 divu.w (a7)+,d1 move.w d1,d0 clr.w d1 swap d1 rts .l2 swap d1 move.w d2,-(a7) move.l d3,-(a7) move.l d1,d3 move.l d0,d1 clr.w d1 swap d1 swap d0 clr.w d0 move.w #$f,d2 .l4 add.l d0,d0 addx.l d1,d1 cmp.l d1,d3 bhi.s .l3 sub.l d3,d1 addq.w #1,d0 .l3 dbf d2,.l4 move.l (a7)+,d3 move.w (a7)+,d2 rts ********************************************************************** * Helppage for CLI * ********************************************************************** CliHelpPage dc.b $0a,$0a BOLDON SETFRONTPEN 2 dc.b "KCommodity V" REVISION dc.b " (" REVDATE dc.b ") " STYLENORMAL SETFRONTPEN 1 dc.b "by Kai Iske. SHAREWARE",$0a dc.b "USAGE : KCommodity",$0a dc.b " ToolType : Description : Default :",$0a dc.b " ---------------------------------------------------------------",$0a dc.b " [CX_PRIORITY=n] Priority of Broker 5",$0a dc.b " [CX_POPKEY=s] PopUpKey for Window LCOMMAND HELP",$0a dc.b " [CX_POPUP=YES|NO] PopUp on startup YES",$0a dc.b " [PORTNAME=s] Set name for ARexx-Port KComm.1",$0a dc.b " [TOOLPRI=n] Priority of Program 0",$0a dc.b " [NOICON] Don`t display AppIcon ---",$0a dc.b $0a,$0a CliHelpPageLen EQU *-CliHelpPage PressKey SETFRONTPEN 2 dc.b "Press any key to continue....",13 SETFRONTPEN 1 PressKeyLen EQU *-PressKey ClearStr dc.b $9B,$30,$20,$70 ClearStrLen EQU *-ClearStr EndAnyStr dc.b $9B,$20,$70,$9b,$4b,$9B,"0;39;49m",0 EndAnyStrLen EQU *-EndAnyStr ********************************************************************** * Variables * ********************************************************************** IntName dc.b "intuition.library",0 ComName dc.b "commodities.library",0 DosName dc.b "dos.library",0 IconName dc.b "icon.library",0,0 LayerName dc.b "layers.library",0,0 GadName dc.b "gadtools.library",0,0 GfxName dc.b "graphics.library",0,0 DiskFontName dc.b "diskfont.library",0,0 RexxSysName dc.b "rexxsyslib.library",0,0 WBName dc.b "workbench.library",0 AslName dc.b "asl.library",0 TimerName dc.b "timer.device",0,0 AudioName dc.b "audio.device",0,0 ConsoleName dc.b "console.device",0,0 PortName dc.b "KComm-Port",0 TimerPortName dc.b "KComm-Timer-Port",0 AudioPortName dc.b "KComm-Audio-Port",0 ARexxPortName dc.b "KComm.1",0 ds.b 10 AppPortName dc.b "KComm-App-Port",0 EVEN TempName dc.b "T:KCX.TEMPFILE",0,0 ConWinDef dc.b "RAW:0/0//150/Telefone log info",0 EVEN CheckerName dc.b "KCOMM.TIME-PROCESS",0 EVEN RexxName dc.b "KCOMM.REXX-PROCESS",0 EVEN PrtName dc.b "PRT:",0 EVEN _IntuitionBase dc.l 0 _DOSBase dc.l 0 _IconBase dc.l 0 _CxBase dc.l 0 _LayersBase dc.l 0 _GadToolsBase dc.l 0 _GfxBase dc.l 0 _DiskFontBase dc.l 0 _RexxSysBase dc.l 0 _AslBase dc.l 0 _ConsoleBase dc.l 0 _WorkBenchBase dc.l 0 OurTask dc.l 0 MyToolTypes dc.l 0 MyDiskObj dc.l 0 WBMsg dc.l 0 MyRDArgs dc.l 0 Args dc.l 0 OldPri dc.l 0 BrokerPort dc.l 0 TimerPort dc.l 0 AudioPort dc.l 0 ARexxPort dc.l 0 DoublePort dc.l 0 AppPort dc.l 0 CheckerProc dc.l 0 CheckerProcSig dc.l 0 MyBroker dc.l 0 MsgType dc.l 0 MsgID dc.l 0 EventFilter dc.l 0 PopUpFilter dc.l 0 PageFilter dc.l 0 PrefsFilter dc.l 0 BillFilter dc.l 0 HotKeyFilter dc.l 0 ShellFilter dc.l 0 UmlautFilter dc.l 0 BrokerSigFlag dc.l 0 TimerSigFlag dc.l 0 ARexxSigFlag dc.l 0 AlarmSigFlag dc.l 0 HelpSigFlag dc.l 0 AppSigFlag dc.l 0 AlarmSigBit dc.l 0 HelpSigBit dc.l 0 ThisSig dc.l 0 RexxSig dc.l 0 RexxProc dc.l 0 WindowSigFlag dc.l 0 ClockSigFlag dc.l 0 MyILock dc.l 0 MouseX dc.l 0 MouseY dc.l 0 ActWindow dc.l 0 WndHandle dc.l 0 FirstGadget dc.l 0 VisInfo dc.l 0 MainMenu dc.l 0 ClockHandle dc.l 0 LogHandle dc.l 0 LogGadget dc.l 0 LogVisInfo dc.l 0 LogMenu dc.l 0 BillHandle dc.l 0 BillRPort dc.l 0 BillSigFlag dc.l 0 BillGadget dc.l 0 BillVisInfo dc.l 0 BillMenu dc.l 0 PrefsHandle dc.l 0 PrefsSigFlag dc.l 0 PrefsGadget dc.l 0 PrefsVisInfo dc.l 0 PrefsMenu dc.l 0 HotKeyHandle dc.l 0 HotKeySigFlag dc.l 0 HotKeyGadget dc.l 0 HotKeyVisInfo dc.l 0 HotKeyMenu dc.l 0 HelpNum dc.l 0 HelpText dc.l 0 HelpHandle dc.l 0 HelpRPort dc.l 0 HelpFont dc.l 0 HelpGadget dc.l 0 HelpVisInfo dc.l 0 HelpMenu dc.l 0 HelpScroll dc.l 0 HelpItem dc.w 0 ThisGadget dc.l 0 BlankHandle dc.l 0 FileHand dc.l 0 TempHand dc.l 0 InHand dc.l 0 OutHand dc.l 0 OurLock dc.l 0 PastLock dc.l 0 QuitBroker dc.w 0 ToolPri dc.l 0 CXPri dc.l 0 ClockWidth dc.w 0 WinLeftEdge dc.l 0 WinTopEdge dc.l 0 ErrorNum dc.l -1 MyBitMap dc.l 0 MyRastPort dc.l 0 MyFont dc.l 0 BitMapWidth dc.w 0 BitMapHeight dc.w 0 BitMapDepth dc.w 0 BitMapSize dc.l 0 LeftEdge dc.l 0 BlitWidth dc.l 0 MyARexxMsg dc.l 0 ARexxCommand dc.l 0 ARexxAction dc.l 0 AResult1 dc.l 0 AResult2 dc.l 0 IEClass dc.w 0 IEvent dc.l 0 ScreenOff dc.l 0 MouseOff dc.l 0 PageNum dc.l 0 EWidth dc.l 0 FWidth dc.l 0 MyAslRequest dc.l 0 AllocKey dc.w 0 KCXAppIcon dc.l 0 KCXAppMenuItem dc.l 0 DoActWindow dc.l 0 DoActGadget dc.l 0 OldSprite dc.w -1,-1 ARexxBuffer dc.l 0 LoadBuffer dc.l 0 HelpBuffer dc.l 0 ActivateStr dc.b "ACTIVATE",0,0 MouseStr dc.b "MOUSEMODE",0 ShowCStr dc.b "SHOWCLOCK",0 ClockWStr dc.b "CLOCKWIN",0,0 ClockPosStr dc.b "CLOCKWINPOS",0 ShowDateStr dc.b "SHOWDATE",0,0 ShowDayStr dc.b "SHOWDAY",0 ShortDayStr dc.b "SHORTDAY",0,0 ShowSecsStr dc.b "SHOWSECS",0,0 AmiDateStr dc.b "AMIDATE",0 PageStr dc.b "PAGEKEY",0 PageNumStr dc.b "PAGENUM",0 AlarmStr dc.b "ALARM",0 AlarmTimeStr dc.b "ALARMTIME",0 SetEnvStr dc.b "SETENV",0,0 ScreenTStr dc.b "SCREENTIME",0,0 MouseTStr dc.b "MOUSETIME",0 CycleWStr dc.b "CYCLEWIN",0,0 CycleStr dc.b "CYCLEKEY",0,0 ClickStr dc.b "CLICK",0 ClickVStr dc.b "CLICKVOL",0,0 BillPosStr dc.b "BILLWINPOS",0,0 BillWinStr dc.b "BILLPOPUP",0 PrefsPosStr dc.b "PREFSWINPOS",0 LogCallStr dc.b "LOGCALLS",0,0 WBFrontStr dc.b "WBFRONT",0 LeftyStr dc.b "LEFTYMOUSE",0,0 ESCCloseStr dc.b "ESCCLOSE",0,0 ESCQualStr dc.b "ESCKEY",0,0 UmlautOnStr dc.b "MAPUMLAUT",0 BillKeyStr dc.b "BILLKEY",0 PrefsKeyStr dc.b "PREFSKEY",0,0 HotKeyStr dc.b "HOTWINKEY",0 ShellKeyStr dc.b "SHELLKEY",0,0 UmlautKeyStr dc.b "UMLAUTKEY",0 ShellCommStr dc.b "SHELLCOMM",0 EnableStr dc.b "ENABLE",0,0 DisableStr dc.b "DISABLE",0 HideStr dc.b "HIDE",0,0 AClearLogStr dc.b "CLEARLOG",0,0 APopUpStr dc.b "POPUP",0 AStatusStr dc.b "STATUS",0,0 AReviseStr dc.b "REVISE",0,0 AReviseAsmStr dc.b "ASM",0 AReviseCStr dc.b "C",0 ARevisePasStr dc.b "PAS",0 ALoadPrefsStr dc.b "LOADPREFS",0 ASavePrefsStr dc.b "SAVEPREFS",0 OnString dc.b "ON",0,0 OffString dc.b "OFF",0 YesString dc.b "YES",0 NoString dc.b "NO",0,0 EnvDayString dc.b "DAY",0 EnvDateString dc.b "DATE",0,0 EnvTimeString dc.b "TIME",0,0 AuthorString dc.b "AUTHOR",0,0 CompanyString dc.b "COMPANY",0 FalseStr dc.b "0",0 TrueStr dc.b "1",0 FileName ds.b 256 EVEN PriStr dc.b "CX_PRIORITY",0 KeyStr dc.b "CX_POPKEY",0 PopUpStr dc.b "CX_POPUP",0,0 PortNameStr dc.b "PORTNAME",0,0 ToolPriStr dc.b "TOOLPRI",0 IconStr dc.b "NOICON",0,0 cnop 0,4 CLITemplate dc.b "CX_PRIORITY/N,CX_POPKEY/K,CX_POPUP/K,PORTNAME/K,TOOLPRI/N,NOICON/S,HELP/S",0 EVEN CXPRI_ARG EQU 0 CXKEY_ARG EQU 1 CXPOP_ARG EQU 2 PORT_ARG EQU 3 PRGPRI_ARG EQU 4 ICON_ARG EQU 5 HELP_ARG EQU 6 ********************************************************************** * Some booleans * ********************************************************************** DoActivate dc.b 1 MouseMode dc.b 0 ShowClock dc.b 1 ClockWin dc.b 0 ShowSecs dc.b 1 AmiDate dc.b 0 ShowDay dc.b 0 ShowDate dc.b 0 ShortDay dc.b 0 DoAlarm dc.b 0 SetEnv dc.b 0 CycleWin dc.b 1 KeyClick dc.b 1 BillPopUp dc.b 1 LogCalls dc.b 1 WBFront dc.b 1 LeftyMouse dc.b 0 ESCClose dc.b 1 MapUmlaut dc.b 0 FLAGSET EQU *-DoActivate NoBillPopDown dc.b 0 MouseTimeOut dc.b 0 ScrTimeOut dc.b 0 SprOff dc.b 0 OnlyLog dc.b 0 LogInputEnd dc.b 0 Disabled dc.b 0 DoPopUp dc.b 1 TimeReset dc.b 1 Online dc.b 0 CheapMode dc.b 0 DoRemakeCosts dc.b 0 DispAppIcon dc.b 1 Scrolling dc.b 0 HelpPage dc.b 0 EVEN ScreenTime dc.l 60 MouseTime dc.l 10 ClickVol dc.l 32 PopQualNum dc.l 0 ESCQualNum dc.l 4 LONGQUAL EQU *-ScreenTime ********************************************************************** * Pointers to Device-Requests * ********************************************************************** TimerReq dc.l 0 AudioReq dc.l 0 ConsoleReq dc.l 0 ********************************************************************** * Audio-Stuff * ********************************************************************** LEFTCH0 EQU 2 RIGHTCH0 EQU 1 LEFTCH1 EQU 4 RIGHTCH1 EQU 8 AnyChannel dc.b LEFTCH0|RIGHTCH0 dc.b LEFTCH0|RIGHTCH1 dc.b LEFTCH1|RIGHTCH0 dc.b LEFTCH1|RIGHTCH1 dc.b LEFTCH0 dc.b LEFTCH1 dc.b RIGHTCH0 dc.b RIGHTCH1 ********************************************************************** * Tags for new process of timer events * ********************************************************************** CheckerTags dc.l NP_Entry ; We only supply an entry point dc.l TimeChecker dc.l NP_Name ; Name of process dc.l CheckerName dc.l NP_Priority ; We run at a higher proirity dc.l 0 ; so that we`re quite fast dc.l NP_StackSize ; Stack-Size to be used dc.l 4096 dc.l TAG_DONE dc.l 0 ********************************************************************** * Tags for new process of timer events * ********************************************************************** RexxTags dc.l NP_Entry ; We only supply an entry point dc.l RexxChecker dc.l NP_Name ; Name of process dc.l RexxName dc.l NP_Priority ; We run at a higher proirity dc.l 0 ; so that we`re quite fast dc.l NP_StackSize ; Stack-Size to be used dc.l 4096 dc.l TAG_DONE dc.l 0 ********************************************************************** * ARexx-Status pointers and their numbers * ********************************************************************** RESULTBYTE EQU 1 RESULTWORD EQU 2 RESULTLONG EQU 3 RESULTSTRING EQU 4 RESULTCLOCKPOS EQU 5 RESULTTIME EQU 6 RESULTPOP EQU 7 RESULTBILLPOS EQU 8 RESULTPREFSPOS EQU 9 ARexxStatus dc.l RESULTLONG,ToolPri dc.l RESULTLONG,CXPri dc.l RESULTSTRING,PopUpKey dc.l RESULTBYTE,DoPopUp dc.l RESULTBYTE,DoActivate dc.l RESULTBYTE,MouseMode dc.l RESULTBYTE,ShowClock dc.l RESULTBYTE,ClockWin dc.l RESULTCLOCKPOS,0 ; This is for the ClockWinPos dc.l RESULTBYTE,ShowDate dc.l RESULTBYTE,ShowDay dc.l RESULTBYTE,ShowSecs dc.l RESULTBYTE,AmiDate dc.l RESULTSTRING,PageHotKey dc.l RESULTLONG,PageNum dc.l RESULTBYTE,DoAlarm dc.l RESULTTIME,0 ; This is for alarmtime dc.l RESULTBYTE,Disabled dc.l RESULTPOP,0 ; This is for poped up mode dc.l RESULTBYTE,SetEnv dc.l RESULTBYTE,ShortDay dc.l RESULTLONG,ScreenTime dc.l RESULTLONG,MouseTime dc.l RESULTBYTE,CycleWin dc.l RESULTLONG,PopQualNum dc.l RESULTBYTE,KeyClick dc.l RESULTLONG,ClickVol dc.l RESULTBYTE,LogCalls dc.l RESULTBILLPOS,0 ; BillWinPos dc.l RESULTBYTE,BillPopUp dc.l RESULTPREFSPOS,0 ; PrefsWinPos dc.l RESULTBYTE,WBFront dc.l RESULTBYTE,LeftyMouse dc.l RESULTBYTE,ESCClose dc.l RESULTLONG,ESCQualNum dc.l RESULTSTRING,BillHotKey dc.l RESULTSTRING,PrefsHotKey dc.l RESULTSTRING,HotWinHotKey dc.l RESULTSTRING,ShellHotKey dc.l RESULTSTRING,UmlautHotKey dc.l RESULTSTRING,SystemParam dc.l RESULTBYTE,MapUmlaut StatusCount EQU (*-ARexxStatus)/8 StatusNum dc.l 0 ResultData dc.l 0 ResultWinData dc.w 0 dc.w 0 ********************************************************************** * Formats and data for C/ASM/PAS Revision Headers * ********************************************************************** CHeader dc.b "/* $Revision Header built by KCommodity by Kai Iske *** (do not edit) ************",$0a dc.b "**",$0a,0 EVEN CLineNL dc.b "**",$0a,0 CLine dc.b "** ",0,0 CCopyRight dc.b "** © Copyright by %s",$0a dc.b "**",$0a,0 EVEN CFile dc.b "** File : %s",$0a,0 EVEN CCreatedOn dc.b "** Created on : %s, %s %s",$0a,0 EVEN CAuthor dc.b "** Created by : %s",$0a,0 EVEN CRevision dc.b "** Current revision : V%d.%02.2d",$0a,0 EVEN CPurpose dc.b "**",$0a dc.b "**",$0a dc.b "** Purpose",$0a dc.b "** -------",$0a,0 EVEN CLog dc.b "**",$0a dc.b "** Revision V%d.%02.2d",$0a dc.b "** --------------",$0a dc.b "** changed on %s, %s %s by %s. LogMessage :",$0a,0 EVEN CLogInit dc.b "**",$0a dc.b "** Revision V%d.%02.2d",$0a dc.b "** --------------",$0a dc.b "** --- Initial release ---",$0a dc.b "**",$0a CEnd dc.b "*********************************************************************************/",$0a,0 EVEN CRevDefine1 dc.b '#define REVISION "%d.%02.2d"',$09,$09,"/* This is the revision number */",$0a dc.b '#define REVDATE "%s"',$09,$09,"/* This is the revision date */",$0a EVEN AsmHeader dc.b ";* $Revision Header built by KCommodity by Kai Iske *** (do not edit) ************",$0a dc.b ";*",$0a,0 EVEN AsmLineNL dc.b ";*",$0a,0 AsmLine dc.b ";* ",0,0 AsmCopyRight dc.b ";* © Copyright by %s",$0a dc.b ";*",$0a,0 EVEN AsmFile dc.b ";* File : %s",$0a,0 EVEN AsmCreatedOn dc.b ";* Created on : %s, %s %s",$0a,0 EVEN AsmAuthor dc.b ";* Created by : %s",$0a,0 EVEN AsmRevision dc.b ";* Current revision : V%d.%02.2d",$0a,0 EVEN AsmPurpose dc.b ";*",$0a dc.b ";*",$0a dc.b ";* Purpose",$0a dc.b ";* -------",$0a,0 EVEN AsmLog dc.b ";*",$0a dc.b ";* Revision V%d.%02.2d",$0a dc.b ";* --------------",$0a dc.b ";* changed on %s, %s %s by %s. LogMessage :",$0a,0 EVEN AsmLogInit dc.b ";*",$0a dc.b ";* Revision V%d.%02.2d",$0a dc.b ";* --------------",$0a dc.b ";* --- Initial release ---",$0a dc.b ";*",$0a AsmEnd dc.b ";*********************************************************************************",$0a,0 EVEN AsmRevDefine1 dc.b "REVISION MACRO ; This is the macro for the revision number",$0a dc.b ' dc.b "%d.%02.2d"',$0a dc.b " ENDM",$0a dc.b "REVDATE MACRO ; This is the macro for the revision date",$0a dc.b ' dc.b "%s"',$0a dc.b " ENDM",$0a,0 EVEN PASHeader dc.b "(* $Revision Header built by KCommodity by Kai Iske *** (do not edit) ************",$0a dc.b "**",$0a,0 EVEN PASLogInit dc.b "**",$0a dc.b "** Revision V%d.%02.2d",$0a dc.b "** --------------",$0a dc.b "** --- Initial release ---",$0a dc.b "**",$0a PASEnd dc.b "*********************************************************************************)",$0a,0 EVEN PASRevDefine1 dc.b "CONST (* Place all your constants beneith these ones *)",$0a dc.b ' REVISION = "%d.%02.2d" (* This is the revision number *)',$0a dc.b ' REVDATE = "%s" (* This is the revision date *)',$0a,0 EVEN RevHeader dc.l 0 RevLineNL dc.l 0 RevLine dc.l 0 RevCompany dc.l 0 RevFile dc.l 0 RevCreatedOn dc.l 0 RevAuthor dc.l 0 RevRevision dc.l 0 RevPurpose dc.l 0 RevLog dc.l 0 RevLogInit dc.l 0 RevEnd dc.l 0 RevDefine dc.l 0 RevCompanyDat dc.l Company RevFileDat dc.l FileName RevRevisionDat dc.w 0 dc.w 0 RevCreatedOnDat dc.l RevDayString dc.l RevDateString dc.l RevTimeString RevAuthorDat dc.l Author RevDefineDat dc.w 0 dc.w 0 dc.l RevDateString NewMsg ds.b 77*5 Author ds.b 42 Company ds.b 42 DefaultName dc.b "--- Unknown ---",0 EVEN ********************************************************************** * This is our datetime * ********************************************************************** MyDateTime ds.b dat_SIZEOF DayString ds.b LEN_DATSTRING DateString ds.b LEN_DATSTRING TimeString ds.b LEN_DATSTRING OnlineString ds.b LEN_DATSTRING AllDayString ds.b LEN_DATSTRING AllDateString ds.b LEN_DATSTRING AllTimeString ds.b LEN_DATSTRING RevDayString ds.b LEN_DATSTRING RevDateString ds.b LEN_DATSTRING RevTimeString ds.b LEN_DATSTRING CopyTime ds.b LEN_DATSTRING ********************************************************************** * Formats for displaying the day * ********************************************************************** FormatData dc.l DayString dc.l DateString dc.l TimeString FinalString ds.b ((LEN_DATSTRING*3)+10) OnlineFormStr dc.b "Online ",0 EVEN EString dc.b "E",0 EVEN FString dc.b "F",0 EVEN ********************************************************************** * The main structure of all...The Broker * ********************************************************************** CNOP 0,4 MyBrokerDef dc.b NB_VERSION ; Commodities-Version (NEEDED) dc.b 0 dc.l BrokerName ; Name of broker (For Exchange-Prg) dc.l BrokerTitle ; Title (For Exchange-Prg) dc.l BrokerDesc ; Broker-Description (For Exchange-Prg) dc.w NBU_NOTIFY!NBU_UNIQUE ; Notify broker, we are unique dc.w COF_SHOW_HIDE ; We can be hidden/shown dc.w 0 ; Pri of broker plus an alignment byte dc.l 0 ; Port-Pointer dc.w 0 ; Dummy BrokerName dc.b "KCommodity",0 EVEN BrokerTitle dc.b "KCommodity V" REVISION dc.b " (" REVDATE dc.b ")" dc.b ", Kai Iske",0 EVEN BrokerDesc dc.b "Multifunction commodity. SHAREWARE",0 EVEN ********************************************************************** * Definition of Input-Filter * ********************************************************************** CNOP 0,4 MyCustomIXDef dc.b IX_VERSION ; Version of filter (NEEDED) dc.b 0 ; Filter Event-Class (that we want) dc.w 0 ; Codes (Bits) dc.w 0 ; Codes-Mask for filtering the Codes dc.w 0 ; Qualifier dc.w 0 ; Qualifier-Mask dc.w 0 ; Qualifier-Synonyms ********************************************************************** * AutoRequester-Texts * ********************************************************************** Only20ITxt dc.b 0,1 dc.b RP_JAM1 dc.b 0 dc.w 10,10 dc.l 0 dc.l Only20Txt dc.l 0 Only20Txt dc.b "This only runs under OS 2.x !",0,$0a Only20TxtEnd EVEN OkITxt dc.b 2,1 dc.b RP_JAM1 dc.b 0 dc.w 6,3 dc.l 0 dc.l OkTxt dc.l 0 OkTxt dc.b "OK",0 EVEN ********************************************************************** * Error-Texts * ********************************************************************** EasyTitle dc.b "KCommodity V" REVISION EasyTitleEnd dc.b 0 EVEN EasyTexts dc.l NoLibErr,NoMsgPErr,NoBrokerErr,NoCFilterErr dc.l CFilterErr,BrokerErr,NoTimerPortErr,NoPlanesErr dc.l NoFontErr,DefPopUpKey,DefPageKey,NoARexxPortErr dc.l OutOfMemory,NoBitMap,NoRastPort,NoAudioPortErr dc.l NoChannelsErr,NoPlayingErr,NoTempBuff dc.l NoTimerBuff,NoAudioBuff,NoConsoleBuff,DefPrefsKeyUse dc.l DefBillKeyUse,DefHotWinKeyUse,DefShellKeyUse,NoHotKeyErr dc.l DefUmlautKeyUse,NoAppIconErr,NoAppMenuErr NoLibErr dc.b "%s could not be opened.",0 EVEN NoMsgPErr dc.b "Broker-Port could not be created.",0 EVEN NoBrokerErr dc.b "Broker could not be set up.",0 EVEN NoCFilterErr dc.b "Filter for CUSTOM handler could not be set up.",0 EVEN CFilterErr dc.b "Definition of CUSTOM handler failed.",0 EVEN BrokerErr dc.b "Broker could not be set up correctly.",0 EVEN NoTimerPortErr dc.b "Could not generate Timer-Port.",0 EVEN NoPlanesErr dc.b "Could not allocate memory for BitPlanes.",0 EVEN NoFontErr dc.b "Could not set appropriate font.",0 EVEN DefPopUpKey dc.b "User PopUp-HotKey",$0a,$0a dc.b "%s",$0a,$0a dc.b "could not be installed.",$0a,$0a dc.b "Now using default : LCOMMAND HELP",0 EVEN DefPageKey dc.b "User Page-HotKey",$0a,$0a dc.b "%s",$0a,$0a dc.b "could not be installed.",$0a,$0a dc.b "Now using default : RALT HELP",0 EVEN NoARexxPortErr dc.b "Could not set up ARexx-Port.",0 EVEN OutOfMemory dc.b "Sorry out of memory.",0 EVEN NoBitMap dc.b "Sorry, could not generate BitMap.",0 EVEN NoRastPort dc.b "Sorry, could not generate RastPort.",0 EVEN NoAudioPortErr dc.b "Audio-Port could not be set up.",0 EVEN NoChannelsErr dc.b "Channel for click could not be allocated.",0 EVEN NoPlayingErr dc.b "Click-Sound can not be played.",0 EVEN NoTempBuff dc.b "Could not allocate memory for Temp-Buffer.",0 EVEN NoTimerBuff dc.b "Could not allocate memory for Timer-Request.",0 EVEN NoAudioBuff dc.b "Could not allocate memory for Audio-Request.",0 EVEN NoConsoleBuff dc.b "Could not allocate memory for Console-Request.",0 EVEN DefPrefsKeyUse dc.b "User Preferences-HotKey",$0a,$0a dc.b "%s",$0a,$0a dc.b "could not be installed.",$0a,$0a dc.b "Now using default : ALT SHIFT P",0 EVEN DefBillKeyUse dc.b "User BillWindow-HotKey",$0a,$0a dc.b "%s",$0a,$0a dc.b "could not be installed.",$0a,$0a dc.b "Now using default : ALT SHIFT B",0 EVEN DefHotWinKeyUse dc.b "User HotKeyWindow-HotKey",$0a,$0a dc.b "%s",$0a,$0a dc.b "could not be installed.",$0a,$0a dc.b "Now using default : ALT SHIFT H",0 EVEN DefShellKeyUse dc.b "User Shell-HotKey",$0a,$0a dc.b "%s",$0a,$0a dc.b "could not be installed.",$0a,$0a dc.b "Now using default : ALT SHIFT S",0 EVEN NoHotKeyErr dc.b "Default HotKey",$0a,$0a dc.b "%s",$0a,$0a dc.b "could not be set up. Aborting",0 EVEN DefUmlautKeyUse dc.b "User Umlaut-HotKey",$0a,$0a dc.b "%s",$0a,$0a dc.b "could not be installed.",$0a,$0a dc.b "Now using default : ALT SHIFT U",0 EVEN NoAppIconErr dc.b "Sorry,",$0a dc.b "but the AppIcon could not be installed.",0 EVEN NoAppMenuErr dc.b "Sorry,",$0a dc.b "but the AppMenu could not be installed.",0 EVEN ********************************************************************** * About requester * ********************************************************************** AboutText dc.b "KCommodity V" REVISION dc.b $0a dc.b "last changed : " REVDATE dc.b $0a dc.b "written by Kai Iske",$0a dc.b "© 1992 Kai Iske, ShareWare 20 DM, $20",$0a,0 EVEN AboutGadgets dc.b "OK|REGISTER",0 EVEN ********************************************************************** * Include the text for registration * ********************************************************************** RegisterTxt INCBIN "Register.TXT" dc.b 0 EVEN REGISTERLEN EQU *-RegisterTxt ********************************************************************** * These are the important dos errors * ********************************************************************** DosErrors dc.l 0,0,Error202,0,Error204,Error205,0,0,0,0,0,0,0 dc.l Error213,Error214,0,0,0,Error218,0,0,Error221 dc.l Error222,Error223,Error224,Error225,Error226 dc.l 0,0,0,0,0,0,0 Error202 dc.b "Can`t open %s.",$0a dc.b "Object in use.",0 EVEN Error204 dc.b "Can`t open %s.",$0a dc.b "Directory not found.",0 EVEN Error205 dc.b "Can`t open %s.",$0a dc.b "Object not found.",0 EVEN Error213 dc.b "Disk not validated.",0 EVEN Error214 dc.b "Disk is write-protected.",0 EVEN Error218 dc.b "Device/Volume not mounted.",0 EVEN Error221 dc.b "Disk is full.",0 EVEN Error222 dc.b "Can`t delete %s.",$0a dc.b "Object is protected from deletion.",0 EVEN Error223 dc.b "Can`t write to %s.",$0a dc.b "File is write-protected.",0 EVEN Error224 dc.b "Can`t read %s",$0a dc.b "File is read protected",0 EVEN Error225 dc.b "Not a valid DOS disk",0 EVEN Error226 dc.b "No disk in drive",0 EVEN EasyGadget dc.b "OK",0 EasyArg dc.l 0 EVEN ********************************************************************** * Easy-Requeststructure * ********************************************************************** MyEasyRequest dc.l es_SIZEOF dc.l 0 dc.l 0 dc.l 0 dc.l 0 ********************************************************************** * Definition for the blanked screen * ********************************************************************** BlankScreenDef dc.w 0,0 dc.w 64,-1 dc.w 1 dc.b -1,-1 dc.w 0 dc.w CUSTOMSCREEN|SCREENQUIET dc.l 0 dc.l 0 dc.l 0 dc.l 0 ********************************************************************** * Some defines fo easy customization * ********************************************************************** WINWIDTH EQU 620 WINHEIGHT EQU 155 WINIDCMP EQU CYCLEIDCMP|STRINGIDCMP|CHECKBOXIDCMP|BUTTONIDCMP|IDCMP_CLOSEWINDOW|IDCMP_VANILLAKEY|IDCMP_ACTIVEWINDOW|IDCMP_MENUPICK|IDCMP_CHANGEWINDOW|IDCMP_MENUHELP|IDCMP_RAWKEY WINFLAGS EQU WFLG_DRAGBAR|WFLG_CLOSEGADGET|WFLG_DEPTHGADGET|WFLG_ACTIVATE LOGWINWIDTH EQU 630 LOGWINHEIGHT EQU 86 LOGWINIDCMP EQU IDCMP_CLOSEWINDOW|STRINGIDCMP|BUTTONIDCMP|IDCMP_ACTIVEWINDOW|IDCMP_VANILLAKEY|IDCMP_CHANGEWINDOW|IDCMP_MENUPICK LOGWINFLAGS EQU WFLG_DEPTHGADGET|WFLG_DRAGBAR|WFLG_CLOSEGADGET|WFLG_ACTIVATE BILLWINWIDTH EQU 240 BILLWINHEIGHT EQU 80 BILLWINIDCMP EQU MXIDCMP|IDCMP_CLOSEWINDOW|IDCMP_VANILLAKEY|IDCMP_CHANGEWINDOW|IDCMP_MENUPICK|IDCMP_RAWKEY|IDCMP_MENUHELP BILLWINFLAGS EQU WFLG_DEPTHGADGET|WFLG_DRAGBAR|WFLG_CLOSEGADGET PREFSWINWIDTH EQU 422 PREFSWINHEIGHT EQU 136 PREFSWINIDCMP EQU BUTTONIDCMP|STRINGIDCMP|LISTVIEWIDCMP|IDCMP_CLOSEWINDOW|IDCMP_VANILLAKEY|IDCMP_RAWKEY|IDCMP_CHANGEWINDOW|IDCMP_MENUHELP|IDCMP_MENUPICK|IDCMP_ACTIVEWINDOW PREFSWINFLAGS EQU WFLG_DEPTHGADGET|WFLG_DRAGBAR|WFLG_CLOSEGADGET|WFLG_ACTIVATE CLOCKWIDTH EQU 1 CLOCKHEIGHT EQU 1 CLOCKIDCMP EQU IDCMP_CHANGEWINDOW|IDCMP_CLOSEWINDOW CLOCKFLAGS EQU WFLG_CLOSEGADGET|WFLG_DEPTHGADGET|WFLG_DRAGBAR|WFLG_RMBTRAP KEYWINWIDTH EQU 400 KEYWINHEIGHT EQU 98 KEYWINIDCMP EQU STRINGIDCMP|IDCMP_CLOSEWINDOW|IDCMP_VANILLAKEY|IDCMP_CHANGEWINDOW|IDCMP_MENUPICK|IDCMP_ACTIVEWINDOW|IDCMP_RAWKEY|IDCMP_MENUHELP KEYWINFLAGS EQU WFLG_CLOSEGADGET|WFLG_DEPTHGADGET|WFLG_DRAGBAR|WFLG_ACTIVATE HELPWINWIDTH EQU 600 HELPWINHEIGHT EQU 100 HELPWINIDCMP EQU SLIDERIDCMP|IDCMP_MOUSEMOVE|ARROWIDCMP|IDCMP_CLOSEWINDOW|IDCMP_RAWKEY|IDCMP_CHANGEWINDOW|IDCMP_MENUPICK HELPWINFLAGS EQU WFLG_CLOSEGADGET|WFLG_DEPTHGADGET|WFLG_DRAGBAR|WFLG_ACTIVATE BEVELWIDTH EQU 64+INTERWIDTH BEVELHEIGHT EQU 13 ********************************************************************** * Some defines for the gadgets * ********************************************************************** GADWIDTH EQU 90 GADHEIGHT EQU 12 STRGADWIDTH EQU 260 INTGADWIDTH EQU 45 LOGSGADWIDTH EQU 620 LOGINTWIDTH EQU 36 PREFINTGADWIDTH EQU 54 CYCLEWIDTH EQU 120 ********************************************************************** * This is our Windowstructure * ********************************************************************** MyWindowDef dc.w ((640-WINWIDTH)/2),((200-WINHEIGHT)/2) dc.w 0,0 dc.b 0,1 dc.l 0 dc.l 0 dc.l 0 dc.l 0 dc.l ControlTitle dc.l 0 dc.l 0 dc.w 0,0,0,0 dc.w WBENCHSCREEN ControlTitle dc.b "KCommodity : HotKey=" PopUpKey ds.b 80 DefaultPopUpKey dc.b "LCOMMAND HELP",0 EVEN WindowScrTitle dc.b "KCommodity V" REVISION dc.b " (" REVDATE dc.b ") " dc.b "by Kai Iske. SHAREWARE" ********************************************************************** * Definition for Clockwindow * ********************************************************************** ClockWinDef dc.w 0,0 dc.w 0,0 dc.b 0,1 dc.l 0 dc.l 0 dc.l 0 dc.l 0 dc.l 0 dc.l 0 dc.l 0 dc.w 0,0,0,0 dc.w WBENCHSCREEN ********************************************************************** * Definition of Log/Purpose window * ********************************************************************** LogWinDef dc.w ((640-LOGWINWIDTH)/2),((200-LOGWINHEIGHT)/2) dc.w 0,0 dc.b 0,1 dc.l 0 dc.l 0 dc.l 0 dc.l 0 dc.l 0 dc.l 0 dc.l 0 dc.w 0,0,0,0 dc.w WBENCHSCREEN LogWinTitle dc.b "You can now enter a 5 lines (75 chars per line) Log Message",0 EVEN PurposeWinTitle dc.b "You can now enter a 5 lines (75 chars per line) Purpos Message",0 EVEN ********************************************************************** * Telefon cost window * ********************************************************************** BillWinDef dc.w 640-BILLWINWIDTH,11 dc.w 0,0 dc.b 0,1 dc.l 0 dc.l 0 dc.l 0 dc.l 0 dc.l BillTitle dc.l 0 dc.l 0 dc.w 0,0,0,0 dc.w WBENCHSCREEN BillTitle dc.b "Bill HotKey=" BillHotKey ds.b 80 DefBillHotKey dc.b "ALT SHIFT B",0 EVEN ********************************************************************** * Bill-Preferences window definition * ********************************************************************** PrefsWinDef dc.w 0,0 dc.w PREFSWINWIDTH,PREFSWINHEIGHT dc.b 0,1 dc.l 0 dc.l 0 dc.l 0 dc.l 0 dc.l PrefsTitle dc.l 0 dc.l 0 dc.w 0,0,0,0 dc.w WBENCHSCREEN PrefsTitle dc.b "Telefone preferences HotKey=" PrefsHotKey ds.b 80 DefPrefsHotKey dc.b "ALT SHIFT P",0 EVEN ********************************************************************** * Definition for HotKey window * ********************************************************************** HotKeyWinDef dc.w 0,0 dc.w KEYWINWIDTH,KEYWINHEIGHT dc.b 0,1 dc.l 0 dc.l 0 dc.l 0 dc.l 0 dc.l HotWinTitle dc.l 0 dc.l 0 dc.w 0,0,0,0 dc.w WBENCHSCREEN HotWinTitle dc.b "HotKeys HotKey=" HotWinHotKey ds.b 80 DefHotWinHotKey dc.b "ALT SHIFT H",0 EVEN ********************************************************************** * Definition of Help-Window * ********************************************************************** HelpWinDef dc.w ((640-HELPWINWIDTH)/2),((200-HELPWINHEIGHT)/2) dc.w 0,0 dc.b 0,1 dc.l 0 dc.l 0 dc.l 0 dc.l 0 dc.l HelpTitle dc.l 0 dc.l 0 dc.w 0,0,0,0 dc.w WBENCHSCREEN HelpTitle dc.b "KCommodity Help for : " HelpDescr ds.b 40 HelpFile dc.b "ENV:KCX/" HelpName ds.b 20 EVEN MainHelpFile dc.b "MainHelp",0 EVEN PrefsHelpFile dc.b "PrefsHelp",0 EVEN BillHelpFile dc.b "BillHelp",0 EVEN HotKeyHelpFile dc.b "HotKeyHelp",0 EVEN ********************************************************************** * Our tags for the window * ********************************************************************** WindowTags dc.l WA_AutoAdjust dc.l 1 dc.l WA_InnerWidth WinWidth dc.l 0 dc.l WA_InnerHeight WinHeight dc.l 0 dc.l WA_ScreenTitle dc.l WindowScrTitle dc.l WA_IDCMP WinIDCMP dc.l 0 dc.l WA_Flags WinFlags dc.l 0 dc.l WA_MenuHelp DoMenuHelp dc.l 1 dc.l TAG_DONE dc.l 0 ********************************************************************** * And here comes a plain NewGadget-Structure * ********************************************************************** DummyNewGadget dc.w 10,0 ; Left and top edge dc.w GADWIDTH,GADHEIGHT ; Width and height dc.l 0 ; Text pointer dc.l GadgetTxtAttr ; TextAttr GadNum dc.w 1 ; Gadget ID dc.l 0 ; Gadget Flags dc.l 0 ; For use by GetVisualInfo() dc.l 0 ; User Data ********************************************************************** * These are the tags for the new gadgets * ********************************************************************** ButtonTags dc.l GT_Underscore dc.b 0,0,0,'_' dc.l TAG_DONE dc.l 0 ********************************************************************** * Thanks to Olaf 'Olsen' Barthels great TERM I was able to * * add a String-Edit Hook, since this function was not * * really documented. Thanx Olaf * ********************************************************************** IFND GTST_EditHook GTST_EditHook EQU GT_TagBase+55 ENDC ********************************************************************** * These are the tags for the string-gadgets * ********************************************************************** StringTags dc.l GT_Underscore dc.b 0,0,0,'_' dc.l GTST_String StringConts dc.l 0 dc.l GTST_MaxChars StrMax dc.l 0 dc.l GA_TabCycle dc.l 1 dc.l STRINGA_ExitHelp dc.l 1 dc.l GTST_EditHook dc.l StrEditHook dc.l TAG_DONE dc.l 0 ********************************************************************** * Tags for integer gadgets * ********************************************************************** IntegerTags dc.l GT_Underscore dc.b 0,0,0,'_' dc.l GTIN_Number IntConts dc.l 0 dc.l GTIN_MaxChars IntMax dc.l 3 dc.l STRINGA_ExitHelp dc.l 1 dc.l GA_TabCycle dc.l 1 dc.l GTST_EditHook dc.l StrEditHook dc.l TAG_DONE dc.l 0 ********************************************************************** * This is the hook for the String/Integer-Gadget editing * ********************************************************************** StrEditHook ds.b h_SIZEOF ********************************************************************** * Tags for cycle gadget * ********************************************************************** CycleTags dc.l GT_Underscore dc.b 0,0,0,'_' dc.l GTCY_Labels CycLabels dc.l 0 dc.l GTCY_Active CycActive dc.l 0 dc.l TAG_DONE dc.l 0 ********************************************************************** * Tags for MutualXclude gadgets * ********************************************************************** MxTags dc.l GT_Underscore dc.b 0,0,0,'_' dc.l GTMX_Labels MxLabels dc.l 0 dc.l GTMX_Active MxActive dc.l 0 dc.l GTMX_Spacing dc.l 4 dc.l TAG_DONE dc.l 0 ********************************************************************** * This is just a tag for changing the defaults for gads * ********************************************************************** CheckBoxTags dc.l GT_Underscore dc.b 0,0,0,'_' dc.l GTCB_Checked SelectMode dc.l 1 dc.l TAG_DONE dc.l 0 ********************************************************************** * This is a tag for ScrollerGadgets * ********************************************************************** ScrollerTags dc.l GTSC_Top ScrollTop dc.l 0 dc.l GTSC_Total ScrollTotal dc.l 0 dc.l GTSC_Visible ScrollVis dc.l 9 dc.l GTSC_Arrows dc.l 10 dc.l PGA_Freedom dc.l LORIENT_VERT dc.l GA_Immediate dc.l 1 dc.l GA_RelVerify dc.l 1 dc.l TAG_DONE dc.l 0 ********************************************************************** * This is the tag for disabling gadgets * ********************************************************************** DisableTag dc.l GA_Disabled GadDisable dc.l 0 dc.l TAG_DONE dc.l 0 ********************************************************************** * Tags for a BevelBox * ********************************************************************** BevelTag dc.l GTBB_Recessed dc.l 1 dc.l GT_VisualInfo BevelVisInfo dc.l 0 dc.l TAG_DONE dc.l 0 ********************************************************************** * FileRequester tags * ********************************************************************** AslFileTags dc.l ASL_Hail FileReqHeader dc.l 0 dc.l ASL_Window FileReqWin dc.l 0 dc.l ASL_LeftEdge FileReqLeft dc.l 0 dc.l ASL_TopEdge FileReqTop dc.l 0 dc.l ASL_Width FileReqWidth dc.l 320 dc.l ASL_Height FileReqHeight dc.l 140 dc.l ASL_File FileReqFile dc.l 0 dc.l ASL_Dir FileReqDir dc.l 0 dc.l TAG_DONE dc.l 0 ********************************************************************** * HotKey definitions * ********************************************************************** PageHotKey ds.b 80 DefPageHotKey dc.b "RALT HELP",0 EVEN ShellHotKey ds.b 80 DefShellHotKey dc.b "ALT SHIFT S",0 EVEN UmlautHotKey ds.b 80 DefUmlautHK dc.b "ALT SHIFT U",0 EVEN POPUPKEYID EQU 1 ; Definitions for IDs PAGEKEYID EQU 2 PREFSKEYID EQU 3 BILLKEYID EQU 4 HOTWINKEYID EQU 5 SHELLKEYID EQU 6 RAWEVENTID EQU 7 UMLAUTKEYID EQU 8 ********************************************************************** * Tags for use to open a new shell * ********************************************************************** SystemTags dc.l SYS_Input SysInput dc.l 0 dc.l SYS_Output SysOutput dc.l 0 dc.l SYS_Asynch dc.l 1 dc.l NP_Priority dc.l 0 SysCLI dc.l NP_Path SysPath dc.l 0 dc.l NP_CurrentDir SysDir dc.l 0 dc.l TAG_DONE dc.l 0 SystemComm dc.b "NewSHELL " SystemParam dc.b "CON:0/11//200/KCX-Shell/CLOSE/ALT///50/50",0 ds.b 88 EVEN SystemInOut dc.b "NIL:",0 EVEN WBPName dc.b "Workbench",0 ; Names of processes we want EVEN ; to clone path-lists from :-) NCLIName dc.b "New CLI",0 EVEN ICLIName dc.b "Initial CLI",0 EVEN AShellName dc.b "AmigaShell",0 EVEN BCLIName dc.b "Background CLI",0 EVEN ********************************************************************** * Texts for control window * ********************************************************************** HotKeyGadTxt dc.b "HotKeys... (_9)",0 EVEN AlarmGadTxt dc.b "Alarm time (_5)",0 EVEN ShellGadTxt dc.b "_User Shell",0 EVEN AlarmStartVal dc.b "00:00:00",0 EVEN AlarmText dc.b "Hey guy,",$0a,"It`s time for you to wake up !",0 EVEN ScrBTxt dc.b "Screen time (_6)",0 EVEN MouseBTxt dc.b "Mouse time (_7)",0 EVEN ClickVolTxt dc.b "Click vol (_8)",0 EVEN FrontGadTxt dc.b "Win Qualifier (_X)",0 EVEN ESCGadTxt dc.b "ESC Qualifier (_J)",0 EVEN PopQualList dc.l AltKeyDef dc.l AmiKeyDef dc.l ShiftKeyDef dc.l ControlKeyDef dc.l 0 POPQUALCNT EQU 4 ESCQualList dc.l AltKeyDef dc.l AmiKeyDef dc.l ShiftKeyDef dc.l ControlKeyDef dc.l NoneKeyDef dc.l 0 ESCQUALCNT EQU 5 NoneKeyDef dc.b "None",0 EVEN AltKeyDef dc.b "Any Alt",0 EVEN AmiKeyDef dc.b "Any Command",0 EVEN ShiftKeyDef dc.b "Any Shift",0 EVEN ControlKeyDef dc.b "Control",0 EVEN PopQualFlags dc.w IEQUALIFIER_RALT dc.w IEQUALIFIER_LALT dc.w IEQUALIFIER_RCOMMAND dc.w IEQUALIFIER_LCOMMAND dc.w IEQUALIFIER_RSHIFT dc.w IEQUALIFIER_LSHIFT dc.w IEQUALIFIER_CONTROL dc.w IEQUALIFIER_CONTROL dc.w -1,-1 ********************************************************************** * Table for converting "Umlauts" * ********************************************************************** UmlautTab dc.w $2a,$20,$12 ; Ae dc.w $2a,$20,$12 dc.w $29,$18,$12 ; Oe dc.w $29,$18,$12 dc.w $1a,$16,$12 ; Ue dc.w $1a,$16,$12 dc.w $0b,$21,$21 ; ss dc.w 0,0,0 TeleBillTxt dc.b "Telefone _bill...",0 EVEN TelePrefsTxt dc.b "Bill _preferences...",0 EVEN AlarmHour dc.l 0 AlarmMins dc.l 0 AlarmSecs dc.l 0 ThisHour dc.l 0 ThisMins dc.l 0 ThisSecs dc.l 0 ********************************************************************** * Control window menu entries * ********************************************************************** MainMenuDef dc.b NM_TITLE,0 dc.l ProjectName,0 dc.w 0 dc.l 0,0 dc.b NM_ITEM,0 dc.l .LoadPrefs,.LoadKey dc.w 0 dc.l 0,DoLoadPrefs dc.b NM_ITEM,0 dc.l .SavePrefs,.SaveKey dc.w 0 dc.l 0,ReSavePrefs dc.b NM_ITEM,0 dc.l .SaveAsPrefs,.SaveAsKey dc.w 0 dc.l 0,DoSaveAsPrefs dc.b NM_ITEM,0 dc.l NM_BARLABEL,0 dc.w 0 dc.l 0,0 dc.b NM_ITEM,0 dc.l .Enable,.EnableKey dc.w 0 dc.l 0,EnableKey dc.b NM_ITEM,0 dc.l .Disable,.DisableKey dc.w 0 dc.l 0,DisableKey dc.b NM_ITEM,0 dc.l HideItem,HideItemKey dc.w 0 dc.l 0,HideKey dc.b NM_ITEM,0 dc.l NM_BARLABEL,0 dc.w 0 dc.l 0,0 dc.b NM_ITEM,0 dc.l .AboutName,0 dc.w 0 dc.l 0,DisplayAbout dc.b NM_ITEM,0 dc.l NM_BARLABEL,0 dc.w 0 dc.l 0,0 dc.b NM_ITEM,0 dc.l .QuitName,.QuitKey dc.w 0 dc.l 0,QuitKey dc.b NM_TITLE,0 dc.l .EnableDisable,0 dc.w 0 dc.l 0,0 dc.b NM_ITEM,0 dc.l .ActivateWin,.ActivateKey dc.w CHECKIT!MENUTOGGLE dc.l 0,ActiKey dc.b NM_ITEM,0 dc.l .MouseMode,.MouseModeKey dc.w CHECKIT!MENUTOGGLE dc.l 0,ModeKey dc.b NM_ITEM,0 dc.l .DisplayClock,.DispClockKey dc.w CHECKIT!MENUTOGGLE dc.l 0,DisplayKey dc.b NM_ITEM,0 dc.l .DispClockWin,.DispWinKey dc.w CHECKIT!MENUTOGGLE dc.l 0,WindowKey dc.b NM_ITEM,0 dc.l .ShowSecs,.ShowSecsKey dc.w CHECKIT!MENUTOGGLE dc.l 0,SecsKey dc.b NM_ITEM,0 dc.l .ShowDate,.ShowDateKey dc.w CHECKIT!MENUTOGGLE dc.l 0,DateKey dc.b NM_ITEM,0 dc.l .AmiDate,.AmiDateKey dc.w CHECKIT!MENUTOGGLE dc.l 0,AmiKey dc.b NM_ITEM,0 dc.l .ShowDay,.ShowDayKey dc.w CHECKIT!MENUTOGGLE dc.l 0,DayKey dc.b NM_ITEM,0 dc.l .ShortDayStr,.ShortDayStr dc.w CHECKIT!MENUTOGGLE dc.l 0,ShortKey dc.b NM_ITEM,0 dc.l .AlarmOn,.AlarmOnKey dc.w CHECKIT!MENUTOGGLE dc.l 0,AlarmModeKey dc.b NM_ITEM,0 dc.l .KeyClick,.KeyClickKey dc.w CHECKIT!MENUTOGGLE dc.l 0,ClickKey dc.b NM_ITEM,0 dc.l .WriteEnv,.WriteEnvKey dc.w CHECKIT!MENUTOGGLE dc.l 0,EnvKey dc.b NM_ITEM,0 dc.l .WindowCycle,.WindowCycKey dc.w CHECKIT!MENUTOGGLE dc.l 0,CycleKey dc.b NM_ITEM,0 dc.l .WBFront,.WBFrontKey dc.w CHECKIT!MENUTOGGLE dc.l 0,WBFrontKey dc.b NM_ITEM,0 dc.l .LeftyMouse,.LeftyMouseKey dc.w CHECKIT!MENUTOGGLE dc.l 0,LeftyKey dc.b NM_ITEM,0 dc.l .ESCClose,.ESCCloseKey dc.w CHECKIT!MENUTOGGLE dc.l 0,WESCKey dc.b NM_ITEM,0 dc.l .MapUmlaut,.UmlautKey dc.w CHECKIT!MENUTOGGLE dc.l 0,UmlautKey dc.b NM_TITLE,0 dc.l .Settings,0 dc.w 0 dc.l 0,0 dc.b NM_ITEM,0 dc.l .NextPopQual,.NextPopKey dc.w 0 dc.l 0,FrontKey dc.b NM_ITEM,0 dc.l .NextESCQual,.NextESCKey dc.w 0 dc.l 0,ESCKey dc.b NM_ITEM,0 dc.l NM_BARLABEL,0 dc.w 0 dc.l 0,0 dc.b NM_ITEM,0 dc.l .ChangeAlarm,.SetAlarmKey dc.w 0 dc.l 0,SetAlarmKey dc.b NM_ITEM,0 dc.l .UserShell,.UserShellKey dc.w 0 dc.l 0,UserShellKey dc.b NM_ITEM,0 dc.l NM_BARLABEL,0 dc.w 0 dc.l 0,0 dc.b NM_ITEM,0 dc.l .ScreenTime,.ScreenKey dc.w 0 dc.l 0,ScreenKey dc.b NM_ITEM,0 dc.l .MouseTime,.MouseKey dc.w 0 dc.l 0,MouseKey dc.b NM_ITEM,0 dc.l .ClickVol,.VolKey dc.w 0 dc.l 0,VolKey dc.b NM_TITLE,0 dc.l .Windows,0 dc.w 0 dc.l 0,0 dc.b NM_ITEM,0 dc.l .BillWin,.BillKey dc.w 0 dc.l 0,BillKey dc.b NM_ITEM,0 dc.l .PrefsWin,.PrefsKey dc.w 0 dc.l 0,PrefsKey dc.b NM_ITEM,0 dc.l .HotKeyWin,.HotWinKey dc.w 0 dc.l 0,HotWinKey dc.b NM_END,0 dc.l 0,0 dc.w 0 dc.l 0,0 .LoadPrefs dc.b "Load Preferences...",0 EVEN .LoadKey dc.b LOADKEY,0 .SavePrefs dc.b "Save Preferences",0 EVEN .SaveKey dc.b "S",0 .SaveAsPrefs dc.b "Save Preferences as...",0 EVEN .SaveAsKey dc.b SAVEKEY,0 .Enable dc.b "Enable",0 EVEN .EnableKey dc.b ENABLEKEY,0 .Disable dc.b "Disable",0 EVEN .DisableKey dc.b DISABLEKEY,0 .AboutName dc.b "About...",0 EVEN .QuitName dc.b "Quit",0 EVEN .QuitKey dc.b QUITKEY,0 .EnableDisable dc.b "Enable/Disable",0 EVEN .ActivateWin dc.b "Window activate",0 EVEN .ActivateKey dc.b ACTIKEY,0 .MouseMode dc.b "MouseMode",0 EVEN .MouseModeKey dc.b MODEKEY,0 .DisplayClock dc.b "Display Clock",0 EVEN .DispClockKey dc.b DISPLAYKEY,0 .DispClockWin dc.b "Display in window",0 EVEN .DispWinKey dc.b WINDOWKEY,0 .ShowSecs dc.b "Show secondz",0 EVEN .ShowSecsKey dc.b SECSKEY,0 .ShowDate dc.b "Show date",0 EVEN .ShowDateKey dc.b DATEKEY,0 .AmiDate dc.b "American date",0 EVEN .AmiDateKey dc.b AMIKEY,0 .ShowDay dc.b "Show day",0 EVEN .ShowDayKey dc.b DAYKEY,0 .ShortDayStr dc.b "Short day string",0 EVEN .ShortStrKey dc.b SHORTKEY,0 .AlarmOn dc.b "Alarm on",0 EVEN .AlarmOnKey dc.b ALARMMODEKEY,0 .KeyClick dc.b "Key-Click",0 EVEN .KeyClickKey dc.b CLICKKEY,0 .WriteEnv dc.b "Write environment",0 EVEN .WriteEnvKey dc.b ENVKEY,0 .WindowCycle dc.b "Window cycling",0 EVEN .WindowCycKey dc.b CYCLEKEY,0 .WBFront dc.b "WB to front",0 EVEN .WBFrontKey dc.b WBFRONTKEY,0 .LeftyMouse dc.b "LeftyMouse",0 EVEN .LeftyMouseKey dc.b LEFTYKEY,0 .ESCClose dc.b "ESC WindowClose",0 EVEN .ESCCloseKey dc.b WESCKEY,0 .MapUmlaut dc.b 'Map "Umlauts"',0 EVEN .UmlautKey dc.b UMLAUTKEY,0 .Settings dc.b "Other settings",0 EVEN .NextPopQual dc.b "Win Qualifier",0 EVEN .NextPopKey dc.b FRONTKEY,0 .NextESCQual dc.b "ESC Qualifier",0 EVEN .NextESCKey dc.b ESCQUALKEY,0 .ChangeAlarm dc.b "Alarm time",0 EVEN .SetAlarmKey dc.b SETALARMKEY,0 .UserShell dc.b "User shell",0 EVEN .UserShellKey dc.b USERSHELLKEY,0 .ScreenTime dc.b "Screen time",0 EVEN .ScreenKey dc.b SCREENKEY,0 .MouseTime dc.b "Mouse time",0 EVEN .MouseKey dc.b MOUSEKEY,0 .ClickVol dc.b "Click vol",0 EVEN .VolKey dc.b VOLKEY,0 .Windows dc.b "Windows",0 EVEN .BillWin dc.b "Telefone bill...",0 EVEN .BillKey dc.b BILLKEY,0 .PrefsWin dc.b "Telefone preferences...",0 EVEN .PrefsKey dc.b PREFSKEY,0 .HotKeyWin dc.b "HotKeys...",0 EVEN .HotWinKey dc.b HOTWINKEY,0 ProjectName dc.b "Project",0 EVEN HideItem dc.b "Hide",0 EVEN HideItemKey dc.b HIDEKEY,0 ********************************************************************** * Texts for Log/Purpose-Window * ********************************************************************** LogOkText dc.b "_OK",0 EVEN LogCancelText dc.b "_CANCEL",0 EVEN LogRevText dc.b "Revision",0 EVEN LogPointText dc.b ".",0 EVEN OKKEY EQU 'O' CANCELKEY EQU 'C' ********************************************************************** * Log/Purpose-Window menu-entries * ********************************************************************** LogMenuDef dc.b NM_TITLE,0 dc.l ProjectName,0 dc.w 0 dc.l 0,0 dc.b NM_ITEM,0 dc.l .Ok,.OkKey dc.w 0 dc.l 0,LogOK dc.b NM_ITEM,0 dc.l .Cancel,.CancelKey dc.w 0 dc.l 0,LogCancel dc.b NM_END,0 dc.l 0,0 dc.w 0 dc.l 0,0 .Ok dc.b "OK",0 EVEN .OkKey dc.b OKKEY,0 .Cancel dc.b "CANCEL",0 EVEN .CancelKey dc.b CANCELKEY,0 ********************************************************************** * Bill window ITexts * ********************************************************************** BillITxts dc.b 1,0 dc.b RP_JAM2 dc.b 0 dc.w INTERWIDTH+INTERWIDTH/2+16 dc.w 2 dc.l GadgetTxtAttr dc.l .Str1 dc.l .ITxt2 .Str1 dc.b "Time",0 EVEN .ITxt2 dc.b 1,0 dc.b RP_JAM2 dc.b 0 dc.w INTERWIDTH+BEVELWIDTH+INTERWIDTH+INTERWIDTH/2+8 dc.w 2 dc.l GadgetTxtAttr dc.l .Str2 dc.l .ITxt3 .Str2 dc.b "Online",0 EVEN .ITxt3 dc.b 1,0 dc.b RP_JAM2 dc.b 0 dc.w INTERWIDTH+((BEVELWIDTH+INTERWIDTH)*2)+INTERWIDTH/2+16 dc.w 2 dc.l GadgetTxtAttr dc.l .Str3 dc.l BillVarStrings .Str3 dc.b "Cost",0 EVEN BillVarStrings dc.b 1,0 dc.b RP_JAM2 dc.b 0 dc.w INTERWIDTH+INTERWIDTH/2 dc.w 2+BEVELHEIGHT dc.l GadgetTxtAttr dc.l TimeString dc.l .ITxt2 .ITxt2 dc.b 1,0 dc.b RP_JAM2 dc.b 0 dc.w INTERWIDTH+BEVELWIDTH+INTERWIDTH+INTERWIDTH/2 dc.w 2+BEVELHEIGHT dc.l GadgetTxtAttr dc.l OnlineString dc.l .ITxt3 .ITxt3 dc.b 1,0 dc.b RP_JAM2 dc.b 0 dc.w INTERWIDTH+((BEVELWIDTH+INTERWIDTH)*2)+INTERWIDTH/2 dc.w 2+BEVELHEIGHT dc.l GadgetTxtAttr dc.l CostString dc.l .ITxt4 .ITxt4 dc.b 1,0 dc.b RP_JAM2 dc.b 0 dc.w INTERWIDTH+4 dc.w BEVELHEIGHT*4+12 dc.l GadgetTxtAttr dc.l PerHourStr dc.l 0 PerHourStr dc.b "Costs per hour : " PerHourBuff ds.b 9 EVEN CostString dc.b " 0.00",0 EVEN TimeZoneLabels dc.l TimeZone1Str dc.l TimeZone2Str dc.l TimeZone3Str dc.l 0 TimeZone1Str dc.b "Time _1",0 EVEN TimeZone2Str dc.b "Time _2",0 EVEN TimeZone3Str dc.b "Time _3",0 EVEN CostUnitTxt dc.b "Cost/_Unit",0 EVEN CheapLabels dc.l CheapTxt dc.l NormalTxt dc.l 0 CheapTxt dc.b "_Normal",0 EVEN NormalTxt dc.b "_Cheap",0 EVEN TotalCost dc.l 0 LogInDate ds.b LEN_DATSTRING LogInTime ds.b LEN_DATSTRING ********************************************************************** * Defines for BillWindow-Gadgets * ********************************************************************** TIMEZONEGAD EQU 1 CHEAPMODEGAD EQU 2 TIME1KEY EQU '1' TIME2KEY EQU '2' TIME3KEY EQU '3' NORMALKEY EQU 'N' CHEAPKEY EQU 'C' ********************************************************************** * Defines for BillWindow menu-entries * ********************************************************************** BillMenuDef dc.b NM_TITLE,0 dc.l ProjectName,0 dc.w 0 dc.l 0,0 dc.b NM_ITEM,0 dc.l .Time1,.Time1Key dc.w 0 dc.l 0,BTime dc.b NM_ITEM,0 dc.l .Time2,.Time2Key dc.w 0 dc.l 0,BTime dc.b NM_ITEM,0 dc.l .Time3,.Time3Key dc.w 0 dc.l 0,BTime dc.b NM_ITEM,0 dc.l NM_BARLABEL,0 dc.w 0 dc.l 0,0 dc.b NM_ITEM,0 dc.l .CostNormal,.CostNormalKey dc.w 0 dc.l 0,NormalKey dc.b NM_ITEM,0 dc.l .CostCheap,.CostCheapKey dc.w 0 dc.l 0,CheapKey dc.b NM_ITEM,0 dc.l NM_BARLABEL,0 dc.w 0 dc.l 0,0 dc.b NM_ITEM,0 dc.l HideItem,HideItemKey dc.w 0 dc.l 0,BEscKey dc.b NM_END,0 dc.l 0,0 dc.w 0 dc.l 0,0 .Time1 dc.b "Time 1",0 EVEN .Time1Key dc.b TIME1KEY .Time2 dc.b "Time 2",0 EVEN .Time2Key dc.b TIME2KEY .Time3 dc.b "Time 3",0 EVEN .Time3Key dc.b TIME3KEY .CostNormal dc.b "Normal",0 EVEN .CostNormalKey dc.b NORMALKEY .CostCheap dc.b "Cheap",0 EVEN .CostCheapKey dc.b CHEAPKEY .Hide dc.b "Hide",0 EVEN .HideKey dc.b HIDEKEY ********************************************************************** * Structures for the costs-calculating * ********************************************************************** RSRESET cu_Normal rs.l 1 cu_Cheap rs.l 1 CostUnit1 dc.l 360 dc.l 720 CostUnit2 dc.l 60 dc.l 120 CostUnit3 dc.l 21 dc.l 42 CostUnit dc.l 23 ********************************************************************** * Gadget/Window text defines for Preferences window * ********************************************************************** PrefsGadTxts dc.l .Txt1,.Txt2,.Txt3,.Txt4,.Txt5,.Txt6,.Txt7,.Txt8,.Txt9 dc.l .Txt10,.Txt11,.Txt12 .Txt1 dc.b "_Normal Time/Unit 1",0 EVEN .Txt2 dc.b "Cheap Time/Unit 1",0 EVEN .Txt3 dc.b "Normal Time/Unit 2",0 EVEN .Txt4 dc.b "Cheap Time/Unit 2",0 EVEN .Txt5 dc.b "Normal Time/Unit 3",0 EVEN .Txt6 dc.b "Cheap Time/Unit 3",0 EVEN .Txt7 dc.b "Costs per unit",0 EVEN .Txt8 dc.b "_PopUp Bill window",0 EVEN .Txt9 dc.b "_Log calls",0 EVEN .Txt10 dc.b "_Clear log",0 EVEN .Txt11 dc.b "_Save Log to...",0 EVEN .Txt12 dc.b "_Total sum...",0 EVEN PrefsTimeLabels dc.l .Txt1 dc.l .Txt2 dc.l .Txt3 dc.l 0 .Txt1 dc.b "Time _1 (to use on startup)",0 EVEN .Txt2 dc.b "Time _2",0 EVEN .Txt3 dc.b "Time _3",0 EVEN PrefsModeLabels dc.l .Txt1 dc.l .Txt2 dc.l 0 .Txt1 dc.b "Normal _4",0 EVEN .Txt2 dc.b "Cheap _5",0 EVEN PTimeZone dc.l 0 PTariff dc.l 0 LogPath dc.b "S:",0 ds.b 256 EVEN LogFile dc.b "KCXLOGFILE",0 ds.b 30 EVEN LogFileName dc.b "S:KCXLOGFILE",0 ds.b 280 EVEN LogFileHeader dc.b "Select new preferences file",0 EVEN PrefsPath dc.b "ENV:",0 ds.b 256 EVEN PrefsFile dc.b "KCXPREFFILE",0 ds.b 30 EVEN PrefsFileName dc.b "ENV:KCXPREFFILE",0 ds.b 280 EVEN PrefsLoadHeader dc.b "Load preferences",0 EVEN PrefsSaveHeader dc.b "Save pereferences",0 EVEN ********************************************************************** * Prefs-Gadget defines * ********************************************************************** NORMAL1GAD EQU 1 CHEAP1GAD EQU 2 NORMAL2GAD EQU 3 CHEAP2GAD EQU 4 NORMAL3GAD EQU 5 CHEAP3GAD EQU 6 COSTGAD EQU 7 PTIMEGAD EQU 8 PMODEGAD EQU 9 BILLPOPGAD EQU 10 LOGCALLGAD EQU 11 CLEARLOGGAD EQU 12 SAVETOGAD EQU 13 LOGFILEGAD EQU 14 TOTALSUMGAD EQU 15 NORMAL1KEY EQU 'N' SAVETOKEY EQU 'S' TOTALSUMKEY EQU 'T' BILLPOPKEY EQU 'P' LOGCALLKEY EQU 'L' CLEARLOGKEY EQU 'C' PNORMALKEY EQU '4' PCHEAPKEY EQU '5' ********************************************************************** * Preferences window menu-entries * ********************************************************************** PrefsMenuDef dc.b NM_TITLE,0 dc.l ProjectName,0 dc.w 0 dc.l 0,0 dc.b NM_ITEM,0 dc.l .TimeUnits,.TimeUnitsKey dc.w 0 dc.l 0,Normal1Key dc.b NM_ITEM,0 dc.l NM_BARLABEL,0 dc.w 0 dc.l 0,0 dc.b NM_ITEM,0 dc.l .Time1,.Time1Key dc.w 0 dc.l 0,Time123Key dc.b NM_ITEM,0 dc.l .Time2,.Time2Key dc.w 0 dc.l 0,Time123Key dc.b NM_ITEM,0 dc.l .Time3,.Time3Key dc.w 0 dc.l 0,Time123Key dc.b NM_ITEM,0 dc.l NM_BARLABEL,0 dc.w 0 dc.l 0,0 dc.b NM_ITEM,0 dc.l .TariffN,.TariffNKey dc.w 0 dc.l 0,Tariff45Key dc.b NM_ITEM,0 dc.l .TariffC,.TariffCKey dc.w 0 dc.l 0,Tariff45Key dc.b NM_ITEM,0 dc.l NM_BARLABEL,0 dc.w 0 dc.l 0,0 dc.b NM_ITEM,0 dc.l HideItem,HideItemKey dc.w 0 dc.l 0,PEscKey dc.b NM_TITLE,0 dc.l .OtherStuff,0 dc.w 0 dc.l 0,0 dc.b NM_ITEM,0 dc.l .PopUpBill,.PopUpBillKey dc.w CHECKIT!MENUTOGGLE dc.l 0,BillPopKey dc.b NM_ITEM,0 dc.l .LogCalls,.LogCallsKey dc.w CHECKIT!MENUTOGGLE dc.l 0,LogCallKey dc.b NM_ITEM,0 dc.l NM_BARLABEL,0 dc.w 0 dc.l 0,0 dc.b NM_ITEM,0 dc.l .ClearLog,.ClearLogKey dc.w 0 dc.l 0,ClearLogKey dc.b NM_ITEM,0 dc.l NM_BARLABEL,0 dc.w 0 dc.l 0,0 dc.b NM_ITEM,0 dc.l .SaveTo,.SaveToKey dc.w 0 dc.l 0,SaveToKey dc.b NM_ITEM,0 dc.l .LogName,.LogNameKey dc.w 0 dc.l 0,ChangeLogName dc.b NM_ITEM,0 dc.l .TotalCost,.TotalCostKey dc.w 0 dc.l 0,TotalSumKey dc.b NM_END,0 dc.l 0,0 dc.w 0 dc.l 0,0 .TimeUnits dc.b "Normal Time/Unit 1",0 EVEN .TimeUnitsKey dc.b NORMAL1KEY,0 .Time1 dc.b "Time 1",0 EVEN .Time1Key dc.b TIME1KEY,0 .Time2 dc.b "Time 2",0 EVEN .Time2Key dc.b TIME2KEY,0 .Time3 dc.b "Time 3",0 EVEN .Time3Key dc.b TIME3KEY,0 .TariffN dc.b "Normal",0 EVEN .TariffNKey dc.b PNORMALKEY,0 .TariffC dc.b "Cheap",0 EVEN .TariffCKey dc.b PCHEAPKEY,0 .OtherStuff dc.b "Other actions",0 EVEN .PopUpBill dc.b "PopUp Bill window",0 EVEN .PopUpBillKey dc.b BILLPOPKEY,0 .LogCalls dc.b "Log calls",0 EVEN .LogCallsKey dc.b LOGCALLKEY,0 .ClearLog dc.b "Clear log",0 EVEN .ClearLogKey dc.b CLEARLOGKEY,0 .SaveTo dc.b "Save Log to...",0 EVEN .SaveToKey dc.b SAVETOKEY,0 .LogName dc.b "Change Log name",0 EVEN .LogNameKey dc.b "F",0 .TotalCost dc.b "Total sum...",0 EVEN .TotalCostKey dc.b TOTALSUMKEY,0 ********************************************************************** * Defines for HotKey-Window * ********************************************************************** HotKeyGadStat dc.l PopUpKey,PageHotKey,BillHotKey,PrefsHotKey,HotWinHotKey dc.l ShellHotKey,UmlautHotKey HotKeyGadTxts dc.l .Txt1,.Txt2,.Txt3,.Txt4,.Txt5,.Txt6,.Txt7 .Txt1 dc.b "_Control",0 EVEN .Txt2 dc.b "_Page-Key",0 EVEN .Txt3 dc.b "_Bill",0 EVEN .Txt4 dc.b "P_references",0 EVEN .Txt5 dc.b "_HotKeys",0 EVEN .Txt6 dc.b "_Open Shell",0 EVEN .Txt7 dc.b '_Map "Umlauts"',0 EVEN POPUPGAD EQU 1 PAGEGAD EQU 2 BILLKEYGAD EQU 3 PREFSKEYGAD EQU 4 HOTKEYGAD EQU 5 SHELLGAD EQU 6 UMLAUTKEYGAD EQU 7 POPUPKEY EQU 'C' PAGEKEY EQU 'P' BILLKEYKEY EQU 'B' PREFSKEYKEY EQU 'R' HOTKEYKEY EQU 'H' SHELLKEY EQU 'O' UMLAUTKEYKEY EQU 'M' ********************************************************************** * HotKey-Window menu-entries * ********************************************************************** HotKeyMenuDef dc.b NM_TITLE,0 dc.l ProjectName,0 dc.w 0 dc.l 0,0 dc.b NM_ITEM,0 dc.l .Control,.ControlKey dc.w 0 dc.l 0,HPopUpKey dc.b NM_ITEM,0 dc.l .Page,.PageKey dc.w 0 dc.l 0,HPageKey dc.b NM_ITEM,0 dc.l .Bill,.BillKey dc.w 0 dc.l 0,HBillKey dc.b NM_ITEM,0 dc.l .Prefs,.PrefsKey dc.w 0 dc.l 0,HPrefsKey dc.b NM_ITEM,0 dc.l .Hot,.HotKey dc.w 0 dc.l 0,HHotKey dc.b NM_ITEM,0 dc.l .Shell,.ShellKey dc.w 0 dc.l 0,HShellKey dc.b NM_ITEM,0 dc.l .Umlaut,.UmlautKey dc.w 0 dc.l 0,HUmlautKey dc.b NM_ITEM,0 dc.l NM_BARLABEL,0 dc.w 0 dc.l 0,0 dc.b NM_ITEM,0 dc.l .Hide,.HideKey dc.w 0 dc.l 0,HEscKey dc.b NM_END,0 dc.l 0,0 dc.w 0 dc.l 0,0 .Control dc.b "Control",0 EVEN .ControlKey dc.b POPUPKEY,0 .Page dc.b "Page-Key",0 EVEN .PageKey dc.b PAGEKEY,0 .Bill dc.b "Bill",0 EVEN .BillKey dc.b BILLKEYKEY,0 .Prefs dc.b "Preferences",0 EVEN .PrefsKey dc.b PREFSKEYKEY,0 .Hot dc.b "HotKeys",0 EVEN .HotKey dc.b HOTKEYKEY,0 .Shell dc.b "Open Shell",0 EVEN .ShellKey dc.b SHELLKEY,0 .Umlaut dc.b 'Map "Umlauts"',0 EVEN .UmlautKey dc.b UMLAUTKEYKEY,0 .Hide dc.b "Hide",0 EVEN .HideKey dc.b "Q",0 ********************************************************************** * Definition of Menus for Help-Window * ********************************************************************** HelpMenuDef dc.b NM_TITLE,0 dc.l ProjectName,0 dc.w 0 dc.l 0,0 dc.b NM_ITEM,0 dc.l .RowUp,0 dc.w 0 dc.l 0,HelpRowUp dc.b NM_ITEM,0 dc.l .RowDown,0 dc.w 0 dc.l 0,HelpRowDown dc.b NM_ITEM,0 dc.l .PageUp,0 dc.w 0 dc.l 0,HelpPageUp dc.b NM_ITEM,0 dc.l .PageDown,0 dc.w 0 dc.l 0,HelpPageDown dc.b NM_ITEM,0 dc.l NM_BARLABEL,0 dc.w 0 dc.l 0,0 dc.b NM_ITEM,0 dc.l .Close,.CloseKey dc.w 0 dc.l 0,HelpWinEnd dc.b NM_END,0 dc.l 0,0 dc.w 0 dc.l 0,0 .RowUp dc.b "One row up (CURSOR UP)",0 EVEN .RowDown dc.b "One row down (CURSOR DOWN)",0 EVEN .PageUp dc.b "One page up (SHIFT CURSOR UP)",0 EVEN .PageDown dc.b "One page down (SHIFT CURSOR DOWN)",0 EVEN .Close dc.b "Close help",0 EVEN .CloseKey dc.b "C",0 ********************************************************************** * Pointers to window-structures for saving * ********************************************************************** WindowDefs dc.l MyWindowDef,PrefsWinDef,BillWinDef,LogWinDef,HelpWinDef dc.l HotKeyWinDef,ClockWinDef,0 ********************************************************************** * Text attribute for gadgets. We are stubborn. Let`s take topaz :-) * ********************************************************************** GadgetTxtAttr dc.l FontName dc.w 8 dc.b FS_NORMAL dc.b FPF_ROMFONT FontName dc.b "topaz.font",0 EVEN ********************************************************************** * Text attr for the text in titlebar * ********************************************************************** TxtAttr dc.l 0 dc.w 0 dc.b FS_NORMAL dc.b 0 ********************************************************************** * Formatstrings for RawDoFmt * ********************************************************************** TimeFormats dc.l FormLSec,FormLNSec,FormSSec,FormSNSec FormLSec dc.b "%s %s %s",0 EVEN FormLNSec dc.b "%s %s %.5s",0 EVEN FormSSec dc.b "%.3s %s %s",0 EVEN FormSNSec dc.b "%.3s %s %.5s",0 EVEN ResultFormat dc.b "%-ld",0 EVEN ResultWinFormat dc.b "%d/%d",0 EVEN CostFormString dc.b "%5ld.%02ld",0 EVEN PerHourForm dc.b "%4ld.%02ld",0 EVEN LIntFormat dc.b "%ld",0 EVEN FormAlarmSStr dc.b "%02ld:%02ld:%02ld",0 EVEN FormAlarmNSStr dc.b "%02ld:%02ld",0 EVEN FormMemString dc.b "C: %7ld F: %8ld",0 EVEN FormTMemString dc.b "Total Memory : %8ld",0 EVEN LogEntryFormat dc.b "%8.8s : %8.8s - %8.8s / Zone %ld Tariff %c / Time %02ld:%02ld:%02ld / Cost %ld.%02ld",$0a,0 EVEN FinalCostForm dc.b " -----------",$0a dc.b " Total Sum %ld.%02ld",$0a,0 EVEN DayCostForm dc.b " -----------",$0a dc.b " Sum for %s %ld.%02ld",$0a,$0a,0 EVEN ChipMem dc.l 0 FastMem dc.l 0 TotalMem dc.l 0 MaxMem dc.l 0 NextUnit dc.l 0 UnitsDone dc.l 0 LogEntryDat dc.l LogInDate dc.l LogInTime dc.l TimeString TimeZone dc.l 0 LogEntryTariff dc.w 0 OnlineHour dc.l 0 OnlineMinute dc.l 0 OnlineSeconds dc.l 0 CostMajor dc.l 0 CostMinor dc.l 0 BillTotalCost dc.l 0 BillDayCost dc.l 0 BillDayPtr dc.l BillDayStr BillMajor dc.l 0 BillMinor dc.l 0 BillDayStr ds.b 10 ********************************************************************** * Defines for better access to gadgets * ********************************************************************** ACTIGAD EQU 1 MODEGAD EQU 2 DISPLAYGAD EQU 3 WINDOWGAD EQU 4 SECSGAD EQU 5 DATEGAD EQU 6 AMIGAD EQU 7 DAYGAD EQU 8 SHORTGAD EQU 9 ALARMMODEGAD EQU 10 CLICKGAD EQU 11 ENVGAD EQU 12 CYCLEGAD EQU 13 WBFRONTGAD EQU 14 LEFTYGAD EQU 15 WESCGAD EQU 16 UMLAUTGAD EQU 17 LOADGAD EQU 18 SAVEGAD EQU 19 ENABLEGAD EQU 20 DISABLEGAD EQU 21 HIDEGAD EQU 22 QUITGAD EQU 23 SETALARMGAD EQU 24 USERSHELLGAD EQU 25 SCREENGAD EQU 26 MOUSEGAD EQU 27 VOLGAD EQU 28 FRONTGAD EQU 29 BILLGAD EQU 30 PREFSGAD EQU 31 ESCQUALGAD EQU 32 HOTWINGAD EQU 33 ACTIKEY EQU 'W' MODEKEY EQU 'M' DISPLAYKEY EQU 'C' WINDOWKEY EQU 'I' SECSKEY EQU 'Z' DATEKEY EQU 'T' AMIKEY EQU 'N' DAYKEY EQU 'Y' SHORTKEY EQU 'G' ALARMMODEKEY EQU 'L' CLICKKEY EQU 'K' ENVKEY EQU 'R' CYCLEKEY EQU '1' WBFRONTKEY EQU '2' LEFTYKEY EQU '3' WESCKEY EQU '4' FRONTKEY EQU 'X' ESCQUALKEY EQU 'J' UMLAUTKEY EQU '!' SETALARMKEY EQU '5' SCREENKEY EQU '6' MOUSEKEY EQU '7' VOLKEY EQU '8' USERSHELLKEY EQU 'U' HOTWINKEY EQU '9' BILLKEY EQU 'B' PREFSKEY EQU 'P' LOADKEY EQU 'O' SAVEKEY EQU 'A' ENABLEKEY EQU 'E' DISABLEKEY EQU 'D' HIDEKEY EQU 'H' QUITKEY EQU 'Q' ControlGads ds.l 33+1 PrefsGads ds.l 15+1 BillGads ds.l 2+1 LogGads ds.l 9+1 HotKeyGads ds.l 6+1 GadgetAttrs dc.l Gadget1Txt,PLACETEXT_RIGHT,CHECKBOX_KIND dc.w INTERWIDTH,5 dc.l Gadget2Txt,PLACETEXT_RIGHT,CHECKBOX_KIND dc.w INTERWIDTH,18 dc.l Gadget3Txt,PLACETEXT_RIGHT,CHECKBOX_KIND dc.w INTERWIDTH,31 dc.l Gadget4Txt,PLACETEXT_RIGHT,CHECKBOX_KIND dc.w INTERWIDTH,44 dc.l Gadget5Txt,PLACETEXT_RIGHT,CHECKBOX_KIND dc.w INTERWIDTH,57 dc.l Gadget6Txt,PLACETEXT_RIGHT,CHECKBOX_KIND dc.w INTERWIDTH,70 dc.l Gadget7Txt,PLACETEXT_RIGHT,CHECKBOX_KIND dc.w WINWIDTH-GADWIDTH-310,5 dc.l Gadget8Txt,PLACETEXT_RIGHT,CHECKBOX_KIND dc.w WINWIDTH-GADWIDTH-310,18 dc.l Gadget9Txt,PLACETEXT_RIGHT,CHECKBOX_KIND dc.w WINWIDTH-GADWIDTH-310,31 dc.l Gadget10Txt,PLACETEXT_RIGHT,CHECKBOX_KIND dc.w WINWIDTH-GADWIDTH-310,44 dc.l Gadget11Txt,PLACETEXT_RIGHT,CHECKBOX_KIND dc.w WINWIDTH-GADWIDTH-310,57 dc.l Gadget12Txt,PLACETEXT_RIGHT,CHECKBOX_KIND dc.w WINWIDTH-GADWIDTH-310,70 dc.l Gadget13Txt,PLACETEXT_RIGHT,CHECKBOX_KIND dc.w WINWIDTH-GADWIDTH-94,5 dc.l Gadget14Txt,PLACETEXT_RIGHT,CHECKBOX_KIND dc.w WINWIDTH-GADWIDTH-94,18 dc.l Gadget15Txt,PLACETEXT_RIGHT,CHECKBOX_KIND dc.w WINWIDTH-GADWIDTH-94,31 dc.l Gadget16Txt,PLACETEXT_RIGHT,CHECKBOX_KIND dc.w WINWIDTH-GADWIDTH-94,44 dc.l Gadget17Txt,PLACETEXT_RIGHT,CHECKBOX_KIND dc.w WINWIDTH-GADWIDTH-94,57 dc.l Gadget18Txt,PLACETEXT_IN,BUTTON_KIND dc.w INTERWIDTH+5,WINHEIGHT-GADHEIGHT-INTERHEIGHT dc.l Gadget19Txt,PLACETEXT_IN,BUTTON_KIND dc.w INTERWIDTH+5+GADWIDTH+INTERWIDTH,WINHEIGHT-GADHEIGHT-INTERHEIGHT dc.l Gadget20Txt,PLACETEXT_IN,BUTTON_KIND dc.w INTERWIDTH+5+(GADWIDTH+INTERWIDTH)*2,WINHEIGHT-GADHEIGHT-INTERHEIGHT dc.l Gadget21Txt,PLACETEXT_IN,BUTTON_KIND dc.w INTERWIDTH+5+(GADWIDTH+INTERWIDTH)*3,WINHEIGHT-GADHEIGHT-INTERHEIGHT dc.l Gadget22Txt,PLACETEXT_IN,BUTTON_KIND dc.w INTERWIDTH+5+(GADWIDTH+INTERWIDTH)*4,WINHEIGHT-GADHEIGHT-INTERHEIGHT dc.l Gadget23Txt,PLACETEXT_IN,BUTTON_KIND dc.w INTERWIDTH+5+(GADWIDTH+INTERWIDTH)*5,WINHEIGHT-GADHEIGHT-INTERHEIGHT dc.l 0 Gadget1Txt dc.b "_Window activate",0 EVEN Gadget2Txt dc.b "_MouseMode",0 EVEN Gadget3Txt dc.b "Display _clock/mem",0 EVEN Gadget4Txt dc.b "D_isplay in window",0 EVEN Gadget5Txt dc.b "Show second_z",0 EVEN Gadget6Txt dc.b "Show da_te",0 EVEN Gadget7Txt dc.b "America_n date",0 EVEN Gadget8Txt dc.b "Show da_y",0 EVEN Gadget9Txt dc.b "Short day strin_g",0 EVEN Gadget10Txt dc.b "A_larm on",0 EVEN Gadget11Txt dc.b "_Key-Click",0 EVEN Gadget12Txt dc.b "W_rite environment",0 EVEN Gadget13Txt dc.b "Window cycling (_1)",0 EVEN Gadget14Txt dc.b "WB to front (_2)",0 EVEN Gadget15Txt dc.b "LeftyMouse (_3)",0 EVEN Gadget16Txt dc.b "ESC WindowClose (_4)",0 EVEN Gadget17Txt dc.b 'Map "Umlauts" (_!)',0 EVEN Gadget18Txt dc.b "L_oad Prefs",0 EVEN Gadget19Txt dc.b "S_ave Prefs",0 EVEN Gadget20Txt dc.b "_Enable",0 EVEN Gadget21Txt dc.b "_Disable",0 EVEN Gadget22Txt dc.b "_Hide",0 EVEN Gadget23Txt dc.b "_Quit",0 EVEN ********************************************************************** * The AppIcon-Icon * ********************************************************************** KCXAppIconDef dc.w 0,0 dc.l 0 ; Gadget structure dc.w 0,0 dc.w 49,20 dc.w 0,0,0 dc.l AppIconImg dc.l 0,0,0,0 dc.w 0 dc.l 0 dc.b 0,0 dc.l 0 dc.l 0 dc.l NO_ICON_POSITION ; Position of icon dc.l NO_ICON_POSITION dc.l 0 dc.l 0 dc.l 0 AppIconImg dc.w 0,0 ; Image structure dc.w 49,19 dc.w 2 dc.l AppIconPic dc.b 3,0 dc.l 0 AppIconText dc.b "KCommodity",0 EVEN ********************************************************************** * Structures for the Tools-MenuItem * ********************************************************************** AppMenuTxt dc.b "KCX Main-Window",0 EVEN MAINITEM EQU 1 SECTION Chips,DATA_C ClickData dc.l $EFFBF7F7,$120FDACC dc.l $6202A07,$C7B8D715 dc.l $5038F4B1,$86D0244D dc.l $27EBBCAE,$D50B1E08 dc.l $DEC1C9F4,$282C07DE dc.l $C3C6E410,$2004E3D1 dc.l $D9EE1324,$15ECD1CC dc.l $E40B1E18,$F8DED7E5 dc.l $FD131A06,$E9DAE1F4 dc.l $81716FB,$E1D4E4FD dc.l $E150CF1,$DEE0F000 NoSpriteDat dc.w 0,0 dc.w 0,0 dc.w 0,0 BusyPtr DC.W $0000,$0000,$0400,$07C0,$0000,$07C0 DC.W $0100,$0380,$0000,$07E0,$07C0,$1FF8 DC.W $1FF0,$3FEC,$3FF8,$7FDE,$3FF8,$7FBE DC.W $7FFC,$FF7F,$7EFC,$FFFF,$7FFC,$FFFF DC.W $3FF8,$7FFE,$3FF8,$7FFE,$1FF0,$3FFC DC.W $07C0,$1FF8,$0000,$07E0,$0000,$0000 AppIconPic dc.w $0,$0,$1,$8000,$0,$0,$1,$8000 dc.w $ff,$ffff,$fe01,$8000,$3aa,$aaaa,$ab81,$8000 dc.w $2ff,$feaa,$aa81,$8000,$6be,$eeaa,$aac1,$8000 dc.w $6be,$ebfa,$aac1,$8000,$6ba,$eafa,$aac1,$8000 dc.w $6be,$eaee,$aac1,$8000,$6be,$eeff,$2ac1,$8000 dc.w $6ff,$ffff,$cac1,$8000,$6aa,$aaab,$f2c1,$8000 dc.w $6aa,$aaab,$fec1,$8000,$6aa,$aaab,$eac1,$8000 dc.w $2aa,$aaab,$f281,$8000,$3aa,$aaaa,$fb81,$8000 dc.w $ff,$ffff,$fc01,$8000,$0,$0,$601,$8000 dc.w $7fff,$ffff,$ffff,$8000,$ffff,$ffff,$fffe,$0 dc.w $d555,$5555,$5554,$0,$d500,$0,$154,$0 dc.w $d4ff,$ffff,$fe54,$0,$d580,$81ff,$ff54,$0 dc.w $d3c9,$19ff,$ff94,$0,$d3c3,$3e07,$ff94,$0 dc.w $d3c7,$3f0f,$ff94,$0,$d3c3,$3f97,$ff94,$0 dc.w $d3c9,$190b,$ff94,$0,$d380,$8203,$ff94,$0 dc.w $d3ff,$fffd,$ff94,$0,$d3ff,$fffd,$ff94,$0 dc.w $d3ff,$fffe,$ff94,$0,$d5ff,$fffe,$df54,$0 dc.w $d4ff,$ffff,$6e54,$0,$d500,$0,$4754,$0 dc.w $d555,$5555,$5354,$0,$8000,$0,$0,$0 END