Ignore:
Timestamp:
Jul 23, 2011, 3:54:02 PM (11 years ago)
Author:
livings124
Message:

#4379 Lion: Use popovers for global gear button

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/macosx/Controller.m

    r12556 r12576  
    4141#import "AddMagnetWindowController.h"
    4242#import "MessageWindowController.h"
     43#import "GlobalOptionsPopoverViewController.h"
    4344#import "ButtonToolbarItem.h"
    4445#import "GroupToolbarItem.h"
     
    22152216}
    22162217
     2218- (IBAction) showGlobalPopover: (id) sender
     2219{
     2220    if ([NSApp isOnLionOrBetter])
     2221    {
     2222        NSPopover * popover = [[NSPopoverLion alloc] init];
     2223        [popover setBehavior: NSPopoverBehaviorTransient];
     2224        GlobalOptionsPopoverViewController * viewController = [[GlobalOptionsPopoverViewController alloc] initWithHandle: [PrefsController handle]];
     2225        [popover setContentViewController: viewController];
     2226       
     2227        [popover showRelativeToRect: [sender frame] ofView: sender preferredEdge: NSMaxYEdge];
     2228       
     2229        [viewController release];
     2230        [popover release];
     2231    }
     2232    else
     2233    {
     2234        //place menu below button
     2235        NSRect rect = [sender frame];
     2236        NSPoint location = rect.origin;
     2237        location.y += NSHeight(rect) + 5.0;
     2238       
     2239        if ([NSApp isOnSnowLeopardOrBetter])
     2240            [fActionMenu popUpMenuPositioningItem: nil atLocation: location inView: sender];
     2241        else
     2242        {
     2243            NSEvent * newEvent = [NSEvent mouseEventWithType: NSLeftMouseDown location: location
     2244                                               modifierFlags: NSLeftMouseDownMask timestamp: GetCurrentEventTime() windowNumber: [fWindow windowNumber]
     2245                                                     context: nil eventNumber: 1 clickCount: 1 pressure: 1];
     2246             
     2247            [NSMenu popUpContextMenu: fActionMenu withEvent: newEvent forView: sender];
     2248        }
     2249    }
     2250}
     2251
    22172252- (void) menuNeedsUpdate: (NSMenu *) menu
    22182253{
     
    23472382    [fDefaults setFloat: [[sender representedObject] floatValue] forKey: @"RatioLimit"];
    23482383   
    2349     [fPrefsController updateRatioStopField];
     2384    [fPrefsController updateRatioStopFieldOld];
    23502385}
    23512386
Note: See TracChangeset for help on using the changeset viewer.