diff options
author | kinddragon <kinddragon@users.sourceforge.net> | 2010-04-20 06:17:50 +0400 |
---|---|---|
committer | kinddragon <kinddragon@users.sourceforge.net> | 2010-04-20 06:17:50 +0400 |
commit | 4f8e4a60a362334579435db89e08f00e78a5de48 (patch) | |
tree | 8aa488487d0984467be5789c0ed6bd226c8d9cbb /src | |
parent | 3c584d0200f48d4b29f783bec509a756f3579ff3 (diff) |
long sequences of "if" replaced by "switch" for better performance and simplifying debugging
git-svn-id: https://mpc-hc.svn.sourceforge.net/svnroot/mpc-hc/trunk@1802 10f7b99b-c216-0410-bff0-8a66a9350fd8
Diffstat (limited to 'src')
-rw-r--r-- | src/apps/mplayerc/FGManager.cpp | 82 | ||||
-rw-r--r-- | src/apps/mplayerc/FileVersionInfo.cpp | 42 | ||||
-rw-r--r-- | src/apps/mplayerc/MainFrm.cpp | 857 | ||||
-rw-r--r-- | src/apps/mplayerc/MainFrm.h | 8 | ||||
-rw-r--r-- | src/apps/mplayerc/PPageAccelTbl.cpp | 266 | ||||
-rw-r--r-- | src/apps/mplayerc/PlayerSubresyncBar.cpp | 407 |
6 files changed, 864 insertions, 798 deletions
diff --git a/src/apps/mplayerc/FGManager.cpp b/src/apps/mplayerc/FGManager.cpp index 340e5af8b..7f6f6afc2 100644 --- a/src/apps/mplayerc/FGManager.cpp +++ b/src/apps/mplayerc/FGManager.cpp @@ -2518,41 +2518,53 @@ CFGManagerPlayer::CFGManagerPlayer(LPCTSTR pName, LPUNKNOWN pUnk, HWND hWnd) // Renderers
- if(s.iDSVideoRendererType == VIDRNDT_DS_OLDRENDERER)
- m_transform.AddTail(DNew CFGFilterRegistry(CLSID_VideoRenderer, m_vrmerit));
- else if(s.iDSVideoRendererType == VIDRNDT_DS_OVERLAYMIXER)
- m_transform.AddTail(DNew CFGFilterVideoRenderer(m_hWnd, CLSID_OverlayMixer, L"Overlay Mixer", m_vrmerit));
- else if(s.iDSVideoRendererType == VIDRNDT_DS_VMR7WINDOWED)
- m_transform.AddTail(DNew CFGFilterVideoRenderer(m_hWnd, CLSID_VideoMixingRenderer, L"Video Mixing Render 7 (Windowed)", m_vrmerit));
- else if(s.iDSVideoRendererType == VIDRNDT_DS_VMR9WINDOWED)
- m_transform.AddTail(DNew CFGFilterVideoRenderer(m_hWnd, CLSID_VideoMixingRenderer9, L"Video Mixing Render 9 (Windowed)", m_vrmerit));
- else if(s.iDSVideoRendererType == VIDRNDT_DS_VMR7RENDERLESS)
- m_transform.AddTail(DNew CFGFilterVideoRenderer(m_hWnd, CLSID_VMR7AllocatorPresenter, L"Video Mixing Render 7 (Renderless)", m_vrmerit));
- else if(s.iDSVideoRendererType == VIDRNDT_DS_VMR9RENDERLESS)
- m_transform.AddTail(DNew CFGFilterVideoRenderer(m_hWnd, CLSID_VMR9AllocatorPresenter, L"Video Mixing Render 9 (Renderless)", m_vrmerit));
- else if(s.iDSVideoRendererType == VIDRNDT_DS_EVR)
- m_transform.AddTail(DNew CFGFilterVideoRenderer(m_hWnd, CLSID_EnhancedVideoRenderer, L"Enhanced Video Renderer", m_vrmerit));
- else if(s.iDSVideoRendererType == VIDRNDT_DS_EVR_CUSTOM)
- m_transform.AddTail(DNew CFGFilterVideoRenderer(m_hWnd, CLSID_EVRAllocatorPresenter, L"Enhanced Video Renderer (custom presenter)", m_vrmerit));
- else if(s.iDSVideoRendererType == VIDRNDT_DS_DXR)
- m_transform.AddTail(DNew CFGFilterVideoRenderer(m_hWnd, CLSID_DXRAllocatorPresenter, L"Haali's Video Renderer", m_vrmerit));
- else if(s.iDSVideoRendererType == VIDRNDT_DS_MADVR)
- m_transform.AddTail(DNew CFGFilterVideoRenderer(m_hWnd, CLSID_madVRAllocatorPresenter, L"madVR Renderer", m_vrmerit));
-// m_transform.AddTail(DNew CFGFilterVideoRenderer(m_hWnd, CLSID_madVR, L"Madshi Video Renderer", m_vrmerit));
- else if(s.iDSVideoRendererType == VIDRNDT_DS_SYNC)
- m_transform.AddTail(DNew CFGFilterVideoRenderer(m_hWnd, CLSID_SyncAllocatorPresenter, L"Sync Renderer", m_vrmerit));
- else if(s.iDSVideoRendererType == VIDRNDT_DS_NULL_COMP)
- {
- pFGF = DNew CFGFilterInternal<CNullVideoRenderer>(L"Null Video Renderer (Any)", MERIT64_ABOVE_DSHOW+2);
- pFGF->AddType(MEDIATYPE_Video, MEDIASUBTYPE_NULL);
- m_transform.AddTail(pFGF);
- }
- else if(s.iDSVideoRendererType == VIDRNDT_DS_NULL_UNCOMP)
- {
- pFGF = DNew CFGFilterInternal<CNullUVideoRenderer>(L"Null Video Renderer (Uncompressed)", MERIT64_ABOVE_DSHOW+2);
- pFGF->AddType(MEDIATYPE_Video, MEDIASUBTYPE_NULL);
- m_transform.AddTail(pFGF);
- }
+ switch(s.iDSVideoRendererType)
+ {
+ case VIDRNDT_DS_OLDRENDERER:
+ m_transform.AddTail(DNew CFGFilterRegistry(CLSID_VideoRenderer, m_vrmerit));
+ break;
+ case VIDRNDT_DS_OVERLAYMIXER:
+ m_transform.AddTail(DNew CFGFilterVideoRenderer(m_hWnd, CLSID_OverlayMixer, L"Overlay Mixer", m_vrmerit));
+ break;
+ case VIDRNDT_DS_VMR7WINDOWED:
+ m_transform.AddTail(DNew CFGFilterVideoRenderer(m_hWnd, CLSID_VideoMixingRenderer, L"Video Mixing Render 7 (Windowed)", m_vrmerit));
+ break;
+ case VIDRNDT_DS_VMR9WINDOWED:
+ m_transform.AddTail(DNew CFGFilterVideoRenderer(m_hWnd, CLSID_VideoMixingRenderer9, L"Video Mixing Render 9 (Windowed)", m_vrmerit));
+ break;
+ case VIDRNDT_DS_VMR7RENDERLESS:
+ m_transform.AddTail(DNew CFGFilterVideoRenderer(m_hWnd, CLSID_VMR7AllocatorPresenter, L"Video Mixing Render 7 (Renderless)", m_vrmerit));
+ break;
+ case VIDRNDT_DS_VMR9RENDERLESS:
+ m_transform.AddTail(DNew CFGFilterVideoRenderer(m_hWnd, CLSID_VMR9AllocatorPresenter, L"Video Mixing Render 9 (Renderless)", m_vrmerit));
+ break;
+ case VIDRNDT_DS_EVR:
+ m_transform.AddTail(DNew CFGFilterVideoRenderer(m_hWnd, CLSID_EnhancedVideoRenderer, L"Enhanced Video Renderer", m_vrmerit));
+ break;
+ case VIDRNDT_DS_EVR_CUSTOM:
+ m_transform.AddTail(DNew CFGFilterVideoRenderer(m_hWnd, CLSID_EVRAllocatorPresenter, L"Enhanced Video Renderer (custom presenter)", m_vrmerit));
+ break;
+ case VIDRNDT_DS_DXR:
+ m_transform.AddTail(DNew CFGFilterVideoRenderer(m_hWnd, CLSID_DXRAllocatorPresenter, L"Haali's Video Renderer", m_vrmerit));
+ break;
+ case VIDRNDT_DS_MADVR:
+ m_transform.AddTail(DNew CFGFilterVideoRenderer(m_hWnd, CLSID_madVRAllocatorPresenter, L"madVR Renderer", m_vrmerit));
+ //m_transform.AddTail(DNew CFGFilterVideoRenderer(m_hWnd, CLSID_madVR, L"Madshi Video Renderer", m_vrmerit));
+ break;
+ case VIDRNDT_DS_SYNC:
+ m_transform.AddTail(DNew CFGFilterVideoRenderer(m_hWnd, CLSID_SyncAllocatorPresenter, L"Sync Renderer", m_vrmerit));
+ break;
+ case VIDRNDT_DS_NULL_COMP:
+ pFGF = DNew CFGFilterInternal<CNullVideoRenderer>(L"Null Video Renderer (Any)", MERIT64_ABOVE_DSHOW+2);
+ pFGF->AddType(MEDIATYPE_Video, MEDIASUBTYPE_NULL);
+ m_transform.AddTail(pFGF);
+ break;
+ case VIDRNDT_DS_NULL_UNCOMP:
+ pFGF = DNew CFGFilterInternal<CNullUVideoRenderer>(L"Null Video Renderer (Uncompressed)", MERIT64_ABOVE_DSHOW+2);
+ pFGF->AddType(MEDIATYPE_Video, MEDIASUBTYPE_NULL);
+ m_transform.AddTail(pFGF);
+ break;
+ }
CString SelAudioRender = s.SelectedAudioRender();
if(SelAudioRender == AUDRNDT_NULL_COMP)
diff --git a/src/apps/mplayerc/FileVersionInfo.cpp b/src/apps/mplayerc/FileVersionInfo.cpp index 9d37d8e05..3f86fc512 100644 --- a/src/apps/mplayerc/FileVersionInfo.cpp +++ b/src/apps/mplayerc/FileVersionInfo.cpp @@ -158,16 +158,19 @@ BOOL CFileVersionInfo::Create(LPCTSTR lpszFileName) WORD CFileVersionInfo::GetFileVersion(int nIndex) const
{
- if (nIndex == 0)
- return (WORD)(m_FileInfo.dwFileVersionLS & 0x0000FFFF);
- else if (nIndex == 1)
- return (WORD)((m_FileInfo.dwFileVersionLS & 0xFFFF0000) >> 16);
- else if (nIndex == 2)
- return (WORD)(m_FileInfo.dwFileVersionMS & 0x0000FFFF);
- else if (nIndex == 3)
+ switch(nIndex)
+ {
+ case 0:
+ return (WORD)(m_FileInfo.dwFileVersionLS & 0x0000FFFF);
+ case 1:
+ return (WORD)((m_FileInfo.dwFileVersionLS & 0xFFFF0000) >> 16);
+ case 2:
+ return (WORD)(m_FileInfo.dwFileVersionMS & 0x0000FFFF);
+ case 3:
return (WORD)((m_FileInfo.dwFileVersionMS & 0xFFFF0000) >> 16);
- else
+ default:
return 0;
+ }
}
CString CFileVersionInfo::GetFileVersionEx() const
@@ -185,16 +188,19 @@ CString CFileVersionInfo::GetFileVersionEx() const WORD CFileVersionInfo::GetProductVersion(int nIndex) const
{
- if (nIndex == 0)
- return (WORD)(m_FileInfo.dwProductVersionLS & 0x0000FFFF);
- else if (nIndex == 1)
- return (WORD)((m_FileInfo.dwProductVersionLS & 0xFFFF0000) >> 16);
- else if (nIndex == 2)
- return (WORD)(m_FileInfo.dwProductVersionMS & 0x0000FFFF);
- else if (nIndex == 3)
- return (WORD)((m_FileInfo.dwProductVersionMS & 0xFFFF0000) >> 16);
- else
- return 0;
+ switch(nIndex)
+ {
+ case 0:
+ return (WORD)(m_FileInfo.dwProductVersionLS & 0x0000FFFF);
+ case 1:
+ return (WORD)((m_FileInfo.dwProductVersionLS & 0xFFFF0000) >> 16);
+ case 2:
+ return (WORD)(m_FileInfo.dwProductVersionMS & 0x0000FFFF);
+ case 3:
+ return (WORD)((m_FileInfo.dwProductVersionMS & 0xFFFF0000) >> 16);
+ default:
+ return 0;
+ }
}
diff --git a/src/apps/mplayerc/MainFrm.cpp b/src/apps/mplayerc/MainFrm.cpp index 793740ebe..236a623cb 100644 --- a/src/apps/mplayerc/MainFrm.cpp +++ b/src/apps/mplayerc/MainFrm.cpp @@ -2093,380 +2093,399 @@ bool CMainFrame::DoAfterPlaybackEvent() }
//
+// graph event EC_COMPLETE handler
+//
+bool CMainFrame::GraphEventComplete( )
+{
+ AppSettings& s = AfxGetAppSettings();
+ FILE_POSITION* FilePosition = s.CurrentFilePosition();
+ if (FilePosition) FilePosition->llPosition = 0;
+
+ if(m_wndPlaylistBar.GetCount() <= 1)
+ {
+ m_nLoops++;
+
+ if(DoAfterPlaybackEvent())
+ return false;
+
+ if(s.fLoopForever || m_nLoops < s.nLoops)
+ {
+ if(GetMediaState() == State_Stopped)
+ {
+ SendMessage(WM_COMMAND, ID_PLAY_PLAY);
+ }
+ else
+ {
+ LONGLONG pos = 0;
+ pMS->SetPositions(&pos, AM_SEEKING_AbsolutePositioning, NULL, AM_SEEKING_NoPositioning);
+
+ if(GetMediaState() == State_Paused)
+ {
+ SendMessage(WM_COMMAND, ID_PLAY_PLAY);
+ }
+ }
+ }
+ else
+ {
+ int NextMediaExist = false;
+ if (s.m_fNextInDirAfterPlayback)
+ {
+ NextMediaExist = SearchInDir(true);
+ }
+ if (!s.m_fNextInDirAfterPlayback || !(NextMediaExist>1))
+ {
+ if(s.fRewind)
+ SendMessage(WM_COMMAND, ID_PLAY_STOP);
+ else
+ {
+ m_fEndOfStream = true;
+ SendMessage(WM_COMMAND, ID_PLAY_PAUSE);
+ }
+ m_OSD.ClearMessage();
+
+ if(m_fFullScreen && s.fExitFullScreenAtTheEnd)
+ OnViewFullscreen();
+ }
+ if (s.m_fNextInDirAfterPlayback && !NextMediaExist)
+ {
+ m_OSD.DisplayMessage(OSD_TOPLEFT, ResStr(IDS_NO_MORE_MEDIA));
+ // Don't move it. Else OSD message "Pause" will rewrite this message.
+ }
+ }
+ }
+ else if(m_wndPlaylistBar.GetCount() > 1)
+ {
+ if(m_wndPlaylistBar.IsAtEnd())
+ {
+ if(DoAfterPlaybackEvent())
+ return false;
+
+ m_nLoops++;
+ }
+
+ if(s.fLoopForever || m_nLoops < s.nLoops)
+ {
+ int nLoops = m_nLoops;
+ PostMessage(WM_COMMAND, ID_NAVIGATE_SKIPFORWARD);
+ m_nLoops = nLoops;
+ }
+ else
+ {
+ if(m_fFullScreen && s.fExitFullScreenAtTheEnd)
+ OnViewFullscreen();
+
+ if(s.fRewind)
+ {
+ s.nCLSwitches |= CLSW_OPEN; // HACK
+ PostMessage(WM_COMMAND, ID_NAVIGATE_SKIPFORWARD);
+ }
+ else
+ {
+ m_fEndOfStream = true;
+ PostMessage(WM_COMMAND, ID_PLAY_PAUSE);
+ }
+ }
+ }
+ return true;
+}
+
+//
// our WM_GRAPHNOTIFY handler
//
#include <comdef.h>
LRESULT CMainFrame::OnGraphNotify(WPARAM wParam, LPARAM lParam)
{
- AppSettings& s = AfxGetAppSettings();
- HRESULT hr = S_OK;
-
- LONG evCode;
- LONG_PTR evParam1, evParam2;
- while(pME && SUCCEEDED(pME->GetEvent(&evCode, &evParam1, &evParam2, 0)))
- {
- TRACE("--> CMainFrame::OnGraphNotify on thread: %d; event: %x\n", GetCurrentThreadId(), evCode);
- CString str;
-
- if(m_fCustomGraph)
- {
- if(EC_BG_ERROR == evCode)
- {
- str = CString((char*)evParam1);
- }
- }
-
- if (!m_fFrameSteppingActive) m_nStepForwardCount = 0;
-
- hr = pME->FreeEventParams(evCode, evParam1, evParam2);
-
- if(EC_COMPLETE == evCode)
- {
- FILE_POSITION* FilePosition = s.CurrentFilePosition();
- if (FilePosition) FilePosition->llPosition = 0;
-
- if(m_wndPlaylistBar.GetCount() <= 1)
- {
- m_nLoops++;
-
- if(DoAfterPlaybackEvent()) return hr;
-
- if(s.fLoopForever || m_nLoops < s.nLoops)
- {
- if(GetMediaState() == State_Stopped)
- {
- SendMessage(WM_COMMAND, ID_PLAY_PLAY);
- }
- else
- {
- LONGLONG pos = 0;
- pMS->SetPositions(&pos, AM_SEEKING_AbsolutePositioning, NULL, AM_SEEKING_NoPositioning);
-
- if(GetMediaState() == State_Paused)
- {
- SendMessage(WM_COMMAND, ID_PLAY_PLAY);
- }
- }
- }
- else
- {
- int NextMediaExist = false;
- if (s.m_fNextInDirAfterPlayback)
- {
- NextMediaExist = SearchInDir(true);
- }
- if (!s.m_fNextInDirAfterPlayback || !(NextMediaExist>1))
- {
- if(s.fRewind) SendMessage(WM_COMMAND, ID_PLAY_STOP);
- else
- {
- m_fEndOfStream = true;
- SendMessage(WM_COMMAND, ID_PLAY_PAUSE);
- }
- m_OSD.ClearMessage();
-
- if(m_fFullScreen && s.fExitFullScreenAtTheEnd)
- OnViewFullscreen();
- }
- if (s.m_fNextInDirAfterPlayback && !NextMediaExist)
- {
- m_OSD.DisplayMessage(OSD_TOPLEFT, ResStr(IDS_NO_MORE_MEDIA));
- // Don't move it. Else OSD message "Pause" will rewrite this message.
- }
- }
- }
- else if(m_wndPlaylistBar.GetCount() > 1)
- {
- if(m_wndPlaylistBar.IsAtEnd())
- {
- if(DoAfterPlaybackEvent()) return hr;
-
- m_nLoops++;
- }
-
- if(s.fLoopForever || m_nLoops < s.nLoops)
- {
- int nLoops = m_nLoops;
- PostMessage(WM_COMMAND, ID_NAVIGATE_SKIPFORWARD);
- m_nLoops = nLoops;
- }
- else
- {
- if(m_fFullScreen && s.fExitFullScreenAtTheEnd)
- OnViewFullscreen();
-
- if(s.fRewind)
- {
- s.nCLSwitches |= CLSW_OPEN; // HACK
- PostMessage(WM_COMMAND, ID_NAVIGATE_SKIPFORWARD);
- }
- else
- {
- m_fEndOfStream = true;
- PostMessage(WM_COMMAND, ID_PLAY_PAUSE);
- }
- }
- }
- }
- else if(EC_ERRORABORT == evCode)
- {
- TRACE(_T("EC_ERRORABORT, hr = %08x\n"), (HRESULT)evParam1);
-// SendMessage(WM_COMMAND, ID_FILE_CLOSEMEDIA);
-// m_closingmsg = _com_error((HRESULT)evParam1).ErrorMessage();
- }
- else if(EC_REPAINT == evCode)
- {
- TRACE(_T("EC_REPAINT\n"));
- }
- else if(EC_BUFFERING_DATA == evCode)
- {
- TRACE(_T("EC_BUFFERING_DATA, %d, %d\n"), (HRESULT)evParam1, evParam2);
-
- m_fBuffering = ((HRESULT)evParam1 != S_OK);
- }
- else if(EC_STEP_COMPLETE == evCode)
- {
- if(m_fFrameSteppingActive)
- {
- m_nStepForwardCount++;
- m_fFrameSteppingActive = false;
- pBA->put_Volume(m_VolumeBeforeFrameStepping);
- }
- }
- else if(EC_DEVICE_LOST == evCode)
- {
- CComQIPtr<IBaseFilter> pBF;
- if(GetPlaybackMode() == PM_CAPTURE
- && (!pVidCap && pVidCap == (pBF = (IUnknown*)evParam1)
- || !pAudCap && pAudCap == (pBF = (IUnknown*)evParam1))
- && evParam2 == 0)
- {
- SendMessage(WM_COMMAND, ID_FILE_CLOSEMEDIA);
- }
- }
- else if(EC_DVD_TITLE_CHANGE == evCode)
- {
- // Casimir666 : Mémoriser le chapitre en cours
- DVD_POSITION* DvdPos = s.CurrentDVDPosition();
- if (DvdPos) DvdPos->lTitle = (DWORD)evParam1;
-
- if(GetPlaybackMode() == PM_FILE)
- {
- SetupChapters();
- }
- else if(GetPlaybackMode() == PM_DVD)
- {
- m_iDVDTitle = (DWORD)evParam1;
-
- if(m_iDVDDomain == DVD_DOMAIN_Title)
- {
- CString Domain;
- Domain.Format(ResStr(IDS_AG_TITLE), m_iDVDTitle);
- m_wndInfoBar.SetLine(ResStr(IDS_INFOBAR_DOMAIN), Domain);
- }
- }
- }
- else if(EC_DVD_DOMAIN_CHANGE == evCode)
- {
- m_iDVDDomain = (DVD_DOMAIN)evParam1;
-
- CString Domain('-');
-
- switch(m_iDVDDomain)
- {
- case DVD_DOMAIN_FirstPlay:
- ULONGLONG llDVDGuid;
-
- if (pDVDI && SUCCEEDED (pDVDI->GetDiscID (NULL, &llDVDGuid)))
- {
- if (s.lDVDTitle != 0)
- {
- s.NewDvd (llDVDGuid);
- // Set command line position
- pDVDC->PlayTitle(s.lDVDTitle, DVD_CMD_FLAG_Block|DVD_CMD_FLAG_Flush, NULL);
- if (s.lDVDChapter > 1)
- pDVDC->PlayChapterInTitle(s.lDVDTitle, s.lDVDChapter, DVD_CMD_FLAG_Block|DVD_CMD_FLAG_Flush, NULL);
- else
- {
- // Trick : skip trailers with somes DVDs
- pDVDC->Resume(DVD_CMD_FLAG_Block|DVD_CMD_FLAG_Flush, NULL);
- pDVDC->PlayAtTime(&s.DVDPosition, DVD_CMD_FLAG_Flush, NULL);
- }
-
- m_iDVDTitle = s.lDVDTitle;
- s.lDVDTitle = 0;
- s.lDVDChapter = 0;
- }
- else if (!s.NewDvd (llDVDGuid) && s.fRememberDVDPos)
- {
- // Set last remembered position (if founded...)
- DVD_POSITION* DvdPos = s.CurrentDVDPosition();
-
- pDVDC->PlayTitle(DvdPos->lTitle, DVD_CMD_FLAG_Block|DVD_CMD_FLAG_Flush, NULL);
- pDVDC->Resume(DVD_CMD_FLAG_Block|DVD_CMD_FLAG_Flush, NULL);
- if (SUCCEEDED (hr = pDVDC->PlayAtTime (&DvdPos->Timecode, DVD_CMD_FLAG_Flush, NULL)))
- {
- m_iDVDTitle = DvdPos->lTitle;
- }
- }
- }
- Domain = _T("First Play");
- break;
- case DVD_DOMAIN_VideoManagerMenu:
- Domain = _T("Video Manager Menu");
- break;
- case DVD_DOMAIN_VideoTitleSetMenu:
- Domain = _T("Video Title Set Menu");
- break;
- case DVD_DOMAIN_Title:
- Domain.Format(ResStr(IDS_AG_TITLE), m_iDVDTitle);
- DVD_POSITION* DvdPos;
- DvdPos = s.CurrentDVDPosition();
- if (DvdPos)
- DvdPos->lTitle = m_iDVDTitle;
- break;
- case DVD_DOMAIN_Stop:
- Domain = ResStr(IDS_AG_STOP);
- break;
- default:
- Domain = _T("-");
- break;
- }
-
- m_wndInfoBar.SetLine(ResStr(IDS_INFOBAR_DOMAIN), Domain);
-
- MoveVideoWindow(); // AR might have changed
- }
- else if(EC_DVD_CURRENT_HMSF_TIME == evCode)
- {
- double fps = evParam2 == DVD_TC_FLAG_25fps ? 25.0
- : evParam2 == DVD_TC_FLAG_30fps ? 30.0
- : evParam2 == DVD_TC_FLAG_DropFrame ? 29.97
- : 25.0;
-
- REFERENCE_TIME rtDur = 0;
-
- DVD_HMSF_TIMECODE tcDur;
- ULONG ulFlags;
- if(SUCCEEDED(pDVDI->GetTotalTitleTime(&tcDur, &ulFlags)))
- rtDur = HMSF2RT(tcDur, fps);
-
- g_bNoDuration = rtDur <= 0;
- m_wndSeekBar.Enable(rtDur > 0);
- m_wndSeekBar.SetRange(0, rtDur);
- m_OSD.SetRange (0, rtDur);
- m_Lcd.SetMediaRange(0, rtDur);
-
- REFERENCE_TIME rtNow = HMSF2RT(*((DVD_HMSF_TIMECODE*)&evParam1), fps);
-
- // Casimir666 : Mémoriser le timecode courant dans le chapitre
- DVD_POSITION* DvdPos = s.CurrentDVDPosition();
- if (DvdPos)
- memcpy (&DvdPos->Timecode, (void*)&evParam1, sizeof(DVD_HMSF_TIMECODE));
-
- m_wndSeekBar.SetPos(rtNow);
- m_OSD.SetPos(rtNow);
- m_Lcd.SetMediaPos(rtNow);
-
- if(m_pSubClock) m_pSubClock->SetTime(rtNow);
- }
- else if(EC_DVD_ERROR == evCode)
- {
- TRACE(_T("EC_DVD_ERROR %d %d\n"), evParam1, evParam2);
-
- CString err;
-
- switch(evParam1)
- {
- case DVD_ERROR_Unexpected:
- default:
- err = ResStr(IDS_MAINFRM_16);
- break;
- case DVD_ERROR_CopyProtectFail:
- err = ResStr(IDS_MAINFRM_17);
- break;
- case DVD_ERROR_InvalidDVD1_0Disc:
- err = ResStr(IDS_MAINFRM_18);
- break;
- case DVD_ERROR_InvalidDiscRegion:
- err = ResStr(IDS_MAINFRM_19);
- break;
- case DVD_ERROR_LowParentalLevel:
- err = ResStr(IDS_MAINFRM_20);
- break;
- case DVD_ERROR_MacrovisionFail:
- err = ResStr(IDS_MAINFRM_21);
- break;
- case DVD_ERROR_IncompatibleSystemAndDecoderRegions:
- err = ResStr(IDS_MAINFRM_22);
- break;
- case DVD_ERROR_IncompatibleDiscAndDecoderRegions:
- err = ResStr(IDS_MAINFRM_23);
- break;
- }
-
- SendMessage(WM_COMMAND, ID_FILE_CLOSEMEDIA);
-
- m_closingmsg = err;
- }
- else if(EC_DVD_WARNING == evCode)
- {
- TRACE(_T("EC_DVD_WARNING %d %d\n"), evParam1, evParam2);
- }
- else if(EC_VIDEO_SIZE_CHANGED == evCode)
- {
- TRACE(_T("EC_VIDEO_SIZE_CHANGED %dx%d\n"), CSize(evParam1));
-
- WINDOWPLACEMENT wp;
- wp.length = sizeof(wp);
- GetWindowPlacement(&wp);
-
- CSize size(evParam1);
- m_fAudioOnly = (size.cx <= 0 || size.cy <= 0);
-
- if(s.fRememberZoomLevel
- && !(m_fFullScreen || wp.showCmd == SW_SHOWMAXIMIZED || wp.showCmd == SW_SHOWMINIMIZED))
- {
- ZoomVideoWindow();
- }
- else
- {
- MoveVideoWindow();
- }
- }
- else if(EC_LENGTH_CHANGED == evCode)
- {
- __int64 rtDur = 0;
- pMS->GetDuration(&rtDur);
- m_wndPlaylistBar.SetCurTime(rtDur);
- }
- else if(!m_fCustomGraph)
- {
- //TRACE(_T("evCode: %d\n"), evCode);
- }
- else if(EC_BG_AUDIO_CHANGED == evCode)
- {
- int nAudioChannels = evParam1;
-
- m_wndStatusBar.SetStatusBitmap(nAudioChannels == 1 ? IDB_MONO
- : nAudioChannels >= 2 ? IDB_STEREO
- : IDB_NOAUDIO);
- }
- else if(EC_BG_ERROR == evCode)
- {
- SendMessage(WM_COMMAND, ID_FILE_CLOSEMEDIA);
- m_closingmsg = !str.IsEmpty() ? str : _T("Unspecified graph error");
- m_wndPlaylistBar.SetCurValid(false);
- break;
- }
- else if(EC_DVD_PLAYBACK_RATE_CHANGE == evCode)
- {
- if(AfxGetAppSettings().AutoChangeFullscrRes.bEnabled && m_fFullScreen
- && m_iDVDDomain == DVD_DOMAIN_Title) AutoChangeMonitorMode();
- }
- }
-
- return hr;
+ AppSettings& s = AfxGetAppSettings();
+ HRESULT hr = S_OK;
+
+ LONG evCode;
+ LONG_PTR evParam1, evParam2;
+ while(pME && SUCCEEDED(pME->GetEvent(&evCode, &evParam1, &evParam2, 0)))
+ {
+ TRACE("--> CMainFrame::OnGraphNotify on thread: %d; event: %x\n", GetCurrentThreadId(), evCode);
+ CString str;
+
+ if(m_fCustomGraph)
+ {
+ if(EC_BG_ERROR == evCode)
+ {
+ str = CString((char*)evParam1);
+ }
+ }
+
+ if (!m_fFrameSteppingActive) m_nStepForwardCount = 0;
+
+ hr = pME->FreeEventParams(evCode, evParam1, evParam2);
+
+ switch(evCode)
+ {
+ case EC_COMPLETE:
+ if (!GraphEventComplete())
+ return hr;
+ break;
+ case EC_ERRORABORT:
+ {
+ TRACE(_T("EC_ERRORABORT, hr = %08x\n"), (HRESULT)evParam1);
+ // SendMessage(WM_COMMAND, ID_FILE_CLOSEMEDIA);
+ // m_closingmsg = _com_error((HRESULT)evParam1).ErrorMessage();
+ }
+ break;
+ case EC_REPAINT:
+ TRACE(_T("EC_REPAINT\n"));
+ break;
+ case EC_BUFFERING_DATA:
+ TRACE(_T("EC_BUFFERING_DATA, %d, %d\n"), (HRESULT)evParam1, evParam2);
+
+ m_fBuffering = ((HRESULT)evParam1 != S_OK);
+ break;
+ case EC_STEP_COMPLETE:
+ if(m_fFrameSteppingActive)
+ {
+ m_nStepForwardCount++;
+ m_fFrameSteppingActive = false;
+ pBA->put_Volume(m_VolumeBeforeFrameStepping);
+ }
+ break;
+ case EC_DEVICE_LOST:
+ if(GetPlaybackMode() == PM_CAPTURE && evParam2 == 0)
+ {
+ CComQIPtr<IBaseFilter> pBF = (IUnknown*)evParam1;
+ if (!pVidCap && pVidCap == pBF || !pAudCap && pAudCap == pBF)
+ SendMessage(WM_COMMAND, ID_FILE_CLOSEMEDIA);
+ }
+ break;
+ case EC_DVD_TITLE_CHANGE:
+ {
+ // Casimir666 : Mémoriser le chapitre en cours
+ DVD_POSITION* DvdPos = s.CurrentDVDPosition();
+ if (DvdPos) DvdPos->lTitle = (DWORD)evParam1;
+
+ if(GetPlaybackMode() == PM_FILE)
+ {
+ SetupChapters();
+ }
+ else if(GetPlaybackMode() == PM_DVD)
+ {
+ m_iDVDTitle = (DWORD)evParam1;
+
+ if(m_iDVDDomain == DVD_DOMAIN_Title)
+ {
+ CString Domain;
+ Domain.Format(ResStr(IDS_AG_TITLE), m_iDVDTitle);
+ m_wndInfoBar.SetLine(ResStr(IDS_INFOBAR_DOMAIN), Domain);
+ }
+ }
+ }
+ break;
+ case EC_DVD_DOMAIN_CHANGE:
+ {
+ m_iDVDDomain = (DVD_DOMAIN)evParam1;
+
+ CString Domain('-');
+
+ switch(m_iDVDDomain)
+ {
+ case DVD_DOMAIN_FirstPlay:
+ ULONGLONG llDVDGuid;
+
+ if (pDVDI && SUCCEEDED (pDVDI->GetDiscID (NULL, &llDVDGuid)))
+ {
+ if (s.lDVDTitle != 0)
+ {
+ s.NewDvd (llDVDGuid);
+ // Set command line position
+ pDVDC->PlayTitle(s.lDVDTitle, DVD_CMD_FLAG_Block|DVD_CMD_FLAG_Flush, NULL);
+ if (s.lDVDChapter > 1)
+ pDVDC->PlayChapterInTitle(s.lDVDTitle, s.lDVDChapter, DVD_CMD_FLAG_Block|DVD_CMD_FLAG_Flush, NULL);
+ else
+ {
+ // Trick : skip trailers with somes DVDs
+ pDVDC->Resume(DVD_CMD_FLAG_Block|DVD_CMD_FLAG_Flush, NULL);
+ pDVDC->PlayAtTime(&s.DVDPosition, DVD_CMD_FLAG_Flush, NULL);
+ }
+
+ m_iDVDTitle = s.lDVDTitle;
+ s.lDVDTitle = 0;
+ s.lDVDChapter = 0;
+ }
+ else if (!s.NewDvd (llDVDGuid) && s.fRememberDVDPos)
+ {
+ // Set last remembered position (if founded...)
+ DVD_POSITION* DvdPos = s.CurrentDVDPosition();
+
+ pDVDC->PlayTitle(DvdPos->lTitle, DVD_CMD_FLAG_Block|DVD_CMD_FLAG_Flush, NULL);
+ pDVDC->Resume(DVD_CMD_FLAG_Block|DVD_CMD_FLAG_Flush, NULL);
+ if (SUCCEEDED (hr = pDVDC->PlayAtTime (&DvdPos->Timecode, DVD_CMD_FLAG_Flush, NULL)))
+ {
+ m_iDVDTitle = DvdPos->lTitle;
+ }
+ }
+ }
+ Domain = _T("First Play");
+ break;
+ case DVD_DOMAIN_VideoManagerMenu:
+ Domain = _T("Video Manager Menu");
+ break;
+ case DVD_DOMAIN_VideoTitleSetMenu:
+ Domain = _T("Video Title Set Menu");
+ break;
+ case DVD_DOMAIN_Title:
+ Domain.Format(ResStr(IDS_AG_TITLE), m_iDVDTitle);
+ DVD_POSITION* DvdPos;
+ DvdPos = s.CurrentDVDPosition();
+ if (DvdPos)
+ DvdPos->lTitle = m_iDVDTitle;
+ break;
+ case DVD_DOMAIN_Stop:
+ Domain = ResStr(IDS_AG_STOP);
+ break;
+ default:
+ Domain = _T("-");
+ break;
+ }
+
+ m_wndInfoBar.SetLine(ResStr(IDS_INFOBAR_DOMAIN), Domain);
+
+ MoveVideoWindow(); // AR might have changed
+ }
+ break;
+ case EC_DVD_CURRENT_HMSF_TIME:
+ {
+ double fps = evParam2 == DVD_TC_FLAG_25fps ? 25.0
+ : evParam2 == DVD_TC_FLAG_30fps ? 30.0
+ : evParam2 == DVD_TC_FLAG_DropFrame ? 29.97
+ : 25.0;
+
+ REFERENCE_TIME rtDur = 0;
+
+ DVD_HMSF_TIMECODE tcDur;
+ ULONG ulFlags;
+ if(SUCCEEDED(pDVDI->GetTotalTitleTime(&tcDur, &ulFlags)))
+ rtDur = HMSF2RT(tcDur, fps);
+
+ g_bNoDuration = rtDur <= 0;
+ m_wndSeekBar.Enable(rtDur > 0);
+ m_wndSeekBar.SetRange(0, rtDur);
+ m_OSD.SetRange (0, rtDur);
+ m_Lcd.SetMediaRange(0, rtDur);
+
+ REFERENCE_TIME rtNow = HMSF2RT(*((DVD_HMSF_TIMECODE*)&evParam1), fps);
+
+ // Casimir666 : Mémoriser le timecode courant dans le chapitre
+ DVD_POSITION* DvdPos = s.CurrentDVDPosition();
+ if (DvdPos)
+ memcpy (&DvdPos->Timecode, (void*)&evParam1, sizeof(DVD_HMSF_TIMECODE));
+
+ m_wndSeekBar.SetPos(rtNow);
+ m_OSD.SetPos(rtNow);
+ m_Lcd.SetMediaPos(rtNow);
+
+ if(m_pSubClock) m_pSubClock->SetTime(rtNow);
+ }
+ break;
+ case EC_DVD_ERROR:
+ {
+ TRACE(_T("EC_DVD_ERROR %d %d\n"), evParam1, evParam2);
+
+ CString err;
+
+ switch(evParam1)
+ {
+ case DVD_ERROR_Unexpected:
+ default:
+ err = ResStr(IDS_MAINFRM_16);
+ break;
+ case DVD_ERROR_CopyProtectFail:
+ err = ResStr(IDS_MAINFRM_17);
+ break;
+ case DVD_ERROR_InvalidDVD1_0Disc:
+ err = ResStr(IDS_MAINFRM_18);
+ break;
+ case DVD_ERROR_InvalidDiscRegion:
+ err = ResStr(IDS_MAINFRM_19);
+ break;
+ case DVD_ERROR_LowParentalLevel:
+ err = ResStr(IDS_MAINFRM_20);
+ break;
+ case DVD_ERROR_MacrovisionFail:
+ err = ResStr(IDS_MAINFRM_21);
+ break;
+ case DVD_ERROR_IncompatibleSystemAndDecoderRegions:
+ err = ResStr(IDS_MAINFRM_22);
+ break;
+ case DVD_ERROR_IncompatibleDiscAndDecoderRegions:
+ err = ResStr(IDS_MAINFRM_23);
+ break;
+ }
+
+ SendMessage(WM_COMMAND, ID_FILE_CLOSEMEDIA);
+
+ m_closingmsg = err;
+ }
+ break;
+ case EC_DVD_WARNING:
+ TRACE(_T("EC_DVD_WARNING %d %d\n"), evParam1, evParam2);
+ break;
+ case EC_VIDEO_SIZE_CHANGED:
+ {
+ TRACE(_T("EC_VIDEO_SIZE_CHANGED %dx%d\n"), CSize(evParam1));
+
+ WINDOWPLACEMENT wp;
+ wp.length = sizeof(wp);
+ GetWindowPlacement(&wp);
+
+ CSize size(evParam1);
+ m_fAudioOnly = (size.cx <= 0 || size.cy <= 0);
+
+ if(s.fRememberZoomLevel
+ && !(m_fFullScreen || wp.showCmd == SW_SHOWMAXIMIZED || wp.showCmd == SW_SHOWMINIMIZED))
+ {
+ ZoomVideoWindow();
+ }
+ else
+ {
+ MoveVideoWindow();
+ }
+ }
+ break;
+ case EC_LENGTH_CHANGED:
+ {
+ __int64 rtDur = 0;
+ pMS->GetDuration(&rtDur);
+ m_wndPlaylistBar.SetCurTime(rtDur);
+ }
+ break;
+ case EC_BG_AUDIO_CHANGED:
+ if(m_fCustomGraph)
+ {
+ int nAudioChannels = evParam1;
+
+ m_wndStatusBar.SetStatusBitmap(nAudioChannels == 1 ? IDB_MONO
+ : nAudioChannels >= 2 ? IDB_STEREO
+ : IDB_NOAUDIO);
+ }
+ break;
+ case EC_BG_ERROR:
+ if(m_fCustomGraph)
+ {
+ SendMessage(WM_COMMAND, ID_FILE_CLOSEMEDIA);
+ m_closingmsg = !str.IsEmpty() ? str : _T("Unspecified graph error");
+ m_wndPlaylistBar.SetCurValid(false);
+ return hr;
+ }
+ break;
+ case EC_DVD_PLAYBACK_RATE_CHANGE:
+ if(m_fCustomGraph && s.AutoChangeFullscrRes.bEnabled &&
+ m_fFullScreen && m_iDVDDomain == DVD_DOMAIN_Title)
+ AutoChangeMonitorMode();
+ break;
+ default:
+ //TRACE(_T("evCode: %d\n"), evCode);
+ break;
+ }
+ }
+
+ return hr;
}
LRESULT CMainFrame::OnRepaintRenderLess(WPARAM wParam, LPARAM lParam)
@@ -7077,37 +7096,36 @@ void CMainFrame::OnUpdatePlayShaders(CCmdUI* pCmdUI) else
pCmdUI->Enable(!!m_pCAP);
- if(pCmdUI->m_nID == ID_SHADERS_OFF)
- {
- pCmdUI->SetRadio(m_shaderlabels.IsEmpty());
- }
- else if(pCmdUI->m_nID == ID_SHADERS_OFFSCR)
- {
- pCmdUI->SetRadio(m_shaderlabelsScreenSpace.IsEmpty());
- }
- else if(pCmdUI->m_nID == ID_SHADERS_COMBINE)
- {
- pCmdUI->SetRadio(m_shaderlabels.GetCount() > 1);
- }
- else if(pCmdUI->m_nID == ID_SHADERS_COMBINESCR)
- {
- pCmdUI->SetRadio(m_shaderlabelsScreenSpace.GetCount() > 0);
- }
- else if(pCmdUI->m_nID == ID_SHADERS_EDIT)
- {
- pCmdUI->Enable(TRUE);
- }
- else
- {
- MENUITEMINFO mii;
- memset(&mii, 0, sizeof(mii));
- mii.cbSize = sizeof(mii);
- mii.fMask = MIIM_DATA;
- m_shaders.GetMenuItemInfo(pCmdUI->m_nID, &mii);
-
- pCmdUI->SetRadio(m_shaderlabels.GetCount() == 1
- && m_shaderlabels.GetHead() == ((AppSettings::Shader*)mii.dwItemData)->label);
- }
+ switch(pCmdUI->m_nID)
+ {
+ case ID_SHADERS_OFF:
+ pCmdUI->SetRadio(m_shaderlabels.IsEmpty());
+ break;
+ case ID_SHADERS_OFFSCR:
+ pCmdUI->SetRadio(m_shaderlabelsScreenSpace.IsEmpty());
+ break;
+ case ID_SHADERS_COMBINE:
+ pCmdUI->SetRadio(m_shaderlabels.GetCount() > 1);
+ break;
+ case ID_SHADERS_COMBINESCR:
+ pCmdUI->SetRadio(m_shaderlabelsScreenSpace.GetCount() > 0);
+ break;
+ case ID_SHADERS_EDIT:
+ pCmdUI->Enable(TRUE);
+ break;
+ default:
+ {
+ MENUITEMINFO mii;
+ memset(&mii, 0, sizeof(mii));
+ mii.cbSize = sizeof(mii);
+ mii.fMask = MIIM_DATA;
+ m_shaders.GetMenuItemInfo(pCmdUI->m_nID, &mii);
+
+ pCmdUI->SetRadio(m_shaderlabels.GetCount() == 1
+ && m_shaderlabels.GetHead() == ((AppSettings::Shader*)mii.dwItemData)->label);
+ }
+ break;
+ }
}
}
@@ -7503,22 +7521,27 @@ void CMainFrame::OnNavigateSkip(UINT nID) }
}
- if((nID == ID_NAVIGATE_SKIPBACK) && (m_wndPlaylistBar.GetCount() != 1))
- {
- SendMessage(WM_COMMAND, ID_NAVIGATE_SKIPBACKPLITEM);
- }
- else if((nID == ID_NAVIGATE_SKIPFORWARD) && (m_wndPlaylistBar.GetCount() != 1))
- {
- SendMessage(WM_COMMAND, ID_NAVIGATE_SKIPFORWARDPLITEM);
- }
- else if((nID == ID_NAVIGATE_SKIPBACK) && (m_wndPlaylistBar.GetCount() == 1) && !AfxGetAppSettings().m_fDontUseSearchInFolder)
- {
- if (!SearchInDir(false)) m_OSD.DisplayMessage(OSD_TOPLEFT, ResStr(IDS_FIRST_IN_FOLDER));
- }
- else if((nID == ID_NAVIGATE_SKIPFORWARD) && (m_wndPlaylistBar.GetCount() == 1) && !AfxGetAppSettings().m_fDontUseSearchInFolder)
- {
- if (!SearchInDir(true)) m_OSD.DisplayMessage(OSD_TOPLEFT, ResStr(IDS_LAST_IN_FOLDER));
- }
+
+ if(m_wndPlaylistBar.GetCount() != 1)
+ {
+ if(nID == ID_NAVIGATE_SKIPBACK)
+ SendMessage(WM_COMMAND, ID_NAVIGATE_SKIPBACKPLITEM);
+ else if(nID == ID_NAVIGATE_SKIPFORWARD)
+ SendMessage(WM_COMMAND, ID_NAVIGATE_SKIPFORWARDPLITEM);
+ }
+ else if ((m_wndPlaylistBar.GetCount() == 1) && !AfxGetAppSettings().m_fDontUseSearchInFolder)
+ {
+ if(nID == ID_NAVIGATE_SKIPBACK)
+ {
+ if (!SearchInDir(false))
+ m_OSD.DisplayMessage(OSD_TOPLEFT, ResStr(IDS_FIRST_IN_FOLDER));
+ }
+ else if(nID == ID_NAVIGATE_SKIPFORWARD)
+ {
+ if (!SearchInDir(true))
+ m_OSD.DisplayMessage(OSD_TOPLEFT, ResStr(IDS_LAST_IN_FOLDER));
+ }
+ }
}
else if(GetPlaybackMode() == PM_DVD)
{
@@ -9702,7 +9725,7 @@ void CMainFrame::OpenDVD(OpenDVDData* pODD) if((pDVDC = pBF) && (pDVDI = pBF))
break;
}
- EndEnumFilters
+ EndEnumFilters;
if(hr == E_INVALIDARG)
throw ResStr(IDS_MAINFRM_93);
diff --git a/src/apps/mplayerc/MainFrm.h b/src/apps/mplayerc/MainFrm.h index f1bf30580..c45f6e272 100644 --- a/src/apps/mplayerc/MainFrm.h +++ b/src/apps/mplayerc/MainFrm.h @@ -428,7 +428,9 @@ protected: // void OpenSetupToolBar();
void OpenSetupCaptureBar();
void OpenSetupWindowTitle(CString fn = _T(""));
- void AutoChangeMonitorMode();
+ void AutoChangeMonitorMode();
+
+ bool GraphEventComplete();
friend class CGraphThread;
CGraphThread* m_pGraphThread;
@@ -442,7 +444,7 @@ public: void OpenMedia(CAutoPtr<OpenMediaData> pOMD);
void CloseMedia();
void StartTunerScan(CAutoPtr<TunerScanData> pTSD);
- void StopTunerScan();
+ void StopTunerScan();
void AddCurDevToPlaylist();
@@ -575,7 +577,7 @@ public: afx_msg void OnTimer(UINT_PTR nIDEvent);
afx_msg LRESULT OnGraphNotify(WPARAM wParam, LPARAM lParam);
- afx_msg LRESULT OnRepaintRenderLess(WPARAM wParam, LPARAM lParam);
+ afx_msg LRESULT OnRepaintRenderLess(WPARAM wParam, LPARAM lParam);
afx_msg LRESULT OnResumeFromState(WPARAM wParam, LPARAM lParam);
BOOL OnButton(UINT id, UINT nFlags, CPoint point);
diff --git a/src/apps/mplayerc/PPageAccelTbl.cpp b/src/apps/mplayerc/PPageAccelTbl.cpp index e02651c0f..752801522 100644 --- a/src/apps/mplayerc/PPageAccelTbl.cpp +++ b/src/apps/mplayerc/PPageAccelTbl.cpp @@ -1445,88 +1445,76 @@ void CPPageAccelTbl::OnDolabeleditList(NMHDR* pNMHDR, LRESULT* pResult) LV_DISPINFO* pDispInfo = (LV_DISPINFO*)pNMHDR;
LV_ITEM* pItem = &pDispInfo->item;
- *pResult = FALSE;
-
if(pItem->iItem < 0)
- return;
+ {
+ *pResult = FALSE;
+ return;
+ }
+
+ *pResult = TRUE;
wmcmd& wc = m_wmcmds.GetAt((POSITION)m_list.GetItemData(pItem->iItem));
ACCEL& a = wc;
CAtlList<CString> sl;
- int nSel = -1;
-
- if(pItem->iSubItem == COL_MOD)
- {
- for(int i = 0; i < countof(s_mods); i++)
- {
- sl.AddTail(MakeAccelModLabel(s_mods[i]));
- if((a.fVirt&~3) == s_mods[i]) nSel = i;
- }
-
- m_list.ShowInPlaceComboBox(pItem->iItem, pItem->iSubItem, sl, nSel);
-
- *pResult = TRUE;
- }
- else if(pItem->iSubItem == COL_KEY)
- {
- for(int i = 0; i < 256; i++)
- {
- sl.AddTail(MakeAccelVkeyLabel(i, a.fVirt&FVIRTKEY));
- if(a.key == i) nSel = i;
- }
-
- m_list.ShowInPlaceComboBox(pItem->iItem, pItem->iSubItem, sl, nSel);
-
- *pResult = TRUE;
- }
- else if(pItem->iSubItem == COL_TYPE)
- {
- sl.AddTail(_T("VIRTKEY"));
- sl.AddTail(_T("ASCII"));
-
- nSel = !(a.fVirt&FVIRTKEY);
-
- m_list.ShowInPlaceComboBox(pItem->iItem, pItem->iSubItem, sl, nSel);
-
- *pResult = TRUE;
- }
- else if(pItem->iSubItem == COL_MOUSE)
- {
- for(UINT i = 0; i < wmcmd::LAST; i++)
- {
- sl.AddTail(MakeMouseButtonLabel(i));
- if(wc.mouse == i) nSel = i;
- }
-
- m_list.ShowInPlaceComboBox(pItem->iItem, pItem->iSubItem, sl, nSel);
-
- *pResult = TRUE;
- }
- else if(pItem->iSubItem == COL_APPCMD)
- {
- for(int i = 0; i < countof(g_CommandList); i++)
- {
- sl.AddTail(g_CommandList[i].cmdname);
- if(wc.appcmd == g_CommandList[i].appcmd) nSel = i;
- }
-
- m_list.ShowInPlaceComboBox(pItem->iItem, pItem->iSubItem, sl, nSel);
-
- *pResult = TRUE;
- }
- else if(pItem->iSubItem == COL_RMCMD)
- {
- m_list.ShowInPlaceEdit(pItem->iItem, pItem->iSubItem);
-
- *pResult = TRUE;
- }
- else if(pItem->iSubItem == COL_RMREPCNT)
- {
- m_list.ShowInPlaceEdit(pItem->iItem, pItem->iSubItem);
-
- *pResult = TRUE;
- }
+ int nSel = -1;
+
+ switch(pItem->iSubItem)
+ {
+ case COL_MOD:
+ for(int i = 0; i < countof(s_mods); i++)
+ {
+ sl.AddTail(MakeAccelModLabel(s_mods[i]));
+ if((a.fVirt&~3) == s_mods[i]) nSel = i;
+ }
+
+ m_list.ShowInPlaceComboBox(pItem->iItem, pItem->iSubItem, sl, nSel);
+ break;
+ case COL_KEY:
+ for(int i = 0; i < 256; i++)
+ {
+ sl.AddTail(MakeAccelVkeyLabel(i, a.fVirt&FVIRTKEY));
+ if(a.key == i) nSel = i;
+ }
+
+ m_list.ShowInPlaceComboBox(pItem->iItem, pItem->iSubItem, sl, nSel);
+ break;
+ case COL_TYPE:
+ sl.AddTail(_T("VIRTKEY"));
+ sl.AddTail(_T("ASCII"));
+
+ nSel = !(a.fVirt&FVIRTKEY);
+
+ m_list.ShowInPlaceComboBox(pItem->iItem, pItem->iSubItem, sl, nSel);
+ break;
+ case COL_MOUSE:
+ for(UINT i = 0; i < wmcmd::LAST; i++)
+ {
+ sl.AddTail(MakeMouseButtonLabel(i));
+ if(wc.mouse == i) nSel = i;
+ }
+
+ m_list.ShowInPlaceComboBox(pItem->iItem, pItem->iSubItem, sl, nSel);
+ break;
+ case COL_APPCMD:
+ for(int i = 0; i < countof(g_CommandList); i++)
+ {
+ sl.AddTail(g_CommandList[i].cmdname);
+ if(wc.appcmd == g_CommandList[i].appcmd) nSel = i;
+ }
+
+ m_list.ShowInPlaceComboBox(pItem->iItem, pItem->iSubItem, sl, nSel);
+ break;
+ case COL_RMCMD:
+ m_list.ShowInPlaceEdit(pItem->iItem, pItem->iSubItem);
+ break;
+ case COL_RMREPCNT:
+ m_list.ShowInPlaceEdit(pItem->iItem, pItem->iSubItem);
+ break;
+ default:
+ *pResult = FALSE;
+ break;
+ }
}
void CPPageAccelTbl::OnEndlabeleditList(NMHDR* pNMHDR, LRESULT* pResult)
@@ -1542,68 +1530,70 @@ void CPPageAccelTbl::OnEndlabeleditList(NMHDR* pNMHDR, LRESULT* pResult) if(pItem->iItem < 0)
return;
- wmcmd& wc = m_wmcmds.GetAt((POSITION)m_list.GetItemData(pItem->iItem));
-
- if(pItem->iSubItem == COL_MOD)
- {
- if(pItem->lParam >= 0 && pItem->lParam < countof(s_mods))
- {
- wc.fVirt = (wc.fVirt&3) | (s_mods[pItem->lParam]&~3);
- m_list.SetItemText(pItem->iItem, COL_MOD, pItem->pszText);
- *pResult = TRUE;
- }
- }
- else if(pItem->iSubItem == COL_KEY)
- {
- int i = pItem->lParam;
- if(i >= 0 && i < 256)
- {
- wc.key = (WORD)i;
- m_list.SetItemText(pItem->iItem, COL_KEY, pItem->pszText);
- *pResult = TRUE;
- }
- }
- else if(pItem->iSubItem == COL_TYPE)
- {
- int i = pItem->lParam;
- if(i >= 0 && i < 2)
- {
- wc.fVirt = (wc.fVirt&~FVIRTKEY) | (i == 0 ? FVIRTKEY : 0);
- m_list.SetItemText(pItem->iItem, COL_KEY, MakeAccelVkeyLabel(wc.key, wc.fVirt&FVIRTKEY));
- m_list.SetItemText(pItem->iItem, COL_TYPE, (wc.fVirt&FVIRTKEY)?_T("VIRTKEY"):_T("ASCII"));
- *pResult = TRUE;
- }
- }
- else if(pItem->iSubItem == COL_APPCMD)
- {
- int i = pItem->lParam;
- if(i >= 0 && i < countof(g_CommandList))
- {
- wc.appcmd = g_CommandList[i].appcmd;
- m_list.SetItemText(pItem->iItem, COL_APPCMD, pItem->pszText);
- *pResult = TRUE;
- }
- }
- else if(pItem->iSubItem == COL_MOUSE)
- {
- wc.mouse = pItem->lParam;
- m_list.SetItemText(pItem->iItem, COL_MOUSE, pItem->pszText);
- }
- else if(pItem->iSubItem == COL_RMCMD)
- {
- wc.rmcmd = CStringA(CString(pItem->pszText)).Trim();
- wc.rmcmd.Replace(' ', '_');
- m_list.SetItemText(pItem->iItem, pItem->iSubItem, CString(wc.rmcmd));
- *pResult = TRUE;
- }
- else if(pItem->iSubItem == COL_RMREPCNT)
- {
- CString str = CString(pItem->pszText).Trim();
- wc.rmrepcnt = _tcstol(str, NULL, 10);
- str.Format(_T("%d"), wc.rmrepcnt);
- m_list.SetItemText(pItem->iItem, pItem->iSubItem, str);
- *pResult = TRUE;
- }
+ wmcmd& wc = m_wmcmds.GetAt((POSITION)m_list.GetItemData(pItem->iItem));
+
+ switch(pItem->iSubItem)
+ {
+ case COL_MOD:
+ if(pItem->lParam >= 0 && pItem->lParam < countof(s_mods))
+ {
+ wc.fVirt = (wc.fVirt&3) | (s_mods[pItem->lParam]&~3);
+ m_list.SetItemText(pItem->iItem, COL_MOD, pItem->pszText);
+ *pResult = TRUE;
+ }
+ break;
+ case COL_KEY:
+ {
+ int i = pItem->lParam;
+ if(i >= 0 && i < 256)
+ {
+ wc.key = (WORD)i;
+ m_list.SetItemText(pItem->iItem, COL_KEY, pItem->pszText);
+ *pResult = TRUE;
+ }
+ }
+ break;
+ case COL_TYPE:
+ {
+ int i = pItem->lParam;
+ if(i >= 0 && i < 2)
+ {
+ wc.fVirt = (wc.fVirt&~FVIRTKEY) | (i == 0 ? FVIRTKEY : 0);
+ m_list.SetItemText(pItem->iItem, COL_KEY, MakeAccelVkeyLabel(wc.key, wc.fVirt&FVIRTKEY));
+ m_list.SetItemText(pItem->iItem, COL_TYPE, (wc.fVirt&FVIRTKEY)?_T("VIRTKEY"):_T("ASCII"));
+ *pResult = TRUE;
+ }
+ }
+ break;
+ case COL_APPCMD:
+ {
+ int i = pItem->lParam;
+ if(i >= 0 && i < countof(g_CommandList))
+ {
+ wc.appcmd = g_CommandList[i].appcmd;
+ m_list.SetItemText(pItem->iItem, COL_APPCMD, pItem->pszText);
+ *pResult = TRUE;
+ }
+ }
+ break;
+ case COL_MOUSE:
+ wc.mouse = pItem->lParam;
+ m_list.SetItemText(pItem->iItem, COL_MOUSE, pItem->pszText);
+ break;
+ case COL_RMCMD:
+ wc.rmcmd = CStringA(CString(pItem->pszText)).Trim();
+ wc.rmcmd.Replace(' ', '_');
+ m_list.SetItemText(pItem->iItem, pItem->iSubItem, CString(wc.rmcmd));
+ *pResult = TRUE;
+ break;
+ case COL_RMREPCNT:
+ CString str = CString(pItem->pszText).Trim();
+ wc.rmrepcnt = _tcstol(str, NULL, 10);
+ str.Format(_T("%d"), wc.rmrepcnt);
+ m_list.SetItemText(pItem->iItem, pItem->iSubItem, str);
+ *pResult = TRUE;
+ break;
+ }
if(*pResult)
SetModified();
diff --git a/src/apps/mplayerc/PlayerSubresyncBar.cpp b/src/apps/mplayerc/PlayerSubresyncBar.cpp index 750d277a1..03f3a0989 100644 --- a/src/apps/mplayerc/PlayerSubresyncBar.cpp +++ b/src/apps/mplayerc/PlayerSubresyncBar.cpp @@ -658,89 +658,105 @@ void CPlayerSubresyncBar::OnEndlabeleditList(NMHDR* pNMHDR, LRESULT* pResult) bool fNeedsUpdate = false;
if(pItem->iItem >= 0 && pItem->pszText && (m_mode == VOBSUB || m_mode == TEXTSUB))
- {
- if(pItem->iSubItem == COL_START)
- {
- int t;
- if(ParseTime(pItem->pszText, t))
- {
- fNeedsUpdate = ModStart(pItem->iItem, t);
-
- *pResult = TRUE;
- }
- }
- else if(pItem->iSubItem == COL_END && m_mode == TEXTSUB)
- {
- int t;
- if(ParseTime(pItem->pszText, t))
- {
- fNeedsUpdate = ModEnd(pItem->iItem, t);
-
- *pResult = TRUE;
- }
- }
- else if(pItem->iSubItem == COL_TEXT && m_mode == TEXTSUB)
- {
- CString str = m_sts.GetStr(pItem->iItem, true);
-
- if(str != pItem->pszText)
- {
- fNeedsUpdate = true;
- m_sts.SetStr(pItem->iItem, CString(pItem->pszText), true);
- m_list.SetItemText(pItem->iItem, pItem->iSubItem, m_sts.GetStr(pItem->iItem, true));
- }
- }
- else if(pItem->iSubItem == COL_STYLE && m_mode == TEXTSUB)
- {
- CString str(pItem->pszText);
- str.Trim();
-
- if(!str.IsEmpty() && m_sts[pItem->iItem].style != str)
- {
- fNeedsUpdate = true;
-
- if(!m_sts.m_styles.Lookup(str))
- m_sts.AddStyle(str, DNew STSStyle());
-
- m_sts[pItem->iItem].style = str;
-
- m_list.SetItemText(pItem->iItem, pItem->iSubItem, pItem->pszText);
- }
- }
- else if(pItem->iSubItem == COL_LAYER && m_mode == TEXTSUB)
- {
- int l;
- if(_stscanf_s(pItem->pszText, _T("%d"), &l) == 1)
- {
- fNeedsUpdate = true;
- m_sts[pItem->iItem].layer = l;
- CString str;
- str.Format(_T("%d"), l);
- m_list.SetItemText(pItem->iItem, pItem->iSubItem, str);
- }
- }
- else if(pItem->iSubItem == COL_ACTOR && m_mode == TEXTSUB)
- {
- CString str(pItem->pszText);
- str.Trim();
- if(!str.IsEmpty())
- {
- fNeedsUpdate = true;
- m_sts[pItem->iItem].actor = str;
- m_list.SetItemText(pItem->iItem, pItem->iSubItem, str);
- }
- }
- else if(pItem->iSubItem == COL_EFFECT && m_mode == TEXTSUB)
- {
- CString str(pItem->pszText);
- str.Trim();
- if(!str.IsEmpty())
- {
- fNeedsUpdate = true;
- m_sts[pItem->iItem].effect = str;
- m_list.SetItemText(pItem->iItem, pItem->iSubItem, str);
- }
- }
+ {
+ switch(pItem->iSubItem)
+ {
+ case COL_START:
+ {
+ int t;
+ if(ParseTime(pItem->pszText, t))
+ {
+ fNeedsUpdate = ModStart(pItem->iItem, t);
+
+ *pResult = TRUE;
+ }
+ }
+ break;
+ case COL_END:
+ if(m_mode == TEXTSUB)
+ {
+ int t;
+ if(ParseTime(pItem->pszText, t))
+ {
+ fNeedsUpdate = ModEnd(pItem->iItem, t);
+
+ *pResult = TRUE;
+ }
+ }
+ break;
+ case COL_TEXT:
+ if(m_mode == TEXTSUB)
+ {
+ CString str = m_sts.GetStr(pItem->iItem, true);
+
+ if(str != pItem->pszText)
+ {
+ fNeedsUpdate = true;
+ m_sts.SetStr(pItem->iItem, CString(pItem->pszText), true);
+ m_list.SetItemText(pItem->iItem, pItem->iSubItem, m_sts.GetStr(pItem->iItem, true));
+ }
+ }
+ break;
+ case COL_STYLE:
+ if(m_mode == TEXTSUB)
+ {
+ CString str(pItem->pszText);
+ str.Trim();
+
+ if(!str.IsEmpty() && m_sts[pItem->iItem].style != str)
+ {
+ fNeedsUpdate = true;
+
+ if(!m_sts.m_styles.Lookup(str))
+ m_sts.AddStyle(str, DNew STSStyle());
+
+ m_sts[pItem->iItem].style = str;
+
+ m_list.SetItemText(pItem->iItem, pItem->iSubItem, pItem->pszText);
+ }
+ }
+ break;
+ case COL_LAYER:
+ if(m_mode == TEXTSUB)
+ {
+ int l;
+ if(_stscanf_s(pItem->pszText, _T("%d"), &l) == 1)
+ {
+ fNeedsUpdate = true;
+ m_sts[pItem->iItem].layer = l;
+ CString str;
+ str.Format(_T("%d"), l);
+ m_list.SetItemText(pItem->iItem, pItem->iSubItem, str);
+ }
+ }
+ break;
+ case COL_ACTOR:
+ if(m_mode == TEXTSUB)
+ {
+ CString str(pItem->pszText);
+ str.Trim();
+ if(!str.IsEmpty())
+ {
+ fNeedsUpdate = true;
+ m_sts[pItem->iItem].actor = str;
+ m_list.SetItemText(pItem->iItem, pItem->iSubItem, str);
+ }
+ }
+ break;
+ case COL_EFFECT:
+ if(m_mode == TEXTSUB)
+ {
+ CString str(pItem->pszText);
+ str.Trim();
+ if(!str.IsEmpty())
+ {
+ fNeedsUpdate = true;
+ m_sts[pItem->iItem].effect = str;
+ m_list.SetItemText(pItem->iItem, pItem->iSubItem, str);
+ }
+ }
+ break;
+ }
}
if(fNeedsUpdate)
@@ -787,110 +803,127 @@ void CPlayerSubresyncBar::OnRclickList(NMHDR* pNMHDR, LRESULT* pResult) m.AppendMenu(MF_STRING|MF_ENABLED, DELITEM, ResStr(IDS_SUBRESYNC_DELETE));
}
- if(lpnmlv->iSubItem == COL_START && (m_mode == VOBSUB || m_mode == TEXTSUB))
- {
- m.AppendMenu(MF_SEPARATOR);
- m.AppendMenu(MF_STRING|MF_ENABLED, RESETS, ResStr(IDS_SUBRESYNC_RESET) + _T("\tF1"));
- m.AppendMenu(MF_STRING|MF_ENABLED, SETOS, ResStr(IDS_SUBRESYNC_ORIGINAL) + _T("\tF3"));
- m.AppendMenu(MF_STRING|MF_ENABLED, SETCS, ResStr(IDS_SUBRESYNC_CURRENT) + _T("\tF5"));
- }
- else if(lpnmlv->iSubItem == COL_END && m_mode == TEXTSUB)
- {
- m.AppendMenu(MF_SEPARATOR);
- m.AppendMenu(MF_STRING|MF_ENABLED, RESETE, ResStr(IDS_SUBRESYNC_RESET) + _T("\tF2"));
- m.AppendMenu(MF_STRING|MF_ENABLED, SETOE, ResStr(IDS_SUBRESYNC_ORIGINAL) + _T("\tF4"));
- m.AppendMenu(MF_STRING|MF_ENABLED, SETCE, ResStr(IDS_SUBRESYNC_CURRENT) + _T("\tF6"));
- }
- else if(lpnmlv->iSubItem == COL_STYLE && m_mode == TEXTSUB)
- {
- m.AppendMenu(MF_SEPARATOR);
-
- int id = STYLEFIRST;
-
- POSITION pos = m_sts.m_styles.GetStartPosition();
- while(pos && id <= STYLELAST)
- {
- CString key;
- STSStyle* val;
- m_sts.m_styles.GetNextAssoc(pos, key, val);
- styles.Add(key);
- m.AppendMenu(MF_STRING|MF_ENABLED, id++, key);
- }
-
- if(id > STYLEFIRST && m_list.GetSelectedCount() == 1)
- {
- m.AppendMenu(MF_SEPARATOR);
- m.AppendMenu(MF_STRING|MF_ENABLED, STYLEEDIT, ResStr(IDS_SUBRESYNC_EDIT));
- }
- }
- else if(lpnmlv->iSubItem == COL_UNICODE && m_mode == TEXTSUB)
- {
- m.AppendMenu(MF_SEPARATOR);
- m.AppendMenu(MF_STRING|MF_ENABLED, UNICODEYES, ResStr(IDS_SUBRESYNC_YES));
- m.AppendMenu(MF_STRING|MF_ENABLED, UNICODENO, ResStr(IDS_SUBRESYNC_NO));
- }
- else if(lpnmlv->iSubItem == COL_LAYER && m_mode == TEXTSUB)
- {
- m.AppendMenu(MF_SEPARATOR);
- m.AppendMenu(MF_STRING|MF_ENABLED, LAYERDEC, ResStr(IDS_SUBRESYNC_DECREASE));
- m.AppendMenu(MF_STRING|MF_ENABLED, LAYERINC, ResStr(IDS_SUBRESYNC_INCREASE));
- }
- else if(lpnmlv->iSubItem == COL_ACTOR && m_mode == TEXTSUB)
- {
- CMapStringToPtr actormap;
-
- for(int i = 0, j = m_sts.GetCount(); i < j; i++)
- actormap[m_sts[i].actor] = NULL;
-
- actormap.RemoveKey(_T(""));
-
- if(actormap.GetCount() > 0)
- {
- m.AppendMenu(MF_SEPARATOR);
-
- int id = ACTORFIRST;
-
- POSITION pos = actormap.GetStartPosition();
- while(pos && id <= ACTORLAST)
- {
- CString key;
- void* val;
- actormap.GetNextAssoc(pos, key, val);
-
- actors.Add(key);
-
- m.AppendMenu(MF_STRING|MF_ENABLED, id++, key);
- }
- }
- }
- else if(lpnmlv->iSubItem == COL_EFFECT && m_mode == TEXTSUB)
- {
- CMapStringToPtr effectmap;
-
- for(int i = 0, j = m_sts.GetCount(); i < j; i++)
- effectmap[m_sts[i].effect] = NULL;
-
- effectmap.RemoveKey(_T(""));
-
- if(effectmap.GetCount() > 0)
- {
- m.AppendMenu(MF_SEPARATOR);
-
- int id = EFFECTFIRST;
-
- POSITION pos = effectmap.GetStartPosition();
- while(pos && id <= EFFECTLAST)
- {
- CString key;
- void* val;
- effectmap.GetNextAssoc(pos, key, val);
-
- effects.Add(key);
-
- m.AppendMenu(MF_STRING|MF_ENABLED, id++, key);
- }
- }
- }
+ switch(lpnmlv->iSubItem)
+ {
+ case COL_START:
+ if(m_mode == VOBSUB || m_mode == TEXTSUB)
+ {
+ m.AppendMenu(MF_SEPARATOR);
+ m.AppendMenu(MF_STRING|MF_ENABLED, RESETS, ResStr(IDS_SUBRESYNC_RESET) + _T("\tF1"));
+ m.AppendMenu(MF_STRING|MF_ENABLED, SETOS, ResStr(IDS_SUBRESYNC_ORIGINAL) + _T("\tF3"));
+ m.AppendMenu(MF_STRING|MF_ENABLED, SETCS, ResStr(IDS_SUBRESYNC_CURRENT) + _T("\tF5"));
+ }
+ break;
+ case COL_END:
+ if(m_mode == TEXTSUB)
+ {
+ m.AppendMenu(MF_SEPARATOR);
+ m.AppendMenu(MF_STRING|MF_ENABLED, RESETE, ResStr(IDS_SUBRESYNC_RESET) + _T("\tF2"));
+ m.AppendMenu(MF_STRING|MF_ENABLED, SETOE, ResStr(IDS_SUBRESYNC_ORIGINAL) + _T("\tF4"));
+ m.AppendMenu(MF_STRING|MF_ENABLED, SETCE, ResStr(IDS_SUBRESYNC_CURRENT) + _T("\tF6"));
+ }
+ break;
+ case COL_STYLE:
+ if(m_mode == TEXTSUB)
+ {
+ m.AppendMenu(MF_SEPARATOR);
+
+ int id = STYLEFIRST;
+
+ POSITION pos = m_sts.m_styles.GetStartPosition();
+ while(pos && id <= STYLELAST)
+ {
+ CString key;
+ STSStyle* val;
+ m_sts.m_styles.GetNextAssoc(pos, key, val);
+ styles.Add(key);
+ m.AppendMenu(MF_STRING|MF_ENABLED, id++, key);
+ }
+
+ if(id > STYLEFIRST && m_list.GetSelectedCount() == 1)
+ {
+ m.AppendMenu(MF_SEPARATOR);
+ m.AppendMenu(MF_STRING|MF_ENABLED, STYLEEDIT, ResStr(IDS_SUBRESYNC_EDIT));
+ }
+ }
+ break;
+ case COL_UNICODE:
+ if(m_mode == TEXTSUB)
+ {
+ m.AppendMenu(MF_SEPARATOR);
+ m.AppendMenu(MF_STRING|MF_ENABLED, UNICODEYES, ResStr(IDS_SUBRESYNC_YES));
+ m.AppendMenu(MF_STRING|MF_ENABLED, UNICODENO, ResStr(IDS_SUBRESYNC_NO));
+ }
+ break;
+ case COL_LAYER:
+ if(m_mode == TEXTSUB)
+ {
+ m.AppendMenu(MF_SEPARATOR);
+ m.AppendMenu(MF_STRING|MF_ENABLED, LAYERDEC, ResStr(IDS_SUBRESYNC_DECREASE));
+ m.AppendMenu(MF_STRING|MF_ENABLED, LAYERINC, ResStr(IDS_SUBRESYNC_INCREASE));
+ }
+ break;
+ case COL_ACTOR:
+ if(m_mode == TEXTSUB)
+ {
+ CMapStringToPtr actormap;
+
+ for(int i = 0, j = m_sts.GetCount(); i < j; i++)
+ actormap[m_sts[i].actor] = NULL;
+
+ actormap.RemoveKey(_T(""));
+
+ if(actormap.GetCount() > 0)
+ {
+ m.AppendMenu(MF_SEPARATOR);
+
+ int id = ACTORFIRST;
+
+ POSITION pos = actormap.GetStartPosition();
+ while(pos && id <= ACTORLAST)
+ {
+ CString key;
+ void* val;
+ actormap.GetNextAssoc(pos, key, val);
+
+ actors.Add(key);
+
+ m.AppendMenu(MF_STRING|MF_ENABLED, id++, key);
+ }
+ }
+ }
+ break;
+ case COL_EFFECT:
+ if(m_mode == TEXTSUB)
+ {
+ CMapStringToPtr effectmap;
+
+ for(int i = 0, j = m_sts.GetCount(); i < j; i++)
+ effectmap[m_sts[i].effect] = NULL;
+
+ effectmap.RemoveKey(_T(""));
+
+ if(effectmap.GetCount() > 0)
+ {
+ m.AppendMenu(MF_SEPARATOR);
+
+ int id = EFFECTFIRST;
+
+ POSITION pos = effectmap.GetStartPosition();
+ while(pos && id <= EFFECTLAST)
+ {
+ CString key;
+ void* val;
+ effectmap.GetNextAssoc(pos, key, val);
+
+ effects.Add(key);
+
+ m.AppendMenu(MF_STRING|MF_ENABLED, id++, key);
+ }
+ }
+ }
+ break;
+ }
CPoint p = lpnmlv->ptAction;
::MapWindowPoints(pNMHDR->hwndFrom, HWND_DESKTOP, &p, 1);
|