source: svn/zasc/app_c/DST_WinSignalBanner.c @ 22

Last change on this file since 22 was 22, checked in by phkim, 11 years ago
  1. phkim
  2. newcon3sk 를 kctv 로 브랜치 함
File size: 7.9 KB
Line 
1#include "DST_WinManager.h"
2#include "DST_OSDImage.h"
3#include "DST_UserInterface.h"
4#include "DST_DataStrings.h"
5
6#if 0
7____CMovingBannerWin___()
8#endif
9
10
11//class CErrorWin : public CWindow
12//{
13//private:
14        static DS_U8 CErrorWin_nErrorNumber;
15        static DS_U8 CErrorWin_nParameter;
16        static int CErrorWin_nWidth;
17//public:
18void CErrorWin_GetPos(CWindow *this);
19
20//      CErrorWin(SWinEventMsg event):CWindow(event)
21        void CErrorWin_Constructor(CWindow *this, SWinEventMsg event)
22        {
23                this->SetWinName(this,  "Error");
24                CErrorWin_nErrorNumber  = event.data[2];
25                CErrorWin_nParameter    = event.data[3];
26                CErrorWin_nWidth = 0;
27                switch(CErrorWin_nErrorNumber)
28                {
29                        case SM_AUDIO_ONLY:
30                                this->rect.w = DST_GetImageWidth(imgaudio);
31                                this->rect.h = DST_GetImageHeight(imgaudio);
32                                this->rect.x = (DST_GetScreenWidth() - this->rect.w) / 2;
33                                this->rect.y = (DST_GetScreenHeight() - this->rect.h) / 2;
34                                DST_CreateWin(WIN_CHANNEL_BANNER, WIN_NULL, BANNER_NORMAL ,0, 0, 0);
35                                break;
36
37                        case SM_NO_PROGRAM:
38                                {
39                                        CErrorWin_nWidth = DST_GetTextWidthUni(pz_NoProgram[OSD_Lang],30); 
40                                        this->rect.w = 9+DST_GetImageWidth(bracon_gui_caution)+10+CErrorWin_nWidth+10;
41                                        this->rect.h = 92;
42                                        CErrorWin_GetPos(this);
43                                }
44                                break;
45                        case SM_WEAK_SIGNAL:
46                                this->rect.w = DST_GetImageWidth(pin_change_back);
47                                this->rect.h = DST_GetImageHeight(pin_change_back);
48                                this->rect.x = (DST_GetScreenWidth() - this->rect.w) / 2;
49                                this->rect.y = (DST_GetScreenHeight() - this->rect.h) / 2;
50                                break;
51                               
52                        default: break;
53                }
54
55                this->SetTimeOut(this, 0);
56        }
57
58        void CErrorWin_Destructor(CWindow *this)
59        {
60        }
61       
62        void CErrorWin_GetPos(CWindow *this)
63        {
64                static DS_U8 nPos = 0;
65                int x = 0, y = 0;
66                int sw = DST_GetScreenWidth();
67                int sh = DST_GetScreenHeight();
68                int iw = this->rect.w;
69                int ih = this->rect.h;
70                int min_x = 0;
71                int min_y = 0;
72                int max_x = 0;
73                int max_y = 0;
74                switch (nPos)
75                {
76                        case 0: x = sw*2/4; y = sh*2/4; break;
77                        case 1: x = sw*1/4; y = sh*1/4; break;
78                        case 2: x = sw*3/4; y = sh*1/4; break;
79                        case 3: x = sw*1/4; y = sh*3/4; break;
80                        case 4: x = sw*3/4; y = sh*3/4; break;
81                }
82                x-=(iw / 2);
83                y-=(ih / 2);
84                min_x = sw/10;
85                min_y = sh/10;
86                max_x = (sw*9/10) - iw;
87                max_y = (sh*9/10) - ih;
88                if (x < min_x) x = min_x;
89                if (y < min_y) y = min_y;
90                if (x > max_x) x = max_x;
91                if (y > max_y) y = max_y;
92                nPos = (nPos >= 4) ? 0 : nPos + 1;
93                this->rect.x=x; this->rect.y=y;
94        }
95
96
97//      virtual void Show()
98        void CErrorWin_Show(CWindow *this)
99        {
100       
101                this->setFontStyle(this, 25,0xFF000000,ALIGN_MIDDLE,ALIGN_CENTER);
102                // ¹è°æ
103                switch (CErrorWin_nErrorNumber)
104                {
105                        case SM_AUDIO_ONLY:
106                                this->DrawImage(this, 0, 0, imgaudio, false);
107                                break;
108                        case SM_NO_PROGRAM:
109                                this->DrawBox32(this, 0, 0, this->rect.w, this->rect.h, CONV32_16(0x00FFFFFF));
110                                this->DrawImage(this, 9, 9, bracon_gui_caution,true);
111                                this->DrawTextUni(this, 11+DST_GetImageWidth(bracon_gui_caution)+10, 2, CErrorWin_nWidth, this->rect.h-2, pz_NoProgram[OSD_Lang], &(this->font));
112                                this->setFontStyle(this, 25,0xFFC8C8C8,ALIGN_MIDDLE,ALIGN_CENTER);
113                                this->DrawTextUni(this, 9+DST_GetImageWidth(bracon_gui_caution)+10, 0, CErrorWin_nWidth, this->rect.h-2, pz_NoProgram[OSD_Lang], &(this->font));
114                                this->SetTimer(this, 1, 1000);                         
115                                break;
116                        case SM_WEAK_SIGNAL:
117                                this->DrawImage(this, 0, 0, pin_change_back, false);
118                                this->setFontStyle(this, 21, 0xFFC8C8C8, ALIGN_MIDDLE, ALIGN_CENTER);
119                                this->RegisterKey(this, VK_OK, true, 0, 0);
120                                int     center_pos =  this->rect.h / 2; 
121                                int     line_spacing = DST_GetFontHeight(this->FontGetSize(this)) * 150 / 100;
122                               
123                                this->DrawTextUni(this, 0, center_pos-2*line_spacing, this->rect.w, line_spacing, pz_WeakSignal1[OSD_Lang], &(this->font)); 
124                                this->DrawTextUni(this, 0, center_pos-line_spacing, this->rect.w, line_spacing, pz_WeakSignal2[OSD_Lang], &(this->font)); 
125                                this->DrawTextUni(this, 0, center_pos, this->rect.w, line_spacing, pz_WeakSignal3[OSD_Lang], &(this->font)); 
126                                this->DrawTextUni(this, 0, center_pos+line_spacing, this->rect.w, line_spacing, pz_WeakSignal4[OSD_Lang], &(this->font));                               
127                                break;
128                        default: break;
129
130                }
131               
132               
133               
134        }
135
136//      virtual void OnMessage(SWinEventMsg event)
137        void CErrorWin_OnMessage(CWindow *this, SWinEventMsg event)
138        {
139                switch (event.cmd)
140                {
141                        case WM_POWER_OFF:
142                                this->Close(this);
143                                break;
144                        default: break;
145                }
146        }
147
148//      virtual void OnTimer(char /*nID*/)
149        void CErrorWin_OnTimer(CWindow *this, char nID)
150        {
151                this->UpdateScreen(this);
152                CErrorWin_GetPos(this);
153                this->UpdateScreen(this);
154        }       
155
156//      virtual void Show(WinID id)
157        void CErrorWin_ShowWindow(CWindow *this, WinID id)
158        {
159                if(CErrorWin_nErrorNumber == SM_AUDIO_ONLY) return;
160                switch(id)
161                {
162                        case WIN_DEBUG_SQL:
163                        case WIN_DEBUG_SQL_SUB:
164                        case WIN_ENGINEER_MODE:
165                        case WIN_FREQUENCY_SETTING:             
166                        case WIN_EWS:
167                        case WIN_CHANNEL_BANNER:
168                        case WIN_DIRECT_TUNE:
169//                      case WIN_VOLUME:
170//                      case WIN_VOLUME_MUTE:
171                        case WIN_SIGNAL_METER:
172//                      case WIN_CLOSED_CAPTION_HOT:
173                        case WIN_AUDIO_HOT:
174                        case WIN_DISPLAY_MODE_HOT:
175                        case WIN_FACTORY_RESET:
176                        case WIN_FACTORY_RESET_ASK:
177                        case WIN_MAIN_MENU:
178                        case WIN_POWER_DOWN_CAUTION:
179                        case WIN_SUB_MENU_2DEPTH:
180                        case WIN_SUB_MENU_3DEPTH:
181                        case WIN_SUB_MENU_4DEPTH:
182                        case WIN_AUTO_SEARCH:
183                        case WIN_MANUAL_SEARCH:
184                        case WIN_CHANNEL_LIST:
185                        case WIN_PROGRAM_GUIDE:
186                        case WIN_STATION_SEARCH:
187                        case WIN_PASSWD_CHANGE:
188                                if (CErrorWin_nErrorNumber == SM_WEAK_SIGNAL && id == WIN_CHANNEL_BANNER)
189                                {
190                                        break;
191                                }
192                                else
193                                {
194                                        this->Close(this);
195                                        break;
196                                }
197                        case WIN_PASSWD_CHECK:
198                        case WIN_PASSWD_CONFIRM:
199                                this->SetVisible(this, false);
200                                break;
201                        default:
202                                break;
203                }
204        }
205
206        void CErrorWin_KeyInput(CWindow *this, DS_U8 key, bool bRepeat)
207        {
208                switch (key)
209                {
210                        case VK_OK:
211                                DST_CreateWin(WIN_AUTO_SEARCH, WIN_NULL, 1, 0, 0, 0); 
212                                this->Close(this);
213                                if(DST_UI_GetMute() && DST_GetWin(WIN_VOLUME_MUTE)==0) DST_CreateWin(WIN_VOLUME_MUTE, 0, 0, 0, 0, 0);
214                                break;
215
216                        default:
217                                break;
218
219                }
220        }
221
222//};
223
224void DST_CreateErrorWin(SWinEventMsg event)
225{
226        static DS_U8 nState = 0;
227//      DST_Printf("DST_GetWin(WIN_ERROR)=%d nState=%d  event.data[2]=%d\n",DST_GetWin(WIN_ERROR),nState, event.data[2]);
228        if (DST_GetWin(WIN_ERROR) != 0  && nState == event.data[2]) return; // ÀÌ¹Ì Ã³¸®ÁßÀ̶ó¸é ¹«½Ã
229       
230        if (DST_GetWin(WIN_EWS)) return;
231        if (DST_GetWin(WIN_CHANNEL_BANNER)) 
232        {
233                if (event.data[2] != SM_AUDIO_ONLY)
234                {
235                        if(nState != SM_AUDIO_ONLY) return;
236                        else 
237                        {
238                                if(event.data[2] == SM_WEAK_SIGNAL)
239                                        DST_CreateWin(WIN_CHANNEL_BANNER, WIN_NULL, BANNER_NORMAL ,3, 0, 0);
240                                else
241                                        DST_CloseWin(WIN_CHANNEL_BANNER);
242                        }
243                }
244        }
245
246        if (DST_GetWin(WIN_DIRECT_TUNE)) return;
247//      if (DST_GetWin(WIN_VOLUME)) return;
248//      if (DST_GetWin(WIN_VOLUME_MUTE)) return;
249        if (DST_GetWin(WIN_SIGNAL_METER)) return;
250//      if (DST_GetWin(WIN_CLOSED_CAPTION_HOT)) return;
251        if (DST_GetWin(WIN_AUDIO_HOT)) return;
252        if (DST_GetWin(WIN_DISPLAY_MODE_HOT)) return;
253        if (DST_GetWin(WIN_FACTORY_RESET)) return;
254        if (DST_GetWin(WIN_FACTORY_RESET_ASK)) return;
255//      if (DST_GetWin(WIN_INFOR_BANNER)) return;
256        if (DST_GetWin(WIN_MAIN_MENU)) return;
257        if (DST_GetWin(WIN_POWER_DOWN_CAUTION)) return;
258        if (DST_GetWin(WIN_SUB_MENU_2DEPTH)) return;
259        if (DST_GetWin(WIN_SUB_MENU_3DEPTH)) return;
260        if (DST_GetWin(WIN_AUTO_SEARCH)) return;
261        if (DST_GetWin(WIN_MANUAL_SEARCH)) return;
262        if (DST_GetWin(WIN_CHANNEL_LIST)) return;
263        if (DST_GetWin(WIN_PROGRAM_GUIDE)) return;
264        if (DST_GetWin(WIN_PASSWD_CHANGE)) return;
265        if (DST_GetWin(WIN_PASSWD_CHECK)) return;
266        if (DST_GetWin(WIN_PASSWD_CONFIRM)) return;
267        if (DST_GetWin(WIN_AGE_RATING)) return;
268//      T();
269        nState = event.data[2];
270
271        CWindow*pWin = NewCWindow(event);
272        pWin->Destructor        = CErrorWin_Destructor;
273        pWin->OnMessage         = CErrorWin_OnMessage;
274        pWin->OnTimer           = CErrorWin_OnTimer;
275        pWin->ShowWindow        = CErrorWin_ShowWindow;
276        pWin->Show                      = CErrorWin_Show;
277        pWin->KeyInput          = CErrorWin_KeyInput;
278        // »ý¼ºÀÚ È£Ãâ
279        CErrorWin_Constructor(pWin, event);
280        // À©µµ¿ì ¸Þ´ÏÀú¿¡ µî·Ï
281        DST_AddWin((WinID)(event.data[0]), pWin);
282}
283
Note: See TracBrowser for help on using the repository browser.