mirror of
https://github.com/gnustep/apps-projectcenter.git
synced 2025-02-23 11:51:08 +00:00
*** empty log message ***
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/apps/projectcenter/branches/UNSTABLE_0_4@18031 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
b938271acd
commit
9cdb6f7acb
14 changed files with 1607 additions and 0 deletions
73
Modules/ApplicationProject/GNUmakefile
Normal file
73
Modules/ApplicationProject/GNUmakefile
Normal file
|
@ -0,0 +1,73 @@
|
||||||
|
#
|
||||||
|
# GNUmakefile - Generated by ProjectCenter
|
||||||
|
# Written by Philippe C.D. Robert <phr@3dkit.org>
|
||||||
|
#
|
||||||
|
# NOTE: Do NOT change this file -- ProjectCenter maintains it!
|
||||||
|
#
|
||||||
|
# Put all of your customisations in GNUmakefile.preamble and
|
||||||
|
# GNUmakefile.postamble
|
||||||
|
#
|
||||||
|
|
||||||
|
include $(GNUSTEP_MAKEFILES)/common.make
|
||||||
|
|
||||||
|
#
|
||||||
|
# Subprojects
|
||||||
|
#
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#
|
||||||
|
# Bundle
|
||||||
|
#
|
||||||
|
|
||||||
|
PACKAGE_NAME = ApplicationProject
|
||||||
|
BUNDLE_NAME = ApplicationProject
|
||||||
|
ApplicationProject_PRINCIPAL_CLASS = PCAppProj
|
||||||
|
|
||||||
|
|
||||||
|
#
|
||||||
|
# Additional libraries
|
||||||
|
#
|
||||||
|
|
||||||
|
ApplicationProject_LIBRARIES_DEPEND_UPON += -lProjectCenter
|
||||||
|
|
||||||
|
#
|
||||||
|
# Resource files
|
||||||
|
#
|
||||||
|
|
||||||
|
ApplicationProject_RESOURCE_FILES= \
|
||||||
|
Templates/AppController.h \
|
||||||
|
Templates/AppController.m \
|
||||||
|
Templates/main.m \
|
||||||
|
Templates/PC.project \
|
||||||
|
Templates/GNUmakefile.preamble \
|
||||||
|
Templates/GNUmakefile.postamble \
|
||||||
|
Templates/objects.gorm \
|
||||||
|
Templates/data.classes
|
||||||
|
|
||||||
|
#
|
||||||
|
# Header files
|
||||||
|
#
|
||||||
|
|
||||||
|
ApplicationProject_HEADERS= \
|
||||||
|
PCAppProj.h \
|
||||||
|
PCAppProject.h
|
||||||
|
|
||||||
|
#
|
||||||
|
# Class files
|
||||||
|
#
|
||||||
|
|
||||||
|
ApplicationProject_OBJC_FILES= \
|
||||||
|
PCAppProj.m \
|
||||||
|
PCAppProject.m
|
||||||
|
|
||||||
|
#
|
||||||
|
# C files
|
||||||
|
#
|
||||||
|
|
||||||
|
ApplicationProject_C_FILES=
|
||||||
|
|
||||||
|
include ../GNUmakefile.bundles
|
||||||
|
|
||||||
|
include $(GNUSTEP_MAKEFILES)/bundle.make
|
||||||
|
|
29
Modules/ApplicationProject/Info.table
Normal file
29
Modules/ApplicationProject/Info.table
Normal file
|
@ -0,0 +1,29 @@
|
||||||
|
{
|
||||||
|
AdditionalAttributes = {
|
||||||
|
PrincipalClass = {ATTR_CLASS_NAME = "NSString";};
|
||||||
|
};
|
||||||
|
Allowable_SubprojectTypes = (Subproject, Bundle, Tool, Framework, Library, Palette);
|
||||||
|
AttributesInspector = ApplicationInspector;
|
||||||
|
DefaultExtension = "";
|
||||||
|
Default_Localizable_Keys = (INTERFACES);
|
||||||
|
GeneratedFiles = (Makefile, iconHeader);
|
||||||
|
INSTALLFLAGS = "-c -s -m 755";
|
||||||
|
InfoName = "";
|
||||||
|
Localizable_Keys = (INTERFACES, IMAGES, OTHER_RESOURCES, HELP_RESOURCES);
|
||||||
|
MAKEFILE = app.make;
|
||||||
|
MAKEFILEDIR = "$(MAKEFILEPATH)/pb_makefiles";
|
||||||
|
Other_Keys = (HELP_RESOURCES, OTHER_SOURCES, FRAMEWORKS, OTHER_LIBS);
|
||||||
|
PBProjectTypeSubClass = "PBApplicationProjectType";
|
||||||
|
ProvidesIcons = Yes;
|
||||||
|
Public_Keys = (H_FILES);
|
||||||
|
Resource_Keys = (INTERFACES, IMAGES, OTHER_RESOURCES);
|
||||||
|
SOURCEMODE = 444;
|
||||||
|
Source_Keys = (CLASSES, H_FILES, OTHER_LINKED);
|
||||||
|
Subproj_Keys = (SUBPROJECTS);
|
||||||
|
Targets = (app, debug, profile, install);
|
||||||
|
ExecutableResults = (
|
||||||
|
"$PROJECTNAME$.app/$PROJECTNAME$$EXECUTABLE_EXT$",
|
||||||
|
"$PROJECTNAME$.debug/$PROJECTNAME$$EXECUTABLE_EXT$",
|
||||||
|
"$PROJECTNAME$.profile/$PROJECTNAME$$EXECUTABLE_EXT$"
|
||||||
|
);
|
||||||
|
}
|
53
Modules/ApplicationProject/PCAppProj.h
Normal file
53
Modules/ApplicationProject/PCAppProj.h
Normal file
|
@ -0,0 +1,53 @@
|
||||||
|
/*
|
||||||
|
GNUstep ProjectCenter - http://www.gnustep.org
|
||||||
|
|
||||||
|
Copyright (C) 2001 Free Software Foundation
|
||||||
|
|
||||||
|
Author: Philippe C.D. Robert <phr@3dkit.org>
|
||||||
|
|
||||||
|
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.
|
||||||
|
|
||||||
|
$Id$
|
||||||
|
*/
|
||||||
|
|
||||||
|
#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;
|
||||||
|
- (NSDictionary *)typeTable;
|
||||||
|
|
||||||
|
- (PCProject *)createProjectAt:(NSString *)path;
|
||||||
|
- (PCProject *)openProjectAt:(NSString *)path;
|
||||||
|
|
||||||
|
@end
|
||||||
|
|
||||||
|
#endif
|
222
Modules/ApplicationProject/PCAppProj.m
Normal file
222
Modules/ApplicationProject/PCAppProj.m
Normal file
|
@ -0,0 +1,222 @@
|
||||||
|
/*
|
||||||
|
GNUstep ProjectCenter - http://www.gnustep.org
|
||||||
|
|
||||||
|
Copyright (C) 2001 Free Software Foundation
|
||||||
|
|
||||||
|
Author: Philippe C.D. Robert <phr@3dkit.org>
|
||||||
|
|
||||||
|
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.
|
||||||
|
|
||||||
|
$Id$
|
||||||
|
*/
|
||||||
|
|
||||||
|
/*
|
||||||
|
Description:
|
||||||
|
|
||||||
|
PCAppProj creates new project of the type Application!
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "PCAppProj.h"
|
||||||
|
#include "PCAppProject.h"
|
||||||
|
|
||||||
|
@implementation PCAppProj
|
||||||
|
|
||||||
|
//static NSString *_projTypeName = @"Application";
|
||||||
|
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";
|
||||||
|
}
|
||||||
|
|
||||||
|
- (NSDictionary *)typeTable
|
||||||
|
{
|
||||||
|
NSString *_path;
|
||||||
|
|
||||||
|
_path = [[NSBundle bundleForClass:[self class]] pathForResource:@"Info"
|
||||||
|
ofType:@"table"];
|
||||||
|
|
||||||
|
return [NSDictionary dictionaryWithContentsOfFile:_path];
|
||||||
|
}
|
||||||
|
|
||||||
|
- (PCProject *)createProjectAt:(NSString *)path
|
||||||
|
{
|
||||||
|
PCAppProject *project = nil;
|
||||||
|
NSFileManager *fm = [NSFileManager defaultManager];
|
||||||
|
|
||||||
|
NSAssert(path,@"No valid project path provided!");
|
||||||
|
|
||||||
|
if ([fm createDirectoryAtPath: path attributes: nil])
|
||||||
|
{
|
||||||
|
NSString *_file = nil;
|
||||||
|
// NSString *_resourcePath = nil;
|
||||||
|
NSMutableDictionary *projectDict = nil;
|
||||||
|
NSDictionary *infoDict = nil;
|
||||||
|
NSBundle *projBundle = [NSBundle bundleForClass:[self class]];
|
||||||
|
NSString *mainNibFile = nil;
|
||||||
|
|
||||||
|
project = [[[PCAppProject alloc] init] autorelease];
|
||||||
|
|
||||||
|
_file = [projBundle pathForResource:@"PC" ofType:@"project"];
|
||||||
|
projectDict = [NSMutableDictionary dictionaryWithContentsOfFile:_file];
|
||||||
|
|
||||||
|
// Customise the project
|
||||||
|
[projectDict setObject:[path lastPathComponent] forKey:PCProjectName];
|
||||||
|
[projectDict setObject:[[project principalClass] description]
|
||||||
|
forKey:PCProjType];
|
||||||
|
|
||||||
|
// Copy the project files to the provided path
|
||||||
|
_file = [projBundle pathForResource:@"GNUmakefile" ofType:@"postamble"];
|
||||||
|
[fm copyPath:_file
|
||||||
|
toPath:[path stringByAppendingPathComponent:@"GNUmakefile.postamble"]
|
||||||
|
handler:nil];
|
||||||
|
|
||||||
|
_file = [projBundle pathForResource:@"GNUmakefile" ofType:@"preamble"];
|
||||||
|
[fm copyPath:_file
|
||||||
|
toPath:[path stringByAppendingPathComponent:@"GNUmakefile.preamble"]
|
||||||
|
handler:nil];
|
||||||
|
|
||||||
|
_file = [projBundle pathForResource:@"main" ofType:@"m"];
|
||||||
|
[fm copyPath:_file
|
||||||
|
toPath:[path stringByAppendingPathComponent:@"main.m"]
|
||||||
|
handler:nil];
|
||||||
|
|
||||||
|
_file = [projBundle pathForResource:@"AppController" ofType:@"m"];
|
||||||
|
[fm copyPath:_file
|
||||||
|
toPath:[path stringByAppendingPathComponent:@"AppController.m"]
|
||||||
|
handler:nil];
|
||||||
|
|
||||||
|
_file = [projBundle pathForResource:@"AppController" ofType:@"h"];
|
||||||
|
[fm copyPath:_file
|
||||||
|
toPath:[path stringByAppendingPathComponent:@"AppController.h"]
|
||||||
|
handler:nil];
|
||||||
|
|
||||||
|
// Resources
|
||||||
|
/* _resourcePath = [path stringByAppendingPathComponent:@"English.lproj"];
|
||||||
|
[fm createDirectoryAtPath:_resourcePath
|
||||||
|
attributes:nil];*/
|
||||||
|
[fm createDirectoryAtPath:[path stringByAppendingPathComponent:@"Images"]
|
||||||
|
attributes:nil];
|
||||||
|
[fm createDirectoryAtPath:[path stringByAppendingPathComponent:@"Documentation"]
|
||||||
|
attributes:nil];
|
||||||
|
|
||||||
|
// Gorm files
|
||||||
|
mainNibFile = [path stringByAppendingPathComponent:
|
||||||
|
[NSString stringWithFormat:@"%@.gorm", [path lastPathComponent]]];
|
||||||
|
[fm createDirectoryAtPath:mainNibFile attributes:nil];
|
||||||
|
|
||||||
|
_file = [projBundle pathForResource:@"objects" ofType:@"gorm"];
|
||||||
|
[fm copyPath:_file
|
||||||
|
toPath:[mainNibFile stringByAppendingPathComponent:@"objects.gorm"]
|
||||||
|
handler:nil];
|
||||||
|
_file = [projBundle pathForResource:@"data" ofType:@"classes"];
|
||||||
|
[fm copyPath:_file
|
||||||
|
toPath:[mainNibFile stringByAppendingPathComponent:@"data.classes"]
|
||||||
|
handler:nil];
|
||||||
|
[projectDict setObject:[mainNibFile lastPathComponent]
|
||||||
|
forKey:PCMainInterfaceFile];
|
||||||
|
|
||||||
|
[projectDict
|
||||||
|
setObject:[NSArray arrayWithObject:[mainNibFile lastPathComponent]]
|
||||||
|
forKey:PCInterfaces];
|
||||||
|
|
||||||
|
// Create the Info-gnutstep.plist
|
||||||
|
infoDict = [NSDictionary dictionaryWithObjectsAndKeys:
|
||||||
|
@"Generated by ProjectCenter, do not edit", @"!",
|
||||||
|
@"", @"ApplicationDescription",
|
||||||
|
@"", @"ApplicationIcon",
|
||||||
|
[path lastPathComponent], @"ApplicationName",
|
||||||
|
@"0.1", @"ApplicationRelease",
|
||||||
|
[NSArray array], @"Authors",
|
||||||
|
@"Copyright (C) 200x by ...", @"Copyright",
|
||||||
|
@"Released under...", @"CopyrightDescription",
|
||||||
|
@"0.1", @"FullVersionID",
|
||||||
|
[path lastPathComponent], @"NSExecutable",
|
||||||
|
@"", @"NSIcon",
|
||||||
|
[mainNibFile lastPathComponent], @"NSMainNibFile",
|
||||||
|
@"NSApplication", @"NSPrincipalClass",
|
||||||
|
@"Application", @"NSRole",
|
||||||
|
@"", @"URL",
|
||||||
|
nil];
|
||||||
|
|
||||||
|
[infoDict
|
||||||
|
writeToFile:[path stringByAppendingPathComponent:@"Info-gnustep.plist"]
|
||||||
|
atomically:YES];
|
||||||
|
|
||||||
|
// Add Info-gnustep.plist into OTHER_RESOURCES
|
||||||
|
[projectDict
|
||||||
|
setObject:[NSArray arrayWithObjects:@"Info-gnustep.plist",nil]
|
||||||
|
forKey:PCOtherResources];
|
||||||
|
|
||||||
|
// The path cannot be in the PC.project file!
|
||||||
|
[project setProjectPath:path];
|
||||||
|
|
||||||
|
// 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
|
||||||
|
[projectDict
|
||||||
|
writeToFile:[path stringByAppendingPathComponent:@"PC.project"]
|
||||||
|
atomically:YES];
|
||||||
|
|
||||||
|
}
|
||||||
|
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
|
111
Modules/ApplicationProject/PCAppProject.h
Normal file
111
Modules/ApplicationProject/PCAppProject.h
Normal file
|
@ -0,0 +1,111 @@
|
||||||
|
/*
|
||||||
|
GNUstep ProjectCenter - http://www.gnustep.org
|
||||||
|
|
||||||
|
Copyright (C) 2001 Free Software Foundation
|
||||||
|
|
||||||
|
Author: Philippe C.D. Robert <phr@3dkit.org>
|
||||||
|
|
||||||
|
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.
|
||||||
|
|
||||||
|
$Id$
|
||||||
|
*/
|
||||||
|
|
||||||
|
/*
|
||||||
|
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.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef _PCAppProj_PCAppProject_h_
|
||||||
|
#define _PCAppProj_PCAppProject_h_
|
||||||
|
|
||||||
|
#include <AppKit/AppKit.h>
|
||||||
|
#include <ProjectCenter/PCProject.h>
|
||||||
|
#include <ProjectCenter/PCProjectInspector.h>
|
||||||
|
|
||||||
|
@interface PCAppProject : PCProject
|
||||||
|
{
|
||||||
|
NSBox *buildAttributesView;
|
||||||
|
NSTextField *ccOptField;
|
||||||
|
NSTextField *ldOptField;
|
||||||
|
NSTextField *installPathField;
|
||||||
|
NSTextField *toolField;
|
||||||
|
NSTextField *headersField;
|
||||||
|
NSTextField *libsField;
|
||||||
|
|
||||||
|
NSBox *projectAttributesView;
|
||||||
|
NSTextField *projectTypeField;
|
||||||
|
NSTextField *projectNameField;
|
||||||
|
NSTextField *projectLanguageField;
|
||||||
|
NSTextField *appClassField;
|
||||||
|
NSTextField *appImageField;
|
||||||
|
NSButton *setAppIconButton;
|
||||||
|
NSButton *clearAppIconButton;
|
||||||
|
NSImageView *appIconView;
|
||||||
|
NSImage *icon;
|
||||||
|
|
||||||
|
NSBox *fileAttributesView;
|
||||||
|
NSImageView *fileIconView;
|
||||||
|
NSTextField *fileNameField;
|
||||||
|
|
||||||
|
NSMutableDictionary *infoDict;
|
||||||
|
}
|
||||||
|
|
||||||
|
// ----------------------------------------------------------------------------
|
||||||
|
// --- Init and free
|
||||||
|
// ----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
- (id)init;
|
||||||
|
- (void)assignInfoDict:(NSMutableDictionary *)dict;
|
||||||
|
- (void)loadInfoFileAtPath:(NSString *)path;
|
||||||
|
- (void)dealloc;
|
||||||
|
|
||||||
|
// ----------------------------------------------------------------------------
|
||||||
|
// --- User Interface
|
||||||
|
// ----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
- (void)createInspectors;
|
||||||
|
- (NSView *)buildAttributesView;
|
||||||
|
- (NSView *)projectAttributesView;
|
||||||
|
- (NSView *)fileAttributesView;
|
||||||
|
- (void)updateInspectorValues:(NSNotification *)aNotif;
|
||||||
|
- (void)clearAppIcon:(id)sender;
|
||||||
|
- (void)setAppIcon:(id)sender;
|
||||||
|
- (BOOL)setAppIconWithImageAtPath:(NSString *)path;
|
||||||
|
- (void)setAppClass:(id)sender;
|
||||||
|
|
||||||
|
// ----------------------------------------------------------------------------
|
||||||
|
// --- Project
|
||||||
|
// ----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
- (Class)builderClass;
|
||||||
|
|
||||||
|
- (BOOL)writeMakefile;
|
||||||
|
|
||||||
|
- (NSArray *)sourceFileKeys;
|
||||||
|
- (NSArray *)resourceFileKeys;
|
||||||
|
- (NSArray *)otherKeys;
|
||||||
|
- (NSArray *)buildTargets;
|
||||||
|
- (NSString *)projectDescription;
|
||||||
|
|
||||||
|
- (BOOL)isExecutable;
|
||||||
|
|
||||||
|
@end
|
||||||
|
|
||||||
|
#endif
|
830
Modules/ApplicationProject/PCAppProject.m
Normal file
830
Modules/ApplicationProject/PCAppProject.m
Normal file
|
@ -0,0 +1,830 @@
|
||||||
|
/*
|
||||||
|
GNUstep ProjectCenter - http://www.gnustep.org
|
||||||
|
|
||||||
|
Copyright (C) 2001 Free Software Foundation
|
||||||
|
|
||||||
|
Author: Philippe C.D. Robert <phr@3dkit.org>
|
||||||
|
|
||||||
|
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.
|
||||||
|
|
||||||
|
$Id$
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <ProjectCenter/ProjectCenter.h>
|
||||||
|
#include <ProjectCenter/PCProjectBrowser.h>
|
||||||
|
|
||||||
|
#include "PCAppProject.h"
|
||||||
|
#include "PCAppProj.h"
|
||||||
|
|
||||||
|
@implementation PCAppProject
|
||||||
|
|
||||||
|
// ----------------------------------------------------------------------------
|
||||||
|
// --- Init and free
|
||||||
|
// ----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
- (id)init
|
||||||
|
{
|
||||||
|
|
||||||
|
if ((self = [super init]))
|
||||||
|
{
|
||||||
|
rootObjects = [[NSArray arrayWithObjects: PCClasses,
|
||||||
|
PCHeaders,
|
||||||
|
PCOtherSources,
|
||||||
|
PCInterfaces,
|
||||||
|
PCImages,
|
||||||
|
PCOtherResources,
|
||||||
|
PCSubprojects,
|
||||||
|
PCDocuFiles,
|
||||||
|
PCSupportingFiles,
|
||||||
|
PCLibraries,
|
||||||
|
PCNonProject,
|
||||||
|
nil] retain];
|
||||||
|
|
||||||
|
rootKeys = [[NSArray arrayWithObjects: @"Classes",
|
||||||
|
@"Headers",
|
||||||
|
@"Other Sources",
|
||||||
|
@"Interfaces",
|
||||||
|
@"Images",
|
||||||
|
@"Other Resources",
|
||||||
|
@"Subprojects",
|
||||||
|
@"Documentation",
|
||||||
|
// @"Context Help",
|
||||||
|
@"Supporting Files",
|
||||||
|
// @"Frameworks",
|
||||||
|
@"Libraries",
|
||||||
|
@"Non Project Files",
|
||||||
|
nil] retain];
|
||||||
|
|
||||||
|
rootCategories = [[NSDictionary
|
||||||
|
dictionaryWithObjects:rootObjects 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"];
|
||||||
|
infoDict = [[NSMutableDictionary alloc] initWithContentsOfFile:infoFile];
|
||||||
|
}
|
||||||
|
|
||||||
|
- (void)dealloc
|
||||||
|
{
|
||||||
|
NSLog (@"PCAppProject: dealloc");
|
||||||
|
|
||||||
|
RELEASE(infoDict);
|
||||||
|
RELEASE(buildAttributesView);
|
||||||
|
RELEASE(projectAttributesView);
|
||||||
|
RELEASE(fileAttributesView);
|
||||||
|
|
||||||
|
RELEASE(rootCategories);
|
||||||
|
RELEASE(rootObjects);
|
||||||
|
RELEASE(rootKeys);
|
||||||
|
|
||||||
|
[super dealloc];
|
||||||
|
}
|
||||||
|
|
||||||
|
// ----------------------------------------------------------------------------
|
||||||
|
// --- User Interface
|
||||||
|
// ----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
- (void)createInspectors
|
||||||
|
{
|
||||||
|
NSTextField *textField = nil;
|
||||||
|
NSBox *_iconViewBox = nil;
|
||||||
|
NSBox *_appIconBox = nil;
|
||||||
|
NSBox *line = nil;
|
||||||
|
|
||||||
|
if (buildAttributesView && projectAttributesView && fileAttributesView)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* "Build Attributes" View
|
||||||
|
*/
|
||||||
|
buildAttributesView = [[NSBox alloc] init];
|
||||||
|
[buildAttributesView setFrame:NSMakeRect(0,0,295,364)];
|
||||||
|
[buildAttributesView setTitlePosition:NSNoTitle];
|
||||||
|
[buildAttributesView
|
||||||
|
setAutoresizingMask:(NSViewWidthSizable | NSViewHeightSizable)];
|
||||||
|
[buildAttributesView setContentViewMargins:NSMakeSize(0.0, 0.0)];
|
||||||
|
|
||||||
|
// Compiler Flags -- ADDITIONAL_OBJCFLAGS(?), ADDITIONAL_CFLAGS
|
||||||
|
textField =[[NSTextField alloc] initWithFrame:NSMakeRect(4,323,104,21)];
|
||||||
|
[textField setAlignment: NSRightTextAlignment];
|
||||||
|
[textField setBordered: NO];
|
||||||
|
[textField setEditable: NO];
|
||||||
|
[textField setBezeled: NO];
|
||||||
|
[textField setDrawsBackground: NO];
|
||||||
|
[textField setStringValue:@"Compiler Flags:"];
|
||||||
|
[buildAttributesView addSubview:textField];
|
||||||
|
RELEASE(textField);
|
||||||
|
|
||||||
|
ccOptField =[[NSTextField alloc] initWithFrame:NSMakeRect(111,323,165,21)];
|
||||||
|
[ccOptField setAlignment: NSLeftTextAlignment];
|
||||||
|
[ccOptField setBordered: YES];
|
||||||
|
[ccOptField setEditable: YES];
|
||||||
|
[ccOptField setBezeled: YES];
|
||||||
|
[ccOptField setDrawsBackground: YES];
|
||||||
|
[ccOptField setStringValue:@""];
|
||||||
|
[ccOptField setAction:@selector(changeCommonProjectEntry:)];
|
||||||
|
[ccOptField setTarget:self];
|
||||||
|
[buildAttributesView addSubview:ccOptField];
|
||||||
|
RELEASE(ccOptField);
|
||||||
|
|
||||||
|
// Linker Flags -- ADDITIONAL_LDFLAGS
|
||||||
|
textField =[[NSTextField alloc] initWithFrame:NSMakeRect(4,298,104,21)];
|
||||||
|
[textField setAlignment: NSRightTextAlignment];
|
||||||
|
[textField setBordered: NO];
|
||||||
|
[textField setEditable: NO];
|
||||||
|
[textField setBezeled: NO];
|
||||||
|
[textField setDrawsBackground: NO];
|
||||||
|
[textField setStringValue:@"Linker Flags:"];
|
||||||
|
[buildAttributesView addSubview:textField];
|
||||||
|
RELEASE(textField);
|
||||||
|
|
||||||
|
ldOptField =[[NSTextField alloc] initWithFrame:NSMakeRect(111,298,165,21)];
|
||||||
|
[ldOptField setAlignment: NSLeftTextAlignment];
|
||||||
|
[ldOptField setBordered: YES];
|
||||||
|
[ldOptField setEditable: YES];
|
||||||
|
[ldOptField setBezeled: YES];
|
||||||
|
[ldOptField setDrawsBackground: YES];
|
||||||
|
[ldOptField setStringValue:@""];
|
||||||
|
[ldOptField setAction:@selector(changeCommonProjectEntry:)];
|
||||||
|
[ldOptField setTarget:self];
|
||||||
|
[buildAttributesView addSubview:ldOptField];
|
||||||
|
RELEASE(ldOptField);
|
||||||
|
|
||||||
|
// Install In
|
||||||
|
textField =[[NSTextField alloc] initWithFrame:NSMakeRect(4,273,104,21)];
|
||||||
|
[textField setAlignment: NSRightTextAlignment];
|
||||||
|
[textField setBordered: NO];
|
||||||
|
[textField setEditable: NO];
|
||||||
|
[textField setBezeled: NO];
|
||||||
|
[textField setDrawsBackground: NO];
|
||||||
|
[textField setStringValue:@"Install In:"];
|
||||||
|
[buildAttributesView addSubview:textField];
|
||||||
|
RELEASE(textField);
|
||||||
|
|
||||||
|
installPathField =[[NSTextField alloc]
|
||||||
|
initWithFrame:NSMakeRect(111,273,165,21)];
|
||||||
|
[installPathField setAlignment: NSLeftTextAlignment];
|
||||||
|
[installPathField setBordered: YES];
|
||||||
|
[installPathField setEditable: YES];
|
||||||
|
[installPathField setBezeled: YES];
|
||||||
|
[installPathField setDrawsBackground: YES];
|
||||||
|
[installPathField setStringValue:@""];
|
||||||
|
[installPathField setAction:@selector(changeCommonProjectEntry:)];
|
||||||
|
[installPathField setTarget:self];
|
||||||
|
[buildAttributesView addSubview:installPathField];
|
||||||
|
RELEASE(installPathField);
|
||||||
|
|
||||||
|
// Build Tool
|
||||||
|
textField =[[NSTextField alloc] initWithFrame:NSMakeRect(4,248,104,21)];
|
||||||
|
[textField setAlignment: NSRightTextAlignment];
|
||||||
|
[textField setBordered: NO];
|
||||||
|
[textField setEditable: NO];
|
||||||
|
[textField setBezeled: NO];
|
||||||
|
[textField setDrawsBackground: NO];
|
||||||
|
[textField setStringValue:@"Build Tool:"];
|
||||||
|
[buildAttributesView addSubview:textField];
|
||||||
|
RELEASE(textField);
|
||||||
|
|
||||||
|
toolField =[[NSTextField alloc] initWithFrame:NSMakeRect(111,248,165,21)];
|
||||||
|
[toolField setAlignment: NSLeftTextAlignment];
|
||||||
|
[toolField setBordered: YES];
|
||||||
|
[toolField setEditable: YES];
|
||||||
|
[toolField setBezeled: YES];
|
||||||
|
[toolField setDrawsBackground: YES];
|
||||||
|
[toolField setStringValue:@""];
|
||||||
|
[toolField setAction:@selector(changeCommonProjectEntry:)];
|
||||||
|
[toolField setTarget:self];
|
||||||
|
[buildAttributesView addSubview:toolField];
|
||||||
|
RELEASE(toolField);
|
||||||
|
|
||||||
|
// Public Headers In -- ADDITIONAL_INCLUDE_DIRS
|
||||||
|
textField =[[NSTextField alloc] initWithFrame:NSMakeRect(4,223,104,21)];
|
||||||
|
[textField setAlignment: NSRightTextAlignment];
|
||||||
|
[textField setBordered: NO];
|
||||||
|
[textField setEditable: NO];
|
||||||
|
[textField setBezeled: NO];
|
||||||
|
[textField setDrawsBackground: NO];
|
||||||
|
[textField setStringValue:@"Public Headers In:"];
|
||||||
|
[buildAttributesView addSubview:textField];
|
||||||
|
RELEASE(textField);
|
||||||
|
|
||||||
|
headersField =[[NSTextField alloc] initWithFrame:NSMakeRect(111,223,165,21)];
|
||||||
|
[headersField setAlignment: NSLeftTextAlignment];
|
||||||
|
[headersField setBordered: YES];
|
||||||
|
[headersField setEditable: YES];
|
||||||
|
[headersField setBezeled: YES];
|
||||||
|
[headersField setDrawsBackground: YES];
|
||||||
|
[headersField setStringValue:@""];
|
||||||
|
[headersField setAction:@selector(changeCommonProjectEntry:)];
|
||||||
|
[headersField setTarget:self];
|
||||||
|
[buildAttributesView addSubview:headersField];
|
||||||
|
RELEASE(headersField);
|
||||||
|
|
||||||
|
// Public Libraries In -- ADDITIONAL_TOOL_LIBS
|
||||||
|
textField =[[NSTextField alloc] initWithFrame:NSMakeRect(4,198,104,21)];
|
||||||
|
[textField setAlignment: NSRightTextAlignment];
|
||||||
|
[textField setBordered: NO];
|
||||||
|
[textField setEditable: NO];
|
||||||
|
[textField setBezeled: NO];
|
||||||
|
[textField setDrawsBackground: NO];
|
||||||
|
[textField setStringValue:@"Public Libraries In:"];
|
||||||
|
[buildAttributesView addSubview:textField];
|
||||||
|
RELEASE(textField);
|
||||||
|
|
||||||
|
libsField =[[NSTextField alloc] initWithFrame:NSMakeRect(111,198,165,21)];
|
||||||
|
[libsField setAlignment: NSLeftTextAlignment];
|
||||||
|
[libsField setBordered: YES];
|
||||||
|
[libsField setEditable: YES];
|
||||||
|
[libsField setBezeled: YES];
|
||||||
|
[libsField setDrawsBackground: YES];
|
||||||
|
[libsField setStringValue:@""];
|
||||||
|
[libsField setAction:@selector(changeCommonProjectEntry:)];
|
||||||
|
[libsField setTarget:self];
|
||||||
|
[buildAttributesView addSubview:libsField];
|
||||||
|
RELEASE(libsField);
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* "Project Attributes" View
|
||||||
|
*/
|
||||||
|
projectAttributesView = [[NSBox alloc] init];
|
||||||
|
[projectAttributesView setFrame:NSMakeRect(0,0,295,364)];
|
||||||
|
[projectAttributesView setTitlePosition:NSNoTitle];
|
||||||
|
[projectAttributesView
|
||||||
|
setAutoresizingMask:(NSViewWidthSizable | NSViewHeightSizable)];
|
||||||
|
[projectAttributesView setContentViewMargins:NSMakeSize(0.0, 0.0)];
|
||||||
|
|
||||||
|
// Project Type
|
||||||
|
textField = [[NSTextField alloc] initWithFrame:NSMakeRect(4,323,104,21)];
|
||||||
|
[textField setAlignment: NSRightTextAlignment];
|
||||||
|
[textField setBordered: NO];
|
||||||
|
[textField setEditable: NO];
|
||||||
|
[textField setBezeled: NO];
|
||||||
|
[textField setDrawsBackground: NO];
|
||||||
|
[textField setStringValue:@"Project Type:"];
|
||||||
|
[projectAttributesView addSubview:textField];
|
||||||
|
RELEASE(textField);
|
||||||
|
|
||||||
|
projectTypeField = [[NSTextField alloc] initWithFrame:
|
||||||
|
NSMakeRect(111,323,165,21)];
|
||||||
|
[projectTypeField setAlignment: NSLeftTextAlignment];
|
||||||
|
[projectTypeField setBordered: NO];
|
||||||
|
[projectTypeField setEditable: NO];
|
||||||
|
[projectTypeField setSelectable: NO];
|
||||||
|
[projectTypeField setBezeled: NO];
|
||||||
|
[projectTypeField setDrawsBackground: NO];
|
||||||
|
[projectTypeField setFont:[NSFont boldSystemFontOfSize: 12.0]];
|
||||||
|
[projectTypeField setStringValue:@""];
|
||||||
|
[projectAttributesView addSubview:projectTypeField];
|
||||||
|
RELEASE(projectTypeField);
|
||||||
|
|
||||||
|
// Project Name
|
||||||
|
textField = [[NSTextField alloc] initWithFrame:NSMakeRect(4,298,104,21)];
|
||||||
|
[textField setAlignment: NSRightTextAlignment];
|
||||||
|
[textField setBordered: NO];
|
||||||
|
[textField setEditable: NO];
|
||||||
|
[textField setBezeled: NO];
|
||||||
|
[textField setDrawsBackground: NO];
|
||||||
|
[textField setStringValue:@"Project Name:"];
|
||||||
|
[projectAttributesView addSubview:textField];
|
||||||
|
RELEASE(textField);
|
||||||
|
|
||||||
|
projectNameField = [[NSTextField alloc] initWithFrame:
|
||||||
|
NSMakeRect(111,298,165,21)];
|
||||||
|
[projectNameField setAlignment: NSLeftTextAlignment];
|
||||||
|
[projectNameField setBordered: NO];
|
||||||
|
[projectNameField setEditable: NO];
|
||||||
|
[projectNameField setBezeled: YES];
|
||||||
|
[projectNameField setDrawsBackground: YES];
|
||||||
|
[projectNameField setStringValue:@""];
|
||||||
|
[projectAttributesView addSubview:projectNameField];
|
||||||
|
RELEASE(projectNameField);
|
||||||
|
|
||||||
|
// Project Language
|
||||||
|
textField = [[NSTextField alloc] initWithFrame:NSMakeRect(4,273,104,21)];
|
||||||
|
[textField setAlignment: NSRightTextAlignment];
|
||||||
|
[textField setBordered: NO];
|
||||||
|
[textField setEditable: NO];
|
||||||
|
[textField setBezeled: NO];
|
||||||
|
[textField setDrawsBackground: NO];
|
||||||
|
[textField setStringValue:@"Language:"];
|
||||||
|
[projectAttributesView addSubview:textField];
|
||||||
|
RELEASE(textField);
|
||||||
|
|
||||||
|
projectLanguageField = [[NSTextField alloc] initWithFrame:
|
||||||
|
NSMakeRect(111,273,165,21)];
|
||||||
|
[projectLanguageField setAlignment: NSLeftTextAlignment];
|
||||||
|
[projectLanguageField setBordered: NO];
|
||||||
|
[projectLanguageField setEditable: NO];
|
||||||
|
[projectLanguageField setBezeled: YES];
|
||||||
|
[projectLanguageField setDrawsBackground: YES];
|
||||||
|
[projectLanguageField setStringValue:@""];
|
||||||
|
[projectAttributesView addSubview:projectLanguageField];
|
||||||
|
RELEASE(projectLanguageField);
|
||||||
|
|
||||||
|
// Application Class
|
||||||
|
textField = [[NSTextField alloc] initWithFrame:NSMakeRect(4,248,104,21)];
|
||||||
|
[textField setAlignment: NSRightTextAlignment];
|
||||||
|
[textField setBordered: NO];
|
||||||
|
[textField setEditable: NO];
|
||||||
|
[textField setBezeled: NO];
|
||||||
|
[textField setDrawsBackground: NO];
|
||||||
|
[textField setStringValue:@"Application Class:"];
|
||||||
|
[projectAttributesView addSubview:textField];
|
||||||
|
RELEASE(textField);
|
||||||
|
|
||||||
|
appClassField = [[NSTextField alloc] initWithFrame:
|
||||||
|
NSMakeRect(111,248,165,21)];
|
||||||
|
[appClassField setAlignment: NSLeftTextAlignment];
|
||||||
|
[appClassField setBordered: YES];
|
||||||
|
[appClassField setEditable: YES];
|
||||||
|
[appClassField setBezeled: YES];
|
||||||
|
[appClassField setDrawsBackground: YES];
|
||||||
|
[appClassField setStringValue:@""];
|
||||||
|
[appClassField setTarget:self];
|
||||||
|
[appClassField setAction:@selector(setAppClass:)];
|
||||||
|
[projectAttributesView addSubview:appClassField];
|
||||||
|
RELEASE(appClassField);
|
||||||
|
|
||||||
|
// Application Icon
|
||||||
|
_appIconBox = [[NSBox alloc] init];
|
||||||
|
[_appIconBox setFrame:NSMakeRect(6,154,270,84)];
|
||||||
|
[_appIconBox setContentViewMargins:NSMakeSize(4.0, 6.0)];
|
||||||
|
[_appIconBox setTitle:@"Application Icon"];
|
||||||
|
[projectAttributesView addSubview:_appIconBox];
|
||||||
|
|
||||||
|
appImageField = [[NSTextField alloc] initWithFrame:NSMakeRect(0,34,195,21)];
|
||||||
|
[appImageField setAlignment: NSLeftTextAlignment];
|
||||||
|
[appImageField setBordered: YES];
|
||||||
|
[appImageField setEditable: YES];
|
||||||
|
[appImageField setBezeled: YES];
|
||||||
|
[appImageField setDrawsBackground: YES];
|
||||||
|
[appImageField setStringValue:@""];
|
||||||
|
[_appIconBox addSubview:appImageField];
|
||||||
|
RELEASE(appImageField);
|
||||||
|
|
||||||
|
setAppIconButton = [[NSButton alloc] initWithFrame:NSMakeRect(147,0,48,21)];
|
||||||
|
[setAppIconButton setTitle:@"Set..."];
|
||||||
|
[setAppIconButton setTarget:self];
|
||||||
|
[setAppIconButton setAction:@selector(setAppIcon:)];
|
||||||
|
[_appIconBox addSubview:setAppIconButton];
|
||||||
|
RELEASE(setAppIconButton);
|
||||||
|
|
||||||
|
clearAppIconButton = [[NSButton alloc] initWithFrame:NSMakeRect(95,0,48,21)];
|
||||||
|
[clearAppIconButton setTitle:@"Clear"];
|
||||||
|
[clearAppIconButton setTarget:self];
|
||||||
|
[clearAppIconButton setAction:@selector(clearAppIcon:)];
|
||||||
|
[_appIconBox addSubview:clearAppIconButton];
|
||||||
|
RELEASE(clearAppIconButton);
|
||||||
|
|
||||||
|
_iconViewBox = [[NSBox alloc] initWithFrame:NSMakeRect(200,0,56,56)];
|
||||||
|
[_iconViewBox setTitlePosition:NSNoTitle];
|
||||||
|
[_iconViewBox setBorderType:NSBezelBorder];
|
||||||
|
[_iconViewBox setContentViewMargins:NSMakeSize(2.0, 2.0)];
|
||||||
|
[_appIconBox addSubview:_iconViewBox];
|
||||||
|
RELEASE(_iconViewBox);
|
||||||
|
|
||||||
|
appIconView = [[NSImageView alloc] initWithFrame:NSMakeRect(200,0,56,56)];
|
||||||
|
[_iconViewBox addSubview:appIconView];
|
||||||
|
RELEASE(appIconView);
|
||||||
|
|
||||||
|
RELEASE(_appIconBox);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* "File Attributes" View
|
||||||
|
*/
|
||||||
|
fileAttributesView = [[NSBox alloc] init];
|
||||||
|
[fileAttributesView setFrame:NSMakeRect(0,0,295,364)];
|
||||||
|
[fileAttributesView setTitlePosition:NSNoTitle];
|
||||||
|
[fileAttributesView setAutoresizingMask:
|
||||||
|
(NSViewWidthSizable | NSViewHeightSizable)];
|
||||||
|
[fileAttributesView setContentViewMargins:NSMakeSize(0.0, 0.0)];
|
||||||
|
|
||||||
|
fileIconView = [[NSImageView alloc] initWithFrame:NSMakeRect(8,290,48,48)];
|
||||||
|
[fileIconView setImage:nil];
|
||||||
|
[fileAttributesView addSubview:fileIconView];
|
||||||
|
RELEASE(fileIconView);
|
||||||
|
|
||||||
|
fileNameField =[[NSTextField alloc] initWithFrame:NSMakeRect(60,290,216,48)];
|
||||||
|
[fileNameField setAlignment: NSLeftTextAlignment];
|
||||||
|
[fileNameField setBordered: NO];
|
||||||
|
[fileNameField setEditable: NO];
|
||||||
|
[fileNameField setSelectable: NO];
|
||||||
|
[fileNameField setBezeled: NO];
|
||||||
|
[fileNameField setDrawsBackground: NO];
|
||||||
|
[fileNameField setFont:[NSFont systemFontOfSize:20.0]];
|
||||||
|
[fileNameField setStringValue:@"No files selected"];
|
||||||
|
[fileAttributesView addSubview:fileNameField];
|
||||||
|
RELEASE(fileNameField);
|
||||||
|
|
||||||
|
line = [[NSBox alloc] initWithFrame:NSMakeRect(0,278,295,2)];
|
||||||
|
[line setTitlePosition:NSNoTitle];
|
||||||
|
[fileAttributesView addSubview:line];
|
||||||
|
RELEASE(line);
|
||||||
|
|
||||||
|
[[NSNotificationCenter defaultCenter]
|
||||||
|
addObserver:self
|
||||||
|
selector:@selector(browserDidSetPath:)
|
||||||
|
name:PCBrowserDidSetPathNotification
|
||||||
|
object:[self projectBrowser]];
|
||||||
|
|
||||||
|
[self updateInspectorValues:nil];
|
||||||
|
}
|
||||||
|
|
||||||
|
- (NSView *)buildAttributesView
|
||||||
|
{
|
||||||
|
if (!buildAttributesView)
|
||||||
|
{
|
||||||
|
[self createInspectors];
|
||||||
|
}
|
||||||
|
|
||||||
|
return buildAttributesView;
|
||||||
|
}
|
||||||
|
|
||||||
|
- (NSView *)projectAttributesView
|
||||||
|
{
|
||||||
|
if (!projectAttributesView)
|
||||||
|
{
|
||||||
|
[self createInspectors];
|
||||||
|
}
|
||||||
|
return projectAttributesView;
|
||||||
|
}
|
||||||
|
|
||||||
|
- (NSView *)fileAttributesView
|
||||||
|
{
|
||||||
|
if (!fileAttributesView)
|
||||||
|
{
|
||||||
|
[self createInspectors];
|
||||||
|
}
|
||||||
|
return fileAttributesView;
|
||||||
|
}
|
||||||
|
|
||||||
|
// ----------------------------------------------------------------------------
|
||||||
|
// --- Actions
|
||||||
|
// ----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
- (void)changeCommonProjectEntry:(id)sender
|
||||||
|
{
|
||||||
|
NSString *newEntry = [sender stringValue];
|
||||||
|
|
||||||
|
if (sender == installPathField)
|
||||||
|
{
|
||||||
|
[projectDict setObject:newEntry forKey:PCInstallDir];
|
||||||
|
}
|
||||||
|
else if ( sender == toolField )
|
||||||
|
{
|
||||||
|
[projectDict setObject:newEntry forKey:PCBuildTool];
|
||||||
|
|
||||||
|
if( ![[NSFileManager defaultManager] isExecutableFileAtPath:newEntry] )
|
||||||
|
{
|
||||||
|
NSRunAlertPanel(@"Build Tool Error!",
|
||||||
|
@"No valid executable found at '%@'!",
|
||||||
|
@"OK",nil,nil,newEntry);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if ( sender == ccOptField )
|
||||||
|
{
|
||||||
|
[projectDict setObject:newEntry forKey:PCCompilerOptions];
|
||||||
|
}
|
||||||
|
else if ( sender == ldOptField )
|
||||||
|
{
|
||||||
|
[projectDict setObject:newEntry forKey:PCLinkerOptions];
|
||||||
|
}
|
||||||
|
|
||||||
|
[[NSNotificationCenter defaultCenter]
|
||||||
|
postNotificationName:ProjectDictDidChangeNotification
|
||||||
|
object:self];
|
||||||
|
}
|
||||||
|
|
||||||
|
- (void)setAppClass:(id)sender
|
||||||
|
{
|
||||||
|
[projectDict setObject:[appClassField stringValue] forKey:PCAppClass];
|
||||||
|
|
||||||
|
[[NSNotificationCenter defaultCenter]
|
||||||
|
postNotificationName:ProjectDictDidChangeNotification
|
||||||
|
object:self];
|
||||||
|
}
|
||||||
|
|
||||||
|
- (void)setAppIcon:(id)sender
|
||||||
|
{
|
||||||
|
int result;
|
||||||
|
NSArray *fileTypes = [NSImage imageFileTypes];
|
||||||
|
NSOpenPanel *openPanel = [NSOpenPanel openPanel];
|
||||||
|
NSString *dir = nil;
|
||||||
|
|
||||||
|
[openPanel setAllowsMultipleSelection:NO];
|
||||||
|
|
||||||
|
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);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
- (BOOL)setAppIconWithImageAtPath:(NSString *)path
|
||||||
|
{
|
||||||
|
NSRect frame = {{0,0}, {64, 64}};
|
||||||
|
NSImage *image = nil;
|
||||||
|
NSString *imageName = nil;
|
||||||
|
|
||||||
|
if (!(image = [[NSImage alloc] initWithContentsOfFile:path]))
|
||||||
|
{
|
||||||
|
return NO;
|
||||||
|
}
|
||||||
|
|
||||||
|
imageName = [path lastPathComponent];
|
||||||
|
|
||||||
|
[self addAndCopyFiles:[NSArray arrayWithObject:path] forKey:PCImages];
|
||||||
|
|
||||||
|
[projectDict setObject:imageName forKey:PCAppIcon];
|
||||||
|
|
||||||
|
[infoDict setObject:imageName forKey:@"NSIcon"];
|
||||||
|
[infoDict setObject:imageName forKey:@"ApplicationIcon"];
|
||||||
|
|
||||||
|
[appImageField setStringValue:imageName];
|
||||||
|
|
||||||
|
[appIconView setImage:nil];
|
||||||
|
[appIconView display];
|
||||||
|
|
||||||
|
frame.size = [image size];
|
||||||
|
[appIconView setFrame:frame];
|
||||||
|
[appIconView setImage:image];
|
||||||
|
[appIconView display];
|
||||||
|
RELEASE(image);
|
||||||
|
|
||||||
|
[[NSNotificationCenter defaultCenter]
|
||||||
|
postNotificationName:ProjectDictDidChangeNotification
|
||||||
|
object:self];
|
||||||
|
|
||||||
|
return YES;
|
||||||
|
}
|
||||||
|
|
||||||
|
- (void)clearAppIcon:(id)sender
|
||||||
|
{
|
||||||
|
[projectDict setObject:@"" forKey:PCAppIcon];
|
||||||
|
[infoDict setObject:@"" forKey:@"NSIcon"];
|
||||||
|
[infoDict setObject:@"" forKey:@"ApplicationIcon"];
|
||||||
|
[appImageField setStringValue:@""];
|
||||||
|
[appIconView setImage:nil];
|
||||||
|
[appIconView display];
|
||||||
|
|
||||||
|
[[NSNotificationCenter defaultCenter]
|
||||||
|
postNotificationName:ProjectDictDidChangeNotification
|
||||||
|
object:self];
|
||||||
|
}
|
||||||
|
|
||||||
|
// ----------------------------------------------------------------------------
|
||||||
|
// --- Notifications
|
||||||
|
// ----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
- (void)updateInspectorValues:(NSNotification *)aNotif
|
||||||
|
{
|
||||||
|
NSRect frame = {{0,0}, {48,48}};
|
||||||
|
NSImage *image = nil;
|
||||||
|
NSString *path = nil;
|
||||||
|
NSString *_icon = nil;
|
||||||
|
|
||||||
|
NSLog (@"PCAppProject: updateInspectorValues");
|
||||||
|
|
||||||
|
// Build Attributes view
|
||||||
|
[installPathField setStringValue:[projectDict objectForKey:PCInstallDir]];
|
||||||
|
[toolField setStringValue:[projectDict objectForKey:PCBuildTool]];
|
||||||
|
[ccOptField setStringValue:[projectDict objectForKey:PCCompilerOptions]];
|
||||||
|
[ldOptField setStringValue:[projectDict objectForKey:PCLinkerOptions]];
|
||||||
|
|
||||||
|
// Project Attributes view
|
||||||
|
[projectTypeField setStringValue:[projectDict objectForKey:PCProjType]];
|
||||||
|
[projectNameField setStringValue:[projectDict objectForKey:PCProjectName]];
|
||||||
|
[projectLanguageField setStringValue:[projectDict objectForKey:@"LANGUAGE"]];
|
||||||
|
[appClassField setStringValue:[projectDict objectForKey:PCAppClass]];
|
||||||
|
[appImageField setStringValue:[projectDict objectForKey:PCAppIcon]];
|
||||||
|
|
||||||
|
_icon = [projectDict objectForKey:PCAppIcon];
|
||||||
|
if (_icon && ![_icon isEqualToString:@""])
|
||||||
|
{
|
||||||
|
path = [self dirForCategory:PCImages];
|
||||||
|
path = [path stringByAppendingPathComponent:_icon];
|
||||||
|
}
|
||||||
|
|
||||||
|
if (path && (image = [[NSImage alloc] initWithContentsOfFile:path]))
|
||||||
|
{
|
||||||
|
frame.size = [image size];
|
||||||
|
[appIconView setFrame:frame];
|
||||||
|
[appIconView setImage:image];
|
||||||
|
[appIconView display];
|
||||||
|
RELEASE(image);
|
||||||
|
}
|
||||||
|
|
||||||
|
// File Attributes view
|
||||||
|
}
|
||||||
|
|
||||||
|
- (void)browserDidSetPath:(NSNotification *)aNotif
|
||||||
|
{
|
||||||
|
NSString *fileName = [[aNotif object] nameOfSelectedFile];
|
||||||
|
|
||||||
|
if (fileName)
|
||||||
|
{
|
||||||
|
[fileNameField setStringValue:fileName];
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
[fileNameField setStringValue:@"No files selected"];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// ----------------------------------------------------------------------------
|
||||||
|
// --- Project
|
||||||
|
// ----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
- (Class)builderClass
|
||||||
|
{
|
||||||
|
return [PCAppProj class];
|
||||||
|
}
|
||||||
|
|
||||||
|
- (BOOL)writeMakefile
|
||||||
|
{
|
||||||
|
NSData *mfd;
|
||||||
|
NSString *mfl = [projectPath stringByAppendingPathComponent:@"GNUmakefile"];
|
||||||
|
int i,j;
|
||||||
|
PCMakefileFactory *mf = [PCMakefileFactory sharedFactory];
|
||||||
|
NSDictionary *dict = [self projectDict];
|
||||||
|
NSString *infoFile = nil;
|
||||||
|
|
||||||
|
// Save the project file
|
||||||
|
[super writeMakefile];
|
||||||
|
|
||||||
|
// Save Info-gnustep.plist
|
||||||
|
infoFile = [projectPath stringByAppendingPathComponent:@"Info-gnustep.plist"];
|
||||||
|
[infoDict writeToFile:infoFile atomically:YES];
|
||||||
|
|
||||||
|
// Create the new file
|
||||||
|
[mf createMakefileForProject:[self projectName]];
|
||||||
|
|
||||||
|
[mf appendString:@"include $(GNUSTEP_MAKEFILES)/common.make\n"];
|
||||||
|
|
||||||
|
[mf appendSubprojects:[dict objectForKey:PCSubprojects]];
|
||||||
|
|
||||||
|
[mf appendApplication];
|
||||||
|
[mf appendAppIcon:[dict objectForKey:PCAppIcon]];
|
||||||
|
[mf appendGuiLibraries:[dict objectForKey:PCLibraries]];
|
||||||
|
|
||||||
|
[mf appendResources];
|
||||||
|
for (i=0; i<[[self resourceFileKeys] count]; i++)
|
||||||
|
{
|
||||||
|
NSString *k = [[self resourceFileKeys] objectAtIndex:i];
|
||||||
|
NSMutableArray *resources = [[dict objectForKey:k] mutableCopy];
|
||||||
|
|
||||||
|
if ([k isEqualToString:PCImages])
|
||||||
|
{
|
||||||
|
for (j=0; j<[resources count]; j++)
|
||||||
|
{
|
||||||
|
[resources replaceObjectAtIndex:j
|
||||||
|
withObject:[NSString stringWithFormat:@"Images/%@",
|
||||||
|
[resources objectAtIndex:j]]];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
[mf appendResourceItems:resources];
|
||||||
|
[resources release];
|
||||||
|
}
|
||||||
|
|
||||||
|
[mf appendHeaders:[dict objectForKey:PCHeaders]];
|
||||||
|
[mf appendClasses:[dict objectForKey:PCClasses]];
|
||||||
|
[mf appendOtherSources:[dict objectForKey:PCOtherSources]];
|
||||||
|
|
||||||
|
[mf appendTailForApp];
|
||||||
|
|
||||||
|
// Write the new file to disc!
|
||||||
|
if ((mfd = [mf encodedMakefile]))
|
||||||
|
{
|
||||||
|
if ([mfd writeToFile:mfl atomically:YES])
|
||||||
|
{
|
||||||
|
return YES;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return NO;
|
||||||
|
}
|
||||||
|
|
||||||
|
- (NSArray *)fileTypesForCategory:(NSString *)category
|
||||||
|
{
|
||||||
|
NSLog(@"Category: %@", category);
|
||||||
|
|
||||||
|
if ([category isEqualToString:PCClasses])
|
||||||
|
{
|
||||||
|
return [NSArray arrayWithObjects:@"m",nil];
|
||||||
|
}
|
||||||
|
else if ([category isEqualToString:PCHeaders])
|
||||||
|
{
|
||||||
|
return [NSArray arrayWithObjects:@"h",nil];
|
||||||
|
}
|
||||||
|
else if ([category isEqualToString:PCOtherSources])
|
||||||
|
{
|
||||||
|
return [NSArray arrayWithObjects:@"c",@"C",nil];
|
||||||
|
}
|
||||||
|
else if ([category isEqualToString:PCInterfaces])
|
||||||
|
{
|
||||||
|
return [NSArray arrayWithObjects:@"gmodel",@"gorm",nil];
|
||||||
|
}
|
||||||
|
else if ([category isEqualToString:PCImages])
|
||||||
|
{
|
||||||
|
return [NSImage imageFileTypes];
|
||||||
|
}
|
||||||
|
else if ([category isEqualToString:PCSubprojects])
|
||||||
|
{
|
||||||
|
return [NSArray arrayWithObjects:@"subproj",nil];
|
||||||
|
}
|
||||||
|
else if ([category isEqualToString:PCLibraries])
|
||||||
|
{
|
||||||
|
return [NSArray arrayWithObjects:@"so",@"a",@"lib",nil];
|
||||||
|
}
|
||||||
|
|
||||||
|
return nil;
|
||||||
|
}
|
||||||
|
|
||||||
|
- (NSString *)dirForCategory:(NSString *)category
|
||||||
|
{
|
||||||
|
if ([category isEqualToString:PCImages])
|
||||||
|
{
|
||||||
|
return [projectPath stringByAppendingPathComponent:@"Images"];
|
||||||
|
}
|
||||||
|
else if ([category isEqualToString:PCDocuFiles])
|
||||||
|
{
|
||||||
|
return [projectPath stringByAppendingPathComponent:@"Documentation"];
|
||||||
|
}
|
||||||
|
|
||||||
|
return projectPath;
|
||||||
|
}
|
||||||
|
|
||||||
|
- (NSArray *)sourceFileKeys
|
||||||
|
{
|
||||||
|
return [NSArray arrayWithObjects:
|
||||||
|
PCClasses, PCOtherSources, nil];
|
||||||
|
}
|
||||||
|
|
||||||
|
- (NSArray *)resourceFileKeys
|
||||||
|
{
|
||||||
|
return [NSArray arrayWithObjects:
|
||||||
|
PCInterfaces, PCOtherResources, PCImages, nil];
|
||||||
|
}
|
||||||
|
|
||||||
|
- (NSArray *)otherKeys
|
||||||
|
{
|
||||||
|
return [NSArray arrayWithObjects:
|
||||||
|
PCDocuFiles, PCSupportingFiles, PCNonProject, nil];
|
||||||
|
}
|
||||||
|
|
||||||
|
- (NSArray *)buildTargets
|
||||||
|
{
|
||||||
|
return [NSArray arrayWithObjects: @"app", @"debug", @"profile", nil];
|
||||||
|
}
|
||||||
|
|
||||||
|
- (NSString *)projectDescription
|
||||||
|
{
|
||||||
|
return @"Project that handles GNUstep/ObjC based applications.";
|
||||||
|
}
|
||||||
|
|
||||||
|
- (BOOL)isExecutable
|
||||||
|
{
|
||||||
|
return YES;
|
||||||
|
}
|
||||||
|
|
||||||
|
@end
|
39
Modules/ApplicationProject/Templates/AppController.h
Normal file
39
Modules/ApplicationProject/Templates/AppController.h
Normal file
|
@ -0,0 +1,39 @@
|
||||||
|
/*
|
||||||
|
* AppController.h created by phr on 2000-08-27 11:38:59 +0000
|
||||||
|
*
|
||||||
|
* GNUstep Application Controller
|
||||||
|
*
|
||||||
|
* Created with ProjectCenter - http://www.gnustep.org
|
||||||
|
*
|
||||||
|
* $Id$
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef _PCAPPPROJ_APPCONTROLLER_H
|
||||||
|
#define _PCAPPPROJ_APPCONTROLLER_H
|
||||||
|
|
||||||
|
#include <AppKit/AppKit.h>
|
||||||
|
|
||||||
|
@interface AppController : NSObject
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
+ (void)initialize;
|
||||||
|
|
||||||
|
- (id)init;
|
||||||
|
- (void)dealloc;
|
||||||
|
|
||||||
|
- (void)awakeFromNib;
|
||||||
|
|
||||||
|
- (void)applicationDidFinishLaunching:(NSNotification *)notif;
|
||||||
|
|
||||||
|
- (BOOL)applicationShouldTerminate:(id)sender;
|
||||||
|
- (void)applicationWillTerminate:(NSNotification *)notification;
|
||||||
|
|
||||||
|
- (BOOL)application:(NSApplication *)application openFile:(NSString *)fileName;
|
||||||
|
|
||||||
|
- (void)showPrefPanel:(id)sender;
|
||||||
|
- (void)showInfoPanel:(id)sender;
|
||||||
|
|
||||||
|
@end
|
||||||
|
|
||||||
|
#endif
|
75
Modules/ApplicationProject/Templates/AppController.m
Normal file
75
Modules/ApplicationProject/Templates/AppController.m
Normal file
|
@ -0,0 +1,75 @@
|
||||||
|
/*
|
||||||
|
* AppController.m created by phr on 2000-08-27 11:38:58 +0000
|
||||||
|
*
|
||||||
|
* GNUstep Application Controller
|
||||||
|
*
|
||||||
|
* Created with ProjectCenter - http://www.gnustep.org
|
||||||
|
*
|
||||||
|
* $Id$
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "AppController.h"
|
||||||
|
|
||||||
|
@implementation AppController
|
||||||
|
|
||||||
|
static NSDictionary *infoDict = nil;
|
||||||
|
|
||||||
|
+ (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
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
- (void)applicationDidFinishLaunching:(NSNotification *)notif
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
- (BOOL)applicationShouldTerminate:(id)sender
|
||||||
|
{
|
||||||
|
return YES;
|
||||||
|
}
|
||||||
|
|
||||||
|
- (void)applicationWillTerminate:(NSNotification *)notification
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
- (BOOL)application:(NSApplication *)application openFile:(NSString *)fileName
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
- (void)showPrefPanel:(id)sender
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
- (void)showInfoPanel:(id)sender
|
||||||
|
{
|
||||||
|
[[NSApplication sharedApplication] orderFrontStandardInfoPanel:sender];
|
||||||
|
}
|
||||||
|
|
||||||
|
@end
|
40
Modules/ApplicationProject/Templates/GNUmakefile.postamble
Normal file
40
Modules/ApplicationProject/Templates/GNUmakefile.postamble
Normal file
|
@ -0,0 +1,40 @@
|
||||||
|
#
|
||||||
|
# GNUmakefile.postamble - Generated by ProjectCenter
|
||||||
|
#
|
||||||
|
|
||||||
|
# Things to do before compiling
|
||||||
|
# before-all::
|
||||||
|
|
||||||
|
# Things to do after compiling
|
||||||
|
# after-all::
|
||||||
|
|
||||||
|
# Things to do before installing
|
||||||
|
# before-install::
|
||||||
|
|
||||||
|
# Things to do after installing
|
||||||
|
# after-install::
|
||||||
|
|
||||||
|
# Things to do before uninstalling
|
||||||
|
# before-uninstall::
|
||||||
|
|
||||||
|
# Things to do after uninstalling
|
||||||
|
# after-uninstall::
|
||||||
|
|
||||||
|
# Things to do before cleaning
|
||||||
|
# before-clean::
|
||||||
|
|
||||||
|
# Things to do after cleaning
|
||||||
|
# after-clean::
|
||||||
|
|
||||||
|
# Things to do before distcleaning
|
||||||
|
# before-distclean::
|
||||||
|
|
||||||
|
# Things to do after distcleaning
|
||||||
|
# after-distclean::
|
||||||
|
|
||||||
|
# Things to do before checking
|
||||||
|
# before-check::
|
||||||
|
|
||||||
|
# Things to do after checking
|
||||||
|
# after-check::
|
||||||
|
|
32
Modules/ApplicationProject/Templates/GNUmakefile.preamble
Normal file
32
Modules/ApplicationProject/Templates/GNUmakefile.preamble
Normal file
|
@ -0,0 +1,32 @@
|
||||||
|
#
|
||||||
|
# GNUmakefile.preamble - Generated by ProjectCenter
|
||||||
|
#
|
||||||
|
|
||||||
|
|
||||||
|
# Additional flags to pass to the preprocessor
|
||||||
|
ADDITIONAL_CPPFLAGS +=
|
||||||
|
|
||||||
|
# Additional flags to pass to the Objective-C compiler
|
||||||
|
ADDITIONAL_OBJCFLAGS +=
|
||||||
|
|
||||||
|
# Additional flags to pass to the C compiler
|
||||||
|
ADDITIONAL_CFLAGS +=
|
||||||
|
|
||||||
|
# Additional include directories the compiler should search
|
||||||
|
ADDITIONAL_INCLUDE_DIRS +=
|
||||||
|
|
||||||
|
# Additional LDFLAGS to pass to the linker
|
||||||
|
ADDITIONAL_LDFLAGS +=
|
||||||
|
|
||||||
|
# Additional library directories the linker should search
|
||||||
|
ADDITIONAL_LIB_DIRS +=
|
||||||
|
|
||||||
|
ADDITIONAL_TOOL_LIBS +=
|
||||||
|
|
||||||
|
#
|
||||||
|
# Flags dealing with installing and uninstalling
|
||||||
|
#
|
||||||
|
|
||||||
|
# Additional directories to be created during installation
|
||||||
|
ADDITIONAL_INSTALL_DIRS +=
|
||||||
|
|
103
Modules/ApplicationProject/Templates/main.m
Normal file
103
Modules/ApplicationProject/Templates/main.m
Normal file
|
@ -0,0 +1,103 @@
|
||||||
|
/* $Id$ */
|
||||||
|
|
||||||
|
#include <AppKit/AppKit.h>
|
||||||
|
#include "AppController.h"
|
||||||
|
|
||||||
|
#define APP_NAME @"GNUstep"
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Create the application's menu
|
||||||
|
*/
|
||||||
|
|
||||||
|
void createMenu();
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Initialise and go!
|
||||||
|
*/
|
||||||
|
|
||||||
|
int main(int argc, const char *argv[])
|
||||||
|
{
|
||||||
|
NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
|
||||||
|
AppController *controller;
|
||||||
|
|
||||||
|
[NSApplication sharedApplication];
|
||||||
|
|
||||||
|
createMenu();
|
||||||
|
|
||||||
|
controller = [[AppController alloc] init];
|
||||||
|
[NSApp setDelegate:controller];
|
||||||
|
|
||||||
|
RELEASE(pool);
|
||||||
|
|
||||||
|
return NSApplicationMain (argc, argv);
|
||||||
|
}
|
||||||
|
|
||||||
|
void createMenu()
|
||||||
|
{
|
||||||
|
NSMenu *menu;
|
||||||
|
NSMenu *info;
|
||||||
|
NSMenu *edit;
|
||||||
|
NSMenu *services;
|
||||||
|
NSMenu *windows;
|
||||||
|
|
||||||
|
SEL action = @selector(method:);
|
||||||
|
|
||||||
|
menu = [[NSMenu alloc] initWithTitle:APP_NAME];
|
||||||
|
|
||||||
|
[menu addItemWithTitle:@"Info" action:@selector(showInfoPanel:)
|
||||||
|
keyEquivalent:@""];
|
||||||
|
[menu addItemWithTitle:@"Edit" action:action keyEquivalent:@""];
|
||||||
|
[menu addItemWithTitle:@"Windows" action:action keyEquivalent:@""];
|
||||||
|
[menu addItemWithTitle:@"Services" action:action keyEquivalent:@""];
|
||||||
|
[menu addItemWithTitle:@"Hide" action:@selector(hide:) keyEquivalent:@"h"];
|
||||||
|
[menu addItemWithTitle:@"Quit" action:@selector(terminate:) keyEquivalent:@"q"];
|
||||||
|
|
||||||
|
info = AUTORELEASE([[NSMenu alloc] init]);
|
||||||
|
[menu setSubmenu:info forItem:[menu itemWithTitle:@"Info"]];
|
||||||
|
[info addItemWithTitle:@"Info Panel..."
|
||||||
|
action:@selector(showInfoPanel:) keyEquivalent:@""];
|
||||||
|
[info addItemWithTitle:@"Preferences"
|
||||||
|
action:@selector(showPrefPanel:) keyEquivalent:@""];
|
||||||
|
[info addItemWithTitle:@"Help" action:action keyEquivalent:@"?"];
|
||||||
|
|
||||||
|
edit = AUTORELEASE([[NSMenu alloc] init]);
|
||||||
|
[edit addItemWithTitle:@"Cut"
|
||||||
|
action:@selector(cut:)
|
||||||
|
keyEquivalent:@"x"];
|
||||||
|
[edit addItemWithTitle:@"Copy"
|
||||||
|
action:@selector(copy:)
|
||||||
|
keyEquivalent:@"c"];
|
||||||
|
[edit addItemWithTitle:@"Paste"
|
||||||
|
action:@selector(paste:)
|
||||||
|
keyEquivalent:@"v"];
|
||||||
|
[edit addItemWithTitle:@"Delete"
|
||||||
|
action:@selector(delete:)
|
||||||
|
keyEquivalent:@""];
|
||||||
|
[edit addItemWithTitle:@"Select All"
|
||||||
|
action:@selector(selectAll:)
|
||||||
|
keyEquivalent:@"a"];
|
||||||
|
[menu setSubmenu:edit forItem:[menu itemWithTitle:@"Edit"]];
|
||||||
|
|
||||||
|
windows = AUTORELEASE([[NSMenu alloc] init]);
|
||||||
|
[windows addItemWithTitle:@"Arrange"
|
||||||
|
action:@selector(arrangeInFront:)
|
||||||
|
keyEquivalent:@""];
|
||||||
|
[windows addItemWithTitle:@"Miniaturize"
|
||||||
|
action:@selector(performMiniaturize:)
|
||||||
|
keyEquivalent:@"m"];
|
||||||
|
[windows addItemWithTitle:@"Close"
|
||||||
|
action:@selector(performClose:)
|
||||||
|
keyEquivalent:@"w"];
|
||||||
|
[menu setSubmenu:windows forItem:[menu itemWithTitle:@"Windows"]];
|
||||||
|
|
||||||
|
services = AUTORELEASE([[NSMenu alloc] init]);
|
||||||
|
[menu setSubmenu:services forItem:[menu itemWithTitle:@"Services"]];
|
||||||
|
|
||||||
|
[NSApp setMainMenu:menu];
|
||||||
|
[NSApp setServicesMenu: services];
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue