Remove contents of Modules

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/apps/projectcenter/branches/UNSTABLE_0_5@22215 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
Sergii Stoian 2005-12-27 11:26:19 +00:00
parent 357f278c1d
commit 0cb66e88b3
77 changed files with 0 additions and 6078 deletions

View file

@ -1,41 +0,0 @@
#
# GNUmakefile - Aggregate.project
#
include $(GNUSTEP_MAKEFILES)/common.make
#
# Bundle
#
BUNDLE_NAME = Aggregate
BUNDLE_EXTENSION = .project
Aggregate_PRINCIPAL_CLASS = PCAggregateProj
#
# Additional libraries
#
Aggregate_LIBRARIES_DEPEND_UPON += -lProjectCenter
#
# Resource files
#
Aggregate_RESOURCE_FILES= \
Resources/PC.project \
Resources/Inspector.gorm
#
# Header files
#
Aggregate_HEADERS= \
PCAggregateProj.h \
PCAggregateProject.h
#
# Class files
#
Aggregate_OBJC_FILES= \
PCAggregateProj.m \
PCAggregateProject.m
include ../GNUmakefile.bundles
include $(GNUSTEP_MAKEFILES)/bundle.make

View file

@ -1,49 +0,0 @@
/*
GNUstep ProjectCenter - http://www.gnustep.org/experience/ProjectCenter.html
Copyright (C) 2004 Free Software Foundation
Authors: Serg Stoyan
This file is part of GNUstep.
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.
*/
#ifndef _PCAGGREGATEPROJ_H
#define _PCAGGREGATEPROJ_H
#include <AppKit/AppKit.h>
#include <ProjectCenter/ProjectCenter.h>
@interface PCAggregateProj : NSObject <ProjectType>
{
}
//----------------------------------------------------------------------------
// ProjectType
//----------------------------------------------------------------------------
+ (id)sharedCreator;
- (Class)projectClass;
- (NSString *)projectTypeName;
- (PCProject *)createProjectAt:(NSString *)path;
- (PCProject *)openProjectAt:(NSString *)path;
@end
#endif

View file

@ -1,127 +0,0 @@
/*
GNUstep ProjectCenter - http://www.gnustep.org/experience/ProjectCenter.html
Copyright (C) 2004 Free Software Foundation
Authors: Serg Stoyan
This file is part of GNUstep.
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.
*/
#include "ProjectCenter/PCFileCreator.h"
#include "ProjectCenter/PCMakefileFactory.h"
#include "PCAggregateProj.h"
#include "PCAggregateProject.h"
@implementation PCAggregateProj
static PCAggregateProj *_creator = nil;
//----------------------------------------------------------------------------
// ProjectType
//----------------------------------------------------------------------------
+ (id)sharedCreator
{
if (!_creator)
{
_creator = [[[self class] alloc] init];
}
return _creator;
}
- (Class)projectClass
{
return [PCAggregateProject class];
}
- (NSString *)projectTypeName
{
return @"Aggregate";
}
- (PCProject *)createProjectAt:(NSString *)path
{
PCAggregateProject *project = nil;
NSFileManager *fm = [NSFileManager defaultManager];
NSAssert(path,@"No valid project path provided!");
if ([fm createDirectoryAtPath:path attributes:nil])
{
NSString *_file = nil;
NSMutableDictionary *projectDict = nil;
NSBundle *projectBundle = nil;
NSString *projectName = nil;
project = [[[PCAggregateProject alloc] init] autorelease];
projectBundle = [NSBundle bundleForClass:[self class]];
_file = [projectBundle pathForResource:@"PC" ofType:@"project"];
projectDict = [NSMutableDictionary dictionaryWithContentsOfFile:_file];
// Customise the project
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];
[projectDict setObject:NSFullUserName() forKey:PCProjectCreator];
[projectDict setObject:NSFullUserName() forKey:PCProjectMaintainer];
// The path cannot be in the PC.project file!
[project setProjectPath:path];
[project setProjectName:projectName];
// GNUmakefile.postamble
[[PCMakefileFactory sharedFactory] createPostambleForProject:project];
// Set the new dictionary - this causes the GNUmakefile to be written
if(![project assignProjectDict:projectDict])
{
NSRunAlertPanel(@"Attention!",
@"Could not load %@!",
@"OK",nil,nil,path);
return nil;
}
// Save the project to disc
[project save];
}
return project;
}
- (PCProject *)openProjectAt:(NSString *)path
{
NSDictionary *dict = [NSDictionary dictionaryWithContentsOfFile:path];
NSString *pPath = [path stringByDeletingLastPathComponent];
PCAggregateProject *project = nil;
project = [[[PCAggregateProject alloc]
initWithProjectDictionary:dict
path:pPath] autorelease];
return project;
}
@end

View file

@ -1,64 +0,0 @@
/*
GNUstep ProjectCenter - http://www.gnustep.org/experience/ProjectCenter.html
Copyright (C) 2004 Free Software Foundation
Authors: Serg Stoyan
This file is part of GNUstep.
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.
*/
#ifndef _PCAGGREGATEPROJECT_H
#define _PCAGGREGATEPROJECT_H
#include <AppKit/AppKit.h>
#include <ProjectCenter/PCProject.h>
@class PCMakefileFactory;
@interface PCAggregateProject : PCProject
{
IBOutlet NSBox *projectAttributesView;
NSMutableDictionary *infoDict;
}
//----------------------------------------------------------------------------
// Init and free
//----------------------------------------------------------------------------
- (id)init;
- (void)dealloc;
@end
@interface PCAggregateProject (GeneratedFiles)
- (BOOL)writeMakefile;
- (void)appendHead:(PCMakefileFactory *)mff;
- (void)appendTail:(PCMakefileFactory *)mff;
@end
@interface PCAggregateProject (Inspector)
- (NSView *)projectAttributesView;
- (void)updateInspectorValues:(NSNotification *)aNotif;
@end
#endif

View file

@ -1,188 +0,0 @@
/*
GNUstep ProjectCenter - http://www.gnustep.org/experience/ProjectCenter.html
Copyright (C) 2004 Free Software Foundation
Authors: Serg Stoyan
This file is part of GNUstep.
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.
*/
#include "PCAggregateProject.h"
#include "PCAggregateProj.h"
#include <ProjectCenter/PCMakefileFactory.h>
@implementation PCAggregateProject
//----------------------------------------------------------------------------
// Init and free
//----------------------------------------------------------------------------
- (id)init
{
if ((self = [super init]))
{
rootKeys = [[NSArray arrayWithObjects:
PCSubprojects,
PCSupportingFiles,
PCNonProject,
nil] retain];
rootCategories = [[NSArray arrayWithObjects:
@"Subprojects",
@"Supporting Files",
@"Non Project Files",
nil] retain];
rootEntries = [[NSDictionary
dictionaryWithObjects:rootCategories forKeys:rootKeys] retain];
}
return self;
}
- (void)dealloc
{
[rootCategories release];
[rootKeys release];
[rootEntries release];
if (projectAttributesView) [projectAttributesView release];
[super dealloc];
}
//----------------------------------------------------------------------------
// Project
//----------------------------------------------------------------------------
- (Class)builderClass
{
return [PCAggregateProj class];
}
- (NSString *)projectDescription
{
return @"Project that contains subprojects.";
}
- (NSArray *)sourceFileKeys
{
return [NSArray arrayWithObjects:
PCSupportingFiles, PCSubprojects, nil];
}
- (NSArray *)otherKeys
{
return [NSArray arrayWithObjects:
PCNonProject, nil];
}
- (NSArray *)allowableSubprojectTypes
{
return [NSArray arrayWithObjects:
@"Application", @"Bundle", @"Library", @"Framework", @"Tool", nil];
}
@end
@implementation PCAggregateProject (GeneratedFiles)
- (BOOL)writeMakefile
{
PCMakefileFactory *mf = [PCMakefileFactory sharedFactory];
NSString *mfl = nil;
NSData *mfd = nil;
// Save the GNUmakefile backup
[super writeMakefile];
// Save GNUmakefile.preamble
[mf createPreambleForProject:self];
// Create the new file
[mf createMakefileForProject:projectName];
// Head
[self appendHead:mf];
// Subprojects
if ([[projectDict objectForKey:PCSubprojects] count] > 0)
{
[mf appendSubprojects:[projectDict objectForKey:PCSubprojects]];
}
// Tail
[self appendTail:mf];
// Write the new file to disc!
mfl = [projectPath stringByAppendingPathComponent:@"GNUmakefile"];
if ((mfd = [mf encodedMakefile]))
{
if ([mfd writeToFile:mfl atomically:YES])
{
return YES;
}
}
return NO;
}
- (void)appendHead:(PCMakefileFactory *)mff
{
[mff appendString:@"\n#\n# Aggregate\n#\n"];
[mff appendString:[NSString stringWithFormat:@"VERSION = %@\n",
[projectDict objectForKey:PCRelease]]];
[mff appendString:[NSString stringWithFormat:@"PACKAGE_NAME = %@\n",
projectName]];
}
- (void)appendTail:(PCMakefileFactory *)mff
{
[mff appendString:@"\n\n#\n# Makefiles\n#\n"];
[mff appendString:@"-include GNUmakefile.preamble\n"];
[mff appendString:@"include $(GNUSTEP_MAKEFILES)/aggregate.make\n"];
[mff appendString:@"-include GNUmakefile.postamble\n"];
}
@end
@implementation PCAggregateProject (Inspector)
- (NSView *)projectAttributesView
{
if (projectAttributesView == nil)
{
if ([NSBundle loadNibNamed:@"Inspector" owner:self] == NO)
{
NSLog(@"PCLibraryProject: error loading Inspector NIB!");
return nil;
}
[projectAttributesView retain];
[self updateInspectorValues:nil];
}
return projectAttributesView;
}
- (void)updateInspectorValues:(NSNotification *)aNotif
{
}
@end

View file

@ -1,17 +0,0 @@
{
"## Comment" = "Do NOT change this file, Gorm maintains it";
FirstResponder = {
Actions = (
"orderFrontFontPanel:"
);
Super = NSObject;
};
PCToolProject = {
Actions = (
);
Outlets = (
projectAttributesView
);
Super = NSObject;
};
}

View file

@ -1,27 +0,0 @@
{
COMPILEROPTIONS = "";
CPPOPTIONS = "";
LINKEROPTIONS = "";
CREATION_DATE = "";
LANGUAGE = "English";
LAST_EDITING = "";
MAKEFILEDIR = "$(GNUSTEP_MAKEFILES)";
INSTALLDIR = "$(HOME)/GNUstep";
OBJC_COMPILEROPTIONS = "";
PROJECT_AUTHORS = ();
PROJECT_CREATOR = "";
PROJECT_DESCRIPTION = "No description avaliable!";
PROJECT_GROUP = "No group available!";
PROJECT_SUMMARY = "No summary available!";
PROJECT_RELEASE = "0.1";
PROJECT_COPYRIGHT = "Copyright (C) 200x";
PROJECT_COPYRIGHT_DESC = "Released under ...";
PROJECT_MAINTAINER = "";
PROJECT_NAME = "";
PROJECT_TYPE = "Aggregate";
PROJECT_URL = "";
SEARCH_HEADER_DIRS = ();
SEARCH_LIB_DIRS = ();
SUBPROJECTS = ();
SUPPORTING_FILES = ("GNUmakefile.preamble", "GNUmakefile", "GNUmakefile.postamble");
}

View file

@ -1,52 +0,0 @@
#
# GNUmakefile - ApplicationProject
#
include $(GNUSTEP_MAKEFILES)/common.make
#
# Bundle
#
BUNDLE_NAME = Application
BUNDLE_EXTENSION = .project
Application_PRINCIPAL_CLASS = PCAppProj
#
# Additional libraries
#
Application_LIBRARIES_DEPEND_UPON += -lProjectCenter
#
# Resource files
#
Application_RESOURCE_FILES= \
Resources/AppController.h \
Resources/AppController.m \
Resources/main.m \
Resources/PC.project \
Resources/Main.gorm \
Resources/Inspector.gorm \
Resources/Main.gsmarkup \
Resources/MainMenu-GNUstep.gsmarkup \
Resources/MainMenu-OSX.gsmarkup
#
# Header files
#
Application_HEADERS= \
PCAppProj.h \
PCAppProject.h \
PCAppProject+Inspector.h
#
# Class files
#
Application_OBJC_FILES= \
PCAppProj.m \
PCAppProject.m \
PCAppProject+Inspector.m
include ../GNUmakefile.bundles
include $(GNUSTEP_MAKEFILES)/bundle.make

View file

@ -1,50 +0,0 @@
/*
GNUstep ProjectCenter - http://www.gnustep.org/experience/ProjectCenter.html
Copyright (C) 2001-2004 Free Software Foundation
Authors: Philippe C.D. Robert
Serg Stoyan
This file is part of GNUstep.
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.
*/
#ifndef _PCAPPPROJ_PCAPPPROJ_H
#define _PCAPPPROJ_PCAPPPROJ_H
#include <AppKit/AppKit.h>
#include <ProjectCenter/ProjectCenter.h>
@interface PCAppProj : NSObject <ProjectType>
{
}
//----------------------------------------------------------------------------
// ProjectType
//----------------------------------------------------------------------------
+ (id)sharedCreator;
- (Class)projectClass;
- (NSString *)projectTypeName;
- (PCProject *)createProjectAt:(NSString *)path;
- (PCProject *)openProjectAt:(NSString *)path;
@end
#endif

View file

@ -1,209 +0,0 @@
/*
GNUstep ProjectCenter - http://www.gnustep.org/experience/ProjectCenter.html
Copyright (C) 2001-2004 Free Software Foundation
Authors: Philippe C.D. Robert
Serg Stoyan
Description: PCAppProj creates new project of the type Application!
This file is part of GNUstep.
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.
*/
#include "ProjectCenter/PCFileCreator.h"
#include "ProjectCenter/PCFileManager.h"
#include "ProjectCenter/PCMakefileFactory.h"
#include "PCAppProj.h"
#include "PCAppProject.h"
@implementation PCAppProj
static PCAppProj *_creator = nil;
//----------------------------------------------------------------------------
// ProjectType
//----------------------------------------------------------------------------
+ (id)sharedCreator
{
if (!_creator)
{
_creator = [[[self class] alloc] init];
}
return _creator;
}
- (Class)projectClass
{
return [PCAppProject class];
}
- (NSString *)projectTypeName
{
return @"Application";
}
- (PCProject *)createProjectAt:(NSString *)path
{
PCAppProject *project = nil;
PCFileManager *pcfm = [PCFileManager defaultManager];
PCFileCreator *pcfc = [PCFileCreator sharedCreator];
NSString *_file = nil;
NSString *_2file = nil;
NSString *_resourcePath = nil;
NSString *projectName = nil;
NSMutableDictionary *projectDict = nil;
NSDictionary *infoDict = nil;
NSBundle *projBundle = [NSBundle bundleForClass:[self class]];
NSString *mainNibFile = nil;
NSAssert(path,@"No valid project path provided!");
project = [[[PCAppProject alloc] init] autorelease];
// PC.project
_file = [projBundle pathForResource:@"PC" ofType:@"project"];
projectDict = [NSMutableDictionary dictionaryWithContentsOfFile:_file];
// Customise the project
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];
[projectDict setObject:NSFullUserName() forKey:PCProjectCreator];
[projectDict setObject:NSFullUserName() forKey:PCProjectMaintainer];
// The path cannot be in the PC.project file!
[project setProjectPath:path];
[project setProjectName:projectName];
// Copy the project files to the provided path
_file = [projBundle pathForResource:@"main" ofType:@"m"];
_2file = [path stringByAppendingPathComponent:
[NSString stringWithFormat:@"%@_main.m", projectName]];
[pcfm copyFile:_file toFile:_2file];
[pcfc replaceTagsInFileAtPath:_2file withProject:project];
[projectDict
setObject:[NSArray arrayWithObjects:[_2file lastPathComponent],nil]
forKey:PCOtherSources];
_file = [projBundle pathForResource:@"AppController" ofType:@"m"];
_2file = [path stringByAppendingPathComponent:@"AppController.m"];
[pcfm copyFile:_file toFile:_2file];
[pcfc replaceTagsInFileAtPath:_2file withProject:project];
_file = [projBundle pathForResource:@"AppController" ofType:@"h"];
_2file = [path stringByAppendingPathComponent:@"AppController.h"];
[pcfm copyFile:_file toFile:_2file];
[pcfc replaceTagsInFileAtPath:_2file withProject:project];
// GNUmakefile.postamble
[[PCMakefileFactory sharedFactory] createPostambleForProject:project];
// Resources
// By default resources located at Resources subdir until Info-gnustep.plist
// will remain not licalisable file. In the future it should be English.lproj.
_resourcePath = [path stringByAppendingPathComponent:@"Resources"];
// Main NIB
_file = [projBundle pathForResource:@"Main" ofType:@"gorm"];
mainNibFile = [NSString stringWithFormat:@"%@.gorm", projectName];
mainNibFile = [_resourcePath stringByAppendingPathComponent:mainNibFile];
[pcfm copyFile:_file toFile:mainNibFile];
[projectDict setObject:[mainNibFile lastPathComponent]
forKey:PCMainInterfaceFile];
// Renaissance
_file = [projBundle pathForResource:@"Main" ofType:@"gsmarkup"];
_2file = [_resourcePath stringByAppendingPathComponent:@"Main.gsmarkup"];
[pcfm copyFile:_file toFile:_2file];
_file = [projBundle pathForResource:@"MainMenu-GNUstep" ofType:@"gsmarkup"];
_2file = [_resourcePath
stringByAppendingPathComponent:@"MainMenu-GNUstep.gsmarkup"];
[pcfm copyFile:_file toFile:_2file];
_file = [projBundle pathForResource:@"MainMenu-OSX" ofType:@"gsmarkup"];
_2file = [_resourcePath
stringByAppendingPathComponent:@"MainMenu-OSX.gsmarkup"];
[pcfm copyFile:_file toFile:_2file];
[projectDict setObject:[NSArray arrayWithObjects:[mainNibFile lastPathComponent], @"Main.gsmarkup", @"MainMenu-GNUstep.gsmarkup", @"MainMenu-OSX.gsmarkup", nil]
forKey:PCInterfaces];
// Create the Info-gnutstep.plist
infoDict = [NSDictionary dictionaryWithObjectsAndKeys:
@"Generated by ProjectCenter, do not edit", @"!",
@"No description avaliable!", @"ApplicationDescription",
projectName, @"ApplicationName",
@"0.1", @"ApplicationRelease",
[NSArray array], @"Authors",
@"Copyright (C) 200x by ...", @"Copyright",
@"Released under...", @"CopyrightDescription",
@"0.1", @"FullVersionID",
projectName, @"NSExecutable",
[mainNibFile lastPathComponent], @"NSMainNibFile",
[projectDict objectForKey:PCPrincipalClass], @"NSPrincipalClass",
@"Application", @"NSRole",
nil];
_2file = [_resourcePath stringByAppendingPathComponent:@"Info-gnustep.plist"];
[infoDict writeToFile:_2file atomically:YES];
// Add Info-gnustep.plist into OTHER_RESOURCES
[projectDict setObject:[NSArray arrayWithObjects:@"Info-gnustep.plist",nil]
forKey:PCOtherResources];
// Set the new dictionary - this causes the GNUmakefile to be written
// to disc
if (![project assignProjectDict:projectDict])
{
NSRunAlertPanel(@"Attention!",
@"Could not load %@!",
@"OK", nil, nil, path);
return nil;
}
[project assignInfoDict:(NSMutableDictionary *)infoDict];
// Save the project to disc
[project save];
return project;
}
- (PCProject *)openProjectAt:(NSString *)path
{
NSDictionary *dict = [NSDictionary dictionaryWithContentsOfFile:path];
PCAppProject *project = nil;
project = [[[PCAppProject alloc]
initWithProjectDictionary:dict
path:[path stringByDeletingLastPathComponent]] autorelease];
[project loadInfoFileAtPath:[path stringByDeletingLastPathComponent]];
return project;
}
@end

View file

@ -1,72 +0,0 @@
/*
GNUstep ProjectCenter - http://www.gnustep.org/experience/ProjectCenter.html
Copyright (C) 2001 Free Software Foundation
Author: Serg Stoyan <stoyan@on.com.ua>
This file is part of GNUstep.
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.
*/
#ifndef _PCAppProject_Inspector_h_
#define _PCAppProject_Inspector_h_
#include "PCAppProject.h"
@interface PCAppProject (Inspector)
// ----------------------------------------------------------------------------
// --- User Interface
// ----------------------------------------------------------------------------
- (void)createProjectAttributes;
- (NSView *)projectAttributesView;
// ----------------------------------------------------------------------------
// --- Actions
// ----------------------------------------------------------------------------
- (void)setAppClass:(id)sender;
- (void)setFile:(id)sender;
- (void)clearFile:(id)sender;
- (void)setAppIcon:(id)sender;
- (void)clearAppIcon:(id)sender;
- (BOOL)setAppIconWithImageAtPath:(NSString *)path;
- (void)setMainNib:(id)sender;
- (BOOL)setMainNibWithFileAtPath:(NSString *)path;
- (void)clearMainNib:(id)sender;
- (void)setDocBasedApp:(id)sender;
- (int)numberOfRowsInTableView:(NSTableView *)aTableView;
- (id) tableView: (NSTableView *)aTableView
objectValueForTableColumn: (NSTableColumn *)aTableColumn
row: (int)rowIndex;
- (void) tableView:(NSTableView *)aTableView
setObjectValue:anObject
forTableColumn:(NSTableColumn *)aTableColumn
row:(int)rowIndex;
- (void)fillFieldsForRow:(int)rowIndex;
// ----------------------------------------------------------------------------
// --- Notifications
// ----------------------------------------------------------------------------
- (void)updateInspectorValues:(NSNotification *)aNotif;
- (void)tfGetFocus:(NSNotification *)aNotif;
@end
#endif

View file

@ -1,705 +0,0 @@
/*
GNUstep ProjectCenter - http://www.gnustep.org/experience/ProjectCenter.html
Copyright (C) 2001 Free Software Foundation
Author: Serg Stoyan <stoyan@on.com.ua>
This file is part of GNUstep.
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.
*/
#include <ProjectCenter/ProjectCenter.h>
#include "PCAppProject+Inspector.h"
// ----------------------------------------------------------------------------
// --- Customized text field
// ----------------------------------------------------------------------------
NSString *PCITextFieldGetFocus = @"PCITextFieldGetFocusNotification";
@implementation PCAppTextField
- (BOOL)becomeFirstResponder
{
[[NSNotificationCenter defaultCenter]
postNotificationName:PCITextFieldGetFocus
object:self];
return [super becomeFirstResponder];
}
@end
@implementation PCAppProject (Inspector)
- (void)awakeFromNib
{
[docBasedAppButton setRefusesFirstResponder:YES];
[docBasedAppButton setState:
([[projectDict objectForKey:PCDocumentBasedApp]
isEqualToString: @"YES"]) ? NSOnState : NSOffState];
}
// ----------------------------------------------------------------------------
// --- User Interface
// ----------------------------------------------------------------------------
- (void)createProjectAttributes
{
// TFs Buttons
[setFieldButton setRefusesFirstResponder:YES];
[clearFieldButton setRefusesFirstResponder:YES];
// Document types buttons
[addDocTypeButton setRefusesFirstResponder:YES];
[removeDocTypeButton setRefusesFirstResponder:YES];
[docBasedAppButton setRefusesFirstResponder:YES];
[self setDocBasedApp:docBasedAppButton];
[[NSNotificationCenter defaultCenter] addObserver:self
selector:@selector(tfGetFocus:)
name:PCITextFieldGetFocus
object:nil];
[projectAttributesView retain];
[self updateInspectorValues:nil];
}
- (NSView *)projectAttributesView
{
if (!projectAttributesView)
{
if ([NSBundle loadNibNamed:@"Inspector" owner:self] == NO)
{
NSLog(@"PCAppProject: error loading Inspector NIB!");
return nil;
}
[self createProjectAttributes];
}
return projectAttributesView;
}
// ----------------------------------------------------------------------------
// --- Actions
// ----------------------------------------------------------------------------
- (void)setAppType:(id)sender
{
NSString *appType = [appTypeField stringValue];
NSMutableArray *libs = [[projectDict objectForKey:PCLibraries] mutableCopy];
if ([appType isEqualToString:@"Renaissance"])
{
[libs addObject:@"Renaissance"];
}
else
{
[libs removeObject:@"Renaissance"];
}
[self setProjectDictObject:libs forKey:PCLibraries notify:YES];
RELEASE(libs);
[self setProjectDictObject:appType forKey:PCAppType notify:YES];
}
- (void)setAppClass:(id)sender
{
[self setProjectDictObject:[appClassField stringValue]
forKey:PCPrincipalClass
notify:YES];
}
- (void)setIconViewImage:(NSImage *)image
{
[iconView setImage:nil];
[iconView display];
if (image == nil)
{
return;
}
[iconView setImage:image];
[iconView display];
}
- (void)setFile:(id)sender
{
if (!activeTextField)
{
return;
}
if (activeTextField == appImageField)
{
[self setAppIcon:self];
}
else if (activeTextField == helpFileField)
{
}
else if (activeTextField == mainNIBField)
{
[self setMainNib:self];
}
}
- (void)clearFile:(id)sender
{
if (!activeTextField)
{
return;
}
if (activeTextField == appImageField)
{
[self clearAppIcon:self];
}
else if (activeTextField == helpFileField)
{
}
else if (activeTextField == mainNIBField)
{
[self clearMainNib:self];
}
[self setIconViewImage:nil];
}
// Application Icon
- (void)setAppIcon:(id)sender
{
int result;
NSArray *fileTypes = [NSImage imageFileTypes];
NSOpenPanel *openPanel = [NSOpenPanel openPanel];
NSString *dir = nil;
[openPanel setAllowsMultipleSelection:NO];
[openPanel setTitle:@"Set Application Icon"];
dir = [[NSUserDefaults standardUserDefaults]
objectForKey:@"LastOpenDirectory"];
result = [openPanel runModalForDirectory:dir
file:nil
types:fileTypes];
if (result == NSOKButton)
{
NSString *imageFilePath = [[openPanel filenames] objectAtIndex:0];
if (![self setAppIconWithImageAtPath:imageFilePath])
{
NSRunAlertPanel(@"Error while opening file!",
@"Couldn't open %@", @"OK", nil, nil,imageFilePath);
}
}
}
- (void)clearAppIcon:(id)sender
{
[appImageField setStringValue:@""];
[infoDict setObject:@"" forKey:@"NSIcon"];
[infoDict setObject:@"" forKey:@"ApplicationIcon"];
[self setProjectDictObject:@"" forKey:PCAppIcon notify:YES];
}
- (BOOL)setAppIconWithImageAtPath:(NSString *)path
{
NSImage *image = nil;
NSString *imageName = nil;
if (!(image = [[NSImage alloc] initWithContentsOfFile:path]))
{
return NO;
}
imageName = [path lastPathComponent];
[appImageField setStringValue:imageName];
[self setIconViewImage:image];
[self addAndCopyFiles:[NSArray arrayWithObject:path] forKey:PCImages];
[infoDict setObject:imageName forKey:@"NSIcon"];
[infoDict setObject:imageName forKey:@"ApplicationIcon"];
[self setProjectDictObject:imageName forKey:PCAppIcon notify:YES];
return YES;
}
// Main Interface File
- (void)setMainNib:(id)sender
{
int result;
NSOpenPanel *openPanel = [NSOpenPanel openPanel];
NSString *dir = nil;
NSArray *types = nil;
[openPanel setAllowsMultipleSelection:NO];
[openPanel setTitle:@"Set Main Interface File"];
if ([[projectDict objectForKey:PCAppType] isEqualToString:@"GORM"])
{
types = [NSArray arrayWithObject:@"gorm"];
}
else
{
types = [NSArray arrayWithObject:@"gsmarkup"];
}
dir = [[NSUserDefaults standardUserDefaults]
objectForKey:@"LastOpenDirectory"];
result = [openPanel runModalForDirectory:dir file:nil types:types];
if (result == NSOKButton)
{
NSString *file = [[openPanel filenames] objectAtIndex:0];
if (![self setMainNibWithFileAtPath:file])
{
NSRunAlertPanel(@"Error while opening file!",
@"Couldn't open %@", @"OK", nil, nil,file);
}
}
}
- (BOOL)setMainNibWithFileAtPath:(NSString *)path
{
NSString *nibName = [path lastPathComponent];
[self setIconViewImage:[[NSWorkspace sharedWorkspace] iconForFile:path]];
[self addAndCopyFiles:[NSArray arrayWithObject:path] forKey:PCInterfaces];
[infoDict setObject:nibName forKey:@"NSMainNibFile"];
[self setProjectDictObject:nibName forKey:PCMainInterfaceFile notify:YES];
[mainNIBField setStringValue:nibName];
return YES;
}
- (void)clearMainNib:(id)sender
{
[mainNIBField setStringValue:@""];
[infoDict setObject:@"" forKey:@"NSMainNibFile"];
[self setProjectDictObject:@"" forKey:PCMainInterfaceFile notify:YES];
}
// Document Types
- (void)showDocTypesPanel:(id)sender
{
[docTypesPanel makeKeyAndOrderFront:nil];
}
- (void)setDocBasedApp:(id)sender
{
NSString *docBased = [projectDict objectForKey:PCDocumentBasedApp];
if ([docBasedAppButton state] == NSOnState)
{
[docTypeLabel setTextColor:[NSColor blackColor]];
[docTypeField setBackgroundColor:[NSColor whiteColor]];
[docTypeField setTextColor:[NSColor blackColor]];
[docTypeField setEditable:YES];
[docNameLabel setTextColor:[NSColor blackColor]];
[docNameField setBackgroundColor:[NSColor whiteColor]];
[docNameField setTextColor:[NSColor blackColor]];
[docNameField setEditable:YES];
[docRoleLabel setTextColor:[NSColor blackColor]];
[docRoleField setBackgroundColor:[NSColor whiteColor]];
[docRoleField setTextColor:[NSColor blackColor]];
[docRoleField setEditable:YES];
[docClassLabel setTextColor:[NSColor blackColor]];
[docClassField setBackgroundColor:[NSColor whiteColor]];
[docClassField setTextColor:[NSColor blackColor]];
[docClassField setEditable:YES];
[nameColumn setIdentifier:@"NSHumanReadableName"];
[[nameColumn headerCell] setStringValue:@"Name"];
[docTypesList addTableColumn:roleColumn];
[docTypesList addTableColumn:classColumn];
RELEASE(roleColumn);
RELEASE(classColumn);
if (![docBased isEqualToString:@"YES"])
{
[self setProjectDictObject:@"YES"
forKey:PCDocumentBasedApp
notify:YES];
}
}
else
{
[docTypeLabel setTextColor:[NSColor darkGrayColor]];
[docTypeField setBackgroundColor:[NSColor lightGrayColor]];
[docTypeField setTextColor:[NSColor darkGrayColor]];
[docTypeField setEditable:NO];
[docNameLabel setTextColor:[NSColor darkGrayColor]];
[docNameField setBackgroundColor:[NSColor lightGrayColor]];
[docNameField setTextColor:[NSColor darkGrayColor]];
[docNameField setEditable:NO];
[docRoleLabel setTextColor:[NSColor darkGrayColor]];
[docRoleField setBackgroundColor:[NSColor lightGrayColor]];
[docRoleField setTextColor:[NSColor darkGrayColor]];
[docRoleField setEditable:NO];
[docClassLabel setTextColor:[NSColor darkGrayColor]];
[docClassField setBackgroundColor:[NSColor lightGrayColor]];
[docClassField setTextColor:[NSColor darkGrayColor]];
[docClassField setEditable:NO];
// Columns
// [docTypesList removeTableColumn:nameColumn];
[nameColumn setIdentifier:@"NSIcon"];
[[nameColumn headerCell] setStringValue:@"Icon"];
RETAIN(roleColumn);
RETAIN(classColumn);
[docTypesList removeTableColumn:roleColumn];
[docTypesList removeTableColumn:classColumn];
if (![docBased isEqualToString:@"NO"])
{
[self setProjectDictObject:@"NO"
forKey:PCDocumentBasedApp
notify:YES];
}
}
}
- (void)addDocType:(id)sender
{
int row;
NSMutableDictionary *entry = [NSMutableDictionary dictionaryWithCapacity:6];
int selectedRow = [docTypesList selectedRow];
[entry setObject:[docTypeField stringValue] forKey:@"NSName"];
[entry setObject:[docNameField stringValue] forKey:@"NSHumanReadableName"];
[entry setObject:[[docExtensionsField stringValue] componentsSeparatedByString:@","] forKey:@"NSUnixExtensions"];
[entry setObject:[docIconField stringValue] forKey:@"NSIcon"];
[entry setObject:[docRoleField stringValue] forKey:@"NSRole"];
[entry setObject:[docClassField stringValue] forKey:@"NSDocumentClass"];
if (selectedRow >= 0 && [docTypesItems count] > 0)
{
[docTypesItems insertObject:entry atIndex:selectedRow + 1];
row = selectedRow + 1;
}
else
{
[docTypesItems addObject:entry];
row = [docTypesItems count] - 1;
}
[docTypesList reloadData];
[docTypesList selectRow:row byExtendingSelection:NO];
[self fillFieldsForRow:row];
[self setProjectDictObject:docTypesItems
forKey:PCDocumentTypes
notify:YES];
}
- (void)removeDocType:(id)sender
{
int selectedRow = [docTypesList selectedRow];
if (selectedRow >= 0)
{
[docTypesItems removeObjectAtIndex:selectedRow];
[docTypesList reloadData];
}
if (([docTypesList selectedRow] < 0) && ([docTypesItems count] > 0))
{
[docTypesList selectRow:[docTypesItems count]-1 byExtendingSelection:NO];
[self fillFieldsForRow:[docTypesItems count]-1];
}
[self setProjectDictObject:docTypesItems
forKey:PCDocumentTypes
notify:YES];
}
- (void)docFieldSet:(id)sender
{
NSMutableDictionary *object = nil;
NSLog(@"docFieldSet");
if (sender != docTypeField && sender != docNameField
&& sender != docIconField && sender != docExtensionsField
&& sender != docRoleField && sender != docClassField)
{
return;
}
if ([docTypesItems count] <= 0)
{
[self addDocType:addDocTypeButton];
}
object = [[docTypesItems objectAtIndex:[docTypesList selectedRow]]
mutableCopy];
if (sender == docTypeField)
{
[object setObject:[sender stringValue] forKey:@"NSName"];
}
else if (sender == docNameField)
{
[object setObject:[sender stringValue] forKey:@"NSHumanReadableName"];
}
else if (sender == docIconField)
{
[object setObject:[sender stringValue] forKey:@"NSIcon"];
}
else if (sender == docExtensionsField)
{
[object
setObject:[[sender stringValue] componentsSeparatedByString:@","]
forKey:@"NSUnixExtensions"];
}
else if (sender == docRoleField)
{
[object setObject:[sender stringValue] forKey:@"NSRole"];
}
else if (sender == docClassField)
{
[object setObject:[sender stringValue] forKey:@"NSDocumentClass"];
}
[docTypesItems replaceObjectAtIndex:[docTypesList selectedRow]
withObject:object];
[docTypesList reloadData];
[object release];
}
// ----------------------------------------------------------------------------
// --- Document Types browser
// ----------------------------------------------------------------------------
- (int)numberOfRowsInTableView:(NSTableView *)aTableView
{
return [docTypesItems count];
}
- (id) tableView:(NSTableView *)aTableView
objectValueForTableColumn:(NSTableColumn *)aTableColumn
row:(int)rowIndex
{
NSDictionary *object = nil;
if (docTypesItems != nil || [docTypesItems count] > 0)
{
object = [docTypesItems objectAtIndex:rowIndex];
if (aTableColumn == extensionsColumn)
{
return [[object objectForKey:@"NSUnixExtensions"]
componentsJoinedByString:@","];
}
else
{
return [object objectForKey:[aTableColumn identifier]];
}
}
return nil;
}
- (void)tableView:(NSTableView *)aTableView
setObjectValue:anObject
forTableColumn:(NSTableColumn *)aTableColumn
row:(int)rowIndex
{
NSMutableDictionary *type = nil;
if (docTypesItems == nil || [docTypesItems count] <= 0)
{
return;
}
type = [docTypesItems objectAtIndex:rowIndex];
if ([[aTableColumn identifier] isEqualToString:@"NSUnixExtensions"])
{
[type removeObjectForKey:@"Extension"];
[type setObject:anObject forKey:@"Extension"];
}
else if ([[aTableColumn identifier] isEqualToString:@"NSIcon"])
{
[type removeObjectForKey:@"Icon"];
[type setObject:anObject forKey:@"Icon"];
}
[self setProjectDictObject:docTypesItems
forKey:PCDocumentTypes
notify:YES];
}
- (BOOL)tableView:(NSTableView *)aTableView shouldSelectRow:(int)rowIndex
{
[self fillFieldsForRow:rowIndex];
return YES;
}
- (void)fillFieldsForRow:(int)rowIndex
{
NSDictionary *type = nil;
int itemCount = [docTypesItems count];
if (itemCount <= 0 || rowIndex > itemCount || rowIndex < 0)
{
[docTypeField setStringValue:@""];
[docNameField setStringValue:@""];
[docIconField setStringValue:@""];
[docExtensionsField setStringValue:@""];
[docRoleField setStringValue:@""];
[docClassField setStringValue:@""];
return;
}
type = [docTypesItems objectAtIndex:rowIndex];
[docTypeField setStringValue:[type objectForKey:@"NSName"]];
[docNameField setStringValue:[type objectForKey:@"NSHumanReadableName"]];
[docIconField setStringValue:[type objectForKey:@"NSIcon"]];
[docExtensionsField setStringValue:@""];
if ([[type objectForKey:@"NSUnixExtensions"] count] > 0)
{
[docExtensionsField setStringValue:
[[type objectForKey:@"NSUnixExtensions"]
componentsJoinedByString:@","]];
}
[docRoleField setStringValue:[type objectForKey:@"NSRole"]];
[docClassField setStringValue:[type objectForKey:@"NSDocumentClass"]];
}
// ----------------------------------------------------------------------------
// --- Notifications
// ----------------------------------------------------------------------------
- (void)updateInspectorValues:(NSNotification *)aNotif
{
// NSLog (@"PCAppProject: updateInspectorValues");
// Project Attributes view
[appTypeField selectItemWithTitle:[projectDict objectForKey:PCAppType]];
[appClassField setStringValue:[projectDict objectForKey:PCPrincipalClass]];
[appImageField setStringValue:[projectDict objectForKey:PCAppIcon]];
[helpFileField setStringValue:[projectDict objectForKey:PCHelpFile]];
[mainNIBField setStringValue:[projectDict objectForKey:PCMainInterfaceFile]];
docTypesItems = [projectDict objectForKey:PCDocumentTypes];
[docTypesList reloadData];
}
// TextFields (PCITextField subclass)
//
// NSTextField become first responder when user clicks on it and immediately
// lost first resonder status, so we can't catch when focus leaves textfield
// with resignFirstResponder: method overriding. Here we're using
// controlTextDidEndEditing (NSTextField's delegate method) to achieve this.
- (void)tfGetFocus:(NSNotification *)aNotif
{
id anObject = [aNotif object];
NSString *file = nil;
NSString *path = nil;
if (anObject != appImageField
&& anObject != helpFileField
&& anObject != mainNIBField)
{
// NSLog(@"tfGetFocus: not that textfield");
return;
}
if (anObject == appImageField)
{
file = [appImageField stringValue];
if (![file isEqualToString:@""])
{
path = [self dirForCategoryKey:PCImages];
path = [path stringByAppendingPathComponent:file];
[self setIconViewImage:[[NSImage alloc]
initWithContentsOfFile:path]];
}
activeTextField = appImageField;
}
else if (anObject == helpFileField)
{
activeTextField = helpFileField;
}
else if (anObject == mainNIBField)
{
file = [mainNIBField stringValue];
if (![file isEqualToString:@""])
{
path = [projectPath stringByAppendingPathComponent:file];
[self setIconViewImage:[[NSWorkspace sharedWorkspace]
iconForFile:path]];
}
activeTextField = mainNIBField;
}
[setFieldButton setEnabled:YES];
[clearFieldButton setEnabled:YES];
}
- (void)controlTextDidEndEditing:(NSNotification *)aNotification
{
NSControl *anObject = [aNotification object];
id target = [anObject target];
SEL action = [anObject action];
if (anObject == appImageField
|| anObject == helpFileField
|| anObject == mainNIBField)
{
activeTextField = nil;
[self setIconViewImage:nil];
[setFieldButton setEnabled:NO];
[clearFieldButton setEnabled:NO];
return;
}
if ([target respondsToSelector:action])
{
[target performSelector:action withObject:anObject];
}
}
@end

View file

@ -1,113 +0,0 @@
/*
GNUstep ProjectCenter - http://www.gnustep.org/experience/ProjectCenter.html
Copyright (C) 2001-2004 Free Software Foundation
Authors: Philippe C.D. Robert
Serg Stoyan
Description: This is the project type 'Application' for GNUstep. You never
should create it yourself but use PCAppProj for doing this.
Otherwise needed files don't get copied to the right place.
This file is part of GNUstep.
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.
*/
#ifndef _PCAppProj_PCAppProject_h_
#define _PCAppProj_PCAppProject_h_
#include <AppKit/AppKit.h>
#include <ProjectCenter/PCProject.h>
#include <ProjectCenter/PCProjectInspector.h>
@interface PCAppTextField : NSTextField
{
}
@end
@interface PCAppProject : PCProject
{
IBOutlet NSBox *projectAttributesView;
IBOutlet NSPopUpButton *appTypeField;
IBOutlet NSTextField *appClassField;
PCAppTextField *activeTextField;
IBOutlet PCAppTextField *appImageField;
IBOutlet PCAppTextField *helpFileField;
IBOutlet PCAppTextField *mainNIBField;
IBOutlet NSImageView *iconView;
NSImage *icon;
IBOutlet NSButton *setFieldButton;
IBOutlet NSButton *clearFieldButton;
IBOutlet NSButton *docTypesButton;
IBOutlet NSPanel *docTypesPanel;
IBOutlet NSButton *addDocTypeButton;
IBOutlet NSButton *removeDocTypeButton;
IBOutlet NSButton *docBasedAppButton;
IBOutlet NSScrollView *docTypesScroll;
NSTableView *docTypesList;
NSTableColumn *typeColumn; // NSName
NSTableColumn *nameColumn; // NSHumanReadableName
NSTableColumn *extensionsColumn; // NSUnixExtensions
NSTableColumn *iconColumn; // NSIcon
NSTableColumn *roleColumn; // NSRole
NSTableColumn *classColumn; // NSDocumentClass
NSMutableArray *docTypesItems;
IBOutlet NSTextField *docTypeLabel;
IBOutlet NSTextField *docTypeField;
IBOutlet NSTextField *docNameLabel;
IBOutlet NSTextField *docNameField;
IBOutlet NSTextField *docIconLabel;
IBOutlet NSTextField *docIconField;
IBOutlet NSTextField *docExtensionsLabel;
IBOutlet NSTextField *docExtensionsField;
IBOutlet NSTextField *docRoleLabel;
IBOutlet NSTextField *docRoleField;
IBOutlet NSTextField *docClassLabel;
IBOutlet NSTextField *docClassField;
NSMutableDictionary *infoDict;
}
// ----------------------------------------------------------------------------
// --- Init and free
// ----------------------------------------------------------------------------
- (id)init;
- (void)assignInfoDict:(NSMutableDictionary *)dict;
- (void)loadInfoFileAtPath:(NSString *)path;
- (void)dealloc;
@end
@interface PCAppProject (GeneratedFiles)
- (void)writeInfoEntry:(NSString *)name forKey:(NSString *)key;
- (BOOL)writeInfoFile;
- (BOOL)writeMakefile;
- (void)appendHead:(PCMakefileFactory *)mff;
- (void)appendTail:(PCMakefileFactory *)mff;
@end
#endif

View file

@ -1,469 +0,0 @@
/*
GNUstep ProjectCenter - http://www.gnustep.org/experience/ProjectCenter.html
Copyright (C) 2001-2004 Free Software Foundation
Authors: Philippe C.D. Robert
Serg Stoyan
This file is part of GNUstep.
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.
*/
#include <ProjectCenter/ProjectCenter.h>
#include <ProjectCenter/PCProjectBrowser.h>
#include "PCAppProject.h"
#include "PCAppProject+Inspector.h"
#include "PCAppProj.h"
@implementation PCAppProject
// ----------------------------------------------------------------------------
// --- Init and free
// ----------------------------------------------------------------------------
- (id)init
{
if ((self = [super init]))
{
rootKeys = [[NSArray arrayWithObjects:
PCClasses,
PCHeaders,
PCOtherSources,
PCInterfaces,
PCImages,
PCOtherResources,
PCSubprojects,
PCDocuFiles,
PCSupportingFiles,
PCLibraries,
PCNonProject,
nil] retain];
rootCategories = [[NSArray arrayWithObjects:
@"Classes",
@"Headers",
@"Other Sources",
@"Interfaces",
@"Images",
@"Other Resources",
@"Subprojects",
@"Documentation",
// @"Context Help",
@"Supporting Files",
// @"Frameworks",
@"Libraries",
@"Non Project Files",
nil] retain];
rootEntries = [[NSDictionary
dictionaryWithObjects:rootCategories forKeys:rootKeys] retain];
}
return self;
}
- (void)assignInfoDict:(NSMutableDictionary *)dict
{
infoDict = [dict mutableCopy];
}
- (void)loadInfoFileAtPath:(NSString *)path
{
NSString *infoFile = nil;
infoFile = [self dirForCategoryKey:PCOtherResources];
infoFile = [infoFile stringByAppendingPathComponent:@"Info-gnustep.plist"];
if ([[NSFileManager defaultManager] fileExistsAtPath:infoFile])
{
infoDict = [[NSMutableDictionary alloc] initWithContentsOfFile:infoFile];
}
else
{
infoDict = [[NSMutableDictionary alloc] init];
}
}
- (void)dealloc
{
#ifdef DEVELOPMENT
NSLog (@"PCAppProject: dealloc");
#endif
[[NSNotificationCenter defaultCenter] removeObserver:self];
RELEASE(infoDict);
RELEASE(projectAttributesView);
RELEASE(rootCategories);
RELEASE(rootKeys);
RELEASE(rootEntries);
[super dealloc];
}
// ----------------------------------------------------------------------------
// --- PCProject overridings
// ----------------------------------------------------------------------------
- (Class)builderClass
{
return [PCAppProj class];
}
- (NSString *)projectDescription
{
return @"Project that handles GNUstep ObjC based applications.";
}
- (BOOL)isExecutable
{
return YES;
}
- (NSString *)execToolName
{
return [NSString stringWithString:@"openapp"];
}
- (NSArray *)buildTargets
{
return [NSArray arrayWithObjects:
@"app", @"debug", @"profile", @"dist", nil];
}
- (NSArray *)sourceFileKeys
{
return [NSArray arrayWithObjects:
PCClasses, PCHeaders, PCOtherSources,
PCSupportingFiles, PCSubprojects, nil];
}
- (NSArray *)resourceFileKeys
{
return [NSArray arrayWithObjects:
PCInterfaces, PCImages, PCOtherResources, PCDocuFiles, nil];
}
- (NSArray *)otherKeys
{
return [NSArray arrayWithObjects:
PCLibraries, PCNonProject, nil];
}
- (NSArray *)allowableSubprojectTypes
{
return [NSArray arrayWithObjects:
@"Aggregate", @"Bundle", @"Tool", @"Library", @"Framework", nil];
}
- (NSArray *)localizableKeys
{
return [NSArray arrayWithObjects:
PCInterfaces, PCImages, PCOtherResources, PCDocuFiles, nil];
}
// ============================================================================
// ==== File Handling
// ============================================================================
- (BOOL)removeFiles:(NSArray *)files forKey:(NSString *)key notify:(BOOL)yn
{
NSMutableArray *filesToRemove = [[files mutableCopy] autorelease];
NSString *mainNibFile = [projectDict objectForKey:PCMainInterfaceFile];
NSString *appIcon = [projectDict objectForKey:PCAppIcon];
if (!files || !key)
{
return NO;
}
// Check for main NIB file
if ([key isEqualToString:PCInterfaces] && [files containsObject:mainNibFile])
{
int ret;
ret = NSRunAlertPanel(@"Remove",
@"You've selected to remove main interface file.\nDo you still want to remove it?",
@"Remove", @"Leave", nil);
if (ret == NSAlertAlternateReturn) // Leave
{
[filesToRemove removeObject:mainNibFile];
}
else
{
[self clearMainNib:self];
}
}
// Check for application icon files
else if ([key isEqualToString:PCImages] && [files containsObject:appIcon])
{
int ret;
ret = NSRunAlertPanel(@"Remove",
@"You've selected to remove application icon file.\nDo you still want to remove it?",
@"Remove", @"Leave", nil);
if (ret == NSAlertAlternateReturn) // Leave
{
[filesToRemove removeObject:appIcon];
}
else
{
[self clearAppIcon:self];
}
}
return [super removeFiles:filesToRemove forKey:key notify:yn];
}
- (BOOL)renameFile:(NSString *)fromFile toFile:(NSString *)toFile
{
NSString *mainNibFile = [projectDict objectForKey:PCMainInterfaceFile];
NSString *appIcon = [projectDict objectForKey:PCAppIcon];
NSString *categoryKey = nil;
NSString *ff = [fromFile copy];
NSString *tf = [toFile copy];
BOOL success = NO;
categoryKey = [self
keyForCategory:[projectBrowser nameOfSelectedRootCategory]];
// Check for main NIB file
if ([categoryKey isEqualToString:PCInterfaces]
&& [fromFile isEqualToString:mainNibFile])
{
[self clearMainNib:self];
if ([super renameFile:ff toFile:tf] == YES)
{
[self setMainNibWithFileAtPath:
[[self dirForCategoryKey:categoryKey]
stringByAppendingPathComponent:tf]];
success = YES;
}
}
// Check for application icon files
else if ([categoryKey isEqualToString:PCImages]
&& [fromFile isEqualToString:appIcon])
{
[self clearAppIcon:self];
if ([super renameFile:ff toFile:tf] == YES)
{
[self setAppIconWithImageAtPath:
[[self dirForCategoryKey:categoryKey]
stringByAppendingPathComponent:tf]];
success = YES;
}
}
else if ([super renameFile:ff toFile:tf] == YES)
{
success = YES;
}
[ff release];
[tf release];
return success;
}
@end
@implementation PCAppProject (GeneratedFiles)
- (void)writeInfoEntry:(NSString *)name forKey:(NSString *)key
{
id entry = [projectDict objectForKey:key];
if (entry == nil)
{
return;
}
if ([entry isKindOfClass:[NSString class]] && [entry isEqualToString:@""])
{
[infoDict removeObjectForKey:name];
return;
}
if ([entry isKindOfClass:[NSArray class]] && [entry count] <= 0)
{
[infoDict removeObjectForKey:name];
return;
}
[infoDict setObject:entry forKey:name];
}
- (BOOL)writeInfoFile
{
NSString *infoFile = nil;
[self writeInfoEntry:@"ApplicationDescription" forKey:PCDescription];
[self writeInfoEntry:@"ApplicationIcon" forKey:PCAppIcon];
[self writeInfoEntry:@"ApplicationName" forKey:PCProjectName];
[self writeInfoEntry:@"ApplicationRelease" forKey:PCRelease];
[self writeInfoEntry:@"Authors" forKey:PCAuthors];
[self writeInfoEntry:@"Copyright" forKey:PCCopyright];
[self writeInfoEntry:@"CopyrightDescription" forKey:PCCopyrightDescription];
[self writeInfoEntry:@"FullVersionID" forKey:PCRelease];
[self writeInfoEntry:@"NSExecutable" forKey:PCProjectName];
[self writeInfoEntry:@"NSIcon" forKey:PCAppIcon];
if ([[projectDict objectForKey:PCAppType] isEqualToString:@"GORM"])
{
[self writeInfoEntry:@"NSMainNibFile" forKey:PCMainInterfaceFile];
[infoDict removeObjectForKey:@"GSMainMarkupFile"];
}
else
{
[self writeInfoEntry:@"GSMainMarkupFile" forKey:PCMainInterfaceFile];
[infoDict removeObjectForKey:@"NSMainNibFile"];
}
[self writeInfoEntry:@"NSPrincipalClass" forKey:PCPrincipalClass];
[infoDict setObject:@"Application" forKey:@"NSRole"];
[self writeInfoEntry:@"NSTypes" forKey:PCDocumentTypes];
[self writeInfoEntry:@"URL" forKey:PCURL];
infoFile = [self dirForCategoryKey:PCOtherResources];
infoFile = [infoFile stringByAppendingPathComponent:@"Info-gnustep.plist"];
return [infoDict writeToFile:infoFile atomically:YES];
}
// Overriding
- (BOOL)writeMakefile
{
PCMakefileFactory *mf = [PCMakefileFactory sharedFactory];
int i,j;
NSString *mfl = nil;
NSData *mfd = nil;
// Save Info-gnustep.plist
[self writeInfoFile];
// Save the GNUmakefile backup
[super writeMakefile];
// Save GNUmakefile.preamble
[mf createPreambleForProject:self];
// Create the new file
[mf createMakefileForProject:projectName];
// Head (Application)
[self appendHead:mf];
// Libraries depend upon
[mf appendLibraries:[projectDict objectForKey:PCLibraries]];
// Subprojects
if ([[projectDict objectForKey:PCSubprojects] count] > 0)
{
[mf appendSubprojects:[projectDict objectForKey:PCSubprojects]];
}
// Resources
[mf appendResources];
for (i = 0; i < [[self resourceFileKeys] count]; i++)
{
NSString *k = [[self resourceFileKeys] objectAtIndex:i];
NSMutableArray *resources = [[projectDict objectForKey:k] mutableCopy];
NSString *resourceItem = nil;
for (j = 0; j < [resources count]; j++)
{
resourceItem = [resources objectAtIndex:j];
if ([[resourceItem pathComponents] count] == 1)
{
resourceItem = [NSString stringWithFormat:@"Resources/%@",
resourceItem];
}
[resources replaceObjectAtIndex:j
withObject:resourceItem];
}
[mf appendResourceItems:resources];
[resources release];
}
// Localization
// TODO: proper support for localization
/* [mf appendLocalization];
[mf appendString:
[NSString stringWithFormat:@"%@_LANGUAGES = %@\n",
projectName, [[projectDict objectForKey:PCUserLanguages] componentsJoinedByString:@" "]]];
[mf appendString:
[NSString stringWithFormat:@"%@_LOCALIZED_RESOURCE_FILES = ", projectName]];
*/
[mf appendHeaders:[projectDict objectForKey:PCHeaders]];
[mf appendClasses:[projectDict objectForKey:PCClasses]];
[mf appendOtherSources:[projectDict objectForKey:PCOtherSources]];
// Tail
[self appendTail:mf];
// Write the new file to disc!
mfl = [projectPath stringByAppendingPathComponent:@"GNUmakefile"];
if ((mfd = [mf encodedMakefile]))
{
if ([mfd writeToFile:mfl atomically:YES])
{
return YES;
}
}
return NO;
}
- (void)appendHead:(PCMakefileFactory *)mff
{
NSString *installDir = [projectDict objectForKey:PCInstallDir];
[mff appendString:@"\n#\n# Application\n#\n"];
[mff appendString:[NSString stringWithFormat:@"VERSION = %@\n",
[projectDict objectForKey:PCRelease]]];
[mff appendString:
[NSString stringWithFormat:@"PACKAGE_NAME = %@\n", projectName]];
[mff appendString:
[NSString stringWithFormat:@"APP_NAME = %@\n", projectName]];
[mff appendString:[NSString stringWithFormat:@"%@_APPLICATION_ICON = %@\n",
projectName, [projectDict objectForKey:PCAppIcon]]];
if ([installDir isEqualToString:@""])
{
[mff appendString:
[NSString stringWithFormat:@"%@_STANDARD_INSTALL = no\n",
projectName]];
}
else
{
[mff appendString:
[NSString stringWithFormat:@"GNUSTEP_INSTALLATION_DIR = %@\n",
installDir]];
}
}
- (void)appendTail:(PCMakefileFactory *)mff
{
[mff appendString:@"\n\n#\n# Makefiles\n#\n"];
[mff appendString:@"-include GNUmakefile.preamble\n"];
[mff appendString:@"include $(GNUSTEP_MAKEFILES)/aggregate.make\n"];
[mff appendString:@"include $(GNUSTEP_MAKEFILES)/application.make\n"];
[mff appendString:@"-include GNUmakefile.postamble\n"];
}
@end

View file

@ -1,54 +0,0 @@
/*
Project: $PROJECTNAME$
Copyright (C) $YEAR$ Free Software Foundation
Author: $FULLUSERNAME$
Created: $DATE$ by $USERNAME$
Application Controller
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.
*/
#ifndef _PCAPPPROJ_APPCONTROLLER_H
#define _PCAPPPROJ_APPCONTROLLER_H
#include <AppKit/AppKit.h>
// Uncomment if your application is Renaissance-based
//#include <Renaissance/Renaissance.h>
@interface AppController : NSObject
{
}
+ (void)initialize;
- (id)init;
- (void)dealloc;
- (void)awakeFromNib;
- (void)applicationDidFinishLaunching:(NSNotification *)aNotif;
- (BOOL)applicationShouldTerminate:(id)sender;
- (void)applicationWillTerminate:(NSNotification *)aNotif;
- (BOOL)application:(NSApplication *)application openFile:(NSString *)fileName;
- (void)showPrefPanel:(id)sender;
@end
#endif

View file

@ -1,88 +0,0 @@
/*
Project: $PROJECTNAME$
Copyright (C) $YEAR$ Free Software Foundation
Author: $FULLUSERNAME$
Created: $DATE$ by $USERNAME$
Application Controller
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.
*/
#include "AppController.h"
@implementation AppController
+ (void)initialize
{
NSMutableDictionary *defaults = [NSMutableDictionary dictionary];
/*
* Register your app's defaults here by adding objects to the
* dictionary, eg
*
* [defaults setObject:anObject forKey:keyForThatObject];
*
*/
[[NSUserDefaults standardUserDefaults] registerDefaults:defaults];
[[NSUserDefaults standardUserDefaults] synchronize];
}
- (id)init
{
if ((self = [super init]))
{
}
return self;
}
- (void)dealloc
{
[super dealloc];
}
- (void)awakeFromNib
{
[[NSApp mainMenu] setTitle:@"$PROJECTNAME$"];
}
- (void)applicationDidFinishLaunching:(NSNotification *)aNotif
{
// Uncomment if your application is Renaissance-based
// [NSBundle loadGSMarkupNamed:@"Main" owner:self];
}
- (BOOL)applicationShouldTerminate:(id)sender
{
return YES;
}
- (void)applicationWillTerminate:(NSNotification *)aNotif
{
}
- (BOOL)application:(NSApplication *)application openFile:(NSString *)fileName
{
}
- (void)showPrefPanel:(id)sender
{
}
@end

View file

@ -1,74 +0,0 @@
{
"## Comment" = "Do NOT change this file, Gorm maintains it";
FirstResponder = {
Actions = (
"clearFile:",
"docFieldSet:",
"setAppType:",
"removeDocType:",
"setAppClass:",
"setDocBasedApp:",
"setDocIcon:",
"setFile:",
"showDocTypesPanel:"
);
Super = NSObject;
};
PCAppProject = {
Actions = (
"setAppClass:",
"setFile:",
"clearFile:",
"addDocType:",
"removeDocType:",
"setCurrentLanguage:",
"showDocTypesPanel:",
"setDocBasedApp:",
"docFieldSet:",
"setAppType:"
);
Outlets = (
projectAttributesView,
appClassField,
iconView,
setFieldButton,
clearFieldButton,
appImageField,
helpFileField,
mainNIBField,
docTypesButton,
docTypesPanel,
addDocTypeButton,
removeDocTypeButton,
docBasedAppButton,
docTypeLabel,
docTypeField,
docNameLabel,
docNameField,
docIconLabel,
docIconField,
docExtensionsLabel,
docExtensionsField,
docRoleLabel,
docRoleField,
docClassLabel,
docClassField,
docTypesList,
typeColumn,
nameColumn,
extensionsColumn,
iconColumn,
roleColumn,
classColumn,
appTypeField
);
Super = NSObject;
};
PCAppTextField = {
Actions = (
);
Outlets = (
);
Super = NSTextField;
};
}

View file

@ -1,18 +0,0 @@
{
"## Comment" = "Do NOT change this file, Gorm maintains it";
AppController = {
Actions = (
"showPrefPanel:"
);
Outlets = (
);
Super = NSObject;
};
FirstResponder = {
Actions = (
"orderFrontFontPanel:",
"showPrefPanel:"
);
Super = NSObject;
};
}

View file

@ -1,8 +0,0 @@
<?xml version="1.0"?>
<!DOCTYPE gsmarkup>
<gsmarkup>
<objects>
<window/>
</objects>
</gsmarkup>

View file

@ -1,32 +0,0 @@
<?xml version="1.0"?>
<!DOCTYPE gsmarkup>
<!-- Remove any menu items and submenus which you don't need. Add any
menu items and submenus which you need. -->
<gsmarkup>
<objects>
<menu type="main">
<menu title="Info">
<menuItem title="Info Panel..."
action="orderFrontStandardInfoPanel:"/>
<menuItem title="Preferences..." action=""/>
<menuItem title="Help..." action="orderFrontHelpPanel:" key="?"/>
</menu>
<menu title="Windows">
<menuItem title="Arrange In Front" action="arrangeInFront:"/>
<menuItem title="Miniaturize Window" action="performMiniaturize:"
key="m"/>
<menuItem title="Close Window" action="performClose:" key="w"/>
</menu>
<menu title="Services" type="services"/>
<menuItem title="Hide" action="hide:" key="h"/>
<menuItem title="Quit" action="terminate:" key="q"/>
</menu>
</objects>
</gsmarkup>

View file

@ -1,63 +0,0 @@
<?xml version="1.0"?>
<!DOCTYPE gsmarkup>
<gsmarkup>
<objects>
<menu type="main">
<menu title="MyApplication" type="apple">
<menuItem title="About MyApplication"
action="orderFrontStandardAboutPanel:"/>
<menuSeparator/>
<menuItem title="Preferences..." action="runPreferencesPanel:"/>
<menu title="Services" type="services"/>
<menuSeparator/>
<menuItem title="Hide MyApplication" action="hide:" key="h"/>
<menuItem title="Hide Others" action="hideOtherApplications:"/>
<menuItem title="Show All" action="unhideAllApplications:"/>
<menuSeparator/>
<menuItem title="Quit MyApplication" action="terminate:" key="q"/>
</menu>
<menu title="File">
<menuItem title="New" action="" key="n"/>
<menuItem title="Open..." action="" key="o"/>
<menu title="Open Recent" type="openRecent">
<menuItem title="Clear menu" action=""/>
</menu>
<menuSeparator/>
<menuItem title="Close" action="performClose:" key="w"/>
<menuItem title="Save" action="" key="s"/>
<menuItem title="Save As..." action="" key="S"/>
<menuItem title="Revert" action=""/>
<menuSeparator/>
<menuItem title="Page Setup..." action="runPageLayout:" key="P"/>
<menuItem title="Print..." action="print:" key="p"/>
</menu>
<menu title="Edit">
<menuItem title="Undo" action="undo:" key="z"/>
<menuItem title="Redo" action="redo:" key="Z"/>
<menuSeparator/>
<menuItem title="Cut" action="cut:" key="x"/>
<menuItem title="Copy" action="copy:" key="c"/>
<menuItem title="Paste" action="paste:" key="v"/>
<menuItem title="Delete" action="delete:"/>
<menuItem title="Select All" action="selectAll:" key="a"/>
</menu>
<menu title="Window" type="windows">
<menuItem title="Close Window" action="performClose:" key="w"/>
<menuItem title="Minimize Window" action="performMiniaturize:"
key="m"/>
<menuSeparator/>
<menuItem title="Bring All to Front" action="arrangeInFront:" key=""/>
</menu>
<menu title="Help">
<menuItem title="MyApplication Help" action="showHelp:" key="?"/>
</menu>
</menu>
</objects>
</gsmarkup>

View file

@ -1,44 +0,0 @@
{
APPLICATIONICON = "";
APP_DOCUMENT_BASED = NO;
APP_TYPE = GORM;
CLASS_FILES = ("AppController.m");
COMPILEROPTIONS = "";
CPPOPTIONS = "";
LINKEROPTIONS = "";
CREATION_DATE = "";
DOCU_FILES = ();
FRAMEWORKS = ();
HEADER_FILES = ("AppController.h");
INTERFACES = ();
IMAGES = ();
LANGUAGE = "English";
USER_LANGUAGES = ();
LAST_EDITING = "";
LIBRARIES = ("gnustep-base","gnustep-gui");
LOCALIZED_RESOURCES = ();
MAININTERFACE = "";
MAKEFILEDIR = "$(GNUSTEP_MAKEFILES)";
INSTALLDIR = "$(HOME)/GNUstep";
OBJC_COMPILEROPTIONS = "";
OTHER_RESOURCES = ();
OTHER_SOURCES = ("");
PRINCIPAL_CLASS = "NSApplication";
PROJECT_AUTHORS = ();
PROJECT_CREATOR = "";
PROJECT_DESCRIPTION = "No description avaliable!";
PROJECT_DOCUMENTTYPES = ();
PROJECT_GROUP = "No group avaliable!";
PROJECT_SUMMARY = "No summary avaliable!";
PROJECT_RELEASE = "0.1";
PROJECT_COPYRIGHT = "Copyright (C) 200x";
PROJECT_COPYRIGHT_DESC = "Released under ...";
PROJECT_MAINTAINER = "";
PROJECT_NAME = "";
PROJECT_TYPE = "Application";
PROJECT_URL = "";
SEARCH_HEADER_DIRS = ();
SEARCH_LIB_DIRS = ();
SUBPROJECTS = ();
SUPPORTING_FILES = ("GNUmakefile.preamble", "GNUmakefile", "GNUmakefile.postamble");
}

View file

@ -1,46 +0,0 @@
/*
Project: $PROJECTNAME$
Copyright (C) $YEAR$ Free Software Foundation
Author: $FULLUSERNAME$
Created: $DATE$ by $USERNAME$
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.
*/
#include <AppKit/AppKit.h>
int
main(int argc, const char *argv[])
{
// Uncomment if your application is Renaissance application
/* CREATE_AUTORELEASE_POOL (pool);
[NSApplication sharedApplication];
[NSApp setDelegate:[AppController new]];
#ifdef GNUSTEP
[NSBundle loadGSMarkupNamed:@"MainMenu-GNUstep" owner:[NSApp delegate]];
#else
[NSBundle loadGSMarkupNamed:@"MainMenu-OSX" owner:[NSApp delegate]];
#endif
RELEASE (pool);
*/
return NSApplicationMain (argc, argv);
}

View file

@ -1,43 +0,0 @@
#
# GNUmakefile - BundleProject
#
include $(GNUSTEP_MAKEFILES)/common.make
#
# Bundle
#
BUNDLE_NAME = Bundle
BUNDLE_EXTENSION = .project
Bundle_PRINCIPAL_CLASS = PCBundleProj
#
# Additional libraries
#
Bundle_LIBRARIES_DEPEND_UPON += -lProjectCenter
#
# Resource files
#
Bundle_RESOURCE_FILES = \
Resources/PC.project \
Resources/Inspector.gorm
#
# Header files
#
Bundle_HEADERS = \
PCBundleProj.h \
PCBundleProject.h
#
# Class files
#
Bundle_OBJC_FILES= \
PCBundleProj.m \
PCBundleProject.m
include ../GNUmakefile.bundles
include $(GNUSTEP_MAKEFILES)/bundle.make

View file

@ -1,50 +0,0 @@
/*
GNUstep ProjectCenter - http://www.gnustep.org/experience/ProjectCenter.html
Copyright (C) 2001-2004 Free Software Foundation
Authors: Philippe C.D. Robert
Serg Stoyan
This file is part of GNUstep.
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.
*/
#ifndef _PCBUNDLEPROJ_H
#define _PCBUNDLEPROJ_H
#include <AppKit/AppKit.h>
#include <ProjectCenter/ProjectCenter.h>
@interface PCBundleProj : NSObject <ProjectType>
{
}
//----------------------------------------------------------------------------
// ProjectType
//----------------------------------------------------------------------------
+ (id)sharedCreator;
- (Class)projectClass;
- (NSString *)projectTypeName;
- (PCProject *)createProjectAt:(NSString *)path;
- (PCProject *)openProjectAt:(NSString *)path;
@end
#endif

View file

@ -1,155 +0,0 @@
/*
GNUstep ProjectCenter - http://www.gnustep.org/experience/ProjectCenter.html
Copyright (C) 2001-2004 Free Software Foundation
Authors: Philippe C.D. Robert
Serg Stoyan
Description: creates new project of the type Bundle!
This file is part of GNUstep.
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.
*/
#include <ProjectCenter/PCFileCreator.h>
#include "ProjectCenter/PCMakefileFactory.h"
#include "PCBundleProj.h"
#include "PCBundleProject.h"
@implementation PCBundleProj
static PCBundleProj *_creator = nil;
//----------------------------------------------------------------------------
// ProjectType
//----------------------------------------------------------------------------
+ (id)sharedCreator
{
if (!_creator)
{
_creator = [[[self class] alloc] init];
}
return _creator;
}
- (Class)projectClass
{
return [PCBundleProject class];
}
- (NSString *)projectTypeName
{
return @"Bundle";
}
- (PCProject *)createProjectAt:(NSString *)path
{
PCBundleProject *project = nil;
NSFileManager *fm = [NSFileManager defaultManager];
NSAssert(path,@"No valid project path provided!");
if ([fm createDirectoryAtPath:path attributes:nil])
{
NSBundle *projectBundle = nil;
NSMutableDictionary *projectDict = nil;
NSString *projectName = nil;
NSString *_file = nil;
NSString *_2file = nil;
// NSString *_lresourcePath;
NSString *_resourcePath;
PCFileCreator *pcfc = [PCFileCreator sharedCreator];
project = [[[PCBundleProject alloc] init] autorelease];
projectBundle = [NSBundle bundleForClass:[self class]];
_file = [projectBundle pathForResource:@"PC" ofType:@"project"];
projectDict = [NSMutableDictionary dictionaryWithContentsOfFile:_file];
// Customise the project
projectName = [path lastPathComponent];
if ([[projectName pathExtension] isEqualToString:@"subproj"])
{
projectName = [projectName stringByDeletingPathExtension];
}
[projectDict setObject:projectName forKey:PCProjectName];
[projectDict setObject:[self projectTypeName] forKey:PCProjectType];
[projectDict setObject:projectName forKey:PCPrincipalClass];
[projectDict setObject:[[NSCalendarDate date] description]
forKey:PCCreationDate];
[projectDict setObject:NSFullUserName() forKey:PCProjectCreator];
[projectDict setObject:NSFullUserName() forKey:PCProjectMaintainer];
// The path cannot be in the PC.project file!
[project setProjectPath:path];
[project setProjectName:projectName];
// Copy the project files to the provided path
// $PROJECTNAME$.m
_file = [NSString stringWithFormat:@"%@", projectName];
_2file = [NSString stringWithFormat:@"%@.m", projectName];
[pcfc createFileOfType:ObjCClass
path:[path stringByAppendingPathComponent:_file]
project:project];
[projectDict setObject:[NSArray arrayWithObjects:_2file,nil]
forKey:PCClasses];
// $PROJECTNAME$.h already created by creating $PROJECTNAME$.m
_file = [NSString stringWithFormat:@"%@.h", projectName];
[projectDict setObject:[NSArray arrayWithObjects:_file,nil]
forKey:PCHeaders];
// GNUmakefile.postamble
[[PCMakefileFactory sharedFactory] createPostambleForProject:project];
// Resources
/* _lresourcePath = [path stringByAppendingPathComponent:@"English.lproj"];
[fm createDirectoryAtPath:_resourcePath attributes:nil];*/
_resourcePath = [path stringByAppendingPathComponent:@"Resources"];
[fm createDirectoryAtPath:_resourcePath attributes:nil];
// Set the new dictionary - this causes the GNUmakefile to be written
if (![project assignProjectDict:projectDict])
{
NSRunAlertPanel(@"Attention!",
@"Could not load %@!",
@"OK",nil,nil,path);
return nil;
}
// Save the project to disc
[project save];
}
return project;
}
- (PCProject *)openProjectAt:(NSString *)path
{
NSDictionary *dict = [NSDictionary dictionaryWithContentsOfFile:path];
NSString *pPath = [path stringByDeletingLastPathComponent];
return [[[PCBundleProject alloc]
initWithProjectDictionary:dict
path:pPath] autorelease];
}
@end

View file

@ -1,71 +0,0 @@
/*
GNUstep ProjectCenter - http://www.gnustep.org/experience/ProjectCenter.html
Copyright (C) 2001-2004 Free Software Foundation
Authors: Philippe C.D. Robert
Serg Stoyan
Description: This is the project type 'Bundle' for GNUstep. You never
should create it yourself but use PCBundleProj for doing this.
Otherwise needed files don't get copied to the right place.
This file is part of GNUstep.
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.
*/
#ifndef _PCBUNDLEPROJECT_H
#define _PCBUNDLEPROJECT_H
#include <AppKit/AppKit.h>
#include <ProjectCenter/PCProject.h>
@class PCMakefileFactory;
@interface PCBundleProject : PCProject
{
IBOutlet NSBox *projectAttributesView;
IBOutlet NSTextField *principalClassField;
IBOutlet NSTextField *bundleExtensionField;
}
//----------------------------------------------------------------------------
// Init and free
//----------------------------------------------------------------------------
- (id)init;
- (void)dealloc;
@end
@interface PCBundleProject (GeneratedFiles)
- (BOOL)writeMakefile;
- (void)appendHead:(PCMakefileFactory *)mff;
- (void)appendTail:(PCMakefileFactory *)mff;
@end
@interface PCBundleProject (Inspector)
- (NSView *)projectAttributesView;
- (void)updateInspectorValues:(NSNotification *)aNotif;
- (void)setPrincipalClass:(id)sender;
- (void)setBundleExtension:(id)sender;
@end
#endif

View file

@ -1,300 +0,0 @@
/*
GNUstep ProjectCenter - http://www.gnustep.org/experience/ProjectCenter.html
Copyright (C) 2001-2004 Free Software Foundation
Authors: Philippe C.D. Robert
Serg Stoyan
This file is part of GNUstep.
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.
*/
#include "PCBundleProj.h"
#include "PCBundleProject.h"
#include <ProjectCenter/PCMakefileFactory.h>
#include <ProjectCenter/ProjectCenter.h>
@implementation PCBundleProject
//----------------------------------------------------------------------------
// Init and free
//----------------------------------------------------------------------------
- (id)init
{
if ((self = [super init]))
{
rootKeys = [[NSArray arrayWithObjects:
PCClasses,
PCHeaders,
PCOtherSources,
PCInterfaces,
PCImages,
PCOtherResources,
PCSubprojects,
PCDocuFiles,
PCSupportingFiles,
PCLibraries,
PCNonProject,
nil] retain];
rootCategories = [[NSArray arrayWithObjects:
@"Classes",
@"Headers",
@"Other Sources",
@"Interfaces",
@"Images",
@"Other Resources",
@"Subprojects",
@"Documentation",
@"Supporting Files",
@"Libraries",
@"Non Project Files",
nil] retain];
rootEntries = [[NSDictionary
dictionaryWithObjects:rootCategories forKeys:rootKeys] retain];
}
return self;
}
- (void)dealloc
{
#ifdef DEVELOPMENT
NSLog(@"PCBundleProject: dealloc");
#endif
[rootCategories release];
[rootKeys release];
[rootEntries release];
[projectAttributesView release];
[super dealloc];
}
//----------------------------------------------------------------------------
// Project
//----------------------------------------------------------------------------
- (Class)builderClass
{
return [PCBundleProj class];
}
- (NSString *)projectDescription
{
return @"GNUstep Objective-C bundle project";
}
- (NSArray *)buildTargets
{
return [NSArray arrayWithObjects:
@"bundle", @"debug", @"profile", @"dist", nil];
}
- (NSArray *)sourceFileKeys
{
return [NSArray arrayWithObjects:
PCClasses, PCHeaders, PCOtherSources,
PCSubprojects, PCSupportingFiles, nil];
}
- (NSArray *)resourceFileKeys
{
return [NSArray arrayWithObjects:
PCInterfaces, PCOtherResources, PCImages, PCDocuFiles, nil];
}
- (NSArray *)otherKeys
{
return [NSArray arrayWithObjects:
PCLibraries, PCNonProject, nil];
}
- (NSArray *)allowableSubprojectTypes
{
return [NSArray arrayWithObjects:
@"Aggregate", @"Bundle", @"Tool", @"Library", @"Framework", nil];
}
- (NSArray *)localizableKeys
{
return [NSArray arrayWithObjects:
PCInterfaces, PCImages, PCOtherResources, PCDocuFiles, nil];
}
@end
@implementation PCBundleProject (GeneratedFiles)
- (BOOL)writeMakefile
{
PCMakefileFactory *mf = [PCMakefileFactory sharedFactory];
int i,j;
NSString *mfl = nil;
NSData *mfd = nil;
// Save the GNUmakefile backup
[super writeMakefile];
// Save GNUmakefile.preamble
[mf createPreambleForProject:self];
// Create the new file
[mf createMakefileForProject:projectName];
// Head
[self appendHead:mf];
// Libraries depend upon
[mf appendLibraries:[projectDict objectForKey:PCLibraries]];
// Subprojects
if ([[projectDict objectForKey:PCSubprojects] count] > 0)
{
[mf appendSubprojects:[projectDict objectForKey:PCSubprojects]];
}
// Resources
[mf appendResources];
for (i = 0; i < [[self resourceFileKeys] count]; i++)
{
NSString *k = [[self resourceFileKeys] objectAtIndex:i];
NSMutableArray *resources = [[projectDict objectForKey:k] mutableCopy];
NSString *resourceItem = nil;
for (j = 0; j < [resources count]; j++)
{
resourceItem = [resources objectAtIndex:j];
if ([[resourceItem pathComponents] count] == 1)
{
resourceItem = [NSString stringWithFormat:@"Resources/%@",
resourceItem];
}
[resources replaceObjectAtIndex:j
withObject:resourceItem];
}
[mf appendResourceItems:resources];
[resources release];
}
[mf appendHeaders:[projectDict objectForKey:PCHeaders]];
[mf appendClasses:[projectDict objectForKey:PCClasses]];
[mf appendOtherSources:[projectDict objectForKey:PCOtherSources]];
// Tail
[self appendTail:mf];
// Write the new file to disc!
mfl = [projectPath stringByAppendingPathComponent:@"GNUmakefile"];
if ((mfd = [mf encodedMakefile]))
{
if ([mfd writeToFile:mfl atomically:YES])
{
return YES;
}
}
return NO;
}
- (void)appendHead:(PCMakefileFactory *)mff
{
NSString *installDir = [projectDict objectForKey:PCInstallDir];
[mff appendString:@"\n#\n# Bundle\n#\n"];
[mff appendString:[NSString stringWithFormat:@"VERSION = %@\n",
[projectDict objectForKey:PCRelease]]];
[mff appendString:[NSString stringWithFormat:@"PACKAGE_NAME = %@\n",
projectName]];
[mff appendString:[NSString stringWithFormat:@"BUNDLE_NAME = %@\n",
projectName]];
[mff appendString:[NSString stringWithFormat:@"%@_PRINCIPAL_CLASS = %@\n",
projectName, [projectDict objectForKey:PCPrincipalClass]]];
[mff appendString:[NSString stringWithFormat:@"BUNDLE_EXTENSION = %@\n",
[projectDict objectForKey:PCBundleExtension]]];
if ([installDir isEqualToString:@""])
{
[mff appendString:
[NSString stringWithFormat:@"%@_STANDARD_INSTALL = no\n",
projectName]];
}
else
{
[mff appendString:[NSString stringWithFormat:@"BUNDLE_INSTALL_DIR = %@\n",
installDir]];
}
}
- (void)appendTail:(PCMakefileFactory *)mff
{
[mff appendString:@"\n\n#\n# Makefiles\n#\n"];
[mff appendString:@"-include GNUmakefile.preamble\n"];
[mff appendString:@"include $(GNUSTEP_MAKEFILES)/aggregate.make\n"];
[mff appendString:@"include $(GNUSTEP_MAKEFILES)/bundle.make\n"];
[mff appendString:@"-include GNUmakefile.postamble\n"];
}
@end
@implementation PCBundleProject (Inspector)
- (NSView *)projectAttributesView
{
if (projectAttributesView == nil)
{
if ([NSBundle loadNibNamed:@"Inspector" owner:self] == NO)
{
NSLog(@"PCBundleProject: error loading Inspector NIB!");
return nil;
}
[projectAttributesView retain];
[self updateInspectorValues:nil];
}
return projectAttributesView;
}
- (void)updateInspectorValues:(NSNotification *)aNotif
{
[principalClassField
setStringValue:[projectDict objectForKey:PCPrincipalClass]];
[bundleExtensionField
setStringValue:[projectDict objectForKey:PCBundleExtension]];
}
- (void)setPrincipalClass:(id)sender
{
[self setProjectDictObject:[principalClassField stringValue]
forKey:PCPrincipalClass
notify:YES];
}
- (void)setBundleExtension:(id)sender
{
[self setProjectDictObject:[bundleExtensionField stringValue]
forKey:PCBundleExtension
notify:YES];
}
@end

View file

@ -1,23 +0,0 @@
{
"## Comment" = "Do NOT change this file, Gorm maintains it";
FirstResponder = {
Actions = (
"orderFrontFontPanel:",
"setPrincipalClass:",
"setBundleExtension:"
);
Super = NSObject;
};
PCBundleProject = {
Actions = (
"setPrincipalClass:",
"setBundleExtension:"
);
Outlets = (
projectAttributesView,
principalClassField,
bundleExtensionField
);
Super = NSObject;
};
}

View file

@ -1,40 +0,0 @@
{
BUNDLE_EXTENSION = ".bundle";
CLASS_FILES = ();
COMPILEROPTIONS = "";
CPPOPTIONS = "";
LINKEROPTIONS = "";
CREATION_DATE = "";
DOCU_FILES = ();
FRAMEWORKS = ();
HEADER_FILES = ();
INTERFACES = ();
IMAGES = ();
LANGUAGE = "English";
USER_LANGUAGES = ();
LAST_EDITING = "";
LIBRARIES = ("gnustep-base","gnustep-gui");
LOCALIZED_RESOURCES = ();
MAKEFILEDIR = "$(GNUSTEP_MAKEFILES)";
INSTALLDIR = "$(HOME)/GNUstep/Library/Bundles";
OBJC_COMPILEROPTIONS = "";
OTHER_RESOURCES = ();
OTHER_SOURCES = ();
PRINCIPAL_CLASS = "";
PROJECT_AUTHORS = ();
PROJECT_CREATOR = "";
PROJECT_DESCRIPTION = "No description available!";
PROJECT_GROUP = "No group available!";
PROJECT_SUMMARY = "No summary available!";
PROJECT_RELEASE = "0.1";
PROJECT_COPYRIGHT = "Copyright (C) 200x";
PROJECT_COPYRIGHT_DESC = "Released under ...";
PROJECT_MAINTAINER = "";
PROJECT_NAME = "";
PROJECT_TYPE = "Bundle";
PROJECT_URL = "";
SEARCH_HEADER_DIRS = ();
SEARCH_LIB_DIRS = ();
SUBPROJECTS = ();
SUPPORTING_FILES = ("GNUmakefile.preamble", "GNUmakefile", "GNUmakefile.postamble");
}

View file

@ -1,43 +0,0 @@
#
# GNUmakefile - FrameworkProject
#
include $(GNUSTEP_MAKEFILES)/common.make
#
# Bundle
#
BUNDLE_NAME = Framework
BUNDLE_EXTENSION = .project
Framework_PRINCIPAL_CLASS = PCFrameworkProj
#
# Additional libraries
#
Framework_LIBRARIES_DEPEND_UPON += -lProjectCenter
#
# Resource files
#
Framework_RESOURCE_FILES= \
Resources/PC.project \
Resources/Inspector.gorm
#
# Header files
#
Framework_HEADERS= \
PCFrameworkProj.h \
PCFrameworkProject.h
#
# Class files
#
Framework_OBJC_FILES= \
PCFrameworkProj.m \
PCFrameworkProject.m
include ../GNUmakefile.bundles
include $(GNUSTEP_MAKEFILES)/bundle.make

View file

@ -1,49 +0,0 @@
/*
GNUstep ProjectCenter - http://www.gnustep.org/experience/ProjectCenter.html
Copyright (C) 2004 Free Software Foundation
Authors: Serg Stoyan
This file is part of GNUstep.
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.
*/
#ifndef _PCFRAMEWORKPROJ_H
#define _PCFRAMEWORKPROJ_H
#include <AppKit/AppKit.h>
#include <ProjectCenter/ProjectCenter.h>
@interface PCFrameworkProj : NSObject <ProjectType>
{
}
//----------------------------------------------------------------------------
// ProjectType
//----------------------------------------------------------------------------
+ (id)sharedCreator;
- (Class)projectClass;
- (NSString *)projectTypeName;
- (PCProject *)createProjectAt:(NSString *)path;
- (PCProject *)openProjectAt:(NSString *)path;
@end
#endif

View file

@ -1,154 +0,0 @@
/*
GNUstep ProjectCenter - http://www.gnustep.org/experience/ProjectCenter.html
Copyright (C) 2004 Free Software Foundation
Authors: Serg Stoyan
Description: Creates new project of the type Library!
This file is part of GNUstep.
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.
*/
#include <ProjectCenter/PCFileCreator.h>
#include "ProjectCenter/PCMakefileFactory.h"
#include "PCFrameworkProj.h"
#include "PCFrameworkProject.h"
@implementation PCFrameworkProj
static PCFrameworkProj *_creator = nil;
//----------------------------------------------------------------------------
// ProjectType
//----------------------------------------------------------------------------
+ (id)sharedCreator
{
if (!_creator)
{
_creator = [[[self class] alloc] init];
}
return _creator;
}
- (Class)projectClass
{
return [PCFrameworkProject class];
}
- (NSString *)projectTypeName
{
return @"Framework";
}
- (PCProject *)createProjectAt:(NSString *)path
{
PCFrameworkProject *project = nil;
NSFileManager *fm = [NSFileManager defaultManager];
NSAssert(path,@"No valid project path provided!");
if ([fm createDirectoryAtPath:path attributes:nil])
{
NSBundle *projectBundle = nil;
NSMutableDictionary *projectDict;
NSString *projectName = nil;
NSString *_file = nil;
NSString *_2file = nil;
// NSString *_lresourcePath;
NSString *_resourcePath;
PCFileCreator *pcfc = [PCFileCreator sharedCreator];
project = [[[PCFrameworkProject alloc] init] autorelease];
projectBundle = [NSBundle bundleForClass:[self class]];
_file = [projectBundle pathForResource:@"PC" ofType:@"project"];
projectDict = [NSMutableDictionary dictionaryWithContentsOfFile:_file];
// Customise the project
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:projectName];
// Copy the project files to the provided path
// $PROJECTNAME$.m
_file = [NSString stringWithFormat:@"%@", projectName];
_2file = [NSString stringWithFormat:@"%@.m", projectName];
[pcfc createFileOfType:ObjCClass
path:[path stringByAppendingPathComponent:_file]
project:project];
[projectDict setObject:[NSArray arrayWithObjects:_2file,nil]
forKey:PCClasses];
// $PROJECTNAME$.h already created by creating $PROJECTNAME$.m
_file = [NSString stringWithFormat:@"%@.h", projectName];
[projectDict setObject:[NSArray arrayWithObjects:_file,nil]
forKey:PCHeaders];
[projectDict setObject:[NSArray arrayWithObjects:_file,nil]
forKey:PCPublicHeaders];
// GNUmakefile.postamble
[[PCMakefileFactory sharedFactory] createPostambleForProject:project];
// Resources
/* _lresourcePath = [path stringByAppendingPathComponent:@"English.lproj"];
[fm createDirectoryAtPath:_resourcePath attributes:nil];*/
_resourcePath = [path stringByAppendingPathComponent:@"Resources"];
[fm createDirectoryAtPath:_resourcePath attributes:nil];
// Set the new dictionary - this causes the GNUmakefile
// to be written to disc
if (![project assignProjectDict:projectDict])
{
NSRunAlertPanel(@"Attention!",
@"Could not load %@!",
@"OK",nil,nil,path);
return nil;
}
// Save the project to disc
[project save];
}
return project;
}
- (PCProject *)openProjectAt:(NSString *)path
{
NSDictionary *dict = [NSDictionary dictionaryWithContentsOfFile:path];
NSString *pPath = [path stringByDeletingLastPathComponent];
return [[[PCFrameworkProject alloc]
initWithProjectDictionary:dict
path:pPath] autorelease];
return nil;
}
@end

View file

@ -1,71 +0,0 @@
/*
GNUstep ProjectCenter - http://www.gnustep.org/experience/ProjectCenter.html
Copyright (C) 2004 Free Software Foundation
Authors: Serg Stoyan
Description: This is the project type 'Library' for GNUstep. You never
should create it yourself but use PCFrameworkProj for doing
this. Otherwise needed files don't get copied to the right
place.
This file is part of GNUstep.
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.
*/
#ifndef _PCFRAMEWORKPROJECT_H
#define _PCFRAMEWORKPROJECT_H
#include <AppKit/AppKit.h>
#include <ProjectCenter/PCProject.h>
@class PCMakefileFactory;
@interface PCFrameworkProject : PCProject
{
IBOutlet NSBox *projectAttributesView;
IBOutlet NSTextField *principalClassField;
IBOutlet NSTextField *currentVersionNameField;
}
//----------------------------------------------------------------------------
// Init and free
//----------------------------------------------------------------------------
- (id)init;
- (void)dealloc;
@end
@interface PCFrameworkProject (GeneratedFiles)
- (BOOL)writeMakefile;
- (void)appendHead:(PCMakefileFactory *)mff;
- (void)appendPublicHeaders:(PCMakefileFactory *)mff;
- (void)appendTail:(PCMakefileFactory *)mff;
@end
@interface PCFrameworkProject (Inspector)
- (NSView *)projectAttributesView;
- (void)updateInspectorValues:(NSNotification *)aNotif;
@end
#endif

View file

@ -1,358 +0,0 @@
/*
GNUstep ProjectCenter - http://www.gnustep.org/experience/ProjectCenter.html
Copyright (C) 2005 Free Software Foundation
Authors: Serg Stoyan
This file is part of GNUstep.
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.
*/
#include <ProjectCenter/PCMakefileFactory.h>
#include "PCFrameworkProject.h"
#include "PCFrameworkProj.h"
@implementation PCFrameworkProject
//----------------------------------------------------------------------------
// Init and free
//----------------------------------------------------------------------------
- (id)init
{
if ((self = [super init]))
{
rootKeys = [[NSArray arrayWithObjects:
PCClasses,
PCHeaders,
PCOtherSources,
PCOtherResources,
PCSubprojects,
PCDocuFiles,
PCSupportingFiles,
PCLibraries,
PCNonProject,
nil] retain];
rootCategories = [[NSArray arrayWithObjects:
@"Classes",
@"Headers",
@"Other Sources",
@"Other Resources",
@"Subprojects",
@"Documentation",
@"Supporting Files",
@"Libraries",
@"Non Project Files",
nil] retain];
rootEntries = [[NSDictionary
dictionaryWithObjects:rootCategories forKeys:rootKeys] retain];
}
return self;
}
- (void)dealloc
{
[rootCategories release];
[rootKeys release];
[rootEntries release];
[super dealloc];
}
//----------------------------------------------------------------------------
// Project
//----------------------------------------------------------------------------
- (Class)builderClass
{
return [PCFrameworkProj class];
}
- (BOOL)canHavePublicHeaders
{
return YES;
}
- (NSArray *)publicHeaders
{
return [projectDict objectForKey:PCPublicHeaders];
}
- (void)setHeaderFile:(NSString *)file public:(BOOL)yn
{
NSMutableArray *publicHeaders = nil;
publicHeaders = [[projectDict objectForKey:PCPublicHeaders] copy];
if (yn)
{
[publicHeaders addObject:file];
}
else if ([publicHeaders count] > 0 && [publicHeaders containsObject:file])
{
[publicHeaders removeObject:file];
}
[self setProjectDictObject:publicHeaders
forKey:PCPublicHeaders
notify:YES];
[publicHeaders release];
}
- (NSString *)projectDescription
{
return @"GNUstep Objective-C framework project";
}
- (NSArray *)buildTargets
{
return [NSArray arrayWithObjects:
@"framework", @"debug", @"profile", @"dist", nil];
}
- (NSArray *)sourceFileKeys
{
return [NSArray arrayWithObjects:
PCClasses, PCHeaders, PCOtherSources,
PCSubprojects, PCSupportingFiles, nil];
}
- (NSArray *)resourceFileKeys
{
return [NSArray arrayWithObjects:
PCInterfaces, PCImages, PCOtherResources, PCDocuFiles, nil];
}
- (NSArray *)otherKeys
{
return [NSArray arrayWithObjects: PCLibraries, PCNonProject, nil];
}
- (NSArray *)allowableSubprojectTypes
{
return [NSArray arrayWithObjects:
@"Bundle", @"Tool", nil];
}
- (NSArray *)localizableKeys
{
return [NSArray arrayWithObjects:
PCInterfaces, PCImages, PCOtherResources, PCDocuFiles, nil];
}
// ============================================================================
// ==== File Handling
// ============================================================================
- (void)addFiles:(NSArray *)files forKey:(NSString *)type notify:(BOOL)yn
{
if ([type isEqualToString:PCHeaders])
{
[super addFiles:files forKey:PCPublicHeaders notify:NO];
}
[super addFiles:files forKey:type notify:YES];
}
- (BOOL)renameFile:(NSString *)fromFile toFile:(NSString *)toFile
{
NSString *category = [projectBrowser nameOfSelectedCategory];
BOOL success = NO;
BOOL isPublicHeader = YES;
isPublicHeader =
[[projectDict objectForKey:PCPublicHeaders] containsObject:fromFile];
success = [super renameFile:fromFile toFile:toFile];
if (success && [category isEqualToString:[super categoryForKey:PCHeaders]])
{
if (isPublicHeader == NO)
{
[self setHeaderFile:toFile public:NO];
}
}
return success;
}
@end
@implementation PCFrameworkProject (GeneratedFiles)
- (BOOL)writeMakefile
{
PCMakefileFactory *mf = [PCMakefileFactory sharedFactory];
int i,j;
NSString *mfl = nil;
NSData *mfd = nil;
// Save the GNUmakefile backup
[super writeMakefile];
// Save GNUmakefile.preamble
[mf createPreambleForProject:self];
// Create the new file
[mf createMakefileForProject:projectName];
// Head
[self appendHead:mf];
// Libraries depend upon
[mf appendLibraries:[projectDict objectForKey:PCLibraries]];
// Subprojects
if ([[projectDict objectForKey:PCSubprojects] count] > 0)
{
[mf appendSubprojects:[projectDict objectForKey:PCSubprojects]];
}
// Resources
[mf appendResources];
for (i = 0; i < [[self resourceFileKeys] count]; i++)
{
NSString *k = [[self resourceFileKeys] objectAtIndex:i];
NSMutableArray *resources = [[projectDict objectForKey:k] mutableCopy];
NSString *resourceItem = nil;
for (j = 0; j < [resources count]; j++)
{
resourceItem = [NSString stringWithFormat:@"Resources/%@",
[resources objectAtIndex:j]];
[resources replaceObjectAtIndex:j
withObject:resourceItem];
}
[mf appendResourceItems:resources];
[resources release];
}
[self appendPublicHeaders:mf];
// For compiling
[mf appendClasses:[projectDict objectForKey:PCClasses]
forTarget:projectName];
[mf appendOtherSources:[projectDict objectForKey:PCOtherSources]
forTarget:projectName];
// Tail
[self appendTail:mf];
// Write the new file to disc!
mfl = [projectPath stringByAppendingPathComponent:@"GNUmakefile"];
if ((mfd = [mf encodedMakefile]))
{
if ([mfd writeToFile:mfl atomically:YES])
{
return YES;
}
}
return NO;
}
- (void)appendHead:(PCMakefileFactory *)mff
{
[mff appendString:@"\n#\n# Framework\n#\n"];
[mff appendString:[NSString stringWithFormat:@"VERSION = %@\n",
[projectDict objectForKey:PCRelease]]];
[mff appendString:[NSString stringWithFormat:@"FRAMEWORK_NAME = %@\n",
projectName]];
[mff appendString:[NSString
stringWithFormat:@"%@_CURRENT_VERSION_NAME = %@\n",
projectName, [projectDict objectForKey:PCRelease]]];
[mff appendString:[NSString
stringWithFormat:@"%@_DEPLOY_WITH_CURRENT_VERSION = yes\n", projectName]];
}
- (void)appendPublicHeaders:(PCMakefileFactory *)mff
{
NSArray *array = [projectDict objectForKey:PCPublicHeaders];
if (array == nil || [array count] == 0)
{
return;
}
[mff appendString:@"\n\n#\n# Public headers (will be installed)\n#\n"];
[mff appendString:[NSString stringWithFormat:@"%@_HEADERS = ",
projectName]];
if (array && [array count])
{
NSString *tmp;
NSEnumerator *enumerator = [array objectEnumerator];
while ((tmp = [enumerator nextObject]))
{
[mff appendString:[NSString stringWithFormat:@"\\\n%@ ",tmp]];
}
}
}
- (void)appendTail:(PCMakefileFactory *)mff
{
[mff appendString:@"\n\n#\n# Makefiles\n#\n"];
[mff appendString:@"-include GNUmakefile.preamble\n"];
[mff appendString:@"include $(GNUSTEP_MAKEFILES)/aggregate.make\n"];
[mff appendString:@"include $(GNUSTEP_MAKEFILES)/framework.make\n"];
[mff appendString:@"-include GNUmakefile.postamble\n"];
}
@end
@implementation PCFrameworkProject (Inspector)
- (NSView *)projectAttributesView
{
if (projectAttributesView == nil)
{
if ([NSBundle loadNibNamed:@"Inspector" owner:self] == NO)
{
NSLog(@"PCFrameworkProject: error loading Inspector NIB!");
return nil;
}
[projectAttributesView retain];
[self updateInspectorValues:nil];
}
return projectAttributesView;
}
- (void)updateInspectorValues:(NSNotification *)aNotif
{
[principalClassField
setStringValue:[projectDict objectForKey:PCPrincipalClass]];
}
- (void)setPrincipalClass:(id)sender
{
[self setProjectDictObject:[principalClassField stringValue]
forKey:PCPrincipalClass
notify:YES];
}
@end

View file

@ -1,19 +0,0 @@
{
"## Comment" = "Do NOT change this file, Gorm maintains it";
FirstResponder = {
Actions = (
"orderFrontFontPanel:"
);
Super = NSObject;
};
PCFrameworkProject = {
Actions = (
);
Outlets = (
projectAttributesView,
currentVersionNameField,
principalClassField
);
Super = NSObject;
};
}

View file

@ -1,38 +0,0 @@
{
CLASS_FILES = ();
COMPILEROPTIONS = "";
CPPOPTIONS = "";
LINKEROPTIONS = "";
CREATION_DATE = "";
DOCU_FILES = ();
FRAMEWORKS = ();
HEADER_FILES = ();
HEADERS_INSTALL_DIR = "";
PUBLIC_HEADERS = ();
INTERFACES = ();
IMAGES = ();
LANGUAGE = "English";
LAST_EDITING = "";
LIBRARIES = ("gnustep-base","gnustep-gui");
MAKEFILEDIR = "$(GNUSTEP_MAKEFILES)";
INSTALLDIR = "$(HOME)/GNUstep/Library/Frameworks";
OBJC_COMPILEROPTIONS = "";
OTHER_RESOURCES = ();
OTHER_SOURCES = ();
PROJECT_AUTHORS = ();
PROJECT_CREATOR = "";
PROJECT_DESCRIPTION = "No description avaliable!";
PROJECT_GROUP = "No group avaliable!";
PROJECT_SUMMARY = "No summary avaliable!";
PROJECT_RELEASE = "0.1";
PROJECT_COPYRIGHT = "Copyright (C) 200x";
PROJECT_COPYRIGHT_DESC = "Released under ...";
PROJECT_MAINTAINER = "";
PROJECT_NAME = "";
PROJECT_TYPE = "Framework";
PROJECT_URL = "";
SEARCH_HEADER_DIRS = ();
SEARCH_LIB_DIRS = ();
SUBPROJECTS = ();
SUPPORTING_FILES = ("GNUmakefile.preamble", "GNUmakefile", "GNUmakefile.postamble");
}

View file

@ -1,44 +0,0 @@
#
# GNUmakefile - LibraryProject
#
include $(GNUSTEP_MAKEFILES)/common.make
#
# Bundle
#
BUNDLE_NAME = Library
BUNDLE_EXTENSION = .project
Library_PRINCIPAL_CLASS = PCLibProj
#
# Additional libraries
#
Library_LIBRARIES_DEPEND_UPON += -lProjectCenter
#
# Resource files
#
Library_RESOURCE_FILES= \
Resources/PC.project \
Resources/Version \
Resources/Inspector.gorm
#
# Header files
#
Library_HEADERS= \
PCLibProj.h \
PCLibProject.h
#
# Class files
#
Library_OBJC_FILES= \
PCLibProj.m \
PCLibProject.m
include ../GNUmakefile.bundles
include $(GNUSTEP_MAKEFILES)/bundle.make

View file

@ -1,50 +0,0 @@
/*
GNUstep ProjectCenter - http://www.gnustep.org/experience/ProjectCenter.html
Copyright (C) 2001-2004 Free Software Foundation
Authors: Philippe C.D. Robert
Serg Stoyan
This file is part of GNUstep.
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.
*/
#ifndef _PCLIBPROJ_H
#define _PCLIBPROJ_H
#include <AppKit/AppKit.h>
#include <ProjectCenter/ProjectCenter.h>
@interface PCLibProj : NSObject <ProjectType>
{
}
//----------------------------------------------------------------------------
// ProjectType
//----------------------------------------------------------------------------
+ (id)sharedCreator;
- (Class)projectClass;
- (NSString *)projectTypeName;
- (PCProject *)createProjectAt:(NSString *)path;
- (PCProject *)openProjectAt:(NSString *)path;
@end
#endif

View file

@ -1,160 +0,0 @@
/*
GNUstep ProjectCenter - http://www.gnustep.org/experience/ProjectCenter.html
Copyright (C) 2001-2004 Free Software Foundation
Authors: Philippe C.D. Robert
Serg Stoyan
Description: Creates new project of the type Library!
This file is part of GNUstep.
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.
*/
#include <ProjectCenter/PCFileCreator.h>
#include "ProjectCenter/PCMakefileFactory.h"
#include "PCLibProj.h"
#include "PCLibProject.h"
@implementation PCLibProj
static PCLibProj *_creator = nil;
//----------------------------------------------------------------------------
// ProjectType
//----------------------------------------------------------------------------
+ (id)sharedCreator
{
if (!_creator)
{
_creator = [[[self class] alloc] init];
}
return _creator;
}
- (Class)projectClass
{
return [PCLibProject class];
}
- (NSString *)projectTypeName
{
return @"Library";
}
- (PCProject *)createProjectAt:(NSString *)path
{
PCLibProject *project = nil;
NSFileManager *fm = [NSFileManager defaultManager];
NSAssert(path,@"No valid project path provided!");
if ([fm createDirectoryAtPath:path attributes:nil])
{
NSBundle *projectBundle = nil;
NSMutableDictionary *projectDict;
NSString *projectName = nil;
NSString *_file = nil;
NSString *_2file = nil;
// NSString *_lresourcePath;
NSString *_resourcePath;
PCFileCreator *pcfc = [PCFileCreator sharedCreator];
project = [[[PCLibProject alloc] init] autorelease];
projectBundle = [NSBundle bundleForClass:[self class]];
_file = [projectBundle pathForResource:@"PC" ofType:@"project"];
projectDict = [NSMutableDictionary dictionaryWithContentsOfFile:_file];
// Customise the project
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];
[projectDict setObject:NSFullUserName() forKey:PCProjectCreator];
[projectDict setObject:NSFullUserName() forKey:PCProjectMaintainer];
// The path cannot be in the PC.project file!
[project setProjectPath:path];
[project setProjectName:projectName];
// Copy the project files to the provided path
// $PROJECTNAME$.m
_file = [NSString stringWithFormat:@"%@", projectName];
_2file = [NSString stringWithFormat:@"%@.m", projectName];
[pcfc createFileOfType:ObjCClass
path:[path stringByAppendingPathComponent:_file]
project:project];
[projectDict setObject:[NSArray arrayWithObjects:_2file,nil]
forKey:PCClasses];
// $PROJECTNAME$.h already created by creating $PROJECTNAME$.m
_file = [NSString stringWithFormat:@"%@.h", projectName];
[projectDict setObject:[NSArray arrayWithObjects:_file,nil]
forKey:PCHeaders];
[projectDict setObject:[NSArray arrayWithObjects:_file,nil]
forKey:PCPublicHeaders];
// GNUmakefile.postamble
[[PCMakefileFactory sharedFactory] createPostambleForProject:project];
// Resources
/* _lresourcePath = [path stringByAppendingPathComponent:@"English.lproj"];
[fm createDirectoryAtPath:_resourcePath attributes:nil];*/
_resourcePath = [path stringByAppendingPathComponent:@"Resources"];
[fm createDirectoryAtPath:_resourcePath attributes:nil];
_file = [projectBundle pathForResource:@"Version" ofType:@""];
_2file = [_resourcePath stringByAppendingPathComponent:@"Version"];
[fm copyPath:_file toPath:_2file handler:nil];
// Set the new dictionary - this causes the GNUmakefile
// to be written to disc
if (![project assignProjectDict:projectDict])
{
NSRunAlertPanel(@"Attention!",
@"Could not load %@!",
@"OK",nil,nil,path);
return nil;
}
// Save the project to disc
[project save];
}
return project;
}
- (PCProject *)openProjectAt:(NSString *)path
{
NSDictionary *dict = [NSDictionary dictionaryWithContentsOfFile:path];
NSString *pPath = [path stringByDeletingLastPathComponent];
return [[[PCLibProject alloc] initWithProjectDictionary:dict
path:pPath] autorelease];
}
@end

View file

@ -1,69 +0,0 @@
/*
GNUstep ProjectCenter - http://www.gnustep.org/experience/ProjectCenter.html
Copyright (C) 2001-2004 Free Software Foundation
Authors: Philippe C.D. Robert
Serg Stoyan
Description: This is the project type 'Library' for GNUstep. You never
should create it yourself but use PCLibProj for doing this.
Otherwise needed files don't get copied to the right place.
This file is part of GNUstep.
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.
*/
#ifndef _PCLIBPROJECT_H
#define _PCLIBPROJECT_H
#include <AppKit/AppKit.h>
#include <ProjectCenter/PCProject.h>
@class PCMakefileFactory;
@interface PCLibProject : PCProject
{
IBOutlet NSBox *projectAttributesView;
}
//----------------------------------------------------------------------------
// Init and free
//----------------------------------------------------------------------------
- (id)init;
- (void)dealloc;
@end
@interface PCLibProject (GeneratedFiles)
- (BOOL)writeMakefile;
- (void)appendHead:(PCMakefileFactory *)mff;
- (void)appendPublicHeaders:(PCMakefileFactory *)mff;
- (void)appendTail:(PCMakefileFactory *)mff;
@end
@interface PCLibProject (Inspector)
- (NSView *)projectAttributesView;
- (void)updateInspectorValues:(NSNotification *)aNotif;
@end
#endif

View file

@ -1,353 +0,0 @@
/*
GNUstep ProjectCenter - http://www.gnustep.org/experience/ProjectCenter.html
Copyright (C) 2001-2004 Free Software Foundation
Authors: Philippe C.D. Robert
Serg Stoyan
This file is part of GNUstep.
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.
*/
#include <ProjectCenter/PCMakefileFactory.h>
#include "PCLibProject.h"
#include "PCLibProj.h"
@implementation PCLibProject
//----------------------------------------------------------------------------
// Init and free
//----------------------------------------------------------------------------
- (id)init
{
if ((self = [super init]))
{
rootKeys = [[NSArray arrayWithObjects:
PCClasses,
PCHeaders,
PCOtherSources,
PCOtherResources,
PCSubprojects,
PCDocuFiles,
PCSupportingFiles,
PCLibraries,
PCNonProject,
nil] retain];
rootCategories = [[NSArray arrayWithObjects:
@"Classes",
@"Headers",
@"Other Sources",
@"Other Resources",
@"Subprojects",
@"Documentation",
@"Supporting Files",
@"Libraries",
@"Non Project Files",
nil] retain];
rootEntries = [[NSDictionary
dictionaryWithObjects:rootCategories forKeys:rootKeys] retain];
}
return self;
}
- (void)dealloc
{
[rootCategories release];
[rootKeys release];
[rootEntries release];
[super dealloc];
}
//----------------------------------------------------------------------------
// Project
//----------------------------------------------------------------------------
- (Class)builderClass
{
return [PCLibProj class];
}
- (BOOL)canHavePublicHeaders
{
return YES;
}
- (NSArray *)publicHeaders
{
return [projectDict objectForKey:PCPublicHeaders];
}
- (void)setHeaderFile:(NSString *)file public:(BOOL)yn
{
NSMutableArray *publicHeaders = [projectDict objectForKey:PCPublicHeaders];
if (yn)
{
[publicHeaders addObject:file];
}
else if ([publicHeaders count] > 0 && [publicHeaders containsObject:file])
{
[publicHeaders removeObject:file];
}
[self setProjectDictObject:publicHeaders
forKey:PCPublicHeaders
notify:YES];
}
- (NSString *)projectDescription
{
return @"GNUstep Objective-C library project";
}
- (NSArray *)buildTargets
{
return [NSArray arrayWithObjects:
@"library", @"debug", @"profile", @"dist", nil];
}
- (NSArray *)sourceFileKeys
{
return [NSArray arrayWithObjects:
PCClasses, PCHeaders, PCOtherSources,
PCSubprojects, PCSupportingFiles, nil];
}
- (NSArray *)resourceFileKeys
{
return [NSArray arrayWithObjects:
PCInterfaces, PCImages, PCOtherResources, PCDocuFiles, nil];
}
- (NSArray *)otherKeys
{
return [NSArray arrayWithObjects:
PCLibraries, PCNonProject, nil];
}
- (NSArray *)allowableSubprojectTypes
{
return [NSArray arrayWithObjects:
@"Bundle", @"Tool", nil];
}
- (NSArray *)localizableKeys
{
return [NSArray arrayWithObjects:
PCInterfaces, PCImages, PCOtherResources, PCDocuFiles, nil];
}
// ============================================================================
// ==== File Handling
// ============================================================================
- (void)addFiles:(NSArray *)files forKey:(NSString *)type notify:(BOOL)yn
{
if ([type isEqualToString:PCHeaders])
{
[super addFiles:files forKey:PCPublicHeaders notify:NO];
}
[super addFiles:files forKey:type notify:YES];
}
- (BOOL)renameFile:(NSString *)fromFile toFile:(NSString *)toFile
{
NSString *category = [projectBrowser nameOfSelectedCategory];
BOOL success = NO;
BOOL isPublicHeader = YES;
isPublicHeader =
[[projectDict objectForKey:PCPublicHeaders] containsObject:fromFile];
success = [super renameFile:fromFile toFile:toFile];
if (success && [category isEqualToString:[super categoryForKey:PCHeaders]])
{
if (isPublicHeader == NO)
{
[self setHeaderFile:toFile public:NO];
}
}
return success;
}
@end
@implementation PCLibProject (GeneratedFiles)
- (BOOL)writeMakefile
{
PCMakefileFactory *mf = [PCMakefileFactory sharedFactory];
int i,j;
NSString *mfl = nil;
NSData *mfd = nil;
// Save the GNUmakefile backup
[super writeMakefile];
// Save GNUmakefile.preamble
[mf createPreambleForProject:self];
// Create the new file
[mf createMakefileForProject:projectName];
// Head
[self appendHead:mf];
// Libraries depend upon
[mf appendLibraries:[projectDict objectForKey:PCLibraries]];
// Subprojects
if ([[projectDict objectForKey:PCSubprojects] count] > 0)
{
[mf appendSubprojects:[projectDict objectForKey:PCSubprojects]];
}
// Resources
[mf appendResources];
for (i = 0; i < [[self resourceFileKeys] count]; i++)
{
NSString *k = [[self resourceFileKeys] objectAtIndex:i];
NSMutableArray *resources = [[projectDict objectForKey:k] mutableCopy];
NSString *resourceItem = nil;
for (j = 0; j < [resources count]; j++)
{
resourceItem = [resources objectAtIndex:j];
if ([[resourceItem pathComponents] count] == 1)
{
resourceItem = [NSString stringWithFormat:@"Resources/%@",
resourceItem];
}
[resources replaceObjectAtIndex:j
withObject:resourceItem];
}
[mf appendResourceItems:resources];
[resources release];
}
[self appendPublicHeaders:mf];
// For compiling
[mf appendClasses:[projectDict objectForKey:PCClasses]
forTarget:[NSString stringWithFormat:@"lib%@",projectName]];
[mf appendOtherSources:[projectDict objectForKey:PCOtherSources]
forTarget:[NSString stringWithFormat:@"lib%@",projectName]];
// Tail
[self appendTail:mf];
// Write the new file to disc!
mfl = [projectPath stringByAppendingPathComponent:@"GNUmakefile"];
if ((mfd = [mf encodedMakefile]))
{
if ([mfd writeToFile:mfl atomically:YES])
{
return YES;
}
}
return NO;
}
- (void)appendHead:(PCMakefileFactory *)mff
{
[mff appendString:@"\n#\n# Library\n#\n"];
[mff appendString:[NSString stringWithFormat:@"VERSION = %@\n",
[projectDict objectForKey:PCRelease]]];
[mff appendString:[NSString stringWithFormat:@"PACKAGE_NAME = %@\n",
projectName]];
[mff appendString:[NSString stringWithFormat:@"LIBRARY_VAR = %@\n",
[projectName uppercaseString]]];
[mff appendString:[NSString stringWithFormat:@"LIBRARY_NAME = lib%@\n",
projectName]];
[mff appendString:[NSString stringWithFormat:@"lib%@_HEADER_FILES_DIR = %@\n",
projectName,@"."]];
[mff appendString:[NSString stringWithFormat:
@"lib%@_HEADER_FILES_INSTALL_DIR = /%@\n", projectName, projectName]];
}
- (void)appendPublicHeaders:(PCMakefileFactory *)mff
{
NSArray *array = [projectDict objectForKey:PCPublicHeaders];
if ([array count] == 0)
{
return;
}
[mff appendString:@"\n\n#\n# Public headers (will be installed)\n#\n"];
[mff appendString:[NSString stringWithFormat:@"%@_HEADERS = ",
projectName]];
if (array && [array count])
{
NSString *tmp;
NSEnumerator *enumerator = [array objectEnumerator];
while ((tmp = [enumerator nextObject]))
{
[mff appendString:[NSString stringWithFormat:@"\\\n%@ ",tmp]];
}
}
}
- (void)appendTail:(PCMakefileFactory *)mff
{
[mff appendString:@"\n\n#\n# Makefiles\n#\n"];
[mff appendString:@"-include GNUmakefile.preamble\n"];
[mff appendString:@"include $(GNUSTEP_MAKEFILES)/aggregate.make\n"];
[mff appendString:@"include $(GNUSTEP_MAKEFILES)/library.make\n"];
[mff appendString:@"-include GNUmakefile.postamble\n"];
}
@end
@implementation PCLibProject (Inspector)
- (NSView *)projectAttributesView
{
if (projectAttributesView == nil)
{
if ([NSBundle loadNibNamed:@"Inspector" owner:self] == NO)
{
NSLog(@"PCLibraryProject: error loading Inspector NIB!");
return nil;
}
[projectAttributesView retain];
[self updateInspectorValues:nil];
}
return projectAttributesView;
}
- (void)updateInspectorValues:(NSNotification *)aNotif
{
}
@end

View file

@ -1,17 +0,0 @@
{
"## Comment" = "Do NOT change this file, Gorm maintains it";
FirstResponder = {
Actions = (
"orderFrontFontPanel:"
);
Super = NSObject;
};
PCLibraryProject = {
Actions = (
);
Outlets = (
projectAttributesView
);
Super = NSObject;
};
}

View file

@ -1,38 +0,0 @@
{
CLASS_FILES = ();
COMPILEROPTIONS = "";
CPPOPTIONS = "";
LINKEROPTIONS = "";
CREATION_DATE = "";
DOCU_FILES = ();
FRAMEWORKS = ();
HEADER_FILES = ();
HEADERS_INSTALL_DIR = "";
PUBLIC_HEADERS = ();
LANGUAGE = "English";
USER_LANGUAGES = ();
LAST_EDITING = "";
LIBRARIES = ("gnustep-base","gnustep-gui");
LOCALIZED_RESOURCES = ();
MAKEFILEDIR = "$(GNUSTEP_MAKEFILES)";
INSTALLDIR = "$(HOME)/GNUstep/Library/Libraries";
OBJC_COMPILEROPTIONS = "";
OTHER_RESOURCES = ("Version");
OTHER_SOURCES = ();
PROJECT_AUTHORS = ();
PROJECT_CREATOR = "";
PROJECT_DESCRIPTION = "No description available!";
PROJECT_GROUP = "No group available!";
PROJECT_SUMMARY = "No summary available!";
PROJECT_RELEASE = "0.1";
PROJECT_COPYRIGHT = "Copyright (C) 200x";
PROJECT_COPYRIGHT_DESC = "Released under ...";
PROJECT_MAINTAINER = "";
PROJECT_NAME = "";
PROJECT_TYPE = "Library";
PROJECT_URL = "";
SEARCH_HEADER_DIRS = ();
SEARCH_LIB_DIRS = ();
SUBPROJECTS = ();
SUPPORTING_FILES = ("GNUmakefile.preamble", "GNUmakefile", "GNUmakefile.postamble");
}

View file

@ -1,12 +0,0 @@
# This file is included in various Makefile's to get version information.
# Compatible with Bourne shell syntax, so it can included there too.
# The gcc version required to compile the library.
GCC_VERSION=2.8.0
# The version number of this release.
MAJOR_VERSION=0
MINOR_VERSION=0
SUBMINOR_VERSION=1
LIB_VERSION=${MAJOR_VERSION}.${MINOR_VERSION}.${SUBMINOR_VERSION}
VERSION=${LIB_VERSION}

View file

@ -1,41 +0,0 @@
#
# GNUmakefile - Aggregate.project
#
include $(GNUSTEP_MAKEFILES)/common.make
#
# Bundle
#
BUNDLE_NAME = ResourceSet
BUNDLE_EXTENSION = .project
ResourceSet_PRINCIPAL_CLASS = PCResourceSetProj
#
# Additional libraries
#
ResourceSet_LIBRARIES_DEPEND_UPON += -lProjectCenter
#
# Resource files
#
ResourceSet_RESOURCE_FILES= \
Resources/PC.project \
Resources/Inspector.gorm
#
# Header files
#
ResourceSet_HEADERS= \
PCResourceSetProj.h \
PCResourceSetProject.h
#
# Class files
#
ResourceSet_OBJC_FILES= \
PCResourceSetProj.m \
PCResourceSetProject.m
include ../GNUmakefile.bundles
include $(GNUSTEP_MAKEFILES)/bundle.make

View file

@ -1,49 +0,0 @@
/*
GNUstep ProjectCenter - http://www.gnustep.org/experience/ProjectCenter.html
Copyright (C) 2004 Free Software Foundation
Authors: Serg Stoyan
This file is part of GNUstep.
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.
*/
#ifndef _PCRESOURCESETPROJ_H
#define _PCRESOURCESETPROJ_H
#include <AppKit/AppKit.h>
#include <ProjectCenter/ProjectCenter.h>
@interface PCResourceSetProj : NSObject <ProjectType>
{
}
//----------------------------------------------------------------------------
// ProjectType
//----------------------------------------------------------------------------
+ (id)sharedCreator;
- (Class)projectClass;
- (NSString *)projectTypeName;
- (PCProject *)createProjectAt:(NSString *)path;
- (PCProject *)openProjectAt:(NSString *)path;
@end
#endif

View file

@ -1,127 +0,0 @@
/*
GNUstep ProjectCenter - http://www.gnustep.org/experience/ProjectCenter.html
Copyright (C) 2004 Free Software Foundation
Authors: Serg Stoyan
This file is part of GNUstep.
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.
*/
#include "ProjectCenter/PCFileCreator.h"
#include "ProjectCenter/PCMakefileFactory.h"
#include "PCResourceSetProj.h"
#include "PCResourceSetProject.h"
@implementation PCResourceSetProj
static PCResourceSetProj *_creator = nil;
//----------------------------------------------------------------------------
// ProjectType
//----------------------------------------------------------------------------
+ (id)sharedCreator
{
if (!_creator)
{
_creator = [[[self class] alloc] init];
}
return _creator;
}
- (Class)projectClass
{
return [PCResourceSetProject class];
}
- (NSString *)projectTypeName
{
return @"Resource Set";
}
- (PCProject *)createProjectAt:(NSString *)path
{
PCResourceSetProject *project = nil;
NSFileManager *fm = [NSFileManager defaultManager];
NSAssert(path,@"No valid project path provided!");
if ([fm createDirectoryAtPath:path attributes:nil])
{
NSString *_file = nil;
NSMutableDictionary *projectDict = nil;
NSBundle *projectBundle = nil;
NSString *projectName = nil;
project = [[[PCResourceSetProject alloc] init] autorelease];
projectBundle = [NSBundle bundleForClass:[self class]];
_file = [projectBundle pathForResource:@"PC" ofType:@"project"];
projectDict = [NSMutableDictionary dictionaryWithContentsOfFile:_file];
// Customise the project
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];
[projectDict setObject:NSFullUserName() forKey:PCProjectCreator];
[projectDict setObject:NSFullUserName() forKey:PCProjectMaintainer];
// The path cannot be in the PC.project file!
[project setProjectPath:path];
[project setProjectName:projectName];
// GNUmakefile.postamble
[[PCMakefileFactory sharedFactory] createPostambleForProject:project];
// Set the new dictionary - this causes the GNUmakefile to be written
if(![project assignProjectDict:projectDict])
{
NSRunAlertPanel(@"Attention!",
@"Could not load %@!",
@"OK",nil,nil,path);
return nil;
}
// Save the project to disc
[project save];
}
return project;
}
- (PCProject *)openProjectAt:(NSString *)path
{
NSDictionary *dict = [NSDictionary dictionaryWithContentsOfFile:path];
NSString *pPath = [path stringByDeletingLastPathComponent];
PCResourceSetProject *project = nil;
project = [[[PCResourceSetProject alloc]
initWithProjectDictionary:dict
path:pPath] autorelease];
return project;
}
@end

View file

@ -1,64 +0,0 @@
/*
GNUstep ProjectCenter - http://www.gnustep.org/experience/ProjectCenter.html
Copyright (C) 2004 Free Software Foundation
Authors: Serg Stoyan
This file is part of GNUstep.
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.
*/
#ifndef _PCRESOURCESETPROJECT_H
#define _PCRESOURCESETPROJECT_H
#include <AppKit/AppKit.h>
#include <ProjectCenter/PCProject.h>
@class PCMakefileFactory;
@interface PCResourceSetProject : PCProject
{
IBOutlet NSBox *projectAttributesView;
NSMutableDictionary *infoDict;
}
//----------------------------------------------------------------------------
// Init and free
//----------------------------------------------------------------------------
- (id)init;
- (void)dealloc;
@end
@interface PCResourceSetProject (GeneratedFiles)
- (BOOL)writeMakefile;
- (void)appendHead:(PCMakefileFactory *)mff;
- (void)appendTail:(PCMakefileFactory *)mff;
@end
@interface PCResourceSetProject (Inspector)
- (NSView *)projectAttributesView;
- (void)updateInspectorValues:(NSNotification *)aNotif;
@end
#endif

View file

@ -1,206 +0,0 @@
/*
GNUstep ProjectCenter - http://www.gnustep.org/experience/ProjectCenter.html
Copyright (C) 2004 Free Software Foundation
Authors: Serg Stoyan
This file is part of GNUstep.
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.
*/
#include "PCResourceSetProject.h"
#include "PCResourceSetProj.h"
#include <ProjectCenter/PCMakefileFactory.h>
@implementation PCResourceSetProject
//----------------------------------------------------------------------------
// Init and free
//----------------------------------------------------------------------------
- (id)init
{
if ((self = [super init]))
{
rootKeys = [[NSArray arrayWithObjects:
PCOtherResources,
PCSupportingFiles,
PCNonProject,
nil] retain];
rootCategories = [[NSArray arrayWithObjects:
@"Other Resources",
@"Supporting Files",
@"Non Project Files",
nil] retain];
rootEntries = [[NSDictionary
dictionaryWithObjects:rootCategories forKeys:rootKeys] retain];
}
return self;
}
- (void)dealloc
{
[rootCategories release];
[rootKeys release];
[rootEntries release];
if (projectAttributesView) [projectAttributesView release];
[super dealloc];
}
//----------------------------------------------------------------------------
// Project
//----------------------------------------------------------------------------
- (Class)builderClass
{
return [PCResourceSetProj class];
}
- (NSString *)projectDescription
{
return @"Project that contains resources.";
}
- (NSArray *)resourceFileKeys
{
return [NSArray arrayWithObjects:PCOtherResources, nil];
}
- (NSArray *)otherKeys
{
return [NSArray arrayWithObjects:PCNonProject, nil];
}
- (NSArray *)allowableSubprojectTypes
{
return [NSArray arrayWithObjects:
@"Application", @"Bundle", @"Library", @"Framework", @"Tool", nil];
}
@end
@implementation PCResourceSetProject (GeneratedFiles)
- (BOOL)writeMakefile
{
PCMakefileFactory *mf = [PCMakefileFactory sharedFactory];
NSString *mfl = nil;
NSData *mfd = nil;
int i, j;
// Save the GNUmakefile backup
[super writeMakefile];
// Save GNUmakefile.preamble
[mf createPreambleForProject:self];
// Create the new file
[mf createMakefileForProject:projectName];
// Head
[self appendHead:mf];
// Resources
[mf appendResources];
for (i = 0; i < [[self resourceFileKeys] count]; i++)
{
NSString *k = [[self resourceFileKeys] objectAtIndex:i];
NSMutableArray *resources = [[projectDict objectForKey:k] mutableCopy];
NSString *resourceItem = nil;
for (j = 0; j < [resources count]; j++)
{
resourceItem = [resources objectAtIndex:j];
if ([[resourceItem pathComponents] count] == 1)
{
resourceItem = [NSString stringWithFormat:@"Resources/%@",
resourceItem];
}
[resources replaceObjectAtIndex:j withObject:resourceItem];
}
[mf appendResourceItems:resources];
[resources release];
}
// Tail
[self appendTail:mf];
// Write the new file to disc!
mfl = [projectPath stringByAppendingPathComponent:@"GNUmakefile"];
if ((mfd = [mf encodedMakefile]))
{
if ([mfd writeToFile:mfl atomically:YES])
{
return YES;
}
}
return NO;
}
- (void)appendHead:(PCMakefileFactory *)mff
{
[mff appendString:@"\n#\n# Resource Set\n#\n"];
[mff appendString:[NSString stringWithFormat:@"RESOURCE_SET_NAME = %@\n",
projectName]];
[mff appendString:
[NSString stringWithFormat:@"@%RESOURCE_FILES_INSTALL_DIR = %@\n",
[projectDict objectForKey:PCInstallDir]]];
}
- (void)appendTail:(PCMakefileFactory *)mff
{
[mff appendString:@"\n\n#\n# Makefiles\n#\n"];
[mff appendString:@"-include GNUmakefile.preamble\n"];
[mff appendString:@"include $(GNUSTEP_MAKEFILES)/resource-set.make\n"];
[mff appendString:@"-include GNUmakefile.postamble\n"];
}
@end
@implementation PCResourceSetProject (Inspector)
- (NSView *)projectAttributesView
{
if (projectAttributesView == nil)
{
if ([NSBundle loadNibNamed:@"Inspector" owner:self] == NO)
{
NSLog(@"PCLibraryProject: error loading Inspector NIB!");
return nil;
}
[projectAttributesView retain];
[self updateInspectorValues:nil];
}
return projectAttributesView;
}
- (void)updateInspectorValues:(NSNotification *)aNotif
{
}
@end

View file

@ -1,17 +0,0 @@
{
"## Comment" = "Do NOT change this file, Gorm maintains it";
FirstResponder = {
Actions = (
"orderFrontFontPanel:"
);
Super = NSObject;
};
PCToolProject = {
Actions = (
);
Outlets = (
projectAttributesView
);
Super = NSObject;
};
}

View file

@ -1,27 +0,0 @@
{
COMPILEROPTIONS = "";
CPPOPTIONS = "";
LINKEROPTIONS = "";
CREATION_DATE = "";
LANGUAGE = "English";
LAST_EDITING = "";
MAKEFILEDIR = "$(GNUSTEP_MAKEFILES)";
INSTALLDIR = "$(HOME)/GNUstep";
OBJC_COMPILEROPTIONS = "";
PROJECT_AUTHORS = ();
PROJECT_CREATOR = "";
PROJECT_DESCRIPTION = "No description avaliable!";
PROJECT_GROUP = "No group available!";
PROJECT_SUMMARY = "No summary available!";
PROJECT_RELEASE = "0.1";
PROJECT_COPYRIGHT = "Copyright (C) 200x";
PROJECT_COPYRIGHT_DESC = "Released under ...";
PROJECT_MAINTAINER = "";
PROJECT_NAME = "";
PROJECT_TYPE = "ResourceSet";
PROJECT_URL = "";
SEARCH_HEADER_DIRS = ();
SEARCH_LIB_DIRS = ();
SUBPROJECTS = ();
SUPPORTING_FILES = ("GNUmakefile.preamble", "GNUmakefile", "GNUmakefile.postamble");
}

View file

@ -1,42 +0,0 @@
#
# GNUmakefile - ToolProject
#
include $(GNUSTEP_MAKEFILES)/common.make
#
# Bundle
#
BUNDLE_NAME = Tool
BUNDLE_EXTENSION = .project
Tool_PRINCIPAL_CLASS = PCToolProj
#
# Additional libraries
#
Tool_LIBRARIES_DEPEND_UPON += -lProjectCenter
#
# Resource files
#
Tool_RESOURCE_FILES= \
Resources/PC.project \
Resources/main.m \
Resources/Inspector.gorm
#
# Header files
#
Tool_HEADERS= \
PCToolProj.h \
PCToolProject.h
#
# Class files
#
Tool_OBJC_FILES= \
PCToolProj.m \
PCToolProject.m
include ../GNUmakefile.bundles
include $(GNUSTEP_MAKEFILES)/bundle.make

View file

@ -1,50 +0,0 @@
/*
GNUstep ProjectCenter - http://www.gnustep.org/experience/ProjectCenter.html
Copyright (C) 2001-2004 Free Software Foundation
Authors: Philippe C.D. Robert
Serg Stoyan
This file is part of GNUstep.
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.
*/
#ifndef _PCTOOLPROJ_H
#define _PCTOOLPROJ_H
#include <AppKit/AppKit.h>
#include <ProjectCenter/ProjectCenter.h>
@interface PCToolProj : NSObject <ProjectType>
{
}
//----------------------------------------------------------------------------
// ProjectType
//----------------------------------------------------------------------------
+ (id)sharedCreator;
- (Class)projectClass;
- (NSString *)projectTypeName;
- (PCProject *)createProjectAt:(NSString *)path;
- (PCProject *)openProjectAt:(NSString *)path;
@end
#endif

View file

@ -1,173 +0,0 @@
/*
GNUstep ProjectCenter - http://www.gnustep.org/experience/ProjectCenter.html
Copyright (C) 2001-2004 Free Software Foundation
Authors: Philippe C.D. Robert
Serg Stoyan
Description: Creates new project of the type Tool!
This file is part of GNUstep.
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.
*/
#include "ProjectCenter/PCFileCreator.h"
#include "ProjectCenter/PCMakefileFactory.h"
#include "PCToolProj.h"
#include "PCToolProject.h"
@implementation PCToolProj
static PCToolProj *_creator = nil;
//----------------------------------------------------------------------------
// ProjectType
//----------------------------------------------------------------------------
+ (id)sharedCreator
{
if (!_creator)
{
_creator = [[[self class] alloc] init];
}
return _creator;
}
- (Class)projectClass
{
return [PCToolProject class];
}
- (NSString *)projectTypeName
{
return @"Tool";
}
- (PCProject *)createProjectAt:(NSString *)path
{
PCToolProject *project = nil;
NSFileManager *fm = [NSFileManager defaultManager];
NSAssert(path,@"No valid project path provided!");
if ([fm createDirectoryAtPath:path attributes:nil])
{
NSString *_file = nil;
NSString *_2file = nil;
// NSString *_lresourcePath;
NSString *_resourcePath;
NSMutableDictionary *projectDict = nil;
NSBundle *projectBundle = nil;
NSString *projectName = nil;
NSMutableDictionary *infoDict = nil;
PCFileCreator *fc = [PCFileCreator sharedCreator];
project = [[[PCToolProject alloc] init] autorelease];
projectBundle = [NSBundle bundleForClass:[self class]];
_file = [projectBundle pathForResource:@"PC" ofType:@"project"];
projectDict = [NSMutableDictionary dictionaryWithContentsOfFile:_file];
// Customise the project
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];
[projectDict setObject:NSFullUserName() forKey:PCProjectCreator];
[projectDict setObject:NSFullUserName() forKey:PCProjectMaintainer];
// The path cannot be in the PC.project file!
[project setProjectPath:path];
[project setProjectName:projectName];
// Copy the project files to the provided path
_file = [projectBundle pathForResource:@"main" ofType:@"m"];
_2file = [path stringByAppendingPathComponent:@"main.m"];
[fm copyPath:_file toPath:_2file handler:nil];
[fc replaceTagsInFileAtPath:_2file withProject:project];
// GNUmakefile.postamble
[[PCMakefileFactory sharedFactory] createPostambleForProject:project];
// Resources
/* _lresourcePath = [path stringByAppendingPathComponent:@"English.lproj"];
[fm createDirectoryAtPath:_resourcePath attributes:nil];*/
_resourcePath = [path stringByAppendingPathComponent:@"Resources"];
[fm createDirectoryAtPath:_resourcePath attributes:nil];
// Create the Info-gnustep.plist
infoDict = [NSDictionary dictionaryWithObjectsAndKeys:
@"Generated by ProjectCenter, do not edit", @"!",
projectName, @"ToolName",
@"", @"ToolDescription",
@"", @"ToolIcon",
@"0.1", @"ToolRelease",
@"0.1", @"FullVersionID",
[NSArray array], @"Authors",
@"", @"URL",
@"Copyright (C) 200x by ...", @"Copyright",
@"Released under...", @"CopyrightDescription",
nil];
_2file = [_resourcePath
stringByAppendingPathComponent:@"Info-gnustep.plist"];
[infoDict writeToFile:_2file atomically:YES];
[projectDict
setObject:[NSArray arrayWithObjects:@"Info-gnustep.plist",nil]
forKey:PCOtherResources];
[project assignInfoDict:(NSMutableDictionary *)infoDict];
// Set the new dictionary - this causes the GNUmakefile to be written
if(![project assignProjectDict:projectDict])
{
NSRunAlertPanel(@"Attention!",
@"Could not load %@!",
@"OK",nil,nil,path);
return nil;
}
// Save the project to disc
[project save];
}
return project;
}
- (PCProject *)openProjectAt:(NSString *)path
{
NSDictionary *dict = [NSDictionary dictionaryWithContentsOfFile:path];
NSString *pPath = [path stringByDeletingLastPathComponent];
PCToolProject *project = nil;
project = [[[PCToolProject alloc]
initWithProjectDictionary:dict
path:pPath] autorelease];
[project loadInfoFileAtPath:[path stringByDeletingLastPathComponent]];
return project;
}
@end

View file

@ -1,74 +0,0 @@
/*
GNUstep ProjectCenter - http://www.gnustep.org/experience/ProjectCenter.html
Copyright (C) 2001-2004 Free Software Foundation
Authors: Philippe C.D. Robert
Serg Stoyan
Description: This is the project type 'Tool' for GNUstep. You never should
create it yourself but use PCToolProj for doing this. Otherwise
needed files don't get copied to the right place.
This file is part of GNUstep.
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.
*/
#ifndef _PCTOOLPROJECT_H
#define _PCTOOLPROJECT_H
#include <AppKit/AppKit.h>
#include <ProjectCenter/PCProject.h>
@class PCMakefileFactory;
@interface PCToolProject : PCProject
{
IBOutlet NSBox *projectAttributesView;
NSMutableDictionary *infoDict;
}
//----------------------------------------------------------------------------
// Init and free
//----------------------------------------------------------------------------
- (id)init;
- (void)assignInfoDict:(NSMutableDictionary *)dict;
- (void)loadInfoFileAtPath:(NSString *)path;
- (void)dealloc;
@end
@interface PCToolProject (GeneratedFiles)
- (void)writeInfoEntry:(NSString *)name forKey:(NSString *)key;
- (BOOL)writeInfoFile;
- (BOOL)writeMakefile;
- (void)appendHead:(PCMakefileFactory *)mff;
- (void)appendTail:(PCMakefileFactory *)mff;
@end
@interface PCToolProject (Inspector)
- (NSView *)projectAttributesView;
- (void)updateInspectorValues:(NSNotification *)aNotif;
@end
#endif

View file

@ -1,347 +0,0 @@
/*
GNUstep ProjectCenter - http://www.gnustep.org/experience/ProjectCenter.html
Copyright (C) 2001-2004 Free Software Foundation
Authors: Philippe C.D. Robert
Serg Stoyan
This file is part of GNUstep.
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.
*/
#include "PCToolProject.h"
#include "PCToolProj.h"
#include <ProjectCenter/PCMakefileFactory.h>
@implementation PCToolProject
//----------------------------------------------------------------------------
// Init and free
//----------------------------------------------------------------------------
- (id)init
{
if ((self = [super init]))
{
rootKeys = [[NSArray arrayWithObjects:
PCClasses,
PCHeaders,
PCOtherSources,
PCImages,
PCOtherResources,
PCSubprojects,
PCDocuFiles,
PCSupportingFiles,
PCLibraries,
PCNonProject,
nil] retain];
rootCategories = [[NSArray arrayWithObjects:
@"Classes",
@"Headers",
@"Other Sources",
@"Images",
@"Other Resources",
@"Subprojects",
@"Documentation",
@"Supporting Files",
@"Libraries",
@"Non Project Files",
nil] retain];
rootEntries = [[NSDictionary
dictionaryWithObjects:rootCategories forKeys:rootKeys] retain];
}
return self;
}
- (void)assignInfoDict:(NSMutableDictionary *)dict
{
infoDict = [dict mutableCopy];
}
- (void)loadInfoFileAtPath:(NSString *)path
{
NSString *infoFile = nil;
infoFile = [path stringByAppendingPathComponent:@"Info-gnustep.plist"];
if ([[NSFileManager defaultManager] fileExistsAtPath:infoFile])
{
infoDict = [[NSMutableDictionary alloc] initWithContentsOfFile:infoFile];
}
else
{
infoDict = [[NSMutableDictionary alloc] init];
}
}
- (void)dealloc
{
[rootCategories release];
[rootKeys release];
[rootEntries release];
[super dealloc];
}
//----------------------------------------------------------------------------
// Project
//----------------------------------------------------------------------------
- (Class)builderClass
{
return [PCToolProj class];
}
- (NSString *)projectDescription
{
return @"Project that handles GNUstep/ObjC based tools.";
}
- (BOOL)isExecutable
{
return YES;
}
- (NSString *)execToolName
{
return [NSString stringWithString:@"opentool"];
}
- (NSArray *)buildTargets
{
return [NSArray arrayWithObjects:
@"tool", @"debug", @"profile", @"dist", nil];
}
- (NSArray *)sourceFileKeys
{
return [NSArray arrayWithObjects:
PCClasses, PCHeaders, PCOtherSources, PCSupportingFiles, nil];
}
- (NSArray *)resourceFileKeys
{
return [NSArray arrayWithObjects:
PCImages, PCOtherResources, PCDocuFiles, PCSubprojects, nil];
}
- (NSArray *)otherKeys
{
return [NSArray arrayWithObjects:
PCLibraries, PCNonProject, nil];
}
- (NSArray *)allowableSubprojectTypes
{
return [NSArray arrayWithObjects:@"Bundle", @"Library", @"Framework", nil];
}
- (NSArray *)localizableKeys
{
return [NSArray arrayWithObjects:PCOtherResources,PCDocuFiles,nil];
}
@end
@implementation PCToolProject (GeneratedFiles)
- (void)writeInfoEntry:(NSString *)name forKey:(NSString *)key
{
id entry = [projectDict objectForKey:key];
if (entry == nil)
{
return;
}
if ([entry isKindOfClass:[NSString class]] && [entry isEqualToString:@""])
{
[infoDict removeObjectForKey:name];
return;
}
if ([entry isKindOfClass:[NSArray class]] && [entry count] <= 0)
{
[infoDict removeObjectForKey:name];
return;
}
[infoDict setObject:entry forKey:name];
}
- (BOOL)writeInfoFile
{
NSString *infoFile = nil;
[self writeInfoEntry:@"ToolName" forKey:PCProjectName];
[self writeInfoEntry:@"ToolDescription" forKey:PCDescription];
[self writeInfoEntry:@"ToolIcon" forKey:PCToolIcon];
[self writeInfoEntry:@"ToolRelease" forKey:PCRelease];
[self writeInfoEntry:@"FullVersionID" forKey:PCRelease];
[self writeInfoEntry:@"Authors" forKey:PCAuthors];
[self writeInfoEntry:@"URL" forKey:PCURL];
[self writeInfoEntry:@"Copyright" forKey:PCCopyright];
[self writeInfoEntry:@"CopyrightDescription" forKey:PCCopyrightDescription];
infoFile = [self dirForCategoryKey:PCOtherSources];
infoFile = [infoFile stringByAppendingPathComponent:@"Info-gnustep.plist"];
return [infoDict writeToFile:infoFile atomically:YES];
}
- (BOOL)writeMakefile
{
PCMakefileFactory *mf = [PCMakefileFactory sharedFactory];
int i,j;
NSString *mfl = nil;
NSData *mfd = nil;
// Info-gnustep.plist
[self writeInfoFile];
// Save the GNUmakefile backup
[super writeMakefile];
// Save GNUmakefile.preamble
[mf createPreambleForProject:self];
// Create the new file
[mf createMakefileForProject:projectName];
// Head
[self appendHead:mf];
// Libraries depend upon
[mf appendLibraries:[projectDict objectForKey:PCLibraries]];
// Subprojects
if ([[projectDict objectForKey:PCSubprojects] count] > 0)
{
[mf appendSubprojects:[projectDict objectForKey:PCSubprojects]];
}
// Resources
[mf appendResources];
for (i = 0; i < [[self resourceFileKeys] count]; i++)
{
NSString *k = [[self resourceFileKeys] objectAtIndex:i];
NSMutableArray *resources = [[projectDict objectForKey:k] mutableCopy];
NSString *resourceItem = nil;
for (j = 0; j < [resources count]; j++)
{
resourceItem = [resources objectAtIndex:j];
if ([[resourceItem pathComponents] count] == 1)
{
resourceItem = [NSString stringWithFormat:@"Resources/%@",
resourceItem];
}
[resources replaceObjectAtIndex:j
withObject:resourceItem];
}
[mf appendResourceItems:resources];
[resources release];
}
[mf appendHeaders:[projectDict objectForKey:PCHeaders]];
[mf appendClasses:[projectDict objectForKey:PCClasses]];
[mf appendOtherSources:[projectDict objectForKey:PCOtherSources]];
// Tail
[self appendTail:mf];
// Write the new file to disc!
mfl = [projectPath stringByAppendingPathComponent:@"GNUmakefile"];
if ((mfd = [mf encodedMakefile]))
{
if ([mfd writeToFile:mfl atomically:YES])
{
return YES;
}
}
return NO;
}
- (void)appendHead:(PCMakefileFactory *)mff
{
NSString *installDir = [projectDict objectForKey:PCInstallDir];
[mff appendString:@"\n#\n# Tool\n#\n"];
[mff appendString:[NSString stringWithFormat:@"VERSION = %@\n",
[projectDict objectForKey:PCRelease]]];
[mff appendString:[NSString stringWithFormat:@"PACKAGE_NAME = %@\n",
projectName]];
[mff appendString:[NSString stringWithFormat:@"TOOL_NAME = %@\n",
projectName]];
[mff appendString:[NSString stringWithFormat:@"%@_TOOL_ICON = %@\n",
projectName, [projectDict objectForKey:PCToolIcon]]];
if ([installDir isEqualToString:@""])
{
[mff appendString:
[NSString stringWithFormat:@"%@_STANDARD_INSTALL = no\n",
projectName]];
}
else
{
[mff appendString:
[NSString stringWithFormat:@"GNUSTEP_INSTALLATION_DIR = %@\n",
installDir]];
}
}
- (void)appendTail:(PCMakefileFactory *)mff
{
[mff appendString:@"\n\n#\n# Makefiles\n#\n"];
[mff appendString:@"-include GNUmakefile.preamble\n"];
[mff appendString:@"include $(GNUSTEP_MAKEFILES)/aggregate.make\n"];
[mff appendString:@"include $(GNUSTEP_MAKEFILES)/tool.make\n"];
[mff appendString:@"-include GNUmakefile.postamble\n"];
}
@end
@implementation PCToolProject (Inspector)
- (NSView *)projectAttributesView
{
if (projectAttributesView == nil)
{
if ([NSBundle loadNibNamed:@"Inspector" owner:self] == NO)
{
NSLog(@"PCLibraryProject: error loading Inspector NIB!");
return nil;
}
[projectAttributesView retain];
[self updateInspectorValues:nil];
}
return projectAttributesView;
}
- (void)updateInspectorValues:(NSNotification *)aNotif
{
}
@end

View file

@ -1,17 +0,0 @@
{
"## Comment" = "Do NOT change this file, Gorm maintains it";
FirstResponder = {
Actions = (
"orderFrontFontPanel:"
);
Super = NSObject;
};
PCToolProject = {
Actions = (
);
Outlets = (
projectAttributesView
);
Super = NSObject;
};
}

View file

@ -1,38 +0,0 @@
{
CLASS_FILES = ();
COMPILEROPTIONS = "";
CPPOPTIONS = "";
LINKEROPTIONS = "";
CREATION_DATE = "";
DOCU_FILES = ();
FRAMEWORKS = ();
HEADER_FILES = ();
IMAGES = ();
LANGUAGE = "English";
USER_LANGUAGES = ();
LAST_EDITING = "";
LIBRARIES = ("gnustep-base");
LOCALIZED_RESOURCES = ();
MAKEFILEDIR = "$(GNUSTEP_MAKEFILES)";
INSTALLDIR = "$(HOME)/GNUstep/Tools";
OBJC_COMPILEROPTIONS = "";
OTHER_RESOURCES = ("Version");
OTHER_SOURCES = ("main.m");
PROJECT_AUTHORS = ();
PROJECT_CREATOR = "";
PROJECT_DESCRIPTION = "No description available!";
PROJECT_GROUP = "No group available!";
PROJECT_SUMMARY = "No summary available!";
PROJECT_RELEASE = "0.1";
PROJECT_COPYRIGHT = "Copyright (C) 200x";
PROJECT_COPYRIGHT_DESC = "Released under ...";
PROJECT_MAINTAINER = "";
PROJECT_NAME = "";
PROJECT_TYPE = "Tool";
PROJECT_URL = "";
SEARCH_HEADER_DIRS = ();
SEARCH_LIB_DIRS = ();
SUBPROJECTS = ();
SUPPORTING_FILES = ("GNUmakefile.preamble", "GNUmakefile", "GNUmakefile.postamble");
TOOLICON = "";
}

View file

@ -1,39 +0,0 @@
/*
Project: $PROJECTNAME$
Copyright (C) $YEAR$ Free Software Foundation
Author: $FULLUSERNAME$
Created: $DATE$ by $USERNAME$
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.
*/
#include <Foundation/Foundation.h>
int
main(int argc, const char *argv[])
{
id pool = [[NSAutoreleasePool alloc] init];
// Your code here...
// The end...
[pool release];
return 0;
}