Skip to content

Commit 191357c

Browse files
authored
UI: Fix minor dark mode issues (#1654)
* Fix black text after graphic pack is disabled in dark mode * Fix background colour of audio debugger in dark mode * Make placeholder game list icons black when using dark mode * Some tweaks to the HotkeySettings window: - Make strings translatable - Makes the column headers bold for clarity - Makes the border darker on Linux, fixed by @goeiecool9999 - Make the column headers have some padding to make it look nicer.
1 parent 55a735d commit 191357c

File tree

6 files changed

+23
-23
lines changed

6 files changed

+23
-23
lines changed

src/gui/wxgui/AudioDebuggerWindow.cpp

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@ wxEND_EVENT_TABLE()
2424
AudioDebuggerWindow::AudioDebuggerWindow(wxFrame& parent)
2525
: wxFrame(&parent, wxID_ANY, _("AX voice viewer"), wxDefaultPosition, wxSize(1126, 580), wxCLOSE_BOX | wxCLIP_CHILDREN | wxCAPTION | wxRESIZE_BORDER)
2626
{
27-
2827
wxPanel* mainPane = new wxPanel(this);
2928
wxBoxSizer* sizer = new wxBoxSizer(wxVERTICAL);
3029

@@ -141,8 +140,6 @@ AudioDebuggerWindow::AudioDebuggerWindow(wxFrame& parent)
141140
}
142141
RefreshVoiceList();
143142

144-
wxFrame::SetBackgroundColour(*wxWHITE);
145-
146143
// start refresh timer
147144
static const int INTERVAL = 100; // milliseconds
148145
refreshTimer = new wxTimer(this, REFRESH_TIMER_ID);

src/gui/wxgui/GraphicPacksWindow2.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -131,11 +131,11 @@ void GraphicPacksWindow2::FillGraphicPackList() const
131131
{
132132
auto tmp_text = m_graphic_pack_tree->GetItemText(node);
133133
m_graphic_pack_tree->SetItemText(node, tmp_text + " (Unsupported version)");
134-
m_graphic_pack_tree->SetItemTextColour(node, 0x0000CC);
134+
m_graphic_pack_tree->SetItemTextColour(node, m_incompatible_colour);
135135
canEnable = false;
136136
}
137137
else if (p->IsActivated())
138-
m_graphic_pack_tree->SetItemTextColour(node, 0x009900);
138+
m_graphic_pack_tree->SetItemTextColour(node, m_activated_colour);
139139

140140
m_graphic_pack_tree->MakeCheckable(node, p->IsEnabled());
141141
if (!canEnable)
@@ -509,15 +509,15 @@ void GraphicPacksWindow2::OnTreeChoiceChanged(wxTreeEvent& event)
509509
if (!requiresRestart)
510510
{
511511
ReloadPack(graphic_pack);
512-
m_graphic_pack_tree->SetItemTextColour(item, 0x009900);
512+
m_graphic_pack_tree->SetItemTextColour(item, m_activated_colour);
513513
}
514514
}
515515
else
516516
{
517517
if (!requiresRestart)
518518
{
519519
DeleteShadersFromRuntimeCache(graphic_pack);
520-
m_graphic_pack_tree->SetItemTextColour(item, *wxBLACK);
520+
m_graphic_pack_tree->SetItemTextColour(item, m_default_colour);
521521
}
522522
GraphicPack2::DeactivateGraphicPack(graphic_pack);
523523
}

src/gui/wxgui/GraphicPacksWindow2.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,9 @@ class GraphicPacksWindow2 : public wxDialog
5353
std::string m_gp_name, m_gp_description;
5454

5555
float m_ratio = 0.55f;
56+
wxColour m_default_colour = wxSystemSettings::GetColour(wxSYS_COLOUR_WINDOWTEXT);
57+
wxColour m_activated_colour = wxSystemSettings::SelectLightDark(wxColour(0x00, 0xCC, 0x00), wxColour(0x42, 0xB3, 0x42));
58+
wxColour m_incompatible_colour = wxSystemSettings::SelectLightDark(wxColour(0xCC, 0x00, 0x00), wxColour(0xDE, 0x49, 0x49));
5659

5760
wxTreeItemId FindTreeItem(const wxTreeItemId& root, const wxString& text) const;
5861
void LoadPresetSelections(const GraphicPackPtr& gp);

src/gui/wxgui/components/wxGameList.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -140,8 +140,8 @@ wxGameList::wxGameList(wxWindow* parent, wxWindowID id)
140140
{
141141
const auto& config = GetWxGUIConfig();
142142

143-
char transparent_bitmap[kIconWidth * kIconWidth * 4] = {wxIMAGE_ALPHA_TRANSPARENT};
144-
memset((void*)transparent_bitmap, wxIMAGE_ALPHA_TRANSPARENT, sizeof(transparent_bitmap));
143+
char transparent_bitmap[kIconWidth * kIconWidth * 4] = {};
144+
memset((void*)transparent_bitmap, wxSystemSettings::GetAppearance().IsDark() ? 0xFF : 0x00, sizeof(transparent_bitmap));
145145
wxBitmap blank(transparent_bitmap, kIconWidth, kIconWidth);
146146
blank.UseAlpha(true);
147147

src/gui/wxgui/debugger/ModuleWindow.cpp

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,6 @@ ModuleWindow::ModuleWindow(DebuggerWindow2& parent, const wxPoint& main_position
2323
{
2424
this->SetSizeHints(wxDefaultSize, wxDefaultSize);
2525

26-
// this->wxWindowBase::SetBackgroundColour(*wxWHITE);
27-
2826
wxBoxSizer* main_sizer = new wxBoxSizer(wxVERTICAL);
2927

3028
m_modules = new wxListView(this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxLC_REPORT);

src/gui/wxgui/input/HotkeySettings.cpp

Lines changed: 14 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -89,11 +89,11 @@ std::optional<std::string> SaveScreenshot(std::vector<uint8> data, int width, in
8989
if (SaveScreenshotToClipboard(image))
9090
{
9191
if (!save_screenshot)
92-
return "Screenshot saved to clipboard";
92+
return _tr("Screenshot saved to clipboard");
9393
}
9494
else
9595
{
96-
return "Failed to open clipboard";
96+
return _tr("Failed to open clipboard");
9797
}
9898
}
9999
if (save_screenshot)
@@ -102,11 +102,11 @@ std::optional<std::string> SaveScreenshot(std::vector<uint8> data, int width, in
102102
if (imagePath.has_value() && SaveScreenshotToFile(imagePath.value(), image))
103103
{
104104
if (mainWindow)
105-
return "Screenshot saved";
105+
return _tr("Screenshot saved");
106106
}
107107
else
108108
{
109-
return "Failed to save screenshot to file";
109+
return _tr("Failed to save screenshot to file");
110110
}
111111
}
112112
return std::nullopt;
@@ -140,7 +140,7 @@ HotkeySettings::HotkeySettings(wxWindow* parent)
140140
m_sizer->AddGrowableCol(1);
141141
m_sizer->AddGrowableCol(2);
142142

143-
m_panel = new wxPanel(this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxBORDER_SIMPLE);
143+
m_panel = new wxPanel(this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxBORDER_THEME);
144144
m_panel->SetSizer(m_sizer);
145145

146146
Center();
@@ -150,13 +150,13 @@ HotkeySettings::HotkeySettings(wxWindow* parent)
150150
CreateColumnHeaders();
151151

152152
/* global modifier */
153-
CreateHotkeyRow("Hotkey modifier", s_cfgHotkeys.modifiers);
153+
CreateHotkeyRow(_tr("Hotkey modifier"), s_cfgHotkeys.modifiers);
154154
m_hotkeys.at(0).keyInput->Hide();
155155

156156
/* hotkeys */
157-
CreateHotkeyRow("Toggle fullscreen", s_cfgHotkeys.toggleFullscreen);
158-
CreateHotkeyRow("Take screenshot", s_cfgHotkeys.takeScreenshot);
159-
CreateHotkeyRow("Toggle fast-forward", s_cfgHotkeys.toggleFastForward);
157+
CreateHotkeyRow(_tr("Toggle fullscreen"), s_cfgHotkeys.toggleFullscreen);
158+
CreateHotkeyRow(_tr("Take screenshot"), s_cfgHotkeys.takeScreenshot);
159+
CreateHotkeyRow(_tr("Toggle fast-forward"), s_cfgHotkeys.toggleFastForward);
160160

161161
m_controllerTimer = new wxTimer(this);
162162
Bind(wxEVT_TIMER, &HotkeySettings::OnControllerTimer, this);
@@ -214,13 +214,15 @@ void HotkeySettings::Init(MainWindow* mainWindowFrame)
214214
void HotkeySettings::CreateColumnHeaders(void)
215215
{
216216
auto* emptySpace = new wxStaticText(m_panel, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxALIGN_CENTER_HORIZONTAL);
217-
auto* keyboard = new wxStaticText(m_panel, wxID_ANY, "Keyboard", wxDefaultPosition, wxDefaultSize, wxALIGN_CENTER_HORIZONTAL);
218-
auto* controller = new wxStaticText(m_panel, wxID_ANY, "Controller", wxDefaultPosition, wxDefaultSize, wxALIGN_CENTER_HORIZONTAL);
217+
auto* keyboard = new wxStaticText(m_panel, wxID_ANY, _tr("Keyboard"), wxDefaultPosition, wxDefaultSize, wxALIGN_CENTER_HORIZONTAL);
218+
auto* controller = new wxStaticText(m_panel, wxID_ANY, _tr("Controller"), wxDefaultPosition, wxDefaultSize, wxALIGN_CENTER_HORIZONTAL);
219+
keyboard->SetFont(keyboard->GetFont().Bold().Larger());
220+
controller->SetFont(controller->GetFont().Bold().Larger());
219221

220222
keyboard->SetMinSize(m_minButtonSize);
221223
controller->SetMinSize(m_minButtonSize);
222224

223-
auto flags = wxSizerFlags().Expand();
225+
auto flags = wxSizerFlags().Expand().Border(wxTOP, 10);
224226
m_sizer->Add(emptySpace, flags);
225227
m_sizer->Add(keyboard, flags);
226228
m_sizer->Add(controller, flags);

0 commit comments

Comments
 (0)