From: <sag...@us...> - 2012-02-14 21:41:22
|
Revision: 1180 http://modplug.svn.sourceforge.net/modplug/?rev=1180&view=rev Author: saga-games Date: 2012-02-14 21:41:16 +0000 (Tue, 14 Feb 2012) Log Message: ----------- [Fix] Sample Editor: When converting between XM and IT / MPTM, sample pan limit was not updated instantly. [Fix] VST Editor: Don't try to resize editor when it is actually not visible (some plugins like Sylenth send resize messages even if their editor is hidden) [Ref] const refactoring. Modified Paths: -------------- trunk/OpenMPT/mptrack/Ctrl_smp.cpp trunk/OpenMPT/mptrack/VSTEditor.cpp trunk/OpenMPT/soundlib/Load_it.cpp trunk/OpenMPT/soundlib/pattern.cpp trunk/OpenMPT/soundlib/pattern.h Modified: trunk/OpenMPT/mptrack/Ctrl_smp.cpp =================================================================== --- trunk/OpenMPT/mptrack/Ctrl_smp.cpp 2012-02-14 21:39:32 UTC (rev 1179) +++ trunk/OpenMPT/mptrack/Ctrl_smp.cpp 2012-02-14 21:41:16 UTC (rev 1180) @@ -221,15 +221,6 @@ // Setup Controls m_SpinVolume.SetRange(0, 64); m_SpinGlobalVol.SetRange(0, 64); - //rewbs.fix36944 - if (m_pSndFile->GetType() == MOD_TYPE_XM) - { - m_SpinPanning.SetRange(0, 255); - } else - { - m_SpinPanning.SetRange(0, 64); - } - //end rewbs.fix36944 // Auto vibrato m_ComboAutoVib.AddString("Sine"); @@ -638,6 +629,7 @@ m_CheckPanning.EnableWindow(b && !(m_pSndFile->GetType() & MOD_TYPE_XM)); m_EditPanning.EnableWindow(b); m_SpinPanning.EnableWindow(b); + m_SpinPanning.SetRange(0, (m_pSndFile->GetType() == MOD_TYPE_XM) ? 255 : 64); b = (m_pSndFile->GetType() & MOD_TYPE_MOD) ? FALSE : TRUE; m_CbnBaseNote.EnableWindow(b); Modified: trunk/OpenMPT/mptrack/VSTEditor.cpp =================================================================== --- trunk/OpenMPT/mptrack/VSTEditor.cpp 2012-02-14 21:39:32 UTC (rev 1179) +++ trunk/OpenMPT/mptrack/VSTEditor.cpp 2012-02-14 21:41:16 UTC (rev 1180) @@ -127,7 +127,7 @@ bool COwnerVstEditor::SetSize(int contentWidth, int contentHeight) //---------------------------------------------------------------- { - if(contentWidth < 0 || contentHeight < 0) + if(contentWidth < 0 || contentHeight < 0 || !m_hWnd) { return false; } Modified: trunk/OpenMPT/soundlib/Load_it.cpp =================================================================== --- trunk/OpenMPT/soundlib/Load_it.cpp 2012-02-14 21:39:32 UTC (rev 1179) +++ trunk/OpenMPT/soundlib/Load_it.cpp 2012-02-14 21:41:16 UTC (rev 1180) @@ -472,8 +472,8 @@ } -void CopyPatternName(CPattern &pattern, char **patNames, UINT &patNamesLen) -//------------------------------------------------------------------------- +void CopyPatternName(CPattern &pattern, const char **patNames, UINT &patNamesLen) +//------------------------------------------------------------------------------- { if(*patNames != nullptr && patNamesLen > 0) { @@ -758,7 +758,7 @@ #ifdef MODPLUG_TRACKER if(GetpModDoc() != nullptr) { - GetpModDoc()->GetFileHistory().clear(); + GetpModDoc()->GetFileHistory().resize(nflt); for(size_t n = 0; n < nflt; n++) { ITHISTORYSTRUCT itHistory = *((ITHISTORYSTRUCT *)(lpStream + dwMemPos)); @@ -776,7 +776,7 @@ mptHistory.loadDate.tm_min = CLAMP((itHistory.fattime >> 5) & 0x3F, 0, 59); mptHistory.loadDate.tm_sec = CLAMP((itHistory.fattime & 0x1F) * 2, 0, 59); mptHistory.openTime = itHistory.runtime * (HISTORY_TIMER_PRECISION / 18.2f); - GetpModDoc()->GetFileHistory().push_back(mptHistory); + GetpModDoc()->GetFileHistory().at(n) = mptHistory; #ifdef DEBUG const uint32 seconds = (uint32)(((double)itHistory.runtime) / 18.2f); @@ -828,7 +828,7 @@ } // Read pattern names: "PNAM" - char *patNames = nullptr; + const char *patNames = nullptr; UINT patNamesLen = 0; if ((dwMemPos + 8 < dwMemLength) && (*((DWORD *)(lpStream+dwMemPos)) == LittleEndian(IT_PNAM))) { @@ -847,14 +847,14 @@ { UINT len = *((DWORD *)(lpStream+dwMemPos+4)); dwMemPos += 8; - if ((dwMemPos + len <= dwMemLength) && (len <= MAX_BASECHANNELS*MAX_CHANNELNAME)) + if ((dwMemPos + len <= dwMemLength) && (len <= MAX_BASECHANNELS * MAX_CHANNELNAME)) { UINT n = len / MAX_CHANNELNAME; if (n > m_nChannels) m_nChannels = n; for (UINT i=0; i<n; i++) { - memcpy(ChnSettings[i].szName, (lpStream+dwMemPos+i*MAX_CHANNELNAME), MAX_CHANNELNAME); - ChnSettings[i].szName[MAX_CHANNELNAME-1] = 0; + memcpy(ChnSettings[i].szName, (lpStream + dwMemPos + i * MAX_CHANNELNAME), MAX_CHANNELNAME); + ChnSettings[i].szName[MAX_CHANNELNAME - 1] = 0; } dwMemPos += len; } @@ -1090,7 +1090,7 @@ UINT len = *((WORD *)(lpStream+patpos[npat])); UINT rows = *((WORD *)(lpStream+patpos[npat]+2)); if ((rows < GetModSpecifications().patternRowsMin) || (rows > GetModSpecifications().patternRowsMax)) continue; - if (patpos[npat]+8+len > dwMemLength) continue; + if (patpos[npat] + 8 + len > dwMemLength) continue; if(Patterns.Insert(npat, rows)) continue; @@ -2078,7 +2078,6 @@ return (retval >> (32-i)); } -#define IT215_SUPPORT void ITUnpack8Bit(LPSTR pSample, DWORD dwLen, LPBYTE lpMemFile, DWORD dwMemLength, BOOL b215) //------------------------------------------------------------------------------------------- { @@ -2143,11 +2142,8 @@ wBits += bTemp; bTemp = (BYTE)wBits; bTemp2 += bTemp; -#ifdef IT215_SUPPORT pDst[dwPos] = (b215) ? bTemp2 : bTemp; -#else - pDst[dwPos] = bTemp; -#endif + SkipByte: dwPos++; Next: @@ -2226,11 +2222,8 @@ dwBits += wTemp; wTemp = (signed short)dwBits; wTemp2 += wTemp; -#ifdef IT215_SUPPORT pDst[dwPos] = (b215) ? wTemp2 : wTemp; -#else - pDst[dwPos] = wTemp; -#endif + SkipByte: dwPos++; Next: @@ -2315,7 +2308,7 @@ s[0] = 'P'; s[1] = 'R'; s[2] = 'O'; s[3] = 'G'; fwrite(s, 1, 4, f); //Write chunk data itself (Could include size if you want variable size. Not necessary here.) - fwrite(&(m_MixPlugins[i].defaultProgram), 1, sizeof(float), f); + fwrite(&(m_MixPlugins[i].defaultProgram), 1, sizeof(long), f); //} //end rewbs.plugDefaultProgram @@ -2577,11 +2570,11 @@ fwrite(&size, 1, sizeof(__int16), f); fwrite(&m_nChannels, 1, size, f); - if(TypeIsIT_MPT() && m_nChannels > 64) //IT header has room only for 64 channels. Save the + if(TypeIsIT_MPT() && GetNumChannels() > 64) //IT header has room only for 64 channels. Save the { //settings that do not fit to the header here as an extension. code = 'ChnS'; fwrite(&code, 1, sizeof(__int32), f); - size = (m_nChannels - 64)*2; + size = (GetNumChannels() - 64) * 2; fwrite(&size, 1, sizeof(__int16), f); for(UINT ich = 64; ich < m_nChannels; ich++) { Modified: trunk/OpenMPT/soundlib/pattern.cpp =================================================================== --- trunk/OpenMPT/soundlib/pattern.cpp 2012-02-14 21:39:32 UTC (rev 1179) +++ trunk/OpenMPT/soundlib/pattern.cpp 2012-02-14 21:41:16 UTC (rev 1180) @@ -216,8 +216,8 @@ } -bool CPattern::SetName(char *newName, size_t maxChars) -//---------------------------------------------------- +bool CPattern::SetName(const char *newName, size_t maxChars) +//---------------------------------------------------------- { if(newName == nullptr || maxChars == 0) { @@ -280,9 +280,9 @@ bool CPattern::WriteITPdata(FILE* f) const //---------------------------------------- { - for(ROWINDEX r = 0; r<GetNumRows(); r++) + for(ROWINDEX r = 0; r < GetNumRows(); r++) { - for(CHANNELINDEX c = 0; c<GetNumChannels(); c++) + for(CHANNELINDEX c = 0; c < GetNumChannels(); c++) { MODCOMMAND mc = GetModCommand(r,c); fwrite(&mc, sizeof(MODCOMMAND), 1, f); @@ -302,7 +302,7 @@ while(streamPos - startPos + sizeof(MODCOMMAND_ORIGINAL) <= datasize) { MODCOMMAND_ORIGINAL temp; - memcpy(&temp, lpStream+streamPos, sizeof(MODCOMMAND_ORIGINAL)); + memcpy(&temp, lpStream + streamPos, sizeof(MODCOMMAND_ORIGINAL)); MODCOMMAND& mc = GetModCommand(counter); mc.command = temp.command; mc.instr = temp.instr; @@ -416,7 +416,7 @@ for(CHANNELINDEX c = 0; c<chns; c++) { const MODCOMMAND m = *pat.GetpModCommand(r, c); - // Writing only commands not writting in IT-pattern writing: + // Writing only commands not written in IT-pattern writing: // For now this means only NOTE_PC and NOTE_PCS. if(!m.IsPcNote()) continue; Modified: trunk/OpenMPT/soundlib/pattern.h =================================================================== --- trunk/OpenMPT/soundlib/pattern.h 2012-02-14 21:39:32 UTC (rev 1179) +++ trunk/OpenMPT/soundlib/pattern.h 2012-02-14 21:41:16 UTC (rev 1180) @@ -73,8 +73,8 @@ void RemoveSignature() { m_RowsPerBeat = m_RowsPerMeasure = 0; } // Patter name functions (for both CString and char[] arrays) - bool functions return true on success. - bool SetName(char *newName, size_t maxChars = MAX_PATTERNNAME); - bool SetName(CString newName) { m_PatternName = newName; return true; }; + bool SetName(const char *newName, size_t maxChars = MAX_PATTERNNAME); + bool SetName(const CString newName) { m_PatternName = newName; return true; }; bool GetName(char *buffer, size_t maxChars = MAX_PATTERNNAME) const; CString GetName() const { return m_PatternName; }; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |