From: <sag...@us...> - 2015-03-28 19:50:22
|
Revision: 4908 http://sourceforge.net/p/modplug/code/4908 Author: saga-games Date: 2015-03-28 19:50:09 +0000 (Sat, 28 Mar 2015) Log Message: ----------- [Mod] Tree view: When confirming the deletion of an unused pattern, show this in the message and default to Yes. [Fix] When loading a template, also reset the tracker ID string. Modified Paths: -------------- trunk/OpenMPT/mptrack/Mptrack.cpp trunk/OpenMPT/mptrack/View_tre.cpp Modified: trunk/OpenMPT/mptrack/Mptrack.cpp =================================================================== --- trunk/OpenMPT/mptrack/Mptrack.cpp 2015-03-28 01:04:29 UTC (rev 4907) +++ trunk/OpenMPT/mptrack/Mptrack.cpp 2015-03-28 19:50:09 UTC (rev 4908) @@ -158,9 +158,11 @@ CMainFrame::GetMainFrame()->UpdateTree(modDoc, GeneralHint().General()); // Reset edit history for template files - modDoc->GetrSoundFile().GetFileHistory().clear(); - modDoc->GetrSoundFile().m_dwCreatedWithVersion = MptVersion::num; - modDoc->GetrSoundFile().m_dwLastSavedWithVersion = 0; + CSoundFile &sndFile = modDoc->GetrSoundFile(); + sndFile.GetFileHistory().clear(); + sndFile.m_dwCreatedWithVersion = MptVersion::num; + sndFile.m_dwLastSavedWithVersion = 0; + sndFile.madeWithTracker.clear(); } else { // Remove extension from title, so that saving the file will not suggest a filename like e.g. "example.it.it". @@ -1803,7 +1805,7 @@ if(!dialogShown && GetTickCount() >= scanStart + 2000) { - // If this is taking too long, show the user what he's waiting for. + // If this is taking too long, show the user what they're waiting for. dialogShown = true; pluginScanDlg.Create(IDD_SCANPLUGINS, gpSplashScreen); pluginScanDlg.ShowWindow(SW_SHOW); Modified: trunk/OpenMPT/mptrack/View_tre.cpp =================================================================== --- trunk/OpenMPT/mptrack/View_tre.cpp 2015-03-28 01:04:29 UTC (rev 4907) +++ trunk/OpenMPT/mptrack/View_tre.cpp 2015-03-28 19:50:09 UTC (rev 4908) @@ -1547,10 +1547,27 @@ break; case MODITEM_PATTERN: - wsprintf(s, _T("Remove pattern %u?"), modItemID); - if(Reporting::Confirm(s, false, true) == cnfYes && modDoc->RemovePattern((PATTERNINDEX)modItemID)) { - modDoc->UpdateAllViews(nullptr, PatternHint((PATTERNINDEX)modItemID).Data().Names()); + CSoundFile &sndFile = modDoc->GetrSoundFile(); + bool isUsed = false; + // First, find all used patterns in all sequences. + for(SEQUENCEINDEX seq = 0; seq < sndFile.Order.GetNumSequences(); seq++) + { + const ORDERINDEX ordLength = sndFile.Order.GetSequence(seq).GetLength(); + for(ORDERINDEX ord = 0; ord < ordLength; ord++) + { + if(sndFile.Order.GetSequence(seq)[ord] == modItemID) + { + isUsed = true; + break; + } + } + } + wsprintf(s, _T("Remove pattern %u?\nThis pattern is currently%s used."), modItemID, isUsed ? _T("") : _T(" not")); + if(Reporting::Confirm(s, false, isUsed) == cnfYes && modDoc->RemovePattern((PATTERNINDEX)modItemID)) + { + modDoc->UpdateAllViews(nullptr, PatternHint((PATTERNINDEX)modItemID).Data().Names()); + } } break; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |