Skip to content

Commit

Permalink
whitespace and dark mode
Browse files Browse the repository at this point in the history
  • Loading branch information
schriftgestalt committed Aug 22, 2019
1 parent cfc4e30 commit ed41176
Show file tree
Hide file tree
Showing 18 changed files with 420 additions and 348 deletions.
352 changes: 176 additions & 176 deletions BlueLocalization/Source/Framework/Model/Keys/BLKeyObject.m

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -51,53 +51,53 @@ @implementation BLDictionaryController

- (id)init
{
self = [super init];
self = [super init];

_dictionaries = [[NSMutableArray alloc] init];
_dictionaries = [[NSMutableArray alloc] init];
_documents = [[NSMutableArray alloc] init];
_keys = [[NSMutableArray alloc] init];
_keys = [[NSMutableArray alloc] init];
_useDocuments = NO;
__sharedDictionaryController = self;

[self loadSettings];
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(applicationWillTerminate:) name:NSApplicationWillTerminateNotification object:NSApp];
return self;
return self;
}

- (void)dealloc
{
__sharedDictionaryController = nil;
__sharedDictionaryController = nil;
}

+ (id)sharedInstance
{
if (!__sharedDictionaryController)
__sharedDictionaryController = [[self alloc] init];
return __sharedDictionaryController;
if (!__sharedDictionaryController)
__sharedDictionaryController = [[self alloc] init];
return __sharedDictionaryController;
}


#pragma mark - Persistent Settings

- (void)loadSettings
{
NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
[self registerDictionariesAtPathURLs: [defaults objectForKey: LTDictionaryControllerDictionaryURLsKey]];
[self setUseDocuments: [defaults boolForKey: LTDictionaryControllerUseDocumentsKey]];
NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
[self registerDictionariesAtPathURLs: [defaults objectForKey: LTDictionaryControllerDictionaryURLsKey]];
[self setUseDocuments: [defaults boolForKey: LTDictionaryControllerUseDocumentsKey]];
}

- (void)applicationWillTerminate:(NSNotification *)notification
{
NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];

[defaults setObject:[_dictionaries valueForKeyPath: @"fileURL.absoluteString"] forKey:LTDictionaryControllerDictionaryURLsKey];
[defaults setBool:[self useDocuments] forKey:LTDictionaryControllerUseDocumentsKey];
[defaults setObject:[_dictionaries valueForKeyPath: @"fileURL.absoluteString"] forKey:LTDictionaryControllerDictionaryURLsKey];
[defaults setBool:[self useDocuments] forKey:LTDictionaryControllerUseDocumentsKey];
}


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ - (void)drawInteriorWithFrame:(NSRect)cellFrame inView:(NSView *)controlView
NSRect target;

NSString *path = [[_document fileURL] path];
NSColor *altColor = ([self isHighlighted] && [[controlView window] firstResponder] == controlView && [[controlView window] isKeyWindow]) ? [NSColor whiteColor] : nil;
NSColor *altColor = ([self isHighlighted] && [[controlView window] firstResponder] == controlView && [[controlView window] isKeyWindow]) ? [NSColor textBackgroundColor] : nil;

// Contains dict?
BOOL containsDict = ([_document isKindOfClass: [BLLocalizerDocument class]] && [_document embeddedDictionary]);
Expand All @@ -41,7 +41,7 @@ - (void)drawInteriorWithFrame:(NSRect)cellFrame inView:(NSView *)controlView
[icon drawInRect:target fromRect:source operation:NSCompositeSourceOver fraction:1.0];

// Draw the file name
NSDictionary *attributes = [NSDictionary dictionaryWithObjectsAndKeys: [NSFont systemFontOfSize: 13], NSFontAttributeName, (altColor) ? altColor : [NSColor blackColor], NSForegroundColorAttributeName, nil];
NSDictionary *attributes = [NSDictionary dictionaryWithObjectsAndKeys: [NSFont systemFontOfSize: 13], NSFontAttributeName, (altColor) ? altColor : [NSColor textColor], NSForegroundColorAttributeName, nil];
target.origin = NSMakePoint(target.size.width + 6, 2 + cellFrame.origin.y);
target.size = NSMakeSize(cellFrame.size.width - target.origin.x - 150, 17);
[[[path lastPathComponent] stringByDeletingPathExtension] drawInRect:target withAttributes:attributes];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ - (void)drawWithFrame:(NSRect)cellFrame inView:(NSView *)controlView
[self setHighlighted: hightlighted];

// Delete mark
NSImage *delete = [self deleteImageWithColor: (![self isHighlighted]) ? [NSColor whiteColor] : [NSColor lightGrayColor]];
NSImage *delete = [self deleteImageWithColor: (![self isHighlighted]) ? [NSColor textBackgroundColor] : [NSColor lightGrayColor]];
NSRect fromRect = NSMakeRect(0, 0, [delete size].width, [delete size].height);

[delete drawInRect:[self deleteButtonFrame: cellFrame] fromRect:fromRect operation:NSCompositeSourceOver fraction:1];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,15 +28,15 @@ - (id)transformedValue:(id)value
BLObject *object;

if (![value isKindOfClass: [BLObject class]])
return [NSColor blackColor];
return [NSColor textColor];
object = (BLObject *)value;

if ([[object errors] count] > 0)
return [NSColor redColor];
else if ([object isKindOfClass: [BLBundleObject class]])
return [NSColor disabledControlTextColor];
else
return [NSColor blackColor];
return [NSColor textColor];
}

@end
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ - (void)drawInteriorWithFrame:(NSRect)cellFrame inView:(NSView *)controlView
// Label
NSDictionary *attributes = [NSDictionary dictionaryWithObjectsAndKeys:
[NSFont fontWithName:@"Helvetica Bold" size:10], NSFontAttributeName,
[NSColor whiteColor], NSForegroundColorAttributeName,
[NSColor textBackgroundColor], NSForegroundColorAttributeName,
nil];
rect.origin.x += 2;
rect.origin.y -= 1;
Expand Down
24 changes: 12 additions & 12 deletions LocInterface/Source/Framework/Panels/LIPreferences.m
Original file line number Diff line number Diff line change
Expand Up @@ -31,30 +31,30 @@ - (NSString *)windowNibName

- (id)init
{
self = [super init];
self = [super init];
if (self) {
self.openDocuments = [NSArray array];
self.selectedDocument = nil;

[self addObserver:self forKeyPath:@"openDocuments" options:NSKeyValueObservingOptionInitial|NSKeyValueObservingOptionPrior context:@"documents"];
}
return self;
return self;
}

- (void)dealloc
{
__sharedLIPreferences = nil;
__sharedLIPreferences = nil;
[query removeObserver:self forKeyPath:@"results"];
}

+ (id)sharedInstance
{
if (!__sharedLIPreferences)
__sharedLIPreferences = [[self alloc] init];
return __sharedLIPreferences;
if (!__sharedLIPreferences)
__sharedLIPreferences = [[self alloc] init];
return __sharedLIPreferences;
}


Expand All @@ -72,7 +72,7 @@ - (void)close

- (void)observeValueForKeyPath:(NSString *)keyPath ofObject:(id)object change:(NSDictionary *)change context:(void *)context
{
if (context == @"documents") {
if (context == @"documents") {
if (![self.openDocuments containsObject: self.selectedDocument]) {
if ([self.openDocuments count])
self.selectedDocument = [self.openDocuments objectAtIndex: 0];
Expand All @@ -81,11 +81,11 @@ - (void)observeValueForKeyPath:(NSString *)keyPath ofObject:(id)object change:(N
}
}
else if (context == @"toolPaths") {
if ([change objectForKey: NSKeyValueChangeNotificationIsPriorKey])
if ([change objectForKey: NSKeyValueChangeNotificationIsPriorKey])
[self willChangeValueForKey: @"availableDeveloperTools"];
else
[self didChangeValueForKey: @"availableDeveloperTools"];
}
}
else {
[super observeValueForKeyPath:keyPath ofObject:object change:change context:context];
}
Expand Down
46 changes: 23 additions & 23 deletions LocTools/Source/Framework/Matching/LTKeyMatch.m
Original file line number Diff line number Diff line change
Expand Up @@ -12,17 +12,17 @@ @implementation LTKeyMatch

- (id)initWithKeyObject:(BLKeyObject *)match matchPercentage:(float)percentage forTargetLanguage:(NSString *)language actualTargetLanguage:(NSString *)actualLanguage andMatchLanguage:(NSString *)matchLanguage
{
self = [super init];
self = [super init];
if (self) {
_actualTargetLanguage = actualLanguage;
_targetLanguage = language;
_object = match;
_percentage = percentage;
_matchLanguage = matchLanguage;
}
return self;
return self;
}


Expand All @@ -31,12 +31,12 @@ - (id)initWithKeyObject:(BLKeyObject *)match matchPercentage:(float)percentage f

- (BLKeyObject *)keyObject
{
return _object;
return _object;
}

- (float)matchPercentage
{
return _percentage;
return _percentage;
}

- (NSString *)targetLanguage
Expand All @@ -59,33 +59,33 @@ - (NSString *)matchLanguage

- (NSAttributedString *)percentageString
{
NSAttributedString *result;
NSColor *color;
if (_percentage == 1.0)
color = [NSColor colorWithDeviceRed:0 green:0.5 blue:0 alpha:1.0];
else if (_percentage >= 0.75)
color = [NSColor colorWithDeviceRed:0.9 green:0.6 blue:0 alpha:1.0];
else if (_percentage >= 0.5)
color = [NSColor colorWithDeviceRed:0.8 green:0 blue:0 alpha:1.0];
else
color = [NSColor blackColor];
result = [[NSAttributedString alloc] initWithString:[NSString stringWithFormat:@"%0.0f%%", 100*[self matchPercentage]]
NSAttributedString *result;
NSColor *color;
if (_percentage == 1.0)
color = [NSColor colorWithDeviceRed:0 green:0.5 blue:0 alpha:1.0];
else if (_percentage >= 0.75)
color = [NSColor colorWithDeviceRed:0.9 green:0.6 blue:0 alpha:1.0];
else if (_percentage >= 0.5)
color = [NSColor colorWithDeviceRed:0.8 green:0 blue:0 alpha:1.0];
else
color = [NSColor textColor];
result = [[NSAttributedString alloc] initWithString:[NSString stringWithFormat:@"%0.0f%%", 100*[self matchPercentage]]
attributes:[NSDictionary dictionaryWithObject:color forKey:NSForegroundColorAttributeName]];
return result;
return result;
}

- (NSString *)matchedValue
{
return [_object stringForLanguage: _matchLanguage];
return [_object stringForLanguage: _matchLanguage];
}

- (NSString *)targetValue
{
NSString *language = (_actualTargetLanguage) ? _actualTargetLanguage : _targetLanguage;
return [_object stringForLanguage: language];
return [_object stringForLanguage: language];
}


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ + (void)initialize
LTTranslationCheckerDefaultPlaceholders = [NSArray arrayWithObjects: @"%*@", @"^C", @"%*d", @"%*f", @"%*s", @"%c", @"%*x", @"%*i", @"%*u", nil];
LTTranslationCheckerIgnorePlaceholders = [NSArray arrayWithObjects: @"%%", @"%_", nil];

LTTranslationCheckerStringEndingCharacters = [NSArray arrayWithObjects: @":", @";", @".", @"", @"!", @"?", @")", @"]", @"}", @">", nil];
LTTranslationCheckerStringEndingCharacters = [NSArray arrayWithObjects: @":", @";", @".", @"", @"!", @"?", @")", @"]", @"}", @">", @"", nil];

LTTranslationCheckerWhitespaceReplacements = [NSDictionary dictionaryWithObjectsAndKeys: @"<return>", @"\n", @"<tab>", @"\t", @"<space>", @" ", nil];

Expand Down Expand Up @@ -249,7 +249,12 @@ + (NSArray *)getLineEndingErrorsFromOrginal:(NSString *)original andTranslation:
transWhitespace = [translated substringFromIndex: transEnd];
origEnding = [original substringWithRange: origRange];
transEnding = [translated substringWithRange: transRange];

if ([origEnding isEqualToString:@""]) {
origEnding = @".";
}
if ([transEnding isEqualToString:@""]) {
transEnding = @".";
}
if (![origEnding isEqual: transEnding]) {
description = [NSString stringWithFormat: NSLocalizedStringFromTableInBundle(@"Mismatching string ending", @"LTTranslationChecker", [NSBundle bundleForClass: [self class]], nil), origEnding, transEnding];
fix = [NSString stringWithFormat: @"%@%@%@", [translated substringToIndex: [translated length] - [transWhitespace length] - [transEnding length]], origEnding, transWhitespace];
Expand Down
4 changes: 2 additions & 2 deletions Localizer/Interface/English.lproj/Document.xib
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@
<rect key="frame" x="0.0" y="0.0" width="415" height="134"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<subviews>
<textView drawsBackground="NO" importsGraphics="NO" richText="NO" horizontallyResizable="YES" verticallyResizable="YES" fieldEditor="YES" findStyle="panel" continuousSpellChecking="YES" allowsUndo="YES" spellingCorrection="YES" grammarChecking="YES" smartInsertDelete="YES" id="447" customClass="StatisticsTextView">
<textView drawsBackground="NO" importsGraphics="NO" richText="NO" horizontallyResizable="YES" verticallyResizable="YES" findStyle="panel" continuousSpellChecking="YES" allowsUndo="YES" spellingCorrection="YES" grammarChecking="YES" smartInsertDelete="YES" id="447" customClass="StatisticsTextView">
<rect key="frame" x="0.0" y="0.0" width="128" height="134"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<color key="textColor" name="controlTextColor" catalog="System" colorSpace="catalog"/>
Expand Down Expand Up @@ -407,7 +407,7 @@
<rect key="frame" x="0.0" y="0.0" width="415" height="134"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<subviews>
<textView verticallyResizable="YES" usesFontPanel="YES" findStyle="panel" continuousSpellChecking="YES" usesRuler="YES" spellingCorrection="YES" grammarChecking="YES" smartInsertDelete="YES" id="444" customClass="StatisticsTextView">
<textView importsGraphics="NO" richText="NO" verticallyResizable="YES" usesFontPanel="YES" findStyle="panel" continuousSpellChecking="YES" allowsUndo="YES" usesRuler="YES" spellingCorrection="YES" grammarChecking="YES" smartInsertDelete="YES" id="444" customClass="StatisticsTextView">
<rect key="frame" x="0.0" y="0.0" width="26" height="134"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<color key="textColor" name="textColor" catalog="System" colorSpace="catalog"/>
Expand Down
12 changes: 10 additions & 2 deletions Localizer/Localizer.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
archiveVersion = 1;
classes = {
};
objectVersion = 46;
objectVersion = 51;
objects = {

/* Begin PBXBuildFile section */
Expand Down Expand Up @@ -37,6 +37,7 @@
50C3D1A60FC37A32005AEF1A /* Sparkle.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 50C3D1A50FC37A32005AEF1A /* Sparkle.framework */; };
50C3D1A70FC37A3D005AEF1A /* Sparkle.framework in CopyFiles */ = {isa = PBXBuildFile; fileRef = 50C3D1A50FC37A32005AEF1A /* Sparkle.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, ); }; };
50C3D25C0FC37D40005AEF1A /* dsa_pub.pem in Resources */ = {isa = PBXBuildFile; fileRef = 50C3D25B0FC37D40005AEF1A /* dsa_pub.pem */; };
56320E74230EA988002A5878 /* GSStringToAttributedValueTransformer.m in Sources */ = {isa = PBXBuildFile; fileRef = 56320E73230EA988002A5878 /* GSStringToAttributedValueTransformer.m */; };
56370B451D42136B0024CD02 /* GSGroupView.m in Sources */ = {isa = PBXBuildFile; fileRef = 56370B441D42136B0024CD02 /* GSGroupView.m */; };
56370B481D4221700024CD02 /* GSLine.m in Sources */ = {isa = PBXBuildFile; fileRef = 56370B471D4221700024CD02 /* GSLine.m */; };
565DBF2F1D42066C000513F0 /* Cocoa.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 565DBF2E1D42066C000513F0 /* Cocoa.framework */; };
Expand Down Expand Up @@ -99,6 +100,8 @@
50C3D18E0FC3792D005AEF1A /* loc.icns */ = {isa = PBXFileReference; lastKnownFileType = image.icns; name = loc.icns; path = ../Shared/Icons/loc.icns; sourceTree = SOURCE_ROOT; };
50C3D1A50FC37A32005AEF1A /* Sparkle.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Sparkle.framework; path = ../Shared/Frameworks/Sparkle.framework; sourceTree = SOURCE_ROOT; };
50C3D25B0FC37D40005AEF1A /* dsa_pub.pem */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; name = dsa_pub.pem; path = ../Shared/Updates/dsa_pub.pem; sourceTree = SOURCE_ROOT; };
56320E72230EA988002A5878 /* GSStringToAttributedValueTransformer.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = GSStringToAttributedValueTransformer.h; sourceTree = "<group>"; };
56320E73230EA988002A5878 /* GSStringToAttributedValueTransformer.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = GSStringToAttributedValueTransformer.m; sourceTree = "<group>"; };
56370B431D42136B0024CD02 /* GSGroupView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = GSGroupView.h; sourceTree = "<group>"; };
56370B441D42136B0024CD02 /* GSGroupView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = GSGroupView.m; sourceTree = "<group>"; };
56370B461D4221700024CD02 /* GSLine.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = GSLine.h; sourceTree = "<group>"; };
Expand Down Expand Up @@ -241,6 +244,8 @@
50E8D89D08CDBF71003F43C3 /* Interface */ = {
isa = PBXGroup;
children = (
56320E72230EA988002A5878 /* GSStringToAttributedValueTransformer.h */,
56320E73230EA988002A5878 /* GSStringToAttributedValueTransformer.m */,
50BB659D10B5C61A00A1AD4C /* StatisticsTextView.h */,
50BB659E10B5C61A00A1AD4C /* StatisticsTextView.m */,
56370B431D42136B0024CD02 /* GSGroupView.h */,
Expand Down Expand Up @@ -290,7 +295,7 @@
};
};
buildConfigurationList = 501EBC8B0855AE8600FBC27B /* Build configuration list for PBXProject "Localizer" */;
compatibilityVersion = "Xcode 3.2";
compatibilityVersion = "Xcode 10.0";
developmentRegion = English;
hasScannedForEncodings = 1;
knownRegions = (
Expand Down Expand Up @@ -344,6 +349,7 @@
50BB659F10B5C61A00A1AD4C /* StatisticsTextView.m in Sources */,
5056659F1384161300E8AB31 /* Preferences.m in Sources */,
50172E111403AA7E006EFC17 /* NSAlert-Extensions.m in Sources */,
56320E74230EA988002A5878 /* GSStringToAttributedValueTransformer.m in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
Expand Down Expand Up @@ -407,6 +413,7 @@
CODE_SIGN_STYLE = Manual;
COMBINE_HIDPI_IMAGES = YES;
COPY_PHASE_STRIP = NO;
DEVELOPMENT_TEAM = X2L8375ZQ7;
FRAMEWORK_SEARCH_PATHS = "\"$(SRCROOT)/../Shared/Frameworks\"";
GCC_C_LANGUAGE_STANDARD = gnu99;
GCC_OPTIMIZATION_LEVEL = 0;
Expand All @@ -429,6 +436,7 @@
COMBINE_HIDPI_IMAGES = YES;
COPY_PHASE_STRIP = NO;
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
DEVELOPMENT_TEAM = X2L8375ZQ7;
FRAMEWORK_SEARCH_PATHS = "\"$(SRCROOT)/../Shared/Frameworks\"";
GCC_C_LANGUAGE_STANDARD = gnu99;
GCC_PRECOMPILE_PREFIX_HEADER = YES;
Expand Down
Loading

0 comments on commit ed41176

Please sign in to comment.