From fc641d1944bcca7962290ccdbbad598d40ee7708 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=B6ren=20Kuklau?= Date: Sat, 6 Apr 2024 19:02:49 +0200 Subject: [PATCH] features/rearrange-columns: vastly improve layout --- .../ArrangeColumns/ArrangeColumnsViewItem.xib | 61 ++++++++++++------- .../ArrangeColumns/ArrangeColumnsWindow.xib | 33 +++++++--- .../StatusComposerWindowController.xib | 8 +-- .../TimelinesWindowController.swift | 37 ++++++----- 4 files changed, 83 insertions(+), 56 deletions(-) diff --git a/Mastonaut/Features/ArrangeColumns/ArrangeColumnsViewItem.xib b/Mastonaut/Features/ArrangeColumns/ArrangeColumnsViewItem.xib index f3ab6a1..ebf1a95 100644 --- a/Mastonaut/Features/ArrangeColumns/ArrangeColumnsViewItem.xib +++ b/Mastonaut/Features/ArrangeColumns/ArrangeColumnsViewItem.xib @@ -16,31 +16,48 @@ - + - - - - - - - - - - - - - - + + - - + + + + + + + + + + + + + + + + + + + + + + - - - - - + + + + diff --git a/Mastonaut/Features/ArrangeColumns/ArrangeColumnsWindow.xib b/Mastonaut/Features/ArrangeColumns/ArrangeColumnsWindow.xib index e0f599d..d91332b 100644 --- a/Mastonaut/Features/ArrangeColumns/ArrangeColumnsWindow.xib +++ b/Mastonaut/Features/ArrangeColumns/ArrangeColumnsWindow.xib @@ -17,14 +17,14 @@ - + - - + + - + - + - + - - + + @@ -66,17 +69,27 @@ DQ + + + + + + + + + + - + diff --git a/Mastonaut/Window Controllers/StatusComposerWindowController.xib b/Mastonaut/Window Controllers/StatusComposerWindowController.xib index 4125e87..6db8a54 100644 --- a/Mastonaut/Window Controllers/StatusComposerWindowController.xib +++ b/Mastonaut/Window Controllers/StatusComposerWindowController.xib @@ -1,8 +1,8 @@ - + - + @@ -50,7 +50,7 @@ - + @@ -709,7 +709,7 @@ - + diff --git a/Mastonaut/Window Controllers/TimelinesWindowController.swift b/Mastonaut/Window Controllers/TimelinesWindowController.swift index 9ce9167..c79ad0a 100644 --- a/Mastonaut/Window Controllers/TimelinesWindowController.swift +++ b/Mastonaut/Window Controllers/TimelinesWindowController.swift @@ -23,8 +23,7 @@ import Logging import MastodonKit import PullRefreshableScrollView -class TimelinesWindowController: NSWindowController, UserPopUpButtonDisplaying, ToolbarWindowController -{ +class TimelinesWindowController: NSWindowController, UserPopUpButtonDisplaying, ToolbarWindowController { private var logger: Logger! // MARK: Outlets @@ -194,20 +193,18 @@ class TimelinesWindowController: NSWindowController, UserPopUpButtonDisplaying, return timelinesSplitViewController.children.first as! TimelinesViewController } - private lazy var accountMenuItems: [NSMenuItem] = { - [ - NSMenuItem(title: 🔠("View Profile"), - action: #selector(showUserProfile(_:)), - keyEquivalent: ""), - NSMenuItem(title: 🔠("Open Profile in Browser"), - action: #selector(openUserProfileInBrowser(_:)), - keyEquivalent: ""), - NSMenuItem(title: 🔠("View Favorites"), - action: #selector(showUserFavorites(_:)), - keyEquivalent: "F").with(modifierMask: [.command, .shift]), - .separator() - ] - }() + private lazy var accountMenuItems: [NSMenuItem] = [ + NSMenuItem(title: 🔠("View Profile"), + action: #selector(showUserProfile(_:)), + keyEquivalent: ""), + NSMenuItem(title: 🔠("Open Profile in Browser"), + action: #selector(openUserProfileInBrowser(_:)), + keyEquivalent: ""), + NSMenuItem(title: 🔠("View Favorites"), + action: #selector(showUserFavorites(_:)), + keyEquivalent: "F").with(modifierMask: [.command, .shift]), + .separator() + ] // MARK: Window Controller Lifecycle @@ -551,10 +548,10 @@ class TimelinesWindowController: NSWindowController, UserPopUpButtonDisplaying, var constraints: [NSLayoutConstraint] = [] let contentView = timelinesViewController.mainContentView - [currentUserPopUpButton, statusComposerSegmentedControl, searchSegmentedControl, newColumnSegmentedControl].forEach { - toolbarView.addSubview($0) + for item in [currentUserPopUpButton, statusComposerSegmentedControl, searchSegmentedControl, newColumnSegmentedControl] { + toolbarView.addSubview(item) let referenceView = toolbarView.superview ?? toolbarView - constraints.append(referenceView.centerYAnchor.constraint(equalTo: $0.centerYAnchor)) + constraints.append(referenceView.centerYAnchor.constraint(equalTo: item.centerYAnchor)) } constraints.append(TrackingLayoutConstraint.constraint(trackingMaxXOf: contentView, @@ -1173,7 +1170,7 @@ extension TimelinesWindowController // IBActions let screen = window.screen { let sheetWidth: CGFloat = 480 - let sheetHeight: CGFloat = 298 + let sheetHeight: CGFloat = 188 childWindow.minSize = NSSize(width: sheetWidth, height: sheetHeight) childWindow.maxSize = NSSize(width: screen.frame.width, height: sheetHeight)