Rename NSReplacePboard → OakReplacePboard

We shouldn’t use Apple’s prefix for our own constants. The actual value of the constant hasn’t been renamed yet as this requires “migration” (renaming the key in user defaults).
This commit is contained in:
Allan Odgaard
2014-02-18 12:41:33 +07:00
parent e80bf978ec
commit 57e8e37313
5 changed files with 13 additions and 13 deletions

View File

@@ -312,7 +312,7 @@ static NSButton* OakCreateStopSearchButton ()
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(userDefaultsDidChange:) name:NSUserDefaultsDidChangeNotification object:[NSUserDefaults standardUserDefaults]];
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(findClipboardDidChange:) name:OakPasteboardDidChangeNotification object:[OakPasteboard pasteboardWithName:NSFindPboard]];
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(replaceClipboardDidChange:) name:OakPasteboardDidChangeNotification object:[OakPasteboard pasteboardWithName:NSReplacePboard]];
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(replaceClipboardDidChange:) name:OakPasteboardDidChangeNotification object:[OakPasteboard pasteboardWithName:OakReplacePboard]];
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(textViewWillPerformFindOperation:) name:@"OakTextViewWillPerformFindOperation" object:nil];
[self.window addObserver:self forKeyPath:@"firstResponder" options:0 context:NULL];
@@ -486,7 +486,7 @@ static NSButton* OakCreateStopSearchButton ()
- (void)replaceClipboardDidChange:(NSNotification*)aNotification
{
self.replaceString = [[[OakPasteboard pasteboardWithName:NSReplacePboard] current] string];
self.replaceString = [[[OakPasteboard pasteboardWithName:OakReplacePboard] current] string];
}
- (void)observeValueForKeyPath:(NSString*)keyPath ofObject:(id)object change:(NSDictionary*)change context:(void*)context
@@ -543,9 +543,9 @@ static NSButton* OakCreateStopSearchButton ()
if(_replaceString)
{
NSString* oldReplacement = [[[OakPasteboard pasteboardWithName:NSReplacePboard] current] string];
NSString* oldReplacement = [[[OakPasteboard pasteboardWithName:OakReplacePboard] current] string];
if(!oldReplacement || ![oldReplacement isEqualToString:_replaceString])
[[OakPasteboard pasteboardWithName:NSReplacePboard] addEntryWithString:_replaceString];
[[OakPasteboard pasteboardWithName:OakReplacePboard] addEntryWithString:_replaceString];
}
return res;
@@ -659,7 +659,7 @@ static NSButton* OakCreateStopSearchButton ()
- (IBAction)showReplaceHistory:(id)sender
{
if(![[[OakPasteboardSelector sharedInstance] window] isVisible])
[[OakPasteboard pasteboardWithName:NSReplacePboard] selectItemForControl:self.replaceTextField];
[[OakPasteboard pasteboardWithName:OakReplacePboard] selectItemForControl:self.replaceTextField];
// if the panel is visible it will automatically be hidden due to the mouse click
}

View File

@@ -38,7 +38,7 @@
- (IBAction)copySelectionToReplacePboard:(id)sender
{
if(NSString* str = [self selection])
[[OakPasteboard pasteboardWithName:NSReplacePboard] addEntryWithString:str];
[[OakPasteboard pasteboardWithName:OakReplacePboard] addEntryWithString:str];
else NSBeep();
}

View File

@@ -1,7 +1,7 @@
#import <oak/oak.h>
#import <regexp/find.h> // for find::options_t
extern PUBLIC NSString* const NSReplacePboard;
extern PUBLIC NSString* const OakReplacePboard;
extern PUBLIC NSString* const OakPasteboardDidChangeNotification;
extern PUBLIC NSString* const kUserDefaultsFindWrapAround;

View File

@@ -9,7 +9,7 @@
OAK_DEBUG_VAR(Pasteboard);
NSString* const NSReplacePboard = @"NSReplacePboard";
NSString* const OakReplacePboard = @"NSReplacePboard";
NSString* const OakPasteboardDidChangeNotification = @"OakClipboardDidChangeNotification";
NSString* const OakPasteboardOptionsPboardType = @"OakPasteboardOptionsPboardType";

View File

@@ -518,7 +518,7 @@ static std::string shell_quote (std::vector<std::string> paths)
}
- (NSString*)findString { return [[OakPasteboard pasteboardWithName:NSFindPboard] current].string; }
- (NSString*)replaceString { return [[OakPasteboard pasteboardWithName:NSReplacePboard] current].string; }
- (NSString*)replaceString { return [[OakPasteboard pasteboardWithName:OakReplacePboard] current].string; }
- (void)didFind:(NSUInteger)aNumber occurrencesOf:(NSString*)aFindString atPosition:(text::pos_t const&)aPosition wrapped:(BOOL)didWrap
{
@@ -701,7 +701,7 @@ static std::string shell_quote (std::vector<std::string> paths)
editor->set_clipboard(get_clipboard(NSGeneralPboard));
editor->set_find_clipboard(get_clipboard(NSFindPboard));
editor->set_replace_clipboard(get_clipboard(NSReplacePboard));
editor->set_replace_clipboard(get_clipboard(OakReplacePboard));
ng::index_t visibleIndex = document->visible_index();
if(document->selection() != NULL_STR)
@@ -2259,7 +2259,7 @@ static void update_menu_key_equivalents (NSMenu* menu, action_to_key_t const& ac
if(findOperation == kFindOperationReplace || findOperation == kFindOperationReplaceAndFind)
{
std::string replacement = to_s(aFindServer.replaceString);
if(NSDictionary* captures = [OakPasteboard pasteboardWithName:NSReplacePboard].auxiliaryOptionsForCurrent)
if(NSDictionary* captures = [OakPasteboard pasteboardWithName:OakReplacePboard].auxiliaryOptionsForCurrent)
{
std::map<std::string, std::string> variables;
for(NSString* key in [captures allKeys])
@@ -2280,7 +2280,7 @@ static void update_menu_key_equivalents (NSMenu* menu, action_to_key_t const& ac
case kFindOperationFind:
case kFindOperationCount:
{
[OakPasteboard pasteboardWithName:NSReplacePboard].auxiliaryOptionsForCurrent = nil;
[OakPasteboard pasteboardWithName:OakReplacePboard].auxiliaryOptionsForCurrent = nil;
bool isCounting = findOperation == kFindOperationCount || findOperation == kFindOperationCountInSelection;
std::string const findStr = to_s(aFindServer.findString);
@@ -2351,7 +2351,7 @@ static void update_menu_key_equivalents (NSMenu* menu, action_to_key_t const& ac
NSMutableDictionary* captures = [NSMutableDictionary dictionary];
for(auto pair : allMatches[res.last()])
captures[[NSString stringWithCxxString:pair.first]] = [NSString stringWithCxxString:pair.second];
[OakPasteboard pasteboardWithName:NSReplacePboard].auxiliaryOptionsForCurrent = captures;
[OakPasteboard pasteboardWithName:OakReplacePboard].auxiliaryOptionsForCurrent = captures;
}
}