source: svn/trunk/zasc/app_c/DST_WinFactoryReset.c @ 14

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

1.phkim

  1. revision copy newcon3sk r27
File size: 8.3 KB
Line 
1#include "DST_WinManager.h"
2#include "DST_DataStrings.h"
3#include "DST_OSDImage.h"
4#include "DST_EEPROM.h"
5#include "DST_ChannelTune.h"
6#include "DST_UserInterface.h"
7#include "DST_DB.h"
8
9
10#if 0
11____CMessageWin___()
12#endif
13
14
15//class CFactoryResetWin : public CWindow
16//{
17//private:
18        static DS_U8 CFactoryResetWin_winParentID;
19        static DS_U8 CFactoryResetWin_msg;
20//public:
21//      CFactoryResetWin(SWinEventMsg event):CWindow(event)
22        void CFactoryResetWin_Constructor(CWindow *this, SWinEventMsg event)
23        {
24                this->SetWinName(this,  "FactoryReset");
25                this->rect.w = DST_GetImageWidth(pin_change_back);
26                this->rect.h = DST_GetImageHeight(pin_change_back);
27                this->rect.x = (DST_GetScreenWidth() - this->rect.w) / 2;
28                this->rect.y = (DST_GetScreenHeight()- this->rect.h) / 2;
29                this->RegisterAllKey(this);
30                this->SetTimeOut(this, 0);
31
32                CFactoryResetWin_winParentID = event.data[1];
33                CFactoryResetWin_msg = event.data[2];
34                DST_Printf("winParentID : %d , msg : %d\n",CFactoryResetWin_winParentID,CFactoryResetWin_msg);
35                DST_EEPROM_SetNeedReset(1);
36                DST_DB_Sync();
37
38        }
39       
40        void CFactoryResetWin_Destructor(CWindow *this)
41        {
42                DST_Reset(__func__); // âÀÌ ´ÝÈ÷¸é¼­ ÀçºÎÆÃ
43        }
44       
45//      virtual void OnTimer(char)
46        void CFactoryResetWin_OnTimer(CWindow *this, char nID)
47        {
48                this->Show(this);
49        }
50
51//      virtual void OnMessage(SWinEventMsg event)
52        void CFactoryResetWin_OnMessage(CWindow *this, SWinEventMsg event)
53        {
54                switch (event.cmd)
55                {
56                        case WM_POWER_OFF:
57                                this->Close(this);
58                                break;
59                        default: break;
60                }
61        }
62       
63//      virtual void Show(void)
64        void CFactoryResetWin_Show(CWindow *this)
65        {
66                this->DrawImage(this, 0, 0, pin_change_back, false);
67                this->setFontStyle(this, 22,0xFFFFFFFF,ALIGN_MIDDLE,ALIGN_CENTER);
68
69                if (DST_DB_IsSync())
70                {
71                        this->KillTimer(this, 1);
72                        this->SetTimeOut(this, 1); // ½ÌÅ©°¡ ³¡³ª¸é ŸÀӾƿôÀ» 1ÃÊ·Î º¯°æ
73                        this->DrawTextUni(this, 0, 0, this->rect.w, this->rect.h, pz_sysreset[OSD_Lang], &(this->font));
74                }
75                else
76                {
77                        this->DrawTextUni(this, 0, 0, this->rect.w, this->rect.h, pz_OTC_Download2[OSD_Lang], &(this->font));
78                        this->SetTimer(this, 1, 1000);
79                }
80                this->UpdateScreen(this);
81        }
82//};
83
84
85//class CFactoryResetAskWin : public CWindow
86//{
87//private:
88
89        static DS_U16 CFactoryResetAskWin_g_nPos;
90        static DS_U16 CFactoryResetAskWin_g_nTop;
91        static DS_U16 CFactoryResetAskWin_select;
92        static DS_U16 CFactoryResetAskWin_itemNum;
93        static bool CFactoryResetAskWin_bExitKeyPressed;
94        static bool CFactoryResetAskWin_bVolumeKeyPressed;
95        static DS_U8 CFactoryResetAskWin_winParentID;
96        static DS_U8 CFactoryResetAskWin_msg;
97//public:
98void CFactoryResetAskWin_setSize(CWindow *this);
99
100//      CFactoryResetAskWin(SWinEventMsg event):CWindow(event)
101        void CFactoryResetAskWin_Constructor(CWindow *this, SWinEventMsg event)
102        {
103                this->SetWinName(this,  "FacResetAsk");
104                CFactoryResetAskWin_setSize(this);
105                CFactoryResetAskWin_bExitKeyPressed = false;
106                CFactoryResetAskWin_bVolumeKeyPressed = false;
107                CFactoryResetAskWin_g_nTop = 0;
108                CFactoryResetAskWin_g_nPos = 0;
109                CFactoryResetAskWin_select = 1;
110                CFactoryResetAskWin_itemNum = 2;
111
112                CFactoryResetAskWin_winParentID = event.data[1];
113                CFactoryResetAskWin_msg = event.data[2];
114                this->SetTimeOut(this, 100);
115        }
116
117        void CFactoryResetAskWin_Destructor(CWindow *this)
118        {
119       
120        }
121       
122        void CFactoryResetAskWin_setSize(CWindow *this)
123        {
124                this->rect.w = DST_GetImageWidth(pin_change_back);
125                this->rect.h = DST_GetImageHeight(pin_change_back);
126                this->rect.x = (DST_GetScreenWidth() - this->rect.w)/2;
127                this->rect.y = (DST_GetScreenHeight() - this->rect.h)/2;
128        }
129
130//      virtual void Focus(bool bVal)
131        void CFactoryResetAskWin_Focus(CWindow *this, bool bVal)
132        {
133                this->RegisterKey(this, VK_CANCEL, bVal, 0, 0);
134                this->RegisterKey(this, VK_MENU, bVal, 0, 0);
135                this->RegisterKey(this, VK_OK, bVal, 0, 0);
136                this->RegisterKey(this, VK_RIGHT, bVal, 0, 0);
137                this->RegisterKey(this, VK_LEFT, bVal, 0, 0);
138                this->RegisterKey(this, VK_UP, bVal, 0, 0);
139                this->RegisterKey(this, VK_DN, bVal, 0, 0);
140                this->RegisterKey(this, VK_PREV, bVal, 0, 0);
141                this->RegisterKey(this, VK_PREV_CH, bVal, 0, 0);
142                this->RegisterKey(this, VK_PREV_MENU, true, 0, 0);
143        }
144
145//      virtual void Show(WinID id)
146        void CFactoryResetAskWin_ShowWindow(CWindow *this, WinID id)
147        {
148                switch(id)
149                {
150                        case WIN_DEBUG_SQL:
151                        case WIN_DEBUG_SQL_SUB:
152                        case WIN_ENGINEER_MODE:
153                        case WIN_FREQUENCY_SETTING:             
154                        case WIN_VOLUME:
155                        case WIN_VOLUME_MUTE:
156                                CFactoryResetAskWin_bVolumeKeyPressed = true;
157                                this->Close(this);
158                                break;
159                        default:
160                                break;
161                }
162        }
163
164        DS_U16* CFactoryResetAskWin_GetString(int index)
165        {
166                switch(index)
167                {
168                        case 0: return pz_ZAS_Confirm[OSD_Lang];
169                        case 1: return pz_ZAS_Cancel[OSD_Lang];
170                        default: break;
171                }
172                return 0;
173        }
174       
175        void CFactoryResetAskWin_Draw(CWindow *this)
176        {
177                int center_pos =  0;
178                int line_spacing = 0;
179                int i = 0;
180               
181                this->DrawImage(this, 0,0,pin_change_back,true);
182                this->setFontStyle(this, 22,0xFFFFFFFF,ALIGN_MIDDLE,ALIGN_CENTER);
183               
184                center_pos =  DST_GetImageHeight(pin_change_back) / 2; 
185                line_spacing = DST_GetFontHeight(this->FontGetSize(this)) * 125 / 100;
186
187                this->DrawTextUni(this, 0,      center_pos-line_spacing/2-line_spacing-line_spacing/2, this->rect.w, line_spacing, pz_Sub_FactoryResetAsk_E1[OSD_Lang],  &(this->font));
188                this->DrawTextUni(this, 0,      center_pos-line_spacing/2-line_spacing/2, this->rect.w, line_spacing, pz_Sub_FactoryResetAsk_E2[OSD_Lang],  &(this->font));
189               
190                this->DrawImage(this, 65, 151, Button_d, true);
191                this->DrawImage(this, 207, 151, Button_d, true);
192                if(CFactoryResetAskWin_select == 0)
193                        this->DrawImage(this, 65, 151, Button_h, true);
194                else
195                        this->DrawImage(this, 207, 151, Button_h, true);
196               
197                for( i=0;i<CFactoryResetAskWin_itemNum;i++)
198                {
199                        if(CFactoryResetAskWin_select==i)
200                                this->setFontStyle(this,20,0xFFFFFFFF,ALIGN_MIDDLE,ALIGN_CENTER);
201                        else
202                                this->setFontStyle(this,20,0xFF494949,ALIGN_MIDDLE,ALIGN_CENTER);
203                        this->DrawTextUni(this, 65+i*142, 151, DST_GetImageWidth(Button_d),  DST_GetImageHeight(Button_d), CFactoryResetAskWin_GetString(i),    &(this->font));
204                }
205        }
206
207//      virtual void Show(void)
208        void CFactoryResetAskWin_Show(CWindow *this)
209        {
210                CFactoryResetAskWin_Draw(this);
211                this->DoFocus(this, true);
212        }
213
214//      virtual void OnMessage(SWinEventMsg event)
215        void CFactoryResetAskWin_OnMessage(CWindow *this, SWinEventMsg event)
216        {
217                switch (event.cmd)
218                {
219                        case WM_POWER_OFF:
220                                this->Close(this);
221                                break;
222                        default: break;
223                }
224        }
225       
226
227//      virtual void KeyInput(DS_U8 key, bool /*bRepeat*/)
228        void CFactoryResetAskWin_KeyInput(CWindow *this, DS_U8 key, bool bRepeat)
229        {
230                switch (key)
231                {
232                        case VK_RIGHT:
233                        case VK_LEFT:
234                                if(key == VK_RIGHT)
235                                        ItemIncrease(CFactoryResetAskWin_itemNum, 2, &CFactoryResetAskWin_g_nTop, &CFactoryResetAskWin_select, &CFactoryResetAskWin_g_nPos, 1);
236                                else
237                                        ItemDecrease(CFactoryResetAskWin_itemNum, 2, &CFactoryResetAskWin_g_nTop, &CFactoryResetAskWin_select, &CFactoryResetAskWin_g_nPos, 1);
238                                CFactoryResetAskWin_Draw(this);
239                                break;
240                        case VK_OK:
241                                if(CFactoryResetAskWin_select == 0)
242                                {
243//                                      DST_RemoveAllWindowExceptBasicWin();
244                                        DST_CreateWin(WIN_FACTORY_RESET, (WinID)CFactoryResetAskWin_winParentID, CFactoryResetAskWin_msg, 0, 0, 0);
245                                }
246                                else
247                                {
248                                        DST_CreateWin((WinID)CFactoryResetAskWin_winParentID, 0, 0, 0, 0, 0);
249                                }
250                                this->Close(this);
251                                break;
252                        case VK_MENU:
253                        case VK_CANCEL:
254                        case VK_PREV_MENU:
255                                this->Close(this);
256                                break;
257                        case VK_PREV:
258                        case VK_PREV_CH:
259                                DST_CreateWin((WinID)CFactoryResetAskWin_winParentID, 0, 0, 0, 0, 0);
260                                this->Close(this);
261                                break;
262                        default:
263                                break;
264                }
265        }
266
267//};
268
269void DST_CreateFactoryResetWin(SWinEventMsg event)
270{
271        CWindow*pWin = NewCWindow(event);
272        pWin->Destructor        = CFactoryResetWin_Destructor;
273        pWin->OnTimer           = CFactoryResetWin_OnTimer;
274        pWin->OnMessage         = CFactoryResetWin_OnMessage;
275        pWin->Show                      = CFactoryResetWin_Show;
276        // »ý¼ºÀÚ È£Ãâ
277        CFactoryResetWin_Constructor(pWin, event);
278        // À©µµ¿ì ¸Þ´ÏÀú¿¡ µî·Ï
279        DST_AddWin((WinID)(event.data[0]), pWin);
280}
281
282void DST_CreateFactoryResetAskWin(SWinEventMsg event)
283{
284        CWindow*pWin = NewCWindow(event);
285        pWin->Destructor        = CFactoryResetAskWin_Destructor;
286        pWin->KeyInput          = CFactoryResetAskWin_KeyInput;
287        pWin->OnMessage         = CFactoryResetAskWin_OnMessage;
288        pWin->ShowWindow        = CFactoryResetAskWin_ShowWindow;
289        pWin->Show                      = CFactoryResetAskWin_Show;
290        pWin->Focus             = CFactoryResetAskWin_Focus;
291        // »ý¼ºÀÚ È£Ãâ
292        CFactoryResetAskWin_Constructor(pWin, event);
293        // À©µµ¿ì ¸Þ´ÏÀú¿¡ µî·Ï
294        DST_AddWin((WinID)(event.data[0]), pWin);
295}
Note: See TracBrowser for help on using the repository browser.