diff --git a/src/wx/dialogs/display-config.cpp b/src/wx/dialogs/display-config.cpp index e306a31f..d37576b4 100644 --- a/src/wx/dialogs/display-config.cpp +++ b/src/wx/dialogs/display-config.cpp @@ -8,6 +8,7 @@ #include #include #include +#include #include #include @@ -301,6 +302,14 @@ private: } // namespace +// Helper function to update slider tooltip with its current value +static void UpdateSliderTooltip(wxSlider* slider, wxCommandEvent& event) { + if (slider) { + slider->SetToolTip(wxString::Format("%d", slider->GetValue())); + } + event.Skip(); +} + // static DisplayConfig* DisplayConfig::NewInstance(wxWindow* parent) { VBAM_CHECK(parent); @@ -422,9 +431,13 @@ DisplayConfig::DisplayConfig(wxWindow* parent) wxSlider* gba_darken_slider = GetValidatedChild("GBADarken"); gba_darken_slider->SetValidator(widgets::OptionUnsignedValidator(config::OptionID::kGBADarken)); + gba_darken_slider->SetToolTip(wxString::Format("%d", gba_darken_slider->GetValue())); + gba_darken_slider->Bind(wxEVT_SLIDER, std::bind(UpdateSliderTooltip, gba_darken_slider, std::placeholders::_1)); wxSlider* gbc_lighten_slider = GetValidatedChild("GBCLighten"); gbc_lighten_slider->SetValidator(widgets::OptionUnsignedValidator(config::OptionID::kGBLighten)); + gbc_lighten_slider->SetToolTip(wxString::Format("%d", gbc_lighten_slider->GetValue())); + gbc_lighten_slider->Bind(wxEVT_SLIDER, std::bind(UpdateSliderTooltip, gbc_lighten_slider, std::placeholders::_1)); filter_selector_ = GetValidatedChild("Filter"); filter_selector_->SetValidator(FilterValidator()); diff --git a/src/wx/dialogs/sound-config.cpp b/src/wx/dialogs/sound-config.cpp index 2a6110a7..8884d295 100644 --- a/src/wx/dialogs/sound-config.cpp +++ b/src/wx/dialogs/sound-config.cpp @@ -135,6 +135,14 @@ private: } // namespace +// Helper function to update slider tooltip with its current value +static void UpdateSliderTooltip(wxSlider* slider, wxCommandEvent& event) { + if (slider) { + slider->SetToolTip(wxString::Format("%d", slider->GetValue())); + } + event.Skip(); +} + // static SoundConfig* SoundConfig::NewInstance(wxWindow* parent) { VBAM_CHECK(parent); @@ -145,6 +153,8 @@ SoundConfig::SoundConfig(wxWindow* parent) : BaseDialog(parent, "SoundConfig") { // Volume slider configuration. wxSlider* volume_slider = GetValidatedChild("Volume"); volume_slider->SetValidator(widgets::OptionIntValidator(config::OptionID::kSoundVolume)); + volume_slider->SetToolTip(wxString::Format("%d", volume_slider->GetValue())); + volume_slider->Bind(wxEVT_SLIDER, std::bind(UpdateSliderTooltip, volume_slider, std::placeholders::_1)); GetValidatedChild("Volume100") ->Bind(wxEVT_BUTTON, std::bind(&wxSlider::SetValue, volume_slider, 100)); @@ -229,17 +239,26 @@ SoundConfig::SoundConfig(wxWindow* parent) : BaseDialog(parent, "SoundConfig") { buffers_info_label_ = GetValidatedChild("BuffersInfo"); buffers_slider_ = GetValidatedChild("Buffers"); buffers_slider_->SetValidator(widgets::OptionIntValidator(config::OptionID::kSoundBuffers)); + buffers_slider_->SetToolTip(wxString::Format("%d", buffers_slider_->GetValue())); + buffers_slider_->Bind(wxEVT_SLIDER, std::bind(UpdateSliderTooltip, buffers_slider_, std::placeholders::_1)); buffers_slider_->Bind(wxEVT_SLIDER, &SoundConfig::OnBuffersChanged, this); // Game Boy configuration. - GetValidatedChild("GBEcho")->SetValidator( - widgets::OptionIntValidator(config::OptionID::kSoundGBEcho)); - GetValidatedChild("GBStereo") - ->SetValidator(widgets::OptionIntValidator(config::OptionID::kSoundGBStereo)); + wxSlider* gb_echo_slider = GetValidatedChild("GBEcho"); + gb_echo_slider->SetValidator(widgets::OptionIntValidator(config::OptionID::kSoundGBEcho)); + gb_echo_slider->SetToolTip(wxString::Format("%d", gb_echo_slider->GetValue())); + gb_echo_slider->Bind(wxEVT_SLIDER, std::bind(UpdateSliderTooltip, gb_echo_slider, std::placeholders::_1)); + + wxSlider* gb_stereo_slider = GetValidatedChild("GBStereo"); + gb_stereo_slider->SetValidator(widgets::OptionIntValidator(config::OptionID::kSoundGBStereo)); + gb_stereo_slider->SetToolTip(wxString::Format("%d", gb_stereo_slider->GetValue())); + gb_stereo_slider->Bind(wxEVT_SLIDER, std::bind(UpdateSliderTooltip, gb_stereo_slider, std::placeholders::_1)); // Game Boy Advance configuration. - GetValidatedChild("GBASoundFiltering") - ->SetValidator(widgets::OptionIntValidator(config::OptionID::kSoundGBAFiltering)); + wxSlider* gba_filtering_slider = GetValidatedChild("GBASoundFiltering"); + gba_filtering_slider->SetValidator(widgets::OptionIntValidator(config::OptionID::kSoundGBAFiltering)); + gba_filtering_slider->SetToolTip(wxString::Format("%d", gba_filtering_slider->GetValue())); + gba_filtering_slider->Bind(wxEVT_SLIDER, std::bind(UpdateSliderTooltip, gba_filtering_slider, std::placeholders::_1)); // Audio Device configuration. audio_device_selector_ = GetValidatedChild("Device"); diff --git a/src/wx/gfxviewers.cpp b/src/wx/gfxviewers.cpp index 211fa20b..fa53cc0f 100644 --- a/src/wx/gfxviewers.cpp +++ b/src/wx/gfxviewers.cpp @@ -4,6 +4,7 @@ #include #include +#include #include "core/gb/gbGlobals.h" #include "core/gba/gbaGlobals.h" @@ -16,6 +17,15 @@ #endif namespace { + +// Helper function to update slider tooltip with its current value +static void UpdateSliderTooltip(wxSlider* slider, wxCommandEvent& event) { + if (slider) { + slider->SetToolTip(wxString::Format("%d", slider->GetValue())); + } + event.Skip(); +} + void utilReadScreenPixels(uint8_t* dest, int w, int h) { uint8_t* b = dest; int sizeX = w; @@ -1549,6 +1559,11 @@ public: getradio(, "CharBase3", charbase_, 0xc000); getradio(, "CharBase4", charbase_, 0x10000); getslider(, "Palette", palette_); + wxSlider* palette_slider = XRCCTRL(*this, "Palette", wxSlider); + if (palette_slider) { + palette_slider->SetToolTip(wxString::Format("%d", palette_slider->GetValue())); + palette_slider->Bind(wxEVT_SLIDER, std::bind(UpdateSliderTooltip, palette_slider, std::placeholders::_1)); + } getlab(tileno_, "Tile", "1WWW"); getlab(addr_, "Address", "06WWWWWW"); selx_ = sely_ = -1; @@ -1741,6 +1756,11 @@ public: getradio(, "CharBase0", charbase, 0); getradio(, "CharBase1", charbase, 0x800); getslider(, "Palette", palette); + wxSlider* palette_slider = XRCCTRL(*this, "Palette", wxSlider); + if (palette_slider) { + palette_slider->SetToolTip(wxString::Format("%d", palette_slider->GetValue())); + palette_slider->Bind(wxEVT_SLIDER, std::bind(UpdateSliderTooltip, palette_slider, std::placeholders::_1)); + } getlab(tileno, "Tile", "2WW"); getlab(addr, "Address", "WWWW"); selx = sely = -1;