Commit Graph

163 Commits

Author SHA1 Message Date
Allan Odgaard
9c42d1ae9f Moving focus to file browser now select first item
This is only when using the special Navigate → Move Focus to File Browser (⌥⌘⇥) command and is mainly because there is no other visual feedback (other than the text view being rendered in its inactive state).

I could see sometimes not wanting a selection in the file browser, this however seems like a general problem (i.e. the solution should likely be to introduce a way to “deselect all”).
2013-02-08 13:55:09 +01:00
Allan Odgaard
9eb4044fdb Switch to simpler regexp::search 2013-02-08 11:20:35 +01:00
Allan Odgaard
001888c1cb Close Other no longer closes untitled but modified tabs
We would previously bring up an “Do you want to keep unsaved changes?” sheet for these, so no convenience (i.e. batch closing several modified tabs) is really lost (on the contrary).
2013-02-08 11:20:34 +01:00
Allan Odgaard
cafb518be8 fixup! Fix infinite loop for documents outside project folder 2013-02-06 18:24:50 +01:00
Allan Odgaard
fbb2f972f9 Don’t mark parent views as opaque
The reason for this is that NSTextField will draw itself in the “faded” state (for non-key windows) unless some of its parent views are marked opaque.

The previous problem with not having the parent views opaque (see da3a91a7bb) seems to have been solved by setting the autohidesScrollers property to YES.
2013-02-06 14:50:04 +01:00
Allan Odgaard
642b009ec9 Add to existing content view instead of replacing it
The window border drawing seems to be done by the root content view so it’s best to keep it around (as it may also do other things that we are unaware of).
2013-02-06 14:50:04 +01:00
Allan Odgaard
6950ebee9a Ensure all methods can handle a missing document
This fixes a crash bug when menu validation is invoked before the controller has set up a document. Hardening the other methods is just a precaution (as we generally shouldn’t make assumptions about the state of public properties.
2013-02-06 14:50:03 +01:00
Allan Odgaard
ebdb8c9364 Directly read a few instance variables
This is instead of going through ‘self’ and was done to harmonize the code. Since two of the three variables are C++ types we cannot use dot syntax (self.property) when we wish to call a member function on the result, but using [self property] is ugly and would require us to then also use [self setProperty:value] (for consistency), hence why I went with direct access.

Since the selectedTabIndex property is closely related to documents and selectedDocument, I applied the same changes to this property.
2013-02-06 14:50:03 +01:00
Allan Odgaard
032cb19320 Use proper cursor image for output view right of text
Fixes #763.
2013-02-05 20:59:53 +01:00
Allan Odgaard
1fb7d8a6d3 Fix infinite loop for documents outside project folder
Fixes issue #557 (part two).
2013-02-05 15:26:31 +01:00
Allan Odgaard
521dd59f14 Don’t use automatic storage in threaded code 2013-02-03 10:48:35 +01:00
Allan Odgaard
151c800239 File icon images now default to ‘existing’ 2013-02-03 10:48:34 +01:00
Allan Odgaard
7e527bd861 When a file is selected, save folder defaults to its parent
This is only when saving untitled documents.

Closes #748.
2013-02-03 10:48:28 +01:00
Allan Odgaard
b51ed151d6 Auto-enable Back / Forward menu items 2013-02-03 10:48:26 +01:00
Allan Odgaard
8c43974265 Add (async) scope attribute collecting to DocumentController
This is for attr.project.XXX and attr.scm.XXX, although the latter is also provided by scm::info_t.

With this commit, the file::path_attributes function no longer collect this information.
2013-02-02 11:14:35 +01:00
Allan Odgaard
c4d6c624e8 Limit disk access done by DocumentController 2013-02-02 11:14:34 +01:00
Allan Odgaard
a470ee8ba8 SCM API: Update file chooser 2013-02-02 10:51:59 +01:00
Allan Odgaard
342152ea71 Remove light gray line above tabs 2013-01-30 18:55:30 +01:00
Allan Odgaard
da3a91a7bb Set root view to be opaque
The idea was that e.g. a status bar may wish to not be opaque and rely on the window’s border to shine through.

Unfortunately there is an issue where if the view is not opaque, the user can drag the entire window by clicking the scroll knobs (requires scrollbars to be configured to be visible and using a mouse, a trackpad doesn’t seem to cause the issue).
2013-01-30 16:55:33 +01:00
Allan Odgaard
0413f35eeb Rework symbol chooser code
The symbol chooser is now owned by DocumentView instead of DocumentController.

The symbol chooser does not know about its owner and is not an observer of any notifications. Instead it has a property for “document” and one for “selectionString”. It is the owners job to update these properties (i.e. when switching document or changing the selection).
2013-01-30 16:17:32 +01:00
Steven Clukey
33751cadf1 SymbolChooser references OakDocumentView instead document
Since a document cannot send notifications, this will allow the
SymbolChooser to monitor and respond to notifications from the
DocumentView.
2013-01-30 13:26:44 +01:00
Adam Strzelecki
08d8d69f2e Fixed occasional “too light” title bar gradient
This would mainly happen when creating new windows with a file browser.

Described at:
http://stackoverflow.com/questions/5812593/nswindow-textured-gradient-fill-weirdness
http://stackoverflow.com/questions/7795505/nswindow-textured-background-with-nstextfield/11482772#11482772
2013-01-30 13:26:09 +01:00
Allan Odgaard
a883854145 Use divider lines in root view
Previously we placed the views with a one point gap between them and had the superview fill the background. This works fine, but has the somewhat theoretical disadvantage that the superview then needs to implement drawRect: and for performance reasons declare that it is “opaque” which means subviews can’t use the (true) window background, should they want to.

Also add a preferences key for “tabs above document” (issue issue #214), but not hooked up in this commit.
2013-01-28 12:42:28 +01:00
Allan Odgaard
80b27f0b28 Add method for searching file browser folder 2013-01-28 12:42:27 +01:00
Allan Odgaard
4dccc12945 Add method to move focus to document or file browser 2013-01-28 12:42:27 +01:00
Allan Odgaard
61fd5d04df Position file chooser relative to text view
This is instead of placing it relative to the entire window. The main motivation is that with the file browser on the right, I want the file chooser closer to the left edge of the window.
2013-01-25 17:44:17 +01:00
Allan Odgaard
7a5294936c QuickLook preview panel now zooms in/out 2013-01-25 17:44:17 +01:00
Allan Odgaard
54eb357eb9 Opening folders is added to recent menu
This behavior was lost while reworking the document window class, closes #701.
2013-01-24 11:39:03 +01:00
Allan Odgaard
3026480a0d Clear file chooser filter string
Now that we re-use the window we need to manually clear the filter string (from last use).
2013-01-23 21:18:32 +01:00
Allan Odgaard
a67866ddb7 Provide singleton API for FileChooser
You can still create multiple instances, but would generally not want to.
2013-01-23 18:56: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