Skip to content

Commit

Permalink
initial commit of Phil Dow's (unchanged) Sprouted Interface framework
Browse files Browse the repository at this point in the history
  • Loading branch information
greay committed Jun 2, 2010
0 parents commit d2224fa
Show file tree
Hide file tree
Showing 298 changed files with 28,510 additions and 0 deletions.
6 changes: 6 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
.DS_Store
*.pbxuser
*.mode1v3
SproutedInterface.framework
SproutedUtilities.framework
build
Binary file added ABBarSmall.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added ActualSize.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added ActualSizePressed.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added AppleScriptActionBarSmall.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
23 changes: 23 additions & 0 deletions AppleScriptAlert.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
//
// AppleScriptAlert.h
// SproutedInterface
//
// Created by Philip Dow on xx.
// Copyright Sprouted. All rights reserved.
// Inquiries should be directed to [email protected]
//

#import <Cocoa/Cocoa.h>

@interface AppleScriptAlert : NSWindowController
{
IBOutlet NSTextView *errorView;
IBOutlet NSTextView *sourceView;

id source;
id error;
}

- (id) initWithSource:(id)source error:(id)error;

@end
66 changes: 66 additions & 0 deletions AppleScriptAlert.m
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
//
// AppleScriptAlert.m
// SproutedInterface
//
// Created by Philip Dow on xx.
// Copyright Sprouted. All rights reserved.
// Inquiries should be directed to [email protected]
//

#import <SproutedInterface/AppleScriptAlert.h>

@implementation AppleScriptAlert

- (id) initWithSource:(id)theSource error:(id)theError
{
if ( self = [super initWithWindowNibName:@"AppleScriptAlert"] )
{
source = [theSource retain];
error = [theError retain];

[self retain];
}

return self;
}

- (void) windowDidLoad
{
if ( [source isKindOfClass:[NSString class]] )
[sourceView setString:source];

else if ( [source isKindOfClass:[NSAttributedString class]] )
{
[[sourceView textStorage] beginEditing];
[[sourceView textStorage] setAttributedString:source];
[[sourceView textStorage] endEditing];
}

if ( error == nil )
[errorView setString:[NSString string]];
else
[errorView setString:[error description]];
}

- (void) dealloc
{
[source release];
[error release];

[super dealloc];
}

- (void) windowWillClose:(NSNotification*)aNotification
{
[self autorelease];
}

#pragma mark -

- (IBAction) showWindow:(id)sender
{
[[self window] center];
[super showWindow:sender];
}

@end
Binary file added Back.tif
Binary file not shown.
Binary file added BackDisabled.tif
Binary file not shown.
Binary file added BackPressed.tif
Binary file not shown.
Binary file added Bigger.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added BiggerDisabled.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added BiggerPressed.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
25 changes: 25 additions & 0 deletions CollectionManagerView.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@

//
// CollectionManagerView.h
// SproutedInterface
//
// Created by Philip Dow on xx.
// Copyright Sprouted. All rights reserved.
// Inquiries should be directed to [email protected]
//

#import <Cocoa/Cocoa.h>

@interface CollectionManagerView : NSView
{
BOOL bordered;
int numConditions;
}

- (int) numConditions;
- (void) setNumConditions:(int)num;

- (BOOL) bordered;
- (void) setBordered:(BOOL)drawsBorder;

@end
80 changes: 80 additions & 0 deletions CollectionManagerView.m
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@

//
// CollectionManagerView.m
// SproutedInterface
//
// Created by Philip Dow on xx.
// Copyright Sprouted. All rights reserved.
// Inquiries should be directed to [email protected]
//

#import <SproutedInterface/CollectionManagerView.h>
#import <SproutedInterface/ConditionController.h>

@implementation CollectionManagerView

- (id)initWithFrame:(NSRect)frameRect
{
if ((self = [super initWithFrame:frameRect]) != nil) {
// Add initialization code here
bordered = YES;
}
return self;
}

#pragma mark -

- (int) numConditions
{
return numConditions;
}

- (void) setNumConditions:(int)num
{
numConditions = num;
}

- (BOOL) bordered
{
return bordered;
}

- (void) setBordered:(BOOL)drawsBorder
{
bordered = drawsBorder;
}

#pragma mark -

- (BOOL) isFlipped
{
return YES;
}

- (void)drawRect:(NSRect)rect
{
int i;
NSRect bds = [self bounds];

for ( i = 0; i < [self numConditions]; i++ )
{
if ( i % 2 == 0 )
{
[[NSColor whiteColor] set];
NSRectFillUsingOperation(NSMakeRect( 0, (kConditionViewHeight*i), bds.size.width, kConditionViewHeight), NSCompositeSourceOver);
}
else
{
[[[NSColor controlAlternatingRowBackgroundColors] objectAtIndex:1] set];
NSRectFillUsingOperation(NSMakeRect( 0, (kConditionViewHeight*i), bds.size.width, kConditionViewHeight), NSCompositeSourceOver);
}
}

if ( [self bordered] )
{
[[NSColor lightGrayColor] set];
NSFrameRect(bds);
}
}

@end
Binary file added ComposeMailBarSmall.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
98 changes: 98 additions & 0 deletions ConditionController.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,98 @@
//
// ConditionController.h
// SproutedInterface
//
// Created by Philip Dow on xx.
// Copyright Sprouted. All rights reserved.
// Inquiries should be directed to [email protected]
//

#import <Cocoa/Cocoa.h>

#define kConditionViewHeight 26

#define PDConditionContains 0
#define PDConditionNotContains 1
#define PDConditionBeginsWith 2
#define PDConditionEndsWith 3
#define PDConditionIs 4

#define PDConditionBefore 0
#define PDConditionAfter 1
#define PDConditionBetween 2
#define PDConditionInTheLast 3
#define PDConditionInTheNext 4

#define PDConditionDay 0
#define PDConditionWeek 1
#define PDConditionMonth 2

@interface ConditionController : NSObject
{
IBOutlet NSView *conditionView;
IBOutlet NSView *specifiedConditionView;
IBOutlet NSPopUpButton *keyPop;

IBOutlet NSButton *removeButton;

int tag;
id target;

BOOL _allowsEmptyCondition;
BOOL _autogeneratesDynamicDates;
BOOL _sendsLiveUpdate;

}

- (id) initWithTarget:(id)anObject;
- (void) setInitialPredicate:(NSPredicate*)aPredicate;
- (void) setInitialCondition:(NSString*)condition;

- (NSView*) conditionView;
- (NSPredicate*) predicate;
- (NSString*) predicateString;

- (int) tag;
- (void) setTag:(int)newTag;

- (id) target;
- (void) setTarget:(id)anObject;

- (BOOL) sendsLiveUpdate;
- (void) setSendsLiveUpdate:(BOOL)updates;

- (BOOL) autogeneratesDynamicDates;
- (void) setAutogeneratesDynamicDates:(BOOL)autogenerate;

- (BOOL) allowsEmptyCondition;
- (void) setAllowsEmptyCondition:(BOOL)allowsEmpty;

- (BOOL) removeButtonEnabled;
- (void) setRemoveButtonEnabled:(BOOL)enabled;

- (IBAction) addCondition:(id)sender;
- (IBAction) removeCondition:(id)sender;
- (IBAction) changeCondition:(id)sender;
- (IBAction) changeConditionKey:(id)sender;

- (id) selectableView;
- (void) appropriateFirstResponder:(NSWindow*)aWindow;
- (void) removeFromSuper;

- (void) _sendUpdateIfRequested;

// utility for creating spotlight based conditions - subclasses feel free to use
- (NSString*) _spotlightConditionStringWithAttribute:(NSString*)anAttribute condition:(NSString*)aCondition operation:(int)anOperation;
- (NSString*) _spotlightConditionStringWithAttributes:(NSArray*)theAttributes condition:(NSString*)aCondition operation:(int)anOperation;

- (BOOL) validatePredicate;
@end


#pragma mark -

@interface NSObject (ConditionControllerDelegate)

- (void) conditionDidChange:(id)condition;

@end
Loading

0 comments on commit d2224fa

Please sign in to comment.