From 4f377bcebed5c51cdf6e84aaf224d6d9632b7b3d Mon Sep 17 00:00:00 2001 From: Aparajita Fishman Date: Tue, 22 Jan 2013 20:41:07 +0700 Subject: [PATCH] Objj2 compiler fixes Compiled all files individually: - Added missing imports. - Added @class/@global declarations to break circular dependencies. - Misc. code cleanup. Conflicts: AppKit/CPWindow/_CPWindow.j AppKit/Platform/DOM/CPPlatformWindow+DOM.j --- AppKit/CPAlert.j | 2 +- AppKit/CPApplication.j | 10 +- AppKit/CPBrowser.j | 5 +- AppKit/CPButtonBar.j | 4 +- AppKit/CPCollectionView.j | 6 +- AppKit/CPColorPanel.j | 24 +- AppKit/CPColorSpace.j | 2 + AppKit/CPControl.j | 1 + AppKit/CPDocument.j | 4 +- AppKit/CPDocumentController.j | 1 + AppKit/CPDragServer.j | 12 +- AppKit/CPDragServer_Constants.j | 30 ++ AppKit/CPEvent.j | 3 + AppKit/CPFontManager.j | 2 + AppKit/CPGradient.j | 9 + AppKit/CPImage.j | 1 + AppKit/CPKeyBinding.j | 1 + AppKit/CPLevelIndicator.j | 3 + AppKit/CPMenu/CPMenu.j | 5 - AppKit/CPMenu/_CPMenuBarWindow.j | 128 ++------- AppKit/CPMenu/_CPMenuManager.j | 31 +- AppKit/CPMenu/_CPMenuWindow.j | 26 +- AppKit/CPMenuItem/CPMenuItem.j | 41 +-- AppKit/CPMenuItem/_CPMenuItemMenuBarView.j | 25 +- AppKit/CPMenuItem/_CPMenuItemSeparatorView.j | 23 +- AppKit/CPMenuItem/_CPMenuItemStandardView.j | 24 ++ AppKit/CPMenuItem/_CPMenuItemView.j | 21 ++ AppKit/CPObjectController.j | 1 + AppKit/CPOutlineView.j | 3 +- AppKit/CPPasteboard.j | 1 + AppKit/CPProgressIndicator.j | 1 + AppKit/CPRadio.j | 2 + AppKit/CPResponder.j | 3 + .../CPPredicateEditorRowTemplate.j | 6 + AppKit/CPRuleEditor/CPRuleEditor.j | 22 +- AppKit/CPRuleEditor/CPRuleEditor_Constants.j | 40 +++ .../CPRuleEditor/_CPPredicateEditorRowNode.j | 22 +- AppKit/CPRuleEditor/_CPPredicateEditorTree.j | 21 +- AppKit/CPRuleEditor/_CPRuleEditorLocalizer.j | 20 +- .../CPRuleEditor/_CPRuleEditorPopUpButton.j | 21 +- AppKit/CPRuleEditor/_CPRuleEditorViewSlice.j | 18 +- .../CPRuleEditor/_CPRuleEditorViewSliceRow.j | 25 +- AppKit/CPScroller.j | 5 +- AppKit/CPSearchField.j | 3 + AppKit/CPSegmentedControl.j | 3 + AppKit/CPShadowView.j | 1 - AppKit/CPSlider.j | 1 + AppKit/CPSliderColorPicker.j | 6 +- AppKit/CPSound.j | 1 + AppKit/CPStringDrawing.j | 1 + AppKit/CPTableColumn.j | 4 +- AppKit/CPTableHeaderView.j | 11 +- AppKit/CPTableView.j | 26 +- AppKit/CPTextField.j | 13 +- AppKit/CPTokenField.j | 4 +- AppKit/CPToolbar.j | 1 + AppKit/CPUserDefaultsController.j | 4 +- AppKit/CPViewController.j | 1 - AppKit/CPWindow/CPWindow.j | 2 +- AppKit/CPWindow/CPWindow_Constants.j | 191 +++++++++++++ AppKit/CPWindow/_CPDocModalWindowView.j | 22 ++ AppKit/CPWindow/_CPHUDWindowView.j | 2 + AppKit/CPWindow/_CPModalWindowView.j | 1 + AppKit/CPWindow/_CPShadowWindowView.j | 1 + AppKit/CPWindow/_CPStandardWindowView.j | 7 +- AppKit/CPWindow/_CPWindow.j | 192 +------------ AppKit/CPWindow/_CPWindowView.j | 52 ++-- AppKit/CPWindowController.j | 2 +- AppKit/Cib/CPCib.j | 2 +- AppKit/Cib/CPCibLoading.j | 1 + AppKit/Cib/_CPCibCustomObject.j | 22 ++ AppKit/Cib/_CPCibCustomResource.j | 4 + AppKit/Cib/_CPCibKeyedUnarchiver.j | 21 ++ AppKit/Cib/_CPCibProxyObject.j | 21 ++ AppKit/Cib/_CPCibWindowTemplate.j | 37 ++- AppKit/CoreAnimation/CALayer.j | 1 + AppKit/Platform/CPPlatformWindow.j | 3 +- AppKit/Platform/DOM/CPPlatformWindow+DOM.j | 267 +++++++++--------- AppKit/_CPPopUpListDataSource.j | 2 + AppKit/_CPToolTip.j | 2 + AppKit/_CPToolbarItem.j | 1 + AppKit/_CPToolbarShowColorsItem.j | 2 +- Tools/nib2cib/NSWindowTemplate.j | 2 +- 83 files changed, 996 insertions(+), 599 deletions(-) create mode 100644 AppKit/CPDragServer_Constants.j create mode 100644 AppKit/CPRuleEditor/CPRuleEditor_Constants.j create mode 100644 AppKit/CPWindow/CPWindow_Constants.j diff --git a/AppKit/CPAlert.j b/AppKit/CPAlert.j index b6f8020eb..55ff0425f 100644 --- a/AppKit/CPAlert.j +++ b/AppKit/CPAlert.j @@ -28,7 +28,6 @@ @import @import -@import "CPApplication.j" @import "CPButton.j" @import "CPColor.j" @import "CPFont.j" @@ -39,6 +38,7 @@ @class CPCheckBox +@global CPApp /* @global diff --git a/AppKit/CPApplication.j b/AppKit/CPApplication.j index 5b520a121..fef213203 100644 --- a/AppKit/CPApplication.j +++ b/AppKit/CPApplication.j @@ -25,17 +25,17 @@ @import @import "CPCompatibility.j" +@import "CPColorPanel.j" +@import "CPCursor.j" +@import "CPDocumentController.j" @import "CPEvent.j" @import "CPMenu.j" @import "CPResponder.j" -@import "CPDocumentController.j" @import "CPThemeBlend.j" @import "CPCibLoading.j" +@import "CPPanel.j" @import "CPPlatform.j" - -@class CPCursor -@class CPColorPanel - +@import "CPWindowController.j" var CPMainCibFile = @"CPMainCibFile", CPMainCibFileHumanFriendly = @"Main cib file base name", diff --git a/AppKit/CPBrowser.j b/AppKit/CPBrowser.j index f2562539e..017d57095 100644 --- a/AppKit/CPBrowser.j +++ b/AppKit/CPBrowser.j @@ -24,15 +24,16 @@ @import "CPControl.j" @import "CPImage.j" +@import "CPScrollView.j" @import "CPTableView.j" @import "CPTextField.j" -@import "CPScrollView.j" + +@global CPApp /*! @ingroup appkit @class CPBrowser */ - @implementation CPBrowser : CPControl { id _delegate; diff --git a/AppKit/CPButtonBar.j b/AppKit/CPButtonBar.j index 5733011cb..8a0249881 100644 --- a/AppKit/CPButtonBar.j +++ b/AppKit/CPButtonBar.j @@ -3,7 +3,7 @@ * AppKit * * Created by Francisco Tolmasky. - * Copyright 2008, 280 North, Inc. + * Copyright 2009, 280 North, Inc. * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -21,10 +21,10 @@ */ @import "CPView.j" +@import "CPWindow_Constants.j" @class CPSplitView -@global CPWindowAbove @global CPPopUpButtonStatePullsDown diff --git a/AppKit/CPCollectionView.j b/AppKit/CPCollectionView.j index e1c934f4c..51c9f8b3f 100644 --- a/AppKit/CPCollectionView.j +++ b/AppKit/CPCollectionView.j @@ -26,9 +26,13 @@ @import @import -@import "CPView.j" @import "CPCollectionViewItem.j" @import "CPCompatibility.j" +@import "CPPasteboard.j" +@import "CPView.j" + +@class CPClipView + /*! @ingroup appkit diff --git a/AppKit/CPColorPanel.j b/AppKit/CPColorPanel.j index 3c6cb781c..a3959ecaa 100644 --- a/AppKit/CPColorPanel.j +++ b/AppKit/CPColorPanel.j @@ -20,7 +20,6 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ -@import "CPApplication.j" @import "CPButton.j" @import "CPCookie.j" @import "CPPanel.j" @@ -28,17 +27,7 @@ @class CPSlider - -CPColorPanelColorDidChangeNotification = @"CPColorPanelColorDidChangeNotification"; - -var PREVIEW_HEIGHT = 20.0, - TOOLBAR_HEIGHT = 32.0, - SWATCH_HEIGHT = 14.0, - ICON_WIDTH = 32.0, - ICON_PADDING = 12.0; - -var SharedColorPanel = nil, - ColorPickerClasses = []; +@global CPApp /* A color wheel @@ -56,6 +45,17 @@ CPSliderColorPickerMode = 2; CPColorPickerViewWidth = 265; CPColorPickerViewHeight = 370; +CPColorPanelColorDidChangeNotification = @"CPColorPanelColorDidChangeNotification"; + +var PREVIEW_HEIGHT = 20.0, + TOOLBAR_HEIGHT = 32.0, + SWATCH_HEIGHT = 14.0, + ICON_WIDTH = 32.0, + ICON_PADDING = 12.0; + +var SharedColorPanel = nil, + ColorPickerClasses = []; + /*! @ingroup appkit @class CPColorPanel diff --git a/AppKit/CPColorSpace.j b/AppKit/CPColorSpace.j index 536258646..efd2f02eb 100644 --- a/AppKit/CPColorSpace.j +++ b/AppKit/CPColorSpace.j @@ -20,6 +20,8 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ +@import + var sRGBColorSpace = nil; /*! diff --git a/AppKit/CPControl.j b/AppKit/CPControl.j index 1fc6664c1..b668bd5d2 100644 --- a/AppKit/CPControl.j +++ b/AppKit/CPControl.j @@ -24,6 +24,7 @@ @import @import + @import "CPFont.j" @import "CPShadow.j" @import "CPView.j" diff --git a/AppKit/CPDocument.j b/AppKit/CPDocument.j index 3b0be22b2..e8dfaed6c 100644 --- a/AppKit/CPDocument.j +++ b/AppKit/CPDocument.j @@ -23,17 +23,15 @@ @import @import -@import "CPApplication.j" +@import "CPAlert.j" @import "CPResponder.j" @import "CPSavePanel.j" @import "CPViewController.j" @import "CPWindowController.j" @class CPDocumentController -@class CPAlert @global CPApp -@global CPWarningAlertStyle /* diff --git a/AppKit/CPDocumentController.j b/AppKit/CPDocumentController.j index 41e7537b0..f85574fe7 100644 --- a/AppKit/CPDocumentController.j +++ b/AppKit/CPDocumentController.j @@ -26,6 +26,7 @@ @import "CPDocument.j" @import "CPOpenPanel.j" @import "CPMenuItem.j" +@import "CPWindowController.j" @global CPApp diff --git a/AppKit/CPDragServer.j b/AppKit/CPDragServer.j index b8697c018..cde39ce54 100644 --- a/AppKit/CPDragServer.j +++ b/AppKit/CPDragServer.j @@ -20,7 +20,7 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ -@import "CPApplication.j" +@import "CPDragServer_Constants.j" @import "CPEvent.j" @import "CPImageView.j" @import "CPPasteboard.j" @@ -29,15 +29,7 @@ @class _CPDOMDataTransferPasteboard - -CPDragOperationNone = 0; -CPDragOperationCopy = 1 << 1; -CPDragOperationLink = 1 << 1; -CPDragOperationGeneric = 1 << 2; -CPDragOperationPrivate = 1 << 3; -CPDragOperationMove = 1 << 4; -CPDragOperationDelete = 1 << 5; -CPDragOperationEvery = -1; +@global CPApp #define DRAGGING_WINDOW(anObject) ([anObject isKindOfClass:[CPWindow class]] ? anObject : [anObject window]) diff --git a/AppKit/CPDragServer_Constants.j b/AppKit/CPDragServer_Constants.j new file mode 100644 index 000000000..38ade5c31 --- /dev/null +++ b/AppKit/CPDragServer_Constants.j @@ -0,0 +1,30 @@ +/* + * CPDragServer_Constants.j + * AppKit + * + * Created by Francisco Tolmasky. + * Copyright 2008, 280 North, Inc. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library 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 + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +CPDragOperationNone = 0; +CPDragOperationCopy = 1 << 1; +CPDragOperationLink = 1 << 1; +CPDragOperationGeneric = 1 << 2; +CPDragOperationPrivate = 1 << 3; +CPDragOperationMove = 1 << 4; +CPDragOperationDelete = 1 << 5; +CPDragOperationEvery = -1; diff --git a/AppKit/CPEvent.j b/AppKit/CPEvent.j index c958b49d9..77d117758 100644 --- a/AppKit/CPEvent.j +++ b/AppKit/CPEvent.j @@ -22,6 +22,9 @@ @import @import +@import +@import + @import "CPText.j" @class CPTextField diff --git a/AppKit/CPFontManager.j b/AppKit/CPFontManager.j index f8a91851d..fc352bf0b 100644 --- a/AppKit/CPFontManager.j +++ b/AppKit/CPFontManager.j @@ -24,6 +24,8 @@ @import "CPFont.j" +@global CPApp + CPItalicFontMask = 1 << 0; CPBoldFontMask = 1 << 1; CPUnboldFontMask = 1 << 2; diff --git a/AppKit/CPGradient.j b/AppKit/CPGradient.j index 725a5c71c..0c9775c0e 100644 --- a/AppKit/CPGradient.j +++ b/AppKit/CPGradient.j @@ -20,6 +20,15 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ +@import +@import +@import + +@import "CoreGraphics/CGColor.j" +@import "CoreGraphics/CGColorSpace.j" +@import "CoreGraphics/CGGradient.j" +@import "CPGraphicsContext.j" + CPGradientDrawsBeforeStartingLocation = kCGGradientDrawsBeforeStartLocation; CPGradientDrawsAfterEndingLocation = kCGGradientDrawsAfterEndLocation; diff --git a/AppKit/CPImage.j b/AppKit/CPImage.j index 8d440a23d..2bbe5c0da 100644 --- a/AppKit/CPImage.j +++ b/AppKit/CPImage.j @@ -28,6 +28,7 @@ @import @import +@import "CPCompatibility.j" CPImageLoadStatusInitialized = 0; CPImageLoadStatusLoading = 1; diff --git a/AppKit/CPKeyBinding.j b/AppKit/CPKeyBinding.j index c62faabcb..5018fc538 100644 --- a/AppKit/CPKeyBinding.j +++ b/AppKit/CPKeyBinding.j @@ -21,6 +21,7 @@ */ @import +@import @import "CPEvent.j" diff --git a/AppKit/CPLevelIndicator.j b/AppKit/CPLevelIndicator.j index 56b5fbbdc..0ff9f1b4a 100644 --- a/AppKit/CPLevelIndicator.j +++ b/AppKit/CPLevelIndicator.j @@ -21,6 +21,9 @@ */ @import "CPControl.j" +@import "CPWindow_Constants.j" + +@global CPApp CPTickMarkBelow = 0; CPTickMarkAbove = 1; diff --git a/AppKit/CPMenu/CPMenu.j b/AppKit/CPMenu/CPMenu.j index 9cd143918..f0c21f02b 100644 --- a/AppKit/CPMenu/CPMenu.j +++ b/AppKit/CPMenu/CPMenu.j @@ -25,15 +25,10 @@ @import @import -@import "_CPMenuManager.j" -@import "CPApplication.j" -@import "CPClipView.j" @import "CPMenuItem.j" -@import "CPPanel.j" @global CPApp - CPMenuDidAddItemNotification = @"CPMenuDidAddItemNotification"; CPMenuDidChangeItemNotification = @"CPMenuDidChangeItemNotification"; CPMenuDidRemoveItemNotification = @"CPMenuDidRemoveItemNotification"; diff --git a/AppKit/CPMenu/_CPMenuBarWindow.j b/AppKit/CPMenu/_CPMenuBarWindow.j index 964f310df..5cfeb5d3e 100644 --- a/AppKit/CPMenu/_CPMenuBarWindow.j +++ b/AppKit/CPMenu/_CPMenuBarWindow.j @@ -1,5 +1,29 @@ +/* + * _CPMenuBarWindow.j + * AppKit + * + * Created by Francisco Tolmasky. + * Copyright 2009, 280 North, Inc. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library 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 + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + @import "CPPanel.j" -@import "_CPMenuWindow.j" +@import "_CPMenuManager.j" + +@class _CPMenuView @global CPMenuDidAddItemNotification @global CPMenuDidChangeItemNotification @@ -432,105 +456,3 @@ } @end - - -// Unused in AppKit ? - -// @implementation _CPMenuBarView : _CPMenuView -// { -// } -// -// - (CGRect)rectForItemAtIndex:(int)anIndex -// { -// return [_menuItemViews[anIndex === CPNotFound ? 0 : anIndex] frame]; -// } -// -// - (int)itemIndexAtPoint:(CGPoint)aPoint -// { -// var bounds = [self bounds]; -// -// if (!CGRectContainsPoint(bounds, aPoint)) -// return CPNotFound; -// -// var x = aPoint.x, -// low = 0, -// high = _visibleMenuItemInfos.length - 1; -// -// while (low <= high) -// { -// var middle = FLOOR(low + (high - low) / 2), -// info = _visibleMenuItemInfos[middle], -// frame = [info.view frame]; -// -// if (x < CGRectGetMinX(frame)) -// high = middle - 1; -// -// else if (x > CGRectGetMaxX(frame)) -// low = middle + 1; -// -// else -// return info.index; -// } -// -// return CPNotFound; -// } -// -// - (void)tile -// { -// var items = [_menu itemArray], -// index = 0, -// count = items.length, -// -// x = MENUBAR_LEFT_MARGIN, -// y = 0.0, -// isLeftAligned = YES; -// -// for (; index < count; ++index) -// { -// var item = items[index]; -// -// if ([item isSeparatorItem]) -// { -// x = CGRectGetWidth([self frame]) - MENUBAR_RIGHT_MARGIN; -// isLeftAligned = NO; -// -// continue; -// } -// -// if ([item isHidden]) -// continue; -// -// var menuItemView = [item _menuItemView], -// frame = [menuItemView frame]; -// -// if (isLeftAligned) -// { -// [menuItemView setFrameOrigin:CGPointMake(x, (MENUBAR_HEIGHT - 1.0 - CGRectGetHeight(frame)) / 2.0)]; -// -// x += CGRectGetWidth([menuItemView frame]) + MENUBAR_MARGIN; -// } -// else -// { -// [menuItemView setFrameOrigin:CGPointMake(x - CGRectGetWidth(frame), (MENUBAR_HEIGHT - 1.0 - CGRectGetHeight(frame)) / 2.0)]; -// -// x = CGRectGetMinX([menuItemView frame]) - MENUBAR_MARGIN; -// } -// } -// -// var bounds = [[self contentView] bounds], -// titleFrame = [_titleField frame]; -// -// if ([_iconImageView isHidden]) -// [_titleField setFrameOrigin:CGPointMake((CGRectGetWidth(bounds) - CGRectGetWidth(titleFrame)) / 2.0, (CGRectGetHeight(bounds) - CGRectGetHeight(titleFrame)) / 2.0)]; -// else -// { -// var iconFrame = [_iconImageView frame], -// iconWidth = CGRectGetWidth(iconFrame), -// totalWidth = iconWidth + CGRectGetWidth(titleFrame); -// -// [_iconImageView setFrameOrigin:CGPointMake((CGRectGetWidth(bounds) - totalWidth) / 2.0, (CGRectGetHeight(bounds) - CGRectGetHeight(iconFrame)) / 2.0)]; -// [_titleField setFrameOrigin:CGPointMake((CGRectGetWidth(bounds) - totalWidth) / 2.0 + iconWidth, (CGRectGetHeight(bounds) - CGRectGetHeight(titleFrame)) / 2.0)]; -// } -// } -// -// @end diff --git a/AppKit/CPMenu/_CPMenuManager.j b/AppKit/CPMenu/_CPMenuManager.j index 479963ae1..dbf9e33df 100644 --- a/AppKit/CPMenu/_CPMenuManager.j +++ b/AppKit/CPMenu/_CPMenuManager.j @@ -1,7 +1,32 @@ -@import -@import "CPWindow.j" -@import "CPEvent.j" +/* + * _CPMenuManager.j + * AppKit + * + * Created by Francisco Tolmasky. + * Copyright 2009, 280 North, Inc. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library 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 + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ +@import +@import + +@import "CPEvent.j" +@import "CPKeyBinding.j" + +@class CPWindow @class _CPMenuWindow diff --git a/AppKit/CPMenu/_CPMenuWindow.j b/AppKit/CPMenu/_CPMenuWindow.j index b2c465ef8..20030a048 100644 --- a/AppKit/CPMenu/_CPMenuWindow.j +++ b/AppKit/CPMenu/_CPMenuWindow.j @@ -1,5 +1,29 @@ +/* + * _CPMenuWindow.j + * AppKit + * + * Created by Francisco Tolmasky. + * Copyright 2009, 280 North, Inc. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library 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 + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +@import "CPClipView.j" +@import "CPImageView.j" @import "CPWindow.j" -@import "CPView.j" +@import "_CPMenuManager.j" var _CPMenuWindowPool = [], _CPMenuWindowPoolCapacity = 5, diff --git a/AppKit/CPMenuItem/CPMenuItem.j b/AppKit/CPMenuItem/CPMenuItem.j index e49923d53..12970ca8b 100644 --- a/AppKit/CPMenuItem/CPMenuItem.j +++ b/AppKit/CPMenuItem/CPMenuItem.j @@ -25,31 +25,32 @@ @import @import "CPImage.j" -@import "CPMenu.j" @import "CPView.j" @import "_CPMenuItemView.j" +@class CPMenu + @global CPApp - -var CPMenuItemStringRepresentationDictionary = [CPDictionary dictionary]; -[CPMenuItemStringRepresentationDictionary setObject:"\u238B" forKey:CPEscapeFunctionKey]; -[CPMenuItemStringRepresentationDictionary setObject:"\u21E5" forKey:CPTabCharacter]; -[CPMenuItemStringRepresentationDictionary setObject:"\u21E4" forKey:CPBackTabCharacter]; -[CPMenuItemStringRepresentationDictionary setObject:"\u2423" forKey:CPSpaceFunctionKey]; -[CPMenuItemStringRepresentationDictionary setObject:"\u23CE" forKey:CPCarriageReturnCharacter]; -[CPMenuItemStringRepresentationDictionary setObject:"\u232B" forKey:CPBackspaceCharacter]; -[CPMenuItemStringRepresentationDictionary setObject:"\u232B" forKey:CPDeleteFunctionKey]; -[CPMenuItemStringRepresentationDictionary setObject:"\u2326" forKey:CPDeleteCharacter]; -[CPMenuItemStringRepresentationDictionary setObject:"\u21F1" forKey:CPHomeFunctionKey]; -[CPMenuItemStringRepresentationDictionary setObject:"\u21F2" forKey:CPEndFunctionKey]; -[CPMenuItemStringRepresentationDictionary setObject:"\u21DE" forKey:CPPageUpFunctionKey]; -[CPMenuItemStringRepresentationDictionary setObject:"\u21DF" forKey:CPPageDownFunctionKey]; -[CPMenuItemStringRepresentationDictionary setObject:"\u2191" forKey:CPUpArrowFunctionKey]; -[CPMenuItemStringRepresentationDictionary setObject:"\u2193" forKey:CPDownArrowFunctionKey]; -[CPMenuItemStringRepresentationDictionary setObject:"\u2190" forKey:CPLeftArrowFunctionKey]; -[CPMenuItemStringRepresentationDictionary setObject:"\u2192" forKey:CPRightArrowFunctionKey]; -[CPMenuItemStringRepresentationDictionary setObject:"\u2327" forKey:CPClearDisplayFunctionKey]; +var CPMenuItemStringRepresentationDictionary = [CPDictionary dictionaryWithObjectsAndKeys: + "\u238B", CPEscapeFunctionKey, + "\u21E5", CPTabCharacter, + "\u21E4", CPBackTabCharacter, + "\u2423", CPSpaceFunctionKey, + "\u23CE", CPCarriageReturnCharacter, + "\u232B", CPBackspaceCharacter, + "\u232B", CPDeleteFunctionKey, + "\u2326", CPDeleteCharacter, + "\u21F1", CPHomeFunctionKey, + "\u21F2", CPEndFunctionKey, + "\u21DE", CPPageUpFunctionKey, + "\u21DF", CPPageDownFunctionKey, + "\u2191", CPUpArrowFunctionKey, + "\u2193", CPDownArrowFunctionKey, + "\u2190", CPLeftArrowFunctionKey, + "\u2192", CPRightArrowFunctionKey, + "\u2327", CPClearDisplayFunctionKey + ]; /*! @ingroup appkit diff --git a/AppKit/CPMenuItem/_CPMenuItemMenuBarView.j b/AppKit/CPMenuItem/_CPMenuItemMenuBarView.j index 2f67ce4db..11b31e688 100644 --- a/AppKit/CPMenuItem/_CPMenuItemMenuBarView.j +++ b/AppKit/CPMenuItem/_CPMenuItemMenuBarView.j @@ -1,4 +1,27 @@ -@import "CPView.j" +/* + * _CPMenuItemMenuBarView.j + * AppKit + * + * Created by Francisco Tolmasky. + * Copyright 2009, 280 North, Inc. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library 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 + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +@import "CPControl.j" +@import "_CPImageAndTextView.j" @class _CPMenuBarWindow @class _CPMenuView diff --git a/AppKit/CPMenuItem/_CPMenuItemSeparatorView.j b/AppKit/CPMenuItem/_CPMenuItemSeparatorView.j index 66857ef29..360d8e8cc 100644 --- a/AppKit/CPMenuItem/_CPMenuItemSeparatorView.j +++ b/AppKit/CPMenuItem/_CPMenuItemSeparatorView.j @@ -1,3 +1,24 @@ +/* + * _CPMenuItemSeparatorView.j + * AppKit + * + * Created by Francisco Tolmasky. + * Copyright 2009, 280 North, Inc. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library 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 + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ @import "CPView.j" @@ -35,4 +56,4 @@ CGContextStrokePath(context); } -@end \ No newline at end of file +@end diff --git a/AppKit/CPMenuItem/_CPMenuItemStandardView.j b/AppKit/CPMenuItem/_CPMenuItemStandardView.j index fc738e2fd..223cf74d2 100644 --- a/AppKit/CPMenuItem/_CPMenuItemStandardView.j +++ b/AppKit/CPMenuItem/_CPMenuItemStandardView.j @@ -1,4 +1,28 @@ +/* + * _CPMenuItemStandardView.j + * AppKit + * + * Created by Francisco Tolmasky. + * Copyright 2009, 280 North, Inc. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library 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 + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + @import "CPControl.j" +@import "CPImageView.j" +@import "_CPImageAndTextView.j" @implementation _CPMenuItemStandardView : CPView { diff --git a/AppKit/CPMenuItem/_CPMenuItemView.j b/AppKit/CPMenuItem/_CPMenuItemView.j index 9a2582b4d..8e0b07902 100644 --- a/AppKit/CPMenuItem/_CPMenuItemView.j +++ b/AppKit/CPMenuItem/_CPMenuItemView.j @@ -1,3 +1,24 @@ +/* + * _CPMenuItemView.j + * AppKit + * + * Created by Francisco Tolmasky. + * Copyright 2009, 280 North, Inc. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library 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 + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ @import "CPControl.j" diff --git a/AppKit/CPObjectController.j b/AppKit/CPObjectController.j index 242ce3153..5c3b3a322 100644 --- a/AppKit/CPObjectController.j +++ b/AppKit/CPObjectController.j @@ -24,6 +24,7 @@ @import @import "CPController.j" +@import "CPKeyValueBinding.j" /*! @class diff --git a/AppKit/CPOutlineView.j b/AppKit/CPOutlineView.j index beea02b12..0b6f922d2 100644 --- a/AppKit/CPOutlineView.j +++ b/AppKit/CPOutlineView.j @@ -20,10 +20,11 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ +@import "CPButton.j" @import "CPTableColumn.j" @import "CPTableView.j" -@import "CPButton.j" +@global CPApp CPOutlineViewColumnDidMoveNotification = @"CPOutlineViewColumnDidMoveNotification"; CPOutlineViewColumnDidResizeNotification = @"CPOutlineViewColumnDidResizeNotification"; diff --git a/AppKit/CPPasteboard.j b/AppKit/CPPasteboard.j index 427e8125c..82a533a70 100644 --- a/AppKit/CPPasteboard.j +++ b/AppKit/CPPasteboard.j @@ -22,6 +22,7 @@ @import @import +@import @import @import diff --git a/AppKit/CPProgressIndicator.j b/AppKit/CPProgressIndicator.j index 1c1e651f8..7ba4852a0 100644 --- a/AppKit/CPProgressIndicator.j +++ b/AppKit/CPProgressIndicator.j @@ -23,6 +23,7 @@ @import "CGGeometry.j" @import "CPImageView.j" @import "CPView.j" +@import "CPWindow_Constants.j" /* diff --git a/AppKit/CPRadio.j b/AppKit/CPRadio.j index b5644ba15..1fa0164a6 100644 --- a/AppKit/CPRadio.j +++ b/AppKit/CPRadio.j @@ -25,6 +25,8 @@ @import "CPButton.j" +@global CPApp + /*! @ingroup appkit diff --git a/AppKit/CPResponder.j b/AppKit/CPResponder.j index dc2f9559c..1bf73056d 100644 --- a/AppKit/CPResponder.j +++ b/AppKit/CPResponder.j @@ -21,6 +21,9 @@ */ @import +@import + +@import "CPEvent.j" @class CPKeyBinding diff --git a/AppKit/CPRuleEditor/CPPredicateEditorRowTemplate.j b/AppKit/CPRuleEditor/CPPredicateEditorRowTemplate.j index 9214c6768..631ea3c5d 100644 --- a/AppKit/CPRuleEditor/CPPredicateEditorRowTemplate.j +++ b/AppKit/CPRuleEditor/CPPredicateEditorRowTemplate.j @@ -22,6 +22,12 @@ @import +@import "CPCheckBox.j" +@import "CPPopUpButton.j" +@import "CPMenuItem.j" +@import "CPTextField.j" + +// NOTE: CPDatePicker is not implemented yet @class CPDatePicker diff --git a/AppKit/CPRuleEditor/CPRuleEditor.j b/AppKit/CPRuleEditor/CPRuleEditor.j index 282b63f4f..e4b86a55e 100644 --- a/AppKit/CPRuleEditor/CPRuleEditor.j +++ b/AppKit/CPRuleEditor/CPRuleEditor.j @@ -24,6 +24,8 @@ @import @import @import + +@import "CPRuleEditor_Constants.j" @import "CPTextField.j" @import "CPViewAnimation.j" @import "CPView.j" @@ -38,26 +40,6 @@ @global CPCaseInsensitivePredicateOption @global CPOrPredicateType - -CPRuleEditorPredicateLeftExpression = "CPRuleEditorPredicateLeftExpression"; -CPRuleEditorPredicateRightExpression = "CPRuleEditorPredicateRightExpression"; -CPRuleEditorPredicateComparisonModifier = "CPRuleEditorPredicateComparisonModifier"; -CPRuleEditorPredicateOptions = "CPRuleEditorPredicateOptions"; -CPRuleEditorPredicateOperatorType = "CPRuleEditorPredicateOperatorType"; -CPRuleEditorPredicateCustomSelector = "CPRuleEditorPredicateCustomSelector"; -CPRuleEditorPredicateCompoundType = "CPRuleEditorPredicateCompoundType"; - -CPRuleEditorRowsDidChangeNotification = "CPRuleEditorRowsDidChangeNotification"; -CPRuleEditorRulesDidChangeNotification = "CPRuleEditorRulesDidChangeNotification"; - -CPRuleEditorNestingModeSingle = 0; // Only a single row is allowed. Plus/minus buttons will not be shown -CPRuleEditorNestingModeList = 1; // Allows a single list, with no nesting and no compound rows -CPRuleEditorNestingModeCompound = 2; // Unlimited nesting and compound rows; this is the default -CPRuleEditorNestingModeSimple = 3; // One compound row at the top with subrows beneath it, and no further nesting allowed - -CPRuleEditorRowTypeSimple = 0; -CPRuleEditorRowTypeCompound = 1; - var CPRuleEditorItemPBoardType = @"CPRuleEditorItemPBoardType", itemsContext = "items", valuesContext = "values", diff --git a/AppKit/CPRuleEditor/CPRuleEditor_Constants.j b/AppKit/CPRuleEditor/CPRuleEditor_Constants.j new file mode 100644 index 000000000..d68b6f48a --- /dev/null +++ b/AppKit/CPRuleEditor/CPRuleEditor_Constants.j @@ -0,0 +1,40 @@ +/* + * CPRuleEditor_Constants.j + * AppKit + * + * Created by cacaodev. + * Copyright 2011, cacaodev. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library 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 + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +CPRuleEditorPredicateLeftExpression = "CPRuleEditorPredicateLeftExpression"; +CPRuleEditorPredicateRightExpression = "CPRuleEditorPredicateRightExpression"; +CPRuleEditorPredicateComparisonModifier = "CPRuleEditorPredicateComparisonModifier"; +CPRuleEditorPredicateOptions = "CPRuleEditorPredicateOptions"; +CPRuleEditorPredicateOperatorType = "CPRuleEditorPredicateOperatorType"; +CPRuleEditorPredicateCustomSelector = "CPRuleEditorPredicateCustomSelector"; +CPRuleEditorPredicateCompoundType = "CPRuleEditorPredicateCompoundType"; + +CPRuleEditorRowsDidChangeNotification = "CPRuleEditorRowsDidChangeNotification"; +CPRuleEditorRulesDidChangeNotification = "CPRuleEditorRulesDidChangeNotification"; + +CPRuleEditorNestingModeSingle = 0; // Only a single row is allowed. Plus/minus buttons will not be shown +CPRuleEditorNestingModeList = 1; // Allows a single list, with no nesting and no compound rows +CPRuleEditorNestingModeCompound = 2; // Unlimited nesting and compound rows; this is the default +CPRuleEditorNestingModeSimple = 3; // One compound row at the top with subrows beneath it, and no further nesting allowed + +CPRuleEditorRowTypeSimple = 0; +CPRuleEditorRowTypeCompound = 1; diff --git a/AppKit/CPRuleEditor/_CPPredicateEditorRowNode.j b/AppKit/CPRuleEditor/_CPPredicateEditorRowNode.j index f66c6a21f..ed9b59f0f 100644 --- a/AppKit/CPRuleEditor/_CPPredicateEditorRowNode.j +++ b/AppKit/CPRuleEditor/_CPPredicateEditorRowNode.j @@ -1,9 +1,25 @@ /* - * Created by cacaodev@gmail.com. - * Copyright (c) 2011 Pear, Inc. All rights reserved. + * Created by cacaodev@gmail.com. + * Copyright (c) 2011 Pear, Inc. All rights reserved. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library 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 + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ -//@class _CPPredicateEditorTree; +@import +@import + @implementation _CPPredicateEditorRowNode : CPObject { _CPPredicateEditorTree tree @accessors; diff --git a/AppKit/CPRuleEditor/_CPPredicateEditorTree.j b/AppKit/CPRuleEditor/_CPPredicateEditorTree.j index 004c8d5c7..f0d47086f 100644 --- a/AppKit/CPRuleEditor/_CPPredicateEditorTree.j +++ b/AppKit/CPRuleEditor/_CPPredicateEditorTree.j @@ -1,8 +1,25 @@ /* - * Created by cacaodev@gmail.com. - * Copyright (c) 2011 Pear, Inc. All rights reserved. + * Created by cacaodev@gmail.com. + * Copyright (c) 2011 Pear, Inc. All rights reserved. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library 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 + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ +@import +@import + @implementation _CPPredicateEditorTree : CPObject { CPPredicateEditorRowTemplate template @accessors; diff --git a/AppKit/CPRuleEditor/_CPRuleEditorLocalizer.j b/AppKit/CPRuleEditor/_CPRuleEditorLocalizer.j index 935b6e759..f1530dacd 100644 --- a/AppKit/CPRuleEditor/_CPRuleEditorLocalizer.j +++ b/AppKit/CPRuleEditor/_CPRuleEditorLocalizer.j @@ -1,11 +1,27 @@ /* - * Created by cacaodev@gmail.com. - * Copyright (c) 2011 Pear, Inc. All rights reserved. + * Created by cacaodev@gmail.com. + * Copyright (c) 2011 Pear, Inc. All rights reserved. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library 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 + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ @import @import @import +@import +@import var LocalizerStringsRegex = new RegExp("\"(.+)\"\\s*=\\s*\"(.+)\"\\s*;\\s*(//.+)?"); diff --git a/AppKit/CPRuleEditor/_CPRuleEditorPopUpButton.j b/AppKit/CPRuleEditor/_CPRuleEditorPopUpButton.j index 900869491..3b48eff50 100644 --- a/AppKit/CPRuleEditor/_CPRuleEditorPopUpButton.j +++ b/AppKit/CPRuleEditor/_CPRuleEditorPopUpButton.j @@ -1,10 +1,27 @@ /* - * Created by cacaodev@gmail.com. - * Copyright (c) 2011 Pear, Inc. All rights reserved. + * Created by cacaodev@gmail.com. + * Copyright (c) 2011 Pear, Inc. All rights reserved. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library 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 + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ +@import "CPBezierPath.j" @import "CPPopUpButton.j" +@class _CPRuleEditorViewSlice + var GRADIENT_START_COLOR = "#fcfcfc", GRADIENT_END_COLOR = "#dfdfdf", BORDER_COLOR = "#BDBDBD"; diff --git a/AppKit/CPRuleEditor/_CPRuleEditorViewSlice.j b/AppKit/CPRuleEditor/_CPRuleEditorViewSlice.j index 876d4f141..54a148ee6 100644 --- a/AppKit/CPRuleEditor/_CPRuleEditorViewSlice.j +++ b/AppKit/CPRuleEditor/_CPRuleEditorViewSlice.j @@ -1,6 +1,20 @@ /* - * Created by cacaodev@gmail.com. - * Copyright (c) 2011 Pear, Inc. All rights reserved. + * Created by cacaodev@gmail.com. + * Copyright (c) 2011 Pear, Inc. All rights reserved. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library 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 + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ @import "CPView.j" diff --git a/AppKit/CPRuleEditor/_CPRuleEditorViewSliceRow.j b/AppKit/CPRuleEditor/_CPRuleEditorViewSliceRow.j index f90c7d892..c70a6ba12 100644 --- a/AppKit/CPRuleEditor/_CPRuleEditorViewSliceRow.j +++ b/AppKit/CPRuleEditor/_CPRuleEditorViewSliceRow.j @@ -1,16 +1,27 @@ /* - * Created by cacaodev@gmail.com. - * Copyright (c) 2011 Pear, Inc. All rights reserved. + * Created by cacaodev@gmail.com. + * Copyright (c) 2011 Pear, Inc. All rights reserved. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library 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 + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ +@import "CPRuleEditor_Constants.j" @import "_CPRuleEditorViewSlice.j" @import "_CPRuleEditorPopUpButton.j" -@import "CPRuleEditor.j" - -@global CPRuleEditorNestingModeCompound -@global CPRuleEditorRowTypeCompound -@global CPRuleEditorNestingModeSingle +@global CPApp var CONTROL_HEIGHT = 16., BUTTON_HEIGHT = 16.; diff --git a/AppKit/CPScroller.j b/AppKit/CPScroller.j index 6103a77d4..32ab6377b 100644 --- a/AppKit/CPScroller.j +++ b/AppKit/CPScroller.j @@ -25,14 +25,13 @@ #include "../Foundation/Foundation.h" +@import "CPAnimation.j" @import "CPControl.j" +@import "CPWindow_Constants.j" @import "CPViewAnimation.j" -@global CPWindowAbove -@global CPWindowBelow @global CPApp - // CPScroller Constants CPScrollerNoPart = 0; CPScrollerDecrementPage = 1; diff --git a/AppKit/CPSearchField.j b/AppKit/CPSearchField.j index 62c2b4fdb..190f7f4e1 100644 --- a/AppKit/CPSearchField.j +++ b/AppKit/CPSearchField.j @@ -21,10 +21,13 @@ */ @import "CPButton.j" +@import "CPMenu.j" +@import "CPMenuItem.j" @import "CPTextField.j" @class CPUserDefaults +@global CPApp CPSearchFieldRecentsTitleMenuItemTag = 1000; CPSearchFieldRecentsMenuItemTag = 1001; diff --git a/AppKit/CPSegmentedControl.j b/AppKit/CPSegmentedControl.j index c0cbed55d..24aabeaef 100644 --- a/AppKit/CPSegmentedControl.j +++ b/AppKit/CPSegmentedControl.j @@ -23,7 +23,10 @@ @import @import "CPControl.j" +@import "CPWindow_Constants.j" +@import "_CPImageAndTextView.j" +@global CPApp CPSegmentSwitchTrackingSelectOne = 0; CPSegmentSwitchTrackingSelectAny = 1; diff --git a/AppKit/CPShadowView.j b/AppKit/CPShadowView.j index 08a561701..7a3b8f261 100644 --- a/AppKit/CPShadowView.j +++ b/AppKit/CPShadowView.j @@ -24,7 +24,6 @@ @import "CGGeometry.j" @import "CPImage.j" -@import "CPImageView.j" @import "CPView.j" diff --git a/AppKit/CPSlider.j b/AppKit/CPSlider.j index 314d00724..ba291ac09 100644 --- a/AppKit/CPSlider.j +++ b/AppKit/CPSlider.j @@ -21,6 +21,7 @@ */ @import "CPControl.j" +@import "CPWindow_Constants.j" /*! SLIDER STATES */ diff --git a/AppKit/CPSliderColorPicker.j b/AppKit/CPSliderColorPicker.j index b1892d010..38aa8427c 100644 --- a/AppKit/CPSliderColorPicker.j +++ b/AppKit/CPSliderColorPicker.j @@ -20,10 +20,10 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ -@import "CPView.j" @import "CPColorPicker.j" - -@class CPSlider +@import "CPSlider.j" +@import "CPTextField.j" +@import "CPView.j" @global CPColorPickerViewWidth @global CPColorPickerViewHeight diff --git a/AppKit/CPSound.j b/AppKit/CPSound.j index 694b1095a..3b5dda2ed 100644 --- a/AppKit/CPSound.j +++ b/AppKit/CPSound.j @@ -21,6 +21,7 @@ */ @import +@import CPSoundLoadStateEmpty = 0; CPSoundLoadStateLoading = 1; diff --git a/AppKit/CPStringDrawing.j b/AppKit/CPStringDrawing.j index 9069e7f5c..271e6a48c 100644 --- a/AppKit/CPStringDrawing.j +++ b/AppKit/CPStringDrawing.j @@ -22,6 +22,7 @@ @import +@import "CoreGraphics/CGGeometry.j" @import "CPPlatformString.j" diff --git a/AppKit/CPTableColumn.j b/AppKit/CPTableColumn.j index bf1b4913e..6cf191f2d 100644 --- a/AppKit/CPTableColumn.j +++ b/AppKit/CPTableColumn.j @@ -26,11 +26,11 @@ @import @import -@import "CPTableHeaderView.j" -@import "CPKeyValueBinding.j" +@import "CPTextField.j" @global CPTableViewColumnDidResizeNotification +@class _CPTableColumnHeaderView CPTableColumnNoResizing = 0; CPTableColumnAutoresizingMask = 1 << 0; diff --git a/AppKit/CPTableHeaderView.j b/AppKit/CPTableHeaderView.j index d6ed7cd95..20f2256ac 100644 --- a/AppKit/CPTableHeaderView.j +++ b/AppKit/CPTableHeaderView.j @@ -22,14 +22,14 @@ @import -@import "CPTableColumn.j" -@import "CPTableView.j" -@import "CPView.j" +@import "CPCursor.j" @import "CPPasteboard.j" +@import "CPTableColumn.j" +@import "CPView.j" +@import "_CPImageAndTextView.j" -@class CPCursor +@class CPTableView -@global CPTableColumnUserResizingMask @global CPApp @@ -52,6 +52,7 @@ - (void)initWithFrame:(CGRect)frame { self = [super initWithFrame:frame]; + if (self) [self _init]; diff --git a/AppKit/CPTableView.j b/AppKit/CPTableView.j index 3bbd8ce3f..6f1785949 100644 --- a/AppKit/CPTableView.j +++ b/AppKit/CPTableView.j @@ -23,25 +23,25 @@ @import @import +@import "CPDragServer_Constants.j" @import "CGGradient.j" - -@import "CPControl.j" -@import "CPTableColumn.j" -@import "_CPCornerView.j" -@import "CPScroller.j" @import "CPCompatibility.j" -@import "CPPasteboard.j" -@import "CPDragServer.j" +@import "CPControl.j" @import "CPImageView.j" +@import "CPScroller.j" +@import "CPScrollView.j" +@import "CPTableColumn.j" +@import "CPTableHeaderView.j" +@import "_CPCornerView.j" -@class CPScrollView +@class CPButton +@class CPClipView @class CPUserDefaults @class CPTableHeaderView @class CPClipView @class CPButton @global CPApp -@global CPTableColumnAutoresizingMask CPTableViewColumnDidMoveNotification = @"CPTableViewColumnDidMoveNotification"; @@ -4652,6 +4652,14 @@ Your delegate can implement this method to avoid subclassing the tableview to ad return YES; } +/*! + @ignore +*/ +- (BOOL)needsPanelToBecomeKey +{ + return YES; +} + /*! @ignore */ diff --git a/AppKit/CPTextField.j b/AppKit/CPTextField.j index 96bc16f08..a767710bf 100644 --- a/AppKit/CPTextField.j +++ b/AppKit/CPTextField.j @@ -785,11 +785,20 @@ CPTextFieldStatePlaceholder = CPThemeState("placeholder"); } /*! - Text fields require panels to become key window, so this returns \c YES. + Text fields require panels to become key window, so this returns \c YES + if the text field is ready to become the first responder as well. */ - (BOOL)needsPanelToBecomeKey { - return YES; + return [self acceptsFirstResponder]; +} + +/*! + Only text fields that can become first responder accepts first mouse. +*/ +- (BOOL)acceptsFirstMouse:(CPEvent)anEvent +{ + return [self acceptsFirstResponder]; } - (void)mouseDown:(CPEvent)anEvent diff --git a/AppKit/CPTokenField.j b/AppKit/CPTokenField.j index 637863d73..e003351fa 100755 --- a/AppKit/CPTokenField.j +++ b/AppKit/CPTokenField.j @@ -31,9 +31,11 @@ @import "CPScrollView.j" @import "CPTextField.j" @import "CPTableView.j" -@import "CPWindow.j" +@import "CPWindow_Constants.j" @import "_CPAutocompleteMenu.j" +@global CPApp + #if PLATFORM(DOM) var CPTokenFieldDOMInputElement = nil, diff --git a/AppKit/CPToolbar.j b/AppKit/CPToolbar.j index 492092309..21fbd788d 100644 --- a/AppKit/CPToolbar.j +++ b/AppKit/CPToolbar.j @@ -28,6 +28,7 @@ @import "CPPopUpButton.j" @import "CPToolbarItem.j" +@global CPApp /* @global diff --git a/AppKit/CPUserDefaultsController.j b/AppKit/CPUserDefaultsController.j index 0cf110da0..9f9399f37 100644 --- a/AppKit/CPUserDefaultsController.j +++ b/AppKit/CPUserDefaultsController.j @@ -23,8 +23,10 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ - +@import +@import @import + @import "CPController.j" @class CPUserDefaults diff --git a/AppKit/CPViewController.j b/AppKit/CPViewController.j index caddcbd62..b47d118d1 100644 --- a/AppKit/CPViewController.j +++ b/AppKit/CPViewController.j @@ -22,7 +22,6 @@ @import -@import "CPApplication.j" @import "CPCib.j" @import "CPResponder.j" diff --git a/AppKit/CPWindow/CPWindow.j b/AppKit/CPWindow/CPWindow.j index 70a8a0d02..677e2f07e 100644 --- a/AppKit/CPWindow/CPWindow.j +++ b/AppKit/CPWindow/CPWindow.j @@ -20,6 +20,7 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ +@import "CPWindow_Constants.j" @import "_CPWindow.j" @import "_CPWindowView.j" @import "_CPStandardWindowView.j" @@ -32,4 +33,3 @@ @import "_CPModalWindowView.j" @import "_CPShadowWindowView.j" @import "CPDragServer.j" -//@import "CPView.j" diff --git a/AppKit/CPWindow/CPWindow_Constants.j b/AppKit/CPWindow/CPWindow_Constants.j new file mode 100644 index 000000000..ddfdb6931 --- /dev/null +++ b/AppKit/CPWindow/CPWindow_Constants.j @@ -0,0 +1,191 @@ +/* + * CPWindow_Constants.j + * AppKit + * + * Created by Francisco Tolmasky. + * Copyright 2008, 280 North, Inc. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library 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 + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +/* + Borderless window mask option. + @global + @class CPWindow +*/ +CPBorderlessWindowMask = 0; +/* + Titled window mask option. + @global + @class CPWindow +*/ +CPTitledWindowMask = 1 << 0; +/* + Closeable window mask option. + @global + @class CPWindow +*/ +CPClosableWindowMask = 1 << 1; +/* + Miniaturizabe window mask option. + @global + @class CPWindow +*/ +CPMiniaturizableWindowMask = 1 << 2; +/* + Resizable window mask option. + @global + @class CPWindow +*/ +CPResizableWindowMask = 1 << 3; +/* + Textured window mask option. + @global + @class CPWindow +*/ +CPTexturedBackgroundWindowMask = 1 << 8; +/* + @global + @class CPWindow +*/ +CPBorderlessBridgeWindowMask = 1 << 20; +/* + @global + @class CPWindow +*/ +CPHUDBackgroundWindowMask = 1 << 21; + +/*! + @global + @class CPWindow +*/ +_CPModalWindowMask = 1 << 22; + +CPWindowNotSizable = 0; +CPWindowMinXMargin = 1; +CPWindowWidthSizable = 2; +CPWindowMaxXMargin = 4; +CPWindowMinYMargin = 8; +CPWindowHeightSizable = 16; +CPWindowMaxYMargin = 32; + +CPBackgroundWindowLevel = -1; +/* + Default level for windows + @group CPWindowLevel + @global +*/ +CPNormalWindowLevel = 0; +/* + Floating palette type window + @group CPWindowLevel + @global +*/ +CPFloatingWindowLevel = 3; +/* + Submenu type window + @group CPWindowLevel + @global +*/ +CPSubmenuWindowLevel = 3; +/* + For a torn-off menu + @group CPWindowLevel + @global +*/ +CPTornOffMenuWindowLevel = 3; +/* + For the application's main menu + @group CPWindowLevel + @global +*/ +CPMainMenuWindowLevel = 24; +/* + Status window level + @group CPWindowLevel + @global +*/ +CPStatusWindowLevel = 25; +/* + Level for a modal panel + @group CPWindowLevel + @global +*/ +CPModalPanelWindowLevel = 8; +/* + Level for a pop up menu + @group CPWindowLevel + @global +*/ +CPPopUpMenuWindowLevel = 101; +/* + Level for a window being dragged + @group CPWindowLevel + @global +*/ +CPDraggingWindowLevel = 500; +/* + Level for the screens saver + @group CPWindowLevel + @global +*/ +CPScreenSaverWindowLevel = 1000; + +/* + The receiver is placed directly in front of the window specified. + @global + @class CPWindowOrderingMode +*/ +CPWindowAbove = 1; +/* + The receiver is placed directly behind the window specified. + @global + @class CPWindowOrderingMode +*/ +CPWindowBelow = -1; +/* + The receiver is removed from the screen list and hidden. + @global + @class CPWindowOrderingMode +*/ +CPWindowOut = 0; + +CPWindowWillCloseNotification = @"CPWindowWillCloseNotification"; +CPWindowDidBecomeMainNotification = @"CPWindowDidBecomeMainNotification"; +CPWindowDidResignMainNotification = @"CPWindowDidResignMainNotification"; +CPWindowDidBecomeKeyNotification = @"CPWindowDidBecomeKeyNotification"; +CPWindowDidResignKeyNotification = @"CPWindowDidResignKeyNotification"; +CPWindowDidResizeNotification = @"CPWindowDidResizeNotification"; +CPWindowDidMoveNotification = @"CPWindowDidMoveNotification"; +CPWindowWillBeginSheetNotification = @"CPWindowWillBeginSheetNotification"; +CPWindowDidEndSheetNotification = @"CPWindowDidEndSheetNotification"; +CPWindowDidMiniaturizeNotification = @"CPWindowDidMiniaturizeNotification"; +CPWindowWillMiniaturizeNotification = @"CPWindowWillMiniaturizeNotification"; +CPWindowDidDeminiaturizeNotification = @"CPWindowDidDeminiaturizeNotification"; + +_CPWindowDidChangeFirstResponderNotification = @"_CPWindowDidChangeFirstResponderNotification"; + +CPWindowShadowStyleStandard = 0; +CPWindowShadowStyleMenu = 1; +CPWindowShadowStylePanel = 2; + +CPWindowResizeStyleModern = 0; +CPWindowResizeStyleLegacy = 1; +CPWindowResizeStyle = CPWindowResizeStyleModern; + +CPWindowPositionFlexibleRight = 1 << 19; +CPWindowPositionFlexibleLeft = 1 << 20; +CPWindowPositionFlexibleBottom = 1 << 21; +CPWindowPositionFlexibleTop = 1 << 22; diff --git a/AppKit/CPWindow/_CPDocModalWindowView.j b/AppKit/CPWindow/_CPDocModalWindowView.j index 143f71eb4..1577a2d76 100644 --- a/AppKit/CPWindow/_CPDocModalWindowView.j +++ b/AppKit/CPWindow/_CPDocModalWindowView.j @@ -1,3 +1,25 @@ +/* + * _CPDocModalWindowView.j + * AppKit + * + * Created by Ross Boucher. + * Copyright 2009, 280 North, Inc. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library 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 + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + @import "_CPWindowView.j" diff --git a/AppKit/CPWindow/_CPHUDWindowView.j b/AppKit/CPWindow/_CPHUDWindowView.j index 34358a7e2..28a0246dd 100644 --- a/AppKit/CPWindow/_CPHUDWindowView.j +++ b/AppKit/CPWindow/_CPHUDWindowView.j @@ -20,9 +20,11 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ +@import "CPButton.j" @import "CPTextField.j" @import "_CPTitleableWindowView.j" + @implementation _CPHUDWindowView : _CPTitleableWindowView { CPView _toolbarView; diff --git a/AppKit/CPWindow/_CPModalWindowView.j b/AppKit/CPWindow/_CPModalWindowView.j index d79c01464..096b1e306 100644 --- a/AppKit/CPWindow/_CPModalWindowView.j +++ b/AppKit/CPWindow/_CPModalWindowView.j @@ -22,6 +22,7 @@ @import "_CPWindowView.j" + @implementation _CPModalWindowView : _CPWindowView { } diff --git a/AppKit/CPWindow/_CPShadowWindowView.j b/AppKit/CPWindow/_CPShadowWindowView.j index 0ca515956..740dcd12e 100644 --- a/AppKit/CPWindow/_CPShadowWindowView.j +++ b/AppKit/CPWindow/_CPShadowWindowView.j @@ -23,6 +23,7 @@ @import "_CPWindowView.j" @import "CPView.j" + @implementation _CPShadowWindowView : CPView { _CPWindowView _windowView @accessors(setter=setWindowView:); diff --git a/AppKit/CPWindow/_CPStandardWindowView.j b/AppKit/CPWindow/_CPStandardWindowView.j index 2ac4599a1..81c0b6487 100644 --- a/AppKit/CPWindow/_CPStandardWindowView.j +++ b/AppKit/CPWindow/_CPStandardWindowView.j @@ -202,10 +202,11 @@ var theWindow = [self window], bounds = [self bounds], - width = _CGRectGetWidth(bounds); + width = _CGRectGetWidth(bounds), + headHeight = [self toolbarMaxY]; - [_headView setFrameSize:_CGSizeMake(width, [self toolbarMaxY])]; - [_dividerView setFrame:_CGRectMake(0.0, _CGRectGetMaxY([_headView frame]), width, 1.0)]; + [_headView setFrameSize:_CGSizeMake(width, headHeight)]; + [_dividerView setFrame:_CGRectMake(0.0, headHeight, width, 1.0)]; var dividerMaxY = 0, dividerMinY = 0; diff --git a/AppKit/CPWindow/_CPWindow.j b/AppKit/CPWindow/_CPWindow.j index 5b34a8c53..4148a02d8 100644 --- a/AppKit/CPWindow/_CPWindow.j +++ b/AppKit/CPWindow/_CPWindow.j @@ -1,5 +1,5 @@ /* - * CPWindow.j + * _CPWindow.j * AppKit * * Created by Francisco Tolmasky. @@ -31,6 +31,8 @@ @import "CPScreen.j" @import "CPEvent.j" @import "CPView.j" +@import "CPWindow_Constants.j" +@import "_CPWindowView.j" #if PLATFORM(BROWSER) @import "CPPlatformWindow+DOM.j" #endif @@ -42,176 +44,6 @@ @class CPProgressIndicator @global CPApp -@global CPWindowPositionFlexibleLeft -@global CPWindowPositionFlexibleRight -@global CPWindowPositionFlexibleTop -@global CPWindowPositionFlexibleBottom - -/* - Borderless window mask option. - @global - @class CPWindow -*/ -CPBorderlessWindowMask = 0; -/* - Titled window mask option. - @global - @class CPWindow -*/ -CPTitledWindowMask = 1 << 0; -/* - Closeable window mask option. - @global - @class CPWindow -*/ -CPClosableWindowMask = 1 << 1; -/* - Miniaturizabe window mask option. - @global - @class CPWindow -*/ -CPMiniaturizableWindowMask = 1 << 2; -/* - Resizable window mask option. - @global - @class CPWindow -*/ -CPResizableWindowMask = 1 << 3; -/* - Textured window mask option. - @global - @class CPWindow -*/ -CPTexturedBackgroundWindowMask = 1 << 8; -/* - @global - @class CPWindow -*/ -CPBorderlessBridgeWindowMask = 1 << 20; -/* - @global - @class CPWindow -*/ -CPHUDBackgroundWindowMask = 1 << 21; - -/*! - @global - @class CPWindow -*/ -_CPModalWindowMask = 1 << 22; - -CPWindowNotSizable = 0; -CPWindowMinXMargin = 1; -CPWindowWidthSizable = 2; -CPWindowMaxXMargin = 4; -CPWindowMinYMargin = 8; -CPWindowHeightSizable = 16; -CPWindowMaxYMargin = 32; - -CPBackgroundWindowLevel = -1; -/* - Default level for windows - @group CPWindowLevel - @global -*/ -CPNormalWindowLevel = 0; -/* - Floating palette type window - @group CPWindowLevel - @global -*/ -CPFloatingWindowLevel = 3; -/* - Submenu type window - @group CPWindowLevel - @global -*/ -CPSubmenuWindowLevel = 3; -/* - For a torn-off menu - @group CPWindowLevel - @global -*/ -CPTornOffMenuWindowLevel = 3; -/* - For the application's main menu - @group CPWindowLevel - @global -*/ -CPMainMenuWindowLevel = 24; -/* - Status window level - @group CPWindowLevel - @global -*/ -CPStatusWindowLevel = 25; -/* - Level for a modal panel - @group CPWindowLevel - @global -*/ -CPModalPanelWindowLevel = 8; -/* - Level for a pop up menu - @group CPWindowLevel - @global -*/ -CPPopUpMenuWindowLevel = 101; -/* - Level for a window being dragged - @group CPWindowLevel - @global -*/ -CPDraggingWindowLevel = 500; -/* - Level for the screens saver - @group CPWindowLevel - @global -*/ -CPScreenSaverWindowLevel = 1000; - -/* - The receiver is removed from the screen list and hidden. - @global - @class CPWindowOrderingMode -*/ -CPWindowOut = 0; -/* - The receiver is placed directly in front of the window specified. - @global - @class CPWindowOrderingMode -*/ -CPWindowAbove = 1; -/* - The receiver is placed directly behind the window specified. - @global - @class CPWindowOrderingMode -*/ -CPWindowBelow = 2; - -CPWindowWillCloseNotification = @"CPWindowWillCloseNotification"; -CPWindowDidBecomeMainNotification = @"CPWindowDidBecomeMainNotification"; -CPWindowDidResignMainNotification = @"CPWindowDidResignMainNotification"; -CPWindowDidBecomeKeyNotification = @"CPWindowDidBecomeKeyNotification"; -CPWindowDidResignKeyNotification = @"CPWindowDidResignKeyNotification"; -CPWindowDidResizeNotification = @"CPWindowDidResizeNotification"; -CPWindowDidMoveNotification = @"CPWindowDidMoveNotification"; -CPWindowWillBeginSheetNotification = @"CPWindowWillBeginSheetNotification"; -CPWindowDidEndSheetNotification = @"CPWindowDidEndSheetNotification"; -CPWindowDidMiniaturizeNotification = @"CPWindowDidMiniaturizeNotification"; -CPWindowWillMiniaturizeNotification = @"CPWindowWillMiniaturizeNotification"; -CPWindowDidDeminiaturizeNotification = @"CPWindowDidDeminiaturizeNotification"; - -_CPWindowDidChangeFirstResponderNotification = @"_CPWindowDidChangeFirstResponderNotification"; - -CPWindowShadowStyleStandard = 0; -CPWindowShadowStyleMenu = 1; -CPWindowShadowStylePanel = 2; - -CPWindowResizeStyleModern = 0; -CPWindowResizeStyleLegacy = 1; -CPWindowResizeStyle = CPWindowResizeStyleModern; -CPWindowResizeSlop = 3; var CPWindowSaveImage = nil, @@ -2203,7 +2035,7 @@ CPTexturedBackgroundWindowMask if (!(_styleMask & CPClosableWindowMask)) return; - if ([self isFullBridge]) + if ([self isFullPlatformWindow]) { var event = [CPApp currentEvent]; @@ -2214,16 +2046,18 @@ CPTexturedBackgroundWindowMask } } - // Only send ONE windowShouldClose: message. + // The Cocoa docs say that if both the delegate and the window implement + // windowShouldClose:, only the delegate receives the message. if ([_delegate respondsToSelector:@selector(windowShouldClose:)]) { if (![_delegate windowShouldClose:self]) return; } - - // Only check self is delegate does NOT implement this. This also ensures this when delegate == self (returns true). - else if ([self respondsToSelector:@selector(windowShouldClose:)] && ![self windowShouldClose:self]) - return; + else if ([self respondsToSelector:@selector(windowShouldClose:)]) + { + if (![self windowShouldClose:self]) + return; + } var documents = [_windowController documents]; @@ -3351,7 +3185,7 @@ var keyViewComparator = function(lhs, rhs, context) { // If we are using the new resizing mode, mouse events are valid // outside the window's frame for non-full platform windows. - var mouseFrame = (!_isFullPlatformWindow && (_styleMask & CPResizableWindowMask) && (CPWindowResizeStyle === CPWindowResizeStyleModern)) ? _CGRectInset(_frame, -CPWindowResizeSlop, -CPWindowResizeSlop) : _frame; + var mouseFrame = (!_isFullPlatformWindow && (_styleMask & CPResizableWindowMask) && (CPWindowResizeStyle === CPWindowResizeStyleModern)) ? _CGRectInset(_frame, -_CPWindowViewResizeSlop, -_CPWindowViewResizeSlop) : _frame; return _CGRectContainsPoint(mouseFrame, aPoint); } @@ -3365,6 +3199,8 @@ var keyViewComparator = function(lhs, rhs, context) */ - (void)setFullBridge:(BOOL)shouldBeFullBridge { + _CPReportLenientDeprecation([self class], _cmd, @selector(setFullPlatformWindow:)); + [self setFullPlatformWindow:shouldBeFullBridge]; } diff --git a/AppKit/CPWindow/_CPWindowView.j b/AppKit/CPWindow/_CPWindowView.j index 08efae084..4266085ce 100644 --- a/AppKit/CPWindow/_CPWindowView.j +++ b/AppKit/CPWindow/_CPWindowView.j @@ -22,21 +22,16 @@ @import "CPImageView.j" @import "CPView.j" +@import "CPWindow_Constants.j" @class CPCursor @class CPMenu @class CPPlatformWindow @global CPApp -@global CPHUDBackgroundWindowMask -@global CPResizableWindowMask -@global CPWindowResizeSlop -@global CPWindowResizeStyle -@global CPWindowResizeStyleLegacy -@global CPWindowResizeStyleModern - var _CPWindowViewCornerResizeRectWidth = 10, + _CPWindowViewResizeRegionNone = -1, _CPWindowViewResizeRegionTopLeft = 0, _CPWindowViewResizeRegionTop = 1, @@ -47,6 +42,9 @@ var _CPWindowViewCornerResizeRectWidth = 10, _CPWindowViewResizeRegionBottomLeft = 6, _CPWindowViewResizeRegionLeft = 7; +_CPWindowViewResizeSlop = 3; + + @implementation _CPWindowView : CPView { unsigned _styleMask; @@ -246,40 +244,40 @@ var _CPWindowViewCornerResizeRectWidth = 10, if (isFixedWidth) { - rect = _CGRectMake(frame.origin.x - CPWindowResizeSlop, - frame.origin.y - CPWindowResizeSlop, - frame.size.width + (CPWindowResizeSlop * 2), - CPWindowResizeSlop * 2); + rect = _CGRectMake(frame.origin.x - _CPWindowViewResizeSlop, + frame.origin.y - _CPWindowViewResizeSlop, + frame.size.width + (_CPWindowViewResizeSlop * 2), + _CPWindowViewResizeSlop * 2); if (_CGRectContainsPoint(rect, aPoint)) return _CPWindowViewResizeRegionTop; - rect.origin.y = _CGRectGetMaxY(frame) - CPWindowResizeSlop; + rect.origin.y = _CGRectGetMaxY(frame) - _CPWindowViewResizeSlop; if (_CGRectContainsPoint(rect, aPoint)) return _CPWindowViewResizeRegionBottom; } else if (isFixedHeight) { - rect = _CGRectMake(frame.origin.x - CPWindowResizeSlop, - frame.origin.y - CPWindowResizeSlop, - CPWindowResizeSlop * 2, - frame.size.height + (CPWindowResizeSlop * 2)); + rect = _CGRectMake(frame.origin.x - _CPWindowViewResizeSlop, + frame.origin.y - _CPWindowViewResizeSlop, + _CPWindowViewResizeSlop * 2, + frame.size.height + (_CPWindowViewResizeSlop * 2)); if (_CGRectContainsPoint(rect, aPoint)) return _CPWindowViewResizeRegionLeft; - rect.origin.x = _CGRectGetMaxX(frame) - CPWindowResizeSlop; + rect.origin.x = _CGRectGetMaxX(frame) - _CPWindowViewResizeSlop; if (_CGRectContainsPoint(rect, aPoint)) return _CPWindowViewResizeRegionRight; } else { - rect = _CGRectMake(frame.origin.x - CPWindowResizeSlop, - frame.origin.y - CPWindowResizeSlop, - _CPWindowViewCornerResizeRectWidth + CPWindowResizeSlop, - _CPWindowViewCornerResizeRectWidth + CPWindowResizeSlop); + rect = _CGRectMake(frame.origin.x - _CPWindowViewResizeSlop, + frame.origin.y - _CPWindowViewResizeSlop, + _CPWindowViewCornerResizeRectWidth + _CPWindowViewResizeSlop, + _CPWindowViewCornerResizeRectWidth + _CPWindowViewResizeSlop); if (_CGRectContainsPoint(rect, aPoint)) return _CPWindowViewResizeRegionTopLeft; @@ -294,33 +292,33 @@ var _CPWindowViewCornerResizeRectWidth = 10, if (_CGRectContainsPoint(rect, aPoint)) return _CPWindowViewResizeRegionBottomRight; - rect.origin.x = frame.origin.x - CPWindowResizeSlop; + rect.origin.x = frame.origin.x - _CPWindowViewResizeSlop; if (_CGRectContainsPoint(rect, aPoint)) return _CPWindowViewResizeRegionBottomLeft; rect = _CGRectMake(rect.origin.x, frame.origin.y + _CPWindowViewCornerResizeRectWidth, - CPWindowResizeSlop * 2, + _CPWindowViewResizeSlop * 2, _CGRectGetHeight(frame) - (_CPWindowViewCornerResizeRectWidth * 2)); if (_CGRectContainsPoint(rect, aPoint)) return _CPWindowViewResizeRegionLeft; - rect.origin.x = _CGRectGetMaxX(frame) - CPWindowResizeSlop; + rect.origin.x = _CGRectGetMaxX(frame) - _CPWindowViewResizeSlop; if (_CGRectContainsPoint(rect, aPoint)) return _CPWindowViewResizeRegionRight; rect = _CGRectMake(frame.origin.x + _CPWindowViewCornerResizeRectWidth, - frame.origin.y - CPWindowResizeSlop, + frame.origin.y - _CPWindowViewResizeSlop, _CGRectGetWidth(frame) - (_CPWindowViewCornerResizeRectWidth * 2), - CPWindowResizeSlop * 2); + _CPWindowViewResizeSlop * 2); if (_CGRectContainsPoint(rect, aPoint)) return _CPWindowViewResizeRegionTop; - rect.origin.y = _CGRectGetMaxY(frame) - CPWindowResizeSlop; + rect.origin.y = _CGRectGetMaxY(frame) - _CPWindowViewResizeSlop; if (_CGRectContainsPoint(rect, aPoint)) return _CPWindowViewResizeRegionBottom; diff --git a/AppKit/CPWindowController.j b/AppKit/CPWindowController.j index feb4ae668..21b5e79c7 100644 --- a/AppKit/CPWindowController.j +++ b/AppKit/CPWindowController.j @@ -23,9 +23,9 @@ @import @import +@import "CPCib.j" @import "CPResponder.j" @import "CPWindow.j" -@import "CPDocument.j" @class CPDocument diff --git a/AppKit/Cib/CPCib.j b/AppKit/Cib/CPCib.j index c1b2a46d6..e7585757e 100644 --- a/AppKit/Cib/CPCib.j +++ b/AppKit/Cib/CPCib.j @@ -29,10 +29,10 @@ @import "_CPCibCustomResource.j" @import "_CPCibCustomView.j" @import "_CPCibKeyedUnarchiver.j" -@import "_CPCibObjectData.j" @import "_CPCibProxyObject.j" @import "_CPCibWindowTemplate.j" +@class _CPCibObjectData CPCibOwner = @"CPCibOwner"; CPCibTopLevelObjects = @"CPCibTopLevelObjects"; diff --git a/AppKit/Cib/CPCibLoading.j b/AppKit/Cib/CPCibLoading.j index 12fe13e9e..02e91af1e 100644 --- a/AppKit/Cib/CPCibLoading.j +++ b/AppKit/Cib/CPCibLoading.j @@ -24,6 +24,7 @@ @import @import +@import "CPCib.j" var CPCibOwner = @"CPCibOwner"; diff --git a/AppKit/Cib/_CPCibCustomObject.j b/AppKit/Cib/_CPCibCustomObject.j index 89652fe84..17410767f 100644 --- a/AppKit/Cib/_CPCibCustomObject.j +++ b/AppKit/Cib/_CPCibCustomObject.j @@ -1,5 +1,27 @@ +/* + * _CPCibCustomObject.j + * AppKit + * + * Created by Francisco Tolmasky. + * Copyright 2008, 280 North, Inc. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library 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 + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ @import +@import @class CPApplication diff --git a/AppKit/Cib/_CPCibCustomResource.j b/AppKit/Cib/_CPCibCustomResource.j index 514292520..508c5e3c2 100644 --- a/AppKit/Cib/_CPCibCustomResource.j +++ b/AppKit/Cib/_CPCibCustomResource.j @@ -26,6 +26,10 @@ @import @import +@import "CPCompatibility.j" +@import "CPImage.j" +@import "CPTheme.j" + @class CPButtonBar diff --git a/AppKit/Cib/_CPCibKeyedUnarchiver.j b/AppKit/Cib/_CPCibKeyedUnarchiver.j index 39765ce53..bdb88d1a0 100644 --- a/AppKit/Cib/_CPCibKeyedUnarchiver.j +++ b/AppKit/Cib/_CPCibKeyedUnarchiver.j @@ -1,3 +1,24 @@ +/* + * _CPCibKeyedUnarchiver.j + * AppKit + * + * Created by Francisco Tolmasky. + * Copyright 2008, 280 North, Inc. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library 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 + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ @import diff --git a/AppKit/Cib/_CPCibProxyObject.j b/AppKit/Cib/_CPCibProxyObject.j index 5122818b4..cfaf1c64f 100644 --- a/AppKit/Cib/_CPCibProxyObject.j +++ b/AppKit/Cib/_CPCibProxyObject.j @@ -1,3 +1,24 @@ +/* + * _CPCibProxyObject.j + * AppKit + * + * Created by Francisco Tolmasky. + * Copyright 2009, 280 North, Inc. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library 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 + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ @import diff --git a/AppKit/Cib/_CPCibWindowTemplate.j b/AppKit/Cib/_CPCibWindowTemplate.j index 6cee86b69..b224b7214 100644 --- a/AppKit/Cib/_CPCibWindowTemplate.j +++ b/AppKit/Cib/_CPCibWindowTemplate.j @@ -1,19 +1,34 @@ +/* + * _CPCibWindowTemplate.j + * AppKit + * + * Created by Francisco Tolmasky. + * Copyright 2008, 280 North, Inc. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library 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 + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ @import +@import @import "CGGeometry.j" -@import "CPWindow.j" +@import "CPView.j" +@import "CPWindow_Constants.j" @class CPToolbar -@global CPPositionProportionalHorizontal -@global CPPositionProportionalVertical - -CPWindowPositionFlexibleRight = 1 << 19; -CPWindowPositionFlexibleLeft = 1 << 20; -CPWindowPositionFlexibleBottom = 1 << 21; -CPWindowPositionFlexibleTop = 1 << 22; - @implementation _CPCibWindowTemplate : CPObject { @@ -49,7 +64,7 @@ CPWindowPositionFlexibleTop = 1 << 22; _windowIsFullPlatformWindow = NO; - _wtFlags = CPPositionProportionalHorizontal | CPPositionProportionalVertical; + _wtFlags = CPWindowPositionFlexibleLeft | CPWindowPositionFlexibleRight | CPWindowPositionFlexibleTop | CPWindowPositionFlexibleBottom; } return self; @@ -101,7 +116,7 @@ CPWindowPositionFlexibleTop = 1 << 22; } [theWindow setAutorecalculatesKeyViewLoop:_windowAutorecalculatesKeyViewLoop]; - [theWindow setFullBridge:_windowIsFullPlatformWindow]; + [theWindow setFullPlatformWindow:_windowIsFullPlatformWindow]; theWindow._positioningMask = _wtFlags; theWindow._positioningScreenRect = _screenRect; diff --git a/AppKit/CoreAnimation/CALayer.j b/AppKit/CoreAnimation/CALayer.j index a86b1795a..d5b390996 100644 --- a/AppKit/CoreAnimation/CALayer.j +++ b/AppKit/CoreAnimation/CALayer.j @@ -21,6 +21,7 @@ */ @import +@import @import "CABackingStore.j" diff --git a/AppKit/Platform/CPPlatformWindow.j b/AppKit/Platform/CPPlatformWindow.j index f1920e57c..7b60a7c1e 100644 --- a/AppKit/Platform/CPPlatformWindow.j +++ b/AppKit/Platform/CPPlatformWindow.j @@ -20,11 +20,10 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ +@import @import @import "CPKeyBinding.j" -//@import "CPMenu.j" @import "CPPlatform.j" -//@import "CPEvent.j" @class CPMenu diff --git a/AppKit/Platform/DOM/CPPlatformWindow+DOM.j b/AppKit/Platform/DOM/CPPlatformWindow+DOM.j index 9e9892afc..c61690c0d 100644 --- a/AppKit/Platform/DOM/CPPlatformWindow+DOM.j +++ b/AppKit/Platform/DOM/CPPlatformWindow+DOM.j @@ -109,34 +109,26 @@ @import @import +@import +@import +@import "CPCursor.j" @import "CPEvent.j" @import "CPText.j" @import "CPCompatibility.j" @import "CPDOMWindowLayer.j" - +@import "CPDragServer_Constants.j" +@import "CPPasteboard.j" @import "CPPlatform.j" @import "CPPlatformWindow.j" @import "CPPlatformWindow+DOMKeys.j" +@import "CPWindow_Constants.j" -@class CPCursor @class CPDragServer -@class CPPasteboard -@class _CPDOMDataTransferPasteboard @class _CPToolTip -@global CPDragOperationNone -@global CPDragOperationMove -@global CPDragOperationCopy -@global CPDragOperationLink -@global CPDragOperationPrivate -@global CPDragOperationGeneric @global CPApp -@global CPStringPboardType -@global CPWindowOut @global _CPRunModalLoop -@global CPDraggingWindowLevel -@global CPWindowAbove // List of all open native windows var PlatformWindows = [CPSet set]; @@ -561,6 +553,7 @@ var resizeTimer = nil; // FIXME: cpSetFrame? _DOMWindow.document.write(""); _DOMWindow.document.close(); + if (self != [CPPlatformWindow primaryPlatformWindow]) _DOMWindow.document.title = _title; @@ -681,7 +674,6 @@ var resizeTimer = nil; - (void)keyEvent:(DOMEvent)aDOMEvent { var event, - location = _CGPointMake(aDOMEvent.clientX, aDOMEvent.clientY), timestamp = [CPEvent currentTimestamp], sourceElement = aDOMEvent.target || aDOMEvent.srcElement, windowNumber = [[CPApp keyWindow] windowNumber], @@ -716,157 +708,160 @@ var resizeTimer = nil; var isNativePasteEvent = NO, isNativeCopyOrCutEvent = NO, - overrideCharacters = nil; + overrideCharacters = nil, + charactersIgnoringModifiers = @""; switch (aDOMEvent.type) { - case "keydown": // Grab and store the keycode now since it is correct and consistent at this point. - if (aDOMEvent.keyCode in MozKeyCodeToKeyCodeMap) - _keyCode = MozKeyCodeToKeyCodeMap[aDOMEvent.keyCode]; - else - _keyCode = aDOMEvent.keyCode; + case "keydown": + // Grab and store the keycode now since it is correct and consistent at this point. + if (aDOMEvent.keyCode in MozKeyCodeToKeyCodeMap) + _keyCode = MozKeyCodeToKeyCodeMap[aDOMEvent.keyCode]; + else + _keyCode = aDOMEvent.keyCode; - var characters; + var characters; - // Handle key codes for which String.fromCharCode won't work. - // Refs #1036: In Internet Explorer, both 'which' and 'charCode' are undefined for special keys. - if (aDOMEvent.which === 0 || aDOMEvent.charCode === 0 || (aDOMEvent.which === undefined && aDOMEvent.charCode === undefined)) - characters = KeyCodesToUnicodeMap[_keyCode]; + // Handle key codes for which String.fromCharCode won't work. + // Refs #1036: In Internet Explorer, both 'which' and 'charCode' are undefined for special keys. + if (aDOMEvent.which === 0 || aDOMEvent.charCode === 0 || (aDOMEvent.which === undefined && aDOMEvent.charCode === undefined)) + characters = KeyCodesToUnicodeMap[_keyCode]; - if (!characters) - characters = String.fromCharCode(_keyCode).toLowerCase(); + if (!characters) + characters = String.fromCharCode(_keyCode).toLowerCase(); - overrideCharacters = (modifierFlags & CPShiftKeyMask || _capsLockActive) ? characters.toUpperCase() : characters; + overrideCharacters = (modifierFlags & CPShiftKeyMask || _capsLockActive) ? characters.toUpperCase() : characters; - // check for caps lock state - if (_keyCode === CPKeyCodes.CAPS_LOCK) - _capsLockActive = YES; + // check for caps lock state + if (_keyCode === CPKeyCodes.CAPS_LOCK) + _capsLockActive = YES; - if ([ModifierKeyCodes containsObject:_keyCode]) - { - // A modifier key will never fire keypress. We don't need to do any other processing so we just fire it here and break. - event = [CPEvent keyEventWithType:CPFlagsChanged location:location modifierFlags:modifierFlags - timestamp:timestamp windowNumber:windowNumber context:nil - characters:nil charactersIgnoringModifiers:nil isARepeat:NO keyCode:_keyCode]; + if ([ModifierKeyCodes containsObject:_keyCode]) + { + // A modifier key will never fire keypress. We don't need to do any other processing so we just fire it here and break. + event = [CPEvent keyEventWithType:CPFlagsChanged location:location modifierFlags:modifierFlags + timestamp:timestamp windowNumber:windowNumber context:nil + characters:nil charactersIgnoringModifiers:nil isARepeat:NO keyCode:_keyCode]; - break; - } - else if (modifierFlags & (CPControlKeyMask | CPCommandKeyMask)) - { - //we are simply going to skip all keypress events that use cmd/ctrl key - //this lets us be consistent in all browsers and send on the keydown - //which means we can cancel the event early enough, but only if sendEvent needs to + break; + } + else if (modifierFlags & (CPControlKeyMask | CPCommandKeyMask)) + { + //we are simply going to skip all keypress events that use cmd/ctrl key + //this lets us be consistent in all browsers and send on the keydown + //which means we can cancel the event early enough, but only if sendEvent needs to - var eligibleForCopyPaste = [self _validateCopyCutOrPasteEvent:aDOMEvent flags:modifierFlags]; + var eligibleForCopyPaste = [self _validateCopyCutOrPasteEvent:aDOMEvent flags:modifierFlags]; - // If this could be a native PASTE event, then we need to further examine it before - // sending a CPEvent. Select our element to see if anything gets pasted in it. - if (characters === "v" && eligibleForCopyPaste) - { - if (!_ignoreNativePastePreparation) - { - _DOMPasteboardElement.select(); - _DOMPasteboardElement.value = ""; - } + // If this could be a native PASTE event, then we need to further examine it before + // sending a CPEvent. Select our element to see if anything gets pasted in it. + if (characters === "v" && eligibleForCopyPaste) + { + if (!_ignoreNativePastePreparation) + { + _DOMPasteboardElement.select(); + _DOMPasteboardElement.value = ""; + } - isNativePasteEvent = YES; - } + isNativePasteEvent = YES; + } - // However, of this could be a native COPY event, we need to let the normal event-process take place so it - // can capture our internal Cappuccino pasteboard. - else if ((characters == "c" || characters == "x") && eligibleForCopyPaste) - { - isNativeCopyOrCutEvent = YES; + // However, of this could be a native COPY event, we need to let the normal event-process take place so it + // can capture our internal Cappuccino pasteboard. + else if ((characters == "c" || characters == "x") && eligibleForCopyPaste) + { + isNativeCopyOrCutEvent = YES; - if (_ignoreNativeCopyOrCutEvent) - break; - } - } - else if (CPKeyCodes.firesKeyPressEvent(_keyCode, _lastKey, aDOMEvent.shiftKey, aDOMEvent.ctrlKey, aDOMEvent.altKey)) - { - // this branch is taken by events which fire keydown, keypress, and keyup. - // this is the only time we'll ALLOW character keys to propagate (needed for text fields) - StopDOMEventPropagation = NO; - break; - } - else - { - //this branch is taken by "remedial" key events - // In this state we continue to keypress and send the CPEvent - } + if (_ignoreNativeCopyOrCutEvent) + break; + } + } + else if (CPKeyCodes.firesKeyPressEvent(_keyCode, _lastKey, aDOMEvent.shiftKey, aDOMEvent.ctrlKey, aDOMEvent.altKey)) + { + // this branch is taken by events which fire keydown, keypress, and keyup. + // this is the only time we'll ALLOW character keys to propagate (needed for text fields) + StopDOMEventPropagation = NO; + break; + } + else + { + //this branch is taken by "remedial" key events + // In this state we continue to keypress and send the CPEvent + } case "keypress": - // we unconditionally break on keypress events with modifiers, - // because we forced the event to be sent on the keydown - if (aDOMEvent.type === "keypress" && (modifierFlags & (CPControlKeyMask | CPCommandKeyMask))) - break; + // we unconditionally break on keypress events with modifiers, + // because we forced the event to be sent on the keydown + if (aDOMEvent.type === "keypress" && (modifierFlags & (CPControlKeyMask | CPCommandKeyMask))) + break; - var keyCode = _keyCode, - charCode = aDOMEvent.keyCode || aDOMEvent.charCode, - isARepeat = (_charCodes[keyCode] != nil); + var keyCode = _keyCode, + charCode = aDOMEvent.keyCode || aDOMEvent.charCode, + isARepeat = (_charCodes[keyCode] != nil); - _lastKey = keyCode; - _charCodes[keyCode] = charCode; + _lastKey = keyCode; + _charCodes[keyCode] = charCode; - var characters = overrideCharacters; - // Is this a special key? - if (!characters && (aDOMEvent.which === 0 || aDOMEvent.charCode === 0)) - characters = KeyCodesToUnicodeMap[charCode]; + var characters = overrideCharacters; + // Is this a special key? + if (!characters && (aDOMEvent.which === 0 || aDOMEvent.charCode === 0)) + characters = KeyCodesToUnicodeMap[charCode]; - if (!characters) - characters = String.fromCharCode(charCode); + if (!characters) + characters = String.fromCharCode(charCode); - var charactersIgnoringModifiers = characters.toLowerCase(); // FIXME: This isn't correct. It SHOULD include Shift. + charactersIgnoringModifiers = characters.toLowerCase(); // FIXME: This isn't correct. It SHOULD include Shift. - // Safari won't send proper capitalization during cmd-key events - if (!overrideCharacters && (modifierFlags & CPCommandKeyMask) && ((modifierFlags & CPShiftKeyMask) || _capsLockActive)) - characters = characters.toUpperCase(); + // Safari won't send proper capitalization during cmd-key events + if (!overrideCharacters && (modifierFlags & CPCommandKeyMask) && ((modifierFlags & CPShiftKeyMask) || _capsLockActive)) + characters = characters.toUpperCase(); - event = [CPEvent keyEventWithType:CPKeyDown location:location modifierFlags:modifierFlags - timestamp:timestamp windowNumber:windowNumber context:nil - characters:characters charactersIgnoringModifiers:charactersIgnoringModifiers isARepeat:isARepeat keyCode:charCode]; + event = [CPEvent keyEventWithType:CPKeyDown location:location modifierFlags:modifierFlags + timestamp:timestamp windowNumber:windowNumber context:nil + characters:characters charactersIgnoringModifiers:charactersIgnoringModifiers isARepeat:isARepeat keyCode:charCode]; - if (isNativePasteEvent) - { - _pasteboardKeyDownEvent = event; - window.setNativeTimeout(function () { [self _checkPasteboardElement] }, 0); - } + if (isNativePasteEvent) + { + _pasteboardKeyDownEvent = event; + window.setNativeTimeout(function () { [self _checkPasteboardElement] }, 0); + } - break; + break; - case "keyup": var keyCode = aDOMEvent.keyCode, - charCode = _charCodes[keyCode]; + case "keyup": + var keyCode = aDOMEvent.keyCode, + charCode = _charCodes[keyCode]; - _keyCode = -1; - _lastKey = -1; - _charCodes[keyCode] = nil; - _ignoreNativeCopyOrCutEvent = NO; - _ignoreNativePastePreparation = NO; + _keyCode = -1; + _lastKey = -1; + _charCodes[keyCode] = nil; + _ignoreNativeCopyOrCutEvent = NO; + _ignoreNativePastePreparation = NO; - // check for caps lock state - if (keyCode === CPKeyCodes.CAPS_LOCK) - _capsLockActive = NO; + // check for caps lock state + if (keyCode === CPKeyCodes.CAPS_LOCK) + _capsLockActive = NO; - if ([ModifierKeyCodes containsObject:keyCode]) - { - // A modifier key will never fire keypress. We don't need to do any other processing so we just fire it here and break. - event = [CPEvent keyEventWithType:CPFlagsChanged location:location modifierFlags:modifierFlags - timestamp:timestamp windowNumber:windowNumber context:nil - characters:nil charactersIgnoringModifiers:nil isARepeat:NO keyCode:_keyCode]; + if ([ModifierKeyCodes containsObject:keyCode]) + { + // A modifier key will never fire keypress. We don't need to do any other processing so we just fire it here and break. + event = [CPEvent keyEventWithType:CPFlagsChanged location:location modifierFlags:modifierFlags + timestamp:timestamp windowNumber:windowNumber context:nil + characters:nil charactersIgnoringModifiers:nil isARepeat:NO keyCode:_keyCode]; - break; - } + break; + } - var characters = KeyCodesToUnicodeMap[charCode] || String.fromCharCode(charCode), - charactersIgnoringModifiers = characters.toLowerCase(); + var characters = KeyCodesToUnicodeMap[charCode] || String.fromCharCode(charCode); + charactersIgnoringModifiers = characters.toLowerCase(); - if (!(modifierFlags & CPShiftKeyMask) && (modifierFlags & CPCommandKeyMask) && !_capsLockActive) - characters = charactersIgnoringModifiers; + if (!(modifierFlags & CPShiftKeyMask) && (modifierFlags & CPCommandKeyMask) && !_capsLockActive) + characters = charactersIgnoringModifiers; - event = [CPEvent keyEventWithType:CPKeyUp location:location modifierFlags:modifierFlags - timestamp: timestamp windowNumber:windowNumber context:nil - characters:characters charactersIgnoringModifiers:charactersIgnoringModifiers isARepeat:NO keyCode:keyCode]; - break; + event = [CPEvent keyEventWithType:CPKeyUp location:location modifierFlags:modifierFlags + timestamp: timestamp windowNumber:windowNumber context:nil + characters:characters charactersIgnoringModifiers:charactersIgnoringModifiers isARepeat:NO keyCode:keyCode]; + break; } if (event && !isNativePasteEvent) @@ -898,10 +893,8 @@ var resizeTimer = nil; characters = cut ? "x" : "c", timestamp = [CPEvent currentTimestamp], // fake event, might as well use current timestamp windowNumber = [[CPApp keyWindow] windowNumber], - location = _CGPointMake(aDOMEvent.clientX, aDOMEvent.clientY), - modifierFlags = CPPlatformActionKeyMask; - - var event = [CPEvent keyEventWithType:CPKeyDown location:location modifierFlags:modifierFlags + modifierFlags = CPPlatformActionKeyMask, + event = [CPEvent keyEventWithType:CPKeyDown location:location modifierFlags:modifierFlags timestamp:timestamp windowNumber:windowNumber context:nil characters:characters charactersIgnoringModifiers:characters isARepeat:NO keyCode:keyCode]; @@ -1393,6 +1386,7 @@ var resizeTimer = nil; } var insertionIndex = 0; + if (middle !== undefined) insertionIndex = _windowLevels[middle] > aLevel ? middle : middle + 1 @@ -1419,6 +1413,7 @@ var resizeTimer = nil; return [layer removeWindow:aWindow]; var insertionIndex = CPNotFound; + if (otherWindow) insertionIndex = aPlace === CPWindowAbove ? otherWindow._index + 1 : otherWindow._index; diff --git a/AppKit/_CPPopUpListDataSource.j b/AppKit/_CPPopUpListDataSource.j index cd413779d..36ccaf51a 100644 --- a/AppKit/_CPPopUpListDataSource.j +++ b/AppKit/_CPPopUpListDataSource.j @@ -20,6 +20,8 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ +@import +@import /*! This abstract base class defines the methods that delegates of _CPPopUpList must implement. diff --git a/AppKit/_CPToolTip.j b/AppKit/_CPToolTip.j index a8383228a..2e93c9d24 100644 --- a/AppKit/_CPToolTip.j +++ b/AppKit/_CPToolTip.j @@ -24,6 +24,8 @@ @import "CPView.j" @import "CPWindow.j" +@global CPApp + _CPToolTipWindowMask = 1 << 27; var _CPToolTipHeight = 24.0, diff --git a/AppKit/_CPToolbarItem.j b/AppKit/_CPToolbarItem.j index 4f6f23a25..f3f4d1819 100644 --- a/AppKit/_CPToolbarItem.j +++ b/AppKit/_CPToolbarItem.j @@ -26,6 +26,7 @@ @import "CPImage.j" @import "CPView.j" +@global CPApp CPToolbarItemVisibilityPriorityStandard = 0; CPToolbarItemVisibilityPriorityLow = -1000; diff --git a/AppKit/_CPToolbarShowColorsItem.j b/AppKit/_CPToolbarShowColorsItem.j index 012ea37c5..368244fef 100644 --- a/AppKit/_CPToolbarShowColorsItem.j +++ b/AppKit/_CPToolbarShowColorsItem.j @@ -20,9 +20,9 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ -@import "CPApplication.j" @import "_CPToolbarItem.j" +@global CPApp @implementation _CPToolbarShowColorsItem : CPToolbarItem { diff --git a/Tools/nib2cib/NSWindowTemplate.j b/Tools/nib2cib/NSWindowTemplate.j index d728bfa50..49063a668 100644 --- a/Tools/nib2cib/NSWindowTemplate.j +++ b/Tools/nib2cib/NSWindowTemplate.j @@ -87,7 +87,7 @@ var NSBorderlessWindowMask = 0x00, (_windowStyleMask & NSDocModalWindowMask ? CPDocModalWindowMask : 0) | (_windowStyleMask & NSHUDBackgroundWindowMask ? CPHUDBackgroundWindowMask : 0); - _windowIsFullPlatformWindow = [aCoder decodeObjectForKey:"NSFrameAutosaveName"] === "CPBorderlessBridgeWindowMask"; + _windowIsFullPlatformWindow = [aCoder decodeObjectForKey:@"NSFrameAutosaveName"] === @"CPBorderlessBridgeWindowMask"; /*if (![_windowClass isEqualToString:@"NSPanel"]) _windowRect.origin.y -= [NSMainMenuView menuHeight]; // compensation for the additional menu bar