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

Last change on this file was 60, checked in by phkim, 10 years ago
  1. phkim
  2. 금강방송
  3. 변경 내용
    • 서경방송 채널 편집 기능 병합
    • 채널 편집 기능 추가, 기존 검색 방법 변경 (RF,Program number ) -> (major, minor)
    • 채널편집 항목중 추가 -> 시청 으로 문구 변경, 가이드 문구 색상 변경
    • 사용장 키 입력 후 플래시 저장 속도 1초 -> 5초 로 변경
    • UI 동작에 대한 시나리오 통일



File size: 8.6 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;
[42]24static int nMin = 0;
25static int nMax = 0;
[18]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);
[34]37                this->rect.w = DST_GetImageWidth(pin_change_back);
38                this->rect.h = DST_GetImageHeight(pin_change_back);;
[18]39                this->rect.x = (DST_GetScreenWidth() - this->rect.w) / 2;
40                this->rect.y = (DST_GetScreenHeight() - this->rect.h) / 2;
[34]41                nPos = 0;
[18]42
43                this->SetTimeOut(this, 0);
[42]44               
45                nMin = DST_EEPROM_GetMinRF();
46                nMax = DST_EEPROM_GetMaxRF();
[18]47        }
48
49        void CFrequncySettingWin_Destructor(CWindow *this)
50        {
[42]51                // ¼³Á¤°ªÀÌ º¯°æµÇ¾ú´Ù¸é ÃʱâÈ­ÇÑ´Ù.
52                if (nMin != DST_EEPROM_GetMinRF() || nMax != DST_EEPROM_GetMaxRF())
53                {
54                        DST_EEPROM_SetNeedReset(1);
55                        DST_Reset(__func__); // âÀÌ ´ÝÈ÷¸é¼­ ÀçºÎÆÃ
56                }
[18]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);
[27]107                                this->RegisterKey(this, VK_PWR, false, 0, 0);
[19]108                // background
[34]109                this->DrawImage(this, 0, 0, pin_change_back, false);
[18]110       
[25]111                char strText[256];
112               
[37]113                int nLineHeight = (this->rect.h) / 7;
[19]114                // title
[34]115                this->setFontStyle(this, 21, 0xFFC8C8C8, ALIGN_MIDDLE, ALIGN_CENTER);
[28]116                this->DrawText(this, 0, 0, this->rect.w, nLineHeight*2, (char*)"Frequency Setting", &(this->font));
[34]117
118
[37]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
[25]124                switch(nPos)
[18]125                {
[34]126
[25]127                        case 0:
[34]128                                this->setFontStyle(this, 22, 0xFFFFFFFF, ALIGN_MIDDLE, ALIGN_CENTER);
129                               
[25]130                                break;
131                        case 1:
[34]132                                this->setFontStyle(this, 21, 0xFFAAAAAA, ALIGN_MIDDLE, ALIGN_CENTER);
133                               
[25]134                                break;
135                        default:break;
[18]136                }
[25]137
[19]138                int num = DST_EEPROM_GetMinRF();
[25]139               
[19]140                        int rf = DST_GetFrequencyNumberbyIndex(num);
141                        int freq = DST_GetMHzFrequencybyIndex(num);
[37]142                        sprintf(strText, "%d (%dMHz)", rf, freq);
[25]143
[37]144                this->DrawText(this, 0, nLineHeight * 4, (this->rect.w)/2, nLineHeight, (char*)strText, &(this->font));
145
146                //display up /down
[39]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));
[37]153
[39]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));       
[37]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
[25]161                switch(nPos)
[18]162                {
[34]163
[25]164                        case 0:
[34]165                                this->setFontStyle(this, 21, 0xFFAAAAAA, ALIGN_MIDDLE, ALIGN_CENTER);
166                               
[25]167                                break;
168                        case 1:
[34]169                                this->setFontStyle(this, 22, 0xFFFFFFFF, ALIGN_MIDDLE, ALIGN_CENTER);
170                               
[25]171                                break;
172                        default:break;
[18]173                }
[25]174
[19]175                num = DST_EEPROM_GetMaxRF();
[25]176
177                rf = DST_GetFrequencyNumberbyIndex(num);
178                freq = DST_GetMHzFrequencybyIndex(num);
[37]179                sprintf(strText, "%d (%dMHz)", rf, freq);
[25]180
181
[37]182                this->DrawText(this, (this->rect.w)/2, nLineHeight * 4, (this->rect.w)/2, nLineHeight, (char*)strText, &(this->font));
[19]183                // descriptor
[34]184                this->setFontStyle(this, 18, 0xFF666666, ALIGN_MIDDLE, ALIGN_CENTER);
[37]185                this->DrawText(this, 0, nLineHeight * 6, this->rect.w, nLineHeight, (char*)"Left/Right : Next", &(this->font));
[18]186        }
187
188
189//      virtual void KeyInput(DS_U8 key, bool /*bRepeat*/)
190        void IncreaseMaxRF()
191        {
[19]192                if (DST_EEPROM_GetMaxRF() >= DST_MaxRF()) 
193                {
194                        DST_EEPROM_SetMaxRF(DST_MaxRF());
195                        return;
196                }
[25]197                else if (DST_EEPROM_GetMinRF() > DST_EEPROM_GetMaxRF())
198                {
199                        DST_EEPROM_SetMaxRF(DST_EEPROM_GetMinRF());
200                        return;
201                }
[18]202                DST_EEPROM_SetMaxRF(DST_EEPROM_GetMaxRF() + 1);
203        }
204        void DecreaseMinRF()
205        {
[25]206                if (DST_EEPROM_GetMinRF() <= DST_MinRF()) 
[19]207                {
[25]208                        DST_EEPROM_SetMinRF(DST_MinRF());
[19]209                        return;
210                }
[25]211                else if (DST_EEPROM_GetMinRF() > DST_EEPROM_GetMaxRF())
212                {
213                        DST_EEPROM_SetMinRF(DST_EEPROM_GetMaxRF());
214                        return;
215                }
[18]216                DST_EEPROM_SetMinRF(DST_EEPROM_GetMinRF() - 1);
217        }
218        void IncreaseMinRF()
219        {
[25]220                if (DST_EEPROM_GetMinRF() >= DST_MaxRF()) 
[18]221                {
[25]222                        DST_EEPROM_SetMinRF(DST_MaxRF());
[19]223                        return;
[18]224                }
[25]225                else if (DST_EEPROM_GetMinRF() >= DST_EEPROM_GetMaxRF())
226                {
227                        DST_EEPROM_SetMinRF(DST_EEPROM_GetMaxRF());
228                        return;
229                }
230
[19]231                DST_EEPROM_SetMinRF(DST_EEPROM_GetMinRF() + 1);
[18]232        }
233        void DecreaseMaxRF()
234        {
[25]235                if (DST_EEPROM_GetMaxRF() <= DST_MinRF()) 
[18]236                {
[25]237                        DST_EEPROM_SetMaxRF(DST_MinRF());
[19]238                        return;
[18]239                }
[25]240                else if (DST_EEPROM_GetMinRF() >= DST_EEPROM_GetMaxRF())
241                {
242                        DST_EEPROM_SetMaxRF(DST_EEPROM_GetMinRF());
243                        return;
244                }
245
[19]246                DST_EEPROM_SetMaxRF(DST_EEPROM_GetMaxRF() - 1);
[18]247        }
248        void CFrequncySettingWin_KeyInput(CWindow *this, DS_U8 key, bool bRepeat)
249        {
250                int i = 0;
[34]251               
[18]252                switch(key)
253                {
[34]254                        case VK_VOL_UP:
255                        case VK_CH_UP:
256                       
[25]257                                switch(nPos)
[18]258                                {
[34]259
[25]260                                        case 0:
[34]261
[25]262                                                        for (i=0; i < 10; i++) IncreaseMinRF();
[34]263
[25]264                                                break;
[34]265                                        case 1:
266
[25]267                                                        for (i=0; i < 10; i++) IncreaseMaxRF();
[34]268
[25]269                                                break;
270                                                default:break;
[18]271                                }
[25]272
[18]273                                this->Show(this);
274                                break;
275                               
[34]276                        case VK_VOL_DN:
277                        case VK_CH_DN:
278
[25]279                                switch(nPos)
[18]280                                {
[34]281
[25]282                                        case 0:
[34]283
[25]284                                                        for (i=0; i < 10; i++) DecreaseMinRF();
[34]285                                               
[25]286                                                break;
[34]287                                        case 1:
288
[25]289                                                        for (i=0; i < 10; i++) DecreaseMaxRF();
[34]290                                               
[25]291                                                break;
292                                                default:break;
[18]293                                }
[25]294
[18]295                                this->Show(this);
296                                break;
297                               
[37]298                        case VK_LEFT:
299                        case VK_RIGHT:
[34]300                                nPos = nPos==1?0:1;
[18]301                                this->Show(this);                       
302                                break;
303                               
[37]304                        case VK_DN:
[25]305                                switch(nPos)
[18]306                                {
[25]307                                        case 0:
[34]308                                                DecreaseMinRF();
[25]309                                                break;
310                                        case 1:
[34]311                                                DecreaseMaxRF();
[25]312                                                break;
313                                                default:break;
[18]314                                }
[25]315
[18]316                                this->Show(this);
317                                break;
318                       
[37]319                        case VK_UP:
[25]320                                switch(nPos)
[18]321                                {
[25]322                                        case 0:
[34]323                                                IncreaseMinRF();
[25]324                                                break;
325                                        case 1:
[34]326                                                IncreaseMaxRF();
[25]327                                                break;
328                                                default:break;
[18]329                                }
[25]330
[18]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.