Skip to content

Commit

Permalink
Fix toolbar icons for Big Sur
Browse files Browse the repository at this point in the history
  • Loading branch information
greimers committed Nov 17, 2020
1 parent ed2e79c commit 80866eb
Show file tree
Hide file tree
Showing 9 changed files with 85 additions and 69 deletions.
8 changes: 5 additions & 3 deletions Source/Tincta.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
archiveVersion = 1;
classes = {
};
objectVersion = 52;
objectVersion = 54;
objects = {

/* Begin PBXBuildFile section */
Expand Down Expand Up @@ -570,7 +570,7 @@
isa = PBXProject;
attributes = {
CLASSPREFIX = TC;
LastUpgradeCheck = 1130;
LastUpgradeCheck = 1220;
ORGANIZATIONNAME = "Coding Friends UG";
TargetAttributes = {
95F1D01819AFA3C70022EA99 = {
Expand All @@ -590,7 +590,7 @@
};
};
buildConfigurationList = 95A5CF071358922D008CA186 /* Build configuration list for PBXProject "Tincta" */;
compatibilityVersion = "Xcode 11.0";
compatibilityVersion = "Xcode 12.0";
developmentRegion = English;
hasScannedForEncodings = 0;
knownRegions = (
Expand Down Expand Up @@ -743,6 +743,7 @@
CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;
CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES;
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
CLANG_WARN_STRICT_PROTOTYPES = YES;
CLANG_WARN_SUSPICIOUS_MOVE = YES;
Expand Down Expand Up @@ -795,6 +796,7 @@
CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;
CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES;
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
CLANG_WARN_STRICT_PROTOTYPES = YES;
CLANG_WARN_SUSPICIOUS_MOVE = YES;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "1130"
LastUpgradeVersion = "1220"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
Expand All @@ -17,7 +17,7 @@
BlueprintIdentifier = "95F1D01819AFA3C70022EA99"
BuildableName = "Tincta.app"
BlueprintName = "Tincta AppStore"
ReferencedContainer = "container:tincta.xcodeproj">
ReferencedContainer = "container:Tincta.xcodeproj">
</BuildableReference>
</BuildActionEntry>
</BuildActionEntries>
Expand All @@ -34,7 +34,7 @@
BlueprintIdentifier = "95F1D01819AFA3C70022EA99"
BuildableName = "Tincta.app"
BlueprintName = "Tincta AppStore"
ReferencedContainer = "container:tincta.xcodeproj">
ReferencedContainer = "container:Tincta.xcodeproj">
</BuildableReference>
</MacroExpansion>
<Testables>
Expand All @@ -57,7 +57,7 @@
BlueprintIdentifier = "95F1D01819AFA3C70022EA99"
BuildableName = "Tincta.app"
BlueprintName = "Tincta AppStore"
ReferencedContainer = "container:tincta.xcodeproj">
ReferencedContainer = "container:Tincta.xcodeproj">
</BuildableReference>
</BuildableProductRunnable>
<EnvironmentVariables>
Expand All @@ -81,7 +81,7 @@
BlueprintIdentifier = "95F1D01819AFA3C70022EA99"
BuildableName = "Tincta.app"
BlueprintName = "Tincta AppStore"
ReferencedContainer = "container:tincta.xcodeproj">
ReferencedContainer = "container:Tincta.xcodeproj">
</BuildableReference>
</BuildableProductRunnable>
</ProfileAction>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "1130"
LastUpgradeVersion = "1220"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
Expand All @@ -20,7 +20,7 @@
BlueprintIdentifier = "C6FE65F81898617100CC3019"
BuildableName = "Tincta Tests.xctest"
BlueprintName = "Tincta Tests"
ReferencedContainer = "container:tincta.xcodeproj">
ReferencedContainer = "container:Tincta.xcodeproj">
</BuildableReference>
</TestableReference>
</Testables>
Expand Down
2 changes: 2 additions & 0 deletions Source/Tincta/Credits.html
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@
<b>Attribution:</b>
<br><p>Solarized color profile: Copyright (c) 2011 Ethan Schoonover</p>
<br>
<p>Toolbar icons from <a href="https://iconmonstr.com/">iconmonstr</a></p>
<br>
<p>Many thanks also to Futurice and the <a href="https://spiceprogram.org/">Spice Program</a>.</p>
<br>
<br>
Expand Down
44 changes: 12 additions & 32 deletions Source/Tincta/MainMenu.xib
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="17132" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES">
<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="17506" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES">
<dependencies>
<deployment version="1080" identifier="macosx"/>
<plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="17132"/>
<plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="17506"/>
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
</dependencies>
<objects>
Expand Down Expand Up @@ -592,10 +592,8 @@
<toolbarItem implicitItemIdentifier="NSToolbarFlexibleSpaceItem" id="542"/>
<toolbarItem implicitItemIdentifier="NSToolbarSpaceItem" id="541"/>
<toolbarItem implicitItemIdentifier="NSToolbarSeparatorItem" id="995"/>
<toolbarItem implicitItemIdentifier="011F5E33-6C49-4564-9FDF-A10DEFA69638" label="Preferences" paletteLabel="Preferences" id="DtR-Cw-Qiy">
<toolbarItem implicitItemIdentifier="011F5E33-6C49-4564-9FDF-A10DEFA69638" label="Preferences" paletteLabel="Preferences" sizingBehavior="auto" id="DtR-Cw-Qiy">
<nil key="toolTip"/>
<size key="minSize" width="32" height="24"/>
<size key="maxSize" width="32" height="32"/>
<button key="view" verticalHuggingPriority="750" id="oxO-6D-98L">
<rect key="frame" x="19" y="14" width="32" height="24"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
Expand All @@ -608,10 +606,8 @@
<action selector="showPreferences:" target="544" id="E9q-Ev-bvH"/>
</connections>
</toolbarItem>
<toolbarItem implicitItemIdentifier="EC5A41AE-5D82-4BB7-BA53-803DBF4A8C39" label="New" paletteLabel="New" id="Gmf-xg-eAF">
<toolbarItem implicitItemIdentifier="EC5A41AE-5D82-4BB7-BA53-803DBF4A8C39" label="New" paletteLabel="New" sizingBehavior="auto" id="Gmf-xg-eAF">
<nil key="toolTip"/>
<size key="minSize" width="32" height="24"/>
<size key="maxSize" width="32" height="32"/>
<button key="view" verticalHuggingPriority="750" id="Byh-LU-1uH">
<rect key="frame" x="0.0" y="14" width="32" height="24"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
Expand All @@ -624,10 +620,8 @@
<action selector="newFile:" target="544" id="XKE-cy-yjX"/>
</connections>
</toolbarItem>
<toolbarItem implicitItemIdentifier="1A081BF2-D439-42FB-9BDC-396FB075DEFD" label="Open" paletteLabel="Open" id="wOK-Zz-3cO">
<toolbarItem implicitItemIdentifier="1A081BF2-D439-42FB-9BDC-396FB075DEFD" label="Open" paletteLabel="Open" sizingBehavior="auto" id="wOK-Zz-3cO">
<nil key="toolTip"/>
<size key="minSize" width="32" height="24"/>
<size key="maxSize" width="32" height="32"/>
<button key="view" verticalHuggingPriority="750" id="txr-rp-Uo0">
<rect key="frame" x="2" y="14" width="32" height="24"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
Expand All @@ -640,10 +634,8 @@
<action selector="open:" target="544" id="ULV-2k-VfJ"/>
</connections>
</toolbarItem>
<toolbarItem implicitItemIdentifier="BF165A0F-6331-4D00-BB7E-A7A71FEDB21C" label="Save" paletteLabel="Save" id="z5O-69-wgv">
<toolbarItem implicitItemIdentifier="BF165A0F-6331-4D00-BB7E-A7A71FEDB21C" label="Save" paletteLabel="Save" sizingBehavior="auto" id="z5O-69-wgv">
<nil key="toolTip"/>
<size key="minSize" width="32" height="24"/>
<size key="maxSize" width="32" height="32"/>
<button key="view" verticalHuggingPriority="750" id="aJn-9t-etz">
<rect key="frame" x="1" y="14" width="32" height="24"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
Expand All @@ -656,10 +648,8 @@
<action selector="save:" target="544" id="AjP-9c-5cK"/>
</connections>
</toolbarItem>
<toolbarItem implicitItemIdentifier="E0980E4A-2CD4-4ACC-854A-791547DE7B9E" label="Close" paletteLabel="Close" id="4uA-nu-qqa">
<toolbarItem implicitItemIdentifier="E0980E4A-2CD4-4ACC-854A-791547DE7B9E" label="Close" paletteLabel="Close" sizingBehavior="auto" id="4uA-nu-qqa">
<nil key="toolTip"/>
<size key="minSize" width="32" height="24"/>
<size key="maxSize" width="32" height="32"/>
<button key="view" verticalHuggingPriority="750" id="5Yb-qV-hoj">
<rect key="frame" x="3" y="14" width="32" height="24"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
Expand All @@ -672,10 +662,8 @@
<action selector="closeFile:" target="544" id="ayk-1P-SbU"/>
</connections>
</toolbarItem>
<toolbarItem implicitItemIdentifier="65B9C739-8515-46B5-92AF-96D4AAD30CAE" label="Print" paletteLabel="Print" id="eOI-gK-dCL">
<toolbarItem implicitItemIdentifier="65B9C739-8515-46B5-92AF-96D4AAD30CAE" label="Print" paletteLabel="Print" sizingBehavior="auto" id="eOI-gK-dCL">
<nil key="toolTip"/>
<size key="minSize" width="32" height="24"/>
<size key="maxSize" width="32" height="32"/>
<button key="view" verticalHuggingPriority="750" id="kw7-0k-Imk">
<rect key="frame" x="0.0" y="14" width="32" height="24"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
Expand All @@ -688,10 +676,8 @@
<action selector="print:" target="561" id="L4d-kW-3kS"/>
</connections>
</toolbarItem>
<toolbarItem implicitItemIdentifier="0A1EDE26-9F03-4A06-AEE4-A21F66AFFAE7" label="Open in Browser" paletteLabel="Open in Browser" id="lOZ-06-KVI">
<toolbarItem implicitItemIdentifier="0A1EDE26-9F03-4A06-AEE4-A21F66AFFAE7" label="Open in Browser" paletteLabel="Open in Browser" sizingBehavior="auto" id="lOZ-06-KVI">
<nil key="toolTip"/>
<size key="minSize" width="32" height="24"/>
<size key="maxSize" width="32" height="32"/>
<button key="view" verticalHuggingPriority="750" id="6Vn-il-5TG">
<rect key="frame" x="31" y="14" width="32" height="24"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
Expand All @@ -704,10 +690,8 @@
<action selector="openInBrowser:" target="544" id="9h1-iz-hvh"/>
</connections>
</toolbarItem>
<toolbarItem implicitItemIdentifier="B261C29C-38A3-4DB1-834F-09EEE9F90893" label="Search" paletteLabel="Search" id="rMl-g6-qD8">
<toolbarItem implicitItemIdentifier="B261C29C-38A3-4DB1-834F-09EEE9F90893" label="Search" paletteLabel="Search" sizingBehavior="auto" id="rMl-g6-qD8">
<nil key="toolTip"/>
<size key="minSize" width="32" height="24"/>
<size key="maxSize" width="32" height="32"/>
<button key="view" verticalHuggingPriority="750" id="hMX-Ks-kEO">
<rect key="frame" x="6" y="14" width="32" height="24"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
Expand All @@ -720,10 +704,8 @@
<action selector="searchForSelection:" target="889" id="Eav-3s-01k"/>
</connections>
</toolbarItem>
<toolbarItem implicitItemIdentifier="5B92227A-F231-4EFE-BD96-0AD3C0D3C7F6" label="Toggle Case" paletteLabel="Toggle Case" id="U3x-9W-F63">
<toolbarItem implicitItemIdentifier="5B92227A-F231-4EFE-BD96-0AD3C0D3C7F6" label="Toggle Case" paletteLabel="Toggle Case" sizingBehavior="auto" id="U3x-9W-F63">
<nil key="toolTip"/>
<size key="minSize" width="32" height="24"/>
<size key="maxSize" width="32" height="32"/>
<button key="view" verticalHuggingPriority="750" id="sJV-oB-O7F">
<rect key="frame" x="20" y="14" width="32" height="24"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
Expand All @@ -736,10 +718,8 @@
<action selector="toggleCaseForSelection:" target="561" id="5uT-v5-stl"/>
</connections>
</toolbarItem>
<toolbarItem implicitItemIdentifier="9E863747-A3E7-4A80-B5C2-89FC5808A179" label="Invisibles" paletteLabel="Invisibles" id="KjY-k2-GdD">
<toolbarItem implicitItemIdentifier="9E863747-A3E7-4A80-B5C2-89FC5808A179" label="Invisibles" paletteLabel="Invisibles" sizingBehavior="auto" id="KjY-k2-GdD">
<nil key="toolTip"/>
<size key="minSize" width="32" height="24"/>
<size key="maxSize" width="32" height="32"/>
<button key="view" verticalHuggingPriority="750" id="krD-Et-bBi">
<rect key="frame" x="12" y="14" width="32" height="24"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
Expand Down
1 change: 0 additions & 1 deletion Source/Tincta/MainWindowController.h
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,6 @@
- (void) alertDidEnd:(NSAlert *)alert returnCode:(NSInteger)returnCode contextInfo:(void *)contextInfo;
- (void) updateStatusText;
- (void) addRecentItem: (NSURL*) anUrl;
- (void) setToolbarItemColor;

- (void) textDidChange: (NSNotification*) aNotification;
- (void) textViewDidChangeSelection:(NSNotification *)aNotification;
Expand Down
47 changes: 30 additions & 17 deletions Source/Tincta/MainWindowController.m
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,9 @@ - (void)awakeFromNib {


NSFont* iconFont = [NSFont fontWithName:@"iconmonstr-iconic-font" size:18];
if (iconFont == nil) {
NSLog(@"🚨 IconMonstr Font Not Found");
}
[self.toolbarSearchItemCell setFont: iconFont];
[self.toolbarNewItemCell setFont: iconFont];
[self.toolbarOpenItemCell setFont: iconFont];
Expand All @@ -68,9 +71,15 @@ - (void)awakeFromNib {
[self.toolbarOpenBrowserItemCell setFont: iconFont];
[self.toolbarPrintItemCell setFont: iconFont];

if (@available(macOS 10.16, *)) {
NSColor* iconColor = [NSColor colorNamed:@"Toolbar Color"];

// These just use text. Sizes are deliberately different
[self.toolbarToggleCaseItemCell setFont: [NSFont systemFontOfSize:21]];
[self.toolbarInvisiblesItemCell setFont: [NSFont systemFontOfSize:22]];

NSColor* iconColor = [NSColor darkGrayColor];
if (@available(macOS 10.13, *)) {
iconColor = [NSColor colorNamed:@"Toolbar Color"];
}
if (@available(macOS 10.14, *)) {
[self.toolbarSearchItemCell setContentTintColor: iconColor];
[self.toolbarNewItemCell setContentTintColor: iconColor];
[self.toolbarOpenItemCell setContentTintColor: iconColor];
Expand All @@ -82,22 +91,26 @@ - (void)awakeFromNib {
[self.toolbarInvisiblesItemCell setContentTintColor: iconColor];
[self.toolbarToggleCaseItemCell setContentTintColor: iconColor];
}


// These just use text. Sizes are deliberately different
[self.toolbarToggleCaseItemCell setFont: [NSFont systemFontOfSize:21]];
[self.toolbarInvisiblesItemCell setFont: [NSFont systemFontOfSize:22]];


[self.toolbarSearchItemCell setTitle:[NSString stringWithFormat: @"%C", 0xe07a]];
[self.toolbarNewItemCell setTitle:[NSString stringWithFormat: @"%C", 0xe072]];
[self.toolbarOpenItemCell setTitle:[NSString stringWithFormat: @"%C", 0xe03a]];
[self.toolbarCloseItemCell setTitle:[NSString stringWithFormat: @"%C", 0xe08c]];
[self.toolbarSaveItemCell setTitle:[NSString stringWithFormat: @"%C", 0xe039]];
[self.toolbarPreferencesItemCell setTitle:[NSString stringWithFormat: @"%C", 0xe09c]];
[self.toolbarOpenBrowserItemCell setTitle:[NSString stringWithFormat: @"%C", 0xe0b0]];
[self.toolbarPrintItemCell setTitle:[NSString stringWithFormat: @"%C", 0xe016]];
// For Big Sur, setting the font and color above is not sufficient
// we actually need to set attributed strings
// probably the above is no longer necessary but we don't want to break it
// on older systems. So we rather set too much than too little.

// Set font icons
NSDictionary<NSAttributedStringKey, id>* attributes = @{NSFontAttributeName: iconFont, NSForegroundColorAttributeName: iconColor};
[self.toolbarSearchItemCell setAttributedTitle:[[NSAttributedString alloc] initWithString:@"\ue07a" attributes:attributes]];
[self.toolbarNewItemCell setAttributedTitle:[[NSAttributedString alloc] initWithString:@"\ue072" attributes:attributes]];
[self.toolbarOpenItemCell setAttributedTitle:[[NSAttributedString alloc] initWithString:@"\ue03a" attributes:attributes]];
[self.toolbarCloseItemCell setAttributedTitle:[[NSAttributedString alloc] initWithString:@"\ue08c" attributes:attributes]];
[self.toolbarSaveItemCell setAttributedTitle:[[NSAttributedString alloc] initWithString:@"\ue039" attributes:attributes]];
[self.toolbarPreferencesItemCell setAttributedTitle:[[NSAttributedString alloc] initWithString:@"\ue09c" attributes:attributes]];
[self.toolbarOpenBrowserItemCell setAttributedTitle:[[NSAttributedString alloc] initWithString:@"\ue0b0" attributes:attributes]];
[self.toolbarPrintItemCell setAttributedTitle:[[NSAttributedString alloc] initWithString:@"\ue016" attributes:attributes]];

// These just use text. Sizes are deliberately different
[self.toolbarToggleCaseItemCell setAttributedTitle:[[NSAttributedString alloc] initWithString:@"aA" attributes:@{NSFontAttributeName: [NSFont systemFontOfSize:21], NSForegroundColorAttributeName: iconColor}]];
[self.toolbarInvisiblesItemCell setAttributedTitle:[[NSAttributedString alloc] initWithString:@"" attributes:@{NSFontAttributeName: [NSFont systemFontOfSize:22], NSForegroundColorAttributeName: iconColor}]];

}

Expand Down
Loading

0 comments on commit 80866eb

Please sign in to comment.