Fix highlighting for standalone editors.

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/apps/projectcenter/trunk@30819 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
Riccardo Mottola 2010-06-22 16:03:05 +00:00
parent 10ccc32c63
commit 491745fd36
3 changed files with 28 additions and 12 deletions

View file

@ -5,6 +5,14 @@
* Modules/Editors/ProjectCenter/PCEditor+Document.m
Clean up parenthesis highlighting.
* Modules/Editors/ProjectCenter/PCEditor.h
* Modules/Editors/ProjectCenter/PCEditor.m
Fix highlighting for standalone editors.
* Modules/Editors/ProjectCenter/PCEditor+Document.m
Deleted
2010-06-15 Wolfgang Lux <wolfgang.lux@gmail.com>
* Framework/PCProject.m (-fileTypesForCategoryKey:): Add .dylib to

View file

@ -149,8 +149,8 @@
@interface PCEditor (Parenthesis)
- (void)unhighlightCharacter;
- (void)highlightCharacterAt:(unsigned int)location;
- (void)unhighlightCharacter: (NSTextView *)editorView;
- (void)highlightCharacterAt:(unsigned int)location inEditor: (NSTextView *)editorView;
- (void)computeNewParenthesisNesting: (NSTextView *)editorView;
@end

View file

@ -212,6 +212,10 @@
NSLog(@"PCEditor: %@ dealloc", [_path lastPathComponent]);
#endif
[_extEditorView setEditor: nil];
[_window setDelegate: nil];
[[NSNotificationCenter defaultCenter] removeObserver:self];
[_window close];
@ -850,7 +854,10 @@
editorTextViewIsPressingKey = YES;
// NSLog(@"Will pressing key");
[self unhighlightCharacter];
if (sender == _intEditorView || sender == _extEditorView)
[self unhighlightCharacter: sender];
else
NSLog(@"PCEditor: unexpected sender");
}
- (void)editorTextViewDidPressKey:sender
@ -858,6 +865,8 @@
// NSLog(@"Did pressing key");
if (sender == _intEditorView || sender == _extEditorView)
[self computeNewParenthesisNesting: sender];
else
NSLog(@"PCEditor: unexpected sender");
editorTextViewIsPressingKey = NO;
}
@ -1212,10 +1221,10 @@ unsigned int FindDelimiterInString(NSString * string,
@implementation PCEditor (Parenthesis)
- (void)unhighlightCharacter
- (void)unhighlightCharacter: (NSTextView *)editorView
{
int i;
NSTextStorage *textStorage = [_intEditorView textStorage];
NSTextStorage *textStorage = [editorView textStorage];
[textStorage beginEditing];
@ -1225,7 +1234,6 @@ unsigned int FindDelimiterInString(NSString * string,
NSRange r = NSMakeRange(highlited_chars[i], 1);
// NSRange r = NSMakeRange(highlitCharacterLocation, i);
// NSLog(@"unhighlight");
isCharacterHighlit = NO;
@ -1271,7 +1279,7 @@ unsigned int FindDelimiterInString(NSString * string,
[textStorage endEditing];
}
- (void)highlightCharacterAt:(unsigned int)location
- (void)highlightCharacterAt:(unsigned int)location inEditor: (NSTextView *)editorView
{
int i;
@ -1280,7 +1288,7 @@ unsigned int FindDelimiterInString(NSString * string,
// if (isCharacterHighlit == NO)
if (i < 2)
{
NSTextStorage *textStorage = [_intEditorView textStorage];
NSTextStorage *textStorage = [editorView textStorage];
NSRange r = NSMakeRange(location, 1);
NSRange tmp;
@ -1290,7 +1298,7 @@ unsigned int FindDelimiterInString(NSString * string,
highlited_chars[i] = location;
isCharacterHighlit = YES;
NSAssert(textStorage, @"textstorage can't be nil");
[textStorage beginEditing];
// store the previous character's attributes
@ -1337,7 +1345,7 @@ unsigned int FindDelimiterInString(NSString * string,
selectedRange = [editorView selectedRange];
// make sure we un-highlight a previously highlit delimiter
[self unhighlightCharacter];
[self unhighlightCharacter :editorView];
// if we have a character at the selected location, check
// to see if it is a delimiter character
@ -1367,8 +1375,8 @@ unsigned int FindDelimiterInString(NSString * string,
// and in case a delimiter is found, highlight it
if (result != NSNotFound)
{
[self highlightCharacterAt:selectedRange.location];
[self highlightCharacterAt:result];
[self highlightCharacterAt:selectedRange.location inEditor:editorView];
[self highlightCharacterAt:result inEditor:editorView];
}
}
}