Added new Modules dir layout

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/apps/projectcenter/branches/UNSTABLE_0_5@22217 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
Sergii Stoian 2005-12-27 11:48:54 +00:00
parent 4b8e0f9057
commit 5fc14a9a5c
43 changed files with 3545 additions and 10 deletions

View file

@ -1,6 +1,21 @@
#
# GNUmakefile
#
# Here are the several types of modules (bundles):
#
# Project types:
# - Aggregate
# - Application
# - Bundle
# - Framework
# - Library
# - ResourceSet
# - Tool
# Editors:
# - ProjectCenter -- default PC editor
# Parsers:
# - ObjectiveC -- that's it!
#
include $(GNUSTEP_MAKEFILES)/common.make
GNUSTEP_INSTALLATION_DIR = $(GNUSTEP_SYSTEM_ROOT)
@ -10,14 +25,15 @@ GNUSTEP_INSTALLATION_DIR = $(GNUSTEP_SYSTEM_ROOT)
# Subprojects
#
SUBPROJECTS = \
AggregateProject \
ApplicationProject \
BundleProject \
FrameworkProject \
LibraryProject \
ResourceSetProject \
ToolProject
# ObjCParser
Projects/Aggregate \
Projects/Application \
Projects/Bundle \
Projects/Framework \
Projects/Library \
Projects/ResourceSet \
Projects/Tool \
Editors/ProjectCenter \
Parsers/ProjectCenter
include $(GNUSTEP_MAKEFILES)/aggregate.make

View file

@ -4,8 +4,21 @@
ADDITIONAL_OBJCFLAGS +=
ADDITIONAL_CFLAGS +=
ADDITIONAL_CPPFLAGS +=
ADDITIONAL_INCLUDE_DIRS += -I../..
ADDITIONAL_LIB_DIRS += -L../../Library/$(GNUSTEP_OBJ_DIR)
ADDITIONAL_INCLUDE_DIRS += -I../../../ -I../../../Headers
ADDITIONAL_LIB_DIRS += -L../../../Library/ProjectCenter.framework/Versions/Current
# BUNDLE_INSTALL_DIR = $(GNUSTEP_SYSTEM_ROOT)/Applications/ProjectCenter.app/Resources
$(BUNDLE_NAME)_STANDARD_INSTALL = no
DO_LIB_LINK=no
ifeq ($(GNUSTEP_TARGET_OS), mingw32)
DO_LIB_LINK=yes
endif
ifeq ($(GNUSTEP_TARGET_OS), cygwin)
DO_LIB_LINK=yes
endif
ifeq ($(DO_LIB_LINK), yes)
$(GNUSTEP_INSTANCE)_LIB_DIRS += -L../../../Library/ProjectCenter.framework
$(GNUSTEP_INSTANCE)_BUNDLE_LIBS += -lProjectCenter
endif

View file

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

View file

@ -0,0 +1,67 @@
/*
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>
#include <Protocols/ProjectType.h>
@class PCMakefileFactory;
@interface PCAggregateProject : PCProject <ProjectType>
{
IBOutlet NSBox *projectAttributesView;
NSMutableDictionary *infoDict;
}
//----------------------------------------------------------------------------
// Init and free
//----------------------------------------------------------------------------
- (id)init;
- (void)dealloc;
- (PCProject *)createProjectAt:(NSString *)path;
@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

@ -0,0 +1,218 @@
/*
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/PCDefines.h>
#include <ProjectCenter/PCFileManager.h>
#include <ProjectCenter/PCMakefileFactory.h>
#include "PCAggregateProject.h"
@implementation PCAggregateProject
//----------------------------------------------------------------------------
// Init and free
//----------------------------------------------------------------------------
- (id)init
{
if ((self = [super init]))
{
/* NSString *_file;
Class class = [self builderClass];
_file = [[NSBundle bundleForClass:class] pathForResource:@"Info"
ofType:@"table"];
infoDict = [NSMutableDictionary dictionaryWithContentsOfFile:_file];
rootEntries = [infoDict objectForKey:@"BrowserRootEntries"];
rootKeys = [[rootEntries allKeys] retain];
rootCategories = [[rootEntries allValues] retain];*/
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];
}
//----------------------------------------------------------------------------
// --- PCProject overridings
//----------------------------------------------------------------------------
- (Class)builderClass
{
return [PCAggregateProject class];
}
// ----------------------------------------------------------------------------
// --- ProjectType protocol
// ----------------------------------------------------------------------------
- (PCProject *)createProjectAt:(NSString *)path
{
PCFileManager *pcfm = [PCFileManager defaultManager];
NSString *_file;
NSBundle *projectBundle;
NSAssert(path,@"No valid project path provided!");
projectBundle = [NSBundle bundleForClass:[self class]];
[pcfm createDirectoriesIfNeededAtPath:path];
_file = [projectBundle pathForResource:@"PC" ofType:@"project"];
[projectDict initWithContentsOfFile:_file];
// Customise the project
[self setProjectPath:path];
[self setProjectName:[path lastPathComponent]];
if ([[projectName pathExtension] isEqualToString:@"subproj"])
{
projectName = [projectName stringByDeletingPathExtension];
}
[projectDict setObject:projectName forKey:PCProjectName];
[projectDict setObject:[[NSCalendarDate date] description]
forKey:PCCreationDate];
[projectDict setObject:NSFullUserName() forKey:PCProjectCreator];
[projectDict setObject:NSFullUserName() forKey:PCProjectMaintainer];
// GNUmakefile.postamble
[[PCMakefileFactory sharedFactory] createPostambleForProject:self];
// Save the project to disc
[self writeMakefile];
[self save];
return self;
}
@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:NO])
{
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

@ -0,0 +1,25 @@
{
Type = "Project";
Name = "Aggregate";
Description = "Project that contains subprojects.";
PrincipalClassName = "PCAggregateProject";
CanHavePublicHeaders = NO;
BrowserRootEntries = {
SUBPROJECTS = "Subprojects";
SUPPORTING_FILES = "Supporting Files";
NON_PROJECT_FILES = "Non Project Files";
};
SourceFileKeys = (
);
OtherFileKeys = (
"SUPPORTING_FILES",
"NON_PROJECT_FILES"
);
AllowableSubprojectTypes = (
"Application",
"Bundle",
"Library",
"Framework",
"Tool"
);
}

View file

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

View file

@ -0,0 +1,27 @@
{
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

@ -0,0 +1,52 @@
#
# GNUmakefile - ApplicationProject
#
include $(GNUSTEP_MAKEFILES)/common.make
#
# Bundle
#
BUNDLE_NAME = Application
BUNDLE_EXTENSION = .project
Application_PRINCIPAL_CLASS = PCAppProject
#
# Additional libraries
#
Application_LIBRARIES_DEPEND_UPON +=
#
# 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 \
Resources/Info.table \
Resources/Info.gnustep
#
# Header files
#
Application_HEADERS= \
PCAppProject.h \
PCAppProject+Inspector.h
#
# Class files
#
Application_OBJC_FILES= \
PCAppProject.m \
PCAppProject+Inspector.m
include ../../GNUmakefile.bundles
include $(GNUSTEP_MAKEFILES)/bundle.make

View file

@ -0,0 +1,72 @@
/*
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

@ -0,0 +1,706 @@
/*
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/PCMakefileFactory.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

@ -0,0 +1,117 @@
/*
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 _PCAppProject_h_
#define _PCAppProject_h_
#include <AppKit/AppKit.h>
#include <ProjectCenter/PCDefines.h>
#include <ProjectCenter/PCProject.h>
#include <ProjectCenter/PCProjectInspector.h>
#include <Protocols/ProjectType.h>
@interface PCAppTextField : NSTextField
{
}
@end
@interface PCAppProject : PCProject <ProjectType>
{
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)loadInfoFile;
- (void)dealloc;
- (PCProject *)createProjectAt:(NSString *)path;
@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

@ -0,0 +1,561 @@
/*
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 <ProjectCenter/PCProjectBrowser.h>
#include <ProjectCenter/PCFileManager.h>
#include <ProjectCenter/PCFileCreator.h>
#include "PCAppProject.h"
#include "PCAppProject+Inspector.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)loadInfoFile
{
PCFileManager *pcfm = [PCFileManager defaultManager];
NSMutableArray *otherRes = nil;
NSString *oldFile = [NSString stringWithString:@"Info-gnustep.plist"];
NSString *oldFilePath = nil;
NSString *infoFile = nil;
NSString *infoFilePath = nil;
infoFile = [NSString stringWithFormat:@"%@Info.plist",projectName];
infoFilePath = [projectPath stringByAppendingPathComponent:infoFile];
// Old project with info file Info-gnustep.plist located in Resources
// directory. Move it to parent directory and replace it in PCOtherResources.
otherRes = [[projectDict objectForKey:PCOtherResources] mutableCopy];
if ([otherRes containsObject:oldFile])
{
oldFilePath = [self dirForCategoryKey:PCOtherResources];
oldFilePath = [oldFilePath stringByAppendingPathComponent:oldFile];
[pcfm copyFile:oldFilePath toFile:infoFilePath];
[pcfm removeFileAtPath:oldFilePath];
[otherRes removeObject:oldFile];
[otherRes addObject:infoFile];
[self setProjectDictObject:otherRes forKey:PCSupportingFiles notify:NO];
RELEASE(otherRes);
}
if ([[NSFileManager defaultManager] fileExistsAtPath:infoFilePath])
{
infoDict =
[[NSMutableDictionary alloc] initWithContentsOfFile:infoFilePath];
}
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];
}
// ----------------------------------------------------------------------------
// --- ProjectType protocol
// ----------------------------------------------------------------------------
- (PCProject *)createProjectAt:(NSString *)path
{
PCFileManager *pcfm = [PCFileManager defaultManager];
PCFileCreator *pcfc = [PCFileCreator sharedCreator];
NSString *_file = nil;
NSString *_2file = nil;
NSString *_resourcePath = nil;
NSBundle *projBundle = [NSBundle bundleForClass:[self class]];
NSString *mainNibFile = nil;
NSMutableArray *_array = nil;
NSAssert(path,@"No valid project path provided!");
// PC.project
_file = [projBundle pathForResource:@"PC" ofType:@"project"];
[projectDict initWithContentsOfFile:_file];
// Customise the project
[self setProjectPath:path];
[self setProjectName:[path lastPathComponent]];
if ([[projectName pathExtension] isEqualToString:@"subproj"])
{
projectName = [projectName stringByDeletingPathExtension];
}
[projectDict setObject:projectName forKey:PCProjectName];
[projectDict setObject:[[NSCalendarDate date] description]
forKey:PCCreationDate];
[projectDict setObject:NSFullUserName() forKey:PCProjectCreator];
[projectDict setObject:NSFullUserName() forKey:PCProjectMaintainer];
// 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:self];
[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:self];
_file = [projBundle pathForResource:@"AppController" ofType:@"h"];
_2file = [path stringByAppendingPathComponent:@"AppController.h"];
[pcfm copyFile:_file toFile:_2file];
[pcfc replaceTagsInFileAtPath:_2file withProject:self];
// GNUmakefile.postamble
[[PCMakefileFactory sharedFactory] createPostambleForProject:self];
// Resources
// By default resources located at Resources subdir.
// If any resource marked as "Localizable" in Inspector it's moved
// into English.lproj and copied into all available .lproj subdirs.
_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];
// Info-gnutstep.plist
_file = [projBundle pathForResource:@"Info" ofType:@"gnustep"];
infoDict = [[NSMutableDictionary alloc] initWithContentsOfFile:_file];
[infoDict setObject:projectName forKey:@"ApplicationName"];
[infoDict setObject:projectName forKey:@"NSExecutable"];
[infoDict setObject:[mainNibFile lastPathComponent]
forKey:@"NSMainNibFile"];
[infoDict setObject:[projectDict objectForKey:PCPrincipalClass]
forKey:@"NSPrincipalClass"];
// Write to ProjectNameInfo.plist
_file = [NSString stringWithFormat:@"%@Info.plist",projectName];
_2file = [projectPath stringByAppendingPathComponent:_file];
[infoDict writeToFile:_2file atomically:YES];
// Add Info-gnustep.plist into SUPPORTING_FILES
_array = [[projectDict objectForKey:PCSupportingFiles] mutableCopy];
[_array addObject:_file];
[projectDict setObject:_array forKey:PCSupportingFiles];
RELEASE(_array);
// Save the project to disc
[self writeMakefile];
[self save];
return self;
}
// ----------------------------------------------------------------------------
// --- PCProject overridings
// ----------------------------------------------------------------------------
- (PCProject *)openWithDictionaryAt:(NSString *)path
{
NSDictionary *dict = [NSDictionary dictionaryWithContentsOfFile:path];
[self assignProjectDict:dict atPath:path];
[self loadInfoFile];
return self;
}
- (Class)builderClass
{
return [PCAppProject class];
}
// ----------------------------------------------------------------------------
// --- 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 = [NSString stringWithFormat:@"%@Info.plist",projectName];
infoFile = [projectPath stringByAppendingPathComponent:infoFile];
return [infoDict writeToFile:infoFile atomically:YES];
}
// Overriding
- (BOOL)writeMakefile
{
PCMakefileFactory *mf = [PCMakefileFactory sharedFactory];
int i,count;
NSString *mfl = nil;
NSData *mfd = nil;
NSString *key = nil;
NSMutableArray *resources = nil;
NSArray *localizedResources = 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
count = [[self resourceFileKeys] count];
resources = [[NSMutableArray alloc] initWithCapacity:1];
// Gather all resource files into one array
for (i = 0; i < count; i++)
{
key = [[self resourceFileKeys] objectAtIndex:i];
[resources addObjectsFromArray:[projectDict objectForKey:key]];
}
// Remove localized resource files from gathered array
count = [resources count];
localizedResources = [projectDict objectForKey:PCLocalizedResources];
for (i = 0; i < count; i++)
{
if ([localizedResources containsObject:[resources objectAtIndex:i]])
{
[resources removeObjectAtIndex:i];
count--;
}
}
[mf appendResources:resources inDir:@"Resources"];
[resources release];
// Localization
[mf appendLocalizedResources:localizedResources
forLanguages:[projectDict objectForKey:PCUserLanguages]];
// Sources
[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

@ -0,0 +1,54 @@
/*
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

@ -0,0 +1,88 @@
/*
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

@ -0,0 +1,13 @@
{
"!" = "Generated by ProjectCenter, do not edit";
ApplicationDescription = "No description avaliable!";
ApplicationName = "";
ApplicationRelease = 0.1;
Copyright = "Copyright (C) 200x";
CopyrightDescription = "Released under ...";
FullVersionID = 0.1;
NSExecutable = "";
NSMainNibFile = "";
NSPrincipalClass = NSApplication;
NSRole = Application;
}

View file

@ -0,0 +1,52 @@
{
Type = "Project";
Name = "Application";
Description = "Project that handles GNUstep ObjC based applications.";
PrincipalClassName = "PCAppProject";
Executable = YES;
ExecToolName = "openapp";
BuildTargets = ("app","debug","profile","dist");
CanHavePublicHeaders = NO;
BrowserRootEntries = {
CLASS_FILES = "Classes";
HEADER_FILES = "Headers";
OTHER_SOURCES = "Other Sources";
INTERFACES = "Interfaces";
IMAGES = "Images";
OTHER_RESOURCES = "Other Resources";
SUBPROJECTS = "Subprojects";
DOCU_FILES = "Documentation";
SUPPORTING_FILES = "Supporting Files";
LIBRARIES = "Libraries";
NON_PROJECT_FILES = "Non Project Files";
};
SourceFileKeys = (
"CLASS_FILES",
"HEADER_FILES",
"OTHER_SOURCES"
);
ResourceFileKeys = (
"INTERFACES",
"IMAGES",
"DOCU_FILES",
"OTHER_RESOURCES"
);
OtherFileKeys = (
"LIBRARIES",
"NON_PROJECT_FILES"
);
AllowableSubprojectTypes = (
"Aggregate",
"Application",
"Bundle",
"Library",
"Framework",
"Tool"
);
LocalizableCategories = (
INTERFACES,
IMAGES,
OTHER_RESOURCES,
DOCU_FILES
);
}

View file

@ -0,0 +1,74 @@
{
"## 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

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

View file

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

View file

@ -0,0 +1,32 @@
<?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

@ -0,0 +1,63 @@
<?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

@ -0,0 +1,44 @@
{
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

@ -0,0 +1,46 @@
/*
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

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

View file

@ -0,0 +1,74 @@
/*
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>
#include <Protocols/ProjectType.h>
@class PCMakefileFactory;
@interface PCBundleProject : PCProject <ProjectType>
{
IBOutlet NSBox *projectAttributesView;
IBOutlet NSTextField *principalClassField;
IBOutlet NSTextField *bundleExtensionField;
}
//----------------------------------------------------------------------------
// Init and free
//----------------------------------------------------------------------------
- (id)init;
- (void)dealloc;
- (PCProject *)createProjectAt:(NSString *)path;
@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

@ -0,0 +1,329 @@
/*
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/PCDefines.h>
#include <ProjectCenter/PCProject.h>
#include <ProjectCenter/PCFileCreator.h>
#include <ProjectCenter/PCMakefileFactory.h>
#include "PCBundleProject.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 [PCBundleProject class];
}
// ----------------------------------------------------------------------------
// --- ProjectType protocol
// ----------------------------------------------------------------------------
- (PCProject *)createProjectAt:(NSString *)path
{
NSBundle *projectBundle = nil;
NSString *_file = nil;
NSString *_2file = nil;
NSString *_resourcePath = nil;
PCFileCreator *pcfc = [PCFileCreator sharedCreator];
NSAssert(path,@"No valid project path provided!");
projectBundle = [NSBundle bundleForClass:[self class]];
_file = [projectBundle pathForResource:@"PC" ofType:@"project"];
[projectDict initWithContentsOfFile:_file];
// Customise the project
[self setProjectPath:path];
[self setProjectName:[path lastPathComponent]];
if ([[projectName pathExtension] isEqualToString:@"subproj"])
{
projectName = [projectName stringByDeletingPathExtension];
}
[projectDict setObject:projectName forKey:PCProjectName];
[projectDict setObject:projectName forKey:PCPrincipalClass];
[projectDict setObject:[[NSCalendarDate date] description]
forKey:PCCreationDate];
[projectDict setObject:NSFullUserName() forKey:PCProjectCreator];
[projectDict setObject:NSFullUserName() forKey:PCProjectMaintainer];
// 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:self];
[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:self];
// Resources
_resourcePath = [path stringByAppendingPathComponent:@"Resources"];
// Save the project to disc
[self writeMakefile];
[self save];
return self;
}
@end
@implementation PCBundleProject (GeneratedFiles)
- (BOOL)writeMakefile
{
PCMakefileFactory *mf = [PCMakefileFactory sharedFactory];
int i,count;
NSString *mfl = nil;
NSData *mfd = nil;
NSString *key = nil;
NSMutableArray *resources = nil;
NSArray *localizedResources = 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
count = [[self resourceFileKeys] count];
resources = [[NSMutableArray alloc] initWithCapacity:1];
// Gather all resource files into one array
for (i = 0; i < count; i++)
{
key = [[self resourceFileKeys] objectAtIndex:i];
[resources addObjectsFromArray:[projectDict objectForKey:key]];
}
// Remove localized resource files from gathered array
count = [resources count];
localizedResources = [projectDict objectForKey:PCLocalizedResources];
for (i = 0; i < count; i++)
{
if ([localizedResources containsObject:[resources objectAtIndex:i]])
{
[resources removeObjectAtIndex:i];
count--;
}
}
[mf appendResources:resources inDir:@"Resources"];
[resources release];
// Localization
[mf appendLocalizedResources:localizedResources
forLanguages:[projectDict objectForKey:PCUserLanguages]];
// Sources
[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

@ -0,0 +1,52 @@
{
Type = "Project";
Name = "Bundle";
Description = "Project that handles GNUstep bundles.";
PrincipalClassName = "PCBundleProject";
ExecToolName = "";
BuildTargets = ("bundle","debug","profile","dist");
CanHavePublicHeaders = NO;
BrowserRootEntries = {
CLASS_FILES = "Classes";
HEADER_FILES = "Headers";
OTHER_SOURCES = "Other Sources";
INTERFACES = "Interfaces";
IMAGES = "Images";
OTHER_RESOURCES = "Other Resources";
SUBPROJECTS = "Subprojects";
DOCU_FILES = "Documentation";
SUPPORTING_FILES = "Supporting Files";
LIBRARIES = "Libraries";
NON_PROJECT_FILES = "Non Project Files";
};
SourceFileKeys = (
"CLASS_FILES",
"HEADER_FILES",
"OTHER_SOURCES"
);
ResourceFileKeys = (
"INTERFACES",
"IMAGES",
"OTHER_RESOURCES",
"DOCU_FILES"
);
OtherFileKeys = (
"SUBPROJECTS",
"SUPPORTING_FILES",
"LIBRARIES",
"NON_PROJECT_FILES"
);
AllowableSubprojectTypes = (
"Aggregate",
"Bundle",
"Library",
"Framework",
"Tool"
);
LocalizableCategories = (
INTERFACES,
IMAGES,
OTHER_RESOURCES,
DOCU_FILES
);
}

View file

@ -0,0 +1,23 @@
{
"## 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

@ -0,0 +1,40 @@
{
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

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

View file

@ -0,0 +1,74 @@
/*
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>
#include <Protocols/ProjectType.h>
@class PCMakefileFactory;
@interface PCFrameworkProject : PCProject <ProjectType>
{
IBOutlet NSBox *projectAttributesView;
IBOutlet NSTextField *principalClassField;
IBOutlet NSTextField *currentVersionNameField;
}
//----------------------------------------------------------------------------
// Init and free
//----------------------------------------------------------------------------
- (id)init;
- (void)dealloc;
- (PCProject *)createProjectAt:(NSString *)path;
@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

@ -0,0 +1,356 @@
/*
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/PCDefines.h>
#include <ProjectCenter/PCMakefileFactory.h>
#include <ProjectCenter/PCProjectBrowser.h>
#include <ProjectCenter/PCFileManager.h>
#include <ProjectCenter/PCFileCreator.h>
#include "PCFrameworkProject.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];
}
//----------------------------------------------------------------------------
// --- PCProject overridings
//----------------------------------------------------------------------------
- (Class)builderClass
{
return [PCFrameworkProject class];
}
// ----------------------------------------------------------------------------
// --- ProjectType protocol
// ----------------------------------------------------------------------------
- (PCProject *)createProjectAt:(NSString *)path
{
PCFileManager *pcfm = [PCFileManager defaultManager];
PCFileCreator *pcfc = [PCFileCreator sharedCreator];
NSBundle *projectBundle = nil;
NSString *_file = nil;
NSString *_2file = nil;
NSString *_resourcePath;
NSAssert(path,@"No valid project path provided!");
projectBundle = [NSBundle bundleForClass:[self class]];
_file = [projectBundle pathForResource:@"PC" ofType:@"project"];
[projectDict initWithContentsOfFile:_file];
// Customise the project
[self setProjectPath:path];
[self setProjectName:[path lastPathComponent]];
if ([[projectName pathExtension] isEqualToString:@"subproj"])
{
projectName = [projectName stringByDeletingPathExtension];
}
[projectDict setObject:projectName forKey:PCProjectName];
// 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:self];
[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:self];
// Resources
// _resourcePath = [path stringByAppendingPathComponent:@"Resources"];
// Save the project to disc
[self writeMakefile];
[self save];
return self;
}
// ----------------------------------------------------------------------------
// --- 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,count;
NSString *mfl = nil;
NSData *mfd = nil;
NSString *key = nil;
NSMutableArray *resources = nil;
NSArray *localizedResources = 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
count = [[self resourceFileKeys] count];
resources = [[NSMutableArray alloc] initWithCapacity:1];
// Gather all resource files into one array
for (i = 0; i < count; i++)
{
key = [[self resourceFileKeys] objectAtIndex:i];
[resources addObjectsFromArray:[projectDict objectForKey:key]];
}
// Remove localized resource files from gathered array
count = [resources count];
localizedResources = [projectDict objectForKey:PCLocalizedResources];
for (i = 0; i < count; i++)
{
if ([localizedResources containsObject:[resources objectAtIndex:i]])
{
[resources removeObjectAtIndex:i];
count--;
}
}
[mf appendResources:resources inDir:@"Resources"];
[resources release];
// Localization
[mf appendLocalizedResources:localizedResources
forLanguages:[projectDict objectForKey:PCUserLanguages]];
// Sources
[self appendPublicHeaders:mf];
[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
{
[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

@ -0,0 +1,43 @@
{
Type = "Project";
Name = "Framework";
Description = "Project that handles GNUstep frameworks.";
PrincipalClassName = "PCFrameworkProject";
ExecToolName = "";
BuildTargets = ("framework","debug","profile","dist");
CanHavePublicHeaders = YES;
BrowserRootEntries = {
CLASS_FILES = "Classes";
HEADER_FILES = "Headers";
OTHER_SOURCES = "Other Sources";
OTHER_RESOURCES = "Other Resources";
SUBPROJECTS = "Subprojects";
DOCU_FILES = "Documentation";
SUPPORTING_FILES = "Supporting Files";
LIBRARIES = "Libraries";
NON_PROJECT_FILES = "Non Project Files";
};
SourceFileKeys = (
"CLASS_FILES",
"HEADER_FILES",
"OTHER_SOURCES"
);
ResourceFileKeys = (
"OTHER_RESOURCES",
"DOCU_FILES"
);
OtherFileKeys = (
"SUBPROJECTS",
"SUPPORTING_FILES",
"LIBRARIES",
"NON_PROJECT_FILES"
);
AllowableSubprojectTypes = (
"Bundle",
"Tool"
);
LocalizableCategories = (
OTHER_RESOURCES,
DOCU_FILES
);
}

View file

@ -0,0 +1,38 @@
{
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");
}