From f4b5aa5fa513d397f947b6f59d914e8ef6937b1a Mon Sep 17 00:00:00 2001 From: michaelangel007 Date: Thu, 27 Apr 2017 09:30:08 -0700 Subject: [PATCH] Cleanup via factor out _DrawSoftSwitchHighlight() --- source/Debugger/Debugger_Display.cpp | 34 +++++++++++++++++++--------- 1 file changed, 23 insertions(+), 11 deletions(-) diff --git a/source/Debugger/Debugger_Display.cpp b/source/Debugger/Debugger_Display.cpp index a075f646..e5f42931 100644 --- a/source/Debugger/Debugger_Display.cpp +++ b/source/Debugger/Debugger_Display.cpp @@ -2720,9 +2720,28 @@ void DrawRegisters ( int line ) DrawRegister( line++, sReg[ BP_SRC_REG_S ] , 2, regs.sp, PARAM_REG_SP ); } + +// 2.9.0.3 +//=========================================================================== +void _DrawSoftSwitchHighlight( RECT & temp, bool bSet, const char *sOn, const char *sOff, int bg = BG_INFO ) +{ +// DebuggerSetColorBG( DebuggerGetColor( bg ) ); // BG_INFO + + ColorizeFlags( bSet, bg ); + PrintTextCursorX( sOn, temp ); + + DebuggerSetColorBG( DebuggerGetColor( bg ) ); // BG_INFO + DebuggerSetColorFG( DebuggerGetColor( FG_DISASM_OPERATOR ) ); + PrintTextCursorX( "/", temp ); + + ColorizeFlags( !bSet, bg ); + PrintTextCursorX( sOff, temp ); +} + + // 2.7.0.7 Cleaned up display of soft-switches to show address. //=========================================================================== -void _DrawSoftSwitch( RECT & rect, int nAddress, bool bSet, char *sPrefix, char *sOn, char *sOff, const char *sSuffix = NULL ) +void _DrawSoftSwitch( RECT & rect, int nAddress, bool bSet, char *sPrefix, char *sOn, char *sOff, const char *sSuffix = NULL, int bg_default = BG_INFO ) { RECT temp = rect; char sText[ 4 ] = ""; @@ -2739,17 +2758,10 @@ void _DrawSoftSwitch( RECT & rect, int nAddress, bool bSet, char *sPrefix, char if( sPrefix ) PrintTextCursorX( sPrefix, temp ); - ColorizeFlags( bSet ); - PrintTextCursorX( sOn, temp ); + // 2.9.0.3 + _DrawSoftSwitchHighlight( temp, bSet, sOn, sOff, bg_default ); - DebuggerSetColorBG( DebuggerGetColor( BG_INFO )); - DebuggerSetColorFG( DebuggerGetColor( FG_DISASM_OPERATOR ) ); - PrintTextCursorX( "/", temp ); - - ColorizeFlags( !bSet ); - PrintTextCursorX( sOff, temp ); - - DebuggerSetColorBG( DebuggerGetColor( BG_INFO )); + DebuggerSetColorBG( DebuggerGetColor( bg_default )); DebuggerSetColorFG( DebuggerGetColor( FG_INFO_TITLE )); if ( sSuffix ) PrintTextCursorX( sSuffix, temp );