upgrade to JUCE 5.4.3. Remove (probably) unused JUCE modules. Remove VST2 target (it's been end-of-life'd by Steinberg and by JUCE)
This commit is contained in:
@ -40,7 +40,7 @@ struct PopupMenu::HelperClasses
|
||||
{
|
||||
|
||||
class MouseSourceState;
|
||||
class MenuWindow;
|
||||
struct MenuWindow;
|
||||
|
||||
static bool canBeTriggered (const PopupMenu::Item& item) noexcept { return item.isEnabled && item.itemID != 0 && ! item.isSectionHeader; }
|
||||
static bool hasActiveSubMenu (const PopupMenu::Item& item) noexcept { return item.isEnabled && item.subMenu != nullptr && item.subMenu->items.size() > 0; }
|
||||
@ -77,9 +77,10 @@ struct ItemComponent : public Component
|
||||
: item (i), customComp (i.customComponent)
|
||||
{
|
||||
if (item.isSectionHeader)
|
||||
customComp = new HeaderItemComponent (item.text);
|
||||
customComp = *new HeaderItemComponent (item.text);
|
||||
|
||||
addAndMakeVisible (customComp);
|
||||
if (customComp != nullptr)
|
||||
addAndMakeVisible (*customComp);
|
||||
|
||||
parent.addAndMakeVisible (this);
|
||||
|
||||
@ -93,9 +94,9 @@ struct ItemComponent : public Component
|
||||
addMouseListener (&parent, false);
|
||||
}
|
||||
|
||||
~ItemComponent()
|
||||
~ItemComponent() override
|
||||
{
|
||||
removeChildComponent (customComp);
|
||||
removeChildComponent (customComp.get());
|
||||
}
|
||||
|
||||
void getIdealSize (int& idealWidth, int& idealHeight, const int standardItemHeight)
|
||||
@ -188,9 +189,8 @@ private:
|
||||
};
|
||||
|
||||
//==============================================================================
|
||||
class MenuWindow : public Component
|
||||
struct MenuWindow : public Component
|
||||
{
|
||||
public:
|
||||
MenuWindow (const PopupMenu& menu, MenuWindow* parentWindow,
|
||||
const Options& opts, bool alignToRectangle, bool shouldDismissOnMouseUp,
|
||||
ApplicationCommandManager** manager, float parentScaleFactor = 1.0f)
|
||||
@ -211,10 +211,10 @@ public:
|
||||
|
||||
setLookAndFeel (parent != nullptr ? &(parent->getLookAndFeel())
|
||||
: menu.lookAndFeel.get());
|
||||
|
||||
auto& lf = getLookAndFeel();
|
||||
|
||||
parentComponent = lf.getParentComponentForMenuOptions (options);
|
||||
const_cast<Options&>(options) = options.withParentComponent (parentComponent);
|
||||
|
||||
if (parentComponent == nullptr && parentWindow == nullptr && lf.shouldPopupMenuScaleWithTargetComponent (options))
|
||||
if (auto* targetComponent = options.getTargetComponent())
|
||||
@ -267,7 +267,7 @@ public:
|
||||
getMouseState (Desktop::getInstance().getMainMouseSource()); // forces creation of a mouse source watcher for the main mouse
|
||||
}
|
||||
|
||||
~MenuWindow()
|
||||
~MenuWindow() override
|
||||
{
|
||||
getActiveWindows().removeFirstMatchingValue (this);
|
||||
Desktop::getInstance().removeGlobalMouseListener (this);
|
||||
@ -592,10 +592,13 @@ public:
|
||||
}
|
||||
|
||||
//==============================================================================
|
||||
Rectangle<int> getParentArea (Point<int> targetPoint)
|
||||
Rectangle<int> getParentArea (Point<int> targetPoint, Component* relativeTo = nullptr)
|
||||
{
|
||||
auto parentArea = Desktop::getInstance().getDisplays().getDisplayContaining (targetPoint)
|
||||
#if JUCE_MAC
|
||||
if (relativeTo != nullptr)
|
||||
targetPoint = relativeTo->localPointToGlobal (targetPoint);
|
||||
|
||||
auto parentArea = Desktop::getInstance().getDisplays().findDisplayForPoint (targetPoint)
|
||||
#if JUCE_MAC || JUCE_ANDROID
|
||||
.userArea;
|
||||
#else
|
||||
.totalArea; // on windows, don't stop the menu overlapping the taskbar
|
||||
@ -789,7 +792,7 @@ public:
|
||||
windowPos.getHeight() - (PopupMenuSettings::scrollZone + m->getHeight())),
|
||||
currentY);
|
||||
|
||||
auto parentArea = getParentArea (windowPos.getPosition()) / scaleFactor;
|
||||
auto parentArea = getParentArea (windowPos.getPosition(), parentComponent) / scaleFactor;
|
||||
auto deltaY = wantedY - currentY;
|
||||
|
||||
windowPos.setSize (jmin (windowPos.getWidth(), parentArea.getWidth()),
|
||||
@ -909,7 +912,8 @@ public:
|
||||
activeSubMenu.reset (new HelperClasses::MenuWindow (*(childComp->item.subMenu), this,
|
||||
options.withTargetScreenArea (childComp->getScreenBounds())
|
||||
.withMinimumWidth (0)
|
||||
.withTargetComponent (nullptr),
|
||||
.withTargetComponent (nullptr)
|
||||
.withParentComponent (parentComponent),
|
||||
false, dismissOnMouseUp, managerOfChosenCommand, scaleFactor));
|
||||
|
||||
activeSubMenu->setVisible (true); // (must be called before enterModalState on Windows to avoid DropShadower confusion)
|
||||
@ -1085,7 +1089,7 @@ private:
|
||||
{
|
||||
PopupMenuSettings::menuWasHiddenBecauseOfAppChange = true;
|
||||
window.dismissMenu (nullptr);
|
||||
// Note: this object may have been deleted by the previous call..
|
||||
// Note: This object may have been deleted by the previous call.
|
||||
}
|
||||
}
|
||||
else if (wasDown && timeNow > window.windowCreationTime + 250
|
||||
@ -1096,7 +1100,7 @@ private:
|
||||
else if ((window.hasBeenOver || ! window.dismissOnMouseUp) && ! isOverAny)
|
||||
window.dismissMenu (nullptr);
|
||||
|
||||
// Note: this object may have been deleted by the previous call..
|
||||
// Note: This object may have been deleted by the previous call.
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -1738,8 +1742,13 @@ bool JUCE_CALLTYPE PopupMenu::dismissAllActiveMenus()
|
||||
auto numWindows = windows.size();
|
||||
|
||||
for (int i = numWindows; --i >= 0;)
|
||||
{
|
||||
if (auto* pmw = windows[i])
|
||||
{
|
||||
pmw->setLookAndFeel (nullptr);
|
||||
pmw->dismissMenu (nullptr);
|
||||
}
|
||||
}
|
||||
|
||||
return numWindows > 0;
|
||||
}
|
||||
@ -1853,7 +1862,9 @@ bool PopupMenu::MenuItemIterator::next()
|
||||
menus.add (currentItem->subMenu.get());
|
||||
}
|
||||
else
|
||||
{
|
||||
index.setUnchecked (index.size() - 1, index.getLast() + 1);
|
||||
}
|
||||
|
||||
while (index.size() > 0 && index.getLast() >= menus.getLast()->items.size())
|
||||
{
|
||||
|
Reference in New Issue
Block a user