From d027dc2fc7f965f66ab9668c0b52ef1d61078681 Mon Sep 17 00:00:00 2001 From: "Gun.io Whitespace Robot" Date: Mon, 19 Dec 2011 02:50:34 -0500 Subject: [PATCH] Remove whitespace [Gun.io WhitespaceBot] --- README.markdown | 2 +- README.markdown~ | 16 ++-- ToolDrawer/ToolDrawerAppDelegate.h | 4 +- ToolDrawer/ToolDrawerAppDelegate.m | 8 +- ToolDrawer/ToolDrawerViewController.h | 4 +- ToolDrawer/ToolDrawerViewController.m | 22 ++--- ToolDrawerView.h | 10 +-- ToolDrawerView.m | 120 +++++++++++++------------- 8 files changed, 93 insertions(+), 93 deletions(-) diff --git a/README.markdown b/README.markdown index 4a25678..d839e5b 100644 --- a/README.markdown +++ b/README.markdown @@ -1,6 +1,6 @@ ## ToolbarView -Accessible toolbar for tools, buttons, etc, +Accessible toolbar for tools, buttons, etc, The software is licensed under LGPLv3.0. Please feel free to use it in your application. diff --git a/README.markdown~ b/README.markdown~ index 5afdaa5..10d5560 100644 --- a/README.markdown~ +++ b/README.markdown~ @@ -1,6 +1,6 @@ ## SlideRule -SlideRule is a custom UI widget that allows you to have a "slider-like" object +SlideRule is a custom UI widget that allows you to have a "slider-like" object that can extend beyond the bounds of your window. ## Code Sample @@ -13,8 +13,8 @@ First Example - creates a simple Slide Rule with default parameters. CustomSliderTheme * theme = [CustomSliderTheme buildTheme:kCSThemeWhite]; [view addSubview:slideRuler]; [slideRuler applyTheme:theme]; - [slideRuler release]; - + [slideRuler release]; + But more realistically, you might want a label to display the value, set parameters, @@ -22,28 +22,28 @@ and of course apply a theme to the sliderule. - + SlideRuleControlView * slideRuler = [[SlideRuleControlView alloc] initWithFrame:CGRectMake(10, 150, 300, 50) params:parms]; CustomSliderTheme * theme = [CustomSliderTheme buildTheme:kCSThemeWhite]; [view addSubview:slideRuler]; [slideRuler applyTheme:theme]; - + SlideLabel * label = [[SlideLabel alloc] initWithFrame:CGRectMake(10, 200, 300, 30)]; [view addSubview:label]; [label setTextColor:[UIColor lightGrayColor]]; [slideRuler setSlideDelegate:label]; [label release]; - + // update our parameters to change the second slide rule parms->minValue = 100.0f; parms->maxValue = 400.0f; - + SlideRuleControlView * secondSlider = [[SlideRuleControlView alloc] initWithFrame:CGRectMake(10, 300, 300, 50) params:parms]; [view addSubview:secondSlider]; [secondSlider setCurrentValue:150.0]; [secondSlider release]; - + ## Obligatory Screenshot diff --git a/ToolDrawer/ToolDrawerAppDelegate.h b/ToolDrawer/ToolDrawerAppDelegate.h index 6a14a18..d594100 100644 --- a/ToolDrawer/ToolDrawerAppDelegate.h +++ b/ToolDrawer/ToolDrawerAppDelegate.h @@ -8,12 +8,12 @@ // it under the terms of the GNU General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. -// +// // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. -// +// // You should have received a copy of the GNU General Public License // along with this program. If not, see . diff --git a/ToolDrawer/ToolDrawerAppDelegate.m b/ToolDrawer/ToolDrawerAppDelegate.m index b165da4..b7203fe 100644 --- a/ToolDrawer/ToolDrawerAppDelegate.m +++ b/ToolDrawer/ToolDrawerAppDelegate.m @@ -8,12 +8,12 @@ // it under the terms of the GNU General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. -// +// // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. -// +// // You should have received a copy of the GNU General Public License // along with this program. If not, see . @@ -30,7 +30,7 @@ - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:( { self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]]; // Override point for customization after application launch. - self.viewController = [[ToolDrawerViewController alloc] initWithNibName:@"ToolDrawerViewController" bundle:nil]; + self.viewController = [[ToolDrawerViewController alloc] initWithNibName:@"ToolDrawerViewController" bundle:nil]; self.window.rootViewController = self.viewController; [self.window makeKeyAndVisible]; return YES; @@ -47,7 +47,7 @@ - (void)applicationWillResignActive:(UIApplication *)application - (void)applicationDidEnterBackground:(UIApplication *)application { /* - Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later. + Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later. If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits. */ } diff --git a/ToolDrawer/ToolDrawerViewController.h b/ToolDrawer/ToolDrawerViewController.h index 2b35545..cb4b1a6 100644 --- a/ToolDrawer/ToolDrawerViewController.h +++ b/ToolDrawer/ToolDrawerViewController.h @@ -8,12 +8,12 @@ // it under the terms of the GNU General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. -// +// // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. -// +// // You should have received a copy of the GNU General Public License // along with this program. If not, see . diff --git a/ToolDrawer/ToolDrawerViewController.m b/ToolDrawer/ToolDrawerViewController.m index 0666a5c..615b059 100644 --- a/ToolDrawer/ToolDrawerViewController.m +++ b/ToolDrawer/ToolDrawerViewController.m @@ -8,12 +8,12 @@ // it under the terms of the GNU General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. -// +// // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. -// +// // You should have received a copy of the GNU General Public License // along with this program. If not, see . @@ -35,9 +35,9 @@ - (void)viewDidLoad [super viewDidLoad]; ToolDrawerView *toolDrawerView; - + UIButton *button; - + toolDrawerView = [[ToolDrawerView alloc]initInVerticalCorner:kTopCorner andHorizontalCorner:kLeftCorner moving:kHorizontally]; button = [UIButton buttonWithType:UIButtonTypeCustom]; [button setTitle:@"A" forState:UIControlStateNormal]; @@ -47,11 +47,11 @@ - (void)viewDidLoad [toolDrawerView appendButton:button]; button = [UIButton buttonWithType:UIButtonTypeCustom]; [button setTitle:@"C" forState:UIControlStateNormal]; - [toolDrawerView appendButton:button]; + [toolDrawerView appendButton:button]; [button addTarget:toolDrawerView action:@selector(blinkTabButton) forControlEvents:UIControlEventTouchDown]; [self.view addSubview:toolDrawerView]; [toolDrawerView blinkTabButton]; - + toolDrawerView = [[ToolDrawerView alloc]initInVerticalCorner:kTopCorner andHorizontalCorner:kRightCorner moving:kVertically]; button = [UIButton buttonWithType:UIButtonTypeCustom]; [button setTitle:@"A" forState:UIControlStateNormal]; @@ -61,9 +61,9 @@ - (void)viewDidLoad [toolDrawerView appendButton:button]; button = [UIButton buttonWithType:UIButtonTypeCustom]; [button setTitle:@"C" forState:UIControlStateNormal]; - [toolDrawerView appendButton:button]; + [toolDrawerView appendButton:button]; [self.view addSubview:toolDrawerView]; - + toolDrawerView = [[ToolDrawerView alloc]initInVerticalCorner:kBottomCorner andHorizontalCorner:kLeftCorner moving:kVertically]; button = [UIButton buttonWithType:UIButtonTypeCustom]; [button setTitle:@"A" forState:UIControlStateNormal]; @@ -73,9 +73,9 @@ - (void)viewDidLoad [toolDrawerView appendButton:button]; button = [UIButton buttonWithType:UIButtonTypeCustom]; [button setTitle:@"C" forState:UIControlStateNormal]; - [toolDrawerView appendButton:button]; + [toolDrawerView appendButton:button]; [self.view addSubview:toolDrawerView]; - + toolDrawerView = [[ToolDrawerView alloc]initInVerticalCorner:kBottomCorner andHorizontalCorner:kRightCorner moving:kHorizontally]; [self.view addSubview:toolDrawerView]; button = [UIButton buttonWithType:UIButtonTypeCustom]; @@ -86,7 +86,7 @@ - (void)viewDidLoad [toolDrawerView appendButton:button]; button = [UIButton buttonWithType:UIButtonTypeCustom]; [button setTitle:@"C" forState:UIControlStateNormal]; - [toolDrawerView appendButton:button]; + [toolDrawerView appendButton:button]; } - (void)viewDidUnload diff --git a/ToolDrawerView.h b/ToolDrawerView.h index b59ec4c..378c42d 100644 --- a/ToolDrawerView.h +++ b/ToolDrawerView.h @@ -8,12 +8,12 @@ // it under the terms of the GNU General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. -// +// // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. -// +// // You should have received a copy of the GNU General Public License // along with this program. If not, see . @@ -41,12 +41,12 @@ typedef enum{ CGPoint closePosition; CGAffineTransform positionTransform; - + UIButton *handleButton; UIImage *handleButtonImage; UIImage *handleButtonBlinkImage; NSTimer *handleButtonBlinkTimer; - + BOOL open; } @@ -63,7 +63,7 @@ typedef enum{ - (void)blinkTabButton; -- (UIButton *)appendItem:(NSString *)imageName; +- (UIButton *)appendItem:(NSString *)imageName; - (UIButton *)appendImage:(UIImage *)img; - (void)appendButton:(UIButton *)button; diff --git a/ToolDrawerView.m b/ToolDrawerView.m index 845cfba..dd8c28f 100644 --- a/ToolDrawerView.m +++ b/ToolDrawerView.m @@ -9,12 +9,12 @@ // it under the terms of the GNU General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. -// +// // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. -// +// // You should have received a copy of the GNU General Public License // along with this program. If not, see . @@ -61,24 +61,24 @@ - (id)initInVerticalCorner:(ToolDrawerVerticalCorner)vCorner andHorizontalCorner open = NO; // Add the chevron button to the view [self createTabButton]; - + // Make sure that the background is clear self.opaque = NO; - + // Capture the corner and direction of the popup toolbar self.verticalCorner = vCorner; self.horizontalCorner = hCorner; self.direction = aDirection; - + // Set the period after which the toolbar should fade self.durationToFade = 15.0; // Set the per item animation duration self.perItemAnimationDuration = 0.3; - + // Start the fade timer [self resetFadeTimer]; } - + return self; } @@ -87,14 +87,14 @@ - (void)drawRect:(CGRect)rect { CGContextRef ctx = UIGraphicsGetCurrentContext(); CGRect iRect = CGRectInset(rect, 0, 0); CGFloat tabRadius = 35.0; - + // For debug purposes - Draw a red box all the way around the rect // CGContextSetStrokeColorWithColor(ctx, [UIColor redColor].CGColor); // CGContextStrokeRect(ctx, rect); - + CGContextSetStrokeColorWithColor(ctx, [UIColor blackColor].CGColor); CGContextSetLineWidth(ctx, 1.0); - + CGContextBeginPath(ctx); CGContextMoveToPoint(ctx, iRect.origin.x, iRect.origin.y); CGContextAddLineToPoint(ctx, iRect.origin.x, iRect.size.height); @@ -102,38 +102,38 @@ - (void)drawRect:(CGRect)rect { CGContextAddArcToPoint(ctx, iRect.size.width, iRect.size.height, iRect.size.width, iRect.size.height - tabRadius, tabRadius); CGContextAddLineToPoint(ctx, iRect.size.width, iRect.origin.y); CGContextAddLineToPoint(ctx, iRect.origin.x, iRect.origin.y); - + CGGradientRef myGradient; CGColorSpaceRef myColorspace; size_t num_locations = 2; CGFloat locations[2] = { 0.0, 1.0 }; CGFloat components[8] = { 0.0, 0.0, 0.0, 0.65, // Start color 0.0, 0.0, 0.0, 0.95 }; // End color - + myColorspace = CGColorSpaceCreateDeviceRGB(); myGradient = CGGradientCreateWithColorComponents (myColorspace, components, locations, num_locations); - - CGPoint startPoint = CGPointMake(iRect.origin.x,iRect.origin.y), + + CGPoint startPoint = CGPointMake(iRect.origin.x,iRect.origin.y), endPoint = CGPointMake(iRect.origin.x, iRect.origin.y + iRect.size.height); - + CGContextSaveGState(ctx); CGContextClip(ctx); CGContextClipToRect(ctx,iRect); CGContextDrawLinearGradient(ctx, myGradient, startPoint, endPoint, 0); CGContextRestoreGState(ctx); - - + + CGContextStrokePath(ctx); } #pragma mark -#pragma mark Tab button creation methods +#pragma mark Tab button creation methods - (void)createTabButton{ handleButtonImage = [self createTabButtonImageWithFillColor:[UIColor colorWithWhite:1.0 alpha:0.25]]; handleButtonBlinkImage = [self createTabButtonImageWithFillColor:[UIColor whiteColor]]; - + self.handleButton = [UIButton buttonWithType:UIButtonTypeCustom]; self.handleButton.frame = CGRectMake(0.0, 0.0, 50.0, 50.0); self.handleButton.center = CGPointMake(25.0, 25.0); @@ -147,23 +147,23 @@ - (void)createTabButton{ - (UIImage *)createTabButtonImageWithFillColor:(UIColor *)fillColor{ UIGraphicsBeginImageContext(CGSizeMake(24.0, 24.0)); CGContextRef ctx = UIGraphicsGetCurrentContext(); - + CGContextSetStrokeColorWithColor(ctx, [UIColor colorWithRed:0 green:0 blue:0 alpha:0.6].CGColor); - + CGContextSetFillColorWithColor(ctx, fillColor.CGColor); CGContextSetLineWidth(ctx, 2.0); - + CGRect circle = CGRectMake(2.0, 2.0, 20.0, 20.0); // Draw filled circle CGContextFillEllipseInRect(ctx, circle); - + // Stroke circle CGContextAddEllipseInRect(ctx, circle); CGContextStrokePath(ctx); - + // Stroke Chevron CGFloat chevronOffset = 4.0; - + CGContextBeginPath(ctx); CGContextMoveToPoint(ctx, 12.0 - chevronOffset, 12.0 - chevronOffset); CGContextAddLineToPoint(ctx, 12.0 + chevronOffset, 12.0); @@ -172,10 +172,10 @@ - (UIImage *)createTabButtonImageWithFillColor:(UIColor *)fillColor{ CGContextSetFillColorWithColor(ctx, [UIColor whiteColor].CGColor); CGContextFillPath(ctx); CGContextStrokePath(ctx); - + UIImage *buttonImage = UIGraphicsGetImageFromCurrentImageContext(); UIGraphicsEndImageContext(); - + return buttonImage; } @@ -196,10 +196,10 @@ - (void)resetTabButton{ if ([handleButtonBlinkTimer isValid]){ [handleButtonBlinkTimer invalidate]; } - + handleButtonBlinkTimer = nil; } - + self.handleButton.imageView.image = handleButtonImage; } @@ -217,8 +217,8 @@ - (void)blinkTabButton{ - (void)fadeAway:(NSTimer*)theTimer{ toolDrawerFadeTimer = nil; if (self.alpha == 1.0){ - [UIView animateWithDuration:0.5 - delay:0.0 + [UIView animateWithDuration:0.5 + delay:0.0 options:UIViewAnimationOptionCurveLinear | UIViewAnimationOptionAllowUserInteraction animations:^{ self.alpha = 0.5; } completion:nil]; @@ -232,16 +232,16 @@ - (void)resetFading{ - (void)resetFadeTimer{ [self resetTabButton]; - + // Make sure to clear out the timer if its running if (toolDrawerFadeTimer != nil){ if ([toolDrawerFadeTimer isValid]){ [toolDrawerFadeTimer invalidate]; } - + toolDrawerFadeTimer = nil; } - + // Start the timer again toolDrawerFadeTimer = [NSTimer scheduledTimerWithTimeInterval:self.durationToFade target:self @@ -253,10 +253,10 @@ - (void)resetFadeTimer{ #pragma mark #pragma mark Toolbar Items methods -- (UIButton *)appendItem:(NSString *)imageName{ +- (UIButton *)appendItem:(NSString *)imageName{ // Load source image / mask from file UIImage *maskImage = [UIImage imageNamed:imageName]; - + // Start a new image context UIGraphicsBeginImageContext(maskImage.size); CGContextRef ctx = UIGraphicsGetCurrentContext(); @@ -267,35 +267,35 @@ - (UIButton *)appendItem:(NSString *)imageName{ CGContextFillRect(ctx, CGRectMake(0.0, 0.0, maskImage.size.width, maskImage.size.height)); UIImage *finalImage = UIGraphicsGetImageFromCurrentImageContext(); UIGraphicsEndImageContext(); - + return [self appendImage:finalImage]; } - (UIButton *)appendImage:(UIImage *)img{ UIButton *button = [UIButton buttonWithType:UIButtonTypeCustom]; [button setImage:img forState:UIControlStateNormal]; - + [self appendButton:button]; - + return button; } -- (void)appendButton:(UIButton *)button{ +- (void)appendButton:(UIButton *)button{ int itemCount = self.subviews.count; - + CGRect bounds = self.bounds; bounds.size.width += 50.0; self.bounds = bounds; - + button.frame = CGRectMake(0.0, 0.0, 50.0, 50.0); button.center = CGPointMake(25.0 + (50.0 * (itemCount - 1)), 25.0); button.autoresizingMask = UIViewAutoresizingFlexibleRightMargin; button.transform = self.transform; - + [button addTarget:self action:@selector(resetFading) forControlEvents:UIControlEventTouchDown]; - + [self addSubview:button]; - + if (self.superview != nil){ [self computePositions]; } @@ -307,34 +307,34 @@ - (void)didMoveToSuperview{ CGRect r = self.superview.bounds; CGFloat w = r.size.width / 2.0; CGFloat h = r.size.height / 2.0; - + CGAffineTransform directionTransform; - + if (self.direction == kVertically){ directionTransform = CGAffineTransformMakeScale(-1.0, 1.0); directionTransform = CGAffineTransformConcat(directionTransform, CGAffineTransformMakeRotation(-(M_PI / 2.0))); } else { directionTransform = CGAffineTransformIdentity; } - + CGAffineTransform scaleTransform = CGAffineTransformMakeScale(self.horizontalCorner, self.verticalCorner); - + self.transform = CGAffineTransformConcat(directionTransform, scaleTransform); - + for(UIView *subview in self.subviews){ if (subview != handleButton){ subview.transform = CGAffineTransformInvert(self.transform); } } - + CGAffineTransform screenTransform; screenTransform = CGAffineTransformMakeTranslation(-w, -h); screenTransform = CGAffineTransformConcat(screenTransform, scaleTransform); screenTransform = CGAffineTransformConcat(screenTransform, CGAffineTransformMakeTranslation(w, h)); - - + + positionTransform = CGAffineTransformConcat(directionTransform, screenTransform); - + [self computePositions]; } @@ -360,13 +360,13 @@ - (void)close{ - (void)computePositions{ int itemCount = self.subviews.count - 1; - + openPosition = CGPointMake(self.bounds.size.width / 2.0, self.bounds.size.height / 2.0); closePosition = CGPointMake(openPosition.x - (50.0 * itemCount), openPosition.y); - + openPosition = CGPointApplyAffineTransform(openPosition, positionTransform); closePosition = CGPointApplyAffineTransform(closePosition, positionTransform); - + self.center = closePosition; } @@ -382,14 +382,14 @@ - (void)updatePosition{ } else { self.center = openPosition; } - + open = !open; - + // If the toolbar isn't at full brightness, ie alpha = 1.0, set it to 1.0 if (self.alpha != 1.0){ self.alpha = 1.0; } - + self.handleButton.transform = CGAffineTransformRotate(self.handleButton.transform, M_PI); } completion:nil];