From: <man...@us...> - 2014-11-01 09:18:03
|
Revision: 4526 http://sourceforge.net/p/modplug/code/4526 Author: manxorist Date: 2014-11-01 09:17:35 +0000 (Sat, 01 Nov 2014) Log Message: ----------- [Imp] VUMeter: Display mono or quad vu meter in toolbar when appropriate. Modified Paths: -------------- trunk/OpenMPT/mptrack/MainFrm.cpp trunk/OpenMPT/mptrack/Mainbar.cpp trunk/OpenMPT/mptrack/Mainbar.h trunk/OpenMPT/mptrack/Notification.h Modified: trunk/OpenMPT/mptrack/MainFrm.cpp =================================================================== --- trunk/OpenMPT/mptrack/MainFrm.cpp 2014-11-01 07:32:51 UTC (rev 4525) +++ trunk/OpenMPT/mptrack/MainFrm.cpp 2014-11-01 09:17:35 UTC (rev 4526) @@ -847,6 +847,10 @@ } } } + for(std::size_t channel = std::min(numChannels, maxChannels); channel < maxChannels; ++channel) + { + channels[channel] = Channel(); + } } @@ -889,7 +893,7 @@ // Add an entry to the notification history - Notification notification(notifyType, notifyItem, streamPosition, m_pSndFile->m_PlayState.m_nRow, m_pSndFile->m_PlayState.m_nTickCount, m_pSndFile->m_PlayState.m_nCurrentOrder, m_pSndFile->m_PlayState.m_nPattern, m_pSndFile->GetMixStat()); + Notification notification(notifyType, notifyItem, streamPosition, m_pSndFile->m_PlayState.m_nRow, m_pSndFile->m_PlayState.m_nTickCount, m_pSndFile->m_PlayState.m_nCurrentOrder, m_pSndFile->m_PlayState.m_nPattern, m_pSndFile->GetMixStat(), static_cast<uint8>(m_pSndFile->m_MixerSettings.gnChannels)); m_pSndFile->ResetMixStat(); @@ -976,9 +980,12 @@ // Master VU meter notification.masterVU[0] = Clamp(m_VUMeter[0].peak >> 11, 0, 0x10000); notification.masterVU[1] = Clamp(m_VUMeter[1].peak >> 11, 0, 0x10000); + notification.masterVU[2] = Clamp(m_VUMeter[2].peak >> 11, 0, 0x10000); + notification.masterVU[3] = Clamp(m_VUMeter[3].peak >> 11, 0, 0x10000); if(m_VUMeter[0].clipped) notification.masterVU[0] |= Notification::ClipVU; if(m_VUMeter[1].clipped) notification.masterVU[1] |= Notification::ClipVU; - int32 us = Util::muldivr(dwSamplesRead, 1000000, m_pSndFile->m_MixerSettings.gdwMixingFreq); + if(m_VUMeter[2].clipped) notification.masterVU[2] |= Notification::ClipVU; + if(m_VUMeter[3].clipped) notification.masterVU[3] |= Notification::ClipVU; m_VUMeter.Decay(dwSamplesRead, m_pSndFile->m_MixerSettings.gdwMixingFreq); } @@ -2280,7 +2287,7 @@ ::SendMessage(GetFollowSong(), WM_MOD_UPDATEPOSITION, 0, lParam); } m_nMixChn = pnotify->mixedChannels; - m_wndToolBar.m_VuMeter.SetVuMeter(pnotify->masterVU[0], pnotify->masterVU[1], pnotify->type[Notification::Stop]); + m_wndToolBar.m_VuMeter.SetVuMeter(pnotify->masterVUchannels, pnotify->masterVU, pnotify->type[Notification::Stop]); } return 0; } Modified: trunk/OpenMPT/mptrack/Mainbar.cpp =================================================================== --- trunk/OpenMPT/mptrack/Mainbar.cpp 2014-11-01 07:32:51 UTC (rev 4525) +++ trunk/OpenMPT/mptrack/Mainbar.cpp 2014-11-01 09:17:35 UTC (rev 4526) @@ -1116,16 +1116,32 @@ } -void CStereoVU::SetVuMeter(uint32 left, uint32 right, bool force) -//--------------------------------------------------------------- +void CStereoVU::SetVuMeter(uint8 validChannels, const uint32 channels[4], bool force) +//----------------------------------------------------------------------------------- { - if(left != vuMeter[0] || right != vuMeter[1]) + bool changed = false; + if(validChannels != numChannels) { + changed = true; + force = true; + numChannels = validChannels; + } + for(uint8 c = 0; c < validChannels; ++c) + { + if(vuMeter[c] != channels[c]) + { + changed = true; + } + } + if(changed) + { DWORD curTime = timeGetTime(); if(curTime - lastVuUpdateTime >= TrackerSettings::Instance().VuMeterUpdateInterval || force) { - vuMeter[0] = left; - vuMeter[1] = right; + for(uint8 c = 0; c < validChannels; ++c) + { + vuMeter[c] = channels[c]; + } CClientDC dc(this); DrawVuMeters(dc); lastVuUpdateTime = curTime; @@ -1140,24 +1156,24 @@ { CRect rect; GetClientRect(&rect); - CRect rectL = rect, rectR = rect; - if(horizontal) + for(uint8 channel = 0; channel < numChannels; ++channel) { - const int mid = rect.top + rect.Height() / 2; - rectL.bottom = mid; - - rectR.top = mid + 1; - } else - { - const int mid = rect.left + rect.Width() / 2; - rectL.right = mid; - - rectR.left = mid + 1; + CRect chanrect = rect; + if(horizontal) + { + float height = rect.Height() / float(numChannels); + chanrect.top = Util::Round<int32>(rect.top + height * channel); + chanrect.bottom = Util::Round<int32>(chanrect.top + height) - 1; + } else + { + float width = rect.Width() / float(numChannels); + chanrect.left = Util::Round<int32>(rect.left + width * channel); + chanrect.right = Util::Round<int32>(chanrect.left + width) - 1; + } + DrawVuMeter(dc, chanrect, channel, redraw); } - DrawVuMeter(dc, rectL, 0, redraw); - DrawVuMeter(dc, rectR, 1, redraw); } Modified: trunk/OpenMPT/mptrack/Mainbar.h =================================================================== --- trunk/OpenMPT/mptrack/Mainbar.h 2014-11-01 07:32:51 UTC (rev 4525) +++ trunk/OpenMPT/mptrack/Mainbar.h 2014-11-01 09:17:35 UTC (rev 4526) @@ -17,15 +17,16 @@ //============================= { protected: - uint32 vuMeter[2]; + uint8 numChannels; + uint32 vuMeter[4]; DWORD lastVuUpdateTime; - int lastV[2]; - bool lastClip[2]; + int lastV[4]; + bool lastClip[4]; bool horizontal; public: - CStereoVU() { vuMeter[0] = vuMeter[1] = 0; lastVuUpdateTime = timeGetTime(); horizontal = true; lastV[0] = lastV[1] = 0; lastClip[0] = lastClip[1] = false; } - void SetVuMeter(uint32 left, uint32 right, bool force=false); + CStereoVU() { numChannels = 2; MemsetZero(vuMeter); lastVuUpdateTime = timeGetTime(); horizontal = true; MemsetZero(lastV); MemsetZero(lastClip); } + void SetVuMeter(uint8 validChannels, const uint32 channels[4], bool force=false); void SetOrientation(bool h) { horizontal = h; } protected: Modified: trunk/OpenMPT/mptrack/Notification.h =================================================================== --- trunk/OpenMPT/mptrack/Notification.h 2014-11-01 07:32:51 UTC (rev 4525) +++ trunk/OpenMPT/mptrack/Notification.h 2014-11-01 09:17:35 UTC (rev 4526) @@ -43,10 +43,11 @@ ORDERINDEX order; // dito PATTERNINDEX pattern; // dito uint32 mixedChannels; // dito - uint32 masterVU[2]; // dito + uint32 masterVU[4]; // dito + uint8 masterVUchannels; // dito SmpLength pos[MAX_CHANNELS]; // Sample / envelope pos for each channel if != PosInvalid, or pattern channel VUs - Notification(Type t = Default, Item i = 0, int64 s = 0, ROWINDEX r = 0, uint32 ti = 0, ORDERINDEX o = 0, PATTERNINDEX p = 0, uint32 x = 0) : timestampSamples(s), type(t), item(i), row(r), tick(ti), order(o), pattern(p), mixedChannels(x) + Notification(Type t = Default, Item i = 0, int64 s = 0, ROWINDEX r = 0, uint32 ti = 0, ORDERINDEX o = 0, PATTERNINDEX p = 0, uint32 x = 0, uint8 outChannels = 2) : timestampSamples(s), type(t), item(i), row(r), tick(ti), order(o), pattern(p), mixedChannels(x), masterVUchannels(outChannels) { MemsetZero(masterVU); } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <man...@us...> - 2014-11-01 17:36:37
|
Revision: 4529 http://sourceforge.net/p/modplug/code/4529 Author: manxorist Date: 2014-11-01 17:36:25 +0000 (Sat, 01 Nov 2014) Log Message: ----------- [Imp] VUMeter: In the toolbar vu meter in horizontal mode, when using quad output, layout the 4 channels in a spatiality-resambling way instead of below each other. Modified Paths: -------------- trunk/OpenMPT/mptrack/Mainbar.cpp trunk/OpenMPT/mptrack/Mainbar.h trunk/OpenMPT/mptrack/Notification.h Modified: trunk/OpenMPT/mptrack/Mainbar.cpp =================================================================== --- trunk/OpenMPT/mptrack/Mainbar.cpp 2014-11-01 14:03:05 UTC (rev 4528) +++ trunk/OpenMPT/mptrack/Mainbar.cpp 2014-11-01 17:36:25 UTC (rev 4529) @@ -1110,8 +1110,6 @@ { CRect rect; CPaintDC dc(this); - GetClientRect(&rect); - dc.FillSolidRect(rect.left, rect.top, rect.Width(), rect.Height(), RGB(0,0,0)); DrawVuMeters(dc, true); } @@ -1120,11 +1118,16 @@ //----------------------------------------------------------------------------------- { bool changed = false; - if(validChannels != numChannels) + if(validChannels == 0) { + // reset + validChannels = numChannels; + } else if(validChannels != numChannels) + { changed = true; force = true; numChannels = validChannels; + allowRightToLeft = (numChannels > 2); } for(uint8 c = 0; c < validChannels; ++c) { @@ -1143,7 +1146,7 @@ vuMeter[c] = channels[c]; } CClientDC dc(this); - DrawVuMeters(dc); + DrawVuMeters(dc, force); lastVuUpdateTime = curTime; } } @@ -1157,14 +1160,36 @@ CRect rect; GetClientRect(&rect); + if(redraw) + { + dc.FillSolidRect(rect.left, rect.top, rect.Width(), rect.Height(), RGB(0,0,0)); + } + for(uint8 channel = 0; channel < numChannels; ++channel) { CRect chanrect = rect; if(horizontal) { - float height = rect.Height() / float(numChannels); - chanrect.top = Util::Round<int32>(rect.top + height * channel); - chanrect.bottom = Util::Round<int32>(chanrect.top + height) - 1; + if(allowRightToLeft) + { + const int col = channel % 2; + const int row = channel / 2; + + float width = (rect.Width() - 2.0f) / 2.0f; + float height = rect.Height() / float(numChannels/2); + + chanrect.top = Util::Round<int32>(rect.top + height * row); + chanrect.bottom = Util::Round<int32>(chanrect.top + height) - 1; + + chanrect.left = Util::Round<int32>(rect.left + width * col) + ((col == 1) ? 2 : 0); + chanrect.right = Util::Round<int32>(chanrect.left + width) - 1; + + } else + { + float height = rect.Height() / float(numChannels); + chanrect.top = Util::Round<int32>(rect.top + height * channel); + chanrect.bottom = Util::Round<int32>(chanrect.top + height) - 1; + } } else { float width = rect.Width() / float(numChannels); @@ -1193,21 +1218,25 @@ if(horizontal) { + const bool rtl = allowRightToLeft && ((index % 2) == 0); + const int cx = std::max(1, rect.Width()); int v = (vu * cx) >> 8; - for(int rx = rect.left; rx <= rect.right; rx += 2) + for(int x = 0; x <= cx; x += 2) { - int pen = Clamp((rx * NUM_VUMETER_PENS) / cx, 0, NUM_VUMETER_PENS - 1); - const bool last = (rx == rect.right - 1); + int pen = Clamp((x * NUM_VUMETER_PENS) / cx, 0, NUM_VUMETER_PENS - 1); + const bool last = (x == (cx & ~0x1)); // Darken everything above volume, unless it's the clip indicator - if(v <= rx && (!last || !clip)) + if(v <= x && (!last || !clip)) pen += NUM_VUMETER_PENS; - bool draw = redraw || (v < lastV[index] && v<=rx && rx<=lastV[index]) || (lastV[index] < v && lastV[index]<=rx && rx<=v); + bool draw = redraw || (v < lastV[index] && v<=x && x<=lastV[index]) || (lastV[index] < v && lastV[index]<=x && x<=v); draw = draw || (last && clip != lastClip[index]); - if(draw) dc.FillSolidRect(rx, rect. top, 1, rect.Height(), CMainFrame::gcolrefVuMeter[pen]); + if(draw) dc.FillSolidRect( + ((!rtl) ? (rect.left + x) : (rect.right - x)), + rect.top, 1, rect.Height(), CMainFrame::gcolrefVuMeter[pen]); if(last) lastClip[index] = clip; } lastV[index] = v; Modified: trunk/OpenMPT/mptrack/Mainbar.h =================================================================== --- trunk/OpenMPT/mptrack/Mainbar.h 2014-11-01 14:03:05 UTC (rev 4528) +++ trunk/OpenMPT/mptrack/Mainbar.h 2014-11-01 17:36:25 UTC (rev 4529) @@ -23,9 +23,10 @@ int lastV[4]; bool lastClip[4]; bool horizontal; + bool allowRightToLeft; public: - CStereoVU() { numChannels = 2; MemsetZero(vuMeter); lastVuUpdateTime = timeGetTime(); horizontal = true; MemsetZero(lastV); MemsetZero(lastClip); } + CStereoVU() { numChannels = 2; MemsetZero(vuMeter); lastVuUpdateTime = timeGetTime(); horizontal = true; MemsetZero(lastV); MemsetZero(lastClip); allowRightToLeft = false; } void SetVuMeter(uint8 validChannels, const uint32 channels[4], bool force=false); void SetOrientation(bool h) { horizontal = h; } Modified: trunk/OpenMPT/mptrack/Notification.h =================================================================== --- trunk/OpenMPT/mptrack/Notification.h 2014-11-01 14:03:05 UTC (rev 4528) +++ trunk/OpenMPT/mptrack/Notification.h 2014-11-01 17:36:25 UTC (rev 4529) @@ -47,7 +47,7 @@ uint8 masterVUchannels; // dito SmpLength pos[MAX_CHANNELS]; // Sample / envelope pos for each channel if != PosInvalid, or pattern channel VUs - Notification(Type t = Default, Item i = 0, int64 s = 0, ROWINDEX r = 0, uint32 ti = 0, ORDERINDEX o = 0, PATTERNINDEX p = 0, uint32 x = 0, uint8 outChannels = 2) : timestampSamples(s), type(t), item(i), row(r), tick(ti), order(o), pattern(p), mixedChannels(x), masterVUchannels(outChannels) + Notification(Type t = Default, Item i = 0, int64 s = 0, ROWINDEX r = 0, uint32 ti = 0, ORDERINDEX o = 0, PATTERNINDEX p = 0, uint32 x = 0, uint8 outChannels = 0) : timestampSamples(s), type(t), item(i), row(r), tick(ti), order(o), pattern(p), mixedChannels(x), masterVUchannels(outChannels) { MemsetZero(masterVU); } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <sag...@us...> - 2014-11-01 20:16:25
|
Revision: 4530 http://sourceforge.net/p/modplug/code/4530 Author: saga-games Date: 2014-11-01 20:16:14 +0000 (Sat, 01 Nov 2014) Log Message: ----------- [Fix] MIDI Mapping Editor: Up/Down spin button was not updating instantly anymore in some cases. [Imp] MIDI Mapping Editor: Combined some columns where it makes sense to save space. [Ref] Remove now unneeded CMIDIMappingDirective::ToString Modified Paths: -------------- trunk/OpenMPT/mptrack/MIDIMapping.cpp trunk/OpenMPT/mptrack/MIDIMapping.h trunk/OpenMPT/mptrack/MIDIMappingDialog.cpp trunk/OpenMPT/mptrack/MIDIMappingDialog.h Modified: trunk/OpenMPT/mptrack/MIDIMapping.cpp =================================================================== --- trunk/OpenMPT/mptrack/MIDIMapping.cpp 2014-11-01 17:36:25 UTC (rev 4529) +++ trunk/OpenMPT/mptrack/MIDIMapping.cpp 2014-11-01 20:16:14 UTC (rev 4530) @@ -18,17 +18,6 @@ OPENMPT_NAMESPACE_BEGIN -std::string CMIDIMappingDirective::ToString() const -//------------------------------------------------- -{ - char flags[4] = "000"; - if(m_Active) flags[0] = '1'; - if(m_CaptureMIDI) flags[1] = '1'; - if(m_AllowPatternEdit) flags[2] = '1'; - return mpt::String::Print("%1:%2:%3:%4:%5:%6", flags, (int)GetChannel(), mpt::fmt::hex((int)GetEvent()), (int)GetController(), (int)m_PluginIndex, m_Parameter); -} - - size_t CMIDIMapper::GetSerializationSize() const //---------------------------------------------- { Modified: trunk/OpenMPT/mptrack/MIDIMapping.h =================================================================== --- trunk/OpenMPT/mptrack/MIDIMapping.h 2014-11-01 17:36:25 UTC (rev 4529) +++ trunk/OpenMPT/mptrack/MIDIMapping.h 2014-11-01 20:16:14 UTC (rev 4530) @@ -57,22 +57,20 @@ bool IsDefault() const {return *this == CMIDIMappingDirective();} - bool operator==(const CMIDIMappingDirective &other) const { return memcmp(this, &other, sizeof(CMIDIMappingDirective)) == 0; } + bool operator==(const CMIDIMappingDirective &other) const { return memcmp(this, &other, sizeof(*this)) == 0; } bool operator<(const CMIDIMappingDirective &other) const { return GetController() < other.GetController(); } - std::string ToString() const; - BYTE GetChnEvent() const {return m_ChnEvent;} private: - bool m_Active; - bool m_CaptureMIDI; //When true, MIDI data should not be processed beyond this directive - bool m_AllowPatternEdit; //When true, the mapping can be used for modifying pattern. - bool m_AnyChannel; + uint32 m_Parameter; + PLUGINDEX m_PluginIndex; + BYTE m_MIDIByte1; uint8 m_ChnEvent; //0-3 channel, 4-7 event - BYTE m_MIDIByte1; - PLUGINDEX m_PluginIndex; - uint32 m_Parameter; + bool m_Active : 1; + bool m_CaptureMIDI : 1; //When true, MIDI data should not be processed beyond this directive + bool m_AllowPatternEdit : 1; //When true, the mapping can be used for modifying pattern. + bool m_AnyChannel : 1; }; class CSoundFile; Modified: trunk/OpenMPT/mptrack/MIDIMappingDialog.cpp =================================================================== --- trunk/OpenMPT/mptrack/MIDIMappingDialog.cpp 2014-11-01 17:36:25 UTC (rev 4529) +++ trunk/OpenMPT/mptrack/MIDIMappingDialog.cpp 2014-11-01 20:16:14 UTC (rev 4530) @@ -108,14 +108,14 @@ CDialog::OnInitDialog(); // Add events - m_EventCBox.SetItemData(m_EventCBox.AddString("Controller Change (0xB)"), MIDIEvents::evControllerChange); - m_EventCBox.SetItemData(m_EventCBox.AddString("Polyphonic Aftertouch (0xA)"), MIDIEvents::evPolyAftertouch); - m_EventCBox.SetItemData(m_EventCBox.AddString("Channel Aftertouch (0xD)"), MIDIEvents::evChannelAftertouch); + m_EventCBox.SetItemData(m_EventCBox.AddString(_T("Controller Change")), MIDIEvents::evControllerChange); + m_EventCBox.SetItemData(m_EventCBox.AddString(_T("Polyphonic Aftertouch")), MIDIEvents::evPolyAftertouch); + m_EventCBox.SetItemData(m_EventCBox.AddString(_T("Channel Aftertouch")), MIDIEvents::evChannelAftertouch); // Add controller names + CString temp; for(size_t i = MIDIEvents::MIDICC_start; i <= MIDIEvents::MIDICC_end; i++) { - CString temp; temp.Format("%3u %s", i, MIDIEvents::MidiCCNames[i]); m_ControllerCBox.AddString(temp); } @@ -123,21 +123,19 @@ // Add plugin names AddPluginNamesToCombobox(m_PluginCBox, m_rSndFile.m_MixPlugins); - // Initialize mapping list + // Initialize mapping table const struct { const TCHAR *text; int width; } labels[] = { - { _T("Active"), 20 }, - { _T("Channel"), 48 }, - { _T("Event"), 56 }, - { _T("Controller"), 120 }, - { _T("Plugin"), 120 }, - { _T("Parameter"), 120 }, - { _T("Capture"), 36 }, - { _T("Pattern Record"), 36 } + { _T("Channel"), 58 }, + { _T("Event / Controller"), 176 }, + { _T("Plugin"), 120 }, + { _T("Parameter"), 120 }, + { _T("Capture"), 40 }, + { _T("Pattern Record"), 40 } }; for(int i = 0; i < CountOf(labels); i++) { @@ -174,50 +172,44 @@ int CMIDIMappingDialog::InsertItem(const CMIDIMappingDirective& m, int insertAt) //------------------------------------------------------------------------------ { - insertAt = m_List.InsertItem(insertAt, _T("")); - if(insertAt == -1) - return -1; - CString s; - m_List.SetCheck(insertAt, m.IsActive() ? TRUE : FALSE); if(m.GetAnyChannel()) s = _T("Any"); else s.Format(_T("Ch %u"), m.GetChannel()); - m_List.SetItemText(insertAt, 1, s); + insertAt = m_List.InsertItem(insertAt, s); + if(insertAt == -1) + return -1; + m_List.SetCheck(insertAt, m.IsActive() ? TRUE : FALSE); + switch(m.GetEvent()) { case MIDIEvents::evControllerChange: - s = _T("CC"); break; + s.Format(_T("CC %u: "), m.GetController()); + if(m.GetController() <= MIDIEvents::MIDICC_end) s += MIDIEvents::MidiCCNames[m.GetController()]; + break; case MIDIEvents::evPolyAftertouch: - s = _T("PolyAT"); break; + s = _T("Polyphonic Aftertouch"); break; case MIDIEvents::evChannelAftertouch: - s = _T("ChanAT"); break; + s = _T("Channel Aftertouch"); break; default: s.Format(_T("0x%02X"), m.GetEvent()); break; } - m_List.SetItemText(insertAt, 2, s); + m_List.SetItemText(insertAt, 1, s); - if(m.GetController() <= MIDIEvents::MIDICC_end && m.GetEvent() == MIDIEvents::evControllerChange) - { - s.Format(_T("%u "), m.GetController()); - s += MIDIEvents::MidiCCNames[m.GetController()]; - m_List.SetItemText(insertAt, 3, s); - } - const PLUGINDEX plugindex = m.GetPlugIndex(); if(plugindex > 0 && plugindex < MAX_MIXPLUGINS) { s.Format(_T("FX%u: "), plugindex); s += m_rSndFile.m_MixPlugins[plugindex - 1].GetName(); - m_List.SetItemText(insertAt, 4, s); + m_List.SetItemText(insertAt, 2, s); s.Format(_T("%02u: "), m.GetParamIndex()); s += m_rSndFile.m_MixPlugins[plugindex - 1].GetParamName(m.GetParamIndex()).c_str(); - m_List.SetItemText(insertAt, 5, s); + m_List.SetItemText(insertAt, 3, s); } - m_List.SetItemText(insertAt, 6, m.GetCaptureMIDI() ? _T("Cap") : _T("")); - m_List.SetItemText(insertAt, 7, m.GetAllowPatternEdit() ? _T("PR") : _T("")); + m_List.SetItemText(insertAt, 4, m.GetCaptureMIDI() ? _T("Capt") : _T("")); + m_List.SetItemText(insertAt, 5, m.GetAllowPatternEdit() ? _T("Rec") : _T("")); return insertAt; } @@ -231,8 +223,8 @@ } -void CMIDIMappingDialog::UpdateDialog() -//------------------------------------- +void CMIDIMappingDialog::UpdateDialog(int selItem) +//------------------------------------------------ { CheckDlgButton(IDC_CHECKACTIVE, m_Setting.IsActive() ? BST_CHECKED : BST_UNCHECKED); CheckDlgButton(IDC_CHECKCAPTURE, m_Setting.GetCaptureMIDI() ? BST_CHECKED : BST_UNCHECKED); @@ -257,8 +249,9 @@ UpdateEvent(); UpdateParameters(); - const int i = m_List.GetSelectionMark(); - const bool enableMover = i >= 0 && ( (i > 0 && m_rMIDIMapper.AreOrderEqual(i - 1, i)) || (i + 1 < m_List.GetItemCount() && m_rMIDIMapper.AreOrderEqual(i, i + 1))); + const bool enableMover = selItem >= 0 && ( + (selItem > 0 && m_rMIDIMapper.AreOrderEqual(selItem - 1, selItem)) || + (selItem + 1 < m_List.GetItemCount() && m_rMIDIMapper.AreOrderEqual(selItem, selItem + 1))); m_SpinMoveMapping.EnableWindow(enableMover); } Modified: trunk/OpenMPT/mptrack/MIDIMappingDialog.h =================================================================== --- trunk/OpenMPT/mptrack/MIDIMappingDialog.h 2014-11-01 17:36:25 UTC (rev 4529) +++ trunk/OpenMPT/mptrack/MIDIMappingDialog.h 2014-11-01 20:16:14 UTC (rev 4530) @@ -46,7 +46,7 @@ ~CMIDIMappingDialog(); protected: - void UpdateDialog(); + void UpdateDialog(int selItem = -1); void UpdateEvent(); void UpdateParameters(); int InsertItem(const CMIDIMappingDirective& m, int insertAt); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <sag...@us...> - 2014-11-02 01:18:58
|
Revision: 4535 http://sourceforge.net/p/modplug/code/4535 Author: saga-games Date: 2014-11-02 01:18:42 +0000 (Sun, 02 Nov 2014) Log Message: ----------- [Imp] Add mnenomics and spin buttons to find/replace dialog. Modified Paths: -------------- trunk/OpenMPT/mptrack/PatternEditorDialogs.cpp trunk/OpenMPT/mptrack/mptrack.rc Modified: trunk/OpenMPT/mptrack/PatternEditorDialogs.cpp =================================================================== --- trunk/OpenMPT/mptrack/PatternEditorDialogs.cpp 2014-11-01 21:51:00 UTC (rev 4534) +++ trunk/OpenMPT/mptrack/PatternEditorDialogs.cpp 2014-11-02 01:18:42 UTC (rev 4535) @@ -145,16 +145,16 @@ CheckDlgButton(IDC_CHECK7, m_Flags[FindReplace::InChannels] ? MF_CHECKED : MF_UNCHECKED); int nButton = IDC_RADIO1; if(m_Flags[FindReplace::FullSearch]) - { nButton = IDC_RADIO2; - } else if(m_bPatSel) - { + else if(m_bPatSel) nButton = IDC_RADIO3; - } + CheckRadioButton(IDC_RADIO1, IDC_RADIO3, nButton); GetDlgItem(IDC_RADIO3)->EnableWindow(m_bPatSel ? TRUE : FALSE); SetDlgItemInt(IDC_EDIT1, m_nMinChannel + 1); SetDlgItemInt(IDC_EDIT2, m_nMaxChannel + 1); + static_cast<CSpinButtonCtrl *>(GetDlgItem(IDC_SPIN1))->SetRange32(1, sndFile.GetNumChannels()); + static_cast<CSpinButtonCtrl *>(GetDlgItem(IDC_SPIN2))->SetRange32(1, sndFile.GetNumChannels()); } // Note if ((combo = (CComboBox *)GetDlgItem(IDC_COMBO1)) != NULL) @@ -350,8 +350,10 @@ if (!m_bReplace) { BOOL b = IsDlgButtonChecked(IDC_CHECK7); - ::EnableWindow(::GetDlgItem(m_hWnd, IDC_EDIT1), b); - ::EnableWindow(::GetDlgItem(m_hWnd, IDC_EDIT2), b); + GetDlgItem(IDC_EDIT1)->EnableWindow(b); + GetDlgItem(IDC_SPIN1)->EnableWindow(b); + GetDlgItem(IDC_EDIT2)->EnableWindow(b); + GetDlgItem(IDC_SPIN2)->EnableWindow(b); } } Modified: trunk/OpenMPT/mptrack/mptrack.rc =================================================================== --- trunk/OpenMPT/mptrack/mptrack.rc 2014-11-01 21:51:00 UTC (rev 4534) +++ trunk/OpenMPT/mptrack/mptrack.rc 2014-11-02 01:18:42 UTC (rev 4535) @@ -1188,25 +1188,27 @@ FONT 8, "MS Shell Dlg", 0, 0, 0x0 BEGIN GROUPBOX "Search for:",IDC_STATIC,4,4,206,110 - CONTROL "Note",IDC_CHECK1,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,12,18,60,10 + CONTROL "&Note",IDC_CHECK1,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,12,18,60,10 COMBOBOX IDC_COMBO1,12,30,59,94,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP - CONTROL "Instrument",IDC_CHECK2,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,84,18,114,10 + CONTROL "&Instrument",IDC_CHECK2,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,84,18,114,10 COMBOBOX IDC_COMBO2,84,30,114,103,CBS_DROPDOWNLIST | CBS_SORT | WS_VSCROLL | WS_TABSTOP - CONTROL "Volume Effect",IDC_CHECK3,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,12,48,114,10 + CONTROL "&Volume Effect",IDC_CHECK3,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,12,48,114,10 COMBOBOX IDC_COMBO3,12,60,114,77,CBS_DROPDOWNLIST | CBS_SORT | WS_VSCROLL | WS_TABSTOP - CONTROL "Volume Data",IDC_CHECK4,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,138,48,60,10 + CONTROL "V&olume Data",IDC_CHECK4,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,138,48,60,10 COMBOBOX IDC_COMBO4,138,60,60,77,CBS_DROPDOWNLIST | CBS_SORT | WS_VSCROLL | WS_TABSTOP - CONTROL "Effect",IDC_CHECK5,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,12,78,114,10 + CONTROL "&Effect",IDC_CHECK5,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,12,78,114,10 COMBOBOX IDC_COMBO5,12,90,113,71,CBS_DROPDOWNLIST | CBS_SORT | WS_VSCROLL | WS_TABSTOP - CONTROL "Effect Data",IDC_CHECK6,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,138,78,60,10 + CONTROL "E&ffect Data",IDC_CHECK6,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,138,78,60,10 COMBOBOX IDC_COMBO6,138,90,60,68,CBS_DROPDOWNLIST | CBS_SORT | WS_VSCROLL | WS_TABSTOP - CONTROL "Find in current pattern",IDC_RADIO1,"Button",BS_AUTORADIOBUTTON,6,120,108,8 - CONTROL "Find in the whole song",IDC_RADIO2,"Button",BS_AUTORADIOBUTTON,6,144,108,8 - CONTROL "Only in channels",IDC_CHECK7,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,120,120,70,10 - EDITTEXT IDC_EDIT1,132,132,28,12,ES_AUTOHSCROLL | ES_NUMBER - CTEXT "to",IDC_STATIC,164,134,8,8 - EDITTEXT IDC_EDIT2,176,132,28,12,ES_AUTOHSCROLL | ES_NUMBER - CONTROL "Find in current selection",IDC_RADIO3,"Button",BS_AUTORADIOBUTTON,6,132,108,8 + CONTROL "Find in current &pattern",IDC_RADIO1,"Button",BS_AUTORADIOBUTTON,6,120,108,8 + CONTROL "Find in current &selection",IDC_RADIO3,"Button",BS_AUTORADIOBUTTON,6,132,108,8 + CONTROL "Find in the &whole song",IDC_RADIO2,"Button",BS_AUTORADIOBUTTON,6,144,108,8 + CONTROL "Only in &channels",IDC_CHECK7,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,114,120,76,10 + EDITTEXT IDC_EDIT1,126,132,30,12,ES_AUTOHSCROLL | ES_NUMBER + CONTROL "",IDC_SPIN1,"msctls_updown32",UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS | UDS_NOTHOUSANDS,150,138,10,14 + CTEXT "&to",IDC_STATIC,164,134,8,8 + EDITTEXT IDC_EDIT2,176,132,30,12,ES_AUTOHSCROLL | ES_NUMBER + CONTROL "",IDC_SPIN2,"msctls_updown32",UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS | UDS_NOTHOUSANDS,198,138,11,14 END IDD_EDIT_REPLACE DIALOGEX 0, 0, 214, 149 @@ -1215,20 +1217,20 @@ FONT 8, "MS Shell Dlg", 0, 0, 0x0 BEGIN GROUPBOX "",IDC_STATIC,4,4,206,140 - CONTROL "Replace By:",IDC_CHECK7,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,12,15,63,10 - CONTROL "Note",IDC_CHECK1,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,12,30,60,10 + CONTROL "&Replace By:",IDC_CHECK7,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,12,15,63,10 + CONTROL "&Note",IDC_CHECK1,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,12,30,60,10 COMBOBOX IDC_COMBO1,12,42,59,93,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP - CONTROL "Instrument",IDC_CHECK2,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,84,30,114,10 + CONTROL "&Instrument",IDC_CHECK2,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,84,30,114,10 COMBOBOX IDC_COMBO2,84,42,114,92,CBS_DROPDOWNLIST | CBS_SORT | WS_VSCROLL | WS_TABSTOP - CONTROL "Volume Effect",IDC_CHECK3,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,13,60,113,10 + CONTROL "&Volume Effect",IDC_CHECK3,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,13,60,113,10 COMBOBOX IDC_COMBO3,12,72,114,64,CBS_DROPDOWNLIST | CBS_SORT | WS_VSCROLL | WS_TABSTOP - CONTROL "Volume Data",IDC_CHECK4,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,138,60,60,10 + CONTROL "V&olume Data",IDC_CHECK4,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,138,60,60,10 COMBOBOX IDC_COMBO4,138,72,60,64,CBS_DROPDOWNLIST | CBS_SORT | WS_VSCROLL | WS_TABSTOP - CONTROL "Effect",IDC_CHECK5,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,12,90,114,10 + CONTROL "&Effect",IDC_CHECK5,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,12,90,114,10 COMBOBOX IDC_COMBO5,12,102,114,70,CBS_DROPDOWNLIST | CBS_SORT | WS_VSCROLL | WS_TABSTOP - CONTROL "Effect Data",IDC_CHECK6,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,138,90,60,10 + CONTROL "E&ffect Data",IDC_CHECK6,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,138,90,60,10 COMBOBOX IDC_COMBO6,138,102,60,80,CBS_DROPDOWNLIST | CBS_SORT | WS_VSCROLL | WS_TABSTOP - CONTROL "Replace All (No confirmation)",IDC_CHECK8,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,12,126,186,10 + CONTROL "Replace &All (No confirmation)",IDC_CHECK8,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,12,126,186,10 END IDD_PATTERN_PROPERTIES DIALOGEX 0, 0, 190, 127 This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <man...@us...> - 2014-11-03 19:29:45
|
Revision: 4545 http://sourceforge.net/p/modplug/code/4545 Author: manxorist Date: 2014-11-03 19:29:38 +0000 (Mon, 03 Nov 2014) Log Message: ----------- [Ref] Tiny cleanup. Modified Paths: -------------- trunk/OpenMPT/mptrack/Mpdlgs.cpp trunk/OpenMPT/mptrack/Mpdlgs.h trunk/OpenMPT/mptrack/TrackerSettings.cpp trunk/OpenMPT/mptrack/TrackerSettings.h Modified: trunk/OpenMPT/mptrack/Mpdlgs.cpp =================================================================== --- trunk/OpenMPT/mptrack/Mpdlgs.cpp 2014-11-03 18:23:01 UTC (rev 4544) +++ trunk/OpenMPT/mptrack/Mpdlgs.cpp 2014-11-03 19:29:38 UTC (rev 4545) @@ -149,8 +149,8 @@ } -COptionsSoundcard::COptionsSoundcard(std::wstring deviceIdentifier) -//----------------------------------------------------------------- +COptionsSoundcard::COptionsSoundcard(SoundDevice::Identifier deviceIdentifier) +//---------------------------------------------------------------------------- : CPropertyPage(IDD_OPTIONS_SOUNDCARD) , m_InitialDeviceIdentifier(deviceIdentifier) { Modified: trunk/OpenMPT/mptrack/Mpdlgs.h =================================================================== --- trunk/OpenMPT/mptrack/Mpdlgs.h 2014-11-03 18:23:01 UTC (rev 4544) +++ trunk/OpenMPT/mptrack/Mpdlgs.h 2014-11-03 19:29:38 UTC (rev 4545) @@ -42,7 +42,7 @@ SoundDevice::Settings m_Settings; public: - COptionsSoundcard(std::wstring deviceIdentifier); + COptionsSoundcard(SoundDevice::Identifier deviceIdentifier); void UpdateStatistics(); Modified: trunk/OpenMPT/mptrack/TrackerSettings.cpp =================================================================== --- trunk/OpenMPT/mptrack/TrackerSettings.cpp 2014-11-03 18:23:01 UTC (rev 4544) +++ trunk/OpenMPT/mptrack/TrackerSettings.cpp 2014-11-03 19:29:38 UTC (rev 4545) @@ -173,7 +173,7 @@ , m_SoundSettingsStopMode(conf, "Sound Settings", "StopMode", SoundDevice::StopModeClosed) , m_SoundDeviceSettingsUseOldDefaults(false) , m_SoundDeviceID_DEPRECATED(SoundDevice::ID()) - , m_SoundDeviceIdentifier(conf, "Sound Settings", "Device", std::wstring()) + , m_SoundDeviceIdentifier(conf, "Sound Settings", "Device", SoundDevice::Identifier()) , m_SoundDevicePreferSameTypeIfDeviceUnavailable(conf, "Sound Settings", "PreferSameTypeIfDeviceUnavailable", false) , MixerMaxChannels(conf, "Sound Settings", "MixChannels", MixerSettings().m_nMaxMixChannels) , MixerDSPMask(conf, "Sound Settings", "Quality", MixerSettings().DSPMask) Modified: trunk/OpenMPT/mptrack/TrackerSettings.h =================================================================== --- trunk/OpenMPT/mptrack/TrackerSettings.h 2014-11-03 18:23:01 UTC (rev 4544) +++ trunk/OpenMPT/mptrack/TrackerSettings.h 2014-11-03 19:29:38 UTC (rev 4545) @@ -378,7 +378,7 @@ SoundDevice::Settings m_SoundDeviceSettingsDefaults; SoundDevice::Settings GetSoundDeviceSettingsDefaults() const; - Setting<std::wstring> m_SoundDeviceIdentifier; + Setting<SoundDevice::Identifier> m_SoundDeviceIdentifier; Setting<bool> m_SoundDevicePreferSameTypeIfDeviceUnavailable; SoundDevice::Identifier GetSoundDeviceIdentifier() const; void SetSoundDeviceIdentifier(const SoundDevice::Identifier &identifier); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <sag...@us...> - 2014-11-04 18:47:12
|
Revision: 4547 http://sourceforge.net/p/modplug/code/4547 Author: saga-games Date: 2014-11-04 18:46:56 +0000 (Tue, 04 Nov 2014) Log Message: ----------- [Ref] Make IMixPlugin::GetParamName return a formatted parameter name, as this is the only way it is being used anyway. Modified Paths: -------------- trunk/OpenMPT/mptrack/Draw_pat.cpp trunk/OpenMPT/mptrack/MIDIMappingDialog.cpp trunk/OpenMPT/mptrack/MIDIMappingDialog.h trunk/OpenMPT/mptrack/Vstplug.cpp Modified: trunk/OpenMPT/mptrack/Draw_pat.cpp =================================================================== --- trunk/OpenMPT/mptrack/Draw_pat.cpp 2014-11-03 20:14:36 UTC (rev 4546) +++ trunk/OpenMPT/mptrack/Draw_pat.cpp 2014-11-04 18:46:56 UTC (rev 4547) @@ -1666,9 +1666,8 @@ // display plugin param name. if(m->instr > 0 && m->instr <= MAX_MIXPLUGINS) { - CHAR sztmp[128] = ""; - mpt::String::CopyN(sztmp, pSndFile->m_MixPlugins[m->instr - 1].GetParamName(m->GetValueVolCol()).c_str()); - if (sztmp[0]) wsprintf(s, "%d: %s", m->GetValueVolCol(), sztmp); + const std::string name = pSndFile->m_MixPlugins[m->instr - 1].GetParamName(m->GetValueVolCol()); + mpt::String::Copy(s, name); } } else { Modified: trunk/OpenMPT/mptrack/MIDIMappingDialog.cpp =================================================================== --- trunk/OpenMPT/mptrack/MIDIMappingDialog.cpp 2014-11-03 20:14:36 UTC (rev 4546) +++ trunk/OpenMPT/mptrack/MIDIMappingDialog.cpp 2014-11-04 18:46:56 UTC (rev 4547) @@ -9,12 +9,12 @@ #include "stdafx.h" -#include "mptrack.h" +#include "Mainfrm.h" +#include "Moddoc.h" #include "MIDIMappingDialog.h" #include "InputHandler.h" #include "../soundlib/MIDIEvents.h" #include "../common/StringFixer.h" -#include "mainfrm.h" OPENMPT_NAMESPACE_BEGIN @@ -169,7 +169,7 @@ } -int CMIDIMappingDialog::InsertItem(const CMIDIMappingDirective& m, int insertAt) +int CMIDIMappingDialog::InsertItem(const CMIDIMappingDirective &m, int insertAt) //------------------------------------------------------------------------------ { CString s; @@ -204,8 +204,7 @@ s.Format(_T("FX%u: "), plugindex); s += m_rSndFile.m_MixPlugins[plugindex - 1].GetName(); m_List.SetItemText(insertAt, 2, s); - s.Format(_T("%02u: "), m.GetParamIndex()); - s += m_rSndFile.m_MixPlugins[plugindex - 1].GetParamName(m.GetParamIndex()).c_str(); + s = m_rSndFile.m_MixPlugins[plugindex - 1].GetParamName(m.GetParamIndex()).c_str(); m_List.SetItemText(insertAt, 3, s); } m_List.SetItemText(insertAt, 4, m.GetCaptureMIDI() ? _T("Capt") : _T("")); @@ -294,7 +293,7 @@ if(m_rSndFile.GetpModDoc()) m_rSndFile.GetpModDoc()->SetModified(); if(nmlv->iItem == m_List.GetSelectionMark()) - CheckDlgButton(IDC_CHECKACTIVE, nmlv->uNewState == 0x2000 ? BST_CHECKED :BST_UNCHECKED); + CheckDlgButton(IDC_CHECKACTIVE, nmlv->uNewState == 0x2000 ? BST_CHECKED : BST_UNCHECKED); } if(nmlv->uNewState & LVIS_SELECTED) Modified: trunk/OpenMPT/mptrack/MIDIMappingDialog.h =================================================================== --- trunk/OpenMPT/mptrack/MIDIMappingDialog.h 2014-11-03 20:14:36 UTC (rev 4546) +++ trunk/OpenMPT/mptrack/MIDIMappingDialog.h 2014-11-04 18:46:56 UTC (rev 4547) @@ -9,13 +9,13 @@ #pragma once -#include "moddoc.h" #include <vector> -#include "afxwin.h" -#include "afxcmn.h" +#include "MIDIMapping.h" OPENMPT_NAMESPACE_BEGIN +class CSoundFile; + // CMIDIMappingDialog dialog //======================================= @@ -49,7 +49,7 @@ void UpdateDialog(int selItem = -1); void UpdateEvent(); void UpdateParameters(); - int InsertItem(const CMIDIMappingDirective& m, int insertAt); + int InsertItem(const CMIDIMappingDirective &m, int insertAt); void SelectItem(int i); virtual BOOL OnInitDialog(); Modified: trunk/OpenMPT/mptrack/Vstplug.cpp =================================================================== --- trunk/OpenMPT/mptrack/Vstplug.cpp 2014-11-03 20:14:36 UTC (rev 4546) +++ trunk/OpenMPT/mptrack/Vstplug.cpp 2014-11-04 18:46:56 UTC (rev 4547) @@ -1248,10 +1248,10 @@ CString name; if(paramName.IsEmpty()) { - name.Format("%02d: Parameter %02d", param, param); + name.Format("%02u: Parameter %02u", param, param); } else { - name.Format("%02d: %s", param, paramName); + name.Format("%02u: %s", param, paramName); } return name; } @@ -2373,7 +2373,7 @@ CVstPlugin *vstPlug = dynamic_cast<CVstPlugin *>(pMixPlugin); if(vstPlug != nullptr) { - return vstPlug->GetParamName(index).GetString(); + return vstPlug->GetFormattedParamName(index).GetString(); } else { return std::string(); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <sag...@us...> - 2014-11-09 00:04:22
|
Revision: 4567 http://sourceforge.net/p/modplug/code/4567 Author: saga-games Date: 2014-11-09 00:04:15 +0000 (Sun, 09 Nov 2014) Log Message: ----------- [Imp] General tab: Clicking on the song type opens Song Properties. Modified Paths: -------------- trunk/OpenMPT/mptrack/Ctrl_gen.cpp trunk/OpenMPT/mptrack/mptrack.rc Modified: trunk/OpenMPT/mptrack/Ctrl_gen.cpp =================================================================== --- trunk/OpenMPT/mptrack/Ctrl_gen.cpp 2014-11-08 23:30:27 UTC (rev 4566) +++ trunk/OpenMPT/mptrack/Ctrl_gen.cpp 2014-11-09 00:04:15 UTC (rev 4567) @@ -29,6 +29,7 @@ ON_WM_VSCROLL() ON_COMMAND(IDC_BUTTON1, OnTapTempo) ON_COMMAND(IDC_BUTTON_MODTYPE, OnSongProperties) + ON_COMMAND(IDC_EDIT_MODTYPE, OnSongProperties) ON_COMMAND(IDC_BUTTON_PLAYERPROPS, OnPlayerProperties) ON_COMMAND(IDC_CHECK_LOOPSONG, OnLoopSongChanged) ON_EN_CHANGE(IDC_EDIT_SONGTITLE, OnTitleChanged) Modified: trunk/OpenMPT/mptrack/mptrack.rc =================================================================== --- trunk/OpenMPT/mptrack/mptrack.rc 2014-11-08 23:30:27 UTC (rev 4566) +++ trunk/OpenMPT/mptrack/mptrack.rc 2014-11-09 00:04:15 UTC (rev 4567) @@ -787,7 +787,7 @@ BEGIN LTEXT "Name:",IDC_STATIC,2,5,23,8 EDITTEXT IDC_EDIT_SONGTITLE,30,3,156,12,ES_AUTOHSCROLL - CTEXT "Type EXT, ## channels",IDC_EDIT_MODTYPE,192,3,138,12,SS_CENTERIMAGE,WS_EX_STATICEDGE + CTEXT "Type EXT, ## channels",IDC_EDIT_MODTYPE,192,3,138,12,SS_NOTIFY | SS_CENTERIMAGE,WS_EX_STATICEDGE GROUPBOX "",IDC_STATIC,1,14,83,82 LTEXT "Initial tempo:",IDC_STATIC,5,20,44,8 CONTROL "",IDC_SLIDER_SONGTEMPO,"msctls_trackbar32",TBS_VERT | TBS_BOTH | TBS_NOTICKS,11,28,15,50 This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <man...@us...> - 2014-11-10 14:01:06
|
Revision: 4589 http://sourceforge.net/p/modplug/code/4589 Author: manxorist Date: 2014-11-10 14:00:54 +0000 (Mon, 10 Nov 2014) Log Message: ----------- [Ref] Stream export: Convert encoder backends to mpt::ustring. Modified Paths: -------------- trunk/OpenMPT/mptrack/Mod2wave.cpp trunk/OpenMPT/mptrack/Moddoc.cpp trunk/OpenMPT/mptrack/StreamEncoder.cpp trunk/OpenMPT/mptrack/StreamEncoder.h trunk/OpenMPT/mptrack/StreamEncoderFLAC.cpp trunk/OpenMPT/mptrack/StreamEncoderMP3.cpp trunk/OpenMPT/mptrack/StreamEncoderOpus.cpp trunk/OpenMPT/mptrack/StreamEncoderVorbis.cpp trunk/OpenMPT/mptrack/StreamEncoderWAV.cpp trunk/OpenMPT/mptrack/TrackerSettings.cpp trunk/OpenMPT/mptrack/mod2wave.h Modified: trunk/OpenMPT/mptrack/Mod2wave.cpp =================================================================== --- trunk/OpenMPT/mptrack/Mod2wave.cpp 2014-11-10 13:31:26 UTC (rev 4588) +++ trunk/OpenMPT/mptrack/Mod2wave.cpp 2014-11-10 14:00:54 UTC (rev 4589) @@ -254,9 +254,9 @@ m_EditGenre.Clear(); m_CbnGenre.ResetContent(); m_CbnGenre.AddString(""); - for(std::vector<std::string>::const_iterator genre = encTraits->genres.begin(); genre != encTraits->genres.end(); ++genre) + for(std::vector<mpt::ustring>::const_iterator genre = encTraits->genres.begin(); genre != encTraits->genres.end(); ++genre) { - m_CbnGenre.AddString((*genre).c_str()); + m_CbnGenre.AddString(mpt::ToCString(*genre)); } } else { @@ -272,15 +272,15 @@ void CWaveConvert::OnShowEncoderInfo() //------------------------------------ { - std::string info; - info += "Format: "; + mpt::ustring info; + info += MPT_USTRING("Format: "); info += encTraits->fileDescription; - info += "\r\n"; - info += "Encoder: "; + info += MPT_USTRING("\r\n"); + info += MPT_USTRING("Encoder: "); info += encTraits->encoderName; - info += "\r\n"; - info += mpt::String::Replace(encTraits->description, "\n", "\r\n"); - Reporting::Information(info.c_str(), "Encoder Information"); + info += MPT_USTRING("\r\n"); + info += mpt::String::Replace(encTraits->description, MPT_USTRING("\n"), MPT_USTRING("\r\n")); + Reporting::Information(info, "Encoder Information"); } @@ -292,7 +292,7 @@ for(std::size_t i = 0; i < m_Settings.EncoderFactories.size(); ++i) { const Encoder::Traits &encTraits = m_Settings.EncoderFactories[i]->GetTraits(); - int ndx = m_CbnFileType.AddString(encTraits.fileShortDescription.c_str()); + int ndx = m_CbnFileType.AddString(mpt::ToCString(encTraits.fileShortDescription)); m_CbnFileType.SetItemData(ndx, i); if(m_Settings.EncoderIndex == i) { @@ -431,7 +431,7 @@ // too may formats break; } - int ndx = m_CbnSampleFormat.AddString(format.Description.c_str()); + int ndx = m_CbnSampleFormat.AddString(mpt::ToCString(format.Description)); m_CbnSampleFormat.SetItemData(ndx, i & 0xffff); if(encSettings.Mode & Encoder::ModeEnumerated && (int)i == encSettings.Format) { @@ -789,8 +789,8 @@ } -std::size_t CWaveConvertSettings::FindEncoder(const std::string &name) const -//-------------------------------------------------------------------------- +std::size_t CWaveConvertSettings::FindEncoder(const mpt::ustring &name) const +//--------------------------------------------------------------------------- { for(std::size_t i = 0; i < EncoderFactories.size(); ++i) { @@ -840,7 +840,7 @@ CWaveConvertSettings::CWaveConvertSettings(SettingsContainer &conf, const std::vector<EncoderFactoryBase*> &encFactories) //----------------------------------------------------------------------------------------------------------------------- : EncoderFactories(encFactories) - , EncoderName(conf, "Export", encFactories.size() > 2 ? "LossyEncoder" : "LosslessEncoder", "") + , EncoderName(conf, "Export", encFactories.size() > 2 ? "LossyEncoder" : "LosslessEncoder", MPT_USTRING("")) , EncoderIndex(FindEncoder(EncoderName)) , FinalSampleFormat(SampleFormatInt16) , storedTags(conf) Modified: trunk/OpenMPT/mptrack/Moddoc.cpp =================================================================== --- trunk/OpenMPT/mptrack/Moddoc.cpp 2014-11-10 13:31:26 UTC (rev 4588) +++ trunk/OpenMPT/mptrack/Moddoc.cpp 2014-11-10 14:00:54 UTC (rev 4589) @@ -1664,12 +1664,12 @@ EncoderFactoryBase *encFactory = wsdlg.m_Settings.GetEncoderFactory(); - const std::string extension = encFactory->GetTraits().fileExtension; + const mpt::PathString extension = encFactory->GetTraits().fileExtension; FileDialog dlg = SaveFileDialog() .DefaultExtension(extension) - .DefaultFilename(GetPathNameMpt().GetFileName() + MPT_PATHSTRING(".") + mpt::PathString::FromUTF8(extension)) - .ExtensionFilter(encFactory->GetTraits().fileDescription + " (*." + extension + ")|*." + extension + "||") + .DefaultFilename(GetPathNameMpt().GetFileName() + MPT_PATHSTRING(".") + extension) + .ExtensionFilter(encFactory->GetTraits().fileDescription + MPT_USTRING(" (*.") + extension.ToUnicode() + MPT_USTRING(")|*.") + extension.ToUnicode() + MPT_USTRING("||")) .WorkingDirectory(TrackerDirectories::Instance().GetWorkingDirectory(DIR_EXPORT)); if(!dlg.Show()) return; Modified: trunk/OpenMPT/mptrack/StreamEncoder.cpp =================================================================== --- trunk/OpenMPT/mptrack/StreamEncoder.cpp 2014-11-10 13:31:26 UTC (rev 4588) +++ trunk/OpenMPT/mptrack/StreamEncoder.cpp 2014-11-10 14:00:54 UTC (rev 4589) @@ -28,8 +28,8 @@ } -StreamEncoderSettings::StreamEncoderSettings(SettingsContainer &conf, const std::string §ion) -//----------------------------------------------------------------------------------------------- +StreamEncoderSettings::StreamEncoderSettings(SettingsContainer &conf, const mpt::ustring §ion) +//------------------------------------------------------------------------------------------------ : FLACCompressionLevel(conf, section, "FLACCompressionLevel", 5) , MP3LameQuality(conf, section, "MP3LameQuality", 3) , MP3ACMFast(conf, section, "MP3ACMFast", false) Modified: trunk/OpenMPT/mptrack/StreamEncoder.h =================================================================== --- trunk/OpenMPT/mptrack/StreamEncoder.h 2014-11-10 13:31:26 UTC (rev 4588) +++ trunk/OpenMPT/mptrack/StreamEncoder.h 2014-11-10 14:00:54 UTC (rev 4589) @@ -66,7 +66,7 @@ SampleFormat Sampleformat; int Bitrate; - std::string Description; + mpt::ustring Description; }; enum Mode @@ -85,23 +85,23 @@ { switch(val) { - case Encoder::ModeCBR: return SettingValue("CBR", "Encoder::Mode"); break; - case Encoder::ModeABR: return SettingValue("ABR", "Encoder::Mode"); break; - case Encoder::ModeVBR: return SettingValue("VBR", "Encoder::Mode"); break; - case Encoder::ModeQuality: return SettingValue("Quality", "Encoder::Mode"); break; - case Encoder::ModeEnumerated: return SettingValue("Enumerated", "Encoder::Mode"); break; - default: return SettingValue("Invalid", "Encoder::Mode"); break; + case Encoder::ModeCBR: return SettingValue(MPT_USTRING("CBR"), "Encoder::Mode"); break; + case Encoder::ModeABR: return SettingValue(MPT_USTRING("ABR"), "Encoder::Mode"); break; + case Encoder::ModeVBR: return SettingValue(MPT_USTRING("VBR"), "Encoder::Mode"); break; + case Encoder::ModeQuality: return SettingValue(MPT_USTRING("Quality"), "Encoder::Mode"); break; + case Encoder::ModeEnumerated: return SettingValue(MPT_USTRING("Enumerated"), "Encoder::Mode"); break; + default: return SettingValue(MPT_USTRING("Invalid"), "Encoder::Mode"); break; } } template<> inline Encoder::Mode FromSettingValue(const SettingValue &val) { ASSERT(val.GetTypeTag() == "Encoder::Mode"); - if(val.as<std::string>() == "") { return Encoder::ModeInvalid; } - else if(val.as<std::string>() == "CBR") { return Encoder::ModeCBR; } - else if(val.as<std::string>() == "ABR") { return Encoder::ModeABR; } - else if(val.as<std::string>() == "VBR") { return Encoder::ModeVBR; } - else if(val.as<std::string>() == "Quality") { return Encoder::ModeQuality; } - else if(val.as<std::string>() == "Enumerated") { return Encoder::ModeEnumerated; } + if(val.as<mpt::ustring>() == MPT_USTRING("")) { return Encoder::ModeInvalid; } + else if(val.as<mpt::ustring>() == MPT_USTRING("CBR")) { return Encoder::ModeCBR; } + else if(val.as<mpt::ustring>() == MPT_USTRING("ABR")) { return Encoder::ModeABR; } + else if(val.as<mpt::ustring>() == MPT_USTRING("VBR")) { return Encoder::ModeVBR; } + else if(val.as<mpt::ustring>() == MPT_USTRING("Quality")) { return Encoder::ModeQuality; } + else if(val.as<mpt::ustring>() == MPT_USTRING("Enumerated")) { return Encoder::ModeEnumerated; } else { return Encoder::ModeInvalid; } } @@ -111,15 +111,15 @@ struct Traits { - std::string fileExtension; - std::string fileDescription; - std::string fileShortDescription; - std::string encoderSettingsName; - std::string encoderName; - std::string description; + mpt::PathString fileExtension; + mpt::ustring fileDescription; + mpt::ustring fileShortDescription; + mpt::ustring encoderSettingsName; + mpt::ustring encoderName; + mpt::ustring description; bool canTags; - std::vector<std::string> genres; + std::vector<mpt::ustring> genres; int modesWithFixedGenres; bool canCues; @@ -174,16 +174,16 @@ Setting<int> Format; Setting<int> Dither; - Settings(SettingsContainer &conf, const std::string &encoderName, bool cues, bool tags, uint32 samplerate, uint16 channels, Encoder::Mode mode, int bitrate, float quality, int format, int dither) - : Cues(conf, "Export", encoderName + "_" + "Cues", cues) - , Tags(conf, "Export", encoderName + "_" + "Tags", tags) - , Samplerate(conf, "Export", encoderName + "_" + "Samplerate", samplerate) - , Channels(conf, "Export", encoderName + "_" + "Channels", channels) - , Mode(conf, "Export", encoderName + "_" + "Mode", mode) - , Bitrate(conf, "Export", encoderName + "_" + "Bitrate", bitrate) - , Quality(conf, "Export", encoderName + "_" + "Quality", quality) - , Format(conf, "Export", encoderName + "_" + "Format", format) - , Dither(conf, "Export", encoderName + "_" + "Dither", dither) + Settings(SettingsContainer &conf, const mpt::ustring &encoderName, bool cues, bool tags, uint32 samplerate, uint16 channels, Encoder::Mode mode, int bitrate, float quality, int format, int dither) + : Cues(conf, "Export", encoderName + MPT_USTRING("_") + MPT_USTRING("Cues"), cues) + , Tags(conf, "Export", encoderName + MPT_USTRING("_") + MPT_USTRING("Tags"), tags) + , Samplerate(conf, "Export", encoderName + MPT_USTRING("_") + MPT_USTRING("Samplerate"), samplerate) + , Channels(conf, "Export", encoderName + MPT_USTRING("_") + MPT_USTRING("Channels"), channels) + , Mode(conf, "Export", encoderName + MPT_USTRING("_") + MPT_USTRING("Mode"), mode) + , Bitrate(conf, "Export", encoderName + MPT_USTRING("_") + MPT_USTRING("Bitrate"), bitrate) + , Quality(conf, "Export", encoderName + MPT_USTRING("_") + MPT_USTRING("Quality"), quality) + , Format(conf, "Export", encoderName + MPT_USTRING("_") + MPT_USTRING("Format"), format) + , Dither(conf, "Export", encoderName + MPT_USTRING("_") + MPT_USTRING("Dither"), dither) { return; } @@ -201,7 +201,7 @@ Setting<int32> MP3LameQuality; Setting<bool> MP3ACMFast; Setting<int32> OpusComplexity; - StreamEncoderSettings(SettingsContainer &conf, const std::string §ion); + StreamEncoderSettings(SettingsContainer &conf, const mpt::ustring §ion); static StreamEncoderSettings &Instance(); }; Modified: trunk/OpenMPT/mptrack/StreamEncoderFLAC.cpp =================================================================== --- trunk/OpenMPT/mptrack/StreamEncoderFLAC.cpp 2014-11-10 13:31:26 UTC (rev 4588) +++ trunk/OpenMPT/mptrack/StreamEncoderFLAC.cpp 2014-11-10 14:00:54 UTC (rev 4589) @@ -255,16 +255,16 @@ //------------------------ { Encoder::Traits traits; - traits.fileExtension = "flac"; - traits.fileShortDescription = "FLAC"; - traits.fileDescription = "FLAC"; - traits.encoderSettingsName = "FLAC"; - traits.encoderName = "libFLAC"; - traits.description = ""; - traits.description += mpt::String::Print<std::string>("Free Lossless Audio Codec\n"); - traits.description += mpt::String::Print<std::string>("Vendor: %1\n", FLAC__VENDOR_STRING); - traits.description += mpt::String::Print<std::string>("Version: %1\n", FLAC__VERSION_STRING); - traits.description += mpt::String::Print<std::string>("API: %1.%2.%3\n", FLAC_API_VERSION_CURRENT, FLAC_API_VERSION_REVISION, FLAC_API_VERSION_AGE); + traits.fileExtension = MPT_PATHSTRING("flac"); + traits.fileShortDescription = MPT_USTRING("FLAC"); + traits.fileDescription = MPT_USTRING("FLAC"); + traits.encoderSettingsName = MPT_USTRING("FLAC"); + traits.encoderName = MPT_USTRING("libFLAC"); + traits.description = MPT_USTRING(""); + traits.description += mpt::String::Print(MPT_USTRING("Free Lossless Audio Codec\n")); + traits.description += mpt::String::Print(MPT_USTRING("Vendor: %1\n"), mpt::ToUnicode(mpt::CharsetASCII, FLAC__VENDOR_STRING)); + traits.description += mpt::String::Print(MPT_USTRING("Version: %1\n"), mpt::ToUnicode(mpt::CharsetASCII, FLAC__VERSION_STRING)); + traits.description += mpt::String::Print(MPT_USTRING("API: %1.%2.%3\n"), FLAC_API_VERSION_CURRENT, FLAC_API_VERSION_REVISION, FLAC_API_VERSION_AGE); traits.canTags = true; traits.maxChannels = 4; traits.samplerates = TrackerSettings::Instance().GetSampleRates(); @@ -280,7 +280,7 @@ format.Samplerate = samplerate; format.Channels = channels; format.Sampleformat = (SampleFormat)(bytes * 8); - format.Description = mpt::String::Print("%1 Bit", bytes * 8); + format.Description = mpt::String::Print(MPT_USTRING("%1 Bit"), bytes * 8); format.Bitrate = 0; traits.formats.push_back(format); } Modified: trunk/OpenMPT/mptrack/StreamEncoderMP3.cpp =================================================================== --- trunk/OpenMPT/mptrack/StreamEncoderMP3.cpp 2014-11-10 13:31:26 UTC (rev 4588) +++ trunk/OpenMPT/mptrack/StreamEncoderMP3.cpp 2014-11-10 14:00:54 UTC (rev 4589) @@ -426,7 +426,7 @@ Encoder::Traits &traits = *reinterpret_cast<Encoder::Traits*>(cookie); if(name) { - traits.genres.push_back(name); + traits.genres.push_back(mpt::ToUnicode(mpt::CharsetISO8859_1, name)); } } Encoder::Traits BuildTraits() @@ -436,20 +436,20 @@ { return traits; } - traits.fileExtension = "mp3"; - traits.fileShortDescription = "MP3 (Lame)"; - traits.fileDescription = "MPEG-1/2 Layer 3"; - traits.encoderSettingsName = "MP3Lame"; - traits.encoderName = "libMP3Lame"; - traits.description += "Version: "; - traits.description += (get_lame_version()?get_lame_version():""); - traits.description += "\n"; - traits.description += "Psycho acoustic model version: "; - traits.description += (get_psy_version()?get_psy_version():""); - traits.description += "\n"; - traits.description += "URL: "; - traits.description += (get_lame_url()?get_lame_url():""); - traits.description += "\n"; + traits.fileExtension = MPT_PATHSTRING("mp3"); + traits.fileShortDescription = MPT_USTRING("MP3 (Lame)"); + traits.fileDescription = MPT_USTRING("MPEG-1/2 Layer 3"); + traits.encoderSettingsName = MPT_USTRING("MP3Lame"); + traits.encoderName = MPT_USTRING("libMP3Lame"); + traits.description += MPT_USTRING("Version: "); + traits.description += mpt::ToUnicode(mpt::CharsetASCII, get_lame_version()?get_lame_version():""); + traits.description += MPT_USTRING("\n"); + traits.description += MPT_USTRING("Psycho acoustic model version: "); + traits.description += mpt::ToUnicode(mpt::CharsetASCII, get_psy_version()?get_psy_version():""); + traits.description += MPT_USTRING("\n"); + traits.description += MPT_USTRING("URL: "); + traits.description += mpt::ToUnicode(mpt::CharsetASCII, get_lame_url()?get_lame_url():""); + traits.description += MPT_USTRING("\n"); traits.canTags = true; traits.genres.clear(); id3tag_genre_list(&GenreEnumCallback, &traits); @@ -724,23 +724,23 @@ { return traits; } - traits.fileExtension = "mp3"; - traits.fileShortDescription = std::string("MP3 ") + (lame ? "(Lame_enc)" : "(BladeEnc)"); - traits.fileDescription = "MPEG-1 Layer 3"; - traits.encoderSettingsName = "MP3Blade"; - traits.encoderName = lame ? "Lame_enc.dll" : "BladeEnc.dll"; + traits.fileExtension = MPT_PATHSTRING("mp3"); + traits.fileShortDescription = MPT_USTRING("MP3 ") + (lame ? MPT_USTRING("(Lame_enc)") : MPT_USTRING("(BladeEnc)")); + traits.fileDescription = MPT_USTRING("MPEG-1 Layer 3"); + traits.encoderSettingsName = MPT_USTRING("MP3Blade"); + traits.encoderName = lame ? MPT_USTRING("Lame_enc.dll") : MPT_USTRING("BladeEnc.dll"); BE_VERSION ver; MemsetZero(ver); beVersion(&ver); - traits.description = ""; - traits.description += mpt::String::Print<std::string>("DLL version: %1.%2\n", (int)ver.byDLLMajorVersion, (int)ver.byDLLMinorVersion); - traits.description += mpt::String::Print<std::string>("Engine version: %1.%2 %3-%4-%5\n" + traits.description = MPT_USTRING(""); + traits.description += mpt::String::Print(MPT_USTRING("DLL version: %1.%2\n"), (int)ver.byDLLMajorVersion, (int)ver.byDLLMinorVersion); + traits.description += mpt::String::Print(MPT_USTRING("Engine version: %1.%2 %3-%4-%5\n") , (int)ver.byMajorVersion, (int)ver.byMinorVersion - , mpt::fmt::dec0<4>((int)ver.wYear), mpt::fmt::dec0<2>((int)ver.byMonth), mpt::fmt::dec0<2>((int)ver.byDay) + , mpt::ufmt::dec0<4>((int)ver.wYear), mpt::ufmt::dec0<2>((int)ver.byMonth), mpt::ufmt::dec0<2>((int)ver.byDay) ); std::string url; mpt::String::Copy(url, ver.zHomepage); - traits.description += mpt::String::Print<std::string>("URL: \n", url); + traits.description += mpt::String::Print(MPT_USTRING("URL: %1\n"), mpt::ToUnicode(mpt::CharsetASCII, url)); traits.canTags = true; traits.maxChannels = 2; traits.samplerates = std::vector<uint32>(mpeg1layer3_samplerates, mpeg1layer3_samplerates + CountOf(mpeg1layer3_samplerates));; @@ -1092,7 +1092,7 @@ format.Channels = pafd->pwfx->nChannels; format.Sampleformat = SampleFormatInvalid; format.Bitrate = pafd->pwfx->nAvgBytesPerSec * 8 / 1000; - format.Description = formatName; + format.Description = mpt::ToUnicode(mpt::CharsetLocale, formatName); formats.push_back(format); formats_driverids.push_back(driver); { @@ -1178,21 +1178,21 @@ { return traits; } - traits.fileExtension = "mp3"; - traits.fileShortDescription = "MP3 (ACM)"; - traits.fileDescription = "MPEG Layer 3"; + traits.fileExtension = MPT_PATHSTRING("mp3"); + traits.fileShortDescription = MPT_USTRING("MP3 (ACM)"); + traits.fileDescription = MPT_USTRING("MPEG Layer 3"); DWORD ver = acmGetVersion(); if(ver & 0xffff) { - traits.encoderName = mpt::String::Print<std::string>("%1 %2.%3.%4", "Microsoft Windows ACM", mpt::fmt::hex0<2>((ver>>24)&0xff), mpt::fmt::hex0<2>((ver>>16)&0xff), mpt::fmt::hex0<4>((ver>>0)&0xffff)); + traits.encoderName = mpt::String::Print(MPT_USTRING("%1 %2.%3.%4"), MPT_USTRING("Microsoft Windows ACM"), mpt::ufmt::hex0<2>((ver>>24)&0xff), mpt::ufmt::hex0<2>((ver>>16)&0xff), mpt::ufmt::hex0<4>((ver>>0)&0xffff)); } else { - traits.encoderName = mpt::String::Print<std::string>("%1 %2.%3", "Microsoft Windows ACM", mpt::fmt::hex0<2>((ver>>24)&0xff), mpt::fmt::hex0<2>((ver>>16)&0xff)); + traits.encoderName = mpt::String::Print(MPT_USTRING("%1 %2.%3"), MPT_USTRING("Microsoft Windows ACM"), mpt::ufmt::hex0<2>((ver>>24)&0xff), mpt::ufmt::hex0<2>((ver>>16)&0xff)); } - traits.encoderSettingsName = "MP3ACM"; + traits.encoderSettingsName = MPT_USTRING("MP3ACM"); for(std::set<std::string>::const_iterator i = drivers.begin(); i != drivers.end(); ++i) { - traits.description += (*i); + traits.description += mpt::ToUnicode(mpt::CharsetLocale, (*i)); } traits.canTags = true; traits.maxChannels = 2; Modified: trunk/OpenMPT/mptrack/StreamEncoderOpus.cpp =================================================================== --- trunk/OpenMPT/mptrack/StreamEncoderOpus.cpp 2014-11-10 13:31:26 UTC (rev 4588) +++ trunk/OpenMPT/mptrack/StreamEncoderOpus.cpp 2014-11-10 14:00:54 UTC (rev 4589) @@ -157,14 +157,14 @@ { return traits; } - traits.fileExtension = "opus"; - traits.fileShortDescription = "Opus"; - traits.fileDescription = "Opus"; - traits.encoderSettingsName = "Opus"; - traits.encoderName = "libOpus"; - traits.description += "Version: "; - traits.description += (opus_get_version_string&&opus_get_version_string()?opus_get_version_string():""); - traits.description += "\n"; + traits.fileExtension = MPT_PATHSTRING("opus"); + traits.fileShortDescription = MPT_USTRING("Opus"); + traits.fileDescription = MPT_USTRING("Opus"); + traits.encoderSettingsName = MPT_USTRING("Opus"); + traits.encoderName = MPT_USTRING("libOpus"); + traits.description += MPT_USTRING("Version: "); + traits.description += mpt::ToUnicode(mpt::CharsetASCII, opus_get_version_string && opus_get_version_string() ? opus_get_version_string() : ""); + traits.description += MPT_USTRING("\n"); traits.canTags = true; traits.maxChannels = 4; traits.samplerates = std::vector<uint32>(opus_samplerates, opus_samplerates + CountOf(opus_samplerates)); Modified: trunk/OpenMPT/mptrack/StreamEncoderVorbis.cpp =================================================================== --- trunk/OpenMPT/mptrack/StreamEncoderVorbis.cpp 2014-11-10 13:31:26 UTC (rev 4588) +++ trunk/OpenMPT/mptrack/StreamEncoderVorbis.cpp 2014-11-10 14:00:54 UTC (rev 4589) @@ -173,14 +173,14 @@ { return traits; } - traits.fileExtension = "ogg"; - traits.fileShortDescription = "Vorbis"; - traits.fileDescription = "Ogg Vorbis"; - traits.encoderSettingsName = "Vorbis"; - traits.encoderName = "libVorbis"; - traits.description += "Version: "; - traits.description += (vorbis_version_string&&vorbis_version_string()?vorbis_version_string():"unknown"); - traits.description += "\n"; + traits.fileExtension = MPT_PATHSTRING("ogg"); + traits.fileShortDescription = MPT_USTRING("Vorbis"); + traits.fileDescription = MPT_USTRING("Ogg Vorbis"); + traits.encoderSettingsName = MPT_USTRING("Vorbis"); + traits.encoderName = MPT_USTRING("libVorbis"); + traits.description += MPT_USTRING("Version: "); + traits.description += mpt::ToUnicode(mpt::CharsetASCII, vorbis_version_string&&vorbis_version_string()?vorbis_version_string():"unknown"); + traits.description += MPT_USTRING("\n"); traits.canTags = true; traits.maxChannels = 4; traits.samplerates = std::vector<uint32>(vorbis_samplerates, vorbis_samplerates + CountOf(vorbis_samplerates)); Modified: trunk/OpenMPT/mptrack/StreamEncoderWAV.cpp =================================================================== --- trunk/OpenMPT/mptrack/StreamEncoderWAV.cpp 2014-11-10 13:31:26 UTC (rev 4588) +++ trunk/OpenMPT/mptrack/StreamEncoderWAV.cpp 2014-11-10 14:00:54 UTC (rev 4589) @@ -164,12 +164,12 @@ //---------------------- { Encoder::Traits traits; - traits.fileExtension = "wav"; - traits.fileShortDescription = "Wave"; - traits.fileDescription = "Wave"; - traits.encoderSettingsName = "Wave"; - traits.encoderName = "OpenMPT"; - traits.description = "Microsoft RIFF WAVE"; + traits.fileExtension = MPT_PATHSTRING("wav"); + traits.fileShortDescription = MPT_USTRING("Wave"); + traits.fileDescription = MPT_USTRING("Wave"); + traits.encoderSettingsName = MPT_USTRING("Wave"); + traits.encoderName = MPT_USTRING("OpenMPT"); + traits.description = MPT_USTRING("Microsoft RIFF WAVE"); traits.canTags = true; traits.canCues = true; traits.maxChannels = 4; @@ -188,11 +188,11 @@ if(bytes == 5) { format.Sampleformat = SampleFormatFloat32; - format.Description = "Floating Point"; + format.Description = MPT_USTRING("Floating Point"); } else { format.Sampleformat = (SampleFormat)(bytes * 8); - format.Description = mpt::String::Print("%1 Bit", bytes * 8); + format.Description = mpt::String::Print(MPT_USTRING("%1 Bit"), bytes * 8); } format.Bitrate = 0; traits.formats.push_back(format); Modified: trunk/OpenMPT/mptrack/TrackerSettings.cpp =================================================================== --- trunk/OpenMPT/mptrack/TrackerSettings.cpp 2014-11-10 13:31:26 UTC (rev 4588) +++ trunk/OpenMPT/mptrack/TrackerSettings.cpp 2014-11-10 14:00:54 UTC (rev 4589) @@ -219,7 +219,7 @@ , previewInFileDialogs(conf, "Sample Editor", "PreviewInFileDialogs", false) // Export , ExportDefaultToSoundcardSamplerate(conf, "Export", "DefaultToSoundcardSamplerate", true) - , ExportStreamEncoderSettings(conf, "Export") + , ExportStreamEncoderSettings(conf, MPT_USTRING("Export")) // Components , ComponentsLoadOnStartup(conf, "Components", "LoadOnStartup", ComponentManagerSettingsDefault().LoadOnStartup()) , ComponentsKeepLoaded(conf, "Components", "KeepLoaded", ComponentManagerSettingsDefault().KeepLoaded()) Modified: trunk/OpenMPT/mptrack/mod2wave.h =================================================================== --- trunk/OpenMPT/mptrack/mod2wave.h 2014-11-10 13:31:26 UTC (rev 4588) +++ trunk/OpenMPT/mptrack/mod2wave.h 2014-11-10 14:00:54 UTC (rev 4589) @@ -41,7 +41,7 @@ std::vector<EncoderFactoryBase*> EncoderFactories; std::vector<MPT_SHARED_PTR<Encoder::Settings> > EncoderSettings; - Setting<std::string> EncoderName; + Setting<mpt::ustring> EncoderName; std::size_t EncoderIndex; SampleFormat FinalSampleFormat; @@ -55,7 +55,7 @@ bool Normalize; bool SilencePlugBuffers; - std::size_t FindEncoder(const std::string &name) const; + std::size_t FindEncoder(const mpt::ustring &name) const; void SelectEncoder(std::size_t index); EncoderFactoryBase *GetEncoderFactory() const; const Encoder::Traits *GetTraits() const; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <sag...@us...> - 2014-11-19 21:32:00
|
Revision: 4603 http://sourceforge.net/p/modplug/code/4603 Author: saga-games Date: 2014-11-19 21:31:48 +0000 (Wed, 19 Nov 2014) Log Message: ----------- [Fix] Sample tab: No longer crash when silencing a single sample (http://bugs.openmpt.org/view.php?id=610) [Imp] Song length estimation: When there are multiple subsongs, also display the total length. Modified Paths: -------------- trunk/OpenMPT/mptrack/Ctrl_smp.cpp trunk/OpenMPT/mptrack/Moddoc.cpp Modified: trunk/OpenMPT/mptrack/Ctrl_smp.cpp =================================================================== --- trunk/OpenMPT/mptrack/Ctrl_smp.cpp 2014-11-19 18:09:53 UTC (rev 4602) +++ trunk/OpenMPT/mptrack/Ctrl_smp.cpp 2014-11-19 21:31:48 UTC (rev 4603) @@ -2279,12 +2279,12 @@ SampleSelectionPoints selection = GetSelectionPoints(); // never apply silence to a sample that has no selection - if(selection.selectionActive == true) + const SmpLength len = selection.nEnd - selection.nStart; + if(selection.selectionActive && len > 1) { ModSample &sample = m_sndFile.GetSample(m_nSample); m_modDoc.GetSampleUndo().PrepareUndo(m_nSample, sundo_update, "Silence", selection.nStart, selection.nEnd); - SmpLength len = selection.nEnd - selection.nStart; if (sample.uFlags[CHN_STEREO]) { int smplsize = sample.GetBytesPerSample(); Modified: trunk/OpenMPT/mptrack/Moddoc.cpp =================================================================== --- trunk/OpenMPT/mptrack/Moddoc.cpp 2014-11-19 18:09:53 UTC (rev 4602) +++ trunk/OpenMPT/mptrack/Moddoc.cpp 2014-11-19 21:31:48 UTC (rev 4603) @@ -2224,13 +2224,15 @@ { CString s = _T("Approximate song length: "); std::vector<GetLengthType> lengths = m_SndFile.GetLength(eNoAdjust, GetLengthTarget(true)); + double totalLength = 0.0; for(size_t i = 0; i < lengths.size(); i++) { + double songLength = lengths[i].duration; if(lengths.size() > 1) { - s.AppendFormat(_T("\nSong %u, starting at order %u: "), i + 1, lengths[i].startOrder); + totalLength += songLength; + s.AppendFormat(_T("\nSong %u, starting at order %u:\t"), i + 1, lengths[i].startOrder); } - double songLength = lengths[i].duration; if(songLength != std::numeric_limits<double>::infinity()) { songLength = Util::Round(songLength); @@ -2240,6 +2242,10 @@ s += _T("Song too long!"); } } + if(lengths.size() > 1 && totalLength != std::numeric_limits<double>::infinity()) + { + s.AppendFormat(_T("\n\nTotal length:\t%.0fmn%02.0fs"), std::floor(totalLength / 60.0), std::fmod(totalLength, 60.0)); + } Reporting::Information(s); } @@ -2649,23 +2655,19 @@ CHANNELINDEX CModDoc::FindAvailableChannel() const //------------------------------------------------ { - CHANNELINDEX nStoppedChannel = CHANNELINDEX_INVALID; + CHANNELINDEX stoppedChannel = m_SndFile.GetNumChannels(); // Search for available channel - for(CHANNELINDEX j = MAX_CHANNELS - 1; j >= m_SndFile.m_nChannels; j--) + for(CHANNELINDEX i = MAX_CHANNELS - 1; i >= m_SndFile.GetNumChannels(); i--) { - const ModChannel &chn = m_SndFile.m_PlayState.Chn[j]; + const ModChannel &chn = m_SndFile.m_PlayState.Chn[i]; if(!chn.nLength) - return j; + return i; else if(chn.dwFlags[CHN_NOTEFADE]) - nStoppedChannel = j; + stoppedChannel = i; } - // Nothing found: return one that's stopped - if(nStoppedChannel != CHANNELINDEX_INVALID) - return nStoppedChannel; - - //Last resort: go for first virtual channel. - return m_SndFile.m_nChannels; + // Nothing found: return one that's stopped, or as a last resort, the first virtual channel. + return stoppedChannel; } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <sag...@us...> - 2014-11-20 19:13:27
|
Revision: 4605 http://sourceforge.net/p/modplug/code/4605 Author: saga-games Date: 2014-11-20 19:13:17 +0000 (Thu, 20 Nov 2014) Log Message: ----------- [New] Added treeview context menu options to reload and save all external samples at once (improve the scenario described in http://bugs.openmpt.org/view.php?id=608) Modified Paths: -------------- trunk/OpenMPT/mptrack/Moddoc.cpp trunk/OpenMPT/mptrack/Moddoc.h trunk/OpenMPT/mptrack/View_tre.cpp trunk/OpenMPT/mptrack/View_tre.h trunk/OpenMPT/mptrack/mptrack.rc trunk/OpenMPT/mptrack/resource.h Modified: trunk/OpenMPT/mptrack/Moddoc.cpp =================================================================== --- trunk/OpenMPT/mptrack/Moddoc.cpp 2014-11-19 21:33:29 UTC (rev 4604) +++ trunk/OpenMPT/mptrack/Moddoc.cpp 2014-11-20 19:13:17 UTC (rev 4605) @@ -448,34 +448,42 @@ BOOL result = CDocument::SaveModified(); if(result && m_SndFile.GetType() == MOD_TYPE_MPT) { - std::wstring prompt = L"The following external samples have been modified:\n"; - bool modified = false; - for(SAMPLEINDEX i = 1; i <= m_SndFile.GetNumSamples(); i++) + result = SaveAllSamples() ? TRUE : FALSE; + } + + return result; +} + + +bool CModDoc::SaveAllSamples() +//---------------------------- +{ + std::wstring prompt = L"The following external samples have been modified:\n"; + bool modified = false; + for(SAMPLEINDEX i = 1; i <= m_SndFile.GetNumSamples(); i++) + { + if(m_SndFile.GetSample(i).uFlags.test_all(SMP_KEEPONDISK | SMP_MODIFIED)) { - if(m_SndFile.GetSample(i).uFlags.test_all(SMP_KEEPONDISK | SMP_MODIFIED)) - { - modified = true; - prompt += mpt::wfmt::dec0<2>(i) + L": " + m_SndFile.GetSamplePath(i).ToWide() + L"\n"; - } + modified = true; + prompt += mpt::wfmt::dec0<2>(i) + L": " + m_SndFile.GetSamplePath(i).ToWide() + L"\n"; } + } - ConfirmAnswer ans = cnfYes; - if(modified && (ans = Reporting::Confirm(prompt + L"Do you want to save them?", L"External Samples", true)) == cnfYes) + ConfirmAnswer ans = cnfYes; + if(modified && (ans = Reporting::Confirm(prompt + L"Do you want to save them?", L"External Samples", true)) == cnfYes) + { + for(SAMPLEINDEX i = 1; i <= m_SndFile.GetNumSamples(); i++) { - for(SAMPLEINDEX i = 1; i <= m_SndFile.GetNumSamples(); i++) + if(m_SndFile.GetSample(i).uFlags.test_all(SMP_KEEPONDISK | SMP_MODIFIED)) { - if(m_SndFile.GetSample(i).uFlags.test_all(SMP_KEEPONDISK | SMP_MODIFIED)) - { - SaveSample(i); - } + SaveSample(i); } - } else if(ans == cnfCancel) - { - result = FALSE; } + } else if(ans == cnfCancel) + { + return false; } - - return result; + return true; } Modified: trunk/OpenMPT/mptrack/Moddoc.h =================================================================== --- trunk/OpenMPT/mptrack/Moddoc.h 2014-11-19 21:33:29 UTC (rev 4604) +++ trunk/OpenMPT/mptrack/Moddoc.h 2014-11-20 19:13:17 UTC (rev 4605) @@ -409,6 +409,7 @@ } virtual BOOL SaveModified(); + bool SaveAllSamples(); bool SaveSample(SAMPLEINDEX smp); #ifndef UNICODE Modified: trunk/OpenMPT/mptrack/View_tre.cpp =================================================================== --- trunk/OpenMPT/mptrack/View_tre.cpp 2014-11-19 21:33:29 UTC (rev 4604) +++ trunk/OpenMPT/mptrack/View_tre.cpp 2014-11-20 19:13:17 UTC (rev 4605) @@ -113,7 +113,9 @@ ON_COMMAND(ID_MODTREE_CLOSE, OnCloseItem) ON_COMMAND(ID_MODTREE_SETPATH, OnSetItemPath) ON_COMMAND(ID_MODTREE_SAVEITEM, OnSaveItem) + ON_COMMAND(ID_MODTREE_SAVEALL, OnSaveAll) ON_COMMAND(ID_MODTREE_RELOADITEM, OnReloadItem) + ON_COMMAND(ID_MODTREE_RELOADALL, OnReloadAll) ON_COMMAND(ID_ADD_SOUNDBANK, OnAddDlsBank) ON_COMMAND(ID_IMPORT_MIDILIB, OnImportMidiLib) ON_COMMAND(ID_EXPORT_MIDILIB, OnExportMidiLib) @@ -2566,10 +2568,26 @@ const bool hasPath = sndFile->SampleHasPath(smpID); if((sample.HasSampleData() && sndFile->GetType() == MOD_TYPE_MPT) || hasPath) { + bool anyPath = false, anyModified = false; + for(SAMPLEINDEX smp = 1; smp <= sndFile->GetNumSamples(); smp++) + { + if(sndFile->SampleHasPath(smp) && smp != smpID) + { + anyPath = true; + const ModSample &sample = sndFile->GetSample(smp); + if(sample.HasSampleData() && sample.uFlags[SMP_MODIFIED]) + { + anyModified = true; + } + if(anyPath && anyModified) break; + } + } AppendMenu(hMenu, MF_SEPARATOR, NULL, _T("")); AppendMenu(hMenu, MF_STRING | (sndFile->GetType() == MOD_TYPE_MPT ? 0 : MF_GRAYED), ID_MODTREE_SETPATH, _T("Set P&ath")); AppendMenu(hMenu, MF_STRING | ((hasPath && sample.HasSampleData() && sample.uFlags[SMP_MODIFIED]) ? 0 : MF_GRAYED), ID_MODTREE_SAVEITEM, _T("&Save")); + if(anyModified) AppendMenu(hMenu, MF_STRING, ID_MODTREE_SAVEALL, _T("&Save All")); AppendMenu(hMenu, MF_STRING | (hasPath ? 0 : MF_GRAYED), ID_MODTREE_RELOADITEM, _T("&Reload")); + if(anyPath) AppendMenu(hMenu, MF_STRING, ID_MODTREE_RELOADALL, _T("&Reload All")); } } } @@ -3171,6 +3189,19 @@ } +void CModTree::OnSaveAll() +//------------------------- +{ + CModDoc *pModDoc = GetDocumentFromItem(GetSelectedItem()); + if(pModDoc != nullptr) + { + pModDoc->SaveModified(); + if(pModDoc) pModDoc->UpdateAllViews(NULL, HINT_SAMPLEINFO); + OnRefreshTree(); + } +} + + void CModTree::OnReloadItem() //--------------------------- { @@ -3202,6 +3233,34 @@ } +void CModTree::OnReloadAll() +//-------------------------- +{ + CModDoc *pModDoc = GetDocumentFromItem(GetSelectedItem()); + if(pModDoc != nullptr) + { + CSoundFile &sndFile = pModDoc->GetrSoundFile(); + for(SAMPLEINDEX smp = 1; smp <= sndFile.GetNumSamples(); smp++) + { + pModDoc->GetSampleUndo().PrepareUndo(smp, sundo_replace, "Replace"); + if(!sndFile.LoadExternalSample(smp, sndFile.GetSamplePath(smp))) + { + pModDoc->GetSampleUndo().RemoveLastUndoStep(smp); + Reporting::Error(L"Unable to load sample:\n" + sndFile.GetSamplePath(smp).ToWide()); + } else + { + if(!sndFile.GetSample(smp).uFlags[SMP_KEEPONDISK]) + { + pModDoc->SetModified(); + } + } + } + pModDoc->UpdateAllViews(NULL, HINT_SAMPLEINFO | HINT_SMPNAMES | HINT_SAMPLEDATA); + OnRefreshTree(); + } +} + + void CModTree::OnAddDlsBank() //--------------------------- { Modified: trunk/OpenMPT/mptrack/View_tre.h =================================================================== --- trunk/OpenMPT/mptrack/View_tre.h 2014-11-19 21:33:29 UTC (rev 4604) +++ trunk/OpenMPT/mptrack/View_tre.h 2014-11-20 19:13:17 UTC (rev 4605) @@ -276,7 +276,9 @@ afx_msg void OnSetItemPath(); afx_msg void OnSaveItem(); + afx_msg void OnSaveAll(); afx_msg void OnReloadItem(); + afx_msg void OnReloadAll(); afx_msg void OnAddDlsBank(); afx_msg void OnImportMidiLib(); Modified: trunk/OpenMPT/mptrack/mptrack.rc =================================================================== --- trunk/OpenMPT/mptrack/mptrack.rc 2014-11-19 21:33:29 UTC (rev 4604) +++ trunk/OpenMPT/mptrack/mptrack.rc 2014-11-20 19:13:17 UTC (rev 4605) @@ -1378,7 +1378,7 @@ CTEXT "Rear Right",IDC_STATIC_CHANNEL_REARRIGHT,78,162,48,12,SS_CENTERIMAGE,WS_EX_STATICEDGE COMBOBOX IDC_COMBO_CHANNEL_REARRIGHT,132,162,144,72,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP GROUPBOX "General",IDC_STATIC,6,186,276,30 - LTEXT "&When playback is stoppped:",IDC_STATIC,12,198,90,12,SS_CENTERIMAGE + LTEXT "&When playback is stopped:",IDC_STATIC,12,198,90,12,SS_CENTERIMAGE COMBOBOX IDC_COMBO11,108,198,60,80,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP CONTROL "&Open device at startup",IDC_CHECK7,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,186,198,90,12 GROUPBOX "Stat&istics",IDC_STATIC,6,222,276,55 Modified: trunk/OpenMPT/mptrack/resource.h =================================================================== --- trunk/OpenMPT/mptrack/resource.h 2014-11-19 21:33:29 UTC (rev 4604) +++ trunk/OpenMPT/mptrack/resource.h 2014-11-20 19:13:17 UTC (rev 4605) @@ -1112,6 +1112,8 @@ #define ID_REARRANGE_SAMPLES 33901 #define ID_CHANNEL_MANAGER 33905 #define ID_MODTREE_RELOADITEM 33906 +#define ID_MODTREE_RELOADALL 33907 +#define ID_MODTREE_SAVEALL 33908 #define ID_FACTORYPRESET 33914 #define ID_FACTORYPRESET_DEFAULT 33915 #define ID_MODTREE_SETPATH 33916 This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <sag...@us...> - 2014-11-20 19:30:44
|
Revision: 4606 http://sourceforge.net/p/modplug/code/4606 Author: saga-games Date: 2014-11-20 19:30:23 +0000 (Thu, 20 Nov 2014) Log Message: ----------- [Mod] Also set sample path when batch-saving samples (to ease the use case described in http://bugs.openmpt.org/view.php?id=608) [Fix] Tree view: Call the proper function when saving all samples. Modified Paths: -------------- trunk/OpenMPT/mptrack/Ctrl_smp.cpp trunk/OpenMPT/mptrack/View_tre.cpp Modified: trunk/OpenMPT/mptrack/Ctrl_smp.cpp =================================================================== --- trunk/OpenMPT/mptrack/Ctrl_smp.cpp 2014-11-20 19:13:17 UTC (rev 4605) +++ trunk/OpenMPT/mptrack/Ctrl_smp.cpp 2014-11-20 19:30:23 UTC (rev 4606) @@ -1108,12 +1108,12 @@ const mpt::PathString ext = dlg.GetExtension(); SAMPLEINDEX minSmp = m_nSample, maxSmp = m_nSample; - CString sNumberFormat; + CStringW sNumberFormat; if(doBatchSave) { minSmp = 1; maxSmp = m_sndFile.GetNumSamples(); - sNumberFormat.Format("%s%d%s", "%.", ((int)log10((float)maxSmp)) + 1, "d"); + sNumberFormat.Format(L"%s%d%s", L"%.", ((int)log10((float)maxSmp)) + 1, L"d"); } bool ok = false; @@ -1124,7 +1124,7 @@ mpt::PathString fileName = dlg.GetFirstFile(); if(doBatchSave) { - CString sSampleNumber; + CStringW sSampleNumber; CString sSampleName; CString sSampleFilename; sSampleNumber.Format(sNumberFormat, smp); @@ -1134,9 +1134,11 @@ SanitizeFilename(sSampleName); SanitizeFilename(sSampleFilename); - fileName = mpt::PathString::FromWide(mpt::String::Replace(fileName.ToWide(), L"%sample_number%", mpt::ToWide(sSampleNumber))); - fileName = mpt::PathString::FromWide(mpt::String::Replace(fileName.ToWide(), L"%sample_filename%", mpt::ToWide(sSampleFilename))); - fileName = mpt::PathString::FromWide(mpt::String::Replace(fileName.ToWide(), L"%sample_name%", mpt::ToWide(sSampleName))); + std::wstring fileNameW = fileName.ToWide(); + fileNameW = mpt::String::Replace(fileNameW, L"%sample_number%", sSampleNumber); + fileNameW = mpt::String::Replace(fileNameW, L"%sample_filename%", mpt::ToWide(sSampleFilename)); + fileNameW = mpt::String::Replace(fileNameW, L"%sample_name%", mpt::ToWide(sSampleName)); + fileName = mpt::PathString::FromWide(fileNameW); } if(!mpt::PathString::CompareNoCase(ext, MPT_PATHSTRING("raw"))) ok = m_sndFile.SaveRAWSample(smp, fileName); @@ -1145,7 +1147,7 @@ else ok = m_sndFile.SaveWAVSample(smp, fileName); - if(ok && !doBatchSave) + if(ok) { m_sndFile.SetSamplePath(smp, fileName); ModSample &sample = m_sndFile.GetSample(smp); Modified: trunk/OpenMPT/mptrack/View_tre.cpp =================================================================== --- trunk/OpenMPT/mptrack/View_tre.cpp 2014-11-20 19:13:17 UTC (rev 4605) +++ trunk/OpenMPT/mptrack/View_tre.cpp 2014-11-20 19:30:23 UTC (rev 4606) @@ -3195,7 +3195,7 @@ CModDoc *pModDoc = GetDocumentFromItem(GetSelectedItem()); if(pModDoc != nullptr) { - pModDoc->SaveModified(); + pModDoc->SaveAllSamples(); if(pModDoc) pModDoc->UpdateAllViews(NULL, HINT_SAMPLEINFO); OnRefreshTree(); } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <sag...@us...> - 2014-11-29 15:48:09
|
Revision: 4614 http://sourceforge.net/p/modplug/code/4614 Author: saga-games Date: 2014-11-29 15:47:55 +0000 (Sat, 29 Nov 2014) Log Message: ----------- [New] Sample / instrument tab: Can now specify custom background and selection colours. Modified Paths: -------------- trunk/OpenMPT/mptrack/Moptions.cpp trunk/OpenMPT/mptrack/TrackerSettings.cpp trunk/OpenMPT/mptrack/TrackerSettings.h trunk/OpenMPT/mptrack/View_ins.cpp trunk/OpenMPT/mptrack/View_smp.cpp trunk/OpenMPT/mptrack/View_smp.h Modified: trunk/OpenMPT/mptrack/Moptions.cpp =================================================================== --- trunk/OpenMPT/mptrack/Moptions.cpp 2014-11-29 00:15:19 UTC (rev 4613) +++ trunk/OpenMPT/mptrack/Moptions.cpp 2014-11-29 15:47:55 UTC (rev 4614) @@ -43,8 +43,8 @@ {"Invalid Commands",0, MODCOLOR_DODGY_COMMANDS, 0, 0, "Invalid Note:", NULL, NULL}, {"Channel Separator",0, MODCOLOR_SEPHILITE, MODCOLOR_SEPFACE, MODCOLOR_SEPSHADOW, "Highlight:", "Face:", "Shadow:"}, {"Next/Prev Pattern",0, MODCOLOR_BLENDCOLOR, 0, 0, "Blend Colour:", NULL, NULL}, - {"Sample Editor", 1, MODCOLOR_SAMPLE, 0, 0, "Sample Data:", NULL, NULL}, - {"Instrument Editor",2, MODCOLOR_ENVELOPES, 0, 0, "Envelopes:", NULL, NULL}, + {"Sample Editor", 1, MODCOLOR_SAMPLE, MODCOLOR_BACKSAMPLE, MODCOLOR_SAMPLESELECTED, "Sample Data:", "Background:", "Selection:"}, + {"Instrument Editor",2, MODCOLOR_ENVELOPES, MODCOLOR_BACKENV, 0, "Envelopes:", "Background:", NULL}, {"VU-Meters", 0, MODCOLOR_VUMETER_HI, MODCOLOR_VUMETER_MED, MODCOLOR_VUMETER_LO, "Hi:", "Med:", "Lo:"} }; @@ -244,6 +244,15 @@ p[8] = rgb2quad(CustomColors[MODCOLOR_TEXTPLAYCURSOR]); p[11] = rgb2quad(CustomColors[MODCOLOR_BACKPLAYCURSOR]); break; + // Sample Editor + case 9: + p[0] = rgb2quad(CustomColors[MODCOLOR_BACKSAMPLE]); + p[15] = rgb2quad(CustomColors[MODCOLOR_SAMPLESELECTED]); + break; + // Envelope Editor + case 10: + p[0] = rgb2quad(CustomColors[MODCOLOR_BACKENV]); + break; } HDC hdc = lpdis->hDC; HPEN oldpen = (HPEN)::SelectObject(hdc, CMainFrame::penDarkGray); @@ -420,6 +429,9 @@ CustomColors[MODCOLOR_SEPHILITE] = RGB(0x99, 0x99, 0xCC); CustomColors[MODCOLOR_BLENDCOLOR] = RGB(0x2E, 0x2E, 0x5A); CustomColors[MODCOLOR_DODGY_COMMANDS] = RGB(0xC0, 0x40, 0x40); + CustomColors[MODCOLOR_BACKSAMPLE] = RGB(0x00, 0x00, 0x00); + CustomColors[MODCOLOR_SAMPLESELECTED] = RGB(0xFF, 0xFF, 0xFF); + CustomColors[MODCOLOR_BACKENV] = RGB(0x00, 0x00, 0x00); OnPreviewChanged(); } @@ -453,6 +465,9 @@ CustomColors[MODCOLOR_SEPHILITE] = RGB(0x94, 0xBC, 0x94); CustomColors[MODCOLOR_BLENDCOLOR] = RGB(0x00, 0x40, 0x00); CustomColors[MODCOLOR_DODGY_COMMANDS] = RGB(0xFF, 0x80, 0x80); + CustomColors[MODCOLOR_BACKSAMPLE] = RGB(0x00, 0x00, 0x00); + CustomColors[MODCOLOR_SAMPLESELECTED] = RGB(0xFF, 0xFF, 0xFF); + CustomColors[MODCOLOR_BACKENV] = RGB(0x00, 0x00, 0x00); OnPreviewChanged(); } @@ -485,6 +500,9 @@ CustomColors[MODCOLOR_SEPHILITE] = RGB(0xEC, 0xE8, 0xE1); CustomColors[MODCOLOR_BLENDCOLOR] = RGB(0xE1, 0xDB, 0xD0); CustomColors[MODCOLOR_DODGY_COMMANDS] = RGB(0xC0, 0x00, 0x00); + CustomColors[MODCOLOR_BACKSAMPLE] = RGB(0x00, 0x00, 0x00); + CustomColors[MODCOLOR_SAMPLESELECTED] = RGB(0xFF, 0xFF, 0xFF); + CustomColors[MODCOLOR_BACKENV] = RGB(0x00, 0x00, 0x00); OnPreviewChanged(); } Modified: trunk/OpenMPT/mptrack/TrackerSettings.cpp =================================================================== --- trunk/OpenMPT/mptrack/TrackerSettings.cpp 2014-11-29 00:15:19 UTC (rev 4613) +++ trunk/OpenMPT/mptrack/TrackerSettings.cpp 2014-11-29 15:47:55 UTC (rev 4614) @@ -785,6 +785,10 @@ colours[MODCOLOR_BLENDCOLOR] = GetSysColor(COLOR_BTNFACE); // Dodgy commands colours[MODCOLOR_DODGY_COMMANDS] = RGB(0xC0, 0x00, 0x00); + // Sample / instrument editor + colours[MODCOLOR_BACKSAMPLE] = RGB(0x00, 0x00, 0x00); + colours[MODCOLOR_SAMPLESELECTED] = RGB(0xFF, 0xFF, 0xFF); + colours[MODCOLOR_BACKENV] = RGB(0x00, 0x00, 0x00); } Modified: trunk/OpenMPT/mptrack/TrackerSettings.h =================================================================== --- trunk/OpenMPT/mptrack/TrackerSettings.h 2014-11-29 00:15:19 UTC (rev 4613) +++ trunk/OpenMPT/mptrack/TrackerSettings.h 2014-11-29 15:47:55 UTC (rev 4614) @@ -73,6 +73,9 @@ MODCOLOR_SEPHILITE, MODCOLOR_BLENDCOLOR, MODCOLOR_DODGY_COMMANDS, + MODCOLOR_BACKSAMPLE, + MODCOLOR_SAMPLESELECTED, + MODCOLOR_BACKENV, MAX_MODCOLORS, // Internal color codes (not saved to color preset files) MODCOLOR_2NDHIGHLIGHT, Modified: trunk/OpenMPT/mptrack/View_ins.cpp =================================================================== --- trunk/OpenMPT/mptrack/View_ins.cpp 2014-11-29 00:15:19 UTC (rev 4613) +++ trunk/OpenMPT/mptrack/View_ins.cpp 2014-11-29 15:47:55 UTC (rev 4614) @@ -832,7 +832,7 @@ } // Paint it black! - m_dcGrid.FillSolidRect(&m_rcClient, 0); + m_dcGrid.FillSolidRect(&m_rcClient, TrackerSettings::Instance().rgbCustomColors[MODCOLOR_BACKENV]); for (int x = 3; x < width; x++) { @@ -900,7 +900,7 @@ } else { // Paint it black! - m_dcMemMain.FillSolidRect(&m_rcClient, 0); + m_dcMemMain.FillSolidRect(&m_rcClient, TrackerSettings::Instance().rgbCustomColors[MODCOLOR_BACKENV]); } // Middle line (half volume or pitch / panning center) Modified: trunk/OpenMPT/mptrack/View_smp.cpp =================================================================== --- trunk/OpenMPT/mptrack/View_smp.cpp 2014-11-29 00:15:19 UTC (rev 4613) +++ trunk/OpenMPT/mptrack/View_smp.cpp 2014-11-29 15:47:55 UTC (rev 4614) @@ -26,9 +26,7 @@ #include "../soundlib/FileReader.h" #include "../soundlib/SampleFormatConverters.h" -#define new DEBUG_NEW - OPENMPT_NAMESPACE_BEGIN @@ -137,16 +135,14 @@ m_lastDrawPoint.SetPoint(-1, -1); noteChannel.assign(NOTE_MAX - NOTE_MIN + 1, CHANNELINDEX_INVALID); - offScreenDC = nullptr; - offScreenBitmap = nullptr; } CViewSample::~CViewSample() //------------------------- { - DeleteObject(offScreenBitmap); - DeleteDC(offScreenDC); + offScreenBitmap.DeleteObject(); + offScreenDC.DeleteDC(); } @@ -1036,7 +1032,7 @@ CModDoc *pModDoc = GetDocument(); HGDIOBJ oldpen; - UINT nSmpScrollPos = ScrollPosToSamplePos(); + const SmpLength nSmpScrollPos = ScrollPosToSamplePos(); if ((!pModDoc) || (!pDC)) return; @@ -1044,15 +1040,14 @@ const ModSample &sample = sndFile.GetSample((m_nSample <= sndFile.GetNumSamples()) ? m_nSample : 0); // Create off-screen image - if(offScreenDC == nullptr) + if(offScreenDC.m_hDC == nullptr) { - offScreenDC = CreateCompatibleDC(pDC->m_hDC); - offScreenBitmap = CreateCompatibleBitmap(pDC->m_hDC, m_rcClient.Width(), m_rcClient.Height()); - SelectObject(offScreenDC, offScreenBitmap); + offScreenDC.CreateCompatibleDC(pDC); + offScreenBitmap.CreateCompatibleBitmap(pDC, m_rcClient.Width(), m_rcClient.Height()); + offScreenDC.SelectObject(offScreenBitmap); } - offScreenDC = offScreenDC; - oldpen = ::SelectObject(offScreenDC, CMainFrame::penBlack); + oldpen = offScreenDC.SelectObject(CMainFrame::penBlack); rect = rcClient; if ((rcClient.bottom > rcClient.top) && (rcClient.right > rcClient.left)) { @@ -1067,32 +1062,32 @@ { rc.right = SampleToScreen(m_dwBeginSel); if (rc.right > rcClient.right) rc.right = rcClient.right; - if (rc.right > rc.left) ::FillRect(offScreenDC, &rc, CMainFrame::brushBlack); + if (rc.right > rc.left) offScreenDC.FillSolidRect(&rc, TrackerSettings::Instance().rgbCustomColors[MODCOLOR_BACKSAMPLE]); rc.left = rc.right; } if (rc.left < 0) rc.left = 0; rc.right = SampleToScreen(m_dwEndSel) + 1; if (rc.right > rcClient.right) rc.right = rcClient.right; - if (rc.right > rc.left) ::FillRect(offScreenDC, &rc, CMainFrame::brushWhite); + if (rc.right > rc.left) offScreenDC.FillSolidRect(&rc, TrackerSettings::Instance().rgbCustomColors[MODCOLOR_SAMPLESELECTED]); rc.left = rc.right; if (rc.left < 0) rc.left = 0; rc.right = rcClient.right; - if (rc.right > rc.left) ::FillRect(offScreenDC, &rc, CMainFrame::brushBlack); + if (rc.right > rc.left) offScreenDC.FillSolidRect(&rc, TrackerSettings::Instance().rgbCustomColors[MODCOLOR_BACKSAMPLE]); } else { - ::FillRect(offScreenDC, &rcClient, CMainFrame::brushBlack); + offScreenDC.FillSolidRect(&rcClient, TrackerSettings::Instance().rgbCustomColors[MODCOLOR_BACKSAMPLE]); } - ::SelectObject(offScreenDC, CMainFrame::penDarkGray); + offScreenDC.SelectObject(CMainFrame::penDarkGray); if (sample.uFlags[CHN_STEREO]) { - ::MoveToEx(offScreenDC, 0, ymed-yrange/2, NULL); - ::LineTo(offScreenDC, rcClient.right, ymed-yrange/2); - ::MoveToEx(offScreenDC, 0, ymed+yrange/2, NULL); - ::LineTo(offScreenDC, rcClient.right, ymed+yrange/2); + offScreenDC.MoveTo(0, ymed - yrange / 2); + offScreenDC.LineTo(rcClient.right, ymed - yrange / 2); + offScreenDC.MoveTo(0, ymed + yrange / 2); + offScreenDC.LineTo(rcClient.right, ymed + yrange / 2); } else { - ::MoveToEx(offScreenDC, 0, ymed, NULL); - ::LineTo(offScreenDC, rcClient.right, ymed); + offScreenDC.MoveTo(0, ymed); + offScreenDC.LineTo(rcClient.right, ymed); } // Drawing sample if ((sample.pSample) && (yrange) && (sample.nLength > 1) && (rect.right > 1)) @@ -1103,35 +1098,35 @@ int xl = SampleToScreen(sample.nLoopStart); if ((xl >= 0) && (xl < rcClient.right)) { - ::MoveToEx(offScreenDC, xl, rect.top, NULL); - ::LineTo(offScreenDC, xl, rect.bottom); + offScreenDC.MoveTo(xl, rect.top); + offScreenDC.LineTo(xl, rect.bottom); } xl = SampleToScreen(sample.nLoopEnd); if ((xl >= 0) && (xl < rcClient.right)) { - ::MoveToEx(offScreenDC, xl, rect.top, NULL); - ::LineTo(offScreenDC, xl, rect.bottom); + offScreenDC.MoveTo(xl, rect.top); + offScreenDC.LineTo(xl, rect.bottom); } } // Sustain Loop Start/End if ((sample.nSustainEnd > nSmpScrollPos) && (sample.nSustainEnd > sample.nSustainStart)) { - ::SelectObject(offScreenDC, CMainFrame::penHalfDarkGray); + offScreenDC.SelectObject(CMainFrame::penHalfDarkGray); int xl = SampleToScreen(sample.nSustainStart); if ((xl >= 0) && (xl < rcClient.right)) { - ::MoveToEx(offScreenDC, xl, rect.top, NULL); - ::LineTo(offScreenDC, xl, rect.bottom); + offScreenDC.MoveTo(xl, rect.top); + offScreenDC.LineTo(xl, rect.bottom); } xl = SampleToScreen(sample.nSustainEnd); if ((xl >= 0) && (xl < rcClient.right)) { - ::MoveToEx(offScreenDC, xl, rect.top, NULL); - ::LineTo(offScreenDC, xl, rect.bottom); + offScreenDC.MoveTo(xl, rect.top); + offScreenDC.LineTo(xl, rect.bottom); } } // Drawing Sample Data - ::SelectObject(offScreenDC, CMainFrame::penSample); + offScreenDC.SelectObject(CMainFrame::penSample); int smplsize = sample.GetBytesPerSample(); if (m_nZoom == 1 || m_nZoom < 0 || ((!m_nZoom) && (sample.nLength <= (SmpLength)rect.Width()))) { @@ -1172,14 +1167,14 @@ if(m_nGridSegments && m_nGridSegments < sample.nLength) { // Draw sample grid - ::SelectObject(offScreenDC, CMainFrame::penHalfDarkGray); + offScreenDC.SelectObject(CMainFrame::penHalfDarkGray); for(SmpLength i = 1; i < m_nGridSegments; i++) { int screenPos = SampleToScreen(sample.nLength * i / m_nGridSegments); if(screenPos >= rect.left && screenPos <= rect.right) { - ::MoveToEx(offScreenDC, screenPos, rect.top, nullptr); - ::LineTo(offScreenDC, screenPos, rect.bottom); + offScreenDC.MoveTo(screenPos, rect.top); + offScreenDC.LineTo(screenPos, rect.bottom); } } } @@ -1188,7 +1183,7 @@ BitBlt(pDC->m_hDC, m_rcClient.left, m_rcClient.top, m_rcClient.Width(), m_rcClient.Height(), offScreenDC, 0, 0, SRCCOPY); - if (oldpen) ::SelectObject(offScreenDC, oldpen); + if (oldpen) offScreenDC.SelectObject(oldpen); CMainFrame *pMainFrm = CMainFrame::GetMainFrame(); bool activeDoc = pMainFrm ? pMainFrm->GetActiveDoc() == GetDocument() : false; @@ -1212,7 +1207,7 @@ rect.left = SampleToScreen(m_dwNotifyPos[i]); rect.right = rect.left + 1; rect.bottom = m_rcClient.bottom + 1; - if ((rect.right >= 0) && (rect.right < m_rcClient.right)) InvertRect(offScreenDC, &rect); + if ((rect.right >= 0) && (rect.right < m_rcClient.right)) offScreenDC.InvertRect(&rect); } } @@ -1445,10 +1440,8 @@ { CModScrollView::OnSize(nType, cx, cy); - DeleteObject(offScreenBitmap); - DeleteDC(offScreenDC); - offScreenBitmap = nullptr; - offScreenDC = nullptr; + offScreenBitmap.DeleteObject(); + offScreenDC.DeleteDC(); if (((nType == SIZE_RESTORED) || (nType == SIZE_MAXIMIZED)) && (cx > 0) && (cy > 0)) { Modified: trunk/OpenMPT/mptrack/View_smp.h =================================================================== --- trunk/OpenMPT/mptrack/View_smp.h 2014-11-29 00:15:19 UTC (rev 4613) +++ trunk/OpenMPT/mptrack/View_smp.h 2014-11-29 15:47:55 UTC (rev 4614) @@ -36,8 +36,8 @@ protected: CImageList m_bmpEnvBar; CRect m_rcClient; - HDC offScreenDC; - HGDIOBJ offScreenBitmap; + CDC offScreenDC; + CBitmap offScreenBitmap; SIZE m_sizeTotal; UINT m_nBtnMouseOver; int m_nZoom; // < 0: Zoom into sample (2^x:1 ratio), 0: Auto zoom, > 0: Zoom out (1:2^x ratio) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <man...@us...> - 2014-11-29 17:10:18
|
Revision: 4616 http://sourceforge.net/p/modplug/code/4616 Author: manxorist Date: 2014-11-29 17:10:04 +0000 (Sat, 29 Nov 2014) Log Message: ----------- [Imp] Stream export: Support more variants of Lame_enc and OggOpus codec dll names. Modified Paths: -------------- trunk/OpenMPT/mptrack/StreamEncoderMP3.cpp trunk/OpenMPT/mptrack/StreamEncoderOpus.cpp Modified: trunk/OpenMPT/mptrack/StreamEncoderMP3.cpp =================================================================== --- trunk/OpenMPT/mptrack/StreamEncoderMP3.cpp 2014-11-29 17:00:20 UTC (rev 4615) +++ trunk/OpenMPT/mptrack/StreamEncoderMP3.cpp 2014-11-29 17:10:04 UTC (rev 4616) @@ -648,7 +648,8 @@ public: - int lame; + bool isLame; + mpt::PathString encoderDLL; VOID (*beVersion) (PBE_VERSION); BE_ERR (*beInitStream) (PBE_CONFIG, PDWORD, PDWORD, PHBE_STREAM); @@ -661,13 +662,15 @@ void Reset() { ClearLibraries(); - lame = 0; + isLame = false; + encoderDLL = mpt::PathString(); } public: ComponentBlade() : ComponentBase(ComponentTypeForeign, false) + , isLame(false) { return; } @@ -681,11 +684,18 @@ Reset(); if(TryLoad(MPT_PATHSTRING("lame_enc"))) { - lame = 1; + isLame = true; + encoderDLL = MPT_PATHSTRING("lame_enc"); return true; + } else if(TryLoad(MPT_PATHSTRING("BladeMP3EncDLL"))) + { + isLame = true; + encoderDLL = MPT_PATHSTRING("BladeMP3EncDLL"); + return true; } else if(TryLoad(MPT_PATHSTRING("bladeenc"))) { - lame = 0; + isLame = false; + encoderDLL = MPT_PATHSTRING("bladeenc"); return true; } return false; @@ -725,10 +735,10 @@ return traits; } traits.fileExtension = MPT_PATHSTRING("mp3"); - traits.fileShortDescription = MPT_USTRING("MP3 ") + (lame ? MPT_USTRING("(Lame_enc)") : MPT_USTRING("(BladeEnc)")); + traits.fileShortDescription = MPT_USTRING("MP3 ") + (isLame ? MPT_USTRING("(Lame_enc)") : MPT_USTRING("(BladeEnc)")); traits.fileDescription = MPT_USTRING("MPEG-1 Layer 3"); traits.encoderSettingsName = MPT_USTRING("MP3Blade"); - traits.encoderName = lame ? MPT_USTRING("Lame_enc.dll") : MPT_USTRING("BladeEnc.dll"); + traits.encoderName = mpt::String::Print(MPT_USTRING("%1.dll\n"), encoderDLL.ToUnicode()); BE_VERSION ver; MemsetZero(ver); beVersion(&ver); Modified: trunk/OpenMPT/mptrack/StreamEncoderOpus.cpp =================================================================== --- trunk/OpenMPT/mptrack/StreamEncoderOpus.cpp 2014-11-29 17:00:20 UTC (rev 4615) +++ trunk/OpenMPT/mptrack/StreamEncoderOpus.cpp 2014-11-29 17:10:04 UTC (rev 4616) @@ -99,7 +99,9 @@ { "opus" , "opus" }, { "libogg-0" , "libopus-0" }, // official xiph.org builds { "libogg" , "libopus" }, - { "ogg" , "opus" } + { "ogg" , "opus" }, + { "libogg" , "opus" }, + { "ogg" , "libopus" } }; bool ok = false; for(std::size_t i=0; i<CountOf(dll_names); ++i) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <sag...@us...> - 2014-11-30 02:02:20
|
Revision: 4618 http://sourceforge.net/p/modplug/code/4618 Author: saga-games Date: 2014-11-30 02:02:03 +0000 (Sun, 30 Nov 2014) Log Message: ----------- [New] Tree view: Added context menu item to scan a folder for missing external samples [Ref] Move reusable folder scanning code to its own FolderScanner class Modified Paths: -------------- trunk/OpenMPT/mptrack/SelectPluginDialog.cpp trunk/OpenMPT/mptrack/View_tre.cpp trunk/OpenMPT/mptrack/View_tre.h trunk/OpenMPT/mptrack/mptrack_08.vcproj trunk/OpenMPT/mptrack/mptrack_10.vcxproj trunk/OpenMPT/mptrack/mptrack_10.vcxproj.filters trunk/OpenMPT/mptrack/resource.h Added Paths: ----------- trunk/OpenMPT/mptrack/FolderScanner.cpp trunk/OpenMPT/mptrack/FolderScanner.h Added: trunk/OpenMPT/mptrack/FolderScanner.cpp =================================================================== --- trunk/OpenMPT/mptrack/FolderScanner.cpp (rev 0) +++ trunk/OpenMPT/mptrack/FolderScanner.cpp 2014-11-30 02:02:03 UTC (rev 4618) @@ -0,0 +1,76 @@ +/* + * FolderScanner.cpp + * ----------------- + * Purpose: Class for finding files in folders. + * Notes : (currently none) + * Authors: OpenMPT Devs + * The OpenMPT source code is released under the BSD license. Read LICENSE for more details. + */ + + +#include "stdafx.h" +#include "FolderScanner.h" + +OPENMPT_NAMESPACE_BEGIN + +FolderScanner::FolderScanner(const mpt::PathString &path, bool findInSubDirs) : paths(1, path), findInSubDirs(findInSubDirs), hFind(INVALID_HANDLE_VALUE) +//------------------------------------------------------------------------------------------------------------------------------------------------------- +{ + MemsetZero(wfd); +} + + +FolderScanner::~FolderScanner() +//----------------------------- +{ + FindClose(hFind); +} + + +// Return one file at a time in parameter file. Returns true if a file was found (file parameter is valid), false if no more files can be found. +bool FolderScanner::NextFile(mpt::PathString &file) +//------------------------------------------------- +{ + bool foundFile = false; + do + { + if(hFind == INVALID_HANDLE_VALUE) + { + if(paths.empty()) + { + return false; + } + + currentPath = paths.back(); + paths.pop_back(); + if(!currentPath.HasTrailingSlash()) currentPath += MPT_PATHSTRING("\\"); + hFind = FindFirstFileW((currentPath + MPT_PATHSTRING("*.*")).AsNative().c_str(), &wfd); + } + + BOOL nextFile = FALSE; + do + { + file = currentPath + mpt::PathString::FromNative(wfd.cFileName); + if(wfd.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) + { + if(findInSubDirs && wcscmp(wfd.cFileName, L"..") && wcscmp(wfd.cFileName, L".")) + { + // Add sub directory + paths.push_back(file); + } + } else + { + foundFile = true; + } + } while((nextFile = FindNextFileW(hFind, &wfd)) != FALSE && !foundFile); + if(nextFile == FALSE) + { + // Done with this directory, advance to next + FindClose(hFind); + hFind = INVALID_HANDLE_VALUE; + } + } while(!foundFile); + return true; +} + +OPENMPT_NAMESPACE_END Property changes on: trunk/OpenMPT/mptrack/FolderScanner.cpp ___________________________________________________________________ Added: svn:mime-type ## -0,0 +1 ## +text/x-c++src \ No newline at end of property Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: trunk/OpenMPT/mptrack/FolderScanner.h =================================================================== --- trunk/OpenMPT/mptrack/FolderScanner.h (rev 0) +++ trunk/OpenMPT/mptrack/FolderScanner.h 2014-11-30 02:02:03 UTC (rev 4618) @@ -0,0 +1,32 @@ +/* + * FolderScanner.h + * --------------- + * Purpose: Class for finding files in folders. + * Notes : (currently none) + * Authors: OpenMPT Devs + * The OpenMPT source code is released under the BSD license. Read LICENSE for more details. + */ + + +#pragma once + +#include "../common/mptPathString.h" + +OPENMPT_NAMESPACE_BEGIN + +class FolderScanner +{ +protected: + std::vector<mpt::PathString> paths; + mpt::PathString currentPath; + HANDLE hFind; + WIN32_FIND_DATAW wfd; + bool findInSubDirs; + +public: + FolderScanner(const mpt::PathString &path, bool findInSubDirs); + ~FolderScanner(); + bool NextFile(mpt::PathString &file); +}; + +OPENMPT_NAMESPACE_END Property changes on: trunk/OpenMPT/mptrack/FolderScanner.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/SelectPluginDialog.cpp =================================================================== --- trunk/OpenMPT/mptrack/SelectPluginDialog.cpp 2014-11-29 21:12:56 UTC (rev 4617) +++ trunk/OpenMPT/mptrack/SelectPluginDialog.cpp 2014-11-30 02:02:03 UTC (rev 4618) @@ -19,6 +19,7 @@ #include "Vstplug.h" #include "SelectPluginDialog.h" #include "../pluginBridge/BridgeWrapper.h" +#include "FolderScanner.h" OPENMPT_NAMESPACE_BEGIN @@ -623,58 +624,36 @@ pluginScanDlg.CenterWindow(this); pluginScanDlg.ShowWindow(SW_SHOW); - std::vector<mpt::PathString> paths(1, dlg.GetDirectory()); + FolderScanner scan(dlg.GetDirectory(), true); + mpt::PathString fileName; int files = 0; - while(!paths.empty()) + while(scan.NextFile(fileName)) { - HANDLE hFind; - WIN32_FIND_DATAW wfd; - MemsetZero(wfd); - - mpt::PathString path = paths.back(); - paths.pop_back(); - if(!path.HasTrailingSlash()) path += MPT_PATHSTRING("\\"); - if((hFind = FindFirstFileW((path + MPT_PATHSTRING("*.*")).AsNative().c_str(), &wfd)) != INVALID_HANDLE_VALUE) + if(!mpt::PathString::CompareNoCase(fileName.GetFileExt(), MPT_PATHSTRING(".dll"))) { - do + CWnd *text = pluginScanDlg.GetDlgItem(IDC_SCANTEXT); + std::wstring scanStr = L"Scanning Plugin...\n" + fileName.ToWide(); + SetWindowTextW(text->m_hWnd, scanStr.c_str()); + MSG msg; + while(::PeekMessage(&msg, NULL, 0, 0, PM_REMOVE)) { - mpt::PathString fileName = path + mpt::PathString::FromNative(wfd.cFileName); - if(wfd.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) + ::TranslateMessage(&msg); + ::DispatchMessage(&msg); + } + + VSTPluginLib *lib = pManager->AddPlugin(fileName, false); + if(lib) + { + update = true; + if(!VerifyPlug(lib)) { - if(wcscmp(wfd.cFileName, L"..") - && wcscmp(wfd.cFileName, L".")) - { - paths.push_back(fileName); - } - continue; - } else if(!mpt::PathString::CompareNoCase(fileName.GetFileExt(), MPT_PATHSTRING(".dll"))) + pManager->RemovePlugin(lib); + } else { - CWnd *text = pluginScanDlg.GetDlgItem(IDC_SCANTEXT); - std::wstring scanStr = L"Scanning Plugin...\n" + fileName.ToWide(); - SetWindowTextW(text->m_hWnd, scanStr.c_str()); - MSG msg; - while(::PeekMessage(&msg, NULL, 0, 0, PM_REMOVE)) - { - ::TranslateMessage(&msg); - ::DispatchMessage(&msg); - } - - VSTPluginLib *lib = pManager->AddPlugin(fileName, false); - if(lib) - { - update = true; - if(!VerifyPlug(lib)) - { - pManager->RemovePlugin(lib); - } else - { - plugLib = lib; - files++; - } - } + plugLib = lib; + files++; } - } while (FindNextFileW(hFind, &wfd)); - FindClose(hFind); + } } } Modified: trunk/OpenMPT/mptrack/View_tre.cpp =================================================================== --- trunk/OpenMPT/mptrack/View_tre.cpp 2014-11-29 21:12:56 UTC (rev 4617) +++ trunk/OpenMPT/mptrack/View_tre.cpp 2014-11-30 02:02:03 UTC (rev 4618) @@ -22,6 +22,7 @@ #include "../soundlib/FileReader.h" #include "FileDialog.h" #include "Globals.h" +#include "FolderScanner.h" OPENMPT_NAMESPACE_BEGIN @@ -116,6 +117,7 @@ ON_COMMAND(ID_MODTREE_SAVEALL, OnSaveAll) ON_COMMAND(ID_MODTREE_RELOADITEM, OnReloadItem) ON_COMMAND(ID_MODTREE_RELOADALL, OnReloadAll) + ON_COMMAND(ID_MODTREE_FINDMISSING, OnFindMissing) ON_COMMAND(ID_ADD_SOUNDBANK, OnAddDlsBank) ON_COMMAND(ID_IMPORT_MIDILIB, OnImportMidiLib) ON_COMMAND(ID_EXPORT_MIDILIB, OnExportMidiLib) @@ -1308,7 +1310,7 @@ case MODITEM_HDR_INSTRUMENTLIB: if(IsSampleBrowser()) { - BrowseForFolder dlg(m_InstrLibPath, TEXT("Select a new instrument library folder...")); + BrowseForFolder dlg(m_InstrLibPath, _T("Select a new instrument library folder...")); if(dlg.Show()) { mpt::PathString dir = dlg.GetDirectory(); @@ -2568,22 +2570,26 @@ const bool hasPath = sndFile->SampleHasPath(smpID); const bool menuForThisSample = (sample.HasSampleData() && sndFile->GetType() == MOD_TYPE_MPT) || hasPath; - bool anyPath = false, anyModified = false; + bool anyPath = false, anyModified = false, anyMissing = false; for(SAMPLEINDEX smp = 1; smp <= sndFile->GetNumSamples(); smp++) { + const ModSample &sample = sndFile->GetSample(smp); if(sndFile->SampleHasPath(smp) && smp != smpID) { anyPath = true; - const ModSample &sample = sndFile->GetSample(smp); if(sample.HasSampleData() && sample.uFlags[SMP_MODIFIED]) { anyModified = true; } - if(anyPath && anyModified) break; } + if(sample.uFlags[SMP_KEEPONDISK] && sample.pSample == nullptr) + { + anyMissing = true; + } + if(anyPath && anyModified && anyMissing) break; } - if(menuForThisSample || anyPath || anyModified) + if(menuForThisSample || anyPath || anyModified || anyMissing) { AppendMenu(hMenu, MF_SEPARATOR, NULL, _T("")); if(menuForThisSample) AppendMenu(hMenu, MF_STRING | (sndFile->GetType() == MOD_TYPE_MPT ? 0 : MF_GRAYED), ID_MODTREE_SETPATH, _T("Set P&ath")); @@ -2591,6 +2597,7 @@ if(anyModified) AppendMenu(hMenu, MF_STRING, ID_MODTREE_SAVEALL, _T("&Save All")); if(menuForThisSample) AppendMenu(hMenu, MF_STRING | (hasPath ? 0 : MF_GRAYED), ID_MODTREE_RELOADITEM, _T("&Reload")); if(anyPath) AppendMenu(hMenu, MF_STRING, ID_MODTREE_RELOADALL, _T("&Reload All")); + if(anyMissing) AppendMenu(hMenu, MF_STRING, ID_MODTREE_FINDMISSING, _T("&Find Missing Samples")); } } } @@ -3264,6 +3271,58 @@ } +// Find missing external samples +void CModTree::OnFindMissing() +//---------------------------- +{ + CModDoc *pModDoc = GetDocumentFromItem(GetSelectedItem()); + if(pModDoc == nullptr) + { + return; + } + BrowseForFolder dlg(TrackerDirectories::Instance().GetWorkingDirectory(DIR_SAMPLES), _T("Select a folder to search for missing samples...")); + int foundFiles = 0; + if(dlg.Show()) + { + FolderScanner scan(dlg.GetDirectory(), true); + mpt::PathString fileName; + CSoundFile &sndFile = pModDoc->GetrSoundFile(); + + BeginWaitCursor(); + while(scan.NextFile(fileName)) + { + for(SAMPLEINDEX smp = 1; smp <= sndFile.GetNumSamples(); smp++) + { + ModSample &sample = sndFile.GetSample(smp); + if(sample.uFlags[SMP_KEEPONDISK] && sample.pSample == nullptr && !mpt::PathString::CompareNoCase(sndFile.GetSamplePath(smp).GetFullFileName(), fileName.GetFullFileName())) + { + pModDoc->GetSampleUndo().PrepareUndo(smp, sundo_replace, "Replace"); + if(!sndFile.LoadExternalSample(smp, fileName)) + { + pModDoc->GetSampleUndo().RemoveLastUndoStep(smp); + } else + { + pModDoc->SetModified(); + foundFiles++; + } + } + } + } + EndWaitCursor(); + } + pModDoc->UpdateAllViews(NULL, HINT_SAMPLEINFO | HINT_SMPNAMES | HINT_SAMPLEDATA); + OnRefreshTree(); + + if(foundFiles) + { + Reporting::Information(mpt::String::Print("%1 sample paths were relocated.", foundFiles)); + } else + { + Reporting::Information("No matching sample names found."); + } +} + + void CModTree::OnAddDlsBank() //--------------------------- { Modified: trunk/OpenMPT/mptrack/View_tre.h =================================================================== --- trunk/OpenMPT/mptrack/View_tre.h 2014-11-29 21:12:56 UTC (rev 4617) +++ trunk/OpenMPT/mptrack/View_tre.h 2014-11-30 02:02:03 UTC (rev 4618) @@ -279,6 +279,7 @@ afx_msg void OnSaveAll(); afx_msg void OnReloadItem(); afx_msg void OnReloadAll(); + afx_msg void OnFindMissing(); afx_msg void OnAddDlsBank(); afx_msg void OnImportMidiLib(); Modified: trunk/OpenMPT/mptrack/mptrack_08.vcproj =================================================================== --- trunk/OpenMPT/mptrack/mptrack_08.vcproj 2014-11-29 21:12:56 UTC (rev 4617) +++ trunk/OpenMPT/mptrack/mptrack_08.vcproj 2014-11-30 02:02:03 UTC (rev 4618) @@ -548,6 +548,10 @@ > </File> <File + RelativePath=".\FolderScanner.cpp" + > + </File> + <File RelativePath=".\globals.cpp" > </File> @@ -1238,6 +1242,10 @@ > </File> <File + RelativePath=".\FolderScanner.h" + > + </File> + <File RelativePath="..\common\FlagSet.h" > </File> Modified: trunk/OpenMPT/mptrack/mptrack_10.vcxproj =================================================================== --- trunk/OpenMPT/mptrack/mptrack_10.vcxproj 2014-11-29 21:12:56 UTC (rev 4617) +++ trunk/OpenMPT/mptrack/mptrack_10.vcxproj 2014-11-30 02:02:03 UTC (rev 4618) @@ -829,6 +829,7 @@ <ClCompile Include="EffectVis.cpp" /> <ClCompile Include="ExceptionHandler.cpp" /> <ClCompile Include="FileDialog.cpp" /> + <ClCompile Include="FolderScanner.cpp" /> <ClCompile Include="Globals.cpp" /> <ClCompile Include="InputHandler.cpp" /> <ClCompile Include="KeyConfigDlg.cpp" /> @@ -1042,6 +1043,7 @@ <ClInclude Include="EffectInfo.h" /> <ClInclude Include="ExceptionHandler.h" /> <ClInclude Include="FileDialog.h" /> + <ClInclude Include="FolderScanner.h" /> <ClInclude Include="Globals.h" /> <ClInclude Include="InputHandler.h" /> <ClInclude Include="Mainbar.h" /> Modified: trunk/OpenMPT/mptrack/mptrack_10.vcxproj.filters =================================================================== --- trunk/OpenMPT/mptrack/mptrack_10.vcxproj.filters 2014-11-29 21:12:56 UTC (rev 4617) +++ trunk/OpenMPT/mptrack/mptrack_10.vcxproj.filters 2014-11-30 02:02:03 UTC (rev 4618) @@ -532,6 +532,9 @@ <ClCompile Include="..\common\mptFileIO.cpp"> <Filter>Source Files\common</Filter> </ClCompile> + <ClCompile Include="FolderScanner.cpp"> + <Filter>Source Files\mptrack</Filter> + </ClCompile> </ItemGroup> <ItemGroup> <ClInclude Include="..\soundlib\Loaders.h"> @@ -1035,6 +1038,9 @@ <ClInclude Include="..\common\mptFileIO.h"> <Filter>Header Files\common</Filter> </ClInclude> + <ClInclude Include="FolderScanner.h"> + <Filter>Header Files\mptrack</Filter> + </ClInclude> </ItemGroup> <ItemGroup> <None Include="res\bitmap1.bmp"> Modified: trunk/OpenMPT/mptrack/resource.h =================================================================== --- trunk/OpenMPT/mptrack/resource.h 2014-11-29 21:12:56 UTC (rev 4617) +++ trunk/OpenMPT/mptrack/resource.h 2014-11-30 02:02:03 UTC (rev 4618) @@ -1114,6 +1114,7 @@ #define ID_MODTREE_RELOADITEM 33906 #define ID_MODTREE_RELOADALL 33907 #define ID_MODTREE_SAVEALL 33908 +#define ID_MODTREE_FINDMISSING 33909 #define ID_FACTORYPRESET 33914 #define ID_FACTORYPRESET_DEFAULT 33915 #define ID_MODTREE_SETPATH 33916 This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <sag...@us...> - 2014-12-01 21:43:06
|
Revision: 4624 http://sourceforge.net/p/modplug/code/4624 Author: saga-games Date: 2014-12-01 21:42:54 +0000 (Mon, 01 Dec 2014) Log Message: ----------- [Imp] Missing samples dialog: Replace messagebox with updated label. [Fix] Pattern tab: When only one parameter column was selected, the interpolation context menu didn't offer to interpolate this column. [Fix] Manual generator: Explicitely state that the python script should be run with python3. Modified Paths: -------------- trunk/OpenMPT/mptrack/ExternalSamples.cpp trunk/OpenMPT/mptrack/View_pat.cpp trunk/OpenMPT/mptrack/manual_generator/wiki.py Modified: trunk/OpenMPT/mptrack/ExternalSamples.cpp =================================================================== --- trunk/OpenMPT/mptrack/ExternalSamples.cpp 2014-12-01 19:18:48 UTC (rev 4623) +++ trunk/OpenMPT/mptrack/ExternalSamples.cpp 2014-12-01 21:42:54 UTC (rev 4624) @@ -186,16 +186,15 @@ EndWaitCursor(); GetDlgItem(IDOK)->EnableWindow(TRUE); SetDlgItemText(IDC_BUTTON1, "&Scan Folder..."); - SetDlgItemText(IDC_STATIC1, ""); modDoc.UpdateAllViews(NULL, HINT_SAMPLEINFO | HINT_SMPNAMES | HINT_SAMPLEDATA); if(foundFiles) { - Reporting::Information(mpt::String::Print("%1 sample paths were relocated.", foundFiles)); - } else if(isScanning) + SetDlgItemText(IDC_STATIC1, mpt::String::Print("%1 sample paths were relocated.", foundFiles).c_str()); + } else { - Reporting::Information("No matching sample names found."); + SetDlgItemText(IDC_STATIC1, _T("No matching sample names found.")); } isScanning = false; GenerateList(); Modified: trunk/OpenMPT/mptrack/View_pat.cpp =================================================================== --- trunk/OpenMPT/mptrack/View_pat.cpp 2014-12-01 19:18:48 UTC (rev 4623) +++ trunk/OpenMPT/mptrack/View_pat.cpp 2014-12-01 21:42:54 UTC (rev 4624) @@ -4703,8 +4703,7 @@ if(target.IsPcNote()) { ENTER_PCNOTE_VALUE(c, ValueEffectCol); - } - else if(pSndFile->GetModSpecifications().HasCommand(c)) + } else if(pSndFile->GetModSpecifications().HasCommand(c)) { if (c) @@ -5203,7 +5202,7 @@ { if(newcmd.command == CMD_NONE) //make sure we don't overwrite any existing commands. { - newcmd.command = (sndFile.TypeIsS3M_IT_MPT()) ? CMD_S3MCMDEX : CMD_MODCMDEX; + newcmd.command = sndFile.GetModSpecifications().HasCommand(CMD_S3MCMDEX) ? CMD_S3MCMDEX : CMD_MODCMDEX; UINT maxSpeed = 0x0F; if(sndFile.m_PlayState.m_nMusicSpeed > 0) maxSpeed = MIN(0x0F, sndFile.m_PlayState.m_nMusicSpeed - 1); newcmd.param = 0xD0 + MIN(maxSpeed, m_nPlayTick); @@ -6114,16 +6113,16 @@ bool CViewPattern::BuildSelectionCtxMenu(HMENU hMenu, CInputHandler *ih) const //---------------------------------------------------------------------------- { - AppendMenu(hMenu, MF_STRING, ID_EDIT_SELECTCOLUMN, "Select Column\t" + ih->GetKeyTextFromCommand(kcSelectColumn)); - AppendMenu(hMenu, MF_STRING, ID_EDIT_SELECT_ALL, "Select Pattern\t" + ih->GetKeyTextFromCommand(kcEditSelectAll)); + AppendMenu(hMenu, MF_STRING, ID_EDIT_SELECTCOLUMN, _T("Select &Column\t") + ih->GetKeyTextFromCommand(kcSelectColumn)); + AppendMenu(hMenu, MF_STRING, ID_EDIT_SELECT_ALL, _T("Select &Pattern\t") + ih->GetKeyTextFromCommand(kcEditSelectAll)); return true; } bool CViewPattern::BuildGrowShrinkCtxMenu(HMENU hMenu, CInputHandler *ih) const //----------------------------------------------------------------------------- { - AppendMenu(hMenu, MF_STRING, ID_GROW_SELECTION, "Grow selection\t" + ih->GetKeyTextFromCommand(kcPatternGrowSelection)); - AppendMenu(hMenu, MF_STRING, ID_SHRINK_SELECTION, "Shrink selection\t" + ih->GetKeyTextFromCommand(kcPatternShrinkSelection)); + AppendMenu(hMenu, MF_STRING, ID_GROW_SELECTION, _T("&Grow selection\t") + ih->GetKeyTextFromCommand(kcPatternGrowSelection)); + AppendMenu(hMenu, MF_STRING, ID_SHRINK_SELECTION, _T("&Shrink selection\t") + ih->GetKeyTextFromCommand(kcPatternShrinkSelection)); return true; } @@ -6135,13 +6134,13 @@ const bool isPCNote = sndFile->Patterns.IsValidPat(m_nPattern) && sndFile->Patterns[m_nPattern].GetpModCommand(m_Selection.GetStartRow(), m_Selection.GetStartChannel())->IsPcNote(); HMENU subMenu = CreatePopupMenu(); - bool possible = BuildInterpolationCtxMenu(subMenu, PatternCursor::noteColumn, CString("Note Column\t") + ih->GetKeyTextFromCommand(kcPatternInterpolateNote), ID_PATTERN_INTERPOLATE_NOTE) - | BuildInterpolationCtxMenu(subMenu, PatternCursor::instrColumn, (isPCNote ? CString("Plugin Column\t") : CString("Instrument Column\t")) + ih->GetKeyTextFromCommand(kcPatternInterpolateInstr), ID_PATTERN_INTERPOLATE_INSTR) - | BuildInterpolationCtxMenu(subMenu, PatternCursor::volumeColumn, (isPCNote ? CString("Parameter Column\t") : CString("Volume Column\t")) + ih->GetKeyTextFromCommand(kcPatternInterpolateVol), ID_PATTERN_INTERPOLATE_VOLUME) - | BuildInterpolationCtxMenu(subMenu, PatternCursor::effectColumn, (isPCNote ? CString("Value Column\t") : CString("Effect Column\t")) + ih->GetKeyTextFromCommand(kcPatternInterpolateEffect), ID_PATTERN_INTERPOLATE_EFFECT); + bool possible = BuildInterpolationCtxMenu(subMenu, PatternCursor::noteColumn, _T("&Note Column\t") + ih->GetKeyTextFromCommand(kcPatternInterpolateNote), ID_PATTERN_INTERPOLATE_NOTE) + | BuildInterpolationCtxMenu(subMenu, PatternCursor::instrColumn, (isPCNote ? _T("&Plugin Column\t") : _T("&Instrument Column\t")) + ih->GetKeyTextFromCommand(kcPatternInterpolateInstr), ID_PATTERN_INTERPOLATE_INSTR) + | BuildInterpolationCtxMenu(subMenu, PatternCursor::volumeColumn, (isPCNote ? _T("&Parameter Column\t") : _T("&Volume Column\t")) + ih->GetKeyTextFromCommand(kcPatternInterpolateVol), ID_PATTERN_INTERPOLATE_VOLUME) + | BuildInterpolationCtxMenu(subMenu, PatternCursor::effectColumn, (isPCNote ? _T("&Value Column\t") : _T("&Effect Column\t")) + ih->GetKeyTextFromCommand(kcPatternInterpolateEffect), ID_PATTERN_INTERPOLATE_EFFECT); if(possible || !(TrackerSettings::Instance().m_dwPatternSetup & PATTERN_OLDCTXMENUSTYLE)) { - AppendMenu(hMenu, MF_POPUP | (possible ? 0 : MF_GRAYED), reinterpret_cast<UINT_PTR>(subMenu), "Interpolate..."); + AppendMenu(hMenu, MF_POPUP | (possible ? 0 : MF_GRAYED), reinterpret_cast<UINT_PTR>(subMenu), "I&nterpolate..."); return true; } return false; @@ -6226,12 +6225,12 @@ if(!greyed || !(TrackerSettings::Instance().m_dwPatternSetup & PATTERN_OLDCTXMENUSTYLE)) { - AppendMenu(transMenu, MF_STRING | greyed, ID_TRANSPOSE_UP, "Transpose +1\t" + ih->GetKeyTextFromCommand(kcTransposeUp)); - AppendMenu(transMenu, MF_STRING | greyed, ID_TRANSPOSE_DOWN, "Transpose -1\t" + ih->GetKeyTextFromCommand(kcTransposeDown)); - AppendMenu(transMenu, MF_STRING | greyed, ID_TRANSPOSE_OCTUP, "Transpose +12\t" + ih->GetKeyTextFromCommand(kcTransposeOctUp)); - AppendMenu(transMenu, MF_STRING | greyed, ID_TRANSPOSE_OCTDOWN, "Transpose -12\t" + ih->GetKeyTextFromCommand(kcTransposeOctDown)); - AppendMenu(transMenu, MF_STRING | greyed, ID_TRANSPOSE_CUSTOM, "Custom...\t" + ih->GetKeyTextFromCommand(kcTransposeCustom)); - AppendMenu(hMenu, MF_POPUP | greyed, reinterpret_cast<UINT_PTR>(transMenu), "Transpose..."); + AppendMenu(transMenu, MF_STRING | greyed, ID_TRANSPOSE_UP, _T("Transpose +&1\t") + ih->GetKeyTextFromCommand(kcTransposeUp)); + AppendMenu(transMenu, MF_STRING | greyed, ID_TRANSPOSE_DOWN, _T("Transpose -&1\t") + ih->GetKeyTextFromCommand(kcTransposeDown)); + AppendMenu(transMenu, MF_STRING | greyed, ID_TRANSPOSE_OCTUP, _T("Transpose +1&2\t") + ih->GetKeyTextFromCommand(kcTransposeOctUp)); + AppendMenu(transMenu, MF_STRING | greyed, ID_TRANSPOSE_OCTDOWN, _T("Transpose -1&2\t") + ih->GetKeyTextFromCommand(kcTransposeOctDown)); + AppendMenu(transMenu, MF_STRING | greyed, ID_TRANSPOSE_CUSTOM, _T("&Custom...\t") + ih->GetKeyTextFromCommand(kcTransposeCustom)); + AppendMenu(hMenu, MF_POPUP | greyed, reinterpret_cast<UINT_PTR>(transMenu), _T("&Transpose...")); return true; } return false; @@ -6336,8 +6335,8 @@ { AppendMenu(instrumentChangeMenu, MF_SEPARATOR, 0, 0); } - AppendMenu(instrumentChangeMenu, MF_STRING, ID_CHANGE_INSTRUMENT, "Remove instrument"); - AppendMenu(instrumentChangeMenu, MF_STRING, ID_CHANGE_INSTRUMENT + GetCurrentInstrument(), "Set to current instrument"); + AppendMenu(instrumentChangeMenu, MF_STRING, ID_CHANGE_INSTRUMENT, _T("&Remove instrument")); + AppendMenu(instrumentChangeMenu, MF_STRING, ID_CHANGE_INSTRUMENT + GetCurrentInstrument(), _T("&Set to current instrument")); } return BuildTogglePlugEditorCtxMenu(hMenu, ih); } @@ -6424,7 +6423,7 @@ if(plug && plug <= MAX_MIXPLUGINS && sndFile->m_MixPlugins[plug - 1].pMixPlugin != nullptr) { - AppendMenu(hMenu, MF_STRING, ID_PATTERN_EDIT_PCNOTE_PLUGIN, "Toggle Plugin Editor\t" + ih->GetKeyTextFromCommand(kcPatternEditPCNotePlugin)); + AppendMenu(hMenu, MF_STRING, ID_PATTERN_EDIT_PCNOTE_PLUGIN, "Toggle Plugin &Editor\t" + ih->GetKeyTextFromCommand(kcPatternEditPCNotePlugin)); return true; } return false; @@ -6437,7 +6436,7 @@ CHANNELINDEX startChan = m_Selection.GetStartChannel(); CHANNELINDEX endChan = m_Selection.GetEndChannel(); chans.clear(); - chans.reserve(endChan - startChan); + chans.reserve(endChan - startChan + 1); // Check in which channels this column is selected. // Actually this check is only important for the first and last channel, but to keep things clean and simple, all channels are checked in the same manner. @@ -6491,8 +6490,8 @@ return false; bool result = false; - const ModCommand startRowMC = *sndFile->Patterns[m_nPattern].GetpModCommand(startRow, chan); - const ModCommand endRowMC = *sndFile->Patterns[m_nPattern].GetpModCommand(endRow, chan); + const ModCommand &startRowMC = *sndFile->Patterns[m_nPattern].GetpModCommand(startRow, chan); + const ModCommand &endRowMC = *sndFile->Patterns[m_nPattern].GetpModCommand(endRow, chan); UINT startRowCmd, endRowCmd; if(colType == PatternCursor::effectColumn && (startRowMC.IsPcNote() || endRowMC.IsPcNote())) @@ -6524,6 +6523,7 @@ break; case PatternCursor::effectColumn: + case PatternCursor::paramColumn: startRowCmd = startRowMC.command; endRowCmd = endRowMC.command; result = (startRowCmd == endRowCmd && startRowCmd != CMD_NONE) // Interpolate between two identical commands Modified: trunk/OpenMPT/mptrack/manual_generator/wiki.py =================================================================== --- trunk/OpenMPT/mptrack/manual_generator/wiki.py 2014-12-01 19:18:48 UTC (rev 4623) +++ trunk/OpenMPT/mptrack/manual_generator/wiki.py 2014-12-01 21:42:54 UTC (rev 4624) @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # OpenMPT help file scraper # by coda and Saga Musix # This script downloads the OpenMPT manual TOC and then downloads all pages @@ -89,10 +89,6 @@ # Remove templates that shouldn't turn up in the manual content = re.sub(r'<div class="todo".+?</div>', '', content, flags = re.DOTALL); content = re.sub(r'<p class="newversion".+?</p>', '', content, flags = re.DOTALL); - # Remove edit links (MW 1.23 should make this superfluous) - content = re.sub(r'<span class="mw-editsection"><span class="mw-editsection-bracket">\[</span><a href=".+?">edit</a><span class="mw-editsection-bracket">\]</span></span>', '', content) - # Remove magnify links for images - content = content.replace('<img src="/skins/common/images/magnify-clip.png" width="15" height="11" alt="" />', '') section = re.match(r'(.+)/', title(p)) section_str = '' This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <sag...@us...> - 2014-12-02 23:07:20
|
Revision: 4627 http://sourceforge.net/p/modplug/code/4627 Author: saga-games Date: 2014-12-02 23:07:06 +0000 (Tue, 02 Dec 2014) Log Message: ----------- [Ref] Change the update hint encoding/decoding logic from bit juggling in dozens of places into one new class, UpdateHint. NOTE: This does not remedy the fact that we only have 14 (well, used to be 13, since I also managed to get rid of one update hint type) bits for the update parameter left, as the update hint is still tunnelled through MFC's OnUpdate() and hence must fit into an LPARAM. Modified Paths: -------------- trunk/OpenMPT/mptrack/AbstractVstEditor.cpp trunk/OpenMPT/mptrack/ChannelManagerDlg.cpp trunk/OpenMPT/mptrack/Ctrl_com.cpp trunk/OpenMPT/mptrack/Ctrl_com.h trunk/OpenMPT/mptrack/Ctrl_gen.cpp trunk/OpenMPT/mptrack/Ctrl_gen.h trunk/OpenMPT/mptrack/Ctrl_ins.cpp trunk/OpenMPT/mptrack/Ctrl_ins.h trunk/OpenMPT/mptrack/Ctrl_pat.cpp trunk/OpenMPT/mptrack/Ctrl_pat.h trunk/OpenMPT/mptrack/Ctrl_seq.cpp trunk/OpenMPT/mptrack/Ctrl_smp.cpp trunk/OpenMPT/mptrack/Ctrl_smp.h trunk/OpenMPT/mptrack/Draw_pat.cpp trunk/OpenMPT/mptrack/EffectVis.cpp trunk/OpenMPT/mptrack/ExternalSamples.cpp trunk/OpenMPT/mptrack/Globals.cpp trunk/OpenMPT/mptrack/Globals.h trunk/OpenMPT/mptrack/MainFrm.cpp trunk/OpenMPT/mptrack/Mainbar.cpp trunk/OpenMPT/mptrack/Mainbar.h trunk/OpenMPT/mptrack/Mainfrm.h trunk/OpenMPT/mptrack/Moddoc.cpp trunk/OpenMPT/mptrack/Moddoc.h trunk/OpenMPT/mptrack/Modedit.cpp trunk/OpenMPT/mptrack/PatternEditorDialogs.cpp trunk/OpenMPT/mptrack/View_gen.cpp trunk/OpenMPT/mptrack/View_gen.h trunk/OpenMPT/mptrack/View_ins.cpp trunk/OpenMPT/mptrack/View_ins.h trunk/OpenMPT/mptrack/View_pat.cpp trunk/OpenMPT/mptrack/View_pat.h trunk/OpenMPT/mptrack/View_smp.cpp trunk/OpenMPT/mptrack/View_smp.h trunk/OpenMPT/mptrack/View_tre.cpp trunk/OpenMPT/mptrack/View_tre.h trunk/OpenMPT/mptrack/mptrack_08.vcproj trunk/OpenMPT/mptrack/mptrack_10.vcxproj trunk/OpenMPT/mptrack/mptrack_10.vcxproj.filters trunk/OpenMPT/mptrack/view_com.cpp trunk/OpenMPT/mptrack/view_com.h Added Paths: ----------- trunk/OpenMPT/mptrack/UpdateHints.h Modified: trunk/OpenMPT/mptrack/AbstractVstEditor.cpp =================================================================== --- trunk/OpenMPT/mptrack/AbstractVstEditor.cpp 2014-12-02 22:33:39 UTC (rev 4626) +++ trunk/OpenMPT/mptrack/AbstractVstEditor.cpp 2014-12-02 23:07:06 UTC (rev 4627) @@ -920,7 +920,7 @@ //pIns->wMidiBank = (WORD)((m_pVstPlugin->GetCurrentProgram() >> 7) + 1); //pIns->nMidiProgram = (BYTE)((m_pVstPlugin->GetCurrentProgram() & 0x7F) + 1); - pModDoc->UpdateAllViews(NULL, (nIns << HINT_SHIFT_INS) | HINT_INSTRUMENT | HINT_INSNAMES | HINT_ENVELOPE | (first ? HINT_MODTYPE : 0)); + pModDoc->UpdateAllViews(NULL, InstrumentHint(HINT_INSTRUMENT | HINT_INSNAMES | HINT_ENVELOPE | (first ? HINT_MODTYPE : HINT_NONE), nIns)); if(sndFile.GetModSpecifications().supportsPlugins) { pModDoc->SetModified(); Modified: trunk/OpenMPT/mptrack/ChannelManagerDlg.cpp =================================================================== --- trunk/OpenMPT/mptrack/ChannelManagerDlg.cpp 2014-12-02 22:33:39 UTC (rev 4626) +++ trunk/OpenMPT/mptrack/ChannelManagerDlg.cpp 2014-12-02 23:07:06 UTC (rev 4627) @@ -9,9 +9,9 @@ #include "stdafx.h" -#include "mainfrm.h" -#include "moddoc.h" -#include "view_gen.h" +#include "Moddoc.h" +#include "Mainfrm.h" +#include "View_gen.h" #include "ChannelManagerDlg.h" @@ -1104,7 +1104,7 @@ pModDoc->MuteChannel(n,!pModDoc->IsChannelMuted(n)); } pModDoc->SetModified(); - pModDoc->UpdateAllViews(NULL, HINT_MODCHANNELS | ((n/CHANNELS_IN_TAB) << HINT_SHIFT_CHNTAB)); + pModDoc->UpdateAllViews(NULL, ChannelTabHint(HINT_MODCHANNELS, n / CHANNELS_IN_TAB)); break; case 1: BYTE rec; @@ -1123,7 +1123,7 @@ if(button == CM_BT_LEFT) pModDoc->NoFxChannel(n, false); else pModDoc->NoFxChannel(n, true); pModDoc->SetModified(); - pModDoc->UpdateAllViews(NULL, HINT_MODCHANNELS | ((n/CHANNELS_IN_TAB) << HINT_SHIFT_CHNTAB)); + pModDoc->UpdateAllViews(NULL, ChannelTabHint(HINT_MODCHANNELS, n / CHANNELS_IN_TAB)); break; case 3: if(button == CM_BT_LEFT) Modified: trunk/OpenMPT/mptrack/Ctrl_com.cpp =================================================================== --- trunk/OpenMPT/mptrack/Ctrl_com.cpp 2014-12-02 22:33:39 UTC (rev 4626) +++ trunk/OpenMPT/mptrack/Ctrl_com.cpp 2014-12-02 23:07:06 UTC (rev 4627) @@ -107,10 +107,10 @@ } -void CCtrlComments::UpdateView(DWORD dwHint, CObject *pHint) -//---------------------------------------------------------- +void CCtrlComments::UpdateView(UpdateHint hint, CObject *pHint) +//------------------------------------------------------------- { - if ((pHint == this) || (!(dwHint & (HINT_MODCOMMENTS|HINT_MPTOPTIONS|HINT_MODTYPE)))) return; + if ((pHint == this) || (!(hint.GetType() & (HINT_MODCOMMENTS|HINT_MPTOPTIONS|HINT_MODTYPE)))) return; if (m_nLockCount) return; m_nLockCount++; HFONT newfont; @@ -156,7 +156,7 @@ m_EditComments.SetSel(0, 0); m_EditComments.SetModify(FALSE); } - if (dwHint & HINT_MODTYPE) + if (hint.GetType() & HINT_MODTYPE) { m_EditComments.SetReadOnly(!m_sndFile.GetModSpecifications().hasComments); } Modified: trunk/OpenMPT/mptrack/Ctrl_com.h =================================================================== --- trunk/OpenMPT/mptrack/Ctrl_com.h 2014-12-02 22:33:39 UTC (rev 4626) +++ trunk/OpenMPT/mptrack/Ctrl_com.h 2014-12-02 23:07:06 UTC (rev 4627) @@ -33,7 +33,7 @@ virtual BOOL OnInitDialog(); virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support virtual void RecalcLayout(); - virtual void UpdateView(DWORD dwHintMask=0, CObject *pObj=NULL); + virtual void UpdateView(UpdateHint hint = HINT_NONE, CObject *pObj = nullptr); virtual CRuntimeClass *GetAssociatedViewClass(); virtual void OnActivatePage(LPARAM); virtual void OnDeactivatePage(); Modified: trunk/OpenMPT/mptrack/Ctrl_gen.cpp =================================================================== --- trunk/OpenMPT/mptrack/Ctrl_gen.cpp 2014-12-02 22:33:39 UTC (rev 4626) +++ trunk/OpenMPT/mptrack/Ctrl_gen.cpp 2014-12-02 23:07:06 UTC (rev 4627) @@ -202,16 +202,17 @@ } -void CCtrlGeneral::UpdateView(DWORD dwHint, CObject *pHint) -//--------------------------------------------------------- +void CCtrlGeneral::UpdateView(UpdateHint hint, CObject *pHint) +//------------------------------------------------------------ { if (pHint == this) return; - if (dwHint & HINT_MODSEQUENCE) + HintType hintType = hint.GetType(); + if (hintType & HINT_MODSEQUENCE) { // Set max valid restart position m_SpinRestartPos.SetRange32(0, m_sndFile.Order.GetLengthTailTrimmed() - 1); } - if (dwHint & HINT_MODGENERAL) + if (hintType & HINT_MODGENERAL) { if (!m_bEditsLocked) { @@ -230,7 +231,7 @@ m_SliderTempo.SetPos(m_sndFile.GetModSpecifications().tempoMax - m_sndFile.m_nDefaultTempo); } - if (dwHint & HINT_MODTYPE) + if (hintType & HINT_MODTYPE) { CModSpecifications specs = m_sndFile.GetModSpecifications(); m_SpinTempo.SetRange(specs.tempoMin, specs.tempoMax); @@ -275,7 +276,7 @@ m_EditModType.SetWindowText(s); } CheckDlgButton(IDC_CHECK_LOOPSONG, (TrackerSettings::Instance().gbLoopSong) ? TRUE : FALSE); - if (dwHint & HINT_MPTOPTIONS) + if (hintType & HINT_MPTOPTIONS) { m_VuMeterLeft.InvalidateRect(NULL, FALSE); m_VuMeterRight.InvalidateRect(NULL, FALSE); @@ -410,7 +411,8 @@ m_sndFile.m_nDefaultSpeed = n; m_sndFile.m_PlayState.m_nMusicSpeed = n; m_modDoc.SetModified(); - m_modDoc.UpdateAllViews(NULL, HINT_MODGENERAL, this); + // HINT_ENVELOPE: Update envelope grid view + m_modDoc.UpdateAllViews(NULL, HINT_MODGENERAL | HINT_ENVELOPE, this); m_bEditsLocked=false; } } Modified: trunk/OpenMPT/mptrack/Ctrl_gen.h =================================================================== --- trunk/OpenMPT/mptrack/Ctrl_gen.h 2014-12-02 22:33:39 UTC (rev 4626) +++ trunk/OpenMPT/mptrack/Ctrl_gen.h 2014-12-02 23:07:06 UTC (rev 4627) @@ -76,7 +76,7 @@ virtual BOOL OnInitDialog(); virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support virtual void RecalcLayout(); - virtual void UpdateView(DWORD dwHintMask=0, CObject *pObj=NULL); + virtual void UpdateView(UpdateHint hint = HINT_NONE, CObject *pObj = nullptr); virtual CRuntimeClass *GetAssociatedViewClass(); virtual void OnActivatePage(LPARAM); virtual void OnDeactivatePage(); Modified: trunk/OpenMPT/mptrack/Ctrl_ins.cpp =================================================================== --- trunk/OpenMPT/mptrack/Ctrl_ins.cpp 2014-12-02 22:33:39 UTC (rev 4626) +++ trunk/OpenMPT/mptrack/Ctrl_ins.cpp 2014-12-02 23:07:06 UTC (rev 4627) @@ -982,10 +982,10 @@ // Set instrument (and moddoc) as modified. // updateAll: Update all views including this one. Otherwise, only update update other views. -void CCtrlInstruments::SetModified(DWORD mask, bool updateAll, bool modified) -//--------------------------------------------------------------------------- +void CCtrlInstruments::SetModified(HintType mask, bool updateAll, bool modified) +//------------------------------------------------------------------------------ { - m_modDoc.UpdateAllViews(NULL, (m_nInstrument << HINT_SHIFT_INS) | mask, updateAll ? nullptr : this); + m_modDoc.UpdateAllViews(NULL, InstrumentHint(mask, m_nInstrument), updateAll ? nullptr : this); if(modified) m_modDoc.SetModified(); } @@ -1000,7 +1000,7 @@ { m_nInstrument = nIns; m_NoteMap.SetCurrentInstrument(m_nInstrument); - UpdateView((m_nInstrument << HINT_SHIFT_INS) | HINT_INSTRUMENT | HINT_ENVELOPE, NULL); + UpdateView(InstrumentHint(HINT_INSTRUMENT | HINT_ENVELOPE, m_nInstrument), NULL); } else { // Just in case @@ -1046,7 +1046,7 @@ SetCurrentInstrument((lParam > 0) ? lParam : m_nInstrument); // Initial Update - if (!m_bInitialized) UpdateView((m_nInstrument << HINT_SHIFT_INS) | HINT_INSTRUMENT | HINT_ENVELOPE | HINT_MODTYPE, NULL); + if (!m_bInitialized) UpdateView(InstrumentHint(HINT_INSTRUMENT | HINT_ENVELOPE | HINT_MODTYPE, m_nInstrument), NULL); CChildFrame *pFrame = (CChildFrame *)GetParentFrame(); if (pFrame) PostViewMessage(VIEWMSG_LOADSTATE, (LPARAM)pFrame->GetInstrumentViewState()); @@ -1124,28 +1124,29 @@ } -void CCtrlInstruments::UpdateView(DWORD dwHintMask, CObject *pObj) -//---------------------------------------------------------------- +void CCtrlInstruments::UpdateView(UpdateHint hint, CObject *pObj) +//--------------------------------------------------------------- { if(pObj == this) return; - if (dwHintMask & HINT_MPTOPTIONS) + HintType hintType = hint.GetType(); + if (hintType & HINT_MPTOPTIONS) { m_ToolBar.UpdateStyle(); } LockControls(); - if (dwHintMask & HINT_MIXPLUGINS) OnMixPlugChanged(); + if (hintType & HINT_MIXPLUGINS) OnMixPlugChanged(); UnlockControls(); - if(!(dwHintMask & (HINT_INSTRUMENT | HINT_ENVELOPE| HINT_MODTYPE))) return; + if(!(hintType & (HINT_INSTRUMENT | HINT_ENVELOPE| HINT_MODTYPE))) return; - const INSTRUMENTINDEX updateIns = (dwHintMask >> HINT_SHIFT_INS); + const INSTRUMENTINDEX updateIns = hint.GetData(); - if(updateIns != m_nInstrument && updateIns != 0 && (dwHintMask & (HINT_INSTRUMENT | HINT_ENVELOPE)) && !(dwHintMask & HINT_MODTYPE)) return; + if(updateIns != m_nInstrument && updateIns != 0 && (hintType & (HINT_INSTRUMENT | HINT_ENVELOPE)) && !(hintType & HINT_MODTYPE)) return; LockControls(); - if (!m_bInitialized) dwHintMask |= HINT_MODTYPE; + if (!m_bInitialized) hintType |= HINT_MODTYPE; ModInstrument *pIns = m_sndFile.Instruments[m_nInstrument]; - if (dwHintMask & HINT_MODTYPE) + if (hintType & HINT_MODTYPE) { const CModSpecifications *specs = &m_sndFile.GetModSpecifications(); @@ -1232,7 +1233,7 @@ m_CbnMidiCh.SetItemData(m_CbnMidiCh.AddString(s), ich); } } - if (dwHintMask & (HINT_INSTRUMENT|HINT_MODTYPE)) + if (hintType & (HINT_INSTRUMENT|HINT_MODTYPE)) { // Backwards compatibility with IT modules that use now deprecated hack features. m_SliderCutSwing.EnableWindow((pIns != nullptr && (m_sndFile.GetType() == MOD_TYPE_MPT || pIns->nCutSwing != 0)) ? TRUE : FALSE); @@ -1353,7 +1354,7 @@ } m_NoteMap.InvalidateRect(NULL, FALSE); } - if(dwHintMask & (HINT_MIXPLUGINS|HINT_MODTYPE)) + if(hintType & (HINT_MIXPLUGINS|HINT_MODTYPE)) { UpdatePluginList(); } @@ -1659,9 +1660,9 @@ if (ins != INSTRUMENTINDEX_INVALID) { SetCurrentInstrument(ins); - m_modDoc.UpdateAllViews(NULL, (ins << HINT_SHIFT_INS) | HINT_INSTRUMENT | HINT_INSNAMES | HINT_ENVELOPE); + m_modDoc.UpdateAllViews(NULL, InstrumentHint(HINT_INSTRUMENT | HINT_INSNAMES | HINT_ENVELOPE, ins)); } - if (bFirst) m_modDoc.UpdateAllViews(NULL, (ins << HINT_SHIFT_INS) | HINT_MODTYPE | HINT_INSTRUMENT | HINT_INSNAMES); + if (bFirst) m_modDoc.UpdateAllViews(NULL, InstrumentHint(HINT_MODTYPE | HINT_INSTRUMENT | HINT_INSNAMES, ins)); m_parent.InstrumentChanged(m_nInstrument); SwitchToView(); } @@ -1676,7 +1677,7 @@ if(ins != INSTRUMENTINDEX_INVALID) { SetCurrentInstrument(ins); - m_modDoc.UpdateAllViews(NULL, (ins << HINT_SHIFT_INS) | HINT_INSTRUMENT | HINT_INSNAMES | HINT_ENVELOPE); + m_modDoc.UpdateAllViews(NULL, InstrumentHint(HINT_INSTRUMENT | HINT_INSNAMES | HINT_ENVELOPE, ins)); } m_parent.InstrumentChanged(m_nInstrument); } @@ -2125,7 +2126,7 @@ // If this plugin can recieve MIDI events and we have no MIDI channel // selected for this instrument, automatically select MIDI channel 1. pIns->nMidiChannel = MidiFirstChannel; - UpdateView((m_nInstrument << HINT_SHIFT_INS) | HINT_INSTRUMENT, NULL); + UpdateView(InstrumentHint(HINT_INSTRUMENT, m_nInstrument), NULL); } if(pIns->midiPWD == 0) { @@ -2446,8 +2447,7 @@ CSampleMapDlg dlg(m_sndFile, m_nInstrument, this); if (dlg.DoModal() == IDOK) { - m_modDoc.SetModified(); - m_modDoc.UpdateAllViews(NULL, (m_nInstrument << HINT_SHIFT_INS) | HINT_INSTRUMENT, this); + SetModified(HINT_INSTRUMENT, true); m_NoteMap.InvalidateRect(NULL, FALSE); } } @@ -2530,7 +2530,7 @@ cs.Leave(); m_modDoc.SetModified(); - UpdateView((m_nInstrument << HINT_SHIFT_INS) | HINT_INSTRUMENT); + UpdateView(InstrumentHint(HINT_INSTRUMENT, m_nInstrument)); return; } @@ -2559,7 +2559,7 @@ cs.Leave(); m_modDoc.SetModified(); - UpdateView((m_nInstrument << HINT_SHIFT_INS) | HINT_INSTRUMENT); + UpdateView(InstrumentHint(HINT_INSTRUMENT, m_nInstrument)); return; } @@ -2585,7 +2585,7 @@ //new tuning(s) come visible. BuildTuningComboBox(); - UpdateView((m_nInstrument << HINT_SHIFT_INS) | HINT_INSTRUMENT); + UpdateView(InstrumentHint(HINT_INSTRUMENT, m_nInstrument)); } Modified: trunk/OpenMPT/mptrack/Ctrl_ins.h =================================================================== --- trunk/OpenMPT/mptrack/Ctrl_ins.h 2014-12-02 22:33:39 UTC (rev 4626) +++ trunk/OpenMPT/mptrack/Ctrl_ins.h 2014-12-02 23:07:06 UTC (rev 4627) @@ -122,7 +122,7 @@ virtual ~CCtrlInstruments(); public: - void SetModified(DWORD mask, bool updateAll, bool modified = true); + void SetModified(HintType mask, bool updateAll, bool modified = true); BOOL SetCurrentInstrument(UINT nIns, BOOL bUpdNum=TRUE); BOOL OpenInstrument(const mpt::PathString &fileName); BOOL OpenInstrument(CSoundFile &sndFile, INSTRUMENTINDEX nInstr); @@ -138,7 +138,7 @@ virtual void RecalcLayout(); virtual void OnActivatePage(LPARAM); virtual void OnDeactivatePage(); - virtual void UpdateView(DWORD dwHintMask=0, CObject *pObj=NULL); + virtual void UpdateView(UpdateHint hint = HINT_NONE, CObject *pObj = nullptr); virtual LRESULT OnModCtrlMsg(WPARAM wParam, LPARAM lParam); virtual BOOL GetToolTipText(UINT uId, LPSTR pszText); virtual BOOL PreTranslateMessage(MSG* pMsg); Modified: trunk/OpenMPT/mptrack/Ctrl_pat.cpp =================================================================== --- trunk/OpenMPT/mptrack/Ctrl_pat.cpp 2014-12-02 22:33:39 UTC (rev 4626) +++ trunk/OpenMPT/mptrack/Ctrl_pat.cpp 2014-12-02 23:07:06 UTC (rev 4627) @@ -239,24 +239,24 @@ } -void CCtrlPatterns::UpdateView(DWORD dwHintMask, CObject *pObj) -//------------------------------------------------------------- +void CCtrlPatterns::UpdateView(UpdateHint hint, CObject *pObj) +//------------------------------------------------------------ { - CHAR s[256]; - m_OrderList.UpdateView(dwHintMask, pObj); + m_OrderList.UpdateView(hint, pObj); + HintType hintType = hint.GetType(); - if(dwHintMask & HINT_MODSEQUENCE) + if(hintType & HINT_MODSEQUENCE) { SetDlgItemText(IDC_EDIT_SEQUENCE_NAME, m_sndFile.Order.GetName().c_str()); } - if(dwHintMask & (HINT_MODSEQUENCE|HINT_MODTYPE)) + if(hintType & (HINT_MODSEQUENCE|HINT_MODTYPE)) { m_SpinSequence.SetRange(0, m_sndFile.Order.GetNumSequences() - 1); m_SpinSequence.SetPos(m_sndFile.Order.GetCurrentSequenceIndex()); } //rewbs.instroVST - if(dwHintMask & (HINT_MIXPLUGINS|HINT_MODTYPE)) + if(hintType & (HINT_MIXPLUGINS|HINT_MODTYPE)) { if (HasValidPlug(m_nInstrument)) ::EnableWindow(::GetDlgItem(m_hWnd, IDC_PATINSTROPLUGGUI), true); @@ -276,7 +276,7 @@ GetDlgItem(IDC_EDIT_PATTERNNAME)->EnableWindow(isPatNameAvail); } //end rewbs.instroVST - if(dwHintMask & HINT_MPTOPTIONS) + if(hintType & HINT_MPTOPTIONS) { m_ToolBar.UpdateStyle(); // -> CODE#0007 @@ -285,10 +285,11 @@ m_ToolBar.SetState(ID_OVERFLOWPASTE, ((TrackerSettings::Instance().m_dwPatternSetup & PATTERN_OVERFLOWPASTE) ? TBSTATE_CHECKED : 0) | TBSTATE_ENABLED); // -! BEHAVIOUR_CHANGE#0007 } - if(dwHintMask & (HINT_MODTYPE|HINT_INSNAMES|HINT_SMPNAMES|HINT_PATNAMES)) + if(hintType & (HINT_MODTYPE|HINT_INSNAMES|HINT_SMPNAMES|HINT_PATNAMES)) { LockControls(); - if(dwHintMask & (HINT_MODTYPE|HINT_INSNAMES|HINT_SMPNAMES)) + CHAR s[256]; + if(hintType & (HINT_MODTYPE|HINT_INSNAMES|HINT_SMPNAMES)) { static const TCHAR szSplitFormat[] = TEXT("%02u %s %02u: %s/%s"); UINT nPos = 0; @@ -340,11 +341,11 @@ m_CbnInstrument.SetRedraw(TRUE); m_CbnInstrument.Invalidate(FALSE); } - if(dwHintMask & (HINT_MODTYPE|HINT_PATNAMES)) + if(hintType & (HINT_MODTYPE|HINT_PATNAMES)) { PATTERNINDEX nPat; - if(dwHintMask & HINT_PATNAMES) - nPat = (PATTERNINDEX)(dwHintMask >> HINT_SHIFT_PAT); + if(hintType & HINT_PATNAMES) + nPat = (PATTERNINDEX)hint.GetData(); else nPat = (PATTERNINDEX)SendViewMessage(VIEWMSG_GETCURRENTPATTERN); if(m_sndFile.Patterns.IsValidIndex(nPat)) @@ -361,7 +362,7 @@ } UnlockControls(); } - if (dwHintMask & (HINT_MODTYPE|HINT_UNDO)) + if (hintType & (HINT_MODTYPE|HINT_UNDO)) { m_ToolBar.EnableButton(ID_EDIT_UNDO, m_modDoc.GetPatternUndo().CanUndo()); } @@ -387,7 +388,7 @@ return m_OrderList.GetCurrentPattern(); case CTRLMSG_PATTERNCHANGED: - UpdateView((DWORD)(lParam << HINT_SHIFT_PAT) | HINT_PATNAMES, NULL); + UpdateView(PatternHint(HINT_PATNAMES, static_cast<PATTERNINDEX>(lParam))); break; case CTRLMSG_PAT_PREVINSTRUMENT: @@ -1090,7 +1091,7 @@ if(m_sndFile.Patterns[nPat].SetName(s)) { if(m_sndFile.GetType() & (MOD_TYPE_XM|MOD_TYPE_IT|MOD_TYPE_MPT)) m_modDoc.SetModified(); - m_modDoc.UpdateAllViews(NULL, (nPat << HINT_SHIFT_PAT) | HINT_PATNAMES, this); + m_modDoc.UpdateAllViews(NULL, PatternHint(HINT_PATNAMES, nPat), this); } } } @@ -1106,7 +1107,7 @@ { m_sndFile.Order.SetName(str.GetString()); m_modDoc.SetModified(); - m_modDoc.UpdateAllViews(NULL, (m_sndFile.Order.GetCurrentSequenceIndex() << HINT_SHIFT_SEQUENCE) | HINT_SEQNAMES, this); + m_modDoc.UpdateAllViews(NULL, SequenceHint(HINT_SEQNAMES, m_sndFile.Order.GetCurrentSequenceIndex()), this); } } Modified: trunk/OpenMPT/mptrack/Ctrl_pat.h =================================================================== --- trunk/OpenMPT/mptrack/Ctrl_pat.h 2014-12-02 22:33:39 UTC (rev 4626) +++ trunk/OpenMPT/mptrack/Ctrl_pat.h 2014-12-02 23:07:06 UTC (rev 4627) @@ -115,7 +115,7 @@ //{{AFX_VIRTUAL(COrderList) virtual BOOL PreTranslateMessage(MSG *pMsg); - virtual void UpdateView(DWORD dwHintMask=0, CObject *pObj=NULL); + virtual void UpdateView(UpdateHint hint = HINT_NONE, CObject *pObj = nullptr); //}}AFX_VIRTUAL protected: @@ -202,7 +202,7 @@ virtual BOOL OnInitDialog(); virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support virtual void RecalcLayout(); - virtual void UpdateView(DWORD dwHintMask=0, CObject *pObj=NULL); + virtual void UpdateView(UpdateHint hint = HINT_NONE, CObject *pObj = nullptr); virtual CRuntimeClass *GetAssociatedViewClass(); virtual LRESULT OnModCtrlMsg(WPARAM wParam, LPARAM lParam); virtual void OnActivatePage(LPARAM); Modified: trunk/OpenMPT/mptrack/Ctrl_seq.cpp =================================================================== --- trunk/OpenMPT/mptrack/Ctrl_seq.cpp 2014-12-02 22:33:39 UTC (rev 4626) +++ trunk/OpenMPT/mptrack/Ctrl_seq.cpp 2014-12-02 23:07:06 UTC (rev 4627) @@ -596,10 +596,10 @@ } -void COrderList::UpdateView(DWORD dwHintMask, CObject *pObj) -//---------------------------------------------------------- +void COrderList::UpdateView(UpdateHint hint, CObject *pObj) +//--------------------------------------------------------- { - if(pObj != this && (dwHintMask & HINT_MODSEQUENCE)) + if(pObj != this && (hint.GetType() & HINT_MODSEQUENCE)) { InvalidateRect(NULL, FALSE); UpdateInfoText(); Modified: trunk/OpenMPT/mptrack/Ctrl_smp.cpp =================================================================== --- trunk/OpenMPT/mptrack/Ctrl_smp.cpp 2014-12-02 22:33:39 UTC (rev 4626) +++ trunk/OpenMPT/mptrack/Ctrl_smp.cpp 2014-12-02 23:07:06 UTC (rev 4627) @@ -336,7 +336,7 @@ if (m_nSample != nSmp) { m_nSample = nSmp; - UpdateView((m_nSample << HINT_SHIFT_SMP) | HINT_SAMPLEINFO, NULL); + UpdateView(SampleHint(HINT_SAMPLEINFO, m_nSample), NULL); } if (bUpdNum) { @@ -402,7 +402,7 @@ SetCurrentSample((lParam > 0) ? ((SAMPLEINDEX)lParam) : m_nSample); // Initial Update - if (!m_bInitialized) UpdateView((m_nSample << HINT_SHIFT_SMP) | HINT_SAMPLEINFO | HINT_MODTYPE, NULL); + if (!m_bInitialized) UpdateView(SampleHint(HINT_SAMPLEINFO | HINT_MODTYPE, m_nSample), NULL); CChildFrame *pFrame = (CChildFrame *)GetParentFrame(); if ((pFrame) && (m_hWndView)) PostViewMessage(VIEWMSG_LOADSTATE, (LPARAM)pFrame->GetSampleViewState()); SwitchToView(); @@ -547,24 +547,25 @@ } -void CCtrlSamples::UpdateView(DWORD dwHintMask, CObject *pObj) -//------------------------------------------------------------ +void CCtrlSamples::UpdateView(UpdateHint hint, CObject *pObj) +//----------------------------------------------------------- { if(pObj == this) return; - if (dwHintMask & HINT_MPTOPTIONS) + HintType hintType = hint.GetType(); + if (hintType & HINT_MPTOPTIONS) { m_ToolBar1.UpdateStyle(); m_ToolBar2.UpdateStyle(); } - if (!(dwHintMask & (HINT_SAMPLEINFO|HINT_MODTYPE))) return; + if (!(hintType & (HINT_SAMPLEINFO|HINT_MODTYPE))) return; - const SAMPLEINDEX updateSmp = (dwHintMask >> HINT_SHIFT_SMP); + const SAMPLEINDEX updateSmp = hint.GetData(); - if(updateSmp != m_nSample && updateSmp != 0 && !(dwHintMask & HINT_MODTYPE)) return; + if(updateSmp != m_nSample && updateSmp != 0 && !(hintType & HINT_MODTYPE)) return; LockControls(); - if (!m_bInitialized) dwHintMask |= HINT_MODTYPE; + if (!m_bInitialized) hintType |= HINT_MODTYPE; // Updating Ranges - if (dwHintMask & HINT_MODTYPE) + if (hintType & HINT_MODTYPE) { const CModSpecifications *specs = &m_sndFile.GetModSpecifications(); @@ -656,7 +657,7 @@ m_CbnBaseNote.EnableWindow(b); } // Updating Values - if (dwHintMask & (HINT_MODTYPE|HINT_SAMPLEINFO)) + if (hintType & (HINT_MODTYPE|HINT_SAMPLEINFO)) { if(m_nSample > m_sndFile.GetNumSamples()) { @@ -755,7 +756,7 @@ wsprintf(s, "%lu", sample.nSustainEnd); m_EditSustainEnd.SetWindowText(s); } - if (dwHintMask & (HINT_MODTYPE | HINT_SAMPLEINFO | HINT_SMPNAMES)) + if (hintType & (HINT_MODTYPE | HINT_SAMPLEINFO | HINT_SMPNAMES)) { CheckDlgButton(IDC_CHECK2, m_sndFile.GetSample(m_nSample).uFlags[SMP_KEEPONDISK] ? BST_CHECKED : BST_UNCHECKED); GetDlgItem(IDC_CHECK2)->EnableWindow((m_sndFile.SampleHasPath(m_nSample) && m_sndFile.GetType() == MOD_TYPE_MPT) ? TRUE : FALSE); @@ -776,8 +777,8 @@ // updateAll: Update all views including this one. Otherwise, only update update other views. -void CCtrlSamples::SetModified(DWORD mask, bool updateAll, bool waveformModified) -//------------------------------------------------------------------------------- +void CCtrlSamples::SetModified(HintType mask, bool updateAll, bool waveformModified) +//---------------------------------------------------------------------------------- { m_modDoc.SetModified(); @@ -788,7 +789,7 @@ if(sample.uFlags[SMP_KEEPONDISK] && !sample.uFlags[SMP_MODIFIED]) mask |= HINT_SMPNAMES; sample.uFlags.set(SMP_MODIFIED); } - m_modDoc.UpdateAllViews(nullptr, mask | (m_nSample << HINT_SHIFT_SMP), updateAll ? nullptr : this); + m_modDoc.UpdateAllViews(nullptr, SampleHint(mask, m_nSample), updateAll ? nullptr : this); } @@ -981,13 +982,13 @@ sndFile.ReadSampleFromSong(smp, sndFile, nOldSmp); } - m_modDoc.UpdateAllViews(NULL, (smp << HINT_SHIFT_SMP) | HINT_SAMPLEINFO | HINT_SAMPLEDATA | HINT_SMPNAMES); + m_modDoc.UpdateAllViews(NULL, SampleHint(HINT_SAMPLEINFO | HINT_SAMPLEDATA | HINT_SMPNAMES, smp)); if(m_modDoc.GetNumInstruments() > 0 && m_modDoc.FindSampleParent(smp) == INSTRUMENTINDEX_INVALID) { if(Reporting::Confirm("This sample is not used by any instrument. Do you want to create a new instrument using this sample?") == cnfYes) { INSTRUMENTINDEX nins = m_modDoc.InsertInstrument(smp); - m_modDoc.UpdateAllViews(NULL, (nins << HINT_SHIFT_INS) | HINT_INSTRUMENT | HINT_INSNAMES | HINT_ENVELOPE); + m_modDoc.UpdateAllViews(NULL, InstrumentHint(HINT_INSTRUMENT | HINT_INSNAMES | HINT_ENVELOPE, nins)); m_parent.InstrumentChanged(nins); } } @@ -1162,7 +1163,7 @@ if(i != smp && m_sndFile.GetSample(i).uFlags[SMP_KEEPONDISK] && m_sndFile.GetSamplePath(i) == m_sndFile.GetSamplePath(smp)) { m_sndFile.GetSample(i).uFlags.reset(SMP_KEEPONDISK); - m_modDoc.UpdateAllViews(nullptr, HINT_SMPNAMES | HINT_SAMPLEINFO | (i << HINT_SHIFT_SMP), this); + m_modDoc.UpdateAllViews(nullptr, SampleHint(HINT_SMPNAMES | HINT_SAMPLEINFO, i), this); } } } @@ -1296,7 +1297,7 @@ if (bOk) { sample.PrecomputeLoops(m_sndFile, false); - m_modDoc.UpdateAllViews(NULL, (iSmp << HINT_SHIFT_SMP) | HINT_SAMPLEDATA, NULL); + m_modDoc.UpdateAllViews(NULL, SampleHint(HINT_SAMPLEDATA, iSmp)); } } } @@ -1405,7 +1406,7 @@ fReportOffset += fOffset; numModified++; - m_modDoc.UpdateAllViews(nullptr, (iSmp << HINT_SHIFT_SMP) | HINT_SAMPLEDATA | HINT_SAMPLEINFO); + m_modDoc.UpdateAllViews(nullptr, SampleHint(HINT_SAMPLEDATA | HINT_SAMPLEINFO, iSmp)); } EndWaitCursor(); @@ -2606,7 +2607,7 @@ { sample.SetLoop(0, sample.nLength, true, n == 2, m_sndFile); } - m_modDoc.UpdateAllViews(NULL, (m_nSample << HINT_SHIFT_SMP) | HINT_SAMPLEINFO | HINT_SAMPLEDATA); + m_modDoc.UpdateAllViews(NULL, SampleHint(HINT_SAMPLEINFO | HINT_SAMPLEDATA, m_nSample)); } else { sample.PrecomputeLoops(m_sndFile); @@ -2653,7 +2654,7 @@ { sample.SetSustainLoop(0, sample.nLength, true, n == 2, m_sndFile); } - m_modDoc.UpdateAllViews(NULL, (m_nSample << HINT_SHIFT_SMP) | HINT_SAMPLEINFO | HINT_SAMPLEDATA); + m_modDoc.UpdateAllViews(NULL, SampleHint(HINT_SAMPLEINFO | HINT_SAMPLEDATA, m_nSample)); } else { sample.PrecomputeLoops(m_sndFile); @@ -3163,7 +3164,7 @@ for(SAMPLEINDEX i = first; i <= last; i++) { m_sndFile.GetSample(i).uFlags.set(SMP_KEEPONDISK, enable && m_sndFile.SampleHasPath(i)); - m_modDoc.UpdateAllViews(nullptr, HINT_SAMPLEINFO | (i << HINT_SHIFT_SMP), this); + m_modDoc.UpdateAllViews(nullptr, SampleHint(HINT_SAMPLEINFO, i), this); } } @@ -3192,7 +3193,7 @@ m_sndFile.GetSample(*sample).nVibType = m_sndFile.GetSample(m_nSample).nVibType; m_sndFile.GetSample(*sample).nVibRate = m_sndFile.GetSample(m_nSample).nVibRate; m_sndFile.GetSample(*sample).nVibSweep = m_sndFile.GetSample(m_nSample).nVibSweep; - m_modDoc.UpdateAllViews(nullptr, HINT_SAMPLEINFO | ((*sample) << HINT_SHIFT_SMP), (CObject *)this); + m_modDoc.UpdateAllViews(nullptr, SampleHint(HINT_SAMPLEINFO, *sample), (CObject *)this); } } } Modified: trunk/OpenMPT/mptrack/Ctrl_smp.h =================================================================== --- trunk/OpenMPT/mptrack/Ctrl_smp.h 2014-12-02 22:33:39 UTC (rev 4626) +++ trunk/OpenMPT/mptrack/Ctrl_smp.h 2014-12-02 23:07:06 UTC (rev 4627) @@ -78,7 +78,7 @@ virtual void RecalcLayout(); virtual void OnActivatePage(LPARAM); virtual void OnDeactivatePage(); - virtual void UpdateView(DWORD dwHintMask=0, CObject *pObj=NULL); + virtual void UpdateView(UpdateHint hint = HINT_NONE, CObject *pObj = nullptr); virtual LRESULT OnModCtrlMsg(WPARAM wParam, LPARAM lParam); virtual BOOL GetToolTipText(UINT uId, TCHAR *pszText); virtual BOOL PreTranslateMessage(MSG* pMsg); @@ -128,7 +128,7 @@ afx_msg void OnEnableStretchToSize(); afx_msg void OnEstimateSampleSize(); - void SetModified(DWORD mask, bool updateAll, bool waveformModified); + void SetModified(HintType mask, bool updateAll, bool waveformModified); //}}AFX_MSG DECLARE_MESSAGE_MAP() Modified: trunk/OpenMPT/mptrack/Draw_pat.cpp =================================================================== --- trunk/OpenMPT/mptrack/Draw_pat.cpp 2014-12-02 22:33:39 UTC (rev 4626) +++ trunk/OpenMPT/mptrack/Draw_pat.cpp 2014-12-02 23:07:06 UTC (rev 4627) @@ -224,14 +224,15 @@ } -void CViewPattern::UpdateView(DWORD dwHintMask, CObject *hint) -//------------------------------------------------------------ +void CViewPattern::UpdateView(UpdateHint hint, CObject *pObj) +//----------------------------------------------------------- { - if(hint == this) + if(pObj == this) { return; } - if(dwHintMask & HINT_MPTOPTIONS) + HintType hintType = hint.GetType(); + if(hintType & HINT_MPTOPTIONS) { UpdateColors(); UpdateSizes(); @@ -239,26 +240,26 @@ InvalidatePattern(true); return; } - if(dwHintMask & HINT_MODCHANNELS) + if(hintType & HINT_MODCHANNELS) { InvalidateChannelsHeaders(); UpdateScrollSize(); } - const PATTERNINDEX updatePat = (dwHintMask >> HINT_SHIFT_PAT); - if(HintFlagPart(dwHintMask) == HINT_PATTERNDATA + const PATTERNINDEX updatePat = hint.GetData(); + if(hintType == HINT_PATTERNDATA && m_nPattern != updatePat && updatePat != 0 && updatePat != GetNextPattern() && updatePat != GetPrevPattern()) return; - if(dwHintMask & (HINT_MODTYPE|HINT_PATTERNDATA)) + if(hintType & (HINT_MODTYPE|HINT_PATTERNDATA)) { InvalidatePattern(false); - } else if(dwHintMask & HINT_PATTERNROW) + } else if(hintType & HINT_PATTERNROW) { - InvalidateRow(dwHintMask >> HINT_SHIFT_ROW); + InvalidateRow(hint.GetData()); } } Modified: trunk/OpenMPT/mptrack/EffectVis.cpp =================================================================== --- trunk/OpenMPT/mptrack/EffectVis.cpp 2014-12-02 22:33:39 UTC (rev 4626) +++ trunk/OpenMPT/mptrack/EffectVis.cpp 2014-12-02 23:07:06 UTC (rev 4627) @@ -850,7 +850,7 @@ } m_pModDoc->SetModified(); - m_pModDoc->UpdateAllViews(NULL, HINT_PATTERNDATA | (m_nPattern << HINT_SHIFT_PAT), NULL); + m_pModDoc->UpdateAllViews(NULL, PatternHint(HINT_PATTERNDATA, m_nPattern), NULL); } void CEffectVis::SetPcNote(ROWINDEX row) Modified: trunk/OpenMPT/mptrack/ExternalSamples.cpp =================================================================== --- trunk/OpenMPT/mptrack/ExternalSamples.cpp 2014-12-02 22:33:39 UTC (rev 4626) +++ trunk/OpenMPT/mptrack/ExternalSamples.cpp 2014-12-02 23:07:06 UTC (rev 4627) @@ -119,7 +119,7 @@ TrackerDirectories::Instance().SetWorkingDirectory(dlg.GetWorkingDirectory(), DIR_SAMPLES); SetSample(smp, dlg.GetFirstFile()); - modDoc.UpdateAllViews(NULL, HINT_SAMPLEINFO | HINT_SMPNAMES | HINT_SAMPLEDATA | (smp << HINT_SHIFT_SMP)); + modDoc.UpdateAllViews(nullptr, SampleHint(HINT_SAMPLEINFO | HINT_SMPNAMES | HINT_SAMPLEDATA, smp)); GenerateList(); } Modified: trunk/OpenMPT/mptrack/Globals.cpp =================================================================== --- trunk/OpenMPT/mptrack/Globals.cpp 2014-12-02 22:33:39 UTC (rev 4626) +++ trunk/OpenMPT/mptrack/Globals.cpp 2014-12-02 23:07:06 UTC (rev 4627) @@ -159,8 +159,8 @@ } -BOOL CModTabCtrl::InsertItem(int nIndex, LPSTR pszText, LPARAM lParam, int iImage) -//-------------------------------------------------------------------------------- +BOOL CModTabCtrl::InsertItem(int nIndex, LPTSTR pszText, LPARAM lParam, int iImage) +//--------------------------------------------------------------------------------- { TC_ITEM tci; tci.mask = TCIF_TEXT | TCIF_PARAM | TCIF_IMAGE; @@ -276,7 +276,7 @@ void CModControlView::OnUpdate(CView*, LPARAM lHint, CObject*pHint) //----------------------------------------------------------------- { - UpdateView(lHint, pHint); + UpdateView(UpdateHint(lHint), pHint); } @@ -423,14 +423,14 @@ } -void CModControlView::UpdateView(DWORD lHint, CObject *pObject) -//------------------------------------------------------------- +void CModControlView::UpdateView(UpdateHint lHint, CObject *pObject) +//------------------------------------------------------------------ { CWnd *pActiveDlg = NULL; CModDoc *pDoc = GetDocument(); if (!pDoc) return; // Module type changed: update tabs - if (lHint & HINT_MODTYPE) + if (lHint.GetType() & HINT_MODTYPE) { UINT nCount = 4; UINT mask = 1 | 2 | 4 | 16; @@ -450,19 +450,19 @@ if (pActiveDlg) pActiveDlg->ShowWindow(SW_HIDE); } m_TabCtrl.DeleteAllItems(); - if (mask & 1) m_TabCtrl.InsertItem(count++, "General", IDD_CONTROL_GLOBALS, IMAGE_GENERAL); - if (mask & 2) m_TabCtrl.InsertItem(count++, "Patterns", IDD_CONTROL_PATTERNS, IMAGE_PATTERNS); - if (mask & 4) m_TabCtrl.InsertItem(count++, "Samples", IDD_CONTROL_SAMPLES, IMAGE_SAMPLES); - if (mask & 8) m_TabCtrl.InsertItem(count++, "Instruments", IDD_CONTROL_INSTRUMENTS, IMAGE_INSTRUMENTS); - //if (mask & 32) m_TabCtrl.InsertItem(count++, "Graph", IDD_CONTROL_GRAPH, IMAGE_GRAPH); //rewbs.graph - if (mask & 16) m_TabCtrl.InsertItem(count++, "Comments", IDD_CONTROL_COMMENTS, IMAGE_COMMENTS); + if (mask & 1) m_TabCtrl.InsertItem(count++, _T("General"), IDD_CONTROL_GLOBALS, IMAGE_GENERAL); + if (mask & 2) m_TabCtrl.InsertItem(count++, _T("Patterns"), IDD_CONTROL_PATTERNS, IMAGE_PATTERNS); + if (mask & 4) m_TabCtrl.InsertItem(count++, _T("Samples"), IDD_CONTROL_SAMPLES, IMAGE_SAMPLES); + if (mask & 8) m_TabCtrl.InsertItem(count++, _T("Instruments"), IDD_CONTROL_INSTRUMENTS, IMAGE_INSTRUMENTS); + //if (mask & 32) m_TabCtrl.InsertItem(count++, _T("Graph"), IDD_CONTROL_GRAPH, IMAGE_GRAPH); //rewbs.graph + if (mask & 16) m_TabCtrl.InsertItem(count++, _T("Comments"), IDD_CONTROL_COMMENTS, IMAGE_COMMENTS); } } // Update child dialogs for (UINT nIndex=0; nIndex<MAX_PAGES; nIndex++) { CModControlDlg *pDlg = m_Pages[nIndex]; - if ((pDlg) && (pObject != pDlg)) pDlg->UpdateView(lHint, pObject); + if ((pDlg) && (pObject != pDlg)) pDlg->UpdateView(UpdateHint(lHint), pObject); } // Restore the displayed child dialog if (pActiveDlg) pActiveDlg->ShowWindow(SW_SHOW); @@ -585,7 +585,7 @@ void CModScrollView::OnUpdate(CView* pView, LPARAM lHint, CObject*pHint) //---------------------------------------------------------------------- { - if (pView != this) UpdateView(lHint, pHint); + if (pView != this) UpdateView(UpdateHint(lHint), pHint); } Modified: trunk/OpenMPT/mptrack/Globals.h =================================================================== --- trunk/OpenMPT/mptrack/Globals.h 2014-12-02 22:33:39 UTC (rev 4626) +++ trunk/OpenMPT/mptrack/Globals.h 2014-12-02 23:07:06 UTC (rev 4627) @@ -83,7 +83,7 @@ virtual void OnOK() {} virtual void OnCancel() {} virtual void RecalcLayout() {} - virtual void UpdateView(DWORD, CObject *) {} + virtual void UpdateView(UpdateHint, CObject *) {} virtual CRuntimeClass *GetAssociatedViewClass() { return NULL; } virtual LRESULT OnModCtrlMsg(WPARAM wParam, LPARAM lParam); virtual void OnActivatePage(LPARAM) {} @@ -106,7 +106,7 @@ //================================ { public: - BOOL InsertItem(int nIndex, LPSTR pszText, LPARAM lParam=0, int iImage=-1); + BOOL InsertItem(int nIndex, LPTSTR pszText, LPARAM lParam=0, int iImage=-1); BOOL Create(DWORD dwStyle, const RECT& rect, CWnd* pParentWnd, UINT nID); LPARAM GetItemData(int nIndex); }; @@ -140,7 +140,7 @@ protected: void RecalcLayout(); - void UpdateView(DWORD dwHintMask=0, CObject *pHint=NULL); + void UpdateView(UpdateHint hint = HINT_NONE, CObject *pHint=NULL); BOOL SetActivePage(int nIndex=-1, LPARAM lParam=-1); int GetActivePage(); @@ -204,7 +204,7 @@ virtual void OnDraw(CDC *) {} virtual void OnPrepareDC(CDC*, CPrintInfo*) {} virtual void OnUpdate(CView* pSender, LPARAM lHint, CObject* pHint); - virtual void UpdateView(DWORD, CObject *) {} + virtual void UpdateView(UpdateHint, CObject *) {} virtual LRESULT OnModViewMsg(WPARAM wParam, LPARAM lParam); virtual BOOL OnDragonDrop(BOOL, const DRAGONDROP *) { return FALSE; } virtual LRESULT OnPlayerNotify(Notification *) { return 0; } Modified: trunk/OpenMPT/mptrack/MainFrm.cpp =================================================================== --- trunk/OpenMPT/mptrack/MainFrm.cpp 2014-12-02 22:33:39 UTC (rev 4626) +++ trunk/OpenMPT/mptrack/MainFrm.cpp 2014-12-02 23:07:06 UTC (rev 4627) @@ -1772,17 +1772,17 @@ } -void CMainFrame::UpdateAllViews(DWORD dwHint, CObject *pHint) +void CMainFrame::UpdateAllViews(UpdateHint hint, CObject *pHint) //----------------------------------------------------------- { CDocTemplate *pDocTmpl = theApp.GetModDocTemplate(); if (pDocTmpl) { POSITION pos = pDocTmpl->GetFirstDocPosition(); - CDocument *pDoc; - while ((pos != NULL) && ((pDoc = pDocTmpl->GetNextDoc(pos)) != NULL)) + CModDoc *pDoc; + while ((pos != NULL) && ((pDoc = dynamic_cast<CModDoc *>(pDocTmpl->GetNextDoc(pos))) != nullptr)) { - pDoc->UpdateAllViews(NULL, dwHint, pHint); + pDoc->UpdateAllViews(NULL, hint, pHint); } } } @@ -1848,10 +1848,10 @@ } -VOID CMainFrame::UpdateTree(CModDoc *pModDoc, DWORD lHint, CObject *pHint) -//------------------------------------------------------------------------ +VOID CMainFrame::UpdateTree(CModDoc *pModDoc, UpdateHint hint, CObject *pHint) +//---------------------------------------------------------------------------- { - m_wndTree.OnUpdate(pModDoc, lHint, pHint); + m_wndTree.OnUpdate(pModDoc, hint, pHint); } @@ -2267,10 +2267,10 @@ } -LRESULT CMainFrame::OnInvalidatePatterns(WPARAM wParam, LPARAM) -//------------------------------------------------------------- +LRESULT CMainFrame::OnInvalidatePatterns(WPARAM, LPARAM) +//------------------------------------------------------ { - UpdateAllViews(wParam, NULL); + UpdateAllViews(UpdateHint(HINT_MPTOPTIONS, 0)); return TRUE; } Modified: trunk/OpenMPT/mptrack/Mainbar.cpp =================================================================== --- trunk/OpenMPT/mptrack/Mainbar.cpp 2014-12-02 22:33:39 UTC (rev 4626) +++ trunk/OpenMPT/mptrack/Mainbar.cpp 2014-12-02 23:07:06 UTC (rev 4627) @@ -448,12 +448,12 @@ int nSpeed = pSndFile->m_PlayState.m_nMusicSpeed; if (nSpeed != nCurrentSpeed) { - //rewbs.envRowGrid - CModDoc *pModDoc = CMainFrame::GetMainFrame()->GetActiveDoc(); - if (pModDoc) { - pModDoc->UpdateAllViews(NULL, HINT_SPEEDCHANGE); + CModDoc *modDoc = pSndFile->GetpModDoc(); + if(modDoc != nullptr) + { + // Update envelope views if speed has changed + modDoc->UpdateAllViews(nullptr, HINT_ENVELOPE); } - //end rewbs.envRowGrid if (nCurrentSpeed < 0) m_SpinSpeed.EnableWindow(TRUE); nCurrentSpeed = nSpeed; @@ -947,10 +947,10 @@ } -VOID CModTreeBar::OnUpdate(CModDoc *pModDoc, DWORD lHint, CObject *pHint) -//----------------------------------------------------------------------- +VOID CModTreeBar::OnUpdate(CModDoc *pModDoc, UpdateHint hint, CObject *pHint) +//--------------------------------------------------------------------------- { - if (m_pModTree) m_pModTree->OnUpdate(pModDoc, lHint, pHint); + if (m_pModTree) m_pModTree->OnUpdate(pModDoc, hint, pHint); } Modified: trunk/OpenMPT/mptrack/Mainbar.h =================================================================== --- trunk/OpenMPT/mptrack/Mainbar.h 2014-12-02 22:33:39 UTC (rev 4626) +++ trunk/OpenMPT/mptrack/Mainbar.h 2014-12-02 23:07:06 UTC (rev 4627) @@ -149,7 +149,7 @@ VOID OnOptionsChanged(); VOID OnDocumentCreated(CModDoc *pModDoc); VOID OnDocumentClosed(CModDoc *pModDoc); - VOID OnUpdate(CModDoc *pModDoc, DWORD lHint=0, CObject *pHint=NULL); + VOID OnUpdate(CModDoc *pModDoc, UpdateHint hint, CObject *pHint=NULL); VOID UpdatePlayPos(CModDoc *pModDoc, Notification *pNotify); HWND GetModTreeHWND(); //rewbs.customKeys BOOL PostMessageToModTree(UINT cmdID, WPARAM wParam, LPARAM lParam); //rewbs.customKeys Modified: trunk/OpenMPT/mptrack/Mainfrm.h =================================================================== --- trunk/OpenMPT/mptrack/Mainfrm.h 2014-12-02 22:33:39 UTC (rev 4626) +++ trunk/OpenMPT/mptrack/Mainfrm.h 2014-12-02 23:07:06 UTC (rev 4627) @@ -11,6 +11,7 @@ #pragma once #include "Mptrack.h" +#include "UpdateHints.h" #include "../common/AudioCriticalSection.h" #include "../common/mutex.h" #include "../soundlib/Sndfile.h" @@ -429,7 +430,7 @@ static HFONT GetGUIFont() { return m_hGUIFont; } static HFONT GetFixedFont() { return m_hFixedFont; } static HFONT GetLargeFixedFont() { return m_hLargeFixedFont; } - static void UpdateAllViews(DWORD dwHint, CObject *pHint=NULL); + static void UpdateAllViews(UpdateHint hint, CObject *pHint=NULL); static LRESULT CALLBACK KeyboardProc(int code, WPARAM wParam, LPARAM lParam); static CInputHandler *m_InputHandler; //rewbs.customKeys static CAutoSaver *m_pAutoSaver; //rewbs.customKeys @@ -445,7 +446,7 @@ CView *GetActiveView(); //rewbs.customKeys void OnDocumentCreated(CModDoc *pModDoc); void OnDocumentClosed(CModDoc *pModDoc); - void UpdateTree(CModDoc *pModDoc, DWORD lHint=0, CObject *pHint=NULL); + void UpdateTree(CModDoc *pModDoc, UpdateHint hint, CObject *pHint=NULL); static CInputHandler* GetInputHandler() { return m_InputHandler; } //rewbs.customKeys bool m_bModTreeHasFocus; //rewbs.customKeys CWnd *m_pNoteMapHasFocus; //rewbs.customKeys Modified: trunk/OpenMPT/mptrack/Moddoc.cpp =================================================================== --- trunk/OpenMPT/mptrack/Moddoc.cpp 2014-12-02 22:33:39 UTC (rev 4626) +++ trunk/OpenMPT/mptrack/Moddoc.cpp 2014-12-02 23:07:06 UTC (rev 4627) @@ -1642,12 +1642,13 @@ } -void CModDoc::UpdateAllViews(CView *pSender, LPARAM lHint, CObject *pHint) -//------------------------------------------------------------------------ +void CModDoc::UpdateAllViews(CView *pSender, UpdateHint hint, CObject *pHint) +//--------------------------------------------------------------------------- { - CDocument::UpdateAllViews(pSender, lHint, pHint); + // Tunnel our UpdateHint into an LPARAM + CDocument::UpdateAllViews(pSender, hint.AsLPARAM(), pHint); CMainFrame *pMainFrm = CMainFrame::GetMainFrame(); - if (pMainFrm) pMainFrm->UpdateTree(this, lHint, pHint); + if (pMainFrm) pMainFrm->UpdateTree(this, hint, pHint); } Modified: trunk/OpenMPT/mptrack/Moddoc.h =================================================================== --- trunk/OpenMPT/mptrack/Moddoc.h 2014-12-02 22:33:39 UTC (rev 4626) +++ trunk/OpenMPT/mptrack/Moddoc.h 2014-12-02 23:07:06 UTC (rev 4627) @@ -14,86 +14,13 @@ #include "../common/misc_util.h" #include "Undo.h" #include "Notification.h" +#include "UpdateHints.h" #include <time.h> OPENMPT_NAMESPACE_BEGIN class EncoderFactoryBase; -//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// -//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// -// Bit Mask for updating view (hints of what changed) -#define HINT_MODTYPE 0x00001 -#define HINT_MODCOMMENTS 0x00002 -#define HINT_MODGENERAL 0x00004 -#define HINT_MODSEQUENCE 0x00008 -#define HINT_MODCHANNELS 0x00010 -#define HINT_PATTERNDATA 0x00020 -#define HINT_PATTERNROW 0x00040 -#define HINT_PATNAMES 0x00080 -#define HINT_MPTOPTIONS 0x00100 -#define HINT_SAMPLEINFO 0x00400 -#define HINT_SAMPLEDATA 0x00800 -#define HINT_INSTRUMENT 0x01000 -#define HINT_ENVELOPE 0x02000 -#define HINT_SMPNAMES 0x04000 -#define HINT_INSNAMES 0x08000 -#define HINT_UNDO 0x10000 -#define HINT_MIXPLUGINS 0x20000 -#define HINT_SPEEDCHANGE 0x40000 //rewbs.envRowGrid -#define HINT_SEQNAMES 0x80000 -#define HINT_MAXHINTFLAG HINT_SEQNAMES -//Bits 0-19 are reserved. -#define HINT_MASK_FLAGS (2*HINT_MAXHINTFLAG - 1) //When applied to hint parameter, should give the flag part. -#define HINT_MASK_ITEM (~HINT_MASK_FLAGS) //To nullify update hintbits from hint parameter. -#define HintFlagPart(x) ((x) & HINT_MASK_FLAGS) - -//If fails, hint flagbits|itembits does not enable all bits; -//might be worthwhile to check the reason. -STATIC_ASSERT( (HINT_MASK_ITEM | HINT_MASK_FLAGS) == -1 ); - -//If fails, hint param flag and item parts overlap; might be a problem. -STATIC_ASSERT( (HINT_MASK_ITEM & HINT_MASK_FLAGS) == 0 ); - -//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// -// NOTE : be careful when adding new flags !!! -// ------------------------------------------------------------------------------------------------------------------------- -// those flags are passed through a 32bits parameter which can also contain instrument/sample/pattern row... number : -// HINT_SAMPLEINFO & HINT_SAMPLEDATA & HINT_SMPNAMES : can be used with a sample number 12bit coded (passed as bit 20 to 31) -// HINT_PATTERNROW : is used with a row number 10bit coded (passed as bit 22 to 31) -// HINT_INSTRUMENT & HINT_INSNAMES : can be used with an instrument number 8bit coded (passed as bit 24 to 31) -// new flags can be added BUT be carefull that they will not be used in a case they should aliased with, ie, a sample number -//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// -//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - - -//Updateview hints can, in addition to the actual hints, contain -//addition data such as pattern or instrument index. The -//values below define the number of bits used for these. -#define HINT_BITS_PATTERN 12 -#define HINT_BITS_ROWS 10 -#define HINT_BITS_SAMPLE 12 -#define HINT_BITS_INST 8 -#define HINT_BITS_CHNTAB 8 -#define HINT_BITS_SEQUENCE 6 - -//Defines bit shift values used for setting/retrieving the additional hint data to/from hint parameter. -#define HINT_SHIFT_PAT (32 - HINT_BITS_PATTERN) -#define HINT_SHIFT_ROW (32 - HINT_BITS_ROWS) -#define HINT_SHIFT_SMP (32 - HINT_BITS_SAMPLE) -#define HINT_SHIFT_INS (32 - HINT_BITS_INST) -#define HINT_SHIFT_CHNTAB (32 - HINT_BITS_CHNTAB) -#define HINT_SHIFT_SEQUENCE (32 - HINT_BITS_SEQUENCE) - -//Check that hint bit counts are not too large given the number of hint flags. -STATIC_ASSERT( ((-1 << HINT_SHIFT_PAT) & HINT_MASK_ITEM) == (-1 << HINT_SHIFT_PAT) ); -STATIC_ASSERT( ((-1 << HINT_SHIFT_ROW) & HINT_MASK_ITEM) == (-1 << HINT_SHIFT_ROW) ); -STATIC_ASSERT( ((-1 << HINT_SHIFT_SMP) & HINT_MASK_ITEM) == (-1 << HINT_SHIFT_SMP) ); -STATIC_ASSERT( ((-1 << HINT_SHIFT_INS) & HINT_MASK_ITEM) == (-1 << HINT_SHIFT_INS) ); -STATIC_ASSERT( ((-1 << HINT_SHIFT_CHNTAB) & HINT_MASK_ITEM) == (-1 << HINT_SHIFT_CHNTAB) ); -STATIC_ASSERT( ((-1 << HINT_SHIFT_SEQUENCE) & HINT_MASK_ITEM) == (-1 << HINT_SHIFT_SEQUENCE) ); - - ///////////////////////////////////////////////////////////////////////// // Split Keyboard Settings (pattern editor) @@ -321,7 +248,7 @@ bool PasteEnvelope(UINT nIns, enmEnvelopeTypes nEnv); LRESULT ActivateView(UINT nIdView, DWORD dwParam); - void UpdateAllViews(CView *pSender, LPARAM lHint=0L, CObject *pHint=NULL); + void UpdateAllViews(CView *pSender, UpdateHint hint, CObject *pHint=NULL); HWND GetEditPosition(ROWINDEX &row, PATTERNINDEX &pat, ORDERINDEX &ord); LRESULT OnCustomKeyMsg(WPARAM, LPARAM); void TogglePluginEditor(UINT m_nCurrentPlugin); Modified: trunk/OpenMPT/mptrack/Modedit.cpp =================================================================== --- trunk/OpenMPT/mptrack/Modedit.cpp 2014-12-02 22:33:39 UTC (rev 4626) +++ trunk/OpenMPT/mptrack/Modedit.cpp 2014-12-02 23:07:06 UTC (rev 4627) @@ -947,7 +947,7 @@ if(success) { SetModified(); - UpdateAllViews(NULL, HINT_PATTERNDATA | (nPattern << HINT_SHIFT_PAT), NULL); + UpdateAllViews(NULL, PatternHint(HINT_PATTERNDATA, nPattern), NULL); } else { GetPatternUndo().RemoveLastUndoStep(); @@ -977,7 +977,7 @@ if(success) { SetModified(); - UpdateAllViews(NULL, HINT_PATTERNDATA | (nPattern << HINT_SHIFT_PAT), NULL); + UpdateAllViews(NULL, PatternHint(HINT_PATTERNDATA, nPattern), NULL); } else { GetPatternUndo().RemoveLastUndoStep(); @@ -1056,6 +1056,7 @@ } HGLOBAL hCpy = ::GetClipboardData(CF_TEXT); LPCSTR p; + bool result = false; if ((hCpy) && ((p = (LPSTR)GlobalLock(hCpy)) != NULL)) { ModInstrument *pIns = m_SndFile.Instruments[nIns]; @@ -1115,11 +1116,10 @@ } GlobalUnlock(hCpy); CloseClipboard(); - SetModified(); - UpdateAllViews(NULL, (nIns << HINT_SHIFT_INS) | HINT_ENVELOPE, NULL); + result = true; } EndWaitCursor(); - return true; + return result; } Modified: trunk/OpenMPT/mptrack/PatternEditorDialogs.cpp =================================================================== --- trunk/OpenMPT/mptrack/PatternEditorDialogs.cpp 2014-12-02 22:33:39 UTC (rev 4626) +++ trunk/OpenMPT/mptrack/PatternEditorDialogs.cpp 2014-12-02 23:07:06 UTC (rev 4627) @@ -944,7 +944,7 @@ m->note = newNote; m->instr = newInstr; - modDoc->UpdateAllViews(NULL, (editPos.row << HINT_SHIFT_ROW) | HINT_PATTERNROW, NULL); + modDoc->UpdateAllViews(NULL, RowHint(HINT_PATTERNROW, editPos.row), NULL); if(wasParamControl != m->IsPcNote()) { @@ -989,7 +989,7 @@ m->volcmd = newVolCmd; m->vol = newVol; - modDoc->UpdateAllViews(NULL, (editPos.row << HINT_SHIFT_ROW) | HINT_PATTERNROW, NULL); + modDoc->UpdateAllViews(NULL, RowHint(HINT_PATTERNROW, editPos.row), NULL); if(volCmdChanged) { @@ -1050,7 +1050,7 @@ } UpdateEffectRange(true); - modDoc->UpdateAllViews(NULL, (editPos.row << HINT_SHIFT_ROW) | HINT_PATTERNROW, NULL); + modDoc->UpdateAllViews(NULL, RowHint(HINT_PATTERNROW, editPos.row), NULL); } } @@ -1095,7 +1095,7 @@ m->param = newParam; } - modDoc->UpdateAllViews(NULL, (editPos.row << HINT_SHIFT_ROW) | HINT_PATTERNROW, NULL); + modDoc->UpdateAllViews(NULL, RowHint(HINT_PATTERNROW, editPos.row), NULL); } } } Added: trunk/OpenMPT/mptrack/UpdateHints.h =================================================================== --- trunk/OpenMPT/mptrack/UpdateHints.h (rev 0) +++ trunk/OpenMPT/mptrack/UpdateHints.h 2014-12-02 23:07:06 UTC (rev 4627) @@ -0,0 +1,114 @@ +/* + * UpdateHints.h + * ------------- + * Purpose: Hint type and abstraction class for passing around hints between module views. + * Notes : Please read the note in enum HintMode if you plan to add more hint types. + * Authors: OpenMPT Devs + * The OpenMPT source code is released under the BSD license. Read LICENSE for more details. + */ + + +#pragma once + +#include "../common/FlagSet.h" + +// Bit Mask for updating view (hints of what changed) +enum HintType +{ + HINT_NONE = 0x00000, + HINT_MODTYPE = 0x00001, + HINT_MODCOMMENTS = 0x00002, + HINT_MODGENERAL = 0x00004, + HINT_MODSEQUENCE = 0x00008, + HINT_MODCHANNELS = 0x00010, + HINT_PATTERNDATA = 0x00020, + HINT_PATTERNROW = 0x00040, + HINT_PATNAMES = 0x00080, + HINT_MPTOPTIONS = 0x00100, + HINT_SAMPLEINFO = 0x00400, + HINT_SAMPLEDATA = 0x00800, + HINT_INSTRUMENT = 0x01000, + HINT_ENVELOPE = 0x02000, + HINT_SMPNAMES = 0x04000, + HINT_INSNAMES = 0x08000, + HINT_UNDO = 0x10000, + HINT_MIXPLUGINS = 0x20000, + HINT_SEQNAMES = 0x40000, + // NOTE: Hint type and hint data need to fit together into one 32-bit integer. + // At the moment, this means that there are only 14 bits left for hint data! + // This means that it will be difficult to add hints in the current scheme, + // which is only really required because hints are passed through LPARAMs in MFC. + // There are two ways to fix this: + // 1) Override MFC's mechanism to pass around UpdateHints instead (Rewrite OnUpdate/etc) + // 2) Reduce number of bits required for hints. This could for example be done by + // finding mutually exclusive flags that can only be used if a certain "context" + // is set (e.g. have instrument, sample and pattern contexts and then use overlapping + // flags for them) + + HINT_MAXHINTFLAG = HINT_SEQNAMES +}; +DECLARE_FLAGSET(HintType) + + +struct UpdateHint +{ +protected: + uint32_t data; + + template<int v> + static int PowerOf2Exponent() + { + if(v <= 1) return 0; + else return 1 + PowerOf2Exponent<v / 2>(); + } + + void Set(HintType type, uint16_t item = 0) + { + data = type | item << PowerOf2Exponent<HINT_MAXHINTFLAG>(); + } + +public: + UpdateHint(HintType type, uint16_t item = 0) + { + Set(type, item); + } + + explicit UpdateHint(LPARAM data) : data(static_cast<uint32_t>(data)) { } + + HintType GetType() const { return static_cast<HintType>(data & (HINT_MAXHINTFLAG | (HINT_MAXHINTFLAG - 1))); } + uint16_t GetData() const { return static_cast<uint16_t>(data >> PowerOf2Exponent<HINT_MAXHINTFLAG>()); } + + LPARAM AsLPARAM() const { return data; } +}; + +static_assert(sizeof(UpdateHint) <= sizeof(LPARAM), "Update hints are currently tunnelled through LPARAMs in MFC"); + +struct SampleHint : public UpdateHint +{ + SampleHint(HintType type, SAMPLEINDEX item) : UpdateHint(type, item) { } +}; + +struct InstrumentHint : public UpdateHint +{ + InstrumentHint(HintType type, INSTRUMENTINDEX item) : UpdateHint(type, item) { } +}; + +struct PatternHint : public UpdateHint +{ + PatternHint(HintType type, PATTERNINDEX item) : UpdateHint(type, item) { } +}; + +struct RowHint : public UpdateHint +{ + RowHint(HintType type, ROWINDEX item) : UpdateHint(type, static_cast<uint16_t>(item)) { } +}; + +struct SequenceHint : public UpdateHint +{ + SequenceHint(HintType type, SEQUENCEINDEX item) : UpdateHint(type, item) { } +}; + +struct ChannelTabHint : public UpdateHint +{ + ChannelTabHint(HintType type, int item) : UpdateHint(type, static_cast<uint16_t>(item)) { } +}; Property changes on: trunk/OpenMPT/mptrack/UpdateHints.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/View_gen.cpp =================================================================== --- trunk/OpenMPT/mptrack/View_gen.cpp 2014-12-02 22:33:39 UTC (rev 4626) +++ trunk/OpenMPT/mptrack/View_gen.cpp 2014-12-02 23:07:06 UTC (rev 4627) @@ -281,8 +281,9 @@ void CViewGlobals::OnUpdate(CView* pView, LPARAM lHint, CObject*pHint) //-------------------------------------------------------------------- { - if ((HintFlagPart(lHint) == HINT_MODCHANNELS) && ((lHint >> HINT_SHIFT_CHNTAB) != m_nActiveTab)) return; - if (pView != this) UpdateView(lHint, pHint); + UpdateHint hint(lHint); + if (hint.GetType() == HINT_MODCHANNELS && hint.GetData () != m_nActiveTab) return; + if (pView != this) UpdateView(hint, pHint); } @@ -297,19 +298,19 @@ } -void CViewGlobals::UpdateView(DWORD dwHintMask, CObject *) -//-------------------------------------------------------- +void CViewGlobals::UpdateView(UpdateHint hint, CObject *) +//------------------------------------------------------- { CHAR s[128]; TC_ITEM tci; CModDoc *pModDoc = GetDocument(); - CSoundFile *pSndFile; int nTabCount, nTabIndex; if (!pModDoc) return; - if (!(dwHintMask & (HINT_MODTYPE|HINT_MODCHANNELS|HINT_MIXPLUGINS))) return; - pSndFile = pModDoc->GetSoundFile(); - nTabCount = (pSndFile->m_nChannels + 3) / 4; + CSoundFile &sndFile = pModDoc->GetrSoundFile(); + HintType hintType = hint.GetType(); + if (!(hintType & (HINT_MODTYPE|HINT_MODCHANNELS|HINT_MIXPLUGINS))) return; + nTabCount = (sndFile.m_nChannels + 3) / 4; if (nTabCount != m_TabCtrl.GetItemCount()) { UINT nOldSel = m_TabCtrl.GetCurSel(); @@ -334,14 +335,14 @@ } nTabIndex = m_TabCtrl.GetCurSel(); if ((nTabIndex < 0) || (nTabIndex >= nTabCount)) return; // ??? - if ((m_nActiveTab != nTabIndex) || (dwHintMask & (HINT_MODTYPE|HINT_MODCHANNELS))) + if ((m_nActiveTab != nTabIndex) || (hintType & (HINT_MODTYPE|HINT_MODCHANNELS))) { LockControls(); m_nActiveTab = static_cast<CHANNELINDEX>(nTabIndex); for (int ichn=0; ichn<4; ichn++) { const UINT nChn = nTabIndex*4+ichn; - const BOOL bEnable = (nChn < pSndFile->GetNumChannels()) ? TRUE : FALSE; + const BOOL bEnable = (nChn < sndFile.GetNumChannels()) ? TRUE : FALSE; if(nChn < MAX_BASECHANNELS) { // Text @@ -349,20 +350,20 @@ if (bEnable) wsprintf(s, "Channel %d", nChn+1); SetDlgItemText(IDC_TEXT1 + ichn, s); // Mute - CheckDlgButton(IDC_CHECK1 + ichn * 2, pSndFile->ChnSettings[nChn].dwFlags[CHN_MUTE] ? TRUE : FALSE); + CheckDlgButton(IDC_CHECK1 + ichn * 2, sndFile.ChnSettings[nChn].dwFlags[CHN_MUTE] ? TRUE : FALSE); // Surround - CheckDlgButton(IDC_CHECK2 + ichn * 2, pSndFile->ChnSettings[nChn].dwFlags[CHN_SURROUND] ? TRUE : FALSE); + CheckDlgButton(IDC_CHECK2 + ichn * 2, sndFile.ChnSettings[nChn].dwFlags[CHN_SURROUND] ? TRUE : FALSE); // Volume - int vol = pSndFile->ChnSettings[nChn].nVolume; + int vol = sndFile.ChnSettings[nChn].nVolume; m_sbVolume[ichn].SetPos(vol); SetDlgItemInt(IDC_EDIT1+ichn*2, vol); // Pan - int pan = pSndFile->ChnSettings[nChn].nPan; + int pan = sndFile.ChnSettings[nChn].nPan; m_sbPan[ichn].SetPos(pan/4); SetDlgItemInt(IDC_EDIT2+ichn*2, pan); // Channel name - memcpy(s, pSndFile->ChnSettings[nChn].szName, MAX_CHANNELNAME); + memcpy(s, sndFile.ChnSettings[nChn].szName, MAX_CHANNELNAME); s[MAX_CHANNELNAME - 1] = 0; SetDlgItemText(IDC_EDIT9 + ichn, s); ((CEdit*)(GetDlgItem(IDC_EDIT9 + ichn)))->LimitText(MAX_CHANNELNAME - 1); @@ -374,14 +375,14 @@ int fxsel = 0; for (UINT ifx=0; ifx<MAX_MIXPLUGINS; ifx++) { - if (pSndFile->m_MixPlugins[ifx].IsValidPlugin() - || (strcmp(pSndFile->m_MixPlugins[ifx].GetName(), "") - || (pSndFile->ChnSettings[nChn].nMixPlugin == ifx + 1))) + if (sndFile.m_MixPlugins[ifx].IsValidPlugin() + || (strcmp(sndFile.m_MixPlugins[ifx].GetName(), "") + || (sndFile.ChnSettings[nChn].nMixPlugin == ifx + 1))) { - wsprintf(s, "FX%d: %s", ifx + 1, pSndFile->m_MixPlugins[ifx].GetName()); + wsprintf(s, "FX%d: %s", ifx + 1, sndFile.m_MixPlugins[ifx].GetName()); int n = m_CbnEffects[ichn].AddString(s); m_CbnEffects[ichn].SetItemData(n, ifx+1); - if (pSndFile->ChnSettings[nChn].nMixPlugin == ifx+1) fxsel = n; + if (sndFile.ChnSettings[nChn].nMixPlugin == ifx+1) fxsel = n; } } m_CbnEffects[ichn].SetRedraw(TRUE); @@ -392,32 +393,32 @@ SetDlgItemText(IDC_TEXT1+ichn, ""); // Enable/Disable controls for this channel - BOOL bIT = ((bEnable) && (pSndFile->m_nType & (MOD_TYPE_IT|MOD_TYPE_MPT))); + BOOL bIT = ((bEnable) && (sndFile.m_nType & (MOD_TYPE_IT|MOD_TYPE_MPT))); GetDlgItem(IDC_CHECK1 + ichn * 2)->EnableWindow(bEnable); GetDlgItem(IDC_CHECK2 + ichn * 2)->EnableWindow(bIT); m_sbVolume[ichn].EnableWindow(bIT); m_spinVolume[ichn].EnableWindow(bIT); - m_sbPan[ichn].EnableWindow(bEnable && !(pSndFile->GetType() & (MOD_TYPE_XM|MOD_TYPE_MOD))); - m_spinPan[ichn].EnableWindow(bEnable && !(pS... [truncated message content] |
From: <sag...@us...> - 2014-12-06 17:17:37
|
Revision: 4634 http://sourceforge.net/p/modplug/code/4634 Author: saga-games Date: 2014-12-06 17:17:11 +0000 (Sat, 06 Dec 2014) Log Message: ----------- [Ref] Refactored GUI update hints again. Now there are 22 bits of item information available in each update hint (instead of 14), and hint usage is somewhat more typesafe thanks to different hint categories (e.g. it is no longer possbile to combined HINT_SMPNAMES and HINT_INSNAMES and then add a parameter, in which case the parameter would mean both "update sample name x" and "update instrument name x", which wouldn't make sense most of the time). Modified Paths: -------------- trunk/OpenMPT/mptrack/AbstractVstEditor.cpp trunk/OpenMPT/mptrack/ChannelManagerDlg.cpp trunk/OpenMPT/mptrack/CleanupSong.cpp trunk/OpenMPT/mptrack/Ctrl_com.cpp trunk/OpenMPT/mptrack/Ctrl_com.h trunk/OpenMPT/mptrack/Ctrl_gen.cpp trunk/OpenMPT/mptrack/Ctrl_gen.h trunk/OpenMPT/mptrack/Ctrl_ins.cpp trunk/OpenMPT/mptrack/Ctrl_ins.h trunk/OpenMPT/mptrack/Ctrl_pat.cpp trunk/OpenMPT/mptrack/Ctrl_pat.h trunk/OpenMPT/mptrack/Ctrl_seq.cpp trunk/OpenMPT/mptrack/Ctrl_smp.cpp trunk/OpenMPT/mptrack/Ctrl_smp.h trunk/OpenMPT/mptrack/Draw_pat.cpp trunk/OpenMPT/mptrack/EffectVis.cpp trunk/OpenMPT/mptrack/ExternalSamples.cpp trunk/OpenMPT/mptrack/Globals.cpp trunk/OpenMPT/mptrack/Globals.h trunk/OpenMPT/mptrack/MainFrm.cpp trunk/OpenMPT/mptrack/Mainbar.cpp trunk/OpenMPT/mptrack/ModConvert.cpp trunk/OpenMPT/mptrack/Moddoc.cpp trunk/OpenMPT/mptrack/Moddoc.h trunk/OpenMPT/mptrack/Modedit.cpp trunk/OpenMPT/mptrack/Mptrack.cpp trunk/OpenMPT/mptrack/Mptrack.h trunk/OpenMPT/mptrack/PatternEditorDialogs.cpp trunk/OpenMPT/mptrack/SelectPluginDialog.cpp trunk/OpenMPT/mptrack/Undo.cpp trunk/OpenMPT/mptrack/UpdateHints.h trunk/OpenMPT/mptrack/View_gen.cpp trunk/OpenMPT/mptrack/View_gen.h trunk/OpenMPT/mptrack/View_ins.cpp trunk/OpenMPT/mptrack/View_ins.h trunk/OpenMPT/mptrack/View_pat.cpp trunk/OpenMPT/mptrack/View_pat.h trunk/OpenMPT/mptrack/View_smp.cpp trunk/OpenMPT/mptrack/View_smp.h trunk/OpenMPT/mptrack/View_tre.cpp trunk/OpenMPT/mptrack/Vstplug.cpp trunk/OpenMPT/mptrack/view_com.cpp trunk/OpenMPT/mptrack/view_com.h Modified: trunk/OpenMPT/mptrack/AbstractVstEditor.cpp =================================================================== --- trunk/OpenMPT/mptrack/AbstractVstEditor.cpp 2014-12-03 21:39:34 UTC (rev 4633) +++ trunk/OpenMPT/mptrack/AbstractVstEditor.cpp 2014-12-06 17:17:11 UTC (rev 4634) @@ -920,7 +920,9 @@ //pIns->wMidiBank = (WORD)((m_pVstPlugin->GetCurrentProgram() >> 7) + 1); //pIns->nMidiProgram = (BYTE)((m_pVstPlugin->GetCurrentProgram() & 0x7F) + 1); - pModDoc->UpdateAllViews(NULL, InstrumentHint(HINT_INSTRUMENT | HINT_INSNAMES | HINT_ENVELOPE | (first ? HINT_MODTYPE : HINT_NONE), nIns)); + InstrumentHint hint = InstrumentHint(nIns).Info().Envelope().Names(); + if(first) hint.ModType(); + pModDoc->UpdateAllViews(nullptr, hint); if(sndFile.GetModSpecifications().supportsPlugins) { pModDoc->SetModified(); Modified: trunk/OpenMPT/mptrack/ChannelManagerDlg.cpp =================================================================== --- trunk/OpenMPT/mptrack/ChannelManagerDlg.cpp 2014-12-03 21:39:34 UTC (rev 4633) +++ trunk/OpenMPT/mptrack/ChannelManagerDlg.cpp 2014-12-06 17:17:11 UTC (rev 4634) @@ -11,7 +11,6 @@ #include "stdafx.h" #include "Moddoc.h" #include "Mainfrm.h" -#include "View_gen.h" #include "ChannelManagerDlg.h" @@ -227,7 +226,7 @@ // Update document & player pModDoc->SetModified(); - pModDoc->UpdateAllViews(NULL, HINT_MODTYPE | HINT_MODCHANNELS, NULL); //refresh channel headers + pModDoc->UpdateAllViews(nullptr, GeneralHint().Channels().ModType()); //refresh channel headers // Redraw channel manager window InvalidateRect(NULL,TRUE); @@ -342,7 +341,7 @@ ResetState(); - pModDoc->UpdateAllViews(NULL, HINT_MODCHANNELS, NULL); + pModDoc->UpdateAllViews(nullptr, GeneralHint().Channels()); InvalidateRect(NULL,FALSE); } } @@ -418,7 +417,7 @@ if(currentTab != 3) ResetState(); - pModDoc->UpdateAllViews(NULL, HINT_MODCHANNELS, NULL); + pModDoc->UpdateAllViews(nullptr, GeneralHint().Channels()); InvalidateRect(NULL,FALSE); } } @@ -508,7 +507,7 @@ if(currentTab != 3) ResetState(); - pModDoc->UpdateAllViews(NULL, HINT_MODCHANNELS, NULL); + pModDoc->UpdateAllViews(nullptr, GeneralHint().Channels()); InvalidateRect(NULL,FALSE); } @@ -1010,7 +1009,7 @@ for(CHANNELINDEX nChn = 0; nChn < MAX_BASECHANNELS ; nChn++) state[pattern[nChn]] = false; - if(pModDoc) pModDoc->UpdateAllViews(NULL, HINT_MODCHANNELS, NULL); + if(pModDoc) pModDoc->UpdateAllViews(nullptr, GeneralHint().Channels()); } void CChannelManagerDlg::OnLButtonDown(UINT nFlags,CPoint point) @@ -1034,7 +1033,7 @@ rightButton = false; CMainFrame * pMainFrm = CMainFrame::GetMainFrame(); CModDoc *pModDoc = pMainFrm->GetActiveDoc(); - if(pModDoc) pModDoc->UpdateAllViews(NULL, HINT_MODCHANNELS, NULL); + if(pModDoc) pModDoc->UpdateAllViews(nullptr, GeneralHint().Channels()); } void CChannelManagerDlg::OnRButtonDown(UINT nFlags,CPoint point) @@ -1104,7 +1103,7 @@ pModDoc->MuteChannel(n,!pModDoc->IsChannelMuted(n)); } pModDoc->SetModified(); - pModDoc->UpdateAllViews(NULL, ChannelTabHint(HINT_MODCHANNELS, n / CHANNELS_IN_TAB)); + pModDoc->UpdateAllViews(nullptr, GeneralHint(n).Channels()); break; case 1: BYTE rec; @@ -1123,7 +1122,7 @@ if(button == CM_BT_LEFT) pModDoc->NoFxChannel(n, false); else pModDoc->NoFxChannel(n, true); pModDoc->SetModified(); - pModDoc->UpdateAllViews(NULL, ChannelTabHint(HINT_MODCHANNELS, n / CHANNELS_IN_TAB)); + pModDoc->UpdateAllViews(nullptr, GeneralHint(n).Channels()); break; case 3: if(button == CM_BT_LEFT) Modified: trunk/OpenMPT/mptrack/CleanupSong.cpp =================================================================== --- trunk/OpenMPT/mptrack/CleanupSong.cpp 2014-12-03 21:39:34 UTC (rev 4633) +++ trunk/OpenMPT/mptrack/CleanupSong.cpp 2014-12-06 17:17:11 UTC (rev 4634) @@ -165,7 +165,7 @@ if(m_bCheckBoxes[CU_RESET_VARIABLES]) bModified |= ResetVariables(); if(bModified) modDoc.SetModified(); - modDoc.UpdateAllViews(NULL, HINT_MODTYPE | HINT_MODSEQUENCE | HINT_MODGENERAL | HINT_SMPNAMES | HINT_INSNAMES); + modDoc.UpdateAllViews(nullptr, UpdateHint().ModType()); logcapturer.ShowLog(true); CDialog::OnOK(); } Modified: trunk/OpenMPT/mptrack/Ctrl_com.cpp =================================================================== --- trunk/OpenMPT/mptrack/Ctrl_com.cpp 2014-12-03 21:39:34 UTC (rev 4633) +++ trunk/OpenMPT/mptrack/Ctrl_com.cpp 2014-12-06 17:17:11 UTC (rev 4634) @@ -76,7 +76,7 @@ // Initialize comments m_hFont = NULL; m_EditComments.SetMargins(4, 0); - UpdateView(HINT_MODTYPE|HINT_MODCOMMENTS|HINT_MPTOPTIONS, NULL); + UpdateView(CommentHint().ModType()); m_EditComments.SetFocus(); m_bInitialized = TRUE; return FALSE; @@ -110,7 +110,8 @@ void CCtrlComments::UpdateView(UpdateHint hint, CObject *pHint) //------------------------------------------------------------- { - if ((pHint == this) || (!(hint.GetType() & (HINT_MODCOMMENTS|HINT_MPTOPTIONS|HINT_MODTYPE)))) return; + CommentHint commentHint = hint.ToType<CommentHint>(); + if (pHint == this || !commentHint.GetType()[HINT_MODCOMMENTS | HINT_MPTOPTIONS | HINT_MODTYPE]) return; if (m_nLockCount) return; m_nLockCount++; HFONT newfont; @@ -156,7 +157,7 @@ m_EditComments.SetSel(0, 0); m_EditComments.SetModify(FALSE); } - if (hint.GetType() & HINT_MODTYPE) + if (commentHint.GetType() & HINT_MODTYPE) { m_EditComments.SetReadOnly(!m_sndFile.GetModSpecifications().hasComments); } @@ -211,7 +212,7 @@ { m_sndFile.songMessage.assign(p); m_modDoc.SetModified(); - m_modDoc.UpdateAllViews(NULL, HINT_MODCOMMENTS, this); + m_modDoc.UpdateAllViews(nullptr, CommentHint(), this); } delete[] p; Modified: trunk/OpenMPT/mptrack/Ctrl_com.h =================================================================== --- trunk/OpenMPT/mptrack/Ctrl_com.h 2014-12-03 21:39:34 UTC (rev 4633) +++ trunk/OpenMPT/mptrack/Ctrl_com.h 2014-12-06 17:17:11 UTC (rev 4634) @@ -33,7 +33,7 @@ virtual BOOL OnInitDialog(); virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support virtual void RecalcLayout(); - virtual void UpdateView(UpdateHint hint = HINT_NONE, CObject *pObj = nullptr); + virtual void UpdateView(UpdateHint hint, CObject *pObj = nullptr); virtual CRuntimeClass *GetAssociatedViewClass(); virtual void OnActivatePage(LPARAM); virtual void OnDeactivatePage(); Modified: trunk/OpenMPT/mptrack/Ctrl_gen.cpp =================================================================== --- trunk/OpenMPT/mptrack/Ctrl_gen.cpp 2014-12-03 21:39:34 UTC (rev 4633) +++ trunk/OpenMPT/mptrack/Ctrl_gen.cpp 2014-12-06 17:17:11 UTC (rev 4634) @@ -117,7 +117,7 @@ m_SliderSamplePreAmp.SetRange(0, MAX_SLIDER_SAMPLE_VOL); m_bEditsLocked=false; - UpdateView(HINT_MODGENERAL|HINT_MODTYPE|HINT_MODSEQUENCE, NULL); + UpdateView(GeneralHint().ModType()); OnActivatePage(0); m_bInitialized = TRUE; @@ -207,12 +207,13 @@ { if (pHint == this) return; FlagSet<HintType> hintType = hint.GetType(); - if (hintType & HINT_MODSEQUENCE) + const bool updateAll = hintType[HINT_MODTYPE]; + if (updateAll || (hint.GetCategory() == HINTCAT_SEQUENCE && hintType[HINT_MODSEQUENCE])) { // Set max valid restart position m_SpinRestartPos.SetRange32(0, m_sndFile.Order.GetLengthTailTrimmed() - 1); } - if (hintType & HINT_MODGENERAL) + if (updateAll || (hint.GetCategory() == HINTCAT_GENERAL && hintType[HINT_MODGENERAL])) { if (!m_bEditsLocked) { @@ -231,7 +232,7 @@ m_SliderTempo.SetPos(m_sndFile.GetModSpecifications().tempoMax - m_sndFile.m_nDefaultTempo); } - if (hintType & HINT_MODTYPE) + if (updateAll) { CModSpecifications specs = m_sndFile.GetModSpecifications(); m_SpinTempo.SetRange(specs.tempoMin, specs.tempoMax); @@ -276,7 +277,7 @@ m_EditModType.SetWindowText(s); } CheckDlgButton(IDC_CHECK_LOOPSONG, (TrackerSettings::Instance().gbLoopSong) ? TRUE : FALSE); - if (hintType & HINT_MPTOPTIONS) + if (hintType[HINT_MPTOPTIONS]) { m_VuMeterLeft.InvalidateRect(NULL, FALSE); m_VuMeterRight.InvalidateRect(NULL, FALSE); @@ -304,7 +305,7 @@ m_sndFile.m_PlayState.m_nMusicTempo = tempo; m_modDoc.SetModified(); - m_modDoc.UpdateAllViews(NULL, HINT_MODGENERAL, this); + m_modDoc.UpdateAllViews(nullptr, GeneralHint().General(), this); } } @@ -317,7 +318,7 @@ m_sndFile.m_nDefaultGlobalVolume = gv; m_modDoc.SetModified(); - m_modDoc.UpdateAllViews(NULL, HINT_MODGENERAL, this); + m_modDoc.UpdateAllViews(nullptr, GeneralHint().General(), this); } } @@ -329,7 +330,7 @@ m_sndFile.m_nSamplePreAmp = spa; if(m_sndFile.GetType() != MOD_TYPE_MOD) m_modDoc.SetModified(); - m_modDoc.UpdateAllViews(NULL, HINT_MODGENERAL, this); + m_modDoc.UpdateAllViews(nullptr, GeneralHint().General(), this); } } @@ -341,11 +342,11 @@ m_sndFile.m_nVSTiVolume = vv; m_sndFile.RecalculateGainForAllPlugs(); m_modDoc.SetModified(); - m_modDoc.UpdateAllViews(NULL, HINT_MODGENERAL, this); + m_modDoc.UpdateAllViews(nullptr, GeneralHint().General(), this); } } - UpdateView(HINT_MODGENERAL, NULL); + UpdateView(GeneralHint().General()); } } @@ -361,7 +362,7 @@ { m_EditTitle.SetModify(FALSE); m_modDoc.SetModified(); - m_modDoc.UpdateAllViews(NULL, HINT_MODGENERAL, this); + m_modDoc.UpdateAllViews(nullptr, GeneralHint().General(), this); } } @@ -384,8 +385,8 @@ m_sndFile.m_nDefaultTempo = n; m_sndFile.m_PlayState.m_nMusicTempo = n; m_modDoc.SetModified(); - m_modDoc.UpdateAllViews(NULL, HINT_MODGENERAL, this); - UpdateView(HINT_MODGENERAL, NULL); + m_modDoc.UpdateAllViews(nullptr, GeneralHint().General(), this); + UpdateView(GeneralHint().General()); m_bEditsLocked=false; } } @@ -411,8 +412,9 @@ m_sndFile.m_nDefaultSpeed = n; m_sndFile.m_PlayState.m_nMusicSpeed = n; m_modDoc.SetModified(); - // HINT_ENVELOPE: Update envelope grid view - m_modDoc.UpdateAllViews(NULL, HINT_MODGENERAL | HINT_ENVELOPE, this); + m_modDoc.UpdateAllViews(nullptr, GeneralHint().General(), this); + // Update envelope grid view + m_modDoc.UpdateAllViews(nullptr, InstrumentHint().Envelope(), this); m_bEditsLocked=false; } } @@ -437,8 +439,8 @@ m_sndFile.m_nVSTiVolume = n; m_sndFile.RecalculateGainForAllPlugs(); m_modDoc.SetModified(); - m_modDoc.UpdateAllViews(NULL, HINT_MODGENERAL, this); - UpdateView(HINT_MODGENERAL, NULL); + m_modDoc.UpdateAllViews(nullptr, GeneralHint().General(), this); + UpdateView(GeneralHint().General()); m_bEditsLocked=false; } } @@ -461,8 +463,8 @@ m_bEditsLocked=true; m_sndFile.m_nSamplePreAmp = n; m_modDoc.SetModified(); - m_modDoc.UpdateAllViews(NULL, HINT_MODGENERAL, this); - UpdateView(HINT_MODGENERAL, NULL); + m_modDoc.UpdateAllViews(nullptr, GeneralHint().General(), this); + UpdateView(GeneralHint().General()); m_bEditsLocked=false; } } @@ -487,8 +489,8 @@ m_sndFile.m_nDefaultGlobalVolume = n; m_sndFile.m_PlayState.m_nGlobalVolume = n; m_modDoc.SetModified(); - m_modDoc.UpdateAllViews(NULL, HINT_MODGENERAL, this); - UpdateView(HINT_MODGENERAL, NULL); + m_modDoc.UpdateAllViews(nullptr, GeneralHint().General(), this); + UpdateView(GeneralHint().General()); m_bEditsLocked = false; } } @@ -515,7 +517,7 @@ m_EditRestartPos.SetModify(FALSE); m_sndFile.m_nRestartPos = n; m_modDoc.SetModified(); - m_modDoc.UpdateAllViews(NULL, HINT_MODGENERAL, this); + m_modDoc.UpdateAllViews(nullptr, GeneralHint().General(), this); } } } Modified: trunk/OpenMPT/mptrack/Ctrl_gen.h =================================================================== --- trunk/OpenMPT/mptrack/Ctrl_gen.h 2014-12-03 21:39:34 UTC (rev 4633) +++ trunk/OpenMPT/mptrack/Ctrl_gen.h 2014-12-06 17:17:11 UTC (rev 4634) @@ -76,7 +76,7 @@ virtual BOOL OnInitDialog(); virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support virtual void RecalcLayout(); - virtual void UpdateView(UpdateHint hint = HINT_NONE, CObject *pObj = nullptr); + virtual void UpdateView(UpdateHint hint, CObject *pObj = nullptr); virtual CRuntimeClass *GetAssociatedViewClass(); virtual void OnActivatePage(LPARAM); virtual void OnDeactivatePage(); Modified: trunk/OpenMPT/mptrack/Ctrl_ins.cpp =================================================================== --- trunk/OpenMPT/mptrack/Ctrl_ins.cpp 2014-12-03 21:39:34 UTC (rev 4633) +++ trunk/OpenMPT/mptrack/Ctrl_ins.cpp 2014-12-06 17:17:11 UTC (rev 4634) @@ -401,7 +401,7 @@ } if (bModified) { - m_pParent.SetModified(HINT_INSTRUMENT, false); + m_pParent.SetModified(InstrumentHint().Info(), false); InvalidateRect(NULL, FALSE); } } @@ -422,7 +422,7 @@ } if (bModified) { - m_pParent.SetModified(HINT_INSTRUMENT, false); + m_pParent.SetModified(InstrumentHint().Info(), false); InvalidateRect(NULL, FALSE); } } @@ -443,7 +443,7 @@ } if (bModified) { - m_pParent.SetModified(HINT_INSTRUMENT, false); + m_pParent.SetModified(InstrumentHint().Info(), false); InvalidateRect(NULL, FALSE); } } @@ -485,7 +485,7 @@ } if (bModified) { - m_pParent.SetModified(HINT_INSTRUMENT, false); + m_pParent.SetModified(InstrumentHint().Info(), false); InvalidateRect(NULL, FALSE); } } @@ -586,7 +586,7 @@ if (n != pIns->NoteMap[m_nNote]) { pIns->NoteMap[m_nNote] = n; - m_pParent.SetModified(HINT_INSTRUMENT, false); + m_pParent.SetModified(InstrumentHint().Info(), false); InvalidateRect(NULL, FALSE); } if (bOk) @@ -621,7 +621,7 @@ if (n != pIns->Keyboard[m_nNote]) { pIns->Keyboard[m_nNote] = n; - m_pParent.SetModified(HINT_INSTRUMENT, false); + m_pParent.SetModified(InstrumentHint().Info(), false); InvalidateRect(NULL, FALSE); PlayNote(m_nNote+1); } @@ -653,7 +653,7 @@ if (n != pIns->NoteMap[m_nNote]) { pIns->NoteMap[m_nNote] = n; - m_pParent.SetModified(HINT_INSTRUMENT, false); + m_pParent.SetModified(InstrumentHint().Info(), false); InvalidateRect(NULL, FALSE); } @@ -980,13 +980,13 @@ } -// Set instrument (and moddoc) as modified. +// Set document as modified and update other views. // updateAll: Update all views including this one. Otherwise, only update update other views. -void CCtrlInstruments::SetModified(FlagSet<HintType> mask, bool updateAll, bool modified) -//--------------------------------------------------------------------------------------- +void CCtrlInstruments::SetModified(InstrumentHint hint, bool updateAll) +//--------------------------------------------------------------------- { - m_modDoc.UpdateAllViews(NULL, InstrumentHint(mask, m_nInstrument), updateAll ? nullptr : this); - if(modified) m_modDoc.SetModified(); + m_modDoc.SetModified(); + m_modDoc.UpdateAllViews(nullptr, hint.SetData(m_nInstrument), updateAll ? nullptr : this); } @@ -1000,7 +1000,7 @@ { m_nInstrument = nIns; m_NoteMap.SetCurrentInstrument(m_nInstrument); - UpdateView(InstrumentHint(HINT_INSTRUMENT | HINT_ENVELOPE, m_nInstrument), NULL); + UpdateView(InstrumentHint(m_nInstrument).Info().Envelope(), NULL); } else { // Just in case @@ -1046,7 +1046,7 @@ SetCurrentInstrument((lParam > 0) ? lParam : m_nInstrument); // Initial Update - if (!m_bInitialized) UpdateView(InstrumentHint(HINT_INSTRUMENT | HINT_ENVELOPE | HINT_MODTYPE, m_nInstrument), NULL); + if (!m_bInitialized) UpdateView(InstrumentHint(m_nInstrument).Info().Envelope().ModType(), NULL); CChildFrame *pFrame = (CChildFrame *)GetParentFrame(); if (pFrame) PostViewMessage(VIEWMSG_LOADSTATE, (LPARAM)pFrame->GetInstrumentViewState()); @@ -1128,25 +1128,26 @@ //--------------------------------------------------------------- { if(pObj == this) return; - FlagSet<HintType> hintType = hint.GetType(); - if (hintType & HINT_MPTOPTIONS) + if (hint.GetType()[HINT_MPTOPTIONS]) { m_ToolBar.UpdateStyle(); } LockControls(); - if (hintType & HINT_MIXPLUGINS) OnMixPlugChanged(); + if (hint.ToType<PluginHint>().GetType()[HINT_MIXPLUGINS | HINT_PLUGINNAMES]) OnMixPlugChanged(); UnlockControls(); - if(!(hintType & (HINT_INSTRUMENT | HINT_ENVELOPE| HINT_MODTYPE))) return; - const INSTRUMENTINDEX updateIns = hint.GetData(); + const InstrumentHint instrHint = hint.ToType<InstrumentHint>(); + FlagSet<HintType> hintType = instrHint.GetType(); + if (!m_bInitialized) hintType.set(HINT_MODTYPE); + if(!hintType[HINT_MODTYPE | HINT_INSTRUMENT | HINT_ENVELOPE]) return; - if(updateIns != m_nInstrument && updateIns != 0 && (hintType & (HINT_INSTRUMENT | HINT_ENVELOPE)) && !(hintType & HINT_MODTYPE)) return; + const INSTRUMENTINDEX updateIns = instrHint.GetInstrument(); + if(updateIns != m_nInstrument && updateIns != 0 && !hintType[HINT_MODTYPE]) return; + LockControls(); - if (!m_bInitialized) hintType |= HINT_MODTYPE; + const ModInstrument *pIns = m_sndFile.Instruments[m_nInstrument]; - ModInstrument *pIns = m_sndFile.Instruments[m_nInstrument]; - - if (hintType & HINT_MODTYPE) + if (hintType[HINT_MODTYPE]) { const CModSpecifications *specs = &m_sndFile.GetModSpecifications(); @@ -1233,7 +1234,7 @@ m_CbnMidiCh.SetItemData(m_CbnMidiCh.AddString(s), ich); } } - if (hintType & (HINT_INSTRUMENT|HINT_MODTYPE)) + if (hintType[HINT_MODTYPE | HINT_INSTRUMENT | HINT_MODTYPE]) { // Backwards compatibility with IT modules that use now deprecated hack features. m_SliderCutSwing.EnableWindow((pIns != nullptr && (m_sndFile.GetType() == MOD_TYPE_MPT || pIns->nCutSwing != 0)) ? TRUE : FALSE); @@ -1354,7 +1355,7 @@ } m_NoteMap.InvalidateRect(NULL, FALSE); } - if(hintType & (HINT_MIXPLUGINS|HINT_MODTYPE)) + if(hintType[HINT_MIXPLUGINS | HINT_MODTYPE]) { UpdatePluginList(); } @@ -1439,7 +1440,6 @@ if (!m_nInstrument) m_nInstrument = 1; if (m_sndFile.ReadInstrumentFromFile(m_nInstrument, file, TrackerSettings::Instance().m_MayNormalizeSamplesOnLoad)) { - SetModified(HINT_SAMPLEINFO | HINT_MODTYPE, true, false); bOk = TRUE; } } @@ -1465,10 +1465,12 @@ } SetCurrentInstrument(m_nInstrument); - SetModified(HINT_INSTRUMENT | HINT_ENVELOPE | HINT_INSNAMES | HINT_SMPNAMES | HINT_SAMPLEINFO | HINT_SAMPLEDATA, true); + SetModified(InstrumentHint().Info().Envelope().Names(), true); } else bOk = FALSE; } - if (bFirst) m_modDoc.UpdateAllViews(NULL, HINT_MODTYPE | HINT_INSNAMES | HINT_SMPNAMES); + SampleHint hint = SampleHint().Info().Data().Names(); + if (bFirst) hint.ModType(); + m_modDoc.UpdateAllViews(nullptr, hint, this); if (!bOk) ErrorBox(IDS_ERR_FILETYPE, this); return bOk; } @@ -1499,8 +1501,10 @@ cs.Leave(); - SetModified(HINT_INSTRUMENT | HINT_ENVELOPE | HINT_INSNAMES | HINT_SMPNAMES, true); - if (bFirst) m_modDoc.UpdateAllViews(NULL, HINT_MODTYPE | HINT_INSNAMES | HINT_SMPNAMES); + SetModified(InstrumentHint().Info().Envelope().Names(), true); + SampleHint hint = SampleHint().Info().Data().Names(); + if (bFirst) hint.ModType(); + m_modDoc.UpdateAllViews(nullptr, hint, this); EndWaitCursor(); return TRUE; } @@ -1660,9 +1664,9 @@ if (ins != INSTRUMENTINDEX_INVALID) { SetCurrentInstrument(ins); - m_modDoc.UpdateAllViews(NULL, InstrumentHint(HINT_INSTRUMENT | HINT_INSNAMES | HINT_ENVELOPE, ins)); + m_modDoc.UpdateAllViews(nullptr, InstrumentHint(ins).Info().Envelope().Names()); } - if (bFirst) m_modDoc.UpdateAllViews(NULL, InstrumentHint(HINT_MODTYPE | HINT_INSTRUMENT | HINT_INSNAMES, ins)); + if (bFirst) m_modDoc.UpdateAllViews(nullptr, InstrumentHint(ins).Info().Names().ModType()); m_parent.InstrumentChanged(m_nInstrument); SwitchToView(); } @@ -1677,7 +1681,7 @@ if(ins != INSTRUMENTINDEX_INVALID) { SetCurrentInstrument(ins); - m_modDoc.UpdateAllViews(NULL, InstrumentHint(HINT_INSTRUMENT | HINT_INSNAMES | HINT_ENVELOPE, ins)); + m_modDoc.UpdateAllViews(nullptr, InstrumentHint(ins).Info().Envelope().Names()); } m_parent.InstrumentChanged(m_nInstrument); } @@ -1770,9 +1774,6 @@ else ok = m_sndFile.SaveITIInstrument(m_nInstrument, dlg.GetFirstFile(), index == (m_sndFile.GetType() == MOD_TYPE_XM ? 3 : 2), m_sndFile.GetType() != MOD_TYPE_XM && index == 3); - SetModified(HINT_MODTYPE | HINT_INSNAMES, true, false); - m_modDoc.UpdateAllViews(nullptr, HINT_SMPNAMES, this); - EndWaitCursor(); if (!ok) ErrorBox(IDS_ERR_SAVEINS, this); @@ -1808,7 +1809,7 @@ if ((pIns) && (strncmp(s, pIns->name, MAX_INSTRUMENTNAME))) { mpt::String::Copy(pIns->name, s); - SetModified(HINT_INSNAMES, false); + SetModified(InstrumentHint().Names(), false); } } } @@ -1826,7 +1827,7 @@ if ((pIns) && (strncmp(s, pIns->filename, 12))) { mpt::String::Copy(pIns->filename, s); - SetModified(HINT_INSNAMES, false); + SetModified(InstrumentHint().Names(), false); } } } @@ -1846,7 +1847,7 @@ if(nVol != (int)pIns->nFadeOut) { pIns->nFadeOut = nVol; - SetModified(HINT_INSTRUMENT, false); + SetModified(InstrumentHint().Info(), false); } } } @@ -1863,7 +1864,7 @@ if (nVol != (int)pIns->nGlobalVol) { pIns->nGlobalVol = nVol; - SetModified(HINT_INSTRUMENT, false); + SetModified(InstrumentHint().Info(), false); } } } @@ -1907,11 +1908,11 @@ if(smp > 0 && smp <= m_sndFile.GetNumSamples()) m_sndFile.GetSample(smp).uFlags &= ~CHN_PANNING; } - m_modDoc.UpdateAllViews(NULL, HINT_SAMPLEINFO | HINT_MODTYPE, this); + m_modDoc.UpdateAllViews(nullptr, SampleHint().Info().ModType(), this); } } } - SetModified(HINT_INSTRUMENT, false); + SetModified(InstrumentHint().Info(), false); } } @@ -1930,7 +1931,7 @@ if (nPan != (int)pIns->nPan) { pIns->nPan = nPan; - SetModified(HINT_INSTRUMENT, false); + SetModified(InstrumentHint().Info(), false); } } } @@ -1945,7 +1946,7 @@ if (pIns->nNNA != m_ComboNNA.GetCurSel()) { pIns->nNNA = m_ComboNNA.GetCurSel(); - SetModified(HINT_INSTRUMENT, false); + SetModified(InstrumentHint().Info(), false); } } } @@ -1960,7 +1961,7 @@ if (pIns->nDCT != m_ComboDCT.GetCurSel()) { pIns->nDCT = m_ComboDCT.GetCurSel(); - SetModified(HINT_INSTRUMENT, false); + SetModified(InstrumentHint().Info(), false); } } } @@ -1975,7 +1976,7 @@ if (pIns->nDNA != m_ComboDCA.GetCurSel()) { pIns->nDNA = m_ComboDCA.GetCurSel(); - SetModified(HINT_INSTRUMENT, false); + SetModified(InstrumentHint().Info(), false); } } } @@ -1993,7 +1994,7 @@ if (pIns->nMidiProgram != n) { pIns->nMidiProgram = n; - SetModified(HINT_INSTRUMENT, false); + SetModified(InstrumentHint().Info(), false); } } //rewbs.MidiBank: we will not set the midi bank/program if it is 0 @@ -2018,7 +2019,7 @@ if(w >= 0 && w <= 16384 && pIns->wMidiBank != w) { pIns->wMidiBank = w; - SetModified(HINT_INSTRUMENT, false); + SetModified(InstrumentHint().Info(), false); } //rewbs.MidiBank: we will not set the midi bank/program if it is 0 if(w == 0) @@ -2042,7 +2043,7 @@ if(pIns->nMidiChannel != ch) { pIns->nMidiChannel = ch; - SetModified(HINT_INSTRUMENT, false); + SetModified(InstrumentHint().Info(), false); } } } @@ -2057,7 +2058,7 @@ if (pIns->nResampling != (BYTE)(n & 0xff)) { pIns->nResampling = (BYTE)(n & 0xff); - SetModified(HINT_INSTRUMENT, false); + SetModified(InstrumentHint().Info(), false); } } } @@ -2084,8 +2085,7 @@ if ((!IsLocked()) && pIns->nMixPlug != nPlug) { pIns->nMixPlug = nPlug; - SetModified(HINT_INSTRUMENT, false); - m_modDoc.UpdateAllViews(NULL, HINT_MIXPLUGINS, this); + SetModified(InstrumentHint().Info(), false); } velocityStyle.SetCheck(pIns->nPluginVelocityHandling == PLUGIN_VELOCITYHANDLING_CHANNEL ? BST_CHECKED : BST_UNCHECKED); @@ -2110,7 +2110,7 @@ } UpdatePluginList(); - m_modDoc.UpdateAllViews(NULL, HINT_MIXPLUGINS, NULL); + m_modDoc.UpdateAllViews(nullptr, PluginHint(nPlug).Info().Names()); } #endif // NO_VST } @@ -2126,7 +2126,7 @@ // If this plugin can recieve MIDI events and we have no MIDI channel // selected for this instrument, automatically select MIDI channel 1. pIns->nMidiChannel = MidiFirstChannel; - UpdateView(InstrumentHint(HINT_INSTRUMENT, m_nInstrument), NULL); + UpdateView(InstrumentHint(m_nInstrument).Info()); } if(pIns->midiPWD == 0) { @@ -2174,7 +2174,7 @@ if (pIns->nPPS != (signed char)n) { pIns->nPPS = (signed char)n; - SetModified(HINT_INSTRUMENT, false); + SetModified(InstrumentHint().Info(), false); } } } @@ -2195,7 +2195,7 @@ if(pIns->nVolRampUp != newRamp) { pIns->nVolRampUp = newRamp; - SetModified(HINT_INSTRUMENT, false); + SetModified(InstrumentHint().Info(), false); } m_SliderAttack.SetPos(n); @@ -2219,7 +2219,7 @@ if (pIns->nPPC != n) { pIns->nPPC = n; - SetModified(HINT_INSTRUMENT, false); + SetModified(InstrumentHint().Info(), false); } } } @@ -2250,7 +2250,7 @@ } } UpdateFilterText(); - SetModified(HINT_INSTRUMENT, false); + SetModified(InstrumentHint().Info(), false); SwitchToView(); } @@ -2279,7 +2279,7 @@ } } UpdateFilterText(); - SetModified(HINT_INSTRUMENT, false); + SetModified(InstrumentHint().Info(), false); SwitchToView(); } @@ -2345,7 +2345,7 @@ { pIns->nVolRampUp = newRamp; SetDlgItemInt(IDC_EDIT2,n); - SetModified(HINT_INSTRUMENT, false); + SetModified(InstrumentHint().Info(), false); } // -! NEW_FEATURE#0027 } @@ -2356,7 +2356,7 @@ if ((n >= 0) && (n <= 100) && (n != (int)pIns->nVolSwing)) { pIns->nVolSwing = (uint8)n; - SetModified(HINT_INSTRUMENT, false); + SetModified(InstrumentHint().Info(), false); } } // Pan Swing @@ -2366,7 +2366,7 @@ if ((n >= 0) && (n <= 64) && (n != (int)pIns->nPanSwing)) { pIns->nPanSwing = (uint8)n; - SetModified(HINT_INSTRUMENT, false); + SetModified(InstrumentHint().Info(), false); } } //Cutoff swing @@ -2376,7 +2376,7 @@ if ((n >= 0) && (n <= 64) && (n != (int)pIns->nCutSwing)) { pIns->nCutSwing = (uint8)n; - SetModified(HINT_INSTRUMENT, false); + SetModified(InstrumentHint().Info(), false); } } //Resonance swing @@ -2386,7 +2386,7 @@ if ((n >= 0) && (n <= 64) && (n != (int)pIns->nResSwing)) { pIns->nResSwing = (uint8)n; - SetModified(HINT_INSTRUMENT, false); + SetModified(InstrumentHint().Info(), false); } } // Filter CutOff @@ -2396,7 +2396,7 @@ if ((n >= 0) && (n < 0x80) && (n != (int)(pIns->GetCutoff()))) { pIns->SetCutoff(n, pIns->IsCutoffEnabled()); - SetModified(HINT_INSTRUMENT, false); + SetModified(InstrumentHint().Info(), false); UpdateFilterText(); filterChanger = true; } @@ -2408,7 +2408,7 @@ if ((n >= 0) && (n < 0x80) && (n != (int)(pIns->GetResonance()))) { pIns->SetResonance(n, pIns->IsResonanceEnabled()); - SetModified(HINT_INSTRUMENT, false); + SetModified(InstrumentHint().Info(), false); UpdateFilterText(); filterChanger = true; } @@ -2447,7 +2447,7 @@ CSampleMapDlg dlg(m_sndFile, m_nInstrument, this); if (dlg.DoModal() == IDOK) { - SetModified(HINT_INSTRUMENT, true); + SetModified(InstrumentHint().Info(), true); m_NoteMap.InvalidateRect(NULL, FALSE); } } @@ -2530,7 +2530,7 @@ cs.Leave(); m_modDoc.SetModified(); - UpdateView(InstrumentHint(HINT_INSTRUMENT, m_nInstrument)); + UpdateView(InstrumentHint(m_nInstrument).Info()); return; } @@ -2559,7 +2559,7 @@ cs.Leave(); m_modDoc.SetModified(); - UpdateView(InstrumentHint(HINT_INSTRUMENT, m_nInstrument)); + UpdateView(InstrumentHint(m_nInstrument).Info()); return; } @@ -2585,7 +2585,7 @@ //new tuning(s) come visible. BuildTuningComboBox(); - UpdateView(InstrumentHint(HINT_INSTRUMENT, m_nInstrument)); + UpdateView(InstrumentHint(m_nInstrument).Info()); } @@ -2656,7 +2656,7 @@ } pIns->nPluginVelocityHandling = n; - SetModified(HINT_INSTRUMENT, false); + SetModified(InstrumentHint().Info(), false); } } } @@ -2679,7 +2679,7 @@ } pIns->nPluginVolumeHandling = n; - SetModified(HINT_INSTRUMENT, false); + SetModified(InstrumentHint().Info(), false); } } } @@ -2699,7 +2699,7 @@ if(pwd != pIns->midiPWD) { pIns->midiPWD = static_cast<int8>(pwd); - SetModified(HINT_INSTRUMENT, false); + SetModified(InstrumentHint().Info(), false); } } } Modified: trunk/OpenMPT/mptrack/Ctrl_ins.h =================================================================== --- trunk/OpenMPT/mptrack/Ctrl_ins.h 2014-12-03 21:39:34 UTC (rev 4633) +++ trunk/OpenMPT/mptrack/Ctrl_ins.h 2014-12-06 17:17:11 UTC (rev 4634) @@ -122,7 +122,7 @@ virtual ~CCtrlInstruments(); public: - void SetModified(FlagSet<HintType> mask, bool updateAll, bool modified = true); + void SetModified(InstrumentHint hint, bool updateAll); BOOL SetCurrentInstrument(UINT nIns, BOOL bUpdNum=TRUE); BOOL OpenInstrument(const mpt::PathString &fileName); BOOL OpenInstrument(CSoundFile &sndFile, INSTRUMENTINDEX nInstr); @@ -138,7 +138,7 @@ virtual void RecalcLayout(); virtual void OnActivatePage(LPARAM); virtual void OnDeactivatePage(); - virtual void UpdateView(UpdateHint hint = HINT_NONE, CObject *pObj = nullptr); + virtual void UpdateView(UpdateHint hint, CObject *pObj = nullptr); virtual LRESULT OnModCtrlMsg(WPARAM wParam, LPARAM lParam); virtual BOOL GetToolTipText(UINT uId, LPSTR pszText); virtual BOOL PreTranslateMessage(MSG* pMsg); Modified: trunk/OpenMPT/mptrack/Ctrl_pat.cpp =================================================================== --- trunk/OpenMPT/mptrack/Ctrl_pat.cpp 2014-12-03 21:39:34 UTC (rev 4633) +++ trunk/OpenMPT/mptrack/Ctrl_pat.cpp 2014-12-06 17:17:11 UTC (rev 4634) @@ -200,7 +200,7 @@ m_OrderList.SetFocus(); - UpdateView(HINT_MODTYPE|HINT_PATNAMES, NULL); + UpdateView(PatternHint().Names().ModType(), NULL); RecalcLayout(); m_bInitialized = TRUE; @@ -245,51 +245,53 @@ m_OrderList.UpdateView(hint, pObj); FlagSet<HintType> hintType = hint.GetType(); - if(hintType & HINT_MODSEQUENCE) + const bool updateAll = hintType[HINT_MODTYPE]; + const bool updateSeq = hint.GetCategory() == HINTCAT_SEQUENCE && hintType[HINT_MODSEQUENCE]; + const bool updatePlug = hint.GetCategory() == HINTCAT_PLUGINS && hintType[HINT_MIXPLUGINS]; + const PatternHint patternHint = hint.ToType<PatternHint>(); + + if(updateAll || updateSeq) { SetDlgItemText(IDC_EDIT_SEQUENCE_NAME, m_sndFile.Order.GetName().c_str()); - } - if(hintType & (HINT_MODSEQUENCE|HINT_MODTYPE)) - { + m_SpinSequence.SetRange(0, m_sndFile.Order.GetNumSequences() - 1); m_SpinSequence.SetPos(m_sndFile.Order.GetCurrentSequenceIndex()); - } - //rewbs.instroVST - if(hintType & (HINT_MIXPLUGINS|HINT_MODTYPE)) - { - if (HasValidPlug(m_nInstrument)) - ::EnableWindow(::GetDlgItem(m_hWnd, IDC_PATINSTROPLUGGUI), true); - else - ::EnableWindow(::GetDlgItem(m_hWnd, IDC_PATINSTROPLUGGUI), false); - // Enable/disable multisequence controls according the current modtype. - BOOL isMultiSeqAvail = (m_sndFile.GetModSpecifications().sequencesMax > 1) ? TRUE : FALSE; + const BOOL isMultiSeqAvail = (m_sndFile.GetModSpecifications().sequencesMax > 1) ? TRUE : FALSE; GetDlgItem(IDC_STATIC_SEQUENCE_NAME)->EnableWindow(isMultiSeqAvail); GetDlgItem(IDC_EDIT_SEQUENCE_NAME)->EnableWindow(isMultiSeqAvail); GetDlgItem(IDC_EDIT_SEQNUM)->EnableWindow(isMultiSeqAvail); GetDlgItem(IDC_SPIN_SEQNUM)->EnableWindow(isMultiSeqAvail); + } + if(updateAll || updatePlug) + { + GetDlgItem(IDC_PATINSTROPLUGGUI)->EnableWindow(HasValidPlug(m_nInstrument)); + } + + if(updateAll) + { // Enable/disable pattern names - BOOL isPatNameAvail = m_sndFile.GetModSpecifications().hasPatternNames ? TRUE : FALSE; + const BOOL isPatNameAvail = m_sndFile.GetModSpecifications().hasPatternNames ? TRUE : FALSE; GetDlgItem(IDC_STATIC_PATTERNNAME)->EnableWindow(isPatNameAvail); GetDlgItem(IDC_EDIT_PATTERNNAME)->EnableWindow(isPatNameAvail); } - //end rewbs.instroVST - if(hintType & HINT_MPTOPTIONS) + + if(hintType[HINT_MPTOPTIONS]) { m_ToolBar.UpdateStyle(); -// -> CODE#0007 -// -> DESC="uncheck follow song checkbox by default" - //CheckDlgButton(IDC_PATTERN_FOLLOWSONG, (TrackerSettings::Instance().m_dwPatternSetup & PATTERN_FOLLOWSONGOFF) ? MF_UNCHECKED : MF_CHECKED); m_ToolBar.SetState(ID_OVERFLOWPASTE, ((TrackerSettings::Instance().m_dwPatternSetup & PATTERN_OVERFLOWPASTE) ? TBSTATE_CHECKED : 0) | TBSTATE_ENABLED); -// -! BEHAVIOUR_CHANGE#0007 } - if(hintType & (HINT_MODTYPE|HINT_INSNAMES|HINT_SMPNAMES|HINT_PATNAMES)) + + const bool updatePatNames = patternHint.GetType()[HINT_PATNAMES]; + const bool updateSmpNames = hint.GetCategory() == HINTCAT_SAMPLES && hintType[HINT_SMPNAMES]; + const bool updateInsNames = hint.GetCategory() == HINTCAT_INSTRUMENTS && hintType[HINT_INSNAMES]; + if(updateAll || updatePatNames || updateSmpNames || updateInsNames) { LockControls(); CHAR s[256]; - if(hintType & (HINT_MODTYPE|HINT_INSNAMES|HINT_SMPNAMES)) + if(updateAll || updateSmpNames || updateInsNames) { static const TCHAR szSplitFormat[] = TEXT("%02u %s %02u: %s/%s"); UINT nPos = 0; @@ -341,11 +343,11 @@ m_CbnInstrument.SetRedraw(TRUE); m_CbnInstrument.Invalidate(FALSE); } - if(hintType & (HINT_MODTYPE|HINT_PATNAMES)) + if(updateAll || updatePatNames) { PATTERNINDEX nPat; - if(hintType & HINT_PATNAMES) - nPat = (PATTERNINDEX)hint.GetData(); + if(patternHint.GetType()[HINT_PATNAMES]) + nPat = patternHint.GetPattern(); else nPat = (PATTERNINDEX)SendViewMessage(VIEWMSG_GETCURRENTPATTERN); if(m_sndFile.Patterns.IsValidIndex(nPat)) @@ -362,7 +364,7 @@ } UnlockControls(); } - if (hintType & (HINT_MODTYPE|HINT_UNDO)) + if (hintType[HINT_MODTYPE | HINT_UNDO]) { m_ToolBar.EnableButton(ID_EDIT_UNDO, m_modDoc.GetPatternUndo().CanUndo()); } @@ -388,7 +390,7 @@ return m_OrderList.GetCurrentPattern(); case CTRLMSG_PATTERNCHANGED: - UpdateView(PatternHint(HINT_PATNAMES, static_cast<PATTERNINDEX>(lParam))); + UpdateView(PatternHint(static_cast<PATTERNINDEX>(lParam)).Names()); break; case CTRLMSG_PAT_PREVINSTRUMENT: @@ -824,7 +826,8 @@ m_OrderList.InvalidateRect(NULL, FALSE); SetCurrentPattern(newPat); m_modDoc.SetModified(); - m_modDoc.UpdateAllViews(NULL, HINT_MODSEQUENCE|HINT_PATNAMES, this); + m_modDoc.UpdateAllViews(NULL, PatternHint().Names(), this); + m_modDoc.UpdateAllViews(NULL, SequenceHint().Data(), this); } SwitchToView(); } @@ -907,7 +910,8 @@ SetCurrentPattern(m_sndFile.Order[showPattern]); m_modDoc.SetModified(); - m_modDoc.UpdateAllViews(NULL, HINT_MODSEQUENCE | HINT_PATNAMES, this); + m_modDoc.UpdateAllViews(NULL, SequenceHint().Data(), this); + m_modDoc.UpdateAllViews(NULL, PatternHint().Names(), this); if(selection.lastOrd != selection.firstOrd) m_OrderList.m_nScrollPos2nd = insertWhere + insertCount; } SwitchToView(); @@ -1091,7 +1095,7 @@ if(m_sndFile.Patterns[nPat].SetName(s)) { if(m_sndFile.GetType() & (MOD_TYPE_XM|MOD_TYPE_IT|MOD_TYPE_MPT)) m_modDoc.SetModified(); - m_modDoc.UpdateAllViews(NULL, PatternHint(HINT_PATNAMES, nPat), this); + m_modDoc.UpdateAllViews(NULL, PatternHint(nPat).Names(), this); } } } @@ -1107,7 +1111,7 @@ { m_sndFile.Order.SetName(str.GetString()); m_modDoc.SetModified(); - m_modDoc.UpdateAllViews(NULL, SequenceHint(HINT_SEQNAMES, m_sndFile.Order.GetCurrentSequenceIndex()), this); + m_modDoc.UpdateAllViews(NULL, SequenceHint(m_sndFile.Order.GetCurrentSequenceIndex()).Names(), this); } } @@ -1199,7 +1203,7 @@ //------------------------------------- { TrackerSettings::Instance().m_dwPatternSetup ^= PATTERN_OVERFLOWPASTE; - UpdateView(HINT_MPTOPTIONS, NULL); + UpdateView(UpdateHint().MPTOptions()); SwitchToView(); } Modified: trunk/OpenMPT/mptrack/Ctrl_pat.h =================================================================== --- trunk/OpenMPT/mptrack/Ctrl_pat.h 2014-12-03 21:39:34 UTC (rev 4633) +++ trunk/OpenMPT/mptrack/Ctrl_pat.h 2014-12-06 17:17:11 UTC (rev 4634) @@ -115,7 +115,7 @@ //{{AFX_VIRTUAL(COrderList) virtual BOOL PreTranslateMessage(MSG *pMsg); - virtual void UpdateView(UpdateHint hint = HINT_NONE, CObject *pObj = nullptr); + virtual void UpdateView(UpdateHint hint, CObject *pObj = nullptr); //}}AFX_VIRTUAL protected: @@ -202,7 +202,7 @@ virtual BOOL OnInitDialog(); virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support virtual void RecalcLayout(); - virtual void UpdateView(UpdateHint hint = HINT_NONE, CObject *pObj = nullptr); + virtual void UpdateView(UpdateHint hint = UpdateHint(), CObject *pObj = nullptr); virtual CRuntimeClass *GetAssociatedViewClass(); virtual LRESULT OnModCtrlMsg(WPARAM wParam, LPARAM lParam); virtual void OnActivatePage(LPARAM); Modified: trunk/OpenMPT/mptrack/Ctrl_seq.cpp =================================================================== --- trunk/OpenMPT/mptrack/Ctrl_seq.cpp 2014-12-03 21:39:34 UTC (rev 4633) +++ trunk/OpenMPT/mptrack/Ctrl_seq.cpp 2014-12-06 17:17:11 UTC (rev 4634) @@ -571,7 +571,7 @@ { sndFile.Order[m_nScrollPos] = nCurNdx; m_pModDoc.SetModified(); - m_pModDoc.UpdateAllViews(NULL, HINT_MODSEQUENCE, this); + m_pModDoc.UpdateAllViews(nullptr, SequenceHint().Data(), this); InvalidateSelection(); } } @@ -599,7 +599,7 @@ void COrderList::UpdateView(UpdateHint hint, CObject *pObj) //--------------------------------------------------------- { - if(pObj != this && (hint.GetType() & HINT_MODSEQUENCE)) + if(pObj != this && hint.ToType<SequenceHint>().GetType()[HINT_MODTYPE |HINT_MODSEQUENCE]) { InvalidateRect(NULL, FALSE); UpdateInfoText(); @@ -1175,7 +1175,7 @@ InvalidateRect(NULL, FALSE); m_pModDoc.SetModified(); - m_pModDoc.UpdateAllViews(NULL, HINT_MODSEQUENCE, this); + m_pModDoc.UpdateAllViews(nullptr, SequenceHint().Data(), this); } @@ -1218,7 +1218,7 @@ InvalidateRect(NULL, FALSE); m_pModDoc.SetModified(); - m_pModDoc.UpdateAllViews(NULL, HINT_MODSEQUENCE, this); + m_pModDoc.UpdateAllViews(nullptr, SequenceHint().Data(), this); } @@ -1243,7 +1243,7 @@ m_pModDoc.SetModified(); InvalidateRect(NULL, FALSE); - m_pModDoc.UpdateAllViews(NULL, HINT_MODSEQUENCE, this); + m_pModDoc.UpdateAllViews(nullptr, SequenceHint().Data(), this); Util::DeleteItem(selection.firstOrd, selection.lastOrd, sndFile.m_PlayState.m_nNextOrder); if(sndFile.m_PlayState.m_nSeqOverride != ORDERINDEX_INVALID) @@ -1368,7 +1368,7 @@ { InvalidateRect(NULL, FALSE); m_pModDoc.SetModified(); - m_pModDoc.UpdateAllViews(NULL, HINT_MODSEQUENCE, this); + m_pModDoc.UpdateAllViews(nullptr, SequenceHint().Data(), this); SetCurSel(posdest, true); } return canDrop; @@ -1413,9 +1413,8 @@ cs.Leave(); - UpdateView(HINT_MODSEQUENCE); m_pModDoc.SetModified(); - m_pModDoc.UpdateAllViews(NULL, HINT_MODSEQUENCE, this); + m_pModDoc.UpdateAllViews(nullptr, SequenceHint().Data(), nullptr); } Modified: trunk/OpenMPT/mptrack/Ctrl_smp.cpp =================================================================== --- trunk/OpenMPT/mptrack/Ctrl_smp.cpp 2014-12-03 21:39:34 UTC (rev 4633) +++ trunk/OpenMPT/mptrack/Ctrl_smp.cpp 2014-12-06 17:17:11 UTC (rev 4634) @@ -336,7 +336,7 @@ if (m_nSample != nSmp) { m_nSample = nSmp; - UpdateView(SampleHint(HINT_SAMPLEINFO, m_nSample), NULL); + UpdateView(SampleHint(m_nSample).Info(), NULL); } if (bUpdNum) { @@ -402,7 +402,7 @@ SetCurrentSample((lParam > 0) ? ((SAMPLEINDEX)lParam) : m_nSample); // Initial Update - if (!m_bInitialized) UpdateView(SampleHint(HINT_SAMPLEINFO | HINT_MODTYPE, m_nSample), NULL); + if (!m_bInitialized) UpdateView(SampleHint(m_nSample).Info().ModType(), NULL); CChildFrame *pFrame = (CChildFrame *)GetParentFrame(); if ((pFrame) && (m_hWndView)) PostViewMessage(VIEWMSG_LOADSTATE, (LPARAM)pFrame->GetSampleViewState()); SwitchToView(); @@ -551,21 +551,23 @@ //----------------------------------------------------------- { if(pObj == this) return; - FlagSet<HintType> hintType = hint.GetType(); - if (hintType & HINT_MPTOPTIONS) + if (hint.GetType()[HINT_MPTOPTIONS]) { m_ToolBar1.UpdateStyle(); m_ToolBar2.UpdateStyle(); } - if (!(hintType & (HINT_SAMPLEINFO|HINT_MODTYPE))) return; - const SAMPLEINDEX updateSmp = hint.GetData(); + const SampleHint sampleHint = hint.ToType<SampleHint>(); + FlagSet<HintType> hintType = sampleHint.GetType(); + if (!m_bInitialized) hintType.set(HINT_MODTYPE); + if(!hintType[HINT_SAMPLEINFO | HINT_MODTYPE]) return; - if(updateSmp != m_nSample && updateSmp != 0 && !(hintType & HINT_MODTYPE)) return; + const SAMPLEINDEX updateSmp = sampleHint.GetSample(); + if(updateSmp != m_nSample && updateSmp != 0 && !hintType[HINT_MODTYPE]) return; + LockControls(); - if (!m_bInitialized) hintType |= HINT_MODTYPE; // Updating Ranges - if (hintType & HINT_MODTYPE) + if (hintType[HINT_MODTYPE]) { const CModSpecifications *specs = &m_sndFile.GetModSpecifications(); @@ -573,7 +575,6 @@ m_EditName.SetLimitText(specs->sampleNameLengthMax); m_EditFileName.SetLimitText(specs->sampleFilenameLengthMax); - BOOL b; // Loop Type m_ComboLoopType.ResetContent(); m_ComboLoopType.AddString("Off"); @@ -608,6 +609,7 @@ m_SpinSustainEnd.SetPos(0); // Sustain Loops only available in IT + BOOL b; b = (m_sndFile.GetType() & (MOD_TYPE_IT|MOD_TYPE_MPT)) ? TRUE : FALSE; m_ComboSustainType.EnableWindow(b); m_SpinSustainStart.EnableWindow(b); @@ -657,7 +659,7 @@ m_CbnBaseNote.EnableWindow(b); } // Updating Values - if (hintType & (HINT_MODTYPE|HINT_SAMPLEINFO)) + if (hintType[HINT_MODTYPE | HINT_SAMPLEINFO]) { if(m_nSample > m_sndFile.GetNumSamples()) { @@ -756,7 +758,7 @@ wsprintf(s, "%lu", sample.nSustainEnd); m_EditSustainEnd.SetWindowText(s); } - if (hintType & (HINT_MODTYPE | HINT_SAMPLEINFO | HINT_SMPNAMES)) + if (hintType[HINT_MODTYPE | HINT_SAMPLEINFO | HINT_SMPNAMES]) { CheckDlgButton(IDC_CHECK2, m_sndFile.GetSample(m_nSample).uFlags[SMP_KEEPONDISK] ? BST_CHECKED : BST_UNCHECKED); GetDlgItem(IDC_CHECK2)->EnableWindow((m_sndFile.SampleHasPath(m_nSample) && m_sndFile.GetType() == MOD_TYPE_MPT) ? TRUE : FALSE); @@ -777,8 +779,8 @@ // updateAll: Update all views including this one. Otherwise, only update update other views. -void CCtrlSamples::SetModified(FlagSet<HintType> mask, bool updateAll, bool waveformModified) -//------------------------------------------------------------------------------------------- +void CCtrlSamples::SetModified(SampleHint hint, bool updateAll, bool waveformModified) +//------------------------------------------------------------------------------------ { m_modDoc.SetModified(); @@ -786,10 +788,10 @@ { // Update on-disk sample status in tree ModSample &sample = m_sndFile.GetSample(m_nSample); - if(sample.uFlags[SMP_KEEPONDISK] && !sample.uFlags[SMP_MODIFIED]) mask |= HINT_SMPNAMES; + if(sample.uFlags[SMP_KEEPONDISK] && !sample.uFlags[SMP_MODIFIED]) hint.Names(); sample.uFlags.set(SMP_MODIFIED); } - m_modDoc.UpdateAllViews(nullptr, SampleHint(mask, m_nSample), updateAll ? nullptr : this); + m_modDoc.UpdateAllViews(nullptr, hint.SetData(m_nSample), updateAll ? nullptr : this); } @@ -899,7 +901,7 @@ sample.nPan = 128; sample.uFlags.set(CHN_PANNING); } - SetModified(HINT_SAMPLEDATA | HINT_SAMPLEINFO | HINT_SMPNAMES, true, false); + SetModified(SampleHint().Info().Data().Names(), true, false); sample.uFlags.reset(SMP_KEEPONDISK); } return true; @@ -918,7 +920,7 @@ EndWaitCursor(); - SetModified(HINT_SAMPLEDATA | HINT_SAMPLEINFO | HINT_SMPNAMES, true, false); + SetModified(SampleHint().Info().Data().Names(), true, false); return true; } @@ -982,13 +984,13 @@ sndFile.ReadSampleFromSong(smp, sndFile, nOldSmp); } - m_modDoc.UpdateAllViews(NULL, SampleHint(HINT_SAMPLEINFO | HINT_SAMPLEDATA | HINT_SMPNAMES, smp)); + m_modDoc.UpdateAllViews(NULL, SampleHint(smp).Info().Data().Names()); if(m_modDoc.GetNumInstruments() > 0 && m_modDoc.FindSampleParent(smp) == INSTRUMENTINDEX_INVALID) { if(Reporting::Confirm("This sample is not used by any instrument. Do you want to create a new instrument using this sample?") == cnfYes) { INSTRUMENTINDEX nins = m_modDoc.InsertInstrument(smp); - m_modDoc.UpdateAllViews(NULL, InstrumentHint(HINT_INSTRUMENT | HINT_INSNAMES | HINT_ENVELOPE, nins)); + m_modDoc.UpdateAllViews(NULL, InstrumentHint(nins).Info().Envelope().Names()); m_parent.InstrumentChanged(nins); } } @@ -1153,7 +1155,7 @@ m_sndFile.SetSamplePath(smp, fileName); ModSample &sample = m_sndFile.GetSample(smp); sample.uFlags.reset(SMP_MODIFIED); - UpdateView(HINT_SAMPLEINFO); + UpdateView(SampleHint().Info()); // Check if any other samples refer to the same file - that would be dangerous. if(sample.uFlags[SMP_KEEPONDISK]) @@ -1163,7 +1165,7 @@ if(i != smp && m_sndFile.GetSample(i).uFlags[SMP_KEEPONDISK] && m_sndFile.GetSamplePath(i) == m_sndFile.GetSamplePath(smp)) { m_sndFile.GetSample(i).uFlags.reset(SMP_KEEPONDISK); - m_modDoc.UpdateAllViews(nullptr, SampleHint(HINT_SMPNAMES | HINT_SAMPLEINFO, i), this); + m_modDoc.UpdateAllViews(nullptr, SampleHint(i).Names().Info(), this); } } } @@ -1297,14 +1299,14 @@ if (bOk) { sample.PrecomputeLoops(m_sndFile, false); - m_modDoc.UpdateAllViews(NULL, SampleHint(HINT_SAMPLEDATA, iSmp)); + m_modDoc.UpdateAllViews(NULL, SampleHint(iSmp).Data()); } } } if(bModified) { - SetModified(HINT_SAMPLEDATA, false, true); + SetModified(SampleHint().Data(), false, true); } EndWaitCursor(); SwitchToView(); @@ -1352,7 +1354,7 @@ ApplyAmplifyImpl<int8>(sample.pSample8, selection.nStart, selection.nEnd, lAmp, fadeIn, fadeOut); } sample.PrecomputeLoops(m_sndFile, false); - SetModified(HINT_SAMPLEDATA, false, true); + SetModified(SampleHint().Data(), false, true); EndWaitCursor(); SwitchToView(); } @@ -1406,7 +1408,7 @@ fReportOffset += fOffset; numModified++; - m_modDoc.UpdateAllViews(nullptr, SampleHint(HINT_SAMPLEDATA | HINT_SAMPLEINFO, iSmp)); + m_modDoc.UpdateAllViews(nullptr, SampleHint(iSmp).Info().Data()); } EndWaitCursor(); @@ -1417,7 +1419,7 @@ CString dcInfo; if(numModified) { - SetModified(HINT_SAMPLEDATA | HINT_SAMPLEINFO, true, true); + SetModified(SampleHint().Info().Data(), true, true); if(numModified == 1) { dcInfo.Format(GetStrI18N(TEXT("Removed DC offset (%.1f%%)")), fReportOffset * 100); @@ -1623,7 +1625,7 @@ { SetSelectionPoints(selection.nStart, newSelEnd); } - SetModified(HINT_SAMPLEDATA | HINT_SAMPLEINFO, true, true); + SetModified(SampleHint().Info().Data(), true, true); } EndWaitCursor(); @@ -1772,7 +1774,7 @@ } // Update sample view - SetModified(HINT_SAMPLEDATA | HINT_SAMPLEINFO, true, true); + SetModified(SampleHint().Info().Data(), true, true); } @@ -2219,7 +2221,7 @@ m_modDoc.GetSampleUndo().PrepareUndo(m_nSample, sundo_reverse, "Reverse", selection.nStart, selection.nEnd); if(ctrlSmp::ReverseSample(sample, selection.nStart, selection.nEnd, m_sndFile)) { - SetModified(HINT_SAMPLEDATA, false, true); + SetModified(SampleHint().Data(), false, true); } else { m_modDoc.GetSampleUndo().RemoveLastUndoStep(m_nSample); @@ -2239,7 +2241,7 @@ m_modDoc.GetSampleUndo().PrepareUndo(m_nSample, sundo_invert, "Invert", selection.nStart, selection.nEnd); if(ctrlSmp::InvertSample(sample, selection.nStart, selection.nEnd, m_sndFile) == true) { - SetModified(HINT_SAMPLEDATA, false, true); + SetModified(SampleHint().Data(), false, true); } else { m_modDoc.GetSampleUndo().RemoveLastUndoStep(m_nSample); @@ -2264,7 +2266,7 @@ m_modDoc.GetSampleUndo().PrepareUndo(m_nSample, sundo_unsign, "Unsign", selection.nStart, selection.nEnd); if(ctrlSmp::UnsignSample(sample, selection.nStart, selection.nEnd, m_sndFile) == true) { - SetModified(HINT_SAMPLEDATA, false, true); + SetModified(SampleHint().Data(), false, true); } else { m_modDoc.GetSampleUndo().RemoveLastUndoStep(m_nSample); @@ -2317,7 +2319,7 @@ } } sample.PrecomputeLoops(m_sndFile, false); - SetModified(HINT_SAMPLEDATA, false, true); + SetModified(SampleHint().Data(), false, true); } EndWaitCursor(); @@ -2355,7 +2357,7 @@ if (_tcscmp(s, m_sndFile.m_szNames[m_nSample])) { mpt::String::Copy(m_sndFile.m_szNames[m_nSample], s); - SetModified(HINT_SMPNAMES | HINT_SAMPLEINFO, false, false); + SetModified(SampleHint().Info().Names(), false, false); } } @@ -2371,7 +2373,7 @@ if (_tcscmp(s, m_sndFile.GetSample(m_nSample).filename)) { mpt::String::Copy(m_sndFile.GetSample(m_nSample).filename, s); - SetModified(HINT_SAMPLEINFO, false, false); + SetModified(SampleHint().Info(), false, false); } } @@ -2386,7 +2388,7 @@ if (nVol != m_sndFile.GetSample(m_nSample).nVolume) { m_sndFile.GetSample(m_nSample).nVolume = (WORD)nVol; - SetModified(HINT_SAMPLEINFO, false, false); + SetModified(SampleHint().Info(), false, false); } } @@ -2400,7 +2402,7 @@ if (nVol != m_sndFile.GetSample(m_nSample).nGlobalVol) { m_sndFile.GetSample(m_nSample).nGlobalVol = (uint16)nVol; - SetModified(HINT_SAMPLEINFO, false, false); + SetModified(SampleHint().Info(), false, false); } } @@ -2420,7 +2422,7 @@ if(b != sample.uFlags[CHN_PANNING]) { sample.uFlags.set(CHN_PANNING, b); - SetModified(HINT_SAMPLEINFO, false, false); + SetModified(SampleHint().Info(), false, false); } } @@ -2444,7 +2446,7 @@ if (nPan != m_sndFile.GetSample(m_nSample).nPan) { m_sndFile.GetSample(m_nSample).nPan = (uint16)nPan; - SetModified(HINT_SAMPLEINFO, false, false); + SetModified(SampleHint().Info(), false, false); } } @@ -2470,7 +2472,7 @@ m_CbnBaseNote.SetCurSel(basenote); UnlockControls(); } - SetModified(HINT_SAMPLEINFO, false, false); + SetModified(SampleHint().Info(), false, false); } } else { @@ -2479,7 +2481,7 @@ if ((n >= -128) && (n <= 127)) { m_sndFile.GetSample(m_nSample).nFineTune = (signed char)n; - SetModified(HINT_SAMPLEINFO, false, false); + SetModified(SampleHint().Info(), false, false); } } @@ -2505,14 +2507,14 @@ LockControls(); SetDlgItemInt(IDC_EDIT5, newTrans, FALSE); UnlockControls(); - SetModified(HINT_SAMPLEINFO, false, false); + SetModified(SampleHint().Info(), false, false); } } else { if ((n >= -128) && (n < 128)) { sample.RelativeTone = (int8)n; - SetModified(HINT_SAMPLEINFO, false, false); + SetModified(SampleHint().Info(), false, false); } } } @@ -2528,7 +2530,7 @@ m_sndFile.GetSample(m_nSample).nVibType = static_cast<uint8>(m_ComboAutoVib.GetItemData(n)); PropagateAutoVibratoChanges(); - SetModified(HINT_SAMPLEINFO, false, false); + SetModified(SampleHint().Info(), false, false); } } @@ -2545,7 +2547,7 @@ m_sndFile.GetSample(m_nSample).nVibDepth = static_cast<uint8>(n); PropagateAutoVibratoChanges(); - SetModified(HINT_SAMPLEINFO, false, false); + SetModified(SampleHint().Info(), false, false); } } @@ -2562,7 +2564,7 @@ m_sndFile.GetSample(m_nSample).nVibSweep = static_cast<uint8>(n); PropagateAutoVibratoChanges(); - SetModified(HINT_SAMPLEINFO, false, false); + SetModified(SampleHint().Info(), false, false); } } @@ -2579,7 +2581,7 @@ m_sndFile.GetSample(m_nSample).nVibRate = static_cast<uint8>(n); PropagateAutoVibratoChanges(); - SetModified(HINT_SAMPLEINFO, false, false); + SetModified(SampleHint().Info(), false, false); } } @@ -2607,13 +2609,13 @@ { sample.SetLoop(0, sample.nLength, true, n == 2, m_sndFile); } - m_modDoc.UpdateAllViews(NULL, SampleHint(HINT_SAMPLEINFO | HINT_SAMPLEDATA, m_nSample)); + m_modDoc.UpdateAllViews(NULL, SampleHint(m_nSample).Info().Data()); } else { sample.PrecomputeLoops(m_sndFile); } ctrlSmp::UpdateLoopPoints(sample, m_sndFile); - SetModified(HINT_SAMPLEINFO, false, false); + SetModified(SampleHint().Info(), false, false); } @@ -2626,7 +2628,7 @@ if(start < end || sample.uFlags[CHN_LOOP]) { sample.SetLoop(start, end, sample.uFlags[CHN_LOOP], sample.uFlags[CHN_PINGPONGLOOP], m_sndFile); - SetModified(HINT_SAMPLEINFO | HINT_SAMPLEDATA, false, false); + SetModified(SampleHint().Info().Data(), false, false); } } @@ -2654,13 +2656,13 @@ { sample.SetSustainLoop(0, sample.nLength, true, n == 2, m_sndFile); } - m_modDoc.UpdateAllViews(NULL, SampleHint(HINT_SAMPLEINFO | HINT_SAMPLEDATA, m_nSample)); + m_modDoc.UpdateAllViews(NULL, SampleHint(m_nSample).Info().Data()); } else { sample.PrecomputeLoops(m_sndFile); } ctrlSmp::UpdateLoopPoints(sample, m_sndFile); - SetModified(HINT_SAMPLEINFO, false, false); + SetModified(SampleHint().Info(), false, false); } @@ -2673,7 +2675,7 @@ if(start < end || !sample.uFlags[CHN_SUSTAINLOOP]) { sample.SetSustainLoop(start, end, sample.uFlags[CHN_SUSTAINLOOP], sample.uFlags[CHN_PINGPONGSUSTAIN], m_sndFile); - SetModified(HINT_SAMPLEINFO | HINT_SAMPLEDATA, false, false); + SetModified(SampleHint().Info().Data(), false, false); } } @@ -2960,7 +2962,7 @@ if(nCode == SB_ENDSCROLL) SwitchToView(); if(redraw) { - SetModified(HINT_SAMPLEINFO | HINT_SAMPLEDATA, false, false); + SetModified(SampleHint().Info().Data(), false, false); } UnlockControls(); } @@ -3115,7 +3117,7 @@ if(ctrlSmp::XFadeSample(sample, fadeLength, m_sndFile)) { - SetModified(HINT_SAMPLEINFO | HINT_SAMPLEDATA, true, true); + SetModified(SampleHint().Info().Data(), true, true); } else { m_modDoc.GetSampleUndo().RemoveLastUndoStep(m_nSample); @@ -3143,7 +3145,7 @@ BeginWaitCursor(); m_modDoc.GetSampleUndo().PrepareUndo(m_nSample, sundo_none, "Automatic Sample Tuning"); at.Apply(static_cast<double>(dlg.GetPitchReference()), dlg.GetTargetNote()); - SetModified(HINT_SAMPLEINFO, true, false); + SetModified(SampleHint().Info(), true, false); EndWaitCursor(); } } @@ -3164,7 +3166,7 @@ for(SAMPLEINDEX i = first; i <= last; i++) { m_sndFile.GetSample(i).uFlags.set(SMP_KEEPONDISK, enable && m_sndFile.SampleHasPath(i)); - m_modDoc.UpdateAllViews(nullptr, SampleHint(HINT_SAMPLEINFO, i), this); + m_modDoc.UpdateAllViews(nullptr, SampleHint(i).Info().Names(), this); } } @@ -3193,7 +3195,7 @@ m_sndFile.GetSample(*sample).nVibType = m_sndFile.GetSample(m_nSample).nVibType; m_sndFile.GetSample(*sample).nVibRate = m_sndFile.GetSample(m_nSample).nVibRate; m_sndFile.GetSample(*sample).nVibSweep = m_sndFile.GetSample(m_nSample).nVibSweep; - m_modDoc.UpdateAllViews(nullptr, SampleHint(HINT_SAMPLEINFO, *sample), (CObject *)this); + m_modDoc.UpdateAllViews(nullptr, SampleHint(*sample).Info(), (CObject *)this); } } } Modified: trunk/OpenMPT/mptrack/Ctrl_smp.h =================================================================== --- trunk/OpenMPT/mptrack/Ctrl_smp.h 2014-12-03 21:39:34 UTC (rev 4633) +++ trunk/OpenMPT/mptrack/Ctrl_smp.h 2014-12-06 17:17:11 UTC (rev 4634) @@ -78,7 +78,7 @@ virtual void RecalcLayout(); virtual void OnActivatePage(LPARAM); virtual void OnDeactivatePage(); - virtual void UpdateView(UpdateHint hint = HINT_NONE, CObject *pObj = nullptr); + virtual void UpdateView(UpdateHint hint, CObject *pObj = nullptr); virtual LRESULT OnModCtrlMsg(WPARAM wParam, LPARAM lParam); virtual BOOL GetToolTipText(UINT uId, TCHAR *pszText); virtual BOOL PreTranslateMessage(MSG* pMsg); @@ -128,7 +128,7 @@ afx_msg void OnEnableStretchToSize(); afx_msg void OnEstimateSampleSize(); - void SetModified(FlagSet<HintType> mask, bool updateAll, bool waveformModified); + noinline void SetModified(SampleHint hint, bool updateAll, bool waveformModified); //}}AFX_MSG DECLARE_MESSAGE_MAP() Modified: trunk/OpenMPT/mptrack/Draw_pat.cpp =================================================================== --- trunk/OpenMPT/mptrack/Draw_pat.cpp 2014-12-03 21:39:34 UTC (rev 4633) +++ trunk/OpenMPT/mptrack/Draw_pat.cpp 2014-12-06 17:17:11 UTC (rev 4634) @@ -231,8 +231,7 @@ { return; } - FlagSet<HintType> hintType = hint.GetType(); - if(hintType & HINT_MPTOPTIONS) + if(hint.GetType()[HINT_MPTOPTIONS]) { UpdateColors(); UpdateSizes(); @@ -240,26 +239,27 @@ InvalidatePattern(true); return; } - if(hintType & HINT_MODCHANNELS) + if(hint.ToType<GeneralHint>().GetType()[HINT_MODTYPE | HINT_MODCHANNELS]) { InvalidateChannelsHeaders(); UpdateScrollSize(); } - const PATTERNINDEX updatePat = hint.GetData(); - if(hintType == HINT_PATTERNDATA + const PatternHint patternHint = hint.ToType<PatternHint>(); + const PATTERNINDEX updatePat = patternHint.GetPattern(); + if(hint.GetType() == HINT_PATTERNDATA && m_nPattern != updatePat && updatePat != 0 && updatePat != GetNextPattern() && updatePat != GetPrevPattern()) return; - if(hintType & (HINT_MODTYPE|HINT_PATTERNDATA)) + if(patternHint.GetType()[HINT_MODTYPE | HINT_PATTERNDATA]) { InvalidatePattern(false); - } else if(hintType & HINT_PATTERNROW) + } else if(patternHint.GetType()[HINT_PATTERNROW]) { - InvalidateRow(hint.GetData()); + InvalidateRow(static_cast<const RowHint &>(hint).GetRow()); } } Modified: trunk/OpenMPT/mptrack/EffectVis.cpp =================================================================== --- trunk/OpenMPT/mptrack/EffectVis.cpp 2014-12-03 21:39:34 UTC (rev 4633) +++ trunk/OpenMPT/mptrack/EffectVis.cpp 2014-12-06 17:17:11 UTC (rev 4634) @@ -850,7 +850,7 @@ } m_pModDoc->SetModified(); - m_pModDoc->UpdateAllViews(NULL, PatternHint(HINT_PATTERNDATA, m_nPattern), NULL); + m_pModDoc->UpdateAllViews(nullptr, PatternHint(m_nPattern).Data()); } void CEffectVis::SetPcNote(ROWINDEX row) Modified: trunk/OpenMPT/mptrack/ExternalSamples.cpp =================================================================== --... [truncated message content] |
From: <sag...@us...> - 2014-12-11 21:35:16
|
Revision: 4642 http://sourceforge.net/p/modplug/code/4642 Author: saga-games Date: 2014-12-11 21:35:01 +0000 (Thu, 11 Dec 2014) Log Message: ----------- [Mod] Apply DPI scaling to list control header sizes. [Mod] Fix a theoretical memory leak in sample undo (cannot be triggered by current code) Modified Paths: -------------- trunk/OpenMPT/mptrack/CListCtrl.h trunk/OpenMPT/mptrack/ExternalSamples.cpp trunk/OpenMPT/mptrack/ExternalSamples.h trunk/OpenMPT/mptrack/MIDIMappingDialog.cpp trunk/OpenMPT/mptrack/MIDIMappingDialog.h trunk/OpenMPT/mptrack/Undo.cpp trunk/OpenMPT/mptrack/view_com.cpp trunk/OpenMPT/mptrack/view_com.h Modified: trunk/OpenMPT/mptrack/CListCtrl.h =================================================================== --- trunk/OpenMPT/mptrack/CListCtrl.h 2014-12-11 17:48:49 UTC (rev 4641) +++ trunk/OpenMPT/mptrack/CListCtrl.h 2014-12-11 21:35:01 UTC (rev 4642) @@ -1,7 +1,7 @@ /* * CListCtrl.h * ----------- - * Purpose: A class that extends MFC's CListCtrl to handle unicode strings in ANSI builds. + * Purpose: A class that extends MFC's CListCtrl with some more functionality and to handle unicode strings in ANSI builds. * Notes : (currently none) * Authors: OpenMPT Devs * The OpenMPT source code is released under the BSD license. Read LICENSE for more details. @@ -10,14 +10,27 @@ #pragma once - OPENMPT_NAMESPACE_BEGIN - -class CListCtrlW : public CListCtrl +class CListCtrlEx : public CListCtrl { public: + struct Header + { + const TCHAR *text; + int width; + UINT mask; + }; + template<size_t numItems> + void SetHeaders(const Header (&header)[numItems]) + { + for(int i = 0; i < numItems; i++) + { + InsertColumn(i, header[i].text, header[i].mask, MulDiv(header[i].width, GetDeviceCaps(GetDC()->m_hDC, LOGPIXELSX), 96)); + } + } + // Unicode strings in ANSI builds #ifndef UNICODE BOOL SetItemText(int nItem, int nSubItem, const WCHAR *lpszText) { Modified: trunk/OpenMPT/mptrack/ExternalSamples.cpp =================================================================== --- trunk/OpenMPT/mptrack/ExternalSamples.cpp 2014-12-11 17:48:49 UTC (rev 4641) +++ trunk/OpenMPT/mptrack/ExternalSamples.cpp 2014-12-11 21:35:01 UTC (rev 4642) @@ -48,19 +48,12 @@ CDialog::OnInitDialog(); // Initialize table - const struct + const CListCtrlEx::Header headers[] = { - const TCHAR *text; - int width; - } labels[] = - { - { _T("Sample"), 128 }, - { _T("External Filename"), 308 }, + { _T("Sample"), 128, LVCFMT_LEFT }, + { _T("External Filename"), 308, LVCFMT_LEFT }, }; - for(int i = 0; i < CountOf(labels); i++) - { - m_List.InsertColumn(i, labels[i].text, LVCFMT_LEFT, labels[i].width); - } + m_List.SetHeaders(headers); m_List.SetExtendedStyle(m_List.GetExtendedStyle() | LVS_EX_FULLROWSELECT); GenerateList(); Modified: trunk/OpenMPT/mptrack/ExternalSamples.h =================================================================== --- trunk/OpenMPT/mptrack/ExternalSamples.h 2014-12-11 17:48:49 UTC (rev 4641) +++ trunk/OpenMPT/mptrack/ExternalSamples.h 2014-12-11 21:35:01 UTC (rev 4642) @@ -8,6 +8,8 @@ */ +#pragma once + #include "CListCtrl.h" #include "../common/thread.h" @@ -23,7 +25,7 @@ protected: CModDoc &modDoc; CSoundFile &sndFile; - CListCtrlW m_List; + CListCtrlEx m_List; bool isScanning; public: Modified: trunk/OpenMPT/mptrack/MIDIMappingDialog.cpp =================================================================== --- trunk/OpenMPT/mptrack/MIDIMappingDialog.cpp 2014-12-11 17:48:49 UTC (rev 4641) +++ trunk/OpenMPT/mptrack/MIDIMappingDialog.cpp 2014-12-11 21:35:01 UTC (rev 4642) @@ -124,23 +124,16 @@ AddPluginNamesToCombobox(m_PluginCBox, m_rSndFile.m_MixPlugins); // Initialize mapping table - const struct + const CListCtrlEx::Header headers[] = { - const TCHAR *text; - int width; - } labels[] = - { - { _T("Channel"), 58 }, - { _T("Event / Controller"), 176 }, - { _T("Plugin"), 120 }, - { _T("Parameter"), 120 }, - { _T("Capture"), 40 }, - { _T("Pattern Record"), 40 } + { _T("Channel"), 58, LVCFMT_LEFT }, + { _T("Event / Controller"), 176, LVCFMT_LEFT }, + { _T("Plugin"), 120, LVCFMT_LEFT }, + { _T("Parameter"), 120, LVCFMT_LEFT }, + { _T("Capture"), 40, LVCFMT_LEFT }, + { _T("Pattern Record"), 40, LVCFMT_LEFT } }; - for(int i = 0; i < CountOf(labels); i++) - { - m_List.InsertColumn(i, labels[i].text, LVCFMT_LEFT, labels[i].width); - } + m_List.SetHeaders(headers); m_List.SetExtendedStyle(m_List.GetExtendedStyle() | LVS_EX_CHECKBOXES | LVS_EX_FULLROWSELECT); // Add directives to list Modified: trunk/OpenMPT/mptrack/MIDIMappingDialog.h =================================================================== --- trunk/OpenMPT/mptrack/MIDIMappingDialog.h 2014-12-11 17:48:49 UTC (rev 4641) +++ trunk/OpenMPT/mptrack/MIDIMappingDialog.h 2014-12-11 21:35:01 UTC (rev 4642) @@ -11,6 +11,7 @@ #pragma once #include <vector> #include "MIDIMapping.h" +#include "CListCtrl.h" OPENMPT_NAMESPACE_BEGIN @@ -38,7 +39,7 @@ CComboBox m_PlugParamCBox; CComboBox m_ChannelCBox; CComboBox m_EventCBox; - CListCtrl m_List; + CListCtrlEx m_List; CSpinButtonCtrl m_SpinMoveMapping; public: Modified: trunk/OpenMPT/mptrack/Undo.cpp =================================================================== --- trunk/OpenMPT/mptrack/Undo.cpp 2014-12-11 17:48:49 UTC (rev 4641) +++ trunk/OpenMPT/mptrack/Undo.cpp 2014-12-11 21:35:01 UTC (rev 4642) @@ -594,7 +594,8 @@ } -// Update undo buffer when using rearrange sample functionality +// Update undo buffer when using rearrange sample functionality. +// newIndex contains one new index for each old index. newIndex[1] represents the first sample. void CSampleUndo::RearrangeSamples(undobuf_t &buffer, const std::vector<SAMPLEINDEX> &newIndex) //--------------------------------------------------------------------------------------------- { @@ -602,19 +603,17 @@ const SAMPLEINDEX newSize = static_cast<SAMPLEINDEX>(newIndex.size()); const SAMPLEINDEX oldSize = static_cast<SAMPLEINDEX>(buffer.size()); - for(SAMPLEINDEX smp = 1; smp < newSize; smp++) + for(SAMPLEINDEX smp = 1; smp <= oldSize; smp++) { - MPT_ASSERT(newIndex[smp] <= modDoc.GetNumSamples()); - if(newIndex[smp] > 0 && newIndex[smp] <= modDoc.GetNumSamples() && smp <= buffer.size()) + MPT_ASSERT(smp >= newSize || newIndex[smp] <= modDoc.GetNumSamples()); + if(smp < newSize && newIndex[smp] > 0 && newIndex[smp] <= modDoc.GetNumSamples()) { newBuf[newIndex[smp] - 1] = buffer[smp - 1]; + } else + { + ClearUndo(smp); } } - // Remove now unused undo buffers - for(SAMPLEINDEX smp = newSize; smp <= oldSize; smp++) - { - ClearUndo(smp); - } #ifdef _DEBUG for(size_t i = 0; i < oldSize; i++) { Modified: trunk/OpenMPT/mptrack/view_com.cpp =================================================================== --- trunk/OpenMPT/mptrack/view_com.cpp 2014-12-11 17:48:49 UTC (rev 4641) +++ trunk/OpenMPT/mptrack/view_com.cpp 2014-12-11 21:35:01 UTC (rev 4642) @@ -28,13 +28,6 @@ #define DETAILS_TOOLBAR_CY 28 -struct LISTCOLHDR -{ - const TCHAR *pszName; - UINT cx; -}; - - enum { SMPLIST_SAMPLENAME = 0, @@ -61,26 +54,26 @@ }; -const LISTCOLHDR gSampleHeaders[SMPLIST_COLUMNS] = +const CListCtrlEx::Header gSampleHeaders[SMPLIST_COLUMNS] = { - { _T("Sample Name"), 192}, - { _T("Num"), 45}, - { _T("Size"), 72}, - { _T("Type"), 45}, - { _T("C-5 Freq"), 80}, - { _T("Instr"), 64}, - { _T("File Name"), 128}, - { _T("Path"), 128}, + { _T("Sample Name"), 192, LVCFMT_LEFT }, + { _T("Num"), 45, LVCFMT_RIGHT }, + { _T("Size"), 72, LVCFMT_RIGHT }, + { _T("Type"), 45, LVCFMT_RIGHT }, + { _T("C-5 Freq"), 80, LVCFMT_RIGHT }, + { _T("Instr"), 64, LVCFMT_RIGHT }, + { _T("File Name"), 128, LVCFMT_RIGHT }, + { _T("Path"), 256, LVCFMT_LEFT }, }; -const LISTCOLHDR gInstrumentHeaders[INSLIST_COLUMNS] = +const CListCtrlEx::Header gInstrumentHeaders[INSLIST_COLUMNS] = { - { _T("Instrument Name"), 192}, - { _T("Num"), 45}, - { _T("Samples"), 64}, - { _T("Envelopes"), 128}, - { _T("File Name"), 128}, - { _T("Plugin"), 128}, + { _T("Instrument Name"), 192, LVCFMT_LEFT }, + { _T("Num"), 45, LVCFMT_RIGHT }, + { _T("Samples"), 64, LVCFMT_RIGHT }, + { _T("Envelopes"), 128, LVCFMT_RIGHT }, + { _T("File Name"), 128, LVCFMT_RIGHT }, + { _T("Plugin"), 128, LVCFMT_RIGHT }, }; @@ -216,37 +209,14 @@ m_ItemList.DeleteAllItems(); while ((m_ItemList.DeleteColumn(0)) && (ichk < 25)) ichk++; m_nCurrentListId = m_nListId; - // Add Sample Headers if (m_nCurrentListId == IDC_LIST_SAMPLES) { - UINT nCol = 0; - for (UINT iSmp=0; iSmp<SMPLIST_COLUMNS; iSmp++) - { - MemsetZero(lvc); - lvc.mask = LVCF_FMT | LVCF_WIDTH | LVCF_TEXT | LVCF_SUBITEM; - lvc.fmt = (iSmp) ? LVCFMT_RIGHT : LVCFMT_LEFT; - lvc.pszText = (LPTSTR)gSampleHeaders[iSmp].pszName; - lvc.cx = gSampleHeaders[iSmp].cx; - lvc.iSubItem = iSmp; - m_ItemList.InsertColumn(nCol, &lvc); - nCol++; - } - } else - // Add Instrument Headers - if (m_nCurrentListId == IDC_LIST_INSTRUMENTS) + // Add Sample Headers + m_ItemList.SetHeaders(gSampleHeaders); + } else if (m_nCurrentListId == IDC_LIST_INSTRUMENTS) { - UINT nCol = 0; - for (UINT i=0; i<INSLIST_COLUMNS; i++) - { - MemsetZero(lvc); - lvc.mask = LVCF_FMT | LVCF_WIDTH | LVCF_TEXT | LVCF_SUBITEM; - lvc.fmt = (i) ? LVCFMT_RIGHT : LVCFMT_LEFT; - lvc.pszText = (LPTSTR)gInstrumentHeaders[i].pszName; - lvc.cx = gInstrumentHeaders[i].cx; - lvc.iSubItem = i; - m_ItemList.InsertColumn(nCol, &lvc); - nCol++; - } + // Add Instrument Headers + m_ItemList.SetHeaders(gInstrumentHeaders); } else updateAll = true; } Modified: trunk/OpenMPT/mptrack/view_com.h =================================================================== --- trunk/OpenMPT/mptrack/view_com.h 2014-12-11 17:48:49 UTC (rev 4641) +++ trunk/OpenMPT/mptrack/view_com.h 2014-12-11 21:35:01 UTC (rev 4642) @@ -11,6 +11,8 @@ #pragma once +#include "CListCtrl.h" + OPENMPT_NAMESPACE_BEGIN enum @@ -28,7 +30,7 @@ protected: CModControlBar m_ToolBar; - CListCtrl m_ItemList; + CListCtrlEx m_ItemList; UINT m_nCurrentListId, m_nListId; public: This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <sag...@us...> - 2014-12-15 00:26:44
|
Revision: 4651 http://sourceforge.net/p/modplug/code/4651 Author: saga-games Date: 2014-12-15 00:26:30 +0000 (Mon, 15 Dec 2014) Log Message: ----------- [Mod] Rename "Colours" settings tab to "Display" [Imp] Make song window saving optional Modified Paths: -------------- trunk/OpenMPT/mptrack/Moddoc.cpp trunk/OpenMPT/mptrack/Moptions.cpp trunk/OpenMPT/mptrack/TrackerSettings.cpp trunk/OpenMPT/mptrack/TrackerSettings.h trunk/OpenMPT/mptrack/mptrack.rc Modified: trunk/OpenMPT/mptrack/Moddoc.cpp =================================================================== --- trunk/OpenMPT/mptrack/Moddoc.cpp 2014-12-14 23:50:14 UTC (rev 4650) +++ trunk/OpenMPT/mptrack/Moddoc.cpp 2014-12-15 00:26:30 UTC (rev 4651) @@ -377,7 +377,7 @@ ReinitRecordState(); // -! NEW_FEATURE#0015 - DeserializeViews(); + if(TrackerSettings::Instance().rememberSongWindows) DeserializeViews(); // Show warning if file was made with more recent version of OpenMPT except if(MptVersion::RemoveBuildNumber(m_SndFile.m_dwLastSavedWithVersion) > MptVersion::num) @@ -451,7 +451,7 @@ if (pMainFrame) pMainFrame->CreateTemplateModulesMenu(); } - SerializeViews(); + if(TrackerSettings::Instance().rememberSongWindows) SerializeViews(); } else { ErrorBox(IDS_ERR_SAVESONG, CMainFrame::GetMainFrame()); Modified: trunk/OpenMPT/mptrack/Moptions.cpp =================================================================== --- trunk/OpenMPT/mptrack/Moptions.cpp 2014-12-14 23:50:14 UTC (rev 4650) +++ trunk/OpenMPT/mptrack/Moptions.cpp 2014-12-15 00:26:30 UTC (rev 4651) @@ -102,10 +102,11 @@ } m_ComboItem.SetCurSel(0); m_BtnPreview.SetWindowPos(NULL, 0,0, PREVIEWBMP_WIDTH*2+2, PREVIEWBMP_HEIGHT*2+2, SWP_NOMOVE|SWP_NOZORDER|SWP_NOACTIVATE); - if (TrackerSettings::Instance().m_dwPatternSetup & PATTERN_STDHIGHLIGHT) CheckDlgButton(IDC_CHECK1, MF_CHECKED); - if (TrackerSettings::Instance().m_dwPatternSetup & PATTERN_EFFECTHILIGHT) CheckDlgButton(IDC_CHECK2, MF_CHECKED); - if (TrackerSettings::Instance().m_dwPatternSetup & PATTERN_SMALLFONT) CheckDlgButton(IDC_CHECK3, MF_CHECKED); - if (TrackerSettings::Instance().m_dwPatternSetup & PATTERN_2NDHIGHLIGHT) CheckDlgButton(IDC_CHECK4, MF_CHECKED); + if (TrackerSettings::Instance().m_dwPatternSetup & PATTERN_STDHIGHLIGHT) CheckDlgButton(IDC_CHECK1, BST_CHECKED); + if (TrackerSettings::Instance().m_dwPatternSetup & PATTERN_EFFECTHILIGHT) CheckDlgButton(IDC_CHECK2, BST_CHECKED); + if (TrackerSettings::Instance().m_dwPatternSetup & PATTERN_SMALLFONT) CheckDlgButton(IDC_CHECK3, BST_CHECKED); + if (TrackerSettings::Instance().m_dwPatternSetup & PATTERN_2NDHIGHLIGHT) CheckDlgButton(IDC_CHECK4, BST_CHECKED); + CheckDlgButton(IDC_CHECK5, TrackerSettings::Instance().rememberSongWindows ? BST_CHECKED : BST_UNCHECKED); SetDlgItemInt(IDC_PRIMARYHILITE, TrackerSettings::Instance().m_nRowHighlightMeasures); SetDlgItemInt(IDC_SECONDARYHILITE, TrackerSettings::Instance().m_nRowHighlightBeats); @@ -139,6 +140,7 @@ if (IsDlgButtonChecked(IDC_CHECK2)) TrackerSettings::Instance().m_dwPatternSetup |= PATTERN_EFFECTHILIGHT; if (IsDlgButtonChecked(IDC_CHECK3)) TrackerSettings::Instance().m_dwPatternSetup |= PATTERN_SMALLFONT; if (IsDlgButtonChecked(IDC_CHECK4)) TrackerSettings::Instance().m_dwPatternSetup |= PATTERN_2NDHIGHLIGHT; + TrackerSettings::Instance().rememberSongWindows = IsDlgButtonChecked(IDC_CHECK5) != BST_UNCHECKED; TrackerSettings::Instance().m_nRowHighlightMeasures = GetDlgItemInt(IDC_PRIMARYHILITE); TrackerSettings::Instance().m_nRowHighlightBeats = GetDlgItemInt(IDC_SECONDARYHILITE); Modified: trunk/OpenMPT/mptrack/TrackerSettings.cpp =================================================================== --- trunk/OpenMPT/mptrack/TrackerSettings.cpp 2014-12-14 23:50:14 UTC (rev 4650) +++ trunk/OpenMPT/mptrack/TrackerSettings.cpp 2014-12-15 00:26:30 UTC (rev 4651) @@ -158,6 +158,7 @@ , gnMsgBoxVisiblityFlags(conf, "Display", "MDIGraphHeight", uint32_max) , GUIUpdateInterval(conf, "Display", "GUIUpdateInterval", 0) , VuMeterUpdateInterval(conf, "Display", "VuMeterUpdateInterval", 15) + , rememberSongWindows(conf, "Display", "RememberSongWindows", true) // Misc , ShowSettingsOnNewVersion(conf, "Misc", "ShowSettingsOnNewVersion", true) , gbShowHackControls(conf, "Misc", "ShowHackControls", false) Modified: trunk/OpenMPT/mptrack/TrackerSettings.h =================================================================== --- trunk/OpenMPT/mptrack/TrackerSettings.h 2014-12-14 23:50:14 UTC (rev 4650) +++ trunk/OpenMPT/mptrack/TrackerSettings.h 2014-12-15 00:26:30 UTC (rev 4651) @@ -359,6 +359,8 @@ Setting<uint32> GUIUpdateInterval; CachedSetting<uint32> VuMeterUpdateInterval; + Setting<bool> rememberSongWindows; + // Misc Setting<bool> ShowSettingsOnNewVersion; Modified: trunk/OpenMPT/mptrack/mptrack.rc =================================================================== --- trunk/OpenMPT/mptrack/mptrack.rc 2014-12-14 23:50:14 UTC (rev 4650) +++ trunk/OpenMPT/mptrack/mptrack.rc 2014-12-15 00:26:30 UTC (rev 4651) @@ -737,29 +737,31 @@ IDD_OPTIONS_COLORS DIALOGEX 0, 0, 286, 282 STYLE DS_SETFONT | DS_3DLOOK | DS_FIXEDSYS | WS_CHILD | WS_DISABLED | WS_CAPTION -CAPTION "Colours" +CAPTION "Display" FONT 8, "MS Shell Dlg", 0, 0, 0x0 BEGIN - GROUPBOX "",IDC_STATIC,6,6,276,217 + GROUPBOX "",IDC_STATIC,6,6,276,114 CONTROL "Use small &font",IDC_CHECK3,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,18,18,114,10 CONTROL "&Enable effect highlighting",IDC_CHECK2,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,18,36,114,10 CONTROL "&Primary highlight",IDC_CHECK1,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,18,54,84,10 EDITTEXT IDC_PRIMARYHILITE,102,54,24,12,ES_AUTOHSCROLL | ES_NUMBER - LTEXT "Rows per measure (default)",IDC_STATIC,132,56,126,8 + LTEXT "Rows per measure (default)",IDC_STATIC,132,56,144,8 CONTROL "&Secondary highlight",IDC_CHECK4,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,18,72,80,10 EDITTEXT IDC_SECONDARYHILITE,102,72,24,12,ES_AUTOHSCROLL | ES_NUMBER - LTEXT "Rows per beat (default)",IDC_STATIC,132,74,126,8 - LTEXT "Note: Songs' time signatures will override the default highlight values",IDC_STATIC,18,90,240,24 - LTEXT "Select &colour for:",IDC_STATIC,18,116,63,8 - COMBOBOX IDC_COMBO1,84,114,114,109,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP - CONTROL "",IDC_BUTTON4,"Button",BS_OWNERDRAW | BS_FLAT,76,132,114,43 - LTEXT "Background:",IDC_TEXT1,36,185,60,8 - CONTROL "C&olour",IDC_BUTTON1,"Button",BS_OWNERDRAW,36,196,51,15 - LTEXT "Foreground:",IDC_TEXT2,109,185,62,8 - CONTROL "Colo&ur",IDC_BUTTON2,"Button",BS_OWNERDRAW,109,196,51,15 - LTEXT "Highlight:",IDC_TEXT3,180,188,61,8 - CONTROL "Colou&r",IDC_BUTTON3,"Button",BS_OWNERDRAW,179,196,51,15 - GROUPBOX "Colour Presets",IDC_STATIC,6,234,276,42 + LTEXT "Rows per beat (default)",IDC_STATIC,132,74,144,8 + LTEXT "Note: Songs' time signatures will override the default highlight values",IDC_STATIC,18,88,258,8 + CONTROL "Remember each song's &window positions",IDC_CHECK5, + "Button",BS_AUTOCHECKBOX | WS_TABSTOP,18,102,258,10 + GROUPBOX "Colours",IDC_STATIC,6,126,276,150 + LTEXT "Select &colour for:",IDC_STATIC,18,146,63,8 + COMBOBOX IDC_COMBO1,90,144,114,109,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP + CONTROL "",IDC_BUTTON4,"Button",BS_OWNERDRAW | BS_FLAT,89,162,114,43 + LTEXT "Background:",IDC_TEXT1,49,215,60,8 + CONTROL "Colour &1",IDC_BUTTON1,"Button",BS_OWNERDRAW,49,226,51,15 + LTEXT "Foreground:",IDC_TEXT2,122,215,62,8 + CONTROL "Colour &2",IDC_BUTTON2,"Button",BS_OWNERDRAW,122,226,51,15 + LTEXT "Highlight:",IDC_TEXT3,193,215,61,8 + CONTROL "Colour &3",IDC_BUTTON3,"Button",BS_OWNERDRAW,192,226,51,15 PUSHBUTTON "&Load...",IDC_LOAD_COLORSCHEME,18,252,42,15 PUSHBUTTON "S&ave...",IDC_SAVE_COLORSCHEME,66,252,42,15 PUSHBUTTON "&MPT",IDC_BUTTON5,132,252,30,15 This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <man...@us...> - 2014-12-15 12:11:59
|
Revision: 4653 http://sourceforge.net/p/modplug/code/4653 Author: manxorist Date: 2014-12-15 12:11:45 +0000 (Mon, 15 Dec 2014) Log Message: ----------- [Ref] Rewrite CTrackApp::SetupPaths into 4 phases: 1. Changing to the exe directory. 2. Determining the configuration paths, portable mode, first run flag. 3. Applying the determined paths. 4. Handling updates from older versions (moving the configuration files). Modified Paths: -------------- trunk/OpenMPT/mptrack/Mptrack.cpp trunk/OpenMPT/mptrack/Mptrack.h Modified: trunk/OpenMPT/mptrack/Mptrack.cpp =================================================================== --- trunk/OpenMPT/mptrack/Mptrack.cpp 2014-12-15 00:56:12 UTC (rev 4652) +++ trunk/OpenMPT/mptrack/Mptrack.cpp 2014-12-15 12:11:45 UTC (rev 4653) @@ -745,7 +745,6 @@ MPT_REGISTERED_COMPONENT(ComponentUXTheme) -#ifdef WIN32 // Legacy stuff // Move a config file called sFileName from the App's directory (or one of its sub directories specified by sSubDir) to // %APPDATA%. If specified, it will be renamed to sNewFileName. Existing files are never overwritten. // Returns true on success. @@ -775,70 +774,108 @@ } return false; } -#endif // WIN32 Legacy Stuff // Set up paths were configuration data is written to. Set overridePortable to true if application's own directory should always be used. void CTrackApp::SetupPaths(bool overridePortable) //----------------------------------------------- { - m_szExePath = mpt::GetAppPath(); - SetCurrentDirectoryW(m_szExePath.AsNative().c_str()); - m_szConfigDirectory = mpt::PathString(); - // Try to find a nice directory where we should store our settings (default: %APPDATA%) - bool bIsAppDir = overridePortable; - WCHAR tempConfigDirectory[MAX_PATH]; - tempConfigDirectory[0] = 0; - if(SHGetFolderPathW(NULL, CSIDL_APPDATA, NULL, SHGFP_TYPE_CURRENT, tempConfigDirectory) != S_OK) + // change to exe directory + + SetCurrentDirectoryW(mpt::GetAppPath().AsNative().c_str()); + + + // Determine paths, portable mode, first run. Do not yet update any state. + + mpt::PathString configPathApp = mpt::GetAppPath(); // config path in portable mode + mpt::PathString configPathGlobal; // config path in default non-portable mode { - if(SHGetFolderPathW(NULL, CSIDL_PERSONAL, NULL, SHGFP_TYPE_CURRENT, tempConfigDirectory) != S_OK) + // Try to find a nice directory where we should store our settings (default: %APPDATA%) + WCHAR tempConfigDirectory[MAX_PATH]; + MemsetZero(tempConfigDirectory); + if((SHGetFolderPathW(NULL, CSIDL_APPDATA, NULL, SHGFP_TYPE_CURRENT, tempConfigDirectory) == S_OK) + || (SHGetFolderPathW(NULL, CSIDL_PERSONAL, NULL, SHGFP_TYPE_CURRENT, tempConfigDirectory) == S_OK)) { - bIsAppDir = true; + // Store our app settings in %APPDATA% or "My Files" + configPathGlobal = mpt::PathString::FromNative(tempConfigDirectory) + MPT_PATHSTRING("\\OpenMPT\\"); } } - m_szConfigDirectory = mpt::PathString::FromNative(tempConfigDirectory); + bool portableMode = overridePortable; + + if(configPathGlobal.empty()) + { + // no usable global directory found + portableMode = true; + } + // Check if the user prefers to use the app's directory - m_szConfigFileName = GetAppDirPath(); // config file - m_szConfigFileName += MPT_PATHSTRING("mptrack.ini"); - if(GetPrivateProfileIntW(L"Paths", L"UseAppDataDirectory", 1, m_szConfigFileName.AsNative().c_str()) == 0) + bool configAppPortable = (GetPrivateProfileIntW(L"Paths", L"UseAppDataDirectory", 1, (configPathApp + MPT_PATHSTRING("mptrack.ini")).AsNative().c_str()) == 0); + if(configAppPortable) { - bIsAppDir = true; + portableMode = true; } - if(!bIsAppDir) + // chose config directory + mpt::PathString configPath = portableMode ? configPathApp : configPathGlobal; + + // check if this is the first run + bool firstRun = true; { - // Store our app settings in %APPDATA% or "My Files" - m_szConfigDirectory += MPT_PATHSTRING("\\OpenMPT\\"); - - // Path doesn't exist yet, so it has to be created - if(!m_szConfigDirectory.IsDirectory()) + WCHAR tempVersion[MAX_PATH]; + MemsetZero(tempVersion); + GetPrivateProfileStringW(L"Version", L"Version", L"", tempVersion, CountOf(tempVersion), (configPathApp + MPT_PATHSTRING("mptrack.ini")).AsNative().c_str()); + if(!std::wstring(tempVersion).empty()) { - CreateDirectoryW(m_szConfigDirectory.AsNative().c_str(), 0); + firstRun = false; } + } - #ifdef WIN32 // Legacy stuff - // Move the config files if they're still in the old place. - MoveConfigFile(MPT_PATHSTRING("mptrack.ini")); - MoveConfigFile(MPT_PATHSTRING("plugin.cache")); - #endif // WIN32 Legacy Stuff - } else + + // Update state. + + // store exe path + m_szExePath = mpt::GetAppPath(); + + // store the config path + m_szConfigDirectory = configPath; + + // 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) { - m_szConfigDirectory = GetAppDirPath(); + free((void *)m_pszProfileName); } + m_pszProfileName = _tcsdup(m_szConfigFileName.ToCString()); - // Create tunings dir - mpt::PathString sTuningPath = m_szConfigDirectory + MPT_PATHSTRING("tunings\\"); - TrackerDirectories::Instance().SetDefaultDirectory(sTuningPath, DIR_TUNING); + m_bPortableMode = portableMode; + // Create missing diretories + if(!m_szConfigDirectory.IsDirectory()) + { + CreateDirectoryW(m_szConfigDirectory.AsNative().c_str(), 0); + } if(!TrackerDirectories::Instance().GetDefaultDirectory(DIR_TUNING).IsDirectory()) { CreateDirectoryW(TrackerDirectories::Instance().GetDefaultDirectory(DIR_TUNING).AsNative().c_str(), 0); } - if(!bIsAppDir) + + // Handle updates from old versions. + + if(!portableMode) { + + // Move the config files if they're still in the old place. + MoveConfigFile(MPT_PATHSTRING("mptrack.ini")); + MoveConfigFile(MPT_PATHSTRING("plugin.cache")); + // Import old tunings mpt::PathString sOldTunings; sOldTunings = GetAppDirPath(); @@ -864,25 +901,6 @@ } } - // Set up default file locations - m_szConfigFileName = m_szConfigDirectory; // config file - m_szConfigFileName += MPT_PATHSTRING("mptrack.ini"); - - m_szPluginCacheFileName = m_szConfigDirectory + MPT_PATHSTRING("plugin.cache"); // plugin cache - - mpt::PathString szTemplatePath; - szTemplatePath = m_szConfigDirectory; - szTemplatePath += MPT_PATHSTRING("TemplateModules\\"); - TrackerDirectories::Instance().SetDefaultDirectory(szTemplatePath, DIR_TEMPLATE_FILES_USER); - - //Force use of custom ini file rather than windowsDir\executableName.ini - if(m_pszProfileName) - { - free((void *)m_pszProfileName); - } - m_pszProfileName = _tcsdup(m_szConfigFileName.ToCString()); - - m_bPortableMode = bIsAppDir; } BOOL CTrackApp::InitInstance() Modified: trunk/OpenMPT/mptrack/Mptrack.h =================================================================== --- trunk/OpenMPT/mptrack/Mptrack.h 2014-12-15 00:56:12 UTC (rev 4652) +++ trunk/OpenMPT/mptrack/Mptrack.h 2014-12-15 12:11:45 UTC (rev 4653) @@ -333,9 +333,7 @@ BOOL UninitializeDXPlugins(); -#ifdef WIN32 // Legacy stuff bool MoveConfigFile(mpt::PathString sFileName, mpt::PathString sSubDir = mpt::PathString(), mpt::PathString sNewFileName = mpt::PathString()); -#endif // WIN32 }; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <man...@us...> - 2014-12-16 10:14:29
|
Revision: 4654 http://sourceforge.net/p/modplug/code/4654 Author: manxorist Date: 2014-12-16 10:14:16 +0000 (Tue, 16 Dec 2014) Log Message: ----------- [Fix] iostreams are not copyable. Modified Paths: -------------- trunk/OpenMPT/mptrack/Childfrm.cpp trunk/OpenMPT/mptrack/Childfrm.h trunk/OpenMPT/mptrack/Moddoc.cpp Modified: trunk/OpenMPT/mptrack/Childfrm.cpp =================================================================== --- trunk/OpenMPT/mptrack/Childfrm.cpp 2014-12-15 12:11:45 UTC (rev 4653) +++ trunk/OpenMPT/mptrack/Childfrm.cpp 2014-12-16 10:14:16 UTC (rev 4654) @@ -468,8 +468,8 @@ //end rewbs.customKeysAutoEffects -std::ostringstream CChildFrame::SerializeView() const -//--------------------------------------------------- +std::string CChildFrame::SerializeView() const +//-------------------------------------------- { std::ostringstream f(std::ios::out | std::ios::binary); // Version @@ -488,7 +488,7 @@ { mpt::IO::WriteVarInt(f, (uint32_t)view->SendMessage(WM_MOD_CTRLMSG, CTRLMSG_GETCURRENTINSTRUMENT)); // Instrument number } - return f; + return f.str(); } Modified: trunk/OpenMPT/mptrack/Childfrm.h =================================================================== --- trunk/OpenMPT/mptrack/Childfrm.h 2014-12-15 12:11:45 UTC (rev 4653) +++ trunk/OpenMPT/mptrack/Childfrm.h 2014-12-16 10:14:16 UTC (rev 4654) @@ -124,7 +124,7 @@ void SetSplitterHeight(int x); int GetSplitterHeight(); - std::ostringstream SerializeView() const; + std::string SerializeView() const; void DeserializeView(FileReader &file); // Overrides Modified: trunk/OpenMPT/mptrack/Moddoc.cpp =================================================================== --- trunk/OpenMPT/mptrack/Moddoc.cpp 2014-12-15 12:11:45 UTC (rev 4653) +++ trunk/OpenMPT/mptrack/Moddoc.cpp 2014-12-16 10:14:16 UTC (rev 4654) @@ -3005,7 +3005,7 @@ mpt::IO::WriteIntLE<int32_t>(f, Util::muldivr(rect.Width(), 1 << 30, width)); mpt::IO::WriteIntLE<int32_t>(f, Util::muldivr(rect.Height(), 1 << 30, height)); - std::string s = pChildFrm->SerializeView().str(); + std::string s = pChildFrm->SerializeView(); mpt::IO::WriteVarInt(f, s.size()); f << s; } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <sag...@us...> - 2014-12-16 17:51:47
|
Revision: 4655 http://sourceforge.net/p/modplug/code/4655 Author: saga-games Date: 2014-12-16 17:51:32 +0000 (Tue, 16 Dec 2014) Log Message: ----------- [Reg] Remove portable option from welcome dialog. It's not easily possible to implement this right now. Modified Paths: -------------- trunk/OpenMPT/mptrack/Mptrack.h trunk/OpenMPT/mptrack/WelcomeDialog.cpp trunk/OpenMPT/mptrack/mptrack.rc Modified: trunk/OpenMPT/mptrack/Mptrack.h =================================================================== --- trunk/OpenMPT/mptrack/Mptrack.h 2014-12-16 10:14:16 UTC (rev 4654) +++ trunk/OpenMPT/mptrack/Mptrack.h 2014-12-16 17:51:32 UTC (rev 4655) @@ -273,7 +273,6 @@ return *m_pTrackerSettings; } bool IsPortableMode() { return m_bPortableMode; } - void SetPortableMode(bool portable) { m_bPortableMode = portable; } SettingsContainer & GetPluginCache() { ASSERT(m_pPluginCache); Modified: trunk/OpenMPT/mptrack/WelcomeDialog.cpp =================================================================== --- trunk/OpenMPT/mptrack/WelcomeDialog.cpp 2014-12-16 10:14:16 UTC (rev 4654) +++ trunk/OpenMPT/mptrack/WelcomeDialog.cpp 2014-12-16 17:51:32 UTC (rev 4655) @@ -121,8 +121,6 @@ CheckDlgButton(IDC_CHECK1, BST_CHECKED); CheckDlgButton(IDC_CHECK2, (TrackerSettings::Instance().m_dwPatternSetup & PATTERN_SMALLFONT) ? BST_UNCHECKED : BST_CHECKED); - CheckDlgButton(IDC_CHECK3, theApp.IsPortableMode() ? BST_CHECKED : BST_UNCHECKED); - GetDlgItem(IDC_CHECK3)->EnableWindow(theApp.IsPortableMode() ? FALSE : TRUE); ShowWindow(SW_SHOW); @@ -156,7 +154,6 @@ TrackerSettings::Instance().m_dwPatternSetup &= ~PATTERN_SMALLFONT; else TrackerSettings::Instance().m_dwPatternSetup |= PATTERN_SMALLFONT; - theApp.SetPortableMode(IsDlgButtonChecked(IDC_CHECK3) != BST_UNCHECKED); CComboBox *combo = (CComboBox *)GetDlgItem(IDC_COMBO1); const char *keyFile = static_cast<char *>(combo->GetItemDataPtr(combo->GetCurSel())); Modified: trunk/OpenMPT/mptrack/mptrack.rc =================================================================== --- trunk/OpenMPT/mptrack/mptrack.rc 2014-12-16 10:14:16 UTC (rev 4654) +++ trunk/OpenMPT/mptrack/mptrack.rc 2014-12-16 17:51:32 UTC (rev 4655) @@ -337,25 +337,23 @@ PUSHBUTTON "&Cancel",IDCANCEL,120,24,50,14 END -IDD_WECLOME DIALOGEX 0, 0, 256, 154 +IDD_WECLOME DIALOGEX 0, 0, 256, 137 STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_CAPTION | WS_SYSMENU CAPTION "Welcome to OpenMPT!" FONT 8, "MS Shell Dlg", 400, 0, 0x1 BEGIN - DEFPUSHBUTTON "&OK",IDOK,198,135,50,14 + DEFPUSHBUTTON "&OK",IDOK,198,116,50,14 LTEXT "Please review the following settings before using this software:",IDC_STATIC,6,6,246,8 CONTROL "&Automatically check for new versions of OpenMPT",IDC_CHECK1, "Button",BS_AUTOCHECKBOX | WS_TABSTOP,6,24,246,10 - CONTROL "Store settings in installation directory (&portable mode)",IDC_CHECK3, + CONTROL "&Use a big font in the pattern editor",IDC_CHECK2, "Button",BS_AUTOCHECKBOX | WS_TABSTOP,6,42,246,10 - CONTROL "&Use a big font in the pattern editor",IDC_CHECK2, - "Button",BS_AUTOCHECKBOX | WS_TABSTOP,6,60,246,10 - LTEXT "&Default keyboard scheme:",IDC_STATIC,6,81,108,8 - COMBOBOX IDC_COMBO1,114,79,132,30,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP - LTEXT "Scan for existing VST plugins in the following location:",IDC_STATIC,6,100,172,8 - PUSHBUTTON "&Scan",IDC_BUTTON2,198,97,50,14 - EDITTEXT IDC_EDIT1,6,113,240,12,ES_AUTOHSCROLL | ES_READONLY | NOT WS_BORDER - PUSHBUTTON "&More Settings",IDC_BUTTON1,6,135,60,14 + LTEXT "&Default keyboard scheme:",IDC_STATIC,6,63,108,8 + COMBOBOX IDC_COMBO1,114,60,132,30,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP + LTEXT "Scan for existing VST plugins in the following location:",IDC_STATIC,6,82,172,8 + PUSHBUTTON "&Scan",IDC_BUTTON2,198,79,50,14 + EDITTEXT IDC_EDIT1,6,95,240,12,ES_AUTOHSCROLL | ES_READONLY | NOT WS_BORDER + PUSHBUTTON "&More Settings",IDC_BUTTON1,6,116,60,14 END @@ -516,7 +514,7 @@ LEFTMARGIN, 7 RIGHTMARGIN, 249 TOPMARGIN, 7 - BOTTOMMARGIN, 147 + BOTTOMMARGIN, 130 END END #endif // APSTUDIO_INVOKED This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <sag...@us...> - 2014-12-21 22:06:14
|
Revision: 4671 http://sourceforge.net/p/modplug/code/4671 Author: saga-games Date: 2014-12-21 22:06:00 +0000 (Sun, 21 Dec 2014) Log Message: ----------- [Imp] Make parameter editor DPI-aware. Modified Paths: -------------- trunk/OpenMPT/mptrack/EffectVis.cpp trunk/OpenMPT/mptrack/EffectVis.h trunk/OpenMPT/mptrack/MainFrm.cpp trunk/OpenMPT/mptrack/Mainfrm.h trunk/OpenMPT/mptrack/mptrack.rc trunk/OpenMPT/mptrack/resource.h Removed Paths: ------------- trunk/OpenMPT/mptrack/res/bitmap1.bmp trunk/OpenMPT/mptrack/res/vispcnode.bmp Modified: trunk/OpenMPT/mptrack/EffectVis.cpp =================================================================== --- trunk/OpenMPT/mptrack/EffectVis.cpp 2014-12-21 18:18:28 UTC (rev 4670) +++ trunk/OpenMPT/mptrack/EffectVis.cpp 2014-12-21 22:06:00 UTC (rev 4671) @@ -21,16 +21,6 @@ OPENMPT_NAMESPACE_BEGIN -#define NODESIZE 7 -#define NODEHALF 3 -#define BOTTOMBORDER 20 -#define TOPBORDER 0 -#define LEFTBORDER 0 -#define RIGHTBORDER 0 - -#define INNERLEFTBORDER 4 -#define INNERRIGHTBORDER 4 - // EffectVis dialog IMPLEMENT_DYNAMIC(CEffectVis, CDialog) @@ -175,7 +165,7 @@ //---------------------------------------------- { if ((row >= m_startRow) || (row <= m_endRow)) - return Util::Round<int>(m_rcDraw.left + INNERLEFTBORDER + (row - m_startRow) * m_pixelsPerRow); + return Util::Round<int>(m_rcDraw.left + m_innerBorder + (row - m_startRow) * m_pixelsPerRow); return -1; } @@ -251,7 +241,7 @@ if (x >= RowToScreenX(m_endRow)) return m_endRow; - return Util::Round<ROWINDEX>(m_startRow + (x - INNERLEFTBORDER) / m_pixelsPerRow); + return Util::Round<ROWINDEX>(m_startRow + (x - m_innerBorder) / m_pixelsPerRow); } CEffectVis::~CEffectVis() @@ -306,8 +296,8 @@ m_dcGrid.SelectObject(CMainFrame::penScratch); int y1 = m_rcDraw.bottom/numHorizontalLines * i; - m_dcGrid.MoveTo(m_rcDraw.left+INNERLEFTBORDER, y1); - m_dcGrid.LineTo(m_rcDraw.right-INNERRIGHTBORDER, y1); + m_dcGrid.MoveTo(m_rcDraw.left + m_innerBorder, y1); + m_dcGrid.LineTo(m_rcDraw.right - m_innerBorder, y1); } } @@ -424,7 +414,7 @@ memDC.TransparentBlt(0, 0, m_rcDraw.Width(), m_rcDraw.Height(), &m_dcPlayPos, 0, 0, m_rcDraw.Width(), m_rcDraw.Height(), 0x00000000) ; // copy the resulting bitmap to the destination - pDC->BitBlt(LEFTBORDER, TOPBORDER, m_rcDraw.Width()+LEFTBORDER, m_rcDraw.Height()+TOPBORDER, &memDC, 0, 0, SRCCOPY) ; + pDC->BitBlt(0, 0, m_rcDraw.Width(), m_rcDraw.Height(), &memDC, 0, 0, SRCCOPY) ; } memDC.SelectObject(oldBitmap); @@ -435,24 +425,35 @@ void CEffectVis::DrawNodes() //-------------------------- { + if(m_rcDraw.IsRectEmpty()) + return; + + //Draw + const int lineWidth = MulDiv(1, GetDeviceCaps(GetDC()->m_hDC, LOGPIXELSX), 96); + const int nodeSizeHalf = m_nodeSizeHalf; + const int nodeSizeHalf2 = nodeSizeHalf - lineWidth + 1; + const int nodeSize = 2 * nodeSizeHalf + 1; + //erase - if ((UINT)m_nRowToErase<m_startRow || m_nParamToErase < 0) + if ((ROWINDEX)m_nRowToErase < m_startRow || m_nParamToErase < 0) { - if(!m_rcDraw.IsRectEmpty()) - m_dcNodes.FillSolidRect(&m_rcDraw, 0); + m_dcNodes.FillSolidRect(&m_rcDraw, 0); } else { int x = RowToScreenX(m_nRowToErase); - CRect r(x - NODEHALF - 1, m_rcDraw.top, x - NODEHALF + NODESIZE + 1, m_rcDraw.bottom); + CRect r(x - nodeSizeHalf, m_rcDraw.top, x + nodeSizeHalf, m_rcDraw.bottom); m_dcNodes.FillSolidRect(&r, 0); } - //Draw for (ROWINDEX row = m_startRow; row <= m_endRow; row++) { + COLORREF col = IsPcNote(row) ? RGB(0xFF, 0xFF, 0x00) : RGB(0xD0, 0xFF, 0xFF); int x = RowToScreenX(row); int y = RowToScreenY(row); - DibBlt(m_dcNodes.m_hDC, x-NODEHALF, y-NODEHALF, NODESIZE, NODESIZE, 0, 0, IsPcNote(row) ? CMainFrame::bmpVisPcNode : CMainFrame::bmpVisNode); + m_dcNodes.FillSolidRect(x - nodeSizeHalf, y - nodeSizeHalf, nodeSize, lineWidth, col); // Top + m_dcNodes.FillSolidRect(x + nodeSizeHalf2, y - nodeSizeHalf, lineWidth, nodeSize, col); // Right + m_dcNodes.FillSolidRect(x - nodeSizeHalf, y + nodeSizeHalf2, nodeSize, lineWidth, col); // Bottom + m_dcNodes.FillSolidRect(x - nodeSizeHalf, y - nodeSizeHalf, lineWidth, nodeSize, col); // Left } } @@ -466,8 +467,8 @@ int x = RowToScreenX(row); invalidated.bottom = m_rcDraw.bottom; invalidated.top = m_rcDraw.top; - invalidated.left = x - NODEHALF*2; - invalidated.right = x + NODEHALF*2; + invalidated.left = x - m_nodeSizeHalf; + invalidated.right = x + m_nodeSizeHalf; InvalidateRect(&invalidated, FALSE); InvalidateRect(NULL, FALSE); @@ -535,8 +536,8 @@ MPT_UNREFERENCED_PARAMETER(cx); MPT_UNREFERENCED_PARAMETER(cy); GetClientRect(&m_rcFullWin); - m_rcDraw.SetRect( m_rcFullWin.left + LEFTBORDER, m_rcFullWin.top + TOPBORDER, - m_rcFullWin.right - RIGHTBORDER, m_rcFullWin.bottom - BOTTOMBORDER); + m_rcDraw.SetRect( m_rcFullWin.left, m_rcFullWin.top, + m_rcFullWin.right, m_rcFullWin.bottom - m_marginBottom); #define INFOWIDTH 200 #define ACTIONLISTWIDTH 150 @@ -551,7 +552,7 @@ if(m_nRows) - m_pixelsPerRow = (float)(m_rcDraw.Width()-INNERLEFTBORDER-INNERRIGHTBORDER)/(float)m_nRows; + m_pixelsPerRow = (float)(m_rcDraw.Width() - m_innerBorder * 2) / (float)m_nRows; else m_pixelsPerRow = 1; m_pixelsPerFXParam = (float)(m_rcDraw.Height())/(float)0xFF; @@ -608,7 +609,7 @@ } if(m_nRows) - m_pixelsPerRow = (float)(m_rcDraw.Width()-INNERLEFTBORDER-INNERRIGHTBORDER) / (float)m_nRows; + m_pixelsPerRow = (float)(m_rcDraw.Width() - m_innerBorder * 2) / (float)m_nRows; else m_pixelsPerRow = 1; m_pixelsPerFXParam = (float)(m_rcDraw.Height())/(float)0xFF; @@ -633,7 +634,7 @@ { int x = RowToScreenX(row); int y = RowToScreenY(row); - rect.SetRect(x-NODEHALF, y-NODEHALF, x+NODEHALF+1, y+NODEHALF+1); + rect.SetRect(x - m_nodeSizeHalf, y - m_nodeSizeHalf, x + m_nodeSizeHalf + 1, y + m_nodeSizeHalf + 1); if (rect.PtInRect(point)) { m_pModDoc->GetPatternUndo().PrepareUndo(static_cast<PATTERNINDEX>(m_nPattern), m_nChan, row, m_nChan + 1, row + 1, "Parameter Editor entry"); @@ -751,6 +752,13 @@ //----------------------------- { CDialog::OnInitDialog(); + + int dpi = GetDeviceCaps(GetDC()->m_hDC, LOGPIXELSX); + m_nodeSizeHalf = MulDiv(3, dpi, 96); + m_marginBottom = MulDiv(20, dpi, 96); + m_innerBorder = MulDiv(4, dpi, 96); + + if (m_pModDoc->GetModType() == MOD_TYPE_MPT && IsPcNote(m_startRow)) { // If first selected row is a PC Note, default to PC note overwrite mode Modified: trunk/OpenMPT/mptrack/EffectVis.h =================================================================== --- trunk/OpenMPT/mptrack/EffectVis.h 2014-12-21 18:18:28 UTC (rev 4670) +++ trunk/OpenMPT/mptrack/EffectVis.h 2014-12-21 22:06:00 UTC (rev 4671) @@ -62,6 +62,10 @@ int m_nRowToErase; int m_nParamToErase; + int m_nodeSizeHalf; // Half width of a node; + int m_marginBottom; + int m_innerBorder; + ROWINDEX m_nOldPlayPos; ModCommand m_templatePCNote; Modified: trunk/OpenMPT/mptrack/MainFrm.cpp =================================================================== --- trunk/OpenMPT/mptrack/MainFrm.cpp 2014-12-21 18:18:28 UTC (rev 4670) +++ trunk/OpenMPT/mptrack/MainFrm.cpp 2014-12-21 22:06:00 UTC (rev 4671) @@ -158,8 +158,6 @@ LPMODPLUGDIB CMainFrame::bmpPatterns = NULL; LPMODPLUGDIB CMainFrame::bmpNotes = NULL; LPMODPLUGDIB CMainFrame::bmpVUMeters = NULL; -LPMODPLUGDIB CMainFrame::bmpVisNode = NULL; -LPMODPLUGDIB CMainFrame::bmpVisPcNode = NULL; COLORREF CMainFrame::gcolrefVuMeter[NUM_VUMETER_PENS*2]; CInputHandler *CMainFrame::m_InputHandler = nullptr; @@ -343,8 +341,6 @@ bmpPatterns = LoadDib(MAKEINTRESOURCE(IDB_PATTERNS)); bmpNotes = LoadDib(MAKEINTRESOURCE(IDB_PATTERNVIEW)); bmpVUMeters = LoadDib(MAKEINTRESOURCE(IDB_VUMETERS)); - bmpVisNode = LoadDib(MAKEINTRESOURCE(IDB_VISNODE)); - bmpVisPcNode = LoadDib(MAKEINTRESOURCE(IDB_VISPCNODE)); // Toolbars EnableDocking(CBRS_ALIGN_ANY); if (!m_wndToolBar.Create(this)) return -1; @@ -413,16 +409,6 @@ delete bmpVUMeters; bmpVUMeters = NULL; } - if (bmpVisNode) - { - delete bmpVisNode; - bmpVisNode = NULL; - } - if (bmpVisPcNode) - { - delete bmpVisPcNode; - bmpVisPcNode = NULL; - } // Kill GDI Objects #define DeleteGDIObject(h) if (h) { ::DeleteObject(h); h = NULL; } Modified: trunk/OpenMPT/mptrack/Mainfrm.h =================================================================== --- trunk/OpenMPT/mptrack/Mainfrm.h 2014-12-21 18:18:28 UTC (rev 4670) +++ trunk/OpenMPT/mptrack/Mainfrm.h 2014-12-21 22:06:00 UTC (rev 4671) @@ -336,7 +336,7 @@ // static CBrush *pbrushBlack, *pbrushWhite; static HPEN penBlack, penDarkGray, penLightGray, penWhite, penHalfDarkGray, penSample, penEnvelope, penEnvelopeHighlight, penSeparator, penScratch, penGray00, penGray33, penGray40, penGray55, penGray80, penGray99, penGraycc, penGrayff; static HCURSOR curDragging, curNoDrop, curArrow, curNoDrop2, curVSplit; - static MODPLUGDIB *bmpPatterns, *bmpNotes, *bmpVUMeters, *bmpVisNode, *bmpVisPcNode; + static MODPLUGDIB *bmpPatterns, *bmpNotes, *bmpVUMeters; static COLORREF gcolrefVuMeter[NUM_VUMETER_PENS * 2]; // General tab VU meters public: Modified: trunk/OpenMPT/mptrack/mptrack.rc =================================================================== --- trunk/OpenMPT/mptrack/mptrack.rc 2014-12-21 18:18:28 UTC (rev 4670) +++ trunk/OpenMPT/mptrack/mptrack.rc 2014-12-21 22:06:00 UTC (rev 4671) @@ -2038,8 +2038,6 @@ IDB_PATTERNVIEW BITMAP "res\\view_pat.bmp" IDB_COLORSETUP BITMAP "res\\colors.bmp" IDB_VUMETERS BITMAP "res\\vumeters.bmp" -IDB_VISNODE BITMAP "res\\bitmap1.bmp" -IDB_VISPCNODE BITMAP "res\\vispcnode.bmp" ///////////////////////////////////////////////////////////////////////////// // Deleted: trunk/OpenMPT/mptrack/res/bitmap1.bmp =================================================================== (Binary files differ) Deleted: trunk/OpenMPT/mptrack/res/vispcnode.bmp =================================================================== (Binary files differ) Modified: trunk/OpenMPT/mptrack/resource.h =================================================================== --- trunk/OpenMPT/mptrack/resource.h 2014-12-21 18:18:28 UTC (rev 4670) +++ trunk/OpenMPT/mptrack/resource.h 2014-12-21 22:06:00 UTC (rev 4671) @@ -95,11 +95,9 @@ #define IDD_SELECTMIXPLUGIN 423 #define IDD_PLUGINEDITOR 424 #define IDD_EFFECTVISUALIZER 426 -#define IDB_VISNODE 427 #define IDB_SPLASHTEST 432 #define IDB_SPLASHNOFOLDFIN 435 #define IDR_VSTMENU 436 -#define IDB_VISPCNODE 437 #define IDD_DEFAULTPLUGINEDITOR 438 #define IDD_CHANNELMANAGER 440 #define IDD_PITCHSHIFT 442 @@ -1248,6 +1246,7 @@ #define ID_MRU_LIST_LAST 44642 #define ID_FILE_APPENDMODULE 44643 #define ID_SAMPLE_16BITCONVERT 44644 + // Next default values for new objects // #ifdef APSTUDIO_INVOKED This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <sag...@us...> - 2014-12-22 00:21:25
|
Revision: 4672 http://sourceforge.net/p/modplug/code/4672 Author: saga-games Date: 2014-12-22 00:21:17 +0000 (Mon, 22 Dec 2014) Log Message: ----------- [Imp] Make splitter positions DPI-aware [Fix] Also remember maximized document state when using document close shortcut. Modified Paths: -------------- trunk/OpenMPT/mptrack/CListCtrl.h trunk/OpenMPT/mptrack/CTreeCtrl.h trunk/OpenMPT/mptrack/Childfrm.cpp trunk/OpenMPT/mptrack/Childfrm.h trunk/OpenMPT/mptrack/Ctrl_com.h trunk/OpenMPT/mptrack/Ctrl_gen.h trunk/OpenMPT/mptrack/Ctrl_ins.h trunk/OpenMPT/mptrack/Ctrl_pat.h trunk/OpenMPT/mptrack/Ctrl_smp.h trunk/OpenMPT/mptrack/EffectVis.cpp trunk/OpenMPT/mptrack/EffectVis.h trunk/OpenMPT/mptrack/Globals.cpp trunk/OpenMPT/mptrack/Globals.h trunk/OpenMPT/mptrack/MPTrackUtil.h trunk/OpenMPT/mptrack/Mainbar.cpp Modified: trunk/OpenMPT/mptrack/CListCtrl.h =================================================================== --- trunk/OpenMPT/mptrack/CListCtrl.h 2014-12-21 22:06:00 UTC (rev 4671) +++ trunk/OpenMPT/mptrack/CListCtrl.h 2014-12-22 00:21:17 UTC (rev 4672) @@ -10,6 +10,8 @@ #pragma once +#include "MPTrackUtil.h" + OPENMPT_NAMESPACE_BEGIN class CListCtrlEx : public CListCtrl @@ -26,7 +28,7 @@ { for(int i = 0; i < numItems; i++) { - InsertColumn(i, header[i].text, header[i].mask, MulDiv(header[i].width, GetDeviceCaps(GetDC()->m_hDC, LOGPIXELSX), 96)); + InsertColumn(i, header[i].text, header[i].mask, Util::ScalePixels(header[i].width, GetDC())); } } Modified: trunk/OpenMPT/mptrack/CTreeCtrl.h =================================================================== --- trunk/OpenMPT/mptrack/CTreeCtrl.h 2014-12-21 22:06:00 UTC (rev 4671) +++ trunk/OpenMPT/mptrack/CTreeCtrl.h 2014-12-22 00:21:17 UTC (rev 4672) @@ -21,12 +21,12 @@ #ifndef UNICODE BOOL GetItem(TVITEMW *pItem) const { - return ::SendMessage(m_hWnd, TVM_GETITEMW, 0, (LPARAM)pItem); + return (BOOL) ::SendMessage(m_hWnd, TVM_GETITEMW, 0, (LPARAM)pItem); } BOOL SetItem(TVITEMW *pItem) { - return ::SendMessage(m_hWnd, TVM_SETITEMW, 0, (LPARAM)pItem); + return (BOOL) ::SendMessage(m_hWnd, TVM_SETITEMW, 0, (LPARAM)pItem); } BOOL SetItem(HTREEITEM hItem, UINT nMask, const WCHAR *lpszItem, int nImage, int nSelectedImage, UINT nState, UINT nStateMask, LPARAM lParam) { Modified: trunk/OpenMPT/mptrack/Childfrm.cpp =================================================================== --- trunk/OpenMPT/mptrack/Childfrm.cpp 2014-12-21 22:06:00 UTC (rev 4671) +++ trunk/OpenMPT/mptrack/Childfrm.cpp 2014-12-22 00:21:17 UTC (rev 4672) @@ -40,36 +40,13 @@ ///////////////////////////////////////////////////////////////////////////// -// - -IMPLEMENT_DYNAMIC(CViewExSplitWnd, CSplitterWnd) - -/*CWnd* CViewExSplitWnd::GetActivePane(int*, int*) // pRow, pCol -//---------------------------------------------- -{ - // attempt to use active view of frame window - CWnd* pView = NULL; - CFrameWnd* pFrameWnd = GetParentFrame(); - ASSERT_VALID(pFrameWnd); - if (pFrameWnd) pView = pFrameWnd->GetActiveView(); - - // failing that, use the current focus - if (pView == NULL) - pView = GetFocus(); - - return pView; -}*/ - - - -///////////////////////////////////////////////////////////////////////////// // CChildFrame IMPLEMENT_DYNCREATE(CChildFrame, CMDIChildWnd) BEGIN_MESSAGE_MAP(CChildFrame, CMDIChildWnd) //{{AFX_MSG_MAP(CChildFrame) - ON_WM_CLOSE() + ON_WM_DESTROY() ON_WM_NCACTIVATE() ON_MESSAGE(WM_MOD_CHANGEVIEWCLASS, OnChangeViewClass) ON_MESSAGE(WM_MOD_INSTRSELECTED, OnInstrumentSelected) @@ -91,7 +68,7 @@ m_bInitialActivation=true; //rewbs.fix3185 m_szCurrentViewClassName[0] = 0; m_hWndCtrl = m_hWndView = NULL; - m_bMaxWhenClosed = FALSE; + m_bMaxWhenClosed = false; glMdiOpenCount++; RtlZeroMemory(&m_ViewGeneral, sizeof(m_ViewGeneral)); RtlZeroMemory(&m_ViewPatterns, sizeof(m_ViewPatterns)); @@ -107,7 +84,7 @@ { if ((--glMdiOpenCount) == 0) { - TrackerSettings::Instance().gbMdiMaximize = (m_bMaxWhenClosed != 0); + TrackerSettings::Instance().gbMdiMaximize = m_bMaxWhenClosed; } } @@ -137,14 +114,15 @@ return bStatus; } -//rewbs.varWindowSize + void CChildFrame::SetSplitterHeight(int cy) +//------------------------------------------ { if (cy <= 1) cy = 188; //default to 188? why not.. - m_wndSplitter.SetRowInfo(0,cy,15); + m_wndSplitter.SetRowInfo(0, Util::ScalePixels(cy, GetDC()), 15); } -//end rewbs.varWindowSize + BOOL CChildFrame::PreCreateWindow(CREATESTRUCT& cs) //------------------------------------------------- { @@ -262,15 +240,15 @@ { CRect rect; - m_bMaxWhenClosed = IsZoomed(); - if (bForce) TrackerSettings::Instance().gbMdiMaximize = (m_bMaxWhenClosed != 0); + m_bMaxWhenClosed = IsZoomed() != FALSE; + if (bForce) TrackerSettings::Instance().gbMdiMaximize = m_bMaxWhenClosed; if (!IsIconic()) { CWnd *pWnd = m_wndSplitter.GetPane(0, 0); if (pWnd) { pWnd->GetWindowRect(&rect); - LONG l = rect.Height(); + int l = Util::ScalePixelsInv(rect.Height(), GetDC()); //rewbs.varWindowSize - not the nicest piece of code, but we need to distinguish btw the views: if (strcmp(CViewGlobals::classCViewGlobals.m_lpszClassName, m_szCurrentViewClassName) == 0) TrackerSettings::Instance().glGeneralWindowHeight = l; @@ -282,11 +260,6 @@ TrackerSettings::Instance().glInstrumentWindowHeight = l; else if (strcmp(CViewComments::classCViewComments.m_lpszClassName, m_szCurrentViewClassName) == 0) TrackerSettings::Instance().glCommentsWindowHeight = l; - //rewbs.graph - else if (strcmp("CViewGraph", m_szCurrentViewClassName) == 0) - TrackerSettings::Instance().glGraphWindowHeight = l; - //end rewbs.graph - } } } @@ -304,7 +277,7 @@ if (pWnd) { pWnd->GetWindowRect(&rect); - return rect.Height(); + return Util::ScalePixelsInv(rect.Height(), GetDC()); } } return 15; // tidy default @@ -363,11 +336,11 @@ ///////////////////////////////////////////////////////////////////////////// // CChildFrame message handlers -void CChildFrame::OnClose() -//------------------------- +void CChildFrame::OnDestroy() +//--------------------------- { SavePosition(); - CMDIChildWnd::OnClose(); + CMDIChildWnd::OnDestroy(); } Modified: trunk/OpenMPT/mptrack/Childfrm.h =================================================================== --- trunk/OpenMPT/mptrack/Childfrm.h 2014-12-21 22:06:00 UTC (rev 4671) +++ trunk/OpenMPT/mptrack/Childfrm.h 2014-12-22 00:21:17 UTC (rev 4672) @@ -35,7 +35,7 @@ PatternCursor cursor; PatternRect selection; PatternCursor::Columns nDetailLevel; - ORDERINDEX nOrder; //rewbs.playSongFromCursor + ORDERINDEX nOrder; ORDERINDEX initialOrder; } PATTERNVIEWSTATE; @@ -65,20 +65,6 @@ -//======================================== -class CViewExSplitWnd: public CSplitterWnd -//======================================== -{ - DECLARE_DYNAMIC(CViewExSplitWnd) - -// Implementation -public: - CViewExSplitWnd() {} - ~CViewExSplitWnd() {} - //CWnd* GetActivePane(int* pRow = NULL, int* pCol = NULL); -}; - - //==================================== class CChildFrame: public CMDIChildWnd //==================================== @@ -93,16 +79,16 @@ // Attributes protected: - CViewExSplitWnd m_wndSplitter; + CSplitterWnd m_wndSplitter; HWND m_hWndCtrl, m_hWndView; - BOOL m_bMaxWhenClosed; GENERALVIEWSTATE m_ViewGeneral; PATTERNVIEWSTATE m_ViewPatterns; SAMPLEVIEWSTATE m_ViewSamples; INSTRUMENTVIEWSTATE m_ViewInstruments; COMMENTVIEWSTATE m_ViewComments; CHAR m_szCurrentViewClassName[256]; - bool m_bInitialActivation; //rewbs.fix3185 + bool m_bMaxWhenClosed; + bool m_bInitialActivation; // Operations public: @@ -110,7 +96,7 @@ BOOL ChangeViewClass(CRuntimeClass* pNewViewClass, CCreateContext* pContext=NULL); void ForceRefresh(); void SavePosition(BOOL bExit=FALSE); - CHAR* GetCurrentViewClassName(); //rewbs.varWindowSize + CHAR* GetCurrentViewClassName(); LRESULT SendViewMessage(UINT uMsg, LPARAM lParam=0) const; LRESULT ActivateView(UINT nId, LPARAM lParam) { return ::SendMessage(m_hWndCtrl, WM_MOD_ACTIVATEVIEW, nId, lParam); } HWND GetHwndCtrl() const { return m_hWndCtrl; } @@ -148,7 +134,7 @@ // Generated message map functions protected: //{{AFX_MSG(CChildFrame) - afx_msg void OnClose(); + afx_msg void OnDestroy(); afx_msg BOOL OnNcActivate(BOOL bActivate); afx_msg LRESULT OnChangeViewClass(WPARAM, LPARAM lParam); afx_msg LRESULT OnInstrumentSelected(WPARAM, LPARAM lParam); Modified: trunk/OpenMPT/mptrack/Ctrl_com.h =================================================================== --- trunk/OpenMPT/mptrack/Ctrl_com.h 2014-12-21 22:06:00 UTC (rev 4671) +++ trunk/OpenMPT/mptrack/Ctrl_com.h 2014-12-22 00:21:17 UTC (rev 4672) @@ -23,7 +23,7 @@ public: CCtrlComments(CModControlView &parent, CModDoc &document); - Setting<LONG>* GetSplitPosRef() {return &TrackerSettings::Instance().glCommentsWindowHeight;} //rewbs.varWindowSize + Setting<LONG> &GetSplitPosRef() {return TrackerSettings::Instance().glCommentsWindowHeight;} //rewbs.varWindowSize public: //{{AFX_DATA(CCtrlComments) Modified: trunk/OpenMPT/mptrack/Ctrl_gen.h =================================================================== --- trunk/OpenMPT/mptrack/Ctrl_gen.h 2014-12-21 22:06:00 UTC (rev 4671) +++ trunk/OpenMPT/mptrack/Ctrl_gen.h 2014-12-22 00:21:17 UTC (rev 4672) @@ -47,7 +47,7 @@ { public: CCtrlGeneral(CModControlView &parent, CModDoc &document); - Setting<LONG>* GetSplitPosRef() {return &TrackerSettings::Instance().glGeneralWindowHeight;} //rewbs.varWindowSize + Setting<LONG> &GetSplitPosRef() {return TrackerSettings::Instance().glGeneralWindowHeight;} //rewbs.varWindowSize private: void setAsDecibels(LPSTR stringToSet, double value, double valueAtZeroDB); Modified: trunk/OpenMPT/mptrack/Ctrl_ins.h =================================================================== --- trunk/OpenMPT/mptrack/Ctrl_ins.h 2014-12-21 22:06:00 UTC (rev 4671) +++ trunk/OpenMPT/mptrack/Ctrl_ins.h 2014-12-22 00:21:17 UTC (rev 4672) @@ -128,7 +128,7 @@ BOOL OpenInstrument(CSoundFile &sndFile, INSTRUMENTINDEX nInstr); BOOL EditSample(UINT nSample); VOID UpdateFilterText(); - Setting<LONG>* GetSplitPosRef() {return &TrackerSettings::Instance().glInstrumentWindowHeight;} //rewbs.varWindowSize + Setting<LONG> &GetSplitPosRef() {return TrackerSettings::Instance().glInstrumentWindowHeight;} //rewbs.varWindowSize public: //{{AFX_VIRTUAL(CCtrlInstruments) Modified: trunk/OpenMPT/mptrack/Ctrl_pat.h =================================================================== --- trunk/OpenMPT/mptrack/Ctrl_pat.h 2014-12-21 22:06:00 UTC (rev 4671) +++ trunk/OpenMPT/mptrack/Ctrl_pat.h 2014-12-22 00:21:17 UTC (rev 4672) @@ -191,7 +191,7 @@ public: CCtrlPatterns(CModControlView &parent, CModDoc &document); - Setting<LONG>* GetSplitPosRef() {return &TrackerSettings::Instance().glPatternWindowHeight;} //rewbs.varWindowSize + Setting<LONG> &GetSplitPosRef() {return TrackerSettings::Instance().glPatternWindowHeight;} //rewbs.varWindowSize public: void SetCurrentPattern(PATTERNINDEX nPat); Modified: trunk/OpenMPT/mptrack/Ctrl_smp.h =================================================================== --- trunk/OpenMPT/mptrack/Ctrl_smp.h 2014-12-21 22:06:00 UTC (rev 4671) +++ trunk/OpenMPT/mptrack/Ctrl_smp.h 2014-12-22 00:21:17 UTC (rev 4672) @@ -69,7 +69,7 @@ bool SetCurrentSample(SAMPLEINDEX nSmp, LONG lZoom = -1, bool bUpdNum = true); bool OpenSample(const mpt::PathString &fileName); bool OpenSample(const CSoundFile &sndFile, SAMPLEINDEX nSample); - Setting<LONG>* GetSplitPosRef() {return &TrackerSettings::Instance().glSampleWindowHeight;} //rewbs.varWindowSize + Setting<LONG> &GetSplitPosRef() {return TrackerSettings::Instance().glSampleWindowHeight;} //rewbs.varWindowSize public: //{{AFX_VIRTUAL(CCtrlSamples) Modified: trunk/OpenMPT/mptrack/EffectVis.cpp =================================================================== --- trunk/OpenMPT/mptrack/EffectVis.cpp 2014-12-21 22:06:00 UTC (rev 4671) +++ trunk/OpenMPT/mptrack/EffectVis.cpp 2014-12-22 00:21:17 UTC (rev 4672) @@ -429,7 +429,7 @@ return; //Draw - const int lineWidth = MulDiv(1, GetDeviceCaps(GetDC()->m_hDC, LOGPIXELSX), 96); + const int lineWidth = Util::ScalePixels(1, GetDC()); const int nodeSizeHalf = m_nodeSizeHalf; const int nodeSizeHalf2 = nodeSizeHalf - lineWidth + 1; const int nodeSize = 2 * nodeSizeHalf + 1; Modified: trunk/OpenMPT/mptrack/EffectVis.h =================================================================== --- trunk/OpenMPT/mptrack/EffectVis.h 2014-12-21 22:06:00 UTC (rev 4671) +++ trunk/OpenMPT/mptrack/EffectVis.h 2014-12-22 00:21:17 UTC (rev 4672) @@ -109,7 +109,6 @@ virtual void OnOK(); virtual void OnCancel(); afx_msg void OnClose(); - Setting<LONG>* GetSplitPosRef() {return NULL;} //rewbs.varWindowSize CViewPattern *m_pViewPattern; Modified: trunk/OpenMPT/mptrack/Globals.cpp =================================================================== --- trunk/OpenMPT/mptrack/Globals.cpp 2014-12-21 22:06:00 UTC (rev 4671) +++ trunk/OpenMPT/mptrack/Globals.cpp 2014-12-22 00:21:17 UTC (rev 4672) @@ -326,9 +326,8 @@ if ((nIndex < 0) || (nIndex >= MAX_PAGES) || (!pMainFrm)) return FALSE; - //rewbs.varWindowSize if (m_Pages[m_nActiveDlg]) - *(m_Pages[m_nActiveDlg]->GetSplitPosRef()) = ((CChildFrame *)GetParentFrame())->GetSplitterHeight(); + m_Pages[m_nActiveDlg]->GetSplitPosRef() = ((CChildFrame *)GetParentFrame())->GetSplitterHeight(); if (nIndex == m_nActiveDlg) { @@ -393,7 +392,7 @@ pMainFrm->SetInfoText(""); pMainFrm->SetXInfoText(""); //rewbs.xinfo pDlg->ShowWindow(SW_SHOW); - ((CChildFrame *)GetParentFrame())->SetSplitterHeight(*(pDlg->GetSplitPosRef())); //rewbs.varWindowSize + ((CChildFrame *)GetParentFrame())->SetSplitterHeight(pDlg->GetSplitPosRef()); if (m_hWndMDI) ::PostMessage(m_hWndMDI, WM_MOD_CHANGEVIEWCLASS, (WPARAM)lParam, (LPARAM)pDlg); return TRUE; } @@ -433,7 +432,7 @@ { mask |= 8; //mask |= 32; //rewbs.graph - nCount ++; + nCount++; } if (nCount != (UINT)m_TabCtrl.GetItemCount()) { Modified: trunk/OpenMPT/mptrack/Globals.h =================================================================== --- trunk/OpenMPT/mptrack/Globals.h 2014-12-21 22:06:00 UTC (rev 4671) +++ trunk/OpenMPT/mptrack/Globals.h 2014-12-22 00:21:17 UTC (rev 4672) @@ -63,7 +63,7 @@ void LockControls() { m_nLockCount++; } void UnlockControls() { PostMessage(WM_MOD_UNLOCKCONTROLS); } bool IsLocked() const { return (m_nLockCount > 0); } - virtual Setting<LONG>* GetSplitPosRef() = 0; //rewbs.varWindowSize + virtual Setting<LONG> &GetSplitPosRef() = 0; //rewbs.varWindowSize protected: //{{AFX_VIRTUAL(CModControlDlg) Modified: trunk/OpenMPT/mptrack/MPTrackUtil.h =================================================================== --- trunk/OpenMPT/mptrack/MPTrackUtil.h 2014-12-21 22:06:00 UTC (rev 4671) +++ trunk/OpenMPT/mptrack/MPTrackUtil.h 2014-12-22 00:21:17 UTC (rev 4672) @@ -95,6 +95,18 @@ fixEnd = delStart; } } + + // Applies DPI scaling factor to some given size + forceinline int ScalePixels(int pixels, CDC *pDC) + { + return MulDiv(pixels, ::GetDeviceCaps(pDC->m_hDC, LOGPIXELSX), 96); + } + + // Removes DPI scaling factor from some given size + forceinline int ScalePixelsInv(int pixels, CDC *pDC) + { + return MulDiv(pixels, 96, ::GetDeviceCaps(pDC->m_hDC, LOGPIXELSX)); + } } Modified: trunk/OpenMPT/mptrack/Mainbar.cpp =================================================================== --- trunk/OpenMPT/mptrack/Mainbar.cpp 2014-12-21 22:06:00 UTC (rev 4671) +++ trunk/OpenMPT/mptrack/Mainbar.cpp 2014-12-22 00:21:17 UTC (rev 4672) @@ -130,7 +130,7 @@ ///////////////////////////////////////////////////////////////////// // CMainToolBar -#define SCALEWIDTH(x) (MulDiv(x, GetDeviceCaps(GetDC()->m_hDC, LOGPIXELSX), 96)) +#define SCALEWIDTH(x) (Util::ScalePixels(x, GetDC())) // Play Command #define PLAYCMD_INDEX 10 @@ -640,7 +640,7 @@ m_pModTree = new CModTree(m_pModTreeData); if (m_pModTree) m_pModTree->SubclassDlgItem(IDC_TREEVIEW, this); m_dwStatus = 0; - m_sizeDefault.cx = TrackerSettings::Instance().glTreeWindowWidth + 3; + m_sizeDefault.cx = Util::ScalePixels(TrackerSettings::Instance().glTreeWindowWidth, GetDC()) + 3; m_sizeDefault.cy = 32767; return l; } @@ -718,10 +718,11 @@ CSize CModTreeBar::CalcFixedLayout(BOOL, BOOL) //-------------------------------------------- { + int width = Util::ScalePixels(TrackerSettings::Instance().glTreeWindowWidth, GetDC()); CSize sz; - m_sizeDefault.cx = TrackerSettings::Instance().glTreeWindowWidth; + m_sizeDefault.cx = width; m_sizeDefault.cy = 32767; - sz.cx = TrackerSettings::Instance().glTreeWindowWidth + 3; + sz.cx = width + 3; if (sz.cx < 4) sz.cx = 4; sz.cy = 32767; return sz; @@ -869,7 +870,7 @@ CMainFrame *pMainFrm = CMainFrame::GetMainFrame(); if ((m_nTrackPos != (UINT)rect.Width()) && (pMainFrm)) { - TrackerSettings::Instance().glTreeWindowWidth = m_nTrackPos - 3; + TrackerSettings::Instance().glTreeWindowWidth = Util::ScalePixelsInv(m_nTrackPos - 3, GetDC()); m_sizeDefault.cx = m_nTrackPos; m_sizeDefault.cy = 32767; pMainFrm->RecalcLayout(); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <sag...@us...> - 2014-12-23 19:11:34
|
Revision: 4673 http://sourceforge.net/p/modplug/code/4673 Author: saga-games Date: 2014-12-23 19:11:09 +0000 (Tue, 23 Dec 2014) Log Message: ----------- [Fix] Instrument tab: Plugin list was updated on every instrument change, loading to a small but noticeable performance drop. [Fix] When using the Song Properties dialog to change some properties of an IT file, re-saving the file always popped up the Save As dialog. Modified Paths: -------------- trunk/OpenMPT/mptrack/Ctrl_ins.cpp trunk/OpenMPT/mptrack/ModConvert.cpp trunk/OpenMPT/mptrack/Moddoc.cpp Modified: trunk/OpenMPT/mptrack/Ctrl_ins.cpp =================================================================== --- trunk/OpenMPT/mptrack/Ctrl_ins.cpp 2014-12-22 00:21:17 UTC (rev 4672) +++ trunk/OpenMPT/mptrack/Ctrl_ins.cpp 2014-12-23 19:11:09 UTC (rev 4673) @@ -1366,7 +1366,7 @@ } m_NoteMap.InvalidateRect(NULL, FALSE); } - if(hintType[HINT_MIXPLUGINS | HINT_MODTYPE]) + if(hint.ToType<PluginHint>().GetType()[HINT_MIXPLUGINS | HINT_PLUGINNAMES | HINT_MODTYPE]) { UpdatePluginList(); } @@ -2863,6 +2863,7 @@ void CCtrlInstruments::UpdatePluginList() //--------------------------------------- { + m_CbnMixPlug.SetRedraw(FALSE); m_CbnMixPlug.Clear(); m_CbnMixPlug.ResetContent(); CHAR s[64]; @@ -2883,6 +2884,7 @@ m_CbnMixPlug.SetItemData(m_CbnMixPlug.AddString(s), nPlug); } + m_CbnMixPlug.SetRedraw(TRUE); ModInstrument *pIns = m_sndFile.Instruments[m_nInstrument]; if ((pIns) && (pIns->nMixPlug <= MAX_MIXPLUGINS)) m_CbnMixPlug.SetCurSel(pIns->nMixPlug); } Modified: trunk/OpenMPT/mptrack/ModConvert.cpp =================================================================== --- trunk/OpenMPT/mptrack/ModConvert.cpp 2014-12-22 00:21:17 UTC (rev 4672) +++ trunk/OpenMPT/mptrack/ModConvert.cpp 2014-12-23 19:11:09 UTC (rev 4673) @@ -89,15 +89,6 @@ const MODTYPE nOldType = m_SndFile.GetType(); - if(nNewType == nOldType && nNewType == MOD_TYPE_IT) - { - // Even if m_nType doesn't change, we might need to change extension in itp<->it case. - // This is because ITP is a HACK and doesn't genuinely change m_nType, - // but uses flags instead. - ChangeFileExtension(nNewType); - return true; - } - if(nNewType == nOldType) return true; Modified: trunk/OpenMPT/mptrack/Moddoc.cpp =================================================================== --- trunk/OpenMPT/mptrack/Moddoc.cpp 2014-12-22 00:21:17 UTC (rev 4672) +++ trunk/OpenMPT/mptrack/Moddoc.cpp 2014-12-23 19:11:09 UTC (rev 4673) @@ -411,29 +411,21 @@ //------------------------------------------------------------------------------------- { ScopedLogCapturer logcapturer(*this); - static int greccount = 0; BOOL bOk = FALSE; m_SndFile.m_dwLastSavedWithVersion = MptVersion::num; if(filename.empty()) return FALSE; - MODTYPE type = m_SndFile.GetType(); // CModSpecifications::ExtensionToType(fext); - if (type == MOD_TYPE_NONE && !greccount) - { - greccount++; - bOk = DoSave(mpt::PathString(), TRUE); - greccount--; - return bOk; - } BeginWaitCursor(); FixNullStrings(); - switch(type) + switch(m_SndFile.GetType()) { case MOD_TYPE_MOD: bOk = m_SndFile.SaveMod(filename); break; case MOD_TYPE_S3M: bOk = m_SndFile.SaveS3M(filename); break; case MOD_TYPE_XM: bOk = m_SndFile.SaveXM(filename); break; case MOD_TYPE_IT: bOk = m_SndFile.SaveIT(filename); break; case MOD_TYPE_MPT: bOk = m_SndFile.SaveIT(filename); break; + default: ASSERT(false); } EndWaitCursor(); if (bOk) @@ -2757,7 +2749,7 @@ { ScopedLogCapturer logcapturer(*this, "Conversion Status"); bool bShowLog = false; - if(dlg.m_nType) + if(dlg.m_nType != GetModType()) { if (!ChangeModType(dlg.m_nType)) return; bShowLog = true; @@ -2983,7 +2975,7 @@ // Document view positions and sizes POSITION pos = GetFirstViewPosition(); - while(pos != nullptr) + while(pos != nullptr && !mdiRect.IsRectEmpty()) { CModControlView *pView = dynamic_cast<CModControlView *>(GetNextView(pos)); if(pView) @@ -3112,7 +3104,10 @@ { wnd.rcNormalPosition = CRect(rect.left, rect.top, rect.right, rect.bottom); } - pChildFrm->SetWindowPlacement(&wnd); + if(!mdiRect.IsRectEmpty()) + { + pChildFrm->SetWindowPlacement(&wnd); + } pChildFrm->DeserializeView(data); pChildFrm = nullptr; } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |