From: <sag...@us...> - 2010-02-21 12:35:42
|
Revision: 505 http://modplug.svn.sourceforge.net/modplug/?rev=505&view=rev Author: saga-games Date: 2010-02-21 12:35:33 +0000 (Sun, 21 Feb 2010) Log Message: ----------- [Fix] Treeview: Right-Click on module -> Close didn't ask for confirmation when the document was modified. [Ref] XM Loader: Rewrote some lines of the instrument loader so they wouldn't confuse the "MPT hack detector". Modified Paths: -------------- trunk/OpenMPT/mptrack/View_tre.cpp trunk/OpenMPT/soundlib/Load_xm.cpp Modified: trunk/OpenMPT/mptrack/View_tre.cpp =================================================================== --- trunk/OpenMPT/mptrack/View_tre.cpp 2010-02-20 23:13:54 UTC (rev 504) +++ trunk/OpenMPT/mptrack/View_tre.cpp 2010-02-21 12:35:33 UTC (rev 505) @@ -845,14 +845,14 @@ // Add Patterns if ((pInfo->hPatterns) && (hintFlagPart != HINT_INSNAMES) && (hintFlagPart != HINT_SMPNAMES)) { - const DWORD nPat = (lHint >> HINT_SHIFT_PAT); + const PATTERNINDEX nPat = (PATTERNINDEX)(lHint >> HINT_SHIFT_PAT); pInfo->tiPatterns.resize(pSndFile->Patterns.Size(), NULL); - UINT imin = 0, imax = pSndFile->Patterns.Size()-1; + PATTERNINDEX imin = 0, imax = pSndFile->Patterns.Size()-1; if ((hintFlagPart == HINT_PATNAMES) && (nPat < pSndFile->Patterns.Size())) imin = imax = nPat; BOOL bDelPat = FALSE; ASSERT(pInfo->tiPatterns.size() == pSndFile->Patterns.Size()); - for (UINT iPat=imin; iPat <= imax; iPat++) + for(PATTERNINDEX iPat = imin; iPat <= imax; iPat++) { if ((bDelPat) && (pInfo->tiPatterns[iPat])) { @@ -3222,5 +3222,9 @@ HTREEITEM hItem = GetSelectedItem(); CModDoc *pModDoc = GetDocumentFromItem(hItem); if(pModDoc == nullptr) return; - pModDoc->OnCloseDocument(); + // Spam our message to the first available view + POSITION pos = pModDoc->GetFirstViewPosition(); + if(pos == NULL) return; + CView* pView = pModDoc->GetNextView(pos); + if (pView) pView->PostMessage(WM_COMMAND, ID_FILE_CLOSE); } Modified: trunk/OpenMPT/soundlib/Load_xm.cpp =================================================================== --- trunk/OpenMPT/soundlib/Load_xm.cpp 2010-02-20 23:13:54 UTC (rev 504) +++ trunk/OpenMPT/soundlib/Load_xm.cpp 2010-02-21 12:35:33 UTC (rev 505) @@ -317,11 +317,8 @@ pih = (XMINSTRUMENTHEADER *)(lpStream + dwMemPos); if (dwMemPos + LittleEndian(pih->size) > dwMemLength) return true; - if ((Instruments[iIns] = new MODINSTRUMENT) == NULL) continue; - memset(Instruments[iIns], 0, sizeof(MODINSTRUMENT)); - Instruments[iIns]->pTuning = m_defaultInstrument.pTuning; - Instruments[iIns]->nPluginVelocityHandling = PLUGIN_VELOCITYHANDLING_CHANNEL; - Instruments[iIns]->nPluginVolumeHandling = PLUGIN_VOLUMEHANDLING_IGNORE; + if ((Instruments[iIns] = new MODINSTRUMENT) == nullptr) continue; + memcpy(Instruments[iIns], &m_defaultInstrument, sizeof(MODINSTRUMENT)); memcpy(Instruments[iIns]->name, pih->name, 22); SpaceToNullStringFixed(Instruments[iIns]->name, 22); @@ -392,7 +389,7 @@ n--; } #ifndef FASTSOUNDLIB - // Damn! more than 200 samples: look for duplicates + // Damn! Too many samples: look for duplicates if (!n) { if (!unused_samples) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |