Commit Graph

492 Commits

Author SHA1 Message Date
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
Allan Odgaard
ce5a6b4b59 Avoid unnecessary folder scanning
This should be fixed in the FileChooser class, but that is non-trivial since we need to introduce a “dirty” flag and start the search when the window is made visible or possibly at the start of the next event loop cycle.
2016-09-14 08:38:27 +02:00
Allan Odgaard
5d8ef8c259 Rename openDocuments property to openCppDocuments 2016-09-14 08:35:55 +02:00
Allan Odgaard
590fd5b71b Change type of document_t::lru from oak::date_t to NSInteger 2016-09-13 08:17:35 +02:00
Allan Odgaard
bdfdef2dde Rename file DocumentController.{mm,h} to DocumentWindowController.{mm,h} 2016-09-13 07:37:16 +02:00
Allan Odgaard
0efd6c750d Rename DocumentController to DocumentWindowController
This should ensure we do not confuse it with OakDocumentController (a class that only tracks document instances w/o any UI).
2016-09-13 07:37:16 +02:00
Allan Odgaard
d65bbc567a Handle document sticky flag in the UI layer 2016-09-13 07:37:16 +02:00
Allan Odgaard
5ae2769cc7 Only set selected document when required prior to showing dialog
Setting OakTextView’s document currently has the side-effect that the caret is made visible, so incase the user scrolls the caret out of view and then e.g. closes the (modified) document, previously the caret would be made visible prior to showing the “Save Changes?” dialog.
2016-09-12 09:25:12 +02:00
Allan Odgaard
553e89ceb6 Update include statements and link declarations 2016-09-11 12:47:39 +02:00
Allan Odgaard
da5fdd78a8 Remove document_t from OakDocumentView
This also updates the commit window to only use OakDocument API.

The bundle editor and document controller still require updating.
2016-09-11 08:49:32 +02:00
Allan Odgaard
ebf6ae9346 Rename document property to cppDocument as intermediate refactoring step 2016-09-11 08:43:46 +02:00
Allan Odgaard
f2289039da Calling document_t::show/hide is now done by DocumentController
This is only done for LRU tracking so it sort of makes sense to move this outside the document view itself (e.g. commit window and bundle editor does not require any LRU tracking).
2016-09-11 08:42:20 +02:00
Allan Odgaard
386979ed2d Enable “backup on change” for documents
This was disabled (by accident) during the migration to OakDocument, although we would still backup document content when project properties were changed (like active tab or window size).

The reason we require DocumentController to explicitly enable backups is that we do not want backups for bundle editor and commit window, since these (currently) are unable to restore documents, and the former is never really closed, so the backups would live forever.
2016-08-29 21:24:34 +02:00
Allan Odgaard
ba8dfaf9fd Remove some unused document::run delegate methods 2016-08-28 13:32:49 +02:00
Allan Odgaard
c7d3aa3649 Move show_command_error to DocumentController 2016-08-28 13:32:49 +02:00
Allan Odgaard
e282dc2fd2 Remove commandRunner from HTMLOutputWindow and DocumentController 2016-08-28 13:32:49 +02:00
Allan Odgaard
0153e837a8 Remove document::run API 2016-08-28 13:32:49 +02:00
Allan Odgaard
f01bf97630 Add OakCommand responder methods to OakTextView and DocumentController 2016-08-28 13:32:48 +02:00
Allan Odgaard
d142f82f9f Check ‘isRunningCommand’ instead of ‘runner->running()’ 2016-08-28 13:32:48 +02:00
Allan Odgaard
bd61830833 Rework how we find suitable OakHTMLOutputView for command execution 2016-08-28 13:32:48 +02:00
Allan Odgaard
894b33d0bf Set frame autosave name of HTML output windows during creation 2016-08-28 13:32:48 +02:00
Allan Odgaard
c99e65b17c Let OakHTMLOutputView handle the “Stop Task?” warning sheet
This also allows for the sheet to automatically close, should the command exit before the user selects an action.
2016-08-28 13:32:47 +02:00
Allan Odgaard
4294889a79 Add comments about scope attributes 2016-08-28 09:13:41 +02:00
Allan Odgaard
0b15e58844 If duplicating the active tab’s document then we open the duplicate 2016-08-25 00:07:47 +02:00
Allan Odgaard
fbc7bab291 With multiple unsaved documents use Save All as button title 2016-08-22 16:14:36 +02:00
Allan Odgaard
3b3d86a320 Use WebView’s stopLoading instead of killing the running task
This is a more appropriate API to use for signalling that we wish to abort the running command.
2016-08-21 12:24:40 +02:00
Allan Odgaard
89c19eff61 Change ‘runningCommand’ getter to ‘isRunningCommand’ 2016-08-21 12:23:40 +02:00
Allan Odgaard
e457c8834f Only check network reachability when we know there are remote grammars
Previously we would check network reachability for all unknown file types, even if it lead to no grammar suggestion.
2016-08-21 12:09:32 +02:00
Ronald Wampler
860da518cb Add attr.project.swift scope
This scope can be used to support the Swift Package Manager tools (e.g., `swift build`).
2016-08-17 15:26:48 +02:00
Allan Odgaard
17a08d2c54 Do not call sync_open on a document which is loading
A document which is loading is likely showing a modal dialog (encoding view) and calling sync_open will run a local event loop which may then lock up the UI.
2016-08-17 15:23:05 +02:00
Allan Odgaard
7cff411632 fixup! Simplify code which inserts new documents into the tab bar
The simplified code did not remove duplicates from the documents to be inserted.
2016-08-10 11:31:11 +02:00
Allan Odgaard
19028bbd71 Using mate /path/to/folder would not use file type setting
This was only incase a new untitled document was created (rather than restore open files for the folder).
2016-08-07 20:43:11 +02:00
Allan Odgaard
076863e954 Add some extra checks to potentially avoid crashes 2016-08-05 23:19:18 +02:00
Allan Odgaard
26edab6a75 Running a command with output and no document would crash 2016-08-05 23:18:43 +02:00