Commit 2e0c90c6 authored by Yavor Doganov's avatar Yavor Doganov

Import Upstream version 0.6.2

parent d2b2ec5d
.gwdir
*.swp
*~
*.app
*.bundle
*.framework
*obj
derived_src
ProjectCenter
This diff is collapsed.
......@@ -7,7 +7,7 @@
"findNext:",
"findPrevious:",
"findShowPanel:",
"newAction:"
"performGoToLinePanelAction:"
);
Super = NSObject;
};
......
......@@ -10,6 +10,13 @@
);
Super = NSObject;
};
PCAuxiliaryWindow = {
Actions = (
);
Outlets = (
);
Super = NSWindow;
};
PCProjectBuilderPanel = {
Actions = (
);
......
......@@ -6,6 +6,13 @@
);
Super = NSObject;
};
PCAuxiliaryWindow = {
Actions = (
);
Outlets = (
);
Super = NSWindow;
};
SaveModifiedFilesDelegate = {
Actions = (
"buttonClicked:"
......
......@@ -7,9 +7,9 @@ include $(GNUSTEP_MAKEFILES)/common.make
#
# Framework
#
VERSION = 0.6.0
VERSION = 0.6.2
FRAMEWORK_NAME = ProjectCenter
ProjectCenter_CURRENT_VERSION_NAME = 0.6.0
ProjectCenter_CURRENT_VERSION_NAME = 0.6.2
ProjectCenter_DEPLOY_WITH_CURRENT_VERSION = yes
ProjectCenter_HEADER_FILES_DIR = ../Headers/ProjectCenter
......@@ -53,7 +53,9 @@ ProjectCenter_HEADER_FILES = \
PCFileNameField.h \
PCFileNameIcon.h \
\
PCLogController.h
PCLogController.h \
\
PCAuxiliaryWindow.h
#
# Class files
......@@ -87,7 +89,9 @@ ProjectCenter_OBJC_FILES = \
PCFileNameField.m \
PCFileNameIcon.m \
\
PCLogController.m
PCLogController.m \
\
PCAuxiliaryWindow.m
#
# Resources
......
/*
GNUstep ProjectCenter - http://www.gnustep.org/experience/ProjectCenter.html
Copyright (C) 2004-2011 Free Software Foundation
Copyright (C) 2004-2014 Free Software Foundation
Authors: Serg Stoyan
Riccardo Mottola
......@@ -107,9 +107,9 @@ static PCAddFilesPanel *addFilesPanel = nil;
{
NSString *category = [fileTypePopup titleOfSelectedItem];
if ([_delegate respondsToSelector:@selector(categoryChangedTo:)])
if ([[self delegate] respondsToSelector:@selector(categoryChangedTo:)])
{
[_delegate categoryChangedTo:category];
[[self delegate] categoryChangedTo:category];
}
}
......
/*
PCAuxiliaryWindow.m
Author: German A. Arias <germanandre@gmx.es>
Date: September 2013
This file is part of ProjectCenter.
ProjectCenter 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 3 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 <ProjectCenter/PCAuxiliaryWindow.h>
@implementation PCAuxiliaryWindow
- (BOOL) canBecomeMainWindow
{
return NO;
}
@end
/*
GNUstep ProjectCenter - http://www.gnustep.org/experience/ProjectCenter.html
Copyright (C) 2003-2004 Free Software Foundation
Copyright (C) 2003-2014 Free Software Foundation
Authors: Serg Stoyan
......@@ -34,10 +34,8 @@
// ==== Main
// ============================================================================
//- (id)initWithFrame:(NSRect)frameRect
- (id)initWithCoder:(NSCoder *)coder
{
// NSLog(@"PCButton: initWithCoder");
self = [super initWithCoder:coder];
[_cell setGradientType:NSGradientConcaveWeak];
[_cell setImageDimsWhenDisabled:YES];
......@@ -64,11 +62,7 @@
}
- (void)dealloc
{
#ifdef DEVELOPMENT
NSLog(@"PCButton %@: dealloc", [self stringValue]);
#endif
{
[[NSNotificationCenter defaultCenter] removeObserver:self];
if (_hasTooltips)
......@@ -82,7 +76,7 @@
[super dealloc];
}
- (void)release
- (oneway void)release
{
// If retain count is number of tracking rects + superview retain,
// remove tracking rects. It seems that tracking rects retain this object.
......
/*
GNUstep ProjectCenter - http://www.gnustep.org/experience/ProjectCenter.html
Copyright (C) 2002-2004 Free Software Foundation
Copyright (C) 2002-2014 Free Software Foundation
Authors: Philippe C.D. Robert
Serg Stoyan
Riccardo Mottola
This file is part of GNUstep.
......@@ -534,7 +535,7 @@ NSString *PCEditorDidResignActiveNotification =
editable: YES
windowed: NO];
[self orderFrontEditorForFile:filePath];
[editor scrollToLineNumber: [line intValue]];
[editor scrollToLineNumber: [line integerValue]];
}
@end
......
/*
GNUstep ProjectCenter - http://www.gnustep.org/experience/ProjectCenter.html
Copyright (C) 2001-2004 Free Software Foundation
Copyright (C) 2001-2013 Free Software Foundation
Authors: Philippe C.D. Robert
Serg Stoyan
Riccardo Mottola
This file is part of GNUstep.
......@@ -55,10 +56,9 @@ static NSDictionary *dict = nil;
// Setting up the dictionary needed for registration!
// Objective C Class
descr = [NSString stringWithString:
@"Generic Objective-C class.\n\n"
@"This is a plain subclass of NSObject which includes"
@" only Foundation.h."];
descr = @"Generic Objective-C class.\n\n"
@"This is a plain subclass of NSObject which includes"
@" only Foundation.h.";
template = [bundle pathForResource:@"class" ofType:@"template"];
classDict = [NSDictionary dictionaryWithObjectsAndKeys:
PCClasses, @"ProjectKey",
......@@ -67,10 +67,9 @@ static NSDictionary *dict = nil;
nil];
// Objective C Header
descr = [NSString stringWithString:
@"Generic Objective-C header.\n\n"
@"This is a plain interface subclassing NSObject."
@" The file includes Foundation.h"];
descr = @"Generic Objective-C header.\n\n"
@"This is a plain interface subclassing NSObject."
@" The file includes Foundation.h";
template = [bundle pathForResource:@"header" ofType:@"template"];
headerDict =[NSDictionary dictionaryWithObjectsAndKeys:
PCHeaders,@"ProjectKey",
......@@ -79,9 +78,8 @@ static NSDictionary *dict = nil;
nil];
// C File
descr = [NSString stringWithString:
@"Generic ANSI-C implementation file.\n\n"
@"This file contains no Objective-C dependency in any form."];
descr = @"Generic ANSI-C implementation file.\n\n"
@"This file contains no Objective-C dependency in any form.";
template = [bundle pathForResource:@"cfile" ofType:@"template"];
ccDict = [NSDictionary dictionaryWithObjectsAndKeys:
PCOtherSources,@"ProjectKey",
......@@ -90,9 +88,8 @@ static NSDictionary *dict = nil;
nil];
// C Header
descr = [NSString stringWithString:
@"Generic ANSI-C header.\n\n"
@"This file contains no Objective-C dependency in any form."];
descr = @"Generic ANSI-C header.\n\n"
@"This file contains no Objective-C dependency in any form.";
template = [bundle pathForResource:@"cheader" ofType:@"template"];
chDict = [NSDictionary dictionaryWithObjectsAndKeys:
PCHeaders,@"ProjectKey",
......@@ -101,10 +98,9 @@ static NSDictionary *dict = nil;
nil];
// Objective C Protocol
descr = [NSString stringWithString:
@"Generic Objective-C protocol.\n\n"
@"This is common Objective-C protocol, comparable"
@" i.e. to a Java interface."];
descr = @"Generic Objective-C protocol.\n\n"
@"This is common Objective-C protocol, comparable"
@" i.e. to a Java interface.";
template = [bundle pathForResource:@"protocol" ofType:@"template"];
protocolDict = [NSDictionary dictionaryWithObjectsAndKeys:
PCHeaders,@"ProjectKey",
......@@ -113,9 +109,8 @@ static NSDictionary *dict = nil;
nil];
// GSMarkup
descr = [NSString stringWithString:
@"Generic GSMarkup File.\n\n"
@"This is the interface description of GNUstep Renaissance."];
descr = @"Generic GSMarkup File.\n\n"
@"This is the interface description of GNUstep Renaissance.";
template = [bundle pathForResource:@"gsmarkup" ofType:@"template"];
gsmarkupDict =[NSDictionary dictionaryWithObjectsAndKeys:
PCGSMarkupFiles,@"ProjectKey",
......@@ -255,11 +250,13 @@ static NSDictionary *dict = nil;
key = [fileType objectForKey:@"ProjectKey"];
template = [fileType objectForKey:@"TemplateFile"];
[pcfm copyFile:template toFile:newFile];
[self replaceTagsInFileAtPath:newFile withProject:aProject];
[aProject addFiles:[NSArray arrayWithObject:newFile]
forKey:key
notify:YES];
if ([pcfm copyFile:template toFile:newFile])
{
[self replaceTagsInFileAtPath:newFile withProject:aProject];
[aProject addFiles:[NSArray arrayWithObject:newFile]
forKey:key
notify:YES];
}
}
// Notify the browser!
......@@ -281,7 +278,13 @@ static NSDictionary *dict = nil;
NSString *fn = [aFile stringByDeletingPathExtension];
NSRange subRange;
#ifdef WIN32
file = [[NSMutableString stringWithContentsOfFile: newFile
encoding: NSUTF8StringEncoding
error: NULL] retain];
#else
file = [[NSMutableString stringWithContentsOfFile:newFile] retain];
#endif
while ((subRange = [file rangeOfString:@"$FULLFILENAME$"]).length)
{
......@@ -324,8 +327,16 @@ static NSDictionary *dict = nil;
withString:[[NSNumber numberWithInt:year] stringValue]];
}
#ifdef WIN32
[file writeToFile: newFile
atomically: YES
encoding: NSUTF8StringEncoding
error: NULL];
#else
[file writeToFile:newFile atomically:YES];
[file autorelease];
#endif
[file release];
}
@end
......@@ -446,9 +457,6 @@ static NSDictionary *dict = nil;
NSFileManager *fm = [NSFileManager defaultManager];
BOOL complementary;
/* NSLog(@"PCFileCreator: [createFile] %@ in category: %@",
fileName, projectKey);*/
path = [[activeProject projectPath] stringByAppendingPathComponent:fileName];
// Create file
if (path)
......
......@@ -330,6 +330,41 @@ static PCFileManager *_mgr = nil;
return YES;
}
// ===========================================================================
// ==== Find Executable
// Tries to find the first matching executable tool fromt he given, nil-terminated
// list. Returns the full path for it.
// ===========================================================================
- (NSString*) findExecutableToolFrom: (NSArray*)candidates
{
NSFileManager *manager;
NSEnumerator *pathEnumerator;
NSString *directory;
manager = [NSFileManager defaultManager];
pathEnumerator = [NSSearchPathForDirectoriesInDomains(NSDeveloperDirectory, NSAllDomainsMask, YES) objectEnumerator];
while (nil != (directory = [pathEnumerator nextObject]))
{
NSEnumerator *candidateEnumerator = [candidates objectEnumerator];
NSString *candidate;
while (nil != (candidate = [candidateEnumerator nextObject]))
{
NSString *path = [directory stringByAppendingPathComponent: candidate];
NSLog(@"final candidate path is: %@", path);
if ([manager isExecutableFileAtPath: path])
{
return path;
}
}
}
return nil;
}
@end
@implementation PCFileManager (UInterface)
......@@ -608,9 +643,11 @@ static PCFileManager *_mgr = nil;
{
NSFileHandle *fh;
NSData *data;
unsigned int i, n;
const char *buf;
unsigned int printable;
NSUInteger i, printable = 0;
NSString *content;
NSCharacterSet *alpha = [NSCharacterSet alphanumericCharacterSet];
NSCharacterSet *spaces = [NSCharacterSet whitespaceAndNewlineCharacterSet];
NSCharacterSet *marks = [NSCharacterSet punctuationCharacterSet];
fh = [NSFileHandle fileHandleForReadingAtPath:filename];
if (fh == nil)
......@@ -624,16 +661,18 @@ static PCFileManager *_mgr = nil;
return YES;
}
buf = [data bytes];
for (i = printable = 0, n = [data length]; i < n; i++)
content = [NSString stringWithContentsOfFile: filename];
for (i = 0; i < [content length]; i++)
{
if (isprint((int)(unsigned char)buf[i]) || isspace((int)(unsigned char)buf[i]))
if ([alpha characterIsMember: [content characterAtIndex: i]] ||
[spaces characterIsMember: [content characterAtIndex: i]] ||
[marks characterIsMember: [content characterAtIndex: i]])
{
printable++;
}
}
return (((double) printable / n) > 0.9);
return (((double) printable / i) > 0.9);
}
- (NSArray *)filesWithExtension:(NSString *)extension
......
......@@ -126,11 +126,11 @@
// --- NSDraggingDestination protocol methods
// -- Before the image is released
- (unsigned int)draggingEntered:(id <NSDraggingInfo>)sender
- (NSDragOperation)draggingEntered:(id <NSDraggingInfo>)sender
{
NSPasteboard *pb = [sender draggingPasteboard];
NSArray *paths = [pb propertyListForType:NSFilenamesPboardType];
unsigned int draggingOp = NSDragOperationNone;
NSDragOperation draggingOp = NSDragOperationNone;
// NSLog(@"Dragging entered: %@", paths);
......@@ -206,7 +206,7 @@
// --- NSDraggingSource protocol methods
- (unsigned int)draggingSourceOperationMaskForLocal:(BOOL)isLocal
- (NSDragOperation)draggingSourceOperationMaskForLocal:(BOOL)isLocal
{
return NSDragOperationCopy;
}
......
......@@ -429,7 +429,7 @@ static PCMakefileFactory *_factory = nil;
int count = [array count];
NSString *string = nil;
NSString *item = nil;
NSString *eol = [NSString stringWithString: @"\\\n"];
NSString *eol = @"\\\n";
if (array == nil || count <= 0)
{
......@@ -449,7 +449,7 @@ static PCMakefileFactory *_factory = nil;
[self appendString:string];
if (i == (count-2))
{
eol = [NSString stringWithString: @"\n"];
eol = @"\n";
}
}
}
......@@ -471,7 +471,7 @@ static PCMakefileFactory *_factory = nil;
NSString *langs = [languages componentsJoinedByString: @" "];
NSString *string = nil;
NSString *item = nil;
NSString *eol = [NSString stringWithString: @"\\\n"];
NSString *eol = @"\\\n";
int i = 0;
int count = [resources count];
......@@ -494,7 +494,7 @@ static PCMakefileFactory *_factory = nil;
{
if (i == (count-1))
{
eol = [NSString stringWithString: @"\n"];
eol = @"\n";
}
item = [resources objectAtIndex:i];
string = [NSString stringWithFormat: @"%@ %@", item, eol];
......
......@@ -388,12 +388,12 @@ NSString
forKey:@"ProjectWindow"];
if ([projectWindow isToolbarVisible] == YES)
{
[windows setObject:[NSString stringWithString:@"YES"]
[windows setObject:@"YES"
forKey:@"ShowToolbar"];
}
else
{
[windows setObject:[NSString stringWithString:@"NO"]
[windows setObject:@"NO"
forKey:@"ShowToolbar"];
}
......@@ -1047,11 +1047,11 @@ NSString
{
if ([type isEqualToString:@"m"] || [type isEqualToString:@"c"])
{
return [NSString stringWithString:@"h"];
return @"h";
}
else if ([type isEqualToString:@"h"])
{
return [NSString stringWithString:@"m"];
return @"m";
}
return nil;
......
......@@ -308,11 +308,11 @@ NSString *PCBrowserDidSetPathNotification = @"PCBrowserDidSetPathNotification";
- (void)reloadLastColumnAndNotify:(BOOL)yn
{
int column = [browser lastColumn];
NSInteger column = [browser lastColumn];
NSString *category = [self nameOfSelectedCategory];
int selectedColumn = [browser selectedColumn];
NSInteger selectedColumn = [browser selectedColumn];
NSMatrix *colMatrix = [browser matrixInColumn:selectedColumn];
int rowCount = 0, colCount = 0, spCount = 0;
NSInteger rowCount = 0, colCount = 0, spCount = 0;
PCProject *activeProject = [[project projectManager] activeProject];
NSString *selCellTitle = [[browser selectedCell] stringValue];
......@@ -527,13 +527,13 @@ NSString *PCBrowserDidSetPathNotification = @"PCBrowserDidSetPathNotification";
@implementation PCProjectBrowser (ProjectBrowserDelegate)
- (void) browser:(NSBrowser *)sender
createRowsForColumn:(int)column
createRowsForColumn:(NSInteger)column
inMatrix:(NSMatrix *)matrix
{
NSString *pathToCol;
NSArray *files;
int i = 0;
int count = 0;
NSString *pathToCol;
NSArray *files;
NSUInteger i = 0;
NSUInteger count = 0;
if (sender != browser || !matrix || ![matrix isKindOfClass:[NSMatrix class]])
{
......
/*
GNUstep ProjectCenter - http://www.gnustep.org/experience/ProjectCenter.html
Copyright (C) 2000-2010 Free Software Foundation
Copyright (C) 2000-2014 Free Software Foundation
Authors: Philippe C.D. Robert
Serg Stoyan
......@@ -383,7 +383,7 @@
nextEL = ELNone;
lastIndentString = @"";
buildStatus = [NSString stringWithString:@"Building..."];
buildStatus = @"Building...";
[buildStatusTarget setString:@"Build"];
[cleanButton setEnabled:NO];
_isBuilding = YES;
......@@ -413,7 +413,7 @@
[buildArgs addObject:@"clean"];
[buildArgs addObjectsFromArray:[self buildArguments]];
buildStatus = [NSString stringWithString:@"Cleaning..."];
buildStatus = @"Cleaning...";
[buildStatusTarget setString:@"Clean"];
[buildButton setEnabled:NO];
_isCleaning = YES;
......@@ -526,7 +526,7 @@
}
// Check build tool path
if (!buildTool || ![fm fileExistsAtPath:buildTool])
if (!buildTool || !([fm fileExistsAtPath:buildTool] || [fm fileExistsAtPath:[buildTool stringByAppendingPathExtension: @"exe"]]))
{
NSRunAlertPanel(@"Project Build",
@"Build tool '%@' not found. Check preferences.\n"
......@@ -574,7 +574,7 @@
stdErrorPipe = [[NSPipe alloc] init];
stdErrorHandle = [stdErrorPipe fileHandleForReading];
[errorsCountField setStringValue:[NSString stringWithString:@""]];
[errorsCountField setStringValue:@""];
errorsCount = 0;
warningsCount = 0;
......@@ -732,8 +732,8 @@
- (void)updateErrorsCountField
{
NSString *string;
NSString *errorsString = [NSString stringWithString:@""];
NSString *warningsString = [NSString stringWithString:@""];
NSString *errorsString = @"";
NSString *warningsString = @"";
if (errorsCount > 0)
{
......@@ -744,7 +744,7 @@
}
else
{
errorsString = [NSString stringWithString:@"1 error"];
errorsString = @"1 error";
}
}
......@@ -757,7 +757,7 @@
}
else
{
warningsString = [NSString stringWithString:@"1 warning"];
warningsString = @"1 warning";
}
}
......@@ -870,10 +870,10 @@
// --- Parsing utilities
- (BOOL)line:(NSString *)lineString startsWithString:(NSString *)substring
{
int position = 0;
NSRange range = NSMakeRange(position,1);
NSInteger position = 0;
NSRange range = NSMakeRange(position,1);
while ([[lineString substringFromRange:range] isEqualToString:@" "])
while ([[lineString substringWithRange:range] isEqualToString:@" "])
{
range.location = ++position;
}
......@@ -920,7 +920,7 @@
NSString *pathComponent;
NSString *path;
// NSLog(@"parseMakeLine: %@", lineString);
// NSLog(@"parseMakeLine: %@", lineString);
makeLineComponents = [NSMutableArray
arrayWithArray:[lineString componentsSeparatedByString:@" "]];
......@@ -1014,7 +1014,9 @@
{// Do current path detection
[self parseMakeLine:string];
}
else if ([self line:string startsWithString:@"gcc"])
else if ([self line:string startsWithString:@"gcc"] ||
[self line:string startsWithString:@"egcc"] ||
[self line:string startsWithString:@"clang"])
{// Parse compiler output
parsedString = [self parseCompilerLine:string];
}
......@@ -1077,11 +1079,11 @@
- (NSArray *)parseErrorLine:(NSString *)string
{
NSArray *components = [string componentsSeparatedByString:@":"];
NSString *file = [NSString stringWithString:@""];
NSString *includedFile = [NSString stringWithString:@""];
NSString *position = [NSString stringWithString:@"{x=0; y=0}"];
NSString *type = [NSString stringWithString:@""];
NSString *message = [NSString stringWithString:@""];
NSString *file = @"";
NSString *includedFile = @"";
NSString *position = @"{x=0; y=0}";
NSString *type = @"";
NSString *message = @"";
NSMutableArray *items = [NSMutableArray arrayWithCapacity:1];
NSMutableDictionary *errorItem;
NSString *indentString = @"\t";
......@@ -1097,13 +1099,13 @@
forKey:NSUnderlineStyleAttributeName];
lastEL = currentEL;
// NSLog(@"error string: %@", string);
/* if (lastEL == ELFile) NSLog(@"+++ELFile");
if (lastEL == ELFunction) NSLog(@"+++ELFunction");
if (lastEL == ELIncluded) NSLog(@"+++ELIncluded");
if (lastEL == ELError) NSLog(@"+++ELError");
if (lastEL == ELNone) NSLog(@"+++ELNone");*/
//NSLog(@"components: %lu, %@", (unsigned long)[components count], components);
if ([errorArray count] > 0)
{
lastFile = [[errorArray lastObject] objectForKey:@"File"];
......@@ -1127,8 +1129,8 @@
}
else if ([components count] > 3)