home *** CD-ROM | disk | FTP | other *** search
- //************************************
- //
- // Name : main.c
- //
- //************************************
-
- //**** Header files
-
- //** OS Include files
- #include <workbench/startup.h>
- #include <workbench/workbench.h>
- #include <libraries/dos.h>
- #include <libraries/wbstart.h>
- #include <libraries/gadtools.h>
- #include <libraries/commodities.h>
-
- //** OS function prototypes
- #include <clib/exec_protos.h>
- #include <clib/dos_protos.h>
- #include <clib/wb_protos.h>
- #include <clib/gadtools_protos.h>
- #include <clib/commodities_protos.h>
-
- //** OS function inline calls
- #include <pragmas/exec_pragmas.h>
- #include <pragmas/dos_pragmas.h>
- #include <pragmas/wb_pragmas.h>
- #include <pragmas/gadtools_pragmas.h>
- #include <pragmas/commodities_pragmas.h>
-
- //** ANSI C includes
- //#include <stdio.h>
-
- //** application include
- #include "Read.h"
- #include "Node.h"
- #include "Prefs.h"
- #include "Librarian.h"
- #include "GuiExtras.h"
- #include "GadToolsBox.h"
-
-
- //**** Local storage
-
- static char VersTag[]="\0$VER: EasyTM-Prefs v1.1 (28 May 1996)";
-
-
- //**** Main
-
- void main(int argc, char **argv) {
- int running=1;
- ULONG sig_c, sret;
- BOOL Active=TRUE;
- struct NewBroker nb = {
- NB_VERSION,
- "EasyTM-Prefs",
- &VersTag[7],
- "EasyTM Prefs commidity",
- NBU_UNIQUE | NBU_NOTIFY,
- COF_SHOW_HIDE,
- 0,
- NULL,
- 0
- };
- CxObj *broker=NULL;
- CxMsg *msg;
-
- if (1==InitList()) {
- if (1==OpenLibs() ) {
- if (1==ReadIcon(argc,argv) ) {
- if (nb.nb_Port =CreateMsgPort() ) {
- nb.nb_Pri = my_cx_pri;
- sig_c = 1 << nb.nb_Port->mp_SigBit;
- if (broker = CxBroker(&nb, NULL)) {
- ActivateCxObj(broker, 1L);
-
- ReadFile(ToolsFileName);
- if (0==SetupScreen()) {
- CX_Show();
- for (running=1; running; ) {
- sret = Wait(SIGBREAKF_CTRL_C | SIGBREAKF_CTRL_D | sig_c | sig_g);
- if (sret & SIGBREAKF_CTRL_C) running=0;
- if (sret & SIGBREAKF_CTRL_D) CX_Hide();
- if (sret & sig_g) running=HandleETMPIDCMP();
- if (sret & sig_c) {
- while(msg = (CxMsg *)GetMsg(nb.nb_Port)) {
- switch(CxMsgType(msg)) {
- case CXM_COMMAND:
- switch(CxMsgID(msg)) {
- case CXCMD_DISABLE:
- if (TRUE==Active) {
- ActivateCxObj(broker, 0L);
- Active = FALSE;
- }; // if
- break;
- case CXCMD_ENABLE:
- if (FALSE==Active) {
- ActivateCxObj(broker, 1L);
- Active = TRUE;
- }; // if
- break;
- case CXCMD_APPEAR:
- CX_Show();
- break;
- case CXCMD_DISAPPEAR:
- CX_Hide();
- break;
- case CXCMD_KILL:
- running=FALSE;
- break;
- case CXCMD_UNIQUE:
- CX_Show();
- break;
- } // switch
- break;
- } // switch
- ReplyMsg((struct Message *)msg);
- } // while GetMsg
- } // if sig_n
- } // for
- CX_Hide();
- CloseDownScreen();
- } // if SetUpScreen
-
- ActivateCxObj(broker, 0L);
- DeleteCxObj(broker);
- } // if CreateBroker
- while (msg=(CxMsg *)GetMsg(nb.nb_Port)) ReplyMsg((struct Message *)msg);
- DeleteMsgPort(nb.nb_Port);
- } // if CreateMsgPort (commodity)
- FreeVec(ToolsFileName);
- FreeVec(PrefsProgDir);
- } // if ReadIcon
- } // if OpenLibs
- CloseLibs(); // yes, this is in the correct place
- FreeList(1);
- } // if InitList
-
- } // main
-
- //**** End of file
-