678 Commits

Author SHA1 Message Date
Allan Odgaard
4fbc9ee6ea Fix indentation (spaces → tabs) 2019-09-05 10:01:10 +02:00
Ronald Wampler
4820e876d2 Only allow navigating bookmarks in the touch bar
See https://lists.macromates.com/textmate/2019-August/041082.html
2019-09-05 09:59:44 +02:00
Allan Odgaard
774e66c009 Ignore ‘types’ in implementation of writeSelectionToPasteboard:types:
The issue is that the types requested may be ‘NSStringPboardType’ but that symbol is deprecated (starting with 10.14), yet the replacement (‘NSPasteboardTypeString’) is not string-equivalent, therefore our simple string comparison would fail.

This effectively broke services starting with 1ef78b3af7 (where we adopted the new symbols).

Implementation of validRequestorForSendType:returnType: does not appear to be a problem, as that method is called with both ‘NSStringPboardType’ and ‘NSPasteboardTypeString’.

Also switched to using NSPasteboard’s writeObjects: so we don’t have to explicitly deal with the type of the data we write to the pasteboard (presumably NSString will declare it using both the old and new type).
2019-08-02 21:03:39 +02:00
Allan Odgaard
8f685ff25c Use std::clamp instead of oak::cap (C++17) 2019-08-01 10:23:55 +02:00
Allan Odgaard
b176bf8f9a Use number formatter for count in Find All / Replace All status text
The Find dialog was already using number formatters, but the tool tips shown in the text view (when doing searches or replacements without going through the find dialog) were not.

This makes a difference when the count is > 999, as it will then format the number with thousand separators.
2019-07-14 11:26:31 +02:00
Allan Odgaard
066e020265 Ensure temporary std::string stays in scope when using its data 2019-07-13 11:02:25 +02:00
Allan Odgaard
8f3f3d9d16 Update deployment version for xibs to 10.12
This was done using search and replace. Presumably it should be done in Xcode so that it can adjust the xib for the new deployment target, otherwise what is the point of storing deployment version in the xib and provide it as a command line argument to the xib compiler as well (only to get a warning if the versions do not match)?
2019-07-07 18:03:30 +02:00
Ronald Wampler
d8db03c426 Add initial touch bar support for OakTextView
This adds buttons for inserting/removing bookmarks and navigate them.

Since the function keys were replaced with the touch bar, there currently is no other way to set and navigate bookmarks other than these buttons so make their visibility priority high.
2019-06-29 19:21:45 -04:00
Allan Odgaard
1ef78b3af7 Rename symbols to what’s expected by the 10.14 SDK 2019-06-29 20:14:15 +02:00
Allan Odgaard
5aa58e5543 Do not include $APP_NAME in framework’s bundle identifier
Since we have multiple application targets, it doesn’t make sense with a global APP_NAME variable.

Though if building the frameworks as standalone bundles and embedding them in different applications, we may need some sort of unique component in the bundle identifier, but we currently do not do this (they are all statically linked, so the Info.plist is currently unused).
2019-06-26 23:32:54 +02:00
Allan Odgaard
b5b36a558b Add missing framework dependencies 2019-06-26 13:21:11 +02: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
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
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
dff0b6ed54 Always allow vertical scroll elasticity in text view 2018-12-02 18:08:38 +07:00
Allan Odgaard
3df481aa36 Remove unnecessary import 2018-12-02 18:08:38 +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
40f5e87aca Opening the Set Wrap Margin dialog would not have focus in text field 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
f14da2a509 Convert font used for line number in status bar to use monospaced digits 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
Allan Odgaard
13ef865561 Simplify layout code using NSLayoutFormatAlignAllTop 2018-11-17 11:35:40 +07:00
Allan Odgaard
43c0352810 Move OakCreateStatusBarPopUpButton to OTVStatusBar.mm
No other status bar uses pop-up buttons and I don’t foresee them doing so.
2018-11-17 11:35:40 +07:00
Allan Odgaard
61c4b3d114 Use secondaryLabelColor for text in status bar
Apple has changed the style of borderless controls to use slightly dimmed text color, presumably to use the non-dimmed color when being pressed.

To match this we use the secondaryLabelColor for text, but ideally we should find a solution that does not rely on assumptions about the text color used by the controls.
2018-11-15 16:13:04 +07:00
Allan Odgaard
930619d6e7 Make NSVisualEffectView the superview of our status bars
The result is the same though with the NSVisualEffectView being a superview, a subview can query the interiorBackgroundStyle to affect rendering.
2018-11-15 12:58:06 +07:00
Allan Odgaard
7f794f618d Remove drawRect: overload as we no longer change contentBorderThickness 2018-11-15 12:58:06 +07:00
Allan Odgaard
7c52308785 Use systemRedColor instead of redColor (10.10) 2018-11-15 11:31:14 +07:00
Allan Odgaard
5b686f66e8 Set default light/dark themes when enabling changeThemeBasedOnAppearance 2018-11-06 20:01:34 +07:00
Ronald Wampler
cb5997717d Allow switching themes based on the effective appearance
The feature is currently not exposed via the UI.

To enable set the changeThemeBasedOnAppearance defaults key to YES and assign the darkModeThemeUUID and universalThemeUUID default keys with the desired theme uuids to use in dark or light mode, respectively.
2018-11-06 19:29:19 +07:00
Ronald Wampler
d5c929dfaf Move theme relate methods out of the status bar delegate section 2018-11-06 19:29:19 +07:00
Allan Odgaard
1e71ce0855 Use hypot function to calculate mouse drag distance
Also update the threshold from 1.0 to 2.5 pixels, as that was already used a few other places, and a single pixel’s threshold seems low.
2018-11-06 17:27:07 +07:00
Allan Odgaard
abcf28b517 Replace macro recording image with red (flat) circle 2018-11-05 19:16:24 +07:00
Allan Odgaard
a12db33d86 Update OakDocumentView to new accessibility API (10.10) 2018-11-05 19:16:24 +07:00
Allan Odgaard
14ae6019bf Update all instances of accessibilitySetOverrideValue:forAttribute: 2018-11-02 08:40:39 +07:00
Allan Odgaard
239b46ce66 Change symbol chooser’s document property to TMDocument
This is to avoid issues with AppKit when changing OakChooser to be a subclass of NSWindowController, as NSWindowController already has a document property and makes some assumptions about this.

I picked TMDocument over oakDocument only because I wasn’t sure how to capitalize the latter for getter/setter.
2018-11-02 08:30:55 +07:00
Allan Odgaard
bcda0d2774 Use visual effect view for snippet pop-up menu (10.11)
On 10.14 we use the “behind window” blending mode as we’d prefer the background to differ from that of the text view itself, though I am not seeing much of a difference here.
2018-11-01 15:39:33 +07:00
Allan Odgaard
3d829d6656 Make OakChoiceMenu an NSWindowController subclass 2018-11-01 15:23:48 +07:00
Allan Odgaard
2d0837aad5 Prefix instance variables with underscore in OakChoiceMenu 2018-11-01 15:21:17 +07:00
Allan Odgaard
48605ef4e9 The bundle selection menu now uses same appearance as the calling view
Only when there are no open windows, and the user is triggering the bundle item selection menu, will it default to the light aqua appearance.
2018-10-31 10:32:46 +07:00
Allan Odgaard
82de01589f Update deployment target of all xib files to 10.10 2018-10-30 13:46:34 +07:00
Allan Odgaard
8e31254f70 Store captures from last search with OakDocument instead of OakTextView
This both allows updating the captures from outside the text view (e.g. Find dialog) and it uses the correct captures if performing searches in multiple tabs with delayed replacements.
2018-10-29 11:48:44 +07:00
Ronald Wampler
e64b09b688 Introduce overloads for the new divider styles
Also, switch to use the new divider styles in most places. The remaining usage of the old "OakCreateLine" functions are in the OakChooser windows. These will be refactor for better dark mode support next.
2018-10-28 11:07:03 +07:00
Allan Odgaard
150c1d8b04 Remove unused instance variable. 2018-10-12 19:28:01 +02:00
Ronald Wampler
7938234060 Let LiveSearchView inherit from OakBackgroundFillView
Also set the style to `OakBackgroundFillViewStyleHeader`.
2018-10-07 11:28:52 +02:00
Ronald Wampler
9198c496b0 OakBackgroundFillView: Add support of Mojave Dark mode
This introduces the `OakBackgroundFillViewStyle` enum with styles that are dark mode aware and should lead to more consistent use between UI elements in the future. Also, convert OTVStatusBar and OFBHeaderView to use the new style enum.
2018-10-07 11:28:52 +02:00
Allan Odgaard
f6fa273912 Update coding style for where to place colon after dictionary keys
This follows the Swift style and also makes it possible to align dictionary values using TextMate’s Align Assignments command.
2018-10-07 09:54:45 +02:00
Allan Odgaard
e70791ee89 Rename a bunch of constants to fix deprecation warnings (10.12) 2018-06-16 22:55:30 +02:00