From 459316f102f6cfd92a2379f7347d32e6f6de8c88 Mon Sep 17 00:00:00 2001 From: Francisco Ryan Tolmasky I Date: Mon, 22 Dec 2008 13:53:48 -0800 Subject: [PATCH 01/14] Major Window Fixes/Changes. [#65 state:resolved]. [#58 state:resolved]. [#94 state:resolved]. Reviewed by me. --- AppKit/CPPopUpButton.j | 9 +- AppKit/CPToolbar.j | 63 ++-- AppKit/CPToolbarItem.j | 51 ++- AppKit/{ => CPWindow}/CPWindow.j | 126 ++++---- .../CPWindow/_CPBorderlessBridgeWindowView.j | 77 +++++ AppKit/CPWindow/_CPBorderlessWindowView.j | 29 ++ AppKit/CPWindow/_CPHUDWindowView.j | 199 ++++++++++++ AppKit/CPWindow/_CPStandardWindowView.j | 285 +++++++++++++++++ AppKit/CPWindow/_CPWindowView.j | 259 +++++++++++++++ .../CPWindow/HUD/CPWindowHUDBackground0.png | Bin 0 -> 317 bytes .../CPWindow/HUD/CPWindowHUDBackground1.png | Bin 0 -> 185 bytes .../CPWindow/HUD/CPWindowHUDBackground2.png | Bin 0 -> 345 bytes .../CPWindow/HUD/CPWindowHUDBackground3.png | Bin 0 -> 117 bytes .../CPWindow/HUD/CPWindowHUDBackground4.png | Bin 0 -> 109 bytes .../CPWindow/HUD/CPWindowHUDBackground5.png | Bin 0 -> 117 bytes .../CPWindow/HUD/CPWindowHUDBackground6.png | Bin 0 -> 204 bytes .../CPWindow/HUD/CPWindowHUDBackground7.png | Bin 0 -> 122 bytes .../CPWindow/HUD/CPWindowHUDBackground8.png | Bin 0 -> 206 bytes .../Standard/CPWindowStandardTop0.png} | Bin 2823 -> 2896 bytes .../Standard/CPWindowStandardTop1.png} | Bin 2792 -> 2812 bytes .../Standard/CPWindowStandardTop2.png} | Bin 2844 -> 2886 bytes .../Resources/HUDTheme/WindowBottomLeft.png | Bin 3093 -> 0 bytes .../Resources/HUDTheme/WindowBottomRight.png | Bin 3105 -> 0 bytes .../Resources/HUDTheme/WindowCenterLeft.png | Bin 2822 -> 0 bytes AppKit/Resources/HUDTheme/WindowTopCenter.png | Bin 2929 -> 0 bytes AppKit/Resources/HUDTheme/WindowTopLeft.png | Bin 3462 -> 0 bytes AppKit/Resources/HUDTheme/WindowTopRight.png | Bin 3454 -> 0 bytes AppKit/_CPWindowView.j | 298 ------------------ 28 files changed, 997 insertions(+), 399 deletions(-) rename AppKit/{ => CPWindow}/CPWindow.j (95%) create mode 100644 AppKit/CPWindow/_CPBorderlessBridgeWindowView.j create mode 100644 AppKit/CPWindow/_CPBorderlessWindowView.j create mode 100644 AppKit/CPWindow/_CPHUDWindowView.j create mode 100644 AppKit/CPWindow/_CPStandardWindowView.j create mode 100644 AppKit/CPWindow/_CPWindowView.j create mode 100644 AppKit/Resources/CPWindow/HUD/CPWindowHUDBackground0.png create mode 100644 AppKit/Resources/CPWindow/HUD/CPWindowHUDBackground1.png create mode 100644 AppKit/Resources/CPWindow/HUD/CPWindowHUDBackground2.png create mode 100644 AppKit/Resources/CPWindow/HUD/CPWindowHUDBackground3.png create mode 100644 AppKit/Resources/CPWindow/HUD/CPWindowHUDBackground4.png create mode 100644 AppKit/Resources/CPWindow/HUD/CPWindowHUDBackground5.png create mode 100644 AppKit/Resources/CPWindow/HUD/CPWindowHUDBackground6.png create mode 100644 AppKit/Resources/CPWindow/HUD/CPWindowHUDBackground7.png create mode 100644 AppKit/Resources/CPWindow/HUD/CPWindowHUDBackground8.png rename AppKit/Resources/{HUDTheme/WindowCenterRight.png => CPWindow/Standard/CPWindowStandardTop0.png} (92%) rename AppKit/Resources/{HUDTheme/WindowCenter.png => CPWindow/Standard/CPWindowStandardTop1.png} (95%) rename AppKit/Resources/{HUDTheme/WindowBottomCenter.png => CPWindow/Standard/CPWindowStandardTop2.png} (93%) delete mode 100644 AppKit/Resources/HUDTheme/WindowBottomLeft.png delete mode 100644 AppKit/Resources/HUDTheme/WindowBottomRight.png delete mode 100644 AppKit/Resources/HUDTheme/WindowCenterLeft.png delete mode 100644 AppKit/Resources/HUDTheme/WindowTopCenter.png delete mode 100644 AppKit/Resources/HUDTheme/WindowTopLeft.png delete mode 100644 AppKit/Resources/HUDTheme/WindowTopRight.png delete mode 100644 AppKit/_CPWindowView.j diff --git a/AppKit/CPPopUpButton.j b/AppKit/CPPopUpButton.j index 32eabce09..bd8f19659 100644 --- a/AppKit/CPPopUpButton.j +++ b/AppKit/CPPopUpButton.j @@ -631,8 +631,9 @@ var CPPopUpButtonArrowsImage = nil; [self highlight:YES]; - var theWindow = [self window], - menuWindow = [_CPMenuWindow menuWindowWithMenu:[self menu] font:[self font]]; + var menu = [self menu], + theWindow = [self window], + menuWindow = [_CPMenuWindow menuWindowWithMenu:menu font:[self font]]; [menuWindow setDelegate:self]; [menuWindow setBackgroundStyle:_CPMenuWindowPopUpBackgroundStyle]; @@ -648,14 +649,14 @@ var CPPopUpButtonArrowsImage = nil; { var contentRect = [menuWindow rectForItemAtIndex:_selectedIndex]; - menuOrigin.x -= CGRectGetMinX(contentRect) + [_CPMenuItemView leftMargin]; + menuOrigin.x -= CGRectGetMinX(contentRect) + [[[menu itemAtIndex:_selectedIndex] _menuItemView] calculatedLeftMargin]; menuOrigin.y -= CGRectGetMinY(contentRect); } [menuWindow setFrameOrigin:menuOrigin]; var menuMaxX = CGRectGetMaxX([menuWindow frame]), - buttonMaxX = CGRectGetMaxX([self convertRect:[self bounds] toView:nil]); + buttonMaxX = [theWindow convertBaseToBridge:CGPointMake(CGRectGetMaxX([self convertRect:[self bounds] toView:nil]), 0.0)].x; if (menuMaxX < buttonMaxX) [menuWindow setMinWidth:CGRectGetWidth([menuWindow frame]) + buttonMaxX - menuMaxX - VISIBLE_MARGIN]; diff --git a/AppKit/CPToolbar.j b/AppKit/CPToolbar.j index 2d72bece0..980e8124d 100644 --- a/AppKit/CPToolbar.j +++ b/AppKit/CPToolbar.j @@ -100,6 +100,7 @@ var CPToolbarConfigurationsByIdentifier = nil; CPArray _itemsSortedByVisibilityPriority; CPView _toolbarView; + CPWindow _window; } /* @ignore */ @@ -187,13 +188,22 @@ var CPToolbarConfigurationsByIdentifier = nil; */ - (void)setVisible:(BOOL)aFlag { - if (_isVisible == aFlag) + if (_isVisible === aFlag) return; - + _isVisible = aFlag; - [_window _setToolbarVisible:_isVisible]; - [self _reloadToolbarItems]; + [_window _noteToolbarChanged]; +} + +- (CPWindow)_window +{ + return _window; +} + +- (void)_setWindow:(CPWindow)aWindow +{ + _window = aWindow; } /*! @@ -222,9 +232,10 @@ var CPToolbarConfigurationsByIdentifier = nil; if (!_toolbarView) { _toolbarView = [[_CPToolbarView alloc] initWithFrame:CPRectMake(0.0, 0.0, 1200.0, 59.0)]; - [_toolbarView setAutoresizingMask:CPViewWidthSizable]; - + [_toolbarView setToolbar:self]; + [_toolbarView setAutoresizingMask:CPViewWidthSizable]; + [_toolbarView reloadToolbarItems]; } return _toolbarView; @@ -233,9 +244,9 @@ var CPToolbarConfigurationsByIdentifier = nil; /* @ignore */ - (void)_reloadToolbarItems { - if (![_toolbarView superview] || !_delegate) + if (!_delegate) return; - + var count = [_itemIdentifiers count]; if (!count) @@ -243,8 +254,6 @@ var CPToolbarConfigurationsByIdentifier = nil; _itemIdentifiers = [[_delegate toolbarDefaultItemIdentifiers:self] mutableCopy]; count = [_itemIdentifiers count]; } - - [[_toolbarView subviews] makeObjectsPerformSelector:@selector(removeFromSuperview)]; _items = []; @@ -256,8 +265,10 @@ var CPToolbarConfigurationsByIdentifier = nil; item = [CPToolbarItem _standardItemWithItemIdentifier:identifier]; if (!item) - item = [[_delegate toolbar:self itemForItemIdentifier:identifier willBeInsertedIntoToolbar:YES] copy]; - + item = [_delegate toolbar:self itemForItemIdentifier:identifier willBeInsertedIntoToolbar:YES]; + + item = [item copy]; + if (item == nil) [CPException raise:CPInvalidArgumentException reason:sprintf(@"_delegate %s returned nil toolbar item returned for identifier %s", _delegate, identifier)]; @@ -436,6 +447,7 @@ var _CPToolbarItemInfoMake = function(anIndex, aView, aLabel, aMinWidth) CPArray _invisibleItems; CPPopUpButton _additionalItemsButton; + CPColor _labelColor; } + (void)initialize @@ -445,8 +457,6 @@ var _CPToolbarItemInfoMake = function(anIndex, aView, aLabel, aMinWidth) var bundle = [CPBundle bundleForClass:self]; - _CPToolbarViewBackgroundColor = [CPColor colorWithPatternImage:[[CPImage alloc] initWithContentsOfFile:[bundle pathForResource:@"_CPToolbarView/_CPToolbarViewBackground.png"] size:CGSizeMake(1.0, 59.0)]]; - _CPToolbarViewExtraItemsImage = [[CPImage alloc] initWithContentsOfFile: [bundle pathForResource:"_CPToolbarView/_CPToolbarViewExtraItemsImage.png"] size: CPSizeMake(10.0, 15.0)]; _CPToolbarViewExtraItemsAlternateImage = [[CPImage alloc] initWithContentsOfFile: [bundle pathForResource:"_CPToolbarView/_CPToolbarViewExtraItemsAlternateImage.png"] size:CGSizeMake(10.0, 15.0)]; @@ -460,7 +470,7 @@ var _CPToolbarItemInfoMake = function(anIndex, aView, aLabel, aMinWidth) { _minWidth = 0; - [self setBackgroundColor:_CPToolbarViewBackgroundColor]; + _labelColor = [CPColor blackColor]; _additionalItemsButton = [[CPPopUpButton alloc] initWithFrame:CGRectMake(0.0, 0.0, 10.0, 15.0) pullsDown:YES]; [_additionalItemsButton setBordered:NO]; @@ -484,6 +494,20 @@ var _CPToolbarItemInfoMake = function(anIndex, aView, aLabel, aMinWidth) return _toolbar; } +- (void)setLabelColor:(CPColor)aColor +{ + if (_labelColor === aColor) + return; + + _labelColor = aColor; + + var items = [_toolbar items], + count = [items count]; + + while (count--) + [[self labelForItem:items[count]] setTextColor:_labelColor]; +} + // This *should* be roughly O(3N) = O(N) - (void)resizeSubviewsWithOldSize:(CGSize)aSize { @@ -527,7 +551,7 @@ var _CPToolbarItemInfoMake = function(anIndex, aView, aLabel, aMinWidth) [[self labelForItem:item] setHidden:YES]; } } - + // Determine all the items that have flexible width. // Also determine the height of the toolbar. // NOTE: height is height without top margin, and bottom margin/label. @@ -717,8 +741,8 @@ var _CPToolbarItemInfoMake = function(anIndex, aView, aLabel, aMinWidth) count = subviews.length; while (count--) - [subviews removeObjectAtIndex:count]; - + [subviews[count] removeFromSuperview]; + // Populate with new subviews. var items = [_toolbar items], index = 0; @@ -748,7 +772,7 @@ var _CPToolbarItemInfoMake = function(anIndex, aView, aLabel, aMinWidth) [view setImagePosition:CPImageOnly]; } - + [self addSubview:view]; // Create a lable for this item. @@ -756,6 +780,7 @@ var _CPToolbarItemInfoMake = function(anIndex, aView, aLabel, aMinWidth) [label setStringValue:[item label]]; [label setFont:[CPFont systemFontOfSize:11.0]]; + [label setTextColor:_labelColor]; [label sizeToFit]; [label setTarget:[item target]]; diff --git a/AppKit/CPToolbarItem.j b/AppKit/CPToolbarItem.j index c56791a9f..1e5bcda53 100644 --- a/AppKit/CPToolbarItem.j +++ b/AppKit/CPToolbarItem.j @@ -56,8 +56,6 @@ CPToolbarShowFontsItemIdentifier = @"CPToolbarShowFontsItemIdentifier"; CPToolbarCustomizeToolbarItemIdentifier = @"CPToolbarCustomizeToolbarItemIdentifier"; CPToolbarPrintItemIdentifier = @"CPToolbarPrintItemIdentifier"; -var _CPToolbarSeparatorItemView = nil; - /*! @class CPToolbarItem A representation of an item in a CPToolbar. @@ -479,8 +477,33 @@ CPToolbarItemVisibilityPriorityUser // Standard toolbar identifiers +var _CPToolbarSeparatorItemView = nil, + _CPToolbarSpaceItemView = nil; + @implementation CPToolbarItem (Standard) ++ (CPView)_separatorItemView +{ + if (!_CPToolbarSeparatorItemView) + { + _CPToolbarSeparatorItemView = [[CPView alloc] initWithFrame:CGRectMake(0.0, 0.0, 2.0, 32.0)]; + + sizes = {}; + sizes[@"CPToolbarItemSeparator"] = [CGSizeMake(2.0, 26.0), CGSizeMake(2.0, 1.0), CGSizeMake(2.0, 26.0)]; + [_CPToolbarSeparatorItemView setBackgroundColor:_CPControlThreePartImagePattern(YES, sizes, @"CPToolbarItem", @"Separator")]; + } + + return _CPToolbarSeparatorItemView; +} + ++ (CPView)_spaceItemView +{ + if (!_CPToolbarSpaceItemView) + _CPToolbarSpaceItemView = [[CPView alloc] initWithFrame:CGRectMakeZero()]; + + return _CPToolbarSpaceItemView; +} + /* @ignore */ + (CPToolbarItem)_standardItemWithItemIdentifier:(CPString)anItemIdentifier { @@ -488,29 +511,23 @@ CPToolbarItemVisibilityPriorityUser switch (anItemIdentifier) { - case CPToolbarSeparatorItemIdentifier: [item setMinSize:CGSizeMake(2.0, 0.0)]; + case CPToolbarSeparatorItemIdentifier: [item setView:[self _separatorItemView]]; + + [item setMinSize:CGSizeMake(2.0, 0.0)]; [item setMaxSize:CGSizeMake(2.0, 100000.0)]; - if (!_CPToolbarSeparatorItemView) - { - _CPToolbarSeparatorItemView = [[CPView alloc] initWithFrame:CGRectMake(0.0, 0.0, 2.0, 32.0)]; - - sizes = {}; - sizes[@"CPToolbarItemSeparator"] = [CGSizeMake(2.0, 26.0), CGSizeMake(2.0, 1.0), CGSizeMake(2.0, 26.0)]; - [_CPToolbarSeparatorItemView setBackgroundColor:_CPControlThreePartImagePattern(YES, sizes, @"CPToolbarItem", @"Separator")]; - } - - [item setView:_CPToolbarSeparatorItemView]; - - return item; - case CPToolbarSpaceItemIdentifier: [item setMinSize:CGSizeMake(32.0, 32.0)]; + case CPToolbarSpaceItemIdentifier: [item setView:[self _spaceItemView]]; + + [item setMinSize:CGSizeMake(32.0, 32.0)]; [item setMaxSize:CGSizeMake(32.0, 32.0)]; return item; - case CPToolbarFlexibleSpaceItemIdentifier: [item setMinSize:CGSizeMake(32.0, 32.0)]; + case CPToolbarFlexibleSpaceItemIdentifier: [item setView:[self _spaceItemView]]; + + [item setMinSize:CGSizeMake(32.0, 32.0)]; [item setMaxSize:CGSizeMake(10000.0, 32.0)]; return item; diff --git a/AppKit/CPWindow.j b/AppKit/CPWindow/CPWindow.j similarity index 95% rename from AppKit/CPWindow.j rename to AppKit/CPWindow/CPWindow.j index aec1dc6da..ac5ff5013 100644 --- a/AppKit/CPWindow.j +++ b/AppKit/CPWindow/CPWindow.j @@ -27,10 +27,10 @@ @import "CPAnimation.j" @import "CPResponder.j" -#include "Platform/Platform.h" -#include "Platform/DOM/CPDOMDisplayServer.h" +#include "../Platform/Platform.h" +#include "../Platform/DOM/CPDOMDisplayServer.h" -#include "CoreGraphics/CGGeometry.h" +#include "../CoreGraphics/CGGeometry.h" /* @@ -88,6 +88,7 @@ CPWindowMinYMargin = 8; CPWindowHeightSizable = 16; CPWindowMaxYMargin = 32; +CPBackgroundWindowLevel = -1; /* Default level for windows @group CPWindowLevel @@ -345,11 +346,7 @@ CPTexturedBackgroundWindowMask CPApp._windows[_windowNumber] = self; _styleMask = aStyleMask; - - _frame = [self frameRectForContentRect:aContentRect]; - - _level = CPNormalWindowLevel; - _hasShadow = NO; + _level = aStyleMask === CPBorderlessBridgeWindowMask ? CPBackgroundWindowLevel : CPNormalWindowLevel; _minSize = CGSizeMake(0.0, 0.0); _maxSize = CGSizeMake(1000000.0, 1000000.0); @@ -358,16 +355,19 @@ CPTexturedBackgroundWindowMask _autoresizingMask = CPWindowWidthSizable | CPWindowHeightSizable; // Create our border view which is the actual root of our view hierarchy. - _windowView = [[_CPWindowView alloc] initWithFrame:CGRectMake(0.0, 0.0, CGRectGetWidth(_frame), CGRectGetHeight(_frame)) forStyleMask:_styleMask]; + var windowViewClass = [[self class] _windowViewClassForStyleMask:aStyleMask]; + _frame = [windowViewClass frameRectForContentRect:aContentRect]; + _windowView = [[windowViewClass alloc] initWithFrame:CGRectMake(0.0, 0.0, CGRectGetWidth(_frame), CGRectGetHeight(_frame)) styleMask:aStyleMask owningWindow:self]; + [_windowView _setWindow:self]; [_windowView setNextResponder:self]; - + [self setMovableByWindowBackground:aStyleMask & CPHUDBackgroundWindowMask]; // Create a generic content view. [self setContentView:[[CPView alloc] initWithFrame:CGRectMakeZero()]]; - + _firstResponder = self; #if PLATFORM(DOM) @@ -384,13 +384,32 @@ CPTexturedBackgroundWindowMask #endif [self setBridge:aBridge]; - + [self setNextResponder:CPApp]; + + [self setHasShadow:aStyleMask !== CPBorderlessWindowMask && !(aStyleMask & CPBorderlessBridgeWindowMask)]; } return self; } +/*! + @ignore +*/ ++ (Class)_windowViewClassForStyleMask:(unsigned)aStyleMask +{ + if (aStyleMask & CPHUDBackgroundWindowMask) + return _CPHUDWindowView; + + else if (aStyleMask & CPBorderlessBridgeWindowMask) + return _CPBorderlessBridgeWindowView; + + else if (aStyleMask === CPBorderlessWindowMask) + return _CPBorderlessWindowView; + + return _CPStandardWindowView; +} + /*! Returns the window's style mask. */ @@ -407,9 +426,7 @@ CPTexturedBackgroundWindowMask */ + (CGRect)frameRectForContentRect:(CGRect)aContentRect styleMask:(unsigned)aStyleMask { - var frame = CGRectMakeCopy(aContentRect); - - return frame; + return [[[self class] _windowViewClassForStyleMask:_styleMask] frameRectForContentRect:aContentRect]; } /*! @@ -418,6 +435,7 @@ CPTexturedBackgroundWindowMask */ - (CGRect)contentRectForFrameRect:(CGRect)aFrame { + return [_windowView contentRectForFrameRect:aFrame];/* // FIXME: EXTRA RECT COPY var contentRect = CGRectMakeCopy([_windowView bounds]); @@ -442,7 +460,7 @@ CPTexturedBackgroundWindowMask contentRect.size.height -= toolbarHeight; } - return contentRect; + return contentRect;*/ } /*! @@ -452,12 +470,7 @@ CPTexturedBackgroundWindowMask */ - (CGRect)frameRectForContentRect:(CGRect)aContentRect { - if (_styleMask & CPBorderlessBridgeWindowMask) - return _bridge ? [_bridge visibleFrame] : CGRectMakeZero(); - - var frame = [[self class] frameRectForContentRect:aContentRect styleMask:_styleMask]; - - return frame; + return [_windowView frameRectForContentRect:aContentRect]; } /*! @@ -701,11 +714,13 @@ CPTexturedBackgroundWindowMask if (_contentView) [_contentView removeFromSuperview]; + var bounds = CGRectMake(0.0, 0.0, CGRectGetWidth(_frame), CGRectGetHeight(_frame)); + _contentView = aView; - [_contentView setFrame:[self contentRectForFrameRect:_frame]]; + [_contentView setFrame:[self contentRectForFrameRect:bounds]]; [_contentView setAutoresizingMask:CPViewWidthSizable | CPViewHeightSizable]; - [_windowView addSubview:_contentView positioned:CPWindowBelow relativeTo:nil]; + [_windowView addSubview:_contentView];// positioned:CPWindowBelow relativeTo:nil]; } /*! @@ -826,7 +841,7 @@ CPTexturedBackgroundWindowMask */ - (void)setHasShadow:(BOOL)shouldHaveShadow { - if (_hasShadow == shouldHaveShadow) + if (_hasShadow === shouldHaveShadow) return; _hasShadow = shouldHaveShadow; @@ -840,7 +855,7 @@ CPTexturedBackgroundWindowMask if (!_CPWindowShadowColor) { - var bundle = [CPBundle bundleForClass:[self class]]; + var bundle = [CPBundle bundleForClass:[CPWindow class]]; _CPWindowShadowColor = [CPColor colorWithPatternImage:[[CPNinePartImage alloc] initWithImageSlices: [ @@ -865,7 +880,7 @@ CPTexturedBackgroundWindowMask CPDOMDisplayServerInsertBefore(_DOMElement, _shadowView._DOMElement, _windowView._DOMElement); #endif } - else + else if (_shadowView) { #if PLATFORM(DOM) CPDOMDisplayServerRemoveChild(_DOMElement, _shadowView._DOMElement); @@ -1434,49 +1449,34 @@ CPTexturedBackgroundWindowMask */ - (void)setToolbar:(CPToolbar)aToolbar { - if (_toolbar == aToolbar) + if (_toolbar === aToolbar) return; - // Cleanup old toolbar - if (_toolbar) - { - [self _setToolbarVisible:NO]; + // If this has an owner, dump it! + [[aToolbar _window] setToolbar:nil]; - _toolbar._window = nil; - _toolbarView = nil; - } + // This is no longer out toolbar. + [_toolbar _setWindow:nil]; - if (_toolbar = aToolbar) - { - // Set up new toolbar - _toolbar = aToolbar; - _toolbar._window = self; - - if ([_toolbar isVisible]) - [self _setToolbarVisible:YES]; - - [_toolbar _reloadToolbarItems]; - } + _toolbar = aToolbar; + + // THIS is our toolbar. + [_toolbar _setWindow:self]; + + [self _noteToolbarChanged]; } -/* @ignore */ -- (void)_setToolbarVisible:(BOOL)aFlag +- (void)toggleToolbarShown:(id)aSender { - if (aFlag) - { - if (!_toolbarView) - _toolbarView = [_toolbar _toolbarView]; - - [_toolbarView setFrame:CGRectMake(0.0, 0.0, CGRectGetWidth([_windowView bounds]), CGRectGetHeight([_toolbarView frame]))]; - [_windowView addSubview:_toolbarView]; - } - else - [_toolbarView removeFromSuperview]; + var toolbar = [self toolbar]; - [_contentView setFrame:[self contentRectForFrameRect:[_windowView bounds]]]; + [toolbar setVisible:![toolbar isVisible]]; } -// Managing Sheets +- (void)_noteToolbarChanged +{ + [_windowView noteToolbarChanged]; +} /* @ignore */ - (void)_setAttachedSheetFrameOrigin @@ -1757,7 +1757,11 @@ var interpolate = function(fromValue, toValue, progress) @end +@import "_CPWindowView.j" +@import "_CPStandardWindowView.j" +@import "_CPHUDWindowView.j" +@import "_CPBorderlessWindowView.j" +@import "_CPBorderlessBridgeWindowView.j" @import "CPDragServer.j" @import "CPDOMWindowBridge.j" -@import "_CPWindowView.j" @import "CPView.j" diff --git a/AppKit/CPWindow/_CPBorderlessBridgeWindowView.j b/AppKit/CPWindow/_CPBorderlessBridgeWindowView.j new file mode 100644 index 000000000..f6549fa4f --- /dev/null +++ b/AppKit/CPWindow/_CPBorderlessBridgeWindowView.j @@ -0,0 +1,77 @@ +/* + * _CPBorderlessWindowView.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 "_CPWindowView.j" + + +var _CPToolbarViewBackgroundColor = nil; + +@implementation _CPBorderlessBridgeWindowView : _CPWindowView +{ + CPView _toolbarBackgroundView; +} + ++ (CPColor)toolbarBackgroundColor +{ + if (!_CPToolbarViewBackgroundColor) + _CPToolbarViewBackgroundColor = [CPColor colorWithPatternImage:[[CPImage alloc] initWithContentsOfFile:[[CPBundle bundleForClass:[_CPBorderlessBridgeWindowView class]] pathForResource:@"_CPToolbarView/_CPToolbarViewBackground.png"] size:CGSizeMake(1.0, 59.0)]]; + + return _CPToolbarViewBackgroundColor; +} + +- (void)tile +{ + [super tile]; + + var owningWindow = [self owningWindow], + bounds = [self bounds]; + + [[owningWindow contentView] setFrame:CGRectMake(0.0, [self toolbarMaxY], CGRectGetWidth(bounds), CGRectGetHeight(bounds) - [self toolbarMaxY])]; + + if (![[owningWindow toolbar] isVisible]) + { + [_toolbarBackgroundView removeFromSuperview]; + + _toolbarBackgroundView = nil; + + return; + } + + if (!_toolbarBackgroundView) + { + _toolbarBackgroundView = [[CPView alloc] initWithFrame:CGRectMakeZero()]; + + [_toolbarBackgroundView setBackgroundColor:[[self class] toolbarBackgroundColor]]; + [_toolbarBackgroundView setAutoresizingMask:CPViewWidthSizable]; + + [self addSubview:_toolbarBackgroundView positioned:CPWindowBelow relativeTo:nil]; + } + + var frame = CGRectMakeZero(); + + frame.origin = CGPointMakeCopy([self toolbarOffset]); + frame.size = [_toolbarView frame].size; + + [_toolbarBackgroundView setFrame:frame]; +} + +@end diff --git a/AppKit/CPWindow/_CPBorderlessWindowView.j b/AppKit/CPWindow/_CPBorderlessWindowView.j new file mode 100644 index 000000000..386eae2b1 --- /dev/null +++ b/AppKit/CPWindow/_CPBorderlessWindowView.j @@ -0,0 +1,29 @@ +/* + * _CPBorderlessWindowView.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 "_CPWindowView.j" + + +@implementation _CPBorderlessWindowView : _CPWindowView +{ +} +@end \ No newline at end of file diff --git a/AppKit/CPWindow/_CPHUDWindowView.j b/AppKit/CPWindow/_CPHUDWindowView.j new file mode 100644 index 000000000..3434663bc --- /dev/null +++ b/AppKit/CPWindow/_CPHUDWindowView.j @@ -0,0 +1,199 @@ +/* + * _CPHUDWindowView.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 + */ + +var _CPHUDWindowViewBackgroundColor = nil, + + CPHUDCloseButtonImage = nil; + +var HUD_TITLEBAR_HEIGHT = 26.0; + +@implementation _CPHUDWindowView : _CPWindowView +{ + CPView _toolbarView; + + CPTextField _titleField; + CPButton _closeButton; +} + ++ (void)initialize +{ + if (self != [_CPHUDWindowView class]) + return; + + var bundle = [CPBundle bundleForClass:self]; + + _CPHUDWindowViewBackgroundColor = [CPColor colorWithPatternImage:[[CPNinePartImage alloc] initWithImageSlices: + [ + [[CPImage alloc] initWithContentsOfFile:[bundle pathForResource:@"CPWindow/HUD/CPWindowHUDBackground0.png"] size:CPSizeMake(6.0, 78.0)], + [[CPImage alloc] initWithContentsOfFile:[bundle pathForResource:@"CPWindow/HUD/CPWindowHUDBackground1.png"] size:CPSizeMake(1.0, 78.0)], + [[CPImage alloc] initWithContentsOfFile:[bundle pathForResource:@"CPWindow/HUD/CPWindowHUDBackground2.png"] size:CPSizeMake(6.0, 78.0)], + + [[CPImage alloc] initWithContentsOfFile:[bundle pathForResource:@"CPWindow/HUD/CPWindowHUDBackground3.png"] size:CPSizeMake(6.0, 1.0)], + [[CPImage alloc] initWithContentsOfFile:[bundle pathForResource:@"CPWindow/HUD/CPWindowHUDBackground4.png"] size:CPSizeMake(1.0, 1.0)], + [[CPImage alloc] initWithContentsOfFile:[bundle pathForResource:@"CPWindow/HUD/CPWindowHUDBackground5.png"] size:CPSizeMake(6.0, 1.0)], + + [[CPImage alloc] initWithContentsOfFile:[bundle pathForResource:@"CPWindow/HUD/CPWindowHUDBackground6.png"] size:CPSizeMake(6.0, 6.0)], + [[CPImage alloc] initWithContentsOfFile:[bundle pathForResource:@"CPWindow/HUD/CPWindowHUDBackground7.png"] size:CPSizeMake(6.0, 6.0)], + [[CPImage alloc] initWithContentsOfFile:[bundle pathForResource:@"CPWindow/HUD/CPWindowHUDBackground8.png"] size:CPSizeMake(6.0, 6.0)] + ]]]; + + _CPHUDWindowViewCloseImage = [[CPImage alloc] initWithContentsOfFile:[bundle pathForResource:@"HUDTheme/WindowClose.png"] size:CPSizeMake(20.0, 20.0)]; + _CPHUDWindowViewCloseActiveImage = [[CPImage alloc] initWithContentsOfFile:[bundle pathForResource:@"HUDTheme/WindowCloseActive.png"] size:CPSizeMake(20.0, 20.0)]; +} + ++ (CGRect)contentRectForFrameRect:(CGRect)aFrameRect +{ + var contentRect = CGRectMakeCopy(aFrameRect), + titleBarHeight = HUD_TITLEBAR_HEIGHT; + + contentRect.origin.y += titleBarHeight; + contentRect.size.height -= titleBarHeight; + + return contentRect; +} + ++ (CGRect)frameRectForContentRect:(CGRect)aContentRect +{ + var frameRect = CGRectMakeCopy(aContentRect), + titleBarHeight = HUD_TITLEBAR_HEIGHT; + + frameRect.origin.y -= titleBarHeight; + frameRect.size.height += titleBarHeight; + + return frameRect; +} + +- (CGRect)contentRectForFrameRect:(CGRect)aFrameRect +{ + var contentRect = [[self class] contentRectForFrameRect:aFrameRect]; + + if ([[[self owningWindow] toolbar] isVisible]) + { + toolbarHeight = CGRectGetHeight([[self toolbarView] frame]); + + contentRect.origin.y += toolbarHeight; + contentRect.size.height -= toolbarHeight; + } + + return contentRect; +} + +- (CGRect)frameRectForContentRect:(CGRect)aContentRect +{ + var frameRect = [[self class] frameRectForContentRect:aContentRect]; + + if ([[[self owningWindow] toolbar] isVisible]) + { + toolbarHeight = CGRectGetHeight([[self toolbarView] frame]); + + frameRect.origin.y -= toolbarHeight; + frameRect.size.height += toolbarHeight; + } + + return frameRect; +} + +- (id)initWithFrame:(CPRect)aFrame styleMask:(unsigned)aStyleMask owningWindow:(CPWindow)aWindow +{ + self = [super initWithFrame:aFrame styleMask:aStyleMask owningWindow:aWindow]; + + if (self) + { + var bounds = [self bounds]; + + [self setBackgroundColor:_CPHUDWindowViewBackgroundColor]; + + _titleField = [[CPTextField alloc] initWithFrame:CGRectMakeZero()]; + + [_titleField setHitTests:NO]; + [_titleField setFont:[CPFont systemFontOfSize:11.0]]; + [_titleField setTextColor:[CPColor whiteColor]]; + [_titleField setTextShadow:[CPShadow shadowWithOffset:CPSizeMake(0.0, 1.0) blurRadius:2.0 color:[CPColor blackColor]]]; + [_titleField setAutoresizingMask:CPViewWidthSizable]; + + // FIXME: Make this to CPLineBreakByTruncatingMiddle once it's implemented. + [_titleField setLineBreakMode:CPLineBreakByTruncatingTail]; + [_titleField setAlignment:CPCenterTextAlignment]; + + [_titleField setStringValue:@"Untitled"]; + [_titleField sizeToFit]; + [_titleField setAutoresizingMask:CPViewWidthSizable]; + [_titleField setStringValue:@""]; + + [_titleField setFrame:CGRectMake(20.0, 3.0, CGRectGetWidth([self bounds]) - 40.0, CGRectGetHeight([_titleField frame]))]; + + [self addSubview:_titleField]; + + if (_styleMask & CPClosableWindowMask) + { + var closeSize = [_CPHUDWindowViewCloseImage size]; + + _closeButton = [[CPButton alloc] initWithFrame:CGRectMake(4.0, 4.0, closeSize.width, closeSize.height)]; + + [_closeButton setBordered:NO]; + + [_closeButton setImage:_CPHUDWindowViewCloseImage]; + [_closeButton setAlternateImage:_CPHUDWindowViewCloseActiveImage]; + + [_closeButton setTarget:aWindow]; + [_closeButton setAction:@selector(performClose:)]; + + [self addSubview:_closeButton]; + } + + [self setResizeIndicatorOffset:CGSizeMake(5.0, 5.0)]; + } + + return self; +} + +- (void)setTitle:(CPString)aTitle +{ + [_titleField setStringValue:aTitle]; +} + +- (_CPToolbarView)toolbarView +{ + return _toolbarView; +} + +- (CPColor)toolbarLabelColor +{ + return [CPColor whiteColor]; +} + +- (CGSize)toolbarOffset +{ + return CGSizeMake(0.0, HUD_TITLEBAR_HEIGHT); +} + +- (void)tile +{ + [super tile]; + + var owningWindow = [self owningWindow]; + + [[owningWindow contentView] setFrameOrigin:CGPointMake(0.0, [self toolbarMaxY])];//HUD_TITLEBAR_HEIGHT + toolbarHeight)]; +} + +@end + diff --git a/AppKit/CPWindow/_CPStandardWindowView.j b/AppKit/CPWindow/_CPStandardWindowView.j new file mode 100644 index 000000000..a2416233d --- /dev/null +++ b/AppKit/CPWindow/_CPStandardWindowView.j @@ -0,0 +1,285 @@ +/* + * _CPStandardWindowView.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 "_CPWindowView.j" + +var GRADIENT_HEIGHT = 41.0; + +var _CPTexturedWindowHeadGradientColor = nil, + _CPTexturedWindowHeadSolidColor = nil; + +@implementation _CPTexturedWindowHeadView : CPView +{ + CPView _gradientView; + CPView _solidView; + CPView _dividerView; +} + ++ (CPColor)gradientColor +{ + if (!_CPTexturedWindowHeadGradientColor) + { + var bundle = [CPBundle bundleForClass:[_CPWindowView class]]; + + _CPTexturedWindowHeadGradientColor = [CPColor colorWithPatternImage:[[CPThreePartImage alloc] initWithImageSlices: + [ + [[CPImage alloc] initWithContentsOfFile:[bundle pathForResource:@"CPWindow/Standard/CPWindowStandardTop0.png"] size:CGSizeMake(6.0, 41.0)], + [[CPImage alloc] initWithContentsOfFile:[bundle pathForResource:@"CPWindow/Standard/CPWindowStandardTop1.png"] size:CGSizeMake(1.0, 41.0)], + [[CPImage alloc] initWithContentsOfFile:[bundle pathForResource:@"CPWindow/Standard/CPWindowStandardTop2.png"] size:CGSizeMake(6.0, 41.0)] + ] + isVertical:NO + ]]; + } + + return _CPTexturedWindowHeadGradientColor; +} + ++ (CPColor)solidColor +{ + if (!_CPTexturedWindowHeadSolidColor) + _CPTexturedWindowHeadSolidColor = [CPColor colorWithCalibratedRed:182.0 / 255.0 green:182.0 / 255.0 blue:182.0 / 255.0 alpha:1.0]; + + return _CPTexturedWindowHeadSolidColor; +} + +- (id)initWithFrame:(CGRect)aFrame +{ + self = [super initWithFrame:aFrame]; + + if (self) + { + var theClass = [self class], + bounds = [self bounds]; + + _gradientView = [[CPView alloc] initWithFrame:CGRectMake(0.0, 0.0, CGRectGetWidth(bounds), GRADIENT_HEIGHT)]; + [_gradientView setBackgroundColor:[theClass gradientColor]]; + + [self addSubview:_gradientView]; + + _solidView = [[CPView alloc] initWithFrame:CGRectMake(0.0, GRADIENT_HEIGHT, CGRectGetWidth(bounds), CGRectGetHeight(bounds) - GRADIENT_HEIGHT)]; + [_solidView setBackgroundColor:[theClass solidColor]]; + + [self addSubview:_solidView]; + } + + return self; +} + +- (void)resizeSubviewsWithOldSize:(CGSize)aSize +{ + var bounds = [self bounds]; + + [_gradientView setFrameSize:CGSizeMake(CGRectGetWidth(bounds), GRADIENT_HEIGHT)]; + [_solidView setFrameSize:CGSizeMake(CGRectGetWidth(bounds), CGRectGetHeight(bounds) - GRADIENT_HEIGHT)]; +} + +@end + +var _CPStandardWindowViewBodyBackgroundColor = nil, + _CPStandardWindowViewDividerBackgroundColor = nil, + _CPStandardWindowViewTitleBackgroundColor = nil; + +var STANDARD_GRADIENT_HEIGHT = 41.0; + STANDARD_TITLEBAR_HEIGHT = 22.0; + +@implementation _CPStandardWindowView : _CPWindowView +{ + _CPTexturedWindowHeadView _headView; + CPView _dividerView; + CPView _bodyView; + CPView _toolbarView; + + CPTextField _titleField; + CPButton _closeButton; +} + ++ (CPColor)bodyBackgroundColor +{ + if (!_CPStandardWindowViewBodyBackgroundColor) + _CPStandardWindowViewBodyBackgroundColor = [CPColor whiteColor];// + + return _CPStandardWindowViewBodyBackgroundColor; +} + ++ (CPColor)dividerBackgroundColor +{ + if (!_CPStandardWindowViewDividerBackgroundColor) + _CPStandardWindowViewDividerBackgroundColor = [CPColor colorWithCalibratedRed:125.0 / 255.0 green:125.0 / 255.0 blue:125.0 / 255.0 alpha:1.0]; + + return _CPStandardWindowViewDividerBackgroundColor; +} + ++ (CPColor)titleColor +{ + if (!_CPStandardWindowViewTitleBackgroundColor) + _CPStandardWindowViewTitleBackgroundColor = [CPColor colorWithCalibratedRed:44.0 / 255.0 green:44.0 / 255.0 blue:44.0 / 255.0 alpha:1.0]; + + return _CPStandardWindowViewTitleBackgroundColor; +} + ++ (CGRect)contentRectForFrameRect:(CGRect)aFrameRect +{ + var contentRect = CGRectMakeCopy(aFrameRect), + titleBarHeight = STANDARD_TITLEBAR_HEIGHT + 1.0; + + contentRect.origin.y += titleBarHeight; + contentRect.size.height -= titleBarHeight; + + return contentRect; +} + ++ (CGRect)frameRectForContentRect:(CGRect)aContentRect +{ + var frameRect = CGRectMakeCopy(aContentRect), + titleBarHeight = STANDARD_TITLEBAR_HEIGHT + 1.0; + + frameRect.origin.y -= titleBarHeight; + frameRect.size.height += titleBarHeight; + + return frameRect; +} + +- (CGRect)contentRectForFrameRect:(CGRect)aFrameRect +{ + var contentRect = [[self class] contentRectForFrameRect:aFrameRect]; + + if ([[[self owningWindow] toolbar] isVisible]) + { + toolbarHeight = CGRectGetHeight([[self toolbarView] frame]); + + contentRect.origin.y += toolbarHeight; + contentRect.size.height -= toolbarHeight; + } + + return contentRect; +} + +- (CGRect)frameRectForContentRect:(CGRect)aContentRect +{ + var frameRect = [[self class] frameRectForContentRect:aContentRect]; + + if ([[[self owningWindow] toolbar] isVisible]) + { + toolbarHeight = CGRectGetHeight([[self toolbarView] frame]); + + frameRect.origin.y -= toolbarHeight; + frameRect.size.height += toolbarHeight; + } + + return frameRect; +} + +- (id)initWithFrame:(CPRect)aFrame styleMask:(unsigned)aStyleMask owningWindow:(CPWindow)aWindow +{ + self = [super initWithFrame:aFrame styleMask:aStyleMask owningWindow:aWindow]; + + if (self) + { + var theClass = [self class], + bounds = [self bounds]; + + _headView = [[_CPTexturedWindowHeadView alloc] initWithFrame:CGRectMake(0.0, 0.0, CGRectGetWidth(bounds), STANDARD_TITLEBAR_HEIGHT)]; + + [_headView setAutoresizingMask:CPViewWidthSizable];; + [_headView setHitTests:NO]; + + [self addSubview:_headView]; + + _dividerView = [[CPView alloc] initWithFrame:CGRectMake(0.0, CGRectGetMaxY([_headView frame]), CGRectGetWidth(bounds), 1.0)]; + + [_dividerView setAutoresizingMask:CPViewWidthSizable]; + [_dividerView setBackgroundColor:[theClass dividerBackgroundColor]]; + [_dividerView setHitTests:NO]; + + [self addSubview:_dividerView]; + + var y = CGRectGetMaxY([_dividerView frame]); + + _bodyView = [[CPView alloc] initWithFrame:CGRectMake(0.0, y, CGRectGetWidth(bounds), CGRectGetHeight(bounds) - y)]; + + [_bodyView setAutoresizingMask:CPViewWidthSizable | CPViewHeightSizable]; + [_bodyView setBackgroundColor:[theClass bodyBackgroundColor]]; + [_bodyView setHitTests:NO]; + + [self addSubview:_bodyView]; + + [self setResizeIndicatorOffset:CGSizeMake(2.0, 2.0)]; + [self setShowsResizeIndicator:NO]; + [self setShowsResizeIndicator:YES]; + + _titleField = [[CPTextField alloc] initWithFrame:CGRectMakeZero()]; + + [_titleField setFont:[CPFont boldSystemFontOfSize:12.0]]; + [_titleField setAutoresizingMask:CPViewWidthSizable]; + + // FIXME: Make this to CPLineBreakByTruncatingMiddle once it's implemented. + [_titleField setLineBreakMode:CPLineBreakByTruncatingTail]; + [_titleField setAlignment:CPCenterTextAlignment]; + + [_titleField setStringValue:@"Untitled"]; + [_titleField sizeToFit]; + [_titleField setAutoresizingMask:CPViewWidthSizable]; + [_titleField setStringValue:@""]; + + [self addSubview:_titleField]; + + [self tile]; + } + + return self; +} + +- (CGSize)toolbarOffset +{ + return CGSizeMake(0.0, STANDARD_TITLEBAR_HEIGHT); +} + +- (void)tile +{ + [super tile]; + + var owningWindow = [self owningWindow], + width = CGRectGetWidth([self bounds]); + + [_headView setFrameSize:CGSizeMake(width, [self toolbarMaxY])]; + [_dividerView setFrameOrigin:CGPointMake(0.0, CGRectGetMaxY([_headView frame]))]; + [_bodyView setFrameOrigin:CGPointMake(0.0, CGRectGetMaxY([_dividerView frame]))]; + + [_titleField setFrame:CGRectMake(10.0, 0.0, width - 20.0, CGRectGetHeight([_titleField frame]))]; + + [[owningWindow contentView] setFrameOrigin:CGPointMake(0.0, CGRectGetMaxY([_dividerView frame]))]; +} + +- (void)setTitle:(CPString)aTitle +{ + [_titleField setStringValue:aTitle]; +} + +- (void)mouseDown:(CPEvent)anEvent +{ + if (CGRectContainsPoint([_headView frame], [self convertPoint:[anEvent locationInWindow] fromView:nil])) + [[self owningWindow] trackMoveWithEvent:anEvent]; + + return [super mouseDown:anEvent]; +} + +@end diff --git a/AppKit/CPWindow/_CPWindowView.j b/AppKit/CPWindow/_CPWindowView.j new file mode 100644 index 000000000..e4a2f4191 --- /dev/null +++ b/AppKit/CPWindow/_CPWindowView.j @@ -0,0 +1,259 @@ +/* + * _CPWindowView.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 "CPView.j" +@import "CPImageView.j" + + +var _CPWindowViewResizeIndicatorImage = nil; + +@implementation _CPWindowView : CPView +{ + unsigned _styleMask; + + CPImageView _resizeIndicator; + CGSize _resizeIndicatorOffset; + + CPView _toolbarView; + + CPWindow _owningWindow; +} + ++ (void)initialize +{ + if (self != [_CPWindowView class]) + return; + + _CPWindowViewResizeIndicatorImage = [[CPImage alloc] initWithContentsOfFile:[[CPBundle bundleForClass:[CPWindow class]] pathForResource:@"_CPWindowView/_CPWindowViewResizeIndicator.png"] size:CGSizeMake(12.0, 12.0)]; +} + ++ (CGRect)contentRectForFrameRect:(CGRect)aFrameRect +{ + return CGRectMakeCopy(aFrameRect); +} + ++ (CGRect)frameRectForContentRect:(CGRect)aContentRect +{ + return CGRectMakeCopy(aContentRect); +} + +- (CGRect)contentRectForFrameRect:(CGRect)aFrameRect +{ + return [[self class] contentRectForFrameRect:aFrameRect]; +} + +- (CGRect)frameRectForContentRect:(CGRect)aContentRect +{ + return [[self class] frameRectForContentRect:aContentRect]; +} + +- (id)initWithFrame:(CPRect)aFrame styleMask:(unsigned)aStyleMask owningWindow:(CPWindow)aWindow +{ + self = [super initWithFrame:aFrame]; + + if (self) + { + _styleMask = aStyleMask; + _owningWindow = aWindow; + _resizeIndicatorOffset = CGSizeMake(0.0, 0.0); + _toolbarOffset = CGSizeMake(0.0, 0.0); + + [self setShowsResizeIndicator:!(_styleMask & CPBorderlessBridgeWindowMask) && (_styleMask & CPResizableWindowMask)]; + } + + return self; +} + +- (CPWindow)owningWindow +{ + return _owningWindow; +} + +- (void)setTitle:(CPString)aTitle +{ +} + +- (BOOL)acceptsFirstMouse:(CPEvent)anEvent +{ + return YES; +} + +- (void)mouseDown:(CPEvent)anEvent +{ + var theWindow = [self window]; + + if ((_styleMask & CPResizableWindowMask) && _resizeIndicator) + { + // FIXME: This should be better + var frame = [_resizeIndicator frame]; + + if (CGRectContainsPoint(frame, [self convertPoint:[anEvent locationInWindow] fromView:nil])) + return [theWindow trackResizeWithEvent:anEvent]; + } + + if ([theWindow isMovableByWindowBackground]) + [theWindow trackMoveWithEvent:anEvent]; + + else + [super mouseDown:anEvent]; +} + +- (void)setShowsResizeIndicator:(BOOL)shouldShowResizeIndicator +{ + if (shouldShowResizeIndicator) + { + var size = [_CPWindowViewResizeIndicatorImage size], + boundsSize = [self frame].size; + + _resizeIndicator = [[CPImageView alloc] initWithFrame:CGRectMake(boundsSize.width - size.width - _resizeIndicatorOffset.width, boundsSize.height - size.height - _resizeIndicatorOffset.height, size.width, size.height)]; + + [_resizeIndicator setImage:_CPWindowViewResizeIndicatorImage]; + [_resizeIndicator setAutoresizingMask:CPViewMinXMargin | CPViewMinYMargin]; + + [self addSubview:_resizeIndicator positioned:CPWindowAbove relativeTo:nil]; + } + else + { + [_resizeIndicator removeFromSuperview]; + + _resizeIndicator = nil; + } +} + +- (CPImage)showsResizeIndicator +{ + return _resizeIndicator != nil; +} + +- (void)setResizeIndicatorOffset:(CGSize)anOffset +{ + if (CGSizeEqualToSize(_resizeIndicatorOffset, anOffset)) + return; + + _resizeIndicatorOffset = anOffset; + + if (!_resizeIndicator) + return; + + var size = [_resizeIndicator frame].size, + boundsSize = [self frame].size; + + [_resizeIndicator setFrameOrigin:CGPointMake(boundsSize.width - size.width - anOffset.width, boundsSize.height - size.height - anOffset.height)]; +} + +- (CGSize)resizeIndicatorOffset +{ + return _resizeIndicatorOffset; +} + +- (void)windowDidChangeDocumentEdited +{ +} + +- (void)windowDidChangeDocumentSaving +{ +} + +- (BOOL)showsToolbar +{ + return YES; + return NO; +} + +- (CGSize)toolbarOffset +{ + return CGSizeMakeZero(); +} + +- (CPColor)toolbarLabelColor +{ + return [CPColor blackColor]; +} + +- (float)toolbarMaxY +{ + if (!_toolbarView || [_toolbarView isHidden]) + return [self toolbarOffset].height; + + return CGRectGetMaxY([_toolbarView frame]); +} + +- (_CPToolbarView)toolbarView +{ + return _toolbarView; +} + +- (void)tile +{ + var owningWindow = [self owningWindow], + bounds = [self bounds], + width = CGRectGetWidth(bounds); + + if ([[owningWindow toolbar] isVisible]) + { + var toolbarView = [self toolbarView], + toolbarOffset = [self toolbarOffset]; + + [toolbarView setFrameOrigin:CGPointMake(toolbarOffset.width, toolbarOffset.height)]; + } + + if ([self showsResizeIndicator]) + { + var size = [_resizeIndicator frame].size, + boundsSize = [self bounds].size; + + [_resizeIndicator setFrameOrigin:CGPointMake(boundsSize.width - size.width - _resizeIndicatorOffset.width, boundsSize.height - size.height - _resizeIndicatorOffset.height)]; + } +} + +- (void)noteToolbarChanged +{ + var owningWindow = [self owningWindow], + toolbar = [owningWindow toolbar], + toolbarView = [toolbar _toolbarView]; + + if (_toolbarView !== toolbarView) + { + [_toolbarView removeFromSuperview]; + + if (toolbarView) + { + [toolbarView removeFromSuperview]; + [toolbarView setLabelColor:[self toolbarLabelColor]]; + [toolbarView setFrameSize:CGSizeMake(CGRectGetWidth([self bounds]), CGRectGetHeight([toolbarView frame]))]; + + [self addSubview:toolbarView]; + } + + _toolbarView = toolbarView; + } + + [toolbarView setHidden:![self showsToolbar] || ![toolbar isVisible]]; + + [self setAutoresizesSubviews:NO]; + [owningWindow setFrameSize:[self frameRectForContentRect:[[owningWindow contentView] frame]].size]; + [self setAutoresizesSubviews:YES]; + + [self tile]; +} + +@end diff --git a/AppKit/Resources/CPWindow/HUD/CPWindowHUDBackground0.png b/AppKit/Resources/CPWindow/HUD/CPWindowHUDBackground0.png new file mode 100644 index 0000000000000000000000000000000000000000..d6f02e4e43b737a72536bebc5e72c323a4355695 GIT binary patch literal 317 zcmV-D0mA-?P)DSr z1<%~X^wgl##FWaylc_d9MbVxvjv*DdTKXON8VopC%#TctfAVt9pY{!tt}NM>v{&Ge zjx#sI@nx%a&$y|na?y*)!(~IMa6$PL1#7!BW(Uqs$M%LjtxK2DU4J6#!hM@aEyu6- hx4u#~YW8kmWazG)QTMIQ{VLEJ22WQ%mvv4FO#ssVLT>;7 literal 0 HcmV?d00001 diff --git a/AppKit/Resources/CPWindow/HUD/CPWindowHUDBackground2.png b/AppKit/Resources/CPWindow/HUD/CPWindowHUDBackground2.png new file mode 100644 index 0000000000000000000000000000000000000000..d855c09874afa212e049ba73e3152fd75632158b GIT binary patch literal 345 zcmV-f0jBsorAhm5gBQ52jF zyGB%1C88+eM73d{MAI}71Od|PiW8qylZeAQu%`+&_`t2k_&uALr|SD&v%+9=`BFko zX!dwFl{BnFf2#TBqtYoVY56>UJE%!_E%%tVCW0Vu`b>FVdQ&MBb@ E06NAU1^@s6 literal 0 HcmV?d00001 diff --git a/AppKit/Resources/CPWindow/HUD/CPWindowHUDBackground5.png b/AppKit/Resources/CPWindow/HUD/CPWindowHUDBackground5.png new file mode 100644 index 0000000000000000000000000000000000000000..37aed4be32cd5724bcedb00c5bea23d9d4abfa54 GIT binary patch literal 117 zcmeAS@N?(olHy`uVBq!ia0vp^Y(UJ&0V4mNy#E16NtU=qlmzFem6RtIr7}3C_8<9 Mp00i_>zopr0N^Gd@&Et; literal 0 HcmV?d00001 diff --git a/AppKit/Resources/CPWindow/HUD/CPWindowHUDBackground6.png b/AppKit/Resources/CPWindow/HUD/CPWindowHUDBackground6.png new file mode 100644 index 0000000000000000000000000000000000000000..c2e32acb6cd24206efc0601c167f7f9b92f34ecb GIT binary patch literal 204 zcmeAS@N?(olHy`uVBq!ia0vp^Y#_`5A|IT2?*XJFOI#yLg7ec#$`gxH85~pclTsBt za}(23gHjVyDhp4h+5i>hdAc};RNP8RNJ!YRe*OCYJrgH>RGh$j+{fY3$L;y|{}mS& z8X74urYTHIOiMF+^z2#MuRlLO*Qay_-``))KXJ;GC(j=|Nci*rzy0C$@%tqbZcS}0 z(-9UFocQSZ^Ylj#A11n(O=s@#ZoDD5L_pyH!vq`Yi_aIWaRb`S;OXk;vd$@?2>`73 BRJ;HH literal 0 HcmV?d00001 diff --git a/AppKit/Resources/CPWindow/HUD/CPWindowHUDBackground7.png b/AppKit/Resources/CPWindow/HUD/CPWindowHUDBackground7.png new file mode 100644 index 0000000000000000000000000000000000000000..71d3c5ac9464ad70e63bb64f8deaf9b9b2cc51c9 GIT binary patch literal 122 zcmeAS@N?(olHy`uVBq!ia0vp^j6lrB!3HFm1ilyoDajJoh?3y^w370~qErUQl>DSr z1<%~X^wgl##FWaylc_d9MKYc)jv*Ddk`fXUDo(JdNKD{hW@Zi(c&zBqz{nuW%#`p| S{{2;;ItEWyKbLh*2~7Z$RUc~r literal 0 HcmV?d00001 diff --git a/AppKit/Resources/CPWindow/HUD/CPWindowHUDBackground8.png b/AppKit/Resources/CPWindow/HUD/CPWindowHUDBackground8.png new file mode 100644 index 0000000000000000000000000000000000000000..fabaf041c606c93278c267e02036e2a348fe8d6a GIT binary patch literal 206 zcmeAS@N?(olHy`uVBq!ia0vp^Y#_`5A|IT2?*XJFOI#yLg7ec#$`gxH85~pclTsBt za}(23gHjVyDhp4h+5i<5c)B=-RNP8RNl2(T!NBU{7b2m@GX?})6U4h~QJ**rC3`dgG>gVrzzYJ(MgQu&X%Q~loCIC-v BOMw6Y literal 0 HcmV?d00001 diff --git a/AppKit/Resources/HUDTheme/WindowCenterRight.png b/AppKit/Resources/CPWindow/Standard/CPWindowStandardTop0.png similarity index 92% rename from AppKit/Resources/HUDTheme/WindowCenterRight.png rename to AppKit/Resources/CPWindow/Standard/CPWindowStandardTop0.png index 750eb713189be7c80b018a604af92d1a46a4313a..bf64acfece99dd6f42ffb0485aa697776499835a 100644 GIT binary patch delta 188 zcmZn{yCA068Q|y6%O%Cdz`(%k>ERLtq}hO2lLJJGnMJJLs5qaizS`5pF{I+wn~58F znG6M3j$hl!b!tIF{s})jr9vOZFV4o(bapba>sNZNWpDDYbla8k+)sSXX-nn_K~W8& zJD9|oI}Gos+?`plb}MTIQ=Qnp@Bbz|Q8nz>UYeuGlH5LXrsu8aJEC4!bJg7Wr)hZX nhrNB|^Y+%~+{g9fm>JwfI|UE2u8iacI*7s3)z4*}Q$iB}mj^?# delta 114 zcmca0)-I;l8Q|y6%O%Cdz`(%k>ERLtr1^oEk%J9H-uYs+QE@((yOF1hV@SoVnuCVC z3<^998$L~3kXsaBW^K*M&n{Nra67u_2!dJSRy+K~#9!Vtn=L)qke{|Nk>EF)%PN optDFP{{8z$EeRqBR5t?#0B|h2;{QnOmUo+h2&zIg0 P650n<8$K-aq~ z*}pE53w2r>8fV;Cd+GbU8`bvhL8qE}4CS)fG?$7Lo%3c|BNfm3Y|j6W^1o}0J8Djp cJ+@?!RGH${c<^r*&=m}x?5=(;>zopr08v&x(EtDd delta 135 zcmX>mHb+dcGr-TCmrII^fq{Y7)59eQNHYSlItLq&Joi9p(MHAjTruvRE{-7;x2Bxl z$k`Aez;f|*zym-DXL8VC|!)U`9z8pq=m8eCv8}gsWe?ArvD$5rk l?488-rg7ekPh7`}8KOnFjvRl%^8jczgQu&X%Q~loCICI)FKYk* diff --git a/AppKit/Resources/HUDTheme/WindowBottomLeft.png b/AppKit/Resources/HUDTheme/WindowBottomLeft.png deleted file mode 100644 index 521b7c6f81f800ac979e16eb75d9c4d58889b013..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 3093 zcmV+w4C?cVP)KLZ*U+IBfRsybQWXdwQbLP>6pAqfylh#{fb6;Z(vMMVS~$e@S=j*ftg6;Uhf59&ghTmgWD0l;*T zI709Y^p6lP1rIRMx#05C~cW=H_Aw*bJ-5DT&Z2n+x)QHX^p z00esgV8|mQcmRZ%02D^@S3L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y1aw zoqc{T`P^XJqPBbIW6s}d4{z_f5Om?vMgNQEJG?v2T=KYd^0M3I6IZxbny)%vZR&LD zJpPl@Psh8QyPB@KTx+@RdcC!KX7}kEo;S|j^u2lU7XQ}Oo;f|;z4Ll+_r>@1-xl3| zawq-H%e&ckC+@AhPrP6BKT#_XdT7&;F71j}Joy zkC~6lh7E@6o;W@^IpRNZ{ptLtL(gQ-CY~4mqW;US7Zxvm_|@yz&e53Bp_lTPlfP|z zrTyx_>lv@x#=^!PzR7qqF<$gm`|ZJZ+;<)Cqu&ot2z=0000WV@Og>004R=004l4008;_004mL004C`008P>0026e000+nl3&F} z0000nNkl@Y1|}9ZG9pe@T^|ns0RR63 Y0K+;3-q;Uh7ytkO07*qoM6N<$f-!0}iU0rr diff --git a/AppKit/Resources/HUDTheme/WindowTopCenter.png b/AppKit/Resources/HUDTheme/WindowTopCenter.png deleted file mode 100644 index 0b89f1b010e25e098ff9d0c5fff5b7806fb3848f..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 2929 zcmV-%3y$=OP)KLZ*U+IBfRsybQWXdwQbLP>6pAqfylh#{fb6;Z(vMMVS~$e@S=j*ftg6;Uhf59&ghTmgWD0l;*T zI709Y^p6lP1rIRMx#05C~cW=H_Aw*bJ-5DT&Z2n+x)QHX^p z00esgV8|mQcmRZ%02D^@S3L16t`O%c004NIvOKvYIYoh62rY33S640`D9%Y2D-rV&nehQ1i z007~1e$oCcFS8neI|hJl{-P!B1ZZ9hpmq0)X0i`JwE&>$+E?>%_LC6RbVIkUx0b+_+BaR3cnT7Zv!AJxW zizFb)h!jyGOOZ85F;a?DAXP{m@;!0_IfqH8(HlgRxt7s3}k3K`kFu>>-2Q$QMFfPW!La{h336o>X zu_CMttHv6zR;&ZNiS=X8v3CR#fknUxHUxJ0uoBa_M6WNWeqIg~6QE69c9o#eyhGvpiOA@W-aonk<7r1(?fC{oI5N*U!4 zfg=2N-7=cNnjjOr{yriy6mMFgG#l znCF=fnQv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NlW!BHW>|Y3oCo2ja;u2tI}GRO%t5pj(SVoSUA)fMer z7r8AH(OpYUfqg0L3MyBsO0b)?T}xY&3`(e)1ehyHd9M0QM1NnNo)tYsV#&|tbBVWI z<*9cAlX+VLW*ehP1~MtdlBOYdW0dk-rQY0lvCt>aD%WtYO-C1p$*i)FoBa#`DWzg- zy1Obz2+azs4Z2pI*|wx@4EKng8tuD1wws1>*7Ux+YIzt2q?EEb_RcEK?M+-9)*7>u z*wd1Nn?1G9&49HC&}}(aD4yLA>$8U5IyPZTp5JvhG?|8S-(1nQCs-Hk(x_=#mgcDO z_@sbY_^nx0Y)2w$kJwV=tL2&7YfoxPdmMZhGVr8|ONTMn86#I&`nd_)lAnuub9?Pc o0c)*)BkVaE{fDq?G$iZK0JD>O4ku0-h5!Hn07*qoM6N<$f;X~s8UO$Q diff --git a/AppKit/Resources/HUDTheme/WindowTopRight.png b/AppKit/Resources/HUDTheme/WindowTopRight.png deleted file mode 100644 index dbb8e39b9cd72f9f9788faef5cf11a938fd98040..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 3454 zcmV-^4T18BP)KLZ*U+IBfRsybQWXdwQbLP>6pAqfylh#{fb6;Z(vMMVS~$e@S=j*ftg6;Uhf59&ghTmgWD0l;*T zI709Y^p6lP1rIRMx#05C~cW=H_Aw*bJ-5DT&Z2n+x)QHX^p z00esgV8|mQcmRZ%02D^@S3L16t`O%c004NIvOKvYIYoh62rY33S640`D9%Y2D-rV&nehQ1i z007~1e$oCcFS8neI|hJl{-P!B1ZZ9hpmq0)X0i`JwE&>$+E?>%_LC6RbVIkUx0b+_+BaR3cnT7Zv!AJxW zizFb)h!jyGOOZ85F;a?DAXP{m@;!0_IfqH8(HlgRxt7s3}k3K`kFu>>-2Q$QMFfPW!La{h336o>X zu_CMttHv6zR;&ZNiS=X8v3CR#fknUxHUxJ0uoBa_M6WNWeqIg~6QE69c9o#eyhGvpiOA@W-aonk<7r1(?fC{oI5N*U!4 zfg=2N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rbsRRf^y;CuQW9$?IR+G^RJM{xNEGW^*-*s_ekzo`X=rFhDQdB)_o(DC z$&jpJ5lx2kxvuM^v}{(zP*v1o#~^Aj&O=jCs&4BcN3{%!;v7>w+uU=5Oj2@)-EgQ$ zVLLjkmuA&%HS9&I=cqCi=5XurY)TH?YRXdb8eF@SEWF)3Z>VmI^N_cThV`K Date: Mon, 22 Dec 2008 15:10:20 -0800 Subject: [PATCH 02/14] Updated nib2cib to support new window styles. Reviewed by me. --- Tools/nib2cib/NSAppKit.j | 1 + Tools/nib2cib/NSWindowTemplate.j | 30 ++++++++++++++++++------------ 2 files changed, 19 insertions(+), 12 deletions(-) diff --git a/Tools/nib2cib/NSAppKit.j b/Tools/nib2cib/NSAppKit.j index d35bcc452..a71b12979 100644 --- a/Tools/nib2cib/NSAppKit.j +++ b/Tools/nib2cib/NSAppKit.j @@ -52,6 +52,7 @@ function CP_NSMapClassName(aClassName) { case @"NSApplication": return @"CPApplication"; case @"NSObject": return @"CPObject"; + case @"NSPanel": return @"CPPanel"; case @"NSView": return @"CPView"; case @"NSWindow": return @"CPWindow"; diff --git a/Tools/nib2cib/NSWindowTemplate.j b/Tools/nib2cib/NSWindowTemplate.j index 3f96196e0..b2a27ad62 100644 --- a/Tools/nib2cib/NSWindowTemplate.j +++ b/Tools/nib2cib/NSWindowTemplate.j @@ -23,6 +23,15 @@ @import +var NSBorderlessWindowMask = 0x00, + NSTitledWindowMask = 0x01, + NSClosableWindowMask = 0x02, + NSMiniaturizableWindowMask = 0x04, + NSResizableWindowMask = 0x08, + NSUtilityWindowMask = 0x10, + NSTexturedBackgroundWindowMask = 0x100, + NSHUDBackgroundWindowMask = 0x2000; + @implementation _CPCibWindowTemplate (NSCoding) - (id)NS_initWithCoder:(CPCoder)aCoder @@ -52,18 +61,15 @@ // Flip Y coordinate _windowRect.origin.y = _screenRect.size.height - _windowRect.origin.y - _windowRect.size.height; - // Only window style so far is CPHUDBackgroundWindowMask - _windowStyleMask |= CPHUDBackgroundWindowMask; - - // Adjust size for HUD window - FIXME: in CPWindow.j - if (_windowStyleMask & CPHUDBackgroundWindowMask) - { - CPLog.warn("Adjusting window rect."); - _windowRect.origin.x -= 7.0; - _windowRect.origin.y -= 30.0; - _windowRect.size.width += 14.0; - _windowRect.size.height += 40.0; - } + if (_windowStyleMask === NSBorderlessWindowMask) + _windowStyleMask = CPBorderlessWindowMask; + + else + _windowStyleMask = (_windowStyleMask & NSTitledWindowMask ? CPTitledWindowMask : 0) | + (_windowStyleMask & NSMiniaturizableWindowMask ? CPMiniaturizableWindowMask : 0) | + (_windowStyleMask & NSResizableWindowMask ? CPResizableWindowMask : 0) | + (_windowStyleMask & NSTexturedBackgroundWindowMask ? NSTexturedBackgroundWindowMask : 0) | + (_windowStyleMask & NSHUDBackgroundWindowMask ? CPHUDBackgroundWindowMask : 0); /*if (![_windowClass isEqualToString:@"NSPanel"]) _windowRect.origin.y -= [NSMainMenuView menuHeight]; // compensation for the additional menu bar From 08a3b644838f313edbfb919f6fdc864824194451 Mon Sep 17 00:00:00 2001 From: Francisco Ryan Tolmasky I Date: Mon, 22 Dec 2008 16:37:22 -0800 Subject: [PATCH 03/14] Fix for impropert animationCurve being set. [#175 state:resolved]. [#176 state:resolved]. Reviewed by me. --- AppKit/CPAnimation.j | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/AppKit/CPAnimation.j b/AppKit/CPAnimation.j index 43b7154ed..c2e745a6d 100644 --- a/AppKit/CPAnimation.j +++ b/AppKit/CPAnimation.j @@ -117,10 +117,6 @@ ACTUAL_FRAME_RATE = 0; */ - (void)setAnimationCurve:(CPAnimationCurve)anAnimationCurve { - _animationCurve = anAnimationCurve; - - var timingFunctionName = kCAMediaTimingFunctionLinear; - switch (_animationCurve) { case CPAnimationEaseInOut: timingFunctionName = kCAMediaTimingFunctionEaseInEaseOut; @@ -131,12 +127,16 @@ ACTUAL_FRAME_RATE = 0; case CPAnimationEaseOut: timingFunctionName = kCAMediaTimingFunctionEaseOut; break; + + case CPAnimationLinear: timingFunctionName = kCAMediaTimingFunctionLinear; + break; default: [CPException raise:CPInvalidArgumentException reason:"Invalid value provided for animation curve"]; break; } + _animationCurve = anAnimationCurve; _timingFunction = [CAMediaTimingFunction functionWithName:timingFunctionName]; } From ce5cfca43de8ce248f6345ae70bec302151e6e7a Mon Sep 17 00:00:00 2001 From: Francisco Ryan Tolmasky I Date: Tue, 23 Dec 2008 01:12:39 -0800 Subject: [PATCH 04/14] Fix for tag not being set on button in toolbar. Reviewed by me. --- AppKit/CPToolbar.j | 2 ++ 1 file changed, 2 insertions(+) diff --git a/AppKit/CPToolbar.j b/AppKit/CPToolbar.j index 980e8124d..fe6667585 100644 --- a/AppKit/CPToolbar.j +++ b/AppKit/CPToolbar.j @@ -769,6 +769,8 @@ var _CPToolbarItemInfoMake = function(anIndex, aView, aLabel, aMinWidth) [view setTarget:[item target]]; [view setAction:[item action]]; + + [view setTag:[item tag]]; [view setImagePosition:CPImageOnly]; } From 33053853116542ae4db33cf32d5c02b2f72341a9 Mon Sep 17 00:00:00 2001 From: Francisco Ryan Tolmasky I Date: Fri, 26 Dec 2008 20:38:08 -0800 Subject: [PATCH 05/14] Removed unnecesary code. Reviewed by me. --- AppKit/CPWindow/CPWindow.j | 29 +---------------------------- 1 file changed, 1 insertion(+), 28 deletions(-) diff --git a/AppKit/CPWindow/CPWindow.j b/AppKit/CPWindow/CPWindow.j index ac5ff5013..0114c2eb3 100644 --- a/AppKit/CPWindow/CPWindow.j +++ b/AppKit/CPWindow/CPWindow.j @@ -293,8 +293,6 @@ var CPWindowSaveImage = nil, var bundle = [CPBundle bundleForClass:[CPWindow class]]; - CPWindowResizeIndicatorImage = [[CPImage alloc] initWithContentsOfFile:[bundle pathForResource:@"CPWindowResizeIndicator.png"] size:CGSizeMake(12.0, 12.0)]; - CPWindowSavingImage = [[CPImage alloc] initWithContentsOfFile:[bundle pathForResource:@"CPProgressIndicator/CPProgressIndicatorSpinningStyleRegular.gif"] size:CGSizeMake(16.0, 16.0)] } @@ -435,32 +433,7 @@ CPTexturedBackgroundWindowMask */ - (CGRect)contentRectForFrameRect:(CGRect)aFrame { - return [_windowView contentRectForFrameRect:aFrame];/* - // FIXME: EXTRA RECT COPY - var contentRect = CGRectMakeCopy([_windowView bounds]); - - if (_styleMask & CPHUDBackgroundWindowMask) - { - contentRect.origin.x += 7.0; - contentRect.origin.y += 30.0; - contentRect.size.width -= 14.0; - contentRect.size.height -= 40.0; - } - - else if (_styleMask & CPBorderlessBridgeWindowMask) - { - // The full width, like borderless. - } - - if ([_toolbar isVisible]) - { - var toolbarHeight = CGRectGetHeight([_toolbarView frame]); - - contentRect.origin.y += toolbarHeight; - contentRect.size.height -= toolbarHeight; - } - - return contentRect;*/ + return [_windowView contentRectForFrameRect:aFrame]; } /*! From 3afd7a9a6951b8f2069f65dafd9ab03caee32d69 Mon Sep 17 00:00:00 2001 From: Francisco Ryan Tolmasky I Date: Fri, 26 Dec 2008 21:35:10 -0800 Subject: [PATCH 06/14] A bit more CPWindow code reorg. Reviewed by me. --- AppKit/CPWindow/CPWindow.j | 20 -------------------- AppKit/CPWindow/_CPWindowView.j | 30 ++++++++++++++++++++++++++++-- 2 files changed, 28 insertions(+), 22 deletions(-) diff --git a/AppKit/CPWindow/CPWindow.j b/AppKit/CPWindow/CPWindow.j index 0114c2eb3..ad6579c99 100644 --- a/AppKit/CPWindow/CPWindow.j +++ b/AppKit/CPWindow/CPWindow.j @@ -550,26 +550,6 @@ CPTexturedBackgroundWindowMask [CPApp setTarget:self selector:@selector(trackMoveWithEvent:) forNextEventMatchingMask:CPLeftMouseDraggedMask | CPLeftMouseUpMask untilDate:nil inMode:nil dequeue:YES]; } -/* - @ignore -*/ -- (void)trackResizeWithEvent:(CPEvent)anEvent -{ - var location = [anEvent locationInWindow], - type = [anEvent type]; - - if (type == CPLeftMouseUp) - return; - - else if (type == CPLeftMouseDown) - _resizeFrame = CGRectMake(location.x, location.y, CGRectGetWidth(_frame), CGRectGetHeight(_frame)); - - else if (type == CPLeftMouseDragged) - [self setFrameSize:CGSizeMake(CGRectGetWidth(_resizeFrame) + location.x - CGRectGetMinX(_resizeFrame), CGRectGetHeight(_resizeFrame) + location.y - CGRectGetMinY(_resizeFrame))]; - - [CPApp setTarget:self selector:@selector(trackResizeWithEvent:) forNextEventMatchingMask:CPLeftMouseDraggedMask | CPLeftMouseUpMask untilDate:nil inMode:nil dequeue:YES]; -} - /*! Makes the receiver the front most window in the screen ordering. @param aSender the object that requested this diff --git a/AppKit/CPWindow/_CPWindowView.j b/AppKit/CPWindow/_CPWindowView.j index e4a2f4191..451c3e209 100644 --- a/AppKit/CPWindow/_CPWindowView.j +++ b/AppKit/CPWindow/_CPWindowView.j @@ -99,7 +99,7 @@ var _CPWindowViewResizeIndicatorImage = nil; - (void)mouseDown:(CPEvent)anEvent { - var theWindow = [self window]; + var theWindow = [self owningWindow]; if ((_styleMask & CPResizableWindowMask) && _resizeIndicator) { @@ -107,7 +107,7 @@ var _CPWindowViewResizeIndicatorImage = nil; var frame = [_resizeIndicator frame]; if (CGRectContainsPoint(frame, [self convertPoint:[anEvent locationInWindow] fromView:nil])) - return [theWindow trackResizeWithEvent:anEvent]; + return [self trackResizeWithEvent:anEvent]; } if ([theWindow isMovableByWindowBackground]) @@ -117,6 +117,32 @@ var _CPWindowViewResizeIndicatorImage = nil; [super mouseDown:anEvent]; } +/* + @ignore +*/ +- (void)trackResizeWithEvent:(CPEvent)anEvent +{ + var location = [anEvent locationInWindow], + type = [anEvent type]; + + if (type === CPLeftMouseUp) + return; + + var theWindow = [self owningWindow]; + + if (type === CPLeftMouseDown) + { + var frame = [theWindow frame]; + + _resizeFrame = CGRectMake(location.x, location.y, CGRectGetWidth(frame), CGRectGetHeight(frame)); + } + + else if (type === CPLeftMouseDragged) + [theWindow setFrameSize:CGSizeMake(CGRectGetWidth(_resizeFrame) + location.x - CGRectGetMinX(_resizeFrame), CGRectGetHeight(_resizeFrame) + location.y - CGRectGetMinY(_resizeFrame))]; + + [CPApp setTarget:self selector:@selector(trackResizeWithEvent:) forNextEventMatchingMask:CPLeftMouseDraggedMask | CPLeftMouseUpMask untilDate:nil inMode:nil dequeue:YES]; +} + - (void)setShowsResizeIndicator:(BOOL)shouldShowResizeIndicator { if (shouldShowResizeIndicator) From b29dc6052eef20623c23238616dde9d54bd3dca1 Mon Sep 17 00:00:00 2001 From: Francisco Ryan Tolmasky I Date: Fri, 26 Dec 2008 23:54:20 -0800 Subject: [PATCH 07/14] Further reorg. Reviewed by me. --- AppKit/CPSplitView.j | 1 + AppKit/CPWindow/CPWindow.j | 25 ------------------ AppKit/CPWindow/_CPStandardWindowView.j | 4 +-- AppKit/CPWindow/_CPWindowView.j | 34 ++++++++++++++++++++++--- 4 files changed, 33 insertions(+), 31 deletions(-) diff --git a/AppKit/CPSplitView.j b/AppKit/CPSplitView.j index e6c07a987..0358f3f81 100644 --- a/AppKit/CPSplitView.j +++ b/AppKit/CPSplitView.j @@ -369,6 +369,7 @@ var CPSplitViewHorizontalImage = nil, - (void)mouseDown:(CPEvent)anEvent { + // FIXME: This should not trap events if not on a divider! [self trackDivider:anEvent]; } diff --git a/AppKit/CPWindow/CPWindow.j b/AppKit/CPWindow/CPWindow.j index ad6579c99..774be7efc 100644 --- a/AppKit/CPWindow/CPWindow.j +++ b/AppKit/CPWindow/CPWindow.j @@ -525,31 +525,6 @@ CPTexturedBackgroundWindowMask [_delegate windowDidResize:self]; } -/* - @ignore -*/ -- (void)trackMoveWithEvent:(CPEvent)anEvent -{ - var type = [anEvent type]; - - if (type == CPLeftMouseUp) - return; - - else if (type == CPLeftMouseDown) - _mouseDraggedPoint = [self convertBaseToBridge:[anEvent locationInWindow]]; - - else if (type == CPLeftMouseDragged) - { - var location = [self convertBaseToBridge:[anEvent locationInWindow]]; - - [self setFrameOrigin:CGPointMake(_CGRectGetMinX(_frame) + (location.x - _mouseDraggedPoint.x), _CGRectGetMinY(_frame) + (location.y - _mouseDraggedPoint.y))]; - - _mouseDraggedPoint = location; - } - - [CPApp setTarget:self selector:@selector(trackMoveWithEvent:) forNextEventMatchingMask:CPLeftMouseDraggedMask | CPLeftMouseUpMask untilDate:nil inMode:nil dequeue:YES]; -} - /*! Makes the receiver the front most window in the screen ordering. @param aSender the object that requested this diff --git a/AppKit/CPWindow/_CPStandardWindowView.j b/AppKit/CPWindow/_CPStandardWindowView.j index a2416233d..5c1c4995e 100644 --- a/AppKit/CPWindow/_CPStandardWindowView.j +++ b/AppKit/CPWindow/_CPStandardWindowView.j @@ -277,9 +277,9 @@ var STANDARD_GRADIENT_HEIGHT = 41.0; - (void)mouseDown:(CPEvent)anEvent { if (CGRectContainsPoint([_headView frame], [self convertPoint:[anEvent locationInWindow] fromView:nil])) - [[self owningWindow] trackMoveWithEvent:anEvent]; + return [self trackMoveWithEvent:anEvent]; - return [super mouseDown:anEvent]; + [super mouseDown:anEvent]; } @end diff --git a/AppKit/CPWindow/_CPWindowView.j b/AppKit/CPWindow/_CPWindowView.j index 451c3e209..e5ec2da77 100644 --- a/AppKit/CPWindow/_CPWindowView.j +++ b/AppKit/CPWindow/_CPWindowView.j @@ -23,6 +23,8 @@ @import "CPView.j" @import "CPImageView.j" +#include "../CoreGraphics/CGGeometry.h" + var _CPWindowViewResizeIndicatorImage = nil; @@ -36,6 +38,9 @@ var _CPWindowViewResizeIndicatorImage = nil; CPView _toolbarView; CPWindow _owningWindow; + + CGRect _resizeFrame; + CGPoint _mouseDraggedPoint; } + (void)initialize @@ -111,15 +116,12 @@ var _CPWindowViewResizeIndicatorImage = nil; } if ([theWindow isMovableByWindowBackground]) - [theWindow trackMoveWithEvent:anEvent]; + [self trackMoveWithEvent:anEvent]; else [super mouseDown:anEvent]; } -/* - @ignore -*/ - (void)trackResizeWithEvent:(CPEvent)anEvent { var location = [anEvent locationInWindow], @@ -143,6 +145,30 @@ var _CPWindowViewResizeIndicatorImage = nil; [CPApp setTarget:self selector:@selector(trackResizeWithEvent:) forNextEventMatchingMask:CPLeftMouseDraggedMask | CPLeftMouseUpMask untilDate:nil inMode:nil dequeue:YES]; } +- (void)trackMoveWithEvent:(CPEvent)anEvent +{ + var type = [anEvent type]; + + if (type === CPLeftMouseUp) + return; + + else if (type === CPLeftMouseDown) + _mouseDraggedPoint = [[self owningWindow] convertBaseToBridge:[anEvent locationInWindow]]; + + else if (type === CPLeftMouseDragged) + { + var theWindow = [self owningWindow], + location = [theWindow convertBaseToBridge:[anEvent locationInWindow]], + frame = [theWindow frame]; + + [theWindow setFrameOrigin:CGPointMake(_CGRectGetMinX(frame) + (location.x - _mouseDraggedPoint.x), _CGRectGetMinY(frame) + (location.y - _mouseDraggedPoint.y))]; + + _mouseDraggedPoint = location; + } + + [CPApp setTarget:self selector:@selector(trackMoveWithEvent:) forNextEventMatchingMask:CPLeftMouseDraggedMask | CPLeftMouseUpMask untilDate:nil inMode:nil dequeue:YES]; +} + - (void)setShowsResizeIndicator:(BOOL)shouldShowResizeIndicator { if (shouldShowResizeIndicator) From bec47ec8140ec0b041fb801c5543df3884563e89 Mon Sep 17 00:00:00 2001 From: Francisco Ryan Tolmasky I Date: Mon, 29 Dec 2008 17:32:03 -0800 Subject: [PATCH 08/14] Added -objectEnumerator to CPSet. [#185 state:resolved]. Reviewed by me. --- Foundation/CPSet.j | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/Foundation/CPSet.j b/Foundation/CPSet.j index 2ba0b995d..9e739c743 100644 --- a/Foundation/CPSet.j +++ b/Foundation/CPSet.j @@ -6,13 +6,13 @@ * Extended by Ross Boucher * Extended by Nabil Elisa * - * TODO: Needs to implement CPCoding, CPCopying, CPEnumerator. + * TODO: Needs to implement CPCoding, CPCopying. */ @import "CPObject.j" @import "CPArray.j" @import "CPNumber.j" -//import "CPEnumerator.j" +@import "CPEnumerator.j" @implementation CPSet : CPObject @@ -163,6 +163,7 @@ - (CPArray)allObjects { var array = []; + for (var property in _contents) { if (_contents.hasOwnProperty(property)) @@ -289,7 +290,10 @@ return nil; } -//- (CPEnumerator)objectEnumerator; +- (CPEnumerator)objectEnumerator +{ + return [[self allObjects] objectEnumerator]; +} // Mutable Set Methods From ef7000a29d1d45424038acf554e3d4d8214bc8b9 Mon Sep 17 00:00:00 2001 From: Francisco Ryan Tolmasky I Date: Mon, 29 Dec 2008 17:53:51 -0800 Subject: [PATCH 09/14] Fix for menus showing up under modal windows. [#182 state:resolved]. Reviewed by me. --- AppKit/CPMenu.j | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/AppKit/CPMenu.j b/AppKit/CPMenu.j index 1179ef946..1aed32613 100644 --- a/AppKit/CPMenu.j +++ b/AppKit/CPMenu.j @@ -905,7 +905,7 @@ var STICKY_TIME_INTERVAL = 500, if (self) { - [self setLevel:CPTornOffMenuWindowLevel]; + [self setLevel:CPPopUpMenuWindowLevel]; [self setHasShadow:YES]; [self setAcceptsMouseMovedEvents:YES]; From aabe06eb3fba21b09330dc3a3ef32941a13f7604 Mon Sep 17 00:00:00 2001 From: Francisco Ryan Tolmasky I Date: Sat, 3 Jan 2009 01:11:06 -0800 Subject: [PATCH 10/14] Fix for adding draggedViewLocation and draggedImageLocatio to CPDraggingInfo. [#192 state:resolved] Reviewed by me. --- AppKit/CPDragServer.j | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/AppKit/CPDragServer.j b/AppKit/CPDragServer.j index da1b4e5bd..0c1cdf798 100644 --- a/AppKit/CPDragServer.j +++ b/AppKit/CPDragServer.j @@ -157,6 +157,16 @@ var CPDragServerUpdateDragging = function(anEvent) return [CPDragServerView image]; } +- (CGPoint)draggedImageLocation +{ + return [self draggedViewLocation]; +} + +- (CGPoint)draggedViewLocation +{ + return [[CPDragServerDestination window] convertBridgeToBase:[CPDragServerView frame].origin]; +} + - (CPView)draggedView { return CPDragServerView; From 35fc44e183decb128015ace8934a3b0ed07d0403 Mon Sep 17 00:00:00 2001 From: Francisco Ryan Tolmasky I Date: Sat, 3 Jan 2009 12:14:04 -0800 Subject: [PATCH 11/14] Fixed convertPoint/rect to work across different windows. [#193 state:resolved] Reviewed by me. --- AppKit/CPView.j | 30 ++++++++++++++++++++++++++++-- 1 file changed, 28 insertions(+), 2 deletions(-) diff --git a/AppKit/CPView.j b/AppKit/CPView.j index f330dfd15..93f806436 100644 --- a/AppKit/CPView.j +++ b/AppKit/CPView.j @@ -1844,7 +1844,10 @@ var _CPViewFullScreenModeStateMake = function(aView) var _CPViewGetTransform = function(/*CPView*/ fromView, /*CPView */ toView) { - var transform = CGAffineTransformMakeIdentity(); + var transform = CGAffineTransformMakeIdentity(), + sameWindow = YES, + fromWindow = nil, + toWindow = nil; if (fromView) { @@ -1868,8 +1871,24 @@ var _CPViewGetTransform = function(/*CPView*/ fromView, /*CPView */ toView) } // If we hit toView, then we're done. - if (view == toView) + if (view === toView) return transform; + + else if (fromView && toView) + { + fromWindow = [fromView window]; + toWindow = [toView window]; + + if (fromWindow && toWindow && fromWindow !== toWindow) + { + sameWindow = NO; + + var frame = [fromWindow frame]; + + transform.tx += _CGRectGetMinX(frame); + transform.ty += _CGRectGetMinY(frame); + } + } } // FIXME: For now we can do things this way, but eventually we need to do them the "hard" way. @@ -1890,6 +1909,13 @@ var _CPViewGetTransform = function(/*CPView*/ fromView, /*CPView */ toView) view = view._superview; } + if (!sameWindow) + { + var frame = [toWindow frame]; + + transform.tx -= _CGRectGetMinX(frame); + transform.ty -= _CGRectGetMinY(frame); + } /* var views = [], view = toView; From 0af5bb05fca54452c76571a07337ffa54458e4e9 Mon Sep 17 00:00:00 2001 From: Francisco Ryan Tolmasky I Date: Sat, 3 Jan 2009 15:44:29 -0800 Subject: [PATCH 12/14] Replacing a few instances of Math.min/max with MIN/MAX and == with ===. Reviewed by me. --- Foundation/CPRange.j | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/Foundation/CPRange.j b/Foundation/CPRange.j index ebdee50c9..2d6519784 100755 --- a/Foundation/CPRange.j +++ b/Foundation/CPRange.j @@ -62,7 +62,7 @@ function CPMakeRangeCopy(aRange) */ function CPEmptyRange(aRange) { - return aRange.length == 0; + return aRange.length === 0; } /*! @@ -84,7 +84,7 @@ function CPMaxRange(aRange) */ function CPEqualRanges(lhsRange, rhsRange) { - return ((lhsRange.location == rhsRange.location) && (lhsRange.length == rhsRange.length)); + return ((lhsRange.location === rhsRange.location) && (lhsRange.length === rhsRange.length)); } /*! @@ -109,8 +109,8 @@ function CPLocationInRange(aLocation, aRange) */ function CPUnionRange(lhsRange, rhsRange) { - var location = Math.min(lhsRange.location, rhsRange.location); - return CPMakeRange(location, Math.max(CPMaxRange(lhsRange), CPMaxRange(rhsRange)) - location); + var location = MIN(lhsRange.location, rhsRange.location); + return CPMakeRange(location, MAX(CPMaxRange(lhsRange), CPMaxRange(rhsRange)) - location); } /*! @@ -125,8 +125,8 @@ function CPIntersectionRange(lhsRange, rhsRange) if(CPMaxRange(lhsRange) < rhsRange.location || CPMaxRange(rhsRange) < lhsRange.location) return CPMakeRange(0, 0); - var location = Math.max(lhsRange.location, rhsRange.location); - return CPMakeRange(location, Math.min(CPMaxRange(lhsRange), CPMaxRange(rhsRange)) - location); + var location = MAX(lhsRange.location, rhsRange.location); + return CPMakeRange(location, MIN(CPMaxRange(lhsRange), CPMaxRange(rhsRange)) - location); } /*! From ac8ecdb7f3ab9c1549a6d724f5c414250244be43 Mon Sep 17 00:00:00 2001 From: Francisco Ryan Tolmasky I Date: Sat, 3 Jan 2009 16:16:24 -0800 Subject: [PATCH 13/14] A number of CPTableView improvements, still not built by default. Reviewed by me. --- AppKit/CPTableColumn.j | 133 +++++++++++++- AppKit/CPTableView.j | 393 +++++++++++++++++++++++++++++++---------- 2 files changed, 422 insertions(+), 104 deletions(-) diff --git a/AppKit/CPTableColumn.j b/AppKit/CPTableColumn.j index 2407b4c3a..1421eecb1 100644 --- a/AppKit/CPTableColumn.j +++ b/AppKit/CPTableColumn.j @@ -43,6 +43,10 @@ CPTableColumnAutoresizingMask = 1; */ CPTableColumnUserResizingMask = 2; +#define PurgableInfoMake(aView, aRow) { view:(aView), row:(aRow) } +#define PurgableInfoView(anInfo) ((anInfo).view) +#define PurgableInfoRow(anInfo) ((anInfo).row) + /*! @class CPTableColumn An CPTableColumn object mainly keeps information about the width of the column, its minimum and maximum width; whether the column can be edited or resized; and the cells used to draw the column header and the data in the column. You can change all these attributes of the column by calling the appropriate methods. Please note that the table column does not hold nor has access to the data to be displayed in the column; this data is maintained in the table view's data source.