Commit Graph

153 Commits

Author SHA1 Message Date
Allan Odgaard
c031557df2 Add ‘New Document’ to file browser
This create a new file on disk and brings up the “rename” text field.

You can control the type/extension either in Preferences → New document type or by setting it in .tm_properties, e.g.:

    [ attr.untitled ]
    fileType = 'source.objc++'

New Document can be undone, but it is handled by deleting the file on disk and losing potential edits you have made since creating it.

Closes #161.
2013-02-15 15:27:57 +01:00
Allan Odgaard
88cc5021a9 Add API for starting edit of item in file browser 2013-02-15 15:27:56 +01:00
Allan Odgaard
f507c75c0e Add directoryForNewItems property to file browser 2013-02-15 15:27:55 +01:00
Allan Odgaard
84b71c7640 Add swiping gesture support for 10.8
I am not sure what Apple’s thinking is here. We have swipeWithEvent: which worked on 10.7 but seems to no longer work, yet there is a global preference for configuring a swipe gesture and Safari supports that config option, but it appears other apps have to role their own implementation.
2013-02-15 15:27:55 +01:00
Allan Odgaard
a4dc3bf977 OakFileManagerDirectoryKey → OakFileManagerPathKey
This allows us to use the same key for more than just directories. The notification name itself should indicate if the ‘path’ refers only to directories or files.
2013-02-15 15:27:54 +01:00
Allan Odgaard
deffe08d1b Fix new selected item after delete 2013-02-15 15:27:54 +01:00
Allan Odgaard
58feb5dd43 Remove “crash guard”
This should no longer be possible now that the callback won’t be called after the scm info has been destroyed.

This reverts fce82f0759.
2013-02-15 15:27:54 +01:00
Allan Odgaard
b66912d8e8 Fix exception
This would happen if root url in file browser was not a file url and the user selected “Go to Folder…”.
2013-02-14 11:31:22 +01:00
Allan Odgaard
60a4b9520a Make internal functions private again 2013-02-14 11:31:21 +01:00
Allan Odgaard
967f08c9c0 Limit file browser header updating
This mainly relates to the folder pop-up. By delaying creation of this menu till the user actually opens it, we avoid/delay having to create potentially expensive icons (icons are “expensive” since creating one may cause TextMate to hit the disk).
2013-02-14 11:31:21 +01:00
Allan Odgaard
ad6a82bb1d Don’t explicitly update file browser header view
This is unnecessary as long as we always go via setUrl: or setHistoryIndex:
2013-02-14 11:31:21 +01:00
Allan Odgaard
43fa57ae22 Don’t draw status bar background on window border 2013-02-14 11:31:20 +01:00
Allan Odgaard
ba7b1b1be7 Fix coding style 2013-02-12 21:55:56 +01:00
Allan Odgaard
0a0d9a3d9b Assign key equivalents to Go → Back/Forward
We use ⌘[ and ⌘] which is also used for Text → Shift Left/Right so we only set these keys for when the main text view is not active.

The main advantage is that you can now use these keys to move back and forth in history of HTML views (it also works in file browser, but due to a custom keyDown: overload, it also worked prior to this commit).
2013-02-11 21:58:29 +01:00
Allan Odgaard
7c1c253c86 Make “Go to Favorites” a toggle 2013-02-11 14:21:24 +01:00
Allan Odgaard
059a8a0b75 Improve Quick Look menu item title
This now also shows what it’ll display and switches to “Close Quick Look” when the panel is already showing.
2013-02-11 14:21:23 +01:00
Allan Odgaard
2c996b6b7a Improve file browser menu titles
We now write what the actions will apply to. This isn’t done for all actions, which is somewhat consistent with Finder, though I don’t know why Finder doesn’t include such description for all items, perhaps it’s seen as redundant to state for every action (and just adds noise), so only items where user could be “confused” should explicitly state what they work on.
2013-02-11 14:21:23 +01:00
Allan Odgaard
7b017d695d Rework file browser action menu 2013-02-11 14:21:23 +01:00
Allan Odgaard
af37d2e30a Skip group cells when selecting item after delete (file browser)
Presently this is only relevant for the SCM Status view, as no other data source use group cells.
2013-02-11 14:21:22 +01:00
Allan Odgaard
df8465e607 Align close button (×) with file labels
Closes #391.
2013-02-11 14:21:21 +01:00
Allan Odgaard
129784816c Don’t show SCM badges for untracked items
All of these will always have the same badge, so there’s no reason to show it (and it covers the alias badge, so there is some usability benefits beyond just the visuals).
2013-02-11 14:21:21 +01:00
Allan Odgaard
507dac1908 Let FSItem use OakFileIconImage. 2013-02-11 14:21:20 +01:00
Michael Sheets
7fa0e34a5e Restyle and add graphics to file browser action bar 2013-02-09 16:34:24 +01:00
Allan Odgaard
ae02db9baa WIP: Add action bar to file browser 2013-02-09 16:34:24 +01:00
Michael Sheets
034dd8f06b Shrink height when tabs above document is enabled 2013-02-09 16:34:24 +01:00
Michael Sheets
2200df74fd Simplify constraints and set a height for file browser header 2013-02-09 16:34:23 +01:00
Allan Odgaard
43e15b3792 Let file browser header inherit from OakGradientView 2013-02-09 16:34:23 +01:00
Allan Odgaard
9c994af1e0 Tweak OakGradientView
- Accept two NSGradient objects instead of four colors.
- Call designated initializer on super instead of self since subclass is likely calling us from its designated initializer
- Make class public
2013-02-09 16:34:23 +01:00
Michael Sheets
9a26e0df5e Move file browser divider into parent view 2013-02-09 16:34:11 +01:00
Allan Odgaard
deac51c7a1 Expose outlineView property of file browser 2013-02-08 13:55:09 +01:00
Allan Odgaard
b139ac5097 Change push_back → emplace_back (C++11)
This is mainly motivated by readability, so I only did a few select replacements.
2013-02-08 11:20:35 +01:00
Allan Odgaard
fce82f0759 Fix potential crash
Even though the code is running on the main thread, it might still run after the owning (C++) object has been destroyed.
2013-02-06 18:25:01 +01:00
Allan Odgaard
a913a512e5 Let directory data source observe the “did change” notification
This means we instantly reload after performing a file system operation.
2013-02-06 14:50:05 +01:00
Allan Odgaard
41ea4b1888 Move instance data to implementation file 2013-02-05 20:59:54 +01:00
Allan Odgaard
446f219c7a Reload updated folders on reactivation
This is done by stat’ing all visible folders and is a fallback for when fs-events is not working (e.g. network file systems).
2013-02-05 20:59:54 +01:00
Allan Odgaard
e46be6b2a2 Add memory address to FSItem description
Since table views use the memory address, and these items are for use in table views, it’s useful to see the address when printing an item.
2013-02-05 20:59:54 +01:00
Allan Odgaard
c951e00a06 File browser: Dispose all children on collapse
Previously we kept the children which had been expanded, as these had an associated record for tracking file system changes and SCM info.

However, when expanding we weren’t actually re-using the item from the cached record, so not only was this wasteful, but it caused a problem because we effectively created a new item but used the old record with the old item, and while the two items would compare is equal when using isEqualTo:, they didn’t have the same memory address, so the outline view would not consider them equal, and would thus not react on reload requests when using the older item.
2013-02-05 20:59:54 +01:00
Allan Odgaard
c182d08c5d Only access SCM info when available
Fixes #756.
2013-02-05 09:45:11 +01:00
Allan Odgaard
f99ca2408d Show non-existing paths with SCM status
This means deleted files which haven’t yet been committed show up in the file browser.
2013-02-04 19:38:32 +01:00
Allan Odgaard
6f076e0895 Remove public initializer
This is only to ensure everyone goes through the class method, which is easier to search for (constructing an FSItem from a URL is a little expensive so we wish to get rid of it where possible).
2013-02-04 19:38:32 +01:00
Allan Odgaard
6d022be813 Rework file browser directory source
We now use the new SCM callback and in general things are much simpler, cleaner, and probably faster.
2013-02-04 19:38:31 +01:00
Allan Odgaard
dae91b7159 Move instance data to implementation 2013-02-04 19:38:31 +01:00
Allan Odgaard
e599bb7379 Introduce scm::ng::root_for_path
Also change SCM implementation so that it doesn’t use objects with automatic storage, as the objects may be accessed from threads, which may run after objects with automatic storage has been destroyed.
2013-02-03 10:48:38 +01:00
Allan Odgaard
bfa3db1d79 Disallow selecting group cells in file browser
Group cells are presently only used for the SCM status data source.
2013-02-03 10:48:29 +01:00
Allan Odgaard
837bdf537b Reset mouse hover state when leaving view
The close buttons in the file browser could be stuck on their “hover” state if quickly moving mouse outside the bounds of the outline view.
2013-02-03 10:48:27 +01:00
Allan Odgaard
b51ed151d6 Auto-enable Back / Forward menu items 2013-02-03 10:48:26 +01:00
Allan Odgaard
78c5114ac6 Remove hardcoded shortcuts from keyDown:
These keys are also in the menu so no need to special-case them (unlike the other keys handled).
2013-02-03 10:47:24 +01:00
Allan Odgaard
d29337a754 SCM API: Update SCM data source 2013-02-02 10:51:59 +01:00
Allan Odgaard
4138c2a3d5 Use data source’s root item’s title in file browser header
This is instead of simply asking for the root URL’s display name, as the data source can provide a more specialized display name.
2013-02-02 10:34:23 +01:00
michael starke
e5d2d43e61 Fixed wrong color in red file labels 2013-01-31 01:26:31 +01:00