home *** CD-ROM | disk | FTP | other *** search
- /****
- * CADSPInPane.c
- *
- * Methods for a pane which gets input from ADSP
- *
- * Copyright © 1992 Bernie Bernstein. All rights reserved.
- *
- ****/
-
- #include "CADSPInPane.h"
- #include "CMessenger.h"
-
- /***
- * IADSPInPane
- *
- * Setup the pane
- ***/
- void CADSPInPane::IADSPInPane(
- CView *anEnclosure,
- CBureaucrat *aSupervisor,
- CMessenger *aMessenger)
- {
- CEditText::IEditText(anEnclosure, aSupervisor,
- 10, 10, 0, 0, sizELASTIC, sizELASTIC, -1);
-
- itsMessenger = aMessenger;
- }
-
- /***
- * GetData
- *
- * Read the data from the buffer and put it into the window
- * this gets called from a Dawdle in the document
- ***/
- void CADSPInPane::GetData(void)
- {
- EventRecord anEvent;
- short size;
-
- itsMessenger->ReceiveMessage((Ptr)&anEvent, sizeof(EventRecord), &size);
- if (size == sizeof(EventRecord))
- {
- HandleInEvent(&anEvent);
- }
- else
- {
- DebugStr("\pLost some stuff");
- }
- }
-
- /***
- * HandleInEvent
- *
- * Deal with the event passed in from the other end.
- * The event will be in local coordinates so that
- * they can work in the local pane.
- ***/
- void CADSPInPane::HandleInEvent(EventRecord *anEvent)
- {
- switch(anEvent->what)
- {
- // case mouseDown:
- // HandleInMouseDown(anEvent);
- // break;
- // case mouseUp:
- // HandleInMouseUp(anEvent);
- // break;
- case keyDown:
- // case keyUp:
- case autoKey:
- HandleInKey(anEvent);
- break;
- }
- }
-
- /***
- * HandleInKey
- *
- * A key was pressed
- ***/
- void CADSPInPane::HandleInKey(EventRecord *anEvent)
- {
- char theChar = anEvent->message & charCodeMask;
- Byte keyCode = (anEvent->message & keyCodeMask) >> 8;
- if (!(anEvent->modifiers & cmdKey))
- {
- Specify(TRUE, TRUE, TRUE);
- DoKeyDown(theChar, keyCode, anEvent);
- Specify(FALSE, TRUE, FALSE);
- }
- }
-
-