#include "DST_Window.h" #include "DST_WinManager.h" #include "DST_CommonAPI.h" #include "DST_UserInterface.h" #include "DST_DataStrings.h" #include "DST_ISDBT_ChannelTask.h" #include "DST_DB.h" #include "DST_ChannelTune.h" #include "DST_SignalMonitor.h" #ifndef DSTAR #include "DHL_OSAL.h" #include "DHL_OSAL_Priv.h" #include "bcmmemmgr.h" #endif extern DS_U8 newcon2_gui_banner_4line_back[]; #if 0 ____CFrequncySettingWin___() #endif static int nPos = 0; //class CFrequncySettingWin : public CWindow //{ //private: // //public: // CFrequncySettingWin(SWinEventMsg event):CWindow(event) void CFrequncySettingWin_Constructor(CWindow *this, SWinEventMsg event) { this->SetWinName(this, "FrequencySetting"); this->setFontStyle(this, 22, 0xFFFFFFFF, ALIGN_MIDDLE, ALIGN_LEFT); this->rect.w = DST_GetImageWidth(newcon2_gui_banner_4line_back); this->rect.h = DST_GetImageHeight(newcon2_gui_banner_4line_back);; this->rect.x = (DST_GetScreenWidth() - this->rect.w) / 2; this->rect.y = (DST_GetScreenHeight() - this->rect.h) / 2; this->SetTimeOut(this, 0); } void CFrequncySettingWin_Destructor(CWindow *this) { } // virtual void OnTimer(char nID) void CFrequncySettingWin_OnTimer(CWindow *this, char nID) { } // virtual void Show(WinID id) void CFrequncySettingWin_ShowWindow(CWindow *this, WinID id) { switch(id) { case WIN_EWS: case WIN_ENGINEER_MODE: case WIN_DEBUG_SQL: case WIN_DEBUG_SQL_SUB: case WIN_DIRECT_TUNE: case WIN_VOLUME: case WIN_VOLUME_MUTE: case WIN_SIGNAL_METER: case WIN_CLOSED_CAPTION_HOT: case WIN_AUDIO_HOT: case WIN_DISPLAY_MODE_HOT: case WIN_FACTORY_RESET: case WIN_FACTORY_RESET_ASK: case WIN_INFOR_BANNER: case WIN_POWER_DOWN_CAUTION: case WIN_MAIN_MENU: case WIN_SUB_MENU_2DEPTH: case WIN_SUB_MENU_3DEPTH: case WIN_SUB_MENU_4DEPTH: case WIN_AUTO_SEARCH: case WIN_MANUAL_SEARCH: case WIN_CHANNEL_LIST: case WIN_PROGRAM_GUIDE: case WIN_PASSWD_CHANGE: case WIN_PASSWD_CHECK: case WIN_PASSWD_CONFIRM: case WIN_AGE_RATING: this->Close(this); break; default: break; } } // virtual void Show() void CFrequncySettingWin_Show(CWindow *this) { this->RegisterAllKey(this); this->DrawImage(this, 0, 0, newcon2_gui_banner_4line_back, false); int nLineHeight = (this->rect.h) / 6; this->setFontStyle(this, 18, 0xFFC8C8C8, ALIGN_MIDDLE, ALIGN_CENTER); this->DrawText(this, 0, 0, this->rect.w, nLineHeight*2, (char*)"Frequency Setting", &(this->font)); char strText[256]; int num = DST_EEPROM_GetMinRF(); int rf = DST_GetFrequencyNumberbyIndex(num); int freq = DST_GetMHzFrequencybyIndex(num); if (nPos == 0) { this->setFontStyle(this, 17, 0xFFFFFFFF, ALIGN_MIDDLE, ALIGN_CENTER); sprintf(strText, "< Min : %d ( %dMHz ) >", rf, freq); } else { this->setFontStyle(this, 15, 0xFFAAAAAA, ALIGN_MIDDLE, ALIGN_CENTER); sprintf(strText, "Min : %d ( %dMHz )", rf, freq); } this->DrawText(this, 0, nLineHeight * 2, this->rect.w, nLineHeight, (char*)strText, &(this->font)); num = DST_EEPROM_GetMaxRF(); rf = DST_GetFrequencyNumberbyIndex(num); freq = DST_GetMHzFrequencybyIndex(num); if (nPos == 0) { this->setFontStyle(this, 15, 0xFFAAAAAA, ALIGN_MIDDLE, ALIGN_CENTER); sprintf(strText, "Max : %d ( %dMHz )", rf, freq); } else { this->setFontStyle(this, 17, 0xFFFFFFFF, ALIGN_MIDDLE, ALIGN_CENTER); sprintf(strText, "< Max : %d ( %dMHz ) >", rf, freq); } this->DrawText(this, 0, nLineHeight * 3, this->rect.w, nLineHeight, (char*)strText, &(this->font)); this->setFontStyle(this, 15, 0xFF666666, ALIGN_MIDDLE, ALIGN_CENTER); this->DrawText(this, 0, nLineHeight * 5, this->rect.w, nLineHeight, (char*)"Channel/Volume : Next", &(this->font)); } // virtual void KeyInput(DS_U8 key, bool /*bRepeat*/) void IncreaseMaxRF() { DST_EEPROM_SetMaxRF(DST_EEPROM_GetMaxRF() + 1); } void DecreaseMinRF() { DST_EEPROM_SetMinRF(DST_EEPROM_GetMinRF() - 1); } void IncreaseMinRF() { DST_EEPROM_SetMinRF(DST_EEPROM_GetMinRF() + 1); if (DST_EEPROM_GetMaxRF() - DST_EEPROM_GetMinRF() < 4) { IncreaseMaxRF(); } if (DST_EEPROM_GetMaxRF() - DST_EEPROM_GetMinRF() < 4) { DST_EEPROM_SetMinRF(DST_EEPROM_GetMaxRF()-4); } } void DecreaseMaxRF() { DST_EEPROM_SetMaxRF(DST_EEPROM_GetMaxRF() - 1); if (DST_EEPROM_GetMaxRF() - DST_EEPROM_GetMinRF() < 4) { DecreaseMinRF(); } if (DST_EEPROM_GetMaxRF() - DST_EEPROM_GetMinRF() < 4) { DST_EEPROM_SetMaxRF(DST_EEPROM_GetMinRF()+4); } } void CFrequncySettingWin_KeyInput(CWindow *this, DS_U8 key, bool bRepeat) { int i = 0; switch(key) { case VK_UP: if (nPos == 0) { for (i=0; i < 10; i++) IncreaseMinRF(); } else { for (i=0; i < 10; i++) IncreaseMaxRF(); } this->Show(this); break; case VK_DN: if (nPos == 0) { for (i=0; i < 10; i++) DecreaseMinRF(); } else { for (i=0; i < 10; i++) DecreaseMaxRF(); } this->Show(this); break; case VK_VOL_UP: case VK_CH_UP: case VK_VOL_DN: case VK_CH_DN: nPos = nPos ? 0 : 1; this->Show(this); break; case VK_LEFT: if (nPos == 0) { DecreaseMinRF(); } else { DecreaseMaxRF(); } this->Show(this); break; case VK_RIGHT: if (nPos == 0) { IncreaseMinRF(); } else { IncreaseMaxRF(); } this->Show(this); break; default: this->Close(this); break; } } //}; void DST_CreateFrequencySettingWin(SWinEventMsg event) { DST_RemoveAllWindowExceptBasicWin(); CWindow*pWin = NewCWindow(event); pWin->Destructor = CFrequncySettingWin_Destructor; pWin->KeyInput = CFrequncySettingWin_KeyInput; pWin->OnTimer = CFrequncySettingWin_OnTimer; pWin->ShowWindow = CFrequncySettingWin_ShowWindow; pWin->Show = CFrequncySettingWin_Show; // »ý¼ºÀÚ È£Ãâ CFrequncySettingWin_Constructor(pWin, event); // À©µµ¿ì ¸Þ´ÏÀú¿¡ µî·Ï DST_AddWin((WinID)(event.data[0]), pWin); }