From: <Rel...@us...> - 2007-11-17 18:00:04
|
Revision: 192 http://modplug.svn.sourceforge.net/modplug/?rev=192&view=rev Author: Relabsoluness Date: 2007-11-17 09:59:58 -0800 (Sat, 17 Nov 2007) Log Message: ----------- + Improved VST preset navigation in VST window. Known problem: doesn't update if preset is changed from VSTs own preset navigation. + Improvements in IT compatibility playmode. When loading ITs, if file doesn't seem modplug made, then automatically setting IT compatibility playmode. The playmode setting can be toggled in song properties dialog, and the autodetection with an ini setting. + 'key binding not understood'-messages can be disabled with an ini setting. . Fixed wrong file version in IT compatibility save. (http://lpchip.com/modplug/viewtopic.php?t=1723) . Fixed possible unnotified overwriting of file occurring for example when dealing with a new file. (http://lpchip.com/modplug/viewtopic.php?t=1813) . Fixed broken note preview for certain type of instruments in instrument tab. (http://lpchip.com/modplug/viewtopic.php?t=1996) . Fixed possible crash on channel mode wav export when a channel has a long name. (http://lpchip.com/modplug/viewtopic.php?t=2005) . Fixed pattern position indicator jump when clicking VST-box in channel header. (http://lpchip.com/modplug/viewtopic.php?t=2014) . CMainFrame::m_csExecutablePath renamed and should now contain the path of executable directory, not that of the working directory. / Tuning related changes/improvements Modified Paths: -------------- trunk/OpenMPT/mptrack/AbstractVstEditor.cpp trunk/OpenMPT/mptrack/AbstractVstEditor.h trunk/OpenMPT/mptrack/AutoSaver.cpp trunk/OpenMPT/mptrack/ChannelManagerDlg.cpp trunk/OpenMPT/mptrack/CommandSet.cpp trunk/OpenMPT/mptrack/CommandSet.h trunk/OpenMPT/mptrack/Ctrl_ins.cpp trunk/OpenMPT/mptrack/Ctrl_ins.h trunk/OpenMPT/mptrack/Draw_pat.cpp trunk/OpenMPT/mptrack/InputHandler.cpp trunk/OpenMPT/mptrack/MainFrm.cpp trunk/OpenMPT/mptrack/Mainfrm.h trunk/OpenMPT/mptrack/Moddoc.cpp trunk/OpenMPT/mptrack/Moddoc.h trunk/OpenMPT/mptrack/Modedit.cpp trunk/OpenMPT/mptrack/Mptrack.cpp trunk/OpenMPT/mptrack/Mptrack.h trunk/OpenMPT/mptrack/OrderToPatternTable.cpp trunk/OpenMPT/mptrack/ScaleEnvPointsDlg.cpp trunk/OpenMPT/mptrack/TuningDialog.cpp trunk/OpenMPT/mptrack/TuningDialog.h trunk/OpenMPT/mptrack/View_gen.cpp trunk/OpenMPT/mptrack/View_ins.cpp trunk/OpenMPT/mptrack/View_pat.cpp trunk/OpenMPT/mptrack/View_pat.h trunk/OpenMPT/mptrack/bin/tunings/standard/std_tunings.tc trunk/OpenMPT/mptrack/dlg_misc.cpp trunk/OpenMPT/mptrack/dlg_misc.h trunk/OpenMPT/mptrack/misc_util.h trunk/OpenMPT/mptrack/mptrack.rc trunk/OpenMPT/mptrack/pattern.cpp trunk/OpenMPT/mptrack/pattern.h trunk/OpenMPT/mptrack/resource.h trunk/OpenMPT/mptrack/serialization_utils.cpp trunk/OpenMPT/mptrack/serialization_utils.h trunk/OpenMPT/mptrack/tuningRatioMapWnd.cpp trunk/OpenMPT/mptrack/tuningRatioMapWnd.h trunk/OpenMPT/mptrack/typedefs.h trunk/OpenMPT/soundlib/Load_it.cpp trunk/OpenMPT/soundlib/Load_xm.cpp trunk/OpenMPT/soundlib/Snd_fx.cpp trunk/OpenMPT/soundlib/Sndfile.cpp trunk/OpenMPT/soundlib/Sndfile.h trunk/OpenMPT/soundlib/Sndmix.cpp trunk/OpenMPT/soundlib/mod_specifications.h trunk/OpenMPT/soundlib/modcommand.h trunk/OpenMPT/soundlib/tuning.cpp trunk/OpenMPT/soundlib/tuning.h trunk/OpenMPT/soundlib/tuningCollection.cpp trunk/OpenMPT/soundlib/tuningcollection.h trunk/OpenMPT/soundlib/wavConverter.h Added Paths: ----------- trunk/OpenMPT/soundlib/load_mptm.cpp trunk/OpenMPT/soundlib/tuningbase.cpp trunk/OpenMPT/soundlib/tuningbase.h Removed Paths: ------------- trunk/OpenMPT/mptrack/bin/tunings/local_tunings.tc trunk/OpenMPT/soundlib/tuning_template.h Property Changed: ---------------- trunk/OpenMPT/mptrack/ Property changes on: trunk/OpenMPT/mptrack ___________________________________________________________________ Name: svn:ignore + *.sln *.vcproj Modified: trunk/OpenMPT/mptrack/AbstractVstEditor.cpp =================================================================== --- trunk/OpenMPT/mptrack/AbstractVstEditor.cpp 2007-07-11 20:36:02 UTC (rev 191) +++ trunk/OpenMPT/mptrack/AbstractVstEditor.cpp 2007-11-17 17:59:58 UTC (rev 192) @@ -21,6 +21,10 @@ ON_COMMAND(ID_PRESET_RANDOM, OnRandomizePreset) ON_COMMAND(ID_VSTMACRO_INFO, OnMacroInfo) ON_COMMAND(ID_VSTINPUT_INFO, OnInputInfo) + ON_COMMAND(ID_PREVIOUSVSTPRESET, OnSetPreviousVSTPreset) + ON_COMMAND(ID_NEXTVSTPRESET, OnSetNextVSTPreset) + ON_COMMAND(ID_VSTPRESETBACKWARDJUMP,OnVSTPresetBackwardJump) + ON_COMMAND(ID_VSTPRESETFORWARDJUMP, OnVSTPresetForwardJump) ON_COMMAND_RANGE(ID_PRESET_SET, ID_PRESET_SET+MAX_PLUGPRESETS, OnSetPreset) ON_MESSAGE(WM_MOD_KEYCOMMAND, OnCustomKeyMsg) //rewbs.customKeys ON_COMMAND_RANGE(ID_PLUGSELECT, ID_PLUGSELECT+MAX_MIXPLUGINS, OnToggleEditor) //rewbs.patPlugName @@ -36,7 +40,7 @@ m_pInputMenu = new CMenu(); m_pOutputMenu = new CMenu(); m_pMacroMenu = new CMenu(); - + m_pPresetMenu = new CMenu(); m_pPresetMenuGroup.SetSize(0); @@ -137,17 +141,50 @@ UpdateOutputMenu(); UpdateMacroMenu(); UpdateOptionsMenu(); + UpdatePresetField(); ::SetMenu(m_hWnd, m_pMenu->m_hMenu); } return; } +void CAbstractVstEditor::UpdatePresetField() +//------------------------------------------ +{ + if(m_pVstPlugin->GetNumPrograms() > 0 && m_pMenu->GetMenuItemCount() < 5) + { + m_pMenu->InsertMenu(4, MF_BYPOSITION, ID_VSTPRESETBACKWARDJUMP, (LPCTSTR)"<<"); + m_pMenu->InsertMenu(5, MF_BYPOSITION, ID_PREVIOUSVSTPRESET, (LPCTSTR)"<"); + m_pMenu->InsertMenu(6, MF_BYPOSITION, ID_NEXTVSTPRESET, (LPCTSTR)">"); + m_pMenu->InsertMenu(7, MF_BYPOSITION, ID_VSTPRESETFORWARDJUMP, (LPCTSTR)">>"); + m_pMenu->InsertMenu(8, MF_BYPOSITION|MF_DISABLED, 0, ""); + } + + long index = m_pVstPlugin->GetCurrentProgram(); + char name[256+6]; + memset(name, ' ', 6); + itoa(index, name, 10); + size_t i = 4; + if(index < 1000) i = 3; + if(index < 100) i = 2; + if(index < 10) i = 1; + name[i] = ':'; name[i+1] = ' '; + + m_pVstPlugin->GetProgramNameIndexed(index, -1, name+i+2); + + m_pMenu->ModifyMenu(8, MF_BYPOSITION, 0, name); + DrawMenuBar(); +} + + void CAbstractVstEditor::OnSetPreset(UINT nID) +//--------------------------------------------- { int nIndex=nID-ID_PRESET_SET; if (nIndex>=0) { m_pVstPlugin->SetCurrentProgram(nIndex); + UpdatePresetField(); + //SetupMenu(); } } @@ -254,8 +291,8 @@ switch(wParam) { - case kcVSTGUIPrevPreset: OnSetPreset(-1+ID_PRESET_SET+m_pVstPlugin->GetCurrentProgram()); return wParam; - case kcVSTGUINextPreset: OnSetPreset( 1+ID_PRESET_SET+m_pVstPlugin->GetCurrentProgram()); return wParam; + case kcVSTGUIPrevPreset: OnSetPreviousVSTPreset(); return wParam; + case kcVSTGUINextPreset: OnSetNextVSTPreset(); return wParam; case kcVSTGUIRandParams: OnRandomizePreset() ; return wParam; } if (wParam>=kcVSTGUIStartNotes && wParam<=kcVSTGUIEndNotes) @@ -301,6 +338,8 @@ char s[256]; char sname[256]; + + if (m_pPresetMenu->m_hMenu) // We rebuild menu from scratch { // So remove any exiting menus... if (curProg == m_nCurProg) //.. unless menu exists and is accurate, @@ -603,6 +642,30 @@ m_nInstrument = (nID-ID_SELECTINST); } +void CAbstractVstEditor::OnSetPreviousVSTPreset() +//-------------------------------------------- +{ + OnSetPreset(-1+ID_PRESET_SET+m_pVstPlugin->GetCurrentProgram()); +} + +void CAbstractVstEditor::OnSetNextVSTPreset() +//---------------------------------------- +{ + OnSetPreset(1+ID_PRESET_SET+m_pVstPlugin->GetCurrentProgram()); +} + +void CAbstractVstEditor::OnVSTPresetBackwardJump() +//------------------------------------------------ +{ + 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)); +} + void CAbstractVstEditor::PrepareToLearnMacro(UINT nID) { m_nLearnMacro = (nID-ID_LEARN_MACRO_FROM_PLUGGUI); Modified: trunk/OpenMPT/mptrack/AbstractVstEditor.h =================================================================== --- trunk/OpenMPT/mptrack/AbstractVstEditor.h 2007-07-11 20:36:02 UTC (rev 191) +++ trunk/OpenMPT/mptrack/AbstractVstEditor.h 2007-11-17 17:59:58 UTC (rev 192) @@ -20,6 +20,8 @@ void SetLearnMacro(int inMacro); int GetLearnMacro(); + void UpdatePresetField(); + afx_msg void OnLoadPreset(); afx_msg void OnSavePreset(); afx_msg void OnRandomizePreset(); @@ -29,6 +31,10 @@ afx_msg void OnBypassPlug(); afx_msg void OnRecordAutomation(); afx_msg void OnPassKeypressesToPlug(); + afx_msg void OnSetPreviousVSTPreset(); + afx_msg void OnSetNextVSTPreset(); + afx_msg void OnVSTPresetBackwardJump(); + afx_msg void OnVSTPresetForwardJump(); afx_msg LRESULT OnCustomKeyMsg(WPARAM, LPARAM); //rewbs.customKeys //Overridden methods: Modified: trunk/OpenMPT/mptrack/AutoSaver.cpp =================================================================== --- trunk/OpenMPT/mptrack/AutoSaver.cpp 2007-07-11 20:36:02 UTC (rev 191) +++ trunk/OpenMPT/mptrack/AutoSaver.cpp 2007-11-17 17:59:58 UTC (rev 192) @@ -185,7 +185,7 @@ if (pModDoc->m_bHasValidPath) { // Check that the file has a user-chosen path name = pModDoc->GetPathName(); } else { // if it doesnt, put it in executable dir - name = CMainFrame::m_csExecutablePath + "\\" + pModDoc->GetTitle(); + name = CMainFrame::m_csExecutableDirectoryPath + pModDoc->GetTitle(); } } else { @@ -263,7 +263,7 @@ CString fullPath = pModDoc->GetPathName(); path = fullPath.Left(fullPath.GetLength()-pModDoc->GetTitle().GetLength()); //remove file name if necessary } else { - path = CMainFrame::m_csExecutablePath + "\\"; + path = CMainFrame::m_csExecutableDirectoryPath; } } else { path = m_csPath; Modified: trunk/OpenMPT/mptrack/ChannelManagerDlg.cpp =================================================================== --- trunk/OpenMPT/mptrack/ChannelManagerDlg.cpp 2007-07-11 20:36:02 UTC (rev 191) +++ trunk/OpenMPT/mptrack/ChannelManagerDlg.cpp 2007-11-17 17:59:58 UTC (rev 192) @@ -171,7 +171,8 @@ if(!m_pSndFile || !pModDoc) return; - // Stop player + + // Stop player (is this necessary?) CModDoc *pActiveMod = NULL; HWND followSong = pMainFrm->GetFollowSong(pModDoc); if(pMainFrm->IsPlaying()){ @@ -181,9 +182,7 @@ EnterCriticalSection(&applying); - MODCOMMAND *p = NULL,*newp = NULL; - MODCHANNELSETTINGS settings[MAX_BASECHANNELS]; - UINT i,j,k,nChannels,newpat[MAX_BASECHANNELS],newMemory[4][MAX_BASECHANNELS]; + UINT i,nChannels,newpat[MAX_BASECHANNELS],newMemory[4][MAX_BASECHANNELS]; // Count new number of channels , copy pattern pointers & manager internal store memory nChannels = 0; @@ -514,7 +513,7 @@ InvalidateRect(NULL,FALSE); } -void CChannelManagerDlg::OnTabSelchange(NMHDR* header, LRESULT* pResult) +void CChannelManagerDlg::OnTabSelchange(NMHDR* /*header*/, LRESULT* /*pResult*/) { if(!show) return; @@ -557,7 +556,7 @@ InvalidateRect(NULL, FALSE); } -void DrawChannelButton(HDC hdc, LPRECT lpRect, LPCSTR lpszText, BOOL bActivate, BOOL bEnable, DWORD dwFlags, HBRUSH markBrush) +void DrawChannelButton(HDC hdc, LPRECT lpRect, LPCSTR lpszText, BOOL bActivate, BOOL bEnable, DWORD dwFlags, HBRUSH /*markBrush*/) { RECT rect; rect = (*lpRect); @@ -609,27 +608,27 @@ CRect wnd,btn; GetWindowRect(&wnd); - if(button = GetDlgItem(IDC_BUTTON1)){ + if((button = GetDlgItem(IDC_BUTTON1)) != 0){ button->GetWindowRect(&btn); button->SetWindowPos(NULL,btn.left-wnd.left-3,wnd.Height()-btn.Height()*2-6,0,0,SWP_NOSIZE | SWP_NOZORDER); } - if(button = GetDlgItem(IDC_BUTTON2)){ + if((button = GetDlgItem(IDC_BUTTON2)) != 0){ button->GetWindowRect(&btn); button->SetWindowPos(NULL,btn.left-wnd.left-3,wnd.Height()-btn.Height()*2-6,0,0,SWP_NOSIZE | SWP_NOZORDER); } - if(button = GetDlgItem(IDC_BUTTON3)){ + if((button = GetDlgItem(IDC_BUTTON3)) != 0){ button->GetWindowRect(&btn); button->SetWindowPos(NULL,btn.left-wnd.left-3,wnd.Height()-btn.Height()*2-6,0,0,SWP_NOSIZE | SWP_NOZORDER); } - if(button = GetDlgItem(IDC_BUTTON4)){ + if((button = GetDlgItem(IDC_BUTTON4)) != 0){ button->GetWindowRect(&btn); button->SetWindowPos(NULL,btn.left-wnd.left-3,wnd.Height()-btn.Height()*2-6,0,0,SWP_NOSIZE | SWP_NOZORDER); } - if(button = GetDlgItem(IDC_BUTTON5)){ + if((button = GetDlgItem(IDC_BUTTON5)) != 0){ button->GetWindowRect(&btn); button->SetWindowPos(NULL,btn.left-wnd.left-3,wnd.Height()-btn.Height()*2-6,0,0,SWP_NOSIZE | SWP_NOZORDER); } - if(button = GetDlgItem(IDC_BUTTON6)){ + if((button = GetDlgItem(IDC_BUTTON6)) != 0){ button->GetWindowRect(&btn); button->SetWindowPos(NULL,btn.left-wnd.left-3,wnd.Height()-btn.Height()*2-6,0,0,SWP_NOSIZE | SWP_NOZORDER); } @@ -856,9 +855,9 @@ CSoundFile * m_pSndFile = pModDoc ? pModDoc->GetSoundFile() : NULL; if(pModDoc && m_pSndFile){ - UINT nChannels = m_pSndFile->m_nChannels; + //UINT nChannels = m_pSndFile->m_nChannels; UINT nColns = CM_NB_COLS; - UINT nLines = nChannels / nColns + (nChannels % nColns ? 1 : 0); + //UINT nLines = nChannels / nColns + (nChannels % nColns ? 1 : 0); int x = point.x - client.left; int y = point.y - client.top; @@ -905,7 +904,7 @@ if(order) nChannelsOld = 0; } -LRESULT CChannelManagerDlg::OnMouseLeave(WPARAM wparam, LPARAM lparam) +LRESULT CChannelManagerDlg::OnMouseLeave(WPARAM /*wparam*/, LPARAM /*lparam*/) { if(!m_hWnd || show == FALSE) return 0; @@ -917,7 +916,7 @@ return 0; } -LRESULT CChannelManagerDlg::OnMouseHover(WPARAM wparam, LPARAM lparam) +LRESULT CChannelManagerDlg::OnMouseHover(WPARAM /*wparam*/, LPARAM /*lparam*/) { if(!m_hWnd || show == FALSE) return 0; @@ -954,7 +953,7 @@ LeaveCriticalSection(&applying); } -void CChannelManagerDlg::OnLButtonUp(UINT nFlags,CPoint point) +void CChannelManagerDlg::OnLButtonUp(UINT /*nFlags*/,CPoint point) { if(!m_hWnd || show == FALSE) return; @@ -1034,7 +1033,7 @@ LeaveCriticalSection(&applying); } -void CChannelManagerDlg::OnRButtonUp(UINT nFlags,CPoint point) +void CChannelManagerDlg::OnRButtonUp(UINT /*nFlags*/,CPoint /*point*/) { if(!m_hWnd || show == FALSE) return; @@ -1186,7 +1185,7 @@ return CModControlDlg::OnMouseWheel(nFlags, zDelta, pt); } -BOOL CCtrlPatterns::OnToolTip(UINT id, NMHDR *pNMHDR, LRESULT *pResult) +BOOL CCtrlPatterns::OnToolTip(UINT /*id*/, NMHDR *pNMHDR, LRESULT* /*pResult*/) //--------------------------------------------------------------------- { TOOLTIPTEXT *pTTT = (TOOLTIPTEXT *)pNMHDR; Modified: trunk/OpenMPT/mptrack/CommandSet.cpp =================================================================== --- trunk/OpenMPT/mptrack/CommandSet.cpp 2007-07-11 20:36:02 UTC (rev 191) +++ trunk/OpenMPT/mptrack/CommandSet.cpp 2007-11-17 17:59:58 UTC (rev 192) @@ -5,6 +5,8 @@ #include <stdio.h> #include <stdlib.h> +bool CCommandSet::s_bShowErrorOnUnknownKeybinding = true; + CCommandSet::CCommandSet(void) { // Which keybinding rules to enforce? @@ -23,7 +25,6 @@ enforceRule[krPropagateSampleManipulation] = true; // enforceRule[krCheckContextHierarchy] = true; - commands.SetSize(kcNumCommands); SetupCommands(); SetupContextHierarchy(); @@ -3120,11 +3121,11 @@ CString err; if (errorCount<10) { err.Format("Line %d in key binding file %s was not understood.", l, fileName); - ::MessageBox(NULL, err, "", MB_ICONEXCLAMATION|MB_OK); + if(s_bShowErrorOnUnknownKeybinding) ::MessageBox(NULL, err, "", MB_ICONEXCLAMATION|MB_OK); Log(err); } else if (errorCount==10) { err.Format("Too many errors detected, not reporting any more."); - ::MessageBox(NULL, err, "", MB_ICONEXCLAMATION|MB_OK); + if(s_bShowErrorOnUnknownKeybinding) ::MessageBox(NULL, err, "", MB_ICONEXCLAMATION|MB_OK); Log(err); } } Modified: trunk/OpenMPT/mptrack/CommandSet.h =================================================================== --- trunk/OpenMPT/mptrack/CommandSet.h 2007-07-11 20:36:02 UTC (rev 191) +++ trunk/OpenMPT/mptrack/CommandSet.h 2007-11-17 17:59:58 UTC (rev 192) @@ -1053,8 +1053,10 @@ //CArray<CArray<bool,bool>, CArray<bool,bool> > m_isParentContext; bool m_isParentContext[kCtxMaxInputContexts][kCtxMaxInputContexts]; bool enforceRule[kNumRules]; + +public: + static bool s_bShowErrorOnUnknownKeybinding; -public: CCommandSet(void); ~CCommandSet(void); Modified: trunk/OpenMPT/mptrack/Ctrl_ins.cpp =================================================================== --- trunk/OpenMPT/mptrack/Ctrl_ins.cpp 2007-07-11 20:36:02 UTC (rev 191) +++ trunk/OpenMPT/mptrack/Ctrl_ins.cpp 2007-11-17 17:59:58 UTC (rev 192) @@ -2435,18 +2435,18 @@ sel -= 1; CTuningCollection* tc = 0; - if(sel < CSoundFile::s_TuningsSharedStandard.GetNumTunings()) - tc = &CSoundFile::s_TuningsSharedStandard; + if(sel < CSoundFile::GetStandardTunings().GetNumTunings()) + tc = &CSoundFile::GetStandardTunings(); else { - sel -= CSoundFile::s_TuningsSharedStandard.GetNumTunings(); - if(sel < CSoundFile::s_TuningsSharedLocal.GetNumTunings()) - tc = &CSoundFile::s_TuningsSharedLocal; + sel -= CSoundFile::GetStandardTunings().GetNumTunings(); + if(sel < CSoundFile::GetLocalTunings().GetNumTunings()) + tc = &CSoundFile::GetLocalTunings(); else { - sel -= CSoundFile::s_TuningsSharedLocal.GetNumTunings(); - if(sel < m_pSndFile->m_TuningsTuneSpecific.GetNumTunings()) - tc = &m_pSndFile->m_TuningsTuneSpecific; + sel -= CSoundFile::GetLocalTunings().GetNumTunings(); + if(sel < m_pSndFile->GetTuneSpecificTunings().GetNumTunings()) + tc = &m_pSndFile->GetTuneSpecificTunings(); } } @@ -2463,17 +2463,17 @@ //Case: Chosen tuning editor to be displayed. //Creating vector for the CTuningDialog. vector<CTuningCollection*> v; - v.push_back(&m_pSndFile->s_TuningsSharedStandard); - v.push_back(&m_pSndFile->s_TuningsSharedLocal); - v.push_back(&m_pSndFile->m_TuningsTuneSpecific); + v.push_back(&m_pSndFile->GetStandardTunings()); + v.push_back(&m_pSndFile->GetLocalTunings()); + v.push_back(&m_pSndFile->GetTuneSpecificTunings()); CTuningDialog td(this, v, pInstH->pTuning); td.DoModal(); - if(td.GetModifiedStatus(&m_pSndFile->s_TuningsSharedLocal)) + if(td.GetModifiedStatus(&m_pSndFile->GetLocalTunings())) { if(MsgBox(IDS_APPLY_TUNING_MODIFICATIONS, this, "", MB_OKCANCEL) == IDOK) m_pSndFile->SaveStaticTunings(); } - if(td.GetModifiedStatus(&m_pSndFile->m_TuningsTuneSpecific)) + if(td.GetModifiedStatus(&m_pSndFile->GetTuneSpecificTunings())) { m_pModDoc->SetModified(); } @@ -2500,29 +2500,29 @@ return; } - for(size_t i = 0; i < CSoundFile::s_TuningsSharedStandard.GetNumTunings(); i++) + for(size_t i = 0; i < CSoundFile::GetStandardTunings().GetNumTunings(); i++) { - if(penv->pTuning == &CSoundFile::s_TuningsSharedStandard.GetTuning(i)) + if(penv->pTuning == &CSoundFile::GetStandardTunings().GetTuning(i)) { m_ComboTuning.SetCurSel(i+1); return; } } - for(size_t i = 0; i < CSoundFile::s_TuningsSharedLocal.GetNumTunings(); i++) + for(size_t i = 0; i < CSoundFile::GetLocalTunings().GetNumTunings(); i++) { - if(penv->pTuning == &CSoundFile::s_TuningsSharedLocal.GetTuning(i)) + if(penv->pTuning == &CSoundFile::GetLocalTunings().GetTuning(i)) { - m_ComboTuning.SetCurSel(i+CSoundFile::s_TuningsSharedStandard.GetNumTunings()+1); + m_ComboTuning.SetCurSel(i+CSoundFile::GetStandardTunings().GetNumTunings()+1); return; } } - for(size_t i = 0; i < m_pSndFile->m_TuningsTuneSpecific.GetNumTunings(); i++) + for(size_t i = 0; i < m_pSndFile->GetTuneSpecificTunings().GetNumTunings(); i++) { - if(penv->pTuning == &m_pSndFile->m_TuningsTuneSpecific.GetTuning(i)) + if(penv->pTuning == &m_pSndFile->GetTuneSpecificTunings().GetTuning(i)) { - m_ComboTuning.SetCurSel(i+CSoundFile::s_TuningsSharedStandard.GetNumTunings() + CSoundFile::s_TuningsSharedLocal.GetNumTunings()+1); + m_ComboTuning.SetCurSel(i+CSoundFile::GetStandardTunings().GetNumTunings() + CSoundFile::GetLocalTunings().GetNumTunings()+1); return; } } @@ -2637,17 +2637,17 @@ m_ComboTuning.DeleteString(0); m_ComboTuning.AddString("OMPT IT behavior"); //<-> Instrument pTuning pointer == NULL - for(size_t i = 0; i<CSoundFile::s_TuningsSharedStandard.GetNumTunings(); i++) + for(size_t i = 0; i<CSoundFile::GetStandardTunings().GetNumTunings(); i++) { - m_ComboTuning.AddString(CSoundFile::s_TuningsSharedStandard.GetTuning(i).GetName().c_str()); + m_ComboTuning.AddString(CSoundFile::GetStandardTunings().GetTuning(i).GetName().c_str()); } - for(size_t i = 0; i<CSoundFile::s_TuningsSharedLocal.GetNumTunings(); i++) + for(size_t i = 0; i<CSoundFile::GetLocalTunings().GetNumTunings(); i++) { - m_ComboTuning.AddString(CSoundFile::s_TuningsSharedLocal.GetTuning(i).GetName().c_str()); + m_ComboTuning.AddString(CSoundFile::GetLocalTunings().GetTuning(i).GetName().c_str()); } - for(size_t i = 0; i<m_pSndFile->m_TuningsTuneSpecific.GetNumTunings(); i++) + for(size_t i = 0; i<m_pSndFile->GetTuneSpecificTunings().GetNumTunings(); i++) { - m_ComboTuning.AddString(m_pSndFile->m_TuningsTuneSpecific.GetTuning(i).GetName().c_str()); + m_ComboTuning.AddString(m_pSndFile->GetTuneSpecificTunings().GetTuning(i).GetName().c_str()); } m_ComboTuning.AddString("Control tunings..."); m_ComboTuning.SetCurSel(0); Modified: trunk/OpenMPT/mptrack/Ctrl_ins.h =================================================================== --- trunk/OpenMPT/mptrack/Ctrl_ins.h 2007-07-11 20:36:02 UTC (rev 191) +++ trunk/OpenMPT/mptrack/Ctrl_ins.h 2007-11-17 17:59:58 UTC (rev 192) @@ -5,7 +5,9 @@ class CNoteMapWnd; class CCtrlInstruments; +using std::pair; + //=============================== class CNoteMapWnd: public CStatic //=============================== Modified: trunk/OpenMPT/mptrack/Draw_pat.cpp =================================================================== --- trunk/OpenMPT/mptrack/Draw_pat.cpp 2007-07-11 20:36:02 UTC (rev 191) +++ trunk/OpenMPT/mptrack/Draw_pat.cpp 2007-11-17 17:59:58 UTC (rev 192) @@ -7,7 +7,7 @@ #include "view_pat.h" #include "EffectVis.h" //rewbs.fxvis #include "ChannelManagerDlg.h" -#include "../soundlib/tuning_template.h" +#include "../soundlib/tuningbase.h" #include <string> using std::string; @@ -322,7 +322,7 @@ { if(pTuning) { - string noteStr = pTuning->GetNoteName(static_cast<CTuning::STEPTYPE>(note-NOTE_MIDDLEC)); + string noteStr = pTuning->GetNoteName(note-NOTE_MIDDLEC); noteStr.resize(3, ' '); DrawLetter(x, y, noteStr[0]); DrawLetter(x + pfnt->nNoteWidth/2, y, noteStr[1]); Modified: trunk/OpenMPT/mptrack/InputHandler.cpp =================================================================== --- trunk/OpenMPT/mptrack/InputHandler.cpp 2007-07-11 20:36:02 UTC (rev 191) +++ trunk/OpenMPT/mptrack/InputHandler.cpp 2007-11-17 17:59:58 UTC (rev 192) @@ -19,6 +19,7 @@ //Init CommandSet and Load defaults activeCommandSet = new CCommandSet(); + CCommandSet::s_bShowErrorOnUnknownKeybinding = (CMainFrame::GetMainFrame()->GetPrivateProfileLong("Misc", "ShowErrorOnUnknownKeybinding", 1, theApp.GetConfigFileName()) != 0); CString workingDir; char wd[255]; Modified: trunk/OpenMPT/mptrack/MainFrm.cpp =================================================================== --- trunk/OpenMPT/mptrack/MainFrm.cpp 2007-07-11 20:36:02 UTC (rev 191) +++ trunk/OpenMPT/mptrack/MainFrm.cpp 2007-11-17 17:59:58 UTC (rev 192) @@ -260,7 +260,7 @@ CAutoSaver *CMainFrame::m_pAutoSaver = NULL; //rewbs.autosave CPerformanceCounter *CMainFrame::m_pPerfCounter = NULL; -CString CMainFrame::m_csExecutablePath = ""; +CString CMainFrame::m_csExecutableDirectoryPath = ""; static UINT indicators[] = { @@ -278,16 +278,17 @@ CMainFrame::CMainFrame() //---------------------- { - char wd[255]; - _getdcwd(_getdrive(), wd, 255); - m_csExecutablePath = wd; //Assume working dir is executable path at this stage. + { + char path[_MAX_PATH]; + char exedrive[_MAX_DRIVE]; + char exedir[_MAX_DIR]; + GetModuleFileName(NULL, path, MAX_PATH); + _splitpath(path, exedrive, exedir, NULL, NULL); + memset(path, 0, sizeof(path)); + _makepath(path, exedrive, exedir, NULL, NULL); + m_csExecutableDirectoryPath = path; //path should end with \ + } - //Relabs.note: m_csExecutablePath doesn't give right path - //at least for debug builds. - #ifdef DEBUG - m_csExecutablePath += "\\bin"; - #endif - m_bModTreeHasFocus = false; //rewbs.customKeys m_pNoteMapHasFocus = NULL; //rewbs.customKeys m_bOptionsLocked = false; //rewbs.customKeys @@ -614,7 +615,6 @@ title += CString(" ") + GetFullVersionString(); SetTitle(title); OnUpdateFrameTitle(false); - // Load Chords theApp.LoadChords(Chords); @@ -664,6 +664,7 @@ delete m_pPerfCounter; CChannelManagerDlg::DestroySharedInstance(); + CSoundFile::DeleteStaticdata(); } int CMainFrame::OnCreate(LPCREATESTRUCT lpCreateStruct) @@ -1903,7 +1904,7 @@ if (m_pSndFile) { //m_pSndFile->LoopPattern(-1); - //Relabs.note: Commented above line - why loop should be disabled when pausing? + //Commented above line - why loop should be disabled when pausing? m_pSndFile->m_dwSongFlags &= ~SONG_PAUSED; if (m_pSndFile == &m_WaveFile) { @@ -2939,3 +2940,4 @@ } } } + Modified: trunk/OpenMPT/mptrack/Mainfrm.h =================================================================== --- trunk/OpenMPT/mptrack/Mainfrm.h 2007-07-11 20:36:02 UTC (rev 191) +++ trunk/OpenMPT/mptrack/Mainfrm.h 2007-11-17 17:59:58 UTC (rev 192) @@ -168,7 +168,7 @@ #define NUM_VUMETER_PENS 32 -// Pattern Setup +// Pattern Setup (contains also non-pattern related settings) #define PATTERN_PLAYNEWNOTE 0x01 #define PATTERN_LARGECOMMENTS 0x02 #define PATTERN_STDHIGHLIGHT 0x04 @@ -207,6 +207,7 @@ #define PATTERN_SYNCMUTE 0x1000000 #define PATTERN_AUTODELAY 0x2000000 + // Keyboard Setup enum { KEYBOARD_CUSTOM=0, @@ -356,7 +357,7 @@ CString m_csRegExt; CString m_csRegSettings; CString m_csRegWindow; - static CString m_csExecutablePath; + static CString m_csExecutableDirectoryPath; //To contain path of executable directory // Globals static UINT m_nLastOptionsPage, m_nFilterIndex; static BOOL gbMdiMaximize; Modified: trunk/OpenMPT/mptrack/Moddoc.cpp =================================================================== --- trunk/OpenMPT/mptrack/Moddoc.cpp 2007-07-11 20:36:02 UTC (rev 191) +++ trunk/OpenMPT/mptrack/Moddoc.cpp 2007-11-17 17:59:58 UTC (rev 192) @@ -107,6 +107,7 @@ // -> DESC="channels management dlg" ReinitRecordState(); // -! NEW_FEATURE#0015 + m_ShowSavedialog = false; } @@ -342,10 +343,10 @@ case MOD_TYPE_DSM: case MOD_TYPE_AMF: case MOD_TYPE_PSM: - m_SndFile.m_nType = MOD_TYPE_S3M; + m_SndFile.ChangeModTypeTo(MOD_TYPE_S3M); break; default: - m_SndFile.m_nType = MOD_TYPE_IT; + m_SndFile.ChangeModTypeTo(MOD_TYPE_IT); } // -> CODE#0015 @@ -523,8 +524,9 @@ ErrorBox(IDS_ERR_SAVESONG, CMainFrame::GetMainFrame()); return FALSE; } - if ((!lpszPathName) || (!lpszPathName[0])) + if ((!lpszPathName) || (!lpszPathName[0]) || m_ShowSavedialog) { + m_ShowSavedialog = false; _splitpath(m_strPathName, drive, path, fname, NULL); if (!fname[0]) strcpy(fname, m_strTitle); strcpy(s, drive); @@ -1351,7 +1353,7 @@ // -> DESC="wav export update" UINT p = 0,n = 1; DWORD flags[MAX_BASECHANNELS]; - CHAR channel[MAX_CHANNELNAME+2]; + CHAR channel[MAX_CHANNELNAME+10]; // Channel mode : save song in multiple wav files (one for each enabled channels) if(wsdlg.m_bChannelMode){ @@ -1423,8 +1425,6 @@ if(!wsdlg.m_bChannelMode || !(flags[i] & CHN_MUTE)){ // rewbs.fix3239 m_SndFile.SetCurrentPos(0); - //Relabs.note: Since I removed pattern loop disabling from certain - //methods, making sure that pattern loop is off. m_SndFile.m_dwSongFlags &= ~SONG_PATTERNLOOP; if (wsdlg.m_bSelectPlay) { m_SndFile.SetCurrentOrder(wsdlg.m_nMinOrder); @@ -1628,7 +1628,6 @@ } END_CRITICAL(); //m_SndFile.m_dwSongFlags &= ~(SONG_STEP|SONG_PAUSED); - //Relabs.note: Added SONG_PATTERNLOOP. m_SndFile.m_dwSongFlags &= ~(SONG_STEP|SONG_PAUSED|SONG_PATTERNLOOP); pMainFrm->PlayMod(this, m_hWndFollow, m_dwNotifyType); } @@ -1705,7 +1704,6 @@ pMainFrm->PauseMod(); //m_SndFile.m_dwSongFlags &= ~SONG_STEP; - //Relabs.hack: Added SONG_PATTERNLOOP m_SndFile.m_dwSongFlags &= ~(SONG_STEP|SONG_PATTERNLOOP); m_SndFile.SetCurrentPos(0); pMainFrm->ResetElapsedTime(); @@ -3013,29 +3011,37 @@ void CModDoc::ChangeFileExtension(UINT nNewType) //---------------------------------------------- { - CHAR path[_MAX_PATH], drive[_MAX_PATH], fname[_MAX_FNAME]; - _splitpath(GetPathName(), drive, path, fname, NULL); + //Not making path if path is empty(case only(?) for new file) + if(GetPathName().GetLength() > 0) + { + CHAR path[_MAX_PATH], drive[_MAX_PATH], fname[_MAX_FNAME]; + _splitpath(GetPathName(), drive, path, fname, NULL); - CString newPath = drive; - newPath += path; + CString newPath = drive; + newPath += path; - //Catch case where we don't have a filename yet. - if (fname[0] == 0) { - newPath += GetTitle(); - } else { - newPath += fname; + //Catch case where we don't have a filename yet. + if (fname[0] == 0) { + newPath += GetTitle(); + } else { + newPath += fname; + } + + switch(nNewType) + { + case MOD_TYPE_XM: newPath += ".xm"; break; + case MOD_TYPE_IT: m_SndFile.m_dwSongFlags & SONG_ITPROJECT ? newPath+=".itp" : newPath+=".it"; break; + case MOD_TYPE_MPT: newPath += ".mptm"; break; + case MOD_TYPE_S3M: newPath += ".s3m"; break; + case MOD_TYPE_MOD: newPath += ".mod"; break; + default: ASSERT(false); + } + SetPathName(newPath, FALSE); + if(GetSoundFile() && GetSoundFile()->GetType() != nNewType) m_ShowSavedialog = true; + //Forcing savedialog to appear after extension change - otherwise + //unnotified file overwriting may occur. } - switch(nNewType) - { - case MOD_TYPE_XM: newPath += ".xm"; break; - case MOD_TYPE_IT: m_SndFile.m_dwSongFlags & SONG_ITPROJECT ? newPath+=".itp" : newPath+=".it"; break; - case MOD_TYPE_MPT: newPath += ".mptm"; break; - case MOD_TYPE_S3M: newPath += ".s3m"; break; - case MOD_TYPE_MOD: newPath += ".mod"; break; - default: ASSERT(false); - } - SetPathName(newPath, FALSE); UpdateAllViews(NULL, HINT_MODTYPE); } @@ -3090,7 +3096,6 @@ CString message; message.Format("Param %d can already be controlled with macro %X", paramToUse, checkMacro); CMainFrame::GetMainFrame()->MessageBox(message, "Macro exists for this param",MB_ICONINFORMATION | MB_OK); - //Relabs.expl: Modified to prevent notification box go 'under' ompt to block key messages. return; } } Modified: trunk/OpenMPT/mptrack/Moddoc.h =================================================================== --- trunk/OpenMPT/mptrack/Moddoc.h 2007-07-11 20:36:02 UTC (rev 191) +++ trunk/OpenMPT/mptrack/Moddoc.h 2007-11-17 17:59:58 UTC (rev 192) @@ -89,6 +89,8 @@ DWORD m_dwNotifyType; PATTERNUNDOBUFFER PatternUndo[MAX_UNDO_LEVEL]; + bool m_ShowSavedialog; + // -> CODE#0015 // -> DESC="channels management dlg" BYTE MultiRecordMask[(MAX_CHANNELS+7)/8]; Modified: trunk/OpenMPT/mptrack/Modedit.cpp =================================================================== --- trunk/OpenMPT/mptrack/Modedit.cpp 2007-07-11 20:36:02 UTC (rev 191) +++ trunk/OpenMPT/mptrack/Modedit.cpp 2007-11-17 17:59:58 UTC (rev 192) @@ -1389,10 +1389,6 @@ BOOL CModDoc::ExpandPattern(UINT nPattern) //---------------------------------------- { - - MODCOMMAND *newPattern, *oldPattern; - UINT nRows, nChns; - // -> CODE#0008 // -> DESC="#define to set pattern size" Modified: trunk/OpenMPT/mptrack/Mptrack.cpp =================================================================== --- trunk/OpenMPT/mptrack/Mptrack.cpp 2007-07-11 20:36:02 UTC (rev 191) +++ trunk/OpenMPT/mptrack/Mptrack.cpp 2007-11-17 17:59:58 UTC (rev 192) @@ -189,7 +189,28 @@ //0,/*rewbs.smoothVST*/ ,0/*rewbs.velocity*/, }; +static void ShowChangesDialog() +//----------------------------- +{ + CString firstOpenMessage = "OpenMPT version " + CMainFrame::GetFullVersionString(); + firstOpenMessage += ". This is a development build primarily aimed for testing.\n\nChanges:\n\n" + "[New] Windows keys can be used as modifiers in the keyboard configuration(disables Windows start menu pop-up if used in the active keyboard configuration).\n" + "[New] Name filter in plugin selection dialog.\n" + "[Imp] Improved preset navigation in VST window.\n" + "[Imp] Improvements in IT compatible play.\n" + "[Imp] Improvements in user defined tuning modes.\n" + "[Fix] Fixed possible unnotified file overwriting when saving unsaved file.\n" + "[Fix] Fixed wrong version number in IT files saved with compatibility save.\n" + "[Fix] Fixed broken note preview for certain type of instruments in instrument tab.\n" + "[Fix] Fixed possible crash when exporting wav in channel mode with long channel name.\n" + "[Fix] Fixed channel position jump when clicking VST box in channel header.\n" + "[Fix] Fixed possible searching of wrong parameter in pattern search.\n" + "[Misc] Update check disabled and miscellaneous other changes."; + CMainFrame::GetMainFrame()->MessageBox(firstOpenMessage, "OpenMPT v." + CMainFrame::GetFullVersionString(), MB_ICONINFORMATION); +} + + ///////////////////////////////////////////////////////////////////////////// // MPTRACK Command Line options @@ -424,6 +445,7 @@ } void CTrackApp::LoadRegistryDLS() +//------------------------------- { CHAR szFileNameX[_MAX_PATH]; HKEY keyX; @@ -649,6 +671,7 @@ m_szConfigFileName[0] = 0; m_szStringsFileName[0] = 0; + if (GetModuleFileName(NULL, m_szConfigFileName, sizeof(m_szConfigFileName))) { CHAR szDrive[_MAX_DRIVE]="", szDir[_MAX_PATH]=""; @@ -786,6 +809,7 @@ m_dwTimeStarted = timeGetTime(); m_bInitialized = TRUE; + /* if (CMainFrame::gnCheckForUpdates) { try { UpdateCheck(); @@ -795,10 +819,12 @@ // we will end up here if the dll cannot be foung (e.g. on win98). } } + */ - // Open settings if this is the previous execution was with an earlier version. + // Open settings if the previous execution was with an earlier version. if (!cmdInfo.m_bNoSettingsOnNewVersion && CMainFrame::gcsPreviousVersion < CMainFrame::GetFullVersionString()) { StopSplashScreen(); + ShowChangesDialog(); m_pMainWnd->PostMessage(WM_COMMAND, ID_VIEW_OPTIONS); } @@ -1576,12 +1602,12 @@ m_bmp.LoadBitmap(MAKEINTRESOURCE(IDB_MPTRACK)); wsprintf(s, "Build Date: %s", gszBuildDate); SetDlgItemText(IDC_EDIT2, s); - SetDlgItemText(IDC_EDIT3, CString("Open Modplug Tracker, version ") + CMainFrame::GetFullVersionString()); + SetDlgItemText(IDC_EDIT3, CString("Open Modplug Tracker, version ") + CMainFrame::GetFullVersionString() + " (development build)"); m_heContact.SetWindowText( "Contact / Discussion:\r\n\ http://modplug.sourceforge.net/forum\r\n\ -\r\n\Updates:\r\n\ +\r\nUpdates:\r\n\ http://modplug.sourceforge.net/builds/#dev"); char *pArrCredit = { @@ -1591,7 +1617,7 @@ "|" "Contributors:|" "Robin Fernandes: ro...@so... (2004-2007)|" - "Ahti Leppan: rel...@us... (2005-2007)|" + "Ahti Lepp\xE4nen: aa...@dn... (2005-2007)|" "Sergiy Pylypenko: x.p...@gm... (2007)|" "Eric Chavanon: co...@er... (2004-2005)|" "Trevor Nunes: mo...@pl... (2004)|" @@ -1635,6 +1661,7 @@ //-------------------------- { if (gpAboutDlg) return; + ShowChangesDialog(); gpAboutDlg = new CAboutDlg(); gpAboutDlg->Create(IDD_ABOUTBOX, m_pMainWnd); } @@ -2960,6 +2987,7 @@ //rewbs.crashHandler LRESULT CTrackApp::ProcessWndProcException(CException* e, const MSG* pMsg) +//----------------------------------------------------------------------- { // TODO: Add your specialized code here and/or call the base class Log("Unhandled Exception\n"); Modified: trunk/OpenMPT/mptrack/Mptrack.h =================================================================== --- trunk/OpenMPT/mptrack/Mptrack.h 2007-07-11 20:36:02 UTC (rev 191) +++ trunk/OpenMPT/mptrack/Mptrack.h 2007-11-17 17:59:58 UTC (rev 192) @@ -15,6 +15,7 @@ #include "resource.h" // main symbols #include "sndfile.h" #include <windows.h> +#include <Specstrings.h> // In VC2003, '__in' was undefined in winhttp.h #include <winhttp.h> class CModDoc; Modified: trunk/OpenMPT/mptrack/OrderToPatternTable.cpp =================================================================== --- trunk/OpenMPT/mptrack/OrderToPatternTable.cpp 2007-07-11 20:36:02 UTC (rev 191) +++ trunk/OpenMPT/mptrack/OrderToPatternTable.cpp 2007-11-17 17:59:58 UTC (rev 192) @@ -9,7 +9,7 @@ { if(memLength < sizeof(s_Version) + sizeof(size_t)) return 0; WORD version = 0; - size_t s = 0; + uint32 s = 0; DWORD memPos = 0; memcpy(&version, src, sizeof(version)); memPos += sizeof(version); @@ -55,7 +55,7 @@ //Version fwrite(&s_Version, sizeof(s_Version), 1, f); - const size_t s = size(); + const uint32 s = size(); //Size fwrite(&s, sizeof(s), 1, f); //Values Modified: trunk/OpenMPT/mptrack/ScaleEnvPointsDlg.cpp =================================================================== --- trunk/OpenMPT/mptrack/ScaleEnvPointsDlg.cpp 2007-07-11 20:36:02 UTC (rev 191) +++ trunk/OpenMPT/mptrack/ScaleEnvPointsDlg.cpp 2007-11-17 17:59:58 UTC (rev 192) @@ -42,7 +42,7 @@ { char buffer[10]; GetDlgItemText(IDC_EDIT_FACTOR, buffer, 9); - float factor = static_cast<float>(atof(buffer)); + float factor = ConvertStrTo<float>(buffer); if(factor > 0) { WORD (*array)[MAX_ENVPOINTS] = NULL; @@ -69,7 +69,7 @@ { for(UINT i = 0; i<*arraySize; i++) { - (*array)[i] *= factor; + (*array)[i] = static_cast<WORD>(factor * (*array)[i]); //Checking that the order of points is preserved. if(i > 0 && (*array)[i] <= (*array)[i-1]) Modified: trunk/OpenMPT/mptrack/TuningDialog.cpp =================================================================== --- trunk/OpenMPT/mptrack/TuningDialog.cpp 2007-07-11 20:36:02 UTC (rev 191) +++ trunk/OpenMPT/mptrack/TuningDialog.cpp 2007-11-17 17:59:58 UTC (rev 192) @@ -5,13 +5,23 @@ #include "misc_util.h" #include ".\tuningdialog.h" -const string CTuningDialog::s_stringTypeGEN = "General"; -const string CTuningDialog::s_stringTypeRP = "Ratio periodic"; -const string CTuningDialog::s_stringTypeTET = "TET"; - const CTuningDialog::TUNINGTREEITEM CTuningDialog::s_notFoundItemTuning = TUNINGTREEITEM(); const HTREEITEM CTuningDialog::s_notFoundItemTree = NULL; +using CTuning::UNOTEINDEXTYPE; +using CTuning::RATIOTYPE; +#define TT_GENERAL CTuning::TT_GENERAL +#define TT_GROUPGEOMETRIC CTuning::TT_GROUPGEOMETRIC +#define TT_GEOMETRIC CTuning::TT_GEOMETRIC +#define EM_CONST CTuning::EM_CONST +#define EM_CONST_STRICT CTuning::EM_CONST_STRICT +#define TUNINGTYPE CTuning::TUNINGTYPE +#define NOTEINDEXTYPE CTuning::NOTEINDEXTYPE +#define EM_ALLOWALL CTuning::EM_ALLOWALL + +using namespace std; + + /* TODOS: -Clear tuning @@ -144,9 +154,11 @@ //-------------------------------- { CDialog::OnInitDialog(); - + m_RatioMapWnd.Init(this, 0); + SetDlgItemText(IDC_TUNINGTYPE_DESC, ""); + //-->Creating treeview m_TreeItemTuningItemMap.ClearMapping(); for(size_t i = 0; i<m_TuningCollections.size(); i++) @@ -158,9 +170,9 @@ m_pActiveTuningCollection = GetpTuningCollection(m_pActiveTuning); //Adding tuning type names to corresponding combobox. - m_CombobTuningType.AddString(s_stringTypeGEN.c_str()); - m_CombobTuningType.AddString(s_stringTypeRP.c_str()); - m_CombobTuningType.AddString(s_stringTypeTET.c_str()); + m_CombobTuningType.AddString(CTuning::s_TuningTypeStrGeneral); + m_CombobTuningType.AddString(CTuning::s_TuningTypeStrGroupGeometric); + m_CombobTuningType.AddString(CTuning::s_TuningTypeStrGeometric); m_ButtonSet.EnableWindow(FALSE); @@ -169,8 +181,11 @@ m_EditTuningCollectionEditMask.ShowWindow(SW_SHOW); //#endif + m_EditSteps.SetLimitText(2); m_EditFineTuneSteps.SetLimitText(3); + if(m_pActiveTuning) m_RatioMapWnd.m_nNote = m_RatioMapWnd.m_nNoteCentre + m_pActiveTuning->GetValidityRange().first + (m_pActiveTuning->GetValidityRange().second - m_pActiveTuning->GetValidityRange().first)/2 + 1; + UpdateView(); return TRUE; @@ -245,15 +260,16 @@ m_RatioMapWnd.Invalidate(); UpdateRatioMapEdits(m_RatioMapWnd.GetShownCentre()); - const CTuning::STEPTYPE period = m_pActiveTuning->GetPeriod(); - const CTuning::RATIOTYPE periodRatio = m_pActiveTuning->GetPeriodRatio(); + + const UNOTEINDEXTYPE period = m_pActiveTuning->GetGroupSize(); + const RATIOTYPE GroupRatio = m_pActiveTuning->GetGroupRatio(); if(period > 0) { m_EditSteps.EnableWindow(); m_EditSteps.SetWindowText(Stringify(period).c_str()); m_EditRatioPeriod.EnableWindow(); - m_EditRatioPeriod.SetWindowText(Stringify(periodRatio).c_str()); + m_EditRatioPeriod.SetWindowText(Stringify(GroupRatio).c_str()); } else //case: m_pActiveTuning is of type general. { @@ -266,11 +282,11 @@ bool enableControls = true; - if(m_pActiveTuning->GetEditMask() == CTuning::EM_CONST || - m_pActiveTuning->GetEditMask() == CTuning::EM_CONST_STRICT) + if(m_pActiveTuning->GetEditMask() == EM_CONST || + m_pActiveTuning->GetEditMask() == EM_CONST_STRICT) { CheckDlgButton(IDC_CHECK_READONLY, MF_CHECKED); - if(m_pActiveTuning->GetEditMask() == CTuning::EM_CONST_STRICT) + if(m_pActiveTuning->GetEditMask() == EM_CONST_STRICT) m_ButtonReadOnly.EnableWindow(FALSE); else m_ButtonReadOnly.EnableWindow(TRUE); @@ -315,6 +331,8 @@ m_EditFineTuneSteps.SetWindowText(""); m_EditName.SetWindowText(""); + SetDlgItemText(IDC_TUNINGTYPE_DESC, ""); + m_CombobTuningType.SetCurSel(-1); m_ButtonReadOnly.EnableWindow(FALSE); @@ -407,81 +425,78 @@ { if(m_CombobTuningType.GetCount() < 3) m_DoErrorExit = true; - if(m_pActiveTuning->GetTuningType() == CTuning::TT_TET) + if(m_pActiveTuning->GetTuningType() == TT_GEOMETRIC) m_CombobTuningType.SetCurSel(2); else - if(m_pActiveTuning->GetTuningType() == CTuning::TT_RATIOPERIODIC) + if(m_pActiveTuning->GetTuningType() == TT_GROUPGEOMETRIC) m_CombobTuningType.SetCurSel(1); else m_CombobTuningType.SetCurSel(0); } + UpdateTuningDescription(); } -CTuning::CTUNINGTYPE CTuningDialog::GetTuningTypeFromStr(const string& str) const +TUNINGTYPE CTuningDialog::GetTuningTypeFromStr(const string& str) const //-------------------------------------------------------------------------------- { - if(str == s_stringTypeTET) - return CTuning::TT_TET; - if(str == s_stringTypeRP) - return CTuning::TT_RATIOPERIODIC; - return CTuning::TT_GENERAL; + return CTuning::GetTuningType(str.c_str()); } void CTuningDialog::OnCbnSelchangeComboTtype() //-------------------------------------------- { - if(m_pActiveTuning == NULL) - return; - - - const CTuning::CTUNINGTYPE oldType = m_pActiveTuning->GetTuningType(); - const size_t BS = 20; - char buffer[BS]; - m_CombobTuningType.GetWindowText(buffer, BS); - const string strNewType = buffer; - CTuning::CTUNINGTYPE newType = GetTuningTypeFromStr(strNewType); - if(!m_pActiveTuning->DoesTypeInclude(newType)) + if(m_pActiveTuning != NULL) { - if(MessageBox("This will change the ratio values; continue?", 0, MB_YESNO) == IDYES) + const TUNINGTYPE oldType = m_pActiveTuning->GetTuningType(); + const size_t BS = 20; + char buffer[BS]; + m_CombobTuningType.GetWindowText(buffer, BS); + const string strNewType = buffer; + TUNINGTYPE newType = GetTuningTypeFromStr(strNewType); + if(!m_pActiveTuning->IsOfType(newType)) { - m_ModifiedTCs[GetpTuningCollection(m_pActiveTuning)] = true; + if(MessageBox("This action may change the ratio values; continue?", 0, MB_YESNO) == IDYES) + { + m_ModifiedTCs[GetpTuningCollection(m_pActiveTuning)] = true; - const size_t BS = 20; - char buffer[BS]; - m_EditSteps.GetWindowText(buffer, BS); - CTuning::STEPTYPE steps = static_cast<CTuning::STEPTYPE>(atoi(buffer)); + const size_t BS = 20; + char buffer[BS]; + m_EditSteps.GetWindowText(buffer, BS); + NOTEINDEXTYPE steps = ConvertStrTo<NOTEINDEXTYPE>(buffer); - m_EditRatioPeriod.GetWindowText(buffer, BS); - CTuning::RATIOTYPE pr = static_cast<CTuning::RATIOTYPE>(atof(buffer)); + m_EditRatioPeriod.GetWindowText(buffer, BS); + RATIOTYPE pr = ConvertStrTo<RATIOTYPE>(buffer); - if(steps <= 0) - steps = 1; - if(pr <= 0) - pr = 1; + if(steps <= 0) + steps = 1; + if(pr <= 0) + pr = 1; - if(newType == CTuning::TT_RATIOPERIODIC) - m_pActiveTuning->CreateRatioPeriodic(steps, pr); - else - if(newType == CTuning::TT_TET) - m_pActiveTuning->CreateTET(steps, pr); - - UpdateView(UM_TUNINGDATA); - } - else //Not wanting to discard current values. - { - //Restoring tuning type combobox. - if(oldType == CTuning::TT_TET) - m_CombobTuningType.SetCurSel(2); - else + if(newType == TT_GROUPGEOMETRIC) + m_pActiveTuning->CreateGroupGeometric(steps, pr, 0); + else + if(newType == TT_GEOMETRIC) + m_pActiveTuning->CreateGeometric(steps, pr); + + UpdateView(UM_TUNINGDATA); + } + else //Not wanting to discard current values. { - if(oldType == CTuning::TT_RATIOPERIODIC) - m_CombobTuningType.SetCurSel(1); - else - m_CombobTuningType.SetCurSel(0); + //Restoring tuning type combobox. + if(oldType == TT_GEOMETRIC) + m_CombobTuningType.SetCurSel(2); + else + { + if(oldType == TT_GROUPGEOMETRIC) + m_CombobTuningType.SetCurSel(1); + else + m_CombobTuningType.SetCurSel(0); + } } } } + UpdateTuningDescription(); } @@ -509,7 +524,7 @@ if(!m_pActiveTuning) return; - const CTuning::STEPTYPE currentNote = m_RatioMapWnd.GetShownCentre(); + const NOTEINDEXTYPE currentNote = m_RatioMapWnd.GetShownCentre(); const size_t BS = 5; char buffer[BS]; m_EditNotename.GetWindowText(buffer, BS); @@ -541,7 +556,7 @@ if(!m_pActiveTuning) return; - const CTuning::STEPTYPE currentNote = m_RatioMapWnd.GetShownCentre(); + const NOTEINDEXTYPE currentNote = m_RatioMapWnd.GetShownCentre(); const size_t BS = 12; char buffer[BS]; @@ -549,7 +564,7 @@ string str = buffer; if(str.length() > 0) { - m_pActiveTuning->SetRatio(currentNote, static_cast<CTuning::RATIOTYPE>(atof(buffer))); + m_pActiveTuning->SetRatio(currentNote, ConvertStrTo<RATIOTYPE>(buffer)); m_ModifiedTCs[GetpTuningCollection(m_pActiveTuning)] = true; UpdateTuningType(); m_RatioMapWnd.Invalidate(); @@ -568,21 +583,21 @@ const size_t BS = 20; char buffer[BS]; m_EditMiscActions.GetWindowText(buffer, BS); - m_pActiveTuning->Multiply(static_cast<CTuning::RATIOTYPE>(atof(buffer))); + m_pActiveTuning->Multiply(ConvertStrTo<RATIOTYPE>(buffer)); m_ModifiedTCs[GetpTuningCollection(m_pActiveTuning)] = true; m_EditMiscActions.SetWindowText(""); m_RatioMapWnd.Invalidate(); } } -void CTuningDialog::UpdateRatioMapEdits(const CTuning::STEPTYPE& note) +void CTuningDialog::UpdateRatioMapEdits(const NOTEINDEXTYPE& note) //----------------------------------------------------------- { if(m_pActiveTuning == NULL) return; m_RatioEditApply = false; - m_EditRatio.SetWindowText(Stringify(m_pActiveTuning->GetFrequencyRatio(note)).c_str()); + m_EditRatio.SetWindowText(Stringify(m_pActiveTuning->GetRatio(note)).c_str()); m_NoteEditApply = false; m_EditNotename.SetWindowText(m_pActiveTuning->GetNoteName(note).c_str()); @@ -625,12 +640,12 @@ if(ext == CTuning::s_FileExtension) { if(pT != NULL) - failure = pT->SerializeBinary(fout); + failure = pT->Serialize(fout); } else //Case: Saving tuning collection. if(ext == CTuningCollection::s_FileExtension) if(pTC != NULL) - failure = pTC->SerializeBinary(fout); + failure = pTC->Serialize(fout); fout.close(); EndWaitCursor(); @@ -663,13 +678,12 @@ if(ext == CTuning::s_FileExtension) { ifstream fin(dlg.GetPathName(), ios::binary); - CTuning* pT = new CTuningRTI; - failure = pT->UnSerializeBinary(fin); + CTuning* pT = CTuningRTI::UnserializeOLD(fin); + if(pT == 0) {fin.clear(); fin.seekg(0); pT = CTuning::Unserialize(fin);} fin.close(); - if(failure) - delete pT; - else + if(pT) { + failure = false; m_TempTunings.AddTuning(pT); m_pActiveTuning = pT; @@ -686,7 +700,7 @@ //directly replace some collection. CTuningCollection* pNewTCol = new CTuningCollection; pNewTCol->SetSavefilePath(static_cast<LPCTSTR>(dlg.GetPathName())); - failure = pNewTCol->UnSerializeBinary(); + failure = pNewTCol->Unserialize(); if(failure) { delete pNewTCol; pNewTCol = 0; @@ -702,10 +716,8 @@ } } - - if(failure) - ErrorBox(IDS_ERR_FILEOPEN, this); + ErrorBox(IDS_OPERATION_FAIL, this); } void CTuningDialog::OnEnChangeEditFinetunesteps() @@ -722,7 +734,7 @@ const BYTE BS = 5; char buffer[BS]; m_EditFineTuneSteps.GetWindowText(buffer, BS); - m_EditFineTuneSteps.SetWindowText(Stringify(m_pActiveTuning->SetFineStepCount(static_cast<CTuning::FINESTEPTYPE>(atoi(buffer)))).c_str()); + m_EditFineTuneSteps.SetWindowText(Stringify(m_pActiveTuning->SetFineStepCount(ConvertStrTo<CTuning::USTEPINDEXTYPE>(buffer))).c_str()); m_ModifiedTCs[GetpTuningCollection(m_pActiveTuning)] = true; m_EditFineTuneSteps.Invalidate(); } @@ -737,14 +749,14 @@ if(IsDlgButtonChecked(IDC_CHECK_READONLY)) { - if(m_pActiveTuning->SetEditMask(CTuning::EM_CONST)) + if(m_pActiveTuning->SetEditMask(EM_CONST)) CheckDlgButton(IDC_CHECK_READONLY, MF_UNCHECKED); else UpdateView(UM_TUNINGDATA); } else { - if(m_pActiveTuning->SetEditMask(CTuning::EM_ALLOWALL)) + if(m_pActiveTuning->SetEditMask(EM_ALLOWALL)) CheckDlgButton(IDC_CHECK_READONLY, MF_CHECKED); else UpdateView(UM_TUNINGDATA); @@ -777,7 +789,7 @@ const size_t BS = 20; char buffer[BS]; m_EditSteps.GetWindowText(buffer, BS); - m_pActiveTuning->ChangePeriod(static_cast<CTuning::STEPTYPE>(atoi(buffer))); + m_pActiveTuning->ChangeGroupsize(ConvertStrTo<UNOTEINDEXTYPE>(buffer)); m_ModifiedTCs[GetpTuningCollection(m_pActiveTuning)] = true; UpdateView(UM_TUNINGDATA); } @@ -792,7 +804,7 @@ const size_t BS = 20; char buffer[BS]; m_EditRatioPeriod.GetWindowText(buffer, BS); - m_pActiveTuning->ChangePeriodRatio(static_cast<CTuning::RATIOTYPE>(atof(buffer))); + m_pActiveTuning->ChangeGroupRatio(ConvertStrTo<RATIOTYPE>(buffer)); m_ModifiedTCs[GetpTuningCollection(m_pActiveTuning)] = true; UpdateView(UM_TUNINGDATA); } @@ -847,7 +859,7 @@ CTuningCollection& rCurTCol = *m_TuningCollections.at(i); for(size_t j = 0; j<rCurTCol.GetNumTunings(); j++) { - if(pT == &rCurTCol.GetTuning(static_cast<unsigned short>(j))) + if(pT == &rCurTCol.GetTuning(j)) { return &rCurTCol; } @@ -863,7 +875,7 @@ //This methods gets called when selected item in the treeview //changes. - //TODO: This gets called before killfocus messages of edits, this + //TODO: This gets called before killfocus messages of edits, which // can be a problem. LPNMTREEVIEW pNMTreeView = reinterpret_cast<LPNMTREEVIEW>(pNMHDR); @@ -903,7 +915,6 @@ //---------------------------------------------------------------------------- { LPNMTREEVIEW pNMTreeView = reinterpret_cast<LPNMTREEVIEW>(pNMHDR); - // TODO: Add your control notification handler code here *pResult = 0; if(pNMTreeView->itemOld.mask & TVIF_HANDLE && pNMTreeView->itemOld.hItem) { @@ -1243,7 +1254,7 @@ if(!m_pActiveTuningCollection) return; - if(m_pActiveTuningCollection->SerializeBinary()) + if(m_pActiveTuningCollection->Serialize()) { MsgBox(IDS_OPERATION_FAIL, this, NULL, MB_ICONINFORMATION); } @@ -1254,7 +1265,33 @@ } } +void CTuningDialog::UpdateTuningDescription() +//------------------------------------------- +{ + switch(m_CombobTuningType.GetCurSel()) + { + case 0: + SetDlgItemText(IDC_TUNINGTYPE_DESC, CTuning::GetTuningTypeDescription(TT_GENERAL)); + break; + case 1: + SetDlgItemText(IDC_TUNINGTYPE_DESC, CTuning::GetTuningTypeDescription(TT_GROUPGEOMETRIC)); + break; + + case 2: + SetDlgItemText(IDC_TUNINGTYPE_DESC, CTuning::GetTuningTypeDescription(TT_GEOMETRIC)); + break; + + default: + if(m_pActiveTuning) + SetDlgItemText(IDC_TUNINGTYPE_DESC, m_pActiveTuning->GetTuningTypeDescription()); + else + SetDlgItemText(IDC_TUNINGTYPE_DESC, "Unknown type"); + break; + } +} + + //////////////////////////////////////////////////////// //*************** //CTuningTreeCtrl Modified: trunk/OpenMPT/mptrack/TuningDialog.h =================================================================== --- trunk/OpenMPT/mptrack/TuningDialog.h 2007-07-11 20:36:02 UTC (rev 191) +++ trunk/OpenMPT/mptrack/TuningDialog.h 2007-11-17 17:59:58 UTC (rev 192) @@ -42,7 +42,7 @@ void RemoveValue_1(const T1& a) { - vector<T1>::iterator iter = find(m_T1.begin(), m_T1.end(), a); + typename vector<T1>::iterator iter = find(m_T1.begin(), m_T1.end(), a); if(iter != m_T1.end()) { m_T2.erase(m_T2.begin() + (iter-m_T1.begin())); @@ -52,7 +52,7 @@ void RemoveValue_2(const T2& b) { - vector<T2>::iterator iter = find(m_T2.begin(), m_T2.end(), b); + typename vector<T2>::iterator iter = find(m_T2.begin(), m_T2.end(), b); if(iter != m_T2.end()) { m_T1.erase(m_T1.begin() + (iter-m_T2.begin())); @@ -62,7 +62,7 @@ T2 GetMapping_12(const T1& a) const { - vector<T1>::const_iterator iter = find(m_T1.begin(), m_T1.end(), a); + typename vector<T1>::const_iterator iter = find(m_T1.begin(), m_T1.end(), a); if(iter != m_T1.end()) { return m_T2[iter-m_T1.begin()]; @@ -73,7 +73,7 @@ T1 GetMapping_21(const T2& b) const { - vector<T2>::const_iterator iter = find(m_T2.begin(), m_T2.end(), b); + typename vector<T2>::const_iterator iter = find(m_T2.begin(), m_T2.end(), b); if(iter != m_T2.end()) { return m_T1[iter-m_T2.begin()]; @@ -102,8 +102,7 @@ CTuningDialog& m_rParentDialog; public: CTuningTreeCtrl(CTuningDialog* parent) : m_rParentDialog(*parent) {} - //Note: Parent address may be given in initialiser list so - //do not use it. + //Note: Parent address may be given in its initializer list. void SetDragging(bool state = true) {m_Dragging = state;} bool IsDragging() {return m_Dragging;} @@ -198,7 +197,7 @@ BOOL OnInitDialog(); void AddTuningCollection(CTuningCollection* pTC) {if(pTC) m_TuningCollections.push_back(pTC);} - void UpdateRatioMapEdits(const CTuning::STEPTYPE&); + void UpdateRatioMapEdits(const CTuning::NOTEINDEXTYPE&); bool GetModifiedStatus(const CTuningCollection* const pTc) const; @@ -209,8 +208,10 @@ virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support private: - CTuning::CTUNINGTYPE GetTuningTypeFromStr(const string& str) const; + CTuning::TUNINGTYPE GetTuningTypeFromStr(const string& str) const; + void UpdateTuningDescription(); + void UpdateView(const int UpdateMask = 0); void UpdateTuningType(); @@ -222,16 +223,17 @@ void OnEndDrag(HTREEITEM dragDestItem); - CTuningCollection* GetpTuningCollection(const CTuning* const) const; //Returns pointer to the tuning collection where tuning given as argument //belongs to. - - CTuningCollection* GetpTuningCollection(HTREEITEM ti) const; + CTuningCollection* GetpTuningCollection(const CTuning* const) const; + //Returns the address of corresponding tuningcollection; if it points //to tuning-entry, returning the owning tuningcollection - - bool IsDeletable(const CTuningCollection* const pTC) const; + CTuningCollection* GetpTuningCollection(HTREEITEM ti) const; + //Checks whether tuning collection can be deleted. + bool IsDeletable(const CTuningCollection* const pTC) const; + private: CTuningRatioMapWnd m_RatioMapWnd; @@ -273,10 +275,6 @@ CTuningTreeCtrl m_TreeCtrlTuning; private: - static const string s_stringTypeGEN; - static const string s_stringTypeRP; - static const string s_stringTypeTET; - typedef CTuningTreeItem TUNINGTREEITEM; typedef CBijectiveMap<HTREEITEM, TUNINGTREEITEM> TREETUNING_MAP; TREETUNING_MAP m_TreeItemTuningItemMap; @@ -299,13 +297,14 @@ TT_TUNING }; + + //To indicate whether to apply changes made to + //those edit boxes(they are modified by certain activities + //in case which the modifications should not be applied to + //tuning data. bool m_NoteEditApply; bool m_RatioEditApply; - //To indicate whether to apply changes made to - //to those edit boxes(they are modified by non-user - //activies and in these cases the value should be applied - //to the tuning data. - + enum { UM_TUNINGDATA = 1, //UM <-> Update Mask @@ -317,9 +316,9 @@ bool AddTuning(CTuningCollection*, CTuning* pT = NULL); - bool m_DoErrorExit; //Flag to prevent multiple exit error-messages. - + bool m_DoErrorExit; + void DoErrorExit(); Modified: trunk/OpenMPT/mptrack/View_gen.cpp =================================================================== --- trunk/OpenMPT/mptrack/View_gen.cpp 2007-07-11 20:36:02 UTC (rev 191) +++ trunk/OpenMPT/mptrack/View_gen.cpp 2007-11-17 17:59:58 UTC (rev 192) @@ -965,6 +965,7 @@ if ((pSndFile->m_nType & (MOD_TYPE_XM|MOD_TYPE_IT|MOD_TYPE_MPT)) && (nChn < pSndFile->m_nChannels) && (strncmp(s, pSndFile->ChnSettings[nChn].szName, MAX_CHANNELNAME))) { memcpy(pSndFile->ChnSettings[nChn].szName, s, MAX_CHANNELNAME); + pSndFile->ChnSettings[nChn].szName[ARRAYELEMCOUNT(pSndFile->ChnSettings[nChn].szName)-1] = 0; pModDoc->SetModified(); pModDoc->UpdateAllViews(this, HINT_MODCHANNELS | (m_nActiveTab << 24)); } @@ -989,6 +990,7 @@ if ((pSndFile->m_nType & (MOD_TYPE_XM|MOD_TYPE_IT|MOD_TYPE_MPT)) && (nChn < pSndFile->m_nChannels) && (strncmp(s, pSndFile->ChnSettings[nChn].szName, MAX_CHANNELNAME))) { memcpy(pSndFile->ChnSettings[nChn].szName, s, MAX_CHANNELNAME); + pSndFile->ChnSettings[nChn].szName[ARRAYELEMCOUNT(pSndFile->ChnSettings[nChn].szName)-1] = 0; pModDoc->SetModified(); pModDoc->UpdateAllViews(this, HINT_MODCHANNELS | (m_nActiveTab << 24)); } @@ -1013,6 +1015,7 @@ if ((pSndFile->m_nType & (MOD_TYPE_XM|MOD_TYPE_IT|MOD_TYPE_MPT)) && (nChn < pSndFile->m_nChannels) && (strncmp(s, pSndFile->ChnSettings[nChn].szName, MAX_CHANNELNAME))) { memcpy(pSndFile->ChnSettings[nChn].szName, s, MAX_CHANNELNAME); + pSndFile->ChnSettings[nChn].szName[ARRAYELEMCOUNT(pSndFile->ChnSettings[nChn].szName)-1] = 0; pModDoc->SetModified(); pModDoc->UpdateAllViews(this, HINT_MODCHANNELS | (m_nActiveTab << 24)); } @@ -1037,6 +1040,7 @@ if ((pSndFile->m_nType & (MOD_TYPE_XM|MOD_TYPE_IT|MOD_TYPE_MPT)) && (nChn < pSndFile->m_nChannels) && (strncmp(s, pSndFile->ChnSettings[nChn].szName, MAX_CHANNELNAME))) { memcpy(pSndFile->ChnSettings[nChn].szName, s, MAX_CHANNELNAME); + pSndFile->ChnSettings[nChn].szName[ARRAYELEMCOUNT(pSndFile->ChnSettings[nChn].szName)-1] = 0; pModDoc->SetModified(); pModDoc->UpdateAllViews(this, HINT_MODCHANNELS | (m_nActiveTab << 24)); } Modified: trunk/OpenMPT/mptrack/View_ins.cpp =================================================================== --- trunk/OpenMPT/mptrack/View_ins.cpp 2007-07-11 20:36:02 UTC (rev 191) +++ trunk/OpenMPT/mptrack/View_ins.cpp 2007-11-17 17:59:58 UTC (rev 192) @@ -2361,7 +2361,7 @@ { CMainFrame *pMainFrm = CMainFrame::GetMainFrame(); CModDoc *pModDoc = GetDocument(); - if ((pModDoc) && (pMainFrm) && (note<128)) + if ((pModDoc) && (pMainFrm) && (note > 0) && (note<128)) { CHAR s[64]; const size_t sizeofS = sizeof(s) / sizeof(s[0]); @@ -2387,13 +2387,13 @@ } */ INSTRUMENTHEADER *penv = pModDoc->GetSoundFile()->Headers[m_nInstrument]; - if ((!penv) || (!penv->Keyboard[note])) return; + if ((!penv) || (!penv->Keyboard[note-1] && !penv->nMixPlug)) return; m_baPlayingNote[note] = true; //rewbs.instViewNNA m_nPlayingChannel= pModDoc->PlayNote(note, m_nInstrument, 0, FALSE); //rewbs.instViewNNA s[0] = 0; if ((note) && (note <= 120)) { - const string temp = pModDoc->GetSoundFile()->GetNoteName(static_cast<CTuning::STEPTYPE>(note), m_nInstrument); + const string temp = pModDoc->GetSoundFile()->GetNoteName(note, m_nInstrument); ... [truncated message content] |