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
RevLine 
[18]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
[34]17extern DS_U8 pin_change_back[];
[18]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);
[34]35                this->rect.w = DST_GetImageWidth(pin_change_back);
36                this->rect.h = DST_GetImageHeight(pin_change_back);;
[18]37                this->rect.x = (DST_GetScreenWidth() - this->rect.w) / 2;
38                this->rect.y = (DST_GetScreenHeight() - this->rect.h) / 2;
[34]39                nPos = 0;
[18]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);
[27]96                                this->RegisterKey(this, VK_PWR, false, 0, 0);
[19]97                // background
[34]98                this->DrawImage(this, 0, 0, pin_change_back, false);
[18]99       
[25]100                char strText[256];
101               
[34]102                int nLineHeight = (this->rect.h) / 6;
[19]103                // title
[34]104                this->setFontStyle(this, 21, 0xFFC8C8C8, ALIGN_MIDDLE, ALIGN_CENTER);
[28]105                this->DrawText(this, 0, 0, this->rect.w, nLineHeight*2, (char*)"Frequency Setting", &(this->font));
[34]106
107
[25]108                // display max
109                switch(nPos)
[18]110                {
[34]111
[25]112                        case 0:
[34]113                                this->setFontStyle(this, 22, 0xFFFFFFFF, ALIGN_MIDDLE, ALIGN_CENTER);
114                               
[25]115                                break;
116                        case 1:
[34]117                                this->setFontStyle(this, 21, 0xFFAAAAAA, ALIGN_MIDDLE, ALIGN_CENTER);
118                               
[25]119                                break;
120                        default:break;
[18]121                }
[25]122
[19]123                int num = DST_EEPROM_GetMinRF();
[25]124               
[19]125                        int rf = DST_GetFrequencyNumberbyIndex(num);
126                        int freq = DST_GetMHzFrequencybyIndex(num);
127                        sprintf(strText, "< Min : %d ( %dMHz ) >", rf, freq);
[25]128
[34]129                this->DrawText(this, 0, nLineHeight * 2, this->rect.w, nLineHeight, (char*)strText, &(this->font));
[19]130                // display min
[25]131                switch(nPos)
[18]132                {
[34]133
[25]134                        case 0:
[34]135                                this->setFontStyle(this, 21, 0xFFAAAAAA, ALIGN_MIDDLE, ALIGN_CENTER);
136                               
[25]137                                break;
138                        case 1:
[34]139                                this->setFontStyle(this, 22, 0xFFFFFFFF, ALIGN_MIDDLE, ALIGN_CENTER);
140                               
[25]141                                break;
142                        default:break;
[18]143                }
[25]144
[19]145                num = DST_EEPROM_GetMaxRF();
[25]146
147                rf = DST_GetFrequencyNumberbyIndex(num);
148                freq = DST_GetMHzFrequencybyIndex(num);
149                sprintf(strText, "< Max : %d ( %dMHz ) >", rf, freq);
150
151
[34]152                this->DrawText(this, 0, nLineHeight * 3, this->rect.w, nLineHeight, (char*)strText, &(this->font));
[19]153                // descriptor
[34]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));
[18]156        }
157
158
159//      virtual void KeyInput(DS_U8 key, bool /*bRepeat*/)
160        void IncreaseMaxRF()
161        {
[19]162                if (DST_EEPROM_GetMaxRF() >= DST_MaxRF()) 
163                {
164                        DST_EEPROM_SetMaxRF(DST_MaxRF());
165                        return;
166                }
[25]167                else if (DST_EEPROM_GetMinRF() > DST_EEPROM_GetMaxRF())
168                {
169                        DST_EEPROM_SetMaxRF(DST_EEPROM_GetMinRF());
170                        return;
171                }
[18]172                DST_EEPROM_SetMaxRF(DST_EEPROM_GetMaxRF() + 1);
173        }
174        void DecreaseMinRF()
175        {
[25]176                if (DST_EEPROM_GetMinRF() <= DST_MinRF()) 
[19]177                {
[25]178                        DST_EEPROM_SetMinRF(DST_MinRF());
[19]179                        return;
180                }
[25]181                else if (DST_EEPROM_GetMinRF() > DST_EEPROM_GetMaxRF())
182                {
183                        DST_EEPROM_SetMinRF(DST_EEPROM_GetMaxRF());
184                        return;
185                }
[18]186                DST_EEPROM_SetMinRF(DST_EEPROM_GetMinRF() - 1);
187        }
188        void IncreaseMinRF()
189        {
[25]190                if (DST_EEPROM_GetMinRF() >= DST_MaxRF()) 
[18]191                {
[25]192                        DST_EEPROM_SetMinRF(DST_MaxRF());
[19]193                        return;
[18]194                }
[25]195                else if (DST_EEPROM_GetMinRF() >= DST_EEPROM_GetMaxRF())
196                {
197                        DST_EEPROM_SetMinRF(DST_EEPROM_GetMaxRF());
198                        return;
199                }
200
[19]201                DST_EEPROM_SetMinRF(DST_EEPROM_GetMinRF() + 1);
[18]202        }
203        void DecreaseMaxRF()
204        {
[25]205                if (DST_EEPROM_GetMaxRF() <= DST_MinRF()) 
[18]206                {
[25]207                        DST_EEPROM_SetMaxRF(DST_MinRF());
[19]208                        return;
[18]209                }
[25]210                else if (DST_EEPROM_GetMinRF() >= DST_EEPROM_GetMaxRF())
211                {
212                        DST_EEPROM_SetMaxRF(DST_EEPROM_GetMinRF());
213                        return;
214                }
215
[19]216                DST_EEPROM_SetMaxRF(DST_EEPROM_GetMaxRF() - 1);
[18]217        }
218        void CFrequncySettingWin_KeyInput(CWindow *this, DS_U8 key, bool bRepeat)
219        {
220                int i = 0;
[34]221               
[18]222                switch(key)
223                {
[34]224                        case VK_VOL_UP:
225                        case VK_CH_UP:
226                       
[25]227                                switch(nPos)
[18]228                                {
[34]229
[25]230                                        case 0:
[34]231
[25]232                                                        for (i=0; i < 10; i++) IncreaseMinRF();
[34]233
[25]234                                                break;
[34]235                                        case 1:
236
[25]237                                                        for (i=0; i < 10; i++) IncreaseMaxRF();
[34]238
[25]239                                                break;
240                                                default:break;
[18]241                                }
[25]242
[18]243                                this->Show(this);
244                                break;
245                               
[34]246                        case VK_VOL_DN:
247                        case VK_CH_DN:
248
[25]249                                switch(nPos)
[18]250                                {
[34]251
[25]252                                        case 0:
[34]253
[25]254                                                        for (i=0; i < 10; i++) DecreaseMinRF();
[34]255                                               
[25]256                                                break;
[34]257                                        case 1:
258
[25]259                                                        for (i=0; i < 10; i++) DecreaseMaxRF();
[34]260                                               
[25]261                                                break;
262                                                default:break;
[18]263                                }
[25]264
[18]265                                this->Show(this);
266                                break;
267                               
[34]268                        case VK_UP:
269                        case VK_DN:
270                                nPos = nPos==1?0:1;
[18]271                                this->Show(this);                       
272                                break;
273                               
274                        case VK_LEFT:
[25]275                                switch(nPos)
[18]276                                {
[25]277                                        case 0:
[34]278                                                DecreaseMinRF();
[25]279                                                break;
280                                        case 1:
[34]281                                                DecreaseMaxRF();
[25]282                                                break;
283                                                default:break;
[18]284                                }
[25]285
[18]286                                this->Show(this);
287                                break;
288                       
289                        case VK_RIGHT:
[25]290                                switch(nPos)
[18]291                                {
[25]292                                        case 0:
[34]293                                                IncreaseMinRF();
[25]294                                                break;
295                                        case 1:
[34]296                                                IncreaseMaxRF();
[25]297                                                break;
298                                                default:break;
[18]299                                }
[25]300
[18]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.