Commit Graph

192 Commits

Author SHA1 Message Date
Allan Odgaard
ca0c72e0c0 Fix potential retain loop via document SCM callback
If we closed a window with a document SCM callback for the current document, but that document was untitled (so it wouldn’t be cleared during shutdown), we would keep ‘self’ retained.
2013-02-22 17:59:42 +01:00
Allan Odgaard
e974f165a2 Add newFolder: forwarding to document controller 2013-02-21 22:08:52 +01:00
Allan Odgaard
1f0a558adc Add performCloseAllTabs: action method
Closes #808.
2013-02-21 21:58:32 +01:00
Allan Odgaard
cbb0a7864d Drop ‘ng’ namespace for scm 2013-02-21 17:39:55 +01:00
Allan Odgaard
0d8ccd17f0 Exclude file browser width from new windows’ width
Closes #679.
2013-02-19 22:08:13 +01:00
Allan Odgaard
0bf5a85a1c Resize window when toggling file browser
If you dislike this it can be disabled using:

    defaults write com.macromates.TextMate.preview disableFileBrowserWindowResize -bool YES
2013-02-19 21:13:53 +01:00
Allan Odgaard
6c48d1d9d7 Always set variable for commands with requirements
Previously we would only set the variable if the command couldn’t be found via PATH. By always setting the variable, we remove redundancy from commands, as they can now rely on the variable instead of needing fallback code (to load via PATH).

The downside is that there are cases where a command may wish to know if the user explicitly set the variable, for example the Run command for Python will ignore the script’s shebang if the user explicitly set TM_PYTHON. As this command doesn’t use the requirement system, it’s not an actual problem. Should it want to specify the requirement, it can do so by using a variable like TM_PYTHON_AUTO and then in the locations array, set TM_PYTHON, this would allow the command to test if TM_PYTHON is set and if not, still have ‘python’ available via the TM_PYTHON_AUTO variable — although, should python not be found, the error dialog will tell the user to set TM_PYTHON_AUTO.

Issue #767
2013-02-18 21:55:59 +01:00
Allan Odgaard
274a658f6f Make encoding “hex view” wider
Since switching to Menlo the lines were being wrapped.
2013-02-18 15:38:26 +01:00
Allan Odgaard
72e54020e6 Add menu validation for Select Next / Previous Tab 2013-02-18 15:38:25 +01:00
Allan Odgaard
f3bf828b15 Edit → Select → None would crash with no file browser 2013-02-16 10:43:55 +01:00
Allan Odgaard
c031557df2 Add ‘New Document’ to file browser
This create a new file on disk and brings up the “rename” text field.

You can control the type/extension either in Preferences → New document type or by setting it in .tm_properties, e.g.:

    [ attr.untitled ]
    fileType = 'source.objc++'

New Document can be undone, but it is handled by deleting the file on disk and losing potential edits you have made since creating it.

Closes #161.
2013-02-15 15:27:57 +01:00
Allan Odgaard
fbf76bbd79 Update file browser when a document changes path
This is required incase the file is open, as we then want the new path to show the close button.
2013-02-15 15:27:56 +01:00
Allan Odgaard
4c96cb5258 Reject custom project directory if not an absolute path 2013-02-15 15:27:56 +01:00
Allan Odgaard
9f095a52bc Close files deleted via file browser
Files with changes are kept open and only files deleted via file browser actually close. It’ll make sense to also close files which are “moved to trash” (but want to do some refactoring before adding that).

Closes #512.
2013-02-15 15:27:55 +01:00
Michael Sheets
2bd089ffe5 Match HTML divider color with the status bar divider 2013-02-12 21:55:56 +01:00
Allan Odgaard
2588d57421 Change where we invalidate cursor rects
Maybe closes #783.
2013-02-12 11:09:24 +01:00
Allan Odgaard
26fe4a95e9 Add Edit → Select → None (⇧⌘A)
This can be used to deselect all in the file browser.

Closes #779.
2013-02-11 22:05:44 +01:00
Allan Odgaard
059a8a0b75 Improve Quick Look menu item title
This now also shows what it’ll display and switches to “Close Quick Look” when the panel is already showing.
2013-02-11 14:21:23 +01:00
Allan Odgaard
2acecd66f3 Show icon in Go to Tab sub menu 2013-02-11 14:21:21 +01:00
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
7d02a67870 Remove unused graphics 2013-01-25 11:01:57 +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