From a9509d54dcf64eecf9b8741bf853b68b5936ab3d Mon Sep 17 00:00:00 2001 From: mpohoreski Date: Thu, 16 Dec 2010 06:41:41 +0000 Subject: [PATCH] 2.7.0.0 Split from Debug.h --- AppleWin/source/Debugger/Debugger_Color.cpp | 149 ++++++++++++++++++++ AppleWin/source/Debugger/Debugger_Color.h | 134 ++++++++++++++++++ 2 files changed, 283 insertions(+) create mode 100644 AppleWin/source/Debugger/Debugger_Color.cpp create mode 100644 AppleWin/source/Debugger/Debugger_Color.h diff --git a/AppleWin/source/Debugger/Debugger_Color.cpp b/AppleWin/source/Debugger/Debugger_Color.cpp new file mode 100644 index 00000000..859f1626 --- /dev/null +++ b/AppleWin/source/Debugger/Debugger_Color.cpp @@ -0,0 +1,149 @@ +/* +AppleWin : An Apple //e emulator for Windows +Copyright (C) 2009-2010, Michael Pohoreski +*/ + +#include "StdAfx.h" + +// Color ______________________________________________________________________ + + int g_iColorScheme = SCHEME_COLOR; + + // Used when the colors are reset + COLORREF g_aColorPalette[ NUM_PALETTE ] = + { + RGB(0,0,0), + // NOTE: See _SetupColorRamp() if you want to programmitically set/change + RGB(255, 0, 0), RGB(223, 0, 0), RGB(191, 0, 0), RGB(159, 0, 0), RGB(127, 0, 0), RGB( 95, 0, 0), RGB( 63, 0, 0), RGB( 31, 0, 0), // 001 // Red + RGB( 0,255, 0), RGB( 0,223, 0), RGB( 0,191, 0), RGB( 0,159, 0), RGB( 0,127, 0), RGB( 0, 95, 0), RGB( 0, 63, 0), RGB( 0, 31, 0), // 010 // Green + RGB(255,255, 0), RGB(223,223, 0), RGB(191,191, 0), RGB(159,159, 0), RGB(127,127, 0), RGB( 95, 95, 0), RGB( 63, 63, 0), RGB( 31, 31, 0), // 011 // Yellow + RGB( 0, 0,255), RGB( 0, 0,223), RGB( 0, 0,191), RGB( 0, 0,159), RGB( 0, 0,127), RGB( 0, 0, 95), RGB( 0, 0, 63), RGB( 0, 0, 31), // 100 // Blue + RGB(255, 0,255), RGB(223, 0,223), RGB(191, 0,191), RGB(159, 0,159), RGB(127, 0,127), RGB( 95, 0, 95), RGB( 63, 0, 63), RGB( 31, 0, 31), // 101 // Magenta + RGB( 0,255,255), RGB( 0,223,223), RGB( 0,191,191), RGB( 0,159,159), RGB( 0,127,127), RGB( 0, 95, 95), RGB( 0, 63, 63), RGB( 0, 31, 31), // 110 // Cyan + RGB(255,255,255), RGB(223,223,223), RGB(191,191,191), RGB(159,159,159), RGB(127,127,127), RGB( 95, 95, 95), RGB( 63, 63, 63), RGB( 31, 31, 31), // 111 // White/Gray + + // Custom Colors + RGB( 80,192,255), // Light Sky Blue // Used for console FG + RGB( 0,128,192), // Darker Sky Blue + RGB( 0, 64,128), // Deep Sky Blue + RGB(255,128, 0), // Orange (Full) + RGB(128, 64, 0), // Orange (Half) + RGB( 0, 0, 0), + RGB( 0, 0, 0), + RGB( 0, 0, 0), + + RGB( 0, 0, 0), + RGB( 0, 0, 0), + RGB( 0, 0, 0), + RGB( 0, 0, 0), + RGB( 0, 0, 0), + RGB( 0, 0, 0), + RGB( 0, 0, 0), + RGB( 0, 0, 0), + }; + +// ZZZ: TODO: FIXME!!! + // Index into "Palette" of colors + // Move to Debugger_Colors.cpp !!! +// ZZZ: TODO: FIXME!!! + int g_aColorIndex[ NUM_DEBUG_COLORS ] = + { + K0, W8, // BG_CONSOLE_OUTPUT FG_CONSOLE_OUTPUT (W8) + B1, COLOR_CUSTOM_01, // BG_CONSOLE_INPUT FG_CONSOLE_INPUT (W8) + + B2, // BG_DISASM_1 + B3, // BG_DISASM_2 + + R8, W8, // BG_DISASM_BP_S_C FG_DISASM_BP_S_C + R6, W5, // BG_DISASM_BP_0_C FG_DISASM_BP_0_C + + R7, // FG_DISASM_BP_S_X // Y8 lookes better on Info Cyan // R6 + W5, // FG_DISASM_BP_0_X + + W8, K0, // BG_DISASM_C FG_DISASM_C // B8 -> K0 + Y8, K0, // BG_DISASM_PC_C FG_DISASM_PC_C // K8 -> K0 + Y4, W8, // BG_DISASM_PC_X FG_DISASM_PC_X + + C4, W8, // BG_DISASM_BOOKMARK FG_DISASM_BOOKMARK + + W8, // FG_DISASM_ADDRESS + G192, // FG_DISASM_OPERATOR + Y8, // FG_DISASM_OPCODE + W8, // FG_DISASM_MNEMONIC + M8, // FG_DISASM_DIRECTIVE + COLOR_CUSTOM_04, // FG_DISASM_TARGET (or W8) + G8, // FG_DISASM_SYMBOL + C8, // FG_DISASM_CHAR + G8, // FG_DISASM_BRANCH + + C3, // BG_INFO (C4, C2 too dark) + W8, // FG_INFO_TITLE (or W8) + Y7, // FG_INFO_BULLET (W8) + G192, // FG_INFO_OPERATOR + COLOR_CUSTOM_04, // FG_INFO_ADDRESS (was Y8) + Y8, // FG_INFO_OPCODE + COLOR_CUSTOM_01, // FG_INFO_REG (was orange) + + W8, C3, // BG_INFO_INVERSE FG_INFO_INVERSE + C5, // BG_INFO_CHAR + W8, // FG_INFO_CHAR_HI + Y8, // FG_INFO_CHAR_LO + + COLOR_CUSTOM_04, // BG_INFO_IO_BYTE + COLOR_CUSTOM_04, // FG_INFO_IO_BYTE + + C2, // BG_DATA_1 + C3, // BG_DATA_2 + Y8, // FG_DATA_BYTE + W8, // FG_DATA_TEXT + + G4, // BG_SYMBOLS_1 + G3, // BG_SYMBOLS_2 + W8, // FG_SYMBOLS_ADDRESS + M8, // FG_SYMBOLS_NAME + + K0, // BG_SOURCE_TITLE + W8, // FG_SOURCE_TITLE + W2, // BG_SOURCE_1 // C2 W2 for "Paper Look" + W3, // BG_SOURCE_2 + W8 // FG_SOURCE + }; + + COLORREF g_aColors[ NUM_COLOR_SCHEMES ][ NUM_DEBUG_COLORS ]; + + COLORREF DebuggerGetColor ( int iColor ); + + +//=========================================================================== +inline COLORREF DebuggerGetColor( int iColor ) +{ + COLORREF nColor = RGB(0,255,255); // 0xFFFF00; // Hot Pink! -- so we notice errors. Not that there is anything wrong with pink... + + if ((g_iColorScheme < NUM_COLOR_SCHEMES) && (iColor < NUM_DEBUG_COLORS)) + { + nColor = g_aColors[ g_iColorScheme ][ iColor ]; + } + + return nColor; +} + + +bool DebuggerSetColor( const int iScheme, const int iColor, const COLORREF nColor ) +{ + bool bStatus = false; + if ((g_iColorScheme < NUM_COLOR_SCHEMES) && (iColor < NUM_DEBUG_COLORS)) + { + g_aColors[ iScheme ][ iColor ] = nColor; + bStatus = true; + } + + // Propogate to console since it has its own copy of colors + if (iColor == FG_CONSOLE_OUTPUT) + { + COLORREF nConsole = DebuggerGetColor( FG_CONSOLE_OUTPUT ); + g_anConsoleColor[ CONSOLE_COLOR_x ] = nConsole; + } + + return bStatus; +} + diff --git a/AppleWin/source/Debugger/Debugger_Color.h b/AppleWin/source/Debugger/Debugger_Color.h new file mode 100644 index 00000000..e098add4 --- /dev/null +++ b/AppleWin/source/Debugger/Debugger_Color.h @@ -0,0 +1,134 @@ +// Colors ___________________________________________________________________ + + enum Color_Schemes_e + { + SCHEME_COLOR, // NOTE: MUST match order in CMD_WINDOW_COLOR + SCHEME_MONO , // NOTE: MUST match order in CMD_WINDOW_MONOCHROME + SCHEME_BW , // NOTE: MUST match order in CMD_WINDOW_BW +// SCHEME_CUSTOM + NUM_COLOR_SCHEMES + }; + + // Named, since they are easier to remember. + // Ok, maybe RGB + CYMK is a little "too" cute. But what the hell, it works out nicely. + enum DebugPalette_e + { + // mipmap level: 8 7 6 5 4 3 2 1 0 + // color depth: 256 224 192 160 128 96 64 32 0 + // +32 +32 +32 +32 +32 +32 +32 +32 + // NOTE: Levels of black are redundant. + // // BGR + K0, // --- K + R8, R7, R6, R5, R4, R3, R2, R1, // --1 R Red + G8, G7, G6, G5, G4, G3, G2, G1, // -1- G Green + Y8, Y7, Y6, Y5, Y4, Y3, Y2, Y1, // -11 Y Yellow + B8, B7, B6, B5, B4, B3, B2, B1, // 1-- B Blue + M8, M7, M6, M5, M4, M3, M2, M1, // 1-1 M Magenta + C8, C7, C6, C5, C4, C3, C2, C1, // 11- C Cyan + W8, W7, W6, W5, W4, W3, W2, W1, // 111 W White / Gray / Black + + COLOR_CUSTOM_01, COLOR_CUSTOM_02, COLOR_CUSTOM_03, COLOR_CUSTOM_04, + COLOR_CUSTOM_05, COLOR_CUSTOM_06, COLOR_CUSTOM_07, COLOR_CUSTOM_08, + COLOR_CUSTOM_09, COLOR_CUSTOM_11, CUSTOM_COLOR_11, COLOR_CUSTOM_12, + COLOR_CUSTOM_13, COLOR_CUSTOM_14, COLOR_CUSTOM_15, COLOR_CUSTOM_16, + + NUM_PALETTE, + + // Gray Aliases + G000 = K0, + G032 = W1, + G064 = W2, + G096 = W3, + G128 = W4, + G160 = W5, + G192 = W6, + G224 = W7, + G256 = W8 + }; + + // Yeah, this was a PITA to organize. +// + enum DebugColors_e + { + BG_CONSOLE_OUTPUT // Black Window + , FG_CONSOLE_OUTPUT // White + , BG_CONSOLE_INPUT // Black Window + , FG_CONSOLE_INPUT // Light Blue + + , BG_DISASM_1 // Blue* Odd address + , BG_DISASM_2 // Blue* Even address +// BreakPoint {Set} {Cursor/Non-Cursor} + , BG_DISASM_BP_S_C // Red Breakpoint Set (cursor) + , FG_DISASM_BP_S_C // White Breakpoint Set&Ena (cursor) + + // Note: redundant BG_DISASM_BP_0_C = BG_DISASM_BP_S_C + , BG_DISASM_BP_0_C // DimRed Breakpoint Disabled (cursor) + , FG_DISASM_BP_0_C // Gray192 Breakpoint Disabled (cursor) + + , FG_DISASM_BP_S_X // Red Set (not cursor) + , FG_DISASM_BP_0_X // White Disabled (not cursor) + + , BG_DISASM_C // White (Cursor) + , FG_DISASM_C // Blue (Cursor) + + , BG_DISASM_PC_C // Yellow (not cursor) + , FG_DISASM_PC_C // White (not cursor) + + , BG_DISASM_PC_X // Dim Yellow (not cursor) + , FG_DISASM_PC_X // White (not cursor) + + , BG_DISASM_BOOKMARK // Lite Blue (always) + , FG_DISASM_BOOKMARK // White addr (always) + + , FG_DISASM_ADDRESS // White addr + , FG_DISASM_OPERATOR // Gray192 : $ (also around instruction addressing g_nAppMode) + , FG_DISASM_OPCODE // Yellow xx xx xx + , FG_DISASM_MNEMONIC // White LDA +/*ZZZ*/ , FG_DISASM_DIRECTIVE// Purple db + , FG_DISASM_TARGET // Orange FAC8 +/*ZZZ*/ , FG_DISASM_SYMBOL // Green HOME + , FG_DISASM_CHAR // Cyan 'c' + , FG_DISASM_BRANCH // Green ^ = v + + , BG_INFO // Cyan Regs/Stack/BP/Watch/ZP + , FG_INFO_TITLE // White Regs/Stack/BP/Watch/ZP + , FG_INFO_BULLET // 1 + , FG_INFO_OPERATOR // Gray192 : - + , FG_INFO_ADDRESS // Orange FA62 FA63 (Yellow -> Orange) + , FG_INFO_OPCODE // Yellow xx + , FG_INFO_REG // Orange (Breakpoints) + , BG_INFO_INVERSE // White + , FG_INFO_INVERSE // Cyan + , BG_INFO_CHAR // mid Cyan + , FG_INFO_CHAR_HI // White + , FG_INFO_CHAR_LO // Yellow + + , BG_INFO_IO_BYTE // Orange (high bit) + , FG_INFO_IO_BYTE // Orange (non-high bit) + + , BG_DATA_1 // Cyan* Window + , BG_DATA_2 // Cyan* + , FG_DATA_BYTE // default same as FG_DISASM_OPCODE + , FG_DATA_TEXT // default same as FG_DISASM_NMEMONIC + + , BG_SYMBOLS_1 // window + , BG_SYMBOLS_2 + , FG_SYMBOLS_ADDRESS // default same as FG_DISASM_ADDRESS + , FG_SYMBOLS_NAME // default same as FG_DISASM_SYMBOL + + , BG_SOURCE_TITLE + , FG_SOURCE_TITLE + , BG_SOURCE_1 // odd + , BG_SOURCE_2 // even + , FG_SOURCE + + , NUM_DEBUG_COLORS + }; + + extern int g_iColorScheme; + extern COLORREF g_aColorPalette[ NUM_PALETTE ]; + extern int g_aColorIndex[ NUM_DEBUG_COLORS ]; + +// Color + inline COLORREF DebuggerGetColor( int iColor ); + bool DebuggerSetColor ( const int iScheme, const int iColor, const COLORREF nColor );