ui_event uiprocessdialogevent( ui_event ui_ev, a_dialog *ui_dlg_info ) { VFIELD *field; a_check *check; an_edit_control *edit; unsigned choice; a_combo_box *combo; a_list *list; ui_ev = uicheckmove( ui_ev, ui_dlg_info ); ui_ev = uitabkey( ui_ev, ui_dlg_info ); field = ui_dlg_info->curr; if( field != NULL ) { switch( field->typ ) { case FLD_CHECK: case FLD_RADIO: switch( ui_ev ) { case EV_MOUSE_DCLICK: case EV_MOUSE_PRESS: case ' ' : ui_ev = EV_CHECK_BOX_CLICK; if( field->typ == FLD_RADIO ) { do_radio( ui_dlg_info, field ); break; } if( field->typ == FLD_CHECK ) { ui_dlg_info->dirty = true; check = field->u.check; check->val = !check->val; print_field( ui_dlg_info->vs, field, true ); break; } } break; case FLD_EDIT: case FLD_INVISIBLE_EDIT: ui_ev = uiledit( ui_ev ); edit = field->u.edit; if( ui_dlg_info->edit_data != NULL ) { edit->buffer = ui_dlg_info->edit_data->edit_buffer; edit->length = ui_dlg_info->edit_data->edit_eline.length; } break; case FLD_LISTBOX: case FLD_EDIT_MLE: list = field->u.list; ui_ev = uilistbox( ui_ev, list, true ); break; case FLD_PULLDOWN: list = field->u.list; if( list->box == NULL ) { ui_ev = pulldownfilter( ui_ev, ui_dlg_info ); } else { choice = list->choice; ui_ev = uilistbox( ui_ev, list, false ); if( choice != list->choice ) { ui_dlg_info->dirty = true; print_field( ui_dlg_info->vs, field, true ); } } break; case FLD_COMBOBOX: combo = field->u.combo; list = &combo->list; edit = &combo->edit; if( list->box == NULL ) { ui_ev = pulldownfilter( ui_ev, ui_dlg_info ); } else { choice = list->choice; ui_ev = uilistbox( ui_ev, list, combo->perm ); if( choice != list->choice ) { ui_dlg_info->dirty = true; setcombobuffer( ui_dlg_info, field ); print_field( ui_dlg_info->vs, field, true ); } } ui_ev = uiledit( ui_ev ); if( ui_dlg_info->edit_data != NULL ) { edit->buffer = ui_dlg_info->edit_data->edit_buffer; edit->length = ui_dlg_info->edit_data->edit_eline.length; } break; } } ui_ev = uihotkeyfilter( ui_dlg_info, ui_ev ); ui_ev = uihotspotfilter( ui_dlg_info->vs, ui_dlg_info->fields, ui_ev ); return( ui_ev ); }
EVENT uiprocessdialogevent( EVENT ev, a_dialog *info ) { VFIELD *field; a_check *check; an_edit_control *edit; unsigned choice; a_combo_box *combo; a_list *list; ev = uicheckmove( ev, info ); ev = uitabkey( ev, info ); field = info->curr; if( field != NULL ) { switch( field->typ ) { case FLD_CHECK: case FLD_RADIO: switch( ev ) { case EV_MOUSE_DCLICK: case EV_MOUSE_PRESS: case ' ' : ev = EV_CHECK_BOX_CLICK; if( field->typ == FLD_RADIO ) { do_radio( info, field ); break; } if( field->typ == FLD_CHECK ) { info->dirty = TRUE; check = field->ptr; check->val = !check->val; print_field( info->vs, field, TRUE ); break; } } break; case FLD_EDIT: case FLD_INVISIBLE_EDIT: ev = uiledit( ev ); edit = field->ptr; if( info->edit_data != NULL ) { edit->buffer = info->edit_data->edit_buffer; edit->length = info->edit_data->edit_eline.length; } break; case FLD_LISTBOX: case FLD_EDIT_MLE: list = field->ptr; ev = uilistbox( ev, list, TRUE ); break; case FLD_PULLDOWN: list = field->ptr; if( list->box == NULL ) { ev = pulldownfilter( ev, info ); } else { choice = list->choice; ev = uilistbox( ev, list, FALSE ); if( choice != list->choice ) { info->dirty = TRUE; print_field( info->vs, field, TRUE ); } } break; case FLD_COMBOBOX: combo = field->ptr; list = &combo->list; edit = &combo->edit; if( list->box == NULL ) { ev = pulldownfilter( ev, info ); } else { choice = list->choice; ev = uilistbox( ev, list, combo->perm ); if( choice != list->choice ) { info->dirty = TRUE; setcombobuffer( info, field ); print_field( info->vs, field, TRUE ); } } ev = uiledit( ev ); if( info->edit_data != NULL ) { edit->buffer = info->edit_data->edit_buffer; edit->length = info->edit_data->edit_eline.length; } break; } } ev = uihotkeyfilter( info, ev ); ev = uihotspotfilter( info->vs, info->fields, ev ); return( ev ); }
static EVENT hlpwait( VTAB *tab ) { bool done; static EVENT bumpev = EV_NO_EVENT; char *next_name; unsigned len1; unsigned len2; helpCur = field_find( helpTab, helpStack->cur ); if( helpTab != NULL && helpCur == NULL ) { helpCur = helpTab; } tab->other = helpCur; tab->curr = helpCur; if( helpCur != NULL ) { tab->home = helpCur->area.col; } uipushlist( helpEventList ); if( bumpev != EV_NO_EVENT ) { uitabfilter( bumpev, tab ); helpCur = tab->curr; bumpev = EV_NO_EVENT; } done = false; while( !done ) { if( helpTab != NULL ) { uivattribute( &helpScreen, helpCur->area, AT( ATTR_CURR_EDIT ) ); } do { uipushlist( keyShift ); curEvent = uivget( &helpScreen ); if( curEvent == EV_MOUSE_PRESS ) { ignoreMouseRelease = false; } uipoplist(); curEvent = uigadgetfilter( curEvent, &vGadget ); curEvent = uitabfilter( curEvent, tab ); } while( curEvent == EV_NO_EVENT ); if( eventMapFn != NULL ) { curEvent = (*eventMapFn)( curEvent ); } curEvent = uihotspotfilter( &helpScreen, hotSpotFields, curEvent ); if( helpTab != NULL ) { uivattribute( &helpScreen, helpCur->area, AT( ATTR_EDIT ) ); } switch( curEvent ) { case EV_HELP: nexttopic( helpWord ); done = true; break; case EV_BOTTOM: case E_UP: case EV_PAGE_UP: case EV_PAGE_DOWN: case EV_CURSOR_UP: case EV_CURSOR_DOWN: case EV_TOP: case E_DOWN: case EV_SCROLL_VERTICAL: if( curEvent == EV_BOTTOM ) { bumpev = EV_CURSOR_DOWN; } else if( curEvent == EV_TOP ) { bumpev = EV_CURSOR_UP; } helpStack->cur = field_count( helpTab, helpCur ); done = true; break; case '-': case EV_MOUSE_RELEASE_R: case EV_ALT_B: case 'b': case 'B': case EV_F8: case EV_F4: prevtopic(); if( strcmp( helpStack->helpfname, curFile ) ) { len1 = strlen( helpStack->word ); len2 = strlen( helpStack->helpfname ); helpCur = HelpMemAlloc( sizeof( a_field ) + len1 + len2 ); memcpy( helpCur->keyword, helpStack->word, len1 ); memcpy( helpCur->keyword + len1, helpStack->helpfname, len2 ); helpCur->keyword[len1 + len2] = '\0'; helpCur->key1_len = len1; helpCur->key2_len = len2; helpCur->next = NULL; // prevtopic(); helpTab = helpCur; } done = true; break; case EV_ALT_S: case 'S': case 's': if( helpSearchHdl != NULL ) { uipoplist(); next_name = HelpSearch( helpSearchHdl ); if( next_name != NULL ) { nexttopic( next_name ); HelpMemFree( next_name ); done = true; } uipushlist( helpEventList ); } break; case EV_FIELD_CHANGE: helpCur = tab->curr; break; case EV_MOUSE_RELEASE: if( tab->other == NULL ) break; if( ignoreMouseRelease ) { /* this mouse release is for a mouse press that occured * before this help topic was opened */ ignoreMouseRelease = false; break; } tab->other = tab->curr; /* fall through */ case EV_ENTER: /*same as page-down if there are other topics*/ case EV_F7: case '+': // DEN 90/04/12 - next line necessary for mouse release kludge helpCur = tab->curr; if( helpTab != NULL ) { if( helpCur->key2_len == 0 ) { nexttopic( helpCur->keyword ); } done = true; } break; case EV_KILL_UI: uiforceevadd( EV_KILL_UI ); /* fall through */ case EV_ESCAPE: done = true; break; } } uipoplist(); return( curEvent ); }