Files
fs2open.github.com/fred2/soundenvironmentdlg.h
Goober5000andClaude Opus 4.8 1c079a79c1 Fix FRED play/media button transparency and disabled state (#7524)
CButton::SetBitmap blits a bitmap verbatim and does not perform the
magic-color substitution MFC applies when loading toolbar bitmaps. So a
button bitmap's background -- the legacy C0C0C0 gray baked into play.bmp
et al., or a magenta transparency key -- was drawn literally, reading as
a dark/colored rectangle instead of matching the real button face
(~F0F0F0 on modern Windows), and a disabled bitmap button embossed its
whole opaque rectangle into a solid gray square.

Add load_button_icon() to management.{cpp,h}, which builds an icon from
a button bitmap by keying out a background color into a transparency
mask. Driven through BS_ICON/SetIcon, the OS blends it with the button
face and grays it correctly when disabled. Route every play/media button
through it (event editor, briefing, debriefing, command brief, music
player, sound environment). Also add load_btnface_mapped() -- a
toolbar-style color remap -- kept as a lighter alternative for
always-enabled buttons.

Co-authored-by: Claude Opus 4.8 (1M context) <[email protected]>
2026-06-15 22:33:37 -04:00

64 lines
1.5 KiB
C++

#if !defined(AFX_SOUNDENVIRONMENTDLG_H__C27DA258_9C66_4987_8D20_AEEB260644A8__INCLUDED_)
#define AFX_SOUNDENVIRONMENTDLG_H__C27DA258_9C66_4987_8D20_AEEB260644A8__INCLUDED_
#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000
// soundenvironmentdlg.h : header file
//
/////////////////////////////////////////////////////////////////////////////
// SoundEnvironment dialog
class SoundEnvironment : public CDialog
{
// Construction
public:
SoundEnvironment(CWnd* pParent = NULL); // standard constructor
int query_modified();
void OnOK();
void OnCancel();
// Dialog Data
//{{AFX_DATA(SoundEnvironment)
enum { IDD = IDD_SOUND_ENVIRONMENT };
int m_environment;
float m_damping;
float m_decay_time;
float m_volume;
CString m_wave_filename;
//}}AFX_DATA
HICON m_play_icon;
// Overrides
// ClassWizard generated virtual function overrides
//{{AFX_VIRTUAL(SoundEnvironment)
public:
virtual BOOL DestroyWindow();
protected:
virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
//}}AFX_VIRTUAL
// Implementation
protected:
// Generated message map functions
//{{AFX_MSG(SoundEnvironment)
virtual BOOL OnInitDialog();
afx_msg void OnClose();
afx_msg void OnSelChangeSoundEnvironment();
afx_msg void OnBrowseWave();
afx_msg void OnPlay();
//}}AFX_MSG
DECLARE_MESSAGE_MAP()
private:
int m_wave_id;
};
//{{AFX_INSERT_LOCATION}}
// Microsoft Visual C++ will insert additional declarations immediately before the previous line.
#endif // !defined(AFX_SOUNDENVIRONMENT_H__C27DA258_9C66_4987_8D20_AEEB260644A8__INCLUDED_)