| 1 | #include "DST_WinManager.h" |
|---|
| 2 | #include "DST_ChannelTune.h" |
|---|
| 3 | #include "DST_SignalMonitor.h" |
|---|
| 4 | #include "DST_DataStrings.h" |
|---|
| 5 | #include "DST_OSDImage.h" |
|---|
| 6 | #include "DST_UserInterface.h" |
|---|
| 7 | #include "DST_DB.h" |
|---|
| 8 | |
|---|
| 9 | DS_U32* DST_UTF82Uni(DS_U8 *utf); |
|---|
| 10 | |
|---|
| 11 | static DS_U32 g_StartTime = 0; // EPG ¿¡¼ Detail â¿¡ °¬´Ù°¡ ¿Ã ¶§ Ä¿¼¸¦ À¯Áö½Ã۱â À§ÇÔ |
|---|
| 12 | static int g_Pos = 0; // EPG ¿¡¼ Detail â¿¡ °¬´Ù°¡ ¿Ã ¶§ Ä¿¼ À§Ä¡¸¦ À¯Áö½Ã۱â À§ÇÔ |
|---|
| 13 | static EPG_DB g_Event; // EPG â¿¡¼ µðÅ×ÀÏ Ã¢¿¡ ³Ñ±â´Â º¯¼ö |
|---|
| 14 | |
|---|
| 15 | #define MAX_LINES (100) // ÃÖ´ë 100 ÁÙ |
|---|
| 16 | |
|---|
| 17 | class CProgramGuideDetailWin : public CWindow |
|---|
| 18 | { |
|---|
| 19 | private: |
|---|
| 20 | int cursor; |
|---|
| 21 | int nLines; |
|---|
| 22 | bool bTitle[MAX_LINES]; // Á¦¸ñÀº ±½°Ô |
|---|
| 23 | DS_U32* MultiLine[MAX_LINES]; // ³»¿ë |
|---|
| 24 | STime_t st; |
|---|
| 25 | public: |
|---|
| 26 | CProgramGuideDetailWin(SWinEventMsg event):CWindow(event) |
|---|
| 27 | { |
|---|
| 28 | rect.w = DST_GetImageWidth(newcon2_gui_detailedinfo_back); |
|---|
| 29 | rect.h = DST_GetImageHeight(newcon2_gui_detailedinfo_back); |
|---|
| 30 | rect.x = (DST_GetScreenWidth() - rect.w) / 2; |
|---|
| 31 | rect.y = (DST_GetScreenHeight()- rect.h) / 2; |
|---|
| 32 | cursor = 0; |
|---|
| 33 | nLines = 0; |
|---|
| 34 | for (int i = 0; i < MAX_LINES; i++) MultiLine[i] = 0; |
|---|
| 35 | // if (g_Event.title > 0) // ¼ÒÁ¦¸ñÀ¸·Î bold |
|---|
| 36 | // { |
|---|
| 37 | // DS_U32* strTemp = DST_UTF82Uni((DS_U8*)g_Event.title); |
|---|
| 38 | //DST_Printf("len: %d, cal len: %d, %s\n",g_Event.title_name_length,strlen((char*)g_Event.title),g_Event.title); |
|---|
| 39 | // SetMultiLineText(strTemp, strlen32(strTemp), 528, fontItemSize, true); |
|---|
| 40 | // DST_OS_Free(&strTemp); |
|---|
| 41 | // } |
|---|
| 42 | if (g_Event.text > 0) // ÁÖ³»¿ëÀ¸·Î normal |
|---|
| 43 | { |
|---|
| 44 | DS_U32* strTemp = DST_UTF82Uni((DS_U8*)g_Event.text); |
|---|
| 45 | // DST_Printf("len: %d, cal len: %d, %s\n",g_Event.title_text_length,strlen((char*)g_Event.text),g_Event.text); |
|---|
| 46 | if(strlen32(strTemp) > 0) |
|---|
| 47 | { |
|---|
| 48 | SetMultiLineText(strTemp, strlen32(strTemp), 528, fontItemSize, false); |
|---|
| 49 | } |
|---|
| 50 | else |
|---|
| 51 | { |
|---|
| 52 | DS_U32 strTemp1[200] = {0,}; |
|---|
| 53 | uni232(strTemp1,pz_ProgramGuide_No[OSD_Lang]); |
|---|
| 54 | SetMultiLineText(strTemp1, strlen32(strTemp1), 528, fontItemSize, false); |
|---|
| 55 | } |
|---|
| 56 | //DST_OS_Free(&strTemp); |
|---|
| 57 | } |
|---|
| 58 | |
|---|
| 59 | |
|---|
| 60 | } |
|---|
| 61 | // ¼ÒÁ¦¸ñ°ú º»¹®À» ±¸ºÐÇÏ¿© ÇÑÁÙ¾¿ Àß¶óÁø µ¥ÀÌÅ͸¦ ÀúÀåÇÑ´Ù. |
|---|
| 62 | void InsertMultiLineText(DS_U32 *strBuff, DS_U16 nStrLen, bool bBold) |
|---|
| 63 | { |
|---|
| 64 | if (nLines >= MAX_LINES-1) return; |
|---|
| 65 | if (nStrLen > 0) |
|---|
| 66 | { |
|---|
| 67 | MultiLine[nLines] = (DS_U32*)DST_OS_Malloc((nStrLen+1) * sizeof(DS_U32)); |
|---|
| 68 | memcpy(MultiLine[nLines], strBuff, nStrLen * sizeof(DS_U32)); |
|---|
| 69 | MultiLine[nLines][nStrLen] = 0; |
|---|
| 70 | } |
|---|
| 71 | bTitle[nLines] = bBold; |
|---|
| 72 | nLines++; |
|---|
| 73 | } |
|---|
| 74 | // ±ä ¹®ÀÚ¿À» Àû´çÈ÷ Àß¶ó³½´Ù. |
|---|
| 75 | int SetMultiLineText(DS_U32 *strBuff, DS_U16 nStrLen, int width, DS_U8 nSize, bool bBold) |
|---|
| 76 | { |
|---|
| 77 | if (nStrLen < 1) return 0; |
|---|
| 78 | int nSpacePos = -1; |
|---|
| 79 | |
|---|
| 80 | for (int i = 0; i < nStrLen; i++) |
|---|
| 81 | { |
|---|
| 82 | if (strBuff[i] == 0x0D) |
|---|
| 83 | { |
|---|
| 84 | if (((i+1) < nStrLen) && strBuff[i+1] == 0x0A) |
|---|
| 85 | { |
|---|
| 86 | InsertMultiLineText(strBuff,i, bBold); |
|---|
| 87 | return SetMultiLineText(strBuff+(i+2), nStrLen-(i+2), width, nSize, bBold) + 1; |
|---|
| 88 | } |
|---|
| 89 | InsertMultiLineText(strBuff,i, bBold); |
|---|
| 90 | return SetMultiLineText(strBuff+(i+1), nStrLen-(i+1), width, nSize, bBold) + 1; |
|---|
| 91 | } |
|---|
| 92 | if ((strBuff[i] == 0x0A)) |
|---|
| 93 | { |
|---|
| 94 | InsertMultiLineText(strBuff,i, bBold); |
|---|
| 95 | return SetMultiLineText(strBuff+(i+1), nStrLen-(i+1), width, nSize, bBold) + 1; |
|---|
| 96 | } |
|---|
| 97 | |
|---|
| 98 | if (DST_GetTextWidth32(strBuff, i + 1, nSize) > width) |
|---|
| 99 | { |
|---|
| 100 | if (strBuff[i-1] == 0x20 ||nSpacePos == -1) |
|---|
| 101 | { |
|---|
| 102 | InsertMultiLineText(strBuff,i, bBold); |
|---|
| 103 | return SetMultiLineText(strBuff+(i), nStrLen-(i), width, nSize, bBold) + 1; |
|---|
| 104 | } |
|---|
| 105 | InsertMultiLineText(strBuff, nSpacePos + 1, bBold); |
|---|
| 106 | return SetMultiLineText(strBuff+(nSpacePos + 1), nStrLen-(nSpacePos + 1), width, nSize, bBold) + 1; |
|---|
| 107 | } |
|---|
| 108 | if (strBuff[i] == 0x20) nSpacePos = i; |
|---|
| 109 | } |
|---|
| 110 | InsertMultiLineText(strBuff, nStrLen, bBold); |
|---|
| 111 | return 1; |
|---|
| 112 | } |
|---|
| 113 | |
|---|
| 114 | virtual ~CProgramGuideDetailWin() |
|---|
| 115 | { |
|---|
| 116 | for (int i = 0; i < MAX_LINES; i++) if (MultiLine[i]) DST_OS_Free(&MultiLine[i]); |
|---|
| 117 | } |
|---|
| 118 | virtual void OnMessage(SWinEventMsg event) |
|---|
| 119 | { |
|---|
| 120 | switch (event.cmd) |
|---|
| 121 | { |
|---|
| 122 | case WM_POWER_OFF: |
|---|
| 123 | Close(); |
|---|
| 124 | break; |
|---|
| 125 | } |
|---|
| 126 | } |
|---|
| 127 | virtual void Show(WinID id) |
|---|
| 128 | { |
|---|
| 129 | switch(id) |
|---|
| 130 | { |
|---|
| 131 | case WIN_EWS: |
|---|
| 132 | case WIN_CHANNEL_BANNER: |
|---|
| 133 | case WIN_DIRECT_TUNE: |
|---|
| 134 | case WIN_VOLUME: |
|---|
| 135 | case WIN_VOLUME_MUTE: |
|---|
| 136 | case WIN_SIGNAL_METER: |
|---|
| 137 | case WIN_CLOSED_CAPTION_HOT: |
|---|
| 138 | case WIN_AUDIO_HOT: |
|---|
| 139 | case WIN_DISPLAY_MODE_HOT: |
|---|
| 140 | case WIN_FACTORY_RESET: |
|---|
| 141 | case WIN_FACTORY_RESET_ASK: |
|---|
| 142 | case WIN_INFOR_BANNER: |
|---|
| 143 | case WIN_MAIN_MENU: |
|---|
| 144 | case WIN_POWER_DOWN_CAUTION: |
|---|
| 145 | case WIN_SUB_MENU_2DEPTH: |
|---|
| 146 | case WIN_SUB_MENU_3DEPTH: |
|---|
| 147 | case WIN_SUB_MENU_4DEPTH: |
|---|
| 148 | case WIN_AUTO_SEARCH: |
|---|
| 149 | case WIN_MANUAL_SEARCH: |
|---|
| 150 | case WIN_CHANNEL_LIST: |
|---|
| 151 | case WIN_OTC_DOWNLOAD: |
|---|
| 152 | case WIN_OTC_DOWNLOAD_FAIL: |
|---|
| 153 | case WIN_UPDATE: |
|---|
| 154 | case WIN_UPDATE_RESET: |
|---|
| 155 | // case WIN_PROGRAM_GUIDE: |
|---|
| 156 | Close(); |
|---|
| 157 | break; |
|---|
| 158 | default: |
|---|
| 159 | break; |
|---|
| 160 | } |
|---|
| 161 | } |
|---|
| 162 | void DrawScrollBar3(int x, int y, int h, int total_count, int page_count, int page_start) |
|---|
| 163 | { |
|---|
| 164 | if (total_count <= page_count) return; |
|---|
| 165 | int nScrollPosition = total_count - page_count; |
|---|
| 166 | int ScrollHeight = h/nScrollPosition; |
|---|
| 167 | DST_Printf("nScrollPosition : %d h/nScrollPosition : %d/%d == %d y+page_start*ScrollHeight = %d\n",nScrollPosition,h,nScrollPosition ,ScrollHeight,y+page_start*ScrollHeight); |
|---|
| 168 | DrawImage(x,y+page_start*ScrollHeight,newcon2_gui_scroll_button,true); |
|---|
| 169 | } |
|---|
| 170 | |
|---|
| 171 | virtual void Show() |
|---|
| 172 | { |
|---|
| 173 | // ¹è°æ |
|---|
| 174 | DrawImage(0, 0, newcon2_gui_detailedinfo_back); |
|---|
| 175 | // window title |
|---|
| 176 | // program title |
|---|
| 177 | setFontStyle(20,0xFFC8C8C8,ALIGN_MIDDLE,ALIGN_LEFT); |
|---|
| 178 | |
|---|
| 179 | int rf = DST_EEPROM_GetRF(); |
|---|
| 180 | if (g_Event.title != 0) |
|---|
| 181 | { |
|---|
| 182 | if (g_Event.title) DrawTextUTF8(15, 43, 528, 29, (DS_U8*)g_Event.title, &font); |
|---|
| 183 | |
|---|
| 184 | } |
|---|
| 185 | // ä³Î À̸§ Ç¥½Ã |
|---|
| 186 | DS_U32 ChInfo[40]={0}; |
|---|
| 187 | DST_UI_GetCurrentChannelInfo(ChInfo); |
|---|
| 188 | setFontStyle(20,0xFFC8C8C8,ALIGN_MIDDLE,ALIGN_LEFT); |
|---|
| 189 | DrawText32(15, 11, 365, 29, ChInfo, &font); |
|---|
| 190 | |
|---|
| 191 | // ÇöÀç½Ã°£ Ç¥½Ã |
|---|
| 192 | setFontStyle(20,0xFFC8C8C8,ALIGN_MIDDLE,ALIGN_RIGHT); |
|---|
| 193 | DS_U32 curTime = DST_GetCurrentUTCTime(); |
|---|
| 194 | DS_U16 CurrTime[50] = {0,}; |
|---|
| 195 | strcpy16(CurrTime, DST_GetTimeString(curTime,DATE_NO_YEAR_TIME_NO_SEC_DETAIL,true,DST_g_TimeOffset[rf])); |
|---|
| 196 | DrawTextUni(0, 11, 536, 29, CurrTime, &font); |
|---|
| 197 | |
|---|
| 198 | |
|---|
| 199 | setFontStyle(20,0xFFC8C8C8,ALIGN_MIDDLE,ALIGN_LEFT); |
|---|
| 200 | |
|---|
| 201 | //program time |
|---|
| 202 | DS_U32 endTime = g_Event.start_time +g_Event.duration; |
|---|
| 203 | DS_U16 time[110] = {0,}; |
|---|
| 204 | strcpy16(time, DST_GetTimeString(g_Event.start_time,DATE_NO_YEAR_TIME_NO_SEC_DETAIL,true,DST_g_TimeOffset[rf])); |
|---|
| 205 | strcat16(time, (char *)" - "); |
|---|
| 206 | strcat16(time, DST_GetTimeString(endTime,TIME_NO_SEC,true,DST_g_TimeOffset[rf])); |
|---|
| 207 | DrawTextUni(15, 80, 482, 29, time, &font); |
|---|
| 208 | |
|---|
| 209 | |
|---|
| 210 | // program text |
|---|
| 211 | for (int i=0; i < 6; i++) |
|---|
| 212 | { |
|---|
| 213 | if (MultiLine[cursor+i] == 0) continue; |
|---|
| 214 | DrawText32(15, 117+36*i, 528, 29, MultiLine[cursor+i], &font); |
|---|
| 215 | } |
|---|
| 216 | // ½ºÅ©·Ñ¹Ù |
|---|
| 217 | if (nLines > 6) DrawScrollBar3(560, 103, 213, nLines, 6, cursor); |
|---|
| 218 | // Ű °¡À̵å |
|---|
| 219 | setFontStyle(20,0xFF8C8C8C,ALIGN_MIDDLE,ALIGN_CENTER); |
|---|
| 220 | DS_U16 final[20]; |
|---|
| 221 | memset(final,0,sizeof(final)); |
|---|
| 222 | strcpy16(final, pz_Edit_Menu[OSD_Lang]); |
|---|
| 223 | str2uni(&final[strlen16(final)], (char *)" : "); |
|---|
| 224 | strcpy16(&final[strlen16(final)], pz_Edit_Exit[OSD_Lang]); |
|---|
| 225 | DrawTextUni(17, 340, 142, 29, final, &font); |
|---|
| 226 | |
|---|
| 227 | UpdateScreen(); |
|---|
| 228 | |
|---|
| 229 | RegisterKey(VK_MENU, true); |
|---|
| 230 | RegisterKey(VK_UP, true); |
|---|
| 231 | RegisterKey(VK_DN, true); |
|---|
| 232 | RegisterKey(VK_LEFT, true); |
|---|
| 233 | RegisterKey(VK_RIGHT, true); |
|---|
| 234 | RegisterKey(VK_OK, true); |
|---|
| 235 | RegisterKey(VK_EPG, true); |
|---|
| 236 | RegisterKey(VK_CANCEL, true); |
|---|
| 237 | RegisterKey(VK_PREV, true); |
|---|
| 238 | RegisterKey(VK_PREV_MENU, true); |
|---|
| 239 | } |
|---|
| 240 | |
|---|
| 241 | virtual void KeyInput(DS_U8 key, bool /*bRepeat*/) |
|---|
| 242 | { |
|---|
| 243 | switch (key) |
|---|
| 244 | { |
|---|
| 245 | case VK_UP: |
|---|
| 246 | if (nLines <= 6) break; |
|---|
| 247 | if (cursor == 0) break; |
|---|
| 248 | cursor--; |
|---|
| 249 | Show(); |
|---|
| 250 | break; |
|---|
| 251 | |
|---|
| 252 | case VK_DN: |
|---|
| 253 | if (nLines <= 6) break; |
|---|
| 254 | if (cursor == nLines-6) break; |
|---|
| 255 | cursor++; |
|---|
| 256 | Show(); |
|---|
| 257 | break; |
|---|
| 258 | |
|---|
| 259 | case VK_RIGHT: |
|---|
| 260 | case VK_OK: |
|---|
| 261 | // ÀÎÀÚ°¡ 2À̸é ÀÌÀü À§Ä¡¸¦ º¹¿øÇÏ¸é¼ EPG¸¦ ±×¸®¶ó´Â ¸í·É |
|---|
| 262 | DST_CreateWin(WIN_PROGRAM_GUIDE, GetParentWinID(), 2); |
|---|
| 263 | Close(); |
|---|
| 264 | break; |
|---|
| 265 | |
|---|
| 266 | default: |
|---|
| 267 | DST_CreateWin(WIN_PROGRAM_GUIDE, GetParentWinID(), 2); |
|---|
| 268 | Close(); |
|---|
| 269 | break; |
|---|
| 270 | } |
|---|
| 271 | } |
|---|
| 272 | }; |
|---|
| 273 | |
|---|
| 274 | class CProgramGuideWin : public CWindow |
|---|
| 275 | { |
|---|
| 276 | private: |
|---|
| 277 | int start; |
|---|
| 278 | int cursor; |
|---|
| 279 | int EventNum; |
|---|
| 280 | EPG_DB *Events; |
|---|
| 281 | DS_U8 event_parameter2; |
|---|
| 282 | public: |
|---|
| 283 | CProgramGuideWin(SWinEventMsg event):CWindow(event) |
|---|
| 284 | { |
|---|
| 285 | |
|---|
| 286 | rect.w = DST_GetImageWidth(newcon2_gui_epg_back); |
|---|
| 287 | rect.h = DST_GetImageHeight(newcon2_gui_epg_back); |
|---|
| 288 | rect.x = (DST_GetScreenWidth() - rect.w) / 2; |
|---|
| 289 | rect.y = (DST_GetScreenHeight()- rect.h) / 2; |
|---|
| 290 | start = 0; |
|---|
| 291 | cursor = 0; |
|---|
| 292 | event_parameter2 = event.data[2]; |
|---|
| 293 | EventNum = 0; |
|---|
| 294 | Events = 0; |
|---|
| 295 | InitEPG(); |
|---|
| 296 | } |
|---|
| 297 | |
|---|
| 298 | virtual ~CProgramGuideWin() |
|---|
| 299 | { |
|---|
| 300 | if (Events) DST_EPG_DB_Free(Events, EventNum); |
|---|
| 301 | } |
|---|
| 302 | |
|---|
| 303 | virtual void OnTimer(char /*nID*/) |
|---|
| 304 | { |
|---|
| 305 | // ½ÃºÐ´ÜÀ§ Ç¥½Ã ½Ã°£ÀÌ °»½ÅµÇ¸é ȸéÀ» °»½ÅÇÑ´Ù. |
|---|
| 306 | InitEPG(); |
|---|
| 307 | Show(); |
|---|
| 308 | } |
|---|
| 309 | |
|---|
| 310 | void InitEPG() |
|---|
| 311 | { |
|---|
| 312 | |
|---|
| 313 | if (Events) |
|---|
| 314 | { |
|---|
| 315 | DST_EPG_DB_Free(Events, EventNum); |
|---|
| 316 | Events = 0; |
|---|
| 317 | } |
|---|
| 318 | Events = DST_EPG_DB_Get(&EventNum); |
|---|
| 319 | int tmpEventNum = 0; |
|---|
| 320 | for (int i = 0; i < EventNum; i++) if (strlen((char *)Events[i].title) == 0 && strlen((char *)Events[i].text) == 0) tmpEventNum--; |
|---|
| 321 | |
|---|
| 322 | if(EventNum != tmpEventNum) |
|---|
| 323 | { |
|---|
| 324 | tmpEventNum = EventNum; |
|---|
| 325 | EPG_DB *tmpEvents = (EPG_DB*)DST_OS_Calloc(tmpEventNum, sizeof(EPG_DB)); |
|---|
| 326 | int nPos = 0; |
|---|
| 327 | for (int i = 0; i < EventNum; i++) |
|---|
| 328 | { |
|---|
| 329 | if (strlen((char *)Events[i].title) == 0 && strlen((char *)Events[i].text) == 0) continue; |
|---|
| 330 | // memcpy(&tmpEvents[nPos], &Events[i],sizeof(EPG_DB)); |
|---|
| 331 | tmpEvents[nPos].source_id= Events[i].source_id; |
|---|
| 332 | tmpEvents[nPos].event_id= Events[i].event_id; |
|---|
| 333 | tmpEvents[nPos].start_time= Events[i].start_time; |
|---|
| 334 | tmpEvents[nPos].duration= Events[i].duration; |
|---|
| 335 | strcpy((char*)tmpEvents[nPos].title, (char*)Events[i].title); |
|---|
| 336 | tmpEvents[nPos].text = (char*)DST_OS_Calloc(strlen(Events[i].text)+1, 1); |
|---|
| 337 | strcpy((char*)tmpEvents[nPos].text, (char*)Events[i].text); |
|---|
| 338 | nPos++; |
|---|
| 339 | } |
|---|
| 340 | if (EventNum > 0) DST_EPG_DB_Free(Events, EventNum); |
|---|
| 341 | Events = (EPG_DB*)DST_OS_Calloc(tmpEventNum, sizeof(EPG_DB)); |
|---|
| 342 | memcpy(Events, tmpEvents,tmpEventNum*sizeof(EPG_DB)); |
|---|
| 343 | EventNum = tmpEventNum; |
|---|
| 344 | |
|---|
| 345 | } |
|---|
| 346 | |
|---|
| 347 | DST_Printf("CProgramGuideWin EventNum = %d\n", EventNum); |
|---|
| 348 | if (event_parameter2 == 2) // ÀÌÀü À§Ä¡ º¹¿ø |
|---|
| 349 | { |
|---|
| 350 | for (int i = 0; i < EventNum; i++) |
|---|
| 351 | { |
|---|
| 352 | if (Events[i].start_time != g_StartTime) continue; |
|---|
| 353 | cursor = i; |
|---|
| 354 | start = cursor - g_Pos; |
|---|
| 355 | if (start < 0) start = 0; |
|---|
| 356 | event_parameter2 = 0; |
|---|
| 357 | break; |
|---|
| 358 | } |
|---|
| 359 | } |
|---|
| 360 | |
|---|
| 361 | } |
|---|
| 362 | |
|---|
| 363 | virtual void OnMessage(SWinEventMsg event) |
|---|
| 364 | { |
|---|
| 365 | switch (event.cmd) |
|---|
| 366 | { |
|---|
| 367 | case WM_POWER_OFF: |
|---|
| 368 | Close(); |
|---|
| 369 | break; |
|---|
| 370 | } |
|---|
| 371 | } |
|---|
| 372 | |
|---|
| 373 | virtual void Show(WinID id) |
|---|
| 374 | { |
|---|
| 375 | switch(id) |
|---|
| 376 | { |
|---|
| 377 | case WIN_EWS: |
|---|
| 378 | case WIN_CHANNEL_BANNER: |
|---|
| 379 | case WIN_DIRECT_TUNE: |
|---|
| 380 | case WIN_VOLUME: |
|---|
| 381 | case WIN_VOLUME_MUTE: |
|---|
| 382 | case WIN_SIGNAL_METER: |
|---|
| 383 | case WIN_AUDIO_HOT: |
|---|
| 384 | case WIN_DISPLAY_MODE_HOT: |
|---|
| 385 | case WIN_FACTORY_RESET: |
|---|
| 386 | case WIN_FACTORY_RESET_ASK: |
|---|
| 387 | case WIN_INFOR_BANNER: |
|---|
| 388 | case WIN_MAIN_MENU: |
|---|
| 389 | case WIN_POWER_DOWN_CAUTION: |
|---|
| 390 | case WIN_SUB_MENU_2DEPTH: |
|---|
| 391 | case WIN_SUB_MENU_3DEPTH: |
|---|
| 392 | case WIN_SUB_MENU_4DEPTH: |
|---|
| 393 | case WIN_AUTO_SEARCH: |
|---|
| 394 | case WIN_MANUAL_SEARCH: |
|---|
| 395 | case WIN_CHANNEL_LIST: |
|---|
| 396 | case WIN_OTC_DOWNLOAD: |
|---|
| 397 | case WIN_OTC_DOWNLOAD_FAIL: |
|---|
| 398 | case WIN_UPDATE: |
|---|
| 399 | case WIN_UPDATE_RESET: |
|---|
| 400 | |
|---|
| 401 | // case WIN_PROGRAM_GUIDE: |
|---|
| 402 | Close(); |
|---|
| 403 | break; |
|---|
| 404 | default: |
|---|
| 405 | break; |
|---|
| 406 | } |
|---|
| 407 | } |
|---|
| 408 | void DrawScrollBar3(int x, int y, int h, int total_count, int page_count, int page_start) |
|---|
| 409 | { |
|---|
| 410 | if (total_count <= page_count) return; |
|---|
| 411 | int nScrollPosition = total_count - page_count; |
|---|
| 412 | int ScrollHeight = h/nScrollPosition; |
|---|
| 413 | DST_Printf("nScrollPosition : %d h/nScrollPosition : %d/%d == %d y+page_start*ScrollHeight = %d\n",nScrollPosition,h,nScrollPosition ,ScrollHeight,y+page_start*ScrollHeight); |
|---|
| 414 | DrawImage(x,y+page_start*ScrollHeight,newcon2_gui_scroll_button,true); |
|---|
| 415 | } |
|---|
| 416 | virtual void Show() |
|---|
| 417 | { |
|---|
| 418 | // ¹è°æ |
|---|
| 419 | DrawImage(0, 0, newcon2_gui_epg_back); |
|---|
| 420 | // ŸÀÌÆ² ä³ÎÁ¤º¸ |
|---|
| 421 | // ·Î°í Ç¥½Ã |
|---|
| 422 | //DS_U8 pImage[72*36]; |
|---|
| 423 | //char strLogo[6] = ""; |
|---|
| 424 | //DS_U8 nWidth = 0; |
|---|
| 425 | //DS_U8 nHeight = 0; |
|---|
| 426 | int xPos = 0; |
|---|
| 427 | //int yPos = 0; |
|---|
| 428 | |
|---|
| 429 | DS_U8 RF= 0; |
|---|
| 430 | DS_U16 sID = 0; |
|---|
| 431 | DST_GetAVState(&RF, 0, &sID); |
|---|
| 432 | // ä³Î À̸§ Ç¥½Ã |
|---|
| 433 | DS_U32 ChInfo[40]={0}; |
|---|
| 434 | DST_UI_GetCurrentChannelInfo(ChInfo); |
|---|
| 435 | setFontStyle(20,0xFFC8C8C8,ALIGN_MIDDLE,ALIGN_LEFT); |
|---|
| 436 | int nTextWidth = DST_GetTextWidth32(ChInfo, strlen32(ChInfo), fontTitleSize); |
|---|
| 437 | xPos = (rect.w - nTextWidth) / 2; |
|---|
| 438 | DrawText32(15, 43, 365, 29, ChInfo, &font); |
|---|
| 439 | // ÇöÀç½Ã°£ Ç¥½Ã |
|---|
| 440 | setFontStyle(20,0xFFC8C8C8,ALIGN_MIDDLE,ALIGN_RIGHT); |
|---|
| 441 | DS_U32 curTime = DST_GetCurrentUTCTime(); |
|---|
| 442 | DS_U16 time[50] = {0,}; |
|---|
| 443 | strcpy16(time, DST_GetTimeString(curTime,DATE_NO_YEAR_TIME_NO_SEC_DETAIL,true,DST_g_TimeOffset[RF])); |
|---|
| 444 | DrawTextUni(0, 11, 536, 29, time, &font); |
|---|
| 445 | // EPG À̺¥Æ® Ç¥½Ã |
|---|
| 446 | |
|---|
| 447 | if (EventNum > 0) |
|---|
| 448 | { |
|---|
| 449 | int listNum = EventNum > 7 ? 7 : EventNum; |
|---|
| 450 | int listPos = cursor - start; |
|---|
| 451 | #if DESIGN_TYPE == 1 |
|---|
| 452 | DrawBox32(7, 79+36*listPos, 221, 33, CONV32_16(0xFF234B9C)); |
|---|
| 453 | DrawBox32(232, 79+36*listPos, 319, 33, CONV32_16(0xFF234B9C)); |
|---|
| 454 | #else |
|---|
| 455 | DrawBox32(12, 79+36*listPos, 217, 33, CONV32_16(0xFF234B9C)); |
|---|
| 456 | DrawBox32(232, 79+36*listPos, 319, 33, CONV32_16(0xFF234B9C)); |
|---|
| 457 | #endif |
|---|
| 458 | |
|---|
| 459 | for (int i=0; i < listNum; i++) |
|---|
| 460 | { |
|---|
| 461 | setFontStyle(20,0xFFC8C8C8,ALIGN_MIDDLE,ALIGN_CENTER); |
|---|
| 462 | DS_U32 endTime = Events[start+i].start_time + Events[start+i].duration; |
|---|
| 463 | DS_U16 time[110] = {0,}; |
|---|
| 464 | strcpy16(time, DST_GetTimeString(endTime,AMPM,true,DST_g_TimeOffset[RF])); |
|---|
| 465 | strcat16(time, (char *)" "); |
|---|
| 466 | strcat16(time, DST_GetTimeString(Events[start+i].start_time,TIME_NO_SEC_NO_AMPM,true,DST_g_TimeOffset[RF])); |
|---|
| 467 | strcat16(time, (char *)" - "); |
|---|
| 468 | strcat16(time, DST_GetTimeString(endTime,TIME_NO_SEC_NO_AMPM,true,DST_g_TimeOffset[RF])); |
|---|
| 469 | DrawTextUni(15, 81+36*i, 205, 29, time, &font); |
|---|
| 470 | |
|---|
| 471 | setFontStyle(20,0xFFC8C8C8,ALIGN_MIDDLE,ALIGN_LEFT); |
|---|
| 472 | if (Events[start+i].title) DrawTextUTF8(238, 81+36*i, 315, 29, (DS_U8*)Events[start+i].title, &font); |
|---|
| 473 | } |
|---|
| 474 | } |
|---|
| 475 | // ½ºÅ©·Ñ¹Ù |
|---|
| 476 | if (EventNum > 7) DrawScrollBar3(560, 76, 250, EventNum, 7, start); |
|---|
| 477 | // Ű °¡À̵å |
|---|
| 478 | setFontStyle(20,0xFF8C8C8C,ALIGN_MIDDLE,ALIGN_CENTER); |
|---|
| 479 | DS_U16 final[20]; |
|---|
| 480 | memset(final,0,sizeof(final)); |
|---|
| 481 | strcpy16(final, pz_Edit_Menu[OSD_Lang]); |
|---|
| 482 | str2uni(&final[strlen16(final)], (char *)" : "); |
|---|
| 483 | strcpy16(&final[strlen16(final)], pz_Edit_Exit[OSD_Lang]); |
|---|
| 484 | DrawTextUni(17, 340, 142, 29, final, &font); |
|---|
| 485 | |
|---|
| 486 | memset(final,0,sizeof(final)); |
|---|
| 487 | strcpy16(final, pz_Edit_OK[OSD_Lang]); |
|---|
| 488 | str2uni(&final[strlen16(final)], (char *)" : "); |
|---|
| 489 | strcpy16(&final[strlen16(final)], pz_EPG_Detail[OSD_Lang]); |
|---|
| 490 | DrawTextUni(170, 340, 200, 29, final, &font); |
|---|
| 491 | |
|---|
| 492 | UpdateScreen(); |
|---|
| 493 | |
|---|
| 494 | RegisterKey(VK_MENU, true); |
|---|
| 495 | RegisterKey(VK_UP, true); |
|---|
| 496 | RegisterKey(VK_DN, true); |
|---|
| 497 | RegisterKey(VK_LEFT, true); |
|---|
| 498 | RegisterKey(VK_RIGHT, true); |
|---|
| 499 | RegisterKey(VK_OK, true); |
|---|
| 500 | RegisterKey(VK_EPG, true); |
|---|
| 501 | RegisterKey(VK_CANCEL, true); |
|---|
| 502 | RegisterKey(VK_PREV, true); |
|---|
| 503 | RegisterKey(VK_PREV_MENU, true); |
|---|
| 504 | SetTimer(1,1000); // ½Ã°£ º¯°æ È®ÀÎÇÏ´Ù°¡ ºÐ´ÜÀ§ º¯°æµÇ¸é ½Ã°è¸¦ ´Ù½Ã ±×¸°´Ù |
|---|
| 505 | } |
|---|
| 506 | |
|---|
| 507 | // µðÅ×ÀÏ Ã¢¿¡ ³Ñ±â±âÀü¿¡ Ä¿¼ µ¥ÀÌÅ͸¦ Àü¿ªº¯¼ö¿¡ º¹»çÇÑ´Ù. |
|---|
| 508 | void SetEPGDetail() |
|---|
| 509 | { |
|---|
| 510 | g_Event.source_id= Events[cursor].source_id; |
|---|
| 511 | g_Event.event_id= Events[cursor].event_id; |
|---|
| 512 | g_Event.start_time = Events[cursor].start_time; |
|---|
| 513 | g_Event.duration = Events[cursor].duration; |
|---|
| 514 | |
|---|
| 515 | strcpy((char*)g_Event.title, (char*)Events[cursor].title); |
|---|
| 516 | if (g_Event.text) DST_OS_Free(&g_Event.text); |
|---|
| 517 | g_Event.text = (char*)DST_OS_Calloc(strlen(Events[cursor].text)+1,1); |
|---|
| 518 | strcpy(g_Event.text, Events[cursor].text); |
|---|
| 519 | |
|---|
| 520 | g_StartTime = Events[cursor].start_time; // µ¹¾Æ¿Ã¶§¸¦ ´ëºñÇØ Ãâ¹ßÀ§Ä¡¸¦ ±â¾ïÇÑ´Ù. |
|---|
| 521 | g_Pos = cursor - start; // µ¹¾Æ¿Ã¶§¸¦ ´ëºñÇØ Ãâ¹ßÀ§Ä¡¸¦ ±â¾ïÇÑ´Ù. |
|---|
| 522 | } |
|---|
| 523 | |
|---|
| 524 | virtual void KeyInput(DS_U8 key, bool /*bRepeat*/) |
|---|
| 525 | { |
|---|
| 526 | switch (key) |
|---|
| 527 | { |
|---|
| 528 | case VK_UP: |
|---|
| 529 | if (cursor == 0) break; |
|---|
| 530 | cursor--; |
|---|
| 531 | if (start > cursor) start = cursor; |
|---|
| 532 | Show(); |
|---|
| 533 | break; |
|---|
| 534 | |
|---|
| 535 | case VK_DN: |
|---|
| 536 | if (cursor >= EventNum - 1) break; |
|---|
| 537 | cursor++; |
|---|
| 538 | if (start < cursor - 6) start = cursor - 6; |
|---|
| 539 | Show(); |
|---|
| 540 | break; |
|---|
| 541 | |
|---|
| 542 | case VK_OK: |
|---|
| 543 | case VK_RIGHT: |
|---|
| 544 | if (EventNum < 1) break; |
|---|
| 545 | // µðÅ×ÀÏ Ã¢¿¡ ³Ñ±â±âÀü¿¡ Ä¿¼ µ¥ÀÌÅ͸¦ Àü¿ªº¯¼ö¿¡ º¹»çÇÑ´Ù. |
|---|
| 546 | SetEPGDetail(); |
|---|
| 547 | DST_CreateWin(WIN_PROGRAM_GUIDE, GetParentWinID(), 1); |
|---|
| 548 | Close(); |
|---|
| 549 | break; |
|---|
| 550 | |
|---|
| 551 | default: |
|---|
| 552 | if (GetParentWinID()) DST_CreateWin(GetParentWinID()); |
|---|
| 553 | Close(); |
|---|
| 554 | break; |
|---|
| 555 | } |
|---|
| 556 | } |
|---|
| 557 | }; |
|---|
| 558 | |
|---|
| 559 | void DST_CreateProgramGuideWin(SWinEventMsg event) |
|---|
| 560 | { |
|---|
| 561 | if (DST_DB_PresentChMap() == false) return; |
|---|
| 562 | |
|---|
| 563 | if (event.data[2] == 1) |
|---|
| 564 | { |
|---|
| 565 | DST_AddWin((WinID)(event.data[0]), new CProgramGuideDetailWin(event)); |
|---|
| 566 | } |
|---|
| 567 | else |
|---|
| 568 | { |
|---|
| 569 | DST_AddWin((WinID)(event.data[0]), new CProgramGuideWin(event)); |
|---|
| 570 | } |
|---|
| 571 | } |
|---|