From: <man...@us...> - 2013-04-09 00:01:33
|
Revision: 1785 http://sourceforge.net/p/modplug/code/1785 Author: manxorist Date: 2013-04-09 00:01:27 +0000 (Tue, 09 Apr 2013) Log Message: ----------- [Ref] Remove CMainFrame::m_hFollowSong. CModDoc knows the HWND just as well. Modified Paths: -------------- trunk/OpenMPT/mptrack/Ctrl_gen.cpp trunk/OpenMPT/mptrack/Globals.cpp trunk/OpenMPT/mptrack/MainFrm.cpp trunk/OpenMPT/mptrack/Mainfrm.h trunk/OpenMPT/mptrack/Moddoc.cpp trunk/OpenMPT/mptrack/View_pat.cpp Modified: trunk/OpenMPT/mptrack/Ctrl_gen.cpp =================================================================== --- trunk/OpenMPT/mptrack/Ctrl_gen.cpp 2013-04-08 23:44:36 UTC (rev 1784) +++ trunk/OpenMPT/mptrack/Ctrl_gen.cpp 2013-04-09 00:01:27 UTC (rev 1785) @@ -147,7 +147,6 @@ CMainFrame *pMainFrm = CMainFrame::GetMainFrame(); if (m_pModDoc) m_pModDoc->SetNotifications(Notification::Default); if (m_pModDoc) m_pModDoc->SetFollowWnd(m_hWnd); - if (pMainFrm) pMainFrm->SetFollowSong(m_pModDoc, m_hWnd, TRUE); PostViewMessage(VIEWMSG_SETACTIVE, NULL); SetFocus(); Modified: trunk/OpenMPT/mptrack/Globals.cpp =================================================================== --- trunk/OpenMPT/mptrack/Globals.cpp 2013-04-08 23:44:36 UTC (rev 1784) +++ trunk/OpenMPT/mptrack/Globals.cpp 2013-04-09 00:01:27 UTC (rev 1785) @@ -642,7 +642,6 @@ if (pMainFrm->GetFollowSong(pModDoc) == m_hWnd) { pModDoc->SetNotifications(Notification::None); - pMainFrm->SetFollowSong(pModDoc, NULL, FALSE); pModDoc->SetFollowWnd(NULL); } if (pMainFrm->GetMidiRecordWnd() == m_hWnd) Modified: trunk/OpenMPT/mptrack/MainFrm.cpp =================================================================== --- trunk/OpenMPT/mptrack/MainFrm.cpp 2013-04-08 23:44:36 UTC (rev 1784) +++ trunk/OpenMPT/mptrack/MainFrm.cpp 2013-04-09 00:01:27 UTC (rev 1785) @@ -194,7 +194,6 @@ m_SoundCardOptionsDialog = nullptr; m_pJustModifiedDoc = nullptr; - m_hFollowSong = NULL; m_hWndMidi = NULL; m_pSndFile = nullptr; m_dwTimeSec = 0; @@ -1265,6 +1264,7 @@ ///////////////////////////////////////////////////////////////////////////// // CMainFrame operations + UINT CMainFrame::GetBaseOctave() const //------------------------------------ { @@ -1381,7 +1381,6 @@ } } m_pSndFile = nullptr; - m_hFollowSong = NULL; m_wndToolBar.SetCurrentSong(nullptr); { Util::lock_guard<Util::mutex> lock(m_NotificationBufferMutex); @@ -1390,16 +1389,15 @@ } -void CMainFrame::SetPlaybackSoundFile(CSoundFile *pSndFile, HWND hPat) -//-------------------------------------------------------------------- +void CMainFrame::SetPlaybackSoundFile(CSoundFile *pSndFile) +//--------------------------------------------------------- { m_pSndFile = pSndFile; - m_hFollowSong = hPat; } -bool CMainFrame::PlayMod(CModDoc *pModDoc, HWND hPat) -//--------------------------------------------------- +bool CMainFrame::PlayMod(CModDoc *pModDoc) +//---------------------------------------- { CriticalSection::AssertUnlocked(); if(!pModDoc) return false; @@ -1418,7 +1416,7 @@ // set mixing parameters in CSoundFile ApplyTrackerSettings(pSndFile); - SetPlaybackSoundFile(pSndFile, hPat); + SetPlaybackSoundFile(pSndFile); const bool bPaused = m_pSndFile->IsPaused(); const bool bPatLoop = m_pSndFile->m_SongFlags[SONG_PATTERNLOOP]; @@ -1719,18 +1717,10 @@ } -BOOL CMainFrame::SetFollowSong(CModDoc *pDoc, HWND hwnd, BOOL bFollowSong) -//------------------------------------------------------------------------ +HWND CMainFrame::GetFollowSong() const +//------------------------------------ { - if((!pDoc) || (pDoc != GetModPlaying())) return FALSE; - if(bFollowSong) - { - m_hFollowSong = hwnd; - } else - { - if(hwnd == m_hFollowSong) m_hFollowSong = NULL; - } - return TRUE; + return GetModPlaying() ? GetModPlaying()->GetFollowWnd() : NULL; } @@ -1743,7 +1733,6 @@ || (TrackerSettings::Instance().m_nChannels != nChns)) { CModDoc *pActiveMod = NULL; - HWND hFollow = m_hFollowSong; if (isPlaying) { if ((m_pSndFile) && (!m_pSndFile->IsPaused())) pActiveMod = GetModPlaying(); @@ -1760,7 +1749,7 @@ CriticalSection cs; UpdateAudioParameters(FALSE); } - if (pActiveMod) PlayMod(pActiveMod, hFollow); + if (pActiveMod) PlayMod(pActiveMod); UpdateWindow(); } else { @@ -2314,8 +2303,8 @@ if (GetModPlaying()) { m_wndTree.UpdatePlayPos(GetModPlaying(), pnotify); - if (m_hFollowSong) - ::SendMessage(m_hFollowSong, WM_MOD_UPDATEPOSITION, 0, lParam); + if (GetFollowSong()) + ::SendMessage(GetFollowSong(), WM_MOD_UPDATEPOSITION, 0, lParam); } m_wndToolBar.m_VuMeter.SetVuMeter(pnotify->masterVU[0], pnotify->masterVU[1]); Modified: trunk/OpenMPT/mptrack/Mainfrm.h =================================================================== --- trunk/OpenMPT/mptrack/Mainfrm.h 2013-04-08 23:44:36 UTC (rev 1784) +++ trunk/OpenMPT/mptrack/Mainfrm.h 2013-04-09 00:01:27 UTC (rev 1785) @@ -308,7 +308,7 @@ CMainToolBar m_wndToolBar; CImageList m_ImageList; CSoundFile *m_pSndFile; // != NULL only when currently playing or rendering - HWND m_hFollowSong, m_hWndMidi; + HWND m_hWndMidi; CSoundFile::samplecount_t m_dwTimeSec; UINT_PTR m_nTimer; UINT m_nAvgMixChn, m_nMixChn; @@ -434,11 +434,11 @@ bool PausePlayback(); bool IsPlaybackRunning() const { return m_IsPlaybackRunning; } static bool IsValidSoundFile(CSoundFile *pSndFile) { return pSndFile && pSndFile->GetType(); } - void SetPlaybackSoundFile(CSoundFile *pSndFile, HWND hPat=NULL); + void SetPlaybackSoundFile(CSoundFile *pSndFile); void UnsetPlaybackSoundFile(); void GenerateStopNotification(); - bool PlayMod(CModDoc *, HWND hPat=NULL); + bool PlayMod(CModDoc *); bool StopMod(CModDoc *pDoc=NULL); bool PauseMod(CModDoc *pDoc=NULL); @@ -465,8 +465,8 @@ BOOL SetupPlayer(DWORD, DWORD, BOOL bForceUpdate=FALSE); BOOL SetupMidi(DWORD d, LONG n); void SetPreAmp(UINT n); - HWND GetFollowSong(const CModDoc *pDoc) const { return (pDoc == GetModPlaying()) ? m_hFollowSong : NULL; } - BOOL SetFollowSong(CModDoc *, HWND hwnd, BOOL bFollowSong=TRUE); + HWND GetFollowSong() const; + HWND GetFollowSong(const CModDoc *pDoc) const { return (pDoc == GetModPlaying()) ? GetFollowSong() : NULL; } void ResetNotificationBuffer(); Modified: trunk/OpenMPT/mptrack/Moddoc.cpp =================================================================== --- trunk/OpenMPT/mptrack/Moddoc.cpp 2013-04-08 23:44:36 UTC (rev 1784) +++ trunk/OpenMPT/mptrack/Moddoc.cpp 2013-04-09 00:01:27 UTC (rev 1785) @@ -1011,7 +1011,7 @@ if (pMainFrm->GetModPlaying() != this) { m_SndFile.m_SongFlags.set(SONG_PAUSED); - pMainFrm->PlayMod(this, m_hWndFollow); + pMainFrm->PlayMod(this); } CriticalSection cs; @@ -1497,9 +1497,7 @@ void CModDoc::SetFollowWnd(HWND hwnd) //----------------------------------- { - CMainFrame *pMainFrm = CMainFrame::GetMainFrame(); m_hWndFollow = hwnd; - if(pMainFrm) pMainFrm->SetFollowSong(this, m_hWndFollow, TRUE); } @@ -1999,7 +1997,7 @@ cs.Leave(); m_SndFile.m_SongFlags.reset(SONG_STEP | SONG_PAUSED | SONG_PATTERNLOOP); - pMainFrm->PlayMod(this, m_hWndFollow); + pMainFrm->PlayMod(this); } } @@ -2084,7 +2082,7 @@ cs.Leave(); - pMainFrm->PlayMod(this, m_hWndFollow); + pMainFrm->PlayMod(this); } } @@ -2399,7 +2397,8 @@ if(pModPlaying != this) { SetNotifications(m_notifyType|Notification::Position|Notification::VUMeters, m_notifyItem); - pMainFrm->PlayMod(this, followSonghWnd); //rewbs.fix2977 + SetFollowWnd(followSonghWnd); + pMainFrm->PlayMod(this); //rewbs.fix2977 } } //SwitchToView(); @@ -2456,7 +2455,8 @@ if(pModPlaying != this) { SetNotifications(m_notifyType|Notification::Position|Notification::VUMeters, m_notifyItem); - pMainFrm->PlayMod(this, followSonghWnd); //rewbs.fix2977 + SetFollowWnd(followSonghWnd); + pMainFrm->PlayMod(this); //rewbs.fix2977 } } //SwitchToView(); @@ -2516,7 +2516,8 @@ if(pModPlaying != this) { SetNotifications(m_notifyType|Notification::Position|Notification::VUMeters, m_notifyItem); - pMainFrm->PlayMod(this, followSonghWnd); //rewbs.fix2977 + SetFollowWnd(followSonghWnd); + pMainFrm->PlayMod(this); //rewbs.fix2977 } } //SwitchToView(); Modified: trunk/OpenMPT/mptrack/View_pat.cpp =================================================================== --- trunk/OpenMPT/mptrack/View_pat.cpp 2013-04-08 23:44:36 UTC (rev 1784) +++ trunk/OpenMPT/mptrack/View_pat.cpp 2013-04-09 00:01:27 UTC (rev 1785) @@ -2469,7 +2469,8 @@ if (pMainFrm->GetModPlaying() != pModDoc) { pModDoc->SetNotifications(Notification::Position | Notification::VUMeters); - pMainFrm->PlayMod(pModDoc, m_hWnd); + pModDoc->SetFollowWnd(m_hWnd); + pMainFrm->PlayMod(pModDoc); } if(row == ROWINDEX_INVALID) { @@ -3932,7 +3933,6 @@ m_Status.set(psFollowSong); if(pModDoc) pModDoc->SetNotifications(Notification::Position | Notification::VUMeters); if(pModDoc) pModDoc->SetFollowWnd(m_hWnd); - if(pMainFrm) pMainFrm->SetFollowSong(pModDoc, m_hWnd, TRUE); SetFocus(); } else { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |