diff --git a/ChangeLog b/ChangeLog index edfd75497..e34ac37ce 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,16 @@ +2006-01-22 Fred Kiefer + + * Source/NSPopupButtonCell.m (-synchronizeTitleAndSelectedItem): + Only select an item if one is highlighted. + * Source/Functions.m: NSFrameRectWithWidthUsingOperation() new + function from Cocoa. NSFrameRectWithWidth() different + implementation, no longer using stroke. + +2006-01-20 Fred Kiefer + + * Source/NSTableHeaderCell.m: Simplified code by letting + the super classes do their job. + 2006-01-14 Richard Frith-Macdonald * Source/NSWindow.m: minor fixups for 64bit cpu support. diff --git a/Source/Functions.m b/Source/Functions.m index 4ec934ec1..68044329c 100644 --- a/Source/Functions.m +++ b/Source/Functions.m @@ -474,14 +474,32 @@ void NSFrameRect(const NSRect aRect) void NSFrameRectWithWidth(const NSRect aRect, float frameWidth) { - float width; - NSGraphicsContext *ctxt = GSCurrentContext(); - DPScurrentlinewidth(ctxt, &width); - DPSsetlinewidth(ctxt, frameWidth); - DPSrectstroke(ctxt, NSMinX(aRect) + frameWidth / 2.0, - NSMinY(aRect) + frameWidth / 2.0, - NSWidth(aRect) - frameWidth, NSHeight(aRect) - frameWidth); - DPSsetlinewidth(ctxt, width); + NSRectEdge sides[] = {NSMaxXEdge, NSMinYEdge, NSMinXEdge, NSMaxYEdge}; + NSRect remainder = aRect; + NSRect rects[4]; + int i; + + for (i = 0; i < 4; i++) + { + NSDivideRect(remainder, &rects[i], &remainder, frameWidth, sides[i]); + } + NSRectFillList(rects, 4); +} + +void +NSFrameRectWithWidthUsingOperation(NSRect aRect, float frameWidth, + NSCompositingOperation op) +{ + NSRectEdge sides[] = {NSMaxXEdge, NSMinYEdge, NSMinXEdge, NSMaxYEdge}; + NSRect remainder = aRect; + NSRect rects[4]; + int i; + + for (i = 0; i < 4; i++) + { + NSDivideRect(remainder, &rects[i], &remainder, frameWidth, sides[i]); + } + NSRectFillListUsingOperation(rects, 4, op); } NSRect diff --git a/Source/NSPopUpButtonCell.m b/Source/NSPopUpButtonCell.m index 14b7c9f74..11aec2f0f 100644 --- a/Source/NSPopUpButtonCell.m +++ b/Source/NSPopUpButtonCell.m @@ -531,12 +531,19 @@ static NSImage *_pbc_image[2]; { index = [[_menu menuRepresentation] highlightedItemIndex]; - if (index < 0) - index = [self indexOfSelectedItem]; - if (index < 0) - index = 0; - - [self selectItemAtIndex: index]; + if (index < 0) + { + // If no item is highighted, display the selected one ... + index = [self indexOfSelectedItem]; + // ... if there is nown, then the first one, but don't select it. + if (index < 0) + index = 0; + } + else + { + // Selected the highlighted item + [self selectItemAtIndex: index]; + } } if ((index >= 0) && ([_menu numberOfItems] > index))