Add ability to process AmigaGuide messages whilst the help system is running

This commit is contained in:
Chris Young 2014-02-10 18:34:09 +00:00
parent 4aa59f5382
commit e1b5332192
2 changed files with 34 additions and 3 deletions

View File

@ -34,7 +34,7 @@ uint32 om_set(Class *, Object *, struct opSet *);
uint32 om_get(Class *, Object *, struct opGet *);
uint32 agm_open(Class *, Object *, Msg);
uint32 agm_close(Class *, Object *, Msg);
uint32 agm_process(Class *, Object *, Msg);
/* *************************** class initialization and disposal ***************************** */
@ -107,6 +107,9 @@ static uint32 dispatchAGClass(Class *cl, Object *o, Msg msg)
case AGM_CLOSE:
return agm_close(cl, o, msg);
case AGM_PROCESS:
return agm_process(cl, o, msg);
default:
return IIntuition->IDoSuperMethodA(cl, o, msg);
}
@ -289,6 +292,11 @@ uint32 om_get(Class *cl, Object *o, struct opGet *msg)
retVal = 1;
break;
case AMIGAGUIDE_Signal:
*(msg->opg_Storage) = (uint32)lod->agSignal;
retVal = 1;
break;
default:
retVal = IIntuition->IDoSuperMethodA(cl, o, (Msg)msg);
}
@ -344,3 +352,23 @@ uint32 agm_close(Class *cl, Object *o, Msg msg)
return (uint32)lod->agHandle;
}
uint32 agm_process(Class *cl, Object *o, Msg msg)
{
struct localObjectData *lod = (struct localObjectData *)INST_DATA(cl, o);
if (lod->agHandle) {
while ( (lod->agm = IAmigaGuide->GetAmigaGuideMsg(lod->agHandle)) ) {
switch(lod->agm->agm_Type) {
default:
printf("%d\n", lod->agm->agm_Type);
break;
}
}
IAmigaGuide->ReplyAmigaGuideMsg(lod->agm);
}
return (uint32)lod->agHandle;
}

View File

@ -27,10 +27,13 @@
#define AMIGAGUIDE_BaseName (AMIGAGUIDE_Dummy + 4) // Basename of the application that opens the help file.
#define AMIGAGUIDE_ContextArray (AMIGAGUIDE_Dummy + 5) // Context node array (must be NULL-terminated).
#define AMIGAGUIDE_ContextID (AMIGAGUIDE_Dummy + 6) // Index value of the node to display.
#define AMIGAGUIDE_Signal (AMIGAGUIDE_Dummy + 7) // Signal mask to wait on
// method definition
#define AGM_OPEN WM_OPEN
#define AGM_CLOSE WM_CLOSE
#define AGM_Dummy AMIGAGUIDE_Dummy + 100
#define AGM_OPEN AGM_Dummy + 1
#define AGM_CLOSE AGM_Dummy + 2
#define AGM_PROCESS AGM_Dummy + 3
// function prototypes
Class *initAGClass(void);