From 19bd95b0a25ada9f80f7953c66570b0d4e878833 Mon Sep 17 00:00:00 2001 From: Josh Steffen Date: Thu, 15 Jan 2015 07:14:03 -0500 Subject: [PATCH 1/4] Added option to change detail brush color in 2d view --- include/qertypes.h | 4 +++- radiant/mainframe.cpp | 12 ++++++++++++ radiant/mainframe.h | 2 ++ radiant/xywindow.cpp | 5 +++++ 4 files changed, 22 insertions(+), 1 deletion(-) diff --git a/include/qertypes.h b/include/qertypes.h index b3631d88..e63f9c2f 100644 --- a/include/qertypes.h +++ b/include/qertypes.h @@ -68,7 +68,9 @@ typedef bool qboolean; #define COLOR_GRIDMINOR_ALT 13 #define COLOR_GRIDMAJOR_ALT 14 -#define COLOR_LAST 15 +#define COLOR_DETAIL 15 + +#define COLOR_LAST 16 // ---------------------------- diff --git a/radiant/mainframe.cpp b/radiant/mainframe.cpp index 72c9e028..e84c47a7 100644 --- a/radiant/mainframe.cpp +++ b/radiant/mainframe.cpp @@ -549,6 +549,7 @@ gint HandleCommand( GtkWidget *widget, gpointer data ){ case ID_COLORS_SELECTEDBRUSH3D: g_pParentWnd->OnColorsSelectedbrush3D(); break; case ID_COLORS_CLIPPER: g_pParentWnd->OnColorsClipper(); break; case ID_COLORS_VIEWNAME: g_pParentWnd->OnColorsViewname(); break; + case ID_COLORS_DETAIL: g_pParentWnd->OnColorsDetail(); break; case ID_MISC_GAMMA: g_pParentWnd->OnMiscGamma(); break; case ID_MISC_FINDBRUSH: g_pParentWnd->OnMiscFindbrush(); break; case ID_MISC_NEXTLEAKSPOT: g_pParentWnd->OnMiscNextleakspot(); break; @@ -1418,6 +1419,8 @@ void MainFrame::create_main_menu( GtkWidget *window, GtkWidget *vbox ){ GTK_SIGNAL_FUNC( HandleCommand ), ID_COLORS_CLIPPER ); create_menu_item_with_mnemonic( menu_in_menu, _( "Active View name..." ), GTK_SIGNAL_FUNC( HandleCommand ), ID_COLORS_VIEWNAME ); + create_menu_item_with_mnemonic( menu_in_menu, _( "Detail brushes..." ), + GTK_SIGNAL_FUNC( HandleCommand ), ID_COLORS_DETAIL ); create_menu_item_with_mnemonic( menu, _( "_Gamma..." ), GTK_SIGNAL_FUNC( HandleCommand ), ID_MISC_GAMMA ); @@ -5884,6 +5887,10 @@ void MainFrame::OnColorSetoriginal(){ g_qeglobals.d_savedinfo.colors[COLOR_SELBRUSHES3D][1] = 0.0f; g_qeglobals.d_savedinfo.colors[COLOR_SELBRUSHES3D][2] = 0.0f; + g_qeglobals.d_savedinfo.colors[COLOR_DETAIL][0] = 0.0f; + g_qeglobals.d_savedinfo.colors[COLOR_DETAIL][1] = 0.0f; + g_qeglobals.d_savedinfo.colors[COLOR_DETAIL][2] = 0.0f; + g_PrefsDlg.SavePrefs(); Sys_UpdateWindows( W_ALL ); } @@ -6088,6 +6095,11 @@ void MainFrame::OnColorsViewname(){ Sys_UpdateWindows( W_ALL ); } +void MainFrame::OnColorsDetail(){ + DoColor( COLOR_DETAIL ); + Sys_UpdateWindows( W_ALL ); +} + void MainFrame::OnMiscGamma(){ float fSave = g_qeglobals.d_savedinfo.fGamma; DoGamma(); diff --git a/radiant/mainframe.h b/radiant/mainframe.h index 73f8ccee..5c3b65bd 100644 --- a/radiant/mainframe.h +++ b/radiant/mainframe.h @@ -105,6 +105,7 @@ struct SKeyInfo #define ID_COLORS_CLIPPER 32836 #define ID_COLORS_GRIDBLOCK 32837 #define ID_COLORS_VIEWNAME 32838 +#define ID_COLORS_DETAIL 37002 #define ID_COLOR_SETORIGINAL 32839 #define ID_COLOR_SETQER 32840 #define ID_COLOR_SETBLACK 32841 @@ -735,6 +736,7 @@ void OnColorsSelectedbrush3D(); void OnColorsCameraBack(); void OnColorsGridblock(); void OnColorsViewname(); +void OnColorsDetail(); void OnColorSetoriginal(); void OnColorSetqer(); void OnColorSetblack(); diff --git a/radiant/xywindow.cpp b/radiant/xywindow.cpp index 560eb8fe..179e130c 100644 --- a/radiant/xywindow.cpp +++ b/radiant/xywindow.cpp @@ -2856,6 +2856,11 @@ void XYWnd::XY_Draw(){ qglColor3fv( g_qeglobals.d_savedinfo.colors[COLOR_BRUSHES] ); } + //Color detail brushes differently + if ( brush->brush_faces->texdef.contents & CONTENTS_DETAIL ) { + qglColor3fv( g_qeglobals.d_savedinfo.colors[COLOR_DETAIL] ); + } + #ifdef DBG_SCENEDUMP if ( bDump ) { Sys_FPrintf( SYS_WRN, "Active brush: %p ", brush ); From a1fd52a8c2f1a1b23ad1dca70556caa24233ea4f Mon Sep 17 00:00:00 2001 From: Josh Steffen Date: Thu, 15 Jan 2015 11:08:46 -0500 Subject: [PATCH 2/4] Changed 'Detail brushes...' to 'Detail Brush...' for consistency --- radiant/mainframe.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/radiant/mainframe.cpp b/radiant/mainframe.cpp index e84c47a7..55ca61be 100644 --- a/radiant/mainframe.cpp +++ b/radiant/mainframe.cpp @@ -1419,7 +1419,7 @@ void MainFrame::create_main_menu( GtkWidget *window, GtkWidget *vbox ){ GTK_SIGNAL_FUNC( HandleCommand ), ID_COLORS_CLIPPER ); create_menu_item_with_mnemonic( menu_in_menu, _( "Active View name..." ), GTK_SIGNAL_FUNC( HandleCommand ), ID_COLORS_VIEWNAME ); - create_menu_item_with_mnemonic( menu_in_menu, _( "Detail brushes..." ), + create_menu_item_with_mnemonic( menu_in_menu, _( "Detail Brush..." ), GTK_SIGNAL_FUNC( HandleCommand ), ID_COLORS_DETAIL ); create_menu_item_with_mnemonic( menu, _( "_Gamma..." ), From c55e2601142fd3dbfc3adc2098c307345ed1b0c7 Mon Sep 17 00:00:00 2001 From: Josh Steffen Date: Thu, 15 Jan 2015 15:54:54 -0500 Subject: [PATCH 3/4] only color detail brush if it's not part of an entity --- radiant/xywindow.cpp | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/radiant/xywindow.cpp b/radiant/xywindow.cpp index 179e130c..7b07ba99 100644 --- a/radiant/xywindow.cpp +++ b/radiant/xywindow.cpp @@ -2851,16 +2851,15 @@ void XYWnd::XY_Draw(){ if ( brush->owner != e && brush->owner ) { qglColor3fv( brush->owner->eclass->color ); } + else if ( brush->brush_faces->texdef.contents & CONTENTS_DETAIL ) + { + qglColor3fv( g_qeglobals.d_savedinfo.colors[COLOR_DETAIL] ); + } else { qglColor3fv( g_qeglobals.d_savedinfo.colors[COLOR_BRUSHES] ); } - //Color detail brushes differently - if ( brush->brush_faces->texdef.contents & CONTENTS_DETAIL ) { - qglColor3fv( g_qeglobals.d_savedinfo.colors[COLOR_DETAIL] ); - } - #ifdef DBG_SCENEDUMP if ( bDump ) { Sys_FPrintf( SYS_WRN, "Active brush: %p ", brush ); From 805ceb9df679e66ff4cafcadcf56168fd2476e06 Mon Sep 17 00:00:00 2001 From: Josh Steffen Date: Fri, 16 Jan 2015 17:10:09 -0500 Subject: [PATCH 4/4] brace alignment --- radiant/xywindow.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/radiant/xywindow.cpp b/radiant/xywindow.cpp index 7b07ba99..e4f0b27e 100644 --- a/radiant/xywindow.cpp +++ b/radiant/xywindow.cpp @@ -2852,7 +2852,7 @@ void XYWnd::XY_Draw(){ qglColor3fv( brush->owner->eclass->color ); } else if ( brush->brush_faces->texdef.contents & CONTENTS_DETAIL ) - { + { qglColor3fv( g_qeglobals.d_savedinfo.colors[COLOR_DETAIL] ); } else