diff --git a/Source/Components/ColourPicker.h b/Source/Components/ColourPicker.h index db5191d8d..56c9e2bad 100644 --- a/Source/Components/ColourPicker.h +++ b/Source/Components/ColourPicker.h @@ -87,16 +87,17 @@ class Eyedropper : public Timer } } - void showEyedropper(Component* topLevelComponent, std::function cb) + void showEyedropper(PluginEditor* targetEditor, Component* topLevelComponent, std::function cb) { callback = std::move(cb); colourDisplayer.show(); topLevel = topLevelComponent; topLevel->addMouseListener(this, true); - + editor = targetEditor; + timerCount = 0; timerCallback(); - startTimerHz(60); + startTimerHz(20); } void hideEyedropper() @@ -118,16 +119,22 @@ class Eyedropper : public Timer void timerCallback() override { - timerCount--; - if (timerCount <= 0) { - componentImage = topLevel->createComponentSnapshot(topLevel->getLocalBounds(), false, 1.0f); - timerCount = 20; - } - auto position = topLevel->getMouseXYRelative(); + auto surfaceMousePosition = editor->nvgSurface.getLocalPoint(topLevel, position); + auto mouseOverSurface = editor->nvgSurface.getLocalBounds().contains(surfaceMousePosition); + if(mouseOverSurface) { + editor->nvgSurface.setRenderThroughImage(true); + editor->nvgSurface.render(); + } + + componentImage = topLevel->createComponentSnapshot(topLevel->getLocalBounds(), false, 1.0f); colourDisplayer.setTopLeftPosition(topLevel->localPointToGlobal(position).translated(-20, -20)); setColour(componentImage.getPixelAt(position.x, position.y)); + + if(mouseOverSurface) { + editor->nvgSurface.setRenderThroughImage(false); + } } std::function callback; @@ -137,6 +144,7 @@ class Eyedropper : public Timer EyedropperDisplayComponnent colourDisplayer; Image componentImage; Colour currentColour; + PluginEditor* editor; }; class ColourPicker : public Component { @@ -178,20 +186,14 @@ class ColourPicker : public Component { }; public: - void show(Component* topLevelComponent, bool onlySendCallbackOnClose, Colour currentColour, Rectangle bounds, std::function const& colourCallback) + void show(PluginEditor* editorComponent, Component* topLevelComponent, bool onlySendCallbackOnClose, Colour currentColour, Rectangle bounds, std::function const& colourCallback) { callback = colourCallback; onlyCallBackOnClose = onlySendCallbackOnClose; - + editor = editorComponent; + _topLevelComponent = topLevelComponent; - /* - Component* parent = nullptr; - if (!ProjectInfo::canUseSemiTransparentWindows()) { - parent = topLevelComponent; - bounds = topLevelComponent->getLocalArea(nullptr, bounds); - } */ - setCurrentColour(currentColour); // we need to put the selector into a holder, as launchAsynchronously will delete the component when its done @@ -248,7 +250,7 @@ class ColourPicker : public Component { _topLevelComponent = getTopLevelComponent(); showEyedropper.onClick = [this]() mutable { - eyedropper.showEyedropper(_topLevelComponent, [this](Colour pickedColour) { + eyedropper.showEyedropper(editor, _topLevelComponent, [this](Colour pickedColour) { setCurrentColour(pickedColour); }); }; @@ -733,7 +735,8 @@ class ColourPicker : public Component { Eyedropper eyedropper; Component* _topLevelComponent; - + PluginEditor* editor; + bool onlyCallBackOnClose; std::function callback = [](Colour) { }; diff --git a/Source/Components/PropertiesPanel.h b/Source/Components/PropertiesPanel.h index 39ffdaa7b..b4460ed17 100644 --- a/Source/Components/PropertiesPanel.h +++ b/Source/Components/PropertiesPanel.h @@ -602,7 +602,7 @@ class PropertiesPanel : public Component { bool isDown = getValue(toggleStateValue); auto bounds = getLocalBounds().toFloat().removeFromRight(getWidth() / (2.0f - hideLabel)); - auto buttonBounds = bounds.reduced(6); + auto buttonBounds = bounds.reduced(4); auto contrast = isDown ? 0.2f : 0.05f; if(isMouseOver()) contrast += 0.025; @@ -717,7 +717,7 @@ class PropertiesPanel : public Component { void resized() override { - auto bounds = getLocalBounds().removeFromRight(getWidth() / (2 - hideLabel)).reduced(6); + auto bounds = getLocalBounds().removeFromRight(getWidth() / (2 - hideLabel)).reduced(4); swatchComponent.setBounds(bounds); hexValueEditor.setBounds(bounds); } @@ -738,7 +738,7 @@ class PropertiesPanel : public Component { } else { auto pickerBounds = getScreenBounds().expanded(5); - ColourPicker::getInstance().show(getTopLevelComponent(), false, Colour::fromString(currentColour.toString()), pickerBounds, [_this = SafePointer(this)](Colour c) { + ColourPicker::getInstance().show(findParentComponentOfClass(), getTopLevelComponent(), false, Colour::fromString(currentColour.toString()), pickerBounds, [_this = SafePointer(this)](Colour c) { if (!_this) return; @@ -788,7 +788,7 @@ class PropertiesPanel : public Component { void mouseDown(MouseEvent const& e) override { auto pickerBounds = getScreenBounds().expanded(5); - ColourPicker::getInstance().show(getTopLevelComponent(), false, Colour::fromString(colourValue.toString()), pickerBounds, [_this = SafePointer(this)](Colour c) { + ColourPicker::getInstance().show(findParentComponentOfClass(), getTopLevelComponent(), false, Colour::fromString(colourValue.toString()), pickerBounds, [_this = SafePointer(this)](Colour c) { if (!_this) return; diff --git a/Source/Objects/CanvasObject.h b/Source/Objects/CanvasObject.h index d9dbef8f0..264339ffa 100644 --- a/Source/Objects/CanvasObject.h +++ b/Source/Objects/CanvasObject.h @@ -31,7 +31,7 @@ class CanvasObject final : public ObjectBase { objectParameters.addParamSize(&sizeProperty); objectParameters.addParamInt("Active area size", ParameterCategory::cDimensions, &hitAreaSize, 15); - objectParameters.addParamColour("Canvas color", cGeneral, &iemHelper.secondaryColour, PlugDataColour::guiObjectInternalOutlineColour); + objectParameters.addParamColour("Background", cGeneral, &iemHelper.secondaryColour, PlugDataColour::guiObjectInternalOutlineColour); iemHelper.addIemParameters(objectParameters, false, true, 20, 12, 14); setRepaintsOnMouseActivity(true); } diff --git a/Source/Objects/ColourPickerObject.h b/Source/Objects/ColourPickerObject.h index 36c810949..abdad096f 100644 --- a/Source/Objects/ColourPickerObject.h +++ b/Source/Objects/ColourPickerObject.h @@ -30,7 +30,7 @@ class ColourPickerObject final : public TextBase { sscanf(colors->x_color, "#%02x%02x%02x", &red, &green, &blue); } - ColourPicker::getInstance().show(getTopLevelComponent(), true, Colour(red, green, blue), object->getScreenBounds(), [_this = SafePointer(this)](Colour c) { + ColourPicker::getInstance().show(findParentComponentOfClass(), getTopLevelComponent(), true, Colour(red, green, blue), object->getScreenBounds(), [_this = SafePointer(this)](Colour c) { if (!_this) return; diff --git a/Source/Objects/KnobObject.h b/Source/Objects/KnobObject.h index 93df458ee..0966e4f4a 100644 --- a/Source/Objects/KnobObject.h +++ b/Source/Objects/KnobObject.h @@ -266,7 +266,7 @@ class KnobObject final : public ObjectBase { objectParameters.addParamColourFG(&primaryColour); objectParameters.addParamColourBG(&secondaryColour); - objectParameters.addParamColour("Arc color", cAppearance, &arcColour, PlugDataColour::guiObjectInternalOutlineColour); + objectParameters.addParamColour("Arc", cAppearance, &arcColour, PlugDataColour::guiObjectInternalOutlineColour); objectParameters.addParamBool("Fill background", cAppearance, &outline, { "No", "Yes" }, 1); objectParameters.addParamBool("Show arc", cAppearance, &showArc, { "No", "Yes" }, 1); } diff --git a/Source/Objects/MessboxObject.h b/Source/Objects/MessboxObject.h index 48b65e453..d8c516aa9 100644 --- a/Source/Objects/MessboxObject.h +++ b/Source/Objects/MessboxObject.h @@ -50,7 +50,7 @@ class MessboxObject final : public ObjectBase editor.setReadOnly(!isLocked); objectParameters.addParamSize(&sizeProperty); - objectParameters.addParamColour("Text color", cAppearance, &primaryColour, PlugDataColour::canvasTextColourId); + objectParameters.addParamColour("Text", cAppearance, &primaryColour, PlugDataColour::canvasTextColourId); objectParameters.addParamColourBG(&secondaryColour); objectParameters.addParamInt("Font size", cAppearance, &fontSize, 12); objectParameters.addParamBool("Bold", cAppearance, &bold, { "No", "Yes" }, 0); diff --git a/Source/Objects/NoteObject.h b/Source/Objects/NoteObject.h index 22ebf20b1..4c73b7fce 100644 --- a/Source/Objects/NoteObject.h +++ b/Source/Objects/NoteObject.h @@ -89,7 +89,7 @@ class NoteObject final : public ObjectBase { }; objectParameters.addParamInt("Width", cDimensions, &width); - objectParameters.addParamColour("Text color", cAppearance, &primaryColour, PlugDataColour::canvasTextColourId); + objectParameters.addParamColour("Text", cAppearance, &primaryColour, PlugDataColour::canvasTextColourId); objectParameters.addParamColourBG(&secondaryColour); objectParameters.addParamFont("Font", cAppearance, &font, "Inter"); objectParameters.addParamInt("Font size", cAppearance, &fontSize, 14); diff --git a/Source/Objects/ScopeObject.h b/Source/Objects/ScopeObject.h index fb1f905c6..1d0085519 100644 --- a/Source/Objects/ScopeObject.h +++ b/Source/Objects/ScopeObject.h @@ -31,7 +31,7 @@ class ScopeObject final : public ObjectBase objectParameters.addParamSize(&sizeProperty); objectParameters.addParamColourFG(&primaryColour); - objectParameters.addParamColour("Grid color", cAppearance, &gridColour, PlugDataColour::guiObjectInternalOutlineColour); + objectParameters.addParamColour("Grid", cAppearance, &gridColour, PlugDataColour::guiObjectInternalOutlineColour); objectParameters.addParamColourBG(&secondaryColour); objectParameters.addParamCombo("Trigger mode", cGeneral, &triggerMode, { "None", "Up", "Down" }, 1); objectParameters.addParamFloat("Trigger value", cGeneral, &triggerValue, 0.0f); diff --git a/Source/Objects/VUMeterObject.h b/Source/Objects/VUMeterObject.h index b8a629a56..ec47c284e 100644 --- a/Source/Objects/VUMeterObject.h +++ b/Source/Objects/VUMeterObject.h @@ -87,7 +87,7 @@ class VUMeterObject final : public ObjectBase { objectParameters.addParamSize(&sizeProperty); objectParameters.addParamReceiveSymbol(&iemHelper.receiveSymbol); objectParameters.addParamBool("Show scale", ParameterCategory::cAppearance, &showScale, { "No", "Yes" }, 1); - objectParameters.addParamColour("Background color", ParameterCategory::cAppearance, &iemHelper.secondaryColour); + objectParameters.addParamColour("Background", ParameterCategory::cAppearance, &iemHelper.secondaryColour); iemHelper.addIemParameters(objectParameters, false, false, -1); updateLabel(); diff --git a/Source/Sidebar/Inspector.h b/Source/Sidebar/Inspector.h index ab4dd04d7..fa8431d92 100644 --- a/Source/Sidebar/Inspector.h +++ b/Source/Sidebar/Inspector.h @@ -213,12 +213,12 @@ class Inspector : public Component { else if (objectParameters.size() == 1) { auto newPanel = createPanel(type, name, value, options, onInteractionFn); - newPanel->setPreferredHeight(32); + newPanel->setPreferredHeight(30); panels.add(newPanel); } else { auto* redirectedProperty = redirector.addProperty(value, otherValues); auto newPanel = createPanel(type, name, redirectedProperty, options); - newPanel->setPreferredHeight(32); + newPanel->setPreferredHeight(30); panels.add(newPanel); } }