mirror of
https://github.com/cappuccino/cappuccino.git
synced 2026-11-24 15:35:52 +00:00
Refs #1364. Formatting, don't shadow window global.
This commit is contained in:
1 parent
de8e08f4f4
commit
5a8c94183a
6 files changed
+55
-55
No files matched your search
@@ -779,9 +779,9 @@ CPTexturedBackgroundWindowMask
|
||||
{
|
||||
// if the shadow would be taller/wider than the window height,
|
||||
// make it the same as the window height. this allows views to
|
||||
// become 0,0 with no shadow on them and makes the sheet
|
||||
// become 0, 0 with no shadow on them and makes the sheet
|
||||
// animation look nicer
|
||||
var shadowSize = _CGSizeMake(size.width,size.height);
|
||||
var shadowSize = _CGSizeMake(size.width, size.height);
|
||||
|
||||
if (size.width >= (SHADOW_MARGIN_LEFT + SHADOW_MARGIN_RIGHT))
|
||||
shadowSize.width += SHADOW_MARGIN_LEFT + SHADOW_MARGIN_RIGHT;
|
||||
@@ -2381,9 +2381,9 @@ CPTexturedBackgroundWindowMask
|
||||
|
||||
var sheetFrame = [aSheet frame];
|
||||
|
||||
_sheetContext = {"sheet":aSheet, "modalDelegate":aModalDelegate, "endSelector":aDidEndSelector,
|
||||
"contextInfo":aContextInfo, "frame":CGRectMakeCopy(sheetFrame), "returnCode":-1,
|
||||
"opened": NO };
|
||||
_sheetContext = {"sheet": aSheet, "modalDelegate": aModalDelegate, "endSelector": aDidEndSelector,
|
||||
"contextInfo": aContextInfo, "frame": _CGRectMakeCopy(sheetFrame), "returnCode": -1,
|
||||
"opened": NO};
|
||||
|
||||
[self _attachSheetWindow];
|
||||
}
|
||||
@@ -2413,9 +2413,9 @@ CPTexturedBackgroundWindowMask
|
||||
var delegate = _sheetContext["modalDelegate"],
|
||||
endSelector = _sheetContext["endSelector"];
|
||||
|
||||
// if the sheet has been ordered out, defer didEndSelector until after sheet animates out,
|
||||
// this must be done since we cannot block an wait for the animation to complete
|
||||
if (delegate != nil && endSelector != nil)
|
||||
// If the sheet has been ordered out, defer didEndSelector until after sheet animates out.
|
||||
// This must be done since we cannot block and wait for the animation to complete.
|
||||
if (delegate && endSelector)
|
||||
{
|
||||
if (_sheetContext["isAttached"])
|
||||
objj_msgSend(delegate, endSelector, _sheetContext["sheet"], _sheetContext["returnCode"],
|
||||
|
||||
@@ -205,13 +205,13 @@ var HUD_TITLEBAR_HEIGHT = 26.0;
|
||||
bounds = [self bounds],
|
||||
width = CGRectGetWidth(bounds);
|
||||
|
||||
[_titleField setFrame:CGRectMake(20.0, 3.0, width - 40.0, CGRectGetHeight([_titleField frame]))];
|
||||
[_titleField setFrame:_CGRectMake(20.0, 3.0, width - 40.0, _CGRectGetHeight([_titleField frame]))];
|
||||
|
||||
var maxY = [self toolbarMaxY];
|
||||
if ([_titleField isHidden])
|
||||
maxY -= ([self toolbarOffset]).height;
|
||||
|
||||
var contentRect = CGRectMake(0.0, maxY, width, CGRectGetHeight(bounds) - maxY);
|
||||
var contentRect = _CGRectMake(0.0, maxY, width, _CGRectGetHeight(bounds) - maxY);
|
||||
|
||||
[[theWindow contentView] setFrame:contentRect];
|
||||
}
|
||||
@@ -224,23 +224,22 @@ var HUD_TITLEBAR_HEIGHT = 26.0;
|
||||
[_titleField setHidden:enable];
|
||||
|
||||
// resize the window
|
||||
var window = [self window],
|
||||
frame = [window frame];
|
||||
var theWindow = [self window],
|
||||
frame = [theWindow frame],
|
||||
dy = ([self toolbarOffset]).height;
|
||||
|
||||
var dy = ([self toolbarOffset]).height;
|
||||
if (enable)
|
||||
dy = -dy;
|
||||
|
||||
var newHeight = CGRectGetMaxY(frame) + dy,
|
||||
newWidth = CGRectGetMaxX(frame);
|
||||
var newHeight = _CGRectGetMaxY(frame) + dy,
|
||||
newWidth = _CGRectGetMaxX(frame);
|
||||
|
||||
frame.size.height += dy;
|
||||
|
||||
[self setFrameSize:CGSizeMake(newWidth, newHeight)];
|
||||
[self setFrameSize:_CGSizeMake(newWidth, newHeight)];
|
||||
[self tile];
|
||||
[window setFrame:frame display:NO animate:NO];
|
||||
[window setMovableByWindowBackground:!enable];
|
||||
[theWindow setFrame:frame display:NO animate:NO];
|
||||
[theWindow setMovableByWindowBackground:!enable];
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
@@ -326,16 +326,16 @@ var STANDARD_GRADIENT_HEIGHT = 41.0,
|
||||
|
||||
var theWindow = [self window],
|
||||
bounds = [self bounds],
|
||||
width = CGRectGetWidth(bounds);
|
||||
width = _CGRectGetWidth(bounds);
|
||||
|
||||
[_headView setFrameSize:CGSizeMake(width, [self toolbarMaxY])];
|
||||
[_dividerView setFrame:CGRectMake(0.0, CGRectGetMaxY([_headView frame]), width, 1.0)];
|
||||
[_headView setFrameSize:_CGSizeMake(width, [self toolbarMaxY])];
|
||||
[_dividerView setFrame:_CGRectMake(0.0, _CGRectGetMaxY([_headView frame]), width, 1.0)];
|
||||
|
||||
var dividerMaxY = 0;
|
||||
if (![_dividerView isHidden])
|
||||
dividerMaxY = CGRectGetMaxY([_dividerView frame]);
|
||||
dividerMaxY = _CGRectGetMaxY([_dividerView frame]);
|
||||
|
||||
[_bodyView setFrame:CGRectMake(0.0, dividerMaxY, width, CGRectGetHeight(bounds) - dividerMaxY)];
|
||||
[_bodyView setFrame:_CGRectMake(0.0, dividerMaxY, width, _CGRectGetHeight(bounds) - dividerMaxY)];
|
||||
|
||||
var leftOffset = 8;
|
||||
|
||||
@@ -344,12 +344,13 @@ var STANDARD_GRADIENT_HEIGHT = 41.0,
|
||||
if (_minimizeButton)
|
||||
leftOffset += 19.0;
|
||||
|
||||
[_titleField setFrame:CGRectMake(leftOffset, 5.0, width - leftOffset * 2.0, CGRectGetHeight([_titleField frame]))];
|
||||
[_titleField setFrame:_CGRectMake(leftOffset, 5.0, width - leftOffset * 2.0, _CGRectGetHeight([_titleField frame]))];
|
||||
|
||||
var contentRect = CGRectMake(0.0, dividerMaxY, width, CGRectGetHeight([_bodyView frame]));
|
||||
var contentRect = _CGRectMake(0.0, dividerMaxY, width, _CGRectGetHeight([_bodyView frame]));
|
||||
|
||||
[[theWindow contentView] setFrame:contentRect];
|
||||
}
|
||||
|
||||
/*
|
||||
- (void)setAnimatingToolbar:(BOOL)isAnimatingToolbar
|
||||
{
|
||||
@@ -428,21 +429,21 @@ var STANDARD_GRADIENT_HEIGHT = 41.0,
|
||||
[_bodyView setBackgroundColor:[[self class] bodyBackgroundColor]];
|
||||
|
||||
// resize the window
|
||||
var window = [self window],
|
||||
frame = [window frame];
|
||||
var theWindow = [self window],
|
||||
frame = [theWindow frame];
|
||||
|
||||
var dy = CGRectGetHeight([_headView frame]) + CGRectGetHeight([_dividerView frame]);
|
||||
var dy = _CGRectGetHeight([_headView frame]) + _CGRectGetHeight([_dividerView frame]);
|
||||
if (enable)
|
||||
dy = -dy;
|
||||
|
||||
var newHeight = CGRectGetMaxY(frame) + dy,
|
||||
newWidth = CGRectGetMaxX(frame);
|
||||
var newHeight = _CGRectGetMaxY(frame) + dy,
|
||||
newWidth = _CGRectGetMaxX(frame);
|
||||
|
||||
frame.size.height += dy;
|
||||
|
||||
[self setFrameSize:CGSizeMake(newWidth, newHeight)];
|
||||
[self setFrameSize:_CGSizeMake(newWidth, newHeight)];
|
||||
[self tile];
|
||||
[window setFrame:frame display:NO animate:NO];
|
||||
[theWindow setFrame:frame display:NO animate:NO];
|
||||
}
|
||||
|
||||
@end
|
||||
@@ -384,10 +384,10 @@ var _CPWindowViewResizeIndicatorImage = nil;
|
||||
if (enable)
|
||||
{
|
||||
var bundle = [CPBundle bundleForClass:[CPWindow class]];
|
||||
_sheetShadowView = [[CPView alloc] initWithFrame:CGRectMake(0, 0, CGRectGetWidth([self bounds]), 8)];
|
||||
_sheetShadowView = [[CPView alloc] initWithFrame:_CGRectMake(0, 0, _CGRectGetWidth([self bounds]), 8)];
|
||||
[_sheetShadowView setAutoresizingMask:CPViewWidthSizable];
|
||||
[_sheetShadowView setBackgroundColor:[CPColor colorWithPatternImage:[[CPImage alloc]
|
||||
initWithContentsOfFile:[bundle pathForResource:@"CPWindow/CPWindowAttachedSheetShadow.png"] size:CGSizeMake(9,8)]]];
|
||||
initWithContentsOfFile:[bundle pathForResource:@"CPWindow/CPWindowAttachedSheetShadow.png"] size:_CGSizeMake(9, 8)]]];
|
||||
[self addSubview:_sheetShadowView];
|
||||
}
|
||||
else
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
|
||||
- (void)awakeFromCib
|
||||
{
|
||||
_sheetController = [ [SheetWindowController alloc] initWithWindowCibName:@"Window"];
|
||||
_sheetController = [[SheetWindowController alloc] initWithWindowCibName:@"Window"];
|
||||
[self newDocument:self];
|
||||
}
|
||||
|
||||
|
||||
@@ -36,7 +36,7 @@
|
||||
- (void)positionWindow
|
||||
{
|
||||
var keyWindow = [CPApp keyWindow],
|
||||
origin = CPPointMake(40,40);
|
||||
origin = CPPointMake(40, 40);
|
||||
|
||||
if (keyWindow)
|
||||
{
|
||||
@@ -67,39 +67,39 @@
|
||||
CPLog.warn("No action set on this %@", [sender class]);
|
||||
}
|
||||
|
||||
- (void)addButtons:(CPWindow)window
|
||||
- (void)addButtons:(CPWindow)aWindow
|
||||
{
|
||||
var x = 10,
|
||||
unsetAction = @selector(unsetAction:);
|
||||
|
||||
_closeButton = [ [CPButton alloc] initWithFrame:CGRectMake(x,10,32,100)];
|
||||
_closeButton = [[CPButton alloc] initWithFrame:CGRectMake(x, 10, 32, 100)];
|
||||
[_closeButton setTitle:@"Close"];
|
||||
[_closeButton setButtonType:CPMomentaryPushInButton];
|
||||
[_closeButton setBezelStyle:CPBezelBorder];
|
||||
[_closeButton sizeToFit];
|
||||
[_closeButton setTarget:self];
|
||||
[_closeButton setAction:unsetAction];
|
||||
[[window contentView] addSubview:_closeButton positioned:CPWindowAbove relativeTo:nil];
|
||||
[[aWindow contentView] addSubview:_closeButton positioned:CPWindowAbove relativeTo:nil];
|
||||
x += 10 + CGRectGetWidth([_closeButton frame]);
|
||||
|
||||
_altCloseButton = [ [CPButton alloc] initWithFrame:CGRectMake(x, 10,32,100)];
|
||||
_altCloseButton = [[CPButton alloc] initWithFrame:CGRectMake(x, 10, 32, 100)];
|
||||
[_altCloseButton setTitle:@"Close Parent Too"];
|
||||
[_altCloseButton setButtonType:CPMomentaryPushInButton];
|
||||
[_altCloseButton setBezelStyle:CPBezelBorder];
|
||||
[_altCloseButton sizeToFit];
|
||||
[_altCloseButton setTarget:self];
|
||||
[_altCloseButton setAction:unsetAction];
|
||||
[[window contentView] addSubview:_altCloseButton positioned:CPWindowAbove relativeTo:nil];
|
||||
[[aWindow contentView] addSubview:_altCloseButton positioned:CPWindowAbove relativeTo:nil];
|
||||
x += 10 + CGRectGetWidth([_altCloseButton frame]);
|
||||
|
||||
_otherCloseButton = [ [CPButton alloc] initWithFrame:CGRectMake(x, 10,32,100)];
|
||||
_otherCloseButton = [[CPButton alloc] initWithFrame:CGRectMake(x, 10, 32, 100)];
|
||||
[_otherCloseButton setTitle:@"Chain Sheets"];
|
||||
[_otherCloseButton setButtonType:CPMomentaryPushInButton];
|
||||
[_otherCloseButton setBezelStyle:CPBezelBorder];
|
||||
[_otherCloseButton sizeToFit];
|
||||
[_otherCloseButton setTarget:self];
|
||||
[_otherCloseButton setAction:unsetAction];
|
||||
[[window contentView] addSubview:_otherCloseButton positioned:CPWindowAbove relativeTo:nil];
|
||||
[[aWindow contentView] addSubview:_otherCloseButton positioned:CPWindowAbove relativeTo:nil];
|
||||
}
|
||||
|
||||
- (SheetWindowController)initWithStyleMask:(int)styleMask debug:(int)debug
|
||||
@@ -109,16 +109,16 @@
|
||||
if (styleMask < 0)
|
||||
return [self initWithWindowCibName:@"Window"];
|
||||
|
||||
var window = [ [CPWindow alloc] initWithContentRect:CGRectMake(0,0,400,300) styleMask:styleMask];
|
||||
var theWindow = [[CPWindow alloc] initWithContentRect:CGRectMake(0, 0, 400, 300) styleMask:styleMask];
|
||||
|
||||
if (debug & 1)
|
||||
[window setBackgroundColor:[CPColor colorWithCalibratedRed:1.0 green:0.0 blue:0.0 alpha:0.5]];
|
||||
[theWindow setBackgroundColor:[CPColor colorWithCalibratedRed:1.0 green:0.0 blue:0.0 alpha:0.5]];
|
||||
|
||||
if (debug & 2)
|
||||
[[window contentView] setBackgroundColor:[CPColor colorWithCalibratedRed:0.0 green:0.0 blue:1.0 alpha:0.5]];
|
||||
[[theWindow contentView] setBackgroundColor:[CPColor colorWithCalibratedRed:0.0 green:0.0 blue:1.0 alpha:0.5]];
|
||||
|
||||
if (self = [super initWithWindow:window])
|
||||
[self addButtons:window];
|
||||
if (self = [super initWithWindow:theWindow])
|
||||
[self addButtons:theWindow];
|
||||
|
||||
return self;
|
||||
}
|
||||
@@ -126,11 +126,11 @@
|
||||
- (SheetWindowController)allocController
|
||||
{
|
||||
CPLog.debug("[%@ %@] groupClass=%@", [self class], _cmd,
|
||||
[ [ [ [ [_windowTypeMatrix subviews] objectAtIndex:0] radioGroup] selectedRadio] tag]);
|
||||
[[[[[_windowTypeMatrix subviews] objectAtIndex:0] radioGroup] selectedRadio] tag]);
|
||||
|
||||
var type = 1;
|
||||
if (_windowTypeMatrix)
|
||||
type = [ [ [ [ [_windowTypeMatrix subviews] objectAtIndex:0] radioGroup] selectedRadio] tag];
|
||||
type = [[[[[_windowTypeMatrix subviews] objectAtIndex:0] radioGroup] selectedRadio] tag];
|
||||
|
||||
var styleMask = 0;
|
||||
if ([_titledMaskButton state])
|
||||
@@ -416,15 +416,15 @@
|
||||
otherButton:@"OtherButton"
|
||||
informativeTextWithFormat:@"This informative text sentence shows text wrapping bug."];
|
||||
|
||||
[parentWindow setDelegate:self];
|
||||
[parentWindow setDelegate:self];
|
||||
_parentWindow = parentWindow;
|
||||
_sheet = alert;
|
||||
_returnCode = -1;
|
||||
|
||||
[alert beginSheetModalForWindow:parentWindow
|
||||
modalDelegate:self
|
||||
didEndSelector:@selector(didEndSheet:returnCode:contextInfo:)
|
||||
contextInfo:parentWindow];
|
||||
modalDelegate:self
|
||||
didEndSelector:@selector(didEndSheet:returnCode:contextInfo:)
|
||||
contextInfo:parentWindow];
|
||||
}
|
||||
|
||||
//
|
||||
|
||||
Reference in new issue
Block a user