home *** CD-ROM | disk | FTP | other *** search
- /* GadTools layout toolkit
- **
- ** Copyright © 1993-1994 by Olaf `Olsen' Barthel
- ** Freely distributable.
- */
-
- #include "gtlayout_global.h"
-
- #ifdef DO_PICKSHORTCUTS
- VOID __regargs
- LTP_SelectKeys(LayoutHandle *handle,ObjectNode *group)
- {
- UBYTE bunch;
- ObjectNode *node;
- ULONG page;
-
- SCANPAGE(group,node,page)
- {
- bunch = 0;
-
- switch(node -> Type)
- {
- case GROUP_KIND:
-
- LTP_SelectKeys(handle,node);
- break;
-
- case TEXT_KIND:
-
- if(!node -> Special . Text . UsePicker)
- break;
-
- case FRACTION_KIND:
- case PASSWORD_KIND:
- case STRING_KIND:
-
- if(node -> Special . String . UsePicker)
- bunch = 255;
-
- case BUTTON_KIND:
- case CHECKBOX_KIND:
- case INTEGER_KIND:
-
- bunch++;
-
- case LISTVIEW_KIND:
- case MX_KIND:
- case CYCLE_KIND:
- case PALETTE_KIND:
- case SCROLLER_KIND:
- case SLIDER_KIND:
- #ifdef DO_LEVEL_KIND
- case LEVEL_KIND:
- #endif /* DO_LEVEL_KIND */
- #ifdef DO_TAPEDECK_KIND
- case TAPEDECK_KIND:
- #endif /* DO_TAPEDECK_KIND */
-
- bunch++;
-
- if(node -> Label && !node -> Key && !node -> NoKey)
- {
- WORD i,len,code,glyph;
- STRPTR label;
-
- label = node -> Label;
- len = strlen(label);
-
- for(i = 0 ; i < len ; i++)
- {
- glyph = ToLower(label[i]);
- code = -1;
-
- if(bunch == 1) // Support increment & decrement
- {
- if(LTP_Keys[0][glyph] && LTP_Keys[1][glyph])
- code = LTP_Keys[0][glyph];
- }
- else
- {
- if(bunch == 2)
- {
- if(LTP_Keys[0][glyph])
- code = LTP_Keys[0][glyph];
- else
- {
- if(LTP_Keys[1][glyph] && LTP_Keys[0][glyph])
- {
- if(ToLower(LTP_Keys[1][glyph]) == glyph)
- code = LTP_Keys[0][glyph];
- }
- }
- }
- }
-
- if(code != -1 && !handle -> Keys[code])
- {
- STRPTR newLabel;
-
- if(newLabel = LTP_Alloc(handle,len + 2))
- {
- node -> Label = newLabel;
- node -> Key = code;
-
- if(i)
- CopyMem(label,newLabel,i);
-
- newLabel[i] = '_';
-
- CopyMem(label + i,&newLabel[i + 1],len - i);
-
- handle -> Keys[code] = handle -> Keys[LTP_Keys[1][code]] = TRUE;
-
- break;
- }
- }
- }
- }
-
- break;
- }
- }
- }
- #endif
-