From: <sag...@us...> - 2011-04-13 20:00:38
|
Revision: 853 http://modplug.svn.sourceforge.net/modplug/?rev=853&view=rev Author: saga-games Date: 2011-04-13 20:00:31 +0000 (Wed, 13 Apr 2011) Log Message: ----------- [Fix] The VST fix from rev. 844 actually broke VSTi playing. [Mod] OpenMPT: Version is now 1.19.01.03 Modified Paths: -------------- trunk/OpenMPT/mptrack/AbstractVstEditor.cpp trunk/OpenMPT/mptrack/version.h Modified: trunk/OpenMPT/mptrack/AbstractVstEditor.cpp =================================================================== --- trunk/OpenMPT/mptrack/AbstractVstEditor.cpp 2011-04-13 17:44:31 UTC (rev 852) +++ trunk/OpenMPT/mptrack/AbstractVstEditor.cpp 2011-04-13 20:00:31 UTC (rev 853) @@ -367,25 +367,30 @@ m_nInstrument = GetBestInstrumentCandidate(); //only show messagebox if plug is able to process notes. - if(m_nInstrument < 0 && m_pVstPlugin->CanRecieveMidiEvents()) + if(m_nInstrument < 0) { - CModDoc *pModDoc = m_pVstPlugin->GetModDoc(); - if(pModDoc == nullptr) - return false; + if(m_pVstPlugin->CanRecieveMidiEvents()) + { + CModDoc *pModDoc = m_pVstPlugin->GetModDoc(); + if(pModDoc == nullptr) + return false; - if(!m_pVstPlugin->isInstrument() || pModDoc->GetSoundFile()->GetModSpecifications().instrumentsMax == 0 || - AfxMessageBox(_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) == IDNO) + if(!m_pVstPlugin->isInstrument() || pModDoc->GetSoundFile()->GetModSpecifications().instrumentsMax == 0 || + AfxMessageBox(_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) == IDNO) + { + return false; + } else + { + return CreateInstrument(); + } + } else { + // Can't process notes return false; - } else - { - return CreateInstrument(); } } else { - // used to return true but that doesn't make sense to me. - // if this is true, random (sample) channels will be retriggered when pressing notes in the editor... - return false; + return true; } } Modified: trunk/OpenMPT/mptrack/version.h =================================================================== --- trunk/OpenMPT/mptrack/version.h 2011-04-13 17:44:31 UTC (rev 852) +++ trunk/OpenMPT/mptrack/version.h 2011-04-13 20:00:31 UTC (rev 853) @@ -15,7 +15,7 @@ #define VER_MAJORMAJOR 1 #define VER_MAJOR 19 #define VER_MINOR 01 -#define VER_MINORMINOR 02 +#define VER_MINORMINOR 03 //Creates version number from version parts that appears in version string. //For example MAKE_VERSION_NUMERIC(1,17,02,28) gives version number of This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <sag...@us...> - 2011-05-02 22:06:06
|
Revision: 863 http://modplug.svn.sourceforge.net/modplug/?rev=863&view=rev Author: saga-games Date: 2011-05-02 22:05:59 +0000 (Mon, 02 May 2011) Log Message: ----------- [Mod] GUID can now be sent on update check (currently unused on the server side). This also introduces a change in the update URL format. Modified Paths: -------------- trunk/OpenMPT/mptrack/MainFrm.cpp trunk/OpenMPT/mptrack/UpdateCheck.cpp trunk/OpenMPT/mptrack/UpdateCheck.h trunk/OpenMPT/mptrack/mptrack.rc trunk/OpenMPT/mptrack/version.h Modified: trunk/OpenMPT/mptrack/MainFrm.cpp =================================================================== --- trunk/OpenMPT/mptrack/MainFrm.cpp 2011-05-02 21:13:34 UTC (rev 862) +++ trunk/OpenMPT/mptrack/MainFrm.cpp 2011-05-02 22:05:59 UTC (rev 863) @@ -387,6 +387,17 @@ vIniVersion = MptVersion::ToNum(gcsPreviousVersion); gcsInstallGUID = GetPrivateProfileCString("Version", "InstallGUID", "", iniFile); + if(gcsInstallGUID == "") + { + //No GUID found in INI file - generate one. + GUID guid; + CoCreateGuid(&guid); + BYTE* Str; + UuidToString((UUID*)&guid, &Str); + gcsInstallGUID.Format("%s", (LPTSTR)Str); + RpcStringFree(&Str); + } + gbMdiMaximize = GetPrivateProfileLong("Display", "MDIMaximize", true, iniFile); glTreeWindowWidth = GetPrivateProfileLong("Display", "MDITreeWidth", 160, iniFile); glTreeSplitRatio = GetPrivateProfileLong("Display", "MDITreeRatio", 128, iniFile); @@ -421,6 +432,7 @@ outTime, GetPrivateProfileInt("Update", "UpdateCheckPeriod", CUpdateCheck::GetUpdateCheckPeriod(), iniFile), GetPrivateProfileCString("Update", "UpdateURL", CUpdateCheck::GetUpdateURL(), iniFile), + GetPrivateProfileInt("Update", "SendGUID", CUpdateCheck::GetSendGUID() ? 1 : 0, iniFile) ? true : false, GetPrivateProfileInt("Update", "ShowUpdateHint", CUpdateCheck::GetShowUpdateHint() ? 1 : 0, iniFile) ? true : false ); } @@ -435,7 +447,7 @@ #ifndef NO_DSOUND DWORD defaultDevice = SNDDEV_BUILD_ID(0, SNDDEV_DSOUND); // first DirectSound device #else - DWORD defaultDevice = SNDDEV_BUILD_ID(0, SNDDEV_WAVEOUT); // first DirectSound device + DWORD defaultDevice = SNDDEV_BUILD_ID(0, SNDDEV_WAVEOUT); // first WaveOut device #endif // NO_DSOUND #ifndef NO_ASIO // If there's an ASIO device available, prefer it over DirectSound @@ -1026,6 +1038,7 @@ WritePrivateProfileString("Update", "LastUpdateCheck", outDate, iniFile); WritePrivateProfileLong("Update", "UpdateCheckPeriod", CUpdateCheck::GetUpdateCheckPeriod(), iniFile); WritePrivateProfileString("Update", "UpdateURL", CUpdateCheck::GetUpdateURL(), iniFile); + WritePrivateProfileLong("Update", "SendGUID", CUpdateCheck::GetSendGUID() ? 1 : 0, iniFile); WritePrivateProfileLong("Update", "ShowUpdateHint", CUpdateCheck::GetShowUpdateHint() ? 1 : 0, iniFile); } Modified: trunk/OpenMPT/mptrack/UpdateCheck.cpp =================================================================== --- trunk/OpenMPT/mptrack/UpdateCheck.cpp 2011-05-02 21:13:34 UTC (rev 862) +++ trunk/OpenMPT/mptrack/UpdateCheck.cpp 2011-05-02 22:05:59 UTC (rev 863) @@ -17,12 +17,13 @@ #endif -const CString CUpdateCheck::defaultUpdateURL = "http://update.openmpt.org/check/%s"; +const CString CUpdateCheck::defaultUpdateURL = "http://update.openmpt.org/check/$VERSION/$GUID"; // Static configuration variables time_t CUpdateCheck::lastUpdateCheck = 0; int CUpdateCheck::updateCheckPeriod = 7; CString CUpdateCheck::updateBaseURL = CUpdateCheck::defaultUpdateURL; +bool CUpdateCheck::sendGUID = true; bool CUpdateCheck::showUpdateHint = true; @@ -93,21 +94,12 @@ } CUpdateCheck::showUpdateHint = false; + // Prepare UA / URL strings... const CString userAgent = CString("OpenMPT ") + MptVersion::str; - CString updateURL; - updateURL.Format(CUpdateCheck::updateBaseURL, MptVersion::str); + CString updateURL = CUpdateCheck::updateBaseURL; + updateURL.Replace("$VERSION", MptVersion::str); + updateURL.Replace("$GUID", GetSendGUID() ? CMainFrame::gcsInstallGUID : "anonymous"); - /*if (CMainFrame::gcsInstallGUID == "") - { - //No GUID found in INI file - generate one. - GUID guid; - CoCreateGuid(&guid); - BYTE* Str; - UuidToString((UUID*)&guid, &Str); - CMainFrame::gcsInstallGUID.Format("%s", (LPTSTR)Str); - RpcStringFree(&Str); - }*/ - // Establish a connection. caller->internetHandle = InternetOpen(userAgent, INTERNET_OPEN_TYPE_PRECONFIG, NULL, NULL, 0); if(caller->internetHandle == NULL) @@ -278,6 +270,7 @@ ON_COMMAND(IDC_RADIO2, OnSettingsChanged) ON_COMMAND(IDC_RADIO3, OnSettingsChanged) ON_COMMAND(IDC_RADIO4, OnSettingsChanged) + ON_COMMAND(IDC_CHECK1, OnSettingsChanged) ON_EN_CHANGE(IDC_EDIT1, OnSettingsChanged) END_MESSAGE_MAP() @@ -296,6 +289,7 @@ case 31: radioID = IDC_RADIO4; break; } CheckRadioButton(IDC_RADIO1, IDC_RADIO4, radioID); + CheckDlgButton(IDC_CHECK1, CUpdateCheck::GetSendGUID() ? MF_CHECKED : MF_UNCHECKED); SetDlgItemText(IDC_EDIT1, CUpdateCheck::GetUpdateURL()); const time_t t = CUpdateCheck::GetLastUpdateCheck(); @@ -325,7 +319,7 @@ CString updateURL; GetDlgItemText(IDC_EDIT1, updateURL); - CUpdateCheck::SetUpdateSettings(CUpdateCheck::GetLastUpdateCheck(), updateCheckPeriod, updateURL, CUpdateCheck::GetShowUpdateHint()); + CUpdateCheck::SetUpdateSettings(CUpdateCheck::GetLastUpdateCheck(), updateCheckPeriod, updateURL, IsDlgButtonChecked(IDC_CHECK1) ? true : false, CUpdateCheck::GetShowUpdateHint()); CPropertyPage::OnOK(); } Modified: trunk/OpenMPT/mptrack/UpdateCheck.h =================================================================== --- trunk/OpenMPT/mptrack/UpdateCheck.h 2011-05-02 21:13:34 UTC (rev 862) +++ trunk/OpenMPT/mptrack/UpdateCheck.h 2011-05-02 22:05:59 UTC (rev 863) @@ -36,9 +36,10 @@ static time_t GetLastUpdateCheck() { return lastUpdateCheck; }; static int GetUpdateCheckPeriod() { return updateCheckPeriod; }; static CString GetUpdateURL() { return updateBaseURL; }; + static bool GetSendGUID() { return sendGUID; } static bool GetShowUpdateHint() { return showUpdateHint; }; - static void SetUpdateSettings(time_t last, int period, CString url, bool showHint) - { lastUpdateCheck = last; updateCheckPeriod = period; updateBaseURL = url; showUpdateHint = showHint; }; + static void SetUpdateSettings(time_t last, int period, CString url, bool sendID, bool showHint) + { lastUpdateCheck = last; updateCheckPeriod = period; updateBaseURL = url; sendGUID = sendID; showUpdateHint = showHint; }; protected: @@ -46,6 +47,7 @@ static time_t lastUpdateCheck; // Time of last successful update check static int updateCheckPeriod; // Check for updates every x days static CString updateBaseURL; // URL where the version check should be made. + static bool sendGUID; // Send GUID to collect basic stats static bool showUpdateHint; // Show hint on first automatic update bool isAutoUpdate; // Are we running an automatic update check? Modified: trunk/OpenMPT/mptrack/mptrack.rc =================================================================== --- trunk/OpenMPT/mptrack/mptrack.rc 2011-05-02 21:13:34 UTC (rev 862) +++ trunk/OpenMPT/mptrack/mptrack.rc 2011-05-02 22:05:59 UTC (rev 863) @@ -196,13 +196,17 @@ CONTROL "Daily",IDC_RADIO2,"Button",BS_AUTORADIOBUTTON,12,30,240,8 CONTROL "Weekly (recommended)",IDC_RADIO3,"Button",BS_AUTORADIOBUTTON,12,42,240,8 CONTROL "Monthly",IDC_RADIO4,"Button",BS_AUTORADIOBUTTON,12,54,240,8 - GROUPBOX "Advanced Settings",IDC_STATIC,6,78,258,60 - LTEXT "Update server URL:",IDC_STATIC,12,90,186,8 - EDITTEXT IDC_EDIT1,12,102,246,12,ES_AUTOHSCROLL - LTEXT "",IDC_LASTUPDATE,6,168,258,24 - LTEXT "Do not change this unless you are absolutely sure of what you are doing.",IDC_STATIC,12,120,246,12 - PUSHBUTTON "Check for Updates",IDC_BUTTON1,6,144,84,18 - PUSHBUTTON "Reset",IDC_BUTTON2,204,87,54,12 + GROUPBOX "Privacy Settings",IDC_STATIC,6,78,258,54 + CONTROL "Allow us to collect basic update statistics",IDC_CHECK1, + "Button",BS_AUTOCHECKBOX | WS_TABSTOP,12,90,246,12 + LTEXT "If enabled, a randomized user ID is created and transmitted with every update check. This ID can not be linked to you or your computer in any way.",IDC_STATIC,12,102,246,24 + GROUPBOX "Advanced Settings",IDC_STATIC,6,138,258,60 + LTEXT "Update server URL:",IDC_STATIC,12,150,186,8 + EDITTEXT IDC_EDIT1,12,162,246,12,ES_AUTOHSCROLL + PUSHBUTTON "Reset",IDC_BUTTON2,204,146,54,12 + LTEXT "Do not change this unless you are absolutely sure of what you are doing.",IDC_STATIC,12,180,246,12 + PUSHBUTTON "Check for Updates",IDC_BUTTON1,6,204,84,18 + LTEXT "",IDC_LASTUPDATE,6,228,258,24 END @@ -1194,7 +1198,7 @@ END IDD_MIDIMACRO DIALOGEX 0, 0, 358, 354 -STYLE DS_SETFONT | DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU +STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_CAPTION | WS_SYSMENU EXSTYLE WS_EX_TOOLWINDOW CAPTION "Zxx Macros Configuration" FONT 8, "MS Shell Dlg", 0, 0, 0x0 Modified: trunk/OpenMPT/mptrack/version.h =================================================================== --- trunk/OpenMPT/mptrack/version.h 2011-05-02 21:13:34 UTC (rev 862) +++ trunk/OpenMPT/mptrack/version.h 2011-05-02 22:05:59 UTC (rev 863) @@ -15,7 +15,7 @@ #define VER_MAJORMAJOR 1 #define VER_MAJOR 19 #define VER_MINOR 01 -#define VER_MINORMINOR 04 +#define VER_MINORMINOR 05 //Creates version number from version parts that appears in version string. //For example MAKE_VERSION_NUMERIC(1,17,02,28) gives version number of This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <sag...@us...> - 2011-05-04 20:18:46
|
Revision: 865 http://modplug.svn.sourceforge.net/modplug/?rev=865&view=rev Author: saga-games Date: 2011-05-04 20:18:40 +0000 (Wed, 04 May 2011) Log Message: ----------- [Mod] Song Creation: If the user's default MIDI macro configuration is the standard configuration, it is not embedded by default anymore. [Fix] The first played note in the pattern / sample editor is not cut off anymore (tx C-jeff, http://bugs.openmpt.org/view.php?id=123) Modified Paths: -------------- trunk/OpenMPT/mptrack/Moddoc.cpp trunk/OpenMPT/mptrack/version.h Modified: trunk/OpenMPT/mptrack/Moddoc.cpp =================================================================== --- trunk/OpenMPT/mptrack/Moddoc.cpp 2011-05-03 22:36:08 UTC (rev 864) +++ trunk/OpenMPT/mptrack/Moddoc.cpp 2011-05-04 20:18:40 UTC (rev 865) @@ -154,13 +154,19 @@ m_SndFile.Create(NULL, this, 0); m_SndFile.ChangeModTypeTo(CTrackApp::GetDefaultDocType()); - if(CTrackApp::IsProject()) { + if(CTrackApp::IsProject()) + { m_SndFile.m_dwSongFlags |= SONG_ITPROJECT; } - if (m_SndFile.m_nType & (MOD_TYPE_XM | MOD_TYPE_IT | MOD_TYPE_MPT)) { + theApp.GetDefaultMidiMacro(&m_SndFile.m_MidiCfg); + if (m_SndFile.m_nType & (MOD_TYPE_XM | MOD_TYPE_IT | MOD_TYPE_MPT)) + { m_SndFile.m_dwSongFlags |= SONG_LINEARSLIDES; - m_SndFile.m_dwSongFlags |= SONG_EMBEDMIDICFG; + if(!IsMacroDefaultSetupUsed()) + { + m_SndFile.m_dwSongFlags |= SONG_EMBEDMIDICFG; + } } @@ -170,7 +176,6 @@ // ...and the order length m_SndFile.Order.resize(min(ModSequenceSet::s_nCacheSize, m_SndFile.GetModSpecifications().ordersMax)); - theApp.GetDefaultMidiMacro(&m_SndFile.m_MidiCfg); ReinitRecordState(); InitializeMod(); SetModifiedFlag(FALSE); @@ -849,6 +854,7 @@ if (nVol > 256) nVol = 256; if (note <= NOTE_MAX) { + BEGIN_CRITICAL(); //kill notes if required. @@ -865,6 +871,17 @@ } } + END_CRITICAL(); + + if (pMainFrm->GetModPlaying() != this) + { + m_SndFile.m_dwSongFlags |= SONG_PAUSED; + pMainFrm->PlayMod(this, m_hWndFollow, m_dwNotifyType); + } + CMainFrame::EnableLowLatencyMode(); + + BEGIN_CRITICAL(); + //find a channel if required //if (nCurrentChn<0) { nChn = FindAvailableChannel(); @@ -986,12 +1003,6 @@ END_CRITICAL(); - if (pMainFrm->GetModPlaying() != this) - { - m_SndFile.m_dwSongFlags |= SONG_PAUSED; - pMainFrm->PlayMod(this, m_hWndFollow, m_dwNotifyType); - } - CMainFrame::EnableLowLatencyMode(); } else { BEGIN_CRITICAL(); @@ -3171,6 +3182,7 @@ enmParameteredMacroType CModDoc::GetMacroType(CString value) //---------------------------------------------------------- { + value.Remove(' '); if (value.Compare("")==0) return sfx_unused; if (value.Compare("F0F000z")==0) return sfx_cutoff; if (value.Compare("F0F001z")==0) return sfx_reso; @@ -3186,6 +3198,7 @@ int CModDoc::MacroToPlugParam(CString macro) //------------------------------------------ { + macro.Remove(' '); int code=0; char* param = (char *) (LPCTSTR) macro; param += 4; @@ -3204,6 +3217,7 @@ int CModDoc::MacroToMidiCC(CString macro) //--------------------------------------- { + macro.Remove(' '); int code=0; char* param = (char *) (LPCTSTR) macro; param += 2; Modified: trunk/OpenMPT/mptrack/version.h =================================================================== --- trunk/OpenMPT/mptrack/version.h 2011-05-03 22:36:08 UTC (rev 864) +++ trunk/OpenMPT/mptrack/version.h 2011-05-04 20:18:40 UTC (rev 865) @@ -15,7 +15,7 @@ #define VER_MAJORMAJOR 1 #define VER_MAJOR 19 #define VER_MINOR 01 -#define VER_MINORMINOR 05 +#define VER_MINORMINOR 06 //Creates version number from version parts that appears in version string. //For example MAKE_VERSION_NUMERIC(1,17,02,28) gives version number of This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <sag...@us...> - 2011-05-08 20:24:56
|
Revision: 867 http://modplug.svn.sourceforge.net/modplug/?rev=867&view=rev Author: saga-games Date: 2011-05-08 20:24:49 +0000 (Sun, 08 May 2011) Log Message: ----------- [Ref] More pattern cursor refactoring. Modified Paths: -------------- trunk/OpenMPT/mptrack/View_pat.cpp trunk/OpenMPT/mptrack/View_pat.h Modified: trunk/OpenMPT/mptrack/View_pat.cpp =================================================================== --- trunk/OpenMPT/mptrack/View_pat.cpp 2011-05-08 19:43:27 UTC (rev 866) +++ trunk/OpenMPT/mptrack/View_pat.cpp 2011-05-08 20:24:49 UTC (rev 867) @@ -217,7 +217,7 @@ bUpdateScroll = true; } if (m_nRow >= pSndFile->Patterns[m_nPattern].GetNumRows()) m_nRow = 0; - int sel = m_dwCursor | (m_nRow << 16); + int sel = CreateCursor(m_nRow) | m_dwCursor; SetCurSel(sel, sel); UpdateSizes(); UpdateScrollSize(); @@ -331,7 +331,7 @@ // Fix: Horizontal scrollbar pos screwed when selecting with mouse UpdateScrollbarPositions(bUpdateHorizontalScrollbar); InvalidateRow(); - int sel = m_dwCursor | (m_nRow << 16); + int sel = CreateCursor(m_nRow) | m_dwCursor; int sel0 = sel; if ((m_dwStatus & (PATSTATUS_KEYDRAGSEL|PATSTATUS_MOUSEDRAGSEL)) && (!(m_dwStatus & PATSTATUS_DRAGNDROPEDIT))) sel0 = m_dwStartSel; @@ -367,7 +367,7 @@ } if ((ncol >> 3) >= pSndFile->GetNumChannels()) return FALSE; m_dwCursor = ncol; - int sel = m_dwCursor | (m_nRow << 16); + int sel = CreateCursor(m_nRow) | m_dwCursor; int sel0 = sel; if ((m_dwStatus & (PATSTATUS_KEYDRAGSEL|PATSTATUS_MOUSEDRAGSEL)) && (!(m_dwStatus & PATSTATUS_DRAGNDROPEDIT))) sel0 = m_dwStartSel; @@ -609,7 +609,7 @@ } if (m_pEditWnd) { - m_pEditWnd->ShowEditWindow(m_nPattern, (m_nRow << 16) | m_dwCursor); + m_pEditWnd->ShowEditWindow(m_nPattern, CreateCursor(m_nRow) | m_dwCursor); return TRUE; } return FALSE; @@ -1110,7 +1110,7 @@ //----------------------------------------------------------- { DWORD dwPos = GetPositionFromPoint(point); - if ((dwPos == ((m_nRow << 16) | m_dwCursor)) && (point.y >= m_szHeader.cy)) + if ((dwPos == (CreateCursor(m_nRow) | m_dwCursor)) && (point.y >= m_szHeader.cy)) { if (ShowEditWindow()) return; } @@ -1437,7 +1437,7 @@ UINT max = pModDoc->GetSoundFile()->Patterns[m_nPattern].GetNumRows(); if ((row) && (row >= max)) row = max-1; dwPos &= 0xFFFF; - dwPos |= (row << 16); + dwPos |= CreateCursor(row); } // Drag & Drop editing if (m_dwStatus & PATSTATUS_DRAGNDROPEDIT) @@ -1474,9 +1474,7 @@ if (pModDoc) { CSoundFile *pSndFile = pModDoc->GetSoundFile(); - SetCurSel(0, ((pSndFile->Patterns[m_nPattern].GetNumRows()-1) << 16) - | ((pSndFile->m_nChannels - 1) << 3) - | (4)); + SetCurSel(CreateCursor(0), CreateCursor(pSndFile->Patterns[m_nPattern].GetNumRows() - 1, pSndFile->GetNumChannels() - 1, LAST_COLUMN)); } } @@ -1488,9 +1486,7 @@ if (pModDoc) { CSoundFile *pSndFile = pModDoc->GetSoundFile(); - SetCurSel(m_nMenuParam & 0xFFF8, - ((pSndFile->Patterns[m_nPattern].GetNumRows()-1) << 16) - | ((m_nMenuParam & 0xFFF8)+4)); + SetCurSel(CreateCursor(0, GetChanFromCursor(m_nMenuParam), 0), CreateCursor(pSndFile->Patterns[m_nPattern].GetNumRows() - 1, GetChanFromCursor(m_nMenuParam), LAST_COLUMN)); } } @@ -1502,14 +1498,13 @@ if (pModDoc) { CSoundFile *pSndFile = pModDoc->GetSoundFile(); - DWORD dwBeginSel = m_dwCursor & 0xFFF8; - DWORD dwEndSel = ((pSndFile->Patterns[m_nPattern].GetNumRows()-1) << 16) | ((m_dwCursor & 0xFFF8)+4); + DWORD dwBeginSel = CreateCursor(0, GetChanFromCursor(m_dwCursor), 0); + DWORD dwEndSel = CreateCursor(pSndFile->Patterns[m_nPattern].GetNumRows() - 1, GetChanFromCursor(m_dwCursor), LAST_COLUMN); // If column is already selected, select the current pattern if ((dwBeginSel == m_dwBeginSel) && (dwEndSel == m_dwEndSel)) { - dwBeginSel = 0; - dwEndSel &= 0xFFFF0000; - dwEndSel |= ((pSndFile->m_nChannels-1) << 3) + 4; + dwBeginSel = CreateCursor(0); + dwEndSel = CreateCursor(pSndFile->Patterns[m_nPattern].GetNumRows() - 1, pSndFile->GetNumChannels() - 1, LAST_COLUMN); } SetCurSel(dwBeginSel, dwEndSel); } @@ -1690,7 +1685,7 @@ } } //rewbs.customKeys - DWORD finalPos = (GetSelectionStartRow() << 16) | (m_dwEndSel & 0xFFFF); + DWORD finalPos = CreateCursor(GetSelectionStartRow()) | (m_dwEndSel & 0xFFFF); SetCurSel(finalPos, finalPos); // Fix: Horizontal scrollbar pos screwed when selecting with mouse SetCursorPosition( GetRowFromCursor(finalPos), finalPos & 0xFFFF ); @@ -2259,10 +2254,10 @@ if (((pMainFrm->GetFollowSong(pModDoc) != m_hWnd) || (pSndFile->IsPaused()) || (!(m_dwStatus & PATSTATUS_FOLLOWSONG)))) { - DWORD sel = (nChn << 3) | (m_nRow << 16); + DWORD sel = CreateCursor(m_nRow, nChn, 0); InvalidateArea(sel, sel + LAST_COLUMN); SetCurrentRow(m_nRow + m_nSpacing); - sel = m_dwCursor | (m_nRow << 16); + sel = CreateCursor(m_nRow) | m_dwCursor; SetCurSel(sel, sel); } } @@ -3695,7 +3690,7 @@ case kcNavigateLeftSelect: case kcNavigateLeft: if ((CMainFrame::m_dwPatternSetup & PATTERN_WRAP) && (!m_dwCursor)) - SetCurrentColumn((((pSndFile->m_nChannels-1) << 3) | 4)); + SetCurrentColumn((((pSndFile->GetNumChannels() - 1) << 3) | 4)); else SetCurrentColumn(m_dwCursor - 1); return wParam; @@ -3712,7 +3707,7 @@ SetCurrentColumn((((GetChanFromCursor(m_dwCursor) - 1) % pSndFile->m_nChannels) << 3) | GetColTypeFromCursor(m_dwCursor)); else SetCurrentColumn(GetColTypeFromCursor(m_dwCursor) | ((pSndFile->m_nChannels-1) << 3)); - UINT n = (m_nRow << 16) | (m_dwCursor); + UINT n = CreateCursor(m_nRow) | m_dwCursor; SetCurSel(n, n); return wParam;} case kcHomeHorizontalSelect: @@ -3727,15 +3722,15 @@ case kcHomeAbsolute: if (m_dwCursor) SetCurrentColumn(0); if (m_nRow > 0) SetCurrentRow(0); return wParam; case kcEndHorizontalSelect: - case kcEndHorizontal: if (m_dwCursor!=(((pSndFile->m_nChannels-1) << 3) | 4)) SetCurrentColumn(((pSndFile->m_nChannels-1) << 3) | 4); + case kcEndHorizontal: if (m_dwCursor!=(((pSndFile->GetNumChannels() - 1) << 3) | 4)) SetCurrentColumn(((pSndFile->m_nChannels-1) << 3) | 4); else if (m_nRow < pModDoc->GetPatternSize(m_nPattern) - 1) SetCurrentRow(pModDoc->GetPatternSize(m_nPattern) - 1); return wParam; case kcEndVerticalSelect: case kcEndVertical: if (m_nRow < pModDoc->GetPatternSize(m_nPattern) - 1) SetCurrentRow(pModDoc->GetPatternSize(m_nPattern) - 1); - else if (m_dwCursor!=(((pSndFile->m_nChannels-1) << 3) | 4)) SetCurrentColumn(((pSndFile->m_nChannels-1) << 3) | 4); + else if (m_dwCursor!=(((pSndFile->GetNumChannels() - 1) << 3) | 4)) SetCurrentColumn(((pSndFile->m_nChannels-1) << 3) | 4); return wParam; case kcEndAbsoluteSelect: - case kcEndAbsolute: SetCurrentColumn(((pSndFile->m_nChannels-1) << 3) | 4); if (m_nRow < pModDoc->GetPatternSize(m_nPattern) - 1) SetCurrentRow(pModDoc->GetPatternSize(m_nPattern) - 1); return wParam; + case kcEndAbsolute: SetCurrentColumn(((pSndFile->GetNumChannels() - 1) << 3) | 4); if (m_nRow < pModDoc->GetPatternSize(m_nPattern) - 1) SetCurrentRow(pModDoc->GetPatternSize(m_nPattern) - 1); return wParam; case kcNextPattern: { UINT n = m_nPattern + 1; while ((n < pSndFile->Patterns.Size()) && (!pSndFile->Patterns[n])) n++; @@ -3753,14 +3748,14 @@ return wParam; } case kcSelectWithCopySelect: case kcSelectWithNav: - case kcSelect: if (!(m_dwStatus & (PATSTATUS_DRAGNDROPEDIT|PATSTATUS_SELECTROW))) m_dwStartSel = (m_nRow << 16) | m_dwCursor; + case kcSelect: if (!(m_dwStatus & (PATSTATUS_DRAGNDROPEDIT|PATSTATUS_SELECTROW))) m_dwStartSel = CreateCursor(m_nRow) | m_dwCursor; m_dwStatus |= PATSTATUS_KEYDRAGSEL; return wParam; case kcSelectOffWithCopySelect: case kcSelectOffWithNav: case kcSelectOff: m_dwStatus &= ~PATSTATUS_KEYDRAGSEL; return wParam; case kcCopySelectWithSelect: case kcCopySelectWithNav: - case kcCopySelect: if (!(m_dwStatus & (PATSTATUS_DRAGNDROPEDIT|PATSTATUS_SELECTROW))) m_dwStartSel = (m_nRow << 16) | m_dwCursor; + case kcCopySelect: if (!(m_dwStatus & (PATSTATUS_DRAGNDROPEDIT|PATSTATUS_SELECTROW))) m_dwStartSel = CreateCursor(m_nRow) | m_dwCursor; m_dwStatus |= PATSTATUS_CTRLDRAGSEL; return wParam; case kcCopySelectOffWithSelect: case kcCopySelectOffWithNav: @@ -3777,15 +3772,15 @@ case kcClearFieldStep: OnClearField(GetColTypeFromCursor(m_dwCursor), true); return wParam; case kcClearFieldStepITStyle: OnClearField(GetColTypeFromCursor(m_dwCursor), true, true); return wParam; case kcDeleteRows: OnDeleteRows(); return wParam; - case kcDeleteAllRows: DeleteRows(0, pSndFile->m_nChannels-1,1); return wParam; + case kcDeleteAllRows: DeleteRows(0, pSndFile->GetNumChannels() - 1, 1); return wParam; case kcInsertRow: OnInsertRows(); return wParam; - case kcInsertAllRows: InsertRows(0, pSndFile->m_nChannels-1); return wParam; + case kcInsertAllRows: InsertRows(0, pSndFile->GetNumChannels() - 1); return wParam; case kcShowNoteProperties: ShowEditWindow(); return wParam; case kcShowPatternProperties: OnPatternProperties(); return wParam; case kcShowMacroConfig: SendCtrlMessage(CTRLMSG_SETUPMACROS); return wParam; case kcShowSplitKeyboardSettings: SetSplitKeyboardSettings(); return wParam; - case kcShowEditMenu: {CPoint pt = GetPointFromPosition((m_nRow << 16) | m_dwCursor); + case kcShowEditMenu: {CPoint pt = GetPointFromPosition(CreateCursor(m_nRow) | m_dwCursor); OnRButtonDown(0, pt); } return wParam; case kcPatternGoto: OnEditGoto(); return wParam; @@ -3807,7 +3802,7 @@ case kcCopyAndLoseSelection: { OnEditCopy(); - int sel = m_dwCursor | (m_nRow << 16); + int sel = CreateCursor(m_nRow) | m_dwCursor; SetCurSel(sel, sel); return wParam; } @@ -3971,7 +3966,7 @@ if (IsEditingEnabled_bmsg()) { - DWORD sel = (m_nRow << 16) | m_dwCursor; + DWORD sel = CreateCursor(m_nRow) | m_dwCursor; SetCurSel(sel, sel); sel &= ~7; if(oldcmd != *p) @@ -4046,7 +4041,7 @@ } } - DWORD sel = (m_nRow << 16) | m_dwCursor; + DWORD sel = CreateCursor(m_nRow) | m_dwCursor; SetCurSel(sel, sel); sel &= ~7; if(oldcmd != *p) @@ -4093,7 +4088,7 @@ } } - DWORD sel = (m_nRow << 16) | m_dwCursor; + DWORD sel = CreateCursor(m_nRow) | m_dwCursor; SetCurSel(sel, sel); sel &= ~7; if(*p != oldcmd) @@ -4232,7 +4227,7 @@ // Update only if not recording live. if(bIsLiveRecord == false) { - DWORD sel = (nRow << 16) | (nChn << 3); + DWORD sel = CreateCursor(nRow, nChn, 0); InvalidateArea(sel, sel + LAST_COLUMN); UpdateIndicator(); } @@ -4307,7 +4302,7 @@ if (IsEditingEnabled_bmsg()) { - DWORD sel = (m_nRow << 16) | m_dwCursor; + DWORD sel = CreateCursor(m_nRow) | m_dwCursor; SetCurSel(sel, sel); sel &= ~7; if(*p != oldcmd) @@ -4369,7 +4364,7 @@ { pModDoc->GetPatternUndo()->PrepareUndo(m_nPattern, nChn, nRow, 1, 1); pSndFile->Patterns[m_nPattern].GetpModCommand(nRow, nChn)->note = note; - const DWORD sel = (nRow << 16) | m_dwCursor; + const DWORD sel = CreateCursor(nRow) | m_dwCursor; pModDoc->SetModified(); InvalidateArea(sel, sel + LAST_COLUMN); UpdateIndicator(); @@ -4508,7 +4503,7 @@ // -- if recording, handle post note entry behaviour (move cursor etc..) if(bRecordEnabled) { - DWORD sel = (nRow << 16) | m_dwCursor; + DWORD sel = CreateCursor(nRow) | m_dwCursor; if(bIsLiveRecord == false) { // Update only when not recording live. SetCurSel(sel, sel); @@ -4540,7 +4535,7 @@ } // we must remember to not step back should the next note form a chord. } - DWORD sel = m_dwCursor | (m_nRow << 16); + DWORD sel = CreateCursor(m_nRow) | m_dwCursor; SetCurSel(sel, sel); } @@ -4679,9 +4674,9 @@ // -- write notedata if(bRecordEnabled) { - DWORD sel = (m_nRow << 16) | m_dwCursor; + DWORD sel = CreateCursor(m_nRow) | m_dwCursor; SetCurSel(sel, sel); - sel &= ~7; + sel = GetRowFromCursor(sel) | GetChanFromCursor(sel); if(modified) { for(CHANNELINDEX n = 0; n < pSndFile->GetNumChannels(); n++) @@ -4750,7 +4745,7 @@ { if ((m_nSpacing > 0) && (m_nSpacing <= MAX_SPACING)) SetCurrentRow(m_nRow + m_nSpacing); - DWORD sel = m_dwCursor | (m_nRow << 16); + DWORD sel = CreateCursor(m_nRow) | m_dwCursor; SetCurSel(sel, sel); } @@ -4793,9 +4788,9 @@ if(IsEditingEnabled_bmsg()) { - DWORD sel = (m_nRow << 16) | m_dwCursor; + DWORD sel = CreateCursor(m_nRow) | m_dwCursor; SetCurSel(sel, sel); - sel &= ~7; + sel = GetRowFromCursor(sel) | GetChanFromCursor(sel); if(*p != oldcmd) { pModDoc->SetModified(); @@ -4807,7 +4802,7 @@ { if ((m_nSpacing > 0) && (m_nSpacing <= MAX_SPACING)) SetCurrentRow(m_nRow+m_nSpacing); - DWORD sel = m_dwCursor | (m_nRow << 16); + DWORD sel = CreateCursor(m_nRow) | m_dwCursor; SetCurSel(sel, sel); } } else @@ -5733,31 +5728,33 @@ // Snap to end of beat / measure of lower-right corner of current selection const ROWINDEX endRow = GetSelectionEndRow() + adjust - (GetSelectionEndRow() % adjust) - 1; - DWORD startMask = (GetSelectionStartChan() << 3), endMask = (GetSelectionEndChan() << 3); + CHANNELINDEX startChannel = GetSelectionStartChan(), endChannel = GetSelectionEndChan(); + UINT startColumn = 0, endColumn = 0; if(m_dwBeginSel == m_dwEndSel) { // No selection has been made yet => expand selection to whole channel. - endMask |= LAST_COLUMN; // Extend to param column; + endColumn = LAST_COLUMN; // Extend to param column } else if(startRow == GetSelectionStartRow() && endRow == GetSelectionEndRow()) { // Whole beat or measure is already selected if(GetColTypeFromCursor(m_dwBeginSel) == NOTE_COLUMN && GetColTypeFromCursor(m_dwEndSel) == LAST_COLUMN) { // Whole channel is already selected => expand selection to whole row. - startMask = 0; - endMask = 0xFFFF; + startChannel = startColumn = 0; + endChannel = MAX_BASECHANNELS; + endColumn = LAST_COLUMN; } else { // Channel is only partly selected => expand to whole channel first. - endMask |= LAST_COLUMN; // Extend to param column; + endColumn = LAST_COLUMN; // Extend to param column } } else { // Some arbitrary selection: Remember start / end column - startMask |= GetColTypeFromCursor(m_dwBeginSel); - endMask |= GetColTypeFromCursor(m_dwEndSel); + startColumn = GetColTypeFromCursor(m_dwBeginSel); + endColumn = GetColTypeFromCursor(m_dwEndSel); } - SetCurSel((startRow << 16) | startMask, (endRow << 16) | endMask); + SetCurSel(CreateCursor(startRow, startChannel, startColumn), CreateCursor(endRow, endChannel, endColumn)); } Modified: trunk/OpenMPT/mptrack/View_pat.h =================================================================== --- trunk/OpenMPT/mptrack/View_pat.h 2011-05-08 19:43:27 UTC (rev 866) +++ trunk/OpenMPT/mptrack/View_pat.h 2011-05-08 20:24:49 UTC (rev 867) @@ -375,6 +375,7 @@ static ROWINDEX GetRowFromCursor(DWORD cursor) { return (cursor >> 16); }; static CHANNELINDEX GetChanFromCursor(DWORD cursor) { return static_cast<CHANNELINDEX>((cursor & 0xFFFF) >> 3); }; static UINT GetColTypeFromCursor(DWORD cursor) { return (cursor & 0x07); }; + static DWORD CreateCursor(ROWINDEX row, CHANNELINDEX channel = 0, UINT column = 0) { return (row << 16) | ((channel << 3) & 0x1FFF) | (column & 0x07); }; bool IsInterpolationPossible(ROWINDEX startRow, ROWINDEX endRow, CHANNELINDEX chan, PatternColumns colType, CSoundFile* pSndFile); void Interpolate(PatternColumns type); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <sag...@us...> - 2011-05-16 14:23:15
|
Revision: 875 http://modplug.svn.sourceforge.net/modplug/?rev=875&view=rev Author: saga-games Date: 2011-05-16 14:23:08 +0000 (Mon, 16 May 2011) Log Message: ----------- [Ref] Moved CRawSampleDlg to SampleEditorDialogs.cpp Modified Paths: -------------- trunk/OpenMPT/mptrack/Ctrl_smp.cpp trunk/OpenMPT/mptrack/Mpdlgs.cpp trunk/OpenMPT/mptrack/Mpdlgs.h trunk/OpenMPT/mptrack/SampleEditorDialogs.cpp trunk/OpenMPT/mptrack/SampleEditorDialogs.h Modified: trunk/OpenMPT/mptrack/Ctrl_smp.cpp =================================================================== --- trunk/OpenMPT/mptrack/Ctrl_smp.cpp 2011-05-15 20:29:13 UTC (rev 874) +++ trunk/OpenMPT/mptrack/Ctrl_smp.cpp 2011-05-16 14:23:08 UTC (rev 875) @@ -9,7 +9,6 @@ #include "SampleEditorDialogs.h" #include "dlg_misc.h" #include "PSRatioCalc.h" //rewbs.timeStretchMods -#include "mpdlgs.h" #include "soundtouch/SoundTouch.h" #include "soundtouch/TDStretch.h" #include "soundtouch/SoundTouchDLL.h" Modified: trunk/OpenMPT/mptrack/Mpdlgs.cpp =================================================================== --- trunk/OpenMPT/mptrack/Mpdlgs.cpp 2011-05-15 20:29:13 UTC (rev 874) +++ trunk/OpenMPT/mptrack/Mpdlgs.cpp 2011-05-16 14:23:08 UTC (rev 875) @@ -1104,45 +1104,6 @@ } -////////////////////////////////////////////////////////////// -// CRawSampleDlg - -UINT CRawSampleDlg::m_nFormat = ER_8BIT | ER_UNSIGNED | ER_MONO; - -BOOL CRawSampleDlg::OnInitDialog() -//-------------------------------- -{ - CDialog::OnInitDialog(); - UpdateDialog(); - return TRUE; -} - - -void CRawSampleDlg::OnOK() -//------------------------ -{ - m_nFormat = 0; - if(IsDlgButtonChecked(IDC_RADIO1)) m_nFormat |= ER_8BIT; - if(IsDlgButtonChecked(IDC_RADIO2)) m_nFormat |= ER_16BIT; - if(IsDlgButtonChecked(IDC_RADIO3)) m_nFormat |= ER_UNSIGNED; - if(IsDlgButtonChecked(IDC_RADIO4)) m_nFormat |= ER_SIGNED; - if(IsDlgButtonChecked(IDC_RADIO5)) m_nFormat |= ER_MONO; - if(IsDlgButtonChecked(IDC_RADIO6)) m_nFormat |= ER_STEREO; - m_bRememberFormat = IsDlgButtonChecked(IDC_CHK_REMEMBERSETTINGS) ? true : false; - CDialog::OnOK(); -} - - -void CRawSampleDlg::UpdateDialog() -//-------------------------------- -{ - CheckRadioButton(IDC_RADIO1, IDC_RADIO2, (m_nFormat & ER_8BIT) ? IDC_RADIO1 : IDC_RADIO2 ); - CheckRadioButton(IDC_RADIO3, IDC_RADIO4, (m_nFormat & ER_UNSIGNED) ? IDC_RADIO3 : IDC_RADIO4); - CheckRadioButton(IDC_RADIO5, IDC_RADIO6, (m_nFormat & ER_MONO) ? IDC_RADIO5 : IDC_RADIO6); - CheckDlgButton(IDC_CHK_REMEMBERSETTINGS, (m_bRememberFormat) ? MF_CHECKED : MF_UNCHECKED); -} - - ///////////////////////////////////////////////////////////// // CMidiSetupDlg Modified: trunk/OpenMPT/mptrack/Mpdlgs.h =================================================================== --- trunk/OpenMPT/mptrack/Mpdlgs.h 2011-05-15 20:29:13 UTC (rev 874) +++ trunk/OpenMPT/mptrack/Mpdlgs.h 2011-05-16 14:23:08 UTC (rev 875) @@ -130,42 +130,6 @@ }; -#define ER_8BIT 0x01 -#define ER_16BIT 0x02 - -#define ER_SIGNED 0x10 -#define ER_UNSIGNED 0x20 - -#define ER_MONO 0x0100 -#define ER_STEREO 0x0200 - -//================================= -class CRawSampleDlg: public CDialog -//================================= -{ -protected: - static UINT m_nFormat; - bool m_bRememberFormat; - -public: - static const UINT GetSampleFormat() { return m_nFormat; } - static void SetSampleFormat(UINT nFormat) { m_nFormat = nFormat; } - const bool GetRemeberFormat() { return m_bRememberFormat; }; - void SetRememberFormat(bool bRemember) { m_bRememberFormat = bRemember; }; - -public: - CRawSampleDlg(CWnd *parent = NULL):CDialog(IDD_LOADRAWSAMPLE, parent) - { - m_bRememberFormat = false; - } - -protected: - virtual BOOL OnInitDialog(); - virtual void OnOK(); - void UpdateDialog(); -}; - - //======================================= class CMidiSetupDlg: public CPropertyPage //======================================= Modified: trunk/OpenMPT/mptrack/SampleEditorDialogs.cpp =================================================================== --- trunk/OpenMPT/mptrack/SampleEditorDialogs.cpp 2011-05-15 20:29:13 UTC (rev 874) +++ trunk/OpenMPT/mptrack/SampleEditorDialogs.cpp 2011-05-16 14:23:08 UTC (rev 875) @@ -56,6 +56,45 @@ } +////////////////////////////////////////////////////////////// +// Sample import dialog + +UINT CRawSampleDlg::m_nFormat = ER_8BIT | ER_UNSIGNED | ER_MONO; + +BOOL CRawSampleDlg::OnInitDialog() +//-------------------------------- +{ + CDialog::OnInitDialog(); + UpdateDialog(); + return TRUE; +} + + +void CRawSampleDlg::OnOK() +//------------------------ +{ + m_nFormat = 0; + if(IsDlgButtonChecked(IDC_RADIO1)) m_nFormat |= ER_8BIT; + if(IsDlgButtonChecked(IDC_RADIO2)) m_nFormat |= ER_16BIT; + if(IsDlgButtonChecked(IDC_RADIO3)) m_nFormat |= ER_UNSIGNED; + if(IsDlgButtonChecked(IDC_RADIO4)) m_nFormat |= ER_SIGNED; + if(IsDlgButtonChecked(IDC_RADIO5)) m_nFormat |= ER_MONO; + if(IsDlgButtonChecked(IDC_RADIO6)) m_nFormat |= ER_STEREO; + m_bRememberFormat = IsDlgButtonChecked(IDC_CHK_REMEMBERSETTINGS) ? true : false; + CDialog::OnOK(); +} + + +void CRawSampleDlg::UpdateDialog() +//-------------------------------- +{ + CheckRadioButton(IDC_RADIO1, IDC_RADIO2, (m_nFormat & ER_8BIT) ? IDC_RADIO1 : IDC_RADIO2 ); + CheckRadioButton(IDC_RADIO3, IDC_RADIO4, (m_nFormat & ER_UNSIGNED) ? IDC_RADIO3 : IDC_RADIO4); + CheckRadioButton(IDC_RADIO5, IDC_RADIO6, (m_nFormat & ER_MONO) ? IDC_RADIO5 : IDC_RADIO6); + CheckDlgButton(IDC_CHK_REMEMBERSETTINGS, (m_bRememberFormat) ? MF_CHECKED : MF_UNCHECKED); +} + + ///////////////////////////////////////////////////////////////////////// // Add silence dialog - add silence to a sample Modified: trunk/OpenMPT/mptrack/SampleEditorDialogs.h =================================================================== --- trunk/OpenMPT/mptrack/SampleEditorDialogs.h 2011-05-15 20:29:13 UTC (rev 874) +++ trunk/OpenMPT/mptrack/SampleEditorDialogs.h 2011-05-16 14:23:08 UTC (rev 875) @@ -29,6 +29,45 @@ }; +////////////////////////////////////////////////////////////////////////// +// Sample import dialog + +#define ER_8BIT 0x01 +#define ER_16BIT 0x02 + +#define ER_SIGNED 0x10 +#define ER_UNSIGNED 0x20 + +#define ER_MONO 0x0100 +#define ER_STEREO 0x0200 + +//================================= +class CRawSampleDlg: public CDialog +//================================= +{ +protected: + static UINT m_nFormat; + bool m_bRememberFormat; + +public: + static const UINT GetSampleFormat() { return m_nFormat; } + static void SetSampleFormat(UINT nFormat) { m_nFormat = nFormat; } + const bool GetRemeberFormat() { return m_bRememberFormat; }; + void SetRememberFormat(bool bRemember) { m_bRememberFormat = bRemember; }; + +public: + CRawSampleDlg(CWnd *parent = NULL):CDialog(IDD_LOADRAWSAMPLE, parent) + { + m_bRememberFormat = false; + } + +protected: + virtual BOOL OnInitDialog(); + virtual void OnOK(); + void UpdateDialog(); +}; + + ///////////////////////////////////////////////////////////////////////// // Add silence dialog - add silence to a sample This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <sag...@us...> - 2011-05-20 14:17:08
|
Revision: 877 http://modplug.svn.sourceforge.net/modplug/?rev=877&view=rev Author: saga-games Date: 2011-05-20 14:17:01 +0000 (Fri, 20 May 2011) Log Message: ----------- [Imp] IT / FT2 envelope limitations are now adhered in the envelope editor in compatible mode. Modified Paths: -------------- trunk/OpenMPT/mptrack/View_ins.cpp trunk/OpenMPT/mptrack/View_ins.h Modified: trunk/OpenMPT/mptrack/View_ins.cpp =================================================================== --- trunk/OpenMPT/mptrack/View_ins.cpp 2011-05-17 18:33:34 UTC (rev 876) +++ trunk/OpenMPT/mptrack/View_ins.cpp 2011-05-20 14:17:01 UTC (rev 877) @@ -274,8 +274,14 @@ { if (nTick >= 0) { - int mintick = (nPoint) ? envelope->Ticks[nPoint-1] : 0; - int maxtick = envelope->Ticks[nPoint+1]; + int mintick = (nPoint) ? envelope->Ticks[nPoint - 1] : 0; + int maxtick = envelope->Ticks[nPoint + 1]; + // Can't have multiple points on same tick + if(GetDocument()->GetSoundFile()->IsCompatibleMode(TRK_IMPULSETRACKER|TRK_FASTTRACKER2)) + { + mintick++; + maxtick--; + } if (nPoint + 1 == (int)envelope->nNodes) maxtick = ENVELOPE_MAX_LENGTH; if (nTick < mintick) nTick = mintick; if (nTick > maxtick) nTick = maxtick; @@ -2310,7 +2316,7 @@ { INSTRUMENTENVELOPE *pEnv = GetEnvelopePtr(); if(pEnv == nullptr || !IsDragItemEnvPoint()) return; - if(m_nDragItem == 1 || pEnv->Ticks[m_nDragItem - 1] == pEnv->Ticks[m_nDragItem - 2]) + if(m_nDragItem == 1 || !CanMovePoint(m_nDragItem - 1, -1)) return; pEnv->Ticks[m_nDragItem - 1]--; @@ -2324,7 +2330,7 @@ { INSTRUMENTENVELOPE *pEnv = GetEnvelopePtr(); if(pEnv == nullptr || !IsDragItemEnvPoint()) return; - if(m_nDragItem == 1 || (m_nDragItem < pEnv->nNodes && pEnv->Ticks[m_nDragItem - 1] == pEnv->Ticks[m_nDragItem])) + if(m_nDragItem == 1 || !CanMovePoint(m_nDragItem - 1, 1)) return; pEnv->Ticks[m_nDragItem - 1]++; @@ -2500,6 +2506,36 @@ } +bool CViewInstrument::CanMovePoint(UINT envPoint, int step) +//--------------------------------------------------------- +{ + INSTRUMENTENVELOPE *pEnv = GetEnvelopePtr(); + if(pEnv == nullptr) return false; + + // Can't move first point + if(envPoint == 0) + { + return false; + } + // Can't move left of previous point + if((step < 0) && (pEnv->Ticks[envPoint] - pEnv->Ticks[envPoint - 1] >= -step + GetDocument()->GetSoundFile()->IsCompatibleMode(TRK_IMPULSETRACKER|TRK_FASTTRACKER2) ? 0 : 1)) + { + return false; + } + // Can't move right of next point + if((step > 0) && (envPoint < pEnv->nNodes - 1) && (pEnv->Ticks[envPoint + 1] - pEnv->Ticks[envPoint] >= step + GetDocument()->GetSoundFile()->IsCompatibleMode(TRK_IMPULSETRACKER|TRK_FASTTRACKER2) ? 0 : 1)) + { + return false; + } + // Limit envelope length + if((envPoint == pEnv->nNodes - 1) && pEnv->Ticks[envPoint] + step > ENVELOPE_MAX_LENGTH) + { + return false; + } + return true; +} + + BOOL CViewInstrument::OnMouseWheel(UINT nFlags, short zDelta, CPoint pt) //---------------------------------------------------------------------- { Modified: trunk/OpenMPT/mptrack/View_ins.h =================================================================== --- trunk/OpenMPT/mptrack/View_ins.h 2011-05-17 18:33:34 UTC (rev 876) +++ trunk/OpenMPT/mptrack/View_ins.h 2011-05-20 14:17:01 UTC (rev 877) @@ -81,6 +81,7 @@ // Misc. bool EnvSetValue(int nPoint, int nTick=-1, int nValue=-1); + bool CanMovePoint(UINT envPoint, int step); // Set loop points bool EnvSetLoopStart(int nPoint); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <sag...@us...> - 2011-05-26 18:25:47
|
Revision: 881 http://modplug.svn.sourceforge.net/modplug/?rev=881&view=rev Author: saga-games Date: 2011-05-26 18:25:41 +0000 (Thu, 26 May 2011) Log Message: ----------- [Imp] Hack Detection: Envelopes with points that share the same tick are now found. [Ref] Minor refactoring Modified Paths: -------------- trunk/OpenMPT/mptrack/Draw_pat.cpp trunk/OpenMPT/mptrack/MPTHacks.cpp Modified: trunk/OpenMPT/mptrack/Draw_pat.cpp =================================================================== --- trunk/OpenMPT/mptrack/Draw_pat.cpp 2011-05-23 21:32:39 UTC (rev 880) +++ trunk/OpenMPT/mptrack/Draw_pat.cpp 2011-05-26 18:25:41 UTC (rev 881) @@ -698,7 +698,7 @@ BOOL bPlaying, UINT yofs, UINT nrows, UINT xofs, CRect &rcClient, int *pypaint) //----------------------------------------------------------------------------------------------------- { - BYTE bColSel[MAX_CHANNELS]; + BYTE bColSel[MAX_BASECHANNELS]; PCPATTERNFONT pfnt = GetCurrentPatternFont(); MODCOMMAND m0, *pPattern = pSndFile->Patterns[nPattern]; CHAR s[256]; @@ -707,7 +707,7 @@ int row_col, row_bkcol; UINT bRowSel, bSpeedUp, nColumnWidth, ncols, maxcol; - ncols = pSndFile->m_nChannels; + ncols = pSndFile->GetNumChannels(); m0.note = m0.instr = m0.vol = m0.volcmd = m0.command = m0.param = 0; nColumnWidth = m_szCell.cx; rect.SetRect(m_szHeader.cx, rcClient.top, m_szHeader.cx+nColumnWidth, rcClient.bottom); @@ -731,7 +731,7 @@ while ((maxcol > xofs) && (bColSel[maxcol-1] & 0x80)) maxcol--; // Init bitmap border { - UINT maxndx = pSndFile->m_nChannels * m_szCell.cx; + UINT maxndx = pSndFile->GetNumChannels() * m_szCell.cx; UINT ibmp = 0; if (maxndx > FASTBMP_MAXWIDTH) maxndx = FASTBMP_MAXWIDTH; do Modified: trunk/OpenMPT/mptrack/MPTHacks.cpp =================================================================== --- trunk/OpenMPT/mptrack/MPTHacks.cpp 2011-05-23 21:32:39 UTC (rev 880) +++ trunk/OpenMPT/mptrack/MPTHacks.cpp 2011-05-26 18:25:41 UTC (rev 881) @@ -84,6 +84,27 @@ bool *foundHacks; }; + +// Find and fix envelopes where two nodes are on the same tick. +bool FindIncompatibleEnvelopes(INSTRUMENTENVELOPE &env, bool autofix) +//------------------------------------------------------------------- +{ + bool found = false; + for(UINT i = 1; i < env.nNodes; i++) + { + if(env.Ticks[i] <= env.Ticks[i - 1]) // "<=" so we can fix envelopes "on the fly" + { + found = true; + if(autofix) + { + env.Ticks[i] = env.Ticks[i - 1] + 1; + } + } + } + return found; +} + + // Go through the module to find out if it contains any hacks introduced by (Open)MPT bool CModDoc::HasMPTHacks(const bool autofix) //------------------------------------------- @@ -139,12 +160,29 @@ { if(m_SndFile.Patterns.IsValidPat(i)) { - if(m_SndFile.Patterns[i].GetNumRows() > originalSpecs->patternRowsMax || m_SndFile.Patterns[i].GetNumRows() < originalSpecs->patternRowsMin) + const ROWINDEX patSize = m_SndFile.Patterns[i].GetNumRows(); + if(patSize > originalSpecs->patternRowsMax) { foundHacks = foundHere = true; - break; + if(autofix) + { + // REQUIRES (INTELLIGENT) AUTOFIX + } else + { + break; + } + } else if(patSize < originalSpecs->patternRowsMin) + { + foundHacks = foundHere = true; + if(autofix) + { + m_SndFile.Patterns[i].Resize(originalSpecs->patternRowsMin); + m_SndFile.TryWriteEffect(i, patSize - 1, CMD_PATTERNBREAK, 0, false, CHANNELINDEX_INVALID, false, weTryNextRow); + } else + { + break; + } } - // REQUIRES (INTELLIGENT) AUTOFIX } } if(foundHere) @@ -182,7 +220,13 @@ message.Format("Found incompatible channel count (must be between %d and %d channels)\n", originalSpecs->channelsMin, originalSpecs->channelsMax); AddToLog(message); foundHacks = true; - // REQUIRES (INTELLIGENT) AUTOFIX + if(autofix) + { + vector<bool> usedChannels; + CheckUsedChannels(usedChannels); + RemoveChannels(usedChannels); + // REQUIRES (INTELLIGENT) AUTOFIX + } } // Check for channel names @@ -221,11 +265,13 @@ // Check for instrument extensions foundHere = false; + bool foundEnvelopes = false; for(INSTRUMENTINDEX i = 1; i <= m_SndFile.GetNumInstruments(); i++) { MODINSTRUMENT *instr = m_SndFile.Instruments[i]; if(instr == nullptr) continue; + // Extended instrument attributes if(instr->nFilterMode != FLTMODE_UNCHANGED || instr->nVolRamp != 0 || instr->nResampling != SRCMODE_DEFAULT || instr->nCutSwing != 0 || instr->nResSwing != 0 || instr->nMixPlug != 0 || instr->wPitchToTempoLock != 0 || instr->nDCT == DCT_PLUGIN || @@ -248,10 +294,16 @@ instr->VolEnv.nReleaseNode = instr->PanEnv.nReleaseNode = instr->PitchEnv.nReleaseNode = ENV_RELEASE_NODE_UNSET; } } - + // Incompatible envelope shape + foundEnvelopes |= FindIncompatibleEnvelopes(instr->VolEnv, autofix); + foundEnvelopes |= FindIncompatibleEnvelopes(instr->PanEnv, autofix); + foundEnvelopes |= FindIncompatibleEnvelopes(instr->PitchEnv, autofix); + foundHacks |= foundEnvelopes; } if(foundHere) AddToLog("Found MPT instrument extensions\n"); + if(foundEnvelopes) + AddToLog("Two envelope points may not share the same tick.\n"); // Check for too many orders if(m_SndFile.Order.GetLengthTailTrimmed() > originalSpecs->ordersMax) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <sag...@us...> - 2011-05-26 18:39:28
|
Revision: 883 http://modplug.svn.sourceforge.net/modplug/?rev=883&view=rev Author: saga-games Date: 2011-05-26 18:39:22 +0000 (Thu, 26 May 2011) Log Message: ----------- [Mod] (Debugging mode only) When LoadLibrary fails because a plugin DLL is not found, its error code is not displayed anymore (we already have our own error box for that) [Fix] VST: When a plugin requests song position in nano secods, the correct value should now be returned. [Mod] OpenMPT: Version is now 1.19.02.01 Modified Paths: -------------- trunk/OpenMPT/mptrack/Vstplug.cpp trunk/OpenMPT/mptrack/version.h Modified: trunk/OpenMPT/mptrack/Vstplug.cpp =================================================================== --- trunk/OpenMPT/mptrack/Vstplug.cpp 2011-05-26 18:35:33 UTC (rev 882) +++ trunk/OpenMPT/mptrack/Vstplug.cpp 2011-05-26 18:39:22 UTC (rev 883) @@ -283,11 +283,11 @@ hLib = LoadLibrary(pszDllPath); //rewbs.VSTcompliance #ifdef _DEBUG - if (!hLib) + DWORD dw = GetLastError(); + if (!hLib && dw != ERROR_MOD_NOT_FOUND) // "File not found errors" are annoying. { TCHAR szBuf[256]; LPVOID lpMsgBuf; - DWORD dw = GetLastError(); FormatMessage(FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM, NULL, dw, MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), (LPTSTR) &lpMsgBuf, 0, NULL ); wsprintf(szBuf, "Warning: encountered problem when loading plugin dll. Error %d: %s", dw, lpMsgBuf); MessageBox(NULL, szBuf, "DEBUG: Error when loading plugin dll", MB_OK); @@ -785,7 +785,7 @@ if ((value & kVstNanosValid)) { timeInfo.flags |= kVstNanosValid; - timeInfo.nanoSeconds = pVstPlugin->GetTimeAtStartOfProcess(); + timeInfo.nanoSeconds = timeGetTime() * 1000000; } if ((value & kVstPpqPosValid) && pSndFile) { Modified: trunk/OpenMPT/mptrack/version.h =================================================================== --- trunk/OpenMPT/mptrack/version.h 2011-05-26 18:35:33 UTC (rev 882) +++ trunk/OpenMPT/mptrack/version.h 2011-05-26 18:39:22 UTC (rev 883) @@ -15,7 +15,7 @@ #define VER_MAJORMAJOR 1 #define VER_MAJOR 19 #define VER_MINOR 02 -#define VER_MINORMINOR 00 +#define VER_MINORMINOR 01 //Creates version number from version parts that appears in version string. //For example MAKE_VERSION_NUMERIC(1,17,02,28) gives version number of This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <sag...@us...> - 2011-05-28 15:14:11
|
Revision: 886 http://modplug.svn.sourceforge.net/modplug/?rev=886&view=rev Author: saga-games Date: 2011-05-28 15:14:04 +0000 (Sat, 28 May 2011) Log Message: ----------- [Imp] Sample Editor: When selecting parts of the sample, the selection range is now also displayed in samples, not only seconds. [Mod] OpenMPT: Version is now 1.19.02.02 Modified Paths: -------------- trunk/OpenMPT/mptrack/View_smp.cpp trunk/OpenMPT/mptrack/version.h Modified: trunk/OpenMPT/mptrack/View_smp.cpp =================================================================== --- trunk/OpenMPT/mptrack/View_smp.cpp 2011-05-27 18:11:33 UTC (rev 885) +++ trunk/OpenMPT/mptrack/View_smp.cpp 2011-05-28 15:14:04 UTC (rev 886) @@ -302,18 +302,19 @@ s[0] = 0; if (m_dwEndSel > m_dwBeginSel) { - wsprintf(s, "[%d,%d]", m_dwBeginSel, m_dwEndSel); + const DWORD selLength = m_dwEndSel - m_dwBeginSel; + wsprintf(s, "[%d,%d] (%d sample%s, ", m_dwBeginSel, m_dwEndSel, selLength, (selLength == 1) ? "" : "s"); LONG lSampleRate = pSndFile->Samples[m_nSample].nC5Speed; if (pSndFile->m_nType & (MOD_TYPE_MOD|MOD_TYPE_XM)) { lSampleRate = CSoundFile::TransposeToFrequency(pSndFile->Samples[m_nSample].RelativeTone, pSndFile->Samples[m_nSample].nFineTune); } if (!lSampleRate) lSampleRate = 8363; - ULONG msec = ((ULONG)(m_dwEndSel - m_dwBeginSel) * 1000) / lSampleRate; + ULONG msec = ((ULONG)selLength * 1000) / lSampleRate; if (msec < 1000) - wsprintf(s+strlen(s), " (%lums)", msec); + wsprintf(s+strlen(s), "%lums)", msec); else - wsprintf(s+strlen(s), " (%lu.%lus)", msec/1000, (msec/100) % 10); + wsprintf(s+strlen(s), "%lu.%lus)", msec/1000, (msec/100) % 10); } pMainFrm->SetInfoText(s); } Modified: trunk/OpenMPT/mptrack/version.h =================================================================== --- trunk/OpenMPT/mptrack/version.h 2011-05-27 18:11:33 UTC (rev 885) +++ trunk/OpenMPT/mptrack/version.h 2011-05-28 15:14:04 UTC (rev 886) @@ -15,7 +15,7 @@ #define VER_MAJORMAJOR 1 #define VER_MAJOR 19 #define VER_MINOR 02 -#define VER_MINORMINOR 01 +#define VER_MINORMINOR 02 //Creates version number from version parts that appears in version string. //For example MAKE_VERSION_NUMERIC(1,17,02,28) gives version number of This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <sag...@us...> - 2011-06-03 20:32:02
|
Revision: 891 http://modplug.svn.sourceforge.net/modplug/?rev=891&view=rev Author: saga-games Date: 2011-06-03 20:31:55 +0000 (Fri, 03 Jun 2011) Log Message: ----------- [Fix] Pattern Editor: When changing the number of channels through the song properties, the channel headers in the pattern display were not updated properly (http://bugs.openmpt.org/view.php?id=140) [Mod] OpenMPT: Version is now 1.19.02.04 Modified Paths: -------------- trunk/OpenMPT/mptrack/Moddoc.cpp trunk/OpenMPT/mptrack/version.h Modified: trunk/OpenMPT/mptrack/Moddoc.cpp =================================================================== --- trunk/OpenMPT/mptrack/Moddoc.cpp 2011-06-01 22:23:05 UTC (rev 890) +++ trunk/OpenMPT/mptrack/Moddoc.cpp 2011-06-03 20:31:55 UTC (rev 891) @@ -3761,8 +3761,8 @@ if(ChangeNumChannels(nNewChannels, showCancelInRemoveDlg)) bShowLog = true; } - // Force update of pattern highlights - UpdateAllViews(NULL, HINT_PATTERNDATA); + // Force update of pattern highlights / num channels + UpdateAllViews(NULL, HINT_PATTERNDATA | HINT_MODCHANNELS); SetModified(); Modified: trunk/OpenMPT/mptrack/version.h =================================================================== --- trunk/OpenMPT/mptrack/version.h 2011-06-01 22:23:05 UTC (rev 890) +++ trunk/OpenMPT/mptrack/version.h 2011-06-03 20:31:55 UTC (rev 891) @@ -15,7 +15,7 @@ #define VER_MAJORMAJOR 1 #define VER_MAJOR 19 #define VER_MINOR 02 -#define VER_MINORMINOR 03 +#define VER_MINORMINOR 04 //Creates version number from version parts that appears in version string. //For example MAKE_VERSION_NUMERIC(1,17,02,28) gives version number of This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <sag...@us...> - 2011-06-12 16:12:11
|
Revision: 897 http://modplug.svn.sourceforge.net/modplug/?rev=897&view=rev Author: saga-games Date: 2011-06-12 16:12:04 +0000 (Sun, 12 Jun 2011) Log Message: ----------- [Fix] Pattern Editor: When overwriting PC notes with normal notes, the pattern cell is now cleared properly. [Ref] GetNumChannels rocks. Modified Paths: -------------- trunk/OpenMPT/mptrack/Undo.cpp trunk/OpenMPT/mptrack/View_pat.cpp Modified: trunk/OpenMPT/mptrack/Undo.cpp =================================================================== --- trunk/OpenMPT/mptrack/Undo.cpp 2011-06-10 23:51:22 UTC (rev 896) +++ trunk/OpenMPT/mptrack/Undo.cpp 2011-06-12 16:12:04 UTC (rev 897) @@ -53,9 +53,9 @@ if (!pSndFile->Patterns.IsValidPat(pattern)) return false; nRows = pSndFile->Patterns[pattern].GetNumRows(); pPattern = pSndFile->Patterns[pattern]; - if ((firstRow >= nRows) || (numChns < 1) || (numRows < 1) || (firstChn >= pSndFile->m_nChannels)) return false; + if ((firstRow >= nRows) || (numChns < 1) || (numRows < 1) || (firstChn >= pSndFile->GetNumChannels())) return false; if (firstRow + numRows >= nRows) numRows = nRows - firstRow; - if (firstChn + numChns >= pSndFile->m_nChannels) numChns = pSndFile->m_nChannels - firstChn; + if (firstChn + numChns >= pSndFile->GetNumChannels()) numChns = pSndFile->GetNumChannels() - firstChn; pUndoData = new MODCOMMAND[numChns * numRows]; if (!pUndoData) return false; @@ -76,12 +76,12 @@ sUndo.numRows = numRows; sUndo.pbuffer = pUndoData; sUndo.linkToPrevious = linkToPrevious; - pPattern += firstChn + firstRow * pSndFile->m_nChannels; + pPattern += firstChn + firstRow * pSndFile->GetNumChannels(); for(ROWINDEX iy = 0; iy < numRows; iy++) { memcpy(pUndoData, pPattern, numChns * sizeof(MODCOMMAND)); pUndoData += numChns; - pPattern += pSndFile->m_nChannels; + pPattern += pSndFile->GetNumChannels(); } UndoBuffer.push_back(sUndo); @@ -129,18 +129,18 @@ nPattern = pUndo->pattern; nRows = pUndo->patternsize; - if(pUndo->firstChannel + pUndo->numChannels <= pSndFile->m_nChannels) + if(pUndo->firstChannel + pUndo->numChannels <= pSndFile->GetNumChannels()) { if((!pSndFile->Patterns[nPattern]) || (pSndFile->Patterns[nPattern].GetNumRows() < nRows)) { - MODCOMMAND *newPattern = CPattern::AllocatePattern(nRows, pSndFile->m_nChannels); + MODCOMMAND *newPattern = CPattern::AllocatePattern(nRows, pSndFile->GetNumChannels()); MODCOMMAND *oldPattern = pSndFile->Patterns[nPattern]; if (!newPattern) return PATTERNINDEX_INVALID; const ROWINDEX nOldRowCount = pSndFile->Patterns[nPattern].GetNumRows(); pSndFile->Patterns[nPattern].SetData(newPattern, nRows); if(oldPattern) { - memcpy(newPattern, oldPattern, pSndFile->m_nChannels * nOldRowCount * sizeof(MODCOMMAND)); + memcpy(newPattern, oldPattern, pSndFile->GetNumChannels() * nOldRowCount * sizeof(MODCOMMAND)); CPattern::FreePattern(oldPattern); } } @@ -148,11 +148,11 @@ pUndoData = pUndo->pbuffer; pPattern = pSndFile->Patterns[nPattern]; if (!pSndFile->Patterns[nPattern]) return PATTERNINDEX_INVALID; - pPattern += pUndo->firstChannel + (pUndo->firstRow * pSndFile->m_nChannels); + pPattern += pUndo->firstChannel + (pUndo->firstRow * pSndFile->GetNumChannels()); for(ROWINDEX iy = 0; iy < pUndo->numRows; iy++) { memcpy(pPattern, pUndoData, pUndo->numChannels * sizeof(MODCOMMAND)); - pPattern += pSndFile->m_nChannels; + pPattern += pSndFile->GetNumChannels(); pUndoData += pUndo->numChannels; } } Modified: trunk/OpenMPT/mptrack/View_pat.cpp =================================================================== --- trunk/OpenMPT/mptrack/View_pat.cpp 2011-06-10 23:51:22 UTC (rev 896) +++ trunk/OpenMPT/mptrack/View_pat.cpp 2011-06-12 16:12:04 UTC (rev 897) @@ -986,10 +986,8 @@ // If invalidation on all columns is wanted, extent invalidation area. if(invalidateAllCols) - tmp += LAST_COLUMN - (tmp % 8); + tmp += LAST_COLUMN - GetColTypeFromCursor(tmp); - ASSERT(tmp % 8 <= LAST_COLUMN); - InvalidateArea(m_dwBeginSel, tmp); pModDoc->SetModified(); pModDoc->UpdateAllViews(this, HINT_PATTERNDATA | (m_nPattern << HINT_SHIFT_PAT), NULL); @@ -1191,11 +1189,12 @@ InvalidateRect(&m_rcDropItem, FALSE); const bool duplicate = (nFlags & MK_SHIFT) ? true : false; - vector<CHANNELINDEX> channels(pModDoc->GetNumChannels() + (duplicate ? 1 : 0), 0); + const CHANNELINDEX newChannels = pModDoc->GetNumChannels() + (duplicate ? 1 : 0); + vector<CHANNELINDEX> channels(newChannels, 0); CHANNELINDEX i = 0; bool modified = duplicate; - for(CHANNELINDEX nChn = 0; nChn < pModDoc->GetNumChannels() + (duplicate ? 1 : 0); nChn++) + for(CHANNELINDEX nChn = 0; nChn < newChannels; nChn++) { if(nChn == nTargetNo) { @@ -4397,8 +4396,16 @@ // If record is enabled, create undo point. if(bRecordEnabled) + { pModDoc->GetPatternUndo()->PrepareUndo(nPat, nChn, nRow, 1, 1); + } + // We're overwriting a PC note here. + if(pTarget->IsPcNote() && !MODCOMMAND::IsPcNote(note)) + { + newcmd.Clear(); + } + // -- write note and instrument data. const bool isSplit = HandleSplit(&newcmd, note); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <sag...@us...> - 2011-06-13 00:02:25
|
Revision: 898 http://modplug.svn.sourceforge.net/modplug/?rev=898&view=rev Author: saga-games Date: 2011-06-13 00:02:17 +0000 (Mon, 13 Jun 2011) Log Message: ----------- [Fix] Instrument tab: Suggested filename when saving instrument was sometimes cut [Fix] Pattern tab: Using the "Paste Pattern" menu entry in the order list didn't refresh the pattern display. Modified Paths: -------------- trunk/OpenMPT/mptrack/Ctrl_ins.cpp trunk/OpenMPT/mptrack/Ctrl_smp.cpp trunk/OpenMPT/mptrack/View_pat.cpp Modified: trunk/OpenMPT/mptrack/Ctrl_ins.cpp =================================================================== --- trunk/OpenMPT/mptrack/Ctrl_ins.cpp 2011-06-12 16:12:04 UTC (rev 897) +++ trunk/OpenMPT/mptrack/Ctrl_ins.cpp 2011-06-13 00:02:17 UTC (rev 898) @@ -1712,13 +1712,12 @@ if (!pIns) return; if (pIns->filename[0]) { - memcpy(szFileName, pIns->filename, 12); - szFileName[12] = 0; + strncpy(szFileName, pIns->filename, min(CountOf(pIns->filename), CountOf(szFileName) - 1)); } else { - memcpy(szFileName, pIns->name, 22); - szFileName[22] = 0; + strncpy(szFileName, pIns->name, min(CountOf(pIns->name), CountOf(szFileName) - 1)); } + SetNullTerminator(szFileName); SanitizeFilename(szFileName); FileDlgResult files = CTrackApp::ShowOpenSaveFileDialog(false, (m_pSndFile->GetType() == MOD_TYPE_XM) ? "xi" : "iti", szFileName, Modified: trunk/OpenMPT/mptrack/Ctrl_smp.cpp =================================================================== --- trunk/OpenMPT/mptrack/Ctrl_smp.cpp 2011-06-12 16:12:04 UTC (rev 897) +++ trunk/OpenMPT/mptrack/Ctrl_smp.cpp 2011-06-13 00:02:17 UTC (rev 898) @@ -998,12 +998,11 @@ } if (m_pSndFile->m_nType & (MOD_TYPE_S3M|MOD_TYPE_IT|MOD_TYPE_MPT)) { - memcpy(szFileName, m_pSndFile->Samples[m_nSample].filename, MAX_SAMPLEFILENAME); - szFileName[22] = 0; + strncpy(szFileName, m_pSndFile->Samples[m_nSample].filename, min(CountOf(m_pSndFile->Samples[m_nSample].filename), CountOf(szFileName) - 1)); } else { - memcpy(szFileName, m_pSndFile->m_szNames[m_nSample], MAX_SAMPLENAME); - szFileName[32] = 0; } + strncpy(szFileName, m_pSndFile->m_szNames[m_nSample], min(CountOf(m_pSndFile->m_szNames[m_nSample]), CountOf(szFileName) - 1)); + } if (!szFileName[0]) strcpy(szFileName, "untitled"); } else @@ -1020,6 +1019,7 @@ sPath += ".wav"; _splitpath(sPath, NULL, NULL, szFileName, NULL); } + SetNullTerminator(szFileName); SanitizeFilename(szFileName); FileDlgResult files = CTrackApp::ShowOpenSaveFileDialog(false, "wav", szFileName, Modified: trunk/OpenMPT/mptrack/View_pat.cpp =================================================================== --- trunk/OpenMPT/mptrack/View_pat.cpp 2011-06-12 16:12:04 UTC (rev 897) +++ trunk/OpenMPT/mptrack/View_pat.cpp 2011-06-13 00:02:17 UTC (rev 898) @@ -3564,6 +3564,7 @@ { CModDoc *pModDoc = GetDocument(); if (pModDoc) pModDoc->PastePattern(m_nPattern, 0, pm_overwrite); + InvalidatePattern(); } break; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <sag...@us...> - 2011-06-14 20:23:56
|
Revision: 901 http://modplug.svn.sourceforge.net/modplug/?rev=901&view=rev Author: saga-games Date: 2011-06-14 20:23:49 +0000 (Tue, 14 Jun 2011) Log Message: ----------- [Imp] General Tab: When editing panning, surround is disabled and when enabling surround, panning is reset. [Imp] Tagging: ID3 tags also contain a TDRC tag now, since this should be used instead of TYER in ID3v2.4 [Ref] Rewrote WAV tagging a bit. [Mod] OpenMPT: Version is now 1.19.02.06 Modified Paths: -------------- trunk/OpenMPT/mptrack/Moddoc.cpp trunk/OpenMPT/mptrack/View_gen.cpp trunk/OpenMPT/mptrack/tagging.cpp trunk/OpenMPT/mptrack/version.h Modified: trunk/OpenMPT/mptrack/Moddoc.cpp =================================================================== --- trunk/OpenMPT/mptrack/Moddoc.cpp 2011-06-14 19:33:46 UTC (rev 900) +++ trunk/OpenMPT/mptrack/Moddoc.cpp 2011-06-14 20:23:49 UTC (rev 901) @@ -848,7 +848,7 @@ //---------------------------------------------------------------------------------------------------------------------------------------------------- { CMainFrame *pMainFrm = CMainFrame::GetMainFrame(); - UINT nChn = m_SndFile.m_nChannels; + UINT nChn = GetNumChannels(); if ((!pMainFrm) || (!note)) return FALSE; if (nVol > 256) nVol = 256; @@ -866,7 +866,7 @@ // All notes off for (UINT i=0; i<MAX_CHANNELS; i++) { - if ((i < m_SndFile.m_nChannels) || (m_SndFile.Chn[i].nMasterChn)) + if ((i < GetNumChannels()) || (m_SndFile.Chn[i].nMasterChn)) { m_SndFile.Chn[i].dwFlags |= CHN_KEYOFF | CHN_NOTEFADE; m_SndFile.Chn[i].nFadeOutVol = 0; @@ -939,7 +939,7 @@ m_SndFile.NoteChange(nChn, note, false, true, true); if (nVol >= 0) pChn->nVolume = nVol; - // handle sample looping. + // Handle sample looping. // Changed line to fix http://forum.openmpt.org/index.php?topic=1700.0 //if ((loopstart + 16 < loopend) && (loopstart >= 0) && (loopend <= (LONG)pChn->nLength)) { if ((loopstart + 16 < loopend) && (loopstart >= 0) && (pChn->pModSample != nullptr)) @@ -951,7 +951,7 @@ pChn->nLength = min(UINT(loopend), pChn->pModSample->nLength); } - // handle extra-loud flag + // Handle extra-loud flag if ((!(CMainFrame::m_dwPatternSetup & PATTERN_NOEXTRALOUD)) && (nsmp)) { pChn->dwFlags |= CHN_EXTRALOUD; @@ -1284,8 +1284,15 @@ if (d != (m_SndFile.ChnSettings[nChn].dwFlags & CHN_SURROUND)) { if (m_SndFile.m_nType & (MOD_TYPE_IT | MOD_TYPE_MPT)) SetModified(); - if (d) m_SndFile.ChnSettings[nChn].dwFlags |= CHN_SURROUND; - else m_SndFile.ChnSettings[nChn].dwFlags &= ~CHN_SURROUND; + if (d) + { + m_SndFile.ChnSettings[nChn].dwFlags |= CHN_SURROUND; + m_SndFile.ChnSettings[nChn].nPan = 128; + } + else + { + m_SndFile.ChnSettings[nChn].dwFlags &= ~CHN_SURROUND; + } } if (d) m_SndFile.Chn[nChn].dwFlags |= CHN_SURROUND; @@ -1318,6 +1325,7 @@ if (m_SndFile.ChnSettings[nChn].nPan != nPan) { m_SndFile.ChnSettings[nChn].nPan = nPan; + m_SndFile.ChnSettings[nChn].dwFlags &= ~CHN_SURROUND; if (m_SndFile.m_nType & (MOD_TYPE_S3M|MOD_TYPE_IT | MOD_TYPE_MPT)) SetModified(); bOk = true; } Modified: trunk/OpenMPT/mptrack/View_gen.cpp =================================================================== --- trunk/OpenMPT/mptrack/View_gen.cpp 2011-06-14 19:33:46 UTC (rev 900) +++ trunk/OpenMPT/mptrack/View_gen.cpp 2011-06-14 20:23:49 UTC (rev 901) @@ -593,6 +593,7 @@ const CHANNELINDEX nChn = (CHANNELINDEX)(m_nActiveTab * 4) + chnMod4; pModDoc->SurroundChannel(nChn, b); pModDoc->UpdateAllViews(this, HINT_MODCHANNELS | (m_nActiveTab << HINT_SHIFT_CHNTAB)); + UpdateView(HINT_MODCHANNELS); } } @@ -635,6 +636,7 @@ { m_sbPan[chnMod4].SetPos(pan/4); pModDoc->UpdateAllViews(this, HINT_MODCHANNELS | (m_nActiveTab << HINT_SHIFT_CHNTAB)); + UpdateView(HINT_MODCHANNELS); } } } @@ -683,6 +685,7 @@ if (pModDoc->SetChannelDefaultPan(nChn+iCh, pos*4)) { SetDlgItemInt(IDC_EDIT2+iCh*2, pos*4); + CheckDlgButton(IDC_CHECK2 + iCh * 2, BST_UNCHECKED); bUpdate = TRUE; } } Modified: trunk/OpenMPT/mptrack/tagging.cpp =================================================================== --- trunk/OpenMPT/mptrack/tagging.cpp 2011-06-14 19:33:46 UTC (rev 900) +++ trunk/OpenMPT/mptrack/tagging.cpp 2011-06-14 20:23:49 UTC (rev 901) @@ -56,19 +56,20 @@ tHeader.flags = 0x00; // No flags fwrite(&tHeader, 1, sizeof(tHeader), f); - // Write TIT2 (Title), TCOM / TPE1 (Composer), TALB (Album), TCON (Genre), TYER (Date), WXXX (URL), TENC (Encoder), COMM (Comment) + // Write TIT2 (Title), TCOM / TPE1 (Composer), TALB (Album), TCON (Genre), TYER / TDRC (Date), WXXX (URL), TENC (Encoder), COMM (Comment) WriteID3v2Frame("TIT2", title, f); WriteID3v2Frame("TPE1", artist, f); WriteID3v2Frame("TCOM", artist, f); WriteID3v2Frame("TALB", album, f); WriteID3v2Frame("TCON", genre, f); WriteID3v2Frame("TYER", year, f); + WriteID3v2Frame("TDRC", year, f); WriteID3v2Frame("WXXX", url, f); WriteID3v2Frame("TENC", encoder, f); WriteID3v2Frame("COMM", comments, f); // Write Padding - for(UINT i = 0; i < ID3v2_PADDING; i++) + for(size_t i = 0; i < ID3v2_PADDING; i++) { fputc(0, f); } @@ -123,10 +124,25 @@ WAVEFILEHEADER list; WAVEDATAHEADER chunk; - CHAR s[256]; DWORD info_ofs, end_ofs; - const DWORD zero = 0; + const uint8 zero = 0; + struct + { + DWORD id; + string *data; + } chunks[] = + { + { IFFID_ICMT, &comments }, + { IFFID_INAM, &title }, + { IFFID_IART, &artist }, + { IFFID_IPRD, &album }, + { IFFID_ICOP, &url }, + { IFFID_IGNR, &genre }, + { IFFID_ISFT, &encoder }, + { IFFID_ICRD, &year }, + }; + info_ofs = ftell(f); if (info_ofs & 1) { @@ -138,55 +154,35 @@ list.id_WAVE = IFFID_INFO; list.filesize = 4; fwrite(&list, 1, sizeof(list), f); - // ICMT - if (!comments.empty()) + + for(size_t iCmt = 0; iCmt < CountOf(chunks); iCmt++) { - chunk.id_data = IFFID_ICMT; - chunk.length = strlen(comments.c_str()) + 1; + if(chunks[iCmt].data->empty()) + { + continue; + } + + string data = *chunks[iCmt].data; + // Special case: Expand year to full date + if(chunks[iCmt].id == IFFID_ICRD) + { + data += "-01-01"; + } + + chunk.id_data = chunks[iCmt].id; + chunk.length = data.length() + 1; + fwrite(&chunk, 1, sizeof(chunk), f); - fwrite(comments.c_str(), 1, chunk.length, f); + fwrite(data.c_str(), 1, chunk.length, f); list.filesize += chunk.length + sizeof(chunk); - if (chunk.length & 1) + + // Chunks must be even-sized + if(chunk.length & 1) { fwrite(&zero, 1, 1, f); list.filesize++; } } - for (UINT iCmt=0; iCmt<=6; iCmt++) - { - s[0] = 0; - switch(iCmt) - { - // INAM - case 0: memcpy(s, title.c_str(), 255); s[255] = 0; chunk.id_data = IFFID_INAM; break; - // IART - case 1: memcpy(s, artist.c_str(), 255); s[255] = 0; chunk.id_data = IFFID_IART; break; - // IPRD - case 2: memcpy(s, album.c_str(), 255); s[255] = 0; chunk.id_data = IFFID_IPRD; break; - // ICOP - case 3: memcpy(s, url.c_str(), 255); s[255] = 0; chunk.id_data = IFFID_ICOP; break; - // IGNR - case 4: memcpy(s, genre.c_str(), 255); s[255] = 0; chunk.id_data = IFFID_IGNR; break; - // ISFT - case 5: memcpy(s, encoder.c_str(), 255); s[255] = 0; chunk.id_data = IFFID_ISFT; break; - // ICRD - case 6: memcpy(s, year.c_str(), 4); s[4] = 0; strcat(s, "-01-01"); if (s[0] <= '0') s[0] = 0; chunk.id_data = IFFID_ICRD; break; - } - int l = strlen(s); - while ((l > 0) && (s[l-1] == ' ')) s[--l] = 0; - if (s[0]) - { - chunk.length = strlen(s)+1; - fwrite(&chunk, 1, sizeof(chunk), f); - fwrite(s, 1, chunk.length, f); - list.filesize += chunk.length + sizeof(chunk); - if (chunk.length & 1) - { - fwrite(&zero, 1, 1, f); - list.filesize++; - } - } - } // Update INFO size end_ofs = ftell(f); fseek(f, info_ofs, SEEK_SET); Modified: trunk/OpenMPT/mptrack/version.h =================================================================== --- trunk/OpenMPT/mptrack/version.h 2011-06-14 19:33:46 UTC (rev 900) +++ trunk/OpenMPT/mptrack/version.h 2011-06-14 20:23:49 UTC (rev 901) @@ -15,7 +15,7 @@ #define VER_MAJORMAJOR 1 #define VER_MAJOR 19 #define VER_MINOR 02 -#define VER_MINORMINOR 05 +#define VER_MINORMINOR 06 //Creates version number from version parts that appears in version string. //For example MAKE_VERSION_NUMERIC(1,17,02,28) gives version number of This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <sag...@us...> - 2011-06-15 13:42:52
|
Revision: 902 http://modplug.svn.sourceforge.net/modplug/?rev=902&view=rev Author: saga-games Date: 2011-06-15 13:42:46 +0000 (Wed, 15 Jun 2011) Log Message: ----------- [Imp] When moving a plugin to another slot, plugins routing their output to the selected plugin are now taken into account when selecting a default slot to move the plugin to. Modified Paths: -------------- trunk/OpenMPT/mptrack/MoveFXSlotDialog.cpp trunk/OpenMPT/mptrack/MoveFXSlotDialog.h trunk/OpenMPT/mptrack/View_gen.cpp Modified: trunk/OpenMPT/mptrack/MoveFXSlotDialog.cpp =================================================================== --- trunk/OpenMPT/mptrack/MoveFXSlotDialog.cpp 2011-06-14 20:23:49 UTC (rev 901) +++ trunk/OpenMPT/mptrack/MoveFXSlotDialog.cpp 2011-06-15 13:42:46 UTC (rev 902) @@ -43,10 +43,11 @@ CDialog::OnOK(); } -void CMoveFXSlotDialog::SetupMove(UINT currentSlot, CArray<UINT, UINT> &emptySlots) -//--------------------------------------------------------------------------------- +void CMoveFXSlotDialog::SetupMove(PLUGINDEX currentSlot, CArray<UINT, UINT> &emptySlots, PLUGINDEX defaultIndex) +//-------------------------------------------------------------------------------------------------------------- { - m_csPrompt.Format("Move plugin in slot %d to the following empty slot:", currentSlot+1); + m_nDefaultSlot = defaultIndex; + m_csPrompt.Format("Move plugin in slot %d to the following empty slot:", currentSlot + 1); m_csTitle.Format("Move To Slot.."); m_EmptySlots.Copy(emptySlots); } @@ -59,11 +60,19 @@ SetWindowText(m_csTitle); CString slotText; - for (int nSlot=0; nSlot<m_EmptySlots.GetSize(); nSlot++) { - slotText.Format("FX%d", m_EmptySlots[nSlot]+1); + int defaultSlot = 0; + bool foundDefault = false; + for (int nSlot=0; nSlot<m_EmptySlots.GetSize(); nSlot++) + { + slotText.Format("FX%d", m_EmptySlots[nSlot] + 1); m_CbnEmptySlots.SetItemData(m_CbnEmptySlots.AddString(slotText), m_EmptySlots[nSlot]); + if(m_EmptySlots[nSlot] >= m_nDefaultSlot && !foundDefault) + { + defaultSlot = nSlot; + foundDefault = true; + } } - m_CbnEmptySlots.SetCurSel(0); + m_CbnEmptySlots.SetCurSel(defaultSlot); return TRUE; } Modified: trunk/OpenMPT/mptrack/MoveFXSlotDialog.h =================================================================== --- trunk/OpenMPT/mptrack/MoveFXSlotDialog.h 2011-06-14 20:23:49 UTC (rev 901) +++ trunk/OpenMPT/mptrack/MoveFXSlotDialog.h 2011-06-15 13:42:46 UTC (rev 902) @@ -10,7 +10,7 @@ public: CMoveFXSlotDialog(CWnd* pParent = NULL); // standard constructor virtual ~CMoveFXSlotDialog(); - void SetupMove(UINT currentSlot, CArray<UINT, UINT> &emptySlots); + void SetupMove(PLUGINDEX currentSlot, CArray<UINT, UINT> &emptySlots, PLUGINDEX defaultIndex); PLUGINDEX m_nToSlot; @@ -24,6 +24,7 @@ CArray<UINT, UINT> m_EmptySlots; virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support CComboBox m_CbnEmptySlots; + PLUGINDEX m_nDefaultSlot; DECLARE_MESSAGE_MAP() virtual void OnOK(); Modified: trunk/OpenMPT/mptrack/View_gen.cpp =================================================================== --- trunk/OpenMPT/mptrack/View_gen.cpp 2011-06-14 20:23:49 UTC (rev 901) +++ trunk/OpenMPT/mptrack/View_gen.cpp 2011-06-15 13:42:46 UTC (rev 902) @@ -1325,9 +1325,25 @@ CArray<UINT, UINT> emptySlots; BuildEmptySlotList(emptySlots); - dlg.SetupMove(m_nCurrentPlugin, emptySlots); + // If any plugin routes its output to the current plugin, we shouldn't try to move it before that plugin... + PLUGINDEX defaultIndex = 0; + const CSoundFile *pSndFile = GetDocument() ? (GetDocument()->GetSoundFile()) : nullptr; + if(pSndFile) + { + for(PLUGINDEX i = 0; i < m_nCurrentPlugin; i++) + { + const DWORD toPlug = pSndFile->m_MixPlugins[i].Info.dwOutputRouting; + if((toPlug & 0x80) && (toPlug & 0x7F) == m_nCurrentPlugin) + { + defaultIndex = i + 1; + } + } + } - if (dlg.DoModal() == IDOK) { + dlg.SetupMove(m_nCurrentPlugin, emptySlots, defaultIndex); + + if (dlg.DoModal() == IDOK) + { MovePlug(m_nCurrentPlugin, dlg.m_nToSlot); m_CbnPlugin.SetCurSel(dlg.m_nToSlot); OnPluginChanged(); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <sag...@us...> - 2011-06-16 20:30:02
|
Revision: 903 http://modplug.svn.sourceforge.net/modplug/?rev=903&view=rev Author: saga-games Date: 2011-06-16 20:29:56 +0000 (Thu, 16 Jun 2011) Log Message: ----------- [Mod] Extended file load test: File is now saved and then re-loaded to verify if file saving works. [Mod] Removed VS2008 exe bloatage fix from StdAfx.cpp again since the latest patches seem to have remedied the situation. Modified Paths: -------------- trunk/OpenMPT/mptrack/Moddoc.h trunk/OpenMPT/mptrack/STDAFX.CPP trunk/OpenMPT/mptrack/test/test.cpp Modified: trunk/OpenMPT/mptrack/Moddoc.h =================================================================== --- trunk/OpenMPT/mptrack/Moddoc.h 2011-06-15 13:42:46 UTC (rev 902) +++ trunk/OpenMPT/mptrack/Moddoc.h 2011-06-16 20:29:56 UTC (rev 903) @@ -269,6 +269,7 @@ SplitKeyboardSettings *GetSplitKeyboardSettings() { return &m_SplitKeyboardSettings; } vector<FileHistory> *GetFileHistory() { return &m_FileHistory; } + const vector<FileHistory> *GetFileHistory() const { return &m_FileHistory; } time_t GetCreationTime() const { return m_creationTime; } // operations Modified: trunk/OpenMPT/mptrack/STDAFX.CPP =================================================================== --- trunk/OpenMPT/mptrack/STDAFX.CPP 2011-06-15 13:42:46 UTC (rev 902) +++ trunk/OpenMPT/mptrack/STDAFX.CPP 2011-06-16 20:29:56 UTC (rev 903) @@ -4,7 +4,7 @@ #include "stdafx.h" -#if (_MSC_VER == MSVC_VER_2008) +/*#if (_MSC_VER == MSVC_VER_2008) // Fix for VS2008 SP1 bloatage (http://tedwvc.wordpress.com/2011/04/16/static-mfc-code-bloat-problem-from-vc2010-is-now-in-vc2008-sp1security-fix/): @@ -33,4 +33,4 @@ return(::AfxCtxLoadLibraryW(wszLoadPath)); } -#endif +#endif*/ Modified: trunk/OpenMPT/mptrack/test/test.cpp =================================================================== --- trunk/OpenMPT/mptrack/test/test.cpp 2011-06-15 13:42:46 UTC (rev 902) +++ trunk/OpenMPT/mptrack/test/test.cpp 2011-06-16 20:29:56 UTC (rev 903) @@ -64,7 +64,7 @@ void TestVersion(); void TestTypes(); -void TestLoadFile(); +void TestLoadSaveFile(); void TestPCnoteSerialization(); void TestMisc(); @@ -78,11 +78,13 @@ DO_TEST(TestTypes); //DO_TEST(TestPCnoteSerialization); DO_TEST(TestMisc); - DO_TEST(TestLoadFile) + DO_TEST(TestLoadSaveFile) Log(TEXT("Tests were run\n")); } + +// Test if functions related to program version data work void TestVersion() //---------------- { @@ -146,6 +148,7 @@ } +// Test if data types are interpreted correctly void TestTypes() //-------------- { @@ -198,47 +201,10 @@ } -template<class T> -T Round(double a) {return static_cast<T>(floor(a + 0.5));} - -double Rand01() {return rand() / double(RAND_MAX);} - -template <class T> -T Rand(const T& min, const T& max) {return Round<T>(min + Rand01() * (max - min));} - - - -void GenerateCommands(CPattern& pat, const double dProbPcs, const double dProbPc) -//------------------------------------------------------------------------------- +// Check if our test file was loaded correctly. +void TestLoadFile(const CModDoc *pModDoc) +//--------------------------------------- { - const double dPcxProb = dProbPcs + dProbPc; - const CPattern::const_iterator end = pat.End(); - for(CPattern::iterator i = pat.Begin(); i != end; i++) - { - const double rand = Rand01(); - if(rand < dPcxProb) - { - if(rand < dProbPcs) - i->note = NOTE_PCS; - else - i->note = NOTE_PC; - - i->instr = Rand<BYTE>(0, MAX_MIXPLUGINS); - i->SetValueVolCol(Rand<uint16>(0, MODCOMMAND::maxColumnValue)); - i->SetValueEffectCol(Rand<uint16>(0, MODCOMMAND::maxColumnValue)); - } - else - i->Clear(); - } -} - - -void TestLoadFile() -//----------------- -{ - CString theFile = __FILE__; - theFile.Replace(".cpp", ".mptm"); - CModDoc *pModDoc = (CModDoc *)theApp.OpenDocumentFile(theFile); const CSoundFile *pSndFile = pModDoc->GetSoundFile(); // Global Variables @@ -441,10 +407,67 @@ VERIFY_EQUAL_NONCONT(mapping.GetEvent(), MIDIEVENT_CONTROLLERCHANGE); VERIFY_EQUAL_NONCONT(mapping.GetController(), MIDICC_ModulationWheel_Coarse); +} + + +// Test file loading and saving +void TestLoadSaveFile() +//--------------------- +{ + CString theFile = __FILE__; + theFile.Replace(".cpp", ".mptm"); + // Test file loading + CModDoc *pModDoc = (CModDoc *)theApp.OpenDocumentFile(theFile); + TestLoadFile(pModDoc); + + // Test file saving + theFile += ".saved"; + pModDoc->GetSoundFile()->SaveIT(theFile); pModDoc->OnCloseDocument(); + + // Reload the saved file and test if everything is still working correctly. + pModDoc = (CModDoc *)theApp.OpenDocumentFile(theFile); + TestLoadFile(pModDoc); + pModDoc->OnCloseDocument(); } +template<class T> +T Round(double a) {return static_cast<T>(floor(a + 0.5));} + +double Rand01() {return rand() / double(RAND_MAX);} + +template <class T> +T Rand(const T& min, const T& max) {return Round<T>(min + Rand01() * (max - min));} + + + +void GenerateCommands(CPattern& pat, const double dProbPcs, const double dProbPc) +//------------------------------------------------------------------------------- +{ + const double dPcxProb = dProbPcs + dProbPc; + const CPattern::const_iterator end = pat.End(); + for(CPattern::iterator i = pat.Begin(); i != end; i++) + { + const double rand = Rand01(); + if(rand < dPcxProb) + { + if(rand < dProbPcs) + i->note = NOTE_PCS; + else + i->note = NOTE_PC; + + i->instr = Rand<BYTE>(0, MAX_MIXPLUGINS); + i->SetValueVolCol(Rand<uint16>(0, MODCOMMAND::maxColumnValue)); + i->SetValueEffectCol(Rand<uint16>(0, MODCOMMAND::maxColumnValue)); + } + else + i->Clear(); + } +} + + +// Test PC note serialization void TestPCnoteSerialization() //---------------------------- { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <sag...@us...> - 2011-06-26 12:09:45
|
Revision: 907 http://modplug.svn.sourceforge.net/modplug/?rev=907&view=rev Author: saga-games Date: 2011-06-26 12:09:38 +0000 (Sun, 26 Jun 2011) Log Message: ----------- [Ref] Renamed sfx_fixed_* to zxx_*, macro test should now work again Modified Paths: -------------- trunk/OpenMPT/mptrack/Moddoc.cpp trunk/OpenMPT/mptrack/Moddoc.h trunk/OpenMPT/mptrack/Mptrack.cpp trunk/OpenMPT/mptrack/dlg_misc.cpp trunk/OpenMPT/mptrack/test/test.cpp Modified: trunk/OpenMPT/mptrack/Moddoc.cpp =================================================================== --- trunk/OpenMPT/mptrack/Moddoc.cpp 2011-06-26 09:24:12 UTC (rev 906) +++ trunk/OpenMPT/mptrack/Moddoc.cpp 2011-06-26 12:09:38 UTC (rev 907) @@ -3254,7 +3254,7 @@ { return -1; } - for (int macro = 0; macro < NUM_MACROS; macro++) + for (size_t macro = 0; macro < NUM_MACROS; macro++) { CString macroString = pSndFile->m_MidiCfg.szMidiSFXExt[macro]; if (GetMacroType(macroString) == sfx_plug && MacroToPlugParam(macroString) == param) @@ -3272,14 +3272,14 @@ //---------------------------------------------------------------------------------- { // Compare with all possible preset patterns - for(int i = 1; i < sfx_fixed_max; i++) + for(size_t i = 1; i < zxx_max; i++) { // Prepare pattern to compare CHAR szPatterns[128][MACRO_LENGTH]; CreateZxxFromType(szPatterns, static_cast<enmFixedMacroType>(i)); bool bFound = true; - for(int j = 0; j < 128; j++) + for(size_t j = 0; j < 128; j++) { if(strncmp(szPatterns[j], szMidiZXXExt[j], MACRO_LENGTH)) { @@ -3289,7 +3289,7 @@ } if(bFound) return static_cast<enmFixedMacroType>(i); } - return sfx_fixed_custom; // Custom setup + return zxx_custom; // Custom setup } @@ -3297,32 +3297,32 @@ void CModDoc::CreateZxxFromType(CHAR (&szMidiZXXExt)[128][MACRO_LENGTH], enmFixedMacroType iZxxType) //-------------------------------------------------------------------------------------------------- { - for(int i = 0; i < 128; i++) + for(size_t i = 0; i < 128; i++) { switch(iZxxType) { - case sfx_fixed_reso4Bit: + case zxx_reso4Bit: // Type 1 - Z80 - Z8F controls resonance if (i < 16) wsprintf(szMidiZXXExt[i], "F0F001%02X", i * 8); else strcpy(szMidiZXXExt[i], ""); break; - case sfx_fixed_reso7Bit: + case zxx_reso7Bit: // Type 2 - Z80 - ZFF controls resonance wsprintf(szMidiZXXExt[i], "F0F001%02X", i); break; - case sfx_fixed_cutoff: + case zxx_cutoff: // Type 3 - Z80 - ZFF controls cutoff wsprintf(szMidiZXXExt[i], "F0F000%02X", i); break; - case sfx_fixed_mode: + case zxx_mode: // Type 4 - Z80 - ZFF controls filter mode wsprintf(szMidiZXXExt[i], "F0F002%02X", i); break; - case sfx_fixed_resomode: + case zxx_resomode: // Type 5 - Z80 - Z9F controls resonance + filter mode if (i < 16) wsprintf(szMidiZXXExt[i], "F0F001%02X", i * 8); else if (i < 32) wsprintf(szMidiZXXExt[i], "F0F002%02X", (i - 16) * 8); @@ -3352,7 +3352,7 @@ return false; } // Z80-Z8F controls resonance - if(GetZxxType(pSndFile->m_MidiCfg.szMidiZXXExt) != sfx_fixed_reso4Bit) + if(GetZxxType(pSndFile->m_MidiCfg.szMidiZXXExt) != zxx_reso4Bit) { return false; } @@ -3719,7 +3719,8 @@ CString macroText = GetSoundFile()->m_MidiCfg.szMidiSFXExt[checkMacro]; int macroType = GetMacroType(macroText); - if (macroType==sfx_plug && MacroToPlugParam(macroText)==paramToUse) { + if (macroType==sfx_plug && MacroToPlugParam(macroText)==paramToUse) + { 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); @@ -3729,11 +3730,14 @@ //set new macro CHAR *pMacroToSet = GetSoundFile()->m_MidiCfg.szMidiSFXExt[macroToSet]; - if (paramToUse<128) { + if (paramToUse < 128) + { wsprintf(pMacroToSet, "F0F0%Xz",paramToUse+128); - } else if (paramToUse<384) { + } else if (paramToUse < 384) + { wsprintf(pMacroToSet, "F0F1%Xz",paramToUse-128); - } else { + } else + { CString message; message.Format("Param %d beyond controllable range.", paramToUse); ::MessageBox(NULL,message, "Macro not assigned for this param",MB_ICONINFORMATION | MB_OK); Modified: trunk/OpenMPT/mptrack/Moddoc.h =================================================================== --- trunk/OpenMPT/mptrack/Moddoc.h 2011-06-26 09:24:12 UTC (rev 906) +++ trunk/OpenMPT/mptrack/Moddoc.h 2011-06-26 12:09:38 UTC (rev 907) @@ -108,14 +108,14 @@ // fixed macro presets: enum enmFixedMacroType { - sfx_fixed_custom = 0, - sfx_fixed_reso4Bit, // Type 1 - Z80 - Z8F controls resonance - sfx_fixed_reso7Bit, // Type 2 - Z80 - ZFF controls resonance - sfx_fixed_cutoff, // Type 3 - Z80 - ZFF controls cutoff - sfx_fixed_mode, // Type 4 - Z80 - ZFF controls filter mode - sfx_fixed_resomode, // Type 5 - Z80 - Z9F controls resonance + filter mode + zxx_custom = 0, + zxx_reso4Bit, // Type 1 - Z80 - Z8F controls resonance + zxx_reso7Bit, // Type 2 - Z80 - ZFF controls resonance + zxx_cutoff, // Type 3 - Z80 - ZFF controls cutoff + zxx_mode, // Type 4 - Z80 - ZFF controls filter mode + zxx_resomode, // Type 5 - Z80 - Z9F controls resonance + filter mode - sfx_fixed_max + zxx_max }; Modified: trunk/OpenMPT/mptrack/Mptrack.cpp =================================================================== --- trunk/OpenMPT/mptrack/Mptrack.cpp 2011-06-26 09:24:12 UTC (rev 906) +++ trunk/OpenMPT/mptrack/Mptrack.cpp 2011-06-26 12:09:38 UTC (rev 907) @@ -615,7 +615,7 @@ strcpy(m_MidiCfg.szMidiGlb[MIDIOUT_NOTEOFF], "9c n 0"); strcpy(m_MidiCfg.szMidiGlb[MIDIOUT_PROGRAM], "Cc p"); strcpy(m_MidiCfg.szMidiSFXExt[0], "F0F000z"); - CModDoc::CreateZxxFromType(m_MidiCfg.szMidiZXXExt, sfx_fixed_reso4Bit); + CModDoc::CreateZxxFromType(m_MidiCfg.szMidiZXXExt, zxx_reso4Bit); } ///////////////////////////////////////////////////////////////////////////// Modified: trunk/OpenMPT/mptrack/dlg_misc.cpp =================================================================== --- trunk/OpenMPT/mptrack/dlg_misc.cpp 2011-06-26 09:24:12 UTC (rev 906) +++ trunk/OpenMPT/mptrack/dlg_misc.cpp 2011-06-26 12:09:38 UTC (rev 907) @@ -952,7 +952,7 @@ { enmFixedMacroType zxx_preset = static_cast<enmFixedMacroType>(m_CbnZxxPreset.GetCurSel()); - if (zxx_preset != sfx_fixed_custom && m_pModDoc != nullptr) + if (zxx_preset != zxx_custom && m_pModDoc != nullptr) { m_pModDoc->CreateZxxFromType(m_MidiCfg.szMidiZXXExt, zxx_preset); UpdateDialog(); Modified: trunk/OpenMPT/mptrack/test/test.cpp =================================================================== --- trunk/OpenMPT/mptrack/test/test.cpp 2011-06-26 09:24:12 UTC (rev 906) +++ trunk/OpenMPT/mptrack/test/test.cpp 2011-06-26 12:09:38 UTC (rev 907) @@ -240,7 +240,7 @@ // Macros VERIFY_EQUAL_NONCONT(pModDoc->GetMacroType(pSndFile->m_MidiCfg.szMidiSFXExt[0]), sfx_reso); VERIFY_EQUAL_NONCONT(pModDoc->GetMacroType(pSndFile->m_MidiCfg.szMidiSFXExt[1]), sfx_drywet); - //VERIFY_EQUAL_NONCONT(pModDoc->GetZxxType(pSndFile->m_MidiCfg.szMidiZXXExt), zxx_resomode); + VERIFY_EQUAL_NONCONT(pModDoc->GetZxxType(pSndFile->m_MidiCfg.szMidiZXXExt), zxx_resomode); // Channels VERIFY_EQUAL_NONCONT(pSndFile->GetNumChannels(), 2); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <sag...@us...> - 2011-06-29 23:28:06
|
Revision: 908 http://modplug.svn.sourceforge.net/modplug/?rev=908&view=rev Author: saga-games Date: 2011-06-29 23:28:00 +0000 (Wed, 29 Jun 2011) Log Message: ----------- [Fix] MP3 export should no more result in a heap corruption and thus crash the tracker [Mod] OpenMPT: Version is now 1.19.02.08 Modified Paths: -------------- trunk/OpenMPT/mptrack/Mod2wave.cpp trunk/OpenMPT/mptrack/version.h Modified: trunk/OpenMPT/mptrack/Mod2wave.cpp =================================================================== --- trunk/OpenMPT/mptrack/Mod2wave.cpp 2011-06-26 12:09:38 UTC (rev 907) +++ trunk/OpenMPT/mptrack/Mod2wave.cpp 2011-06-29 23:28:00 UTC (rev 908) @@ -999,11 +999,13 @@ // Open the ACM Driver if (theApp.AcmDriverOpen(&had, m_hadid, 0L) != MMSYSERR_NOERROR) goto OnError; if (theApp.AcmStreamOpen(&has, had, &wfxSrc, m_pwfx, NULL, 0L, 0L, ACM_STREAMOPENF_NONREALTIME) != MMSYSERR_NOERROR) goto OnError; - if (theApp.AcmStreamSize(has, WAVECONVERTBUFSIZE, &dwDstBufSize, ACM_STREAMSIZEF_SOURCE) != MMSYSERR_NOERROR) goto OnError; - if (dwDstBufSize > 0x10000) dwDstBufSize = 0x10000; - pcmBuffer = (LPBYTE)GlobalAllocPtr(GHND, WAVECONVERTBUFSIZE); - dstBuffer = (LPBYTE)GlobalAllocPtr(GHND, dwDstBufSize); + if (theApp.AcmStreamSize(has, WAVECONVERTBUFSIZE, &dwDstBufSize, ACM_STREAMSIZEF_SOURCE | ACM_STREAMSIZEF_DESTINATION) != MMSYSERR_NOERROR) goto OnError; + //if (dwDstBufSize > 0x10000) dwDstBufSize = 0x10000; + pcmBuffer = new BYTE[WAVECONVERTBUFSIZE]; + dstBuffer = new BYTE[dwDstBufSize]; if ((!dstBuffer) || (!pcmBuffer)) goto OnError; + memset(pcmBuffer, 0, WAVECONVERTBUFSIZE); + memset(dstBuffer, 0, dwDstBufSize); MemsetZero(ash); ash.cbStruct = sizeof(ash); ash.pbSrc = pcmBuffer; @@ -1114,6 +1116,7 @@ } if (ash.cbDstLengthUsed > 0) { + ASSERT(ash.cbDstLengthUsed <= dwDstBufSize); UINT lWrite = fwrite(dstBuffer, 1, ash.cbDstLengthUsed, f); if (!lWrite) break; wdh.length += lWrite; @@ -1169,8 +1172,8 @@ if (bPrepared) theApp.AcmStreamUnprepareHeader(has, &ash, 0L); if (has != NULL) theApp.AcmStreamClose(has, 0L); if (had != NULL) theApp.AcmDriverClose(had, 0L); - if (pcmBuffer) GlobalFreePtr(pcmBuffer); - if (dstBuffer) GlobalFreePtr(dstBuffer); + if (pcmBuffer) delete[] pcmBuffer; + if (dstBuffer) delete[] dstBuffer; //rewbs: reduce to normal priority during debug for easier hang debugging //SetPriorityClass(GetCurrentProcess(), HIGH_PRIORITY_CLASS); SetPriorityClass(GetCurrentProcess(), NORMAL_PRIORITY_CLASS); Modified: trunk/OpenMPT/mptrack/version.h =================================================================== --- trunk/OpenMPT/mptrack/version.h 2011-06-26 12:09:38 UTC (rev 907) +++ trunk/OpenMPT/mptrack/version.h 2011-06-29 23:28:00 UTC (rev 908) @@ -15,7 +15,7 @@ #define VER_MAJORMAJOR 1 #define VER_MAJOR 19 #define VER_MINOR 02 -#define VER_MINORMINOR 07 +#define VER_MINORMINOR 08 //Creates version number from version parts that appears in version string. //For example MAKE_VERSION_NUMERIC(1,17,02,28) gives version number of This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <sag...@us...> - 2011-07-01 18:50:19
|
Revision: 910 http://modplug.svn.sourceforge.net/modplug/?rev=910&view=rev Author: saga-games Date: 2011-07-01 18:50:13 +0000 (Fri, 01 Jul 2011) Log Message: ----------- [Fix] More fixes to MP3 export... Should be "about right" now. Modified Paths: -------------- trunk/OpenMPT/mptrack/Mod2wave.cpp trunk/OpenMPT/mptrack/Mptrack.cpp Modified: trunk/OpenMPT/mptrack/Mod2wave.cpp =================================================================== --- trunk/OpenMPT/mptrack/Mod2wave.cpp 2011-07-01 18:04:04 UTC (rev 909) +++ trunk/OpenMPT/mptrack/Mod2wave.cpp 2011-07-01 18:50:13 UTC (rev 910) @@ -956,36 +956,30 @@ void CDoAcmConvert::OnButton1() //----------------------------- { - BOOL bSaveWave; + bool bSaveWave = false; CHAR s[80], fext[_MAX_EXT]; WAVEFILEHEADER wfh; WAVEDATAHEADER wdh, chunk; ACMSTREAMHEADER ash; WAVEFORMATEX wfxSrc; - HACMDRIVER had; - HACMSTREAM has; + HACMDRIVER hADriver = nullptr; + HACMSTREAM hAStream = nullptr; HWND progress; MSG msg; - LPBYTE pcmBuffer, dstBuffer; + LPBYTE pcmBuffer = nullptr, dstBuffer = nullptr; // Render and conversion buffers UINT retval = IDCANCEL, pos, n; DWORD dwDstBufSize, pcmBufSize, data_ofs; uint64 ullMaxSamples, ullSamples; int oldrepeat; - BOOL bPrepared, bFinished; + bool bPrepared = false, bFinished = false; FILE *f; - had = NULL; - has = NULL; - dstBuffer = NULL; - pcmBuffer = NULL; - bPrepared = FALSE; progress = ::GetDlgItem(m_hWnd, IDC_PROGRESS1); if ((!m_pSndFile) || (!m_lpszFileName) || (!m_pwfx) || (!m_hadid)) goto OnError; SetPriorityClass(GetCurrentProcess(), NORMAL_PRIORITY_CLASS); - bSaveWave = FALSE; _splitpath(m_lpszFileName, NULL, NULL, NULL, fext); if (((m_bSaveInfoField) && (m_pwfx->wFormatTag != WAVE_FORMAT_MPEGLAYER3)) - || (!lstrcmpi(fext, ".wav"))) bSaveWave = TRUE; + || (!lstrcmpi(fext, ".wav"))) bSaveWave = true; MemsetZero(wfxSrc); wfxSrc.wFormatTag = WAVE_FORMAT_PCM; wfxSrc.nSamplesPerSec = m_pwfx->nSamplesPerSec; @@ -997,9 +991,12 @@ wfxSrc.cbSize = 0; dwDstBufSize = WAVECONVERTBUFSIZE; // Open the ACM Driver - if (theApp.AcmDriverOpen(&had, m_hadid, 0L) != MMSYSERR_NOERROR) goto OnError; - if (theApp.AcmStreamOpen(&has, had, &wfxSrc, m_pwfx, NULL, 0L, 0L, ACM_STREAMOPENF_NONREALTIME) != MMSYSERR_NOERROR) goto OnError; - if (theApp.AcmStreamSize(has, WAVECONVERTBUFSIZE, &dwDstBufSize, ACM_STREAMSIZEF_SOURCE | ACM_STREAMSIZEF_DESTINATION) != MMSYSERR_NOERROR) goto OnError; + if (theApp.AcmDriverOpen(&hADriver, m_hadid, 0L) != MMSYSERR_NOERROR) goto OnError; + if (theApp.AcmStreamOpen(&hAStream, hADriver, &wfxSrc, m_pwfx, NULL, 0L, 0L, ACM_STREAMOPENF_NONREALTIME) != MMSYSERR_NOERROR) goto OnError; + // Next call is useless for BLADEenc/LAMEenc. Is it required for ACM codecs? + if (theApp.AcmStreamSize(hAStream, WAVECONVERTBUFSIZE, &dwDstBufSize, ACM_STREAMSIZEF_SOURCE) != MMSYSERR_NOERROR) goto OnError; + ASSERT(dwDstBufSize <= WAVECONVERTBUFSIZE); + if (theApp.AcmStreamSize(hAStream, WAVECONVERTBUFSIZE, &dwDstBufSize, ACM_STREAMSIZEF_DESTINATION) != MMSYSERR_NOERROR) goto OnError; //if (dwDstBufSize > 0x10000) dwDstBufSize = 0x10000; pcmBuffer = new BYTE[WAVECONVERTBUFSIZE]; dstBuffer = new BYTE[dwDstBufSize]; @@ -1012,8 +1009,8 @@ ash.cbSrcLength = WAVECONVERTBUFSIZE; ash.pbDst = dstBuffer; ash.cbDstLength = dwDstBufSize; - if (theApp.AcmStreamPrepareHeader(has, &ash, 0L) != MMSYSERR_NOERROR) goto OnError; - bPrepared = TRUE; + if (theApp.AcmStreamPrepareHeader(hAStream, &ash, 0L) != MMSYSERR_NOERROR) goto OnError; + bPrepared = true; // Creating the output file if ((f = fopen(m_lpszFileName, "wb")) == NULL) { @@ -1082,7 +1079,6 @@ ullSamples = 0; pos = 0; pcmBufSize = WAVECONVERTBUFSIZE; - bFinished = FALSE; // Writing File CMainFrame::GetMainFrame()->InitRenderer(m_pSndFile); //rewbs.VSTTimeInfo @@ -1092,12 +1088,12 @@ if (!bFinished) { lRead = m_pSndFile->Read(pcmBuffer + WAVECONVERTBUFSIZE - pcmBufSize, pcmBufSize); - if (!lRead) bFinished = TRUE; + if (!lRead) bFinished = true; } ullSamples += lRead; ash.cbSrcLength = lRead * wfxSrc.nBlockAlign + WAVECONVERTBUFSIZE - pcmBufSize; ash.cbDstLengthUsed = 0; - if (theApp.AcmStreamConvert(has, &ash, (lRead) ? ACM_STREAMCONVERTF_BLOCKALIGN : ACM_STREAMCONVERTF_END) != MMSYSERR_NOERROR) break; + if (theApp.AcmStreamConvert(hAStream, &ash, (lRead) ? ACM_STREAMCONVERTF_BLOCKALIGN : ACM_STREAMCONVERTF_END) != MMSYSERR_NOERROR) break; do { if (::PeekMessage(&msg, m_hWnd, 0, 0, PM_REMOVE)) @@ -1169,9 +1165,9 @@ fclose(f); if (!m_bAbort) retval = IDOK; OnError: - if (bPrepared) theApp.AcmStreamUnprepareHeader(has, &ash, 0L); - if (has != NULL) theApp.AcmStreamClose(has, 0L); - if (had != NULL) theApp.AcmDriverClose(had, 0L); + if (bPrepared) theApp.AcmStreamUnprepareHeader(hAStream, &ash, 0L); + if (hAStream != NULL) theApp.AcmStreamClose(hAStream, 0L); + if (hADriver != NULL) theApp.AcmDriverClose(hADriver, 0L); if (pcmBuffer) delete[] pcmBuffer; if (dstBuffer) delete[] dstBuffer; //rewbs: reduce to normal priority during debug for easier hang debugging Modified: trunk/OpenMPT/mptrack/Mptrack.cpp =================================================================== --- trunk/OpenMPT/mptrack/Mptrack.cpp 2011-07-01 18:04:04 UTC (rev 909) +++ trunk/OpenMPT/mptrack/Mptrack.cpp 2011-07-01 18:50:13 UTC (rev 910) @@ -2322,7 +2322,7 @@ ///////////////////////////////////////////////////////////////////////////////////////// -// MPEG Layer-3 Functions (through ACM) +// MPEG Layer-3 Functions (through ACM - access to LAMEenc and BLADEenc is emulated through the ACM interface) typedef struct BLADEENCSTREAMINFO { @@ -2424,8 +2424,8 @@ BYTE wfx[256]; WAVEFORMATEX *pwfx = (WAVEFORMATEX *)&wfx; - memset(&afd, 0, sizeof(afd)); - memset(pwfx, 0, sizeof(wfx)); + MemsetZero(afd); + MemsetZero(*pwfx); afd.cbStruct = sizeof(ACMFORMATDETAILS); afd.dwFormatTag = WAVE_FORMAT_PCM; afd.pwfx = pwfx; @@ -2731,11 +2731,11 @@ { if (fdwSize & ACM_STREAMSIZEF_DESTINATION) { - *pdwOutputBytes = pbeCfg->dwInputSamples * sizeof(SHORT); + *pdwOutputBytes = pbeCfg->dwOutputSamples * sizeof(short); } else if (fdwSize & ACM_STREAMSIZEF_SOURCE) { - *pdwOutputBytes = pbeCfg->dwOutputSamples; + *pdwOutputBytes = pbeCfg->dwInputSamples * sizeof(short); } return MMSYSERR_NOERROR; } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <sag...@us...> - 2011-07-02 12:28:58
|
Revision: 913 http://modplug.svn.sourceforge.net/modplug/?rev=913&view=rev Author: saga-games Date: 2011-07-02 12:28:51 +0000 (Sat, 02 Jul 2011) Log Message: ----------- [Fix] Hopefully the final fix for ACM MP3 export... Modified Paths: -------------- trunk/OpenMPT/mptrack/Mod2wave.cpp trunk/OpenMPT/mptrack/Mptrack.cpp Modified: trunk/OpenMPT/mptrack/Mod2wave.cpp =================================================================== --- trunk/OpenMPT/mptrack/Mod2wave.cpp 2011-07-01 20:15:53 UTC (rev 912) +++ trunk/OpenMPT/mptrack/Mod2wave.cpp 2011-07-02 12:28:51 UTC (rev 913) @@ -81,7 +81,7 @@ } m_dwFileLimit = 0; m_dwSongLimit = 0; - memset(&WaveFormat, 0, sizeof(WaveFormat)); + MemsetZero(WaveFormat); WaveFormat.Format.wFormatTag = WAVE_FORMAT_PCM; WaveFormat.Format.nChannels = 2; WaveFormat.Format.nSamplesPerSec = 44100; @@ -359,8 +359,8 @@ m_bDriversEnumerated = FALSE; m_nNumFormats = 0; m_nNumDrivers = 0; - memset(&afd, 0, sizeof(afd)); - memset(pwfx, 0, sizeof(wfx)); + MemsetZero(afd); + MemsetZero(*pwfx); afd.cbStruct = sizeof(ACMFORMATDETAILS); afd.dwFormatTag = WAVE_FORMAT_PCM; afd.pwfx = pwfx; @@ -401,8 +401,8 @@ m_nDriverIndex = m_CbnDriver.GetItemData(m_CbnDriver.GetCurSel()); m_bInitialFound = FALSE; if (m_nDriverIndex >= m_nNumDrivers) m_nDriverIndex = 0; - memset(&afd, 0, sizeof(afd)); - memset(wfx, 0, sizeof(wfx)); + MemsetZero(afd); + MemsetZero(wfx); afd.cbStruct = sizeof(ACMFORMATDETAILS); afd.dwFormatTag = WAVE_FORMAT_PCM; afd.pwfx = pwfx; @@ -452,7 +452,7 @@ { if (Drivers[i] == hdid) return TRUE; } - memset(&add, 0, sizeof(add)); + MemsetZero(add); add.cbStruct = sizeof(add); if (theApp.AcmDriverDetails(hdid, &add, 0L) == MMSYSERR_NOERROR) { @@ -993,9 +993,9 @@ // Open the ACM Driver if (theApp.AcmDriverOpen(&hADriver, m_hadid, 0L) != MMSYSERR_NOERROR) goto OnError; if (theApp.AcmStreamOpen(&hAStream, hADriver, &wfxSrc, m_pwfx, NULL, 0L, 0L, ACM_STREAMOPENF_NONREALTIME) != MMSYSERR_NOERROR) goto OnError; - // Next call is useless for BLADEenc/LAMEenc. Is it required for ACM codecs? + // This call is useless for BLADEenc/LAMEenc, but required for ACM codecs! if (theApp.AcmStreamSize(hAStream, WAVECONVERTBUFSIZE, &dwDstBufSize, ACM_STREAMSIZEF_SOURCE) != MMSYSERR_NOERROR) goto OnError; - ASSERT(dwDstBufSize <= WAVECONVERTBUFSIZE); + // This call is useless for ACM, but required for BLADEenc/LAMEenc codecs! if (theApp.AcmStreamSize(hAStream, WAVECONVERTBUFSIZE, &dwDstBufSize, ACM_STREAMSIZEF_DESTINATION) != MMSYSERR_NOERROR) goto OnError; //if (dwDstBufSize > 0x10000) dwDstBufSize = 0x10000; pcmBuffer = new BYTE[WAVECONVERTBUFSIZE]; Modified: trunk/OpenMPT/mptrack/Mptrack.cpp =================================================================== --- trunk/OpenMPT/mptrack/Mptrack.cpp 2011-07-01 20:15:53 UTC (rev 912) +++ trunk/OpenMPT/mptrack/Mptrack.cpp 2011-07-02 12:28:51 UTC (rev 913) @@ -807,7 +807,7 @@ //m_hAlternateResourceHandle = LoadLibrary("mpt_intl.dll"); - memset(&gMemStatus, 0, sizeof(gMemStatus)); + MemsetZero(gMemStatus); GlobalMemoryStatus(&gMemStatus); #if 0 Log("Physical: %lu\n", gMemStatus.dwTotalPhys); @@ -2075,7 +2075,7 @@ // & release builds when ran directly from vs.net m_pTextDib = lpTextDib; - memset(&m_Dib, 0, sizeof(m_Dib)); + MemsetZero(m_Dib); m_nTextColor = 0; m_nBkColor = 1; m_Dib.bmiHeader.biSize = sizeof(BITMAPINFOHEADER); @@ -2743,6 +2743,8 @@ } if (m_hACMInst) { + if (fdwSize & ACM_STREAMSIZEF_DESTINATION) // Why does acmStreamSize return ACMERR_NOTPOSSIBLE in this case? + return MMSYSERR_NOERROR; PFNACMSTREAMSIZE pfnAcmStreamSize = (PFNACMSTREAMSIZE)GetProcAddress(m_hACMInst, "acmStreamSize"); if (pfnAcmStreamSize) return pfnAcmStreamSize(has, cbInput, pdwOutputBytes, fdwSize); } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <sag...@us...> - 2011-07-02 13:10:35
|
Revision: 914 http://modplug.svn.sourceforge.net/modplug/?rev=914&view=rev Author: saga-games Date: 2011-07-02 13:10:28 +0000 (Sat, 02 Jul 2011) Log Message: ----------- [Fix] Tagging: Added text ending character to text strings in ID3v2 tags. [Mod] Mod Loading: When loading a file made with a newer version of OpenMPT that only differs in the build number (last number in the version), no warning is shown anymore. For all other cases, the warning is now also shown for MPTM files. Modified Paths: -------------- trunk/OpenMPT/mptrack/Moddoc.cpp trunk/OpenMPT/mptrack/tagging.cpp trunk/OpenMPT/mptrack/test/test.cpp trunk/OpenMPT/mptrack/version.h Modified: trunk/OpenMPT/mptrack/Moddoc.cpp =================================================================== --- trunk/OpenMPT/mptrack/Moddoc.cpp 2011-07-02 12:28:51 UTC (rev 913) +++ trunk/OpenMPT/mptrack/Moddoc.cpp 2011-07-02 13:10:28 UTC (rev 914) @@ -397,9 +397,8 @@ ReinitRecordState(); // -! NEW_FEATURE#0015 - // Show warning if file was made with more recent version of OpenMPT except for MPTM-files, - // which uses CModDocs log-mechanism to show messages. - if (m_SndFile.m_dwLastSavedWithVersion > MptVersion::num && m_SndFile.GetType() != MOD_TYPE_MPT) + // Show warning if file was made with more recent version of OpenMPT except + if(MptVersion::RemoveBuildNumber(m_SndFile.m_dwLastSavedWithVersion) > MptVersion::num) { char s[256]; wsprintf(s, "Warning: this song was last saved with a more recent version of OpenMPT.\r\nSong saved with: v%s. Current version: v%s.\r\n", Modified: trunk/OpenMPT/mptrack/tagging.cpp =================================================================== --- trunk/OpenMPT/mptrack/tagging.cpp 2011-07-02 12:28:51 UTC (rev 913) +++ trunk/OpenMPT/mptrack/tagging.cpp 2011-07-02 13:10:28 UTC (rev 914) @@ -62,12 +62,12 @@ WriteID3v2Frame("TCOM", artist, f); WriteID3v2Frame("TALB", album, f); WriteID3v2Frame("TCON", genre, f); - WriteID3v2Frame("TYER", year, f); + //WriteID3v2Frame("TYER", year, f); // Deprecated WriteID3v2Frame("TDRC", year, f); + WriteID3v2Frame("TBPM", bpm, f); WriteID3v2Frame("WXXX", url, f); WriteID3v2Frame("TENC", encoder, f); WriteID3v2Frame("COMM", comments, f); - WriteID3v2Frame("TBPM", bpm, f); // Write Padding for(size_t i = 0; i < ID3v2_PADDING; i++) @@ -102,6 +102,7 @@ sFramecontent = ID3v2_TEXTENDING + sFramecontent; } sFramecontent = ID3v2_CHARSET + sFramecontent; + sFramecontent += ID3v2_TEXTENDING; TAGID3v2FRAME tFrame; Modified: trunk/OpenMPT/mptrack/test/test.cpp =================================================================== --- trunk/OpenMPT/mptrack/test/test.cpp 2011-07-02 12:28:51 UTC (rev 913) +++ trunk/OpenMPT/mptrack/test/test.cpp 2011-07-02 13:10:28 UTC (rev 914) @@ -98,6 +98,11 @@ VERIFY_EQUAL( MptVersion::ToNum("1.17.02.28"), 18285096 ); VERIFY_EQUAL( MptVersion::ToNum(MptVersion::str), MptVersion::num ); VERIFY_EQUAL( MptVersion::ToStr(MptVersion::num), MptVersion::str ); + VERIFY_EQUAL( MptVersion::RemoveBuildNumber(MAKE_VERSION_NUMERIC(1,19,02,00)), MAKE_VERSION_NUMERIC(1,19,02,00)); + VERIFY_EQUAL( MptVersion::RemoveBuildNumber(MAKE_VERSION_NUMERIC(1,18,03,20)), MAKE_VERSION_NUMERIC(1,18,03,00)); + VERIFY_EQUAL( MptVersion::IsTestBuild(MAKE_VERSION_NUMERIC(1,18,01,13)), true); + VERIFY_EQUAL( MptVersion::IsTestBuild(MAKE_VERSION_NUMERIC(1,19,01,00)), false); + VERIFY_EQUAL( MptVersion::IsTestBuild(MAKE_VERSION_NUMERIC(1,17,02,54)), false); STATIC_ASSERT( MAKE_VERSION_NUMERIC(1,17,2,28) == 18285096 ); STATIC_ASSERT( MAKE_VERSION_NUMERIC(1,17,02,48) == 18285128 ); STATIC_ASSERT( MAKE_VERSION_NUMERIC(01,17,02,52) == 18285138 ); Modified: trunk/OpenMPT/mptrack/version.h =================================================================== --- trunk/OpenMPT/mptrack/version.h 2011-07-02 12:28:51 UTC (rev 913) +++ trunk/OpenMPT/mptrack/version.h 2011-07-02 13:10:28 UTC (rev 914) @@ -34,15 +34,16 @@ const VersionNum num = MPT_VERSION_NUMERIC; const char* const str = MPT_VERSION_STR; - //Returns numerical version value from given version string. - inline VersionNum ToNum(const char* const s) + // Returns numerical version value from given version string. + static VersionNum ToNum(const char* const s) { int v1, v2, v3, v4; sscanf(s, "%x.%x.%x.%x", &v1, &v2, &v3, &v4); return ((v1 << 24) + (v2 << 16) + (v3 << 8) + v4); - } - //Returns version string from given numerical version value. - inline CString ToStr(const VersionNum v) + }; + + // Returns version string from given numerical version value. + static CString ToStr(const VersionNum v) { CString strVersion; if(v == 0) @@ -50,6 +51,20 @@ else strVersion.Format("%X.%02X.%02X.%02X", (v>>24)&0xFF, (v>>16)&0xFF, (v>>8)&0xFF, (v)&0xFF); return strVersion; + }; + + // Return a version without build number (the last number in the version). + // The current versioning scheme uses this number only for test builds, and it should be 00 for official builds, + // So sometimes it might be wanted to do comparisons without the build number. + static VersionNum RemoveBuildNumber(const VersionNum num) + { + return (num & 0xFFFFFF00); + }; + + // Returns true if a given version number is from a test build, false if it's a release build. + static bool IsTestBuild(const VersionNum num) + { + return ((num > MAKE_VERSION_NUMERIC(1,17,02,54) && num < MAKE_VERSION_NUMERIC(1,18,02,00)) || (num > MAKE_VERSION_NUMERIC(1,18,02,00) && RemoveBuildNumber(num) != num)); } }; //namespace MptVersion This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <sag...@us...> - 2011-07-21 16:39:22
|
Revision: 920 http://modplug.svn.sourceforge.net/modplug/?rev=920&view=rev Author: saga-games Date: 2011-07-21 16:39:15 +0000 (Thu, 21 Jul 2011) Log Message: ----------- [Ref] Got rid of global gszModCommands / gszS3mCommands / gszVolCommands effect letter arrays. Always using modspecs-specific effect letter descriptions now. Modified Paths: -------------- trunk/OpenMPT/mptrack/Draw_pat.cpp trunk/OpenMPT/mptrack/Moddoc.cpp trunk/OpenMPT/mptrack/Modedit.cpp trunk/OpenMPT/mptrack/Mptrack.h trunk/OpenMPT/mptrack/View_pat.cpp trunk/OpenMPT/mptrack/View_smp.cpp Modified: trunk/OpenMPT/mptrack/Draw_pat.cpp =================================================================== --- trunk/OpenMPT/mptrack/Draw_pat.cpp 2011-07-16 22:43:01 UTC (rev 919) +++ trunk/OpenMPT/mptrack/Draw_pat.cpp 2011-07-21 16:39:15 UTC (rev 920) @@ -973,7 +973,7 @@ if (m->command) { UINT command = m->command & 0x3F; - int n = (pSndFile->m_nType & (MOD_TYPE_MOD|MOD_TYPE_XM)) ? gszModCommands[command] : gszS3mCommands[command]; + int n = pSndFile->GetModSpecifications().GetEffectLetter(command); ASSERT(n > ' '); //if (n <= ' ') n = '?'; DrawLetter(xbmp+x, 0, (char)n, pfnt->nEltWidths[3], pfnt->nCmdOfs); Modified: trunk/OpenMPT/mptrack/Moddoc.cpp =================================================================== --- trunk/OpenMPT/mptrack/Moddoc.cpp 2011-07-16 22:43:01 UTC (rev 919) +++ trunk/OpenMPT/mptrack/Moddoc.cpp 2011-07-21 16:39:15 UTC (rev 920) @@ -2282,8 +2282,7 @@ if ((bXX) && (bSupported)) { strcpy(pszDescription, " xx: "); - LPCSTR pszCmd = (m_SndFile.m_nType & (MOD_TYPE_MOD|MOD_TYPE_XM)) ? gszModCommands : gszS3mCommands; - pszDescription[0] = pszCmd[command]; + pszDescription[0] = m_SndFile.GetModSpecifications().GetEffectLetter(command); if ((gFXInfo[fxndx].dwParamMask & 0xF0) == 0xF0) pszDescription[1] = szHexChar[gFXInfo[fxndx].dwParamValue >> 4]; if ((gFXInfo[fxndx].dwParamMask & 0x0F) == 0x0F) pszDescription[2] = szHexChar[gFXInfo[fxndx].dwParamValue & 0x0F]; } Modified: trunk/OpenMPT/mptrack/Modedit.cpp =================================================================== --- trunk/OpenMPT/mptrack/Modedit.cpp 2011-07-16 22:43:01 UTC (rev 919) +++ trunk/OpenMPT/mptrack/Modedit.cpp 2011-07-21 16:39:15 UTC (rev 920) @@ -269,7 +269,7 @@ if(chnFrom < chnTo) { CHANNELINDEX temp = newOrder[chnFrom]; - for(UINT i = chnFrom; i < chnTo; i++) + for(CHANNELINDEX i = chnFrom; i < chnTo; i++) { newOrder[i] = newOrder[i + 1]; } @@ -278,7 +278,7 @@ else //case chnFrom > chnTo(can't be equal, since it has been examined earlier.) { CHANNELINDEX temp = newOrder[chnFrom]; - for(UINT i = chnFrom; i >= chnTo + 1; i--) + for(CHANNELINDEX i = chnFrom; i >= chnTo + 1; i--) { newOrder[i] = newOrder[i - 1]; } @@ -836,7 +836,7 @@ { if ((m->volcmd) && (m->volcmd <= MAX_VOLCMDS)) { - p[6] = gszVolCommands[m->volcmd]; + p[6] = m_SndFile.GetModSpecifications().GetVolEffectLetter(m->volcmd); p[7] = '0' + (m->vol / 10); p[8] = '0' + (m->vol % 10); } else p[6] = p[7] = p[8] = '.'; @@ -861,10 +861,7 @@ { if (m->command) { - if (m_SndFile.m_nType & (MOD_TYPE_S3M|MOD_TYPE_IT|MOD_TYPE_MPT)) - p[9] = gszS3mCommands[m->command]; - else - p[9] = gszModCommands[m->command]; + p[9] = m_SndFile.GetModSpecifications().GetEffectLetter(m->command); } else p[9] = '.'; if (m->param) { @@ -944,6 +941,7 @@ } } + const CModSpecifications &sourceSpecs = CSoundFile::GetModSpecifications(origFormat); const bool bS3MCommands = (origFormat & (MOD_TYPE_IT|MOD_TYPE_MPT|MOD_TYPE_S3M)) != 0 ? true : false; pos = startPos; @@ -1057,7 +1055,8 @@ m[col].volcmd = 0; for (UINT i=1; i<MAX_VOLCMDS; i++) { - if (s[5] == gszVolCommands[i]) + const char cmd = sourceSpecs.GetVolEffectLetter(i); + if (s[5] == cmd && cmd != '?') { m[col].volcmd = i; break; @@ -1086,10 +1085,14 @@ m[col].command = 0; if (s[8] != '.') { - LPCSTR psc = (bS3MCommands) ? gszS3mCommands : gszModCommands; for (UINT i=1; i<MAX_EFFECTS; i++) { - if ((s[8] == psc[i]) && (psc[i] != '?')) m[col].command = i; + const char cmd = sourceSpecs.GetEffectLetter(i); + if (s[8] == cmd && cmd != '?') + { + m[col].command = i; + break; + } } } } Modified: trunk/OpenMPT/mptrack/Mptrack.h =================================================================== --- trunk/OpenMPT/mptrack/Mptrack.h 2011-07-16 22:43:01 UTC (rev 919) +++ trunk/OpenMPT/mptrack/Mptrack.h 2011-07-21 16:39:15 UTC (rev 920) @@ -408,9 +408,6 @@ STATIC_ASSERT(ARRAYELEMCOUNT(szSpecialNoteShortDesc) == ARRAYELEMCOUNT(szSpecialNoteNames)); const LPCSTR szHexChar = "0123456789ABCDEF"; -const LPCSTR gszModCommands = " 0123456789ABCDRFFTE???GHK?YXPLZ\\?#??"; //rewbs.smoothVST: added last \ (written as \\); -const LPCSTR gszS3mCommands = " JFEGHLKRXODB?CQATI?SMNVW?UY?P?Z\\:#??"; //rewbs.smoothVST: added last \ (written as \\); -const LPCSTR gszVolCommands = " vpcdabuhlrgfe:o"; const TCHAR gszEmpty[] = TEXT(""); // Defined in load_mid.cpp Modified: trunk/OpenMPT/mptrack/View_pat.cpp =================================================================== --- trunk/OpenMPT/mptrack/View_pat.cpp 2011-07-16 22:43:01 UTC (rev 919) +++ trunk/OpenMPT/mptrack/View_pat.cpp 2011-07-21 16:39:15 UTC (rev 920) @@ -2120,7 +2120,7 @@ if (m_findReplace.dwFindFlags & PATSEARCH_VOLCMD) { if (m_findReplace.cmdFind.volcmd) - wsprintf(&szFind[strlen(szFind)], "%c", gszVolCommands[m_findReplace.cmdFind.volcmd]); + wsprintf(&szFind[strlen(szFind)], "%c", pSndFile->GetModSpecifications().GetVolEffectLetter(m_findReplace.cmdFind.volcmd)); else strcat(szFind, "."); } else strcat(szFind, "?"); @@ -2133,12 +2133,11 @@ { if (m_findReplace.cmdFind.command) { - if (pSndFile->m_nType & (MOD_TYPE_S3M|MOD_TYPE_IT|MOD_TYPE_MPT)) - wsprintf(&szFind[strlen(szFind)], "%c", gszS3mCommands[m_findReplace.cmdFind.command]); - else - wsprintf(&szFind[strlen(szFind)], "%c", gszModCommands[m_findReplace.cmdFind.command]); + wsprintf(&szFind[strlen(szFind)], "%c", pSndFile->GetModSpecifications().GetEffectLetter(m_findReplace.cmdFind.command)); } else + { strcat(szFind, "."); + } } else strcat(szFind, "?"); if (m_findReplace.dwFindFlags & PATSEARCH_PARAM) { @@ -3328,6 +3327,10 @@ break; + case MIDIEVENT_POLYAFTERTOUCH: + case MIDIEVENT_CHANAFTERTOUCH: + break; + case MIDIEVENT_CONTROLLERCHANGE: //Controller change switch(nByte1) { @@ -4020,7 +4023,6 @@ else if(pSndFile->GetModSpecifications().HasCommand(c)) { - //LPCSTR lpcmd = (pSndFile->m_nType & (MOD_TYPE_MOD|MOD_TYPE_XM)) ? gszModCommands : gszS3mCommands; if (c) { if ((c == m_cmdOld.command) && (!p->param) && (!p->command)) p->param = m_cmdOld.param; Modified: trunk/OpenMPT/mptrack/View_smp.cpp =================================================================== --- trunk/OpenMPT/mptrack/View_smp.cpp 2011-07-16 22:43:01 UTC (rev 919) +++ trunk/OpenMPT/mptrack/View_smp.cpp 2011-07-21 16:39:15 UTC (rev 920) @@ -1291,7 +1291,7 @@ const char cOffsetChar = pSndFile->GetModSpecifications().GetEffectLetter(CMD_OFFSET); const bool bHasHighOffset = (pSndFile->TypeIsS3M_IT_MPT() || (pSndFile->GetType() == MOD_TYPE_XM)); - const char cHighOffsetChar = (pSndFile->TypeIsS3M_IT_MPT()) ? gszS3mCommands[CMD_S3MCMDEX] : gszModCommands[CMD_XFINEPORTAUPDOWN]; + const char cHighOffsetChar = pSndFile->GetModSpecifications().GetEffectLetter((pSndFile->TypeIsS3M_IT_MPT()) ? CMD_S3MCMDEX : CMD_XFINEPORTAUPDOWN); if(xHigh == 0) wsprintf(s, "Offset: %c%02X", cOffsetChar, xLow); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <sag...@us...> - 2011-07-22 20:54:24
|
Revision: 923 http://modplug.svn.sourceforge.net/modplug/?rev=923&view=rev Author: saga-games Date: 2011-07-22 20:54:18 +0000 (Fri, 22 Jul 2011) Log Message: ----------- [Ref] Moved effect colour assignment arrays from mptrack to draw_pat Modified Paths: -------------- trunk/OpenMPT/mptrack/Draw_pat.cpp trunk/OpenMPT/mptrack/Mptrack.cpp trunk/OpenMPT/mptrack/Mptrack.h Modified: trunk/OpenMPT/mptrack/Draw_pat.cpp =================================================================== --- trunk/OpenMPT/mptrack/Draw_pat.cpp 2011-07-22 17:43:39 UTC (rev 922) +++ trunk/OpenMPT/mptrack/Draw_pat.cpp 2011-07-22 20:54:18 UTC (rev 923) @@ -98,7 +98,38 @@ // some additions there. +///////////////////////////////////////////////////////////////////////////// +// Effect colour codes +// Effect number => Effect colour assignment +const BYTE effectColors[] = +{ + 0, 0, MODCOLOR_PITCH, MODCOLOR_PITCH, + MODCOLOR_PITCH, MODCOLOR_PITCH, MODCOLOR_VOLUME, MODCOLOR_VOLUME, + MODCOLOR_VOLUME, MODCOLOR_PANNING, 0, MODCOLOR_VOLUME, + MODCOLOR_GLOBALS, MODCOLOR_VOLUME, MODCOLOR_GLOBALS, 0, + MODCOLOR_GLOBALS, MODCOLOR_GLOBALS, 0, 0, + 0, MODCOLOR_VOLUME, MODCOLOR_VOLUME, MODCOLOR_GLOBALS, + MODCOLOR_GLOBALS, 0, MODCOLOR_PITCH, MODCOLOR_PANNING, + MODCOLOR_PITCH, MODCOLOR_PANNING, 0, 0, + 0, 0, 0, MODCOLOR_PITCH, + MODCOLOR_PITCH, +}; + +STATIC_ASSERT(CountOf(effectColors) == MAX_EFFECTS); + +// Volume effect number => Effect colour assignment +const BYTE volEffectColors[] = +{ + 0, MODCOLOR_VOLUME, MODCOLOR_PANNING, MODCOLOR_VOLUME, + MODCOLOR_VOLUME, MODCOLOR_VOLUME, MODCOLOR_VOLUME, MODCOLOR_PITCH, + MODCOLOR_PITCH, MODCOLOR_PANNING, MODCOLOR_PANNING, MODCOLOR_PITCH, + MODCOLOR_PITCH, MODCOLOR_PITCH, 0, 0, +}; + +STATIC_ASSERT(CountOf(volEffectColors) == MAX_VOLCMDS); + + ///////////////////////////////////////////////////////////////////////////// // CViewPattern Drawing Implementation @@ -930,8 +961,8 @@ } else if ((!m->IsPcNote()) && (m->volcmd) && (m->volcmd < MAX_VOLCMDS) && (CMainFrame::m_dwPatternSetup & PATTERN_EFFECTHILIGHT)) { - if(gVolEffectColors[m->volcmd] != 0) - tx_col = gVolEffectColors[m->volcmd]; + if(volEffectColors[m->volcmd] != 0) + tx_col = volEffectColors[m->volcmd]; } // Drawing Volume m_Dib.SetTextColor(tx_col, bk_col); @@ -948,8 +979,8 @@ fx_col = row_col; if (!isPCnote && (m->command) && (m->command < MAX_EFFECTS) && (CMainFrame::m_dwPatternSetup & PATTERN_EFFECTHILIGHT)) { - if(gEffectColors[m->command] != 0) - fx_col = gEffectColors[m->command]; + if(effectColors[m->command] != 0) + fx_col = effectColors[m->command]; } if (!(dwSpeedUpMask & 0x08)) { Modified: trunk/OpenMPT/mptrack/Mptrack.cpp =================================================================== --- trunk/OpenMPT/mptrack/Mptrack.cpp 2011-07-22 17:43:39 UTC (rev 922) +++ trunk/OpenMPT/mptrack/Mptrack.cpp 2011-07-22 20:54:18 UTC (rev 923) @@ -212,28 +212,6 @@ TEXT("C-9"), TEXT("C#9"), TEXT("D-9"), TEXT("D#9"), TEXT("E-9"), TEXT("F-9"), TEXT("F#9"), TEXT("G-9"), TEXT("G#9"), TEXT("A-9"), TEXT("A#9"), TEXT("B-9"), }; -const BYTE gEffectColors[MAX_EFFECTS] = -{ - 0, 0, MODCOLOR_PITCH, MODCOLOR_PITCH, - MODCOLOR_PITCH, MODCOLOR_PITCH, MODCOLOR_VOLUME, MODCOLOR_VOLUME, - MODCOLOR_VOLUME, MODCOLOR_PANNING, 0, MODCOLOR_VOLUME, - MODCOLOR_GLOBALS, MODCOLOR_VOLUME, MODCOLOR_GLOBALS, 0, - MODCOLOR_GLOBALS, MODCOLOR_GLOBALS, 0, 0, - 0, MODCOLOR_VOLUME, MODCOLOR_VOLUME, MODCOLOR_GLOBALS, - MODCOLOR_GLOBALS, 0, MODCOLOR_PITCH, MODCOLOR_PANNING, - MODCOLOR_PITCH, MODCOLOR_PANNING, 0, 0, - 0, 0, 0, MODCOLOR_PITCH, - MODCOLOR_PITCH, -}; - -const BYTE gVolEffectColors[MAX_VOLCMDS] = -{ - 0, MODCOLOR_VOLUME, MODCOLOR_PANNING, MODCOLOR_VOLUME, - MODCOLOR_VOLUME, MODCOLOR_VOLUME, MODCOLOR_VOLUME, MODCOLOR_PITCH, - MODCOLOR_PITCH, MODCOLOR_PANNING, MODCOLOR_PANNING, MODCOLOR_PITCH, - MODCOLOR_PITCH, MODCOLOR_PITCH, 0, 0, -}; - static void ShowChangesDialog() //----------------------------- { Modified: trunk/OpenMPT/mptrack/Mptrack.h =================================================================== --- trunk/OpenMPT/mptrack/Mptrack.h 2011-07-22 17:43:39 UTC (rev 922) +++ trunk/OpenMPT/mptrack/Mptrack.h 2011-07-22 20:54:18 UTC (rev 923) @@ -395,8 +395,6 @@ /////////////////////////////////////////////////// // Tables -extern const BYTE gEffectColors[MAX_EFFECTS]; -extern const BYTE gVolEffectColors[MAX_VOLCMDS]; extern const LPCSTR szNoteNames[12]; extern const LPCTSTR szDefaultNoteNames[NOTE_MAX]; //const LPCTSTR szSpecialNoteNames[NOTE_MAX_SPECIAL - NOTE_MIN_SPECIAL + 1] = {TEXT("PCs"), TEXT("PC"), TEXT("~~"), TEXT("^^"), TEXT("==")}; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <sag...@us...> - 2011-07-22 21:31:25
|
Revision: 924 http://modplug.svn.sourceforge.net/modplug/?rev=924&view=rev Author: saga-games Date: 2011-07-22 21:31:18 +0000 (Fri, 22 Jul 2011) Log Message: ----------- [Mod] Realigned find/replace dialog a bit, to fit long note names for Note Cut/Off/Fade. [Fix] Some unsupported effects were shown in the Find/Replace dialog. Modified Paths: -------------- trunk/OpenMPT/mptrack/Mptrack.h trunk/OpenMPT/mptrack/PatternEditorDialogs.cpp trunk/OpenMPT/mptrack/mptrack.rc Modified: trunk/OpenMPT/mptrack/Mptrack.h =================================================================== --- trunk/OpenMPT/mptrack/Mptrack.h 2011-07-22 20:54:18 UTC (rev 923) +++ trunk/OpenMPT/mptrack/Mptrack.h 2011-07-22 21:31:18 UTC (rev 924) @@ -397,13 +397,13 @@ extern const LPCSTR szNoteNames[12]; extern const LPCTSTR szDefaultNoteNames[NOTE_MAX]; -//const LPCTSTR szSpecialNoteNames[NOTE_MAX_SPECIAL - NOTE_MIN_SPECIAL + 1] = {TEXT("PCs"), TEXT("PC"), TEXT("~~"), TEXT("^^"), TEXT("==")}; -const LPCTSTR szSpecialNoteNames[NOTE_MAX_SPECIAL - NOTE_MIN_SPECIAL + 1] = {TEXT("PCs"), TEXT("PC"), TEXT("Note Fade"), TEXT("Note Cut"), TEXT("Note Off")}; -const LPCTSTR szSpecialNoteShortDesc[NOTE_MAX_SPECIAL - NOTE_MIN_SPECIAL + 1] = {TEXT("Param Control (Smooth)"), TEXT("Param Control"), TEXT("Note Fade"), TEXT("Note Cut"), TEXT("Note Off")}; +//const LPCTSTR szSpecialNoteNames[] = {TEXT("PCs"), TEXT("PC"), TEXT("~~"), TEXT("^^"), TEXT("==")}; +const LPCTSTR szSpecialNoteNames[] = {TEXT("PCs"), TEXT("PC"), TEXT("~~ (Note Fade)"), TEXT("^^ (Note Cut)"), TEXT("== (Note Off)")}; +const LPCTSTR szSpecialNoteShortDesc[] = {TEXT("Param Control (Smooth)"), TEXT("Param Control"), TEXT("Note Fade"), TEXT("Note Cut"), TEXT("Note Off")}; // Make sure that special note arrays include string for every note. -STATIC_ASSERT(NOTE_MAX_SPECIAL - NOTE_MIN_SPECIAL + 1 == ARRAYELEMCOUNT(szSpecialNoteNames)); -STATIC_ASSERT(ARRAYELEMCOUNT(szSpecialNoteShortDesc) == ARRAYELEMCOUNT(szSpecialNoteNames)); +STATIC_ASSERT(NOTE_MAX_SPECIAL - NOTE_MIN_SPECIAL + 1 == CountOf(szSpecialNoteNames)); +STATIC_ASSERT(CountOf(szSpecialNoteShortDesc) == CountOf(szSpecialNoteNames)); const LPCSTR szHexChar = "0123456789ABCDEF"; const TCHAR gszEmpty[] = TEXT(""); Modified: trunk/OpenMPT/mptrack/PatternEditorDialogs.cpp =================================================================== --- trunk/OpenMPT/mptrack/PatternEditorDialogs.cpp 2011-07-22 20:54:18 UTC (rev 923) +++ trunk/OpenMPT/mptrack/PatternEditorDialogs.cpp 2011-07-22 21:31:18 UTC (rev 924) @@ -154,8 +154,8 @@ combo->SetItemData(combo->AddString("..."), 0); if (m_bReplace) { - combo->SetItemData(combo->AddString("note-1"), replaceNoteMinusOne); - combo->SetItemData(combo->AddString("note+1"), replaceNotePlusOne); + combo->SetItemData(combo->AddString("note -1"), replaceNoteMinusOne); + combo->SetItemData(combo->AddString("note +1"), replaceNotePlusOne); combo->SetItemData(combo->AddString("-1 oct"), replaceNoteMinusOctave); combo->SetItemData(combo->AddString("+1 oct"), replaceNotePlusOctave); } else @@ -177,8 +177,8 @@ combo->SetItemData(combo->AddString(".."), 0); if (m_bReplace) { - combo->SetItemData(combo->AddString("ins-1"), replaceInstrumentMinusOne); - combo->SetItemData(combo->AddString("ins+1"), replaceInstrumentPlusOne); + combo->SetItemData(combo->AddString("ins -1"), replaceInstrumentMinusOne); + combo->SetItemData(combo->AddString("ins +1"), replaceInstrumentPlusOne); } for (UINT n=1; n<MAX_INSTRUMENTS; n++) { @@ -209,8 +209,10 @@ UINT count = m_pModDoc->GetNumVolCmds(); for (UINT n=0; n<count; n++) { - m_pModDoc->GetVolCmdInfo(n, s); - if (s[0]) combo->SetItemData(combo->AddString(s), n); + if(m_pModDoc->GetVolCmdInfo(n, s) && s[0]) + { + combo->SetItemData(combo->AddString(s), n); + } } combo->SetCurSel(0); UINT fxndx = m_pModDoc->GetIndexFromVolCmd(m_nVolCmd); @@ -244,8 +246,10 @@ UINT count = m_pModDoc->GetNumEffects(); for (UINT n=0; n<count; n++) { - m_pModDoc->GetEffectInfo(n, s, true); - if (s[0]) combo->SetItemData(combo->AddString(s), n); + if(m_pModDoc->GetEffectInfo(n, s, true) && s[0]) + { + combo->SetItemData(combo->AddString(s), n); + } } combo->SetCurSel(0); UINT fxndx = m_pModDoc->GetIndexFromEffect(m_nCommand, m_nParam); @@ -423,17 +427,18 @@ m_nPattern, pSndFile->Patterns[m_nPattern].GetNumRows(), (pSndFile->Patterns[m_nPattern].GetNumRows() == 1) ? "" : "s", - (pSndFile->Patterns[m_nPattern].GetNumRows() * pSndFile->m_nChannels * sizeof(MODCOMMAND)) / 1024); + (pSndFile->Patterns[m_nPattern].GetNumRows() * pSndFile->GetNumChannels() * sizeof(MODCOMMAND)) / 1024); SetDlgItemText(IDC_TEXT1, s); - // Window title - CHAR szName[MAX_PATTERNNAME + 1]; - pSndFile->Patterns[m_nPattern].GetName(szName, MAX_PATTERNNAME); - if(strlen(szName)) + // Window title + const CString patternName = pSndFile->Patterns[m_nPattern].GetName(); + wsprintf(s, "Pattern Properties for Pattern #%d", m_nPattern); + if(!patternName.IsEmpty()) { - strcat(szName, ")"); + strcat(s, " ("); + strcat(s, patternName); + strcat(s, ")"); } - wsprintf(s, "Pattern Properties for Pattern #%d%s%s", m_nPattern, strlen(szName) ? " (" : "", szName); SetWindowText(s); // pattern time signature Modified: trunk/OpenMPT/mptrack/mptrack.rc =================================================================== --- trunk/OpenMPT/mptrack/mptrack.rc 2011-07-22 20:54:18 UTC (rev 923) +++ trunk/OpenMPT/mptrack/mptrack.rc 2011-07-22 21:31:18 UTC (rev 924) @@ -943,53 +943,53 @@ CTEXT "Wet Dry Ratio",IDC_STATIC8,245,282,65,14,SS_CENTERIMAGE,WS_EX_STATICEDGE END -IDD_EDIT_FIND DIALOGEX 0, 0, 182, 161 +IDD_EDIT_FIND DIALOGEX 0, 0, 214, 162 STYLE DS_SETFONT | DS_FIXEDSYS | WS_CHILD | WS_CAPTION CAPTION "Find" FONT 8, "MS Shell Dlg", 0, 0, 0x0 BEGIN - GROUPBOX "Search for:",IDC_STATIC,4,4,174,107 - CONTROL "Note",IDC_CHECK1,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,13,17,31,10 - COMBOBOX IDC_COMBO1,13,28,41,94,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP - CONTROL "Instrument",IDC_CHECK2,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,60,17,49,10 - COMBOBOX IDC_COMBO2,60,28,106,103,CBS_DROPDOWNLIST | CBS_SORT | WS_VSCROLL | WS_TABSTOP - CONTROL "Volume Effect",IDC_CHECK3,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,13,46,60,10 - COMBOBOX IDC_COMBO3,13,58,94,77,CBS_DROPDOWNLIST | CBS_SORT | WS_VSCROLL | WS_TABSTOP - CONTROL "Volume Data",IDC_CHECK4,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,117,46,56,10 - COMBOBOX IDC_COMBO4,117,58,48,77,CBS_DROPDOWNLIST | CBS_SORT | WS_VSCROLL | WS_TABSTOP - CONTROL "Effect",IDC_CHECK5,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,13,78,35,10 - COMBOBOX IDC_COMBO5,13,92,94,71,CBS_DROPDOWNLIST | CBS_SORT | WS_VSCROLL | WS_TABSTOP - CONTROL "Effect Data",IDC_CHECK6,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,117,78,52,10 - COMBOBOX IDC_COMBO6,117,92,48,68,CBS_DROPDOWNLIST | CBS_SORT | WS_VSCROLL | WS_TABSTOP - CONTROL "Find in current pattern",IDC_RADIO1,"Button",BS_AUTORADIOBUTTON,6,120,96,8 - CONTROL "Find in the whole song",IDC_RADIO2,"Button",BS_AUTORADIOBUTTON,6,144,102,8 - CONTROL "Only in channels",IDC_CHECK7,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,105,117,70,10 - EDITTEXT IDC_EDIT1,117,130,22,12,ES_AUTOHSCROLL | ES_NUMBER - CTEXT "to",IDC_STATIC,143,131,8,8 - EDITTEXT IDC_EDIT2,155,130,22,12,ES_AUTOHSCROLL | ES_NUMBER - CONTROL "Find in current selection",IDC_RADIO3,"Button",BS_AUTORADIOBUTTON,6,132,102,8 + GROUPBOX "Search for:",IDC_STATIC,4,4,206,110 + CONTROL "Note",IDC_CHECK1,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,12,18,60,10 + COMBOBOX IDC_COMBO1,12,30,59,94,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP + CONTROL "Instrument",IDC_CHECK2,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,84,18,114,10 + COMBOBOX IDC_COMBO2,84,30,114,103,CBS_DROPDOWNLIST | CBS_SORT | WS_VSCROLL | WS_TABSTOP + CONTROL "Volume Effect",IDC_CHECK3,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,12,48,114,10 + COMBOBOX IDC_COMBO3,12,60,114,77,CBS_DROPDOWNLIST | CBS_SORT | WS_VSCROLL | WS_TABSTOP + CONTROL "Volume Data",IDC_CHECK4,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,138,48,60,10 + COMBOBOX IDC_COMBO4,138,60,60,77,CBS_DROPDOWNLIST | CBS_SORT | WS_VSCROLL | WS_TABSTOP + CONTROL "Effect",IDC_CHECK5,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,12,78,114,10 + COMBOBOX IDC_COMBO5,12,90,113,71,CBS_DROPDOWNLIST | CBS_SORT | WS_VSCROLL | WS_TABSTOP + CONTROL "Effect Data",IDC_CHECK6,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,138,78,60,10 + COMBOBOX IDC_COMBO6,138,90,60,68,CBS_DROPDOWNLIST | CBS_SORT | WS_VSCROLL | WS_TABSTOP + CONTROL "Find in current pattern",IDC_RADIO1,"Button",BS_AUTORADIOBUTTON,6,120,108,8 + CONTROL "Find in the whole song",IDC_RADIO2,"Button",BS_AUTORADIOBUTTON,6,144,108,8 + CONTROL "Only in channels",IDC_CHECK7,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,120,120,70,10 + EDITTEXT IDC_EDIT1,132,132,28,12,ES_AUTOHSCROLL | ES_NUMBER + CTEXT "to",IDC_STATIC,164,134,8,8 + EDITTEXT IDC_EDIT2,176,132,28,12,ES_AUTOHSCROLL | ES_NUMBER + CONTROL "Find in current selection",IDC_RADIO3,"Button",BS_AUTORADIOBUTTON,6,132,108,8 END -IDD_EDIT_REPLACE DIALOGEX 0, 0, 182, 145 -STYLE DS_SETFONT | WS_CHILD | WS_CAPTION +IDD_EDIT_REPLACE DIALOGEX 0, 0, 214, 149 +STYLE DS_SETFONT | DS_FIXEDSYS | WS_CHILD | WS_CAPTION CAPTION "Replace" FONT 8, "MS Shell Dlg", 0, 0, 0x0 BEGIN - GROUPBOX "",IDC_STATIC,4,4,174,137 + GROUPBOX "",IDC_STATIC,4,4,206,140 CONTROL "Replace By:",IDC_CHECK7,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,12,15,63,10 - CONTROL "Note",IDC_CHECK1,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,13,31,31,10 - COMBOBOX IDC_COMBO1,13,42,41,93,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP - CONTROL "Instrument",IDC_CHECK2,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,60,31,49,10 - COMBOBOX IDC_COMBO2,60,42,106,92,CBS_DROPDOWNLIST | CBS_SORT | WS_VSCROLL | WS_TABSTOP - CONTROL "Volume Effect",IDC_CHECK3,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,13,60,60,10 - COMBOBOX IDC_COMBO3,13,71,94,64,CBS_DROPDOWNLIST | CBS_SORT | WS_VSCROLL | WS_TABSTOP - CONTROL "Volume Data",IDC_CHECK4,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,117,60,56,10 - COMBOBOX IDC_COMBO4,117,71,48,64,CBS_DROPDOWNLIST | CBS_SORT | WS_VSCROLL | WS_TABSTOP - CONTROL "Effect",IDC_CHECK5,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,13,92,35,10 - COMBOBOX IDC_COMBO5,13,106,94,70,CBS_DROPDOWNLIST | CBS_SORT | WS_VSCROLL | WS_TABSTOP - CONTROL "Effect Data",IDC_CHECK6,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,117,92,52,10 - COMBOBOX IDC_COMBO6,117,106,48,80,CBS_DROPDOWNLIST | CBS_SORT | WS_VSCROLL | WS_TABSTOP - CONTROL "Replace All (No confirmation)",IDC_CHECK8,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,12,125,144,10 + CONTROL "Note",IDC_CHECK1,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,12,30,60,10 + COMBOBOX IDC_COMBO1,12,42,59,93,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP + CONTROL "Instrument",IDC_CHECK2,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,84,30,114,10 + COMBOBOX IDC_COMBO2,84,42,114,92,CBS_DROPDOWNLIST | CBS_SORT | WS_VSCROLL | WS_TABSTOP + CONTROL "Volume Effect",IDC_CHECK3,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,13,60,113,10 + COMBOBOX IDC_COMBO3,12,72,114,64,CBS_DROPDOWNLIST | CBS_SORT | WS_VSCROLL | WS_TABSTOP + CONTROL "Volume Data",IDC_CHECK4,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,138,60,60,10 + COMBOBOX IDC_COMBO4,138,72,60,64,CBS_DROPDOWNLIST | CBS_SORT | WS_VSCROLL | WS_TABSTOP + CONTROL "Effect",IDC_CHECK5,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,12,90,114,10 + COMBOBOX IDC_COMBO5,12,102,114,70,CBS_DROPDOWNLIST | CBS_SORT | WS_VSCROLL | WS_TABSTOP + CONTROL "Effect Data",IDC_CHECK6,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,138,90,60,10 + COMBOBOX IDC_COMBO6,138,102,60,80,CBS_DROPDOWNLIST | CBS_SORT | WS_VSCROLL | WS_TABSTOP + CONTROL "Replace All (No confirmation)",IDC_CHECK8,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,12,126,186,10 END IDD_PATTERN_PROPERTIES DIALOGEX 0, 0, 190, 127 @@ -1716,9 +1716,16 @@ IDD_EDIT_FIND, DIALOG BEGIN - BOTTOMMARGIN, 145 + RIGHTMARGIN, 176 + BOTTOMMARGIN, 146 END + IDD_EDIT_REPLACE, DIALOG + BEGIN + RIGHTMARGIN, 182 + BOTTOMMARGIN, 148 + END + IDD_PATTERN_PROPERTIES, DIALOG BEGIN LEFTMARGIN, 4 This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <sag...@us...> - 2011-07-22 23:02:17
|
Revision: 926 http://modplug.svn.sourceforge.net/modplug/?rev=926&view=rev Author: saga-games Date: 2011-07-22 23:02:11 +0000 (Fri, 22 Jul 2011) Log Message: ----------- [Mod] Renamed "Find" to "Find / Replace" (http://forum.openmpt.org/index.php?topic=4055.0) Modified Paths: -------------- trunk/OpenMPT/mptrack/CommandSet.cpp trunk/OpenMPT/mptrack/InputHandler.cpp Modified: trunk/OpenMPT/mptrack/CommandSet.cpp =================================================================== --- trunk/OpenMPT/mptrack/CommandSet.cpp 2011-07-22 21:52:30 UTC (rev 925) +++ trunk/OpenMPT/mptrack/CommandSet.cpp 2011-07-22 23:02:11 UTC (rev 926) @@ -434,7 +434,7 @@ DefineKeyCommand(kcEditPaste, 1362, kcVisible, kcNoDummy, _T("Paste")); DefineKeyCommand(kcEditMixPaste, 1363, kcVisible, kcNoDummy, _T("Mix Paste")); DefineKeyCommand(kcEditSelectAll, 1364, kcVisible, kcNoDummy, _T("SelectAll")); - DefineKeyCommand(kcEditFind, 1365, kcVisible, kcNoDummy, _T("Find")); + DefineKeyCommand(kcEditFind, 1365, kcVisible, kcNoDummy, _T("Find / Replace")); DefineKeyCommand(kcEditFindNext, 1366, kcVisible, kcNoDummy, _T("Find Next")); DefineKeyCommand(kcViewMain, 1367, kcVisible, kcNoDummy, _T("Toggle Main View")); DefineKeyCommand(kcViewTree, 1368, kcVisible, kcNoDummy, _T("Toggle Tree View")); Modified: trunk/OpenMPT/mptrack/InputHandler.cpp =================================================================== --- trunk/OpenMPT/mptrack/InputHandler.cpp 2011-07-22 21:52:30 UTC (rev 925) +++ trunk/OpenMPT/mptrack/InputHandler.cpp 2011-07-22 23:02:11 UTC (rev 926) @@ -426,7 +426,7 @@ case ID_IMPORT_MIDILIB: s="Import &MIDI Library...\t"; c=kcFileImportMidiLib; break; case ID_ADD_SOUNDBANK: s="Add Sound &Bank...\t"; c=kcFileAddSoundBank; break; - case ID_PLAYER_PLAY: s="Pause/&Resume\t"; c= kcPlayPauseSong; break; + case ID_PLAYER_PLAY: s="Pause / &Resume\t"; c= kcPlayPauseSong; break; case ID_PLAYER_PLAYFROMSTART: s="&Play from start\t"; c=kcPlaySongFromStart; break; case ID_PLAYER_STOP: s="&Stop\t"; c=kcStopSong; break; case ID_PLAYER_PAUSE: s="P&ause\t"; c=kcPauseSong; break; @@ -440,7 +440,7 @@ case ID_EDIT_PASTE: s="&Paste\t"; c=kcEditPaste; break; case ID_EDIT_SELECT_ALL: s="Select &All\t"; c=kcEditSelectAll; break; case ID_EDIT_CLEANUP: s="C&leanup"; break; - case ID_EDIT_FIND: s="&Find\t"; c=kcEditFind; break; + case ID_EDIT_FIND: s="&Find / Replace\t"; c=kcEditFind; break; case ID_EDIT_FINDNEXT: s="Find &Next\t"; c=kcEditFindNext; break; case ID_EDIT_GOTO_MENU: s="&Goto\t"; c=kcPatternGoto; break; case ID_EDIT_SPLITKEYBOARDSETTINGS: s="Split &Keyboard Settings\t"; c=kcShowSplitKeyboardSettings; break; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <sag...@us...> - 2011-07-26 19:04:14
|
Revision: 929 http://modplug.svn.sourceforge.net/modplug/?rev=929&view=rev Author: saga-games Date: 2011-07-26 19:04:08 +0000 (Tue, 26 Jul 2011) Log Message: ----------- Experimental new code... [New] Adding / removing channels through the pattern editor now creates an undo point. [Fix] Moving channels and then undoing the move preserves old channel settings (http://bugs.openmpt.org/view.php?id=156). Modified Paths: -------------- trunk/OpenMPT/mptrack/Moddoc.h trunk/OpenMPT/mptrack/Modedit.cpp trunk/OpenMPT/mptrack/Undo.cpp trunk/OpenMPT/mptrack/Undo.h Modified: trunk/OpenMPT/mptrack/Moddoc.h =================================================================== --- trunk/OpenMPT/mptrack/Moddoc.h 2011-07-26 00:22:44 UTC (rev 928) +++ trunk/OpenMPT/mptrack/Moddoc.h 2011-07-26 19:04:08 UTC (rev 929) @@ -277,9 +277,9 @@ bool ChangeModType(MODTYPE wType); bool ChangeNumChannels(CHANNELINDEX nNewChannels, const bool showCancelInRemoveDlg = true); - CHANNELINDEX ReArrangeChannels(const vector<CHANNELINDEX> &fromToArray); + bool RemoveChannels(const vector<bool> &keepMask); + CHANNELINDEX ReArrangeChannels(const vector<CHANNELINDEX> &fromToArray, const bool createUndoPoint = true); bool MoveChannel(CHANNELINDEX chn_from, CHANNELINDEX chn_to); - bool RemoveChannels(const vector<bool> &keepMask); void CheckUsedChannels(vector<bool> &usedMask, CHANNELINDEX maxRemoveCount = MAX_BASECHANNELS) const; bool ConvertInstrumentsToSamples(); Modified: trunk/OpenMPT/mptrack/Modedit.cpp =================================================================== --- trunk/OpenMPT/mptrack/Modedit.cpp 2011-07-26 00:22:44 UTC (rev 928) +++ trunk/OpenMPT/mptrack/Modedit.cpp 2011-07-26 19:04:08 UTC (rev 929) @@ -138,8 +138,8 @@ // Base code for adding, removing, moving and duplicating channels. Returns new number of channels on success, CHANNELINDEX_INVALID otherwise. // The new channel vector can contain CHANNELINDEX_INVALID for adding new (empty) channels. -CHANNELINDEX CModDoc::ReArrangeChannels(const vector<CHANNELINDEX> &newOrder) -//--------------------------------------------------------------------------- +CHANNELINDEX CModDoc::ReArrangeChannels(const vector<CHANNELINDEX> &newOrder, const bool createUndoPoint) +//------------------------------------------------------------------------------------------------------- { //newOrder[i] tells which current channel should be placed to i:th position in //the new order, or if i is not an index of current channels, then new channel is @@ -157,20 +157,25 @@ } bool first = true; - if(nRemainingChannels != GetNumChannels()) + // Find highest valid pattern number for storing channel undo data with, since the pattern with the highest number will be undone first. + PATTERNINDEX highestPattern = 0; + for(PATTERNINDEX nPat = m_SndFile.Patterns.Size() - 1; nPat > 0; nPat--) { - // For now, changing number of channels can't be undone - GetPatternUndo()->ClearUndo(); + if(m_SndFile.Patterns.IsValidPat(nPat)) + { + highestPattern = nPat; + break; + } } BEGIN_CRITICAL(); - for(PATTERNINDEX nPat = 0; nPat < m_SndFile.Patterns.Size(); nPat++) + for(PATTERNINDEX nPat = 0; nPat <= highestPattern; nPat++) { - if(m_SndFile.Patterns[nPat]) + if(m_SndFile.Patterns.IsValidPat(nPat)) { - if(nRemainingChannels == GetNumChannels()) + if(createUndoPoint) { - GetPatternUndo()->PrepareUndo(nPat, 0, 0, GetNumChannels(), m_SndFile.Patterns[nPat].GetNumRows(), !first); + GetPatternUndo()->PrepareUndo(nPat, 0, 0, GetNumChannels(), m_SndFile.Patterns[nPat].GetNumRows(), !first, (nPat == highestPattern)); first = false; } @@ -795,9 +800,9 @@ case NOTE_NONE: p[1] = p[2] = p[3] = '.'; break; case NOTE_KEYOFF: p[1] = p[2] = p[3] = '='; break; case NOTE_NOTECUT: p[1] = p[2] = p[3] = '^'; break; - case NOTE_FADE: p[1] = p[2] = p[3] = '~'; break; - case NOTE_PC: p[1] = 'P'; p[2] = 'C'; p[3] = ' '; break; - case NOTE_PCS: p[1] = 'P'; p[2] = 'C'; p[3] = 'S'; break; + case NOTE_FADE: p[1] = p[2] = p[3] = '~'; break; + case NOTE_PC: p[1] = 'P'; p[2] = 'C'; p[3] = ' '; break; + case NOTE_PCS: p[1] = 'P'; p[2] = 'C'; p[3] = 'S'; break; default: p[1] = szNoteNames[(note-1) % 12][0]; p[2] = szNoteNames[(note-1) % 12][1]; Modified: trunk/OpenMPT/mptrack/Undo.cpp =================================================================== --- trunk/OpenMPT/mptrack/Undo.cpp 2011-07-26 00:22:44 UTC (rev 928) +++ trunk/OpenMPT/mptrack/Undo.cpp 2011-07-26 19:04:08 UTC (rev 929) @@ -39,8 +39,9 @@ // - numChns: width // - numRows: height // - linkToPrevious: Don't create a separate undo step, but link this to the previous undo event. Useful for commands that modify several patterns at once. -bool CPatternUndo::PrepareUndo(PATTERNINDEX pattern, CHANNELINDEX firstChn, ROWINDEX firstRow, CHANNELINDEX numChns, ROWINDEX numRows, bool linkToPrevious) -//--------------------------------------------------------------------------------------------------------------------------------------------------------- +// - storeChannelInfo: Also store current channel header information (pan / volume / etc. settings) and number of channels in this undo point. +bool CPatternUndo::PrepareUndo(PATTERNINDEX pattern, CHANNELINDEX firstChn, ROWINDEX firstRow, CHANNELINDEX numChns, ROWINDEX numRows, bool linkToPrevious, bool storeChannelInfo) +//-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- { if(m_pModDoc == nullptr) return false; CSoundFile *pSndFile = m_pModDoc->GetSoundFile(); @@ -84,6 +85,17 @@ pPattern += pSndFile->GetNumChannels(); } + if(storeChannelInfo) + { + sUndo.channelInfo = new PATTERNUNDOINFO; + sUndo.channelInfo->oldNumChannels = pSndFile->GetNumChannels(); + sUndo.channelInfo->settings = new MODCHANNELSETTINGS[pSndFile->GetNumChannels()]; + memcpy(sUndo.channelInfo->settings, pSndFile->ChnSettings, sizeof(MODCHANNELSETTINGS) * pSndFile->GetNumChannels()); + } else + { + sUndo.channelInfo = nullptr; + } + UndoBuffer.push_back(sUndo); if (bUpdate) m_pModDoc->UpdateAllViews(NULL, HINT_UNDO); @@ -127,6 +139,30 @@ // Select most recent undo slot const PATTERNUNDOBUFFER *pUndo = &UndoBuffer.back(); + if(pUndo->channelInfo != nullptr) + { + if(pUndo->channelInfo->oldNumChannels > pSndFile->GetNumChannels()) + { + // First add some channels again... + vector<CHANNELINDEX> channels(pUndo->channelInfo->oldNumChannels, CHANNELINDEX_INVALID); + for(CHANNELINDEX i = 0; i < pSndFile->GetNumChannels(); i++) + { + channels[i] = i; + } + m_pModDoc->ReArrangeChannels(channels, false); + } else if(pUndo->channelInfo->oldNumChannels < pSndFile->GetNumChannels()) + { + // ... or remove newly added channels + vector<CHANNELINDEX> channels(pUndo->channelInfo->oldNumChannels); + for(CHANNELINDEX i = 0; i < pUndo->channelInfo->oldNumChannels; i++) + { + channels[i] = i; + } + m_pModDoc->ReArrangeChannels(channels, false); + } + memcpy(pSndFile->ChnSettings, pUndo->channelInfo->settings, sizeof(MODCHANNELSETTINGS) * pUndo->channelInfo->oldNumChannels); + } + nPattern = pUndo->pattern; nRows = pUndo->patternsize; if(pUndo->firstChannel + pUndo->numChannels <= pSndFile->GetNumChannels()) @@ -159,14 +195,14 @@ RemoveLastUndoStep(); - if (CanUndo() == false) m_pModDoc->UpdateAllViews(NULL, HINT_UNDO); + if(CanUndo() == false) m_pModDoc->UpdateAllViews(NULL, HINT_UNDO); + if(linkToPrevious) { - return Undo(true); - } else - { - return nPattern; + nPattern = Undo(true); } + + return nPattern; } @@ -183,7 +219,12 @@ //------------------------------------------- { if(nStep >= UndoBuffer.size()) return; - if (UndoBuffer[nStep].pbuffer) delete[] UndoBuffer[nStep].pbuffer; + if(UndoBuffer[nStep].pbuffer) delete[] UndoBuffer[nStep].pbuffer; + if(UndoBuffer[nStep].channelInfo) + { + delete[] UndoBuffer[nStep].channelInfo->settings; + delete UndoBuffer[nStep].channelInfo; + } UndoBuffer.erase(UndoBuffer.begin() + nStep); } Modified: trunk/OpenMPT/mptrack/Undo.h =================================================================== --- trunk/OpenMPT/mptrack/Undo.h 2011-07-26 00:22:44 UTC (rev 928) +++ trunk/OpenMPT/mptrack/Undo.h 2011-07-26 19:04:08 UTC (rev 929) @@ -14,6 +14,13 @@ ///////////////////////////////////////////////////////////////////////////////////////// // Pattern Undo +// Additional undo information, as required +struct PATTERNUNDOINFO +{ + MODCHANNELSETTINGS *settings; + CHANNELINDEX oldNumChannels; +}; + struct PATTERNUNDOBUFFER { PATTERNINDEX pattern; @@ -21,6 +28,7 @@ CHANNELINDEX firstChannel, numChannels; ROWINDEX firstRow, numRows; MODCOMMAND *pbuffer; + PATTERNUNDOINFO *channelInfo; bool linkToPrevious; }; @@ -29,7 +37,7 @@ //================ { -private: +protected: std::vector<PATTERNUNDOBUFFER> UndoBuffer; CModDoc *m_pModDoc; @@ -42,7 +50,7 @@ // Pattern undo functions void ClearUndo(); - bool PrepareUndo(PATTERNINDEX pattern, CHANNELINDEX firstChn, ROWINDEX firstRow, CHANNELINDEX numChns, ROWINDEX numRows, bool linkToPrevious = false); + bool PrepareUndo(PATTERNINDEX pattern, CHANNELINDEX firstChn, ROWINDEX firstRow, CHANNELINDEX numChns, ROWINDEX numRows, bool linkToPrevious = false, bool storeChannelInfo = false); PATTERNINDEX Undo(); bool CanUndo(); void RemoveLastUndoStep(); @@ -93,7 +101,7 @@ //=============== { -private: +protected: // Undo buffer std::vector<std::vector<SAMPLEUNDOBUFFER> > UndoBuffer; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |