diff --git a/macosx/AddMagnetWindowController.mm b/macosx/AddMagnetWindowController.mm index 1f7e82456..12e6b269d 100644 --- a/macosx/AddMagnetWindowController.mm +++ b/macosx/AddMagnetWindowController.mm @@ -24,16 +24,6 @@ typedef NS_ENUM(NSUInteger, PopupPriority) { @property(nonatomic) IBOutlet NSPopUpButton* fGroupPopUp; @property(nonatomic) IBOutlet NSPopUpButton* fPriorityPopUp; -//remove these when switching to auto layout -@property(nonatomic) IBOutlet NSTextField* fMagnetLinkLabel; -@property(nonatomic) IBOutlet NSTextField* fDownloadToLabel; -@property(nonatomic) IBOutlet NSTextField* fGroupLabel; -@property(nonatomic) IBOutlet NSTextField* fPriorityLabel; -@property(nonatomic) IBOutlet NSButton* fChangeDestinationButton; -@property(nonatomic) IBOutlet NSBox* fDownloadToBox; -@property(nonatomic) IBOutlet NSButton* fAddButton; -@property(nonatomic) IBOutlet NSButton* fCancelButton; - @property(nonatomic, readonly) Controller* fController; @property(nonatomic) NSString* fDestination; @@ -105,64 +95,6 @@ typedef NS_ENUM(NSUInteger, PopupPriority) { self.fLocationField.stringValue = @""; self.fLocationImageView.image = nil; } - - // TODO: adopt auto layout instead - [self.fMagnetLinkLabel sizeToFit]; - - CGFloat const downloadToLabelOldWidth = self.fDownloadToLabel.frame.size.width; - [self.fDownloadToLabel sizeToFit]; - CGFloat const changeDestOldWidth = self.fChangeDestinationButton.frame.size.width; - [self.fChangeDestinationButton sizeToFit]; - NSRect changeDestFrame = self.fChangeDestinationButton.frame; - changeDestFrame.origin.x -= changeDestFrame.size.width - changeDestOldWidth; - self.fChangeDestinationButton.frame = changeDestFrame; - - NSRect downloadToBoxFrame = self.fDownloadToBox.frame; - CGFloat const downloadToBoxSizeDiff = (self.fDownloadToLabel.frame.size.width - downloadToLabelOldWidth) + - (changeDestFrame.size.width - changeDestOldWidth); - downloadToBoxFrame.size.width -= downloadToBoxSizeDiff; - downloadToBoxFrame.origin.x -= downloadToLabelOldWidth - self.fDownloadToLabel.frame.size.width; - self.fDownloadToBox.frame = downloadToBoxFrame; - - NSRect groupPopUpFrame = self.fGroupPopUp.frame; - NSRect priorityPopUpFrame = self.fPriorityPopUp.frame; - CGFloat const popUpOffset = groupPopUpFrame.origin.x - NSMaxX(self.fGroupLabel.frame); - [self.fGroupLabel sizeToFit]; - [self.fPriorityLabel sizeToFit]; - NSRect groupLabelFrame = self.fGroupLabel.frame; - NSRect priorityLabelFrame = self.fPriorityLabel.frame; - //first bring them both to the left edge - groupLabelFrame.origin.x = MIN(groupLabelFrame.origin.x, priorityLabelFrame.origin.x); - priorityLabelFrame.origin.x = MIN(groupLabelFrame.origin.x, priorityLabelFrame.origin.x); - //then align on the right - CGFloat const labelWidth = MAX(groupLabelFrame.size.width, priorityLabelFrame.size.width); - groupLabelFrame.origin.x += labelWidth - groupLabelFrame.size.width; - priorityLabelFrame.origin.x += labelWidth - priorityLabelFrame.size.width; - groupPopUpFrame.origin.x = NSMaxX(groupLabelFrame) + popUpOffset; - priorityPopUpFrame.origin.x = NSMaxX(priorityLabelFrame) + popUpOffset; - self.fGroupLabel.frame = groupLabelFrame; - self.fGroupPopUp.frame = groupPopUpFrame; - self.fPriorityLabel.frame = priorityLabelFrame; - self.fPriorityPopUp.frame = priorityPopUpFrame; - - CGFloat const minButtonWidth = 82.0; - CGFloat const oldAddButtonWidth = self.fAddButton.bounds.size.width; - CGFloat const oldCancelButtonWidth = self.fCancelButton.bounds.size.width; - [self.fAddButton sizeToFit]; - [self.fCancelButton sizeToFit]; - NSRect addButtonFrame = self.fAddButton.frame; - NSRect cancelButtonFrame = self.fCancelButton.frame; - CGFloat buttonWidth = MAX(addButtonFrame.size.width, cancelButtonFrame.size.width); - buttonWidth = MAX(buttonWidth, minButtonWidth); - addButtonFrame.size.width = buttonWidth; - cancelButtonFrame.size.width = buttonWidth; - CGFloat const addButtonWidthIncrease = buttonWidth - oldAddButtonWidth; - addButtonFrame.origin.x -= addButtonWidthIncrease; - cancelButtonFrame.origin.x -= addButtonWidthIncrease + (buttonWidth - oldCancelButtonWidth); - self.fAddButton.frame = addButtonFrame; - self.fCancelButton.frame = cancelButtonFrame; - - [self.fStartCheck sizeToFit]; } - (void)windowDidLoad diff --git a/macosx/Base.lproj/AddMagnetWindow.xib b/macosx/Base.lproj/AddMagnetWindow.xib index 9cbf5646a..e476ac613 100644 --- a/macosx/Base.lproj/AddMagnetWindow.xib +++ b/macosx/Base.lproj/AddMagnetWindow.xib @@ -8,18 +8,10 @@ - - - - - - - - @@ -31,7 +23,7 @@ - + @@ -99,11 +91,11 @@ Gw - + - + @@ -117,7 +109,7 @@ Gw - + @@ -125,7 +117,7 @@ Gw - + @@ -133,7 +125,7 @@ Gw - + @@ -156,7 +148,7 @@ Gw - + @@ -164,13 +156,13 @@ Gw - + - + - + @@ -181,7 +173,7 @@ Gw - + @@ -202,7 +194,7 @@ Gw