* Documentation/Changelog: Update

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/apps/projectcenter/trunk@26095 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
Sergii Stoian 2008-02-18 22:50:56 +00:00
parent 256e47d6c9
commit f66acd94df
16 changed files with 294 additions and 97 deletions

View file

@ -1,3 +1,85 @@
2008-02-19 Sergii Stoian <stoyan255@gmail.com>
* PCMenuController.m: Start thinking about "Go to line:" popup.
* English.lproj/ProjectCenter.gorm: Added "Edit->Find->Line Number..."
menu item.
* Framework/PCProjectBrowser.m: (-nameOfSelectedFile:): Improve
category select detection.
(-pathToSelectedFile:): Use nameOfSelctedFile:. Cleanup.
(-nameOfSelctedCategory:): Return project name if subproject is
selected.
* Framework/PCProjectEditor.m:
(-openEditorForCategoryPath:windowed:): Use PCEditor's
fileStructureItemSelected if file structure component selected
in browser.
* Framework/PCProjectBuilder.m: Go to line number in editor
on error/warning click functionality implemented.
* Framework/PCProjectWindow.m: Cleanup.
* Framework/PCPrefController.m: Fix some compiler warnings.
* Modules/Parsers/ProjectCenter/ObjCMethodHandler.m:
* Modules/Parsers/ProjectCenter/ObjCClassHandler.m:
Fix bug #20855. Improve class names parsing: don't include spaces.
* Modules/Editors/ProjectCenter/PCEditorView.h: Remove unused
editorDocument variable.
* Modules/Editors/ProjectCenter/PCEditor.h:
* Modules/Editors/ProjectCenter/PCEditor.m: Make class independent
from ProjectCenter framework. Added variable _highlighSyntax. It sould
be set via preferences in the future.
(-_createEditorViewWithFrame:): Use _highlighSyntax variable.
(-_methodsForClass:): New method. Used to return to browser methods
only for selected class.
(-browserItemsForItem:): Use _methodsForClass method.
(-scrollToClassName:): Implemented. Now it's a almost identical copy
of scrollToMethodName:. TODO: think about code optimization.
* Modules/Editors/ProjectCenter/PCEditorView.m:
(-drawRect:): Call highilghter only if it's enabled.
2008-02-13 22:10-EST Gregory John Casamento <greg_casamento@yahoo.com>
* Framework/PCMakefileFactory.m: Correction for bug#22311. Added
project-type specific makefile generation.
2008-02-10 23:53-EST Gregory John Casamento <greg_casamento@yahoo.com>
* Framework/PCEditorManager.m: Corrected problem with call to
NSLog(..) which was causing a crash.
2008-02-05 Sergii Stoian <stoyan255@gmail.com>
* PCMenuController.m: Start thinking about "Go to line:" popup.
* English.lproj/ProjectCenter.gorm: Added "Edit->Find->Line Number..."
menu item.
* Framework/PCProjectBrowser.m: (-nameOfSelectedFile:): Improve
category select detection.
(-pathToSelectedFile:): Use nameOfSelctedFile:. Cleanup.
(-nameOfSelctedCategory:): Return project name if subproject is
selected.
* Framework/PCProjectEditor.m:
(-openEditorForCategoryPath:windowed:): Use PCEditor's
fileStructureItemSelected if file structure component selected
in browser.
* Framework/PCProjectBuilder.m: Go to line number in editor
on error/warning click functionality implemented.
* Framework/PCProjectWindow.m: Cleanup.
* Framework/PCPrefController.m: Fix some compiler warnings.
* Modules/Parsers/ProjectCenter/ObjCMethodHandler.m:
* Modules/Parsers/ProjectCenter/ObjCClassHandler.m:
Fix bug #20855. Improve class names parsing: don't include spaces.
* Modules/Editors/ProjectCenter/PCEditorView.h: Remove unused
editorDocument variable.
* Modules/Editors/ProjectCenter/PCEditor.h:
* Modules/Editors/ProjectCenter/PCEditor.m: Make class independent
from ProjectCenter framework. Added variable _highlighSyntax. It sould
be set via preferences in the future.
(-_createEditorViewWithFrame:): Use _highlighSyntax variable.
(-_methodsForClass:): New method. Used to return to browser methods
only for selected class.
(-browserItemsForItem:): Use _methodsForClass method.
(-scrollToClassName:): Implemented. Now it's a almost identical copy
of scrollToMethodName:. TODO: think about code optimization.
* Modules/Editors/ProjectCenter/PCEditorView.m:
(-drawRect:): Call highilghter only if it's enabled.
2008-02-13 22:10-EST Gregory John Casamento <greg_casamento@yahoo.com>
* Framework/PCMakefileFactory.m: Correction for bug#22311. Added

View file

@ -3,10 +3,11 @@
FirstResponder = {
Actions = (
"findEnterSelection:",
"findJumpToSelection:",
"findNext:",
"findPrevious:",
"findShowPanel:",
"findJumpToSelection:"
"newAction:"
);
Super = NSObject;
};
@ -59,7 +60,8 @@
"findNext:",
"findPrevious:",
"findShowPanel:",
"findJumpToSelection:"
"findJumpToSelection:",
"goToLine:"
);
Outlets = (
);

View file

@ -141,6 +141,7 @@ static PCPrefController *_prefCtrllr = nil;
{
NSDictionary *prefs;
NSString *val;
NSString *defValue = @"";
prefs = [[NSUserDefaults standardUserDefaults] dictionaryRepresentation];
[preferencesDict addEntriesFromDictionary: prefs];
@ -148,18 +149,17 @@ static PCPrefController *_prefCtrllr = nil;
// Fill in the defaults
// Building
val = [preferencesDict objectForKey:SuccessSound];
[successField setStringValue: (val == nil) ? @"" : val];
[successField setStringValue:
(val = [preferencesDict objectForKey:SuccessSound]) ? val : defValue];
[failureField setStringValue:
(val = [preferencesDict objectForKey:FailureSound]) ? val : @""];
(val = [preferencesDict objectForKey:FailureSound]) ? val : defValue];
[promptOnClean setState:
([[preferencesDict objectForKey:PromptOnClean]
isEqualToString: @"YES"]) ? NSOnState : NSOffState];
[rootBuildDirField setStringValue:
(val = [preferencesDict objectForKey:RootBuildDirectory]) ? val : @""];
(val = [preferencesDict objectForKey:RootBuildDirectory]) ? val : defValue];
// Saving
[saveOnQuit setState:
@ -170,8 +170,9 @@ static PCPrefController *_prefCtrllr = nil;
([[preferencesDict objectForKey: KeepBackup]
isEqualToString: @"YES"]) ? NSOnState : NSOffState];
defValue = @"120";
[autosaveField setStringValue:
(val = [preferencesDict objectForKey: AutoSavePeriod]) ? val : @"120"];
(val = [preferencesDict objectForKey: AutoSavePeriod]) ? val : defValue];
[autosaveSlider setFloatValue:[[autosaveField stringValue] floatValue]];
// Key Bindings

View file

@ -103,8 +103,10 @@ NSString *PCBrowserDidSetPathNotification = @"PCBrowserDidSetPathNotification";
NSEnumerator *enumerator;
NSString *pathItem;
// NSLog(@"---> Selected: %@: category: %@", name, category);
if ([[browser selectedCells] count] != 1
|| [name isEqualToString:[self nameOfSelectedCategory]])
|| [name isEqualToString:category])
{
return nil;
}
@ -127,22 +129,14 @@ NSString *PCBrowserDidSetPathNotification = @"PCBrowserDidSetPathNotification";
// Returns nil if multiple files selected
- (NSString *)pathToSelectedFile
{
NSString *name = nil;
NSString *path = nil;
NSString *name = [self nameOfSelectedFile];
NSString *path = [browser path];
if ([[browser selectedCells] count] == 1)
if (!name)
{
name = [[browser path] lastPathComponent];
if ([name isEqualToString:[self nameOfSelectedCategory]])
{
path = nil;
}
else
{
path = [browser path];
}
path = nil;
}
return path;
}
@ -150,13 +144,19 @@ NSString *PCBrowserDidSetPathNotification = @"PCBrowserDidSetPathNotification";
- (NSString *)nameOfSelectedCategory
{
NSArray *pathArray = [[browser path] componentsSeparatedByString:@"/"];
NSString *lastPathElement = [[browser path] lastPathComponent];
PCProject *activeProject = [[project projectManager] activeProject];
NSArray *rootCategories = [activeProject rootCategories];
NSString *name = nil;
int i;
if ([rootCategories containsObject:[pathArray lastObject]]
&& [[browser selectedCells] count] > 1)
if ([lastPathElement isEqualToString:[activeProject projectName]])
{
return [activeProject projectName];
}
if (([rootCategories containsObject:lastPathElement]
&& [[browser selectedCells] count] > 1))
{
return nil;
}
@ -374,16 +374,15 @@ NSString *PCBrowserDidSetPathNotification = @"PCBrowserDidSetPathNotification";
browserPath = [self path];
filePath = [self pathToSelectedFile];
/* NSLog(@"browserPath: %@ forProject: %@",
browserPath, [activeProject projectName]);*/
// NSLog(@"browserPath: %@ forProject: %@",
// browserPath, [activeProject projectName]);
// if ([[self selectedFiles] count] == 1
if (filePath &&
[filePath isEqualToString:browserPath] &&
![[ud objectForKey:SeparateEditor] isEqualToString:@"YES"])
{
/* PCLogInfo(self, @"[click] category: %@ filePath: %@",
category, filePath);*/
// NSLog(@"[click] category: %@ filePath: %@", category, filePath);
[[activeProject projectEditor] openEditorForCategoryPath:browserPath
windowed:NO];
}

View file

@ -36,6 +36,9 @@
#include <ProjectCenter/PCProjectBuilder.h>
#include <ProjectCenter/PCProjectBuilderOptions.h>
#include <ProjectCenter/PCProjectEditor.h>
#include <Protocols/CodeEditor.h>
#include <ProjectCenter/PCLogController.h>
#include <ProjectCenter/PCPrefController.h>
@ -993,13 +996,21 @@
// position
if (typeIndex == 2) // :line:
{
position = [NSString stringWithFormat:@"{x=0; y=%f}",
[components objectAtIndex:1]];
int lInt = atoi([[components objectAtIndex:1] cString]);
NSNumber *lNumber = [NSNumber numberWithInt:lInt];
position = [NSString stringWithFormat:@"{x=%i; y=0}",
[lNumber floatValue]];
}
else if (typeIndex == 3) // :line:column:
{
int lInt = atoi([[components objectAtIndex:1] cString]);
int cInt = atoi([[components objectAtIndex:2] cString]);
NSNumber *lNumber = [NSNumber numberWithInt:lInt];
NSNumber *cNumber = [NSNumber numberWithInt:cInt];
position = [NSString stringWithFormat:@"{x=%f; y=%f}",
[components objectAtIndex:2], [components objectAtIndex:1]];
[lNumber floatValue], [cNumber floatValue]];
}
// message
substr = [NSString stringWithFormat:@"%@:", type];
@ -1125,14 +1136,26 @@
- (void)errorItemClick:(id)sender
{
int rowIndex = [errorOutput selectedRow];
NSDictionary *error = [errorArray objectAtIndex:rowIndex];
int rowIndex = [errorOutput selectedRow];
NSDictionary *error = [errorArray objectAtIndex:rowIndex];
NSPoint position;
PCProjectEditor *projectEditor = [project projectEditor];
id<CodeEditor> editor;
NSLog(@"%i: %@(%@): %@",
rowIndex,
editor = [projectEditor openEditorForFile:[error objectForKey:@"File"]
editable:YES
windowed:NO];
if (editor)
{
position = NSPointFromString([error objectForKey:@"Position"]);
[editor scrollToLineNumber:(unsigned int)position.x];
}
/* NSLog(@"%f: %@(%@): %@",
position.x,
[error objectForKey:@"File"],
[error objectForKey:@"IncludedFile"],
[error objectForKey:@"Error"]);
[error objectForKey:@"Error"]);*/
}
@end

View file

@ -184,7 +184,8 @@
- (id<CodeEditor>)openEditorForCategoryPath:(NSString *)categoryPath
windowed:(BOOL)windowed
{
// NSArray *pathArray = [categoryPath pathComponents];
NSArray *pathArray = [categoryPath pathComponents];
NSString *pathLastObject = [pathArray lastObject];
PCProject *activeProject = [[_project projectManager] activeProject];
NSString *category = [[_project projectBrowser] nameOfSelectedCategory];
NSString *categoryKey = [activeProject keyForCategory:category];
@ -192,7 +193,6 @@
NSString *filePath = nil;
BOOL editable = YES;
id<CodeEditor> editor;
NSString *pathLastObject = [[categoryPath pathComponents] lastObject];
NSString *firstSymbol = nil;
fileName = [[[[_project projectBrowser] pathFromSelectedCategory]
@ -244,13 +244,21 @@
NSLog(@"lastObject[1]: %@",
[pathLastObject substringWithRange:NSMakeRange(0,1)]);*/
// pathLastObject = [pathArray lastObject];
firstSymbol = [pathLastObject substringToIndex:1];
if ([pathLastObject isEqualToString:@"/"]) // file selected
{ // Reload last column because editor has just been loaded
[[_project projectBrowser] reloadLastColumnAndNotify:NO];
if ([pathLastObject isEqualToString:@"/"])
{
pathLastObject = [pathArray objectAtIndex:[pathArray count]-2];
if ([pathLastObject isEqualToString:fileName]) // file selected
{ // Reload last column because editor has just been loaded
[[_project projectBrowser] reloadLastColumnAndNotify:NO];
}
else
{
[editor fileStructureItemSelected:pathLastObject];
}
}
else
else // TODO: rethink
{
[editor fileStructureItemSelected:pathLastObject];
}

View file

@ -564,9 +564,16 @@
//--- Add Custom view
if ([self hasCustomView] && customView == nil)
{
// [browserView setAutoresizingMask: NSViewWidthSizable | NSViewMinYMargin];
[self _createCustomView];
}
//--- Remove Custom view
if (![self hasCustomView] && customView != nil)
{
[customView removeFromSuperview];
[h_split adjustSubviews];
customView = nil;
}
// Project Builder
if ([[prefsDict objectForKey:@"SeparateBuilder"] isEqualToString:@"YES"])
@ -605,15 +612,6 @@
}
}
//--- Remove Custom view
if (![self hasCustomView] && customView != nil)
{
// [browserView setAutoresizingMask:NSViewWidthSizable|NSViewHeightSizable];
[customView removeFromSuperview];
[h_split adjustSubviews];
customView = nil;
}
// Loaded Files view
if ([self hasLoadedFilesView])
{

View file

@ -48,18 +48,25 @@
NSString *_categoryPath;
NSWindow *_window;
BOOL _isEdited;
BOOL _isEditable;
BOOL _isWindowed;
BOOL _isExternal;
// Search
NSView *goToLineView;
NSView *quickFindView;
// Parser
id<CodeParser> aParser;
NSArray *parserClasses;
NSArray *parserMethods;
// NSMutableArray *classNames;
// NSMutableArray *methodNames;
// Syntax highlighter (used in PCEditorView)
BOOL _highlightSyntax;
// Default text attributes (not syntax) and open/close brackets
// highlighting ([],{},())
NSFont *defaultFont;
NSFont *highlightFont;
@ -136,7 +143,6 @@
- (void)findNext:sender;
- (void)findPrevious:sender;
- (void)jumpToSelection:sender;
- (void)goToLine:sender;
@end

View file

@ -23,10 +23,6 @@
Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111 USA.
*/
#import <ProjectCenter/PCDefines.h>
#import <ProjectCenter/PCProjectWindow.h>
#import <ProjectCenter/PCLogController.h>
#import "PCEditor.h"
#import "PCEditorView.h"
//#import "CommandQueryPanel.h"
@ -129,8 +125,11 @@
ev = [[PCEditorView alloc] initWithFrame:fr textContainer:tc];
[ev setBackgroundColor:textBackground];
[ev setTextColor:textColor];
[ev createSyntaxHighlighterForFileType:[_path pathExtension]];
[ev setEditor:self];
if (_highlightSyntax)
{
[ev createSyntaxHighlighterForFileType:[_path pathExtension]];
}
[ev setMinSize:NSMakeSize(0, 0)];
[ev setMaxSize:NSMakeSize(1e7, 1e7)];
@ -177,6 +176,8 @@
_isWindowed = NO;
_isExternal = YES;
_highlightSyntax = YES;
ASSIGN(defaultFont, [PCEditorView defaultEditorFont]);
ASSIGN(highlightFont, [PCEditorView defaultEditorFont]);
ASSIGN(highlightColor, [NSColor greenColor]);
@ -248,6 +249,7 @@
[[NSNotificationCenter defaultCenter]
postNotificationName:PCEditorWillOpenNotification
object:self];
_editorManager = editorManager;
_path = [filePath copy];
_isEditable = editable;
@ -345,11 +347,11 @@
if (![path isEqualToString:_path])
{
PCLogError(self, @"external editor task terminated");
NSLog(@"external editor task terminated");
return;
}
PCLogStatus(self, @"Our Editor task terminated");
NSLog(@"Our Editor task terminated");
// Inform about closing
[[NSNotificationCenter defaultCenter]
@ -460,12 +462,48 @@
return AUTORELEASE(image);
}
- (NSArray *)browserItemsForItem:(NSString *)item
- (NSArray *)_methodsForClass:(NSString *)className
{
NSEnumerator *enumerator;
NSDictionary *method;
NSDictionary *class;
NSMutableArray *items = [NSMutableArray array];
NSRange classRange;
NSRange methodRange;
ASSIGN(parserClasses, [aParser classNames]);
ASSIGN(parserMethods, [aParser methodNames]);
enumerator = [parserClasses objectEnumerator];
while ((class = [enumerator nextObject]))
{
if ([[class objectForKey:@"ClassName"] isEqualToString:className])
{
classRange = NSRangeFromString([class objectForKey:@"ClassBodyRange"]);
break;
}
}
enumerator = [parserMethods objectEnumerator];
while ((method = [enumerator nextObject]))
{
// NSLog(@"Method> %@", method);
methodRange = NSRangeFromString([method objectForKey:@"MethodBodyRange"]);
if (NSIntersectionRange(classRange, methodRange).length != 0)
{
[items addObject:[method objectForKey:@"MethodName"]];
}
}
return items;
}
- (NSArray *)browserItemsForItem:(NSString *)item
{
NSEnumerator *enumerator;
// NSDictionary *method;
NSDictionary *class;
NSMutableArray *items = [NSMutableArray array];
NSLog(@"PCEditor: asked for browser items for: %@", item);
@ -488,14 +526,15 @@
// If item starts with "@" show method list
if ([[item substringToIndex:1] isEqualToString:@"@"])
{
ASSIGN(parserMethods, [aParser methodNames]);
/* ASSIGN(parserMethods, [aParser methodNames]);
enumerator = [parserMethods objectEnumerator];
while ((method = [enumerator nextObject]))
{
// NSLog(@"Method> %@", method);
[items addObject:[method objectForKey:@"MethodName"]];
}
}*/
return [self _methodsForClass:item];
}
return items;
@ -803,6 +842,7 @@
firstSymbol = [item substringToIndex:1];
if ([firstSymbol isEqualToString:@"@"]) // class selected
{
[self scrollToClassName:item];
}
else if ([firstSymbol isEqualToString:@"-"] // method selected
|| [firstSymbol isEqualToString:@"+"])
@ -813,6 +853,29 @@
- (void)scrollToClassName:(NSString *)className
{
NSEnumerator *enumerator = nil;
NSDictionary *class = nil;
NSRange classNameRange;
NSLog(@"SCROLL to class: \"%@\"", className);
enumerator = [parserClasses objectEnumerator];
while ((class = [enumerator nextObject]))
{
if ([[class objectForKey:@"ClassName"] isEqualToString:className])
{
classNameRange =
NSRangeFromString([class objectForKey:@"ClassNameRange"]);
break;
}
}
NSLog(@"classNameRange: %@", NSStringFromRange(classNameRange));
if (classNameRange.length != 0)
{
[_intEditorView setSelectedRange:classNameRange];
[_intEditorView scrollRangeToVisible:classNameRange];
}
}
- (void)scrollToMethodName:(NSString *)methodName
@ -872,6 +935,9 @@
@end
// ===========================================================================
// ==== Menu actions
// ===========================================================================
@implementation PCEditor (Menu)
- (void)pipeOutputOfCommand:(NSString *)command
@ -927,12 +993,12 @@
- (void)findNext:sender
{
// [[TextFinder sharedInstance] findNext: self];
// [[TextFinder sharedInstance] findNext:self];
}
- (void)findPrevious:sender
{
// [[TextFinder sharedInstance] findPrevious: self];
// [[TextFinder sharedInstance] findPrevious:self];
}
- (void)jumpToSelection:sender
@ -940,18 +1006,12 @@
[_intEditorView scrollRangeToVisible:[_intEditorView selectedRange]];
}
- (void)goToLine:sender
{
/* LineQueryPanel * lqp = [LineQueryPanel shared];
if ([lqp runModal] == NSOKButton)
{
[self goToLineNumber: (unsigned int) [lqp unsignedIntValue]];
}*/
}
@end
// ===========================================================================
// ==== Parenthesis highlighting
// ===========================================================================
/**
* Checks whether a character is a delimiter.
*

View file

@ -30,7 +30,6 @@
@interface PCEditorView : NSTextView
{
PCEditor *editor;
// SourceEditorDocument *editorDocument;
SyntaxHighlighter *highlighter;
}

View file

@ -429,7 +429,7 @@ static int ComputeIndentingOffset(NSString * string, unsigned int start)
}
// ---
- (void) dealloc
- (void)dealloc
{
TEST_RELEASE(highlighter);
@ -462,22 +462,24 @@ static int ComputeIndentingOffset(NSString * string, unsigned int start)
- (void)drawRect:(NSRect)r
{
// NSEnumerator *e;
NSRange drawnRange;
NSRange drawnRange;
drawnRange = [[self layoutManager]
glyphRangeForBoundingRect:r
inTextContainer:[self textContainer]];
[highlighter highlightRange:drawnRange];
if (highlighter)
{
drawnRange = [[self layoutManager]
glyphRangeForBoundingRect:r inTextContainer:[self textContainer]];
[highlighter highlightRange:drawnRange];
}
[super drawRect: r];
[super drawRect:r];
}
- (void)createSyntaxHighlighterForFileType:(NSString *)fileType
{
ASSIGN(highlighter, [[[SyntaxHighlighter alloc]
initWithFileType: fileType textStorage: [self textStorage]]
autorelease]);
ASSIGN(highlighter,
[[[SyntaxHighlighter alloc] initWithFileType:fileType
textStorage:[self textStorage]]
autorelease]);
}
- (void)insertText:text

View file

@ -101,7 +101,7 @@
if (_commentType != NoComment)
{
}
else if (_stringBegin /* != NoString*/)
else if (_stringBegin)
{
}
else if (step != ClassNone)
@ -118,7 +118,11 @@
}
else if ((step == ClassName) || (step == ClassCategory))
{
[class appendString:element];
[class appendString:element];
if (prev_step == ClassNone)
{
prev_step = ClassName;
}
}
}
@ -205,7 +209,7 @@
[class appendString:@"@"];
step = ClassName;
prev_step = ClassNone;
nameBeginPosition = position;
nameBeginPosition = position+1;
}
[keyword setString:@""];
@ -221,8 +225,13 @@
{
// NSLog(@"Class body start: \"%@\"", class);
step = ClassBody;
nameEndPosition = position - 1;
bodyBeginPosition = position;
nameEndPosition = position;
bodyBeginPosition = position+1;
}
else if ((element == ' ') && (step == ClassName)
&& (prev_step != ClassName))
{
nameBeginPosition++;
}
}

View file

@ -245,7 +245,7 @@
}
else if (element == ':')
{
step = MethodParameterStart;
step = MethodName;
[method appendString:@":"];
}
}
@ -293,6 +293,7 @@
if ((step == MethodName) && (element == ';'))
{
nameEndPosition = position;
bodyBeginPosition = position - 1;
[self addMethodToArray];
step = MethodNone;
}

View file

@ -233,6 +233,13 @@
[[TextFinder sharedInstance] enterSelection:self];
}
- (void)goToLine:sender
{
// TODO: What is the best: inline editor popup or separate panel?
// [[[[projectManager rootActiveProject] projectEditor] activeEditor]
// goToLine:sender];
}
// Tools
- (void)toggleToolbar:(id)sender
{