Commit Graph

525 Commits

Author SHA1 Message Date
Allan Odgaard
b56c51212a Check for exact dependencies when updating icon/represented file 2016-09-24 15:21:02 +02:00
Allan Odgaard
8cab8be8b5 Also observe document’s display name
The display name can change without a change to the path, in which case, we should update the UI accordingly, although the current implementation of OakDocument does not trigger any change notification when e.g. the user enables “Hide Extension” for a document.
2016-09-24 15:21:02 +02:00
Allan Odgaard
66075f6a30 Inline the track/untrack methods 2016-09-24 15:21:02 +02:00
Allan Odgaard
46e83179ae No need to track/untrack selected document since we track all documents 2016-09-24 15:21:01 +02:00
Allan Odgaard
7d40792a32 Do not update documentPath from setSelectedDocument:
The property will automatically be updated by our observer.
2016-09-24 15:21:01 +02:00
Allan Odgaard
d9b6bde6ec Update window’s icon/represented file directly from observer 2016-09-24 15:21:01 +02:00
Allan Odgaard
a3543029d8 Update window’s documentEdited property directly from observer 2016-09-24 15:21:01 +02:00
Allan Odgaard
17046aa051 Observe documents/selectedDocument properties instead of each document 2016-09-24 15:21:01 +02:00
Allan Odgaard
0a6cbe150e Remove documentDisplayName property
The only purpose of observing this property seems to be to update the window title, but since display name is derived from path, which we also observe, it seems redundant.

Though technically the display name could change because extension is hidden or similar, but this is a bit of an edge-case, and long-term we want file browser and tab bar to observe the document’s displayName property directly.
2016-09-24 09:43:59 +02:00
Allan Odgaard
510d093696 Use selectedDocument.property instead of our mirrored documentProperty 2016-09-24 09:41:36 +02:00
Allan Odgaard
dcd725de05 Remove cppDocuments property and last usage of document_t 2016-09-24 09:37:31 +02:00
Allan Odgaard
83c1f2b6e5 Use OakDocument API to “detach” backup file
This needs to be revised.
2016-09-24 09:37:31 +02:00
Allan Odgaard
2baf1f7889 Remove most uses of _cppDocuments 2016-09-24 09:37:31 +02:00
Allan Odgaard
58b075da44 Remove selectedCppDocument property
The selectedDocument property is now readwrite.
2016-09-24 09:37:31 +02:00
Allan Odgaard
25156bcd8d Limit use of selectedCppDocument property 2016-09-24 09:37:31 +02:00
Allan Odgaard
a478cc0ae1 Move openAndSelectDocument: API to use OakDocument 2016-09-24 09:37:30 +02:00
Allan Odgaard
754ca4901c Move insertDocuments: API to use OakDocument 2016-09-24 09:37:30 +02:00
Allan Odgaard
cdda7495ea Prepare moving insertDocuments: API to OakDocument 2016-09-24 09:37:30 +02:00
Allan Odgaard
f4b56d1435 More code updated to use OakDocument 2016-09-24 09:37:30 +02:00
Allan Odgaard
381e1bff73 Use OakDocument’s isEqual: instead of document_ptr’s operator==
Since we no longer ensure document_ptr objects are reused, we cannot compare them using operator==.
2016-09-24 09:37:30 +02:00
Allan Odgaard
53c1c4b13c Use OakDocument type for managing sticky state 2016-09-24 09:37:30 +02:00
Allan Odgaard
41eff5c089 Use NSArray<NSUUID*>* for tabs to close
Also change disposableDocument to NSUUID*.
2016-09-24 09:37:30 +02:00
Allan Odgaard
5ee70bfe29 Use instance variable for documents array instead 2016-09-24 09:37:30 +02:00
Allan Odgaard
34e1fec7f1 Remove UI proxy implementation from DocumentWindowController 2016-09-24 09:37:30 +02:00
Allan Odgaard
965eac9342 Use KVO instead of document_t callback 2016-09-24 09:37:29 +02:00
Allan Odgaard
df0fbe8630 Preparation for removing document_ptr from DocumentWindowController 2016-09-24 09:00:25 +02:00
Allan Odgaard
e133be01b7 Rename documents property to cppDocuments
This is just to make migration easier.
2016-09-24 08:59:31 +02:00
Allan Odgaard
eef0878538 Remove document::show_browser
Instead use OakDocumentController’s showFileBrowserAtPath:
2016-09-24 08:55:18 +02:00
Allan Odgaard
48a73f0a0f Remove openAndSelectDocument: from public API 2016-09-24 08:55:18 +02:00
Allan Odgaard
ffca47a262 More code ported to OakDocument 2016-09-24 08:55:06 +02:00
Allan Odgaard
3af916629c Let OakCommand use OakDocumentController API 2016-09-24 08:33:33 +02:00
Allan Odgaard
9a4db4665d Add “show document” API to OakDocumentController
This is currently just a wrapper for the old C++ API.
2016-09-24 08:33:33 +02:00
Allan Odgaard
8f736f39cd Add key/value types for NSArray and NSDictionary return types
This is just to give us better type checking (as we probably want to change the dictionary key type to NSUUID*).
2016-09-24 08:33:32 +02:00
Allan Odgaard
aa2e86a015 Fix crash when clearing document that was never set
This would show when opening a file that prompted the user for input (e.g. unknown encoding) and then selecting cancel.
2016-09-21 20:39:42 +02:00
Allan Odgaard
6db5ac8de3 Rename performCloseOtherTabs: to performCloseOtherTabsXYZ:
Starting with macOS 10.12 the NSWindow class will swallow this method, even if we set NSWindow.allowsAutomaticWindowTabbing = NO.
2016-09-21 20:39:41 +02:00
Allan Odgaard
ad01eb1ac6 Use stringArrayForKey: where appropriate 2016-09-21 20:39:41 +02:00
Allan Odgaard
1087a68f44 Add “File Browser Items” as find dialog search target 2016-09-20 20:04:19 +02:00
Allan Odgaard
e3874bcecb Only set menu item image when required
The system can be updating the menu only to resolve a key equivalent, hence the image is not required. The document icon can be a little expensive to create because of the SCM badge. This would be noticeable when doing a folder search with hundres or thousands of results and then pressing ⌘1, here it would previously need to create all the document icons before responding to the key.
2016-09-20 18:12:13 +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
7cc017f343 Harmonize all implementations of sharedInstance 2016-09-19 12:54:19 +02:00
Allan Odgaard
41bf68e636 Remove FileChooser’s openDocuments property
List of open documents are (now) obtained from OakDocumentController.
2016-09-19 12:51:36 +02:00
Allan Odgaard
44d037da65 Use OakDocument’s icon for Select Tab menu items 2016-09-19 12:50:04 +02:00
Allan Odgaard
7a69bf3b28 Ensure untitled documents are in the LRU list after session restore 2016-09-19 12:46:07 +02:00
Allan Odgaard
82ad6667e9 Ensure all untitled documents in a project get a directory
We should probably update the directory if the project’s project folder is changed, and we may also consider storing this in the session, at least if we set the directory during “New Tab” (based on current file browser selection).
2016-09-18 13:26:12 +02:00
Allan Odgaard
a58f3b88e9 Let document window send ‘open’ to unloaded documents
When batch-opening documents we only load the selected one. Previously this meant that e.g. after session restore, using Find in Open Files would not search documents in background tabs (that had not yet been clicked).
2016-09-18 10:35:33 +02:00
Allan Odgaard
ddefdec649 Change document’s isOpen property to isLoaded
Since we do not load documents before the user selects them, e.g. after session restore or when opening multiple documents, it makes sense to have both an isOpen and isLoaded property, the former means “is shown somewhere in the UI” and would make it appear (e.g. in file browser) with close button etc., whereas the latter means that data has been loaded from disk, and we can safely access the buffer.
2016-09-18 10:29:21 +02:00
Allan Odgaard
83113e4765 Use NSUUID for documentIdentifier properties 2016-09-18 07:32:05 +02:00
Allan Odgaard
676f542dac Custom scopeAttributes only worked for file pattern sections
That is [ *.diff ] worked but [ source.diff ] did not, since we looked up using only the file path, not the file type.
2016-09-16 15:39:33 +02:00
Allan Odgaard
0a2754a4c6 Add missing include 2016-09-16 15:39:33 +02:00
Allan Odgaard
a70363d4e0 Remove document_t compatibility API from FileChooser class 2016-09-14 08:39:09 +02:00