📄 mediaplayeroutlook.c
字号:
// replace strSrc from iFrom to iTo using strDest,
// eg: strReplace("disc:\level1\level2\filename.ext", 6, 12, "...")="disc:\...\level2\filename.ext"
char *strReplace(char *strSrc, int iFrom, int iTo, char *strSub)
{
char strTemp1[BUF_MAX], strTemp2[BUF_MAX];
strcpy(strTemp1, strSrc);
strTemp1[iFrom]='\0';
strcpy(strTemp2, strSrc+iTo);
strcat(strTemp1, strSub);
strcat(strTemp1, strTemp2);
return strcpy(strSrc, strTemp1);
}
/********************************************************************/
// Path
void DrawPath(BYTE *strDirName, tHighlightType iHighlight)
{
RECT rectPath={PATH_LEFT, PATH_TOP, PATH_RIGHT, PATH_BOTTOM};
COLORREF clPath;
COLORREF clPathText;
int i, j;
char strTemp[BUF_MAX];
char strnum[10];
if(strncmp(strDirName, "disc", 4)==0)
if( strlen(strDirName)<=6 )
strcpy(strDirName, "");
else
strDirName+=5;
if( (strncmp(strDirName, "SE_", 3)==0) || (strncmp(strDirName, "SE~", 3)==0) )
{
if(strlen(strDirName)<=6)
{
//sprintf(strTemp, "\\SESSION%d", strDirName[3]-'0');
memset(strnum, 0, 10);
I2Str(strDirName[3]-'0', strnum, 0, 0);
strcpy(strTemp, "\\SESSION");
strcat(strTemp, strnum);
}
else
{
//sprintf(strTemp, "\\SESSION%d%s", strDirName[3]-'0', strDirName+5);
memset(strnum, 0, 10);
I2Str(strDirName[3]-'0', strnum, 0, 0);
strcpy(strTemp, "\\SESSION");
strcat(strTemp, strnum);
strcat(strTemp, strDirName+5);
}
strcpy(strDirName, strTemp);
}
if (strlen(strDirName)>MAX_PATHNAME_LEN)
{
for(i=0; (strDirName[i]!='\\') && (strDirName[i+1]!='\0'); i++)
; // first '\' of disc:\level1\level2\...
for(j = i+1; (strDirName[j]!='\\') && (strDirName[j+1]!='\0'); j++)
; // next '\' of disc:\level1\level2\...
while((i+1)+3+strlen(strDirName+j)>MAX_PATHNAME_LEN)
{
j++;
for(; (strDirName[j]!='\\') && (strDirName[j+1]!='\0'); j++)
; // next '\' of disc:\level1\level2\...
}
strReplace(strDirName, i+1, i+1+3, "...");
strcpy(strDirName+i+1+3,strDirName+j);
}
clPath=GetColorInDef256Palette(255);//CL_TRANSPARENT;
clPathText=GetColorInDef256Palette(PATHTEXT_CLR_INDEX);
switch(MPO_Attr.iPlayerType[MPO_Attr.iPlayerSelected])
{
case MPLR_CD:
GUI_CreateButtonControl(gMPOdc, &rectPath, clPath, clPath, clPath, clPathText, "", NORMAL_STRING, DT_LEFT, 0);
break;
case MPLR_MUSIC:
case MPLR_PHOTO:
GUI_CreateButtonControl(gMPOdc, &rectPath, clPath, clPath, clPath, clPathText, strDirName, NORMAL_STRING, DT_LEFT, 0);
break;
}
}
/***************************MPO_HighLevel.c*****************************
*
* Copyright (C) 2003 by ALi Corporation. All Rights Reserved.
*
* File: MPO_HighLevel.c
*
* Contents:
* To draw Media Player's ( DYNAMIC ) Outlook -- Implementation
*
* History:
* Date By Reason Ver.
* ====================================
* 2003/07 Gordon J.H. CHEN Create v2.6
*
***********************************************************************/
/*********************************************************************
*********************************************************************/
//Media Player Outlook Attribute
//private:
BOOL bOutOfMPO=FALSE; // if ture, highlight is not in Media Player Outlook, eg, highlight in Karaoke
BOOL bInited=FALSE; // the following position info is inited
typedef struct
{
int iPlayerFocused; // -1: NO FOCUS
tMediaPlayerObj iFocusObj;
tMediaPlayerObj iPrevFocusObj;
tMediaPlayerObj iPlayingObj; // keep playing position to process feedback, -1: NO PLAYING
//********** list highlight page *********************
//current dir highlight index(0..n), and current page highlight index(-n..n)
int wListHighlightIndex; // 0 .. n -1: NO HIGHLIGHT
int iListHighlightIndex; // -n .. n if not in [0..7], invisible
//current dir playing index(0..n), and current page playing index(-n..n)
//if exit current dir, they will be set to -1
int wListPlayingIndex; // 0 .. n -1: NO PLAYING
int iListPlayingIndex; // -n .. n if not in [0..7], invisible
//********** list playing page *********************, mainly used for showing track no, pathname and used for changing dir back to this one
//current disc playing index(0..n)
// it will be kept across dir (even exit current dir)
int wListPlayingIndex_xDir; //0 .. n -1: NO PLAYING
int wListItemCount_xDir;
int wListFileCount_xDir;
char szPathName_xDir[BUF_MAX];
char szFileName_xDir[BUF_MAX];
WORD iListCurLevelHighlight[C_DIRDEPTH];
WORD iCurLevel;
}
tPositionInfoInner;
tPositionInfoInner gPosInfo;
/*********************************************************************
*********************************************************************/
//Media Player Outlook Operation
//public: shared as interface to MediaPlayerFunc.c
//eg: 1 MPO_GetPositionInfo(&iPositionInfo, &iRefreshParam);
// 2 ... // do what you want to do
// 3 MPO_RefreshOutlook(iRefreshType, &iRefreshParam);
void MPO_GetPositionInfo(tPositionInfo *iPositionInfo);
void MPO_RefreshOutlook(tRefreshType iRefreshType, tRefreshParam *iRefreshParam);
//private:
void RefreshTrackTime(tPositionInfoInner *iPosInfoInner, tRefreshParam *iRefreshParam);
void RefreshTrackNo(tPositionInfoInner *iPosInfoInner, tRefreshParam *iRefreshParam);
void RefreshStatusItem(tPositionInfoInner *iPosInfoInner, tRefreshParam *iRefreshParam);
void RefreshListProgIcon(tPositionInfoInner *iPosInfoInner, tRefreshParam *iRefreshParam);
void RefreshListContent(MPLIST_INFO *diTable, int iListPlayingIndex, tHighlightType iHighlight);
void RefreshListScrolls(tPositionInfoInner *iPosInfoInner, tRefreshParam *iRefreshParam);
void RefreshScrolls(tPositionInfoInner *iPosInfoInner, tRefreshParam *iRefreshParam);
void RefreshPathName(tPositionInfoInner *iPosInfoInner, tRefreshParam *iRefreshParam);
void InitMediaPlayerPosition(tPositionInfoInner *iPosInfoInner);
void DrawMediaPlayer(tPositionInfoInner *iPosInfoInner, tRefreshParam *iRefreshParam);
void DeactivateMediaPlayer(tPositionInfoInner *iPosInfoInner, tRefreshParam *iRefreshParam);
void ActiviteMediaPlayer(tPositionInfoInner *iPosInfoInner, tRefreshParam *iRefreshParam);
void DrawMPOAccordingFeedback(tPositionInfoInner *iPosInfoInner, tRefreshParam *iRefreshParam);
void PlayModeChange(tPositionInfoInner *iPosInfoInner, tRefreshParam *iRefreshParam);
void ChangeDir(tPositionInfoInner *iPosInfoInner, tRefreshParam *iRefreshParam, BOOL bEnterNotExit);
void MoveHighlightUp(tPositionInfoInner *iPosInfoInner, tRefreshParam *iRefreshParam);
void MoveHighlightDown(tPositionInfoInner *iPosInfoInner, tRefreshParam *iRefreshParam);
void RefreshPageUp(tPositionInfoInner *iPosInfoInner, tRefreshParam *iRefreshParam, BOOL bIsToFirst);
void RefreshPageDown(tPositionInfoInner *iPosInfoInner, tRefreshParam *iRefreshParam, BOOL bIsToLast);
void TurnPageUp(tPositionInfoInner *iPosInfoInner, tRefreshParam *iRefreshParam);
void TurnPageDown(tPositionInfoInner *iPosInfoInner, tRefreshParam *iRefreshParam);
void RefreshListPlayingPageInfo(tPositionInfoInner *iPosInfoInner, tRefreshParam *iRefreshParam);
void MoveHighlightOtherOSD(tPositionInfoInner *iPosInfoInner, tRefreshParam *iRefreshParam);
/********************************************************************/
// Get Position Information,
//ATTN: global structure tPositionInfoInner gPosInfo is used!!!
void MPO_GetPositionInfo(tPositionInfo *iPositionInfo)
{
if(gPosInfo.iPlayerFocused==MPO_NOTHING)
iPositionInfo->iPlayerFocused=GetCurrentPlayerType();
else
iPositionInfo->iPlayerFocused=MPO_Attr.iPlayerType[gPosInfo.iPlayerFocused];
iPositionInfo->iFocusObj = gPosInfo.iFocusObj;
iPositionInfo->wListHighlightIndex=gPosInfo.wListHighlightIndex;
iPositionInfo->iListHighlightIndex=gPosInfo.iListHighlightIndex;
iPositionInfo->wListPlayingIndex=gPosInfo.wListPlayingIndex;
iPositionInfo->iListPlayingIndex=gPosInfo.iListPlayingIndex;
iPositionInfo->wListPlayingIndex_xDir=gPosInfo.wListPlayingIndex_xDir;
}
/********************************************************************/
// dwTime to strTime
char* ChangeTime_DWToSTR(DWORD dwPlayTime, char* strTime)
{
DWORD sec, min, hour;
sec = dwPlayTime % 60;
dwPlayTime /= 60;
min = dwPlayTime % 60;
dwPlayTime /= 60;
hour = dwPlayTime;
I2Str(hour,strTime,0,1);
strTime[1] = ':';
I2Str( min, strTime, 2, 2 );
strTime[ 4 ] = ':';
I2Str( sec, strTime, 5, 2 );
strTime[7]='\0';
return strTime;
}
/********************************************************************/
// Refresh Track Time
void RefreshTrackTime(tPositionInfoInner *iPosInfoInner, tRefreshParam *iRefreshParam)
{
char strTemp[BUF_MAX];
ChangeTime_DWToSTR(*(iRefreshParam->dwPlayTime), strTemp);
DrawTrackTime(strTemp, HIGHLIGHT_NORMAL);
}
/********************************************************************/
// Determine track no
// Spec: if playing, show playing music's / total count,
// if not, show highlight music's / total count
void DetermineTrackNo(tPositionInfoInner *iPosInfoInner, tRefreshParam *iRefreshParam, WORD *iCurTrack, WORD *iTotalTrack)
{
*iCurTrack=iPosInfoInner->wListPlayingIndex_xDir-(iPosInfoInner->wListItemCount_xDir-iPosInfoInner->wListFileCount_xDir)+1;
*iTotalTrack=iPosInfoInner->wListFileCount_xDir;
}
/********************************************************************/
// Refresh Track No
void RefreshTrackNo(tPositionInfoInner *iPosInfoInner, tRefreshParam *iRefreshParam)
{
WORD iCurTrack, iTotalTrack;
DetermineTrackNo(iPosInfoInner, iRefreshParam, &iCurTrack, &iTotalTrack);
DrawTrackNo(iCurTrack, iTotalTrack, HIGHLIGHT_NORMAL);
}
/********************************************************************/
// Refresh Status Items
void RefreshStatusItem(tPositionInfoInner *iPosInfoInner, tRefreshParam *iRefreshParam)
{
DrawPlayback(*(iRefreshParam->wPlayMode), *(iRefreshParam->bIsSecondStop), *(iRefreshParam->bActionCtl), HIGHLIGHT_NORMAL);
RefreshTrackTime(iPosInfoInner, iRefreshParam);
RefreshTrackNo(iPosInfoInner, iRefreshParam);
DrawRepeat(*(iRefreshParam->wRepeatMode), HIGHLIGHT_NORMAL);
Draw3DSur(*(iRefreshParam->wSurMode), HIGHLIGHT_NORMAL);
}
/********************************************************************/
// Refresh Icon on left of List and Icon on left of Prog
void RefreshListProgIcon(tPositionInfoInner *iPosInfoInner, tRefreshParam *iRefreshParam)
{
if(iPosInfoInner->iPlayingObj==MPO_NOTHING)
DrawListProgramPreview(HIGHLIGHT_NOT_ON_BOTH, HIGHLIGHT_NORMAL);
}
/********************************************************************/
// Draw All List Contents
// Suppose that the diTable's size is CONTENT_MAX_ITEM_COUNT
void RefreshListContent(MPLIST_INFO *diTable, int iListPlayingIndex, tHighlightType iHighlight)
{
int i;
for(i=0; i<CONTENT_MAX_ITEM_COUNT; i++)
{
if(i==iListPlayingIndex)
DrawListItemSign(i, TRUE, HIGHLIGHT_NORMAL);
else
DrawListItemSign(i, FALSE, HIGHLIGHT_NORMAL);
if(diTable[i].bType==C_DIR)
DrawListItemText(i, diTable[i].szName, diTable[i].bType, HIGHLIGHT_NORMAL);
else
DrawListItemText(i, diTable[i].szName, diTable[i].bType, iHighlight);
}
}
void RefreshProgrammedSign(tPositionInfoInner *iPosInfoInner)
{
int i;
for(i=0; i<CONTENT_MAX_ITEM_COUNT; i++)
{
if(findProgItem((iPosInfoInner->wListHighlightIndex-iPosInfoInner->iListHighlightIndex)+i)==PROG_ITEM_NULL)
DrawListItemProg(i, FALSE, HIGHLIGHT_NORMAL);
else
DrawListItemProg(i, TRUE, HIGHLIGHT_NORMAL);
}
}
/********************************************************************/
// Item Visible or not
BOOL ItemVisible(int iItem, int wAbosuluteHL, int iRelativeHL, int wTotalCount)
{
int iFirstDisplayNum, iLastDisplayNum;
BOOL bRet;
if(iItem==MPO_NOTHING || wTotalCount<=0 )
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -