- renamed clearAllWithColor to clearAll - clearAll now actually clears all (nothing happened before)

git-svn-id: http://macvim.googlecode.com/svn/trunk@297 96c4425d-ca35-0410-94e5-3396d5c13a8f
This commit is contained in:
Bjorn Winckler
2007-09-30 18:27:48 +00:00
parent a91326dc57
commit 44155c847f
4 changed files with 20 additions and 36 deletions
-2
View File
@@ -278,8 +278,6 @@ enum {
[drawData setLength:0];
[drawData appendBytes:&type length:sizeof(int)];
[drawData appendBytes:&defaultBackgroundColor length:sizeof(unsigned)];
}
- (void)clearBlockFromRow:(int)row1 column:(int)col1
+1 -1
View File
@@ -54,7 +54,7 @@
color:(NSColor *)color;
- (void)clearBlockFromRow:(int)row1 column:(int)col1 toRow:(int)row2
column:(int)col2 color:(NSColor *)color;
- (void)clearAllWithColor:(NSColor *)color;
- (void)clearAll;
- (void)setDefaultColorsBackground:(NSColor *)bgColor
foreground:(NSColor *)fgColor;
- (void)setFont:(NSFont *)newFont;
+18 -30
View File
@@ -25,7 +25,7 @@
@interface MMTextStorage (Private)
- (void)lazyResize;
- (void)lazyResize:(BOOL)force;
@end
@@ -194,8 +194,10 @@
withFlags:(int)flags foregroundColor:(NSColor *)fg
backgroundColor:(NSColor *)bg specialColor:(NSColor *)sp
{
//NSLog(@"replaceString:atRow:%d column:%d withFlags:%d", row, col, flags);
[self lazyResize];
//NSLog(@"replaceString:atRow:%d column:%d withFlags:%d "
// "foreground:%@ background:%@ special:%@",
// row, col, flags, fg, bg, sp);
[self lazyResize:NO];
// TODO: support DRAW_TRANSP
if (flags & DRAW_TRANSP)
@@ -264,8 +266,8 @@
scrollBottom:(int)bottom left:(int)left right:(int)right
color:(NSColor *)color
{
//NSLog(@"deleteLinesFromRow:%d lineCount:%d", row, count);
[self lazyResize];
//NSLog(@"deleteLinesFromRow:%d lineCount:%d color:%@", row, count, color);
[self lazyResize:NO];
if (row < 0 || row+count > maxRows) {
//NSLog(@"[%s] WARNING : out of range, row=%d (%d) count=%d", _cmd, row,
@@ -318,8 +320,8 @@
scrollBottom:(int)bottom left:(int)left right:(int)right
color:(NSColor *)color
{
//NSLog(@"insertLinesAtRow:%d lineCount:%d", row, count);
[self lazyResize];
//NSLog(@"insertLinesAtRow:%d lineCount:%d color:%@", row, count, color);
[self lazyResize:NO];
if (row < 0 || row+count > maxRows) {
//NSLog(@"[%s] WARNING : out of range, row=%d (%d) count=%d", _cmd, row,
@@ -367,9 +369,9 @@
- (void)clearBlockFromRow:(int)row1 column:(int)col1 toRow:(int)row2
column:(int)col2 color:(NSColor *)color
{
//NSLog(@"clearBlockFromRow:%d column:%d toRow:%d column:%d", row1, col1,
// row2, col2);
[self lazyResize];
//NSLog(@"clearBlockFromRow:%d column:%d toRow:%d column:%d color:%@",
// row1, col1, row2, col2, color);
[self lazyResize:NO];
if (row1 < 0 || row2 >= maxRows || col1 < 0 || col2 > maxColumns) {
//NSLog(@"[%s] WARNING : out of range, row1=%d row2=%d (%d) col1=%d "
@@ -399,31 +401,17 @@
}
}
- (void)clearAllWithColor:(NSColor *)color
- (void)clearAll
{
//NSLog(@"%s%@", _cmd, color);
[self lazyResize];
[attribString release];
attribString = [[NSMutableAttributedString alloc] init];
NSRange fullRange = NSMakeRange(0, [attribString length]);
int i;
for (i=0; i<maxRows; ++i)
[attribString appendAttributedString:emptyRowString];
NSDictionary *attribs = [NSDictionary dictionaryWithObjectsAndKeys:
font, NSFontAttributeName,
color, NSBackgroundColorAttributeName, nil];
[attribString setAttributes:attribs range:fullRange];
[self edited:(NSTextStorageEditedCharacters|NSTextStorageEditedAttributes)
range:fullRange changeInLength:0];
[self lazyResize:YES];
}
- (void)setDefaultColorsBackground:(NSColor *)bgColor
foreground:(NSColor *)fgColor
{
//NSLog(@"setDefaultColorsBackground:%@ foreground:%@", bgColor, fgColor);
if (defaultBackgroundColor != bgColor) {
[defaultBackgroundColor release];
defaultBackgroundColor = bgColor ? [bgColor retain] : nil;
@@ -638,12 +626,12 @@
@implementation MMTextStorage (Private)
- (void)lazyResize
- (void)lazyResize:(BOOL)force
{
int i;
// Do nothing if the dimensions are already right.
if (actualRows == maxRows && actualColumns == maxColumns)
if (!force && actualRows == maxRows && actualColumns == maxColumns)
return;
NSRange oldRange = NSMakeRange(0, actualRows*(actualColumns+1));
+1 -3
View File
@@ -816,12 +816,10 @@ static NSMenuItem *findMenuItemWithTagInMenu(NSMenu *root, int tag)
int type = *((int*)bytes); bytes += sizeof(int);
if (ClearAllDrawType == type) {
unsigned color = *((unsigned*)bytes); bytes += sizeof(unsigned);
#if MM_DEBUG_DRAWING
NSLog(@" Clear all");
#endif
[textStorage clearAllWithColor:[NSColor colorWithArgbInt:color]];
[textStorage clearAll];
} else if (ClearBlockDrawType == type) {
unsigned color = *((unsigned*)bytes); bytes += sizeof(unsigned);
int row1 = *((int*)bytes); bytes += sizeof(int);