Commit Graph

51 Commits

Author SHA1 Message Date
Allan Odgaard
96d1220e63 Use self.window instead of accessing instance variable of superclass 2018-10-31 23:07:52 +07:00
Allan Odgaard
fa5e3cf869 Remove custom NSCell subclass used for file browser’s folder pop-up
The purpose was to render text with a shadow and fade the text when the window is inactive, but the former has not been used since 10.10 and the latter doesn’t actually seem to work.
2018-10-30 21:22:13 +07:00
Allan Odgaard
c21387adfb Selecting file outside project (⌃⌘R) would fail 2018-10-30 18:52:30 +07:00
Allan Odgaard
9b70e273d5 Make new file browser’s CreateIconImageForURL public API
Ideally I would like to have the FileItem class be the public API, as that will then take care of updating the icon’s SCM status etc., current commit is just a temporary fix for missing document icons on 10.14.
2018-10-30 16:10:51 +07:00
Allan Odgaard
fd0ef648e1 Show as many parents as required to disambiguate file browser items 2018-10-30 13:45:38 +07:00
Allan Odgaard
e6ae59976b Remove most of our 10.10 compatibility checks 2018-10-30 12:31:51 +07:00
Allan Odgaard
aa674c08b7 Guard against no file browser root item when updating modified/open URLs 2018-10-30 11:53:35 +07:00
Allan Odgaard
bad84bd511 Tweak how we throttle fetching SCM status
When we observe a change on disk we will fetch status after 0.5 seconds if we are active, otherwise 3 seconds.

If we become active and have a pending update, we update immediately.

The reason for the delay is that the change on disk could be the version control system working, for example performing a rebase, and not all systems can gracefully handle requesting status when in the midst of such operation.
2018-10-29 21:31:56 +07:00
Allan Odgaard
0eb5250c26 Pass directory with changes to FSEvents observer 2018-10-29 19:49:28 +07:00
Allan Odgaard
85d5bb3fbe Fix indentation 2018-10-29 13:34:08 +07:00
Allan Odgaard
493620710b Avoid copying full status map for each file observer 2018-10-29 11:05:00 +07:00
Allan Odgaard
2354a485ef Don’t call repositoryAtURL: when we already have a repository 2018-10-29 10:59:12 +07:00
Allan Odgaard
82c0752c0f Remove method from SCMManager only used by one client 2018-10-29 10:53:32 +07:00
Allan Odgaard
c8beb6c238 Pass SCMRepository to observers (instead of status map) 2018-10-29 10:49:14 +07:00
Allan Odgaard
553a2c5912 Use SCMManager instead of scm framework for SCM status data source 2018-10-29 10:38:01 +07:00
Allan Odgaard
4d3de192ce Let SCMManager use the SCM drivers directly
Currently SCMManager is not as conservative about refreshing SCM status, specifically SCM status was previously not updated when the application was inactive, the latency for updating was pretty high (3 seconds).

We do however need to check if there are actual changes, as at least in the past, calling `hg` even when there are no changes, may cause file system to be updated, which will trigger a new status refresh.
2018-10-29 10:36:22 +07:00
Allan Odgaard
d5ea5d1d80 Add symbolic link to scm drivers
The drivers include ../status.h so we need to link to that file as well.
2018-10-29 10:29:47 +07:00
Allan Odgaard
82dda5588d Wrong URL got passed to SCMManager 2018-10-29 09:27:31 +07:00
Allan Odgaard
1e5fdcbc09 Allow observing subdirectories with FSEventsManager 2018-10-28 23:03:32 +07:00
Allan Odgaard
9f6d9d043e Do not have FSEventsManager load directory contents
Originally we had FSEventsManager handle directory loading because it worked as a cache, but it’s better to move this to the client, as not all clients need the directory content, additionally it simplifies the cache invalidation (reload) and also moves the hardcoded list of URL keys to preload into the client, which should know which keys are desired.
2018-10-28 22:38:10 +07:00
Allan Odgaard
f5e543dc77 Only allow observing full repository instead of “files with status” 2018-10-28 16:51:33 +07:00
Allan Odgaard
9f9bb5e255 Fix capitalization of URL in parentURL 2018-10-28 16:43:17 +07:00
Allan Odgaard
a5c4b979d5 Rename SCMRepository → SCMDirectory 2018-10-28 15:54:04 +07:00
Allan Odgaard
3d350f2ec4 Update link dependencies for new file browser framework 2018-10-28 15:05:31 +07:00
Allan Odgaard
c14350dc98 Move remaining code and resources from OakFileBrowser → FileBrowser 2018-10-28 15:02:11 +07:00
Allan Odgaard
5449e27430 Move file item auxiliary views to new file browser framework 2018-10-28 14:51:47 +07:00
Allan Odgaard
c8ea52f19c Move “select base name” cell subclass to new file browser framework 2018-10-28 14:48:48 +07:00
Allan Odgaard
b0262c452c fixup! Switch to new file browser 2018-10-28 13:38:25 +07:00
Allan Odgaard
0d75927528 Update OakFileBrowserDelegate protocol to new file browser controller 2018-10-28 13:36:33 +07:00
Allan Odgaard
7cf482fe25 Rename notification constants 2018-10-28 13:32:14 +07:00
Allan Odgaard
10bf1acf78 Use display name instead of localized name for file browser location
The display name includes the “disambiguation suffix” which we set to “disabled” or “no status” for the SCM status file item.
2018-10-28 13:21:19 +07:00
Allan Odgaard
c822943b93 Move OakFileBrowser delegate protocol and constants to new file browser 2018-10-28 13:15:39 +07:00
Ronald Wampler
e64b09b688 Introduce overloads for the new divider styles
Also, switch to use the new divider styles in most places. The remaining usage of the old "OakCreateLine" functions are in the OakChooser windows. These will be refactor for better dark mode support next.
2018-10-28 11:07:03 +07:00
Allan Odgaard
a304ebe25f Add file browser view controller 2018-10-28 00:28:02 +07:00
Allan Odgaard
62f9b3810c Add reload action method to file browser view 2018-10-28 00:28:02 +07:00
Allan Odgaard
cc8f610973 Add API to force reload of an observed directory 2018-10-28 00:28:02 +07:00
Allan Odgaard
4b8946184d Make previewableItems a public property 2018-10-28 00:28:02 +07:00
Allan Odgaard
7037388242 Disable animated file browser updates when we have more than ~500 items
Insert and remove could still be done, but the re-ordering does not scale as we currently use an LCS algorithm that require N*M storage.

Long-term my thinking is that we can limit animated re-ordering to only include the visible rows, but my initial attempt at this showed some issues with the NSOutlineView, as re-ordering non-visible items still require a reload, which had visible side-effects.
2018-10-28 00:28:02 +07:00
Allan Odgaard
387a5a844d Allow file packages to be inline expandable (like directories)
File packages are still sorted together with regular files rather than moved to the top.

To enable, run: defaults write com.macromates.TextMate allowExpandingPackages -bool YES
2018-10-28 00:28:02 +07:00
Allan Odgaard
fd0b5b5f07 Add disk operations (move, copy, delete) to file browser view 2018-10-28 00:28:02 +07:00
Allan Odgaard
89d4d23867 Add new file browser view 2018-10-28 00:28:02 +07:00
Allan Odgaard
0c4c6baca2 Add symbolic links to some private OakFileBrowser headers
This is only during the transition to a new file browser.
2018-10-28 00:28:02 +07:00
Allan Odgaard
566acd2445 Add NSOutlineView subclass for file browser
This is largely copy/paste from OFBOutlineView.mm.

This adds keyboard support, delegate methods that include whether or not expand/collapse includes children, and a delegate method for when items are dragged to the trash.
2018-10-28 00:28:02 +07:00
Allan Odgaard
446265e0fa Add NSTableCellView subclass for use with FileItem 2018-10-28 00:28:02 +07:00
Allan Odgaard
ffb3d9a276 Add FileItem subclass for SCM status 2018-10-28 00:28:02 +07:00
Allan Odgaard
fa33b9afaf Add FileItem subclass for mounted volumes 2018-10-28 00:28:02 +07:00
Allan Odgaard
0708f909c9 Add API that allows observing children of a URL 2018-10-28 00:28:02 +07:00
Allan Odgaard
e0b4d8460b Add FileItem class as interface to the filesystem
FileItem objects will automatically update their SCMStatus and icon based on the properties of the object, but the item’s children (and arranged children) needs to be set externally.

The reason is that to properly sync insert/remove animations with changes to a item’s children, updating the children should be done by the same controller that updates the outline view.
2018-10-28 00:28:02 +07:00
Allan Odgaard
c7c6799bad Add source for new FSEventsManager
This is a wrapper for the FSEvents API but uses blocks (and NSURL) for callbacks and will coalesce multiple observers for the same directory.
2018-10-26 22:44:10 +07:00
Allan Odgaard
b4da449399 Add helper function to create document icon images
This is based on the somewhat new block-based NSImage rendering API which simplifies things tremendously compared to our existing OakFileIconImage.

Like with the SCMManager class, this new API is limited to a future file browser, as for example images need to update themselves when SCM status or document’s modified state changes, but the NSImage class itself has no way to indicate that it needs to be redrawn, therefore the places we show images should bind to a file item which will then be responsible for updating its image property when the document state changes.
2018-10-26 22:44:10 +07:00