Some coding standard changes for NSSearchField

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@31788 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
Fred Kiefer 2010-12-27 13:44:18 +00:00
parent caeca26669
commit dc285c6df1
3 changed files with 46 additions and 35 deletions

View file

@ -1,3 +1,8 @@
2010-12-27 Fred Kiefer <FredKiefer@gmx.de>
* Source/NSSearchField.m,
* Source/NSSearchFieldCell.m: Some coding standard changes.
2010-12-27 Fred Kiefer <FredKiefer@gmx.de>
* Source/GSDragView.m: Check whether the drag source supports

View file

@ -27,10 +27,11 @@
Boston, MA 02110-1301, USA.
*/
#include <Foundation/NSString.h>
#include <Foundation/NSArray.h>
#include <AppKit/NSSearchField.h>
#include <AppKit/NSSearchFieldCell.h>
#import <Foundation/NSString.h>
#import <Foundation/NSArray.h>
#import "AppKit/NSSearchField.h"
#import "AppKit/NSSearchFieldCell.h"
/*
* Class variables
@ -92,16 +93,17 @@ static Class usedCellClass;
untilMouseUp: YES];
}
- (void)delete:(id)sender
- (void) delete: (id)sender
{
[self setStringValue:@""]; // this may need to do more (like send action), but start here...
[[self cell] performClick:self];
// this may need to do more (like send action), but start here...
[self setStringValue: @""];
[[self cell] performClick: self];
}
// Cocoa only defines these methods on the cell, but nib loading targets the field itself
- (void) setSearchMenuTemplate:(NSMenu *)newTemplate
- (void) setSearchMenuTemplate: (NSMenu *)newTemplate
{
[[self cell] setSearchMenuTemplate:newTemplate];
[[self cell] setSearchMenuTemplate: newTemplate];
}
- (void) setSendsWholeSearchString: (BOOL)flag

View file

@ -29,19 +29,20 @@
Boston, MA 02110-1301, USA.
*/
#include <Foundation/NSArray.h>
#include <Foundation/NSException.h>
#include <Foundation/NSNotification.h>
#include <Foundation/NSString.h>
#include <Foundation/NSUserDefaults.h>
#include <AppKit/NSApplication.h>
#include <AppKit/NSButtonCell.h>
#include <AppKit/NSEvent.h>
#include <AppKit/NSImage.h>
#include <AppKit/NSMenu.h>
#include "AppKit/NSMenuView.h"
#include <AppKit/NSSearchFieldCell.h>
#include "AppKit/NSWindow.h"
#import <Foundation/NSArray.h>
#import <Foundation/NSException.h>
#import <Foundation/NSNotification.h>
#import <Foundation/NSString.h>
#import <Foundation/NSUserDefaults.h>
#import "AppKit/NSApplication.h"
#import "AppKit/NSButtonCell.h"
#import "AppKit/NSEvent.h"
#import "AppKit/NSImage.h"
#import "AppKit/NSMenu.h"
#import "AppKit/NSMenuView.h"
#import "AppKit/NSSearchFieldCell.h"
#import "AppKit/NSWindow.h"
@interface NSSearchFieldCell (Private)
@ -82,8 +83,8 @@
//_recent_searches = [[NSMutableArray alloc] init];
//_recents_autosave_name = nil;
[self _loadSearches];
_max_recents = 10;
[self _loadSearches];
}
return self;
@ -199,7 +200,7 @@
}
else
{
searches = [NSMutableArray arrayWithArray:searches];
searches = [NSMutableArray arrayWithArray: searches];
}
ASSIGN(_recent_searches, searches);
[self _saveSearches];
@ -212,9 +213,9 @@
ASSIGN(_recent_searches, [NSMutableArray array]);
}
if (searchTerm != nil && [searchTerm length] > 0
&& [_recent_searches indexOfObject:searchTerm] == NSNotFound)
&& [_recent_searches indexOfObject: searchTerm] == NSNotFound)
{
[_recent_searches addObject:searchTerm];
[_recent_searches addObject: searchTerm];
[self _saveSearches];
}
}
@ -229,9 +230,9 @@
ASSIGN(_menu_template, menu);
if (menu)
{
[[self searchButtonCell] setTarget:self];
[[self searchButtonCell] setAction:@selector(_openPopup:)];
[[self searchButtonCell] sendActionOn:NSLeftMouseDownMask];
[[self searchButtonCell] setTarget: self];
[[self searchButtonCell] setAction: @selector(_openPopup:)];
[[self searchButtonCell] sendActionOn: NSLeftMouseDownMask];
}
else
{
@ -295,7 +296,7 @@
// [c setTarget: [self target]];
[c setAction: @selector(performClick:)];
[c setTarget: self];
[c sendActionOn:NSLeftMouseUpMask];
[c sendActionOn: NSLeftMouseUpMask];
[c setKeyEquivalent: @"\r"];
[c setKeyEquivalentModifierMask: 0];
}
@ -361,7 +362,7 @@
- (void) endEditing: (NSText *)editor
{
[self addToRecentSearches:[[[editor string] copy] autorelease]];
[self addToRecentSearches: [[[editor string] copy] autorelease]];
[super endEditing: editor];
[[NSNotificationCenter defaultCenter]
removeObserver: self
@ -558,6 +559,7 @@
{
return NO;
}
- (void) selectItemAtIndex:(int)anIndex
{
// do nothing
@ -572,7 +574,6 @@
NSRect cellFrame;
int i;
int recentCount = [_recent_searches count];
// NSRect textRect;
template = [self searchMenuTemplate];
popupmenu = [[NSMenu alloc] init];
@ -652,15 +653,16 @@
// Last, display the window
[[mr window] orderFrontRegardless];
[mr mouseDown:[NSApp currentEvent]];
[mr mouseDown: [NSApp currentEvent]];
AUTORELEASE(popupmenu);
}
- (void) _searchForRecent: (id)sender
{
NSString *searchTerm = [sender title];
[(id)_control_view setStringValue:searchTerm];
[self performClick:self]; // do the search
[(id)_control_view setStringValue: searchTerm];
[self performClick: self]; // do the search
}
- (void) _clearSearches: (id)sender
@ -672,6 +674,7 @@
{
NSArray *list;
NSString *name = [self recentsAutosaveName];
if (name)
{
list = [[NSUserDefaults standardUserDefaults]
@ -684,6 +687,7 @@
{
NSArray *list = [self recentSearches];
NSString *name = [self recentsAutosaveName];
if (name && list)
{
[[NSUserDefaults standardUserDefaults]