Skip to content

Commit

Permalink
Beta 1
Browse files Browse the repository at this point in the history
Added global keyboard Shortcuts
Added gestureRecognizer property to allow for custom gestureRecognizers
Added options to turn of status bar and keyboard shortcuts
Added property descriptions

Signed-off-by: Patrick Richards <pat@domesticcat.com.au>
  • Loading branch information
domesticcatsoftware committed May 3, 2011
1 parent 2f6abe2 commit 049dd29
Show file tree
Hide file tree
Showing 9 changed files with 5,725 additions and 4,981 deletions.
29 changes: 17 additions & 12 deletions DCIntrospect/DCFrameView.m
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,8 @@ - (void)drawRect:(CGRect)rect
return;
}

if (CGRectIsEmpty(self.mainRect))
return;
CGRect mainRectOffset = CGRectOffset(mainRect, -superRect.origin.x, -superRect.origin.y);

BOOL showAntialiasingWarning = NO;
Expand Down Expand Up @@ -122,7 +124,7 @@ - (void)drawRect:(CGRect)rect
CGContextMoveToPoint(context, self.superRect.origin.x, floorf(CGRectGetMidY(newMainRect)) + 0.5);
CGContextAddLineToPoint(context, newMainRect.origin.x - 2.0, floorf(CGRectGetMidY(newMainRect)) + 0.5);
CGContextStrokePath(context);
NSLog(@"%f", self.mainRect.origin.x);

if (self.mainRect.origin.x > 0)
{
NSString *leftDistanceString = (showAntialiasingWarning) ? [NSString stringWithFormat:@"%.1f", mainRectOffset.origin.x] : [NSString stringWithFormat:@"%.0f", mainRectOffset.origin.x];
Expand Down Expand Up @@ -150,16 +152,20 @@ - (void)drawRect:(CGRect)rect
}

// edge->top side
CGContextMoveToPoint(context, floorf(CGRectGetMidX(newMainRect)) + 0.5, self.superRect.origin.y);
CGContextAddLineToPoint(context, floorf(CGRectGetMidX(newMainRect)) + 0.5, CGRectGetMinY(newMainRect));
CGContextStrokePath(context);
NSString *topDistanceString = (showAntialiasingWarning) ? [NSString stringWithFormat:@"%.1f", mainRectOffset.origin.y] : [NSString stringWithFormat:@"%.0f", mainRectOffset.origin.y];
CGSize topDistanceStringSize = [topDistanceString sizeWithFont:font];
[topDistanceString drawInRect:CGRectMake(floorf(CGRectGetMidX(newMainRect)) + 3.0,
floorf(CGRectGetMinY(self.superRect)),
topDistanceStringSize.width,
topDistanceStringSize.height)
withFont:font];
NSLog(@"mro: %f", mainRectOffset.origin.y);
if (mainRectOffset.origin.y > 0)
{
CGContextMoveToPoint(context, floorf(CGRectGetMidX(newMainRect)) + 0.5, self.superRect.origin.y);
CGContextAddLineToPoint(context, floorf(CGRectGetMidX(newMainRect)) + 0.5, CGRectGetMinY(newMainRect));
CGContextStrokePath(context);
NSString *topDistanceString = (showAntialiasingWarning) ? [NSString stringWithFormat:@"%.1f", mainRectOffset.origin.y] : [NSString stringWithFormat:@"%.0f", mainRectOffset.origin.y];
CGSize topDistanceStringSize = [topDistanceString sizeWithFont:font];
[topDistanceString drawInRect:CGRectMake(floorf(CGRectGetMidX(newMainRect)) + 3.0,
floorf(CGRectGetMinY(self.superRect)),
topDistanceStringSize.width,
topDistanceStringSize.height)
withFont:font];
}

// bottom side->edge
if (CGRectGetMaxY(newMainRect) < CGRectGetMaxY(self.superRect))
Expand All @@ -168,7 +174,6 @@ - (void)drawRect:(CGRect)rect
CGContextAddLineToPoint(context, floorf(CGRectGetMidX(newMainRect)) + 0.5, CGRectGetMaxY(self.superRect));
CGContextStrokePath(context);
NSString *bottomDistanceString = (showAntialiasingWarning) ? [NSString stringWithFormat:@"%.1f", CGRectGetMaxY(self.superRect) - CGRectGetMaxY(mainRectOffset)] : [NSString stringWithFormat:@"%.0f", self.superRect.size.height - mainRectOffset.origin.y - mainRectOffset.size.height];
NSLog(@"super: %@ mainRectOffset: %@", NSStringFromCGRect(self.superRect), NSStringFromCGRect(mainRectOffset));
CGSize bottomDistanceStringSize = [bottomDistanceString sizeWithFont:font];
[bottomDistanceString drawInRect:CGRectMake(floorf(CGRectGetMidX(newMainRect)) + 3.0,
floorf(CGRectGetMaxY(self.superRect)) - bottomDistanceStringSize.height - 1.0,
Expand Down
45 changes: 37 additions & 8 deletions DCIntrospect/DCIntrospect.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,13 @@

}

@property (nonatomic) BOOL keyboardShortcuts; // default: YES
@property (nonatomic) BOOL showStatusBarOverlay; // default: YES
@property (nonatomic, retain) UIGestureRecognizer *gestureRecognizer;

@property (nonatomic) BOOL on;
@property (nonatomic) BOOL outlinesOn;
@property (nonatomic) BOOL opaqueViewsOn;
@property (nonatomic, retain) DCFrameView *frameView;
@property (nonatomic, retain) UIScrollView *toolbar;
@property (nonatomic, retain) UITextField *inputField;
Expand All @@ -35,20 +40,49 @@
// Introspector //
//////////////////

- (void)introspectorInvoked:(UIGestureRecognizer *)gestureRecognizer;
- (void)introspectorInvoked:(UIGestureRecognizer *)aGestureRecognizer; // can be manually invoked with nil ([[DCIntrospect sharedIntrospector introspectorInvoked:nil];)
- (void)updateFrameView;
- (void)updateStatusBar;
- (void)updateStatusBarFrame;
- (void)touchAtPoint:(CGPoint)point;
- (void)setGestureRecognizer:(UIGestureRecognizer *)newGestureRecognizer;

///////////
// Tools //
///////////

- (void)toggleTools;
- (void)logDescriptionForCurrentView;
- (void)toggleOutlines:(id)sender;
- (void)updateToolbar;
- (void)logRecursiveDescriptionForCurrentView;
- (void)forceSetNeedsDisplay;
- (void)forceSetNeedsLayout;
- (void)forceReload;
- (void)toggleOutlines;
- (void)toggleOpaqueViews;
- (void)setBackgroundColor:(UIColor *)color ofOpaqueViewsInSubview:(UIView *)view;
- (void)addOutlinesToFrameViewFromSubview:(UIView *)view;

//////////////////
// Experimental //
//////////////////

- (void)logPropertiesForCurrentView;
- (BOOL)ignoreView:(UIView *)view;
- (NSArray *)subclassesOfClass:(Class)parentClass;

//////////////////////
// Keyboard Capture //
//////////////////////

- (BOOL)textField:(UITextField *)textField shouldChangeCharactersInRange:(NSRange)range replacementString:(NSString *)string;

/////////////////////////
// Description Methods //
/////////////////////////

- (NSString *)describeProperty:(NSString *)propertyName value:(int)value;
- (NSString *)describeColor:(UIColor *)color;

////////////////////
// Helper Methods //
////////////////////
Expand All @@ -57,10 +91,5 @@
- (NSMutableArray *)viewsAtPoint:(CGPoint)touchPoint inView:(UIView *)view;
- (void)fadeView:(UIView *)view toAlpha:(CGFloat)alpha;

// Unused/experimental

- (void)describePropertiesForCurrentView;
- (NSString *)prettyDescriptionForProperty:(NSString *)propertyName value:(int)value;
- (BOOL)ignoreView:(UIView *)view;

@end
Loading

0 comments on commit 049dd29

Please sign in to comment.