mirror of
https://github.com/cemu-project/Cemu.git
synced 2025-12-16 04:36:59 +00:00
UI: Fix some light themed elements in input window when using dark mode
This commit is contained in:
parent
72b4d521cf
commit
e60f1666bd
6 changed files with 57 additions and 50 deletions
|
|
@ -21,33 +21,35 @@ void wxInputDraw::OnRender(wxDC& dc)
|
||||||
{
|
{
|
||||||
dc.Clear();
|
dc.Clear();
|
||||||
|
|
||||||
glm::vec2 position;
|
glm::vec2 position = m_position;
|
||||||
const wxPen *black, *red, *grey;
|
|
||||||
const wxBrush *black_brush, *red_brush, *grey_brush;
|
|
||||||
if(IsEnabled())
|
|
||||||
{
|
|
||||||
position = m_position;
|
|
||||||
|
|
||||||
black = wxBLACK_PEN;
|
wxPen black = wxPen(wxSystemSettings::GetColour(wxSYS_COLOUR_WINDOWTEXT));
|
||||||
red = wxRED_PEN;
|
wxPen red = *wxRED_PEN;
|
||||||
grey = wxGREY_PEN;
|
wxPen grey = wxPen(wxSystemSettings::GetColour(wxSYS_COLOUR_GRAYTEXT));
|
||||||
|
wxPen green = wxSystemSettings::SelectLightDark(0x336600, 0x99FF99);
|
||||||
|
|
||||||
black_brush = wxBLACK_BRUSH;
|
wxBrush black_brush = wxSystemSettings::GetColour(wxSYS_COLOUR_WINDOWTEXT);
|
||||||
red_brush = wxRED_BRUSH;
|
wxBrush red_brush = *wxRED_BRUSH;
|
||||||
grey_brush = wxGREY_BRUSH;
|
wxBrush grey_brush = wxSystemSettings::GetColour(wxSYS_COLOUR_GRAYTEXT);
|
||||||
}
|
wxBrush green_brush = wxSystemSettings::SelectLightDark(0x336600, 0x99FF99);
|
||||||
else
|
|
||||||
|
if(!IsEnabled())
|
||||||
{
|
{
|
||||||
position = {};
|
position = {};
|
||||||
black = red = wxMEDIUM_GREY_PEN;
|
black.SetColour(black.GetColour());
|
||||||
grey = wxLIGHT_GREY_PEN;
|
red.SetColour(wxSystemSettings::GetColour(wxSYS_COLOUR_GRAYTEXT));
|
||||||
|
grey.SetColour(wxSystemSettings::GetColour(wxSYS_COLOUR_GRAYTEXT).MakeDisabled());
|
||||||
|
|
||||||
black_brush = red_brush = wxMEDIUM_GREY_BRUSH;
|
black_brush = wxSystemSettings::GetColour(wxSYS_COLOUR_GRAYTEXT);
|
||||||
grey_brush = wxLIGHT_GREY_BRUSH;
|
red_brush = wxSystemSettings::GetColour(wxSYS_COLOUR_GRAYTEXT).MakeDisabled();
|
||||||
|
grey_brush = wxSystemSettings::GetColour(wxSYS_COLOUR_GRAYTEXT).MakeDisabled();
|
||||||
}
|
}
|
||||||
|
|
||||||
dc.SetBackgroundMode(wxSOLID);
|
dc.SetBackgroundMode(wxSOLID);
|
||||||
dc.SetBackground(*wxWHITE_BRUSH);
|
dc.SetBackground(wxSystemSettings::GetColour(wxSYS_COLOUR_WINDOW));
|
||||||
|
dc.SetPen(wxSystemSettings::GetColour(wxSYS_COLOUR_WINDOW));
|
||||||
|
dc.SetBrush(wxSystemSettings::GetColour(wxSYS_COLOUR_WINDOW));
|
||||||
|
dc.Clear();
|
||||||
|
|
||||||
const auto size = GetSize();
|
const auto size = GetSize();
|
||||||
const auto min_size = (float)std::min(size.GetWidth(), size.GetHeight()) - 1.0f;
|
const auto min_size = (float)std::min(size.GetWidth(), size.GetHeight()) - 1.0f;
|
||||||
|
|
@ -55,16 +57,16 @@ void wxInputDraw::OnRender(wxDC& dc)
|
||||||
|
|
||||||
// border
|
// border
|
||||||
const wxRect border{0, 0, (int)min_size, (int)min_size};
|
const wxRect border{0, 0, (int)min_size, (int)min_size};
|
||||||
dc.SetPen(*black);
|
dc.SetPen(wxSystemSettings::GetColour(wxSYS_COLOUR_GRAYTEXT));
|
||||||
dc.DrawRectangle(border);
|
dc.DrawRectangle(border);
|
||||||
|
|
||||||
dc.SetPen(IsEnabled() ? wxPen(wxColour(0x336600)) : *grey); // dark green
|
dc.SetPen(IsEnabled() ? green.GetColour() : grey.GetColour());
|
||||||
dc.DrawCircle((int)middle.x, (int)middle.y, (int)middle.x);
|
dc.DrawCircle((int)middle.x, (int)middle.y, (int)middle.x);
|
||||||
|
|
||||||
if (m_deadzone > 0)
|
if (m_deadzone > 0)
|
||||||
{
|
{
|
||||||
dc.SetPen(*grey);
|
dc.SetPen(grey);
|
||||||
dc.SetBrush(*wxLIGHT_GREY_BRUSH);
|
dc.SetBrush(grey_brush);
|
||||||
const auto deadzone_size = m_deadzone * min_size / 2.0f;
|
const auto deadzone_size = m_deadzone * min_size / 2.0f;
|
||||||
dc.DrawCircle(
|
dc.DrawCircle(
|
||||||
static_cast<int>(middle.x),
|
static_cast<int>(middle.x),
|
||||||
|
|
@ -73,25 +75,25 @@ void wxInputDraw::OnRender(wxDC& dc)
|
||||||
|
|
||||||
if (length(position) >= m_deadzone)
|
if (length(position) >= m_deadzone)
|
||||||
{
|
{
|
||||||
dc.SetPen(*red);
|
dc.SetPen(red);
|
||||||
dc.SetBrush(*red_brush);
|
dc.SetBrush(red_brush);
|
||||||
|
|
||||||
if (std::abs(1.0f - length(position)) < 0.05f)
|
if (std::abs(1.0f - length(position)) < 0.05f)
|
||||||
{
|
{
|
||||||
dc.SetPen(wxPen(wxColour(0x336600)));
|
dc.SetPen(green);
|
||||||
dc.SetBrush(wxColour(0x336600));
|
dc.SetBrush(green_brush);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
dc.SetPen(*black);
|
dc.SetPen(black);
|
||||||
dc.SetBrush(*black_brush);
|
dc.SetBrush(black_brush);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
dc.SetPen(*red);
|
dc.SetPen(red);
|
||||||
dc.SetBrush(*red_brush);
|
dc.SetBrush(red_brush);
|
||||||
}
|
}
|
||||||
|
|
||||||
// draw axis
|
// draw axis
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,8 @@
|
||||||
#include "wxgui/wxgui.h"
|
#include "wxgui/wxgui.h"
|
||||||
#include "wxgui/debugger/DebuggerWindow2.h"
|
#include "wxgui/debugger/DebuggerWindow2.h"
|
||||||
|
|
||||||
|
#include "wxHelper.h"
|
||||||
|
|
||||||
#include <filesystem>
|
#include <filesystem>
|
||||||
|
|
||||||
#include "config/ActiveSettings.h"
|
#include "config/ActiveSettings.h"
|
||||||
|
|
@ -220,20 +222,20 @@ void DebuggerWindow2::CreateToolBar()
|
||||||
m_toolbar = wxFrame::CreateToolBar(wxTB_HORIZONTAL, wxID_ANY);
|
m_toolbar = wxFrame::CreateToolBar(wxTB_HORIZONTAL, wxID_ANY);
|
||||||
m_toolbar->SetToolBitmapSize(wxSize(16, 16));
|
m_toolbar->SetToolBitmapSize(wxSize(16, 16));
|
||||||
|
|
||||||
wxBitmap goto_bitmap = LoadThemedBitmapFromPNG(DEBUGGER_GOTO_png, sizeof(DEBUGGER_GOTO_png), wxSystemSettings::GetColour(wxSYS_COLOUR_WINDOWTEXT));
|
wxBitmap goto_bitmap = wxHelper::LoadThemedBitmapFromPNG(DEBUGGER_GOTO_png, sizeof(DEBUGGER_GOTO_png), wxSystemSettings::GetColour(wxSYS_COLOUR_WINDOWTEXT));
|
||||||
m_toolbar->AddTool(TOOL_ID_GOTO, wxEmptyString, goto_bitmap, wxNullBitmap, wxITEM_NORMAL, _("GoTo (CTRL + G)"), "test", NULL);
|
m_toolbar->AddTool(TOOL_ID_GOTO, wxEmptyString, goto_bitmap, wxNullBitmap, wxITEM_NORMAL, _("GoTo (CTRL + G)"), "test", NULL);
|
||||||
m_toolbar->AddSeparator();
|
m_toolbar->AddSeparator();
|
||||||
|
|
||||||
wxBitmap bp_bitmap = LoadThemedBitmapFromPNG(DEBUGGER_BP_RED_png, sizeof(DEBUGGER_BP_RED_png), wxSystemSettings::GetColour(wxSYS_COLOUR_WINDOWTEXT));
|
wxBitmap bp_bitmap = wxHelper::LoadThemedBitmapFromPNG(DEBUGGER_BP_RED_png, sizeof(DEBUGGER_BP_RED_png), wxSystemSettings::GetColour(wxSYS_COLOUR_WINDOWTEXT));
|
||||||
m_toolbar->AddTool(TOOL_ID_BP, wxEmptyString, bp_bitmap, wxNullBitmap, wxITEM_NORMAL, _("Toggle Breakpoint (F9)"), wxEmptyString, NULL);
|
m_toolbar->AddTool(TOOL_ID_BP, wxEmptyString, bp_bitmap, wxNullBitmap, wxITEM_NORMAL, _("Toggle Breakpoint (F9)"), wxEmptyString, NULL);
|
||||||
m_toolbar->AddSeparator();
|
m_toolbar->AddSeparator();
|
||||||
|
|
||||||
m_pause = LoadThemedBitmapFromPNG(DEBUGGER_PAUSE_png, sizeof(DEBUGGER_PAUSE_png), wxSystemSettings::GetColour(wxSYS_COLOUR_WINDOWTEXT));
|
m_pause = wxHelper::LoadThemedBitmapFromPNG(DEBUGGER_PAUSE_png, sizeof(DEBUGGER_PAUSE_png), wxSystemSettings::GetColour(wxSYS_COLOUR_WINDOWTEXT));
|
||||||
m_run = LoadThemedBitmapFromPNG(DEBUGGER_PLAY_png, sizeof(DEBUGGER_PLAY_png), wxSystemSettings::GetColour(wxSYS_COLOUR_WINDOWTEXT));
|
m_run = wxHelper::LoadThemedBitmapFromPNG(DEBUGGER_PLAY_png, sizeof(DEBUGGER_PLAY_png), wxSystemSettings::GetColour(wxSYS_COLOUR_WINDOWTEXT));
|
||||||
m_toolbar->AddTool(TOOL_ID_PAUSE, wxEmptyString, m_pause, wxNullBitmap, wxITEM_NORMAL, _("Break (F5)"), wxEmptyString, NULL);
|
m_toolbar->AddTool(TOOL_ID_PAUSE, wxEmptyString, m_pause, wxNullBitmap, wxITEM_NORMAL, _("Break (F5)"), wxEmptyString, NULL);
|
||||||
|
|
||||||
wxBitmap step_into_bitmap = LoadThemedBitmapFromPNG(DEBUGGER_STEP_INTO_png, sizeof(DEBUGGER_STEP_INTO_png), wxSystemSettings::GetColour(wxSYS_COLOUR_WINDOWTEXT));
|
wxBitmap step_into_bitmap = wxHelper::LoadThemedBitmapFromPNG(DEBUGGER_STEP_INTO_png, sizeof(DEBUGGER_STEP_INTO_png), wxSystemSettings::GetColour(wxSYS_COLOUR_WINDOWTEXT));
|
||||||
wxBitmap step_over_bitmap = LoadThemedBitmapFromPNG(DEBUGGER_STEP_OVER_png, sizeof(DEBUGGER_STEP_OVER_png), wxSystemSettings::GetColour(wxSYS_COLOUR_WINDOWTEXT));
|
wxBitmap step_over_bitmap = wxHelper::LoadThemedBitmapFromPNG(DEBUGGER_STEP_OVER_png, sizeof(DEBUGGER_STEP_OVER_png), wxSystemSettings::GetColour(wxSYS_COLOUR_WINDOWTEXT));
|
||||||
m_toolbar->AddTool(TOOL_ID_STEP_INTO, wxEmptyString, step_into_bitmap, wxNullBitmap, wxITEM_NORMAL, _("Step Into (F11)"), wxEmptyString, NULL);
|
m_toolbar->AddTool(TOOL_ID_STEP_INTO, wxEmptyString, step_into_bitmap, wxNullBitmap, wxITEM_NORMAL, _("Step Into (F11)"), wxEmptyString, NULL);
|
||||||
m_toolbar->AddTool(TOOL_ID_STEP_OVER, wxEmptyString, step_over_bitmap, wxNullBitmap, wxITEM_NORMAL, _("Step Over (F10)"), wxEmptyString, NULL);
|
m_toolbar->AddTool(TOOL_ID_STEP_OVER, wxEmptyString, step_over_bitmap, wxNullBitmap, wxITEM_NORMAL, _("Step Over (F10)"), wxEmptyString, NULL);
|
||||||
m_toolbar->AddSeparator();
|
m_toolbar->AddSeparator();
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,7 @@
|
||||||
#include "wxgui/wxgui.h"
|
#include "wxgui/wxgui.h"
|
||||||
#include "wxgui/debugger/DisasmCtrl.h"
|
#include "wxgui/debugger/DisasmCtrl.h"
|
||||||
|
|
||||||
|
#include "wxHelper.h"
|
||||||
#include "Cafe/OS/RPL/rpl_structs.h"
|
#include "Cafe/OS/RPL/rpl_structs.h"
|
||||||
#include "Cafe/OS/RPL/rpl.h"
|
#include "Cafe/OS/RPL/rpl.h"
|
||||||
#include "Cafe/OS/RPL/rpl_symbol_storage.h"
|
#include "Cafe/OS/RPL/rpl_symbol_storage.h"
|
||||||
|
|
@ -12,7 +13,6 @@
|
||||||
|
|
||||||
#include "Cemu/ExpressionParser/ExpressionParser.h"
|
#include "Cemu/ExpressionParser/ExpressionParser.h"
|
||||||
#include "Cafe/HW/Espresso/Debugger/DebugSymbolStorage.h"
|
#include "Cafe/HW/Espresso/Debugger/DebugSymbolStorage.h"
|
||||||
#include <wx/mstream.h> // for wxMemoryInputStream
|
|
||||||
|
|
||||||
wxDEFINE_EVENT(wxEVT_DISASMCTRL_NOTIFY_GOTO_ADDRESS, wxCommandEvent);
|
wxDEFINE_EVENT(wxEVT_DISASMCTRL_NOTIFY_GOTO_ADDRESS, wxCommandEvent);
|
||||||
|
|
||||||
|
|
@ -105,7 +105,7 @@ static void InitSyntaxColors()
|
||||||
|
|
||||||
// theme the current instruction pointer arrow
|
// theme the current instruction pointer arrow
|
||||||
wxMemoryInputStream strm(arrowRightPNG, sizeof(arrowRightPNG));
|
wxMemoryInputStream strm(arrowRightPNG, sizeof(arrowRightPNG));
|
||||||
g_ipArrowBitmap = LoadThemedBitmapFromPNG(arrowRightPNG, sizeof(arrowRightPNG), wxSystemSettings::GetColour(wxSYS_COLOUR_WINDOWTEXT));
|
g_ipArrowBitmap = wxHelper::LoadThemedBitmapFromPNG(arrowRightPNG, sizeof(arrowRightPNG), wxSystemSettings::GetColour(wxSYS_COLOUR_WINDOWTEXT));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -70,9 +70,9 @@ InputSettings2::InputSettings2(wxWindow* parent)
|
||||||
|
|
||||||
g_inputConfigWindowHasFocus = true;
|
g_inputConfigWindowHasFocus = true;
|
||||||
|
|
||||||
m_connected = wxBITMAP_PNG_FROM_DATA(INPUT_CONNECTED);
|
m_connected = wxHelper::LoadThemedBitmapFromPNG(INPUT_CONNECTED_png, sizeof(INPUT_CONNECTED_png), wxSystemSettings::GetColour(wxSYS_COLOUR_WINDOWTEXT));
|
||||||
m_disconnected = wxBITMAP_PNG_FROM_DATA(INPUT_DISCONNECTED);
|
m_disconnected = wxHelper::LoadThemedBitmapFromPNG(INPUT_DISCONNECTED_png, sizeof(INPUT_DISCONNECTED_png), wxSystemSettings::GetColour(wxSYS_COLOUR_WINDOWTEXT));
|
||||||
m_low_battery = wxBITMAP_PNG_FROM_DATA(INPUT_LOW_BATTERY);
|
m_low_battery = wxHelper::LoadThemedBitmapFromPNG(INPUT_LOW_BATTERY_png, sizeof(INPUT_LOW_BATTERY_png), wxSystemSettings::GetColour(wxSYS_COLOUR_WINDOWTEXT));
|
||||||
|
|
||||||
auto* sizer = new wxBoxSizer(wxVERTICAL);
|
auto* sizer = new wxBoxSizer(wxVERTICAL);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -14,15 +14,9 @@ class wxComboBox;
|
||||||
class InputPanel : public wxPanel
|
class InputPanel : public wxPanel
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
#if BOOST_OS_WINDOWS
|
|
||||||
const wxColour kKeyColourNormalMode = 0xfafafa;
|
|
||||||
const wxColour kKeyColourEditMode = 0x99ccff;
|
|
||||||
const wxColour kKeyColourActiveMode = 0xE0E0E0;
|
|
||||||
#else
|
|
||||||
const wxColour kKeyColourNormalMode = GetBackgroundColour();
|
const wxColour kKeyColourNormalMode = GetBackgroundColour();
|
||||||
const wxColour kKeyColourEditMode = GetBackgroundColour();
|
const wxColour kKeyColourEditMode = wxSystemSettings::GetColour(wxSYS_COLOUR_HIGHLIGHT);
|
||||||
const wxColour kKeyColourActiveMode = wxHelper::CalculateAccentColour(kKeyColourNormalMode);
|
const wxColour kKeyColourActiveMode = wxHelper::CalculateAccentColour(GetBackgroundColour());
|
||||||
#endif
|
|
||||||
|
|
||||||
InputPanel(wxWindow* parent);
|
InputPanel(wxWindow* parent);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,7 @@
|
||||||
#pragma once
|
#pragma once
|
||||||
#include <wx/string.h>
|
#include <wx/string.h>
|
||||||
|
#include <wx/bitmap.h>
|
||||||
|
#include <wx/mstream.h>
|
||||||
|
|
||||||
namespace wxHelper
|
namespace wxHelper
|
||||||
{
|
{
|
||||||
|
|
@ -33,4 +35,11 @@ namespace wxHelper
|
||||||
return bgColourSecondary;
|
return bgColourSecondary;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static wxBitmap LoadThemedBitmapFromPNG(const uint8* data, size_t size, const wxColour& tint)
|
||||||
|
{
|
||||||
|
wxMemoryInputStream strm(data, size);
|
||||||
|
wxImage img(strm, wxBITMAP_TYPE_PNG);
|
||||||
|
img.Replace(0x00, 0x00, 0x00, tint.Red(), tint.Green(), tint.Blue());
|
||||||
|
return wxBitmap(img);
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue