| 1 | #include "DST_WinManager.h" |
|---|
| 2 | #include "DST_DataStrings.h" |
|---|
| 3 | #include "DST_OSDImage.h" |
|---|
| 4 | #include "DST_EEPROM.h" |
|---|
| 5 | #include "DST_ChannelTune.h" |
|---|
| 6 | #include "DST_UserInterface.h" |
|---|
| 7 | #include "DST_DB.h" |
|---|
| 8 | |
|---|
| 9 | |
|---|
| 10 | #if 0 |
|---|
| 11 | ____CMessageWin___() |
|---|
| 12 | #endif |
|---|
| 13 | |
|---|
| 14 | |
|---|
| 15 | //class CFactoryResetWin : public CWindow |
|---|
| 16 | //{ |
|---|
| 17 | //private: |
|---|
| 18 | static DS_U8 CFactoryResetWin_winParentID; |
|---|
| 19 | static DS_U8 CFactoryResetWin_msg; |
|---|
| 20 | //public: |
|---|
| 21 | // CFactoryResetWin(SWinEventMsg event):CWindow(event) |
|---|
| 22 | void CFactoryResetWin_Constructor(CWindow *this, SWinEventMsg event) |
|---|
| 23 | { |
|---|
| 24 | this->SetWinName(this, "FactoryReset"); |
|---|
| 25 | this->rect.w = DST_GetImageWidth(pin_change_back); |
|---|
| 26 | this->rect.h = DST_GetImageHeight(pin_change_back); |
|---|
| 27 | this->rect.x = (DST_GetScreenWidth() - this->rect.w) / 2; |
|---|
| 28 | this->rect.y = (DST_GetScreenHeight()- this->rect.h) / 2; |
|---|
| 29 | this->RegisterAllKey(this); |
|---|
| 30 | this->SetTimeOut(this, 0); |
|---|
| 31 | |
|---|
| 32 | CFactoryResetWin_winParentID = event.data[1]; |
|---|
| 33 | CFactoryResetWin_msg = event.data[2]; |
|---|
| 34 | DST_Printf("winParentID : %d , msg : %d\n",CFactoryResetWin_winParentID,CFactoryResetWin_msg); |
|---|
| 35 | DST_EEPROM_SetNeedReset(1); |
|---|
| 36 | DST_DB_Sync(); |
|---|
| 37 | |
|---|
| 38 | } |
|---|
| 39 | |
|---|
| 40 | void CFactoryResetWin_Destructor(CWindow *this) |
|---|
| 41 | { |
|---|
| 42 | DST_Reset(__func__); // âÀÌ ´ÝÈ÷¸é¼ ÀçºÎÆÃ |
|---|
| 43 | } |
|---|
| 44 | |
|---|
| 45 | // virtual void OnTimer(char) |
|---|
| 46 | void CFactoryResetWin_OnTimer(CWindow *this, char nID) |
|---|
| 47 | { |
|---|
| 48 | this->Show(this); |
|---|
| 49 | } |
|---|
| 50 | |
|---|
| 51 | // virtual void OnMessage(SWinEventMsg event) |
|---|
| 52 | void CFactoryResetWin_OnMessage(CWindow *this, SWinEventMsg event) |
|---|
| 53 | { |
|---|
| 54 | switch (event.cmd) |
|---|
| 55 | { |
|---|
| 56 | case WM_POWER_OFF: |
|---|
| 57 | this->Close(this); |
|---|
| 58 | break; |
|---|
| 59 | default: break; |
|---|
| 60 | } |
|---|
| 61 | } |
|---|
| 62 | |
|---|
| 63 | // virtual void Show(void) |
|---|
| 64 | void CFactoryResetWin_Show(CWindow *this) |
|---|
| 65 | { |
|---|
| 66 | this->DrawImage(this, 0, 0, pin_change_back, false); |
|---|
| 67 | this->setFontStyle(this, 22,0xFFFFFFFF,ALIGN_MIDDLE,ALIGN_CENTER); |
|---|
| 68 | |
|---|
| 69 | if (DST_DB_IsSync()) |
|---|
| 70 | { |
|---|
| 71 | this->KillTimer(this, 1); |
|---|
| 72 | this->SetTimeOut(this, 1); // ½ÌÅ©°¡ ³¡³ª¸é ŸÀӾƿôÀ» 1ÃÊ·Î º¯°æ |
|---|
| 73 | this->DrawTextUni(this, 0, 0, this->rect.w, this->rect.h, pz_sysreset[OSD_Lang], &(this->font)); |
|---|
| 74 | } |
|---|
| 75 | else |
|---|
| 76 | { |
|---|
| 77 | this->DrawTextUni(this, 0, 0, this->rect.w, this->rect.h, pz_OTC_Download2[OSD_Lang], &(this->font)); |
|---|
| 78 | this->SetTimer(this, 1, 1000); |
|---|
| 79 | } |
|---|
| 80 | this->UpdateScreen(this); |
|---|
| 81 | } |
|---|
| 82 | //}; |
|---|
| 83 | |
|---|
| 84 | |
|---|
| 85 | //class CFactoryResetAskWin : public CWindow |
|---|
| 86 | //{ |
|---|
| 87 | //private: |
|---|
| 88 | |
|---|
| 89 | static DS_U16 CFactoryResetAskWin_g_nPos; |
|---|
| 90 | static DS_U16 CFactoryResetAskWin_g_nTop; |
|---|
| 91 | static DS_U16 CFactoryResetAskWin_select; |
|---|
| 92 | static DS_U16 CFactoryResetAskWin_itemNum; |
|---|
| 93 | static bool CFactoryResetAskWin_bExitKeyPressed; |
|---|
| 94 | static bool CFactoryResetAskWin_bVolumeKeyPressed; |
|---|
| 95 | static DS_U8 CFactoryResetAskWin_winParentID; |
|---|
| 96 | static DS_U8 CFactoryResetAskWin_msg; |
|---|
| 97 | //public: |
|---|
| 98 | void CFactoryResetAskWin_setSize(CWindow *this); |
|---|
| 99 | |
|---|
| 100 | // CFactoryResetAskWin(SWinEventMsg event):CWindow(event) |
|---|
| 101 | void CFactoryResetAskWin_Constructor(CWindow *this, SWinEventMsg event) |
|---|
| 102 | { |
|---|
| 103 | this->SetWinName(this, "FacResetAsk"); |
|---|
| 104 | CFactoryResetAskWin_setSize(this); |
|---|
| 105 | CFactoryResetAskWin_bExitKeyPressed = false; |
|---|
| 106 | CFactoryResetAskWin_bVolumeKeyPressed = false; |
|---|
| 107 | CFactoryResetAskWin_g_nTop = 0; |
|---|
| 108 | CFactoryResetAskWin_g_nPos = 0; |
|---|
| 109 | CFactoryResetAskWin_select = 1; |
|---|
| 110 | CFactoryResetAskWin_itemNum = 2; |
|---|
| 111 | |
|---|
| 112 | CFactoryResetAskWin_winParentID = event.data[1]; |
|---|
| 113 | CFactoryResetAskWin_msg = event.data[2]; |
|---|
| 114 | this->SetTimeOut(this, 100); |
|---|
| 115 | } |
|---|
| 116 | |
|---|
| 117 | void CFactoryResetAskWin_Destructor(CWindow *this) |
|---|
| 118 | { |
|---|
| 119 | |
|---|
| 120 | } |
|---|
| 121 | |
|---|
| 122 | void CFactoryResetAskWin_setSize(CWindow *this) |
|---|
| 123 | { |
|---|
| 124 | this->rect.w = DST_GetImageWidth(pin_change_back); |
|---|
| 125 | this->rect.h = DST_GetImageHeight(pin_change_back); |
|---|
| 126 | this->rect.x = (DST_GetScreenWidth() - this->rect.w)/2; |
|---|
| 127 | this->rect.y = (DST_GetScreenHeight() - this->rect.h)/2; |
|---|
| 128 | } |
|---|
| 129 | |
|---|
| 130 | // virtual void Focus(bool bVal) |
|---|
| 131 | void CFactoryResetAskWin_Focus(CWindow *this, bool bVal) |
|---|
| 132 | { |
|---|
| 133 | this->RegisterKey(this, VK_CANCEL, bVal, 0, 0); |
|---|
| 134 | this->RegisterKey(this, VK_MENU, bVal, 0, 0); |
|---|
| 135 | this->RegisterKey(this, VK_OK, bVal, 0, 0); |
|---|
| 136 | this->RegisterKey(this, VK_RIGHT, bVal, 0, 0); |
|---|
| 137 | this->RegisterKey(this, VK_LEFT, bVal, 0, 0); |
|---|
| 138 | this->RegisterKey(this, VK_UP, bVal, 0, 0); |
|---|
| 139 | this->RegisterKey(this, VK_DN, bVal, 0, 0); |
|---|
| 140 | this->RegisterKey(this, VK_PREV, bVal, 0, 0); |
|---|
| 141 | this->RegisterKey(this, VK_PREV_CH, bVal, 0, 0); |
|---|
| 142 | this->RegisterKey(this, VK_PREV_MENU, true, 0, 0); |
|---|
| 143 | } |
|---|
| 144 | |
|---|
| 145 | // virtual void Show(WinID id) |
|---|
| 146 | void CFactoryResetAskWin_ShowWindow(CWindow *this, WinID id) |
|---|
| 147 | { |
|---|
| 148 | switch(id) |
|---|
| 149 | { |
|---|
| 150 | case WIN_DEBUG_SQL: |
|---|
| 151 | case WIN_DEBUG_SQL_SUB: |
|---|
| 152 | case WIN_ENGINEER_MODE: |
|---|
| 153 | case WIN_VOLUME: |
|---|
| 154 | case WIN_VOLUME_MUTE: |
|---|
| 155 | CFactoryResetAskWin_bVolumeKeyPressed = true; |
|---|
| 156 | this->Close(this); |
|---|
| 157 | break; |
|---|
| 158 | default: |
|---|
| 159 | break; |
|---|
| 160 | } |
|---|
| 161 | } |
|---|
| 162 | |
|---|
| 163 | DS_U16* CFactoryResetAskWin_GetString(int index) |
|---|
| 164 | { |
|---|
| 165 | switch(index) |
|---|
| 166 | { |
|---|
| 167 | case 0: return pz_ZAS_Confirm[OSD_Lang]; |
|---|
| 168 | case 1: return pz_ZAS_Cancel[OSD_Lang]; |
|---|
| 169 | default: break; |
|---|
| 170 | } |
|---|
| 171 | return 0; |
|---|
| 172 | } |
|---|
| 173 | |
|---|
| 174 | void CFactoryResetAskWin_Draw(CWindow *this) |
|---|
| 175 | { |
|---|
| 176 | int center_pos = 0; |
|---|
| 177 | int line_spacing = 0; |
|---|
| 178 | int i = 0; |
|---|
| 179 | |
|---|
| 180 | this->DrawImage(this, 0,0,pin_change_back,true); |
|---|
| 181 | this->setFontStyle(this, 22,0xFFFFFFFF,ALIGN_MIDDLE,ALIGN_CENTER); |
|---|
| 182 | |
|---|
| 183 | center_pos = DST_GetImageHeight(pin_change_back) / 2; |
|---|
| 184 | line_spacing = DST_GetFontHeight(this->FontGetSize(this)) * 125 / 100; |
|---|
| 185 | |
|---|
| 186 | this->DrawTextUni(this, 0, center_pos-line_spacing/2-line_spacing-line_spacing/2, this->rect.w, line_spacing, pz_Sub_FactoryResetAsk_E1[OSD_Lang], &(this->font)); |
|---|
| 187 | this->DrawTextUni(this, 0, center_pos-line_spacing/2-line_spacing/2, this->rect.w, line_spacing, pz_Sub_FactoryResetAsk_E2[OSD_Lang], &(this->font)); |
|---|
| 188 | |
|---|
| 189 | this->DrawImage(this, 65, 151, Button_d, true); |
|---|
| 190 | this->DrawImage(this, 207, 151, Button_d, true); |
|---|
| 191 | if(CFactoryResetAskWin_select == 0) |
|---|
| 192 | this->DrawImage(this, 65, 151, Button_h, true); |
|---|
| 193 | else |
|---|
| 194 | this->DrawImage(this, 207, 151, Button_h, true); |
|---|
| 195 | |
|---|
| 196 | for( i=0;i<CFactoryResetAskWin_itemNum;i++) |
|---|
| 197 | { |
|---|
| 198 | if(CFactoryResetAskWin_select==i) |
|---|
| 199 | this->setFontStyle(this,20,0xFFFFFFFF,ALIGN_MIDDLE,ALIGN_CENTER); |
|---|
| 200 | else |
|---|
| 201 | this->setFontStyle(this,20,0xFF494949,ALIGN_MIDDLE,ALIGN_CENTER); |
|---|
| 202 | this->DrawTextUni(this, 65+i*142, 151, DST_GetImageWidth(Button_d), DST_GetImageHeight(Button_d), CFactoryResetAskWin_GetString(i), &(this->font)); |
|---|
| 203 | } |
|---|
| 204 | } |
|---|
| 205 | |
|---|
| 206 | // virtual void Show(void) |
|---|
| 207 | void CFactoryResetAskWin_Show(CWindow *this) |
|---|
| 208 | { |
|---|
| 209 | CFactoryResetAskWin_Draw(this); |
|---|
| 210 | this->DoFocus(this, true); |
|---|
| 211 | } |
|---|
| 212 | |
|---|
| 213 | // virtual void OnMessage(SWinEventMsg event) |
|---|
| 214 | void CFactoryResetAskWin_OnMessage(CWindow *this, SWinEventMsg event) |
|---|
| 215 | { |
|---|
| 216 | switch (event.cmd) |
|---|
| 217 | { |
|---|
| 218 | case WM_POWER_OFF: |
|---|
| 219 | this->Close(this); |
|---|
| 220 | break; |
|---|
| 221 | default: break; |
|---|
| 222 | } |
|---|
| 223 | } |
|---|
| 224 | |
|---|
| 225 | |
|---|
| 226 | // virtual void KeyInput(DS_U8 key, bool /*bRepeat*/) |
|---|
| 227 | void CFactoryResetAskWin_KeyInput(CWindow *this, DS_U8 key, bool bRepeat) |
|---|
| 228 | { |
|---|
| 229 | switch (key) |
|---|
| 230 | { |
|---|
| 231 | case VK_RIGHT: |
|---|
| 232 | case VK_LEFT: |
|---|
| 233 | if(key == VK_RIGHT) |
|---|
| 234 | ItemIncrease(CFactoryResetAskWin_itemNum, 2, &CFactoryResetAskWin_g_nTop, &CFactoryResetAskWin_select, &CFactoryResetAskWin_g_nPos, 1); |
|---|
| 235 | else |
|---|
| 236 | ItemDecrease(CFactoryResetAskWin_itemNum, 2, &CFactoryResetAskWin_g_nTop, &CFactoryResetAskWin_select, &CFactoryResetAskWin_g_nPos, 1); |
|---|
| 237 | CFactoryResetAskWin_Draw(this); |
|---|
| 238 | break; |
|---|
| 239 | case VK_OK: |
|---|
| 240 | if(CFactoryResetAskWin_select == 0) |
|---|
| 241 | { |
|---|
| 242 | // DST_RemoveAllWindowExceptBasicWin(); |
|---|
| 243 | DST_CreateWin(WIN_FACTORY_RESET, (WinID)CFactoryResetAskWin_winParentID, CFactoryResetAskWin_msg, 0, 0, 0); |
|---|
| 244 | } |
|---|
| 245 | else |
|---|
| 246 | { |
|---|
| 247 | DST_CreateWin((WinID)CFactoryResetAskWin_winParentID, 0, 0, 0, 0, 0); |
|---|
| 248 | } |
|---|
| 249 | this->Close(this); |
|---|
| 250 | break; |
|---|
| 251 | case VK_MENU: |
|---|
| 252 | case VK_CANCEL: |
|---|
| 253 | case VK_PREV_MENU: |
|---|
| 254 | this->Close(this); |
|---|
| 255 | break; |
|---|
| 256 | case VK_PREV: |
|---|
| 257 | case VK_PREV_CH: |
|---|
| 258 | DST_CreateWin((WinID)CFactoryResetAskWin_winParentID, 0, 0, 0, 0, 0); |
|---|
| 259 | this->Close(this); |
|---|
| 260 | break; |
|---|
| 261 | default: |
|---|
| 262 | break; |
|---|
| 263 | } |
|---|
| 264 | } |
|---|
| 265 | |
|---|
| 266 | //}; |
|---|
| 267 | |
|---|
| 268 | void DST_CreateFactoryResetWin(SWinEventMsg event) |
|---|
| 269 | { |
|---|
| 270 | CWindow*pWin = NewCWindow(event); |
|---|
| 271 | pWin->Destructor = CFactoryResetWin_Destructor; |
|---|
| 272 | pWin->OnTimer = CFactoryResetWin_OnTimer; |
|---|
| 273 | pWin->OnMessage = CFactoryResetWin_OnMessage; |
|---|
| 274 | pWin->Show = CFactoryResetWin_Show; |
|---|
| 275 | // »ý¼ºÀÚ È£Ãâ |
|---|
| 276 | CFactoryResetWin_Constructor(pWin, event); |
|---|
| 277 | // À©µµ¿ì ¸Þ´ÏÀú¿¡ µî·Ï |
|---|
| 278 | DST_AddWin((WinID)(event.data[0]), pWin); |
|---|
| 279 | } |
|---|
| 280 | |
|---|
| 281 | void DST_CreateFactoryResetAskWin(SWinEventMsg event) |
|---|
| 282 | { |
|---|
| 283 | CWindow*pWin = NewCWindow(event); |
|---|
| 284 | pWin->Destructor = CFactoryResetAskWin_Destructor; |
|---|
| 285 | pWin->KeyInput = CFactoryResetAskWin_KeyInput; |
|---|
| 286 | pWin->OnMessage = CFactoryResetAskWin_OnMessage; |
|---|
| 287 | pWin->ShowWindow = CFactoryResetAskWin_ShowWindow; |
|---|
| 288 | pWin->Show = CFactoryResetAskWin_Show; |
|---|
| 289 | pWin->Focus = CFactoryResetAskWin_Focus; |
|---|
| 290 | // »ý¼ºÀÚ È£Ãâ |
|---|
| 291 | CFactoryResetAskWin_Constructor(pWin, event); |
|---|
| 292 | // À©µµ¿ì ¸Þ´ÏÀú¿¡ µî·Ï |
|---|
| 293 | DST_AddWin((WinID)(event.data[0]), pWin); |
|---|
| 294 | } |
|---|