2006-12-26 11:00:33 +00:00
|
|
|
/*
|
|
|
|
GNUstep ProjectCenter - http://www.gnustep.org/experience/ProjectCenter.html
|
|
|
|
|
2014-07-31 10:18:31 +00:00
|
|
|
Copyright (C) 2002-2014 Free Software Foundation
|
2006-12-26 11:00:33 +00:00
|
|
|
|
|
|
|
Authors: Philippe C.D. Robert
|
|
|
|
Serg Stoyan
|
2010-06-01 13:35:07 +00:00
|
|
|
Riccardo Mottola
|
2006-12-26 11:00:33 +00:00
|
|
|
|
|
|
|
This file is part of GNUstep.
|
|
|
|
|
|
|
|
This application is free software; you can redistribute it and/or
|
|
|
|
modify it under the terms of the GNU General Public
|
|
|
|
License as published by the Free Software Foundation; either
|
|
|
|
version 2 of the License, or (at your option) any later version.
|
|
|
|
|
|
|
|
This application is distributed in the hope that it will be useful,
|
|
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
Library General Public License for more details.
|
|
|
|
|
|
|
|
You should have received a copy of the GNU General Public
|
|
|
|
License along with this library; if not, write to the Free
|
|
|
|
Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111 USA.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#import <AppKit/AppKit.h>
|
|
|
|
|
|
|
|
#import <Protocols/CodeEditor.h>
|
|
|
|
#import <Protocols/CodeParser.h>
|
|
|
|
|
|
|
|
#import <ProjectCenter/PCProjectEditor.h>
|
|
|
|
|
|
|
|
@class PCEditorView;
|
|
|
|
|
|
|
|
@interface PCEditor : NSObject <CodeEditor>
|
|
|
|
{
|
2008-01-21 22:26:36 +00:00
|
|
|
id _editorManager;
|
2006-12-26 11:00:33 +00:00
|
|
|
|
|
|
|
NSScrollView *_extScrollView;
|
|
|
|
PCEditorView *_extEditorView;
|
|
|
|
NSScrollView *_intScrollView;
|
|
|
|
PCEditorView *_intEditorView;
|
|
|
|
NSTextStorage *_storage;
|
|
|
|
NSMutableString *_path;
|
|
|
|
NSString *_categoryPath;
|
|
|
|
NSWindow *_window;
|
|
|
|
|
|
|
|
BOOL _isEdited;
|
2008-01-16 00:35:17 +00:00
|
|
|
BOOL _isEditable;
|
2006-12-26 11:00:33 +00:00
|
|
|
BOOL _isWindowed;
|
|
|
|
BOOL _isExternal;
|
|
|
|
|
2008-02-18 22:50:56 +00:00
|
|
|
// Search
|
|
|
|
NSView *goToLineView;
|
|
|
|
NSView *quickFindView;
|
|
|
|
|
|
|
|
// Parser
|
2006-12-26 11:00:33 +00:00
|
|
|
id<CodeParser> aParser;
|
|
|
|
NSArray *parserClasses;
|
|
|
|
NSArray *parserMethods;
|
|
|
|
|
2008-02-18 22:50:56 +00:00
|
|
|
// Syntax highlighter (used in PCEditorView)
|
|
|
|
BOOL _highlightSyntax;
|
|
|
|
|
|
|
|
// Default text attributes (not syntax) and open/close brackets
|
|
|
|
// highlighting ([],{},())
|
2006-12-26 11:00:33 +00:00
|
|
|
NSFont *defaultFont;
|
|
|
|
NSFont *highlightFont;
|
|
|
|
|
|
|
|
NSColor *textColor;
|
|
|
|
NSColor *highlightColor;
|
|
|
|
NSColor *backgroundColor;
|
|
|
|
NSColor *readOnlyColor;
|
|
|
|
NSColor *textBackground;
|
|
|
|
|
|
|
|
// location of the highlit delimiter character
|
|
|
|
unsigned int highlitCharacterLocation;
|
|
|
|
|
|
|
|
// is YES if we are currently highlighting a delimiter character
|
|
|
|
// otherwise NO
|
|
|
|
BOOL isCharacterHighlit;
|
|
|
|
int highlited_chars[2];
|
|
|
|
|
|
|
|
// the stored color and font attributes of the highlit character, so
|
|
|
|
// that they can be restored later on when the character is un-highlit
|
|
|
|
NSColor *previousFGColor;
|
|
|
|
NSColor *previousBGColor;
|
|
|
|
NSColor *previousFont;
|
|
|
|
|
|
|
|
// This is used to protect that -textViewDidChangeSelection: invocations
|
|
|
|
// don't do anything when the text view changing, because this causes
|
|
|
|
// further changes to the text view and infinite recursive invocations
|
|
|
|
// of this method.
|
|
|
|
BOOL editorTextViewIsPressingKey;
|
2010-06-01 13:35:07 +00:00
|
|
|
|
|
|
|
// keep one undo manager for the editor
|
|
|
|
NSUndoManager *undoManager;
|
2006-12-26 11:00:33 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
- (BOOL)editorShouldClose;
|
|
|
|
|
|
|
|
// ===========================================================================
|
|
|
|
// ==== Window delegate
|
|
|
|
// ===========================================================================
|
|
|
|
- (BOOL)windowShouldClose:(id)sender;
|
|
|
|
- (void)windowDidBecomeKey:(NSNotification *)aNotification;
|
|
|
|
- (void)windowDidResignKey:(NSNotification *)aNotification;
|
|
|
|
|
|
|
|
// ===========================================================================
|
|
|
|
// ==== TextView (_intEditorView, _extEditorView) delegate
|
|
|
|
// ===========================================================================
|
|
|
|
- (void)textDidChange:(NSNotification *)aNotification;
|
|
|
|
- (void)textViewDidChangeSelection:(NSNotification *)notification;
|
|
|
|
- (void)editorTextViewWillPressKey:sender;
|
|
|
|
- (void)editorTextViewDidPressKey:sender;
|
|
|
|
|
2008-01-21 22:26:36 +00:00
|
|
|
- (BOOL)becomeFirstResponder:(PCEditorView *)view;
|
|
|
|
- (BOOL)resignFirstResponder:(PCEditorView *)view;
|
|
|
|
|
|
|
|
// ===========================================================================
|
|
|
|
// ==== Parser and scrolling
|
|
|
|
// ===========================================================================
|
|
|
|
|
|
|
|
- (void)fileStructureItemSelected:(NSString *)item; // CodeEditor protocol
|
|
|
|
- (void)scrollToClassName:(NSString *)className;
|
|
|
|
- (void)scrollToMethodName:(NSString *)methodName;
|
2014-07-31 10:18:31 +00:00
|
|
|
- (void)scrollToLineNumber:(NSUInteger)lineNumber; // CodeEditor protocol
|
2006-12-26 11:00:33 +00:00
|
|
|
|
|
|
|
@end
|
|
|
|
|
|
|
|
@interface PCEditor (UInterface)
|
|
|
|
|
|
|
|
- (void)_createWindow;
|
|
|
|
- (void)_createInternalView;
|
|
|
|
- (PCEditorView *)_createEditorViewWithFrame:(NSRect)fr;
|
|
|
|
|
|
|
|
@end
|
|
|
|
|
|
|
|
@interface PCEditor (Menu)
|
|
|
|
|
|
|
|
- (void)pipeOutputOfCommand:(NSString *)command;
|
|
|
|
// Find
|
|
|
|
- (void)findNext:sender;
|
|
|
|
- (void)findPrevious:sender;
|
|
|
|
- (void)jumpToSelection:sender;
|
|
|
|
|
|
|
|
@end
|
|
|
|
|
|
|
|
@interface PCEditor (Parenthesis)
|
|
|
|
|
2010-06-22 16:03:05 +00:00
|
|
|
- (void)unhighlightCharacter: (NSTextView *)editorView;
|
2012-07-30 21:07:19 +00:00
|
|
|
- (void)highlightCharacterAt:(NSUInteger)location inEditor: (NSTextView *)editorView;
|
2010-06-22 00:20:46 +00:00
|
|
|
- (void)computeNewParenthesisNesting: (NSTextView *)editorView;
|
2006-12-26 11:00:33 +00:00
|
|
|
|
|
|
|
@end
|