From 88571ee8da80ed99faa8aa9c4d9a6715c999b3b9 Mon Sep 17 00:00:00 2001 From: jules Date: Tue, 27 Nov 2012 12:06:02 +0000 Subject: [PATCH] Minor tooltipwindow fix. --- .../lookandfeel/juce_LookAndFeel.cpp | 14 ++++---------- .../windows/juce_TooltipWindow.cpp | 18 ++++++++---------- 2 files changed, 12 insertions(+), 20 deletions(-) diff --git a/modules/juce_gui_basics/lookandfeel/juce_LookAndFeel.cpp b/modules/juce_gui_basics/lookandfeel/juce_LookAndFeel.cpp index 05ba1e1f96..a49e899166 100644 --- a/modules/juce_gui_basics/lookandfeel/juce_LookAndFeel.cpp +++ b/modules/juce_gui_basics/lookandfeel/juce_LookAndFeel.cpp @@ -1508,11 +1508,7 @@ void LookAndFeel::drawRotarySlider (Graphics& g, { Path filledArc; - filledArc.addPieSegment (rx, ry, rw, rw, - rotaryStartAngle, - angle, - thickness); - + filledArc.addPieSegment (rx, ry, rw, rw, rotaryStartAngle, angle, thickness); g.fillPath (filledArc); } @@ -1619,8 +1615,8 @@ void LookAndFeel::drawTooltip (Graphics& g, const String& text, int width, int h g.drawRect (0, 0, width, height, 1); #endif - const TextLayout tl (LookAndFeelHelpers::layoutTooltipText (text, findColour (TooltipWindow::textColourId))); - tl.draw (g, Rectangle ((float) width, (float) height)); + LookAndFeelHelpers::layoutTooltipText (text, findColour (TooltipWindow::textColourId)) + .draw (g, Rectangle ((float) width, (float) height)); } //============================================================================== @@ -1635,9 +1631,7 @@ void LookAndFeel::layoutFilenameComponent (FilenameComponent& filenameComp, { browseButton->setSize (80, filenameComp.getHeight()); - TextButton* const tb = dynamic_cast (browseButton); - - if (tb != nullptr) + if (TextButton* const tb = dynamic_cast (browseButton)) tb->changeWidthToFitText(); browseButton->setTopRightPosition (filenameComp.getWidth(), 0); diff --git a/modules/juce_gui_basics/windows/juce_TooltipWindow.cpp b/modules/juce_gui_basics/windows/juce_TooltipWindow.cpp index 1608ddb3aa..e1893c07bb 100644 --- a/modules/juce_gui_basics/windows/juce_TooltipWindow.cpp +++ b/modules/juce_gui_basics/windows/juce_TooltipWindow.cpp @@ -23,10 +23,9 @@ ============================================================================== */ -TooltipWindow::TooltipWindow (Component* const parent_, - const int millisecondsBeforeTipAppears_) +TooltipWindow::TooltipWindow (Component* const parentComp, const int delayMs) : Component ("tooltip"), - millisecondsBeforeTipAppears (millisecondsBeforeTipAppears_), + millisecondsBeforeTipAppears (delayMs), mouseClicks (0), mouseWheelMoves (0), lastHideTime (0), @@ -39,8 +38,8 @@ TooltipWindow::TooltipWindow (Component* const parent_, setAlwaysOnTop (true); setOpaque (true); - if (parent_ != nullptr) - parent_->addChildComponent (this); + if (parentComp != nullptr) + parentComp->addChildComponent (this); } TooltipWindow::~TooltipWindow() @@ -120,10 +119,9 @@ String TooltipWindow::getTipFor (Component* const c) && Process::isForegroundProcess() && ! ModifierKeys::getCurrentModifiers().isAnyMouseButtonDown()) { - TooltipClient* const ttc = dynamic_cast (c); - - if (ttc != nullptr && ! c->isCurrentlyBlockedByAnotherModalComponent()) - return ttc->getTooltip(); + if (TooltipClient* const ttc = dynamic_cast (c)) + if (! c->isCurrentlyBlockedByAnotherModalComponent()) + return ttc->getTooltip(); } return String::empty; @@ -148,7 +146,7 @@ void TooltipWindow::timerCallback() Desktop& desktop = Desktop::getInstance(); const int clickCount = desktop.getMouseButtonClickCounter(); - const int wheelCount = desktop.getMouseButtonClickCounter(); + const int wheelCount = desktop.getMouseWheelMoveCounter(); const bool mouseWasClicked = (clickCount > mouseClicks || wheelCount > mouseWheelMoves); mouseClicks = clickCount; mouseWheelMoves = wheelCount;