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

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

first commit

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