Skip to content

Commit

Permalink
[Ref] Don't include WindowMessages.h in headers.
Browse files Browse the repository at this point in the history
git-svn-id: https://source.openmpt.org/svn/openmpt/trunk/OpenMPT@22260 56274372-70c3-4bfc-bfc3-4c3a0b034d27
  • Loading branch information
sagamusix committed Nov 21, 2024
1 parent 8256f80 commit 05ecf0d
Show file tree
Hide file tree
Showing 14 changed files with 68 additions and 36 deletions.
1 change: 1 addition & 0 deletions mptrack/AbstractVstEditor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
#include "resource.h"
#include "VstPresets.h"
#include "Vstplug.h"
#include "WindowMessages.h"
#include "../common/FileReader.h"
#include "../common/mptStringBuffer.h"
#include "../soundlib/Sndfile.h"
Expand Down
4 changes: 4 additions & 0 deletions mptrack/Childfrm.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
#include "View_ins.h"
#include "View_pat.h"
#include "View_smp.h"
#include "WindowMessages.h"
#include "../common/FileReader.h"
#include "mpt/io/io.hpp"
#include "mpt/io/io_stdstream.hpp"
Expand Down Expand Up @@ -338,6 +339,9 @@ LRESULT CChildFrame::SendViewMessage(UINT uMsg, LPARAM lParam) const
}


LRESULT CChildFrame::ActivateView(UINT nId, LPARAM lParam) { return ::SendMessage(m_hWndCtrl, WM_MOD_ACTIVATEVIEW, nId, lParam); }


LRESULT CChildFrame::OnInstrumentSelected(WPARAM wParam, LPARAM lParam)
{
CView *pView = GetActiveView();
Expand Down
3 changes: 1 addition & 2 deletions mptrack/Childfrm.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
#include "openmpt/all/BuildSettings.hpp"

#include "PatternCursor.h"
#include "WindowMessages.h"

#include "../common/FileReaderFwd.h"
#include "../soundlib/plugins/PluginStructs.h"
Expand Down Expand Up @@ -120,7 +119,7 @@ class CChildFrame: public CMDIChildWnd
const char *GetCurrentViewClassName() const;
LRESULT SendCtrlMessage(UINT uMsg, LPARAM lParam = 0) const;
LRESULT SendViewMessage(UINT uMsg, LPARAM lParam = 0) const;
LRESULT ActivateView(UINT nId, LPARAM lParam) { return ::SendMessage(m_hWndCtrl, WM_MOD_ACTIVATEVIEW, nId, lParam); }
LRESULT ActivateView(UINT nId, LPARAM lParam);
HWND GetHwndCtrl() const { return m_hWndCtrl; }
HWND GetHwndView() const { return m_hWndView; }
GeneralViewState &GetGeneralViewState() { return m_ViewGeneral; }
Expand Down
5 changes: 3 additions & 2 deletions mptrack/Ctrl_com.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ BOOL CCtrlComments::OnInitDialog()
UpdateView(CommentHint().ModType());
m_EditComments.SetFocus();
m_EditComments.FmtLines(FALSE);
m_bInitialized = TRUE;
m_initialized = true;
return FALSE;
}

Expand Down Expand Up @@ -333,7 +333,8 @@ void CCtrlComments::OnCommentsChanged()
{
if(m_nLockCount)
return;
if ((!m_bInitialized) || (!m_EditComments.m_hWnd) || (!m_EditComments.GetModify())) return;
if(!m_initialized || !m_EditComments.m_hWnd || !m_EditComments.GetModify())
return;
CString text;
m_EditComments.GetWindowText(text);
m_EditComments.SetModify(FALSE);
Expand Down
18 changes: 9 additions & 9 deletions mptrack/Ctrl_gen.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ BOOL CCtrlGeneral::OnInitDialog()
m_editsLocked = false;
UpdateView(GeneralHint().ModType());
OnActivatePage(0);
m_bInitialized = TRUE;
m_initialized = true;

return FALSE;
}
Expand Down Expand Up @@ -403,7 +403,7 @@ void CCtrlGeneral::OnVScroll(UINT code, UINT pos, CScrollBar *pscroll)
{
CModControlDlg::OnVScroll(code, pos, pscroll);

if (m_bInitialized)
if (m_initialized)
{
CSliderCtrl* pSlider = (CSliderCtrl*) pscroll;

Expand Down Expand Up @@ -521,7 +521,7 @@ void CCtrlGeneral::OnArtistChanged()

void CCtrlGeneral::OnTempoChanged()
{
if (m_bInitialized && m_EditTempo.GetWindowTextLength() > 0 && !IsLocked())
if (m_initialized && m_EditTempo.GetWindowTextLength() > 0 && !IsLocked())
{
TEMPO tempo = m_EditTempo.GetTempoValue();
Limit(tempo, m_tempoMin, m_tempoMax);
Expand All @@ -543,7 +543,7 @@ void CCtrlGeneral::OnTempoChanged()
void CCtrlGeneral::OnSpeedChanged()
{
TCHAR s[16];
if(m_bInitialized)
if(m_initialized)
{
m_EditSpeed.GetWindowText(s, mpt::saturate_cast<int>(std::size(s)));
if (s[0])
Expand All @@ -570,7 +570,7 @@ void CCtrlGeneral::OnSpeedChanged()
void CCtrlGeneral::OnVSTiVolChanged()
{
TCHAR s[16];
if (m_bInitialized)
if (m_initialized)
{
m_EditVSTiVol.GetWindowText(s, mpt::saturate_cast<int>(std::size(s)));
if (s[0])
Expand All @@ -594,7 +594,7 @@ void CCtrlGeneral::OnVSTiVolChanged()
void CCtrlGeneral::OnSamplePAChanged()
{
TCHAR s[16];
if(m_bInitialized)
if(m_initialized)
{
m_EditSamplePA.GetWindowText(s, mpt::saturate_cast<int>(std::size(s)));
if (s[0])
Expand All @@ -617,7 +617,7 @@ void CCtrlGeneral::OnSamplePAChanged()
void CCtrlGeneral::OnGlobalVolChanged()
{
TCHAR s[16];
if(m_bInitialized)
if(m_initialized)
{
m_EditGlobalVol.GetWindowText(s, mpt::saturate_cast<int>(std::size(s)));
if (s[0])
Expand All @@ -642,7 +642,7 @@ void CCtrlGeneral::OnGlobalVolChanged()

void CCtrlGeneral::OnRestartPosChanged()
{
if(!m_bInitialized)
if(!m_initialized)
return;
TCHAR s[32];
m_EditRestartPos.GetWindowText(s, mpt::saturate_cast<int>(std::size(s)));
Expand All @@ -666,7 +666,7 @@ void CCtrlGeneral::OnRestartPosChanged()

void CCtrlGeneral::OnRestartPosDone()
{
if(m_bInitialized)
if(m_initialized)
SetDlgItemInt(IDC_EDIT_RESTARTPOS, m_sndFile.Order().GetRestartPos());
}

Expand Down
13 changes: 7 additions & 6 deletions mptrack/Ctrl_ins.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1031,7 +1031,7 @@ void CCtrlInstruments::OnEditFocus()
BOOL CCtrlInstruments::OnInitDialog()
{
CModControlDlg::OnInitDialog();
m_bInitialized = FALSE;
m_initialized = false;
SetRedraw(FALSE);

m_ToolBar.SetExtendedStyle(m_ToolBar.GetExtendedStyle() | TBSTYLE_EX_DRAWDDARROWS);
Expand Down Expand Up @@ -1189,7 +1189,7 @@ BOOL CCtrlInstruments::SetCurrentInstrument(UINT nIns, BOOL bUpdNum)
if (m_sndFile.m_nInstruments < 1) return FALSE;
if ((nIns < 1) || (nIns > m_sndFile.m_nInstruments)) return FALSE;
LockControls();
if ((m_nInstrument != nIns) || (!m_bInitialized))
if (m_nInstrument != nIns || !m_initialized)
{
m_nInstrument = static_cast<INSTRUMENTINDEX>(nIns);
m_NoteMap.SetCurrentInstrument(m_nInstrument);
Expand Down Expand Up @@ -1242,7 +1242,8 @@ void CCtrlInstruments::OnActivatePage(LPARAM lParam)
SetCurrentInstrument(static_cast<INSTRUMENTINDEX>((lParam > 0) ? lParam : m_nInstrument));

// Initial Update
if (!m_bInitialized) UpdateView(InstrumentHint(m_nInstrument).Info().Envelope().ModType(), NULL);
if(!m_initialized)
UpdateView(InstrumentHint(m_nInstrument).Info().Envelope().ModType(), NULL);

PostViewMessage(VIEWMSG_LOADSTATE, (LPARAM)&instrumentState);
SwitchToView();
Expand Down Expand Up @@ -1341,7 +1342,7 @@ void CCtrlInstruments::UpdateView(UpdateHint hint, CObject *pObj)

const InstrumentHint instrHint = hint.ToType<InstrumentHint>();
FlagSet<HintType> hintType = instrHint.GetType();
if(!m_bInitialized)
if(!m_initialized)
hintType.set(HINT_MODTYPE);
if(!hintType[HINT_MODTYPE | HINT_INSTRUMENT | HINT_ENVELOPE | HINT_INSNAMES])
return;
Expand Down Expand Up @@ -1586,10 +1587,10 @@ void CCtrlInstruments::UpdateView(UpdateHint hint, CObject *pObj)
m_ComboTuning.Invalidate(FALSE);
}

if (!m_bInitialized)
if(!m_initialized)
{
// First update
m_bInitialized = TRUE;
m_initialized = true;
UnlockControls();
}

Expand Down
2 changes: 1 addition & 1 deletion mptrack/Ctrl_pat.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,7 @@ BOOL CCtrlPatterns::OnInitDialog()
UpdateView(PatternHint().Names().ModType(), NULL);
RecalcLayout();

m_bInitialized = TRUE;
m_initialized = true;
UnlockControls();

SetRedraw(TRUE);
Expand Down
15 changes: 9 additions & 6 deletions mptrack/Ctrl_smp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,7 @@ void CCtrlSamples::OnEditFocus()
BOOL CCtrlSamples::OnInitDialog()
{
CModControlDlg::OnInitDialog();
m_bInitialized = FALSE;
m_initialized = false;
SetRedraw(FALSE);

// Zoom Selection
Expand Down Expand Up @@ -405,8 +405,10 @@ void CCtrlSamples::OnActivatePage(LPARAM lParam)
SetCurrentSample((lParam > 0) ? ((SAMPLEINDEX)lParam) : m_nSample);

// Initial Update
if (!m_bInitialized) UpdateView(SampleHint(m_nSample).Info().ModType(), NULL);
if (m_hWndView) PostViewMessage(VIEWMSG_LOADSTATE, (LPARAM)&sampleState);
if(!m_initialized)
UpdateView(SampleHint(m_nSample).Info().ModType(), nullptr);
if(m_hWndView)
PostViewMessage(VIEWMSG_LOADSTATE, (LPARAM)&sampleState);
SwitchToView();

// Combo boxes randomly disappear without this... why?
Expand Down Expand Up @@ -683,7 +685,8 @@ void CCtrlSamples::UpdateView(UpdateHint hint, CObject *pObj)

const SampleHint sampleHint = hint.ToType<SampleHint>();
FlagSet<HintType> hintType = sampleHint.GetType();
if (!m_bInitialized) hintType.set(HINT_MODTYPE);
if(!m_initialized)
hintType.set(HINT_MODTYPE);
if(!hintType[HINT_SMPNAMES | HINT_SAMPLEINFO | HINT_MODTYPE]) return;

const SAMPLEINDEX updateSmp = sampleHint.GetSample();
Expand Down Expand Up @@ -914,10 +917,10 @@ void CCtrlSamples::UpdateView(UpdateHint hint, CObject *pObj)
GetDlgItem(IDC_CHECK2)->EnableWindow((m_sndFile.SampleHasPath(m_nSample) && m_sndFile.GetType() == MOD_TYPE_MPT) ? TRUE : FALSE);
}

if (!m_bInitialized)
if(!m_initialized)
{
// First update
m_bInitialized = TRUE;
m_initialized = true;
UnlockControls();
}

Expand Down
4 changes: 4 additions & 0 deletions mptrack/Globals.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
#include "Mptrack.h"
#include "resource.h"
#include "TrackerSettings.h"
#include "WindowMessages.h"
#include "../soundlib/mod_specifications.h"

#include <afxpriv.h>
Expand Down Expand Up @@ -152,6 +153,9 @@ BOOL CModControlDlg::PostViewMessage(UINT uMsg, LPARAM lParam) const
return FALSE;
}

LRESULT CModControlDlg::SwitchToView() const { return SendViewMessage(VIEWMSG_SETACTIVE); }
void CModControlDlg::UnlockControls() { PostMessage(WM_MOD_UNLOCKCONTROLS); }


BOOL CModControlDlg::OnToolTipText(UINT /*nID*/, NMHDR *pNMHDR, LRESULT *pResult)
{
Expand Down
7 changes: 3 additions & 4 deletions mptrack/Globals.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
#include "DialogBase.h"
#include "Settings.h"
#include "UpdateHints.h"
#include "WindowMessages.h"

OPENMPT_NAMESPACE_BEGIN

Expand Down Expand Up @@ -45,7 +44,7 @@ class CModControlDlg : public DialogBase
HWND m_hWndView = nullptr;
HWND m_lastFocusItem = nullptr;
LONG m_nLockCount = 0;
BOOL m_bInitialized = FALSE;
bool m_initialized = false;

public:
CModControlDlg(CModControlView &parent, CModDoc &document);
Expand All @@ -56,9 +55,9 @@ class CModControlDlg : public DialogBase
HWND GetViewWnd() const { return m_hWndView; }
LRESULT SendViewMessage(UINT uMsg, LPARAM lParam = 0) const;
BOOL PostViewMessage(UINT uMsg, LPARAM lParam = 0) const;
LRESULT SwitchToView() const { return SendViewMessage(VIEWMSG_SETACTIVE); }
LRESULT SwitchToView() const;
void LockControls() { m_nLockCount++; }
void UnlockControls() { PostMessage(WM_MOD_UNLOCKCONTROLS); }
void UnlockControls();
bool IsLocked() const { return (m_nLockCount > 0); }
virtual Setting<LONG> &GetSplitPosRef() = 0;

Expand Down
4 changes: 4 additions & 0 deletions mptrack/View_gen.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
#include "Reporting.h"
#include "resource.h"
#include "SelectPluginDialog.h"
#include "WindowMessages.h"
#include "../common/mptStringBuffer.h"
#include "../soundlib/mod_specifications.h"
#include "../soundlib/plugins/PlugInterface.h"
Expand Down Expand Up @@ -297,6 +298,9 @@ void CViewGlobals::RecalcLayout()
}


void CViewGlobals::UnlockControls() { PostMessage(WM_MOD_UNLOCKCONTROLS); }


int CViewGlobals::GetDlgItemIntEx(UINT nID)
{
CString s;
Expand Down
3 changes: 1 addition & 2 deletions mptrack/View_gen.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
#include "ColorPickerButton.h"
#include "PluginComboBox.h"
#include "UpdateHints.h"
#include "WindowMessages.h"
#include "../soundlib/plugins/PluginStructs.h"

OPENMPT_NAMESPACE_BEGIN
Expand Down Expand Up @@ -64,7 +63,7 @@ class CViewGlobals: public CFormView
CModDoc* GetDocument() const;
void RecalcLayout();
void LockControls() { m_nLockCount++; }
void UnlockControls() { PostMessage(WM_MOD_UNLOCKCONTROLS); }
void UnlockControls();
bool IsLocked() const noexcept { return (m_nLockCount > 0); }
int GetDlgItemIntEx(UINT nID);
void PopulateChannelPlugins(UpdateHint hint, const CObject *pObj = nullptr);
Expand Down
19 changes: 18 additions & 1 deletion mptrack/View_pat.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@
#include "resource.h"
#include "SampleEditorDialogs.h" // For amplification dialog (which is re-used from sample editor)
#include "WindowMessages.h"
#include "WindowMessages.h"
#include "../common/misc_util.h"
#include "../soundlib/MIDIEvents.h"
#include "../soundlib/mod_specifications.h"
Expand Down Expand Up @@ -3305,6 +3304,24 @@ void CViewPattern::OnSwitchToOrderList()
}


void CViewPattern::OnPrevInstrument()
{
PostCtrlMessage(CTRLMSG_PAT_PREVINSTRUMENT);
}


void CViewPattern::OnNextInstrument()
{
PostCtrlMessage(CTRLMSG_PAT_NEXTINSTRUMENT);
}


void CViewPattern::OnPatternRecord()
{
PostCtrlMessage(CTRLMSG_SETRECORD, -1);
}


void CViewPattern::GotoPreviousOrder(std::optional<OrderTransitionMode> transitionMode)
{
if(CSoundFile *sndFile = GetSoundFile(); sndFile && transitionMode && IsLiveRecord())
Expand Down
6 changes: 3 additions & 3 deletions mptrack/View_pat.h
Original file line number Diff line number Diff line change
Expand Up @@ -420,9 +420,9 @@ class CViewPattern final : public CModScrollView
afx_msg void OnSplitPattern();
afx_msg void OnPatternStep();
afx_msg void OnSwitchToOrderList();
afx_msg void OnPrevInstrument() { PostCtrlMessage(CTRLMSG_PAT_PREVINSTRUMENT); }
afx_msg void OnNextInstrument() { PostCtrlMessage(CTRLMSG_PAT_NEXTINSTRUMENT); }
afx_msg void OnPatternRecord() { PostCtrlMessage(CTRLMSG_SETRECORD, -1); }
afx_msg void OnPrevInstrument();
afx_msg void OnNextInstrument();
afx_msg void OnPatternRecord();
afx_msg void OnInterpolateVolume() { Interpolate(PatternCursor::volumeColumn); }
afx_msg void OnInterpolateEffect() { Interpolate(PatternCursor::effectColumn); }
afx_msg void OnInterpolateNote() { Interpolate(PatternCursor::noteColumn); }
Expand Down

0 comments on commit 05ecf0d

Please sign in to comment.