Skip to content

Fix FRED play/media button transparency and disabled state#7524

Merged
wookieejedi merged 1 commit into
scp-fs2open:masterfrom
Goober5000:fix/button_colors
Jun 16, 2026
Merged

Fix FRED play/media button transparency and disabled state#7524
wookieejedi merged 1 commit into
scp-fs2open:masterfrom
Goober5000:fix/button_colors

Conversation

@Goober5000

@Goober5000 Goober5000 commented Jun 14, 2026

Copy link
Copy Markdown
Contributor

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_btnface_mapped() to management.{cpp,h}: it loads a bitmap via CreateMappedBitmap, remapping the standard toolbar colors (background keys, shadow, highlight, text) to the live GetSysColor() values. Route the event editor's play button and the music player's play/stop/next/prev buttons through it.

@Goober5000 Goober5000 added fix A fix for bugs, not-a-bugs, and/or regressions. fred A feature or issue related to the FReespace EDitor (FRED) labels Jun 14, 2026
@Goober5000 Goober5000 marked this pull request as draft June 14, 2026 02:31
@Goober5000 Goober5000 marked this pull request as ready for review June 14, 2026 06:30
@Goober5000 Goober5000 changed the title Fix FRED button bitmaps rendering their raw background color Fix FRED play/media button transparency and disabled state Jun 14, 2026
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) <noreply@anthropic.com>

@wookieejedi wookieejedi left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Everything looks good to me

@wookieejedi wookieejedi merged commit 1c079a7 into scp-fs2open:master Jun 16, 2026
20 checks passed
@Goober5000 Goober5000 deleted the fix/button_colors branch June 16, 2026 03:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

fix A fix for bugs, not-a-bugs, and/or regressions. fred A feature or issue related to the FReespace EDitor (FRED)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants