📄 localfileplay.cpp
字号:
m_ctlVolume.EnableWindow(FALSE);
pButton = (CButton *)GetDlgItem(IDC_PLAY_FILE);
pButton->SetIcon(m_hPlayEnableIcon);
pButton->EnableWindow(TRUE);
pButton = (CButton *)GetDlgItem(IDC_STOP);
pButton->SetIcon(m_hStopDisableIcon);
pButton->EnableWindow(FALSE);
pButton = (CButton *)GetDlgItem(IDC_FAST);
pButton->SetIcon(m_hFastDisableIcon);
pButton->EnableWindow(FALSE);
pButton = (CButton *)GetDlgItem(IDC_SLOW);
pButton->SetIcon(m_hSlowDisableIcon);
pButton->EnableWindow(FALSE);
pButton = (CButton *)GetDlgItem(IDC_STEP);
pButton->SetIcon(m_hStepDisableIcon);
pButton->EnableWindow(FALSE);
pButton = (CButton *)GetDlgItem(IDC_STEPBACK);
pButton->SetIcon(m_hStepBackDisableIcon);
pButton->EnableWindow(FALSE);
pButton = (CButton *)GetDlgItem(IDC_CAPPIC);
pButton->SetIcon(m_hCaptureIcon);
pButton->EnableWindow(FALSE);
pButton = (CButton *)GetDlgItem(IDC_SOUND);
pButton->SetIcon(m_hSoundStopIcon);
pButton->EnableWindow(FALSE);
pButton = (CButton *)GetDlgItem(IDC_STEP);
pButton->SetIcon(m_hStepDisableIcon);
pButton->EnableWindow(FALSE);
F_UpdateStepBackUI(FALSE);
}
void CLocalFilePlay::F_UpdateStepBackUI(BOOL bEnable)
{
m_bFileRefCreated=bEnable;
CButton *pButton;
if(m_bFileRefCreated)
{
pButton = (CButton *)GetDlgItem(IDC_STEPBACK);
pButton->SetIcon(m_hStepBackEnableIcon);
pButton->EnableWindow(TRUE);
}
else
{
pButton = (CButton *)GetDlgItem(IDC_STEPBACK);
pButton->SetIcon(m_hStepBackDisableIcon);
pButton->EnableWindow(FALSE);
}
}
void CLocalFilePlay::F_SetPlayState()
{
CButton *pButton;
m_ctlProgress.EnableWindow(TRUE);
m_ctlVolume.EnableWindow(TRUE);
pButton = (CButton *)GetDlgItem(IDC_PLAY_FILE);
pButton->SetIcon(m_hPauseEnableIcon);
pButton->EnableWindow(TRUE);
pButton = (CButton *)GetDlgItem(IDC_STOP);
pButton->SetIcon(m_hStopEnableIcon);
pButton->EnableWindow(TRUE);
pButton = (CButton *)GetDlgItem(IDC_FAST);
pButton->SetIcon(m_hFastEnableIcon);
pButton->EnableWindow(TRUE);
pButton = (CButton *)GetDlgItem(IDC_SLOW);
pButton->SetIcon(m_hSlowEnableIcon);
pButton->EnableWindow(TRUE);
pButton = (CButton *)GetDlgItem(IDC_CAPPIC);
pButton->SetIcon(m_hCaptureIcon);
pButton->EnableWindow(TRUE);
pButton = (CButton *)GetDlgItem(IDC_SOUND);
if(m_bSound)
pButton->SetIcon(m_hSoundStartIcon);
else
pButton->SetIcon(m_hSoundStopIcon);
pButton->EnableWindow(TRUE);
pButton = (CButton *)GetDlgItem(IDC_STEP);
pButton->SetIcon(m_hStepEnableIcon);
pButton->EnableWindow(TRUE);
}
void CLocalFilePlay::F_SetPauseState()
{
CButton *pButton;
pButton = (CButton *)GetDlgItem(IDC_PLAY_FILE);
pButton->SetIcon(m_hPlayEnableIcon);
pButton->EnableWindow(TRUE);
}
void CLocalFilePlay::F_Play()
{
int fileselpos = 0;
CString csFileName;
CString csIP,csTemp, sTemp1;
int nPos = 0;
UpdateData(TRUE);
POSITION pos = m_locFileList.GetFirstSelectedItemPosition();
if(pos == NULL)
{
AfxMessageBox("Please select file!");
return;
}
fileselpos = m_locFileList.GetNextSelectedItem(pos);
PlayM4_SetFileRefCallBack(USED_PORT,FileRefDone,(DWORD)this);
csFileName = m_locFileList.GetItemText(fileselpos,0);
if(csFileName.GetLength()==0)
return;
csTemp.Format("%s",csFileName);
nPos=csTemp.Find("\\",0);
while(nPos>=0)
{
csIP.Format("%s",csTemp.Right(csTemp.GetLength()-nPos-1));
csTemp.Format("%s",csIP);
nPos=csTemp.Find("\\",0);
}
nPos=csTemp.Find("_",0);
csIP.Format("%s",csTemp.Left(nPos));
m_csIP.Format("%s",csIP);
if(!PlayM4_OpenFile(USED_PORT,csFileName.GetBuffer(csFileName.GetLength())))
{
TRACE("open file failed!");
return;
}
sTemp1 = m_locFileList.GetItemText(fileselpos,1);
TRACE("Play file of %s", sTemp1);
iSelChannel = atoi(sTemp1);
TRACE("iSelChannel = %d", iSelChannel);
m_iTotalSeconds=PlayM4_GetFileTime(USED_PORT);
if(m_iTotalSeconds<=0)
{
PlayM4_CloseFile(USED_PORT);
MessageBox("File size is 0!");
return;
}
PlayM4_SetDisplayCallBack(USED_PORT,DisplayCBFun);
if((m_bPlay=PlayM4_Play(USED_PORT,m_hPlayWnd))==FALSE)
{
PlayM4_CloseFile(USED_PORT);
TRACE("play file error!");
return;
}
}
void CLocalFilePlay::F_Pause()
{
if(PlayM4_Pause(USED_PORT,!m_bPause))
{
m_bPause=!m_bPause;
}
else
{
TRACE("PAUSE ERROR!");
}
if(m_bPause)
F_SetPauseState();
else
F_SetPlayState();
}
void CLocalFilePlay::F_Sound(BOOL bSound)
{
if(!m_bPlay)
return;
if(bSound)
{
m_bSound=PlayM4_PlaySound(USED_PORT);
PlayM4_SetVolume(USED_PORT,(WORD)m_ctlVolume.GetPos());
}
else
{
PlayM4_StopSound();
m_bSound=FALSE;
}
if(m_bSound)
F_SetPlaySoundState();
else
F_SetStopSoundState();
}
void CLocalFilePlay::F_SetPlaySoundState()
{
CButton *pButton;
pButton = (CButton *)GetDlgItem(IDC_SOUND);
pButton->SetIcon(m_hSoundStartIcon);
pButton->EnableWindow(TRUE);
}
void CLocalFilePlay::F_SetStopSoundState()
{
CButton *pButton;
pButton = (CButton *)GetDlgItem(IDC_SOUND);
pButton->SetIcon(m_hSoundStopIcon);
pButton->EnableWindow(TRUE);
}
void CLocalFilePlay::F_ShowFullScreen()
{
F_EnableFlashWnd(FALSE);
CRect rc,rcClient;
::GetWindowRect(m_hPareDlgWnd,m_rcPareDlg);
::GetWindowRect(m_hPareTabWnd,m_rcPareTab);
::ScreenToClient(m_hPareDlgWnd,(POINT*)(&m_rcPareTab));
::ScreenToClient(m_hPareDlgWnd,(POINT*)(&m_rcPareTab)+1);
::GetWindowRect(m_hWnd,m_rcParent);
::ScreenToClient(m_hPareTabWnd,(POINT*)(&m_rcParent));
::ScreenToClient(m_hPareTabWnd,(POINT*)(&m_rcParent)+1);
::SetWindowPos(m_hPareDlgWnd,NULL,m_rcScreen.left-SCREEN_EDGE,m_rcScreen.top-SCREEN_EDGE,m_rcScreen.Width()+2*SCREEN_EDGE,m_rcScreen.Height()+2*SCREEN_EDGE,SWP_SHOWWINDOW);
::GetClientRect(m_hPareDlgWnd,rc);
::SetWindowPos(m_hPareTabWnd,NULL,rc.left,rc.top,rc.Width(),rc.Height(),SWP_SHOWWINDOW);
::GetClientRect(m_hPareTabWnd,rc);
::SetWindowPos(m_hWnd,NULL,rc.left,rc.top,rc.Width(),rc.Height(),SWP_SHOWWINDOW);
GetDlgItem(IDC_WND)->GetClientRect(rcClient);
GetDlgItem(IDC_WND)->GetWindowRect(rc);
int iEdge=(rc.Width()-rcClient.Width())/2;
rc=m_rcScreen;
rc.left-=iEdge;
rc.right+=iEdge;
rc.top-=iEdge;
rc.bottom+=iEdge;
this->ScreenToClient(rc);
::SetWindowPos(GetDlgItem(IDC_WND)->m_hWnd,NULL,rc.left,rc.top,rc.Width(),rc.Height(),SWP_SHOWWINDOW);
Invalidate(FALSE);
UpdateWindow();
}
void CLocalFilePlay::F_ShowNormal()
{
GetDlgItem(IDC_WND)->SetWindowPos(NULL,m_rcWnd.left,m_rcWnd.top,m_rcWnd.Width(),m_rcWnd.Height(),SWP_SHOWWINDOW);
::SetWindowPos(m_hWnd,NULL,m_rcParent.left,m_rcParent.top,m_rcParent.Width(),m_rcParent.Height(),SWP_SHOWWINDOW);
::SetWindowPos(m_hPareTabWnd,NULL,m_rcPareTab.left,m_rcPareTab.top,m_rcPareTab.Width(),m_rcPareTab.Height(),SWP_SHOWWINDOW);
::SetWindowPos(m_hPareDlgWnd,NULL,m_rcPareDlg.left,m_rcPareDlg.top,m_rcPareDlg.Width(),m_rcPareDlg.Height(),SWP_SHOWWINDOW);
F_EnableFlashWnd(TRUE);
Invalidate(FALSE);
UpdateWindow();
}
void CLocalFilePlay::F_EnableFlashWnd(BOOL bEnable)
{
if(bEnable)
{
//THE same to multiplay
GetDlgItem(IDC_PLAYSTATUS)->ModifyStyle(0,WS_VISIBLE,0);
GetDlgItem(IDC_PLAY_FILE)->ModifyStyle(0,WS_VISIBLE,0);
GetDlgItem(IDC_STOP)->ModifyStyle(0,WS_VISIBLE,0);
GetDlgItem(IDC_SLOW)->ModifyStyle(0,WS_VISIBLE,0);
GetDlgItem(IDC_FAST)->ModifyStyle(0,WS_VISIBLE,0);
GetDlgItem(IDC_SOUND)->ModifyStyle(0,WS_VISIBLE,0);
GetDlgItem(IDC_VOLUME_SLIDER)->ModifyStyle(0,WS_VISIBLE,0);
GetDlgItem(IDC_DATESTART)->ModifyStyle(0,WS_VISIBLE,0);
GetDlgItem(IDC_DATESTOP)->ModifyStyle(0,WS_VISIBLE,0);
GetDlgItem(IDC_TIMESTOP)->ModifyStyle(0,WS_VISIBLE,0);
GetDlgItem(IDC_TIMESTART)->ModifyStyle(0,WS_VISIBLE,0);
GetDlgItem(IDC_COMBOFILETYPE)->ModifyStyle(0,WS_VISIBLE,0);
GetDlgItem(IDC_SEARCHLOCALLIST)->ModifyStyle(0,WS_VISIBLE,0);
GetDlgItem(IDC_PROGRESS_SLIDER)->ModifyStyle(0,WS_VISIBLE,0);
GetDlgItem(IDC_CAPPIC)->ModifyStyle(0,WS_VISIBLE,0);
//the only for single play
GetDlgItem(IDC_LOCALFILRLIST)->ModifyStyle(0,WS_VISIBLE,0);
GetDlgItem(IDC_STEP)->ModifyStyle(0,WS_VISIBLE,0);
GetDlgItem(IDC_STEPBACK)->ModifyStyle(0,WS_VISIBLE,0);
GetDlgItem(IDC_DELETEALL)->ModifyStyle(0,WS_VISIBLE,0);
GetDlgItem(IDC_DELETE)->ModifyStyle(0,WS_VISIBLE,0);
GetDlgItem(IDC_COMBOCHANNEL)->ModifyStyle(0,WS_VISIBLE,0);
}
else
{
//THE same to multiplay
GetDlgItem(IDC_PLAYSTATUS)->ModifyStyle(WS_VISIBLE,0,0);
GetDlgItem(IDC_PLAY_FILE)->ModifyStyle(WS_VISIBLE,0,0);
GetDlgItem(IDC_STOP)->ModifyStyle(WS_VISIBLE,0,0);
GetDlgItem(IDC_SLOW)->ModifyStyle(WS_VISIBLE,0,0);
GetDlgItem(IDC_FAST)->ModifyStyle(WS_VISIBLE,0,0);
GetDlgItem(IDC_SOUND)->ModifyStyle(WS_VISIBLE,0,0);
GetDlgItem(IDC_VOLUME_SLIDER)->ModifyStyle(WS_VISIBLE,0,0);
GetDlgItem(IDC_PROGRESS_SLIDER)->ModifyStyle(WS_VISIBLE,0,0);
GetDlgItem(IDC_DATESTART)->ModifyStyle(WS_VISIBLE,0,0);
GetDlgItem(IDC_DATESTOP)->ModifyStyle(WS_VISIBLE,0,0);
GetDlgItem(IDC_TIMESTOP)->ModifyStyle(WS_VISIBLE,0,0);
GetDlgItem(IDC_TIMESTART)->ModifyStyle(WS_VISIBLE,0,0);
GetDlgItem(IDC_COMBOFILETYPE)->ModifyStyle(WS_VISIBLE,0,0);
GetDlgItem(IDC_SEARCHLOCALLIST)->ModifyStyle(WS_VISIBLE,0,0);
GetDlgItem(IDC_CAPPIC)->ModifyStyle(WS_VISIBLE,0,0);
//the only for single play
GetDlgItem(IDC_LOCALFILRLIST)->ModifyStyle(WS_VISIBLE,0,0);
GetDlgItem(IDC_STEP)->ModifyStyle(WS_VISIBLE,0,0);
GetDlgItem(IDC_STEPBACK)->ModifyStyle(WS_VISIBLE,0,0);
GetDlgItem(IDC_DELETEALL)->ModifyStyle(WS_VISIBLE,0,0);
GetDlgItem(IDC_DELETE)->ModifyStyle(WS_VISIBLE,0,0);
GetDlgItem(IDC_COMBOCHANNEL)->ModifyStyle(WS_VISIBLE,0,0);
}
}
void CLocalFilePlay::OnCancel()
{
// TODO: Add extra cleanup here
//CDialog::OnCancel();
}
void CLocalFilePlay::OnSelchangeComboserver()
{
// TODO: Add your control notification handler code here
int iSelServer = m_ServerCtrl.GetCurSel() - 1;
if(iSelServer < 0)
return;
LONG m_lServerID = serverinfo[iSelServer].m_lServerID;
LONG m_lServerType = serverinfo[iSelServer].m_wServerType;
m_lStartChan = serverinfo[iSelServer].m_lStartChannel;
m_iChannelnumber = serverinfo[iSelServer].m_iServerChannelNumber;
m_ChannelCtrl.ResetContent();
CString sTemp;
m_ChannelCtrl.AddString("All Channels");
for(int i=0; i<m_iChannelnumber; i++)
{
sTemp.Format("%d", i+m_lStartChan);
m_ChannelCtrl.AddString(sTemp);
}
m_ChannelCtrl.SetCurSel(0);
}
void CLocalFilePlay::OnSelchangeCombofiletype()
{
// TODO: Add your control notification handler code here
}
void CLocalFilePlay::OnOK()
{
// TODO: Add extra cleanup here
// CDialog::OnOK();
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -