From: <sag...@us...> - 2012-07-26 18:14:55
|
Revision: 1337 http://modplug.svn.sourceforge.net/modplug/?rev=1337&view=rev Author: saga-games Date: 2012-07-26 18:14:47 +0000 (Thu, 26 Jul 2012) Log Message: ----------- [Fix] Save All / Save None buttons in the Unsaved Files dialog didn't always work if there was only one unsaved file (http://bugs.openmpt.org/view.php?id=206, fix by coda) [Fix] Order list: When switching to the pattern tab for the first time, it shouldn't scroll the order list anymore if not necessary. [Fix] IT Loader: Silent samples were sometimes loaded into sample slots that were actually supposed to be empty. [Mod] Updated DE_jojo.mkb [Mod] OpenMPT: Version is now 1.20.02.04 Modified Paths: -------------- trunk/OpenMPT/mptrack/CloseMainDialog.cpp trunk/OpenMPT/mptrack/Ctrl_pat.cpp trunk/OpenMPT/mptrack/Ctrl_pat.h trunk/OpenMPT/mptrack/Ctrl_seq.cpp trunk/OpenMPT/mptrack/version.h trunk/OpenMPT/packageTemplate/extraKeymaps/DE_jojo.mkb trunk/OpenMPT/soundlib/Load_it.cpp Modified: trunk/OpenMPT/mptrack/CloseMainDialog.cpp =================================================================== --- trunk/OpenMPT/mptrack/CloseMainDialog.cpp 2012-07-21 18:00:54 UTC (rev 1336) +++ trunk/OpenMPT/mptrack/CloseMainDialog.cpp 2012-07-26 18:14:47 UTC (rev 1337) @@ -110,7 +110,10 @@ void CloseMainDialog::OnSaveAll() //------------------------------- { - m_List.SelItemRange(TRUE, 0, m_List.GetCount() - 1); + if(m_List.GetCount() == 1) + m_List.SetSel(0, TRUE); // SelItemRange can't select one item: http://support.microsoft.com/kb/129428/en-us + else + m_List.SelItemRange(TRUE, 0, m_List.GetCount() - 1); OnOK(); } @@ -118,7 +121,10 @@ void CloseMainDialog::OnSaveNone() //-------------------------------- { - m_List.SelItemRange(FALSE, 0, m_List.GetCount() - 1); + if(m_List.GetCount() == 1) + m_List.SetSel(0, FALSE); // SelItemRange can't select one item: http://support.microsoft.com/kb/129428/en-us + else + m_List.SelItemRange(FALSE, 0, m_List.GetCount() - 1); OnOK(); } Modified: trunk/OpenMPT/mptrack/Ctrl_pat.cpp =================================================================== --- trunk/OpenMPT/mptrack/Ctrl_pat.cpp 2012-07-21 18:00:54 UTC (rev 1336) +++ trunk/OpenMPT/mptrack/Ctrl_pat.cpp 2012-07-26 18:14:47 UTC (rev 1337) @@ -703,12 +703,11 @@ void CCtrlPatterns::OnOrderListMarginsChanged() //--------------------------------------------- { - BYTE i; + ORDERINDEX i; if((m_EditOrderListMargins.m_hWnd) && (m_EditOrderListMargins.IsWindowVisible()) && (m_EditOrderListMargins.GetWindowTextLength() > 0)) { i = m_OrderList.SetMargins(GetDlgItemInt(IDC_EDIT_ORDERLIST_MARGINS)); - } - else + } else { i = m_OrderList.GetMargins(); } Modified: trunk/OpenMPT/mptrack/Ctrl_pat.h =================================================================== --- trunk/OpenMPT/mptrack/Ctrl_pat.h 2012-07-21 18:00:54 UTC (rev 1336) +++ trunk/OpenMPT/mptrack/Ctrl_pat.h 2012-07-26 18:14:47 UTC (rev 1337) @@ -38,13 +38,13 @@ //m_nScrollPos2nd: 2nd selection point if multiple orders are selected // (not neccessarily the higher order - GetCurSel() is taking care of that.) ORDERINDEX m_nXScroll, m_nScrollPos, m_nScrollPos2nd, m_nDropPos; - bool m_bScrolling, m_bDragging; ORDERINDEX m_nDragOrder; //To tell how many orders('orderboxes') to show at least //on both sides of current order(when updating orderslist position). int m_nOrderlistMargins; CModDoc *m_pModDoc; CCtrlPatterns *m_pParent; + bool m_bScrolling, m_bDragging; public: COrderList(); @@ -56,7 +56,8 @@ UINT GetCurrentPattern() 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; + { + if(isSelectionKeyPressed && m_nScrollPos2nd == ORDERINDEX_INVALID) m_nScrollPos2nd = m_nScrollPos; else if(!isSelectionKeyPressed && m_nScrollPos2nd != ORDERINDEX_INVALID) m_nScrollPos2nd = ORDERINDEX_INVALID; }; bool SetCurSel(ORDERINDEX sel, bool bEdit = true, bool bShiftClick = false, bool bIgnoreCurSel = false); @@ -72,24 +73,24 @@ OrdSelection GetCurSel(bool bIgnoreSelection) const; // Sets target margin value and returns the effective margin value. - BYTE SetMargins(int); + ORDERINDEX SetMargins(int); // Returns the effective margin value. - BYTE GetMargins() { return GetMargins(GetMarginsMax()); } + ORDERINDEX GetMargins() { return GetMargins(GetMarginsMax()); } // Returns the effective margin value. - BYTE GetMargins(const BYTE nMaxMargins) const { return Util::Min(nMaxMargins, static_cast<BYTE>(m_nOrderlistMargins)); } + ORDERINDEX GetMargins(const ORDERINDEX maxMargins) const { return Util::Min(maxMargins, static_cast<ORDERINDEX>(m_nOrderlistMargins)); } // Returns maximum margin value given current window width. - BYTE GetMarginsMax() { return GetMarginsMax(GetLength()); } + ORDERINDEX GetMarginsMax() { return GetMarginsMax(GetLength()); } // Returns maximum margin value when shown sequence has nLength orders. // For example: If length is 4 orders -> maxMargins = 4/2 - 1 = 1; // if maximum is 5 -> maxMargins = (int)5/2 = 2 - BYTE GetMarginsMax(const BYTE nLength) const { return (nLength > 0 && nLength % 2 == 0) ? nLength / 2 - 1 : nLength / 2; } + ORDERINDEX GetMarginsMax(const ORDERINDEX length) const { return (length > 0 && length % 2 == 0) ? length / 2 - 1 : length / 2; } // Returns the number of sequence items visible in the list. - BYTE GetLength(); + ORDERINDEX GetLength(); // Return true if given order is in margins given that first shown order // is 'startOrder'. Begin part of the whole sequence @@ -158,6 +159,8 @@ }; +// CPatEdit: Edit control that switches back to the pattern view if Tab key is pressed. + //========================== class CPatEdit: public CEdit //========================== @@ -166,7 +169,7 @@ CCtrlPatterns *m_pParent; public: - CPatEdit() { m_pParent = NULL; } + CPatEdit() { m_pParent = nullptr; } void SetParent(CCtrlPatterns *parent) { m_pParent = parent; } virtual BOOL PreTranslateMessage(MSG *pMsg); }; Modified: trunk/OpenMPT/mptrack/Ctrl_seq.cpp =================================================================== --- trunk/OpenMPT/mptrack/Ctrl_seq.cpp 2012-07-21 18:00:54 UTC (rev 1336) +++ trunk/OpenMPT/mptrack/Ctrl_seq.cpp 2012-07-26 18:14:47 UTC (rev 1337) @@ -85,7 +85,7 @@ bool COrderList::IsOrderInMargins(int order, int startOrder) //---------------------------------------------------------- { - const BYTE nMargins = GetMargins(); + const ORDERINDEX nMargins = GetMargins(); return ((startOrder != 0 && order - startOrder < nMargins) || order - startOrder >= GetLength() - nMargins); } @@ -237,23 +237,23 @@ } -BYTE COrderList::GetLength() -//-------------------------- +ORDERINDEX COrderList::GetLength() +//-------------------------------- { CRect rcClient; GetClientRect(&rcClient); if(m_cxFont > 0) - return static_cast<BYTE>(rcClient.right / m_cxFont); + return static_cast<ORDERINDEX>(rcClient.right / m_cxFont); else { const int nFontWidth = GetFontWidth(); - return (nFontWidth > 0) ? static_cast<BYTE>(rcClient.right / nFontWidth) : 0; + return (nFontWidth > 0) ? static_cast<ORDERINDEX>(rcClient.right / nFontWidth) : 0; } } OrdSelection COrderList::GetCurSel(bool bIgnoreSelection) const -//-------------------------------------------------------------- +//------------------------------------------------------------- { // returns the currently selected order(s) OrdSelection result; @@ -277,33 +277,33 @@ { CMainFrame *pMainFrm = CMainFrame::GetMainFrame(); CSoundFile *pSndFile = m_pModDoc->GetSoundFile(); - ORDERINDEX *nOrder = (bShiftClick) ? &m_nScrollPos2nd : &m_nScrollPos; + ORDERINDEX &nOrder = bShiftClick ? m_nScrollPos2nd : m_nScrollPos; if ((sel < 0) || (sel >= pSndFile->Order.GetLength()) || (!m_pParent) || (!pMainFrm)) return false; - if (!bIgnoreCurSel && sel == *nOrder) return true; - const BYTE nShownLength = GetLength(); + if (!bIgnoreCurSel && sel == nOrder) return true; + const ORDERINDEX nShownLength = GetLength(); InvalidateSelection(); - *nOrder = sel; + nOrder = sel; if (!m_bScrolling) { - const BYTE nMargins = GetMargins(GetMarginsMax(nShownLength)); - if ((*nOrder < m_nXScroll + nMargins) || (!m_cxFont) || (!m_cyFont)) + const ORDERINDEX nMargins = GetMargins(GetMarginsMax(nShownLength)); + if(nOrder < m_nXScroll + nMargins) { // Must move first shown sequence item to left in order to show // the new active order. - m_nXScroll = max(0, *nOrder - nMargins); + m_nXScroll = Util::Max(ORDERINDEX(0), static_cast<ORDERINDEX>(nOrder - nMargins)); SetScrollPos(SB_HORZ, m_nXScroll); InvalidateRect(NULL, FALSE); } else { ORDERINDEX maxsel = nShownLength; if (maxsel) maxsel--; - if (*nOrder - m_nXScroll >= maxsel - nMargins) + if (nOrder - m_nXScroll >= maxsel - nMargins) { // Must move first shown sequence item to right in order to show // the new active order. - m_nXScroll = *nOrder - (maxsel - nMargins); + m_nXScroll = nOrder - (maxsel - nMargins); SetScrollPos(SB_HORZ, m_nXScroll); InvalidateRect(NULL, FALSE); } @@ -1475,8 +1475,8 @@ } -BYTE COrderList::SetMargins(int i) -//-------------------------------- +ORDERINDEX COrderList::SetMargins(int i) +//-------------------------------------- { m_nOrderlistMargins = i; return GetMargins(); Modified: trunk/OpenMPT/mptrack/version.h =================================================================== --- trunk/OpenMPT/mptrack/version.h 2012-07-21 18:00:54 UTC (rev 1336) +++ trunk/OpenMPT/mptrack/version.h 2012-07-26 18:14:47 UTC (rev 1337) @@ -19,7 +19,7 @@ #define VER_MAJORMAJOR 1 #define VER_MAJOR 20 #define VER_MINOR 02 -#define VER_MINORMINOR 03 +#define VER_MINORMINOR 04 //Creates version number from version parts that appears in version string. //For example MAKE_VERSION_NUMERIC(1,17,02,28) gives version number of Modified: trunk/OpenMPT/packageTemplate/extraKeymaps/DE_jojo.mkb =================================================================== --- trunk/OpenMPT/packageTemplate/extraKeymaps/DE_jojo.mkb 2012-07-21 18:00:54 UTC (rev 1336) +++ trunk/OpenMPT/packageTemplate/extraKeymaps/DE_jojo.mkb 2012-07-26 18:14:47 UTC (rev 1337) @@ -387,6 +387,8 @@ 19:1876:2:85:1 //Unlock Playback: Ctrl+U (KeyDown) //----( Quick Channel Settings Context (20) )------------ -20:1878:2:8:5 //Previous Channel: Ctrl+R\xDCCK (KeyDown|KeyHold) -20:1879:0:13:5 //Next Channel: EINGABE (KeyDown|KeyHold) -20:1880:1:13:1 //Switch to Pattern Editor: Shift+EINGABE (KeyDown) +20:1878:1:37:5 //Previous Channel: Shift+NACH-LINKS (KeyDown|KeyHold) +20:1878:1:8:5 //Previous Channel: Shift+R\xDCCK (KeyDown|KeyHold) +20:1879:1:39:5 //Next Channel: Shift+NACH-RECHTS (KeyDown|KeyHold) +20:1879:1:13:5 //Next Channel: Shift+EINGABE (KeyDown|KeyHold) +20:1880:0:13:1 //Switch to Pattern Editor: EINGABE (KeyDown) Modified: trunk/OpenMPT/soundlib/Load_it.cpp =================================================================== --- trunk/OpenMPT/soundlib/Load_it.cpp 2012-07-21 18:00:54 UTC (rev 1336) +++ trunk/OpenMPT/soundlib/Load_it.cpp 2012-07-26 18:14:47 UTC (rev 1337) @@ -756,13 +756,16 @@ for (UINT nsmp = 0; nsmp < m_nSamples; nsmp++) if ((smppos[nsmp]) && (smppos[nsmp] <= dwMemLength - sizeof(ITSample))) { ITSample *pis = (ITSample *)(lpStream+smppos[nsmp]); - if (pis->id == LittleEndian(ITSample::magic)) + if(pis->id == LittleEndian(ITSample::magic)) { size_t sampleOffset = pis->ConvertToMPT(Samples[nsmp + 1]); StringFixer::ReadString<StringFixer::spacePadded>(m_szNames[nsmp + 1], pis->name); - lastSampleOffset = Util::Max(lastSampleOffset, sampleOffset + pis->GetSampleFormat(itHeader.cwtv).ReadSample(Samples[nsmp + 1], (LPSTR)(lpStream + sampleOffset), dwMemLength - sampleOffset)); + if(sampleOffset < dwMemLength) + { + lastSampleOffset = Util::Max(lastSampleOffset, sampleOffset + pis->GetSampleFormat(itHeader.cwtv).ReadSample(Samples[nsmp + 1], lpStream + sampleOffset, dwMemLength - sampleOffset)); + } } } m_nSamples = max(1, m_nSamples); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |