source: svn/branches/kctv/zasc/app_c/DST_WinInforbanner.c @ 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: 8.8 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#include "DST_MemoryDB.h"
12
13OSD_PIXEL_T DST_GetAribColor(DS_U8 n);
14DS_U32* DST_UTF82Uni(DS_U8 *utf);
15
16#if 0
17____CInfobannerWin___()
18#endif
19
20//class CInfobannerWin : public CWindow
21//{
22// public:
23//      CInfobannerWin(SWinEventMsg event):CWindow(event)
24        void CInfobannerWin_Constructor(CWindow *this, SWinEventMsg event)
25        {
26                this->SetWinName(this,  "Infobanner");
27                this->rect.w = DST_GetImageWidth(newcon2_gui_infobanner_back);
28                this->rect.h = DST_GetImageHeight(newcon2_gui_infobanner_back);
29                this->rect.x = (DST_GetScreenWidth() - this->rect.w) / 2;
30                this->rect.y = DST_GetScreenHeight() / 20;
31                this->SetTimeOut(this, 100);
32        }
33
34        void CInfobannerWin_Destructor(CWindow *tis)
35        {
36               
37        }
38
39//      virtual void Show(WinID id)
40        void CInfobannerWin_ShowWindow(CWindow *this, WinID id)
41        {
42                switch(id)
43                {
44                        case WIN_DEBUG_SQL:
45                        case WIN_DEBUG_SQL_SUB:
46                        case WIN_ENGINEER_MODE:
47                        case WIN_FREQUENCY_SETTING:             
48                        case WIN_EWS:
49                        case WIN_CHANNEL_BANNER:
50                        case WIN_DIRECT_TUNE:
51                        case WIN_VOLUME:
52                        case WIN_VOLUME_MUTE:
53                        case WIN_SIGNAL_METER:
54                        case WIN_CLOSED_CAPTION_HOT:
55                        case WIN_AUDIO_HOT:
56                        case WIN_DISPLAY_MODE_HOT:
57                        case WIN_FACTORY_RESET:
58                        case WIN_FACTORY_RESET_ASK:
59//                      case WIN_INFOR_BANNER:
60                        case WIN_MAIN_MENU:
61                        case WIN_POWER_DOWN_CAUTION:
62                        case WIN_SUB_MENU_2DEPTH:
63                        case WIN_SUB_MENU_3DEPTH:
64                        case WIN_SUB_MENU_4DEPTH:
65                        case WIN_AUTO_SEARCH:
66                        case WIN_MANUAL_SEARCH:
67                        case WIN_CHANNEL_LIST:
68                        case WIN_PROGRAM_GUIDE:
69                                this->Close(this);
70                                break;
71                        default:
72                                break;
73                }
74        }
75
76        void CInfobannerWin_DrawProgram(CWindow *this, int RF, DS_U16 source_id)
77        {
78#if EPG_SUPPORT
79                DS_U16 time[110] = {0,};
80               
81                if (source_id == 0) return;
82               
83//              CDB db; NewCDB(&db);
84                // ÇöÀç ¹æ¼ÛÁßÀÎ ÇÁ·Î±×·¥À» ã´Â´Ù. ÀÌ¹Ì Á¾·áµÈ ¹æ¼ÛÀ» Á¦¿ÜÇÏ°í °¡Àå ½ÃÀ۽ð£ÀÌ ºü¸¥°É·Î Çϳª °í¸¥´Ù
85//              db.GetTable(&db, "select start_time, length_in_seconds, title from eit_sub "
86//                              "where rf = %d and source_id = %d "
87//                              "and start_time+length_in_seconds >  %d "
88//                              "order by start_time limit 1", RF, source_id, DST_GetCurrentUTCTime());
89                int i;
90                int nPos = -1;
91                DS_U32 min_start_time = 0xFFFFFFFF;             
92                for (i=0; i < DB_EIT_SUB_MAX; i++)
93                {
94                        if (db_eit_sub[i].source_id == 0) continue;
95                        if (db_eit_sub[i].rf != RF) continue;
96                        if (db_eit_sub[i].source_id != source_id) continue;
97                        //DST_Printf("db_eit_sub[%d].rf = %d source_id = %d\n", i, db_eit_sub[i].rf, db_eit_sub[i].source_id);
98                        if (db_eit_sub[i].start_time + db_eit_sub[i].length_in_seconds <= DST_GetCurrentUTCTime()) continue;
99                        if (db_eit_sub[i].start_time < min_start_time)
100                        {
101                                min_start_time = db_eit_sub[i].start_time;
102                                nPos = i;
103                        }
104                }               
105                if(nPos < 0) 
106                {
107                        return;
108                }
109                       
110                this->setFontStyle(this, 20,0xFFC8C8C8,ALIGN_MIDDLE,ALIGN_LEFT);
111                this->DrawTextUTF8(this, 12, 35, 540, 20, db_eit_sub[nPos].title, &(this->font));
112
113                strcpy16(time, DST_GetTimeString(db_eit_sub[nPos].start_time, DATE_NO_YEAR_TIME_NO_SEC_DETAIL,true,DST_g_TimeOffset[RF]));
114                strcat16_8(time, (char *)" - ");
115                strcat16(time, DST_GetTimeString(db_eit_sub[nPos].start_time+ db_eit_sub[nPos].length_in_seconds,TIME_NO_SEC,true,DST_g_TimeOffset[RF]));
116                this->DrawTextUni(this, 12, 65, 540, 20 , time, &(this->font));         
117//              DeleteCDB(&db);
118#endif
119        }
120
121        void CInfobannerWin_DrawTime(CWindow *this, int RF)
122        {
123                DS_U32 curTime = DST_GetCurrentUTCTime();
124                // ÇöÀç½Ã°£ Ç¥½Ã
125                this->setFontStyle(this, 20,0xFFC8C8C8,ALIGN_MIDDLE,ALIGN_RIGHT);
126                // DST_Printf("curTime = %d\n", curTime);
127                if (curTime > 0)
128                {
129                        DS_U16 time[50] = {0,};
130                        strcpy16(time, DST_GetTimeString(curTime,DATE_NO_YEAR_TIME_NO_SEC_DETAIL,true,DST_g_TimeOffset[RF]));
131                        this->DrawTextUni(this, 12, 5, 540, 20, time, &(this->font));
132                }
133        }
134       
135        void CInfobannerWin_DrawChannel(CWindow *this)
136        {
137                // ä³Î À̸§ Ç¥½Ã                       
138                DS_U32 ChInfo[100]={0};
139                DST_UI_GetCurrentChannelInfo(ChInfo);
140                this->setFontStyle(this, 20,0xFFC8C8C8,ALIGN_MIDDLE,ALIGN_LEFT);
141                this->DrawText32(this, 12, 5, 298, 20, ChInfo,  &(this->font));
142        }
143
144        void CInfobannerWin_DrawResolution(CWindow *this)
145        {
146                DS_U8 *image = newcon2_gui_infobanner_hdtv_disable;
147                switch (DST_GetResolutionInfo())
148                {
149                        case  1: image = DST_IsVideoPlay() ? newcon2_gui_infobanner_hdtv_disable : newcon2_gui_infobanner_hdtv_disable; break;
150                        case  2: image = DST_IsVideoPlay() ? newcon2_gui_infobanner_hdtv_disable : newcon2_gui_infobanner_hdtv_disable; break;
151                        case  3: image = DST_IsVideoPlay() ? newcon2_gui_infobanner_hdtv_disable : newcon2_gui_infobanner_hdtv_disable; break;
152                        case  4: image = DST_IsVideoPlay() ? newcon2_gui_infobanner_hdtv_disable : newcon2_gui_infobanner_hdtv_disable; break;
153                        case  5: image = DST_IsVideoPlay() ? newcon2_gui_infobanner_hdtv_disable : newcon2_gui_infobanner_hdtv_disable; break;
154                        case  6: image = DST_IsVideoPlay() ? newcon2_gui_infobanner_hdtv_disable : newcon2_gui_infobanner_hdtv_disable; break;
155                        case  7: image = DST_IsVideoPlay() ? newcon2_gui_infobanner_hdtv_disable : newcon2_gui_infobanner_hdtv_disable; break;
156                        case  8: image = DST_IsVideoPlay() ? newcon2_gui_infobanner_hdtv_enable : newcon2_gui_infobanner_hdtv_disable; break;
157                        case  9: image = DST_IsVideoPlay() ? newcon2_gui_infobanner_hdtv_enable : newcon2_gui_infobanner_hdtv_disable; break;
158                        case 10: image = DST_IsVideoPlay() ? newcon2_gui_infobanner_hdtv_enable : newcon2_gui_infobanner_hdtv_disable; break;
159                }
160                this->DrawImage(this, 12, 128, image, false);
161        }
162       
163        void CInfobannerWin_DrawIcon(CWindow *this, DS_U8 RF, DS_U16 program_number)
164        {
165                DS_U8* image  = newcon2_gui_infobanner_stereo_disable;
166               
167                CInfobannerWin_DrawResolution(this);
168                this->DrawImage(this, 163, 128, DST_UI_GetCCInfo() ? newcon2_gui_infobanner_cc_enable:newcon2_gui_infobanner_cc_disable, false);
169
170                this->DrawImage(this, 118, 128, (CT_GetAudioCount(RF, program_number) > 1) ? newcon2_gui_infobanner_multi_enable : newcon2_gui_infobanner_multi_disable, false);
171                switch (DST_AUD_GetMode())
172                {
173                        case DHL_AUDIO_MONO: image = newcon2_gui_infobanner_stereo_disable; break;// Mono
174                        case DHL_AUDIO_DUAL_MONO: image = newcon2_gui_infobanner_stereo_enable; break; // Dual Mono
175                        case DHL_AUDIO_STEREO:  image = newcon2_gui_infobanner_stereo_enable; break;// Stereo
176                        case DHL_AUDIO_5_1: image = newcon2_gui_infobanner_stereo_disable; break;// 5.1
177                        default: break;
178                }
179                this->DrawImage(this, 73, 128, image, false);
180        }
181       
182        void CInfobannerWin_DrawSignalBar(CWindow *this)
183        {
184                int xPos        = 358;
185                int yPos        = 133;
186                int width   = 183;
187                int range       = 100;
188                int signal      = DST_GetSignalStrength();
189
190                int division =  width/3;
191                int position = (width*signal)/(range);
192
193                int i = 0;
194                //signal meter
195                for ( i=xPos; i < xPos+position; i++)
196                {
197                        if ((i-xPos) <= division)
198                                this->DrawImage(this, i, yPos, newcon2_gui_progress_red, false);
199                        else if ((i-xPos) <= (division*2))
200                                this->DrawImage(this, i, yPos, newcon2_gui_progress_yellow, false);
201                        else
202                                this->DrawImage(this, i, yPos, newcon2_gui_progress_green, false);
203                }
204        }
205
206
207//  virtual void Show(void)
208        void CInfobannerWin_Show(CWindow *this)
209        {       
210                DS_U8 RF = 0;
211                DS_U16 source_id = 0;
212               
213                this->DrawImage(this, 0, 0, newcon2_gui_infobanner_back, false);
214                DST_GetAVState(&RF, 0, &source_id);
215               
216                CInfobannerWin_DrawChannel(this);
217                CInfobannerWin_DrawTime(this, RF);
218                CInfobannerWin_DrawProgram(this, RF, source_id);
219                CInfobannerWin_DrawSignalBar(this);
220                CInfobannerWin_DrawIcon(this, RF, source_id);
221               
222                this->SetTimer(this, 1, 500); // 500ms ¸¶´Ù °»½Å
223                this->RegisterKey(this, VK_OK, true, 0, 0);
224                this->RegisterKey(this, VK_CANCEL, true, 0, 0);
225        }
226
227//      virtual void OnMessage(SWinEventMsg event)
228        void CInfobannerWin_OnMessage(CWindow *this, SWinEventMsg event)
229        {
230                switch (event.cmd)
231                {
232                        case WM_POWER_OFF:
233                                this->Close(this);
234                                break;
235                        case WM_CT_MSG: // Æ©´× ½ÃÀÛ ¸Þ½ÃÁö¸¦ ¹ÞÀ¸¸é °»½Å
236                                if (event.data32[0] == CT_TUNE_START) this->Show(this);
237                                this->SetTimeOut(this, 100);
238                                break;
239                }
240        }
241       
242//      virtual void OnTimer(char /*nID*/)
243        void CInfobannerWin_OnTimer(CWindow *this, char nID)
244        {
245                this->Show(this);
246        }
247
248
249//      virtual void KeyInput(DS_U8 key, bool /*bRepeat*/)
250        void CInfobannerWin_KeyInput(CWindow *this, DS_U8 key, bool bRepeat)
251        {
252                switch (key)
253                {
254                        case VK_OK:
255                        case VK_CANCEL:
256                          this->Close(this);
257                          break;
258                }
259        }
260//};
261
262void DST_CreateInforbannerWindow(SWinEventMsg event)
263{
264        CWindow*pWin = NewCWindow(event);
265        pWin->Destructor        = CInfobannerWin_Destructor;
266        pWin->KeyInput          = CInfobannerWin_KeyInput;
267        pWin->OnMessage         = CInfobannerWin_OnMessage;
268        pWin->OnTimer           = CInfobannerWin_OnTimer;
269        pWin->ShowWindow        = CInfobannerWin_ShowWindow;
270        pWin->Show                      = CInfobannerWin_Show;
271        // »ý¼ºÀÚ È£Ãâ
272        CInfobannerWin_Constructor(pWin, event);
273        // À©µµ¿ì ¸Þ´ÏÀú¿¡ µî·Ï
274        DST_AddWin((WinID)(event.data[0]), pWin);
275}
Note: See TracBrowser for help on using the repository browser.