Commit Graph

3859 Commits

Author SHA1 Message Date
Ronald Wampler
9f2eb76223 Explicitly close OakChoiceMenu
On 10.13, just setting our instance of OakChoiceMenu to `nil` no longer seem to close our window.
2018-02-06 17:08:03 +07:00
Allan Odgaard
75e8723e64 Specify ‘ns’ as a (link) dependency
See http://lists.macromates.com/textmate/2017-November/040458.html
2017-11-16 10:06:39 +07:00
Allan Odgaard
4080334609 Fix bug in CommonAncestor function
When all paths had the same prefix as first item, the first item would be returned as the common ancestor even if the other paths were not children.

For example:

    /path/to/some_folder
    /path/to/some_folder_with_same_prefix

Here `/path/to/some_folder` was returned even though `/path/to` is the common ancestor.

The function is still not correct when all paths are actual descendants of first path, but since it’s only used for display purposes, and with “find in folder” (where paths shouldn’t overlap), I am not bothering with that issue.
2017-10-09 10:31:44 +02:00
Allan Odgaard
4268b57605 Use OakNotEmptyString convenience function 2017-10-09 10:28:30 +02:00
Allan Odgaard
06bd8b2be0 Add a ‘didUpdateFrom’ argument when relaunching during software update 2017-10-08 20:17:43 +02:00
Allan Odgaard
a8b7906a4b Do not hardcode bundle identifier in Caches path 2017-10-08 20:12:14 +02:00
Allan Odgaard
6893bceae6 Accept application/json for version update information 2017-10-08 19:54:32 +02:00
Allan Odgaard
75d4c29f11 Change etag network filter to a general header (capture) filter 2017-10-08 09:19:49 +02:00
Allan Odgaard
81d1f84a2c Change sw_update.cc → sw_update.mm 2017-10-08 09:13:03 +02:00
Allan Odgaard
eead4102dc Do not require that _app_path is setup when calling relaunch 2017-10-08 09:00:32 +02:00
Allan Odgaard
c6e07fadf3 Accept additional application arguments for relaunch API
This allows us to indicate to the new instance why it was launched.
2017-10-08 08:53:12 +02:00
Allan Odgaard
503d493f47 Move OakTabBarView into its own framework
The motivation is to get an OakAppKit that does not include hundres of image resources.
2017-10-07 13:58:35 +02:00
Jake Kirshner
9f1cec343e Add basic touch-bar support 2017-10-03 21:56:54 +02:00
Allan Odgaard
f7f6444885 Only load charset (encoding) frequency database once
Previously this database was loaded each time a file of unknown encoding was read, which could add a significant overhead when using “find in folder” with a large database and many files with unknown encoding.
2017-10-03 09:43:43 +02:00
Allan Odgaard
7d38095532 Let EncodingWindowController accept NSData instead of char pointers 2017-10-03 09:43:43 +02:00
Allan Odgaard
2748e12699 Change encoding classifier language from C++ to Objective-C++ 2017-10-03 09:43:43 +02:00
Allan Odgaard
c57a70db83 Do not use NSOutlineView’s clickedRow for key events 2017-10-03 08:19:41 +02:00
Allan Odgaard
5fc61d0a34 Don’t use menuForEvent: when showing NSOutlineView’s menu using ⌥F2
The reason is that menuForEvent: will draw an outline around the items under the mouse, which can be incorrect when we use the keyboard.

While we can address it by creating a fake mouse event that points to the selection, this will fail when there is no selection, so I felt it was better to always forego it.
2017-10-03 08:18:05 +02:00
Allan Odgaard
5782569a1f Workaround for modified icons in the file chooser being pixelated
Comment also added to the source (since this workaround is not optimal, and I would like to find the correct solution):

If we use `self.size` for the off-screen image buffer then we get a scaled up 16×16 image in the file chooser (⌘T).

My theory is that when drawing the image, the image size is 16×16 but the graphics context uses a transformation so that each point is multiple pixels, which our off-screen image does not replicate.

I do not know how to get the actual “pixel size” of the destination, so using the largest image is a workaround and knowing the actual size could give a better result.
2017-10-02 20:53:05 +02:00
Allan Odgaard
ed6be1b35e Remove var-args constructor from string list transformer
Instead add constructor that takes a dictionary so that it can be used with values that are not consecutive and starting from zero.
2017-10-02 20:53:05 +02:00
Allan Odgaard
e804a57e04 Change name of property setter: isChecking → checking 2017-10-02 20:53:05 +02:00
Allan Odgaard
8d56ad455a Use NSBundle API instead of oak::application_t 2017-10-02 20:53:05 +02:00
Allan Odgaard
5bc450f56f Move instance variables from implementation to interface block 2017-10-02 20:53:05 +02:00
Allan Odgaard
239d5bc19f Add format string API that accepts lambda (callback) for variables 2017-10-02 20:53:05 +02:00
Allan Odgaard
f869f09b6c Remove obsolete friend declaration 2017-10-02 20:53:04 +02:00
Allan Odgaard
0b1496011f Use a lambda for format string variables 2017-10-02 20:53:04 +02:00
Allan Odgaard
47ccee4f36 Do not pass variables to run_command callback
The caller already has a copy of the environment variables so this was redundant.
2017-10-02 20:53:04 +02:00
Allan Odgaard
78e0546a59 Return variable value instead of iterator 2017-10-02 20:53:04 +02:00
Allan Odgaard
bc3e42330b Use nested visitor instead of swapping member variables 2017-10-02 20:53:04 +02:00
Allan Odgaard
107a56e12d Add some new format string transformations
- number: Show number with thousand separators, e.g. “32,351”
- relative: Show dates as relative to now, e.g. “3 minutes ago”
- duration: Show numbers as duration in seconds, e.g. “1 hour, 7 minutes”.
- dirname: Show all but last path component
- basename: Show last path component
- urlescape: Encode characters that are not valid to include in URLs
- shellescape: Wrap problematic strings in single quotes and/or escape single quote characters
2017-10-02 20:53:04 +02:00
Allan Odgaard
a0a15caa2a Introduce sdk-compat.h for redeclaring stuff in latest SDK
This is when we are not yet ready to require building with the latest SDK but need to use some of symbols defined there.
2017-09-12 20:43:52 +02:00
Allan Odgaard
ed91562780 Use encode::url_part instead of NSString’s deprecated API
While NSString does have a “modern” replacement, it seems simpler to use our own API because we are already dealing with a std::string.
2017-09-12 16:57:00 +02:00
Allan Odgaard
c5fd9d074d fixup! Remove OakShowSheetForWindow wrapper (10.9)
There were two issues:

1. The window’s sheetParent property is cleared when sending orderOut: to the window so the NSModalResponse was never passed on, as we were sending it to nil.

2. The endSheet:returnCode: was using NSModalResponseCancel but the completion handler was actually testing for NSModalResponseAbort
2017-09-12 16:57:00 +02:00
Allan Odgaard
f30ce91455 Use triangular bullet (‣) instead of black small triangle (▸)
We were already using the triangular bullet in a few places, so I made it consistent. Semantically the small triangle might be more appropriate, because we do not use the glyph as a point marker, but I think the triangular bullet aligns better with the text (it’s raised above the baseline where the triangle seems to just touch the baseline).
2017-09-12 16:57:00 +02:00
Allan Odgaard
212ef9b488 Update MASPreferences submodule: identifier → viewIdentifier 2017-09-12 16:57:00 +02:00
Allan Odgaard
353ae8839c Remove OakPasteboardSelector’s shouldSendAction property
This was used when the selector also functioned as the standalone pasteboard history UI.
2017-07-12 12:11:56 +02:00
Allan Odgaard
9c00277a46 Change two methods to use Objective-C properties 2017-07-12 11:54:59 +02:00
Allan Odgaard
5c853a7cb2 Handle the case where pasteboard selector returns “no selection” (-1)
This is based on a bug report which I have been unable to reproduce, as the pasteboard selector should always have one item selected.
2017-07-12 11:49:00 +02:00
Allan Odgaard
511e370b77 Change a few missing unsigned/int → NS[U]Integer
One API was declared as returning ‘unsigned’ but was actually returning a signed integer.
2017-07-12 11:37:15 +02:00
Allan Odgaard
ffd6271a69 Allow disabling TextMate’s JavaScript API for commands with HTML output
This is done by setting the ‘disableJavaScriptAPI’ key to ‘true’ in the tmCommand file.

The rationale behind this is that a command like “HTML → Show Preview” is using the HTML output view with user data which should not have access to the special TextMate JavaScript object, for example a user may have a `<script>` tag that loads JavaScript from a CDN, and such script would effectively have shell access to the user’s machine.
2017-07-12 10:35:31 +02:00
Ronald Wampler
c0fb320549 Fix issues with redundant qualified names
Starting in Clang 5, lookup with nested-class names is stricter (e.g., A::A now specifically refers to the constructor name).
2017-06-23 13:24:04 -04:00
Ronald Wampler
49cc123544 Change std::vector< std::pair<char const*, char const*> > to auto (C++17)
C++17 added a non-const overload for std::string::data().
2017-06-23 10:44:28 -04:00
Allan Odgaard
4d86258e47 Use new alert style enumeration names (10.12) 2017-05-31 21:58:31 +02:00
Ronald Wampler
08f41a37dc Add "Copy As Pathname" to file browser's context menu
This is implemented as an alternate menu item to "Copy" like in Finder.
2017-05-31 21:58:31 +02:00
Ronald Wampler
f3cd0b0797 Resolve ambiguous autolayout issues
Most of these layout changes are related to the common pattern we used to set constraints for "dividers", where one of the dividers is specified to be connected to both edges of its superview then setting the other dividers' constraints to have equal widths (e.g., @"H:|[divider(==divider2,==divider3)]"). On 10.12, this now appears to result in ambiguous layout. We can resolve it by connecting at least one of the edges for each divider to its superview.
2017-05-31 21:58:31 +02:00
Ronald Wampler
a124b494c2 Revert "Explicitly cast back to the CGEventFlags typedef"
This reverts commit 9e4e88ce76.

CGEventFlags is (correctly) defined in the 10.12 sdk as:

   typedef CF_OPTIONS(uint64_t, CGEventFlags)
2017-05-31 21:58:31 +02:00
Ronald Wampler
d1ecba2629 Use the FSRef API directly and delete fsref_t (10.9)
The textClipping file is saved as a binary plist on 10.11 and 10.12 (I could not verify 10.10) so we can eventually replace the use of FSRef here as well.
2017-05-31 21:58:31 +02:00
Ronald Wampler
a377b35bde Use OakMoveToTrash instead of FSMoveObjectToTrashSync (10.9) 2017-05-31 21:58:31 +02:00
Ronald Wampler
b9665fa44e Introduce OakMoveToTrash and make it accessible only to C++
This is just a C++ wrapper around the Cocoa API for moving a file to trash.
2017-05-31 21:58:31 +02:00
Ronald Wampler
b8143a626c Avoid use of NSRunInformationalAlertPanel (10.9)
Although this is actually deprecated in 10.10, new APIs are available in 10.9 and it will make addressing deprecation warnings when upgrading to 10.10 easier.
2017-05-31 21:58:31 +02:00