diff --git a/macosx/AddMagnetWindowController.h b/macosx/AddMagnetWindowController.h index eee77568a..08e2695c3 100644 --- a/macosx/AddMagnetWindowController.h +++ b/macosx/AddMagnetWindowController.h @@ -34,6 +34,13 @@ IBOutlet NSButton * fStartCheck; IBOutlet NSPopUpButton * fGroupPopUp, * fPriorityPopUp; + //remove these when switching to auto layout + IBOutlet NSTextField * fMagnetLinkLabel; + IBOutlet NSTextField * fDownloadToLabel, * fGroupLabel, * fPriorityLabel; + IBOutlet NSButton * fChangeDestinationButton; + IBOutlet NSBox * fDownloadToBox; + IBOutlet NSButton * fAddButton, * fCancelButton; + Controller * fController; Torrent * fTorrent; diff --git a/macosx/AddMagnetWindowController.m b/macosx/AddMagnetWindowController.m index 14eb367ff..f1408b728 100644 --- a/macosx/AddMagnetWindowController.m +++ b/macosx/AddMagnetWindowController.m @@ -94,6 +94,67 @@ [fLocationField setStringValue: @""]; [fLocationImageView setImage: nil]; } + + #warning enable after 2.7 + /* + #warning when 10.7-only, switch to auto layout + [fMagnetLinkLabel sizeToFit]; + + const CGFloat downloadToLabelOldWidth = [fDownloadToLabel frame].size.width; + [fDownloadToLabel sizeToFit]; + const CGFloat changeDestOldWidth = [fChangeDestinationButton frame].size.width; + [fChangeDestinationButton sizeToFit]; + NSRect changeDestFrame = [fChangeDestinationButton frame]; + changeDestFrame.origin.x -= changeDestFrame.size.width - changeDestOldWidth; + [fChangeDestinationButton setFrame: changeDestFrame]; + + NSRect downloadToBoxFrame = [fDownloadToBox frame]; + const CGFloat downloadToBoxSizeDiff = ([fDownloadToLabel frame].size.width - downloadToLabelOldWidth) + (changeDestFrame.size.width - changeDestOldWidth); + downloadToBoxFrame.size.width -= downloadToBoxSizeDiff; + downloadToBoxFrame.origin.x -= downloadToLabelOldWidth - [fDownloadToLabel frame].size.width; + [fDownloadToBox setFrame: downloadToBoxFrame]; + + NSRect groupPopUpFrame = [fGroupPopUp frame]; + NSRect priorityPopUpFrame = [fPriorityPopUp frame]; + const CGFloat popUpOffset = groupPopUpFrame.origin.x - NSMaxX([fGroupLabel frame]); + [fGroupLabel sizeToFit]; + [fPriorityLabel sizeToFit]; + NSRect groupLabelFrame = [fGroupLabel frame]; + NSRect priorityLabelFrame = [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 + const CGFloat 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; + [fGroupLabel setFrame: groupLabelFrame]; + [fGroupPopUp setFrame: groupPopUpFrame]; + [fPriorityLabel setFrame: priorityLabelFrame]; + [fPriorityPopUp setFrame: priorityPopUpFrame]; + + const CGFloat minButtonWidth = 82.0; + const CGFloat oldAddButtonWidth = [fAddButton bounds].size.width; + const CGFloat oldCancelButtonWidth = [fCancelButton bounds].size.width; + #warning add "extra" width that sizeToFit loses + [fAddButton sizeToFit]; + [fCancelButton sizeToFit]; + NSRect addButtonFrame = [fAddButton frame]; + NSRect cancelButtonFrame = [fCancelButton frame]; + CGFloat buttonWidth = MAX(addButtonFrame.size.width, cancelButtonFrame.size.width); + buttonWidth = MAX(buttonWidth, minButtonWidth); + addButtonFrame.size.width = buttonWidth; + cancelButtonFrame.size.width = buttonWidth; + const CGFloat addButtonWidthIncrease = buttonWidth - oldAddButtonWidth; + addButtonFrame.origin.x -= addButtonWidthIncrease; + cancelButtonFrame.origin.x -= addButtonWidthIncrease + (buttonWidth - oldCancelButtonWidth); + [fAddButton setFrame: addButtonFrame]; + [fCancelButton setFrame: cancelButtonFrame]; + + [fStartCheck sizeToFit]; + */ } - (void) windowDidLoad diff --git a/macosx/en.lproj/AddMagnetWindow.xib b/macosx/en.lproj/AddMagnetWindow.xib index c12043d8e..6f517a065 100644 --- a/macosx/en.lproj/AddMagnetWindow.xib +++ b/macosx/en.lproj/AddMagnetWindow.xib @@ -2,29 +2,29 @@ 1060 - 11C74 - 1938 - 1138.23 - 567.00 + 12B19 + 2549 + 1187 + 624.00 com.apple.InterfaceBuilder.CocoaPlugin - 1938 + 2549 - NSPopUpButton - NSButton - NSMenu - NSButtonCell - NSImageView - NSTextFieldCell NSBox - NSImageCell - NSMenuItem + NSButton + NSButtonCell NSCustomObject + NSImageCell + NSImageView + NSMenu + NSMenuItem + NSPopUpButton + NSPopUpButtonCell + NSTextField + NSTextFieldCell NSView NSWindowTemplate - NSTextField - NSPopUpButtonCell com.apple.InterfaceBuilder.CocoaPlugin @@ -75,7 +75,7 @@ YES - 130560 + 134217728 33554432 NSImage @@ -86,6 +86,7 @@ 0 NO + NO YES @@ -97,7 +98,7 @@ YES - 67239488 + 67108928 272632320 File Name @@ -125,6 +126,7 @@ + NO @@ -135,7 +137,7 @@ YES - -2080244224 + -2080374784 0 Start when added @@ -144,8 +146,12 @@ 1044 - 1211912703 + 1211912448 2 + + NSImage + NSSwitch + NSSwitch @@ -154,17 +160,17 @@ 200 25 + NO 289 - {{306, 12}, {80, 32}} + {{304, 12}, {82, 32}} - YES - 67239424 + 67108864 134217728 Add @@ -173,7 +179,7 @@ 16 - -2038284033 + -2038284288 1 @@ -181,22 +187,23 @@ 200 25 + NO 289 - {{224, 12}, {82, 32}} + {{222, 12}, {82, 32}} YES - 67239424 + 67108864 134217728 Cancel - -2038284033 + -2038284288 1 @@ -204,6 +211,7 @@ 200 25 + NO @@ -214,7 +222,7 @@ YES - 68288064 + 68157504 272630784 Magnet Link @@ -226,6 +234,7 @@ + NO @@ -244,11 +253,11 @@ YES - -2076049856 + -2076180416 2048 - 109199615 + 109199360 1 @@ -266,6 +275,7 @@ YES 2 + NO @@ -276,7 +286,7 @@ YES - 67239424 + 67108864 134348800 Changeā€¦ @@ -285,7 +295,7 @@ 3100 - -2038284033 + -2038284288 1 LucidaGrande @@ -299,6 +309,7 @@ 200 25 + NO @@ -309,7 +320,7 @@ YES - 67239424 + 67108864 272629760 Download to: @@ -317,6 +328,7 @@ + NO @@ -327,7 +339,7 @@ YES - 67239424 + 67108864 272629760 Priority: @@ -335,6 +347,7 @@ + NO @@ -345,41 +358,42 @@ YES - -2076049856 + -2076180416 2048 - 109199615 + 109199360 1 400 75 - + + + High + + 2147483647 + 1 + + NSImage + PriorityHighTemplate + + + NSImage + NSMenuCheckmark + + + NSImage + NSMenuMixedState + + _popUpItemAction: + + YES OtherViews - - - High - - 2147483647 - - NSImage - PriorityHighTemplate - - - NSImage - NSMenuCheckmark - - - NSImage - NSMenuMixedState - - _popUpItemAction: - - + Normal @@ -418,6 +432,7 @@ YES 2 + NO @@ -428,7 +443,7 @@ YES - 67239424 + 67108864 272629760 Group: @@ -436,6 +451,7 @@ + NO @@ -454,7 +470,7 @@ YES - 67239488 + 67108928 4327936 File @@ -462,6 +478,7 @@ + NO @@ -480,7 +497,7 @@ YES - 130560 + 134217728 33554432 NSImage @@ -491,6 +508,7 @@ 0 NO + NO YES @@ -506,7 +524,7 @@ {0, 0} - 67239424 + 67108864 0 @@ -543,7 +561,7 @@ {0, 0} - 67239424 + 67108864 0 Box @@ -565,7 +583,7 @@ - {{0, 0}, {1680, 1028}} + {{0, 0}, {2560, 1440}} {400, 260} {9999, 260} AddMagnetWindow @@ -662,6 +680,70 @@ 99 + + + fChangeDestinationButton + + + + 104 + + + + fDownloadToBox + + + + 105 + + + + fDownloadToLabel + + + + 106 + + + + fGroupLabel + + + + 107 + + + + fMagnetLinkLabel + + + + 108 + + + + fPriorityLabel + + + + 109 + + + + fCancelButton + + + + 110 + + + + fAddButton + + + + 111 + delegate @@ -1011,7 +1093,7 @@ - 103 + 111 @@ -1019,14 +1101,46 @@ AddMagnetWindowController NSWindowController + NSButton + NSButton + NSButton + NSBox + NSTextField + NSTextField NSPopUpButton NSTextField NSImageView + NSTextField NSTextField + NSTextField NSPopUpButton NSButton + + fAddButton + NSButton + + + fCancelButton + NSButton + + + fChangeDestinationButton + NSButton + + + fDownloadToBox + NSBox + + + fDownloadToLabel + NSTextField + + + fGroupLabel + NSTextField + fGroupPopUp NSPopUpButton @@ -1039,10 +1153,18 @@ fLocationImageView NSImageView + + fMagnetLinkLabel + NSTextField + fNameField NSTextField + + fPriorityLabel + NSTextField + fPriorityPopUp NSPopUpButton @@ -1067,15 +1189,16 @@ com.apple.InterfaceBuilder.CocoaPlugin.macosx - + YES 3 {32, 32} {128, 128} - {9, 8} - {7, 2} + {11, 11} + {10, 3} + {15, 15} {128, 128} {128, 128} {128, 128}