From: <sag...@us...> - 2011-08-25 15:46:33
|
Revision: 999 http://modplug.svn.sourceforge.net/modplug/?rev=999&view=rev Author: saga-games Date: 2011-08-25 15:46:25 +0000 (Thu, 25 Aug 2011) Log Message: ----------- [Mod] Changed exception handling a bit more again, added exception handler for notification thread. [Mod] OpenMPT: Version is now 1.20.00.13 Modified Paths: -------------- trunk/OpenMPT/mptrack/ExceptionHandler.cpp trunk/OpenMPT/mptrack/ExceptionHandler.h trunk/OpenMPT/mptrack/MainFrm.cpp trunk/OpenMPT/mptrack/version.h Modified: trunk/OpenMPT/mptrack/ExceptionHandler.cpp =================================================================== --- trunk/OpenMPT/mptrack/ExceptionHandler.cpp 2011-08-24 16:43:02 UTC (rev 998) +++ trunk/OpenMPT/mptrack/ExceptionHandler.cpp 2011-08-25 15:46:25 UTC (rev 999) @@ -12,24 +12,11 @@ #include "Mainfrm.h" #include "snddev.h" #include "Moddoc.h" +#include <shlwapi.h> #include "ExceptionHandler.h" #include "dbghelp.h" -void ExceptionHandler::RegisterMainThread() -//----------------------------------------- -{ - ::SetUnhandledExceptionFilter(UnhandledExceptionFilterMain); -} - - -void ExceptionHandler::RegisterAudioThread() -//------------------------------------------ -{ - ::SetUnhandledExceptionFilter(UnhandledExceptionFilterAudio); -} - - LONG ExceptionHandler::UnhandledExceptionFilterMain(_EXCEPTION_POINTERS *pExceptionInfo) //-------------------------------------------------------------------------------------- { @@ -44,6 +31,13 @@ } +LONG ExceptionHandler::UnhandledExceptionFilterNotify(_EXCEPTION_POINTERS *pExceptionInfo) +//---------------------------------------------------------------------------------------- +{ + return UnhandledExceptionFilter(pExceptionInfo, "notify"); +} + + typedef BOOL (WINAPI *MINIDUMPWRITEDUMP)(HANDLE hProcess, DWORD dwPid, HANDLE hFile, MINIDUMP_TYPE DumpType, CONST PMINIDUMP_EXCEPTION_INFORMATION ExceptionParam, CONST PMINIDUMP_USER_STREAM_INFORMATION UserStreamParam, @@ -64,6 +58,9 @@ pMainFrame->audioCloseDevice(); } + CString errorMessage; + errorMessage.Format("Unhandled exception 0x%X at address %p occoured in the %s thread.", pExceptionInfo->ExceptionRecord->ExceptionCode, pExceptionInfo->ExceptionRecord->ExceptionAddress, threadName); + const CString timestampDir = (CTime::GetCurrentTime()).Format("%Y-%m-%d %H.%M.%S\\"); CString baseRescuePath; { @@ -78,7 +75,7 @@ baseRescuePath.Append(timestampDir); if(!PathIsDirectory(baseRescuePath) && !CreateDirectory(baseRescuePath, nullptr)) { - ::MessageBox(window, "A crash has been detected and OpenMPT will be closed.\nOpenMPT was unable to create a directory for saving debug information and modified files to.", "OpenMPT Crash", MB_ICONERROR); + errorMessage.AppendFormat("\n\nCould not create the following directory for saving debug information and modified files to:\n%s", baseRescuePath); } } @@ -102,6 +99,8 @@ pDump(GetCurrentProcess(), GetCurrentProcessId(), hFile, MiniDumpNormal, &ExInfo, NULL, NULL); ::CloseHandle(hFile); + + errorMessage.AppendFormat("\n\nDebug information have been saved to\n%s", baseRescuePath); } } ::FreeLibrary(hDll); @@ -134,11 +133,11 @@ if(numFiles > 0) { - CString message; - message.Format("A crash has been detected in the %s thread and OpenMPT will be closed.\n%d modified file%s been rescued to\n\n%s\n\nNote: It cannot be guaranteed that rescued files are still intact.", threadName, numFiles, (numFiles == 1 ? " has" : "s have"), baseRescuePath); - ::MessageBox(window, message, "OpenMPT Crash", MB_ICONERROR); + errorMessage.AppendFormat("\n\n%d modified file%s been rescued, but it cannot be guaranteed that %s still intact.", numFiles, (numFiles == 1 ? " has" : "s have"), (numFiles == 1 ? "it is" : "they are")); } } + + ::MessageBox(window, errorMessage, "OpenMPT Crash", MB_ICONERROR); // Let Windows handle the exception... return EXCEPTION_CONTINUE_SEARCH; Modified: trunk/OpenMPT/mptrack/ExceptionHandler.h =================================================================== --- trunk/OpenMPT/mptrack/ExceptionHandler.h 2011-08-24 16:43:02 UTC (rev 998) +++ trunk/OpenMPT/mptrack/ExceptionHandler.h 2011-08-25 15:46:25 UTC (rev 999) @@ -18,13 +18,18 @@ { public: - static void RegisterMainThread(); - static void RegisterAudioThread(); + // Call this in the main thread to activate unhandled exception filtering for this thread. + static void RegisterMainThread() { ::SetUnhandledExceptionFilter(UnhandledExceptionFilterMain); }; + // Call this in the audio thread to activate unhandled exception filtering for this thread. + static void RegisterAudioThread() { ::SetUnhandledExceptionFilter(UnhandledExceptionFilterAudio); }; + // Call this in the notification thread to activate unhandled exception filtering for this thread. + static void RegisterNotifyThread() { ::SetUnhandledExceptionFilter(UnhandledExceptionFilterNotify); }; protected: static LONG WINAPI UnhandledExceptionFilterMain(_EXCEPTION_POINTERS *pExceptionInfo); static LONG WINAPI UnhandledExceptionFilterAudio(_EXCEPTION_POINTERS *pExceptionInfo); + static LONG WINAPI UnhandledExceptionFilterNotify(_EXCEPTION_POINTERS *pExceptionInfo); static LONG UnhandledExceptionFilter(_EXCEPTION_POINTERS *pExceptionInfo, const CString threadName); }; Modified: trunk/OpenMPT/mptrack/MainFrm.cpp =================================================================== --- trunk/OpenMPT/mptrack/MainFrm.cpp 2011-08-24 16:43:02 UTC (rev 998) +++ trunk/OpenMPT/mptrack/MainFrm.cpp 2011-08-25 15:46:25 UTC (rev 999) @@ -782,24 +782,13 @@ } -void Terminate_NotifyThread() -//--------------------------- -{ - //TODO: Why does this not get called. - AfxMessageBox("Notify thread terminated unexpectedly. Attempting to shut down audio device"); - CMainFrame* pMainFrame = CMainFrame::GetMainFrame(); - if (pMainFrame->gpSoundDevice) pMainFrame->gpSoundDevice->Reset(); - pMainFrame->audioCloseDevice(); - exit(-1); -} - // Notify thread DWORD WINAPI CMainFrame::NotifyThread(LPVOID) //------------------------------------------- { CMainFrame *pMainFrm; - set_terminate(Terminate_NotifyThread); + ExceptionHandler::RegisterNotifyThread(); SetThreadPriority(GetCurrentThread(), THREAD_PRIORITY_BELOW_NORMAL); for (;;) @@ -1317,7 +1306,7 @@ CSoundFile *pSndFile = pModDoc->GetSoundFile(); if ((!pSndFile) || (!pSndFile->GetType())) return FALSE; const bool bPaused = pSndFile->IsPaused(); - const bool bPatLoop = (pSndFile->m_dwSongFlags & SONG_PATTERNLOOP) ? true : false; + const bool bPatLoop = (pSndFile->m_dwSongFlags & SONG_PATTERNLOOP) != 0; pSndFile->ResetChannels(); // Select correct bidi loop mode when playing a module. pSndFile->SetupITBidiMode(); @@ -2311,17 +2300,6 @@ { case ID_NETLINK_MODPLUG: pszURL = "http://openmpt.org/"; break; case ID_NETLINK_TOP_PICKS: pszURL = "http://openmpt.org/top_picks"; break; - /* - case ID_NETLINK_OPENMPTWIKI:pszURL = "http://wiki.openmpt.org/"; break; -// case ID_NETLINK_UT: pszURL = "http://www.united-trackers.org"; break; -// case ID_NETLINK_OSMUSIC: pszURL = "http://www.osmusic.net/"; break; -// case ID_NETLINK_HANDBOOK: pszURL = "http://www.modplug.com/mods/handbook/handbook.htm"; break; - case ID_NETLINK_MPTFR: pszURL = "http://mpt.new.fr/"; break; - case ID_NETLINK_FORUMS: pszURL = "http://forum.openmpt.org/"; break; - case ID_NETLINK_PLUGINS: pszURL = "http://www.kvraudio.com/"; break; - case ID_NETLINK_MODARCHIVE: pszURL = "http://modarchive.org/"; break; - case ID_NETLINK_OPENMPTWIKI_GERMAN: pszURL = "http://wikide.openmpt.org/Hauptseite"; break; - */ } if (pszURL) return CTrackApp::OpenURL(pszURL); return FALSE; Modified: trunk/OpenMPT/mptrack/version.h =================================================================== --- trunk/OpenMPT/mptrack/version.h 2011-08-24 16:43:02 UTC (rev 998) +++ trunk/OpenMPT/mptrack/version.h 2011-08-25 15:46:25 UTC (rev 999) @@ -15,7 +15,7 @@ #define VER_MAJORMAJOR 1 #define VER_MAJOR 20 #define VER_MINOR 00 -#define VER_MINORMINOR 12 +#define VER_MINORMINOR 13 //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-08-31 17:51:53
|
Revision: 1002 http://modplug.svn.sourceforge.net/modplug/?rev=1002&view=rev Author: saga-games Date: 2011-08-31 17:51:46 +0000 (Wed, 31 Aug 2011) Log Message: ----------- [Fix] Tentative fix for disappearing combo boxes [Mod] Disabled DEP in VS2010 builds again (breaks Farbrausch V2) Modified Paths: -------------- trunk/OpenMPT/mptrack/Ctrl_gen.cpp trunk/OpenMPT/mptrack/Ctrl_ins.cpp trunk/OpenMPT/mptrack/Ctrl_pat.cpp trunk/OpenMPT/mptrack/Ctrl_smp.cpp trunk/OpenMPT/mptrack/mptrack_10.vcxproj trunk/OpenMPT/mptrack/resource.h Modified: trunk/OpenMPT/mptrack/Ctrl_gen.cpp =================================================================== --- trunk/OpenMPT/mptrack/Ctrl_gen.cpp 2011-08-25 21:22:28 UTC (rev 1001) +++ trunk/OpenMPT/mptrack/Ctrl_gen.cpp 2011-08-31 17:51:46 UTC (rev 1002) @@ -154,6 +154,9 @@ CMainFrame::EnableLowLatencyMode(FALSE); PostViewMessage(VIEWMSG_SETACTIVE, NULL); SetFocus(); + + // Combo boxes randomly disappear without this... why? + Invalidate(); } @@ -403,10 +406,12 @@ if ((m_pSndFile) && (m_pModDoc) && (m_bInitialized)) { m_EditVSTiVol.GetWindowText(s, sizeof(s)); - if (s[0]) { + if (s[0]) + { UINT n = ConvertStrTo<UINT>(s); - n = CLAMP(n, 0, 2000); - if (n != m_pSndFile->m_nVSTiVolume) { + Limit(n, 0u, 2000u); + if (n != m_pSndFile->m_nVSTiVolume) + { m_bEditsLocked=true; m_pSndFile->m_nVSTiVolume = n; m_pSndFile->RecalculateGainForAllPlugs(); @@ -426,10 +431,12 @@ if ((m_pSndFile) && (m_pModDoc) && (m_bInitialized)) { m_EditSamplePA.GetWindowText(s, sizeof(s)); - if (s[0]) { + if (s[0]) + { UINT n = ConvertStrTo<UINT>(s); - n = CLAMP(n, 0, 2000); - if (n != m_pSndFile->m_nSamplePreAmp) { + Limit(n, 0u, 2000u); + if (n != m_pSndFile->m_nSamplePreAmp) + { m_bEditsLocked=true; m_pSndFile->m_nSamplePreAmp = n; m_pModDoc->SetModified(); @@ -451,7 +458,7 @@ if (s[0]) { UINT n = atoi(s); - n = CLAMP(n, 0, 128); + Limit(n, 0u, 128u); if (n != (m_pSndFile->m_nDefaultGlobalVolume >> 1)) { m_bEditsLocked=true; @@ -478,7 +485,7 @@ if (s[0]) { ORDERINDEX n = (ORDERINDEX)atoi(s); - n = CLAMP(n, 0, m_pSndFile->Order.size()); + Limit(n, (ORDERINDEX)0, m_pSndFile->Order.size()); for (ORDERINDEX i = 0; i <= n; i++) if (m_pSndFile->Order[i] == m_pSndFile->Order.GetInvalidPatIndex()) return; Modified: trunk/OpenMPT/mptrack/Ctrl_ins.cpp =================================================================== --- trunk/OpenMPT/mptrack/Ctrl_ins.cpp 2011-08-25 21:22:28 UTC (rev 1001) +++ trunk/OpenMPT/mptrack/Ctrl_ins.cpp 2011-08-31 17:51:46 UTC (rev 1002) @@ -17,8 +17,6 @@ ///////////////////////////////////////////////////////////////////////// // CNoteMapWnd -#define ID_NOTEMAP_EDITSAMPLE 40000 - BEGIN_MESSAGE_MAP(CNoteMapWnd, CStatic) ON_WM_ERASEBKGND() ON_WM_PAINT() @@ -1026,8 +1024,8 @@ if (bUpdNum) { SetDlgItemInt(IDC_EDIT_INSTRUMENT, m_nInstrument); - m_SpinInstrument.SetRange(1, m_pSndFile->m_nInstruments); - m_SpinInstrument.EnableWindow((m_pSndFile->m_nInstruments) ? TRUE : FALSE); + m_SpinInstrument.SetRange(1, m_pSndFile->GetNumInstruments()); + m_SpinInstrument.EnableWindow((m_pSndFile->GetNumInstruments()) ? TRUE : FALSE); // Is this a bug ? m_SliderCutOff.InvalidateRect(NULL, FALSE); m_SliderResonance.InvalidateRect(NULL, FALSE); @@ -1073,6 +1071,8 @@ if (pFrame) PostViewMessage(VIEWMSG_LOADSTATE, (LPARAM)pFrame->GetInstrumentViewState()); SwitchToView(); + // Combo boxes randomly disappear without this... why? + Invalidate(); } @@ -1836,7 +1836,7 @@ int minval = 0, maxval = 32767; m_SpinFadeOut.GetRange(minval, maxval); int nVol = GetDlgItemInt(IDC_EDIT7); - nVol = CLAMP(nVol, minval, maxval); + Limit(nVol, minval, maxval); if(nVol != (int)pIns->nFadeOut) { @@ -1854,8 +1854,7 @@ if ((!IsLocked()) && (pIns)) { int nVol = GetDlgItemInt(IDC_EDIT8); - if (nVol < 0) nVol = 0; - if (nVol > 64) nVol = 64; + Limit(nVol, 0, 64); if (nVol != (int)pIns->nGlobalVol) { pIns->nGlobalVol = nVol; @@ -2808,6 +2807,7 @@ m_ComboTuning.SetCurSel(0); } + void CCtrlInstruments::UpdatePluginList() //--------------------------------------- { @@ -2817,14 +2817,13 @@ CHAR s[64]; for (PLUGINDEX nPlug = 0; nPlug <= MAX_MIXPLUGINS; nPlug++) { - s[0] = 0; if (!nPlug) { strcpy(s, "No plugin"); } else { - PSNDMIXPLUGIN p = &(m_pSndFile->m_MixPlugins[nPlug-1]); + PSNDMIXPLUGIN p = &(m_pSndFile->m_MixPlugins[nPlug - 1]); p->Info.szLibraryName[63] = 0; if (p->Info.szLibraryName[0]) wsprintf(s, "FX%d: %s", nPlug, p->Info.szName); Modified: trunk/OpenMPT/mptrack/Ctrl_pat.cpp =================================================================== --- trunk/OpenMPT/mptrack/Ctrl_pat.cpp 2011-08-25 21:22:28 UTC (rev 1001) +++ trunk/OpenMPT/mptrack/Ctrl_pat.cpp 2011-08-31 17:51:46 UTC (rev 1002) @@ -607,6 +607,9 @@ SwitchToView(); } + + // Combo boxes randomly disappear without this... why? + Invalidate(); } Modified: trunk/OpenMPT/mptrack/Ctrl_smp.cpp =================================================================== --- trunk/OpenMPT/mptrack/Ctrl_smp.cpp 2011-08-25 21:22:28 UTC (rev 1001) +++ trunk/OpenMPT/mptrack/Ctrl_smp.cpp 2011-08-31 17:51:46 UTC (rev 1002) @@ -404,6 +404,9 @@ CChildFrame *pFrame = (CChildFrame *)GetParentFrame(); if ((pFrame) && (m_hWndView)) PostViewMessage(VIEWMSG_LOADSTATE, (LPARAM)pFrame->GetSampleViewState()); SwitchToView(); + + // Combo boxes randomly disappear without this... why? + Invalidate(); } @@ -3113,8 +3116,8 @@ void CCtrlSamples::SetSelectionPoints(UINT nStart, UINT nEnd) //----------------------------------------------------------- { - nStart = CLAMP(nStart, 0, m_pSndFile->Samples[m_nSample].nLength); - nEnd = CLAMP(nEnd, 0, m_pSndFile->Samples[m_nSample].nLength); + Limit(nStart, 0u, m_pSndFile->Samples[m_nSample].nLength); + Limit(nEnd, 0u, m_pSndFile->Samples[m_nSample].nLength); SAMPLEVIEWSTATE viewstate; MemsetZero(viewstate); Modified: trunk/OpenMPT/mptrack/mptrack_10.vcxproj =================================================================== --- trunk/OpenMPT/mptrack/mptrack_10.vcxproj 2011-08-25 21:22:28 UTC (rev 1001) +++ trunk/OpenMPT/mptrack/mptrack_10.vcxproj 2011-08-31 17:51:46 UTC (rev 1002) @@ -158,7 +158,7 @@ <OptimizeReferences>true</OptimizeReferences> <EnableCOMDATFolding>true</EnableCOMDATFolding> <RandomizedBaseAddress>true</RandomizedBaseAddress> - <DataExecutionPrevention>true</DataExecutionPrevention> + <DataExecutionPrevention>false</DataExecutionPrevention> </Link> <Manifest> <AdditionalManifestFiles>$(ProjectDir)res/rt_manif.bin;%(AdditionalManifestFiles)</AdditionalManifestFiles> Modified: trunk/OpenMPT/mptrack/resource.h =================================================================== --- trunk/OpenMPT/mptrack/resource.h 2011-08-25 21:22:28 UTC (rev 1001) +++ trunk/OpenMPT/mptrack/resource.h 2011-08-31 17:51:46 UTC (rev 1002) @@ -1098,8 +1098,6 @@ #define ID_PLUGSELECT 35000 #define ID_VSTMACRO_INFO 36002 #define ID_VSTINPUT_INFO 36003 -#define ID_PLAYER_APPROXI 36004 -#define ID_Menu36005 36005 #define ID_APPROX_BPM 36007 #define ID_FACTORY_MENU 36008 #define ID_PLUG_BYPASS 36009 @@ -1131,68 +1129,73 @@ #define ID_PLUG_PASSKEYS 38001 #define ID_VIEW_SONGPROPERTIES 38002 #define ID_SEQUENCE_ITEM 38003 -#define ID_GROW_SELECTION 40001 -#define ID_SHRINK_SELECTION 40002 -#define ID_RUN_SCRIPT 40003 -#define ID_EXAMPLE_MODULES 40004 -#define ID_EXAMPLE_MODULES_LASTINRANGE 40053 -#define ID_FILE_OPENTEMPLATE 40054 -#define ID_FILE_OPENTEMPLATE_LASTINRANGE 40103 -#define ID_INDICATOR_TIME 40143 -#define ID_INDICATOR_USER 40144 -#define ID_INDICATOR_INFO 40145 -#define ID_FILE_SAVECOMPAT 40146 -#define ID_INDICATOR_XINFO 40147 -#define ID_PATTERN_ADDCHANNEL_FRONT 40148 -#define ID_PATTERN_ADDCHANNEL_AFTER 40149 -#define ID_PATTERN_REMOVECHANNEL 40150 -#define ID_PATTERN_REMOVECHANNELDIALOG 40151 -#define ID_NEW_MPT 40152 -#define ID_CLEANUP_PLUGS 40153 -#define ID_ENVELOPE_TOGGLERELEASENODE 40154 -#define ID_ENVELOPE_SCALEPOINTS 40155 -#define ID_VIEW_MIDIMAPPING 40156 -#define ID_PATTERN_DUPLICATECHANNEL 40216 -#define ID_EDIT_GOTO_MENU 40217 -#define ID_CLEANUP_COMPO 40218 -#define ID_SAMPLE_DRAW 40219 -#define ID_SAMPLE_ADDSILENCE 40220 -#define ID_OVERFLOWPASTE 40221 -#define ID_NOTEMAP_COPY_NOTE 40222 -#define ID_CLEANUP_REARRANGESAMPLES 40223 -#define ID_ORDERLIST_RENDER 40224 -#define ID_EDIT_CLEANUP 40225 -#define ID_ORDERLIST_EDIT_COPY 40226 -#define ID_ORDERLIST_EDIT_CUT 40227 -#define ID_ORDERLIST_EDIT_PASTE 40228 -#define ID_CHANNEL_RENAME 40229 -#define ID_EDIT_PASTEFLOOD 40230 -#define ID_MODTREE_DUPLICATE 40231 -#define ID_MODTREE_INSERT 40232 -#define ID_MODTREE_SWITCHTO 40233 -#define ID_EDIT_PUSHFORWARDPASTE 40234 -#define ID_EDIT_SPLITKEYBOARDSETTINGS 40235 -#define ID_EDIT_PASTESPECIAL 40236 -#define ID_CHANGE_PCNOTE_PARAM 40242 -#define ID_MODTREE_CLOSE 41243 -#define ID_SAMPLE_GENERATOR_MENU 41244 -#define ID_SAMPLE_GENERATOR_PRESET_MENU 41344 -#define ID_SAMPLE_GENERATE 41445 -#define ID_NOTEMAP_TRANS_UP 41446 -#define ID_NOTEMAP_TRANS_DOWN 41447 -#define ID_PATTERN_EDIT_PCNOTE_PLUGIN 41448 -#define ID_ENVELOPE_ZOOM_IN 41449 -#define ID_ENVELOPE_ZOOM_OUT 41450 -#define ID_PANIC 41451 -#define ID_VIEW_EDITHISTORY 41452 -#define ID_SAMPLE_GRID 41453 -#define ID_SAMPLE_QUICKFADE 41454 -#define ID_EDIT_MIXPASTE_ITSTYLE 41455 -#define ID_VIEW_MPTHACKS 41456 -#define ID_PLUGINTOINSTRUMENT 41457 -#define ID_INTERNETUPDATE 41458 -#define ID_HELP_EXAMPLEMODULES 41459 -#define ID_FILE_SAVEASTEMPLATE 41460 +// From here: Command range [ID_SEQUENCE_ITEM, ID_SEQUENCE_ITEM + MAX_SEQUENCES + 2] +#define ID_NOTEMAP_EDITSAMPLE 39000 +// From here: Command range [ID_NOTEMAP_EDITSAMPLE, ID_NOTEMAP_EDITSAMPLE + MAX_SAMPLES] +#define ID_GROW_SELECTION 43001 +#define ID_SHRINK_SELECTION 43002 +#define ID_RUN_SCRIPT 43003 +#define ID_EXAMPLE_MODULES 43004 +#define ID_EXAMPLE_MODULES_LASTINRANGE 43053 +#define ID_FILE_OPENTEMPLATE 43054 +#define ID_FILE_OPENTEMPLATE_LASTINRANGE 43103 +#define ID_INDICATOR_TIME 43143 +#define ID_INDICATOR_USER 43144 +#define ID_INDICATOR_INFO 43145 +#define ID_FILE_SAVECOMPAT 43146 +#define ID_INDICATOR_XINFO 43147 +#define ID_PATTERN_ADDCHANNEL_FRONT 43148 +#define ID_PATTERN_ADDCHANNEL_AFTER 43149 +#define ID_PATTERN_REMOVECHANNEL 43150 +#define ID_PATTERN_REMOVECHANNELDIALOG 43151 +#define ID_NEW_MPT 43152 +#define ID_CLEANUP_PLUGS 43153 +#define ID_ENVELOPE_TOGGLERELEASENODE 43154 +#define ID_ENVELOPE_SCALEPOINTS 43155 +#define ID_VIEW_MIDIMAPPING 43156 +#define ID_PATTERN_DUPLICATECHANNEL 43216 +#define ID_EDIT_GOTO_MENU 43217 +#define ID_CLEANUP_COMPO 43218 +#define ID_SAMPLE_DRAW 43219 +#define ID_SAMPLE_ADDSILENCE 43220 +#define ID_OVERFLOWPASTE 43221 +#define ID_NOTEMAP_COPY_NOTE 43222 +#define ID_CLEANUP_REARRANGESAMPLES 43223 +#define ID_ORDERLIST_RENDER 43224 +#define ID_EDIT_CLEANUP 43225 +#define ID_ORDERLIST_EDIT_COPY 43226 +#define ID_ORDERLIST_EDIT_CUT 43227 +#define ID_ORDERLIST_EDIT_PASTE 43228 +#define ID_CHANNEL_RENAME 43229 +#define ID_EDIT_PASTEFLOOD 43230 +#define ID_MODTREE_DUPLICATE 43231 +#define ID_MODTREE_INSERT 43232 +#define ID_MODTREE_SWITCHTO 43233 +#define ID_EDIT_PUSHFORWARDPASTE 43234 +#define ID_EDIT_SPLITKEYBOARDSETTINGS 43235 +#define ID_EDIT_PASTESPECIAL 43236 +#define ID_CHANGE_PCNOTE_PARAM 43242 +// From here: Command range [ID_CHANGE_PCNOTE_PARAM, ID_CHANGE_PCNOTE_PARAM + MODCOMMAND::maxColumnValue] +#define ID_MODTREE_CLOSE 44243 +#define ID_SAMPLE_GENERATOR_MENU 44244 +#define ID_SAMPLE_GENERATOR_PRESET_MENU 44344 +// From here: Command range [ID_SAMPLE_GENERATOR_PRESET_MENU, ID_SAMPLE_GENERATOR_PRESET_MENU + MAX_SAMPLEGEN_EXPRESSIONS - 1] +#define ID_SAMPLE_GENERATE 44445 +#define ID_NOTEMAP_TRANS_UP 44446 +#define ID_NOTEMAP_TRANS_DOWN 44447 +#define ID_PATTERN_EDIT_PCNOTE_PLUGIN 44448 +#define ID_ENVELOPE_ZOOM_IN 44449 +#define ID_ENVELOPE_ZOOM_OUT 44450 +#define ID_PANIC 44451 +#define ID_VIEW_EDITHISTORY 44452 +#define ID_SAMPLE_GRID 44453 +#define ID_SAMPLE_QUICKFADE 44454 +#define ID_EDIT_MIXPASTE_ITSTYLE 44455 +#define ID_VIEW_MPTHACKS 44456 +#define ID_PLUGINTOINSTRUMENT 44457 +#define ID_INTERNETUPDATE 44458 +#define ID_HELP_EXAMPLEMODULES 44459 +#define ID_FILE_SAVEASTEMPLATE 44460 // Next default values for new objects // @@ -1200,7 +1203,7 @@ #ifndef APSTUDIO_READONLY_SYMBOLS #define _APS_3D_CONTROLS 1 #define _APS_NEXT_RESOURCE_VALUE 531 -#define _APS_NEXT_COMMAND_VALUE 40461 +#define _APS_NEXT_COMMAND_VALUE 44461 #define _APS_NEXT_CONTROL_VALUE 2436 #define _APS_NEXT_SYMED_VALUE 901 #endif This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <sag...@us...> - 2011-09-01 19:03:16
|
Revision: 1005 http://modplug.svn.sourceforge.net/modplug/?rev=1005&view=rev Author: saga-games Date: 2011-09-01 19:03:09 +0000 (Thu, 01 Sep 2011) Log Message: ----------- [Imp] Named DMO parameter values are now displayed properly. [Mod] OpenMPT: Version is now 1.20.00.15 Modified Paths: -------------- trunk/OpenMPT/mptrack/Vstplug.cpp trunk/OpenMPT/mptrack/version.h Modified: trunk/OpenMPT/mptrack/Vstplug.cpp =================================================================== --- trunk/OpenMPT/mptrack/Vstplug.cpp 2011-09-01 17:57:33 UTC (rev 1004) +++ trunk/OpenMPT/mptrack/Vstplug.cpp 2011-09-01 19:03:09 UTC (rev 1005) @@ -473,7 +473,7 @@ BOOL CVstPluginManager::CreateMixPlugin(PSNDMIXPLUGIN pMixPlugin, CSoundFile* pSndFile) //------------------------------------------------------------------------------------- { - UINT nMatch=0; + UINT nMatch = 0; PVSTPLUGINLIB pFound = NULL; if (pMixPlugin) @@ -850,12 +850,9 @@ if (pSndFile) { return (VstInt32)(pSndFile->GetCurrentBPM() * 10000); - } else - { - return (VstInt32)(125 * 10000); } } - return 125 * 10000; + return (VstInt32)(125 * 10000); // parameters - DEPRECATED in VST 2.4 case audioMasterGetNumAutomatableParameters: Log("VST plugin to host: Get Num Automatable Parameters\n"); @@ -1212,7 +1209,7 @@ LPITEMIDLIST pid = SHBrowseForFolder(&bi); if(pid != NULL && SHGetPathFromIDList(pid, szBuffer)) { - if(!memcmp(&(effect->uniqueID), "rTSV", 4) && pFileSel->returnPath != nullptr && pFileSel->sizeReturnPath == 0) + if(CCONST('V', 'S', 'T', 'r') == effect->uniqueID && pFileSel->returnPath != nullptr && pFileSel->sizeReturnPath == 0) { // old versions of reViSiT (which still relied on the host's file selection code) seem to be dodgy. // They report a path size of 0, but when using an own buffer, they will crash. @@ -1342,7 +1339,7 @@ m_bModified = false; m_dwTimeAtStartOfProcess=0; m_nSampleRate = nInvalidSampleRate; //rewbs.VSTCompliance: gets set on Resume() - memset(m_MidiCh, 0, sizeof(m_MidiCh)); + MemsetZero(m_MidiCh); for (int ch=0; ch<16; ch++) { m_nMidiPitchBendPos[ch]=MIDI_PitchBend_Centre; //centre pitch bend on all channels @@ -1368,7 +1365,7 @@ m_bRecordAutomation=false; m_bPassKeypressesToPlug=false; - memset(m_MidiCh, 0, sizeof(m_MidiCh)); + MemsetZero(m_MidiCh); //rewbs.VSTcompliance //Store a pointer so we can get the CVstPlugin object from the basic VST effect object. @@ -2060,7 +2057,8 @@ if (m_bIsInstrument) { mixop = 0; //force normal mix mode for instruments - } else { + } else + { mixop = m_pMixStruct ? (m_pMixStruct->Info.dwInputRouting>>8) & 0xff : 0; } @@ -2542,7 +2540,7 @@ bool progChanged = (pCh->nProgram != --nMidiProg) && (nMidiProg < 0x80); //bool chanChanged = nCh != m_nPreviousMidiChan; //get vol in [0,128[ - vol = min(vol/2, 127); + vol = min(vol / 2, 127); // Note: Some VSTis update bank/prog on midi channel change, others don't. // For those that don't, we do it for them. @@ -3525,7 +3523,7 @@ m_pMediaProcess = pMOIP; m_pParamInfo = NULL; m_pMediaParams = NULL; - memset(&m_Effect, 0, sizeof(m_Effect)); + MemsetZero(m_Effect); m_Effect.magic = kDmoMagic; m_Effect.numPrograms = 0; m_Effect.numParams = 0; @@ -3671,10 +3669,26 @@ wsprintf(pszName, (bNeg) ? "-%d.%02d" : "%d.%02d", nValue/100, nValue%100); } break; + case MPT_BOOL: strcpy(pszName, ((int)md) ? "Yes" : "No"); break; - // TODO: case MPT_ENUM: -> GetParamText + + case MPT_ENUM: + { + WCHAR *text = nullptr; + m_pParamInfo->GetParamText(index, &text); + + const int nValue = (int)(md * (mpi.mpdMaxValue - mpi.mpdMinValue) + 0.5f); + // Always skip first two strings (param name, unit name) + for(int i = 0; i < nValue + 2; i++) + { + text += wcslen(text) + 1; + } + WideCharToMultiByte(CP_ACP, 0, text, -1, pszName, 32, NULL, NULL); + } + break; + default: wsprintf(pszName, "%d", (int)md); break; Modified: trunk/OpenMPT/mptrack/version.h =================================================================== --- trunk/OpenMPT/mptrack/version.h 2011-09-01 17:57:33 UTC (rev 1004) +++ trunk/OpenMPT/mptrack/version.h 2011-09-01 19:03:09 UTC (rev 1005) @@ -15,7 +15,7 @@ #define VER_MAJORMAJOR 1 #define VER_MAJOR 20 #define VER_MINOR 00 -#define VER_MINORMINOR 14 +#define VER_MINORMINOR 15 //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-09-02 15:00:29
|
Revision: 1007 http://modplug.svn.sourceforge.net/modplug/?rev=1007&view=rev Author: saga-games Date: 2011-09-02 15:00:22 +0000 (Fri, 02 Sep 2011) Log Message: ----------- [Ref] EQ refactoring Modified Paths: -------------- trunk/OpenMPT/mptrack/Mainfrm.h trunk/OpenMPT/mptrack/Mpdlgs.cpp trunk/OpenMPT/mptrack/Mpdlgs.h trunk/OpenMPT/mptrack/TrackerSettings.cpp trunk/OpenMPT/mptrack/TrackerSettings.h trunk/OpenMPT/mptrack/misc_util.h trunk/OpenMPT/mptrack/resource.h Modified: trunk/OpenMPT/mptrack/Mainfrm.h =================================================================== --- trunk/OpenMPT/mptrack/Mainfrm.h 2011-09-02 14:55:32 UTC (rev 1006) +++ trunk/OpenMPT/mptrack/Mainfrm.h 2011-09-02 15:00:22 UTC (rev 1007) @@ -366,12 +366,12 @@ ///////////////////////////////////////////////////////////////////////// // EQ Presets -typedef struct _EQPRESET +struct EQPRESET { CHAR szName[12]; UINT Gains[MAX_EQ_BANDS]; UINT Freqs[MAX_EQ_BANDS]; -} EQPRESET, *PEQPRESET; +}; ///////////////////////////////////////////////////////////////////////// Modified: trunk/OpenMPT/mptrack/Mpdlgs.cpp =================================================================== --- trunk/OpenMPT/mptrack/Mpdlgs.cpp 2011-09-02 14:55:32 UTC (rev 1006) +++ trunk/OpenMPT/mptrack/Mpdlgs.cpp 2011-09-02 15:00:22 UTC (rev 1007) @@ -397,7 +397,7 @@ // Polyphony { int nmmx = m_CbnPolyphony.GetCurSel(); - if ((nmmx >= 0) && (nmmx < sizeof(nCPUMix)/sizeof(nCPUMix[0]))) CSoundFile::m_nMaxMixChannels = nCPUMix[nmmx]; + if ((nmmx >= 0) && (nmmx < CountOf(nCPUMix))) CSoundFile::m_nMaxMixChannels = nCPUMix[nmmx]; } // Sound Device { @@ -691,30 +691,20 @@ // EQ Globals // -enum { - EQPRESET_FLAT=0, - EQPRESET_JAZZ, - EQPRESET_POP, - EQPRESET_ROCK, - EQPRESET_CONCERT, - EQPRESET_CLEAR, -}; - - #define EQ_MAX_FREQS 5 -const UINT gEqBandFreqs[EQ_MAX_FREQS*MAX_EQ_BANDS] = +const UINT gEqBandFreqs[MAX_EQ_BANDS][EQ_MAX_FREQS] = { - 100, 125, 150, 200, 250, - 300, 350, 400, 450, 500, - 600, 700, 800, 900, 1000, - 1250, 1500, 1750, 2000, 2500, - 3000, 3500, 4000, 4500, 5000, - 6000, 7000, 8000, 9000, 10000 + { 100, 125, 150, 200, 250 }, + { 300, 350, 400, 450, 500 }, + { 600, 700, 800, 900, 1000 }, + { 1250, 1500, 1750, 2000, 2500 }, + { 3000, 3500, 4000, 4500, 5000 }, + { 6000, 7000, 8000, 9000, 10000 }, }; -const EQPRESET gEQPresets[6] = +const EQPRESET CEQSetupDlg::gEQPresets[] = { { "Flat", {16,16,16,16,16,16}, { 125, 300, 600, 1250, 4000, 8000 } }, // Flat { "Jazz", {16,16,24,20,20,14}, { 125, 300, 600, 1250, 4000, 8000 } }, // Jazz @@ -725,19 +715,15 @@ }; -EQPRESET CEQSetupDlg::gUserPresets[4] = +EQPRESET CEQSetupDlg::gUserPresets[] = { - { "User1", {16,16,16,16,16,16}, { 125, 300, 600, 1250, 4000, 8000 } }, // User1 - { "User2", {16,16,16,16,16,16}, { 125, 300, 600, 1250, 4000, 8000 } }, // User2 - { "User3", {16,16,16,16,16,16}, { 125, 300, 600, 1250, 4000, 8000 } }, // User3 + { "User1", {16,16,16,16,16,16}, { 125, 300, 600, 1250, 4000, 8000 } }, // User1 + { "User2", {16,16,16,16,16,16}, { 125, 300, 600, 1250, 4000, 8000 } }, // User2 + { "User3", {16,16,16,16,16,16}, { 125, 300, 600, 1250, 4000, 8000 } }, // User3 { "User4", {16,16,16,16,16,16}, { 150, 500, 1000, 2500, 5000, 10000 } } // User4 }; -#define ID_EQSLIDER_BASE 41000 -#define ID_EQMENU_BASE 41100 - - //////////////////////////////////////////////////////////////////////////////// // // CEQSavePresetDlg @@ -748,10 +734,10 @@ //==================================== { protected: - PEQPRESET m_pEq; + EQPRESET *m_pEq; public: - CEQSavePresetDlg(PEQPRESET pEq, CWnd *parent=NULL):CDialog(IDD_SAVEPRESET, parent) { m_pEq = pEq; } + CEQSavePresetDlg(EQPRESET *pEq, CWnd *parent=NULL):CDialog(IDD_SAVEPRESET, parent) { m_pEq = pEq; } BOOL OnInitDialog(); VOID OnOK(); }; @@ -798,28 +784,7 @@ // CEQSetupDlg // -VOID CEQSetupDlg::LoadEQ(HKEY key, LPCSTR pszName, PEQPRESET pEqSettings) -//----------------------------------------------------------------------- -{ - DWORD dwType = REG_BINARY; - DWORD dwSize = sizeof(EQPRESET); - RegQueryValueEx(key, pszName, NULL, &dwType, (LPBYTE)pEqSettings, &dwSize); - for (UINT i=0; i<MAX_EQ_BANDS; i++) - { - if (pEqSettings->Gains[i] > 32) pEqSettings->Gains[i] = 16; - if ((pEqSettings->Freqs[i] < 100) || (pEqSettings->Freqs[i] > 10000)) pEqSettings->Freqs[i] = gEQPresets[0].Freqs[i]; - } - pEqSettings->szName[sizeof(pEqSettings->szName)-1] = 0; -} - -VOID CEQSetupDlg::SaveEQ(HKEY key, LPCSTR pszName, PEQPRESET pEqSettings) -//----------------------------------------------------------------------- -{ - RegSetValueEx(key, pszName, NULL, REG_BINARY, (LPBYTE)pEqSettings, sizeof(EQPRESET)); -} - - VOID CEQSlider::Init(UINT nID, UINT n, CWnd *parent) //-------------------------------------------------- { @@ -944,96 +909,15 @@ } -void CEQSetupDlg::OnEqFlat() -//-------------------------- +void CEQSetupDlg::LoadEQPreset(const EQPRESET &preset) +//---------------------------------------------------- { - *m_pEqPreset = gEQPresets[EQPRESET_FLAT]; + *m_pEqPreset = preset; UpdateEQ(TRUE); UpdateDialog(); } -void CEQSetupDlg::OnEqJazz() -//-------------------------- -{ - *m_pEqPreset = gEQPresets[EQPRESET_JAZZ]; - UpdateEQ(TRUE); - UpdateDialog(); -} - - -void CEQSetupDlg::OnEqPop() -//------------------------- -{ - *m_pEqPreset = gEQPresets[EQPRESET_POP]; - UpdateEQ(TRUE); - UpdateDialog(); -} - - -void CEQSetupDlg::OnEqRock() -//-------------------------- -{ - *m_pEqPreset = gEQPresets[EQPRESET_ROCK]; - UpdateEQ(TRUE); - UpdateDialog(); -} - - -void CEQSetupDlg::OnEqConcert() -//----------------------------- -{ - *m_pEqPreset = gEQPresets[EQPRESET_CONCERT]; - UpdateEQ(TRUE); - UpdateDialog(); -} - - -void CEQSetupDlg::OnEqClear() -//--------------------------- -{ - *m_pEqPreset = gEQPresets[EQPRESET_CLEAR]; - UpdateEQ(TRUE); - UpdateDialog(); -} - - -void CEQSetupDlg::OnEqUser1() -//--------------------------- -{ - *m_pEqPreset = gUserPresets[0]; - UpdateEQ(TRUE); - UpdateDialog(); -} - - -void CEQSetupDlg::OnEqUser2() -//--------------------------- -{ - *m_pEqPreset = gUserPresets[1]; - UpdateEQ(TRUE); - UpdateDialog(); -} - - -void CEQSetupDlg::OnEqUser3() -//--------------------------- -{ - *m_pEqPreset = gUserPresets[2]; - UpdateEQ(TRUE); - UpdateDialog(); -} - - -void CEQSetupDlg::OnEqUser4() -//--------------------------- -{ - *m_pEqPreset = gUserPresets[3]; - UpdateEQ(TRUE); - UpdateDialog(); -} - - void CEQSetupDlg::OnSavePreset() //------------------------------ { @@ -1055,8 +939,8 @@ HMENU hMenu = ::CreatePopupMenu(); m_nSliderMenu = n; if (!hMenu) return; - const UINT *pFreqs = &gEqBandFreqs[m_nSliderMenu*EQ_MAX_FREQS]; - for (UINT i=0; i<EQ_MAX_FREQS; i++) + const UINT *pFreqs = gEqBandFreqs[m_nSliderMenu]; + for (UINT i = 0; i < EQ_MAX_FREQS; i++) { DWORD d = MF_STRING; if (m_pEqPreset->Freqs[m_nSliderMenu] == pFreqs[i]) d |= MF_CHECKED; @@ -1077,7 +961,7 @@ UINT n = nID - ID_EQMENU_BASE; if ((m_nSliderMenu < MAX_EQ_BANDS) && (n < EQ_MAX_FREQS)) { - UINT f = gEqBandFreqs[m_nSliderMenu*EQ_MAX_FREQS+n]; + UINT f = gEqBandFreqs[m_nSliderMenu][n]; if (f != m_pEqPreset->Freqs[m_nSliderMenu]) { m_pEqPreset->Freqs[m_nSliderMenu] = f; Modified: trunk/OpenMPT/mptrack/Mpdlgs.h =================================================================== --- trunk/OpenMPT/mptrack/Mpdlgs.h 2011-09-02 14:55:32 UTC (rev 1006) +++ trunk/OpenMPT/mptrack/Mpdlgs.h 2011-09-02 15:00:22 UTC (rev 1007) @@ -95,38 +95,52 @@ { protected: CEQSlider m_Sliders[MAX_EQ_BANDS]; - PEQPRESET m_pEqPreset; + EQPRESET *m_pEqPreset; UINT m_nSliderMenu; public: - CEQSetupDlg(PEQPRESET pEq):CPropertyPage(IDD_SETUP_EQ) { m_pEqPreset = pEq; } + CEQSetupDlg(EQPRESET *pEq):CPropertyPage(IDD_SETUP_EQ) { m_pEqPreset = pEq; } void UpdateDialog(); void UpdateEQ(BOOL bReset); public: - static EQPRESET gUserPresets[4]; - static VOID LoadEQ(HKEY key, LPCSTR pszName, PEQPRESET pEqSettings); - static VOID SaveEQ(HKEY key, LPCSTR pszName, PEQPRESET pEqSettings); + static const EQPRESET gEQPresets[]; + static EQPRESET gUserPresets[]; protected: virtual BOOL OnInitDialog(); virtual BOOL OnSetActive(); afx_msg void OnSettingsChanged() { SetModified(TRUE); } afx_msg void OnVScroll(UINT nSBCode, UINT nPos, CScrollBar* pScrollBar); - afx_msg void OnEqFlat(); - afx_msg void OnEqJazz(); - afx_msg void OnEqPop(); - afx_msg void OnEqRock(); - afx_msg void OnEqConcert(); - afx_msg void OnEqClear(); - afx_msg void OnEqUser1(); - afx_msg void OnEqUser2(); - afx_msg void OnEqUser3(); - afx_msg void OnEqUser4(); + + enum + { + EQPRESET_FLAT = 0, + EQPRESET_JAZZ, + EQPRESET_POP, + EQPRESET_ROCK, + EQPRESET_CONCERT, + EQPRESET_CLEAR, + }; + + afx_msg void OnEqFlat() { LoadEQPreset(gEQPresets[EQPRESET_FLAT]); }; + afx_msg void OnEqJazz() { LoadEQPreset(gEQPresets[EQPRESET_JAZZ]); }; + afx_msg void OnEqPop() { LoadEQPreset(gEQPresets[EQPRESET_POP]); }; + afx_msg void OnEqRock() { LoadEQPreset(gEQPresets[EQPRESET_ROCK]); }; + afx_msg void OnEqConcert() { LoadEQPreset(gEQPresets[EQPRESET_CONCERT]); }; + afx_msg void OnEqClear() { LoadEQPreset(gEQPresets[EQPRESET_CLEAR]); }; + + afx_msg void OnEqUser1() { LoadEQPreset(gUserPresets[0]); }; + afx_msg void OnEqUser2() { LoadEQPreset(gUserPresets[1]); }; + afx_msg void OnEqUser3() { LoadEQPreset(gUserPresets[2]); }; + afx_msg void OnEqUser4() { LoadEQPreset(gUserPresets[3]); }; + afx_msg void OnSavePreset(); afx_msg void OnSliderMenu(UINT); afx_msg void OnSliderFreq(UINT); DECLARE_MESSAGE_MAP() + + void LoadEQPreset(const EQPRESET &preset); }; Modified: trunk/OpenMPT/mptrack/TrackerSettings.cpp =================================================================== --- trunk/OpenMPT/mptrack/TrackerSettings.cpp 2011-09-02 14:55:32 UTC (rev 1006) +++ trunk/OpenMPT/mptrack/TrackerSettings.cpp 2011-09-02 15:00:22 UTC (rev 1007) @@ -21,6 +21,7 @@ #include "AutoSaver.h" #include "../soundlib/StringFixer.h" #include "TrackerSettings.h" +#include "misc_util.h" const TCHAR *TrackerSettings::m_szDirectoryToSettingsName[NUM_DIRS] = { _T("Songs_Directory"), _T("Samples_Directory"), _T("Instruments_Directory"), _T("Plugins_Directory"), _T("Plugin_Presets_Directory"), _T("Export_Directory"), _T(""), _T("") }; @@ -71,17 +72,7 @@ m_nBufferLength = 50; // Default EQ settings - strcpy(m_EqSettings.szName, ""); - for(size_t i = 0; i < CountOf(m_EqSettings.Gains); i++) - { - m_EqSettings.Gains[i] = 16; - } - m_EqSettings.Freqs[0] = 125; - m_EqSettings.Freqs[1] = 300; - m_EqSettings.Freqs[2] = 600; - m_EqSettings.Freqs[3] = 1250; - m_EqSettings.Freqs[4] = 4000; - m_EqSettings.Freqs[5] = 8000; + MemCopy(m_EqSettings, CEQSetupDlg::gEQPresets[0]); // MIDI Setup m_dwMidiSetup = MIDISETUP_RECORDVELOCITY|MIDISETUP_RECORDNOTEOFF; @@ -100,7 +91,6 @@ m_nSampleUndoMaxBuffer = 0; // Real sample buffer undo size will be set later. - // TODO duplicate code (see Moptions.cpp) GetDefaultColourScheme(rgbCustomColors); // Directory Arrays (Default + Last) @@ -457,6 +447,21 @@ #define SETTINGS_REGEXT_WINDOW "\\Window" #define SETTINGS_REGEXT_SETTINGS "\\Settings" +void TrackerSettings::LoadRegistryEQ(HKEY key, LPCSTR pszName, EQPRESET *pEqSettings) +//----------------------------------------------------------------------------------- +{ + DWORD dwType = REG_BINARY; + DWORD dwSize = sizeof(EQPRESET); + RegQueryValueEx(key, pszName, NULL, &dwType, (LPBYTE)pEqSettings, &dwSize); + for (UINT i=0; i<MAX_EQ_BANDS; i++) + { + if (pEqSettings->Gains[i] > 32) pEqSettings->Gains[i] = 16; + if ((pEqSettings->Freqs[i] < 100) || (pEqSettings->Freqs[i] > 10000)) pEqSettings->Freqs[i] = CEQSetupDlg::gEQPresets[0].Freqs[i]; + } + pEqSettings->szName[sizeof(pEqSettings->szName)-1] = 0; +} + + bool TrackerSettings::LoadRegistrySettings() //------------------------------------------ { @@ -556,11 +561,11 @@ RegQueryValueEx(key, "MidiImportSpeed", NULL, &dwREG_DWORD, (LPBYTE)&midiImportSpeed, &dwDWORDSize); RegQueryValueEx(key, "MidiImportPatLen", NULL, &dwREG_DWORD, (LPBYTE)&midiImportPatternLen, &dwDWORDSize); // EQ - CEQSetupDlg::LoadEQ(key, "EQ_Settings", &m_EqSettings); - CEQSetupDlg::LoadEQ(key, "EQ_User1", &CEQSetupDlg::gUserPresets[0]); - CEQSetupDlg::LoadEQ(key, "EQ_User2", &CEQSetupDlg::gUserPresets[1]); - CEQSetupDlg::LoadEQ(key, "EQ_User3", &CEQSetupDlg::gUserPresets[2]); - CEQSetupDlg::LoadEQ(key, "EQ_User4", &CEQSetupDlg::gUserPresets[3]); + LoadRegistryEQ(key, "EQ_Settings", &m_EqSettings); + LoadRegistryEQ(key, "EQ_User1", &CEQSetupDlg::gUserPresets[0]); + LoadRegistryEQ(key, "EQ_User2", &CEQSetupDlg::gUserPresets[1]); + LoadRegistryEQ(key, "EQ_User3", &CEQSetupDlg::gUserPresets[2]); + LoadRegistryEQ(key, "EQ_User4", &CEQSetupDlg::gUserPresets[3]); //rewbs.resamplerConf dwDWORDSize = sizeof(gbWFIRType); Modified: trunk/OpenMPT/mptrack/TrackerSettings.h =================================================================== --- trunk/OpenMPT/mptrack/TrackerSettings.h 2011-09-02 14:55:32 UTC (rev 1006) +++ trunk/OpenMPT/mptrack/TrackerSettings.h 2011-09-02 15:00:22 UTC (rev 1007) @@ -109,6 +109,8 @@ protected: void LoadINISettings(const CString &iniFile); + + void LoadRegistryEQ(HKEY key, LPCSTR pszName, EQPRESET *pEqSettings); bool LoadRegistrySettings(); void SetDirectory(const LPCTSTR szFilenameFrom, Directory dir, TCHAR (&pDirs)[NUM_DIRS][_MAX_PATH], bool bStripFilename); Modified: trunk/OpenMPT/mptrack/misc_util.h =================================================================== --- trunk/OpenMPT/mptrack/misc_util.h 2011-09-02 14:55:32 UTC (rev 1006) +++ trunk/OpenMPT/mptrack/misc_util.h 2011-09-02 15:00:22 UTC (rev 1007) @@ -65,7 +65,18 @@ memcpy(&destination, &source, sizeof(T)); } +template <class T> +inline void MemCopy(T &destination, const T &source) +//-------------------------------------------------- +{ +#if _HAS_TR1 + static_assert(std::tr1::is_pointer<T>::value == false, "Won't copy pointers."); + static_assert(std::tr1::is_pod<T>::value == true, "Won't copy non-pods."); +#endif + memcpy(&destination, &source, sizeof(T)); +} + // Limits 'val' to given range. If 'val' is less than 'lowerLimit', 'val' is set to value 'lowerLimit'. // Similarly if 'val' is greater than 'upperLimit', 'val' is set to value 'upperLimit'. // If 'lowerLimit' > 'upperLimit', 'val' won't be modified. Modified: trunk/OpenMPT/mptrack/resource.h =================================================================== --- trunk/OpenMPT/mptrack/resource.h 2011-09-02 14:55:32 UTC (rev 1006) +++ trunk/OpenMPT/mptrack/resource.h 2011-09-02 15:00:22 UTC (rev 1007) @@ -1081,6 +1081,10 @@ #define ID_PRESET_LIST 32919 #define ID_INFO 32920 #define ID_VIEWPLUGNAMES 32921 +#define ID_EQSLIDER_BASE 32922 +// From here: Command range [ID_EQSLIDER_BASE, ID_EQSLIDER_BASE + MAX_EQ_BANDS] +#define ID_EQMENU_BASE 32950 +// From here: Command range [ID_EQMENU_BASE, ID_EQMENU_BASE + EQ_MAX_FREQS] #define ID_EDIT_SPLITRECSELECT 33900 #define ID_REARRANGE_SAMPLES 33901 #define ID_CHANNEL_MANAGER 33905 @@ -1095,7 +1099,9 @@ #define ID_MODTREE_SAVEITEM 33917 #define ID_PLUGIN_SETUP 33918 #define ID_PRESET_SET 33920 +// From here: Command range [ID_PRESET_SET, ID_PRESET_SET + MAX_PLUGPRESETS] #define ID_PLUGSELECT 35000 +// From here: Command range [ID_PLUGSELECT, ID_PLUGSELECT + MAX_MIXPLUGINS] #define ID_VSTMACRO_INFO 36002 #define ID_VSTINPUT_INFO 36003 #define ID_APPROX_BPM 36007 @@ -1122,9 +1128,11 @@ #define ID_VSTPRESETBACKWARDJUMP 36031 #define ID_VSTPRESETFORWARDJUMP 36032 #define ID_SELECTINST 36100 +// From here: Command range [ID_SELECTINST, ID_SELECTINST + MAX_INSTRUMENTS] #define ID_PLUG_RECORDAUTOMATION 37003 #define ID_LEARN_MACRO_FROM_PLUGGUI 37004 #define ID_CHANGE_INSTRUMENT 37020 +// From here: Command range [ID_CHANGE_INSTRUMENT, ID_CHANGE_INSTRUMENT + MAX_INSTRUMENTS] #define ID_CLEAR_SELECTION 38000 #define ID_PLUG_PASSKEYS 38001 #define ID_VIEW_SONGPROPERTIES 38002 This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <sag...@us...> - 2011-09-04 19:12:14
|
Revision: 1021 http://modplug.svn.sourceforge.net/modplug/?rev=1021&view=rev Author: saga-games Date: 2011-09-04 19:12:08 +0000 (Sun, 04 Sep 2011) Log Message: ----------- [Fix] Mod Conversion: Various instrument properties were not cleared when converting to XM; Sample sustain loops were also not removed. [Mod] OpenMPT: Version is now 1.20.00.18 Modified Paths: -------------- trunk/OpenMPT/mptrack/ModConvert.cpp trunk/OpenMPT/mptrack/version.h Modified: trunk/OpenMPT/mptrack/ModConvert.cpp =================================================================== --- trunk/OpenMPT/mptrack/ModConvert.cpp 2011-09-04 19:02:27 UTC (rev 1020) +++ trunk/OpenMPT/mptrack/ModConvert.cpp 2011-09-04 19:12:08 UTC (rev 1021) @@ -266,7 +266,7 @@ CHANGEMODTYPE_WARNING(wMOD31Samples); } - // No Bidi / Sustain loops / Autovibrato for MOD/S3M + // No Bidi and Autovibrato for MOD/S3M if(newTypeIsMOD || newTypeIsS3M) { // Bidi loops @@ -276,6 +276,17 @@ CHANGEMODTYPE_WARNING(wSampleBidiLoops); } + // Autovibrato + if(sample.nVibDepth || sample.nVibRate || sample.nVibSweep) + { + sample.nVibDepth = sample.nVibRate = sample.nVibSweep = sample.nVibType = 0; + CHANGEMODTYPE_WARNING(wSampleAutoVibrato); + } + } + + // No sustain loops for MOD/S3M/XM + if(newTypeIsMOD_XM || newTypeIsS3M) + { // Sustain loops - convert to normal loops if((sample.uFlags & CHN_SUSTAINLOOP) != 0) { @@ -287,13 +298,6 @@ } sample.nSustainStart = sample.nSustainEnd = 0; sample.uFlags &= ~(CHN_SUSTAINLOOP|CHN_PINGPONGSUSTAIN); - - // Autovibrato - if(sample.nVibDepth || sample.nVibRate || sample.nVibSweep) - { - sample.nVibDepth = sample.nVibRate = sample.nVibSweep = sample.nVibType = 0; - CHANGEMODTYPE_WARNING(wSampleAutoVibrato); - } } // Transpose to Frequency (MOD/XM to S3M/IT/MPT) @@ -378,6 +382,17 @@ pIns->dwFlags &= ~INS_SETPANNING; pIns->nIFC &= 0x7F; pIns->nIFR &= 0x7F; + pIns->nFilterMode = FLTMODE_UNCHANGED; + + pIns->nCutSwing = pIns->nPanSwing = pIns->nResSwing = pIns->nVolSwing = 0; + + pIns->wPitchToTempoLock = 0; + + pIns->nPPC = NOTE_MIDDLEC - 1; + pIns->nPPS = 0; + + pIns->nGlobalVol = 64; + pIns->nPan = 128; } } // Convert MPT to anything - remove instrument tunings Modified: trunk/OpenMPT/mptrack/version.h =================================================================== --- trunk/OpenMPT/mptrack/version.h 2011-09-04 19:02:27 UTC (rev 1020) +++ trunk/OpenMPT/mptrack/version.h 2011-09-04 19:12:08 UTC (rev 1021) @@ -15,7 +15,7 @@ #define VER_MAJORMAJOR 1 #define VER_MAJOR 20 #define VER_MINOR 00 -#define VER_MINORMINOR 17 +#define VER_MINORMINOR 18 //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-09-06 12:23:30
|
Revision: 1024 http://modplug.svn.sourceforge.net/modplug/?rev=1024&view=rev Author: saga-games Date: 2011-09-06 12:23:23 +0000 (Tue, 06 Sep 2011) Log Message: ----------- [Imp] Added a try...catch block to module rescue code in unhandled exception filter, to prevent crashes in a crash (yo dawg) [Fix] Add instrument confirmation in VST editor was broken since a few revisions ago. Modified Paths: -------------- trunk/OpenMPT/mptrack/AbstractVstEditor.cpp trunk/OpenMPT/mptrack/ExceptionHandler.cpp Modified: trunk/OpenMPT/mptrack/AbstractVstEditor.cpp =================================================================== --- trunk/OpenMPT/mptrack/AbstractVstEditor.cpp 2011-09-05 14:39:30 UTC (rev 1023) +++ trunk/OpenMPT/mptrack/AbstractVstEditor.cpp 2011-09-06 12:23:23 UTC (rev 1024) @@ -355,7 +355,7 @@ return false; if(!m_pVstPlugin->isInstrument() || pModDoc->GetSoundFile()->GetModSpecifications().instrumentsMax == 0 || - Reporting::Confirm(_T("You need to assign an instrument to this plugin before you can play notes from here.\nCreate a new instrument and assign this plugin to the instrument?"), false, false, this) == cnfYes) + Reporting::Confirm(_T("You need to assign an instrument to this plugin before you can play notes from here.\nCreate a new instrument and assign this plugin to the instrument?"), false, false, this) == cnfNo) { return false; } else Modified: trunk/OpenMPT/mptrack/ExceptionHandler.cpp =================================================================== --- trunk/OpenMPT/mptrack/ExceptionHandler.cpp 2011-09-05 14:39:30 UTC (rev 1023) +++ trunk/OpenMPT/mptrack/ExceptionHandler.cpp 2011-09-06 12:23:23 UTC (rev 1024) @@ -126,7 +126,14 @@ } CString filename; filename.Format("%s%d_%s.%s", baseRescuePath, ++numFiles, pModDoc->GetTitle(), pModDoc->GetSoundFile()->GetModSpecifications().fileExtension); - pModDoc->OnSaveDocument(filename); + + try + { + pModDoc->OnSaveDocument(filename); + } catch(...) + { + continue; + } } } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <sag...@us...> - 2011-09-09 13:22:24
|
Revision: 1030 http://modplug.svn.sourceforge.net/modplug/?rev=1030&view=rev Author: saga-games Date: 2011-09-09 13:22:13 +0000 (Fri, 09 Sep 2011) Log Message: ----------- [Fix] Instruments should now fade out properly in the pattern and instrument editor when editing an XM module. [Fix] Channel mute status was not updated properly when undoing channel movement. Modified Paths: -------------- trunk/OpenMPT/mptrack/Moddoc.cpp trunk/OpenMPT/mptrack/Moddoc.h trunk/OpenMPT/mptrack/Undo.cpp Modified: trunk/OpenMPT/mptrack/Moddoc.cpp =================================================================== --- trunk/OpenMPT/mptrack/Moddoc.cpp 2011-09-08 20:15:53 UTC (rev 1029) +++ trunk/OpenMPT/mptrack/Moddoc.cpp 2011-09-09 13:22:13 UTC (rev 1030) @@ -932,6 +932,7 @@ { m_SndFile.ResetChannelEnvelopes(pChn); m_SndFile.InstrumentChange(pChn, nins); + pChn->nFadeOutVol = 0x10000; // Needed for XM files, as the nRowInstr check in NoteChange() will fail. } else if ((nsmp) && (nsmp < MAX_SAMPLES)) // Or set sample { @@ -1063,10 +1064,10 @@ } //end rewbs.vstiLive + const DWORD mask = (bFade) ? CHN_NOTEFADE : (CHN_NOTEFADE|CHN_KEYOFF); MODCHANNEL *pChn = &m_SndFile.Chn[m_SndFile.m_nChannels]; for (UINT i=m_SndFile.m_nChannels; i<MAX_CHANNELS; i++, pChn++) if (!pChn->nMasterChn) { - DWORD mask = (bFade) ? CHN_NOTEFADE : (CHN_NOTEFADE|CHN_KEYOFF); // Fade all channels > m_nChannels which are playing this note. // Could conflict with NNAs. @@ -1103,14 +1104,12 @@ bool CModDoc::MuteChannel(CHANNELINDEX nChn, bool doMute) //------------------------------------------------------- { - DWORD muteType = (CMainFrame::GetSettings().m_dwPatternSetup&PATTERN_SYNCMUTE)? CHN_SYNCMUTE:CHN_MUTE; - - if (nChn >= m_SndFile.m_nChannels) + if (nChn >= m_SndFile.GetNumChannels()) { return false; } - //Mark channel as muted in channel settings + // Mark channel as muted in channel settings if (doMute) { m_SndFile.ChnSettings[nChn].dwFlags |= CHN_MUTE; @@ -1118,12 +1117,38 @@ { m_SndFile.ChnSettings[nChn].dwFlags &= ~CHN_MUTE; } - - //Mute pattern channel + + const bool success = UpdateChannelMuteStatus(nChn); + if(success) + { + //Mark IT/MPTM/S3M as modified + if (m_SndFile.GetType() & (MOD_TYPE_IT | MOD_TYPE_MPT | MOD_TYPE_S3M)) + { + CMainFrame::GetMainFrame()->ThreadSafeSetModified(this); + } + } + + return success; +} + + +bool CModDoc::UpdateChannelMuteStatus(CHANNELINDEX nChn) +//------------------------------------------------------ +{ + const DWORD muteType = (CMainFrame::GetSettings().m_dwPatternSetup & PATTERN_SYNCMUTE) ? CHN_SYNCMUTE : CHN_MUTE; + + if (nChn >= m_SndFile.GetNumChannels()) + { + return false; + } + + const bool doMute = (m_SndFile.ChnSettings[nChn].dwFlags & CHN_MUTE) != 0; + + // Mute pattern channel if (doMute) { m_SndFile.Chn[nChn].dwFlags |= muteType; - //Kill VSTi notes on muted channel. + // Kill VSTi notes on muted channel. PLUGINDEX nPlug = m_SndFile.GetBestPlugin(nChn, PrioritiseInstrument, EvenIfMuted); if ((nPlug) && (nPlug<=MAX_MIXPLUGINS)) { @@ -1136,31 +1161,26 @@ } } else { - //on unmute alway cater for both mute types - this way there's no probs if user changes mute mode. + // On unmute alway cater for both mute types - this way there's no probs if user changes mute mode. m_SndFile.Chn[nChn].dwFlags &= ~(CHN_SYNCMUTE|CHN_MUTE); } - //mute any NNA'd channels - for (UINT i=m_SndFile.m_nChannels; i<MAX_CHANNELS; i++) + // Mute any NNA'd channels + for (CHANNELINDEX i = m_SndFile.GetNumChannels(); i < MAX_CHANNELS; i++) { - if (m_SndFile.Chn[i].nMasterChn == nChn + 1u) { + if (m_SndFile.Chn[i].nMasterChn == nChn + 1u) + { if (doMute) { m_SndFile.Chn[i].dwFlags |= muteType; } else { - //on unmute alway cater for both mute types - this way there's no probs if user changes mute mode. + // On unmute alway cater for both mute types - this way there's no probs if user changes mute mode. m_SndFile.Chn[i].dwFlags &= ~(CHN_SYNCMUTE|CHN_MUTE); } } } - //Mark IT/MPTM/S3M as modified - if (m_SndFile.GetType() & (MOD_TYPE_IT | MOD_TYPE_MPT | MOD_TYPE_S3M)) - { - CMainFrame::GetMainFrame()->ThreadSafeSetModified(this); - } - return true; } Modified: trunk/OpenMPT/mptrack/Moddoc.h =================================================================== --- trunk/OpenMPT/mptrack/Moddoc.h 2011-09-08 20:15:53 UTC (rev 1029) +++ trunk/OpenMPT/mptrack/Moddoc.h 2011-09-09 13:22:13 UTC (rev 1030) @@ -301,6 +301,7 @@ BOOL IsNotePlaying(UINT note, UINT nsmp=0, UINT nins=0); bool MuteChannel(CHANNELINDEX nChn, bool bMute); + bool UpdateChannelMuteStatus(CHANNELINDEX nChn); bool MuteSample(SAMPLEINDEX nSample, bool bMute); bool MuteInstrument(INSTRUMENTINDEX nInstr, bool bMute); // -> CODE#0012 Modified: trunk/OpenMPT/mptrack/Undo.cpp =================================================================== --- trunk/OpenMPT/mptrack/Undo.cpp 2011-09-08 20:15:53 UTC (rev 1029) +++ trunk/OpenMPT/mptrack/Undo.cpp 2011-09-09 13:22:13 UTC (rev 1030) @@ -161,6 +161,13 @@ m_pModDoc->ReArrangeChannels(channels, false); } memcpy(pSndFile->ChnSettings, pUndo->channelInfo->settings, sizeof(MODCHANNELSETTINGS) * pUndo->channelInfo->oldNumChannels); + + // Channel mute status might have changed... + for(CHANNELINDEX i = 0; i < pSndFile->GetNumChannels(); i++) + { + m_pModDoc->UpdateChannelMuteStatus(i); + } + } nPattern = pUndo->pattern; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <sag...@us...> - 2011-09-10 19:55:07
|
Revision: 1031 http://modplug.svn.sourceforge.net/modplug/?rev=1031&view=rev Author: saga-games Date: 2011-09-10 19:55:00 +0000 (Sat, 10 Sep 2011) Log Message: ----------- [Fix] Last sample and instrument name were not sanitized properly before writing them to file. [Mod] Changed "file not found" message box to error type [Mod] Pattern Editor: Row Spacing is now 0 by default. Modified Paths: -------------- trunk/OpenMPT/mptrack/Moddoc.cpp trunk/OpenMPT/mptrack/Mptrack.cpp trunk/OpenMPT/mptrack/TrackerSettings.cpp Modified: trunk/OpenMPT/mptrack/Moddoc.cpp =================================================================== --- trunk/OpenMPT/mptrack/Moddoc.cpp 2011-09-09 13:22:13 UTC (rev 1030) +++ trunk/OpenMPT/mptrack/Moddoc.cpp 2011-09-10 19:55:00 UTC (rev 1031) @@ -3973,14 +3973,14 @@ StringFixer::FixNullString(m_SndFile.m_szNames[0]); // Sample names + filenames - for(SAMPLEINDEX nSmp = 1; nSmp < m_SndFile.GetNumSamples(); nSmp++) + for(SAMPLEINDEX nSmp = 1; nSmp <= m_SndFile.GetNumSamples(); nSmp++) { StringFixer::FixNullString(m_SndFile.m_szNames[nSmp]); StringFixer::FixNullString(m_SndFile.GetSample(nSmp).filename); } // Instrument names - for(INSTRUMENTINDEX nIns = 1; nIns < m_SndFile.GetNumInstruments(); nIns++) + for(INSTRUMENTINDEX nIns = 1; nIns <= m_SndFile.GetNumInstruments(); nIns++) { if(m_SndFile.Instruments[nIns] != nullptr) { Modified: trunk/OpenMPT/mptrack/Mptrack.cpp =================================================================== --- trunk/OpenMPT/mptrack/Mptrack.cpp 2011-09-09 13:22:13 UTC (rev 1030) +++ trunk/OpenMPT/mptrack/Mptrack.cpp 2011-09-10 19:55:00 UTC (rev 1031) @@ -97,7 +97,7 @@ { CString str; str.Format(GetStrI18N(_TEXT("Unable to open \"%s\": file does not exist.")), path); - Reporting::Notification(str); + Reporting::Error(str); } else //Case: Valid path but opening fails. { Modified: trunk/OpenMPT/mptrack/TrackerSettings.cpp =================================================================== --- trunk/OpenMPT/mptrack/TrackerSettings.cpp 2011-09-09 13:22:13 UTC (rev 1030) +++ trunk/OpenMPT/mptrack/TrackerSettings.cpp 2011-09-10 19:55:00 UTC (rev 1031) @@ -30,7 +30,7 @@ TrackerSettings::TrackerSettings() //-------------------------------- { - gnPatternSpacing = 1; + gnPatternSpacing = 0; gbPatternRecord = TRUE; gbPatternVUMeters = FALSE; gbPatternPluginNames = TRUE; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <sag...@us...> - 2011-09-11 18:52:27
|
Revision: 1033 http://modplug.svn.sourceforge.net/modplug/?rev=1033&view=rev Author: saga-games Date: 2011-09-11 18:52:20 +0000 (Sun, 11 Sep 2011) Log Message: ----------- [Fix] VST: JUCE-based plugins should not crash anymore when switching between orders when module playback is stopped. [Mod] OpenMPT: Version is now 1.20.00.21 Modified Paths: -------------- trunk/OpenMPT/mptrack/Vstplug.cpp trunk/OpenMPT/mptrack/version.h Modified: trunk/OpenMPT/mptrack/Vstplug.cpp =================================================================== --- trunk/OpenMPT/mptrack/Vstplug.cpp 2011-09-11 17:31:27 UTC (rev 1032) +++ trunk/OpenMPT/mptrack/Vstplug.cpp 2011-09-11 18:52:20 UTC (rev 1033) @@ -1369,7 +1369,7 @@ //rewbs.VSTcompliance //Store a pointer so we can get the CVstPlugin object from the basic VST effect object. - m_pEffect->resvd1=ToVstPtr(this); + m_pEffect->resvd1 = ToVstPtr(this); //rewbs.plugDocAware m_pSndFile = pSndFile; m_pModDoc = pSndFile->GetpModDoc(); @@ -2419,6 +2419,13 @@ //if (IsBypassed()) // return; + // The JUCE framework doesn't like processing while being suspended. + const bool wasSuspended = !IsResumed(); + if(wasSuspended) + { + Resume(); + } + do { overflow=false; @@ -2459,6 +2466,11 @@ // If we had hit an overflow, we need to loop around and start again. } while (overflow); + if(wasSuspended) + { + Suspend(); + } + } //end rewbs.VSTiNoteHoldonStopFix Modified: trunk/OpenMPT/mptrack/version.h =================================================================== --- trunk/OpenMPT/mptrack/version.h 2011-09-11 17:31:27 UTC (rev 1032) +++ trunk/OpenMPT/mptrack/version.h 2011-09-11 18:52:20 UTC (rev 1033) @@ -15,7 +15,7 @@ #define VER_MAJORMAJOR 1 #define VER_MAJOR 20 #define VER_MINOR 00 -#define VER_MINORMINOR 20 +#define VER_MINORMINOR 21 //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-09-18 20:27:11
|
Revision: 1041 http://modplug.svn.sourceforge.net/modplug/?rev=1041&view=rev Author: saga-games Date: 2011-09-18 20:27:04 +0000 (Sun, 18 Sep 2011) Log Message: ----------- [Imp] Buttons in the Plugin Manager have mnemonic shortcuts now (http://bugs.openmpt.org/view.php?id=186). [Imp] Treeview: If available, drum keys use key names provided by the sounddfont instead of pre-defined drum key names (experimental) [Fix] Comments tab: C5 frequency should be displayed correctly in all cases now. [Ref] Smaller refactoring here and there. [Mod] OpenMPT: Version is now 1.20.00.23 Modified Paths: -------------- trunk/OpenMPT/mptrack/CloseMainDialog.cpp trunk/OpenMPT/mptrack/CloseMainDialog.h trunk/OpenMPT/mptrack/SelectPluginDialog.cpp trunk/OpenMPT/mptrack/TrackerSettings.cpp trunk/OpenMPT/mptrack/View_ins.cpp trunk/OpenMPT/mptrack/View_tre.cpp trunk/OpenMPT/mptrack/Vstplug.cpp trunk/OpenMPT/mptrack/Vstplug.h trunk/OpenMPT/mptrack/mptrack.rc trunk/OpenMPT/mptrack/version.h trunk/OpenMPT/mptrack/view_com.cpp Modified: trunk/OpenMPT/mptrack/CloseMainDialog.cpp =================================================================== --- trunk/OpenMPT/mptrack/CloseMainDialog.cpp 2011-09-18 20:11:32 UTC (rev 1040) +++ trunk/OpenMPT/mptrack/CloseMainDialog.cpp 2011-09-18 20:27:04 UTC (rev 1041) @@ -46,8 +46,6 @@ { CDialog::OnInitDialog(); - CMainFrame::GetInputHandler()->Bypass(true); - // Create list of unsaved documents m_List.ResetContent(); @@ -104,8 +102,6 @@ } CDialog::OnOK(); - CMainFrame::GetInputHandler()->Bypass(false); - } @@ -113,7 +109,6 @@ //------------------------------ { CDialog::OnCancel(); - CMainFrame::GetInputHandler()->Bypass(false); } Modified: trunk/OpenMPT/mptrack/CloseMainDialog.h =================================================================== --- trunk/OpenMPT/mptrack/CloseMainDialog.h 2011-09-18 20:11:32 UTC (rev 1040) +++ trunk/OpenMPT/mptrack/CloseMainDialog.h 2011-09-18 20:27:04 UTC (rev 1041) @@ -21,9 +21,9 @@ CString FormatTitle(const CModDoc *pModDoc, bool fullPath); public: - CloseMainDialog() : CDialog(IDD_CLOSEDOCUMENTS) { }; + CloseMainDialog() : CDialog(IDD_CLOSEDOCUMENTS) { CMainFrame::GetInputHandler()->Bypass(true); }; + ~CloseMainDialog() { CMainFrame::GetInputHandler()->Bypass(false); }; - protected: virtual void DoDataExchange(CDataExchange* pDX); virtual BOOL OnInitDialog(); Modified: trunk/OpenMPT/mptrack/SelectPluginDialog.cpp =================================================================== --- trunk/OpenMPT/mptrack/SelectPluginDialog.cpp 2011-09-18 20:11:32 UTC (rev 1040) +++ trunk/OpenMPT/mptrack/SelectPluginDialog.cpp 2011-09-18 20:27:04 UTC (rev 1041) @@ -68,12 +68,14 @@ m_treePlugins.ModifyStyle(dwRemove, dwAdd); m_treePlugins.SetImageList(CMainFrame::GetMainFrame()->GetImageList(), TVSIL_NORMAL); - if (m_pPlugin) { + if (m_pPlugin) + { CString targetSlot; - targetSlot.Format("Put in FX%02d", m_nPlugSlot+1); + targetSlot.Format("&Put in FX%02d", m_nPlugSlot + 1); SetDlgItemText(IDOK, targetSlot); ::EnableWindow(::GetDlgItem(m_hWnd, IDOK), TRUE); - } else { + } else + { ::EnableWindow(::GetDlgItem(m_hWnd, IDOK), FALSE); } Modified: trunk/OpenMPT/mptrack/TrackerSettings.cpp =================================================================== --- trunk/OpenMPT/mptrack/TrackerSettings.cpp 2011-09-18 20:11:32 UTC (rev 1040) +++ trunk/OpenMPT/mptrack/TrackerSettings.cpp 2011-09-18 20:27:04 UTC (rev 1041) @@ -513,9 +513,9 @@ RegQueryValueEx(key, "MDIGraphHeight", NULL, &dwREG_DWORD, (LPBYTE)&glGraphWindowHeight, &dwDWORDSize); //rewbs.graph RegQueryValueEx(key, "MDITreeRatio", NULL, &dwREG_DWORD, (LPBYTE)&glTreeSplitRatio, &dwDWORDSize); // Colors - for (int ncol=0; ncol<MAX_MODCOLORS; ncol++) + for (int ncol = 0; ncol < MAX_MODCOLORS; ncol++) { - CHAR s[64]; + CHAR s[16]; wsprintf(s, "Color%02d", ncol); RegQueryValueEx(key, s, NULL, &dwREG_DWORD, (LPBYTE)&rgbCustomColors[ncol], &dwCRSIZE); } @@ -752,7 +752,7 @@ } // Obsolete, since we always write to Keybindings.mkb now. // Older versions of OpenMPT 1.18+ will look for this file if this entry is missing, so removing this entry after having read it is kind of backwards compatible. - WritePrivateProfileString("Paths", "Key_Config_File", NULL, iniFile); + WritePrivateProfileString("Paths", "Key_Config_File", nullptr, iniFile); CMainFrame::WritePrivateProfileLong("Effects", "XBassDepth", CSoundFile::m_nXBassDepth, iniFile); CMainFrame::WritePrivateProfileLong("Effects", "XBassRange", CSoundFile::m_nXBassRange, iniFile); @@ -822,7 +822,7 @@ _tcscpy(szPath, szFilenameFrom); } - TCHAR szOldDir[sizeof(directories[dir])]; // for comparison + TCHAR szOldDir[CountOf(directories[dir])]; // for comparison _tcscpy(szOldDir, directories[dir]); _tcscpy(directories[dir], szPath); Modified: trunk/OpenMPT/mptrack/View_ins.cpp =================================================================== --- trunk/OpenMPT/mptrack/View_ins.cpp 2011-09-18 20:11:32 UTC (rev 1040) +++ trunk/OpenMPT/mptrack/View_ins.cpp 2011-09-18 20:27:04 UTC (rev 1041) @@ -113,10 +113,10 @@ m_rcClient.bottom = 2; m_dwStatus = 0; m_nBtnMouseOver = 0xFFFF; - memset(m_dwNotifyPos, 0, sizeof(m_dwNotifyPos)); - memset(m_NcButtonState, 0, sizeof(m_NcButtonState)); + MemsetZero(m_dwNotifyPos); + MemsetZero(m_NcButtonState); m_bmpEnvBar.Create(IDB_ENVTOOLBAR, 20, 0, RGB(192,192,192)); - memset(m_baPlayingNote, 0, sizeof(bool)*NOTE_MAX); //rewbs.customKeys + MemsetZero(m_baPlayingNote); //rewbs.customKeys m_nPlayingChannel = CHANNELINDEX_INVALID; //rewbs.customKeys //rewbs.envRowGrid m_bGrid=true; Modified: trunk/OpenMPT/mptrack/View_tre.cpp =================================================================== --- trunk/OpenMPT/mptrack/View_tre.cpp 2011-09-18 20:11:32 UTC (rev 1040) +++ trunk/OpenMPT/mptrack/View_tre.cpp 2011-09-18 20:27:04 UTC (rev 1041) @@ -469,8 +469,8 @@ // Memorize Banks WORD wBanks[16]; HTREEITEM hBanks[16]; - memset(wBanks, 0, sizeof(wBanks)); - memset(hBanks, 0, sizeof(hBanks)); + MemsetZero(wBanks); + MemsetZero(hBanks); UINT nBanks = 0; // Add Drum Kits folder HTREEITEM hDrums = InsertItem(TVIF_TEXT|TVIF_IMAGE|TVIF_SELECTEDIMAGE, @@ -492,16 +492,25 @@ { UINT keymin = pDlsIns->Regions[iRgn].uKeyMin; UINT keymax = pDlsIns->Regions[iRgn].uKeyMax; + + const CHAR *regionName = pDlsBank->GetRegionName(iIns, iRgn); + if(regionName == nullptr && (keymin >= 24) && (keymin <= 84)) + { + regionName = szMidiPercussionNames[keymin - 24]; + } else + { + regionName = ""; + } + if (keymin >= keymax) { - wsprintf(szName, "%s%d: %s", szNoteNames[keymin%12], keymin/12, - ((keymin >= 24) && (keymin <= 84)) ? szMidiPercussionNames[keymin-24] : ""); + wsprintf(szName, "%s%d: %s", szNoteNames[keymin % 12], keymin / 12, regionName); } else { wsprintf(szName, "%s%d-%s%d: %s", - szNoteNames[keymin%12], keymin/12, - szNoteNames[keymax%12], keymax/12, - ((keymin >= 24) && (keymin <= 84)) ? szMidiPercussionNames[keymin-24] : ""); + szNoteNames[keymin % 12], keymin / 12, + szNoteNames[keymax % 12], keymax / 12, + regionName); } LPARAM lParam = 0x80000000|(iDls<<24)|(iRgn<<16)|iIns; InsertItem(TVIF_TEXT|TVIF_IMAGE|TVIF_SELECTEDIMAGE|TVIF_PARAM, Modified: trunk/OpenMPT/mptrack/Vstplug.cpp =================================================================== --- trunk/OpenMPT/mptrack/Vstplug.cpp 2011-09-18 20:11:32 UTC (rev 1040) +++ trunk/OpenMPT/mptrack/Vstplug.cpp 2011-09-18 20:27:04 UTC (rev 1041) @@ -67,7 +67,7 @@ BOOL CVstPluginManager::CreateMixPluginProc(PSNDMIXPLUGIN pMixPlugin, CSoundFile* pSndFile) -//------------------------------------------------------------------------------------- +//----------------------------------------------------------------------------------------- { CVstPluginManager *that = theApp.GetPluginManager(); if (that) @@ -1554,9 +1554,11 @@ { if (!(--m_nRefCount)) { - try { + try + { delete this; - } catch (...) { + } catch (...) + { CVstPluginManager::ReportPlugException("Exception while destroying plugin!\n"); } @@ -2916,8 +2918,10 @@ else m_pMixStruct->Info.dwInputRouting &= ~MIXPLUG_INPUTF_BYPASS; +#ifdef MODPLUG_TRACKER if (m_pModDoc) m_pModDoc->UpdateAllViews(NULL, HINT_MIXPLUGINS, NULL); +#endif // MODPLUG_TRACKER return bypass; } @@ -2956,7 +2960,7 @@ void CVstPlugin::NotifySongPlaying(bool playing) //---------------------------------------------- { - m_bSongPlaying=playing; + m_bSongPlaying = playing; } @@ -2966,7 +2970,7 @@ UINT slot = 0; if (m_pSndFile) { - while ((m_pMixStruct != &(m_pSndFile->m_MixPlugins[slot])) && slot<MAX_MIXPLUGINS - 1) + while ((m_pMixStruct != &(m_pSndFile->m_MixPlugins[slot])) && slot < MAX_MIXPLUGINS - 1) { slot++; } @@ -3008,12 +3012,6 @@ return (CVstPlugin::Dispatch(effCanDo, 0, 0, (char*)(LPCTSTR)s, 0)) ? true : false; } -bool CVstPlugin::KeysRequired() -//----------------------------- -{ - return (CVstPlugin::Dispatch(effKeysRequired, 0, 0, NULL, 0) != 0); -} - void CVstPlugin::GetOutputPlugList(CArray<CVstPlugin*, CVstPlugin*> &list) //------------------------------------------------------------------------ { Modified: trunk/OpenMPT/mptrack/Vstplug.h =================================================================== --- trunk/OpenMPT/mptrack/Vstplug.h 2011-09-18 20:11:32 UTC (rev 1040) +++ trunk/OpenMPT/mptrack/Vstplug.h 2011-09-18 20:27:04 UTC (rev 1041) @@ -158,7 +158,6 @@ bool isInstrument(); // ericus 18/02/2005 bool CanRecieveMidiEvents(); - bool KeysRequired(); void GetOutputPlugList(CArray<CVstPlugin*,CVstPlugin*> &list); void GetInputPlugList(CArray<CVstPlugin*,CVstPlugin*> &list); Modified: trunk/OpenMPT/mptrack/mptrack.rc =================================================================== --- trunk/OpenMPT/mptrack/mptrack.rc 2011-09-18 20:11:32 UTC (rev 1040) +++ trunk/OpenMPT/mptrack/mptrack.rc 2011-09-18 20:27:04 UTC (rev 1041) @@ -1372,9 +1372,9 @@ EDITTEXT IDC_NAMEFILTER,30,6,150,14,ES_AUTOHSCROLL CONTROL "Tree1",IDC_TREE1,"SysTreeView32",TVS_DISABLEDRAGDROP | TVS_SHOWSELALWAYS | WS_HSCROLL | WS_TABSTOP,6,24,174,180,WS_EX_CLIENTEDGE DEFPUSHBUTTON "Add to Song",IDOK,187,6,53,14 - PUSHBUTTON "New plugin...",IDC_BUTTON1,188,23,52,14,BS_MULTILINE - PUSHBUTTON "Remove",IDC_BUTTON2,188,40,52,14 - PUSHBUTTON "Cancel",IDCANCEL,186,189,54,14 + PUSHBUTTON "&New plugin...",IDC_BUTTON1,188,23,52,14,BS_MULTILINE + PUSHBUTTON "&Remove",IDC_BUTTON2,188,40,52,14 + PUSHBUTTON "&Cancel",IDCANCEL,186,189,54,14 LTEXT "IDC_TEXT_CURRENT_VSTPLUG",IDC_TEXT_CURRENT_VSTPLUG,6,208,234,8 END Modified: trunk/OpenMPT/mptrack/version.h =================================================================== --- trunk/OpenMPT/mptrack/version.h 2011-09-18 20:11:32 UTC (rev 1040) +++ trunk/OpenMPT/mptrack/version.h 2011-09-18 20:27:04 UTC (rev 1041) @@ -15,7 +15,7 @@ #define VER_MAJORMAJOR 1 #define VER_MAJOR 20 #define VER_MINOR 00 -#define VER_MINORMINOR 22 +#define VER_MINORMINOR 23 //Creates version number from version parts that appears in version string. //For example MAKE_VERSION_NUMERIC(1,17,02,28) gives version number of Modified: trunk/OpenMPT/mptrack/view_com.cpp =================================================================== --- trunk/OpenMPT/mptrack/view_com.cpp 2011-09-18 20:11:32 UTC (rev 1040) +++ trunk/OpenMPT/mptrack/view_com.cpp 2011-09-18 20:27:04 UTC (rev 1041) @@ -202,7 +202,7 @@ UINT nCol = 0; for (UINT iSmp=0; iSmp<SMPLIST_COLUMNS; iSmp++) { - memset(&lvc, 0, sizeof(LV_COLUMN)); + MemsetZero(lvc); lvc.mask = LVCF_FMT | LVCF_WIDTH | LVCF_TEXT | LVCF_SUBITEM; lvc.fmt = (iSmp) ? LVCFMT_RIGHT : LVCFMT_LEFT; lvc.pszText = (LPSTR)gSampleHeaders[iSmp].pszName; @@ -218,7 +218,7 @@ UINT nCol = 0; for (UINT i=0; i<INSLIST_COLUMNS; i++) { - memset(&lvc, 0, sizeof(LV_COLUMN)); + MemsetZero(lvc); lvc.mask = LVCF_FMT | LVCF_WIDTH | LVCF_TEXT | LVCF_SUBITEM; lvc.fmt = (i) ? LVCFMT_RIGHT : LVCFMT_LEFT; lvc.pszText = (LPSTR)gInstrumentHeaders[i].pszName; @@ -299,15 +299,12 @@ case SMPLIST_MIDDLEC: if (sample.nLength) { - wsprintf(s, "%d Hz", - pSndFile->GetFreqFromPeriod( - pSndFile->GetPeriodFromNote(NOTE_MIDDLEC + sample.RelativeTone, sample.nFineTune, sample.nC5Speed), - sample.nC5Speed)); + wsprintf(s, "%d Hz", sample.GetSampleRate(pSndFile->GetType())); } break; case SMPLIST_FILENAME: memcpy(s, sample.filename, sizeof(sample.filename)); - s[sizeof(sample.filename)] = 0; + s[CountOf(sample.filename)] = 0; break; } lvi.mask = LVIF_TEXT; @@ -364,15 +361,14 @@ case INSLIST_SAMPLES: if (pIns) { - BYTE smp_tb[(MAX_SAMPLES+7)/8]; - memset(smp_tb, 0, sizeof(smp_tb)); + vector<bool> smpRef(MAX_SAMPLES, false); for (UINT i=0; i<NOTE_MAX; i++) { UINT n = pIns->Keyboard[i]; - if ((n) && (n < MAX_SAMPLES)) smp_tb[n>>3] |= (1<<(n&7)); + if ((n) && (n < MAX_SAMPLES)) smpRef[n] = true; } UINT k = 0; - for (UINT j=1; j<MAX_SAMPLES; j++) if (smp_tb[j>>3] & (1<<(j&7))) + for (UINT j=1; j<MAX_SAMPLES; j++) if (smpRef[j]) { if (k) strcat(s, ","); UINT l = strlen(s); @@ -398,7 +394,7 @@ if (pIns) { memcpy(s, pIns->filename, sizeof(pIns->filename)); - s[sizeof(pIns->filename)] = 0; + s[CountOf(pIns->filename)] = 0; } break; case INSLIST_PLUGIN: This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <sag...@us...> - 2011-09-18 21:12:58
|
Revision: 1042 http://modplug.svn.sourceforge.net/modplug/?rev=1042&view=rev Author: saga-games Date: 2011-09-18 21:12:51 +0000 (Sun, 18 Sep 2011) Log Message: ----------- [Imp] Plugin Manager: Plugin list doesn't collapse every time a plugin is removed (http://bugs.openmpt.org/view.php?id=186). [Mod] Plugin Manager: Keyboard handler is bypassed while the Plugin Manager is open. Modified Paths: -------------- trunk/OpenMPT/mptrack/SelectPluginDialog.cpp trunk/OpenMPT/mptrack/SelectPluginDialog.h trunk/OpenMPT/mptrack/Vstplug.cpp trunk/OpenMPT/mptrack/Vstplug.h Modified: trunk/OpenMPT/mptrack/SelectPluginDialog.cpp =================================================================== --- trunk/OpenMPT/mptrack/SelectPluginDialog.cpp 2011-09-18 20:27:04 UTC (rev 1041) +++ trunk/OpenMPT/mptrack/SelectPluginDialog.cpp 2011-09-18 21:12:51 UTC (rev 1042) @@ -55,9 +55,18 @@ m_pPlugin = &pSndFile->m_MixPlugins[m_nPlugSlot]; } } + + CMainFrame::GetMainFrame()->GetInputHandler()->Bypass(true); } +CSelectPluginDlg::~CSelectPluginDlg() +//----------------------------------- +{ + CMainFrame::GetMainFrame()->GetInputHandler()->Bypass(false); +} + + BOOL CSelectPluginDlg::OnInitDialog() //----------------------------------- { @@ -440,7 +449,7 @@ UpdatePluginsList(plugLib ? plugLib->dwPluginId2 : 0); } else { - Reporting::Error("At least one selected file was not a valid VST-Plugin."); + Reporting::Error("At least one selected file was not a valid VST Plugin."); } } @@ -448,12 +457,16 @@ void CSelectPluginDlg::OnRemovePlugin() //------------------------------------- { + const HTREEITEM pluginToDelete = m_treePlugins.GetSelectedItem(); + PVSTPLUGINLIB pPlug = (PVSTPLUGINLIB)m_treePlugins.GetItemData(pluginToDelete); CVstPluginManager *pManager = theApp.GetPluginManager(); - PVSTPLUGINLIB pPlug = (PVSTPLUGINLIB)m_treePlugins.GetItemData(m_treePlugins.GetSelectedItem()); + if ((pManager) && (pPlug)) { - pManager->RemovePlugin(pPlug); - UpdatePluginsList(); + if(pManager->RemovePlugin(pPlug)) + { + m_treePlugins.DeleteItem(pluginToDelete); + } } } Modified: trunk/OpenMPT/mptrack/SelectPluginDialog.h =================================================================== --- trunk/OpenMPT/mptrack/SelectPluginDialog.h 2011-09-18 20:27:04 UTC (rev 1041) +++ trunk/OpenMPT/mptrack/SelectPluginDialog.h 2011-09-18 21:12:51 UTC (rev 1042) @@ -30,6 +30,7 @@ public: CSelectPluginDlg(CModDoc *pModDoc, int nPlugSlot, CWnd *parent); //rewbs.plugDocAware + ~CSelectPluginDlg(); void DoClose(); void UpdatePluginsList(DWORD forceSelect = 0); bool VerifyPlug(PVSTPLUGINLIB plug); Modified: trunk/OpenMPT/mptrack/Vstplug.cpp =================================================================== --- trunk/OpenMPT/mptrack/Vstplug.cpp 2011-09-18 20:27:04 UTC (rev 1041) +++ trunk/OpenMPT/mptrack/Vstplug.cpp 2011-09-18 21:12:51 UTC (rev 1042) @@ -434,7 +434,7 @@ } -BOOL CVstPluginManager::RemovePlugin(PVSTPLUGINLIB pFactory) +bool CVstPluginManager::RemovePlugin(PVSTPLUGINLIB pFactory) //---------------------------------------------------------- { PVSTPLUGINLIB p = m_pVstHead; @@ -462,11 +462,11 @@ CVstPluginManager::ReportPlugException("Exception while trying to release plugin \"%s\"!\n", pFactory->szLibraryName); } - return TRUE; + return true; } p = p->pNext; } - return FALSE; + return false; } Modified: trunk/OpenMPT/mptrack/Vstplug.h =================================================================== --- trunk/OpenMPT/mptrack/Vstplug.h 2011-09-18 20:27:04 UTC (rev 1041) +++ trunk/OpenMPT/mptrack/Vstplug.h 2011-09-18 21:12:51 UTC (rev 1042) @@ -244,7 +244,7 @@ PVSTPLUGINLIB GetFirstPlugin() const { return m_pVstHead; } BOOL IsValidPlugin(const VSTPLUGINLIB *pLib); PVSTPLUGINLIB AddPlugin(LPCSTR pszDllPath, BOOL bCache=TRUE, const bool checkFileExistence = false, CString* const errStr = 0); - BOOL RemovePlugin(PVSTPLUGINLIB); + bool RemovePlugin(PVSTPLUGINLIB); BOOL CreateMixPlugin(PSNDMIXPLUGIN, CSoundFile*); void OnIdle(); static void ReportPlugException(LPCSTR format,...); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <sag...@us...> - 2011-09-19 16:14:13
|
Revision: 1045 http://modplug.svn.sourceforge.net/modplug/?rev=1045&view=rev Author: saga-games Date: 2011-09-19 16:14:07 +0000 (Mon, 19 Sep 2011) Log Message: ----------- [Ref] Data type refactoring in pattern editor Modified Paths: -------------- trunk/OpenMPT/mptrack/Draw_pat.cpp trunk/OpenMPT/mptrack/View_pat.cpp trunk/OpenMPT/mptrack/View_pat.h Modified: trunk/OpenMPT/mptrack/Draw_pat.cpp =================================================================== --- trunk/OpenMPT/mptrack/Draw_pat.cpp 2011-09-19 00:34:36 UTC (rev 1044) +++ trunk/OpenMPT/mptrack/Draw_pat.cpp 2011-09-19 16:14:07 UTC (rev 1045) @@ -1429,16 +1429,16 @@ } -void CViewPattern::InvalidateRow(int n) -//------------------------------------- +void CViewPattern::InvalidateRow(ROWINDEX n) +//------------------------------------------ { CModDoc *pModDoc = GetDocument(); if (pModDoc) { CSoundFile *pSndFile = pModDoc->GetSoundFile(); int yofs = GetYScrollPos() - m_nMidRow; - if (n == -1) n = m_nRow; - if ((n < yofs) || (n >= (int)pSndFile->Patterns[m_nPattern].GetNumRows())) return; + if (n == ROWINDEX_INVALID) n = m_nRow; + if (((int)n < yofs) || (n >= pSndFile->Patterns[m_nPattern].GetNumRows())) return; CRect rect; GetClientRect(&rect); rect.left = m_szHeader.cx; @@ -1484,7 +1484,7 @@ if ((pMainFrm) && (pModDoc)) { CSoundFile *pSndFile = pModDoc->GetSoundFile(); - CHAR s[512]; + CHAR s[128]; CHANNELINDEX nChn; wsprintf(s, "Row %d, Col %d", GetCurrentRow(), GetCurrentChannel() + 1); pMainFrm->SetUserText(s); @@ -1496,7 +1496,7 @@ && (m_dwBeginSel == m_dwEndSel) && (pSndFile->Patterns[m_nPattern]) && (m_nRow < pSndFile->Patterns[m_nPattern].GetNumRows()) && (nChn < pSndFile->m_nChannels)) { - MODCOMMAND *m = &pSndFile->Patterns[m_nPattern][m_nRow*pSndFile->m_nChannels+nChn]; + MODCOMMAND *m = pSndFile->Patterns[m_nPattern].GetpModCommand(m_nRow, nChn); switch (GetColTypeFromCursor(m_dwCursor)) { Modified: trunk/OpenMPT/mptrack/View_pat.cpp =================================================================== --- trunk/OpenMPT/mptrack/View_pat.cpp 2011-09-19 00:34:36 UTC (rev 1044) +++ trunk/OpenMPT/mptrack/View_pat.cpp 2011-09-19 16:14:07 UTC (rev 1045) @@ -173,7 +173,8 @@ //m_dwStatus = 0; m_dwStatus = PATSTATUS_PLUGNAMESINHEADERS; m_nXScroll = m_nYScroll = 0; - m_nPattern = m_nRow = 0; + m_nPattern = 0; + m_nRow = 0; m_nSpacing = 0; m_nAccelChar = 0; // -> CODE#0018 @@ -190,8 +191,8 @@ } -BOOL CViewPattern::SetCurrentPattern(UINT npat, int nrow) -//------------------------------------------------------- +BOOL CViewPattern::SetCurrentPattern(UINT npat, ROWINDEX nrow) +//------------------------------------------------------------ { CSoundFile *pSndFile; CModDoc *pModDoc = GetDocument(); @@ -211,7 +212,7 @@ } m_nPattern = npat; - if ((nrow >= 0) && (nrow != (int)m_nRow) && (nrow < (int)pSndFile->Patterns[m_nPattern].GetNumRows())) + if ((nrow != ROWINDEX_INVALID) && (nrow != m_nRow) && (nrow < pSndFile->Patterns[m_nPattern].GetNumRows())) { m_nRow = nrow; bUpdateScroll = true; @@ -226,7 +227,7 @@ if (m_bWholePatternFitsOnScreen) //rewbs.scrollFix SetScrollPos(SB_VERT, 0); else if (bUpdateScroll) //rewbs.fix3147 - SetScrollPos(SB_VERT, m_nRow * GetColumnHeight()); + SetScrollPos(SB_VERT, (int)m_nRow * GetColumnHeight()); UpdateScrollPos(); InvalidatePattern(TRUE); @@ -2254,7 +2255,7 @@ { CSoundFile *pSndFile = pModDoc->GetSoundFile(); if ((!pSndFile->Patterns[m_nPattern].GetNumRows()) || (!pSndFile->Patterns[m_nPattern])) return; - MODCOMMAND *m = pSndFile->Patterns[m_nPattern] + m_nRow * pSndFile->GetNumChannels() + GetChanFromCursor(m_dwCursor); + const MODCOMMAND *m = pSndFile->Patterns[m_nPattern].GetpModCommand(m_nRow, GetChanFromCursor(m_dwCursor)); switch(GetColTypeFromCursor(m_dwCursor)) { case NOTE_COLUMN: @@ -2290,7 +2291,7 @@ UINT nChn = GetChanFromCursor(m_dwCursor); UINT nCursor = GetColTypeFromCursor(m_dwCursor); CSoundFile *pSndFile = pModDoc->GetSoundFile(); - MODCOMMAND *p = pSndFile->Patterns[m_nPattern] + m_nRow*pSndFile->m_nChannels + nChn; + MODCOMMAND *p = pSndFile->Patterns[m_nPattern].GetpModCommand(m_nRow, nChn); switch(nCursor) { @@ -2916,7 +2917,7 @@ void CViewPattern::OnPatternAmplify() //----------------------------------- { - static UINT snOldAmp = 100; + static int16 snOldAmp = 100; CAmpDlg dlg(this, snOldAmp, 0); CModDoc *pModDoc = GetDocument(); @@ -2927,7 +2928,7 @@ BeginWaitCursor(); PrepareUndo(m_dwBeginSel, m_dwEndSel); - snOldAmp = static_cast<UINT>(dlg.m_nFactor); + snOldAmp = dlg.m_nFactor; if (pSndFile->Patterns[m_nPattern]) { @@ -3749,14 +3750,14 @@ case kcPatternSnapDownh2: CursorJump(GetRowsPerBeat(), false, true); return wParam; case kcNavigateDownSelect: - case kcNavigateDown: SetCurrentRow(m_nRow+1, TRUE); return wParam; + case kcNavigateDown: SetCurrentRow(m_nRow + 1, TRUE); return wParam; case kcNavigateUpSelect: - case kcNavigateUp: SetCurrentRow(m_nRow-1, TRUE); return wParam; + case kcNavigateUp: SetCurrentRow(m_nRow - 1, TRUE); return wParam; case kcNavigateDownBySpacingSelect: - case kcNavigateDownBySpacing: SetCurrentRow(m_nRow+m_nSpacing, TRUE); return wParam; + case kcNavigateDownBySpacing: SetCurrentRow(m_nRow + m_nSpacing, TRUE); return wParam; case kcNavigateUpBySpacingSelect: - case kcNavigateUpBySpacing: SetCurrentRow(m_nRow-m_nSpacing, TRUE); return wParam; + case kcNavigateUpBySpacing: SetCurrentRow(m_nRow - m_nSpacing, TRUE); return wParam; case kcNavigateLeftSelect: case kcNavigateLeft: if ((CMainFrame::GetSettings().m_dwPatternSetup & PATTERN_WRAP) && (!m_dwCursor)) @@ -4850,7 +4851,7 @@ PrepareUndo(m_dwBeginSel, m_dwEndSel); UINT nChn = GetChanFromCursor(m_dwCursor); CSoundFile *pSndFile = pModDoc->GetSoundFile(); - MODCOMMAND *p = pSndFile->Patterns[m_nPattern] + m_nRow*pSndFile->m_nChannels + nChn; + MODCOMMAND *p = pSndFile->Patterns[m_nPattern].GetpModCommand(m_nRow, nChn); MODCOMMAND oldcmd = *p; switch(field) @@ -4880,7 +4881,7 @@ || (!(m_dwStatus & PATSTATUS_FOLLOWSONG))))) { if ((m_nSpacing > 0) && (m_nSpacing <= MAX_SPACING)) - SetCurrentRow(m_nRow+m_nSpacing); + SetCurrentRow(m_nRow + m_nSpacing); DWORD sel = CreateCursor(m_nRow) | m_dwCursor; SetCurSel(sel, sel); } Modified: trunk/OpenMPT/mptrack/View_pat.h =================================================================== --- trunk/OpenMPT/mptrack/View_pat.h 2011-09-19 00:34:36 UTC (rev 1044) +++ trunk/OpenMPT/mptrack/View_pat.h 2011-09-19 16:14:07 UTC (rev 1045) @@ -102,7 +102,8 @@ CEditCommand *m_pEditWnd; CPatternGotoDialog *m_pGotoWnd; SIZE m_szHeader, m_szCell; - UINT m_nPattern, m_nRow, m_nMidRow, m_nPlayPat, m_nPlayRow, m_nSpacing, m_nAccelChar, m_nLastPlayedRow, m_nLastPlayedOrder; + ROWINDEX m_nRow; + UINT m_nPattern, m_nMidRow, m_nPlayPat, m_nPlayRow, m_nSpacing, m_nAccelChar, m_nLastPlayedRow, m_nLastPlayedOrder; int m_nXScroll, m_nYScroll; DWORD m_nMenuParam, m_nDetailLevel; @@ -163,7 +164,7 @@ int GetColumnWidth() const { return m_szCell.cx; } int GetColumnHeight() const { return m_szCell.cy; } UINT GetCurrentPattern() const { return m_nPattern; } - UINT GetCurrentRow() const { return m_nRow; } + ROWINDEX GetCurrentRow() const { return m_nRow; } UINT GetCurrentColumn() const { return m_dwCursor; } UINT GetCurrentChannel() const { return (m_dwCursor >> 3); } UINT GetColumnOffset(DWORD dwPos) const; @@ -174,12 +175,12 @@ ROWINDEX GetRowsPerMeasure() const; void InvalidatePattern(BOOL bHdr=FALSE); - void InvalidateRow(int n=-1); + void InvalidateRow(ROWINDEX n = ROWINDEX_INVALID); void InvalidateArea(DWORD dwBegin, DWORD dwEnd); void InvalidateSelection() { InvalidateArea(m_dwBeginSel, m_dwEndSel); } void InvalidateChannelsHeaders(); void SetCurSel(DWORD dwBegin, DWORD dwEnd); - BOOL SetCurrentPattern(UINT npat, int nrow=-1); + BOOL SetCurrentPattern(UINT npat, ROWINDEX nrow = ROWINDEX_INVALID); BOOL SetCurrentRow(UINT nrow, BOOL bWrap=FALSE, BOOL bUpdateHorizontalScrollbar=TRUE ); BOOL SetCurrentColumn(UINT ncol); // This should be used instead of consecutive calls to SetCurrentRow() then SetCurrentColumn() This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <sag...@us...> - 2011-09-24 22:58:10
|
Revision: 1054 http://modplug.svn.sourceforge.net/modplug/?rev=1054&view=rev Author: saga-games Date: 2011-09-24 22:58:02 +0000 (Sat, 24 Sep 2011) Log Message: ----------- [Imp] Keyboard Config Dialog: Added a button to restore default configuration. [Mod] Keyboard Config Dialog: Removed annoying and unnecessary notifications. [Imp] Order list: Added a context menu to add a separator index. Modified Paths: -------------- trunk/OpenMPT/mptrack/CommandSet.cpp trunk/OpenMPT/mptrack/CommandSet.h trunk/OpenMPT/mptrack/Ctrl_pat.h trunk/OpenMPT/mptrack/Ctrl_seq.cpp trunk/OpenMPT/mptrack/InputHandler.cpp trunk/OpenMPT/mptrack/KeyConfigDlg.cpp trunk/OpenMPT/mptrack/KeyConfigDlg.h trunk/OpenMPT/mptrack/MainFrm.cpp trunk/OpenMPT/mptrack/mptrack.rc trunk/OpenMPT/mptrack/resource.h Modified: trunk/OpenMPT/mptrack/CommandSet.cpp =================================================================== --- trunk/OpenMPT/mptrack/CommandSet.cpp 2011-09-24 15:07:51 UTC (rev 1053) +++ trunk/OpenMPT/mptrack/CommandSet.cpp 2011-09-24 22:58:02 UTC (rev 1054) @@ -1407,7 +1407,7 @@ return commands[cmd].Message; } -bool CCommandSet::SaveFile(CString fileName, bool debug) +bool CCommandSet::SaveFile(CString fileName) { //TODO: Make C++ /* Layout: @@ -1446,7 +1446,7 @@ if (kc.ctx != ctx) continue; //sort by context - if (debug || !commands[cmd].isHidden) + if (!commands[cmd].isHidden) { fprintf(outStream, "%d:%d:%d:%d:%d\t\t//%s: %s (%s)\n", ctx, commands[cmd].UID, kc.mod, kc.code, kc.event, @@ -1596,7 +1596,9 @@ return true; } + bool CCommandSet::LoadFile(CString fileName) +//------------------------------------------ { std::ifstream fin(fileName); if (fin.fail()) @@ -1611,6 +1613,23 @@ } +bool CCommandSet::LoadDefaultKeymap() +//----------------------------------- +{ + bool success = false; + const char* pData = nullptr; + HGLOBAL hglob = nullptr; + size_t nSize = 0; + if (LoadResource(MAKEINTRESOURCE(IDR_DEFAULT_KEYBINDINGS), TEXT("KEYBINDINGS"), pData, nSize, hglob) != nullptr) + { + std::istrstream iStrm(pData, nSize); + success = LoadFile(iStrm, TEXT("\"executable resource\"")); + FreeResource(hglob); + } + return success; +} + + // Fix outdated keymap files void CCommandSet::UpgradeKeymap(CCommandSet *pCommands, int oldVersion) //--------------------------------------------------------------------- Modified: trunk/OpenMPT/mptrack/CommandSet.h =================================================================== --- trunk/OpenMPT/mptrack/CommandSet.h 2011-09-24 15:07:51 UTC (rev 1053) +++ trunk/OpenMPT/mptrack/CommandSet.h 2011-09-24 22:58:02 UTC (rev 1054) @@ -1198,9 +1198,10 @@ //Pululation ;) void Copy(CCommandSet *source); // copy the contents of a commandset into this command set void GenKeyMap(KeyMap &km); // Generate a keymap from this command set - bool SaveFile(CString FileName, bool debug); + bool SaveFile(CString FileName); bool LoadFile(CString FileName); bool LoadFile(std::istream& iStrm, LPCTSTR szFilename); + bool LoadDefaultKeymap(); void UpgradeKeymap(CCommandSet *pCommands, int oldVersion); static DWORD GetKeymapLabel(InputTargetContext ctx, UINT mod, UINT code, KeyEventType ke); Modified: trunk/OpenMPT/mptrack/Ctrl_pat.h =================================================================== --- trunk/OpenMPT/mptrack/Ctrl_pat.h 2011-09-24 15:07:51 UTC (rev 1053) +++ trunk/OpenMPT/mptrack/Ctrl_pat.h 2011-09-24 22:58:02 UTC (rev 1054) @@ -63,18 +63,18 @@ BYTE SetMargins(int); // Returns the effective margin value. - BYTE GetMargins() {return GetMargins(GetMarginsMax());} + BYTE GetMargins() { return GetMargins(GetMarginsMax()); } // Returns the effective margin value. - BYTE GetMargins(const BYTE nMaxMargins) {return Util::Min(nMaxMargins, static_cast<BYTE>(m_nOrderlistMargins));} + BYTE GetMargins(const BYTE nMaxMargins) const { return Util::Min(nMaxMargins, static_cast<BYTE>(m_nOrderlistMargins)); } // Returns maximum margin value given current window width. - BYTE GetMarginsMax() {return GetMarginsMax(GetLength());} + BYTE GetMarginsMax() { return GetMarginsMax(GetLength()); } // Returns maximum margin value when shown sequence has nLength orders. // For example: If length is 4 orders -> maxMargins = 4/2 - 1 = 1; // if maximum is 5 -> maxMargins = (int)5/2 = 2 - BYTE GetMarginsMax(const BYTE nLength) {return (nLength > 0 && nLength % 2 == 0) ? nLength/2 - 1 : nLength/2;} + BYTE GetMarginsMax(const BYTE nLength) const { return (nLength > 0 && nLength % 2 == 0) ? nLength / 2 - 1 : nLength / 2; } // Returns the number of sequence items visible in the list. BYTE GetLength(); @@ -122,6 +122,7 @@ afx_msg void OnSize(UINT nType, int cx, int cy); afx_msg void OnSwitchToView(); afx_msg void OnInsertOrder(); + afx_msg void OnInsertSeparatorPattern(); afx_msg void OnDeleteOrder(); afx_msg void OnRenderOrder(); afx_msg void OnPatternProperties(); Modified: trunk/OpenMPT/mptrack/Ctrl_seq.cpp =================================================================== --- trunk/OpenMPT/mptrack/Ctrl_seq.cpp 2011-09-24 15:07:51 UTC (rev 1053) +++ trunk/OpenMPT/mptrack/Ctrl_seq.cpp 2011-09-24 22:58:02 UTC (rev 1054) @@ -41,29 +41,30 @@ ON_WM_KILLFOCUS() ON_WM_HSCROLL() ON_WM_SIZE() - ON_COMMAND(ID_CONTROLTAB, OnSwitchToView) + ON_COMMAND(ID_CONTROLTAB, OnSwitchToView) - ON_COMMAND(ID_ORDERLIST_INSERT, OnInsertOrder) - ON_COMMAND(ID_ORDERLIST_DELETE, OnDeleteOrder) - ON_COMMAND(ID_ORDERLIST_RENDER, OnRenderOrder) - ON_COMMAND(ID_ORDERLIST_EDIT_COPY, OnEditCopy) - ON_COMMAND(ID_ORDERLIST_EDIT_CUT, OnEditCut) - ON_COMMAND(ID_ORDERLIST_EDIT_PASTE, OnEditPaste) + ON_COMMAND(ID_ORDERLIST_INSERT, OnInsertOrder) + ON_COMMAND(ID_ORDERLIST_INSERT_SEPARATOR, OnInsertSeparatorPattern) + ON_COMMAND(ID_ORDERLIST_DELETE, OnDeleteOrder) + ON_COMMAND(ID_ORDERLIST_RENDER, OnRenderOrder) + ON_COMMAND(ID_ORDERLIST_EDIT_COPY, OnEditCopy) + ON_COMMAND(ID_ORDERLIST_EDIT_CUT, OnEditCut) + ON_COMMAND(ID_ORDERLIST_EDIT_PASTE, OnEditPaste) - ON_COMMAND(ID_PATTERN_PROPERTIES, OnPatternProperties) - ON_COMMAND(ID_PLAYER_PLAY, OnPlayerPlay) - ON_COMMAND(ID_PLAYER_PAUSE, OnPlayerPause) - ON_COMMAND(ID_PLAYER_PLAYFROMSTART, OnPlayerPlayFromStart) - ON_COMMAND(IDC_PATTERN_PLAYFROMSTART,OnPatternPlayFromStart) - //ON_COMMAND(ID_PATTERN_RESTART, OnPatternPlayFromStart) - ON_COMMAND(ID_ORDERLIST_NEW, OnCreateNewPattern) - ON_COMMAND(ID_ORDERLIST_COPY, OnDuplicatePattern) - ON_COMMAND(ID_PATTERNCOPY, OnPatternCopy) - ON_COMMAND(ID_PATTERNPASTE, OnPatternPaste) + ON_COMMAND(ID_PATTERN_PROPERTIES, OnPatternProperties) + ON_COMMAND(ID_PLAYER_PLAY, OnPlayerPlay) + ON_COMMAND(ID_PLAYER_PAUSE, OnPlayerPause) + ON_COMMAND(ID_PLAYER_PLAYFROMSTART, OnPlayerPlayFromStart) + ON_COMMAND(IDC_PATTERN_PLAYFROMSTART, OnPatternPlayFromStart) + //ON_COMMAND(ID_PATTERN_RESTART, OnPatternPlayFromStart) + ON_COMMAND(ID_ORDERLIST_NEW, OnCreateNewPattern) + ON_COMMAND(ID_ORDERLIST_COPY, OnDuplicatePattern) + ON_COMMAND(ID_PATTERNCOPY, OnPatternCopy) + ON_COMMAND(ID_PATTERNPASTE, OnPatternPaste) ON_COMMAND_RANGE(ID_SEQUENCE_ITEM, ID_SEQUENCE_ITEM + MAX_SEQUENCES + 2, OnSelectSequence) - ON_MESSAGE(WM_MOD_DRAGONDROPPING, OnDragonDropping) - ON_MESSAGE(WM_HELPHITTEST, OnHelpHitTest) - ON_MESSAGE(WM_MOD_KEYCOMMAND, OnCustomKeyMsg) + ON_MESSAGE(WM_MOD_DRAGONDROPPING, OnDragonDropping) + ON_MESSAGE(WM_HELPHITTEST, OnHelpHitTest) + ON_MESSAGE(WM_MOD_KEYCOMMAND, OnCustomKeyMsg) //}}AFX_MSG_MAP END_MESSAGE_MAP() @@ -245,7 +246,8 @@ ORD_SELECTION result; result.nOrdLo = result.nOrdHi = m_nScrollPos; // bIgnoreSelection: true if only first selection marker is important. - if(!bIgnoreSelection && m_nScrollPos2nd != ORDERINDEX_INVALID) { + if(!bIgnoreSelection && m_nScrollPos2nd != ORDERINDEX_INVALID) + { if(m_nScrollPos2nd < m_nScrollPos) // ord2 < ord1 result.nOrdLo = m_nScrollPos2nd; else @@ -1063,6 +1065,10 @@ { // only one pattern is selected AppendMenu(hMenu, MF_STRING, ID_ORDERLIST_INSERT, "&Insert Pattern\t" + ih->GetKeyTextFromCommand(kcOrderlistEditInsert)); + if(pSndFile->GetModSpecifications().hasIgnoreIndex) + { + AppendMenu(hMenu, MF_STRING, ID_ORDERLIST_INSERT_SEPARATOR, "&Insert Separator\t" + ih->GetKeyTextFromCommand(kcOrderlistPatIgnore)); + } AppendMenu(hMenu, MF_STRING, ID_ORDERLIST_DELETE, "&Remove Pattern\t" + ih->GetKeyTextFromCommand(kcOrderlistEditDelete)); AppendMenu(hMenu, MF_SEPARATOR, NULL, ""); AppendMenu(hMenu, MF_STRING, ID_ORDERLIST_NEW, "Create &New Pattern\t" + ih->GetKeyTextFromCommand(kcNewPattern)); @@ -1189,12 +1195,12 @@ { CSoundFile *pSndFile = m_pModDoc->GetSoundFile(); - ORD_SELECTION selection = GetCurSel(false); - ORDERINDEX nInsertCount = selection.nOrdHi - selection.nOrdLo, nInsertEnd = selection.nOrdHi; + const ORD_SELECTION selection = GetCurSel(false); + const ORDERINDEX nInsertCount = selection.nOrdHi - selection.nOrdLo, nInsertEnd = selection.nOrdHi; for(ORDERINDEX i = 0; i <= nInsertCount; i++) { - //Checking whether there is some pattern at the end of orderlist. + // Checking whether there is some pattern at the end of orderlist. if (pSndFile->Order.GetLength() < 1 || pSndFile->Order.Last() < pSndFile->Patterns.Size()) { if(pSndFile->Order.GetLength() < pSndFile->GetModSpecifications().ordersMax) @@ -1228,6 +1234,34 @@ } } + +void COrderList::OnInsertSeparatorPattern() +//----------------------------------------- +{ + // Insert a separator pattern after the current pattern, don't move order list cursor + if (m_pModDoc) + { + CSoundFile *pSndFile = m_pModDoc->GetSoundFile(); + + const ORD_SELECTION selection = GetCurSel(true); + // Checking whether there is some pattern at the end of orderlist. + if (pSndFile->Order.GetLength() < 1 || pSndFile->Order.Last() < pSndFile->Patterns.Size()) + { + if(pSndFile->Order.GetLength() < pSndFile->GetModSpecifications().ordersMax) + pSndFile->Order.Append(); + } + for(int j = pSndFile->Order.GetLastIndex(); j > selection.nOrdHi; j--) + pSndFile->Order[j] = pSndFile->Order[j - 1]; + + pSndFile->Order[selection.nOrdHi + 1] = pSndFile->Order.GetIgnoreIndex(); + + InvalidateRect(NULL, FALSE); + m_pModDoc->SetModified(); + m_pModDoc->UpdateAllViews(NULL, HINT_MODSEQUENCE, this); + } +} + + void COrderList::OnRenderOrder() //------------------------------ { Modified: trunk/OpenMPT/mptrack/InputHandler.cpp =================================================================== --- trunk/OpenMPT/mptrack/InputHandler.cpp 2011-09-24 15:07:51 UTC (rev 1053) +++ trunk/OpenMPT/mptrack/InputHandler.cpp 2011-09-24 22:58:02 UTC (rev 1054) @@ -45,16 +45,10 @@ { // Load keybindings from resources. Log("Loading keybindings from resources\n"); - const char* pData = nullptr; - HGLOBAL hglob = nullptr; - size_t nSize = 0; - if (LoadResource(MAKEINTRESOURCE(IDR_DEFAULT_KEYBINDINGS), TEXT("KEYBINDINGS"), pData, nSize, hglob) != nullptr) + bSuccess = activeCommandSet->LoadDefaultKeymap(); + if (bSuccess && bNoExistingKbdFileSetting) { - std::istrstream iStrm(pData, nSize); - bSuccess = activeCommandSet->LoadFile(iStrm, TEXT("\"executable resource\"")); - FreeResource(hglob); - if (bSuccess && bNoExistingKbdFileSetting) - activeCommandSet->SaveFile(CMainFrame::GetSettings().m_szKbdFile, false); + activeCommandSet->SaveFile(CMainFrame::GetSettings().m_szKbdFile); } } if (bSuccess == false) Modified: trunk/OpenMPT/mptrack/KeyConfigDlg.cpp =================================================================== --- trunk/OpenMPT/mptrack/KeyConfigDlg.cpp 2011-09-24 15:07:51 UTC (rev 1053) +++ trunk/OpenMPT/mptrack/KeyConfigDlg.cpp 2011-09-24 22:58:02 UTC (rev 1054) @@ -83,23 +83,24 @@ //----------------------------------------------------------- BEGIN_MESSAGE_MAP(COptionsKeyboard, CPropertyPage) - ON_LBN_SELCHANGE(IDC_CHOICECOMBO, OnKeyChoiceSelect) - ON_LBN_SELCHANGE(IDC_COMMAND_LIST, OnCommandKeySelChanged) - ON_LBN_SELCHANGE(IDC_KEYCATEGORY, OnCategorySelChanged) - ON_EN_UPDATE(IDC_CHORDDETECTWAITTIME, OnChordWaitTimeChanged) //rewbs.autochord - ON_COMMAND(IDC_SET, OnSetKeyChoice) - ON_COMMAND(IDC_DELETE, OnDeleteKeyChoice) - ON_COMMAND(IDC_RESTORE, OnRestoreKeyChoice) - ON_COMMAND(IDC_LOAD, OnLoad) - ON_COMMAND(IDC_SAVE, OnSave) - ON_COMMAND(IDC_CHECKKEYDOWN, OnCheck) - ON_COMMAND(IDC_CHECKKEYHOLD, OnCheck) - ON_COMMAND(IDC_CHECKKEYUP, OnCheck) - ON_COMMAND(IDC_NOTESREPEAT, OnNotesRepeat) - ON_COMMAND(IDC_NONOTESREPEAT, OnNoNotesRepeat) - ON_COMMAND(IDC_EFFECTLETTERSXM, OnSetXMEffects) - ON_COMMAND(IDC_EFFECTLETTERSIT, OnSetITEffects) - ON_COMMAND(IDC_CLEARLOG, OnClearLog) + ON_LBN_SELCHANGE(IDC_CHOICECOMBO, OnKeyChoiceSelect) + ON_LBN_SELCHANGE(IDC_COMMAND_LIST, OnCommandKeySelChanged) + ON_LBN_SELCHANGE(IDC_KEYCATEGORY, OnCategorySelChanged) + ON_EN_UPDATE(IDC_CHORDDETECTWAITTIME, OnChordWaitTimeChanged) //rewbs.autochord + ON_COMMAND(IDC_SET, OnSetKeyChoice) + ON_COMMAND(IDC_DELETE, OnDeleteKeyChoice) + ON_COMMAND(IDC_RESTORE, OnRestoreKeyChoice) + ON_COMMAND(IDC_LOAD, OnLoad) + ON_COMMAND(IDC_SAVE, OnSave) + ON_COMMAND(IDC_CHECKKEYDOWN, OnCheck) + ON_COMMAND(IDC_CHECKKEYHOLD, OnCheck) + ON_COMMAND(IDC_CHECKKEYUP, OnCheck) + ON_COMMAND(IDC_NOTESREPEAT, OnNotesRepeat) + ON_COMMAND(IDC_NONOTESREPEAT, OnNoNotesRepeat) + ON_COMMAND(IDC_EFFECTLETTERSXM, OnSetXMEffects) + ON_COMMAND(IDC_EFFECTLETTERSIT, OnSetITEffects) + ON_COMMAND(IDC_CLEARLOG, OnClearLog) + ON_COMMAND(IDC_RESTORE_KEYMAP, OnRestoreDefaultKeymap) ON_WM_DESTROY() END_MESSAGE_MAP() @@ -116,8 +117,6 @@ DDX_Control(pDX, IDC_CHECKKEYDOWN, m_bKeyDown); DDX_Control(pDX, IDC_CHECKKEYHOLD, m_bKeyHold); DDX_Control(pDX, IDC_CHECKKEYUP, m_bKeyUp); - - DDX_Control(pDX, IDC_DEBUGSAVE, m_bDebugSave); } @@ -527,15 +526,16 @@ CInputHandler *ih=CMainFrame::GetInputHandler(); - //Do nothing if there's nothing to restore + // Do nothing if there's nothing to restore if (cmd<0 || m_nCurKeyChoice<0 || m_nCurKeyChoice>=ih->GetKeyListSize(cmd)) { - CString error = "Nothing to restore for this slot."; - Reporting::Error(error, "Invalid key data"); + // Annoying message box is annoying. + //CString error = "Nothing to restore for this slot."; + //Reporting::Error(error, "Invalid key data"); return; } - //Restore current key combination choice for currently selected command. + // Restore current key combination choice for currently selected command. kc = ih->activeCommandSet->GetKey(cmd, m_nCurKeyChoice); plocalCmdSet->Remove(m_nCurKeyChoice, cmd); plocalCmdSet->Add(kc, cmd, true, m_nCurKeyChoice); @@ -548,11 +548,12 @@ { CommandID cmd = (CommandID)m_nCurHotKey; - //Do nothing if there's no key defined for this slot. + // Do nothing if there's no key defined for this slot. if (m_nCurHotKey<0 || m_nCurKeyChoice<0 || m_nCurKeyChoice>=plocalCmdSet->GetKeyListSize(cmd)) { - CString error = "No key currently set for this slot."; - Reporting::Warning(error, "Invalid key data"); + // Annoying message box is annoying. + //CString error = "No key currently set for this slot."; + //Reporting::Warning(error, "Invalid key data"); return; } @@ -657,7 +658,7 @@ if(files.abort) return; m_sFullPathName = files.first_file.c_str(); - plocalCmdSet->SaveFile(m_sFullPathName, m_bDebugSave.GetCheck() != BST_UNCHECKED); + plocalCmdSet->SaveFile(m_sFullPathName); //TentativeSetToDefaultFile(m_sFullPathName); } @@ -700,4 +701,15 @@ { m_eReport.SetWindowText(""); ForceUpdateGUI(); +} + + +void COptionsKeyboard::OnRestoreDefaultKeymap() +//--------------------------------------------- +{ + if(Reporting::Confirm("Discard all custom changes and restore default key configuration?") == cnfYes) + { + plocalCmdSet->LoadDefaultKeymap(); + ForceUpdateGUI(); + } } \ No newline at end of file Modified: trunk/OpenMPT/mptrack/KeyConfigDlg.h =================================================================== --- trunk/OpenMPT/mptrack/KeyConfigDlg.h 2011-09-24 15:07:51 UTC (rev 1053) +++ trunk/OpenMPT/mptrack/KeyConfigDlg.h 2011-09-24 22:58:02 UTC (rev 1054) @@ -98,8 +98,6 @@ bool m_bModified; bool m_bChoiceModified; - CButton m_bDebugSave; - void ForceUpdateGUI(); public: @@ -135,6 +133,7 @@ afx_msg void OnLoad(); afx_msg void OnSave(); afx_msg void OnClearLog(); + afx_msg void OnRestoreDefaultKeymap(); DECLARE_MESSAGE_MAP(); public: afx_msg void OnDestroy(); Modified: trunk/OpenMPT/mptrack/MainFrm.cpp =================================================================== --- trunk/OpenMPT/mptrack/MainFrm.cpp 2011-09-24 15:07:51 UTC (rev 1053) +++ trunk/OpenMPT/mptrack/MainFrm.cpp 2011-09-24 22:58:02 UTC (rev 1054) @@ -508,13 +508,13 @@ gpSoundDevice = NULL; } // Save Settings - RemoveControlBar(&m_wndStatusBar); //Remove statusbar so that its state won't get saved. + RemoveControlBar(&m_wndStatusBar); // Remove statusbar so that its state won't get saved. m_Settings.SaveSettings(); - AddControlBar(&m_wndStatusBar); //Restore statusbar to mainframe. + AddControlBar(&m_wndStatusBar); // Restore statusbar to mainframe. if(m_InputHandler && m_InputHandler->activeCommandSet) { - m_InputHandler->activeCommandSet->SaveFile(GetSettings().m_szKbdFile, false); + m_InputHandler->activeCommandSet->SaveFile(GetSettings().m_szKbdFile); } EndWaitCursor(); Modified: trunk/OpenMPT/mptrack/mptrack.rc =================================================================== --- trunk/OpenMPT/mptrack/mptrack.rc 2011-09-24 15:07:51 UTC (rev 1053) +++ trunk/OpenMPT/mptrack/mptrack.rc 2011-09-24 22:58:02 UTC (rev 1054) @@ -441,35 +441,35 @@ CAPTION "Keyboard" FONT 8, "MS Shell Dlg", 0, 0, 0x0 BEGIN + LTEXT "Select category:",IDC_STATIC,7,5,131,11 COMBOBOX IDC_KEYCATEGORY,5,16,133,204,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP LISTBOX IDC_COMMAND_LIST,5,32,133,244,LBS_NOINTEGRALHEIGHT | WS_VSCROLL | WS_TABSTOP - COMBOBOX IDC_CHOICECOMBO,150,18,114,51,CBS_DROPDOWN | WS_VSCROLL | WS_TABSTOP - EDITTEXT IDC_CUSTHOTKEY,168,36,95,13,ES_AUTOHSCROLL + COMBOBOX IDC_CHOICECOMBO,150,18,72,51,CBS_DROPDOWN | WS_VSCROLL | WS_TABSTOP + LTEXT "Key:",IDC_STATIC,150,38,16,8 + EDITTEXT IDC_CUSTHOTKEY,168,36,54,13,ES_AUTOHSCROLL CONTROL "On Key Down",IDC_CHECKKEYDOWN,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,150,54,66,8 CONTROL "On Key Hold",IDC_CHECKKEYHOLD,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,150,66,66,8 CONTROL "On Key Up",IDC_CHECKKEYUP,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,150,78,66,8 - PUSHBUTTON "Restore",IDC_RESTORE,222,54,43,13 - PUSHBUTTON "Delete",IDC_DELETE,222,71,43,13 - EDITTEXT IDC_KEYREPORT,144,192,126,84,ES_MULTILINE | ES_AUTOVSCROLL | ES_READONLY | WS_VSCROLL + PUSHBUTTON "Restore",IDC_RESTORE,228,36,37,13 + PUSHBUTTON "Set",IDC_SET,228,30,36,13,NOT WS_VISIBLE + PUSHBUTTON "Delete",IDC_DELETE,228,18,37,13 + LTEXT "Repeat notes on hold?",IDC_STATIC,150,108,74,8 PUSHBUTTON "Yes",IDC_NOTESREPEAT,228,108,18,9 PUSHBUTTON "No",IDC_NONOTESREPEAT,246,108,18,9 + LTEXT "Chord detect interval (ms):",IDC_STATIC,150,122,88,8 EDITTEXT IDC_CHORDDETECTWAITTIME,240,120,24,12,ES_AUTOHSCROLL | ES_NUMBER,WS_EX_RIGHT - PUSHBUTTON "it",IDC_EFFECTLETTERSIT,103,184,12,9,NOT WS_VISIBLE - PUSHBUTTON "xm",IDC_EFFECTLETTERSXM,119,184,12,9,NOT WS_VISIBLE PUSHBUTTON "Import Keys...",IDC_LOAD,150,156,54,13 PUSHBUTTON "Export Keys...",IDC_SAVE,210,156,54,13 - CONTROL "Debug Save",IDC_DEBUGSAVE,"Button",BS_AUTOCHECKBOX | NOT WS_VISIBLE | WS_TABSTOP,59,199,56,10 - LTEXT "Select category:",IDC_STATIC,7,5,131,11 - PUSHBUTTON "Set",IDC_SET,228,52,43,13,NOT WS_VISIBLE + LTEXT "Error Log:",IDC_STATIC,144,198,78,8 + PUSHBUTTON "Clear Log",IDC_CLEARLOG,228,196,42,12 + EDITTEXT IDC_KEYREPORT,144,210,126,66,ES_MULTILINE | ES_AUTOVSCROLL | ES_READONLY | WS_VSCROLL GROUPBOX "Key setup for this command ",IDC_STATIC,144,6,126,84 - LTEXT "Key:",IDC_STATIC,150,38,16,8 GROUPBOX "Misc",IDC_STATIC,144,96,126,40 - GROUPBOX "Multi Config Handling",IDC_STATIC,144,144,126,31 - LTEXT "Repeat notes on hold?",IDC_STATIC,150,108,74,8 - LTEXT "Effect letters like:",IDC_STATIC,11,185,73,11,NOT WS_VISIBLE - LTEXT "Chord detect interval (ms):",IDC_STATIC,150,122,88,8 - LTEXT "Error Log:",IDC_STATIC,144,180,88,8 - PUSHBUTTON "Clear Log",IDC_CLEARLOG,228,179,42,12 + GROUPBOX "Multi Config Handling",IDC_STATIC,144,144,126,48 + PUSHBUTTON "it",IDC_EFFECTLETTERSIT,98,252,12,9,NOT WS_VISIBLE + PUSHBUTTON "xm",IDC_EFFECTLETTERSXM,114,252,12,9,NOT WS_VISIBLE + LTEXT "Effect letters like:",IDC_STATIC,6,254,73,11,NOT WS_VISIBLE + PUSHBUTTON "Restore default configuration",IDC_RESTORE_KEYMAP,150,174,114,12 END IDD_OPTIONS_COLORS DIALOGEX 0, 0, 272, 281 Modified: trunk/OpenMPT/mptrack/resource.h =================================================================== --- trunk/OpenMPT/mptrack/resource.h 2011-09-24 15:07:51 UTC (rev 1053) +++ trunk/OpenMPT/mptrack/resource.h 2011-09-24 22:58:02 UTC (rev 1054) @@ -676,7 +676,6 @@ #define IDC_CHECKKEYDOWN 2094 #define IDC_CHECKKEYHOLD 2095 #define IDC_CHECKKEYUP 2096 -#define IDC_DEBUGSAVE 2097 #define IDC_CUSTHOTKEY 2098 #define IDC_SET 2099 #define IDC_RESTORE 2100 @@ -946,6 +945,7 @@ #define IDC_SAMPLE_QUICKFADE 2433 #define IDC_SAMPLE_XFADE 2434 #define IDC_LASTUPDATE 2435 +#define IDC_RESTORE_KEYMAP 2436 #define ID_FILE_NEWMOD 32771 #define ID_FILE_NEWXM 32772 #define ID_FILE_NEWS3M 32773 @@ -1205,6 +1205,7 @@ #define ID_INTERNETUPDATE 44458 #define ID_HELP_EXAMPLEMODULES 44459 #define ID_FILE_SAVEASTEMPLATE 44460 +#define ID_ORDERLIST_INSERT_SEPARATOR 44461 // Next default values for new objects // @@ -1212,8 +1213,8 @@ #ifndef APSTUDIO_READONLY_SYMBOLS #define _APS_3D_CONTROLS 1 #define _APS_NEXT_RESOURCE_VALUE 531 -#define _APS_NEXT_COMMAND_VALUE 44461 -#define _APS_NEXT_CONTROL_VALUE 2436 +#define _APS_NEXT_COMMAND_VALUE 44462 +#define _APS_NEXT_CONTROL_VALUE 2437 #define _APS_NEXT_SYMED_VALUE 901 #endif #endif This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <sag...@us...> - 2011-09-25 00:39:02
|
Revision: 1056 http://modplug.svn.sourceforge.net/modplug/?rev=1056&view=rev Author: saga-games Date: 2011-09-25 00:38:55 +0000 (Sun, 25 Sep 2011) Log Message: ----------- [Imp] PC Notes have an edit memory now and adhere to the row spacing setting (http://bugs.openmpt.org/view.php?id=190). 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-09-24 22:59:29 UTC (rev 1055) +++ trunk/OpenMPT/mptrack/View_pat.cpp 2011-09-25 00:38:55 UTC (rev 1056) @@ -148,6 +148,7 @@ m_pGotoWnd = NULL; m_Dib.Init(CMainFrame::bmpNotes); UpdateColors(); + m_PCNoteEditMemory = MODCOMMAND::Empty(); } void CViewPattern::OnInitialUpdate() @@ -1687,7 +1688,7 @@ pModDoc->GetPatternUndo()->PrepareUndo(m_nPattern, 0,0, pSndFile->m_nChannels, maxrow); for (UINT r=row; r<maxrow; r++) { - MODCOMMAND *m = pSndFile->Patterns[m_nPattern] + r * pSndFile->m_nChannels + colmin; + MODCOMMAND *m = pSndFile->Patterns[m_nPattern].GetpModCommand(r, colmin); for (UINT c=colmin; c<=colmax; c++, m++) { if (r + nrows >= maxrow) @@ -3963,12 +3964,13 @@ { \ if((v >= 0) && (v <= 9)) \ { \ - uint16 val = p->Get##method##(); \ + uint16 val = pTarget->Get##method##(); \ /* Move existing digits to left, drop out leftmost digit and */ \ /* push new digit to the least meaning digit. */ \ val = (val % 100) * 10 + v; \ if(val > MODCOMMAND::maxColumnValue) val = MODCOMMAND::maxColumnValue; \ - p->Set##method##(val); \ + pTarget->Set##method##(val); \ + m_PCNoteEditMemory = *pTarget; \ } \ } @@ -3987,17 +3989,17 @@ PrepareUndo(m_dwBeginSel, m_dwEndSel); - MODCOMMAND* p = pSndFile->Patterns[m_nPattern].GetpModCommand(m_nRow, GetChanFromCursor(m_dwCursor)); - MODCOMMAND oldcmd = *p; // This is the command we are about to overwrite + MODCOMMAND* pTarget = pSndFile->Patterns[m_nPattern].GetpModCommand(m_nRow, GetChanFromCursor(m_dwCursor)); + MODCOMMAND oldcmd = *pTarget; // This is the command we are about to overwrite - if(p->IsPcNote()) + if(pTarget->IsPcNote()) { ENTER_PCNOTE_VALUE(v, ValueVolCol); } else { - UINT volcmd = p->volcmd; - UINT vol = p->vol; + UINT volcmd = pTarget->volcmd; + UINT vol = pTarget->vol; if ((v >= 0) && (v <= 9)) { vol = ((vol * 10) + v) % 100; @@ -4032,8 +4034,8 @@ if (vol > max) vol %= 10; if(pSndFile->GetModSpecifications().HasVolCommand(volcmd)) { - p->volcmd = volcmd; - p->vol = vol; + pTarget->volcmd = volcmd; + pTarget->vol = vol; } } @@ -4042,7 +4044,7 @@ DWORD sel = CreateCursor(m_nRow) | m_dwCursor; SetCurSel(sel, sel); sel &= ~7; - if(oldcmd != *p) + if(oldcmd != *pTarget) { pModDoc->SetModified(); InvalidateArea(sel, sel + LAST_COLUMN); @@ -4052,7 +4054,7 @@ else { // recording disabled - *p = oldcmd; + *pTarget = oldcmd; } } } @@ -4081,12 +4083,12 @@ { CSoundFile *pSndFile = pModDoc->GetSoundFile(); - MODCOMMAND *p = pSndFile->Patterns[m_nPattern].GetpModCommand(m_nRow, GetChanFromCursor(m_dwCursor)); - MODCOMMAND oldcmd = *p; // This is the command we are about to overwrite + MODCOMMAND *pTarget = pSndFile->Patterns[m_nPattern].GetpModCommand(m_nRow, GetChanFromCursor(m_dwCursor)); + MODCOMMAND oldcmd = *pTarget; // This is the command we are about to overwrite PrepareUndo(m_dwBeginSel, m_dwEndSel); - if(p->IsPcNote()) + if(pTarget->IsPcNote()) { ENTER_PCNOTE_VALUE(c, ValueEffectCol); } @@ -4095,28 +4097,28 @@ if (c) { - if ((c == m_cmdOld.command) && (!p->param) && (!p->command)) p->param = m_cmdOld.param; + if ((c == m_cmdOld.command) && (!pTarget->param) && (!pTarget->command)) pTarget->param = m_cmdOld.param; else m_cmdOld.param = 0; m_cmdOld.command = c; } - p->command = c; + pTarget->command = c; if(v >= 0) { - p->param = v; + pTarget->param = v; } // Check for MOD/XM Speed/Tempo command if ((pSndFile->m_nType & (MOD_TYPE_MOD|MOD_TYPE_XM)) - && ((p->command == CMD_SPEED) || (p->command == CMD_TEMPO))) + && ((pTarget->command == CMD_SPEED) || (pTarget->command == CMD_TEMPO))) { - p->command = (p->param <= pSndFile->GetModSpecifications().speedMax) ? CMD_SPEED : CMD_TEMPO; + pTarget->command = (pTarget->param <= pSndFile->GetModSpecifications().speedMax) ? CMD_SPEED : CMD_TEMPO; } } DWORD sel = CreateCursor(m_nRow) | m_dwCursor; SetCurSel(sel, sel); sel &= ~7; - if(oldcmd != *p) + if(oldcmd != *pTarget) { pModDoc->SetModified(); InvalidateArea(sel, sel + LAST_COLUMN); @@ -4137,33 +4139,33 @@ { CSoundFile *pSndFile = pModDoc->GetSoundFile(); - MODCOMMAND *p = pSndFile->Patterns[m_nPattern].GetpModCommand(m_nRow, GetChanFromCursor(m_dwCursor)); - MODCOMMAND oldcmd = *p; // This is the command we are about to overwrite + MODCOMMAND *pTarget = pSndFile->Patterns[m_nPattern].GetpModCommand(m_nRow, GetChanFromCursor(m_dwCursor)); + MODCOMMAND oldcmd = *pTarget; // This is the command we are about to overwrite PrepareUndo(m_dwBeginSel, m_dwEndSel); - if(p->IsPcNote()) + if(pTarget->IsPcNote()) { ENTER_PCNOTE_VALUE(v, ValueEffectCol); } else { - p->param = (p->param << 4) | v; - if (p->command == m_cmdOld.command) m_cmdOld.param = p->param; + pTarget->param = (pTarget->param << 4) | v; + if (pTarget->command == m_cmdOld.command) m_cmdOld.param = pTarget->param; // Check for MOD/XM Speed/Tempo command if ((pSndFile->m_nType & (MOD_TYPE_MOD|MOD_TYPE_XM)) - && ((p->command == CMD_SPEED) || (p->command == CMD_TEMPO))) + && ((pTarget->command == CMD_SPEED) || (pTarget->command == CMD_TEMPO))) { - p->command = (p->param <= pSndFile->GetModSpecifications().speedMax) ? CMD_SPEED : CMD_TEMPO; + pTarget->command = (pTarget->param <= pSndFile->GetModSpecifications().speedMax) ? CMD_SPEED : CMD_TEMPO; } } DWORD sel = CreateCursor(m_nRow) | m_dwCursor; SetCurSel(sel, sel); sel &= ~7; - if(*p != oldcmd) + if(*pTarget != oldcmd) { pModDoc->SetModified(); InvalidateArea(sel, sel + LAST_COLUMN); @@ -4326,7 +4328,9 @@ MODCOMMAND* p = pSndFile->Patterns[m_nPattern].GetpModCommand(m_nRow, nChn); MODCOMMAND oldcmd = *p; // This is the command we are about to overwrite if (oldcmd.note) - TempEnterNote(((oldcmd.note-1)%12)+val*12+1); + { + TempEnterNote(((oldcmd.note - 1) % 12) + val * 12 + 1); + } } } @@ -4383,6 +4387,10 @@ InvalidateArea(sel, sel + LAST_COLUMN); UpdateIndicator(); } + if(p->IsPcNote()) + { + m_PCNoteEditMemory = *p; + } } else { @@ -4410,7 +4418,7 @@ const PATTERNINDEX nPatPlayback = pSndFile->m_nPattern; const bool bRecordEnabled = IsEditingEnabled(); - const UINT nChn = GetChanFromCursor(m_dwCursor); + const CHANNELINDEX nChn = GetChanFromCursor(m_dwCursor); if(note > pSndFile->GetModSpecifications().noteMax && note < NOTE_MIN_SPECIAL) note = pSndFile->GetModSpecifications().noteMax; @@ -4431,23 +4439,12 @@ BYTE recordGroup = pModDoc->IsChannelRecord(nChn); const bool bIsLiveRecord = IsLiveRecord(*pMainFrm, *pModDoc, *pSndFile); const bool usePlaybackPosition = (bIsLiveRecord && (CMainFrame::GetSettings().m_dwPatternSetup & PATTERN_AUTODELAY) && !(pSndFile->m_dwSongFlags & SONG_STEP)); - //Param control 'note' - if(MODCOMMAND::IsPcNote(note) && bRecordEnabled) - { - pModDoc->GetPatternUndo()->PrepareUndo(m_nPattern, nChn, nRow, 1, 1); - pSndFile->Patterns[m_nPattern].GetpModCommand(nRow, nChn)->note = note; - const DWORD sel = CreateCursor(nRow) | m_dwCursor; - pModDoc->SetModified(); - InvalidateArea(sel, sel + LAST_COLUMN); - UpdateIndicator(); - return; - } + bool isSplit = false; - // -- Chord autodetection: step back if we just entered a note - if ((bRecordEnabled) && (recordGroup) && !bIsLiveRecord) + if (bRecordEnabled && recordGroup && !bIsLiveRecord && !MODCOMMAND::IsPcNote(note)) { - if ((m_nSpacing > 0) && (m_nSpacing <= MAX_SPACING)) + if (m_nSpacing > 0 && m_nSpacing <= MAX_SPACING) { if ((timeGetTime() - m_dwLastNoteEntryTime < CMainFrame::GetSettings().gnAutoChordWaitTime) && (nRow >= m_nSpacing) && (!m_bLastNoteEntryBlocked)) @@ -4459,78 +4456,100 @@ m_dwLastNoteEntryTime = timeGetTime(); PATTERNINDEX nPat = m_nPattern; - if(usePlaybackPosition) SetEditPos(*pSndFile, nRow, nPat, nRowPlayback, nPatPlayback); - // -- Work out where to put the new note + // -- Work out where to put the new note MODCOMMAND *pTarget = pSndFile->Patterns[nPat].GetpModCommand(nRow, nChn); MODCOMMAND newcmd = *pTarget; - + // 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)) + // Param control 'note' + if(MODCOMMAND::IsPcNote(note)) { - newcmd.Clear(); - } + if(bRecordEnabled) + { + if(!pTarget->IsPcNote()) + { + // We're overwriting a normal cell with a PC note. + newcmd = m_PCNoteEditMemory; + } else + { + // Just update PC note edit memory. + m_PCNoteEditMemory = newcmd; + } - // -- write note and instrument data. - const bool isSplit = HandleSplit(&newcmd, note); - - // Nice idea actually: Use lower section of the keyboard to play chords (but it won't work 100% correctly this way...) - /*if(isSplit) + newcmd.note = note; + modified = true; + } + } else { - TempEnterChord(note); - return; - }*/ - // -- write vol data - int volWrite = -1; - if (vol >= 0 && vol <= 64 && !(isSplit && pModDoc->GetSplitKeyboardSettings()->splitVolume)) //write valid volume, as long as there's no split volume override. - { - volWrite = vol; - } else if (isSplit && pModDoc->GetSplitKeyboardSettings()->splitVolume) //cater for split volume override. - { - if (pModDoc->GetSplitKeyboardSettings()->splitVolume > 0 && pModDoc->GetSplitKeyboardSettings()->splitVolume <= 64) + // Are we overwriting a PC note here? + if(pTarget->IsPcNote()) { - volWrite = pModDoc->GetSplitKeyboardSettings()->splitVolume; + newcmd.Clear(); } - } - if(volWrite != -1) - { - if(pSndFile->GetModSpecifications().HasVolCommand(VOLCMD_VOLUME)) + // -- write note and instrument data. + isSplit = HandleSplit(&newcmd, note); + + // Nice idea actually: Use lower section of the keyboard to play chords (but it won't work 100% correctly this way...) + /*if(isSplit) { - newcmd.volcmd = VOLCMD_VOLUME; - newcmd.vol = (MODCOMMAND::VOL)volWrite; - } else + TempEnterChord(note); + return; + }*/ + + // -- write vol data + int volWrite = -1; + if (vol >= 0 && vol <= 64 && !(isSplit && pModDoc->GetSplitKeyboardSettings()->splitVolume)) //write valid volume, as long as there's no split volume override. { - newcmd.command = CMD_VOLUME; - newcmd.param = (MODCOMMAND::PARAM)volWrite; + volWrite = vol; + } else if (isSplit && pModDoc->GetSplitKeyboardSettings()->splitVolume) //cater for split volume override. + { + if (pModDoc->GetSplitKeyboardSettings()->splitVolume > 0 && pModDoc->GetSplitKeyboardSettings()->splitVolume <= 64) + { + volWrite = pModDoc->GetSplitKeyboardSettings()->splitVolume; + } } - } - // -- write sdx if playing live - if (usePlaybackPosition && nTick) // avoid SD0 which will be mis-interpreted - { - if (newcmd.command == CMD_NONE) //make sure we don't overwrite any existing commands. + if(volWrite != -1) { - newcmd.command = (pSndFile->TypeIsS3M_IT_MPT()) ? CMD_S3MCMDEX : CMD_MODCMDEX; - UINT maxSpeed = 0x0F; - if(pSndFile->m_nMusicSpeed > 0) maxSpeed = min(0x0F, pSndFile->m_nMusicSpeed - 1); - newcmd.param = 0xD0 + min(maxSpeed, nTick); + if(pSndFile->GetModSpecifications().HasVolCommand(VOLCMD_VOLUME)) + { + newcmd.volcmd = VOLCMD_VOLUME; + newcmd.vol = (MODCOMMAND::VOL)volWrite; + } else + { + newcmd.command = CMD_VOLUME; + newcmd.param = (MODCOMMAND::PARAM)volWrite; + } } + + // -- write sdx if playing live + if (usePlaybackPosition && nTick) // avoid SD0 which will be mis-interpreted + { + if (newcmd.command == CMD_NONE) //make sure we don't overwrite any existing commands. + { + newcmd.command = (pSndFile->TypeIsS3M_IT_MPT()) ? CMD_S3MCMDEX : CMD_MODCMDEX; + UINT maxSpeed = 0x0F; + if(pSndFile->m_nMusicSpeed > 0) maxSpeed = min(0x0F, pSndFile->m_nMusicSpeed - 1); + newcmd.param = 0xD0 + min(maxSpeed, nTick); + } + } + + // -- old style note cut/off/fade: erase instrument number + if (oldStyle && newcmd.note >= NOTE_MIN_SPECIAL) + newcmd.instr = 0; + } - // -- old style note cut/off/fade: erase instrument number - if (oldStyle && newcmd.note >= NOTE_MIN_SPECIAL) - newcmd.instr = 0; - // -- if recording, write out modified command. if (bRecordEnabled && *pTarget != newcmd) @@ -4541,7 +4560,7 @@ // -- play note - if ((CMainFrame::GetSettings().m_dwPatternSetup & (PATTERN_PLAYNEWNOTE|PATTERN_PLAYEDITROW)) || (!bRecordEnabled)) + if (((CMainFrame::GetSettings().m_dwPatternSetup & (PATTERN_PLAYNEWNOTE|PATTERN_PLAYEDITROW)) || !bRecordEnabled) && !newcmd.IsPcNote()) { const bool playWholeRow = ((CMainFrame::GetSettings().m_dwPatternSetup & PATTERN_PLAYEDITROW) && !bIsLiveRecord); if (playWholeRow) @@ -4590,11 +4609,12 @@ sel &= ~7; } - if(modified) //has it really changed? + if(modified) // Has it really changed? { pModDoc->SetModified(); if(bIsLiveRecord == false) - { // Update only when not recording live. + { + // Update only when not recording live. InvalidateArea(sel, sel + LAST_COLUMN); UpdateIndicator(); } @@ -4619,33 +4639,39 @@ SetCurSel(sel, sel); } + if(newcmd.IsPcNote()) + { + // Nothing to do here anymore. + return; + } + BYTE* activeNoteMap = isSplit ? splitActiveNoteChannel : activeNoteChannel; if (newcmd.note <= NOTE_MAX) activeNoteMap[newcmd.note] = nChn; - //Move to next channel if required + // Move to next channel if required if (recordGroup) { bool channelLocked; - UINT n = nChn; - for (UINT i=1; i<pSndFile->m_nChannels; i++) + CHANNELINDEX n = nChn; + for (CHANNELINDEX i = 1; i < pSndFile->GetNumChannels(); i++) { - if (++n >= pSndFile->m_nChannels) n = 0; //loop around + if (++n >= pSndFile->GetNumChannels()) n = 0; // loop around channelLocked = false; - for (int k=0; k<NOTE_MAX; k++) + for (int k = 0; k < NOTE_MAX; k++) { - if (activeNoteChannel[k]==n || splitActiveNoteChannel[k]==n) + if (activeNoteChannel[k] == n || splitActiveNoteChannel[k] == n) { channelLocked = true; break; } } - if (pModDoc->IsChannelRecord(n)==recordGroup && !channelLocked) + if (pModDoc->IsChannelRecord(n) == recordGroup && !channelLocked) { - SetCurrentColumn(n<<3); + SetCurrentColumn(CreateCursor(0, n)); break; } } Modified: trunk/OpenMPT/mptrack/View_pat.h =================================================================== --- trunk/OpenMPT/mptrack/View_pat.h 2011-09-24 22:59:29 UTC (rev 1055) +++ trunk/OpenMPT/mptrack/View_pat.h 2011-09-25 00:38:55 UTC (rev 1056) @@ -120,13 +120,13 @@ DWORD m_dwStartSel, m_dwDragPos; // Point where selection was started WORD ChnVUMeters[MAX_BASECHANNELS]; WORD OldVUMeters[MAX_BASECHANNELS]; - CListBox *ChnEffectList[MAX_BASECHANNELS]; //rewbs.patPlugName UINT m_nFoundInstrument; UINT m_nMenuOnChan; DWORD m_dwLastNoteEntryTime; //rewbs.customkeys UINT m_nLastPlayedChannel; //rewbs.customkeys bool m_bLastNoteEntryBlocked; + MODCOMMAND m_PCNoteEditMemory; // PC Note edit memory static MODCOMMAND m_cmdOld; // Quick cursor copy/paste data static FindReplaceStruct m_findReplace; // Find/replace data This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <sag...@us...> - 2011-09-25 22:22:44
|
Revision: 1058 http://modplug.svn.sourceforge.net/modplug/?rev=1058&view=rev Author: saga-games Date: 2011-09-25 22:22:38 +0000 (Sun, 25 Sep 2011) Log Message: ----------- [Imp] For plugins with no custom GUI, "Record Params" is now also working. Modified Paths: -------------- trunk/OpenMPT/mptrack/DefaultVstEditor.cpp trunk/OpenMPT/mptrack/Vstplug.cpp Modified: trunk/OpenMPT/mptrack/DefaultVstEditor.cpp =================================================================== --- trunk/OpenMPT/mptrack/DefaultVstEditor.cpp 2011-09-25 22:10:17 UTC (rev 1057) +++ trunk/OpenMPT/mptrack/DefaultVstEditor.cpp 2011-09-25 22:22:38 UTC (rev 1058) @@ -148,14 +148,22 @@ void CDefaultVstEditor::OnParamSliderChanged() //---------------------------------------------- { - if (m_nControlLock) { // Lock will be set if the GUI change was triggered internally (in UpdateParamDisplays). - return; // We're only interested in handling changes triggered by the user. + if (m_nControlLock) + { + // Lock will be set if the GUI change was triggered internally (in UpdateParamDisplays). + // We're only interested in handling changes triggered by the user. + return; } - //Extract value and notify plug + // Extract value and notify plug int val = PARAM_RESOLUTION-m_slParam.GetPos(); - m_pVstPlugin->SetParameter(m_nCurrentParam, val/static_cast<float>(PARAM_RESOLUTION)); - + m_pVstPlugin->SetParameter(m_nCurrentParam, val / static_cast<float>(PARAM_RESOLUTION)); + + if(m_pVstPlugin->m_bRecordAutomation) + { + m_pVstPlugin->GetModDoc()->RecordParamChange(m_pVstPlugin->GetSlot(), m_nCurrentParam); + } + UpdateParamDisplays(); // update other GUI controls m_pVstPlugin->GetModDoc()->SetModified(); @@ -166,7 +174,9 @@ void CDefaultVstEditor::UpdateParamDisplays() //------------------------------------------- { - if (m_nControlLock) { //Just to make sure we're not here as a consequence of an internal GUI change. + if (m_nControlLock) + { + //Just to make sure we're not here as a consequence of an internal GUI change. return; } @@ -180,11 +190,13 @@ m_pVstPlugin->GetParamDisplay(m_nCurrentParam, sdisplay); wsprintf(label, "%s %s", sdisplay, sunits); - //Update the GUI controls + // Update the GUI controls m_nControlLock++; // Set lock to indicate that the changes to the GUI are internal - no need to notify the plug and re-update GUI. m_statParamLabel.SetWindowText(label); m_slParam.SetPos(PARAM_RESOLUTION-val); - if (&m_editParam != m_editParam.GetFocus()) { //Don't update textbox when it has focus, else this will prevent user from changing the content + if (&m_editParam != m_editParam.GetFocus()) + { + // Don't update textbox when it has focus, else this will prevent user from changing the content m_editParam.SetWindowText(s); } m_nControlLock--; // Unset lock - done with internal GUI updates. Modified: trunk/OpenMPT/mptrack/Vstplug.cpp =================================================================== --- trunk/OpenMPT/mptrack/Vstplug.cpp 2011-09-25 22:10:17 UTC (rev 1057) +++ trunk/OpenMPT/mptrack/Vstplug.cpp 2011-09-25 22:22:38 UTC (rev 1058) @@ -690,7 +690,7 @@ { CVstPlugin *pVstPlugin = ((CVstPlugin*)effect->resvd1); - //Mark track modified + // Mark track modified CModDoc* pModDoc = pVstPlugin->GetModDoc(); if (pModDoc) { @@ -705,9 +705,10 @@ //pModDoc->UpdateAllViews(NULL, HINT_MIXPLUGINS, NULL); } - //Record param change + // Record param change if (pVstPlugin->m_bRecordAutomation) { + // Note that audioMasterAutomate is not called when using our own plugin GUI. For those plugins, the same mechanism is called from CDefaultVstEditor::OnParamSliderChanged(). pModDoc->RecordParamChange(pVstPlugin->GetSlot(), index); } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <sag...@us...> - 2011-09-27 16:42:12
|
Revision: 1059 http://modplug.svn.sourceforge.net/modplug/?rev=1059&view=rev Author: saga-games Date: 2011-09-27 16:42:05 +0000 (Tue, 27 Sep 2011) Log Message: ----------- [Fix] Sample Editor: Deleting some sample data adjusted loop points, but not sustain points. Modified Paths: -------------- trunk/OpenMPT/mptrack/View_smp.cpp trunk/OpenMPT/mptrack/View_smp.h Modified: trunk/OpenMPT/mptrack/View_smp.cpp =================================================================== --- trunk/OpenMPT/mptrack/View_smp.cpp 2011-09-25 22:22:38 UTC (rev 1058) +++ trunk/OpenMPT/mptrack/View_smp.cpp 2011-09-27 16:42:05 UTC (rev 1059) @@ -1720,6 +1720,41 @@ } +// Update loop points after deleting a sample selection +void CViewSample::AdjustLoopPoints(UINT &loopStart, UINT &loopEnd, UINT length) const +//----------------------------------------------------------------------------------- +{ + if(m_dwBeginSel < loopStart && m_dwEndSel < loopStart) + { + // cut part is before loop start + loopStart -= m_dwEndSel - m_dwBeginSel; + loopEnd -= m_dwEndSel - m_dwBeginSel; + } + else if(m_dwBeginSel < loopStart && m_dwEndSel < loopEnd) + { + // cut part is partly before loop start + loopStart = m_dwBeginSel; + loopEnd -= m_dwEndSel - m_dwBeginSel; + } + else if(m_dwBeginSel >= loopStart && m_dwEndSel < loopEnd) + { + // cut part is in the loop + loopEnd -= m_dwEndSel - m_dwBeginSel; + } + else if(m_dwBeginSel >= loopStart && m_dwBeginSel < loopEnd && m_dwEndSel > loopEnd) + { + // cut part is partly before loop end + loopEnd = m_dwBeginSel; + } + + if(loopEnd > length) loopEnd = length; + if(loopStart + 4 >= loopEnd) + { + loopStart = loopEnd = 0; + } +} + + void CViewSample::OnEditDelete() //------------------------------ { @@ -1774,35 +1809,19 @@ } len = sample.nLength; - // adjust loop points (could need some optimization) - if(m_dwBeginSel < sample.nLoopStart && m_dwEndSel < sample.nLoopStart) + + // adjust loop points + AdjustLoopPoints(sample.nLoopStart, sample.nLoopEnd, len); + AdjustLoopPoints(sample.nSustainStart, sample.nSustainEnd, len); + + if(sample.nLoopEnd == 0) { - // cut part is before loop start - sample.nLoopStart -= m_dwEndSel - m_dwBeginSel; - sample.nLoopEnd -= m_dwEndSel - m_dwBeginSel; + sample.uFlags &= ~(CHN_LOOP | CHN_PINGPONGLOOP); } - else if(m_dwBeginSel < sample.nLoopStart && m_dwEndSel < sample.nLoopEnd) - { - // cut part is partly before loop start - sample.nLoopStart = m_dwBeginSel; - sample.nLoopEnd -= m_dwEndSel - m_dwBeginSel; - } - else if(m_dwBeginSel >= sample.nLoopStart && m_dwEndSel < sample.nLoopEnd) - { - // cut part is in the loop - sample.nLoopEnd -= m_dwEndSel - m_dwBeginSel; - } - else if(m_dwBeginSel >= sample.nLoopStart && m_dwBeginSel < sample.nLoopEnd && m_dwEndSel > sample.nLoopEnd) - { - // cut part is partly before loop end - sample.nLoopEnd = m_dwBeginSel; - } - if (sample.nLoopEnd > len) sample.nLoopEnd = len; - if (sample.nLoopStart + 4 >= sample.nLoopEnd) + if(sample.nSustainEnd == 0) { - sample.nLoopStart = sample.nLoopEnd = 0; - sample.uFlags &= ~CHN_LOOP; + sample.uFlags &= ~(CHN_SUSTAINLOOP | CHN_PINGPONGSUSTAIN); } } SetCurSel(0, 0); @@ -1844,7 +1863,7 @@ dwMemSize += sizeof(WAVEFILEHEADER) + sizeof(WAVEFORMATHEADER) + sizeof(WAVEDATAHEADER) + sizeof(WAVEEXTRAHEADER) + sizeof(WAVESAMPLERINFO); // For name + fname - dwMemSize += 32*2; + dwMemSize += 32 * 2; BeginWaitCursor(); if ((pMainFrm->OpenClipboard()) && ((hCpy = GlobalAlloc(GMEM_MOVEABLE|GMEM_DDESHARE, dwMemSize))!=NULL)) { @@ -1866,16 +1885,16 @@ } pfmt->channels = (sample.uFlags & CHN_STEREO) ? (WORD)2 : (WORD)1; pfmt->bitspersample = (sample.uFlags & CHN_16BIT) ? (WORD)16 : (WORD)8; - pfmt->samplesize = pfmt->channels*pfmt->bitspersample/8; + pfmt->samplesize = pfmt->channels * pfmt->bitspersample / 8; pfmt->bytessec = pfmt->freqHz*pfmt->samplesize; pdata->id_data = IFFID_data; pdata->length = dwSmpLen; phdr->filesize += pdata->length; - LPBYTE psamples = p+sizeof(WAVEFILEHEADER)+sizeof(WAVEFORMATHEADER)+sizeof(WAVEDATAHEADER); + LPBYTE psamples = p + sizeof(WAVEFILEHEADER) + sizeof(WAVEFORMATHEADER) + sizeof(WAVEDATAHEADER); memcpy(psamples, sample.pSample+dwSmpOffset, dwSmpLen); if (pfmt->bitspersample == 8) { - for (UINT i=0; i<dwSmpLen; i++) psamples[i] += 0x80; + for (UINT i = 0; i < dwSmpLen; i++) psamples[i] += 0x80; } if (bExtra) { Modified: trunk/OpenMPT/mptrack/View_smp.h =================================================================== --- trunk/OpenMPT/mptrack/View_smp.h 2011-09-25 22:22:38 UTC (rev 1058) +++ trunk/OpenMPT/mptrack/View_smp.h 2011-09-27 16:42:05 UTC (rev 1059) @@ -30,7 +30,7 @@ CViewSample(); DECLARE_SERIAL(CViewSample) -public: +protected: void UpdateScrollSize() {UpdateScrollSize(m_nZoom);} void UpdateScrollSize(const UINT nZoomOld); BOOL SetCurrentSample(SAMPLEINDEX nSmp); @@ -69,6 +69,8 @@ UINT ScrollPosToSamplePos() const {return ScrollPosToSamplePos(m_nZoom);} UINT ScrollPosToSamplePos(UINT nZoom) const {return (nZoom > 0) ? (m_nScrollPos << (nZoom - 1)) : 0;} + void AdjustLoopPoints(UINT &loopStart, UINT &loopEnd, UINT length) const; + public: //{{AFX_VIRTUAL(CViewSample) virtual void OnDraw(CDC *); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <sag...@us...> - 2011-09-27 23:34:45
|
Revision: 1061 http://modplug.svn.sourceforge.net/modplug/?rev=1061&view=rev Author: saga-games Date: 2011-09-27 23:34:38 +0000 (Tue, 27 Sep 2011) Log Message: ----------- [New] Added shortcuts to increase/decrease row spacing (http://bugs.openmpt.org/view.php?id=181) Modified Paths: -------------- trunk/OpenMPT/mptrack/CommandSet.cpp trunk/OpenMPT/mptrack/CommandSet.h trunk/OpenMPT/mptrack/View_pat.cpp Modified: trunk/OpenMPT/mptrack/CommandSet.cpp =================================================================== --- trunk/OpenMPT/mptrack/CommandSet.cpp 2011-09-27 21:41:21 UTC (rev 1060) +++ trunk/OpenMPT/mptrack/CommandSet.cpp 2011-09-27 23:34:38 UTC (rev 1061) @@ -386,7 +386,7 @@ DefineKeyCommand(kcCopySelectWithNav, 1314, _T("kcCopySelectWithNav"), kcHidden, kcNoDummy); DefineKeyCommand(kcCopySelectOffWithNav, 1315, _T("kcCopySelectOffWithNav"), kcHidden, kcNoDummy); DefineKeyCommand(kcChordModifier, 1316, _T("Chord Modifier"), kcVisible, kcDummy); - DefineKeyCommand(kcSetSpacing, 1317, _T("Set row jump on note entry"), kcVisible, kcDummy); + DefineKeyCommand(kcSetSpacing, 1317, _T("Set row spacing on note entry"), kcVisible, kcDummy); DefineKeyCommand(kcSetSpacing0, 1318, _T(""), kcHidden, kcNoDummy); DefineKeyCommand(kcSetSpacing1, 1319, _T(""), kcHidden, kcNoDummy); DefineKeyCommand(kcSetSpacing2, 1320, _T(""), kcHidden, kcNoDummy); @@ -607,6 +607,8 @@ DefineKeyCommand(kcSelectBeat, 1858, _T("Select beat")); DefineKeyCommand(kcSelectMeasure, 1859, _T("Select measure")); DefineKeyCommand(kcFileSaveTemplate, 1860, _T("File/Save As Template")); + DefineKeyCommand(kcIncreaseSpacing, 1861, _T("Increase row spacing")); + DefineKeyCommand(kcDecreaseSpacing, 1862, _T("Decrease row spacing")); // Add new key commands here. #ifdef _DEBUG Modified: trunk/OpenMPT/mptrack/CommandSet.h =================================================================== --- trunk/OpenMPT/mptrack/CommandSet.h 2011-09-27 21:41:21 UTC (rev 1060) +++ trunk/OpenMPT/mptrack/CommandSet.h 2011-09-27 23:34:38 UTC (rev 1061) @@ -223,6 +223,8 @@ kcSetSpacing7, kcSetSpacing8, kcSetSpacing9, + kcIncreaseSpacing, + kcDecreaseSpacing, kcSwitchToOrderList, kcNewPattern, kcDuplicatePattern, Modified: trunk/OpenMPT/mptrack/View_pat.cpp =================================================================== --- trunk/OpenMPT/mptrack/View_pat.cpp 2011-09-27 21:41:21 UTC (rev 1060) +++ trunk/OpenMPT/mptrack/View_pat.cpp 2011-09-27 23:34:38 UTC (rev 1061) @@ -3895,6 +3895,13 @@ case kcSwitchOverflowPaste: CMainFrame::GetSettings().m_dwPatternSetup ^= PATTERN_OVERFLOWPASTE; return wParam; case kcPatternEditPCNotePlugin: OnTogglePCNotePluginEditor(); return wParam; + case kcDecreaseSpacing: + if(m_nSpacing > 0) SetSpacing(m_nSpacing - 1); + break; + case kcIncreaseSpacing: + if(m_nSpacing < MAX_SPACING) SetSpacing(m_nSpacing + 1); + break; + } //Ranges: if (wParam>=kcVPStartNotes && wParam<=kcVPEndNotes) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <sag...@us...> - 2011-09-29 20:59:36
|
Revision: 1065 http://modplug.svn.sourceforge.net/modplug/?rev=1065&view=rev Author: saga-games Date: 2011-09-29 20:59:29 +0000 (Thu, 29 Sep 2011) Log Message: ----------- [Ref] Various refactoring in view_pat [Imp] Pattern Editor: Context menu entry for effect column is now adjusted when interpolating PC notes. 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-09-28 21:04:23 UTC (rev 1064) +++ trunk/OpenMPT/mptrack/View_pat.cpp 2011-09-29 20:59:29 UTC (rev 1065) @@ -141,7 +141,6 @@ m_pRandomizer = NULL; m_bLastNoteEntryBlocked=false; - m_nMenuOnChan = 0; m_nPattern = 0; m_nDetailLevel = 4; m_pEditWnd = NULL; @@ -192,8 +191,8 @@ } -BOOL CViewPattern::SetCurrentPattern(UINT npat, ROWINDEX nrow) -//------------------------------------------------------------ +BOOL CViewPattern::SetCurrentPattern(PATTERNINDEX npat, ROWINDEX nrow) +//-------------------------------------------------------------------- { CSoundFile *pSndFile; CModDoc *pModDoc = GetDocument(); @@ -641,7 +640,7 @@ if ((pMsg->message == WM_SYSKEYUP) || (pMsg->message == WM_KEYUP) || (pMsg->message == WM_SYSKEYDOWN) || (pMsg->message == WM_KEYDOWN)) { - CInputHandler* ih = (CMainFrame::GetMainFrame())->GetInputHandler(); + CInputHandler *ih = (CMainFrame::GetMainFrame())->GetInputHandler(); //Translate message manually UINT nChar = pMsg->wParam; @@ -1321,7 +1320,7 @@ if ((nChn < pSndFile->GetNumChannels()) && (pSndFile->Patterns[m_nPattern])) { CString MenuText; - CInputHandler* ih = (CMainFrame::GetMainFrame())->GetInputHandler(); + CInputHandler *ih = (CMainFrame::GetMainFrame())->GetInputHandler(); //------ Plugin Header Menu --------- : if ((m_dwStatus & PATSTATUS_PLUGNAMESINHEADERS) && @@ -1531,7 +1530,7 @@ { const CHANNELINDEX nChn = GetChanFromCursor(m_nMenuParam); CModDoc *pModDoc = GetDocument(); - CSoundFile* pSndFile; + CSoundFile *pSndFile; if (pModDoc == 0 || (pSndFile = pModDoc->GetSoundFile()) == 0) return; const bool bIsMuted = pModDoc->IsChannelMuted(nChn); @@ -1871,7 +1870,7 @@ } if (m_pGotoWnd) { - CSoundFile* pSndFile = pModDoc->GetSoundFile(); + CSoundFile *pSndFile = pModDoc->GetSoundFile(); UINT nCurrentOrder = SendCtrlMessage(CTRLMSG_GETCURRENTORDER); UINT nCurrentChannel = GetChanFromCursor(m_dwCursor) + 1; @@ -2739,7 +2738,7 @@ //---------------------------------- { CModDoc *pModDoc = GetDocument(); - CSoundFile* pSndFile; + CSoundFile *pSndFile; if (pModDoc == nullptr || (pSndFile = pModDoc->GetSoundFile()) == nullptr) return; if(pSndFile->m_nChannels <= pSndFile->GetModSpecifications().channelsMin) @@ -3108,10 +3107,9 @@ if ((!pModDoc) || (!pnotify)) return 0; if (pnotify->dwType & MPTNOTIFY_POSITION) { - UINT nOrd = pnotify->nOrder; - UINT nRow = pnotify->nRow; - //UINT nPat = 0xFFFF; - UINT nPat = pnotify->nPattern; //get player pattern + ORDERINDEX nOrd = pnotify->nOrder; + ROWINDEX nRow = pnotify->nRow; + PATTERNINDEX nPat = pnotify->nPattern; //get player pattern CSoundFile *pSndFile = pModDoc->GetSoundFile(); bool updateOrderList = false; @@ -3146,7 +3144,7 @@ if (nOrd >= pSndFile->Order.GetLength() || pSndFile->Order[nOrd] != nPat) { //order doesn't correlate with pattern, so mark it as invalid - nOrd = 0xFFFF; + nOrd = ORDERINDEX_INVALID; } if (m_pEffectVis && m_pEffectVis->m_hWnd) @@ -3198,7 +3196,6 @@ //------------------------------------------------------------------------------- { CModDoc *pModDoc = GetDocument(); - //if (!m_bRecord || !pModDoc) { if (!IsEditingEnabled() || !pModDoc) { return 0; @@ -3321,7 +3318,7 @@ if ((!pModDoc) || (!pMainFrm)) return 0; - CSoundFile* pSndFile = pModDoc->GetSoundFile(); + CSoundFile *pSndFile = pModDoc->GetSoundFile(); if(!pSndFile) return 0; //Midi message from our perspective: @@ -4252,18 +4249,18 @@ if(usePlaybackPosition) SetEditPos(*pSndFile, nRow, nPat, nRowPlayback, nPatPlayback); - MODCOMMAND* p = pSndFile->Patterns[nPat].GetpModCommand(nRow, nChn); + MODCOMMAND* pTarget = pSndFile->Patterns[nPat].GetpModCommand(nRow, nChn); //don't overwrite: - if (p->note || p->instr || p->volcmd) + if (pTarget->note || pTarget->instr || pTarget->volcmd) { //if there's a note in the current location and the song is playing and following, //the user probably just tapped the key - let's try the next row down. nRow++; - if (p->note==note && bIsLiveRecord && pSndFile->Patterns[nPat].IsValidRow(nRow)) + if (pTarget->note==note && bIsLiveRecord && pSndFile->Patterns[nPat].IsValidRow(nRow)) { - p = pSndFile->Patterns[nPat].GetpModCommand(nRow, nChn); - if (p->note || (!bChordMode && (p->instr || p->volcmd)) ) + pTarget = pSndFile->Patterns[nPat].GetpModCommand(nRow, nChn); + if (pTarget->note || (!bChordMode && (pTarget->instr || pTarget->volcmd)) ) return; } else @@ -4275,33 +4272,33 @@ // -- write sdx if playing live if (usePlaybackPosition && nTick) { // avoid SD0 which will be mis-interpreted - if (p->command == 0) { //make sure we don't overwrite any existing commands. - p->command = (pSndFile->TypeIsS3M_IT_MPT()) ? CMD_S3MCMDEX : CMD_MODCMDEX; - p->param = 0xD0 | min(0xF, nTick); + if (pTarget->command == 0) { //make sure we don't overwrite any existing commands. + pTarget->command = (pSndFile->TypeIsS3M_IT_MPT()) ? CMD_S3MCMDEX : CMD_MODCMDEX; + pTarget->param = 0xD0 | min(0xF, nTick); } } //Enter note off if(pSndFile->GetModSpecifications().hasNoteOff) // === - p->note = NOTE_KEYOFF; + pTarget->note = NOTE_KEYOFF; else if(pSndFile->GetModSpecifications().hasNoteCut) // ^^^ - p->note = NOTE_NOTECUT; + pTarget->note = NOTE_NOTECUT; else { // we don't have anything to cut (MOD format) - use volume or ECx if(usePlaybackPosition && nTick) // ECx { - p->command = (pSndFile->TypeIsS3M_IT_MPT()) ? CMD_S3MCMDEX : CMD_MODCMDEX; - p->param = 0xC0 | min(0xF, nTick); + pTarget->command = (pSndFile->TypeIsS3M_IT_MPT()) ? CMD_S3MCMDEX : CMD_MODCMDEX; + pTarget->param = 0xC0 | min(0xF, nTick); } else // C00 { - p->note = NOTE_NONE; - p->command = CMD_VOLUME; - p->param = 0; + pTarget->note = NOTE_NONE; + pTarget->command = CMD_VOLUME; + pTarget->param = 0; } } - p->instr = (bChordMode) ? 0 : ins; //p->instr = 0; + pTarget->instr = (bChordMode) ? 0 : ins; //p->instr = 0; //Writing the instrument as well - probably someone finds this annoying :) - p->volcmd = 0; - p->vol = 0; + pTarget->volcmd = VOLCMD_NONE; + pTarget->vol = 0; pModDoc->SetModified(); @@ -4332,8 +4329,8 @@ UINT nChn = GetChanFromCursor(m_dwCursor); PrepareUndo(m_dwBeginSel, m_dwEndSel); - MODCOMMAND* p = pSndFile->Patterns[m_nPattern].GetpModCommand(m_nRow, nChn); - MODCOMMAND oldcmd = *p; // This is the command we are about to overwrite + MODCOMMAND* pTarget = pSndFile->Patterns[m_nPattern].GetpModCommand(m_nRow, nChn); + MODCOMMAND oldcmd = *pTarget; // This is the command we are about to overwrite if (oldcmd.note) { TempEnterNote(((oldcmd.note - 1) % 12) + val * 12 + 1); @@ -4358,11 +4355,11 @@ UINT nChn = GetChanFromCursor(m_dwCursor); PrepareUndo(m_dwBeginSel, m_dwEndSel); - MODCOMMAND *p = pSndFile->Patterns[m_nPattern].GetpModCommand(m_nRow, nChn); - MODCOMMAND oldcmd = *p; // This is the command we are about to overwrite + MODCOMMAND *pTarget = pSndFile->Patterns[m_nPattern].GetpModCommand(m_nRow, nChn); + MODCOMMAND oldcmd = *pTarget; // This is the command we are about to overwrite - UINT instr = p->instr, nTotalMax, nTempMax; - if(p->IsPcNote()) // this is a plugin index + UINT instr = pTarget->instr, nTotalMax, nTempMax; + if(pTarget->IsPcNote()) // this is a plugin index { nTotalMax = MAX_MIXPLUGINS + 1; nTempMax = MAX_MIXPLUGINS + 1; @@ -4381,28 +4378,28 @@ if (nTempMax < 100) // if we're using samples & have less than 100 samples instr = instr % 100; // or if we're using instruments and have less than 100 instruments // --> ensure the entered instrument value is less than 100. - p->instr = instr; + pTarget->instr = instr; if (IsEditingEnabled_bmsg()) { DWORD sel = CreateCursor(m_nRow) | m_dwCursor; SetCurSel(sel, sel); sel &= ~7; - if(*p != oldcmd) + if(*pTarget != oldcmd) { pModDoc->SetModified(); InvalidateArea(sel, sel + LAST_COLUMN); UpdateIndicator(); } - if(p->IsPcNote()) + if(pTarget->IsPcNote()) { - m_PCNoteEditMemory = *p; + m_PCNoteEditMemory = *pTarget; } } else { // recording disabled - *p = oldcmd; + *pTarget = oldcmd; } } } @@ -4417,7 +4414,6 @@ if ((pModDoc) && (pMainFrm)) { - bool modified = false; ROWINDEX nRow = m_nRow; CSoundFile *pSndFile = pModDoc->GetSoundFile(); const ROWINDEX nRowPlayback = pSndFile->m_nRow; @@ -4427,10 +4423,10 @@ const bool bRecordEnabled = IsEditingEnabled(); const CHANNELINDEX nChn = GetChanFromCursor(m_dwCursor); - if(note > pSndFile->GetModSpecifications().noteMax && note < NOTE_MIN_SPECIAL) - note = pSndFile->GetModSpecifications().noteMax; - else if( note < pSndFile->GetModSpecifications().noteMin) - note = pSndFile->GetModSpecifications().noteMin; + if(note < NOTE_MIN_SPECIAL) + { + Limit(note, pSndFile->GetModSpecifications().noteMin, pSndFile->GetModSpecifications().noteMax); + } // Special case: Convert note off commands to C00 for MOD files if((pSndFile->GetType() == MOD_TYPE_MOD) && (note == NOTE_NOTECUT || note == NOTE_FADE || note == NOTE_KEYOFF)) @@ -4440,10 +4436,12 @@ } // Check whether the module format supports the note. - if( pSndFile->GetModSpecifications().HasNote(note) == false ) + if(pSndFile->GetModSpecifications().HasNote(note) == false) + { return; + } - BYTE recordGroup = pModDoc->IsChannelRecord(nChn); + const BYTE recordGroup = pModDoc->IsChannelRecord(nChn); const bool bIsLiveRecord = IsLiveRecord(*pMainFrm, *pModDoc, *pSndFile); const bool usePlaybackPosition = (bIsLiveRecord && (CMainFrame::GetSettings().m_dwPatternSetup & PATTERN_AUTODELAY) && !(pSndFile->m_dwSongFlags & SONG_STEP)); bool isSplit = false; @@ -4470,30 +4468,20 @@ MODCOMMAND *pTarget = pSndFile->Patterns[nPat].GetpModCommand(nRow, nChn); MODCOMMAND newcmd = *pTarget; - // If record is enabled, create undo point. - if(bRecordEnabled) - { - pModDoc->GetPatternUndo()->PrepareUndo(nPat, nChn, nRow, 1, 1); - } - // Param control 'note' if(MODCOMMAND::IsPcNote(note)) { - if(bRecordEnabled) + if(!pTarget->IsPcNote()) { - if(!pTarget->IsPcNote()) - { - // We're overwriting a normal cell with a PC note. - newcmd = m_PCNoteEditMemory; - } else - { - // Just update PC note edit memory. - m_PCNoteEditMemory = newcmd; - } - - newcmd.note = note; - modified = true; + // We're overwriting a normal cell with a PC note. + newcmd = m_PCNoteEditMemory; + } else if(bRecordEnabled) + { + // Pick up current entry to update PC note edit memory. + m_PCNoteEditMemory = newcmd; } + + newcmd.note = note; } else { @@ -4558,11 +4546,12 @@ } - // -- if recording, write out modified command. - if (bRecordEnabled && *pTarget != newcmd) + // -- if recording, create undo point and write out modified command. + const bool modified = (bRecordEnabled && *pTarget != newcmd); + if (modified) { + pModDoc->GetPatternUndo()->PrepareUndo(nPat, nChn, nRow, 1, 1); *pTarget = newcmd; - modified = true; } @@ -4583,15 +4572,15 @@ // just play the newly inserted note using the already specified instrument... UINT nPlayIns = newcmd.instr; - if(!nPlayIns && (note <= NOTE_MAX)) + if(!nPlayIns && NOTE_IS_VALID(note)) { // ...or one that can be found on a previous row of this pattern. MODCOMMAND *search = pTarget; - UINT srow = nRow; - while (srow-- > 0) + ROWINDEX srow = nRow; + while(srow-- > 0) { - search -= pSndFile->m_nChannels; - if (search->instr) + search -= pSndFile->GetNumChannels(); + if (search->instr && !search->IsPcNote()) { nPlayIns = search->instr; m_nFoundInstrument = nPlayIns; //used to figure out which instrument to stop on key release. @@ -4600,8 +4589,7 @@ } } BOOL bNotPlaying = ((pMainFrm->GetModPlaying() == pModDoc) && (pMainFrm->IsPlaying())) ? FALSE : TRUE; - //pModDoc->PlayNote(p->note, nPlayIns, 0, bNotPlaying, -1, 0, 0, nChn); //rewbs.vstiLive - added extra args - pModDoc->PlayNote(newcmd.note, nPlayIns, 0, bNotPlaying, 4*vol, 0, 0, nChn); //rewbs.vstiLive - added extra args + pModDoc->PlayNote(newcmd.note, nPlayIns, 0, bNotPlaying, 4 * vol, 0, 0, nChn); } } @@ -4948,7 +4936,7 @@ int plug = pSndFile->ChnSettings[chan].nMixPlugin; if (plug > 0) - pModDoc->TogglePluginEditor(plug-1); + pModDoc->TogglePluginEditor(plug - 1); return; } @@ -5004,12 +4992,13 @@ CModDoc *pModDoc = GetDocument(); if (!pModDoc) return; CSoundFile *pSndFile = pModDoc->GetSoundFile(); if (!pSndFile) return; - if (m_nMenuOnChan) + const CHANNELINDEX plugChannel = GetChanFromCursor(m_nMenuParam); + if (plugChannel < pSndFile->GetNumChannels()) { - UINT newPlug = nID-ID_PLUGSELECT; - if (newPlug <= MAX_MIXPLUGINS && newPlug != pSndFile->ChnSettings[m_nMenuOnChan-1].nMixPlugin) + UINT newPlug = nID - ID_PLUGSELECT; + if (newPlug <= MAX_MIXPLUGINS && newPlug != pSndFile->ChnSettings[plugChannel].nMixPlugin) { - pSndFile->ChnSettings[m_nMenuOnChan-1].nMixPlugin = newPlug; + pSndFile->ChnSettings[plugChannel].nMixPlugin = newPlug; if(pSndFile->GetModSpecifications().supportsPlugins) pModDoc->SetModified(); InvalidateChannelsHeaders(); @@ -5051,24 +5040,24 @@ return isSplit; } -bool CViewPattern::BuildPluginCtxMenu(HMENU hMenu, UINT nChn, CSoundFile* pSndFile) -//--------------------------------------------------------------------------------- +bool CViewPattern::BuildPluginCtxMenu(HMENU hMenu, UINT nChn, CSoundFile *pSndFile) const +//--------------------------------------------------------------------------------------- { - CHAR s[512]; bool itemFound; for (UINT plug=0; plug<=MAX_MIXPLUGINS; plug++) { itemFound=false; - s[0] = 0; + CHAR s[64] = { '\0' }; + if (!plug) { strcpy(s, "No plugin"); itemFound=true; } else { - PSNDMIXPLUGIN p = &(pSndFile->m_MixPlugins[plug-1]); + PSNDMIXPLUGIN p = &(pSndFile->m_MixPlugins[plug - 1]); if (p->Info.szLibraryName[0]) { wsprintf(s, "FX%d: %s", plug, p->Info.szName); @@ -5078,21 +5067,20 @@ if (itemFound) { - m_nMenuOnChan = nChn + 1; if (plug == pSndFile->ChnSettings[nChn].nMixPlugin) { - AppendMenu(hMenu, (MF_STRING|MF_CHECKED), ID_PLUGSELECT+plug, s); + AppendMenu(hMenu, (MF_STRING | MF_CHECKED), ID_PLUGSELECT + plug, s); } else { - AppendMenu(hMenu, MF_STRING, ID_PLUGSELECT+plug, s); + AppendMenu(hMenu, MF_STRING, ID_PLUGSELECT + plug, s); } } } return true; } -bool CViewPattern::BuildSoloMuteCtxMenu(HMENU hMenu, CInputHandler* ih, UINT nChn, CSoundFile* pSndFile) -//------------------------------------------------------------------------------------------------------ +bool CViewPattern::BuildSoloMuteCtxMenu(HMENU hMenu, CInputHandler *ih, UINT nChn, CSoundFile *pSndFile) const +//------------------------------------------------------------------------------------------------------------ { AppendMenu(hMenu, (pSndFile->ChnSettings[nChn].dwFlags & CHN_MUTE) ? (MF_STRING|MF_CHECKED) : MF_STRING, ID_PATTERN_MUTE, @@ -5133,8 +5121,8 @@ return true; } -bool CViewPattern::BuildRecordCtxMenu(HMENU hMenu, UINT nChn, CModDoc* pModDoc) -//----------------------------------------------------------------------------- +bool CViewPattern::BuildRecordCtxMenu(HMENU hMenu, UINT nChn, CModDoc* pModDoc) const +//----------------------------------------------------------------------------------- { AppendMenu(hMenu, pModDoc->IsChannelRecord1(nChn) ? (MF_STRING|MF_CHECKED) : MF_STRING, ID_EDIT_RECSELECT, "Record select"); AppendMenu(hMenu, pModDoc->IsChannelRecord2(nChn) ? (MF_STRING|MF_CHECKED) : MF_STRING, ID_EDIT_SPLITRECSELECT, "Split Record select"); @@ -5143,8 +5131,8 @@ -bool CViewPattern::BuildRowInsDelCtxMenu(HMENU hMenu, CInputHandler* ih) -//---------------------------------------------------------------------- +bool CViewPattern::BuildRowInsDelCtxMenu(HMENU hMenu, CInputHandler *ih) const +//---------------------------------------------------------------------------- { const CString label = (GetSelectionStartRow() != GetSelectionEndRow() ? "Rows" : "Row"); @@ -5153,31 +5141,31 @@ return true; } -bool CViewPattern::BuildMiscCtxMenu(HMENU hMenu, CInputHandler* ih) -//----------------------------------------------------------------- +bool CViewPattern::BuildMiscCtxMenu(HMENU hMenu, CInputHandler *ih) const +//----------------------------------------------------------------------- { AppendMenu(hMenu, MF_STRING, ID_SHOWTIMEATROW, "Show row play time\t" + ih->GetKeyTextFromCommand(kcTimeAtRow)); return true; } -bool CViewPattern::BuildSelectionCtxMenu(HMENU hMenu, CInputHandler* ih) -//---------------------------------------------------------------------- +bool CViewPattern::BuildSelectionCtxMenu(HMENU hMenu, CInputHandler *ih) const +//---------------------------------------------------------------------------- { AppendMenu(hMenu, MF_STRING, ID_EDIT_SELECTCOLUMN, "Select Column\t" + ih->GetKeyTextFromCommand(kcSelectColumn)); AppendMenu(hMenu, MF_STRING, ID_EDIT_SELECT_ALL, "Select Pattern\t" + ih->GetKeyTextFromCommand(kcEditSelectAll)); return true; } -bool CViewPattern::BuildGrowShrinkCtxMenu(HMENU hMenu, CInputHandler* ih) -//---------------------------------------------------------------------- +bool CViewPattern::BuildGrowShrinkCtxMenu(HMENU hMenu, CInputHandler *ih) const +//----------------------------------------------------------------------------- { AppendMenu(hMenu, MF_STRING, ID_GROW_SELECTION, "Grow selection\t" + ih->GetKeyTextFromCommand(kcPatternGrowSelection)); AppendMenu(hMenu, MF_STRING, ID_SHRINK_SELECTION, "Shrink selection\t" + ih->GetKeyTextFromCommand(kcPatternShrinkSelection)); return true; } -bool CViewPattern::BuildNoteInterpolationCtxMenu(HMENU hMenu, CInputHandler* ih, CSoundFile* pSndFile) -//---------------------------------------------------------------------------------------------------- +bool CViewPattern::BuildNoteInterpolationCtxMenu(HMENU hMenu, CInputHandler *ih, CSoundFile *pSndFile) const +//---------------------------------------------------------------------------------------------------------- { CArray<UINT, UINT> validChans; DWORD greyed = MF_GRAYED; @@ -5198,16 +5186,16 @@ } } - if (!greyed || !(CMainFrame::GetSettings().m_dwPatternSetup&PATTERN_OLDCTXMENUSTYLE)) + if (!greyed || !(CMainFrame::GetSettings().m_dwPatternSetup & PATTERN_OLDCTXMENUSTYLE)) { - AppendMenu(hMenu, MF_STRING|greyed, ID_PATTERN_INTERPOLATE_NOTE, "Interpolate Note\t" + ih->GetKeyTextFromCommand(kcPatternInterpolateNote)); + AppendMenu(hMenu, MF_STRING | greyed, ID_PATTERN_INTERPOLATE_NOTE, "Interpolate Note\t" + ih->GetKeyTextFromCommand(kcPatternInterpolateNote)); return true; } return false; } -bool CViewPattern::BuildVolColInterpolationCtxMenu(HMENU hMenu, CInputHandler* ih, CSoundFile* pSndFile) -//------------------------------------------------------------------------------------------------------ +bool CViewPattern::BuildVolColInterpolationCtxMenu(HMENU hMenu, CInputHandler *ih, CSoundFile *pSndFile) const +//------------------------------------------------------------------------------------------------------------ { CArray<UINT, UINT> validChans; DWORD greyed = MF_GRAYED; @@ -5217,7 +5205,7 @@ if (ListChansWhereColSelected(VOL_COLUMN, validChans) > 0) { - for (int valChnIdx=0; valChnIdx<validChans.GetCount(); valChnIdx++) + for (int valChnIdx = 0; valChnIdx < validChans.GetCount(); valChnIdx++) { if (IsInterpolationPossible(startRow, endRow, validChans[valChnIdx], VOL_COLUMN, pSndFile)) @@ -5227,17 +5215,17 @@ } } } - if (!greyed || !(CMainFrame::GetSettings().m_dwPatternSetup&PATTERN_OLDCTXMENUSTYLE)) + if (!greyed || !(CMainFrame::GetSettings().m_dwPatternSetup & PATTERN_OLDCTXMENUSTYLE)) { - AppendMenu(hMenu, MF_STRING|greyed, ID_PATTERN_INTERPOLATE_VOLUME, "Interpolate Vol Col\t" + ih->GetKeyTextFromCommand(kcPatternInterpolateVol)); + AppendMenu(hMenu, MF_STRING | greyed, ID_PATTERN_INTERPOLATE_VOLUME, "Interpolate Vol Col\t" + ih->GetKeyTextFromCommand(kcPatternInterpolateVol)); return true; } return false; } -bool CViewPattern::BuildEffectInterpolationCtxMenu(HMENU hMenu, CInputHandler* ih, CSoundFile* pSndFile) -//------------------------------------------------------------------------------------------------------ +bool CViewPattern::BuildEffectInterpolationCtxMenu(HMENU hMenu, CInputHandler *ih, CSoundFile *pSndFile) const +//------------------------------------------------------------------------------------------------------------ { CArray<UINT, UINT> validChans; DWORD greyed = MF_GRAYED; @@ -5247,11 +5235,11 @@ if (ListChansWhereColSelected(EFFECT_COLUMN, validChans) > 0) { - for (int valChnIdx=0; valChnIdx<validChans.GetCount(); valChnIdx++) + for (int valChnIdx = 0; valChnIdx < validChans.GetCount(); valChnIdx++) { if (IsInterpolationPossible(startRow, endRow, validChans[valChnIdx], EFFECT_COLUMN, pSndFile)) { - greyed=0; //Can do interpolation. + greyed = 0; // Can do interpolation. break; } } @@ -5263,23 +5251,31 @@ { if (IsInterpolationPossible(startRow, endRow, validChans[valChnIdx], EFFECT_COLUMN, pSndFile)) { - greyed = 0; //Can do interpolation. + greyed = 0; // Can do interpolation. break; } } } - if (!greyed || !(CMainFrame::GetSettings().m_dwPatternSetup&PATTERN_OLDCTXMENUSTYLE)) + if (!greyed || !(CMainFrame::GetSettings().m_dwPatternSetup & PATTERN_OLDCTXMENUSTYLE)) { - AppendMenu(hMenu, MF_STRING|greyed, ID_PATTERN_INTERPOLATE_EFFECT, "Interpolate Effect\t" + ih->GetKeyTextFromCommand(kcPatternInterpolateEffect)); + // Figure out what we want to interpolate + CString interpolateWhat = "Effect"; + const CSoundFile *pSndFile = GetDocument() != nullptr ? GetDocument()->GetSoundFile() : nullptr; + if(pSndFile->Patterns.IsValidPat(m_nPattern) && pSndFile->Patterns[m_nPattern].GetpModCommand(GetSelectionStartRow(), GetSelectionStartChan())->IsPcNote()) + { + interpolateWhat = "Parameter"; + } + + AppendMenu(hMenu, MF_STRING | greyed, ID_PATTERN_INTERPOLATE_EFFECT, "Interpolate " + interpolateWhat + "\t" + ih->GetKeyTextFromCommand(kcPatternInterpolateEffect)); return true; } return false; } -bool CViewPattern::BuildEditCtxMenu(HMENU hMenu, CInputHandler* ih, CModDoc* pModDoc) -//----------------------------------------------------------------------------------- +bool CViewPattern::BuildEditCtxMenu(HMENU hMenu, CInputHandler *ih, CModDoc* pModDoc) const +//----------------------------------------------------------------------------------------- { HMENU pasteSpecialMenu = ::CreatePopupMenu(); AppendMenu(hMenu, MF_STRING, ID_EDIT_CUT, "Cut\t" + ih->GetKeyTextFromCommand(kcEditCut)); @@ -5302,31 +5298,32 @@ return true; } -bool CViewPattern::BuildVisFXCtxMenu(HMENU hMenu, CInputHandler* ih) -//------------------------------------------------------------------ +bool CViewPattern::BuildVisFXCtxMenu(HMENU hMenu, CInputHandler *ih) const +//------------------------------------------------------------------------ { CArray<UINT, UINT> validChans; - DWORD greyed = (ListChansWhereColSelected(EFFECT_COLUMN, validChans)>0)?FALSE:MF_GRAYED; + DWORD greyed = (ListChansWhereColSelected(EFFECT_COLUMN, validChans) > 0) ? FALSE:MF_GRAYED; - if (!greyed || !(CMainFrame::GetSettings().m_dwPatternSetup&PATTERN_OLDCTXMENUSTYLE)) { + if (!greyed || !(CMainFrame::GetSettings().m_dwPatternSetup & PATTERN_OLDCTXMENUSTYLE)) + { AppendMenu(hMenu, MF_STRING|greyed, ID_PATTERN_VISUALIZE_EFFECT, "Visualize Effect\t" + ih->GetKeyTextFromCommand(kcPatternVisualizeEffect)); return true; } return false; } -bool CViewPattern::BuildRandomCtxMenu(HMENU hMenu, CInputHandler* ih) -//------------------------------------------------------------------ +bool CViewPattern::BuildRandomCtxMenu(HMENU hMenu, CInputHandler *ih) const +//------------------------------------------------------------------------ { AppendMenu(hMenu, MF_STRING, ID_PATTERN_OPEN_RANDOMIZER, "Randomize...\t" + ih->GetKeyTextFromCommand(kcPatternOpenRandomizer)); return true; } -bool CViewPattern::BuildTransposeCtxMenu(HMENU hMenu, CInputHandler* ih) -//---------------------------------------------------------------------- +bool CViewPattern::BuildTransposeCtxMenu(HMENU hMenu, CInputHandler *ih) const +//---------------------------------------------------------------------------- { CArray<UINT, UINT> validChans; - DWORD greyed = (ListChansWhereColSelected(NOTE_COLUMN, validChans)>0)?FALSE:MF_GRAYED; + DWORD greyed = (ListChansWhereColSelected(NOTE_COLUMN, validChans) > 0) ? FALSE:MF_GRAYED; //AppendMenu(hMenu, MF_STRING, ID_RUN_SCRIPT, "Run script"); @@ -5341,23 +5338,23 @@ return false; } -bool CViewPattern::BuildAmplifyCtxMenu(HMENU hMenu, CInputHandler* ih) -//-------------------------------------------------------------------- +bool CViewPattern::BuildAmplifyCtxMenu(HMENU hMenu, CInputHandler *ih) const +//-------------------------------------------------------------------------- { CArray<UINT, UINT> validChans; - DWORD greyed = (ListChansWhereColSelected(VOL_COLUMN, validChans)>0)?FALSE:MF_GRAYED; + DWORD greyed = (ListChansWhereColSelected(VOL_COLUMN, validChans) > 0) ? 0 : MF_GRAYED; - if (!greyed || !(CMainFrame::GetSettings().m_dwPatternSetup&PATTERN_OLDCTXMENUSTYLE)) + if (!greyed || !(CMainFrame::GetSettings().m_dwPatternSetup & PATTERN_OLDCTXMENUSTYLE)) { - AppendMenu(hMenu, MF_STRING|greyed, ID_PATTERN_AMPLIFY, "Amplify\t" + ih->GetKeyTextFromCommand(kcPatternAmplify)); + AppendMenu(hMenu, MF_STRING | greyed, ID_PATTERN_AMPLIFY, "Amplify\t" + ih->GetKeyTextFromCommand(kcPatternAmplify)); return true; } return false; } -bool CViewPattern::BuildChannelControlCtxMenu(HMENU hMenu) -//-------------------------------------------------------- +bool CViewPattern::BuildChannelControlCtxMenu(HMENU hMenu) const +//-------------------------------------------------------------- { AppendMenu(hMenu, MF_SEPARATOR, 0, ""); @@ -5378,11 +5375,11 @@ } -bool CViewPattern::BuildSetInstCtxMenu(HMENU hMenu, CInputHandler* ih, CSoundFile* pSndFile) -//------------------------------------------------------------------------------------------ +bool CViewPattern::BuildSetInstCtxMenu(HMENU hMenu, CInputHandler *ih, CSoundFile *pSndFile) const +//------------------------------------------------------------------------------------------------ { CArray<UINT, UINT> validChans; - DWORD greyed = (ListChansWhereColSelected(INST_COLUMN, validChans)>0)?FALSE:MF_GRAYED; + DWORD greyed = (ListChansWhereColSelected(INST_COLUMN, validChans) > 0) ? 0 : MF_GRAYED; if (!greyed || !(CMainFrame::GetSettings().m_dwPatternSetup & PATTERN_OLDCTXMENUSTYLE)) { @@ -5447,10 +5444,10 @@ } -bool CViewPattern::BuildChannelMiscCtxMenu(HMENU hMenu, CSoundFile* pSndFile) -//--------------------------------------------------------------------------- +bool CViewPattern::BuildChannelMiscCtxMenu(HMENU hMenu, CSoundFile *pSndFile) const +//--------------------------------------------------------------------------------- { - if((pSndFile->m_nType & (MOD_TYPE_IT|MOD_TYPE_MPT)) == 0) return false; + if((pSndFile->GetType() & (MOD_TYPE_IT|MOD_TYPE_MPT)) == 0) return false; AppendMenu(hMenu, MF_SEPARATOR, 0, 0); AppendMenu(hMenu, MF_STRING, ID_CHANNEL_RENAME, "Rename channel"); return true; @@ -5458,8 +5455,8 @@ // Context menu for Param Control notes -bool CViewPattern::BuildPCNoteCtxMenu(HMENU hMenu, CInputHandler* ih, CSoundFile* pSndFile) -//----------------------------------------------------------------------------------------- +bool CViewPattern::BuildPCNoteCtxMenu(HMENU hMenu, CInputHandler *ih, CSoundFile *pSndFile) const +//----------------------------------------------------------------------------------------------- { MODCOMMAND *mSelStart = nullptr; if((pSndFile == nullptr) || (!pSndFile->Patterns.IsValidPat(m_nPattern))) @@ -5511,32 +5508,32 @@ } -ROWINDEX CViewPattern::GetSelectionStartRow() -//------------------------------------------- +ROWINDEX CViewPattern::GetSelectionStartRow() const +//------------------------------------------------- { return min(GetRowFromCursor(m_dwBeginSel), GetRowFromCursor(m_dwEndSel)); } -ROWINDEX CViewPattern::GetSelectionEndRow() -//----------------------------------------- +ROWINDEX CViewPattern::GetSelectionEndRow() const +//----------------------------------------------- { return max(GetRowFromCursor(m_dwBeginSel), GetRowFromCursor(m_dwEndSel)); } -CHANNELINDEX CViewPattern::GetSelectionStartChan() -//------------------------------------------------ +CHANNELINDEX CViewPattern::GetSelectionStartChan() const +//------------------------------------------------------ { return min(GetChanFromCursor(m_dwBeginSel), GetChanFromCursor(m_dwEndSel)); } -CHANNELINDEX CViewPattern::GetSelectionEndChan() -//---------------------------------------------- +CHANNELINDEX CViewPattern::GetSelectionEndChan() const +//---------------------------------------------------- { return max(GetChanFromCursor(m_dwBeginSel), GetChanFromCursor(m_dwEndSel)); } -UINT CViewPattern::ListChansWhereColSelected(PatternColumns colType, CArray<UINT,UINT> &chans) -//-------------------------------------------------------------------------------------------- +UINT CViewPattern::ListChansWhereColSelected(PatternColumns colType, CArray<UINT, UINT> &chans) const +//--------------------------------------------------------------------------------------------------- { chans.RemoveAll(); UINT startChan = GetSelectionStartChan(); @@ -5546,7 +5543,7 @@ { chans.Add(startChan); //first selected chan includes this col type } - for (UINT chan=startChan+1; chan<endChan; chan++) + for (UINT chan=startChan + 1; chan < endChan; chan++) { chans.Add(chan); //All chans between first & last must include this col type } @@ -5560,8 +5557,8 @@ bool CViewPattern::IsInterpolationPossible(ROWINDEX startRow, ROWINDEX endRow, CHANNELINDEX chan, - PatternColumns colType, CSoundFile* pSndFile) -//-------------------------------------------------------------------------------------- + PatternColumns colType, CSoundFile *pSndFile) const +//-------------------------------------------------------------------------------------------- { if (startRow == endRow) return false; @@ -5653,8 +5650,6 @@ CPoint pt = GetPointFromPosition(m_dwCursor); AppendMenu(hMenu, MF_STRING, IDC_PATTERN_RECORD, "Editing(record) is disabled; click here to enable it."); - //To check: It seems to work the way it should, but still is it ok to use IDC_PATTERN_RECORD here since it is not - //'aimed' to be used here. ClientToScreen(&pt); ::TrackPopupMenu(hMenu, TPM_LEFTALIGN, pt.x, pt.y, 0, m_hWnd, NULL); @@ -5669,7 +5664,7 @@ //---------------------------------- { CModDoc* pModDoc = GetDocument(); - CSoundFile* pSndFile = (pModDoc) ? pModDoc->GetSoundFile() : 0; + CSoundFile *pSndFile = (pModDoc) ? pModDoc->GetSoundFile() : 0; if(!pSndFile) return; CString msg; @@ -5720,7 +5715,7 @@ CSoundFile *pSndFile = pModDoc->GetSoundFile(); if(pSndFile == nullptr) return; - CHANNELINDEX nChn = GetChanFromCursor(m_nMenuParam); + const CHANNELINDEX nChn = GetChanFromCursor(m_nMenuParam); CChannelRenameDlg dlg(this, pSndFile->ChnSettings[nChn].szName, nChn + 1); if(dlg.DoModal() != IDOK || dlg.bChanged == false) return; Modified: trunk/OpenMPT/mptrack/View_pat.h =================================================================== --- trunk/OpenMPT/mptrack/View_pat.h 2011-09-28 21:04:23 UTC (rev 1064) +++ trunk/OpenMPT/mptrack/View_pat.h 2011-09-29 20:59:29 UTC (rev 1065) @@ -102,8 +102,9 @@ CEditCommand *m_pEditWnd; CPatternGotoDialog *m_pGotoWnd; SIZE m_szHeader, m_szCell; + PATTERNINDEX m_nPattern; ROWINDEX m_nRow; - UINT m_nPattern, m_nMidRow, m_nPlayPat, m_nPlayRow, m_nSpacing, m_nAccelChar, m_nLastPlayedRow, m_nLastPlayedOrder; + UINT m_nMidRow, m_nPlayPat, m_nPlayRow, m_nSpacing, m_nAccelChar, m_nLastPlayedRow, m_nLastPlayedOrder; int m_nXScroll, m_nYScroll; DWORD m_nMenuParam, m_nDetailLevel; @@ -121,7 +122,6 @@ WORD ChnVUMeters[MAX_BASECHANNELS]; WORD OldVUMeters[MAX_BASECHANNELS]; UINT m_nFoundInstrument; - UINT m_nMenuOnChan; DWORD m_dwLastNoteEntryTime; //rewbs.customkeys UINT m_nLastPlayedChannel; //rewbs.customkeys bool m_bLastNoteEntryBlocked; @@ -134,7 +134,7 @@ // -> DESC="midi keyboard split" BYTE activeNoteChannel[NOTE_MAX + 1]; BYTE splitActiveNoteChannel[NOTE_MAX + 1]; - int oldrow,oldchn,oldsplitchn; + int oldrow, oldchn, oldsplitchn; // -! NEW_FEATURE#0012 // -> CODE#0018 @@ -163,7 +163,7 @@ int GetYScrollPos() const { return m_nYScroll; } int GetColumnWidth() const { return m_szCell.cx; } int GetColumnHeight() const { return m_szCell.cy; } - UINT GetCurrentPattern() const { return m_nPattern; } + PATTERNINDEX GetCurrentPattern() const { return m_nPattern; } ROWINDEX GetCurrentRow() const { return m_nRow; } UINT GetCurrentColumn() const { return m_dwCursor; } UINT GetCurrentChannel() const { return (m_dwCursor >> 3); } @@ -180,7 +180,7 @@ void InvalidateSelection() { InvalidateArea(m_dwBeginSel, m_dwEndSel); } void InvalidateChannelsHeaders(); void SetCurSel(DWORD dwBegin, DWORD dwEnd); - BOOL SetCurrentPattern(UINT npat, ROWINDEX nrow = ROWINDEX_INVALID); + BOOL SetCurrentPattern(PATTERNINDEX npat, ROWINDEX nrow = ROWINDEX_INVALID); BOOL SetCurrentRow(UINT nrow, BOOL bWrap=FALSE, BOOL bUpdateHorizontalScrollbar=TRUE ); BOOL SetCurrentColumn(UINT ncol); // This should be used instead of consecutive calls to SetCurrentRow() then SetCurrentColumn() @@ -355,57 +355,66 @@ private: void SetSplitKeyboardSettings(); - bool HandleSplit(MODCOMMAND* p, int note); - bool BuildChannelControlCtxMenu(HMENU hMenu); - bool BuildPluginCtxMenu(HMENU hMenu, UINT nChn, CSoundFile* pSndFile); - bool BuildRecordCtxMenu(HMENU hMenu, UINT nChn, CModDoc* pModDoc); - bool BuildSoloMuteCtxMenu(HMENU hMenu, CInputHandler* ih, UINT nChn, CSoundFile* pSndFile); - bool BuildRowInsDelCtxMenu(HMENU hMenu, CInputHandler* ih); - bool BuildMiscCtxMenu(HMENU hMenu, CInputHandler* ih); - bool BuildSelectionCtxMenu(HMENU hMenu, CInputHandler* ih); - bool BuildGrowShrinkCtxMenu(HMENU hMenu, CInputHandler* ih); - bool BuildNoteInterpolationCtxMenu(HMENU hMenu, CInputHandler* ih, CSoundFile* pSndFile); - bool BuildVolColInterpolationCtxMenu(HMENU hMenu, CInputHandler* ih, CSoundFile* pSndFile); - bool BuildEffectInterpolationCtxMenu(HMENU hMenu, CInputHandler* ih, CSoundFile* pSndFile); - bool BuildEditCtxMenu(HMENU hMenu, CInputHandler* ih, CModDoc* pModDoc); - bool BuildVisFXCtxMenu(HMENU hMenu, CInputHandler* ih); - bool BuildRandomCtxMenu(HMENU hMenu, CInputHandler* ih); - bool BuildTransposeCtxMenu(HMENU hMenu, CInputHandler* ih); - bool BuildSetInstCtxMenu(HMENU hMenu, CInputHandler* ih, CSoundFile* pSndFile); - bool BuildAmplifyCtxMenu(HMENU hMenu, CInputHandler* ih); - bool BuildChannelMiscCtxMenu(HMENU hMenu, CSoundFile* pSndFile); - bool BuildPCNoteCtxMenu(HMENU hMenu, CInputHandler* ih, CSoundFile* pSndFile); + bool HandleSplit(MODCOMMAND *p, int note); - ROWINDEX GetSelectionStartRow(); - ROWINDEX GetSelectionEndRow(); - CHANNELINDEX GetSelectionStartChan(); - CHANNELINDEX GetSelectionEndChan(); - UINT ListChansWhereColSelected(PatternColumns colType, CArray<UINT,UINT> &chans); + bool BuildChannelControlCtxMenu(HMENU hMenu) const; + bool BuildPluginCtxMenu(HMENU hMenu, UINT nChn, CSoundFile *pSndFile) const; + bool BuildRecordCtxMenu(HMENU hMenu, UINT nChn, CModDoc *pModDoc) const; + bool BuildSoloMuteCtxMenu(HMENU hMenu, CInputHandler *ih, UINT nChn, CSoundFile *pSndFile) const; + bool BuildRowInsDelCtxMenu(HMENU hMenu, CInputHandler *ih) const; + bool BuildMiscCtxMenu(HMENU hMenu, CInputHandler *ih) const; + bool BuildSelectionCtxMenu(HMENU hMenu, CInputHandler *ih) const; + bool BuildGrowShrinkCtxMenu(HMENU hMenu, CInputHandler *ih) const; + bool BuildNoteInterpolationCtxMenu(HMENU hMenu, CInputHandler *ih, CSoundFile *pSndFile) const; + bool BuildVolColInterpolationCtxMenu(HMENU hMenu, CInputHandler *ih, CSoundFile *pSndFile) const; + bool BuildEffectInterpolationCtxMenu(HMENU hMenu, CInputHandler *ih, CSoundFile *pSndFile) const; + bool BuildEditCtxMenu(HMENU hMenu, CInputHandler *ih, CModDoc* pModDoc) const; + bool BuildVisFXCtxMenu(HMENU hMenu, CInputHandler *ih) const; + bool BuildRandomCtxMenu(HMENU hMenu, CInputHandler *ih) const; + bool BuildTransposeCtxMenu(HMENU hMenu, CInputHandler *ih) const; + bool BuildSetInstCtxMenu(HMENU hMenu, CInputHandler *ih, CSoundFile *pSndFile) const; + bool BuildAmplifyCtxMenu(HMENU hMenu, CInputHandler *ih) const; + bool BuildChannelMiscCtxMenu(HMENU hMenu, CSoundFile *pSndFile) const; + bool BuildPCNoteCtxMenu(HMENU hMenu, CInputHandler *ih, CSoundFile *pSndFile) const; - bool IsInterpolationPossible(ROWINDEX startRow, ROWINDEX endRow, CHANNELINDEX chan, PatternColumns colType, CSoundFile* pSndFile); + ROWINDEX GetSelectionStartRow() const; + ROWINDEX GetSelectionEndRow() const; + CHANNELINDEX GetSelectionStartChan() const; + CHANNELINDEX GetSelectionEndChan() const; + UINT ListChansWhereColSelected(PatternColumns colType, CArray<UINT, UINT> &chans) const; + + bool IsInterpolationPossible(ROWINDEX startRow, ROWINDEX endRow, CHANNELINDEX chan, PatternColumns colType, CSoundFile *pSndFile) const; void Interpolate(PatternColumns type); // Return true if recording live (i.e. editing while following playback). // rSndFile must be the CSoundFile object of given rModDoc. - bool IsLiveRecord(const CModDoc& rModDoc, const CSoundFile& rSndFile) const; - bool IsLiveRecord(const CMainFrame& rMainFrm, const CModDoc& rModDoc, const CSoundFile& rSndFile) const; + bool IsLiveRecord(const CModDoc &rModDoc, const CSoundFile &rSndFile) const + { + return IsLiveRecord(*CMainFrame::GetMainFrame(), rModDoc, rSndFile); + }; + bool IsLiveRecord(const CMainFrame &rMainFrm, const CModDoc &rModDoc, const CSoundFile &rSndFile) const + { + // (following song) && (following in correct document) && (playback is on) + return ((m_dwStatus & PATSTATUS_FOLLOWSONG) && (rMainFrm.GetFollowSong(&rModDoc) == m_hWnd) && !(rSndFile.IsPaused())); + }; // If given edit positions are valid, sets them to iRow and iPat. // If not valid, set edit cursor position. - void SetEditPos(const CSoundFile& rSndFile, - ROWINDEX& iRow, PATTERNINDEX& iPat, + void SetEditPos(const CSoundFile &rSndFile, + ROWINDEX &iRow, PATTERNINDEX &iPat, const ROWINDEX iRowCandidate, const PATTERNINDEX iPatCandidate) const; // Returns edit position. - ModCommandPos GetEditPos(CSoundFile& rSf, const bool bLiveRecord) const; + ModCommandPos GetEditPos(CSoundFile &rSf, const bool bLiveRecord) const; // Returns pointer to modcommand at given position. If the position is not valid, returns pointer // to a dummy command. - MODCOMMAND* GetModCommand(CSoundFile& rSf, const ModCommandPos& pos); + MODCOMMAND* GetModCommand(CSoundFile &rSf, const ModCommandPos &pos); - bool IsEditingEnabled() const {return ((m_dwStatus&PATSTATUS_RECORD) != 0);} + // Returns true if pattern editing is enabled. + bool IsEditingEnabled() const { return ((m_dwStatus & PATSTATUS_RECORD) != 0); } - //Like IsEditingEnabled(), but shows some notification when editing is not enabled. + // Like IsEditingEnabled(), but shows some notification when editing is not enabled. bool IsEditingEnabled_bmsg(); // Play one pattern row and stop ("step mode") @@ -427,19 +436,6 @@ }; -inline bool CViewPattern::IsLiveRecord(const CMainFrame& rMainFrm, const CModDoc& rModDoc, const CSoundFile& rSndFile) const -//---------------------------------------------------------------------------- -{ // (following song) && (following in correct document(?)) && (playback is on) - return ((m_dwStatus & PATSTATUS_FOLLOWSONG) && (rMainFrm.GetFollowSong(&rModDoc) == m_hWnd) && !(rSndFile.IsPaused())); -} - - -inline bool CViewPattern::IsLiveRecord(const CModDoc& rModDoc, const CSoundFile& rSndFile) const -//---------------------------------------------------------------------------- -{ - return IsLiveRecord(*CMainFrame::GetMainFrame(), rModDoc, rSndFile); -} - #endif This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <sag...@us...> - 2011-09-30 22:51:50
|
Revision: 1069 http://modplug.svn.sourceforge.net/modplug/?rev=1069&view=rev Author: saga-games Date: 2011-09-30 22:51:44 +0000 (Fri, 30 Sep 2011) Log Message: ----------- [Fix] Keyboard Split instrument setting was broken since OpenMPT 1.19 [Fix] Using Keyboard Split, it was possible to input unsupported notes (f.e. C-0 in MOD files). Modified Paths: -------------- trunk/OpenMPT/mptrack/PatternEditorDialogs.cpp trunk/OpenMPT/mptrack/View_pat.cpp Modified: trunk/OpenMPT/mptrack/PatternEditorDialogs.cpp =================================================================== --- trunk/OpenMPT/mptrack/PatternEditorDialogs.cpp 2011-09-30 22:32:30 UTC (rev 1068) +++ trunk/OpenMPT/mptrack/PatternEditorDialogs.cpp 2011-09-30 22:51:44 UTC (rev 1069) @@ -1451,8 +1451,8 @@ CHAR s[64]; // Split Notes - AppendNotesToControl(m_CbnSplitNote, 0, NOTE_MAX - 1); - m_CbnSplitNote.SetCurSel(m_pOptions->splitNote); + AppendNotesToControl(m_CbnSplitNote, m_pSndFile->GetModSpecifications().noteMin - NOTE_MIN, m_pSndFile->GetModSpecifications().noteMax - NOTE_MIN); + m_CbnSplitNote.SetCurSel(m_pOptions->splitNote - (m_pSndFile->GetModSpecifications().noteMin - NOTE_MIN)); // Octave modifier for(int i = -SPLIT_OCTAVE_RANGE; i < SPLIT_OCTAVE_RANGE + 1; i++) @@ -1514,7 +1514,7 @@ { CDialog::OnOK(); - m_pOptions->splitNote = static_cast<MODCOMMAND::NOTE>(m_CbnSplitNote.GetCurSel()); + m_pOptions->splitNote = static_cast<MODCOMMAND::NOTE>(m_CbnSplitNote.GetCurSel() + (m_pSndFile->GetModSpecifications().noteMin - NOTE_MIN)); m_pOptions->octaveModifier = m_CbnOctaveModifier.GetCurSel() - SPLIT_OCTAVE_RANGE; m_pOptions->octaveLink = (IsDlgButtonChecked(IDC_PATTERN_OCTAVELINK) == TRUE) ? true : false; m_pOptions->splitVolume = static_cast<MODCOMMAND::VOL>(m_CbnSplitVolume.GetCurSel()); Modified: trunk/OpenMPT/mptrack/View_pat.cpp =================================================================== --- trunk/OpenMPT/mptrack/View_pat.cpp 2011-09-30 22:32:30 UTC (rev 1068) +++ trunk/OpenMPT/mptrack/View_pat.cpp 2011-09-30 22:51:44 UTC (rev 1069) @@ -4216,7 +4216,7 @@ } } - //Enter note off in pattern? + // Enter note off in pattern? if ((note < NOTE_MIN) || (note > NOTE_MAX)) return; if (GetColTypeFromCursor(m_dwCursor) > INST_COLUMN && (bChordMode || !fromMidi)) @@ -5010,7 +5010,9 @@ bool CViewPattern::HandleSplit(MODCOMMAND* p, int note) //----------------------------------------------------- { - CModDoc *pModDoc = GetDocument(); if (!pModDoc) return false; + CModDoc *pModDoc = GetDocument(); + CSoundFile *pSndFile; + if (pModDoc == nullptr || (pSndFile = pModDoc->GetSoundFile()) == nullptr) return false; MODCOMMAND::INSTR ins = GetCurrentInstrument(); bool isSplit = false; @@ -5024,11 +5026,11 @@ if (pModDoc->GetSplitKeyboardSettings()->octaveLink && note <= NOTE_MAX) { note += 12 * pModDoc->GetSplitKeyboardSettings()->octaveModifier; - Limit(note, NOTE_MIN, NOTE_MAX); + Limit(note, pSndFile->GetModSpecifications().noteMin, pSndFile->GetModSpecifications().noteMax); } if (pModDoc->GetSplitKeyboardSettings()->splitInstrument) { - p->instr = pModDoc->GetSplitKeyboardSettings()->splitInstrument; + ins = pModDoc->GetSplitKeyboardSettings()->splitInstrument; } } } @@ -5043,25 +5045,24 @@ bool CViewPattern::BuildPluginCtxMenu(HMENU hMenu, UINT nChn, CSoundFile *pSndFile) const //--------------------------------------------------------------------------------------- { - bool itemFound; for (UINT plug=0; plug<=MAX_MIXPLUGINS; plug++) { - itemFound=false; + bool itemFound = false; - CHAR s[64] = { '\0' }; + CHAR s[64]; if (!plug) { strcpy(s, "No plugin"); - itemFound=true; + itemFound = true; } else { PSNDMIXPLUGIN p = &(pSndFile->m_MixPlugins[plug - 1]); if (p->Info.szLibraryName[0]) { wsprintf(s, "FX%d: %s", plug, p->Info.szName); - itemFound=true; + itemFound = true; } } @@ -5088,7 +5089,7 @@ bool bSolo = false, bUnmuteAll = false; bool bSoloPending = false, bUnmuteAllPending = false; // doesn't work perfectly yet - for (CHANNELINDEX i = 0; i < pSndFile->m_nChannels; i++) + for (CHANNELINDEX i = 0; i < pSndFile->GetNumChannels(); i++) { if (i != nChn) { @@ -5180,7 +5181,7 @@ if (IsInterpolationPossible(startRow, endRow, validChans[valChnIdx], NOTE_COLUMN, pSndFile)) { - greyed=0; //Can do interpolation. + greyed = 0; // Can do interpolation. break; } } @@ -5210,7 +5211,7 @@ if (IsInterpolationPossible(startRow, endRow, validChans[valChnIdx], VOL_COLUMN, pSndFile)) { - greyed = 0; //Can do interpolation. + greyed = 0; // Can do interpolation. break; } } @@ -5261,7 +5262,7 @@ if (!greyed || !(CMainFrame::GetSettings().m_dwPatternSetup & PATTERN_OLDCTXMENUSTYLE)) { // Figure out what we want to interpolate - CString interpolateWhat = "Effect"; + CString interpolateWhat = "Effect"; const CSoundFile *pSndFile = GetDocument() != nullptr ? GetDocument()->GetSoundFile() : nullptr; if(pSndFile->Patterns.IsValidPat(m_nPattern) && pSndFile->Patterns[m_nPattern].GetpModCommand(GetSelectionStartRow(), GetSelectionStartChan())->IsPcNote()) { @@ -5325,8 +5326,6 @@ CArray<UINT, UINT> validChans; DWORD greyed = (ListChansWhereColSelected(NOTE_COLUMN, validChans) > 0) ? FALSE:MF_GRAYED; - //AppendMenu(hMenu, MF_STRING, ID_RUN_SCRIPT, "Run script"); - if (!greyed || !(CMainFrame::GetSettings().m_dwPatternSetup & PATTERN_OLDCTXMENUSTYLE)) { AppendMenu(hMenu, MF_STRING|greyed, ID_TRANSPOSE_UP, "Transpose +1\t" + ih->GetKeyTextFromCommand(kcTransposeUp)); @@ -5407,34 +5406,38 @@ if(!greyed) { - if (pSndFile->m_nInstruments) + bool addSeparator = false; + if (pSndFile->GetNumInstruments()) { - for (UINT i=1; i<=pSndFile->m_nInstruments; i++) + for (UINT i = 1; i <= pSndFile->GetNumInstruments() ; i++) { if (pSndFile->Instruments[i] == NULL) continue; CString instString = pModDoc->GetPatternViewInstrumentName(i, true); - if(instString.GetLength() > 0) AppendMenu(instrumentChangeMenu, MF_STRING, ID_CHANGE_INSTRUMENT+i, pModDoc->GetPatternViewInstrumentName(i)); - //Adding the entry to the list only if it has some name, since if the name is empty, - //it likely is some non-used instrument. + if(!instString.IsEmpty()) + { + AppendMenu(instrumentChangeMenu, MF_STRING, ID_CHANGE_INSTRUMENT + i, pModDoc->GetPatternViewInstrumentName(i)); + addSeparator = true; + } } - } - else + } else { - CHAR s[256]; - UINT nmax = pSndFile->m_nSamples; - while ((nmax > 1) && (pSndFile->GetSample(nmax).pSample == nullptr) && (!pSndFile->m_szNames[nmax][0])) nmax--; - for (UINT i=1; i<=nmax; i++) if ((pSndFile->m_szNames[i][0]) || (pSndFile->GetSample(i).pSample)) + CHAR s[64]; + for (UINT i = 1; i <= pSndFile->GetNumSamples(); i++) if (pSndFile->GetSample(i).pSample != nullptr) { wsprintf(s, "%02d: %s", i, pSndFile->m_szNames[i]); - AppendMenu(instrumentChangeMenu, MF_STRING, ID_CHANGE_INSTRUMENT+i, s); + AppendMenu(instrumentChangeMenu, MF_STRING, ID_CHANGE_INSTRUMENT + i, s); + addSeparator = true; } } - //Add options to remove instrument from selection. - AppendMenu(instrumentChangeMenu, MF_SEPARATOR, 0, 0); + // Add options to remove instrument from selection. + if(addSeparator) + { + AppendMenu(instrumentChangeMenu, MF_SEPARATOR, 0, 0); + } AppendMenu(instrumentChangeMenu, MF_STRING, ID_CHANGE_INSTRUMENT, "Remove instrument"); AppendMenu(instrumentChangeMenu, MF_STRING, ID_CHANGE_INSTRUMENT + GetCurrentInstrument(), "Set to current instrument"); } @@ -5541,15 +5544,15 @@ if (GetColTypeFromCursor(m_dwBeginSel) <= colType) { - chans.Add(startChan); //first selected chan includes this col type + chans.Add(startChan); // First selected chan includes this col type } for (UINT chan=startChan + 1; chan < endChan; chan++) { - chans.Add(chan); //All chans between first & last must include this col type + chans.Add(chan); // All chans between first & last must include this col type } if ((startChan != endChan) && colType <= GetColTypeFromCursor(m_dwEndSel)) { - chans.Add(endChan); //last selected chan includes this col type + chans.Add(endChan); // Last selected chan includes this col type } return chans.GetCount(); @@ -5649,7 +5652,7 @@ CPoint pt = GetPointFromPosition(m_dwCursor); - AppendMenu(hMenu, MF_STRING, IDC_PATTERN_RECORD, "Editing(record) is disabled; click here to enable it."); + AppendMenu(hMenu, MF_STRING, IDC_PATTERN_RECORD, "Editing (recording) is disabled; click here to enable it."); ClientToScreen(&pt); ::TrackPopupMenu(hMenu, TPM_LEFTALIGN, pt.x, pt.y, 0, m_hWnd, NULL); @@ -5676,7 +5679,7 @@ msg.Format("Unable to determine the time. Possible cause: No order %d, row %d found from play sequence", currentOrder, m_nRow); else { - const uint32 minutes = static_cast<uint32>(t/60.0); + const uint32 minutes = static_cast<uint32>(t / 60.0); const float seconds = t - minutes*60; msg.Format("Estimate for playback time at order %d(pattern %d), row %d: %d minute%s %.2f seconds", currentOrder, m_nPattern, m_nRow, minutes, (minutes == 1) ? "" : "s", seconds); } @@ -5777,6 +5780,7 @@ } +// Get the active pattern's rows per beat, or, if they are not overriden, the song's default rows per beat. ROWINDEX CViewPattern::GetRowsPerBeat() const //------------------------------------------- { @@ -5790,6 +5794,7 @@ } +// Get the active pattern's rows per measure, or, if they are not overriden, the song's default rows per measure. ROWINDEX CViewPattern::GetRowsPerMeasure() const //---------------------------------------------- { @@ -5821,20 +5826,20 @@ PrepareUndo(m_dwBeginSel, m_dwEndSel); //rewbs: re-written to work regardless of selection - UINT startRow = GetSelectionStartRow(); - UINT endRow = GetSelectionEndRow(); - UINT startChan = GetSelectionStartChan(); - UINT endChan = GetSelectionEndChan(); + ROWINDEX startRow = GetSelectionStartRow(); + ROWINDEX endRow = GetSelectionEndRow(); + CHANNELINDEX startChan = GetSelectionStartChan(); + CHANNELINDEX endChan = GetSelectionEndChan(); - for (UINT r=startRow; r<endRow+1; r++) + for (ROWINDEX r = startRow; r < endRow + 1; r++) { - p = pSndFile->Patterns[m_nPattern] + r * pSndFile->GetNumChannels() + startChan; - for (UINT c = startChan; c < endChan + 1; c++, p++) + p = pSndFile->Patterns[m_nPattern].GetpModCommand(r, startChan); + for (CHANNELINDEX c = startChan; c < endChan + 1; c++, p++) { // If a note or an instr is present on the row, do the change, if required. - // Do not set instr if note and instr are both blank. - // Do set instr if note is a PC note and instr is blank. - if ( ((p->note > 0 && p->note < NOTE_MIN_SPECIAL) || p->IsPcNote() || p->instr) && (p->instr!=nIns) ) + // Do not set instr if note and instr are both blank, + // but set instr if note is a PC note and instr is blank. + if (((p->note != NOTE_NONE && NOTE_IS_VALID(p->note)) || p->IsPcNote() || p->instr) && (p->instr != nIns)) { p->instr = nIns; bModified = true; @@ -5863,7 +5868,7 @@ const ROWINDEX endRow = GetSelectionEndRow() + adjust - (GetSelectionEndRow() % adjust) - 1; CHANNELINDEX startChannel = GetSelectionStartChan(), endChannel = GetSelectionEndChan(); - UINT startColumn = 0, endColumn = 0; + UINT startColumn = NOTE_COLUMN, endColumn = NOTE_COLUMN; if(m_dwBeginSel == m_dwEndSel) { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <sag...@us...> - 2011-10-01 00:30:12
|
Revision: 1070 http://modplug.svn.sourceforge.net/modplug/?rev=1070&view=rev Author: saga-games Date: 2011-10-01 00:30:05 +0000 (Sat, 01 Oct 2011) Log Message: ----------- [Mod] Song Properties: "Test Version" is appended to version number strings when a song was created / saved with a test version. [Mod] Revamped MIDI Mapping dialog a bit. [Imp] Keyboard Settings: Error boxes are now modal to the keyboard settings dialog, so they cannot be overlooked (which effectively means that entering new shortcuts doesn't work). Modified Paths: -------------- trunk/OpenMPT/mptrack/KeyConfigDlg.cpp trunk/OpenMPT/mptrack/dlg_misc.cpp trunk/OpenMPT/mptrack/dlg_misc.h trunk/OpenMPT/mptrack/mptrack.rc Modified: trunk/OpenMPT/mptrack/KeyConfigDlg.cpp =================================================================== --- trunk/OpenMPT/mptrack/KeyConfigDlg.cpp 2011-09-30 22:51:44 UTC (rev 1069) +++ trunk/OpenMPT/mptrack/KeyConfigDlg.cpp 2011-10-01 00:30:05 UTC (rev 1070) @@ -530,8 +530,7 @@ if (cmd<0 || m_nCurKeyChoice<0 || m_nCurKeyChoice>=ih->GetKeyListSize(cmd)) { // Annoying message box is annoying. - //CString error = "Nothing to restore for this slot."; - //Reporting::Error(error, "Invalid key data"); + //Reporting::Error("Nothing to restore for this slot.", "Invalid key data", this); return; } @@ -552,8 +551,7 @@ if (m_nCurHotKey<0 || m_nCurKeyChoice<0 || m_nCurKeyChoice>=plocalCmdSet->GetKeyListSize(cmd)) { // Annoying message box is annoying. - //CString error = "No key currently set for this slot."; - //Reporting::Warning(error, "Invalid key data"); + //Reporting::Warning("No key currently set for this slot.", "Invalid key data", this); return; } @@ -574,7 +572,7 @@ if (cmd<0) { CString error = "Invalid slot."; - Reporting::Warning(error, "Invalid key data"); + Reporting::Warning(error, "Invalid key data", this); return; } @@ -590,7 +588,7 @@ if (!kc.code) { CString error = "You need to say to which key you'd like to map this command to."; - Reporting::Warning(error, "Invalid key data"); + Reporting::Warning(error, "Invalid key data", this); return; } if (!kc.event) @@ -604,12 +602,12 @@ //process valid input plocalCmdSet->Remove(m_nCurKeyChoice, cmd); - report=plocalCmdSet->Add(kc, cmd, true, m_nCurKeyChoice); + report = plocalCmdSet->Add(kc, cmd, true, m_nCurKeyChoice); //Update log m_eReport.GetWindowText(reportHistory); //reportHistory = reportHistory.Mid(6,reportHistory.GetLength()-1); - m_eReport.SetWindowText(report+reportHistory); + m_eReport.SetWindowText(report + reportHistory); ForceUpdateGUI(); m_bModified=false; @@ -707,7 +705,7 @@ void COptionsKeyboard::OnRestoreDefaultKeymap() //--------------------------------------------- { - if(Reporting::Confirm("Discard all custom changes and restore default key configuration?") == cnfYes) + if(Reporting::Confirm("Discard all custom changes and restore default key configuration?", false, true, this) == cnfYes) { plocalCmdSet->LoadDefaultKeymap(); ForceUpdateGUI(); Modified: trunk/OpenMPT/mptrack/dlg_misc.cpp =================================================================== --- trunk/OpenMPT/mptrack/dlg_misc.cpp 2011-09-30 22:51:44 UTC (rev 1069) +++ trunk/OpenMPT/mptrack/dlg_misc.cpp 2011-10-01 00:30:05 UTC (rev 1070) @@ -94,8 +94,6 @@ default: m_TypeBox.SetCurSel(0); break; } - UpdateChannelCBox(); - // Don't show new tempo modes for XM/IT, unless they are currently used const bool showNewTempoModes = (m_pSndFile->GetType() == MOD_TYPE_MPT || (m_pSndFile->m_dwSongFlags & SONG_ITPROJECT) != 0); @@ -121,7 +119,7 @@ m_PlugMixBox.SetItemData(m_PlugMixBox.AddString("OpenMPT 1.17RC1"), mixLevels_117RC1); m_PlugMixBox.SetItemData(m_PlugMixBox.AddString("Original (MPT 1.16)"), mixLevels_original); m_PlugMixBox.SetItemData(m_PlugMixBox.AddString("Compatible"), mixLevels_compatible); - //m_PlugMixBox.SetItemData(m_PlugMixBox.AddString("Test"), mixLevels_Test); + m_PlugMixBox.SetCurSel(0); for(int i = m_PlugMixBox.GetCount(); i > 0; i--) { @@ -135,8 +133,8 @@ SetDlgItemText(IDC_TEXT_CREATEDWITH, "Created with:"); SetDlgItemText(IDC_TEXT_SAVEDWITH, "Last saved with:"); - SetDlgItemText(IDC_EDIT_CREATEDWITH, MptVersion::ToStr(m_pSndFile->m_dwCreatedWithVersion)); - SetDlgItemText(IDC_EDIT_SAVEDWITH, MptVersion::ToStr(m_pSndFile->m_dwLastSavedWithVersion)); + SetDlgItemText(IDC_EDIT_CREATEDWITH, FormatVersionNumber(m_pSndFile->m_dwCreatedWithVersion)); + SetDlgItemText(IDC_EDIT_SAVEDWITH, FormatVersionNumber(m_pSndFile->m_dwLastSavedWithVersion)); UpdateDialog(); @@ -145,6 +143,13 @@ } +CString CModTypeDlg::FormatVersionNumber(DWORD version) +//----------------------------------------------------- +{ + return MptVersion::ToStr(version) + (MptVersion::IsTestBuild(version) ? " (Test Build)" : ""); +} + + void CModTypeDlg::UpdateChannelCBox() //----------------------------------- { @@ -1838,7 +1843,7 @@ void AppendNotesToControl(CComboBox& combobox, const MODCOMMAND::NOTE noteStart, const MODCOMMAND::NOTE noteEnd) //------------------------------------------------------------------------------------------------------------------ { - const MODCOMMAND::NOTE upperLimit = min(ARRAYELEMCOUNT(szDefaultNoteNames)-1, noteEnd); + const MODCOMMAND::NOTE upperLimit = min(ARRAYELEMCOUNT(szDefaultNoteNames) - 1, noteEnd); for(MODCOMMAND::NOTE note = noteStart; note <= upperLimit; ++note) combobox.SetItemData(combobox.AddString(szDefaultNoteNames[note]), note); } @@ -1847,16 +1852,16 @@ void AppendNotesToControlEx(CComboBox& combobox, const CSoundFile* const pSndFile /* = nullptr*/, const INSTRUMENTINDEX nInstr/* = MAX_INSTRUMENTS*/) //---------------------------------------------------------------------------------------------------------------------------------- { - const MODCOMMAND::NOTE noteStart = (pSndFile != nullptr) ? pSndFile->GetModSpecifications().noteMin : 1; + const MODCOMMAND::NOTE noteStart = (pSndFile != nullptr) ? pSndFile->GetModSpecifications().noteMin : NOTE_MIN; const MODCOMMAND::NOTE noteEnd = (pSndFile != nullptr) ? pSndFile->GetModSpecifications().noteMax : NOTE_MAX; for(MODCOMMAND::NOTE nNote = noteStart; nNote <= noteEnd; nNote++) { if(pSndFile != nullptr && nInstr != MAX_INSTRUMENTS) combobox.SetItemData(combobox.AddString(pSndFile->GetNoteName(nNote, nInstr).c_str()), nNote); else - combobox.SetItemData(combobox.AddString(szDefaultNoteNames[nNote-1]), nNote); + combobox.SetItemData(combobox.AddString(szDefaultNoteNames[nNote - 1]), nNote); } - for(MODCOMMAND::NOTE nNote = NOTE_MIN_SPECIAL-1; nNote++ < NOTE_MAX_SPECIAL;) + for(MODCOMMAND::NOTE nNote = NOTE_MIN_SPECIAL - 1; nNote++ < NOTE_MAX_SPECIAL;) { if(pSndFile == nullptr || pSndFile->GetModSpecifications().HasNote(nNote) == true) combobox.SetItemData(combobox.AddString(szSpecialNoteNames[nNote-NOTE_MIN_SPECIAL]), nNote); Modified: trunk/OpenMPT/mptrack/dlg_misc.h =================================================================== --- trunk/OpenMPT/mptrack/dlg_misc.h 2011-09-30 22:51:44 UTC (rev 1069) +++ trunk/OpenMPT/mptrack/dlg_misc.h 2011-10-01 00:30:05 UTC (rev 1070) @@ -27,8 +27,9 @@ bool VerifyData(); void UpdateDialog(); -private: +protected: void UpdateChannelCBox(); + CString FormatVersionNumber(DWORD version); protected: //{{AFX_VIRTUAL(CModTypeDlg) Modified: trunk/OpenMPT/mptrack/mptrack.rc =================================================================== --- trunk/OpenMPT/mptrack/mptrack.rc 2011-09-30 22:51:44 UTC (rev 1069) +++ trunk/OpenMPT/mptrack/mptrack.rc 2011-10-01 00:30:05 UTC (rev 1070) @@ -1022,8 +1022,8 @@ CONTROL "Override &song signature:",IDC_CHECK1,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,6,48,174,12 EDITTEXT IDC_EDIT_ROWSPERBEAT,18,66,30,12,ES_AUTOHSCROLL | ES_NUMBER EDITTEXT IDC_EDIT_ROWSPERMEASURE,18,84,30,12,ES_AUTOHSCROLL | ES_NUMBER - DEFPUSHBUTTON "OK",IDOK,132,6,50,14 - PUSHBUTTON "Cancel",IDCANCEL,132,24,50,14 + DEFPUSHBUTTON "&OK",IDOK,132,6,50,14 + PUSHBUTTON "&Cancel",IDCANCEL,132,24,50,14 LTEXT "Rows:",IDC_STATIC,6,6,108,8 CONTROL "",IDC_STATIC,"Static",SS_ETCHEDFRAME,6,42,174,1 LTEXT "Rows per beat",IDC_STATIC,54,68,126,8 @@ -2128,7 +2128,7 @@ MENUITEM "&Copy envelope", ID_EDIT_COPY MENUITEM "&Paste envelope", ID_EDIT_PASTE MENUITEM SEPARATOR - MENUITEM "Scale points...", ID_ENVELOPE_SCALEPOINTS + MENUITEM "Scale Envelope Points...", ID_ENVELOPE_SCALEPOINTS END END @@ -2575,10 +2575,10 @@ LTEXT "Static",IDC_MESSAGETEXT,7,7,172,40 END -IDD_MIDIPARAMCONTROL DIALOGEX 0, 0, 392, 202 +IDD_MIDIPARAMCONTROL DIALOGEX 0, 0, 340, 223 STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_CAPTION | WS_SYSMENU EXSTYLE WS_EX_TOOLWINDOW -CAPTION "MIDI mapping" +CAPTION "MIDI Mapping" FONT 8, "MS Shell Dlg", 0, 0, 0x1 BEGIN GROUPBOX "Current mapping",IDC_STATIC,5,5,325,105 @@ -2598,11 +2598,11 @@ PUSHBUTTON "Add",IDC_BUTTON_ADD,175,90,45,12 PUSHBUTTON "Replace",IDC_BUTTON_REPLACE,225,90,45,12 PUSHBUTTON "Remove",IDC_BUTTON_REMOVE,275,90,45,12 - LISTBOX IDC_LIST1,5,115,325,82,LBS_NOINTEGRALHEIGHT | WS_VSCROLL | WS_TABSTOP - CONTROL "",IDC_SPINMOVEMAPPING,"msctls_updown32",0x0,330,115,11,80 - CONTROL "MIDI learn",IDC_CHECK_MIDILEARN,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,335,30,47,11 - DEFPUSHBUTTON "Close",IDOK,335,10,50,14 - CONTROL "Pattern record",IDC_CHECK_PATRECORD,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,114,20,63,10 + LISTBOX IDC_LIST1,5,115,313,82,LBS_NOINTEGRALHEIGHT | WS_VSCROLL | WS_TABSTOP + CONTROL "",IDC_SPINMOVEMAPPING,"msctls_updown32",0x0,318,115,11,82 + CONTROL "MIDI Learn",IDC_CHECK_MIDILEARN,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,276,18,47,11 + DEFPUSHBUTTON "Close",IDOK,276,204,50,14 + CONTROL "Pattern Record",IDC_CHECK_PATRECORD,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,114,20,65,10 END IDD_TUNING DIALOGEX 0, 0, 512, 240 @@ -2748,9 +2748,9 @@ IDD_MIDIPARAMCONTROL, DIALOG BEGIN - RIGHTMARGIN, 388 + RIGHTMARGIN, 336 TOPMARGIN, 2 - BOTTOMMARGIN, 201 + BOTTOMMARGIN, 222 END IDD_TUNING, DIALOG This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <sag...@us...> - 2011-10-01 23:06:58
|
Revision: 1073 http://modplug.svn.sourceforge.net/modplug/?rev=1073&view=rev Author: saga-games Date: 2011-10-01 23:06:51 +0000 (Sat, 01 Oct 2011) Log Message: ----------- [Ref] Unified macro name retrieval [Mod] Changed some menu item names in the plugin editor to be more verbose Modified Paths: -------------- trunk/OpenMPT/mptrack/AbstractVstEditor.cpp trunk/OpenMPT/mptrack/Moddoc.cpp trunk/OpenMPT/mptrack/Moddoc.h trunk/OpenMPT/mptrack/Vstplug.cpp trunk/OpenMPT/mptrack/Vstplug.h trunk/OpenMPT/mptrack/mptrack.rc Modified: trunk/OpenMPT/mptrack/AbstractVstEditor.cpp =================================================================== --- trunk/OpenMPT/mptrack/AbstractVstEditor.cpp 2011-10-01 17:03:23 UTC (rev 1072) +++ trunk/OpenMPT/mptrack/AbstractVstEditor.cpp 2011-10-01 23:06:51 UTC (rev 1073) @@ -187,7 +187,7 @@ //-------------------------------------------- { int nIndex = nID - ID_PRESET_SET; - if (nIndex>=0) + if (nIndex >= 0) { m_pVstPlugin->SetCurrentProgram(nIndex); UpdatePresetField(); @@ -217,7 +217,8 @@ void CAbstractVstEditor::OnPassKeypressesToPlug() //----------------------------------------------- { - if (m_pVstPlugin) { + if (m_pVstPlugin) + { m_pVstPlugin->m_bPassKeypressesToPlug = !m_pVstPlugin->m_bPassKeypressesToPlug; } } @@ -378,6 +379,7 @@ #define PRESETS_PER_GROUP 128 void CAbstractVstEditor::UpdatePresetMenu() +//----------------------------------------- { long numProgs = m_pVstPlugin->GetNumPrograms(); long curProg = m_pVstPlugin->GetCurrentProgram(); @@ -454,6 +456,7 @@ } void CAbstractVstEditor::UpdateInputMenu() +//---------------------------------------- { CMenu* pInfoMenu = m_pMenu->GetSubMenu(2); pInfoMenu->DeleteMenu(0, MF_BYPOSITION); @@ -461,10 +464,12 @@ CModDoc* pModDoc = m_pVstPlugin->GetModDoc(); CSoundFile* pSndFile = pModDoc->GetSoundFile(); - if (m_pInputMenu->m_hMenu) { + if (m_pInputMenu->m_hMenu) + { m_pInputMenu->DestroyMenu(); } - if (!m_pInputMenu->m_hMenu) { + if (!m_pInputMenu->m_hMenu) + { m_pInputMenu->CreatePopupMenu(); } @@ -472,15 +477,18 @@ CArray<CVstPlugin*, CVstPlugin*> inputPlugs; m_pVstPlugin->GetInputPlugList(inputPlugs); - for (int nPlug=0; nPlug<inputPlugs.GetSize(); nPlug++) { + for (int nPlug=0; nPlug<inputPlugs.GetSize(); nPlug++) + { name.Format("FX%02d: %s", inputPlugs[nPlug]->m_nSlot+1, inputPlugs[nPlug]->m_pMixStruct->Info.szName); m_pInputMenu->AppendMenu(MF_STRING, ID_PLUGSELECT+inputPlugs[nPlug]->m_nSlot, name); } CArray<UINT, UINT> inputChannels; m_pVstPlugin->GetInputChannelList(inputChannels); - for (int nChn=0; nChn<inputChannels.GetSize(); nChn++) { - if (nChn==0 && inputPlugs.GetSize()) { + for (int nChn=0; nChn<inputChannels.GetSize(); nChn++) + { + if (nChn==0 && inputPlugs.GetSize()) + { m_pInputMenu->AppendMenu(MF_SEPARATOR); } name.Format("Chn%02d: %s", inputChannels[nChn]+1, pSndFile->ChnSettings[inputChannels[nChn]].szName); @@ -490,9 +498,11 @@ CArray<UINT, UINT> inputInstruments; m_pVstPlugin->GetInputInstrumentList(inputInstruments); bool checked; - for (int nIns=0; nIns<inputInstruments.GetSize(); nIns++) { + for (int nIns=0; nIns<inputInstruments.GetSize(); nIns++) + { checked=false; - if (nIns==0 && (inputPlugs.GetSize() || inputChannels.GetSize())) { + if (nIns==0 && (inputPlugs.GetSize() || inputChannels.GetSize())) + { m_pInputMenu->AppendMenu(MF_SEPARATOR); } name.Format("Ins%02d: %s", inputInstruments[nIns], (LPCTSTR)pSndFile->GetInstrumentName(inputInstruments[nIns])); @@ -502,7 +512,8 @@ if ((inputPlugs.GetSize() == 0) && (inputChannels.GetSize() == 0) && - (inputInstruments.GetSize() == 0)) { + (inputInstruments.GetSize() == 0)) + { m_pInputMenu->AppendMenu(MF_STRING|MF_GRAYED, NULL, "None"); } @@ -510,14 +521,17 @@ } void CAbstractVstEditor::UpdateOutputMenu() +//----------------------------------------- { CMenu* pInfoMenu = m_pMenu->GetSubMenu(2); pInfoMenu->DeleteMenu(1, MF_BYPOSITION); - if (m_pOutputMenu->m_hMenu) { + if (m_pOutputMenu->m_hMenu) + { m_pOutputMenu->DestroyMenu(); } - if (!m_pOutputMenu->m_hMenu) { + if (!m_pOutputMenu->m_hMenu) + { m_pOutputMenu->CreatePopupMenu(); } @@ -525,12 +539,14 @@ m_pVstPlugin->GetOutputPlugList(outputPlugs); CString name; - for (int nPlug=0; nPlug<outputPlugs.GetSize(); nPlug++) { + for (int nPlug = 0; nPlug < outputPlugs.GetSize(); nPlug++ + ) { if (outputPlugs[nPlug] != NULL) { name.Format("FX%02d: %s", outputPlugs[nPlug]->m_nSlot+1, outputPlugs[nPlug]->m_pMixStruct->Info.szName); m_pOutputMenu->AppendMenu(MF_STRING, ID_PLUGSELECT+outputPlugs[nPlug]->m_nSlot, name); - } else { + } else + { name = "Master Output"; m_pOutputMenu->AppendMenu(MF_STRING|MF_GRAYED, NULL, name); } @@ -543,9 +559,8 @@ //---------------------------------------- { CString label, macroName, macroText; - char paramName[128]; bool greyed; - int macroType,nParam,action; + int action; CModDoc* pModDoc = m_pVstPlugin->GetModDoc(); if (!pModDoc) @@ -565,60 +580,37 @@ m_pMacroMenu->CreatePopupMenu(); } - for (int nMacro=0; nMacro<NUM_MACROS; nMacro++) + for (int nMacro = 0; nMacro < NUM_MACROS; nMacro++) { - action=NULL; - greyed=true; + action = NULL; + greyed = true; macroText = pModDoc->GetSoundFile()->m_MidiCfg.szMidiSFXExt[nMacro]; - macroType = pModDoc->GetMacroType(macroText); + const enmParameteredMacroType macroType = pModDoc->GetMacroType(macroText); - switch (macroType) { - case sfx_unused: - macroName = "Unused. Learn Param..."; - action=ID_LEARN_MACRO_FROM_PLUGGUI+nMacro; - greyed=false; - break; - case sfx_cutoff: - macroName = "Set Filter Cutoff"; - break; - case sfx_reso: - macroName = "Set Filter Resonance"; - break; - case sfx_mode: macroName = "Set Filter Mode"; - break; - case sfx_drywet: - macroName = "Set plugin dry/wet ratio"; - greyed=false; - break; - case sfx_plug: - { - nParam = pModDoc->MacroToPlugParam(macroText); - m_pVstPlugin->GetParamName(nParam, paramName, sizeof(paramName)); - - if (paramName[0] == 0) { - strcpy(paramName, "N/A for this plug"); - } else { - greyed=false; - } - - macroName.Format("%d - %s", nParam, paramName); - break; + if(macroType == sfx_unused) + { + macroName = "Unused. Learn Param..."; + action= ID_LEARN_MACRO_FROM_PLUGGUI + nMacro; + greyed = false; + } else + { + macroName = pModDoc->GetMacroName(macroText, m_pVstPlugin->GetSlot()); + if(macroType != sfx_plug || macroName.Left(3) != "N/A") + { + greyed = false; } - case sfx_custom: - default: - macroName.Format("Custom: %s", macroText); - greyed=false; + } - } label.Format("SF%X: %s", nMacro, macroName); - m_pMacroMenu->AppendMenu(MF_STRING|(greyed?MF_GRAYED:0), action, label); + m_pMacroMenu->AppendMenu(MF_STRING | (greyed ? MF_GRAYED : 0), action, label); } - pInfoMenu->InsertMenu(2, MF_BYPOSITION|MF_POPUP, (UINT)m_pMacroMenu->m_hMenu, "&Macros"); + pInfoMenu->InsertMenu(2, MF_BYPOSITION | MF_POPUP, (UINT)m_pMacroMenu->m_hMenu, "&Macros"); } -void CAbstractVstEditor::UpdateOptionsMenu() { -//-------------------------------------------- +void CAbstractVstEditor::UpdateOptionsMenu() +//------------------------------------------ +{ if (m_pOptionsMenu->m_hMenu) m_pOptionsMenu->DestroyMenu(); @@ -628,14 +620,14 @@ m_pOptionsMenu->CreatePopupMenu(); //Bypass - m_pOptionsMenu->AppendMenu(MF_STRING | m_pVstPlugin->IsBypassed()?MF_CHECKED:0, - ID_PLUG_BYPASS, "&Bypass\t" + ih->GetKeyTextFromCommand(kcVSTGUIBypassPlug)); + m_pOptionsMenu->AppendMenu(MF_STRING | m_pVstPlugin->IsBypassed() ? MF_CHECKED : 0, + ID_PLUG_BYPASS, "&Bypass Plugin\t" + ih->GetKeyTextFromCommand(kcVSTGUIBypassPlug)); //Record Params - m_pOptionsMenu->AppendMenu(MF_STRING | m_pVstPlugin->m_bRecordAutomation?MF_CHECKED:0, - ID_PLUG_RECORDAUTOMATION, "Record &Params\t" + ih->GetKeyTextFromCommand(kcVSTGUIToggleRecordParams)); + m_pOptionsMenu->AppendMenu(MF_STRING | m_pVstPlugin->m_bRecordAutomation ? MF_CHECKED : 0, + ID_PLUG_RECORDAUTOMATION, "Record &Parameter Changes\t" + ih->GetKeyTextFromCommand(kcVSTGUIToggleRecordParams)); //Pass on keypresses - m_pOptionsMenu->AppendMenu(MF_STRING | m_pVstPlugin->m_bPassKeypressesToPlug?MF_CHECKED:0, - ID_PLUG_PASSKEYS, "Pass &Keys to Plug\t" + ih->GetKeyTextFromCommand(kcVSTGUIToggleSendKeysToPlug)); + m_pOptionsMenu->AppendMenu(MF_STRING | m_pVstPlugin->m_bPassKeypressesToPlug ? MF_CHECKED : 0, + ID_PLUG_PASSKEYS, "Pass &Keys to Plugin\t" + ih->GetKeyTextFromCommand(kcVSTGUIToggleSendKeysToPlug)); m_pMenu->DeleteMenu(3, MF_BYPOSITION); @@ -643,33 +635,41 @@ } + void CAbstractVstEditor::OnToggleEditor(UINT nID) +//----------------------------------------------- { CModDoc* pModDoc = m_pVstPlugin->GetModDoc(); - if (pModDoc) { + if (pModDoc) + { pModDoc->TogglePluginEditor(nID-ID_PLUGSELECT); } } + void CAbstractVstEditor::OnInitMenu(CMenu* /*pMenu*/) //--------------------------------------------------- { SetupMenu(); } + bool CAbstractVstEditor::CheckInstrument(int instrument) //------------------------------------------------------ { CSoundFile* pSndFile = m_pVstPlugin->GetSoundFile(); - if (instrument>=0 && instrument<MAX_INSTRUMENTS && pSndFile->Instruments[instrument]) { - return (pSndFile->Instruments[instrument]->nMixPlug) == (m_pVstPlugin->m_nSlot+1); + if (instrument >= 0 && instrument<MAX_INSTRUMENTS && pSndFile->Instruments[instrument]) + { + return (pSndFile->Instruments[instrument]->nMixPlug) == (m_pVstPlugin->m_nSlot + 1); } return false; } + int CAbstractVstEditor::GetBestInstrumentCandidate() +//-------------------------------------------------- { //First try current instrument: /* CModDoc* pModDoc = m_pVstPlugin->GetModDoc(); @@ -690,33 +690,39 @@ return -1; } + void CAbstractVstEditor::OnSetInputInstrument(UINT nID) +//----------------------------------------------------- { - m_nInstrument = (nID-ID_SELECTINST); + m_nInstrument = (nID - ID_SELECTINST); } + void CAbstractVstEditor::OnSetPreviousVSTPreset() -//-------------------------------------------- +//----------------------------------------------- { - OnSetPreset(-1+ID_PRESET_SET+m_pVstPlugin->GetCurrentProgram()); + OnSetPreset(ID_PRESET_SET + m_pVstPlugin->GetCurrentProgram() - 1); } + void CAbstractVstEditor::OnSetNextVSTPreset() -//---------------------------------------- +//------------------------------------------- { - OnSetPreset(1+ID_PRESET_SET+m_pVstPlugin->GetCurrentProgram()); + OnSetPreset(ID_PRESET_SET + m_pVstPlugin->GetCurrentProgram() + 1); } + void CAbstractVstEditor::OnVSTPresetBackwardJump() //------------------------------------------------ { - OnSetPreset(max(ID_PRESET_SET+m_pVstPlugin->GetCurrentProgram()-10, ID_PRESET_SET)); + OnSetPreset(max(ID_PRESET_SET + m_pVstPlugin->GetCurrentProgram() - 10, ID_PRESET_SET)); } + void CAbstractVstEditor::OnVSTPresetForwardJump() //----------------------------------------------- { - OnSetPreset(min(10+ID_PRESET_SET+m_pVstPlugin->GetCurrentProgram(), ID_PRESET_SET+m_pVstPlugin->GetNumPrograms()-1)); + OnSetPreset(min(ID_PRESET_SET + m_pVstPlugin->GetCurrentProgram() + 10, ID_PRESET_SET + m_pVstPlugin->GetNumPrograms() - 1)); } @@ -767,6 +773,7 @@ void CAbstractVstEditor::PrepareToLearnMacro(UINT nID) +//---------------------------------------------------- { m_nLearnMacro = (nID-ID_LEARN_MACRO_FROM_PLUGGUI); //Now we wait for a param to be touched. We'll get the message from the VST Plug Manager. @@ -774,6 +781,7 @@ } void CAbstractVstEditor::SetLearnMacro(int inMacro) +//------------------------------------------------- { if (inMacro < NUM_MACROS) { @@ -781,7 +789,9 @@ } } -int CAbstractVstEditor::GetLearnMacro() { +int CAbstractVstEditor::GetLearnMacro() +//------------------------------------- +{ return m_nLearnMacro; } Modified: trunk/OpenMPT/mptrack/Moddoc.cpp =================================================================== --- trunk/OpenMPT/mptrack/Moddoc.cpp 2011-10-01 17:03:23 UTC (rev 1072) +++ trunk/OpenMPT/mptrack/Moddoc.cpp 2011-10-01 23:06:51 UTC (rev 1073) @@ -2380,39 +2380,11 @@ if (macroText != "_no macro_") { - switch (GetMacroType(macroText)) - { - case sfx_unused: chanSpec.Append("Unused"); break; - case sfx_cutoff: chanSpec.Append("Cutoff"); break; - case sfx_reso: chanSpec.Append("Resonance"); break; - case sfx_mode: chanSpec.Append("Filter Mode"); break; - case sfx_drywet: chanSpec.Append("Plug wet/dry ratio"); break; - case sfx_cc: { - int nCC = MacroToMidiCC(macroText); - chanSpec.AppendFormat("MidiCC %d", nCC); - break; - } - case sfx_plug: { - int nParam = MacroToPlugParam(macroText); - char paramName[128]; - MemsetZero(paramName); - PLUGINDEX nPlug = m_SndFile.GetBestPlugin(nChn, PrioritiseChannel, EvenIfMuted); - if ((nPlug) && (nPlug<=MAX_MIXPLUGINS)) { - CVstPlugin *pPlug = (CVstPlugin*)m_SndFile.m_MixPlugins[nPlug-1].pMixPlugin; - if (pPlug) - pPlug->GetParamName(nParam, paramName, sizeof(paramName)); - if (paramName[0] == 0) - strcpy(paramName, "N/A"); - } - if (paramName[0] == 0) - strcpy(paramName, "N/A - no plug"); - chanSpec.AppendFormat("param %d (%s)", nParam, paramName); - break; } - case sfx_custom: - default: chanSpec.Append("Custom"); - } + const PLUGINDEX plugin = m_SndFile.GetBestPlugin(nChn, PrioritiseChannel, EvenIfMuted) - 1; + chanSpec.Append(GetMacroName(macroText, plugin)); } - if (chanSpec != "") { + if (chanSpec != "") + { strcat(pszDescription, chanSpec); } @@ -3271,19 +3243,68 @@ //---------------------------------------------------------- { 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; - if (value.Compare("F0F002z")==0) return sfx_mode; - if (value.Compare("F0F003z")==0) return sfx_drywet; - if (value.Compare("Bc00z")>=0 && value.Compare("BcFFz")<=0 && value.GetLength()==5) + if (value.Compare("") == 0) return sfx_unused; + if (value.Compare("F0F000z") == 0) return sfx_cutoff; + if (value.Compare("F0F001z") == 0) return sfx_reso; + if (value.Compare("F0F002z") == 0) return sfx_mode; + if (value.Compare("F0F003z") == 0) return sfx_drywet; + if (value.Compare("Bc00z") >= 0 && value.Compare("BcFFz") <= 0 && value.GetLength() == 5) return sfx_cc; - if (value.Compare("F0F079z")>0 && value.Compare("F0F1G")<0 && value.GetLength()==7) + if (value.Compare("F0F080z") >= 0 && value.Compare("F0F1FFz") <= 0 && value.GetLength() == 7) return sfx_plug; return sfx_custom; //custom/unknown } +// Returns macro description including plugin parameter / MIDI CC information +CString CModDoc::GetMacroName(CString value, PLUGINDEX plugin) +//------------------------------------------------------------ +{ + const enmParameteredMacroType macroType = GetMacroType(value); + + switch(macroType) + { + case sfx_plug: + { + const int param = MacroToPlugParam(value); + char paramName[128] = { '\0' }; + + if(plugin < MAX_MIXPLUGINS) + { + CVstPlugin *pPlug = (CVstPlugin*)m_SndFile.m_MixPlugins[plugin].pMixPlugin; + if(pPlug) + { + pPlug->GetParamName(param, paramName, sizeof(paramName)); + StringFixer::SetNullTerminator(paramName); + } + if (paramName[0] == '\0') + { + return _T("N/A"); + } + + CString formattedName; + formattedName.Format(_T("Param %d (%s)"), param, paramName); + return CString(formattedName); + } else + { + return _T("N/A - No Plugin"); + } + } + + case sfx_cc: + { + CString formattedCC; + formattedCC.Format(_T("MIDI CC %d"), MacroToMidiCC(value)); + return formattedCC; + } + + default: + return GetMacroName(macroType); + } +} + + +// Returns generic macro description. CString CModDoc::GetMacroName(enmParameteredMacroType macro) //---------------------------------------------------------- { Modified: trunk/OpenMPT/mptrack/Moddoc.h =================================================================== --- trunk/OpenMPT/mptrack/Moddoc.h 2011-10-01 17:03:23 UTC (rev 1072) +++ trunk/OpenMPT/mptrack/Moddoc.h 2011-10-01 23:06:51 UTC (rev 1073) @@ -256,6 +256,7 @@ // Various MIDI Macro helpers static enmParameteredMacroType GetMacroType(CString value); //rewbs.xinfo + CString GetMacroName(CString value, PLUGINDEX plugin); static CString GetMacroName(enmParameteredMacroType macro); static int MacroToPlugParam(CString value); //rewbs.xinfo static int MacroToMidiCC(CString value); Modified: trunk/OpenMPT/mptrack/Vstplug.cpp =================================================================== --- trunk/OpenMPT/mptrack/Vstplug.cpp 2011-10-01 17:03:23 UTC (rev 1072) +++ trunk/OpenMPT/mptrack/Vstplug.cpp 2011-10-01 23:06:51 UTC (rev 1073) @@ -2965,10 +2965,10 @@ } -UINT CVstPlugin::FindSlot() -//------------------------ +PLUGINDEX CVstPlugin::FindSlot() +//------------------------------ { - UINT slot = 0; + PLUGINDEX slot = 0; if (m_pSndFile) { while ((m_pMixStruct != &(m_pSndFile->m_MixPlugins[slot])) && slot < MAX_MIXPLUGINS - 1) @@ -2979,14 +2979,14 @@ return slot; } -void CVstPlugin::SetSlot(UINT slot) -//--------------------------------- +void CVstPlugin::SetSlot(PLUGINDEX slot) +//-------------------------------------- { m_nSlot = slot; } -UINT CVstPlugin::GetSlot() -//------------------------ +PLUGINDEX CVstPlugin::GetSlot() +//----------------------------- { return m_nSlot; } Modified: trunk/OpenMPT/mptrack/Vstplug.h =================================================================== --- trunk/OpenMPT/mptrack/Vstplug.h 2011-10-01 17:03:23 UTC (rev 1072) +++ trunk/OpenMPT/mptrack/Vstplug.h 2011-10-01 23:06:51 UTC (rev 1073) @@ -98,7 +98,7 @@ DWORD m_dwTimeAtStartOfProcess; bool m_bModified; HANDLE processCalled; - UINT m_nSlot; + PLUGINDEX m_nSlot; float m_fGain; bool m_bIsInstrument; @@ -125,9 +125,9 @@ bool isModified() {return m_bModified;} inline CModDoc* GetModDoc() {return m_pModDoc;} inline CSoundFile* GetSoundFile() {return m_pSndFile;} - UINT FindSlot(); - void SetSlot(UINT slot); - UINT GetSlot(); + PLUGINDEX FindSlot(); + void SetSlot(PLUGINDEX slot); + PLUGINDEX GetSlot(); void UpdateMixStructPtr(PSNDMIXPLUGIN); void SetCurrentProgram(UINT nIndex); Modified: trunk/OpenMPT/mptrack/mptrack.rc =================================================================== --- trunk/OpenMPT/mptrack/mptrack.rc 2011-10-01 17:03:23 UTC (rev 1072) +++ trunk/OpenMPT/mptrack/mptrack.rc 2011-10-01 23:06:51 UTC (rev 1073) @@ -2827,7 +2827,7 @@ MENUITEM "&Save Preset As...", ID_PRESET_SAVE MENUITEM "Create instrument from plugin", ID_PLUGINTOINSTRUMENT MENUITEM SEPARATOR - MENUITEM "&Randomize Params", ID_PRESET_RANDOM + MENUITEM "&Randomize Parameters", ID_PRESET_RANDOM END POPUP "&Info" BEGIN @@ -2837,8 +2837,8 @@ END POPUP "&Options" BEGIN - MENUITEM "&Bypass", ID_PLUG_BYPASS - MENUITEM "Record &Params", ID_PLUG_RECORDAUTOMATION + MENUITEM "&Bypass Plugin", ID_PLUG_BYPASS + MENUITEM "Record &Parameter Changes", ID_PLUG_RECORDAUTOMATION END END This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <sag...@us...> - 2011-10-03 19:20:35
|
Revision: 1079 http://modplug.svn.sourceforge.net/modplug/?rev=1079&view=rev Author: saga-games Date: 2011-10-03 19:20:29 +0000 (Mon, 03 Oct 2011) Log Message: ----------- [Imp] General Tab: Like the plugin preset box, the plugin parameter selection box is now only populated when needed. [Imp] General Tab: Plugin parameter indexes aren't ORed with 0x80 anymore (why was this done in the first place?) Modified Paths: -------------- trunk/OpenMPT/mptrack/View_gen.cpp trunk/OpenMPT/mptrack/View_gen.h trunk/OpenMPT/mptrack/resource.h Modified: trunk/OpenMPT/mptrack/View_gen.cpp =================================================================== --- trunk/OpenMPT/mptrack/View_gen.cpp 2011-10-03 16:52:48 UTC (rev 1078) +++ trunk/OpenMPT/mptrack/View_gen.cpp 2011-10-03 19:20:29 UTC (rev 1079) @@ -13,9 +13,7 @@ #include "SelectPluginDialog.h" #include "../common/StringFixer.h" -#define ID_FXCOMMANDS_BASE 41000 - IMPLEMENT_SERIAL(CViewGlobals, CFormView, 0) BEGIN_MESSAGE_MAP(CViewGlobals, CFormView) @@ -79,7 +77,10 @@ ON_CBN_SELCHANGE(IDC_COMBO3, OnFx3Changed) ON_CBN_SELCHANGE(IDC_COMBO4, OnFx4Changed) ON_CBN_SELCHANGE(IDC_COMBO5, OnPluginChanged) + ON_CBN_SELCHANGE(IDC_COMBO6, OnParamChanged) + ON_CBN_SETFOCUS(IDC_COMBO6, OnFillParamCombo) + ON_CBN_SELCHANGE(IDC_COMBO7, OnOutputRoutingChanged) // -> CODE#0002 @@ -441,7 +442,9 @@ // -> CODE#0028 // -> DESC="effect plugin mixing mode combo" - if(pVstPlugin && pVstPlugin->isInstrument()){ // ericus 18/02/2005 : disable mix mode for VSTi + if(pVstPlugin && pVstPlugin->isInstrument()) + { + // ericus 18/02/2005 : disable mix mode for VSTi ::EnableWindow(::GetDlgItem(m_hWnd, IDC_COMBO9), FALSE); ::EnableWindow(::GetDlgItem(m_hWnd, IDC_CHECK12), FALSE); } @@ -462,28 +465,26 @@ if (pVstPlugin) { -// -> CODE#0002 -// -> DESC="VST plugins presets" - CHAR sname[64]; -// -! NEW_FEATURE#0002 UINT nParams = pVstPlugin->GetNumParameters(); m_CbnParam.SetRedraw(FALSE); m_CbnParam.ResetContent(); - UINT i = 0; - for (i=0; i<nParams; i++) + if (m_nCurrentParam >= nParams) m_nCurrentParam = 0; + + if(nParams) { - pVstPlugin->GetParamName(i, sname, sizeof(sname)); - wsprintf(s, "%02X: %s", i|0x80, sname); - m_CbnParam.SetItemData(m_CbnParam.AddString(s), i); + char sname[64]; + pVstPlugin->GetParamName(m_nCurrentParam, sname, sizeof(sname)); + wsprintf(s, "%02X: %s", m_nCurrentParam, sname); + m_CbnParam.SetItemData(m_CbnParam.AddString(s), m_nCurrentParam); } - m_CbnParam.SetRedraw(TRUE); - if (m_nCurrentParam >= nParams) m_nCurrentParam = 0; - m_CbnParam.SetCurSel(m_nCurrentParam); + + m_CbnParam.SetCurSel(0); + m_CbnParam.SetRedraw(TRUE); OnParamChanged(); + + // Input / Output type pVstPlugin->GetPluginType(s); -// -> CODE#0002 -// -> DESC="VST plugins presets" // For now, only display the "current" preset. // This prevents the program from hanging when switching between plugin slots or // switching to the general tab and the first plugin in the list has a lot of presets. @@ -500,15 +501,13 @@ m_sbDryRatio.EnableWindow(TRUE); ::EnableWindow(::GetDlgItem(m_hWnd, IDC_EDIT14), TRUE); ::EnableWindow(::GetDlgItem(m_hWnd, IDC_BUTTON3), TRUE); -// -! NEW_FEATURE#0002 } else { s[0] = 0; if (m_CbnParam.GetCount() > 0) m_CbnParam.ResetContent(); m_nCurrentParam = 0; -// -> CODE#0002 -// -> DESC="VST plugins presets" + CHAR s2[16]; m_CbnPreset.SetRedraw(FALSE); m_CbnPreset.ResetContent(); @@ -521,7 +520,6 @@ m_sbDryRatio.EnableWindow(FALSE); ::EnableWindow(::GetDlgItem(m_hWnd, IDC_EDIT14), FALSE); ::EnableWindow(::GetDlgItem(m_hWnd, IDC_BUTTON3), FALSE); -// -! NEW_FEATURE#0002 } SetDlgItemText(IDC_TEXT6, s); int outputsel = 0; @@ -955,7 +953,7 @@ void CViewGlobals::OnParamChanged() //--------------------------------- { - int cursel = m_CbnParam.GetCurSel(); + int cursel = m_CbnParam.GetItemData(m_CbnParam.GetCurSel()); CModDoc *pModDoc = GetDocument(); CHAR s[256]; PSNDMIXPLUGIN pPlugin; @@ -964,11 +962,11 @@ if ((m_nCurrentPlugin >= MAX_MIXPLUGINS) || (!pModDoc)) return; pSndFile = pModDoc->GetSoundFile(); pPlugin = &pSndFile->m_MixPlugins[m_nCurrentPlugin]; - if (pPlugin->pMixPlugin) + if (pPlugin->pMixPlugin && cursel != CB_ERR) { CVstPlugin *pVstPlugin = (CVstPlugin *)pPlugin->pMixPlugin; - UINT nParams = pVstPlugin->GetNumParameters(); - if ((cursel >= 0) && (cursel < (int)nParams)) m_nCurrentParam = cursel; + const PlugParamIndex nParams = pVstPlugin->GetNumParameters(); + if ((cursel >= 0) && (cursel < nParams)) m_nCurrentParam = cursel; if (m_nCurrentParam < nParams) { CHAR sunits[64], sdisplay[64]; @@ -1509,6 +1507,41 @@ } +// The plugin param box is only filled when it gets the focus (done here). +void CViewGlobals::OnFillParamCombo() +//----------------------------------- +{ + // no need to fill it again. + if(m_CbnParam.GetCount() > 1) + return; + + if(GetDocument() == nullptr) return; + CSoundFile *pSndFile = GetDocument()->GetSoundFile(); + if(pSndFile == nullptr) return; + if (m_nCurrentPlugin >= MAX_MIXPLUGINS) m_nCurrentPlugin = 0; + PSNDMIXPLUGIN pPlugin = &(pSndFile->m_MixPlugins[m_nCurrentPlugin]); + CVstPlugin *pVstPlugin = (pPlugin->pMixPlugin) ? (CVstPlugin *)pPlugin->pMixPlugin : nullptr; + if(pVstPlugin == nullptr) return; + + CHAR s[128]; + CHAR sname[64]; + const PlugParamIndex nParams = pVstPlugin->GetNumParameters(); + m_CbnParam.SetRedraw(FALSE); + m_CbnParam.ResetContent(); + + for(PlugParamIndex i = 0; i < nParams; i++) + { + pVstPlugin->GetParamName(i, sname, sizeof(sname)); + wsprintf(s, "%02X: %s", i, sname); + m_CbnParam.SetItemData(m_CbnParam.AddString(s), i); + } + + if (m_nCurrentParam >= nParams) m_nCurrentParam = 0; + m_CbnParam.SetCurSel(m_nCurrentParam); + m_CbnParam.SetRedraw(TRUE); +} + + // The preset box is only filled when it gets the focus (done here). void CViewGlobals::OnFillProgramCombo() //------------------------------------- Modified: trunk/OpenMPT/mptrack/View_gen.h =================================================================== --- trunk/OpenMPT/mptrack/View_gen.h 2011-10-03 16:52:48 UTC (rev 1078) +++ trunk/OpenMPT/mptrack/View_gen.h 2011-10-03 19:20:29 UTC (rev 1079) @@ -112,6 +112,7 @@ afx_msg void OnFx4Changed(); afx_msg void OnPluginChanged(); afx_msg void OnPluginNameChanged(); + afx_msg void OnFillParamCombo(); afx_msg void OnParamChanged(); // -> CODE#0002 // -> DESC="VST plugins presets" Modified: trunk/OpenMPT/mptrack/resource.h =================================================================== --- trunk/OpenMPT/mptrack/resource.h 2011-10-03 16:52:48 UTC (rev 1078) +++ trunk/OpenMPT/mptrack/resource.h 2011-10-03 19:20:29 UTC (rev 1079) @@ -1207,6 +1207,8 @@ #define ID_HELP_EXAMPLEMODULES 44459 #define ID_FILE_SAVEASTEMPLATE 44460 #define ID_ORDERLIST_INSERT_SEPARATOR 44461 +#define ID_FXCOMMANDS_BASE 44462 +// From here: Command range [ID_FXCOMMANDS_BASE, ID_FXCOMMANDS_BASE + 10] // Next default values for new objects // @@ -1214,7 +1216,7 @@ #ifndef APSTUDIO_READONLY_SYMBOLS #define _APS_3D_CONTROLS 1 #define _APS_NEXT_RESOURCE_VALUE 531 -#define _APS_NEXT_COMMAND_VALUE 44462 +#define _APS_NEXT_COMMAND_VALUE 44474 #define _APS_NEXT_CONTROL_VALUE 2438 #define _APS_NEXT_SYMED_VALUE 901 #endif This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <sag...@us...> - 2011-10-03 20:47:30
|
Revision: 1080 http://modplug.svn.sourceforge.net/modplug/?rev=1080&view=rev Author: saga-games Date: 2011-10-03 20:47:23 +0000 (Mon, 03 Oct 2011) Log Message: ----------- [Mod] Default keymap: Note Cut / Off / Fade without instrument number is now default. Modified Paths: -------------- trunk/OpenMPT/mptrack/CommandSet.cpp trunk/OpenMPT/mptrack/CommandSet.h trunk/OpenMPT/mptrack/res/defaultKeybindings.mkb Modified: trunk/OpenMPT/mptrack/CommandSet.cpp =================================================================== --- trunk/OpenMPT/mptrack/CommandSet.cpp 2011-10-03 19:20:29 UTC (rev 1079) +++ trunk/OpenMPT/mptrack/CommandSet.cpp 2011-10-03 20:47:23 UTC (rev 1080) @@ -475,8 +475,8 @@ DefineKeyCommand(kcClearFieldITStyle, 1664, _T("Clear field (IT Style)")); DefineKeyCommand(kcClearFieldStepITStyle, 1665, _T("Clear field and step (IT Style)")); DefineKeyCommand(kcSetFXextension, 1666, _T("FX parameter extension command")); - DefineKeyCommand(kcNoteCutOld, 1667, _T("Note Cut (don't remember instrument)")); - DefineKeyCommand(kcNoteOffOld, 1668, _T("Note Off (don't remember instrument)")); + DefineKeyCommand(kcNoteCutOld, 1667, _T("Note Cut (without instrument number)")); + DefineKeyCommand(kcNoteOffOld, 1668, _T("Note Off (without instrument number)")); DefineKeyCommand(kcViewAddPlugin, 1669, _T("View Plugin Manager")); DefineKeyCommand(kcViewChannelManager, 1670, _T("View Channel Manager")); DefineKeyCommand(kcCopyAndLoseSelection, 1671, _T("Copy and lose selection")); @@ -538,7 +538,7 @@ DefineKeyCommand(kcNotePCS, 1789, _T("Parameter control(smooth)(MPTm only)")); DefineKeyCommand(kcSampleRemoveDCOffset, 1790, _T("Remove DC Offset")); DefineKeyCommand(kcNoteFade, 1791, _T("Note Fade")); - DefineKeyCommand(kcNoteFadeOld, 1792, _T("Note Fade (don't remember instrument)")); + DefineKeyCommand(kcNoteFadeOld, 1792, _T("Note Fade (without instrument number)")); DefineKeyCommand(kcEditPasteFlood, 1793, _T("Paste Flood")); DefineKeyCommand(kcOrderlistNavigateLeft, 1794, _T("Previous Order")); DefineKeyCommand(kcOrderlistNavigateRight, 1795, _T("Next Order")); Modified: trunk/OpenMPT/mptrack/CommandSet.h =================================================================== --- trunk/OpenMPT/mptrack/CommandSet.h 2011-10-03 19:20:29 UTC (rev 1079) +++ trunk/OpenMPT/mptrack/CommandSet.h 2011-10-03 20:47:23 UTC (rev 1080) @@ -443,12 +443,12 @@ //Note Misc kcStartNoteMisc, kcChordModifier=kcStartNoteMisc, + kcNoteCutOld, + kcNoteOffOld, + kcNoteFadeOld, kcNoteCut, kcNoteOff, kcNoteFade, - kcNoteCutOld, - kcNoteOffOld, - kcNoteFadeOld, kcNotePC, kcNotePCS, kcEndNoteMisc=kcNotePCS, Modified: trunk/OpenMPT/mptrack/res/defaultKeybindings.mkb =================================================================== --- trunk/OpenMPT/mptrack/res/defaultKeybindings.mkb 2011-10-03 19:20:29 UTC (rev 1079) +++ trunk/OpenMPT/mptrack/res/defaultKeybindings.mkb 2011-10-03 20:47:23 UTC (rev 1080) @@ -170,9 +170,9 @@ 3:1221:0:57:1 //Set octave 9: 9 (KeyDown) 3:1221:0:105:1 //Set octave 9: NUM 9 (KeyDown) 3:1316:1:16:1 //Chord Modifier: Shift (KeyDown) -3:1200:0:192:1 //Note Cut: ' (KeyDown) -3:1201:0:187:1 //Note Off: = (KeyDown) -3:1791:1:187:1 //Note Fade: Shift+= (KeyDown) +3:1667:0:192:1 //Note Cut (without instrument number): ' (KeyDown) +3:1668:0:187:1 //Note Off (without instrument number): = (KeyDown) +3:1792:1:187:1 //Note Fade (without instrument number): Shift+= (KeyDown) 3:1788:1:189:1 //Parameter control(MPTm only): Shift+- (KeyDown) 3:1789:0:189:1 //Parameter control(smooth)(MPTm only): - (KeyDown) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <sag...@us...> - 2011-10-05 20:47:40
|
Revision: 1088 http://modplug.svn.sourceforge.net/modplug/?rev=1088&view=rev Author: saga-games Date: 2011-10-05 20:47:34 +0000 (Wed, 05 Oct 2011) Log Message: ----------- [Fix] Building with NO_VST defined was broken since a few hundred revisions ago. Modified Paths: -------------- trunk/OpenMPT/mptrack/SelectPluginDialog.cpp trunk/OpenMPT/mptrack/Vstplug.h Modified: trunk/OpenMPT/mptrack/SelectPluginDialog.cpp =================================================================== --- trunk/OpenMPT/mptrack/SelectPluginDialog.cpp 2011-10-05 18:52:07 UTC (rev 1087) +++ trunk/OpenMPT/mptrack/SelectPluginDialog.cpp 2011-10-05 20:47:34 UTC (rev 1088) @@ -16,6 +16,8 @@ #include "SelectPluginDialog.h" +#ifndef NO_VST + ///////////////////////////////////////////////////////////////////////////////// // Plugin selection dialog @@ -499,3 +501,5 @@ lpMMI->ptMinTrackSize.y = 270; CDialog::OnGetMinMaxInfo(lpMMI); } + +#endif // NO_VST Modified: trunk/OpenMPT/mptrack/Vstplug.h =================================================================== --- trunk/OpenMPT/mptrack/Vstplug.h 2011-10-05 18:52:07 UTC (rev 1087) +++ trunk/OpenMPT/mptrack/Vstplug.h 2011-10-05 20:47:34 UTC (rev 1088) @@ -211,7 +211,7 @@ void GetPluginType(LPSTR) {} PlugParamIndex GetNumPrograms() {return 0;} bool GetProgramNameIndexed(long, long, char*) {return false;} - CString GetFormattedProgramName(VstInt32 index, bool allowFallback = false) { return "" }; + CString GetFormattedProgramName(VstInt32 index, bool allowFallback = false) { return ""; }; void SetParameter(PlugParamIndex nIndex, PlugParamValue fValue) {} void GetParamLabel(UINT, LPSTR) {} void GetParamDisplay(UINT, LPSTR) {} This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <sag...@us...> - 2011-10-05 21:40:38
|
Revision: 1089 http://modplug.svn.sourceforge.net/modplug/?rev=1089&view=rev Author: saga-games Date: 2011-10-05 21:40:31 +0000 (Wed, 05 Oct 2011) Log Message: ----------- [Mod] Keyboard Setup Dialog: The commented out message boxes were replaced by Windows sounds. [Fix] Tree View: Fixed mnemonics in context menus. [Mod] Clarified log message when opening a module. Modified Paths: -------------- trunk/OpenMPT/mptrack/KeyConfigDlg.cpp trunk/OpenMPT/mptrack/Moddoc.cpp trunk/OpenMPT/mptrack/View_tre.cpp Modified: trunk/OpenMPT/mptrack/KeyConfigDlg.cpp =================================================================== --- trunk/OpenMPT/mptrack/KeyConfigDlg.cpp 2011-10-05 20:47:34 UTC (rev 1088) +++ trunk/OpenMPT/mptrack/KeyConfigDlg.cpp 2011-10-05 21:40:31 UTC (rev 1089) @@ -531,6 +531,7 @@ { // Annoying message box is annoying. //Reporting::Error("Nothing to restore for this slot.", "Invalid key data", this); + ::MessageBeep(MB_ICONWARNING); return; } @@ -552,6 +553,7 @@ { // Annoying message box is annoying. //Reporting::Warning("No key currently set for this slot.", "Invalid key data", this); + ::MessageBeep(MB_ICONWARNING); return; } @@ -593,6 +595,7 @@ } if (!kc.event) { + ::MessageBeep(MB_ICONWARNING); /* CString error = "You need to select at least one key event type (up, down or hold)."; Reporting::Warning(error, "Invalid key data"); return; Modified: trunk/OpenMPT/mptrack/Moddoc.cpp =================================================================== --- trunk/OpenMPT/mptrack/Moddoc.cpp 2011-10-05 20:47:34 UTC (rev 1088) +++ trunk/OpenMPT/mptrack/Moddoc.cpp 2011-10-05 21:40:31 UTC (rev 1089) @@ -232,7 +232,7 @@ if (GetLog() != nullptr) { CString sTemp; - sTemp.Format("File: %s\nLast saved with: %s, current version is %s\n\n%s", lpszPathName, (LPCTSTR)MptVersion::ToStr(m_SndFile.m_dwLastSavedWithVersion), MptVersion::str, GetLog()); + sTemp.Format("File: %s\nLast saved with: %s, your version is %s\n\n%s", lpszPathName, (LPCTSTR)MptVersion::ToStr(m_SndFile.m_dwLastSavedWithVersion), MptVersion::str, GetLog()); Reporting::Information(sTemp); ClearLog(); } Modified: trunk/OpenMPT/mptrack/View_tre.cpp =================================================================== --- trunk/OpenMPT/mptrack/View_tre.cpp 2011-10-05 20:47:34 UTC (rev 1088) +++ trunk/OpenMPT/mptrack/View_tre.cpp 2011-10-05 21:40:31 UTC (rev 1089) @@ -2457,7 +2457,7 @@ if ((pModDoc) && (!pModDoc->GetNumInstruments())) { AppendMenu(hMenu, MF_SEPARATOR, NULL, ""); - AppendMenu(hMenu, (pModDoc->IsSampleMuted((SAMPLEINDEX)modItemID) ? MF_CHECKED:0)|MF_STRING, ID_MODTREE_MUTE, "&Mute Sample"); + AppendMenu(hMenu, (pModDoc->IsSampleMuted((SAMPLEINDEX)modItemID) ? MF_CHECKED : 0) | MF_STRING, ID_MODTREE_MUTE, "&Mute Sample"); AppendMenu(hMenu, MF_STRING, ID_MODTREE_SOLO, "&Solo Sample"); AppendMenu(hMenu, MF_STRING, ID_MODTREE_UNMUTEALL, "&Unmute all"); } @@ -2474,14 +2474,17 @@ if ((pModDoc) && (pModDoc->GetNumInstruments())) { AppendMenu(hMenu, MF_SEPARATOR, NULL, ""); - AppendMenu(hMenu, (pModDoc->IsInstrumentMuted((INSTRUMENTINDEX)modItemID) ? MF_CHECKED:0)|MF_STRING, ID_MODTREE_MUTE, "&Mute Instrument"); - AppendMenu(hMenu, MF_STRING, ID_MODTREE_SOLO, "&Solo Instrument"); + AppendMenu(hMenu, (pModDoc->IsInstrumentMuted((INSTRUMENTINDEX)modItemID) ? MF_CHECKED : 0) | MF_STRING, ID_MODTREE_MUTE, "&Mute Instrument"); + AppendMenu(hMenu, MF_STRING, ID_MODTREE_SOLO, "S&olo Instrument"); AppendMenu(hMenu, MF_STRING, ID_MODTREE_UNMUTEALL, "&Unmute all"); // -> CODE#0023 // -> DESC="IT project files (.itp)" - AppendMenu(hMenu, MF_SEPARATOR, NULL, ""); - AppendMenu(hMenu, MF_STRING, ID_MODTREE_SETPATH, "&Set path"); - AppendMenu(hMenu, MF_STRING, ID_MODTREE_SAVEITEM, "&Save"); + if(pModDoc->GetSoundFile()->m_dwSongFlags & SONG_ITPROJECT) + { + AppendMenu(hMenu, MF_SEPARATOR, NULL, ""); + AppendMenu(hMenu, MF_STRING, ID_MODTREE_SETPATH, "Set p&ath"); + AppendMenu(hMenu, MF_STRING, ID_MODTREE_SAVEITEM, "&Save"); + } // -! NEW_FEATURE#0023 } } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |