From: <sag...@us...> - 2014-04-02 19:26:43
|
Revision: 4003 http://sourceforge.net/p/modplug/code/4003 Author: saga-games Date: 2014-04-02 19:26:35 +0000 (Wed, 02 Apr 2014) Log Message: ----------- [Fix] More multi-view update fixes. Modified Paths: -------------- trunk/OpenMPT/mptrack/Ctrl_ins.cpp trunk/OpenMPT/mptrack/Ctrl_ins.h trunk/OpenMPT/mptrack/View_ins.cpp trunk/OpenMPT/mptrack/View_ins.h trunk/OpenMPT/mptrack/View_pat.cpp trunk/OpenMPT/mptrack/View_smp.cpp trunk/OpenMPT/mptrack/View_smp.h Modified: trunk/OpenMPT/mptrack/Ctrl_ins.cpp =================================================================== --- trunk/OpenMPT/mptrack/Ctrl_ins.cpp 2014-04-02 15:01:53 UTC (rev 4002) +++ trunk/OpenMPT/mptrack/Ctrl_ins.cpp 2014-04-02 19:26:35 UTC (rev 4003) @@ -396,7 +396,7 @@ } if (bModified) { - m_pParent.SetInstrumentModified(); + m_pParent.SetModified(HINT_INSTRUMENT, false); InvalidateRect(NULL, FALSE); } } @@ -417,7 +417,7 @@ } if (bModified) { - m_pParent.SetInstrumentModified(); + m_pParent.SetModified(HINT_INSTRUMENT, false); InvalidateRect(NULL, FALSE); } } @@ -438,7 +438,7 @@ } if (bModified) { - m_pParent.SetInstrumentModified(); + m_pParent.SetModified(HINT_INSTRUMENT, false); InvalidateRect(NULL, FALSE); } } @@ -480,7 +480,7 @@ } if (bModified) { - m_pParent.SetInstrumentModified(); + m_pParent.SetModified(HINT_INSTRUMENT, false); InvalidateRect(NULL, FALSE); } } @@ -581,7 +581,7 @@ if (n != pIns->NoteMap[m_nNote]) { pIns->NoteMap[m_nNote] = n; - m_pParent.SetInstrumentModified(); + m_pParent.SetModified(HINT_INSTRUMENT, false); InvalidateRect(NULL, FALSE); } if (bOk) @@ -616,7 +616,7 @@ if (n != pIns->Keyboard[m_nNote]) { pIns->Keyboard[m_nNote] = n; - m_pParent.SetInstrumentModified(); + m_pParent.SetModified(HINT_INSTRUMENT, false); InvalidateRect(NULL, FALSE); PlayNote(m_nNote+1); } @@ -648,7 +648,7 @@ if (n != pIns->NoteMap[m_nNote]) { pIns->NoteMap[m_nNote] = n; - m_pParent.SetInstrumentModified(); + m_pParent.SetModified(HINT_INSTRUMENT, false); InvalidateRect(NULL, FALSE); } @@ -975,18 +975,23 @@ // Set instrument (and moddoc) as modified. -void CCtrlInstruments::SetInstrumentModified(const bool modified) -//--------------------------------------------------------------- +// updateAll: Update all views including this one. Otherwise, only update update other views. +void CCtrlInstruments::SetModified(DWORD mask, bool updateAll, bool modified) +//--------------------------------------------------------------------------- { -// -> CODE#0023 -// -> DESC="IT project files (.itp)" - m_modDoc.m_bsInstrumentModified.set(m_nInstrument - 1, modified); - m_modDoc.UpdateAllViews(NULL, (m_nInstrument << HINT_SHIFT_INS) | HINT_INSNAMES, this); -// -! NEW_FEATURE#0023 - if(modified) + // -> CODE#0023 + // -> DESC="IT project files (.itp)" + if(m_modDoc.GetrSoundFile().m_SongFlags[SONG_ITPROJECT]) { - m_modDoc.SetModified(); + if(m_modDoc.m_bsInstrumentModified[m_nInstrument - 1] != modified) + { + m_modDoc.m_bsInstrumentModified.set(m_nInstrument - 1, modified); + mask |= HINT_INSNAMES; + } } + m_modDoc.UpdateAllViews(NULL, (m_nInstrument << HINT_SHIFT_INS) | mask, updateAll ? nullptr : this); + // -! NEW_FEATURE#0023 + if(modified) m_modDoc.SetModified(); } @@ -1431,12 +1436,8 @@ if (!m_nInstrument) m_nInstrument = 1; if (m_sndFile.ReadInstrumentFromFile(m_nInstrument, file, TrackerSettings::Instance().m_MayNormalizeSamplesOnLoad)) { - m_modDoc.UpdateAllViews(NULL, HINT_SAMPLEINFO | HINT_MODTYPE, NULL); - // -> CODE#0023 - // -> DESC="IT project files (.itp)" m_sndFile.m_szInstrumentPath[m_nInstrument - 1] = fileName; - SetInstrumentModified(false); - // -! NEW_FEATURE#0023 + SetModified(HINT_SAMPLEINFO | HINT_MODTYPE, true, false); bOk = TRUE; } } @@ -1770,23 +1771,15 @@ else ok = m_sndFile.SaveITIInstrument(m_nInstrument, dlg.GetFirstFile(), index == (m_sndFile.GetType() == MOD_TYPE_XM ? 3 : 2)); -// -> CODE#0023 -// -> DESC="IT project files (.itp)" m_sndFile.m_szInstrumentPath[m_nInstrument - 1] = dlg.GetFirstFile(); - SetInstrumentModified(false); -// -! NEW_FEATURE#0023 + SetModified(HINT_MODTYPE | HINT_INSNAMES, true, false); + m_modDoc.UpdateAllViews(nullptr, HINT_SMPNAMES, this); EndWaitCursor(); - if (!ok) ErrorBox(IDS_ERR_SAVEINS, this); else - { + if (!ok) + ErrorBox(IDS_ERR_SAVEINS, this); + else TrackerDirectories::Instance().SetWorkingDirectory(dlg.GetWorkingDirectory(), DIR_INSTRUMENTS); - -// -> CODE#0023 -// -> DESC="IT project files (.itp)" -// m_pModDoc.UpdateAllViews(NULL, (m_nInstrument << 24) | HINT_INSTRUMENT); - m_modDoc.UpdateAllViews(NULL, HINT_MODTYPE | HINT_INSNAMES | HINT_SMPNAMES); -// -! NEW_FEATURE#0023 - } SwitchToView(); } @@ -1817,7 +1810,7 @@ if ((pIns) && (strncmp(s, pIns->name, MAX_INSTRUMENTNAME))) { mpt::String::Copy(pIns->name, s); - SetInstrumentModified(true); + SetModified(HINT_INSNAMES, false); } } } @@ -1835,7 +1828,7 @@ if ((pIns) && (strncmp(s, pIns->filename, 12))) { mpt::String::Copy(pIns->filename, s); - SetInstrumentModified(true); + SetModified(HINT_INSNAMES, false); } } } @@ -1855,7 +1848,7 @@ if(nVol != (int)pIns->nFadeOut) { pIns->nFadeOut = nVol; - SetInstrumentModified(true); + SetModified(HINT_INSTRUMENT, false); } } } @@ -1872,7 +1865,7 @@ if (nVol != (int)pIns->nGlobalVol) { pIns->nGlobalVol = nVol; - SetInstrumentModified(true); + SetModified(HINT_INSTRUMENT, false); } } } @@ -1916,11 +1909,11 @@ if(smp > 0 && smp <= m_sndFile.GetNumSamples()) m_sndFile.GetSample(smp).uFlags &= ~CHN_PANNING; } - m_modDoc.UpdateAllViews(NULL, HINT_SAMPLEINFO | HINT_MODTYPE); + m_modDoc.UpdateAllViews(NULL, HINT_SAMPLEINFO | HINT_MODTYPE, this); } } } - SetInstrumentModified(true); + SetModified(HINT_INSTRUMENT, false); } } @@ -1939,7 +1932,7 @@ if (nPan != (int)pIns->nPan) { pIns->nPan = nPan; - SetInstrumentModified(true); + SetModified(HINT_INSTRUMENT, false); } } } @@ -1954,12 +1947,12 @@ if (pIns->nNNA != m_ComboNNA.GetCurSel()) { pIns->nNNA = m_ComboNNA.GetCurSel(); - SetInstrumentModified(true); - } + SetModified(HINT_INSTRUMENT, false); + } } } - - + + void CCtrlInstruments::OnDCTChanged() //----------------------------------- { @@ -1969,12 +1962,12 @@ if (pIns->nDCT != m_ComboDCT.GetCurSel()) { pIns->nDCT = m_ComboDCT.GetCurSel(); - SetInstrumentModified(true); + SetModified(HINT_INSTRUMENT, false); } } } - + void CCtrlInstruments::OnDCAChanged() //----------------------------------- { @@ -1984,7 +1977,7 @@ if (pIns->nDNA != m_ComboDCA.GetCurSel()) { pIns->nDNA = m_ComboDCA.GetCurSel(); - SetInstrumentModified(true); + SetModified(HINT_INSTRUMENT, false); } } } @@ -2002,7 +1995,7 @@ if (pIns->nMidiProgram != n) { pIns->nMidiProgram = n; - SetInstrumentModified(true); + SetModified(HINT_INSTRUMENT, false); } } //rewbs.MidiBank: we will not set the midi bank/program if it is 0 @@ -2027,7 +2020,7 @@ if(w >= 0 && w <= 16384 && pIns->wMidiBank != w) { pIns->wMidiBank = w; - SetInstrumentModified(true); + SetModified(HINT_INSTRUMENT, false); } //rewbs.MidiBank: we will not set the midi bank/program if it is 0 if(w == 0) @@ -2051,7 +2044,7 @@ if(pIns->nMidiChannel != ch) { pIns->nMidiChannel = ch; - SetInstrumentModified(true); + SetModified(HINT_INSTRUMENT, false); } } } @@ -2066,8 +2059,7 @@ if (pIns->nResampling != (BYTE)(n & 0xff)) { pIns->nResampling = (BYTE)(n & 0xff); - SetInstrumentModified(true); - m_modDoc.UpdateAllViews(NULL, HINT_INSNAMES, this); + SetModified(HINT_INSTRUMENT, false); } } } @@ -2094,7 +2086,7 @@ if ((!IsLocked()) && pIns->nMixPlug != nPlug) { pIns->nMixPlug = nPlug; - SetInstrumentModified(true); + SetModified(HINT_INSTRUMENT, false); m_modDoc.UpdateAllViews(NULL, HINT_MIXPLUGINS, this); } @@ -2184,7 +2176,7 @@ if (pIns->nPPS != (signed char)n) { pIns->nPPS = (signed char)n; - SetInstrumentModified(true); + SetModified(HINT_INSTRUMENT, false); } } } @@ -2204,7 +2196,7 @@ if(pIns->nVolRampUp != newRamp) { pIns->nVolRampUp = newRamp; - SetInstrumentModified(true); + SetModified(HINT_INSTRUMENT, false); } m_SliderAttack.SetPos(n); @@ -2229,7 +2221,7 @@ if (pIns->nPPC != n) { pIns->nPPC = n; - SetInstrumentModified(true); + SetModified(HINT_INSTRUMENT, false); } } } @@ -2260,7 +2252,7 @@ } } UpdateFilterText(); - SetInstrumentModified(true); + SetModified(HINT_INSTRUMENT, false); SwitchToView(); } @@ -2289,7 +2281,7 @@ } } UpdateFilterText(); - SetInstrumentModified(true); + SetModified(HINT_INSTRUMENT, false); SwitchToView(); } @@ -2355,7 +2347,7 @@ { pIns->nVolRampUp = newRamp; SetDlgItemInt(IDC_EDIT2,n); - SetInstrumentModified(true); + SetModified(HINT_INSTRUMENT, false); } // -! NEW_FEATURE#0027 } @@ -2365,8 +2357,8 @@ n = m_SliderVolSwing.GetPos(); if ((n >= 0) && (n <= 100) && (n != (int)pIns->nVolSwing)) { - pIns->nVolSwing = (BYTE)n; - SetInstrumentModified(true); + pIns->nVolSwing = (uint8)n; + SetModified(HINT_INSTRUMENT, false); } } // Pan Swing @@ -2375,8 +2367,8 @@ n = m_SliderPanSwing.GetPos(); if ((n >= 0) && (n <= 64) && (n != (int)pIns->nPanSwing)) { - pIns->nPanSwing = (BYTE)n; - SetInstrumentModified(true); + pIns->nPanSwing = (uint8)n; + SetModified(HINT_INSTRUMENT, false); } } //Cutoff swing @@ -2385,8 +2377,8 @@ n = m_SliderCutSwing.GetPos(); if ((n >= 0) && (n <= 64) && (n != (int)pIns->nCutSwing)) { - pIns->nCutSwing = (BYTE)n; - SetInstrumentModified(true); + pIns->nCutSwing = (uint8)n; + SetModified(HINT_INSTRUMENT, false); } } //Resonance swing @@ -2395,8 +2387,8 @@ n = m_SliderResSwing.GetPos(); if ((n >= 0) && (n <= 64) && (n != (int)pIns->nResSwing)) { - pIns->nResSwing = (BYTE)n; - SetInstrumentModified(true); + pIns->nResSwing = (uint8)n; + SetModified(HINT_INSTRUMENT, false); } } // Filter CutOff @@ -2406,7 +2398,7 @@ if ((n >= 0) && (n < 0x80) && (n != (int)(pIns->GetCutoff()))) { pIns->SetCutoff(n, pIns->IsCutoffEnabled()); - SetInstrumentModified(true); + SetModified(HINT_INSTRUMENT, false); UpdateFilterText(); filterChanger = true; } @@ -2418,7 +2410,7 @@ if ((n >= 0) && (n < 0x80) && (n != (int)(pIns->GetResonance()))) { pIns->SetResonance(n, pIns->IsResonanceEnabled()); - SetInstrumentModified(true); + SetModified(HINT_INSTRUMENT, false); UpdateFilterText(); filterChanger = true; } @@ -2672,7 +2664,7 @@ } pIns->nPluginVelocityHandling = n; - SetInstrumentModified(true); + SetModified(HINT_INSTRUMENT, false); } } } @@ -2695,7 +2687,7 @@ } pIns->nPluginVolumeHandling = n; - SetInstrumentModified(true); + SetModified(HINT_INSTRUMENT, false); } } } @@ -2715,7 +2707,7 @@ if(pwd != pIns->midiPWD) { pIns->midiPWD = static_cast<int8>(pwd); - SetInstrumentModified(true); + SetModified(HINT_INSTRUMENT, false); } } } Modified: trunk/OpenMPT/mptrack/Ctrl_ins.h =================================================================== --- trunk/OpenMPT/mptrack/Ctrl_ins.h 2014-04-02 15:01:53 UTC (rev 4002) +++ trunk/OpenMPT/mptrack/Ctrl_ins.h 2014-04-02 19:26:35 UTC (rev 4003) @@ -120,7 +120,7 @@ virtual ~CCtrlInstruments(); public: - void SetInstrumentModified(const bool modified = true); + void SetModified(DWORD 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); Modified: trunk/OpenMPT/mptrack/View_ins.cpp =================================================================== --- trunk/OpenMPT/mptrack/View_ins.cpp 2014-04-02 15:01:53 UTC (rev 4002) +++ trunk/OpenMPT/mptrack/View_ins.cpp 2014-04-02 19:26:35 UTC (rev 4003) @@ -177,15 +177,16 @@ // Set instrument (and moddoc) as modified. -void CViewInstrument::SetInstrumentModified() -//------------------------------------------- +// updateAll: Update all views including this one. Otherwise, only update update other views. +void CViewInstrument::SetModified(DWORD mask, bool updateAll) +//----------------------------------------------------------- { CModDoc *pModDoc = GetDocument(); if(pModDoc == nullptr) return; // -> CODE#0023 // -> DESC="IT project files (.itp)" pModDoc->m_bsInstrumentModified.set(m_nInstrument - 1, true); - pModDoc->UpdateAllViews(NULL, (m_nInstrument << HINT_SHIFT_INS) | HINT_INSNAMES, this); + pModDoc->UpdateAllViews(NULL, (m_nInstrument << HINT_SHIFT_INS) | HINT_INSNAMES | mask, updateAll ? nullptr : this); // -! NEW_FEATURE#0023 pModDoc->SetModified(); } @@ -772,9 +773,13 @@ //////////////////////////////////////////////////////////////////// // CViewInstrument drawing -void CViewInstrument::UpdateView(DWORD dwHintMask, CObject *) -//----------------------------------------------------------- +void CViewInstrument::UpdateView(DWORD dwHintMask, CObject *hint) +//--------------------------------------------------------------- { + if(hint == this) + { + return; + } const INSTRUMENTINDEX updateIns = (dwHintMask >> HINT_SHIFT_INS); if((dwHintMask & (HINT_MPTOPTIONS | HINT_MODTYPE)) || ((dwHintMask & HINT_ENVELOPE) && (m_nInstrument == updateIns || updateIns == 0)) @@ -1044,8 +1049,7 @@ envelope->nReleaseNode = ENV_RELEASE_NODE_UNSET; } - SetInstrumentModified(); - pModDoc->UpdateAllViews(NULL, (m_nInstrument << HINT_SHIFT_INS) | HINT_ENVELOPE, NULL); + SetModified(HINT_ENVELOPE, true); return true; } } @@ -1119,8 +1123,7 @@ if (envelope->nSustainEnd >= i) envelope->nSustainEnd++; if (envelope->nReleaseNode >= i && envelope->nReleaseNode != ENV_RELEASE_NODE_UNSET) envelope->nReleaseNode++; - SetInstrumentModified(); - pModDoc->UpdateAllViews(NULL, (m_nInstrument << HINT_SHIFT_INS) | HINT_ENVELOPE, NULL); + SetModified(HINT_ENVELOPE, true); return i + 1; } } @@ -1517,8 +1520,7 @@ CModDoc *pModDoc = GetDocument(); if(pModDoc) { - SetInstrumentModified(); - pModDoc->UpdateAllViews(NULL, (m_nInstrument << HINT_SHIFT_INS) | HINT_ENVELOPE, NULL); + SetModified(HINT_ENVELOPE, true); } UpdateWindow(); //rewbs: TODO - optimisation here so we don't redraw whole view. } @@ -1776,9 +1778,7 @@ pEnv->nLoopStart = 0; pEnv->nLoopEnd = static_cast<uint8>(pEnv->nNodes - 1); } - SetInstrumentModified(); - pModDoc->UpdateAllViews(NULL, (m_nInstrument << HINT_SHIFT_INS) | HINT_ENVELOPE, NULL); - UpdateNcButtonState(); + SetModified(HINT_ENVELOPE, true); } } @@ -1795,9 +1795,7 @@ // Enabled sustain loop => set sustain loop points if no sustain loop has been specified yet. pEnv->nSustainStart = pEnv->nSustainEnd = static_cast<uint8>(m_nDragItem - 1); } - SetInstrumentModified(); - pModDoc->UpdateAllViews(NULL, (m_nInstrument << HINT_SHIFT_INS) | HINT_ENVELOPE, NULL); - UpdateNcButtonState(); + SetModified(HINT_ENVELOPE, true); } } @@ -1808,8 +1806,7 @@ CModDoc *pModDoc = GetDocument(); if ((pModDoc) && (EnvSetCarry(!EnvGetCarry()))) { - SetInstrumentModified(); - UpdateNcButtonState(); + SetModified(HINT_ENVELOPE, false); } } @@ -1818,8 +1815,7 @@ { if(IsDragItemEnvPoint() && EnvToggleReleaseNode(m_nDragItem - 1)) { - SetInstrumentModified(); - InvalidateRect(NULL, FALSE); + SetModified(HINT_ENVELOPE, true); } } @@ -1829,8 +1825,7 @@ { if (EnvSetVolEnv(!EnvGetVolEnv())) { - SetInstrumentModified(); - UpdateNcButtonState(); + SetModified(HINT_ENVELOPE, false); } } @@ -1840,8 +1835,7 @@ { if (EnvSetPanEnv(!EnvGetPanEnv())) { - SetInstrumentModified(); - UpdateNcButtonState(); + SetModified(HINT_ENVELOPE, false); } } @@ -1851,8 +1845,7 @@ { if (EnvSetPitchEnv(!EnvGetPitchEnv())) { - SetInstrumentModified(); - UpdateNcButtonState(); + SetModified(HINT_ENVELOPE, false); } } @@ -1862,8 +1855,7 @@ { if (EnvSetFilterEnv(!EnvGetFilterEnv())) { - SetInstrumentModified(); - UpdateNcButtonState(); + SetModified(HINT_ENVELOPE, false); } } @@ -1873,10 +1865,10 @@ { m_bGrid = !m_bGrid; if (m_bGrid) - m_bGridForceRedraw; + m_bGridForceRedraw = true; CModDoc *pModDoc = GetDocument(); if (pModDoc) - pModDoc->UpdateAllViews(NULL, (m_nInstrument << HINT_SHIFT_INS) | HINT_ENVELOPE, NULL); + pModDoc->UpdateAllViews(NULL, (m_nInstrument << HINT_SHIFT_INS) | HINT_ENVELOPE); } //end rewbs.envRowGrid @@ -2122,8 +2114,7 @@ } if (bUpdate) { - SetInstrumentModified(); - pModDoc->UpdateAllViews(NULL, (m_nInstrument << HINT_SHIFT_INS) | HINT_INSTRUMENT | HINT_ENVELOPE | HINT_INSNAMES, NULL); + SetModified(HINT_INSTRUMENT | HINT_ENVELOPE | HINT_INSNAMES, true); } CMDIChildWnd *pMDIFrame = (CMDIChildWnd *)GetParentFrame(); if (pMDIFrame) @@ -2254,8 +2245,7 @@ CScaleEnvPointsDlg dlg(this, *GetEnvelopePtr(), nOffset); if(dlg.DoModal() == IDOK) { - SetInstrumentModified(); - pModDoc->UpdateAllViews(NULL, (m_nInstrument << HINT_SHIFT_INS) | HINT_ENVELOPE, NULL); + SetModified(HINT_ENVELOPE, true); } } } @@ -2310,8 +2300,7 @@ return; pEnv->Ticks[m_nDragItem - 1]--; - SetInstrumentModified(); - InvalidateRect(NULL, FALSE); + SetModified(HINT_ENVELOPE, true); } @@ -2324,8 +2313,7 @@ return; pEnv->Ticks[m_nDragItem - 1]++; - SetInstrumentModified(); - InvalidateRect(NULL, FALSE); + SetModified(HINT_ENVELOPE, true); } @@ -2339,8 +2327,7 @@ else pEnv->Values[m_nDragItem - 1] = ENVELOPE_MAX; - SetInstrumentModified(); - InvalidateRect(NULL, FALSE); + SetModified(HINT_ENVELOPE, true); } @@ -2354,8 +2341,7 @@ else pEnv->Values[m_nDragItem - 1] = ENVELOPE_MIN; - SetInstrumentModified(); - InvalidateRect(NULL, FALSE); + SetModified(HINT_ENVELOPE, true); } void CViewInstrument::EnvKbdInsertPoint() @@ -2450,8 +2436,7 @@ if(EnvToggleReleaseNode(m_nDragItem - 1)) { CModDoc *pModDoc = GetDocument(); // sanity checks are done in GetEnvelopePtr() already - SetInstrumentModified(); - pModDoc->UpdateAllViews(NULL, (m_nInstrument << HINT_SHIFT_INS) | HINT_ENVELOPE, NULL); + SetModified(HINT_ENVELOPE, true); } } Modified: trunk/OpenMPT/mptrack/View_ins.h =================================================================== --- trunk/OpenMPT/mptrack/View_ins.h 2014-04-02 15:01:53 UTC (rev 4002) +++ trunk/OpenMPT/mptrack/View_ins.h 2014-04-02 19:26:35 UTC (rev 4003) @@ -131,7 +131,7 @@ //////////////////////// // Misc stuff void UpdateScrollSize(); - void SetInstrumentModified(); + void SetModified(DWORD mask, bool updateAll); BOOL SetCurrentInstrument(INSTRUMENTINDEX nIns, enmEnvelopeTypes m_nEnv = ENV_VOLUME); ModInstrument *GetInstrumentPtr() const; InstrumentEnvelope *GetEnvelopePtr() const; Modified: trunk/OpenMPT/mptrack/View_pat.cpp =================================================================== --- trunk/OpenMPT/mptrack/View_pat.cpp 2014-04-02 15:01:53 UTC (rev 4002) +++ trunk/OpenMPT/mptrack/View_pat.cpp 2014-04-02 19:26:35 UTC (rev 4003) @@ -3856,6 +3856,7 @@ if(!liveRecord) InvalidateRow(editpos.row); pMainFrm->ThreadSafeSetModified(pModDoc); + pModDoc->UpdateAllViews(this, HINT_PATTERNDATA | (editpos.pattern << HINT_SHIFT_PAT), this); } if(captured) @@ -3920,13 +3921,14 @@ m.command = CMD_SMOOTHMIDI; m.param = nByte2; pMainFrm->ThreadSafeSetModified(pModDoc); + pModDoc->UpdateAllViews(this, HINT_PATTERNDATA | (editpos.pattern << HINT_SHIFT_PAT), this); // Update GUI only if not recording live. if(!liveRecord) InvalidateRow(editpos.row); } } - + MPT_FALLTHROUGH; default: if(event == MIDIEvents::evSystem && TrackerSettings::Instance().m_dwMidiSetup & MIDISETUP_RESPONDTOPLAYCONTROLMSGS) { Modified: trunk/OpenMPT/mptrack/View_smp.cpp =================================================================== --- trunk/OpenMPT/mptrack/View_smp.cpp 2014-04-02 15:01:53 UTC (rev 4002) +++ trunk/OpenMPT/mptrack/View_smp.cpp 2014-04-02 19:26:35 UTC (rev 4003) @@ -162,6 +162,16 @@ } +// updateAll: Update all views including this one. Otherwise, only update update other views. +void CViewSample::SetModified(DWORD mask, bool updateAll) +//------------------------------------------------------- +{ + CModDoc *pModDoc = GetDocument(); + pModDoc->SetModified(); + pModDoc->UpdateAllViews(nullptr, mask | (m_nSample << HINT_SHIFT_SMP), updateAll ? nullptr : this); +} + + void CViewSample::UpdateScrollSize(int newZoom, bool forceRefresh, SmpLength centeredSample) //------------------------------------------------------------------------------------------ { @@ -495,9 +505,13 @@ /////////////////////////////////////////////////////////////// // CViewSample drawing -void CViewSample::UpdateView(DWORD dwHintMask, CObject *) -//------------------------------------------------------- +void CViewSample::UpdateView(DWORD dwHintMask, CObject *hint) +//----------------------------------------------------------- { + if(hint == this) + { + return; + } const SAMPLEINDEX updateSmp = (dwHintMask >> HINT_SHIFT_SMP); if((dwHintMask & (HINT_MPTOPTIONS | HINT_MODTYPE)) || ((dwHintMask & HINT_SAMPLEDATA) && (m_nSample == updateSmp || updateSmp == 0))) @@ -1605,7 +1619,7 @@ sndFile.GetSample(m_nSample).PrecomputeLoops(sndFile, false); InvalidateSample(); - pModDoc->SetModified(); + SetModified(HINT_SAMPLEDATA, false); } } else if (old != m_dwEndDrag) @@ -1660,7 +1674,7 @@ sndFile.GetSample(m_nSample).PrecomputeLoops(sndFile, false); InvalidateSample(); - pModDoc->SetModified(); + SetModified(HINT_SAMPLEDATA, false); } else { // ctrl + click = play from cursor pos @@ -1913,8 +1927,7 @@ if ((sample.nLoopStart != m_dwBeginSel) || (sample.nLoopEnd != m_dwEndSel)) { sample.SetLoop(m_dwBeginSel, m_dwEndSel, true, sample.uFlags[CHN_PINGPONGLOOP], sndFile); - pModDoc->SetModified(); - pModDoc->UpdateAllViews(NULL, (m_nSample << HINT_SHIFT_SMP) | HINT_SAMPLEINFO | HINT_SAMPLEDATA, NULL); + SetModified(HINT_SAMPLEINFO | HINT_SAMPLEDATA, true); } } } @@ -1934,8 +1947,7 @@ if ((sample.nSustainStart != m_dwBeginSel) || (sample.nSustainEnd != m_dwEndSel)) { sample.SetSustainLoop(m_dwBeginSel, m_dwEndSel, true, sample.uFlags[CHN_PINGPONGSUSTAIN], sndFile); - pModDoc->SetModified(); - pModDoc->UpdateAllViews(NULL, (m_nSample << HINT_SHIFT_SMP) | HINT_SAMPLEINFO | HINT_SAMPLEDATA, NULL); + SetModified(HINT_SAMPLEINFO | HINT_SAMPLEDATA, true); } } } @@ -2037,8 +2049,7 @@ sample.PrecomputeLoops(sndFile); } SetCurSel(0, 0); - pModDoc->SetModified(); - pModDoc->UpdateAllViews(NULL, (m_nSample << HINT_SHIFT_SMP) | dwUpdateFlags, NULL); + SetModified(dwUpdateFlags, false); } @@ -2176,8 +2187,7 @@ GlobalUnlock(hCpy); SetCurSel(0, 0); sample.PrecomputeLoops(sndFile, true); - pModDoc->SetModified(); - pModDoc->UpdateAllViews(NULL, (m_nSample << HINT_SHIFT_SMP) | HINT_SAMPLEINFO | HINT_SAMPLEDATA | HINT_SMPNAMES, NULL); + SetModified(HINT_SAMPLEINFO | HINT_SAMPLEDATA | HINT_SMPNAMES, true); } CloseClipboard(); } @@ -2191,7 +2201,9 @@ CModDoc *pModDoc = GetDocument(); if(pModDoc == nullptr) return; if(pModDoc->GetSampleUndo().Undo(m_nSample)) - pModDoc->UpdateAllViews(NULL, (m_nSample << HINT_SHIFT_SMP) | HINT_SAMPLEINFO | HINT_SAMPLEDATA, NULL); + { + SetModified(HINT_SAMPLEINFO | HINT_SAMPLEDATA | HINT_SMPNAMES, true); + } } @@ -2201,7 +2213,9 @@ CModDoc *pModDoc = GetDocument(); if(pModDoc == nullptr) return; if(pModDoc->GetSampleUndo().Redo(m_nSample)) - pModDoc->UpdateAllViews(NULL, (m_nSample << HINT_SHIFT_SMP) | HINT_SAMPLEINFO | HINT_SAMPLEDATA, NULL); + { + SetModified(HINT_SAMPLEINFO | HINT_SAMPLEDATA | HINT_SMPNAMES, true); + } } @@ -2235,8 +2249,7 @@ sample.PrecomputeLoops(sndFile, false); cs.Leave(); - pModDoc->SetModified(); - pModDoc->UpdateAllViews(NULL, (m_nSample << HINT_SHIFT_SMP) | HINT_SAMPLEDATA | HINT_SAMPLEINFO, NULL); + SetModified(HINT_SAMPLEDATA | HINT_SAMPLEINFO, true); } } EndWaitCursor(); @@ -2304,8 +2317,7 @@ right.nPan = 256; } } - pModDoc->SetModified(); - pModDoc->UpdateAllViews(NULL, (m_nSample << HINT_SHIFT_SMP) | HINT_SAMPLEDATA | HINT_SAMPLEINFO | HINT_SMPNAMES | HINT_INSNAMES, NULL); + SetModified(HINT_SAMPLEDATA | HINT_SAMPLEINFO, true); } else { pModDoc->GetSampleUndo().RemoveLastUndoStep(m_nSample); @@ -2359,9 +2371,8 @@ sample.PrecomputeLoops(sndFile); cs.Leave(); - pModDoc->SetModified(); SetCurSel(0, 0); - pModDoc->UpdateAllViews(NULL, (m_nSample << HINT_SHIFT_SMP) | HINT_SAMPLEDATA | HINT_SAMPLEINFO, NULL); + SetModified(HINT_SAMPLEDATA | HINT_SAMPLEINFO, true); } EndWaitCursor(); } @@ -2560,8 +2571,7 @@ } if (bUpdate) { - pModDoc->UpdateAllViews(NULL, (m_nSample << HINT_SHIFT_SMP) | HINT_SAMPLEDATA | HINT_SAMPLEINFO | HINT_SMPNAMES, NULL); - pModDoc->SetModified(); + SetModified(HINT_SAMPLEDATA | HINT_SAMPLEINFO | HINT_SMPNAMES, true); } CMDIChildWnd *pMDIFrame = (CMDIChildWnd *)GetParentFrame(); if (pMDIFrame) @@ -2628,8 +2638,7 @@ { pModDoc->GetSampleUndo().PrepareUndo(m_nSample, sundo_none, "Set Loop Start"); sample.SetLoop(m_dwMenuParam, sample.nLoopEnd, true, sample.uFlags[CHN_PINGPONGLOOP], sndFile); - pModDoc->SetModified(); - pModDoc->UpdateAllViews(NULL, (m_nSample << HINT_SHIFT_SMP) | HINT_SAMPLEINFO | HINT_SAMPLEDATA, NULL); + SetModified(HINT_SAMPLEDATA | HINT_SAMPLEINFO, true); } } } @@ -2647,8 +2656,7 @@ { pModDoc->GetSampleUndo().PrepareUndo(m_nSample, sundo_none, "Set Loop End"); sample.SetLoop(sample.nLoopStart, m_dwMenuParam, true, sample.uFlags[CHN_PINGPONGLOOP], sndFile); - pModDoc->SetModified(); - pModDoc->UpdateAllViews(NULL, (m_nSample << HINT_SHIFT_SMP) | HINT_SAMPLEINFO | HINT_SAMPLEDATA, NULL); + SetModified(HINT_SAMPLEDATA | HINT_SAMPLEINFO, true); } } } @@ -2666,8 +2674,7 @@ { pModDoc->GetSampleUndo().PrepareUndo(m_nSample, sundo_none, "Set Sustain Start"); sample.SetSustainLoop(m_dwMenuParam, sample.nSustainEnd, true, sample.uFlags[CHN_PINGPONGSUSTAIN], sndFile); - pModDoc->SetModified(); - pModDoc->UpdateAllViews(NULL, (m_nSample << HINT_SHIFT_SMP) | HINT_SAMPLEINFO | HINT_SAMPLEDATA, NULL); + SetModified(HINT_SAMPLEDATA | HINT_SAMPLEINFO, true); } } } @@ -2685,8 +2692,7 @@ { pModDoc->GetSampleUndo().PrepareUndo(m_nSample, sundo_none, "Set Sustain End"); sample.SetSustainLoop(sample.nSustainStart, m_dwMenuParam, true, sample.uFlags[CHN_PINGPONGSUSTAIN], sndFile); - pModDoc->SetModified(); - pModDoc->UpdateAllViews(NULL, (m_nSample << HINT_SHIFT_SMP) | HINT_SAMPLEINFO | HINT_SAMPLEDATA, NULL); + SetModified(HINT_SAMPLEDATA | HINT_SAMPLEINFO, true); } } } @@ -2782,8 +2788,7 @@ if(nOldLength != sample.nLength) { SetCurSel(0, 0); - pModDoc->SetModified(); - pModDoc->UpdateAllViews(NULL, (m_nSample << HINT_SHIFT_SMP) | HINT_SAMPLEINFO | HINT_SAMPLEDATA | HINT_SMPNAMES, NULL); + SetModified(HINT_SAMPLEDATA | HINT_SAMPLEINFO, true); } } Modified: trunk/OpenMPT/mptrack/View_smp.h =================================================================== --- trunk/OpenMPT/mptrack/View_smp.h 2014-04-02 15:01:53 UTC (rev 4002) +++ trunk/OpenMPT/mptrack/View_smp.h 2014-04-02 19:26:35 UTC (rev 4003) @@ -57,6 +57,7 @@ DECLARE_SERIAL(CViewSample) protected: + void SetModified(DWORD mask, bool updateAll); void UpdateScrollSize() { UpdateScrollSize(m_nZoom, true); } void UpdateScrollSize(int newZoom, bool forceRefresh, SmpLength centeredSample = SmpLength(-1)); BOOL SetCurrentSample(SAMPLEINDEX nSmp); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |