4488 Commits

Author SHA1 Message Date
Allan Odgaard
0a04a77a89 Allow building with the macOS 10.14 SDK
This does mean that NSRelativeDateTimeFormatter is not used, even when running on macOS 10.15.
2020-05-14 15:47:13 +07:00
Allan Odgaard
fb165589c3 Change layout constraints to allow superview with zero width
I occasionally see log entries saying that the constraints cannot be resolved, and it appears to be because the superview has a width of zero.
2020-05-14 15:43:24 +07:00
Allan Odgaard
a7e23d2722 Expose automatic theme switching in View → Themes submenu
Theme is now stored only with OakTextView (observed by OakDocumentView) and the “global” setting is stored in user defaults (not Global.tmProperties), though it is still possible to override theme on a file-by-file basis via .tm_properties files.
2020-05-14 15:43:24 +07:00
Allan Odgaard
e310724951 Pass theme to OakDocumentView instead of querying settings in the object
This is because OakDocumentView is not in the view hierarchy and it obtains the theme via settings_t, so there is no way to notify about theme changes.
2020-05-14 15:43:24 +07:00
Allan Odgaard
6404eedaf7 Add status bar to Bundles preferences showing when index was updated
It also shows a progress spinner when installing bundles and potential errors.
2020-05-14 09:52:38 +07:00
Allan Odgaard
47b1d712f0 Change Nightly Builds to Prereleases in Software Update preferences 2020-05-14 09:52:38 +07:00
Allan Odgaard
e62db9386e Call NSMenu’s numberOfItems instead of itemArray.count 2020-05-14 09:52:38 +07:00
Allan Odgaard
ad1cc8abd8 Deliver all NSUserDefaultsDidChangeNotification in main queue
This is easier than ensuring that we do not update user defaults from a background thread.
2020-05-14 09:52:38 +07:00
Allan Odgaard
c939c53f34 Don’t let HTMLOutputWindowController handle toggleHTMLOutput:
Now that the window is a panel, we can rely on the main window to close the window on toggle, even with the HTML window having key.
2020-05-13 18:50:02 +07:00
Allan Odgaard
8e6791324a Let app delegate handle workaround for “Move to Active Space” behavior
I don’t think the default behavior ever makes sense, so we are applying the change to all windows instead of handling it on a one-by-one basis.
2020-05-13 18:50:02 +07:00
Allan Odgaard
6042041505 Use NSWindowController as superclass for HTMLOutputWindowController 2020-05-13 18:50:02 +07:00
Allan Odgaard
0caa4eb12a Improve the folder pop-up submenu for Find in Folder
The submenu now show the immediate children in the first submenu, with parents below these items, although without adding submenus to the parents.

Also show ⌘↑ for the first parent, to improve discoverability of this key equivalent.
2020-05-13 18:50:02 +07:00
Allan Odgaard
c2019e15a1 Use CGContext instead of graphicsPort 2020-05-13 18:50:02 +07:00
Allan Odgaard
44847a6171 Make sure we always return a document from documentWithPath:
Based on crash reports, there appears to be a race condition where the weak pointer has been nilled.
2020-05-13 18:50:02 +07:00
Allan Odgaard
1ea8ad41e0 Remove properties related to install progress from BundlesManager 2020-05-13 18:50:02 +07:00
Allan Odgaard
6adb9a2589 Introduce singleton to store state about bundles being installed 2020-05-13 18:50:02 +07:00
Allan Odgaard
c05c68698c Show relative dates as “1 day ago” instead of “yesterday”
Main reason I picked the named styles was that a time interval of zero would show as “in 0 seconds”, but we now check if check was less than 5 seconds ago and use “Just now” for that case.
2020-05-13 18:49:55 +07:00
Allan Odgaard
92953099e6 Allow escape to dismiss HTML output window (by using NSPanel) 2020-05-13 18:49:55 +07:00
Allan Odgaard
57336423ca Remove unused user defaults key 2020-05-13 18:49:55 +07:00
Allan Odgaard
927f2c7803 Use NSBackgroundActivityScheduler for updating bundle index 2020-05-13 18:49:55 +07:00
Allan Odgaard
9da2d327c9 Only use implicit animation to resize windows on 10.15 and later
This causes lots of visual glitches on macOS 10.14.
2020-05-10 21:41:12 +07:00
Allan Odgaard
0c49db9838 Prior to 10.15 a window’s screen property could be nil 2020-05-10 21:38:27 +07:00
Allan Odgaard
f8dd2ebae7 Find History: Change Find Next to “in Project” when holding down option 2020-05-10 20:07:31 +07:00
Allan Odgaard
0d951dc113 Allow toggling chooser windows (⌘T, ⇧⌘T, ⌃⌘T, ⇧⌘O)
If the window already has keyboard focus, sending it an “open” will instead close it, similar to pressing escape.

This might be useful for touch bar users.
2020-05-10 20:07:31 +07:00
Allan Odgaard
90a2517600 Allow opening “Find in Project” from pasteboard history chooser
This is triggered by holding option when selecting Find Next. Improving discoverability is work in progress.
2020-05-10 20:07:31 +07:00
Allan Odgaard
c11828add9 Add an alternateAction property to OakPasteboardChooser
This is sent when the action button is triggered while option (⌥) is down (if there is a valid responder for the message).
2020-05-10 20:07:31 +07:00
Allan Odgaard
3bee6c728b Log the localized string from NSError instead of the entire object 2020-05-10 20:07:31 +07:00
Allan Odgaard
01bf868832 Go back to visual formal language for laying out the Find dialog
Now that we use OakTransitionViewController for toggling the results view, using a stack view provides no real benefits, and are in some ways a little bit more opaque, for example the hugging priority weirdness and what width constraints are setup by the view.
2020-05-10 20:07:31 +07:00
Allan Odgaard
e9c4ea57dd Move initialization of view controllers from helper method to init
These view controllers are used in other methods, so we were basically relying on the order of which methods were called, which is not good design.
2020-05-10 20:07:31 +07:00
Allan Odgaard
3d1f4c82df Only install event monitor when results outline view is visible 2020-05-10 20:07:31 +07:00
Allan Odgaard
407aed195e Make sure window is within visible screen frame when resizing 2020-05-10 20:07:31 +07:00
Allan Odgaard
bd7e306b91 Use OakTransitionViewController to show/hide find results 2020-05-10 20:07:31 +07:00
Allan Odgaard
3c609e33d9 Move transitioning of view (animation) to stand-alone view controller
Also make the code slightly more general, for example support transitions to nil.
2020-05-10 20:07:31 +07:00
Allan Odgaard
b57afafef9 Minor change in implementation of toolbar:itemForItemIdentifier:
We now always return an NSToolbarItem instance, even when we don’t actually have a view controller for the identifier.

This should not arise in practice, but it makes it easier to test new items in the toolbar (by only adding the identifier).
2020-05-10 20:07:31 +07:00
Allan Odgaard
d5ca34ceb7 Increase row spacing in preferences pane grid view 2020-05-10 20:07:31 +07:00
Allan Odgaard
53da62f33d Fix issue with ⌘F not bringing find dialog to active space
The problem is that we use ⌘F and ⇧⌘F as key equivalents both in the Edit → Find submenu and in the “where” pop-up button’s menu, but as they previously had different action methods, the system would only allow the key to trigger one of these items (and remove the key from the other, as part of menu validation).

Normally not an issue, but when the find dialog is in another space, it appears menu validation would not update the Find → Edit submenu items to get the key equivalents, even though these would be “first responders”.

By using same action method for both Find → Edit submenu items and the “where” pop-up menu items, we avoid the key equivalents being removed from any of the two menus.
2020-05-10 20:07:31 +07:00
Allan Odgaard
9bfae1aada Use FFSearchTarget instead of find_tags enumeration
This avoids the need to map between the two enumeration constants, although we handle some of the constants before passing them to the find singleton, so the code has not yet been updated to remove the redundant mappings.
2020-05-10 20:07:31 +07:00
Allan Odgaard
46e350c3ec Include Move to Active Space in preferences window’s collection behavior 2020-05-10 20:07:31 +07:00
Allan Odgaard
6b414283ed Use NSPanel for preferences window to support dismissing with escape 2020-05-10 20:07:31 +07:00
Allan Odgaard
09ee4d49a7 Use MBMenuBuilder to construct “where” pop-up menu in Find dialog 2020-05-10 20:07:31 +07:00
Allan Odgaard
6e6893498a Remove initialKeyView from PreferencesPaneProtocol 2020-05-10 20:07:30 +07:00
Allan Odgaard
57e3411473 Cross-fade when switching between preferences panes 2020-05-10 20:07:30 +07:00
Allan Odgaard
56206b163d Let the bundles preferences view controller set first responder itself
This is instead of using the initialKeyView property. The latter is more declarative, and thus more abstracted / flexible, but we only need it for a single preferences pane, and the downside is that the generic code to “swap views” has to implement support for it, which I would like to avoid.
2020-05-10 20:07:30 +07:00
Allan Odgaard
040aeea7bb Remove code required by MASPreferences 2020-05-10 20:07:30 +07:00
Allan Odgaard
7d0f9cb5d7 Use custom code for preferences window
Relying on “modern” APIs we can eliminate most of the MASPreferencesViewController protocol:

- viewIdentifier → identifier
- toolbarItemLabel → title
- initialKeyView → call makeFirstResponder: in viewDidAppear
- hasResizableWidth / hasResizableHeight → use auto layout constraints

Furthermore, handling the preferences panes can be done by using child view controllers, and it might even be possible to use transitionFromViewController:toViewController:options:completionHandler: to switch between the views.

The last point is actually the motivation for this change, as I need a playground for animated view transitions.
2020-05-10 20:07:30 +07:00
Allan Odgaard
af6243ff17 Implement preferredContentSize for terminal preferences
This currently has no effect as the view uses autoresizing masks (which do not make the width/height sizable).
2020-05-10 20:07:30 +07:00
Allan Odgaard
6bf5e9b7cb Set hugging priority for grid view instead of constraining width/height
None of our grid views are actually sizable, but those containing text fields should probably have adjustable width.
2020-05-10 20:07:30 +07:00
Allan Odgaard
e1943cac3d Set hugging priority for stack view in Software Update preferences
This prevents the containing grid view to increase the height of the stack view (introducing whitespace in the layout).
2020-05-10 20:07:30 +07:00
Allan Odgaard
83874a965c Use NSLayoutPriorityDefaultHigh-1 as hugging priority for stack views
When set to NSLayoutPriorityDefaultHigh then it is able to compress text fields. The text field does set content compression resistance to NSLayoutPriorityDefaultHigh, but for reasons I do not understand, this is not enough to keep it from being compressed by the stack view.

The reason I do not understand this is that even with a high hugging priority, we should not make views smaller than their fittingSize, but it appears the stack view will do that.

Only one stack view actually contained a text field, and we already used a priority lower than NSLayoutPriorityDefaultHigh, so this commit does not change anything, but to play it safe, we should probably avoid NSLayoutPriorityDefaultHigh for stack views.
2020-05-10 20:07:30 +07:00
Allan Odgaard
834a6006f8 Use selectControllerWithIdentifier: instead of selectControllerAtIndex: 2020-05-10 20:07:30 +07:00