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