Merge Source/NSMenu.m - reformat Source/NSLayoutManager.m

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/branches/gnustep_testplant_branch@38731 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
Marcian Lytwyn 2015-07-01 19:40:11 +00:00
parent 2a41972a78
commit 03f5d6b879
2 changed files with 27 additions and 20 deletions

View file

@ -883,35 +883,37 @@ has the same y origin and height as the line frag rect it is in.
glyph_index = [self numberOfGlyphs] - 1; glyph_index = [self numberOfGlyphs] - 1;
if (glyph_index == (unsigned int)-1) if (glyph_index == (unsigned int)-1)
{ /* No information is available. Get default font height. */ { /* No information is available. Get default font height. */
NSFont *f = [_typingAttributes objectForKey:NSFontAttributeName]; NSFont *f = [_typingAttributes objectForKey:NSFontAttributeName];
/* will be -1 if there are no text containers */ /* will be -1 if there are no text containers */
*textContainer = num_textcontainers - 1; *textContainer = num_textcontainers - 1;
r = NSMakeRect(0, 0, 1, [f boundingRectForFont].size.height); r = NSMakeRect(0, 0, 1, [f boundingRectForFont].size.height);
if (num_textcontainers > 0) if (num_textcontainers > 0)
{ {
NSParagraphStyle *paragraph = [_typingAttributes objectForKey: NSParagraphStyleAttributeName]; NSParagraphStyle *paragraph = [_typingAttributes objectForKey: NSParagraphStyleAttributeName];
NSTextAlignment alignment = [paragraph alignment]; NSTextAlignment alignment = [paragraph alignment];
tc = textcontainers + num_textcontainers - 1; tc = textcontainers + num_textcontainers - 1;
r.origin.x += [tc->textContainer lineFragmentPadding]; r.origin.x += [tc->textContainer lineFragmentPadding];
// Apply left/right/center justification... // Apply left/right/center justification...
if (alignment == NSRightTextAlignment) if (alignment == NSRightTextAlignment)
{ {
r.origin.x += [tc->textContainer containerSize].width; r.origin.x += [tc->textContainer containerSize].width;
} }
else if (alignment == NSCenterTextAlignment) else if (alignment == NSCenterTextAlignment)
{ {
r.origin.x += [tc->textContainer containerSize].width / 2; r.origin.x += [tc->textContainer containerSize].width / 2;
} }
} }
return r; return r;
} }
fraction_through = 1.0; fraction_through = 1.0;
} }
else else
[self _doLayoutToGlyph: glyph_index]; {
[self _doLayoutToGlyph: glyph_index];
}
for (tc = textcontainers, i = 0; i < num_textcontainers; i++, tc++) for (tc = textcontainers, i = 0; i < num_textcontainers; i++, tc++)
if (tc->pos + tc->length > glyph_index) if (tc->pos + tc->length > glyph_index)

View file

@ -503,7 +503,8 @@ static BOOL menuBarVisible = YES;
if ((_aWindow != nil) && ([_aWindow screen] != nil)) if ((_aWindow != nil) && ([_aWindow screen] != nil))
{ {
origin = NSMakePoint(0, [[_aWindow screen] visibleFrame].size.height - [_aWindow frame].size.height); origin = NSMakePoint(0, [[_aWindow screen] visibleFrame].size.height
- [_aWindow frame].size.height);
[_aWindow setFrameOrigin: origin]; [_aWindow setFrameOrigin: origin];
[_bWindow setFrameOrigin: origin]; [_bWindow setFrameOrigin: origin];
@ -831,6 +832,7 @@ static BOOL menuBarVisible = YES;
[self menuChanged]; [self menuChanged];
} }
// Testplant-MAL-2015-07-01: Using testplant branch code...
- (void) removeAllItems - (void) removeAllItems
{ {
[_items makeObjectsPerformSelector:@selector(setMenu:) withObject:nil]; [_items makeObjectsPerformSelector:@selector(setMenu:) withObject:nil];
@ -902,7 +904,7 @@ static BOOL menuBarVisible = YES;
return nil; return nil;
} }
- (id <NSMenuItem>) itemAtIndex: (NSInteger)index - (NSMenuItem *) itemAtIndex: (NSInteger)index
{ {
if (index >= [_items count] || index < 0) if (index >= [_items count] || index < 0)
[NSException raise: NSRangeException [NSException raise: NSRangeException
@ -1093,6 +1095,7 @@ static BOOL menuBarVisible = YES;
- (void) update - (void) update
{ {
// Testplant-MAL-2015-07-01: Stop potential recursive invocation...
if (_menu.isUpdating == NO) if (_menu.isUpdating == NO)
{ {
_menu.isUpdating = YES; _menu.isUpdating = YES;
@ -1243,6 +1246,7 @@ static BOOL menuBarVisible = YES;
} }
} }
// Testplant-MAL-2015-07-01: Stop potential recursive invocation...
_menu.isUpdating = NO; _menu.isUpdating = NO;
} }
@ -1508,6 +1512,7 @@ static BOOL menuBarVisible = YES;
return _menu.changedMessagesEnabled; return _menu.changedMessagesEnabled;
} }
// Testplant-MAL-2015-07-01: Using testplant branch code...
- (NSSize) size - (NSSize) size
{ {
if (_view) if (_view)
@ -1585,10 +1590,10 @@ static BOOL menuBarVisible = YES;
forView: (NSView *)view forView: (NSView *)view
withFont: (NSFont *)font withFont: (NSFont *)font
{ {
// Testplant-MAL-2015-07-01: Using tetplant branch code...
NSPoint point = [view frame].origin; NSPoint point = [view frame].origin;
point = [[view superview] convertPoint:point toView:nil]; point = [[view superview] convertPoint:point toView:nil];
point = [[view window] convertBaseToScreen: point]; point = [[view window] convertBaseToScreen: point];
// [[menu window] setFrameOrigin:point];
[menu _rightMouseDisplay: event]; [menu _rightMouseDisplay: event];
} }