source: svn/zasc/app_c/DST_WinMainMenu.c

Last change on this file was 76, checked in by megakiss, 10 years ago

1W 대기전력을 만족시키기 위하여 POWEROFF시 튜너를 Standby 상태로 함

File size: 19.6 KB
Line 
1#include "DST_Window.h"
2#include "DST_WinManager.h"
3#include "DST_CommonAPI.h"
4#include "DST_DataStrings.h"
5#include "DST_UserInterface.h"
6#include "DST_CCTask.h"
7#include "DST_ChannelTune.h"
8#include "DST_DB.h"
9#include "DST_OSDImage.h"
10#include "DST_SignalMonitor.h"
11#include "DST_EEPROM.h"
12
13
14typedef struct 
15{
16        MainMenuLists menu;
17        bool bEnable;
18}MAIN_MENU;
19
20static MAIN_MENU CMainMenu_tv_menu[] = {
21        {       MN_AUTO_SCAN,   true    },
22        {       MN_MANUAL_SCAN, true    },
23        {       MN_SIGNAL_METER,        false   },
24        {       MN_AV_DISPLAY_MODE,     true    },
25        {       MN_AV_AUDIO_PREF,       true    },
26        {       MN_AV_VI,       true    },
27        {       MN_CC_DISPLAY,  true    },
28        {       MN_SLEEP_TIMER, true    },
29        {       MN_AV_PREFERRED_CONN,   true    },
30        {       MN_FACTORY_RESET,       true    },
31        {       MN_STB_INFO,    true    },
32        { MN_MAX_NUM, false}
33};
34
35
36//class CZASMainMenu: public CWindow
37//{
38//private:
39
40        static DS_U16 CMainMenu_g_nPos;
41        static DS_U16 CMainMenu_g_nTop;
42        static DS_U16 CMainMenu_mainSelect;
43        static DS_U16 CMainMenu_mainListNum;
44        static DS_U16 CMainMenu_mainItemNum;
45       
46
47        static DS_U16 CMainMenu_cursor[20];
48        static DS_U16 CMainMenu_select[20];
49        static DS_U16 CMainMenu_userSavedValue[20];
50
51        static DS_U16 CMainMenu_listNum[20];
52        static DS_U16 CMainMenu_itemNum[20];
53        static DS_U16 CMainMenu_SubTop[20];
54
55        static int  CMainMenu_MenuIdx;
56       
57        void CMainMenu_InitValues();
58        void CMainMenu_SetSize(CWindow *this);
59        int CMainMenu_GetCount();
60        void CMainMenu_GetValuse(DS_U16 menu, DS_U16 *value);
61
62//public:
63//      CZASMainMenu(SWinEventMsg event):CWindow(event)
64        void CMainMenu_Constructor(CWindow *this, SWinEventMsg event)
65        {
66                CMainMenu_InitValues();
67                CMainMenu_SetSize(this);
68                this->SetTimeOut(this, 100);
69               
70        }
71
72//      virtual ~CZASMainMenu()
73        void CMainMenu_Desnstructor(CWindow *this)
74        {
75                if(DST_GetWin(WIN_FACTORY_RESET)) DST_CreateWin(WIN_MAIN_MENU, 0, 0, 0, 0, 0);
76                if(DST_GetWin(WIN_FACTORY_RESET_ASK)) DST_CreateWin(WIN_MAIN_MENU, 0, 0, 0, 0, 0);
77                if(DST_g_SignalState == SM_AUDIO_ONLY) DST_CreateWin(WIN_CHANNEL_BANNER, WIN_NULL, BANNER_NORMAL ,0, 0, 0);
78        }
79
80        bool CMainMenu_getTR_AspectRatio()
81        {
82                DS_U16 w = 0, h = 0, fps = 0;
83                bool bWide = false, bInterlace = false;
84                DST_GetVideoSize(&w, &h, &fps, &bInterlace, &bWide);
85               
86                return (!bWide);
87        }
88
89        DS_U8 CMainMenu_getAspectRatioIndex()
90        {
91                if(CMainMenu_getTR_AspectRatio()) return 1;
92                else return 3;
93        }
94
95        MainMenuLists CMainMenu_Index2MenuLists(int index)
96        {
97                int nPos = -1;
98                int i = 0;
99                MainMenuLists menu = MN_AUTO_SCAN;
100                if (index < CMainMenu_mainItemNum)
101                {
102                        for (i = 0; i < 20; i++)
103                        {
104                               
105                                if (CMainMenu_tv_menu[i].bEnable) nPos++;
106                                if (nPos != index) continue;
107                                menu = CMainMenu_tv_menu[i].menu;
108                                break;
109                        }
110                }
111                return menu;
112        }
113       
114        DS_U16 CMainMenu_GetSubCount(DS_U16 menu)
115        {
116                switch(CMainMenu_Index2MenuLists(menu))
117                {
118                        case MN_AUTO_SCAN: return 1;
119                        case MN_MANUAL_SCAN: return 1;
120                        case MN_SIGNAL_METER: return 1;
121                        case MN_AV_DISPLAY_MODE: return CMainMenu_getAspectRatioIndex();
122                        case MN_AV_AUDIO_PREF: return 2;
123                        case MN_AV_VI: return 2;
124                        case MN_CC_DISPLAY: return 2;
125                        case MN_SLEEP_TIMER: return SLEEP_TIMER_MAX_NUM;
126                        case MN_AV_PREFERRED_CONN: return PREFERRED_CONN_MAX_NUM;
127                        case MN_FACTORY_RESET: return 1;
128                        case MN_STB_INFO: return 1;
129                        default: break;
130                }
131                return 0;
132        }
133
134        void CMainMenu_InitSubValues()
135        {
136                int i = 0;
137                for(i = 0 ; i < CMainMenu_mainItemNum ; i++)
138                {
139                        CMainMenu_cursor[i]             =0;
140                        CMainMenu_select[i]             =0;
141                        CMainMenu_userSavedValue[i] =0;
142
143                        CMainMenu_listNum[i] = 0;
144                        CMainMenu_itemNum[i] = 0;
145                        CMainMenu_SubTop[i] = 0;
146               
147                        CMainMenu_listNum[i] = 6;
148                        CMainMenu_itemNum[i]  = CMainMenu_GetSubCount(i);
149                        if (CMainMenu_itemNum[i] < CMainMenu_listNum[i]) CMainMenu_listNum[i] = CMainMenu_itemNum[i];
150                        CMainMenu_GetValuse(i, &CMainMenu_select[i]);
151                        CMainMenu_userSavedValue[i] = CMainMenu_select[i];
152                        InitItemValues(CMainMenu_listNum[i], CMainMenu_select[i], &CMainMenu_SubTop[i], &CMainMenu_cursor[i]);
153                }
154        }
155       
156        void CMainMenu_InitValues()
157        {
158                CMainMenu_MenuIdx = 0;/*DST_UI_GetSource();*/
159               
160                CMainMenu_mainItemNum = CMainMenu_GetCount();
161                CMainMenu_g_nTop = MenuTop[CMainMenu_MenuIdx];
162                CMainMenu_g_nPos = MenuPos[CMainMenu_MenuIdx];
163                CMainMenu_mainSelect = MenuSelect[CMainMenu_MenuIdx];
164                CMainMenu_mainListNum = 6;
165                if (CMainMenu_mainItemNum < CMainMenu_mainListNum) CMainMenu_mainListNum = CMainMenu_mainItemNum;
166                CMainMenu_InitSubValues();
167               
168        }
169
170        int CMainMenu_GetCount()
171        {
172                int MenuCount = 0;
173                int i = 0;
174                for (i = 0; i < 20; i++)
175                {
176                        if (CMainMenu_tv_menu[i].menu == MN_MAX_NUM) break;
177                        if (CMainMenu_tv_menu[i].bEnable) MenuCount++;
178                }
179                return MenuCount;
180        }
181       
182        void CMainMenu_GetValuse(DS_U16 menu, DS_U16 *value)
183        {
184                switch(CMainMenu_Index2MenuLists(menu))
185                {
186                        case MN_AUTO_SCAN: *value = 0; break;
187                        case MN_MANUAL_SCAN: *value = 0; break;
188                        case MN_SIGNAL_METER: *value = 0; break;
189                        case MN_AV_DISPLAY_MODE: *value = DST_UI_GetAspect(); break;
190                        case MN_AV_AUDIO_PREF: *value = DST_UI_GetMTS(); break;
191                        case MN_AV_VI: *value = DST_UI_GetVI(); break;
192                        case MN_CC_DISPLAY: *value = DST_EEPROM_GetCC(); break;
193                        case MN_SLEEP_TIMER: *value = DST_GetSleepTimer(); break;
194                        case MN_AV_PREFERRED_CONN: *value = DST_UI_GetCh34(); break;
195                        case MN_FACTORY_RESET: *value = 0; break;
196                        case MN_STB_INFO: *value = 0; break;
197                        default: break;
198                }
199        }
200
201        void CMainMenu_SetValuse(DS_U16 menu, DS_U16 value)
202        {
203                switch(CMainMenu_Index2MenuLists(menu))
204                {
205                        case MN_AUTO_SCAN:break;
206                        case MN_MANUAL_SCAN: break;
207                        case MN_SIGNAL_METER: break;
208                        case MN_AV_DISPLAY_MODE: DST_UI_SetAspect(value); break;
209                        case MN_AV_AUDIO_PREF: DST_UI_SetMTS(value); break;
210                        case MN_AV_VI: DST_UI_SetVI(value); break;
211                        case MN_CC_DISPLAY: DST_UI_SetCloseCaption(value); break;
212                        case MN_SLEEP_TIMER:
213                                if(0 < value && value < 5 )DST_g_sleepTimercheckTime = DST_OS_GetTickCount(); 
214                                DST_SetSleepTimer(value); 
215                                break; 
216                        case MN_AV_PREFERRED_CONN: DST_UI_SetCh34(value); break;
217                        case MN_FACTORY_RESET: break;
218                        case MN_STB_INFO: break;
219                        default: break;
220                }
221        }
222       
223
224       
225        DS_U16* CMainMenu_GetString(int nPos)
226        {
227                switch (CMainMenu_Index2MenuLists(nPos))
228                {
229                        case MN_AUTO_SCAN: return pz_Sub_AutoScan[OSD_Lang]; break;
230                        case MN_MANUAL_SCAN: return pz_ManualSearch[OSD_Lang]; break;
231                        case MN_SIGNAL_METER: return pz_Sub_SignalMeter[OSD_Lang]; break;
232                        case MN_AV_DISPLAY_MODE: return pz_Sub_DisplayMode[OSD_Lang]; break;
233                        case MN_AV_AUDIO_PREF: return pz_Sub_AudioPref[OSD_Lang]; break;
234                        case MN_AV_VI: return pz_Sub_DVS[OSD_Lang]; break;
235                        case MN_CC_DISPLAY: return pz_Sub_CC[OSD_Lang]; break;
236                        case MN_SLEEP_TIMER: return pz_Sub_SleepTime[OSD_Lang]; break;
237                        case MN_AV_PREFERRED_CONN: return pz_Sub_PrefConn[OSD_Lang]; break;
238                        case MN_FACTORY_RESET: return pz_Sub_Factory[OSD_Lang]; break;
239                        case MN_STB_INFO: return pz_Sub_STB_Info[OSD_Lang];
240                        default: break;
241                }
242                return 0;
243        }
244
245        DS_U16* CMainMenu_GetSubString(int itemIdx, int nPos)
246        {
247                static DS_U16 strText[32];
248                unsigned i = 0;
249                // ±âº»°ª..À̰ªÀÌ ¶á´Ù¸é ¹ö±×
250                for (i = 0; i < 40; i++)
251                {
252                        strText[i] = pz_Unknown[OSD_Lang][i];
253                        if (strText[i] == 0) break;
254                }
255
256                switch (CMainMenu_Index2MenuLists(itemIdx))
257                {
258
259                        case MN_AV_DISPLAY_MODE:
260                                switch(nPos)
261                                {
262                                        case DISPLAY_MODE_WIDE: return pz_Wide[OSD_Lang]; break;
263                                        case DISPLAY_MODE_NORMAL: return pz_Normal[OSD_Lang]; break;
264                                        case DISPLAY_MODE_ZOOM: return pz_Zoom[OSD_Lang]; break;
265                                        default: break;
266                                }
267                                break;
268
269                        case MN_AV_AUDIO_PREF:
270                                switch (nPos)
271                                {
272                                        case  0: return pz_MTS_Main[OSD_Lang];
273                                        case  1: return pz_MTS_Sub[OSD_Lang];
274                                        default: break;
275                                }
276                                break;
277                               
278                        case MN_AV_VI:
279                                switch (nPos)
280                                {
281                                        case  0: return pz_VI_Off[OSD_Lang];
282                                        case  1: return pz_VI_On[OSD_Lang];
283                                        default: break;
284
285                                }
286                                break;
287                               
288                        case MN_CC_DISPLAY:
289                                switch (nPos)
290                                {
291                                        case  0: return pz_Off[OSD_Lang]; break;
292                                        case  1: return pz_On[OSD_Lang]; break;
293                                        default: break;
294                                }
295                                break;
296                               
297                        case MN_SLEEP_TIMER:
298                                switch(nPos)
299                                {
300                                        case SLEEP_TIMER_OFF: return pz_Off[OSD_Lang]; break;
301                                        case SLEEP_TIMER_15M: return pz_Sub_SleepTime_15[OSD_Lang]; break;
302                                        case SLEEP_TIMER_30M: return pz_Sub_SleepTime_30[OSD_Lang]; break;
303                                        case SLEEP_TIMER_60M: return pz_Sub_SleepTime_60[OSD_Lang]; break;
304                                        case SLEEP_TIMER_120M: return pz_Sub_SleepTime_120[OSD_Lang]; break;
305                                        default: break;
306                                }
307                                break;
308                               
309                        case MN_AV_PREFERRED_CONN:
310                                switch(nPos)
311                                {
312                                        case PREFERRED_CONN_LINE_OUT: return pz_Sub_LineOut[OSD_Lang]; break;
313                                        case PREFERRED_CONN_CH34: return pz_Sub_CH34[OSD_Lang]; break;
314                                        default: break;
315                                }
316                                break;
317                               
318                        case MN_AUTO_SCAN:
319                        case MN_MANUAL_SCAN:
320                        case MN_SIGNAL_METER:
321                        case MN_FACTORY_RESET:
322                        case MN_STB_INFO:
323                                switch (nPos)
324                                {
325                                        case  0: return pz_Empty[OSD_Lang];
326                                }
327                                break;
328                        default:
329                                break;
330                }
331                return 0;
332        }
333
334        void CMainMenu_SetSize(CWindow *this)
335        {
336                this->rect.w = DST_GetImageWidth(back);
337                this->rect.h = DST_GetImageHeight(back);
338                this->rect.x = (DST_GetScreenWidth() - this->rect.w)/2;
339                this->rect.y = ((DST_GetScreenHeight() - this->rect.h)/2)+10;
340        }
341
342//      virtual void Focus(bool bVal)
343        void CMainMenu_Focus(CWindow *this, bool bVal)
344        {
345                this->RegisterKey(this, VK_MENU, bVal, 0, 0);
346                this->RegisterKey(this, VK_CANCEL, bVal, 0, 0);
347                this->RegisterKey(this, VK_LEFT, bVal, 0, 0);
348                this->RegisterKey(this, VK_RIGHT, bVal, 0, 0);
349                this->RegisterKey(this, VK_UP, bVal, 0, 0);
350                this->RegisterKey(this, VK_DN, bVal, 0, 0);
351                this->RegisterKey(this, VK_OK, bVal, 0, 0);
352                this->RegisterKey(this, VK_CH_UP, bVal, 0, 0);
353                this->RegisterKey(this, VK_CH_DN, bVal, 0, 0);
354                this->RegisterKey(this, VK_PREV, bVal, 0, 0);
355                this->RegisterKey(this, VK_PREV_CH, bVal, 0, 0);
356                this->RegisterKey(this, VK_PREV_MENU, bVal, 0, 0);
357        }
358       
359//      virtual void Show(WinID id)
360        void CMainMenu_ShowWindow(CWindow *this, WinID id)
361        {
362                switch(id)
363                {
364                        case WIN_DEBUG_SQL:
365                        case WIN_DEBUG_SQL_SUB:
366                        case WIN_ENGINEER_MODE:
367                        case WIN_FREQUENCY_SETTING:     
368                        case WIN_EWS:
369                        case WIN_DIRECT_TUNE:
370                        case WIN_CLOSED_CAPTION_HOT:
371                        case WIN_AUDIO_HOT:
372                        case WIN_DISPLAY_MODE_HOT:
373                        case WIN_FACTORY_RESET:
374                        case WIN_FACTORY_RESET_ASK:
375                        case WIN_INFOR_BANNER:
376                        case WIN_POWER_DOWN_CAUTION:
377                        case WIN_AUTO_SEARCH:
378                        case WIN_MANUAL_SEARCH:
379                        case WIN_CHANNEL_LIST:
380                        case WIN_PROGRAM_GUIDE:
381                        case WIN_AGE_RATING:
382                                this->Close(this);
383                                break;
384                        default:
385                                break;         
386                }
387        }
388       
389         void CMainMenu_DrawScrollBar(CWindow *this, int x, int y, int h, int total_count, int page_count, int page_start)
390         {
391                 if (total_count <= page_count) return;
392                 // ¼±Åà ±×¸®±â
393                 int nTop = DST_GetImageHeight(scroll_p_1);
394                 int nBot = DST_GetImageHeight(scroll_p_3);
395                 int nMinHeight = nTop + nBot + 1; // ÃÖ¼Ò ³ôÀÌ
396                 int nHeight = (h * page_count) / total_count; // ³ôÀÌ
397                 if (nHeight < nMinHeight) nHeight = nMinHeight; 
398                 int nStart = (h * page_start) / total_count;
399                 if (nStart + nHeight > h) nStart = h - nHeight; // ¾Æ·¡·Î »ßÁ®³ª¿À´Â°Í ¹æÁö
400                 if (total_count == page_start + page_count) nStart = h - nHeight; // ¾Æ·¡ ÇÑÇȼ¿ »ù ¹æÁö
401                 int nMid = nHeight - nTop - nBot;       
402                 this->DrawImage(this, x, y+nStart, scroll_p_1, true);
403                 int yy = 0;
404                 for (yy = 0; yy < nMid; yy++)
405                 {
406                         this->DrawImage(this, x,y+yy+nStart+nTop,scroll_p_2,false);
407                 }
408                 this->DrawImage(this, x,y+nStart+nTop+nMid,scroll_p_3,true);
409         }
410
411         //ȯ°æ¼³Á¤ ¸Þ´º ŸÀÌÆ² ±×¸®±â
412        void CMainMenu_DrawTitle(CWindow *this)
413        {
414                this->setFontStyle(this, 22,0xFFE1E1E1,ALIGN_MIDDLE,ALIGN_CENTER);
415                this->DrawTextUni(this, 323-313, 82-78, 312, 42, pz_Empty[OSD_Lang], &(this->font));
416        }
417
418         //³×ºñ°ÔÀÌ¼Ç ±×¸®±â
419        void CMainMenu_DrawNavigation(CWindow *this)
420        {
421                this->setFontStyle(this, 20,0xFF7B7B7B,this->FontGetVerAlign(this),ALIGN_LEFT);
422
423                DS_U16  final[20];
424
425                this->DrawImage(this, 433-313,426-78, arrow_ud, false);
426                str2uni(final, (char *)": ");
427                strcpy16(&final[strlen16(final)], pz_Move[OSD_Lang]);
428                this->DrawTextUni(this, 454-313, 428-78, 79, 22, final, &(this->font));
429
430                this->DrawImage(this, 545-313,426-77,arrow_lr, false);
431                str2uni(final, (char *)": ");
432                strcpy16(&final[strlen16(final)], pz_Select[OSD_Lang]);
433                this->DrawTextUni(this,569-313, 428-78, 79, 22, final, &(this->font));
434        }
435
436         //È­¸é¿¡ ³ªÅ¸³ª´Â ¸ÞÀÎÇ׸ñ ±×¸²
437        void CMainMenu_DrawCategory(CWindow *this, int index)
438        {
439                int y_Constant=157;
440                int y_Multiplier=42;
441                int width=163;
442                if(MenuPos[CMainMenu_MenuIdx] == index)
443                        this->setFontStyle(this, 21,0xFFFFFFFF,this->FontGetVerAlign(this),ALIGN_LEFT);
444                else 
445                        this->setFontStyle(this, 21,0xFFC8C8C8,this->FontGetVerAlign(this),ALIGN_LEFT);
446
447                this->DrawTextUni(this, 344-313, (y_Constant-78)+index*y_Multiplier, width, 20, CMainMenu_GetString(index+CMainMenu_g_nTop), &(this->font));
448
449                if(MenuPos[CMainMenu_MenuIdx] == index)
450                {
451                        int i = 0;
452                        this->DrawImage(this, 333-313, (145-76)+index*y_Multiplier, hl_orange_l,true);
453                        for( i=0;i<255;i++)
454                        {
455                                this->DrawImage(this, (333-313)+15+i, (145-76)+index*y_Multiplier, hl_orange_mid, false);
456                        }
457                        this->DrawImage(this, (333-313)+270, (145-76)+index*y_Multiplier, hl_orange_r,true);
458
459                        this->DrawTextUni(this, 344-313, (y_Constant-78)+index*y_Multiplier, width, 20, CMainMenu_GetString(index+CMainMenu_g_nTop), &(this->font));   
460
461                        //Aspect Ratio°¡ Çϳª¹Û¿¡ ¼±ÅøøÇÒ°æ¿ì, ȤÀº ºñµð¿À°¡ Ç÷¹ÀÌ µÇÁö ¾Ê´Â °æ¿ì ´ÙÀ½À» ±×¸®Áö ¾ÊÀ½
462                        if(CMainMenu_Index2MenuLists(MenuSelect[CMainMenu_MenuIdx]) == MN_AV_DISPLAY_MODE)
463                        {
464                                if(CMainMenu_getAspectRatioIndex() == 1 || DST_IsVideoPlay() == false) return;
465                                       
466                        }
467                       
468                        this->DrawImage(this, 601-313,(160-76)+index*y_Multiplier,arrow_right,true);
469                        switch(CMainMenu_Index2MenuLists(MenuSelect[CMainMenu_MenuIdx]))
470                        {
471                                case MN_AUTO_SCAN:
472                                case MN_MANUAL_SCAN:
473                                case MN_SIGNAL_METER:
474                                case MN_FACTORY_RESET:
475                                case MN_STB_INFO:
476                                        break;
477                                default:
478                                        this->DrawImage(this, 514-313,(160-76)+index*y_Multiplier,arrow_left,true);
479                                        break;
480                                               
481                        }
482                       
483                }
484        }
485         //È­¸é¿¡ ³ªÅ¸³ª´Â ¼¼ºÎÇ׸ñ ±×¸²
486        void CMainMenu_DrawItems(CWindow *this, int mainIndex,int subIndex)
487        {
488                int y_Constant=157;
489                int y_Multiplier=42;
490                int width=80;
491                int nFontSize=20;
492                if(MenuPos[CMainMenu_MenuIdx] == mainIndex)
493                        this->setFontStyle(this, 21,0xFFFFFFFF,this->FontGetVerAlign(this),ALIGN_CENTER);
494                else 
495                        this->setFontStyle(this, 21,0xFFF06E03,this->FontGetVerAlign(this),ALIGN_LEFT);
496                DS_U16* strText16 = CMainMenu_GetSubString(mainIndex+CMainMenu_g_nTop,subIndex);
497                int k = 0;
498                for (k = nFontSize; k > 10; k--)
499                {
500                        int nWidth = DST_GetTextWidthUni(strText16, k);
501                        if (nWidth > width) continue;
502                        nFontSize = k;
503                        break;
504                }
505                this->FontSetSize(this, nFontSize); 
506               
507                this->DrawTextUni(this, 522-313, (y_Constant-78)+mainIndex*y_Multiplier,        width, 20, strText16, &(this->font));
508               
509        }
510
511        void CMainMenu_DrawMenu(CWindow *this, int categoryIndex)
512        {
513                this->setFontStyle(this, 21,this->FontGetColor(this),ALIGN_MIDDLE,this->FontGetHorAlign(this));
514               
515                CMainMenu_DrawCategory(this, categoryIndex);
516                CMainMenu_DrawItems(this, categoryIndex,CMainMenu_userSavedValue[categoryIndex+CMainMenu_g_nTop]);
517        }
518
519        void CMainMenu_Draw(CWindow *this)
520        {
521                this->DrawImage(this,0,0, (DS_U8*)back,false);
522               
523                CMainMenu_DrawScrollBar(this, 622-313, 145-77, 42*CMainMenu_mainListNum-1, CMainMenu_mainItemNum, CMainMenu_mainListNum, CMainMenu_g_nTop);
524
525                int i = 0;
526                for(i=0;i<CMainMenu_mainListNum;i++)
527                        CMainMenu_DrawMenu(this, i);
528                CMainMenu_DrawNavigation(this);
529               
530        }
531
532        void CMainMenu_DrawSubMenu(CWindow *this, DS_U8 key)
533        {
534                switch(key)
535                {
536                        case VK_RIGHT:
537                        case VK_OK:
538                                switch(CMainMenu_Index2MenuLists(CMainMenu_mainSelect))
539                                {
540                                        case MN_AUTO_SCAN:
541                                                DST_CreateWin(WIN_AUTO_SEARCH, WIN_MAIN_MENU, 0, 0, 0, 0); 
542                                                this->Close(this);
543                                                break;
544                                        case MN_MANUAL_SCAN:
545                                                DST_CreateWin(WIN_MANUAL_SEARCH, WIN_MAIN_MENU,0 ,0 ,0 ,0);
546                                                this->Close(this);
547                                                break;
548                                        case MN_SIGNAL_METER:
549                                                DST_CreateWin(WIN_SIGNAL_METER, WIN_NULL,0,0,0,0);
550                                                this->Close(this);
551                                                break;
552                                        case MN_FACTORY_RESET:
553                                                DST_CreateWin(WIN_FACTORY_RESET_ASK, WIN_MAIN_MENU, 0, 0, 0, 0);
554                                                this->Close(this);
555                                                break;
556                                        case MN_STB_INFO:
557                                                DST_CreateWin(WIN_STB_INFO, WIN_NULL, 0, 0, 0, 0);
558                                                break;
559                                        default:
560                                                break;
561                                }
562                                break;
563                        default:
564                                break;
565                }
566               
567        }
568
569//      virtual void Show(void)
570        void CMainMenu_Show(CWindow *this)
571        {
572                CMainMenu_Draw(this);
573                this->DoFocus(this, true);
574        }
575
576//      virtual void OnMessage(SWinEventMsg event)
577        void CMainMenu_OnMessage(CWindow *this, SWinEventMsg event)
578        {
579                switch (event.cmd)
580                {
581                         //¸Þ´º°¡ ¶°ÀÖ´Â »óÅ¿¡¼­ ¹æ¼Û È­¸éºñÀ² ¼Ò½º°¡ º¯°æÀÌ µÇ¸é ÇØ´ç»çÇ× ¾÷µ¥ÀÌÆ®
582                        case WM_SOURCE_FORMAT_DONE:
583                                CMainMenu_InitSubValues(); //¸ðµå¿¡ ¸Â°Ô UI°ª º¯°æ
584                                DST_UI_SetAspect( DST_UI_GetAspect());//¹Ù²ï È­¸éºñÀ²·Î ¼¼ÆÃ
585                                CMainMenu_Draw(this);
586                                break;
587                }
588        }       
589//      virtual void KeyInput(DS_U8 key, bool /*bRepeat*/)
590        void CMainMenu_KeyInput(CWindow *this, DS_U8 key, bool bRepeat)
591        {
592                switch (key)
593                {
594                         //¿À¸¥ÂÊ ¿ÞÂÊÀ¸·Î ¹Ù·Î ¼±ÅÃ
595                        case VK_RIGHT:
596                        case VK_LEFT:
597                               
598                                if(key == VK_LEFT)
599                                        ItemDecrease(CMainMenu_itemNum[MenuSelect[CMainMenu_MenuIdx]], CMainMenu_itemNum[MenuSelect[CMainMenu_MenuIdx]], &CMainMenu_SubTop[MenuSelect[CMainMenu_MenuIdx]], &CMainMenu_select[MenuSelect[CMainMenu_MenuIdx]], &CMainMenu_cursor[MenuSelect[CMainMenu_MenuIdx]],1);
600                                else
601                                        ItemIncrease(CMainMenu_itemNum[MenuSelect[CMainMenu_MenuIdx]], CMainMenu_itemNum[MenuSelect[CMainMenu_MenuIdx]], &CMainMenu_SubTop[MenuSelect[CMainMenu_MenuIdx]], &CMainMenu_select[MenuSelect[CMainMenu_MenuIdx]], &CMainMenu_cursor[MenuSelect[CMainMenu_MenuIdx]],1);
602                               
603                                CMainMenu_userSavedValue[MenuSelect[CMainMenu_MenuIdx]] = CMainMenu_select[MenuSelect[CMainMenu_MenuIdx]];
604                                CMainMenu_SetValuse(MenuSelect[CMainMenu_MenuIdx], CMainMenu_select[MenuSelect[CMainMenu_MenuIdx]]);
605                                CMainMenu_InitSubValues();
606                               
607                                CMainMenu_Draw(this);
608                                CMainMenu_DrawSubMenu(this, key);
609                                break;
610
611                        case VK_UP:
612                        case VK_DN:
613                                if(key == VK_DN)
614                                        ItemIncrease(CMainMenu_mainItemNum, CMainMenu_mainListNum, &CMainMenu_g_nTop, &CMainMenu_mainSelect, &CMainMenu_g_nPos, 1);
615                                else
616                                        ItemDecrease(CMainMenu_mainItemNum, CMainMenu_mainListNum, &CMainMenu_g_nTop, &CMainMenu_mainSelect, &CMainMenu_g_nPos, 1);
617                                MenuTop[CMainMenu_MenuIdx] = CMainMenu_g_nTop;
618                                MenuPos[CMainMenu_MenuIdx] = CMainMenu_g_nPos;
619                                MenuSelect[CMainMenu_MenuIdx] = CMainMenu_mainSelect;
620                                CMainMenu_InitSubValues();
621                                CMainMenu_Draw(this);
622                                break;
623                               
624                        case VK_OK:
625                                CMainMenu_DrawSubMenu(this, key);
626                                break;
627                        case VK_CANCEL:
628                        case VK_MENU:
629                        case VK_PREV:
630                        case VK_PREV_CH:
631                        case VK_PREV_MENU:
632                                if(DST_UI_GetMute() && DST_GetWin(WIN_VOLUME_MUTE)==0) DST_CreateWin(WIN_VOLUME_MUTE, 0, 0, 0, 0, 0);
633                                this->Close(this);
634                                if(DST_g_SignalState == SM_AUDIO_ONLY) DST_CreateWin(WIN_CHANNEL_BANNER, WIN_NULL, BANNER_NORMAL ,0, 0, 0);
635                                break;
636
637                        default:
638                                break;
639                }
640        }
641//};
642
643void DST_CreateMainMenu(SWinEventMsg event)
644{
645        CWindow*pWin = NewCWindow(event);
646        pWin->Destructor = CMainMenu_Desnstructor;
647        pWin->OnMessage = CMainMenu_OnMessage; 
648        pWin->KeyInput = CMainMenu_KeyInput;
649        pWin->Focus = CMainMenu_Focus;
650        pWin->ShowWindow = CMainMenu_ShowWindow;
651        pWin->Show = CMainMenu_Show;
652        // »ý¼ºÀÚ È£Ãâ
653        CMainMenu_Constructor(pWin, event);
654        // À©µµ¿ì ¸Þ´ÏÀú¿¡ µî·Ï
655        DST_AddWin((WinID)(event.data[0]), pWin);
656}
657
Note: See TracBrowser for help on using the repository browser.