Commit Graph

412 Commits

Author SHA1 Message Date
Allan Odgaard
2d6930cfee Provide OFBFinderTagsChooser with non-favorite tags
Since OFBFinderTagsChooser always show only the favorite tags, any non-favorite tag set as selected or removable will simply be ignored, so there is no reason to filter these out at the call-site.

In fact, whether or not to show non-favorite tags should probably be an OFBFinderTagsChooser decision.

Furthermore, the tag’s favorite status is set during initialization, so it could actually be outdated when showing the OFBFinderTagsChooser.
2018-07-08 20:32:56 +02:00
Allan Odgaard
05938a91ce Add favoriteFinderTags property to OFBFinderTagsChooser
This guarantees that each instance of the class uses the same array of tags.
2018-07-08 20:11:53 +02:00
Allan Odgaard
6e18e1236b Add foreground/background color properties to OakFinderTag 2018-07-08 20:00:36 +02:00
Allan Odgaard
346ffb5559 Use OakFinderTags instead of label numbers in OakLabelSwatchView 2018-07-08 19:53:01 +02:00
Allan Odgaard
376a823313 Only make a tag removable when all selected items have the tag set
This is consistent with how Finder works.
2018-07-08 19:30:50 +02:00
Allan Odgaard
c5eb4c3259 Remove unused code 2018-07-08 19:30:26 +02:00
Allan Odgaard
13cb0a32f6 Let OFBFinderTagsChooser’s chosenTag property by an OakFinderTag 2018-07-08 18:17:30 +02:00
Allan Odgaard
b0e6c5caa6 Let FSItem’s finderTags setter update file on disk 2018-07-08 18:16:20 +02:00
Allan Odgaard
fef19f8465 Let FSItem create finderTags when requested
This does mean that we are taxing our main thread with disk access. This is mainly a problem for users who are using network mounted file systems, but it does provide better abstraction in the code, and should this turn out to be a performance issue, I think a better approach is to fetch the tags in a dispatch queue (initiated by FSItem), and then use KVC to update the property once the tags have been loaded, although ideally such system would use some sort of batching, so that we do not dispatch in each property accessor.

Could also have the background directory scanner set a boolean property to indicate if the item has tags, as most items do not, and in that case, we can bypass the disk access. But this then only does half the job of encapsulating how tags are stored.
2018-07-08 17:52:36 +02:00
Allan Odgaard
11fa1841b3 Remove all code related to labels 2018-07-08 17:23:53 +02:00
Allan Odgaard
5001e1e5b1 Add trailing separator to file browser’s action menu
When the menu is brought up as a context-sensitive menu (right-clicking a file) the system will add a “Services” submenu as the last item, which looks nicer when there is a separator before it.

This submenu is not added when the menu is brought up via the gear button in the status bar, but the system will automatically strip trailing separator items from menus, so in this case, the separator will not be shown at all.
2018-07-08 15:28:51 +02:00
Allan Odgaard
2e5d4fc96a Ensure the “Tags…” menu item is always disabled
When using the gear menu in the status bar, the “Tags…” menu item was enabled. It appears that NSPopupButton validates its menu differently than NSView when bringing up the context-sensitive pop-up menu.
2018-07-08 15:25:09 +02:00
Allan Odgaard
88757f25bf Update FSItem’s finderTags property when updating the tags on disk
The file browser is observing the `finderTags` property so we need to do KVC updating of this property when we change the tags on disk.

It worked before because changing tags on disk triggers a reload, but that may not always be the case, e.g. the SCM data source showing uncommitted changes did not update in response to changing tags.
2018-07-08 14:59:20 +02:00
Allan Odgaard
c52b749f5b Let SCM data source set finderTags when creating FSItem objects 2018-07-08 14:58:19 +02:00
Allan Odgaard
b5df2d26f1 The secondaryLabelColor class property was introduced in 10.10
There aren’t many left on 10.9 but it was an easy change.
2018-07-08 14:51:04 +02:00
Allan Odgaard
ac92e1b040 Minor stylistic changes: Whitespace and put const after the type
The rationale behind the latter is for consistency with pointer declarations, e.g. we need to do `NSString* const kConstant = …` to indicate that the variable is a constant NSString pointer, so for this reason I prefer to also do `CGFloat const kConstant = …`

This commit can be merged into its parent.
2018-07-08 14:47:59 +02:00
Ronald Wampler
a31a985610 Add support for Finder tags instead of just one label color 2018-07-06 19:41:00 -04:00
Ronald Wampler
cec95ce601 Remove unnecessary forward declaration 2018-07-04 13:04:58 -04:00
Allan Odgaard
40a14995f6 Call fileSystemRepresentation directly on NSURL (10.9) 2018-06-17 17:14:47 +02:00
Allan Odgaard
e70791ee89 Rename a bunch of constants to fix deprecation warnings (10.12) 2018-06-16 22:55:30 +02:00
Allan Odgaard
3fb653ebf0 Do not provide graphics context when creating a fake NSEvent
This is not required and 10.12 makes accessing the NSEvent’s context property deprecated, as it always (did?) return nil.
2018-06-16 22:55:30 +02:00
Allan Odgaard
503d493f47 Move OakTabBarView into its own framework
The motivation is to get an OakAppKit that does not include hundres of image resources.
2017-10-07 13:58:35 +02:00
Allan Odgaard
c57a70db83 Do not use NSOutlineView’s clickedRow for key events 2017-10-03 08:19:41 +02:00
Allan Odgaard
5fc61d0a34 Don’t use menuForEvent: when showing NSOutlineView’s menu using ⌥F2
The reason is that menuForEvent: will draw an outline around the items under the mouse, which can be incorrect when we use the keyboard.

While we can address it by creating a fake mouse event that points to the selection, this will fail when there is no selection, so I felt it was better to always forego it.
2017-10-03 08:18:05 +02:00
Ronald Wampler
08f41a37dc Add "Copy As Pathname" to file browser's context menu
This is implemented as an alternate menu item to "Copy" like in Finder.
2017-05-31 21:58:31 +02:00
Ronald Wampler
f3cd0b0797 Resolve ambiguous autolayout issues
Most of these layout changes are related to the common pattern we used to set constraints for "dividers", where one of the dividers is specified to be connected to both edges of its superview then setting the other dividers' constraints to have equal widths (e.g., @"H:|[divider(==divider2,==divider3)]"). On 10.12, this now appears to result in ambiguous layout. We can resolve it by connecting at least one of the edges for each divider to its superview.
2017-05-31 21:58:31 +02:00
Ronald Wampler
038acacca9 Avoid use of NSRunAlertPanel (10.9)
Although this is actually deprecated in 10.10, new APIs are available in 10.9 and it will make addressing deprecation warnings when upgrading to 10.10 easier.
2017-05-31 21:58:31 +02:00
Ronald Wampler
42654ff283 Use appropriate enum case for NSSavePanel and NSOpenPanel result (10.9) 2017-05-31 10:03:41 +02:00
Ronald Wampler
6e28cea42c Don't try to replace a folder with an item it contains 2017-03-10 12:22:35 +07:00
Allan Odgaard
2c524907d6 Disable Xcode data source by default
It can be enabled by setting the ‘enableXcodeDataSource’ defaults key to YES.

The reason it has been disabled is that there is a file browser (crash) issue, and the 3 users who have provided steps to reproduce all mention clicking an Xcode project (though myself and Michael Sheets have been unable to reproduce, following those steps, and I do not think the bug is with the Xcode data source, but it does seem to be a catalyst).
2016-12-10 12:43:08 +07:00
Allan Odgaard
944ad3ea5d Rename API: add_callback → push_callback
This makes it clear what is actually done.
2016-11-11 15:47:19 +07:00
Allan Odgaard
30b409b2eb Revert "Remove custom handling of ‘return’ to edit items in file browser"
It appears that the OS does not reliable initiate edit on 10.12.1.

When expanding and then collapsing an item, the OS will often then no longer edit the item on return.

This reverts commit cce3417962.
2016-11-02 23:02:18 +07:00
Allan Odgaard
9d980a07df Remove NSPrincipalClass from framework bundles’s Info.plist
This is not something which is used anywhere and a few of the frameworks does not have a principal class.
2016-10-31 17:30:30 +07:00
Allan Odgaard
bec3548d55 Avoid extra call to accessor by using instancesRespondToSelector: 2016-10-15 13:07:51 +02:00
Allan Odgaard
b47b160498 Populate services clipboard with items of type NSFilenamesPboardType
Back when this code was written there was a lot of problems related to application expectations (especially for the copy clipboard), and that might have been why we did not put NSFilenamesPboardType on the (services) clipboard, but it seems strange as it’s the only type we actually declare support for.
2016-09-30 12:43:55 +02:00
Allan Odgaard
330c434a73 Check for nil before messaging object
This shouldn’t be necessary but many of the new crashes on macOS 10.12 are from this method, though I suspect that ‘self’ is the already released object rather than ‘otherObject’ being nil.
2016-09-27 21:49:32 +02:00
Allan Odgaard
ede6b4b026 Change named parameter completionHandler: to outputHandler:
The handler is only called for commands with output to insert into the text view, hence completionHandler is a misnomer.
2016-09-27 21:29:03 +02:00
Allan Odgaard
b8c2b8889c Going to SCM status for non-repository with spaces would throw exception 2016-09-21 20:39:42 +02:00
Allan Odgaard
ad01eb1ac6 Use stringArrayForKey: where appropriate 2016-09-21 20:39:41 +02:00
Allan Odgaard
10f88212e4 Use setDynamicTitle: for menu items with dynamic title
See previous commit for details.
2016-09-20 10:03:45 +02:00
Allan Odgaard
297cfa1726 Remove unused OakFileIconImage.h includes 2016-09-19 12:49:03 +02:00
Allan Odgaard
9b75a50520 Fix issue where aborting a file rename did not restore display name 2016-09-19 12:46:54 +02:00
Allan Odgaard
de83ebf06e Introduce OakCreateCloseButton API 2016-09-19 09:01:35 +02:00
Allan Odgaard
ce639d6d09 Move close button graphics to OakAppKit 2016-09-19 08:59:34 +02:00
Allan Odgaard
553e89ceb6 Update include statements and link declarations 2016-09-11 12:47:39 +02:00
Allan Odgaard
d4050ea44a Use symbolic name for NSF2FunctionKey 2016-09-11 09:18:25 +02:00
Allan Odgaard
24f98894e7 Ignore folders when opening multiple items from file browser
Previously we would descend into the first selected folder, ignoring all other items selected. Now we ignore the folders, unless all items selected are folders, in that case, we descend into the first one.
2016-09-09 11:38:09 +02:00
Allan Odgaard
05977ece99 Refuse first responder for close buttons in the file browser
This seems to make the key view loop behave as expected.
2016-09-08 20:14:07 +02:00
Allan Odgaard
49da7a71b1 Remove code that was never executed
Since we were testing for a class rather than instance method, this check would never be true.

Since I am not aware of any problems with the current code where we do not call super, I decided to remove rather than change the code (to call super when it responds to the selector).
2016-09-04 20:17:42 +02:00
Allan Odgaard
d13fcb826c Re-introduce the use of bindings for file browser’s text field
The display name of an item may change, e.g. when user toggles “hidden extension” in Finder. The data source for the FSItem will catch this and update the displayName property, but since we did not observe it, the file browser would not update with the new name.

The reason we disabled use of bindings was because the binding is bidirectional and we had no setter for the new object value.

We solve this by adding a new property to FSItem that is for use with bindings and data formatters.
2016-08-30 18:33:24 +02:00