source: svn/trunk/zasc/app/DST_WinMainMenu.cpp @ 2

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

1.phkim

  1. revision copy newcon3sk r27
  • Property svn:executable set to *
File size: 36.2 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
12#define ICON_DEFAULT 0
13#define ICON_CURSOR 1
14#define ICON_SELECT 2
15
16char* DST_GetAppShortVersion();
17
18struct MAIN_MENU
19{
20        MainMenuLists menu;
21        bool bEnable;
22};
23
24struct CH_SUB_MENU
25{
26        ChannelSubMenuLists menu;
27        bool bEnable;
28};
29
30struct SETUP_SUB_MENU
31{
32        SetupSubMenuLists menu;
33        bool bEnable;
34};
35
36struct PROGRAM_SUB_MENU
37{
38        ProgramSubMenuLists menu;
39        bool bEnable;
40};
41
42struct FUNCTION_SUB_MENU
43{
44        FunctionSubMenuLists menu;
45        bool bEnable;
46};
47
48
49static MAIN_MENU tv_menu[] = {
50        {       MN_CHANNEL,     true    },
51        {       MN_SETUP, true  },
52        {       MN_PROGRAM, true        },
53        {       MN_FUNCTION,    true    },
54        { MN_MAX_NUM, false}
55};
56
57static CH_SUB_MENU ch_sub_menu[] = {
58        {       CH_SUB_INPUT,   false   },
59        {       CH_SUB_AUTO_SCAN,       true    },
60        {       CH_SUB_MANUAL_SCAN,     true    },
61        {       CH_SUB_CHANNEL_EDIT, true       },
62        {       CH_SUB_SIGNAL_METER,    true    },
63        { CH_SUB_MAX_NUM, false}
64};
65
66static SETUP_SUB_MENU setup_sub_menu[] = {
67        {       SETUP_SUB_AV_DISPLAY_MODE,      true    },
68        {       SETUP_SUB_AV_AUDIO_PREF, true   },
69        {       SETUP_SUB_AV_VI,        true    },
70        {       SETUP_SUB_CC_DISPLAY,   true    },
71        { SETUP_SUB_MAX_NUM, false}
72};
73
74static PROGRAM_SUB_MENU program_sub_menu[] = {
75        {       PROGRAM_INFORMATION,    false   },
76        { PROGRAM_SUB_MAX_NUM, false}
77};
78
79static FUNCTION_SUB_MENU function_sub_menu[] = {
80        {       FUNCTION_SUB_SLEEP_TIMER,       true    },
81        {       FUNCTION_SUB_AV_PREFERRED_CONN, true    },
82        {       FUNCTION_SUB_FACTORY_RESET,     true    },
83        { FUNCTION_SUB_MAX_NUM, false}
84};
85
86
87class CMainMenu: public CWindow
88{
89private:
90        DS_U16 g_nPos;
91        DS_U16 g_nTop;
92        DS_U16 mainSelect;
93        DS_U16 mainListNum;
94        DS_U16 mainItemNum;
95        DS_U16 userSavedValue;
96        int  MenuIdx;
97public:
98        CMainMenu(SWinEventMsg event):CWindow(event)
99        {
100                InitValues();
101                setSize();
102                DoFocus(true);
103                SetTimeOut(30);
104        }
105        virtual ~CMainMenu()
106        {
107        }
108       
109        void InitValues(void)
110        {
111                DST_g_Focus_menu = 0;
112                MenuIdx = 0;/*DST_UI_GetSource();*/
113                mainItemNum = GetCount();
114                g_nTop = MenuTop[MenuIdx];
115                g_nPos = MenuPos[MenuIdx];
116                mainSelect = MenuSelect[MenuIdx];
117                mainListNum = 4;
118                if (mainItemNum < mainListNum) mainListNum = mainItemNum;
119               
120               
121        }
122
123        int GetCount()
124        {
125                int MenuCount = 0;
126               
127                for (int i = 0; i < 20; i++)
128                {
129                        if (tv_menu[i].menu == MN_MAX_NUM) break;
130                        if (tv_menu[i].bEnable) MenuCount++;
131                }
132                return MenuCount;
133        }
134       
135        MainMenuLists Index2MenuLists(int index)
136        {
137                int nPos = -1;
138                MainMenuLists menu = MN_CHANNEL;
139                if (index < mainItemNum)
140                {
141                        for (int i = 0; i < 20; i++)
142                        {
143                                if (tv_menu[i].bEnable) nPos++;
144                                if (nPos != index) continue;
145                                menu = tv_menu[i].menu;
146                                break;
147                        }
148                }
149                return menu;
150        }
151       
152
153        void setSize(void)
154        {
155                rect.w = DST_GetImageWidth(newcon2_gui_main_back_720x480_1);
156                rect.h = DST_GetImageHeight(newcon2_gui_main_back_720x480_1);
157                rect.x = (DST_GetScreenWidth() - DST_GetImageWidth(newcon2_gui_main_back_720x480))/2;
158                rect.y = (DST_GetScreenHeight() - rect.h)/2;
159        }
160
161        virtual void Focus(bool bVal)
162        {
163                RegisterKey(VK_MENU, bVal);
164                RegisterKey(VK_CANCEL, bVal);
165                RegisterKey(VK_LEFT, bVal);
166                RegisterKey(VK_RIGHT, bVal);
167                RegisterKey(VK_UP, bVal);
168                RegisterKey(VK_DN, bVal);
169                RegisterKey(VK_OK, bVal);
170                RegisterKey(VK_CH_UP, bVal);
171                RegisterKey(VK_CH_DN, bVal);
172                RegisterKey(VK_PREV, bVal);
173                RegisterKey(VK_PREV_MENU, true);
174        }
175       
176        virtual void Show(WinID id)
177        {
178                switch(id)
179                {
180                        case WIN_EWS:
181                        //case WIN_CHANNEL_BANNER:
182                        case WIN_DIRECT_TUNE:
183                        case WIN_VOLUME:
184                        case WIN_VOLUME_MUTE:
185                        case WIN_SIGNAL_METER:
186                        case WIN_CLOSED_CAPTION_HOT:
187                        case WIN_AUDIO_HOT:
188                        case WIN_DISPLAY_MODE_HOT:
189                        case WIN_FACTORY_RESET:
190                        case WIN_FACTORY_RESET_ASK:
191                        case WIN_INFOR_BANNER:
192                        case WIN_POWER_DOWN_CAUTION:
193                        //case WIN_MAIN_MENU:
194                        //case WIN_SUB_MENU_2DEPTH:
195                        //case WIN_SUB_MENU_3DEPTH:
196                        //case WIN_SUB_MENU_4DEPTH:
197                        case WIN_AUTO_SEARCH:
198                        case WIN_MANUAL_SEARCH:
199                        case WIN_CHANNEL_LIST:
200                        case WIN_PROGRAM_GUIDE:
201//                      case WIN_PASSWD_CHANGE:
202//                      case WIN_PASSWD_CHECK:
203//                      case WIN_PASSWD_CONFIRM:
204                        case WIN_AGE_RATING:
205                                Close();
206                                break;
207                        default:
208                                break;
209                }
210        }
211        virtual void Show(void)
212        {
213                SetTimeOut(30);
214                DrawImage(0 , 0, newcon2_gui_main_back_720x480_1);
215                Draw();
216                DrawSubWin(mainSelect, false);
217        }
218
219        void DrawIcons(int menu, int selector)
220        {
221#if DESIGN_TYPE == 1
222                switch(menu)
223                {
224                        case MN_CHANNEL:
225                                DrawImage(19, 16, selector == ICON_DEFAULT ? newcon2_gui_main_ch_default_720x480 : selector == ICON_CURSOR ? newcon2_gui_main_ch_cursor_720x480 : newcon2_gui_main_ch_selected_720x480);
226                                break;
227                        case MN_SETUP:
228                                DrawImage(19, 93, selector == ICON_DEFAULT ? newcon2_gui_main_cc_default_720x480 : selector == ICON_CURSOR ? newcon2_gui_main_cc_cursor_720x480 : newcon2_gui_main_cc_selected_720x480);
229                                break;
230                        case MN_PROGRAM:
231                                DrawImage(19, 170, selector == ICON_DEFAULT ? newcon2_gui_main_lock_default_720x480 : selector == ICON_CURSOR ? newcon2_gui_main_lock_cursor_720x480 : newcon2_gui_main_lock_selected_720x480);
232                                break;
233                        case MN_FUNCTION:
234                                DrawImage(19, 247, selector == ICON_DEFAULT ? newcon2_gui_main_setting_default_720x480 : selector == ICON_CURSOR ? newcon2_gui_main_setting_cursor_720x480 : newcon2_gui_main_setting_selected_720x480);
235                                break;
236                }
237#else
238                switch(menu)
239                {
240                        case MN_CHANNEL:
241                                DrawImage(10, 16, selector == ICON_DEFAULT ? newcon2_gui_main_ch_default_720x480 : selector == ICON_CURSOR ? newcon2_gui_main_ch_cursor_720x480 : newcon2_gui_main_ch_selected_720x480);
242                                break;
243                        case MN_SETUP:
244                                DrawImage(10, 93, selector == ICON_DEFAULT ? newcon2_gui_main_cc_default_720x480 : selector == ICON_CURSOR ? newcon2_gui_main_cc_cursor_720x480 : newcon2_gui_main_cc_selected_720x480);
245                                break;
246                        case MN_PROGRAM:
247                                DrawImage(10, 170, selector == ICON_DEFAULT ? newcon2_gui_main_lock_default_720x480 : selector == ICON_CURSOR ? newcon2_gui_main_lock_cursor_720x480 : newcon2_gui_main_lock_selected_720x480);
248                                break;
249                        case MN_FUNCTION:
250                                DrawImage(10, 247, selector == ICON_DEFAULT ? newcon2_gui_main_setting_default_720x480 : selector == ICON_CURSOR ? newcon2_gui_main_setting_cursor_720x480 : newcon2_gui_main_setting_selected_720x480);
251                                break;
252                }
253#endif
254
255
256        }
257               
258        void Draw(void)
259        {
260                for(int i=0;i<mainListNum;i++)
261                {
262                        DrawIcons(i,ICON_DEFAULT);
263                        if(g_nPos == i)
264                        {
265                                if(bFocus)
266                                        DrawIcons(i+g_nTop,ICON_CURSOR);
267                                else
268                                        DrawIcons(i+g_nTop,ICON_SELECT);
269                        }
270                }
271
272
273                UpdateScreen();
274        }
275
276        virtual void OnMessage(SWinEventMsg event)
277        {
278                switch (event.cmd)
279                {
280                        case WM_POWER_OFF:
281                                Close();
282                                break;
283                               
284                        case WM_MENU_LANGUAGE_CHANGE:
285                                Draw();
286                                break;
287                }
288        }
289
290        void DrawSubWin(int index, bool Execute)
291        {
292                if (Execute == false)
293                {
294                        CWindow *pSubWin = DST_GetWin(WIN_SUB_MENU_2DEPTH);
295                        if (pSubWin) pSubWin->Close();
296                }
297
298                if (Execute == false)
299                {
300                        DST_CreateWin(WIN_SUB_MENU_2DEPTH, GetWinID(), Index2MenuLists(index), true);
301                }
302                else
303                {
304                        DST_g_Focus_menu = 1;
305                        FocusToChild(WIN_SUB_MENU_2DEPTH);
306                        SetTimeOut(0);
307                }
308                       
309        }
310       
311
312        virtual void KeyInput(DS_U8 key, bool /*bRepeat*/)
313        {
314                CWindow *pSubWin = DST_GetWin(WIN_SUB_MENU_2DEPTH);
315
316                switch (key)
317                {
318                        case VK_UP:
319                        case VK_DN:
320                                if(key == VK_DN)
321                                        ItemIncrease(mainItemNum, mainListNum, &g_nTop, &mainSelect, &g_nPos);
322                                else
323                                        ItemDecrease(mainItemNum, mainListNum, &g_nTop, &mainSelect, &g_nPos);
324                                MenuTop[MenuIdx] = g_nTop;
325                                MenuPos[MenuIdx] = g_nPos;
326                                MenuSelect[MenuIdx] = mainSelect;
327
328
329                                Draw();
330                                DrawSubWin(mainSelect, false);
331                                break;
332
333                        case VK_RIGHT:
334                        case VK_OK:
335                                        DoFocus(false);
336                                        T();
337                                        if(Index2MenuLists(mainSelect)== MN_PROGRAM)
338                                        {
339                                                T();
340                                                DST_CreateWin(WIN_PROGRAM_GUIDE,WIN_MAIN_MENU); 
341                                                Close();
342                                                break;
343                                        }       
344
345                                        DrawSubWin(mainSelect, true);
346                                        Draw();
347                                        if(pSubWin) pSubWin->Show();
348                                break;
349                        default:
350//                              if(pSubWin) pSubWin->Close();
351                                Close();
352                                break;
353                }
354        }
355
356       
357};
358
359void DST_CreateMainMenu(SWinEventMsg event)
360{
361  DST_AddWin((WinID)(event.data[0]), new CMainMenu(event));
362}
363
364class CMenu2Depth: public CWindow
365{
366private:
367        DS_U16 g_nPos;
368        DS_U16 g_nTop;
369        DS_U16 mainSelect;
370        DS_U16 mainListNum;
371        DS_U16 mainItemNum;
372
373        DS_U16 userSavedValue;
374
375        int  MenuIdx;
376        int MainMenuIndex;
377
378public:
379        CMenu2Depth(SWinEventMsg event):CWindow(event)
380        {
381                MainMenuIndex = event.data[2];
382                InitValues();
383                setSize();
384                SetTimeOut(30);
385
386        }
387        virtual ~CMenu2Depth()
388        {
389        }
390       
391        void InitValues(void)
392        {
393                MenuIdx = 0;/*DST_UI_GetSource();*/
394                mainItemNum = GetCount();
395                g_nTop = 0;
396                g_nPos = 0;
397                mainSelect = 0;
398                mainListNum = 5;
399                if (mainItemNum < mainListNum) mainListNum = mainItemNum;
400               
401               
402        }
403
404        int GetCount()
405        {
406                int MenuCount = 0;
407                switch(MainMenuIndex)
408                {
409                        case MN_CHANNEL:
410                                for (int i = 0; i < 20; i++)
411                                {
412                                        if (ch_sub_menu[i].menu == CH_SUB_MAX_NUM) break;
413                                        if (ch_sub_menu[i].bEnable) MenuCount++;
414                                }
415                                break;
416                        case MN_SETUP:
417                                for (int i = 0; i < 20; i++)
418                                {
419                                        if (setup_sub_menu[i].menu == SETUP_SUB_MAX_NUM) break;
420                                        if (setup_sub_menu[i].bEnable) MenuCount++;
421                                }
422                                break;
423                        case MN_PROGRAM:
424                                for (int i = 0; i < 20; i++)
425                                {
426                                        if (program_sub_menu[i].menu == PROGRAM_SUB_MAX_NUM) break;
427                                        if (program_sub_menu[i].bEnable) MenuCount++;
428                                }
429                                break;
430                        case MN_FUNCTION:
431                                for (int i = 0; i < 20; i++)
432                                {
433                                        if (function_sub_menu[i].menu == FUNCTION_SUB_MAX_NUM) break;
434                                        if (function_sub_menu[i].bEnable) MenuCount++;
435                                }
436                                break;
437                }
438
439                return MenuCount;
440        }
441       
442        int Index2MenuLists(int index)
443        {
444                int nPos = -1;
445                int menu = 0;
446                if (index < mainItemNum)
447                {
448                        switch(MainMenuIndex)
449                        {
450                                case MN_CHANNEL:
451//                                      T();
452                                        for (int i = 0; i < 20; i++)
453                                        {
454                                                if (ch_sub_menu[i].bEnable) nPos++;
455                                                if (nPos != index) continue;
456                                                menu = ch_sub_menu[i].menu;
457                                                break;
458                                        }
459                                        break;
460                                case MN_SETUP:
461                                        for (int i = 0; i < 20; i++)
462                                        {
463                                                if (setup_sub_menu[i].bEnable) nPos++;
464                                                if (nPos != index) continue;
465                                                menu = setup_sub_menu[i].menu;
466                                                break;
467                                        }
468                                        break;
469                                case MN_PROGRAM:
470                                        for (int i = 0; i < 20; i++)
471                                        {
472                                                if (program_sub_menu[i].bEnable) nPos++;
473                                                if (nPos != index) continue;
474                                                menu = program_sub_menu[i].menu;
475                                                break;
476                                        }
477                                        break;
478                                case MN_FUNCTION:
479                                        for (int i = 0; i < 20; i++)
480                                        {
481                                                if (function_sub_menu[i].bEnable) nPos++;
482                                                if (nPos != index) continue;
483                                                menu = function_sub_menu[i].menu;
484                                                break;
485                                        }
486                                        break;
487                        }
488                }
489                return menu;
490        }
491
492        DS_U16* GetParentString(int nPos)
493        {
494                switch (nPos)
495                {
496                        case MN_CHANNEL: return pz_Menu_Channel[OSD_Lang]; break;
497                        case MN_SETUP: return pz_Menu_Setup[OSD_Lang]; break;
498                        case MN_PROGRAM: return pz_Menu_Program[OSD_Lang]; break;
499                        case MN_FUNCTION: return pz_Menu_Function[OSD_Lang]; break;
500                        default: break;
501                }
502                return 0;
503        }       
504        bool HasMoreDepth(int menu)
505        {
506                bool ret = false;
507                switch(MainMenuIndex)
508                {
509                        case MN_CHANNEL:
510                               
511//                              T();
512//                              DST_Printf("menu=%d Index2MenuLists(menu)=%d\n\n",menu,Index2MenuLists(menu));
513                                switch(Index2MenuLists(menu))
514                                {
515                                        case CH_SUB_AUTO_SCAN: ret = false; break;
516                                        case CH_SUB_MANUAL_SCAN: ret = false; break;
517                                        case CH_SUB_CHANNEL_EDIT: ret = false; break;
518                                        case CH_SUB_SIGNAL_METER: ret = false; break;
519                                }
520                                break;
521                        case MN_SETUP:
522                                switch(Index2MenuLists(menu))
523                                {
524                                        case SETUP_SUB_AV_DISPLAY_MODE: ret = true; break;
525                                        case SETUP_SUB_AV_AUDIO_PREF: ret = true; break;
526                                        case SETUP_SUB_AV_VI: ret = true; break;
527                                        case SETUP_SUB_CC_DISPLAY: ret = true; break;
528                                }
529                                break;
530                        case MN_PROGRAM:
531                                switch(Index2MenuLists(menu))
532                                {
533                                        case PROGRAM_INFORMATION: ret = false; break;
534                                }
535                                break;
536                        case MN_FUNCTION:
537                                switch(Index2MenuLists(menu))
538                                {
539                                        case FUNCTION_SUB_SLEEP_TIMER: ret = true; break;
540                                        case FUNCTION_SUB_AV_PREFERRED_CONN: ret = true; break;
541                                        case FUNCTION_SUB_FACTORY_RESET: ret = false; break;
542                                }
543                                break;
544
545                        default: break;
546
547                }
548                return ret;
549        }
550       
551        DS_U16* GetString(int menu)
552        {
553                switch(MainMenuIndex)
554                {
555                        case MN_CHANNEL:
556                               
557//                              T();
558//                              DST_Printf("menu=%d Index2MenuLists(menu)=%d\n\n",menu,Index2MenuLists(menu));
559                                switch(Index2MenuLists(menu))
560                                {
561                                        case CH_SUB_AUTO_SCAN: return pz_Sub_AutoScan[OSD_Lang]; break;
562                                        case CH_SUB_MANUAL_SCAN: return pz_ManualSearch[OSD_Lang]; break;
563                                        case CH_SUB_CHANNEL_EDIT: return pz_Sub_ChannelEdit[OSD_Lang]; break;
564                                        case CH_SUB_SIGNAL_METER: return pz_Sub_SignalMeter[OSD_Lang]; break;
565                                }
566                                break;
567                        case MN_SETUP:
568                                switch(Index2MenuLists(menu))
569                                {
570                                        case SETUP_SUB_AV_DISPLAY_MODE: return pz_Sub_DisplayMode[OSD_Lang]; break;
571                                        case SETUP_SUB_AV_AUDIO_PREF: return pz_Sub_AudioPref[OSD_Lang]; break;
572                                        case SETUP_SUB_AV_VI: return pz_Sub_DVS[OSD_Lang]; break;
573                                        case SETUP_SUB_CC_DISPLAY: return pz_Sub_CC[OSD_Lang]; break;
574                                }
575                                break;
576                        case MN_PROGRAM:
577                                switch(Index2MenuLists(menu))
578                                {
579                                }
580                                break;
581                        case MN_FUNCTION:
582                                switch(Index2MenuLists(menu))
583                                {
584                                        case FUNCTION_SUB_SLEEP_TIMER: return pz_Sub_SleepTime[OSD_Lang]; break;
585                                        case FUNCTION_SUB_AV_PREFERRED_CONN: return pz_Sub_PrefConn[OSD_Lang]; break;
586                                        case FUNCTION_SUB_FACTORY_RESET: return pz_Sub_Factory[OSD_Lang]; break;
587                                }
588                                break;
589
590                        default: break;
591
592                }
593                return 0;
594        }
595
596
597        void setSize(void)
598        {
599                rect.w = DST_GetImageWidth(newcon2_gui_main_back_720x480_2);
600                rect.h = DST_GetImageHeight(newcon2_gui_main_back_720x480_2);
601                rect.x = 106+(DST_GetScreenWidth() - DST_GetImageWidth(newcon2_gui_main_back_720x480))/2;
602                rect.y = (DST_GetScreenHeight() - rect.h)/2;
603        }
604
605        virtual void Focus(bool bVal)
606        {
607                RegisterKey(VK_MENU, bVal);
608                RegisterKey(VK_CANCEL, bVal);
609                RegisterKey(VK_LEFT, bVal);
610                RegisterKey(VK_RIGHT, bVal);
611                RegisterKey(VK_UP, bVal);
612                RegisterKey(VK_DN, bVal);
613                RegisterKey(VK_OK, bVal);
614                RegisterKey(VK_CH_UP, bVal);
615                RegisterKey(VK_CH_DN, bVal);
616                RegisterKey(VK_PREV, bVal);
617                RegisterKey(VK_PREV_MENU, true);
618        }
619       
620        virtual void Show(WinID id)
621        {
622                switch(id)
623                {
624                        case WIN_EWS:
625                        //case WIN_CHANNEL_BANNER:
626                        case WIN_DIRECT_TUNE:
627                        case WIN_VOLUME:
628                        case WIN_VOLUME_MUTE:
629                        case WIN_SIGNAL_METER:
630                        case WIN_CLOSED_CAPTION_HOT:
631                        case WIN_AUDIO_HOT:
632                        case WIN_DISPLAY_MODE_HOT:
633                        case WIN_FACTORY_RESET:
634                        case WIN_FACTORY_RESET_ASK:
635                        case WIN_INFOR_BANNER:
636                        case WIN_POWER_DOWN_CAUTION:
637                        //case WIN_MAIN_MENU:
638                        //case WIN_SUB_MENU_2DEPTH:
639                        //case WIN_SUB_MENU_3DEPTH:
640                        //case WIN_SUB_MENU_4DEPTH:
641                        case WIN_AUTO_SEARCH:
642                        case WIN_MANUAL_SEARCH:
643                        case WIN_CHANNEL_LIST:
644                        case WIN_PROGRAM_GUIDE:
645//                      case WIN_PASSWD_CHANGE:
646//                      case WIN_PASSWD_CHECK:
647//                      case WIN_PASSWD_CONFIRM:
648                        case WIN_AGE_RATING:
649                                Close();
650                                break;
651                        default:
652                                break;
653                }
654        }
655        virtual void Show(void)
656        {
657                SetTimeOut(30);
658//              DrawBox(0, 0, rect.w, rect.h, CONV32_16(0x00000000));
659                Draw();
660                DrawSubWin(mainSelect, false);
661        }
662
663        void Draw(void)
664        {
665                DrawImage(0 , 0, newcon2_gui_main_back_720x480_2);
666                setFontStyle(24, 0xFFD8D8D8, ALIGN_MIDDLE, ALIGN_CENTER);
667                DrawTextUni(6, 17, 226, 22, GetParentString(MainMenuIndex), &font);
668
669                if(MainMenuIndex == MN_PROGRAM)
670                {
671                        setFontStyle(24,0xFFC8C8C8,ALIGN_MIDDLE,ALIGN_CENTER);
672                        int center_pos =  DST_GetImageHeight(newcon2_gui_main_back_720x480_2) / 2; 
673                        int line_spacing = DST_GetFontHeight(font.GetSize()) * 125 / 100;
674                        int width = DST_GetImageWidth(newcon2_gui_main_back_720x480_2);
675                        DrawTextUni(0, center_pos-line_spacing/2-line_spacing, width, line_spacing, pz_ProgramGuide_E1[OSD_Lang], &font);
676                        DrawTextUni(0, center_pos-line_spacing/2, width, line_spacing, pz_ProgramGuide_E2[OSD_Lang], &font);
677                        DrawTextUni(0, center_pos+line_spacing/2, width, line_spacing, pz_ProgramGuide_E3[OSD_Lang], &font);
678                        DrawTextUni(0, center_pos+line_spacing/2+line_spacing, width, line_spacing, pz_ProgramGuide_E4[OSD_Lang], &font);               
679                        UpdateScreen();
680                        return;
681                }
682                for(int i=0;i<mainListNum;i++)
683                {
684                        setFontStyle(24,0xFFC8C8C8,ALIGN_MIDDLE,ALIGN_CENTER);
685                        if(DST_g_Focus_menu != 0 && g_nPos == i)
686                        {
687                                if(bFocus)
688                                {
689                                        DrawImage(16 , 72 + i*50, newcon2_gui_depth3_button_cursor,true);
690                                        if(HasMoreDepth(i)) DrawImage(206 , 72 + i*50, newcon2_gui_depth3_button_cursor_arrow_right,true);
691#if DESIGN_TYPE == 1
692#else
693                                        setFontStyle(24,0xFF000000,ALIGN_MIDDLE,ALIGN_CENTER);
694#endif 
695
696                                }
697                                else
698                                {
699                                        DrawImage(16 , 72 + i*50, newcon2_gui_depth3_button_selected,true);
700                                        if(HasMoreDepth(i)) DrawImage(206 , 72 + i*50, newcon2_gui_depth3_button_selected_arrow_right,true);
701                                }
702                        }
703
704                        DrawTextUni(16, 72 + i*50, 205, 38, GetString(g_nTop+i), &font);
705                }
706               
707
708                UpdateScreen();
709        }
710
711        virtual void OnMessage(SWinEventMsg event)
712        {
713                switch (event.cmd)
714                {
715                        case WM_POWER_OFF:
716                                Close();
717                                break;
718                               
719                        case WM_MENU_LANGUAGE_CHANGE:
720                                Draw();
721                                break;
722                }
723        }
724
725        void DrawSubWin(int index, bool Execute)
726        {
727                if (Execute == false)
728                {
729                        CWindow *pSubWin = DST_GetWin(WIN_SUB_MENU_3DEPTH);
730                        if (pSubWin) pSubWin->Close();
731                }
732
733                if (Execute == false)
734                {
735                        DST_CreateWin(WIN_SUB_MENU_3DEPTH, GetWinID(), MainMenuIndex, Index2MenuLists(index));
736                }
737                else
738                {
739                        DST_g_Focus_menu = 2;
740                        FocusToChild(WIN_SUB_MENU_3DEPTH);
741                        SetTimeOut(0);
742                }
743        }
744        void DrawWin(int menu)
745        {
746                switch(MainMenuIndex)
747                {
748                        case MN_CHANNEL:
749                                switch(Index2MenuLists(menu))
750                                {
751                                        case CH_SUB_AUTO_SCAN: 
752                                                DST_CreateWin(WIN_AUTO_SEARCH, WIN_MAIN_MENU); 
753                                                break;
754                                        case CH_SUB_MANUAL_SCAN:
755                                                DST_CreateWin(WIN_MANUAL_SEARCH, WIN_MAIN_MENU);
756                                                break;
757                                        case CH_SUB_CHANNEL_EDIT: 
758                                                DST_CreateWin(WIN_CHANNEL_LIST,WIN_MAIN_MENU); 
759                                                break;
760                                        case CH_SUB_SIGNAL_METER: break;
761                                }
762                                break;
763                        case MN_FUNCTION:
764                                switch(Index2MenuLists(menu))
765                                {
766                                        case FUNCTION_SUB_FACTORY_RESET:
767                                                DST_CreateWin(WIN_FACTORY_RESET_ASK);
768//                                              DST_CreateWin(WIN_PASSWD_CHECK,WIN_MAIN_MENU,MN_FUNCTION,FUNCTION_SUB_FACTORY_RESET);
769                                                break;
770                                }
771                                break;
772
773                        default: break;
774
775                }
776        }       
777       
778
779        virtual void KeyInput(DS_U8 key, bool /*bRepeat*/)
780        {
781                CWindow *pParentWin = DST_GetWin(WIN_MAIN_MENU);
782                CWindow *pSubWin = DST_GetWin(WIN_SUB_MENU_3DEPTH);
783                switch (key)
784                {
785                        case VK_UP:
786                        case VK_DN:
787                                if(key == VK_DN)
788                                {
789                                        ItemIncrease(mainItemNum, mainListNum, &g_nTop, &mainSelect, &g_nPos);
790                                }
791                                else
792                                {
793                                        ItemDecrease(mainItemNum, mainListNum, &g_nTop, &mainSelect, &g_nPos);
794                                }
795                                Draw();
796                                DrawSubWin(mainSelect, false);
797                                break;
798
799                        case VK_RIGHT:
800                        case VK_OK:
801                                if(HasMoreDepth(mainSelect))
802                                {
803                                        DoFocus(false);
804                                        DrawSubWin(mainSelect, true);
805                                        Draw();
806                                        if(pSubWin) pSubWin->Show();
807                                }
808                                else
809                                {
810                                        DrawWin(mainSelect);
811                                        if(MainMenuIndex == MN_CHANNEL && Index2MenuLists(mainSelect) == CH_SUB_SIGNAL_METER) break;
812                                        if(pParentWin) pParentWin->Close();
813                                        Close();
814                                }
815                               
816                                break;
817                        case VK_CANCEL:
818                        case VK_MENU:
819                                if(pParentWin) pParentWin->Close();
820                                break;
821
822                        default:
823                                DST_g_Focus_menu = 0;
824                                FocusToParent();
825                                if(pParentWin) pParentWin ->Show();
826                                else DST_Printf("[Depth3] No Parent Win!!!\n");
827                                Close();
828                                break;
829                }
830        }
831
832       
833};
834
835void DST_CreateMenu2Depth(SWinEventMsg event)
836{
837  DST_AddWin((WinID)(event.data[0]), new CMenu2Depth(event));
838}
839
840class CMenu3Depth: public CWindow
841{
842private:
843        DS_U16 g_nPos;
844        DS_U16 g_nTop;
845        DS_U16 mainSelect;
846        DS_U16 mainListNum;
847        DS_U16 mainItemNum;
848        DS_U16 userSavedValue;
849
850        int  MenuIdx;
851        int MainMenuIndex;
852        int SubMenuIndex;
853
854public:
855        CMenu3Depth(SWinEventMsg event):CWindow(event)
856        {
857                MainMenuIndex = event.data[2];
858                SubMenuIndex = event.data[3];
859                InitValues();
860                setSize();
861                SetTimeOut(30);
862        }
863        virtual ~CMenu3Depth()
864        {
865        }
866       
867        void InitValues(void)
868        {
869                MenuIdx = 0;/*DST_UI_GetSource();*/
870                mainItemNum = GetCount();
871                g_nTop = 0;
872                g_nPos = 0;
873                mainSelect = 0;
874                GetValuse(&mainSelect);
875                userSavedValue = mainSelect;
876               
877                mainListNum = 5;
878                if (mainItemNum < mainListNum) mainListNum = mainItemNum;
879               
880                InitItemValues(mainListNum, mainSelect, &g_nTop, &g_nPos);
881               
882        }
883
884        int GetCount()
885        {
886                int ret = 0;
887                switch(MainMenuIndex)
888                {
889                        case MN_CHANNEL:
890                                switch(SubMenuIndex)
891                                {
892                                        case CH_SUB_AUTO_SCAN: ret = 0; break;
893                                        case CH_SUB_MANUAL_SCAN: ret = 0; break;
894                                        case CH_SUB_CHANNEL_EDIT: ret = 0; break;
895                                        case CH_SUB_SIGNAL_METER: ret = 0; break;
896                                }
897                                break;
898                        case MN_SETUP:
899                                switch(SubMenuIndex)
900                                {
901                                        case SETUP_SUB_AV_DISPLAY_MODE: ret = getAspectRatioIndex(); break;
902                                        case SETUP_SUB_AV_AUDIO_PREF: ret = 2; break;
903                                        case SETUP_SUB_AV_VI: ret = 2; break;
904                                        case SETUP_SUB_CC_DISPLAY: ret = 2; break;
905                                }
906                                break;
907                        case MN_PROGRAM:
908                                switch(SubMenuIndex)
909                                {
910                                }
911                                break;
912                        case MN_FUNCTION:
913                                switch(SubMenuIndex)
914                                {
915                                        case FUNCTION_SUB_SLEEP_TIMER: ret = SLEEP_TIMER_MAX_NUM;  break;
916                                        case FUNCTION_SUB_AV_PREFERRED_CONN: ret = PREFERRED_CONN_MAX_NUM; ; break;
917                                        case FUNCTION_SUB_FACTORY_RESET: ret = 0; break;
918                                }
919                                break;
920
921                        default: break;
922                }
923                return ret;
924        }
925       
926        bool getTR_AspectRatio()
927        {
928                DS_U16 w = 0, h = 0, fps = 0;
929                bool bWide = false, bInterlace = false;
930                DST_GetVideoSize(&w, &h, &fps, &bInterlace, &bWide);
931               
932                return (!bWide);
933        }
934
935        DS_U8 getAspectRatioIndex()
936        {
937                if(getTR_AspectRatio()) return 1;
938                else return 3;
939        }       
940        void GetItemInfo(bool* bRadio, bool* bNeedPopUp)
941        {
942                switch(MainMenuIndex)
943                {
944                        case MN_CHANNEL:
945                                switch(SubMenuIndex)
946                                {
947                                        case CH_SUB_AUTO_SCAN: *bRadio = false; *bNeedPopUp = true; break;
948                                        case CH_SUB_MANUAL_SCAN: *bRadio = false; *bNeedPopUp = true; break;
949                                        case CH_SUB_CHANNEL_EDIT: *bRadio = false; *bNeedPopUp = true; break;
950                                        case CH_SUB_SIGNAL_METER: *bRadio = false; *bNeedPopUp = true; break;
951                                }
952                                break;
953                        case MN_SETUP:
954                                switch(SubMenuIndex)
955                                {
956                                        case SETUP_SUB_AV_DISPLAY_MODE: *bRadio = true; *bNeedPopUp = false; break;
957                                        case SETUP_SUB_AV_AUDIO_PREF: *bRadio = true; *bNeedPopUp = false; break;
958                                        case SETUP_SUB_AV_VI: *bRadio = true; *bNeedPopUp = false; break;
959                                        case SETUP_SUB_CC_DISPLAY: *bRadio = true; *bNeedPopUp = false; break;
960                                }
961                                break;
962                        case MN_PROGRAM:
963                                switch(SubMenuIndex)
964                                {
965                                }
966                                break;
967                        case MN_FUNCTION:
968                                switch(SubMenuIndex)
969                                {
970                                        case FUNCTION_SUB_SLEEP_TIMER: *bRadio = true; *bNeedPopUp = false; break;
971                                        case FUNCTION_SUB_AV_PREFERRED_CONN: *bRadio = true; *bNeedPopUp = false; break;
972                                        case FUNCTION_SUB_FACTORY_RESET: *bRadio = false; *bNeedPopUp = true; break;
973                                }
974                                break;
975
976                        default: break;
977                }
978        }
979
980        void GetValuse(DS_U16 *value)
981        {
982                switch(MainMenuIndex)
983                {
984                        case MN_CHANNEL:
985                                switch(SubMenuIndex)
986                                {
987                                        case CH_SUB_AUTO_SCAN: *value = 0; break;
988                                        case CH_SUB_MANUAL_SCAN: *value = 0; break;
989                                        case CH_SUB_CHANNEL_EDIT: *value = 0; break;
990                                        case CH_SUB_SIGNAL_METER: *value = 0; break;
991                                }
992                                break;
993                        case MN_SETUP:
994                                switch(SubMenuIndex)
995                                {
996                                        case SETUP_SUB_AV_DISPLAY_MODE: *value =DST_UI_GetAspect(); break;
997                                        case SETUP_SUB_AV_AUDIO_PREF: *value =DST_UI_GetMTS(); break;
998                                        case SETUP_SUB_AV_VI: *value =DST_UI_GetVI(); break;
999                                        case SETUP_SUB_CC_DISPLAY: *value =DST_EEPROM_GetCC(); break;
1000                                }
1001                                break;
1002                        case MN_PROGRAM:
1003                                switch(SubMenuIndex)
1004                                {
1005                                }
1006                                break;
1007                        case MN_FUNCTION:
1008                                switch(SubMenuIndex)
1009                                {
1010                                        case FUNCTION_SUB_SLEEP_TIMER:  *value = DST_GetSleepTimer(); break;
1011                                        case FUNCTION_SUB_AV_PREFERRED_CONN: *value =DST_UI_GetCh34(); break;
1012                                        case FUNCTION_SUB_FACTORY_RESET: *value = 0; break;
1013                                }
1014                                break;
1015
1016                        default: break;
1017                }
1018        }
1019
1020        void SetValuse(DS_U16 value)
1021        {
1022                switch(MainMenuIndex)
1023                {
1024                        case MN_CHANNEL:
1025                                switch(SubMenuIndex)
1026                                {
1027                                        case CH_SUB_AUTO_SCAN: break;
1028                                        case CH_SUB_MANUAL_SCAN: break;
1029                                        case CH_SUB_CHANNEL_EDIT: break;
1030                                        case CH_SUB_SIGNAL_METER: break;
1031                                }
1032                                break;
1033                        case MN_SETUP:
1034                                switch(SubMenuIndex)
1035                                {
1036                                        case SETUP_SUB_AV_DISPLAY_MODE: DST_UI_SetAspect(value); break;
1037                                        case SETUP_SUB_AV_AUDIO_PREF: DST_UI_SetMTS(value);  break;
1038                                        case SETUP_SUB_AV_VI: DST_UI_SetVI(value); break;
1039                                        case SETUP_SUB_CC_DISPLAY: DST_UI_SetCloseCaption(value); break;
1040                                }
1041                                break;
1042                        case MN_PROGRAM:
1043                                switch(SubMenuIndex)
1044                                {
1045                                }
1046                                break;
1047                        case MN_FUNCTION:
1048                                switch(SubMenuIndex)
1049                                {
1050                                        case FUNCTION_SUB_SLEEP_TIMER: 
1051                                                if(0 < value && value < 5 )DST_g_sleepTimercheckTime = DST_OS_GetTickCount(); 
1052                                                DST_SetSleepTimer(value); 
1053                                                break;
1054                                        case FUNCTION_SUB_AV_PREFERRED_CONN: DST_UI_SetCh34(value); break;
1055                                        case FUNCTION_SUB_FACTORY_RESET: break;
1056                                }
1057                                break;
1058
1059                        default: break;
1060
1061                }
1062
1063        }
1064
1065        DS_U16* GetString(int nPos)
1066        {
1067                static DS_U16 strText[32];
1068                // ±âº»°ª..À̰ªÀÌ ¶á´Ù¸é ¹ö±×
1069                for (unsigned i = 0; i < 40; i++)
1070                {
1071                        strText[i] = pz_Unknown[OSD_Lang][i];
1072                        if (strText[i] == 0) break;
1073                }
1074                switch(MainMenuIndex)
1075                {
1076                        case MN_CHANNEL:
1077                                switch(SubMenuIndex)
1078                                {
1079                                        case CH_SUB_AUTO_SCAN:
1080                                        case CH_SUB_MANUAL_SCAN:
1081                                        case CH_SUB_CHANNEL_EDIT: 
1082                                        case CH_SUB_SIGNAL_METER: 
1083                                                return pz_Empty[OSD_Lang];
1084                                                break;
1085                                }
1086                                break;
1087                        case MN_SETUP:
1088                                switch(SubMenuIndex)
1089                                {
1090                                        case SETUP_SUB_AV_DISPLAY_MODE: 
1091                                                switch(nPos)
1092                                                {
1093                                                        case DISPLAY_MODE_WIDE: return pz_Wide[OSD_Lang]; break;
1094                                                        case DISPLAY_MODE_NORMAL: return pz_Normal[OSD_Lang]; break;
1095                                                        case DISPLAY_MODE_ZOOM: return pz_Zoom[OSD_Lang]; break;
1096                                                }
1097                                                break;
1098                                        case SETUP_SUB_AV_AUDIO_PREF: 
1099                                                switch (nPos)
1100                                                {
1101                                                        case  0: return pz_MTS_Main[OSD_Lang];
1102                                                        case  1: return pz_MTS_Sub[OSD_Lang];
1103                                                }
1104                                                break;
1105                                        case SETUP_SUB_AV_VI: 
1106                                                switch (nPos)
1107                                                {
1108                                                        case  0: return pz_VI_Off[OSD_Lang];
1109                                                        case  1: return pz_VI_On[OSD_Lang];
1110
1111                                                }
1112                                                break;
1113                                        case SETUP_SUB_CC_DISPLAY: 
1114                                                switch (nPos)
1115                                                {
1116                                                        case  0: return pz_Off[OSD_Lang]; break;
1117                                                        case  1: return pz_On[OSD_Lang]; break;
1118                                                }
1119                                                break;
1120                                }
1121                                break;
1122                        case MN_PROGRAM:
1123                                switch(SubMenuIndex)
1124                                {
1125                                }
1126                                break;
1127                        case MN_FUNCTION:
1128                                switch(SubMenuIndex)
1129                                {
1130                                        case FUNCTION_SUB_SLEEP_TIMER:
1131                                                switch(nPos)
1132                                                {
1133                                                        case SLEEP_TIMER_OFF: return pz_Off[OSD_Lang]; break;
1134                                                        case SLEEP_TIMER_15M: return pz_Sub_SleepTime_15[OSD_Lang]; break;
1135                                                        case SLEEP_TIMER_30M: return pz_Sub_SleepTime_30[OSD_Lang]; break;
1136                                                        case SLEEP_TIMER_60M: return pz_Sub_SleepTime_60[OSD_Lang]; break;
1137                                                        case SLEEP_TIMER_120M: return pz_Sub_SleepTime_120[OSD_Lang]; break;
1138                                                }
1139                                                break;
1140                                        case FUNCTION_SUB_AV_PREFERRED_CONN: 
1141                                                switch(nPos)
1142                                                {
1143                                                        case PREFERRED_CONN_LINE_OUT: return pz_Sub_LineOut[OSD_Lang]; break;
1144                                                        case PREFERRED_CONN_CH34: return pz_Sub_CH34[OSD_Lang]; break;
1145                                                }
1146                                                break;
1147
1148                                        case FUNCTION_SUB_FACTORY_RESET: return pz_Empty[OSD_Lang]; break;
1149                                }
1150                                break;
1151
1152                        default: break;
1153
1154                }
1155                return 0;
1156        }
1157
1158
1159        void setSize(void)
1160        {
1161                rect.w = DST_GetImageWidth(newcon2_gui_main_back_720x480_3);
1162                rect.h = DST_GetImageHeight(newcon2_gui_main_back_720x480_3);
1163                rect.x = 237+106+(DST_GetScreenWidth() - DST_GetImageWidth(newcon2_gui_main_back_720x480))/2;
1164                rect.y = (DST_GetScreenHeight() - rect.h)/2;
1165        }
1166
1167        virtual void Focus(bool bVal)
1168        {
1169                RegisterKey(VK_MENU, bVal);
1170                RegisterKey(VK_CANCEL, bVal);
1171                RegisterKey(VK_LEFT, bVal);
1172                RegisterKey(VK_RIGHT, bVal);
1173                RegisterKey(VK_UP, bVal);
1174                RegisterKey(VK_DN, bVal);
1175                RegisterKey(VK_OK, bVal);
1176                RegisterKey(VK_CH_UP, bVal);
1177                RegisterKey(VK_CH_DN, bVal);
1178                RegisterKey(VK_PREV, bVal);
1179                RegisterKey(VK_PREV_MENU, true);
1180        }
1181       
1182        virtual void Show(WinID id)
1183        {
1184                switch(id)
1185                {
1186                        case WIN_EWS:
1187                        //case WIN_CHANNEL_BANNER:
1188                        case WIN_DIRECT_TUNE:
1189                        case WIN_VOLUME:
1190                        case WIN_VOLUME_MUTE:
1191                        case WIN_SIGNAL_METER:
1192                        case WIN_CLOSED_CAPTION_HOT:
1193                        case WIN_AUDIO_HOT:
1194                        case WIN_DISPLAY_MODE_HOT:
1195                        case WIN_FACTORY_RESET:
1196                        case WIN_FACTORY_RESET_ASK:
1197                        case WIN_INFOR_BANNER:
1198                        case WIN_POWER_DOWN_CAUTION:
1199                        //case WIN_MAIN_MENU:
1200                        //case WIN_SUB_MENU_2DEPTH:
1201                        //case WIN_SUB_MENU_3DEPTH:
1202                        //case WIN_SUB_MENU_4DEPTH:
1203                        case WIN_AUTO_SEARCH:
1204                        case WIN_MANUAL_SEARCH:
1205                        case WIN_CHANNEL_LIST:
1206                        case WIN_PROGRAM_GUIDE:
1207//                      case WIN_PASSWD_CHANGE:
1208//                      case WIN_PASSWD_CHECK:
1209//                      case WIN_PASSWD_CONFIRM:
1210                        case WIN_AGE_RATING:
1211                                Close();
1212                                break;
1213                        default:
1214                                break;
1215                }
1216        }
1217        virtual void Show(void)
1218        {
1219//              DrawBox(0, 0, rect.w, rect.h, CONV32_16(0x00000000));
1220                Draw();
1221        }
1222
1223        void DrawExplanation()
1224        {
1225                setFontStyle(24, 0xFFC8C8C8, ALIGN_MIDDLE, ALIGN_CENTER);
1226                int center_pos =  DST_GetImageHeight(newcon2_gui_main_back_720x480_3) / 2; 
1227                int line_spacing = DST_GetFontHeight(font.GetSize()) * 125 / 100;
1228                switch(MainMenuIndex)
1229                {
1230                        case MN_CHANNEL:
1231                                switch(SubMenuIndex)
1232                                {
1233                                        case CH_SUB_AUTO_SCAN: 
1234                                                DrawTextUni(8, center_pos-line_spacing/2-line_spacing, 205, line_spacing, pz_Sub_AutoScan_E1[OSD_Lang], &font);
1235                                                DrawTextUni(8, center_pos-line_spacing/2, 205, line_spacing, pz_Sub_AutoScan_E2[OSD_Lang], &font);
1236                                                DrawTextUni(8, center_pos-line_spacing/2+line_spacing, 205, line_spacing, pz_Sub_AutoScan_E3[OSD_Lang], &font);
1237                                                break;
1238                                        case CH_SUB_MANUAL_SCAN:
1239                                                DrawTextUni(8, center_pos-line_spacing/2-line_spacing, 205, line_spacing, pz_ManualSearch[OSD_Lang], &font);
1240                                                DrawTextUni(8, center_pos-line_spacing/2, 205, line_spacing, pz_Sub_AutoScan_E2[OSD_Lang], &font);
1241                                                DrawTextUni(8, center_pos-line_spacing/2+line_spacing, 205, line_spacing, pz_Sub_AutoScan_E3[OSD_Lang], &font);
1242                                                break;
1243                                        case CH_SUB_CHANNEL_EDIT: 
1244                                                DrawTextUni(8, center_pos-line_spacing/2-line_spacing, 205, line_spacing, pz_Sub_ChannelEdit_E1[OSD_Lang], &font);
1245                                                DrawTextUni(8, center_pos-line_spacing/2, 205, line_spacing, pz_Sub_ChannelEdit_E2[OSD_Lang], &font);
1246                                                DrawTextUni(8, center_pos-line_spacing/2+line_spacing, 205, line_spacing, pz_Sub_ChannelEdit_E3[OSD_Lang], &font);
1247                                                break;
1248                                        case CH_SUB_SIGNAL_METER: 
1249                                                DrawTextUni(8, center_pos-line_spacing/2-2*line_spacing, 205, line_spacing, pz_Sub_SignalMeter_E1[OSD_Lang], &font);
1250                                                DrawTextUni(8, center_pos-line_spacing/2-line_spacing, 205, line_spacing, pz_Sub_SignalMeter_E2[OSD_Lang], &font);
1251                                                DrawTextUni(8, center_pos-line_spacing/2, 205, line_spacing, pz_Sub_SignalMeter_E3[OSD_Lang], &font);
1252                                                DrawSignalBar();
1253                                                break;
1254                                }
1255                                break;
1256                        case MN_PROGRAM:
1257                                switch(SubMenuIndex)
1258                                {
1259                                }
1260                                break;
1261                        case MN_FUNCTION:
1262                                switch(SubMenuIndex)
1263                                {
1264                                        case FUNCTION_SUB_FACTORY_RESET: 
1265                                                {
1266                                                       
1267                                                        setFontStyle(20, 0xFFC8C8C8, ALIGN_MIDDLE, ALIGN_CENTER);
1268                                                        char tmpTxt[100] = {0,};
1269                                                        sprintf(tmpTxt, "S/W : %s ",DST_GetAppShortVersion());
1270                                                        DrawText(8, center_pos-3*line_spacing-line_spacing/2, 205, line_spacing, tmpTxt, &font);
1271                                                }
1272                                       
1273                                                setFontStyle(24, 0xFFC8C8C8, ALIGN_MIDDLE, ALIGN_CENTER);
1274                                                DrawTextUni(8, center_pos-2*line_spacing, 205, line_spacing, pz_Sub_FactoryReset_E1[OSD_Lang], &font);
1275                                                DrawTextUni(8, center_pos-line_spacing, 205, line_spacing, pz_Sub_FactoryReset_E2[OSD_Lang], &font);
1276                                                DrawTextUni(8, center_pos, 205, line_spacing, pz_Sub_FactoryReset_E3[OSD_Lang], &font);
1277                                                DrawTextUni(8, center_pos+line_spacing, 205, line_spacing, pz_Sub_FactoryReset_E4[OSD_Lang], &font);
1278                                                break;
1279                                }
1280                                break;
1281
1282                        default: break;
1283
1284                }                       
1285        }
1286       
1287        void DrawSignalBar(void)
1288        {
1289                int xPos        = 20;
1290                int yPos        = 270;
1291                int width   = 166;
1292                int range       = 100;
1293                int signal      = DST_GetSignalStrength();
1294
1295                //background
1296                DrawImage(19 , 269,newcon2_gui_main_signalmeter_back_720x480,true);
1297
1298                //signal text
1299                setFontStyle(24, 0xFFC8C8C8, ALIGN_MIDDLE, ALIGN_CENTER);
1300                char tmp[5]={0};
1301                sprintf(tmp, "%d", signal);
1302                DrawText(8, 231, 205, 38, tmp, &font);
1303
1304                int division =  width/3;
1305                int position = (width*signal)/(range);
1306
1307                //signal meter
1308                for (int i=xPos; i < xPos+position; i++)
1309                {
1310                        if ((i-xPos) <= division)
1311                                DrawImage(i, yPos, newcon2_gui_progress_red);
1312                        else if ((i-xPos) <= (division*2))
1313                                DrawImage(i, yPos, newcon2_gui_progress_yellow);
1314                        else
1315                                DrawImage(i, yPos, newcon2_gui_progress_green);
1316                }
1317               
1318
1319        }
1320       
1321        void Draw(void)
1322        {
1323                T();
1324                DrawImage(0 , 0, newcon2_gui_main_back_720x480_3);
1325                setFontStyle(24, 0xFFC8C8C8, ALIGN_MIDDLE, ALIGN_LEFT);
1326               
1327               
1328                if(DST_g_Focus_menu != 0)
1329                {
1330                       
1331                        bool bRadio, bNeedPopUp = false;
1332                        GetItemInfo(&bRadio, &bNeedPopUp);
1333                        if(bNeedPopUp) 
1334                        {
1335                                DrawExplanation();
1336                                UpdateScreen();
1337                               
1338                                if(MainMenuIndex == MN_CHANNEL && SubMenuIndex == CH_SUB_SIGNAL_METER) SetTimer(1, 500);
1339                                return;
1340                        }
1341
1342                        if(bRadio)
1343                        {
1344                                for(int i=0;i<mainListNum;i++)
1345                                {
1346                                        setFontStyle(24,0xFFC8C8C8,ALIGN_MIDDLE,ALIGN_LEFT);
1347                                        bool cursor = false;
1348                                        if(bFocus && g_nPos == i)
1349                                        {
1350                                                cursor = true;
1351                                                DrawImage(8 , 31+i*51,newcon2_gui_depth3_button_cursor,true);
1352#if DESIGN_TYPE == 1
1353#else
1354                                                setFontStyle(24,0xFF000000,ALIGN_MIDDLE,ALIGN_LEFT);
1355#endif 
1356
1357                                        }
1358                                       
1359                                        if(userSavedValue == i)
1360                                        {
1361                                                if(cursor == false)DrawImage(8 , 31+i*51,newcon2_gui_depth3_button_selected,true);
1362       
1363                                                DrawImage(17 , 39+i*51, newcon2_gui_depth3_button_chech_cursor,true);
1364                                        }
1365
1366                                        DrawTextUni(46, 31+i*51, 167, 38, GetString(g_nTop+i), &font);
1367                                }
1368                        }
1369                        else
1370                        {
1371                                for(int i=0;i<mainListNum;i++)
1372                                {
1373                                        setFontStyle(24,0xFFC8C8C8,ALIGN_MIDDLE,ALIGN_LEFT);
1374                                        if(bFocus && g_nPos == i)
1375                                        {
1376                                                DrawImage(8 , 31+i*51, newcon2_gui_depth3_button_cursor,true);
1377                                                if(bNeedPopUp == false) DrawImage(198 , 31+i*51, newcon2_gui_depth3_button_cursor_arrow_right,true);
1378#if DESIGN_TYPE == 1
1379#else
1380                                                setFontStyle(24,0xFF000000,ALIGN_MIDDLE,ALIGN_LEFT);
1381#endif 
1382
1383                                        }
1384                                        if(userSavedValue == i && DST_g_Focus_menu == 3 )
1385                                        {
1386                                                if(bFocus == false) DrawImage(8 , 31+i*51,newcon2_gui_depth3_button_selected,true);
1387                                        }
1388                                       
1389                                        DrawTextUni(8, 31+i*51, 205, 38, GetString(g_nTop+i), &font);
1390       
1391                                }
1392                        }
1393
1394                }
1395
1396                UpdateScreen();
1397        }
1398       
1399        virtual void OnTimer(char nID)
1400        {
1401                switch(nID)
1402                {
1403                        case 1:
1404                                KillTimer(1);
1405                                Draw();
1406                                break;
1407                        default:
1408                                break;
1409                }
1410        }
1411
1412
1413        virtual void OnMessage(SWinEventMsg event)
1414        {
1415                switch (event.cmd)
1416                {
1417                        case WM_POWER_OFF:
1418                                Close();
1419                                break;
1420                               
1421                        case WM_MENU_LANGUAGE_CHANGE:
1422                                Draw();
1423                                break;
1424                }
1425        }
1426
1427        void DrawSubWin(int index)
1428        {
1429                bool bRadio, bNeedPopUp = false;
1430                GetItemInfo(&bRadio, &bNeedPopUp);
1431                if(bRadio == false && bNeedPopUp == false)
1432                {
1433                        DST_g_Focus_menu = 3;
1434                        DoFocus(false);
1435                        DST_CreateWin(WIN_SUB_MENU_4DEPTH, GetWinID(), MainMenuIndex, SubMenuIndex, index);
1436                }
1437        }
1438       
1439
1440        virtual void KeyInput(DS_U8 key, bool /*bRepeat*/)
1441        {
1442                CWindow *pRootWin = DST_GetWin(WIN_MAIN_MENU);
1443                CWindow *pParentWin = DST_GetWin(WIN_SUB_MENU_2DEPTH);
1444                switch (key)
1445                {
1446                        case VK_UP:
1447                        case VK_DN:
1448                                if(key == VK_DN)
1449                                        ItemIncrease(mainItemNum, mainListNum, &g_nTop, &mainSelect, &g_nPos);
1450                                else
1451                                        ItemDecrease(mainItemNum, mainListNum, &g_nTop, &mainSelect, &g_nPos);
1452                                Draw();
1453                                break;
1454
1455                        case VK_RIGHT:
1456                        case VK_OK:
1457                                //DrawSubWin(mainSelect);
1458                                userSavedValue = mainSelect;
1459                                SetValuse(mainSelect);
1460                                Draw();
1461//                              if(pSubWin) pSubWin->Show();
1462                                break;
1463                        case VK_CANCEL:
1464                        case VK_MENU:
1465                                if(pRootWin) pRootWin->Close();
1466                                break;
1467
1468                        default:
1469                                DST_g_Focus_menu = 1;
1470                                FocusToParent();
1471                                if(pParentWin) pParentWin ->Show();
1472                                else DST_Printf("[Depth3] No Parent Win!!!\n");
1473                                Close();
1474                                break;
1475                }
1476        }
1477
1478       
1479};
1480
1481void DST_CreateMenu3Depth(SWinEventMsg event)
1482{
1483  DST_AddWin((WinID)(event.data[0]), new CMenu3Depth(event));
1484}
1485
1486
1487
1488
1489
Note: See TracBrowser for help on using the repository browser.