Skip to content

Commit

Permalink
• fixed some layout issues
Browse files Browse the repository at this point in the history
• increased layout speed
• fixed width for German's Editor Preferences

git-svn-id: https://svn.r-project.org/R-packages/trunk/Mac-GUI@6240 694ef91d-65df-0310-b7bb-92e67a308ead
  • Loading branch information
Hans-Jörg Bibiko committed Aug 25, 2012
1 parent de9817f commit dd77caa
Show file tree
Hide file tree
Showing 8 changed files with 64 additions and 58 deletions.
20 changes: 10 additions & 10 deletions English.lproj/EditorPrefPane.xib
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@ AAMAAAABAAEAAAFTAAMAAAAEAAAFwgAAAAAACAAIAAgACAABAAEAAQABA</bytes>
<object class="NSButton" id="467859425">
<reference key="NSNextResponder" ref="16355349"/>
<int key="NSvFlags">256</int>
<string key="NSFrame">{{18, 291}, {224, 18}}</string>
<string key="NSFrame">{{18, 291}, {242.47265625, 18}}</string>
<reference key="NSSuperview" ref="16355349"/>
<bool key="NSEnabled">YES</bool>
<object class="NSButtonCell" key="NSCell" id="112392175">
Expand All @@ -198,7 +198,7 @@ AAMAAAABAAEAAAFTAAMAAAAEAAAFwgAAAAAACAAIAAgACAABAAEAAQABA</bytes>
<object class="NSButton" id="857479191">
<reference key="NSNextResponder" ref="16355349"/>
<int key="NSvFlags">256</int>
<string key="NSFrame">{{18, 218}, {224, 18}}</string>
<string key="NSFrame">{{18, 218}, {242.47265625, 18}}</string>
<reference key="NSSuperview" ref="16355349"/>
<bool key="NSEnabled">YES</bool>
<object class="NSButtonCell" key="NSCell" id="607892952">
Expand All @@ -219,7 +219,7 @@ AAMAAAABAAEAAAFTAAMAAAAEAAAFwgAAAAAACAAIAAgACAABAAEAAQABA</bytes>
<object class="NSButton" id="598267823">
<reference key="NSNextResponder" ref="16355349"/>
<int key="NSvFlags">256</int>
<string key="NSFrame">{{18, 167}, {224, 18}}</string>
<string key="NSFrame">{{18, 167}, {233.15625, 18}}</string>
<reference key="NSSuperview" ref="16355349"/>
<bool key="NSEnabled">YES</bool>
<object class="NSButtonCell" key="NSCell" id="507616695">
Expand All @@ -240,7 +240,7 @@ AAMAAAABAAEAAAFTAAMAAAAEAAAFwgAAAAAACAAIAAgACAABAAEAAQABA</bytes>
<object class="NSButton" id="542486847">
<reference key="NSNextResponder" ref="16355349"/>
<int key="NSvFlags">256</int>
<string key="NSFrame">{{18, 147}, {224, 18}}</string>
<string key="NSFrame">{{18, 147}, {233.15625, 18}}</string>
<reference key="NSSuperview" ref="16355349"/>
<bool key="NSEnabled">YES</bool>
<object class="NSButtonCell" key="NSCell" id="375630071">
Expand All @@ -261,7 +261,7 @@ AAMAAAABAAEAAAFTAAMAAAAEAAAFwgAAAAAACAAIAAgACAABAAEAAQABA</bytes>
<object class="NSButton" id="522909206">
<reference key="NSNextResponder" ref="16355349"/>
<int key="NSvFlags">256</int>
<string key="NSFrame">{{18, 99}, {213, 18}}</string>
<string key="NSFrame">{{18, 99}, {237.15625, 18}}</string>
<reference key="NSSuperview" ref="16355349"/>
<bool key="NSEnabled">YES</bool>
<object class="NSButtonCell" key="NSCell" id="583581786">
Expand All @@ -286,7 +286,7 @@ AAMAAAABAAEAAAFTAAMAAAAEAAAFwgAAAAAACAAIAAgACAABAAEAAQABA</bytes>
<object class="NSButton" id="86182398">
<reference key="NSNextResponder" ref="16355349"/>
<int key="NSvFlags">256</int>
<string key="NSFrame">{{18, 238}, {224, 18}}</string>
<string key="NSFrame">{{18, 238}, {242.47265625, 18}}</string>
<reference key="NSSuperview" ref="16355349"/>
<bool key="NSEnabled">YES</bool>
<object class="NSButtonCell" key="NSCell" id="805682697">
Expand All @@ -307,7 +307,7 @@ AAMAAAABAAEAAAFTAAMAAAAEAAAFwgAAAAAACAAIAAgACAABAAEAAQABA</bytes>
<object class="NSButton" id="954429201">
<reference key="NSNextResponder" ref="16355349"/>
<int key="NSvFlags">268</int>
<string key="NSFrame">{{18, 271}, {224, 18}}</string>
<string key="NSFrame">{{18, 271}, {242.47265625, 18}}</string>
<reference key="NSSuperview" ref="16355349"/>
<bool key="NSEnabled">YES</bool>
<object class="NSButtonCell" key="NSCell" id="480889402">
Expand All @@ -329,7 +329,7 @@ AAMAAAABAAEAAAFTAAMAAAAEAAAFwgAAAAAACAAIAAgACAABAAEAAQABA</bytes>
<object class="NSButton" id="909633476">
<reference key="NSNextResponder" ref="16355349"/>
<int key="NSvFlags">268</int>
<string key="NSFrame">{{18, 127}, {213, 18}}</string>
<string key="NSFrame">{{18, 127}, {242.47265625, 18}}</string>
<reference key="NSSuperview" ref="16355349"/>
<bool key="NSEnabled">YES</bool>
<object class="NSButtonCell" key="NSCell" id="590715081">
Expand Down Expand Up @@ -455,7 +455,7 @@ AAMAAAABAAEAAAFTAAMAAAAEAAAFwgAAAAAACAAIAAgACAABAAEAAQABA</bytes>
<object class="NSButton" id="601854215">
<reference key="NSNextResponder" ref="16355349"/>
<int key="NSvFlags">268</int>
<string key="NSFrame">{{18, 70}, {213, 18}}</string>
<string key="NSFrame">{{18, 70}, {242.47265625, 18}}</string>
<reference key="NSSuperview" ref="16355349"/>
<bool key="NSEnabled">YES</bool>
<object class="NSButtonCell" key="NSCell" id="749916913">
Expand Down Expand Up @@ -1489,7 +1489,7 @@ AAMAAAABAAEAAAFTAAMAAAAEAAAFwgAAAAAACAAIAAgACAABAAEAAQABA</bytes>
<boolean value="YES"/>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<boolean value="YES"/>
<string>{{395, 340}, {583, 416}}</string>
<string>{{225, 170}, {583, 416}}</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<boolean value="YES"/>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
Expand Down
2 changes: 1 addition & 1 deletion RController.m
Original file line number Diff line number Diff line change
Expand Up @@ -350,7 +350,7 @@ - (void) awakeFromNib {
[attr setDictionary:[consoleTextView selectedTextAttributes]];
[attr setObject:[Preferences unarchivedObjectForKey:selectionColorKey withDefault:[NSColor colorWithCalibratedRed:0.71f green:0.835f blue:1.0f alpha:1.0f]] forKey:NSBackgroundColorAttributeName];
[consoleTextView setSelectedTextAttributes:attr];
[consoleTextView setNeedsDisplayInRect:[consoleTextView bounds]];
[consoleTextView setNeedsDisplayInRect:[consoleTextView visibleRect]];

NSLayoutManager *lm = [[consoleTextView layoutManager] retain];
#if MAC_OS_X_VERSION_MIN_REQUIRED >= MAC_OS_X_VERSION_10_5
Expand Down
4 changes: 2 additions & 2 deletions RDocumentWinCtrl.m
Original file line number Diff line number Diff line change
Expand Up @@ -1143,7 +1143,7 @@ - (BOOL)textView:(NSTextView *)textViewSrc doCommandBySelector:(SEL)commandSelec
}
}

[textView setNeedsDisplayInRect:[textView frame]];
// [textView setNeedsDisplayInRect:[textView frame]];
return YES;
}
}
Expand Down Expand Up @@ -1327,7 +1327,7 @@ - (void)textViewDidChangeSelection:(NSNotification *)aNotification
#endif

if([[NSUserDefaults standardUserDefaults] boolForKey:highlightCurrentLine])
[tv setNeedsDisplayInRect:[tv bounds] avoidAdditionalLayout:YES];
[tv setNeedsDisplayInRect:[tv visibleRect] avoidAdditionalLayout:NO];

// Adjust cursor position if cursor is inside of a folded text chunk;
// additional checks were made in [RScriptEditorTextView:setSelectedRanges:]
Expand Down
2 changes: 1 addition & 1 deletion RScriptEditorLayoutManager.m
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ - (id)init
[self setGlyphGenerator:glyphGenerator];
[glyphGenerator release];

[self setBackgroundLayoutEnabled:YES];
[self setBackgroundLayoutEnabled:NO];

return self;

Expand Down
2 changes: 2 additions & 0 deletions RScriptEditorTextView.h
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,8 @@
- (BOOL)unfoldLinesContainingCharacterAtIndex:(NSUInteger)charIndex;
- (NSInteger)foldStatusAtIndex:(NSInteger)index;

- (id)scrollView;

- (void)updatePreferences;

@end
42 changes: 23 additions & 19 deletions RScriptEditorTextView.m
Original file line number Diff line number Diff line change
Expand Up @@ -357,13 +357,18 @@ - (void)dealloc {

}

- (id)scrollView
{
return scrollView;
}

- (void)setNonSyntaxHighlighting
{
[theTextStorage removeAttribute:NSForegroundColorAttributeName range:NSMakeRange(0, [[theTextStorage string] length])];
[theTextStorage removeAttribute:NSBackgroundColorAttributeName range:NSMakeRange(0, [[theTextStorage string] length])];
[self setTextColor:[NSColor blackColor]];
[self setInsertionPointColor:[NSColor blackColor]];
[self setNeedsDisplayInRect:[self bounds]];
[self setNeedsDisplayInRect:[self visibleRect]];
}

/**
Expand Down Expand Up @@ -426,7 +431,7 @@ - (void)observeValueForKeyPath:(NSString *)keyPath ofObject:(id)object change:(N
if(shColorCursor) [shColorCursor release];
shColorCursor = [[NSUnarchiver unarchiveObjectWithData:[change objectForKey:NSKeyValueChangeNewKey]] retain];
[self setInsertionPointColor:shColorCursor];
[self setNeedsDisplayInRect:[self bounds]];
[self setNeedsDisplayInRect:[self visibleRect]];
} else if ([keyPath isEqualToString:identifierSyntaxColorKey]) {
if(shColorIdentifier) [shColorIdentifier release];
shColorIdentifier = [[NSUnarchiver unarchiveObjectWithData:[change objectForKey:NSKeyValueChangeNewKey]] retain];
Expand All @@ -435,18 +440,18 @@ - (void)observeValueForKeyPath:(NSString *)keyPath ofObject:(id)object change:(N
} else if ([keyPath isEqualToString:editorBackgroundColorKey]) {
if(shColorBackground) [shColorBackground release];
shColorBackground = [[NSUnarchiver unarchiveObjectWithData:[change objectForKey:NSKeyValueChangeNewKey]] retain];
[self setNeedsDisplayInRect:[self bounds]];
[self setNeedsDisplayInRect:[self visibleRect]];
} else if ([keyPath isEqualToString:editorCurrentLineBackgroundColorKey]) {
if(shColorCurrentLine) [shColorCurrentLine release];
shColorCurrentLine = [[NSUnarchiver unarchiveObjectWithData:[change objectForKey:NSKeyValueChangeNewKey]] retain];
[self setNeedsDisplayInRect:[self bounds]];
[self setNeedsDisplayInRect:[self visibleRect]];
} else if ([keyPath isEqualToString:editorSelectionBackgroundColorKey]) {
NSColor *c = [[NSUnarchiver unarchiveObjectWithData:[change objectForKey:NSKeyValueChangeNewKey]] retain];
NSMutableDictionary *attr = [NSMutableDictionary dictionary];
[attr setDictionary:[self selectedTextAttributes]];
[attr setObject:c forKey:NSBackgroundColorAttributeName];
[self setSelectedTextAttributes:attr];
[self setNeedsDisplayInRect:[self bounds]];
[self setNeedsDisplayInRect:[self visibleRect]];

} else if ([keyPath isEqualToString:showSyntaxColoringKey]) {
syntaxHighlightingEnabled = [[change objectForKey:NSKeyValueChangeNewKey] boolValue];
Expand Down Expand Up @@ -486,11 +491,11 @@ - (void)observeValueForKeyPath:(NSString *)keyPath ofObject:(id)object change:(N
}

} else if ([keyPath isEqualToString:highlightCurrentLine]) {
[self setNeedsDisplayInRect:[self bounds]];
[self setNeedsDisplayInRect:[self visibleRect]];

} else if ([keyPath isEqualToString:RScriptEditorDefaultFont] && ![[[[self window] windowController] document] isRTF] && ![self selectedRange].length) {
[self setFont:[NSUnarchiver unarchiveObjectWithData:[change objectForKey:NSKeyValueChangeNewKey]]];
[self setNeedsDisplayInRect:[self bounds]];
[self setNeedsDisplayInRect:[self visibleRect]];

} else if ([keyPath isEqualToString:HighlightIntervalKey]) {
braceHighlightInterval = [Preferences floatForKey:HighlightIntervalKey withDefault:0.3f];
Expand All @@ -501,12 +506,12 @@ - (void)updateLineWrappingMode
{

lineWrappingEnabled = [Preferences flagForKey:enableLineWrappingKey withDefault: YES];

NSSize contentSize = [scrollView contentSize];
NSTextContainer *textContainer = [self textContainer];

// [self setMinSize:contentSize];

if (lineWrappingEnabled) {
[scrollView setHasHorizontalScroller:YES];
[textContainer setContainerSize:NSMakeSize(contentSize.width, CGFLOAT_MAX)];
Expand All @@ -520,7 +525,7 @@ - (void)updateLineWrappingMode
[self setHorizontallyResizable:YES];
[(NoodleLineNumberView*)[[self enclosingScrollView] verticalRulerView] setLineWrappingMode:NO];
}

[[[self enclosingScrollView] verticalRulerView] performSelector:@selector(refresh) withObject:nil afterDelay:0.0f];

// NSSize layoutSize;
Expand Down Expand Up @@ -716,7 +721,7 @@ - (void)doSyntaxHighlighting
// by considering entire lines).

// Get the text range currently displayed in the view port
NSRect visibleRect = [scrollView documentVisibleRect];
NSRect visibleRect = [self visibleRect];
NSRange visibleRange = [[self layoutManager] glyphRangeForBoundingRectWithoutAdditionalLayout:visibleRect inTextContainer:[self textContainer]];

if(!visibleRange.length) {
Expand Down Expand Up @@ -864,11 +869,11 @@ - (void)doSyntaxHighlighting
if(breakSyntaxHighlighting) {

// Cancel calling doSyntaxHighlighting
[NSObject cancelPreviousPerformRequestsWithTarget:self
selector:@selector(doSyntaxHighlighting)
object:nil];

[self performSelector:@selector(doSyntaxHighlighting) withObject:nil afterDelay:0.15f];
// [NSObject cancelPreviousPerformRequestsWithTarget:self
// selector:@selector(doSyntaxHighlighting)
// object:nil];
//
// [self performSelector:@selector(doSyntaxHighlighting) withObject:nil afterDelay:0.15f];

breakSyntaxHighlighting = 0;
break;
Expand All @@ -892,8 +897,7 @@ - (void)doSyntaxHighlighting

[theTextStorage endEditing];
isSyntaxHighlighting = NO;

[self setNeedsDisplayInRect:[self bounds]];
[self setNeedsDisplayInRect:visibleRect];

}

Expand Down
2 changes: 1 addition & 1 deletion RTextView.m
Original file line number Diff line number Diff line change
Expand Up @@ -1569,7 +1569,7 @@ - (void)endSnippetSession
snippetWasJustInserted = NO;

// remove all snippet frames
[self setNeedsDisplayInRect:[self bounds] avoidAdditionalLayout:NO];
[self setNeedsDisplayInRect:[self visibleRect] avoidAdditionalLayout:NO];

}

Expand Down
Loading

0 comments on commit dd77caa

Please sign in to comment.