Commit Graph

204 Commits

Author SHA1 Message Date
Allan Odgaard
398e55cdbe Add helper functions to get OS version
We need this in a few places and while calling Gestalt() isn’t that much code, that function is deprecated in 10.8 and the alternative is a lot more code, so we don’t want to repeat that once we update the code.
2013-03-17 15:44:06 +01:00
Allan Odgaard
b0a0df831a Add ability to set project folder via file browser
For now it is done via a new menu item in the top folder pop-up. It might be useful to also show this menu item in the general action menu.
2013-03-16 17:49:49 +01:00
Allan Odgaard
b5eb83d383 Refactor code 2013-03-13 12:38:12 +01:00
Allan Odgaard
db5df4a58c Update Find window API 2013-03-13 12:37:22 +01:00
Allan Odgaard
cceff2cb99 Clear previous frame when switching side of file browser 2013-03-11 17:28:34 +01:00
Allan Odgaard
514f65bcb5 Improve window sizing when toggling file browser
The first time the browser is toggled, we’ll save the current frame so that we can restore it if the user toggles again (the calculated frame won’t match when window is moved or width is “truncated”).

Additionally when file browser is on the left side, we reframe the window so that the text view remains in the same place on the screen.

Closes #827.
2013-03-11 17:24:41 +01:00
Allan Odgaard
4a24d0ad58 Rework find dialog (part one)
This is work in progress but I don’t think any functionality is missing compared to previous commit, although some functionality might be less polished, e.g. the action buttons don’t properly enable/disable and the height of the results list gets lost when hiding it.

Some of the stuff that has changed / improved:

 * The find/replace text fields adjust their height to encompass the content (closes #94). Presently though the initial height of the ontrols is one line regardless of content (but they should adjust on first edit).
 * You can use Save All (⌥⌘S) to save affected files after Replace All (closes #558).
 * The key equivalents / actions available in the Find dialog is now easier to find via the action pop-up, which also has enables accessibility.
 * Using Next (⌘G) or Previous (⇧⌘G) with search results will move selection up/down.
 * Using Find All with ‘in’ set to ‘Selection’ will find and select all matches in the current document, which fixes #425, though it might be more desirable to show the results in the find dialog (like Find All does for a document or folder).
2013-03-07 10:50:19 +01:00
Allan Odgaard
ae15687db4 Move focus to document when closing split with focus
This applies to file browser and HTML output (when configured to be shown in the document window).

Closes #838.
2013-03-04 10:43:58 +01:00
Allan Odgaard
2c6504b82f Use symbolic constants for binding properties 2013-03-03 15:53:05 +01:00
Allan Odgaard
e8efb3638d Fix Go → Current Document with no project folder
We were creating an NSURL from the project folder which would throw an exception when the project folder was nil.
2013-03-01 22:03:58 +01:00
Allan Odgaard
5e6cfe8e1e The 10th tab now get ⌘0 as key equivalent 2013-02-27 21:05:09 +01:00
Allan Odgaard
c4323efbb7 Use path::is_child instead of custom code 2013-02-25 15:25:17 +01:00
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