mirror of
https://github.com/juce-framework/JUCE.git
synced 2026-01-10 23:44:24 +00:00
OSX main menu recent files list fixes.
This commit is contained in:
parent
5918d039ce
commit
00e77a7ac2
3 changed files with 14 additions and 9 deletions
|
|
@ -89,8 +89,10 @@ public:
|
|||
|
||||
mainWindowList.createWindowIfNoneAreOpen();
|
||||
|
||||
#if JUCE_MAC
|
||||
MenuBarModel::setMacMainMenu (menuModel, nullptr, "Open Recent");
|
||||
#if JUCE_MAC
|
||||
// NB: the native recent menus doesn't work at the moment - must reenable this when fixed
|
||||
//MenuBarModel::setMacMainMenu (menuModel, nullptr, "Open Recent");
|
||||
MenuBarModel::setMacMainMenu (menuModel, nullptr);
|
||||
#endif
|
||||
|
||||
struct ModuleFolderChecker : public CallbackMessage
|
||||
|
|
|
|||
|
|
@ -254,7 +254,7 @@ int JUCEApplication::main()
|
|||
extern void initialiseNSApplication();
|
||||
#endif
|
||||
|
||||
extern const char** juce_argv; // declared in juce_core
|
||||
extern const char* const* juce_argv; // declared in juce_core
|
||||
extern int juce_argc;
|
||||
|
||||
StringArray JUCEApplication::getCommandLineParameterArray()
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue