| [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; |
|---|
| 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); |
|---|
| [34] | 35 | this->rect.w = DST_GetImageWidth(pin_change_back); |
|---|
| 36 | this->rect.h = DST_GetImageHeight(pin_change_back);; |
|---|
| [18] | 37 | this->rect.x = (DST_GetScreenWidth() - this->rect.w) / 2; |
|---|
| 38 | this->rect.y = (DST_GetScreenHeight() - this->rect.h) / 2; |
|---|
| [34] | 39 | nPos = 0; |
|---|
| [18] | 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); |
|---|
| [27] | 96 | this->RegisterKey(this, VK_PWR, false, 0, 0); |
|---|
| [19] | 97 | // background |
|---|
| [34] | 98 | this->DrawImage(this, 0, 0, pin_change_back, false); |
|---|
| [18] | 99 | |
|---|
| [25] | 100 | char strText[256]; |
|---|
| 101 | |
|---|
| [37] | 102 | int nLineHeight = (this->rect.h) / 7; |
|---|
| [19] | 103 | // title |
|---|
| [34] | 104 | this->setFontStyle(this, 21, 0xFFC8C8C8, ALIGN_MIDDLE, ALIGN_CENTER); |
|---|
| [28] | 105 | this->DrawText(this, 0, 0, this->rect.w, nLineHeight*2, (char*)"Frequency Setting", &(this->font)); |
|---|
| [34] | 106 | |
|---|
| 107 | |
|---|
| [37] | 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 |
|---|
| [25] | 113 | switch(nPos) |
|---|
| [18] | 114 | { |
|---|
| [34] | 115 | |
|---|
| [25] | 116 | case 0: |
|---|
| [34] | 117 | this->setFontStyle(this, 22, 0xFFFFFFFF, ALIGN_MIDDLE, ALIGN_CENTER); |
|---|
| 118 | |
|---|
| [25] | 119 | break; |
|---|
| 120 | case 1: |
|---|
| [34] | 121 | this->setFontStyle(this, 21, 0xFFAAAAAA, ALIGN_MIDDLE, ALIGN_CENTER); |
|---|
| 122 | |
|---|
| [25] | 123 | break; |
|---|
| 124 | default:break; |
|---|
| [18] | 125 | } |
|---|
| [25] | 126 | |
|---|
| [19] | 127 | int num = DST_EEPROM_GetMinRF(); |
|---|
| [25] | 128 | |
|---|
| [19] | 129 | int rf = DST_GetFrequencyNumberbyIndex(num); |
|---|
| 130 | int freq = DST_GetMHzFrequencybyIndex(num); |
|---|
| [37] | 131 | sprintf(strText, "%d (%dMHz)", rf, freq); |
|---|
| [25] | 132 | |
|---|
| [37] | 133 | this->DrawText(this, 0, nLineHeight * 4, (this->rect.w)/2, nLineHeight, (char*)strText, &(this->font)); |
|---|
| 134 | |
|---|
| 135 | //display up /down |
|---|
| [39] | 136 | this->setFontStyle(this, 15, 0xFFC8C8C8, ALIGN_MIDDLE, ALIGN_CENTER); |
|---|
| 137 | //this->DrawText(this, 0, (nLineHeight * 3)+(nLineHeight/3), (this->rect.w)/2, nLineHeight, (char*)"^", &(this->font)); |
|---|
| 138 | DS_U16 strTextUp[2] = { 0x25B2, 0}; |
|---|
| 139 | DS_U16 strTextDn[2] = { 0x25BC, 0}; |
|---|
| 140 | this->DrawTextUni(this, 0, (nLineHeight * 3)+(nLineHeight/3), (this->rect.w)/2, nLineHeight, strTextUp, &(this->font)); |
|---|
| 141 | this->DrawTextUni(this, (this->rect.w)/2, (nLineHeight * 3)+(nLineHeight/3), (this->rect.w)/2, nLineHeight, strTextUp, &(this->font)); |
|---|
| [37] | 142 | |
|---|
| [39] | 143 | this->DrawTextUni(this, 0, (nLineHeight * 4)+(nLineHeight*2)/3, (this->rect.w)/2, nLineHeight, strTextDn, &(this->font)); |
|---|
| 144 | this->DrawTextUni(this, (this->rect.w)/2, (nLineHeight * 4)+(nLineHeight*2)/3, (this->rect.w)/2, nLineHeight, strTextDn, &(this->font)); |
|---|
| [37] | 145 | // display ~ |
|---|
| 146 | this->setFontStyle(this, 21, 0xFFC8C8C8, ALIGN_MIDDLE, ALIGN_CENTER); |
|---|
| 147 | this->DrawText(this, 0, nLineHeight * 4, this->rect.w, nLineHeight, (char*)"~", &(this->font)); |
|---|
| 148 | |
|---|
| 149 | // display max |
|---|
| [25] | 150 | switch(nPos) |
|---|
| [18] | 151 | { |
|---|
| [34] | 152 | |
|---|
| [25] | 153 | case 0: |
|---|
| [34] | 154 | this->setFontStyle(this, 21, 0xFFAAAAAA, ALIGN_MIDDLE, ALIGN_CENTER); |
|---|
| 155 | |
|---|
| [25] | 156 | break; |
|---|
| 157 | case 1: |
|---|
| [34] | 158 | this->setFontStyle(this, 22, 0xFFFFFFFF, ALIGN_MIDDLE, ALIGN_CENTER); |
|---|
| 159 | |
|---|
| [25] | 160 | break; |
|---|
| 161 | default:break; |
|---|
| [18] | 162 | } |
|---|
| [25] | 163 | |
|---|
| [19] | 164 | num = DST_EEPROM_GetMaxRF(); |
|---|
| [25] | 165 | |
|---|
| 166 | rf = DST_GetFrequencyNumberbyIndex(num); |
|---|
| 167 | freq = DST_GetMHzFrequencybyIndex(num); |
|---|
| [37] | 168 | sprintf(strText, "%d (%dMHz)", rf, freq); |
|---|
| [25] | 169 | |
|---|
| 170 | |
|---|
| [37] | 171 | this->DrawText(this, (this->rect.w)/2, nLineHeight * 4, (this->rect.w)/2, nLineHeight, (char*)strText, &(this->font)); |
|---|
| [19] | 172 | // descriptor |
|---|
| [34] | 173 | this->setFontStyle(this, 18, 0xFF666666, ALIGN_MIDDLE, ALIGN_CENTER); |
|---|
| [37] | 174 | this->DrawText(this, 0, nLineHeight * 6, this->rect.w, nLineHeight, (char*)"Left/Right : Next", &(this->font)); |
|---|
| [18] | 175 | } |
|---|
| 176 | |
|---|
| 177 | |
|---|
| 178 | // virtual void KeyInput(DS_U8 key, bool /*bRepeat*/) |
|---|
| 179 | void IncreaseMaxRF() |
|---|
| 180 | { |
|---|
| [19] | 181 | if (DST_EEPROM_GetMaxRF() >= DST_MaxRF()) |
|---|
| 182 | { |
|---|
| 183 | DST_EEPROM_SetMaxRF(DST_MaxRF()); |
|---|
| 184 | return; |
|---|
| 185 | } |
|---|
| [25] | 186 | else if (DST_EEPROM_GetMinRF() > DST_EEPROM_GetMaxRF()) |
|---|
| 187 | { |
|---|
| 188 | DST_EEPROM_SetMaxRF(DST_EEPROM_GetMinRF()); |
|---|
| 189 | return; |
|---|
| 190 | } |
|---|
| [18] | 191 | DST_EEPROM_SetMaxRF(DST_EEPROM_GetMaxRF() + 1); |
|---|
| 192 | } |
|---|
| 193 | void DecreaseMinRF() |
|---|
| 194 | { |
|---|
| [25] | 195 | if (DST_EEPROM_GetMinRF() <= DST_MinRF()) |
|---|
| [19] | 196 | { |
|---|
| [25] | 197 | DST_EEPROM_SetMinRF(DST_MinRF()); |
|---|
| [19] | 198 | return; |
|---|
| 199 | } |
|---|
| [25] | 200 | else if (DST_EEPROM_GetMinRF() > DST_EEPROM_GetMaxRF()) |
|---|
| 201 | { |
|---|
| 202 | DST_EEPROM_SetMinRF(DST_EEPROM_GetMaxRF()); |
|---|
| 203 | return; |
|---|
| 204 | } |
|---|
| [18] | 205 | DST_EEPROM_SetMinRF(DST_EEPROM_GetMinRF() - 1); |
|---|
| 206 | } |
|---|
| 207 | void IncreaseMinRF() |
|---|
| 208 | { |
|---|
| [25] | 209 | if (DST_EEPROM_GetMinRF() >= DST_MaxRF()) |
|---|
| [18] | 210 | { |
|---|
| [25] | 211 | DST_EEPROM_SetMinRF(DST_MaxRF()); |
|---|
| [19] | 212 | return; |
|---|
| [18] | 213 | } |
|---|
| [25] | 214 | else if (DST_EEPROM_GetMinRF() >= DST_EEPROM_GetMaxRF()) |
|---|
| 215 | { |
|---|
| 216 | DST_EEPROM_SetMinRF(DST_EEPROM_GetMaxRF()); |
|---|
| 217 | return; |
|---|
| 218 | } |
|---|
| 219 | |
|---|
| [19] | 220 | DST_EEPROM_SetMinRF(DST_EEPROM_GetMinRF() + 1); |
|---|
| [18] | 221 | } |
|---|
| 222 | void DecreaseMaxRF() |
|---|
| 223 | { |
|---|
| [25] | 224 | if (DST_EEPROM_GetMaxRF() <= DST_MinRF()) |
|---|
| [18] | 225 | { |
|---|
| [25] | 226 | DST_EEPROM_SetMaxRF(DST_MinRF()); |
|---|
| [19] | 227 | return; |
|---|
| [18] | 228 | } |
|---|
| [25] | 229 | else if (DST_EEPROM_GetMinRF() >= DST_EEPROM_GetMaxRF()) |
|---|
| 230 | { |
|---|
| 231 | DST_EEPROM_SetMaxRF(DST_EEPROM_GetMinRF()); |
|---|
| 232 | return; |
|---|
| 233 | } |
|---|
| 234 | |
|---|
| [19] | 235 | DST_EEPROM_SetMaxRF(DST_EEPROM_GetMaxRF() - 1); |
|---|
| [18] | 236 | } |
|---|
| 237 | void CFrequncySettingWin_KeyInput(CWindow *this, DS_U8 key, bool bRepeat) |
|---|
| 238 | { |
|---|
| 239 | int i = 0; |
|---|
| [34] | 240 | |
|---|
| [18] | 241 | switch(key) |
|---|
| 242 | { |
|---|
| [34] | 243 | case VK_VOL_UP: |
|---|
| 244 | case VK_CH_UP: |
|---|
| 245 | |
|---|
| [25] | 246 | switch(nPos) |
|---|
| [18] | 247 | { |
|---|
| [34] | 248 | |
|---|
| [25] | 249 | case 0: |
|---|
| [34] | 250 | |
|---|
| [25] | 251 | for (i=0; i < 10; i++) IncreaseMinRF(); |
|---|
| [34] | 252 | |
|---|
| [25] | 253 | break; |
|---|
| [34] | 254 | case 1: |
|---|
| 255 | |
|---|
| [25] | 256 | for (i=0; i < 10; i++) IncreaseMaxRF(); |
|---|
| [34] | 257 | |
|---|
| [25] | 258 | break; |
|---|
| 259 | default:break; |
|---|
| [18] | 260 | } |
|---|
| [25] | 261 | |
|---|
| [18] | 262 | this->Show(this); |
|---|
| 263 | break; |
|---|
| 264 | |
|---|
| [34] | 265 | case VK_VOL_DN: |
|---|
| 266 | case VK_CH_DN: |
|---|
| 267 | |
|---|
| [25] | 268 | switch(nPos) |
|---|
| [18] | 269 | { |
|---|
| [34] | 270 | |
|---|
| [25] | 271 | case 0: |
|---|
| [34] | 272 | |
|---|
| [25] | 273 | for (i=0; i < 10; i++) DecreaseMinRF(); |
|---|
| [34] | 274 | |
|---|
| [25] | 275 | break; |
|---|
| [34] | 276 | case 1: |
|---|
| 277 | |
|---|
| [25] | 278 | for (i=0; i < 10; i++) DecreaseMaxRF(); |
|---|
| [34] | 279 | |
|---|
| [25] | 280 | break; |
|---|
| 281 | default:break; |
|---|
| [18] | 282 | } |
|---|
| [25] | 283 | |
|---|
| [18] | 284 | this->Show(this); |
|---|
| 285 | break; |
|---|
| 286 | |
|---|
| [37] | 287 | case VK_LEFT: |
|---|
| 288 | case VK_RIGHT: |
|---|
| [34] | 289 | nPos = nPos==1?0:1; |
|---|
| [18] | 290 | this->Show(this); |
|---|
| 291 | break; |
|---|
| 292 | |
|---|
| [37] | 293 | case VK_DN: |
|---|
| [25] | 294 | switch(nPos) |
|---|
| [18] | 295 | { |
|---|
| [25] | 296 | case 0: |
|---|
| [34] | 297 | DecreaseMinRF(); |
|---|
| [25] | 298 | break; |
|---|
| 299 | case 1: |
|---|
| [34] | 300 | DecreaseMaxRF(); |
|---|
| [25] | 301 | break; |
|---|
| 302 | default:break; |
|---|
| [18] | 303 | } |
|---|
| [25] | 304 | |
|---|
| [18] | 305 | this->Show(this); |
|---|
| 306 | break; |
|---|
| 307 | |
|---|
| [37] | 308 | case VK_UP: |
|---|
| [25] | 309 | switch(nPos) |
|---|
| [18] | 310 | { |
|---|
| [25] | 311 | case 0: |
|---|
| [34] | 312 | IncreaseMinRF(); |
|---|
| [25] | 313 | break; |
|---|
| 314 | case 1: |
|---|
| [34] | 315 | IncreaseMaxRF(); |
|---|
| [25] | 316 | break; |
|---|
| 317 | default:break; |
|---|
| [18] | 318 | } |
|---|
| [25] | 319 | |
|---|
| [18] | 320 | this->Show(this); |
|---|
| 321 | break; |
|---|
| 322 | |
|---|
| 323 | default: |
|---|
| 324 | this->Close(this); |
|---|
| 325 | break; |
|---|
| 326 | } |
|---|
| 327 | } |
|---|
| 328 | |
|---|
| 329 | //}; |
|---|
| 330 | |
|---|
| 331 | void DST_CreateFrequencySettingWin(SWinEventMsg event) |
|---|
| 332 | { |
|---|
| 333 | DST_RemoveAllWindowExceptBasicWin(); |
|---|
| 334 | CWindow*pWin = NewCWindow(event); |
|---|
| 335 | pWin->Destructor = CFrequncySettingWin_Destructor; |
|---|
| 336 | pWin->KeyInput = CFrequncySettingWin_KeyInput; |
|---|
| 337 | pWin->OnTimer = CFrequncySettingWin_OnTimer; |
|---|
| 338 | pWin->ShowWindow = CFrequncySettingWin_ShowWindow; |
|---|
| 339 | pWin->Show = CFrequncySettingWin_Show; |
|---|
| 340 | // »ý¼ºÀÚ È£Ãâ |
|---|
| 341 | CFrequncySettingWin_Constructor(pWin, event); |
|---|
| 342 | // À©µµ¿ì ¸Þ´ÏÀú¿¡ µî·Ï |
|---|
| 343 | DST_AddWin((WinID)(event.data[0]), pWin); |
|---|
| 344 | } |
|---|
| 345 | |
|---|
| 346 | |
|---|