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

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

1.phkim

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