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; }
BOOL submenu_set_one_page(sub_menu_t* sub_menu) { UINT16 i; sub_menu_item_t* menu_item; CONTAINER* menu_item_obj; POBJECT_HEAD pObj,pObjName,pObjSet; CONTAINER* win_sub_menu = &g_win_submenu; UINT8 action; for(i=0;i<sub_menu->list_page;i++) { #if 0 /* IDX & setting Display */ ComInt2UniStr(display_strs[i], i + 1, 0); ComAscStr2Uni("", display_strs[10 + i]); #endif /* Set attribute to active*/ action = submenu_item_attr(sub_menu, i+sub_menu->list_top); submenu_set_item_attr(i,action); menu_item = &sub_menu->items[i+sub_menu->list_top]; menu_item_obj = submenu_items[i]; /* Link menu items next object and set IDs*/ menu_item_obj->head.pNext = (i< (sub_menu->list_page - 1) ) ? ((POBJECT_HEAD)submenu_items[i + 1]) : NULL; OSD_SetID(menu_item_obj, i + 1, i + 1, i + 1, i==0? sub_menu->list_page : i, (i==sub_menu->list_page - 1)? 1 : i+2); #if 0 /* Link menu item's setting or not*/ pObj = menu_item_obj->pNextInCntn; /* IDX */ pObjName = pObj->pNext; /* Name */ pObjSet = submenu_item_sets[i]; switch(menu_item->item_type) { case ITEM_TYPE_NOMAL: pObjName->pNext = NULL; break; default: pObjName->pNext = pObjSet; break; } #endif /* Set menu item's name display*/ pObjName = OSD_GetContainerNextObj(menu_item_obj); OSD_SetTextFieldContent((PTEXT_FIELD)pObjName, STRING_ID, (UINT32)menu_item->item_name); /*Set menu item's callback */ if(menu_item->item_callback != NULL) OSD_SetCallback(menu_item_obj, menu_item->item_callback); else OSD_SetCallback(menu_item_obj, sm_item_con_callback); } OSD_SetContainerFocus(win_sub_menu, sub_menu->list_sel + 1 - sub_menu->list_top); }
static PRESULT sm_con_callback(POBJECT_HEAD pObj, VEVENT event, UINT32 param1, UINT32 param2) { PRESULT ret = PROC_PASS; UINT32 i; UINT8 unact; CONTAINER* cont = (CONTAINER*)pObj; UINT8 id = OSD_GetObjID(pObj); POBJECT_HEAD focusObj; switch(event) { case EVN_PRE_OPEN: #if 0 for(i=0;i<9;i++) ComInt2UniStr(display_strs[i], i + 1, 0); #endif if (!submenu_set_items(sub_menu_desc)) { return PROC_LEAVE; } #ifdef EXIT_KEY_EXIT_ALL_MENU exit_key_flag =FALSE; #endif //wincom_open_title(pObj,sub_menu_desc->title_id, 0); //guop break; case EVN_POST_OPEN: break; case EVN_PRE_DRAW: { UINT8 mm_focus_id= OSD_GetFocusID((POBJECT_HEAD)&g_win_mainmenu); UINT8 sm_focus_id= OSD_GetFocusID((POBJECT_HEAD)&g_win_submenu); #if ((defined(OSD_GOLDENMEDIA)) ||(defined(OSD_OCEANBLUE))||(defined(OSD_15))||(defined(OSD_12))) ((POBJECT_HEAD)&g_win_submenu)->frame.uHeight=(sub_menu_desc->item_count)*43+50; #else if((mm_focus_id==1)/*&&((sm_focus_id==1)||(sm_focus_id==2))*/) ((POBJECT_HEAD)&g_win_submenu)->frame.uHeight=W_H+14; else ((POBJECT_HEAD)&g_win_submenu)->frame.uHeight=W_H; #endif }break; case EVN_POST_DRAW: { UINT16 str_id; UINT8 mm_focus_id= OSD_GetFocusID((POBJECT_HEAD)&g_win_mainmenu); UINT8 sm_focus_id= OSD_GetFocusID((POBJECT_HEAD)&g_win_submenu); str_id=mm_item_str_ids[mm_focus_id-1]; OSD_SetTextFieldContent((PTEXT_FIELD)&subm_item_title,STRING_ID,str_id ); OSD_DrawObject((POBJECT_HEAD)&subm_item_title,C_UPDATE_ALL); //item_count = sub_menu_desc->item_count; #if ((defined(OSD_BLACKBERRY))||(defined(OSD_GOLDENMEDIA))||(defined(OSD_OCEANBLUE))||(defined(OSD_15))||(defined(OSD_12))) #else need_draw_signal_status=0; #endif #ifdef OSD_12 #ifdef PREVIEW_SUBMENU switch(mm_focus_id) { case 1: //str_id=RS_MM_SERVICE; if(submenu_open_from_stack) { submenu_open_from_stack=0; if(editchannel_sub_menus[sm_focus_id-1]!=NULL) OSD_ObjOpen(editchannel_sub_menus[sm_focus_id-1],MENU_OPEN_TYPE_OTHER/* + idx + C_SUBMENU_ID_BASE*/); } break; case 2: //str_id=RS_MM_INSTALLATION; //if(sm_focus_id==1) if(submenu_open_from_stack) { submenu_open_from_stack=0; if(installation_sub_menus[sm_focus_id-1]!=NULL) OSD_ObjOpen(installation_sub_menus[sm_focus_id-1],MENU_OPEN_TYPE_OTHER/* + idx + C_SUBMENU_ID_BASE*/); } break; #ifdef PREVIEW_SUBMENU //-a by wangyang case 3: if(submenu_open_from_stack) { submenu_open_from_stack=0; if(system_sub_menus[sm_focus_id-1]!=NULL) { /* if(system_sub_menus[sm_focus_id-1]==(POBJECT_HEAD)&g_win_disk_operate) OSD_ObjOpen((POBJECT_HEAD)&g_win_disk_operate, MENU_OPEN_TYPE_OTHER ); else*/ OSD_ObjOpen(system_sub_menus[sm_focus_id-1],MENU_OPEN_TYPE_OTHER); } } break; case 4: if(submenu_open_from_stack) { submenu_open_from_stack=0; if(preference_sub_menus[sm_focus_id-1]!=NULL) OSD_ObjOpen(preference_sub_menus[sm_focus_id-1],MENU_OPEN_TYPE_OTHER); } break; case 13: if(submenu_open_from_stack) { submenu_open_from_stack=0; if(network_sub_menus[sm_focus_id-1]!=NULL) OSD_ObjOpen(network_sub_menus[sm_focus_id-1],MENU_OPEN_TYPE_OTHER); } break; #if 1 case 14: if(submenu_open_from_stack) { submenu_open_from_stack=0; if(sm_focus_id==1) { game_othello_init(); } else if(sm_focus_id==2) { game_sudoku_init(); } if(games_sub_menus[sm_focus_id-1]!=NULL) OSD_ObjOpen(games_sub_menus[sm_focus_id-1],MENU_OPEN_TYPE_OTHER); } break; #endif case 15: if(submenu_open_from_stack) { submenu_open_from_stack=0; if(ca_sub_menus[sm_focus_id-1]!=NULL) OSD_ObjOpen(ca_sub_menus[sm_focus_id-1],MENU_OPEN_TYPE_OTHER); } break; case 16: if(submenu_open_from_stack) { submenu_open_from_stack=0; if(upg_sub_menus[sm_focus_id-1]!=NULL) OSD_ObjOpen(upg_sub_menus[sm_focus_id-1],MENU_OPEN_TYPE_OTHER); } break; #endif default: break; } #endif #else #ifdef PREVIEW_SUBMENU switch(mm_focus_id) { case 1: //str_id=RS_MM_SERVICE; if(submenu_open_from_stack) { submenu_open_from_stack=0; if(editchannel_sub_menus[sm_focus_id-1]!=NULL) OSD_ObjOpen(editchannel_sub_menus[sm_focus_id-1],MENU_OPEN_TYPE_OTHER/* + idx + C_SUBMENU_ID_BASE*/); } break; case 2: //str_id=RS_MM_INSTALLATION; //if(sm_focus_id==1) if(submenu_open_from_stack) { submenu_open_from_stack=0; if(installation_sub_menus[sm_focus_id-1]!=NULL) OSD_ObjOpen(installation_sub_menus[sm_focus_id-1],MENU_OPEN_TYPE_OTHER/* + idx + C_SUBMENU_ID_BASE*/); } break; #ifdef PREVIEW_SUBMENU //-a by wangyang case 3: if(submenu_open_from_stack) { submenu_open_from_stack=0; if(system_sub_menus[sm_focus_id-1]!=NULL) { /* if(system_sub_menus[sm_focus_id-1]==(POBJECT_HEAD)&g_win_disk_operate) OSD_ObjOpen((POBJECT_HEAD)&g_win_disk_operate, MENU_OPEN_TYPE_OTHER ); else*/ OSD_ObjOpen(system_sub_menus[sm_focus_id-1],MENU_OPEN_TYPE_OTHER); } } break; case 4: if(submenu_open_from_stack) { submenu_open_from_stack=0; if(preference_sub_menus[sm_focus_id-1]!=NULL) OSD_ObjOpen(preference_sub_menus[sm_focus_id-1],MENU_OPEN_TYPE_OTHER); } break; case 9: if(submenu_open_from_stack) { submenu_open_from_stack=0; if(network_sub_menus[sm_focus_id-1]!=NULL) OSD_ObjOpen(network_sub_menus[sm_focus_id-1],MENU_OPEN_TYPE_OTHER); } break; #if 1 case 10: if(submenu_open_from_stack) { submenu_open_from_stack=0; if(sm_focus_id==1) { game_othello_init(); } else if(sm_focus_id==2) { game_sudoku_init(); } if(games_sub_menus[sm_focus_id-1]!=NULL) OSD_ObjOpen(games_sub_menus[sm_focus_id-1],MENU_OPEN_TYPE_OTHER); } break; #endif case 11: if(submenu_open_from_stack) { submenu_open_from_stack=0; if(ca_sub_menus[sm_focus_id-1]!=NULL) OSD_ObjOpen(ca_sub_menus[sm_focus_id-1],MENU_OPEN_TYPE_OTHER); } break; case 12: if(submenu_open_from_stack) { submenu_open_from_stack=0; if(upg_sub_menus[sm_focus_id-1]!=NULL) OSD_ObjOpen(upg_sub_menus[sm_focus_id-1],MENU_OPEN_TYPE_OTHER); } break; #endif default: break; } #endif #endif //if(item_count<3) //OSD_SetObjRect(&subm_item_bg,CON_L,CON_T,CON_W,CON_H*2); //else //OSD_SetObjRect(&subm_item_bg,CON_L,CON_T,CON_W,CON_H*item_count+2); //OSD_DrawObject((POBJECT_HEAD)&subm_item_bg,C_UPDATE_ALL); }break; case EVN_PRE_CLOSE: /* Make OSD not flickering */ *((UINT32*)param2) &= ~C_CLOSE_CLRBACK_FLG; //OSD_DrawObject((POBJECT_HEAD)&g_win_submenu,C_DRAW_SIGN_EVN_FLG | C_UPDATE_FOCUS);//albert.li del break; case EVN_POST_CLOSE: enter_system_flag=FALSE; #if ((defined(OSD_BLACKBERRY))||(defined(OSD_GOLDENMEDIA))||(defined(OSD_OCEANBLUE))/*||(defined(OSD_15))*/) #ifdef EXIT_KEY_EXIT_ALL_MENU if(exit_key_flag) api_full_screen_play(); #endif #else api_full_screen_play(); #endif #if ((defined(OSD_BLACKBERRY))||(defined(OSD_GOLDENMEDIA))||(defined(OSD_OCEANBLUE))||(defined(OSD_15))||(defined(OSD_12))) #else need_draw_signal_status=1; #endif #ifdef EXIT_KEY_EXIT_ALL_MENU #ifdef MINI_INFO_BAR//wdh 2012.2.3 对此客户,进入service 的submenu项直接按推出键会出现信号条没消除掉,原因是把INFO BAR 改小以后没有刷新的这块区域 win_progname_signal_close(); #endif if(exit_key_flag ==FALSE ) { exit_submenu_flag_mute =TRUE; exit_submenu_flag_pause =TRUE; exit_submenu_flag_rec =TRUE; ap_send_key(V_KEY_MENU, TRUE); } else { exit_key_flag =FALSE; } #else ap_send_key(V_KEY_MENU, TRUE);//albert.li add #endif break; case EVN_UNKNOWN_ACTION: #ifdef PREVIEW_SUBMENU unact = (VACTION)(param1>>16) ; if((unact == VACT_FOCUS_UP)||(unact == VACT_FOCUS_DOWN)) ; else #endif submenu_unknown_act(sub_menu_desc, (VACTION)(param1>>16)); ret = PROC_LOOP; break; case EVN_MSG_GOT: if(param1 == CTRL_MSG_SUBTYPE_CMD_STO && param2 == USB_STATUS_OVER) { #ifdef PREVIEW_SUBMENU //-a by wangyang UINT8 sm_focus_id= OSD_GetFocusID((POBJECT_HEAD)&g_win_submenu); #endif //storage_dev_mount_hint(1); submenu_set_items(sub_menu_desc); submenu_show(); OSD_TrackObject(pObj, C_DRAW_SIGN_EVN_FLG | C_UPDATE_FOCUS); // if all sub menu items are inactive, exit sub menu if (!submenu_active(sub_menu_desc)) { UINT32 hkey; ap_vk_to_hk(0, V_KEY_EXIT, &hkey); ap_send_msg(CTRL_MSG_SUBTYPE_KEY, hkey, FALSE); } #ifdef USB_MP_SUPPORT #ifdef USB_SAFELY_REMOVE_SUPPORT #ifndef DISK_MANAGER_SUPPORT extern UINT8 g_show_usb_safely_removed; if (g_show_usb_safely_removed) { g_show_usb_safely_removed = 0; UINT8 back_saved; win_compopup_init(WIN_POPUP_TYPE_OK); win_compopup_set_msg(NULL, NULL, RS_USB_SAFELY_REMOVE_SUCCESS); ap_clear_all_message(); win_compopup_open_ext(&back_saved); } #endif #endif #endif #ifdef PREVIEW_SUBMENU //-a by wangyang if(sub_menu_desc->title_id==RS_MM_SYSTEM) { if((sm_focus_id ==4)||(sm_focus_id ==5) ||(sm_focus_id ==6)) { OSD_DrawFill(SUBMENU_W_L, SUBMENU_W_T, (SUBMENU_W_W), (SUBMENU_W_H), OSD_TRANSPARENT_COLOR, NULL); OSD_ObjOpen((POBJECT_HEAD)&win_info_con, MENU_OPEN_TYPE_OTHER ); } } else if (sub_menu_desc->title_id==RS_MM_UPGRADE) { if((sm_focus_id ==3)||(sm_focus_id==4)) { OSD_DrawFill(SUBMENU_W_L, SUBMENU_W_T, (SUBMENU_W_W), (SUBMENU_W_H), OSD_TRANSPARENT_COLOR, NULL); OSD_ObjOpen((POBJECT_HEAD)&win_rs232upg_con, MENU_OPEN_TYPE_OTHER ); } } #endif } #ifdef PREVIEW_SUBMENU //-a by wangyang { UINT8 sm_focus_id; sm_focus_id= OSD_GetFocusID((POBJECT_HEAD)&g_win_submenu); #if !defined (MAIN_CHIP_M3601S) && !defined (M3606_NON_NETWORK) if (sub_menu_desc->title_id==RS_MM_NETWORK) { if((sm_focus_id ==1)) { TestNetStatus(); } } #endif } #endif #ifdef NETWORK_SUPPORT #ifdef WIFI_SUPPORT if(param1 == CTRL_MSG_SUBTYPE_CMD_WIFI_CTRL_MSG && (param2 == WIFI_MSG_DEVICE_PLUG_IN||param2 == WIFI_MSG_DEVICE_PLUG_OUT)) { //storage_dev_mount_hint(1); submenu_set_items(sub_menu_desc); submenu_show(); OSD_TrackObject(pObj, C_DRAW_SIGN_EVN_FLG | C_UPDATE_FOCUS); // if all sub menu items are inactive, exit sub menu if (!submenu_active(sub_menu_desc)) { UINT32 hkey; ap_vk_to_hk(0, V_KEY_EXIT, &hkey); ap_send_msg(CTRL_MSG_SUBTYPE_KEY, hkey, FALSE); } } #endif #endif default: break; } return ret; }