source: svn/trunk/zasc/app_c/DST_WinFrequencySetting.c @ 34

Last change on this file since 34 was 34, checked in by jglee, 11 years ago
File size: 7.1 KB
Line 
1#include "DST_Window.h"
2#include "DST_WinManager.h"
3#include "DST_CommonAPI.h"
4#include "DST_UserInterface.h"
5#include "DST_DataStrings.h"
6#include "DST_ISDBT_ChannelTask.h"
7#include "DST_DB.h"
8#include "DST_ChannelTune.h"
9#include "DST_SignalMonitor.h"
10
11#ifndef DSTAR
12#include "DHL_OSAL.h"
13#include "DHL_OSAL_Priv.h"
14#include "bcmmemmgr.h"
15#endif
16
17extern DS_U8 pin_change_back[];
18
19#if 0
20____CFrequncySettingWin___()
21#endif
22
23static int nPos = 0;
24
25//class CFrequncySettingWin : public CWindow
26//{
27//private:
28//     
29//public:
30//      CFrequncySettingWin(SWinEventMsg event):CWindow(event)
31        void CFrequncySettingWin_Constructor(CWindow *this, SWinEventMsg event)
32        {
33                this->SetWinName(this,  "FrequencySetting");
34                this->setFontStyle(this, 22, 0xFFFFFFFF, ALIGN_MIDDLE, ALIGN_LEFT);
35                this->rect.w = DST_GetImageWidth(pin_change_back);
36                this->rect.h = DST_GetImageHeight(pin_change_back);;
37                this->rect.x = (DST_GetScreenWidth() - this->rect.w) / 2;
38                this->rect.y = (DST_GetScreenHeight() - this->rect.h) / 2;
39                nPos = 0;
40
41                this->SetTimeOut(this, 0);
42        }
43
44        void CFrequncySettingWin_Destructor(CWindow *this)
45        {
46        }
47       
48//      virtual void OnTimer(char nID)
49        void CFrequncySettingWin_OnTimer(CWindow *this, char nID)
50        {
51        }
52
53//      virtual void Show(WinID id)
54        void CFrequncySettingWin_ShowWindow(CWindow *this, WinID id)
55        {
56                switch(id)
57                {
58                        case WIN_EWS:
59                        case WIN_ENGINEER_MODE:
60                        case WIN_DEBUG_SQL:
61                        case WIN_DEBUG_SQL_SUB:
62                        case WIN_DIRECT_TUNE:
63                        case WIN_VOLUME:
64                        case WIN_VOLUME_MUTE:
65                        case WIN_SIGNAL_METER:
66                        case WIN_CLOSED_CAPTION_HOT:
67                        case WIN_AUDIO_HOT:
68                        case WIN_DISPLAY_MODE_HOT:
69                        case WIN_FACTORY_RESET:
70                        case WIN_FACTORY_RESET_ASK:
71                        case WIN_INFOR_BANNER:
72                        case WIN_POWER_DOWN_CAUTION:
73                        case WIN_MAIN_MENU:
74                        case WIN_SUB_MENU_2DEPTH:
75                        case WIN_SUB_MENU_3DEPTH:
76                        case WIN_SUB_MENU_4DEPTH:
77                        case WIN_AUTO_SEARCH:
78                        case WIN_MANUAL_SEARCH:
79                        case WIN_CHANNEL_LIST:
80                        case WIN_PROGRAM_GUIDE:
81                        case WIN_PASSWD_CHANGE:
82                        case WIN_PASSWD_CHECK:
83                        case WIN_PASSWD_CONFIRM:
84                        case WIN_AGE_RATING:
85                                this->Close(this);
86                                break;
87                        default:
88                                break;
89                }
90        }
91
92//      virtual void Show()
93        void CFrequncySettingWin_Show(CWindow *this)
94        {
95                this->RegisterAllKey(this);
96                                this->RegisterKey(this, VK_PWR, false, 0, 0);
97                // background
98                this->DrawImage(this, 0, 0, pin_change_back, false);
99       
100                char strText[256];
101               
102                int nLineHeight = (this->rect.h) / 6;
103                // title
104                this->setFontStyle(this, 21, 0xFFC8C8C8, ALIGN_MIDDLE, ALIGN_CENTER);
105                this->DrawText(this, 0, 0, this->rect.w, nLineHeight*2, (char*)"Frequency Setting", &(this->font));
106
107
108                // display max
109                switch(nPos)
110                {
111
112                        case 0:
113                                this->setFontStyle(this, 22, 0xFFFFFFFF, ALIGN_MIDDLE, ALIGN_CENTER);
114                               
115                                break;
116                        case 1:
117                                this->setFontStyle(this, 21, 0xFFAAAAAA, ALIGN_MIDDLE, ALIGN_CENTER);
118                               
119                                break;
120                        default:break;
121                }
122
123                int num = DST_EEPROM_GetMinRF();
124               
125                        int rf = DST_GetFrequencyNumberbyIndex(num);
126                        int freq = DST_GetMHzFrequencybyIndex(num);
127                        sprintf(strText, "< Min : %d ( %dMHz ) >", rf, freq);
128
129                this->DrawText(this, 0, nLineHeight * 2, this->rect.w, nLineHeight, (char*)strText, &(this->font));
130                // display min
131                switch(nPos)
132                {
133
134                        case 0:
135                                this->setFontStyle(this, 21, 0xFFAAAAAA, ALIGN_MIDDLE, ALIGN_CENTER);
136                               
137                                break;
138                        case 1:
139                                this->setFontStyle(this, 22, 0xFFFFFFFF, ALIGN_MIDDLE, ALIGN_CENTER);
140                               
141                                break;
142                        default:break;
143                }
144
145                num = DST_EEPROM_GetMaxRF();
146
147                rf = DST_GetFrequencyNumberbyIndex(num);
148                freq = DST_GetMHzFrequencybyIndex(num);
149                sprintf(strText, "< Max : %d ( %dMHz ) >", rf, freq);
150
151
152                this->DrawText(this, 0, nLineHeight * 3, this->rect.w, nLineHeight, (char*)strText, &(this->font));
153                // descriptor
154                this->setFontStyle(this, 18, 0xFF666666, ALIGN_MIDDLE, ALIGN_CENTER);
155                this->DrawText(this, 0, nLineHeight * 5, this->rect.w, nLineHeight, (char*)"Up/Down : Next", &(this->font));
156        }
157
158
159//      virtual void KeyInput(DS_U8 key, bool /*bRepeat*/)
160        void IncreaseMaxRF()
161        {
162                if (DST_EEPROM_GetMaxRF() >= DST_MaxRF()) 
163                {
164                        DST_EEPROM_SetMaxRF(DST_MaxRF());
165                        return;
166                }
167                else if (DST_EEPROM_GetMinRF() > DST_EEPROM_GetMaxRF())
168                {
169                        DST_EEPROM_SetMaxRF(DST_EEPROM_GetMinRF());
170                        return;
171                }
172                DST_EEPROM_SetMaxRF(DST_EEPROM_GetMaxRF() + 1);
173        }
174        void DecreaseMinRF()
175        {
176                if (DST_EEPROM_GetMinRF() <= DST_MinRF()) 
177                {
178                        DST_EEPROM_SetMinRF(DST_MinRF());
179                        return;
180                }
181                else if (DST_EEPROM_GetMinRF() > DST_EEPROM_GetMaxRF())
182                {
183                        DST_EEPROM_SetMinRF(DST_EEPROM_GetMaxRF());
184                        return;
185                }
186                DST_EEPROM_SetMinRF(DST_EEPROM_GetMinRF() - 1);
187        }
188        void IncreaseMinRF()
189        {
190                if (DST_EEPROM_GetMinRF() >= DST_MaxRF()) 
191                {
192                        DST_EEPROM_SetMinRF(DST_MaxRF());
193                        return;
194                }
195                else if (DST_EEPROM_GetMinRF() >= DST_EEPROM_GetMaxRF())
196                {
197                        DST_EEPROM_SetMinRF(DST_EEPROM_GetMaxRF());
198                        return;
199                }
200
201                DST_EEPROM_SetMinRF(DST_EEPROM_GetMinRF() + 1);
202        }
203        void DecreaseMaxRF()
204        {
205                if (DST_EEPROM_GetMaxRF() <= DST_MinRF()) 
206                {
207                        DST_EEPROM_SetMaxRF(DST_MinRF());
208                        return;
209                }
210                else if (DST_EEPROM_GetMinRF() >= DST_EEPROM_GetMaxRF())
211                {
212                        DST_EEPROM_SetMaxRF(DST_EEPROM_GetMinRF());
213                        return;
214                }
215
216                DST_EEPROM_SetMaxRF(DST_EEPROM_GetMaxRF() - 1);
217        }
218        void CFrequncySettingWin_KeyInput(CWindow *this, DS_U8 key, bool bRepeat)
219        {
220                int i = 0;
221               
222                switch(key)
223                {
224                        case VK_VOL_UP:
225                        case VK_CH_UP:
226                       
227                                switch(nPos)
228                                {
229
230                                        case 0:
231
232                                                        for (i=0; i < 10; i++) IncreaseMinRF();
233
234                                                break;
235                                        case 1:
236
237                                                        for (i=0; i < 10; i++) IncreaseMaxRF();
238
239                                                break;
240                                                default:break;
241                                }
242
243                                this->Show(this);
244                                break;
245                               
246                        case VK_VOL_DN:
247                        case VK_CH_DN:
248
249                                switch(nPos)
250                                {
251
252                                        case 0:
253
254                                                        for (i=0; i < 10; i++) DecreaseMinRF();
255                                               
256                                                break;
257                                        case 1:
258
259                                                        for (i=0; i < 10; i++) DecreaseMaxRF();
260                                               
261                                                break;
262                                                default:break;
263                                }
264
265                                this->Show(this);
266                                break;
267                               
268                        case VK_UP:
269                        case VK_DN:
270                                nPos = nPos==1?0:1;
271                                this->Show(this);                       
272                                break;
273                               
274                        case VK_LEFT:
275                                switch(nPos)
276                                {
277                                        case 0:
278                                                DecreaseMinRF();
279                                                break;
280                                        case 1:
281                                                DecreaseMaxRF();
282                                                break;
283                                                default:break;
284                                }
285
286                                this->Show(this);
287                                break;
288                       
289                        case VK_RIGHT:
290                                switch(nPos)
291                                {
292                                        case 0:
293                                                IncreaseMinRF();
294                                                break;
295                                        case 1:
296                                                IncreaseMaxRF();
297                                                break;
298                                                default:break;
299                                }
300
301                                this->Show(this);
302                                break;
303                               
304                        default:
305                                this->Close(this);
306                                break;
307                }
308        }
309
310//};
311
312void DST_CreateFrequencySettingWin(SWinEventMsg event)
313{
314        DST_RemoveAllWindowExceptBasicWin();
315        CWindow*pWin = NewCWindow(event);
316        pWin->Destructor        = CFrequncySettingWin_Destructor;
317        pWin->KeyInput          = CFrequncySettingWin_KeyInput;
318        pWin->OnTimer           = CFrequncySettingWin_OnTimer;
319        pWin->ShowWindow        = CFrequncySettingWin_ShowWindow;
320        pWin->Show                      = CFrequncySettingWin_Show;
321        // »ý¼ºÀÚ È£Ãâ
322        CFrequncySettingWin_Constructor(pWin, event);
323        // À©µµ¿ì ¸Þ´ÏÀú¿¡ µî·Ï
324        DST_AddWin((WinID)(event.data[0]), pWin);
325}
326
327
Note: See TracBrowser for help on using the repository browser.