diff --git a/ChangeLog b/ChangeLog index 103427d..d67982d 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,15 @@ +2020-03-24 Riccardo Mottola + + * Framework/PCProjectLauncher.m + * Modules/Debuggers/ProjectCenter/PCDebugger.m + * Modules/Debuggers/ProjectCenter/PCDebuggerView.h + * Modules/Debuggers/ProjectCenter/PCDebuggerViewDelegateProtocol.h + * Modules/Debuggers/ProjectCenter/PipeDelegate.h + * Modules/Debuggers/ProjectCenter/PipeDelegate.m + * Modules/Editors/ProjectCenter/PCEditorView.m + Uniform font defaults to use PCPreferenceController, fix Debugger to + actually make setFont work thorugh the view-delegate chain. + 2020-03-24 Riccardo Mottola * Modules/Preferences/EditorFSC/PCEditorFSCPrefs.m diff --git a/Framework/PCProjectLauncher.m b/Framework/PCProjectLauncher.m index efcf84f..ba7fe91 100644 --- a/Framework/PCProjectLauncher.m +++ b/Framework/PCProjectLauncher.m @@ -1,7 +1,7 @@ /* GNUstep ProjectCenter - http://www.gnustep.org/experience/ProjectCenter.html - Copyright (C) 2000-2016 Free Software Foundation + Copyright (C) 2000-2020 Free Software Foundation Authors: Philippe C.D. Robert Serg Stoyan @@ -35,6 +35,9 @@ #import #import "Modules/Preferences/Misc/PCMiscPrefs.h" +#import "Modules/Preferences/EditorFSC/PCEditorFSCPrefs.h" + +#import "PCPrefController.h" #ifndef NOTIFICATION_CENTER #define NOTIFICATION_CENTER [NSNotificationCenter defaultCenter] @@ -145,7 +148,16 @@ enum { if ((self = [super init])) { - NSFont *font = [NSFont userFixedPitchFontOfSize: 10.0]; + PCPrefController *prefs = [PCPrefController sharedPCPreferences]; + NSFont *font; + NSString *fontName; + CGFloat fontSize; + + fontName = [prefs stringForKey:ConsoleFixedFont]; + fontSize = [prefs floatForKey:ConsoleFixedFontSize]; + font = [NSFont fontWithName:fontName size:fontSize]; + if (font == nil) + font = [NSFont userFixedPitchFontOfSize:0]; project = aProject; diff --git a/Modules/Debuggers/ProjectCenter/PCDebugger.m b/Modules/Debuggers/ProjectCenter/PCDebugger.m index 523b247..68bd627 100644 --- a/Modules/Debuggers/ProjectCenter/PCDebugger.m +++ b/Modules/Debuggers/ProjectCenter/PCDebugger.m @@ -1,7 +1,7 @@ /* ** PCDebugger.m ** -** Copyright (c) 2008-2016 +** Copyright (c) 2008-2020 ** ** Author: Gregory Casamento ** Riccardo Mottola > @@ -36,7 +36,7 @@ #import "Modules/Preferences/EditorFSC/PCEditorFSCPrefs.h" #import "PCDebuggerViewDelegateProtocol.h" #import "PipeDelegate.h" - +#import "PCPrefController.h" #ifndef NOTIFICATION_CENTER @@ -120,22 +120,17 @@ NSString *PCDBDebuggerStartedNotification = @"PCDBDebuggerStartedNotification"; + (NSFont *)defaultConsoleFont { - NSUserDefaults *df = [NSUserDefaults standardUserDefaults]; + PCPrefController *prefs = [PCPrefController sharedPCPreferences]; NSString *fontName; - float fontSize; + CGFloat fontSize; NSFont *font = nil; - fontName = [df objectForKey:ConsoleFixedFont]; - fontSize = [df floatForKey:ConsoleFixedFontSize]; + fontName = [prefs stringForKey:ConsoleFixedFont]; + fontSize = [prefs floatForKey:ConsoleFixedFontSize]; - if (fontName != nil && fontSize > 0) - { - font = [NSFont fontWithName:fontName size:fontSize]; - } + font = [NSFont fontWithName:fontName size:fontSize]; if (font == nil) - { - font = [NSFont userFixedPitchFontOfSize:0]; - } + font = [NSFont userFixedPitchFontOfSize:0]; return font; } @@ -144,6 +139,7 @@ NSString *PCDBDebuggerStartedNotification = @"PCDBDebuggerStartedNotification"; { if((self = [super init]) != nil) { + NSLog(@"PCDebugger Init"); id viewDelegate; // initialization here... if([NSBundle loadNibNamed: @"PCDebugger" owner: self] == NO) @@ -157,6 +153,7 @@ NSString *PCDBDebuggerStartedNotification = @"PCDBDebuggerStartedNotification"; [viewDelegate setTextView:debuggerView]; [viewDelegate setDebugger:self]; [viewDelegate release]; + [debuggerView setFont: [PCDebugger defaultConsoleFont]]; subProcessId = 0; gdbVersion = 0.0; @@ -236,7 +233,6 @@ NSString *PCDBDebuggerStartedNotification = @"PCDBDebuggerStartedNotification"; [debuggerWindow setToolbar: toolbar]; RELEASE(toolbar); - [debuggerView setFont: [PCDebugger defaultConsoleFont]]; [debuggerWindow setFrameAutosaveName: @"PCDebuggerWindow"]; [self setStatus: @"Idle."]; } diff --git a/Modules/Debuggers/ProjectCenter/PCDebuggerView.h b/Modules/Debuggers/ProjectCenter/PCDebuggerView.h index 22f96c8..e99e00a 100644 --- a/Modules/Debuggers/ProjectCenter/PCDebuggerView.h +++ b/Modules/Debuggers/ProjectCenter/PCDebuggerView.h @@ -1,7 +1,7 @@ /* ** PCDebuggerView ** -** Copyright (c) 2008-2016 +** Copyright (c) 2008-2020 ** ** Author: Gregory Casamento ** Riccardo Mottola @@ -41,6 +41,9 @@ - (void) setCurrentFile: (NSString *)fileName; - (NSString *) currentFile; +- (void)setFont:(NSFont *)font; + + - (void) runProgram: (NSString *)path inCurrentDirectory: (NSString *)directory diff --git a/Modules/Debuggers/ProjectCenter/PCDebuggerView.m b/Modules/Debuggers/ProjectCenter/PCDebuggerView.m index c546bf3..642506e 100644 --- a/Modules/Debuggers/ProjectCenter/PCDebuggerView.m +++ b/Modules/Debuggers/ProjectCenter/PCDebuggerView.m @@ -57,6 +57,11 @@ } +- (void)setFont:(NSFont *)aFont +{ + [viewDelegate setFont:aFont]; +} + /** * Log string to the view. */ diff --git a/Modules/Debuggers/ProjectCenter/PCDebuggerViewDelegateProtocol.h b/Modules/Debuggers/ProjectCenter/PCDebuggerViewDelegateProtocol.h index 4c67cd6..8debdae 100644 --- a/Modules/Debuggers/ProjectCenter/PCDebuggerViewDelegateProtocol.h +++ b/Modules/Debuggers/ProjectCenter/PCDebuggerViewDelegateProtocol.h @@ -1,7 +1,7 @@ /* ** PCDebuggerViewDelegateProtocol.h ** -** Copyright (c) 2016 +** Copyright (c) 2016-2020 ** ** Author: Riccardo Mottola ** @@ -30,6 +30,8 @@ @protocol PCDebuggerViewDelegateProtocol +- (void)setFont:(NSFont *)font; + - (NSColor *)userInputColor; - (NSColor *)debuggerColor; - (NSColor *)messageColor; diff --git a/Modules/Debuggers/ProjectCenter/PipeDelegate.h b/Modules/Debuggers/ProjectCenter/PipeDelegate.h index fd55470..75648ec 100644 --- a/Modules/Debuggers/ProjectCenter/PipeDelegate.h +++ b/Modules/Debuggers/ProjectCenter/PipeDelegate.h @@ -56,6 +56,7 @@ typedef enum PCDebuggerOutputType_enum { NSColor *messageColor; NSColor *errorColor; NSColor *promptColor; + NSFont *font; BOOL debuggerStarted; } diff --git a/Modules/Debuggers/ProjectCenter/PipeDelegate.m b/Modules/Debuggers/ProjectCenter/PipeDelegate.m index 4ab714f..4be2003 100644 --- a/Modules/Debuggers/ProjectCenter/PipeDelegate.m +++ b/Modules/Debuggers/ProjectCenter/PipeDelegate.m @@ -1,7 +1,7 @@ /* ** PipeDelegate.m ** -** Copyright (c) 2008-2016 Free Software Foundation +** Copyright (c) 2008-2020 Free Software Foundation ** ** Author: Gregory Casamento ** Riccardo Mottola @@ -90,6 +90,17 @@ } } +- (void)setFont:(NSFont *)aFont +{ + if (font != aFont) + { + [font release]; + font = aFont; + [font retain]; + } +} + + - (NSColor *)userInputColor { return userInputColor; @@ -127,7 +138,7 @@ } textAttributes = [NSMutableDictionary dictionary]; - [textAttributes setObject:[NSFont userFixedPitchFontOfSize:0] forKey:NSFontAttributeName]; + [textAttributes setObject:font forKey:NSFontAttributeName]; if (color) { diff --git a/Modules/Editors/ProjectCenter/PCEditorView.m b/Modules/Editors/ProjectCenter/PCEditorView.m index bf09f26..746e434 100644 --- a/Modules/Editors/ProjectCenter/PCEditorView.m +++ b/Modules/Editors/ProjectCenter/PCEditorView.m @@ -4,7 +4,7 @@ Implementation of the PCEditorView class for the ProjectManager application. - Copyright (C) 2005-2016 Free Software Foundation + Copyright (C) 2005-2020 Free Software Foundation Saso Kiselkov Serg Stoyan Riccardo Mottola @@ -44,7 +44,7 @@ #import "SyntaxHighlighter.h" #import "LineJumper.h" #import "Modules/Preferences/EditorFSC/PCEditorFSCPrefs.h" - +#import "PCPrefController.h" /** * Computes the indenting offset of the last line before the passed @@ -360,22 +360,17 @@ static int ComputeIndentingOffset(NSString * string, unsigned int start) + (NSFont *)defaultEditorFont { - NSUserDefaults *df = [NSUserDefaults standardUserDefaults]; + PCPrefController *prefs = [PCPrefController sharedPCPreferences]; NSString *fontName; - float fontSize; + CGFloat fontSize; NSFont *font = nil; - fontName = [df objectForKey:EditorTextFont]; - fontSize = [df floatForKey:EditorTextFontSize]; + fontName = [prefs stringForKey:EditorTextFont]; + fontSize = [prefs floatForKey:EditorTextFontSize]; - if (fontName != nil && fontSize > 0) - { - font = [NSFont fontWithName:fontName size:fontSize]; - } + font = [NSFont fontWithName:fontName size:fontSize]; if (font == nil) - { - font = [NSFont userFixedPitchFontOfSize:fontSize]; - } + font = [NSFont userFixedPitchFontOfSize:0]; return font; }