Skip to content

Commit dd77caa

Browse files
author
Hans-Jörg Bibiko
committed
• fixed some layout issues
• 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
1 parent de9817f commit dd77caa

File tree

8 files changed

+64
-58
lines changed

8 files changed

+64
-58
lines changed

English.lproj/EditorPrefPane.xib

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -175,7 +175,7 @@ AAMAAAABAAEAAAFTAAMAAAAEAAAFwgAAAAAACAAIAAgACAABAAEAAQABA</bytes>
175175
<object class="NSButton" id="467859425">
176176
<reference key="NSNextResponder" ref="16355349"/>
177177
<int key="NSvFlags">256</int>
178-
<string key="NSFrame">{{18, 291}, {224, 18}}</string>
178+
<string key="NSFrame">{{18, 291}, {242.47265625, 18}}</string>
179179
<reference key="NSSuperview" ref="16355349"/>
180180
<bool key="NSEnabled">YES</bool>
181181
<object class="NSButtonCell" key="NSCell" id="112392175">
@@ -198,7 +198,7 @@ AAMAAAABAAEAAAFTAAMAAAAEAAAFwgAAAAAACAAIAAgACAABAAEAAQABA</bytes>
198198
<object class="NSButton" id="857479191">
199199
<reference key="NSNextResponder" ref="16355349"/>
200200
<int key="NSvFlags">256</int>
201-
<string key="NSFrame">{{18, 218}, {224, 18}}</string>
201+
<string key="NSFrame">{{18, 218}, {242.47265625, 18}}</string>
202202
<reference key="NSSuperview" ref="16355349"/>
203203
<bool key="NSEnabled">YES</bool>
204204
<object class="NSButtonCell" key="NSCell" id="607892952">
@@ -219,7 +219,7 @@ AAMAAAABAAEAAAFTAAMAAAAEAAAFwgAAAAAACAAIAAgACAABAAEAAQABA</bytes>
219219
<object class="NSButton" id="598267823">
220220
<reference key="NSNextResponder" ref="16355349"/>
221221
<int key="NSvFlags">256</int>
222-
<string key="NSFrame">{{18, 167}, {224, 18}}</string>
222+
<string key="NSFrame">{{18, 167}, {233.15625, 18}}</string>
223223
<reference key="NSSuperview" ref="16355349"/>
224224
<bool key="NSEnabled">YES</bool>
225225
<object class="NSButtonCell" key="NSCell" id="507616695">
@@ -240,7 +240,7 @@ AAMAAAABAAEAAAFTAAMAAAAEAAAFwgAAAAAACAAIAAgACAABAAEAAQABA</bytes>
240240
<object class="NSButton" id="542486847">
241241
<reference key="NSNextResponder" ref="16355349"/>
242242
<int key="NSvFlags">256</int>
243-
<string key="NSFrame">{{18, 147}, {224, 18}}</string>
243+
<string key="NSFrame">{{18, 147}, {233.15625, 18}}</string>
244244
<reference key="NSSuperview" ref="16355349"/>
245245
<bool key="NSEnabled">YES</bool>
246246
<object class="NSButtonCell" key="NSCell" id="375630071">
@@ -261,7 +261,7 @@ AAMAAAABAAEAAAFTAAMAAAAEAAAFwgAAAAAACAAIAAgACAABAAEAAQABA</bytes>
261261
<object class="NSButton" id="522909206">
262262
<reference key="NSNextResponder" ref="16355349"/>
263263
<int key="NSvFlags">256</int>
264-
<string key="NSFrame">{{18, 99}, {213, 18}}</string>
264+
<string key="NSFrame">{{18, 99}, {237.15625, 18}}</string>
265265
<reference key="NSSuperview" ref="16355349"/>
266266
<bool key="NSEnabled">YES</bool>
267267
<object class="NSButtonCell" key="NSCell" id="583581786">
@@ -286,7 +286,7 @@ AAMAAAABAAEAAAFTAAMAAAAEAAAFwgAAAAAACAAIAAgACAABAAEAAQABA</bytes>
286286
<object class="NSButton" id="86182398">
287287
<reference key="NSNextResponder" ref="16355349"/>
288288
<int key="NSvFlags">256</int>
289-
<string key="NSFrame">{{18, 238}, {224, 18}}</string>
289+
<string key="NSFrame">{{18, 238}, {242.47265625, 18}}</string>
290290
<reference key="NSSuperview" ref="16355349"/>
291291
<bool key="NSEnabled">YES</bool>
292292
<object class="NSButtonCell" key="NSCell" id="805682697">
@@ -307,7 +307,7 @@ AAMAAAABAAEAAAFTAAMAAAAEAAAFwgAAAAAACAAIAAgACAABAAEAAQABA</bytes>
307307
<object class="NSButton" id="954429201">
308308
<reference key="NSNextResponder" ref="16355349"/>
309309
<int key="NSvFlags">268</int>
310-
<string key="NSFrame">{{18, 271}, {224, 18}}</string>
310+
<string key="NSFrame">{{18, 271}, {242.47265625, 18}}</string>
311311
<reference key="NSSuperview" ref="16355349"/>
312312
<bool key="NSEnabled">YES</bool>
313313
<object class="NSButtonCell" key="NSCell" id="480889402">
@@ -329,7 +329,7 @@ AAMAAAABAAEAAAFTAAMAAAAEAAAFwgAAAAAACAAIAAgACAABAAEAAQABA</bytes>
329329
<object class="NSButton" id="909633476">
330330
<reference key="NSNextResponder" ref="16355349"/>
331331
<int key="NSvFlags">268</int>
332-
<string key="NSFrame">{{18, 127}, {213, 18}}</string>
332+
<string key="NSFrame">{{18, 127}, {242.47265625, 18}}</string>
333333
<reference key="NSSuperview" ref="16355349"/>
334334
<bool key="NSEnabled">YES</bool>
335335
<object class="NSButtonCell" key="NSCell" id="590715081">
@@ -455,7 +455,7 @@ AAMAAAABAAEAAAFTAAMAAAAEAAAFwgAAAAAACAAIAAgACAABAAEAAQABA</bytes>
455455
<object class="NSButton" id="601854215">
456456
<reference key="NSNextResponder" ref="16355349"/>
457457
<int key="NSvFlags">268</int>
458-
<string key="NSFrame">{{18, 70}, {213, 18}}</string>
458+
<string key="NSFrame">{{18, 70}, {242.47265625, 18}}</string>
459459
<reference key="NSSuperview" ref="16355349"/>
460460
<bool key="NSEnabled">YES</bool>
461461
<object class="NSButtonCell" key="NSCell" id="749916913">
@@ -1489,7 +1489,7 @@ AAMAAAABAAEAAAFTAAMAAAAEAAAFwgAAAAAACAAIAAgACAABAAEAAQABA</bytes>
14891489
<boolean value="YES"/>
14901490
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
14911491
<boolean value="YES"/>
1492-
<string>{{395, 340}, {583, 416}}</string>
1492+
<string>{{225, 170}, {583, 416}}</string>
14931493
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
14941494
<boolean value="YES"/>
14951495
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>

RController.m

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -350,7 +350,7 @@ - (void) awakeFromNib {
350350
[attr setDictionary:[consoleTextView selectedTextAttributes]];
351351
[attr setObject:[Preferences unarchivedObjectForKey:selectionColorKey withDefault:[NSColor colorWithCalibratedRed:0.71f green:0.835f blue:1.0f alpha:1.0f]] forKey:NSBackgroundColorAttributeName];
352352
[consoleTextView setSelectedTextAttributes:attr];
353-
[consoleTextView setNeedsDisplayInRect:[consoleTextView bounds]];
353+
[consoleTextView setNeedsDisplayInRect:[consoleTextView visibleRect]];
354354

355355
NSLayoutManager *lm = [[consoleTextView layoutManager] retain];
356356
#if MAC_OS_X_VERSION_MIN_REQUIRED >= MAC_OS_X_VERSION_10_5

RDocumentWinCtrl.m

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1143,7 +1143,7 @@ - (BOOL)textView:(NSTextView *)textViewSrc doCommandBySelector:(SEL)commandSelec
11431143
}
11441144
}
11451145

1146-
[textView setNeedsDisplayInRect:[textView frame]];
1146+
// [textView setNeedsDisplayInRect:[textView frame]];
11471147
return YES;
11481148
}
11491149
}
@@ -1327,7 +1327,7 @@ - (void)textViewDidChangeSelection:(NSNotification *)aNotification
13271327
#endif
13281328

13291329
if([[NSUserDefaults standardUserDefaults] boolForKey:highlightCurrentLine])
1330-
[tv setNeedsDisplayInRect:[tv bounds] avoidAdditionalLayout:YES];
1330+
[tv setNeedsDisplayInRect:[tv visibleRect] avoidAdditionalLayout:NO];
13311331

13321332
// Adjust cursor position if cursor is inside of a folded text chunk;
13331333
// additional checks were made in [RScriptEditorTextView:setSelectedRanges:]

RScriptEditorLayoutManager.m

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ - (id)init
5757
[self setGlyphGenerator:glyphGenerator];
5858
[glyphGenerator release];
5959

60-
[self setBackgroundLayoutEnabled:YES];
60+
[self setBackgroundLayoutEnabled:NO];
6161

6262
return self;
6363

RScriptEditorTextView.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,8 @@
112112
- (BOOL)unfoldLinesContainingCharacterAtIndex:(NSUInteger)charIndex;
113113
- (NSInteger)foldStatusAtIndex:(NSInteger)index;
114114

115+
- (id)scrollView;
116+
115117
- (void)updatePreferences;
116118

117119
@end

RScriptEditorTextView.m

Lines changed: 23 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -357,13 +357,18 @@ - (void)dealloc {
357357

358358
}
359359

360+
- (id)scrollView
361+
{
362+
return scrollView;
363+
}
364+
360365
- (void)setNonSyntaxHighlighting
361366
{
362367
[theTextStorage removeAttribute:NSForegroundColorAttributeName range:NSMakeRange(0, [[theTextStorage string] length])];
363368
[theTextStorage removeAttribute:NSBackgroundColorAttributeName range:NSMakeRange(0, [[theTextStorage string] length])];
364369
[self setTextColor:[NSColor blackColor]];
365370
[self setInsertionPointColor:[NSColor blackColor]];
366-
[self setNeedsDisplayInRect:[self bounds]];
371+
[self setNeedsDisplayInRect:[self visibleRect]];
367372
}
368373

369374
/**
@@ -426,7 +431,7 @@ - (void)observeValueForKeyPath:(NSString *)keyPath ofObject:(id)object change:(N
426431
if(shColorCursor) [shColorCursor release];
427432
shColorCursor = [[NSUnarchiver unarchiveObjectWithData:[change objectForKey:NSKeyValueChangeNewKey]] retain];
428433
[self setInsertionPointColor:shColorCursor];
429-
[self setNeedsDisplayInRect:[self bounds]];
434+
[self setNeedsDisplayInRect:[self visibleRect]];
430435
} else if ([keyPath isEqualToString:identifierSyntaxColorKey]) {
431436
if(shColorIdentifier) [shColorIdentifier release];
432437
shColorIdentifier = [[NSUnarchiver unarchiveObjectWithData:[change objectForKey:NSKeyValueChangeNewKey]] retain];
@@ -435,18 +440,18 @@ - (void)observeValueForKeyPath:(NSString *)keyPath ofObject:(id)object change:(N
435440
} else if ([keyPath isEqualToString:editorBackgroundColorKey]) {
436441
if(shColorBackground) [shColorBackground release];
437442
shColorBackground = [[NSUnarchiver unarchiveObjectWithData:[change objectForKey:NSKeyValueChangeNewKey]] retain];
438-
[self setNeedsDisplayInRect:[self bounds]];
443+
[self setNeedsDisplayInRect:[self visibleRect]];
439444
} else if ([keyPath isEqualToString:editorCurrentLineBackgroundColorKey]) {
440445
if(shColorCurrentLine) [shColorCurrentLine release];
441446
shColorCurrentLine = [[NSUnarchiver unarchiveObjectWithData:[change objectForKey:NSKeyValueChangeNewKey]] retain];
442-
[self setNeedsDisplayInRect:[self bounds]];
447+
[self setNeedsDisplayInRect:[self visibleRect]];
443448
} else if ([keyPath isEqualToString:editorSelectionBackgroundColorKey]) {
444449
NSColor *c = [[NSUnarchiver unarchiveObjectWithData:[change objectForKey:NSKeyValueChangeNewKey]] retain];
445450
NSMutableDictionary *attr = [NSMutableDictionary dictionary];
446451
[attr setDictionary:[self selectedTextAttributes]];
447452
[attr setObject:c forKey:NSBackgroundColorAttributeName];
448453
[self setSelectedTextAttributes:attr];
449-
[self setNeedsDisplayInRect:[self bounds]];
454+
[self setNeedsDisplayInRect:[self visibleRect]];
450455

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

488493
} else if ([keyPath isEqualToString:highlightCurrentLine]) {
489-
[self setNeedsDisplayInRect:[self bounds]];
494+
[self setNeedsDisplayInRect:[self visibleRect]];
490495

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

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

503508
lineWrappingEnabled = [Preferences flagForKey:enableLineWrappingKey withDefault: YES];
504-
509+
505510
NSSize contentSize = [scrollView contentSize];
506511
NSTextContainer *textContainer = [self textContainer];
507-
512+
508513
// [self setMinSize:contentSize];
509-
514+
510515
if (lineWrappingEnabled) {
511516
[scrollView setHasHorizontalScroller:YES];
512517
[textContainer setContainerSize:NSMakeSize(contentSize.width, CGFLOAT_MAX)];
@@ -520,7 +525,7 @@ - (void)updateLineWrappingMode
520525
[self setHorizontallyResizable:YES];
521526
[(NoodleLineNumberView*)[[self enclosingScrollView] verticalRulerView] setLineWrappingMode:NO];
522527
}
523-
528+
524529
[[[self enclosingScrollView] verticalRulerView] performSelector:@selector(refresh) withObject:nil afterDelay:0.0f];
525530

526531
// NSSize layoutSize;
@@ -716,7 +721,7 @@ - (void)doSyntaxHighlighting
716721
// by considering entire lines).
717722

718723
// Get the text range currently displayed in the view port
719-
NSRect visibleRect = [scrollView documentVisibleRect];
724+
NSRect visibleRect = [self visibleRect];
720725
NSRange visibleRange = [[self layoutManager] glyphRangeForBoundingRectWithoutAdditionalLayout:visibleRect inTextContainer:[self textContainer]];
721726

722727
if(!visibleRange.length) {
@@ -864,11 +869,11 @@ - (void)doSyntaxHighlighting
864869
if(breakSyntaxHighlighting) {
865870

866871
// Cancel calling doSyntaxHighlighting
867-
[NSObject cancelPreviousPerformRequestsWithTarget:self
868-
selector:@selector(doSyntaxHighlighting)
869-
object:nil];
870-
871-
[self performSelector:@selector(doSyntaxHighlighting) withObject:nil afterDelay:0.15f];
872+
// [NSObject cancelPreviousPerformRequestsWithTarget:self
873+
// selector:@selector(doSyntaxHighlighting)
874+
// object:nil];
875+
//
876+
// [self performSelector:@selector(doSyntaxHighlighting) withObject:nil afterDelay:0.15f];
872877

873878
breakSyntaxHighlighting = 0;
874879
break;
@@ -892,8 +897,7 @@ - (void)doSyntaxHighlighting
892897

893898
[theTextStorage endEditing];
894899
isSyntaxHighlighting = NO;
895-
896-
[self setNeedsDisplayInRect:[self bounds]];
900+
[self setNeedsDisplayInRect:visibleRect];
897901

898902
}
899903

RTextView.m

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1569,7 +1569,7 @@ - (void)endSnippetSession
15691569
snippetWasJustInserted = NO;
15701570

15711571
// remove all snippet frames
1572-
[self setNeedsDisplayInRect:[self bounds] avoidAdditionalLayout:NO];
1572+
[self setNeedsDisplayInRect:[self visibleRect] avoidAdditionalLayout:NO];
15731573

15741574
}
15751575

0 commit comments

Comments
 (0)