From: <sag...@us...> - 2011-09-03 21:47:01
|
Revision: 1015 http://modplug.svn.sourceforge.net/modplug/?rev=1015&view=rev Author: saga-games Date: 2011-09-03 21:46:53 +0000 (Sat, 03 Sep 2011) Log Message: ----------- [Fix] After a messagebox was shown, shortcuts didn't work anymore [Ref] More messagebox related refactoring. Modified Paths: -------------- trunk/OpenMPT/common/Reporting.cpp trunk/OpenMPT/common/Reporting.h trunk/OpenMPT/mptrack/AbstractVstEditor.cpp trunk/OpenMPT/mptrack/Childfrm.h trunk/OpenMPT/mptrack/CommandSet.cpp trunk/OpenMPT/mptrack/CreditStatic.h trunk/OpenMPT/mptrack/Ctrl_smp.cpp trunk/OpenMPT/mptrack/ExceptionHandler.cpp trunk/OpenMPT/mptrack/Globals.h trunk/OpenMPT/mptrack/InputHandler.cpp trunk/OpenMPT/mptrack/KeyConfigDlg.cpp trunk/OpenMPT/mptrack/Mainfrm.h trunk/OpenMPT/mptrack/Mod2wave.cpp trunk/OpenMPT/mptrack/Moddoc.cpp trunk/OpenMPT/mptrack/Modedit.cpp trunk/OpenMPT/mptrack/Moptions.cpp trunk/OpenMPT/mptrack/Mptrack.cpp trunk/OpenMPT/mptrack/Mptrack.h trunk/OpenMPT/mptrack/SampleEditorDialogs.cpp trunk/OpenMPT/mptrack/SelectPluginDialog.cpp trunk/OpenMPT/mptrack/View_smp.cpp trunk/OpenMPT/mptrack/View_tre.cpp trunk/OpenMPT/soundlib/Sampleio.cpp Modified: trunk/OpenMPT/common/Reporting.cpp =================================================================== --- trunk/OpenMPT/common/Reporting.cpp 2011-09-03 19:42:29 UTC (rev 1014) +++ trunk/OpenMPT/common/Reporting.cpp 2011-09-03 21:46:53 UTC (rev 1015) @@ -12,15 +12,16 @@ #include "Reporting.h" #include "../mptrack/Mainfrm.h" -UINT Reporting::Notification(CString text, UINT flags /* = MB_OK*/, HWND parent /* = NULL*/) -//------------------------------------------------------------------------------------------ + +UINT Reporting::Notification(CString text, UINT flags, CWnd *parent) +//------------------------------------------------------------------ { return Notification(text, MAINFRAME_TITLE, flags, parent); -}; +} -UINT Reporting::Notification(CString text, CString caption, UINT flags /* = MB_OK*/, HWND parent /* = NULL*/) -//----------------------------------------------------------------------------------------------------------- +UINT Reporting::Notification(CString text, CString caption, UINT flags, CWnd *parent) +//----------------------------------------------------------------------------------- { CMainFrame *pMainFrm = CMainFrame::GetMainFrame(); @@ -29,10 +30,12 @@ pMainFrm->GetInputHandler()->Bypass(true); } - return ::MessageBox(parent, text, caption, flags); + UINT result = ::MessageBox((parent ? parent->m_hWnd : NULL), text, caption, flags); if(pMainFrm != nullptr && pMainFrm->GetInputHandler() != nullptr) { pMainFrm->GetInputHandler()->Bypass(false); } -}; + + return result; +} Modified: trunk/OpenMPT/common/Reporting.h =================================================================== --- trunk/OpenMPT/common/Reporting.h 2011-09-03 19:42:29 UTC (rev 1014) +++ trunk/OpenMPT/common/Reporting.h 2011-09-03 21:46:53 UTC (rev 1015) @@ -19,8 +19,8 @@ public: - static UINT Notification(CString text, UINT flags = MB_OK, HWND parent = NULL); - static UINT Notification(CString text, CString caption, UINT flags = MB_OK, HWND parent = NULL); + static UINT Notification(CString text, UINT flags = MB_OK, CWnd *parent = nullptr); + static UINT Notification(CString text, CString caption, UINT flags = MB_OK, CWnd *parent = nullptr); }; Modified: trunk/OpenMPT/mptrack/AbstractVstEditor.cpp =================================================================== --- trunk/OpenMPT/mptrack/AbstractVstEditor.cpp 2011-09-03 19:42:29 UTC (rev 1014) +++ trunk/OpenMPT/mptrack/AbstractVstEditor.cpp 2011-09-03 21:46:53 UTC (rev 1015) @@ -355,7 +355,7 @@ return false; if(!m_pVstPlugin->isInstrument() || pModDoc->GetSoundFile()->GetModSpecifications().instrumentsMax == 0 || - Reporting::Notification(_T("You need to assign an instrument to this plugin before you can play notes from here.\nCreate a new instrument and assign this plugin to the instrument?"), MB_YESNO | MB_ICONQUESTION, this->m_hWnd) == IDNO) + Reporting::Notification(_T("You need to assign an instrument to this plugin before you can play notes from here.\nCreate a new instrument and assign this plugin to the instrument?"), MB_YESNO | MB_ICONQUESTION, this) == IDNO) { return false; } else @@ -655,7 +655,6 @@ void CAbstractVstEditor::OnInitMenu(CMenu* /*pMenu*/) //--------------------------------------------------- { - //AfxMessageBox(""); SetupMenu(); } Modified: trunk/OpenMPT/mptrack/Childfrm.h =================================================================== --- trunk/OpenMPT/mptrack/Childfrm.h 2011-09-03 19:42:29 UTC (rev 1014) +++ trunk/OpenMPT/mptrack/Childfrm.h 2011-09-03 21:46:53 UTC (rev 1015) @@ -2,12 +2,9 @@ // ///////////////////////////////////////////////////////////////////////////// -#if !defined(AFX_CHILDFRM_H__AE144DCA_DD0B_11D1_AF24_444553540000__INCLUDED_) -#define AFX_CHILDFRM_H__AE144DCA_DD0B_11D1_AF24_444553540000__INCLUDED_ - -#if _MSC_VER >= 1000 #pragma once -#endif // _MSC_VER >= 1000 +#ifndef CHILDFRM_H +#define CHILDFRM_H class CModControlDlg; @@ -155,4 +152,4 @@ //{{AFX_INSERT_LOCATION}} // Microsoft Developer Studio will insert additional declarations immediately before the previous line. -#endif // !defined(AFX_CHILDFRM_H__AE144DCA_DD0B_11D1_AF24_444553540000__INCLUDED_) +#endif // CHILDFRM_H Modified: trunk/OpenMPT/mptrack/CommandSet.cpp =================================================================== --- trunk/OpenMPT/mptrack/CommandSet.cpp 2011-09-03 19:42:29 UTC (rev 1014) +++ trunk/OpenMPT/mptrack/CommandSet.cpp 2011-09-03 21:46:53 UTC (rev 1015) @@ -3,6 +3,7 @@ #include "stdafx.h" #include "commandset.h" #include "resource.h" +#include "Mptrack.h" // For MsgBox #include "../common/Reporting.h" #include <stdio.h> #include <stdlib.h> @@ -1423,7 +1424,7 @@ if( (outStream = fopen( fileName, "w" )) == NULL ) { - AfxMessageBox(IDS_CANT_OPEN_FILE_FOR_WRITING, MB_ICONEXCLAMATION|MB_OK); + MsgBox(IDS_CANT_OPEN_FILE_FOR_WRITING, NULL, NULL, MB_ICONEXCLAMATION | MB_OK); return false; } fprintf(outStream, "//-------- OpenMPT key binding definition file -------\n"); Modified: trunk/OpenMPT/mptrack/CreditStatic.h =================================================================== --- trunk/OpenMPT/mptrack/CreditStatic.h 2011-09-03 19:42:29 UTC (rev 1014) +++ trunk/OpenMPT/mptrack/CreditStatic.h 2011-09-03 21:46:53 UTC (rev 1015) @@ -1,9 +1,7 @@ -#if !defined(AFX_CREDITSTATIC_H__4ABD7701_49F5_11D1_9E3C_00A0245800CF__INCLUDED_) -#define AFX_CREDITSTATIC_H__4ABD7701_49F5_11D1_9E3C_00A0245800CF__INCLUDED_ - -#if _MSC_VER >= 1000 #pragma once -#endif // _MSC_VER >= 1000 +#ifndef CREDITSTATIC_H +#define CREDITSTATIC_H + // CreditStatic.h : header file // @@ -117,4 +115,4 @@ //{{AFX_INSERT_LOCATION}} // Microsoft Developer Studio will insert additional declarations immediately before the previous line. -#endif // !defined(AFX_CREDITSTATIC_H__4ABD7701_49F5_11D1_9E3C_00A0245800CF__INCLUDED_) +#endif // CREDITSTATIC_H Modified: trunk/OpenMPT/mptrack/Ctrl_smp.cpp =================================================================== --- trunk/OpenMPT/mptrack/Ctrl_smp.cpp 2011-09-03 19:42:29 UTC (rev 1014) +++ trunk/OpenMPT/mptrack/Ctrl_smp.cpp 2011-09-03 21:46:53 UTC (rev 1015) @@ -623,6 +623,10 @@ // Updating Values if (dwHintMask & (HINT_MODTYPE|HINT_SAMPLEINFO)) { + if(m_nSample > m_pSndFile->GetNumSamples()) + { + SetCurrentSample(m_pSndFile->GetNumSamples()); + } const MODSAMPLE &sample = m_pSndFile->GetSample(m_nSample); CHAR s[128]; DWORD d; @@ -1873,7 +1877,7 @@ } if (handleSt == NULL) { - AfxMessageBox(IDS_SOUNDTOUCH_LOADFAILURE); + MsgBox(IDS_SOUNDTOUCH_LOADFAILURE); return -1; } Modified: trunk/OpenMPT/mptrack/ExceptionHandler.cpp =================================================================== --- trunk/OpenMPT/mptrack/ExceptionHandler.cpp 2011-09-03 19:42:29 UTC (rev 1014) +++ trunk/OpenMPT/mptrack/ExceptionHandler.cpp 2011-09-03 21:46:53 UTC (rev 1015) @@ -49,7 +49,6 @@ //------------------------------------------------------------------------------------------------------------ { CMainFrame* pMainFrame = CMainFrame::GetMainFrame(); - const HWND window = (pMainFrame ? pMainFrame->m_hWnd : NULL); // Shut down audio device... if(pMainFrame) @@ -137,7 +136,7 @@ } } - Reporting::Notification(errorMessage, "OpenMPT Crash", MB_ICONERROR, window); + Reporting::Notification(errorMessage, "OpenMPT Crash", MB_ICONERROR, pMainFrame); // Let Windows handle the exception... return EXCEPTION_CONTINUE_SEARCH; Modified: trunk/OpenMPT/mptrack/Globals.h =================================================================== --- trunk/OpenMPT/mptrack/Globals.h 2011-09-03 19:42:29 UTC (rev 1014) +++ trunk/OpenMPT/mptrack/Globals.h 2011-09-03 21:46:53 UTC (rev 1015) @@ -2,14 +2,11 @@ // ///////////////////////////////////////////////////////////////////////////// +#pragma once #ifndef _MODGLOBALS_H_ #define _MODGLOBALS_H_ -#if _MSC_VER >= 1000 -#pragma once -#endif // _MSC_VER >= 1000 - #ifndef WM_HELPHITTEST #define WM_HELPHITTEST 0x366 #endif Modified: trunk/OpenMPT/mptrack/InputHandler.cpp =================================================================== --- trunk/OpenMPT/mptrack/InputHandler.cpp 2011-09-03 19:42:29 UTC (rev 1014) +++ trunk/OpenMPT/mptrack/InputHandler.cpp 2011-09-03 21:46:53 UTC (rev 1015) @@ -58,7 +58,7 @@ } } if (bSuccess == false) - AfxMessageBox(IDS_UNABLE_TO_LOAD_KEYBINDINGS, MB_ICONERROR); + MsgBox(IDS_UNABLE_TO_LOAD_KEYBINDINGS, NULL, MAINFRAME_TITLE, MB_ICONERROR); } // We will only overwrite the default Keybindings.mkb file from now on. _tcscpy(CMainFrame::GetSettings().m_szKbdFile, sDefaultPath); Modified: trunk/OpenMPT/mptrack/KeyConfigDlg.cpp =================================================================== --- trunk/OpenMPT/mptrack/KeyConfigDlg.cpp 2011-09-03 19:42:29 UTC (rev 1014) +++ trunk/OpenMPT/mptrack/KeyConfigDlg.cpp 2011-09-03 21:46:53 UTC (rev 1015) @@ -665,7 +665,7 @@ { if (m_sFullPathName.Compare(CMainFrame::GetSettings().m_szKbdFile)) { - if (AfxMessageBox("Load this keyboard config file when MPT starts up?", MB_YESNO) == IDYES) + if (Reporting::Notification("Load this keyboard config file when MPT starts up?", MB_YESNO) == IDYES) { strcpy(CMainFrame::GetSettings().m_szKbdFile,m_sFullPathName); OnSettingsChanged(); // Enable "apply" button Modified: trunk/OpenMPT/mptrack/Mainfrm.h =================================================================== --- trunk/OpenMPT/mptrack/Mainfrm.h 2011-09-03 19:42:29 UTC (rev 1014) +++ trunk/OpenMPT/mptrack/Mainfrm.h 2011-09-03 21:46:53 UTC (rev 1015) @@ -1,13 +1,12 @@ // MainFrm.h : interface of the CMainFrame class // ///////////////////////////////////////////////////////////////////////////// -#if !defined(AFX_MAINFRM_H__AE144DC8_DD0B_11D1_AF24_444553540000__INCLUDED_) -#define AFX_MAINFRM_H__AE144DC8_DD0B_11D1_AF24_444553540000__INCLUDED_ -#if _MSC_VER >= 1000 #pragma once -#endif // _MSC_VER >= 1000 +#ifndef MAINFRM_H +#define MAINFRM_H + #include "sndfile.h" #include "CommandSet.h" #include "inputhandler.h" @@ -682,10 +681,9 @@ const CHAR gszBuildDate[] = __DATE__ " " __TIME__; - ///////////////////////////////////////////////////////////////////////////// //{{AFX_INSERT_LOCATION}} // Microsoft Developer Studio will insert additional declarations immediately before the previous line. -#endif // !defined(AFX_MAINFRM_H__AE144DC8_DD0B_11D1_AF24_444553540000__INCLUDED_) +#endif // MAINFRM_H Modified: trunk/OpenMPT/mptrack/Mod2wave.cpp =================================================================== --- trunk/OpenMPT/mptrack/Mod2wave.cpp 2011-09-03 19:42:29 UTC (rev 1014) +++ trunk/OpenMPT/mptrack/Mod2wave.cpp 2011-09-03 21:46:53 UTC (rev 1015) @@ -613,7 +613,7 @@ if ((!m_pSndFile) || (!m_lpszFileName) || ((f = fopen(m_lpszFileName, "w+b")) == NULL)) { - ::AfxMessageBox("Could not open file for writing. Is it open in another application?"); + Reporting::Notification("Could not open file for writing. Is it open in another application?"); EndDialog(IDCANCEL); return; } @@ -1001,7 +1001,7 @@ // Creating the output file if ((f = fopen(m_lpszFileName, "wb")) == NULL) { - ::AfxMessageBox("Could not open file for writing. Is it open in another application?"); + Reporting::Notification("Could not open file for writing. Is it open in another application?"); goto OnError; } wfh.id_RIFF = IFFID_RIFF; Modified: trunk/OpenMPT/mptrack/Moddoc.cpp =================================================================== --- trunk/OpenMPT/mptrack/Moddoc.cpp 2011-09-03 19:42:29 UTC (rev 1014) +++ trunk/OpenMPT/mptrack/Moddoc.cpp 2011-09-03 21:46:53 UTC (rev 1015) @@ -854,7 +854,7 @@ CShowLogDlg dlg(parent); return dlg.ShowLog(m_lpszLog, lpszTitle); #else - return Reporting::Notification(m_lpszLog, lpszTitle, MB_OK | MB_ICONINFORMATION, (parent) ? parent->m_hWnd : nullptr); + return Reporting::Notification(m_lpszLog, lpszTitle, MB_OK | MB_ICONINFORMATION, parent); #endif } return IDCANCEL; @@ -3887,7 +3887,7 @@ { const SAMPLEINDEX nSmp = m_SndFile.Instruments[nInstr]->Keyboard[NOTE_MIDDLEC - 1]; if (nSmp <= m_SndFile.GetNumSamples() && m_SndFile.GetSample(nSmp).pSample) - instrumentName.Format(TEXT("s: %s"), m_SndFile.GetSampleName(nSmp)); //60 is C-5 + instrumentName.Format(TEXT("s: %s"), m_SndFile.GetSampleName(nSmp)); } // Get plugin name. Modified: trunk/OpenMPT/mptrack/Modedit.cpp =================================================================== --- trunk/OpenMPT/mptrack/Modedit.cpp 2011-09-03 19:42:29 UTC (rev 1014) +++ trunk/OpenMPT/mptrack/Modedit.cpp 2011-09-03 21:46:53 UTC (rev 1015) @@ -689,9 +689,10 @@ if ((nIns) && (nIns <= m_SndFile.GetNumInstruments()) && (m_SndFile.Instruments[nIns])) { bool instrumentsLeft = false; - CriticalSection cs; m_SndFile.DestroyInstrument(nIns); + + CriticalSection cs; if (nIns == m_SndFile.m_nInstruments) m_SndFile.m_nInstruments--; for (UINT i=1; i<MAX_INSTRUMENTS; i++) if (m_SndFile.Instruments[i]) instrumentsLeft = true; if (!instrumentsLeft) m_SndFile.m_nInstruments = 0; Modified: trunk/OpenMPT/mptrack/Moptions.cpp =================================================================== --- trunk/OpenMPT/mptrack/Moptions.cpp 2011-09-03 19:42:29 UTC (rev 1014) +++ trunk/OpenMPT/mptrack/Moptions.cpp 2011-09-03 21:46:53 UTC (rev 1015) @@ -108,7 +108,7 @@ if ((temp_nRowSpacing2 > temp_nRowSpacing)) { - ::AfxMessageBox("Error: Primary highlight must be greater than or equal secondary highlight.", MB_OK|MB_ICONEXCLAMATION); + Reporting::Notification("Error: Primary highlight must be greater than or equal secondary highlight.", MB_OK | MB_ICONEXCLAMATION); ::SetFocus(::GetDlgItem(m_hWnd, IDC_PRIMARYHILITE)); return 0; } Modified: trunk/OpenMPT/mptrack/Mptrack.cpp =================================================================== --- trunk/OpenMPT/mptrack/Mptrack.cpp 2011-09-03 19:42:29 UTC (rev 1014) +++ trunk/OpenMPT/mptrack/Mptrack.cpp 2011-09-03 21:46:53 UTC (rev 1015) @@ -1854,15 +1854,14 @@ { CString str; str.LoadString(nStringID); - HWND hwnd = (p) ? p->m_hWnd : NULL; - return ::MessageBox(hwnd, str, lpszTitle, n); + return Reporting::Notification(str, CString(lpszTitle), n, p); } void ErrorBox(UINT nStringID, CWnd*p) //----------------------------------- { - MsgBox(nStringID, p, "Error!", MB_OK|MB_ICONSTOP); + MsgBox(nStringID, p, "Error!", MB_OK | MB_ICONSTOP); } Modified: trunk/OpenMPT/mptrack/Mptrack.h =================================================================== --- trunk/OpenMPT/mptrack/Mptrack.h 2011-09-03 19:42:29 UTC (rev 1014) +++ trunk/OpenMPT/mptrack/Mptrack.h 2011-09-03 21:46:53 UTC (rev 1015) @@ -1,13 +1,11 @@ // mptrack.h : main header file for the MPTRACK application // -#if !defined(AFX_MPTRACK_H__AE144DC4_DD0B_11D1_AF24_444553540000__INCLUDED_) -#define AFX_MPTRACK_H__AE144DC4_DD0B_11D1_AF24_444553540000__INCLUDED_ - -#if _MSC_VER >= 1000 #pragma once -#endif // _MSC_VER >= 1000 +#ifndef MPTRACK_H +#define MPTRACK_H + #ifndef __AFXWIN_H__ #error include 'stdafx.h' before including this file for PCH #endif @@ -381,4 +379,4 @@ //{{AFX_INSERT_LOCATION}} // Microsoft Developer Studio will insert additional declarations immediately before the previous line. -#endif // !defined(AFX_MPTRACK_H__AE144DC4_DD0B_11D1_AF24_444553540000__INCLUDED_) +#endif // MPTRACK_H Modified: trunk/OpenMPT/mptrack/SampleEditorDialogs.cpp =================================================================== --- trunk/OpenMPT/mptrack/SampleEditorDialogs.cpp 2011-09-03 19:42:29 UTC (rev 1014) +++ trunk/OpenMPT/mptrack/SampleEditorDialogs.cpp 2011-09-03 21:46:53 UTC (rev 1015) @@ -46,7 +46,7 @@ if(nVal < m_nFactorMin || nVal > m_nFactorMax) { CString str; str.Format(GetStrI18N(__TEXT("Value should be within [%d, %d]")), m_nFactorMin, m_nFactorMax); - AfxMessageBox(str, MB_ICONINFORMATION); + Reporting::Notification(str, MB_ICONINFORMATION); return; } m_nFactor = static_cast<int16>(nVal); Modified: trunk/OpenMPT/mptrack/SelectPluginDialog.cpp =================================================================== --- trunk/OpenMPT/mptrack/SelectPluginDialog.cpp 2011-09-03 19:42:29 UTC (rev 1014) +++ trunk/OpenMPT/mptrack/SelectPluginDialog.cpp 2011-09-03 21:46:53 UTC (rev 1015) @@ -391,7 +391,7 @@ /*&& (gProblemPlugs[p].id1 == plug->dwPluginId1)*/) { s.Format("WARNING: This plugin has been identified as %s,\nwhich is known to have the following problem with OpenMPT:\n\n%s\n\nWould you still like to add this plugin to the library?", gProblemPlugs[p].name, gProblemPlugs[p].problem); - return (AfxMessageBox(s, MB_YESNO) == IDYES); + return (Reporting::Notification(s, MB_YESNO) == IDYES); } } Modified: trunk/OpenMPT/mptrack/View_smp.cpp =================================================================== --- trunk/OpenMPT/mptrack/View_smp.cpp 2011-09-03 19:42:29 UTC (rev 1014) +++ trunk/OpenMPT/mptrack/View_smp.cpp 2011-09-03 21:46:53 UTC (rev 1015) @@ -1116,8 +1116,13 @@ switch(cLeftBarButtons[i]) { case ID_SAMPLE_DRAW: - if(m_bDrawingEnabled) dwStyle |= NCBTNS_CHECKED; - if(pSndFile->GetSample(m_nSample).GetNumChannels() > 1 || pSndFile->GetSample(m_nSample).pSample == nullptr) dwStyle |= NCBTNS_DISABLED; + if(m_bDrawingEnabled) dwStyle |= NCBTNS_CHECKED; + if(m_nSample > pSndFile->GetNumSamples() || + pSndFile->GetSample(m_nSample).GetNumChannels() > 1 || + pSndFile->GetSample(m_nSample).pSample == nullptr) + { + dwStyle |= NCBTNS_DISABLED; + } break; } Modified: trunk/OpenMPT/mptrack/View_tre.cpp =================================================================== --- trunk/OpenMPT/mptrack/View_tre.cpp 2011-09-03 19:42:29 UTC (rev 1014) +++ trunk/OpenMPT/mptrack/View_tre.cpp 2011-09-03 21:46:53 UTC (rev 1015) @@ -1400,7 +1400,7 @@ if (pModDoc && pSndFile) { wsprintf(s, _T("Remove sequence %d?"), modItemID); - if(MessageBox(s, _T("Confirmation"), MB_YESNO | MB_DEFBUTTON2) == IDNO) break; + if(Reporting::Notification(s, _T("Confirmation"), MB_YESNO | MB_DEFBUTTON2) == IDNO) break; pSndFile->Order.RemoveSequence((SEQUENCEINDEX)(modItemID)); pModDoc->UpdateAllViews(NULL, HINT_MODSEQUENCE, NULL); } @@ -1416,7 +1416,7 @@ case MODITEM_PATTERN: wsprintf(s, _T("Remove pattern %d?"), modItemID); - if (pModDoc == nullptr || MessageBox(s, _T("Confirmation"), MB_YESNO | MB_DEFBUTTON2) == IDNO) break; + if (pModDoc == nullptr || Reporting::Notification(s, _T("Confirmation"), MB_YESNO | MB_DEFBUTTON2) == IDNO) break; if (pModDoc->RemovePattern((PATTERNINDEX)modItemID)) { pModDoc->UpdateAllViews(NULL, (UINT(modItemID) << HINT_SHIFT_PAT) | HINT_PATTERNDATA|HINT_PATNAMES); @@ -1425,7 +1425,7 @@ case MODITEM_SAMPLE: wsprintf(s, _T("Remove sample %d?"), modItemID); - if (pModDoc == nullptr || MessageBox(s, _T("Confirmation"), MB_YESNO | MB_DEFBUTTON2) == IDNO) break; + if (pModDoc == nullptr || Reporting::Notification(s, _T("Confirmation"), MB_YESNO | MB_DEFBUTTON2) == IDNO) break; pModDoc->GetSampleUndo()->PrepareUndo((SAMPLEINDEX)modItemID, sundo_replace); if (pModDoc->RemoveSample((SAMPLEINDEX)modItemID)) { @@ -1435,7 +1435,7 @@ case MODITEM_INSTRUMENT: wsprintf(s, _T("Remove instrument %d?"), modItemID); - if (pModDoc == nullptr || MessageBox(s, _T("Confirmation"), MB_YESNO | MB_DEFBUTTON2) == IDNO) break; + if (pModDoc == nullptr || Reporting::Notification(s, _T("Confirmation"), MB_YESNO | MB_DEFBUTTON2) == IDNO) break; if (pModDoc->RemoveInstrument((INSTRUMENTINDEX)modItemID)) { pModDoc->UpdateAllViews(NULL, (UINT(modItemID) << HINT_SHIFT_INS) | HINT_MODTYPE|HINT_ENVELOPE|HINT_INSTRUMENT); Modified: trunk/OpenMPT/soundlib/Sampleio.cpp =================================================================== --- trunk/OpenMPT/soundlib/Sampleio.cpp 2011-09-03 19:42:29 UTC (rev 1014) +++ trunk/OpenMPT/soundlib/Sampleio.cpp 2011-09-03 21:46:53 UTC (rev 1015) @@ -14,6 +14,7 @@ #ifdef MODPLUG_TRACKER #include "../mptrack/Moddoc.h" #endif //MODPLUG_TRACKER +#include "../mptrack/Mainfrm.h" // For CriticalSection #include "Wav.h" #include "../common/StringFixer.h" #include "../common/Reporting.h" @@ -132,6 +133,8 @@ #endif // MODPLUG_TRACKER // -! NEW_FEATURE#0023 + CriticalSection cs; + MODINSTRUMENT *pIns = Instruments[nInstr]; Instruments[nInstr] = nullptr; for(CHANNELINDEX i = 0; i < MAX_CHANNELS; i++) @@ -171,6 +174,8 @@ } for (SAMPLEINDEX nSmp = 1; nSmp <= GetNumSamples(); nSmp++) if (sampleused[nSmp]) { + CriticalSection cs; + DestroySample(nSmp); strcpy(m_szNames[nSmp], ""); } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |