diff --git a/aegisub/src/colour_button.cpp b/aegisub/src/colour_button.cpp index a6e68e0fb..19bcbbe21 100644 --- a/aegisub/src/colour_button.cpp +++ b/aegisub/src/colour_button.cpp @@ -32,7 +32,15 @@ ColourButton::ColourButton(wxWindow *parent, wxSize const& size, agi::Color col, { UpdateBitmap(); Bind(wxEVT_COMMAND_BUTTON_CLICKED, [=](wxCommandEvent&) { - GetColorFromUser(GetParent(), colour, this); + GetColorFromUser(GetParent(), colour, [=](agi::Color new_color) { + colour = new_color; + UpdateBitmap(); + + wxThreadEvent evt(EVT_COLOR, GetId()); + evt.SetEventObject(this); + evt.SetPayload(colour); + AddPendingEvent(evt); + }); }); } @@ -43,13 +51,3 @@ void ColourButton::UpdateBitmap() { dc.DrawRectangle(0, 0, bmp.GetWidth(), bmp.GetHeight()); SetBitmapLabel(bmp); } - -void ColourButton::SetColour(agi::Color new_color) { - colour = new_color; - UpdateBitmap(); - - wxThreadEvent evt(EVT_COLOR, GetId()); - evt.SetEventObject(this); - evt.SetPayload(colour); - AddPendingEvent(evt); -} diff --git a/aegisub/src/colour_button.h b/aegisub/src/colour_button.h index d279da1c0..af317c9d3 100644 --- a/aegisub/src/colour_button.h +++ b/aegisub/src/colour_button.h @@ -30,8 +30,6 @@ class ColourButton: public wxButton { /// Update the bitmap label after the color is changed void UpdateBitmap(); - /// Callback for the colorpicker dialog - void SetColour(agi::Color colour); public: /// Constructor diff --git a/aegisub/src/dialog_colorpicker.h b/aegisub/src/dialog_colorpicker.h index 91ae3a15a..676eaf8e3 100644 --- a/aegisub/src/dialog_colorpicker.h +++ b/aegisub/src/dialog_colorpicker.h @@ -31,15 +31,3 @@ class wxWindow; /// @param callback Function called whenever the selected color changes /// @return Did the user accept the new color? bool GetColorFromUser(wxWindow* parent, agi::Color original, std::function callback); - -/// @brief Get a color from the user via a color picker dialog -/// @param T Class which the callback method belongs to -/// @param method Callback method -/// @param parent Parent window -/// @param original Initial color to select -/// @param callbackObj Object to call callback method on. Must be of type T. -/// @return Did the user accept the new color? -template -bool GetColorFromUser(wxWindow* parent, agi::Color original, T* callbackObj) { - return GetColorFromUser(parent, original, std::bind(method, callbackObj, std::placeholders::_1)); -}