From f2e456d00ea56b247006d531a6f3bf1cdce66a87 Mon Sep 17 00:00:00 2001 From: jules Date: Tue, 17 Dec 2013 20:14:19 +0000 Subject: [PATCH] Minor tidying. --- .../juce_gui_basics/widgets/juce_Toolbar.cpp | 29 ++++++++----------- 1 file changed, 12 insertions(+), 17 deletions(-) diff --git a/modules/juce_gui_basics/widgets/juce_Toolbar.cpp b/modules/juce_gui_basics/widgets/juce_Toolbar.cpp index d16b712058..2987e8598c 100644 --- a/modules/juce_gui_basics/widgets/juce_Toolbar.cpp +++ b/modules/juce_gui_basics/widgets/juce_Toolbar.cpp @@ -228,7 +228,7 @@ public: private: Component::SafePointer owner; const int height; - Array oldIndexes; + Array oldIndexes; JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (MissingItemsComponent) }; @@ -285,7 +285,7 @@ void Toolbar::addItemInternal (ToolbarItemFactory& factory, if (ToolbarItemComponent* const tc = createItem (factory, itemId)) { #if JUCE_DEBUG - Array allowedIds; + Array allowedIds; factory.getAllToolbarItemIds (allowedIds); // If your factory can create an item for a given ID, it must also return @@ -308,7 +308,7 @@ void Toolbar::addItem (ToolbarItemFactory& factory, void Toolbar::addDefaultItems (ToolbarItemFactory& factoryToUse) { - Array ids; + Array ids; factoryToUse.getDefaultItemSet (ids); clear(); @@ -675,32 +675,27 @@ public: void positionNearBar() { const Rectangle screenSize (toolbar.getParentMonitorArea()); - const int tbx = toolbar.getScreenX(); - const int tby = toolbar.getScreenY(); + Point pos (toolbar.getScreenPosition()); const int gap = 8; - int x, y; - if (toolbar.isVertical()) { - y = tby; - - if (tbx > screenSize.getCentreX()) - x = tbx - getWidth() - gap; + if (pos.x > screenSize.getCentreX()) + pos.x -= getWidth() - gap; else - x = tbx + toolbar.getWidth() + gap; + pos.x += toolbar.getWidth() + gap; } else { - x = tbx + (toolbar.getWidth() - getWidth()) / 2; + pos.x += (toolbar.getWidth() - getWidth()) / 2; - if (tby > screenSize.getCentreY()) - y = tby - getHeight() - gap; + if (pos.y > screenSize.getCentreY()) + pos.y -= getHeight() - gap; else - y = tby + toolbar.getHeight() + gap; + pos.y += toolbar.getHeight() + gap; } - setTopLeftPosition (x, y); + setTopLeftPosition (pos); } private: