source: svn/trunk/zasc/app_c/DST_WinMainMenu.c @ 2

Last change on this file since 2 was 2, checked in by jglee, 11 years ago

first commit

File size: 19.5 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_EWS:
368                        case WIN_DIRECT_TUNE:
369                        case WIN_CLOSED_CAPTION_HOT:
370                        case WIN_AUDIO_HOT:
371                        case WIN_DISPLAY_MODE_HOT:
372                        case WIN_FACTORY_RESET:
373                        case WIN_FACTORY_RESET_ASK:
374                        case WIN_INFOR_BANNER:
375                        case WIN_POWER_DOWN_CAUTION:
376                        case WIN_AUTO_SEARCH:
377                        case WIN_MANUAL_SEARCH:
378                        case WIN_CHANNEL_LIST:
379                        case WIN_PROGRAM_GUIDE:
380                        case WIN_AGE_RATING:
381                                this->Close(this);
382                                break;
383                        default:
384                                break;         
385                }
386        }
387       
388         void CMainMenu_DrawScrollBar(CWindow *this, int x, int y, int h, int total_count, int page_count, int page_start)
389         {
390                 if (total_count <= page_count) return;
391                 // ¼±Åà ±×¸®±â
392                 int nTop = DST_GetImageHeight(scroll_p_1);
393                 int nBot = DST_GetImageHeight(scroll_p_3);
394                 int nMinHeight = nTop + nBot + 1; // ÃÖ¼Ò ³ôÀÌ
395                 int nHeight = (h * page_count) / total_count; // ³ôÀÌ
396                 if (nHeight < nMinHeight) nHeight = nMinHeight; 
397                 int nStart = (h * page_start) / total_count;
398                 if (nStart + nHeight > h) nStart = h - nHeight; // ¾Æ·¡·Î »ßÁ®³ª¿À´Â°Í ¹æÁö
399                 if (total_count == page_start + page_count) nStart = h - nHeight; // ¾Æ·¡ ÇÑÇȼ¿ »ù ¹æÁö
400                 int nMid = nHeight - nTop - nBot;       
401                 this->DrawImage(this, x, y+nStart, scroll_p_1, true);
402                 int yy = 0;
403                 for (yy = 0; yy < nMid; yy++)
404                 {
405                         this->DrawImage(this, x,y+yy+nStart+nTop,scroll_p_2,false);
406                 }
407                 this->DrawImage(this, x,y+nStart+nTop+nMid,scroll_p_3,true);
408         }
409
410         //ȯ°æ¼³Á¤ ¸Þ´º ŸÀÌÆ² ±×¸®±â
411        void CMainMenu_DrawTitle(CWindow *this)
412        {
413                this->setFontStyle(this, 22,0xFFE1E1E1,ALIGN_MIDDLE,ALIGN_CENTER);
414                this->DrawTextUni(this, 323-313, 82-78, 312, 42, pz_Empty[OSD_Lang], &(this->font));
415        }
416
417         //³×ºñ°ÔÀÌ¼Ç ±×¸®±â
418        void CMainMenu_DrawNavigation(CWindow *this)
419        {
420                this->setFontStyle(this, 20,0xFF7B7B7B,this->FontGetVerAlign(this),ALIGN_LEFT);
421
422                DS_U16  final[20];
423
424                this->DrawImage(this, 433-313,426-78, arrow_ud, false);
425                str2uni(final, (char *)": ");
426                strcpy16(&final[strlen16(final)], pz_Move[OSD_Lang]);
427                this->DrawTextUni(this, 454-313, 428-78, 79, 22, final, &(this->font));
428
429                this->DrawImage(this, 545-313,426-77,arrow_lr, false);
430                str2uni(final, (char *)": ");
431                strcpy16(&final[strlen16(final)], pz_Select[OSD_Lang]);
432                this->DrawTextUni(this,569-313, 428-78, 79, 22, final, &(this->font));
433        }
434
435         //È­¸é¿¡ ³ªÅ¸³ª´Â ¸ÞÀÎÇ׸ñ ±×¸²
436        void CMainMenu_DrawCategory(CWindow *this, int index)
437        {
438                int y_Constant=157;
439                int y_Multiplier=42;
440                int width=163;
441                if(MenuPos[CMainMenu_MenuIdx] == index)
442                        this->setFontStyle(this, 21,0xFFFFFFFF,this->FontGetVerAlign(this),ALIGN_LEFT);
443                else 
444                        this->setFontStyle(this, 21,0xFFC8C8C8,this->FontGetVerAlign(this),ALIGN_LEFT);
445
446                this->DrawTextUni(this, 344-313, (y_Constant-78)+index*y_Multiplier, width, 20, CMainMenu_GetString(index+CMainMenu_g_nTop), &(this->font));
447
448                if(MenuPos[CMainMenu_MenuIdx] == index)
449                {
450                        int i = 0;
451                        this->DrawImage(this, 333-313, (145-76)+index*y_Multiplier, hl_orange_l,true);
452                        for( i=0;i<255;i++)
453                        {
454                                this->DrawImage(this, (333-313)+15+i, (145-76)+index*y_Multiplier, hl_orange_mid, false);
455                        }
456                        this->DrawImage(this, (333-313)+270, (145-76)+index*y_Multiplier, hl_orange_r,true);
457
458                        this->DrawTextUni(this, 344-313, (y_Constant-78)+index*y_Multiplier, width, 20, CMainMenu_GetString(index+CMainMenu_g_nTop), &(this->font));   
459
460                        //Aspect Ratio°¡ Çϳª¹Û¿¡ ¼±ÅøøÇÒ°æ¿ì, ȤÀº ºñµð¿À°¡ Ç÷¹ÀÌ µÇÁö ¾Ê´Â °æ¿ì ´ÙÀ½À» ±×¸®Áö ¾ÊÀ½
461                        if(CMainMenu_Index2MenuLists(MenuSelect[CMainMenu_MenuIdx]) == MN_AV_DISPLAY_MODE)
462                        {
463                                if(CMainMenu_getAspectRatioIndex() == 1 || DST_IsVideoPlay() == false) return;
464                                       
465                        }
466                       
467                        this->DrawImage(this, 601-313,(160-76)+index*y_Multiplier,arrow_right,true);
468                        switch(CMainMenu_Index2MenuLists(MenuSelect[CMainMenu_MenuIdx]))
469                        {
470                                case MN_AUTO_SCAN:
471                                case MN_MANUAL_SCAN:
472                                case MN_SIGNAL_METER:
473                                case MN_FACTORY_RESET:
474                                case MN_STB_INFO:
475                                        break;
476                                default:
477                                        this->DrawImage(this, 514-313,(160-76)+index*y_Multiplier,arrow_left,true);
478                                        break;
479                                               
480                        }
481                       
482                }
483        }
484         //È­¸é¿¡ ³ªÅ¸³ª´Â ¼¼ºÎÇ׸ñ ±×¸²
485        void CMainMenu_DrawItems(CWindow *this, int mainIndex,int subIndex)
486        {
487                int y_Constant=157;
488                int y_Multiplier=42;
489                int width=80;
490                int nFontSize=20;
491                if(MenuPos[CMainMenu_MenuIdx] == mainIndex)
492                        this->setFontStyle(this, 21,0xFFFFFFFF,this->FontGetVerAlign(this),ALIGN_CENTER);
493                else 
494                        this->setFontStyle(this, 21,0xFFF06E03,this->FontGetVerAlign(this),ALIGN_LEFT);
495                DS_U16* strText16 = CMainMenu_GetSubString(mainIndex+CMainMenu_g_nTop,subIndex);
496                int k = 0;
497                for (k = nFontSize; k > 10; k--)
498                {
499                        int nWidth = DST_GetTextWidthUni(strText16, k);
500                        if (nWidth > width) continue;
501                        nFontSize = k;
502                        break;
503                }
504                this->FontSetSize(this, nFontSize); 
505               
506                this->DrawTextUni(this, 522-313, (y_Constant-78)+mainIndex*y_Multiplier,        width, 20, strText16, &(this->font));
507               
508        }
509
510        void CMainMenu_DrawMenu(CWindow *this, int categoryIndex)
511        {
512                this->setFontStyle(this, 21,this->FontGetColor(this),ALIGN_MIDDLE,this->FontGetHorAlign(this));
513               
514                CMainMenu_DrawCategory(this, categoryIndex);
515                CMainMenu_DrawItems(this, categoryIndex,CMainMenu_userSavedValue[categoryIndex+CMainMenu_g_nTop]);
516        }
517
518        void CMainMenu_Draw(CWindow *this)
519        {
520                this->DrawImage(this,0,0, (DS_U8*)back,false);
521               
522                CMainMenu_DrawScrollBar(this, 622-313, 145-77, 42*CMainMenu_mainListNum-1, CMainMenu_mainItemNum, CMainMenu_mainListNum, CMainMenu_g_nTop);
523
524                int i = 0;
525                for(i=0;i<CMainMenu_mainListNum;i++)
526                        CMainMenu_DrawMenu(this, i);
527                CMainMenu_DrawNavigation(this);
528               
529        }
530
531        void CMainMenu_DrawSubMenu(CWindow *this, DS_U8 key)
532        {
533                switch(key)
534                {
535                        case VK_RIGHT:
536                        case VK_OK:
537                                switch(CMainMenu_Index2MenuLists(CMainMenu_mainSelect))
538                                {
539                                        case MN_AUTO_SCAN:
540                                                DST_CreateWin(WIN_AUTO_SEARCH, WIN_MAIN_MENU, 0, 0, 0, 0); 
541                                                this->Close(this);
542                                                break;
543                                        case MN_MANUAL_SCAN:
544                                                DST_CreateWin(WIN_MANUAL_SEARCH, WIN_MAIN_MENU,0 ,0 ,0 ,0);
545                                                this->Close(this);
546                                                break;
547                                        case MN_SIGNAL_METER:
548                                                DST_CreateWin(WIN_SIGNAL_METER, WIN_NULL,0,0,0,0);
549                                                this->Close(this);
550                                                break;
551                                        case MN_FACTORY_RESET:
552                                                DST_CreateWin(WIN_FACTORY_RESET_ASK, WIN_MAIN_MENU, 0, 0, 0, 0);
553                                                this->Close(this);
554                                                break;
555                                        case MN_STB_INFO:
556                                                DST_CreateWin(WIN_STB_INFO, WIN_NULL, 0, 0, 0, 0);
557                                                break;
558                                        default:
559                                                break;
560                                }
561                                break;
562                        default:
563                                break;
564                }
565               
566        }
567
568//      virtual void Show(void)
569        void CMainMenu_Show(CWindow *this)
570        {
571                CMainMenu_Draw(this);
572                this->DoFocus(this, true);
573        }
574
575//      virtual void OnMessage(SWinEventMsg event)
576        void CMainMenu_OnMessage(CWindow *this, SWinEventMsg event)
577        {
578                switch (event.cmd)
579                {
580                         //¸Þ´º°¡ ¶°ÀÖ´Â »óÅ¿¡¼­ ¹æ¼Û È­¸éºñÀ² ¼Ò½º°¡ º¯°æÀÌ µÇ¸é ÇØ´ç»çÇ× ¾÷µ¥ÀÌÆ®
581                        case WM_SOURCE_FORMAT_DONE:
582                                CMainMenu_InitSubValues(); //¸ðµå¿¡ ¸Â°Ô UI°ª º¯°æ
583                                DST_UI_SetAspect( DST_UI_GetAspect());//¹Ù²ï È­¸éºñÀ²·Î ¼¼ÆÃ
584                                CMainMenu_Draw(this);
585                                break;
586                }
587        }       
588//      virtual void KeyInput(DS_U8 key, bool /*bRepeat*/)
589        void CMainMenu_KeyInput(CWindow *this, DS_U8 key, bool bRepeat)
590        {
591                switch (key)
592                {
593                         //¿À¸¥ÂÊ ¿ÞÂÊÀ¸·Î ¹Ù·Î ¼±ÅÃ
594                        case VK_RIGHT:
595                        case VK_LEFT:
596                               
597                                if(key == VK_LEFT)
598                                        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);
599                                else
600                                        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);
601                               
602                                CMainMenu_userSavedValue[MenuSelect[CMainMenu_MenuIdx]] = CMainMenu_select[MenuSelect[CMainMenu_MenuIdx]];
603                                CMainMenu_SetValuse(MenuSelect[CMainMenu_MenuIdx], CMainMenu_select[MenuSelect[CMainMenu_MenuIdx]]);
604                                CMainMenu_InitSubValues();
605                               
606                                CMainMenu_Draw(this);
607                                CMainMenu_DrawSubMenu(this, key);
608                                break;
609
610                        case VK_UP:
611                        case VK_DN:
612                                if(key == VK_DN)
613                                        ItemIncrease(CMainMenu_mainItemNum, CMainMenu_mainListNum, &CMainMenu_g_nTop, &CMainMenu_mainSelect, &CMainMenu_g_nPos, 1);
614                                else
615                                        ItemDecrease(CMainMenu_mainItemNum, CMainMenu_mainListNum, &CMainMenu_g_nTop, &CMainMenu_mainSelect, &CMainMenu_g_nPos, 1);
616                                MenuTop[CMainMenu_MenuIdx] = CMainMenu_g_nTop;
617                                MenuPos[CMainMenu_MenuIdx] = CMainMenu_g_nPos;
618                                MenuSelect[CMainMenu_MenuIdx] = CMainMenu_mainSelect;
619                                CMainMenu_InitSubValues();
620                                CMainMenu_Draw(this);
621                                break;
622                               
623                        case VK_OK:
624                                CMainMenu_DrawSubMenu(this, key);
625                                break;
626                        case VK_CANCEL:
627                        case VK_MENU:
628                        case VK_PREV:
629                        case VK_PREV_CH:
630                        case VK_PREV_MENU:
631                                if(DST_UI_GetMute() && DST_GetWin(WIN_VOLUME_MUTE)==0) DST_CreateWin(WIN_VOLUME_MUTE, 0, 0, 0, 0, 0);
632                                this->Close(this);
633                                if(DST_g_SignalState == SM_AUDIO_ONLY) DST_CreateWin(WIN_CHANNEL_BANNER, WIN_NULL, BANNER_NORMAL ,0, 0, 0);
634                                break;
635
636                        default:
637                                break;
638                }
639        }
640//};
641
642void DST_CreateMainMenu(SWinEventMsg event)
643{
644        CWindow*pWin = NewCWindow(event);
645        pWin->Destructor = CMainMenu_Desnstructor;
646        pWin->OnMessage = CMainMenu_OnMessage; 
647        pWin->KeyInput = CMainMenu_KeyInput;
648        pWin->Focus = CMainMenu_Focus;
649        pWin->ShowWindow = CMainMenu_ShowWindow;
650        pWin->Show = CMainMenu_Show;
651        // »ý¼ºÀÚ È£Ãâ
652        CMainMenu_Constructor(pWin, event);
653        // À©µµ¿ì ¸Þ´ÏÀú¿¡ µî·Ï
654        DST_AddWin((WinID)(event.data[0]), pWin);
655}
656
Note: See TracBrowser for help on using the repository browser.