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

Last change on this file since 39 was 39, checked in by megakiss, 11 years ago

주파수 설정창 화살표를 적당한 유니코드로 변경

File size: 8.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 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) / 7;
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                this->DrawText(this, 0, (nLineHeight * 2)+(nLineHeight/3), (this->rect.w)/2, nLineHeight, (char*)"Min.", &(this->font));
109                this->DrawText(this, (this->rect.w)/2, (nLineHeight * 2)+(nLineHeight/3), (this->rect.w)/2, nLineHeight, (char*)"Max.", &(this->font));
110
111
112                // display min
113                switch(nPos)
114                {
115
116                        case 0:
117                                this->setFontStyle(this, 22, 0xFFFFFFFF, ALIGN_MIDDLE, ALIGN_CENTER);
118                               
119                                break;
120                        case 1:
121                                this->setFontStyle(this, 21, 0xFFAAAAAA, ALIGN_MIDDLE, ALIGN_CENTER);
122                               
123                                break;
124                        default:break;
125                }
126
127                int num = DST_EEPROM_GetMinRF();
128               
129                        int rf = DST_GetFrequencyNumberbyIndex(num);
130                        int freq = DST_GetMHzFrequencybyIndex(num);
131                        sprintf(strText, "%d (%dMHz)", rf, freq);
132
133                this->DrawText(this, 0, nLineHeight * 4, (this->rect.w)/2, nLineHeight, (char*)strText, &(this->font));
134
135                //display up /down
136                this->setFontStyle(this, 15, 0xFFC8C8C8, ALIGN_MIDDLE, ALIGN_CENTER);
137                //this->DrawText(this, 0, (nLineHeight * 3)+(nLineHeight/3), (this->rect.w)/2, nLineHeight, (char*)"^", &(this->font));
138                DS_U16 strTextUp[2] = { 0x25B2, 0};
139                DS_U16 strTextDn[2] = { 0x25BC, 0};
140                this->DrawTextUni(this, 0, (nLineHeight * 3)+(nLineHeight/3), (this->rect.w)/2, nLineHeight, strTextUp, &(this->font));
141                this->DrawTextUni(this, (this->rect.w)/2, (nLineHeight * 3)+(nLineHeight/3), (this->rect.w)/2, nLineHeight, strTextUp, &(this->font));
142
143                this->DrawTextUni(this, 0, (nLineHeight * 4)+(nLineHeight*2)/3, (this->rect.w)/2, nLineHeight, strTextDn, &(this->font));
144                this->DrawTextUni(this, (this->rect.w)/2, (nLineHeight * 4)+(nLineHeight*2)/3, (this->rect.w)/2, nLineHeight, strTextDn, &(this->font));       
145                // display ~
146                this->setFontStyle(this, 21, 0xFFC8C8C8, ALIGN_MIDDLE, ALIGN_CENTER);
147                this->DrawText(this, 0, nLineHeight * 4, this->rect.w, nLineHeight, (char*)"~", &(this->font));
148               
149                // display max
150                switch(nPos)
151                {
152
153                        case 0:
154                                this->setFontStyle(this, 21, 0xFFAAAAAA, ALIGN_MIDDLE, ALIGN_CENTER);
155                               
156                                break;
157                        case 1:
158                                this->setFontStyle(this, 22, 0xFFFFFFFF, ALIGN_MIDDLE, ALIGN_CENTER);
159                               
160                                break;
161                        default:break;
162                }
163
164                num = DST_EEPROM_GetMaxRF();
165
166                rf = DST_GetFrequencyNumberbyIndex(num);
167                freq = DST_GetMHzFrequencybyIndex(num);
168                sprintf(strText, "%d (%dMHz)", rf, freq);
169
170
171                this->DrawText(this, (this->rect.w)/2, nLineHeight * 4, (this->rect.w)/2, nLineHeight, (char*)strText, &(this->font));
172                // descriptor
173                this->setFontStyle(this, 18, 0xFF666666, ALIGN_MIDDLE, ALIGN_CENTER);
174                this->DrawText(this, 0, nLineHeight * 6, this->rect.w, nLineHeight, (char*)"Left/Right : Next", &(this->font));
175        }
176
177
178//      virtual void KeyInput(DS_U8 key, bool /*bRepeat*/)
179        void IncreaseMaxRF()
180        {
181                if (DST_EEPROM_GetMaxRF() >= DST_MaxRF()) 
182                {
183                        DST_EEPROM_SetMaxRF(DST_MaxRF());
184                        return;
185                }
186                else if (DST_EEPROM_GetMinRF() > DST_EEPROM_GetMaxRF())
187                {
188                        DST_EEPROM_SetMaxRF(DST_EEPROM_GetMinRF());
189                        return;
190                }
191                DST_EEPROM_SetMaxRF(DST_EEPROM_GetMaxRF() + 1);
192        }
193        void DecreaseMinRF()
194        {
195                if (DST_EEPROM_GetMinRF() <= DST_MinRF()) 
196                {
197                        DST_EEPROM_SetMinRF(DST_MinRF());
198                        return;
199                }
200                else if (DST_EEPROM_GetMinRF() > DST_EEPROM_GetMaxRF())
201                {
202                        DST_EEPROM_SetMinRF(DST_EEPROM_GetMaxRF());
203                        return;
204                }
205                DST_EEPROM_SetMinRF(DST_EEPROM_GetMinRF() - 1);
206        }
207        void IncreaseMinRF()
208        {
209                if (DST_EEPROM_GetMinRF() >= DST_MaxRF()) 
210                {
211                        DST_EEPROM_SetMinRF(DST_MaxRF());
212                        return;
213                }
214                else if (DST_EEPROM_GetMinRF() >= DST_EEPROM_GetMaxRF())
215                {
216                        DST_EEPROM_SetMinRF(DST_EEPROM_GetMaxRF());
217                        return;
218                }
219
220                DST_EEPROM_SetMinRF(DST_EEPROM_GetMinRF() + 1);
221        }
222        void DecreaseMaxRF()
223        {
224                if (DST_EEPROM_GetMaxRF() <= DST_MinRF()) 
225                {
226                        DST_EEPROM_SetMaxRF(DST_MinRF());
227                        return;
228                }
229                else if (DST_EEPROM_GetMinRF() >= DST_EEPROM_GetMaxRF())
230                {
231                        DST_EEPROM_SetMaxRF(DST_EEPROM_GetMinRF());
232                        return;
233                }
234
235                DST_EEPROM_SetMaxRF(DST_EEPROM_GetMaxRF() - 1);
236        }
237        void CFrequncySettingWin_KeyInput(CWindow *this, DS_U8 key, bool bRepeat)
238        {
239                int i = 0;
240               
241                switch(key)
242                {
243                        case VK_VOL_UP:
244                        case VK_CH_UP:
245                       
246                                switch(nPos)
247                                {
248
249                                        case 0:
250
251                                                        for (i=0; i < 10; i++) IncreaseMinRF();
252
253                                                break;
254                                        case 1:
255
256                                                        for (i=0; i < 10; i++) IncreaseMaxRF();
257
258                                                break;
259                                                default:break;
260                                }
261
262                                this->Show(this);
263                                break;
264                               
265                        case VK_VOL_DN:
266                        case VK_CH_DN:
267
268                                switch(nPos)
269                                {
270
271                                        case 0:
272
273                                                        for (i=0; i < 10; i++) DecreaseMinRF();
274                                               
275                                                break;
276                                        case 1:
277
278                                                        for (i=0; i < 10; i++) DecreaseMaxRF();
279                                               
280                                                break;
281                                                default:break;
282                                }
283
284                                this->Show(this);
285                                break;
286                               
287                        case VK_LEFT:
288                        case VK_RIGHT:
289                                nPos = nPos==1?0:1;
290                                this->Show(this);                       
291                                break;
292                               
293                        case VK_DN:
294                                switch(nPos)
295                                {
296                                        case 0:
297                                                DecreaseMinRF();
298                                                break;
299                                        case 1:
300                                                DecreaseMaxRF();
301                                                break;
302                                                default:break;
303                                }
304
305                                this->Show(this);
306                                break;
307                       
308                        case VK_UP:
309                                switch(nPos)
310                                {
311                                        case 0:
312                                                IncreaseMinRF();
313                                                break;
314                                        case 1:
315                                                IncreaseMaxRF();
316                                                break;
317                                                default:break;
318                                }
319
320                                this->Show(this);
321                                break;
322                               
323                        default:
324                                this->Close(this);
325                                break;
326                }
327        }
328
329//};
330
331void DST_CreateFrequencySettingWin(SWinEventMsg event)
332{
333        DST_RemoveAllWindowExceptBasicWin();
334        CWindow*pWin = NewCWindow(event);
335        pWin->Destructor        = CFrequncySettingWin_Destructor;
336        pWin->KeyInput          = CFrequncySettingWin_KeyInput;
337        pWin->OnTimer           = CFrequncySettingWin_OnTimer;
338        pWin->ShowWindow        = CFrequncySettingWin_ShowWindow;
339        pWin->Show                      = CFrequncySettingWin_Show;
340        // »ý¼ºÀÚ È£Ãâ
341        CFrequncySettingWin_Constructor(pWin, event);
342        // À©µµ¿ì ¸Þ´ÏÀú¿¡ µî·Ï
343        DST_AddWin((WinID)(event.data[0]), pWin);
344}
345
346
Note: See TracBrowser for help on using the repository browser.