From 4dc102a3cf0bb4572c67539afcb0391f74f45a48 Mon Sep 17 00:00:00 2001 From: Alexander Ljungberg Date: Tue, 28 Sep 2010 19:00:59 -0400 Subject: [PATCH] Applied coding standards. --- AppKit/CPAccordionView.j | 20 +++++++++--------- AppKit/CPApplication.j | 14 ++++++------- AppKit/CPBox.j | 8 ++++---- AppKit/CPBrowser.j | 44 +++++++++++++++++++--------------------- AppKit/CPButtonBar.j | 18 ++++++++-------- 5 files changed, 51 insertions(+), 53 deletions(-) diff --git a/AppKit/CPAccordionView.j b/AppKit/CPAccordionView.j index ec1798a67..4762499ec 100644 --- a/AppKit/CPAccordionView.j +++ b/AppKit/CPAccordionView.j @@ -33,9 +33,9 @@ /*! @ingroup appkit @class CPAccordionViewItem - +

A CPAccordionViewItem represents a single section of a CPAccordionView.

-*/ +*/ @implementation CPAccordionViewItem : CPObject { CPString _identifier @accessors(property=identifier); @@ -67,10 +67,10 @@ /*! @ingroup appkit @class CPAccordionView - +

CPAccordionView provides a container for CPAccordionViewItem objects and manages layout state for all sublayout items.

- + Example
 var myAccordionView = [[CPAccordionView alloc] initWithFrame:CGRectMakeZero()];
@@ -213,7 +213,7 @@ var secondItem = [[CPAccordionViewItem alloc] initWithIdentifier:@"secondSection
 
     if ([itemView isCollapsed])
         [self expandItemAtIndex:anIndex];
-    
+
     else
         [self collapseItemAtIndex:anIndex];
 }
@@ -237,12 +237,12 @@ var secondItem = [[CPAccordionViewItem alloc] initWithIdentifier:@"secondSection
     var itemView = _itemViews[anIndex];
     if (!itemView)
         return;
-    
+
     if (!isEnabled)
         [self collapseItemAtIndex:anIndex];
     else
         [self expandItemAtIndex:anIndex];
-    
+
     [itemView setEnabled:isEnabled];
 }
 
@@ -270,7 +270,7 @@ var secondItem = [[CPAccordionViewItem alloc] initWithIdentifier:@"secondSection
 {
     if (_items.length <= 0)
         return [self setFrameSize:_CGSizeMake(_CGRectGetWidth([self frame]), 0.0)];
-    
+
     if (_dirtyItemIndex === CPNotFound)
         return;
 
@@ -391,7 +391,7 @@ var secondItem = [[CPAccordionViewItem alloc] initWithIdentifier:@"secondSection
 
         [_contentView setFrameSize:_CGSizeMake(aWidth, contentHeight)];
         [self setFrame:_CGRectMake(0.0, aY, aWidth, contentHeight + headerHeight)];
-    }    
+    }
 }
 
 - (void)resizeSubviewsWithOldSize:(CGSize)aSize
@@ -408,7 +408,7 @@ var secondItem = [[CPAccordionViewItem alloc] initWithIdentifier:@"secondSection
 /*
     else if (aKeyPath === "itemHeaderPrototype")
     {
-        
+
     }
 */
 }
diff --git a/AppKit/CPApplication.j b/AppKit/CPApplication.j
index 6ac7d44ac..f962a8b6c 100644
--- a/AppKit/CPApplication.j
+++ b/AppKit/CPApplication.j
@@ -683,7 +683,7 @@ CPRunContinuesResponse  = -1002;
     if ([super tryToPerform:anAction with:anObject])
         return YES;
 
-    if([_delegate respondsToSelector:anAction])
+    if ([_delegate respondsToSelector:anAction])
     {
         [_delegate performSelector:anAction withObject:anObject];
 
@@ -873,8 +873,8 @@ CPRunContinuesResponse  = -1002;
 
     while (--count >= 0)
     {
-        var aWindow = [_windows objectAtIndex:count];
-        var context = aWindow._sheetContext;
+        var aWindow = [_windows objectAtIndex:count],
+            context = aWindow._sheetContext;
 
         if (context != nil && context["sheet"] === sheet)
         {
@@ -892,7 +892,7 @@ CPRunContinuesResponse  = -1002;
 
 - (CPArray)arguments
 {
-    if(_fullArgsString !== window.location.hash)
+    if (_fullArgsString !== window.location.hash)
         [self _reloadArguments];
 
     return _args;
@@ -900,7 +900,7 @@ CPRunContinuesResponse  = -1002;
 
 - (void)setArguments:(CPArray)args
 {
-    if(!args || args.length == 0)
+    if (!args || args.length == 0)
     {
         _args = [];
         window.location.hash = @"#";
@@ -908,13 +908,13 @@ CPRunContinuesResponse  = -1002;
         return;
     }
 
-    if([args class] != CPArray)
+    if ([args class] != CPArray)
         args = [CPArray arrayWithObject:args];
 
     _args = args;
 
     var toEncode = [_args copy];
-    for(var i=0, count = toEncode.length; i= _tableViews.length)
         return;
 
-    var oldValue = _tableViews.length - 1;
+    var oldValue = _tableViews.length - 1,
+        indexPlusOne = columnIndex + 1; // unloads all later columns.
 
-    // unloads all later columns.
-    var indexPlusOne = columnIndex + 1;
-
-    [[_tableViews.slice(indexPlusOne) valueForKey:"enclosingScrollView"] 
+    [[_tableViews.slice(indexPlusOne) valueForKey:"enclosingScrollView"]
       makeObjectsPerformSelector:@selector(removeFromSuperview)];
 
     _tableViews = _tableViews.slice(0, indexPlusOne);
@@ -196,10 +194,10 @@
         selectionIndexes = [lastColumn selectedRowIndexes];
 
     if (lastIndex >= 0 && [selectionIndexes count] > 1)
-        [CPException raise:CPInvalidArgumentException 
+        [CPException raise:CPInvalidArgumentException
                     reason:"Can't add column, column "+lastIndex+" has invalid selection."];
 
-    var index = lastIndex+1,
+    var index = lastIndex + 1,
         item = index === 0 ? _rootItem : [_tableDelegates[lastIndex] childAtIndex:[selectionIndexes firstIndex]];
 
     if (index > 0 && item && [self isLeafItem:item])
@@ -231,7 +229,7 @@
     [table setAction:@selector(_tableViewClicked:)];
     [table setDoubleAction:@selector(_tableViewDoubleClicked:)];
     [table setDraggingDestinationFeedbackStyle:CPTableViewDraggingDestinationFeedbackStyleRegular];
-    
+
     var scrollView = [[_CPBrowserScrollView alloc] initWithFrame:CGRectMakeZero()];
     [scrollView _setBrowser:self];
     [scrollView setDocumentView:table];
@@ -272,10 +270,10 @@
 
     [view setBranchImage:[[self class] branchImage]];
     [view setHighlightedBranchImage:[[self class] highlightedBranchImage]];
-    
+
     [column setDataView:view];
     [column setResizingMask:CPTableColumnNoResizing];
-    
+
     [aTableView addTableColumn:column];
 }
 
@@ -584,7 +582,7 @@
     if ([_delegate respondsToSelector:@selector(browser:selectionIndexesForProposedSelection:inColumn:)])
         indexSet = [_delegate browser:self selectionIndexesForProposedSelection:indexSet inColumn:column];
 
-    if ([_delegate respondsToSelector:@selector(browser:shouldSelectRowIndexes:inColumn:)] && 
+    if ([_delegate respondsToSelector:@selector(browser:shouldSelectRowIndexes:inColumn:)] &&
        ![_delegate browser:self shouldSelectRowIndexes:indexSet inColumn:column])
         return;
 
@@ -796,7 +794,7 @@ var _CPBrowserResizeControlBackgroundImage = nil;
 }
 
 - (void)moveLeft:(id)sender
-{    
+{
     var previousColumn = [_browser selectedColumn] - 1,
         selectedRow = [_browser selectedRowInColumn:previousColumn];
 
@@ -804,7 +802,7 @@ var _CPBrowserResizeControlBackgroundImage = nil;
 }
 
 - (void)moveRight:(id)sender
-{    
+{
     [_browser selectRow:0 inColumn:[_browser selectedColumn] + 1];
 }
 
@@ -921,9 +919,9 @@ var _CPBrowserResizeControlBackgroundImage = nil;
 {
     var imageView = [self layoutEphemeralSubviewNamed:@"image-view"
                                            positioned:CPWindowAbove
-                      relativeToEphemeralSubviewNamed:nil];
+                      relativeToEphemeralSubviewNamed:nil],
+        isHighlighted = [self themeState] & CPThemeStateSelectedDataView;
 
-    var isHighlighted = [self themeState] & CPThemeStateSelectedDataView;
     [imageView setImage: _isLeaf ? (isHighlighted ? _highlightedBranchImage : _branchImage) : nil];
     [imageView setImageScaling:CPScaleNone];
 }
diff --git a/AppKit/CPButtonBar.j b/AppKit/CPButtonBar.j
index 01aa1d833..138fffc71 100644
--- a/AppKit/CPButtonBar.j
+++ b/AppKit/CPButtonBar.j
@@ -197,12 +197,12 @@
         availableWidth = frameWidth - resizeWidth - 1;
 
     for (var i = 0, count = [buttonsNotHidden count]; i < count; i++)
-    {   
+    {
         var button = buttonsNotHidden[i],
             width = CGRectGetWidth([button frame]);
 
         if (availableWidth > width)
-            availableWidth -=width;
+            availableWidth -= width;
         else
             break;
 
@@ -217,15 +217,15 @@
             currentButtonOffset += width - 1;
         }
 
-        [button setValue:normalColor forThemeAttribute:@"bezel-color" inState:CPThemeStateNormal|CPThemeStateBordered];    
-        [button setValue:highlightedColor forThemeAttribute:@"bezel-color" inState:CPThemeStateHighlighted|CPThemeStateBordered];    
-        [button setValue:disabledColor forThemeAttribute:@"bezel-color" inState:CPThemeStateDisabled|CPThemeStateBordered];    
-        [button setValue:textColor forThemeAttribute:@"text-color" inState:CPThemeStateBordered];    
+        [button setValue:normalColor forThemeAttribute:@"bezel-color" inState:CPThemeStateNormal | CPThemeStateBordered];
+        [button setValue:highlightedColor forThemeAttribute:@"bezel-color" inState:CPThemeStateHighlighted | CPThemeStateBordered];
+        [button setValue:disabledColor forThemeAttribute:@"bezel-color" inState:CPThemeStateDisabled | CPThemeStateBordered];
+        [button setValue:textColor forThemeAttribute:@"text-color" inState:CPThemeStateBordered];
 
         // FIXME shouldn't need this
-        [button setValue:normalColor forThemeAttribute:@"bezel-color" inState:CPThemeStateNormal|CPThemeStateBordered|CPPopUpButtonStatePullsDown];    
-        [button setValue:highlightedColor forThemeAttribute:@"bezel-color" inState:CPThemeStateHighlighted|CPThemeStateBordered|CPPopUpButtonStatePullsDown];    
-        [button setValue:disabledColor forThemeAttribute:@"bezel-color" inState:CPThemeStateDisabled|CPThemeStateBordered|CPPopUpButtonStatePullsDown];    
+        [button setValue:normalColor forThemeAttribute:@"bezel-color" inState:CPThemeStateNormal | CPThemeStateBordered | CPPopUpButtonStatePullsDown];
+        [button setValue:highlightedColor forThemeAttribute:@"bezel-color" inState:CPThemeStateHighlighted | CPThemeStateBordered | CPPopUpButtonStatePullsDown];
+        [button setValue:disabledColor forThemeAttribute:@"bezel-color" inState:CPThemeStateDisabled | CPThemeStateBordered | CPPopUpButtonStatePullsDown];
 
         [self addSubview:button];
     }