home *** CD-ROM | disk | FTP | other *** search
- #include "mppexterns.h"
-
- LONG SendDaemonMsg(ULONG Command, ULONG Code, APTR Data)
- {
- LONG rv=0;
- struct MPMessage *mpm;
-
- if(mpm=AllocVec(sizeof(struct MPMessage),MEMF_PUBLIC|MEMF_CLEAR))
- {
- mpm->Command=Command;
- mpm->Code=Code;
- mpm->Data=Data;
- mpm->mp_Message.mn_Length=sizeof(struct MPMessage);
- mpm->mp_Message.mn_ReplyPort=ReplyPort;
-
- //printf("Sending %8x - Command %d Code %d Data %8x\n",mpm,mpm->Command,mpm->Code,mpm->Data);
- PutMsg(MPSem->DaemonPort,(struct Message *)mpm);
- MsgsOut++;
- rv=1;
- }
-
- return(rv);
- }
-
-
- void ProcessPrefsMessages(void)
- {
- ULONG listupd=FALSE;
- struct MPMessage *mpm;
-
- loopy:
-
- while(mpm=(struct MPMessage *)GetMsg(PrefsPort))
- {
- //printf("Recieved %8x - Command %d Code %d Data %8x\n",mpm,mpm->Command,mpm->Code,mpm->Data);
- switch(mpm->Command)
- {
- /*
- case MP_FORCEDEDIT:
- printf("MP_FORCEDEDIT\n");
- AddTail(&ForcedEditList,(struct Node *)mpm);
- if(ForcedEditMode==0)
- {
- ForcedEditMode=1;
- RemakeGads();
- }
- mpm=0;
- break;
- */
- case MP_SAVE:
- ObtainSemaphore(&MPSem->NodeSem);
- PrefSaveFile(EnvArcFile);
- PrefSaveFile(EnvFile);
- ReleaseSemaphore(&MPSem->NodeSem);
- break;
- case MP_QUIT:
- case MP_PREFSCLOSE:
- ClosePrefs=TRUE;
- break;
- case MP_PREFSTOFRONT:
- ScreenToFront(Scr);
- WindowToFront(Win);
- ActivateWindow(Win);
- break;
- case MP_LISTSTATUS:
- switch(mpm->Code)
- {
- case MPLS_UPDATING:
- listupd=TRUE;
- LG_SetGadgetAttrs(GadControl,GD_LIST,
- GTLV_Labels,~0,
- TAG_DONE);
-
- ReleaseSemaphore(&MPSem->ListSem);
- break;
- case MPLS_NORMAL:
- listupd=FALSE;
- ObtainSemaphoreShared(&MPSem->ListSem);
- LVActive=0;
- UpdateGadgets();
- break;
- }
- break;
- case MP_REFRESH:
- RefreshMenus();
- break;
- case MP_NEWNODE:
- GD_Type(ListToCyc[mpm->Code]); // change to the correct list
- break;
-
- }
- if(mpm)
- ReplyMsg((struct Message *)mpm);
- }
- if(listupd)
- {
- WaitPort(PrefsPort);
- goto loopy;
- }
- }
-