source: svn/trunk/zasc/app/DST_WinInforbanner.cpp @ 22

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

1.phkim

  1. revision copy newcon3sk r27
File size: 6.5 KB
Line 
1#include "DST_WinManager.h"
2#include "DST_OSDImage.h"
3#include "DST_UserInterface.h"
4#include "DST_SignalMonitor.h"
5#include "DST_ChannelTune.h"
6#include "DST_GlobalVariables.h"
7#include "DST_DataStrings.h"
8#include "DST_DB.h"
9#include "DST_ISDBT_ChannelTask.h"
10#include "DST_DB_Engine.h"
11
12OSD_PIXEL_T DST_GetAribColor(DS_U8 n);
13DS_U32* DST_UTF82Uni(DS_U8 *utf);
14
15#if 0
16____CInfobannerWin___()
17#endif
18
19class CInfobannerWin : public CWindow
20{
21 public:
22        CInfobannerWin(SWinEventMsg event):CWindow(event)
23        {
24                rect.w = DST_GetImageWidth(newcon2_gui_infobanner_back);
25                rect.h = DST_GetImageHeight(newcon2_gui_infobanner_back);
26                rect.x = (DST_GetScreenWidth() - rect.w) / 2;
27                rect.y = DST_GetScreenHeight() / 20;
28                SetTimeOut(60);
29        }
30       
31        virtual void OnMessage(SWinEventMsg event)
32        {
33                switch (event.cmd)
34                {
35                        case WM_POWER_OFF:
36                                Close();
37                                break;
38                        case WM_CT_MSG: // Æ©´× ½ÃÀÛ ¸Þ½ÃÁö¸¦ ¹ÞÀ¸¸é °»½Å
39                                if (event.data32[0] == CT_TUNE_START) Show();
40                                SetTimeOut(60);
41                                break;
42                }
43        }
44       
45        virtual void OnTimer(char /*nID*/)
46        {
47                Show();
48        }
49
50        virtual void Show(WinID id)
51        {
52                switch(id)
53                {
54                        case WIN_EWS:
55                        case WIN_CHANNEL_BANNER:
56                        case WIN_DIRECT_TUNE:
57                        case WIN_VOLUME:
58                        case WIN_VOLUME_MUTE:
59                        case WIN_SIGNAL_METER:
60                        case WIN_CLOSED_CAPTION_HOT:
61                        case WIN_AUDIO_HOT:
62                        case WIN_DISPLAY_MODE_HOT:
63                        case WIN_FACTORY_RESET:
64                        case WIN_FACTORY_RESET_ASK:
65//                      case WIN_INFOR_BANNER:
66                        case WIN_MAIN_MENU:
67                        case WIN_POWER_DOWN_CAUTION:
68                        case WIN_SUB_MENU_2DEPTH:
69                        case WIN_SUB_MENU_3DEPTH:
70                        case WIN_SUB_MENU_4DEPTH:
71                        case WIN_AUTO_SEARCH:
72                        case WIN_MANUAL_SEARCH:
73                        case WIN_CHANNEL_LIST:
74                        case WIN_PROGRAM_GUIDE:
75                                Close();
76                                break;
77                        default:
78                                break;
79                }
80        }
81
82  virtual void Show(void)
83        {
84                DrawImage(0, 0, newcon2_gui_infobanner_back);
85               
86                DS_U8 RF = 0;
87                DS_U16 source_id = 0;
88                DST_GetAVState(&RF, 0, &source_id);
89               
90                DrawChannel();
91                DrawTime(RF);
92                DrawProgram(RF, source_id);
93                DrawSignalBar();
94                DrawIcon(RF, source_id);
95               
96                SetTimer(1, 500); // 500ms ¸¶´Ù °»½Å
97                RegisterKey(VK_OK, true);
98                RegisterKey(VK_CANCEL, true);
99        }
100
101        void DrawProgram(int RF, DS_U16 source_id)
102        {
103                if (source_id == 0) return;
104                CDB db;
105                // ÇöÀç ¹æ¼ÛÁßÀÎ ÇÁ·Î±×·¥À» ã´Â´Ù. ÀÌ¹Ì Á¾·áµÈ ¹æ¼ÛÀ» Á¦¿ÜÇÏ°í °¡Àå ½ÃÀ۽ð£ÀÌ ºü¸¥°É·Î Çϳª °í¸¥´Ù
106                db.GetTable("select start_time, length_in_seconds, title from eit_sub "
107                                "where rf = %d and source_id = %d "
108                                "and start_time+length_in_seconds >  %d "
109                                "order by start_time limit 1", RF, source_id, DST_GetCurrentUTCTime());
110                if(db.GetRow() < 1) return;
111                       
112                setFontStyle(20,0xFFC8C8C8,ALIGN_MIDDLE,ALIGN_LEFT);
113                DrawTextUTF8(12, 35, 540, 20, (DS_U8*)db.GetResult(5), &font);
114
115                DS_U16 time[110] = {0,};
116                strcpy16(time, DST_GetTimeString(atoi(db.GetResult(3)),DATE_NO_YEAR_TIME_NO_SEC_DETAIL,true,DST_g_TimeOffset[RF]));
117                strcat16(time, (char *)" - ");
118                strcat16(time, DST_GetTimeString(atoi(db.GetResult(3)) + atoi(db.GetResult(4)),TIME_NO_SEC,true,DST_g_TimeOffset[RF]));
119                DrawTextUni(12, 65, 540, 20 , time, &font);     
120        }
121
122        void DrawTime(int RF)
123        {
124                // ÇöÀç½Ã°£ Ç¥½Ã
125                setFontStyle(20,0xFFC8C8C8,ALIGN_MIDDLE,ALIGN_RIGHT);
126                DS_U32 curTime = DST_GetCurrentUTCTime();
127                // DST_Printf("curTime = %d\n", curTime);
128                if (curTime > 0)
129                {
130                        DS_U16 time[50] = {0,};
131                        strcpy16(time, DST_GetTimeString(curTime,DATE_NO_YEAR_TIME_NO_SEC_DETAIL,true,DST_g_TimeOffset[RF]));
132                        DrawTextUni(12, 5, 540, 20, time, &font);
133                }
134        }
135       
136        void DrawChannel(void)
137        {
138                // ä³Î À̸§ Ç¥½Ã                       
139                DS_U32 ChInfo[40]={0};
140                DST_UI_GetCurrentChannelInfo(ChInfo);
141                setFontStyle(20,0xFFC8C8C8,ALIGN_MIDDLE,ALIGN_LEFT);
142                DrawText32(12, 5, 298, 20, ChInfo,  &font);
143        }
144        void DrawIcon(DS_U8 RF, DS_U16 program_number)
145        {
146                DrawResolution();
147                DrawImage(163, 128, DST_UI_GetCCInfo() ? newcon2_gui_infobanner_cc_enable:newcon2_gui_infobanner_cc_disable);
148
149                DrawImage(118, 128, (CT_GetAudioCount(RF, program_number) > 1) ? newcon2_gui_infobanner_multi_enable : newcon2_gui_infobanner_multi_disable);
150                DS_U8* image  = newcon2_gui_infobanner_stereo_disable;
151                switch (DST_AUD_GetMode())
152                {
153                        case DHL_AUDIO_MONO: image = newcon2_gui_infobanner_stereo_disable; break;// Mono
154                        case DHL_AUDIO_DUAL_MONO: image = newcon2_gui_infobanner_stereo_enable; break; // Dual Mono
155                        case DHL_AUDIO_STEREO:  image = newcon2_gui_infobanner_stereo_enable; break;// Stereo
156                        case DHL_AUDIO_5_1: image = newcon2_gui_infobanner_stereo_disable; break;// 5.1
157                        default: break;
158                }
159                DrawImage(73, 128, image);
160        }
161
162        void DrawResolution(void)
163        {
164                DS_U8 *image = newcon2_gui_infobanner_hdtv_disable;
165                switch (DST_GetResolutionInfo())
166                {
167                        case  1: image = DST_IsVideoPlay() ? newcon2_gui_infobanner_hdtv_disable : newcon2_gui_infobanner_hdtv_disable; break;
168                        case  2: image = DST_IsVideoPlay() ? newcon2_gui_infobanner_hdtv_disable : newcon2_gui_infobanner_hdtv_disable; break;
169                        case  3: image = DST_IsVideoPlay() ? newcon2_gui_infobanner_hdtv_disable : newcon2_gui_infobanner_hdtv_disable; break;
170                        case  4: image = DST_IsVideoPlay() ? newcon2_gui_infobanner_hdtv_disable : newcon2_gui_infobanner_hdtv_disable; break;
171                        case  5: image = DST_IsVideoPlay() ? newcon2_gui_infobanner_hdtv_disable : newcon2_gui_infobanner_hdtv_disable; break;
172                        case  6: image = DST_IsVideoPlay() ? newcon2_gui_infobanner_hdtv_disable : newcon2_gui_infobanner_hdtv_disable; break;
173                        case  7: image = DST_IsVideoPlay() ? newcon2_gui_infobanner_hdtv_disable : newcon2_gui_infobanner_hdtv_disable; break;
174                        case  8: image = DST_IsVideoPlay() ? newcon2_gui_infobanner_hdtv_enable : newcon2_gui_infobanner_hdtv_disable; break;
175                        case  9: image = DST_IsVideoPlay() ? newcon2_gui_infobanner_hdtv_enable : newcon2_gui_infobanner_hdtv_disable; break;
176                        case 10: image = DST_IsVideoPlay() ? newcon2_gui_infobanner_hdtv_enable : newcon2_gui_infobanner_hdtv_disable; break;
177                }
178                DrawImage(12, 128, image);
179        }
180
181        void DrawSignalBar(void)
182        {
183                int xPos        = 358;
184                int yPos        = 133;
185                int width   = 183;
186                int range       = 100;
187                int signal      = DST_GetSignalStrength();
188
189                int division =  width/3;
190                int position = (width*signal)/(range);
191
192                //signal meter
193                for (int i=xPos; i < xPos+position; i++)
194                {
195                        if ((i-xPos) <= division)
196                                DrawImage(i, yPos, newcon2_gui_progress_red);
197                        else if ((i-xPos) <= (division*2))
198                                DrawImage(i, yPos, newcon2_gui_progress_yellow);
199                        else
200                                DrawImage(i, yPos, newcon2_gui_progress_green);
201                }
202        }
203
204        virtual void KeyInput(DS_U8 key, bool /*bRepeat*/)
205        {
206                switch (key)
207                {
208                        case VK_OK:
209                        case VK_CANCEL:
210                          Close();
211                          break;
212                }
213        }
214};
215
216void DST_CreateInforbannerWindow(SWinEventMsg event)
217{
218        DST_AddWin((WinID)(event.data[0]), new CInfobannerWin (event));
219}
Note: See TracBrowser for help on using the repository browser.