static BOOL check_focus_can_addsub(PEDIT_FIELD pCtrl,PEDIT_PATTERN pPattern) { BOOL b; UINT32 cursor_type; UINT32 mode,status; mode = OSD_GetEditFieldMode(pCtrl); status = OSD_GetEditFieldStatus(pCtrl); if(pPattern->bTag != 'r') return FALSE; cursor_type = pCtrl->bCursorMode; if(cursor_type == CURSOR_NO) return TRUE; else if(cursor_type == CURSOR_NORMAL) return FALSE; else // CURSOR_SPECIAL { if(status == SELECT_STATUS) return TRUE; else return FALSE; } }
static PRESULT otaset_item_edf_callback(POBJECT_HEAD pObj, VEVENT event, UINT32 param1, UINT32 param2) { PRESULT ret = PROC_PASS; UINT8 bID; UINT8 status; EDIT_FIELD* edf; bID = OSD_GetObjID(pObj); edf = (EDIT_FIELD*)pObj; switch(event) { case EVN_POST_CHANGE: status = OSD_GetEditFieldStatus(edf); if(status == SELECT_STATUS) { if(bID == EDIT_TP_FREQ_ID || bID == EDIT_TP_SYMB_ID) win_otaset_turn_frntend(); } break; case EVN_PARENT_FOCUS_POST_LOSE: if(bID == EDIT_TP_FREQ_ID || bID == EDIT_TP_SYMB_ID) { if(win_otaset_get_FreqSymbPid_display() != 0) win_otaset_turn_frntend(); } break; } return ret; }
static void ConvertValue2String(PEDIT_FIELD pCtrl,UINT16* pString, UINT32 dwValue, PEDIT_PATTERN pPattern) { UINT32 i, j, len, cnt; UINT32 dwTemp = 1; UINT16 wSep; UINT32 status = OSD_GetEditFieldStatus(pCtrl); #if EDITFIELD_SUPPORT_TIME if('t' == pPattern->bTag || 'T' == pPattern->bTag ) { UINT16 wsNum[8], wsSep[2];// = {0}; char *pfmt = m_fmtDT[pPattern->dt.bFormat]; for(i=0; i<pPattern->bLen; i++) dwTemp *= 10; pString[0] = 0; wSep = (UINT16)(m_Sep[pPattern->dt.bSep]); for(i=0, len=0; i<STRLEN(pfmt); i+=2) { cnt = pfmt[i+1] - '0'; for(j=0; j<cnt; j++) dwTemp /= 10; len += ComInt2UniStr(&pString[len], dwValue/dwTemp, cnt); if(dwTemp > 1) //pString[len++] = wSep; SetUniStrCharAt(&pString[len++], wSep,0); dwValue %= dwTemp; } if(pPattern->bTag=='T') { SetUniStrCharAt(&pString[len+2], 'M',0); SetUniStrCharAt(&pString[len], ' ',0);//space if (status == SELECT_STATUS || (status == EDIT_STATUS && pCtrl->bCursor == (len+1))) SetUniStrCharAt(&pString[len+1], (getTimeMode() ? 'P' : 'A'),0); len += 3; } pString[len++] = 0; } else #endif if(pPattern->bTag == 'i') { wSep = (UINT16)(m_Sep[pPattern->ip.bSep]); for(i = 0,len = 0; i < 4; i++) { len += ComInt2UniStr(&pString[len], (UINT8)(dwValue>>((3-i)*8)), 3); if(i < 3) SetUniStrCharAt(&pString[len++], wSep,0); } pString[len++] = 0; }
static BOOL check_focus_can_input09(PEDIT_FIELD pCtrl,PEDIT_PATTERN pPattern) { UINT32 mode,status; mode = OSD_GetEditFieldMode(pCtrl); status = OSD_GetEditFieldStatus(pCtrl); if(status == EDIT_STATUS || mode == NORMAL_EDIT_MODE) return TRUE; else /* SELECT_EDIT_MODE && status != EDIT_STATUS*/ return FALSE; }
void check_number_edit_mode(PEDIT_FIELD pCtrl,PEDIT_PATTERN pPattern) { UINT32 mode,status; UINT8 len; mode = OSD_GetEditFieldMode(pCtrl); status = OSD_GetEditFieldStatus(pCtrl); if(pPattern->bTag == 'r' && status==EDIT_STATUS && pCtrl->bCursorMode == CURSOR_SPECIAL) { len = ComUniStrLen(pCtrl->pString); if(len >= pPattern->bMaxLen) { pCtrl->bStyle &= ~EDIT_STATUS; check_number_value(pCtrl, pPattern); } } }
static VACTION atnsetm_item_edf_keymap(POBJECT_HEAD pObj, UINT32 key) { VACTION act; UINT8 bID; bID = OSD_GetObjID(pObj); switch(key) { case V_KEY_LEFT: case V_KEY_RIGHT: act = (key == V_KEY_LEFT)? VACT_EDIT_LEFT : VACT_EDIT_RIGHT; if( bID == LONG_ID || bID == LAT_ID ) { EDIT_FIELD* edf; edf = (EDIT_FIELD*)pObj; if(OSD_GetEditFieldStatus(edf) == SELECT_STATUS) act = VACT_CHANGE_SUB; } break; case V_KEY_0: case V_KEY_1: case V_KEY_2: case V_KEY_3: case V_KEY_4: case V_KEY_5: case V_KEY_6: case V_KEY_7: case V_KEY_8: case V_KEY_9: act = key - V_KEY_0 + VACT_NUM_0; break; case V_KEY_ENTER: act = VACT_EDIT_ENTER; break; // case V_KEY_EXIT: // act = VACT_EDIT_SAVE_EXIT; // break; default: act = VACT_PASS; } return act; }
static BOOL check_number_value(PEDIT_FIELD pCtrl,PEDIT_PATTERN pPattern) { UINT32 mode,status,dval; UINT32 value,valbak,min,max; UINT16 wsText[C_MAX_EDIT_LENGTH]; mode = OSD_GetEditFieldMode(pCtrl); status = OSD_GetEditFieldStatus(pCtrl); dval = OSD_GetEditFieldDefaultVal(pCtrl); if(pPattern->bTag == 'r' && pCtrl->bCursorMode == CURSOR_SPECIAL) { value = ComUniStr2Int(pCtrl->pString); //OSD_GetEditFieldIntValue(pCtrl,&value); min = pPattern->r.nMin; max = pPattern->r.nMax; valbak = pCtrl->valbak; if(value < min || value > max) { if(dval==FORCE_TO_VALBAK) value = valbak; else { if(valbak>= min && valbak <= max) value = valbak; else value = (value < min)? min : max; } ConvertValue2String(pCtrl,wsText,value,pPattern); NotifyChangeEvent(pCtrl,wsText,pPattern); return TRUE; } } return FALSE; }
static UINT32 get_focus_cursor_type(PEDIT_FIELD pCtrl,PEDIT_PATTERN pPattern) { UINT32 cursor_type; UINT32 mode,status; mode = OSD_GetEditFieldMode(pCtrl); status = OSD_GetEditFieldStatus(pCtrl); cursor_type = get_edit_cursor_type(pCtrl,pPattern); if(cursor_type == CURSOR_NORMAL) { if(status == EDIT_STATUS || mode == NORMAL_EDIT_MODE) return CURSOR_NORMAL; } else if(cursor_type == CURSOR_SPECIAL) { if(status == EDIT_STATUS) return CURSOR_SPECIAL; } return CURSOR_NO; }