diff --git a/AppKit/CPMenu/_CPMenuManager.j b/AppKit/CPMenu/_CPMenuManager.j index 9b680674a..210c8b8b9 100644 --- a/AppKit/CPMenu/_CPMenuManager.j +++ b/AppKit/CPMenu/_CPMenuManager.j @@ -126,8 +126,8 @@ var STICKY_TIME_INTERVAL = 0.5, } if (_keyBuffer) - { - if (([anEvent timestamp] - _startTime) > (STICKY_TIME_INTERVAL + [activeMenu numberOfItems] / 2)) + { // periodic events have a timestamp of 0 so use the currentTimestamp + if (([CPEvent currentTimestamp] - _startTime) > (STICKY_TIME_INTERVAL + [activeMenu numberOfItems] / 2)) [self selectNextItemBeginningWith:_keyBuffer inMenu:menu clearBuffer:YES]; if (type === CPPeriodic) @@ -245,7 +245,7 @@ var STICKY_TIME_INTERVAL = 0.5, 3. The user clicks, drags and then releases. Tracking ends. */ - if (_mouseWasDragged || ([anEvent timestamp] - _startTime > STICKY_TIME_INTERVAL)) + if (_mouseWasDragged || ([CPEvent currentTimestamp] - _startTime > STICKY_TIME_INTERVAL)) { /* Close the menu if: @@ -485,7 +485,7 @@ var STICKY_TIME_INTERVAL = 0.5, { if (!_keyBuffer) { - _startTime = [CPDate date]; + _startTime = [CPEvent currentTimestamp]; _keyBuffer = character; [CPEvent stopPeriodicEvents]; @@ -522,7 +522,7 @@ var STICKY_TIME_INTERVAL = 0.5, _keyBuffer = Nil; } else - _startTime = [CPDate date]; + _startTime = [CPEvent currentTimestamp]; } - (void)scrollToBeginningOfDocument:(CPMenu)menu diff --git a/Tests/Manual/CPMenuTest/AppController.j b/Tests/Manual/CPMenuTest/AppController.j index 3c2e43393..09e1c15e9 100644 --- a/Tests/Manual/CPMenuTest/AppController.j +++ b/Tests/Manual/CPMenuTest/AppController.j @@ -1,14 +1,13 @@ /* * AppController.j - * CPMenuTest + * CPMenu * - * Created by Alexander Ljungberg on August 31, 2010. - * Copyright 2010, WireLoad, LLC All rights reserved. + * Created by Blair Duncan on April 23, 2012. + * Copyright 2012, SGL Studio, BBDO Toronto All rights reserved. */ @import -@import "MyView.j" @implementation AppController : CPObject { @@ -17,16 +16,10 @@ - (void)applicationDidFinishLaunching:(CPNotification)aNotification { var theWindow = [[CPWindow alloc] initWithContentRect:CGRectMakeZero() styleMask:CPBorderlessBridgeWindowMask], - contentView = [[MyView alloc] initWithFrame:CGRectMakeZero()]; + contentView = [theWindow contentView], + popupButton = [[CPPopUpButton alloc] initWithFrame:CGRectMakeZero()]; - [contentView setAutoresizingMask:CPViewWidthSizable | CPViewHeightSizable]; - [theWindow setContentView:contentView]; - - var popupButton = [[CPPopUpButton alloc] initWithFrame:CGRectMakeZero()]; - - [popupButton addItemWithTitle:@"Item 1"]; - [popupButton addItemWithTitle:@"Item 2"]; - [popupButton addItemWithTitle:@"Item 3"]; + [popupButton addItemsWithTitles:[[CPFontManager sharedFontManager] availableFonts]]; [popupButton sizeToFit]; [popupButton setAutoresizingMask:CPViewMinXMargin | CPViewMaxXMargin | CPViewMinYMargin | CPViewMaxYMargin]; @@ -37,7 +30,8 @@ [theWindow orderFront:self]; // Uncomment the following line to turn on the standard menu bar. - [CPMenu setMenuBarVisible:YES]; + //[CPMenu setMenuBarVisible:YES]; } + @end diff --git a/Tests/Manual/CPMenuTest/MyView.j b/Tests/Manual/CPMenuTest/MyView.j deleted file mode 100644 index 0f2b01870..000000000 --- a/Tests/Manual/CPMenuTest/MyView.j +++ /dev/null @@ -1,18 +0,0 @@ -@import - -@implementation MyView : CPView -{ -} - -- (CPMenu)menu -{ - var menu = [[CPMenu alloc] initWithTitle:@""]; - - [menu addItemWithTitle:@"Item 1" action:nil keyEquivalent:nil]; - [menu addItemWithTitle:@"Item 2" action:nil keyEquivalent:nil]; - [menu addItemWithTitle:@"Item 3" action:nil keyEquivalent:nil]; - - return menu; -} - -@end \ No newline at end of file