Commit Graph

143 Commits

Author SHA1 Message Date
Allan Odgaard
c619054780 Provide singleton API for FileChooser
You can still create multiple instances, but would generally not want to.
2013-01-23 17:12:33 +01:00
Allan Odgaard
645f8d91e1 Let OS handle keys for Go to Tab submenu
My memory is a little vague here, but I believe the point of handling the menu keys was to workaround a bug in NSMenu.

The bug was that NSMenu would look at (the target of) cached menu items, probably for UI validation, so potentially sending methods to unretained objects, which could lead to a crash. Several workarounds were attempted (like clearing the target property after the menu had been displayed) but the only effective one was overloading key handling.

I’m quite sure though that this bug is no longer relevant.
2013-01-22 11:00:27 +01:00
Allan Odgaard
7b8b13fa2f Improve behavior when resizing subviews
Now resizing one subview has the other view locked at its current size and will stay at that size. Previously if you made the window smaller, causing the HTML view (on right) to shrink, and then resized the file browser to be smaller, the HTML view would grow until it had reclaimed the pixels lost during window resize.

Additionally, when resizing the window, the HTML view (on right) will shrink to its minimum size before the file browser starts to shrink. Previously this was “undefined” and after shrinking a window, you could actually see the two views resize to redistribute the loss.
2013-01-22 08:03:07 +01:00
Allan Odgaard
4ad6dc99a9 Use ‘nil’ to indicate no represented file
The window uses the empty string, but since we use our represented file property to create proxy icons, test if we should setup SCM status watching, etc., we don’t want to test for either nil or empty string in all these places.

This fixes exception from creating OakFileIconImage from empty string.
2013-01-21 06:12:16 +01:00
Allan Odgaard
564571ab8b Pass SCM info to file chooser 2013-01-20 12:49:35 +01:00
Allan Odgaard
5627d201db Opening multiple documents selects the last one
This way ⌘W can be used to close the current document and move to the “next” one which was part of the set opened.
2013-01-20 12:49:34 +01:00
Allan Odgaard
ee44735a88 Don’t re-use scratch document for already open documents 2013-01-20 12:49:34 +01:00
Allan Odgaard
cd40111b91 Skip modified tabs when opening with “close other” 2013-01-20 12:49:34 +01:00
Allan Odgaard
46d870c5ca Let DocumentController provide SCM scopes 2013-01-20 12:49:33 +01:00
Allan Odgaard
61b01c89f8 Use scm variables API 2013-01-20 12:49:33 +01:00
Allan Odgaard
92685ecf07 Use C++11 for-loop instead of macro 2013-01-20 12:49:33 +01:00
Allan Odgaard
6c05cae8ed Use std::inserter helper function 2013-01-20 12:49:32 +01:00
Allan Odgaard
686f9eadb1 Allow slashes in path string on find clipboard (⌘T) 2013-01-18 15:45:43 +01:00
Allan Odgaard
29638a948d Switch to reworked file chooser 2013-01-18 15:45:43 +01:00
Allan Odgaard
a2a3bf96b5 Enable ‘Go → Reload’ when text view is focused
Previously would only work if focus was in the file browser.

Issue #674.
2013-01-16 04:42:51 +01:00
Allan Odgaard
2e43970d05 Don’t ask to save untitled documents during quit
This is only if there are no other documents with unsaved changes and the user has ‘open documents from last session’ enabled in preferences.

The rationale behind only offering it for untitled documents is that we can be sure that these will not be modified by another program while TextMate is not running. It also seems to be less valuable to have TextMate keep unsaved changes to a file that exist on disk, in fact, it’s a pretty bad behavior IMHO (and dangerous if other programs may work on the file).
2013-01-16 04:42:51 +01:00
Allan Odgaard
3835b55a55 Fix resize constraints for file browser / HTML output
These were set to ‘NSLayoutPriorityRequired-1’ which is higher than the window’s size constraints, meaning that resizing the window would not allow shrinking the file browser (or HTML output) views, furthermore, by making the views larger (when dragging the divider) the growth would not be constrained by the current window size, so it was possible to make the window grow with it.

The priority is now the proper NSLayoutPriorityDragThatCannotResizeWindow.
2013-01-16 04:42:51 +01:00
Allan Odgaard
2d8d393878 Close excess tabs when tab bar overflows 2013-01-16 04:42:50 +01:00
Allan Odgaard
f984664921 Add recursion guard to mouseDown:
It’s not clear to me how we end up calling ourself, but I see (stack overflow) crash reports that has mouseDown: interspersed with forwardMethod.
2013-01-16 04:42:50 +01:00
Allan Odgaard
b1dc3fce66 Fix missing variables for windowless commands 2013-01-13 11:56:08 +01:00
Allan Odgaard
44e760a7d9 Improve support for full screen mode
When opening a new window we ignore windows in full screen or on another space when searching for a window we can cascade to.

Full screen status of a window is restored after a relaunch and the bigger frame (when in full screen mode) is not stored in the session data or user defaults (as it should not be used).

Closes issue #667.
2013-01-13 11:56:07 +01:00
Allan Odgaard
4b369e3bf1 Close HTML output view when using exit_discard
This was also done by TextMate 1.x.
2013-01-13 11:56:07 +01:00
Allan Odgaard
0d8ade2687 Insignificant stylistic change 2013-01-13 11:56:06 +01:00
Allan Odgaard
59ff33fc5b Insert file browser into responder chain
This is required to have the object respond to various action methods such as cut:, copy:, paste:, and delete: — ideally though the class would handle it by itself, as OFB responsibility is bleeding into the document controller (though long-term I think it makes sense to instead let the document controller implement the OFB action methods).
2013-01-12 13:09:19 +01:00
Allan Odgaard
5e291d8a22 Improve QuickLook support
Preview can now be initiated with multiple items and while the preview panel is showing, one can use arrow up/down to switch to other items (in the file browser).
2013-01-12 13:09:19 +01:00
Allan Odgaard
be1cfeb458 Improve file browser API
We now expose the root URL and allows mutating it.

We also provide the selectURL:withParentURL: method instead of the two showURL: and revealURL:.
2013-01-12 13:09:19 +01:00
Allan Odgaard
10ef2f1034 Rename property (location → path) 2013-01-12 13:09:18 +01:00
Allan Odgaard
a9745164c7 Exclude backups from document::find by default 2013-01-12 13:09:16 +01:00
Allan Odgaard
d8bec5b761 Fix bad memory access
We wrote to instance data after potentially having been released.
2013-01-11 23:23:40 +01:00
Allan Odgaard
a545598e78 fixup! Iterate controllers instead of all window delegates 2013-01-10 21:03:29 +01:00
Allan Odgaard
9f02e86e00 Cap document array index 2013-01-10 21:03:29 +01:00
Allan Odgaard
abab5d8725 Make openItems:closingOtherTabs: more robust 2013-01-10 21:03:29 +01:00
Allan Odgaard
4a97f6e64d Save All with more than one document would crash 2013-01-10 21:03:29 +01:00
Allan Odgaard
80c358f947 Remove unnecessary hack
The issue this code solved was that setting the proxy icon via represented file before a file actually exists on disk would lead to no icon so we would have to update it again after a successful save.

This however is already done (by the save callback passed in).
2013-01-10 21:03:28 +01:00
Allan Odgaard
81b05711f0 Improve how we find window for new documents
We first search for a window containing one of the documents we wish to open, then for the window with a best match for project folder (for any of our documents), then check if frontmost window is a scratch window, and if none of the above gives a candidate, we create a new window (and give it a project folder based on the document(s) we opened).
2013-01-10 06:46:44 +01:00
Allan Odgaard
bccaee4be6 Simplify document open API
Removed the ability to specify wether documents should open in current window or a new window — all documents opened via this API will go through the same algorithm to find where the documents should end up (more choice is just adding confusion and complexity).
2013-01-10 06:46:44 +01:00
Allan Odgaard
d8cc115a5e Ensure we have a document in showWindow:
Also move (back) to using DocumentController instead of document::show().
2013-01-10 06:46:44 +01:00
Allan Odgaard
759b7d1ae5 Introduce ui_proxy_t::show_browser 2013-01-10 06:46:44 +01:00
Allan Odgaard
7b6515169f Remove unnecessary stuff
This includes the OakFilterWindow factory method as ‘new’ is just as good (now that ARC automatically autoreleases).
2013-01-10 06:46:44 +01:00
Allan Odgaard
211acb8a84 Use proper (specialized) type instead of ‘id’ 2013-01-10 06:46:43 +01:00
Allan Odgaard
cd124ac404 Iterate controllers instead of all window delegates 2013-01-10 06:46:43 +01:00
Allan Odgaard
531e8a44f1 Handle app termination in class method
It didn’t really make sense as an instance method since it iterate all instances, and we also want to execute code incase of no instances (save that fact as session data).
2013-01-10 06:46:43 +01:00
Allan Odgaard
a7a633f993 Remove procedural API for load/save of session
Since everything about session is now contained in the DocumentController class there is no need for invoking this from elsewhere and thus no need for the previous indirection.
2013-01-10 06:46:43 +01:00
Allan Odgaard
082ef43b0d Use Objective-C types in session read/write code
With the new compiler support for property list types it might be time to phase out the plist_t C++ wrapper.
2013-01-10 06:46:43 +01:00
Allan Odgaard
874520f49a Remove need for explicitly calling ‘monitor_controller’
Instead we register the class (causing a retain) when setting the object’s identifier (to a non-nil value).

This is a much better design as it (again) makes it safe to just instantiate a document controller w/o going through a special factory method. Additionally it makes it safe to change the identifier of an already created (and registered) instance.
2013-01-10 06:40:03 +01:00
Allan Odgaard
738456dbc7 Only let DocumentController schedule session saves 2013-01-10 06:40:03 +01:00
Allan Odgaard
362bf74fd9 Provide fallback search folder for non-project windows 2013-01-09 06:48:03 +01:00
Allan Odgaard
03398ed9e6 Insignificant source file touchup 2013-01-09 06:48:03 +01:00
Allan Odgaard
494c836217 Add (unused) code to prune tab bar 2013-01-09 06:48:02 +01:00
Allan Odgaard
6d46ba5363 Disable Go → Project Folder when unavailable 2013-01-09 06:48:02 +01:00