Skip to content

Commit

Permalink
features/rearrange-columns: vastly improve layout
Browse files Browse the repository at this point in the history
  • Loading branch information
Sören Kuklau committed Apr 6, 2024
1 parent 785fdba commit fc641d1
Show file tree
Hide file tree
Showing 4 changed files with 83 additions and 56 deletions.
61 changes: 39 additions & 22 deletions Mastonaut/Features/ArrangeColumns/ArrangeColumnsViewItem.xib
Original file line number Diff line number Diff line change
Expand Up @@ -16,31 +16,48 @@
<customObject id="-1" userLabel="First Responder" customClass="FirstResponder"/>
<customObject id="-3" userLabel="Application" customClass="NSObject"/>
<customView translatesAutoresizingMaskIntoConstraints="NO" id="Hz6-mo-xeY">
<rect key="frame" x="0.0" y="0.0" width="200" height="170"/>
<rect key="frame" x="0.0" y="0.0" width="200" height="80"/>
<subviews>
<textField horizontalHuggingPriority="251" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="22P-Y3-Q72">
<rect key="frame" x="48" y="50" width="104" height="100"/>
<constraints>
<constraint firstAttribute="width" relation="greaterThanOrEqual" constant="100" id="lq7-8v-Gbn"/>
<constraint firstAttribute="height" relation="greaterThanOrEqual" constant="100" id="q1T-Rt-2x1"/>
</constraints>
<textFieldCell key="cell" lineBreakMode="clipping" alignment="center" title="Label" id="iWm-Nh-4yg">
<font key="font" usesAppearanceFont="YES"/>
<color key="textColor" name="labelColor" catalog="System" colorSpace="catalog"/>
<color key="backgroundColor" name="textBackgroundColor" catalog="System" colorSpace="catalog"/>
</textFieldCell>
</textField>
<imageView horizontalHuggingPriority="251" verticalHuggingPriority="251" fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="Y0n-ws-Gdk">
<rect key="frame" x="20" y="102" width="48" height="48"/>
<box fixedFrame="YES" title="Box" titlePosition="noTitle" translatesAutoresizingMaskIntoConstraints="NO" id="9UB-SI-fmz">
<rect key="frame" x="11" y="8" width="179" height="62"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
<imageCell key="cell" refusesFirstResponder="YES" alignment="left" imageScaling="proportionallyDown" id="owz-SP-BK2"/>
</imageView>
<view key="contentView" id="tgq-rP-zBX">
<rect key="frame" x="4" y="5" width="171" height="54"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<subviews>
<imageView horizontalHuggingPriority="251" verticalHuggingPriority="251" id="Y0n-ws-Gdk">
<rect key="frame" x="9" y="17" width="20" height="20"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
<imageCell key="cell" refusesFirstResponder="YES" alignment="left" imageScaling="proportionallyDown" id="owz-SP-BK2"/>
</imageView>
<textField horizontalHuggingPriority="251" verticalHuggingPriority="750" id="22P-Y3-Q72">
<rect key="frame" x="31" y="12" width="122" height="24"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
<textFieldCell key="cell" lineBreakMode="clipping" alignment="left" title="Label" id="iWm-Nh-4yg">
<font key="font" usesAppearanceFont="YES"/>
<color key="textColor" name="labelColor" catalog="System" colorSpace="catalog"/>
<color key="backgroundColor" name="textBackgroundColor" catalog="System" colorSpace="catalog"/>
</textFieldCell>
</textField>
<button fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="vGV-yE-8bo">
<rect key="frame" x="145" y="14" width="25" height="26"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
<buttonCell key="cell" type="roundTextured" bezelStyle="texturedRounded" image="xmark.circle.fill" catalog="system" imagePosition="overlaps" alignment="center" lineBreakMode="truncatingTail" state="on" imageScaling="proportionallyDown" inset="2" id="4ca-Sf-PTn">
<behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/>
<font key="font" metaFont="system"/>
</buttonCell>
<connections>
<action selector="closeColumn:" target="-2" id="QvA-Yl-Xds"/>
</connections>
</button>
</subviews>
</view>
</box>
</subviews>
<constraints>
<constraint firstItem="22P-Y3-Q72" firstAttribute="centerX" secondItem="Hz6-mo-xeY" secondAttribute="centerX" id="GiT-4K-osc"/>
<constraint firstItem="22P-Y3-Q72" firstAttribute="top" secondItem="Hz6-mo-xeY" secondAttribute="top" constant="20" symbolic="YES" id="yUn-UH-Hnf"/>
</constraints>
<point key="canvasLocation" x="-133" y="61"/>
<point key="canvasLocation" x="-134" y="61"/>
</customView>
</objects>
<resources>
<image name="xmark.circle.fill" catalog="system" width="15" height="15"/>
</resources>
</document>
33 changes: 23 additions & 10 deletions Mastonaut/Features/ArrangeColumns/ArrangeColumnsWindow.xib
Original file line number Diff line number Diff line change
Expand Up @@ -17,37 +17,40 @@
<window title="Window" allowsToolTipsWhenApplicationIsInactive="NO" autorecalculatesKeyViewLoop="NO" releasedWhenClosed="NO" animationBehavior="default" id="QvC-M9-y7g">
<windowStyleMask key="styleMask" titled="YES" closable="YES" miniaturizable="YES" resizable="YES"/>
<windowPositionMask key="initialPositionMask" leftStrut="YES" rightStrut="YES" topStrut="YES" bottomStrut="YES"/>
<rect key="contentRect" x="196" y="240" width="480" height="270"/>
<rect key="contentRect" x="196" y="240" width="480" height="160"/>
<rect key="screenRect" x="0.0" y="0.0" width="1512" height="944"/>
<view key="contentView" wantsLayer="YES" id="EiT-Mj-1SZ">
<rect key="frame" x="0.0" y="0.0" width="480" height="270"/>
<view key="contentView" wantsLayer="YES" misplaced="YES" id="EiT-Mj-1SZ">
<rect key="frame" x="0.0" y="0.0" width="545" height="160"/>
<autoresizingMask key="autoresizingMask"/>
<subviews>
<button verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="6Cq-CW-6uC">
<rect key="frame" x="401" y="13" width="66" height="32"/>
<rect key="frame" x="476" y="13" width="66" height="32"/>
<buttonCell key="cell" type="push" title="Done" bezelStyle="rounded" alignment="center" borderStyle="border" imageScaling="proportionallyDown" inset="2" id="7Es-C0-NLl">
<behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/>
<font key="font" metaFont="system"/>
<string key="keyEquivalent" base64-UTF8="YES">
DQ
</string>
</buttonCell>
<constraints>
<constraint firstAttribute="width" constant="52" id="Lm6-OQ-lpO"/>
</constraints>
<connections>
<action selector="done:" target="-2" id="yzo-Rh-xBg"/>
</connections>
</button>
<scrollView wantsLayer="YES" autohidesScrollers="YES" horizontalLineScroll="10" horizontalPageScroll="10" verticalLineScroll="10" verticalPageScroll="10" hasVerticalScroller="NO" usesPredominantAxisScrolling="NO" verticalScrollElasticity="none" translatesAutoresizingMaskIntoConstraints="NO" id="ljS-sl-Ta6">
<rect key="frame" x="0.0" y="60" width="480" height="210"/>
<rect key="frame" x="0.0" y="60" width="555" height="100"/>
<clipView key="contentView" id="dbb-ln-cTG">
<rect key="frame" x="1" y="1" width="478" height="208"/>
<rect key="frame" x="1" y="1" width="553" height="98"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<subviews>
<collectionView selectable="YES" id="IYj-mm-J94">
<rect key="frame" x="0.0" y="0.0" width="478" height="158"/>
<rect key="frame" x="0.0" y="0.0" width="553" height="98"/>
<autoresizingMask key="autoresizingMask" heightSizable="YES"/>
<collectionViewGridLayout key="collectionViewLayout" maximumNumberOfRows="1" id="EsS-OT-eL1">
<size key="minimumItemSize" width="135" height="180"/>
<size key="maximumItemSize" width="135" height="180"/>
<size key="minimumItemSize" width="200" height="80"/>
<size key="maximumItemSize" width="200" height="80"/>
</collectionViewGridLayout>
<color key="primaryBackgroundColor" name="controlBackgroundColor" catalog="System" colorSpace="catalog"/>
<connections>
Expand All @@ -66,17 +69,27 @@ DQ
<autoresizingMask key="autoresizingMask"/>
</scroller>
</scrollView>
<textField horizontalHuggingPriority="251" verticalHuggingPriority="750" ambiguous="YES" translatesAutoresizingMaskIntoConstraints="NO" id="fcq-zJ-X8L">
<rect key="frame" x="18" y="18" width="447" height="23"/>
<textFieldCell key="cell" title="Drag the boxes to rearrange their corresponding columns, or click an X to close one." id="SZh-XP-vcq">
<font key="font" metaFont="smallSystem"/>
<color key="textColor" name="secondaryLabelColor" catalog="System" colorSpace="catalog"/>
<color key="backgroundColor" name="textBackgroundColor" catalog="System" colorSpace="catalog"/>
</textFieldCell>
</textField>
</subviews>
<constraints>
<constraint firstItem="6Cq-CW-6uC" firstAttribute="top" secondItem="ljS-sl-Ta6" secondAttribute="bottom" constant="20" symbolic="YES" id="2Sp-XX-kB7"/>
<constraint firstItem="ljS-sl-Ta6" firstAttribute="top" secondItem="EiT-Mj-1SZ" secondAttribute="top" id="3pO-N8-pRM"/>
<constraint firstAttribute="trailing" secondItem="ljS-sl-Ta6" secondAttribute="trailing" id="BLQ-yM-BLG"/>
<constraint firstItem="ljS-sl-Ta6" firstAttribute="leading" secondItem="EiT-Mj-1SZ" secondAttribute="leading" id="D6y-1Y-bcC"/>
<constraint firstItem="6Cq-CW-6uC" firstAttribute="leading" secondItem="fcq-zJ-X8L" secondAttribute="trailing" constant="20" id="HBF-lm-XSF"/>
<constraint firstAttribute="trailing" secondItem="6Cq-CW-6uC" secondAttribute="trailing" constant="20" symbolic="YES" id="frT-qQ-vuH"/>
<constraint firstAttribute="bottom" secondItem="6Cq-CW-6uC" secondAttribute="bottom" constant="20" symbolic="YES" id="wrs-0i-lrt"/>
<constraint firstItem="fcq-zJ-X8L" firstAttribute="leading" secondItem="EiT-Mj-1SZ" secondAttribute="leading" constant="20" symbolic="YES" id="zEp-45-kWN"/>
</constraints>
</view>
<point key="canvasLocation" x="2" y="125"/>
<point key="canvasLocation" x="1.5" y="125"/>
</window>
</objects>
</document>
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="21507" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES" customObjectInstantitationMethod="direct">
<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="32700.99.1234" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES" customObjectInstantitationMethod="direct">
<dependencies>
<deployment identifier="macosx"/>
<plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="21507"/>
<plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="22689"/>
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
</dependencies>
<objects>
Expand Down Expand Up @@ -50,7 +50,7 @@
<windowStyleMask key="styleMask" titled="YES" closable="YES" miniaturizable="YES" resizable="YES"/>
<windowCollectionBehavior key="collectionBehavior" fullScreenAuxiliary="YES"/>
<rect key="contentRect" x="484" y="366" width="534" height="469"/>
<rect key="screenRect" x="0.0" y="0.0" width="1920" height="1080"/>
<rect key="screenRect" x="0.0" y="0.0" width="1512" height="944"/>
<value key="minSize" type="size" width="530" height="100"/>
<view key="contentView" wantsLayer="YES" id="zyG-Dy-UO4">
<rect key="frame" x="0.0" y="0.0" width="534" height="469"/>
Expand Down Expand Up @@ -709,7 +709,7 @@
</popover>
</objects>
<resources>
<image name="NSStopProgressTemplate" width="14" height="13"/>
<image name="NSStopProgressTemplate" width="17" height="16"/>
<image name="camera" width="16" height="14"/>
<image name="content_warning" width="22" height="14"/>
<image name="emoji_panel" width="14" height="14"/>
Expand Down
37 changes: 17 additions & 20 deletions Mastonaut/Window Controllers/TimelinesWindowController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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

Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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)
Expand Down

0 comments on commit fc641d1

Please sign in to comment.