📄 emc_epg.c
字号:
break;
}
}
epg_item[i+4] = '\0';
EMC_DrawTSTextRectangle(Handle_ProviewWindow,
DrawPositionX+7, DrawPositionY+6,150,18,
epg_item,JLEFT,TRUE,
textcolor, yellowcolor, yellowcolor);
drawEPGProgramPointer(offset,bHighlight?TRUE:FALSE);
}
static void drawEPGEventItem(U8 offset,EPG_SKED_INFO_STRUCT *pEventInfo,BOOL bHighlight)
{
char eventItem[MAX_EVENT_NAME_LEN+15];
U16 DrawPositionX,DrawPositionY,DrawWidth,DrawHeight;
//STOSD_Color_t drawcolor,textcolor,fillcolor;
ConvertTimeStampToTimeString(pEventInfo->startTime,eventItem);
eventItem[5] = '-';
ConvertTimeStampToTimeString(pEventInfo->startTime+pEventInfo->duration,&eventItem[6]);
eventItem[11] = ' ';
sprintf(&eventItem[12], "%s", pEventInfo->eventName);
if(bHighlight)
{
HL_STOSD_DrawRectangle(Handle_ProviewWindow, EPG_EVENT_ITEM_X-2, EPG_EVENT_ITEM_Y+offset*(EPG_EVENT_ITEM_H+6)-2,EPG_EVENT_ITEM_W+4, EPG_EVENT_ITEM_H+4, whitecolor);
HL_STOSD_DrawRectangle(Handle_ProviewWindow, EPG_EVENT_ITEM_X-1, EPG_EVENT_ITEM_Y+offset*(EPG_EVENT_ITEM_H+6)-1,EPG_EVENT_ITEM_W+2, EPG_EVENT_ITEM_H+2, whitecolor);
}
else
{
HL_STOSD_DrawRectangle(Handle_ProviewWindow, EPG_EVENT_ITEM_X-2, EPG_EVENT_ITEM_Y+offset*(EPG_EVENT_ITEM_H+6)-2,EPG_EVENT_ITEM_W+4, EPG_EVENT_ITEM_H+4, dialogcolor);
HL_STOSD_DrawRectangle(Handle_ProviewWindow, EPG_EVENT_ITEM_X-1, EPG_EVENT_ITEM_Y+offset*(EPG_EVENT_ITEM_H+6)-1,EPG_EVENT_ITEM_W+2, EPG_EVENT_ITEM_H+2, dialogcolor);
}
EMC_DrawTSTextRectangle(Handle_ProviewWindow,
EPG_EVENT_ITEM_X+5, EPG_EVENT_ITEM_Y+5+offset*(EPG_EVENT_ITEM_H+6),342,25,
eventItem,JLEFT,FALSE,
blackcolor, yellowcolor, yellowcolor);
}
static void updateEventDescBox(char *event_desc)
{
U16 DrawPositionX,DrawPositionY,DrawWidth,DrawHeight;
DrawPositionX=EPG_HEADER1_X+241;
DrawPositionY=EPG_HEADER1_Y+329;
DrawWidth=370;
DrawHeight=92;
STOSD_FillRectangle(Handle_ProviewWindow, DrawPositionX, DrawPositionY, DrawWidth+3, DrawHeight,yellowcolor);
EMC_DrawTSTextRectangle(Handle_ProviewWindow,
DrawPositionX,DrawPositionY,DrawWidth,DrawHeight,
event_desc,IGNORE,FALSE,
blackcolor, yellowcolor, yellowcolor);
}
static void showSkedDescription(short int progIndex)
{
SERVICE_EPG_INFO *astEventInfoTable = &SkedEvtInfoDataBlock[progIndex];
char epg_eventdesc[256];
if(iEventItemOff!=-1)
{
memset(epg_eventdesc, 0, sizeof(epg_eventdesc));
memcpy(epg_eventdesc, astEventInfoTable->events[iEventItemOff].description, 255);
epg_eventdesc[255] = '\0';
updateEventDescBox(epg_eventdesc);
}
}
static int drawEPGEventList(short int progIndex,int dateIndex,int hourIndex)
{ /*we use iTopEventItem and iEventItemOff as parameters*/
int i,num;
SERVICE_EPG_INFO *astEventInfoTable = &SkedEvtInfoDataBlock[progIndex];
if(astEventInfoTable->eventsDateIndex[dateIndex].TailEventIndex == -1 ||
astEventInfoTable->eventsDateIndex[dateIndex].HourIndex[hourIndex] == -1)
{
bNeedUpdateSkedInfo = TRUE;
return 0;
}
NEXT:
iTopEventItem = astEventInfoTable->eventsDateIndex[dateIndex].HourIndex[hourIndex];
iEventItemOff = iTopEventItem;
if(hourIndex<7 && astEventInfoTable->eventsDateIndex[dateIndex].HourIndex[hourIndex+1]!=-1)
num = astEventInfoTable->eventsDateIndex[dateIndex].HourIndex[hourIndex+1]-iTopEventItem;
else
num = astEventInfoTable->eventsDateIndex[dateIndex].TailEventIndex-iTopEventItem+1;
num = num>MAX_EVENT_ITEMS_IN_EPG? MAX_EVENT_ITEMS_IN_EPG: num;
if(num<0)
{
bNeedUpdateSkedInfo = TRUE;
return 0;
}
sttbx_Print("\n@@@@@@@num = %d,next = %d,Tail = %d\n",num,astEventInfoTable->eventsDateIndex[dateIndex].HourIndex[hourIndex+1],astEventInfoTable->eventsDateIndex[dateIndex].TailEventIndex);
if(num == 0)
{
hourIndex++;
goto NEXT;
}
/*display current page items*/
for( i= 0; i < num; i++)
{
drawEPGEventItem(i, &(astEventInfoTable->events[iTopEventItem+i]), (i + iTopEventItem) == iEventItemOff ? 1 : 0);
}
iCurrentTimePeriod = hourIndex;
bNeedUpdateSkedInfo = FALSE;
updateEPGCurrTimePeriod(iCurrentTimePeriod);
showSkedDescription(progIndex);
return num;
}
static void drawEPGMenu(void)
{
int i;
PROG_INFO_STRUCT *pstProgInfoTemp;
MENU_DATA_STRUCT *p = NULL;
char currDate[50],currTime[10];
/*draw current date*/
uCurrentDateForShow = ConvertTimeStampToDateString(currentUTCtime/*+timeDateUserOffset*3600*/, currDate);
/*when uCurrentDateForShow equals 3 means it is Wednesday,equals 0,means Sunday*/
sttbx_Print("\nuCurrentDate = %d\n",uCurrentDateForShow);
if(uCurrentDateForShow == 0)
uCurrentDateForShow = 7;
iSelectedDay = uCurrentDateForShow;
/*draw current time*/
ConvertTimeStampToTimeString(currentUTCtime/*+8*3600*/, currTime); /*added by Allen,09-25-2005*/
/*small window*/
SRAVC_PositionVideoWindow(PRIMARY_DECODE,0,EPG_SMALL_SCREEN_X+9*(iPAL_Mode? 0: -1),EPG_SMALL_SCREEN_Y-2+2*(iPAL_Mode? 0: -1),EPG_SMALL_SCREEN_W,EPG_SMALL_SCREEN_H-1);
//sttbx_Print("\n----SmallWindow W=%d,H = %d\n",EPG_SMALL_SCREEN_W,EPG_SMALL_SCREEN_H-2);
/*clear the screen*/
EMC_HideAllRegions();
/*background*/
STOSD_FillRectangle(Handle_ProviewWindow, 0, 0, ProviewWindowParams.Width, ProviewWindowParams.Height,dialogcolor);
/*date and time*/
msm_UpdateEPGCurrTime();
/*header*/
drawEPGHeader();
/*left_panel*/
drawEPGLeftsidePanel();
for(i=0;i<MAX_PROG_ITEMS_IN_EPG;i++)
{
HL_STOSD_DrawBMP(Handle_ProviewWindow,EPG_PROGITEM_X,EPG_PROGITEM_Y+i*(32+3), Bitmap_Struct_EPG_ProgItem);
}
/*smallscreen*/
drawEPGSmallScreen();
/*7 date button*/
for(i=0;i<7;i++)
{
if(i == iSelectedDay-1)
drawEPGMenuDateBtnSelected(i);
else
drawEPGMenuDateBtnUnSelected(i);
}
drawEPGEventListBox();
drawEPGEventDescBox();
setUpdateTips();
/*Tab key defined*/
#if 0
HL_STOSD_DrawBMP(Handle_ProviewWindow,EPG_HEADER1_X+227,EPG_SMALL_SCREEN_BOTTOM_Y+20-Bitmap_Struct_EPG_Arrow.Height,Bitmap_Struct_EPG_Arrow);
EMC_DrawTextRectangle(Handle_ProviewWindow,
EPG_HEADER1_X+227+Bitmap_Struct_EPG_Arrow.Width,EPG_SMALL_SCREEN_BOTTOM_Y+20-15,100,15,
"MOVEMENT",JLEFT,FONT_MYFONT,FALSE,
lightbluecolor,dialogcolor,dialogcolor);
HL_STOSD_DrawBMP(Handle_ProviewWindow,EPG_HEADER1_X+227+397-Bitmap_Struct_EPG_NavBar.Width,EPG_SMALL_SCREEN_BOTTOM_Y+20-Bitmap_Struct_EPG_NavBar.Height,Bitmap_Struct_EPG_NavBar);
EMC_DrawTextRectangle(Handle_ProviewWindow,
EPG_HEADER1_X+227+397-100,EPG_SMALL_SCREEN_BOTTOM_Y+20-Bitmap_Struct_EPG_NavBar.Height-20,100,20,
"NAVIGATION",JLEFT,FONT_MYFONT,FALSE,
lightbluecolor,dialogcolor,dialogcolor);
EMC_DrawTriangle(TRIANGLE_DOWN,EPG_HEADER1_X+227+397-100-20-4,EPG_SMALL_SCREEN_BOTTOM_Y+20-Bitmap_Struct_EPG_NavBar.Height-18,20,lightbluecolor);
#endif
/*show epg region*/
EMC_ShowRegion();
/*fill the program list with data from database*/
if((iChannelItemOff = getChannels(MAX_PROG_ITEMS_IN_EPG)) == INVALID_LINK)
{
sttbx_Print("The Database is empty!!!\n");
return;
}
p=pstAvailableMenuDataHead;
for(i=0;i<iNoOfAvailableMenuElements;i++)
{
if(p==NULL)
break;
drawEPGItem(i,(char *)p->aucData,0);
p =p->Next;
}
/*highlighted the first item*/
if(iNoOfAvailableMenuElements == 0)
return;
drawEPGItem(iChannelItemOff,(char *)pstCurAvailableChannel->aucData,1);
#if 0
if ( ( pstProgInfoTemp = SRDBE_PositionProgInfoByUserProgramNo ( iCurrentProgramNo ) ) == NULL )
{
sttbx_Print("cannot get current program!!!\n");
}
else
{
if(old_EIT_slot != -1) /*Wuhan added, 06-21-2005*/
SRSTF_CancelSectionReq(old_EIT_slot);
SRDBE_GetCurEventInfo();
}
#endif
}
static void updateEPGCurrTimePeriod(int timeIndex)
{
STOSD_Color_t backcolor;
backcolor.Type = STOSD_COLOR_TYPE_PALETTE;
backcolor.Value.PaletteEntry = 84;
if(timeIndex>=0 && timeIndex<8)
EMC_DrawTextRectangle(Handle_ProviewWindow,
EPG_HEADER1_X+245,EPG_HEADER1_Y+281,90,18,
TimePeriod[timeIndex],JLEFT,FONT_MYFONT,FALSE,
whitecolor,backcolor,backcolor);
else
{
iCurrentTimePeriod = -1;
STOSD_FillRectangle(Handle_ProviewWindow,EPG_HEADER1_X+245,EPG_HEADER1_Y+281,90,18, backcolor);
}
}
void setUpdateTips(void)
{
/*current program update tips*/
STOSD_FillRectangle(Handle_ProviewWindow,EPG_SMALL_SCREEN_FRAME_X+42, EPG_SMALL_SCREEN_FRAME_Y+4,158,16+18,dialogcolor);
EMC_DrawTextRectangle(Handle_ProviewWindow,
EPG_SMALL_SCREEN_FRAME_X+42, EPG_SMALL_SCREEN_FRAME_Y+4, 158,16,
"waiting for update...", JLEFT,FONT_MYFONT,FALSE,
lightbluecolor, dialogcolor, dialogcolor);
/*program guide update tips*/
EMC_DrawTextRectangle(Handle_ProviewWindow,
EPG_HEADER1_X+229+120,EPG_HEADER1_Y+41, 165, 22,
"-- waiting for update...", JLEFT,FONT_MYFONT,FALSE,
darkbluecolor,orangecolor, orangecolor);
}
void clearUpdateTips(void)
{
STOSD_FillRectangle(Handle_ProviewWindow,EPG_HEADER1_X+229+120,EPG_HEADER1_Y+41, 165, 22,orangecolor);
}
void clearEventDescBox(void)
{
STOSD_FillRectangle(Handle_ProviewWindow,EPG_HEADER1_X+241,EPG_HEADER1_Y+329,372,91,yellowcolor);
}
void clearEPGEventList(void)
{
int i;
/*clear event list area*/
for( i=0; i<MAX_EVENT_ITEMS_IN_EPG; i++)
{
STOSD_FillRectangle(Handle_ProviewWindow, EPG_EVENT_ITEM_X, EPG_EVENT_ITEM_Y+i*(EPG_EVENT_ITEM_H+6), EPG_EVENT_ITEM_W, EPG_EVENT_ITEM_H, yellowcolor);
}
/*clear highlighted area*/
HL_STOSD_DrawRectangle(Handle_ProviewWindow, EPG_EVENT_ITEM_X-2, EPG_EVENT_ITEM_Y+(iEventItemOff-iTopEventItem)*(EPG_EVENT_ITEM_H+6)-2,EPG_EVENT_ITEM_W+4, EPG_EVENT_ITEM_H+4, dialogcolor);
HL_STOSD_DrawRectangle(Handle_ProviewWindow, EPG_EVENT_ITEM_X-1, EPG_EVENT_ITEM_Y+(iEventItemOff-iTopEventItem)*(EPG_EVENT_ITEM_H+6)-1,EPG_EVENT_ITEM_W+2, EPG_EVENT_ITEM_H+2, dialogcolor);
/*clear eventdesc area*/
clearEventDescBox();
//bRefreshEPGList = TRUE;
}
void msm_UpdateEPGCurrTime(void)
{
/*fix me*/
char currTime[10];
ConvertTimeStampToTimeString(currentUTCtime/*+timeDateUserOffset*3600*/, currTime);
EMC_DrawTextRectangle(Handle_ProviewWindow,
EPG_HEADER1_X+145,EPG_HEADER1_Y+11,67,15,
currTime,JLEFT,FONT_MYFONT,FALSE,
whitecolor,darkbluecolor,darkbluecolor);
}
void msm_UpdateCurrProgInfo(void)
{
int i;
char time[20];
char progName[MAX_SERVICE_NAME_LENGTH+1];
PROG_INFO_STRUCT *pstProgInfoTemp;
int iProgNo;
int sProgIndex = 0;
if ( ( pstProgInfoTemp = SRDBE_CurProgInfo ( &iProgNo ) ) == NULL )
{
sttbx_Print("cannot get current program!!!\n");
return ;
}
sProgIndex = VerifyProgramExistance(pstProgInfoTemp->stProgNo.unShort.sLo16, pstProgInfoTemp->stProgNo.unShort.sHi16);
if(sProgIndex == INVALID_LINK)
{
sttbx_Print("cannot get sProgIndex!!!\n");
return;
}
#if 0
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -