2000-11-04 13:22:29 +00:00
|
|
|
/*
|
2001-08-03 14:23:25 +00:00
|
|
|
GNUstep ProjectCenter - http://www.gnustep.org
|
2000-11-04 13:22:29 +00:00
|
|
|
|
2001-08-03 14:23:25 +00:00
|
|
|
Copyright (C) 2001 Free Software Foundation
|
2000-11-04 13:22:29 +00:00
|
|
|
|
2001-08-03 14:23:25 +00:00
|
|
|
Author: Philippe C.D. Robert <phr@3dkit.org>
|
2000-11-04 13:22:29 +00:00
|
|
|
|
2001-08-03 14:23:25 +00:00
|
|
|
This file is part of GNUstep.
|
2000-11-04 13:22:29 +00:00
|
|
|
|
|
|
|
This application is free software; you can redistribute it and/or
|
|
|
|
modify it under the terms of the GNU General Public
|
|
|
|
License as published by the Free Software Foundation; either
|
|
|
|
version 2 of the License, or (at your option) any later version.
|
|
|
|
|
|
|
|
This application is distributed in the hope that it will be useful,
|
|
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
Library General Public License for more details.
|
|
|
|
|
|
|
|
You should have received a copy of the GNU General Public
|
|
|
|
License along with this library; if not, write to the Free
|
|
|
|
Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111 USA.
|
|
|
|
|
|
|
|
$Id$
|
|
|
|
*/
|
|
|
|
|
|
|
|
#import "PCBundleProject.h"
|
|
|
|
#import "PCBundleMakefileFactory.h"
|
|
|
|
|
|
|
|
#import <ProjectCenter/ProjectCenter.h>
|
|
|
|
|
|
|
|
@interface PCBundleProject (CreateUI)
|
|
|
|
|
|
|
|
- (void)_initUI;
|
|
|
|
|
|
|
|
@end
|
|
|
|
|
|
|
|
@implementation PCBundleProject (CreateUI)
|
|
|
|
|
|
|
|
- (void)_initUI
|
|
|
|
{
|
|
|
|
NSTextField *textField;
|
|
|
|
NSRect frame = {{84,120}, {80, 80}};
|
|
|
|
NSBox *box;
|
|
|
|
|
|
|
|
[super _initUI];
|
|
|
|
|
|
|
|
textField =[[NSTextField alloc] initWithFrame:NSMakeRect(16,240,88,21)];
|
|
|
|
[textField setAlignment: NSRightTextAlignment];
|
|
|
|
[textField setBordered: NO];
|
|
|
|
[textField setEditable: NO];
|
|
|
|
[textField setBezeled: NO];
|
|
|
|
[textField setDrawsBackground: NO];
|
|
|
|
[textField setStringValue:@"Principal class:"];
|
2001-01-14 15:08:21 +00:00
|
|
|
[projectProjectInspectorView addSubview:textField];
|
|
|
|
RELEASE(textField);
|
2000-11-04 13:22:29 +00:00
|
|
|
|
2001-01-14 15:08:21 +00:00
|
|
|
frame = NSMakeRect(106,240,144,21);
|
|
|
|
principalClassField =[[NSTextField alloc] initWithFrame:frame];
|
2000-11-04 13:22:29 +00:00
|
|
|
[principalClassField setAlignment: NSLeftTextAlignment];
|
|
|
|
[principalClassField setBordered: YES];
|
|
|
|
[principalClassField setEditable: YES];
|
|
|
|
[principalClassField setBezeled: YES];
|
|
|
|
[principalClassField setDrawsBackground: YES];
|
|
|
|
[principalClassField setStringValue:@""];
|
2001-01-14 15:08:21 +00:00
|
|
|
[principalClassField setTarget:self];
|
|
|
|
[principalClassField setAction:@selector(setPrincipalClass:)];
|
2000-11-04 13:22:29 +00:00
|
|
|
[projectProjectInspectorView addSubview:principalClassField];
|
|
|
|
}
|
|
|
|
|
|
|
|
@end
|
|
|
|
|
|
|
|
@implementation PCBundleProject
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------------
|
|
|
|
// Init and free
|
|
|
|
//----------------------------------------------------------------------------
|
|
|
|
|
|
|
|
- (id)init
|
|
|
|
{
|
|
|
|
if ((self = [super init])) {
|
|
|
|
rootCategories = [[NSDictionary dictionaryWithObjectsAndKeys:
|
|
|
|
PCGModels,@"Interfaces",
|
2001-01-14 16:10:20 +00:00
|
|
|
PCSupportingFiles,@"Supporting Files",
|
2000-11-04 13:22:29 +00:00
|
|
|
PCImages,@"Images",
|
|
|
|
PCOtherResources,@"Other Resources",
|
|
|
|
PCSubprojects,@"Subprojects",
|
|
|
|
PCLibraries,@"Libraries",
|
|
|
|
PCDocuFiles,@"Documentation",
|
|
|
|
PCOtherSources,@"Other Sources",
|
|
|
|
PCHeaders,@"Headers",
|
|
|
|
PCClasses,@"Classes",
|
|
|
|
nil] retain];
|
|
|
|
|
|
|
|
[self _initUI];
|
|
|
|
}
|
|
|
|
return self;
|
|
|
|
}
|
|
|
|
|
|
|
|
- (void)dealloc
|
|
|
|
{
|
|
|
|
[rootCategories release];
|
|
|
|
[principalClassField release];
|
|
|
|
|
|
|
|
[super dealloc];
|
|
|
|
}
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------------
|
|
|
|
// Project
|
|
|
|
//----------------------------------------------------------------------------
|
|
|
|
|
|
|
|
- (BOOL)writeMakefile
|
|
|
|
{
|
2001-12-29 14:07:58 +00:00
|
|
|
NSFileManager *fm = [NSFileManager defaultManager];
|
|
|
|
NSData *mfd;
|
|
|
|
NSString *mf = [projectPath stringByAppendingPathComponent:@"GNUmakefile"];
|
|
|
|
|
|
|
|
// Save the project file
|
|
|
|
[super writeMakefile];
|
|
|
|
|
|
|
|
if(mfd = [[PCBundleMakefileFactory sharedFactory] makefileForProject:self]){
|
|
|
|
if ([mfd writeToFile:mf atomically:YES]) {
|
|
|
|
return YES;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2000-11-04 13:22:29 +00:00
|
|
|
return NO;
|
|
|
|
}
|
|
|
|
|
|
|
|
- (BOOL)isValidDictionary:(NSDictionary *)aDict
|
|
|
|
{
|
|
|
|
#warning No project check implemented, yet!
|
|
|
|
return YES;
|
|
|
|
}
|
|
|
|
|
|
|
|
- (NSArray *)sourceFileKeys
|
|
|
|
{
|
|
|
|
return [NSArray arrayWithObjects:PCClasses,PCOtherSources,nil];
|
|
|
|
}
|
|
|
|
|
|
|
|
- (NSArray *)resourceFileKeys
|
|
|
|
{
|
|
|
|
return [NSArray arrayWithObjects:PCGModels,PCOtherResources,PCImages,nil];
|
|
|
|
}
|
|
|
|
|
|
|
|
- (NSArray *)otherKeys
|
|
|
|
{
|
|
|
|
return [NSArray arrayWithObjects:PCDocuFiles,PCSupportingFiles,nil];
|
|
|
|
}
|
|
|
|
|
|
|
|
- (NSArray *)buildTargets
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
- (NSString *)projectDescription
|
|
|
|
{
|
|
|
|
return @"GNUstep Objective-C bundle project";
|
|
|
|
}
|
|
|
|
|
2000-11-10 18:27:15 +00:00
|
|
|
- (void)updateValuesFromProjectDict
|
|
|
|
{
|
2001-01-14 15:08:21 +00:00
|
|
|
NSString *pc;
|
|
|
|
|
2000-11-10 18:27:15 +00:00
|
|
|
[super updateValuesFromProjectDict];
|
|
|
|
|
2001-01-14 15:08:21 +00:00
|
|
|
pc = [projectDict objectForKey:PCPrincipalClass];
|
|
|
|
[principalClassField setStringValue:pc];
|
|
|
|
}
|
|
|
|
|
|
|
|
- (void)setPrincipalClass:(id)sender
|
|
|
|
{
|
|
|
|
[projectDict setObject:[principalClassField stringValue]
|
|
|
|
forKey:PCPrincipalClass];
|
|
|
|
|
|
|
|
[self writeMakefile];
|
2000-11-10 18:27:15 +00:00
|
|
|
}
|
|
|
|
|
2000-11-04 13:22:29 +00:00
|
|
|
@end
|
2001-01-14 15:08:21 +00:00
|
|
|
|
|
|
|
|
|
|
|
|