Skip to content

Commit

Permalink
[Fix] Hidden items in the main toolbar could still sometimes show up …
Browse files Browse the repository at this point in the history
…when restarting playback (https://bugs.openmpt.org/view.php?id=1839).

git-svn-id: https://source.openmpt.org/svn/openmpt/trunk/OpenMPT@22184 56274372-70c3-4bfc-bfc3-4c3a0b034d27
  • Loading branch information
sagamusix committed Nov 14, 2024
1 parent 16e1563 commit c84ce4c
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
9 changes: 5 additions & 4 deletions mptrack/Mainbar.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -535,14 +535,15 @@ void CMainToolBar::SetCurrentSong(CSoundFile *pSndFile)
// Update Info
m_updating = true;
const CWnd *focus = GetFocus();
const FlagSet<MainToolBarItem> visibleItems = TrackerSettings::Instance().mainToolBarVisibleItems.Get();
if(pSndFile)
{
// Update play/pause button
if(m_currentTempo == TEMPO(0, 0))
SetButtonInfo(PLAYCMD_INDEX, ID_PLAYER_PAUSE, TBBS_BUTTON, TOOLBAR_IMAGE_PAUSE);
// Update Speed
int nSpeed = pSndFile->m_PlayState.m_nMusicSpeed;
if(nSpeed != m_currentSpeed && focus != &m_EditSpeed)
if(nSpeed != m_currentSpeed && focus != &m_EditSpeed && visibleItems[MainToolBarItem::Speed])
{
if(m_currentSpeed < 0)
EnableEdit(m_EditSpeed, m_SpinSpeed, true);
Expand All @@ -551,7 +552,7 @@ void CMainToolBar::SetCurrentSong(CSoundFile *pSndFile)
SetDlgItemInt(IDC_EDIT_CURRENTSPEED, m_currentSpeed, FALSE);
}
TEMPO nTempo = pSndFile->m_PlayState.m_nMusicTempo;
if(nTempo != m_currentTempo && focus != &m_EditTempo)
if(nTempo != m_currentTempo && focus != &m_EditTempo && visibleItems[MainToolBarItem::Tempo])
{
if(m_currentTempo <= TEMPO(0, 0))
EnableEdit(m_EditTempo, m_SpinTempo, true);
Expand All @@ -560,7 +561,7 @@ void CMainToolBar::SetCurrentSong(CSoundFile *pSndFile)
m_EditTempo.SetTempoValue(m_currentTempo);
}
int nRowsPerBeat = pSndFile->m_PlayState.m_nCurrentRowsPerBeat;
if(nRowsPerBeat != m_currentRowsPerBeat && focus != &m_EditRowsPerBeat)
if(nRowsPerBeat != m_currentRowsPerBeat && focus != &m_EditRowsPerBeat && visibleItems[MainToolBarItem::RowsPerBeat])
{
if(m_currentRowsPerBeat < 0)
EnableEdit(m_EditRowsPerBeat, m_SpinRowsPerBeat, true);
Expand All @@ -569,7 +570,7 @@ void CMainToolBar::SetCurrentSong(CSoundFile *pSndFile)
SetDlgItemInt(IDC_EDIT_RPB, m_currentRowsPerBeat, FALSE);
}
int globalVol = pSndFile->m_PlayState.m_nGlobalVolume;
if(globalVol != m_currentGlobalVolume && focus != &m_EditGlobalVolume)
if(globalVol != m_currentGlobalVolume && focus != &m_EditGlobalVolume && visibleItems[MainToolBarItem::GlobalVolume])
{
if(m_currentGlobalVolume < 0)
EnableEdit(m_EditGlobalVolume, m_SpinGlobalVolume, true);
Expand Down
2 changes: 1 addition & 1 deletion mptrack/TrackerSettings.h
Original file line number Diff line number Diff line change
Expand Up @@ -715,7 +715,7 @@ class TrackerSettings

Setting<FontSetting> commentsFont;

Setting<MainToolBarItem> mainToolBarVisibleItems;
CachedSetting<MainToolBarItem> mainToolBarVisibleItems;
Setting<bool> treeViewOnLeft;

// Misc
Expand Down

0 comments on commit c84ce4c

Please sign in to comment.