* Framework/PCProjectManager.m: Fix problem with closing project.

* Framework/PCProjectr.m: Ditto.
        * Framework/PCMakefileFactory.m: Support for root build directory added.
        * Framework/PCProjectBuilder.m: Code cleanup.
        * Framework/PCProjectEditor.m: Enable usage of parser. Start testing process.
        * Framework/PCProjectWindows.m: Enable tooltips for buttons.
        * Framework/PCPrefController.m: setRootBuildDir: fix.

        * PCAppController.m: applicationWillTerminate: Remove file from build dir on
        application quit. This code still needs review (also removed build dir because of
        use PCFileManager's method).

        * Modules/Editors/ProjectCenter/PCEditor.m: browserItemsForItem: Crashes if file
        is not supported by parser. Fixed.



git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/apps/projectcenter/trunk@24353 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
Sergii Stoian 2007-01-15 18:40:58 +00:00
parent d5c82c42a2
commit 3793013f03
16 changed files with 455 additions and 274 deletions

View file

@ -1,3 +1,20 @@
2007-01-15 Sergii Stoian <stoyan255@gmail.com>
* Framework/PCProjectManager.m: Fix problem with closing project.
* Framework/PCProjectr.m: Ditto.
* Framework/PCMakefileFactory.m: Support for root build directory added.
* Framework/PCProjectBuilder.m: Code cleanup.
* Framework/PCProjectEditor.m: Enable usage of parser. Start testing process.
* Framework/PCProjectWindows.m: Enable tooltips for buttons.
* Framework/PCPrefController.m: setRootBuildDir: fix.
* PCAppController.m: applicationWillTerminate: Remove file from build dir on
application quit. This code still needs review (also removed build dir because of
use PCFileManager's method).
* Modules/Editors/ProjectCenter/PCEditor.m: browserItemsForItem: Crashes if file
is not supported by parser. Fixed.
2007-01-12 Sergii Stoian <stoyan255@gmail.com>
* Framework/PCProjectBuilder.m: Parsing of error output almost complete,

View file

@ -32,12 +32,12 @@ ProjectCenter 0.5
- Implement code parser (get it from CodeEditor?) [done!]
- Project Browser should show file structure. [done!]
- Click on Browser item should move cursor to line in file [done!]
- Imlement pending adding/removal of files (history?) [done!]
- Imlement pending adding/removal of files (history?) stoyan
--- Project Builder:
- Implement root build directory handling stoyan
- Finish options handling stoyan
- Parse gcc output stoyan
- Display warnings,errors,options etc. as clickable list stoyan
- Parse gcc output [90% done!]
- Display warnings,errors,options etc. as clickable list [90% done!]
- Finish FileNameIcon (draggable, files can be dragged to it) stoyan
- Review all dialogs and situations when dialogs must be
popped up stoyan

View file

@ -229,9 +229,9 @@
// ==== Tool Tips
// ============================================================================
- (void)mouseEntered:(NSEvent *)theEvent
/*- (void)mouseEntered:(NSEvent *)theEvent
{
// NSLog (@"mouseEntered");
NSLog (@"mouseEntered");
if (ttTimer == nil)
{
@ -381,7 +381,7 @@
}
return nil;
}
}*/
@end

View file

@ -59,6 +59,10 @@ static PCMakefileFactory *_factory = nil;
- (void)createMakefileForProject:(NSString *)prName
{
NSUserDefaults *ud = [NSUserDefaults standardUserDefaults];
NSString *buildDir = [ud objectForKey:RootBuildDirectory];
NSString *buildName = [prName stringByAppendingPathExtension:@"build"];
NSAssert(prName, @"No project name given!");
AUTORELEASE(mfile);
@ -72,6 +76,13 @@ static PCMakefileFactory *_factory = nil;
[mfile appendString:@"#\n"];
[mfile appendString:@"\ninclude $(GNUSTEP_MAKEFILES)/common.make\n"];
if (![buildDir isEqualToString:@""])
{
[mfile appendString:
[NSString stringWithFormat:@"\nGNUSTEP_BUILD_DIR = %@\n",
[buildDir stringByAppendingPathComponent:buildName]]];
}
}
- (BOOL)createPreambleForProject:(PCProject *)project

View file

@ -25,7 +25,7 @@
#import <ProjectCenter/PCPrefController.h>
// TODO: rewrite it as PCPrefernces, use +sharedPreferences instead of
// TODO: rewrite it as PCPreferences, use +sharedPreferences instead of
// [NSUserDefaults standardUserDefaults] in every part of ProjectCenter
@implementation PCPrefController
@ -414,15 +414,24 @@ static PCPrefController *_prefCtrllr = nil;
- (void)setRootBuildDir:(id)sender
{
NSArray *types = nil;
NSString *path = [self selectFileWithTypes:types];
NSString *path;
if (sender == rootBuildDirButton)
{
path = [self selectFileWithTypes:nil];
[rootBuildDirField setStringValue:path];
}
else
{
path = [rootBuildDirField stringValue];
}
if (path)
{
[rootBuildDirField setStringValue:path];
[[NSUserDefaults standardUserDefaults] setObject:path
forKey:RootBuildDirectory];
[preferencesDict setObject:path forKey:RootBuildDirectory];
[preferencesDict setObject:path
forKey:RootBuildDirectory];
}
}

View file

@ -24,7 +24,8 @@
*/
// TODO: Split into several files with categories
// TODO: Take care of Libraries and Non Project Files
// TODO: Take care of Libraries(gnustep-gui, gnustep-base)
// and Non Project Files
#include <ProjectCenter/PCFileManager.h>
#include <ProjectCenter/PCProjectManager.h>
@ -305,6 +306,7 @@ NSString
NSRunAlertPanel(@"Attention!",
@"Could not keep a backup of the GNUMakefile!",
@"OK",nil,nil);
return NO;
}
}
@ -470,7 +472,7 @@ NSString
- (BOOL)close:(id)sender
{
// PCLogInfo(self, @"Closing %@ project", projectName);
PCLogInfo(self, @"Closing %@ project", projectName);
// Save visible windows and panels positions to project dictionary
if (isSubproject == NO)
@ -527,6 +529,12 @@ NSString
return NO;
}
// Project Builder
/* if (projectBuilder)
{
[projectBuilder release];
}*/
// Project window
if (sender != projectWindow)
{

View file

@ -48,7 +48,7 @@
- (void)awakeFromNib
{
NSScrollView *errorScroll;
NSScrollView *scrollView2;
NSScrollView *logScroll;
[componentView retain];
[componentView removeFromSuperview];
@ -65,7 +65,7 @@
[installButton setToolTip:@"Install"];
// [installButton setImage:IMAGE(@"Install")];
[optionsButton setToolTip:@"Options"];
[optionsButton setToolTip:@"Build Options"];
// [optionsButton setImage:IMAGE(@"Options")];
[errorsCountField setStringValue:@""];
@ -82,24 +82,26 @@
errorColumn = [[NSTableColumn alloc] initWithIdentifier:@"Error"];
[errorColumn setEditable:NO];
errorOutputTable = [[NSTableView alloc]
errorOutput = [[NSTableView alloc]
initWithFrame:NSMakeRect(0,0,209,111)];
[errorOutputTable setAllowsMultipleSelection:NO];
[errorOutputTable setAllowsColumnReordering:NO];
[errorOutputTable setAllowsColumnResizing:NO];
[errorOutputTable setAllowsEmptySelection:YES];
[errorOutputTable setAllowsColumnSelection:NO];
[errorOutputTable setRowHeight:19.0];
[errorOutputTable setCornerView:nil];
[errorOutputTable setHeaderView:nil];
[errorOutputTable addTableColumn:errorImageColumn];
[errorOutputTable addTableColumn:errorColumn];
[errorOutputTable setDataSource:self];
[errorOutputTable setBackgroundColor:[NSColor colorWithDeviceRed:0.88
[errorOutput setAllowsMultipleSelection:NO];
[errorOutput setAllowsColumnReordering:NO];
[errorOutput setAllowsColumnResizing:NO];
[errorOutput setAllowsEmptySelection:YES];
[errorOutput setAllowsColumnSelection:NO];
[errorOutput setRowHeight:19.0];
[errorOutput setCornerView:nil];
[errorOutput setHeaderView:nil];
[errorOutput addTableColumn:errorImageColumn];
[errorOutput addTableColumn:errorColumn];
[errorOutput setDataSource:self];
[errorOutput setBackgroundColor:[NSColor colorWithDeviceRed:0.88
green:0.76
blue:0.60
alpha:1.0]];
[errorOutputTable setDrawsGrid:NO];
[errorOutput setDrawsGrid:NO];
[errorOutput setTarget:self];
[errorOutput setAction:@selector(errorItemClick:)];
errorScroll = [[NSScrollView alloc] initWithFrame:NSMakeRect(0,0,464,120)];
[errorScroll setHasHorizontalScroller:NO];
@ -107,55 +109,37 @@
[errorScroll setBorderType:NSBezelBorder];
[errorScroll setAutoresizingMask:(NSViewWidthSizable | NSViewHeightSizable)];
/* errorOutput = [[NSTextView alloc]
initWithFrame:[[scrollView1 contentView] frame]];
[errorOutput setRichText:NO];
[errorOutput setEditable:NO];
[errorOutput setSelectable:YES];
[errorOutput setAutoresizingMask: NSViewWidthSizable | NSViewHeightSizable];
[errorOutput setBackgroundColor:[NSColor colorWithDeviceRed:0.88
green:0.76
blue:0.60
alpha:1.0]];
[errorOutput setHorizontallyResizable:NO];
[errorOutput setVerticallyResizable:YES];
[errorOutput setMinSize:NSMakeSize(0, 0)];
[errorOutput setMaxSize:NSMakeSize(1E7, 1E7)];
[[errorOutput textContainer] setContainerSize:
NSMakeSize([errorOutput frame].size.width, 1e7)];
[[errorOutput textContainer] setWidthTracksTextView:YES];*/
[errorScroll setDocumentView:errorOutputTable];
RELEASE(errorOutputTable);
[errorScroll setDocumentView:errorOutput];
RELEASE(errorOutput);
/*
* Log output
*/
scrollView2 = [[NSScrollView alloc]
logScroll = [[NSScrollView alloc]
initWithFrame:NSMakeRect (0, 0, 480, 133)];
[scrollView2 setHasHorizontalScroller:NO];
[scrollView2 setHasVerticalScroller:YES];
[scrollView2 setBorderType: NSBezelBorder];
[scrollView2 setAutoresizingMask:(NSViewWidthSizable | NSViewHeightSizable)];
[logScroll setHasHorizontalScroller:NO];
[logScroll setHasVerticalScroller:YES];
[logScroll setBorderType:NSBezelBorder];
[logScroll setAutoresizingMask:(NSViewWidthSizable | NSViewHeightSizable)];
logOutput = [[NSTextView alloc]
initWithFrame:[[scrollView2 contentView] frame]];
initWithFrame:[[logScroll contentView] frame]];
[logOutput setRichText:NO];
[logOutput setEditable:NO];
[logOutput setSelectable:YES];
[logOutput setAutoresizingMask: NSViewWidthSizable | NSViewHeightSizable];
[logOutput setBackgroundColor: [NSColor lightGrayColor]];
[logOutput setAutoresizingMask:NSViewWidthSizable | NSViewHeightSizable];
[logOutput setBackgroundColor:[NSColor lightGrayColor]];
[[logOutput textContainer] setWidthTracksTextView:YES];
[[logOutput textContainer] setHeightTracksTextView:YES];
[logOutput setHorizontallyResizable:NO];
[logOutput setVerticallyResizable:YES];
[logOutput setMinSize:NSMakeSize (0, 0)];
[logOutput setMaxSize:NSMakeSize (1E7, 1E7)];
[logOutput setMinSize:NSMakeSize(0, 0)];
[logOutput setMaxSize:NSMakeSize(1E7, 1E7)];
[[logOutput textContainer] setContainerSize:
NSMakeSize ([logOutput frame].size.width, 1e7)];
[[logOutput textContainer] setWidthTracksTextView:YES];
[scrollView2 setDocumentView:logOutput];
[logScroll setDocumentView:logOutput];
RELEASE(logOutput);
/*
@ -163,8 +147,8 @@
*/
[split addSubview:errorScroll];
RELEASE (errorScroll);
[split addSubview:scrollView2];
RELEASE (scrollView2);
[split addSubview:logScroll];
RELEASE (logScroll);
// [split adjustSubviews];
// [componentView addSubview:split];
@ -293,8 +277,6 @@
_isBuilding = NO;
_isCleaning = NO;
makePath = [[NSUserDefaults standardUserDefaults] objectForKey:BuildTool];
if ([NSBundle loadNibNamed:@"Builder" owner:self] == NO)
{
PCLogError(self, @"error loading Builder NIB file!");
@ -329,6 +311,21 @@
return componentView;
}
- (BOOL)setMakePath
{
makePath = [[NSUserDefaults standardUserDefaults] objectForKey:BuildTool];
if (!makePath || ![[NSFileManager defaultManager] fileExistsAtPath:makePath])
{
NSRunAlertPanel(@"Build terminated",
@"Build tool not found.\nFile \"%@\" doesn't exist!",
@"OK", nil, nil, makePath);
return NO;
}
return YES;
}
// --- Accessory
- (BOOL)isBuilding
{
@ -374,7 +371,7 @@
NSString *tFString = [targetField stringValue];
NSArray *tFArray = [tFString componentsSeparatedByString:@" "];
if ([self stopBuild:self] == YES)
if ([self stopMake:self] == YES)
{// We've just stopped build process
return;
}
@ -400,6 +397,10 @@
nextEL = ELNone;
lastIndentString = @"";
currentBuildPath = [[NSMutableArray alloc] initWithCapacity:1];
[currentBuildPath addObject:[currentProject projectPath]];
currentBuildFile = [[NSMutableString alloc] initWithString:@""];
statusString = [NSString stringWithString:@"Building..."];
[buildTarget setString:@"Build"];
[cleanButton setEnabled:NO];
@ -408,7 +409,51 @@
_isBuilding = YES;
}
- (BOOL)stopBuild:(id)sender
- (void)startClean:(id)sender
{
if ([self stopMake:self] == YES)
{// We've just stopped build process
return;
}
if ([[[[NSUserDefaults standardUserDefaults] dictionaryRepresentation]
objectForKey:PromptOnClean] isEqualToString:@"YES"])
{
if (NSRunAlertPanel(@"Clean Project?",
@"Do you really want to clean project '%@'?",
@"Yes", @"No", nil, [currentProject projectName])
== NSAlertAlternateReturn)
{
[cleanButton setState:NSOffState];
return;
}
}
statusString = [NSString stringWithString:@"Cleaning..."];
[buildTarget setString:@"Clean"];
[buildArgs addObject:@"clean"];
[buildButton setEnabled:NO];
[installButton setEnabled:NO];
[self build:self];
_isCleaning = YES;
}
- (void)startInstall:(id)sender
{
if ([self stopMake:self] == YES)
{// We've just stopped build process
return;
}
[buildTarget setString:@"Install"];
statusString = [NSString stringWithString:@"Installing..."];
[buildArgs addObject:@"install"];
[buildButton setEnabled:NO];
[cleanButton setEnabled:NO];
[self build:self];
}
- (BOOL)stopMake:(id)sender
{
// [makeTask isRunning] doesn't work here.
// "waitpid 7045, result -1, error No child processes" is printed.
@ -430,37 +475,45 @@
return NO;
}
- (void)startClean:(id)sender
- (void)cleanupAfterMake
{
if ([[[[NSUserDefaults standardUserDefaults] dictionaryRepresentation]
objectForKey:PromptOnClean] isEqualToString:@"YES"])
if (_isBuilding || _isCleaning)
{
if (NSRunAlertPanel(@"Clean Project?",
@"Do you really want to clean project '%@'?",
@"Yes", @"No", nil, [currentProject projectName])
== NSAlertAlternateReturn)
[buildStatusField setStringValue:[NSString stringWithFormat:
@"%@ - %@ terminated", [currentProject projectName], buildTarget]];
}
// Restore buttons state
if ([buildTarget isEqualToString:@"Build"])
{
[buildButton setState:NSOffState];
[cleanButton setEnabled:YES];
[installButton setEnabled:YES];
}
else if ([buildTarget isEqualToString:@"Clean"])
{
[cleanButton setState:NSOffState];
return;
[buildButton setEnabled:YES];
[installButton setEnabled:YES];
}
else if ([buildTarget isEqualToString:@"Install"])
{
[installButton setState:NSOffState];
[buildButton setEnabled:YES];
[cleanButton setEnabled:YES];
}
statusString = [NSString stringWithString:@"Cleaning..."];
[buildTarget setString:@"Clean"];
[buildArgs addObject:@"clean"];
[buildButton setEnabled:NO];
[installButton setEnabled:NO];
[self build:self];
_isCleaning = YES;
}
- (void)startInstall:(id)sender
{
[buildTarget setString:@"Install"];
statusString = [NSString stringWithString:@"Installing..."];
[buildArgs addObject:@"install"];
[buildButton setEnabled:NO];
[cleanButton setEnabled:NO];
[self build:self];
[buildArgs removeAllObjects];
[buildTarget setString:@"Default"];
if (_isBuilding)
{
[currentBuildPath release];
[currentBuildFile release];
}
_isBuilding = NO;
_isCleaning = NO;
}
- (void)showOptionsPanel:(id)sender
@ -472,52 +525,10 @@
[optionsPanel orderFront:nil];
}
- (void)updateErrorsCountField
{
NSString *string;
NSString *errorsString = [NSString stringWithString:@""];;
NSString *warningsString = [NSString stringWithString:@""];
if (errorsCount > 0)
{
if (errorsCount > 1)
{
errorsString = [NSString stringWithFormat:@"%i errors",
errorsCount];
}
else
{
errorsString = [NSString stringWithString:@"1 error"];
}
}
if (warningsCount > 0)
{
if (warningsCount > 1)
{
warningsString = [NSString stringWithFormat:@"%i warnings",
warningsCount];
}
else
{
warningsString = [NSString stringWithString:@"1 warning"];
}
}
string = [NSString stringWithFormat:@"%@ %@", errorsString, warningsString];
[errorsCountField setStringValue:string];
}
// --- Actions
- (void)build:(id)sender
- (BOOL)prebuildCheck
{
NSPipe *logPipe;
NSPipe *errorPipe;
// NSDictionary *env = [[NSProcessInfo processInfo] environment];
//TODO: Support build options!!!
//NSDictionary *optionDict = [currentProject buildOptions];
// Checking prerequisites
if ([currentProject isProjectChanged])
{
@ -534,6 +545,37 @@
[currentProject save];
}
// Get make tool path
makePath = [[NSUserDefaults standardUserDefaults] objectForKey:BuildTool];
if (!makePath || ![[NSFileManager defaultManager] fileExistsAtPath:makePath])
{
NSRunAlertPanel(@"Build terminated",
@"Build tool not found.\nFile \"%@\" doesn't exist!",
@"OK", nil, nil, makePath);
return NO;
}
// Create root build directory if not exist
return YES;
}
- (void)build:(id)sender
{
NSPipe *logPipe;
NSPipe *errorPipe;
// TODO: Support build options!!!
// NSDictionary *optionDict = [currentProject buildOptions];
// Checking build conditions
if ([self prebuildCheck] == NO)
{
[self cleanupAfterMake];
return;
}
// Prepearing to building
logPipe = [NSPipe pipe];
readHandle = [logPipe fileHandleForReading];
@ -563,7 +605,7 @@
// Run make task
[logOutput setString:@""];
[errorArray removeAllObjects];
[errorOutputTable reloadData];
[errorOutput reloadData];
[NOTIFICATION_CENTER addObserver:self
selector:@selector(buildDidTerminate:)
@ -630,7 +672,7 @@
{
[[NSRunLoop currentRunLoop] runMode:NSDefaultRunLoopMode
beforeDate:[NSDate distantFuture]];
};
}
[self updateErrorsCountField];
@ -652,38 +694,17 @@
if (errorsCount > 0)
{
[buildStatusField setStringValue:[NSString stringWithFormat:
@"%@ - %@ unsuccessful (%i errors)",
@"%@ - %@ failed (%i errors)",
[currentProject projectName], buildTarget, errorsCount]];
}
else
{
[buildStatusField setStringValue:[NSString stringWithFormat:
@"%@ - %@ unsuccessful",
@"%@ - %@ failed",
[currentProject projectName], buildTarget]];
}
}
// Rstore buttons state
if ([buildTarget isEqualToString:@"Build"])
{
[buildButton setState:NSOffState];
[cleanButton setEnabled:YES];
[installButton setEnabled:YES];
}
else if ([buildTarget isEqualToString:@"Clean"])
{
[cleanButton setState:NSOffState];
[buildButton setEnabled:YES];
[installButton setEnabled:YES];
}
else if ([buildTarget isEqualToString:@"Install"])
{
[installButton setState:NSOffState];
[buildButton setEnabled:YES];
[cleanButton setEnabled:YES];
}
// Run post process if configured
/* if (status && postProcess)
{
@ -691,11 +712,9 @@
postProcess = NULL;
}*/
[buildArgs removeAllObjects];
[buildTarget setString:@"Default"];
_isBuilding = NO;
_isCleaning = NO;
[self cleanupAfterMake];
}
- (void)popupChanged:(id)sender
@ -758,6 +777,42 @@
}
}
- (void)updateErrorsCountField
{
NSString *string;
NSString *errorsString = [NSString stringWithString:@""];;
NSString *warningsString = [NSString stringWithString:@""];
if (errorsCount > 0)
{
if (errorsCount > 1)
{
errorsString = [NSString stringWithFormat:@"%i errors",
errorsCount];
}
else
{
errorsString = [NSString stringWithString:@"1 error"];
}
}
if (warningsCount > 0)
{
if (warningsCount > 1)
{
warningsString = [NSString stringWithFormat:@"%i warnings",
warningsCount];
}
else
{
warningsString = [NSString stringWithString:@"1 warning"];
}
}
string = [NSString stringWithFormat:@"%@ %@", errorsString, warningsString];
[errorsCountField setStringValue:string];
}
@end
@implementation PCProjectBuilder (BuildLogging)
@ -790,39 +845,18 @@
- (void)logData:(NSData *)data
error:(BOOL)yn
{
NSString *s = nil;
s = [[NSString alloc] initWithData:data
encoding:[NSString defaultCStringEncoding]];
if (yn)
{
[self logErrorString:s];
}
else
{
[self logString:s error:yn newLine:NO];
}
RELEASE(s);
}
@end
@implementation PCProjectBuilder (ErrorLogging)
- (void)logErrorString:(NSString *)string
{
NSString *dataString;
NSRange newLineRange;
NSRange lineRange;
NSArray *items;
NSString *lineString;
// Send it to standard out anyway to see all make process errors
[self logString:string error:NO newLine:NO];
dataString = [[NSString alloc]
initWithData:data
encoding:[NSString defaultCStringEncoding]];
// Process new data
lineRange.location = 0;
[errorString appendString:string];
[errorString appendString:dataString];
while (newLineRange.location != NSNotFound)
{
newLineRange = [errorString rangeOfString:@"\n"];
@ -836,13 +870,19 @@
// NSLog(@"<------%@------>", errorString);
lineRange.length = newLineRange.location+1;
string = [errorString substringWithRange:lineRange];
items = [self parseErrorLine:string];
if (items)
{
[self addItems:items];
}
lineString = [errorString substringWithRange:lineRange];
[errorString deleteCharactersInRange:lineRange];
// Send it
if (_isBuilding)
{
[self parseBuildLine:lineString];
if (yn)
{
[self logErrorString:lineString];
}
}
[self logString:lineString error:yn newLine:NO];
}
else
{
@ -850,15 +890,64 @@
continue;
}
}
RELEASE(dataString);
}
- (void)addItems:(NSArray *)items
- (void)parseBuildLine:(NSString *)string
{
[errorArray addObjectsFromArray:items];
[errorOutputTable reloadData];
[errorOutputTable scrollRowToVisible:[errorArray count]-1];
NSArray *components = [string componentsSeparatedByString:@" "];
if (!components)
{
return;
}
if ([components containsObject:@"Compiling"] &&
[components containsObject:@"file"])
{
NSLog(@"Current build file: %@", [components objectAtIndex:3]);
[currentBuildFile setString:[components objectAtIndex:3]];
}
else if ([components containsObject:@"Entering"] &&
[components containsObject:@"directory"])
{
NSString *path;
NSString *pathComponent = [components objectAtIndex:3];
NSLog(@"Go down to %@", pathComponent);
path = [pathComponent
substringWithRange:NSMakeRange(1,[pathComponent length]-3)];
[currentBuildPath addObject:path];
NSLog(@"%@", [currentBuildPath lastObject]);
}
else if ([components containsObject:@"Leaving"] &&
[components containsObject:@"directory"])
{
NSLog(@"Go up from %@", [components objectAtIndex:3]);
[currentBuildPath removeLastObject];
NSLog(@"%@", [currentBuildPath lastObject]);
}
}
@end
@implementation PCProjectBuilder (ErrorLogging)
- (void)logErrorString:(NSString *)string
{
NSArray *items;
items = [self parseErrorLine:string];
if (items)
{
[errorArray addObjectsFromArray:items];
[errorOutput reloadData];
[errorOutput scrollRowToVisible:[errorArray count]-1];
}
}
- (NSString *)lineTail:(NSString*)line afterString:(NSString*)string
{
NSRange substrRange;
@ -884,7 +973,7 @@
NSString *message = [NSString stringWithString:@""];
NSMutableArray *items = [NSMutableArray arrayWithCapacity:1];
NSMutableDictionary *errorItem;
NSString *indentString = @" ";
NSString *indentString = @"\t";
NSString *lastFile = @"";
NSString *lastIncludedFile = @"";
@ -914,8 +1003,11 @@
{
// NSLog(@"In file included from ");
currentEL = ELIncluded;
return nil;
file = [self lineTail:[components objectAtIndex:0]
afterString:@"In file included from "];
file = [[currentBuildPath lastObject]
stringByAppendingPathComponent:file];
if ([file isEqualToString:lastFile])
{
return nil;
@ -926,6 +1018,7 @@
}
else if ([string rangeOfString:@"In function '"].location != NSNotFound)
{
return nil;
file = [components objectAtIndex:0];
message = [self lineTail:string afterString:@"In function "];
currentEL = ELFunction;
@ -935,18 +1028,21 @@
currentEL = ELFile;
return nil;
}
else if ([components count] > 2)
else if ([components count] > 3)
{
unsigned typeIndex;
NSString *substr;
// file and includedFile
file = [components objectAtIndex:0];
if (lastEL == ELIncluded || [file isEqualToString:lastIncludedFile])
// file = [components objectAtIndex:0];
file = [[currentBuildPath lastObject]
stringByAppendingPathComponent:currentBuildFile];
if (lastEL == ELIncluded
|| [[components objectAtIndex:0] isEqualToString:lastIncludedFile])
{// first message after "In file included from"
// NSLog(@"Inlcuded File: %@", file);
includedFile = file;
file = lastFile;
includedFile = [components objectAtIndex:0];
file = includedFile;
currentEL = ELIncludedError;
}
else
@ -990,7 +1086,7 @@
{
if (lastEL == ELFunction)
{
indentString = @" ";
indentString = @"\t\t";
}
else if (lastEL == ELError)
{
@ -1001,37 +1097,22 @@
{
indentString = @"";
}
else if (currentEL == ELIncludedError)
/* else if (currentEL == ELIncludedError)
{
indentString = @" ";
}
indentString = @"\t\t";
}*/
message = [NSString stringWithFormat:@"%@%@", indentString, message];
lastIndentString = [indentString copy];
// Create array items
if ((lastEL == ELIncluded
|| ![includedFile isEqualToString:@""])
&& ![includedFile isEqualToString:lastIncludedFile])
{
NSString *incMessage = [NSString stringWithFormat:@" %@", includedFile];
// NSLog(@"Included: %@ != %@", includedFile, lastIncludedFile);
errorItem = [NSMutableDictionary dictionaryWithCapacity:1];
[errorItem setObject:@"" forKey:@"ErrorImage"];
[errorItem setObject:[file copy] forKey:@"File"];
[errorItem setObject:[includedFile copy] forKey:@"IncludedFile"];
[errorItem setObject:@"" forKey:@"Position"];
[errorItem setObject:@"" forKey:@"Type"];
[errorItem setObject:[incMessage copy] forKey:@"Error"];
[items addObject:errorItem];
}
else if ((lastEL == ELNone
/* else if ((lastEL == ELNone
|| ![file isEqualToString:lastFile]
|| lastEL == ELIncludedError)
&& currentEL != ELIncluded
&& currentEL != ELIncludedError)
&& currentEL != ELIncludedError)*/
if ((lastEL == ELNone || ![file isEqualToString:lastFile])
&& [includedFile isEqualToString:@""])
{
// NSLog(@"lastEL == ELNone (%@)", includedFile);
// NSLog(@"File: %@ != %@", file, lastFile);
@ -1042,7 +1123,29 @@
[errorItem setObject:@"" forKey:@"Position"];
[errorItem setObject:@"" forKey:@"Type"];
attributedString = [[NSAttributedString alloc] initWithString:file
attributedString = [[NSAttributedString alloc]
initWithString:[file lastPathComponent]
attributes:attributes];
[errorItem setObject:[attributedString copy] forKey:@"Error"];
[attributedString release];
[items addObject:errorItem];
}
if ((lastEL == ELIncluded || currentEL == ELIncludedError)
&& ![includedFile isEqualToString:lastIncludedFile])
{
NSString *incMessage = [NSString stringWithFormat:@"%@", includedFile];
// NSLog(@"Included: %@ != %@", includedFile, lastIncludedFile);
errorItem = [NSMutableDictionary dictionaryWithCapacity:1];
[errorItem setObject:@"" forKey:@"ErrorImage"];
[errorItem setObject:[file copy] forKey:@"File"];
[errorItem setObject:[includedFile copy] forKey:@"IncludedFile"];
[errorItem setObject:@"" forKey:@"Position"];
[errorItem setObject:@"" forKey:@"Type"];
attributedString = [[NSAttributedString alloc] initWithString:incMessage
attributes:attributes];
[errorItem setObject:[attributedString copy] forKey:@"Error"];
[attributedString release];
@ -1058,7 +1161,7 @@
[errorItem setObject:[type copy] forKey:@"Type"];
[errorItem setObject:[message copy] forKey:@"Error"];
// NSLog(@"Parsed message: %@ (%@)", message, includedFile);
// NSLog(@"Parsed message:%@ (%@)", message, includedFile);
[items addObject:errorItem];
@ -1067,7 +1170,7 @@
- (int)numberOfRowsInTableView:(NSTableView *)aTableView
{
if (errorArray != nil && aTableView == errorOutputTable)
if (errorArray != nil && aTableView == errorOutput)
{
return [errorArray count];
}
@ -1081,7 +1184,7 @@
{
NSDictionary *errorItem;
if (errorArray != nil && aTableView == errorOutputTable)
if (errorArray != nil && aTableView == errorOutput)
{
errorItem = [errorArray objectAtIndex:rowIndex];
@ -1091,4 +1194,16 @@
return nil;
}
- (void)errorItemClick:(id)sender
{
int rowIndex = [errorOutput selectedRow];
NSDictionary *error = [errorArray objectAtIndex:rowIndex];
NSLog(@"%i: %@(%@): %@",
rowIndex,
[error objectForKey:@"File"],
[error objectForKey:@"IncludedFile"],
[error objectForKey:@"Error"]);
}
@end

View file

@ -125,6 +125,7 @@
/* PCLogInfo(self, @"activeProjectDidChange to: %@",
[rootProject projectName]);*/
NSLog(@"activeProjectDidChange to: %@", [rootProject projectName]);
if (!rootProject)
{

View file

@ -411,7 +411,7 @@ NSString *PCEditorDidResignActiveNotification =
}
// Parser
/* parserClassName = [self classNameForBundleType:@"parser"
parserClassName = [self classNameForBundleType:@"parser"
andFile:[path lastPathComponent]];
if (parserClassName != nil)
{
@ -421,7 +421,7 @@ NSString *PCEditorDidResignActiveNotification =
inBundleType:@"parser"];
[editor setParser:parser];
RELEASE(parser);
}*/
}
[editor openFileAtPath:path
categoryPath:categoryPath

View file

@ -645,8 +645,6 @@ NSString *PCActiveProjectDidChangeNotification = @"PCActiveProjectDidChange";
{
[[project projectWindow] showProjectLoadedFiles:self];
}
[[project projectWindow] orderFront:self];
return YES;
}
@ -709,6 +707,8 @@ NSString *PCActiveProjectDidChangeNotification = @"PCActiveProjectDidChange";
if (filePath != nil)
{
[self openProjectAt:filePath];
[[activeProject projectWindow] makeKeyAndOrderFront:self];
/* NSRunAlertPanel(@"Attention!",
@"Couldn't open project %@!",
@"OK",nil,nil,
@ -921,7 +921,7 @@ NSString *PCActiveProjectDidChangeNotification = @"PCActiveProjectDidChange";
PCProject *currentProject = nil;
NSString *projectName = [aProject projectName];
currentProject = RETAIN([loadedProjects objectForKey:projectName]);
currentProject = [loadedProjects objectForKey:projectName];
if (!currentProject)
{
return;
@ -948,7 +948,7 @@ NSString *PCActiveProjectDidChangeNotification = @"PCActiveProjectDidChange";
{
[launchPanel close];
}
[self setActiveProject: nil];
[self setActiveProject:nil];
[self stopSaveTimer];
}
else if (currentProject == [self activeProject])

View file

@ -67,10 +67,10 @@
{
NSRect rect;
[buildButton setToolTip:@"Build"];
[buildButton setToolTip:@"Project Builder"];
// [buildButton setImage:IMAGE(@"Build")];
[launchButton setToolTip:@"Launch/Debug"];
[launchButton setToolTip:@"Project Launcher"];
// [launchButton setImage:IMAGE(@"Run")];
if (![project isExecutable])
{
@ -84,10 +84,10 @@
[loadedFilesButton setEnabled:NO];
}
[findButton setToolTip:@"Find"];
[findButton setToolTip:@"Project Finder"];
// [findButton setImage:IMAGE(@"Find")];
[inspectorButton setToolTip:@"Inspector"];
[inspectorButton setToolTip:@"Project Inspector"];
// [inspectorButton setImage:IMAGE(@"Inspector")];
[fileIcon setFileNameField:fileIconTitle];
@ -749,6 +749,8 @@
/* PCLogInfo(self, @"windowDidBecomeKey: activeSubproject %@",
[[project activeSubproject] projectName]);*/
NSLog(@"windowDidBecomeKey: project %@",
[project projectName]);
if ([[project projectManager] rootActiveProject] != project)
{
@ -763,7 +765,6 @@
}
}
// Workaround
if ([projectWindow isDocumentEdited])
{

View file

@ -30,6 +30,7 @@
/*
* Button
*/
@interface PCButton : NSButton
{
NSToolTipTag mainToolTip;

View file

@ -51,11 +51,9 @@ typedef enum _ErrorLevel {
NSSplitView *split;
id buildStatusField;
id targetField;
NSTextView *logOutput;
/// NSTextView *errorOutput;
// Error logging
NSTableView *errorOutputTable;
NSTableView *errorOutput;
NSTableColumn *errorImageColumn;
NSTableColumn *errorColumn;
NSMutableArray *errorArray;
@ -65,6 +63,13 @@ typedef enum _ErrorLevel {
ErrorLevel lastEL;
ErrorLevel nextEL;
NSString *lastIndentString;
int errorsCount;
int warningsCount;
// Output logging
NSTextView *logOutput;
NSMutableString *currentBuildFile;
NSMutableArray *currentBuildPath;
// Options
NSPopUpButton *popup;
@ -86,9 +91,6 @@ typedef enum _ErrorLevel {
NSFileHandle *readHandle;
NSFileHandle *errorReadHandle;
int errorsCount;
int warningsCount;
BOOL _isBuilding;
BOOL _isCleaning;
BOOL _isLogging;
@ -99,6 +101,7 @@ typedef enum _ErrorLevel {
- (void)dealloc;
- (NSView *)componentView;
- (BOOL)setMakePath;
// --- Accessory
- (BOOL)isBuilding;
@ -109,8 +112,12 @@ typedef enum _ErrorLevel {
// --- Actions
- (void)startBuild:(id)sender;
- (BOOL)stopBuild:(id)sender;
- (void)startClean:(id)sender;
- (void)startInstall:(id)sender;
- (BOOL)stopMake:(id)sender;
- (void)cleanupAfterMake;
- (BOOL)prebuildCheck;
- (void)build:(id)sender;
//- (void)buildDidTerminate;
@ -119,6 +126,8 @@ typedef enum _ErrorLevel {
- (void)logStdOut:(NSNotification *)aNotif;
- (void)logErrOut:(NSNotification *)aNotif;
- (void)updateErrorsCountField;
@end
@interface PCProjectBuilder (UserInterface)
@ -129,6 +138,8 @@ typedef enum _ErrorLevel {
@interface PCProjectBuilder (BuildLogging)
- (void)parseBuildLine:(NSString *)string;
- (void)logString:(NSString *)string error:(BOOL)yn newLine:(BOOL)newLine;
- (void)logData:(NSData *)data error:(BOOL)yn;
@ -137,7 +148,6 @@ typedef enum _ErrorLevel {
@interface PCProjectBuilder (ErrorLogging)
- (void)logErrorString:(NSString *)string;
- (void)addItems:(NSArray *)items;
- (NSString *)lineTail:(NSString*)line afterString:(NSString*)string;
- (NSArray *)parseErrorLine:(NSString *)string;

View file

@ -472,7 +472,7 @@
NSEnumerator *enumerator;
NSDictionary *method;
NSDictionary *class;
NSMutableArray *items;
NSMutableArray *items = [NSMutableArray array];
NSLog(@"PCEditor: asked for browser items for: %@", item);
@ -484,7 +484,6 @@
{
ASSIGN(parserClasses, [aParser classNames]);
items = [NSMutableArray array];
enumerator = [parserClasses objectEnumerator];
while ((class = [enumerator nextObject]))
{
@ -498,7 +497,6 @@
{
ASSIGN(parserMethods, [aParser methodNames]);
items = [NSMutableArray array];
enumerator = [parserMethods objectEnumerator];
while ((method = [enumerator nextObject]))
{

View file

@ -21,6 +21,7 @@
*/
#include <ProjectCenter/PCPrefController.h>
#include <ProjectCenter/PCLogController.h>
#include <ProjectCenter/PCFileManager.h>
#include "PCAppController.h"
#include "PCMenuController.h"
@ -123,7 +124,7 @@
- (void)applicationDidFinishLaunching:(NSNotification *)notification
{
NSString *connectionName = [NSString stringWithFormat:@"ProjectCenter"];
// NSString *connectionName = [NSString stringWithFormat:@"ProjectCenter"];
if ([[prefController objectForKey:DisplayLog] isEqualToString:@"YES"])
{
@ -180,21 +181,30 @@
- (void)applicationWillTerminate:(NSNotification *)notification
{
NSUserDefaults *ud = [NSUserDefaults standardUserDefaults];
NSFileManager *fm;
PCFileManager *pcfm;
NSString *rootBuildDir;
NSArray *rootBuildDirList;
#ifdef DEVELOPMENT
NSLog (@"--- Application WILL terminate");
#endif
/*
if ([[[NSUserDefaults standardUserDefaults]
stringForKey:DeleteCacheWhenQuitting] isEqualToString:@"YES"])
{
[[NSFileManager defaultManager]
removeFileAtPath:[projectManager rootBuildPath]
handler:nil];
}
*/
[[NSUserDefaults standardUserDefaults] synchronize];
if ([[ud stringForKey:DeleteCacheWhenQuitting] isEqualToString:@"YES"])
{
fm = [NSFileManager defaultManager];
pcfm = [PCFileManager defaultManager];
rootBuildDir = [prefController objectForKey:RootBuildDirectory];
rootBuildDirList = [fm directoryContentsAtPath:rootBuildDir];
NSLog(@"The following files will be removed from directory \"%@\": %@",
rootBuildDir, rootBuildDirList);
[pcfm removeFiles:rootBuildDirList fromDirectory:rootBuildDir];
}
[ud synchronize];
//--- Cleanup
if (doConnection)