source: svn/newcon3bcm2_21bu/dst/app/src/kview/OSD/App_OSD_Common.c

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

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

  • Property svn:executable set to *
File size: 12.6 KB
Line 
1/****************************************************************************
2* NAME: App_OSD_Common.c
3*----------------------------------------------------------------------------
4* Copyright (c) DIGITAL STREAM Technology Inc.
5*----------------------------------------------------------------------------
6* CREATED_BY: Yong Dae Park
7* CREATION_DATE: 2009/10/16
8* $Author: x2silo $
9* $Revision: 1.0 $
10* $Date: 2009/10/16 19:02:09 $
11*----------------------------------------------------------------------------
12* PURPOSE:
13* -
14*****************************************************************************/
15
16/*_____ I N C L U D E __________________________________________*/
17
18#include "App_Main.h"
19
20#include "App_OSD_Common.h"
21#include "App_Fnc_Time.h"
22
23#include "App_Res_Resources.h"
24
25
26
27
28
29/*_____ D E F I N I T I O N ____________________________________*/
30
31#if COMMENT
32____DbgPrint____(){}
33#endif
34
35DHL_MODULE("@o_com", 0);
36
37
38
39
40
41#if COMMENT
42_____Config_____(){}
43#endif
44
45/* scroll bar */
46#define ARROW_TOP_IMG1 DST_scroll_arrow_up_480
47#define ARROW_TOP_IMG2 DST_scroll_arrow_up_480
48#define ARROW_BTM_IMG1 DST_scroll_arrow_down_480
49#define ARROW_BTM_IMG2 DST_scroll_arrow_down_480
50
51#define BTN_IMG DST_scroll_arrow_bar_480
52
53#define BAR_ARROW_GAP 1
54#define ARROW_HEIGHT 19
55
56#define BTN_R 17
57
58
59
60
61
62#if COMMENT
63_____Types_____(){}
64#endif
65
66static struct {
67        int id;
68        int height;
69        unsigned char *pimg;
70} p_scroll[]= /* ÀÛÀº °ÍºÎÅÍ Å« °Í ¼øÀ¸·Î Á¤·ÄÇÒ °Í */
71{
72        {0, 121 + 3, NULL},
73        {1, 193, NULL},
74        {2, 193, NULL},
75};
76
77
78char tbl_wday[7][4][5] = {  // Eng / Fre / Spa
79        { "Sun", "Dim", "DOM", "ÀÏ",},
80        { "Mon", "Lun", "LUN", "¿ù", },
81        { "Tue", "Mar", "MAR", "È­", },
82        { "Wed", "Mer", "MIE", "¼ö", },          //{ "Wed", "Mi&e9r", "Mer", },
83        { "Thu", "Jeu", "JUE", "¸ñ", },
84        { "Fri", "Ven", "VIE", "±Ý", },
85        { "Sat", "Sam", {'S',0xe1,'b'}, "Åä"}, //{ "Sat", "S&e1b", "Sam", },
86};
87
88char *tbl_month[13][4] = {
89        { "", "", "", "",},           // month 0 is not used.
90        { "Jan", "Jan",   "Ene", "1¿ù",},
91        { "Feb", "F&e9v", "Feb", "2¿ù",},
92        { "Mar", "Mar",   "Mar", "3¿ù",},
93        { "Apr", "Avr",   "Abr", "4¿ù",},
94        { "May", "May",   "May", "5¿ù",},
95        { "Jun", "Jun",   "Jun", "6¿ù",},
96        { "Jul", "Jul",   "Jul", "7¿ù",},
97        { "Aug", "Ao&fb", "Ago", "8¿ù",},
98        { "Sep", "Sep",   "Sep", "9¿ù",},
99        { "Oct", "Oct",   "Oct", "10¿ù",},
100        { "Nov", "Nov",   "Nov", "11¿ù",},
101        { "Dec", "D&e9c", "Dic", "12¿ù",},
102};
103
104char *tbl_month_num[13] = {
105        "", "1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11", "12"};
106
107char *tbl_ampm[2][4] = { /* neverdai Çѱ¹Çâµµ AM, PMÀ¸·Î Ç¥±âÇØµµ ¹«¹æÇÒ µí*/
108        { "AM", "AM", "AM", "¿ÀÀü"},
109        { "PM", "PM", "PM", "¿ÀÈÄ"},           
110};
111
112
113
114
115
116#if COMMENT
117____Variables____(){}
118#endif
119
120
121
122
123
124/*_____ F U N C T I O N ________________________________________*/
125
126#if COMMENT
127__Scroll_Bar__() {}
128#endif
129
130/******************************************************************************************
131FUNCTION:
132  - App_OSD_DrawScroll
133
134Purpose:
135  - Draw Scroll
136******************************************************************************************/
137void App_OSD_DrawScroll(int x, int y, int id, int num_pos, int cur_pos, BOOL bsel)
138{
139        /* scroll height°¡ µé¾î¿À¸é °¡Àå ÀûÀýÇÑ size¸¦ ãÀ½. */
140        int idx;
141        int posy;
142        int i;
143       
144        for(i=0,idx=-1; i<(int)sizeof(p_scroll)/sizeof(p_scroll[0]); i++) {
145                if(id==p_scroll[i].id) {
146                        idx=i;
147                        break;
148                }
149        }
150       
151        if(idx==-1) return;
152       
153        /* ¹è°æ ±×¸®±â */
154        DRAW_IMAGE(x, y, bsel?ARROW_TOP_IMG2:ARROW_TOP_IMG1);
155        DRAW_IMAGE(x, y+ARROW_HEIGHT+BAR_ARROW_GAP, p_scroll[idx].pimg);
156        DRAW_IMAGE(x, y+ARROW_HEIGHT+p_scroll[idx].height+BAR_ARROW_GAP*2, 
157                bsel?ARROW_BTM_IMG2:ARROW_BTM_IMG1);
158                       
159        /* ´ÜÃß ±×¸®±â, 2º¸´Ù Ä¿¾ß scrollÀ» ±×¸®µµ·Ï ÇÑ´Ù. */
160        if(num_pos>1) {
161                //posy=y+BAR_ARROW_GAP+BTN_R+cur_pos*(p_scroll[idx].height-BTN_R*2)/(num_pos-1);
162                posy=y+BAR_ARROW_GAP+ARROW_HEIGHT+cur_pos*(p_scroll[idx].height-BTN_R*2)/(num_pos-1);
163                DRAW_IMAGE(x, posy, BTN_IMG);
164        }
165}
166
167
168
169
170
171#if COMMNET
172__Screen_Backup() {}
173#endif
174
175/******************************************************************************************
176FUNCTION:
177  - App_OSD_BackupScreen
178
179Purpose:
180  - Current OSD Backup
181******************************************************************************************/
182void App_OSD_BackupScreen(int x, int y, int w, int h)
183{
184        tDHL_GrpRect rect;
185       
186        rect.x=x;
187        rect.y=y;
188        rect.w=w;
189        rect.h=h;
190       
191        DMG_BLT(APP_PLANE_WRITE, APP_PLANE_TEMP2, &rect, &rect);
192}
193
194
195/******************************************************************************************
196FUNCTION:
197  - App_OSD_RestoreScreen
198
199Purpose:
200  - Resotre OSD
201******************************************************************************************/
202void App_OSD_RestoreScreen(int x, int y, int w, int h)
203{
204        tDHL_GrpRect rect;
205       
206        rect.x=x;
207        rect.y=y;
208        rect.w=w;
209        rect.h=h;
210       
211        DMG_BLT(APP_PLANE_TEMP2, APP_PLANE_WRITE, &rect, &rect);
212}
213
214
215
216
217
218#if COMMNET
219__Util_Time_String() {}
220#endif
221
222/******************************************************************************************
223FUNCTION:
224  - App_MakeDateTimeString
225
226Purpose:
227  - Time ±¸Á¶Ã¼¸¦ ÀÔ·ÂÀ¸·Î ¹Þ¾Æ¼­ stringÀ¸·Î ¸¸µé¾î ÁÖ´Â ÇÔ¼ö
228  - nMode :
229                0  -> Date+Time       "Sun 10 Jan 12:30 PM"
230                1  -> Date Only1      "Sun 10 Jan"          // info date (old version)
231                2  -> Date Only2      "[Sun] 01/10"         // epg current date, info date
232                3  -> Date Only3      "Jan.10(Sun)"         // epg time ruler(date)
233                4  -> Time Only1(12H) "12:30"               // epg current time
234                5  -> Time Only2(24H) "23:00"
235                6  -> Time Only3(12H) "12:30 PM"            // epg time ruler(time), info time
236                7  -> Time Only4(12H) "12:30PM"             // epg event information start/end time
237                8  -> Hour Only (12H) "09"                  // info time(hour)
238                9  -> Min Only        "30"                  // info time(minutes)
239                10 -> AM/PM Only      "PM"                  // epg current time
240******************************************************************************************/
241void App_MakeDateTimeString(char *buf, APP_TIME_T tm, int nMode)
242{
243        char s_wday[10], s_month[10], s_ampm[10];
244        int user_day, user_hour, user_min;
245       
246#if USE_3LANGUAGE
247        int iLang = ;           // 3 language support
248#else
249        int iLang = 3;  // trinity ÇѱÛÀº 3
250#endif  /* #if USE_3LANGUAGE */
251       
252        STime_t t0, *t = &t0;
253        AppTime_DmwTime2STime(&tm, t);
254       
255#if SUPPORT_NEWBY
256        iLang=App_NVM_GetMenuLang()==0?0:App_NVM_GetMenuLang()==1?2:3;
257#endif
258       
259        /* wday : Mon, Tue,... */
260        if (t->wday >= 0 && t->wday <= 6)
261                strcpy(s_wday, tbl_wday[t->wday][iLang]);
262        else
263                strcpy(s_wday, "---");
264               
265               
266        /* day : 1, 2, 3, ... */
267        user_day = (t->day < 1 || t->day > 31) ? 1 : t->day;
268                        // do not check this day is allowed in each month
269       
270       
271        /* month : Jan, Feb, or 01, 02, */
272        if (t->month >= 1 && t->month <= 12)
273        {
274                if(nMode == 2 || nMode == 0 || nMode == 12)     // trinity, udcp date only : 1, 2, ....
275                        {       strcpy(s_month, tbl_month_num[t->month]);       }
276                else                                            // default value : Jan, Feb, ...
277                        {       strcpy(s_month, tbl_month[t->month][iLang]); }
278        }
279        else
280                strcpy(s_month, "---");
281       
282       
283        /* time */
284        user_hour = 
285                                (t->hour < 0 || t->hour > 23) ? 1 : // this is exception case
286                                t->hour > 12 ? t->hour-12 :                     // afternoon hour
287                                t->hour == 0 ? 12 :                                                                     // hour 0 is not allowed
288                                t->hour;
289        user_min = (t->min < 0 || t->min >= 60) ? 0 : t->min;
290               
291               
292        /* ampm */
293        strcpy(s_ampm, t->hour < 12 ? tbl_ampm[0][iLang] : tbl_ampm[1][iLang]);
294       
295       
296        /* composition */
297        if (nMode == 0)                         // "Sun 10 Jan 12:30 PM"
298                sprintf(buf, "%s/%2d %s %02d:%02d %s", s_month, user_day, s_wday, user_hour, user_min, s_ampm);
299        else if (nMode == 1)    // "Sun 10 Jan"   - info date (old version)
300                sprintf(buf, "%s %d %s", s_wday, user_day, s_month);
301       
302        else if (nMode == 2)    // "[Sun] 01/10"  - epg current date, info date
303                sprintf(buf, "[%s] %s/%d", s_wday, s_month, user_day);
304#if SUPPORT_NEWBY
305        else if (nMode == 3)    // "Jan.10(Sun)"  - epg time ruler(date)
306                /* 110503 sjpark, ¸Þ´º ¾ð¾î°¡ Çѱ¹¾îÀÏ °æ¿ì¿¡ ¾Æ·¡¿Í °°ÀÌ Ç¥ÇöÇϵµ·Ï ¼öÁ¤ */
307                if(iLang == 3) // korean
308                        sprintf(buf, "%s %dÀÏ (%s)", s_month, user_day, s_wday);
309                else
310                        sprintf(buf, "%s %d (%s)", s_month, user_day, s_wday);
311#else
312        else if (nMode == 3)    // "Jan.10(Sun)"  - epg time ruler(date)
313                sprintf(buf, "%s.%d(%s)", s_month, user_day, s_wday);
314#endif
315
316        else if (nMode == 4)    // "12:30"        - epg current time
317                sprintf(buf, "%02d:%02d", user_hour, user_min);
318               
319        else if (nMode == 5)    // "23:00"
320                sprintf(buf, "%02d:%02d", t->hour, user_min);
321       
322        else if (nMode == 6)    // "12:30 PM"                   - epg time ruler(time), info time
323                sprintf(buf, "%d:%02d %s", user_hour, user_min, s_ampm);
324               
325        else if (nMode == 7)    // "12:30PM"                    - epg event information start/end time
326                sprintf(buf, "%02d:%02d%s", user_hour, user_min, s_ampm);
327       
328        else if (nMode == 8)    // "09"                                         - info time(hour)
329                sprintf(buf, "%02d", user_hour);
330               
331        else if (nMode == 9)    // "30"                                         - info time(minutes)
332                sprintf(buf, "%02d", user_min);
333       
334        else if (nMode == 10)   // "PM"                                         - epg current time
335                sprintf(buf, "%s", s_ampm);
336       
337        else if (nMode == 11)   // "¿ÀÀü 12:30"                 - epg event information start/end time
338                sprintf(buf, "%s %d:%02d", s_ampm, user_hour, user_min);
339        else if (nMode == 12) // 1/11 (day)
340                sprintf(buf, "%s/%2d (%s)", s_month, user_day, s_wday);
341        else if (nMode == 13)
342                sprintf(buf, "%s, %2d %s %02d:%02d %s",
343                        s_wday, user_day, s_month, user_hour, user_min, s_ampm);
344        else
345                sprintf(buf, "wrong time format !!");
346}
347
348
349
350
351
352void App_OSD_CommonBox1(int x, int y, int w, int h, int gap, int lineW, UINT32 outBgColor, UINT32 inBgColor, UINT32 lineColor)
353{
354        DMG_EraseRect(x, y, w, h, outBgColor);
355        DMG_EraseRect(x+(gap+lineW), y+(gap+lineW), w-2*(gap+lineW), h-2*(gap+lineW), inBgColor);
356
357        DMG_EraseRect(x+gap, y+gap, w-2*gap, lineW, lineColor);
358        DMG_EraseRect(x+gap, y+gap, lineW, h-2*gap, lineColor);
359        DMG_EraseRect(x+gap+lineW, y+h-gap-lineW, w-2*gap-lineW,
360                                        lineW, lineColor);
361        DMG_EraseRect(x+w-gap-lineW, y+gap+lineW, lineW, h-2*gap-lineW, lineColor);     
362}
363
364void App_OSD_CommonBox2(int x, int y, int w, int h, int lineW, UINT32 bgColor, UINT32 leftLineColor, UINT32 rightLineColor)
365{
366        DMG_EraseRect(x+lineW, y+lineW, w-2*lineW, h-2*lineW, bgColor);
367
368#if 0
369        DMG_EraseRect(x, y, w, lineW, leftLineColor);
370        DMG_EraseRect(x,y,lineW,h, leftLineColor);
371        DMG_EraseRect(x+lineW,y+h-lineW,w-lineW,lineW, rightLineColor);
372        DMG_EraseRect(x+w-lineW,y+lineW,lineW,h-lineW, rightLineColor);
373#else
374        DMG_EraseRect(x, y, w-lineW, lineW, leftLineColor);
375        DMG_EraseRect(x,y,lineW,h-lineW, leftLineColor);
376        DMG_EraseRect(x,y+h-lineW,w,lineW, rightLineColor);
377        DMG_EraseRect(x+w-lineW,y,lineW,h, rightLineColor);
378#endif
379}
380
381void App_OSD_CommonBox3(int x, int y, int w, int h, UINT32 bgColor)
382{
383        DMG_EraseRect(x, y, w, h, bgColor);
384}
385
386void App_OSD_DrawButton(int mode, int x, int y, int w)
387{
388        #define IMG_LT_RT_WIDTH 14
389       
390        //mode 0: normal 1:active, 2:inactive
391        int i;
392        UINT8 *pimg_lt, *pimg_rt, *pimg_mid;
393
394        switch(mode) {
395                case 0:                 // normal
396                        pimg_lt=IMG_UNIT_N_BG_LT;
397                        pimg_rt=IMG_UNIT_N_BG_RT;
398                        pimg_mid=IMG_UNIT_N_BG_MID;
399                        break;
400               
401                case 1:                 // active
402                        pimg_lt=IMG_UNIT_A_BG_LT;
403                        pimg_rt=IMG_UNIT_A_BG_RT;
404                        pimg_mid=IMG_UNIT_A_BG_MID;
405                        break;
406                       
407                case 2:                 // choice, inactive
408                        pimg_lt=IMG_UNIT_I_BG_LT;
409                        pimg_rt=IMG_UNIT_I_BG_RT;
410                        pimg_mid=IMG_UNIT_I_BG_MID;
411                        break;
412               
413                default:                        // default == normal
414                        pimg_lt=IMG_UNIT_N_BG_LT;
415                        pimg_rt=IMG_UNIT_N_BG_RT;
416                        pimg_mid=IMG_UNIT_N_BG_MID;
417        }
418       
419        DMG_DrawImagePng(x, y, pimg_lt);
420        for(i=0; i<w-IMG_LT_RT_WIDTH*2; i++) 
421                DMG_DrawImagePng(x+IMG_LT_RT_WIDTH+i, y, pimg_mid);
422        DMG_DrawImagePng(x+w-IMG_LT_RT_WIDTH, y, pimg_rt);
423}
424
425//mode bit 1 : enable draw only progress bar
426//mode bit 2 : progress bar has 3 colors.
427void App_OSD_DrawProgressBar(int mode, int x, int y,  int partWidth, int percent)
428{
429        int i=0;
430        int total_w=0;
431        UINT32 width =0;
432        UINT8 idx=0;
433        tMenuImage signalbar[] = INFO_BANNER_SIGNALBAR;
434       
435        if(percent<0)
436                percent = 0;
437        else if(percent>100)
438                percent = 100;
439
440        if(partWidth < 10)
441                return;
442
443        //draw sinal power bar background
444        if((mode&0x01) != 0) {
445                total_w = partWidth * 3;
446                DMG_DrawImagePng(x, y, IMG_PROGRESS_LEFT_BG);
447                for(i=0;i<total_w-28;i++)
448                        DMG_DrawImagePng(x+16+i, y, IMG_PROGRESS_MID_BG);
449                DMG_DrawImagePng(x+16+i, y, IMG_PROGRESS_RIGHT_BG);
450        }
451
452        //draw sinal power bar
453        if((mode&0x02) != 0) {
454                width = partWidth * 3 * percent / 100;
455                for(i=0 ; i<width ; i++) {
456                        idx = i / partWidth;
457                        DRAW_IMAGE(x+2+i, y+2, signalbar[idx]);
458                }
459        }
460        else {
461                width = partWidth * 3 * percent / 100;
462                for(i=0 ; i<width ; i++) {
463                        DRAW_IMAGE(x+2+i, y+2, IMG_PROGRESS_YELLO);
464                }
465        }
466}
467
468/* end of file */
Note: See TracBrowser for help on using the repository browser.