Browse files

Replacing string defines in Obj-C code with const NSString objects.

  • Loading branch information...
1 parent 1931abf commit bf5850c112920647e3b2959712b5f2f74fa69767 Jan Weiß committed Sep 27, 2011
Showing with 8 additions and 5 deletions.
  1. +2 −1 EditPaneTextView.h
  2. +1 −0 EditPaneTextView.m
  3. +1 −1 PreferencesController.h
  4. +4 −3 PreferencesController.m
View
3 EditPaneTextView.h
@@ -7,7 +7,8 @@
//
#import <Foundation/Foundation.h>
-#define kEditPaneTextViewChangedNotification @"EditPaneTextViewChangedNotification"
+
+extern NSString * const kEditPaneTextViewChangedNotification;
@class EditPaneLayoutManager;
View
1 EditPaneTextView.m
@@ -11,6 +11,7 @@
#import "PreferencesManager.h"
#import "PreferencesController.h"
+NSString * const kEditPaneTextViewChangedNotification = @"EditPaneTextViewChangedNotification";
@implementation EditPaneTextView
View
2 PreferencesController.h
@@ -8,7 +8,7 @@
#import <Foundation/Foundation.h>
-#define kEditPaneFontNameChangedNotification @"EditPaneFontNameChangedNotification"
+extern NSString * const kEditPaneFontNameChangedNotification;
@interface PreferencesController : NSObject {
IBOutlet NSWindow *prefWindow;
View
7 PreferencesController.m
@@ -9,8 +9,9 @@
#import "PreferencesController.h"
#import "PreferencesManager.h"
-#define FONT_DISPLAY_FORMAT @"%@ %g pt."
+NSString * const kEditPaneFontNameChangedNotification = @"EditPaneFontNameChangedNotification";
+NSString * const kFontDisplayFormat = @"%@ %g pt.";
@interface PreferencesController (Private)
@@ -35,7 +36,7 @@ - (IBAction)showFonts:(id)sender {
- (void)updateFontDisplay {
NSString *fontName = [PreferencesManager editPaneFontName];
float fontSize = [PreferencesManager editPaneFontSize];
- [fontPreviewField setStringValue:[NSString stringWithFormat:FONT_DISPLAY_FORMAT, fontName, fontSize]];
+ [fontPreviewField setStringValue:[NSString stringWithFormat:kFontDisplayFormat, fontName, fontSize]];
}
- (IBAction)resetEditPanePreferences:(id)sender {
@@ -56,7 +57,7 @@ - (void)changeFont:(id)sender {
if (newFont && fontName) {
[PreferencesManager setEditPaneFontName:fontName];
[PreferencesManager setEditPaneFontSize:fontSize];
- [fontPreviewField setStringValue:[NSString stringWithFormat:FONT_DISPLAY_FORMAT, fontName, fontSize]];
+ [fontPreviewField setStringValue:[NSString stringWithFormat:kFontDisplayFormat, fontName, fontSize]];
[[NSNotificationCenter defaultCenter] postNotificationName:kEditPaneFontNameChangedNotification
object:nil];

0 comments on commit bf5850c

Please sign in to comment.