Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Fix some issues with Dark Mode on 10.14
  • Loading branch information
dmoagx committed Jul 4, 2018
1 parent e625224 commit d73e70d
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 25 deletions.
12 changes: 3 additions & 9 deletions Interfaces/English.lproj/UserManagerView.xib
Expand Up @@ -52,8 +52,8 @@
<scrollView borderType="none" autohidesScrollers="YES" horizontalLineScroll="20" horizontalPageScroll="10" verticalLineScroll="20" verticalPageScroll="10" usesPredominantAxisScrolling="NO" id="28">
<rect key="frame" x="0.0" y="23" width="177" height="483"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<clipView key="contentView" id="VfC-c0-tv4">
<rect key="frame" x="0.0" y="17" width="177" height="466"/>
<clipView key="contentView" drawsBackground="NO" id="VfC-c0-tv4">
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<subviews>
<outlineView focusRingType="none" verticalHuggingPriority="750" allowsExpansionToolTips="YES" columnAutoresizingStyle="lastColumnOnly" selectionHighlightStyle="sourceList" columnReordering="NO" multipleSelection="NO" autosaveColumns="NO" rowHeight="20" headerView="923" indentationPerLevel="14" autoresizesOutlineColumn="YES" outlineTableColumn="33" id="31" customClass="SPOutlineView">
Expand Down Expand Up @@ -93,7 +93,6 @@
</connections>
</outlineView>
</subviews>
<color key="backgroundColor" name="controlBackgroundColor" catalog="System" colorSpace="catalog"/>
</clipView>
<scroller key="horizontalScroller" hidden="YES" verticalHuggingPriority="750" controlSize="small" horizontal="YES" id="30">
<rect key="frame" x="0.0" y="473" width="183" height="11"/>
Expand Down Expand Up @@ -865,7 +864,7 @@ DQ
<rect key="frame" x="0.0" y="0.0" width="163" height="363"/>
<autoresizingMask key="autoresizingMask"/>
<size key="intercellSpacing" width="3" height="2"/>
<color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
<color key="backgroundColor" name="controlBackgroundColor" catalog="System" colorSpace="catalog"/>
<color key="gridColor" name="gridColor" catalog="System" colorSpace="catalog"/>
<tableColumns>
<tableColumn identifier="Schemas" editable="NO" width="160" minWidth="40" maxWidth="1000" id="750">
Expand All @@ -888,7 +887,6 @@ DQ
</connections>
</tableView>
</subviews>
<color key="backgroundColor" name="controlBackgroundColor" catalog="System" colorSpace="catalog"/>
</clipView>
<scroller key="horizontalScroller" hidden="YES" verticalHuggingPriority="750" controlSize="small" horizontal="YES" id="747">
<rect key="frame" x="1" y="369" width="109" height="11"/>
Expand Down Expand Up @@ -944,7 +942,6 @@ DQ
</connections>
</tableView>
</subviews>
<color key="backgroundColor" name="controlBackgroundColor" catalog="System" colorSpace="catalog"/>
</clipView>
<scroller key="horizontalScroller" hidden="YES" verticalHuggingPriority="750" controlSize="small" horizontal="YES" id="771">
<rect key="frame" x="1" y="369" width="109" height="11"/>
Expand All @@ -970,7 +967,7 @@ DQ
<rect key="frame" x="0.0" y="0.0" width="163" height="363"/>
<autoresizingMask key="autoresizingMask"/>
<size key="intercellSpacing" width="3" height="2"/>
<color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
<color key="backgroundColor" name="controlBackgroundColor" catalog="System" colorSpace="catalog"/>
<color key="gridColor" name="gridColor" catalog="System" colorSpace="catalog"/>
<tableColumns>
<tableColumn identifier="Available Privilige" editable="NO" width="160" minWidth="40" maxWidth="1000" id="780">
Expand Down Expand Up @@ -1000,7 +997,6 @@ DQ
</connections>
</tableView>
</subviews>
<color key="backgroundColor" name="controlBackgroundColor" catalog="System" colorSpace="catalog"/>
</clipView>
<scroller key="horizontalScroller" hidden="YES" verticalHuggingPriority="750" controlSize="small" horizontal="YES" id="778">
<rect key="frame" x="1" y="369" width="109" height="11"/>
Expand Down Expand Up @@ -1333,8 +1329,6 @@ Some changes may have already been applied; please review the errors below befor
<size key="minSize" width="405" height="115"/>
<size key="maxSize" width="463" height="10000000"/>
<color key="insertionPointColor" white="0.0" alpha="1" colorSpace="calibratedWhite"/>
<size key="minSize" width="405" height="115"/>
<size key="maxSize" width="463" height="10000000"/>
</textView>
</subviews>
<color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
Expand Down
5 changes: 3 additions & 2 deletions Source/SPCustomQuery.m
Expand Up @@ -2112,7 +2112,7 @@ - (void)tableView:(SPCopyTable *)aTableView willDisplayCell:(id)cell forTableCol
showCellAsGray = [resultData cellIsNullOrUnloadedAtRow:rowIndex column:columnIndex];
}

[cell setTextColor:showCellAsGray ? [NSColor lightGrayColor] : [NSColor blackColor]];
[cell setTextColor:showCellAsGray ? [NSColor lightGrayColor] : [NSColor controlTextColor]];
}
}

Expand Down Expand Up @@ -3403,7 +3403,8 @@ - (BOOL)control:(NSControl *)control textShouldBeginEditing:(NSText *)aFieldEdit
}

// Set editing color to black for NULL values while editing
[aFieldEditor setTextColor:[NSColor blackColor]];
// TODO: This method won't be called until the user actually starts typing. The tableView's willDisplayCell delegate call is the proper place to update this (see SPTableContent)
[aFieldEditor setTextColor:[NSColor controlTextColor]];

return shouldBeginEditing;
}
Expand Down
7 changes: 3 additions & 4 deletions Source/SPTableContent.h
Expand Up @@ -157,10 +157,9 @@ typedef NS_ENUM(NSInteger, SPTableContentFilterSource) {
NSString *kCellEditorErrorNoMultiTabDb;
NSString *kCellEditorErrorTooManyMatches;

NSColor *blackColor;
NSColor *lightGrayColor;
NSColor *blueColor;
NSColor *whiteColor;
NSColor *textForegroundColor;
NSColor *nullHighlightColor;
NSColor *binhexHighlightColor;

SPFieldEditorController *fieldEditor;

Expand Down
20 changes: 11 additions & 9 deletions Source/SPTableContent.m
Expand Up @@ -187,10 +187,9 @@ - (id)init

tableLoadTimer = nil;

blackColor = [NSColor blackColor];
lightGrayColor = [NSColor lightGrayColor];
blueColor = [NSColor blueColor];
whiteColor = [NSColor whiteColor];
textForegroundColor = [NSColor controlTextColor]; // this color dynamically adapts to the rest of the UI
nullHighlightColor = [NSColor lightGrayColor];
binhexHighlightColor = [NSColor blueColor];

kCellEditorErrorNoMatch = NSLocalizedString(@"Field is not editable. No matching record found.\nReload table, check the encoding, or try to add\na primary key field or more fields\nin the view declaration of '%@' to identify\nfield origin unambiguously.", @"Table Content result editing error - could not identify original row");
kCellEditorErrorNoMultiTabDb = NSLocalizedString(@"Field is not editable. Field has no or multiple table or database origin(s).",@"field is not editable due to no table/database");
Expand Down Expand Up @@ -4337,7 +4336,7 @@ - (void)tableView:(SPCopyTable *)tableView willDisplayCell:(id)cell forTableColu
if ([tableView editedColumn] != -1
&& [tableView editedRow] == rowIndex
&& (NSUInteger)[[NSArrayObjectAtIndex([tableView tableColumns], [tableView editedColumn]) identifier] integerValue] == columnIndex) {
[cell setTextColor:blackColor];
[cell setTextColor:textForegroundColor];
if (cellIsLinkCell) [cell setLinkActive:NO];
return;
}
Expand All @@ -4359,13 +4358,16 @@ - (void)tableView:(SPCopyTable *)tableView willDisplayCell:(id)cell forTableColu
}

if (cellIsNullOrUnloaded) {
[cell setTextColor:rowIndex == [tableContentView selectedRow] ? whiteColor : lightGrayColor];
[cell setTextColor:(rowIndex == [tableContentView selectedRow] ? textForegroundColor : nullHighlightColor)];
}
else {
[cell setTextColor:blackColor];
[cell setTextColor:textForegroundColor];

if ([self cellValueIsDisplayedAsHexForColumn:[[tableColumn identifier] integerValue]]) {
[cell setTextColor:rowIndex == [tableContentView selectedRow] ? whiteColor : blueColor];
if (
[self cellValueIsDisplayedAsHexForColumn:[[tableColumn identifier] integerValue]] &&
rowIndex != [tableContentView selectedRow]
) {
[cell setTextColor:binhexHighlightColor];
}
}

Expand Down
2 changes: 1 addition & 1 deletion Source/SPUserManager.m
Expand Up @@ -1597,7 +1597,7 @@ - (void)tableView:(NSTableView *)tableView willDisplayCell:(id)cell forTableColu
if ([schemaName isEqualToString:@""] || [schemaName isEqualToString:@"%"]) {
[cell setTextColor:[NSColor lightGrayColor]];
} else {
[cell setTextColor:[NSColor blackColor]];
[cell setTextColor:[NSColor controlTextColor]];
}

// If the schema has permissions set, highlight with a yellow background
Expand Down

0 comments on commit d73e70d

Please sign in to comment.