Skip to content

Commit

Permalink
修正播放停止时下一首播放设置后状态栏没有更新
Browse files Browse the repository at this point in the history
  • Loading branch information
lrisora committed Sep 12, 2023
1 parent 550e940 commit eca5de3
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 2 deletions.
3 changes: 2 additions & 1 deletion MusicPlayer2/Define.h
Original file line number Diff line number Diff line change
Expand Up @@ -163,8 +163,9 @@ const int EQU_STYLE_TABLE[9][EQU_CH_NUM] //均衡器预设
#define WM_RE_INIT_BASS_CONTINUE_PLAY (WM_USER+138) // BASS内核出问题时post此消息到主窗口重启内核
#define WM_VOLUME_CHANGED (WM_USER+139) //音量变化时发送的消息
#define WM_RECENT_FOLDER_OR_PLAYLIST_CHANGED (WM_USER+140) //最近打开的文件夹或播放列表发生了改变
#define WM_SET_UI_FORCE_FRESH_FLAG (WM_USER+141) // 通知主窗口设置UI强制刷新标志m_ui_thread_para.ui_force_refresh

#define WM_NEXT_USER_MSG (WM_USER+141)
#define WM_NEXT_USER_MSG (WM_USER+142)

#ifdef _DEBUG
#define ADD_TO_PLAYLIST_MAX_SIZE 10 //“添加到播放列表”子菜单中项目的最大数量(不能超过40)
Expand Down
1 change: 1 addition & 0 deletions MusicPlayer2/FindDlg.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -650,4 +650,5 @@ void CFindDlg::OnPlayAsNext()
vector<SongInfo> songs;
GetSongsSelected(songs);
CPlayer::GetInstance().PlayAfterCurrentTrack(songs);
::SendMessage(theApp.m_pMainWnd->GetSafeHwnd(), WM_SET_UI_FORCE_FRESH_FLAG, 0, 0); // 主动触发更新状态栏显示
}
1 change: 1 addition & 0 deletions MusicPlayer2/MediaLibTabDlg.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,7 @@ void CMediaLibTabDlg::OnPlayAsNext()
vector<SongInfo> songs;
GetSongsSelected(songs);
CPlayer::GetInstance().PlayAfterCurrentTrack(songs);
::SendMessage(theApp.m_pMainWnd->GetSafeHwnd(), WM_SET_UI_FORCE_FRESH_FLAG, 0, 0);
}


Expand Down
10 changes: 9 additions & 1 deletion MusicPlayer2/MusicPlayerDlg.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -340,6 +340,7 @@ BEGIN_MESSAGE_MAP(CMusicPlayerDlg, CMainDialogBase)
ON_COMMAND(ID_PLAY_AS_NEXT, &CMusicPlayerDlg::OnPlayAsNext)
ON_COMMAND(ID_PLAYLIST_FIX_PATH_ERROR, &CMusicPlayerDlg::OnPlaylistFixPathError)
ON_WM_POWERBROADCAST()
ON_MESSAGE(WM_SET_UI_FORCE_FRESH_FLAG, &CMusicPlayerDlg::OnSetUiForceFreshFlag)
END_MESSAGE_MAP()


Expand Down Expand Up @@ -6637,7 +6638,7 @@ afx_msg LRESULT CMusicPlayerDlg::OnRecentFolderOrPlaylistChanged(WPARAM wParam,

void CMusicPlayerDlg::OnPlayAsNext() {
CPlayer::GetInstance().PlayAfterCurrentTrack(m_items_selected);
DrawInfo(false);
m_ui_thread_para.ui_force_refresh = true; // 虽然现在这行的效果被“主窗口拥有焦点”盖过了,不过保留这行
}


Expand Down Expand Up @@ -6670,3 +6671,10 @@ ULONG CMusicPlayerDlg::DeviceNotifyCallbackRoutine(PVOID Context, ULONG Type, PV
::PostMessage(theApp.m_pMainWnd->GetSafeHwnd(), WM_RE_INIT_BASS_CONTINUE_PLAY, 0, 0);
return 0;
}


afx_msg LRESULT CMusicPlayerDlg::OnSetUiForceFreshFlag(WPARAM wParam, LPARAM lParam)
{
m_ui_thread_para.ui_force_refresh = true;
return 0;
}
2 changes: 2 additions & 0 deletions MusicPlayer2/MusicPlayerDlg.h
Original file line number Diff line number Diff line change
Expand Up @@ -542,4 +542,6 @@ class CMusicPlayerDlg : public CMainDialogBase
afx_msg void OnPlayAsNext();
afx_msg void OnPlaylistFixPathError();
afx_msg UINT OnPowerBroadcast(UINT nPowerEvent, LPARAM nEventData);
protected:
afx_msg LRESULT OnSetUiForceFreshFlag(WPARAM wParam, LPARAM lParam);
};

0 comments on commit eca5de3

Please sign in to comment.