6 int OpenBroker(int argc
,char **argv
)
10 if(info
.broker
.nbrk
.nb_Port
= CreateMsgPort())
12 ttypes
= ArgArrayInit(argc
,argv
);
13 info
.broker
.nbrk
.nb_Version
= NB_VERSION
;
14 info
.broker
.nbrk
.nb_Name
= "Find V1.0";
15 info
.broker
.nbrk
.nb_Title
= "Pattern Matching Utility";
16 info
.broker
.nbrk
.nb_Descr
= " ";
17 info
.broker
.nbrk
.nb_Unique
= NBU_UNIQUE
| NBU_NOTIFY
;
18 info
.broker
.nbrk
.nb_Flags
= COF_SHOW_HIDE
;
19 info
.broker
.nbrk
.nb_Pri
= (BYTE
)ArgInt(ttypes
,"CX_PRIORITY",0);
20 strcpy(info
.broker
.hotkey
,(char *)ArgString(ttypes
,"CX_POPKEY","control alt f"));
21 if(info
.broker
.broker
= CxBroker(&info
.broker
.nbrk
,NULL
))
23 if(info
.broker
.key
= CxFilter(info
.broker
.hotkey
))
25 AttachCxObj(info
.broker
.broker
,info
.broker
.key
);
26 if(info
.broker
.sender
= CxSender(info
.broker
.nbrk
.nb_Port
,EVT_HOTKEY
))
28 AttachCxObj(info
.broker
.key
,info
.broker
.sender
);
29 if(info
.broker
.translate
= (CxTranslate(NULL
)))
31 AttachCxObj(info
.broker
.key
,info
.broker
.translate
);
32 if(!CxObjError(info
.broker
.key
))
34 ActivateCxObj(info
.broker
.broker
,1L);
35 strcpy(yn
,(char *)ArgString(ttypes
,"CX_POPUP","NO"));
36 if(!stricmp(yn
,"yes"))
54 if(info
.broker
.broker
)
56 DeleteCxObjAll(info
.broker
.broker
);
57 while(msg
= GetMsg(info
.broker
.nbrk
.nb_Port
))ReplyMsg(msg
);
58 DeletePort(info
.broker
.nbrk
.nb_Port
);
68 if(msg
= (CxMsg
*)GetMsg(info
.broker
.nbrk
.nb_Port
))
71 type
= CxMsgType(msg
);
72 ReplyMsg((struct Message
*)msg
);
78 case EVT_HOTKEY
: if(!Project0Wnd
)
89 case CXCMD_DISABLE
: ActivateCxObj(info
.broker
.broker
,0L);
91 case CXCMD_ENABLE
: ActivateCxObj(info
.broker
.broker
,1L);
93 case CXCMD_KILL
: rc
= FALSE
;
95 case CXCMD_APPEAR
: if(!Project0Wnd
)
100 case CXCMD_DISAPPEAR
: if(Project0Wnd
)
102 CloseProject0Window();
105 case CXCMD_UNIQUE
: if(!Project0Wnd
)
106 OpenProject0Window();
108 WindowToFront(Project0Wnd
);