From: <sag...@us...> - 2015-06-27 13:54:09
|
Revision: 5367 http://sourceforge.net/p/modplug/code/5367 Author: saga-games Date: 2015-06-27 13:54:03 +0000 (Sat, 27 Jun 2015) Log Message: ----------- [Fix] Fix some alignment issues occuring with smooth pattern scrolling (e.g. when using step feature) Modified Paths: -------------- trunk/OpenMPT/mptrack/Draw_pat.cpp trunk/OpenMPT/mptrack/View_pat.cpp Modified: trunk/OpenMPT/mptrack/Draw_pat.cpp =================================================================== --- trunk/OpenMPT/mptrack/Draw_pat.cpp 2015-06-27 11:40:04 UTC (rev 5366) +++ trunk/OpenMPT/mptrack/Draw_pat.cpp 2015-06-27 13:54:03 UTC (rev 5367) @@ -160,7 +160,14 @@ int CViewPattern::GetSmoothScrollOffset() const //--------------------------------------------- { - return Util::muldivr_unsigned(m_szCell.cy, m_nPlayTick, std::max(1u, m_nTicksOnRow)); + if((TrackerSettings::Instance().m_dwPatternSetup & PATTERN_SMOOTHSCROLL) != 0 // Actually using the smooth scroll feature + && (m_Status & (psFollowSong | psDragActive)) == psFollowSong // Not drawing a selection during playback + && (m_nMidRow != 0 || GetYScrollPos() > 0) // If active row is not centered, only scroll when display position is actually not at the top + && IsLiveRecord()) // Actually playing live (not paused or stepping) + { + return Util::muldivr_unsigned(m_szCell.cy, m_nPlayTick, std::max(1u, m_nTicksOnRow)); + } + return 0; } @@ -246,15 +253,10 @@ { const PATTERNFONT *pfnt = PatternFont::currentFont; int xofs = GetXScrollPos(); - int yofs = GetYScrollPos(); + int yofs = GetYScrollPos() + GetSmoothScrollOffset(); int x = xofs + (pt.x - m_szHeader.cx) / GetColumnWidth(); if (pt.x < m_szHeader.cx) x = (xofs) ? xofs - 1 : 0; - if((TrackerSettings::Instance().m_dwPatternSetup & PATTERN_SMOOTHSCROLL) != 0 && (m_Status & (psFollowSong | psDragActive)) == psFollowSong && IsLiveRecord()) - { - pt.y += GetSmoothScrollOffset(); - } - int y = yofs - m_nMidRow + (pt.y - m_szHeader.cy) / m_szCell.cy; if (y < 0) y = 0; int xx = (pt.x - m_szHeader.cx) % GetColumnWidth(), dx = 0; @@ -513,13 +515,7 @@ UINT nColumnWidth = m_szCell.cx; UINT ncols = sndFile.GetNumChannels(); int xpaint = m_szHeader.cx; - int ypaint = rcClient.top + m_szHeader.cy; - - // Scroll tick by tick (always if active row is centered, otherwise only if the top row isn't the first one) - if(doSmoothScroll && liveRecord && (m_Status & (psFollowSong | psDragActive)) == psFollowSong && (m_nMidRow != 0 || yofs > 0)) - { - ypaint -= GetSmoothScrollOffset(); - } + int ypaint = rcClient.top + m_szHeader.cy - GetSmoothScrollOffset(); if (m_nMidRow) { @@ -1514,7 +1510,7 @@ CRect rect; GetClientRect(&rect); rect.left = m_szHeader.cx; - rect.top = m_szHeader.cy; + rect.top = m_szHeader.cy - GetSmoothScrollOffset(); rect.top += (n - yofs) * m_szCell.cy; rect.bottom = rect.top + m_szCell.cy; InvalidateRect(&rect, FALSE); Modified: trunk/OpenMPT/mptrack/View_pat.cpp =================================================================== --- trunk/OpenMPT/mptrack/View_pat.cpp 2015-06-27 11:40:04 UTC (rev 5366) +++ trunk/OpenMPT/mptrack/View_pat.cpp 2015-06-27 13:54:03 UTC (rev 5367) @@ -99,10 +99,6 @@ ON_COMMAND(ID_NEXTINSTRUMENT, OnNextInstrument) ON_COMMAND(ID_PREVINSTRUMENT, OnPrevInstrument) ON_COMMAND(ID_PATTERN_PLAYROW, OnPatternStep) - ON_COMMAND(ID_CONTROLENTER, OnPatternStep) - ON_COMMAND(ID_CONTROLTAB, OnSwitchToOrderList) - ON_COMMAND(ID_PREVORDER, OnPrevOrder) - ON_COMMAND(ID_NEXTORDER, OnNextOrder) ON_COMMAND(IDC_PATTERN_RECORD, OnPatternRecord) ON_COMMAND(ID_RUN_SCRIPT, OnRunScript) ON_COMMAND(ID_TRANSPOSE_UP, OnTransposeUp) @@ -2488,6 +2484,10 @@ CriticalSection cs; + // In case we were previously in smooth scrolling mode during live playback, the pattern might be misaligned. + if(GetSmoothScrollOffset() != 0) + InvalidatePattern(true); + // Cut instruments/samples in virtual channels for(CHANNELINDEX i = pSndFile->GetNumChannels(); i < MAX_CHANNELS; i++) { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |