Commit Graph

4169 Commits

Author SHA1 Message Date
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
Allan Odgaard
13ef865561 Simplify layout code using NSLayoutFormatAlignAllTop 2018-11-17 11:35:40 +07:00
Allan Odgaard
f95c68475d Use systemFontSizeForControlSize: when changing button’s control size 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
36652c8afa Some changes for Find dialog’s status text on 10.14
The empty status text had a smaller fitting size than when it contained text, causing the UI to resize a few pixels. Fixed by setting the initial value of the button to a space.

The color of the text has been set to controlContentColor which is slightly dimmed (when used in this context), but which caused the text to be highlighted when clicked, even when there was no alternate title. Fixed by always setting the alternate title.

The size of the button is now set to a small button without making any font changes: This means the font is 12 point instead of 11 point, but with the slightly dimmed text color, I think this is appropriate.
2018-11-17 11:35:40 +07:00
Allan Odgaard
62e1c0e491 Use non-deprecated API to create property lists from data 2018-11-15 23:32:14 +07:00
Allan Odgaard
0df1795f27 Use isAccessibilityElement instead of accessibilityIsIgnored
The latter is deprecated starting with 10.10.
2018-11-15 23:10:25 +07:00
Allan Odgaard
ae0fc82f87 fixup! Use NSVisualEffectMaterialToolTip for tool tips on 10.14 2018-11-15 23:02:30 +07:00
Allan Odgaard
99f7aff714 Use BSD time functions instead of deprecated CFGregorianDate 2018-11-15 22:58:23 +07:00
Allan Odgaard
89404715f3 Tweak layout of action buttons in file browser
Avoid setting explicit size of the image buttons and do not stretch the buttons to full height, except for reload, as that image seems to use a different size as our other buttons, and therefor doesn’t align properly.
2018-11-15 16:42:55 +07:00
Allan Odgaard
1022be1548 Use NSButton/NSTextField convenience constructors on 10.12
The convenience constructors initializes several additional properties and should be future compatible.

It’s not ideal to have two code paths to construct the UI, but these helper functions should have stabilized by now and will soon be dropped, so this commit also serves to ensure that our UI works with the new convenience constructors.
2018-11-15 16:38:07 +07:00
Allan Odgaard
fe667ba01d Do not set button’s hugging priority in OakCreateButton
We generally do want buttons to hug their content, but as long as there is flexible space in the layout, they should act as desired, as the flexible will get the superfluousness width/height.

I checked several dialogs and found none that breaks with this change, presumably it was required for some layout that no longer exists.
2018-11-15 16:28:54 +07:00
Allan Odgaard
efde68385f Remove unnecessary property 2018-11-15 16:17:21 +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