⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 osmo4.cpp

📁 一个用于智能手机的多媒体库适合S60 WinCE的跨平台开发库
💻 CPP
📖 第 1 页 / 共 3 页
字号:
}/////////////////////////////////////////////////////////////////////////////// WinGPAC message handlers/////////////////////////////////////////////////////////////////////////////// CAboutDlg dialog used for App Aboutclass CAboutDlg : public CDialog{public:	CAboutDlg();// Dialog Data	//{{AFX_DATA(CAboutDlg)	enum { IDD = IDD_ABOUTBOX };	//}}AFX_DATA	// ClassWizard generated virtual function overrides	//{{AFX_VIRTUAL(CAboutDlg)	protected:	virtual void DoDataExchange(CDataExchange* pDX);    // DDX/DDV support	//}}AFX_VIRTUAL// Implementationprotected:	//{{AFX_MSG(CAboutDlg)	virtual BOOL OnInitDialog();	afx_msg void OnGogpac();	//}}AFX_MSG	DECLARE_MESSAGE_MAP()};CAboutDlg::CAboutDlg() : CDialog(CAboutDlg::IDD){	//{{AFX_DATA_INIT(CAboutDlg)	//}}AFX_DATA_INIT}void CAboutDlg::DoDataExchange(CDataExchange* pDX){	CDialog::DoDataExchange(pDX);	//{{AFX_DATA_MAP(CAboutDlg)	//}}AFX_DATA_MAP}BEGIN_MESSAGE_MAP(CAboutDlg, CDialog)	//{{AFX_MSG_MAP(CAboutDlg)	ON_BN_CLICKED(IDC_GOGPAC, OnGogpac)	//}}AFX_MSG_MAPEND_MESSAGE_MAP()void WinGPAC::OnAbout() {	CAboutDlg aboutDlg;	aboutDlg.DoModal();}BOOL CAboutDlg::OnInitDialog() {	CDialog::OnInitDialog();	CString str = "GPAC/Osmo4 - version " GPAC_VERSION;	SetWindowText(str);	return TRUE;  }void CAboutDlg::OnGogpac() {	ShellExecute(NULL, "open", "http://gpac.sourceforge.net", NULL, NULL, SW_SHOWNORMAL);}/////////////////////////////////////////////////////////////////////////////// WinGPAC message handlersvoid WinGPAC::SetOptions(){	const char *sOpt = gf_cfg_get_key(m_user.config, "General", "Loop");	m_Loop = (sOpt && !stricmp(sOpt, "yes")) ? 1 : 0;	sOpt = gf_cfg_get_key(m_user.config, "General", "LookForSubtitles");	m_LookForSubtitles = (sOpt && !stricmp(sOpt, "yes")) ? 1 : 0;	sOpt = gf_cfg_get_key(m_user.config, "General", "ConsoleOff");	m_NoConsole = (sOpt && !stricmp(sOpt, "yes")) ? 1 : 0;	sOpt = gf_cfg_get_key(m_user.config, "General", "ViewXMT");	m_ViewXMTA  = (sOpt && !stricmp(sOpt, "yes")) ? 1 : 0;	sOpt = gf_cfg_get_key(m_user.config, "General", "NoMIMETypeFetch");	m_NoMimeFetch = (sOpt && !stricmp(sOpt, "yes")) ? 1 : 0;}void WinGPAC::OnOpenUrl() {	COpenUrl url;	if (url.DoModal() != IDOK) return;	CMainFrame *pFrame = (CMainFrame *) m_pMainWnd;	pFrame->m_pPlayList->Truncate();	pFrame->m_pPlayList->QueueURL(url.m_url);	pFrame->m_pPlayList->RefreshList();	pFrame->m_pPlayList->PlayNext();}CString WinGPAC::GetFileFilter(){	u32 keyCount, i;	CString sFiles;	CString sExts;	CString supportedFiles;	/*force MP4 and 3GP files at beginning to make sure they are selected (Win32 bug with too large filters)*/	supportedFiles = "All Known Files|*.m3u;*.pls;*.mp4;*.3gp;*.3g2";	sExts = "";	sFiles = "";	keyCount = gf_cfg_get_key_count(m_user.config, "MimeTypes");	for (i=0; i<keyCount; i++) {		const char *sMime;		Bool first;		char *sKey;		const char *opt;		char szKeyList[1000], sDesc[1000];		sMime = gf_cfg_get_key_name(m_user.config, "MimeTypes", i);		if (!sMime) continue;		CString sOpt;		opt = gf_cfg_get_key(m_user.config, "MimeTypes", sMime);		/*remove module name*/		strcpy(szKeyList, opt+1);		sKey = strrchr(szKeyList, '\"');		if (!sKey) continue;		sKey[0] = 0;		/*get description*/		sKey = strrchr(szKeyList, '\"');		if (!sKey) continue;		strcpy(sDesc, sKey+1);		sKey[0] = 0;		sKey = strrchr(szKeyList, '\"');		if (!sKey) continue;		sKey[0] = 0;		/*if same description for # mime types skip (means an old mime syntax)*/		if (sFiles.Find(sDesc)>=0) continue;		/*if same extensions for # mime types skip (don't polluate the file list)*/		if (sExts.Find(szKeyList)>=0) continue;		sExts += szKeyList;		sExts += " ";		sFiles += sDesc;		sFiles += "|";		first = 1;		sOpt = CString(szKeyList);		while (1) {						int pos = sOpt.Find(' ');			CString ext = (pos==-1) ? sOpt : sOpt.Left(pos);			/*WATCHOUT: we do have some "double" ext , eg .wrl.gz - these are NOT supported by windows*/			if (ext.Find(".")<0) {				if (!first) {					sFiles += ";";				} else {					first = 0;				}				sFiles += "*.";				sFiles += ext;				CString sext = ext;				sext += ";";				if (supportedFiles.Find(sext)<0) {					supportedFiles += ";*.";					supportedFiles += ext;				}			}			if (sOpt==ext) break;			CString rem;			rem.Format("%s ", (LPCTSTR) ext);			sOpt.Replace((LPCTSTR) rem, "");		}		sFiles += "|";	}	supportedFiles += "|";	supportedFiles += sFiles;	supportedFiles += "M3U Playlists|*.m3u|ShoutCast Playlists|*.pls|All Files |*.*|";	return supportedFiles;}void WinGPAC::OnOpenFile() {	CString sFiles = GetFileFilter();	u32 nb_items;		/*looks like there's a bug here, main filter isn't used correctly while the others are*/	CFileDialog fd(TRUE,NULL,NULL, OFN_ALLOWMULTISELECT | OFN_HIDEREADONLY | OFN_FILEMUSTEXIST , sFiles);	fd.m_ofn.nMaxFile = 25000;	fd.m_ofn.lpstrFile = (char *) malloc(sizeof(char) * fd.m_ofn.nMaxFile);	fd.m_ofn.lpstrFile[0] = 0;	if (fd.DoModal()!=IDOK) {		free(fd.m_ofn.lpstrFile);		return;	}	CMainFrame *pFrame = (CMainFrame *) m_pMainWnd;	nb_items = 0;	POSITION pos = fd.GetStartPosition();	while (pos) {		CString file = fd.GetNextPathName(pos);		nb_items++;	}	/*if several items, act as playlist (replace playlist), otherwise as browser (lost all "next" context)*/	if (nb_items==1) 		pFrame->m_pPlayList->Truncate();	else		pFrame->m_pPlayList->Clear();	pos = fd.GetStartPosition();	while (pos) {		CString file = fd.GetNextPathName(pos);		pFrame->m_pPlayList->QueueURL(file);	}	free(fd.m_ofn.lpstrFile);	pFrame->m_pPlayList->RefreshList();	pFrame->m_pPlayList->PlayNext();}void WinGPAC::Pause(){	if (!m_isopen) return;	gf_term_set_option(m_term, GF_OPT_PLAY_STATE, (gf_term_get_option(m_term, GF_OPT_PLAY_STATE)==GF_STATE_PLAYING) ? GF_STATE_PAUSED : GF_STATE_PLAYING);}void WinGPAC::OnMainPause() {	Pause();	}void WinGPAC::OnFileStep() {	gf_term_set_option(m_term, GF_OPT_PLAY_STATE, GF_STATE_STEP_PAUSE);	((CMainFrame *) m_pMainWnd)->m_wndToolBar.SetButtonInfo(5, ID_FILE_PLAY, TBBS_BUTTON, 3);}void WinGPAC::OnUpdateFileStep(CCmdUI* pCmdUI) {	pCmdUI->Enable(m_isopen && !m_reset);	}void WinGPAC::PlayFromTime(u32 time){	Bool do_pause;	if (start_mode==1) do_pause = 1;	else if (start_mode==2) do_pause = 0;	else do_pause = /*!m_AutoPlay*/0;	gf_term_play_from_time(m_term, time, do_pause);	m_reset = 0;}void WinGPAC::OnFileReload() {	gf_term_disconnect(m_term);	m_pMainWnd->PostMessage(WM_OPENURL);}void WinGPAC::UpdatePlayButton(Bool force_play){	if (!force_play && gf_term_get_option(m_term, GF_OPT_PLAY_STATE)==GF_STATE_PLAYING) {		((CMainFrame *) m_pMainWnd)->m_wndToolBar.SetButtonInfo(5, ID_FILE_PLAY, TBBS_BUTTON, 4);	} else {		((CMainFrame *) m_pMainWnd)->m_wndToolBar.SetButtonInfo(5, ID_FILE_PLAY, TBBS_BUTTON, 3);	}}void WinGPAC::OnFilePlay() {	if (m_isopen) {		if (m_reset) {			m_reset = 0;			PlayFromTime(0);			((CMainFrame *)m_pMainWnd)->SetProgTimer(1);		} else {			Pause();		}		UpdatePlayButton();	} else {		((CMainFrame *) m_pMainWnd)->m_pPlayList->Play();	}}void WinGPAC::OnUpdateFilePlay(CCmdUI* pCmdUI) {	if (m_isopen) {		pCmdUI->Enable(TRUE);			if (pCmdUI->m_nID==ID_FILE_PLAY) {			if (!m_isopen) {				pCmdUI->SetText("Play/Pause\tCtrl+P");			} else if (gf_term_get_option(m_term, GF_OPT_PLAY_STATE)==GF_STATE_PLAYING) {				pCmdUI->SetText("Pause\tCtrl+P");			} else {				pCmdUI->SetText("Resume\tCtrl+P");			}		}	} else {		pCmdUI->Enable(((CMainFrame *)m_pMainWnd)->m_pPlayList->HasValidEntries() );			pCmdUI->SetText("Play\tCtrl+P");	}}void WinGPAC::OnFileStop() {	CMainFrame *pFrame = (CMainFrame *) m_pMainWnd;	if (m_reset) return;	if (gf_term_get_option(m_term, GF_OPT_PLAY_STATE)==GF_STATE_PLAYING) Pause();	m_reset = 1;	pFrame->m_Sliders.m_PosSlider.SetPos(0);	pFrame->SetProgTimer(0);	pFrame->m_wndToolBar.SetButtonInfo(5, ID_FILE_PLAY, TBBS_BUTTON, 3);	start_mode = 2;}void WinGPAC::OnUpdateFileStop(CCmdUI* pCmdUI) {	pCmdUI->Enable(m_isopen);	}void WinGPAC::OnSwitchRender() {	const char *opt = gf_cfg_get_key(m_user.config, "Rendering", "RendererName");	if (!stricmp(opt, "GPAC 2D Renderer"))		gf_cfg_set_key(m_user.config, "Rendering", "RendererName", "GPAC 3D Renderer");	else		gf_cfg_set_key(m_user.config, "Rendering", "RendererName", "GPAC 2D Renderer");	ReloadTerminal();}void WinGPAC::UpdateRenderSwitch(){	const char *opt = gf_cfg_get_key(m_user.config, "Rendering", "RendererName");	if (!stricmp(opt, "GPAC 3D Renderer"))		((CMainFrame *) m_pMainWnd)->m_wndToolBar.SetButtonInfo(12, ID_SWITCH_RENDER, TBBS_BUTTON, 10);	else		((CMainFrame *) m_pMainWnd)->m_wndToolBar.SetButtonInfo(12, ID_SWITCH_RENDER, TBBS_BUTTON, 9);}void WinGPAC::OnReloadTerminal() {	ReloadTerminal();}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -