From: <sag...@us...> - 2011-10-01 17:03:30
|
Revision: 1072 http://modplug.svn.sourceforge.net/modplug/?rev=1072&view=rev Author: saga-games Date: 2011-10-01 17:03:23 +0000 (Sat, 01 Oct 2011) Log Message: ----------- [Fix] Sample Editor: Samples created using the "add silence / resize to" button didn't show up in the pattern editor's instrument list instantly. [Imp] When opening a WAV file for rendering fails, the user can choose to retry opening the file. [Ref] Various small changes Modified Paths: -------------- trunk/OpenMPT/common/Reporting.cpp trunk/OpenMPT/common/Reporting.h trunk/OpenMPT/mptrack/Ctrl_smp.cpp trunk/OpenMPT/mptrack/Mod2wave.cpp trunk/OpenMPT/mptrack/View_smp.cpp trunk/OpenMPT/mptrack/dlg_misc.cpp trunk/OpenMPT/mptrack/mptrack.rc trunk/OpenMPT/mptrack/mptrack_10.vcxproj.filters trunk/OpenMPT/soundlib/Dlsbank.cpp Modified: trunk/OpenMPT/common/Reporting.cpp =================================================================== --- trunk/OpenMPT/common/Reporting.cpp 2011-10-01 16:50:44 UTC (rev 1071) +++ trunk/OpenMPT/common/Reporting.cpp 2011-10-01 17:03:23 UTC (rev 1072) @@ -112,3 +112,25 @@ return cnfCancel; } } + + +RetryAnswer Reporting::RetryCancel(const char *text, const CWnd *parent) +//---------------------------------------------------------------------- +{ + return RetryCancel(text, MAINFRAME_TITLE, parent); +} + + +RetryAnswer Reporting::RetryCancel(const char *text, const char *caption, const CWnd *parent) +//------------------------------------------------------------------------------------------- +{ + UINT result = ShowNotification(text, caption, MB_RETRYCANCEL, parent); + switch(result) + { + case IDRETRY: + return rtyRetry; + default: + case IDCANCEL: + return rtyCancel; + } +} Modified: trunk/OpenMPT/common/Reporting.h =================================================================== --- trunk/OpenMPT/common/Reporting.h 2011-10-01 16:50:44 UTC (rev 1071) +++ trunk/OpenMPT/common/Reporting.h 2011-10-01 17:03:23 UTC (rev 1072) @@ -19,6 +19,12 @@ cnfCancel, }; +enum RetryAnswer +{ + rtyRetry, + rtyCancel, +}; + //============= class Reporting //============= @@ -55,6 +61,10 @@ 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); + // Show a confirmation dialog. + static RetryAnswer RetryCancel(const char *text, const CWnd *parent = nullptr); + static RetryAnswer RetryCancel(const char *text, const char *caption, const CWnd *parent = nullptr); + }; #endif // REPORTING_H Modified: trunk/OpenMPT/mptrack/Ctrl_smp.cpp =================================================================== --- trunk/OpenMPT/mptrack/Ctrl_smp.cpp 2011-10-01 16:50:44 UTC (rev 1071) +++ trunk/OpenMPT/mptrack/Ctrl_smp.cpp 2011-10-01 17:03:23 UTC (rev 1072) @@ -914,7 +914,7 @@ void CCtrlSamples::OnSampleNew() //------------------------------ { - bool bDuplicate = CMainFrame::GetInputHandler()->ShiftPressed(); + const bool bDuplicate = CMainFrame::GetInputHandler()->ShiftPressed(); SAMPLEINDEX smp = m_pModDoc->InsertSample(true); if (smp != SAMPLEINDEX_INVALID) Modified: trunk/OpenMPT/mptrack/Mod2wave.cpp =================================================================== --- trunk/OpenMPT/mptrack/Mod2wave.cpp 2011-10-01 16:50:44 UTC (rev 1071) +++ trunk/OpenMPT/mptrack/Mod2wave.cpp 2011-10-01 17:03:23 UTC (rev 1072) @@ -611,12 +611,20 @@ DWORD dwDataOffset; LONG lMax = 256; - if ((!m_pSndFile) || (!m_lpszFileName) || ((f = fopen(m_lpszFileName, "w+b")) == NULL)) + if (!m_pSndFile || !m_lpszFileName) { - Reporting::Notification("Could not open file for writing. Is it open in another application?"); EndDialog(IDCANCEL); return; } + + while((f = fopen(m_lpszFileName, "w+b")) == NULL) + { + if(Reporting::RetryCancel("Could not open file for writing. Is it open in another application?") == rtyCancel) + { + EndDialog(IDCANCEL); + return; + } + } SetPriorityClass(GetCurrentProcess(), NORMAL_PRIORITY_CLASS); int oldVol = m_pSndFile->GetMasterVolume(); @@ -999,10 +1007,12 @@ if (theApp.GetACMConvert().AcmStreamPrepareHeader(hAStream, &ash, 0L) != MMSYSERR_NOERROR) goto OnError; bPrepared = true; // Creating the output file - if ((f = fopen(m_lpszFileName, "wb")) == NULL) + while ((f = fopen(m_lpszFileName, "wb")) == NULL) { - Reporting::Notification("Could not open file for writing. Is it open in another application?"); - goto OnError; + if(Reporting::RetryCancel("Could not open file for writing. Is it open in another application?") == rtyCancel) + { + goto OnError; + } } wfh.id_RIFF = IFFID_RIFF; wfh.id_WAVE = IFFID_WAVE; Modified: trunk/OpenMPT/mptrack/View_smp.cpp =================================================================== --- trunk/OpenMPT/mptrack/View_smp.cpp 2011-10-01 16:50:44 UTC (rev 1071) +++ trunk/OpenMPT/mptrack/View_smp.cpp 2011-10-01 17:03:23 UTC (rev 1072) @@ -2516,7 +2516,7 @@ const ctrlSmp::SmpLength nOldLength = sample.nLength; - if( MAX_SAMPLE_LENGTH - nOldLength < dlg.m_nSamples ) + 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::Information(str); @@ -2557,7 +2557,7 @@ { SetCurSel(0, 0); pModDoc->SetModified(); - pModDoc->UpdateAllViews(NULL, (m_nSample << HINT_SHIFT_SMP) | HINT_SAMPLEINFO | HINT_SAMPLEDATA, NULL); + pModDoc->UpdateAllViews(NULL, (m_nSample << HINT_SHIFT_SMP) | HINT_SAMPLEINFO | HINT_SAMPLEDATA | HINT_SMPNAMES, NULL); } } Modified: trunk/OpenMPT/mptrack/dlg_misc.cpp =================================================================== --- trunk/OpenMPT/mptrack/dlg_misc.cpp 2011-10-01 16:50:44 UTC (rev 1071) +++ trunk/OpenMPT/mptrack/dlg_misc.cpp 2011-10-01 17:03:23 UTC (rev 1072) @@ -781,24 +781,24 @@ UpdateDialog(); int offsetx=108, offsety=30, separatorx=4, separatory=2, - height=18, widthMacro=30, widthVal=90, widthType=135, widthBtn=60; + height=18, widthMacro=30, widthVal=90, widthType=135, widthBtn=70; - for (UINT m=0; m<NUM_MACROS; m++) + for (UINT m = 0; m < NUM_MACROS; m++) { m_EditMacro[m].Create("", /*BS_FLAT |*/ WS_CHILD | WS_VISIBLE | WS_TABSTOP /*| WS_BORDER*/, - CRect(offsetx, offsety+m*(separatory+height), offsetx+widthMacro, offsety+m*(separatory+height)+height), this, ID_PLUGSELECT+NUM_MACROS+m); + CRect(offsetx, offsety + m * (separatory + height), offsetx + widthMacro, offsety + m * (separatory + height) + height), this, ID_PLUGSELECT + NUM_MACROS + m); m_EditMacro[m].SetFont(GetFont()); m_EditMacroType[m].Create(ES_READONLY | WS_CHILD| WS_VISIBLE | WS_TABSTOP | WS_BORDER, - CRect(offsetx+separatorx+widthMacro, offsety+m*(separatory+height), offsetx+widthMacro+widthType, offsety+m*(separatory+height)+height), this, ID_PLUGSELECT+NUM_MACROS+m); + CRect(offsetx + separatorx + widthMacro, offsety + m* (separatory + height), offsetx + widthMacro + widthType, offsety + m * (separatory + height) + height), this, ID_PLUGSELECT + NUM_MACROS + m); m_EditMacroType[m].SetFont(GetFont()); m_EditMacroValue[m].Create(ES_CENTER | ES_READONLY | WS_CHILD | WS_VISIBLE | WS_TABSTOP | WS_BORDER, - CRect(offsetx+separatorx+widthType+widthMacro, offsety+m*(separatory+height), offsetx+widthMacro+widthType+widthVal, offsety+m*(separatory+height)+height), this, ID_PLUGSELECT+NUM_MACROS+m); + CRect(offsetx + separatorx + widthType + widthMacro, offsety + m * (separatory + height), offsetx + widthMacro + widthType + widthVal, offsety + m * (separatory + height) + height), this, ID_PLUGSELECT + NUM_MACROS + m); m_EditMacroValue[m].SetFont(GetFont()); m_BtnMacroShowAll[m].Create("Show All...", WS_CHILD | WS_TABSTOP | WS_VISIBLE, - CRect(offsetx+separatorx+widthType+widthMacro+widthVal, offsety+m*(separatory+height), offsetx+widthMacro+widthType+widthVal+widthBtn, offsety+m*(separatory+height)+height), this, ID_PLUGSELECT+m); + CRect(offsetx + separatorx + widthType + widthMacro + widthVal, offsety + m *(separatory + height), offsetx + widthMacro + widthType + widthVal + widthBtn, offsety + m * (separatory + height) + height), this, ID_PLUGSELECT + m); m_BtnMacroShowAll[m].SetFont(GetFont()); } UpdateMacroList(); @@ -1128,8 +1128,7 @@ m_EditSFx.SetWindowText(macroText); } else { - Reporting::Notification("Warning: Currently MPT can only assign macros to parameters 0 to 383"); - param = 383; + Reporting::Notification("MPT can only assign macros to parameters 0 to 383. Use Parameter Control Notes to automate higher parameters."); } } Modified: trunk/OpenMPT/mptrack/mptrack.rc =================================================================== --- trunk/OpenMPT/mptrack/mptrack.rc 2011-10-01 16:50:44 UTC (rev 1071) +++ trunk/OpenMPT/mptrack/mptrack.rc 2011-10-01 17:03:23 UTC (rev 1072) @@ -1218,7 +1218,7 @@ IDD_MIDIMACRO DIALOGEX 0, 0, 358, 354 STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_CAPTION | WS_SYSMENU EXSTYLE WS_EX_TOOLWINDOW -CAPTION "Zxx Macros Configuration" +CAPTION "Zxx Macro Configuration" FONT 8, "MS Shell Dlg", 0, 0, 0x0 BEGIN DEFPUSHBUTTON "OK",IDOK,300,6,50,14 Modified: trunk/OpenMPT/mptrack/mptrack_10.vcxproj.filters =================================================================== --- trunk/OpenMPT/mptrack/mptrack_10.vcxproj.filters 2011-10-01 16:50:44 UTC (rev 1071) +++ trunk/OpenMPT/mptrack/mptrack_10.vcxproj.filters 2011-10-01 17:03:23 UTC (rev 1072) @@ -205,9 +205,6 @@ <ClCompile Include="MainFrm.cpp"> <Filter>Source Files</Filter> </ClCompile> - <ClCompile Include="MIDIMappingDialog.cpp"> - <Filter>Source Files</Filter> - </ClCompile> <ClCompile Include="..\soundlib\mmcmp.cpp"> <Filter>Source Files</Filter> </ClCompile> @@ -430,6 +427,9 @@ <ClCompile Include="KeyConfigDlg.cpp"> <Filter>Source Files\Dialogs</Filter> </ClCompile> + <ClCompile Include="MIDIMappingDialog.cpp"> + <Filter>Source Files\Dialogs</Filter> + </ClCompile> </ItemGroup> <ItemGroup> <ClInclude Include="AbstractVstEditor.h"> @@ -525,9 +525,6 @@ <ClInclude Include="..\soundlib\midi.h"> <Filter>Header Files</Filter> </ClInclude> - <ClInclude Include="MIDIMappingDialog.h"> - <Filter>Header Files</Filter> - </ClInclude> <ClInclude Include="mod2midi.h"> <Filter>Header Files</Filter> </ClInclude> @@ -753,6 +750,9 @@ <ClInclude Include="KeyConfigDlg.h"> <Filter>Header Files\Dialogs</Filter> </ClInclude> + <ClInclude Include="MIDIMappingDialog.h"> + <Filter>Header Files\Dialogs</Filter> + </ClInclude> </ItemGroup> <ItemGroup> <None Include="res\bitmap1.bmp"> Modified: trunk/OpenMPT/soundlib/Dlsbank.cpp =================================================================== --- trunk/OpenMPT/soundlib/Dlsbank.cpp 2011-10-01 16:50:44 UTC (rev 1071) +++ trunk/OpenMPT/soundlib/Dlsbank.cpp 2011-10-01 17:03:23 UTC (rev 1072) @@ -460,12 +460,13 @@ FILE *f; if ((!lpszFileName) || (!lpszFileName[0])) return FALSE; if ((f = fopen(lpszFileName, "rb")) == NULL) return FALSE; - memset(&riff, 0, sizeof(riff)); + MemsetZero(riff); fread(&riff, sizeof(RIFFCHUNKID), 1, f); // Check for embedded DLS sections if (riff.id_RIFF == IFFID_FORM) { - do { + do + { int len = BigEndian(riff.riff_len); if (len <= 4) break; if (riff.id_DLS == IFFID_XDLS) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |