Skip to content

Commit

Permalink
Fix #1508.
Browse files Browse the repository at this point in the history
As it turns out, the responder state combo box has the owner draw style
applied. So, `ifdef`ing the draw method out causes the box to be blank.
Who would have thought it? While I was here, I cleaned up the colors to
not look out of place on Max 2022.
  • Loading branch information
Hoikas committed Feb 25, 2024
1 parent ef73775 commit 65ca738
Showing 1 changed file with 12 additions and 7 deletions.
19 changes: 12 additions & 7 deletions Sources/Tools/MaxComponent/plResponderComponent.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -877,11 +877,18 @@ void plResponderProc::IDrawComboItem(DRAWITEMSTRUCT *dis)
return;

// The colors depend on whether the item is selected.
COLORREF clrForeground = SetTextColor(dis->hDC,
GetSysColor(dis->itemState & ODS_SELECTED ? COLOR_HIGHLIGHTTEXT : COLOR_WINDOWTEXT));

COLORREF clrBackground = SetBkColor(dis->hDC,
GetSysColor(dis->itemState & ODS_SELECTED ? COLOR_HIGHLIGHT : COLOR_WINDOW));
bool selected = hsCheckBits(dis->itemState, ODS_SELECTED);
COLORREF maxForeground = selected ? kHilightText : kWindowText;
COLORREF maxBackground = selected ? kItemHilight : kWindow;

COLORREF clrForeground = SetTextColor(
dis->hDC,
GetColorManager()->GetColor(maxForeground)
);
COLORREF clrBackground = SetBkColor(
dis->hDC,
GetColorManager()->GetColor(maxBackground)
);

// Calculate the vertical and horizontal position.
TEXTMETRIC tm;
Expand Down Expand Up @@ -1072,15 +1079,13 @@ INT_PTR plResponderProc::DlgProc(TimeValue t, IParamMap2 *pm, HWND hWnd, UINT ms
}
return TRUE;

#ifdef CUSTOM_DRAW
case WM_DRAWITEM:
if (wParam == IDC_STATE_COMBO)
{
IDrawComboItem((DRAWITEMSTRUCT*)lParam);
return TRUE;
}
break;
#endif

case WM_SETCURSOR:
{
Expand Down

0 comments on commit 65ca738

Please sign in to comment.