From: <sag...@us...> - 2011-09-04 00:10:06
|
Revision: 1016 http://modplug.svn.sourceforge.net/modplug/?rev=1016&view=rev Author: saga-games Date: 2011-09-04 00:09:56 +0000 (Sun, 04 Sep 2011) Log Message: ----------- [Imp] Compatibility export menu item is now greyed out for S3M and MPTM modules. [Ref] Even more messagebox refactoring. Slowly getting it to where I want it to be... Modified Paths: -------------- trunk/OpenMPT/common/Reporting.cpp trunk/OpenMPT/common/Reporting.h trunk/OpenMPT/mptrack/AbstractVstEditor.cpp trunk/OpenMPT/mptrack/AutoSaver.cpp trunk/OpenMPT/mptrack/ChannelManagerDlg.cpp trunk/OpenMPT/mptrack/CleanupSong.cpp trunk/OpenMPT/mptrack/CommandSet.cpp trunk/OpenMPT/mptrack/Ctrl_ins.cpp trunk/OpenMPT/mptrack/Ctrl_pat.cpp trunk/OpenMPT/mptrack/Ctrl_seq.cpp trunk/OpenMPT/mptrack/Ctrl_smp.cpp trunk/OpenMPT/mptrack/ExceptionHandler.cpp trunk/OpenMPT/mptrack/KeyConfigDlg.cpp trunk/OpenMPT/mptrack/KeyConfigDlg.h trunk/OpenMPT/mptrack/MIDIMappingDialog.cpp trunk/OpenMPT/mptrack/MainFrm.cpp trunk/OpenMPT/mptrack/Mod2wave.cpp trunk/OpenMPT/mptrack/ModConvert.cpp trunk/OpenMPT/mptrack/Moddoc.cpp trunk/OpenMPT/mptrack/Moddoc.h trunk/OpenMPT/mptrack/Modedit.cpp trunk/OpenMPT/mptrack/Mpdlgs.cpp trunk/OpenMPT/mptrack/Mptrack.cpp trunk/OpenMPT/mptrack/PatternEditorDialogs.cpp trunk/OpenMPT/mptrack/SampleEditorDialogs.cpp trunk/OpenMPT/mptrack/SelectPluginDialog.cpp trunk/OpenMPT/mptrack/TuningDialog.cpp trunk/OpenMPT/mptrack/UpdateCheck.cpp trunk/OpenMPT/mptrack/View_gen.cpp trunk/OpenMPT/mptrack/View_pat.cpp trunk/OpenMPT/mptrack/View_smp.cpp trunk/OpenMPT/mptrack/View_tre.cpp trunk/OpenMPT/mptrack/Vstplug.cpp trunk/OpenMPT/mptrack/dlg_misc.cpp trunk/OpenMPT/mptrack/fxp.cpp trunk/OpenMPT/mptrack/mod2midi.cpp trunk/OpenMPT/mptrack/test/test.cpp trunk/OpenMPT/soundlib/Dlsbank.cpp trunk/OpenMPT/soundlib/Mmx_mix.cpp trunk/OpenMPT/soundlib/ModSequence.cpp trunk/OpenMPT/soundlib/Sampleio.cpp trunk/OpenMPT/soundlib/Sndfile.cpp trunk/OpenMPT/soundlib/Sndfile.h trunk/OpenMPT/soundlib/pattern.cpp Modified: trunk/OpenMPT/common/Reporting.cpp =================================================================== --- trunk/OpenMPT/common/Reporting.cpp 2011-09-03 21:46:53 UTC (rev 1015) +++ trunk/OpenMPT/common/Reporting.cpp 2011-09-04 00:09:56 UTC (rev 1016) @@ -13,16 +13,9 @@ #include "../mptrack/Mainfrm.h" -UINT Reporting::Notification(CString text, UINT flags, CWnd *parent) -//------------------------------------------------------------------ +UINT Reporting::ShowNotification(const char *text, const char *caption, UINT flags, const CWnd *parent) +//----------------------------------------------------------------------------------------------------- { - return Notification(text, MAINFRAME_TITLE, flags, parent); -} - - -UINT Reporting::Notification(CString text, CString caption, UINT flags, CWnd *parent) -//----------------------------------------------------------------------------------- -{ CMainFrame *pMainFrm = CMainFrame::GetMainFrame(); if(pMainFrm != nullptr && pMainFrm->GetInputHandler() != nullptr) @@ -39,3 +32,83 @@ return result; } + + +void Reporting::Notification(const char *text, UINT flags, const CWnd *parent) +//---------------------------------------------------------------------------- +{ + Notification(text, MAINFRAME_TITLE, flags, parent); +} + + +void Reporting::Notification(const char *text, const char *caption, UINT flags, const CWnd *parent) +//------------------------------------------------------------------------------------------------- +{ + ShowNotification(text, caption, flags, parent); +} + + +void Reporting::Information(const char *text, const CWnd *parent) +//--------------------------------------------------------------- +{ + Information(text, MAINFRAME_TITLE, parent); +} + + +void Reporting::Information(const char *text, const char *caption, const CWnd *parent) +//------------------------------------------------------------------------------------ +{ + ShowNotification(text, caption, MB_OK | MB_ICONINFORMATION, parent); +} + + +void Reporting::Warning(const char *text, const CWnd *parent) +//----------------------------------------------------------- +{ + Warning(text, MAINFRAME_TITLE " - Error", parent); +} + + +void Reporting::Warning(const char *text, const char *caption, const CWnd *parent) +//-------------------------------------------------------------------------------- +{ + ShowNotification(text, caption, MB_OK | MB_ICONWARNING, parent); +} + + +void Reporting::Error(const char *text, const CWnd *parent) +//--------------------------------------------------------- +{ + Error(text, MAINFRAME_TITLE " - Error", parent); +} + + +void Reporting::Error(const char *text, const char *caption, const CWnd *parent) +//------------------------------------------------------------------------------ +{ + ShowNotification(text, caption, MB_OK | MB_ICONERROR, parent); +} + + +ConfirmAnswer Reporting::Confirm(const char *text, bool showCancel, bool defaultNo, const CWnd *parent) +//----------------------------------------------------------------------------------------------------- +{ + return Confirm(text, MAINFRAME_TITLE " - Confirmation", showCancel, defaultNo, parent); +} + + +ConfirmAnswer Reporting::Confirm(const char *text, const char *caption, bool showCancel, bool defaultNo, const CWnd *parent) +//-------------------------------------------------------------------------------------------------------------------------- +{ + UINT result = ShowNotification(text, caption, (showCancel ? MB_YESNOCANCEL : MB_YESNO) | MB_ICONQUESTION | (defaultNo ? MB_DEFBUTTON2 : 0), parent); + switch(result) + { + case IDYES: + return cnfYes; + case IDNO: + return cnfNo; + default: + case IDCANCEL: + return cnfCancel; + } +} Modified: trunk/OpenMPT/common/Reporting.h =================================================================== --- trunk/OpenMPT/common/Reporting.h 2011-09-03 21:46:53 UTC (rev 1015) +++ trunk/OpenMPT/common/Reporting.h 2011-09-04 00:09:56 UTC (rev 1016) @@ -12,16 +12,47 @@ #ifndef REPORTING_H #define REPORTING_H +enum ConfirmAnswer +{ + cnfYes, + cnfNo, + cnfCancel, +}; + //============= class Reporting //============= { +protected: + + static UINT ShowNotification(const char *text, const char *caption, UINT flags, const CWnd *parent); + public: - 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); + // TODO Quick'n'dirty workaround for MsgBox(). Shouldn't be public. + static UINT CustomNotification(const char *text, const char *caption, UINT flags, const CWnd *parent) { return ShowNotification(text, caption, flags, parent); }; + // Show a simple notification + static void Notification(const char *text, UINT flags = MB_OK, const CWnd *parent = nullptr); + static void Notification(const char *text, const char *caption, UINT flags = MB_OK, const CWnd *parent = nullptr); + + // Show a simple information + static void Information(const char *text, const CWnd *parent = nullptr); + static void Information(const char *text, const char *caption, const CWnd *parent = nullptr); + + // Show a simple warning + static void Warning(const char *text, const CWnd *parent = nullptr); + static void Warning(const char *text, const char *caption, const CWnd *parent = nullptr); + + // Show an error box. + static void Error(const char *text, const CWnd *parent = nullptr); + static void Error(const char *text, const char *caption, const CWnd *parent = nullptr); + + // Show a confirmation dialog. + static ConfirmAnswer Confirm(const char *text, bool showCancel = false, bool defaultNo = false, const CWnd *parent = nullptr); + static ConfirmAnswer Confirm(const char *text, const char *caption, bool showCancel = false, bool defaultNo = false, const CWnd *parent = nullptr); + }; #endif // REPORTING_H Modified: trunk/OpenMPT/mptrack/AbstractVstEditor.cpp =================================================================== --- trunk/OpenMPT/mptrack/AbstractVstEditor.cpp 2011-09-03 21:46:53 UTC (rev 1015) +++ trunk/OpenMPT/mptrack/AbstractVstEditor.cpp 2011-09-04 00:09:56 UTC (rev 1016) @@ -111,7 +111,7 @@ m_pVstPlugin->GetModDoc()->SetModified(); } else { - Reporting::Notification("Error loading preset. Are you sure it is for this plugin?"); + Reporting::Error("Error loading preset. Are you sure it is for this plugin?"); } } @@ -129,7 +129,7 @@ //TODO: exception handling if (!(m_pVstPlugin->SaveProgram(files.first_file.c_str()))) - Reporting::Notification("Error saving preset."); + Reporting::Error("Error saving preset."); } @@ -138,7 +138,7 @@ { if (m_pVstPlugin) { - if (Reporting::Notification("Are you sure you want to randomize parameters?\nYou will lose current parameter values.", MB_YESNO | MB_ICONEXCLAMATION) == IDYES) + if (Reporting::Confirm("Are you sure you want to randomize parameters?\nYou will lose current parameter values.") == cnfYes) m_pVstPlugin->RandomizeParams(); UpdateParamDisplays(); } @@ -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) == IDNO) + Reporting::Confirm(_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?"), false, false, this) == cnfYes) { return false; } else Modified: trunk/OpenMPT/mptrack/AutoSaver.cpp =================================================================== --- trunk/OpenMPT/mptrack/AutoSaver.cpp 2011-09-03 21:46:53 UTC (rev 1015) +++ trunk/OpenMPT/mptrack/AutoSaver.cpp 2011-09-04 00:09:56 UTC (rev 1016) @@ -85,7 +85,7 @@ } else { m_bEnabled = false; - Reporting::Notification("Warning: Autosave failed and has been disabled. Please:\n- Review your autosave paths\n- Check available diskspace & filesystem access rights\n- If you are using the ITP format, ensure all instruments exist as independant .iti files"); + Reporting::Warning("Warning: Autosave failed and has been disabled. Please:\n- Review your autosave paths\n- Check available diskspace & filesystem access rights\n- If you are using the ITP format, ensure all instruments exist as independant .iti files"); success = false; } } @@ -477,7 +477,7 @@ if (!pathIsOK && IsDlgButtonChecked(IDC_AUTOSAVE_ENABLE) && !IsDlgButtonChecked(IDC_AUTOSAVE_USEORIGDIR)) { - Reporting::Notification("Error: backup path does not exist.", MB_OK | MB_ICONEXCLAMATION); + Reporting::Error("Error: backup path does not exist."); ::SetFocus(::GetDlgItem(m_hWnd, IDC_AUTOSAVE_PATH)); return 0; } Modified: trunk/OpenMPT/mptrack/ChannelManagerDlg.cpp =================================================================== --- trunk/OpenMPT/mptrack/ChannelManagerDlg.cpp 2011-09-03 21:46:53 UTC (rev 1015) +++ trunk/OpenMPT/mptrack/ChannelManagerDlg.cpp 2011-09-04 00:09:56 UTC (rev 1016) @@ -204,7 +204,7 @@ { cs.Leave(); EndWaitCursor(); - MessageBox("Rearranging channels failed"); + Reporting::Error("Rearranging channels failed"); ResetState(true, true, true, true, true); LeaveCriticalSection(&applying); Modified: trunk/OpenMPT/mptrack/CleanupSong.cpp =================================================================== --- trunk/OpenMPT/mptrack/CleanupSong.cpp 2011-09-03 21:46:53 UTC (rev 1015) +++ trunk/OpenMPT/mptrack/CleanupSong.cpp 2011-09-04 00:09:56 UTC (rev 1016) @@ -422,7 +422,7 @@ { EndWaitCursor(); wsprintf(s, "%d pattern%s present in file, but not used in the song\nDo you want to reorder the sequence list and remove these patterns?", nWaste, (nWaste == 1) ? "" : "s"); - if (m_wParent->MessageBox(s, "Pattern Cleanup", MB_YESNO) != IDYES) return false; + if (Reporting::Confirm(s, "Pattern Cleanup") != cnfYes) return false; BeginWaitCursor(); } @@ -546,7 +546,7 @@ { //We don't remove an instrument's unused samples in an ITP. wsprintf(s, "OpenMPT detected %d sample%s referenced by an instrument,\n" "but not used in the song. Do you want to remove them?", nExt, (nExt == 1) ? "" : "s"); - if (Reporting::Notification(s, "Sample Cleanup", MB_YESNO | MB_ICONQUESTION) == IDYES) + if (Reporting::Confirm(s, "Sample Cleanup") == cnfYes) { CriticalSection cs; for (SAMPLEINDEX nSmp = 1; nSmp <= pSndFile->GetNumSamples(); nSmp++) @@ -588,7 +588,7 @@ CHAR s[512]; wsprintf(s, "%d sample%s unused data after the loop end point,\n" "Do you want to optimize %s and remove this unused data?", nLoopOpt, (nLoopOpt == 1) ? " has" : "s have", (nLoopOpt == 1) ? "it" : "them"); - if (Reporting::Notification(s, "Sample Optimization", MB_YESNO | MB_ICONQUESTION) == IDYES) + if (Reporting::Confirm(s, "Sample Optimization") == cnfYes) { for (SAMPLEINDEX nSmp = 1; nSmp <= pSndFile->m_nSamples; nSmp++) { @@ -709,16 +709,16 @@ if (!pSndFile->GetNumInstruments()) return false; - char removeSamples = -1; + deleteInstrumentSamples removeSamples = doNoDeleteAssociatedSamples; if ( !((pSndFile->GetType() == MOD_TYPE_IT) && (pSndFile->m_dwSongFlags & SONG_ITPROJECT))) //never remove an instrument's samples in ITP. { - if(Reporting::Notification("Remove samples associated with an instrument if they are unused?", "Removing unused instruments", MB_YESNO | MB_ICONQUESTION) == IDYES) + if(Reporting::Confirm("Remove samples associated with an instrument if they are unused?", "Removing unused instruments") == cnfYes) { - removeSamples = 1; + removeSamples = deleteAssociatedSamples; } } else { - Reporting::Notification("This is an IT project file, so no samples associated with an used instrument will be removed.", "Removing unused instruments", MB_OK | MB_ICONINFORMATION); + Reporting::Information("This is an IT project file, so no samples associated with an used instrument will be removed.", "Removing unused instruments"); } BeginWaitCursor(); @@ -729,16 +729,15 @@ if (!pSndFile->IsInstrumentUsed(i)) { CriticalSection cs; - // -> CODE#0003 - // -> DESC="remove instrument's samples" - // pSndFile->DestroyInstrument(i); - pSndFile->DestroyInstrument(i, removeSamples); - // -! BEHAVIOUR_CHANGE#0003 - if ((i == pSndFile->GetNumInstruments()) && (i >1)) - pSndFile->m_nInstruments--; - else - bReorg = true; - nRemoved++; + + if(pSndFile->DestroyInstrument(i, removeSamples)) + { + if ((i == pSndFile->GetNumInstruments()) && (i > 1)) + pSndFile->m_nInstruments--; + else + bReorg = true; + nRemoved++; + } } else { usedmap[i] = true; @@ -746,7 +745,7 @@ } EndWaitCursor(); if ((bReorg) && (pSndFile->m_nInstruments > 1) - && (Reporting::Notification("Do you want to reorganize the remaining instruments?", "Removing unused instruments", MB_YESNO | MB_ICONQUESTION) == IDYES)) + && (Reporting::Confirm("Do you want to reorganize the remaining instruments?", "Removing unused instruments") == cnfYes)) { BeginWaitCursor(); CriticalSection cs; @@ -870,7 +869,7 @@ if(pSndFile == nullptr) return false; //jojo.compocleanup - if(Reporting::Notification(TEXT("WARNING: OpenMPT will convert the module to IT format and reset all song, sample and instrument attributes to default values. Continue?"), TEXT("Resetting variables"), MB_YESNO | MB_ICONWARNING) == IDNO) + if(Reporting::Confirm(TEXT("WARNING: OpenMPT will convert the module to IT format and reset all song, sample and instrument attributes to default values. Continue?"), TEXT("Resetting variables")) == cnfNo) return false; // Stop play. @@ -987,8 +986,7 @@ if(bConfirm) { - if (CMainFrame::GetMainFrame()->MessageBox("Do you want to convert all instruments to samples?", - "Removing all instruments", MB_YESNO | MB_ICONQUESTION) == IDYES) + if (Reporting::Confirm("Do you want to convert all instruments to samples?", "Removing all instruments") == cnfYes) { m_pModDoc->ConvertInstrumentsToSamples(); } @@ -996,7 +994,7 @@ for (INSTRUMENTINDEX i = 1; i <= pSndFile->GetNumInstruments(); i++) { - pSndFile->DestroyInstrument(i, -1); + pSndFile->DestroyInstrument(i, doNoDeleteAssociatedSamples); } pSndFile->m_nInstruments = 0; Modified: trunk/OpenMPT/mptrack/CommandSet.cpp =================================================================== --- trunk/OpenMPT/mptrack/CommandSet.cpp 2011-09-03 21:46:53 UTC (rev 1015) +++ trunk/OpenMPT/mptrack/CommandSet.cpp 2011-09-04 00:09:56 UTC (rev 1016) @@ -45,7 +45,7 @@ { //CHAR s[64]; //wsprintf(s, "pointer = %lX",plocalCmdSet); - //Reporting::Notification("about to remove all", NULL, MB_OK|MB_ICONEXCLAMATION); //disabled by rewbs + //Reporting::Notification("about to remove all", MB_OK | MB_ICONEXCLAMATION); //disabled by rewbs //commands.RemoveAll(); } Modified: trunk/OpenMPT/mptrack/Ctrl_ins.cpp =================================================================== --- trunk/OpenMPT/mptrack/Ctrl_ins.cpp 2011-09-03 21:46:53 UTC (rev 1015) +++ trunk/OpenMPT/mptrack/Ctrl_ins.cpp 2011-09-04 00:09:56 UTC (rev 1016) @@ -1889,12 +1889,10 @@ } if(smpPanningInUse) { - if(MessageBox(_T("Some of the samples used in the instrument have \"Set Pan\" enabled. " + if(Reporting::Confirm(_T("Some of the samples used in the instrument have \"Set Pan\" enabled. " "When instrument is played with such sample, sample pan setting overrides instrument pan. " "Do you wish to disable panning from those samples so that instrument pan setting is effective " - "for the whole instrument?"), - _T(""), - MB_YESNO) == IDYES) + "for the whole instrument?")) == cnfYes) { for(BYTE i = 0; i < CountOf(pIns->Keyboard); i++) { @@ -2649,7 +2647,7 @@ CString str; str.Format(TEXT("Tuning %s was not found. Setting to default tuning."), m_pSndFile->Instruments[m_nInstrument]->pTuning->GetName().c_str()); - MessageBox(str); + Reporting::Notification(str); CriticalSection cs; pIns->SetTuning(pIns->s_DefaultTuning); Modified: trunk/OpenMPT/mptrack/Ctrl_pat.cpp =================================================================== --- trunk/OpenMPT/mptrack/Ctrl_pat.cpp 2011-09-03 21:46:53 UTC (rev 1015) +++ trunk/OpenMPT/mptrack/Ctrl_pat.cpp 2011-09-04 00:09:56 UTC (rev 1016) @@ -1128,7 +1128,7 @@ // If this macro is not the default IT macro, display a warning. if(!m_pModDoc->IsMacroDefaultSetupUsed()) { - if(Reporting::Notification(_T("You have chosen not to embed MIDI macros. However, the current macro configuration differs from the default macro configuration that is assumed when loading a file that has no macros embedded. This can result in data loss and broken playback.\nWould you like to embed MIDI macros now?"), MB_YESNO) == IDYES) + if(Reporting::Confirm(_T("You have chosen not to embed MIDI macros. However, the current macro configuration differs from the default macro configuration that is assumed when loading a file that has no macros embedded. This can result in data loss and broken playback.\nWould you like to embed MIDI macros now?")) == cnfYes) { m_pSndFile->m_dwSongFlags |= SONG_EMBEDMIDICFG; m_pModDoc->SetModified(); Modified: trunk/OpenMPT/mptrack/Ctrl_seq.cpp =================================================================== --- trunk/OpenMPT/mptrack/Ctrl_seq.cpp 2011-09-03 21:46:53 UTC (rev 1015) +++ trunk/OpenMPT/mptrack/Ctrl_seq.cpp 2011-09-04 00:09:56 UTC (rev 1016) @@ -1399,7 +1399,7 @@ CString strParam; strParam.Format(TEXT("%u: %s"), rSf.Order.GetCurrentSequenceIndex(), (LPCTSTR)rSf.Order.m_sName); CString str; AfxFormatString1(str, IDS_CONFIRM_SEQUENCE_DELETE, strParam); - if (Reporting::Notification(str, MB_YESNO | MB_ICONQUESTION) == IDYES) + if (Reporting::Confirm(str) == cnfYes) rSf.Order.RemoveSequence(); else { Modified: trunk/OpenMPT/mptrack/Ctrl_smp.cpp =================================================================== --- trunk/OpenMPT/mptrack/Ctrl_smp.cpp 2011-09-03 21:46:53 UTC (rev 1015) +++ trunk/OpenMPT/mptrack/Ctrl_smp.cpp 2011-09-04 00:09:56 UTC (rev 1016) @@ -941,8 +941,7 @@ m_pModDoc->UpdateAllViews(NULL, (smp << HINT_SHIFT_SMP) | HINT_SAMPLEINFO | HINT_SAMPLEDATA | HINT_SMPNAMES); if ((pSndFile->m_nInstruments) && (!m_pModDoc->FindSampleParent(smp))) { - if (MessageBox("This sample is not used by any instrument. Do you want to create a new instrument using this sample?", - NULL, MB_YESNO|MB_ICONQUESTION) == IDYES) + if (Reporting::Confirm("This sample is not used by any instrument. Do you want to create a new instrument using this sample?") == cnfYes) { UINT nins = m_pModDoc->InsertInstrument(smp); m_pModDoc->UpdateAllViews(NULL, (nins << HINT_SHIFT_INS) | HINT_INSTRUMENT | HINT_INSNAMES | HINT_ENVELOPE); @@ -1133,7 +1132,7 @@ //Shift -> Normalize all samples if(CMainFrame::GetInputHandler()->ShiftPressed()) { - if(MessageBox(GetStrI18N(TEXT("This will normalize all samples independently. Continue?")), GetStrI18N(TEXT("Normalize")), MB_YESNO | MB_ICONQUESTION) == IDNO) + if(Reporting::Confirm(GetStrI18N(TEXT("This will normalize all samples independently. Continue?")), GetStrI18N(TEXT("Normalize"))) == cnfNo) return; iMinSample = 1; iMaxSample = m_pSndFile->m_nSamples; @@ -1295,7 +1294,7 @@ //Shift -> Process all samples if(CMainFrame::GetInputHandler()->ShiftPressed()) { - if(MessageBox(GetStrI18N(TEXT("This will process all samples independently. Continue?")), GetStrI18N(TEXT("DC Offset Removal")), MB_YESNO | MB_ICONQUESTION) == IDNO) + if(Reporting::Confirm(GetStrI18N(TEXT("This will process all samples independently. Continue?")), GetStrI18N(TEXT("DC Offset Removal"))) == cnfNo) return; iMinSample = 1; iMaxSample = m_pSndFile->m_nSamples; @@ -1830,7 +1829,7 @@ default: wsprintf(str, _T("Unknown Error...")); break; } - Reporting::Notification(str, MB_ICONERROR); + Reporting::Error(str); return; } @@ -1901,7 +1900,7 @@ { CString str; str.Format(TEXT(GetStrI18N("Current samplerate, %u Hz, is not in the supported samplerate range 8000 Hz - 48000 Hz. Continue?")), nSampleRate); - if(Reporting::Notification(str, MB_ICONQUESTION|MB_YESNO) != IDYES) + if(Reporting::Confirm(str) != cnfYes) return -1; } Modified: trunk/OpenMPT/mptrack/ExceptionHandler.cpp =================================================================== --- trunk/OpenMPT/mptrack/ExceptionHandler.cpp 2011-09-03 21:46:53 UTC (rev 1015) +++ trunk/OpenMPT/mptrack/ExceptionHandler.cpp 2011-09-04 00:09:56 UTC (rev 1016) @@ -136,7 +136,7 @@ } } - Reporting::Notification(errorMessage, "OpenMPT Crash", MB_ICONERROR, pMainFrame); + Reporting::Error(errorMessage, "OpenMPT Crash", pMainFrame); // Let Windows handle the exception... return EXCEPTION_CONTINUE_SEARCH; Modified: trunk/OpenMPT/mptrack/KeyConfigDlg.cpp =================================================================== --- trunk/OpenMPT/mptrack/KeyConfigDlg.cpp 2011-09-03 21:46:53 UTC (rev 1015) +++ trunk/OpenMPT/mptrack/KeyConfigDlg.cpp 2011-09-04 00:09:56 UTC (rev 1016) @@ -531,7 +531,7 @@ if (cmd<0 || m_nCurKeyChoice<0 || m_nCurKeyChoice>=ih->GetKeyListSize(cmd)) { CString error = "Nothing to restore for this slot."; - Reporting::Notification(error, "Invalid key data", MB_ICONEXCLAMATION|MB_OK); + Reporting::Error(error, "Invalid key data"); return; } @@ -661,22 +661,6 @@ //TentativeSetToDefaultFile(m_sFullPathName); } -bool COptionsKeyboard::TentativeSetToDefaultFile(CString m_sFullPathName) -{ - if (m_sFullPathName.Compare(CMainFrame::GetSettings().m_szKbdFile)) - { - 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 - UpdateDialog(); - return true; - } - } - - return false; -} - void COptionsKeyboard::OnNotesRepeat() { plocalCmdSet->QuickChange_NotesRepeat(); Modified: trunk/OpenMPT/mptrack/KeyConfigDlg.h =================================================================== --- trunk/OpenMPT/mptrack/KeyConfigDlg.h 2011-09-03 21:46:53 UTC (rev 1015) +++ trunk/OpenMPT/mptrack/KeyConfigDlg.h 2011-09-04 00:09:56 UTC (rev 1016) @@ -101,7 +101,6 @@ CButton m_bDebugSave; void ForceUpdateGUI(); - bool TentativeSetToDefaultFile(CString); public: COptionsKeyboard():CPropertyPage(IDD_OPTIONS_KEYBOARD) { m_nKeyboardCfg = 0; } Modified: trunk/OpenMPT/mptrack/MIDIMappingDialog.cpp =================================================================== --- trunk/OpenMPT/mptrack/MIDIMappingDialog.cpp 2011-09-03 21:46:53 UTC (rev 1015) +++ trunk/OpenMPT/mptrack/MIDIMappingDialog.cpp 2011-09-04 00:09:56 UTC (rev 1016) @@ -247,7 +247,7 @@ { if(m_rSndFile.GetModSpecifications().MIDIMappingDirectivesMax <= m_rMIDIMapper.GetCount()) { - MessageBox("Max limit reached", 0, MB_ICONINFORMATION); + Reporting::Information("Maximum amount of MIDI Mapping directives reached."); } else { Modified: trunk/OpenMPT/mptrack/MainFrm.cpp =================================================================== --- trunk/OpenMPT/mptrack/MainFrm.cpp 2011-09-03 21:46:53 UTC (rev 1015) +++ trunk/OpenMPT/mptrack/MainFrm.cpp 2011-09-04 00:09:56 UTC (rev 1016) @@ -103,7 +103,7 @@ ON_MESSAGE(WM_MOD_UPDATEPOSITION, OnUpdatePosition) ON_MESSAGE(WM_MOD_INVALIDATEPATTERNS, OnInvalidatePatterns) ON_MESSAGE(WM_MOD_SPECIALKEY, OnSpecialKey) - ON_MESSAGE(WM_MOD_KEYCOMMAND, OnCustomKeyMsg) //rewbs.customKeys + ON_MESSAGE(WM_MOD_KEYCOMMAND, OnCustomKeyMsg) //rewbs.customKeys ON_COMMAND(ID_INTERNETUPDATE, OnInternetUpdate) //}}AFX_MSG_MAP ON_WM_INITMENU() @@ -963,7 +963,7 @@ // Display error message box if (err != 0) { - MessageBox("Unable to open sound device!", NULL, MB_OK|MB_ICONERROR); + Reporting::Error("Unable to open sound device!"); return FALSE; } // Device is ready Modified: trunk/OpenMPT/mptrack/Mod2wave.cpp =================================================================== --- trunk/OpenMPT/mptrack/Mod2wave.cpp 2011-09-03 21:46:53 UTC (rev 1015) +++ trunk/OpenMPT/mptrack/Mod2wave.cpp 2011-09-04 00:09:56 UTC (rev 1016) @@ -261,8 +261,8 @@ m_bGivePlugsIdleTime = IsDlgButtonChecked(IDC_GIVEPLUGSIDLETIME) ? true : false; if (m_bGivePlugsIdleTime) { - if (MessageBox("You only need slow render if you are experiencing dropped notes with a Kontakt based sampler with Direct-From-Disk enabled.\nIt will make rendering *very* slow.\n\nAre you sure you want to enable slow render?", - "Really enable slow render?", MB_YESNO) == IDNO ) + if (Reporting::Confirm("You only need slow render if you are experiencing dropped notes with a Kontakt based sampler with Direct-From-Disk enabled.\nIt will make rendering *very* slow.\n\nAre you sure you want to enable slow render?", + "Really enable slow render?") == cnfNo) { CheckDlgButton(IDC_GIVEPLUGSIDLETIME, BST_UNCHECKED); return; Modified: trunk/OpenMPT/mptrack/ModConvert.cpp =================================================================== --- trunk/OpenMPT/mptrack/ModConvert.cpp 2011-09-03 21:46:53 UTC (rev 1015) +++ trunk/OpenMPT/mptrack/ModConvert.cpp 2011-09-04 00:09:56 UTC (rev 1016) @@ -121,10 +121,10 @@ if((m_SndFile.GetNumInstruments() || nResizedPatterns) && (nNewType & (MOD_TYPE_MOD|MOD_TYPE_S3M))) { - if(Reporting::Notification( + if(Reporting::Confirm( "This operation will convert all instruments to samples,\n" "and resize all patterns to 64 rows.\n" - "Do you want to continue?", "Warning", MB_YESNO | MB_ICONQUESTION) != IDYES) return false; + "Do you want to continue?", "Warning") != cnfYes) return false; BeginWaitCursor(); CriticalSection cs; Modified: trunk/OpenMPT/mptrack/Moddoc.cpp =================================================================== --- trunk/OpenMPT/mptrack/Moddoc.cpp 2011-09-03 21:46:53 UTC (rev 1015) +++ trunk/OpenMPT/mptrack/Moddoc.cpp 2011-09-04 00:09:56 UTC (rev 1016) @@ -89,6 +89,7 @@ ON_UPDATE_COMMAND_UI(ID_VIEW_MIDIMAPPING, OnUpdateHasMIDIMappings) ON_UPDATE_COMMAND_UI(ID_FILE_SAVEASMP3, OnUpdateMP3Encode) ON_UPDATE_COMMAND_UI(ID_VIEW_EDITHISTORY, OnUpdateITMPTOnly) + ON_UPDATE_COMMAND_UI(ID_FILE_SAVECOMPAT, OnUpdateCompatExportableOnly) //}}AFX_MSG_MAP END_MESSAGE_MAP() @@ -232,7 +233,7 @@ { CString sTemp; sTemp.Format("File: %s\nLast saved with: %s, current version is %s\n\n%s", lpszPathName, (LPCTSTR)MptVersion::ToStr(m_SndFile.m_dwLastSavedWithVersion), MptVersion::str, GetLog()); - Reporting::Notification(sTemp, MB_ICONINFORMATION); + Reporting::Information(sTemp); ClearLog(); } @@ -481,7 +482,7 @@ } else { if(type == MOD_TYPE_IT && m_SndFile.m_dwSongFlags & SONG_ITPROJECT) - Reporting::Notification(_T("ITP projects need to have a path set for each instrument..."), MB_ICONERROR | MB_OK); + Reporting::Error(_T("ITP projects need to have a path set for each instrument...")); else ErrorBox(IDS_ERR_SAVESONG, CMainFrame::GetMainFrame()); } @@ -508,7 +509,7 @@ } } - if(unsavedInstrument && Reporting::Notification("Do you want to save modified instruments?", MB_ICONQUESTION | MB_YESNO | MB_APPLMODAL) == IDYES) + if(unsavedInstrument && Reporting::Confirm("Do you want to save modified instruments?") == cnfYes) { for(INSTRUMENTINDEX i = 0 ; i < m_SndFile.m_nInstruments ; i++) @@ -854,7 +855,8 @@ CShowLogDlg dlg(parent); return dlg.ShowLog(m_lpszLog, lpszTitle); #else - return Reporting::Notification(m_lpszLog, lpszTitle, MB_OK | MB_ICONINFORMATION, parent); + Reporting::Information(m_lpszLog, lpszTitle, parent); + return IDOK; #endif } return IDCANCEL; @@ -1802,24 +1804,24 @@ { case MOD_TYPE_MOD: pattern = FileFilterMOD; - if(Reporting::Notification(GetStrI18N(TEXT( + if(Reporting::Confirm(GetStrI18N(TEXT( "Compared to regular MOD save, compatibility export adjusts the beginning of oneshot samples " "in order to make the file compatible with ProTracker and other Amiga-based trackers. " "Note that this feature does not remove effects \"invented\" by other PC-based trackers (f.e. panning commands)." - "\n\n Proceed?")), MB_ICONINFORMATION | MB_YESNO) != IDYES + "\n\n Proceed?"))) != cnfYes ) return; break; case MOD_TYPE_IT: pattern = FileFilterIT; - Reporting::Notification("Warning: the exported file will not contain any of MPT's file-format hacks.", "Compatibility export warning.", MB_ICONINFORMATION | MB_OK); + Reporting::Information("Warning: the exported file will not contain any of MPT's file-format hacks.", "Compatibility export warning."); break; case MOD_TYPE_XM: pattern = FileFilterXM; - Reporting::Notification("Warning: the exported file will not contain any of MPT's file-format hacks.", "Compatibility export warning.", MB_ICONINFORMATION | MB_OK); + Reporting::Information("Warning: the exported file will not contain any of MPT's file-format hacks.", "Compatibility export warning."); break; default: - Reporting::Notification("Compatibility export is currently only available for MOD, XM and IT modules.", "Can't do compatibility export.", MB_ICONINFORMATION | MB_OK); + Reporting::Information("Compatibility export is currently only available for MOD, XM and IT modules.", "Can't do compatibility export."); return; } ext = m_SndFile.GetModSpecifications().fileExtension; @@ -2086,6 +2088,14 @@ } +void CModDoc::OnUpdateCompatExportableOnly(CCmdUI *p) +//--------------------------------------------------- +{ + if (p) + p->Enable((m_SndFile.GetType() & (MOD_TYPE_XM|MOD_TYPE_IT|MOD_TYPE_MOD)) ? TRUE : FALSE); +} + + void CModDoc::OnInsertPattern() //----------------------------- { @@ -2123,14 +2133,14 @@ void CModDoc::OnEstimateSongLength() //---------------------------------- { - CHAR s[256]; + CHAR s[64]; DWORD dwSongLength = m_SndFile.GetSongTime(); - wsprintf(s, "Approximate song length: %dmn%02ds", dwSongLength/60, dwSongLength%60); - CMainFrame::GetMainFrame()->MessageBox(s, NULL, MB_OK|MB_ICONINFORMATION); + wsprintf(s, "Approximate song length: %dmn%02ds", dwSongLength / 60, dwSongLength % 60); + Reporting::Information(s); } void CModDoc::OnApproximateBPM() -//---------------------------------- +//------------------------------ { //Convert BPM to string: CString Message; @@ -2155,7 +2165,7 @@ break; } - CMainFrame::GetMainFrame()->MessageBox(Message, NULL, MB_OK|MB_ICONINFORMATION); + Reporting::Information(Message); } @@ -3795,7 +3805,7 @@ { CString message; message.Format("Param %d can already be controlled with macro %X", paramToUse, checkMacro); - CMainFrame::GetMainFrame()->MessageBox(message, "Macro exists for this param",MB_ICONINFORMATION | MB_OK); + Reporting::Information(message, "Macro exists for this param"); return; } } @@ -3812,13 +3822,13 @@ { CString message; message.Format("Param %d beyond controllable range.", paramToUse); - Reporting::Notification(message, "Macro not assigned for this param", MB_ICONINFORMATION | MB_OK); + Reporting::Information(message, "Macro not assigned for this param"); return; } CString message; message.Format("Param %d can now be controlled with macro %X", paramToUse, macroToSet); - Reporting::Notification(message, "Macro assigned for this param", MB_ICONINFORMATION | MB_OK); + Reporting::Information(message, "Macro assigned for this param"); return; } Modified: trunk/OpenMPT/mptrack/Moddoc.h =================================================================== --- trunk/OpenMPT/mptrack/Moddoc.h 2011-09-03 21:46:53 UTC (rev 1015) +++ trunk/OpenMPT/mptrack/Moddoc.h 2011-09-04 00:09:56 UTC (rev 1016) @@ -438,6 +438,7 @@ afx_msg void OnUpdateITMPTOnly(CCmdUI *p); afx_msg void OnUpdateHasMIDIMappings(CCmdUI *p); afx_msg void OnUpdateMP3Encode(CCmdUI *pCmdUI); + afx_msg void OnUpdateCompatExportableOnly(CCmdUI *p); afx_msg void OnPatternRestart(); //rewbs.customKeys afx_msg void OnPatternPlay(); //rewbs.customKeys afx_msg void OnPatternPlayNoLoop(); //rewbs.customKeys Modified: trunk/OpenMPT/mptrack/Modedit.cpp =================================================================== --- trunk/OpenMPT/mptrack/Modedit.cpp 2011-09-03 21:46:53 UTC (rev 1015) +++ trunk/OpenMPT/mptrack/Modedit.cpp 2011-09-04 00:09:56 UTC (rev 1016) @@ -109,7 +109,7 @@ CString str; if(nRemainingChannels == GetNumChannels()) str.Format("No channels chosen to be removed."); else str.Format("No removal done - channel number is already at minimum."); - CMainFrame::GetMainFrame()->MessageBox(str, "Remove channel", MB_OK | MB_ICONINFORMATION); + Reporting::Information(str, "Remove channel"); return false; } @@ -152,7 +152,7 @@ { CString str; str.Format(GetStrI18N(_TEXT("Can't apply change: Number of channels should be within [%u,%u]")), m_SndFile.GetModSpecifications().channelsMin, m_SndFile.GetModSpecifications().channelsMax); - CMainFrame::GetMainFrame()->MessageBox(str , "ReArrangeChannels", MB_OK | MB_ICONINFORMATION); + Reporting::Error(str , "ReArrangeChannels"); return CHANNELINDEX_INVALID; } @@ -190,7 +190,7 @@ if(!newp) { cs.Leave(); - CMainFrame::GetMainFrame()->MessageBox("ERROR: Pattern allocation failed in ReArrangechannels(...)" , "ReArrangeChannels", MB_OK | MB_ICONINFORMATION); + Reporting::Error("ERROR: Pattern allocation failed in ReArrangechannels(...)"); return CHANNELINDEX_INVALID; } MODCOMMAND *tmpsrc = p, *tmpdest = newp; @@ -264,8 +264,7 @@ if(chnFrom == chnTo) return false; if(chnFrom >= GetNumChannels() || chnTo >= GetNumChannels()) { - CString str = "Error: Bad move indexes in CSoundFile::MoveChannel(...)"; - CMainFrame::GetMainFrame()->MessageBox(str , "MoveChannel(...)", MB_OK | MB_ICONINFORMATION); + Reporting::Error("Error: Bad move indexes in CSoundFile::MoveChannel(...)" , "MoveChannel(...)"); return true; } vector<CHANNELINDEX> newOrder; @@ -296,7 +295,7 @@ if(newOrder.size() != ReArrangeChannels(newOrder)) { - CMainFrame::GetMainFrame()->MessageBox("BUG: Channel number changed in MoveChannel()" , "", MB_OK | MB_ICONINFORMATION); + Reporting::Error("BUG: Channel number changed in MoveChannel()"); } return false; } @@ -485,9 +484,13 @@ if ((!m_SndFile.GetNumInstruments()) && ((m_SndFile.GetNumSamples() > 1) || (m_SndFile.GetSample(1).pSample))) { if (pDup) return INSTRUMENTINDEX_INVALID; - UINT n = CMainFrame::GetMainFrame()->MessageBox("Convert existing samples to instruments first?", NULL, MB_YESNOCANCEL|MB_ICONQUESTION); - if (n == IDYES) + ConfirmAnswer result = Reporting::Confirm("Convert existing samples to instruments first?", true); + if (result == cnfCancel) { + return INSTRUMENTINDEX_INVALID; + } + if (result == cnfYes) + { SAMPLEINDEX nInstruments = m_SndFile.m_nSamples; if (nInstruments > nInstrumentMax) nInstruments = nInstrumentMax; for (SAMPLEINDEX smp = 1; smp <= nInstruments; smp++) @@ -509,8 +512,7 @@ } } m_SndFile.m_nInstruments = nInstruments; - } else - if (n != IDNO) return INSTRUMENTINDEX_INVALID; + } } UINT newins = 0; for (INSTRUMENTINDEX i = 1; i <= m_SndFile.m_nInstruments; i++) @@ -690,15 +692,16 @@ { bool instrumentsLeft = false; - m_SndFile.DestroyInstrument(nIns); + if(m_SndFile.DestroyInstrument(nIns, askdeleteAssociatedSamples)) + { + 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; + SetModified(); - 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; - SetModified(); - - return true; + return true; + } } return false; } Modified: trunk/OpenMPT/mptrack/Mpdlgs.cpp =================================================================== --- trunk/OpenMPT/mptrack/Mpdlgs.cpp 2011-09-03 21:46:53 UTC (rev 1015) +++ trunk/OpenMPT/mptrack/Mpdlgs.cpp 2011-09-04 00:09:56 UTC (rev 1016) @@ -288,7 +288,7 @@ else { m_PreAmpNoteShowed = true; - Reporting::Notification(str_preampChangeNote, MB_ICONINFORMATION); + Reporting::Information(str_preampChangeNote); SetPreAmpSliderPosition(); } } Modified: trunk/OpenMPT/mptrack/Mptrack.cpp =================================================================== --- trunk/OpenMPT/mptrack/Mptrack.cpp 2011-09-03 21:46:53 UTC (rev 1015) +++ trunk/OpenMPT/mptrack/Mptrack.cpp 2011-09-04 00:09:56 UTC (rev 1016) @@ -292,15 +292,15 @@ } if (CDLSBank::IsDLSBank(lpszConfigFile)) { - UINT id = IDYES; + ConfirmAnswer result = cnfYes; if (!bNoWarn) { - id = CMainFrame::GetMainFrame()->MessageBox("You are about to replace the current MIDI library:\n" - "Do you want to replace only the missing instruments? (recommended)", - "Warning", MB_YESNOCANCEL|MB_ICONQUESTION ); + result = Reporting::Confirm("You are about to replace the current MIDI library:\n" + "Do you want to replace only the missing instruments? (recommended)", + "Warning", true); } - if (id == IDCANCEL) return FALSE; - const bool bReplaceAll = (id == IDNO); + if (result == cnfCancel) return FALSE; + const bool bReplaceAll = (result == cnfNo); CDLSBank dlsbank; if (dlsbank.Open(lpszConfigFile)) { @@ -933,7 +933,6 @@ int CTrackApp::ExitInstance() //--------------------------- { - //::MessageBox("Exiting/Crashing"); SndDevUninitialize(); if (glpMidiLibrary) { @@ -1849,19 +1848,19 @@ // Misc functions -UINT MsgBox(UINT nStringID, CWnd *p, LPCSTR lpszTitle, UINT n) -//------------------------------------------------------------ +UINT MsgBox(UINT nStringID, CWnd *parent, LPCSTR lpszTitle, UINT n) +//----------------------------------------------------------------- { CString str; str.LoadString(nStringID); - return Reporting::Notification(str, CString(lpszTitle), n, p); + return Reporting::CustomNotification(str, CString(lpszTitle), n, parent); } -void ErrorBox(UINT nStringID, CWnd*p) -//----------------------------------- +void ErrorBox(UINT nStringID, CWnd *parent) +//----------------------------------------- { - MsgBox(nStringID, p, "Error!", MB_OK | MB_ICONSTOP); + MsgBox(nStringID, parent, "Error!", MB_OK | MB_ICONSTOP); } Modified: trunk/OpenMPT/mptrack/PatternEditorDialogs.cpp =================================================================== --- trunk/OpenMPT/mptrack/PatternEditorDialogs.cpp 2011-09-03 21:46:53 UTC (rev 1015) +++ trunk/OpenMPT/mptrack/PatternEditorDialogs.cpp 2011-09-04 00:09:56 UTC (rev 1016) @@ -554,7 +554,7 @@ { if(!pSndFile->Patterns[m_nPattern].SetSignature(nNewBeat, nNewMeasure)) { - MessageBox("Invalid time signature!", "Pattern Properties", MB_OK|MB_ICONEXCLAMATION); + Reporting::Error("Invalid time signature!", "Pattern Properties"); GetDlgItem(IDC_EDIT_ROWSPERBEAT)->SetFocus(); return; } Modified: trunk/OpenMPT/mptrack/SampleEditorDialogs.cpp =================================================================== --- trunk/OpenMPT/mptrack/SampleEditorDialogs.cpp 2011-09-03 21:46:53 UTC (rev 1015) +++ trunk/OpenMPT/mptrack/SampleEditorDialogs.cpp 2011-09-04 00:09:56 UTC (rev 1016) @@ -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); - Reporting::Notification(str, MB_ICONINFORMATION); + Reporting::Information(str); return; } m_nFactor = static_cast<int16>(nVal); Modified: trunk/OpenMPT/mptrack/SelectPluginDialog.cpp =================================================================== --- trunk/OpenMPT/mptrack/SelectPluginDialog.cpp 2011-09-03 21:46:53 UTC (rev 1015) +++ trunk/OpenMPT/mptrack/SelectPluginDialog.cpp 2011-09-04 00:09:56 UTC (rev 1016) @@ -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 (Reporting::Notification(s, MB_YESNO) == IDYES); + return (Reporting::Confirm(s) == cnfYes); } } @@ -438,7 +438,7 @@ UpdatePluginsList(plugLib ? plugLib->dwPluginId2 : 0); } else { - MessageBox("At least one selected file was not a valid VST-Plugin.", NULL, MB_ICONERROR | MB_OK); + Reporting::Error("At least one selected file was not a valid VST-Plugin."); } } Modified: trunk/OpenMPT/mptrack/TuningDialog.cpp =================================================================== --- trunk/OpenMPT/mptrack/TuningDialog.cpp 2011-09-03 21:46:53 UTC (rev 1015) +++ trunk/OpenMPT/mptrack/TuningDialog.cpp 2011-09-04 00:09:56 UTC (rev 1016) @@ -458,7 +458,7 @@ TUNINGTYPE newType = GetTuningTypeFromStr(strNewType); if(!m_pActiveTuning->IsOfType(newType)) { - if(Reporting::Notification("This action may change the ratio values; continue?", MB_YESNO) == IDYES) + if(Reporting::Confirm("This action may change the ratio values; continue?") == cnfYes) { m_ModifiedTCs[GetpTuningCollection(m_pActiveTuning)] = true; @@ -787,7 +787,7 @@ } } if (sLoadReport.GetLength() > 0) - Reporting::Notification(sLoadReport, MB_ICONINFORMATION); + Reporting::Information(sLoadReport); UpdateView(); } @@ -1170,14 +1170,14 @@ if(!pTC) { - MessageBox("No tuning collection chosen", 0, MB_OK); + Reporting::Notification("No tuning collection chosen"); return true; } CTuning* pNewTuning = new CTuningRTI(pT); if(pTC->AddTuning(pNewTuning)) { - MessageBox("Add tuning failed"); + Reporting::Notification("Add tuning failed"); delete pNewTuning; return true; } @@ -1214,7 +1214,7 @@ if(pTC) { string str = string("Remove tuning '") + pT->GetName() + string("' from ' ") + pTC->GetName() + string("'?"); - if(MessageBox(str.c_str(), 0, MB_YESNO) == IDYES) + if(Reporting::Confirm(str.c_str()) == cnfYes) { if(!pTC->Remove(pT)) { @@ -1224,7 +1224,7 @@ } else { - MessageBox("Tuning removal failed"); + Reporting::Notification("Tuning removal failed"); } } } @@ -1333,7 +1333,7 @@ } else { - MessageBox("Saving succesful."); + Reporting::Notification("Saving succesful."); m_ModifiedTCs[m_pActiveTuningCollection] = false; } } Modified: trunk/OpenMPT/mptrack/UpdateCheck.cpp =================================================================== --- trunk/OpenMPT/mptrack/UpdateCheck.cpp 2011-09-03 21:46:53 UTC (rev 1015) +++ trunk/OpenMPT/mptrack/UpdateCheck.cpp 2011-09-04 00:09:56 UTC (rev 1016) @@ -83,7 +83,7 @@ { CString msg; msg.Format("OpenMPT would like to check for updates now, proceed?\n\nNote: In the future, OpenMPT will check for updates every %d days. If you do not want this, you can disable update checks in the setup.", CUpdateCheck::updateCheckPeriod); - if(Reporting::Notification(msg, "OpenMPT Internet Update", MB_YESNO | MB_ICONQUESTION) == IDNO) + if(Reporting::Confirm(msg, "OpenMPT Internet Update") == cnfNo) { CUpdateCheck::showUpdateHint = false; caller->Terminate(); @@ -165,7 +165,7 @@ { if(!caller->isAutoUpdate) { - Reporting::Notification("You already have the latest version of OpenMPT.", "OpenMPT Internet Update", MB_OK | MB_ICONINFORMATION); + Reporting::Information("You already have the latest version of OpenMPT.", "OpenMPT Internet Update"); } } else { @@ -198,7 +198,7 @@ if(parseStep >= 4) { resultData.Format("A new version is available!\nOpenMPT %s has been released on %s. Would you like to visit %s for more information?", releaseVersion, releaseDate, releaseURL); - if(Reporting::Notification(resultData, "OpenMPT Internet Update", MB_YESNO | MB_ICONINFORMATION) == IDYES) + if(Reporting::Confirm(resultData, "OpenMPT Internet Update") == cnfYes) { CTrackApp::OpenURL(releaseURL); } @@ -222,7 +222,7 @@ { if(!isAutoUpdate) { - Reporting::Notification(errorMessage, "OpenMPT Internet Update Error", MB_OK | MB_ICONERROR); + Reporting::Error(errorMessage, "OpenMPT Internet Update Error"); } Terminate(); } Modified: trunk/OpenMPT/mptrack/View_gen.cpp =================================================================== --- trunk/OpenMPT/mptrack/View_gen.cpp 2011-09-03 21:46:53 UTC (rev 1015) +++ trunk/OpenMPT/mptrack/View_gen.cpp 2011-09-04 00:09:56 UTC (rev 1016) @@ -1034,7 +1034,7 @@ //TODO: exception handling if (!(pVstPlugin->LoadProgram(files.first_file.c_str()))) { - Reporting::Notification("Error loading preset. Are you sure it is for this plugin?"); + Reporting::Error("Error loading preset. Are you sure it is for this plugin?"); } else { if(pSndFile->GetModSpecifications().supportsPlugins) @@ -1062,7 +1062,7 @@ //TODO: exception handling if (!(pVstPlugin->SaveProgram(files.first_file.c_str()))) - Reporting::Notification("Error saving preset."); + Reporting::Error("Error saving preset."); //end rewbs.fxpPresets } @@ -1463,12 +1463,12 @@ CString prompt; CModDoc *pModDoc = GetDocument(); CSoundFile* pSndFile = pModDoc->GetSoundFile(); - prompt.Format("Insert empty slot before slot FX%d?", m_nCurrentPlugin+1); + prompt.Format("Insert empty slot before slot FX%d?", m_nCurrentPlugin + 1); if (pSndFile->m_MixPlugins[MAX_MIXPLUGINS-1].pMixPlugin) { prompt.Append("\nWarning: plugin data in last slot will be lost."); } - if (Reporting::Notification(prompt, MB_YESNO) == IDYES) + if (Reporting::Confirm(prompt) == cnfYes) { //Delete last plug... Modified: trunk/OpenMPT/mptrack/View_pat.cpp =================================================================== --- trunk/OpenMPT/mptrack/View_pat.cpp 2011-09-03 21:46:53 UTC (rev 1015) +++ trunk/OpenMPT/mptrack/View_pat.cpp 2011-09-04 00:09:56 UTC (rev 1016) @@ -2028,9 +2028,14 @@ if (!(m_findReplace.dwReplaceFlags & PATSEARCH_REPLACE)) goto EndSearch; if (!(m_findReplace.dwReplaceFlags & PATSEARCH_REPLACEALL)) { - UINT ans = MessageBox("Replace this occurrence?", "Replace", MB_YESNOCANCEL); - if (ans == IDYES) bReplace = true; else - if (ans == IDNO) bReplace = false; else goto EndSearch; + ConfirmAnswer result = Reporting::Confirm("Replace this occurrence?", "Replace", true); + if(result == cnfCancel) + { + goto EndSearch; // Yuck! + } else + { + bReplace = (result == cnfYes); + } } if (bReplace) { @@ -2162,7 +2167,7 @@ wsprintf(&szFind[strlen(szFind)], "%02X", m_findReplace.cmdFind.param); } else strcat(szFind, "??"); wsprintf(s, "Cannot find \"%s\"", szFind); - MessageBox(s, "Find/Replace", MB_OK | MB_ICONINFORMATION); + Reporting::Information(s, "Find/Replace"); } } @@ -2713,7 +2718,7 @@ if(pSndFile->m_nChannels <= pSndFile->GetModSpecifications().channelsMin) { - CMainFrame::GetMainFrame()->MessageBox("No channel removed - channel number already at minimum.", "Remove channel", MB_OK | MB_ICONINFORMATION); + Reporting::Error("No channel removed - channel number already at minimum.", "Remove channel"); return; } @@ -2722,7 +2727,7 @@ CString str; str.Format("Remove channel %d? This channel still contains note data!", nChn + 1); - if(isEmpty || CMainFrame::GetMainFrame()->MessageBox(str , "Remove channel", MB_YESNO | MB_ICONQUESTION) == IDYES) + if(isEmpty || Reporting::Confirm(str , "Remove channel") == cnfYes) { vector<bool> keepMask(pModDoc->GetNumChannels(), true); keepMask[nChn] = false; @@ -2767,7 +2772,7 @@ CModDoc *pModDoc = GetDocument(); if (pModDoc == nullptr) return; - if(Reporting::Notification(GetStrI18N(_TEXT("This affects all patterns, proceed?")), MB_YESNO) != IDYES) + if(Reporting::Confirm(GetStrI18N(_TEXT("This affects all patterns, proceed?"))) != cnfYes) return; const CHANNELINDEX nDupChn = GetChanFromCursor(m_nMenuParam); @@ -5626,7 +5631,7 @@ else msg.Format("Unable to determine the time: pattern at current order(=%d) does not correspond to pattern at pattern view(=pattern %d).", currentOrder, m_nPattern); - MessageBox(msg); + Reporting::Notification(msg); } Modified: trunk/OpenMPT/mptrack/View_smp.cpp =================================================================== --- trunk/OpenMPT/mptrack/View_smp.cpp 2011-09-03 21:46:53 UTC (rev 1015) +++ trunk/OpenMPT/mptrack/View_smp.cpp 2011-09-04 00:09:56 UTC (rev 1016) @@ -1737,7 +1737,7 @@ if ((m_dwBeginSel >= m_dwEndSel) || (m_dwEndSel - m_dwBeginSel + 4 >= len)) { - if (MessageBox("Remove this sample?", "Remove Sample", MB_YESNOCANCEL | MB_ICONQUESTION) != IDYES) return; + if (Reporting::Confirm("Remove this sample?", "Remove Sample", true) != cnfYes) return; pModDoc->GetSampleUndo()->PrepareUndo(m_nSample, sundo_replace); CriticalSection cs; @@ -2500,7 +2500,7 @@ if( MAX_SAMPLE_LENGTH - nOldLength < dlg.m_nSamples ) { CString str; str.Format(TEXT("Can't add silence because the new sample length would exceed maximum sample length %u."), MAX_SAMPLE_LENGTH); - Reporting::Notification(str, MB_ICONINFORMATION); + Reporting::Information(str); return; } Modified: trunk/OpenMPT/mptrack/View_tre.cpp =================================================================== --- trunk/OpenMPT/mptrack/View_tre.cpp 2011-09-03 21:46:53 UTC (rev 1015) +++ trunk/OpenMPT/mptrack/View_tre.cpp 2011-09-04 00:09:56 UTC (rev 1016) @@ -1400,7 +1400,7 @@ if (pModDoc && pSndFile) { wsprintf(s, _T("Remove sequence %d?"), modItemID); - if(Reporting::Notification(s, _T("Confirmation"), MB_YESNO | MB_DEFBUTTON2) == IDNO) break; + if(Reporting::Confirm(s, false, true) == cnfNo) 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 || Reporting::Notification(s, _T("Confirmation"), MB_YESNO | MB_DEFBUTTON2) == IDNO) break; + if (pModDoc == nullptr || Reporting::Confirm(s, false, true) == cnfNo) 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 || Reporting::Notification(s, _T("Confirmation"), MB_YESNO | MB_DEFBUTTON2) == IDNO) break; + if (pModDoc == nullptr || Reporting::Confirm(s, false, true) == cnfNo) 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 || Reporting::Notification(s, _T("Confirmation"), MB_YESNO | MB_DEFBUTTON2) == IDNO) break; + if (pModDoc == nullptr || Reporting::Confirm(s, false, true) == cnfNo) break; if (pModDoc->RemoveInstrument((INSTRUMENTINDEX)modItemID)) { pModDoc->UpdateAllViews(NULL, (UINT(modItemID) << HINT_SHIFT_INS) | HINT_MODTYPE|HINT_ENVELOPE|HINT_INSTRUMENT); @@ -1916,7 +1916,7 @@ if (!bOk) { wsprintf(s, "Unable to browse to \"%s\"", lpszDir); - MessageBox(s, NULL, MB_OK|MB_ICONERROR); + Reporting::Error(s); } return TRUE; } @@ -2080,7 +2080,7 @@ } else { - if(Reporting::Notification(_T("Replace the current orderlist?"), _T("Sequence import"), MB_YESNO | MB_ICONQUESTION) == IDNO) + if(Reporting::Confirm(_T("Replace the current orderlist?"), _T("Sequence import")) == cnfNo) return false; } pSndFile->Order.resize(min(pSndFile->GetModSpecifications().ordersMax, pOrigSeq->GetLength()), pSndFile->Order.GetInvalidPatIndex()); Modified: trunk/OpenMPT/mptrack/Vstplug.cpp =================================================================== --- trunk/OpenMPT/mptrack/Vstplug.cpp 2011-09-03 21:46:53 UTC (rev 1015) +++ trunk/OpenMPT/mptrack/Vstplug.cpp 2011-09-04 00:09:56 UTC (rev 1016) @@ -288,7 +288,7 @@ { TCHAR szBuf[256]; wsprintf(szBuf, "Warning: encountered problem when loading plugin dll. Error %d: %s", dw, (LPCTSTR)GetErrorMessage(dw)); - Reporting::Notification(szBuf, "DEBUG: Error when loading plugin dll"); + Reporting::Error(szBuf, "DEBUG: Error when loading plugin dll"); } #endif //_DEBUG //end rewbs.VSTcompliance @@ -1449,7 +1449,7 @@ m_nOutputs = 32; CString str; str.Format("Plugin has unsupported number(=%d) of outputs; plugin may malfunction.", m_pEffect->numOutputs); - Reporting::Notification(str, "Warning", MB_ICONWARNING); + Reporting::Warning(str); } //input pointer array size must be >=2 for now - the input buffer assignment might write to non allocated mem. otherwise Modified: trunk/OpenMPT/mptrack/dlg_misc.cpp =================================================================== --- trunk/OpenMPT/mptrack/dlg_misc.cpp 2011-09-03 21:46:53 UTC (rev 1015) +++ trunk/OpenMPT/mptrack/dlg_misc.cpp 2011-09-04 00:09:56 UTC (rev 1016) @@ -359,7 +359,7 @@ if(maxChans < m_pSndFile->GetNumChannels()) { - if(Reporting::Notification("New module type supports less channels than currently used, and reducing channel number is required. Continue?", MB_OKCANCEL) != IDOK) + if(Reporting::Confirm("New module type supports less channels than currently used, and reducing channel number is required. Continue?") != cnfYes) return false; } @@ -921,7 +921,7 @@ void CMidiMacroSetup::OnMacroHelp() //--------------------------------- { - MessageBox(_T("Valid characters in macros:\n\n" + Reporting::Information(_T("Valid characters in macros:\n\n" "0-9, A-F - Raw hex data (4-Bit value)\n" "c - MIDI channel (4-Bit value)\n" "n - Note value\n\n" @@ -934,7 +934,7 @@ "p - Program select\n\n" "z - Zxx parameter (00-7F)\n\n" "Macros can be up to 31 characters long and contain multiple MIDI messages. SysEx messages are automatically terminated if not specified by the user."), - _T("OpenMPT MIDI Macro quick reference"), MB_OK | MB_ICONINFORMATION); + _T("OpenMPT MIDI Macro quick reference")); } Modified: trunk/OpenMPT/mptrack/fxp.cpp =================================================================== --- trunk/OpenMPT/mptrack/fxp.cpp 2011-09-03 21:46:53 UTC (rev 1015) +++ trunk/OpenMPT/mptrack/fxp.cpp 2011-09-04 00:09:56 UTC (rev 1016) @@ -88,7 +88,7 @@ if ( !inStream.Open(fileName, CFile::modeRead, &e) ) { //TODO: exception - Reporting::Notification("Error opening file."); + Reporting::Error("Error opening file."); return false; } @@ -105,7 +105,7 @@ ChunkMagic == 'CcnK' && (fxMagic == 'FxCk' || fxMagic == 'FPCh'))) { - Reporting::Notification("Bad Magic number: this does not look like a preset file."); + Reporting::Error("Bad Magic number: this does not look like a preset file."); inStream.Close(); return false; } @@ -117,7 +117,7 @@ { if (!ReadLE(inStream, params[p])) { - Reporting::Notification("Error reading Params."); + Reporting::Error("Error reading Params."); inStream.Close(); return false; } @@ -127,7 +127,7 @@ { if (!ReadLE(inStream, chunkSize)) { - Reporting::Notification("Error reading chunk size."); + Reporting::Error("Error reading chunk size."); inStream.Close(); return false; } @@ -136,14 +136,14 @@ if (!chunk) { - Reporting::Notification("Error allocating memory for chunk."); + Reporting::Error("Error allocating memory for chunk."); inStream.Close(); return false; } if (!ReadLE(inStream, (char*)chunk, chunkSize)) { - Reporting::Notification("Error reading chunk."); + Reporting::Error("Error reading chunk."); inStream.Close(); return false; } @@ -231,10 +231,9 @@ return false; } catch (CFileException *e) { - Reporting::Notification(e->m_strFileName); char s[256]; wsprintf(s, "%lx: %d; %d; %s;", e, e->m_cause, e->m_lOsError, (LPCTSTR)e->m_strFileName); - Reporting::Notification(s); + Reporting::Error(s); e->Delete(); } Modified: trunk/OpenMPT/mptrack/mod2midi.cpp =================================================================== --- trunk/OpenMPT/mptrack/mod2midi.cpp 2011-09-03 21:46:53 UTC (rev 1015) +++ trunk/OpenMPT/mptrack/mod2midi.cpp 2011-09-04 00:09:56 UTC (rev 1016) @@ -349,13 +349,13 @@ const CHANNELINDEX chnCount = min(64, m_pSndFile->GetNumChannels()); if(chnCount < m_pSndFile->GetNumChannels()) - MessageBox("Note: Only 64 channels will be exported."); + Reporting::Information("Note: Only 64 channels will be exported."); if (!f.Open(m_szFileName, CFile::modeCreate | CFile::modeWrite)) { return FALSE; } - memset(Tracks, 0, sizeof(Tracks)); + MemsetZero(Tracks); if (!m_pSndFile->m_nDefaultTempo) m_pSndFile->m_nDefaultTempo = 125; nTickMultiplier = MOD2MIDI_TEMPOFACTOR; const uint16 wPPQN = static_cast<uint16>((m_pSndFile->m_nDefaultTempo*nTickMultiplier) / 5); Modified: trunk/OpenMPT/mptrack/test/test.cpp =================================================================== --- trunk/OpenMPT/mptrack/test/test.cpp 2011-09-03 21:46:53 UTC (rev 1015) +++ trunk/OpenMPT/mptrack/test/test.cpp 2011-09-04 00:09:56 UTC (rev 1016) @@ -33,7 +33,7 @@ { \ CString str; \ str.Format("File: " STRINGIZE(__FILE__) "\nLine: " STRINGIZE(__LINE__) "\n\nVERIFY_EQUAL failed when comparing\n" #x "\nand\n" #y); \ - Reporting::Notification(str, "VERIFY_EQUAL failed", MB_ICONERROR); \ + Reporting::Error(str, "VERIFY_EQUAL failed"); \ } // Like VERIFY_EQUAL, but throws exception if comparison fails. @@ -54,11 +54,11 @@ } \ catch(const std::exception& e) \ { \ - Reporting::Notification(CString("Test \"" STRINGIZE... [truncated message content] |