352 Commits

Author SHA1 Message Date
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
Allan Odgaard
f2387c9bc3 Ensure that the outline view’s clicked row is valid
The problem is if we right-click an item that causes content to be changed (e.g. Show Enclosing Folder) then later in the same run loop cycle ask for selected items, we prefer the clicked row, but this one might now no longer exist.
2015-07-30 22:00:06 +02:00
Allan Odgaard
14a1110199 Don’t pass NSTableCellView to OakFileManager
The view passed to the file manager is used to request the undo manager. The problem with using an NSTableCellView instance is that this view may be taken out of the view hierarchy (and thus responder chain) which makes it lose its undo manager.

This isn’t an immediate problem but if we later use undo/redo, it might be.
2015-07-30 21:56:00 +02:00
Allan Odgaard
a92b34fcaa Prefer insert/removeItemsAtIndexes: over reloadItem:
This way we only have to abort editing if the item being edited is going away.

View-based table views do not supported editedRow so this commit also change the way to figure out if a row is being edited.
2015-07-30 14:12:07 +02:00
Allan Odgaard
8abf5f2c9a Improve selection in file browser after deleting items
Previously if we deleted an expanded folder it would select the first child of this item which would then be removed and leave nothing selected.

There are still a few edge-cases left though where what’s selected after deleting items is not ideal.
2015-07-30 14:12:07 +02:00
Allan Odgaard
f0f056318d Update scmStatus and missing FSItem properties in SCM data source 2015-07-30 14:12:07 +02:00
Allan Odgaard
9cb059fa7b Move FSFileItem’s missing property to superclass 2015-07-30 14:12:07 +02:00
Allan Odgaard
16363f3aa0 Let the SCM data source re-use its FSItem instances 2015-07-30 14:12:07 +02:00
Allan Odgaard
bf9102f789 Re-use FSFileItems that represent missing files 2015-07-30 14:12:07 +02:00
Allan Odgaard
d40d9b0f24 Draw white circle around label swatch when row is selected
We previously did this when the background style was set to dark, but the code for this only works when the view is a direct descendent of the NSTableCellView and also, when a row is selected in an inactive table view, the background style is not set to dark.
2015-07-30 14:12:06 +02:00
Allan Odgaard
5b357d58c2 Track open state in FSItem
This eliminates the need for the last binding that was causing a retain cycle.
2015-07-27 18:45:32 +02:00
Allan Odgaard
79d012dba2 Dynamically create and dispose close button and label view 2015-07-27 18:44:49 +02:00
Allan Odgaard
a2052592ef Move construction of open/close buttons to table cell view
This gives us a bit more flexibility which we will need to properly toggle the close button.
2015-07-27 18:43:36 +02:00
Allan Odgaard
0c2a8b7e0c File browser’s undo/redo menu items only worked when it had focus
We only want to use first responder’s (local) undo manager when the first responder is a descendent of the file browser itself, e.g. the field editor.
2015-07-27 18:42:03 +02:00
Allan Odgaard
33d5538967 Make the datasource setter more robust
Previously it would throw an exception if datasource was set to nil after the outline view had been disposed.
2015-07-27 18:40:38 +02:00
Allan Odgaard
2d1804fc4c Don’t handle “item did reload” notifications for leaf items
In the view-based system all changes to a single item should be done by updating the properties of this item.
2015-07-27 18:39:43 +02:00
Allan Odgaard
e52efd5486 Avoid binding each table cell view to the modifiedURLs property
This removes a retain cycle though we still have one left caused by the openURLs property.
2015-07-27 18:39:37 +02:00
Allan Odgaard
f66abfa33d Add isModified property to FSItem 2015-07-27 18:39:26 +02:00
Allan Odgaard
b67713e9e5 Add custom view to draw label swatch
This mimics the new look used by Finder and we also fix a retain cycle by not binding to ‘self’ for the labelIndex property.
2015-07-27 18:39:25 +02:00
Allan Odgaard
161ffdc3fc Remove “cut” from file browser’s menu
It’s still possible to use ⌘X but I will probably remove the functionality in the future.
2015-07-24 23:41:06 +02:00
Allan Odgaard
909e36b516 Support using ⌥⌘V in file browser to “move” an item
This is consistent with Finder and slightly more flexible as it allows copying items in Finder and pasting them in TextMate via ⌥⌘V.
2015-07-24 23:34:05 +02:00
Allan Odgaard
8910b395f9 Include number of items on pasteboard in menu item title 2015-07-24 23:24:14 +02:00
Allan Odgaard
90ab3749d9 Setup proper truncation for file browser’s text field 2015-07-23 21:54:20 +02:00
Allan Odgaard
f675008402 Mark file browser as needing display after reloading items
After changing root item it often fails to redraw itself, so this is a workaround for what appears to be a framework bug.
2015-07-23 13:18:02 +02:00
Allan Odgaard
22acd31b25 Skip reloading file browser items if items are unchanged
The comparison is somewhat shallow, but ideally all changes to the actual items (rather than adding or removing items) is done by updating the properties of the existing instance. The exception here is the SCM Status data source, but FSItem’s isEqual: method does compare scmStatus.
2015-07-23 13:13:09 +02:00
Allan Odgaard
b8906248bd Don’t post “item did reload” notification for property changes 2015-07-23 13:08:09 +02:00
Allan Odgaard
f5358c79e4 Remove OFBPathInfoCell 2015-07-23 13:06:39 +02:00
Allan Odgaard
5b30416083 Switch file browser to be view-based (instead of cell-based)
One issue with the view-based version is that there seems to be no hook where we can update the text prior to edit, so in the SCM Status view where item names are disambiguated, editing the item will cause the disambiguated name to be used as basename.

The view-based version is also more eager to start editing rows, for example the “click a selected item to move focus to file browser” now also trigger renaming of that item, which is rather undesirable.

A few other pending issues also remain, like better rendering of labels, not adding a (hidden) close button to each row, and ensuring FSItem instances are re-used when possible (e.g. SCM data source).

The way we mark items as modified or open is also suboptimal, as it’s partly done via bindings and partly manual.
2015-07-23 12:59:25 +02:00
Allan Odgaard
e3ad1440e1 Prefer the clicked row when triggering edit of a row 2015-07-23 12:54:16 +02:00
Allan Odgaard
34ebabdc87 Call abortEditing on outline view instead of cancelOperation
I’m not sure if it is necessary to manually refocus the outline view after aborting the field editor, does seem like a bug and will most likely not be present for view-based outline views.
2015-07-23 12:50:21 +02:00
Allan Odgaard
58dc3070ba Move label color change to FSItem 2015-07-23 11:49:24 +02:00