Skip to content

Commit

Permalink
Merge pull request #1341 from Sequel-Ace/change-default-font-to-menlo
Browse files Browse the repository at this point in the history
#changed Change default query editor font to Menlo to improve query editor performance
  • Loading branch information
Jason-Morcos committed Jan 4, 2022
2 parents 858f5d0 + bcbd8de commit b002cae
Show file tree
Hide file tree
Showing 8 changed files with 49 additions and 10 deletions.
Binary file added Resources/Fonts/Menlo.ttc
Binary file not shown.
2 changes: 2 additions & 0 deletions Resources/Plists/Info.plist
Expand Up @@ -330,6 +330,8 @@
</array>
<key>NSSupportsAutomaticGraphicsSwitching</key>
<true/>
<key>ATSApplicationFontsPath</key>
<string>Fonts</string>
<key>UTExportedTypeDeclarations</key>
<array>
<dict>
Expand Down
2 changes: 1 addition & 1 deletion Resources/Plists/PreferenceDefaults.plist
Expand Up @@ -72,7 +72,7 @@
<key>CustomQueryEditorCommentColor</key>
<data>BAtzdHJlYW10eXBlZIHoA4QBQISEhAdOU0NvbG9yAISECE5TT2JqZWN0AIWEAWMBhARmZmZmAIPp6Og+AAGG</data>
<key>CustomQueryEditorFont</key>
<data>BAtzdHJlYW10eXBlZIHoA4QBQISEhAZOU0ZvbnQehIQITlNPYmplY3QAhYQBaRiEBVsyNGNdBgAAAA4AAAD//k0AbwBuAGEAYwBvAAAAhAFmCoQBYwCYAZgAmACG</data>
<data>BAtzdHJlYW10eXBlZIHoA4QBQISEhAZOU0ZvbnQehIQITlNPYmplY3QAhYQBaSSEBVszNmNdBgAAABwAAAD//k0AZQBuAGwAbwAtAFIAZQBnAHUAbABhAHIAhAFmDoQBYwCYAZgAmACG</data>
<key>CustomQueryEditorHighlightQueryColor</key>
<data>BAtzdHJlYW10eXBlZIHoA4QBQISEhAdOU0NvbG9yAISECE5TT2JqZWN0AIWEAWMChARmZmZmgzMzcz+DMzNzP4MzM3M/AYY=</data>
<key>CustomQueryEditorNumericColor</key>
Expand Down
12 changes: 12 additions & 0 deletions Source/Controllers/Preferences/SPPreferencesUpgrade.m
Expand Up @@ -70,12 +70,24 @@ void SPApplyRevisionChanges(void)
return;
}

if (recordedVersionNumber < 20026) {
//Reset any users that have query editor font set to Monaco to the new default font (menlo) as this has better performance in the query editor
NSString *monocoFontBytes = @"040B73747265616D747970656481E803840140848484064E53466F6E741E8484084E534F626A65637400858401691884055B3234635D060000000E000000FFFE4D006F006E00610063006F0000008401660A8401630098019800980086";
NSData *prefFontValue = [prefs objectForKey:SPCustomQueryEditorFont];
if(prefFontValue && [[NSString rawByteStringWithData:prefFontValue] isEqualToString:monocoFontBytes]) {
[prefs removeObjectForKey:SPCustomQueryEditorFont];
SPLog(@"Reset query editor font setting to default");
}
}


// This is how you add release notes and run specific migration steps
if (recordedVersionNumber < 2061) {
[importantUpdateNotes addObject:NSLocalizedString(@"There is a new option in Preferences->Alerts & Logs: \"Show warning before executing a query\". When enabled, you will be prompted to confirm that you want to execute an SQL query or edit a row.", @"Short important release note for new option in Preferences->Alerts & Logs")];
}



// Display any important release notes, if any. Call this after a slight delay to prevent double help
// menus - see http://www.cocoabuilder.com/archive/cocoa/6200-two-help-menus-why.html .
[SPPreferencesUpgrade performSelector:@selector(showPostMigrationReleaseNotes:) withObject:importantUpdateNotes afterDelay:0.1];
Expand Down
8 changes: 0 additions & 8 deletions Source/Controllers/SPAppController.m
Expand Up @@ -134,14 +134,6 @@ + (void)initialize
// Register application defaults
[prefs registerDefaults:preferenceDefaults];

if ([prefs objectForKey:@"GlobalResultTableFont"]) {
NSFont *tableFont = [NSUnarchiver unarchiveObjectWithData:[prefs dataForKey:@"GlobalResultTableFont"]];
if (tableFont) {
[NSUserDefaults saveFont:tableFont];
}
[prefs removeObjectForKey:@"GlobalResultTableFont"];
}

// Upgrade prefs before any other parts of the app pick up on the values
SPApplyRevisionChanges();
}
Expand Down
Expand Up @@ -295,7 +295,7 @@ - (void)editWithObject:(id)data
NSFont *textEditorFont = [NSFont systemFontOfSize:[NSFont systemFontSize]];
// Based on user preferences, either use:
// 1. The font specifically chosen for the editor sheet textView (FieldEditorSheetFont, right-click in the textView, and choose "Font > Show Fonts" to do that);
// 2. The font used for the tablew view (GlobalResultTableFont, per the "MySQL Content Font" preference option);
// 2. The font used for the table view (SPGlobalFontSettings, per the "MySQL Content Font" preference option);
if ([prefs objectForKey:SPFieldEditorSheetFont]) {
textEditorFont = [NSUnarchiver unarchiveObjectWithData:[prefs dataForKey:SPFieldEditorSheetFont]];
} else if ([prefs objectForKey:SPGlobalFontSettings]) {
Expand Down
8 changes: 8 additions & 0 deletions Source/Other/Extensions/StringExtension.swift
Expand Up @@ -31,6 +31,10 @@ extension String {
}
}

static func rawByteString(_ data: Data) -> String {
return data.map { String(format: "%02x", $0) }.joined().uppercased()
}


func dropPrefix(_ prefix: String) -> String {
guard self.hasPrefix(prefix) else {
Expand Down Expand Up @@ -197,6 +201,10 @@ extension String {
}

@objc extension NSString {
static func rawByteString(data: NSData) -> NSString {
return String.rawByteString(data as Data) as NSString
}

public func dropPrefix(prefix: NSString) -> NSString {
return (self as String).dropPrefix(prefix as String) as NSString
}
Expand Down
25 changes: 25 additions & 0 deletions sequel-ace.xcodeproj/project.pbxproj
Expand Up @@ -387,6 +387,8 @@
96B0A1512493DF3E007BB270 /* ShortcutRecorder.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 96B0A1502493DF16007BB270 /* ShortcutRecorder.framework */; };
96B0A1522493DF3E007BB270 /* ShortcutRecorder.framework in Copy Frameworks */ = {isa = PBXBuildFile; fileRef = 96B0A1502493DF16007BB270 /* ShortcutRecorder.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; };
96B0A16124941670007BB270 /* SequelAceTunnelAssistant in Copy SequelAceTunnelAssistant and sign */ = {isa = PBXBuildFile; fileRef = 58CDB3360FCE13C900F8ACA3 /* SequelAceTunnelAssistant */; settings = {ATTRIBUTES = (CodeSignOnCopy, ); }; };
96CA8F9C2783A9010061C2D1 /* Menlo.ttc in Resources */ = {isa = PBXBuildFile; fileRef = 96CA8F9B2783A8FE0061C2D1 /* Menlo.ttc */; };
96CA8FA12783AA650061C2D1 /* Menlo.ttc in Copy Fonts */ = {isa = PBXBuildFile; fileRef = 96CA8F9B2783A8FE0061C2D1 /* Menlo.ttc */; };
9BE765682376A00C82FB93AA /* SPHelpViewerClient.m in Sources */ = {isa = PBXBuildFile; fileRef = 9BE764320CE8E86E8F63647B /* SPHelpViewerClient.m */; };
9BE765EBBDFD2F121C13D274 /* SPFillView.m in Sources */ = {isa = PBXBuildFile; fileRef = 9BE768F3989033CEDDC2027E /* SPFillView.m */; };
9BE76F2886901784E4FD2321 /* SPFilterTableController.m in Sources */ = {isa = PBXBuildFile; fileRef = 9BE76A3D5C9830E2F7738770 /* SPFilterTableController.m */; };
Expand Down Expand Up @@ -554,6 +556,17 @@
name = "Copy SequelAceTunnelAssistant and sign";
runOnlyForDeploymentPostprocessing = 0;
};
96CA8FA02783AA560061C2D1 /* Copy Fonts */ = {
isa = PBXCopyFilesBuildPhase;
buildActionMask = 2147483647;
dstPath = Fonts;
dstSubfolderSpec = 7;
files = (
96CA8FA12783AA650061C2D1 /* Menlo.ttc in Copy Fonts */,
);
name = "Copy Fonts";
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXCopyFilesBuildPhase section */

/* Begin PBXFileReference section */
Expand Down Expand Up @@ -1061,6 +1074,7 @@
9696538724931AE10003321E /* xibLocalizationPostprocessor.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.plist.entitlements; path = xibLocalizationPostprocessor.entitlements; sourceTree = "<group>"; };
96B0A1502493DF16007BB270 /* ShortcutRecorder.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = ShortcutRecorder.framework; path = Frameworks/ShortcutRecorder.framework; sourceTree = "<group>"; };
96B0A1532493F43B007BB270 /* TunnelAssistant-Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; name = "TunnelAssistant-Info.plist"; path = "Plists/TunnelAssistant-Info.plist"; sourceTree = "<group>"; };
96CA8F9B2783A8FE0061C2D1 /* Menlo.ttc */ = {isa = PBXFileReference; lastKnownFileType = file; name = Menlo.ttc; path = Fonts/Menlo.ttc; sourceTree = "<group>"; };
9BE760B3C4586EA3B1A48600 /* SPHelpViewerController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SPHelpViewerController.m; sourceTree = "<group>"; };
9BE761AE45D4F6B9B90E67DE /* SPHelpViewerClient.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SPHelpViewerClient.h; sourceTree = "<group>"; };
9BE764320CE8E86E8F63647B /* SPHelpViewerClient.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SPHelpViewerClient.m; sourceTree = "<group>"; };
Expand Down Expand Up @@ -1781,6 +1795,7 @@
517E44F5257A906100ED333B /* Localization */,
1740F8370FC306C900CF3699 /* Plists */,
17E6418B0EF01FF7001BC333 /* Images */,
96CA8F922783A3E40061C2D1 /* Fonts */,
1740F8360FC306AE00CF3699 /* Scripting */,
58D1006813A57FAE0092E019 /* Localization Strings Files */,
1740F8350FC3069700CF3699 /* Templates */,
Expand Down Expand Up @@ -2332,6 +2347,14 @@
path = Parsing;
sourceTree = "<group>";
};
96CA8F922783A3E40061C2D1 /* Fonts */ = {
isa = PBXGroup;
children = (
96CA8F9B2783A8FE0061C2D1 /* Menlo.ttc */,
);
name = Fonts;
sourceTree = "<group>";
};
96D494B8249C07940092F335 /* SSH Helpers */ = {
isa = PBXGroup;
children = (
Expand Down Expand Up @@ -2457,6 +2480,7 @@
96B0A162249416B1007BB270 /* Copy SequelAceTunnelAssistant and sign */,
4DECC4940EC2B447008D359E /* Copy Frameworks */,
9691789224A562330012ED42 /* Copy Default Themes and Default Bundles */,
96CA8FA02783AA560061C2D1 /* Copy Fonts */,
1A62C63425BE08F400DF903B /* ShellScript */,
);
buildRules = (
Expand Down Expand Up @@ -2714,6 +2738,7 @@
51CD0BE4258D06D8009E2484 /* HelpViewer.xib in Resources */,
517412382573E8F900EB6935 /* EditorQuickLookTypes.plist in Resources */,
8831EFA8224011B700D10172 /* button_addTemplate.pdf in Resources */,
96CA8F9C2783A9010061C2D1 /* Menlo.ttc in Resources */,
582E942E1683658A003459FD /* clearconsole.png in Resources */,
582E944A168374C1003459FD /* field-small-square.png in Resources */,
582E944C16837986003459FD /* hideconsole.png in Resources */,
Expand Down

0 comments on commit b002cae

Please sign in to comment.