From: <sag...@us...> - 2015-04-12 16:09:50
|
Revision: 4927 http://sourceforge.net/p/modplug/code/4927 Author: saga-games Date: 2015-04-12 16:09:36 +0000 (Sun, 12 Apr 2015) Log Message: ----------- [New] Sample and pattern volume fading can now use other fade curves than just linear: Exponential, Logarithmic, Square Root, Quarter Sine, Half Sine Modified Paths: -------------- trunk/OpenMPT/mptrack/Ctrl_smp.cpp trunk/OpenMPT/mptrack/Ctrl_smp.h trunk/OpenMPT/mptrack/SampleEditorDialogs.cpp trunk/OpenMPT/mptrack/SampleEditorDialogs.h trunk/OpenMPT/mptrack/View_pat.cpp trunk/OpenMPT/mptrack/mptrack.rc trunk/OpenMPT/mptrack/mptrack_08.vcproj trunk/OpenMPT/mptrack/mptrack_10.vcxproj trunk/OpenMPT/mptrack/mptrack_10.vcxproj.filters Added Paths: ----------- trunk/OpenMPT/mptrack/FadeLaws.h Modified: trunk/OpenMPT/mptrack/Ctrl_smp.cpp =================================================================== --- trunk/OpenMPT/mptrack/Ctrl_smp.cpp 2015-04-11 23:36:29 UTC (rev 4926) +++ trunk/OpenMPT/mptrack/Ctrl_smp.cpp 2015-04-12 16:09:36 UTC (rev 4927) @@ -1323,53 +1323,6 @@ } -template<typename T> -void ApplyAmplifyImpl(T *pSample, SmpLength start, SmpLength end, int32 amp, bool fadeIn, bool fadeOut) -//----------------------------------------------------------------------------------------------------- -{ - pSample += start; - SmpLength len = end - start; - int64 l64 = static_cast<int64>(len); - - for(SmpLength i = 0; i < len; i++) - { - int32 l = (pSample[i] * amp) / 100; - if(fadeIn) l = (int32)((l * (int64)i) / l64); - if(fadeOut) l = (int32)((l * (int64)(len - i)) / l64); - Limit(l, std::numeric_limits<T>::min(), std::numeric_limits<T>::max()); - pSample[i] = static_cast<T>(l); - } -} - - -void CCtrlSamples::ApplyAmplify(int32 lAmp, bool fadeIn, bool fadeOut) -//-------------------------------------------------------------------- -{ - if((!m_sndFile.GetSample(m_nSample).pSample)) return; - - BeginWaitCursor(); - ModSample &sample = m_sndFile.GetSample(m_nSample); - - SampleSelectionPoints selection = GetSelectionPoints(); - - m_modDoc.GetSampleUndo().PrepareUndo(m_nSample, sundo_update, "Amplify", selection.nStart, selection.nEnd); - - if (sample.uFlags[CHN_STEREO]) { selection.nStart *= 2; selection.nEnd *= 2; } - if ((fadeIn) && (fadeOut)) lAmp *= 4; - if (sample.uFlags[CHN_16BIT]) - { - ApplyAmplifyImpl<int16>(sample.pSample16, selection.nStart, selection.nEnd, lAmp, fadeIn, fadeOut); - } else - { - ApplyAmplifyImpl<int8>(sample.pSample8, selection.nStart, selection.nEnd, lAmp, fadeIn, fadeOut); - } - sample.PrecomputeLoops(m_sndFile, false); - SetModified(SampleHint().Data(), false, true); - EndWaitCursor(); - SwitchToView(); -} - - void CCtrlSamples::OnRemoveDCOffset() //----------------------------------- { @@ -1450,14 +1403,74 @@ } +template<typename T> +static void ApplyAmplifyImpl(T * MPT_RESTRICT pSample, SmpLength start, SmpLength end, int32 amp, bool fadeIn, bool fadeOut, Fade::Law fadeLaw) +//--------------------------------------------------------------------------------------------------------------------------------------------- +{ + pSample += start; + SmpLength len = end - start, len2 = len / 2; + Fade::Func fadeFunc = Fade::GetFadeFunc(fadeLaw); + + for(SmpLength i = 0; i < len; i++) + { + int32 l = (pSample[i] * amp) / 100; + if(fadeIn && fadeOut) + { + if(i < len2) + l = fadeFunc(l, i, len2); + else + l = fadeFunc(l, len - i, len - len2); + } else if(fadeIn) + { + l = fadeFunc(l, i, len); + } else if(fadeOut) + { + l = fadeFunc(l, len - i, len); + } + Limit(l, std::numeric_limits<T>::min(), std::numeric_limits<T>::max()); + pSample[i] = static_cast<T>(l); + } +} + + +void CCtrlSamples::ApplyAmplify(int32 lAmp, bool fadeIn, bool fadeOut, Fade::Law fadeLaw) +//--------------------------------------------------------------------------------------- +{ + if((!m_sndFile.GetSample(m_nSample).pSample)) return; + + BeginWaitCursor(); + ModSample &sample = m_sndFile.GetSample(m_nSample); + + SampleSelectionPoints selection = GetSelectionPoints(); + + m_modDoc.GetSampleUndo().PrepareUndo(m_nSample, sundo_update, "Amplify", selection.nStart, selection.nEnd); + + selection.nStart *= sample.GetNumChannels(); + selection.nEnd *= sample.GetNumChannels(); + if (sample.uFlags[CHN_16BIT]) + { + ApplyAmplifyImpl(sample.pSample16, selection.nStart, selection.nEnd, lAmp, fadeIn, fadeOut, fadeLaw); + } else + { + ApplyAmplifyImpl(sample.pSample8, selection.nStart, selection.nEnd, lAmp, fadeIn, fadeOut, fadeLaw); + } + sample.PrecomputeLoops(m_sndFile, false); + SetModified(SampleHint().Data(), false, true); + EndWaitCursor(); + SwitchToView(); +} + + void CCtrlSamples::OnAmplify() //---------------------------- { - static int16 snOldAmp = 100; - CAmpDlg dlg(this, snOldAmp); + static int16 oldAmp = 100; + static Fade::Law fadeLaw = Fade::kLinear; + CAmpDlg dlg(this, oldAmp, fadeLaw); if (dlg.DoModal() != IDOK) return; - snOldAmp = dlg.m_nFactor; - ApplyAmplify(dlg.m_nFactor, dlg.m_bFadeIn, dlg.m_bFadeOut); + oldAmp = dlg.m_nFactor; + fadeLaw = dlg.m_fadeLaw; + ApplyAmplify(dlg.m_nFactor, dlg.m_bFadeIn, dlg.m_bFadeOut, dlg.m_fadeLaw); } @@ -1472,7 +1485,7 @@ SampleSelectionPoints sel = GetSelectionPoints(); if(sel.selectionActive && (sel.nStart == 0 || sel.nEnd == m_sndFile.GetSample(m_nSample).nLength)) { - ApplyAmplify(100, (sel.nStart == 0), (sel.nEnd == m_sndFile.GetSample(m_nSample).nLength)); + ApplyAmplify(100, (sel.nStart == 0), (sel.nEnd == m_sndFile.GetSample(m_nSample).nLength), Fade::kLinear); } else { // Can't apply quick fade as no appropriate selection has been made, so ask the user to amplify the whole sample instead. Modified: trunk/OpenMPT/mptrack/Ctrl_smp.h =================================================================== --- trunk/OpenMPT/mptrack/Ctrl_smp.h 2015-04-11 23:36:29 UTC (rev 4926) +++ trunk/OpenMPT/mptrack/Ctrl_smp.h 2015-04-12 16:09:36 UTC (rev 4927) @@ -12,6 +12,7 @@ #pragma once #include "../soundlib/SampleIO.h" +#include "FadeLaws.h" OPENMPT_NAMESPACE_BEGIN @@ -55,7 +56,7 @@ // Applies amplification to sample. Negative values // can be used to invert phase. - void ApplyAmplify(int32 nAmp, bool fadeIn = false, bool fadeOut = false); + void ApplyAmplify(int32 nAmp, bool fadeIn, bool fadeOut, Fade::Law fadeLaw); void ApplyResample(uint32_t newRate); SampleSelectionPoints GetSelectionPoints(); Added: trunk/OpenMPT/mptrack/FadeLaws.h =================================================================== --- trunk/OpenMPT/mptrack/FadeLaws.h (rev 0) +++ trunk/OpenMPT/mptrack/FadeLaws.h 2015-04-12 16:09:36 UTC (rev 4927) @@ -0,0 +1,66 @@ +/* + * FadeLaws.h + * ---------- + * Purpose: Various fade law implementations for sample and pattern fading / interpolation + * Notes : (currently none) + * Authors: OpenMPT Devs + * The OpenMPT source code is released under the BSD license. Read LICENSE for more details. + */ + +#pragma once + +#define _USE_MATH_DEFINES +#include <cmath> +#ifndef M_PI +#define M_PI 3.14159265358979323846 +#endif +#ifndef M_PI_2 +#define M_PI_2 1.57079632679489661923 +#endif +#include "../common/misc_util.h" + +OPENMPT_NAMESPACE_BEGIN + +namespace Fade +{ + enum Law + { + kLinear, + kPow, + kSqrt, + kLog, + kQuarterSine, + kHalfSine, + }; + + typedef int32 (*Func) (int32 val, int64 i, int64 max); + + static int32 LinearFunc(int32 val, int64 i, int64 max) + { return static_cast<int32>((val * i) / max); } + static int32 PowFunc(int32 val, int64 i, int64 max) + { return static_cast<int32>((val * i * i) / (max * max)); } + static int32 SqrtFunc(int32 val, int64 i, int64 max) + { return Util::Round<int32>(val * std::sqrt(static_cast<double>(i) / max)); } + static int32 LogFunc(int32 val, int64 i, int64 max) + { return Util::Round<int32>(val * std::log10(1.0 + (static_cast<double>(i) / max) * 99.0) * 0.5); } + static int32 QuarterSineFunc(int32 val, int64 i, int64 max) + { return Util::Round<int32>(val * std::sin(M_PI_2 * static_cast<double>(i) / max)); } + static int32 HalfSineFunc(int32 val, int64 i, int64 max) + { return Util::Round<int32>(val * (1.0 + std::cos(M_PI + M_PI * static_cast<double>(i) / max)) * 0.5); } + + static Func GetFadeFunc(Law fadeLaw) + { + switch(fadeLaw) + { + default: + case Fade::kLinear: return LinearFunc; + case Fade::kPow: return PowFunc; + case Fade::kSqrt: return SqrtFunc; + case Fade::kLog: return LogFunc; + case Fade::kQuarterSine: return QuarterSineFunc; + case Fade::kHalfSine: return HalfSineFunc; + } + } +} + +OPENMPT_NAMESPACE_END Property changes on: trunk/OpenMPT/mptrack/FadeLaws.h ___________________________________________________________________ Added: svn:mime-type ## -0,0 +1 ## +text/x-chdr \ No newline at end of property Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Modified: trunk/OpenMPT/mptrack/SampleEditorDialogs.cpp =================================================================== --- trunk/OpenMPT/mptrack/SampleEditorDialogs.cpp 2015-04-11 23:36:29 UTC (rev 4926) +++ trunk/OpenMPT/mptrack/SampleEditorDialogs.cpp 2015-04-12 16:09:36 UTC (rev 4927) @@ -24,11 +24,15 @@ ////////////////////////////////////////////////////////////////////////// // Sample amplification dialog -CAmpDlg::CAmpDlg(CWnd *parent, int16 nFactor, int16 nFactorMin, int16 nFactorMax) -//------------------------------------------------------------------------------- -: CDialog(IDD_SAMPLE_AMPLIFY, parent), m_nFactor(nFactor), -m_nFactorMin(nFactorMin), m_nFactorMax(nFactorMax), -m_bFadeIn(FALSE), m_bFadeOut(FALSE) +CAmpDlg::CAmpDlg(CWnd *parent, int16 factor, Fade::Law fadeLaw, int16 factorMin, int16 factorMax) +//----------------------------------------------------------------------------------------------- + : CDialog(IDD_SAMPLE_AMPLIFY, parent) + , m_nFactor(factor) + , m_nFactorMin(factorMin) + , m_nFactorMax(factorMax) + , m_bFadeIn(FALSE) + , m_bFadeOut(FALSE) + , m_fadeLaw(fadeLaw) {} BOOL CAmpDlg::OnInitDialog() @@ -42,6 +46,28 @@ spin->SetPos32(m_nFactor); } SetDlgItemInt(IDC_EDIT1, m_nFactor); + + CComboBox *combo = (CComboBox *)GetDlgItem(IDC_COMBO1); + const struct + { + const TCHAR *name; + Fade::Law id; + } fadeLaws[] = + { + { _T("Linear"), Fade::kLinear }, + { _T("Exponential"), Fade::kPow }, + { _T("Square Root"), Fade::kSqrt }, + { _T("Logarithmic"), Fade::kLog }, + { _T("Quarter Sine"), Fade::kQuarterSine }, + { _T("Half Sine"), Fade::kHalfSine }, + }; + for(size_t i = 0; i < CountOf(fadeLaws); i++) + { + int id = combo->AddString(fadeLaws[i].name); + combo->SetItemData(id, fadeLaws[i].id); + if(fadeLaws[i].id == m_fadeLaw) combo->SetCurSel(id); + } + return TRUE; } @@ -52,13 +78,15 @@ const int nVal = static_cast<int>(GetDlgItemInt(IDC_EDIT1)); if(nVal < m_nFactorMin || nVal > m_nFactorMax) { - CString str; str.Format(GetStrI18N(__TEXT("Value should be within [%d, %d]")), m_nFactorMin, m_nFactorMax); + CString str; str.Format(GetStrI18N(_T("Value should be within [%d, %d]")), m_nFactorMin, m_nFactorMax); Reporting::Information(str); return; } m_nFactor = static_cast<int16>(nVal); - m_bFadeIn = (IsDlgButtonChecked(IDC_CHECK1) != 0); - m_bFadeOut = (IsDlgButtonChecked(IDC_CHECK2) != 0); + m_bFadeIn = (IsDlgButtonChecked(IDC_CHECK1) != BST_UNCHECKED); + m_bFadeOut = (IsDlgButtonChecked(IDC_CHECK2) != BST_UNCHECKED); + CComboBox *combo = (CComboBox *)GetDlgItem(IDC_COMBO1); + m_fadeLaw = static_cast<Fade::Law>(combo->GetItemData(combo->GetCurSel())); CDialog::OnOK(); } Modified: trunk/OpenMPT/mptrack/SampleEditorDialogs.h =================================================================== --- trunk/OpenMPT/mptrack/SampleEditorDialogs.h 2015-04-11 23:36:29 UTC (rev 4926) +++ trunk/OpenMPT/mptrack/SampleEditorDialogs.h 2015-04-12 16:09:36 UTC (rev 4927) @@ -12,6 +12,7 @@ #pragma once #include "../soundlib/SampleIO.h" +#include "FadeLaws.h" OPENMPT_NAMESPACE_BEGIN @@ -23,11 +24,12 @@ //=========================== { public: + Fade::Law m_fadeLaw; int16 m_nFactor, m_nFactorMin, m_nFactorMax; bool m_bFadeIn, m_bFadeOut; public: - CAmpDlg(CWnd *parent, int16 nFactor=100, int16 nFactorMin = int16_min, int16 nFactorMax = int16_max); + CAmpDlg(CWnd *parent, int16 factor, Fade::Law fadeLaw, int16 factorMin = int16_min, int16 factorMax = int16_max); virtual BOOL OnInitDialog(); virtual void OnOK(); }; Modified: trunk/OpenMPT/mptrack/View_pat.cpp =================================================================== --- trunk/OpenMPT/mptrack/View_pat.cpp 2015-04-11 23:36:29 UTC (rev 4926) +++ trunk/OpenMPT/mptrack/View_pat.cpp 2015-04-12 16:09:36 UTC (rev 4927) @@ -3137,14 +3137,12 @@ //---------------------------------- { CModDoc *pModDoc; - CSoundFile *pSndFile; - if((pModDoc = GetDocument()) == nullptr || !IsEditingEnabled_bmsg()) { return; } - pSndFile = pModDoc->GetSoundFile(); - if(pSndFile == nullptr || !pSndFile->Patterns.IsValidPat(m_nPattern)) + CSoundFile &sndFile = pModDoc->GetrSoundFile(); + if(!sndFile.Patterns.IsValidPat(m_nPattern)) { return; } @@ -3158,7 +3156,7 @@ } // Allocate replacement pattern - ModCommand *pNewPattern = CPattern::AllocatePattern(pSndFile->Patterns[m_nPattern].GetNumRows(), pSndFile->GetNumChannels()); + ModCommand *pNewPattern = CPattern::AllocatePattern(sndFile.Patterns[m_nPattern].GetNumRows(), sndFile.GetNumChannels()); if(pNewPattern == nullptr) { return; @@ -3166,7 +3164,7 @@ // Compute destination rect PatternCursor begin(m_Selection.GetUpperLeft()), end(m_Selection.GetLowerRight()); begin.Move(dy, dx, 0); - if(begin.GetChannel() >= pSndFile->GetNumChannels()) + if(begin.GetChannel() >= sndFile.GetNumChannels()) { // Moved outside pattern range. return; @@ -3177,19 +3175,19 @@ // Extend to parameter column end.Move(0, 0, 1); } - begin.Sanitize(pSndFile->Patterns[m_nPattern].GetNumRows(), pSndFile->GetNumChannels()); - end.Sanitize(pSndFile->Patterns[m_nPattern].GetNumRows(), pSndFile->GetNumChannels()); + begin.Sanitize(sndFile.Patterns[m_nPattern].GetNumRows(), sndFile.GetNumChannels()); + end.Sanitize(sndFile.Patterns[m_nPattern].GetNumRows(), sndFile.GetNumChannels()); PatternRect destination(begin, end); const bool moveSelection = !m_Status[psKeyboardDragSelect | psCtrlDragSelect]; BeginWaitCursor(); - pModDoc->GetPatternUndo().PrepareUndo(m_nPattern, 0, 0, pSndFile->GetNumChannels(), pSndFile->Patterns[m_nPattern].GetNumRows(), moveSelection ? "Move Selection" : "Copy Selection"); + pModDoc->GetPatternUndo().PrepareUndo(m_nPattern, 0, 0, sndFile.GetNumChannels(), sndFile.Patterns[m_nPattern].GetNumRows(), moveSelection ? "Move Selection" : "Copy Selection"); ModCommand *p = pNewPattern; - for(ROWINDEX row = 0; row < pSndFile->Patterns[m_nPattern].GetNumRows(); row++) + for(ROWINDEX row = 0; row < sndFile.Patterns[m_nPattern].GetNumRows(); row++) { - for(CHANNELINDEX chn = 0; chn < pSndFile->GetNumChannels(); chn++, p++) + for(CHANNELINDEX chn = 0; chn < sndFile.GetNumChannels(); chn++, p++) { for (int c = PatternCursor::firstColumn; c <= PatternCursor::lastColumn; c++) { @@ -3210,10 +3208,10 @@ } } - if(xsrc >= 0 && xsrc < (int)pSndFile->GetNumChannels() && ysrc >= 0 && ysrc < (int)pSndFile->Patterns[m_nPattern].GetNumRows()) + if(xsrc >= 0 && xsrc < (int)sndFile.GetNumChannels() && ysrc >= 0 && ysrc < (int)sndFile.Patterns[m_nPattern].GetNumRows()) { // Copy the data - const ModCommand &src = *pSndFile->Patterns[m_nPattern].GetpModCommand(ysrc, xsrc); + const ModCommand &src = *sndFile.Patterns[m_nPattern].GetpModCommand(ysrc, xsrc); switch(c) { case PatternCursor::noteColumn: @@ -3237,8 +3235,8 @@ } CriticalSection cs; - CPattern::FreePattern(pSndFile->Patterns[m_nPattern]); - pSndFile->Patterns[m_nPattern] = pNewPattern; + CPattern::FreePattern(sndFile.Patterns[m_nPattern]); + sndFile.Patterns[m_nPattern] = pNewPattern; cs.Leave(); // Fix: Horizontal scrollbar pos screwed when selecting with mouse @@ -3458,11 +3456,36 @@ } +// Apply amplification and fade function to volume +static void AmplifyFade(int &vol, int amp, ROWINDEX row, ROWINDEX numRows, bool fadeIn, bool fadeOut, Fade::Func &fadeFunc) +//------------------------------------------------------------------------------------------------------------------------- +{ + vol *= amp; + if(fadeIn && fadeOut) + { + ROWINDEX numRows2 = numRows / 2; + if(row < numRows2) + vol = fadeFunc(vol, row + 1, numRows2); + else + vol = fadeFunc(vol, numRows - row, numRows - numRows2); + } else if(fadeIn) + { + vol = fadeFunc(vol, row + 1, numRows); + } else if(fadeOut) + { + vol = fadeFunc(vol, numRows - row, numRows); + } + vol = (vol + 50) / 100; + LimitMax(vol, 64); +} + + void CViewPattern::OnPatternAmplify() //----------------------------------- { - static int16 snOldAmp = 100; - CAmpDlg dlg(this, snOldAmp, 0); + static int16 oldAmp = 100; + static Fade::Law fadeLaw = Fade::kLinear; + CAmpDlg dlg(this, oldAmp, fadeLaw, 0); if(dlg.DoModal() != IDOK) { return; @@ -3474,7 +3497,9 @@ BeginWaitCursor(); PrepareUndo(m_Selection, "Amplify"); - snOldAmp = dlg.m_nFactor; + oldAmp = dlg.m_nFactor; + fadeLaw = dlg.m_fadeLaw; + Fade::Func fadeFunc = GetFadeFunc(fadeLaw); if(pSndFile->Patterns.IsValidPat(m_nPattern)) { @@ -3553,10 +3578,11 @@ } if(nSmp > 0 && nSmp <= pSndFile->GetNumSamples()) { - chvol[nChn] = (BYTE)(pSndFile->GetSample(nSmp).nVolume / 4); + chvol[nChn] = (uint8)(pSndFile->GetSample(nSmp).nVolume / 4); break; } else - { //nonexistant sample and no volume present in patten? assume volume=64. + { + //nonexistant sample and no volume present in patten? assume volume=64. if(useVolCol) { m->volcmd = VOLCMD_VOLUME; @@ -3631,24 +3657,18 @@ if(m->volcmd == VOLCMD_VOLUME) { - int vol = m->vol * dlg.m_nFactor; - if(dlg.m_bFadeIn) vol = (vol * (nRow+1-firstRow)) / cy; - if(dlg.m_bFadeOut) vol = (vol * (cy+firstRow-nRow)) / cy; - vol = (vol + 50) / 100; - LimitMax(vol, 64); - m->vol = (BYTE)vol; + int vol = m->vol; + AmplifyFade(vol, dlg.m_nFactor, nRow - firstRow, cy, dlg.m_bFadeIn, dlg.m_bFadeOut, fadeFunc); + m->vol = static_cast<ModCommand::VOL>(vol); } if(m_Selection.ContainsHorizontal(PatternCursor(0, nChn, PatternCursor::effectColumn)) || m_Selection.ContainsHorizontal(PatternCursor(0, nChn, PatternCursor::paramColumn))) { if(m->command == CMD_VOLUME && m->param <= 64) { - int vol = m->param * dlg.m_nFactor; - if(dlg.m_bFadeIn) vol = (vol * (nRow + 1 - firstRow)) / cy; - if(dlg.m_bFadeOut) vol = (vol * (cy + firstRow - nRow)) / cy; - vol = (vol + 50) / 100; - LimitMax(vol, 64); - m->param = (BYTE)vol; + int vol = m->param; + AmplifyFade(vol, dlg.m_nFactor, nRow - firstRow, cy, dlg.m_bFadeIn, dlg.m_bFadeOut, fadeFunc); + m->param = static_cast<ModCommand::PARAM>(vol); } } } Modified: trunk/OpenMPT/mptrack/mptrack.rc =================================================================== --- trunk/OpenMPT/mptrack/mptrack.rc 2015-04-11 23:36:29 UTC (rev 4926) +++ trunk/OpenMPT/mptrack/mptrack.rc 2015-04-12 16:09:36 UTC (rev 4927) @@ -1330,20 +1330,22 @@ CONTROL "",IDC_SLIDER2,"msctls_trackbar32",TBS_BOTH | TBS_NOTICKS | WS_TABSTOP,114,78,150,12 END -IDD_SAMPLE_AMPLIFY DIALOGEX 0, 0, 175, 71 -STYLE DS_SETFONT | DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU +IDD_SAMPLE_AMPLIFY DIALOGEX 0, 0, 190, 82 +STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_CAPTION | WS_SYSMENU CAPTION "Amplify" FONT 8, "MS Shell Dlg", 0, 0, 0x0 BEGIN - LTEXT "Amplify by",IDC_STATIC,13,19,37,8 - EDITTEXT IDC_EDIT1,54,16,40,14,ES_AUTOHSCROLL - CONTROL "Spin1",IDC_SPIN1,"msctls_updown32",UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS | UDS_NOTHOUSANDS,89,17,11,14 - LTEXT "%",IDC_STATIC,97,19,11,8 - DEFPUSHBUTTON "OK",IDOK,120,6,50,14 - PUSHBUTTON "Cancel",IDCANCEL,120,24,50,14 + LTEXT "Amplify by",IDC_STATIC,13,21,37,8 + EDITTEXT IDC_EDIT1,60,18,40,14,ES_AUTOHSCROLL + 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,132,6,50,14 + PUSHBUTTON "Cancel",IDCANCEL,132,24,50,14 CONTROL "Fade In",IDC_CHECK1,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,12,36,88,10 CONTROL "Fade Out",IDC_CHECK2,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,12,48,88,10 - GROUPBOX "",IDC_STATIC,6,6,108,60 + LTEXT "Fade Curve:",IDC_STATIC,12,62,48,8 + COMBOBOX IDC_COMBO1,60,60,60,30,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP + GROUPBOX "",IDC_STATIC,6,6,120,72 END IDD_OPTIONS_AUTHOR DIALOGEX 0, 0, 214, 151 Modified: trunk/OpenMPT/mptrack/mptrack_08.vcproj =================================================================== --- trunk/OpenMPT/mptrack/mptrack_08.vcproj 2015-04-11 23:36:29 UTC (rev 4926) +++ trunk/OpenMPT/mptrack/mptrack_08.vcproj 2015-04-12 16:09:36 UTC (rev 4927) @@ -1262,6 +1262,10 @@ > </File> <File + RelativePath=".\FadeLaws.h" + > + </File> + <File RelativePath=".\FileDialog.h" > </File> Modified: trunk/OpenMPT/mptrack/mptrack_10.vcxproj =================================================================== --- trunk/OpenMPT/mptrack/mptrack_10.vcxproj 2015-04-11 23:36:29 UTC (rev 4926) +++ trunk/OpenMPT/mptrack/mptrack_10.vcxproj 2015-04-12 16:09:36 UTC (rev 4927) @@ -1050,6 +1050,7 @@ <ClInclude Include="EffectInfo.h" /> <ClInclude Include="ExceptionHandler.h" /> <ClInclude Include="ExternalSamples.h" /> + <ClInclude Include="FadeLaws.h" /> <ClInclude Include="FileDialog.h" /> <ClInclude Include="FolderScanner.h" /> <ClInclude Include="Globals.h" /> Modified: trunk/OpenMPT/mptrack/mptrack_10.vcxproj.filters =================================================================== --- trunk/OpenMPT/mptrack/mptrack_10.vcxproj.filters 2015-04-11 23:36:29 UTC (rev 4926) +++ trunk/OpenMPT/mptrack/mptrack_10.vcxproj.filters 2015-04-12 16:09:36 UTC (rev 4927) @@ -1074,6 +1074,9 @@ <ClInclude Include="..\sounddev\SoundDeviceUtilities.h"> <Filter>Header Files\sounddev</Filter> </ClInclude> + <ClInclude Include="FadeLaws.h"> + <Filter>Header Files\mptrack</Filter> + </ClInclude> </ItemGroup> <ItemGroup> <None Include="res\bitmap1.bmp"> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <sag...@us...> - 2015-04-12 21:30:09
|
Revision: 4929 http://sourceforge.net/p/modplug/code/4929 Author: saga-games Date: 2015-04-12 21:29:56 +0000 (Sun, 12 Apr 2015) Log Message: ----------- [Imp] Show icons in amplification dialog to visualize the different fade curves. Modified Paths: -------------- trunk/OpenMPT/mptrack/SampleEditorDialogs.cpp trunk/OpenMPT/mptrack/SampleEditorDialogs.h trunk/OpenMPT/mptrack/mptrack.rc Modified: trunk/OpenMPT/mptrack/SampleEditorDialogs.cpp =================================================================== --- trunk/OpenMPT/mptrack/SampleEditorDialogs.cpp 2015-04-12 17:13:40 UTC (rev 4928) +++ trunk/OpenMPT/mptrack/SampleEditorDialogs.cpp 2015-04-12 21:29:56 UTC (rev 4929) @@ -12,6 +12,7 @@ #include "stdafx.h" #include "resource.h" #include "Reporting.h" +#include "MPTrackUtil.h" #include "../common/misc_util.h" #include "../soundlib/Snd_defs.h" #include "../soundlib/ModSample.h" @@ -24,6 +25,15 @@ ////////////////////////////////////////////////////////////////////////// // Sample amplification dialog +void CAmpDlg::DoDataExchange(CDataExchange* pDX) +//---------------------------------------------- +{ + CDialog::DoDataExchange(pDX); + //{{AFX_DATA_MAP(CSampleGridDlg) + DDX_Control(pDX, IDC_COMBO1, m_fadeBox); + //}}AFX_DATA_MAP +} + CAmpDlg::CAmpDlg(CWnd *parent, int16 factor, Fade::Law fadeLaw, int16 factorMin, int16 factorMax) //----------------------------------------------------------------------------------------------- : CDialog(IDD_SAMPLE_AMPLIFY, parent) @@ -47,12 +57,11 @@ } SetDlgItemInt(IDC_EDIT1, m_nFactor); - CComboBox *combo = (CComboBox *)GetDlgItem(IDC_COMBO1); const struct { - const TCHAR *name; + TCHAR *name; Fade::Law id; - } fadeLaws[] = + } fadeLaws[] = { { _T("Linear"), Fade::kLinear }, { _T("Exponential"), Fade::kPow }, @@ -61,17 +70,57 @@ { _T("Quarter Sine"), Fade::kQuarterSine }, { _T("Half Sine"), Fade::kHalfSine }, }; + // Create icons for fade laws + const int cx = Util::ScalePixels(16, m_hWnd); + const int cy = Util::ScalePixels(16, m_hWnd); + m_list.Create(cx, cy, ILC_COLOR32 | ILC_MASK, 0, 1); + std::vector<COLORREF> bits; + const COLORREF col = GetSysColor(COLOR_WINDOWTEXT); for(size_t i = 0; i < CountOf(fadeLaws); i++) { - int id = combo->AddString(fadeLaws[i].name); - combo->SetItemData(id, fadeLaws[i].id); - if(fadeLaws[i].id == m_fadeLaw) combo->SetCurSel(id); + bits.assign(cx * cy, RGB(255, 0, 255)); + Fade::Func fadeFunc = Fade::GetFadeFunc(static_cast<Fade::Law>(i)); + for(int x = 0; x < cx; x++) + { + int32 val = cy - fadeFunc(cy, x, cx) - 1; + Limit(val, 0, cy - 1); + bits[x + val * cx] = col; + // Draw another pixel for fake interpolation + val = cy - fadeFunc(cy, x * 2 + 1, cx * 2) - 1; + Limit(val, 0, cy - 1); + bits[x + val * cx] = col; + } + CBitmap bitmap; + bitmap.CreateBitmap(cx, cy, 1, 32, &bits[0]); + m_list.Add(&bitmap, RGB(255, 0, 255)); + bitmap.DeleteObject(); } + m_fadeBox.SetImageList(&m_list); + // Add fade laws to list + COMBOBOXEXITEM cbi; + MemsetZero(cbi); + cbi.mask = CBEIF_IMAGE | CBEIF_SELECTEDIMAGE | CBEIF_TEXT | CBEIF_LPARAM; + for(size_t i = 0; i < CountOf(fadeLaws); i++) + { + cbi.iItem = i; + cbi.pszText = fadeLaws[i].name; + cbi.iImage = cbi.iSelectedImage = i; + cbi.lParam = fadeLaws[i].id; + m_fadeBox.InsertItem(&cbi); + if(fadeLaws[i].id == m_fadeLaw) m_fadeBox.SetCurSel(i); + } + return TRUE; } +void CAmpDlg::OnDestroy() +//----------------------- +{ + m_list.DeleteImageList(); +} + void CAmpDlg::OnOK() //------------------ { @@ -85,8 +134,7 @@ m_nFactor = static_cast<int16>(nVal); m_bFadeIn = (IsDlgButtonChecked(IDC_CHECK1) != BST_UNCHECKED); m_bFadeOut = (IsDlgButtonChecked(IDC_CHECK2) != BST_UNCHECKED); - CComboBox *combo = (CComboBox *)GetDlgItem(IDC_COMBO1); - m_fadeLaw = static_cast<Fade::Law>(combo->GetItemData(combo->GetCurSel())); + m_fadeLaw = static_cast<Fade::Law>(m_fadeBox.GetItemData(m_fadeBox.GetCurSel())); CDialog::OnOK(); } Modified: trunk/OpenMPT/mptrack/SampleEditorDialogs.h =================================================================== --- trunk/OpenMPT/mptrack/SampleEditorDialogs.h 2015-04-12 17:13:40 UTC (rev 4928) +++ trunk/OpenMPT/mptrack/SampleEditorDialogs.h 2015-04-12 21:29:56 UTC (rev 4929) @@ -28,9 +28,17 @@ int16 m_nFactor, m_nFactorMin, m_nFactorMax; bool m_bFadeIn, m_bFadeOut; +protected: + CComboBoxEx m_fadeBox; + CImageList m_list; + public: CAmpDlg(CWnd *parent, int16 factor, Fade::Law fadeLaw, int16 factorMin = int16_min, int16 factorMax = int16_max); + +protected: + virtual void DoDataExchange(CDataExchange* pDX); virtual BOOL OnInitDialog(); + virtual void OnDestroy(); virtual void OnOK(); }; Modified: trunk/OpenMPT/mptrack/mptrack.rc =================================================================== --- trunk/OpenMPT/mptrack/mptrack.rc 2015-04-12 17:13:40 UTC (rev 4928) +++ trunk/OpenMPT/mptrack/mptrack.rc 2015-04-12 21:29:56 UTC (rev 4929) @@ -1330,7 +1330,7 @@ CONTROL "",IDC_SLIDER2,"msctls_trackbar32",TBS_BOTH | TBS_NOTICKS | WS_TABSTOP,114,78,150,12 END -IDD_SAMPLE_AMPLIFY DIALOGEX 0, 0, 190, 82 +IDD_SAMPLE_AMPLIFY DIALOGEX 0, 0, 208, 82 STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_CAPTION | WS_SYSMENU CAPTION "Amplify" FONT 8, "MS Shell Dlg", 0, 0, 0x0 @@ -1339,13 +1339,13 @@ EDITTEXT IDC_EDIT1,60,18,40,14,ES_AUTOHSCROLL 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,132,6,50,14 - PUSHBUTTON "Cancel",IDCANCEL,132,24,50,14 + DEFPUSHBUTTON "OK",IDOK,150,6,50,14 + PUSHBUTTON "Cancel",IDCANCEL,150,24,50,14 CONTROL "Fade In",IDC_CHECK1,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,12,36,88,10 CONTROL "Fade Out",IDC_CHECK2,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,12,48,88,10 LTEXT "Fade Curve:",IDC_STATIC,12,62,48,8 - COMBOBOX IDC_COMBO1,60,60,60,30,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP - GROUPBOX "",IDC_STATIC,6,6,120,72 + GROUPBOX "",IDC_STATIC,6,6,138,72 + CONTROL "",IDC_COMBO1,"ComboBoxEx32",CBS_DROPDOWNLIST | CBS_SORT | WS_VSCROLL | WS_TABSTOP,60,60,78,78 END IDD_OPTIONS_AUTHOR DIALOGEX 0, 0, 214, 151 @@ -1866,7 +1866,8 @@ IDD_SAMPLE_AMPLIFY, DIALOG BEGIN - BOTTOMMARGIN, 65 + RIGHTMARGIN, 184 + BOTTOMMARGIN, 76 END IDD_OPTIONS_AUTHOR, DIALOG This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <man...@us...> - 2015-04-23 19:20:49
|
Revision: 4976 http://sourceforge.net/p/modplug/code/4976 Author: manxorist Date: 2015-04-23 19:20:43 +0000 (Thu, 23 Apr 2015) Log Message: ----------- [Ref] #ifdef-out unused and unfinished code in SampleGenerator.* that does not compile. Modified Paths: -------------- trunk/OpenMPT/mptrack/SampleGenerator.cpp trunk/OpenMPT/mptrack/SampleGenerator.h Modified: trunk/OpenMPT/mptrack/SampleGenerator.cpp =================================================================== --- trunk/OpenMPT/mptrack/SampleGenerator.cpp 2015-04-23 17:48:24 UTC (rev 4975) +++ trunk/OpenMPT/mptrack/SampleGenerator.cpp 2015-04-23 19:20:43 UTC (rev 4976) @@ -9,6 +9,9 @@ #include "stdafx.h" + +#if MPT_DISABLED_CODE + #include "SampleGenerator.h" #include "modsmp_ctrl.h" @@ -774,3 +777,5 @@ if(currentItem != 0) clist->SetCurSel(currentItem - 1); OnListSelChange(); } + +#endif // MPT_DISABLED_CODE Modified: trunk/OpenMPT/mptrack/SampleGenerator.h =================================================================== --- trunk/OpenMPT/mptrack/SampleGenerator.h 2015-04-23 17:48:24 UTC (rev 4975) +++ trunk/OpenMPT/mptrack/SampleGenerator.h 2015-04-23 19:20:43 UTC (rev 4976) @@ -10,6 +10,8 @@ #pragma once +#ifdef MPT_DISABLED_CODE + #include "mptrack.h" #include "Mainfrm.h" #include "Sndfile.h" @@ -208,3 +210,5 @@ DECLARE_MESSAGE_MAP() }; + +#endif // MPT_DISABLED_CODE This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <man...@us...> - 2015-04-24 16:44:18
|
Revision: 4983 http://sourceforge.net/p/modplug/code/4983 Author: manxorist Date: 2015-04-24 16:44:05 +0000 (Fri, 24 Apr 2015) Log Message: ----------- [Ref] Kill Util::sdOs::IsPathFileAvailable(). Member functions of mpt::PathString can do the job. Modified Paths: -------------- trunk/OpenMPT/mptrack/MPTrackUtil.cpp trunk/OpenMPT/mptrack/MPTrackUtil.h trunk/OpenMPT/mptrack/MainFrm.cpp trunk/OpenMPT/mptrack/Moddoc.cpp trunk/OpenMPT/mptrack/Mptrack.cpp trunk/OpenMPT/mptrack/SelectPluginDialog.cpp Modified: trunk/OpenMPT/mptrack/MPTrackUtil.cpp =================================================================== --- trunk/OpenMPT/mptrack/MPTrackUtil.cpp 2015-04-24 16:09:00 UTC (rev 4982) +++ trunk/OpenMPT/mptrack/MPTrackUtil.cpp 2015-04-24 16:44:05 UTC (rev 4983) @@ -69,10 +69,4 @@ } -bool Util::sdOs::IsPathFileAvailable(const mpt::PathString &pszFilePath, FileMode fm) -{ - return (_waccess(pszFilePath.AsNative().c_str(), fm) == 0); -} - - OPENMPT_NAMESPACE_END Modified: trunk/OpenMPT/mptrack/MPTrackUtil.h =================================================================== --- trunk/OpenMPT/mptrack/MPTrackUtil.h 2015-04-24 16:09:00 UTC (rev 4982) +++ trunk/OpenMPT/mptrack/MPTrackUtil.h 2015-04-24 16:44:05 UTC (rev 4983) @@ -21,14 +21,6 @@ std::string GetErrorMessage(DWORD nErrorCode); -namespace Util { namespace sdOs -{ - /// Checks whether file or folder exists and whether it has the given mode. - enum FileMode {FileModeExists = 0, FileModeRead = 4, FileModeWrite = 2, FileModeReadWrite = 6}; - bool IsPathFileAvailable(const mpt::PathString &pszFilePath, FileMode fm); - -}} // namespace Util::sdOs - namespace Util { // Get horizontal DPI resolution Modified: trunk/OpenMPT/mptrack/MainFrm.cpp =================================================================== --- trunk/OpenMPT/mptrack/MainFrm.cpp 2015-04-24 16:09:00 UTC (rev 4982) +++ trunk/OpenMPT/mptrack/MainFrm.cpp 2015-04-24 16:44:05 UTC (rev 4983) @@ -2245,13 +2245,14 @@ if (nIndex < vecFilePaths.size()) { const mpt::PathString& sPath = vecFilePaths[nIndex]; - const bool bAvailable = Util::sdOs::IsPathFileAvailable(sPath, Util::sdOs::FileModeRead); - if (bAvailable) + const bool bExists = sPath.IsFile(); + CDocument *pDoc = nullptr; + if(bExists) { - theApp.GetModDocTemplate()->OpenTemplateFile(sPath, !bTemplateFile); - } else + pDoc = theApp.GetModDocTemplate()->OpenTemplateFile(sPath, !bTemplateFile); + } + if(!pDoc) { - const bool bExists = Util::sdOs::IsPathFileAvailable(sPath, Util::sdOs::FileModeExists); Reporting::Notification(L"The file '" + sPath.ToWide() + L"' " + (bExists ? L"exists but can't be read" : L"does not exist")); } } @@ -2694,7 +2695,7 @@ mpt::PathString basePath; basePath = (i == 0) ? theApp.GetAppDirPath() : theApp.GetConfigPath(); basePath += pszFolderName; - if (Util::sdOs::IsPathFileAvailable(basePath, Util::sdOs::FileModeExists) == false) + if(!basePath.IsDirectory()) continue; mpt::PathString sPath = basePath + MPT_PATHSTRING("*"); Modified: trunk/OpenMPT/mptrack/Moddoc.cpp =================================================================== --- trunk/OpenMPT/mptrack/Moddoc.cpp 2015-04-24 16:09:00 UTC (rev 4982) +++ trunk/OpenMPT/mptrack/Moddoc.cpp 2015-04-24 16:44:05 UTC (rev 4983) @@ -2909,7 +2909,7 @@ { sName += MPT_PATHSTRING("newTemplate") + mpt::PathString::FromWide(mpt::ToWString(i)); sName += MPT_PATHSTRING(".") + mpt::PathString::FromUTF8(m_SndFile.GetModSpecifications().fileExtension); - if (!Util::sdOs::IsPathFileAvailable(templateFolder + sName, Util::sdOs::FileModeExists)) + if (!(templateFolder + sName).FileOrDirectoryExists()) break; } Modified: trunk/OpenMPT/mptrack/Mptrack.cpp =================================================================== --- trunk/OpenMPT/mptrack/Mptrack.cpp 2015-04-24 16:09:00 UTC (rev 4982) +++ trunk/OpenMPT/mptrack/Mptrack.cpp 2015-04-24 16:44:05 UTC (rev 4983) @@ -1137,7 +1137,7 @@ const mpt::PathString dirs[] = { GetConfigPath() + MPT_PATHSTRING("TemplateModules\\"), GetAppDirPath() + MPT_PATHSTRING("TemplateModules\\"), mpt::PathString() }; for(size_t i = 0; i < CountOf(dirs); i++) { - if(Util::sdOs::IsPathFileAvailable(dirs[i] + templateFile, Util::sdOs::FileModeExists)) + if((dirs[i] + templateFile).IsFile()) { if(m_pModTemplate->OpenTemplateFile(dirs[i] + templateFile) != nullptr) { Modified: trunk/OpenMPT/mptrack/SelectPluginDialog.cpp =================================================================== --- trunk/OpenMPT/mptrack/SelectPluginDialog.cpp 2015-04-24 16:09:00 UTC (rev 4982) +++ trunk/OpenMPT/mptrack/SelectPluginDialog.cpp 2015-04-24 16:44:05 UTC (rev 4983) @@ -62,8 +62,8 @@ m_pModDoc = pModDoc; m_nPlugSlot = nPlugSlot; - hasBridge32 = Util::sdOs::IsPathFileAvailable(theApp.GetAppDirPath() + MPT_PATHSTRING("PluginBridge32.exe"), Util::sdOs::FileModeExists); - hasBridge64 = Util::sdOs::IsPathFileAvailable(theApp.GetAppDirPath() + MPT_PATHSTRING("PluginBridge64.exe"), Util::sdOs::FileModeExists); + hasBridge32 = (theApp.GetAppDirPath() + MPT_PATHSTRING("PluginBridge32.exe")).IsFile(); + hasBridge64 = (theApp.GetAppDirPath() + MPT_PATHSTRING("PluginBridge64.exe")).IsFile(); if(m_pModDoc) { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <man...@us...> - 2015-04-24 18:09:43
|
Revision: 4985 http://sourceforge.net/p/modplug/code/4985 Author: manxorist Date: 2015-04-24 18:09:33 +0000 (Fri, 24 Apr 2015) Log Message: ----------- [Ref] UNICODE build support in mptrack/AboutDialog.cpp. [Ref] UNICODE build support in mptrack/WelcomeDialog.cpp. Modified Paths: -------------- trunk/OpenMPT/mptrack/AboutDialog.cpp trunk/OpenMPT/mptrack/WelcomeDialog.cpp Modified: trunk/OpenMPT/mptrack/AboutDialog.cpp =================================================================== --- trunk/OpenMPT/mptrack/AboutDialog.cpp 2015-04-24 17:31:36 UTC (rev 4984) +++ trunk/OpenMPT/mptrack/AboutDialog.cpp 2015-04-24 18:09:33 UTC (rev 4985) @@ -234,10 +234,10 @@ m_bmp.SubclassDlgItem(IDC_BITMAP1, this); - SetDlgItemText(IDC_EDIT2, CString("Build Date: ") + MptVersion::GetBuildDateString().c_str()); - SetDlgItemText(IDC_EDIT3, CString("OpenMPT ") + MptVersion::GetVersionStringExtended().c_str()); - m_static.SubclassDlgItem(IDC_CREDITS,this); - m_static.SetCredits((mpt::String::Replace(mpt::ToCharset(mpt::CharsetLocale, mpt::CharsetUTF8, MptVersion::GetFullCreditsString()), "\n", "|") + "|" + mpt::String::Replace(MptVersion::GetContactString(), "\n", "|" ) + "||||||").c_str()); + SetDlgItemText(IDC_EDIT2, mpt::ToCString(mpt::CharsetASCII, std::string("Build Date: ") + MptVersion::GetBuildDateString())); + SetDlgItemText(IDC_EDIT3, mpt::ToCString(mpt::CharsetASCII, std::string("OpenMPT ") + MptVersion::GetVersionStringExtended())); + m_static.SubclassDlgItem(IDC_CREDITS, this); + m_static.SetCredits(mpt::ToCString(mpt::CharsetUTF8, mpt::String::Replace(MptVersion::GetFullCreditsString(), "\n", "|") + "|" + mpt::String::Replace(MptVersion::GetContactString(), "\n", "|" ) + "||||||")); m_static.SetSpeed(DISPLAY_SLOW); m_static.SetColor(BACKGROUND_COLOR, RGB(138, 165, 219)); // Background Colour m_static.SetTransparent(); // Set parts of bitmaps with RGB(192,192,192) transparent Modified: trunk/OpenMPT/mptrack/WelcomeDialog.cpp =================================================================== --- trunk/OpenMPT/mptrack/WelcomeDialog.cpp 2015-04-24 17:31:36 UTC (rev 4984) +++ trunk/OpenMPT/mptrack/WelcomeDialog.cpp 2015-04-24 18:09:33 UTC (rev 4985) @@ -67,7 +67,7 @@ } if(!vstPath.empty()) { - SetDlgItemTextW(m_hWnd, IDC_EDIT1, vstPath.AsNative().c_str()); + ::SetDlgItemTextW(m_hWnd, IDC_EDIT1, vstPath.AsNative().c_str()); if(TrackerDirectories::Instance().GetDefaultDirectory(DIR_PLUGINS).empty()) { TrackerDirectories::Instance().SetDefaultDirectory(vstPath, DIR_PLUGINS); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <man...@us...> - 2015-04-24 19:41:09
|
Revision: 4988 http://sourceforge.net/p/modplug/code/4988 Author: manxorist Date: 2015-04-24 19:41:03 +0000 (Fri, 24 Apr 2015) Log Message: ----------- [Ref] UNICODE build support in mptrack/TrackerSettings.cpp. Modified Paths: -------------- trunk/OpenMPT/mptrack/TrackerSettings.cpp trunk/OpenMPT/mptrack/TrackerSettings.h Modified: trunk/OpenMPT/mptrack/TrackerSettings.cpp =================================================================== --- trunk/OpenMPT/mptrack/TrackerSettings.cpp 2015-04-24 18:53:18 UTC (rev 4987) +++ trunk/OpenMPT/mptrack/TrackerSettings.cpp 2015-04-24 19:41:03 UTC (rev 4988) @@ -295,8 +295,8 @@ { continue; } - const std::string settingKey = TrackerDirectories::Instance().m_szDirectoryToSettingsName[i]; - mpt::PathString path = conf.Read<mpt::PathString>("Paths", settingKey, TrackerDirectories::Instance().GetDefaultDirectory(static_cast<Directory>(i))); + const CString settingKey = TrackerDirectories::Instance().m_szDirectoryToSettingsName[i]; + mpt::PathString path = conf.Read<mpt::PathString>(MPT_USTRING("Paths"), mpt::ToUnicode(settingKey), TrackerDirectories::Instance().GetDefaultDirectory(static_cast<Directory>(i))); path = theApp.RelativePathToAbsolute(path); TrackerDirectories::Instance().SetDefaultDirectory(path, static_cast<Directory>(i), false); } @@ -338,8 +338,8 @@ { tm lastUpdate; MemsetZero(lastUpdate); - CString s = conf.Read<CString>("Update", "LastUpdateCheck", "1970-01-01 00:00"); - if(sscanf(s, "%04d-%02d-%02d %02d:%02d", &lastUpdate.tm_year, &lastUpdate.tm_mon, &lastUpdate.tm_mday, &lastUpdate.tm_hour, &lastUpdate.tm_min) == 5) + std::string s = conf.Read<std::string>("Update", "LastUpdateCheck", "1970-01-01 00:00"); + if(sscanf(s.c_str(), "%04d-%02d-%02d %02d:%02d", &lastUpdate.tm_year, &lastUpdate.tm_mon, &lastUpdate.tm_mday, &lastUpdate.tm_hour, &lastUpdate.tm_min) == 5) { lastUpdate.tm_year -= 1900; lastUpdate.tm_mon--; @@ -858,7 +858,7 @@ const tm* const lastUpdate = gmtime(&t); if(lastUpdate != nullptr) { - outDate.Format("%04d-%02d-%02d %02d:%02d", lastUpdate->tm_year + 1900, lastUpdate->tm_mon + 1, lastUpdate->tm_mday, lastUpdate->tm_hour, lastUpdate->tm_min); + outDate.Format(_T("%04d-%02d-%02d %02d:%02d"), lastUpdate->tm_year + 1900, lastUpdate->tm_mon + 1, lastUpdate->tm_mday, lastUpdate->tm_hour, lastUpdate->tm_min); } conf.Write<CString>("Update", "LastUpdateCheck", outDate); conf.Write<int32>("Update", "UpdateCheckPeriod", CUpdateCheck::GetUpdateCheckPeriod()); Modified: trunk/OpenMPT/mptrack/TrackerSettings.h =================================================================== --- trunk/OpenMPT/mptrack/TrackerSettings.h 2015-04-24 18:53:18 UTC (rev 4987) +++ trunk/OpenMPT/mptrack/TrackerSettings.h 2015-04-24 19:41:03 UTC (rev 4988) @@ -140,7 +140,7 @@ #endif struct PACKED EQPreset { - char szName[12]; + char szName[12]; // locale encoding UINT Gains[MAX_EQ_BANDS]; UINT Freqs[MAX_EQ_BANDS]; }; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <sag...@us...> - 2015-04-24 21:05:21
|
Revision: 4989 http://sourceforge.net/p/modplug/code/4989 Author: saga-games Date: 2015-04-24 21:05:15 +0000 (Fri, 24 Apr 2015) Log Message: ----------- [Fix] Effect visualisation could still not show up properly in some cases (http://forum.openmpt.org/index.php?topic=5476.0) [Imp] Effect visualisation window size is now remembered (also across sessions) Modified Paths: -------------- trunk/OpenMPT/mptrack/EffectVis.cpp trunk/OpenMPT/mptrack/EffectVis.h trunk/OpenMPT/mptrack/TrackerSettings.cpp trunk/OpenMPT/mptrack/TrackerSettings.h Modified: trunk/OpenMPT/mptrack/EffectVis.cpp =================================================================== --- trunk/OpenMPT/mptrack/EffectVis.cpp 2015-04-24 19:41:03 UTC (rev 4988) +++ trunk/OpenMPT/mptrack/EffectVis.cpp 2015-04-24 21:05:15 UTC (rev 4989) @@ -2,19 +2,19 @@ * EffectVis.cpp * ------------- * Purpose: Implementation of parameter visualisation dialog. - * Notes : TODO: Take DPI scaling into account. + * Notes : (currenlty none) * Authors: OpenMPT Devs * The OpenMPT source code is released under the BSD license. Read LICENSE for more details. */ #include "stdafx.h" -#include "mptrack.h" -#include "mainfrm.h" -#include "childfrm.h" -#include "moddoc.h" -#include "globals.h" -#include "view_pat.h" +#include "Mptrack.h" +#include "Mainfrm.h" +#include "Childfrm.h" +#include "Moddoc.h" +#include "Globals.h" +#include "View_pat.h" #include "EffectVis.h" @@ -24,23 +24,25 @@ // EffectVis dialog IMPLEMENT_DYNAMIC(CEffectVis, CDialog) -CEffectVis::CEffectVis(CViewPattern *pViewPattern, ROWINDEX startRow, ROWINDEX endRow, CHANNELINDEX nchn, CModDoc *pModDoc, PATTERNINDEX pat) : effectInfo(pModDoc->GetrSoundFile()) +CEffectVis::CEffectVis(CViewPattern *pViewPattern, ROWINDEX startRow, ROWINDEX endRow, CHANNELINDEX nchn, CModDoc *pModDoc, PATTERNINDEX pat) + : effectInfo(pModDoc->GetrSoundFile()) + , m_pViewPattern(pViewPattern) + , m_dwStatus(0) + , m_nDragItem(-1) + , m_forceRedraw(true) + , m_pModDoc(pModDoc) + , m_nRowToErase(-1) + , m_nParamToErase(-1) + , m_nLastDrawnRow(ROWINDEX_INVALID) + , m_nLastDrawnY(-1) + , m_nOldPlayPos(ROWINDEX_INVALID) + , m_nAction(kAction_OverwriteFX) + , m_pixelsPerRow(1) + , m_pixelsPerFXParam(1) + , m_pixelsPerPCParam(1) { - m_pViewPattern = pViewPattern; - m_dwStatus = 0x00; - m_nDragItem = -1; - m_boolForceRedraw = TRUE; - m_pModDoc = pModDoc; - - m_nRowToErase = -1; - m_nParamToErase = -1; - m_nLastDrawnRow = ROWINDEX_INVALID; - m_nLastDrawnY = -1; - m_nOldPlayPos = ROWINDEX_INVALID; m_nFillEffect = effectInfo.GetIndexFromEffect(CMD_SMOOTHMIDI, 0); - m_nAction=kAction_OverwriteFX; m_templatePCNote.Set(NOTE_PCS, 1, 0, 0); - UpdateSelection(startRow, endRow, nchn, pModDoc, pat); } @@ -333,9 +335,9 @@ //--------------------------------------------------- { MPT_UNREFERENCED_PARAMETER(rectBorder); - if (m_boolForceRedraw) + if (m_forceRedraw) { - m_boolForceRedraw = FALSE ; + m_forceRedraw = false; // if we already have a memory dc, destroy it (this occurs for a re-size) if (m_dcGrid.GetSafeHdc()) @@ -479,7 +481,16 @@ //--------------------------------------- { Create(IDD_EFFECTVISUALIZER, parent); - m_boolForceRedraw = TRUE; + m_forceRedraw = true; + + if(TrackerSettings::Instance().effectVisWidth > 0 && TrackerSettings::Instance().effectVisHeight > 0) + { + SetWindowPos(nullptr, + 0, 0, + MulDiv(TrackerSettings::Instance().effectVisWidth, Util::GetDPIx(m_hWnd), 96), MulDiv(TrackerSettings::Instance().effectVisHeight, Util::GetDPIy(m_hWnd), 96), + SWP_NOZORDER | SWP_NOMOVE); + } + ShowWindow(SW_SHOW); return TRUE; } @@ -509,6 +520,11 @@ void CEffectVis::DoClose() //------------------------ { + CRect rect; + GetWindowRect(rect); + TrackerSettings::Instance().effectVisWidth = MulDiv(rect.Width(), 96, Util::GetDPIx(m_hWnd)); + TrackerSettings::Instance().effectVisHeight = MulDiv(rect.Height(), 96, Util::GetDPIy(m_hWnd)); + m_dcGrid.SelectObject(m_pbOldGrid); m_dcGrid.DeleteDC(); m_dcNodes.SelectObject(m_pbOldNodes); @@ -557,7 +573,7 @@ m_pixelsPerRow = 1; m_pixelsPerFXParam = (float)(m_rcDraw.Height())/(float)0xFF; m_pixelsPerPCParam = (float)(m_rcDraw.Height())/(float)ModCommand::maxColumnValue; - m_boolForceRedraw = TRUE; + m_forceRedraw = true; InvalidateRect(NULL, FALSE); //redraw everything } @@ -615,7 +631,7 @@ m_pixelsPerFXParam = (float)(m_rcDraw.Height())/(float)0xFF; m_pixelsPerPCParam = (float)(m_rcDraw.Height())/(float)ModCommand::maxColumnValue; - m_boolForceRedraw = TRUE; + m_forceRedraw = true; Update(); } Modified: trunk/OpenMPT/mptrack/EffectVis.h =================================================================== --- trunk/OpenMPT/mptrack/EffectVis.h 2015-04-24 19:41:03 UTC (rev 4988) +++ trunk/OpenMPT/mptrack/EffectVis.h 2015-04-24 21:05:15 UTC (rev 4989) @@ -10,7 +10,6 @@ #pragma once -#include "afxwin.h" #include "EffectInfo.h" OPENMPT_NAMESPACE_BEGIN @@ -28,7 +27,7 @@ public: enum { - kAction_OverwriteFX=0, + kAction_OverwriteFX, kAction_FillFX, kAction_OverwritePC, kAction_FillPC, @@ -54,7 +53,6 @@ void ShowVis(CDC * pDC, CRect rectBorder); void ShowVisImage(CDC *pDC); - BOOL m_boolForceRedraw, m_boolUseBitmaps; RECT invalidated; ROWINDEX m_nLastDrawnRow; // for interpolation @@ -83,6 +81,8 @@ float m_pixelsPerRow, m_pixelsPerFXParam, m_pixelsPerPCParam; + bool m_forceRedraw : 1; + void InvalidateRow(int row); int RowToScreenX(ROWINDEX row) const; int RowToScreenY(ROWINDEX row) const; Modified: trunk/OpenMPT/mptrack/TrackerSettings.cpp =================================================================== --- trunk/OpenMPT/mptrack/TrackerSettings.cpp 2015-04-24 19:41:03 UTC (rev 4988) +++ trunk/OpenMPT/mptrack/TrackerSettings.cpp 2015-04-24 21:05:15 UTC (rev 4989) @@ -214,6 +214,8 @@ , orderlistMargins(conf, "Pattern Editor", "DefaultSequenceMargins", 0) , rowDisplayOffset(conf, "Pattern Editor", "RowDisplayOffset", 0) , patternFont(conf, "Pattern Editor", "Font", FontSetting(PATTERNFONT_SMALL, 0)) + , effectVisWidth(conf, "Pattern Editor", "EffectVisWidth", -1) + , effectVisHeight(conf, "Pattern Editor", "EffectVisHeight", -1) // Sample Editor , m_SampleUndoBufferSize(conf, "Sample Editor", "UndoBufferSize", SampleUndoBufferSize()) , sampleEditorKeyBehaviour(conf, "Sample Editor", "KeyBehaviour", seNoteOffOnNewKey) Modified: trunk/OpenMPT/mptrack/TrackerSettings.h =================================================================== --- trunk/OpenMPT/mptrack/TrackerSettings.h 2015-04-24 19:41:03 UTC (rev 4988) +++ trunk/OpenMPT/mptrack/TrackerSettings.h 2015-04-24 21:05:15 UTC (rev 4989) @@ -502,6 +502,8 @@ CachedSetting<int32> orderlistMargins; CachedSetting<int32> rowDisplayOffset; Setting<FontSetting> patternFont; + Setting<int32> effectVisWidth; + Setting<int32> effectVisHeight; // Sample Editor This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <man...@us...> - 2015-04-30 11:24:59
|
Revision: 5024 http://sourceforge.net/p/modplug/code/5024 Author: manxorist Date: 2015-04-30 11:24:53 +0000 (Thu, 30 Apr 2015) Log Message: ----------- [Ref] UNICODE build support in mptrack/CreditStatic.*. Modified Paths: -------------- trunk/OpenMPT/mptrack/CreditStatic.cpp trunk/OpenMPT/mptrack/CreditStatic.h Modified: trunk/OpenMPT/mptrack/CreditStatic.cpp =================================================================== --- trunk/OpenMPT/mptrack/CreditStatic.cpp 2015-04-30 11:23:42 UTC (rev 5023) +++ trunk/OpenMPT/mptrack/CreditStatic.cpp 2015-04-30 11:24:53 UTC (rev 5024) @@ -10,13 +10,7 @@ #include "stdafx.h" #include "CreditStatic.h" -#ifdef _DEBUG -#define new DEBUG_NEW -#undef THIS_FILE -static char THIS_FILE[] = __FILE__; -#endif - OPENMPT_NAMESPACE_BEGIN @@ -117,9 +111,9 @@ } } -void CCreditStatic::SetCredits(LPCTSTR credits,char delimiter) +void CCreditStatic::SetCredits(LPCTSTR credits,TCHAR delimiter) { - char *str,*ptr1,*ptr2; + TCHAR *str,*ptr1,*ptr2; ASSERT(credits); @@ -146,7 +140,7 @@ m_bDrawText = FALSE; } -void CCreditStatic::SetCredits(UINT nID,char delimiter) +void CCreditStatic::SetCredits(UINT nID,TCHAR delimiter) { CString credits; if(!credits.LoadString(nID)) @@ -179,7 +173,7 @@ m_TextHeights[index] = height; } -void CCreditStatic::SetEscape(UINT index, char escape) +void CCreditStatic::SetEscape(UINT index, TCHAR escape) { ASSERT(index <= DISPLAY_BITMAP); @@ -555,7 +549,7 @@ int rmcode = 0; if (!m_szWork.IsEmpty()) { - char c = m_szWork[m_szWork.GetLength()-1]; + TCHAR c = m_szWork[m_szWork.GetLength()-1]; if(c == m_Escapes[TOP_LEVEL_GROUP]) { rmcode = 1; bItalic = FALSE; @@ -568,7 +562,7 @@ CLIP_DEFAULT_PRECIS, ANTIALIASED_QUALITY, VARIABLE_PITCH | 0x04 | FF_DONTCARE, - (LPSTR)"Arial"); + _T("Arial")); memDC.SetTextColor(m_Colors[TOP_LEVEL_GROUP_COLOR]); if (pOldFont != NULL) memDC.SelectObject(pOldFont); pOldFont = memDC.SelectObject(&m_fntArial); @@ -586,7 +580,7 @@ CLIP_DEFAULT_PRECIS, ANTIALIASED_QUALITY, VARIABLE_PITCH | 0x04 | FF_DONTCARE, - (LPSTR)"Arial"); + _T("Arial")); memDC.SetTextColor(m_Colors[GROUP_TITLE_COLOR]); if (pOldFont != NULL) memDC.SelectObject(pOldFont); pOldFont = memDC.SelectObject(&m_fntArial); @@ -604,7 +598,7 @@ CLIP_DEFAULT_PRECIS, ANTIALIASED_QUALITY, VARIABLE_PITCH | 0x04 | FF_DONTCARE, - (LPSTR)"Arial"); + _T("Arial")); memDC.SetTextColor(m_Colors[TOP_LEVEL_TITLE_COLOR]); if (pOldFont != NULL) memDC.SelectObject(pOldFont); pOldFont = memDC.SelectObject(&m_fntArial); @@ -613,7 +607,7 @@ if (!m_bProcessingBitmap) { CString szBitmap = m_szWork.Left(m_szWork.GetLength()-1); - if(m_bmpWork.LoadBitmap((const char *)szBitmap)) { + if(m_bmpWork.LoadBitmap(szBitmap)) { BITMAP m_bmpInfo; m_bmpWork.GetObject(sizeof(BITMAP), &m_bmpInfo); @@ -648,7 +642,7 @@ CLIP_DEFAULT_PRECIS, ANTIALIASED_QUALITY, VARIABLE_PITCH | 0x04 | FF_DONTCARE, - (LPSTR)"Arial"); + _T("Arial")); memDC.SetTextColor(m_Colors[NORMAL_TEXT_COLOR]); if (pOldFont != NULL) memDC.SelectObject(pOldFont); pOldFont = memDC.SelectObject(&m_fntArial); @@ -679,7 +673,7 @@ } CRect r(m_ClientRect); r.top = r.bottom-m_nClip; - memDC.DrawText((const char *)m_szWork,m_szWork.GetLength()-rmcode,&r,DT_TOP|DT_CENTER| + memDC.DrawText(m_szWork,m_szWork.GetLength()-rmcode,&r,DT_TOP|DT_CENTER| DT_NOPREFIX | DT_SINGLELINE); m_bDrawText=FALSE; } @@ -754,7 +748,7 @@ CBitmap bitmap; if (!m_szWork.IsEmpty()) { - char c = m_szWork[m_szWork.GetLength()-1]; + TCHAR c = m_szWork[m_szWork.GetLength()-1]; if(c == m_Escapes[TOP_LEVEL_GROUP]) { rmcode = 1; bItalic = FALSE; @@ -767,7 +761,7 @@ CLIP_DEFAULT_PRECIS, PROOF_QUALITY, VARIABLE_PITCH | 0x04 | FF_DONTCARE, - (LPSTR)"Arial"); + _T("Arial")); memDC.SetTextColor(m_Colors[TOP_LEVEL_GROUP_COLOR]); pOldFont = memDC.SelectObject(&m_fntArial); @@ -784,7 +778,7 @@ CLIP_DEFAULT_PRECIS, PROOF_QUALITY, VARIABLE_PITCH | 0x04 | FF_DONTCARE, - (LPSTR)"Arial"); + _T("Arial")); memDC.SetTextColor(m_Colors[GROUP_TITLE_COLOR]); pOldFont = memDC.SelectObject(&m_fntArial); } @@ -801,13 +795,13 @@ CLIP_DEFAULT_PRECIS, PROOF_QUALITY, VARIABLE_PITCH | 0x04 | FF_DONTCARE, - (LPSTR)"Arial"); + _T("Arial")); memDC.SetTextColor(m_Colors[TOP_LEVEL_TITLE_COLOR]); pOldFont = memDC.SelectObject(&m_fntArial); } else if(c == m_Escapes[DISPLAY_BITMAP]) { CString szBitmap = m_szWork.Left(m_szWork.GetLength()-1); - if(bitmap.LoadBitmap((const char *)szBitmap)) { + if(bitmap.LoadBitmap(szBitmap)) { BITMAP m_bmpInfo; bitmap.GetObject(sizeof(BITMAP), &m_bmpInfo); @@ -835,7 +829,7 @@ CLIP_DEFAULT_PRECIS, PROOF_QUALITY, VARIABLE_PITCH | 0x04 | FF_DONTCARE, - (LPSTR)"Arial"); + _T("Arial")); memDC.SetTextColor(m_Colors[NORMAL_TEXT_COLOR]); pOldFont = memDC.SelectObject(&m_fntArial); } @@ -850,7 +844,7 @@ CSize size; if(m_szWork.GetLength()-rmcode != 0) { - memDC.DrawText((const char *)m_szWork,m_szWork.GetLength()-rmcode,&r,DT_TOP|DT_CENTER| + memDC.DrawText(m_szWork,m_szWork.GetLength()-rmcode,&r,DT_TOP|DT_CENTER| DT_NOPREFIX | DT_SINGLELINE); size = memDC.GetTextExtent((LPCTSTR)m_szWork,m_szWork.GetLength()-rmcode); } Modified: trunk/OpenMPT/mptrack/CreditStatic.h =================================================================== --- trunk/OpenMPT/mptrack/CreditStatic.h 2015-04-30 11:23:42 UTC (rev 5023) +++ trunk/OpenMPT/mptrack/CreditStatic.h 2015-04-30 11:24:53 UTC (rev 5024) @@ -79,12 +79,12 @@ public: BOOL StartScrolling(); void EndScrolling(); - void SetCredits(LPCTSTR credits, char delimiter = '|'); - void SetCredits(UINT nID, char delimiter = '|'); + void SetCredits(LPCTSTR credits, TCHAR delimiter = _T('|')); + void SetCredits(UINT nID, TCHAR delimiter = _T('|')); void SetSpeed(UINT index, int speed = 0); void SetColor(UINT index, COLORREF col); void SetTextHeight(UINT index, int height); - void SetEscape(UINT index, char escape); + void SetEscape(UINT index, TCHAR escape); void SetGradient(UINT value = GRADIENT_RIGHT_DARK); BOOL SetBkImage(UINT nIDResource); BOOL SetBkImage(LPCTSTR lpszResourceName); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <man...@us...> - 2015-04-30 18:11:26
|
Revision: 5028 http://sourceforge.net/p/modplug/code/5028 Author: manxorist Date: 2015-04-30 18:11:20 +0000 (Thu, 30 Apr 2015) Log Message: ----------- [Ref] UNICODE build support in mptrack/Autotune.cpp. Modified Paths: -------------- trunk/OpenMPT/mptrack/Autotune.cpp trunk/OpenMPT/mptrack/Autotune.h Modified: trunk/OpenMPT/mptrack/Autotune.cpp =================================================================== --- trunk/OpenMPT/mptrack/Autotune.cpp 2015-04-30 18:06:51 UTC (rev 5027) +++ trunk/OpenMPT/mptrack/Autotune.cpp 2015-04-30 18:11:20 UTC (rev 5028) @@ -162,10 +162,10 @@ }; -DWORD WINAPI Autotune::AutotuneThread(void *i) -//-------------------------------------------- +DWORD WINAPI Autotune::AutotuneThread(void *info_) +//------------------------------------------------ { - AutotuneThreadData &info = *static_cast<AutotuneThreadData *>(i); + AutotuneThreadData &info = *static_cast<AutotuneThreadData *>(info_); info.histogram.resize(HISTORY_BINS, 0); #ifdef ENABLE_SSE2 const bool useSSE = (GetProcSupport() & PROCSUPPORT_SSE2) != 0; @@ -360,7 +360,7 @@ m_CbnNoteBox.ResetContent(); for(int note = 0; note < 12; note++) { - const int item = m_CbnNoteBox.AddString(szNoteNames[note]); + const int item = m_CbnNoteBox.AddString(mpt::ToCString(mpt::CharsetASCII, szNoteNames[note])); m_CbnNoteBox.SetItemData(item, note); if(note == targetNote) { Modified: trunk/OpenMPT/mptrack/Autotune.h =================================================================== --- trunk/OpenMPT/mptrack/Autotune.h 2015-04-30 18:06:51 UTC (rev 5027) +++ trunk/OpenMPT/mptrack/Autotune.h 2015-04-30 18:11:20 UTC (rev 5028) @@ -53,7 +53,7 @@ bool PrepareSample(SmpLength maxShift); - static DWORD WINAPI AutotuneThread(void *i); + static DWORD WINAPI AutotuneThread(void *info); }; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <man...@us...> - 2015-04-30 18:17:45
|
Revision: 5029 http://sourceforge.net/p/modplug/code/5029 Author: manxorist Date: 2015-04-30 18:17:39 +0000 (Thu, 30 Apr 2015) Log Message: ----------- [Ref] Partial UNICODE build support in mptrack/Mptrack.cpp. Modified Paths: -------------- trunk/OpenMPT/mptrack/Mptrack.cpp trunk/OpenMPT/mptrack/Mptrack.h Modified: trunk/OpenMPT/mptrack/Mptrack.cpp =================================================================== --- trunk/OpenMPT/mptrack/Mptrack.cpp 2015-04-30 18:11:20 UTC (rev 5028) +++ trunk/OpenMPT/mptrack/Mptrack.cpp 2015-04-30 18:17:39 UTC (rev 5029) @@ -55,8 +55,8 @@ CTrackApp theApp; -const char *szSpecialNoteNamesMPT[] = {TEXT("PCs"), TEXT("PC"), TEXT("~~ (Note Fade)"), TEXT("^^ (Note Cut)"), TEXT("== (Note Off)")}; -const char *szSpecialNoteShortDesc[] = {TEXT("Param Control (Smooth)"), TEXT("Param Control"), TEXT("Note Fade"), TEXT("Note Cut"), TEXT("Note Off")}; +const TCHAR *szSpecialNoteNamesMPT[] = {_T("PCs"), _T("PC"), _T("~~ (Note Fade)"), _T("^^ (Note Cut)"), _T("== (Note Off)")}; +const TCHAR *szSpecialNoteShortDesc[] = {_T("Param Control (Smooth)"), _T("Param Control"), _T("Note Fade"), _T("Note Cut"), _T("Note Off")}; // Make sure that special note arrays include string for every note. STATIC_ASSERT(NOTE_MAX_SPECIAL - NOTE_MIN_SPECIAL + 1 == CountOf(szSpecialNoteNamesMPT)); @@ -433,7 +433,7 @@ if(filename.empty()) { const char *pszSection = (iMidi < 128) ? "Melodic Patches" : "Drum Patches"; - sprintf(section, _T("%d"), iMidi & 0x7f); + sprintf(section, "%d", iMidi & 0x7f); filename = file.Read<mpt::PathString>(pszSection, section, mpt::PathString()); if(forgetSettings) file.Forget(pszSection, section); if(filename.empty()) @@ -490,9 +490,9 @@ char s[16]; if (iMidi < 128) - sprintf(s, _T("Midi%d"), iMidi); + sprintf(s, "Midi%d", iMidi); else - sprintf(s, _T("Perc%d"), iMidi & 0x7F); + sprintf(s, "Perc%d", iMidi & 0x7F); file.Write<mpt::PathString>("Midi Library", s, szFileName); } @@ -516,7 +516,7 @@ for(size_t i = 0; i < numBanks; i++) { char s[16]; - sprintf(s, _T("Bank%d"), i + 1); + sprintf(s, "Bank%d", i + 1); mpt::PathString path = theApp.GetSettings().Read<mpt::PathString>("DLS Banks", s, mpt::PathString()); path = theApp.RelativePathToAbsolute(path); AddDLSBank(path); @@ -575,7 +575,7 @@ } char s[16]; - sprintf(s, _T("Bank%d"), nBanks + 1); + sprintf(s, "Bank%d", nBanks + 1); theApp.GetSettings().Write<mpt::PathString>("DLS Banks", s, path); nBanks++; @@ -1492,8 +1492,8 @@ } -MODPLUGDIB *LoadDib(LPCSTR lpszName) -//---------------------------------- +MODPLUGDIB *LoadDib(LPCTSTR lpszName) +//----------------------------------- { HINSTANCE hInstance = AfxGetInstanceHandle(); HRSRC hrsrc = FindResource(hInstance, lpszName, RT_BITMAP); Modified: trunk/OpenMPT/mptrack/Mptrack.h =================================================================== --- trunk/OpenMPT/mptrack/Mptrack.h 2015-04-30 18:11:20 UTC (rev 5028) +++ trunk/OpenMPT/mptrack/Mptrack.h 2015-04-30 18:17:39 UTC (rev 5029) @@ -385,7 +385,7 @@ /////////////////////////////////////////////////// // 4-bit DIB Drawing functions void DibBlt(HDC hdc, int x, int y, int sizex, int sizey, int srcx, int srcy, MODPLUGDIB *lpdib); -MODPLUGDIB *LoadDib(LPCSTR lpszName); +MODPLUGDIB *LoadDib(LPCTSTR lpszName); RGBQUAD rgb2quad(COLORREF c); // Other bitmap functions @@ -414,8 +414,8 @@ /////////////////////////////////////////////////// // Tables -extern const char *szSpecialNoteNamesMPT[]; -extern const char *szSpecialNoteShortDesc[]; +extern const TCHAR *szSpecialNoteNamesMPT[]; +extern const TCHAR *szSpecialNoteShortDesc[]; extern const char *szHexChar; // Defined in load_mid.cpp This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <man...@us...> - 2015-05-03 12:53:40
|
Revision: 5035 http://sourceforge.net/p/modplug/code/5035 Author: manxorist Date: 2015-05-03 12:53:34 +0000 (Sun, 03 May 2015) Log Message: ----------- [Ref] build: Move Win32 manifest dependency on Common Controls 6 from external manifest file to a #pragma based solution in MPTrackLink.cpp. Modified Paths: -------------- trunk/OpenMPT/mptrack/MPTrackLink.cpp trunk/OpenMPT/mptrack/res/rt_manif.bin Modified: trunk/OpenMPT/mptrack/MPTrackLink.cpp =================================================================== --- trunk/OpenMPT/mptrack/MPTrackLink.cpp 2015-05-03 08:45:14 UTC (rev 5034) +++ trunk/OpenMPT/mptrack/MPTrackLink.cpp 2015-05-03 12:53:34 UTC (rev 5035) @@ -34,6 +34,8 @@ #pragma comment(lib, "msacm32.lib") +#pragma comment( linker, "\"/manifestdependency:type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' processorArchitecture='*' publicKeyToken='6595b64144ccf1df'\"" ) + #endif // MPT_COMPILER_MSVC Modified: trunk/OpenMPT/mptrack/res/rt_manif.bin =================================================================== --- trunk/OpenMPT/mptrack/res/rt_manif.bin 2015-05-03 08:45:14 UTC (rev 5034) +++ trunk/OpenMPT/mptrack/res/rt_manif.bin 2015-05-03 12:53:34 UTC (rev 5035) @@ -8,15 +8,4 @@ type="win32" name="mptrack.exe"/> <description>OpenMPT</description> - <dependency> - <dependentAssembly> - <assemblyIdentity - type="win32" - name="Microsoft.Windows.Common-Controls" - version="6.0.0.0" - publicKeyToken="6595b64144ccf1df" - language="*" - processorArchitecture="*"/> - </dependentAssembly> - </dependency> </assembly> \ No newline at end of file This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <man...@us...> - 2015-05-04 16:56:42
|
Revision: 5044 http://sourceforge.net/p/modplug/code/5044 Author: manxorist Date: 2015-05-04 16:56:37 +0000 (Mon, 04 May 2015) Log Message: ----------- [Ref] Since r4037, the current per-device samplerate gets always propagated to the mixer samplerate when opening a sound device. I.e. the latter has no real actual meaning anymore since then. The old ASIO-specific fix to set the mixer samplerate to the ASIO device's samplerate if it had, for whatever reason, been saved to the INI as 0, is no longer useful. Remove it and always just sanitize the mixer samplerate to the default when found invalid. Revision Links: -------------- http://sourceforge.net/p/modplug/code/4037 Modified Paths: -------------- trunk/OpenMPT/mptrack/MainFrm.cpp trunk/OpenMPT/mptrack/TrackerSettings.cpp Modified: trunk/OpenMPT/mptrack/MainFrm.cpp =================================================================== --- trunk/OpenMPT/mptrack/MainFrm.cpp 2015-05-04 16:16:08 UTC (rev 5043) +++ trunk/OpenMPT/mptrack/MainFrm.cpp 2015-05-04 16:56:37 UTC (rev 5044) @@ -244,17 +244,6 @@ dev = theApp.GetSoundDevicesManager()->FindDeviceInfoBestMatch(dev, TrackerSettings::Instance().m_SoundDevicePreferSameTypeIfDeviceUnavailable).GetIdentifier(); TrackerSettings::Instance().SetSoundDeviceIdentifier(dev); } - if(TrackerSettings::Instance().MixerSamplerate == 0) - { - TrackerSettings::Instance().MixerSamplerate = MixerSettings().gdwMixingFreq; - #ifndef NO_ASIO - // If no mixing rate is specified and we're using ASIO, get a mixing rate supported by the device. - if(SoundDevice::ParseType(dev) == SoundDevice::TypeASIO) - { - TrackerSettings::Instance().MixerSamplerate = theApp.GetSoundDevicesManager()->GetDeviceDynamicCaps(dev, TrackerSettings::Instance().GetSampleRates(), CMainFrame::GetMainFrame(), CMainFrame::GetMainFrame()->gpSoundDevice).currentSampleRate; - } - #endif // NO_ASIO - } // Setup timer OnUpdateUser(NULL); Modified: trunk/OpenMPT/mptrack/TrackerSettings.cpp =================================================================== --- trunk/OpenMPT/mptrack/TrackerSettings.cpp 2015-05-04 16:16:08 UTC (rev 5043) +++ trunk/OpenMPT/mptrack/TrackerSettings.cpp 2015-05-04 16:56:37 UTC (rev 5044) @@ -486,6 +486,10 @@ { m_SoundDeviceDirectSoundOldDefaultIdentifier = true; } + if(MixerSamplerate == 0) + { + MixerSamplerate = MixerSettings().gdwMixingFreq; + } if(storedVersion < MAKE_VERSION_NUMERIC(1,21,01,26)) { MixerFlags &= ~OLD_SOUNDSETUP_REVERSESTEREO; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <sag...@us...> - 2015-05-23 15:10:20
|
Revision: 5143 http://sourceforge.net/p/modplug/code/5143 Author: saga-games Date: 2015-05-23 15:10:15 +0000 (Sat, 23 May 2015) Log Message: ----------- [Imp] Main bar: Add dropdown menus to "New" and "MIDI Record" buttons to select file type and MIDI device respectively. Modified Paths: -------------- trunk/OpenMPT/mptrack/Mainbar.cpp trunk/OpenMPT/mptrack/Mainbar.h trunk/OpenMPT/mptrack/resource.h Modified: trunk/OpenMPT/mptrack/Mainbar.cpp =================================================================== --- trunk/OpenMPT/mptrack/Mainbar.cpp 2015-05-23 11:19:36 UTC (rev 5142) +++ trunk/OpenMPT/mptrack/Mainbar.cpp 2015-05-23 15:10:15 UTC (rev 5143) @@ -223,8 +223,13 @@ }; +enum { MAX_MIDI_DEVICES = 256}; + BEGIN_MESSAGE_MAP(CMainToolBar, CToolBarEx) ON_WM_VSCROLL() + //ON_NOTIFY(TBN_DROPDOWN, OnTbnDropDownToolBar) + ON_NOTIFY_REFLECT(TBN_DROPDOWN, OnTbnDropDownToolBar) + ON_COMMAND_RANGE(ID_SELECT_MIDI_DEVICE, ID_SELECT_MIDI_DEVICE + MAX_MIDI_DEVICES, OnSelectMIDIDevice) END_MESSAGE_MAP() @@ -247,9 +252,15 @@ if (!SetButtons(MainButtons, CountOf(MainButtons))) return FALSE; CRect temp; - GetItemRect(0,&temp); + GetItemRect(0, temp); SetSizes(CSize(temp.Width(), temp.Height()), CSize(16, 16)); + // Dropdown menus for New and MIDI buttons + DWORD dwExStyle = GetToolBarCtrl().SendMessage(TB_GETEXTENDEDSTYLE) | TBSTYLE_EX_DRAWDDARROWS; + GetToolBarCtrl().SendMessage(TB_SETEXTENDEDSTYLE, 0, dwExStyle); + SetButtonStyle(CommandToIndex(ID_FILE_NEW), GetButtonStyle(CommandToIndex(ID_FILE_NEW)) | TBSTYLE_DROPDOWN); + SetButtonStyle(CommandToIndex(ID_MIDI_RECORD), GetButtonStyle(CommandToIndex(ID_MIDI_RECORD)) | TBSTYLE_DROPDOWN); + nCurrentSpeed = 6; nCurrentTempo = 125; nCurrentRowsPerBeat = 4; @@ -574,6 +585,51 @@ } +void CMainToolBar::OnTbnDropDownToolBar(NMHDR *pNMHDR, LRESULT *pResult) +//---------------------------------------------------------------------- +{ + NMTOOLBAR *pToolBar = reinterpret_cast<NMTOOLBAR *>(pNMHDR); + ClientToScreen(&(pToolBar->rcButton)); + + switch(pToolBar->iItem) + { + case ID_FILE_NEW: + CMainFrame::GetMainFrame()->GetFileMenu()->GetSubMenu(0)->TrackPopupMenu(TPM_LEFTALIGN | TPM_RIGHTBUTTON, pToolBar->rcButton.left, pToolBar->rcButton.bottom, this); + break; + case ID_MIDI_RECORD: + // Show a list of MIDI devices + { + HMENU hMenu = ::CreatePopupMenu(); + MIDIINCAPS mic; + UINT ndevs = midiInGetNumDevs(); + UINT current = TrackerSettings::Instance().m_nMidiDevice; + for(UINT i = 0; i < ndevs; i++) + { + mic.szPname[0] = 0; + if(midiInGetDevCaps(i, &mic, sizeof(mic)) == MMSYSERR_NOERROR) + { + ::AppendMenu(hMenu, MF_STRING | (i == current ? MF_CHECKED : 0), ID_SELECT_MIDI_DEVICE + i, mic.szPname); + } + } + ::TrackPopupMenu(hMenu, TPM_LEFTALIGN | TPM_RIGHTBUTTON, pToolBar->rcButton.left, pToolBar->rcButton.bottom, 0, m_hWnd, NULL); + ::DestroyMenu(hMenu); + } + break; + } + + *pResult = 0; +} + + +void CMainToolBar::OnSelectMIDIDevice(UINT id) +//-------------------------------------------- +{ + CMainFrame::GetMainFrame()->midiCloseDevice(); + TrackerSettings::Instance().m_nMidiDevice = id - ID_SELECT_MIDI_DEVICE; + CMainFrame::GetMainFrame()->midiOpenDevice(); +} + + void CMainToolBar::SetRowsPerBeat(ROWINDEX nNewRPB) //------------------------------------------------- { Modified: trunk/OpenMPT/mptrack/Mainbar.h =================================================================== --- trunk/OpenMPT/mptrack/Mainbar.h 2015-05-23 11:19:36 UTC (rev 5142) +++ trunk/OpenMPT/mptrack/Mainbar.h 2015-05-23 15:10:15 UTC (rev 5143) @@ -109,6 +109,8 @@ protected: //{{AFX_MSG(CMainToolBar) afx_msg void OnVScroll(UINT, UINT, CScrollBar *); + afx_msg void OnTbnDropDownToolBar(NMHDR* pNMHDR, LRESULT* pResult); + afx_msg void OnSelectMIDIDevice(UINT id); //}}AFX_MSG DECLARE_MESSAGE_MAP() }; Modified: trunk/OpenMPT/mptrack/resource.h =================================================================== --- trunk/OpenMPT/mptrack/resource.h 2015-05-23 11:19:36 UTC (rev 5142) +++ trunk/OpenMPT/mptrack/resource.h 2015-05-23 15:10:15 UTC (rev 5143) @@ -1107,6 +1107,8 @@ // 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_SELECT_MIDI_DEVICE 33000 +// From here: Command range [ID_SELECT_MIDI_DEVICE, ID_SELECT_MIDI_DEVICE + MAX_MIDI_DEVICES] #define ID_EDIT_SPLITRECSELECT 33900 #define ID_REARRANGE_SAMPLES 33901 #define ID_CHANNEL_MANAGER 33905 This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <sag...@us...> - 2015-05-24 01:12:54
|
Revision: 5151 http://sourceforge.net/p/modplug/code/5151 Author: saga-games Date: 2015-05-24 01:12:47 +0000 (Sun, 24 May 2015) Log Message: ----------- [Mod] Tuning dialog: Remove unnecessary clutter which was mostly there for debugging purposes [Imp] Tuning dialog: Mouse wheel can now be used to scroll the tuning note map. Modified Paths: -------------- trunk/OpenMPT/mptrack/TuningDialog.cpp trunk/OpenMPT/mptrack/TuningDialog.h trunk/OpenMPT/mptrack/mptrack.rc trunk/OpenMPT/mptrack/resource.h trunk/OpenMPT/mptrack/tuningRatioMapWnd.cpp trunk/OpenMPT/mptrack/tuningRatioMapWnd.h Modified: trunk/OpenMPT/mptrack/TuningDialog.cpp =================================================================== --- trunk/OpenMPT/mptrack/TuningDialog.cpp 2015-05-24 00:41:16 UTC (rev 5150) +++ trunk/OpenMPT/mptrack/TuningDialog.cpp 2015-05-24 01:12:47 UTC (rev 5151) @@ -117,10 +117,10 @@ HTREEITEM nextitem = m_TreeCtrlTuning.GetNextItem(temp, TVGN_NEXT); if(!nextitem) nextitem = m_TreeCtrlTuning.GetNextItem(temp, TVGN_PREVIOUS); m_pActiveTuning = m_TreeItemTuningItemMap.GetMapping_12(nextitem).GetT(); - m_TreeCtrlTuning.DeleteItem(temp); - //Note: Item from map is deleted 'automatically' in + m_TreeCtrlTuning.DeleteItem(temp); + //Note: Item from map is deleted 'automatically' in //OnTvnDeleteitemTreeTuning. - + } } @@ -143,7 +143,7 @@ pTCnext = GetpTuningCollection(nextTTI.GetT()); if(pTCprev == NULL) pTCprev = GetpTuningCollection(prevTTI.GetT()); - + if(pTCnext != NULL && pTCnext != m_pActiveTuningCollection) m_pActiveTuningCollection = pTCnext; else @@ -153,9 +153,9 @@ else m_pActiveTuningCollection = NULL; } - + m_TreeCtrlTuning.DeleteItem(temp); - //Note: Item from map is deleted 'automatically' in + //Note: Item from map is deleted 'automatically' in //OnTvnDeleteitemTreeTuning. } else @@ -192,11 +192,6 @@ m_ButtonSet.EnableWindow(FALSE); - //#ifdef DEBUG - m_EditTuningCollectionVersion.ShowWindow(SW_SHOW); - m_EditTuningCollectionEditMask.ShowWindow(SW_SHOW); - //#endif - m_EditSteps.SetLimitText(2); m_EditFineTuneSteps.SetLimitText(3); @@ -217,7 +212,7 @@ return; } - //-->Updating treeview + //-->Updating treeview if(updateMask != UM_TUNINGDATA) { TUNINGTREEITEM tuningitem; @@ -236,11 +231,11 @@ m_TreeCtrlTuning.SetItemText(treeitem, m_pActiveTuning->GetName().c_str()); else m_TreeCtrlTuning.SetItemText(treeitem, m_pActiveTuningCollection->GetName().c_str()); - } + } } //<--Updating treeview - + if(m_pActiveTuningCollection == NULL) { return; @@ -250,9 +245,9 @@ if(updateMask == 0 || updateMask & UM_TUNINGCOLLECTION) { m_EditTuningCollectionName.SetWindowText(m_pActiveTuningCollection->GetName().c_str()); - m_EditTuningCollectionVersion.SetWindowText(m_pActiveTuningCollection->GetVersionString().c_str()); - m_EditTuningCollectionEditMask.SetWindowText(m_pActiveTuningCollection->GetEditMaskString().c_str()); - m_EditTuningCollectionItemNum.SetWindowText(mpt::ToString(m_pActiveTuningCollection->GetNumTunings()).c_str()); + //m_EditTuningCollectionVersion.SetWindowText(m_pActiveTuningCollection->GetVersionString().c_str()); + //m_EditTuningCollectionEditMask.SetWindowText(m_pActiveTuningCollection->GetEditMaskString().c_str()); + //m_EditTuningCollectionItemNum.SetWindowText(mpt::ToString(m_pActiveTuningCollection->GetNumTunings()).c_str()); ::SetWindowTextW(m_EditTuningCollectionPath.m_hWnd, m_pActiveTuningCollection->GetSaveFilePath().ToWide().c_str()); } //<-- Updating tuning collection part @@ -323,14 +318,14 @@ m_EditMiscActions.SetReadOnly(!enableControls); m_EditFineTuneSteps.SetReadOnly(!enableControls); m_EditName.SetReadOnly(!enableControls); - + m_ButtonSet.EnableWindow(enableControls); m_CombobTuningType.Invalidate(); m_EditSteps.Invalidate(); m_EditRatioPeriod.Invalidate(); } - else + else { if(m_pActiveTuning == NULL) //No active tuning, clearing tuning part. { @@ -377,9 +372,6 @@ DDX_Control(pDX, IDC_EDIT_NAME, m_EditName); DDX_Control(pDX, IDC_TREE_TUNING, m_TreeCtrlTuning); DDX_Control(pDX, IDC_EDIT_TUNINGCOLLECTION_NAME, m_EditTuningCollectionName); - DDX_Control(pDX, IDC_EDIT_TUNINGC_VERSION, m_EditTuningCollectionVersion); - DDX_Control(pDX, IDC_EDIT_TUNINGC_EDITMASK, m_EditTuningCollectionEditMask); - DDX_Control(pDX, IDC_EDIT_TUNINGNUM, m_EditTuningCollectionItemNum); DDX_Control(pDX, IDC_EDIT_TUNINGCOLLECTION_PATH, m_EditTuningCollectionPath); } @@ -488,7 +480,7 @@ else if(newType == TT_GEOMETRIC) m_pActiveTuning->CreateGeometric(steps, pr); - + UpdateView(UM_TUNINGDATA); } else //Not wanting to discard current values. @@ -500,7 +492,7 @@ { if(oldType == TT_GROUPGEOMETRIC) m_CombobTuningType.SetCurSel(1); - else + else m_CombobTuningType.SetCurSel(0); } } @@ -524,7 +516,7 @@ void CTuningDialog::OnEnChangeEditNotename() //------------------------------------------ { - + if(!m_NoteEditApply) { m_NoteEditApply = true; @@ -550,13 +542,13 @@ m_ModifiedTCs[GetpTuningCollection(m_pActiveTuning)] = true; m_RatioMapWnd.Invalidate(); - + } void CTuningDialog::OnEnChangeEditRatiovalue() //-------------------------------------------- { - + if(!m_RatioEditApply) { m_RatioEditApply = true; @@ -579,7 +571,7 @@ UpdateTuningType(); m_RatioMapWnd.Invalidate(); } - + } void CTuningDialog::OnBnClickedButtonSetvalues() @@ -619,7 +611,7 @@ void CTuningDialog::OnBnClickedButtonExport() //------------------------------------------- -{ +{ const CTuning* pT = m_pActiveTuning; const CTuningCollection* pTC = m_pActiveTuningCollection; @@ -628,7 +620,7 @@ MsgBox(IDS_ERR_NO_TUNING_SELECTION, this, NULL, MB_ICONINFORMATION); return; } - + std::string filter; if(pT != NULL) filter = std::string("Tuning files (*") + CTuning::s_FileExtension + std::string(")|*") + CTuning::s_FileExtension + std::string("|"); @@ -646,7 +638,7 @@ BeginWaitCursor(); bool failure = true; - + mpt::ofstream fout(dlg.GetFirstFile(), std::ios::binary); if(filterIndex == 0) @@ -662,7 +654,7 @@ fout.close(); EndWaitCursor(); - + if(failure) ErrorBox(IDS_ERR_EXPORT_TUNING, this); } @@ -699,7 +691,7 @@ const bool bIsTun = (mpt::PathString::CompareNoCase(fileExt, mpt::PathString::FromUTF8(CTuning::s_FileExtension)) == 0); const bool bIsScl = (mpt::PathString::CompareNoCase(fileExt, MPT_PATHSTRING(".scl")) == 0); - + if (bIsTun || bIsScl) { CTuning* pT = nullptr; @@ -746,7 +738,7 @@ else // scl import successful. pT = &m_TempTunings.GetTuning(m_TempTunings.GetNumTunings() - 1); } - + if (pT) { m_pActiveTuning = pT; @@ -755,15 +747,15 @@ } else if(mpt::PathString::CompareNoCase(fileExt, mpt::PathString::FromUTF8(CTuningCollection::s_FileExtension)) == 0) { - // For now only loading tuning collection as - // a separate collection - no possibility to + // For now only loading tuning collection as + // a separate collection - no possibility to // directly replace some collection. CTuningCollection* pNewTCol = new CTuningCollection; pNewTCol->SetSavefilePath(files[counter]); if (pNewTCol->Deserialize()) { delete pNewTCol; pNewTCol = 0; - sLoadReport += L"-Unable to import tuning collection \"" + fileNameExt + L"\": unrecognized file.\n"; + sLoadReport += L"-Unable to import tuning collection \"" + fileNameExt + L"\": unrecognized file.\n"; } else { @@ -774,7 +766,7 @@ } else // Case: Unknown extension (should not happen). { - sLoadReport += L"-Unable to load \"" + fileNameExt + L"\": unrecognized file extension.\n"; + sLoadReport += L"-Unable to load \"" + fileNameExt + L"\": unrecognized file extension.\n"; } } if(sLoadReport.length() > 0) @@ -855,7 +847,7 @@ m_pActiveTuning->ChangeGroupsize(ConvertStrTo<UNOTEINDEXTYPE>(buffer)); m_ModifiedTCs[GetpTuningCollection(m_pActiveTuning)] = true; UpdateView(UM_TUNINGDATA); - } + } } @@ -894,7 +886,7 @@ return (*iter).second; else return false; - + } CTuningCollection* CTuningDialog::GetpTuningCollection(HTREEITEM ti) const @@ -944,7 +936,7 @@ LPNMTREEVIEW pNMTreeView = reinterpret_cast<LPNMTREEVIEW>(pNMHDR); TUNINGTREEITEM ti = m_TreeItemTuningItemMap.GetMapping_12(pNMTreeView->itemNew.hItem); - + if(ti) { int updateMask = UM_TUNINGDATA; @@ -961,7 +953,7 @@ { m_pActiveTuning = pT; m_pActiveTuningCollection = GetpTuningCollection(m_pActiveTuning); - + } if(m_pActiveTuningCollection != pPrevTuningCollection) updateMask |= UM_TUNINGCOLLECTION; UpdateView(updateMask); @@ -1064,7 +1056,7 @@ std::vector<CTuningCollection*>::const_iterator iter = find(m_DeletableTuningCollections.begin(), m_DeletableTuningCollections.end(), pTC); if(iter != m_DeletableTuningCollections.end()) return true; - else + else return false; } @@ -1108,7 +1100,7 @@ CTuningCollection* pTCdest = NULL; CTuningCollection* pTCsrc = m_CommandItemSrc.GetTC(); - + if(pTCsrc == NULL) pTCsrc = GetpTuningCollection(m_CommandItemSrc.GetT()); @@ -1124,9 +1116,9 @@ pTCdest = destTunItem.GetTC(); //For now, ignoring drags within a tuning collection. - if(pTCdest == pTCsrc) + if(pTCdest == pTCsrc) return; - + if(pTCdest) { UINT mask = MF_STRING; @@ -1238,7 +1230,7 @@ m_CommandItemDest = s_notFoundItemTuning; return; } - + CTuningCollection* pTCdest = NULL; if(m_CommandItemDest.GetT()) pTCdest = GetpTuningCollection(m_CommandItemDest.GetT()); @@ -1270,7 +1262,7 @@ if(!pTC) return; - + m_CommandItemDest = s_notFoundItemTuning; CTuning* pT = m_CommandItemSrc.GetT(); @@ -1307,7 +1299,7 @@ m_TuningCollections.erase(iter); DeleteTreeItem(m_pActiveTuningCollection); delete deletableTC; deletableTC = 0; - + UpdateView(); } @@ -1386,8 +1378,8 @@ HTREEITEM hItem; hItem = HitTest(point, NULL); m_rParentDialog.OnEndDrag(hItem); - - CTreeCtrl::OnLButtonUp(nFlags, point); + + CTreeCtrl::OnLButtonUp(nFlags, point); } } @@ -1404,25 +1396,25 @@ //---------------------------------------------------------- { CString sMsg; - switch(id) - { - case enSclImportFailTooManyNotes: + switch(id) + { + case enSclImportFailTooManyNotes: AfxFormatString1(sMsg, IDS_SCL_IMPORT_FAIL_8, mpt::ToString(s_nSclImportMaxNoteCount).c_str()); return sMsg; - - case enSclImportFailTooLargeNumDenomIntegers: + + case enSclImportFailTooLargeNumDenomIntegers: sMsg.LoadString(IDS_SCL_IMPORT_FAIL_1); return sMsg; - - case enSclImportFailZeroDenominator: + + case enSclImportFailZeroDenominator: sMsg.LoadString(IDS_SCL_IMPORT_FAIL_2); return sMsg; - - case enSclImportFailNegativeRatio: + + case enSclImportFailNegativeRatio: sMsg.LoadString(IDS_SCL_IMPORT_FAIL_3); return sMsg; - - case enSclImportFailUnableToOpenFile: + + case enSclImportFailUnableToOpenFile: sMsg.LoadString(IDS_SCL_IMPORT_FAIL_4); return sMsg; - - case enSclImportLineCountMismatch: + + case enSclImportLineCountMismatch: sMsg.LoadString(IDS_SCL_IMPORT_FAIL_5); return sMsg; case enSclImportTuningCreationFailure: @@ -1430,32 +1422,32 @@ case enSclImportAddTuningFailure: sMsg.LoadString(IDS_SCL_IMPORT_FAIL_7); return sMsg; - - default: - return sMsg; - } + + default: + return sMsg; + } } static void SkipCommentLines(std::istream& iStrm, std::string& str) //----------------------------------------------------------------- { - while(std::getline(iStrm, str)) - { - LPCSTR psz = str.c_str(); - for(; *psz != 0; psz++) - { - if (*psz == ' ' || *psz == '\t') - continue; - else - { - if (*psz != '!') - return; - else // Found comment line: break for loop and get another line. - break; - } - } - } + while(std::getline(iStrm, str)) + { + LPCSTR psz = str.c_str(); + for(; *psz != 0; psz++) + { + if (*psz == ' ' || *psz == '\t') + continue; + else + { + if (*psz != '!') + return; + else // Found comment line: break for loop and get another line. + break; + } + } + } } @@ -1520,12 +1512,12 @@ } if (*pNonDigit == '.') // Reading cents - { + { SclFloat fCent = ConvertStrTo<SclFloat>(psz); fRatios.push_back(static_cast<CTuningRTI::RATIOTYPE>(CentToRatio(fCent))); } else if (*pNonDigit == '/') // Reading ratios - { + { *pNonDigit = 0; // Replace '/' with null. int64 nNum = ConvertStrTo<int64>(psz); psz = pNonDigit + 1; @@ -1570,4 +1562,4 @@ } -OPENMPT_NAMESPACE_END +OPENMPT_NAMESPACE_END \ No newline at end of file Modified: trunk/OpenMPT/mptrack/TuningDialog.h =================================================================== --- trunk/OpenMPT/mptrack/TuningDialog.h 2015-05-24 00:41:16 UTC (rev 5150) +++ trunk/OpenMPT/mptrack/TuningDialog.h 2015-05-24 01:12:47 UTC (rev 5151) @@ -92,7 +92,7 @@ } private: - //Elements are collected to two arrays so that elements with the + //Elements are collected to two arrays so that elements with the //same index are mapped to each other. std::vector<T1> m_T1; std::vector<T2> m_T2; @@ -120,13 +120,13 @@ bool m_Dragging; afx_msg void OnLButtonUp(UINT nFlags, CPoint point); - DECLARE_MESSAGE_MAP() + DECLARE_MESSAGE_MAP() }; //=================== class CTuningTreeItem //=================== -{ +{ private: CTuning* m_pTuning; CTuningCollection* m_pTuningCollection; @@ -136,12 +136,12 @@ m_pTuningCollection(NULL) {} - CTuningTreeItem(CTuning* pT) : + CTuningTreeItem(CTuning* pT) : m_pTuning(pT), m_pTuningCollection(NULL) {} - CTuningTreeItem(CTuningCollection* pTC) : + CTuningTreeItem(CTuningCollection* pTC) : m_pTuning(NULL), m_pTuningCollection(pTC) {} @@ -156,8 +156,8 @@ } void Reset() {m_pTuning = NULL; m_pTuningCollection = NULL;} - + void Set(CTuning* pT) { m_pTuning = pT; @@ -176,8 +176,8 @@ //if(CTuningTreeItemInstance.m_pTuning != NULL || // CTuningTreeItemInstance.m_pTuningCollection != NULL) if(m_pTuning) - return m_pTuning; - else + return m_pTuning; + else return m_pTuningCollection; } @@ -248,19 +248,19 @@ //Returns pointer to the tuning collection where tuning given as argument //belongs to. CTuningCollection* GetpTuningCollection(const CTuning* const) const; - + //Returns the address of corresponding tuningcollection; if it points //to tuning-entry, returning the owning tuningcollection CTuningCollection* GetpTuningCollection(HTREEITEM ti) const; - + //Checks whether tuning collection can be deleted. bool IsDeletable(const CTuningCollection* const pTC) const; // Scl-file import. EnSclImport ImportScl(const mpt::PathString &filename, const mpt::ustring &name); EnSclImport ImportScl(std::istream& iStrm, const mpt::ustring &name); - + private: CTuningRatioMapWnd m_RatioMapWnd; TUNINGVECTOR m_TuningCollections; @@ -285,12 +285,9 @@ //-->Tuning collection edits CEdit m_EditTuningCollectionName; - CEdit m_EditTuningCollectionVersion; - CEdit m_EditTuningCollectionEditMask; - CEdit m_EditTuningCollectionItemNum; CEdit m_EditTuningCollectionPath; //<--Tuningcollection edits - + CButton m_ButtonSet; CButton m_ButtonExport; CButton m_ButtonImport; @@ -307,7 +304,7 @@ TUNINGTREEITEM m_CommandItemSrc; TUNINGTREEITEM m_CommandItemDest; //Commanditem is used when receiving context menu-commands, - //m_CommandItemDest is used when the command really need only + //m_CommandItemDest is used when the command really need only //one argument. typedef std::map<const CTuningCollection* const, bool> MODIFIED_MAP; @@ -324,13 +321,13 @@ static CString GetSclImportFailureMsg(EnSclImport); static const size_t s_nSclImportMaxNoteCount = 64; - //To indicate whether to apply changes made to - //those edit boxes(they are modified by certain activities + //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; - + enum { UM_TUNINGDATA = 1, //UM <-> Update Mask @@ -344,7 +341,7 @@ //Flag to prevent multiple exit error-messages. bool m_DoErrorExit; - + void DoErrorExit(); virtual void OnOK(); @@ -356,7 +353,7 @@ afx_msg void OnMoveTuning(); afx_msg void OnCopyTuning(); afx_msg void OnRemoveTuningCollection(); - + //Event-functions public: afx_msg void OnCbnSelchangeComboTtype(); @@ -381,9 +378,9 @@ afx_msg void OnTvnSelchangedTreeTuning(NMHDR *pNMHDR, LRESULT *pResult); afx_msg void OnTvnDeleteitemTreeTuning(NMHDR *pNMHDR, LRESULT *pResult); afx_msg void OnNMRclickTreeTuning(NMHDR *pNMHDR, LRESULT *pResult); - afx_msg void OnTvnBegindragTreeTuning(NMHDR *pNMHDR, LRESULT *pResult); + afx_msg void OnTvnBegindragTreeTuning(NMHDR *pNMHDR, LRESULT *pResult); DECLARE_MESSAGE_MAP() }; -OPENMPT_NAMESPACE_END +OPENMPT_NAMESPACE_END \ No newline at end of file Modified: trunk/OpenMPT/mptrack/mptrack.rc =================================================================== --- trunk/OpenMPT/mptrack/mptrack.rc 2015-05-24 00:41:16 UTC (rev 5150) +++ trunk/OpenMPT/mptrack/mptrack.rc 2015-05-24 01:12:47 UTC (rev 5151) @@ -2657,9 +2657,9 @@ CAPTION "Tuning Properties" FONT 8, "MS Shell Dlg", 400, 0, 0x1 BEGIN - DEFPUSHBUTTON "Close",IDOK,456,12,48,14 - PUSHBUTTON "Import",IDC_BUTTON_IMPORT,456,30,48,14 - PUSHBUTTON "Export",IDC_BUTTON_EXPORT,456,48,48,14 + DEFPUSHBUTTON "Close",IDOK,456,10,48,14 + PUSHBUTTON "Import",IDC_BUTTON_IMPORT,456,28,48,14 + PUSHBUTTON "Export",IDC_BUTTON_EXPORT,456,46,48,14 CONTROL "",IDC_TREE_TUNING,"SysTreeView32",TVS_HASBUTTONS | TVS_HASLINES | TVS_SHOWSELALWAYS | WS_BORDER | WS_HSCROLL | WS_TABSTOP,6,6,96,222 CONTROL "Read Only",IDC_CHECK_READONLY,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,113,77,199,12 LTEXT "Name:",IDC_STATIC,114,96,53,11 @@ -2683,16 +2683,10 @@ CONTROL "",IDC_STATICRATIOMAP,"Static",SS_GRAYRECT | SS_NOTIFY | WS_TABSTOP,324,78,168,138,WS_EX_CLIENTEDGE GROUPBOX "Tuning Editor",IDC_STATIC,108,66,395,162 LTEXT "Name:",IDC_STATIC,114,19,35,9,SS_CENTERIMAGE - EDITTEXT IDC_EDIT_TUNINGCOLLECTION_NAME,162,18,84,12,ES_AUTOHSCROLL | ES_READONLY - LTEXT "File Path: ",IDC_STATIC,252,18,31,12,SS_CENTERIMAGE - EDITTEXT IDC_EDIT_TUNINGCOLLECTION_PATH,288,18,120,12,ES_AUTOHSCROLL | ES_READONLY - PUSHBUTTON "Save",IDC_BUTTON_TUNINGCOLLECTION_SAVE,414,18,30,12 - LTEXT "Number of tunings:",IDC_STATIC,114,36,72,11,SS_CENTERIMAGE - EDITTEXT IDC_EDIT_TUNINGNUM,186,36,60,13,ES_AUTOHSCROLL | ES_READONLY - LTEXT "Version:",IDC_STATIC,252,37,35,9,SS_CENTERIMAGE - EDITTEXT IDC_EDIT_TUNINGC_VERSION,288,36,30,13,ES_AUTOHSCROLL | ES_READONLY | NOT WS_VISIBLE - LTEXT "Edit Mask:",IDC_STATIC,324,38,35,8,SS_CENTERIMAGE - EDITTEXT IDC_EDIT_TUNINGC_EDITMASK,366,36,78,12,ES_AUTOHSCROLL | ES_READONLY | NOT WS_VISIBLE + EDITTEXT IDC_EDIT_TUNINGCOLLECTION_NAME,162,18,282,12,ES_AUTOHSCROLL | ES_READONLY + LTEXT "File Path: ",IDC_STATIC,114,36,31,12,SS_CENTERIMAGE + EDITTEXT IDC_EDIT_TUNINGCOLLECTION_PATH,162,36,240,12,ES_AUTOHSCROLL | ES_READONLY + PUSHBUTTON "Save",IDC_BUTTON_TUNINGCOLLECTION_SAVE,408,36,36,12 GROUPBOX "Tuning Collection",IDC_STATIC,108,6,342,54 END Modified: trunk/OpenMPT/mptrack/resource.h =================================================================== --- trunk/OpenMPT/mptrack/resource.h 2015-05-24 00:41:16 UTC (rev 5150) +++ trunk/OpenMPT/mptrack/resource.h 2015-05-24 01:12:47 UTC (rev 5151) @@ -778,10 +778,6 @@ #define IDC_EDIT_MISC_ACTIONS 2284 #define IDC_BUTTON_TUNINGCOLLECTION_SAVE 2285 #define IDC_EDIT_TUNINGCOLLECTION_PATH 2286 -#define IDC_EDIT_TUNINGC_EDITMASK 2287 -#define IDC_EDIT_TUNINGNUM 2288 -#define IDC_EDIT_TUNINGC_VERSION 2289 -#define IDC_EDIT_TUNINGCVERSION 2290 #define IDC_EDIT_TUNINGCOLLECTION_NAME 2291 #define IDC_TREE_TUNING 2292 #define IDC_PATTERN_FOLLOWSONG 2293 Modified: trunk/OpenMPT/mptrack/tuningRatioMapWnd.cpp =================================================================== --- trunk/OpenMPT/mptrack/tuningRatioMapWnd.cpp 2015-05-24 00:41:16 UTC (rev 5150) +++ trunk/OpenMPT/mptrack/tuningRatioMapWnd.cpp 2015-05-24 01:12:47 UTC (rev 5151) @@ -24,6 +24,7 @@ ON_WM_SETFOCUS() ON_WM_KILLFOCUS() ON_WM_LBUTTONDOWN() + ON_WM_MOUSEWHEEL() END_MESSAGE_MAP() @@ -68,14 +69,14 @@ NOTEINDEXTYPE nPos = m_nNote - (nNotes/2); int ypaint = 0; - + for (int ynote=0; ynote<nNotes; ynote++, ypaint+=m_cyFont, nPos++) { BOOL bHighLight; // Note NOTEINDEXTYPE noteToDraw = nPos - m_nNoteCentre; s[0] = 0; - + const bool isValidNote = m_pTuning->IsValidNote(noteToDraw); std::string temp; if(isValidNote) @@ -87,8 +88,8 @@ wsprintf(s, "%s", temp.c_str()); else wsprintf(s, "%s", "..."); - + rect.SetRect(0, ypaint, m_cxFont, ypaint+m_cyFont); DrawButtonRect(hdc, &rect, s, FALSE, FALSE); // Mapped Note @@ -111,7 +112,7 @@ DrawButtonRect(hdc, &rect, "", FALSE, FALSE); if (ypaint < rcClient.bottom) { - rect.SetRect(rcClient.left, ypaint, rcClient.right, rcClient.bottom); + rect.SetRect(rcClient.left, ypaint, rcClient.right, rcClient.bottom); FillRect(hdc, &rect, CMainFrame::brushGray); } } @@ -133,16 +134,36 @@ InvalidateRect(NULL, FALSE); } + +BOOL CTuningRatioMapWnd::OnMouseWheel(UINT nFlags, short zDelta, CPoint pt) +//------------------------------------------------------------------------- +{ + NOTEINDEXTYPE note = static_cast<NOTEINDEXTYPE>(m_nNote - sgn(zDelta)); + if(m_pTuning->IsValidNote(note - m_nNoteCentre)) + { + m_nNote = note; + InvalidateRect(NULL, FALSE); + if(m_pParent) + m_pParent->UpdateRatioMapEdits(GetShownCentre()); + } + + return CWnd::OnMouseWheel(nFlags, zDelta, pt); +} + + void CTuningRatioMapWnd::OnLButtonDown(UINT, CPoint pt) -//---------------------------------------------- +//----------------------------------------------------- { - if ((pt.x >= m_cxFont) && (pt.x < m_cxFont*2)) { + if ((pt.x >= m_cxFont) && (pt.x < m_cxFont*2)) + { InvalidateRect(NULL, FALSE); } - if ((pt.x > m_cxFont*2) && (pt.x <= m_cxFont*3)) { + if ((pt.x > m_cxFont*2) && (pt.x <= m_cxFont*3)) + { InvalidateRect(NULL, FALSE); } - if ((pt.x >= 0) && (m_cyFont)) { + if ((pt.x >= 0) && (m_cyFont)) + { CRect rcClient; GetClientRect(&rcClient); int nNotes = (rcClient.bottom + m_cyFont - 1) / m_cyFont; @@ -155,7 +176,7 @@ if(m_pParent) m_pParent->UpdateRatioMapEdits(GetShownCentre()); } - + } SetFocus(); } @@ -163,10 +184,10 @@ NOTEINDEXTYPE CTuningRatioMapWnd::GetShownCentre() const -//-------------------------------------- +//------------------------------------------------------ { return m_nNote - m_nNoteCentre; } -OPENMPT_NAMESPACE_END +OPENMPT_NAMESPACE_END \ No newline at end of file Modified: trunk/OpenMPT/mptrack/tuningRatioMapWnd.h =================================================================== --- trunk/OpenMPT/mptrack/tuningRatioMapWnd.h 2015-05-24 00:41:16 UTC (rev 5150) +++ trunk/OpenMPT/mptrack/tuningRatioMapWnd.h 2015-05-24 01:12:47 UTC (rev 5151) @@ -51,7 +51,8 @@ NOTEINDEXTYPE GetShownCentre() const; protected: - + + afx_msg BOOL OnMouseWheel(UINT nFlags, short zDelta, CPoint pt); afx_msg void OnLButtonDown(UINT, CPoint); afx_msg void OnLButtonUp(UINT, CPoint); afx_msg void OnSetFocus(CWnd *pOldWnd); @@ -61,4 +62,4 @@ DECLARE_MESSAGE_MAP() }; -OPENMPT_NAMESPACE_END +OPENMPT_NAMESPACE_END \ No newline at end of file This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <sag...@us...> - 2015-05-24 22:10:43
|
Revision: 5155 http://sourceforge.net/p/modplug/code/5155 Author: saga-games Date: 2015-05-24 22:10:36 +0000 (Sun, 24 May 2015) Log Message: ----------- [Ref] Clean up tooltip-related code Modified Paths: -------------- trunk/OpenMPT/mptrack/CleanupSong.cpp trunk/OpenMPT/mptrack/CleanupSong.h trunk/OpenMPT/mptrack/MIDIMappingDialog.cpp trunk/OpenMPT/mptrack/dlg_misc.cpp Modified: trunk/OpenMPT/mptrack/CleanupSong.cpp =================================================================== --- trunk/OpenMPT/mptrack/CleanupSong.cpp 2015-05-24 21:48:08 UTC (rev 5154) +++ trunk/OpenMPT/mptrack/CleanupSong.cpp 2015-05-24 22:10:36 UTC (rev 5155) @@ -10,7 +10,7 @@ #include "stdafx.h" -#include "moddoc.h" +#include "Moddoc.h" #include "Mainfrm.h" #include "modsmp_ctrl.h" #include "CleanupSong.h" @@ -91,8 +91,7 @@ ON_COMMAND(IDC_CHK_REMOVE_PLUGINS, OnVerifyMutualExclusive) ON_COMMAND(IDC_CHK_RESET_VARIABLES, OnVerifyMutualExclusive) - ON_NOTIFY_EX_RANGE(TTN_NEEDTEXTW, 0, 0xFFFF, &CModCleanupDlg::OnToolTipNotify) - ON_NOTIFY_EX_RANGE(TTN_NEEDTEXTA, 0, 0xFFFF, &CModCleanupDlg::OnToolTipNotify) + ON_NOTIFY_EX(TTN_NEEDTEXT, 0, OnToolTipNotify) //}}AFX_MSG_MAP END_MESSAGE_MAP() @@ -171,13 +170,6 @@ } -void CModCleanupDlg::OnCancel() -//----------------------------- -{ - CDialog::OnCancel(); -} - - void CModCleanupDlg::OnVerifyMutualExclusive() //-------------------------------------------- { @@ -258,19 +250,12 @@ } -BOOL CModCleanupDlg::OnToolTipNotify(UINT id, NMHDR* pNMHDR, LRESULT* pResult) -//---------------------------------------------------------------------------- +BOOL CModCleanupDlg::OnToolTipNotify(UINT, NMHDR *pNMHDR, LRESULT *) +//------------------------------------------------------------------ { - MPT_UNREFERENCED_PARAMETER(id); - MPT_UNREFERENCED_PARAMETER(pResult); - - // need to handle both ANSI and UNICODE versions of the message - TOOLTIPTEXTA* pTTTA = (TOOLTIPTEXTA*)pNMHDR; - TOOLTIPTEXTW* pTTTW = (TOOLTIPTEXTW*)pNMHDR; - CStringA strTipText = ""; + TOOLTIPTEXT* pTTT = (TOOLTIPTEXTA*)pNMHDR; UINT_PTR nID = pNMHDR->idFrom; - if (pNMHDR->code == TTN_NEEDTEXTA && (pTTTA->uFlags & TTF_IDISHWND) || - pNMHDR->code == TTN_NEEDTEXTW && (pTTTW->uFlags & TTF_IDISHWND)) + if (pTTT->uFlags & TTF_IDISHWND) { // idFrom is actually the HWND of the tool nID = ::GetDlgCtrlID((HWND)nID); @@ -280,66 +265,56 @@ { // patterns case IDC_CHK_CLEANUP_PATTERNS: - strTipText = "Remove all unused patterns and rearrange them."; + pTTT->lpszText = _T("Remove all unused patterns and rearrange them."); break; case IDC_CHK_REMOVE_PATTERNS: - strTipText = "Remove all patterns."; + pTTT->lpszText = _T("Remove all patterns."); break; case IDC_CHK_REARRANGE_PATTERNS: - strTipText = "Number the patterns given by their order in the sequence."; + pTTT->lpszText = _T("Number the patterns given by their order in the sequence."); break; // orders case IDC_CHK_REMOVE_ORDERS: - strTipText = "Reset the order list."; + pTTT->lpszText = _T("Reset the order list."); break; case IDC_CHK_MERGE_SEQUENCES: - strTipText = "Merge multiple sequences into one."; + pTTT->lpszText = _T("Merge multiple sequences into one."); break; // samples case IDC_CHK_CLEANUP_SAMPLES: - strTipText = "Remove all unused samples."; + pTTT->lpszText = _T("Remove all unused samples."); break; case IDC_CHK_REMOVE_SAMPLES: - strTipText = "Remove all samples."; + pTTT->lpszText = _T("Remove all samples."); break; case IDC_CHK_REARRANGE_SAMPLES: - strTipText = "Reorder sample list by removing empty samples."; + pTTT->lpszText = _T("Reorder sample list by removing empty samples."); break; case IDC_CHK_OPTIMIZE_SAMPLES: - strTipText = "Remove unused data after the sample loop end."; + pTTT->lpszText = _T("Remove unused data after the sample loop end."); break; // instruments case IDC_CHK_CLEANUP_INSTRUMENTS: - strTipText = "Remove all unused instruments."; + pTTT->lpszText = _T("Remove all unused instruments."); break; case IDC_CHK_REMOVE_INSTRUMENTS: - strTipText = "Remove all instruments and convert them to samples."; + pTTT->lpszText = _T("Remove all instruments and convert them to samples."); break; // plugins case IDC_CHK_CLEANUP_PLUGINS: - strTipText = "Remove all unused plugins."; + pTTT->lpszText = _T("Remove all unused plugins."); break; case IDC_CHK_REMOVE_PLUGINS: - strTipText = "Remove all plugins."; + pTTT->lpszText = _T("Remove all plugins."); break; // misc case IDC_CHK_SAMPLEPACK: - strTipText = "Convert the module to .IT and reset song / sample / instrument variables"; + pTTT->lpszText = _T("Convert the module to .IT and reset song / sample / instrument variables"); break; + default: + pTTT->lpszText = _T(""); + break; } - - if (pNMHDR->code == TTN_NEEDTEXTA) - { - //strncpy_s(pTTTA->szText, sizeof(pTTTA->szText), strTipText, - // strTipText.GetLength() + 1); - mpt::String::CopyN(pTTTA->szText, strTipText); - } - else - { - ::MultiByteToWideChar(CP_ACP , 0, strTipText, strTipText.GetLength() + 1, - pTTTW->szText, CountOf(pTTTW->szText)); - } - return TRUE; } @@ -626,14 +601,10 @@ } } - if(sample.nLength > loopLength + 2) + if(sample.nLength > loopLength && loopLength >= 2) { - SmpLength lmax = loopLength + 2; - if(lmax < sample.nLength && lmax >= 2) - { - modDoc.GetSampleUndo().PrepareUndo(smp, sundo_delete, "Trim Unused Data", lmax, sample.nLength); - ctrlSmp::ResizeSample(sample, lmax, sndFile); - } + modDoc.GetSampleUndo().PrepareUndo(smp, sundo_delete, "Trim Unused Data", loopLength, sample.nLength); + ctrlSmp::ResizeSample(sample, loopLength, sndFile); } // Convert stereo samples with identical channels to mono Modified: trunk/OpenMPT/mptrack/CleanupSong.h =================================================================== --- trunk/OpenMPT/mptrack/CleanupSong.h 2015-05-24 21:48:08 UTC (rev 5154) +++ trunk/OpenMPT/mptrack/CleanupSong.h 2015-05-24 22:10:36 UTC (rev 5155) @@ -78,7 +78,6 @@ //{{AFX_VIRTUAL(CModCleanupDlg) virtual BOOL OnInitDialog(); virtual void OnOK(); - virtual void OnCancel(); //}}AFX_VIRTUAL BOOL OnToolTipNotify(UINT id, NMHDR* pNMHDR, LRESULT* pResult); Modified: trunk/OpenMPT/mptrack/MIDIMappingDialog.cpp =================================================================== --- trunk/OpenMPT/mptrack/MIDIMappingDialog.cpp 2015-05-24 21:48:08 UTC (rev 5154) +++ trunk/OpenMPT/mptrack/MIDIMappingDialog.cpp 2015-05-24 22:10:36 UTC (rev 5155) @@ -70,8 +70,7 @@ ON_NOTIFY(UDN_DELTAPOS, IDC_SPINMOVEMAPPING, OnDeltaposSpinmovemapping) ON_BN_CLICKED(IDC_CHECK_PATRECORD, OnBnClickedCheckPatRecord) - ON_NOTIFY_EX_RANGE(TTN_NEEDTEXTW, 0, 0xFFFF, &CMIDIMappingDialog::OnToolTipNotify) - ON_NOTIFY_EX_RANGE(TTN_NEEDTEXTA, 0, 0xFFFF, &CMIDIMappingDialog::OnToolTipNotify) + ON_NOTIFY_EX(TTN_NEEDTEXT, 0, OnToolTipNotify) END_MESSAGE_MAP() @@ -461,19 +460,13 @@ } -BOOL CMIDIMappingDialog::OnToolTipNotify(UINT id, NMHDR* pNMHDR, LRESULT* pResult) -//-------------------------------------------------------------------------------- +BOOL CMIDIMappingDialog::OnToolTipNotify(UINT, NMHDR * pNMHDR, LRESULT *) +//----------------------------------------------------------------------- { - MPT_UNREFERENCED_PARAMETER(id); - MPT_UNREFERENCED_PARAMETER(pResult); - - // need to handle both ANSI and UNICODE versions of the message - TOOLTIPTEXTA* pTTTA = (TOOLTIPTEXTA*)pNMHDR; - TOOLTIPTEXTW* pTTTW = (TOOLTIPTEXTW*)pNMHDR; - const char *strTipText = ""; + TOOLTIPTEXT *pTTT = (TOOLTIPTEXTA*)pNMHDR; + const TCHAR *text = _T(""); UINT_PTR nID = pNMHDR->idFrom; - if(pNMHDR->code == TTN_NEEDTEXTA && (pTTTA->uFlags & TTF_IDISHWND) || - pNMHDR->code == TTN_NEEDTEXTW && (pTTTW->uFlags & TTF_IDISHWND)) + if(pTTT->uFlags & TTF_IDISHWND) { // idFrom is actually the HWND of the tool nID = ::GetDlgCtrlID((HWND)nID); @@ -482,32 +475,23 @@ switch(nID) { case IDC_CHECKCAPTURE: - strTipText = "The event is not passed to any further MIDI mappings or recording facilities."; + text = _T("The event is not passed to any further MIDI mappings or recording facilities."); break; case IDC_CHECKACTIVE: - strTipText = "The MIDI mapping is enabled and can be procssed."; + text = _T("The MIDI mapping is enabled and can be procssed."); break; case IDC_CHECK_PATRECORD: - strTipText = "Parameter changes are recorded into patterns as Parameter Control events."; + text = _T("Parameter changes are recorded into patterns as Parameter Control events."); break; case IDC_CHECK_MIDILEARN: - strTipText = "Listens to incoming MIDI data to automatically fill in the appropriate data."; + text = _T("Listens to incoming MIDI data to automatically fill in the appropriate data."); break; case IDC_SPINMOVEMAPPING: - strTipText = "Change the processing order of the current selected MIDI mapping."; + text = _T("Change the processing order of the current selected MIDI mapping."); break; } - if(pNMHDR->code == TTN_NEEDTEXTA) - { - // 80 chars max?! - mpt::String::CopyN(pTTTA->szText, strTipText); - } else - { - ::MultiByteToWideChar(CP_ACP , 0, strTipText, strlen(strTipText) + 1, - pTTTW->szText, CountOf(pTTTW->szText)); - } - + mpt::String::CopyN(pTTT->szText, text); return TRUE; } Modified: trunk/OpenMPT/mptrack/dlg_misc.cpp =================================================================== --- trunk/OpenMPT/mptrack/dlg_misc.cpp 2015-05-24 21:48:08 UTC (rev 5154) +++ trunk/OpenMPT/mptrack/dlg_misc.cpp 2015-05-24 22:10:36 UTC (rev 5155) @@ -33,8 +33,7 @@ ON_CBN_SELCHANGE(IDC_COMBO1, UpdateDialog) ON_COMMAND(IDC_CHECK_PT1X, OnPTModeChanged) - ON_NOTIFY_EX_RANGE(TTN_NEEDTEXTW, 0, 0xFFFF, &CModTypeDlg::OnToolTipNotify) - ON_NOTIFY_EX_RANGE(TTN_NEEDTEXTA, 0, 0xFFFF, &CModTypeDlg::OnToolTipNotify) + ON_NOTIFY_EX(TTN_NEEDTEXT, 0, OnToolTipNotify) //}}AFX_MSG_MAP @@ -363,19 +362,13 @@ } -BOOL CModTypeDlg::OnToolTipNotify(UINT id, NMHDR* pNMHDR, LRESULT* pResult) -//------------------------------------------------------------------------- +BOOL CModTypeDlg::OnToolTipNotify(UINT, NMHDR *pNMHDR, LRESULT *) +//--------------------------------------------------------------- { - MPT_UNREFERENCED_PARAMETER(id); - MPT_UNREFERENCED_PARAMETER(pResult); - - // need to handle both ANSI and UNICODE versions of the message - TOOLTIPTEXTA* pTTTA = (TOOLTIPTEXTA*)pNMHDR; - TOOLTIPTEXTW* pTTTW = (TOOLTIPTEXTW*)pNMHDR; - CStringA strTipText = ""; + TOOLTIPTEXT *pTTT = (TOOLTIPTEXTA*)pNMHDR; + const TCHAR *text = _T(""); UINT_PTR nID = pNMHDR->idFrom; - if(pNMHDR->code == TTN_NEEDTEXTA && (pTTTA->uFlags & TTF_IDISHWND) || - pNMHDR->code == TTN_NEEDTEXTW && (pTTTW->uFlags & TTF_IDISHWND)) + if(pTTT->uFlags & TTF_IDISHWND) { // idFrom is actually the HWND of the tool nID = ::GetDlgCtrlID((HWND)nID); @@ -384,56 +377,47 @@ switch(nID) { case IDC_CHECK1: - strTipText = "Note slides always slide the same amount, not depending on the sample frequency."; + text = _T("Note slides always slide the same amount, not depending on the sample frequency."); break; case IDC_CHECK2: - strTipText = "Old ScreamTracker 3 volume slide behaviour (not recommended)."; + text = _T("Old ScreamTracker 3 volume slide behaviour (not recommended)."); break; case IDC_CHECK3: - strTipText = "Play some effects like in early versions of Impulse Tracker (not recommended)."; + text = _T("Play some effects like in early versions of Impulse Tracker (not recommended)."); break; case IDC_CHECK4: - strTipText = "Gxx and Exx/Fxx won't share effect memory. Gxx resets instrument envelopes."; + text = _T("Gxx and Exx/Fxx won't share effect memory. Gxx resets instrument envelopes."); break; case IDC_CHECK5: - strTipText = "The resonant filter's frequency range is increased from about 5KHz to 10KHz."; + text = _T("The resonant filter's frequency range is increased from about 5KHz to 10KHz."); break; case IDC_CHECK6: - strTipText = "The instrument settings of the external ITI files will be ignored."; + text = _T("The instrument settings of the external ITI files will be ignored."); break; case IDC_CHECK_PT1X: - strTipText = "Ignore pan fx, use on-the-fly sample swapping, enforce Amiga frequency limits."; + text = _T("Ignore pan fx, use on-the-fly sample swapping, enforce Amiga frequency limits."); break; case IDC_COMBO_MIXLEVELS: - strTipText = "Mixing method of sample and VST levels."; + text = _T("Mixing method of sample and VST levels."); break; case IDC_CHK_COMPATPLAY: - strTipText = "Play commands as the original tracker would play them (recommended)"; + text = _T("Play commands as the original tracker would play them (recommended)"); break; case IDC_CHK_MIDICCBUG: - strTipText = "Emulate an old bug which sent wrong volume messages to VSTis (not recommended)"; + text = _T("Emulate an old bug which sent wrong volume messages to VSTis (not recommended)"); break; case IDC_CHK_OLDRANDOM: - strTipText = "Use old (buggy) random volume / panning variation algorithm (not recommended)"; + text = _T("Use old (buggy) random volume / panning variation algorithm (not recommended)"); break; case IDC_CHK_OLDPITCH: - strTipText = "Use old (imprecise) portamento logic for instrument plugins (not recommended)"; + text = _T("Use old (imprecise) portamento logic for instrument plugins (not recommended)"); break; case IDC_CHK_FT2VOLRAMP: - strTipText = "Use Fasttracker 2 style super soft volume ramping (recommended for true compatible playback)"; + text = _T("Use Fasttracker 2 style super soft volume ramping (recommended for true compatible playback)"); break; } - if(pNMHDR->code == TTN_NEEDTEXTA) - { - // 80 chars max?! - mpt::String::CopyN(pTTTA->szText, strTipText); - } else - { - ::MultiByteToWideChar(CP_ACP , 0, strTipText, strTipText.GetLength() + 1, - pTTTW->szText, CountOf(pTTTW->szText)); - } - + mpt::String::CopyN(pTTT->szText, text); return TRUE; } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <sag...@us...> - 2015-05-24 22:25:07
|
Revision: 5158 http://sourceforge.net/p/modplug/code/5158 Author: saga-games Date: 2015-05-24 22:25:01 +0000 (Sun, 24 May 2015) Log Message: ----------- [Imp] Credits: Scale font according to UI zoom settings. [Imp] Plugin selection dialog: Indicate bitness of non-native plugins. Modified Paths: -------------- trunk/OpenMPT/mptrack/CreditStatic.cpp trunk/OpenMPT/mptrack/SelectPluginDialog.cpp trunk/OpenMPT/mptrack/Vstplug.h Modified: trunk/OpenMPT/mptrack/CreditStatic.cpp =================================================================== --- trunk/OpenMPT/mptrack/CreditStatic.cpp 2015-05-24 22:17:44 UTC (rev 5157) +++ trunk/OpenMPT/mptrack/CreditStatic.cpp 2015-05-24 22:25:01 UTC (rev 5158) @@ -9,6 +9,7 @@ #include "stdafx.h" #include "CreditStatic.h" +#include "MPTrackUtil.h" OPENMPT_NAMESPACE_BEGIN @@ -30,7 +31,7 @@ m_TextHeights[0] = 21; m_TextHeights[1] = 19; m_TextHeights[2] = 17; - m_TextHeights[3] = 15; + m_TextHeights[3] = MulDiv(15, Util::GetDPIy(m_hWnd), 96); m_nCurrentFontHeight = m_TextHeights[NORMAL_TEXT_HEIGHT]; Modified: trunk/OpenMPT/mptrack/SelectPluginDialog.cpp =================================================================== --- trunk/OpenMPT/mptrack/SelectPluginDialog.cpp 2015-05-24 22:17:44 UTC (rev 5157) +++ trunk/OpenMPT/mptrack/SelectPluginDialog.cpp 2015-05-24 22:25:01 UTC (rev 5158) @@ -339,7 +339,12 @@ } } - HTREEITEM h = AddTreeItem(plug.libraryName.AsNative().c_str(), plug.isInstrument ? IMAGE_PLUGININSTRUMENT : IMAGE_EFFECTPLUGIN, true, categoryFolders[plug.category], reinterpret_cast<LPARAM>(&plug)); + std::wstring title = plug.libraryName.AsNative(); + if(!plug.IsNativeFromCache()) + { + title += mpt::String::Print(L" (%1-Bit)", plug.GetDllBits()); + } + HTREEITEM h = AddTreeItem(title.c_str(), plug.isInstrument ? IMAGE_PLUGININSTRUMENT : IMAGE_EFFECTPLUGIN, true, categoryFolders[plug.category], reinterpret_cast<LPARAM>(&plug)); categoryUsed[plug.category] = true; if(nameFilterActive) Modified: trunk/OpenMPT/mptrack/Vstplug.h =================================================================== --- trunk/OpenMPT/mptrack/Vstplug.h 2015-05-24 22:17:44 UTC (rev 5157) +++ trunk/OpenMPT/mptrack/Vstplug.h 2015-05-24 22:25:01 UTC (rev 5158) @@ -83,6 +83,9 @@ // Check whether a plugin can be hosted inside OpenMPT or requires bridging uint8 GetDllBits(bool fromCache = true) const; bool IsNative(bool fromCache = true) const { return GetDllBits(fromCache) == sizeof(void *) * CHAR_BIT; } + // Check if a plugin is native, and if it is currently unknown, assume that it is native. Use this function only for performance reasons + // (e.g. if tons of unscanned plugins would slow down generation of the plugin selection dialog) + bool IsNativeFromCache() const { return dllBits == sizeof(void *) * CHAR_BIT || dllBits == 0; } void WriteToCache() const; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <sag...@us...> - 2015-05-25 21:16:08
|
Revision: 5185 http://sourceforge.net/p/modplug/code/5185 Author: saga-games Date: 2015-05-25 21:16:02 +0000 (Mon, 25 May 2015) Log Message: ----------- Update help file name for Path / Auto Save tab to new name. Modified Paths: -------------- trunk/OpenMPT/mptrack/MainFrm.cpp trunk/OpenMPT/mptrack/manual_generator/wiki.py Modified: trunk/OpenMPT/mptrack/MainFrm.cpp =================================================================== --- trunk/OpenMPT/mptrack/MainFrm.cpp 2015-05-25 20:24:50 UTC (rev 5184) +++ trunk/OpenMPT/mptrack/MainFrm.cpp 2015-05-25 21:16:02 UTC (rev 5185) @@ -2646,7 +2646,7 @@ case OPTIONS_PAGE_KEYBOARD: page = "::/Setup_Keyboard.html"; break; case OPTIONS_PAGE_COLORS: page = "::/Setup_Display.html"; break; case OPTIONS_PAGE_MIDI: page = "::/Setup_MIDI.html"; break; - case OPTIONS_PAGE_PATHS: page = "::/Setup_Autosave.html"; break; + case OPTIONS_PAGE_PATHS: page = "::/Setup_Paths_Auto_Save.html"; break; case OPTIONS_PAGE_UPDATE: page = "::/Setup_Update.html"; break; case OPTIONS_PAGE_ADVANCED: page = "::/Setup_Advanced.html"; break; } Modified: trunk/OpenMPT/mptrack/manual_generator/wiki.py =================================================================== --- trunk/OpenMPT/mptrack/manual_generator/wiki.py 2015-05-25 20:24:50 UTC (rev 5184) +++ trunk/OpenMPT/mptrack/manual_generator/wiki.py 2015-05-25 21:16:02 UTC (rev 5185) @@ -31,6 +31,8 @@ p = p.split(':_')[1] p = p.replace('/', '_') p = p.replace('.', '_') + while p.find('__') >= 0: + p = p.replace('__', '_') if p.find('#') >= 0: parts = p.split('#') return parts[0] + '.html#' + parts[1] This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <man...@us...> - 2015-05-25 23:19:31
|
Revision: 5187 http://sourceforge.net/p/modplug/code/5187 Author: manxorist Date: 2015-05-25 23:19:25 +0000 (Mon, 25 May 2015) Log Message: ----------- [Ref] Move initialization of tuning and template default directories right to the initialization of the other default directories. Modified Paths: -------------- trunk/OpenMPT/mptrack/Mptrack.cpp trunk/OpenMPT/mptrack/Mptrack.h trunk/OpenMPT/mptrack/TrackerSettings.cpp Modified: trunk/OpenMPT/mptrack/Mptrack.cpp =================================================================== --- trunk/OpenMPT/mptrack/Mptrack.cpp 2015-05-25 22:02:11 UTC (rev 5186) +++ trunk/OpenMPT/mptrack/Mptrack.cpp 2015-05-25 23:19:25 UTC (rev 5187) @@ -849,8 +849,6 @@ // Set up default file locations m_szConfigFileName = m_szConfigDirectory + MPT_PATHSTRING("mptrack.ini"); // config file m_szPluginCacheFileName = m_szConfigDirectory + MPT_PATHSTRING("plugin.cache"); // plugin cache - TrackerDirectories::Instance().SetDefaultDirectory(m_szConfigDirectory + MPT_PATHSTRING("tunings\\"), DIR_TUNING); - TrackerDirectories::Instance().SetDefaultDirectory(m_szConfigDirectory + MPT_PATHSTRING("TemplateModules\\"), DIR_TEMPLATE_FILES_USER); // Force use of custom ini file rather than windowsDir\executableName.ini if(m_pszProfileName) @@ -866,10 +864,6 @@ { CreateDirectoryW(m_szConfigDirectory.AsNative().c_str(), 0); } - if(!TrackerDirectories::Instance().GetDefaultDirectory(DIR_TUNING).IsDirectory()) - { - CreateDirectoryW(TrackerDirectories::Instance().GetDefaultDirectory(DIR_TUNING).AsNative().c_str(), 0); - } // Handle updates from old versions. @@ -940,8 +934,6 @@ InitProcSupport(); #endif - m_pTrackerDirectories = new TrackerDirectories(); - // Set up paths to store configuration in SetupPaths(cmdInfo.m_bPortable); @@ -950,8 +942,15 @@ m_pSettingsIniFile = new IniFileSettingsBackend(m_szConfigFileName); m_pSettings = new SettingsContainer(m_pSettingsIniFile); + m_pTrackerDirectories = new TrackerDirectories(); m_pTrackerSettings = new TrackerSettings(*m_pSettings); + // Create missing diretories + if(!TrackerDirectories::Instance().GetDefaultDirectory(DIR_TUNING).IsDirectory()) + { + CreateDirectoryW(TrackerDirectories::Instance().GetDefaultDirectory(DIR_TUNING).AsNative().c_str(), 0); + } + m_pSongSettingsIniFile = new IniFileSettingsBackend(m_szConfigDirectory + MPT_PATHSTRING("SongSettings.ini")); m_pSongSettings = new SettingsContainer(m_pSongSettingsIniFile); @@ -1152,6 +1151,8 @@ m_pComponentManagerSettings = nullptr; delete m_pTrackerSettings; m_pTrackerSettings = nullptr; + delete m_pTrackerDirectories; + m_pTrackerDirectories = nullptr; delete m_pSettings; m_pSettings = nullptr; delete m_pSettingsIniFile; @@ -1160,8 +1161,6 @@ m_pSongSettings = nullptr; delete m_pSongSettingsIniFile; m_pSongSettingsIniFile = nullptr; - delete m_pTrackerDirectories; - m_pTrackerDirectories = nullptr; return CWinApp::ExitInstance(); } Modified: trunk/OpenMPT/mptrack/Mptrack.h =================================================================== --- trunk/OpenMPT/mptrack/Mptrack.h 2015-05-25 22:02:11 UTC (rev 5186) +++ trunk/OpenMPT/mptrack/Mptrack.h 2015-05-25 23:19:25 UTC (rev 5187) @@ -202,9 +202,9 @@ DWORD m_GuiThreadId; - TrackerDirectories *m_pTrackerDirectories; IniFileSettingsBackend *m_pSettingsIniFile; SettingsContainer *m_pSettings; + TrackerDirectories *m_pTrackerDirectories; TrackerSettings *m_pTrackerSettings; IniFileSettingsBackend *m_pSongSettingsIniFile; SettingsContainer *m_pSongSettings; Modified: trunk/OpenMPT/mptrack/TrackerSettings.cpp =================================================================== --- trunk/OpenMPT/mptrack/TrackerSettings.cpp 2015-05-25 22:02:11 UTC (rev 5186) +++ trunk/OpenMPT/mptrack/TrackerSettings.cpp 2015-05-25 23:19:25 UTC (rev 5187) @@ -294,6 +294,8 @@ CMainFrame::m_pAutoSaver->SetUseOriginalPath(conf.Read<bool>("AutoSave", "UseOriginalPath", CMainFrame::m_pAutoSaver->GetUseOriginalPath())); CMainFrame::m_pAutoSaver->SetPath(theApp.RelativePathToAbsolute(conf.Read<mpt::PathString>("AutoSave", "Path", CMainFrame::m_pAutoSaver->GetPath()))); // Paths + TrackerDirectories::Instance().SetDefaultDirectory(theApp.GetConfigPath() + MPT_PATHSTRING("tunings\\"), DIR_TUNING); + TrackerDirectories::Instance().SetDefaultDirectory(theApp.GetConfigPath() + MPT_PATHSTRING("TemplateModules\\"), DIR_TEMPLATE_FILES_USER); for(size_t i = 0; i < NUM_DIRS; i++) { if(TrackerDirectories::Instance().m_szDirectoryToSettingsName[i][0] == '\0') This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <sag...@us...> - 2015-05-26 19:32:43
|
Revision: 5194 http://sourceforge.net/p/modplug/code/5194 Author: saga-games Date: 2015-05-26 19:32:38 +0000 (Tue, 26 May 2015) Log Message: ----------- [Fix] When a new shortcut has conflicts in both the same context (error) and cross-context (warning), always treat this as an error. Before, it depended on the ID order of the conflicting shortcuts. Modified Paths: -------------- trunk/OpenMPT/mptrack/CommandSet.cpp trunk/OpenMPT/mptrack/KeyConfigDlg.cpp Modified: trunk/OpenMPT/mptrack/CommandSet.cpp =================================================================== --- trunk/OpenMPT/mptrack/CommandSet.cpp 2015-05-26 18:59:43 UTC (rev 5193) +++ trunk/OpenMPT/mptrack/CommandSet.cpp 2015-05-26 19:32:38 UTC (rev 5194) @@ -771,20 +771,29 @@ if(IsDummyCommand(cmd)) // no need to search if we are adding a dummy key return std::pair<CommandID, KeyCombination>(kcNull, KeyCombination()); - for(int curCmd = 0; curCmd < kcNumCommands; curCmd++) + for(int pass = 0; pass < 2; pass++) { - if(IsDummyCommand((CommandID)curCmd)) - continue; + // In the first pass, only look for conflicts in the same context, since + // such conflicts are errors. Cross-context conflicts only emit warnings. + for(int curCmd = 0; curCmd < kcNumCommands; curCmd++) + { + if(IsDummyCommand((CommandID)curCmd)) + continue; - for(size_t k = 0; k < commands[curCmd].kcList.size(); k++) - { - const KeyCombination &curKc = commands[curCmd].kcList[k]; - if(KeyCombinationConflict(curKc, kc, checkEventConflict)) + for(size_t k = 0; k < commands[curCmd].kcList.size(); k++) { - return std::pair<CommandID, KeyCombination>((CommandID)curCmd, curKc); + const KeyCombination &curKc = commands[curCmd].kcList[k]; + if(pass == 0 && curKc.Context() != kc.Context()) + continue; + + if(KeyCombinationConflict(curKc, kc, checkEventConflict)) + { + return std::pair<CommandID, KeyCombination>((CommandID)curCmd, curKc); + } } } } + return std::pair<CommandID, KeyCombination>(kcNull, KeyCombination()); } Modified: trunk/OpenMPT/mptrack/KeyConfigDlg.cpp =================================================================== --- trunk/OpenMPT/mptrack/KeyConfigDlg.cpp 2015-05-26 18:59:43 UTC (rev 5193) +++ trunk/OpenMPT/mptrack/KeyConfigDlg.cpp 2015-05-26 19:32:38 UTC (rev 5194) @@ -776,7 +776,7 @@ if((conflictCmd = plocalCmdSet->IsConflicting(kc, cmd)).first != kcNull && conflictCmd.first != cmd && !plocalCmdSet->IsCrossContextConflict(kc, conflictCmd.second) - && Reporting::Confirm("New shortcut (" + kc.GetKeyText() + ") conflicts with " + plocalCmdSet->GetCommandText(conflictCmd.first) + " in " + conflictCmd.second.GetContextText() + ".\nDelete the other shortcut and keep the new one?", "Shortcut Conflict", false, this) == cnfNo) + && Reporting::Confirm("New shortcut (" + kc.GetKeyText() + ") conflicts with " + plocalCmdSet->GetCommandText(conflictCmd.first) + " in " + conflictCmd.second.GetContextText() + ".\nDelete the other shortcut and keep the new one?", MPT_USTRING("Shortcut Conflict"), false, false, this) == cnfNo) { // Restore original choice add = false; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <sag...@us...> - 2015-05-26 21:16:59
|
Revision: 5196 http://sourceforge.net/p/modplug/code/5196 Author: saga-games Date: 2015-05-26 21:16:52 +0000 (Tue, 26 May 2015) Log Message: ----------- [New] Order list: Can now also just copy the order list pattern IDs instead of their content (available from context menu or shortcut) [Ref] Remove unused author setup dialog. 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/PatternClipboard.cpp trunk/OpenMPT/mptrack/PatternClipboard.h trunk/OpenMPT/mptrack/mptrack.rc trunk/OpenMPT/mptrack/resource.h Modified: trunk/OpenMPT/mptrack/CommandSet.cpp =================================================================== --- trunk/OpenMPT/mptrack/CommandSet.cpp 2015-05-26 20:04:55 UTC (rev 5195) +++ trunk/OpenMPT/mptrack/CommandSet.cpp 2015-05-26 21:16:52 UTC (rev 5196) @@ -684,9 +684,9 @@ wsprintf(s, _T("Preview Sample Cue %u"), j - kcStartSampleCues + 1); DefineKeyCommand((CommandID)j, 1924 + j - kcStartSampleCues, s); } + // Safety margin if we want to add more cues + DefineKeyCommand(kcOrderlistEditCopyOrders, 1950, _T("Copy Orders")); - - // Add new key commands here. #ifdef _DEBUG Modified: trunk/OpenMPT/mptrack/CommandSet.h =================================================================== --- trunk/OpenMPT/mptrack/CommandSet.h 2015-05-26 20:04:55 UTC (rev 5195) +++ trunk/OpenMPT/mptrack/CommandSet.h 2015-05-26 21:16:52 UTC (rev 5196) @@ -1095,6 +1095,7 @@ kcStartOrderlistEdit=kcStartOrderlistCommands, kcOrderlistEditDelete=kcStartOrderlistEdit, kcOrderlistEditInsert, + kcOrderlistEditCopyOrders, kcOrderlistEditPattern, kcOrderlistSwitchToPatternView, kcEndOrderlistEdit=kcOrderlistSwitchToPatternView, Modified: trunk/OpenMPT/mptrack/Ctrl_pat.h =================================================================== --- trunk/OpenMPT/mptrack/Ctrl_pat.h 2015-05-26 20:04:55 UTC (rev 5195) +++ trunk/OpenMPT/mptrack/Ctrl_pat.h 2015-05-26 21:16:52 UTC (rev 5196) @@ -106,13 +106,11 @@ // Set given sqeuence and update orderlist display. void SelectSequence(const SEQUENCEINDEX nSeq); - // Clipboard. - void OnEditCopy(); - void OnEditCut(); - // Helper function for entering pattern number void EnterPatternNum(int enterNum); + void OnCopy(bool onlyOrders); + //{{AFX_VIRTUAL(COrderList) virtual BOOL PreTranslateMessage(MSG *pMsg); virtual void UpdateView(UpdateHint hint, CObject *pObj = nullptr); @@ -146,6 +144,9 @@ afx_msg void OnDuplicatePattern(); afx_msg void OnPatternCopy(); afx_msg void OnPatternPaste(); + afx_msg void OnEditCopy() { OnCopy(false); } + afx_msg void OnEditCopyOrders() { OnCopy(true); } + afx_msg void OnEditCut(); afx_msg LRESULT OnDragonDropping(WPARAM bDoDrop, LPARAM lParam); afx_msg LRESULT OnHelpHitTest(WPARAM, LPARAM lParam); afx_msg void OnSelectSequence(UINT nid); Modified: trunk/OpenMPT/mptrack/Ctrl_seq.cpp =================================================================== --- trunk/OpenMPT/mptrack/Ctrl_seq.cpp 2015-05-26 20:04:55 UTC (rev 5195) +++ trunk/OpenMPT/mptrack/Ctrl_seq.cpp 2015-05-26 21:16:52 UTC (rev 5196) @@ -71,6 +71,7 @@ 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_COPY_ORDERS, OnEditCopyOrders) ON_COMMAND(ID_PATTERN_PROPERTIES, OnPatternProperties) ON_COMMAND(ID_PLAYER_PLAY, OnPlayerPlay) @@ -566,12 +567,12 @@ } -void COrderList::OnEditCopy() -//--------------------------- +void COrderList::OnCopy(bool onlyOrders) +//-------------------------------------- { const OrdSelection ordsel = GetCurSel(false); BeginWaitCursor(); - PatternClipboard::Copy(m_pModDoc.GetrSoundFile(), ordsel.firstOrd, ordsel.lastOrd); + PatternClipboard::Copy(m_pModDoc.GetrSoundFile(), ordsel.firstOrd, ordsel.lastOrd, onlyOrders); PatternClipboardDialog::UpdateList(); EndWaitCursor(); } @@ -966,6 +967,7 @@ AppendMenu(hMenu, MF_STRING, ID_ORDERLIST_DELETE, "&Remove Patterns\t" + ih->GetKeyTextFromCommand(kcOrderlistEditDelete)); AppendMenu(hMenu, MF_SEPARATOR, NULL, ""); AppendMenu(hMenu, MF_STRING, ID_ORDERLIST_EDIT_COPY, "&Copy Patterns\t" + ih->GetKeyTextFromCommand(kcEditCopy)); + AppendMenu(hMenu, MF_STRING, ID_ORDERLIST_EDIT_COPY_ORDERS, "&Copy Orders\t" + ih->GetKeyTextFromCommand(kcOrderlistEditCopyOrders)); AppendMenu(hMenu, MF_STRING, ID_ORDERLIST_EDIT_CUT, "&C&ut Patterns\t" + ih->GetKeyTextFromCommand(kcEditCut)); AppendMenu(hMenu, MF_STRING | greyed, ID_PATTERNPASTE, "P&aste Patterns\t" + ih->GetKeyTextFromCommand(kcEditPaste)); AppendMenu(hMenu, MF_SEPARATOR, NULL, ""); Modified: trunk/OpenMPT/mptrack/PatternClipboard.cpp =================================================================== --- trunk/OpenMPT/mptrack/PatternClipboard.cpp 2015-05-26 20:04:55 UTC (rev 5195) +++ trunk/OpenMPT/mptrack/PatternClipboard.cpp 2015-05-26 21:16:52 UTC (rev 5196) @@ -54,8 +54,8 @@ // Copy a range of patterns to both the system clipboard and the internal clipboard. -bool PatternClipboard::Copy(CSoundFile &sndFile, ORDERINDEX first, ORDERINDEX last) -//--------------------------------------------------------------------------------- +bool PatternClipboard::Copy(CSoundFile &sndFile, ORDERINDEX first, ORDERINDEX last, bool onlyOrders) +//-------------------------------------------------------------------------------------------------- { LimitMax(first, sndFile.Order.GetLength()); LimitMax(last, sndFile.Order.GetLength()); @@ -85,8 +85,11 @@ data.AppendChar('+'); } else if(sndFile.Patterns.IsValidPat(pattern)) { - if(patList[pattern] == PATTERNINDEX_INVALID) + if(onlyOrders) { + patList[pattern] = pattern; + } else if(patList[pattern] == PATTERNINDEX_INVALID) + { // New pattern patList[pattern] = insertedPats++; @@ -106,13 +109,16 @@ data.AppendFormat("%u", patList[pattern]); } } - data.Append("\r\n" + patternData); + if(!onlyOrders) + { + data.Append("\r\n" + patternData); + } if(instance.activeClipboard < instance.clipboards.size()) { // Copy to internal clipboard CStringA desc; - desc.Format("%u Patterns (%u to %u)", last - first + 1, first, last); + desc.Format("%u %s (%u to %u)", last - first + 1, onlyOrders ? "Orders" : "Patterns", first, last); instance.clipboards[instance.activeClipboard] = PatternClipboardElement(data, desc); } @@ -367,6 +373,12 @@ pos = startPos + 8; startPos = data.Find("\n", pos) + 1; ORDERINDEX writeOrder = curOrder; + bool onlyOrders = (startPos == 0); + if(onlyOrders) + { + // Only create order list, no patterns + startPos = data.GetLength(); + } while(pos < startPos && pos != 0) { @@ -385,7 +397,7 @@ { // Duplicate pattern insertPat = patList[insertPat]; - } else + } else if(!onlyOrders) { // New pattern if(insertPat >= patList.size()) Modified: trunk/OpenMPT/mptrack/PatternClipboard.h =================================================================== --- trunk/OpenMPT/mptrack/PatternClipboard.h 2015-05-26 20:04:55 UTC (rev 5195) +++ trunk/OpenMPT/mptrack/PatternClipboard.h 2015-05-26 21:16:52 UTC (rev 5196) @@ -67,7 +67,7 @@ public: // Copy a range of patterns to both the system clipboard and the internal clipboard. - static bool Copy(CSoundFile &sndFile, ORDERINDEX first, ORDERINDEX last); + static bool Copy(CSoundFile &sndFile, ORDERINDEX first, ORDERINDEX last, bool onlyOrders); // Copy a pattern selection to both the system clipboard and the internal clipboard. static bool Copy(CSoundFile &sndFile, PATTERNINDEX pattern, PatternRect selection); // Try pasting a pattern selection from the system clipboard. Modified: trunk/OpenMPT/mptrack/mptrack.rc =================================================================== --- trunk/OpenMPT/mptrack/mptrack.rc 2015-05-26 20:04:55 UTC (rev 5195) +++ trunk/OpenMPT/mptrack/mptrack.rc 2015-05-26 21:16:52 UTC (rev 5196) @@ -1351,27 +1351,6 @@ CONTROL "",IDC_COMBO1,"ComboBoxEx32",CBS_DROPDOWNLIST | CBS_SORT | WS_VSCROLL | WS_TABSTOP,60,60,78,78 END -IDD_OPTIONS_AUTHOR DIALOGEX 0, 0, 214, 151 -STYLE DS_SETFONT | WS_CHILD | WS_DISABLED | WS_CAPTION -CAPTION "Identification" -FONT 8, "MS Shell Dlg", 0, 0, 0x0 -BEGIN - GROUPBOX "Author Information",IDC_STATIC,6,6,202,66 - LTEXT "Name:",IDC_STATIC,12,20,25,8 - EDITTEXT IDC_EDIT1,42,18,157,12,ES_AUTOHSCROLL - LTEXT "E-Mail:",IDC_STATIC,12,38,24,8 - EDITTEXT IDC_EDIT2,42,36,157,12,ES_AUTOHSCROLL - LTEXT "URL:",IDC_STATIC,12,56,24,8 - EDITTEXT IDC_EDIT3,42,54,157,12,ES_AUTOHSCROLL - GROUPBOX "Group Information",IDC_STATIC,6,78,202,66 - LTEXT "Name:",IDC_STATIC,12,92,25,8 - EDITTEXT IDC_EDIT4,42,90,157,12,ES_AUTOHSCROLL - LTEXT "E-Mail:",IDC_STATIC,12,110,22,8 - EDITTEXT IDC_EDIT5,42,108,157,12,ES_AUTOHSCROLL - LTEXT "URL:",IDC_STATIC,12,128,18,8 - EDITTEXT IDC_EDIT6,42,126,157,12,ES_AUTOHSCROLL -END - IDD_SOUNDBANK_INFO DIALOGEX 0, 0, 271, 167 STYLE DS_SETFONT | DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU CAPTION "Sound Bank Information" @@ -1884,11 +1863,6 @@ BOTTOMMARGIN, 76 END - IDD_OPTIONS_AUTHOR, DIALOG - BEGIN - BOTTOMMARGIN, 150 - END - IDD_SOUNDBANK_INFO, DIALOG BEGIN LEFTMARGIN, 7 Modified: trunk/OpenMPT/mptrack/resource.h =================================================================== --- trunk/OpenMPT/mptrack/resource.h 2015-05-26 20:04:55 UTC (rev 5195) +++ trunk/OpenMPT/mptrack/resource.h 2015-05-26 21:16:52 UTC (rev 5196) @@ -30,7 +30,6 @@ #define IDD_SAMPLE_AMPLIFY 130 #define IDD_SAMPLE_RESAMPLE 131 #define IDD_OPTIONS_EFFECTS 133 -#define IDD_OPTIONS_AUTHOR 134 #define IDR_MAINFRAME 200 #define IDR_MODULETYPE 201 #define IDR_TOOLBARS 202 @@ -1204,6 +1203,7 @@ #define ID_EDIT_PUSHFORWARDPASTE 43234 #define ID_EDIT_SPLITKEYBOARDSETTINGS 43235 #define ID_EDIT_PASTESPECIAL 43236 +#define ID_ORDERLIST_EDIT_COPY_ORDERS 43237 #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 This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <sag...@us...> - 2015-05-29 20:26:23
|
Revision: 5205 http://sourceforge.net/p/modplug/code/5205 Author: saga-games Date: 2015-05-29 20:26:17 +0000 (Fri, 29 May 2015) Log Message: ----------- [Imp] Default VST editor is now DPI-aware. Modified Paths: -------------- trunk/OpenMPT/mptrack/DefaultVstEditor.cpp trunk/OpenMPT/mptrack/DefaultVstEditor.h Modified: trunk/OpenMPT/mptrack/DefaultVstEditor.cpp =================================================================== --- trunk/OpenMPT/mptrack/DefaultVstEditor.cpp 2015-05-29 19:44:23 UTC (rev 5204) +++ trunk/OpenMPT/mptrack/DefaultVstEditor.cpp 2015-05-29 20:26:17 UTC (rev 5205) @@ -21,44 +21,63 @@ // Window proportions -enum +struct Measurements { - edSpacing = 5, // Spacing between elements - edLineHeight = 20, // Line of a single parameter line - edEditWidth = 45, // Width of the parameter edit box - edPerMilWidth = 30, // Width of the per mil label - edRightWidth = edEditWidth + edSpacing + edPerMilWidth, // Width of the right part of a parameter control set (edit box, param value) - edTotalHeight = 2 * edLineHeight + edSpacing, // Height of one set of controls + enum + { + edSpacing = 5, // Spacing between elements + edLineHeight = 20, // Line of a single parameter line + edEditWidth = 45, // Width of the parameter edit box + edPerMilWidth = 30, // Width of the per mil label + edRightWidth = edEditWidth + edSpacing + edPerMilWidth, // Width of the right part of a parameter control set (edit box, param value) + edTotalHeight = 2 * edLineHeight + edSpacing, // Height of one set of controls + }; + + const int spacing; + const int lineHeight; + const int editWidth; + const int perMilWidth; + const int rightWidth; + const int totalHeight; + + Measurements(HWND hWnd) + : spacing(Util::ScalePixels(edSpacing, hWnd)) + , lineHeight(Util::ScalePixels(edLineHeight, hWnd)) + , editWidth(Util::ScalePixels(edEditWidth, hWnd)) + , perMilWidth(Util::ScalePixels(edPerMilWidth, hWnd)) + , rightWidth(Util::ScalePixels(edRightWidth, hWnd)) + , totalHeight(Util::ScalePixels(edTotalHeight, hWnd)) + { } }; // Create a set of parameter controls -ParamControlSet::ParamControlSet(CWnd *parent, const CRect &rect, int setID) -//-------------------------------------------------------------------------- +ParamControlSet::ParamControlSet(CWnd *parent, const CRect &rect, int setID, const Measurements &m) +//------------------------------------------------------------------------------------------------- { // Offset of components on the right side - const int horizSplit = rect.left + rect.Width() - edRightWidth; + const int horizSplit = rect.left + rect.Width() - m.rightWidth; // Parameter name - nameLabel.Create("", WS_CHILD | WS_VISIBLE | SS_CENTERIMAGE, CRect(rect.left, rect.top, horizSplit - edSpacing, rect.top + edLineHeight), parent); + nameLabel.Create("", WS_CHILD | WS_VISIBLE | SS_CENTERIMAGE, CRect(rect.left, rect.top, horizSplit - m.spacing, rect.top + m.lineHeight), parent); nameLabel.SetFont(parent->GetFont()); // Parameter value as reported by the plugin - valueLabel.Create("", WS_CHILD | WS_VISIBLE | SS_CENTERIMAGE, CRect(horizSplit, rect.top, rect.right, rect.top + edLineHeight), parent); + valueLabel.Create("", WS_CHILD | WS_VISIBLE | SS_CENTERIMAGE, CRect(horizSplit, rect.top, rect.right, rect.top + m.lineHeight), parent); valueLabel.SetFont(parent->GetFont()); // Parameter value slider - valueSlider.Create(WS_CHILD | WS_VISIBLE | WS_TABSTOP /* | TBS_NOTICKS | TBS_BOTH */ | TBS_AUTOTICKS, CRect(rect.left, rect.bottom - edLineHeight, horizSplit - edSpacing, rect.bottom), parent, ID_PLUGINEDITOR_SLIDERS_BASE + setID); + valueSlider.Create(WS_CHILD | WS_VISIBLE | WS_TABSTOP /* | TBS_NOTICKS | TBS_BOTH */ | TBS_AUTOTICKS, CRect(rect.left, rect.bottom - m.lineHeight, horizSplit - m.spacing, rect.bottom), parent, ID_PLUGINEDITOR_SLIDERS_BASE + setID); valueSlider.SetFont(parent->GetFont()); valueSlider.SetRange(0, PARAM_RESOLUTION); valueSlider.SetTicFreq(PARAM_RESOLUTION / 10); // Parameter value edit box - valueEdit.CreateEx(WS_EX_CLIENTEDGE, _T("EDIT"), NULL, WS_CHILD | WS_VISIBLE | WS_TABSTOP | WS_BORDER | ES_AUTOHSCROLL | ES_NUMBER, CRect(horizSplit, rect.bottom - edLineHeight, horizSplit + edEditWidth, rect.bottom), parent, ID_PLUGINEDITOR_EDIT_BASE + setID); + valueEdit.CreateEx(WS_EX_CLIENTEDGE, _T("EDIT"), NULL, WS_CHILD | WS_VISIBLE | WS_TABSTOP | WS_BORDER | ES_AUTOHSCROLL | ES_NUMBER, CRect(horizSplit, rect.bottom - m.lineHeight, horizSplit + m.editWidth, rect.bottom), parent, ID_PLUGINEDITOR_EDIT_BASE + setID); valueEdit.SetFont(parent->GetFont()); // "Per mil" label - perMilLabel.Create("\x89", WS_CHILD | WS_VISIBLE | SS_CENTERIMAGE, CRect(horizSplit + edEditWidth + edSpacing, rect.bottom - edLineHeight, rect.right, rect.bottom), parent); + perMilLabel.Create("\x89", WS_CHILD | WS_VISIBLE | SS_CENTERIMAGE, CRect(horizSplit + m.editWidth + m.spacing, rect.bottom - m.lineHeight, rect.right, rect.bottom), parent); perMilLabel.SetFont(parent->GetFont()); } @@ -185,6 +204,7 @@ { return; } + Measurements m(m_hWnd); CRect window; GetWindowRect(&window); @@ -205,22 +225,22 @@ controls.clear(); // Create a bit of border space - rect.DeflateRect(edSpacing, edSpacing); - rect.bottom = edTotalHeight; + rect.DeflateRect(m.spacing, m.spacing); + rect.bottom = m.totalHeight; for(int i = 0; i < NUM_PLUGINEDITOR_PARAMETERS; i++) { try { - controls.push_back(new ParamControlSet(this, rect, i)); - rect.OffsetRect(0, edTotalHeight + edSpacing); + controls.push_back(new ParamControlSet(this, rect, i, m)); + rect.OffsetRect(0, m.totalHeight + m.spacing); } catch(MPTMemoryException) { } } // Calculate new ideal window height. - const int heightChange = (rect.bottom - edTotalHeight + edSpacing) - origHeight; + const int heightChange = (rect.bottom - m.totalHeight + m.spacing) - origHeight; // Update parameter scroll bar height scrollRect.bottom += heightChange; Modified: trunk/OpenMPT/mptrack/DefaultVstEditor.h =================================================================== --- trunk/OpenMPT/mptrack/DefaultVstEditor.h 2015-05-29 19:44:23 UTC (rev 5204) +++ trunk/OpenMPT/mptrack/DefaultVstEditor.h 2015-05-29 20:26:17 UTC (rev 5205) @@ -23,6 +23,8 @@ NUM_PLUGINEDITOR_PARAMETERS = 8, // Parameters on screen }; +struct Measurements; + //=================== class ParamControlSet //=================== @@ -35,7 +37,7 @@ CStatic perMilLabel; public: - ParamControlSet(CWnd *parent, const CRect &rect, int setID); + ParamControlSet(CWnd *parent, const CRect &rect, int setID, const Measurements &m); ~ParamControlSet(); void EnableControls(bool enable = true); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <sag...@us...> - 2015-05-31 14:37:39
|
Revision: 5216 http://sourceforge.net/p/modplug/code/5216 Author: saga-games Date: 2015-05-31 14:37:32 +0000 (Sun, 31 May 2015) Log Message: ----------- [Fix] Instrument tab: Updating the instrument's filter mode, pitch/tempo lock and tuning didn't update other windows [Imp] Instrument tab: Pitch/Pan Separation note list now uses tuning note names. Modified Paths: -------------- trunk/OpenMPT/mptrack/Ctrl_ins.cpp trunk/OpenMPT/mptrack/Mptrack.h trunk/OpenMPT/mptrack/dlg_misc.cpp Modified: trunk/OpenMPT/mptrack/Ctrl_ins.cpp =================================================================== --- trunk/OpenMPT/mptrack/Ctrl_ins.cpp 2015-05-30 22:05:09 UTC (rev 5215) +++ trunk/OpenMPT/mptrack/Ctrl_ins.cpp 2015-05-31 14:37:32 UTC (rev 5216) @@ -10,14 +10,14 @@ #include "stdafx.h" -#include "mptrack.h" -#include "mainfrm.h" +#include "Mptrack.h" +#include "Mainfrm.h" #include "InputHandler.h" -#include "childfrm.h" -#include "moddoc.h" -#include "globals.h" -#include "ctrl_ins.h" -#include "view_ins.h" +#include "Childfrm.h" +#include "Moddoc.h" +#include "Globals.h" +#include "Ctrl_ins.h" +#include "View_ins.h" #include "dlg_misc.h" #include "tuningDialog.h" #include "../common/misc_util.h" @@ -268,7 +268,7 @@ { CWnd::OnSetFocus(pOldWnd); InvalidateRect(NULL, FALSE); - CMainFrame::GetMainFrame()->m_pNoteMapHasFocus = (CWnd*) this; //rewbs.customKeys + CMainFrame::GetMainFrame()->m_pNoteMapHasFocus = (CWnd*)this; } @@ -277,7 +277,7 @@ { CWnd::OnKillFocus(pNewWnd); InvalidateRect(NULL, FALSE); - CMainFrame::GetMainFrame()->m_pNoteMapHasFocus=NULL; //rewbs.customKeys + CMainFrame::GetMainFrame()->m_pNoteMapHasFocus = nullptr; } @@ -754,17 +754,12 @@ m_nPlayingNote = -1; } -//end rewbs.customKeys - ///////////////////////////////////////////////////////////////////////// // CCtrlInstruments -// -> CODE#0027 -// -> DESC="per-instrument volume ramping setup (refered as attack)" #define MAX_ATTACK_LENGTH 2001 #define MAX_ATTACK_VALUE (MAX_ATTACK_LENGTH - 1) // 16 bit unsigned max -// -! NEW_FEATURE#0027 BEGIN_MESSAGE_MAP(CCtrlInstruments, CModControlDlg) //{{AFX_MSG_MAP(CCtrlInstruments) @@ -780,7 +775,7 @@ ON_COMMAND(IDC_CHECK1, OnSetPanningChanged) ON_COMMAND(IDC_CHECK2, OnEnableCutOff) ON_COMMAND(IDC_CHECK3, OnEnableResonance) - ON_COMMAND(IDC_INSVIEWPLG, TogglePluginEditor) //rewbs.instroVSTi + ON_COMMAND(IDC_INSVIEWPLG, TogglePluginEditor) ON_EN_CHANGE(IDC_EDIT_INSTRUMENT, OnInstrumentChanged) ON_EN_CHANGE(IDC_SAMPLE_NAME, OnNameChanged) ON_EN_CHANGE(IDC_SAMPLE_FILENAME, OnFileNameChanged) @@ -788,33 +783,29 @@ ON_EN_CHANGE(IDC_EDIT8, OnGlobalVolChanged) ON_EN_CHANGE(IDC_EDIT9, OnPanningChanged) ON_EN_CHANGE(IDC_EDIT10, OnMPRChanged) - ON_EN_CHANGE(IDC_EDIT11, OnMBKChanged) //rewbs.MidiBank + ON_EN_CHANGE(IDC_EDIT11, OnMBKChanged) ON_EN_CHANGE(IDC_EDIT15, OnPPSChanged) ON_EN_CHANGE(IDC_PITCHWHEELDEPTH, OnPitchWheelDepthChanged) - -// -> CODE#0027 -// -> DESC="per-instrument volume ramping setup (refered as attack)" ON_EN_CHANGE(IDC_EDIT2, OnAttackChanged) -// -! NEW_FEATURE#0027 ON_CBN_SELCHANGE(IDC_COMBO1, OnNNAChanged) ON_CBN_SELCHANGE(IDC_COMBO2, OnDCTChanged) ON_CBN_SELCHANGE(IDC_COMBO3, OnDCAChanged) ON_CBN_SELCHANGE(IDC_COMBO4, OnPPCChanged) ON_CBN_SELCHANGE(IDC_COMBO5, OnMCHChanged) - ON_CBN_SELCHANGE(IDC_COMBO6, OnMixPlugChanged) //rewbs.instroVSTi + ON_CBN_SELCHANGE(IDC_COMBO6, OnMixPlugChanged) ON_CBN_DROPDOWN(IDC_COMBO6, OnOpenPluginList) ON_CBN_SELCHANGE(IDC_COMBO9, OnResamplingChanged) ON_CBN_SELCHANGE(IDC_FILTERMODE, OnFilterModeChanged) ON_CBN_SELCHANGE(IDC_PLUGIN_VOLUMESTYLE, OnPluginVolumeHandlingChanged) ON_COMMAND(IDC_PLUGIN_VELOCITYSTYLE, OnPluginVelocityHandlingChanged) ON_COMMAND(ID_INSTRUMENT_SAMPLEMAP, OnEditSampleMap) - //}}AFX_MSG_MAP ON_CBN_SELCHANGE(IDC_COMBOTUNING, OnCbnSelchangeCombotuning) ON_EN_CHANGE(IDC_EDIT_PITCHTEMPOLOCK, OnEnChangeEditPitchtempolock) ON_BN_CLICKED(IDC_CHECK_PITCHTEMPOLOCK, OnBnClickedCheckPitchtempolock) ON_EN_KILLFOCUS(IDC_EDIT_PITCHTEMPOLOCK, OnEnKillfocusEditPitchtempolock) ON_EN_KILLFOCUS(IDC_EDIT7, OnEnKillfocusEditFadeOut) + //}}AFX_MSG_MAP END_MESSAGE_MAP() void CCtrlInstruments::DoDataExchange(CDataExchange* pDX) @@ -832,7 +823,7 @@ DDX_Control(pDX, IDC_COMBO3, m_ComboDCA); DDX_Control(pDX, IDC_COMBO4, m_ComboPPC); DDX_Control(pDX, IDC_COMBO5, m_CbnMidiCh); - DDX_Control(pDX, IDC_COMBO6, m_CbnMixPlug); //rewbs.instroVSTi + DDX_Control(pDX, IDC_COMBO6, m_CbnMixPlug); DDX_Control(pDX, IDC_COMBO9, m_CbnResampling); DDX_Control(pDX, IDC_FILTERMODE, m_CbnFilterMode); DDX_Control(pDX, IDC_EDIT7, m_EditFadeOut); @@ -840,7 +831,7 @@ DDX_Control(pDX, IDC_SPIN8, m_SpinGlobalVol); DDX_Control(pDX, IDC_SPIN9, m_SpinPanning); DDX_Control(pDX, IDC_SPIN10, m_SpinMidiPR); - DDX_Control(pDX, IDC_SPIN11, m_SpinMidiBK); //rewbs.MidiBank + DDX_Control(pDX, IDC_SPIN11, m_SpinMidiBK); DDX_Control(pDX, IDC_SPIN12, m_SpinPPS); DDX_Control(pDX, IDC_EDIT8, m_EditGlobalVol); DDX_Control(pDX, IDC_EDIT9, m_EditPanning); @@ -854,11 +845,8 @@ DDX_Control(pDX, IDC_SLIDER4, m_SliderResonance); DDX_Control(pDX, IDC_SLIDER6, m_SliderCutSwing); DDX_Control(pDX, IDC_SLIDER7, m_SliderResSwing); -// -> CODE#0027 -// -> DESC="per-instrument volume ramping setup (refered as attack)" DDX_Control(pDX, IDC_SLIDER5, m_SliderAttack); DDX_Control(pDX, IDC_SPIN1, m_SpinAttack); -// -! NEW_FEATURE#0027 DDX_Control(pDX, IDC_COMBOTUNING, m_ComboTuning); DDX_Control(pDX, IDC_CHECK_PITCHTEMPOLOCK, m_CheckPitchTempoLock); DDX_Control(pDX, IDC_EDIT_PITCHTEMPOLOCK, m_EditPitchTempoLock); @@ -915,7 +903,7 @@ m_ComboDCT.AddString("Note"); m_ComboDCT.AddString("Sample"); m_ComboDCT.AddString("Instrument"); - m_ComboDCT.AddString("Plugin"); //rewbs.instroVSTi + m_ComboDCT.AddString("Plugin"); // DCA m_ComboDCA.AddString("Note Cut"); m_ComboDCA.AddString("Note Off"); @@ -928,7 +916,7 @@ m_SpinPanning.SetRange(0, (m_modDoc.GetModType() & MOD_TYPE_IT) ? 64 : 256); // Midi Program m_SpinMidiPR.SetRange(0, 128); - // rewbs.MidiBank + // Midi Bank m_SpinMidiBK.SetRange(0, 16384); m_CbnResampling.SetItemData(m_CbnResampling.AddString("Default"), SRCMODE_DEFAULT); @@ -938,7 +926,6 @@ m_CbnResampling.SetItemData(m_CbnResampling.AddString("Polyphase"), SRCMODE_POLYPHASE); m_CbnResampling.SetItemData(m_CbnResampling.AddString("XMMS"), SRCMODE_FIRFILTER); - //end rewbs.instroVSTi m_CbnFilterMode.SetItemData(m_CbnFilterMode.AddString("Channel default"), FLTMODE_UNCHANGED); m_CbnFilterMode.SetItemData(m_CbnFilterMode.AddString("Force lowpass"), FLTMODE_LOWPASS); m_CbnFilterMode.SetItemData(m_CbnFilterMode.AddString("Force highpass"), FLTMODE_HIGHPASS); @@ -960,13 +947,11 @@ m_SpinPPS.SetRange(-32, +32); // Pitch/Pan Center AppendNotesToControl(m_ComboPPC, 0, NOTE_MAX - NOTE_MIN); + SetWindowLongPtr(m_ComboPPC.m_hWnd, GWLP_USERDATA, 0); -// -> CODE#0027 -// -> DESC="per-instrument volume ramping setup (refered as attack)" // Volume ramping (attack) m_SliderAttack.SetRange(0,MAX_ATTACK_VALUE); m_SpinAttack.SetRange(0,MAX_ATTACK_VALUE); -// -! NEW_FEATURE#0027 m_SpinInstrument.SetFocus(); @@ -1022,11 +1007,8 @@ // Is this a bug ? m_SliderCutOff.InvalidateRect(NULL, FALSE); m_SliderResonance.InvalidateRect(NULL, FALSE); -// -> CODE#0027 -// -> DESC="per-instrument volume ramping setup (refered as attack)" // Volume ramping (attack) m_SliderAttack.InvalidateRect(NULL, FALSE); -// -! NEW_FEATURE#0027 } PostViewMessage(VIEWMSG_SETCURRENTINSTRUMENT, m_nInstrument); UnlockControls(); @@ -1124,7 +1106,6 @@ OnEditSampleMap(); break; - //rewbs.customKeys case IDC_INSTRUMENT_NEW: OnInstrumentNew(); break; @@ -1134,7 +1115,6 @@ case IDC_INSTRUMENT_SAVEAS: OnInstrumentSave(); break; - //end rewbs.customKeys default: return CModControlDlg::OnModCtrlMsg(wParam, lParam); @@ -1296,7 +1276,6 @@ m_CbnMixPlug.SetCurSel(0); } OnMixPlugChanged(); - //end rewbs.instroVSTi for(int nRes = 0; nRes<m_CbnResampling.GetCount(); nRes++) { DWORD v = m_CbnResampling.GetItemData(nRes); @@ -1321,7 +1300,17 @@ m_ComboDCT.SetCurSel(pIns->nDCT); m_ComboDCA.SetCurSel(pIns->nDNA); // Pitch/Pan Separation + if(hintType[HINT_MODTYPE] || pIns->pTuning != (CTuning *)GetWindowLongPtr(m_ComboPPC.m_hWnd, GWLP_USERDATA)) + { + // Tuning may have changed, and thus the note names need to be updated + m_ComboPPC.SetRedraw(FALSE); + m_ComboPPC.ResetContent(); + AppendNotesToControlEx(m_ComboPPC, m_sndFile, m_nInstrument, NOTE_MIN, NOTE_MAX); + SetWindowLongPtr(m_ComboPPC.m_hWnd, GWLP_USERDATA, (LONG_PTR)pIns->pTuning); + m_ComboPPC.SetRedraw(TRUE); + } m_ComboPPC.SetCurSel(pIns->nPPC); + ASSERT(m_ComboPPC.GetItemData(m_ComboPPC.GetCurSel()) == pIns->nPPC + NOTE_MIN); SetDlgItemInt(IDC_EDIT15, pIns->nPPS); // Filter if (m_sndFile.GetType() & (MOD_TYPE_IT | MOD_TYPE_MPT)) @@ -1681,7 +1670,7 @@ //-------------------------------------- { if(m_sndFile.GetNumInstruments() > 0 - && CMainFrame::GetInputHandler()->ShiftPressed()) //rewbs.customKeys + && CMainFrame::GetInputHandler()->ShiftPressed()) { OnInstrumentDuplicate(); return; @@ -2026,18 +2015,17 @@ SetModified(InstrumentHint().Info(), false); } } - //rewbs.MidiBank: we will not set the midi bank/program if it is 0 - if (n==0) + // we will not set the midi bank/program if it is 0 + if (n == 0) { LockControls(); SetDlgItemText(IDC_EDIT10, "---"); UnlockControls(); } - //end rewbs.MidiBank } } -//rewbs.MidiBank + void CCtrlInstruments::OnMBKChanged() //----------------------------------- { @@ -2050,18 +2038,17 @@ pIns->wMidiBank = w; SetModified(InstrumentHint().Info(), false); } - //rewbs.MidiBank: we will not set the midi bank/program if it is 0 + // we will not set the midi bank/program if it is 0 if(w == 0) { LockControls(); SetDlgItemText(IDC_EDIT11, "---"); UnlockControls(); } - //end rewbs.MidiBank } } -//end rewbs.MidiBank + void CCtrlInstruments::OnMCHChanged() //----------------------------------- { @@ -2093,7 +2080,6 @@ } -//rewbs.instroVSTi void CCtrlInstruments::OnMixPlugChanged() //--------------------------------------- { @@ -2188,10 +2174,8 @@ } ::EnableWindow(::GetDlgItem(m_hWnd, IDC_INSVIEWPLG), false); } -//end rewbs.instroVSTi - void CCtrlInstruments::OnPPSChanged() //----------------------------------- { @@ -2323,7 +2307,7 @@ if(pIns->nFilterMode != instFiltermode) { pIns->nFilterMode = instFiltermode; - m_modDoc.SetModified(); + SetModified(InstrumentHint().Info(), false); //Update channel settings where this instrument is active, if required. if(instFiltermode != FLTMODE_UNCHANGED) @@ -2358,13 +2342,10 @@ if (pIns) { - //Various optimisations by rewbs CSliderCtrl* pSlider = (CSliderCtrl*) pSB; short int n; bool filterChanger = false; -// -> CODE#0027 -// -> DESC="per-instrument volume ramping setup (refered as attack)" // Volume ramping (attack) if (pSlider == &m_SliderAttack) { @@ -2376,7 +2357,6 @@ SetDlgItemInt(IDC_EDIT2,n); SetModified(InstrumentHint().Info(), false); } -// -! NEW_FEATURE#0027 } // Volume Swing else if (pSlider == &m_SliderVolSwing) @@ -2494,7 +2474,6 @@ } -//rewbs.customKeys BOOL CCtrlInstruments::PreTranslateMessage(MSG *pMsg) //----------------------------------------------- { @@ -2540,7 +2519,6 @@ return 0; } -//end rewbs.customKeys void CCtrlInstruments::OnCbnSelchangeCombotuning() //------------------------------------------------ @@ -2558,8 +2536,7 @@ pInstH->SetTuning(NULL); cs.Leave(); - m_modDoc.SetModified(); - UpdateView(InstrumentHint(m_nInstrument).Info()); + SetModified(InstrumentHint(m_nInstrument).Info(), true); return; } @@ -2587,8 +2564,7 @@ pInstH->SetTuning(&tc->GetTuning(sel)); cs.Leave(); - m_modDoc.SetModified(); - UpdateView(InstrumentHint(m_nInstrument).Info()); + SetModified(InstrumentHint(m_nInstrument).Info(), true); return; } @@ -2614,7 +2590,7 @@ //new tuning(s) come visible. BuildTuningComboBox(); - UpdateView(InstrumentHint(m_nInstrument).Info()); + m_modDoc.UpdateAllViews(nullptr, InstrumentHint(m_nInstrument).Info()); } @@ -2782,6 +2758,7 @@ } } } + m_modDoc.UpdateAllViews(nullptr, InstrumentHint().Info(), this); } @@ -2796,7 +2773,7 @@ Limit(ptlTempo, m_sndFile.GetModSpecifications().tempoMin, m_sndFile.GetModSpecifications().tempoMax); m_sndFile.Instruments[m_nInstrument]->wPitchToTempoLock = ptlTempo; - m_modDoc.SetModified(); + m_modDoc.SetModified(); // Only update other views after killing focus } @@ -2804,7 +2781,6 @@ //------------------------------------------------------ { //Checking that tempo value is in correct range. - if(IsLocked()) return; TCHAR buffer[8]; @@ -2824,7 +2800,12 @@ changed = true; } - if(changed) m_EditPitchTempoLock.SetWindowText(mpt::ToString(ptlTempo).c_str()); + if(changed) + { + m_EditPitchTempoLock.SetWindowText(mpt::ToString(ptlTempo).c_str()); + m_modDoc.SetModified(); + } + m_modDoc.UpdateAllViews(nullptr, InstrumentHint().Info(), this); } Modified: trunk/OpenMPT/mptrack/Mptrack.h =================================================================== --- trunk/OpenMPT/mptrack/Mptrack.h 2015-05-30 22:05:09 UTC (rev 5215) +++ trunk/OpenMPT/mptrack/Mptrack.h 2015-05-31 14:37:32 UTC (rev 5216) @@ -397,12 +397,13 @@ void AddPluginParameternamesToCombobox(CComboBox& CBox, CVstPlugin& plug); // Append note names in range [noteStart, noteEnd] to given combobox. Index starts from 0. -void AppendNotesToControl(CComboBox& combobox, const ModCommand::NOTE noteStart, const ModCommand::NOTE noteEnd); +void AppendNotesToControl(CComboBox& combobox, ModCommand::NOTE noteStart, ModCommand::NOTE noteEnd); -// Append note names to combobox. If pSndFile != nullprt, appends only notes that are -// available in the module type. If nInstr is given, instrument specific note names are used instead of -// default note names. -void AppendNotesToControlEx(CComboBox& combobox, const CSoundFile &sndFile, const INSTRUMENTINDEX nInstr = MAX_INSTRUMENTS); +// Append note names to combo box. +// If nInstr is given, instrument-specific note names are used instead of default note names. +// A custom note range may also be specified using the noteStart and noteEnd parameters. +// If they are left out, only notes that are available in the module type, plus any supported "special notes" are added. +void AppendNotesToControlEx(CComboBox& combobox, const CSoundFile &sndFile, INSTRUMENTINDEX nInstr = MAX_INSTRUMENTS, ModCommand::NOTE noteStart = 0, ModCommand::NOTE noteEnd = 0); // Get window text (e.g. edit box conent) as a wide string std::wstring GetWindowTextW(CWnd &wnd); Modified: trunk/OpenMPT/mptrack/dlg_misc.cpp =================================================================== --- trunk/OpenMPT/mptrack/dlg_misc.cpp 2015-05-30 22:05:09 UTC (rev 5215) +++ trunk/OpenMPT/mptrack/dlg_misc.cpp 2015-05-31 14:37:32 UTC (rev 5216) @@ -1247,29 +1247,36 @@ ///////////////////////////////////////////////////////////////////////////////////// -void AppendNotesToControl(CComboBox& combobox, const ModCommand::NOTE noteStart, const ModCommand::NOTE noteEnd) -//-------------------------------------------------------------------------------------------------------------- +void AppendNotesToControl(CComboBox& combobox, ModCommand::NOTE noteStart, ModCommand::NOTE noteEnd) +//-------------------------------------------------------------------------------------------------- { - const ModCommand::NOTE upperLimit = MIN(NOTE_MAX - NOTE_MIN, noteEnd); - for(ModCommand::NOTE note = noteStart; note <= upperLimit; ++note) + const ModCommand::NOTE upperLimit = std::min(ModCommand::NOTE(NOTE_MAX - NOTE_MIN), noteEnd); + for(ModCommand::NOTE note = noteStart; note <= upperLimit; note++) combobox.SetItemData(combobox.AddString(CSoundFile::GetNoteName(note + NOTE_MIN).c_str()), note); } -void AppendNotesToControlEx(CComboBox& combobox, const CSoundFile &sndFile, const INSTRUMENTINDEX nInstr/* = MAX_INSTRUMENTS*/) -//----------------------------------------------------------------------------------------------------------------------------- +void AppendNotesToControlEx(CComboBox& combobox, const CSoundFile &sndFile, INSTRUMENTINDEX nInstr, ModCommand::NOTE noteStart, ModCommand::NOTE noteEnd) +//------------------------------------------------------------------------------------------------------------------------------------------------------- { - const ModCommand::NOTE noteStart = sndFile.GetModSpecifications().noteMin; - const ModCommand::NOTE noteEnd = sndFile.GetModSpecifications().noteMax; - for(ModCommand::NOTE nNote = noteStart; nNote <= noteEnd; nNote++) + bool addSpecial = noteStart == noteEnd; + if(noteStart == noteEnd) { - combobox.SetItemData(combobox.AddString(sndFile.GetNoteName(nNote, nInstr).c_str()), nNote); + noteStart = sndFile.GetModSpecifications().noteMin; + noteEnd = sndFile.GetModSpecifications().noteMax; } - for(ModCommand::NOTE nNote = NOTE_MIN_SPECIAL - 1; nNote++ < NOTE_MAX_SPECIAL;) + for(ModCommand::NOTE note = noteStart; note <= noteEnd; note++) { - if(sndFile.GetModSpecifications().HasNote(nNote)) - combobox.SetItemData(combobox.AddString(szSpecialNoteNamesMPT[nNote - NOTE_MIN_SPECIAL]), nNote); + combobox.SetItemData(combobox.AddString(sndFile.GetNoteName(note, nInstr).c_str()), note); } + if(addSpecial) + { + for(ModCommand::NOTE note = NOTE_MIN_SPECIAL - 1; note++ < NOTE_MAX_SPECIAL;) + { + if(sndFile.GetModSpecifications().HasNote(note)) + combobox.SetItemData(combobox.AddString(szSpecialNoteNamesMPT[note - NOTE_MIN_SPECIAL]), note); + } + } } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <man...@us...> - 2015-05-31 20:53:11
|
Revision: 5220 http://sourceforge.net/p/modplug/code/5220 Author: manxorist Date: 2015-05-31 20:53:05 +0000 (Sun, 31 May 2015) Log Message: ----------- [Ref] Move LoadStaticTunings to a more sensible point during startup. Modified Paths: -------------- trunk/OpenMPT/mptrack/MainFrm.cpp trunk/OpenMPT/mptrack/Mptrack.cpp Modified: trunk/OpenMPT/mptrack/MainFrm.cpp =================================================================== --- trunk/OpenMPT/mptrack/MainFrm.cpp 2015-05-31 18:48:35 UTC (rev 5219) +++ trunk/OpenMPT/mptrack/MainFrm.cpp 2015-05-31 20:53:05 UTC (rev 5220) @@ -214,8 +214,6 @@ m_InputHandler = new CInputHandler(this); - //Loading static tunings here - probably not the best place to do that but anyway. - CSoundFile::LoadStaticTunings(); } Modified: trunk/OpenMPT/mptrack/Mptrack.cpp =================================================================== --- trunk/OpenMPT/mptrack/Mptrack.cpp 2015-05-31 18:48:35 UTC (rev 5219) +++ trunk/OpenMPT/mptrack/Mptrack.cpp 2015-05-31 20:53:05 UTC (rev 5220) @@ -1054,6 +1054,9 @@ } #endif // !NO_DSOUND + // Load static tunings + CSoundFile::LoadStaticTunings(); + // Load DLS Banks if (!cmdInfo.m_bNoDls) LoadDefaultDLSBanks(); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <sag...@us...> - 2015-05-31 21:01:42
|
Revision: 5221 http://sourceforge.net/p/modplug/code/5221 Author: saga-games Date: 2015-05-31 21:01:36 +0000 (Sun, 31 May 2015) Log Message: ----------- [Imp] If fractional tempo is supported, using the mouse wheel or spin button the default tempo and main bar tempo control uses .1 increments (.01 if ctrl is held) Modified Paths: -------------- trunk/OpenMPT/mptrack/Ctrl_gen.cpp trunk/OpenMPT/mptrack/Mainbar.cpp Modified: trunk/OpenMPT/mptrack/Ctrl_gen.cpp =================================================================== --- trunk/OpenMPT/mptrack/Ctrl_gen.cpp 2015-05-31 20:53:05 UTC (rev 5220) +++ trunk/OpenMPT/mptrack/Ctrl_gen.cpp 2015-05-31 21:01:36 UTC (rev 5221) @@ -12,6 +12,7 @@ #include "stdafx.h" #include "Mptrack.h" #include "Mainfrm.h" +#include "InputHandler.h" #include "Moddoc.h" #include "Globals.h" #include "dlg_misc.h" @@ -390,11 +391,26 @@ int pos = m_SpinTempo.GetPos32(); if(pos != 0) { - TEMPO newTempo = m_sndFile.m_nDefaultTempo + TEMPO(pos, 0); + TEMPO newTempo; + if(m_sndFile.GetModSpecifications().hasFractionalTempo) + { + pos *= TEMPO::fractFact; + if(CMainFrame::GetMainFrame()->GetInputHandler()->CtrlPressed()) + pos /= 100; + else + pos /= 10; + newTempo.SetRaw(pos); + } else + { + newTempo = TEMPO(pos, 0); + } + newTempo += m_sndFile.m_nDefaultTempo; Limit(newTempo, tempoMin, tempoMax); m_sndFile.m_nDefaultTempo = m_sndFile.m_PlayState.m_nMusicTempo = newTempo; m_modDoc.SetModified(); + LockControls(); m_modDoc.UpdateAllViews(nullptr, GeneralHint().General(), this); + UnlockControls(); } m_SpinTempo.SetPos(0); } @@ -626,18 +642,18 @@ switch(uId) { - case IDC_SLIDER_SAMPLEPREAMP: - (displayDBValues) ? setAsDecibels(pszText, m_sndFile.m_nSamplePreAmp, m_sndFile.GetPlayConfig().getNormalSamplePreAmp()) : strcpy(pszText, moreRecentMixModeNote); - return TRUE; - break; - case IDC_SLIDER_VSTIVOL: - (displayDBValues) ? setAsDecibels(pszText, m_sndFile.m_nVSTiVolume, m_sndFile.GetPlayConfig().getNormalVSTiVol()) : strcpy(pszText, moreRecentMixModeNote); - return TRUE; - break; - case IDC_SLIDER_GLOBALVOL: - (displayDBValues) ? setAsDecibels(pszText, m_sndFile.m_PlayState.m_nGlobalVolume, m_sndFile.GetPlayConfig().getNormalGlobalVol()) : strcpy(pszText, moreRecentMixModeNote); - return TRUE; - break; + case IDC_BUTTON_MODTYPE: + _tcscpy(pszText, _T("Song Properties")); + return TRUE; + case IDC_SLIDER_SAMPLEPREAMP: + (displayDBValues) ? setAsDecibels(pszText, m_sndFile.m_nSamplePreAmp, m_sndFile.GetPlayConfig().getNormalSamplePreAmp()) : strcpy(pszText, moreRecentMixModeNote); + return TRUE; + case IDC_SLIDER_VSTIVOL: + (displayDBValues) ? setAsDecibels(pszText, m_sndFile.m_nVSTiVolume, m_sndFile.GetPlayConfig().getNormalVSTiVol()) : strcpy(pszText, moreRecentMixModeNote); + return TRUE; + case IDC_SLIDER_GLOBALVOL: + (displayDBValues) ? setAsDecibels(pszText, m_sndFile.m_PlayState.m_nGlobalVolume, m_sndFile.GetPlayConfig().getNormalGlobalVol()) : strcpy(pszText, moreRecentMixModeNote); + return TRUE; } } return FALSE; Modified: trunk/OpenMPT/mptrack/Mainbar.cpp =================================================================== --- trunk/OpenMPT/mptrack/Mainbar.cpp 2015-05-31 20:53:05 UTC (rev 5220) +++ trunk/OpenMPT/mptrack/Mainbar.cpp 2015-05-31 21:01:36 UTC (rev 5221) @@ -11,6 +11,7 @@ #include "stdafx.h" #include "Mptrack.h" #include "Mainfrm.h" +#include "InputHandler.h" #include "View_tre.h" #include "Moddoc.h" #include "../soundlib/mod_specifications.h" @@ -535,15 +536,30 @@ CSoundFile *pSndFile = pMainFrm->GetSoundFilePlaying(); if (pSndFile) { + const CModSpecifications &specs = pSndFile->GetModSpecifications(); int n; if ((n = sgn(m_SpinTempo.GetPos32())) != 0) { - pSndFile->SetTempo(Clamp(nCurrentTempo + TEMPO(n, 0), pSndFile->GetModSpecifications().tempoMin, pSndFile->GetModSpecifications().tempoMax), true); + TEMPO newTempo; + if(specs.hasFractionalTempo) + { + n *= TEMPO::fractFact; + if(CMainFrame::GetMainFrame()->GetInputHandler()->CtrlPressed()) + n /= 100; + else + n /= 10; + newTempo.SetRaw(n); + } else + { + newTempo = TEMPO(n, 0); + } + newTempo += nCurrentTempo; + pSndFile->SetTempo(Clamp(newTempo, specs.tempoMin, specs.tempoMax), true); m_SpinTempo.SetPos(0); } if ((n = sgn(m_SpinSpeed.GetPos32())) != 0) { - pSndFile->m_PlayState.m_nMusicSpeed = Clamp(UINT(nCurrentSpeed + n), pSndFile->GetModSpecifications().speedMin, pSndFile->GetModSpecifications().speedMax); + pSndFile->m_PlayState.m_nMusicSpeed = Clamp(uint32(nCurrentSpeed + n), specs.speedMin, specs.speedMax); m_SpinSpeed.SetPos(0); } if ((n = m_SpinRowsPerBeat.GetPos32()) != 0) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <sag...@us...> - 2015-05-31 21:34:13
|
Revision: 5222 http://sourceforge.net/p/modplug/code/5222 Author: saga-games Date: 2015-05-31 21:34:07 +0000 (Sun, 31 May 2015) Log Message: ----------- [Imp] Time stretcher ratio calculation now also allows for fractional tempos. [Ref] Rename CDecimalSupport::AllowSign to CDecimalSupport::AllowNegative Modified Paths: -------------- trunk/OpenMPT/mptrack/CDecimalSupport.h trunk/OpenMPT/mptrack/Ctrl_gen.cpp trunk/OpenMPT/mptrack/Ctrl_ins.cpp trunk/OpenMPT/mptrack/PSRatioCalc.cpp trunk/OpenMPT/mptrack/PSRatioCalc.h trunk/OpenMPT/mptrack/dlg_misc.cpp Modified: trunk/OpenMPT/mptrack/CDecimalSupport.h =================================================================== --- trunk/OpenMPT/mptrack/CDecimalSupport.h 2015-05-31 21:01:36 UTC (rev 5221) +++ trunk/OpenMPT/mptrack/CDecimalSupport.h 2015-05-31 21:34:07 UTC (rev 5222) @@ -51,7 +51,7 @@ /// the locale dependant negative sign TCHAR m_NegativeSign[6]; - bool allowSign, allowFractions; + bool allowNegative, allowFractions; public: @@ -67,7 +67,7 @@ /// \brief Initialize m_DecimalSeparator and m_NegativeSign /// \remarks calls InitDecimalSeparator and InitNegativeSign CDecimalSupport() - : allowSign(true) + : allowNegative(true) , allowFractions(true) { InitDecimalSeparator(); @@ -219,7 +219,7 @@ bHandled = true; } - if (static_cast<TCHAR>(wParam) == m_NegativeSign[0] && allowSign) + if (static_cast<TCHAR>(wParam) == m_NegativeSign[0] && allowNegative) { T* pT = static_cast<T*>(this); int nStartChar; @@ -360,9 +360,9 @@ szBuff[std::min(buflen - 1,last_nonzero)] = _T('\0'); } - void AllowSign(bool allow) + void AllowNegative(bool allow) { - allowSign = allow; + allowNegative = allow; } void AllowFractions(bool allow) Modified: trunk/OpenMPT/mptrack/Ctrl_gen.cpp =================================================================== --- trunk/OpenMPT/mptrack/Ctrl_gen.cpp 2015-05-31 21:01:36 UTC (rev 5221) +++ trunk/OpenMPT/mptrack/Ctrl_gen.cpp 2015-05-31 21:34:07 UTC (rev 5222) @@ -107,7 +107,7 @@ m_SliderTempo.SetLineSize(1); m_SliderTempo.SetPageSize(10); m_EditTempo.SubclassDlgItem(IDC_EDIT_TEMPO, this); - m_EditTempo.AllowSign(false); + m_EditTempo.AllowNegative(false); m_bEditsLocked = false; UpdateView(GeneralHint().ModType()); Modified: trunk/OpenMPT/mptrack/Ctrl_ins.cpp =================================================================== --- trunk/OpenMPT/mptrack/Ctrl_ins.cpp 2015-05-31 21:01:36 UTC (rev 5221) +++ trunk/OpenMPT/mptrack/Ctrl_ins.cpp 2015-05-31 21:34:07 UTC (rev 5222) @@ -965,7 +965,7 @@ CheckDlgButton(IDC_CHECK_PITCHTEMPOLOCK, MF_UNCHECKED); m_EditPitchTempoLock.SubclassDlgItem(IDC_EDIT_PITCHTEMPOLOCK, this); - m_EditPitchTempoLock.AllowSign(false); + m_EditPitchTempoLock.AllowNegative(false); m_EditPitchTempoLock.SetLimitText(9); SetRedraw(TRUE); Modified: trunk/OpenMPT/mptrack/PSRatioCalc.cpp =================================================================== --- trunk/OpenMPT/mptrack/PSRatioCalc.cpp 2015-05-31 21:01:36 UTC (rev 5221) +++ trunk/OpenMPT/mptrack/PSRatioCalc.cpp 2015-05-31 21:34:07 UTC (rev 5222) @@ -31,7 +31,7 @@ sampleRate = 8363; m_nSpeed = sndFile.m_PlayState.m_nMusicSpeed; - m_nTempo = sndFile.m_PlayState.m_nMusicTempo.GetInt(); + m_nTempo = sndFile.m_PlayState.m_nMusicTempo; // Sample rate will not change. We can calculate original duration once and disgard sampleRate. m_lMsOrig = static_cast<ULONGLONG>(1000.0 * ((double)smp.nLength / sampleRate)); @@ -40,9 +40,6 @@ CalcRows(); } -CPSRatioCalc::~CPSRatioCalc() -{ -} void CPSRatioCalc::DoDataExchange(CDataExchange* pDX) { @@ -55,7 +52,6 @@ DDX_Text(pDX, IDC_MS_LENGTH_ORIGINAL2, m_lMsOrig); DDX_Text(pDX, IDC_MS_LENGTH_NEW, m_lMsNew); DDX_Text(pDX, IDC_SPEED, m_nSpeed); - DDX_Text(pDX, IDC_TEMPO, m_nTempo); DDX_Text(pDX, IDC_ROW_LENGTH_ORIGINAL, m_dRowsOrig); //These 2 CEdits must only be updated if they don't have focus (to preserve trailing . and 0s etc..) @@ -77,6 +73,15 @@ END_MESSAGE_MAP() +BOOL CPSRatioCalc::OnInitDialog() +{ + CDialog::OnInitDialog(); + m_EditTempo.SubclassDlgItem(IDC_TEMPO, this); + m_EditTempo.AllowNegative(false); + m_EditTempo.SetTempoValue(m_nTempo); + return TRUE; +} + // CPSRatioCalc message handlers void CPSRatioCalc::OnEnChangeSamples() { @@ -119,7 +124,8 @@ void CPSRatioCalc::OnEnChangeSpeed() { UpdateData(); - if (m_nTempo < 1) m_nTempo = 1; + m_nTempo = m_EditTempo.GetTempoValue(); + if (m_nTempo < TEMPO(1, 0)) m_nTempo = TEMPO(1, 0); if (m_nSpeed < 1) m_nSpeed = 1; CalcRows(); UpdateData(FALSE); @@ -153,10 +159,10 @@ void CPSRatioCalc::CalcRows() { - double rowTime = sndFile.GetRowDuration(TEMPO(m_nTempo, 0), m_nSpeed); + double rowTime = sndFile.GetRowDuration(m_nTempo, m_nSpeed); m_dRowsOrig = (double)m_lMsOrig / rowTime; - m_dRowsNew = m_dRowsOrig*(m_dRatio / 100); + m_dRowsNew = m_dRowsOrig * (m_dRatio / 100); return; } Modified: trunk/OpenMPT/mptrack/PSRatioCalc.h =================================================================== --- trunk/OpenMPT/mptrack/PSRatioCalc.h 2015-05-31 21:01:36 UTC (rev 5221) +++ trunk/OpenMPT/mptrack/PSRatioCalc.h 2015-05-31 21:34:07 UTC (rev 5222) @@ -10,6 +10,8 @@ #pragma once +#include "CDecimalSupport.h" + OPENMPT_NAMESPACE_BEGIN class CPSRatioCalc : public CDialog @@ -18,19 +20,21 @@ public: CPSRatioCalc(const CSoundFile &sndFile, SAMPLEINDEX sample, double ratio, CWnd* pParent = NULL); // standard constructor - virtual ~CPSRatioCalc(); double m_dRatio; protected: virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support + virtual BOOL OnInitDialog(); + CNumberEdit m_EditTempo; const CSoundFile &sndFile; SAMPLEINDEX sampleIndex; ULONGLONG m_lSamplesNew; ULONGLONG m_lMsNew, m_lMsOrig; double m_dRowsOrig, m_dRowsNew; - uint32 m_nTempo, m_nSpeed; + uint32 m_nSpeed; + TEMPO m_nTempo; afx_msg void OnEnChangeSamples(); afx_msg void OnEnChangeMs(); Modified: trunk/OpenMPT/mptrack/dlg_misc.cpp =================================================================== --- trunk/OpenMPT/mptrack/dlg_misc.cpp 2015-05-31 21:01:36 UTC (rev 5221) +++ trunk/OpenMPT/mptrack/dlg_misc.cpp 2015-05-31 21:34:07 UTC (rev 5222) @@ -1138,7 +1138,7 @@ SetDlgItemInt(IDC_EDIT1, resultNumber); m_edit.SubclassDlgItem(IDC_EDIT1, this); m_edit.ModifyStyle(0, ES_NUMBER); - m_edit.AllowSign(minValue < 0); + m_edit.AllowNegative(minValue < 0); m_edit.AllowFractions(false); } else { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |