| 1 | #include "DST_Window.h" |
|---|
| 2 | #include "DST_WinManager.h" |
|---|
| 3 | #include "DST_CommonAPI.h" |
|---|
| 4 | #include "DST_UserInterface.h" |
|---|
| 5 | #include "DST_DataStrings.h" |
|---|
| 6 | #include "DST_ISDBT_ChannelTask.h" |
|---|
| 7 | #include "DST_DB.h" |
|---|
| 8 | #include "DST_ChannelTune.h" |
|---|
| 9 | #include "DST_SignalMonitor.h" |
|---|
| 10 | |
|---|
| 11 | #ifndef DSTAR |
|---|
| 12 | #include "DHL_OSAL.h" |
|---|
| 13 | #include "DHL_OSAL_Priv.h" |
|---|
| 14 | #include "bcmmemmgr.h" |
|---|
| 15 | #endif |
|---|
| 16 | |
|---|
| 17 | extern DS_U8 pin_change_back[]; |
|---|
| 18 | |
|---|
| 19 | #if 0 |
|---|
| 20 | ____CFrequncySettingWin___() |
|---|
| 21 | #endif |
|---|
| 22 | |
|---|
| 23 | static int nPos = 0; |
|---|
| 24 | |
|---|
| 25 | //class CFrequncySettingWin : public CWindow |
|---|
| 26 | //{ |
|---|
| 27 | //private: |
|---|
| 28 | // |
|---|
| 29 | //public: |
|---|
| 30 | // CFrequncySettingWin(SWinEventMsg event):CWindow(event) |
|---|
| 31 | void CFrequncySettingWin_Constructor(CWindow *this, SWinEventMsg event) |
|---|
| 32 | { |
|---|
| 33 | this->SetWinName(this, "FrequencySetting"); |
|---|
| 34 | this->setFontStyle(this, 22, 0xFFFFFFFF, ALIGN_MIDDLE, ALIGN_LEFT); |
|---|
| 35 | this->rect.w = DST_GetImageWidth(pin_change_back); |
|---|
| 36 | this->rect.h = DST_GetImageHeight(pin_change_back);; |
|---|
| 37 | this->rect.x = (DST_GetScreenWidth() - this->rect.w) / 2; |
|---|
| 38 | this->rect.y = (DST_GetScreenHeight() - this->rect.h) / 2; |
|---|
| 39 | nPos = 0; |
|---|
| 40 | |
|---|
| 41 | this->SetTimeOut(this, 0); |
|---|
| 42 | } |
|---|
| 43 | |
|---|
| 44 | void CFrequncySettingWin_Destructor(CWindow *this) |
|---|
| 45 | { |
|---|
| 46 | } |
|---|
| 47 | |
|---|
| 48 | // virtual void OnTimer(char nID) |
|---|
| 49 | void CFrequncySettingWin_OnTimer(CWindow *this, char nID) |
|---|
| 50 | { |
|---|
| 51 | } |
|---|
| 52 | |
|---|
| 53 | // virtual void Show(WinID id) |
|---|
| 54 | void CFrequncySettingWin_ShowWindow(CWindow *this, WinID id) |
|---|
| 55 | { |
|---|
| 56 | switch(id) |
|---|
| 57 | { |
|---|
| 58 | case WIN_EWS: |
|---|
| 59 | case WIN_ENGINEER_MODE: |
|---|
| 60 | case WIN_DEBUG_SQL: |
|---|
| 61 | case WIN_DEBUG_SQL_SUB: |
|---|
| 62 | case WIN_DIRECT_TUNE: |
|---|
| 63 | case WIN_VOLUME: |
|---|
| 64 | case WIN_VOLUME_MUTE: |
|---|
| 65 | case WIN_SIGNAL_METER: |
|---|
| 66 | case WIN_CLOSED_CAPTION_HOT: |
|---|
| 67 | case WIN_AUDIO_HOT: |
|---|
| 68 | case WIN_DISPLAY_MODE_HOT: |
|---|
| 69 | case WIN_FACTORY_RESET: |
|---|
| 70 | case WIN_FACTORY_RESET_ASK: |
|---|
| 71 | case WIN_INFOR_BANNER: |
|---|
| 72 | case WIN_POWER_DOWN_CAUTION: |
|---|
| 73 | case WIN_MAIN_MENU: |
|---|
| 74 | case WIN_SUB_MENU_2DEPTH: |
|---|
| 75 | case WIN_SUB_MENU_3DEPTH: |
|---|
| 76 | case WIN_SUB_MENU_4DEPTH: |
|---|
| 77 | case WIN_AUTO_SEARCH: |
|---|
| 78 | case WIN_MANUAL_SEARCH: |
|---|
| 79 | case WIN_CHANNEL_LIST: |
|---|
| 80 | case WIN_PROGRAM_GUIDE: |
|---|
| 81 | case WIN_PASSWD_CHANGE: |
|---|
| 82 | case WIN_PASSWD_CHECK: |
|---|
| 83 | case WIN_PASSWD_CONFIRM: |
|---|
| 84 | case WIN_AGE_RATING: |
|---|
| 85 | this->Close(this); |
|---|
| 86 | break; |
|---|
| 87 | default: |
|---|
| 88 | break; |
|---|
| 89 | } |
|---|
| 90 | } |
|---|
| 91 | |
|---|
| 92 | // virtual void Show() |
|---|
| 93 | void CFrequncySettingWin_Show(CWindow *this) |
|---|
| 94 | { |
|---|
| 95 | this->RegisterAllKey(this); |
|---|
| 96 | this->RegisterKey(this, VK_PWR, false, 0, 0); |
|---|
| 97 | // background |
|---|
| 98 | this->DrawImage(this, 0, 0, pin_change_back, false); |
|---|
| 99 | |
|---|
| 100 | char strText[256]; |
|---|
| 101 | |
|---|
| 102 | int nLineHeight = (this->rect.h) / 7; |
|---|
| 103 | // title |
|---|
| 104 | this->setFontStyle(this, 21, 0xFFC8C8C8, ALIGN_MIDDLE, ALIGN_CENTER); |
|---|
| 105 | this->DrawText(this, 0, 0, this->rect.w, nLineHeight*2, (char*)"Frequency Setting", &(this->font)); |
|---|
| 106 | |
|---|
| 107 | |
|---|
| 108 | this->DrawText(this, 0, (nLineHeight * 2)+(nLineHeight/3), (this->rect.w)/2, nLineHeight, (char*)"Min.", &(this->font)); |
|---|
| 109 | this->DrawText(this, (this->rect.w)/2, (nLineHeight * 2)+(nLineHeight/3), (this->rect.w)/2, nLineHeight, (char*)"Max.", &(this->font)); |
|---|
| 110 | |
|---|
| 111 | |
|---|
| 112 | // display min |
|---|
| 113 | switch(nPos) |
|---|
| 114 | { |
|---|
| 115 | |
|---|
| 116 | case 0: |
|---|
| 117 | this->setFontStyle(this, 22, 0xFFFFFFFF, ALIGN_MIDDLE, ALIGN_CENTER); |
|---|
| 118 | |
|---|
| 119 | break; |
|---|
| 120 | case 1: |
|---|
| 121 | this->setFontStyle(this, 21, 0xFFAAAAAA, ALIGN_MIDDLE, ALIGN_CENTER); |
|---|
| 122 | |
|---|
| 123 | break; |
|---|
| 124 | default:break; |
|---|
| 125 | } |
|---|
| 126 | |
|---|
| 127 | int num = DST_EEPROM_GetMinRF(); |
|---|
| 128 | |
|---|
| 129 | int rf = DST_GetFrequencyNumberbyIndex(num); |
|---|
| 130 | int freq = DST_GetMHzFrequencybyIndex(num); |
|---|
| 131 | sprintf(strText, "%d (%dMHz)", rf, freq); |
|---|
| 132 | |
|---|
| 133 | this->DrawText(this, 0, nLineHeight * 4, (this->rect.w)/2, nLineHeight, (char*)strText, &(this->font)); |
|---|
| 134 | |
|---|
| 135 | //display up /down |
|---|
| 136 | this->setFontStyle(this, 21, 0xFFC8C8C8, ALIGN_MIDDLE, ALIGN_CENTER); |
|---|
| 137 | this->DrawText(this, 0, (nLineHeight * 3)+(nLineHeight/3), (this->rect.w)/2, nLineHeight, (char*)"^", &(this->font)); |
|---|
| 138 | this->DrawText(this, (this->rect.w)/2, (nLineHeight * 3)+(nLineHeight/3), (this->rect.w)/2, nLineHeight, (char*)"^", &(this->font)); |
|---|
| 139 | |
|---|
| 140 | this->DrawText(this, 0, (nLineHeight * 4)+(nLineHeight*2)/3, (this->rect.w)/2, nLineHeight, (char*)"v", &(this->font)); |
|---|
| 141 | this->DrawText(this, (this->rect.w)/2, (nLineHeight * 4)+(nLineHeight*2)/3, (this->rect.w)/2, nLineHeight, (char*)"v", &(this->font)); |
|---|
| 142 | // display ~ |
|---|
| 143 | this->setFontStyle(this, 21, 0xFFC8C8C8, ALIGN_MIDDLE, ALIGN_CENTER); |
|---|
| 144 | this->DrawText(this, 0, nLineHeight * 4, this->rect.w, nLineHeight, (char*)"~", &(this->font)); |
|---|
| 145 | |
|---|
| 146 | // display max |
|---|
| 147 | switch(nPos) |
|---|
| 148 | { |
|---|
| 149 | |
|---|
| 150 | case 0: |
|---|
| 151 | this->setFontStyle(this, 21, 0xFFAAAAAA, ALIGN_MIDDLE, ALIGN_CENTER); |
|---|
| 152 | |
|---|
| 153 | break; |
|---|
| 154 | case 1: |
|---|
| 155 | this->setFontStyle(this, 22, 0xFFFFFFFF, ALIGN_MIDDLE, ALIGN_CENTER); |
|---|
| 156 | |
|---|
| 157 | break; |
|---|
| 158 | default:break; |
|---|
| 159 | } |
|---|
| 160 | |
|---|
| 161 | num = DST_EEPROM_GetMaxRF(); |
|---|
| 162 | |
|---|
| 163 | rf = DST_GetFrequencyNumberbyIndex(num); |
|---|
| 164 | freq = DST_GetMHzFrequencybyIndex(num); |
|---|
| 165 | sprintf(strText, "%d (%dMHz)", rf, freq); |
|---|
| 166 | |
|---|
| 167 | |
|---|
| 168 | this->DrawText(this, (this->rect.w)/2, nLineHeight * 4, (this->rect.w)/2, nLineHeight, (char*)strText, &(this->font)); |
|---|
| 169 | // descriptor |
|---|
| 170 | this->setFontStyle(this, 18, 0xFF666666, ALIGN_MIDDLE, ALIGN_CENTER); |
|---|
| 171 | this->DrawText(this, 0, nLineHeight * 6, this->rect.w, nLineHeight, (char*)"Left/Right : Next", &(this->font)); |
|---|
| 172 | } |
|---|
| 173 | |
|---|
| 174 | |
|---|
| 175 | // virtual void KeyInput(DS_U8 key, bool /*bRepeat*/) |
|---|
| 176 | void IncreaseMaxRF() |
|---|
| 177 | { |
|---|
| 178 | if (DST_EEPROM_GetMaxRF() >= DST_MaxRF()) |
|---|
| 179 | { |
|---|
| 180 | DST_EEPROM_SetMaxRF(DST_MaxRF()); |
|---|
| 181 | return; |
|---|
| 182 | } |
|---|
| 183 | else if (DST_EEPROM_GetMinRF() > DST_EEPROM_GetMaxRF()) |
|---|
| 184 | { |
|---|
| 185 | DST_EEPROM_SetMaxRF(DST_EEPROM_GetMinRF()); |
|---|
| 186 | return; |
|---|
| 187 | } |
|---|
| 188 | DST_EEPROM_SetMaxRF(DST_EEPROM_GetMaxRF() + 1); |
|---|
| 189 | } |
|---|
| 190 | void DecreaseMinRF() |
|---|
| 191 | { |
|---|
| 192 | if (DST_EEPROM_GetMinRF() <= DST_MinRF()) |
|---|
| 193 | { |
|---|
| 194 | DST_EEPROM_SetMinRF(DST_MinRF()); |
|---|
| 195 | return; |
|---|
| 196 | } |
|---|
| 197 | else if (DST_EEPROM_GetMinRF() > DST_EEPROM_GetMaxRF()) |
|---|
| 198 | { |
|---|
| 199 | DST_EEPROM_SetMinRF(DST_EEPROM_GetMaxRF()); |
|---|
| 200 | return; |
|---|
| 201 | } |
|---|
| 202 | DST_EEPROM_SetMinRF(DST_EEPROM_GetMinRF() - 1); |
|---|
| 203 | } |
|---|
| 204 | void IncreaseMinRF() |
|---|
| 205 | { |
|---|
| 206 | if (DST_EEPROM_GetMinRF() >= DST_MaxRF()) |
|---|
| 207 | { |
|---|
| 208 | DST_EEPROM_SetMinRF(DST_MaxRF()); |
|---|
| 209 | return; |
|---|
| 210 | } |
|---|
| 211 | else if (DST_EEPROM_GetMinRF() >= DST_EEPROM_GetMaxRF()) |
|---|
| 212 | { |
|---|
| 213 | DST_EEPROM_SetMinRF(DST_EEPROM_GetMaxRF()); |
|---|
| 214 | return; |
|---|
| 215 | } |
|---|
| 216 | |
|---|
| 217 | DST_EEPROM_SetMinRF(DST_EEPROM_GetMinRF() + 1); |
|---|
| 218 | } |
|---|
| 219 | void DecreaseMaxRF() |
|---|
| 220 | { |
|---|
| 221 | if (DST_EEPROM_GetMaxRF() <= DST_MinRF()) |
|---|
| 222 | { |
|---|
| 223 | DST_EEPROM_SetMaxRF(DST_MinRF()); |
|---|
| 224 | return; |
|---|
| 225 | } |
|---|
| 226 | else if (DST_EEPROM_GetMinRF() >= DST_EEPROM_GetMaxRF()) |
|---|
| 227 | { |
|---|
| 228 | DST_EEPROM_SetMaxRF(DST_EEPROM_GetMinRF()); |
|---|
| 229 | return; |
|---|
| 230 | } |
|---|
| 231 | |
|---|
| 232 | DST_EEPROM_SetMaxRF(DST_EEPROM_GetMaxRF() - 1); |
|---|
| 233 | } |
|---|
| 234 | void CFrequncySettingWin_KeyInput(CWindow *this, DS_U8 key, bool bRepeat) |
|---|
| 235 | { |
|---|
| 236 | int i = 0; |
|---|
| 237 | |
|---|
| 238 | switch(key) |
|---|
| 239 | { |
|---|
| 240 | case VK_VOL_UP: |
|---|
| 241 | case VK_CH_UP: |
|---|
| 242 | |
|---|
| 243 | switch(nPos) |
|---|
| 244 | { |
|---|
| 245 | |
|---|
| 246 | case 0: |
|---|
| 247 | |
|---|
| 248 | for (i=0; i < 10; i++) IncreaseMinRF(); |
|---|
| 249 | |
|---|
| 250 | break; |
|---|
| 251 | case 1: |
|---|
| 252 | |
|---|
| 253 | for (i=0; i < 10; i++) IncreaseMaxRF(); |
|---|
| 254 | |
|---|
| 255 | break; |
|---|
| 256 | default:break; |
|---|
| 257 | } |
|---|
| 258 | |
|---|
| 259 | this->Show(this); |
|---|
| 260 | break; |
|---|
| 261 | |
|---|
| 262 | case VK_VOL_DN: |
|---|
| 263 | case VK_CH_DN: |
|---|
| 264 | |
|---|
| 265 | switch(nPos) |
|---|
| 266 | { |
|---|
| 267 | |
|---|
| 268 | case 0: |
|---|
| 269 | |
|---|
| 270 | for (i=0; i < 10; i++) DecreaseMinRF(); |
|---|
| 271 | |
|---|
| 272 | break; |
|---|
| 273 | case 1: |
|---|
| 274 | |
|---|
| 275 | for (i=0; i < 10; i++) DecreaseMaxRF(); |
|---|
| 276 | |
|---|
| 277 | break; |
|---|
| 278 | default:break; |
|---|
| 279 | } |
|---|
| 280 | |
|---|
| 281 | this->Show(this); |
|---|
| 282 | break; |
|---|
| 283 | |
|---|
| 284 | case VK_LEFT: |
|---|
| 285 | case VK_RIGHT: |
|---|
| 286 | nPos = nPos==1?0:1; |
|---|
| 287 | this->Show(this); |
|---|
| 288 | break; |
|---|
| 289 | |
|---|
| 290 | case VK_DN: |
|---|
| 291 | switch(nPos) |
|---|
| 292 | { |
|---|
| 293 | case 0: |
|---|
| 294 | DecreaseMinRF(); |
|---|
| 295 | break; |
|---|
| 296 | case 1: |
|---|
| 297 | DecreaseMaxRF(); |
|---|
| 298 | break; |
|---|
| 299 | default:break; |
|---|
| 300 | } |
|---|
| 301 | |
|---|
| 302 | this->Show(this); |
|---|
| 303 | break; |
|---|
| 304 | |
|---|
| 305 | case VK_UP: |
|---|
| 306 | switch(nPos) |
|---|
| 307 | { |
|---|
| 308 | case 0: |
|---|
| 309 | IncreaseMinRF(); |
|---|
| 310 | break; |
|---|
| 311 | case 1: |
|---|
| 312 | IncreaseMaxRF(); |
|---|
| 313 | break; |
|---|
| 314 | default:break; |
|---|
| 315 | } |
|---|
| 316 | |
|---|
| 317 | this->Show(this); |
|---|
| 318 | break; |
|---|
| 319 | |
|---|
| 320 | default: |
|---|
| 321 | this->Close(this); |
|---|
| 322 | break; |
|---|
| 323 | } |
|---|
| 324 | } |
|---|
| 325 | |
|---|
| 326 | //}; |
|---|
| 327 | |
|---|
| 328 | void DST_CreateFrequencySettingWin(SWinEventMsg event) |
|---|
| 329 | { |
|---|
| 330 | DST_RemoveAllWindowExceptBasicWin(); |
|---|
| 331 | CWindow*pWin = NewCWindow(event); |
|---|
| 332 | pWin->Destructor = CFrequncySettingWin_Destructor; |
|---|
| 333 | pWin->KeyInput = CFrequncySettingWin_KeyInput; |
|---|
| 334 | pWin->OnTimer = CFrequncySettingWin_OnTimer; |
|---|
| 335 | pWin->ShowWindow = CFrequncySettingWin_ShowWindow; |
|---|
| 336 | pWin->Show = CFrequncySettingWin_Show; |
|---|
| 337 | // »ý¼ºÀÚ È£Ãâ |
|---|
| 338 | CFrequncySettingWin_Constructor(pWin, event); |
|---|
| 339 | // À©µµ¿ì ¸Þ´ÏÀú¿¡ µî·Ï |
|---|
| 340 | DST_AddWin((WinID)(event.data[0]), pWin); |
|---|
| 341 | } |
|---|
| 342 | |
|---|
| 343 | |
|---|