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

Last change on this file since 19 was 19, checked in by megakiss, 11 years ago
File size: 6.3 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 newcon2_gui_banner_4line_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(newcon2_gui_banner_4line_back);
36                this->rect.h = DST_GetImageHeight(newcon2_gui_banner_4line_back);;
37                this->rect.x = (DST_GetScreenWidth() - this->rect.w) / 2;
38                this->rect.y = (DST_GetScreenHeight() - this->rect.h) / 2;
39
40                this->SetTimeOut(this, 0);
41        }
42
43        void CFrequncySettingWin_Destructor(CWindow *this)
44        {
45        }
46       
47//      virtual void OnTimer(char nID)
48        void CFrequncySettingWin_OnTimer(CWindow *this, char nID)
49        {
50        }
51
52//      virtual void Show(WinID id)
53        void CFrequncySettingWin_ShowWindow(CWindow *this, WinID id)
54        {
55                switch(id)
56                {
57                        case WIN_EWS:
58                        case WIN_ENGINEER_MODE:
59                        case WIN_DEBUG_SQL:
60                        case WIN_DEBUG_SQL_SUB:
61                        case WIN_DIRECT_TUNE:
62                        case WIN_VOLUME:
63                        case WIN_VOLUME_MUTE:
64                        case WIN_SIGNAL_METER:
65                        case WIN_CLOSED_CAPTION_HOT:
66                        case WIN_AUDIO_HOT:
67                        case WIN_DISPLAY_MODE_HOT:
68                        case WIN_FACTORY_RESET:
69                        case WIN_FACTORY_RESET_ASK:
70                        case WIN_INFOR_BANNER:
71                        case WIN_POWER_DOWN_CAUTION:
72                        case WIN_MAIN_MENU:
73                        case WIN_SUB_MENU_2DEPTH:
74                        case WIN_SUB_MENU_3DEPTH:
75                        case WIN_SUB_MENU_4DEPTH:
76                        case WIN_AUTO_SEARCH:
77                        case WIN_MANUAL_SEARCH:
78                        case WIN_CHANNEL_LIST:
79                        case WIN_PROGRAM_GUIDE:
80                        case WIN_PASSWD_CHANGE:
81                        case WIN_PASSWD_CHECK:
82                        case WIN_PASSWD_CONFIRM:
83                        case WIN_AGE_RATING:
84                                this->Close(this);
85                                break;
86                        default:
87                                break;
88                }
89        }
90
91//      virtual void Show()
92        void CFrequncySettingWin_Show(CWindow *this)
93        {
94                this->RegisterAllKey(this);
95                // background
96                this->DrawImage(this, 0, 0, newcon2_gui_banner_4line_back, false);
97       
98                int nLineHeight = (this->rect.h) / 6;
99                // title
100                this->setFontStyle(this, 18, 0xFFC8C8C8, ALIGN_MIDDLE, ALIGN_CENTER);
101                this->DrawText(this, 0, 0, this->rect.w, nLineHeight*2, (char*)"Frequency Setting", &(this->font));
102                // display max
103                if (nPos == 0)
104                {
105                        this->setFontStyle(this, 17, 0xFFFFFFFF, ALIGN_MIDDLE, ALIGN_CENTER);
106                }
107                else
108                {
109                        this->setFontStyle(this, 15, 0xFFAAAAAA, ALIGN_MIDDLE, ALIGN_CENTER);
110                }
111                int num = DST_EEPROM_GetMinRF();
112                char strText[256];
113                if (num > 0)
114                {
115                        int rf = DST_GetFrequencyNumberbyIndex(num);
116                        int freq = DST_GetMHzFrequencybyIndex(num);
117                        sprintf(strText, "< Min : %d ( %dMHz ) >", rf, freq);
118                }
119                else
120                {
121                        sprintf(strText, "< Min : OFF >");
122                }
123                this->DrawText(this, 0, nLineHeight * 2, this->rect.w, nLineHeight, (char*)strText, &(this->font));
124                // display min
125                if (nPos == 0)
126                {
127                        this->setFontStyle(this, 15, 0xFFAAAAAA, ALIGN_MIDDLE, ALIGN_CENTER);
128                }
129                else
130                {
131                        this->setFontStyle(this, 17, 0xFFFFFFFF, ALIGN_MIDDLE, ALIGN_CENTER);
132                }
133                num = DST_EEPROM_GetMaxRF();
134                if (num > 0)
135                {
136                        int rf = DST_GetFrequencyNumberbyIndex(num);
137                        int freq = DST_GetMHzFrequencybyIndex(num);
138                        sprintf(strText, "< Max : %d ( %dMHz ) >", rf, freq);
139                }
140                else
141                {
142                        sprintf(strText, "< Max : OFF >");
143                }
144                this->DrawText(this, 0, nLineHeight * 3, this->rect.w, nLineHeight, (char*)strText, &(this->font));
145                // descriptor
146                this->setFontStyle(this, 15, 0xFF666666, ALIGN_MIDDLE, ALIGN_CENTER);
147                this->DrawText(this, 0, nLineHeight * 5, this->rect.w, nLineHeight, (char*)"Channel/Volume : Next", &(this->font));
148        }
149
150
151//      virtual void KeyInput(DS_U8 key, bool /*bRepeat*/)
152        void IncreaseMaxRF()
153        {
154                if (DST_EEPROM_GetMaxRF() >= DST_MaxRF()) 
155                {
156                        DST_EEPROM_SetMaxRF(DST_MaxRF());
157                        return;
158                }
159                DST_EEPROM_SetMaxRF(DST_EEPROM_GetMaxRF() + 1);
160        }
161        void DecreaseMinRF()
162        {
163                if (DST_EEPROM_GetMinRF() < DST_MinRF()) 
164                {
165                        DST_EEPROM_SetMinRF(-1);
166                        return;
167                }
168                DST_EEPROM_SetMinRF(DST_EEPROM_GetMinRF() - 1);
169        }
170        void IncreaseMinRF()
171        {
172                if (DST_EEPROM_GetMinRF() >= DST_MinRF()) 
173                {
174                        DST_EEPROM_SetMinRF(DST_MinRF());
175                        return;
176                }
177                DST_EEPROM_SetMinRF(DST_EEPROM_GetMinRF() + 1);
178        }
179        void DecreaseMaxRF()
180        {
181                if (DST_EEPROM_GetMaxRF() < DST_MaxRF()) 
182                {
183                        DST_EEPROM_SetMaxRF(-1);
184                        return;
185                }
186                DST_EEPROM_SetMaxRF(DST_EEPROM_GetMaxRF() - 1);
187        }
188        void CFrequncySettingWin_KeyInput(CWindow *this, DS_U8 key, bool bRepeat)
189        {
190                int i = 0;
191                switch(key)
192                {
193                        case VK_UP:
194                                if (nPos == 0)
195                                {
196                                        for (i=0; i < 10; i++) IncreaseMinRF();
197                                }
198                                else
199                                {
200                                        for (i=0; i < 10; i++) IncreaseMaxRF();
201                                }
202                                this->Show(this);
203                                break;
204                               
205                        case VK_DN:
206                                if (nPos == 0)
207                                {
208                                        for (i=0; i < 10; i++) DecreaseMinRF();
209                                }
210                                else
211                                {
212                                        for (i=0; i < 10; i++) DecreaseMaxRF();
213                                }
214                                this->Show(this);
215                                break;
216                               
217                        case VK_VOL_UP:
218                        case VK_CH_UP:
219                        case VK_VOL_DN:
220                        case VK_CH_DN:
221                                nPos = nPos ? 0 : 1;
222                                this->Show(this);                       
223                                break;
224                               
225                        case VK_LEFT:
226                                if (nPos == 0)
227                                {
228                                        DecreaseMinRF();
229                                }
230                                else
231                                {
232                                        DecreaseMaxRF();
233                                }
234                                this->Show(this);
235                                break;
236                       
237                        case VK_RIGHT:
238                                if (nPos == 0)
239                                {
240                                        IncreaseMinRF();
241                                }
242                                else
243                                {
244                                        IncreaseMaxRF();
245                                }
246                                this->Show(this);
247                                break;
248                               
249                        default:
250                                this->Close(this);
251                                break;
252                }
253        }
254
255//};
256
257void DST_CreateFrequencySettingWin(SWinEventMsg event)
258{
259        DST_RemoveAllWindowExceptBasicWin();
260        CWindow*pWin = NewCWindow(event);
261        pWin->Destructor        = CFrequncySettingWin_Destructor;
262        pWin->KeyInput          = CFrequncySettingWin_KeyInput;
263        pWin->OnTimer           = CFrequncySettingWin_OnTimer;
264        pWin->ShowWindow        = CFrequncySettingWin_ShowWindow;
265        pWin->Show                      = CFrequncySettingWin_Show;
266        // »ý¼ºÀÚ È£Ãâ
267        CFrequncySettingWin_Constructor(pWin, event);
268        // À©µµ¿ì ¸Þ´ÏÀú¿¡ µî·Ï
269        DST_AddWin((WinID)(event.data[0]), pWin);
270}
271
272
Note: See TracBrowser for help on using the repository browser.