diff --git a/resources/Delay.h b/resources/Delay.h index 8e827e7..5d9b5d5 100644 --- a/resources/Delay.h +++ b/resources/Delay.h @@ -127,7 +127,7 @@ class Delay : private ProcessorBase writePosition += L; - writePosition = writePosition % buffer.getNumSamples(); + writePosition = writePosition % static_cast(buffer.getNumSamples()); } } @@ -138,11 +138,11 @@ class Delay : private ProcessorBase void getReadWritePositions (bool read, int numSamples, int& startIndex, int& blockSize1, int& blockSize2) { - const int L = buffer.getNumSamples(); + const size_t L = static_cast(buffer.getNumSamples()); size_t pos = writePosition; if (read) { - pos = static_cast (static_cast (writePosition) - delayInSamples); + pos = static_cast (static_cast (writePosition) - delayInSamples); } if (pos < 0) pos = pos + L; diff --git a/resources/customComponents/AlertOverlay.h b/resources/customComponents/AlertOverlay.h index 680708e..9b3b237 100644 --- a/resources/customComponents/AlertOverlay.h +++ b/resources/customComponents/AlertOverlay.h @@ -116,9 +116,9 @@ class AlertOverlay : public Component, private Button::Listener, private Timer } - }; + } - ~AlertOverlay() { + ~AlertOverlay() override { delete tbOkay; if (type == Type::disturberTracking || type == Type::signalTracking) { @@ -127,7 +127,7 @@ class AlertOverlay : public Component, private Button::Listener, private Timer stopTimer(); delete ppVisualizer; } - }; + } void paint (Graphics& g) override @@ -164,14 +164,14 @@ class AlertOverlay : public Component, private Button::Listener, private Timer if (type == Type::errorMessage) { - tbOkay->setBounds(width / 2.0f - errorButtonWidth / 2.0f, height - buttonHeight - mB, errorButtonWidth, buttonHeight); + tbOkay->setBounds(width / 2 - errorButtonWidth / 2, height - buttonHeight - mB, errorButtonWidth, buttonHeight); } else if (type == Type::disturberTracking || type == Type::signalTracking) { tbOkay->setBounds(mL + dvWidth + horSpace, height - buttonHeight - mB, trackingButtonWidth, buttonHeight); tbRatio->setBounds(mL + dvWidth + trackingButtonWidth + buttonMargin + horSpace, height - buttonHeight - mB, trackingButtonWidth, buttonHeight); tbCancel->setBounds(mL + dvWidth + 2 * trackingButtonWidth + 2 * buttonMargin + horSpace, height - buttonHeight - mB, trackingButtonWidth, buttonHeight); - ppVisualizer->setBounds(mL, mT + titleHeight + textMargin - 10.0f, dvWidth, dvWidth); + ppVisualizer->setBounds(mL, mT + titleHeight + textMargin - 10, dvWidth, dvWidth); } } diff --git a/resources/customComponents/AnimatedLabel.h b/resources/customComponents/AnimatedLabel.h index 91bc103..ae40ad4 100644 --- a/resources/customComponents/AnimatedLabel.h +++ b/resources/customComponents/AnimatedLabel.h @@ -78,8 +78,8 @@ class AnimatedLabel : public juce::Component, void paint (juce::Graphics& g) override { - fontHeight = getTopLevelComponent()->getHeight() * 0.018f; - textArea = getLocalBounds().reduced(getLocalBounds().getWidth() * 0.06f, (getLocalBounds().getHeight() - fontHeight)/2); + fontHeight = static_cast(getTopLevelComponent()->getHeight() * 0.018f); + textArea = getLocalBounds().reduced(static_cast(getLocalBounds().getWidth() * 0.06f), (getLocalBounds().getHeight() - fontHeight)/2); g.fillAll (mainLaF.labelBackgroundColor); g.setColour (mainLaF.mainTextColor); @@ -91,12 +91,12 @@ class AnimatedLabel : public juce::Component, void resized() override { - fontHeight = getTopLevelComponent()->getHeight() * 0.018f; + fontHeight = static_cast(getTopLevelComponent()->getHeight() * 0.018f); Font font(fontHeight); - textArea = getLocalBounds().reduced(getLocalBounds().getWidth() * 0.06f, (getLocalBounds().getHeight() - fontHeight) / 2); + textArea = getLocalBounds().reduced(static_cast(getLocalBounds().getWidth() * 0.06f), (getLocalBounds().getHeight() - fontHeight) / 2); auto centredTextArea = Rectangle(textArea.getX(), textArea.getY() - fontHeight/4, textArea.getWidth(), fontHeight); - int equalSignWidth = getLocalBounds().getWidth() * 0.042f; + int equalSignWidth = static_cast(getLocalBounds().getWidth() * 0.042f); float rowProportion = static_cast(font.getStringWidth(animatedString)) / static_cast(centredTextArea.getWidth()); if (animatedString.length() > 0) @@ -105,7 +105,7 @@ class AnimatedLabel : public juce::Component, equalSignWidth = font.getStringWidth(animatedString) / animatedString.length(); if (font.getStringWidth(animatedString) > centredTextArea.getWidth()) { - int nrOfSignsInNewRow = (rowProportion - 1.f) * (centredTextArea.getWidth()/ equalSignWidth); + int nrOfSignsInNewRow = static_cast((rowProportion - 1.f) * (centredTextArea.getWidth()/ equalSignWidth)); rectArea = centredTextArea.withWidth(equalSignWidth).translated(equalSignWidth * nrOfSignsInNewRow, fontHeight); } else diff --git a/resources/customComponents/DirSlider.h b/resources/customComponents/DirSlider.h index d219c0b..40e0914 100644 --- a/resources/customComponents/DirSlider.h +++ b/resources/customComponents/DirSlider.h @@ -60,13 +60,13 @@ class DirSlider : public Slider DirSlider () : Slider(), lastDistanceFromDragStart(0), - reversed(false), - isDual(false), - scrollWheelEnabled(true), +// reversed(false), +// isDual(false), +// scrollWheelEnabled(true), tooltipActive(false), tooltipWidth(40), tooltipHeight(20), - activePolarPatternPath(-1.0f), +// activePolarPatternPath(-1.0f), patternStripSize(12), dirStrip(this) { @@ -75,7 +75,7 @@ class DirSlider : public Slider addAndMakeVisible(&dirStrip); } - ~DirSlider () {} + ~DirSlider () override {} class DirPatternStrip : public Component { @@ -90,10 +90,10 @@ class DirSlider : public Slider eightPath.loadPathFromData (eightData, sizeof (eightData)); omniPath.loadPathFromData (omniData, sizeof (omniData)); revCardPath.loadPathFromData (cardData, sizeof (cardData)); - revCardPath.applyTransform (AffineTransform::rotation(M_PI)); + revCardPath.applyTransform (AffineTransform::rotation(static_cast (M_PI))); } - ~DirPatternStrip() {} + ~DirPatternStrip() override {} void paint (Graphics& g) override { @@ -108,22 +108,48 @@ class DirSlider : public Slider boundsY, dirImgSize, dirImgSize, true, Justification::centred)); (slider->isEnabled()) ? g.setColour (Colours::white) : g.setColour (Colours::white.withMultipliedAlpha(0.5f)); - g.strokePath (revCardPath, PathStrokeType (activePatternPath == revCardFact ? 2.0f : 1.0f)); - - omniPath.applyTransform (omniPath.getTransformToScaleToFit(boundsX + 0.33 * width - dirImgSize/2.0f + 2.0f , + if (floatsEquivalent(activePatternPath, revCardFact)) + { + g.strokePath (revCardPath, PathStrokeType (2.0f)); + } + else + { + g.strokePath (revCardPath, PathStrokeType (1.0f)); + } + + omniPath.applyTransform (omniPath.getTransformToScaleToFit(static_cast (boundsX + 0.33 * width - dirImgSize / 2.0f + 2.0f), boundsY, dirImgSize, dirImgSize, true, Justification::centred)); - g.strokePath (omniPath, PathStrokeType (activePatternPath == omniFact ? 2.0f : 1.0f)); + if (floatsEquivalent(activePatternPath, omniFact)) + { + g.strokePath (omniPath, PathStrokeType (2.0f)); + } + else + { + g.strokePath (omniPath, PathStrokeType (1.0f)); + } - cardPath.applyTransform (cardPath.getTransformToScaleToFit(boundsX + 0.66 * width - dirImgSize/2.0f - 1.0f, + cardPath.applyTransform (cardPath.getTransformToScaleToFit(static_cast (boundsX + 0.66 * width - dirImgSize / 2.0f - 1.0f), boundsY, dirImgSize, dirImgSize, true, Justification::centred)); - g.strokePath (cardPath, PathStrokeType (activePatternPath == cardFact ? 2.0f : 1.0f)); + if (floatsEquivalent(activePatternPath, cardFact)) + { + g.strokePath (cardPath, PathStrokeType (2.0f)); + } + else + { + g.strokePath (cardPath, PathStrokeType (1.0f)); + } eightPath.applyTransform (eightPath.getTransformToScaleToFit(boundsX + width - dirImgSize, boundsY, dirImgSize, dirImgSize, true, Justification::centred)); - g.strokePath (eightPath, PathStrokeType (activePatternPath == eightFact ? 2.0f : 1.0f)); + if (floatsEquivalent(activePatternPath, eightFact)) { + g.strokePath (eightPath, PathStrokeType (2.0f)); + } + else { + g.strokePath (eightPath, PathStrokeType (1.0f)); + } } void mouseMove(const MouseEvent &e) override @@ -141,16 +167,17 @@ class DirSlider : public Slider else if (cardPath.getBounds().contains(posf)) activePatternPath = cardFact; else if (revCardPath.getBounds().contains(posf)) activePatternPath = revCardFact; - if (oldActivePath != activePatternPath) + if (!floatsEquivalent(oldActivePath, activePatternPath)) repaint(); } void mouseUp (const MouseEvent &e) override { + (void)e; if (!slider->isEnabled()) return; - if (activePatternPath != -1) + if (!floatsEquivalent(activePatternPath,-1)) { slider->setValue (activePatternPath, NotificationType::sendNotification); } @@ -158,6 +185,7 @@ class DirSlider : public Slider void mouseExit (const MouseEvent& e) override { + (void)e; activePatternPath = -1; repaint(); } @@ -225,6 +253,7 @@ class DirSlider : public Slider void mouseExit (const MouseEvent& e) override { + (void)e; tooltipActive = false; if (tooltipValueBox != nullptr && !tooltipValueBox->isMouseOver() && !tooltipValueBox->isBeingEdited()) @@ -248,9 +277,9 @@ class DirSlider : public Slider auto layout = lf.getSliderLayout (*this); sliderRect = layout.sliderBounds; - sliderRect.removeFromTop(patternStripSize); + sliderRect.removeFromTop(static_cast (patternStripSize)); - dirPatternBounds = getLocalBounds().removeFromTop(patternStripSize); + dirPatternBounds = getLocalBounds().removeFromTop(static_cast (patternStripSize)); dirStrip.setBounds(dirPatternBounds); initValueBox(); @@ -279,12 +308,12 @@ class DirSlider : public Slider void tooltipTextChanged() { - if (getValueFromText (tooltipValueBox->getText()) == getValue()) + if (doublesEquivalent(getValueFromText (tooltipValueBox->getText()), getValue())) return; double newValue = snapValueToRange (getValueFromText (tooltipValueBox->getText())); - if (newValue != static_cast (getValue())) + if (!doublesEquivalent(newValue, getValue())) { setValue (newValue, NotificationType::sendNotification); tooltipValueBox->setText (getTextFromValue (newValue), NotificationType::dontSendNotification); @@ -307,16 +336,16 @@ class DirSlider : public Slider private: int lastDistanceFromDragStart; - bool reversed; - bool isDual; - bool scrollWheelEnabled; +// bool reversed; +// bool isDual; +// bool scrollWheelEnabled; bool tooltipActive; Rectangle sliderRect; Rectangle dirPatternBounds; int tooltipWidth; int tooltipHeight; - float activePolarPatternPath; +// float activePolarPatternPath; float patternStripSize; std::unique_ptr