mirror of
https://github.com/gnustep/apps-projectcenter.git
synced 2025-02-21 19:01:18 +00:00
Initial subprojects support added
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/apps/projectcenter/branches/UNSTABLE_0_4@19016 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
4943aeb693
commit
a31acb76e5
24 changed files with 403 additions and 172 deletions
|
@ -31,10 +31,13 @@
|
|||
|
||||
- (id)initWithProjectManager:(PCProjectManager *)aManager
|
||||
{
|
||||
PCProjectBuilder *projectBuilder = [[aManager activeProject] projectBuilder];
|
||||
PCProjectBuilder *projectBuilder = nil;
|
||||
PCProject *activeProject = nil;
|
||||
|
||||
projectManager = aManager;
|
||||
|
||||
activeProject = [projectManager rootActiveProject];
|
||||
projectBuilder = [activeProject projectBuilder];
|
||||
|
||||
self = [super initWithContentRect: NSMakeRect (0, 300, 480, 322)
|
||||
styleMask: (NSTitledWindowMask
|
||||
| NSClosableWindowMask
|
||||
|
@ -46,7 +49,7 @@
|
|||
[self setReleasedWhenClosed: NO];
|
||||
[self setHidesOnDeactivate: NO];
|
||||
[self setTitle: [NSString stringWithFormat:
|
||||
@"%@ - Project Build", [[projectManager activeProject] projectName]]];
|
||||
@"%@ - Project Build", [activeProject projectName]]];
|
||||
|
||||
contentBox = [[NSBox alloc] init];
|
||||
[contentBox setContentViewMargins:NSMakeSize(8.0, 0.0)];
|
||||
|
@ -82,7 +85,7 @@
|
|||
|
||||
- (void)activeProjectDidChange:(NSNotification *)aNotif
|
||||
{
|
||||
PCProject *activeProject = [aNotif object];
|
||||
PCProject *activeProject = [projectManager rootActiveProject];
|
||||
|
||||
[self setTitle: [NSString stringWithFormat:
|
||||
@"%@ - Project Build", [activeProject projectName]]];
|
||||
|
|
|
@ -39,6 +39,11 @@
|
|||
NSLog(@"PCFileManager: error loading NewFile NIB!");
|
||||
return;
|
||||
}
|
||||
[newFilePanel setFrameAutosaveName:@"NewFile"];
|
||||
if (![newFilePanel setFrameUsingName: @"NewFile"])
|
||||
{
|
||||
[newFilePanel center];
|
||||
}
|
||||
[newFilePanel center];
|
||||
[nfImage setImage:[NSApp applicationIconImage]];
|
||||
[nfTypePB setRefusesFirstResponder:YES];
|
||||
|
|
|
@ -31,11 +31,12 @@
|
|||
|
||||
- (id)initWithProjectManager:(PCProjectManager *)aManager
|
||||
{
|
||||
PCProjectHistory *projectHistory;
|
||||
PCProjectHistory *projectHistory = nil;
|
||||
PCProject *activeProject = nil;
|
||||
|
||||
projectManager = aManager;
|
||||
|
||||
projectHistory = [[aManager activeProject] projectHistory];
|
||||
activeProject = [projectManager rootActiveProject];
|
||||
projectHistory = [activeProject projectHistory];
|
||||
|
||||
self = [super initWithContentRect: NSMakeRect (0, 300, 220, 322)
|
||||
styleMask: (NSTitledWindowMask
|
||||
|
@ -48,7 +49,7 @@
|
|||
[self setReleasedWhenClosed: NO];
|
||||
[self setHidesOnDeactivate: YES];
|
||||
[self setTitle: [NSString stringWithFormat:
|
||||
@"%@ - Loaded Files", [[projectManager activeProject] projectName]]];
|
||||
@"%@ - Loaded Files", [activeProject projectName]]];
|
||||
|
||||
contentBox = [[NSBox alloc] init];
|
||||
[contentBox setContentViewMargins:NSMakeSize(0.0, 0.0)];
|
||||
|
@ -56,7 +57,7 @@
|
|||
[contentBox setBorderType:NSNoBorder];
|
||||
[self setContentView:contentBox];
|
||||
|
||||
[self setContentView: [projectHistory componentView]];
|
||||
[contentBox setContentView:[projectHistory componentView]];
|
||||
|
||||
// Track project switching
|
||||
[[NSNotificationCenter defaultCenter]
|
||||
|
@ -84,41 +85,24 @@
|
|||
- (BOOL)canBecomeKeyWindow
|
||||
{
|
||||
// Panels controls doesn't receive mouse click if return NO
|
||||
|
||||
return YES;
|
||||
}
|
||||
|
||||
- (void)setContentView:(NSView *)view
|
||||
{
|
||||
if (view == contentBox)
|
||||
{
|
||||
[super setContentView:view];
|
||||
}
|
||||
else
|
||||
{
|
||||
[contentBox setContentView:view];
|
||||
}
|
||||
}
|
||||
|
||||
- (void)activeProjectDidChange:(NSNotification *)aNotif
|
||||
{
|
||||
PCProject *activeProject = [aNotif object];
|
||||
|
||||
if (![self isVisible])
|
||||
{
|
||||
return;
|
||||
}
|
||||
PCProject *activeProject = [projectManager rootActiveProject];
|
||||
|
||||
[self setTitle: [NSString stringWithFormat:
|
||||
@"%@ - Loaded Files", [activeProject projectName]]];
|
||||
|
||||
if (!activeProject)
|
||||
{
|
||||
[[contentBox contentView] removeFromSuperview];
|
||||
[contentBox setContentView:nil];
|
||||
}
|
||||
else
|
||||
{
|
||||
[self setContentView:[[activeProject projectHistory] componentView]];
|
||||
[contentBox
|
||||
setContentView:[[activeProject projectHistory] componentView]];
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -31,9 +31,12 @@
|
|||
|
||||
- (id)initWithProjectManager:(PCProjectManager *)aManager
|
||||
{
|
||||
PCProjectLauncher *projectLauncher;
|
||||
PCProjectLauncher *projectLauncher = nil;
|
||||
PCProject *activeProject = nil;
|
||||
|
||||
projectManager = aManager;
|
||||
activeProject = [projectManager rootActiveProject];
|
||||
projectLauncher = [activeProject projectLauncher];
|
||||
|
||||
projectLauncher = [[aManager activeProject] projectLauncher];
|
||||
|
||||
|
@ -48,7 +51,7 @@
|
|||
[self setReleasedWhenClosed: NO];
|
||||
[self setHidesOnDeactivate: NO];
|
||||
[self setTitle: [NSString stringWithFormat:
|
||||
@"%@ - Launch", [[projectManager activeProject] projectName]]];
|
||||
@"%@ - Launch", [activeProject projectName]]];
|
||||
|
||||
contentBox = [[NSBox alloc] init];
|
||||
[contentBox setContentViewMargins:NSMakeSize(8.0, 0.0)];
|
||||
|
@ -83,7 +86,7 @@
|
|||
|
||||
- (void)activeProjectDidChange:(NSNotification *)aNotif
|
||||
{
|
||||
PCProject *activeProject = [aNotif object];
|
||||
PCProject *activeProject = [projectManager rootActiveProject];
|
||||
|
||||
[self setTitle: [NSString stringWithFormat:
|
||||
@"%@ - Launch", [activeProject projectName]]];
|
||||
|
|
|
@ -305,6 +305,7 @@ static PCMakefileFactory *_factory = nil;
|
|||
- (void)appendSubprojects:(NSArray*)array
|
||||
{
|
||||
[self appendString:COMMENT_SUBPROJECTS];
|
||||
[self appendString:@"SUBPROJECTS = "];
|
||||
|
||||
if (array && [array count])
|
||||
{
|
||||
|
@ -313,7 +314,8 @@ static PCMakefileFactory *_factory = nil;
|
|||
|
||||
while ((tmp = [enumerator nextObject]))
|
||||
{
|
||||
[self appendString:[NSString stringWithFormat:@"\\\n\t%@ ",tmp]];
|
||||
tmp = [tmp stringByAppendingPathExtension:@"subproj"];
|
||||
[self appendString:[NSString stringWithFormat:@"\\\n%@ ",tmp]];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -70,7 +70,10 @@ extern NSString *PCProjectDictDidSaveNotification;
|
|||
|
||||
BOOL editorIsActive;
|
||||
|
||||
PCProject *activeSubproject;
|
||||
|
||||
// Subproject
|
||||
NSMutableArray *loadedSubprojects;
|
||||
BOOL isSubproject;
|
||||
PCProject *rootProject;
|
||||
PCProject *superProject;
|
||||
|
@ -187,16 +190,17 @@ extern NSString *PCProjectDictDidSaveNotification;
|
|||
// ==== Subprojects
|
||||
// ============================================================================
|
||||
|
||||
- (NSArray *)subprojects;
|
||||
- (void)addSubproject:(PCProject *)aSubproject;
|
||||
- (NSArray *)loadedSubprojects;
|
||||
- (PCProject *)activeSubproject;
|
||||
|
||||
- (BOOL)isSubProject;
|
||||
- (BOOL)isSubproject;
|
||||
- (void)setIsSubproject:(BOOL)yn;
|
||||
- (PCProject *)superProject;
|
||||
- (void)setSuperProject:(PCProject *)project;
|
||||
- (PCProject *)rootProject;
|
||||
- (void)setRootProject:(PCProject *)project;
|
||||
|
||||
- (PCProject *)subprojectWithName:(NSString *)name;
|
||||
|
||||
- (void)addSubproject:(PCProject *)aSubproject;
|
||||
- (void)newSubprojectNamed:(NSString *)aName;
|
||||
- (void)removeSubproject:(PCProject *)aSubproject;
|
||||
|
||||
|
|
|
@ -61,6 +61,10 @@ NSString
|
|||
projectWindow = [[PCProjectWindow alloc] initWithProject:self];
|
||||
projectBuilder = nil;
|
||||
projectLauncher = nil;
|
||||
|
||||
loadedSubprojects = [[NSMutableArray alloc] init];
|
||||
isSubproject = NO;
|
||||
activeSubproject = nil;
|
||||
}
|
||||
|
||||
return self;
|
||||
|
@ -102,13 +106,15 @@ NSString
|
|||
|
||||
- (BOOL)close:(id)sender
|
||||
{
|
||||
int ret;
|
||||
NSLog(@"Closing %@ project", projectName);
|
||||
|
||||
// Project files (GNUmakefile, PC.project etc.)
|
||||
if ([self isProjectChanged] == YES)
|
||||
if (isSubproject == NO && [self isProjectChanged] == YES)
|
||||
{
|
||||
int ret;
|
||||
|
||||
ret = NSRunAlertPanel(@"Alert",
|
||||
@"Project is modified",
|
||||
@"Project or subprojects are modified",
|
||||
@"Save and Close",@"Don't save",@"Cancel");
|
||||
switch (ret)
|
||||
{
|
||||
|
@ -127,6 +133,20 @@ NSString
|
|||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// Close subprojects
|
||||
while ([loadedSubprojects count])
|
||||
{
|
||||
[(PCProject *)[loadedSubprojects objectAtIndex:0] close:self];
|
||||
// We should release subproject here, because it retains us
|
||||
// and we never reach -dealloc in other case.
|
||||
[loadedSubprojects removeObjectAtIndex:0];
|
||||
}
|
||||
|
||||
if (isSubproject == YES)
|
||||
{
|
||||
return YES;
|
||||
}
|
||||
|
||||
// Save visible windows and panels positions to project dictionary
|
||||
/* if ([self saveProjectWindowsAndPanels] == NO)
|
||||
|
@ -220,25 +240,34 @@ NSString
|
|||
|
||||
- (void)dealloc
|
||||
{
|
||||
NSLog (@"PCProject: dealloc");
|
||||
NSLog (@"PCProject %@: dealloc", projectName);
|
||||
|
||||
[[NSNotificationCenter defaultCenter] removeObserver:self];
|
||||
|
||||
|
||||
RELEASE(projectName);
|
||||
RELEASE(projectPath);
|
||||
RELEASE(projectDict);
|
||||
RELEASE(loadedSubprojects);
|
||||
|
||||
// Initialized in -init
|
||||
// For subprojects we should release these objects, because we
|
||||
// use ASSIGN() macro.
|
||||
RELEASE(projectWindow);
|
||||
RELEASE(projectBrowser);
|
||||
RELEASE(projectHistory);
|
||||
RELEASE(projectEditor);
|
||||
|
||||
|
||||
if (projectBuilder) RELEASE(projectBuilder);
|
||||
if (projectLauncher) RELEASE(projectLauncher);
|
||||
|
||||
|
||||
RELEASE(buildOptions);
|
||||
|
||||
if (isSubproject == YES)
|
||||
{
|
||||
RELEASE(rootProject);
|
||||
RELEASE(superProject);
|
||||
}
|
||||
|
||||
[super dealloc];
|
||||
}
|
||||
|
||||
|
@ -258,7 +287,7 @@ NSString
|
|||
|
||||
- (PCProjectHistory *)projectHistory
|
||||
{
|
||||
if (!projectHistory)
|
||||
if (!projectHistory && !isSubproject)
|
||||
{
|
||||
projectHistory = [[PCProjectHistory alloc] initWithProject:self];
|
||||
}
|
||||
|
@ -268,7 +297,7 @@ NSString
|
|||
|
||||
- (PCProjectBuilder *)projectBuilder
|
||||
{
|
||||
if (!projectBuilder)
|
||||
if (!projectBuilder && !isSubproject)
|
||||
{
|
||||
projectBuilder = [[PCProjectBuilder alloc] initWithProject:self];
|
||||
}
|
||||
|
@ -278,7 +307,7 @@ NSString
|
|||
|
||||
- (PCProjectLauncher *)projectLauncher
|
||||
{
|
||||
if (!projectLauncher)
|
||||
if (!projectLauncher && !isSubproject)
|
||||
{
|
||||
projectLauncher = [[PCProjectLauncher alloc] initWithProject:self];
|
||||
}
|
||||
|
@ -727,6 +756,13 @@ NSString
|
|||
NSUserDefaults *defs = [NSUserDefaults standardUserDefaults];
|
||||
NSString *keepBackup = [defs objectForKey:KeepBackup];
|
||||
BOOL shouldKeep = [keepBackup isEqualToString:@"YES"];
|
||||
int spCount = [loadedSubprojects count];
|
||||
int i;
|
||||
|
||||
for (i = 0; i < spCount; i++)
|
||||
{
|
||||
[[loadedSubprojects objectAtIndex:i] save];
|
||||
}
|
||||
|
||||
if (shouldKeep == YES && [fm isWritableFileAtPath:backup])
|
||||
{
|
||||
|
@ -901,23 +937,17 @@ NSString
|
|||
// ==== Subprojects
|
||||
// ============================================================================
|
||||
|
||||
- (NSArray *)subprojects
|
||||
- (NSArray *)loadedSubprojects
|
||||
{
|
||||
return [projectDict objectForKey:PCSubprojects];
|
||||
return loadedSubprojects;
|
||||
}
|
||||
|
||||
- (void)addSubproject:(PCProject *)aSubproject
|
||||
- (PCProject *)activeSubproject
|
||||
{
|
||||
NSMutableArray *subprojects;
|
||||
|
||||
subprojects = [NSMutableArray
|
||||
arrayWithArray:[projectDict objectForKey:PCSubprojects]];
|
||||
|
||||
[subprojects addObject:aSubproject];
|
||||
[self setProjectDictObject:subprojects forKey:PCSubprojects];
|
||||
return activeSubproject;
|
||||
}
|
||||
|
||||
- (BOOL)isSubProject
|
||||
- (BOOL)isSubproject
|
||||
{
|
||||
return isSubproject;
|
||||
}
|
||||
|
@ -934,19 +964,71 @@ NSString
|
|||
|
||||
- (void)setSuperProject:(PCProject *)project
|
||||
{
|
||||
superProject = project;
|
||||
if (superProject != nil)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
ASSIGN(superProject, project);
|
||||
|
||||
// Assigning releases left part
|
||||
ASSIGN(projectBrowser,[project projectBrowser]);
|
||||
ASSIGN(projectHistory,[project projectHistory]);
|
||||
ASSIGN(projectEditor,[project projectEditor]);
|
||||
ASSIGN(projectWindow,[project projectWindow]);
|
||||
}
|
||||
|
||||
- (PCProject *)rootProject
|
||||
- (PCProject *)subprojectWithName:(NSString *)name
|
||||
{
|
||||
return rootProject;
|
||||
int count = [loadedSubprojects count];
|
||||
int i;
|
||||
PCProject *sp = nil;
|
||||
NSString *spName = nil;
|
||||
NSString *spFile = nil;
|
||||
|
||||
// Subproject in project but not loaded
|
||||
if ([[projectDict objectForKey:PCSubprojects] containsObject:name])
|
||||
{
|
||||
// Search for subproject with name in subprojects array
|
||||
for (i = 0; i < count; i++)
|
||||
{
|
||||
sp = [loadedSubprojects objectAtIndex:i];
|
||||
spName = [sp projectName];
|
||||
if ([spName isEqualToString:name])
|
||||
{
|
||||
break;
|
||||
}
|
||||
sp = nil;
|
||||
}
|
||||
|
||||
// Subproject not found in array, load subproject
|
||||
if (sp == nil)
|
||||
{
|
||||
spFile = [projectPath stringByAppendingPathComponent:name];
|
||||
spFile = [spFile stringByAppendingPathExtension:@"subproj"];
|
||||
spFile = [spFile stringByAppendingPathComponent:@"PC.project"];
|
||||
sp = [projectManager loadProjectAt:spFile];
|
||||
[sp setIsSubproject:YES];
|
||||
[sp setSuperProject:self];
|
||||
[loadedSubprojects addObject:sp];
|
||||
}
|
||||
}
|
||||
|
||||
return sp;
|
||||
}
|
||||
|
||||
- (void)setRootProject:(PCProject *)project
|
||||
|
||||
- (void)addSubproject:(PCProject *)aSubproject
|
||||
{
|
||||
rootProject = project;
|
||||
}
|
||||
NSMutableArray *_subprojects;
|
||||
|
||||
_subprojects = [NSMutableArray
|
||||
arrayWithArray:[projectDict objectForKey:PCSubprojects]];
|
||||
|
||||
[_subprojects addObject:[aSubproject projectName]];
|
||||
[loadedSubprojects addObject:aSubproject];
|
||||
[self setProjectDictObject:_subprojects forKey:PCSubprojects];
|
||||
}
|
||||
|
||||
- (void)newSubprojectNamed:(NSString *)aName
|
||||
{
|
||||
|
@ -962,35 +1044,94 @@ NSString
|
|||
|
||||
- (NSArray *)contentAtCategoryPath:(NSString *)categoryPath
|
||||
{
|
||||
NSString *key = nil;
|
||||
NSString *key = [self keyForCategoryPath:categoryPath];
|
||||
NSArray *pathArray = nil;
|
||||
|
||||
pathArray = [categoryPath componentsSeparatedByString:@"/"];
|
||||
|
||||
if ([pathArray count] == 2)
|
||||
{
|
||||
[projectManager setActiveProject:self];
|
||||
activeSubproject = nil;
|
||||
}
|
||||
|
||||
if ([categoryPath isEqualToString:@""] || [categoryPath isEqualToString:@"/"])
|
||||
{
|
||||
return rootCategories;
|
||||
}
|
||||
else if ([key isEqualToString:PCSubprojects])
|
||||
{
|
||||
PCProject *_subproject = nil;
|
||||
NSString *spCategoryPath = nil;
|
||||
NSMutableArray *mCategoryPath = nil;
|
||||
|
||||
key = [self keyForCategoryPath:categoryPath];
|
||||
mCategoryPath = [pathArray mutableCopy];
|
||||
// NSLog(@"1. mCategoryPath: %@", mCategoryPath);
|
||||
|
||||
return [projectDict objectForKey:key];;
|
||||
// NSLog(@"path: %@ array count: %i", categoryPath, [pathArray count]);
|
||||
if ([pathArray count] == 2)
|
||||
{ // Click on "/Subprojects"
|
||||
return [projectDict objectForKey:PCSubprojects];
|
||||
}
|
||||
else if ([pathArray count] > 2)
|
||||
{ // CLick on "/Subprojects/Name.subproj+"
|
||||
_subproject = [self
|
||||
subprojectWithName:[pathArray objectAtIndex:2]];
|
||||
|
||||
[projectManager setActiveProject:_subproject];
|
||||
activeSubproject = _subproject;
|
||||
|
||||
[mCategoryPath removeObjectAtIndex:1];
|
||||
[mCategoryPath removeObjectAtIndex:1];
|
||||
// NSLog(@"2. mCategoryPath: %@", mCategoryPath);
|
||||
|
||||
spCategoryPath = [mCategoryPath componentsJoinedByString:@"/"];
|
||||
|
||||
/* NSLog(@"%@: retreiving content from %@ subproject\n> path: %@",
|
||||
projectName, [_subproject projectName], spCategoryPath);*/
|
||||
|
||||
return [_subproject contentAtCategoryPath:spCategoryPath];
|
||||
}
|
||||
}
|
||||
|
||||
return [projectDict objectForKey:key];
|
||||
}
|
||||
|
||||
- (BOOL)hasChildrenAtCategoryPath:(NSString *)categoryPath
|
||||
{
|
||||
NSString *listEntry = nil;
|
||||
NSString *listEntry = nil;
|
||||
/* NSString *key = nil;
|
||||
NSMutableArray *pathArray = nil;
|
||||
NSString *path = nil;
|
||||
PCProject *_subproject = nil;
|
||||
|
||||
if (!categoryPath || [categoryPath isEqualToString:@""]
|
||||
||[categoryPath isEqualToString:@"/"])
|
||||
pathArray = [[categoryPath componentsSeparatedByString:@"/"] mutableCopy];
|
||||
|
||||
NSLog(@"PCP: hasChildren %@", categoryPath);
|
||||
if ([categoryPath isEqualToString:@""]
|
||||
|| [categoryPath isEqualToString:@"/"])
|
||||
{
|
||||
return NO;
|
||||
}
|
||||
}*/
|
||||
|
||||
listEntry = [[categoryPath componentsSeparatedByString:@"/"] lastObject];
|
||||
|
||||
if ([rootCategories containsObject:listEntry]
|
||||
|| [[projectDict objectForKey:PCSubprojects] containsObject:listEntry])
|
||||
{
|
||||
return YES;
|
||||
}
|
||||
|
||||
/* key = [self keyForCategoryPath:categoryPath];
|
||||
if ([key isEqualToString:PCSubprojects])
|
||||
{
|
||||
NSLog(@"PCP: has choldren subprojects");
|
||||
_subproject = [self subprojectWithName:[pathArray objectAtIndex:2]];
|
||||
|
||||
[pathArray removeObjectAtIndex:1];
|
||||
[pathArray removeObjectAtIndex:1];
|
||||
path = [pathArray componentsJoinedByString:@"/"];
|
||||
return [_subproject hasChildrenAtCategoryPath:path];
|
||||
}*/
|
||||
|
||||
return NO;
|
||||
}
|
||||
|
|
|
@ -165,11 +165,20 @@ NSString *PCBrowserDidSetPathNotification = @"PCBrowserDidSetPathNotification";
|
|||
|
||||
if ([[sender selectedCell] isLeaf] && [[self selectedFiles] count] == 1)
|
||||
{
|
||||
NSString *category = [[sender selectedCellInColumn:0] stringValue];
|
||||
NSString *fn = [[sender selectedCell] stringValue];
|
||||
NSString *fp = [[project projectPath] stringByAppendingPathComponent:fn];
|
||||
PCProject *sp = nil;
|
||||
NSString *category = [[sender selectedCellInColumn:0] stringValue];
|
||||
NSString *fn = [[sender selectedCell] stringValue];
|
||||
NSString *fp = [[project projectPath] stringByAppendingPathComponent:fn];
|
||||
|
||||
if ([project isEditableCategory:category])
|
||||
if ((sp = [project activeSubproject]) != nil)
|
||||
{
|
||||
fp = [[sp projectPath] stringByAppendingPathComponent:fn];
|
||||
}
|
||||
|
||||
NSLog(@"Open file %@ in editor", fp);
|
||||
|
||||
if ([project isEditableCategory:category]
|
||||
|| [sp isEditableCategory:category])
|
||||
{
|
||||
[[project projectEditor] editorForFile:fp
|
||||
category:category
|
||||
|
@ -220,7 +229,9 @@ NSString *PCBrowserDidSetPathNotification = @"PCBrowserDidSetPathNotification";
|
|||
|
||||
- (void)projectDictDidChange:(NSNotification *)aNotif
|
||||
{
|
||||
if (browser && ([aNotif object] == project))
|
||||
if (browser &&
|
||||
([aNotif object] == project
|
||||
|| [[project loadedSubprojects] containsObject:[aNotif object]]))
|
||||
{
|
||||
NSString *browserPath = [browser path];
|
||||
NSString *slctdCategory = [project selectedRootCategory];
|
||||
|
@ -270,7 +281,10 @@ NSString *PCBrowserDidSetPathNotification = @"PCBrowserDidSetPathNotification";
|
|||
cell = [matrix cellAtRow:i column:0];
|
||||
[cell setStringValue:[files objectAtIndex:i]];
|
||||
|
||||
[categoryPath appendString:@"/"];
|
||||
if (![categoryPath isEqualToString:@"/"])
|
||||
{
|
||||
[categoryPath appendString:@"/"];
|
||||
}
|
||||
[categoryPath appendString:[files objectAtIndex:i]];
|
||||
|
||||
[cell setLeaf:![project hasChildrenAtCategoryPath:categoryPath]];
|
||||
|
|
|
@ -357,7 +357,7 @@
|
|||
{
|
||||
NSAssert(aProject, @"No project specified!");
|
||||
|
||||
NSLog (@"PCProjectBuilder: initWithProject");
|
||||
NSLog (@"PCProjectBuilder: initWithProject %@", [aProject projectName]);
|
||||
|
||||
if ((self = [super init]))
|
||||
{
|
||||
|
|
|
@ -80,6 +80,7 @@ extern NSString *PCActiveProjectDidChangeNotification;
|
|||
IBOutlet NSPanel *nsPanel;
|
||||
IBOutlet NSImageView *nsImage;
|
||||
IBOutlet NSTextField *nsTitle;
|
||||
IBOutlet NSTextField *projectNameField;
|
||||
IBOutlet NSTextField *nsNameField;
|
||||
IBOutlet NSPopUpButton *nsTypePB;
|
||||
IBOutlet NSButton *nsCancelButton;
|
||||
|
@ -114,6 +115,9 @@ extern NSString *PCActiveProjectDidChangeNotification;
|
|||
- (NSPanel *)buildPanel;
|
||||
- (NSPanel *)launchPanel;
|
||||
- (NSPanel *)projectFinderPanel;
|
||||
- (NSString *)rootBuildPath;
|
||||
- (NSString *)projectPath;
|
||||
- (NSString *)selectedFileName;
|
||||
|
||||
// ============================================================================
|
||||
// ==== Project management
|
||||
|
@ -122,22 +126,10 @@ extern NSString *PCActiveProjectDidChangeNotification;
|
|||
// Returns all currently loaded projects. They are stored with their absolut
|
||||
// paths as the keys.
|
||||
- (NSMutableDictionary *)loadedProjects;
|
||||
|
||||
// Returns the currently active project
|
||||
- (PCProject *)activeProject;
|
||||
|
||||
// Sets the new currently active project
|
||||
- (PCProject *)rootActiveProject;
|
||||
- (void)setActiveProject:(PCProject *)aProject;
|
||||
|
||||
// Gets set while initialising!
|
||||
- (NSString *)rootBuildPath;
|
||||
|
||||
// Returns active project's path
|
||||
- (NSString *)projectPath;
|
||||
|
||||
// Returns name of file selected in browser (and visible in internal editor)
|
||||
- (NSString *)selectedFileName;
|
||||
|
||||
// ============================================================================
|
||||
// ==== Project actions
|
||||
// ============================================================================
|
||||
|
|
|
@ -96,7 +96,7 @@ NSString *PCActiveProjectDidChangeNotification = @"PCActiveProjectDidChange";
|
|||
selector:@selector(editorDidClose:)
|
||||
name:PCEditorDidCloseNotification
|
||||
object:nil];
|
||||
|
||||
|
||||
fileManager = [[PCFileManager alloc] initWithProjectManager:self];
|
||||
|
||||
_needsReleasing = NO;
|
||||
|
@ -289,15 +289,30 @@ NSString *PCActiveProjectDidChangeNotification = @"PCActiveProjectDidChange";
|
|||
return activeProject;
|
||||
}
|
||||
|
||||
- (PCProject *)rootActiveProject
|
||||
{
|
||||
PCProject *rootProject = nil;
|
||||
|
||||
if (!activeProject)
|
||||
{
|
||||
return nil;
|
||||
}
|
||||
|
||||
rootProject = activeProject;
|
||||
while ([rootProject isSubproject] == YES)
|
||||
{
|
||||
rootProject = [rootProject superProject];
|
||||
}
|
||||
|
||||
return rootProject;
|
||||
}
|
||||
|
||||
- (void)setActiveProject:(PCProject *)aProject
|
||||
{
|
||||
if (aProject != activeProject)
|
||||
{
|
||||
activeProject = aProject;
|
||||
|
||||
NSLog(@"PCProjectManager: setActiveProject: %@",
|
||||
[activeProject projectName]);
|
||||
|
||||
[[NSNotificationCenter defaultCenter]
|
||||
postNotificationName:PCActiveProjectDidChangeNotification
|
||||
object:activeProject];
|
||||
|
@ -384,7 +399,7 @@ NSString *PCActiveProjectDidChangeNotification = @"PCActiveProjectDidChange";
|
|||
|
||||
if ((project = [projectCreator openProjectAt:aPath]))
|
||||
{
|
||||
NSLog (@"Project loaded as %@", [projectCreator projectTypeName]);
|
||||
NSLog (@"Project %@ loaded as %@", [projectCreator projectTypeName]);
|
||||
return project;
|
||||
}
|
||||
|
||||
|
@ -397,23 +412,22 @@ NSString *PCActiveProjectDidChangeNotification = @"PCActiveProjectDidChange";
|
|||
|
||||
- (BOOL)openProjectAt:(NSString *)aPath
|
||||
{
|
||||
BOOL isDir = NO;
|
||||
NSString *projectName = nil;
|
||||
BOOL isDir = NO;
|
||||
NSString *projectName = nil;
|
||||
PCProject *project = nil;
|
||||
|
||||
projectName = [[aPath stringByDeletingLastPathComponent] lastPathComponent];
|
||||
|
||||
if ([loadedProjects objectForKey:projectName])
|
||||
if ((project = [loadedProjects objectForKey:projectName]) != nil)
|
||||
{
|
||||
NSRunAlertPanel(@"Attention!",
|
||||
@"Project '%@' has already been opened!",
|
||||
@"OK",nil,nil,projectName);
|
||||
return NO;
|
||||
[[project projectWindow] makeKeyAndOrderFront:self];
|
||||
return YES;
|
||||
}
|
||||
|
||||
if ([[NSFileManager defaultManager] fileExistsAtPath:aPath
|
||||
isDirectory:&isDir] && !isDir)
|
||||
{
|
||||
PCProject *project = [self loadProjectAt:aPath];
|
||||
project = [self loadProjectAt:aPath];
|
||||
|
||||
if (!project)
|
||||
{
|
||||
|
@ -435,22 +449,21 @@ NSString *PCActiveProjectDidChangeNotification = @"PCActiveProjectDidChange";
|
|||
- (PCProject *)createProjectOfType:(NSString *)projectType
|
||||
path:(NSString *)aPath
|
||||
{
|
||||
Class creatorClass = NSClassFromString(projectType);
|
||||
PCProject *project;
|
||||
NSString *className = [projectTypes objectForKey:projectType];
|
||||
Class creatorClass = NSClassFromString(className);
|
||||
PCProject *project = nil;
|
||||
NSString *projectName = [aPath lastPathComponent];
|
||||
|
||||
if ([loadedProjects objectForKey:projectName])
|
||||
if ((project = [loadedProjects objectForKey:projectName]) != nil)
|
||||
{
|
||||
NSRunAlertPanel(@"Attention!",
|
||||
@"Project '%@' has already been opened!",
|
||||
@"OK",nil,nil,projectName);
|
||||
return nil;
|
||||
[[project projectWindow] makeKeyAndOrderFront:self];
|
||||
return project;
|
||||
}
|
||||
|
||||
if (![creatorClass conformsToProtocol:@protocol(ProjectType)])
|
||||
{
|
||||
[NSException raise:NOT_A_PROJECT_TYPE_EXCEPTION
|
||||
format:@"%@ does not conform to ProjectType!",projectType];
|
||||
format:@"%@ does not conform to ProjectType!", projectType];
|
||||
return nil;
|
||||
}
|
||||
|
||||
|
@ -490,7 +503,6 @@ NSString *PCActiveProjectDidChangeNotification = @"PCActiveProjectDidChange";
|
|||
NSString *filePath = nil;
|
||||
NSArray *fileTypes = [NSArray arrayWithObjects:@"project",@"pcproj",nil];
|
||||
NSString *projectType = nil;
|
||||
NSString *className = nil;
|
||||
PCProject *project = nil;
|
||||
|
||||
[self createProjectTypeAccessaryView];
|
||||
|
@ -501,9 +513,8 @@ NSString *PCActiveProjectDidChangeNotification = @"PCActiveProjectDidChange";
|
|||
if (filePath != nil)
|
||||
{
|
||||
projectType = [projectTypePopup titleOfSelectedItem];
|
||||
className = [projectTypes objectForKey:projectType];
|
||||
|
||||
if (!(project = [self createProjectOfType:className path:filePath]))
|
||||
if (!(project = [self createProjectOfType:projectType path:filePath]))
|
||||
{
|
||||
NSRunAlertPanel(@"Attention!",
|
||||
@"Failed to create %@!",
|
||||
|
@ -518,13 +529,17 @@ NSString *PCActiveProjectDidChangeNotification = @"PCActiveProjectDidChange";
|
|||
|
||||
- (BOOL)saveProject
|
||||
{
|
||||
if (![self activeProject])
|
||||
PCProject *rootProject = [self rootActiveProject];
|
||||
|
||||
if (!rootProject)
|
||||
{
|
||||
return NO;
|
||||
}
|
||||
|
||||
NSLog(@"PCPM: save root project: %@", [rootProject projectName]);
|
||||
|
||||
// Save PC.project and the makefiles!
|
||||
if ([activeProject save] == NO)
|
||||
if ([rootProject save] == NO)
|
||||
{
|
||||
NSRunAlertPanel(@"Attention!",
|
||||
@"Couldn't save project %@!",
|
||||
|
@ -664,9 +679,15 @@ NSString *PCActiveProjectDidChangeNotification = @"PCActiveProjectDidChange";
|
|||
|
||||
- (BOOL)closeAllProjects
|
||||
{
|
||||
PCProject *project = nil;
|
||||
NSEnumerator *enumerator = [loadedProjects objectEnumerator];
|
||||
|
||||
NSLog(@"ProjectManager: loaded %i projects", [loadedProjects count]);
|
||||
|
||||
while ([loadedProjects count] > 0)
|
||||
{
|
||||
if ([activeProject close:self] == NO)
|
||||
project = [enumerator nextObject];
|
||||
if ([project close:self] == NO)
|
||||
{
|
||||
return NO;
|
||||
}
|
||||
|
@ -748,7 +769,6 @@ NSString *PCActiveProjectDidChangeNotification = @"PCActiveProjectDidChange";
|
|||
return [[activeProject projectEditor] closeActiveEditor:self];
|
||||
}
|
||||
|
||||
|
||||
// Project menu
|
||||
// ============================================================================
|
||||
// ==== Non project editors
|
||||
|
@ -854,16 +874,24 @@ NSString *PCActiveProjectDidChangeNotification = @"PCActiveProjectDidChange";
|
|||
NSLog(@"PCProjectManager: error loading NewSubproject NIB!");
|
||||
return NO;
|
||||
}
|
||||
[nsPanel center];
|
||||
|
||||
[nsPanel setFrameAutosaveName:@"NewSubproject"];
|
||||
if (![nsPanel setFrameUsingName: @"NewSubproject"])
|
||||
{
|
||||
[nsPanel center];
|
||||
}
|
||||
|
||||
[nsImage setImage:[NSApp applicationIconImage]];
|
||||
[nsTypePB removeAllItems];
|
||||
[nsTypePB addItemsWithTitles:
|
||||
[[projectTypes allKeys]
|
||||
[[activeProject allowableSubprojectTypes]
|
||||
sortedArrayUsingSelector:@selector(caseInsensitiveCompare:)]];
|
||||
[nsTypePB setRefusesFirstResponder:YES];
|
||||
[nsTypePB selectItemAtIndex:0];
|
||||
[nsCancelButton setRefusesFirstResponder:YES];
|
||||
[nsCreateButton setRefusesFirstResponder:YES];
|
||||
}
|
||||
[projectNameField setStringValue:[activeProject projectName]];
|
||||
[nsPanel makeKeyAndOrderFront:nil];
|
||||
[nsNameField setStringValue:@""];
|
||||
[nsPanel makeFirstResponder:nsNameField];
|
||||
|
@ -885,24 +913,30 @@ NSString *PCActiveProjectDidChangeNotification = @"PCActiveProjectDidChange";
|
|||
|
||||
- (BOOL)createSubproject
|
||||
{
|
||||
PCProject *rootProject = [activeProject copy];
|
||||
PCProject *superProject = activeProject;
|
||||
PCProject *subproject = nil;
|
||||
NSString *spName = [nsNameField stringValue];
|
||||
NSString *spPath = nil;
|
||||
NSString *spType = [nsTypePB titleOfSelectedItem];
|
||||
|
||||
spPath = [[activeProject projectPath]
|
||||
stringByAppendingPathComponent:spName];
|
||||
if (![[spName pathExtension] isEqualToString:@"subproj"])
|
||||
{
|
||||
spName = [[nsNameField stringValue]
|
||||
stringByAppendingPathExtension:@"subproj"];
|
||||
}
|
||||
|
||||
spPath = [[activeProject projectPath] stringByAppendingPathComponent:spName];
|
||||
|
||||
NSLog(@"ProjectManager: creating subproject with type %@ at path %@",
|
||||
spType, spPath);
|
||||
// Create subproject
|
||||
subproject = [self createProjectOfType:spType path:spPath];
|
||||
|
||||
// For now root project can contain subproject but suboproject can't.
|
||||
[subproject setIsSubproject:YES];
|
||||
[subproject setRootProject:rootProject];
|
||||
[subproject setSuperProject:rootProject];
|
||||
[subproject setSuperProject:superProject];
|
||||
|
||||
[rootProject addSubproject:subproject];
|
||||
[superProject addSubproject:subproject];
|
||||
|
||||
return YES;
|
||||
}
|
||||
|
|
|
@ -243,20 +243,20 @@
|
|||
addObserver:self
|
||||
selector:@selector(projectDictDidChange:)
|
||||
name:PCProjectDictDidChangeNotification
|
||||
object:project];
|
||||
object:nil];
|
||||
|
||||
[[NSNotificationCenter defaultCenter]
|
||||
addObserver:self
|
||||
selector:@selector(projectDictDidSave:)
|
||||
name:PCProjectDictDidSaveNotification
|
||||
object:project];
|
||||
object:nil];
|
||||
|
||||
// Active project changing
|
||||
[[NSNotificationCenter defaultCenter]
|
||||
addObserver:self
|
||||
selector:@selector(activeProjectDidChange:)
|
||||
name:PCActiveProjectDidChangeNotification
|
||||
object:project];
|
||||
object:nil];
|
||||
}
|
||||
|
||||
return self;
|
||||
|
@ -514,7 +514,10 @@
|
|||
|
||||
- (void)projectDictDidChange:(NSNotification *)aNotif
|
||||
{
|
||||
if ([aNotif object] != project)
|
||||
NSArray *sps = [project loadedSubprojects];
|
||||
|
||||
if ([aNotif object] != project
|
||||
&& ![sps containsObject:[aNotif object]])
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
@ -531,16 +534,24 @@
|
|||
|
||||
- (void)projectDictDidSave:(NSNotification *)aNotif
|
||||
{
|
||||
if ([aNotif object] != project
|
||||
&& ![[project loadedSubprojects] containsObject:[aNotif object]])
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
[projectWindow setDocumentEdited:NO];
|
||||
}
|
||||
|
||||
- (void)activeProjectDidChange:(NSNotification *)aNotif
|
||||
{
|
||||
// [projectWindow makeKeyAndOrderFront:nil];
|
||||
if ([aNotif object] == project)
|
||||
if ([aNotif object] != project
|
||||
&& ![[project loadedSubprojects] containsObject:[aNotif object]])
|
||||
{
|
||||
[self makeKeyWindow];
|
||||
return;
|
||||
}
|
||||
|
||||
[self makeKeyWindow];
|
||||
}
|
||||
|
||||
// ============================================================================
|
||||
|
@ -612,9 +623,17 @@
|
|||
- (void)windowDidBecomeKey:(NSNotification *)aNotification
|
||||
{
|
||||
[projectWindow makeMainWindow];
|
||||
[[project projectManager] setActiveProject:project];
|
||||
[projectWindow makeFirstResponder:(NSResponder *)firstResponder];
|
||||
|
||||
if ([project activeSubproject] != nil)
|
||||
{
|
||||
[[project projectManager] setActiveProject:[project activeSubproject]];
|
||||
}
|
||||
else
|
||||
{
|
||||
[[project projectManager] setActiveProject:project];
|
||||
}
|
||||
|
||||
// Workaround
|
||||
if ([projectWindow isDocumentEdited])
|
||||
{
|
||||
|
|
|
@ -156,7 +156,8 @@
|
|||
nsNameField,
|
||||
nsTypePB,
|
||||
nsCancelButton,
|
||||
nsCreateButton
|
||||
nsCreateButton,
|
||||
projectNameField
|
||||
);
|
||||
Super = NSObject;
|
||||
};
|
||||
|
|
Binary file not shown.
|
@ -74,6 +74,7 @@ static PCAppProj *_creator = nil;
|
|||
NSString *_file = nil;
|
||||
NSString *_2file = nil;
|
||||
// NSString *_resourcePath = nil;
|
||||
NSString *projectName = nil;
|
||||
NSMutableDictionary *projectDict = nil;
|
||||
NSDictionary *infoDict = nil;
|
||||
NSBundle *projBundle = [NSBundle bundleForClass:[self class]];
|
||||
|
@ -86,7 +87,12 @@ static PCAppProj *_creator = nil;
|
|||
projectDict = [NSMutableDictionary dictionaryWithContentsOfFile:_file];
|
||||
|
||||
// Customise the project
|
||||
[projectDict setObject:[path lastPathComponent] forKey:PCProjectName];
|
||||
projectName = [path lastPathComponent];
|
||||
if ([[projectName pathExtension] isEqualToString:@"subproj"])
|
||||
{
|
||||
projectName = [projectName stringByDeletingPathExtension];
|
||||
}
|
||||
[projectDict setObject:projectName forKey:PCProjectName];
|
||||
[projectDict setObject:[self projectTypeName] forKey:PCProjectType];
|
||||
[projectDict setObject:[[NSCalendarDate date] description]
|
||||
forKey:PCCreationDate];
|
||||
|
@ -94,7 +100,7 @@ static PCAppProj *_creator = nil;
|
|||
[projectDict setObject:NSFullUserName() forKey:PCProjectMaintainer];
|
||||
// The path cannot be in the PC.project file!
|
||||
[project setProjectPath:path];
|
||||
[project setProjectName:[path lastPathComponent]];
|
||||
[project setProjectName:projectName];
|
||||
|
||||
// Copy the project files to the provided path
|
||||
_file = [projBundle pathForResource:@"main" ofType:@"m"];
|
||||
|
@ -126,7 +132,7 @@ static PCAppProj *_creator = nil;
|
|||
|
||||
// Main NIB
|
||||
mainNibFile = [path stringByAppendingPathComponent:
|
||||
[NSString stringWithFormat:@"%@.gorm", [path lastPathComponent]]];
|
||||
[NSString stringWithFormat:@"%@.gorm", projectName]];
|
||||
|
||||
_file = [projBundle pathForResource:@"Main" ofType:@"gorm"];
|
||||
[fm copyPath:_file toPath:mainNibFile handler:nil];
|
||||
|
@ -141,13 +147,13 @@ static PCAppProj *_creator = nil;
|
|||
@"Generated by ProjectCenter, do not edit", @"!",
|
||||
// @"", @"ApplicationDescription",
|
||||
// @"", @"ApplicationIcon",
|
||||
[path lastPathComponent], @"ApplicationName",
|
||||
projectName, @"ApplicationName",
|
||||
@"0.1", @"ApplicationRelease",
|
||||
[NSArray array], @"Authors",
|
||||
@"Copyright (C) 200x by ...", @"Copyright",
|
||||
@"Released under...", @"CopyrightDescription",
|
||||
@"0.1", @"FullVersionID",
|
||||
[path lastPathComponent], @"NSExecutable",
|
||||
projectName, @"NSExecutable",
|
||||
// @"", @"NSIcon",
|
||||
[mainNibFile lastPathComponent], @"NSMainNibFile",
|
||||
[projectDict objectForKey:PCPrincipalClass], @"NSPrincipalClass",
|
||||
|
|
|
@ -214,7 +214,7 @@
|
|||
- (NSArray *)allowableSubprojectTypes
|
||||
{
|
||||
return [NSArray arrayWithObjects:
|
||||
@"Bundle", @"Tool", @"Framework", @"Library", @"Palette", nil];
|
||||
@"Bundle", @"Tool", @"Library", nil];
|
||||
}
|
||||
|
||||
- (NSArray *)defaultLocalizableKeys
|
||||
|
|
|
@ -67,10 +67,11 @@ static PCBundleProj *_creator = nil;
|
|||
|
||||
if ([fm createDirectoryAtPath:path attributes:nil])
|
||||
{
|
||||
NSBundle *projectBundle;
|
||||
NSMutableDictionary *projectDict;
|
||||
NSString *_file;
|
||||
NSString *_2file;
|
||||
NSBundle *projectBundle = nil;
|
||||
NSMutableDictionary *projectDict = nil;
|
||||
NSString *projectName = nil;
|
||||
NSString *_file = nil;
|
||||
NSString *_2file = nil;
|
||||
// NSString *_resourcePath;
|
||||
PCFileCreator *pcfc = [PCFileCreator sharedCreator];
|
||||
|
||||
|
@ -82,19 +83,23 @@ static PCBundleProj *_creator = nil;
|
|||
projectDict = [NSMutableDictionary dictionaryWithContentsOfFile:_file];
|
||||
|
||||
// Customise the project
|
||||
[project setProjectName:[path lastPathComponent]];
|
||||
[projectDict setObject:[path lastPathComponent] forKey:PCProjectName];
|
||||
projectName = [path lastPathComponent];
|
||||
if ([[projectName pathExtension] isEqualToString:@"subproj"])
|
||||
{
|
||||
projectName = [projectName stringByDeletingPathExtension];
|
||||
}
|
||||
[projectDict setObject:projectName forKey:PCProjectName];
|
||||
[projectDict setObject:[self projectTypeName] forKey:PCProjectType];
|
||||
[projectDict setObject:[path lastPathComponent] forKey:PCPrincipalClass];
|
||||
[projectDict setObject:projectName forKey:PCPrincipalClass];
|
||||
// The path cannot be in the PC.project file!
|
||||
[project setProjectPath:path];
|
||||
[project setProjectName:[path lastPathComponent]];
|
||||
[project setProjectName:projectName];
|
||||
|
||||
// Copy the project files to the provided path
|
||||
|
||||
// $PROJECTNAME$.m
|
||||
_file = [NSString stringWithFormat:@"%@", [path lastPathComponent]];
|
||||
_2file = [NSString stringWithFormat:@"%@.m", [path lastPathComponent]];
|
||||
_file = [NSString stringWithFormat:@"%@", projectName];
|
||||
_2file = [NSString stringWithFormat:@"%@.m", projectName];
|
||||
[pcfc createFileOfType:ObjCClass
|
||||
path:[path stringByAppendingPathComponent:_file]
|
||||
project:project];
|
||||
|
@ -102,7 +107,7 @@ static PCBundleProj *_creator = nil;
|
|||
forKey:PCClasses];
|
||||
|
||||
// $PROJECTNAME$.h already created by creating $PROJECTNAME$.m
|
||||
_file = [NSString stringWithFormat:@"%@.h", [path lastPathComponent]];
|
||||
_file = [NSString stringWithFormat:@"%@.h", projectName];
|
||||
[projectDict setObject:[NSArray arrayWithObjects:_file,nil]
|
||||
forKey:PCHeaders];
|
||||
|
||||
|
|
|
@ -181,7 +181,7 @@
|
|||
- (NSArray *)allowableSubprojectTypes
|
||||
{
|
||||
return [NSArray arrayWithObjects:
|
||||
@"Bundle", @"Tool", @"Framework", @"Library", @"Palette", nil];
|
||||
@"Bundle", @"Tool", @"Library", nil];
|
||||
}
|
||||
|
||||
- (NSArray *)defaultLocalizableKeys
|
||||
|
|
|
@ -74,6 +74,7 @@ static PCLibProj *_creator = nil;
|
|||
{
|
||||
NSBundle *projectBundle = nil;
|
||||
NSMutableDictionary *projectDict;
|
||||
NSString *projectName = nil;
|
||||
NSString *_file = nil;
|
||||
NSString *_2file = nil;
|
||||
// NSString *_resourcePath;
|
||||
|
@ -86,17 +87,22 @@ static PCLibProj *_creator = nil;
|
|||
projectDict = [NSMutableDictionary dictionaryWithContentsOfFile:_file];
|
||||
|
||||
// Customise the project
|
||||
[projectDict setObject:[path lastPathComponent] forKey:PCProjectName];
|
||||
projectName = [path lastPathComponent];
|
||||
if ([[projectName pathExtension] isEqualToString:@"subproj"])
|
||||
{
|
||||
projectName = [projectName stringByDeletingPathExtension];
|
||||
}
|
||||
[projectDict setObject:projectName forKey:PCProjectName];
|
||||
[projectDict setObject:[self projectTypeName] forKey:PCProjectType];
|
||||
// The path cannot be in the PC.project file!
|
||||
[project setProjectPath:path];
|
||||
[project setProjectName:[path lastPathComponent]];
|
||||
[project setProjectName:projectName];
|
||||
|
||||
// Copy the project files to the provided path
|
||||
|
||||
// $PROJECTNAME$.m
|
||||
_file = [NSString stringWithFormat:@"%@", [path lastPathComponent]];
|
||||
_2file = [NSString stringWithFormat:@"%@.m", [path lastPathComponent]];
|
||||
_file = [NSString stringWithFormat:@"%@", projectName];
|
||||
_2file = [NSString stringWithFormat:@"%@.m", projectName];
|
||||
[pcfc createFileOfType:ObjCClass
|
||||
path:[path stringByAppendingPathComponent:_file]
|
||||
project:project];
|
||||
|
@ -104,7 +110,7 @@ static PCLibProj *_creator = nil;
|
|||
forKey:PCClasses];
|
||||
|
||||
// $PROJECTNAME$.h already created by creating $PROJECTNAME$.m
|
||||
_file = [NSString stringWithFormat:@"%@.h", [path lastPathComponent]];
|
||||
_file = [NSString stringWithFormat:@"%@.h", projectName];
|
||||
[projectDict setObject:[NSArray arrayWithObjects:_file,nil]
|
||||
forKey:PCHeaders];
|
||||
|
||||
|
|
|
@ -173,7 +173,7 @@
|
|||
- (NSArray *)allowableSubprojectTypes
|
||||
{
|
||||
return [NSArray arrayWithObjects:
|
||||
@"Bundle", @"Tool", @"Palette", nil];
|
||||
@"Bundle", @"Tool", nil];
|
||||
}
|
||||
|
||||
- (NSArray *)defaultLocalizableKeys
|
||||
|
|
|
@ -76,6 +76,7 @@ static PCRenaissanceProj *_creator = nil;
|
|||
{
|
||||
NSBundle *projectBundle = nil;
|
||||
NSMutableDictionary *projectDict = nil;
|
||||
NSString *projectName = nil;
|
||||
NSString *_file = nil;
|
||||
NSString *_2file = nil;
|
||||
// NSString *_resourcePath = nil;
|
||||
|
@ -90,7 +91,12 @@ static PCRenaissanceProj *_creator = nil;
|
|||
projectDict = [NSMutableDictionary dictionaryWithContentsOfFile:_file];
|
||||
|
||||
// Customise the project
|
||||
[projectDict setObject:[path lastPathComponent] forKey:PCProjectName];
|
||||
projectName = [path lastPathComponent];
|
||||
if ([[projectName pathExtension] isEqualToString:@"subproj"])
|
||||
{
|
||||
projectName = [projectName stringByDeletingPathExtension];
|
||||
}
|
||||
[projectDict setObject:projectName forKey:PCProjectName];
|
||||
[projectDict setObject:[self projectTypeName] forKey:PCProjectType];
|
||||
[projectDict setObject:[[NSCalendarDate date] description]
|
||||
forKey:PCCreationDate];
|
||||
|
@ -98,7 +104,7 @@ static PCRenaissanceProj *_creator = nil;
|
|||
[projectDict setObject:NSFullUserName() forKey:PCProjectMaintainer];
|
||||
// The path cannot be in the PC.project file!
|
||||
[project setProjectPath:path];
|
||||
[project setProjectName:[path lastPathComponent]];
|
||||
[project setProjectName:projectName];
|
||||
|
||||
// Copy the project files to the provided path
|
||||
_file = [projectBundle pathForResource:@"main" ofType:@"m"];
|
||||
|
@ -160,13 +166,13 @@ static PCRenaissanceProj *_creator = nil;
|
|||
@"Generated by ProjectCenter, do not edit", @"!",
|
||||
// @"", @"ApplicationDescription",
|
||||
// @"", @"ApplicationIcon",
|
||||
[path lastPathComponent], @"ApplicationName",
|
||||
projectName, @"ApplicationName",
|
||||
@"0.1", @"ApplicationRelease",
|
||||
[NSArray array], @"Authors",
|
||||
@"Copyright (C) 200x by ...", @"Copyright",
|
||||
@"Released under...", @"CopyrightDescription",
|
||||
@"0.1", @"FullVersionID",
|
||||
[path lastPathComponent], @"NSExecutable",
|
||||
projectName, @"NSExecutable",
|
||||
// @"", @"NSIcon",
|
||||
mainMarkup, @"GSMainMarkupFile",
|
||||
[projectDict objectForKey:PCPrincipalClass], @"NSPrincipalClass",
|
||||
|
|
|
@ -214,7 +214,7 @@
|
|||
- (NSArray *)allowableSubprojectTypes
|
||||
{
|
||||
return [NSArray arrayWithObjects:
|
||||
@"Bundle", @"Tool", @"Framework", @"Library", @"Palette", nil];
|
||||
@"Bundle", @"Tool", @"Library", nil];
|
||||
}
|
||||
|
||||
- (NSArray *)defaultLocalizableKeys
|
||||
|
|
|
@ -76,6 +76,7 @@ static PCToolProj *_creator = nil;
|
|||
// NSString *_resourcePath;
|
||||
NSMutableDictionary *projectDict = nil;
|
||||
NSBundle *projectBundle = nil;
|
||||
NSString *projectName = nil;
|
||||
NSMutableDictionary *infoDict = nil;
|
||||
PCFileCreator *fc = [PCFileCreator sharedCreator];
|
||||
|
||||
|
@ -86,11 +87,16 @@ static PCToolProj *_creator = nil;
|
|||
projectDict = [NSMutableDictionary dictionaryWithContentsOfFile:_file];
|
||||
|
||||
// Customise the project
|
||||
[projectDict setObject:[path lastPathComponent] forKey:PCProjectName];
|
||||
projectName = [path lastPathComponent];
|
||||
if ([[projectName pathExtension] isEqualToString:@"subproj"])
|
||||
{
|
||||
projectName = [projectName stringByDeletingPathExtension];
|
||||
}
|
||||
[projectDict setObject:projectName forKey:PCProjectName];
|
||||
[projectDict setObject:[self projectTypeName] forKey:PCProjectType];
|
||||
// The path cannot be in the PC.project file!
|
||||
[project setProjectPath:path];
|
||||
[project setProjectName:[path lastPathComponent]];
|
||||
[project setProjectName:projectName];
|
||||
|
||||
// Copy the project files to the provided path
|
||||
_file = [projectBundle pathForResource:@"main" ofType:@"m"];
|
||||
|
@ -112,7 +118,7 @@ static PCToolProj *_creator = nil;
|
|||
// Create the Info-gnustep.plist
|
||||
infoDict = [NSDictionary dictionaryWithObjectsAndKeys:
|
||||
@"Generated by ProjectCenter, do not edit", @"!",
|
||||
[path lastPathComponent], @"ToolName",
|
||||
projectName, @"ToolName",
|
||||
@"", @"ToolDescription",
|
||||
@"", @"ToolIcon",
|
||||
@"0.1", @"ToolRelease",
|
||||
|
|
|
@ -192,7 +192,7 @@
|
|||
- (NSArray *)allowableSubprojectTypes
|
||||
{
|
||||
return [NSArray arrayWithObjects:
|
||||
@"Bundle", @"Library", @"Palette", nil];
|
||||
@"Bundle", @"Library", nil];
|
||||
}
|
||||
|
||||
- (NSArray *)defaultLocalizableKeys
|
||||
|
|
Loading…
Reference in a new issue