home *** CD-ROM | disk | FTP | other *** search
- /*
- ** GadTools layout toolkit
- **
- ** Copyright © 1993-1996 by Olaf `Olsen' Barthel
- ** Freely distributable.
- **
- ** :ts=4
- */
-
- #ifndef _GTLAYOUT_GLOBAL_H
- #include "gtlayout_global.h"
- #endif
-
- ULONG SAVE_DS ASM
- LTP_DefaultEditRoutine(REG(a0) struct Hook *Hook,REG(a2) struct SGWork *Work,REG(a1) Msg msg)
- {
- struct Hook *Validate;
- LayoutHandle *Handle;
- ObjectNode *Node;
-
- if(!GETOBJECT(Work->Gadget,Node))
- return(TRUE);
-
- switch(msg->MethodID)
- {
- case SGH_KEY:
-
- Handle = Hook->h_Data;
-
- if(Work->IEvent->ie_Code == 0x5F && Handle->HelpHook)
- {
- Work->Code = 0x5F;
- Work->Actions = (Work->Actions & ~SGA_BEEP) | SGA_END | SGA_USE;
-
- LTP_AddHistory(Work);
- break;
- }
-
- if(Work->IEvent->ie_Code == CURSORUP || Work->IEvent->ie_Code == CURSORDOWN)
- LTP_HandleHistory(Work);
-
- if(Work->EditOp == EO_ENTER)
- {
- BOOL Activate = TRUE;
-
- DB(kprintf("enter operation\n"));
-
- if(Node->Type == STRING_KIND)
- {
- if(Node->Special.String.LastGadget)
- Activate = FALSE;
- }
- #ifndef DO_HEXHOOK
- else
- {
- if(Node->Type == INTEGER_KIND)
- {
- if(Node->Special.Integer.LastGadget)
- Activate = FALSE;
- }
- }
- #endif
-
- if(!(Work->IEvent->ie_Qualifier & QUALIFIER_SHIFT))
- {
- DB(kprintf("no shift\n"));
-
- if(Activate && Handle->AutoActivate)
- Work->Actions |= SGA_NEXTACTIVE;
-
- if(!(Work->Actions & SGA_NEXTACTIVE))
- Work->Code = '\r';
- }
- else
- DB(kprintf("has shift\n"));
- }
-
- if(Node->Type == INTEGER_KIND)
- Validate = Node->Special.Integer.ValidateHook;
- else
- Validate = Node->Special.String.ValidateHook;
-
- if(Validate)
- {
- if(!CallHookPkt(Validate,Work,msg))
- {
- Work->EditOp = EO_BADFORMAT;
- Work->Actions = SGA_BEEP;
- }
- }
-
- if(Work->Actions & SGA_END)
- LTP_AddHistory(Work);
-
- /* Falls through to... */
-
- case SGH_CLICK:
-
- break;
-
- default:
-
- return(FALSE);
- }
-
- return(TRUE);
- }
-