From: <sv...@op...> - 2025-01-03 15:56:17
|
Author: sagamusix Date: Fri Jan 3 16:56:05 2025 New Revision: 22741 URL: https://source.openmpt.org/browse/openmpt/?op=revision&rev=22741 Log: [Ref] DrawButtonRect: Take rect by reference rather than pointer. Modified: trunk/OpenMPT/mptrack/Ctrl_ins.cpp trunk/OpenMPT/mptrack/Draw_pat.cpp trunk/OpenMPT/mptrack/Mptrack.cpp trunk/OpenMPT/mptrack/Mptrack.h trunk/OpenMPT/mptrack/tuningRatioMapWnd.cpp Modified: trunk/OpenMPT/mptrack/Ctrl_ins.cpp ============================================================================== --- trunk/OpenMPT/mptrack/Ctrl_ins.cpp Fri Jan 3 16:40:39 2025 (r22740) +++ trunk/OpenMPT/mptrack/Ctrl_ins.cpp Fri Jan 3 16:56:05 2025 (r22741) @@ -216,7 +216,7 @@ s.clear(); } rect.SetRect(0, ypaint, m_cxFont, ypaint+m_cyFont); - DrawButtonRect(dc, lineWidth, &rect, s.c_str(), false, false); + DrawButtonRect(dc, lineWidth, rect, s.c_str(), false, false); // Mapped Note bool highlight = ((focus) && (nPos == (int)m_nNote)); rect.left = rect.right; @@ -263,7 +263,7 @@ dc.DrawText(s.c_str(), -1, &rect, DT_SINGLELINE | DT_CENTER | DT_VCENTER | DT_NOPREFIX); } rect.SetRect(rcClient.left + m_cxFont * 2 - 1, rcClient.top, rcClient.left + m_cxFont * 2 + 3, ypaint); - DrawButtonRect(dc, lineWidth, &rect, _T(""), false, false); + DrawButtonRect(dc, lineWidth, rect, _T(""), false, false); if (ypaint < rcClient.bottom) { rect.SetRect(rcClient.left, ypaint, rcClient.right, rcClient.bottom); Modified: trunk/OpenMPT/mptrack/Draw_pat.cpp ============================================================================== --- trunk/OpenMPT/mptrack/Draw_pat.cpp Fri Jan 3 16:40:39 2025 (r22740) +++ trunk/OpenMPT/mptrack/Draw_pat.cpp Fri Jan 3 16:56:05 2025 (r22741) @@ -681,7 +681,7 @@ int width = HighDPISupport::ScalePixels(1, m_hWnd); rc.SetRect(0, ypaint, rcClient.right + 1, rcClient.bottom + 1); if(width == 1) - DrawButtonRect(hdc, lineWidth, &rc, _T("")); + DrawButtonRect(hdc, lineWidth, rc, _T("")); else DrawEdge(hdc, rc, EDGE_RAISED, BF_TOPLEFT | BF_MIDDLE); // Prevent lower edge from being drawn } @@ -700,7 +700,7 @@ { sprintf(s, "#%u", m_nPattern); rect.right = m_szHeader.cx; - DrawButtonRect(hdc, lineWidth, &rect, s, false, + DrawButtonRect(hdc, lineWidth, rect, s, false, m_bInItemRect && m_nDragItem.Type() == DragItem::PatternHeader); const int dropWidth = HighDPISupport::ScalePixels(2, m_hWnd); @@ -723,7 +723,7 @@ else if(numVisibleColums < 5) pszfmt = sndFile.m_bChannelMuteTogglePending[ncolhdr] ? "[Chn %u]" : "Chn %u"; sprintf(s, pszfmt, ncolhdr + 1, channel.szName.buf); - DrawButtonRect(hdc, lineWidth, &rect, s, + DrawButtonRect(hdc, lineWidth, rect, s, channel.dwFlags[CHN_MUTE], m_bInItemRect && m_nDragItem.Type() == DragItem::ChannelHeader && m_nDragItem.Value() == ncolhdr, recordGroup != RecordGroup::NoGroup ? DT_RIGHT : DT_CENTER, chanColorHeight); @@ -769,7 +769,7 @@ InvertRect(hdc, &rect); s[0] = (recordGroup == RecordGroup::Group1) ? '1' : '2'; s[1] = '\0'; - DrawButtonRect(hdc, lineWidth, &insRect, s, false, false, DT_CENTER); + DrawButtonRect(hdc, lineWidth, insRect, s, false, false, DT_CENTER); FrameRect(hdc, &insRect, blackBrush); } @@ -788,7 +788,7 @@ sprintf(s, "%u: %s", mixPlug, (sndFile.m_MixPlugins[mixPlug - 1]).pMixPlugin ? sndFile.m_MixPlugins[mixPlug - 1].GetNameLocale() : "[empty]"); else sprintf(s, "---"); - DrawButtonRect(hdc, lineWidth, &rect, s, channel.dwFlags[CHN_NOFX], + DrawButtonRect(hdc, lineWidth, rect, s, channel.dwFlags[CHN_NOFX], m_bInItemRect && (m_nDragItem.Type() == DragItem::PluginName) && (m_nDragItem.Value() == ncolhdr), DT_CENTER); } @@ -921,7 +921,7 @@ else wsprintf(s, _T("%d"), compRow); - DrawButtonRect(hdc, lineWidth, &rect, s, !selEnable || rowDisabled); + DrawButtonRect(hdc, lineWidth, rect, s, !selEnable || rowDisabled); oldrowcolor = EncodeRowColor(row_bkcol, row_col, bRowSel); bRowSel = (m_Selection.ContainsVertical(PatternCursor(row))); row_col = MODCOLOR_TEXTNORMAL; Modified: trunk/OpenMPT/mptrack/Mptrack.cpp ============================================================================== --- trunk/OpenMPT/mptrack/Mptrack.cpp Fri Jan 3 16:40:39 2025 (r22740) +++ trunk/OpenMPT/mptrack/Mptrack.cpp Fri Jan 3 16:56:05 2025 (r22741) @@ -2040,27 +2040,27 @@ } -void DrawButtonRect(HDC hdc, int lineWidth, const RECT *lpRect, const char *text, bool disabled, bool pushed, DWORD dwFlags, uint32 topMargin) +void DrawButtonRect(HDC hdc, int lineWidth, const CRect &rect, const char *text, bool disabled, bool pushed, DWORD dwFlags, uint32 topMargin) { - DrawButtonRectImpl(hdc, lineWidth, CMainFrame::GetGUIFont(), *lpRect, text, disabled, pushed, dwFlags, topMargin); + DrawButtonRectImpl(hdc, lineWidth, CMainFrame::GetGUIFont(), rect, text, disabled, pushed, dwFlags, topMargin); } -void DrawButtonRect(HDC hdc, int lineWidth, const RECT *lpRect, const wchar_t * text, bool disabled, bool pushed, DWORD dwFlags, uint32 topMargin) +void DrawButtonRect(HDC hdc, int lineWidth, const CRect &rect, const wchar_t *text, bool disabled, bool pushed, DWORD dwFlags, uint32 topMargin) { - DrawButtonRectImpl(hdc, lineWidth, CMainFrame::GetGUIFont(), *lpRect, text, disabled, pushed, dwFlags, topMargin); + DrawButtonRectImpl(hdc, lineWidth, CMainFrame::GetGUIFont(), rect, text, disabled, pushed, dwFlags, topMargin); } -void DrawButtonRect(HDC hdc, int lineWidth, HFONT font, const RECT *lpRect, const char * text, bool disabled, bool pushed, DWORD dwFlags, uint32 topMargin) +void DrawButtonRect(HDC hdc, int lineWidth, HFONT font, const CRect &rect, const char *text, bool disabled, bool pushed, DWORD dwFlags, uint32 topMargin) { - DrawButtonRectImpl(hdc, lineWidth, font, *lpRect, text, disabled, pushed, dwFlags, topMargin); + DrawButtonRectImpl(hdc, lineWidth, font, rect, text, disabled, pushed, dwFlags, topMargin); } -void DrawButtonRect(HDC hdc, int lineWidth, HFONT font, const RECT *lpRect, const wchar_t * text, bool disabled, bool pushed, DWORD dwFlags, uint32 topMargin) +void DrawButtonRect(HDC hdc, int lineWidth, HFONT font, const CRect &rect, const wchar_t *text, bool disabled, bool pushed, DWORD dwFlags, uint32 topMargin) { - DrawButtonRectImpl(hdc, lineWidth, font, *lpRect, text, disabled, pushed, dwFlags, topMargin); + DrawButtonRectImpl(hdc, lineWidth, font, rect, text, disabled, pushed, dwFlags, topMargin); } Modified: trunk/OpenMPT/mptrack/Mptrack.h ============================================================================== --- trunk/OpenMPT/mptrack/Mptrack.h Fri Jan 3 16:40:39 2025 (r22740) +++ trunk/OpenMPT/mptrack/Mptrack.h Fri Jan 3 16:56:05 2025 (r22741) @@ -419,10 +419,10 @@ // Other bitmap functions int DrawTextT(HDC hdc, const wchar_t *lpchText, int cchText, LPRECT lprc, UINT format); int DrawTextT(HDC hdc, const char *lpchText, int cchText, LPRECT lprc, UINT format); -void DrawButtonRect(HDC hdc, int lineWidth, const RECT *lpRect, const char *text = nullptr, bool disabled = false, bool pushed = false, DWORD dwFlags = (DT_CENTER | DT_VCENTER), uint32 topMargin = 0); -void DrawButtonRect(HDC hdc, int lineWidth, const RECT *lpRect, const wchar_t *text = nullptr, bool disabled = false, bool pushed = false, DWORD dwFlags = (DT_CENTER | DT_VCENTER), uint32 topMargin = 0); -void DrawButtonRect(HDC hdc, int lineWidth, HFONT font, const RECT *lpRect, const char *text = nullptr, bool disabled = false, bool pushed = false, DWORD dwFlags = (DT_CENTER | DT_VCENTER), uint32 topMargin = 0); -void DrawButtonRect(HDC hdc, int lineWidth, HFONT font, const RECT *lpRect, const wchar_t *text = nullptr, bool disabled = false, bool pushed = false, DWORD dwFlags = (DT_CENTER | DT_VCENTER), uint32 topMargin = 0); +void DrawButtonRect(HDC hdc, int lineWidth, const CRect &rect, const char *text = nullptr, bool disabled = false, bool pushed = false, DWORD dwFlags = (DT_CENTER | DT_VCENTER), uint32 topMargin = 0); +void DrawButtonRect(HDC hdc, int lineWidth, const CRect &rect, const wchar_t *text = nullptr, bool disabled = false, bool pushed = false, DWORD dwFlags = (DT_CENTER | DT_VCENTER), uint32 topMargin = 0); +void DrawButtonRect(HDC hdc, int lineWidth, HFONT font, const CRect &rect, const char *text = nullptr, bool disabled = false, bool pushed = false, DWORD dwFlags = (DT_CENTER | DT_VCENTER), uint32 topMargin = 0); +void DrawButtonRect(HDC hdc, int lineWidth, HFONT font, const CRect &rect, const wchar_t *text = nullptr, bool disabled = false, bool pushed = false, DWORD dwFlags = (DT_CENTER | DT_VCENTER), uint32 topMargin = 0); // Misc functions void ErrorBox(UINT nStringID, CWnd *p = nullptr); Modified: trunk/OpenMPT/mptrack/tuningRatioMapWnd.cpp ============================================================================== --- trunk/OpenMPT/mptrack/tuningRatioMapWnd.cpp Fri Jan 3 16:40:39 2025 (r22740) +++ trunk/OpenMPT/mptrack/tuningRatioMapWnd.cpp Fri Jan 3 16:56:05 2025 (r22741) @@ -89,7 +89,7 @@ rect.SetRect(0, ypaint, m_cxFont, ypaint + m_cyFont); const auto noteStr = isValidNote ? mpt::tfmt::val(noteToDraw) : mpt::tstring(_T("...")); - DrawButtonRect(dc, lineWidth, m_font, &rect, noteStr.c_str(), false, false); + DrawButtonRect(dc, lineWidth, m_font, rect, noteStr.c_str(), false, false); // Mapped Note const bool highLight = focus && (nPos == (int)m_nNote); @@ -115,7 +115,7 @@ } rect.SetRect(rcClient.left + m_cxFont * 4 - 1, rcClient.top, rcClient.left + m_cxFont * 4 + 3, ypaint); - DrawButtonRect(dc, lineWidth, m_font, &rect, _T("")); + DrawButtonRect(dc, lineWidth, m_font, rect, _T("")); if (ypaint < rcClient.bottom) { rect.SetRect(rcClient.left, ypaint, rcClient.right, rcClient.bottom); |