From: <sag...@us...> - 2010-01-09 20:06:39
|
Revision: 460 http://modplug.svn.sourceforge.net/modplug/?rev=460&view=rev Author: saga-games Date: 2010-01-09 20:06:18 +0000 (Sat, 09 Jan 2010) Log Message: ----------- [Fix] Mod Loaders: Very short sample sustain loops are now also accepted (similar fix to normal loop points) [Fix] Order list: Fixed display error when selecting multiple orders, inserting them and clicking on another order (only first order of previous selection was un-highlighted) [Imp] VST Editor: When dealing with midi learn in vst editors (with Shift key), also accept child windows of the VST editor as valid window. This still doesn't fix the Shift+clicking sliders issue in Synth1, but might help with other plugins. Modified Paths: -------------- trunk/OpenMPT/mptrack/Ctrl_pat.h trunk/OpenMPT/mptrack/Ctrl_seq.cpp trunk/OpenMPT/mptrack/Vstplug.cpp trunk/OpenMPT/soundlib/Sndfile.cpp Modified: trunk/OpenMPT/mptrack/Ctrl_pat.h =================================================================== --- trunk/OpenMPT/mptrack/Ctrl_pat.h 2010-01-08 20:56:53 UTC (rev 459) +++ trunk/OpenMPT/mptrack/Ctrl_pat.h 2010-01-09 20:06:18 UTC (rev 460) @@ -44,7 +44,6 @@ BOOL Init(const CRect&, CCtrlPatterns *pParent, CModDoc *, HFONT hFont); void InvalidateSelection() const; UINT GetCurrentPattern() const; - ORD_SELECTION GetCurSel(bool bIgnoreSelection) const; // make the current selection the secondary selection (used for keyboard orderlist navigation) inline void SetCurSelTo2ndSel(bool isSelectionKeyPressed) { if(isSelectionKeyPressed && m_nScrollPos2nd == ORDERINDEX_INVALID) m_nScrollPos2nd = m_nScrollPos; @@ -58,6 +57,10 @@ ORDERINDEX GetOrderFromPoint(const CRect& rect, const CPoint& pt) const; + // Get the currently selected pattern(s). + // Set bIgnoreSelection to true if only the first selected point is important. + ORD_SELECTION GetCurSel(bool bIgnoreSelection) const; + // Sets target margin value and returns the effective margin value. BYTE SetMargins(int); @@ -83,6 +86,9 @@ // is not interpreted to be in margins regardless of the margin value. bool IsOrderInMargins(int order, int startOrder); + // Ensure that a given order index is visible in the orderlist view. + void EnsureVisible(ORDERINDEX order); + // Set given sqeuence and update orderlist display. void SelectSequence(const SEQUENCEINDEX nSeq); Modified: trunk/OpenMPT/mptrack/Ctrl_seq.cpp =================================================================== --- trunk/OpenMPT/mptrack/Ctrl_seq.cpp 2010-01-08 20:56:53 UTC (rev 459) +++ trunk/OpenMPT/mptrack/Ctrl_seq.cpp 2010-01-09 20:06:18 UTC (rev 460) @@ -71,7 +71,7 @@ BYTE COrderList::s_nDefaultMargins = 0; bool COrderList::IsOrderInMargins(int order, int startOrder) -//----------------------------------------------------- +//---------------------------------------------------------- { const BYTE nMargins = GetMargins(); return ((startOrder != 0 && order - startOrder < nMargins) || @@ -79,6 +79,29 @@ } +void COrderList::EnsureVisible(ORDERINDEX order) +//---------------------------------------------- +{ + // nothing needs to be done + if(!IsOrderInMargins(order, m_nXScroll) || order == ORDERINDEX_INVALID) return; + + if(order < m_nXScroll) + { + if(order < GetMargins()) + m_nXScroll = 0; + else + m_nXScroll = order - GetMargins(); + } else + { + m_nXScroll = order + 2 * GetMargins() - 1; + if(m_nXScroll < GetLength()) + m_nXScroll = 0; + else + m_nXScroll -= GetLength(); + } +} + + COrderList::COrderList() //---------------------- { @@ -235,6 +258,7 @@ return result; } + bool COrderList::SetCurSel(ORDERINDEX sel, bool bEdit, bool bShiftClick, bool bIgnoreCurSel) //------------------------------------------------------------------------------------------ { @@ -1165,6 +1189,12 @@ m_nScrollPos2nd = min(m_nScrollPos + nInsertCount, pSndFile->Order.GetLastIndex()); else m_nScrollPos2nd = ORDERINDEX_INVALID; + + InvalidateSelection(); + EnsureVisible(m_nScrollPos2nd); + // first inserted order has higher priority than the last one + EnsureVisible(m_nScrollPos); + InvalidateRect(NULL, FALSE); m_pModDoc->SetModified(); m_pModDoc->UpdateAllViews(NULL, HINT_MODSEQUENCE, this); @@ -1324,7 +1354,7 @@ BYTE COrderList::SetMargins(int i) -//---------------------------------------------- +//-------------------------------- { m_nOrderlistMargins = static_cast<BYTE>(i); return GetMargins(); Modified: trunk/OpenMPT/mptrack/Vstplug.cpp =================================================================== --- trunk/OpenMPT/mptrack/Vstplug.cpp 2010-01-08 20:56:53 UTC (rev 459) +++ trunk/OpenMPT/mptrack/Vstplug.cpp 2010-01-09 20:06:18 UTC (rev 460) @@ -669,7 +669,7 @@ pModDoc->RecordParamChange(pVstPlugin->GetSlot(), index); } - if (pModDoc && CMainFrame::GetInputHandler()->ShiftPressed() && pVstPlugin->GetEditor() && (pVstPlugin->GetEditor()->m_hWnd == ::GetForegroundWindow())) + if (pModDoc && CMainFrame::GetInputHandler()->ShiftPressed() && pVstPlugin->GetEditor() && (pVstPlugin->GetEditor()->m_hWnd == ::GetForegroundWindow() || ::IsChild(pVstPlugin->GetEditor()->m_hWnd, ::GetForegroundWindow()))) { CMainFrame::GetInputHandler()->SetModifierMask(0); // Make sure that the dialog will open only once. CAbstractVstEditor *pVstEditor = pVstPlugin->GetEditor(); Modified: trunk/OpenMPT/soundlib/Sndfile.cpp =================================================================== --- trunk/OpenMPT/soundlib/Sndfile.cpp 2010-01-08 20:56:53 UTC (rev 459) +++ trunk/OpenMPT/soundlib/Sndfile.cpp 2010-01-09 20:06:18 UTC (rev 460) @@ -667,7 +667,7 @@ pSmp->nLoopEnd = 0; } if (pSmp->nSustainEnd > pSmp->nLength) pSmp->nSustainEnd = pSmp->nLength; - if (pSmp->nSustainStart + 3 >= pSmp->nSustainEnd) + if (pSmp->nSustainStart >= pSmp->nSustainEnd) { pSmp->nSustainStart = 0; pSmp->nSustainEnd = 0; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |