From 4c31b251102466f21a284ebe66db4ab98ea53cb8 Mon Sep 17 00:00:00 2001 From: Ross Boucher Date: Wed, 13 May 2009 12:46:18 -0700 Subject: [PATCH 1/3] A couple minor segmented control changes. Still needs work. --- AppKit/CPSegmentedControl.j | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/AppKit/CPSegmentedControl.j b/AppKit/CPSegmentedControl.j index 303b7e70c..6ab4e86ef 100644 --- a/AppKit/CPSegmentedControl.j +++ b/AppKit/CPSegmentedControl.j @@ -443,20 +443,20 @@ CPSegmentSwitchTrackingMomentary = 2; contentInset = [self currentValueForThemeAttribute:@"content-inset"], bezelInset = [self currentValueForThemeAttribute:@"bezel-inset"], bounds = [self bounds]; - +console.log("bounds: "+CPStringFromRect(bounds)); if (aName === "left-segment-bezel") { return CGRectMake(bezelInset.left, bezelInset.top, contentInset.left, height); } else if (aName === "right-segment-bezel") { - return CGRectMake(CGRectGetMaxX(bounds) - contentInset.right, bezelInset.top, contentInset.right, height); + return CGRectMake(CGRectGetMaxX(bounds) - contentInset.right - bezelInset.right, bezelInset.top, contentInset.right, height); } else if (aName.substring(0, "segment-bezel".length) == "segment-bezel") { var segment = parseInt(aName.substring("segment-bezel-".length), 10), frame = CGRectCreateCopy(_segments[segment].frame); - +console.log(segment+" "+CPStringFromRect(frame)); if (segment == 0) { frame.origin.x += contentInset.left; @@ -465,7 +465,7 @@ CPSegmentSwitchTrackingMomentary = 2; if (segment == _segments.length - 1) frame.size.width -= contentInset.right; - +console.log("finished "+CPStringFromRect(frame)); return frame; } else if (aName.substring(0, "divider-bezel".length) == "divider-bezel") @@ -549,9 +549,12 @@ CPSegmentSwitchTrackingMomentary = 2; [contentView setLineBreakMode:[self valueForThemeAttribute:@"line-break-mode" inState:themeState]]; [contentView setTextShadowColor:[self valueForThemeAttribute:@"text-shadow-color" inState:themeState]]; [contentView setTextShadowOffset:[self valueForThemeAttribute:@"text-shadow-offset" inState:themeState]]; - [contentView setImagePosition:[self valueForThemeAttribute:@"image-position" inState:themeState]]; [contentView setImageScaling:[self valueForThemeAttribute:@"image-scaling" inState:themeState]]; - + + if (segment.image && segment.label) + [contentView setImagePosition:[self valueForThemeAttribute:@"image-position" inState:themeState]]; + else if (segment.image) + [contentView setImagePosition:CPImageOnly]; if (i == count - 1) continue; @@ -619,7 +622,7 @@ CPSegmentSwitchTrackingMomentary = 2; // Update Segment Width segment.width = segmentWidth; segment.frame = [self frameForSegment:aSegment];; - +console.log("updated: "+CPStringFromRect(segment.frame)); // Update Following Segments Widths var index = aSegment + 1; From f4231dd890affd1ae65ea1cad6c459e4b1963343 Mon Sep 17 00:00:00 2001 From: Ross Boucher Date: Wed, 13 May 2009 18:19:41 -0700 Subject: [PATCH 2/3] Fix for closing an already not visible window causing app to break. --- AppKit/Platform/DOM/CPDOMWindowLayer.j | 3 +++ 1 file changed, 3 insertions(+) diff --git a/AppKit/Platform/DOM/CPDOMWindowLayer.j b/AppKit/Platform/DOM/CPDOMWindowLayer.j index be1c7c673..b1fdd76c5 100644 --- a/AppKit/Platform/DOM/CPDOMWindowLayer.j +++ b/AppKit/Platform/DOM/CPDOMWindowLayer.j @@ -61,6 +61,9 @@ - (void)removeWindow:(CPWindow)aWindow { + if (!aWindow._isVisible) + return; + var index = aWindow._index, count = _windows.length - 1; From a71a984a03413aef001f997f5e8f9b1ab6fbfaf8 Mon Sep 17 00:00:00 2001 From: Ross Boucher Date: Wed, 13 May 2009 18:28:18 -0700 Subject: [PATCH 3/3] Accidentally committed logs to CPSegmentedContorl --- AppKit/CPSegmentedControl.j | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/AppKit/CPSegmentedControl.j b/AppKit/CPSegmentedControl.j index 6ab4e86ef..411baa18c 100644 --- a/AppKit/CPSegmentedControl.j +++ b/AppKit/CPSegmentedControl.j @@ -443,7 +443,7 @@ CPSegmentSwitchTrackingMomentary = 2; contentInset = [self currentValueForThemeAttribute:@"content-inset"], bezelInset = [self currentValueForThemeAttribute:@"bezel-inset"], bounds = [self bounds]; -console.log("bounds: "+CPStringFromRect(bounds)); + if (aName === "left-segment-bezel") { return CGRectMake(bezelInset.left, bezelInset.top, contentInset.left, height); @@ -456,7 +456,7 @@ console.log("bounds: "+CPStringFromRect(bounds)); { var segment = parseInt(aName.substring("segment-bezel-".length), 10), frame = CGRectCreateCopy(_segments[segment].frame); -console.log(segment+" "+CPStringFromRect(frame)); + if (segment == 0) { frame.origin.x += contentInset.left; @@ -465,7 +465,7 @@ console.log(segment+" "+CPStringFromRect(frame)); if (segment == _segments.length - 1) frame.size.width -= contentInset.right; -console.log("finished "+CPStringFromRect(frame)); + return frame; } else if (aName.substring(0, "divider-bezel".length) == "divider-bezel") @@ -622,7 +622,7 @@ console.log("finished "+CPStringFromRect(frame)); // Update Segment Width segment.width = segmentWidth; segment.frame = [self frameForSegment:aSegment];; -console.log("updated: "+CPStringFromRect(segment.frame)); + // Update Following Segments Widths var index = aSegment + 1;