181 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
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
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
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
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
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
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
834a6006f8 Use selectControllerWithIdentifier: instead of selectControllerAtIndex: 2020-05-10 20:07:30 +07:00
Allan Odgaard
ff1886a04b Let toolbarItemLabel + viewIdentifier be wrappers for title + identifier
We might as well use the standard properties to store label/title and identifier.

It indirectly fixes a bug, as the code that generates the ⌘1-n menu would look at identifier instead of viewIdentifier to find selected item (so no item was shown as selected).
2020-05-10 20:07:30 +07:00
Allan Odgaard
e5dca9f72a Use NSNibName instead of NSString* 2020-05-10 20:07:30 +07:00
Allan Odgaard
aa5edbba1f Only use NSRelativeDateTimeFormatter when 10.15 SDK is available
While we can copy the interface of this class to our sdk-compat.h header, we also need to setup weak linking for the class itself, so better just skip it for now, as it provides no benefits over the fallback code.
2020-04-30 19:44:09 +07:00
Allan Odgaard
43f75ea713 Set y-placement to ‘none’ for labels in preferences window
Rows are baseline aligned, and when that is the case, the grid view will use the y-placement of the first cell (which is not ‘none’) to place the row.

However, since the non-label column is likely to contain taller views, we should use that for placing the row.

That said, this change has no effect on the resulting layout, possibly because there are constraints with higher priorities that prevent the labels from bleeding into neighboring rows.
2020-04-29 08:02:02 +07:00
Allan Odgaard
7a30a3ed53 Use layout anchors to set fixed width/height of various views 2020-04-29 08:02:02 +07:00
Allan Odgaard
dedb182932 Remove humanReadableTimeElapsed NSDate category extension method
We still need this code when running on macOS before 10.15, but we only use the method in one place, so we have inlined the code.
2020-04-29 08:02:02 +07:00
Allan Odgaard
e15798bac3 Use NSRelativeDateTimeFormatter when running on macOS 10.15 2020-04-29 08:02:02 +07:00
Allan Odgaard
b514114ec7 Access most system singletons using dot syntax
These are identified by having a prefix of shared, default, or standard in the class method.
2020-04-23 12:25:11 +07:00
Allan Odgaard
814a3c78b4 Access sharedInstance using dot syntax 2020-04-23 12:25:11 +07:00
Allan Odgaard
715d023673 Declare “sharedInstance” as a class property 2020-04-23 12:25:11 +07:00
Allan Odgaard
5e2a16902d Controls in the Terminal (mate) preferences pane could fail
If full keyboard navigation is disabled (default) and “Accept rmate connections” is also disabled, no control in the on the preference pane would have keyboard focus, meaning that the view controller (implementing action methods for the pop-up and install/uninstall button) would not be in the responder chain (since first responder would be the window, which is after the view controller in the responder chain).
2020-04-21 15:01:00 +07:00
Allan Odgaard
9e2156dda1 Resize Terminal preferences pane
It now matches the width of the other preference panes, so the preferences window will only change height when changing preferences panes (unless the user has manually resized any of the resizable preference panes).
2020-04-19 16:31:03 +07:00
Allan Odgaard
fc0d4e32b4 Save xib with Xcode 11.4.1 (11E503a) 2020-04-19 16:31:03 +07:00
Allan Odgaard
355725cf36 Create Variables preference pane with code 2020-04-19 14:32:30 +07:00
Allan Odgaard
666ac73864 Update default size of bundles preferences pane to match projects
The goal is to have the window resize as little as possible when switching to another preference pane, therefore we aim for at least making the width the same for all panes.
2020-04-19 14:32:30 +07:00
Allan Odgaard
9e7d727792 Create Software Update preference pane with code (using NSGridView) 2020-04-19 14:32:30 +07:00
Allan Odgaard
b938dce914 Create Projects preference pane with code (using NSGridView) 2020-04-19 14:32:30 +07:00
Allan Odgaard
bdedf08bd7 Create Files preference pane with code (using NSGridView) 2020-04-19 14:32:30 +07:00
Allan Odgaard
5aef1c5c8a Add helper function to configure NSGridView for our preference panes 2020-04-19 14:32:30 +07:00
Allan Odgaard
c8faa0fa91 Don’t opt-in to making the preferences window restorable 2020-04-19 14:32:30 +07:00
Allan Odgaard
40379d8ab1 Remove (unused) general preferences pane
This was just a placeholder/template.
2020-04-19 14:32:30 +07:00
Allan Odgaard
ca8075b5c4 Update Bundles preferences pane to use OakScopeBarViewController
The MGScopeBar class uses deprecated API, doesn’t support dark mode, and doesn’t seem to be maintained, therefore it’s better to switch to OakScopeBarViewController, although it doesn’t support “collapsing” into a pop-up menu.

This commit does change the category filter to work as a radio button, so if one category is selected, others will be deselected, which I do think makes more sense than the previous behavior of allowing multiple categories to be selected, and using the union of these when filtering.

This commit also retires the xib file. The long-term goal is to eliminate all xib files, as being explicit (in code) is preferred. The xib files only exist because in the past we did not have auto-layout.
2020-04-17 19:19:53 +07:00
Allan Odgaard
266fa8746c Refactoring of file pop-up menu: Use NSDesktopDirectory and NSURL APIs 2020-04-17 19:19:53 +07:00
Allan Odgaard
38305e7fc4 Fix code that should return NO when bundle install is in progress 2020-04-14 12:58:10 +07:00
Allan Odgaard
d9ac41d790 Add checkbox in Preferences for the disableTabAutoClose setting 2019-09-15 11:26:41 +02:00
Allan Odgaard
8f3f3d9d16 Update deployment version for xibs to 10.12
This was done using search and replace. Presumably it should be done in Xcode so that it can adjust the xib for the new deployment target, otherwise what is the point of storing deployment version in the xib and provide it as a command line argument to the xib compiler as well (only to get a warning if the versions do not match)?
2019-07-07 18:03:30 +02:00
Allan Odgaard
1ef78b3af7 Rename symbols to what’s expected by the 10.14 SDK 2019-06-29 20:14:15 +02:00
Allan Odgaard
5aa58e5543 Do not include $APP_NAME in framework’s bundle identifier
Since we have multiple application targets, it doesn’t make sense with a global APP_NAME variable.

Though if building the frameworks as standalone bundles and embedding them in different applications, we may need some sort of unique component in the bundle identifier, but we currently do not do this (they are all statically linked, so the Info.plist is currently unused).
2019-06-26 23:32:54 +02:00
Allan Odgaard
412e6798ca Update build generator script
This changes a bunch of things:

1. Each framework now creates its own include directory for exported headers, and any target linking with this framework, gets that directory added to its include search path. This ensures deterministic behavior, unlike previously where a single shared directory was used, so even if target A did not explicitly link with target B, there was a reasonable chance that target B’s headers would be available when target A was built.

2. There is a new IMPORT keyword to indicate that a target depends on the headers of another framework but does not want to link with it. For example the `commit` shell command imports headers from the CommitWindow framework (related to their communications protocol) but linking with the CommitWindow framework would not be practical (as that would bring in all the resources of the CommitWindow).

3. All embedded targets are signed before being copied to their destination.

4. A new CS_ENTITLEMENTS keyword allows specifying `codesign` entitlements. Currently the hardened runtime is enabled, although this does make development problematic, as modifying files of a running instance (as done during rebuild) can cause TextMate to crash with EXC_BAD_ACCESS (Code Signature Invalid). Worse though, it seems the system has a cache of blacklisted executables indexed by inode. So if e.g. the embedded `mate` executable gets blacklisted, one has to manually remove and rebuild it, before it gets possible to use it again (by default, rebuilding causes the inode to be re-used, but I may change the build system to unlink before copy).

5. The build file no longer contains rules related to deployment. Instead variables are declared that a user build file can reference to extend the build with notarization/deployment rules (without having to hardcode build directory paths).

6. The code has been made modular with a Compiler super class that is subclassed to add support for file transformations (xib, ragel, asset catalogs, etc.) and a transformed file can have its own settings.

7. If target A links with target B, the linker flags of target B will now be included when linking target A.

8. Currently no indexing of help books. Unsure if this is actually useful.

9. Previously it was possible to have umbrella targets that would not generate any output, but just change settings for their sub-targets. This is no longer supported, as the implementation was arcane. I would like to introduce a different system for managing sectioned settings. Related to this; settings in target files are now always merged, regardless of whether using ‘=’ or ‘+=’.
2019-06-26 23:32:19 +02:00