| 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 | DS_U8 nErrorNumber; |
|---|
| 15 | DS_U8 nParameter; |
|---|
| 16 | int nWidth; |
|---|
| 17 | public: |
|---|
| 18 | CErrorWin(SWinEventMsg event):CWindow(event) |
|---|
| 19 | { |
|---|
| 20 | nErrorNumber = event.data[2]; |
|---|
| 21 | nParameter = event.data[3]; |
|---|
| 22 | nWidth = 0; |
|---|
| 23 | switch(nErrorNumber) |
|---|
| 24 | { |
|---|
| 25 | case SM_AUDIO_ONLY: |
|---|
| 26 | case SM_NO_PROGRAM: |
|---|
| 27 | case SM_WEAK_SIGNAL: |
|---|
| 28 | { |
|---|
| 29 | |
|---|
| 30 | switch(nErrorNumber) |
|---|
| 31 | { |
|---|
| 32 | case SM_AUDIO_ONLY: nWidth = DST_GetTextWidthUni(pz_AudioChannel[OSD_Lang],30); break; |
|---|
| 33 | case SM_NO_PROGRAM: nWidth = DST_GetTextWidthUni(pz_NoProgram[OSD_Lang],30); break; |
|---|
| 34 | case SM_WEAK_SIGNAL: nWidth = DST_GetTextWidthUni(pz_WeakSignal[OSD_Lang],30); break; |
|---|
| 35 | } |
|---|
| 36 | |
|---|
| 37 | rect.w = 9+DST_GetImageWidth(bracon_gui_caution)+10+nWidth+10; |
|---|
| 38 | rect.h = 92; |
|---|
| 39 | GetPos(); |
|---|
| 40 | } |
|---|
| 41 | break; |
|---|
| 42 | } |
|---|
| 43 | |
|---|
| 44 | SetTimeOut(0); |
|---|
| 45 | } |
|---|
| 46 | virtual void OnMessage(SWinEventMsg event) |
|---|
| 47 | { |
|---|
| 48 | switch (event.cmd) |
|---|
| 49 | { |
|---|
| 50 | case WM_POWER_OFF: |
|---|
| 51 | Close(); |
|---|
| 52 | break; |
|---|
| 53 | } |
|---|
| 54 | } |
|---|
| 55 | virtual ~CErrorWin() |
|---|
| 56 | { |
|---|
| 57 | } |
|---|
| 58 | |
|---|
| 59 | virtual void OnTimer(char /*nID*/) |
|---|
| 60 | { |
|---|
| 61 | UpdateScreen(); |
|---|
| 62 | GetPos(); |
|---|
| 63 | UpdateScreen(); |
|---|
| 64 | } |
|---|
| 65 | void GetPos() |
|---|
| 66 | { |
|---|
| 67 | static DS_U8 nPos = 0; |
|---|
| 68 | int x = 0, y = 0; |
|---|
| 69 | int sw = DST_GetScreenWidth(); |
|---|
| 70 | int sh = DST_GetScreenHeight(); |
|---|
| 71 | int iw = rect.w; |
|---|
| 72 | int ih = rect.h; |
|---|
| 73 | switch (nPos) |
|---|
| 74 | { |
|---|
| 75 | case 0: x = sw*2/4; y = sh*2/4; break; |
|---|
| 76 | case 1: x = sw*1/4; y = sh*1/4; break; |
|---|
| 77 | case 2: x = sw*3/4; y = sh*1/4; break; |
|---|
| 78 | case 3: x = sw*1/4; y = sh*3/4; break; |
|---|
| 79 | case 4: x = sw*3/4; y = sh*3/4; break; |
|---|
| 80 | } |
|---|
| 81 | x-=(iw / 2); |
|---|
| 82 | y-=(ih / 2); |
|---|
| 83 | int min_x = sw/10; |
|---|
| 84 | int min_y = sh/10; |
|---|
| 85 | int max_x = (sw*9/10) - iw; |
|---|
| 86 | int max_y = (sh*9/10) - ih; |
|---|
| 87 | if (x < min_x) x = min_x; |
|---|
| 88 | if (y < min_y) y = min_y; |
|---|
| 89 | if (x > max_x) x = max_x; |
|---|
| 90 | if (y > max_y) y = max_y; |
|---|
| 91 | nPos = (nPos >= 4) ? 0 : nPos + 1; |
|---|
| 92 | rect.x=x; rect.y=y; |
|---|
| 93 | } |
|---|
| 94 | |
|---|
| 95 | |
|---|
| 96 | virtual void Show() |
|---|
| 97 | { |
|---|
| 98 | // ¹è°æ |
|---|
| 99 | switch (nErrorNumber) |
|---|
| 100 | { |
|---|
| 101 | case SM_AUDIO_ONLY: |
|---|
| 102 | case SM_NO_PROGRAM: |
|---|
| 103 | case SM_WEAK_SIGNAL: |
|---|
| 104 | DrawBox32(0, 0, rect.w, rect.h, CONV32_16(0x00FFFFFF)); |
|---|
| 105 | DrawImage(9, 9, bracon_gui_caution,true); |
|---|
| 106 | break; |
|---|
| 107 | |
|---|
| 108 | } |
|---|
| 109 | |
|---|
| 110 | setFontStyle(25,0xFF000000,ALIGN_MIDDLE,ALIGN_CENTER); |
|---|
| 111 | // ¹®ÀÚ¿ |
|---|
| 112 | DST_Printf("nWidth = %d\n",nWidth); |
|---|
| 113 | switch (nErrorNumber) |
|---|
| 114 | { |
|---|
| 115 | case SM_AUDIO_ONLY: |
|---|
| 116 | DrawTextUni(11+DST_GetImageWidth(bracon_gui_caution)+10, 2, nWidth, rect.h-2, pz_AudioChannel[OSD_Lang], &font); |
|---|
| 117 | setFontStyle(25,0xFFC8C8C8,ALIGN_MIDDLE,ALIGN_CENTER); |
|---|
| 118 | DrawTextUni(9+DST_GetImageWidth(bracon_gui_caution)+10, 0, nWidth, rect.h-2, pz_AudioChannel[OSD_Lang], &font); |
|---|
| 119 | SetTimer(1, 1000); |
|---|
| 120 | |
|---|
| 121 | break; |
|---|
| 122 | case SM_NO_PROGRAM: |
|---|
| 123 | DrawTextUni(11+DST_GetImageWidth(bracon_gui_caution)+10, 2, nWidth, rect.h-2, pz_NoProgram[OSD_Lang], &font); |
|---|
| 124 | setFontStyle(25,0xFFC8C8C8,ALIGN_MIDDLE,ALIGN_CENTER); |
|---|
| 125 | DrawTextUni(9+DST_GetImageWidth(bracon_gui_caution)+10, 0, nWidth, rect.h-2, pz_NoProgram[OSD_Lang], &font); |
|---|
| 126 | SetTimer(1, 1000); |
|---|
| 127 | break; |
|---|
| 128 | case SM_WEAK_SIGNAL: |
|---|
| 129 | DrawTextUni(11+DST_GetImageWidth(bracon_gui_caution)+10, 2, nWidth, rect.h-2, pz_WeakSignal[OSD_Lang], &font); |
|---|
| 130 | setFontStyle(25,0xFFC8C8C8,ALIGN_MIDDLE,ALIGN_CENTER); |
|---|
| 131 | DrawTextUni(9+DST_GetImageWidth(bracon_gui_caution)+10, 0, nWidth, rect.h-2, pz_WeakSignal[OSD_Lang], &font); |
|---|
| 132 | SetTimer(1, 1000); |
|---|
| 133 | |
|---|
| 134 | break; |
|---|
| 135 | } |
|---|
| 136 | |
|---|
| 137 | } |
|---|
| 138 | |
|---|
| 139 | virtual void Show(WinID id) |
|---|
| 140 | { |
|---|
| 141 | switch(id) |
|---|
| 142 | { |
|---|
| 143 | case WIN_EWS: |
|---|
| 144 | case WIN_CHANNEL_BANNER: |
|---|
| 145 | case WIN_DIRECT_TUNE: |
|---|
| 146 | case WIN_VOLUME: |
|---|
| 147 | case WIN_VOLUME_MUTE: |
|---|
| 148 | case WIN_SIGNAL_METER: |
|---|
| 149 | case WIN_CLOSED_CAPTION_HOT: |
|---|
| 150 | case WIN_AUDIO_HOT: |
|---|
| 151 | case WIN_DISPLAY_MODE_HOT: |
|---|
| 152 | case WIN_FACTORY_RESET: |
|---|
| 153 | case WIN_FACTORY_RESET_ASK: |
|---|
| 154 | // case WIN_INFOR_BANNER: |
|---|
| 155 | case WIN_MAIN_MENU: |
|---|
| 156 | case WIN_POWER_DOWN_CAUTION: |
|---|
| 157 | case WIN_SUB_MENU_2DEPTH: |
|---|
| 158 | case WIN_SUB_MENU_3DEPTH: |
|---|
| 159 | case WIN_SUB_MENU_4DEPTH: |
|---|
| 160 | case WIN_AUTO_SEARCH: |
|---|
| 161 | case WIN_MANUAL_SEARCH: |
|---|
| 162 | case WIN_CHANNEL_LIST: |
|---|
| 163 | case WIN_PROGRAM_GUIDE: |
|---|
| 164 | case WIN_STATION_SEARCH: |
|---|
| 165 | case WIN_PASSWD_CHANGE: |
|---|
| 166 | // case WIN_PASSWD_CHECK: |
|---|
| 167 | // case WIN_PASSWD_CONFIRM: |
|---|
| 168 | Close(); |
|---|
| 169 | break; |
|---|
| 170 | case WIN_PASSWD_CHECK: |
|---|
| 171 | case WIN_PASSWD_CONFIRM: |
|---|
| 172 | SetVisible(false); |
|---|
| 173 | break; |
|---|
| 174 | default: |
|---|
| 175 | break; |
|---|
| 176 | } |
|---|
| 177 | } |
|---|
| 178 | }; |
|---|
| 179 | |
|---|
| 180 | void DST_CreateErrorWin(SWinEventMsg event) |
|---|
| 181 | { |
|---|
| 182 | static DS_U8 nState = 0; |
|---|
| 183 | // DST_Printf("DST_GetWin(WIN_ERROR)=%d nState=%d event.data[2]=%d\n",DST_GetWin(WIN_ERROR),nState, event.data[2]); |
|---|
| 184 | if (DST_GetWin(WIN_ERROR) != 0 && nState == event.data[2]) return; // ÀÌ¹Ì Ã³¸®ÁßÀ̶ó¸é ¹«½Ã |
|---|
| 185 | |
|---|
| 186 | if (DST_GetWin(WIN_EWS)) return; |
|---|
| 187 | if (DST_GetWin(WIN_CHANNEL_BANNER)) return; |
|---|
| 188 | if (DST_GetWin(WIN_DIRECT_TUNE)) return; |
|---|
| 189 | if (DST_GetWin(WIN_VOLUME)) return; |
|---|
| 190 | if (DST_GetWin(WIN_VOLUME_MUTE)) return; |
|---|
| 191 | if (DST_GetWin(WIN_SIGNAL_METER)) return; |
|---|
| 192 | if (DST_GetWin(WIN_CLOSED_CAPTION_HOT)) return; |
|---|
| 193 | if (DST_GetWin(WIN_AUDIO_HOT)) return; |
|---|
| 194 | if (DST_GetWin(WIN_DISPLAY_MODE_HOT)) return; |
|---|
| 195 | if (DST_GetWin(WIN_FACTORY_RESET)) return; |
|---|
| 196 | if (DST_GetWin(WIN_FACTORY_RESET_ASK)) return; |
|---|
| 197 | // if (DST_GetWin(WIN_INFOR_BANNER)) return; |
|---|
| 198 | if (DST_GetWin(WIN_MAIN_MENU)) return; |
|---|
| 199 | if (DST_GetWin(WIN_POWER_DOWN_CAUTION)) return; |
|---|
| 200 | if (DST_GetWin(WIN_SUB_MENU_2DEPTH)) return; |
|---|
| 201 | if (DST_GetWin(WIN_SUB_MENU_3DEPTH)) return; |
|---|
| 202 | if (DST_GetWin(WIN_AUTO_SEARCH)) return; |
|---|
| 203 | if (DST_GetWin(WIN_MANUAL_SEARCH)) return; |
|---|
| 204 | if (DST_GetWin(WIN_CHANNEL_LIST)) return; |
|---|
| 205 | if (DST_GetWin(WIN_PROGRAM_GUIDE)) return; |
|---|
| 206 | if (DST_GetWin(WIN_PASSWD_CHANGE)) return; |
|---|
| 207 | if (DST_GetWin(WIN_PASSWD_CHECK)) return; |
|---|
| 208 | if (DST_GetWin(WIN_PASSWD_CONFIRM)) return; |
|---|
| 209 | if (DST_GetWin(WIN_AGE_RATING)) return; |
|---|
| 210 | // T(); |
|---|
| 211 | nState = event.data[2]; |
|---|
| 212 | DST_AddWin((WinID)(event.data[0]), new CErrorWin(event)); |
|---|
| 213 | } |
|---|