| [2] | 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 | static int nMin = 0; |
|---|
| 25 | static int nMax = 0; |
|---|
| 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); |
|---|
| 37 | this->rect.w = DST_GetImageWidth(pin_change_back); |
|---|
| 38 | this->rect.h = DST_GetImageHeight(pin_change_back);; |
|---|
| 39 | this->rect.x = (DST_GetScreenWidth() - this->rect.w) / 2; |
|---|
| 40 | this->rect.y = (DST_GetScreenHeight() - this->rect.h) / 2; |
|---|
| 41 | nPos = 0; |
|---|
| 42 | |
|---|
| 43 | this->SetTimeOut(this, 0); |
|---|
| 44 | |
|---|
| 45 | nMin = DST_EEPROM_GetMinRF(); |
|---|
| 46 | nMax = DST_EEPROM_GetMaxRF(); |
|---|
| 47 | } |
|---|
| 48 | |
|---|
| 49 | void CFrequncySettingWin_Destructor(CWindow *this) |
|---|
| 50 | { |
|---|
| 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 | } |
|---|
| 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); |
|---|
| 108 | this->RegisterKey(this, VK_PWR, false, 0, 0); |
|---|
| 109 | // background |
|---|
| 110 | this->DrawImage(this, 0, 0, pin_change_back, false); |
|---|
| 111 | |
|---|
| 112 | char strText[256]; |
|---|
| 113 | |
|---|
| 114 | int nLineHeight = (this->rect.h) / 7; |
|---|
| 115 | // title |
|---|
| 116 | this->setFontStyle(this, 21, 0xFFC8C8C8, ALIGN_MIDDLE, ALIGN_CENTER); |
|---|
| 117 | this->DrawText(this, 0, 0, this->rect.w, nLineHeight*2, (char*)"Frequency Setting", &(this->font)); |
|---|
| 118 | |
|---|
| 119 | |
|---|
| 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 |
|---|
| 125 | switch(nPos) |
|---|
| 126 | { |
|---|
| 127 | |
|---|
| 128 | case 0: |
|---|
| 129 | this->setFontStyle(this, 22, 0xFFFFFFFF, ALIGN_MIDDLE, ALIGN_CENTER); |
|---|
| 130 | |
|---|
| 131 | break; |
|---|
| 132 | case 1: |
|---|
| 133 | this->setFontStyle(this, 21, 0xFFAAAAAA, ALIGN_MIDDLE, ALIGN_CENTER); |
|---|
| 134 | |
|---|
| 135 | break; |
|---|
| 136 | default:break; |
|---|
| 137 | } |
|---|
| 138 | |
|---|
| 139 | int num = DST_EEPROM_GetMinRF(); |
|---|
| 140 | |
|---|
| 141 | int rf = DST_GetFrequencyNumberbyIndex(num); |
|---|
| 142 | int freq = DST_GetMHzFrequencybyIndex(num); |
|---|
| 143 | sprintf(strText, "%d (%dMHz)", rf, freq); |
|---|
| 144 | |
|---|
| 145 | this->DrawText(this, 0, nLineHeight * 4, (this->rect.w)/2, nLineHeight, (char*)strText, &(this->font)); |
|---|
| 146 | |
|---|
| 147 | //display up /down |
|---|
| 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)); |
|---|
| 154 | |
|---|
| 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)); |
|---|
| 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 |
|---|
| 162 | switch(nPos) |
|---|
| 163 | { |
|---|
| 164 | |
|---|
| 165 | case 0: |
|---|
| 166 | this->setFontStyle(this, 21, 0xFFAAAAAA, ALIGN_MIDDLE, ALIGN_CENTER); |
|---|
| 167 | |
|---|
| 168 | break; |
|---|
| 169 | case 1: |
|---|
| 170 | this->setFontStyle(this, 22, 0xFFFFFFFF, ALIGN_MIDDLE, ALIGN_CENTER); |
|---|
| 171 | |
|---|
| 172 | break; |
|---|
| 173 | default:break; |
|---|
| 174 | } |
|---|
| 175 | |
|---|
| 176 | num = DST_EEPROM_GetMaxRF(); |
|---|
| 177 | |
|---|
| 178 | rf = DST_GetFrequencyNumberbyIndex(num); |
|---|
| 179 | freq = DST_GetMHzFrequencybyIndex(num); |
|---|
| 180 | sprintf(strText, "%d (%dMHz)", rf, freq); |
|---|
| 181 | |
|---|
| 182 | |
|---|
| 183 | this->DrawText(this, (this->rect.w)/2, nLineHeight * 4, (this->rect.w)/2, nLineHeight, (char*)strText, &(this->font)); |
|---|
| 184 | // descriptor |
|---|
| 185 | this->setFontStyle(this, 18, 0xFF666666, ALIGN_MIDDLE, ALIGN_CENTER); |
|---|
| 186 | this->DrawText(this, 0, nLineHeight * 6, this->rect.w, nLineHeight, (char*)"Left/Right : Next", &(this->font)); |
|---|
| 187 | } |
|---|
| 188 | |
|---|
| 189 | |
|---|
| 190 | // virtual void KeyInput(DS_U8 key, bool /*bRepeat*/) |
|---|
| 191 | void IncreaseMaxRF() |
|---|
| 192 | { |
|---|
| 193 | if (DST_EEPROM_GetMaxRF() >= DST_MaxRF()) |
|---|
| 194 | { |
|---|
| 195 | DST_EEPROM_SetMaxRF(DST_MaxRF()); |
|---|
| 196 | return; |
|---|
| 197 | } |
|---|
| 198 | else if (DST_EEPROM_GetMinRF() > DST_EEPROM_GetMaxRF()) |
|---|
| 199 | { |
|---|
| 200 | DST_EEPROM_SetMaxRF(DST_EEPROM_GetMinRF()); |
|---|
| 201 | return; |
|---|
| 202 | } |
|---|
| 203 | DST_EEPROM_SetMaxRF(DST_EEPROM_GetMaxRF() + 1); |
|---|
| 204 | } |
|---|
| 205 | void DecreaseMinRF() |
|---|
| 206 | { |
|---|
| 207 | if (DST_EEPROM_GetMinRF() <= DST_MinRF()) |
|---|
| 208 | { |
|---|
| 209 | DST_EEPROM_SetMinRF(DST_MinRF()); |
|---|
| 210 | return; |
|---|
| 211 | } |
|---|
| 212 | else if (DST_EEPROM_GetMinRF() > DST_EEPROM_GetMaxRF()) |
|---|
| 213 | { |
|---|
| 214 | DST_EEPROM_SetMinRF(DST_EEPROM_GetMaxRF()); |
|---|
| 215 | return; |
|---|
| 216 | } |
|---|
| 217 | DST_EEPROM_SetMinRF(DST_EEPROM_GetMinRF() - 1); |
|---|
| 218 | } |
|---|
| 219 | void IncreaseMinRF() |
|---|
| 220 | { |
|---|
| 221 | if (DST_EEPROM_GetMinRF() >= DST_MaxRF()) |
|---|
| 222 | { |
|---|
| 223 | DST_EEPROM_SetMinRF(DST_MaxRF()); |
|---|
| 224 | return; |
|---|
| 225 | } |
|---|
| 226 | else if (DST_EEPROM_GetMinRF() >= DST_EEPROM_GetMaxRF()) |
|---|
| 227 | { |
|---|
| 228 | DST_EEPROM_SetMinRF(DST_EEPROM_GetMaxRF()); |
|---|
| 229 | return; |
|---|
| 230 | } |
|---|
| 231 | |
|---|
| 232 | DST_EEPROM_SetMinRF(DST_EEPROM_GetMinRF() + 1); |
|---|
| 233 | } |
|---|
| 234 | void DecreaseMaxRF() |
|---|
| 235 | { |
|---|
| 236 | if (DST_EEPROM_GetMaxRF() <= DST_MinRF()) |
|---|
| 237 | { |
|---|
| 238 | DST_EEPROM_SetMaxRF(DST_MinRF()); |
|---|
| 239 | return; |
|---|
| 240 | } |
|---|
| 241 | else if (DST_EEPROM_GetMinRF() >= DST_EEPROM_GetMaxRF()) |
|---|
| 242 | { |
|---|
| 243 | DST_EEPROM_SetMaxRF(DST_EEPROM_GetMinRF()); |
|---|
| 244 | return; |
|---|
| 245 | } |
|---|
| 246 | |
|---|
| 247 | DST_EEPROM_SetMaxRF(DST_EEPROM_GetMaxRF() - 1); |
|---|
| 248 | } |
|---|
| 249 | void CFrequncySettingWin_KeyInput(CWindow *this, DS_U8 key, bool bRepeat) |
|---|
| 250 | { |
|---|
| 251 | int i = 0; |
|---|
| 252 | |
|---|
| 253 | switch(key) |
|---|
| 254 | { |
|---|
| 255 | case VK_VOL_UP: |
|---|
| 256 | case VK_CH_UP: |
|---|
| 257 | |
|---|
| 258 | switch(nPos) |
|---|
| 259 | { |
|---|
| 260 | |
|---|
| 261 | case 0: |
|---|
| 262 | |
|---|
| 263 | for (i=0; i < 10; i++) IncreaseMinRF(); |
|---|
| 264 | |
|---|
| 265 | break; |
|---|
| 266 | case 1: |
|---|
| 267 | |
|---|
| 268 | for (i=0; i < 10; i++) IncreaseMaxRF(); |
|---|
| 269 | |
|---|
| 270 | break; |
|---|
| 271 | default:break; |
|---|
| 272 | } |
|---|
| 273 | |
|---|
| 274 | this->Show(this); |
|---|
| 275 | break; |
|---|
| 276 | |
|---|
| 277 | case VK_VOL_DN: |
|---|
| 278 | case VK_CH_DN: |
|---|
| 279 | |
|---|
| 280 | switch(nPos) |
|---|
| 281 | { |
|---|
| 282 | |
|---|
| 283 | case 0: |
|---|
| 284 | |
|---|
| 285 | for (i=0; i < 10; i++) DecreaseMinRF(); |
|---|
| 286 | |
|---|
| 287 | break; |
|---|
| 288 | case 1: |
|---|
| 289 | |
|---|
| 290 | for (i=0; i < 10; i++) DecreaseMaxRF(); |
|---|
| 291 | |
|---|
| 292 | break; |
|---|
| 293 | default:break; |
|---|
| 294 | } |
|---|
| 295 | |
|---|
| 296 | this->Show(this); |
|---|
| 297 | break; |
|---|
| 298 | |
|---|
| 299 | case VK_LEFT: |
|---|
| 300 | case VK_RIGHT: |
|---|
| 301 | nPos = nPos==1?0:1; |
|---|
| 302 | this->Show(this); |
|---|
| 303 | break; |
|---|
| 304 | |
|---|
| 305 | case VK_DN: |
|---|
| 306 | switch(nPos) |
|---|
| 307 | { |
|---|
| 308 | case 0: |
|---|
| 309 | DecreaseMinRF(); |
|---|
| 310 | break; |
|---|
| 311 | case 1: |
|---|
| 312 | DecreaseMaxRF(); |
|---|
| 313 | break; |
|---|
| 314 | default:break; |
|---|
| 315 | } |
|---|
| 316 | |
|---|
| 317 | this->Show(this); |
|---|
| 318 | break; |
|---|
| 319 | |
|---|
| 320 | case VK_UP: |
|---|
| 321 | switch(nPos) |
|---|
| 322 | { |
|---|
| 323 | case 0: |
|---|
| 324 | IncreaseMinRF(); |
|---|
| 325 | break; |
|---|
| 326 | case 1: |
|---|
| 327 | IncreaseMaxRF(); |
|---|
| 328 | break; |
|---|
| 329 | default:break; |
|---|
| 330 | } |
|---|
| 331 | |
|---|
| 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 | |
|---|