From: <sag...@us...> - 2015-06-01 22:12:00
|
Revision: 5230 http://sourceforge.net/p/modplug/code/5230 Author: saga-games Date: 2015-06-01 22:11:54 +0000 (Mon, 01 Jun 2015) Log Message: ----------- [Fix] Previous commit was still missing a file. [Imp] Make amplification and envelope scaling dialogs and use CNumberEdit Modified Paths: -------------- trunk/OpenMPT/mptrack/SampleEditorDialogs.cpp trunk/OpenMPT/mptrack/SampleEditorDialogs.h trunk/OpenMPT/mptrack/ScaleEnvPointsDlg.cpp trunk/OpenMPT/mptrack/ScaleEnvPointsDlg.h trunk/OpenMPT/mptrack/mptrack.rc trunk/OpenMPT/soundlib/Load_mid.cpp Modified: trunk/OpenMPT/mptrack/SampleEditorDialogs.cpp =================================================================== --- trunk/OpenMPT/mptrack/SampleEditorDialogs.cpp 2015-06-01 22:00:39 UTC (rev 5229) +++ trunk/OpenMPT/mptrack/SampleEditorDialogs.cpp 2015-06-01 22:11:54 UTC (rev 5230) @@ -29,7 +29,7 @@ //---------------------------------------------- { CDialog::DoDataExchange(pDX); - //{{AFX_DATA_MAP(CSampleGridDlg) + //{{AFX_DATA_MAP(CAmpDlg) DDX_Control(pDX, IDC_COMBO1, m_fadeBox); //}}AFX_DATA_MAP } @@ -56,6 +56,9 @@ spin->SetPos32(m_nFactor); } SetDlgItemInt(IDC_EDIT1, m_nFactor); + m_edit.SubclassDlgItem(IDC_EDIT1, this); + m_edit.AllowFractions(false); + m_edit.AllowNegative(m_nFactorMin < 0); const struct { @@ -121,16 +124,12 @@ m_list.DeleteImageList(); } + void CAmpDlg::OnOK() //------------------ { - const int nVal = static_cast<int>(GetDlgItemInt(IDC_EDIT1)); - if(nVal < m_nFactorMin || nVal > m_nFactorMax) - { - CString str; str.Format(GetStrI18N(_T("Value should be within [%d, %d]")), m_nFactorMin, m_nFactorMax); - Reporting::Information(str); - return; - } + int nVal = static_cast<int>(GetDlgItemInt(IDC_EDIT1)); + Limit(nVal, m_nFactorMin, m_nFactorMax); m_nFactor = static_cast<int16>(nVal); m_bFadeIn = (IsDlgButtonChecked(IDC_CHECK1) != BST_UNCHECKED); m_bFadeOut = (IsDlgButtonChecked(IDC_CHECK2) != BST_UNCHECKED); @@ -173,7 +172,7 @@ CheckRadioButton(IDC_RADIO1, IDC_RADIO2, (m_nFormat.GetBitDepth() == 8) ? IDC_RADIO1 : IDC_RADIO2 ); CheckRadioButton(IDC_RADIO3, IDC_RADIO4, (m_nFormat.GetEncoding() == SampleIO::unsignedPCM) ? IDC_RADIO3 : IDC_RADIO4); CheckRadioButton(IDC_RADIO5, IDC_RADIO6, (m_nFormat.GetChannelFormat() == SampleIO::mono) ? IDC_RADIO5 : IDC_RADIO6); - CheckDlgButton(IDC_CHK_REMEMBERSETTINGS, (m_bRememberFormat) ? MF_CHECKED : MF_UNCHECKED); + CheckDlgButton(IDC_CHK_REMEMBERSETTINGS, (m_bRememberFormat ? MF_CHECKED : MF_UNCHECKED)); } Modified: trunk/OpenMPT/mptrack/SampleEditorDialogs.h =================================================================== --- trunk/OpenMPT/mptrack/SampleEditorDialogs.h 2015-06-01 22:00:39 UTC (rev 5229) +++ trunk/OpenMPT/mptrack/SampleEditorDialogs.h 2015-06-01 22:11:54 UTC (rev 5230) @@ -13,6 +13,7 @@ #include "../soundlib/SampleIO.h" #include "FadeLaws.h" +#include "CDecimalSupport.h" OPENMPT_NAMESPACE_BEGIN @@ -31,6 +32,7 @@ protected: CComboBoxEx m_fadeBox; CImageList m_list; + CNumberEdit m_edit; public: CAmpDlg(CWnd *parent, int16 factor, Fade::Law fadeLaw, int16 factorMin = int16_min, int16 factorMax = int16_max); Modified: trunk/OpenMPT/mptrack/ScaleEnvPointsDlg.cpp =================================================================== --- trunk/OpenMPT/mptrack/ScaleEnvPointsDlg.cpp 2015-06-01 22:00:39 UTC (rev 5229) +++ trunk/OpenMPT/mptrack/ScaleEnvPointsDlg.cpp 2015-06-01 22:11:54 UTC (rev 5230) @@ -10,29 +10,28 @@ #include "stdafx.h" #include "resource.h" +#include "ModInstrument.h" #include "ScaleEnvPointsDlg.h" -#include "ModInstrument.h" OPENMPT_NAMESPACE_BEGIN -float CScaleEnvPointsDlg::m_fFactorX = 1.0f; -float CScaleEnvPointsDlg::m_fFactorY = 1.0f; +double CScaleEnvPointsDlg::m_fFactorX = 1.0; +double CScaleEnvPointsDlg::m_fFactorY = 1.0; BOOL CScaleEnvPointsDlg::OnInitDialog() //------------------------------------- { CDialog::OnInitDialog(); + m_EditX.SubclassDlgItem(IDC_EDIT_FACTORX, this); + m_EditY.SubclassDlgItem(IDC_EDIT_FACTORY, this); + m_EditX.AllowNegative(false); + m_EditX.SetDecimalValue(m_fFactorX); + m_EditY.SetDecimalValue(m_fFactorY); + m_EditX.SetFocus(); - char buffer[10]; - _snprintf(buffer, 9, "%g", m_fFactorX); - SetDlgItemText(IDC_EDIT_FACTORX, buffer); - _snprintf(buffer, 9, "%g", m_fFactorY); - SetDlgItemText(IDC_EDIT_FACTORY, buffer); - GetDlgItem(IDC_EDIT_FACTORX)->SetFocus(); - return FALSE; // return TRUE unless you set the focus to a control } @@ -40,18 +39,14 @@ void CScaleEnvPointsDlg::OnOK() //----------------------------- { - char buffer[10]; - GetDlgItemText(IDC_EDIT_FACTORX, buffer, 9); - m_fFactorX = ConvertStrTo<float>(buffer); + m_EditX.GetDecimalValue(m_fFactorX); + m_EditY.GetDecimalValue(m_fFactorY); - GetDlgItemText(IDC_EDIT_FACTORY, buffer, 9); - m_fFactorY = ConvertStrTo<float>(buffer); - if(m_fFactorX > 0 && m_fFactorX != 1) { for(uint32 i = 0; i < m_Env.nNodes; i++) { - m_Env.Ticks[i] = static_cast<WORD>(m_fFactorX * m_Env.Ticks[i]); + m_Env.Ticks[i] = static_cast<uint16>(m_fFactorX * m_Env.Ticks[i]); // Checking that the order of points is preserved. if(i > 0 && m_Env.Ticks[i] <= m_Env.Ticks[i - 1]) @@ -61,7 +56,7 @@ if(m_fFactorY != 1) { - float factor = m_fFactorY; + double factor = m_fFactorY; bool invert = false; if(m_fFactorY < 0) { Modified: trunk/OpenMPT/mptrack/ScaleEnvPointsDlg.h =================================================================== --- trunk/OpenMPT/mptrack/ScaleEnvPointsDlg.h 2015-06-01 22:00:39 UTC (rev 5229) +++ trunk/OpenMPT/mptrack/ScaleEnvPointsDlg.h 2015-06-01 22:11:54 UTC (rev 5230) @@ -10,6 +10,8 @@ #pragma once +#include "CDecimalSupport.h" + OPENMPT_NAMESPACE_BEGIN struct InstrumentEnvelope; @@ -18,18 +20,19 @@ class CScaleEnvPointsDlg : public CDialog //======================================= { -public: - - CScaleEnvPointsDlg(CWnd* pParent, InstrumentEnvelope &env, int nCenter) : CDialog(IDD_SCALE_ENV_POINTS, pParent), m_Env(env) - { - m_nCenter = nCenter; - } - -private: +protected: + CNumberEdit m_EditX, m_EditY; InstrumentEnvelope &m_Env; //To tell which envelope to process. - static float m_fFactorX, m_fFactorY; + static double m_fFactorX, m_fFactorY; int m_nCenter; +public: + CScaleEnvPointsDlg(CWnd* pParent, InstrumentEnvelope &env, int nCenter) + : CDialog(IDD_SCALE_ENV_POINTS, pParent) + , m_Env(env) + , m_nCenter(nCenter) + { } + protected: virtual void OnOK(); virtual BOOL OnInitDialog(); Modified: trunk/OpenMPT/mptrack/mptrack.rc =================================================================== --- trunk/OpenMPT/mptrack/mptrack.rc 2015-06-01 22:00:39 UTC (rev 5229) +++ trunk/OpenMPT/mptrack/mptrack.rc 2015-06-01 22:11:54 UTC (rev 5230) @@ -1106,11 +1106,12 @@ CONTROL "Plugin volume command &bug emulation",IDC_CHK_MIDICCBUG, "Button",BS_AUTOCHECKBOX | WS_TABSTOP,18,167,222,12 LTEXT "&Tempo Mode:",IDC_TEXT_TEMPOMODE,12,204,44,8 - COMBOBOX IDC_COMBO_TEMPOMODE,12,215,108,77,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP - LTEXT "Rows per beat",IDC_TEXT_ROWSPERBEAT,162,206,84,8 - EDITTEXT IDC_ROWSPERBEAT,132,204,24,12,ES_AUTOHSCROLL | ES_NUMBER - LTEXT "Rows per measure",IDC_TEXT_ROWSPERMEASURE,162,223,84,8 - EDITTEXT IDC_ROWSPERMEASURE,132,222,24,12,ES_AUTOHSCROLL | ES_NUMBER + COMBOBOX IDC_COMBO_TEMPOMODE,60,204,78,77,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP + LTEXT "Rows per beat",IDC_TEXT_ROWSPERBEAT,174,206,72,8 + EDITTEXT IDC_ROWSPERBEAT,144,204,24,12,ES_AUTOHSCROLL | ES_NUMBER + LTEXT "Rows per measure",IDC_TEXT_ROWSPERMEASURE,174,223,72,8 + EDITTEXT IDC_ROWSPERMEASURE,144,222,24,12,ES_AUTOHSCROLL | ES_NUMBER + PUSHBUTTON "Configure S&huffle",IDC_BUTTON1,60,222,78,12 RTEXT "Created with:",IDC_TEXT_CREATEDWITH,12,260,60,8 EDITTEXT IDC_EDIT_CREATEDWITH,78,258,166,13,ES_AUTOHSCROLL | ES_READONLY,WS_EX_STATICEDGE RTEXT "Last saved with:",IDC_TEXT_SAVEDWITH,12,276,60,8 @@ -1339,7 +1340,7 @@ FONT 8, "MS Shell Dlg", 0, 0, 0x0 BEGIN LTEXT "Amplify by",IDC_STATIC,13,21,37,8 - EDITTEXT IDC_EDIT1,60,18,40,14,ES_AUTOHSCROLL + EDITTEXT IDC_EDIT1,60,18,40,14,ES_AUTOHSCROLL | ES_NUMBER CONTROL "Spin1",IDC_SPIN1,"msctls_updown32",UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS | UDS_NOTHOUSANDS,95,19,11,14 LTEXT "%",IDC_STATIC,103,21,11,8 DEFPUSHBUTTON "OK",IDOK,150,6,50,14 @@ -2738,8 +2739,8 @@ CAPTION "Scale Envelope Points" FONT 8, "MS Shell Dlg", 400, 0, 0x1 BEGIN - EDITTEXT IDC_EDIT_FACTORX,126,6,36,13,ES_AUTOHSCROLL - EDITTEXT IDC_EDIT_FACTORY,126,24,36,13,ES_AUTOHSCROLL + EDITTEXT IDC_EDIT_FACTORX,126,6,36,13,ES_AUTOHSCROLL | ES_NUMBER + EDITTEXT IDC_EDIT_FACTORY,126,24,36,13,ES_AUTOHSCROLL | ES_NUMBER DEFPUSHBUTTON "OK",IDOK,60,54,50,14 PUSHBUTTON "Cancel",IDCANCEL,114,54,50,14 LTEXT "Scale envelope points (x axis) by:",IDC_STATIC,6,8,120,8 Modified: trunk/OpenMPT/soundlib/Load_mid.cpp =================================================================== --- trunk/OpenMPT/soundlib/Load_mid.cpp 2015-06-01 22:00:39 UTC (rev 5229) +++ trunk/OpenMPT/soundlib/Load_mid.cpp 2015-06-01 22:11:54 UTC (rev 5230) @@ -12,7 +12,6 @@ #include "stdafx.h" #include "Loaders.h" #include "Dlsbank.h" -#include "Wav.h" #ifdef MODPLUG_TRACKER #include "../mptrack/TrackerSettings.h" #endif // MODPLUG_TRACKER This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |