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

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

first commit

File size: 5.0 KB
Line 
1#include "DST_WinManager.h"
2#include "DST_OSDImage.h"
3#include "DST_CommonAPI.h"
4#include "DST_UserInterface.h"
5#include "DST_DataStrings.h"
6#include "DST_SignalMonitor.h"
7
8#if 0
9____CVolumeWin___()
10#endif
11
12
13//class CSignalMeterWin : public CWindow
14//{
15//public:
16//      CSignalMeterWin(SWinEventMsg event):CWindow(event)
17        void CSignalMeterWin_Constructor(CWindow *this, SWinEventMsg event)
18        {
19                this->SetWinName(this,  "SignalMeter");
20                this->rect.w = DST_GetImageWidth(pin_change_back);
21                this->rect.h = DST_GetImageHeight(pin_change_back);
22                this->rect.x = (DST_GetScreenWidth() - this->rect.w) / 2;
23                this->rect.y = (DST_GetScreenHeight() - this->rect.h) / 2;
24
25                this->SetTimeOut(this, 0);
26        }
27
28        void CSignalMeterWin_Destructor(CWindow *this)
29        {
30        }
31       
32//      virtual void Show(WinID id)
33        void CSignalMeterWin_ShowWindow(CWindow *this, WinID id)
34        {
35                switch(id)
36                {
37                        case WIN_DEBUG_SQL:
38                        case WIN_DEBUG_SQL_SUB:
39                        case WIN_ENGINEER_MODE:         
40                        case WIN_EWS:
41                        case WIN_CHANNEL_BANNER:
42                        case WIN_DIRECT_TUNE:
43                        case WIN_VOLUME:
44                        case WIN_VOLUME_MUTE:
45                        case WIN_AUDIO_HOT:
46                        case WIN_DISPLAY_MODE_HOT:
47                        case WIN_CLOSED_CAPTION_HOT:
48                        case WIN_FACTORY_RESET:
49                        case WIN_FACTORY_RESET_ASK:
50                        case WIN_INFOR_BANNER:
51                        case WIN_MAIN_MENU:
52                        case WIN_POWER_DOWN_CAUTION:
53                        case WIN_SUB_MENU_2DEPTH:
54                        case WIN_SUB_MENU_3DEPTH:
55                        case WIN_SUB_MENU_4DEPTH:
56                        case WIN_AUTO_SEARCH:
57                        case WIN_MANUAL_SEARCH:
58                        case WIN_CHANNEL_LIST:
59                        case WIN_PROGRAM_GUIDE:
60                                this->Close(this);
61                                break;
62                        default:
63                                break;
64                }
65        }
66
67//      virtual void OnMessage(SWinEventMsg event)
68        void CSignalMeterWin_OnMessage(CWindow *this, SWinEventMsg event)
69        {
70                switch (event.cmd)
71                {
72                        case WM_POWER_OFF:
73                                this->Close(this);
74                                break;
75                        default: break;
76                }
77        }
78
79        void CSignalMeterWin_DrawSignalBar(CWindow *this)
80        {
81                int xPos        = 53;
82                int yPos        = 168;
83                int width   = 273;
84                int range       = 100;
85                int division =  width/3;
86                int signal      = DST_GetSignalStrength();
87                int position = (width*signal)/(range);
88                int i = 0;
89               
90                this->DrawImage(this, xPos-1, yPos-1, Strength_prog_back, false);
91                //signal meter
92                for ( i=xPos; i < xPos+position; i++)
93                {
94                        if ((i-xPos) <= division)
95                                this->DrawImage(this, i, yPos, signal_prog_r, false);
96                        else if ((i-xPos) <= (division*2))
97                                this->DrawImage(this, i, yPos, signal_prog_y, false);
98                        else
99                                this->DrawImage(this, i, yPos, signal_prog_g, false);
100                }
101                if(signal == 100)
102                        this->DrawImage(this, xPos+position, yPos, signal_prog_g, false);
103
104        }
105       
106        void CSignalMeterWin_Draw(CWindow *this)
107        {
108                this->RegisterKey(this, VK_CANCEL, true, 0, 0);
109                this->RegisterKey(this, VK_OK, true, 0, 0);
110                this->RegisterKey(this, VK_MENU, true, 0, 0);
111                this->RegisterKey(this, VK_PREV, true, 0, 0);
112                this->RegisterKey(this, VK_PREV_CH, true, 0, 0);
113                this->RegisterKey(this, VK_PREV_MENU, true, 0, 0);
114                this->DrawImage(this, 0, 0, pin_change_back, false);
115
116               
117                this->DrawImage(this, 44, 39, icon_signal, false);
118                this->setFontStyle(this, 20, 0xFFC8C8C8, ALIGN_MIDDLE, ALIGN_LEFT);
119                this->DrawTextUni(this, 133 , 49, 212, 24, pz_Sub_SignalMeter_E1[OSD_Lang], &(this->font));
120                this->DrawTextUni(this, 133 , 49+38, 212, 24, pz_Sub_SignalMeter_E2[OSD_Lang], &(this->font));
121
122                this->setFontStyle(this, 20, 0xFFC8C8C8, ALIGN_MIDDLE, ALIGN_CENTER);
123
124                //signal text
125                char tmp[5]={0};
126                int signal      = DST_GetSignalStrength();
127                sprintf(tmp, "%d", signal);
128                this->DrawText(this,0, 129, this->rect.w, 24, tmp, &(this->font));
129
130
131                this->DrawTextUni(this, 52 , 189, 67, 24, pz_Weak[OSD_Lang], &(this->font));
132                this->DrawTextUni(this, 262 , 189, 67, 24, pz_Good[OSD_Lang], &(this->font));
133               
134                CSignalMeterWin_DrawSignalBar(this);
135                this->SetTimer(this,1,500);
136        }       
137
138//      virtual void Show()
139        void CSignalMeterWin_Show(CWindow *this)
140        {
141                CSignalMeterWin_Draw(this);
142        }
143
144//      virtual void OnTimer(char nID)
145        void CSignalMeterWin_OnTimer(CWindow *this, char nID)
146        {
147                switch(nID)
148                {
149                        case 1:
150                                this->KillTimer(this, 1);
151                                CSignalMeterWin_Draw(this);
152                                break;
153                        default:
154                                break;
155                }
156        }
157
158//      virtual void KeyInput(DS_U8 key, bool /*bRepeat*/)
159        void CSignalMeterWin_KeyInput(CWindow *this, DS_U8 key, bool bRepeat)
160        {
161                switch (key)
162                {
163                        case VK_MENU:
164                        case VK_CANCEL:
165                        case VK_PREV_MENU:
166                        case VK_OK:
167                        case VK_PREV:
168                        case VK_PREV_CH:                               
169                                this->Close(this);
170                                if(DST_UI_GetMute() && DST_GetWin(WIN_VOLUME_MUTE)==0) DST_CreateWin(WIN_VOLUME_MUTE, 0, 0, 0, 0, 0);
171                                break;
172
173                        default:
174                                break;
175
176                }
177        }
178
179
180//};
181
182void DST_CreateSignalMeterWindow(SWinEventMsg event)
183{
184        CWindow*pWin = NewCWindow(event);
185        pWin->Destructor        = CSignalMeterWin_Destructor;
186        pWin->KeyInput          = CSignalMeterWin_KeyInput;
187        pWin->OnTimer           = CSignalMeterWin_OnTimer;
188        pWin->OnMessage         = CSignalMeterWin_OnMessage;
189        pWin->ShowWindow        = CSignalMeterWin_ShowWindow;
190        pWin->Show                      = CSignalMeterWin_Show;
191        // »ý¼ºÀÚ È£Ãâ
192        CSignalMeterWin_Constructor(pWin, event);
193        // À©µµ¿ì ¸Þ´ÏÀú¿¡ µî·Ï
194        DST_AddWin((WinID)(event.data[0]), pWin);
195}
196
197
198
Note: See TracBrowser for help on using the repository browser.