Commit Graph

533 Commits

Author SHA1 Message Date
Allan Odgaard
6245fa17d5 Introduce ‘reusable’ property to OakHTMLOutputView
This defaults to YES but can be set to NO if an output view should not be re-used (even though no command is currently running).
2016-10-03 22:05:39 +02:00
Allan Odgaard
265f36eb4f Workaround for window order when restoring session and opening document
While debugging the problem I dumped NSApp.orderedWindows, which turned out to fix the issue. Wouldn’t rely too much on this, but I am not sure what a proper workaround should be, given that this appears to be a framework issue.

For issue description see comment in the source code.
2016-10-01 09:03:25 +02:00
Allan Odgaard
414794603f Fix array literal potentially initialized with nil value 2016-09-29 15:42:49 +02:00
Allan Odgaard
0fb5050cfe Support NSNotFound in performCloseTab:
The tab bar uses the result of indexOfObject: as the tag, so if there is no selected tab, it would be NSNotFound.

Generally though this should not happen.
2016-09-29 09:56:49 +02:00
Allan Odgaard
db6c22bd8c Delegate menu item validation for performBundleItemWithUUIDStringFrom:
We now let the object that handles performBundleItem: validate the menu item.
2016-09-29 09:16:00 +02:00
Allan Odgaard
9e8a435e2b Change how we manage window title updates
We now only “reveal file in project” (when enabled) on document path changes.
2016-09-28 20:56:55 +02:00
Allan Odgaard
9e949e3eda Use NSUUID for project identifier (instead of NSString) 2016-09-26 11:08:22 +02:00
Allan Odgaard
d5fad16311 Dragging selected tab to new window will select it in the new window 2016-09-26 11:06:52 +02:00
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