GSAutoCompleteWindow/Color/ColorWell/ColorList merges

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/branches/gnustep_testplant_branch@38689 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
Marcian Lytwyn 2015-06-26 02:03:03 +00:00
parent 3238f42ec6
commit 425dc1efe7
4 changed files with 105 additions and 34 deletions

View file

@ -182,13 +182,20 @@ static GSAutocompleteWindow *gsWindow = nil;
}
}
#if 0
// Testplant-MAL-2015-06-25: Fix for main branch code...
// String size caching could cache one of our strings with the wrong sizing
widestWord = [NSString stringWithFormat:@"%@#",widestWord];
// Width
cell = [[_tableView tableColumnWithIdentifier: @"content"] dataCell];
windowWidth = ([cell _sizeText: widestWord].width + [NSScroller scrollerWidth] + 2*bsize.width);
// windowWidth *= 1.1;
#else
// Testplant-MAL-2015-06-25: GUI main branch code...
// Width
cell = [[_tableView tableColumnWithIdentifier: @"content"] dataCell];
windowWidth = 1.1*[cell _sizeText: widestWord].width
+ [NSScroller scrollerWidth] + 2*bsize.width;
#endif
//Height
windowHeight = 2*bsize.height + [_tableView rowHeight]*num
@ -203,6 +210,9 @@ static GSAutocompleteWindow *gsWindow = nil;
NSRect rect;
NSRect stringRect;
NSPoint point;
NSInterfaceStyle style;
style = NSInterfaceStyleForKey(@"NSScrollViewInterfaceStyle", nil);
rect = [self frame];
screenFrame = [[[_textView window] screen] frame];
@ -215,7 +225,17 @@ static GSAutocompleteWindow *gsWindow = nil;
[_textView convertRect: stringRect toView: nil].origin];
// Calculate the origin point to the window.
rect.origin.x = point.x; // - [NSScroller scrollerWidth] - 4;
// Testplant-MAL-2015-06-25: Main branch code merge...
if (style == NSMacintoshInterfaceStyle
|| style == NSWindows95InterfaceStyle)
{
rect.origin.x = point.x - 4;
}
else
{
// Testplant-MAL-2015-06-25: Testplant branch code...
rect.origin.x = point.x; // - [NSScroller scrollerWidth] - 4;
}
rect.origin.y = point.y - rect.size.height;
// If part of the window is off screen, change the origin point.

View file

@ -40,6 +40,7 @@
#import <Foundation/NSDebug.h>
#import <Foundation/NSScanner.h>
#import "AppKit/NSBezierPath.h"
#import "AppKit/NSColor.h"
#import "AppKit/NSColorList.h"
#import "AppKit/NSColorSpace.h"
@ -202,12 +203,14 @@ void initSystemColors(void)
colorStrings = [[NSMutableDictionary alloc]
initWithObjectsAndKeys:
black, @"alternateSelectedControlColor",
white, @"alternateSelectedControlTextColor",
lightGray, @"controlBackgroundColor",
lightGray, @"controlColor",
black, @"controlDarkShadowColor",
lightGray, @"controlHighlightColor",
white, @"controlLightHighlightColor",
darkGray, @"controlShadowColor",
black, @"controlDarkShadowColor",
black, @"controlTextColor",
darkGray, @"disabledControlTextColor",
gray, @"gridColor",
@ -216,7 +219,11 @@ void initSystemColors(void)
white, @"highlightColor",
black, @"keyboardFocusIndicatorColor",
lightGray, @"knobColor",
black, @"labelColor",
black, @"quaternaryLabelColor",
gray, @"scrollBarColor",
black, @"secondaryLabelColor",
lightGray, @"secondarySelectedControlColor",
white, @"selectedControlColor",
black, @"selectedControlTextColor",
lightGray, @"selectedKnobColor",
@ -225,18 +232,15 @@ void initSystemColors(void)
lightGray, @"selectedTextBackgroundColor",
black, @"selectedTextColor",
black, @"shadowColor",
black, @"tertiaryLabelColor",
white, @"textBackgroundColor",
black, @"textColor",
lightGray, @"windowBackgroundColor",
black, @"windowFrameColor",
white, @"windowFrameTextColor",
black, @"alternateSelectedControlColor",
white, @"alternateSelectedControlTextColor",
white, @"rowBackgroundColor",
lightGray, @"alternateRowBackgroundColor",
lightGray, @"secondarySelectedControlColor",
//gray, @"windowFrameColor",
//black, @"windowFrameTextColor",
nil];
systemColors = RETAIN([NSColorList colorListNamed: @"System"]);
@ -739,6 +743,11 @@ systemColorWithName(NSString *name)
return systemColorWithName(@"controlColor");
}
+ (NSColor*) controlDarkShadowColor
{
return systemColorWithName(@"controlDarkShadowColor");
}
+ (NSColor*) controlHighlightColor
{
return systemColorWithName(@"controlHighlightColor");
@ -754,11 +763,6 @@ systemColorWithName(NSString *name)
return systemColorWithName(@"controlShadowColor");
}
+ (NSColor*) controlDarkShadowColor
{
return systemColorWithName(@"controlDarkShadowColor");
}
+ (NSColor*) controlTextColor
{
return systemColorWithName(@"controlTextColor");
@ -799,11 +803,26 @@ systemColorWithName(NSString *name)
return systemColorWithName(@"knobColor");
}
+ (NSColor*) labelColor
{
return systemColorWithName(@"labelColor");
}
+ (NSColor*) quaternaryLabelColor
{
return systemColorWithName(@"quaternaryLabelColor");
}
+ (NSColor*) scrollBarColor
{
return systemColorWithName(@"scrollBarColor");
}
+ (NSColor*) secondaryLabelColor
{
return systemColorWithName(@"secondaryLabelColor");
}
+ (NSColor*) secondarySelectedControlColor
{
return systemColorWithName(@"secondarySelectedControlColor");
@ -849,6 +868,11 @@ systemColorWithName(NSString *name)
return systemColorWithName(@"shadowColor");
}
+ (NSColor*) tertiaryLabelColor
{
return systemColorWithName(@"tertiaryLabelColor");
}
+ (NSColor*) textBackgroundColor
{
return systemColorWithName(@"textBackgroundColor");
@ -1364,6 +1388,24 @@ systemColorWithName(NSString *name)
//
- (void) drawSwatchInRect: (NSRect)rect
{
// Testplant-MAL-2015-06-25 Merged with GUI trunk...
if ([self alphaComponent] < 1.0)
{
NSBezierPath *triangle = [NSBezierPath bezierPath];
[[NSColor whiteColor] set];
NSRectFill(rect);
[triangle moveToPoint: NSMakePoint(rect.origin.x,
rect.origin.y + rect.size.height)];
[triangle lineToPoint: NSMakePoint(rect.origin.x + rect.size.width,
rect.origin.y + rect.size.height)];
[triangle lineToPoint: rect.origin];
[triangle closePath];
[[NSColor blackColor] set];
[triangle fill];
}
[self set];
NSRectFill(rect);
}
@ -1515,6 +1557,7 @@ systemColorWithName(NSString *name)
}
else if (colorSpace == 6)
{
// Testplant-MAL-2015-06-25: This fixes the main branch code...
self = [[GSNamedColor alloc] initWithCoder:aDecoder];
}
else if (colorSpace == 10)
@ -1858,6 +1901,7 @@ static NSRecursiveLock *namedColorLock = nil;
+ (void) initialize
{
// Testplant-MAL-2015-06-25: Fix for main branch code...
if (self == [GSNamedColor class])
{
namedColorLock = [NSRecursiveLock new];
@ -2032,6 +2076,7 @@ static NSRecursiveLock *namedColorLock = nil;
[aCoder encodeInt: 6 forKey: @"NSColorSpace"];
[aCoder encodeObject: _catalog_name forKey: @"NSCatalogName"];
[aCoder encodeObject: _color_name forKey: @"NSColorName"];
// Testplant-MAL-2015-06-25: Fix for main branch code...
[aCoder encodeObject: _cached_color forKey:@"NSColor"];
}
else
@ -2047,6 +2092,7 @@ static NSRecursiveLock *namedColorLock = nil;
NSString *listName = nil;
NSString *colorName = nil;
// Testplant-MAL-2015-06-25: Fix for main branch code...
if ([aDecoder allowsKeyedCoding])
{
listName = [aDecoder decodeObjectForKey: @"NSCatalogName"];

View file

@ -535,8 +535,20 @@ static NSColorList *themeColorList = nil;
{
if ([aCoder allowsKeyedCoding])
{
// FIXME
NSMutableArray *colors = [[NSMutableArray alloc] init];
NSInteger i;
for (i = 0; i < [_orderedColorKeys count]; i++)
{
NSString *name = [_orderedColorKeys objectAtIndex: i];
[colors insertObject: [_colorDictionary objectForKey: name]
atIndex: i];
}
[aCoder encodeObject: _name forKey: @"NSName"];
[aCoder encodeObject: _orderedColorKeys forKey: @"NSKeys"];
[aCoder encodeObject: colors forKey: @"NSColors"];
RELEASE(colors);
}
else
{
[aCoder encodeObject: _name];
@ -549,7 +561,14 @@ static NSColorList *themeColorList = nil;
{
if ([aDecoder allowsKeyedCoding])
{
// FIXME
NSArray *colors;
ASSIGN(_name, [aDecoder decodeObjectForKey: @"NSName"]);
ASSIGN(_orderedColorKeys, [aDecoder decodeObjectForKey: @"NSKeys"]);
colors = [aDecoder decodeObjectForKey: @"NSColors"];
_colorDictionary = [[NSMutableDictionary alloc]
initWithObjects: colors
forKeys: _orderedColorKeys];
}
else
{

View file

@ -185,7 +185,7 @@ static NSString *GSColorWellDidBecomeExclusiveNotification =
_wellRect = [[GSTheme theme] drawColorWellBorder: self
withBounds: _bounds
withClip: clipRect];
[self drawWellInside: NSIntersectionRect(_wellRect, clipRect)];
[self drawWellInside: _wellRect];
}
/**<p>Draws the NSColorWell inside the rectangle <var>insideRect</var>.</p>
@ -197,22 +197,6 @@ static NSString *GSColorWellDidBecomeExclusiveNotification =
{
return;
}
if ([_the_color alphaComponent] < 1.0)
{
NSBezierPath *triangle = [NSBezierPath bezierPath];
[[NSColor whiteColor] set];
NSRectFill(insideRect);
[triangle moveToPoint: NSMakePoint(insideRect.origin.x,
insideRect.origin.y + insideRect.size.height)];
[triangle lineToPoint: NSMakePoint(insideRect.origin.x + insideRect.size.width,
insideRect.origin.y + insideRect.size.height)];
[triangle lineToPoint: insideRect.origin];
[triangle closePath];
[[NSColor blackColor] set];
[triangle fill];
}
[_the_color drawSwatchInRect: insideRect];
}
@ -305,7 +289,9 @@ static NSString *GSColorWellDidBecomeExclusiveNotification =
- (BOOL) isOpaque
{
return _is_bordered;
// Testplant-MAL-2015-06-25: main branch code merge...
// May not be opaque, due to themes
return NO;
}
- (void) mouseDown: (NSEvent *)theEvent