Commit Graph

538 Commits

Author SHA1 Message Date
Allan Odgaard
0a772dabf1 Temporarily disable visual effects view used in file browser 2018-10-29 22:57:46 +07:00
Ian Gregory
9baff6d7e1 Selectively apply BG colors in OakSyntaxFormatter
OakSyntaxFormatter now applies background colors only when they do not match the theme's global background color. The old behavior drew the background all the time, which looked off when drawing formatted text in the Find History list. This effect is made especially apparent by macOS 10.14's translucent combo boxes, and now that they're used for history in the Find dialog, this needed to be fixed.
2018-10-29 21:15:18 +07:00
Allan Odgaard
c822943b93 Move OakFileBrowser delegate protocol and constants to new file browser 2018-10-28 13:15:39 +07:00
Ronald Wampler
b43abb13a6 Use a dynamic color for the dark divider style (10.14) 2018-10-28 12:13:39 +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
Ronald Wampler
3b90855b98 OakBackgroundFillView: Introduce styles for light and dark dividers 2018-10-28 11:07:03 +07:00
Allan Odgaard
581c201008 Remove most code related to old file browser 2018-10-28 10:15:56 +07:00
Allan Odgaard
4c63bb0983 Use NSCountedSet when constructing the Open With menu
Previously we used an NSDictionary with NSNumber objects as values, basically emulating a counted set.
2018-10-28 00:28:02 +07:00
Ronald Wampler
9049d995ed Introduce OAK_AVAILABLE macro
Newer versions of clang now warn when using API's that are only available on OS version newer than the target OS unless they are guarded using `@available`.

This is temporary and should be remove when we move away from older versions of Xcode.
2018-10-12 19:37:41 +02:00
Ronald Wampler
5aedfce3a1 Don't update our background style unless it changes
Also, always remove our background view before attempting to add another one.
2018-10-09 17:40:30 +02:00
Allan Odgaard
ef032c78a6 Enable visual effect view for status bar on 10.10 and forward 2018-10-07 11:28:52 +02:00
Allan Odgaard
d4e0f2e3b7 Inline helper methods used to setup NSVisualEffectView 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
e9bf48fbc0 Use controlTextColor (instead of blackColor) in a few places 2018-10-06 10:46:53 +02:00
Allan Odgaard
cae5eff55c Set a foreground color when styling is disabled (find text fields)
We remove all styles from the string, even when styling is disabled, as these styles could be from when styling was enabled, so we can’t trust them to be proper defaults.

However, a string with no styles will be rendered as black in the interface, rather than using the default text color for the interface, therefore we now explicitly set the string’s foreground color to be the control text color.
2018-10-05 09:23:19 +02:00
Allan Odgaard
14b00645ee Enable clipping for menu item text
The default is to wrap text, which could happen when installing a replacement font.

Specifically installing https://github.com/jenskutilek/FiraSystemFontReplacement shows a problem for menu items using ⌃⇧ in their shortcut key.

My theory is that the font lack these glyphs and font substitution can take them from different fonts, and thus, sometimes they would render as narrow, other times in regular width.

It appears that when we measure the string width, and use for the cell’s width, we get the narrow glyphs, but then when rendering the text, the wider glyphs are used, causing the text to overflow and thus wrap.
2018-08-06 21:20:06 +02:00
Allan Odgaard
051ffb68b3 Post a notification when mouse enters/leaves OakRolloverButton 2018-07-10 19:22:49 +02:00
Allan Odgaard
5ab8d4ea99 Remove OakFinderTag’s markedFavorite property 2018-07-08 20:34:21 +02:00
Allan Odgaard
c77d0270d2 Recreate favorite Finder tags on each method call
I changed the interface from class property to a method since a read-only property sort of implies that the value is constant.
2018-07-08 20:17:45 +02:00
Allan Odgaard
1b75fd9d27 Make OakFinderTag’s constructor and label property private 2018-07-08 20:05:22 +02:00
Allan Odgaard
6e18e1236b Add foreground/background color properties to OakFinderTag 2018-07-08 20:00:36 +02:00
Allan Odgaard
42fa47a2fd Remove path::tag_data and let finderTagsFromData: be private 2018-07-08 18:20:17 +02:00
Allan Odgaard
fef19f8465 Let FSItem create finderTags when requested
This does mean that we are taxing our main thread with disk access. This is mainly a problem for users who are using network mounted file systems, but it does provide better abstraction in the code, and should this turn out to be a performance issue, I think a better approach is to fetch the tags in a dispatch queue (initiated by FSItem), and then use KVC to update the property once the tags have been loaded, although ideally such system would use some sort of batching, so that we do not dispatch in each property accessor.

Could also have the background directory scanner set a boolean property to indicate if the item has tags, as most items do not, and in that case, we can bypass the disk access. But this then only does half the job of encapsulating how tags are stored.
2018-07-08 17:52:36 +02:00
Allan Odgaard
d6d47febfe Remove OakFinderLabelChooser 2018-07-08 17:17:32 +02:00
Allan Odgaard
ac92e1b040 Minor stylistic changes: Whitespace and put const after the type
The rationale behind the latter is for consistency with pointer declarations, e.g. we need to do `NSString* const kConstant = …` to indicate that the variable is a constant NSString pointer, so for this reason I prefer to also do `CGFloat const kConstant = …`

This commit can be merged into its parent.
2018-07-08 14:47:59 +02:00
Ronald Wampler
a31a985610 Add support for Finder tags instead of just one label color 2018-07-06 19:41:00 -04:00
Allan Odgaard
a34bba3523 Use light gray color for OakKeyEquivalentView’s frame
This is closer to what the system uses for borders, though still not an exact match.
2018-06-28 10:40:27 +02:00
Allan Odgaard
d16667d736 Add hardcoded baselineOffsetFromBottom to OakKeyEquivalentView 2018-06-28 10:40:27 +02:00
Allan Odgaard
b65490f711 Add missing left/right constraints for horizontal separator lines 2018-06-17 22:30:18 +02:00
Allan Odgaard
40a14995f6 Call fileSystemRepresentation directly on NSURL (10.9) 2018-06-17 17:14:47 +02:00
Allan Odgaard
e70791ee89 Rename a bunch of constants to fix deprecation warnings (10.12) 2018-06-16 22:55:30 +02:00
Allan Odgaard
87ad8f6559 Create main menu in our application delegate
The advantages are:

- More compatible with version control
- Easier to copy/paste menus and menu items between other projects
- Easier to setup menu delegates or obtain pointers to menu items
- We can use symbolic names when setting a menu item’s tag
- More transparent: We can read the declaration in a few minutes, use search, etc.

There are two disadvantage that I can think of:

1. We currently need to use private API to create the Open Recent submenu. Should this become a problem in a future macOS update, we can always create a single Open Recent menu in MainMenu.nib and use that when building our menu.

2. If you make a typo in the menu declaration then the compiler error will often just point to the first line of the declaration rather than the line with the incorrectly declared item. One can comment out sections to narrow it down, if many edits have been made since last compile.
2018-04-30 15:30:48 +07:00
Allan Odgaard
8ddfa9efe1 Identify Select Tab submenu by its menu title instead of pointer
This is an intermediary step to get rid of the outlets.
2018-04-30 15:30:48 +07:00
Allan Odgaard
677459aa22 Change behavior of shift page up/down sent to inactive table views
We now extend the selection to include the rows that we previously “jumped” over.
2018-04-25 22:28:33 +07:00
Allan Odgaard
8a0a50dad6 Consult table view’s delegate about which rows we can select 2018-04-25 22:07:50 +07:00
Allan Odgaard
4268b57605 Use OakNotEmptyString convenience function 2017-10-09 10:28:30 +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
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
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
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
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
07c29ff14c Avoid use of NSRunCriticalAlertPanel (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
Ronald Wampler
038acacca9 Avoid use of NSRunAlertPanel (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
Ronald Wampler
903d34338d Remove remaining 10.9 LEGACY markers 2017-05-31 10:03:41 +02:00
Ronald Wampler
42654ff283 Use appropriate enum case for NSSavePanel and NSOpenPanel result (10.9) 2017-05-31 10:03:41 +02:00
Ronald Wampler
043a00c934 Remove OakShowSheetForWindow wrapper (10.9)
Also removed `OakSheetCallbackDelegate` since it's no longer used now.
2017-05-31 10:03:41 +02:00