From: <sag...@us...> - 2015-07-01 19:41:09
|
Revision: 5387 http://sourceforge.net/p/modplug/code/5387 Author: saga-games Date: 2015-07-01 19:41:03 +0000 (Wed, 01 Jul 2015) Log Message: ----------- [Fix] Instrument tab: When creating the first instrument failed, revert adding the instrument slot. [Fix] General tab: Setting plugin gain didn't update the display (http://bugs.openmpt.org/view.php?id=688) Modified Paths: -------------- trunk/OpenMPT/mptrack/Ctrl_ins.cpp trunk/OpenMPT/mptrack/View_gen.cpp Modified: trunk/OpenMPT/mptrack/Ctrl_ins.cpp =================================================================== --- trunk/OpenMPT/mptrack/Ctrl_ins.cpp 2015-06-30 23:21:54 UTC (rev 5386) +++ trunk/OpenMPT/mptrack/Ctrl_ins.cpp 2015-07-01 19:41:03 UTC (rev 5387) @@ -1429,8 +1429,6 @@ BOOL CCtrlInstruments::OpenInstrument(const mpt::PathString &fileName) //-------------------------------------------------------------------- { - BOOL bFirst, bOk; - BeginWaitCursor(); InputFile f(fileName); if(!f.IsValid()) @@ -1438,29 +1436,37 @@ EndWaitCursor(); return FALSE; } - bFirst = FALSE; FileReader file = GetFileReader(f); - bOk = FALSE; + bool first = false, ok = false; if (file.IsValid()) { if (!m_sndFile.GetNumInstruments()) { - bFirst = TRUE; + first = true; m_sndFile.m_nInstruments = 1; - m_NoteMap.SetCurrentInstrument(1); m_modDoc.SetModified(); } if (!m_nInstrument) m_nInstrument = 1; if (m_sndFile.ReadInstrumentFromFile(m_nInstrument, file, TrackerSettings::Instance().m_MayNormalizeSamplesOnLoad)) { - bOk = TRUE; + ok = true; } } + if(!ok && first) + { + // Undo adding the instrument + delete m_sndFile.Instruments[1]; + m_sndFile.m_nInstruments = 0; + } else if(ok && first) + { + m_NoteMap.SetCurrentInstrument(1); + } + EndWaitCursor(); - if (bOk) + if (ok) { TrackerSettings::Instance().PathInstruments.SetWorkingDir(fileName, true); ModInstrument *pIns = m_sndFile.Instruments[m_nInstrument]; @@ -1481,15 +1487,15 @@ SetCurrentInstrument(m_nInstrument); InstrumentHint hint = InstrumentHint().Info().Envelope().Names(); - if(bFirst) hint.ModType(); + if(first) hint.ModType(); SetModified(hint, true); - } else bOk = FALSE; + } else ok = FALSE; } SampleHint hint = SampleHint().Info().Data().Names(); - if (bFirst) hint.ModType(); + if (first) hint.ModType(); m_modDoc.UpdateAllViews(nullptr, hint, this); - if (!bOk) ErrorBox(IDS_ERR_FILETYPE, this); - return bOk; + if (!ok) ErrorBox(IDS_ERR_FILETYPE, this); + return ok; } Modified: trunk/OpenMPT/mptrack/View_gen.cpp =================================================================== --- trunk/OpenMPT/mptrack/View_gen.cpp 2015-06-30 23:21:54 UTC (rev 5386) +++ trunk/OpenMPT/mptrack/View_gen.cpp 2015-07-01 19:41:03 UTC (rev 5387) @@ -807,7 +807,7 @@ float fValue = 0.1f * (float)gain; _stprintf(s, _T("Gain: x %1.1f"), fValue); - SetDlgItemText(IDC_EDIT16, s); + SetDlgItemText(IDC_STATIC2, s); SetPluginModified(); } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |