diff --git a/ChangeLog b/ChangeLog index 1fe9e7c..3cf9a0e 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +2003-01-25 Daniel Luederwald + + * GNUmakefile (SUBPROJECTS): New project PCRenaissanceProj + 2002-10-06 15:45 probert * AUTHORS, PCLib/PCEditor.h, PCLib/PCEditor.m, diff --git a/GNUmakefile b/GNUmakefile index 8f50012..ca27936 100644 --- a/GNUmakefile +++ b/GNUmakefile @@ -41,6 +41,7 @@ SUBPROJECTS = \ PCToolProj \ PCLibProj \ PCBaseFileTypes \ + PCRenaissanceProj \ ProjectCenter -include GNUMakefile.preamble diff --git a/PCBaseFileTypes/ChangeLog b/PCBaseFileTypes/ChangeLog index 8a67cae..aa24085 100644 --- a/PCBaseFileTypes/ChangeLog +++ b/PCBaseFileTypes/ChangeLog @@ -1,3 +1,8 @@ +2003-01-25 Daniel Luederwald + + * GNUmakefile (PCBaseFileTypes_RESOURCE_FILES): New type gsmarkup. + * PCBaseFileType.m: Idem. + 2002-11-27 15:45 probert * Mac OS X port using Cocoa diff --git a/PCBaseFileTypes/GNUmakefile b/PCBaseFileTypes/GNUmakefile index 39ed106..e42014e 100644 --- a/PCBaseFileTypes/GNUmakefile +++ b/PCBaseFileTypes/GNUmakefile @@ -45,6 +45,7 @@ class.template \ header.template \ protocol.template \ nsviewclass.template \ +gsmarkup.template \ nsviewheader.template # diff --git a/PCBaseFileTypes/PCBaseFileType.m b/PCBaseFileTypes/PCBaseFileType.m index 1b2b6a7..018a7e6 100644 --- a/PCBaseFileTypes/PCBaseFileType.m +++ b/PCBaseFileTypes/PCBaseFileType.m @@ -33,6 +33,7 @@ #define CFile @"C File" #define CHeader @"C Header" #define ProtocolFile @"Objective-C Protocol" +#define GSMarkupFile @"GSMarkup" @implementation PCBaseFileType @@ -49,6 +50,7 @@ static NSDictionary *dict = nil; NSDictionary *ccDict; NSDictionary *chDict; NSDictionary *protocolDict; + NSDictionary *gsmarkupDict; NSString *descr; _creator = [[[self class] alloc] init]; @@ -95,6 +97,14 @@ static NSDictionary *dict = nil; PCHeaders,@"ProjectKey", descr,@"TypeDescription", nil]; + +descr = [NSString stringWithString:@"Generic GSMarkup File.\n\nThis is the interface description of GNUstep Renaissance."]; + gsmarkupDict =[NSDictionary dictionaryWithObjectsAndKeys: + _creator,@"Creator", + PCGSMarkupFiles,@"ProjectKey", + descr,@"TypeDescription", + nil]; + dict = [[NSDictionary alloc] initWithObjectsAndKeys: ccDict,CFile, @@ -103,6 +113,7 @@ static NSDictionary *dict = nil; headerDict,ObjCHeader, classDict,ObjCClass, nsviewClassDict,ObjCNSViewClass, + gsmarkupDict, GSMarkupFile, nil]; } return _creator; @@ -225,6 +236,17 @@ static NSDictionary *dict = nil; [files setObject:ObjCHeader forKey:newFile]; } + else if ([type isEqualToString:GSMarkupFile]) + { + _file = [[NSBundle bundleForClass:[self class]] pathForResource:@"gsmarkup" ofType:@"template"]; + if ([[path pathExtension] isEqual: @"gsmarkup"] == NO) + newFile = [path stringByAppendingPathExtension:@"gsmarkup"]; + [fm copyPath:_file toPath:newFile handler:nil]; + [files setObject:GSMarkupFile forKey:newFile]; + } + + + /* * */ diff --git a/PCBaseFileTypes/gsmarkup.template b/PCBaseFileTypes/gsmarkup.template new file mode 100644 index 0000000..e403420 --- /dev/null +++ b/PCBaseFileTypes/gsmarkup.template @@ -0,0 +1,8 @@ + + + + + + + + diff --git a/PCLib/ChangeLog b/PCLib/ChangeLog index e3844f5..dad2da5 100644 --- a/PCLib/ChangeLog +++ b/PCLib/ChangeLog @@ -1,3 +1,10 @@ +2003-01-25 Daniel Luederwald + + * PCBrowserController.m: Add gsmarkup to editable files. + (isEditableFiles:): Idem, but don't allow editing if extension + is gorm (patch from Adam Fedor ). + * PCProjectDebugger.m (run:): Add PCRenaissanceProject. + 2002-11-27 Philippe C.D. Robert * Extracting UI code into separate categories. PBX project file for diff --git a/PCLib/PCBrowserController.h b/PCLib/PCBrowserController.h index 3c906d0..4e49bdc 100644 --- a/PCLib/PCBrowserController.h +++ b/PCLib/PCBrowserController.h @@ -42,7 +42,7 @@ - (void)click:(id)sender; - (void)doubleClick:(id)sender; -- (BOOL)isEditableCategory:(NSString *)category; +- (BOOL)isEditableCategory:(NSString *)category file: (NSString *)title; - (void)projectDictDidChange:(NSNotification *)aNotif; diff --git a/PCLib/PCBrowserController.m b/PCLib/PCBrowserController.m index 27237f9..5a22cfc 100644 --- a/PCLib/PCBrowserController.m +++ b/PCLib/PCBrowserController.m @@ -44,7 +44,7 @@ NSString *ltitle = [[sender selectedCell] stringValue]; NSString *category = [[sender selectedCellInColumn:0] stringValue]; - if ([self isEditableCategory:category]) + if ([self isEditableCategory:category file: ltitle]) { [[NSNotificationCenter defaultCenter] postNotificationName:@"FileBecomesEditedNotification" object:ltitle]; @@ -61,7 +61,7 @@ NSString *fn = [self nameOfSelectedFile]; NSString *f = [[project projectPath] stringByAppendingPathComponent:fn]; - if ([self isEditableCategory:category]) + if ([self isEditableCategory:category file: fn]) { [project browserDidDblClickFile:f category:category]; } @@ -76,7 +76,7 @@ } } -- (BOOL)isEditableCategory:(NSString *)category +- (BOOL)isEditableCategory:(NSString *)category file: (NSString *)title { NSString *k = [[project rootCategories] objectForKey:category]; @@ -90,6 +90,12 @@ return YES; } + if ([k isEqualToString:PCGSMarkupFiles] + && [[title pathExtension] isEqual: @"gorm"] == NO) + { + return YES; + } + return NO; } diff --git a/PCLib/PCProject.h b/PCLib/PCProject.h index ad2a163..f1dde63 100644 --- a/PCLib/PCProject.h +++ b/PCLib/PCProject.h @@ -81,6 +81,7 @@ typedef int PCProjInfoBits; static NSString * const PCClasses = @"CLASS_FILES"; static NSString * const PCHeaders = @"HEADER_FILES"; +static NSString * const PCGSMarkupFiles = @"INTERFACES"; static NSString * const PCOtherSources = @"OTHER_SOURCES"; static NSString * const PCOtherResources = @"OTHER_RESOURCES"; static NSString * const PCSupportingFiles = @"SUPPORTING_FILES"; diff --git a/PCLib/PCProject.m b/PCLib/PCProject.m index 11a2d07..c1cf875 100644 --- a/PCLib/PCProject.m +++ b/PCLib/PCProject.m @@ -138,6 +138,9 @@ if ([key isEqualToString:PCGModels]) { return [NSArray arrayWithObjects:@"gmodel",@"gorm",nil]; } + if ([key isEqualToString:PCGSMarkupFiles]) { + return [NSArray arrayWithObjects:@"gsmarkup",nil]; + } else if ([key isEqualToString:PCClasses]) { return [NSArray arrayWithObjects:@"m",nil]; } diff --git a/PCLib/PCProjectDebugger.m b/PCLib/PCProjectDebugger.m index 3aee02a..ca1e2c4 100644 --- a/PCLib/PCProjectDebugger.m +++ b/PCLib/PCProjectDebugger.m @@ -266,6 +266,7 @@ enum { */ if ([currentProject isKindOfClass:NSClassFromString(@"PCAppProject")] || + [currentProject isKindOfClass:NSClassFromString(@"PCRenaissanceProject")] || [currentProject isKindOfClass:NSClassFromString(@"PCGormProject")]) { NSString *tn; diff --git a/PCRenaissanceProj/AppController.h b/PCRenaissanceProj/AppController.h new file mode 100644 index 0000000..ae173a1 --- /dev/null +++ b/PCRenaissanceProj/AppController.h @@ -0,0 +1,25 @@ +/* + * AppController.h + * + * GNUstep Renaissance Application Controller + * + * Created with ProjectCenter - http://www.gnustep.org + */ + +#ifndef _APPCONTROLLER_H_ +#define _APPCONTROLLER_H_ + +#import +#import + +@interface AppController : NSObject +{ + +} + +- (void) applicationDidFinishLaunching: (NSNotification *)not; + +@end + +#endif // _APPCONTROLLER_H_ + diff --git a/PCRenaissanceProj/AppController.m b/PCRenaissanceProj/AppController.m new file mode 100644 index 0000000..479945a --- /dev/null +++ b/PCRenaissanceProj/AppController.m @@ -0,0 +1,18 @@ +/* + * AppController.m + * + * GNUstep Renaissance Application Controller + * + * Created with ProjectCenter - http://www.gnustep.org + * + */ + +#import "AppController.h" + +@implementation AppController + +- (void) applicationDidFinishLaunching: (NSNotification *)not +{ + [NSBundle loadGSMarkupNamed: @"Main" owner: self]; +} +@end diff --git a/PCRenaissanceProj/ChangeLog b/PCRenaissanceProj/ChangeLog new file mode 100644 index 0000000..60a2fdf --- /dev/null +++ b/PCRenaissanceProj/ChangeLog @@ -0,0 +1,4 @@ +2003-01-25 Daniel Luederwald + + * New project (copied and updated from PCGormProj). + diff --git a/PCRenaissanceProj/GNUmakefile b/PCRenaissanceProj/GNUmakefile new file mode 100644 index 0000000..230096e --- /dev/null +++ b/PCRenaissanceProj/GNUmakefile @@ -0,0 +1,76 @@ +# +# GNUmakefile - Generated by ProjectCenter +# Written by Philippe C.D. Robert +# +# 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=PCRenaissanceProj +BUNDLE_NAME=PCRenaissanceProj +BUNDLE_EXTENSION=.bundle +BUNDLE_INSTALL_DIR=$(GNUSTEP_INSTALLATION_DIR)/Library/ProjectCenter +PCRenaissanceProj_PRINCIPAL_CLASS=PCRenaissanceProj + + +# +# Additional libraries +# + +PCRenaissanceProj_LIBRARIES_DEPEND_UPON += -lProjectCenter + +# +# Resource files +# + +PCRenaissanceProj_RESOURCE_FILES= \ +PC.proj \ +main.m \ +AppController.m \ +AppController.h \ +Main.gsmarkup \ +MainMenu-GNUstep.gsmarkup \ +MainMenu-OSX.gsmarkup \ +Info-project.plist + +# +# Header files +# + +PCRenaissanceProj_HEADERS= \ +PCRenaissanceProj.h \ +PCRenaissanceProject.h + +# +# Class files +# + +PCRenaissanceProj_OBJC_FILES= \ +PCRenaissanceProj.m \ +PCRenaissanceProject.m + +# +# C files +# + +PCRenaissanceProj_C_FILES= + +-include GNUmakefile.preamble +-include GNUmakefile.local +include $(GNUSTEP_MAKEFILES)/bundle.make +-include GNUmakefile.postamble diff --git a/PCRenaissanceProj/GNUmakefile.postamble b/PCRenaissanceProj/GNUmakefile.postamble new file mode 100644 index 0000000..adfc278 --- /dev/null +++ b/PCRenaissanceProj/GNUmakefile.postamble @@ -0,0 +1,30 @@ +# +# Makefile.postamble +# +# Copyright (C) 2003 Free Software Foundation +# +# Author: Philippe C.D. Robert +# +# This file is part of GNUstep +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Library General Public +# License as published by the Free Software Foundation; either +# version 2 of the License, or (at your option) any later version. +# +# This library 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. +# +# If you are interested in a warranty or support for this source code, +# contact Scott Christley at scottc@net-community.com +# +# You should have received a copy of the GNU Library General Public +# License along with this library; see the file COPYING.LIB. +# If not, write to the Free Software Foundation, +# 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + + + + diff --git a/PCRenaissanceProj/GNUmakefile.preamble b/PCRenaissanceProj/GNUmakefile.preamble new file mode 100644 index 0000000..ae1902a --- /dev/null +++ b/PCRenaissanceProj/GNUmakefile.preamble @@ -0,0 +1,78 @@ +# +# Makefile.preamble +# +# Copyright (C) 2003 Free Software Foundation, Inc. +# +# Author: Philippe C.D. Robert +# +# This file is part of GNUstep +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Library General Public +# License as published by the Free Software Foundation; either +# version 2 of the License, or (at your option) any later version. +# +# This library 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. +# +# If you are interested in a warranty or support for this source code, +# contact Scott Christley at scottc@net-community.com +# +# You should have received a copy of the GNU Library General Public +# License along with this library; see the file COPYING.LIB. +# If not, write to the Free Software Foundation, +# 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + +# +# Makefile.preamble +# +# Project specific makefile variables, and additional +# +# Do not put any Makefile rules in this file, instead they should +# be put into Makefile.postamble. +# + +# +# Flags dealing with compiling and linking +# + +# 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_CFLAGS += + +# Additional include directories the compiler should search +ADDITIONAL_INCLUDE_DIRS += -I../PCLib + +# Additional LDFLAGS to pass to the linker +#ADDITIONAL_LDFLAGS += + +# Additional library directories the linker should search +ADDITIONAL_LIB_DIRS += -L../PCLib/$(GNUSTEP_OBJ_DIR) + +ADDITIONAL_TOOL_LIBS += + +# Not needed anymore, now managed by ProjectCenter +#PCGormProj_BUNDLE_LIBS = -lProjectCenter + + +# +# Flags dealing with installing and uninstalling +# + +# Additional directories to be created during installation +ADDITIONAL_INSTALL_DIRS += + +# +# Local configuration +# + + + diff --git a/PCRenaissanceProj/Info-project.plist b/PCRenaissanceProj/Info-project.plist new file mode 100644 index 0000000..ed865ab --- /dev/null +++ b/PCRenaissanceProj/Info-project.plist @@ -0,0 +1,12 @@ +{ + NOTE = "Automatically generated, do not edit!"; + ApplicationName = ""; + ApplicationDescription = ""; + ApplicationIcon = ""; + ApplicationRelease = ""; + FullVersionID = ""; + Authors = (); + URL = ""; + Copyright = ""; + CopyrightDescription = ""; +} diff --git a/PCRenaissanceProj/Info.table b/PCRenaissanceProj/Info.table new file mode 100644 index 0000000..e0861e8 --- /dev/null +++ b/PCRenaissanceProj/Info.table @@ -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$" + ); +} diff --git a/PCRenaissanceProj/Main.gsmarkup b/PCRenaissanceProj/Main.gsmarkup new file mode 100644 index 0000000..e403420 --- /dev/null +++ b/PCRenaissanceProj/Main.gsmarkup @@ -0,0 +1,8 @@ + + + + + + + + diff --git a/PCRenaissanceProj/MainMenu-GNUstep.gsmarkup b/PCRenaissanceProj/MainMenu-GNUstep.gsmarkup new file mode 100644 index 0000000..1272fa0 --- /dev/null +++ b/PCRenaissanceProj/MainMenu-GNUstep.gsmarkup @@ -0,0 +1,29 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/PCRenaissanceProj/MainMenu-OSX.gsmarkup b/PCRenaissanceProj/MainMenu-OSX.gsmarkup new file mode 100644 index 0000000..e30a79f --- /dev/null +++ b/PCRenaissanceProj/MainMenu-OSX.gsmarkup @@ -0,0 +1,50 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/PCRenaissanceProj/PC.proj b/PCRenaissanceProj/PC.proj new file mode 100644 index 0000000..6c5d77e --- /dev/null +++ b/PCRenaissanceProj/PC.proj @@ -0,0 +1,40 @@ +{ + APPCLASS = "NSApplication"; + APPKIT = "GNUSTEP-GUI"; + APPLICATIONICON = ""; + BUILDTOOL = "/usr/bin/make"; + CLASS_FILES = ("main.m", "AppController.m"); + COMPILEROPTIONS = ""; + LINKEROPTIONS = ""; + CREATION_DATE = ""; + DOCU_FILES = (); + FOUNDATION = "GNUSTEP-BASE"; + FRAMEWORKS = (); + HEADER_FILES = ("AppController.h"); + INTERFACES = ("Main.gsmarkup", "MainMenu-GNUstep.gsmarkup", "MainMenu-OSX.gsmarkup"); + IMAGES = (); + LANGUAGE = "English"; + LAST_EDITING = ""; + LIBRARIES = ("gnustep-base","gnustep-gui","Renaissance"); + MAININTERFACE = ""; + MAKEFILEDIR = "$(GNUSTEP_SYSTEM_ROOT)/Makefiles"; + INSTALLDIR = "$(GNUSTEP_LOCAL_ROOT)/"; + OTHER_FILES = (); + OTHER_RESOURCES = (); + OTHER_SOURCES = (); + PRINCIPAL_CLASS = "main.m"; + PROJECT_CREATOR = ""; + PROJECT_DESCRIPTION = "No description avaliable!"; + PROJECT_GROUP = "No description avaliable!"; + PROJECT_SUMMARY = "No summary avaliable!"; + PROJECT_RELEASE = "1"; + PROJECT_COPYRIGHT = "No license specified!"; + PROJECT_SOURCE = "%{gs_name}-%{gs_version}.tar.gz"; + PROJECT_MAINTAINER = ""; + PROJECT_NAME = ""; + PROJECT_TYPE = "RenaissanceApplication"; + PROJECT_BUILDER = "PCRenaissanceProj"; + PROJECT_VERSION = 1.0; + SUBPROJECTS = (); + SUPPORTING_FILES = ("GNUmakefile.preamble", "GNUmakefile", "GNUmakefile.postamble"); +} diff --git a/PCRenaissanceProj/PCRenaissanceProj.h b/PCRenaissanceProj/PCRenaissanceProj.h new file mode 100644 index 0000000..045dbf7 --- /dev/null +++ b/PCRenaissanceProj/PCRenaissanceProj.h @@ -0,0 +1,47 @@ +/* + GNUstep ProjectCenter - http://www.gnustep.org + + Copyright (C) 2003 Free Software Foundation + + Author: Philippe C.D. Robert + Modified by Daniel Luederwald + + 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. +*/ + +#import +#import + +@interface PCRenaissanceProj : NSObject +{ +} + +//---------------------------------------------------------------------------- +// ProjectType +//---------------------------------------------------------------------------- + ++ (id)sharedCreator; + +- (Class)projectClass; + +- (NSString *)projectTypeName; +- (NSDictionary *)typeTable; + +- (PCProject *)createProjectAt:(NSString *)path; +- (PCProject *)openProjectAt:(NSString *)path; + +@end diff --git a/PCRenaissanceProj/PCRenaissanceProj.m b/PCRenaissanceProj/PCRenaissanceProj.m new file mode 100644 index 0000000..9990364 --- /dev/null +++ b/PCRenaissanceProj/PCRenaissanceProj.m @@ -0,0 +1,195 @@ +/* + GNUstep ProjectCenter - http://www.gnustep.org + + Copyright (C) 2003 Free Software Foundation + Copyright (C) 2001 Pierre-Yves Rivaille + + Authors: Philippe C.D. Robert + Pierre-Yves Rivaille + + Modified by Daniel Luederwald + + 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. +*/ + +/* + Description: + + PCRenaissanceProj creates new project of the type RenaissanceApplication! + +*/ + +#import "PCRenaissanceProj.h" +#import "PCRenaissanceProject.h" + +@implementation PCRenaissanceProj + +static NSString *_projTypeName = @"RenaissanceApplication"; +static PCRenaissanceProj *_creator = nil; + +//---------------------------------------------------------------------------- +// ProjectType +//---------------------------------------------------------------------------- + ++ (id)sharedCreator +{ + if (!_creator) { + _creator = [[[self class] alloc] init]; + } + return _creator; +} + +- (Class)projectClass +{ + return [PCRenaissanceProject class]; +} + +- (NSString *)projectTypeName +{ + return _projTypeName; +} + +- (NSDictionary *)typeTable +{ + NSString *_path = [[NSBundle bundleForClass:[self class]] pathForResource:@"Info" ofType:@"table"]; + + return [NSDictionary dictionaryWithContentsOfFile:_path]; +} + +- (PCProject *)createProjectAt:(NSString *)path +{ + PCRenaissanceProject *project = nil; + NSFileManager *fm = [NSFileManager defaultManager]; + + NSAssert(path,@"No valid project path provided!"); + + if ([fm createDirectoryAtPath:path attributes:nil]) { + NSString *_file; + NSString *_resourcePath; + NSMutableDictionary *dict; + NSDictionary *infoDict; + NSString *plistFileName; + NSString *projectFile; + + project = [[[PCRenaissanceProject alloc] init] autorelease]; + + _file = [[NSBundle bundleForClass:[self class]] pathForResource:@"PC" ofType:@"proj"]; + dict = [NSMutableDictionary dictionaryWithContentsOfFile:_file]; + + // Customise the project + [dict setObject:[path lastPathComponent] forKey:PCProjectName]; +#ifndef GNUSTEP_BASE_VERSION + [dict setObject:[[project principalClass] description] forKey:PCProjType]; +#else + [dict setObject:[project principalClass] forKey:PCProjType]; +#endif + + // Create the AppNameInfo.plist + infoDict = [NSDictionary dictionaryWithObjectsAndKeys: + @"Automatically generated!",@"NOTE", + [path lastPathComponent],@"ApplicationName", + @"",@"ApplicationDescription", + @"",@"ApplicationIcon", + @"0.1",@"ApplicationRelease", + @"0.1",@"FullVersionID", + @"",@"Authors", + @"",@"URL", + @"Copyright (C) 200x by ...",@"Copyright", + @"Released under ...",@"CopyrightDescription", nil]; + plistFileName = [NSString stringWithFormat:@"%@Info.plist",[path lastPathComponent]]; + [infoDict writeToFile:[path stringByAppendingPathComponent:plistFileName] atomically:YES]; + + [dict setObject:[NSArray arrayWithObjects:plistFileName,nil] + forKey:PCOtherResources]; + // [dict setObject:[NSArray arrayWithObject:[NSString stringWithFormat: @"%@.gsmarkup", [path lastPathComponent]]] + [dict setObject:[NSArray arrayWithObjects: @"Main.gsmarkup", @"MainMenu-GNUstep.gsmarkup", @"MainMenu-OSX.gsmarkup",nil] + forKey:PCGModels]; + + // Save the project to disc + projectFile = [NSString stringWithString:[path lastPathComponent]]; + projectFile = [projectFile stringByAppendingPathExtension:@"pcproj"]; + [dict writeToFile:[path stringByAppendingPathComponent:projectFile] + atomically:YES]; + + /* + * Copy the project files to the provided path + * + */ + + _file = [[NSBundle bundleForClass:[self class]] pathForResource:@"GNUmakefile" ofType:@"postamble"]; + [fm copyPath:_file toPath:[path stringByAppendingPathComponent:@"GNUmakefile.postamble"] handler:nil]; + + _file = [[NSBundle bundleForClass:[self class]] pathForResource:@"GNUmakefile" ofType:@"preamble"]; + [fm copyPath:_file toPath:[path stringByAppendingPathComponent:@"GNUmakefile.preamble"] handler:nil]; + + _file = [[NSBundle bundleForClass:[self class]] pathForResource:@"main" ofType:@"m"]; + [fm copyPath:_file toPath:[path stringByAppendingPathComponent:@"main.m"] handler:nil]; + + _file = [[NSBundle bundleForClass:[self class]] pathForResource:@"MainMenu-GNUstep" ofType:@"gsmarkup"]; + [fm copyPath:_file toPath:[path stringByAppendingPathComponent:@"MainMenu-GNUstep.gsmarkup"] handler:nil]; + + + _file = [[NSBundle bundleForClass:[self class]] pathForResource:@"MainMenu-OSX" ofType:@"gsmarkup"]; + [fm copyPath:_file toPath:[path stringByAppendingPathComponent:@"MainMenu-OSX.gsmarkup"] handler:nil]; + + + _file = [[NSBundle bundleForClass:[self class]] pathForResource:@"Main" ofType:@"gsmarkup"]; + [fm copyPath:_file toPath:[path stringByAppendingPathComponent:@"Main.gsmarkup"] handler:nil]; + + _file = [[NSBundle bundleForClass:[self class]] pathForResource:@"AppController" ofType:@"m"]; + [fm copyPath:_file toPath:[path stringByAppendingPathComponent:@"AppController.m"] handler:nil]; + + _file = [[NSBundle bundleForClass:[self class]] pathForResource:@"AppController" ofType:@"h"]; + [fm copyPath:_file toPath:[path stringByAppendingPathComponent:@"AppController.h"] handler:nil]; + + _file = [[NSBundle bundleForClass:[self class]] pathForResource:@"baseInterface" ofType:@"gsmarkup"]; + [fm copyPath:_file toPath:[path stringByAppendingPathComponent: + [[path lastPathComponent] stringByAppendingString: @".gsmarkup"]] 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]; + + // 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:dict]) { + NSRunAlertPanel(@"Attention!",@"Could not load %@!",@"OK",nil,nil,path); + return nil; + } + } + return project; +} + +- (PCProject *)openProjectAt:(NSString *)path +{ + NSDictionary *dict = [NSDictionary dictionaryWithContentsOfFile:path]; + id obj; + + NSLog(@"<%@ %x>: opening project at %@",[self class],self,path); + + obj = [dict objectForKey:PCProjectBuilderClass]; + if ([obj isEqualToString:@"PCRenaissanceProj"]) { + return [[[PCRenaissanceProject alloc] initWithProjectDictionary:dict path:[path stringByDeletingLastPathComponent]] autorelease]; + } + return nil; +} + +@end diff --git a/PCRenaissanceProj/PCRenaissanceProj.pcproj b/PCRenaissanceProj/PCRenaissanceProj.pcproj new file mode 100644 index 0000000..592568d --- /dev/null +++ b/PCRenaissanceProj/PCRenaissanceProj.pcproj @@ -0,0 +1,68 @@ +{ + APPCLASS = NSApplication; + APPKIT = GNUSTEP-GUI; + APPLICATIONICON = ""; + BUILDTOOL = "/usr/local/bin/gmake"; + CLASS_FILES = ( + PCRenaissanceProj.m, + PCRenaissanceProject.m + ); + COMPILEROPTIONS = ""; + CREATION_DATE = ""; + DOCU_FILES = ( + ); + FOUNDATION = GNUSTEP-BASE; + FRAMEWORKS = ( + ); + HEADER_FILES = ( + PCRenaissanceProj.h, + PCRenaissanceProject.h + ); + IMAGES = ( + ); + INSTALLDIR = "$(GNUSTEP_INSTALLATION_DIR)/Library/ProjectCenter"; + INTERFACES = ( + ); + LANGUAGE = English; + LAST_EDITING = ""; + LIBRARIES = ( + gnustep-base, + gnustep-gui, + ProjectCenter + ); + LINKEROPTIONS = ""; + MAININTERFACE = ""; + MAKEFILEDIR = "$(GNUSTEP_SYSTEM_ROOT)/Makefiles"; + OTHER_FILES = ( + ); + OTHER_RESOURCES = ( + PC.proj, + main.m, + Main.gsmarkup, + MainMenu-GNUstep.gsmarkup, + MainMenu-OSX.gsmarkup, + Info-project.plist + ); + OTHER_SOURCES = ( + ); + PRINCIPAL_CLASS = PCRenaissanceProj; + PROJECT_BUILDER = PCBundleProj; + PROJECT_COPYRIGHT = "No license specified!"; + PROJECT_CREATOR = ""; + PROJECT_DESCRIPTION = "No description avaliable!"; + PROJECT_GROUP = "No description avaliable!"; + PROJECT_MAINTAINER = ""; + PROJECT_NAME = PCGormProj; + PROJECT_RELEASE = 1; + PROJECT_SOURCE = "%{gs_name}-%{gs_version}.tar.gz"; + PROJECT_SUMMARY = "No summary avaliable!"; + PROJECT_TYPE = PCBundleProject; + PROJECT_VERSION = 1.0; + SUBPROJECTS = ( + ); + SUPPORTING_FILES = ( + GNUmakefile.preamble, + GNUmakefile, + GNUmakefile.postamble + ); +} diff --git a/PCRenaissanceProj/PCRenaissanceProject.h b/PCRenaissanceProj/PCRenaissanceProject.h new file mode 100644 index 0000000..a787947 --- /dev/null +++ b/PCRenaissanceProj/PCRenaissanceProject.h @@ -0,0 +1,82 @@ +/* + GNUstep ProjectCenter - http://www.gnustep.org + + Copyright (C) 2003 Free Software Foundation + + Author: Philippe C.D. Robert + Modified by Daniel Luederwald + + 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. +*/ + +/* + Description: + + This is the project type 'RenaissanceApplication' for GNUstep. You never should create + it yourself but use PCRenaissanceProj for doing this. Otherwise needed files don't + get copied to the right place. + + */ + +#import +#import + +@interface PCRenaissanceProject : PCProject +{ + NSTextField *appClassField; + NSTextField *appImageField; + NSButton *setAppIconButton; + NSButton *clearAppIconButton; + NSImageView *appIconView; + NSImage *icon; +} + +//---------------------------------------------------------------------------- +// Init and free +//---------------------------------------------------------------------------- + +- (id)init; +- (void)dealloc; + +//---------------------------------------------------------------------------- +// Project +//---------------------------------------------------------------------------- + +- (Class)builderClass; + +- (BOOL)writeMakefile; + +- (NSArray *)sourceFileKeys; +- (NSArray *)resourceFileKeys; +- (NSArray *)otherKeys; +- (NSArray *)buildTargets; +- (NSString *)projectDescription; + +- (BOOL)isExecutable; + +- (void)updateValuesFromProjectDict; + +- (void)clearAppIcon:(id)sender; +- (void)setAppIcon:(id)sender; + +- (BOOL)setAppIconWithImageAtPath:(NSString *)path; + +- (void)setAppClass:(id)sender; + +@end + + diff --git a/PCRenaissanceProj/PCRenaissanceProject.m b/PCRenaissanceProj/PCRenaissanceProject.m new file mode 100644 index 0000000..6bf462b --- /dev/null +++ b/PCRenaissanceProj/PCRenaissanceProject.m @@ -0,0 +1,326 @@ +/* + GNUstep ProjectCenter - http://www.gnustep.org + + Copyright (C) 2003 Free Software Foundation + + Authors: Philippe C.D. Robert + Modified by Daniel Luederwald + + 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. +*/ + +#import "PCRenaissanceProject.h" +#import "PCRenaissanceProj.h" + +#import + +@interface PCRenaissanceProject (CreateUI) + +- (void)_initUI; + +@end + +@implementation PCRenaissanceProject (CreateUI) + +- (void)_initUI +{ + NSTextField *textField; + NSRect frame = {{84,120}, {80, 80}}; + NSBox *_box; + + [super _initUI]; + + textField =[[NSTextField alloc] initWithFrame:NSMakeRect(16,256,64,21)]; + [textField setAlignment: NSRightTextAlignment]; + [textField setBordered: NO]; + [textField setEditable: NO]; + [textField setBezeled: NO]; + [textField setDrawsBackground: NO]; + [textField setStringValue:@"App class:"]; + [projectProjectInspectorView addSubview:textField]; + RELEASE(textField); + + appClassField =[[NSTextField alloc] initWithFrame:NSMakeRect(84,256,176,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:)]; + [projectProjectInspectorView addSubview:appClassField]; + + textField =[[NSTextField alloc] initWithFrame:NSMakeRect(16,204,64,21)]; + [textField setAlignment: NSRightTextAlignment]; + [textField setBordered: NO]; + [textField setEditable: NO]; + [textField setBezeled: NO]; + [textField setDrawsBackground: NO]; + [textField setStringValue:@"App icon:"]; + [projectProjectInspectorView addSubview:textField]; + RELEASE(textField); + + appImageField =[[NSTextField alloc] initWithFrame:NSMakeRect(84,204,176,21)]; + [appImageField setAlignment: NSLeftTextAlignment]; + [appImageField setBordered: YES]; + [appImageField setEditable: NO]; + [appImageField setBezeled: YES]; + [appImageField setDrawsBackground: YES]; + [appImageField setStringValue:@""]; + [projectProjectInspectorView addSubview:appImageField]; + + setAppIconButton =[[NSButton alloc] initWithFrame:NSMakeRect(220,180,40,21)]; + [setAppIconButton setTitle:@"Set"]; + [setAppIconButton setTarget:self]; + [setAppIconButton setAction:@selector(setAppIcon:)]; + [projectProjectInspectorView addSubview:setAppIconButton]; + + clearAppIconButton =[[NSButton alloc] initWithFrame:NSMakeRect(180,180,40,21)]; + [clearAppIconButton setTitle:@"Clear"]; + [clearAppIconButton setTarget:self]; + [clearAppIconButton setAction:@selector(clearAppIcon:)]; + [projectProjectInspectorView addSubview:clearAppIconButton]; + + _box = [[NSBox alloc] init]; + [_box setFrame:frame]; + [_box setTitlePosition:NSNoTitle]; + [_box setBorderType:NSBezelBorder]; + [projectProjectInspectorView addSubview:_box]; + + appIconView = [[NSImageView alloc] initWithFrame:frame]; + [_box addSubview:appIconView]; + + RELEASE(_box); + RELEASE(setAppIconButton); + RELEASE(clearAppIconButton); + RELEASE(appIconView); +} + +@end + +@implementation PCRenaissanceProject + +//---------------------------------------------------------------------------- +// Init and free +//---------------------------------------------------------------------------- + +- (id)init +{ + if ((self = [super init])) { + rootCategories = [[NSDictionary dictionaryWithObjectsAndKeys: + PCGModels,@"Interfaces", + PCSupportingFiles,@"Supporting Files", + PCImages,@"Images", + PCOtherResources,@"Other Resources", + PCSubprojects,@"Subprojects", + PCLibraries,@"Libraries", + PCDocuFiles,@"Documentation", + PCOtherSources,@"Other Sources", + PCHeaders,@"Headers", + PCClasses,@"Classes", + nil] retain]; + + } + return self; +} + +- (void)dealloc +{ + [rootCategories release]; + [appClassField release]; + [appImageField release]; + + [super dealloc]; +} + +//---------------------------------------------------------------------------- +// Project +//---------------------------------------------------------------------------- + +- (Class)builderClass +{ + return [PCRenaissanceProj class]; +} + +- (BOOL)writeMakefile +{ + NSData *mfd; + NSString *mfl = [projectPath stringByAppendingPathComponent:@"GNUmakefile"]; + int i; + PCMakefileFactory *mf = [PCMakefileFactory sharedFactory]; + NSDictionary *dict = [self projectDict]; + + // Save the project file + [super writeMakefile]; + + // Create the new file + [mf createMakefileForProject:[self projectName]]; + + [mf appendString:@"include $(GNUSTEP_MAKEFILES)/common.make\n"]; + + [mf appendSubprojects:[dict objectForKey:PCSubprojects]]; + + [mf appendApplication]; + [mf appendInstallDir:[dict objectForKey:PCInstallDir]]; + [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]; + [mf appendResourceItems:[dict objectForKey:k]]; + } + + [mf appendHeaders:[dict objectForKey:PCHeaders]]; + [mf appendClasses:[dict objectForKey:PCClasses]]; + [mf appendCFiles:[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 *)sourceFileKeys +{ + return [NSArray arrayWithObjects:PCClasses,PCOtherSources,nil]; +} + +- (NSArray *)resourceFileKeys +{ + return [NSArray arrayWithObjects:PCGModels,PCOtherResources,PCImages,nil]; +} + +- (NSArray *)otherKeys +{ + return [NSArray arrayWithObjects:PCDocuFiles,PCSupportingFiles,nil]; +} + +- (NSArray *)buildTargets +{ + return nil; +} + +- (NSString *)projectDescription +{ + return @"Project that handles GNUstep/ObjC based applications."; +} + +- (BOOL)isExecutable +{ + return YES; +} + +- (void)updateValuesFromProjectDict +{ + NSRect frame = {{0,0}, {64, 64}}; + NSImage *image; + NSString *path = nil; + NSString *_icon; + + [super updateValuesFromProjectDict]; + + [appClassField setStringValue:[projectDict objectForKey:PCAppClass]]; + [appImageField setStringValue:[projectDict objectForKey:PCAppIcon]]; + + if ((_icon = [projectDict objectForKey:PCAppIcon])) { + path = [projectPath stringByAppendingPathComponent:_icon]; + } + + if (path && (image = [[NSImage alloc] initWithContentsOfFile:path])) { + frame.size = [image size]; + [appIconView setFrame:frame]; + [appIconView setImage:image]; + [appIconView display]; + RELEASE(image); + } +} + +- (void)clearAppIcon:(id)sender +{ + [projectDict setObject:@"" forKey:PCAppIcon]; + [appImageField setStringValue:@"No Icon!"]; + [appIconView setImage:nil]; + [appIconView display]; + + [projectWindow setDocumentEdited:YES]; +} + +- (void)setAppIcon:(id)sender +{ + int result; + NSArray *fileTypes = [NSImage imageFileTypes]; + NSOpenPanel *openPanel = [NSOpenPanel openPanel]; + + [openPanel setAllowsMultipleSelection:NO]; + result = [openPanel runModalForDirectory:NSHomeDirectory() + file:nil + types:fileTypes]; + + if (result == NSOKButton) { + NSArray *files = [openPanel filenames]; + NSString *imageFilePath = [files 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; + + if (!(image = [[NSImage alloc] initWithContentsOfFile:path])) { + return NO; + } + + [self addFile:path forKey:PCImages copy:YES]; + [projectDict setObject:[path lastPathComponent] forKey:PCAppIcon]; + + [appImageField setStringValue:[path lastPathComponent]]; + + frame.size = [image size]; + [appIconView setFrame:frame]; + [appIconView setImage:image]; + [appIconView display]; + RELEASE(image); + + [projectWindow setDocumentEdited:YES]; + + return YES; +} + +- (void)setAppClass:(id)sender +{ + [projectDict setObject:[appClassField stringValue] forKey:PCAppClass]; + [projectWindow setDocumentEdited:YES]; +} + +@end diff --git a/PCRenaissanceProj/h.template b/PCRenaissanceProj/h.template new file mode 100644 index 0000000..7b523c7 --- /dev/null +++ b/PCRenaissanceProj/h.template @@ -0,0 +1,11 @@ +$$ +/* $FILENAME$ created by $USERNAME$ on $DATE$ */ + +#import + +@interface $FILENAMESANSEXTENSION$ : NSObject +{ + +} + +@end diff --git a/PCRenaissanceProj/m.template b/PCRenaissanceProj/m.template new file mode 100644 index 0000000..1216fe5 --- /dev/null +++ b/PCRenaissanceProj/m.template @@ -0,0 +1,18 @@ +$$ Lines starting with $$ are not inserted into newly created files +$$ The following substitutions are made: +$$ +$$ $FILENAME$ e.g. foo.m +$$ $FILENAMESANSEXTENSION$ e.g. foo +$$ $DIRECTORY$ e.g. /tmp/MyNewApp +$$ $PROJECTNAME$ e.g. MyNewApp +$$ $SUBPROJECTNAME$ e.g. TheGoodPart.subproj +$$ $USERNAME$ e.g. mwagner +$$ $DATE$ e.g. Jan-1-1994 +$$ +/* $FILENAME$ created by $USERNAME$ on $DATE$ */ + +#import "$FILENAMESANSEXTENSION$.h" + +@implementation $FILENAMESANSEXTENSION$ + +@end diff --git a/PCRenaissanceProj/main.m b/PCRenaissanceProj/main.m new file mode 100644 index 0000000..ebae4f8 --- /dev/null +++ b/PCRenaissanceProj/main.m @@ -0,0 +1,27 @@ +#import +#import +#import +#import "AppController.h" + + +/* + * Initialise and go! + */ + +int main(int argc, const char *argv[]) +{ + 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); + +} diff --git a/ProjectCenter/PCMenuController.m b/ProjectCenter/PCMenuController.m index 0b87bf2..52d3981 100644 --- a/ProjectCenter/PCMenuController.m +++ b/ProjectCenter/PCMenuController.m @@ -55,6 +55,7 @@ projectTypeAccessaryView = [[NSBox alloc] init]; projectTypePopup = [[NSPopUpButton alloc] initWithFrame:fr pullsDown:NO]; + [projectTypePopup setAutoenablesItems: NO]; [projectTypePopup addItemWithTitle:@"No type available!"]; [projectTypeAccessaryView setTitle:@"Project Types"];