#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 pin_change_back[]; #if 0 ____CFrequncySettingWin___() #endif static int nPos = 0; static int nMin = 0; static int nMax = 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(pin_change_back); this->rect.h = DST_GetImageHeight(pin_change_back);; this->rect.x = (DST_GetScreenWidth() - this->rect.w) / 2; this->rect.y = (DST_GetScreenHeight() - this->rect.h) / 2; nPos = 0; this->SetTimeOut(this, 0); nMin = DST_EEPROM_GetMinRF(); nMax = DST_EEPROM_GetMaxRF(); } void CFrequncySettingWin_Destructor(CWindow *this) { // ¼³Á¤°ªÀÌ º¯°æµÇ¾ú´Ù¸é ÃʱâÈ­ÇÑ´Ù. if (nMin != DST_EEPROM_GetMinRF() || nMax != DST_EEPROM_GetMaxRF()) { DST_EEPROM_SetNeedReset(1); DST_Reset(__func__); // âÀÌ ´ÝÈ÷¸é¼­ ÀçºÎÆÃ } } // 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->RegisterKey(this, VK_PWR, false, 0, 0); // background this->DrawImage(this, 0, 0, pin_change_back, false); char strText[256]; int nLineHeight = (this->rect.h) / 7; // title this->setFontStyle(this, 21, 0xFFC8C8C8, ALIGN_MIDDLE, ALIGN_CENTER); this->DrawText(this, 0, 0, this->rect.w, nLineHeight*2, (char*)"Frequency Setting", &(this->font)); this->DrawText(this, 0, (nLineHeight * 2)+(nLineHeight/3), (this->rect.w)/2, nLineHeight, (char*)"Min.", &(this->font)); this->DrawText(this, (this->rect.w)/2, (nLineHeight * 2)+(nLineHeight/3), (this->rect.w)/2, nLineHeight, (char*)"Max.", &(this->font)); // display min switch(nPos) { case 0: this->setFontStyle(this, 22, 0xFFFFFFFF, ALIGN_MIDDLE, ALIGN_CENTER); break; case 1: this->setFontStyle(this, 21, 0xFFAAAAAA, ALIGN_MIDDLE, ALIGN_CENTER); break; default:break; } int num = DST_EEPROM_GetMinRF(); int rf = DST_GetFrequencyNumberbyIndex(num); int freq = DST_GetMHzFrequencybyIndex(num); sprintf(strText, "%d (%dMHz)", rf, freq); this->DrawText(this, 0, nLineHeight * 4, (this->rect.w)/2, nLineHeight, (char*)strText, &(this->font)); //display up /down this->setFontStyle(this, 15, 0xFFC8C8C8, ALIGN_MIDDLE, ALIGN_CENTER); //this->DrawText(this, 0, (nLineHeight * 3)+(nLineHeight/3), (this->rect.w)/2, nLineHeight, (char*)"^", &(this->font)); DS_U16 strTextUp[2] = { 0x25B2, 0}; DS_U16 strTextDn[2] = { 0x25BC, 0}; this->DrawTextUni(this, 0, (nLineHeight * 3)+(nLineHeight/3), (this->rect.w)/2, nLineHeight, strTextUp, &(this->font)); this->DrawTextUni(this, (this->rect.w)/2, (nLineHeight * 3)+(nLineHeight/3), (this->rect.w)/2, nLineHeight, strTextUp, &(this->font)); this->DrawTextUni(this, 0, (nLineHeight * 4)+(nLineHeight*2)/3, (this->rect.w)/2, nLineHeight, strTextDn, &(this->font)); this->DrawTextUni(this, (this->rect.w)/2, (nLineHeight * 4)+(nLineHeight*2)/3, (this->rect.w)/2, nLineHeight, strTextDn, &(this->font)); // display ~ this->setFontStyle(this, 21, 0xFFC8C8C8, ALIGN_MIDDLE, ALIGN_CENTER); this->DrawText(this, 0, nLineHeight * 4, this->rect.w, nLineHeight, (char*)"~", &(this->font)); // display max switch(nPos) { case 0: this->setFontStyle(this, 21, 0xFFAAAAAA, ALIGN_MIDDLE, ALIGN_CENTER); break; case 1: this->setFontStyle(this, 22, 0xFFFFFFFF, ALIGN_MIDDLE, ALIGN_CENTER); break; default:break; } num = DST_EEPROM_GetMaxRF(); rf = DST_GetFrequencyNumberbyIndex(num); freq = DST_GetMHzFrequencybyIndex(num); sprintf(strText, "%d (%dMHz)", rf, freq); this->DrawText(this, (this->rect.w)/2, nLineHeight * 4, (this->rect.w)/2, nLineHeight, (char*)strText, &(this->font)); // descriptor this->setFontStyle(this, 18, 0xFF666666, ALIGN_MIDDLE, ALIGN_CENTER); this->DrawText(this, 0, nLineHeight * 6, this->rect.w, nLineHeight, (char*)"Left/Right : Next", &(this->font)); } // virtual void KeyInput(DS_U8 key, bool /*bRepeat*/) void IncreaseMaxRF() { if (DST_EEPROM_GetMaxRF() >= DST_MaxRF()) { DST_EEPROM_SetMaxRF(DST_MaxRF()); return; } else if (DST_EEPROM_GetMinRF() > DST_EEPROM_GetMaxRF()) { DST_EEPROM_SetMaxRF(DST_EEPROM_GetMinRF()); return; } DST_EEPROM_SetMaxRF(DST_EEPROM_GetMaxRF() + 1); } void DecreaseMinRF() { if (DST_EEPROM_GetMinRF() <= DST_MinRF()) { DST_EEPROM_SetMinRF(DST_MinRF()); return; } else if (DST_EEPROM_GetMinRF() > DST_EEPROM_GetMaxRF()) { DST_EEPROM_SetMinRF(DST_EEPROM_GetMaxRF()); return; } DST_EEPROM_SetMinRF(DST_EEPROM_GetMinRF() - 1); } void IncreaseMinRF() { if (DST_EEPROM_GetMinRF() >= DST_MaxRF()) { DST_EEPROM_SetMinRF(DST_MaxRF()); return; } else if (DST_EEPROM_GetMinRF() >= DST_EEPROM_GetMaxRF()) { DST_EEPROM_SetMinRF(DST_EEPROM_GetMaxRF()); return; } DST_EEPROM_SetMinRF(DST_EEPROM_GetMinRF() + 1); } void DecreaseMaxRF() { if (DST_EEPROM_GetMaxRF() <= DST_MinRF()) { DST_EEPROM_SetMaxRF(DST_MinRF()); return; } else if (DST_EEPROM_GetMinRF() >= DST_EEPROM_GetMaxRF()) { DST_EEPROM_SetMaxRF(DST_EEPROM_GetMinRF()); return; } DST_EEPROM_SetMaxRF(DST_EEPROM_GetMaxRF() - 1); } void CFrequncySettingWin_KeyInput(CWindow *this, DS_U8 key, bool bRepeat) { int i = 0; switch(key) { case VK_VOL_UP: case VK_CH_UP: switch(nPos) { case 0: for (i=0; i < 10; i++) IncreaseMinRF(); break; case 1: for (i=0; i < 10; i++) IncreaseMaxRF(); break; default:break; } this->Show(this); break; case VK_VOL_DN: case VK_CH_DN: switch(nPos) { case 0: for (i=0; i < 10; i++) DecreaseMinRF(); break; case 1: for (i=0; i < 10; i++) DecreaseMaxRF(); break; default:break; } this->Show(this); break; case VK_LEFT: case VK_RIGHT: nPos = nPos==1?0:1; this->Show(this); break; case VK_DN: switch(nPos) { case 0: DecreaseMinRF(); break; case 1: DecreaseMaxRF(); break; default:break; } this->Show(this); break; case VK_UP: switch(nPos) { case 0: IncreaseMinRF(); break; case 1: IncreaseMaxRF(); break; default:break; } 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); }