|
|
@@ -134,7 +134,8 @@ public: |
|
|
|
if (currentModel != nullptr)
|
|
|
|
menuNames = currentModel->getMenuBarNames();
|
|
|
|
|
|
|
|
NSMenu* menuBar = [NSApp mainMenu];
|
|
|
|
NSMenu* menuBar = [[NSApp mainMenu] retain];
|
|
|
|
|
|
|
|
while ([menuBar numberOfItems] > 1 + menuNames.size())
|
|
|
|
[menuBar removeItemAtIndex: [menuBar numberOfItems] - 1];
|
|
|
|
|
|
|
@@ -149,6 +150,8 @@ public: |
|
|
|
else
|
|
|
|
updateTopLevelMenu ([menuBar itemAtIndex: 1 + i], menu, menuNames[i], menuId, i);
|
|
|
|
}
|
|
|
|
|
|
|
|
[menuBar release];
|
|
|
|
}
|
|
|
|
|
|
|
|
void menuCommandInvoked (MenuBarModel*, const ApplicationCommandTarget::InvocationInfo& info)
|
|
|
@@ -544,6 +547,9 @@ public: |
|
|
|
if (const PopupMenu* appleMenu = MenuBarModel::getMacExtraAppleItemsMenu())
|
|
|
|
oldAppleMenu = new PopupMenu (*appleMenu);
|
|
|
|
|
|
|
|
if (JuceMainMenuHandler::instance != nullptr)
|
|
|
|
oldRecentItems = JuceMainMenuHandler::instance->recentItemsMenuName;
|
|
|
|
|
|
|
|
MenuBarModel::setMacMainMenu (nullptr);
|
|
|
|
|
|
|
|
NSMenu* menu = [[NSMenu alloc] initWithTitle: nsStringLiteral ("Edit")];
|
|
|
@@ -575,12 +581,13 @@ public: |
|
|
|
|
|
|
|
~TemporaryMainMenuWithStandardCommands()
|
|
|
|
{
|
|
|
|
MenuBarModel::setMacMainMenu (oldMenu, oldAppleMenu);
|
|
|
|
MenuBarModel::setMacMainMenu (oldMenu, oldAppleMenu, oldRecentItems);
|
|
|
|
}
|
|
|
|
|
|
|
|
private:
|
|
|
|
MenuBarModel* oldMenu;
|
|
|
|
ScopedPointer<PopupMenu> oldAppleMenu;
|
|
|
|
String oldRecentItems;
|
|
|
|
|
|
|
|
// The OS view already plays an alert when clicking outside
|
|
|
|
// the modal comp, so this override avoids adding extra
|
|
|
@@ -737,8 +744,4 @@ void juce_initialiseMacMainMenu() |
|
|
|
|
|
|
|
if (JuceMainMenuHandler::instance == nullptr)
|
|
|
|
MainMenuHelpers::rebuildMainMenu (nullptr);
|
|
|
|
|
|
|
|
// Forcing a rebuild of the menus like this seems necessary to kick the native
|
|
|
|
// recent-files list into action.. (not sure precisely why though)
|
|
|
|
TemporaryMainMenuWithStandardCommands dummy; (void) dummy;
|
|
|
|
}
|