Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

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

  • Loading branch information...
commit bf5850c112920647e3b2959712b5f2f74fa69767 1 parent 1931abf
Jan Weiß authored
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];
Please sign in to comment.
Something went wrong with that request. Please try again.