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

Last change on this file was 46, checked in by phkim, 10 years ago
  1. phkim
  2. 서경방송 [릴리즈 1.1.1]
  3. 초기화등 빠른 동기화를 위한 함수 추가및 수정
File size: 8.6 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;
24static int nMin = 0;
25static int nMax = 0;
26
27//class CFrequncySettingWin : public CWindow
28//{
29//private:
30//     
31//public:
32//      CFrequncySettingWin(SWinEventMsg event):CWindow(event)
33        void CFrequncySettingWin_Constructor(CWindow *this, SWinEventMsg event)
34        {
35                this->SetWinName(this,  "FrequencySetting");
36                this->setFontStyle(this, 22, 0xFFFFFFFF, ALIGN_MIDDLE, ALIGN_LEFT);
37                this->rect.w = DST_GetImageWidth(pin_change_back);
38                this->rect.h = DST_GetImageHeight(pin_change_back);;
39                this->rect.x = (DST_GetScreenWidth() - this->rect.w) / 2;
40                this->rect.y = (DST_GetScreenHeight() - this->rect.h) / 2;
41                nPos = 0;
42
43                this->SetTimeOut(this, 0);
44               
45                nMin = DST_EEPROM_GetMinRF();
46                nMax = DST_EEPROM_GetMaxRF();
47        }
48
49        void CFrequncySettingWin_Destructor(CWindow *this)
50        {
51                // ¼³Á¤°ªÀÌ º¯°æµÇ¾ú´Ù¸é ÃʱâÈ­ÇÑ´Ù.
52                if (nMin != DST_EEPROM_GetMinRF() || nMax != DST_EEPROM_GetMaxRF())
53                {
54                        DST_EEPROM_SetNeedReset(1);
55                        DST_Reset(__func__); // âÀÌ ´ÝÈ÷¸é¼­ ÀçºÎÆÃ
56                }
57        }
58       
59//      virtual void OnTimer(char nID)
60        void CFrequncySettingWin_OnTimer(CWindow *this, char nID)
61        {
62        }
63
64//      virtual void Show(WinID id)
65        void CFrequncySettingWin_ShowWindow(CWindow *this, WinID id)
66        {
67                switch(id)
68                {
69                        case WIN_EWS:
70                        case WIN_ENGINEER_MODE:
71                        case WIN_DEBUG_SQL:
72                        case WIN_DEBUG_SQL_SUB:
73                        case WIN_DIRECT_TUNE:
74                        case WIN_VOLUME:
75                        case WIN_VOLUME_MUTE:
76                        case WIN_SIGNAL_METER:
77                        case WIN_CLOSED_CAPTION_HOT:
78                        case WIN_AUDIO_HOT:
79                        case WIN_DISPLAY_MODE_HOT:
80                        case WIN_FACTORY_RESET:
81                        case WIN_FACTORY_RESET_ASK:
82                        case WIN_INFOR_BANNER:
83                        case WIN_POWER_DOWN_CAUTION:
84                        case WIN_MAIN_MENU:
85                        case WIN_SUB_MENU_2DEPTH:
86                        case WIN_SUB_MENU_3DEPTH:
87                        case WIN_SUB_MENU_4DEPTH:
88                        case WIN_AUTO_SEARCH:
89                        case WIN_MANUAL_SEARCH:
90                        case WIN_CHANNEL_LIST:
91                        case WIN_PROGRAM_GUIDE:
92                        case WIN_PASSWD_CHANGE:
93                        case WIN_PASSWD_CHECK:
94                        case WIN_PASSWD_CONFIRM:
95                        case WIN_AGE_RATING:
96                                this->Close(this);
97                                break;
98                        default:
99                                break;
100                }
101        }
102
103//      virtual void Show()
104        void CFrequncySettingWin_Show(CWindow *this)
105        {
106                this->RegisterAllKey(this);
107                                this->RegisterKey(this, VK_PWR, false, 0, 0);
108                // background
109                this->DrawImage(this, 0, 0, pin_change_back, false);
110       
111                char strText[256];
112               
113                int nLineHeight = (this->rect.h) / 7;
114                // title
115                this->setFontStyle(this, 21, 0xFFC8C8C8, ALIGN_MIDDLE, ALIGN_CENTER);
116                this->DrawText(this, 0, 0, this->rect.w, nLineHeight*2, (char*)"Frequency Setting", &(this->font));
117
118
119                this->DrawText(this, 0, (nLineHeight * 2)+(nLineHeight/3), (this->rect.w)/2, nLineHeight, (char*)"Min.", &(this->font));
120                this->DrawText(this, (this->rect.w)/2, (nLineHeight * 2)+(nLineHeight/3), (this->rect.w)/2, nLineHeight, (char*)"Max.", &(this->font));
121
122
123                // display min
124                switch(nPos)
125                {
126
127                        case 0:
128                                this->setFontStyle(this, 22, 0xFFFFFFFF, ALIGN_MIDDLE, ALIGN_CENTER);
129                               
130                                break;
131                        case 1:
132                                this->setFontStyle(this, 21, 0xFFAAAAAA, ALIGN_MIDDLE, ALIGN_CENTER);
133                               
134                                break;
135                        default:break;
136                }
137
138                int num = DST_EEPROM_GetMinRF();
139               
140                        int rf = DST_GetFrequencyNumberbyIndex(num);
141                        int freq = DST_GetMHzFrequencybyIndex(num);
142                        sprintf(strText, "%d (%dMHz)", rf, freq);
143
144                this->DrawText(this, 0, nLineHeight * 4, (this->rect.w)/2, nLineHeight, (char*)strText, &(this->font));
145
146                //display up /down
147                this->setFontStyle(this, 15, 0xFFC8C8C8, ALIGN_MIDDLE, ALIGN_CENTER);
148                //this->DrawText(this, 0, (nLineHeight * 3)+(nLineHeight/3), (this->rect.w)/2, nLineHeight, (char*)"^", &(this->font));
149                DS_U16 strTextUp[2] = { 0x25B2, 0};
150                DS_U16 strTextDn[2] = { 0x25BC, 0};
151                this->DrawTextUni(this, 0, (nLineHeight * 3)+(nLineHeight/3), (this->rect.w)/2, nLineHeight, strTextUp, &(this->font));
152                this->DrawTextUni(this, (this->rect.w)/2, (nLineHeight * 3)+(nLineHeight/3), (this->rect.w)/2, nLineHeight, strTextUp, &(this->font));
153
154                this->DrawTextUni(this, 0, (nLineHeight * 4)+(nLineHeight*2)/3, (this->rect.w)/2, nLineHeight, strTextDn, &(this->font));
155                this->DrawTextUni(this, (this->rect.w)/2, (nLineHeight * 4)+(nLineHeight*2)/3, (this->rect.w)/2, nLineHeight, strTextDn, &(this->font));       
156                // display ~
157                this->setFontStyle(this, 21, 0xFFC8C8C8, ALIGN_MIDDLE, ALIGN_CENTER);
158                this->DrawText(this, 0, nLineHeight * 4, this->rect.w, nLineHeight, (char*)"~", &(this->font));
159               
160                // display max
161                switch(nPos)
162                {
163
164                        case 0:
165                                this->setFontStyle(this, 21, 0xFFAAAAAA, ALIGN_MIDDLE, ALIGN_CENTER);
166                               
167                                break;
168                        case 1:
169                                this->setFontStyle(this, 22, 0xFFFFFFFF, ALIGN_MIDDLE, ALIGN_CENTER);
170                               
171                                break;
172                        default:break;
173                }
174
175                num = DST_EEPROM_GetMaxRF();
176
177                rf = DST_GetFrequencyNumberbyIndex(num);
178                freq = DST_GetMHzFrequencybyIndex(num);
179                sprintf(strText, "%d (%dMHz)", rf, freq);
180
181
182                this->DrawText(this, (this->rect.w)/2, nLineHeight * 4, (this->rect.w)/2, nLineHeight, (char*)strText, &(this->font));
183                // descriptor
184                this->setFontStyle(this, 18, 0xFF666666, ALIGN_MIDDLE, ALIGN_CENTER);
185                this->DrawText(this, 0, nLineHeight * 6, this->rect.w, nLineHeight, (char*)"Left/Right : Next", &(this->font));
186        }
187
188
189//      virtual void KeyInput(DS_U8 key, bool /*bRepeat*/)
190        void IncreaseMaxRF()
191        {
192                if (DST_EEPROM_GetMaxRF() >= DST_MaxRF()) 
193                {
194                        DST_EEPROM_SetMaxRF(DST_MaxRF());
195                        return;
196                }
197                else if (DST_EEPROM_GetMinRF() > DST_EEPROM_GetMaxRF())
198                {
199                        DST_EEPROM_SetMaxRF(DST_EEPROM_GetMinRF());
200                        return;
201                }
202                DST_EEPROM_SetMaxRF(DST_EEPROM_GetMaxRF() + 1);
203        }
204        void DecreaseMinRF()
205        {
206                if (DST_EEPROM_GetMinRF() <= DST_MinRF()) 
207                {
208                        DST_EEPROM_SetMinRF(DST_MinRF());
209                        return;
210                }
211                else if (DST_EEPROM_GetMinRF() > DST_EEPROM_GetMaxRF())
212                {
213                        DST_EEPROM_SetMinRF(DST_EEPROM_GetMaxRF());
214                        return;
215                }
216                DST_EEPROM_SetMinRF(DST_EEPROM_GetMinRF() - 1);
217        }
218        void IncreaseMinRF()
219        {
220                if (DST_EEPROM_GetMinRF() >= DST_MaxRF()) 
221                {
222                        DST_EEPROM_SetMinRF(DST_MaxRF());
223                        return;
224                }
225                else if (DST_EEPROM_GetMinRF() >= DST_EEPROM_GetMaxRF())
226                {
227                        DST_EEPROM_SetMinRF(DST_EEPROM_GetMaxRF());
228                        return;
229                }
230
231                DST_EEPROM_SetMinRF(DST_EEPROM_GetMinRF() + 1);
232        }
233        void DecreaseMaxRF()
234        {
235                if (DST_EEPROM_GetMaxRF() <= DST_MinRF()) 
236                {
237                        DST_EEPROM_SetMaxRF(DST_MinRF());
238                        return;
239                }
240                else if (DST_EEPROM_GetMinRF() >= DST_EEPROM_GetMaxRF())
241                {
242                        DST_EEPROM_SetMaxRF(DST_EEPROM_GetMinRF());
243                        return;
244                }
245
246                DST_EEPROM_SetMaxRF(DST_EEPROM_GetMaxRF() - 1);
247        }
248        void CFrequncySettingWin_KeyInput(CWindow *this, DS_U8 key, bool bRepeat)
249        {
250                int i = 0;
251               
252                switch(key)
253                {
254                        case VK_VOL_UP:
255                        case VK_CH_UP:
256                       
257                                switch(nPos)
258                                {
259
260                                        case 0:
261
262                                                        for (i=0; i < 10; i++) IncreaseMinRF();
263
264                                                break;
265                                        case 1:
266
267                                                        for (i=0; i < 10; i++) IncreaseMaxRF();
268
269                                                break;
270                                                default:break;
271                                }
272
273                                this->Show(this);
274                                break;
275                               
276                        case VK_VOL_DN:
277                        case VK_CH_DN:
278
279                                switch(nPos)
280                                {
281
282                                        case 0:
283
284                                                        for (i=0; i < 10; i++) DecreaseMinRF();
285                                               
286                                                break;
287                                        case 1:
288
289                                                        for (i=0; i < 10; i++) DecreaseMaxRF();
290                                               
291                                                break;
292                                                default:break;
293                                }
294
295                                this->Show(this);
296                                break;
297                               
298                        case VK_LEFT:
299                        case VK_RIGHT:
300                                nPos = nPos==1?0:1;
301                                this->Show(this);                       
302                                break;
303                               
304                        case VK_DN:
305                                switch(nPos)
306                                {
307                                        case 0:
308                                                DecreaseMinRF();
309                                                break;
310                                        case 1:
311                                                DecreaseMaxRF();
312                                                break;
313                                                default:break;
314                                }
315
316                                this->Show(this);
317                                break;
318                       
319                        case VK_UP:
320                                switch(nPos)
321                                {
322                                        case 0:
323                                                IncreaseMinRF();
324                                                break;
325                                        case 1:
326                                                IncreaseMaxRF();
327                                                break;
328                                                default:break;
329                                }
330
331                                this->Show(this);
332                                break;
333                               
334                        default:
335                                this->Close(this);
336                                break;
337                }
338        }
339
340//};
341
342void DST_CreateFrequencySettingWin(SWinEventMsg event)
343{
344        DST_RemoveAllWindowExceptBasicWin();
345        CWindow*pWin = NewCWindow(event);
346        pWin->Destructor        = CFrequncySettingWin_Destructor;
347        pWin->KeyInput          = CFrequncySettingWin_KeyInput;
348        pWin->OnTimer           = CFrequncySettingWin_OnTimer;
349        pWin->ShowWindow        = CFrequncySettingWin_ShowWindow;
350        pWin->Show                      = CFrequncySettingWin_Show;
351        // »ý¼ºÀÚ È£Ãâ
352        CFrequncySettingWin_Constructor(pWin, event);
353        // À©µµ¿ì ¸Þ´ÏÀú¿¡ µî·Ï
354        DST_AddWin((WinID)(event.data[0]), pWin);
355}
356
357
Note: See TracBrowser for help on using the repository browser.