static Boolean MainFormKeyDown(AppContext* appContext, FormType* form, EventType* event) { Boolean handled = false; if ( HaveFiveWay(appContext) && EvtKeydownIsVirtual(event) && IsFiveWayEvent(appContext, event) ) { if (FiveWayCenterPressed(appContext, event)) MainFormPressFindButton(form); if (FiveWayDirectionPressed(appContext, event, Up )) DefScrollUp(appContext, appContext->prefs.navButtonScrollType ); if (FiveWayDirectionPressed(appContext, event, Down )) DefScrollDown(appContext, appContext->prefs.navButtonScrollType ); // mark as unhandled so that left/right works in text field for // moving the cursor return false; } switch (event->data.keyDown.chr) { case returnChr: case linefeedChr: MainFormPressFindButton(form); handled = true; break; case pageUpChr: if ( ! (HaveFiveWay(appContext) && EvtKeydownIsVirtual(event) && IsFiveWayEvent(appContext, event) ) ) { DefScrollUp(appContext, appContext->prefs.hwButtonScrollType); handled = true; break; } case pageDownChr: if ( ! (HaveFiveWay(appContext) && EvtKeydownIsVirtual(event) && IsFiveWayEvent(appContext, event) ) ) { DefScrollUp(appContext, appContext->prefs.hwButtonScrollType); handled = true; break; } default: if (appContext->lookupStatusBarVisible) handled=true; break; } return handled; }
/* Handler to process any FiveWay requests in the main form */ Boolean FiveWayMainHandler ( EventType* event ) { Boolean handled; Boolean didLeft; Boolean didRight; Boolean didUp; Boolean didDown; handled = false; if ( ! Prefs()->arrowKeys || ! HaveFiveWay() || ! IsFiveWayEvent( event )) { return handled; } didLeft = FiveWayKeyPressed( event, Left ); didRight = FiveWayKeyPressed( event, Right ); didUp = FiveWayKeyPressed( event, Up ); didDown = FiveWayKeyPressed( event, Down ); if ( RotSelect( didLeft, didDown, didUp ) && Prefs()->arrowMode[ LEFT_ARROW ] != SELECT_NONE ) { DoSelectTypeAction( Prefs()->arrowMode[ LEFT_ARROW ] ); handled = true; } else if ( RotSelect( didRight, didUp, didDown ) && Prefs()->arrowMode[ RIGHT_ARROW ] != SELECT_NONE ) { DoSelectTypeAction( Prefs()->arrowMode[ RIGHT_ARROW ] ); handled = true; } else if ( RotSelect( didUp, didLeft, didRight ) && Prefs()->arrowMode[ UP_ARROW ] != SELECT_NONE ) { DoSelectTypeAction( Prefs()->arrowMode[ UP_ARROW ] ); handled = true; } else if ( RotSelect( didDown, didRight, didLeft ) && Prefs()->arrowMode[ DOWN_ARROW ] != SELECT_NONE ) { DoSelectTypeAction( Prefs()->arrowMode[ DOWN_ARROW ] ); handled = true; } else if ( FiveWayCenterPressed( event ) && Prefs()->arrowMode[ SELECT_ARROW ] != SELECT_NONE ) { DoSelectTypeAction( Prefs()->arrowMode[ SELECT_ARROW ]); handled = true; } return handled; }
static Boolean WordsListFormKeyDown(AppContext* appContext, FormType* form, EventType* event) { Boolean handled=false; if (HaveFiveWay(appContext) && EvtKeydownIsVirtual(event) && IsFiveWayEvent(appContext, event)) { if (FiveWayCenterPressed(appContext, event)) { UInt16 selected=LstGetSelectionByListID(form, listProposals); WordsListFormSelectProposal(appContext, selected); handled=true; } else if (FiveWayDirectionPressed(appContext, event, Up )) { WordsListFormScrollList(form, -1); handled=true; } else if (FiveWayDirectionPressed(appContext, event, Down )) { WordsListFormScrollList(form, 1); handled=true; } else if (FiveWayDirectionPressed(appContext, event, Left )) { WordsListFormScrollList(form, -(appContext->dispLinesCount-1)); handled=true; } else if (FiveWayDirectionPressed(appContext, event, Right )) { WordsListFormScrollList(form, (appContext->dispLinesCount-1)); handled=true; } } else { switch (event->data.keyDown.chr) { case returnChr: case linefeedChr: UInt16 selected=LstGetSelectionByListID(form, listProposals); WordsListFormSelectProposal(appContext, selected); handled=true; break; case pageUpChr: if ( ! (HaveFiveWay(appContext) && EvtKeydownIsVirtual(event) && IsFiveWayEvent(appContext, event) ) ) { WordsListFormScrollList(form, -(appContext->dispLinesCount-1)); handled=true; } break; case pageDownChr: if ( ! (HaveFiveWay(appContext) && EvtKeydownIsVirtual(event) && IsFiveWayEvent(appContext, event) ) ) { WordsListFormScrollList(form, (appContext->dispLinesCount-1)); handled=true; } break; default: // notify ourselves that a text field is (possibly) updated SendFieldChanged(); // mark as unhandled so that text field will (possibly) get updated handled = false; break; } } return handled; }
static Boolean ResidentBrowseFormKeyDown(AppContext* appContext, FormType* form, EventType* event) { Boolean handled=false; switch (event->data.keyDown.chr) { case returnChr: case linefeedChr: ResidentBrowseFormChooseWord(appContext, form, appContext->selectedWord); handled=true; break; case pageUpChr: if ( ! (HaveFiveWay(appContext) && EvtKeydownIsVirtual(event) && IsFiveWayEvent(appContext, event) ) ) { ScrollWordListByDx( appContext, form, -(appContext->dispLinesCount-1) ); handled=true; } break; case pageDownChr: if ( ! (HaveFiveWay(appContext) && EvtKeydownIsVirtual(event) && IsFiveWayEvent(appContext, event) ) ) { ScrollWordListByDx( appContext, form, (appContext->dispLinesCount-1) ); handled=true; } break; default: if (HaveFiveWay(appContext) && EvtKeydownIsVirtual(event) && IsFiveWayEvent(appContext, event)) { if (FiveWayCenterPressed(appContext, event)) { ResidentBrowseFormChooseWord(appContext, form, appContext->selectedWord); handled=true; } if (FiveWayDirectionPressed(appContext, event, Left )) { ScrollWordListByDx(appContext, form, -(appContext->dispLinesCount-1)); handled=true; } if (FiveWayDirectionPressed(appContext, event, Right )) { ScrollWordListByDx( appContext, form, (appContext->dispLinesCount-1) ); handled=true; } if (FiveWayDirectionPressed(appContext, event, Up )) { ScrollWordListByDx( appContext, form, -1 ); handled=true; } if (FiveWayDirectionPressed(appContext, event, Down )) { ScrollWordListByDx( appContext, form, 1 ); handled=true; } } else { FieldType* field=NULL; UInt16 index=FrmGetObjectIndex(form, fieldWord); Assert(index!=frmInvalidObjectId); field=(FieldType*)FrmGetObjectPtr(form, index); Assert(field); FldSendChangeNotification(field); } } return handled; }