Lots of fixes.

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@4844 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
michael 1999-09-07 08:59:35 +00:00
parent 186d117c16
commit 9870f513bc
12 changed files with 352 additions and 214 deletions

View file

@ -1,3 +1,21 @@
1999-09-07 Michael Hanni <mhanni@sprintmail.com>
* Source/NSInterfaceStyle.m: added support for
GSWindowMakerInterfaceStyle.
* Headers/NSInterfaceStyle.h: added enum
GSWindowMakerInterfaceStyle.
* Source/NSMenu.m: implemented NSInterfaceStyle based window maker
like menus. i.e. they line up with the menu item selected.
try 'defaults write NSGlobalDomain NSMenuInterfaceStyle
GSWindowMakerInterfaceStyle'
* Source/NSTabView.m: some modifications to make tabs on the
bottom look a little better.
* Source/NSAttributedString.m: turned off fixParagraphAttributes,
was causing Text Network to crash. (Most likely my fault.)
* Source/NSLayoutManager.m: lots of code... nothing exciting.
* Images/*: somehow I triggered CVS to touch everything in here,
oops.
Tue Sep 7 6:50:00 1999 Richard Frith-Macdonald <richard@brainstorm.co.uk> Tue Sep 7 6:50:00 1999 Richard Frith-Macdonald <richard@brainstorm.co.uk>
* Source/NSScrollView.m: ([-setContentView:]) prohibit illegal settings. * Source/NSScrollView.m: ([-setContentView:]) prohibit illegal settings.

View file

@ -36,7 +36,14 @@ typedef enum {
NSNoInterfaceStyle = 0, NSNoInterfaceStyle = 0,
NSNextStepInterfaceStyle = 1, NSNextStepInterfaceStyle = 1,
NSMacintoshInterfaceStyle = 2, NSMacintoshInterfaceStyle = 2,
NSWindows95InterfaceStyle = 3 NSWindows95InterfaceStyle = 3,
/*
* GNUstep specific. Blame: Michael Hanni.
*/
GSWindowMakerInterfaceStyle = 4
} NSInterfaceStyle; } NSInterfaceStyle;
extern NSString *NSInterfaceStyleDefault; extern NSString *NSInterfaceStyleDefault;

View file

@ -19,7 +19,7 @@
# #
# You should have received a copy of the GNU Library General Public # You should have received a copy of the GNU Library General Public
# License along with this library; if not, write to the Free # License along with this library; if not, write to the Free
# Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. # Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111 USA.
GNUSTEP_INSTALLATION_DIR = $(GNUSTEP_SYSTEM_ROOT) GNUSTEP_INSTALLATION_DIR = $(GNUSTEP_SYSTEM_ROOT)

View file

@ -412,7 +412,7 @@ documentAttributes: (NSDictionary**)dict
- (void) fixAttributesInRange: (NSRange)range - (void) fixAttributesInRange: (NSRange)range
{ {
[self fixFontAttributeInRange: range]; [self fixFontAttributeInRange: range];
[self fixParagraphStyleAttributeInRange: range]; // [self fixParagraphStyleAttributeInRange: range];
[self fixAttachmentAttributeInRange: range]; [self fixAttachmentAttributeInRange: range];
} }

View file

@ -49,6 +49,8 @@ styleFromString(NSString* str)
return NSMacintoshInterfaceStyle; return NSMacintoshInterfaceStyle;
if ([str isEqualToString: @"NSWindows95InterfaceStyle"]) if ([str isEqualToString: @"NSWindows95InterfaceStyle"])
return NSWindows95InterfaceStyle; return NSWindows95InterfaceStyle;
if ([str isEqualToString: @"GSWindowMakerInterfaceStyle"])
return GSWindowMakerInterfaceStyle;
return NSNoInterfaceStyle; return NSNoInterfaceStyle;
} }

View file

@ -169,8 +169,8 @@ static NSComparisonResult aSort(GSIArrayItem i0, GSIArrayItem i1)
position = GSIArrayInsertionPosition(_runs, (GSIArrayItem)aKey, aSort); position = GSIArrayInsertionPosition(_runs, (GSIArrayItem)aKey, aSort);
NSLog(@"key: %d aObject: %d position: %d", aKey->glyphRange.location, // NSLog(@"key: %d aObject: %d position: %d", aKey->glyphRange.location,
aObject->glyphRange.location, position); //aObject->glyphRange.location, position);
if (position > 0) if (position > 0)
{ {
@ -179,18 +179,18 @@ aObject->glyphRange.location, position);
if (anKey->glyphRange.location == aObject->glyphRange.location) if (anKey->glyphRange.location == aObject->glyphRange.location)
{ {
// GSIArrayInsertSorted(_runs, (GSIArrayItem)anObject, aSort); // GSIArrayInsertSorted(_runs, (GSIArrayItem)anObject, aSort);
NSLog(@"=========> duplicated item."); // NSLog(@"=========> duplicated item.");
GSIArraySetItemAtIndex(_runs, (GSIArrayItem)anObject, position-1); GSIArraySetItemAtIndex(_runs, (GSIArrayItem)anObject, position-1);
} }
else else
{ {
NSLog(@"=========> not duplicated item."); // NSLog(@"=========> not duplicated item.");
GSIArrayInsertItem(_runs, (GSIArrayItem)anObject, position); GSIArrayInsertItem(_runs, (GSIArrayItem)anObject, position);
} }
} }
else if (position == 0) else if (position == 0)
{ {
NSLog(@"=========> first item (zero index)."); // NSLog(@"=========> first item (zero index).");
GSIArrayInsertItem(_runs, (GSIArrayItem)anObject, position); GSIArrayInsertItem(_runs, (GSIArrayItem)anObject, position);
// GSIArrayInsertSorted(_runs, (GSIArrayItem)anObject, aSort); // GSIArrayInsertSorted(_runs, (GSIArrayItem)anObject, aSort);
// [self insertObject:anObject atIndex:position]; // [self insertObject:anObject atIndex:position];
@ -198,7 +198,7 @@ aObject->glyphRange.location, position);
else else
NSLog(@"dead. VERY DEAD DEAD DEAD DEAD."); NSLog(@"dead. VERY DEAD DEAD DEAD DEAD.");
NSLog(@"==> %d item(s)", GSIArrayCount(_runs)); // NSLog(@"==> %d item(s)", GSIArrayCount(_runs));
} }
- (void)insertObject:(id)anObject - (void)insertObject:(id)anObject
@ -536,16 +536,19 @@ textContainer(s) in containerRuns.", [containerRuns count]);
{ {
GSTextContainerLayoutInfo *aNewLine = [containerRuns objectAtIndex:i]; GSTextContainerLayoutInfo *aNewLine = [containerRuns objectAtIndex:i];
/*
NSLog(@"glyphRangeForTextContainer: (%d, %d)", NSLog(@"glyphRangeForTextContainer: (%d, %d)",
aNewLine->glyphRange.location, aNewLine->glyphRange.location,
aNewLine->glyphRange.length); aNewLine->glyphRange.length);
*/
if ([aNewLine->textContainer isEqual:aTextContainer]) if ([aNewLine->textContainer isEqual:aTextContainer])
{ {
/*
NSLog(@"glyphRangeForWantedTextContainer: (%d, %d)", NSLog(@"glyphRangeForWantedTextContainer: (%d, %d)",
aNewLine->glyphRange.location, aNewLine->glyphRange.location,
aNewLine->glyphRange.length); aNewLine->glyphRange.length);
*/
return aNewLine->glyphRange; return aNewLine->glyphRange;
} }
} }
@ -927,7 +930,7 @@ info->lineFragmentRect.size.height);
firstPosition = [fragmentRuns indexOfObjectContainingLocation:glyphRange.location]; firstPosition = [fragmentRuns indexOfObjectContainingLocation:glyphRange.location];
lastPosition = [fragmentRuns lastPosition = [fragmentRuns
indexOfObjectContainingLocation:(glyphRange.location+glyphRange.length-2)]; indexOfObjectContainingLocation:(glyphRange.location+glyphRange.length-3)];
NSLog(@"glyphRange: (%d, %d) position1: %d position2: %d", NSLog(@"glyphRange: (%d, %d) position1: %d position2: %d",
glyphRange.location, glyphRange.length, firstPosition, lastPosition); glyphRange.location, glyphRange.length, firstPosition, lastPosition);
@ -936,13 +939,16 @@ glyphRange.location, glyphRange.length, firstPosition, lastPosition);
{ {
if (lastPosition == -1) if (lastPosition == -1)
{ {
lastPosition = [fragmentRuns count]; // FIXME lastPosition = [fragmentRuns count] - 1; // FIXME
NSLog(@"fixed lastPosition: %d", lastPosition); NSLog(@"fixed lastPosition: %d", lastPosition);
} }
for (i = firstPosition; i < lastPosition; i++) for (i = firstPosition; i <= lastPosition; i++)
{ {
GSLineLayoutInfo *aLine = [fragmentRuns objectAtIndex:i]; GSLineLayoutInfo *aLine = [fragmentRuns objectAtIndex:i];
NSRect aRect = aLine->lineFragmentRect;
aRect.size.height -= 4;
/* /*
NSLog(@"drawRange: (%d, %d) inRect (%f, %f) (%f, %f)", NSLog(@"drawRange: (%d, %d) inRect (%f, %f) (%f, %f)",
aLine->glyphRange.location, aLine->glyphRange.location,
@ -952,6 +958,8 @@ aLine->lineFragmentRect.origin.y,
aLine->lineFragmentRect.size.width, aLine->lineFragmentRect.size.width,
aLine->lineFragmentRect.size.height); aLine->lineFragmentRect.size.height);
*/ */
NSEraseRect (aRect);
[_textStorage drawRange:aLine->glyphRange inRect:aLine->lineFragmentRect]; [_textStorage drawRange:aLine->glyphRange inRect:aLine->lineFragmentRect];
} }
} }
@ -1015,13 +1023,15 @@ Ghiradelli chocolate to he who puts all the pieces together :) */
{ {
NSSize cSize = [aContainer containerSize]; NSSize cSize = [aContainer containerSize];
float i = 0.0; float i = 0.0;
NSMutableArray *lines = [NSMutableArray new]; NSMutableArray *lineStarts = [NSMutableArray new];
NSMutableArray *lineEnds = [NSMutableArray new];
int indexToAdd; int indexToAdd;
_GNUTextScanner *lineScanner; _GNUTextScanner *lineScanner;
_GNUTextScanner *paragraphScanner; _GNUTextScanner *paragraphScanner;
BOOL lastLineForContainerReached = NO; BOOL lastLineForContainerReached = NO;
NSString *aString; NSString *aString;
int previousScanLocation; int previousScanLocation;
int previousParagraphLocation;
int endScanLocation; int endScanLocation;
int startIndex; int startIndex;
NSRect firstProposedRect; NSRect firstProposedRect;
@ -1038,9 +1048,11 @@ Ghiradelli chocolate to he who puts all the pieces together :) */
NSRange currentStringRange; NSRange currentStringRange;
NSRange trailingSpacesRange; NSRange trailingSpacesRange;
NSRange leadingNlRange; NSRange leadingNlRange;
NSRange trailingNlRange;
NSSize lSize; NSSize lSize;
float lineWidth = 0.0; float lineWidth = 0.0;
float ourLines = 0.0; float ourLines = 0.0;
int beginLineIndex = 0;
NSLog(@"rebuilding Layout at index: %d.\n", glyphIndex); NSLog(@"rebuilding Layout at index: %d.\n", glyphIndex);
@ -1075,23 +1087,30 @@ Ghiradelli chocolate to he who puts all the pieces together :) */
while (![paragraphScanner isAtEnd]) while (![paragraphScanner isAtEnd])
{ {
// leadingNlRange=[paragraphScanner scanSetCharacters]; previousParagraphLocation = [paragraphScanner scanLocation];
paragraphRange = [paragraphScanner scanNonSetCharacters]; beginLineIndex = previousParagraphLocation;
leadingNlRange=[paragraphScanner scanSetCharacters]; lineWidth = 0.0;
if (leadingNlRange.length) leadingNlRange=[paragraphScanner scanSetCharacters];
currentStringRange = NSUnionRange (leadingNlRange,paragraphRange); paragraphRange = [paragraphScanner scanNonSetCharacters];
trailingNlRange=[paragraphScanner scanSetCharacters];
// NSLog(@"leadingNlRange: (%d, %d)", leadingNlRange.location, leadingNlRange.length);
// if (leadingNlRange.length)
// paragraphRange = NSUnionRange (leadingNlRange,paragraphRange);
// if (trailingNlRange.length)
// paragraphRange = NSUnionRange (trailingNlRange,paragraphRange);
NSLog(@"paragraphRange: (%d, %d)", paragraphRange.location, paragraphRange.length); NSLog(@"paragraphRange: (%d, %d)", paragraphRange.location, paragraphRange.length);
NSLog(@"======> begin paragraph");
lineScanner = [_GNUTextScanner scannerWithString:[[_textStorage string] substringWithRange:paragraphRange] lineScanner = [_GNUTextScanner scannerWithString:[[_textStorage string] substringWithRange:paragraphRange]
set:selectionWordGranularitySet invertedSet:invSelectionWordGranularitySet]; set:selectionWordGranularitySet invertedSet:invSelectionWordGranularitySet];
while(![lineScanner isAtEnd]) while(![lineScanner isAtEnd])
{ {
previousScanLocation = [lineScanner scanLocation]; previousScanLocation = [lineScanner scanLocation];
// snack next word // snack next word
leadingSpacesRange = [lineScanner scanSetCharacters]; // leading spaces: only first time leadingSpacesRange = [lineScanner scanSetCharacters]; // leading spaces: only first time
currentStringRange = [lineScanner scanNonSetCharacters]; currentStringRange = [lineScanner scanNonSetCharacters];
@ -1104,16 +1123,28 @@ Ghiradelli chocolate to he who puts all the pieces together :) */
lSize = [_textStorage sizeRange:currentStringRange]; lSize = [_textStorage sizeRange:currentStringRange];
if (lineWidth + lSize.width < cSize.width) // lSize = [_textStorage sizeRange:
//NSMakeRange(currentStringRange.location+paragraphRange.location+startIndex,
//currentStringRange.length)];
if ((lineWidth + lSize.width) < cSize.width)
{ {
if ([lineScanner isAtEnd]) if ([lineScanner isAtEnd])
{ {
NSLog(@"we are at end before finishing a line: %d.\n", [lineScanner scanLocation]); NSLog(@"we are at end before finishing a line: %d.\n", [lineScanner scanLocation]);
[lines addObject:[NSNumber numberWithInt:(int)[lineScanner scanLocation] + paragraphRange.location]]; NSLog(@"scanLocation = %d, previousParagraphLocation = %d, beginLineIndex = %d",
[lineScanner scanLocation],
previousParagraphLocation,
beginLineIndex);
[lineStarts addObject: [NSNumber
numberWithInt:beginLineIndex]];
[lineEnds addObject: [NSNumber
numberWithInt:(int)[lineScanner scanLocation] + previousParagraphLocation - (beginLineIndex)]];
lineWidth = 0.0;
} }
lineWidth += lSize.width; lineWidth += lSize.width;
NSLog(@"lineWidth: %f", lineWidth); //NSLog(@"lineWidth: %f", lineWidth);
} }
else else
{ {
@ -1124,13 +1155,22 @@ Ghiradelli chocolate to he who puts all the pieces together :) */
} }
[lineScanner setScanLocation:previousScanLocation]; [lineScanner setScanLocation:previousScanLocation];
indexToAdd = previousScanLocation + paragraphRange.location; indexToAdd = previousScanLocation + previousParagraphLocation
- (beginLineIndex);
NSLog(@"previousScanLocation = %d, previousParagraphLocation = %d, beginLineIndex = %d indexToAdd = %d",
previousScanLocation,
previousParagraphLocation,
beginLineIndex,
indexToAdd);
ourLines += 14.0; ourLines += 14.0;
lineWidth = 0; lineWidth = 0.0;
NSLog(@"indexToAdd: %d\tourLines: %f", indexToAdd, ourLines); [lineStarts addObject: [NSNumber
numberWithInt:beginLineIndex]];
[lines addObject:[NSNumber numberWithInt:indexToAdd]]; [lineEnds addObject:[NSNumber numberWithInt:indexToAdd]];
beginLineIndex = previousScanLocation + previousParagraphLocation;
} }
} }
@ -1138,7 +1178,7 @@ Ghiradelli chocolate to he who puts all the pieces together :) */
break; break;
} }
endScanLocation = [lineScanner scanLocation] + paragraphRange.location; endScanLocation = [paragraphScanner scanLocation];
NSLog(@"endScanLocation: %d", endScanLocation); NSLog(@"endScanLocation: %d", endScanLocation);
@ -1151,14 +1191,18 @@ Ghiradelli chocolate to he who puts all the pieces together :) */
// step 2. break the lines up and assign rects to them. // step 2. break the lines up and assign rects to them.
for (i=0;i<[lines count];i++) for (i=0;i<[lineStarts count];i++)
{ {
NSRect aRect, bRect; NSRect aRect, bRect;
float padding = [aContainer lineFragmentPadding]; float padding = [aContainer lineFragmentPadding];
NSRange ourRange; NSRange ourRange;
NSLog(@"\t\t===> %d", [[lines objectAtIndex:i] intValue]); // NSLog(@"\t\t===> %d", [[lines objectAtIndex:i] intValue]);
ourRange = NSMakeRange ([[lineStarts objectAtIndex: i] intValue],
[[lineEnds objectAtIndex: i] intValue]);
/*
if (i == 0) if (i == 0)
{ {
ourRange = NSMakeRange (startIndex, ourRange = NSMakeRange (startIndex,
@ -1170,7 +1214,10 @@ Ghiradelli chocolate to he who puts all the pieces together :) */
[[lines objectAtIndex:i] intValue] - [[lines objectAtIndex:i-1] [[lines objectAtIndex:i] intValue] - [[lines objectAtIndex:i-1]
intValue]); intValue]);
} }
*/
NSLog(@"line: %@|", [[_textStorage string]
substringWithRange:ourRange]);
firstProposedRect = NSMakeRect (0, i * 14, cSize.width, 14); firstProposedRect = NSMakeRect (0, i * 14, cSize.width, 14);
// ask our textContainer to fix our lineFragment. // ask our textContainer to fix our lineFragment.
@ -1204,7 +1251,8 @@ intValue]);
// didCompleteLayoutForTextContainer:[textContainers objectAtIndex:i] // didCompleteLayoutForTextContainer:[textContainers objectAtIndex:i]
// atEnd:YES]; // atEnd:YES];
[lines release]; [lineStarts release];
[lineEnds release];
return endScanLocation; return endScanLocation;
} }

View file

@ -489,14 +489,17 @@ static NSString* NSMenuLocationsKey = @"NSMenuLocations";
{ {
NSRect frame; NSRect frame;
NSRect submenuFrame; NSRect submenuFrame;
NSWindow *win_link;
if (![self isFollowTransient]) if (![self isFollowTransient])
{ {
frame = [aWindow frame]; frame = [aWindow frame];
win_link = aWindow;
} }
else else
{ {
frame = [bWindow frame]; frame = [bWindow frame];
win_link = bWindow;
} }
if (aSubmenu) if (aSubmenu)
@ -506,9 +509,20 @@ static NSString* NSMenuLocationsKey = @"NSMenuLocations";
else else
submenuFrame = NSZeroRect; submenuFrame = NSZeroRect;
return NSMakePoint (frame.origin.x + frame.size.width + 1, if (NSInterfaceStyleForKey(@"NSMenuInterfaceStyle", nil) == GSWindowMakerInterfaceStyle)
frame.origin.y + frame.size.height {
- submenuFrame.size.height); NSRect aRect = [menu_view rectOfItemAtIndex:[self indexOfItemWithTitle:[aSubmenu title]]];
NSPoint subOrigin = [win_link convertBaseToScreen: NSMakePoint(aRect.origin.x, aRect.origin.y)];
return NSMakePoint (frame.origin.x + frame.size.width + 1,
subOrigin.y - (submenuFrame.size.height - 41));
}
else
{
return NSMakePoint (frame.origin.x + frame.size.width + 1,
frame.origin.y + frame.size.height
- submenuFrame.size.height);
}
} }
- (NSMenu *) supermenu - (NSMenu *) supermenu
@ -837,6 +851,12 @@ NSArray* array;
} }
} }
- (void) _rightMouseDisplay
{
// TODO: implement this method
;
}
- (void) display - (void) display
{ {
if (menu_changed) if (menu_changed)

View file

@ -309,204 +309,234 @@
if (tab_type == NSBottomTabsBezelBorder) if (tab_type == NSBottomTabsBezelBorder)
{ {
for (i=0;i<howMany;i++) { for (i=0;i<howMany;i++)
// where da tab be at? {
NSSize s; // where da tab be at?
NSRect r; NSSize s;
NSPoint iP; NSRect r;
NSTabViewItem *anItem = [tab_items objectAtIndex:i]; NSPoint iP;
NSTabState itemState; NSTabViewItem *anItem = [tab_items objectAtIndex:i];
NSTabState itemState;
itemState = [anItem tabState]; itemState = [anItem tabState];
s = [anItem sizeOfLabel:NO]; s = [anItem sizeOfLabel:NO];
if (i == 0) { if (i == 0)
{
int iFlex = 0;
iP.x = rect.origin.x;
iP.y = rect.origin.y;
iP.x = rect.origin.x; if (itemState == NSSelectedTab)
iP.y = rect.origin.y; {
iP.y += 1;
[[NSImage imageNamed:@"common_TabDownSelectedLeft.tiff"]
compositeToPoint:iP operation: NSCompositeSourceOver];
iP.y -= 1;
iFlex = 1;
}
else if (itemState == NSBackgroundTab)
{
iP.y += 1;
[[NSImage imageNamed:@"common_TabDownUnSelectedLeft.tiff"]
compositeToPoint:iP operation: NSCompositeSourceOver];
iP.y -= 1;
}
else
NSLog(@"Not finished yet. Luff ya.\n");
if (itemState == NSSelectedTab) { r.origin.x = rect.origin.x + 13;
iP.y += 1; r.origin.y = rect.origin.y + 2;
[[NSImage imageNamed:@"common_TabDownSelectedLeft.tiff"] r.size.width = s.width;
compositeToPoint:iP operation: NSCompositeSourceOver]; r.size.height = 15 + iFlex;
}
else if (itemState == NSBackgroundTab)
[[NSImage imageNamed:@"common_TabDownUnSelectedLeft.tiff"]
compositeToPoint:iP operation: NSCompositeSourceOver];
else
NSLog(@"Not finished yet. Luff ya.\n");
r.origin.x = rect.origin.x + 13; DPSsetlinewidth(ctxt,1);
r.origin.y = rect.origin.y + 2; DPSsetgray(ctxt,1);
r.size.width = s.width; DPSmoveto(ctxt, r.origin.x, r.origin.y-1);
r.size.height = 15; DPSrlineto(ctxt, r.size.width, 0);
DPSstroke(ctxt);
DPSsetlinewidth(ctxt,1); [anItem drawLabel:NO inRect:r];
DPSsetgray(ctxt,1);
DPSmoveto(ctxt, r.origin.x, r.origin.y-1);
DPSrlineto(ctxt, r.size.width, 0);
DPSstroke(ctxt);
[anItem drawLabel:NO inRect:r]; previousRect = r;
previousState = itemState;
previousRect = r;
previousState = itemState;
} else {
iP.x = previousRect.origin.x + previousRect.size.width;
iP.y = rect.origin.y;
if (itemState == NSSelectedTab) {
iP.y += 1;
[[NSImage
imageNamed:@"common_TabDownUnSelectedToSelectedJunction.tiff"]
compositeToPoint:iP operation: NSCompositeSourceOver];
}
else if (itemState == NSBackgroundTab) {
if (previousState == NSSelectedTab) {
iP.y += 1;
[[NSImage
imageNamed:@"common_TabDownSelectedToUnSelectedJunction.tiff"]
compositeToPoint:iP operation: NSCompositeSourceOver];
iP.y -= 1;
} else { } else {
[[NSImage int iFlex = 0;
imageNamed:@"common_TabDownUnSelectedJunction.tiff"] iP.x = previousRect.origin.x + previousRect.size.width;
compositeToPoint:iP operation: NSCompositeSourceOver]; iP.y = rect.origin.y;
}
}
else
NSLog(@"Not finished yet. Luff ya.\n");
r.origin.x = iP.x + 13; if (itemState == NSSelectedTab)
r.origin.y = rect.origin.y + 2; {
r.size.width = s.width; iP.y += 1;
r.size.height = 15; iFlex = 1;
[[NSImage imageNamed:@"common_TabDownUnSelectedToSelectedJunction.tiff"]
compositeToPoint:iP operation: NSCompositeSourceOver];
iP.y -= 1;
}
else if (itemState == NSBackgroundTab)
{
if (previousState == NSSelectedTab)
{
iP.y += 1;
[[NSImage imageNamed:@"common_TabDownSelectedToUnSelectedJunction.tiff"]
compositeToPoint:iP operation: NSCompositeSourceOver];
iP.y -= 1;
iFlex = -1;
} else {
// iP.y += 1;
[[NSImage imageNamed:@"common_TabDownUnSelectedJunction.tiff"]
compositeToPoint:iP operation: NSCompositeSourceOver];
//iP.y -= 1;
iFlex = -1;
}
}
else
NSLog(@"Not finished yet. Luff ya.\n");
r.origin.x = iP.x + 13;
r.origin.y = rect.origin.y + 2;
r.size.width = s.width;
r.size.height = 15 + iFlex; // was 15
DPSsetlinewidth(ctxt,1); iFlex = 0;
DPSsetgray(ctxt,1);
DPSmoveto(ctxt, r.origin.x, r.origin.y - 1);
DPSrlineto(ctxt, r.size.width, 0);
DPSstroke(ctxt);
[anItem drawLabel:NO inRect:r]; DPSsetlinewidth(ctxt,1);
DPSsetgray(ctxt,1);
DPSmoveto(ctxt, r.origin.x, r.origin.y - 1);
DPSrlineto(ctxt, r.size.width, 0);
DPSstroke(ctxt);
previousRect = r; [anItem drawLabel:NO inRect:r];
previousState = itemState;
} previousRect = r;
previousState = itemState;
}
if (i == howMany-1) { if (i == howMany-1)
iP.x += s.width + 13; {
iP.x += s.width + 13;
if ([anItem tabState] == NSSelectedTab) if ([anItem tabState] == NSSelectedTab)
[[NSImage imageNamed:@"common_TabDownSelectedRight.tiff"] [[NSImage imageNamed:@"common_TabDownSelectedRight.tiff"]
compositeToPoint:iP operation: NSCompositeSourceOver]; compositeToPoint:iP operation: NSCompositeSourceOver];
else if ([anItem tabState] == NSBackgroundTab) else if ([anItem tabState] == NSBackgroundTab)
[[NSImage imageNamed:@"common_TabDownUnSelectedRight.tiff"] {
compositeToPoint:iP operation: NSCompositeSourceOver]; // iP.y += 1;
else [[NSImage imageNamed:@"common_TabDownUnSelectedRight.tiff"]
NSLog(@"Not finished yet. Luff ya.\n"); compositeToPoint:iP operation: NSCompositeSourceOver];
} // iP.y -= 1;
}
else
NSLog(@"Not finished yet. Luff ya.\n");
}
}
} }
return; else if (tab_type == NSTopTabsBezelBorder)
} {
for (i=0;i<howMany;i++)
{
// where da tab be at?
NSSize s;
NSRect r;
NSPoint iP;
NSTabViewItem *anItem = [tab_items objectAtIndex:i];
NSTabState itemState;
itemState = [anItem tabState];
s = [anItem sizeOfLabel:NO];
if (i == 0)
{
iP.x = rect.origin.x;
iP.y = rect.size.height;
if (itemState == NSSelectedTab)
{
iP.y -= 1;
[[NSImage imageNamed:@"common_TabSelectedLeft.tiff"]
compositeToPoint:iP operation: NSCompositeSourceOver];
}
else if (itemState == NSBackgroundTab)
[[NSImage imageNamed:@"common_TabUnSelectedLeft.tiff"]
compositeToPoint:iP operation: NSCompositeSourceOver];
else
NSLog(@"Not finished yet. Luff ya.\n");
for (i=0;i<howMany;i++) { r.origin.x = rect.origin.x + 13;
// where da tab be at? r.origin.y = rect.size.height;
NSSize s; r.size.width = s.width;
NSRect r; r.size.height = 15;
NSPoint iP;
NSTabViewItem *anItem = [tab_items objectAtIndex:i]; DPSsetlinewidth(ctxt,1);
NSTabState itemState; DPSsetgray(ctxt,1);
DPSmoveto(ctxt, r.origin.x, r.origin.y+16);
DPSrlineto(ctxt, r.size.width, 0);
DPSstroke(ctxt);
[anItem drawLabel:NO inRect:r];
previousRect = r;
previousState = itemState;
} else {
iP.x = previousRect.origin.x + previousRect.size.width;
iP.y = rect.size.height;
itemState = [anItem tabState]; if (itemState == NSSelectedTab)
{
iP.y -= 1;
[[NSImage imageNamed:@"common_TabUnSelectToSelectedJunction.tiff"]
compositeToPoint:iP operation: NSCompositeSourceOver];
}
else if (itemState == NSBackgroundTab)
{
if (previousState == NSSelectedTab)
{
iP.y -= 1;
[[NSImage imageNamed:@"common_TabSelectedToUnSelectedJunction.tiff"]
compositeToPoint:iP operation: NSCompositeSourceOver];
iP.y += 1;
} else {
[[NSImage imageNamed:@"common_TabUnSelectedJunction.tiff"]
compositeToPoint:iP operation: NSCompositeSourceOver];
}
}
else
NSLog(@"Not finished yet. Luff ya.\n");
s = [anItem sizeOfLabel:NO]; r.origin.x = iP.x + 13;
r.origin.y = rect.size.height;
r.size.width = s.width;
r.size.height = 15;
if (i == 0) { DPSsetlinewidth(ctxt,1);
DPSsetgray(ctxt,1);
DPSmoveto(ctxt, r.origin.x, r.origin.y+16);
DPSrlineto(ctxt, r.size.width, 0);
DPSstroke(ctxt);
[anItem drawLabel:NO inRect:r];
previousRect = r;
previousState = itemState;
}
iP.x = rect.origin.x; if (i == howMany-1)
iP.y = rect.size.height; {
iP.x += s.width + 13;
if (itemState == NSSelectedTab) {
iP.y -= 1; if ([anItem tabState] == NSSelectedTab)
[[NSImage imageNamed:@"common_TabSelectedLeft.tiff"] [[NSImage imageNamed:@"common_TabSelectedRight.tiff"]
compositeToPoint:iP operation: NSCompositeSourceOver]; compositeToPoint:iP operation: NSCompositeSourceOver];
} else if ([anItem tabState] == NSBackgroundTab)
else if (itemState == NSBackgroundTab) [[NSImage imageNamed:@"common_TabUnSelectedRight.tiff"]
[[NSImage imageNamed:@"common_TabUnSelectedLeft.tiff"] compositeToPoint:iP operation: NSCompositeSourceOver];
compositeToPoint:iP operation: NSCompositeSourceOver]; else
else NSLog(@"Not finished yet. Luff ya.\n");
NSLog(@"Not finished yet. Luff ya.\n"); }
}
r.origin.x = rect.origin.x + 13;
r.origin.y = rect.size.height;
r.size.width = s.width;
r.size.height = 15;
DPSsetlinewidth(ctxt,1);
DPSsetgray(ctxt,1);
DPSmoveto(ctxt, r.origin.x, r.origin.y+16);
DPSrlineto(ctxt, r.size.width, 0);
DPSstroke(ctxt);
[anItem drawLabel:NO inRect:r];
previousRect = r;
previousState = itemState;
} else {
iP.x = previousRect.origin.x + previousRect.size.width;
iP.y = rect.size.height;
if (itemState == NSSelectedTab) {
iP.y -= 1;
[[NSImage imageNamed:@"common_TabUnSelectToSelectedJunction.tiff"]
compositeToPoint:iP operation: NSCompositeSourceOver];
}
else if (itemState == NSBackgroundTab) {
if (previousState == NSSelectedTab) {
iP.y -= 1;
[[NSImage imageNamed:@"common_TabSelectedToUnSelectedJunction.tiff"]
compositeToPoint:iP operation: NSCompositeSourceOver];
iP.y += 1;
} else {
[[NSImage imageNamed:@"common_TabUnSelectedJunction.tiff"]
compositeToPoint:iP operation: NSCompositeSourceOver];
}
}
else
NSLog(@"Not finished yet. Luff ya.\n");
r.origin.x = iP.x + 13;
r.origin.y = rect.size.height;
r.size.width = s.width;
r.size.height = 15;
DPSsetlinewidth(ctxt,1);
DPSsetgray(ctxt,1);
DPSmoveto(ctxt, r.origin.x, r.origin.y+16);
DPSrlineto(ctxt, r.size.width, 0);
DPSstroke(ctxt);
[anItem drawLabel:NO inRect:r];
previousRect = r;
previousState = itemState;
}
if (i == howMany-1) {
iP.x += s.width + 13;
if ([anItem tabState] == NSSelectedTab)
[[NSImage imageNamed:@"common_TabSelectedRight.tiff"]
compositeToPoint:iP operation: NSCompositeSourceOver];
else if ([anItem tabState] == NSBackgroundTab)
[[NSImage imageNamed:@"common_TabUnSelectedRight.tiff"]
compositeToPoint:iP operation: NSCompositeSourceOver];
else
NSLog(@"Not finished yet. Luff ya.\n");
} }
}
DPSgrestore(ctxt); DPSgrestore(ctxt);
} }
@ -539,7 +569,9 @@ imageNamed:@"common_TabDownUnSelectedJunction.tiff"]
[self selectTabViewItem:anItem]; [self selectTabViewItem:anItem];
} }
[self setNeedsDisplay:YES]; // [self setNeedsDisplay:YES];
[window update];
return [super hitTest:aPoint]; return [super hitTest:aPoint];
} }

View file

@ -939,12 +939,23 @@ container, returning the modified location. */
[textStorage replaceCharactersInRange:[self selectedRange] [textStorage replaceCharactersInRange:[self selectedRange]
withAttributedString:(NSAttributedString *)aString]; withAttributedString:(NSAttributedString *)aString];
[self sizeToFit]; // ScrollView interaction
[self setSelectedRange:NSMakeRange([self [self setSelectedRange:NSMakeRange([self
selectedRange].location+[aString length],0)]; selectedRange].location+[aString length],0)];
[self display];
[window update];
[self textDidChange: nil]; // broadcast notification
NSLog(@"%@", [textStorage string]); NSLog(@"%@", [textStorage string]);
} }
- (void)sizeToFit
{
NSLog(@"sizeToFit called.\n");
}
- (void)drawRect:(NSRect)aRect - (void)drawRect:(NSRect)aRect
{ {
if(tv_backGroundColor) if(tv_backGroundColor)