void KDialogP::UpdateTemperature() { SOUNDSETTING setting; KCLastMemory::GetInstance()->GetSoundMemory(setting); if (setting.uAutoAir) { // 换算公式 F=(C×9/5)+32 ; // C=(F-32)×5/9 ;式中F--华氏温度,C--摄氏温度 · WCHAR wcsTemperature[16] = {0}; DOUBLE dbTemperature = DOUBLE(setting.uOutdoorTemperature)/2 - 35; // 1 : 摄氏温度 2:华氏温度 if (2 == setting.uTemperature) { swprintf(wcsTemperature, L"%.1f℉", (dbTemperature*9/5+32)); } else { swprintf(wcsTemperature, L"%.1f℃", dbTemperature); } SAFECALL(m_pTxtTemperature)->SetText(wcsTemperature); SAFECALL(m_pTxtTemperature)->SetShow(true); } else { SAFECALL(m_pTxtTemperature)->SetShow(false); } }
EFI_STATUS TestReadBlocks( EFI_BLOCK_IO_PROTOCOL* BlockIo) { EFI_STATUS Status = 0; UINT8* Buf; UINT32 BlockSize = BlockIo->Media->BlockSize; SAFECALL(Status = gBS->AllocatePool(EfiBootServicesCode, BlockSize, (VOID**)&Buf)); SAFECALL(Status = BlockIo->ReadBlocks(BlockIo, BlockIo->Media->MediaId, 0, BlockSize, (VOID**)Buf)); SAFECALL(Status = gBS->FreePool(Buf)); return Status; }
EFI_STATUS TestReadBlocks2Signal( EFI_BLOCK_IO2_PROTOCOL* BlockIo2) { EFI_STATUS Status = 0; UINT8* Buf = NULL; EFI_BLOCK_IO2_TOKEN b2Token; UINT32 BlockSize = BlockIo2->Media->BlockSize; SAFECALL(Status = gBS->CreateEvent(EVT_NOTIFY_SIGNAL, TPL_NOTIFY, BlockIo2OnReadWriteComplete, (VOID*)Buf, &b2Token.Event)); SAFECALL(Status = gBS->AllocatePool(EfiBootServicesCode, BlockSize, (VOID**)&Buf)); Status = BlockIo2->ReadBlocksEx(BlockIo2, BlockIo2->Media->MediaId, 0, &b2Token, BlockSize, (VOID**)Buf); if(EFI_ERROR(Status)){ //处理错误 SAFECALL(Status = gBS->FreePool(Buf)); }else{ } return Status; }
EFI_STATUS TestReadDisk2( EFI_DISK_IO2_PROTOCOL* DiskIo2, UINT32 MediaId) { EFI_STATUS Status = 0; UINT8* Buf; EFI_DISK_IO2_TOKEN d2Token; UINTN BufSize = 512; UINTN Index; SAFECALL(Status = gBS->CreateEvent(0, TPL_NOTIFY, NULL, NULL, &d2Token.Event)); SAFECALL(Status = gBS->AllocatePool(EfiBootServicesCode, BufSize, (VOID**)&Buf)); Status = DiskIo2->ReadDiskEx(DiskIo2, MediaId, 0, &d2Token, BufSize, (VOID**)Buf); if(EFI_ERROR(Status)){ //处理错误 }else{ gBS->WaitForEvent(1, &d2Token.Event, &Index); } SAFECALL(Status = gBS->FreePool(Buf)); return Status; }
EFI_STATUS TestReadBlocks2( EFI_BLOCK_IO2_PROTOCOL* BlockIo2) { EFI_STATUS Status = 0; UINT8* Buf; EFI_BLOCK_IO2_TOKEN b2Token; UINTN Index; UINT32 BlockSize = BlockIo2->Media->BlockSize; SAFECALL(Status = gBS->CreateEvent(0, TPL_NOTIFY, NULL, NULL, &b2Token.Event)); SAFECALL(Status = gBS->AllocatePool(EfiBootServicesCode, BlockSize, (VOID**)&Buf)); Status = BlockIo2->ReadBlocksEx(BlockIo2, BlockIo2->Media->MediaId, 0, &b2Token, BlockSize, (VOID**)Buf); if(EFI_ERROR(Status)){ //处理错误 }else{ gBS->WaitForEvent(1, &b2Token.Event, &Index); } SAFECALL(Status = gBS->FreePool(Buf)); return Status; }
void KDialogP::UpdateVolumeBar() { SOUNDSETTING seting; KCLastMemory::GetInstance()->GetSoundMemory(seting); SAFECALL(m_pVolumeSlider)->SetValue(seting.uSoundVol); WCHAR szBuf[MAX_PATH] = {0}; _itow(seting.uSoundVol, szBuf, 10); SAFECALL(m_pVolSize)->SetText(szBuf); if (0 != seting.uSoundVol) { SAFECALL(m_pImgVolume)->SetBkgndN(g_pSur_Head_Vol_Icon); } else { SAFECALL(m_pImgVolume)->SetBkgndN(g_pSur_Head_Vol_Mute_Icon); } }
void KDialogP::UpdateHeadDevIcon() { DWORD dwDevStatus = KCStatusIcon::GetInstance()->GetStatus(); if (dwDevStatus & IDDS_USB1 || dwDevStatus & IDDS_USB2) { SAFECALL(m_pUsbIco)->SetShow(true); } else { SAFECALL(m_pUsbIco)->SetShow(false); } if (dwDevStatus & IDDS_SD1 || dwDevStatus & IDDS_SD2) { SAFECALL(m_pSDIco)->SetShow(true); } else { SAFECALL(m_pSDIco)->SetShow(false); } if (dwDevStatus & IDDS_BT) { SAFECALL(m_pBTIco)->SetShow(true); } else { SAFECALL(m_pBTIco)->SetShow(false); } if (dwDevStatus & IDDS_IPOD) { SAFECALL(m_pPhoneIco)->SetShow(true); } else { SAFECALL(m_pPhoneIco)->SetShow(false); } //if (dwDevStatus & IDDS_RADIO) //{ // m_pRadioIco->SetShow(true); //} //else //{ // m_pRadioIco->SetShow(false); //} }
void KDialogP::OnAutoUpdateTime(void * pParam) { SYSTEMTIME systime; // ::GetSystemTime(&systime); ::GetLocalTime(&systime); SETUPSETTING seting; memset(&seting,0,sizeof(seting)); KCLastMemory::GetInstance()->GetSetupMemory(seting); WCHAR wcsTime[4] = {0}; //wsprintf(wcsTime, L"%02d:%02d", ((seting.c12Or24)?(systime.wHour):(systime.wHour%12)), systime.wMinute); if (seting.c12Or24) { _itow(systime.wHour/10, wcsTime, 10); SAFECALL(m_pTxtTime[0])->SetText(wcsTime); ZeroMemory(wcsTime, 4*sizeof(WCHAR)); _itow(systime.wHour%10, wcsTime, 10); SAFECALL(m_pTxtTime[1])->SetText(wcsTime); SAFECALL(m_pTxtAPM[0])->SetShow(false); SAFECALL(m_pTxtAPM[1])->SetShow(false); } else { WORD wHour = systime.wHour%12; wHour = ((wHour == 0) ? 12 : wHour); _itow(wHour/10, wcsTime, 10); SAFECALL(m_pTxtTime[0])->SetText(wcsTime); ZeroMemory(wcsTime, 4*sizeof(WCHAR)); _itow(wHour%10, wcsTime, 10); SAFECALL(m_pTxtTime[1])->SetText(wcsTime); if (systime.wHour < 12) { SAFECALL(m_pTxtAPM[0])->SetText(L"A"); } else { SAFECALL(m_pTxtAPM[0])->SetText(L"P"); } SAFECALL(m_pTxtAPM[0])->SetShow(true); SAFECALL(m_pTxtAPM[1])->SetShow(true); } ZeroMemory(wcsTime, 4*sizeof(WCHAR)); _itow(systime.wMinute/10, wcsTime, 10); SAFECALL(m_pTxtTime[3])->SetText(wcsTime); ZeroMemory(wcsTime, 4*sizeof(WCHAR)); _itow(systime.wMinute%10, wcsTime, 10); SAFECALL(m_pTxtTime[4])->SetText(wcsTime); }
// Function name : ReleasePopupSkin // Description : 退出到后台释放POPUP皮肤所占内存 // Return type : void // Argument : void // // Writer : // Date : // Remark : void KDialogP::ReleasePopupSkin() { SAFECALL(m_pGrp_Popup)->SetBackGround(NULL); SAFECALL(m_pBtn_OK)->SetBkgndN(NULL); SAFECALL(m_pBtn_OK)->SetBkgndA(NULL); SAFECALL(m_pBtn_CANCEL)->SetBkgndN(NULL); SAFECALL(m_pBtn_CANCEL)->SetBkgndA(NULL); SAFECALL(m_pHeadGrpCtrl)->SetBackGround(NULL); SAFECALL(m_pBtnHome)->SetBkgndN(NULL); SAFECALL(m_pBtnHome)->SetBkgndA(NULL); SAFECALL(m_pBtnHome)->SetBkgndS(NULL); SAFECALL(m_pBtnBack)->SetBkgndN(NULL); SAFECALL(m_pBtnBack)->SetBkgndA(NULL); SAFECALL(m_pBtnBack)->SetBkgndS(NULL); SAFECALL(m_pVolumeSlider)->SetBkgndN(NULL); SAFECALL(m_pVolumeSlider)->SetBkgndS(NULL); //SAFECALL(m_pRadioIco)->SetBkgndN(NULL); SAFECALL(m_pPhoneIco)->SetBkgndN(NULL); SAFECALL(m_pSDIco)->SetBkgndN(NULL); SAFECALL(m_pUsbIco)->SetBkgndN(NULL); SAFECALL(m_pBTIco)->SetBkgndN(NULL); }
void KDialogP::ChangeHeadCtrlStyle(void) { SAFECALL(m_pHeadBkgnd)->SetBkgndN(g_pSur_Head_GrpCtrl_N); SAFECALL(m_pHeadBkgnd)->SetOpacity(8); SAFECALL(m_pBtnHome)->SetBkgndN(g_pSur_Head_Home_N); SAFECALL(m_pBtnHome)->SetBkgndA(g_pSur_Head_Home_A); SAFECALL(m_pBtnHome)->SetBkgndS(g_pSur_Head_Home_D); //SAFECALL(m_pBtnHome)->SetOpacity(8); SAFECALL(m_pBtnBack)->SetBkgndN(g_pSur_Head_Back_N); SAFECALL(m_pBtnBack)->SetBkgndA(g_pSur_Head_Back_A); SAFECALL(m_pBtnBack)->SetBkgndS(g_pSur_Head_Back_D); //SAFECALL(m_pBtnBack)->SetOpacity(8); SAFECALL(m_pVolumeSlider)->SetBkgndN(g_pSur_Head_Volume_Slider_N); SAFECALL(m_pVolumeSlider)->SetBkgndS(g_pSur_Head_Volume_Slider_S); //m_pRadioIco->SetBkgndN(g_pSur_Head_Radio_Icon); SAFECALL(m_pPhoneIco)->SetBkgndN(g_pSur_Head_Phone_Icon); SAFECALL(m_pSDIco)->SetBkgndN(g_pSur_Head_SD_Icon); SAFECALL(m_pUsbIco)->SetBkgndN(g_pSur_Head_USB_Icon); SAFECALL(m_pBTIco)->SetBkgndN(g_pSur_Head_BT_Icon); UpdateTemperature(); UpdateVolumeBar(); UpdateHeadDevIcon(); OnAutoUpdateTime(NULL); }
void KDialogP::InitHeadCtrl(void) { // 构建画面 m_pHeadGrpCtrl = new HCGroupCtrl; SAFECALL(m_pHeadGrpCtrl)->Create(0, 0, 800, 60/*68*/); AddChild(m_pHeadGrpCtrl); m_pHeadBkgnd = new HCImageCtrl; SAFECALL(m_pHeadBkgnd)->Create(0, 0, 800, 60/*68*/); //SAFECALL(m_pHeadBkgnd)->Enable(false); SAFECALL(m_pHeadBkgnd)->EnableMsg(false); SAFECALL(m_pHeadGrpCtrl)->AddChild(m_pHeadBkgnd); m_pBtnHome = new HCButton; SAFECALL(m_pBtnHome)->Create(0,0,86,68); SAFECALL(m_pBtnHome)->SetCallBack(OnBtnHome, this); SAFECALL(m_pHeadGrpCtrl)->AddChild(m_pBtnHome); m_pTxtScreen = new HCTextCtrl; SAFECALL(m_pTxtScreen)->Create(90,0,154,60); SAFECALL(m_pTxtScreen)->SetFont(GetRESingleton()->GetFont(0)); SAFECALL(m_pTxtScreen)->SetTxtColor(255, 255, 255); SAFECALL(m_pTxtScreen)->SetFontSize(25,25); SAFECALL(m_pTxtScreen)->SetText(L"",0, 17, RE_TS_NORMAL); SAFECALL(m_pHeadGrpCtrl)->AddChild(m_pTxtScreen); m_pImgVolume = new HCImageCtrl; SAFECALL(m_pImgVolume)->Create(233,0,42,68); SAFECALL(m_pImgVolume)->Enable(false); SAFECALL(m_pHeadGrpCtrl)->AddChild(m_pImgVolume); // 音量条 m_pVolumeSlider=new HCSlideCtrl; SAFECALL(m_pVolumeSlider)->Create(277,27,120,6,0,0); SAFECALL(m_pVolumeSlider)->SetBound(0,30); //m_pVolumeSlider->SetValue(20); SAFECALL(m_pVolumeSlider)->EnableMsg(false); SAFECALL(m_pHeadGrpCtrl)->AddChild(m_pVolumeSlider); m_pVolSize = new HCTextCtrl; SAFECALL(m_pVolSize)->Create(401,0,40,60); SAFECALL(m_pVolSize)->SetFontSize(22,22); SAFECALL(m_pVolSize)->SetFont(GetRESingleton()->GetFont(0)); SAFECALL(m_pVolSize)->SetTxtColor(255, 255, 255); SAFECALL(m_pVolSize)->SetText(L"",5, 16, RE_TS_NORMAL); SAFECALL(m_pHeadGrpCtrl)->AddChild(m_pVolSize); //m_pRadioIco = new HCImageCtrl; //m_pRadioIco->Create(494,0,26,68); //m_pRadioIco->SetShow(false); //m_pHeadGrpCtrl->AddChild(m_pRadioIco); m_pTxtTemperature = new HCTextCtrl; SAFECALL(m_pTxtTemperature)->Create(436,0,76,60); SAFECALL(m_pTxtTemperature)->SetFont(GetRESingleton()->GetFont(0)); SAFECALL(m_pTxtTemperature)->SetTxtColor(255, 255, 255); SAFECALL(m_pTxtTemperature)->SetFontSize(22,22); SAFECALL(m_pTxtTemperature)->SetText(L"20℃",0, 17, RE_TS_NORMAL); SAFECALL(m_pTxtTemperature)->SetShow(false); SAFECALL(m_pHeadGrpCtrl)->AddChild(m_pTxtTemperature); m_pPhoneIco = new HCImageCtrl; SAFECALL(m_pPhoneIco)->Create(527,0,20,68); SAFECALL(m_pPhoneIco)->SetShow(false); SAFECALL(m_pPhoneIco)->Enable(false); SAFECALL(m_pHeadGrpCtrl)->AddChild(m_pPhoneIco); m_pSDIco = new HCImageCtrl; SAFECALL(m_pSDIco)->Create(553,0,20,68); SAFECALL(m_pSDIco)->SetShow(false); SAFECALL(m_pSDIco)->Enable(false); SAFECALL(m_pHeadGrpCtrl)->AddChild(m_pSDIco); m_pUsbIco = new HCImageCtrl; SAFECALL(m_pUsbIco)->Create(577,0,20,68); SAFECALL(m_pUsbIco)->SetShow(false); SAFECALL(m_pUsbIco)->Enable(false); SAFECALL(m_pHeadGrpCtrl)->AddChild(m_pUsbIco); m_pBTIco = new HCImageCtrl; SAFECALL(m_pBTIco)->Create(599,0,20,68); SAFECALL(m_pBTIco)->SetShow(false); SAFECALL(m_pBTIco)->Enable(false); SAFECALL(m_pHeadGrpCtrl)->AddChild(m_pBTIco); for (HINT i = 0; i < 2; ++i) { m_pTxtTime[i] = new HCTextCtrl; SAFECALL(m_pTxtTime[i])->Create(625+i*18, 0, 18, 60); SAFECALL(m_pTxtTime[i])->SetFontSize(40,40); SAFECALL(m_pTxtTime[i])->SetFont(GetRESingleton()->GetFont(FONT_QUARTZ_REGULAR_TTF)); SAFECALL(m_pTxtTime[i])->SetTxtColor(255, 255, 255); SAFECALL(m_pTxtTime[i])->SetText(L"",9, 26, RE_TS_CENTER); SAFECALL(m_pHeadGrpCtrl)->AddChild(m_pTxtTime[i]); } m_pTxtTime[2] = new HCTextCtrl; SAFECALL(m_pTxtTime[2])->Create(625+36, 0, 6, 60); SAFECALL(m_pTxtTime[2])->SetFontSize(40,40); SAFECALL(m_pTxtTime[2])->SetFont(GetRESingleton()->GetFont(FONT_QUARTZ_REGULAR_TTF)); SAFECALL(m_pTxtTime[2])->SetTxtColor(255, 255, 255); SAFECALL(m_pTxtTime[2])->SetText(L":",3, 24, RE_TS_CENTER); SAFECALL(m_pHeadGrpCtrl)->AddChild(m_pTxtTime[2]); for (HINT i = 3; i < 5; ++i) { m_pTxtTime[i] = new HCTextCtrl; SAFECALL(m_pTxtTime[i])->Create(625+42+(i-3)*18, 0, 18, 60); SAFECALL(m_pTxtTime[i])->SetFontSize(40,40); SAFECALL(m_pTxtTime[i])->SetFont(GetRESingleton()->GetFont(FONT_QUARTZ_REGULAR_TTF)); SAFECALL(m_pTxtTime[i])->SetTxtColor(255, 255, 255); SAFECALL(m_pTxtTime[i])->SetText(L"",9, 26, RE_TS_CENTER); SAFECALL(m_pHeadGrpCtrl)->AddChild(m_pTxtTime[i]); } m_pTxtAPM[0] = new HCTextCtrl; SAFECALL(m_pTxtAPM[0])->Create(705, 0, 6, 15); SAFECALL(m_pTxtAPM[0])->SetFontSize(10,12); SAFECALL(m_pTxtAPM[0])->SetFont(GetRESingleton()->GetFont(FONT_MSYH_TTF)); SAFECALL(m_pTxtAPM[0])->SetTxtColor(255, 255, 255); SAFECALL(m_pTxtAPM[0])->SetText(L"A",3, 24, RE_TS_CENTER); SAFECALL(m_pTxtAPM[0])->SetShow(false); SAFECALL(m_pHeadGrpCtrl)->AddChild(m_pTxtAPM[0]); m_pTxtAPM[1] = new HCTextCtrl; SAFECALL(m_pTxtAPM[1])->Create(705, 15, 6, 15); SAFECALL(m_pTxtAPM[1])->SetFontSize(10,12); SAFECALL(m_pTxtAPM[1])->SetFont(GetRESingleton()->GetFont(FONT_MSYH_TTF)); SAFECALL(m_pTxtAPM[1])->SetTxtColor(255, 255, 255); SAFECALL(m_pTxtAPM[1])->SetText(L"M",3, 24, RE_TS_CENTER); SAFECALL(m_pTxtAPM[1])->SetShow(false); SAFECALL(m_pHeadGrpCtrl)->AddChild(m_pTxtAPM[1]); // 60s更新一次 m_cTime.SetTime(100*60); m_cTime.SetCallBack(OnAutoUpdateTime,this); AddTimer(&m_cTime); m_cTime.StartTimer(); m_pBtnBack = new HCButton; SAFECALL(m_pBtnBack)->Create(714,0,86,68); SAFECALL(m_pBtnBack)->SetCallBack(OnBtnBackPrevious, this); SAFECALL(m_pHeadGrpCtrl)->AddChild(m_pBtnBack); }
void KDialogP::InitPopupCtrl(void) { // 遮罩窗体 m_pTxt_Popup_Cover = new HCTextCtrl; if( NULL != m_pTxt_Popup_Cover ) { m_pTxt_Popup_Cover->Create(0,0,m_width,m_height); m_pTxt_Popup_Cover->SetFillType(FT_LINEAR_ALPHAV); m_pTxt_Popup_Cover->SetFillColor(100,100,0); m_pTxt_Popup_Cover->SetShow(false); m_pTxt_Popup_Cover->EnableBeep(false); AddChild(m_pTxt_Popup_Cover); } // POPUP GROUP m_pGrp_Popup = new HCGroupCtrl; if( NULL != m_pGrp_Popup ) { SAFECALL(m_pGrp_Popup)->Create(160,140,500,220); SAFECALL(m_pGrp_Popup)->SetShow(false); AddChild(m_pGrp_Popup); // 信息控件 for (size_t i=0;i<(sizeof(m_pTxt_Popup_Infor)/sizeof(m_pTxt_Popup_Infor[0]));i++) { m_pTxt_Popup_Infor[i] = new HCTextCtrl; if( NULL != m_pTxt_Popup_Infor[i] ) { m_pTxt_Popup_Infor[i]->Create(214,-50/*100*/,380,40); SAFECALL(m_pGrp_Popup)->AddChild(m_pTxt_Popup_Infor[i]); m_pTxt_Popup_Infor[i]->SetTextStyle(RE_TS_CENTER); m_pTxt_Popup_Infor[i]->SetTextPos(190,20); m_pTxt_Popup_Infor[i]->SetTxtColor(255,255,255); m_pTxt_Popup_Infor[i]->SetFont(GetRESingleton()->GetFont(0)); m_pTxt_Popup_Infor[i]->SetFontSize(30,30); m_pTxt_Popup_Infor[i]->EnableMsg(false); } } // OK 按钮 m_pBtn_OK = new HCButton; SAFECALL(m_pBtn_OK)->Create(263,262,116,60); SAFECALL(m_pBtn_OK)->SetFontSize(22, 22); SAFECALL(m_pBtn_OK)->SetFont(GetRESingleton()->GetFont(0)); SAFECALL(m_pBtn_OK)->SetText(L"", 58, 30, RE_TS_CENTER); SAFECALL(m_pBtn_OK)->SetCallBack(OnPopupOk,this); SAFECALL(m_pGrp_Popup)->AddChild(m_pBtn_OK); // CANCEL 按钮 m_pBtn_CANCEL = new HCButton; SAFECALL(m_pBtn_CANCEL)->Create(423,262,116,60); SAFECALL(m_pBtn_CANCEL)->SetFontSize(22, 22); SAFECALL(m_pBtn_CANCEL)->SetFont(GetRESingleton()->GetFont(0)); SAFECALL(m_pBtn_CANCEL)->SetText(L"", 58, 30, RE_TS_CENTER); SAFECALL(m_pBtn_CANCEL)->SetCallBack(OnPopupCancel,this); SAFECALL(m_pGrp_Popup)->AddChild(m_pBtn_CANCEL); // 自动隐藏POPUP 定时器 m_ctAutoHidePopup.SetCallBack(OnAutoHidePopup,this); AddTimer(&m_ctAutoHidePopup); } }