1
0
Fork 0
mirror of https://github.com/juce-framework/JUCE.git synced 2026-01-17 00:44:19 +00:00

Translation of OSX app menu strings. Minor misc changes and documentation fixes.

This commit is contained in:
jules 2012-08-08 14:25:59 +01:00
parent af9c71be38
commit 0ce65462af
4 changed files with 36 additions and 37 deletions

View file

@ -36,6 +36,11 @@
Analogous to the AudioSampleBuffer, this holds a set of midi events with
integer time-stamps. The buffer is kept sorted in order of the time-stamps.
If you're working with a sequence of midi events that may need to be manipulated
or read/written to a midi file, then MidiMessageSequence is probably a more
appropriate container. MidiBuffer is designed for lower-level streams of raw
midi data.
@see MidiMessage
*/
class JUCE_API MidiBuffer

View file

@ -283,6 +283,9 @@ public:
zeromem (data, sizeof (ElementType) * numElements);
}
/** This typedef can be used to get the type of the heapblock's elements. */
typedef ElementType Type;
private:
//==============================================================================
ElementType* data;

View file

@ -84,7 +84,7 @@ void StretchableObjectResizer::resizeToFit (const double targetSize)
{
const double availableExtraSpace = maxSize - currentSize;
const double targetAmountOfExtraSpace = thisIterationTarget - currentSize;
const double scale = targetAmountOfExtraSpace / availableExtraSpace;
const double scale = availableExtraSpace > 0 ? targetAmountOfExtraSpace / availableExtraSpace : 1.0;
for (int i = 0; i < items.size(); ++i)
{

View file

@ -470,7 +470,22 @@ JuceMainMenuHandler* JuceMainMenuHandler::instance = nullptr;
//==============================================================================
namespace MainMenuHelpers
{
static NSMenu* createStandardAppMenu (NSMenu* menu, const String& appName, const PopupMenu* extraItems)
static NSString* translateMenuName (const String& name)
{
return NSLocalizedString (juceStringToNS (TRANS (name)), nil);
}
static NSMenuItem* createMenuItem (NSMenu* menu, const String& name, SEL sel, NSString* key)
{
NSMenuItem* item = [[[NSMenuItem alloc] initWithTitle: translateMenuName (name)
action: sel
keyEquivalent: key] autorelease];
[item setTarget: NSApp];
[menu addItem: item];
return item;
}
static void createStandardAppMenu (NSMenu* menu, const String& appName, const PopupMenu* extraItems)
{
if (extraItems != nullptr && JuceMainMenuHandler::instance != nullptr && extraItems->getNumItems() > 0)
{
@ -480,50 +495,26 @@ namespace MainMenuHelpers
[menu addItem: [NSMenuItem separatorItem]];
}
NSMenuItem* item;
// Services...
item = [[NSMenuItem alloc] initWithTitle: NSLocalizedString (nsStringLiteral ("Services"), nil)
action: nil keyEquivalent: nsEmptyString()];
[menu addItem: item];
[item release];
NSMenu* servicesMenu = [[NSMenu alloc] initWithTitle: nsStringLiteral ("Services")];
[menu setSubmenu: servicesMenu forItem: item];
NSMenuItem* services = [[[NSMenuItem alloc] initWithTitle: translateMenuName ("Services")
action: nil keyEquivalent: nsEmptyString()] autorelease];
[menu addItem: services];
NSMenu* servicesMenu = [[[NSMenu alloc] initWithTitle: translateMenuName ("Services")] autorelease];
[menu setSubmenu: servicesMenu forItem: services];
[NSApp setServicesMenu: servicesMenu];
[servicesMenu release];
[menu addItem: [NSMenuItem separatorItem]];
// Hide + Show stuff...
item = [[NSMenuItem alloc] initWithTitle: juceStringToNS ("Hide " + appName)
action: @selector (hide:) keyEquivalent: nsStringLiteral ("h")];
[item setTarget: NSApp];
[menu addItem: item];
[item release];
createMenuItem (menu, "Hide " + appName, @selector (hide:), nsStringLiteral ("h"));
item = [[NSMenuItem alloc] initWithTitle: NSLocalizedString (nsStringLiteral ("Hide Others"), nil)
action: @selector (hideOtherApplications:) keyEquivalent: nsStringLiteral ("h")];
[item setKeyEquivalentModifierMask: NSCommandKeyMask | NSAlternateKeyMask];
[item setTarget: NSApp];
[menu addItem: item];
[item release];
[createMenuItem (menu, "Hide Others", @selector (hideOtherApplications:), nsStringLiteral ("h"))
setKeyEquivalentModifierMask: NSCommandKeyMask | NSAlternateKeyMask];
item = [[NSMenuItem alloc] initWithTitle: NSLocalizedString (nsStringLiteral ("Show All"), nil)
action: @selector (unhideAllApplications:) keyEquivalent: nsEmptyString()];
[item setTarget: NSApp];
[menu addItem: item];
[item release];
createMenuItem (menu, "Show All", @selector (unhideAllApplications:), nsEmptyString());
[menu addItem: [NSMenuItem separatorItem]];
// Quit item....
item = [[NSMenuItem alloc] initWithTitle: juceStringToNS ("Quit " + appName)
action: @selector (terminate:) keyEquivalent: nsStringLiteral ("q")];
[item setTarget: NSApp];
[menu addItem: item];
[item release];
return menu;
createMenuItem (menu, "Quit " + appName, @selector (terminate:), nsStringLiteral ("q"));
}
// Since our app has no NIB, this initialises a standard app menu...