Commit Graph

728 Commits

Author SHA1 Message Date
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
0467ce6bb4 Make file chooser a floating panel
Also disable our “render as active” code for the table view when the window is not key.
2013-01-23 18:56:33 +01:00
Allan Odgaard
8e7de5e4ad Only underline matched characters
We now drawn the full string with same color and font.

Path shown in status bar is not marked up at all.
2013-01-23 18:56:32 +01:00
Allan Odgaard
f0f64ccde4 Change some default settings
- File browser placed on right.
- HTML output placed in new window.
- Theme set to Twilight.
2013-01-23 18:56:32 +01:00
Allan Odgaard
b1f9259cec Render table view as having focus 2013-01-23 13:44:51 +01:00
Allan Odgaard
127ef7e9eb Files with no extension open as plain text
This is instead of asking the user.
2013-01-23 12:36:48 +01:00
Allan Odgaard
49bb52c812 Improve scroll when selecting units
When selecting a unit (Edit → Select submenu or e.g. Find Next) then we only scroll if we can make the entire selection visible.

Closes #692.
2013-01-23 12:36:47 +01:00
Allan Odgaard
16da0b5d76 Don’t open documents with a path via UUID
The UUID is a unique reference to a document that trumps the path. However, as we don’t actually keep the documents in the file chooser, we end up with UUIDs from documents that does not exist, and should a new document be created for the same path, it will get another UUID.
2013-01-23 12:36:47 +01:00
Allan Odgaard
67ebb34f23 Fix unreliable tab switching keys
This was broken by 645f8d91e1.

The issue is that if the user press a key not in our managed menu, then the menu delegate will no longer be asked to update the menu for keys not in this (cached) menu.

Example: If there are items for ⌘1-3 in the menu and the user press ⌥⌘N a few times (to create more tabs), then the delegate is asked to update the menu on the first press, but as ⌥⌘N is not in the menu, successive events will not cause the menu to be updated. If the user then press ⌘5 (to go to the 5’th tab), nothing will happen, because our menu only holds 3 items, and the delegate is not asked to update the menu.
2013-01-23 12:36:47 +01:00
Michael Sheets
39ecb522d7 Improve layout and styling of Go to File window.
- Remove focus ring from search field as there is no second target.
- Set top and bottom border widths for the textured window.
- Remove miniaturize and zoom buttons for lack of utility.
- Match name of window to menu command.
- Various color and spacing tweaks.
2013-01-23 05:13:26 -06:00
Allan Odgaard
4f07b95556 Add scope bar to file chooser 2013-01-23 09:33:35 +01:00
Allan Odgaard
c8ab123aaf Move font name/size to theme_t
Since styles_for_scope effectively ignore the font parameters (and instead return styles based on the font parameters used when the cache entry was created) it is a better design to have theme_t own the font. This way, changing it can do the proper cache invalidation.

A minor downside is that we can now change the font of the theme without also changing the layout’s font, which wouldn’t cause proper layout invalidation — since layout_t owns theme_t though, users of a layout should always change font via layout_t (which will then change it in the theme).

Also, themes cannot be shared between views that wish to use different font settings.
2013-01-23 09:33:29 +01:00
Allan Odgaard
30c60ddc34 Accept scope_t instead of context_t
Since styles are applied to the actual content, we only have a single scope, not a left/right scope.
2013-01-23 08:19:39 +01:00
Allan Odgaard
aa71b7ccf0 Adhere to naming convention
Given constraint-based layouts, we’re more likely to create views in code, and as helper functions are often involved, it makes sense to name them so that we can quickly get a list of all helpers (via search), either for copy/paste or for evaluating wether or not it makes sense to move all helpers to a single library.

Since helpers are declared with static storage, they do not pollute the global namespace.
2013-01-23 08:19:39 +01:00
Joachim Mårtensson
2b51ca93bd Don’t use font name / size as key values in style cache
Font name and font size was being used in the cache key as a way to avoid having to do cache invalidation. This comes at a price of a 3X slow down. Instead clear the cache when font size/name changes. Excessive font name/size switching should be deterred IMO, why not with slowdowns? so no real downside. This does not affect themes setting font name/size, as they are handled by another mechanism.
2013-01-23 08:04:17 +01:00
Allan Odgaard
ef012c90f2 Add undo support to file browser
This closes #17.
2013-01-22 19:57:02 +01:00
Allan Odgaard
658c17023b Use menu validation instead of manual disabling items
This is required if some of the menu item targets are not ‘self’ as we do not know if these targets can handle the action method.
2013-01-22 19:56:18 +01:00
Allan Odgaard
f4c42bbd7a Fix double indent 2013-01-22 19:56:18 +01:00
Allan Odgaard
6ca780191b Remove undo/redo methods
This wasn’t functional (and not really in the responder chain).
2013-01-22 19:56:18 +01:00
Allan Odgaard
8cd45626ab Add OakFileManager
This is to be used with file actions done from the UI: Actions are undoable, proper dialogs will be shown for errors or to confirm permanent deletes on volumes without a trashcan (closes #589). Interface sounds will also be played (when moving, trashing, and duplicating items).

I decided not to use the asynchronous file system methods that NSWorkspace offer. Mainly because they can only be used for the initial operation, not during replay, as performing asynchronous operations during replay may cause issues if user moves quickly between items (something that seems to be an actual problem for Finder). The problem though only exist as long as we rely on NSUndoManager to manage the process.

Presently there is no API for batch operations, which leads to suboptimal action titles when performing multiple file system operations in the same undo group.
2013-01-22 19:37:14 +01:00
Allan Odgaard
5799a7c4c4 Add compatibility code for 10.7 2013-01-22 19:23:16 +01:00
Allan Odgaard
72b587e147 Account for strings with \0 characters
Previously we would truncate such strings.
2013-01-22 19:23:16 +01:00
Allan Odgaard
7c305f744f Delete old file chooser code 2013-01-22 19:23:15 +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
4590a77a71 Switch HTML output window back to NSWindow
The motivation for using a panel was to avoid the window from becoming main (so key equivalents would be sent to the document window, if not handled by the HTML output window). Unfortunately window ordering ignores non-main windows when a window is closed meaning that bringing up the Find dialog from an HTML output window and then closing it, would bring the current main window to front, eclipsing the HTML output window.
2013-01-22 10:15:29 +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
49a822c0d5 Remove instance data from header
Also add type-safety by introducing a protocol for the delegate.
2013-01-22 08:03:07 +01:00
Allan Odgaard
e7ada88e42 Minor tweak to file chooser UI 2013-01-21 15:03:52 +01:00
Allan Odgaard
d00b9b34aa Change how we update TextMate.app
We now keep the root folder and instead replace the inner Contents folder — hopefully this way LaunchServices won’t add the update as a new entry (causing duplicates to show up in the Open With menu).
2013-01-21 15:03:52 +01:00
Allan Odgaard
0208414672 Download s/w updates to cache folder
This should hopefully solve the issue with the (on some systems) fairly aggressive temp cleaner.

Also remove the archive incase the user cancels the update, now that we are extracting it to a less temporary location.
2013-01-21 15:03:52 +01:00
Allan Odgaard
b0c4363c48 Introduce path::cache
This gives the cache location — this one is not cleaned as often as the temp directory.
2013-01-21 15:03:52 +01:00
Allan Odgaard
c874a81246 Indicate cell prefersTrackingUntilMouseUp
Not really sure if there is any difference, but at least with this, the table view should expect trackMouse:inRect:ofView:untilMouseUp: to run a local event loop (until NSLeftMouseUp).
2013-01-21 15:03:52 +01:00
Michael Sheets
6970031245 Restyle navigation bar to be more in line with Lion.
- The shading is a combination of the scope bar and textured button used in Lion/Mountain Lion.
- Add an inactive state.
- Increase click area of the forward/back buttons while decreasing the image size.
- Switch popup menu cell to NSBackgroundStyleLight, previously the text would go to gray when inactive this prevents that though it does lose the drop shadow.
- Various tweaks to alignment and spacing.
2013-01-21 00:38:26 -06: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
cbe38c92ce Initialize encoding pop-up (Preferences)
Previously this would always show UTF-8 and cause an existing setting to be overwritten (with UTF-8) when bringing up the preferences window.
2013-01-21 05:54:28 +01:00
Allan Odgaard
564571ab8b Pass SCM info to file chooser 2013-01-20 12:49:35 +01:00
Allan Odgaard
a02305df2d Add ‘scmInfo’ property to file chooser
If set, the file chooser will use this to obtain file SCM status.
2013-01-20 12:49:35 +01:00
Allan Odgaard
98b19afcba Let file chooser setup OakFileIconImage
This makes it a lot faster as we don’t need to stat the files etc. Presently though there is no SCM badging.
2013-01-20 12:49:35 +01:00
Allan Odgaard
ba58611c66 Add API to OakFileIconImage
This allows manually setting up SCM status, link badge, and similar, which avoids having OakFileIconImage do any disk access.
2013-01-20 12:49:35 +01:00
Allan Odgaard
63d734295b Cache custom icon images
Also fix it so that a file named ‘gen_html’ doesn’t get the HTML icon (as we no longer use path::rank for finding the best icon).
2013-01-20 12:49:35 +01:00
Allan Odgaard
6bdf883abf fixup! Optimize path::disambiguate 2013-01-20 12:49:34 +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
fe3dff7af6 Replace custom code with kSelectionExtendToWord 2013-01-20 12:49:34 +01:00
Allan Odgaard
36e612930d Don’t setup variables in test proxy 2013-01-20 12:49:34 +01:00
Allan Odgaard
ec79163f30 Avoid editor_t::variables for getting selected text 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
340782dbc9 Update SCM variables with status 2013-01-20 12:49:33 +01:00