[#29] dgbase cocoa: Moved some few more duplicated code, and replaced the ResultsChangedNotification for a ResultsUpdatedNotification for ref switching.

--HG--
extra : convert_revision : svn%3Ac306627e-7827-47d3-bdf0-9a457c9553a1/trunk%4045
This commit is contained in:
hsoft 2009-06-14 15:13:11 +00:00
parent ef9c7f1d25
commit 0f4a9e8a19
3 changed files with 27 additions and 1 deletions

View File

@ -1,7 +1,10 @@
#import <Cocoa/Cocoa.h>
#define DuplicateSelectionChangedNotification @"DuplicateSelectionChangedNotification"
/* ResultsChangedNotification happens on major changes, which requires a complete reload of the data*/
#define ResultsChangedNotification @"ResultsChangedNotification"
/* ResultsChangedNotification happens on minor changes, which requires buffer flush*/
#define ResultsUpdatedNotification @"ResultsUpdatedNotification"
#define ResultsMarkingChangedNotification @"ResultsMarkingChangedNotification"
#define RegistrationRequired @"RegistrationRequired"
#define JobStarted @"JobStarted"

View File

@ -18,6 +18,7 @@
IBOutlet NSView *filterFieldView;
IBOutlet MatchesView *matches;
IBOutlet NSView *pmSwitchView;
IBOutlet NSTextField *stats;
BOOL _powerMode;
BOOL _displayDelta;
@ -29,6 +30,7 @@
- (NSArray *)getSelected:(BOOL)aDupesOnly;
- (NSArray *)getSelectedPaths:(BOOL)aDupesOnly;
- (void)performPySelection:(NSArray *)aIndexPaths;
- (void)refreshStats;
/* Actions */
- (IBAction)changeDelta:(id)sender;

View File

@ -53,8 +53,11 @@
{
[self window];
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(registrationRequired:) name:RegistrationRequired object:nil];
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(jobCompleted:) name:JobCompletedNotification object:nil];
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(jobStarted:) name:JobStarted object:nil];
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(jobInProgress:) name:JobInProgress object:nil];
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(resultsChanged:) name:ResultsChangedNotification object:nil];
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(resultsUpdated:) name:ResultsUpdatedNotification object:nil];
}
/* Virtual */
@ -101,6 +104,11 @@
[py selectResultNodePaths:aIndexPaths];
}
- (void)refreshStats
{
[stats setStringValue:[py getStatLine]];
}
/* Actions */
- (IBAction)changeDelta:(id)sender
{
@ -171,7 +179,7 @@
{
[self performPySelection:[self getSelectedPaths:YES]];
[py makeSelectedReference];
[[NSNotificationCenter defaultCenter] postNotificationName:ResultsChangedNotification object:self];
[[NSNotificationCenter defaultCenter] postNotificationName:ResultsUpdatedNotification object:self];
}
/* Delegate */
@ -248,6 +256,19 @@
[Dialogs showMessage:msg];
}
- (void)resultsChanged:(NSNotification *)aNotification
{
[matches reloadData];
[self expandAll:nil];
[self outlineViewSelectionDidChange:nil];
[self refreshStats];
}
- (void)resultsUpdated:(NSNotification *)aNotification
{
[matches invalidateBuffers];
}
/* Toolbar */
- (NSToolbarItem *)toolbar:(NSToolbar *)toolbar itemForItemIdentifier:(NSString *)itemIdentifier willBeInsertedIntoToolbar:(BOOL)flag
{