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

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

빠진 파일 추가

File size: 6.2 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                this->DrawImage(this, 0, 0, newcon2_gui_banner_4line_back, false);
96       
97       
98                int nLineHeight = (this->rect.h) / 6;
99               
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               
103                char strText[256];
104                int num = DST_EEPROM_GetMinRF();
105                int rf = DST_GetFrequencyNumberbyIndex(num);
106                int freq = DST_GetMHzFrequencybyIndex(num);
107                if (nPos == 0)
108                {
109                        this->setFontStyle(this, 17, 0xFFFFFFFF, ALIGN_MIDDLE, ALIGN_CENTER);
110                        sprintf(strText, "< Min : %d ( %dMHz ) >", rf, freq);
111                }
112                else
113                {
114                        this->setFontStyle(this, 15, 0xFFAAAAAA, ALIGN_MIDDLE, ALIGN_CENTER);
115                        sprintf(strText, "Min : %d ( %dMHz )", rf, freq);
116                }
117                this->DrawText(this, 0, nLineHeight * 2, this->rect.w, nLineHeight, (char*)strText, &(this->font));
118               
119                num = DST_EEPROM_GetMaxRF();
120                rf = DST_GetFrequencyNumberbyIndex(num);
121                freq = DST_GetMHzFrequencybyIndex(num);
122                if (nPos == 0)
123                {
124                        this->setFontStyle(this, 15, 0xFFAAAAAA, ALIGN_MIDDLE, ALIGN_CENTER);
125                        sprintf(strText, "Max : %d ( %dMHz )", rf, freq);
126                }
127                else
128                {
129                        this->setFontStyle(this, 17, 0xFFFFFFFF, ALIGN_MIDDLE, ALIGN_CENTER);
130                        sprintf(strText, "< Max : %d ( %dMHz ) >", rf, freq);
131                }
132               
133                this->DrawText(this, 0, nLineHeight * 3, this->rect.w, nLineHeight, (char*)strText, &(this->font));
134               
135                this->setFontStyle(this, 15, 0xFF666666, ALIGN_MIDDLE, ALIGN_CENTER);
136                this->DrawText(this, 0, nLineHeight * 5, this->rect.w, nLineHeight, (char*)"Channel/Volume : Next", &(this->font));
137        }
138
139
140//      virtual void KeyInput(DS_U8 key, bool /*bRepeat*/)
141        void IncreaseMaxRF()
142        {
143                DST_EEPROM_SetMaxRF(DST_EEPROM_GetMaxRF() + 1);
144        }
145        void DecreaseMinRF()
146        {
147                DST_EEPROM_SetMinRF(DST_EEPROM_GetMinRF() - 1);
148        }
149        void IncreaseMinRF()
150        {
151                DST_EEPROM_SetMinRF(DST_EEPROM_GetMinRF() + 1);
152                if (DST_EEPROM_GetMaxRF() - DST_EEPROM_GetMinRF() < 4)
153                {
154                        IncreaseMaxRF();
155                }
156                if (DST_EEPROM_GetMaxRF() - DST_EEPROM_GetMinRF() < 4)
157                {
158                        DST_EEPROM_SetMinRF(DST_EEPROM_GetMaxRF()-4);
159                }
160        }
161        void DecreaseMaxRF()
162        {
163                DST_EEPROM_SetMaxRF(DST_EEPROM_GetMaxRF() - 1);
164                if (DST_EEPROM_GetMaxRF() - DST_EEPROM_GetMinRF() < 4)
165                {
166                        DecreaseMinRF();
167                }
168                if (DST_EEPROM_GetMaxRF() - DST_EEPROM_GetMinRF() < 4)
169                {
170                        DST_EEPROM_SetMaxRF(DST_EEPROM_GetMinRF()+4);
171                }
172        }
173        void CFrequncySettingWin_KeyInput(CWindow *this, DS_U8 key, bool bRepeat)
174        {
175                int i = 0;
176                switch(key)
177                {
178                        case VK_UP:
179                                if (nPos == 0)
180                                {
181                                        for (i=0; i < 10; i++) IncreaseMinRF();
182                                }
183                                else
184                                {
185                                        for (i=0; i < 10; i++) IncreaseMaxRF();
186                                }
187                                this->Show(this);
188                                break;
189                               
190                        case VK_DN:
191                                if (nPos == 0)
192                                {
193                                        for (i=0; i < 10; i++) DecreaseMinRF();
194                                }
195                                else
196                                {
197                                        for (i=0; i < 10; i++) DecreaseMaxRF();
198                                }
199                                this->Show(this);
200                                break;
201                               
202                        case VK_VOL_UP:
203                        case VK_CH_UP:
204                        case VK_VOL_DN:
205                        case VK_CH_DN:
206                                nPos = nPos ? 0 : 1;
207                                this->Show(this);                       
208                                break;
209                               
210                        case VK_LEFT:
211                                if (nPos == 0)
212                                {
213                                        DecreaseMinRF();
214                                }
215                                else
216                                {
217                                        DecreaseMaxRF();
218                                }
219                                this->Show(this);
220                                break;
221                       
222                        case VK_RIGHT:
223                                if (nPos == 0)
224                                {
225                                        IncreaseMinRF();
226                                }
227                                else
228                                {
229                                        IncreaseMaxRF();
230                                }
231                                this->Show(this);
232                                break;
233                               
234                        default:
235                                this->Close(this);
236                                break;
237                }
238        }
239
240//};
241
242void DST_CreateFrequencySettingWin(SWinEventMsg event)
243{
244        DST_RemoveAllWindowExceptBasicWin();
245        CWindow*pWin = NewCWindow(event);
246        pWin->Destructor        = CFrequncySettingWin_Destructor;
247        pWin->KeyInput          = CFrequncySettingWin_KeyInput;
248        pWin->OnTimer           = CFrequncySettingWin_OnTimer;
249        pWin->ShowWindow        = CFrequncySettingWin_ShowWindow;
250        pWin->Show                      = CFrequncySettingWin_Show;
251        // »ý¼ºÀÚ È£Ãâ
252        CFrequncySettingWin_Constructor(pWin, event);
253        // À©µµ¿ì ¸Þ´ÏÀú¿¡ µî·Ï
254        DST_AddWin((WinID)(event.data[0]), pWin);
255}
256
257
Note: See TracBrowser for help on using the repository browser.