Skip to content

Commit

Permalink
fix some spacing issues (tab vs space)
Browse files Browse the repository at this point in the history
  • Loading branch information
joesavage committed Nov 13, 2014
1 parent c58e049 commit 54d7e46
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 12 deletions.
20 changes: 10 additions & 10 deletions Binspect/SBCurveView.m
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,9 @@ @implementation SBCurveView
- (void) awakeFromNib {
// Track mouse entering, exiting, and movement when our window is the key window
NSTrackingArea *trackingArea = [[NSTrackingArea alloc] initWithRect:self.bounds
options:NSTrackingMouseEnteredAndExited | NSTrackingMouseMoved |NSTrackingActiveInKeyWindow
owner:self
userInfo:nil];
options:NSTrackingMouseEnteredAndExited | NSTrackingMouseMoved |NSTrackingActiveInKeyWindow
owner:self
userInfo:nil];
[self addTrackingArea:trackingArea];
[trackingArea release];

Expand Down Expand Up @@ -114,7 +114,7 @@ - (NSUInteger) calculateHilbertChunkWidth:(NSUInteger)maxWidth {
// A method to get the index of the byte that the user is currenly hovering over in the view
- (NSUInteger) getIndexOfCurrentlyHoveredByte {
NSUInteger index = 0,
maxWidth = _viewBounds.width / _pointSize;
maxWidth = _viewBounds.width / _pointSize;

// Adjust the mouse positions to our curve view grid scale, with some adjustments in Y for accuracy
_mousePosition.x = (NSUInteger)(_mousePosition.x / _pointSize);
Expand All @@ -124,8 +124,8 @@ - (NSUInteger) getIndexOfCurrentlyHoveredByte {
// For getting the hovered index on a Hilbert curve, the positions need to be 'un-chunked' to get
// the correct value from 'getHilbertCurveIndex: for Coords:' which expects a square curve
NSUInteger hilbertWidth = [self calculateHilbertChunkWidth:maxWidth],
chunkArea = (hilbertWidth * hilbertWidth),
chunkIndex = (NSUInteger)(_mousePosition.y / hilbertWidth);
chunkArea = (hilbertWidth * hilbertWidth),
chunkIndex = (NSUInteger)(_mousePosition.y / hilbertWidth);
CGPoint hilbertPoint = _mousePosition;
hilbertPoint.y = (NSUInteger)_mousePosition.y % hilbertWidth;
index = chunkIndex*chunkArea + [SBCurveView getHilbertCurveIndex:chunkArea forCoords:hilbertPoint];
Expand Down Expand Up @@ -153,13 +153,13 @@ - (void) setCurveType:(SBCurveViewType)type {
// I wouldn't recommend using this chunking method (and instead enabling horizontal scrolling
// of a square curve) for _pointSize values which are not of this type.
NSUInteger maxWidth = _viewBounds.width / _pointSize,
chunkWidth = [self calculateHilbertChunkWidth:maxWidth],
chunks = ceilf((float)_data.length / (float)(maxWidth * maxWidth));
chunkWidth = [self calculateHilbertChunkWidth:maxWidth],
chunks = ceilf((float)_data.length / (float)(maxWidth * maxWidth));

// Set the vertex array values for each chunk
for(NSUInteger chunk = 0; chunk < chunks; chunk++) {
NSUInteger currentChunkArea = chunkWidth * chunkWidth,
lastPointCovered = chunkWidth * chunkWidth * chunk;
lastPointCovered = chunkWidth * chunkWidth * chunk;
if (chunk + 1 == chunks) currentChunkArea = _data.length - lastPointCovered;

// For each byte in this chunk, set the position as determined by 'getHilbertCurveCoordinates: forIndex:',
Expand Down Expand Up @@ -422,7 +422,7 @@ - (void) draw
- (void) setScrollPosition:(float)position {
// Define the minimum and maximum scroll positions
NSUInteger minScrollPosition = 0,
maxScrollPosition = ceilf(_data.length / (_viewBounds.width / _pointSize)) * _pointSize;
maxScrollPosition = ceilf(_data.length / (_viewBounds.width / _pointSize)) * _pointSize;

// Adjust the maximum scroll position such that the user can't scroll to a fully white screen
if (maxScrollPosition >= _viewBounds.height / 4.0f) maxScrollPosition -= (_viewBounds.height / 4.0f);
Expand Down
4 changes: 2 additions & 2 deletions Binspect/SBWindowController.m
Original file line number Diff line number Diff line change
Expand Up @@ -256,8 +256,8 @@ - (void) curveViewMouseMovedToInvalidIndex {
// A delegate method for _curveView, invoked when the user hovers their mouse over a valid visualised byte in the view.
- (void) curveViewMouseMovedToIndex:(NSInteger)index {
NSUInteger regionStartIndex = index,
regionEndIndex = index + _hoverRegionSize,
maximumDataIndex = _data.length - 1;
regionEndIndex = index + _hoverRegionSize,
maximumDataIndex = _data.length - 1;

// If the selected region spans over the end of the data, move the indices back so it doesn't.
if (regionEndIndex > maximumDataIndex) {
Expand Down

0 comments on commit 54d7e46

Please sign in to comment.