| 1 | #include "DST_WinManager.h" |
|---|
| 2 | #include "DST_OSDImage.h" |
|---|
| 3 | #include "DST_UserInterface.h" |
|---|
| 4 | #include "DST_DataStrings.h" |
|---|
| 5 | |
|---|
| 6 | #if 0 |
|---|
| 7 | ____CMovingBannerWin___() |
|---|
| 8 | #endif |
|---|
| 9 | |
|---|
| 10 | |
|---|
| 11 | //class CErrorWin : public CWindow |
|---|
| 12 | //{ |
|---|
| 13 | //private: |
|---|
| 14 | static DS_U8 CErrorWin_nErrorNumber; |
|---|
| 15 | static DS_U8 CErrorWin_nParameter; |
|---|
| 16 | static int CErrorWin_nWidth; |
|---|
| 17 | //public: |
|---|
| 18 | void CErrorWin_GetPos(CWindow *this); |
|---|
| 19 | |
|---|
| 20 | // CErrorWin(SWinEventMsg event):CWindow(event) |
|---|
| 21 | void CErrorWin_Constructor(CWindow *this, SWinEventMsg event) |
|---|
| 22 | { |
|---|
| 23 | this->SetWinName(this, "Error"); |
|---|
| 24 | CErrorWin_nErrorNumber = event.data[2]; |
|---|
| 25 | CErrorWin_nParameter = event.data[3]; |
|---|
| 26 | CErrorWin_nWidth = 0; |
|---|
| 27 | switch(CErrorWin_nErrorNumber) |
|---|
| 28 | { |
|---|
| 29 | case SM_AUDIO_ONLY: |
|---|
| 30 | this->rect.w = DST_GetImageWidth(imgaudio); |
|---|
| 31 | this->rect.h = DST_GetImageHeight(imgaudio); |
|---|
| 32 | this->rect.x = (DST_GetScreenWidth() - this->rect.w) / 2; |
|---|
| 33 | this->rect.y = (DST_GetScreenHeight() - this->rect.h) / 2; |
|---|
| 34 | DST_CreateWin(WIN_CHANNEL_BANNER, WIN_NULL, BANNER_NORMAL ,0, 0, 0); |
|---|
| 35 | break; |
|---|
| 36 | |
|---|
| 37 | case SM_NO_PROGRAM: |
|---|
| 38 | { |
|---|
| 39 | CErrorWin_nWidth = DST_GetTextWidthUni(pz_NoProgram[OSD_Lang],30); |
|---|
| 40 | this->rect.w = 9+DST_GetImageWidth(bracon_gui_caution)+10+CErrorWin_nWidth+10; |
|---|
| 41 | this->rect.h = 92; |
|---|
| 42 | CErrorWin_GetPos(this); |
|---|
| 43 | } |
|---|
| 44 | break; |
|---|
| 45 | case SM_WEAK_SIGNAL: |
|---|
| 46 | this->rect.w = DST_GetImageWidth(pin_change_back); |
|---|
| 47 | this->rect.h = DST_GetImageHeight(pin_change_back); |
|---|
| 48 | this->rect.x = (DST_GetScreenWidth() - this->rect.w) / 2; |
|---|
| 49 | this->rect.y = (DST_GetScreenHeight() - this->rect.h) / 2; |
|---|
| 50 | break; |
|---|
| 51 | |
|---|
| 52 | default: break; |
|---|
| 53 | } |
|---|
| 54 | |
|---|
| 55 | this->SetTimeOut(this, 0); |
|---|
| 56 | } |
|---|
| 57 | |
|---|
| 58 | void CErrorWin_Destructor(CWindow *this) |
|---|
| 59 | { |
|---|
| 60 | } |
|---|
| 61 | |
|---|
| 62 | void CErrorWin_GetPos(CWindow *this) |
|---|
| 63 | { |
|---|
| 64 | static DS_U8 nPos = 0; |
|---|
| 65 | int x = 0, y = 0; |
|---|
| 66 | int sw = DST_GetScreenWidth(); |
|---|
| 67 | int sh = DST_GetScreenHeight(); |
|---|
| 68 | int iw = this->rect.w; |
|---|
| 69 | int ih = this->rect.h; |
|---|
| 70 | int min_x = 0; |
|---|
| 71 | int min_y = 0; |
|---|
| 72 | int max_x = 0; |
|---|
| 73 | int max_y = 0; |
|---|
| 74 | switch (nPos) |
|---|
| 75 | { |
|---|
| 76 | case 0: x = sw*2/4; y = sh*2/4; break; |
|---|
| 77 | case 1: x = sw*1/4; y = sh*1/4; break; |
|---|
| 78 | case 2: x = sw*3/4; y = sh*1/4; break; |
|---|
| 79 | case 3: x = sw*1/4; y = sh*3/4; break; |
|---|
| 80 | case 4: x = sw*3/4; y = sh*3/4; break; |
|---|
| 81 | } |
|---|
| 82 | x-=(iw / 2); |
|---|
| 83 | y-=(ih / 2); |
|---|
| 84 | min_x = sw/10; |
|---|
| 85 | min_y = sh/10; |
|---|
| 86 | max_x = (sw*9/10) - iw; |
|---|
| 87 | max_y = (sh*9/10) - ih; |
|---|
| 88 | if (x < min_x) x = min_x; |
|---|
| 89 | if (y < min_y) y = min_y; |
|---|
| 90 | if (x > max_x) x = max_x; |
|---|
| 91 | if (y > max_y) y = max_y; |
|---|
| 92 | nPos = (nPos >= 4) ? 0 : nPos + 1; |
|---|
| 93 | this->rect.x=x; this->rect.y=y; |
|---|
| 94 | } |
|---|
| 95 | |
|---|
| 96 | |
|---|
| 97 | // virtual void Show() |
|---|
| 98 | void CErrorWin_Show(CWindow *this) |
|---|
| 99 | { |
|---|
| 100 | |
|---|
| 101 | this->setFontStyle(this, 25,0xFF000000,ALIGN_MIDDLE,ALIGN_CENTER); |
|---|
| 102 | // ¹è°æ |
|---|
| 103 | switch (CErrorWin_nErrorNumber) |
|---|
| 104 | { |
|---|
| 105 | case SM_AUDIO_ONLY: |
|---|
| 106 | this->DrawImage(this, 0, 0, imgaudio, false); |
|---|
| 107 | break; |
|---|
| 108 | case SM_NO_PROGRAM: |
|---|
| 109 | this->DrawBox32(this, 0, 0, this->rect.w, this->rect.h, CONV32_16(0x00FFFFFF)); |
|---|
| 110 | this->DrawImage(this, 9, 9, bracon_gui_caution,true); |
|---|
| 111 | this->DrawTextUni(this, 11+DST_GetImageWidth(bracon_gui_caution)+10, 2, CErrorWin_nWidth, this->rect.h-2, pz_NoProgram[OSD_Lang], &(this->font)); |
|---|
| 112 | this->setFontStyle(this, 25,0xFFC8C8C8,ALIGN_MIDDLE,ALIGN_CENTER); |
|---|
| 113 | this->DrawTextUni(this, 9+DST_GetImageWidth(bracon_gui_caution)+10, 0, CErrorWin_nWidth, this->rect.h-2, pz_NoProgram[OSD_Lang], &(this->font)); |
|---|
| 114 | this->SetTimer(this, 1, 1000); |
|---|
| 115 | break; |
|---|
| 116 | case SM_WEAK_SIGNAL: |
|---|
| 117 | this->DrawImage(this, 0, 0, pin_change_back, false); |
|---|
| 118 | this->setFontStyle(this, 21, 0xFFC8C8C8, ALIGN_MIDDLE, ALIGN_CENTER); |
|---|
| 119 | this->RegisterKey(this, VK_OK, true, 0, 0); |
|---|
| 120 | int center_pos = this->rect.h / 2; |
|---|
| 121 | int line_spacing = DST_GetFontHeight(this->FontGetSize(this)) * 150 / 100; |
|---|
| 122 | |
|---|
| 123 | this->DrawTextUni(this, 0, center_pos-2*line_spacing, this->rect.w, line_spacing, pz_WeakSignal1[OSD_Lang], &(this->font)); |
|---|
| 124 | this->DrawTextUni(this, 0, center_pos-line_spacing, this->rect.w, line_spacing, pz_WeakSignal2[OSD_Lang], &(this->font)); |
|---|
| 125 | this->DrawTextUni(this, 0, center_pos, this->rect.w, line_spacing, pz_WeakSignal3[OSD_Lang], &(this->font)); |
|---|
| 126 | this->DrawTextUni(this, 0, center_pos+line_spacing, this->rect.w, line_spacing, pz_WeakSignal4[OSD_Lang], &(this->font)); |
|---|
| 127 | break; |
|---|
| 128 | default: break; |
|---|
| 129 | |
|---|
| 130 | } |
|---|
| 131 | |
|---|
| 132 | |
|---|
| 133 | |
|---|
| 134 | } |
|---|
| 135 | |
|---|
| 136 | // virtual void OnMessage(SWinEventMsg event) |
|---|
| 137 | void CErrorWin_OnMessage(CWindow *this, SWinEventMsg event) |
|---|
| 138 | { |
|---|
| 139 | switch (event.cmd) |
|---|
| 140 | { |
|---|
| 141 | case WM_POWER_OFF: |
|---|
| 142 | this->Close(this); |
|---|
| 143 | break; |
|---|
| 144 | default: break; |
|---|
| 145 | } |
|---|
| 146 | } |
|---|
| 147 | |
|---|
| 148 | // virtual void OnTimer(char /*nID*/) |
|---|
| 149 | void CErrorWin_OnTimer(CWindow *this, char nID) |
|---|
| 150 | { |
|---|
| 151 | this->UpdateScreen(this); |
|---|
| 152 | CErrorWin_GetPos(this); |
|---|
| 153 | this->UpdateScreen(this); |
|---|
| 154 | } |
|---|
| 155 | |
|---|
| 156 | // virtual void Show(WinID id) |
|---|
| 157 | void CErrorWin_ShowWindow(CWindow *this, WinID id) |
|---|
| 158 | { |
|---|
| 159 | if(CErrorWin_nErrorNumber == SM_AUDIO_ONLY) return; |
|---|
| 160 | switch(id) |
|---|
| 161 | { |
|---|
| 162 | case WIN_DEBUG_SQL: |
|---|
| 163 | case WIN_DEBUG_SQL_SUB: |
|---|
| 164 | case WIN_ENGINEER_MODE: |
|---|
| 165 | case WIN_EWS: |
|---|
| 166 | case WIN_CHANNEL_BANNER: |
|---|
| 167 | case WIN_DIRECT_TUNE: |
|---|
| 168 | // case WIN_VOLUME: |
|---|
| 169 | // case WIN_VOLUME_MUTE: |
|---|
| 170 | case WIN_SIGNAL_METER: |
|---|
| 171 | // case WIN_CLOSED_CAPTION_HOT: |
|---|
| 172 | case WIN_AUDIO_HOT: |
|---|
| 173 | case WIN_DISPLAY_MODE_HOT: |
|---|
| 174 | case WIN_FACTORY_RESET: |
|---|
| 175 | case WIN_FACTORY_RESET_ASK: |
|---|
| 176 | case WIN_MAIN_MENU: |
|---|
| 177 | case WIN_POWER_DOWN_CAUTION: |
|---|
| 178 | case WIN_SUB_MENU_2DEPTH: |
|---|
| 179 | case WIN_SUB_MENU_3DEPTH: |
|---|
| 180 | case WIN_SUB_MENU_4DEPTH: |
|---|
| 181 | case WIN_AUTO_SEARCH: |
|---|
| 182 | case WIN_MANUAL_SEARCH: |
|---|
| 183 | case WIN_CHANNEL_LIST: |
|---|
| 184 | case WIN_PROGRAM_GUIDE: |
|---|
| 185 | case WIN_STATION_SEARCH: |
|---|
| 186 | case WIN_PASSWD_CHANGE: |
|---|
| 187 | if (CErrorWin_nErrorNumber == SM_WEAK_SIGNAL && id == WIN_CHANNEL_BANNER) |
|---|
| 188 | { |
|---|
| 189 | break; |
|---|
| 190 | } |
|---|
| 191 | else |
|---|
| 192 | { |
|---|
| 193 | this->Close(this); |
|---|
| 194 | break; |
|---|
| 195 | } |
|---|
| 196 | case WIN_PASSWD_CHECK: |
|---|
| 197 | case WIN_PASSWD_CONFIRM: |
|---|
| 198 | this->SetVisible(this, false); |
|---|
| 199 | break; |
|---|
| 200 | default: |
|---|
| 201 | break; |
|---|
| 202 | } |
|---|
| 203 | } |
|---|
| 204 | |
|---|
| 205 | void CErrorWin_KeyInput(CWindow *this, DS_U8 key, bool bRepeat) |
|---|
| 206 | { |
|---|
| 207 | switch (key) |
|---|
| 208 | { |
|---|
| 209 | case VK_OK: |
|---|
| 210 | DST_CreateWin(WIN_AUTO_SEARCH, WIN_NULL, 1, 0, 0, 0); |
|---|
| 211 | this->Close(this); |
|---|
| 212 | if(DST_UI_GetMute() && DST_GetWin(WIN_VOLUME_MUTE)==0) DST_CreateWin(WIN_VOLUME_MUTE, 0, 0, 0, 0, 0); |
|---|
| 213 | break; |
|---|
| 214 | |
|---|
| 215 | default: |
|---|
| 216 | break; |
|---|
| 217 | |
|---|
| 218 | } |
|---|
| 219 | } |
|---|
| 220 | |
|---|
| 221 | //}; |
|---|
| 222 | |
|---|
| 223 | void DST_CreateErrorWin(SWinEventMsg event) |
|---|
| 224 | { |
|---|
| 225 | static DS_U8 nState = 0; |
|---|
| 226 | // DST_Printf("DST_GetWin(WIN_ERROR)=%d nState=%d event.data[2]=%d\n",DST_GetWin(WIN_ERROR),nState, event.data[2]); |
|---|
| 227 | if (DST_GetWin(WIN_ERROR) != 0 && nState == event.data[2]) return; // ÀÌ¹Ì Ã³¸®ÁßÀ̶ó¸é ¹«½Ã |
|---|
| 228 | |
|---|
| 229 | if (DST_GetWin(WIN_EWS)) return; |
|---|
| 230 | if (DST_GetWin(WIN_CHANNEL_BANNER)) |
|---|
| 231 | { |
|---|
| 232 | if (event.data[2] != SM_AUDIO_ONLY) |
|---|
| 233 | { |
|---|
| 234 | if(nState != SM_AUDIO_ONLY) return; |
|---|
| 235 | else |
|---|
| 236 | { |
|---|
| 237 | if(event.data[2] == SM_WEAK_SIGNAL) |
|---|
| 238 | DST_CreateWin(WIN_CHANNEL_BANNER, WIN_NULL, BANNER_NORMAL ,3, 0, 0); |
|---|
| 239 | else |
|---|
| 240 | DST_CloseWin(WIN_CHANNEL_BANNER); |
|---|
| 241 | } |
|---|
| 242 | } |
|---|
| 243 | } |
|---|
| 244 | |
|---|
| 245 | if (DST_GetWin(WIN_DIRECT_TUNE)) return; |
|---|
| 246 | // if (DST_GetWin(WIN_VOLUME)) return; |
|---|
| 247 | // if (DST_GetWin(WIN_VOLUME_MUTE)) return; |
|---|
| 248 | if (DST_GetWin(WIN_SIGNAL_METER)) return; |
|---|
| 249 | // if (DST_GetWin(WIN_CLOSED_CAPTION_HOT)) return; |
|---|
| 250 | if (DST_GetWin(WIN_AUDIO_HOT)) return; |
|---|
| 251 | if (DST_GetWin(WIN_DISPLAY_MODE_HOT)) return; |
|---|
| 252 | if (DST_GetWin(WIN_FACTORY_RESET)) return; |
|---|
| 253 | if (DST_GetWin(WIN_FACTORY_RESET_ASK)) return; |
|---|
| 254 | // if (DST_GetWin(WIN_INFOR_BANNER)) return; |
|---|
| 255 | if (DST_GetWin(WIN_MAIN_MENU)) return; |
|---|
| 256 | if (DST_GetWin(WIN_POWER_DOWN_CAUTION)) return; |
|---|
| 257 | if (DST_GetWin(WIN_SUB_MENU_2DEPTH)) return; |
|---|
| 258 | if (DST_GetWin(WIN_SUB_MENU_3DEPTH)) return; |
|---|
| 259 | if (DST_GetWin(WIN_AUTO_SEARCH)) return; |
|---|
| 260 | if (DST_GetWin(WIN_MANUAL_SEARCH)) return; |
|---|
| 261 | if (DST_GetWin(WIN_CHANNEL_LIST)) return; |
|---|
| 262 | if (DST_GetWin(WIN_PROGRAM_GUIDE)) return; |
|---|
| 263 | if (DST_GetWin(WIN_PASSWD_CHANGE)) return; |
|---|
| 264 | if (DST_GetWin(WIN_PASSWD_CHECK)) return; |
|---|
| 265 | if (DST_GetWin(WIN_PASSWD_CONFIRM)) return; |
|---|
| 266 | if (DST_GetWin(WIN_AGE_RATING)) return; |
|---|
| 267 | // T(); |
|---|
| 268 | nState = event.data[2]; |
|---|
| 269 | |
|---|
| 270 | CWindow*pWin = NewCWindow(event); |
|---|
| 271 | pWin->Destructor = CErrorWin_Destructor; |
|---|
| 272 | pWin->OnMessage = CErrorWin_OnMessage; |
|---|
| 273 | pWin->OnTimer = CErrorWin_OnTimer; |
|---|
| 274 | pWin->ShowWindow = CErrorWin_ShowWindow; |
|---|
| 275 | pWin->Show = CErrorWin_Show; |
|---|
| 276 | pWin->KeyInput = CErrorWin_KeyInput; |
|---|
| 277 | // »ý¼ºÀÚ È£Ãâ |
|---|
| 278 | CErrorWin_Constructor(pWin, event); |
|---|
| 279 | // À©µµ¿ì ¸Þ´ÏÀú¿¡ µî·Ï |
|---|
| 280 | DST_AddWin((WinID)(event.data[0]), pWin); |
|---|
| 281 | } |
|---|
| 282 | |
|---|