Skip to content
Browse files

added override input font option

  • Loading branch information...
1 parent ad5758e commit 762c633ba45309fee9d7b3ff8df12f06435e3792 @psychs psychs committed
View
5 Classes/Dialogs/Preferences/PreferencesController.h
@@ -24,11 +24,15 @@
NSMutableArray* sounds;
NSOpenPanel* transcriptFolderOpenPanel;
NSFont* logFont;
+ NSFont* inputFont;
+ BOOL changingLogFont;
}
@property (nonatomic, assign) id delegate;
@property (nonatomic, assign) NSString* fontDisplayName;
@property (nonatomic, assign) CGFloat fontPointSize;
+@property (nonatomic, assign) NSString* inputFontDisplayName;
+@property (nonatomic, assign) CGFloat inputFontPointSize;
@property (nonatomic, readonly) NSArray* availableSounds;
@property (nonatomic, readonly) NSMutableArray* sounds;
@@ -42,6 +46,7 @@
- (void)onChangedTheme:(id)sender;
- (void)onOpenThemePath:(id)sender;
- (void)onSelectFont:(id)sender;
+- (void)onInputSelectFont:(id)sender;
- (void)onOverrideFontChanged:(id)sender;
- (void)onChangedTransparency:(id)sender;
View
52 Classes/Dialogs/Preferences/PreferencesController.m
@@ -37,6 +37,7 @@ - (void)dealloc
[sounds release];
[transcriptFolderOpenPanel release];
[logFont release];
+ [inputFont release];
[super dealloc];
}
@@ -52,6 +53,9 @@ - (void)show
[logFont release];
logFont = [[NSFont fontWithName:[Preferences themeLogFontName] size:[Preferences themeLogFontSize]] retain];
+ [inputFont release];
+ inputFont = [[NSFont fontWithName:[Preferences themeInputFontName] size:[Preferences themeInputFontSize]] retain];
+
if (![self.window isVisible]) {
[self.window center];
}
@@ -82,6 +86,26 @@ - (CGFloat)fontPointSize
return [Preferences themeLogFontSize];
}
+- (void)setInputFontDisplayName:(NSString*)value
+{
+ [Preferences setThemeInputFontName:value];
+}
+
+- (NSString*)inputFontDisplayName
+{
+ return [Preferences themeInputFontName];
+}
+
+- (void)setInputFontPointSize:(CGFloat)value
+{
+ [Preferences setThemeInputFontSize:value];
+}
+
+- (CGFloat)inputFontPointSize
+{
+ return [Preferences themeInputFontSize];
+}
+
- (int)dccFirstPort
{
return [Preferences dccFirstPort];
@@ -388,18 +412,36 @@ - (void)onOpenThemePath:(id)sender
- (void)onSelectFont:(id)sender
{
+ changingLogFont = YES;
+
NSFontManager* fm = [NSFontManager sharedFontManager];
[fm setSelectedFont:logFont isMultiple:NO];
[fm orderFrontFontPanel:self];
}
-- (void)changeFont:(id)sender
+- (void)onInputSelectFont:(id)sender
{
- [logFont autorelease];
- logFont = [[sender convertFont:logFont] retain];
+ changingLogFont = NO;
- [self setValue:logFont.fontName forKey:@"fontDisplayName"];
- [self setValue:[NSNumber numberWithDouble:logFont.pointSize] forKey:@"fontPointSize"];
+ NSFontManager* fm = [NSFontManager sharedFontManager];
+ [fm setSelectedFont:inputFont isMultiple:NO];
+ [fm orderFrontFontPanel:self];
+}
+
+- (void)changeFont:(id)sender
+{
+ if (changingLogFont) {
+ [logFont autorelease];
+ logFont = [[sender convertFont:logFont] retain];
+ [self setValue:logFont.fontName forKey:@"fontDisplayName"];
+ [self setValue:[NSNumber numberWithDouble:logFont.pointSize] forKey:@"fontPointSize"];
+ }
+ else {
+ [inputFont autorelease];
+ inputFont = [[sender convertFont:inputFont] retain];
+ [self setValue:inputFont.fontName forKey:@"inputFontDisplayName"];
+ [self setValue:[NSNumber numberWithDouble:inputFont.pointSize] forKey:@"inputFontPointSize"];
+ }
[self onLayoutChanged:nil];
}
View
10 Classes/IRC/IRCWorld.m
@@ -583,7 +583,15 @@ - (void)changeInputTextTheme
[fieldEditor setInsertionPointColor:theme.inputTextColor];
[text setTextColor:theme.inputTextColor];
[text setBackgroundColor:theme.inputTextBgColor];
- [chatBox setInputTextFont:theme.inputTextFont];
+
+ NSFont* inputFont = nil;
+ if ([Preferences themeOverrideInputFont]) {
+ inputFont = [NSFont fontWithName:[Preferences themeInputFontName] size:[Preferences themeInputFontSize]];
+ }
+ if (!inputFont) {
+ inputFont = theme.inputTextFont;
+ }
+ [chatBox setInputTextFont:inputFont];
}
- (void)changeTreeTheme
View
5 Classes/Preferences/Preferences.h
@@ -68,8 +68,13 @@ typedef enum {
+ (void)setThemeLogFontName:(NSString*)value;
+ (double)themeLogFontSize;
+ (void)setThemeLogFontSize:(double)value;
++ (NSString*)themeInputFontName;
++ (void)setThemeInputFontName:(NSString*)value;
++ (double)themeInputFontSize;
++ (void)setThemeInputFontSize:(double)value;
+ (NSString*)themeNickFormat;
+ (BOOL)themeOverrideLogFont;
++ (BOOL)themeOverrideInputFont;
+ (BOOL)themeOverrideNickFormat;
+ (BOOL)themeOverrideTimestampFormat;
+ (NSString*)themeTimestampFormat;
View
33 Classes/Preferences/Preferences.m
@@ -213,6 +213,30 @@ + (void)setThemeLogFontSize:(double)value
[ud setDouble:value forKey:@"Preferences.Theme.log_font_size"];
}
++ (NSString*)themeInputFontName
+{
+ NSUserDefaults* ud = [NSUserDefaults standardUserDefaults];
+ return [ud objectForKey:@"Preferences.Theme.input_font_name"];
+}
+
++ (void)setThemeInputFontName:(NSString*)value
+{
+ NSUserDefaults* ud = [NSUserDefaults standardUserDefaults];
+ [ud setObject:value forKey:@"Preferences.Theme.input_font_name"];
+}
+
++ (double)themeInputFontSize
+{
+ NSUserDefaults* ud = [NSUserDefaults standardUserDefaults];
+ return [ud doubleForKey:@"Preferences.Theme.input_font_size"];
+}
+
++ (void)setThemeInputFontSize:(double)value
+{
+ NSUserDefaults* ud = [NSUserDefaults standardUserDefaults];
+ [ud setDouble:value forKey:@"Preferences.Theme.input_font_size"];
+}
+
+ (NSString*)themeNickFormat
{
NSUserDefaults* ud = [NSUserDefaults standardUserDefaults];
@@ -225,6 +249,12 @@ + (BOOL)themeOverrideLogFont
return [ud boolForKey:@"Preferences.Theme.override_log_font"];
}
++ (BOOL)themeOverrideInputFont
+{
+ NSUserDefaults* ud = [NSUserDefaults standardUserDefaults];
+ return [ud boolForKey:@"Preferences.Theme.override_input_font"];
+}
+
+ (BOOL)themeOverrideNickFormat
{
NSUserDefaults* ud = [NSUserDefaults standardUserDefaults];
@@ -787,8 +817,11 @@ + (void)initPreferences
[d setObject:@"resource:Limelight" forKey:@"Preferences.Theme.name"];
[d setObject:@"Lucida Grande" forKey:@"Preferences.Theme.log_font_name"];
[d setDouble:12 forKey:@"Preferences.Theme.log_font_size"];
+ [d setObject:@"Lucida Grande" forKey:@"Preferences.Theme.input_font_name"];
+ [d setDouble:12 forKey:@"Preferences.Theme.input_font_size"];
[d setObject:@"%n: " forKey:@"Preferences.Theme.nick_format"];
[d setBool:NO forKey:@"Preferences.Theme.override_log_font"];
+ [d setBool:NO forKey:@"Preferences.Theme.override_input_font"];
[d setBool:NO forKey:@"Preferences.Theme.override_nick_format"];
[d setBool:NO forKey:@"Preferences.Theme.override_timestamp_format"];
[d setObject:@"%H:%M" forKey:@"Preferences.Theme.timestamp_format"];
View
1,678 English.lproj/Preferences.xib
1,630 additions, 48 deletions not shown because the diff is too large. Please use a local Git client to view these changes.

0 comments on commit 762c633

Please sign in to comment.
Something went wrong with that request. Please try again.