From 86e0282011e98f8abc052ac08c15245ffcbe255a Mon Sep 17 00:00:00 2001 From: Antoine Mercadal Date: Fri, 18 Jan 2013 14:29:25 -0800 Subject: [PATCH] Fix nib2cib warnings --- Tools/nib2cib/Converter+Mac.j | 7 ++--- Tools/nib2cib/Converter.j | 2 ++ Tools/nib2cib/NSButton.j | 2 ++ Tools/nib2cib/NSClassSwapper.j | 2 ++ Tools/nib2cib/NSColor.j | 2 +- Tools/nib2cib/NSCustomObject.j | 3 ++- Tools/nib2cib/NSCustomResource.j | 2 ++ Tools/nib2cib/NSCustomView.j | 2 ++ Tools/nib2cib/NSMatrix.j | 1 + Tools/nib2cib/NSObjectController.j | 3 +++ Tools/nib2cib/NSSlider.j | 12 ++++----- Tools/nib2cib/NSSplitView.j | 6 ++--- Tools/nib2cib/NSStepper.j | 18 ++++++------- Tools/nib2cib/NSWindowTemplate.j | 43 +++++++++++++++--------------- Tools/nib2cib/Nib2Cib.j | 4 +++ 15 files changed, 65 insertions(+), 44 deletions(-) diff --git a/Tools/nib2cib/Converter+Mac.j b/Tools/nib2cib/Converter+Mac.j index 7c48b77c4..74941e149 100644 --- a/Tools/nib2cib/Converter+Mac.j +++ b/Tools/nib2cib/Converter+Mac.j @@ -22,6 +22,8 @@ @import "Converter.j" +@import "Nib2CibKeyedUnarchiver.j" +@import "NSFont.j" @implementation Converter (Mac) @@ -55,9 +57,8 @@ [object setFrameOrigin:CGPointMake(CGRectGetMinX(frame), superviewHeight - CGRectGetMaxY(frame))]; - var NS_autoresizingMask = [object autoresizingMask]; - - autoresizingMask = NS_autoresizingMask & ~(CPViewMaxYMargin | CPViewMinYMargin); + var NS_autoresizingMask = [object autoresizingMask], + autoresizingMask = NS_autoresizingMask & ~(CPViewMaxYMargin | CPViewMinYMargin); if (!(NS_autoresizingMask & (CPViewMaxYMargin | CPViewMinYMargin | CPViewHeightSizable))) autoresizingMask |= CPViewMinYMargin; diff --git a/Tools/nib2cib/Converter.j b/Tools/nib2cib/Converter.j index 096ee34b0..2ea4eab3e 100644 --- a/Tools/nib2cib/Converter.j +++ b/Tools/nib2cib/Converter.j @@ -24,6 +24,8 @@ @import @import +@global java + var FILE = require("file"), OS = require("os"), diff --git a/Tools/nib2cib/NSButton.j b/Tools/nib2cib/NSButton.j index 4b095bdce..198b3150b 100644 --- a/Tools/nib2cib/NSButton.j +++ b/Tools/nib2cib/NSButton.j @@ -30,6 +30,8 @@ @import "NSCell.j" @import "NSControl.j" +@global NIB_CONNECTION_EQUIVALENCY_TABLE + var NSButtonIsBorderedMask = 0x00800000, NSButtonAllowsMixedStateMask = 0x1000000, diff --git a/Tools/nib2cib/NSClassSwapper.j b/Tools/nib2cib/NSClassSwapper.j index 91e26c765..a833ff695 100644 --- a/Tools/nib2cib/NSClassSwapper.j +++ b/Tools/nib2cib/NSClassSwapper.j @@ -22,6 +22,8 @@ @import "Converter.j" +@global CP_NSMapClassName + var NSClassSwapperClassNames = {}, NSClassSwapperOriginalClassNames = {}; diff --git a/Tools/nib2cib/NSColor.j b/Tools/nib2cib/NSColor.j index c4d3c830c..a9016610b 100644 --- a/Tools/nib2cib/NSColor.j +++ b/Tools/nib2cib/NSColor.j @@ -120,7 +120,7 @@ var NSUnknownColorSpaceModel = -1, break; default: - CPLog.warn(@"-[%@ %s] unknown color space %d", isa, _cmd, colorSpace); + CPLog.warn(@"-[%@ %s] unknown color space %d", self.isa, _cmd, colorSpace); result = [CPColor blackColor]; break; } diff --git a/Tools/nib2cib/NSCustomObject.j b/Tools/nib2cib/NSCustomObject.j index e74ed9447..6c675b803 100644 --- a/Tools/nib2cib/NSCustomObject.j +++ b/Tools/nib2cib/NSCustomObject.j @@ -22,6 +22,7 @@ @import +@global CP_NSMapClassName @implementation _CPCibCustomObject (NSCoding) @@ -51,4 +52,4 @@ return [_CPCibCustomObject class]; } -@end \ No newline at end of file +@end diff --git a/Tools/nib2cib/NSCustomResource.j b/Tools/nib2cib/NSCustomResource.j index 3c1370f08..4c641e9cd 100644 --- a/Tools/nib2cib/NSCustomResource.j +++ b/Tools/nib2cib/NSCustomResource.j @@ -25,6 +25,8 @@ @import +@global CP_NSMapClassName + var FILE = require("file"), imageSize = require("cappuccino/imagesize").imagesize; diff --git a/Tools/nib2cib/NSCustomView.j b/Tools/nib2cib/NSCustomView.j index 5c7cf26a8..2c97c3c14 100644 --- a/Tools/nib2cib/NSCustomView.j +++ b/Tools/nib2cib/NSCustomView.j @@ -24,6 +24,8 @@ @import "NSView.j" +@global CP_NSMapClassName + var _CPCibCustomViewClassNameKey = @"_CPCibCustomViewClassNameKey"; diff --git a/Tools/nib2cib/NSMatrix.j b/Tools/nib2cib/NSMatrix.j index f3d09cdd0..4ee93c847 100644 --- a/Tools/nib2cib/NSMatrix.j +++ b/Tools/nib2cib/NSMatrix.j @@ -25,6 +25,7 @@ @import "NSView.j" +@global NIB_CONNECTION_EQUIVALENCY_TABLE var NSMatrixRadioModeMask = 0x40000000, NSMatrixDrawsBackgroundMask = 0x01000000; diff --git a/Tools/nib2cib/NSObjectController.j b/Tools/nib2cib/NSObjectController.j index c141df0e9..f711ab093 100644 --- a/Tools/nib2cib/NSObjectController.j +++ b/Tools/nib2cib/NSObjectController.j @@ -22,6 +22,9 @@ @import +@global CP_NSMapClassName + + @implementation CPObjectController (NSCoding) - (id)NS_initWithCoder:(CPCoder)aCoder diff --git a/Tools/nib2cib/NSSlider.j b/Tools/nib2cib/NSSlider.j index 683c10be5..a754ff432 100644 --- a/Tools/nib2cib/NSSlider.j +++ b/Tools/nib2cib/NSSlider.j @@ -84,14 +84,14 @@ if (self) { - _objectValue = [aCoder decodeDoubleForKey:@"NSValue"]; + self._objectValue = [aCoder decodeDoubleForKey:@"NSValue"]; - _minValue = [aCoder decodeDoubleForKey:@"NSMinValue"]; - _maxValue = [aCoder decodeDoubleForKey:@"NSMaxValue"]; - _altIncrementValue = [aCoder decodeDoubleForKey:@"NSAltIncValue"]; - _isVertical = [aCoder decodeBoolForKey:@"NSVertical"]; + self._minValue = [aCoder decodeDoubleForKey:@"NSMinValue"]; + self._maxValue = [aCoder decodeDoubleForKey:@"NSMaxValue"]; + self._altIncrementValue = [aCoder decodeDoubleForKey:@"NSAltIncValue"]; + self._isVertical = [aCoder decodeBoolForKey:@"NSVertical"]; - _sliderType = [aCoder decodeIntForKey:@"NSSliderType"]; + self._sliderType = [aCoder decodeIntForKey:@"NSSliderType"]; } return self; diff --git a/Tools/nib2cib/NSSplitView.j b/Tools/nib2cib/NSSplitView.j index 741b970af..95961cf5f 100644 --- a/Tools/nib2cib/NSSplitView.j +++ b/Tools/nib2cib/NSSplitView.j @@ -30,14 +30,14 @@ var NSThinDividerStyle = 2; { if (self = [super NS_initWithCoder:aCoder]) { - _isVertical = [aCoder decodeBoolForKey:@"NSIsVertical"]; + self._isVertical = [aCoder decodeBoolForKey:@"NSIsVertical"]; // The possible values appear to be: no value (thick divider), 2 (thin divider) and 3 (pane splitter). For // Cappuccino's purposes we treat thick divider and pane splitter as the same thing since the only difference // seems to be graphical. - _isPaneSplitter = [aCoder decodeIntForKey:@"NSDividerStyle"] != NSThinDividerStyle; + self._isPaneSplitter = [aCoder decodeIntForKey:@"NSDividerStyle"] != NSThinDividerStyle; - _autosaveName = [aCoder decodeObjectForKey:@"NSAutosaveName"]; + self._autosaveName = [aCoder decodeObjectForKey:@"NSAutosaveName"]; } return self; diff --git a/Tools/nib2cib/NSStepper.j b/Tools/nib2cib/NSStepper.j index c5b3746ae..d1146a583 100644 --- a/Tools/nib2cib/NSStepper.j +++ b/Tools/nib2cib/NSStepper.j @@ -32,17 +32,17 @@ { var cell = [aCoder decodeObjectForKey:@"NSCell"]; - _minValue = [cell minValue]; - _maxValue = [cell maxValue]; - _increment = [cell increment]; - _valueWraps = [cell valueWraps]; - _autorepeat = [cell autorepeat]; - _objectValue = [cell objectValue]; + self._minValue = [cell minValue]; + self._maxValue = [cell maxValue]; + self._increment = [cell increment]; + self._valueWraps = [cell valueWraps]; + self._autorepeat = [cell autorepeat]; + self._objectValue = [cell objectValue]; // Convert Cocoa normal size to Cappuccino normal size. - _frame.origin.y += 2; - _frame.size.height -= 2; - _bounds.size.height -= 2; + self._frame.origin.y += 2; + self._frame.size.height -= 2; + self._bounds.size.height -= 2; } return self; diff --git a/Tools/nib2cib/NSWindowTemplate.j b/Tools/nib2cib/NSWindowTemplate.j index 7f8df2686..2ebd5630d 100644 --- a/Tools/nib2cib/NSWindowTemplate.j +++ b/Tools/nib2cib/NSWindowTemplate.j @@ -22,6 +22,7 @@ @import +@global CP_NSMapClassName var NSBorderlessWindowMask = 0x00, NSTitledWindowMask = 0x01, @@ -54,36 +55,36 @@ var NSBorderlessWindowMask = 0x00, if ([aCoder containsValueForKey:@"NSMaxSize"]) _maxSize = [aCoder decodeSizeForKey:@"NSMaxSize"]; - _screenRect = [aCoder decodeRectForKey:@"NSScreenRect"]; // screen created on - _viewClass = [aCoder decodeObjectForKey:@"NSViewClass"]; // references the toolbar if present (anything else?) - _wtFlags = [aCoder decodeIntForKey:@"NSWTFlags"]; - _windowAutorecalculatesKeyViewLoop = !!(_wtFlags & NSAutorecalculatesKeyViewLoopWTFlag); - _windowBacking = [aCoder decodeIntForKey:@"NSWindowBacking"]; + self._screenRect = [aCoder decodeRectForKey:@"NSScreenRect"]; // screen created on + self._viewClass = [aCoder decodeObjectForKey:@"NSViewClass"]; // references the toolbar if present (anything else?) + self._wtFlags = [aCoder decodeIntForKey:@"NSWTFlags"]; + self._windowAutorecalculatesKeyViewLoop = !!(_wtFlags & NSAutorecalculatesKeyViewLoopWTFlag); + self._windowBacking = [aCoder decodeIntForKey:@"NSWindowBacking"]; // Convert NSWindows to CPWindows. - _windowClass = CP_NSMapClassName([aCoder decodeObjectForKey:@"NSWindowClass"]); + self._windowClass = CP_NSMapClassName([aCoder decodeObjectForKey:@"NSWindowClass"]); - _windowRect = [aCoder decodeRectForKey:@"NSWindowRect"]; - _windowStyleMask = [aCoder decodeIntForKey:@"NSWindowStyleMask"]; - _windowTitle = [aCoder decodeObjectForKey:@"NSWindowTitle"]; - _windowView = [aCoder decodeObjectForKey:@"NSWindowView"]; + self._windowRect = [aCoder decodeRectForKey:@"NSWindowRect"]; + self._windowStyleMask = [aCoder decodeIntForKey:@"NSWindowStyleMask"]; + self._windowTitle = [aCoder decodeObjectForKey:@"NSWindowTitle"]; + self._windowView = [aCoder decodeObjectForKey:@"NSWindowView"]; // Flip Y coordinate - _windowRect.origin.y = _screenRect.size.height - _windowRect.origin.y - _windowRect.size.height; + self._windowRect.origin.y = self._screenRect.size.height - self._windowRect.origin.y - self._windowRect.size.height; - if (_windowStyleMask === NSBorderlessWindowMask) - _windowStyleMask = CPBorderlessWindowMask; + if (self._windowStyleMask === NSBorderlessWindowMask) + self._windowStyleMask = CPBorderlessWindowMask; else - _windowStyleMask = (_windowStyleMask & NSTitledWindowMask ? CPTitledWindowMask : 0) | - (_windowStyleMask & NSClosableWindowMask ? CPClosableWindowMask : 0) | - (_windowStyleMask & NSMiniaturizableWindowMask ? CPMiniaturizableWindowMask : 0) | - (_windowStyleMask & NSResizableWindowMask ? CPResizableWindowMask : 0) | - (_windowStyleMask & NSTexturedBackgroundWindowMask ? NSTexturedBackgroundWindowMask : 0) | - (_windowStyleMask & NSDocModalWindowMask ? CPDocModalWindowMask : 0) | - (_windowStyleMask & NSHUDBackgroundWindowMask ? CPHUDBackgroundWindowMask : 0); + self._windowStyleMask = (self._windowStyleMask & NSTitledWindowMask ? CPTitledWindowMask : 0) | + (self._windowStyleMask & NSClosableWindowMask ? CPClosableWindowMask : 0) | + (self._windowStyleMask & NSMiniaturizableWindowMask ? CPMiniaturizableWindowMask : 0) | + (self._windowStyleMask & NSResizableWindowMask ? CPResizableWindowMask : 0) | + (self._windowStyleMask & NSTexturedBackgroundWindowMask ? NSTexturedBackgroundWindowMask : 0) | + (self._windowStyleMask & NSDocModalWindowMask ? CPDocModalWindowMask : 0) | + (self._windowStyleMask & NSHUDBackgroundWindowMask ? CPHUDBackgroundWindowMask : 0); - _windowIsFullBridge = [aCoder decodeObjectForKey:"NSFrameAutosaveName"] === "CPBorderlessBridgeWindowMask"; + self._windowIsFullBridge = [aCoder decodeObjectForKey:"NSFrameAutosaveName"] === "CPBorderlessBridgeWindowMask"; /*if (![_windowClass isEqualToString:@"NSPanel"]) _windowRect.origin.y -= [NSMainMenuView menuHeight]; // compensation for the additional menu bar diff --git a/Tools/nib2cib/Nib2Cib.j b/Tools/nib2cib/Nib2Cib.j index 6072893c7..d51cae78d 100644 --- a/Tools/nib2cib/Nib2Cib.j +++ b/Tools/nib2cib/Nib2Cib.j @@ -391,6 +391,8 @@ var FILE = require("file"), - (void)printOptions:options { + var option; + for (option in options) { var value = options[option]; @@ -408,6 +410,8 @@ var FILE = require("file"), // Merges properties in sourceOptions into targetOptions, overriding properties in targetOptions - (void)mergeOptions:(JSObject)sourceOptions with:(JSObject)targetOptions { + var option; + for (option in sourceOptions) { // Make sure only a supported option is given