Merge pull request #238 from Fs00/more-translations

More l10n improvements and add workflow to generate POT file
This commit is contained in:
Exzap 2022-09-14 22:49:14 +02:00 committed by GitHub
commit 61a3b07697
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
17 changed files with 207 additions and 230 deletions

42
.github/workflows/generate_pot.yml vendored Normal file
View File

@ -0,0 +1,42 @@
name: Generate translation template
on:
pull_request:
paths-ignore:
- "*.md"
types:
- opened
- synchronize
- reopened
push:
paths-ignore:
- "*.md"
branches:
- main
jobs:
generate-pot:
runs-on: ubuntu-latest
steps:
- name: "Checkout repo"
uses: actions/checkout@v3
- name: "Install gettext"
run: |
sudo apt update -qq
sudo apt install -y gettext
- name: "Generate POT file using xgettext"
run: >
find src -name *.cpp -o -name *.hpp -o -name *.h |
xargs xgettext --from-code=utf-8
-k_ -kwxTRANSLATE -w 100
--check=space-ellipsis --omit-header
-o cemu.pot
- name: Upload artifact
uses: actions/upload-artifact@v3
with:
name: POT file
path: ./cemu.pot
if-no-files-found: error

View File

@ -290,7 +290,8 @@ void wxTitleManagerList::OnConvertToCompressedFormat(uint64 titleId)
} }
} }
std::string msg = wxHelper::MakeUTF8(_("The following content will be converted to a compressed Wii U archive file (.wua):\n \n")); std::string msg = wxHelper::MakeUTF8(_("The following content will be converted to a compressed Wii U archive file (.wua):"));
msg.append("\n \n");
if (titleInfo_base.IsValid()) if (titleInfo_base.IsValid())
msg.append(fmt::format(fmt::runtime(wxHelper::MakeUTF8(_("Base game: {}"))), _pathToUtf8(titleInfo_base.GetPath()))); msg.append(fmt::format(fmt::runtime(wxHelper::MakeUTF8(_("Base game: {}"))), _pathToUtf8(titleInfo_base.GetPath())));

View File

@ -28,7 +28,7 @@ enum
}; };
RegisterWindow::RegisterWindow(DebuggerWindow2& parent, const wxPoint& main_position, const wxSize& main_size) RegisterWindow::RegisterWindow(DebuggerWindow2& parent, const wxPoint& main_position, const wxSize& main_size)
: wxFrame(&parent, wxID_ANY, _("Register View"), wxDefaultPosition, wxSize(400, 975), wxSYSTEM_MENU | wxCAPTION | wxCLIP_CHILDREN | wxRESIZE_BORDER | wxFRAME_FLOAT_ON_PARENT), : wxFrame(&parent, wxID_ANY, _("Registers"), wxDefaultPosition, wxSize(400, 975), wxSYSTEM_MENU | wxCAPTION | wxCLIP_CHILDREN | wxRESIZE_BORDER | wxFRAME_FLOAT_ON_PARENT),
m_prev_snapshot({}), m_show_double_values(true), m_context_ctrl(nullptr) m_prev_snapshot({}), m_show_double_values(true), m_context_ctrl(nullptr)
{ {
SetSizeHints(wxDefaultSize, wxDefaultSize); SetSizeHints(wxDefaultSize, wxDefaultSize);

View File

@ -13,7 +13,7 @@ enum ItemColumns
}; };
SymbolWindow::SymbolWindow(DebuggerWindow2& parent, const wxPoint& main_position, const wxSize& main_size) SymbolWindow::SymbolWindow(DebuggerWindow2& parent, const wxPoint& main_position, const wxSize& main_size)
: wxFrame(&parent, wxID_ANY, _("Symbol Window"), wxDefaultPosition, wxSize(600, 250), wxSYSTEM_MENU | wxCAPTION | wxCLIP_CHILDREN | wxRESIZE_BORDER | wxFRAME_FLOAT_ON_PARENT) : wxFrame(&parent, wxID_ANY, _("Symbols"), wxDefaultPosition, wxSize(600, 250), wxSYSTEM_MENU | wxCAPTION | wxCLIP_CHILDREN | wxRESIZE_BORDER | wxFRAME_FLOAT_ON_PARENT)
{ {
this->wxWindowBase::SetBackgroundColour(*wxWHITE); this->wxWindowBase::SetBackgroundColour(*wxWHITE);

View File

@ -29,16 +29,7 @@ ClassicControllerInputPanel::ClassicControllerInputPanel(wxWindow* parent)
for (const auto& id : g_kFirstColumnItems) for (const auto& id : g_kFirstColumnItems)
{ {
row++; row++;
add_button_row(main_sizer, row, column, id);
main_sizer->Add(new wxStaticText(this, wxID_ANY, to_wxString(ClassicController::get_button_name(id))), wxGBPosition(row, column), wxDefaultSpan, wxALL | wxALIGN_CENTER_VERTICAL, 5);
auto* text_ctrl = new wxTextCtrl(this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL | wxTE_PROCESS_ENTER | wxTE_PROCESS_TAB);
text_ctrl->SetClientData(reinterpret_cast<void*>(id));
text_ctrl->SetMinSize(wxSize(150, -1));
text_ctrl->SetEditable(false);
text_ctrl->SetBackgroundColour(kKeyColourNormalMode);
bind_hotkey_events(text_ctrl);
main_sizer->Add(text_ctrl, wxGBPosition(row, column + 1), wxDefaultSpan, wxALL | wxEXPAND, 5);
} }
////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////
@ -55,16 +46,7 @@ ClassicControllerInputPanel::ClassicControllerInputPanel(wxWindow* parent)
for (const auto& id : g_kSecondColumnItems) for (const auto& id : g_kSecondColumnItems)
{ {
row++; row++;
add_button_row(main_sizer, row, column, id);
main_sizer->Add(new wxStaticText(this, wxID_ANY, to_wxString(ClassicController::get_button_name(id))), wxGBPosition(row, column), wxDefaultSpan, wxALL | wxALIGN_CENTER_VERTICAL, 5);
auto* text_ctrl = new wxTextCtrl(this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL | wxTE_PROCESS_ENTER | wxTE_PROCESS_TAB);
text_ctrl->SetClientData(reinterpret_cast<void*>(id));
text_ctrl->SetMinSize(wxSize(150, -1));
text_ctrl->SetEditable(false);
text_ctrl->SetBackgroundColour(kKeyColourNormalMode);
bind_hotkey_events(text_ctrl);
main_sizer->Add(text_ctrl, wxGBPosition(row, column + 1), wxDefaultSpan, wxALL | wxEXPAND, 5);
} }
row++; row++;
@ -87,16 +69,7 @@ ClassicControllerInputPanel::ClassicControllerInputPanel(wxWindow* parent)
for (const auto& id : g_kThirdColumnItems) for (const auto& id : g_kThirdColumnItems)
{ {
row++; row++;
add_button_row(main_sizer, row, column, id);
main_sizer->Add(new wxStaticText(this, wxID_ANY, to_wxString(ClassicController::get_button_name(id))), wxGBPosition(row, column), wxDefaultSpan, wxALL | wxALIGN_CENTER_VERTICAL, 5);
auto* text_ctrl = new wxTextCtrl(this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL | wxTE_PROCESS_ENTER | wxTE_PROCESS_TAB);
text_ctrl->SetClientData(reinterpret_cast<void*>(id));
text_ctrl->SetMinSize(wxSize(150, -1));
text_ctrl->SetEditable(false);
text_ctrl->SetBackgroundColour(kKeyColourNormalMode);
bind_hotkey_events(text_ctrl);
main_sizer->Add(text_ctrl, wxGBPosition(row, column + 1), wxDefaultSpan, wxALL | wxEXPAND, 5);
} }
row++; row++;
@ -119,21 +92,27 @@ ClassicControllerInputPanel::ClassicControllerInputPanel(wxWindow* parent)
for (auto id : g_kFourthRowItems) for (auto id : g_kFourthRowItems)
{ {
row++; row++;
add_button_row(main_sizer, row, column, id);
main_sizer->Add(new wxStaticText(this, wxID_ANY, to_wxString(ClassicController::get_button_name(id))), wxGBPosition(row, column), wxDefaultSpan, wxALL | wxALIGN_CENTER_VERTICAL, 5);
auto* text_ctrl = new wxTextCtrl(this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL | wxTE_PROCESS_ENTER | wxTE_PROCESS_TAB);
text_ctrl->SetClientData(reinterpret_cast<void*>(id));
text_ctrl->SetMinSize(wxSize(150, -1));
text_ctrl->SetEditable(false);
text_ctrl->SetBackgroundColour(kKeyColourNormalMode);
bind_hotkey_events(text_ctrl);
main_sizer->Add(text_ctrl, wxGBPosition(row, column + 1), wxDefaultSpan, wxALL | wxEXPAND, 5);
} }
////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////
SetSizer(main_sizer); SetSizer(main_sizer);
Layout(); Layout();
} }
void ClassicControllerInputPanel::add_button_row(wxGridBagSizer *sizer, sint32 row, sint32 column, const ClassicController::ButtonId &button_id) {
sizer->Add(
new wxStaticText(this, wxID_ANY, wxGetTranslation(to_wxString(ClassicController::get_button_name(button_id)))),
wxGBPosition(row, column),
wxDefaultSpan,
wxALL | wxALIGN_CENTER_VERTICAL, 5);
auto* text_ctrl = new wxTextCtrl(this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL | wxTE_PROCESS_ENTER | wxTE_PROCESS_TAB);
text_ctrl->SetClientData(reinterpret_cast<void*>(button_id));
text_ctrl->SetMinSize(wxSize(150, -1));
text_ctrl->SetEditable(false);
text_ctrl->SetBackgroundColour(kKeyColourNormalMode);
bind_hotkey_events(text_ctrl);
sizer->Add(text_ctrl, wxGBPosition(row, column + 1), wxDefaultSpan, wxALL | wxEXPAND, 5);
}

View File

@ -1,5 +1,7 @@
#pragma once #pragma once
#include <wx/gbsizer.h>
#include "input/emulated/ClassicController.h"
#include "gui/input/panels/InputPanel.h" #include "gui/input/panels/InputPanel.h"
class wxInputDraw; class wxInputDraw;
@ -11,5 +13,7 @@ public:
private: private:
wxInputDraw* m_left_draw, * m_right_draw; wxInputDraw* m_left_draw, * m_right_draw;
void add_button_row(wxGridBagSizer *sizer, sint32 row, sint32 column, const ClassicController::ButtonId &button_id);
}; };

View File

@ -4,9 +4,7 @@
#include <wx/stattext.h> #include <wx/stattext.h>
#include <wx/statline.h> #include <wx/statline.h>
#include <wx/textctrl.h> #include <wx/textctrl.h>
#include <wx/slider.h>
#include "gui/helpers/wxControlObject.h"
#include "input/emulated/ProController.h" #include "input/emulated/ProController.h"
#include "gui/helpers/wxHelpers.h" #include "gui/helpers/wxHelpers.h"
#include "gui/components/wxInputDraw.h" #include "gui/components/wxInputDraw.h"
@ -30,16 +28,7 @@ ProControllerInputPanel::ProControllerInputPanel(wxWindow* parent)
for (auto id : g_kFirstColumnItems) for (auto id : g_kFirstColumnItems)
{ {
row++; row++;
add_button_row(main_sizer, row, column, id);
main_sizer->Add(new wxStaticText(this, wxID_ANY, to_wxString(ProController::get_button_name(id))), wxGBPosition(row, column), wxDefaultSpan, wxALL | wxALIGN_CENTER_VERTICAL, 5);
auto text_ctrl = new wxTextCtrl(this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL | wxTE_PROCESS_ENTER | wxTE_PROCESS_TAB);
text_ctrl->SetClientData((void*)id);
text_ctrl->SetMinSize(wxSize(150, -1));
text_ctrl->SetEditable(false);
text_ctrl->SetBackgroundColour(kKeyColourNormalMode);
bind_hotkey_events(text_ctrl);
main_sizer->Add(text_ctrl, wxGBPosition(row, column + 1), wxDefaultSpan, wxALL | wxEXPAND, 5);
} }
////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////
@ -56,16 +45,7 @@ ProControllerInputPanel::ProControllerInputPanel(wxWindow* parent)
for (auto id : g_kSecondColumnItems) for (auto id : g_kSecondColumnItems)
{ {
row++; row++;
add_button_row(main_sizer, row, column, id);
main_sizer->Add(new wxStaticText(this, wxID_ANY, to_wxString(ProController::get_button_name(id))), wxGBPosition(row, column), wxDefaultSpan, wxALL | wxALIGN_CENTER_VERTICAL, 5);
auto text_ctrl = new wxTextCtrl(this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL | wxTE_PROCESS_ENTER | wxTE_PROCESS_TAB);
text_ctrl->SetClientData((void*)id);
text_ctrl->SetMinSize(wxSize(150, -1));
text_ctrl->SetEditable(false);
text_ctrl->SetBackgroundColour(kKeyColourNormalMode);
bind_hotkey_events(text_ctrl);
main_sizer->Add(text_ctrl, wxGBPosition(row, column + 1), wxDefaultSpan, wxALL | wxEXPAND, 5);
} }
row++; row++;
@ -88,16 +68,7 @@ ProControllerInputPanel::ProControllerInputPanel(wxWindow* parent)
for (auto id : g_kThirdColumnItems) for (auto id : g_kThirdColumnItems)
{ {
row++; row++;
add_button_row(main_sizer, row, column, id);
main_sizer->Add(new wxStaticText(this, wxID_ANY, to_wxString(ProController::get_button_name(id))), wxGBPosition(row, column), wxDefaultSpan, wxALL | wxALIGN_CENTER_VERTICAL, 5);
auto text_ctrl = new wxTextCtrl(this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL | wxTE_PROCESS_ENTER | wxTE_PROCESS_TAB);
text_ctrl->SetClientData((void*)id);
text_ctrl->SetMinSize(wxSize(150, -1));
text_ctrl->SetEditable(false);
text_ctrl->SetBackgroundColour(kKeyColourNormalMode);
bind_hotkey_events(text_ctrl);
main_sizer->Add(text_ctrl, wxGBPosition(row, column + 1), wxDefaultSpan, wxALL | wxEXPAND, 5);
} }
row++; row++;
@ -120,24 +91,28 @@ ProControllerInputPanel::ProControllerInputPanel(wxWindow* parent)
for (auto id : g_kFourthRowItems) for (auto id : g_kFourthRowItems)
{ {
row++; row++;
add_button_row(main_sizer, row, column, id);
main_sizer->Add(new wxStaticText(this, wxID_ANY, to_wxString(ProController::get_button_name(id))), wxGBPosition(row, column), wxDefaultSpan, wxALL | wxALIGN_CENTER_VERTICAL, 5);
auto text_ctrl = new wxTextCtrl(this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL | wxTE_PROCESS_ENTER | wxTE_PROCESS_TAB);
text_ctrl->SetClientData((void*)id);
text_ctrl->SetMinSize(wxSize(150, -1));
text_ctrl->SetEditable(false);
text_ctrl->SetBackgroundColour(kKeyColourNormalMode);
bind_hotkey_events(text_ctrl);
main_sizer->Add(text_ctrl, wxGBPosition(row, column + 1), wxDefaultSpan, wxALL | wxEXPAND, 5);
} }
////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////
// LoadController(controller);
SetSizerAndFit(main_sizer); SetSizerAndFit(main_sizer);
//wxWindow::Show(show); }
void ProControllerInputPanel::add_button_row(wxGridBagSizer *sizer, sint32 row, sint32 column, const ProController::ButtonId &button_id) {
sizer->Add(
new wxStaticText(this, wxID_ANY, wxGetTranslation(to_wxString(ProController::get_button_name(button_id)))),
wxGBPosition(row, column),
wxDefaultSpan,
wxALL | wxALIGN_CENTER_VERTICAL, 5);
auto text_ctrl = new wxTextCtrl(this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL | wxTE_PROCESS_ENTER | wxTE_PROCESS_TAB);
text_ctrl->SetClientData((void*)button_id);
text_ctrl->SetMinSize(wxSize(150, -1));
text_ctrl->SetEditable(false);
text_ctrl->SetBackgroundColour(kKeyColourNormalMode);
bind_hotkey_events(text_ctrl);
sizer->Add(text_ctrl, wxGBPosition(row, column + 1), wxDefaultSpan, wxALL | wxEXPAND, 5);
} }
void ProControllerInputPanel::on_timer(const EmulatedControllerPtr& emulated_controller, void ProControllerInputPanel::on_timer(const EmulatedControllerPtr& emulated_controller,

View File

@ -1,5 +1,7 @@
#pragma once #pragma once
#include <wx/gbsizer.h>
#include "input/emulated/ProController.h"
#include "gui/input/panels/InputPanel.h" #include "gui/input/panels/InputPanel.h"
#include "gui/components/wxInputDraw.h" #include "gui/components/wxInputDraw.h"
@ -12,4 +14,6 @@ public:
private: private:
wxInputDraw* m_left_draw, * m_right_draw; wxInputDraw* m_left_draw, * m_right_draw;
void add_button_row(wxGridBagSizer *sizer, sint32 row, sint32 column, const ProController::ButtonId &button_id);
}; };

View File

@ -48,16 +48,7 @@ VPADInputPanel::VPADInputPanel(wxWindow* parent)
for (const auto& id : g_kFirstColumnItems) for (const auto& id : g_kFirstColumnItems)
{ {
row++; row++;
add_button_row(main_sizer, row, column, id);
main_sizer->Add(new wxStaticText(this, wxID_ANY, to_wxString(VPADController::get_button_name(id))), wxGBPosition(row, column), wxDefaultSpan, wxALL | wxALIGN_CENTER_VERTICAL, 5);
auto* text_ctrl = new wxTextCtrl(this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL | wxTE_PROCESS_ENTER | wxTE_PROCESS_TAB);
text_ctrl->SetClientData((void*)id);
text_ctrl->SetMinSize(wxSize(150, -1));
text_ctrl->SetEditable(false);
text_ctrl->SetBackgroundColour(kKeyColourNormalMode);
bind_hotkey_events(text_ctrl);
main_sizer->Add(text_ctrl, wxGBPosition(row, column + 1), wxDefaultSpan, wxALL | wxEXPAND, 5);
} }
////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////
@ -74,16 +65,7 @@ VPADInputPanel::VPADInputPanel(wxWindow* parent)
for (const auto& id : g_kSecondColumnItems) for (const auto& id : g_kSecondColumnItems)
{ {
row++; row++;
add_button_row(main_sizer, row, column, id);
main_sizer->Add(new wxStaticText(this, wxID_ANY, to_wxString(VPADController::get_button_name(id))), wxGBPosition(row, column), wxDefaultSpan, wxALL | wxALIGN_CENTER_VERTICAL, 5);
auto* text_ctrl = new wxTextCtrl(this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL | wxTE_PROCESS_ENTER | wxTE_PROCESS_TAB);
text_ctrl->SetClientData((void*)id);
text_ctrl->SetMinSize(wxSize(150, -1));
text_ctrl->SetEditable(false);
text_ctrl->SetBackgroundColour(kKeyColourNormalMode);
bind_hotkey_events(text_ctrl);
main_sizer->Add(text_ctrl, wxGBPosition(row, column + 1), wxDefaultSpan, wxALL | wxEXPAND, 5);
} }
row++; row++;
@ -106,16 +88,7 @@ VPADInputPanel::VPADInputPanel(wxWindow* parent)
for (const auto& id : g_kThirdColumnItems) for (const auto& id : g_kThirdColumnItems)
{ {
row++; row++;
add_button_row(main_sizer, row, column, id);
main_sizer->Add(new wxStaticText(this, wxID_ANY, to_wxString(VPADController::get_button_name(id))), wxGBPosition(row, column), wxDefaultSpan, wxALL | wxALIGN_CENTER_VERTICAL, 5);
auto* text_ctrl = new wxTextCtrl(this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL | wxTE_PROCESS_ENTER | wxTE_PROCESS_TAB);
text_ctrl->SetClientData((void*)id);
text_ctrl->SetMinSize(wxSize(150, -1));
text_ctrl->SetEditable(false);
text_ctrl->SetBackgroundColour(kKeyColourNormalMode);
bind_hotkey_events(text_ctrl);
main_sizer->Add(text_ctrl, wxGBPosition(row, column + 1), wxDefaultSpan, wxALL | wxEXPAND, 5);
} }
row++; row++;
@ -154,50 +127,41 @@ VPADInputPanel::VPADInputPanel(wxWindow* parent)
for (const auto& id : g_kFourthRowItems) for (const auto& id : g_kFourthRowItems)
{ {
row++; row++;
add_button_row(main_sizer, row, column, id);
main_sizer->Add(new wxStaticText(this, wxID_ANY, to_wxString(VPADController::get_button_name(id))), wxGBPosition(row, column), wxDefaultSpan, wxALL | wxALIGN_CENTER_VERTICAL, 5);
auto text_ctrl = new wxTextCtrl(this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL | wxTE_PROCESS_ENTER | wxTE_PROCESS_TAB);
text_ctrl->SetClientData((void*)id);
text_ctrl->SetMinSize(wxSize(150, -1));
text_ctrl->SetEditable(false);
text_ctrl->SetBackgroundColour(kKeyColourNormalMode);
bind_hotkey_events(text_ctrl);
main_sizer->Add(text_ctrl, wxGBPosition(row, column + 1), wxDefaultSpan, wxALL | wxEXPAND, 5);
} }
// Blow Mic // Blow Mic
row = 9; row = 9;
main_sizer->Add(new wxStaticText(this, wxID_ANY, _("blow mic")), wxGBPosition(row, column), wxDefaultSpan, wxALL | wxALIGN_CENTER_VERTICAL, 5); add_button_row(main_sizer, row, column, VPADController::kButtonId_Mic, _("blow mic"));
auto text_ctrl = new wxTextCtrl(this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL | wxTE_PROCESS_ENTER | wxTE_PROCESS_TAB);
text_ctrl->SetClientData((void*)VPADController::kButtonId_Mic);
text_ctrl->SetMinSize(wxSize(150, -1));
text_ctrl->SetEditable(false);
text_ctrl->SetBackgroundColour(kKeyColourNormalMode);
bind_hotkey_events(text_ctrl);
main_sizer->Add(text_ctrl, wxGBPosition(row, column + 1), wxDefaultSpan, wxALL | wxEXPAND, 5);
row++; row++;
main_sizer->Add(new wxStaticText(this, wxID_ANY, _("show screen")), wxGBPosition(row, column), wxDefaultSpan, wxALL | wxALIGN_CENTER_VERTICAL, 5); add_button_row(main_sizer, row, column, VPADController::kButtonId_Screen, _("show screen"));
text_ctrl = new wxTextCtrl(this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL | wxTE_PROCESS_ENTER | wxTE_PROCESS_TAB);
text_ctrl->SetClientData((void*)VPADController::kButtonId_Screen);
text_ctrl->SetMinSize(wxSize(150, -1));
text_ctrl->SetEditable(false);
text_ctrl->SetBackgroundColour(kKeyColourNormalMode);
bind_hotkey_events(text_ctrl);
main_sizer->Add(text_ctrl, wxGBPosition(row, column + 1), wxDefaultSpan, wxALL | wxEXPAND, 5);
////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////
//LoadController(controller);
SetSizer(main_sizer); SetSizer(main_sizer);
Layout(); Layout();
}
//SetSizerAndFit(main_sizer); void VPADInputPanel::add_button_row(wxGridBagSizer *sizer, sint32 row, sint32 column, const VPADController::ButtonId &button_id) {
//wxWindow::Show(show); add_button_row(sizer, row, column, button_id, wxGetTranslation(to_wxString(VPADController::get_button_name(button_id))));
}
void VPADInputPanel::add_button_row(wxGridBagSizer *sizer, sint32 row, sint32 column,
const VPADController::ButtonId &button_id, const wxString &label) {
sizer->Add(
new wxStaticText(this, wxID_ANY, label),
wxGBPosition(row, column),
wxDefaultSpan,
wxALL | wxALIGN_CENTER_VERTICAL, 5);
auto* text_ctrl = new wxTextCtrl(this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL | wxTE_PROCESS_ENTER | wxTE_PROCESS_TAB);
text_ctrl->SetClientData((void*)button_id);
text_ctrl->SetMinSize(wxSize(150, -1));
text_ctrl->SetEditable(false);
text_ctrl->SetBackgroundColour(kKeyColourNormalMode);
bind_hotkey_events(text_ctrl);
sizer->Add(text_ctrl, wxGBPosition(row, column + 1), wxDefaultSpan, wxALL | wxEXPAND, 5);
} }
void VPADInputPanel::on_timer(const EmulatedControllerPtr& emulated_controller, const ControllerPtr& controller_base) void VPADInputPanel::on_timer(const EmulatedControllerPtr& emulated_controller, const ControllerPtr& controller_base)

View File

@ -1,5 +1,6 @@
#pragma once #pragma once
#include <wx/gbsizer.h>
#include "gui/input/panels/InputPanel.h" #include "gui/input/panels/InputPanel.h"
class wxInputDraw; class wxInputDraw;
@ -15,4 +16,7 @@ private:
void OnVolumeChange(wxCommandEvent& event); void OnVolumeChange(wxCommandEvent& event);
wxInputDraw* m_left_draw, * m_right_draw; wxInputDraw* m_left_draw, * m_right_draw;
void add_button_row(wxGridBagSizer *sizer, sint32 row, sint32 column, const VPADController::ButtonId &button_id);
void add_button_row(wxGridBagSizer *sizer, sint32 row, sint32 column, const VPADController::ButtonId &button_id, const wxString &label);
}; };

View File

@ -64,16 +64,7 @@ WiimoteInputPanel::WiimoteInputPanel(wxWindow* parent)
for (const auto& id : g_kFirstColumnItems) for (const auto& id : g_kFirstColumnItems)
{ {
row++; row++;
add_button_row(row, column, id);
m_item_sizer->Add(new wxStaticText(this, wxID_ANY, to_wxString(WiimoteController::get_button_name(id))), wxGBPosition(row, column), wxDefaultSpan, wxALL | wxALIGN_CENTER_VERTICAL, 5);
auto* text_ctrl = new wxTextCtrl(this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL | wxTE_PROCESS_ENTER | wxTE_PROCESS_TAB);
text_ctrl->SetClientData((void*)id);
text_ctrl->SetMinSize(wxSize(150, -1));
text_ctrl->SetEditable(false);
text_ctrl->SetBackgroundColour(kKeyColourNormalMode);
bind_hotkey_events(text_ctrl);
m_item_sizer->Add(text_ctrl, wxGBPosition(row, column + 1), wxDefaultSpan, wxALL | wxEXPAND, 5);
} }
m_item_sizer->Add(new wxStaticLine(this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxVERTICAL), wxGBPosition(0, column + 2), wxGBSpan(11, 1), wxLEFT | wxRIGHT | wxBOTTOM | wxEXPAND, 5); m_item_sizer->Add(new wxStaticLine(this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxVERTICAL), wxGBPosition(0, column + 2), wxGBSpan(11, 1), wxLEFT | wxRIGHT | wxBOTTOM | wxEXPAND, 5);
@ -90,16 +81,7 @@ WiimoteInputPanel::WiimoteInputPanel(wxWindow* parent)
for (const auto& id : g_kSecondColumnItems) for (const auto& id : g_kSecondColumnItems)
{ {
row++; row++;
add_button_row(row, column, id);
m_item_sizer->Add(new wxStaticText(this, wxID_ANY, to_wxString(WiimoteController::get_button_name(id))), wxGBPosition(row, column), wxDefaultSpan, wxALL | wxALIGN_CENTER_VERTICAL, 5);
auto* text_ctrl = new wxTextCtrl(this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL | wxTE_PROCESS_ENTER | wxTE_PROCESS_TAB);
text_ctrl->SetClientData((void*)id);
text_ctrl->SetMinSize(wxSize(150, -1));
text_ctrl->SetEditable(false);
text_ctrl->SetBackgroundColour(kKeyColourNormalMode);
bind_hotkey_events(text_ctrl);
m_item_sizer->Add(text_ctrl, wxGBPosition(row, column + 1), wxDefaultSpan, wxALL | wxEXPAND, 5);
} }
row = 8; row = 8;
@ -135,7 +117,11 @@ WiimoteInputPanel::WiimoteInputPanel(wxWindow* parent)
if (id == WiimoteController::kButtonId_None) if (id == WiimoteController::kButtonId_None)
continue; continue;
m_item_sizer->Add(new wxStaticText(this, wxID_ANY, to_wxString(WiimoteController::get_button_name(id))), wxGBPosition(row, column), wxDefaultSpan, wxALL | wxALIGN_CENTER_VERTICAL, 5); m_item_sizer->Add(
new wxStaticText(this, wxID_ANY, wxGetTranslation(to_wxString(WiimoteController::get_button_name(id)))),
wxGBPosition(row, column),
wxDefaultSpan,
wxALL | wxALIGN_CENTER_VERTICAL, 5);
auto* text_ctrl = new wxTextCtrl(this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL | wxTE_PROCESS_ENTER | wxTE_PROCESS_TAB); auto* text_ctrl = new wxTextCtrl(this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL | wxTE_PROCESS_ENTER | wxTE_PROCESS_TAB);
text_ctrl->SetClientData((void*)id); text_ctrl->SetClientData((void*)id);
@ -166,6 +152,22 @@ WiimoteInputPanel::WiimoteInputPanel(wxWindow* parent)
Layout(); Layout();
} }
void WiimoteInputPanel::add_button_row(sint32 row, sint32 column, const WiimoteController::ButtonId &button_id) {
m_item_sizer->Add(
new wxStaticText(this, wxID_ANY, wxGetTranslation(to_wxString(WiimoteController::get_button_name(button_id)))),
wxGBPosition(row, column),
wxDefaultSpan,
wxALL | wxALIGN_CENTER_VERTICAL, 5);
auto* text_ctrl = new wxTextCtrl(this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL | wxTE_PROCESS_ENTER | wxTE_PROCESS_TAB);
text_ctrl->SetClientData((void*)button_id);
text_ctrl->SetMinSize(wxSize(150, -1));
text_ctrl->SetEditable(false);
text_ctrl->SetBackgroundColour(kKeyColourNormalMode);
bind_hotkey_events(text_ctrl);
m_item_sizer->Add(text_ctrl, wxGBPosition(row, column + 1), wxDefaultSpan, wxALL | wxEXPAND, 5);
}
void WiimoteInputPanel::set_active_device_type(WPADDeviceType type) void WiimoteInputPanel::set_active_device_type(WPADDeviceType type)
{ {
m_device_type = type; m_device_type = type;
@ -209,9 +211,6 @@ void WiimoteInputPanel::on_volume_change(wxCommandEvent& event)
void WiimoteInputPanel::on_extension_change(wxCommandEvent& event) void WiimoteInputPanel::on_extension_change(wxCommandEvent& event)
{ {
const auto obj = dynamic_cast<wxCheckBox*>(event.GetEventObject());
wxASSERT(obj);
if(m_motion_plus->GetValue() && m_nunchuck->GetValue()) if(m_motion_plus->GetValue() && m_nunchuck->GetValue())
set_active_device_type(kWAPDevMPLSFreeStyle); set_active_device_type(kWAPDevMPLSFreeStyle);
else if(m_motion_plus->GetValue() && m_classic->GetValue()) else if(m_motion_plus->GetValue() && m_classic->GetValue())

View File

@ -1,6 +1,7 @@
#pragma once #pragma once
#include "gui/input/panels/InputPanel.h" #include "gui/input/panels/InputPanel.h"
#include "input/emulated/WiimoteController.h"
#include <wx/slider.h> #include <wx/slider.h>
class wxCheckBox; class wxCheckBox;
@ -33,7 +34,8 @@ private:
wxSlider* m_volume; wxSlider* m_volume;
std::vector<wxWindow*> m_nunchuck_items; std::vector<wxWindow*> m_nunchuck_items;
bool m_extensions_changed;
void add_button_row(sint32 row, sint32 column, const WiimoteController::ButtonId &button_id);
}; };

View File

@ -3,6 +3,7 @@
#include "input/api/Controller.h" #include "input/api/Controller.h"
#include "input/api/SDL/SDLController.h" #include "input/api/SDL/SDLController.h"
#include <wx/intl.h>
ClassicController::ClassicController(size_t player_index) ClassicController::ClassicController(size_t player_index)
: WPADController(player_index, kDataFormat_CLASSIC) : WPADController(player_index, kDataFormat_CLASSIC)
@ -69,22 +70,22 @@ std::string_view ClassicController::get_button_name(ButtonId id)
case kButtonId_Plus: return "+"; case kButtonId_Plus: return "+";
case kButtonId_Minus: return "-"; case kButtonId_Minus: return "-";
case kButtonId_Home: return "home"; case kButtonId_Home: return wxTRANSLATE("home");
case kButtonId_Up: return "up"; case kButtonId_Up: return wxTRANSLATE("up");
case kButtonId_Down: return "down"; case kButtonId_Down: return wxTRANSLATE("down");
case kButtonId_Left: return "left"; case kButtonId_Left: return wxTRANSLATE("left");
case kButtonId_Right: return "right"; case kButtonId_Right: return wxTRANSLATE("right");
case kButtonId_StickL_Up: return "up"; case kButtonId_StickL_Up: return wxTRANSLATE("up");
case kButtonId_StickL_Down: return "down"; case kButtonId_StickL_Down: return wxTRANSLATE("down");
case kButtonId_StickL_Left: return "left"; case kButtonId_StickL_Left: return wxTRANSLATE("left");
case kButtonId_StickL_Right: return "right"; case kButtonId_StickL_Right: return wxTRANSLATE("right");
case kButtonId_StickR_Up: return "up"; case kButtonId_StickR_Up: return wxTRANSLATE("up");
case kButtonId_StickR_Down: return "down"; case kButtonId_StickR_Down: return wxTRANSLATE("down");
case kButtonId_StickR_Left: return "left"; case kButtonId_StickR_Left: return wxTRANSLATE("left");
case kButtonId_StickR_Right: return "right"; case kButtonId_StickR_Right: return wxTRANSLATE("right");
default: default:
return ""; return "";

View File

@ -3,6 +3,8 @@
#include "input/api/Controller.h" #include "input/api/Controller.h"
#include "input/api/SDL/SDLController.h" #include "input/api/SDL/SDLController.h"
#include <wx/intl.h>
ProController::ProController(size_t player_index) ProController::ProController(size_t player_index)
: WPADController(player_index, kDataFormat_URCC) : WPADController(player_index, kDataFormat_URCC)
{ {
@ -73,21 +75,21 @@ std::string_view ProController::get_button_name(ButtonId id)
case kButtonId_ZR: return "ZR"; case kButtonId_ZR: return "ZR";
case kButtonId_Plus: return "+"; case kButtonId_Plus: return "+";
case kButtonId_Minus: return "-"; case kButtonId_Minus: return "-";
case kButtonId_Up: return "up"; case kButtonId_Up: return wxTRANSLATE("up");
case kButtonId_Down: return "down"; case kButtonId_Down: return wxTRANSLATE("down");
case kButtonId_Left: return "left"; case kButtonId_Left: return wxTRANSLATE("left");
case kButtonId_Right: return "right"; case kButtonId_Right: return wxTRANSLATE("right");
case kButtonId_StickL: return "click"; case kButtonId_StickL: return wxTRANSLATE("click");
case kButtonId_StickR: return "click"; case kButtonId_StickR: return wxTRANSLATE("click");
case kButtonId_StickL_Up: return "up"; case kButtonId_StickL_Up: return wxTRANSLATE("up");
case kButtonId_StickL_Down: return "down"; case kButtonId_StickL_Down: return wxTRANSLATE("down");
case kButtonId_StickL_Left: return "left"; case kButtonId_StickL_Left: return wxTRANSLATE("left");
case kButtonId_StickL_Right: return "right"; case kButtonId_StickL_Right: return wxTRANSLATE("right");
case kButtonId_StickR_Up: return "up"; case kButtonId_StickR_Up: return wxTRANSLATE("up");
case kButtonId_StickR_Down: return "down"; case kButtonId_StickR_Down: return wxTRANSLATE("down");
case kButtonId_StickR_Left: return "left"; case kButtonId_StickR_Left: return wxTRANSLATE("left");
case kButtonId_StickR_Right: return "right"; case kButtonId_StickR_Right: return wxTRANSLATE("right");
case kButtonId_Home: return "home"; case kButtonId_Home: return wxTRANSLATE("home");
default: default:
cemu_assert_debug(false); cemu_assert_debug(false);
return ""; return "";

View File

@ -5,6 +5,7 @@
#include "input/InputManager.h" #include "input/InputManager.h"
#include "Cafe/HW/Latte/Core/Latte.h" #include "Cafe/HW/Latte/Core/Latte.h"
#include "Cafe/CafeSystem.h" #include "Cafe/CafeSystem.h"
#include <wx/intl.h>
enum ControllerVPADMapping2 : uint32 enum ControllerVPADMapping2 : uint32
{ {
@ -366,21 +367,21 @@ std::string_view VPADController::get_button_name(ButtonId id)
case kButtonId_ZR: return "ZR"; case kButtonId_ZR: return "ZR";
case kButtonId_Plus: return "+"; case kButtonId_Plus: return "+";
case kButtonId_Minus: return "-"; case kButtonId_Minus: return "-";
case kButtonId_Up: return "up"; case kButtonId_Up: return wxTRANSLATE("up");
case kButtonId_Down: return "down"; case kButtonId_Down: return wxTRANSLATE("down");
case kButtonId_Left: return "left"; case kButtonId_Left: return wxTRANSLATE("left");
case kButtonId_Right: return "right"; case kButtonId_Right: return wxTRANSLATE("right");
case kButtonId_StickL: return "click"; case kButtonId_StickL: return wxTRANSLATE("click");
case kButtonId_StickR: return "click"; case kButtonId_StickR: return wxTRANSLATE("click");
case kButtonId_StickL_Up: return "up"; case kButtonId_StickL_Up: return wxTRANSLATE("up");
case kButtonId_StickL_Down: return "down"; case kButtonId_StickL_Down: return wxTRANSLATE("down");
case kButtonId_StickL_Left: return "left"; case kButtonId_StickL_Left: return wxTRANSLATE("left");
case kButtonId_StickL_Right: return "right"; case kButtonId_StickL_Right: return wxTRANSLATE("right");
case kButtonId_StickR_Up: return "up"; case kButtonId_StickR_Up: return wxTRANSLATE("up");
case kButtonId_StickR_Down: return "down"; case kButtonId_StickR_Down: return wxTRANSLATE("down");
case kButtonId_StickR_Left: return "left"; case kButtonId_StickR_Left: return wxTRANSLATE("left");
case kButtonId_StickR_Right: return "right"; case kButtonId_StickR_Right: return wxTRANSLATE("right");
case kButtonId_Home: return "home"; case kButtonId_Home: return wxTRANSLATE("home");
default: default:
cemu_assert_debug(false); cemu_assert_debug(false);
return ""; return "";

View File

@ -2,7 +2,7 @@
#include "input/api/Controller.h" #include "input/api/Controller.h"
#include "input/api/Wiimote/NativeWiimoteController.h" #include "input/api/Wiimote/NativeWiimoteController.h"
#include <wx/intl.h>
WiimoteController::WiimoteController(size_t player_index) WiimoteController::WiimoteController(size_t player_index)
: WPADController(player_index, kDataFormat_CORE_ACC_DPD) : WPADController(player_index, kDataFormat_CORE_ACC_DPD)
@ -159,22 +159,22 @@ std::string_view WiimoteController::get_button_name(ButtonId id)
case kButtonId_1: return "1"; case kButtonId_1: return "1";
case kButtonId_2: return "2"; case kButtonId_2: return "2";
case kButtonId_Home: return "home"; case kButtonId_Home: return wxTRANSLATE("home");
case kButtonId_Plus: return "+"; case kButtonId_Plus: return "+";
case kButtonId_Minus: return "-"; case kButtonId_Minus: return "-";
case kButtonId_Up: return "up"; case kButtonId_Up: return wxTRANSLATE("up");
case kButtonId_Down: return "down"; case kButtonId_Down: return wxTRANSLATE("down");
case kButtonId_Left: return "left"; case kButtonId_Left: return wxTRANSLATE("left");
case kButtonId_Right: return "right"; case kButtonId_Right: return wxTRANSLATE("right");
case kButtonId_Nunchuck_Z: return "Z"; case kButtonId_Nunchuck_Z: return "Z";
case kButtonId_Nunchuck_C: return "C"; case kButtonId_Nunchuck_C: return "C";
case kButtonId_Nunchuck_Up: return "up"; case kButtonId_Nunchuck_Up: return wxTRANSLATE("up");
case kButtonId_Nunchuck_Down: return "down"; case kButtonId_Nunchuck_Down: return wxTRANSLATE("down");
case kButtonId_Nunchuck_Left: return "left"; case kButtonId_Nunchuck_Left: return wxTRANSLATE("left");
case kButtonId_Nunchuck_Right: return "right"; case kButtonId_Nunchuck_Right: return wxTRANSLATE("right");
default: default:
return ""; return "";

View File

@ -1,7 +1,6 @@
#pragma once #pragma once
#include "input/emulated/WPADController.h" #include "input/emulated/WPADController.h"
#include "gui/input/panels/WiimoteInputPanel.h"
class WiimoteController : public WPADController class WiimoteController : public WPADController
{ {