From 2526bb2513f560f75de7f4ce1b30109c84c61280 Mon Sep 17 00:00:00 2001 From: Justin Marshall Date: Thu, 14 May 2026 20:25:55 -0700 Subject: [PATCH] Switched to dark theme. --- neo/engine/tools/radiant/MainFrm.cpp | 123 ++++++++++++++++++++++++--- 1 file changed, 111 insertions(+), 12 deletions(-) diff --git a/neo/engine/tools/radiant/MainFrm.cpp b/neo/engine/tools/radiant/MainFrm.cpp index 0d3c67d9..5d22fd4a 100644 --- a/neo/engine/tools/radiant/MainFrm.cpp +++ b/neo/engine/tools/radiant/MainFrm.cpp @@ -104,6 +104,83 @@ static void InitRadiantCommonControls() { } } + +static COLORREF RadiantDarkPaneColor() { + return RGB(24, 24, 24); +} + +static COLORREF RadiantDarkSplitterColor() { + return RGB(38, 38, 38); +} + +static COLORREF RadiantDarkSplitterHighlightColor() { + return RGB(58, 58, 58); +} + +static COLORREF RadiantDarkSplitterShadowColor() { + return RGB(12, 12, 12); +} + +static HBRUSH RadiantDarkPaneBrush() { + static HBRUSH hBrush = ::CreateSolidBrush(RadiantDarkPaneColor()); + return hBrush; +} + +static void SetRadiantSavedInfoColor(int colorIndex, float r, float g, float b) { + g_qeglobals.d_savedinfo.colors[colorIndex][0] = r; + g_qeglobals.d_savedinfo.colors[colorIndex][1] = g; + g_qeglobals.d_savedinfo.colors[colorIndex][2] = b; +} + +static void ApplyRadiantDarkXYAndZTheme() { + // The XY and Z views are both grid-based editor windows. Keep those views + // dark regardless of the rest of the MFC chrome/theme selection. + SetRadiantSavedInfoColor(COLOR_GRIDBACK, 0.045f, 0.045f, 0.050f); + SetRadiantSavedInfoColor(COLOR_GRIDMINOR, 0.120f, 0.120f, 0.130f); + SetRadiantSavedInfoColor(COLOR_GRIDMAJOR, 0.220f, 0.240f, 0.265f); + SetRadiantSavedInfoColor(COLOR_GRIDBLOCK, 0.330f, 0.395f, 0.500f); + SetRadiantSavedInfoColor(COLOR_GRIDTEXT, 0.780f, 0.800f, 0.835f); + SetRadiantSavedInfoColor(COLOR_BRUSHES, 0.780f, 0.790f, 0.815f); + SetRadiantSavedInfoColor(COLOR_SELBRUSHES, 1.000f, 0.580f, 0.160f); + SetRadiantSavedInfoColor(COLOR_CLIPPER, 0.270f, 0.540f, 1.000f); + SetRadiantSavedInfoColor(COLOR_VIEWNAME, 0.600f, 0.720f, 1.000f); + SetRadiantSavedInfoColor(COLOR_PRECISION_CROSSHAIR, 1.000f, 0.230f, 0.850f); +} + +#ifdef IDI_ICON1 +static HICON LoadRadiantFrameIcon(int cx, int cy) { + return reinterpret_cast(::LoadImage( + AfxGetResourceHandle(), + MAKEINTRESOURCE(IDI_ICON1), + IMAGE_ICON, + cx, + cy, + LR_DEFAULTCOLOR | LR_SHARED + )); +} +#endif + +static void ApplyRadiantFrameIcon(CWnd* pWnd) { + if (!pWnd || !pWnd->GetSafeHwnd()) { + return; + } + +#ifdef IDI_ICON1 + HICON hBigIcon = LoadRadiantFrameIcon(::GetSystemMetrics(SM_CXICON), ::GetSystemMetrics(SM_CYICON)); + HICON hSmallIcon = LoadRadiantFrameIcon(::GetSystemMetrics(SM_CXSMICON), ::GetSystemMetrics(SM_CYSMICON)); + + if (hBigIcon) { + pWnd->SetIcon(hBigIcon, TRUE); + } + if (hSmallIcon) { + pWnd->SetIcon(hSmallIcon, FALSE); + } + else if (hBigIcon) { + pWnd->SetIcon(hBigIcon, FALSE); + } +#endif +} + // globals CString g_strAppPath; // holds the full path of the executable CMainFrame* g_pParentWnd = NULL; // used to precast to CMainFrame @@ -781,7 +858,7 @@ BOOL CMainFrameLeftPaneWnd::Create(CWnd* pParent, UINT nID) { CString className = AfxRegisterWndClass( CS_HREDRAW | CS_VREDRAW | CS_DBLCLKS, ::LoadCursor(NULL, IDC_ARROW), - (HBRUSH)(COLOR_BTNFACE + 1), + RadiantDarkPaneBrush(), NULL ); return CWnd::CreateEx( @@ -876,12 +953,12 @@ void CMainFrameLeftPaneWnd::DrawSplitter(CDC* pDC) { } CRect rc = m_rcSplitter; - CBrush brush(::GetSysColor(COLOR_BTNFACE)); + CBrush brush(RadiantDarkSplitterColor()); pDC->FillRect(rc, &brush); - pDC->Draw3dRect(rc, ::GetSysColor(COLOR_3DHILIGHT), ::GetSysColor(COLOR_3DSHADOW)); + pDC->Draw3dRect(rc, RadiantDarkSplitterHighlightColor(), RadiantDarkSplitterShadowColor()); int y = rc.top + rc.Height() / 2; - CPen pen(PS_SOLID, 1, ::GetSysColor(COLOR_3DSHADOW)); + CPen pen(PS_SOLID, 1, RadiantDarkSplitterShadowColor()); CPen* oldPen = pDC->SelectObject(&pen); pDC->MoveTo(rc.left + 6, y); pDC->LineTo(rc.right - 6, y); @@ -1013,7 +1090,7 @@ BOOL CMainFrameLeftPaneWnd::OnSetCursor(CWnd* pWnd, UINT nHitTest, UINT message) BOOL CMainFrameLeftPaneWnd::OnEraseBkgnd(CDC* pDC) { CRect client; GetClientRect(client); - CBrush brush(::GetSysColor(COLOR_BTNFACE)); + CBrush brush(RadiantDarkPaneColor()); pDC->FillRect(client, &brush); DrawSplitter(pDC); return TRUE; @@ -1053,7 +1130,7 @@ BOOL CMainFrameLayoutWnd::Create(CWnd* pParent, UINT nID) { CString className = AfxRegisterWndClass( CS_HREDRAW | CS_VREDRAW | CS_DBLCLKS, ::LoadCursor(NULL, IDC_ARROW), - (HBRUSH)(COLOR_BTNFACE + 1), + RadiantDarkPaneBrush(), NULL ); @@ -1151,12 +1228,12 @@ void CMainFrameLayoutWnd::DrawSplitter(CDC* pDC) { } CRect rc = m_rcSplitter; - CBrush brush(::GetSysColor(COLOR_BTNFACE)); + CBrush brush(RadiantDarkSplitterColor()); pDC->FillRect(rc, &brush); - pDC->Draw3dRect(rc, ::GetSysColor(COLOR_3DHILIGHT), ::GetSysColor(COLOR_3DSHADOW)); + pDC->Draw3dRect(rc, RadiantDarkSplitterHighlightColor(), RadiantDarkSplitterShadowColor()); int x = rc.left + rc.Width() / 2; - CPen pen(PS_SOLID, 1, ::GetSysColor(COLOR_3DSHADOW)); + CPen pen(PS_SOLID, 1, RadiantDarkSplitterShadowColor()); CPen* oldPen = pDC->SelectObject(&pen); pDC->MoveTo(x, rc.top + 6); pDC->LineTo(x, rc.bottom - 6); @@ -1290,7 +1367,7 @@ BOOL CMainFrameLayoutWnd::OnSetCursor(CWnd* pWnd, UINT nHitTest, UINT message) { BOOL CMainFrameLayoutWnd::OnEraseBkgnd(CDC* pDC) { CRect client; GetClientRect(client); - CBrush brush(::GetSysColor(COLOR_BTNFACE)); + CBrush brush(RadiantDarkPaneColor()); pDC->FillRect(client, &brush); DrawSplitter(pDC); return TRUE; @@ -1871,6 +1948,8 @@ void MFCCreate(HINSTANCE hInstance) LoadRegistryInfo("radiant_SavedInfo", &g_qeglobals.d_savedinfo, &l); } } + + ApplyRadiantDarkXYAndZTheme(); } /* @@ -1895,6 +1974,9 @@ int CMainFrame::OnCreate(LPCREATESTRUCT lpCreateStruct) { return -1; } + ApplyRadiantFrameIcon(this); + ApplyRadiantDarkXYAndZTheme(); + UINT nID = (g_PrefsDlg.m_bWideToolbar) ? IDR_TOOLBAR_ADVANCED : IDR_TOOLBAR1; if (!CreateEmbeddedMainToolBar(nID)) { @@ -2057,8 +2139,19 @@ void CMainFrame::LoadCommandMap() { ======================================================================================================================= */ BOOL CMainFrame::PreCreateWindow(CREATESTRUCT& cs) { - // TODO: Modify the Window class or styles here by modifying the CREATESTRUCT cs - return CFrameWnd::PreCreateWindow(cs); + BOOL result = CFrameWnd::PreCreateWindow(cs); +#ifdef IDI_ICON1 + HICON hClassIcon = LoadRadiantFrameIcon(::GetSystemMetrics(SM_CXICON), ::GetSystemMetrics(SM_CYICON)); + if (hClassIcon) { + cs.lpszClass = AfxRegisterWndClass( + CS_HREDRAW | CS_VREDRAW | CS_DBLCLKS, + ::LoadCursor(NULL, IDC_ARROW), + (HBRUSH)(COLOR_WINDOW + 1), + hClassIcon + ); + } +#endif + return result; } // CMainFrame diagnostics @@ -2606,6 +2699,7 @@ BOOL CMainFrame::OnCreateClient(LPCREATESTRUCT lpcs, CCreateContext* pContext) { RecalcMainLayout(); CreateQEChildren(); + ApplyRadiantDarkXYAndZTheme(); AttachDoomWindowToGameTab(); ApplyActiveTabInputMode(); @@ -5061,6 +5155,7 @@ void CMainFrame::OnColorSetoriginal() { g_qeglobals.d_savedinfo.colors[COLOR_PRECISION_CROSSHAIR][1] = 0.0; g_qeglobals.d_savedinfo.colors[COLOR_PRECISION_CROSSHAIR][2] = 1.0; + ApplyRadiantDarkXYAndZTheme(); Sys_UpdateWindows(W_ALL); } @@ -5105,6 +5200,7 @@ void CMainFrame::OnColorSetqer() { g_qeglobals.d_savedinfo.colors[COLOR_PRECISION_CROSSHAIR][1] = 0.0; g_qeglobals.d_savedinfo.colors[COLOR_PRECISION_CROSSHAIR][2] = 1.0; + ApplyRadiantDarkXYAndZTheme(); Sys_UpdateWindows(W_ALL); } @@ -5137,6 +5233,7 @@ void CMainFrame::OnColorSetSuperMal() { g_qeglobals.d_savedinfo.colors[COLOR_VIEWNAME][2] = 0.74f; + ApplyRadiantDarkXYAndZTheme(); Sys_UpdateWindows(W_ALL); } @@ -5184,6 +5281,7 @@ void CMainFrame::OnColorSetblack() { g_qeglobals.d_savedinfo.colors[COLOR_PRECISION_CROSSHAIR][1] = 0.0; g_qeglobals.d_savedinfo.colors[COLOR_PRECISION_CROSSHAIR][2] = 1.0; + ApplyRadiantDarkXYAndZTheme(); Sys_UpdateWindows(W_ALL); } @@ -5223,6 +5321,7 @@ void CMainFrame::OnColorSetMax() { g_qeglobals.d_savedinfo.colors[COLOR_PRECISION_CROSSHAIR][1] = 0.0f; g_qeglobals.d_savedinfo.colors[COLOR_PRECISION_CROSSHAIR][2] = 1.0f; + ApplyRadiantDarkXYAndZTheme(); Sys_UpdateWindows(W_ALL); }