Commit Graph

382 Commits

Author SHA1 Message Date
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
Allan Odgaard
2aaaff487c Workaround for NSTableView set to render as source list 2016-08-30 14:33:28 +02:00
Allan Odgaard
565c5c242b Let file name formatter return error string for unexpected value type
One spin report shows that an attributed string is being used with the text field. Calling ‘description’ on an attributed string can produce a lot of output (dumping all the attributes) and the spin report in question shows a lot of symbols related to auto-layout and text sizing, so perhaps this is related.

http://lists.macromates.com/textmate/2016-August/039891.html
2016-08-30 11:56:47 +02:00
Allan Odgaard
caa72fca85 Remove FSItem’s setNewDisplayName: 2016-08-29 12:34:26 +02:00
Allan Odgaard
cb6a5a911f Edit last path component instead of display name in file browser
This commit turned out rather complex because the only proper way to do this seems to do with a data formatter, but the data formatting protocol assumes that we can construct an object from the editing string, which is not possible when the string only represents a subset of the object being edited.
2016-08-29 12:31:38 +02:00
Allan Odgaard
50d2815645 Add renameToName: to FSItem
Unlike the existing setNewDisplayName: this function does not try to figure out if the argument was the file’s display name (with potentially hidden extension).
2016-08-29 11:16:18 +02:00
Allan Odgaard
29033c60d8 Use OakCommand in file browser and application delegate 2016-08-28 13:32:48 +02:00
Allan Odgaard
0638874b61 Tag code that can be retired when updating OS requirement
When bumping the minimum requirement we can do a search for MAC_OS_X to find all places where we have compatibility code.
2016-08-28 09:13:33 +02:00
Allan Odgaard
0c08c608fe Let file browser post notification when duplicating URLs 2016-08-25 00:07:47 +02:00
Allan Odgaard
59ac63bd94 Simplify OakFileBrowser’s selectedPaths implementation 2016-08-22 16:14:36 +02:00
Allan Odgaard
ef2d50606f Use non-deprecated version of weak NSMapTable (10.8) 2016-06-22 20:44:41 +02:00
Allan Odgaard
fb7c2cef3f Use NSUserDefaults’s specialized «type»ForKey: 2016-06-20 11:43:40 +02:00
Allan Odgaard
6e8ab01c09 Let OakFileBrowser validate menu items sending deselectAll: 2016-06-19 09:40:08 +02:00
Allan Odgaard
0a0b9a8052 Move Select None to File Browser (main) menu
This was previously placed in the file browser’s action menu and thus probably overlooked by many, even though ⇧⌘A is a very useful key equivalent, since many commands work on the entire project when there is no selection in the file browser.
2016-06-19 09:40:08 +02:00
Allan Odgaard
417193e089 Update link dependencies for all targets
Some targets were including headers from frameworks not specified in their link dependencies. For a clean build this could cause an issue because the header was not available at the time of building the target.

The updated link dependencies are also based on what a target’s tests require. Ideally tests would have separate link dependencies, but as we don’t want to maintain this manually, this will have to wait until the build system automatically handles link dependencies.

Currently the commit command uses constants from the CommitWindow framework but should actually not be linked with it. However, the optimizer will strip dead code, so it should not result in much if any difference in the resulting binary and does solve a build dependency issue.
2016-05-07 13:00:55 +02:00
Allan Odgaard
78da1357fd File browser no longer refuses first responder on mouse clicks
Previously we would only accept first responder if clicking an already selected item, this was so that the user could select items in the file browser without losing focus from the text editor.

Unfortunately after switching to a view-based file browser, clicking an already selected item (even when the file browser does not have focus) brings up an edit-in-place text field which is undesired.

Worse is that it is brought up after a delay, so a user may for example click the file browser (to give it focus) and instantly initiates an action like duplicate, which brings up the edit-in-place text field for the new copy, but then after a short delay, will move the edit-in-place text field to the originally clicked item.
2015-12-06 19:56:57 +07:00
Allan Odgaard
3478457098 Pass non-null arguments where the 10.11 SDK requires it 2015-11-20 13:12:16 +07:00
Allan Odgaard
9490ff8967 Don’t re-use FSItems for expanded folders during reload
The problem is that the URL property for all descendents of this item are pointing to the old path.

Ideally we should recursively update the descendents, because the current workaround loses the expanded state of the folder.
2015-10-23 17:21:41 +07:00
Allan Odgaard
1cdf087e96 Reset target property when re-using file system item 2015-10-23 17:20:54 +07:00
Allan Odgaard
c8fce64ad6 Account for NSOutlineView expand animations when revealing item
To reveal an item we need to expand all parents, but after switching to a view-based outline view, expanding items will be done animated, and updating the outline view’s bounds won’t happen until after all animation has completed.

I tried adding a completion handler to the current animation context, but this ran before the bounds had been updated.

I also tried to disable expansion animation (when we have an item to reveal), but I was unable to make that work. What I did was group the expandItem:expandChildren: call in a new animation context for which the duration had been set to zero.
2015-10-18 10:34:53 +07:00
Ronald Wampler
75d3c74f05 OFBOutlineView: Rename draggedItems → draggedOFBItems
This property's name was conflicting with a private instance variable in our superclass (NSOutlineView) for the 10.11 SDK.
2015-09-21 09:50:49 -04:00
Allan Odgaard
a99acf8532 fixup! Ensure we re-use file browser items that are unchanged 2015-09-07 20:15:10 +02:00
Allan Odgaard
c038bbe7bc Ensure we re-use file browser items that are unchanged
The data sources should already re-use items, as they are passed the old items, but since data sources are multi threaded, there might perhaps be a situation where the items passed gets updated out-of-order and re-use isn’t perfect (I haven’t been able to confirm this).

Re-using the items, when we use the animation methods of the outline view, does however seem to be very important, because the outline view will neither copy nor retain the items returned from our data source, so we must ensure they stay retained until we have told the outline view that the item no longer exist, so replacing an item with one that is equal but not pointer identical, without notifying the outline view, will cause random crashes.

At least that is my theory.
2015-09-07 18:16:58 +02:00
Allan Odgaard
7e396fae6f Open all selected items on double click and Open menu action 2015-09-07 18:16:58 +02:00
Allan Odgaard
4484eb0de3 Remove unused method 2015-08-30 10:55:18 +02:00
Allan Odgaard
f06f447ede Avoid referencing private types by using std::remove_pointer 2015-08-27 22:46:53 +02:00
Allan Odgaard
6b387eea6e Implement setNilValueForKey:
When running a debug build we get an exception due to lacking this method and the documentation does seem to indicate this is required for scalar keys.
2015-08-05 12:32:40 +02:00
Allan Odgaard
8fe7681ebd Remove unnecessary include of oak/compat.h 2015-08-05 12:31:20 +02:00
Allan Odgaard
d1ed42fef1 Use isOperatingSystemAtLeastVersion: to check for 10.10
The method wasn’t public before 10.10 but since we need to check for 10.10 we can simply conclude that lack of this method means that we are not running on 10.10.
2015-08-05 12:29:33 +02:00
Allan Odgaard
6ffd12e805 Improve algorithm to find root when using reveal in file browser
The algorithm will avoid changing root when possible. If root has to be changed, we favor the current project folder, if that is not possible, we use the parent for the item being selected, unless the item is in a file package below the project folder, in that case, we use the root of the file package.
2015-08-05 12:29:12 +02:00
Allan Odgaard
7d9b2d5470 Unbind properties when disposing our view
Since we dispose the subviews that the bindings are hooked up to, this shouldn’t be necessary, but it’s good for symmetri.
2015-08-05 12:25:12 +02:00