diff --git a/modules/juce_gui_extra/misc/juce_ColourSelector.cpp b/modules/juce_gui_extra/misc/juce_ColourSelector.cpp index ed34f1ec34..0caa010295 100644 --- a/modules/juce_gui_extra/misc/juce_ColourSelector.cpp +++ b/modules/juce_gui_extra/misc/juce_ColourSelector.cpp @@ -336,7 +336,7 @@ ColourSelector::ColourSelector (const int sectionsToShow, const int edge, const addAndMakeVisible (hueSelector = new HueSelectorComp (*this, h, gapAroundColourSpaceComponent)); } - update(); + update (sendNotification); } ColourSelector::~ColourSelector() @@ -351,14 +351,14 @@ Colour ColourSelector::getCurrentColour() const return ((flags & showAlphaChannel) != 0) ? colour : colour.withAlpha ((uint8) 0xff); } -void ColourSelector::setCurrentColour (Colour c) +void ColourSelector::setCurrentColour (Colour c, NotificationType notification) { if (c != colour) { colour = ((flags & showAlphaChannel) != 0) ? c : c.withAlpha ((uint8) 0xff); updateHSV(); - update(); + update (notification); } } @@ -370,7 +370,7 @@ void ColourSelector::setHue (float newH) { h = newH; colour = Colour (h, s, v, colour.getFloatAlpha()); - update(); + update (sendNotification); } } @@ -384,7 +384,7 @@ void ColourSelector::setSV (float newS, float newV) s = newS; v = newV; colour = Colour (h, s, v, colour.getFloatAlpha()); - update(); + update (sendNotification); } } @@ -394,14 +394,14 @@ void ColourSelector::updateHSV() colour.getHSB (h, s, v); } -void ColourSelector::update() +void ColourSelector::update (NotificationType notification) { if (sliders[0] != nullptr) { - sliders[0]->setValue ((int) colour.getRed()); - sliders[1]->setValue ((int) colour.getGreen()); - sliders[2]->setValue ((int) colour.getBlue()); - sliders[3]->setValue ((int) colour.getAlpha()); + sliders[0]->setValue ((int) colour.getRed(), notification); + sliders[1]->setValue ((int) colour.getGreen(), notification); + sliders[2]->setValue ((int) colour.getBlue(), notification); + sliders[3]->setValue ((int) colour.getAlpha(), notification); } if (colourSpace != nullptr) @@ -413,7 +413,11 @@ void ColourSelector::update() if ((flags & showColourAtTop) != 0) repaint (previewArea); - sendChangeMessage(); + if (notification != dontSendNotification) + sendChangeMessage(); + + if (notification == sendNotificationSync) + dispatchPendingMessages(); } //============================================================================== diff --git a/modules/juce_gui_extra/misc/juce_ColourSelector.h b/modules/juce_gui_extra/misc/juce_ColourSelector.h index ff2901b2db..6f2006a69e 100644 --- a/modules/juce_gui_extra/misc/juce_ColourSelector.h +++ b/modules/juce_gui_extra/misc/juce_ColourSelector.h @@ -80,7 +80,7 @@ public: Colour getCurrentColour() const; /** Changes the colour that is currently being shown. */ - void setCurrentColour (Colour newColour); + void setCurrentColour (Colour newColour, NotificationType notificationType = sendNotification); //============================================================================== /** Tells the selector how many preset colour swatches you want to have on the component. @@ -153,7 +153,7 @@ private: void setHue (float newH); void setSV (float newS, float newV); void updateHSV(); - void update(); + void update (NotificationType); void sliderValueChanged (Slider*) override; void paint (Graphics&) override; void resized() override;