| 889 | else |
| 890 | { |
| 891 | ctrl->SetText(LocalizeString(IDS_LEFT_BUTTON)); |
| 892 | } |
| 893 | |
| 894 | // CKeys caches row text at AddString time; action labels won't update from the |
| 895 | // generic ReloadLocalizedText path, so subscribe explicitly. |
| 896 | _langCbToken = RegisterLanguageChangedCallback([this]() { RefreshLanguage(); }); |
| 897 | } |
| 898 | |
| 899 | DisplayConfigure::~DisplayConfigure() |
| 900 | { |
| 901 | if (_langCbToken >= 0) |
| 902 | { |
| 903 | UnregisterLanguageChangedCallback(_langCbToken); |
| 904 | _langCbToken = -1; |
| 905 | } |
| 906 | } |
| 907 | |
| 908 | void DisplayConfigure::RefreshLanguage() |
| 909 | { |
| 910 | if (!_keys) |
| 911 | return; |
| 912 | UserActionDesc* userActionDesc = InputSubsystem::GetUserActionDesc(); |
| 913 | int n = _keys->GetSize(); |
| 914 | for (int i = 0; i < n && i < UAN; i++) |
| 915 | { |
| 916 | _keys->Set(i).text = LocalizeString(userActionDesc[i].desc); |
| 917 | } |
| 918 | |
| 919 | // Also refresh the three C3DActiveText labels that reflect input state. |
| 920 | auto& input = InputSubsystem::Instance(); |
| 921 | if (auto* c = dynamic_cast<C3DActiveText*>(GetCtrl(IDC_CONFIG_YREVERSED))) |
| 922 | c->SetText(LocalizeString(input.IsReverseMouse() ? IDS_CONFIG_YREVERSED : IDS_CONFIG_YNORMAL)); |
| 923 | if (auto* c = dynamic_cast<C3DActiveText*>(GetCtrl(IDC_CONFIG_JOYSTICK))) |
| 924 | c->SetText( |
| 925 | LocalizeString(input.IsJoystickEnabled() ? IDS_CONFIG_JOYSTICK_ENABLED : IDS_CONFIG_JOYSTICK_DISABLED)); |
| 926 | if (auto* c = dynamic_cast<C3DActiveText*>(GetCtrl(IDC_CONFIG_BUTTONS))) |
| 927 | c->SetText(LocalizeString(input.IsMouseButtonsReversed() ? IDS_RIGHT_BUTTON : IDS_LEFT_BUTTON)); |
| 928 | } |
| 929 | |
| 930 | void DisplayConfigure::Destroy() |
| 931 | { |
| 932 | Display::Destroy(); |
| 933 | |
| 934 | auto& input = InputSubsystem::Instance(); |
| 935 | if (_exit != IDC_OK) |
| 936 | { |
| 937 | input.SetReverseMouse(_oldRevMouse); |
| 938 | input.SetJoystickEnabled(_oldJoystickEnabled); |
| 939 | input.SetMouseSensitivityX(_oldMouseSensitivityX); |
nothing calls this directly
no test coverage detected