Commit Graph

4182 Commits

Author SHA1 Message Date
Allan Odgaard
5202dc34bd Revert "Let NSScrollView draw border above/below search results"
The scroll view’s border is black on 10.13.6 (and possibly earlier) which is undesired.

See https://lists.macromates.com/textmate/2018-December/040858.html

This reverts commit a0ac9c9a92.
2019-03-19 12:08:11 +07:00
Boris Dušek
85d3af94ba Implement "Symbols" accessibility rotor
Accessibility rotors allow VoiceOver user to navigate content quickly
by making possible navigation through select elements only.

In this case, we enable VoiceOver users to navigate efficiently
through symbols.

The first way to invoke a rotor is a "global" one (does not take into
account current position in text) and is invoked with VO-U. After
pressing arrow left/right sufficient times to reach "Symbols", one is
presented with a list analogical to the "Jump to symbols" TextMate
feature invokable by Shift-Cmd-T. Arrow up and down then enable
navigating through items, Return selects the result (and jumps to it),
Esc cancels the interface without moving the cursor. Also filtering
the list works by simply typing characters (implemented as
case-insensitive substring search - consistent e.g. with Safari's
"Headings" rotor).

The second way to use a rotor is a "local" one (navigates w.r.t. the
current position in text) and is typically done through Trackpad
Commander (turned on by VO + two finger "screw" gesture to the right
on the Trackpad). Then one uses two-finger "screw" gesture (like
(un)screwing the bottle lid from/to the bottle with thumb and index
finger) to select "Symbols". When this is finally selected (the
selection is persistent), the user can then use flick with one finger
up or down gestures to move to the previous/next occurrence respectively.

I made a choice at one spot - I report the "symbol location - end of
hardline" as the range of the symbol (that is e.g. what VoiceOver
reads when navigating the elements). This seemed to work best for the
user at least in the Objective-C code.

The APIs are 10.13+ only, so appropriate avaiability declarations are
put in place to not cause warnings from the compiler. I was not sure
whether some declaration like that is needed also for the
OakTextView's informal category's conformance to the
`NSAccessibilityCustomRotorItemSearchDelegate` protocol - the protocol
is 10.13+ only too, but the compiler does not warn about conforming to
it. Perhaps the Objective-C runtime is smart enough to take into
account that the `NSAccessibilityCustomRotorItemSearchDelegate` symbol
is (hopefully) weakly-linked and adds conformance to it (I assume
using the `class_addProtocol` function) only when it is non-nil. I
have however not tested whether the compiled app actually degrades
gracefully (without crashing) on macOS 10.12 and earlier, though (for
starters, I seem not to have access to a macOS Sierra image to create
a VM).
2019-02-21 14:46:19 +07:00
Allan Odgaard
97fb1f07cd Only use checkbox convenience constructor on 10.14 or later
The button created on 10.12 or 10.13 has a “Button” label next to it when used in table views (as used in the Find in Project results and Commit sheet).
2019-02-13 18:57:44 +07:00
Ronald Wampler
e0ddc61794 OakSyntaxFormatter: Clean up font attributes
See https://lists.macromates.com/textmate/2019-January/040883.html.

The issue is caused by commit f850dbdbc7, which added support for font style changes. It did so by applying a single font across the entire string. But, in some cases not all characters (e.g., Chinese or Japanese characters) may be available for that font so these characters would not be rendered correctly while editing.
2019-02-13 18:47:54 +07:00
Allan Odgaard
8e2ccd0dff Convenience constructor for labels appear to not use controlTextColor
Issue: https://lists.macromates.com/textmate/2018-December/040853.html
2018-12-07 12:55:47 +07:00
Allan Odgaard
56f073a8ef Associate search results with the current find delegate
This fixes the problem where a folder search has been done and the dialog is later re-opened for another project (which will then take ownership) and then selecting one of the old search results: The “select match” is now sent to the project that was active, when the search was performed.
2018-12-06 22:00:26 +07:00
Allan Odgaard
1a1a910c92 Introduce find dialog delegate instead of using project identifier 2018-12-06 22:00:22 +07:00
Allan Odgaard
b8017b9f22 Do not set NSBackgroundStyleRaised for controls and text in status bars
It appears to be ignored on 10.14 but earlier versions of macOS rendered the elements with a shadow, which is probably not a good fit for our current design.
2018-12-06 22:00:22 +07:00
Ronald Wampler
85a11ba0bf Check whether or not indexOfObject: returns NSNotFound 2018-12-06 21:59:32 +07:00
Allan Odgaard
a6e6437262 Set ‘accessibilityElement’ on NSControl’s cell object
An alternative to accessing the cell directly is using NSAccessibilityUnignoredDescendant to obtain the object, but while it seems to abstract away whether or not it is the control or its cell which participates in accessibility, we forego the type checker.
2018-12-05 21:16:54 +07:00
Allan Odgaard
5c2e646b3f Use fontAttributesInRange: instead of attributesAtIndex:effectiveRange:
Semantically this seems slightly more appropriate, and giving a range allows us to pass the strings length as the length of the range, instead of assuming that the string has a first character for which we can get attributes, although for an empty string, passing in a zero-length range *does* throw an exception, so we must only call this when we know the string is non-empty.
2018-12-05 21:16:54 +07:00
Allan Odgaard
fdc4dd3124 Do not request attributes for an empty NSAttributedString
This would throw an “out of bounds” exception.
2018-12-05 21:16:54 +07:00
Ronald Wampler
ca80254b80 Refactor finder tags to use catalog colors
Also, reworked the OFBFinderTagsChooser to have a similar look as on 10.14.
2018-12-05 21:16:54 +07:00
Allan Odgaard
fab38c6def Check whether or not indexOfObject: returns NSNotFound 2018-12-04 15:43:15 +07:00
Allan Odgaard
9e3b1d6028 Set wantsLayer to YES for all NSVisualEffectView subclasses
This is required when using NSVisualEffectBlendingModeWithinWindow although on macOS 10.13 and later a view is layer backed by default.
2018-12-04 15:43:15 +07:00
Boris Dušek
5ee17f2b0e Use new convenience accessibility APIs in OakTextView.mm 2018-12-04 15:40:25 +07:00
Boris Dušek
9ad976a4c0 Migrate OakTextView to new Accessibility API
macOS 10.10 SDK introduced new protocol-based accessibility APIs. The
old accessibility APIs are now deprecated. These APIs require a
minimum deployment target of 10.10, which is fulfilled since TextMate
2.0 rc 12.

Main changes connected with this new API is that it is statically
typed, so it is no longer necessary to convert parameters from (and
results to) NSValue objects.

Still some of the weakly-typed original APIs are not deprecated and
have no alternative in the new API, notably e.g. the
accessibilityArray* methods, so they are kept.
2018-12-04 15:40:25 +07:00
Allan Odgaard
dd77fcd6e1 Add one line of margin below tab views
At least on macOS 10.14 the auxiliary titlebar view is placed so that the bottom line of the view overlaps with the divider that separates the titlebar from the window content.

While the tab view background color is using alpha, the divider was still visible, but it didn’t look that good when using the light appearance.
2018-12-02 23:30:07 +07:00
Allan Odgaard
66b1eb906a Only skip updating to new layout when reloadData results in same layout
The problem with having the check in updateToLayout: is that the background view that extends to right window edge is not part of the layout, so while the width of this view may change when resizing the window, it would not result in a different layout.
2018-12-02 23:16:17 +07:00
Allan Odgaard
a1459bd135 Hide left border of first tab by placing it at X position -1 2018-12-02 23:15:13 +07:00
Allan Odgaard
dff0b6ed54 Always allow vertical scroll elasticity in text view 2018-12-02 18:08:38 +07:00
Allan Odgaard
f7eb32a83b New tool tip material was accidentally disabled in a previous commit
Commit in question: ae0fc82f87
2018-12-02 18:08:38 +07:00
Allan Odgaard
e9af090811 Make private function ‘static’ 2018-12-02 18:08:38 +07:00
Allan Odgaard
3df481aa36 Remove unnecessary import 2018-12-02 18:08:38 +07:00
Allan Odgaard
7030b0041e Update documents array and selected document inside animation group 2018-12-02 18:08:38 +07:00
Allan Odgaard
f92a50b59a Remove unused tab bar graphics 2018-12-02 18:08:38 +07:00
Allan Odgaard
f2d38e4e0f Update OakTabBarView to use title bar material for active tab 2018-12-02 18:08:38 +07:00
Allan Odgaard
f850dbdbc7 Support font style changes in OakSyntaxFormatter 2018-11-22 16:38:23 +07:00
Allan Odgaard
4eafd59374 Let OakSyntaxFormatter use OakTheme
As the latter supports catalog colors, the styled string should automatically work in both light and dark mode.
2018-11-22 16:38:23 +07:00
Allan Odgaard
db41b4b524 Add OakTheme: An Objective-C version of theme_t
This doesn’t do any caching of style lookups so performance is worse than theme_t and it also lacks an API to control the initial base font.

For now, the intention is to use this for system dialogs, such as the Find dialog, but long-term it should also be used by OakTextView, at which point, caching and base font support should be added.
2018-11-22 16:24:17 +07:00
Allan Odgaard
82de801d3e Add UUID for the macOS System Theme
Theme available here: e6e9185062
2018-11-22 16:24:17 +07:00
Allan Odgaard
42cdb1c430 Add URL escaping for the path component of SCM URLs 2018-11-22 16:24:17 +07:00
Allan Odgaard
60a3690bef Use NSPasteboard’s writeObjects: when copying items from file browser 2018-11-21 16:24:51 +07:00
Allan Odgaard
82593c8824 Use NSPasteboard’s writeObjects: when copying find in folder results
When requesting clipboard content using stringForType: then NSPasteboard will automatically join all strings using a newline character, so copied results will still paste as a “list” but applications that are aware of multiple pasteboard items could potentially do something different.
2018-11-21 16:24:51 +07:00
Allan Odgaard
892fc536f8 Move outlineView:writeItems:toPasteboard: to view controller 2018-11-21 16:24:51 +07:00
Allan Odgaard
aad3fdaca8 Implement outlineView:pasteboardWriterForItem: for file browser dragging
This is the “modern” API that supports multiple items on the clipboard and gives us a badge to show how many items are being dragged.

Though the default drag image does not resemble Finder nor does it seem to support flocking out of the box (where multiple items are collapsed into a single proxy image).
2018-11-21 16:24:51 +07:00
Allan Odgaard
19f15f97fc Use NSPasteboard’s writeObjects: for file browser’s service menu support 2018-11-21 16:24:51 +07:00
Allan Odgaard
942b962ce5 The gear shown for action pop-up buttons was clipped on 10.14
We wrap the button in view to clip some of the excessive left margin but on 10.14 the dimensions changed so we would also clip some of the gear.
2018-11-20 22:21:50 +07:00
Allan Odgaard
f244e223fd Rename a few menu items 2018-11-20 22:21:50 +07:00
Allan Odgaard
40f5e87aca Opening the Set Wrap Margin dialog would not have focus in text field 2018-11-20 22:21:50 +07:00
Allan Odgaard
432d6ba604 Use tertiaryLabelColor for disabled bundle items in bundle editor 2018-11-20 22:21:50 +07:00
Allan Odgaard
c21a6af60b Do not call SCM status callbacks when status changes from unknown → none
We ship with the “Update Gutter” command enabled by default which is causing a small delay when opening documents because bundle items are currently blocking the main thread.

This commit (together with the previous one) makes it so that we only call it when we have an assumption that it will actually update the gutter.
2018-11-19 11:48:20 +07:00
Allan Odgaard
f5605b1702 Reset SCM status when changing OakTextView’s document 2018-11-19 11:48:20 +07:00
Allan Odgaard
180dfb971f Make document window controller’s document array a read only property
This is because we may sometimes want to enable implicit animations when updating this property, by making it read-only we limit places from where it can be updated, to make it easier to audit the code.

Currently no-one outside the class actually uses the property, so we could (and may) make it private.
2018-11-19 09:42:33 +07:00
Allan Odgaard
79172d552e Set controlSize on NSControl instead of its cell 2018-11-17 20:20:55 +07:00
Allan Odgaard
ffba605cc1 Do not call abort for posix_spawn related failures
Based on crash reports, some of these functions do fail in practice, mainly due to “too many open file descriptors”, in which case we should let the io::spawn function fail, rather than crash the program.

The io::spawn function is used (amongst others) to update SCM status, so a failure is not always worth notifying the user about (beyond logging an error).
2018-11-17 11:35:40 +07:00
Allan Odgaard
01aa28cc82 Convert “count of items” font in filter dialogs to use monospaced digits 2018-11-17 11:35:40 +07:00
Allan Odgaard
f14da2a509 Convert font used for line number in status bar to use monospaced digits 2018-11-17 11:35:40 +07:00
Allan Odgaard
b6f9be7fae Introduce statusBarFontSize user defaults key and increase default size 2018-11-17 11:35:40 +07:00
Allan Odgaard
f2c42b0646 Do not limit width of “Tab Size” pop-up in status bar
Not sure why the width of this control has been limited as the content of the pop-up is somewhat fixed (unlike e.g. the grammar or symbol pop-ups, which can contain extremely wide entries).
2018-11-17 11:35:40 +07:00