source: svn/trunk/zasc/app_c/DST_WinProgramGuide.c @ 27

Last change on this file since 27 was 2, checked in by jglee, 11 years ago

first commit

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